diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 721ed44e8f..6f469c6456 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -627,9 +627,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.19.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.19.0.tgz", - "integrity": "sha512-rbq9/g38qjfqFLOVPvwjIvFFdNziEC5S65jmjPw5r6A//QH+W91akh9irMwjDN8zKUTak6W9EsAv4m/7Wnw0UQ==", + "version": "9.20.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.20.0.tgz", + "integrity": "sha512-iZA07H9io9Wn836aVTytRaNqh00Sad+EamwOVJT12GTLw1VGMFV/4JaME+JjLtr9fiGaoWgYnS54wrfWsSs4oQ==", "dev": true, "license": "MIT", "engines": { @@ -3738,9 +3738,9 @@ } }, "node_modules/eslint-plugin-github": { - "version": "5.1.7", - "resolved": "https://registry.npmjs.org/eslint-plugin-github/-/eslint-plugin-github-5.1.7.tgz", - "integrity": "sha512-P3S5TwvHy8u1QadfcI/tZ2uNFMTHv+mT/YmEdLEgEzp08mA3iK02kg/IhoWOz0SnbTyUi1qrq0a6SwC3uQSkpQ==", + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/eslint-plugin-github/-/eslint-plugin-github-5.1.8.tgz", + "integrity": "sha512-A6q+R3EBMF7hxIViWpQsalqpu3O0POcQ9VpN1m9W2I8yGumw+SFxXZUTafBd9X9mgUJhaU4M9qSifC1q/39H3A==", "dev": true, "license": "MIT", "dependencies": { @@ -5575,9 +5575,9 @@ "license": "MIT" }, "node_modules/long": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.4.tgz", - "integrity": "sha512-qtzLbJE8hq7VabR3mISmVGtoXP8KGc2Z/AT8OuqlYD7JTR3oqrgwdjnk07wpj1twXxYmgDXgoKVWUG/fReSzHg==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/long/-/long-5.3.0.tgz", + "integrity": "sha512-5vvY5yF1zF/kXk+L94FRiTDa1Znom46UjPCH6/XbSvS8zBKMFBHTJk8KDMqJ+2J6QezQFi7k1k8v21ClJYHPaw==", "license": "Apache-2.0" }, "node_modules/lower-case": { @@ -5794,9 +5794,9 @@ "license": "0BSD" }, "node_modules/nock": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/nock/-/nock-14.0.0.tgz", - "integrity": "sha512-3Z2ZoZoYTR/y2I+NI16+6IzfZFKBX7MrADtoBAm7v/QKqxQUhKw+Dh+847PPS1j/FDutjfIXfrh3CJF74yITWg==", + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/nock/-/nock-14.0.1.tgz", + "integrity": "sha512-IJN4O9pturuRdn60NjQ7YkFt6Rwei7ZKaOwb1tvUIIqTgeD0SDDAX3vrqZD4wcXczeEy/AsUXxpGpP/yHqV7xg==", "dev": true, "license": "MIT", "dependencies": { @@ -5805,7 +5805,7 @@ "propagate": "^2.0.0" }, "engines": { - "node": ">= 18" + "node": ">=18.20.0 <20 || >=20.12.1" } }, "node_modules/node-fetch": { @@ -6623,9 +6623,9 @@ "license": "ISC" }, "node_modules/semver": { - "version": "7.7.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.0.tgz", - "integrity": "sha512-DrfFnPzblFmNrIZzg5RzHegbiRWg7KMR7btwi2yjHwx06zsUbO5g613sVwEV7FTwmzJu+Io0lJe2GJ3LxqpvBQ==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "license": "ISC", "bin": { "semver": "bin/semver.js" diff --git a/node_modules/@eslint/js/package.json b/node_modules/@eslint/js/package.json index 1d0220dcf7..8caf00054d 100644 --- a/node_modules/@eslint/js/package.json +++ b/node_modules/@eslint/js/package.json @@ -1,6 +1,6 @@ { "name": "@eslint/js", - "version": "9.19.0", + "version": "9.20.0", "description": "ESLint JavaScript language implementation", "main": "./src/index.js", "types": "./types/index.d.ts", diff --git a/node_modules/eslint-plugin-github/lib/configs/flat/recommended.js b/node_modules/eslint-plugin-github/lib/configs/flat/recommended.js index 96695ef38c..748647ea22 100644 --- a/node_modules/eslint-plugin-github/lib/configs/flat/recommended.js +++ b/node_modules/eslint-plugin-github/lib/configs/flat/recommended.js @@ -16,7 +16,7 @@ module.exports = { }, }, plugins: { - prettierPlugin, + prettier: prettierPlugin, 'eslint-comments': eslintComments, import: importPlugin, 'i18n-text': fixupPluginRules(i18nTextPlugin), @@ -131,7 +131,7 @@ module.exports = { 'prefer-rest-params': 'error', 'prefer-spread': 'error', 'prefer-template': 'error', - 'prettierPlugin/prettier': 'error', + 'prettier/prettier': 'error', 'require-yield': 'error', 'use-isnan': 'error', 'valid-typeof': 'error', diff --git a/node_modules/eslint-plugin-github/lib/configs/react.js b/node_modules/eslint-plugin-github/lib/configs/react.js index f5b2982919..6667f59767 100644 --- a/node_modules/eslint-plugin-github/lib/configs/react.js +++ b/node_modules/eslint-plugin-github/lib/configs/react.js @@ -36,6 +36,7 @@ module.exports = { nav: ['navigation'], // default in eslint-plugin-jsx-a11y tbody: ['rowgroup'], thead: ['rowgroup'], + ul: ['list'], // In webkit, setting list-style-type: none results in semantics being removed. Need explicit role. }, ], }, diff --git a/node_modules/eslint-plugin-github/package.json b/node_modules/eslint-plugin-github/package.json index 95bbf6909b..b5b0889cbd 100644 --- a/node_modules/eslint-plugin-github/package.json +++ b/node_modules/eslint-plugin-github/package.json @@ -1,6 +1,6 @@ { "name": "eslint-plugin-github", - "version": "5.1.7", + "version": "5.1.8", "description": "An opinionated collection of ESLint shared configs and rules used by GitHub.", "main": "lib/index.js", "entries": [ diff --git a/node_modules/long/README.md b/node_modules/long/README.md index ab168f1cf7..6f551c9121 100644 --- a/node_modules/long/README.md +++ b/node_modules/long/README.md @@ -4,7 +4,7 @@ long.js A Long class for representing a 64 bit two's-complement integer value derived from the [Closure Library](https://github.com/google/closure-library) for stand-alone use and extended with unsigned support. -[![Build Status](https://img.shields.io/github/workflow/status/dcodeIO/long.js/Test/main?label=test&logo=github)](https://github.com/dcodeIO/long.js/actions?query=workflow%3ATest) [![Publish Status](https://img.shields.io/github/workflow/status/dcodeIO/long.js/Publish/main?label=publish&logo=github)](https://github.com/dcodeIO/long.js/actions?query=workflow%3APublish) [![npm](https://img.shields.io/npm/v/long.svg?label=npm&color=007acc&logo=npm)](https://www.npmjs.com/package/long) +[![Build Status](https://img.shields.io/github/actions/workflow/status/dcodeIO/long.js/test.yml?branch=main&label=test&logo=github)](https://github.com/dcodeIO/long.js/actions/workflows/test.yml) [![Publish Status](https://img.shields.io/github/actions/workflow/status/dcodeIO/long.js/publish.yml?branch=main&label=publish&logo=github)](https://github.com/dcodeIO/long.js/actions/workflows/publish.yml) [![npm](https://img.shields.io/npm/v/long.svg?label=npm&color=007acc&logo=npm)](https://www.npmjs.com/package/long) Background ---------- @@ -103,7 +103,10 @@ API ### Utility -* Long.**isLong**(obj: `*`): `boolean`
+* type **LongLike**: `Long | number | bigint | string`
+ Any value or object that either is or can be converted to a Long. + +* Long.**isLong**(obj: `any`): `boolean`
Tests if the specified object is a Long. * Long.**fromBits**(lowBits: `number`, highBits: `number`, unsigned?: `boolean`): `Long`
@@ -124,28 +127,31 @@ API * Long.**fromNumber**(value: `number`, unsigned?: `boolean`): `Long`
Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. +* Long.**fromBigInt**(value: `bigint`, unsigned?: `boolean`): `Long`
+ Returns a Long representing the given big integer. + * Long.**fromString**(str: `string`, unsigned?: `boolean`, radix?: `number`)
Long.**fromString**(str: `string`, radix: `number`)
Returns a Long representation of the given string, written using the specified radix. -* Long.**fromValue**(val: `*`, unsigned?: `boolean`): `Long`
+* Long.**fromValue**(val: `LongLike`, unsigned?: `boolean`): `Long`
Converts the specified value to a Long using the appropriate from* function for its type. ### Methods -* Long#**add**(addend: `Long | number | string`): `Long`
+* Long#**add**(addend: `LongLike`): `Long`
Returns the sum of this and the specified Long. -* Long#**and**(other: `Long | number | string`): `Long`
+* Long#**and**(other: `LongLike`): `Long`
Returns the bitwise AND of this Long and the specified. -* Long#**compare**/**comp**(other: `Long | number | string`): `number`
+* Long#**compare**/**comp**(other: `LongLike`): `number`
Compares this Long's value with the specified's. Returns `0` if they are the same, `1` if the this is greater and `-1` if the given one is greater. -* Long#**divide**/**div**(divisor: `Long | number | string`): `Long`
+* Long#**divide**/**div**(divisor: `LongLike`): `Long`
Returns this Long divided by the specified. -* Long#**equals**/**eq**(other: `Long | number | string`): `boolean`
+* Long#**equals**/**eq**(other: `LongLike`): `boolean`
Tests if this Long's value equals the specified's. * Long#**getHighBits**(): `number`
@@ -163,10 +169,10 @@ API * Long#**getNumBitsAbs**(): `number`
Gets the number of bits needed to represent the absolute value of this Long. -* Long#**greaterThan**/**gt**(other: `Long | number | string`): `boolean`
+* Long#**greaterThan**/**gt**(other: `LongLike`): `boolean`
Tests if this Long's value is greater than the specified's. -* Long#**greaterThanOrEqual**/**gte**/**ge**(other: `Long | number | string`): `boolean`
+* Long#**greaterThanOrEqual**/**gte**/**ge**(other: `LongLike`): `boolean`
Tests if this Long's value is greater than or equal the specified's. * Long#**isEven**(): `boolean`
@@ -181,19 +187,22 @@ API * Long#**isPositive**(): `boolean`
Tests if this Long's value is positive or zero. +* Long#**isSafeInteger**(): `boolean`
+ Tests if this Long can be safely represented as a JavaScript number. + * Long#**isZero**/**eqz**(): `boolean`
Tests if this Long's value equals zero. -* Long#**lessThan**/**lt**(other: `Long | number | string`): `boolean`
+* Long#**lessThan**/**lt**(other: `LongLike`): `boolean`
Tests if this Long's value is less than the specified's. -* Long#**lessThanOrEqual**/**lte**/**le**(other: `Long | number | string`): `boolean`
+* Long#**lessThanOrEqual**/**lte**/**le**(other: `LongLike`): `boolean`
Tests if this Long's value is less than or equal the specified's. -* Long#**modulo**/**mod**/**rem**(divisor: `Long | number | string`): `Long`
+* Long#**modulo**/**mod**/**rem**(divisor: `LongLike`): `Long`
Returns this Long modulo the specified. -* Long#**multiply**/**mul**(multiplier: `Long | number | string`): `Long`
+* Long#**multiply**/**mul**(multiplier: `LongLike`): `Long`
Returns the product of this and the specified Long. * Long#**negate**/**neg**(): `Long`
@@ -208,28 +217,28 @@ API * Long#**countTrailingZeros**/**ctz**(): `number`
Returns count trailing zeros of this Long. -* Long#**notEquals**/**neq**/**ne**(other: `Long | number | string`): `boolean`
+* Long#**notEquals**/**neq**/**ne**(other: `LongLike`): `boolean`
Tests if this Long's value differs from the specified's. -* Long#**or**(other: `Long | number | string`): `Long`
+* Long#**or**(other: `LongLike`): `Long`
Returns the bitwise OR of this Long and the specified. -* Long#**shiftLeft**/**shl**(numBits: `Long | number | string`): `Long`
+* Long#**shiftLeft**/**shl**(numBits: `Long | number`): `Long`
Returns this Long with bits shifted to the left by the given amount. -* Long#**shiftRight**/**shr**(numBits: `Long | number | string`): `Long`
+* Long#**shiftRight**/**shr**(numBits: `Long | number`): `Long`
Returns this Long with bits arithmetically shifted to the right by the given amount. -* Long#**shiftRightUnsigned**/**shru**/**shr_u**(numBits: `Long | number | string`): `Long`
+* Long#**shiftRightUnsigned**/**shru**/**shr_u**(numBits: `Long | number`): `Long`
Returns this Long with bits logically shifted to the right by the given amount. -* Long#**rotateLeft**/**rotl**(numBits: `Long | number | string`): `Long`
+* Long#**rotateLeft**/**rotl**(numBits: `Long | number`): `Long`
Returns this Long with bits rotated to the left by the given amount. -* Long#**rotateRight**/**rotr**(numBits: `Long | number | string`): `Long`
+* Long#**rotateRight**/**rotr**(numBits: `Long | number`): `Long`
Returns this Long with bits rotated to the right by the given amount. -* Long#**subtract**/**sub**(subtrahend: `Long | number | string`): `Long`
+* Long#**subtract**/**sub**(subtrahend: `LongLike`): `Long`
Returns the difference of this and the specified Long. * Long#**toBytes**(le?: `boolean`): `number[]`
@@ -247,6 +256,9 @@ API * Long#**toNumber**(): `number`
Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). +* Long#**toBigInt**(): `bigint`
+ Converts the Long to its big integer representation. + * Long#**toSigned**(): `Long`
Converts this Long to signed. diff --git a/node_modules/long/index.d.ts b/node_modules/long/index.d.ts index d675d338d5..d16583cf2b 100644 --- a/node_modules/long/index.d.ts +++ b/node_modules/long/index.d.ts @@ -1,2 +1,2 @@ -import Long from './umd/index'; -export default Long; // compatible with `import Long from "long"` +import { Long } from './types.js'; +export default Long; diff --git a/node_modules/long/index.js b/node_modules/long/index.js index f04775e0be..ca2615da82 100644 --- a/node_modules/long/index.js +++ b/node_modules/long/index.js @@ -22,9 +22,69 @@ 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 + // \0asm + 0, 97, 115, 109, + // version 1 + 1, 0, 0, 0, + + // section "type" + 1, 13, 2, + // 0, () => i32 + 96, 0, 1, 127, + // 1, (i32, i32, i32, i32) => i32 + 96, 4, 127, 127, 127, 127, 1, 127, + + // section "function" + 3, 7, 6, + // 0, type 0 + 0, + // 1, type 1 + 1, + // 2, type 1 + 1, + // 3, type 1 + 1, + // 4, type 1 + 1, + // 5, type 1 + 1, + + // section "global" + 6, 6, 1, + // 0, "high", mutable i32 + 127, 1, 65, 0, 11, + + // section "export" + 7, 50, 6, + // 0, "mul" + 3, 109, 117, 108, 0, 1, + // 1, "div_s" + 5, 100, 105, 118, 95, 115, 0, 2, + // 2, "div_u" + 5, 100, 105, 118, 95, 117, 0, 3, + // 3, "rem_s" + 5, 114, 101, 109, 95, 115, 0, 4, + // 4, "rem_u" + 5, 114, 101, 109, 95, 117, 0, 5, + // 5, "get_high" + 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, + + // section "code" + 10, 191, 1, 6, + // 0, "get_high" + 4, 0, 35, 0, 11, + // 1, "mul" + 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, + // 2, "div_s" + 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, + // 3, "div_u" + 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, + // 4, "rem_s" + 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, + // 5, "rem_u" + 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) { +} catch { // no wasm support :( } @@ -315,7 +375,7 @@ function fromValue(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 {!Long|number|bigint|string|!{low: number, high: number, unsigned: boolean}} val Value * @param {boolean=} unsigned Whether unsigned or not, defaults to signed * @returns {!Long} */ @@ -585,6 +645,22 @@ LongPrototype.getNumBitsAbs = function getNumBitsAbs() { return this.high != 0 ? bit + 33 : bit + 1; }; +/** + * Tests if this Long can be safely represented as a JavaScript number. + * @this {!Long} + * @returns {boolean} + */ +LongPrototype.isSafeInteger = function isSafeInteger() { + // 2^53-1 is the maximum safe value + var top11Bits = this.high >> 21; + // [0, 2^53-1] + if (!top11Bits) return true; + // > 2^53-1 + if (this.unsigned) return false; + // [-2^53, -1] except -2^53 + return top11Bits === -1 && !(this.low === 0 && this.high === -0x200000); +}; + /** * Tests if this Long's value equals zero. * @this {!Long} @@ -639,7 +715,7 @@ LongPrototype.isEven = function isEven() { /** * Tests if this Long's value equals the specified's. * @this {!Long} - * @param {!Long|number|string} other Other value + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ LongPrototype.equals = function equals(other) { @@ -653,7 +729,7 @@ LongPrototype.equals = function equals(other) { /** * 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 + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ LongPrototype.eq = LongPrototype.equals; @@ -661,7 +737,7 @@ LongPrototype.eq = LongPrototype.equals; /** * Tests if this Long's value differs from the specified's. * @this {!Long} - * @param {!Long|number|string} other Other value + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ LongPrototype.notEquals = function notEquals(other) { @@ -671,7 +747,7 @@ LongPrototype.notEquals = function notEquals(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 + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ LongPrototype.neq = LongPrototype.notEquals; @@ -679,7 +755,7 @@ 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 + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ LongPrototype.ne = LongPrototype.notEquals; @@ -687,7 +763,7 @@ LongPrototype.ne = LongPrototype.notEquals; /** * Tests if this Long's value is less than the specified's. * @this {!Long} - * @param {!Long|number|string} other Other value + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ LongPrototype.lessThan = function lessThan(other) { @@ -697,7 +773,7 @@ LongPrototype.lessThan = function lessThan(other) { /** * 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 + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ LongPrototype.lt = LongPrototype.lessThan; @@ -705,7 +781,7 @@ LongPrototype.lt = LongPrototype.lessThan; /** * Tests if this Long's value is less than or equal the specified's. * @this {!Long} - * @param {!Long|number|string} other Other value + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) { @@ -715,7 +791,7 @@ LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) { /** * 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 + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ LongPrototype.lte = LongPrototype.lessThanOrEqual; @@ -723,7 +799,7 @@ 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 + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ LongPrototype.le = LongPrototype.lessThanOrEqual; @@ -731,7 +807,7 @@ LongPrototype.le = LongPrototype.lessThanOrEqual; /** * Tests if this Long's value is greater than the specified's. * @this {!Long} - * @param {!Long|number|string} other Other value + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ LongPrototype.greaterThan = function greaterThan(other) { @@ -741,7 +817,7 @@ LongPrototype.greaterThan = function greaterThan(other) { /** * 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 + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ LongPrototype.gt = LongPrototype.greaterThan; @@ -749,7 +825,7 @@ LongPrototype.gt = LongPrototype.greaterThan; /** * Tests if this Long's value is greater than or equal the specified's. * @this {!Long} - * @param {!Long|number|string} other Other value + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) { @@ -759,7 +835,7 @@ LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) { /** * 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 + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ LongPrototype.gte = LongPrototype.greaterThanOrEqual; @@ -767,7 +843,7 @@ 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 + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ LongPrototype.ge = LongPrototype.greaterThanOrEqual; @@ -775,7 +851,7 @@ LongPrototype.ge = LongPrototype.greaterThanOrEqual; /** * Compares this Long's value with the specified's. * @this {!Long} - * @param {!Long|number|string} other Other value + * @param {!Long|number|bigint|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 */ @@ -800,7 +876,7 @@ LongPrototype.compare = function compare(other) { /** * 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 + * @param {!Long|number|bigint|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 */ @@ -827,7 +903,7 @@ LongPrototype.neg = LongPrototype.negate; /** * Returns the sum of this and the specified Long. * @this {!Long} - * @param {!Long|number|string} addend Addend + * @param {!Long|number|bigint|string} addend Addend * @returns {!Long} Sum */ LongPrototype.add = function add(addend) { @@ -864,7 +940,7 @@ LongPrototype.add = function add(addend) { /** * Returns the difference of this and the specified Long. * @this {!Long} - * @param {!Long|number|string} subtrahend Subtrahend + * @param {!Long|number|bigint|string} subtrahend Subtrahend * @returns {!Long} Difference */ LongPrototype.subtract = function subtract(subtrahend) { @@ -876,7 +952,7 @@ LongPrototype.subtract = function subtract(subtrahend) { /** * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}. * @function - * @param {!Long|number|string} subtrahend Subtrahend + * @param {!Long|number|bigint|string} subtrahend Subtrahend * @returns {!Long} Difference */ LongPrototype.sub = LongPrototype.subtract; @@ -884,7 +960,7 @@ LongPrototype.sub = LongPrototype.subtract; /** * Returns the product of this and the specified Long. * @this {!Long} - * @param {!Long|number|string} multiplier Multiplier + * @param {!Long|number|bigint|string} multiplier Multiplier * @returns {!Long} Product */ LongPrototype.multiply = function multiply(multiplier) { @@ -961,7 +1037,7 @@ LongPrototype.multiply = function multiply(multiplier) { /** * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}. * @function - * @param {!Long|number|string} multiplier Multiplier + * @param {!Long|number|bigint|string} multiplier Multiplier * @returns {!Long} Product */ LongPrototype.mul = LongPrototype.multiply; @@ -970,7 +1046,7 @@ 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. * @this {!Long} - * @param {!Long|number|string} divisor Divisor + * @param {!Long|number|bigint|string} divisor Divisor * @returns {!Long} Quotient */ LongPrototype.divide = function divide(divisor) { @@ -1083,7 +1159,7 @@ LongPrototype.divide = function divide(divisor) { /** * Returns this Long divided by the specified. This is an alias of {@link Long#divide}. * @function - * @param {!Long|number|string} divisor Divisor + * @param {!Long|number|bigint|string} divisor Divisor * @returns {!Long} Quotient */ LongPrototype.div = LongPrototype.divide; @@ -1091,7 +1167,7 @@ LongPrototype.div = LongPrototype.divide; /** * Returns this Long modulo the specified. * @this {!Long} - * @param {!Long|number|string} divisor Divisor + * @param {!Long|number|bigint|string} divisor Divisor * @returns {!Long} Remainder */ LongPrototype.modulo = function modulo(divisor) { @@ -1115,7 +1191,7 @@ LongPrototype.modulo = function modulo(divisor) { /** * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}. * @function - * @param {!Long|number|string} divisor Divisor + * @param {!Long|number|bigint|string} divisor Divisor * @returns {!Long} Remainder */ LongPrototype.mod = LongPrototype.modulo; @@ -1123,7 +1199,7 @@ 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 + * @param {!Long|number|bigint|string} divisor Divisor * @returns {!Long} Remainder */ LongPrototype.rem = LongPrototype.modulo; @@ -1174,7 +1250,7 @@ LongPrototype.ctz = LongPrototype.countTrailingZeros; /** * Returns the bitwise AND of this Long and the specified. * @this {!Long} - * @param {!Long|number|string} other Other Long + * @param {!Long|number|bigint|string} other Other Long * @returns {!Long} */ LongPrototype.and = function and(other) { @@ -1186,7 +1262,7 @@ LongPrototype.and = function and(other) { /** * Returns the bitwise OR of this Long and the specified. * @this {!Long} - * @param {!Long|number|string} other Other Long + * @param {!Long|number|bigint|string} other Other Long * @returns {!Long} */ LongPrototype.or = function or(other) { @@ -1198,7 +1274,7 @@ LongPrototype.or = function or(other) { /** * Returns the bitwise XOR of this Long and the given one. * @this {!Long} - * @param {!Long|number|string} other Other Long + * @param {!Long|number|bigint|string} other Other Long * @returns {!Long} */ LongPrototype.xor = function xor(other) { @@ -1464,4 +1540,40 @@ Long.fromBytesBE = function fromBytesBE(bytes, unsigned) { ); }; +// Support conversion to/from BigInt where available +if (typeof BigInt === "function") { + + /** + * Returns a Long representing the given big integer. + * @function + * @param {number} value The big integer value + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {!Long} The corresponding Long value + */ + Long.fromBigInt = function fromBigInt(value, unsigned) { + var lowBits = Number(BigInt.asIntN(32, value)); + var highBits = Number(BigInt.asIntN(32, value >> BigInt(32))); + return fromBits(lowBits, highBits, unsigned); + }; + + // Override + Long.fromValue = function fromValueWithBigInt(value, unsigned) { + if (typeof value === "bigint") + return fromBigInt(value, unsigned); + return fromValue(value, unsigned); + } + + /** + * Converts the Long to its big integer representation. + * @this {!Long} + * @returns {bigint} + */ + LongPrototype.toBigInt = function toBigInt() { + var lowBigInt = BigInt(this.low >>> 0); + var highBigInt = BigInt(this.unsigned ? this.high >>> 0 : this.high); + return highBigInt << BigInt(32) | lowBigInt; + }; + +} + export default Long; diff --git a/node_modules/long/package.json b/node_modules/long/package.json index 5333376db3..7144fcecc8 100644 --- a/node_modules/long/package.json +++ b/node_modules/long/package.json @@ -1,6 +1,6 @@ { "name": "long", - "version": "5.2.4", + "version": "5.3.0", "author": "Daniel Wirtz ", "description": "A Long class for representing a 64-bit two's-complement integer value.", "repository": { @@ -33,7 +33,9 @@ }, "scripts": { "build": "esm2umd Long index.js > umd/index.js", - "test": "node tests" + "test": "npm run test:unit && npm run test:typescript", + "test:unit": "node tests", + "test:typescript": "tsc --project tests/typescript/tsconfig.esnext.json && tsc --project tests/typescript/tsconfig.nodenext.json && tsc --project tests/typescript/tsconfig.commonjs.json" }, "files": [ "index.js", @@ -41,10 +43,12 @@ "umd/index.js", "umd/index.d.ts", "umd/package.json", + "types.d.ts", "LICENSE", "README.md" ], "devDependencies": { - "esm2umd": "^0.2.1" + "esm2umd": "^0.2.2", + "typescript": "^5.7.3" } } diff --git a/node_modules/long/types.d.ts b/node_modules/long/types.d.ts new file mode 100644 index 0000000000..7fc3f9badc --- /dev/null +++ b/node_modules/long/types.d.ts @@ -0,0 +1,465 @@ +type LongLike = Long | number | bigint | string | { low: number; high: number; unsigned: boolean }; + +export declare class Long { + /** + * 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. + */ + constructor(low: number, high?: number, unsigned?: boolean); + + /** + * Maximum unsigned value. + */ + static MAX_UNSIGNED_VALUE: Long; + + /** + * Maximum signed value. + */ + static MAX_VALUE: Long; + + /** + * Minimum signed value. + */ + static MIN_VALUE: Long; + + /** + * Signed negative one. + */ + static NEG_ONE: Long; + + /** + * Signed one. + */ + static ONE: Long; + + /** + * Unsigned one. + */ + static UONE: Long; + + /** + * Unsigned zero. + */ + static UZERO: Long; + + /** + * Signed zero + */ + static ZERO: Long; + + /** + * The high 32 bits as a signed value. + */ + high: number; + + /** + * The low 32 bits as a signed value. + */ + low: number; + + /** + * Whether unsigned or not. + */ + unsigned: boolean; + + /** + * 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. + */ + static fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long; + + /** + * Returns a Long representing the given 32 bit integer value. + */ + static fromInt(value: number, unsigned?: boolean): Long; + + /** + * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. + */ + static fromNumber(value: number, unsigned?: boolean): Long; + + /** + * Returns a Long representing the given big integer value. + */ + static fromBigInt(value: bigint, unsigned?: boolean): Long; + + /** + * Returns a Long representation of the given string, written using the specified radix. + */ + static fromString( + str: string, + unsigned?: boolean | number, + radix?: number + ): Long; + + /** + * Creates a Long from its byte representation. + */ + static fromBytes(bytes: number[], unsigned?: boolean, le?: boolean): Long; + + /** + * Creates a Long from its little endian byte representation. + */ + static fromBytesLE(bytes: number[], unsigned?: boolean): Long; + + /** + * Creates a Long from its big endian byte representation. + */ + static fromBytesBE(bytes: number[], unsigned?: boolean): Long; + + /** + * Tests if the specified object is a Long. + */ + static isLong(obj: any): obj is Long; + + /** + * Converts the specified value to a Long. + */ + static fromValue(val: LongLike, unsigned?: boolean): Long; + + /** + * Returns the sum of this and the specified Long. + */ + add(addend: LongLike): Long; + + /** + * Returns the bitwise AND of this Long and the specified. + */ + and(other: LongLike): Long; + + /** + * Compares this Long's value with the specified's. + */ + compare(other: LongLike): number; + + /** + * Compares this Long's value with the specified's. + */ + comp(other: LongLike): number; + + /** + * Returns this Long divided by the specified. + */ + divide(divisor: LongLike): Long; + + /** + * Returns this Long divided by the specified. + */ + div(divisor: LongLike): Long; + + /** + * Tests if this Long's value equals the specified's. + */ + equals(other: LongLike): boolean; + + /** + * Tests if this Long's value equals the specified's. + */ + eq(other: LongLike): boolean; + + /** + * Gets the high 32 bits as a signed integer. + */ + getHighBits(): number; + + /** + * Gets the high 32 bits as an unsigned integer. + */ + getHighBitsUnsigned(): number; + + /** + * Gets the low 32 bits as a signed integer. + */ + getLowBits(): number; + + /** + * Gets the low 32 bits as an unsigned integer. + */ + getLowBitsUnsigned(): number; + + /** + * Gets the number of bits needed to represent the absolute value of this Long. + */ + getNumBitsAbs(): number; + + /** + * Tests if this Long's value is greater than the specified's. + */ + greaterThan(other: LongLike): boolean; + + /** + * Tests if this Long's value is greater than the specified's. + */ + gt(other: LongLike): boolean; + + /** + * Tests if this Long's value is greater than or equal the specified's. + */ + greaterThanOrEqual(other: LongLike): boolean; + + /** + * Tests if this Long's value is greater than or equal the specified's. + */ + gte(other: LongLike): boolean; + + /** + * Tests if this Long's value is greater than or equal the specified's. + */ + ge(other: LongLike): boolean; + + /** + * Tests if this Long's value is even. + */ + isEven(): boolean; + + /** + * Tests if this Long's value is negative. + */ + isNegative(): boolean; + + /** + * Tests if this Long's value is odd. + */ + isOdd(): boolean; + + /** + * Tests if this Long's value is positive or zero. + */ + isPositive(): boolean; + + /** + * Tests if this Long can be safely represented as a JavaScript number. + */ + isSafeInteger(): boolean; + + /** + * Tests if this Long's value equals zero. + */ + isZero(): boolean; + + /** + * Tests if this Long's value equals zero. + */ + eqz(): boolean; + + /** + * Tests if this Long's value is less than the specified's. + */ + lessThan(other: LongLike): boolean; + + /** + * Tests if this Long's value is less than the specified's. + */ + lt(other: LongLike): boolean; + + /** + * Tests if this Long's value is less than or equal the specified's. + */ + lessThanOrEqual(other: LongLike): boolean; + + /** + * Tests if this Long's value is less than or equal the specified's. + */ + lte(other: LongLike): boolean; + + /** + * Tests if this Long's value is less than or equal the specified's. + */ + le(other: LongLike): boolean; + + /** + * Returns this Long modulo the specified. + */ + modulo(other: LongLike): Long; + + /** + * Returns this Long modulo the specified. + */ + mod(other: LongLike): Long; + + /** + * Returns this Long modulo the specified. + */ + rem(other: LongLike): Long; + + /** + * Returns the product of this and the specified Long. + */ + multiply(multiplier: LongLike): Long; + + /** + * Returns the product of this and the specified Long. + */ + mul(multiplier: LongLike): Long; + + /** + * Negates this Long's value. + */ + negate(): Long; + + /** + * Negates this Long's value. + */ + neg(): Long; + + /** + * Returns the bitwise NOT of this Long. + */ + not(): Long; + + /** + * Returns count leading zeros of this Long. + */ + countLeadingZeros(): number; + + /** + * Returns count leading zeros of this Long. + */ + clz(): number; + + /** + * Returns count trailing zeros of this Long. + */ + countTrailingZeros(): number; + + /** + * Returns count trailing zeros of this Long. + */ + ctz(): number; + + /** + * Tests if this Long's value differs from the specified's. + */ + notEquals(other: LongLike): boolean; + + /** + * Tests if this Long's value differs from the specified's. + */ + neq(other: LongLike): boolean; + + /** + * Tests if this Long's value differs from the specified's. + */ + ne(other: LongLike): boolean; + + /** + * Returns the bitwise OR of this Long and the specified. + */ + or(other: LongLike): Long; + + /** + * Returns this Long with bits shifted to the left by the given amount. + */ + shiftLeft(numBits: number | Long): Long; + + /** + * Returns this Long with bits shifted to the left by the given amount. + */ + shl(numBits: number | Long): Long; + + /** + * Returns this Long with bits arithmetically shifted to the right by the given amount. + */ + shiftRight(numBits: number | Long): Long; + + /** + * Returns this Long with bits arithmetically shifted to the right by the given amount. + */ + shr(numBits: number | Long): Long; + + /** + * Returns this Long with bits logically shifted to the right by the given amount. + */ + shiftRightUnsigned(numBits: number | Long): Long; + + /** + * Returns this Long with bits logically shifted to the right by the given amount. + */ + shru(numBits: number | Long): Long; + + /** + * Returns this Long with bits logically shifted to the right by the given amount. + */ + shr_u(numBits: number | Long): Long; + + /** + * Returns this Long with bits rotated to the left by the given amount. + */ + rotateLeft(numBits: number | Long): Long; + + /** + * Returns this Long with bits rotated to the left by the given amount. + */ + rotl(numBits: number | Long): Long; + + /** + * Returns this Long with bits rotated to the right by the given amount. + */ + rotateRight(numBits: number | Long): Long; + + /** + * Returns this Long with bits rotated to the right by the given amount. + */ + rotr(numBits: number | Long): Long; + + /** + * Returns the difference of this and the specified Long. + */ + subtract(subtrahend: LongLike): Long; + + /** + * Returns the difference of this and the specified Long. + */ + sub(subtrahend: LongLike): Long; + + /** + * Converts the Long to a big integer. + */ + toBigInt(): bigint; + + /** + * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. + */ + toInt(): number; + + /** + * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). + */ + toNumber(): number; + + /** + * Converts this Long to its byte representation. + */ + + toBytes(le?: boolean): number[]; + + /** + * Converts this Long to its little endian byte representation. + */ + + toBytesLE(): number[]; + + /** + * Converts this Long to its big endian byte representation. + */ + + toBytesBE(): number[]; + + /** + * Converts this Long to signed. + */ + toSigned(): Long; + + /** + * Converts the Long to a string written in the specified radix. + */ + toString(radix?: number): string; + + /** + * Converts this Long to unsigned. + */ + toUnsigned(): Long; + + /** + * Returns the bitwise XOR of this Long and the given one. + */ + xor(other: LongLike): Long; +} diff --git a/node_modules/long/umd/index.d.ts b/node_modules/long/umd/index.d.ts index c6b1440c86..3599abb027 100644 --- a/node_modules/long/umd/index.d.ts +++ b/node_modules/long/umd/index.d.ts @@ -1,457 +1,2 @@ -declare class Long { - /** - * 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. - */ - constructor(low: number, high?: number, unsigned?: boolean); - - /** - * Maximum unsigned value. - */ - static MAX_UNSIGNED_VALUE: Long; - - /** - * Maximum signed value. - */ - static MAX_VALUE: Long; - - /** - * Minimum signed value. - */ - static MIN_VALUE: Long; - - /** - * Signed negative one. - */ - static NEG_ONE: Long; - - /** - * Signed one. - */ - static ONE: Long; - - /** - * Unsigned one. - */ - static UONE: Long; - - /** - * Unsigned zero. - */ - static UZERO: Long; - - /** - * Signed zero - */ - static ZERO: Long; - - /** - * The high 32 bits as a signed value. - */ - high: number; - - /** - * The low 32 bits as a signed value. - */ - low: number; - - /** - * Whether unsigned or not. - */ - unsigned: boolean; - - /** - * 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. - */ - static fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long; - - /** - * Returns a Long representing the given 32 bit integer value. - */ - static fromInt(value: number, unsigned?: boolean): Long; - - /** - * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. - */ - static fromNumber(value: number, unsigned?: boolean): Long; - - /** - * Returns a Long representation of the given string, written using the specified radix. - */ - static fromString( - str: string, - unsigned?: boolean | number, - radix?: number - ): Long; - - /** - * Creates a Long from its byte representation. - */ - static fromBytes(bytes: number[], unsigned?: boolean, le?: boolean): Long; - - /** - * Creates a Long from its little endian byte representation. - */ - static fromBytesLE(bytes: number[], unsigned?: boolean): Long; - - /** - * Creates a Long from its big endian byte representation. - */ - static fromBytesBE(bytes: number[], unsigned?: boolean): Long; - - /** - * Tests if the specified object is a Long. - */ - static isLong(obj: any): obj is Long; - - /** - * Converts the specified value to a Long. - */ - static fromValue( - val: - | Long - | number - | string - | { low: number; high: number; unsigned: boolean }, - unsigned?: boolean - ): Long; - - /** - * Returns the sum of this and the specified Long. - */ - add(addend: number | Long | string): Long; - - /** - * Returns the bitwise AND of this Long and the specified. - */ - and(other: Long | number | string): Long; - - /** - * Compares this Long's value with the specified's. - */ - compare(other: Long | number | string): number; - - /** - * Compares this Long's value with the specified's. - */ - comp(other: Long | number | string): number; - - /** - * Returns this Long divided by the specified. - */ - divide(divisor: Long | number | string): Long; - - /** - * Returns this Long divided by the specified. - */ - div(divisor: Long | number | string): Long; - - /** - * Tests if this Long's value equals the specified's. - */ - equals(other: Long | number | string): boolean; - - /** - * Tests if this Long's value equals the specified's. - */ - eq(other: Long | number | string): boolean; - - /** - * Gets the high 32 bits as a signed integer. - */ - getHighBits(): number; - - /** - * Gets the high 32 bits as an unsigned integer. - */ - getHighBitsUnsigned(): number; - - /** - * Gets the low 32 bits as a signed integer. - */ - getLowBits(): number; - - /** - * Gets the low 32 bits as an unsigned integer. - */ - getLowBitsUnsigned(): number; - - /** - * Gets the number of bits needed to represent the absolute value of this Long. - */ - getNumBitsAbs(): number; - - /** - * Tests if this Long's value is greater than the specified's. - */ - greaterThan(other: Long | number | string): boolean; - - /** - * Tests if this Long's value is greater than the specified's. - */ - gt(other: Long | number | string): boolean; - - /** - * Tests if this Long's value is greater than or equal the specified's. - */ - greaterThanOrEqual(other: Long | number | string): boolean; - - /** - * Tests if this Long's value is greater than or equal the specified's. - */ - gte(other: Long | number | string): boolean; - - /** - * Tests if this Long's value is greater than or equal the specified's. - */ - ge(other: Long | number | string): boolean; - - /** - * Tests if this Long's value is even. - */ - isEven(): boolean; - - /** - * Tests if this Long's value is negative. - */ - isNegative(): boolean; - - /** - * Tests if this Long's value is odd. - */ - isOdd(): boolean; - - /** - * Tests if this Long's value is positive or zero. - */ - isPositive(): boolean; - - /** - * Tests if this Long's value equals zero. - */ - isZero(): boolean; - - /** - * Tests if this Long's value equals zero. - */ - eqz(): boolean; - - /** - * Tests if this Long's value is less than the specified's. - */ - lessThan(other: Long | number | string): boolean; - - /** - * Tests if this Long's value is less than the specified's. - */ - lt(other: Long | number | string): boolean; - - /** - * Tests if this Long's value is less than or equal the specified's. - */ - lessThanOrEqual(other: Long | number | string): boolean; - - /** - * Tests if this Long's value is less than or equal the specified's. - */ - lte(other: Long | number | string): boolean; - - /** - * Tests if this Long's value is less than or equal the specified's. - */ - le(other: Long | number | string): boolean; - - /** - * Returns this Long modulo the specified. - */ - modulo(other: Long | number | string): Long; - - /** - * Returns this Long modulo the specified. - */ - mod(other: Long | number | string): Long; - - /** - * Returns this Long modulo the specified. - */ - rem(other: Long | number | string): Long; - - /** - * Returns the product of this and the specified Long. - */ - multiply(multiplier: Long | number | string): Long; - - /** - * Returns the product of this and the specified Long. - */ - mul(multiplier: Long | number | string): Long; - - /** - * Negates this Long's value. - */ - negate(): Long; - - /** - * Negates this Long's value. - */ - neg(): Long; - - /** - * Returns the bitwise NOT of this Long. - */ - not(): Long; - - /** - * Returns count leading zeros of this Long. - */ - countLeadingZeros(): number; - - /** - * Returns count leading zeros of this Long. - */ - clz(): number; - - /** - * Returns count trailing zeros of this Long. - */ - countTrailingZeros(): number; - - /** - * Returns count trailing zeros of this Long. - */ - ctz(): number; - - /** - * Tests if this Long's value differs from the specified's. - */ - notEquals(other: Long | number | string): boolean; - - /** - * Tests if this Long's value differs from the specified's. - */ - neq(other: Long | number | string): boolean; - - /** - * Tests if this Long's value differs from the specified's. - */ - ne(other: Long | number | string): boolean; - - /** - * Returns the bitwise OR of this Long and the specified. - */ - or(other: Long | number | string): Long; - - /** - * Returns this Long with bits shifted to the left by the given amount. - */ - shiftLeft(numBits: number | Long): Long; - - /** - * Returns this Long with bits shifted to the left by the given amount. - */ - shl(numBits: number | Long): Long; - - /** - * Returns this Long with bits arithmetically shifted to the right by the given amount. - */ - shiftRight(numBits: number | Long): Long; - - /** - * Returns this Long with bits arithmetically shifted to the right by the given amount. - */ - shr(numBits: number | Long): Long; - - /** - * Returns this Long with bits logically shifted to the right by the given amount. - */ - shiftRightUnsigned(numBits: number | Long): Long; - - /** - * Returns this Long with bits logically shifted to the right by the given amount. - */ - shru(numBits: number | Long): Long; - - /** - * Returns this Long with bits logically shifted to the right by the given amount. - */ - shr_u(numBits: number | Long): Long; - - /** - * Returns this Long with bits rotated to the left by the given amount. - */ - rotateLeft(numBits: number | Long): Long; - - /** - * Returns this Long with bits rotated to the left by the given amount. - */ - rotl(numBits: number | Long): Long; - - /** - * Returns this Long with bits rotated to the right by the given amount. - */ - rotateRight(numBits: number | Long): Long; - - /** - * Returns this Long with bits rotated to the right by the given amount. - */ - rotr(numBits: number | Long): Long; - - /** - * Returns the difference of this and the specified Long. - */ - subtract(subtrahend: number | Long | string): Long; - - /** - * Returns the difference of this and the specified Long. - */ - sub(subtrahend: number | Long | string): Long; - - /** - * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. - */ - toInt(): number; - - /** - * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). - */ - toNumber(): number; - - /** - * Converts this Long to its byte representation. - */ - - toBytes(le?: boolean): number[]; - - /** - * Converts this Long to its little endian byte representation. - */ - - toBytesLE(): number[]; - - /** - * Converts this Long to its big endian byte representation. - */ - - toBytesBE(): number[]; - - /** - * Converts this Long to signed. - */ - toSigned(): Long; - - /** - * Converts the Long to a string written in the specified radix. - */ - toString(radix?: number): string; - - /** - * Converts this Long to unsigned. - */ - toUnsigned(): Long; - - /** - * Returns the bitwise XOR of this Long and the given one. - */ - xor(other: Long | number | string): Long; -} - +import { Long } from '../types.js'; export = Long; diff --git a/node_modules/long/umd/index.js b/node_modules/long/umd/index.js index a6ccd9cc45..376ab3a64c 100644 --- a/node_modules/long/umd/index.js +++ b/node_modules/long/umd/index.js @@ -6,7 +6,6 @@ var Long = (function(exports) { value: true }); exports.default = void 0; - /** * @license * Copyright 2009 The Closure Library Authors @@ -26,13 +25,71 @@ var Long = (function(exports) { * * SPDX-License-Identifier: Apache-2.0 */ + // WebAssembly 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 :( + wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([ + // \0asm + 0, 97, 115, 109, + // version 1 + 1, 0, 0, 0, + // section "type" + 1, 13, 2, + // 0, () => i32 + 96, 0, 1, 127, + // 1, (i32, i32, i32, i32) => i32 + 96, 4, 127, 127, 127, 127, 1, 127, + // section "function" + 3, 7, 6, + // 0, type 0 + 0, + // 1, type 1 + 1, + // 2, type 1 + 1, + // 3, type 1 + 1, + // 4, type 1 + 1, + // 5, type 1 + 1, + // section "global" + 6, 6, 1, + // 0, "high", mutable i32 + 127, 1, 65, 0, 11, + // section "export" + 7, 50, 6, + // 0, "mul" + 3, 109, 117, 108, 0, 1, + // 1, "div_s" + 5, 100, 105, 118, 95, 115, 0, 2, + // 2, "div_u" + 5, 100, 105, 118, 95, 117, 0, 3, + // 3, "rem_s" + 5, 114, 101, 109, 95, 115, 0, 4, + // 4, "rem_u" + 5, 114, 101, 109, 95, 117, 0, 5, + // 5, "get_high" + 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, + // section "code" + 10, 191, 1, 6, + // 0, "get_high" + 4, 0, 35, 0, 11, + // 1, "mul" + 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, + // 2, "div_s" + 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, + // 3, "div_u" + 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, + // 4, "rem_s" + 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, + // 5, "rem_u" + 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 { + // 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. @@ -43,27 +100,27 @@ var Long = (function(exports) { * @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. + } + + // 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 @@ -86,91 +143,83 @@ var Long = (function(exports) { * @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; } + /** * @function * @param {*} value number * @returns {number} * @inner */ - - function ctz32(value) { var c = Math.clz32(value & -value); return value ? 31 - c : c; } + /** * 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, 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 @@ -178,19 +227,16 @@ var Long = (function(exports) { * @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; @@ -198,10 +244,10 @@ var Long = (function(exports) { 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 @@ -209,9 +255,8 @@ var Long = (function(exports) { * @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 @@ -219,10 +264,10 @@ var Long = (function(exports) { * @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. @@ -232,9 +277,8 @@ var Long = (function(exports) { * @param {boolean=} unsigned Whether unsigned or not, defaults to signed * @returns {!Long} The corresponding Long value */ - - Long.fromBits = fromBits; + /** * @function * @param {number} base @@ -242,7 +286,6 @@ var Long = (function(exports) { * @returns {number} * @inner */ - var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4) /** @@ -252,10 +295,8 @@ var Long = (function(exports) { * @returns {!Long} * @inner */ - function fromString(str, unsigned, radix) { if (str.length === 0) throw Error('empty string'); - if (typeof unsigned === 'number') { // For goog.math.long compatibility radix = unsigned; @@ -263,23 +304,21 @@ var Long = (function(exports) { } else { unsigned = !!unsigned; } - if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity") return unsigned ? UZERO : ZERO; 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. + } + // 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); - + 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)); @@ -288,10 +327,10 @@ var Long = (function(exports) { result = result.add(fromNumber(value)); } } - result.unsigned = unsigned; return result; } + /** * Returns a Long representation of the given string, written using the specified radix. * @function @@ -300,9 +339,8 @@ var Long = (function(exports) { * @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 @@ -310,23 +348,23 @@ var Long = (function(exports) { * @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: - + 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 {!Long|number|bigint|string|!{low: number, high: number, unsigned: boolean}} val Value * @param {boolean=} unsigned Whether unsigned or not, defaults to signed * @returns {!Long} */ + Long.fromValue = fromValue; - - Long.fromValue = fromValue; // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be + // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be // no runtime penalty for these. /** @@ -334,165 +372,164 @@ var Long = (function(exports) { * @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. * @this {!Long} * @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). * @this {!Long} * @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. * @this {!Long} @@ -501,363 +538,346 @@ var Long = (function(exports) { * @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); + 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. - + } + // 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; + rem = this; var result = ''; - while (true) { var remDiv = rem.div(radixToPower), - intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0, - digits = intval.toString(radix); + 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. * @this {!Long} * @returns {number} Signed high bits */ - - LongPrototype.getHighBits = function getHighBits() { return this.high; }; + /** * Gets the high 32 bits as an unsigned integer. * @this {!Long} * @returns {number} Unsigned high bits */ - - LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() { return this.high >>> 0; }; + /** * Gets the low 32 bits as a signed integer. * @this {!Long} * @returns {number} Signed low bits */ - - LongPrototype.getLowBits = function getLowBits() { return this.low; }; + /** * Gets the low 32 bits as an unsigned integer. * @this {!Long} * @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. * @this {!Long} * @returns {number} */ - - LongPrototype.getNumBitsAbs = function getNumBitsAbs() { - if (this.isNegative()) // Unsigned Longs are never negative + 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. + * Tests if this Long can be safely represented as a JavaScript number. * @this {!Long} * @returns {boolean} */ + LongPrototype.isSafeInteger = function isSafeInteger() { + // 2^53-1 is the maximum safe value + var top11Bits = this.high >> 21; + // [0, 2^53-1] + if (!top11Bits) return true; + // > 2^53-1 + if (this.unsigned) return false; + // [-2^53, -1] except -2^53 + return top11Bits === -1 && !(this.low === 0 && this.high === -0x200000); + }; - + /** + * Tests if this Long's value equals zero. + * @this {!Long} + * @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. * @this {!Long} * @returns {boolean} */ - LongPrototype.isNegative = function isNegative() { return !this.unsigned && this.high < 0; }; + /** * Tests if this Long's value is positive or zero. * @this {!Long} * @returns {boolean} */ - - LongPrototype.isPositive = function isPositive() { return this.unsigned || this.high >= 0; }; + /** * Tests if this Long's value is odd. * @this {!Long} * @returns {boolean} */ - - LongPrototype.isOdd = function isOdd() { return (this.low & 1) === 1; }; + /** * Tests if this Long's value is even. * @this {!Long} * @returns {boolean} */ - - LongPrototype.isEven = function isEven() { return (this.low & 1) === 0; }; + /** * Tests if this Long's value equals the specified's. * @this {!Long} - * @param {!Long|number|string} other Other value + * @param {!Long|number|bigint|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 + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ - - LongPrototype.eq = LongPrototype.equals; + /** * Tests if this Long's value differs from the specified's. * @this {!Long} - * @param {!Long|number|string} other Other value + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ - LongPrototype.notEquals = function notEquals(other) { - return !this.eq( - /* validates */ - 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 + * @param {!Long|number|bigint|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 + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ - LongPrototype.ne = LongPrototype.notEquals; + /** * Tests if this Long's value is less than the specified's. * @this {!Long} - * @param {!Long|number|string} other Other value + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ - LongPrototype.lessThan = function lessThan(other) { - return this.comp( - /* validates */ - other) < 0; + 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 + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ - - LongPrototype.lt = LongPrototype.lessThan; + /** * Tests if this Long's value is less than or equal the specified's. * @this {!Long} - * @param {!Long|number|string} other Other value + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ - LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) { - return this.comp( - /* validates */ - other) <= 0; + 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 + * @param {!Long|number|bigint|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 + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ - LongPrototype.le = LongPrototype.lessThanOrEqual; + /** * Tests if this Long's value is greater than the specified's. * @this {!Long} - * @param {!Long|number|string} other Other value + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ - LongPrototype.greaterThan = function greaterThan(other) { - return this.comp( - /* validates */ - other) > 0; + 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 + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ - - LongPrototype.gt = LongPrototype.greaterThan; + /** * Tests if this Long's value is greater than or equal the specified's. * @this {!Long} - * @param {!Long|number|string} other Other value + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ - LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) { - return this.comp( - /* validates */ - other) >= 0; + 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 + * @param {!Long|number|bigint|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 + * @param {!Long|number|bigint|string} other Other value * @returns {boolean} */ - LongPrototype.ge = LongPrototype.greaterThanOrEqual; + /** * Compares this Long's value with the specified's. * @this {!Long} - * @param {!Long|number|string} other Other value + * @param {!Long|number|bigint|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(); + 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 - + 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 + * @param {!Long|number|bigint|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. * @this {!Long} * @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. * @this {!Long} - * @param {!Long|number|string} addend Addend + * @param {!Long|number|bigint|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. + 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; @@ -868,9 +888,9 @@ var Long = (function(exports) { var b16 = addend.low >>> 16; var b00 = addend.low & 0xFFFF; var c48 = 0, - c32 = 0, - c16 = 0, - c00 = 0; + c32 = 0, + c16 = 0, + c00 = 0; c00 += a00 + b00; c16 += c00 >>> 16; c00 &= 0xFFFF; @@ -884,53 +904,52 @@ var Long = (function(exports) { c48 &= 0xFFFF; return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned); }; + /** * Returns the difference of this and the specified Long. * @this {!Long} - * @param {!Long|number|string} subtrahend Subtrahend + * @param {!Long|number|bigint|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 + * @param {!Long|number|bigint|string} subtrahend Subtrahend * @returns {!Long} Difference */ - - LongPrototype.sub = LongPrototype.subtract; + /** * Returns the product of this and the specified Long. * @this {!Long} - * @param {!Long|number|string} multiplier Multiplier + * @param {!Long|number|bigint|string} multiplier Multiplier * @returns {!Long} Product */ - LongPrototype.multiply = function multiply(multiplier) { if (this.isZero()) return this; - if (!isLong(multiplier)) multiplier = fromValue(multiplier); // use wasm support if present + 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 this.unsigned ? UZERO : 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 + } 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); - 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. + // 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; @@ -942,9 +961,9 @@ var Long = (function(exports) { var b16 = multiplier.low >>> 16; var b00 = multiplier.low & 0xFFFF; var c48 = 0, - c32 = 0, - c16 = 0, - c00 = 0; + c32 = 0, + c16 = 0, + c00 = 0; c00 += a00 * b00; c16 += c00 >>> 16; c00 &= 0xFFFF; @@ -967,27 +986,27 @@ var Long = (function(exports) { 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 + * @param {!Long|number|bigint|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. * @this {!Long} - * @param {!Long|number|string} divisor Divisor + * @param {!Long|number|bigint|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 (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 @@ -996,14 +1015,11 @@ var Long = (function(exports) { // 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. @@ -1013,7 +1029,6 @@ var Long = (function(exports) { // 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 { @@ -1023,230 +1038,217 @@ var Long = (function(exports) { } } } 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 + 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 + } + + // 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. + 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); - + 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. - + } + // 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 + * @param {!Long|number|bigint|string} divisor Divisor * @returns {!Long} Quotient */ - - LongPrototype.div = LongPrototype.divide; + /** * Returns this Long modulo the specified. * @this {!Long} - * @param {!Long|number|string} divisor Divisor + * @param {!Long|number|bigint|string} divisor Divisor * @returns {!Long} Remainder */ - LongPrototype.modulo = function modulo(divisor) { - if (!isLong(divisor)) divisor = fromValue(divisor); // use wasm support if present + 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 + * @param {!Long|number|bigint|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 + * @param {!Long|number|bigint|string} divisor Divisor * @returns {!Long} Remainder */ - LongPrototype.rem = LongPrototype.modulo; + /** * Returns the bitwise NOT of this Long. * @this {!Long} * @returns {!Long} */ - LongPrototype.not = function not() { return fromBits(~this.low, ~this.high, this.unsigned); }; + /** * Returns count leading zeros of this Long. * @this {!Long} * @returns {!number} */ - - LongPrototype.countLeadingZeros = function countLeadingZeros() { return this.high ? Math.clz32(this.high) : Math.clz32(this.low) + 32; }; + /** * Returns count leading zeros. This is an alias of {@link Long#countLeadingZeros}. * @function * @param {!Long} * @returns {!number} */ - - LongPrototype.clz = LongPrototype.countLeadingZeros; + /** * Returns count trailing zeros of this Long. * @this {!Long} * @returns {!number} */ - LongPrototype.countTrailingZeros = function countTrailingZeros() { return this.low ? ctz32(this.low) : ctz32(this.high) + 32; }; + /** * Returns count trailing zeros. This is an alias of {@link Long#countTrailingZeros}. * @function * @param {!Long} * @returns {!number} */ - - LongPrototype.ctz = LongPrototype.countTrailingZeros; + /** * Returns the bitwise AND of this Long and the specified. * @this {!Long} - * @param {!Long|number|string} other Other Long + * @param {!Long|number|bigint|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. * @this {!Long} - * @param {!Long|number|string} other Other Long + * @param {!Long|number|bigint|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. * @this {!Long} - * @param {!Long|number|string} other Other Long + * @param {!Long|number|bigint|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. * @this {!Long} * @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. * @this {!Long} * @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. * @this {!Long} * @param {number|!Long} numBits Number of bits * @returns {!Long} Shifted Long */ - LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) { if (isLong(numBits)) numBits = numBits.toInt(); if ((numBits &= 63) === 0) return this; @@ -1254,41 +1256,38 @@ var Long = (function(exports) { if (numBits === 32) return fromBits(this.high, 0, this.unsigned); return fromBits(this.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; + /** * Returns this Long with bits rotated to the left by the given amount. * @this {!Long} * @param {number|!Long} numBits Number of bits * @returns {!Long} Rotated Long */ - LongPrototype.rotateLeft = function rotateLeft(numBits) { var b; if (isLong(numBits)) numBits = numBits.toInt(); if ((numBits &= 63) === 0) return this; if (numBits === 32) return fromBits(this.high, this.low, this.unsigned); - if (numBits < 32) { b = 32 - numBits; return fromBits(this.low << numBits | this.high >>> b, this.high << numBits | this.low >>> b, this.unsigned); } - numBits -= 32; b = 32 - numBits; return fromBits(this.high << numBits | this.low >>> b, this.low << numBits | this.high >>> b, this.unsigned); @@ -1299,27 +1298,23 @@ var Long = (function(exports) { * @param {number|!Long} numBits Number of bits * @returns {!Long} Rotated Long */ - - LongPrototype.rotl = LongPrototype.rotateLeft; + /** * Returns this Long with bits rotated to the right by the given amount. * @this {!Long} * @param {number|!Long} numBits Number of bits * @returns {!Long} Rotated Long */ - LongPrototype.rotateRight = function rotateRight(numBits) { var b; if (isLong(numBits)) numBits = numBits.toInt(); if ((numBits &= 63) === 0) return this; if (numBits === 32) return fromBits(this.high, this.low, this.unsigned); - if (numBits < 32) { b = 32 - numBits; return fromBits(this.high << b | this.low >>> numBits, this.low << b | this.high >>> numBits, this.unsigned); } - numBits -= 32; b = 32 - numBits; return fromBits(this.low << b | this.high >>> numBits, this.high << b | this.low >>> numBits, this.unsigned); @@ -1330,65 +1325,60 @@ var Long = (function(exports) { * @param {number|!Long} numBits Number of bits * @returns {!Long} Rotated Long */ - - LongPrototype.rotr = LongPrototype.rotateRight; + /** * Converts this Long to signed. * @this {!Long} * @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. * @this {!Long} * @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 * @this {!Long} * @returns {!Array.} Byte representation */ - - LongPrototype.toBytes = function toBytes(le) { return le ? this.toBytesLE() : this.toBytesBE(); }; + /** * Converts this Long to its little endian byte representation. * @this {!Long} * @returns {!Array.} Little endian byte representation */ - - LongPrototype.toBytesLE = function toBytesLE() { var hi = this.high, - lo = this.low; + 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. * @this {!Long} * @returns {!Array.} Big endian byte representation */ - - LongPrototype.toBytesBE = function toBytesBE() { var hi = this.high, - lo = this.low; + 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 @@ -1396,36 +1386,63 @@ var Long = (function(exports) { * @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); }; - var _default = Long; - exports.default = _default; + // Support conversion to/from BigInt where available + if (typeof BigInt === "function") { + /** + * Returns a Long representing the given big integer. + * @function + * @param {number} value The big integer value + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {!Long} The corresponding Long value + */ + Long.fromBigInt = function fromBigInt(value, unsigned) { + var lowBits = Number(BigInt.asIntN(32, value)); + var highBits = Number(BigInt.asIntN(32, value >> BigInt(32))); + return fromBits(lowBits, highBits, unsigned); + }; + + // Override + Long.fromValue = function fromValueWithBigInt(value, unsigned) { + if (typeof value === "bigint") return fromBigInt(value, unsigned); + return fromValue(value, unsigned); + }; + + /** + * Converts the Long to its big integer representation. + * @this {!Long} + * @returns {bigint} + */ + LongPrototype.toBigInt = function toBigInt() { + var lowBigInt = BigInt(this.low >>> 0); + var highBigInt = BigInt(this.unsigned ? this.high >>> 0 : this.high); + return highBigInt << BigInt(32) | lowBigInt; + }; + } + var _default = exports.default = Long; return "default" in exports ? exports.default : exports; })({}); if (typeof define === 'function' && define.amd) define([], function() { return Long; }); diff --git a/node_modules/nock/lib/recorder.js b/node_modules/nock/lib/recorder.js index 4d70ac3bbd..460e365714 100644 --- a/node_modules/nock/lib/recorder.js +++ b/node_modules/nock/lib/recorder.js @@ -6,7 +6,6 @@ const { inspect } = require('util') const common = require('./common') const { restoreOverriddenClientRequest } = require('./intercept') -const { EventEmitter } = require('stream') const { gzipSync, brotliCompressSync, deflateSync } = require('zlib') const { default: nodeInterceptors, @@ -225,134 +224,106 @@ function record(recOptions) { // We override the requests so that we can save information on them before executing. clientRequestInterceptor.apply() fetchRequestInterceptor.apply() - clientRequestInterceptor.on('request', async function ({ request }) { - await recordRequest(request) - }) - fetchRequestInterceptor.on('request', async function ({ request }) { - await recordRequest(request) - }) + clientRequestInterceptor.on( + 'response', + async function ({ request, response }) { + await recordResponse(request, response) + }, + ) + fetchRequestInterceptor.on( + 'response', + async function ({ request, response }) { + // fetch decompresses the body automatically, so we need to recompress it + const codings = + response.headers + .get('content-encoding') + ?.toLowerCase() + .split(',') + .map(c => c.trim()) || [] + + let body = await response.arrayBuffer() + for (const coding of codings) { + if (coding === 'gzip') { + body = gzipSync(body) + } else if (coding === 'deflate') { + body = deflateSync(body) + } else if (coding === 'br') { + body = brotliCompressSync(body) + } + } - async function recordRequest(mswRequest) { + await recordResponse(request, new Response(body, response)) + }, + ) + + async function recordResponse(mswRequest, mswResponse) { const request = mswRequest.clone() + const response = mswResponse.clone() const { options } = common.normalizeClientRequestArgs(request.url) options.method = request.method const proto = options.protocol.slice(0, -1) + if (proto === 'https') { + options.proto = 'https' + } + debug(thisRecordingId, proto, 'intercepted request ended') + + let reqheaders + // Ignore request headers completely unless it was explicitly enabled by the user (see README) + if (enableReqHeadersRecording) { + // We never record user-agent headers as they are worse than useless - + // they actually make testing more difficult without providing any benefit (see README) + reqheaders = Object.fromEntries(request.headers.entries()) + common.deleteHeadersField(reqheaders, 'user-agent') + } - // Node 0.11 https.request calls http.request -- don't want to record things - // twice. - /* istanbul ignore if */ - if (options._recording) { - return + const headers = Object.fromEntries(response.headers.entries()) + const res = { + statusCode: response.status, + headers, + rawHeaders: headers, } - options._recording = true - - const req = new EventEmitter() - req.on('response', function () { - debug(thisRecordingId, 'intercepting', proto, 'request to record') - - clientRequestInterceptor.once('response', async function ({ response }) { - await recordResponse(response) - }) - fetchRequestInterceptor.once('response', async function ({ response }) { - // fetch decompresses the body automatically, so we need to recompress it - const codings = - response.headers - .get('content-encoding') - ?.toLowerCase() - .split(',') - .map(c => c.trim()) || [] - - let body = await response.arrayBuffer() - for (const coding of codings) { - if (coding === 'gzip') { - body = gzipSync(body) - } else if (coding === 'deflate') { - body = deflateSync(body) - } else if (coding === 'br') { - body = brotliCompressSync(body) - } - } - await recordResponse(new Response(body, response)) - }) - - // Intercept "res.once('end', ...)"-like event - async function recordResponse(mswResponse) { - const response = mswResponse.clone() - debug(thisRecordingId, proto, 'intercepted request ended') - - let reqheaders - // Ignore request headers completely unless it was explicitly enabled by the user (see README) - if (enableReqHeadersRecording) { - // We never record user-agent headers as they are worse than useless - - // they actually make testing more difficult without providing any benefit (see README) - reqheaders = Object.fromEntries(request.headers.entries()) - common.deleteHeadersField(reqheaders, 'user-agent') - } + const generateFn = outputObjects + ? generateRequestAndResponseObject + : generateRequestAndResponse + let out = generateFn({ + req: options, + bodyChunks: [Buffer.from(await request.arrayBuffer())], + options, + res, + dataChunks: [Buffer.from(await response.arrayBuffer())], + reqheaders, + }) - const headers = Object.fromEntries(response.headers.entries()) - const res = { - statusCode: response.status, - headers, - rawHeaders: headers, - } + debug('out:', out) + + // Check that the request was made during the current recording. + // If it hasn't then skip it. There is no other simple way to handle + // this as it depends on the timing of requests and responses. Throwing + // will make some recordings/unit tests fail randomly depending on how + // fast/slow the response arrived. + // If you are seeing this error then you need to make sure that all + // the requests made during a single recording session finish before + // ending the same recording session. + if (thisRecordingId !== currentRecordingId) { + debug('skipping recording of an out-of-order request', out) + return + } - const generateFn = outputObjects - ? generateRequestAndResponseObject - : generateRequestAndResponse - let out = generateFn({ - req: options, - bodyChunks: [Buffer.from(await request.arrayBuffer())], - options, - res, - dataChunks: [Buffer.from(await response.arrayBuffer())], - reqheaders, - }) - - debug('out:', out) - - // Check that the request was made during the current recording. - // If it hasn't then skip it. There is no other simple way to handle - // this as it depends on the timing of requests and responses. Throwing - // will make some recordings/unit tests fail randomly depending on how - // fast/slow the response arrived. - // If you are seeing this error then you need to make sure that all - // the requests made during a single recording session finish before - // ending the same recording session. - if (thisRecordingId !== currentRecordingId) { - debug('skipping recording of an out-of-order request', out) - return - } + outputs.push(out) - outputs.push(out) - - if (!dontPrint) { - if (useSeparator) { - if (typeof out !== 'string') { - out = JSON.stringify(out, null, 2) - } - logging(SEPARATOR + out + SEPARATOR) - } else { - logging(out) - } + if (!dontPrint) { + if (useSeparator) { + if (typeof out !== 'string') { + out = JSON.stringify(out, null, 2) } + logging(SEPARATOR + out + SEPARATOR) + } else { + logging(out) } + } - debug('finished setting up intercepting') - - // We override both the http and the https modules; when we are - // serializing the request, we need to know which was called. - // By stuffing the state, we can make sure that nock records - // the intended protocol. - if (proto === 'https') { - options.proto = 'https' - } - }) - - // This is a massive change, we are trying to change minimum code, so we emit end event here - // because mswjs take care for these events - // TODO: refactor the recorder, we no longer need all the listeners and can just record the request we get from MSW - req.emit('response') + debug('finished setting up intercepting') } } diff --git a/node_modules/nock/package.json b/node_modules/nock/package.json index 3f1bfdf0ca..c88111193c 100644 --- a/node_modules/nock/package.json +++ b/node_modules/nock/package.json @@ -7,7 +7,7 @@ "testing", "isolation" ], - "version": "14.0.0", + "version": "14.0.1", "author": "Pedro Teixeira ", "repository": { "type": "git", @@ -17,7 +17,7 @@ "url": "https://github.com/nock/nock/issues" }, "engines": { - "node": ">= 18" + "node": ">=18.20.0 <20 || >=20.12.1" }, "main": "./index.js", "types": "types", diff --git a/node_modules/semver/classes/semver.js b/node_modules/semver/classes/semver.js index 97049a4084..6fbc062bc2 100644 --- a/node_modules/semver/classes/semver.js +++ b/node_modules/semver/classes/semver.js @@ -1,6 +1,6 @@ const debug = require('../internal/debug') const { MAX_LENGTH, MAX_SAFE_INTEGER } = require('../internal/constants') -const { safeRe: re, t } = require('../internal/re') +const { safeRe: re, safeSrc: src, t } = require('../internal/re') const parseOptions = require('../internal/parse-options') const { compareIdentifiers } = require('../internal/identifiers') @@ -182,7 +182,8 @@ class SemVer { } // Avoid an invalid semver results if (identifier) { - const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]) + const r = new RegExp(`^${this.options.loose ? src[t.PRERELEASELOOSE] : src[t.PRERELEASE]}$`) + const match = `-${identifier}`.match(r) if (!match || match[1] !== identifier) { throw new Error(`invalid identifier: ${identifier}`) } diff --git a/node_modules/semver/internal/re.js b/node_modules/semver/internal/re.js index fd8920e7ba..2a956ba0a3 100644 --- a/node_modules/semver/internal/re.js +++ b/node_modules/semver/internal/re.js @@ -10,6 +10,7 @@ exports = module.exports = {} const re = exports.re = [] const safeRe = exports.safeRe = [] const src = exports.src = [] +const safeSrc = exports.safeSrc = [] const t = exports.t = {} let R = 0 @@ -42,6 +43,7 @@ const createToken = (name, value, isGlobal) => { debug(name, index, value) t[name] = index src[index] = value + safeSrc[index] = safe re[index] = new RegExp(value, isGlobal ? 'g' : undefined) safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined) } diff --git a/node_modules/semver/package.json b/node_modules/semver/package.json index 405fb66e68..c2644547a2 100644 --- a/node_modules/semver/package.json +++ b/node_modules/semver/package.json @@ -1,6 +1,6 @@ { "name": "semver", - "version": "7.7.0", + "version": "7.7.1", "description": "The semantic version parser used by npm.", "main": "index.js", "scripts": { diff --git a/package-lock.json b/package-lock.json index dc64790a53..2c858b0299 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,10 +35,10 @@ "get-folder-size": "^2.0.1", "js-yaml": "^4.1.0", "jsonschema": "1.4.1", - "long": "^5.2.4", + "long": "^5.3.0", "node-forge": "^1.3.1", "path": "^0.12.7", - "semver": "^7.7.0", + "semver": "^7.7.1", "uuid": "^11.0.5", "zlib": "^1.0.5" }, @@ -46,7 +46,7 @@ "@ava/typescript": "4.1.0", "@eslint/compat": "^1.1.1", "@eslint/eslintrc": "^3.2.0", - "@eslint/js": "^9.19.0", + "@eslint/js": "^9.20.0", "@microsoft/eslint-formatter-sarif": "^3.1.0", "@types/adm-zip": "^0.5.7", "@types/console-log-level": "^1.4.5", @@ -62,11 +62,11 @@ "eslint": "^8.57.1", "eslint-import-resolver-typescript": "^3.7.0", "eslint-plugin-filenames": "^1.3.2", - "eslint-plugin-github": "^5.1.7", + "eslint-plugin-github": "^5.1.8", "eslint-plugin-import": "2.29.1", "eslint-plugin-no-async-foreach": "^0.1.1", "micromatch": "4.0.8", - "nock": "^14.0.0", + "nock": "^14.0.1", "removeNPMAbsolutePaths": "3.0.1", "sinon": "^19.0.2", "typescript": "^5.7.3" @@ -695,9 +695,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.19.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.19.0.tgz", - "integrity": "sha512-rbq9/g38qjfqFLOVPvwjIvFFdNziEC5S65jmjPw5r6A//QH+W91akh9irMwjDN8zKUTak6W9EsAv4m/7Wnw0UQ==", + "version": "9.20.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.20.0.tgz", + "integrity": "sha512-iZA07H9io9Wn836aVTytRaNqh00Sad+EamwOVJT12GTLw1VGMFV/4JaME+JjLtr9fiGaoWgYnS54wrfWsSs4oQ==", "dev": true, "license": "MIT", "engines": { @@ -3806,9 +3806,9 @@ } }, "node_modules/eslint-plugin-github": { - "version": "5.1.7", - "resolved": "https://registry.npmjs.org/eslint-plugin-github/-/eslint-plugin-github-5.1.7.tgz", - "integrity": "sha512-P3S5TwvHy8u1QadfcI/tZ2uNFMTHv+mT/YmEdLEgEzp08mA3iK02kg/IhoWOz0SnbTyUi1qrq0a6SwC3uQSkpQ==", + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/eslint-plugin-github/-/eslint-plugin-github-5.1.8.tgz", + "integrity": "sha512-A6q+R3EBMF7hxIViWpQsalqpu3O0POcQ9VpN1m9W2I8yGumw+SFxXZUTafBd9X9mgUJhaU4M9qSifC1q/39H3A==", "dev": true, "license": "MIT", "dependencies": { @@ -5643,9 +5643,9 @@ "license": "MIT" }, "node_modules/long": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.4.tgz", - "integrity": "sha512-qtzLbJE8hq7VabR3mISmVGtoXP8KGc2Z/AT8OuqlYD7JTR3oqrgwdjnk07wpj1twXxYmgDXgoKVWUG/fReSzHg==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/long/-/long-5.3.0.tgz", + "integrity": "sha512-5vvY5yF1zF/kXk+L94FRiTDa1Znom46UjPCH6/XbSvS8zBKMFBHTJk8KDMqJ+2J6QezQFi7k1k8v21ClJYHPaw==", "license": "Apache-2.0" }, "node_modules/lower-case": { @@ -5862,9 +5862,9 @@ "license": "0BSD" }, "node_modules/nock": { - "version": "14.0.0", - "resolved": "https://registry.npmjs.org/nock/-/nock-14.0.0.tgz", - "integrity": "sha512-3Z2ZoZoYTR/y2I+NI16+6IzfZFKBX7MrADtoBAm7v/QKqxQUhKw+Dh+847PPS1j/FDutjfIXfrh3CJF74yITWg==", + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/nock/-/nock-14.0.1.tgz", + "integrity": "sha512-IJN4O9pturuRdn60NjQ7YkFt6Rwei7ZKaOwb1tvUIIqTgeD0SDDAX3vrqZD4wcXczeEy/AsUXxpGpP/yHqV7xg==", "dev": true, "license": "MIT", "dependencies": { @@ -5873,7 +5873,7 @@ "propagate": "^2.0.0" }, "engines": { - "node": ">= 18" + "node": ">=18.20.0 <20 || >=20.12.1" } }, "node_modules/node-fetch": { @@ -6691,9 +6691,9 @@ "license": "ISC" }, "node_modules/semver": { - "version": "7.7.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.0.tgz", - "integrity": "sha512-DrfFnPzblFmNrIZzg5RzHegbiRWg7KMR7btwi2yjHwx06zsUbO5g613sVwEV7FTwmzJu+Io0lJe2GJ3LxqpvBQ==", + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "license": "ISC", "bin": { "semver": "bin/semver.js" diff --git a/package.json b/package.json index cdde03e661..778968ea3e 100644 --- a/package.json +++ b/package.json @@ -48,10 +48,10 @@ "get-folder-size": "^2.0.1", "js-yaml": "^4.1.0", "jsonschema": "1.4.1", - "long": "^5.2.4", + "long": "^5.3.0", "node-forge": "^1.3.1", "path": "^0.12.7", - "semver": "^7.7.0", + "semver": "^7.7.1", "uuid": "^11.0.5", "zlib": "^1.0.5" }, @@ -62,7 +62,7 @@ "@ava/typescript": "4.1.0", "@eslint/compat": "^1.1.1", "@eslint/eslintrc": "^3.2.0", - "@eslint/js": "^9.19.0", + "@eslint/js": "^9.20.0", "@microsoft/eslint-formatter-sarif": "^3.1.0", "@types/adm-zip": "^0.5.7", "@types/console-log-level": "^1.4.5", @@ -78,11 +78,11 @@ "eslint": "^8.57.1", "eslint-import-resolver-typescript": "^3.7.0", "eslint-plugin-filenames": "^1.3.2", - "eslint-plugin-github": "^5.1.7", + "eslint-plugin-github": "^5.1.8", "eslint-plugin-import": "2.29.1", "eslint-plugin-no-async-foreach": "^0.1.1", "micromatch": "4.0.8", - "nock": "^14.0.0", + "nock": "^14.0.1", "removeNPMAbsolutePaths": "3.0.1", "sinon": "^19.0.2", "typescript": "^5.7.3" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy