UNPKG

libnexa-ts

Version:

A pure and powerful Nexa SDK library.

1,270 lines (1,179 loc) 375 kB
var $2u1Tt$crypto = require("crypto"); var $2u1Tt$bnjs = require("bn.js"); var $2u1Tt$jsbigdecimal = require("js-big-decimal"); var $2u1Tt$elliptic = require("elliptic"); var $2u1Tt$bs58 = require("bs58"); function $parcel$export(e, n, v, s) { Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true}); } var $parcel$global = globalThis; function $parcel$defineInteropFlag(a) { Object.defineProperty(a, '__esModule', {value: true, configurable: true}); } function $parcel$interopDefault(a) { return a && a.__esModule ? a.default : a; } var $parcel$modules = {}; var $parcel$inits = {}; var parcelRequire = $parcel$global["parcelRequirec94d"]; if (parcelRequire == null) { parcelRequire = function(id) { if (id in $parcel$modules) { return $parcel$modules[id].exports; } if (id in $parcel$inits) { var init = $parcel$inits[id]; delete $parcel$inits[id]; var module = {id: id, exports: {}}; $parcel$modules[id] = module; init.call(module.exports, module, module.exports); return module.exports; } var err = new Error("Cannot find module '" + id + "'"); err.code = 'MODULE_NOT_FOUND'; throw err; }; parcelRequire.register = function register(id, init) { $parcel$inits[id] = init; }; $parcel$global["parcelRequirec94d"] = parcelRequire; } var parcelRegister = parcelRequire.register; parcelRegister("9CWxJ", function(module, exports) { $parcel$export(module.exports, "default", () => $7025131d3698d998$export$2e2bcd8739ae039); var $1rFgO = parcelRequire("1rFgO"); var $8nqVO = parcelRequire("8nqVO"); /** Detect free variable `exports`. */ var freeExports = exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && true && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Built-in value references. */ var Buffer = moduleExports ? (0, $1rFgO.default).Buffer : undefined; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; /** * Checks if `value` is a buffer. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. * @example * * _.isBuffer(new Buffer(2)); * // => true * * _.isBuffer(new Uint8Array(2)); * // => false */ var isBuffer = nativeIsBuffer || (0, $8nqVO.default); var $7025131d3698d998$export$2e2bcd8739ae039 = isBuffer; }); parcelRegister("1rFgO", function(module, exports) { $parcel$export(module.exports, "default", () => $10d85371782a38a1$export$2e2bcd8739ae039); var $4inLA = parcelRequire("4inLA"); /** Detect free variable `self`. */ var $10d85371782a38a1$var$freeSelf = typeof self == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var $10d85371782a38a1$var$root = (0, $4inLA.default) || $10d85371782a38a1$var$freeSelf || Function('return this')(); var $10d85371782a38a1$export$2e2bcd8739ae039 = $10d85371782a38a1$var$root; }); parcelRegister("4inLA", function(module, exports) { $parcel$export(module.exports, "default", () => $320b476c3c6c072a$export$2e2bcd8739ae039); /** Detect free variable `global` from Node.js. */ var $320b476c3c6c072a$var$freeGlobal = typeof $parcel$global == 'object' && $parcel$global && $parcel$global.Object === Object && $parcel$global; var $320b476c3c6c072a$export$2e2bcd8739ae039 = $320b476c3c6c072a$var$freeGlobal; }); parcelRegister("8nqVO", function(module, exports) { $parcel$export(module.exports, "default", () => $61955cb7a6b881d7$export$2e2bcd8739ae039); /** * This method returns `false`. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {boolean} Returns `false`. * @example * * _.times(2, _.stubFalse); * // => [false, false] */ function $61955cb7a6b881d7$var$stubFalse() { return false; } var $61955cb7a6b881d7$export$2e2bcd8739ae039 = $61955cb7a6b881d7$var$stubFalse; }); parcelRegister("3rCfz", function(module, exports) { $parcel$export(module.exports, "default", () => $2821906aaea807d2$export$2e2bcd8739ae039); var $4inLA = parcelRequire("4inLA"); /** Detect free variable `exports`. */ var freeExports = exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && true && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Detect free variable `process` from Node.js. */ var freeProcess = moduleExports && (0, $4inLA.default).process; /** Used to access faster Node.js helpers. */ var nodeUtil = function() { try { // Use `util.types` for Node.js 10+. var types = freeModule && freeModule.require && freeModule.require('util').types; if (types) return types; // Legacy `process.binding('util')` for Node.js < 10. return freeProcess && freeProcess.binding && freeProcess.binding('util'); } catch (e) {} }(); var $2821906aaea807d2$export$2e2bcd8739ae039 = nodeUtil; }); $parcel$defineInteropFlag(module.exports); $parcel$export(module.exports, "Networks", () => $a5a7c3c2578bd308$export$2e8191f482a38ccd); $parcel$export(module.exports, "default", () => $a5a7c3c2578bd308$export$2e2bcd8739ae039); $parcel$export(module.exports, "BNExtended", () => $643a25691531d779$export$2e2bcd8739ae039); $parcel$export(module.exports, "Point", () => $2523ecb8fa4dc663$export$2e2bcd8739ae039); $parcel$export(module.exports, "Hash", () => $09ee79c40e4d73c0$export$2e2bcd8739ae039); $parcel$export(module.exports, "Signature", () => $75793ec13d8587b4$export$2e2bcd8739ae039); $parcel$export(module.exports, "DigitalSignature", () => $afff291f92244d6e$export$2e2bcd8739ae039); $parcel$export(module.exports, "ECDSA", () => $61484a8f288f2e6f$export$2e2bcd8739ae039); $parcel$export(module.exports, "Schnorr", () => $e6f2e702a25ea4f6$export$2e2bcd8739ae039); $parcel$export(module.exports, "BufferReader", () => $bc22c844686c075e$export$2e2bcd8739ae039); $parcel$export(module.exports, "BufferWriter", () => $abe6a353ddb9f06e$export$2e2bcd8739ae039); $parcel$export(module.exports, "Network", () => $8bb3feb46a212adc$export$95be4ae94445245a); $parcel$export(module.exports, "NetworkManager", () => $ea9564eebdf0c3b1$export$2e2bcd8739ae039); $parcel$export(module.exports, "UnitType", () => $b93cfeb076d56b43$export$80d48287646c9e3b); $parcel$export(module.exports, "UnitUtils", () => $b93cfeb076d56b43$export$2e2bcd8739ae039); $parcel$export(module.exports, "BufferUtils", () => $e15ce05834df1029$export$2e2bcd8739ae039); $parcel$export(module.exports, "CommonUtils", () => $f59639688aed9fb7$export$2e2bcd8739ae039); $parcel$export(module.exports, "PrivateKey", () => $148fc09b840d5369$export$2e2bcd8739ae039); $parcel$export(module.exports, "PublicKey", () => $ddd420490879056b$export$2e2bcd8739ae039); $parcel$export(module.exports, "HDPrivateKey", () => $3ea6d2d715c0e283$export$2e2bcd8739ae039); $parcel$export(module.exports, "HDPublicKey", () => $e57c1f42725c251e$export$2e2bcd8739ae039); $parcel$export(module.exports, "Opcode", () => $501ed26bc5405c78$export$393941f88fd16991); $parcel$export(module.exports, "ScriptOpcode", () => $501ed26bc5405c78$export$2e2bcd8739ae039); $parcel$export(module.exports, "Script", () => $4f3e0170e0844d3e$export$2e2bcd8739ae039); $parcel$export(module.exports, "ScriptFactory", () => $b1d53405081d1a14$export$2e2bcd8739ae039); $parcel$export(module.exports, "Address", () => $8164bb5f41e91211$export$2e2bcd8739ae039); $parcel$export(module.exports, "AddressType", () => $0cb9a5190d372c3f$export$189c6ba3eaa96ac2); $parcel$export(module.exports, "Block", () => $e3527bdbe21fa19e$export$2e2bcd8739ae039); $parcel$export(module.exports, "BlockHeader", () => $e410e45f3f7024e2$export$2e2bcd8739ae039); $parcel$export(module.exports, "SighashType", () => $b754e2bb1b68f34d$export$2e2bcd8739ae039); $parcel$export(module.exports, "InputSighashType", () => $b754e2bb1b68f34d$export$ae38be9ef660d12e); $parcel$export(module.exports, "OutputSighashType", () => $b754e2bb1b68f34d$export$cc0d5ed6c4786851); $parcel$export(module.exports, "Transaction", () => $6c5d9f2f8b3d4ca7$export$2e2bcd8739ae039); $parcel$export(module.exports, "UnspentOutput", () => $3849d1751d8f3b99$export$2e2bcd8739ae039); $parcel$export(module.exports, "Output", () => $33426531828162bf$export$2e2bcd8739ae039); $parcel$export(module.exports, "OutputType", () => $33426531828162bf$export$be94d7b677b041dd); $parcel$export(module.exports, "Input", () => $82b8fd1ac0665923$export$2e2bcd8739ae039); $parcel$export(module.exports, "InputType", () => $82b8fd1ac0665923$export$476dfc2401bc286b); $parcel$export(module.exports, "PublicKeyTemplateInput", () => $ec2616f96081aff1$export$2e2bcd8739ae039); $parcel$export(module.exports, "ScriptTemplateInput", () => $4513d83808a5b718$export$2e2bcd8739ae039); $parcel$export(module.exports, "PublicKeyHashInput", () => $052841338e3c2839$export$2e2bcd8739ae039); $parcel$export(module.exports, "TxSigner", () => $402608c73a428c6c$export$2e2bcd8739ae039); $parcel$export(module.exports, "TxSignature", () => $e0a34455af5d5538$export$2e2bcd8739ae039); $parcel$export(module.exports, "TransactionBuilder", () => $80e833b71125885c$export$2e2bcd8739ae039); $parcel$export(module.exports, "Message", () => $d5e83da52d74ff26$export$2e2bcd8739ae039); $parcel$export(module.exports, "GroupToken", () => $ab819013bfcb2c83$export$2e2bcd8739ae039); $parcel$export(module.exports, "GroupIdFlag", () => $ab819013bfcb2c83$export$7b9ebdcfe3200497); $parcel$export(module.exports, "GroupIdType", () => $ab819013bfcb2c83$export$8da1cb8322810fc2); var $f578eb98aee426c3$exports = {}; $f578eb98aee426c3$exports = JSON.parse("{\"name\":\"libnexa-ts\",\"version\":\"1.0.6\",\"description\":\"A pure and powerful Nexa SDK library.\",\"type\":\"module\",\"source\":\"src/index.ts\",\"types\":\"dist/index.d.ts\",\"main\":\"dist/index.cjs\",\"module\":\"dist/index.mjs\",\"browser\":\"dist/index.web.mjs\",\"exports\":{\"types\":\"./dist/index.d.ts\",\"node\":{\"import\":\"./dist/index.mjs\",\"require\":\"./dist/index.cjs\"},\"browser\":\"./dist/index.web.mjs\",\"default\":\"./dist/index.mjs\"},\"targets\":{\"main\":{\"context\":\"node\",\"outputFormat\":\"commonjs\",\"distDir\":\"dist\",\"isLibrary\":true,\"includeNodeModules\":[\"lodash-es\"]},\"module\":{\"context\":\"node\",\"outputFormat\":\"esmodule\",\"distDir\":\"dist\",\"isLibrary\":true},\"browser\":{\"context\":\"browser\",\"outputFormat\":\"esmodule\",\"distDir\":\"dist\",\"isLibrary\":true}},\"files\":[\"dist\"],\"scripts\":{\"check\":\"tsc --noEmit && npm run madge\",\"build\":\"del-cli ./dist && parcel build\",\"lint\":\"eslint .\",\"madge\":\"madge --circular src/index.ts\",\"test\":\"vitest run --dir tests\",\"coverage\":\"del-cli ./coverage && npm test -- --coverage --reporter=verbose --reporter=junit\",\"docs\":\"typedoc\"},\"keywords\":[\"nexa\",\"blockchain\"],\"repository\":{\"type\":\"git\",\"url\":\"https://gitlab.com/nexa/libnexa-ts\"},\"author\":\"vgrunner\",\"license\":\"MIT\",\"dependencies\":{\"bn.js\":\"^5.2.2\",\"bs58\":\"^6.0.0\",\"elliptic\":\"^6.6.1\",\"js-big-decimal\":\"^2.2.0\",\"lodash-es\":\"^4.17.21\"},\"devDependencies\":{\"@parcel/packager-ts\":\"^2.15.4\",\"@parcel/transformer-typescript-types\":\"^2.15.4\",\"@types/bn.js\":\"^5.2.0\",\"@types/elliptic\":\"^6.4.18\",\"@types/lodash-es\":\"^4.17.12\",\"@types/node\":\"^24.0.8\",\"@vitest/coverage-v8\":\"^3.2.4\",\"del-cli\":\"^6.0.0\",\"eslint\":\"^9.30.0\",\"madge\":\"^8.0.0\",\"parcel\":\"^2.15.4\",\"typedoc\":\"^0.28.7\",\"typedoc-plugin-markdown\":\"^4.7.0\",\"typedoc-plugin-rename-defaults\":\"^0.7.3\",\"typescript\":\"^5.8.3\",\"typescript-eslint\":\"^8.35.1\",\"vitest\":\"^3.0.6\"},\"@parcel/resolver-default\":{\"packageExports\":true},\"madge\":{\"detectiveOptions\":{\"ts\":{\"skipTypeImports\":true}}}}"); var $1rFgO = parcelRequire("1rFgO"); /** Built-in value references. */ var $835b893372538428$var$Symbol = (0, $1rFgO.default).Symbol; var $835b893372538428$export$2e2bcd8739ae039 = $835b893372538428$var$Symbol; /** Used for built-in method references. */ var $68b7694a039a1d75$var$objectProto = Object.prototype; /** Used to check objects for own properties. */ var $68b7694a039a1d75$var$hasOwnProperty = $68b7694a039a1d75$var$objectProto.hasOwnProperty; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var $68b7694a039a1d75$var$nativeObjectToString = $68b7694a039a1d75$var$objectProto.toString; /** Built-in value references. */ var $68b7694a039a1d75$var$symToStringTag = (0, $835b893372538428$export$2e2bcd8739ae039) ? (0, $835b893372538428$export$2e2bcd8739ae039).toStringTag : undefined; /** * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. * * @private * @param {*} value The value to query. * @returns {string} Returns the raw `toStringTag`. */ function $68b7694a039a1d75$var$getRawTag(value) { var isOwn = $68b7694a039a1d75$var$hasOwnProperty.call(value, $68b7694a039a1d75$var$symToStringTag), tag = value[$68b7694a039a1d75$var$symToStringTag]; try { value[$68b7694a039a1d75$var$symToStringTag] = undefined; var unmasked = true; } catch (e) {} var result = $68b7694a039a1d75$var$nativeObjectToString.call(value); if (unmasked) { if (isOwn) value[$68b7694a039a1d75$var$symToStringTag] = tag; else delete value[$68b7694a039a1d75$var$symToStringTag]; } return result; } var $68b7694a039a1d75$export$2e2bcd8739ae039 = $68b7694a039a1d75$var$getRawTag; /** Used for built-in method references. */ var $a7a24c904bb1f1e0$var$objectProto = Object.prototype; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var $a7a24c904bb1f1e0$var$nativeObjectToString = $a7a24c904bb1f1e0$var$objectProto.toString; /** * Converts `value` to a string using `Object.prototype.toString`. * * @private * @param {*} value The value to convert. * @returns {string} Returns the converted string. */ function $a7a24c904bb1f1e0$var$objectToString(value) { return $a7a24c904bb1f1e0$var$nativeObjectToString.call(value); } var $a7a24c904bb1f1e0$export$2e2bcd8739ae039 = $a7a24c904bb1f1e0$var$objectToString; /** `Object#toString` result references. */ var $3aa5d73bea98c8c5$var$nullTag = '[object Null]', $3aa5d73bea98c8c5$var$undefinedTag = '[object Undefined]'; /** Built-in value references. */ var $3aa5d73bea98c8c5$var$symToStringTag = (0, $835b893372538428$export$2e2bcd8739ae039) ? (0, $835b893372538428$export$2e2bcd8739ae039).toStringTag : undefined; /** * The base implementation of `getTag` without fallbacks for buggy environments. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function $3aa5d73bea98c8c5$var$baseGetTag(value) { if (value == null) return value === undefined ? $3aa5d73bea98c8c5$var$undefinedTag : $3aa5d73bea98c8c5$var$nullTag; return $3aa5d73bea98c8c5$var$symToStringTag && $3aa5d73bea98c8c5$var$symToStringTag in Object(value) ? (0, $68b7694a039a1d75$export$2e2bcd8739ae039)(value) : (0, $a7a24c904bb1f1e0$export$2e2bcd8739ae039)(value); } var $3aa5d73bea98c8c5$export$2e2bcd8739ae039 = $3aa5d73bea98c8c5$var$baseGetTag; /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var $9734df608078bdcd$var$isArray = Array.isArray; var $9734df608078bdcd$export$2e2bcd8739ae039 = $9734df608078bdcd$var$isArray; /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function $40b72c5f5651ffff$var$isObjectLike(value) { return value != null && typeof value == 'object'; } var $40b72c5f5651ffff$export$2e2bcd8739ae039 = $40b72c5f5651ffff$var$isObjectLike; /** `Object#toString` result references. */ var $d11db166b6cb5bb0$var$stringTag = '[object String]'; /** * Checks if `value` is classified as a `String` primitive or object. * * @static * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a string, else `false`. * @example * * _.isString('abc'); * // => true * * _.isString(1); * // => false */ function $d11db166b6cb5bb0$var$isString(value) { return typeof value == 'string' || !(0, $9734df608078bdcd$export$2e2bcd8739ae039)(value) && (0, $40b72c5f5651ffff$export$2e2bcd8739ae039)(value) && (0, $3aa5d73bea98c8c5$export$2e2bcd8739ae039)(value) == $d11db166b6cb5bb0$var$stringTag; } var $d11db166b6cb5bb0$export$2e2bcd8739ae039 = $d11db166b6cb5bb0$var$isString; class $25719caf4e05099f$export$2e2bcd8739ae039 { static validateState(condition, message) { if (!condition) throw new Error(`Invalid State: ${message}`); } static validateArgument(condition, argumentName, message = "") { if (!condition) throw new Error(`Invalid Argument: ${argumentName}. ${message}`); } static validateArgumentType(argument, type, argumentName) { argumentName = argumentName || '(unknown name)'; if ((0, $d11db166b6cb5bb0$export$2e2bcd8739ae039)(type)) { if (type === 'Buffer') { if (!Buffer.isBuffer(argument)) throw new TypeError(`Invalid Argument for ${argumentName}, expected ${type} but got ${typeof argument}`); } else if (typeof argument !== type) throw new TypeError(`Invalid Argument for ${argumentName}, expected ${type} but got ${typeof argument}`); } else { if (!(argument instanceof type)) throw new TypeError(`Invalid Argument for ${argumentName}, expected ${type} but got ${typeof argument}`); } } } class $e15ce05834df1029$export$2e2bcd8739ae039 { /** * Fill a buffer with a value. * * @param buffer * @param value * @return filled buffer * * @deprecated use `buffer.fill(value)` */ static fill(buffer, value) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgumentType(buffer, 'Buffer', 'buffer'); (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgumentType(value, 'number', 'value'); return buffer.fill(value); } /** * * @param original buffer * @return Return a copy of a buffer * * @deprecated use `Buffer.from(original) or Buffer.copyBytesFrom(original)` */ static copy(original) { let buffer = Buffer.alloc(original.length); original.copy(buffer); return buffer; } /** * Tests for both node's Buffer and Uint8Array * * @param arg * @return Returns true if the given argument is an instance of a buffer. */ static isBuffer(arg) { return Buffer.isBuffer(arg) || arg instanceof Uint8Array; } /** * Tests for both node's Buffer and Uint8Array * * @param arg * @return Returns true if the given argument is an instance of a hash160 or hash256 buffer. */ static isHashBuffer(arg) { return this.isBuffer(arg) && (arg.length === 20 || arg.length === 32); } /** * Returns a zero-filled byte array * * @param length * * @deprecated use `Buffer.alloc(length)` */ static emptyBuffer(length) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgumentType(length, 'number', 'length'); return Buffer.alloc(length); } /** * Reverse a buffer * @param param * @return new reversed buffer */ static reverse(param) { return Buffer.from(param).reverse(); } /** * Transforms a buffer into a string with a number in hexa representation * * Shorthand for <tt>buffer.toString('hex')</tt> * * @param buffer * @return string */ static bufferToHex(buffer) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgumentType(buffer, 'Buffer', 'buffer'); return buffer.toString('hex'); } /** * Transforms a number from 0 to 255 into a Buffer of size 1 with that value * * @param integer * @return Buffer */ static integerAsSingleByteBuffer(integer) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgumentType(integer, 'number', 'integer'); return Buffer.from([ integer & 0xff ]); } /** * Transforms the first byte of an array into a number ranging from -128 to 127 * * @param buffer * @return number */ static integerFromSingleByteBuffer(buffer) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgumentType(buffer, 'Buffer', 'buffer'); return buffer[0]; } /** * Transform a 4-byte integer into a Buffer of length 4. * * @param integer * @return Buffer */ static integerAsBuffer(integer) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgumentType(integer, 'number', 'integer'); let bytes = []; bytes.push(integer >> 24 & 0xff); bytes.push(integer >> 16 & 0xff); bytes.push(integer >> 8 & 0xff); bytes.push(integer & 0xff); return Buffer.from(bytes); } /** * Transform the first 4 values of a Buffer into a number, in little endian encoding * * @param buffer * @return integer */ static integerFromBuffer(buffer) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgumentType(buffer, 'Buffer', 'buffer'); return buffer[0] << 24 | buffer[1] << 16 | buffer[2] << 8 | buffer[3]; } /* secure random bytes that sometimes throws an error due to lack of entropy */ static getRandomBuffer(size) { return (0, ($parcel$interopDefault($2u1Tt$crypto))).randomBytes(size); } } var $09ee79c40e4d73c0$var$SHA_BLOCKSIZE = /*#__PURE__*/ function(SHA_BLOCKSIZE) { SHA_BLOCKSIZE[SHA_BLOCKSIZE["SHA256"] = 512] = "SHA256"; SHA_BLOCKSIZE[SHA_BLOCKSIZE["SHA512"] = 1024] = "SHA512"; return SHA_BLOCKSIZE; }($09ee79c40e4d73c0$var$SHA_BLOCKSIZE || {}); class $09ee79c40e4d73c0$export$2e2bcd8739ae039 { static sha1(buf) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgument((0, $e15ce05834df1029$export$2e2bcd8739ae039).isBuffer(buf), "buf", "Must be Buffer"); return (0, ($parcel$interopDefault($2u1Tt$crypto))).createHash('sha1').update(buf).digest(); } static sha256(buf) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgument((0, $e15ce05834df1029$export$2e2bcd8739ae039).isBuffer(buf), "buf", "Must be Buffer"); return (0, ($parcel$interopDefault($2u1Tt$crypto))).createHash('sha256').update(buf).digest(); } static sha512(buf) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgument((0, $e15ce05834df1029$export$2e2bcd8739ae039).isBuffer(buf), "buf", "Must be Buffer"); return (0, ($parcel$interopDefault($2u1Tt$crypto))).createHash('sha512').update(buf).digest(); } static ripemd160(buf) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgument((0, $e15ce05834df1029$export$2e2bcd8739ae039).isBuffer(buf), "buf", "Must be Buffer"); return (0, ($parcel$interopDefault($2u1Tt$crypto))).createHash('ripemd160').update(buf).digest(); } static sha256sha256(buf) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgument((0, $e15ce05834df1029$export$2e2bcd8739ae039).isBuffer(buf), "buf", "Must be Buffer"); return this.sha256(this.sha256(buf)); } static sha256ripemd160(buf) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgument((0, $e15ce05834df1029$export$2e2bcd8739ae039).isBuffer(buf), "buf", "Must be Buffer"); return this.ripemd160(this.sha256(buf)); } static sha256hmac(data, key) { return $09ee79c40e4d73c0$export$2e2bcd8739ae039.hmac($09ee79c40e4d73c0$export$2e2bcd8739ae039.sha256, 512, data, key); } static sha512hmac(data, key) { return $09ee79c40e4d73c0$export$2e2bcd8739ae039.hmac($09ee79c40e4d73c0$export$2e2bcd8739ae039.sha512, 1024, data, key); } static hmac(hashf, size, data, key) { //http://en.wikipedia.org/wiki/Hash-based_message_authentication_code //http://tools.ietf.org/html/rfc4868#section-2 (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgument((0, $e15ce05834df1029$export$2e2bcd8739ae039).isBuffer(data), "data", "Must be Buffer"); (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgument((0, $e15ce05834df1029$export$2e2bcd8739ae039).isBuffer(key), "key", "Must be Buffer"); let blocksize = size / 8; if (key.length > blocksize) key = hashf(key); else if (key.length < blocksize) { let fill = Buffer.alloc(blocksize); fill.fill(0); key.copy(fill); key = fill; } let o_key = Buffer.alloc(blocksize); o_key.fill(0x5c); let i_key = Buffer.alloc(blocksize); i_key.fill(0x36); let o_key_pad = Buffer.alloc(blocksize); let i_key_pad = Buffer.alloc(blocksize); for(let i = 0; i < blocksize; i++){ o_key_pad[i] = o_key[i] ^ key[i]; i_key_pad[i] = i_key[i] ^ key[i]; } return hashf(Buffer.concat([ o_key_pad, hashf(Buffer.concat([ i_key_pad, data ])) ])); } } class $f59639688aed9fb7$export$2e2bcd8739ae039 { /** * Determines whether a string contains only hexadecimal values * * @param value * @returns true if the string is the hexa representation of a number */ static isHexa(value) { return (0, $d11db166b6cb5bb0$export$2e2bcd8739ae039)(value) && value.length % 2 === 0 && /^[0-9a-fA-F]+$/.test(value); } /** * Test if an argument is a valid JSON object. If it is, returns a truthy * value (the json object decoded), so no double JSON.parse call is necessary * * @param arg * @return false if the argument is not a JSON string. */ static isValidJSON(arg) { if (!(0, $d11db166b6cb5bb0$export$2e2bcd8739ae039)(arg)) return false; try { return JSON.parse(arg); } catch { return false; } } static cloneArray(array) { return [ ...array ]; } /** * Checks that a value is a natural number. * * @param value * @return true if a positive integer or zero. */ static isNaturalNumber(value) { return typeof value === 'number' && isFinite(value) && Math.floor(value) === value && value >= 0; } /** * Checks that a value is a natural number. * * @param value * @return true if a positive integer or zero. */ static isNaturalBigInt(value) { return typeof value === 'bigint' && value >= 0n; } } /** `Object#toString` result references. */ var $c79bf17a4534dd16$var$numberTag = '[object Number]'; /** * Checks if `value` is classified as a `Number` primitive or object. * * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are * classified as numbers, use the `_.isFinite` method. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a number, else `false`. * @example * * _.isNumber(3); * // => true * * _.isNumber(Number.MIN_VALUE); * // => true * * _.isNumber(Infinity); * // => true * * _.isNumber('3'); * // => false */ function $c79bf17a4534dd16$var$isNumber(value) { return typeof value == 'number' || (0, $40b72c5f5651ffff$export$2e2bcd8739ae039)(value) && (0, $3aa5d73bea98c8c5$export$2e2bcd8739ae039)(value) == $c79bf17a4534dd16$var$numberTag; } var $c79bf17a4534dd16$export$2e2bcd8739ae039 = $c79bf17a4534dd16$var$isNumber; class $643a25691531d779$export$2e2bcd8739ae039 extends (0, ($parcel$interopDefault($2u1Tt$bnjs))) { static{ this.Zero = new $643a25691531d779$export$2e2bcd8739ae039(0); } static{ this.One = new $643a25691531d779$export$2e2bcd8739ae039(1); } static{ this.Minus1 = new $643a25691531d779$export$2e2bcd8739ae039(-1); } static fromNumber(num) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgument((0, $c79bf17a4534dd16$export$2e2bcd8739ae039)(num), "num"); return new $643a25691531d779$export$2e2bcd8739ae039(num); } static fromBigInt(num) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgument(typeof num === 'bigint', "num"); return new $643a25691531d779$export$2e2bcd8739ae039(num.toString()); } static fromString(str, base) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgument((0, $d11db166b6cb5bb0$export$2e2bcd8739ae039)(str), "str"); return new $643a25691531d779$export$2e2bcd8739ae039(str, base); } static fromBuffer(buf, opts) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgument((0, $e15ce05834df1029$export$2e2bcd8739ae039).isBuffer(buf), "buf"); if (opts?.endian === 'little') buf = (0, $e15ce05834df1029$export$2e2bcd8739ae039).reverse(buf); return new $643a25691531d779$export$2e2bcd8739ae039(buf.toString('hex'), 16); } /** * Create a BN from a "ScriptNum": * This is analogous to the constructor for CScriptNum in nexad. Many ops in * nexad's script interpreter use CScriptNum, which is not really a proper * bignum. Instead, an error is thrown if trying to input a number bigger than * 4 bytes. We copy that behavior here. A third argument, `size`, is provided to * extend the hard limit of 4 bytes, as some usages require more than 4 bytes. */ static fromScriptNumBuffer(buf, fRequireMinimal, size) { let nMaxNumSize = size || 4; (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgument(buf.length <= nMaxNumSize, 'script number overflow'); if (fRequireMinimal && buf.length > 0) // Check that the number is encoded with the minimum possible // number of bytes. // // If the most-significant-byte - excluding the sign bit - is zero // then we're not minimal. Note how this test also rejects the // negative-zero encoding, 0x80. { if ((buf[buf.length - 1] & 0x7f) === 0) { // One exception: if there's more than one byte and the most // significant bit of the second-most-significant-byte is set // it would conflict with the sign bit. An example of this case // is +-255, which encode to 0xff00 and 0xff80 respectively. // (big-endian). if (buf.length <= 1 || (buf[buf.length - 2] & 0x80) === 0) throw new Error('non-minimally encoded script number'); } } return $643a25691531d779$export$2e2bcd8739ae039.fromSM(buf, { endian: 'little' }); } // Override arithmetic methods to ensure they return BNExtended instances add(b) { const result = super.add(b).toString(); return new $643a25691531d779$export$2e2bcd8739ae039(result); } sub(b) { const result = super.sub(b).toString(); return new $643a25691531d779$export$2e2bcd8739ae039(result); } mul(b) { const result = super.mul(b).toString(); return new $643a25691531d779$export$2e2bcd8739ae039(result); } mod(b) { const result = super.mod(b).toString(); return new $643a25691531d779$export$2e2bcd8739ae039(result); } umod(b) { const result = super.umod(b).toString(); return new $643a25691531d779$export$2e2bcd8739ae039(result); } toNumber() { return parseInt(this.toString(10), 10); } toBigInt() { return BigInt(this.toString(10)); } toBuffer(opts, length) { if ((0, $d11db166b6cb5bb0$export$2e2bcd8739ae039)(opts)) // compatability with override return super.toBuffer(opts, length); let hex = this.toString(16, 2); let buf = Buffer.from(hex, 'hex'); if (opts?.size) { let natlen = hex.length / 2; if (natlen > opts.size) buf = $643a25691531d779$export$2e2bcd8739ae039.trim(buf, natlen); else if (natlen < opts.size) buf = $643a25691531d779$export$2e2bcd8739ae039.pad(buf, natlen, opts.size); } if (opts?.endian === 'little') buf = (0, $e15ce05834df1029$export$2e2bcd8739ae039).reverse(buf); return buf; } /** * The corollary to the above, with the notable exception that we do not throw * an error if the output is larger than four bytes. (Which can happen if * performing a numerical operation that results in an overflow to more than 4 * bytes). */ toScriptNumBuffer() { return this.toSM({ endian: 'little' }); } toScriptBigNumBuffer() { return this.toSM({ endian: 'little', bignum: true }); } getSize() { const bin = this.toString(2).replace('-', ''); const numBits = bin.length + 1; return numBits / 8; } safeAdd(bigNumToAdd, maxSize) { const sum = this.add(bigNumToAdd); this.checkOperationForOverflow(bigNumToAdd, sum, maxSize); return sum; } safeSub(bigNumToSubtract, maxSize) { const difference = this.sub(bigNumToSubtract); this.checkOperationForOverflow(bigNumToSubtract, difference, maxSize); return difference; } safeMul(bigNumToMultiply, maxSize) { const product = this.mul(bigNumToMultiply); this.checkOperationForOverflow(bigNumToMultiply, product, maxSize); return product; } checkOperationForOverflow(operand, result, maxSize) { if (this.getSize() > maxSize || operand.getSize() > maxSize || result.getSize() > 8) throw new Error('overflow'); } toSMBigEndian() { let buf; if (this.cmp($643a25691531d779$export$2e2bcd8739ae039.Zero) === -1) { buf = this.neg().toBuffer(); if (buf[0] & 0x80) buf = Buffer.concat([ Buffer.from([ 0x80 ]), buf ]); else buf[0] = buf[0] | 0x80; } else { buf = this.toBuffer(); if (buf[0] & 0x80) buf = Buffer.concat([ Buffer.from([ 0x00 ]), buf ]); } if (buf.length === 1 && buf[0] === 0) buf = Buffer.from([]); return buf; } toBigNumSMBigEndian() { let buf; if (this.cmp($643a25691531d779$export$2e2bcd8739ae039.Zero) === -1) { buf = this.neg().toBuffer(); buf = Buffer.concat([ Buffer.from([ 0x80 ]), buf ]); } else { buf = this.toBuffer(); buf = Buffer.concat([ Buffer.from([ 0x00 ]), buf ]); } return buf; } toSM(opts) { let buf = opts?.bignum ? this.toBigNumSMBigEndian() : this.toSMBigEndian(); if (opts?.endian === 'little') buf = (0, $e15ce05834df1029$export$2e2bcd8739ae039).reverse(buf); return buf; } /** * Instantiate a BigNumber from a "signed magnitude buffer" * (a buffer where the most significant bit represents the sign (0 = positive, -1 = negative)) */ static fromSM(buf, opts) { if (buf.length === 0) return this.fromBuffer(Buffer.from([ 0 ])); if (opts?.endian === 'little') buf = (0, $e15ce05834df1029$export$2e2bcd8739ae039).reverse(buf); let ret; if (buf[0] & 0x80) { buf[0] = buf[0] & 0x7f; ret = this.fromBuffer(buf); ret.neg().copy(ret); } else ret = this.fromBuffer(buf); return ret; } static trim(buf, natlen) { return buf.subarray(natlen - buf.length, natlen); } static pad(buf, natlen, size) { let rbuf = Buffer.alloc(size); for(let i = 0; i < buf.length; i++)rbuf[rbuf.length - 1 - i] = buf[buf.length - 1 - i]; for(let i = 0; i < size - natlen; i++)rbuf[i] = 0; return rbuf; } } /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function $919291a5351d94c4$var$isObject(value) { var type = typeof value; return value != null && (type == 'object' || type == 'function'); } var $919291a5351d94c4$export$2e2bcd8739ae039 = $919291a5351d94c4$var$isObject; /** * Checks if `value` is `undefined`. * * @static * @since 0.1.0 * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. * @example * * _.isUndefined(void 0); * // => true * * _.isUndefined(null); * // => false */ function $400022aef0660df3$var$isUndefined(value) { return value === undefined; } var $400022aef0660df3$export$2e2bcd8739ae039 = $400022aef0660df3$var$isUndefined; class $bc22c844686c075e$export$2e2bcd8739ae039 { constructor(buf){ this.finished = this.eof; this.buf = Buffer.from([]); this.pos = 0; if ((0, $400022aef0660df3$export$2e2bcd8739ae039)(buf)) return; if (Buffer.isBuffer(buf)) this.set({ buf: buf }); else if ((0, $d11db166b6cb5bb0$export$2e2bcd8739ae039)(buf)) { let b = Buffer.from(buf, 'hex'); if (b.length * 2 != buf.length) throw new TypeError('Invalid hex string'); this.set({ buf: b }); } else if ((0, $919291a5351d94c4$export$2e2bcd8739ae039)(buf)) { let obj = buf; this.set(obj); } else throw new TypeError('Unrecognized argument for BufferReader'); } set(obj) { this.buf = obj.buf || this.buf; this.pos = obj.pos || this.pos || 0; return this; } eof() { return this.pos >= this.buf.length; } read(len) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgument(!(0, $400022aef0660df3$export$2e2bcd8739ae039)(len), 'Must specify a length'); let buf = this.buf.subarray(this.pos, this.pos + len); this.pos = this.pos + len; return buf; } readAll() { let buf = this.buf.subarray(this.pos, this.buf.length); this.pos = this.buf.length; return buf; } readUInt8() { let val = this.buf.readUInt8(this.pos); this.pos = this.pos + 1; return val; } readUInt16BE() { let val = this.buf.readUInt16BE(this.pos); this.pos = this.pos + 2; return val; } readUInt16LE() { let val = this.buf.readUInt16LE(this.pos); this.pos = this.pos + 2; return val; } readUInt32BE() { let val = this.buf.readUInt32BE(this.pos); this.pos = this.pos + 4; return val; } readUInt32LE() { let val = this.buf.readUInt32LE(this.pos); this.pos = this.pos + 4; return val; } readInt32LE() { let val = this.buf.readInt32LE(this.pos); this.pos = this.pos + 4; return val; } readUInt64BEBN() { let buf = this.buf.subarray(this.pos, this.pos + 8); let bn = (0, $643a25691531d779$export$2e2bcd8739ae039).fromBuffer(buf); this.pos = this.pos + 8; return bn; } readUInt64LEBN() { let second = this.buf.readUInt32LE(this.pos); let first = this.buf.readUInt32LE(this.pos + 4); let combined = first * 0x100000000 + second; // Instantiating an instance of BN with a number is faster than with an // array or string. However, the maximum safe number for a double precision // floating point is 2 ^ 52 - 1 (0x1fffffffffffff), thus we can safely use // non-floating point numbers less than this amount (52 bits). And in the case // that the number is larger, we can instatiate an instance of BN by passing // an array from the buffer (slower) and specifying the endianness. let bn; if (combined <= 0x1fffffffffffff) bn = new (0, $643a25691531d779$export$2e2bcd8739ae039)(combined); else { let data = this.buf.subarray(this.pos, this.pos + 8); bn = new (0, $643a25691531d779$export$2e2bcd8739ae039)(data, 10, 'le'); } this.pos = this.pos + 8; return bn; } readVarintNum() { let first = this.readUInt8(); switch(first){ case 0xFD: return this.readUInt16LE(); case 0xFE: return this.readUInt32LE(); case 0xFF: let bn = this.readUInt64LEBN(); let n = bn.toNumber(); if (n <= Math.pow(2, 53)) return n; else throw new Error('number too large to retain precision - use readVarintBN'); } return first; } /** * reads a length prepended buffer */ readVarLengthBuffer() { let len = this.readVarintNum(); let buf = this.read(len); (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateState(buf.length === len, "Invalid length while reading varlength buffer. Expected to read: " + len + ' and read ' + buf.length); return buf; } readVarintBuf() { let first = this.buf.readUInt8(this.pos); switch(first){ case 0xFD: return this.read(3); case 0xFE: return this.read(5); case 0xFF: return this.read(9); default: return this.read(1); } } readVarintBN() { let first = this.readUInt8(); switch(first){ case 0xFD: return new (0, $643a25691531d779$export$2e2bcd8739ae039)(this.readUInt16LE()); case 0xFE: return new (0, $643a25691531d779$export$2e2bcd8739ae039)(this.readUInt32LE()); case 0xFF: return this.readUInt64LEBN(); default: return new (0, $643a25691531d779$export$2e2bcd8739ae039)(first); } } reverse() { let buf = (0, $e15ce05834df1029$export$2e2bcd8739ae039).reverse(this.buf); this.buf = buf; return this; } readReverse(len) { if ((0, $400022aef0660df3$export$2e2bcd8739ae039)(len)) len = this.buf.length; let buf = this.buf.subarray(this.pos, this.pos + len); this.pos = this.pos + len; return (0, $e15ce05834df1029$export$2e2bcd8739ae039).reverse(buf); } readCoreVarintNum() { let n = 0; while(true){ let chData = this.readUInt8(); n = n << 7 | chData & 0x7F; if (chData & 0x80) n++; else return n; } } } class $abe6a353ddb9f06e$export$2e2bcd8739ae039 { constructor(obj){ this.bufs = []; this.bufLen = 0; if (obj) this.set(obj); } set(obj) { this.bufs = obj.bufs || this.bufs; this.bufLen = this.bufs.reduce((prev, buf)=>prev + buf.length, 0); return this; } toBuffer() { return this.concat(); } concat() { return Buffer.concat(this.bufs, this.bufLen); } write(buf) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgument((0, $e15ce05834df1029$export$2e2bcd8739ae039).isBuffer(buf), "buf"); this.bufs.push(buf); this.bufLen += buf.length; return this; } writeReverse(buf) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgument((0, $e15ce05834df1029$export$2e2bcd8739ae039).isBuffer(buf), "buf"); this.bufs.push((0, $e15ce05834df1029$export$2e2bcd8739ae039).reverse(buf)); this.bufLen += buf.length; return this; } writeUInt8(n) { let buf = Buffer.alloc(1); buf.writeUInt8(n, 0); this.write(buf); return this; } writeUInt16BE(n) { let buf = Buffer.alloc(2); buf.writeUInt16BE(n, 0); this.write(buf); return this; } writeUInt16LE(n) { let buf = Buffer.alloc(2); buf.writeUInt16LE(n, 0); this.write(buf); return this; } writeUInt32BE(n) { let buf = Buffer.alloc(4); buf.writeUInt32BE(n, 0); this.write(buf); return this; } writeInt32LE(n) { let buf = Buffer.alloc(4); buf.writeInt32LE(n, 0); this.write(buf); return this; } writeUInt32LE(n) { let buf = Buffer.alloc(4); buf.writeUInt32LE(n, 0); this.write(buf); return this; } writeUInt64BEBN(bn) { let buf = bn.toBuffer({ size: 8 }); this.write(buf); return this; } writeUInt64LEBN(bn) { let buf = bn.toBuffer({ size: 8 }); this.writeReverse(buf); return this; } writeVarintNum(n) { let buf = $abe6a353ddb9f06e$export$2e2bcd8739ae039.varintBufNum(n); this.write(buf); return this; } writeVarintBN(bn) { let buf = $abe6a353ddb9f06e$export$2e2bcd8739ae039.varintBufBN(bn); this.write(buf); return this; } writeVarLengthBuf(buf) { (0, $25719caf4e05099f$export$2e2bcd8739ae039).validateArgument((0, $e15ce05834df1029$export$2e2bcd8739ae039).isBuffer(buf), "buf"); this.writeVarintNum(buf.length); this.write(buf); return this; } writeCoreVarintNum(n) { let tmp = []; let len = 0; while(true){ tmp.push(n & 0x7F | (len ? 0x80 : 0x00)); if (n <= 0x7F) break; n = (n >> 7) - 1; len++; } this.write(Buffer.from(tmp).reverse()); return this; } static varintBufNum(n) { let buf = undefined; if (n < 253) { buf = Buffer.alloc(1); buf.writeUInt8(n, 0); } else if (n < 0x10000) { buf = Buffer.alloc(3); buf.writeUInt8(253, 0); buf.writeUInt16LE(n, 1); } else if (n < 0x100000000) { buf = Buffer.alloc(5); buf.writeUInt8(254, 0); buf.writeUInt32LE(n, 1); } else { buf = Buffer.alloc(9); buf.writeUInt8(255, 0); buf.writeInt32LE(n & -1, 1); buf.writeUInt32LE(Math.floor(n / 0x100000000), 5); } return buf; } static varintBufBN(bn) { let buf = undefined; let n = bn.toNumber(); if (n < 253) { buf = Buffer.alloc(1); buf.writeUInt8(n, 0); } else if (n < 0x10000) { buf = Buffer.alloc(3); buf.writeUInt8(253, 0); buf.writeUInt16LE(n, 1); } else if (n < 0x100000000) { buf = Buffer.alloc(5); buf.writeUInt8(254, 0); buf.writeUInt32LE(n, 1); } else { let bw = new $abe6a353ddb9f06e$export$2e2bcd8739ae039(); bw.writeUInt8(255); bw.writeUInt64LEBN(bn); buf = bw.concat(); } return buf; } } /** Used to match a single whitespace character. */ var $492ee41d67c95c4a$var$reWhitespace = /\s/; /** * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace * character of `string`. * * @private * @param {string} string The string to inspect. * @returns {number} Returns the index of the last non-whitespace character. */ function $492ee41d67c95c4a$var$trimmedEndIndex(string) { var index = string.length; while(index-- && $492ee41d67c95c4a$var$reWhitespace.test(string.charAt(index))); return index; } var $492ee41d67c95c4a$export$2e2bcd8739ae039 = $492ee41d67c95c4a$var$trimmedEndIndex; /** Used to match leading whitespace. */ var $b6e57b2dbda05104$var$reTrimStart = /^\s+/; /** * The base implementation of `_.trim`. * * @private * @param {string} string The string to trim. * @returns {string} Returns the trimmed string. */ function $b6e57b2dbda05104$var$baseTrim(string) { return string ? string.slice(0, (0, $492ee41d67c95c4a$export$2e2bcd8739ae039)(string) + 1).replace($b6e57b2dbda05104$var$reTrimStart, '') : string; } var $b6e57b2dbda05104$export$2e2bcd8739ae039 = $b6e57b2dbda05104$var$baseTrim; /