@dxos/vendor-hypercore 0.8.4-main.66e292d → 0.8.4-main.69d29f4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/chunk-WLEV7IVZ.mjs +6336 -0
- package/dist/lib/browser/chunk-WLEV7IVZ.mjs.map +7 -0
- package/dist/lib/browser/hypercore-crypto.mjs +1 -1
- package/dist/lib/browser/hypercore.mjs +1022 -1128
- package/dist/lib/browser/hypercore.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/chunk-H7LBQLKP.mjs +5779 -0
- package/dist/lib/node-esm/chunk-H7LBQLKP.mjs.map +7 -0
- package/dist/lib/node-esm/hypercore-crypto.mjs +1 -1
- package/dist/lib/node-esm/hypercore.mjs +1050 -203
- package/dist/lib/node-esm/hypercore.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/package.json +7 -2
- package/dist/lib/browser/chunk-XAJ5RWMK.mjs +0 -223
- package/dist/lib/browser/chunk-XAJ5RWMK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IEADO42Y.mjs +0 -222
- package/dist/lib/node-esm/chunk-IEADO42Y.mjs.map +0 -7
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import "@dxos/node-std/globals";
|
|
2
|
-
import import$_dxos_node_std_events from '@dxos/node-std/events';
|
|
3
|
-
import * as import$
|
|
4
|
-
import * as import$sodium_universal_crypto_aead from 'sodium-universal/crypto_aead';
|
|
5
|
-
import * as import$sodium_universal_helpers from 'sodium-universal/helpers';
|
|
6
|
-
import * as import$sodium_universal_crypto_generichash from 'sodium-universal/crypto_generichash';
|
|
7
|
-
import * as import$sodium_universal_crypto_kx from 'sodium-universal/crypto_kx';
|
|
8
|
-
import * as import$sodium_universal_crypto_scalarmult from 'sodium-universal/crypto_scalarmult';
|
|
9
|
-
import * as import$streamx from 'streamx';
|
|
2
|
+
import import$d$_dxos_node_std_events from '@dxos/node-std/events';
|
|
3
|
+
import * as import$n$_dxos_node_std_events from '@dxos/node-std/events';
|
|
10
4
|
import {
|
|
11
5
|
__commonJS,
|
|
12
6
|
__export,
|
|
13
7
|
__reExport,
|
|
14
8
|
__require,
|
|
15
9
|
__toESM,
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
require_browser,
|
|
11
|
+
require_crypto_aead,
|
|
12
|
+
require_crypto_generichash,
|
|
13
|
+
require_crypto_kx,
|
|
14
|
+
require_crypto_scalarmult,
|
|
15
|
+
require_helpers,
|
|
16
|
+
require_hypercore_crypto,
|
|
17
|
+
require_memory,
|
|
18
|
+
require_nanoassert,
|
|
19
|
+
require_xsalsa20
|
|
20
|
+
} from "./chunk-WLEV7IVZ.mjs";
|
|
18
21
|
|
|
19
22
|
// ../../node_modules/.pnpm/last-one-wins@1.0.4/node_modules/last-one-wins/index.js
|
|
20
23
|
var require_last_one_wins = __commonJS({
|
|
@@ -2007,7 +2010,7 @@ var require_storage = __commonJS({
|
|
|
2007
2010
|
});
|
|
2008
2011
|
|
|
2009
2012
|
// ../../node_modules/.pnpm/inspect-custom-symbol@1.1.1/node_modules/inspect-custom-symbol/browser.js
|
|
2010
|
-
var
|
|
2013
|
+
var require_browser2 = __commonJS({
|
|
2011
2014
|
"../../node_modules/.pnpm/inspect-custom-symbol@1.1.1/node_modules/inspect-custom-symbol/browser.js"(exports, module) {
|
|
2012
2015
|
module.exports = Symbol.for("nodejs.util.inspect.custom");
|
|
2013
2016
|
}
|
|
@@ -2097,23 +2100,6 @@ var require_safe_buffer_equals = __commonJS({
|
|
|
2097
2100
|
}
|
|
2098
2101
|
});
|
|
2099
2102
|
|
|
2100
|
-
// ../../node_modules/.pnpm/nanoassert@2.0.0/node_modules/nanoassert/index.js
|
|
2101
|
-
var require_nanoassert = __commonJS({
|
|
2102
|
-
"../../node_modules/.pnpm/nanoassert@2.0.0/node_modules/nanoassert/index.js"(exports, module) {
|
|
2103
|
-
module.exports = assert;
|
|
2104
|
-
var AssertionError = class extends Error {
|
|
2105
|
-
};
|
|
2106
|
-
AssertionError.prototype.name = "AssertionError";
|
|
2107
|
-
function assert(t, m) {
|
|
2108
|
-
if (!t) {
|
|
2109
|
-
var err = new AssertionError(m);
|
|
2110
|
-
if (Error.captureStackTrace) Error.captureStackTrace(err, assert);
|
|
2111
|
-
throw err;
|
|
2112
|
-
}
|
|
2113
|
-
}
|
|
2114
|
-
}
|
|
2115
|
-
});
|
|
2116
|
-
|
|
2117
2103
|
// ../../node_modules/.pnpm/clone@2.1.2/node_modules/clone/clone.js
|
|
2118
2104
|
var require_clone = __commonJS({
|
|
2119
2105
|
"../../node_modules/.pnpm/clone@2.1.2/node_modules/clone/clone.js"(exports, module) {
|
|
@@ -2313,14 +2299,14 @@ var require_clone = __commonJS({
|
|
|
2313
2299
|
// ../../node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/cipher.js
|
|
2314
2300
|
var require_cipher = __commonJS({
|
|
2315
2301
|
"../../node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/cipher.js"(exports, module) {
|
|
2316
|
-
var { sodium_malloc, sodium_memzero } =
|
|
2302
|
+
var { sodium_malloc, sodium_memzero } = require_memory();
|
|
2317
2303
|
var {
|
|
2318
2304
|
crypto_aead_chacha20poly1305_ietf_KEYBYTES,
|
|
2319
2305
|
crypto_aead_chacha20poly1305_ietf_NPUBBYTES,
|
|
2320
2306
|
crypto_aead_chacha20poly1305_ietf_ABYTES,
|
|
2321
2307
|
crypto_aead_chacha20poly1305_ietf_encrypt,
|
|
2322
2308
|
crypto_aead_chacha20poly1305_ietf_decrypt
|
|
2323
|
-
} =
|
|
2309
|
+
} = require_crypto_aead();
|
|
2324
2310
|
var assert = require_nanoassert();
|
|
2325
2311
|
var KEYLEN = 32;
|
|
2326
2312
|
var NONCELEN = 8;
|
|
@@ -2387,8 +2373,8 @@ var require_cipher = __commonJS({
|
|
|
2387
2373
|
// ../../node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/cipher-state.js
|
|
2388
2374
|
var require_cipher_state = __commonJS({
|
|
2389
2375
|
"../../node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/cipher-state.js"(exports, module) {
|
|
2390
|
-
var { sodium_memzero } =
|
|
2391
|
-
var { sodium_increment, sodium_memcmp, sodium_is_zero } =
|
|
2376
|
+
var { sodium_memzero } = require_memory();
|
|
2377
|
+
var { sodium_increment, sodium_memcmp, sodium_is_zero } = require_helpers();
|
|
2392
2378
|
var assert = require_nanoassert();
|
|
2393
2379
|
var cipher = require_cipher();
|
|
2394
2380
|
var STATELEN = cipher.KEYLEN + cipher.NONCELEN;
|
|
@@ -2520,8 +2506,8 @@ var require_nanoassert2 = __commonJS({
|
|
|
2520
2506
|
// ../../node_modules/.pnpm/hmac-blake2b@2.0.0/node_modules/hmac-blake2b/index.js
|
|
2521
2507
|
var require_hmac_blake2b = __commonJS({
|
|
2522
2508
|
"../../node_modules/.pnpm/hmac-blake2b@2.0.0/node_modules/hmac-blake2b/index.js"(exports, module) {
|
|
2523
|
-
var { sodium_malloc, sodium_memzero } =
|
|
2524
|
-
var { crypto_generichash, crypto_generichash_batch } =
|
|
2509
|
+
var { sodium_malloc, sodium_memzero } = require_memory();
|
|
2510
|
+
var { crypto_generichash, crypto_generichash_batch } = require_crypto_generichash();
|
|
2525
2511
|
var assert = require_nanoassert2();
|
|
2526
2512
|
var HASHLEN = 64;
|
|
2527
2513
|
var BLOCKLEN = 128;
|
|
@@ -2558,8 +2544,8 @@ var require_hmac_blake2b = __commonJS({
|
|
|
2558
2544
|
// ../../node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/dh.js
|
|
2559
2545
|
var require_dh = __commonJS({
|
|
2560
2546
|
"../../node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/dh.js"(exports, module) {
|
|
2561
|
-
var { crypto_kx_SEEDBYTES, crypto_kx_keypair, crypto_kx_seed_keypair } =
|
|
2562
|
-
var { crypto_scalarmult_BYTES, crypto_scalarmult_SCALARBYTES, crypto_scalarmult } =
|
|
2547
|
+
var { crypto_kx_SEEDBYTES, crypto_kx_keypair, crypto_kx_seed_keypair } = require_crypto_kx();
|
|
2548
|
+
var { crypto_scalarmult_BYTES, crypto_scalarmult_SCALARBYTES, crypto_scalarmult } = require_crypto_scalarmult();
|
|
2563
2549
|
var assert = require_nanoassert();
|
|
2564
2550
|
var DHLEN = crypto_scalarmult_BYTES;
|
|
2565
2551
|
var PKLEN = crypto_scalarmult_BYTES;
|
|
@@ -2601,8 +2587,8 @@ var require_dh = __commonJS({
|
|
|
2601
2587
|
// ../../node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/hash.js
|
|
2602
2588
|
var require_hash = __commonJS({
|
|
2603
2589
|
"../../node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/hash.js"(exports, module) {
|
|
2604
|
-
var { sodium_malloc, sodium_memzero } =
|
|
2605
|
-
var { crypto_generichash_batch } =
|
|
2590
|
+
var { sodium_malloc, sodium_memzero } = require_memory();
|
|
2591
|
+
var { crypto_generichash_batch } = require_crypto_generichash();
|
|
2606
2592
|
var assert = require_nanoassert();
|
|
2607
2593
|
var hmacBlake2b = require_hmac_blake2b();
|
|
2608
2594
|
var dh = require_dh();
|
|
@@ -2649,7 +2635,7 @@ var require_hash = __commonJS({
|
|
|
2649
2635
|
// ../../node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/symmetric-state.js
|
|
2650
2636
|
var require_symmetric_state = __commonJS({
|
|
2651
2637
|
"../../node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/symmetric-state.js"(exports, module) {
|
|
2652
|
-
var { sodium_malloc, sodium_memzero } =
|
|
2638
|
+
var { sodium_malloc, sodium_memzero } = require_memory();
|
|
2653
2639
|
var assert = require_nanoassert();
|
|
2654
2640
|
var cipherState = require_cipher_state();
|
|
2655
2641
|
var hash = require_hash();
|
|
@@ -2776,7 +2762,7 @@ var require_symmetric_state = __commonJS({
|
|
|
2776
2762
|
// ../../node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/handshake-state.js
|
|
2777
2763
|
var require_handshake_state = __commonJS({
|
|
2778
2764
|
"../../node_modules/.pnpm/noise-protocol@3.0.1/node_modules/noise-protocol/handshake-state.js"(exports, module) {
|
|
2779
|
-
var { sodium_malloc, sodium_memzero, sodium_free } =
|
|
2765
|
+
var { sodium_malloc, sodium_memzero, sodium_free } = require_memory();
|
|
2780
2766
|
var assert = require_nanoassert();
|
|
2781
2767
|
var clone = require_clone();
|
|
2782
2768
|
var symmetricState = require_symmetric_state();
|
|
@@ -3599,694 +3585,12 @@ var require_signed_varint = __commonJS({
|
|
|
3599
3585
|
}
|
|
3600
3586
|
});
|
|
3601
3587
|
|
|
3602
|
-
// ../../node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/ascii.js
|
|
3603
|
-
var require_ascii = __commonJS({
|
|
3604
|
-
"../../node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/ascii.js"(exports, module) {
|
|
3605
|
-
function byteLength(string) {
|
|
3606
|
-
return string.length;
|
|
3607
|
-
}
|
|
3608
|
-
function toString(buffer) {
|
|
3609
|
-
const len = buffer.byteLength;
|
|
3610
|
-
let result = "";
|
|
3611
|
-
for (let i = 0; i < len; i++) {
|
|
3612
|
-
result += String.fromCharCode(buffer[i]);
|
|
3613
|
-
}
|
|
3614
|
-
return result;
|
|
3615
|
-
}
|
|
3616
|
-
function write(buffer, string, offset = 0, length = byteLength(string)) {
|
|
3617
|
-
const len = Math.min(length, buffer.byteLength - offset);
|
|
3618
|
-
for (let i = 0; i < len; i++) {
|
|
3619
|
-
buffer[offset + i] = string.charCodeAt(i);
|
|
3620
|
-
}
|
|
3621
|
-
return len;
|
|
3622
|
-
}
|
|
3623
|
-
module.exports = {
|
|
3624
|
-
byteLength,
|
|
3625
|
-
toString,
|
|
3626
|
-
write
|
|
3627
|
-
};
|
|
3628
|
-
}
|
|
3629
|
-
});
|
|
3630
|
-
|
|
3631
|
-
// ../../node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/base64.js
|
|
3632
|
-
var require_base64 = __commonJS({
|
|
3633
|
-
"../../node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/base64.js"(exports, module) {
|
|
3634
|
-
var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
3635
|
-
var codes = new Uint8Array(256);
|
|
3636
|
-
for (let i = 0; i < alphabet.length; i++) {
|
|
3637
|
-
codes[alphabet.charCodeAt(i)] = i;
|
|
3638
|
-
}
|
|
3639
|
-
codes[
|
|
3640
|
-
/* - */
|
|
3641
|
-
45
|
|
3642
|
-
] = 62;
|
|
3643
|
-
codes[
|
|
3644
|
-
/* _ */
|
|
3645
|
-
95
|
|
3646
|
-
] = 63;
|
|
3647
|
-
function byteLength(string) {
|
|
3648
|
-
let len = string.length;
|
|
3649
|
-
if (string.charCodeAt(len - 1) === 61) len--;
|
|
3650
|
-
if (len > 1 && string.charCodeAt(len - 1) === 61) len--;
|
|
3651
|
-
return len * 3 >>> 2;
|
|
3652
|
-
}
|
|
3653
|
-
function toString(buffer) {
|
|
3654
|
-
const len = buffer.byteLength;
|
|
3655
|
-
let result = "";
|
|
3656
|
-
for (let i = 0; i < len; i += 3) {
|
|
3657
|
-
result += alphabet[buffer[i] >> 2] + alphabet[(buffer[i] & 3) << 4 | buffer[i + 1] >> 4] + alphabet[(buffer[i + 1] & 15) << 2 | buffer[i + 2] >> 6] + alphabet[buffer[i + 2] & 63];
|
|
3658
|
-
}
|
|
3659
|
-
if (len % 3 === 2) {
|
|
3660
|
-
result = result.substring(0, result.length - 1) + "=";
|
|
3661
|
-
} else if (len % 3 === 1) {
|
|
3662
|
-
result = result.substring(0, result.length - 2) + "==";
|
|
3663
|
-
}
|
|
3664
|
-
return result;
|
|
3665
|
-
}
|
|
3666
|
-
function write(buffer, string, offset = 0, length = byteLength(string)) {
|
|
3667
|
-
const len = Math.min(length, buffer.byteLength - offset);
|
|
3668
|
-
for (let i = 0, j = 0; j < len; i += 4) {
|
|
3669
|
-
const a = codes[string.charCodeAt(i)];
|
|
3670
|
-
const b = codes[string.charCodeAt(i + 1)];
|
|
3671
|
-
const c = codes[string.charCodeAt(i + 2)];
|
|
3672
|
-
const d = codes[string.charCodeAt(i + 3)];
|
|
3673
|
-
buffer[j++] = a << 2 | b >> 4;
|
|
3674
|
-
buffer[j++] = (b & 15) << 4 | c >> 2;
|
|
3675
|
-
buffer[j++] = (c & 3) << 6 | d & 63;
|
|
3676
|
-
}
|
|
3677
|
-
return len;
|
|
3678
|
-
}
|
|
3679
|
-
module.exports = {
|
|
3680
|
-
byteLength,
|
|
3681
|
-
toString,
|
|
3682
|
-
write
|
|
3683
|
-
};
|
|
3684
|
-
}
|
|
3685
|
-
});
|
|
3686
|
-
|
|
3687
|
-
// ../../node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/hex.js
|
|
3688
|
-
var require_hex = __commonJS({
|
|
3689
|
-
"../../node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/hex.js"(exports, module) {
|
|
3690
|
-
function byteLength(string) {
|
|
3691
|
-
return string.length >>> 1;
|
|
3692
|
-
}
|
|
3693
|
-
function toString(buffer) {
|
|
3694
|
-
const len = buffer.byteLength;
|
|
3695
|
-
buffer = new DataView(buffer.buffer, buffer.byteOffset, len);
|
|
3696
|
-
let result = "";
|
|
3697
|
-
let i = 0;
|
|
3698
|
-
for (let n = len - len % 4; i < n; i += 4) {
|
|
3699
|
-
result += buffer.getUint32(i).toString(16).padStart(8, "0");
|
|
3700
|
-
}
|
|
3701
|
-
for (; i < len; i++) {
|
|
3702
|
-
result += buffer.getUint8(i).toString(16).padStart(2, "0");
|
|
3703
|
-
}
|
|
3704
|
-
return result;
|
|
3705
|
-
}
|
|
3706
|
-
function write(buffer, string, offset = 0, length = byteLength(string)) {
|
|
3707
|
-
const len = Math.min(length, buffer.byteLength - offset);
|
|
3708
|
-
for (let i = 0; i < len; i++) {
|
|
3709
|
-
const a = hexValue(string.charCodeAt(i * 2));
|
|
3710
|
-
const b = hexValue(string.charCodeAt(i * 2 + 1));
|
|
3711
|
-
if (a === void 0 || b === void 0) {
|
|
3712
|
-
return buffer.subarray(0, i);
|
|
3713
|
-
}
|
|
3714
|
-
buffer[offset + i] = a << 4 | b;
|
|
3715
|
-
}
|
|
3716
|
-
return len;
|
|
3717
|
-
}
|
|
3718
|
-
module.exports = {
|
|
3719
|
-
byteLength,
|
|
3720
|
-
toString,
|
|
3721
|
-
write
|
|
3722
|
-
};
|
|
3723
|
-
function hexValue(char) {
|
|
3724
|
-
if (char >= 48 && char <= 57) return char - 48;
|
|
3725
|
-
if (char >= 65 && char <= 70) return char - 65 + 10;
|
|
3726
|
-
if (char >= 97 && char <= 102) return char - 97 + 10;
|
|
3727
|
-
}
|
|
3728
|
-
}
|
|
3729
|
-
});
|
|
3730
|
-
|
|
3731
|
-
// ../../node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/utf8.js
|
|
3732
|
-
var require_utf8 = __commonJS({
|
|
3733
|
-
"../../node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/utf8.js"(exports, module) {
|
|
3734
|
-
function byteLength(string) {
|
|
3735
|
-
let length = 0;
|
|
3736
|
-
for (let i = 0, n = string.length; i < n; i++) {
|
|
3737
|
-
const code = string.charCodeAt(i);
|
|
3738
|
-
if (code >= 55296 && code <= 56319 && i + 1 < n) {
|
|
3739
|
-
const code2 = string.charCodeAt(i + 1);
|
|
3740
|
-
if (code2 >= 56320 && code2 <= 57343) {
|
|
3741
|
-
length += 4;
|
|
3742
|
-
i++;
|
|
3743
|
-
continue;
|
|
3744
|
-
}
|
|
3745
|
-
}
|
|
3746
|
-
if (code <= 127) length += 1;
|
|
3747
|
-
else if (code <= 2047) length += 2;
|
|
3748
|
-
else length += 3;
|
|
3749
|
-
}
|
|
3750
|
-
return length;
|
|
3751
|
-
}
|
|
3752
|
-
var toString;
|
|
3753
|
-
if (typeof TextDecoder !== "undefined") {
|
|
3754
|
-
const decoder = new TextDecoder();
|
|
3755
|
-
toString = function toString2(buffer) {
|
|
3756
|
-
return decoder.decode(buffer);
|
|
3757
|
-
};
|
|
3758
|
-
} else {
|
|
3759
|
-
toString = function toString2(buffer) {
|
|
3760
|
-
const len = buffer.byteLength;
|
|
3761
|
-
let output = "";
|
|
3762
|
-
let i = 0;
|
|
3763
|
-
while (i < len) {
|
|
3764
|
-
let byte = buffer[i];
|
|
3765
|
-
if (byte <= 127) {
|
|
3766
|
-
output += String.fromCharCode(byte);
|
|
3767
|
-
i++;
|
|
3768
|
-
continue;
|
|
3769
|
-
}
|
|
3770
|
-
let bytesNeeded = 0;
|
|
3771
|
-
let codePoint = 0;
|
|
3772
|
-
if (byte <= 223) {
|
|
3773
|
-
bytesNeeded = 1;
|
|
3774
|
-
codePoint = byte & 31;
|
|
3775
|
-
} else if (byte <= 239) {
|
|
3776
|
-
bytesNeeded = 2;
|
|
3777
|
-
codePoint = byte & 15;
|
|
3778
|
-
} else if (byte <= 244) {
|
|
3779
|
-
bytesNeeded = 3;
|
|
3780
|
-
codePoint = byte & 7;
|
|
3781
|
-
}
|
|
3782
|
-
if (len - i - bytesNeeded > 0) {
|
|
3783
|
-
let k = 0;
|
|
3784
|
-
while (k < bytesNeeded) {
|
|
3785
|
-
byte = buffer[i + k + 1];
|
|
3786
|
-
codePoint = codePoint << 6 | byte & 63;
|
|
3787
|
-
k += 1;
|
|
3788
|
-
}
|
|
3789
|
-
} else {
|
|
3790
|
-
codePoint = 65533;
|
|
3791
|
-
bytesNeeded = len - i;
|
|
3792
|
-
}
|
|
3793
|
-
output += String.fromCodePoint(codePoint);
|
|
3794
|
-
i += bytesNeeded + 1;
|
|
3795
|
-
}
|
|
3796
|
-
return output;
|
|
3797
|
-
};
|
|
3798
|
-
}
|
|
3799
|
-
var write;
|
|
3800
|
-
if (typeof TextEncoder !== "undefined") {
|
|
3801
|
-
const encoder = new TextEncoder();
|
|
3802
|
-
write = function write2(buffer, string, offset = 0, length = byteLength(string)) {
|
|
3803
|
-
const len = Math.min(length, buffer.byteLength - offset);
|
|
3804
|
-
encoder.encodeInto(string, buffer.subarray(offset, offset + len));
|
|
3805
|
-
return len;
|
|
3806
|
-
};
|
|
3807
|
-
} else {
|
|
3808
|
-
write = function write2(buffer, string, offset = 0, length = byteLength(string)) {
|
|
3809
|
-
const len = Math.min(length, buffer.byteLength - offset);
|
|
3810
|
-
buffer = buffer.subarray(offset, offset + len);
|
|
3811
|
-
let i = 0;
|
|
3812
|
-
let j = 0;
|
|
3813
|
-
while (i < string.length) {
|
|
3814
|
-
const code = string.codePointAt(i);
|
|
3815
|
-
if (code <= 127) {
|
|
3816
|
-
buffer[j++] = code;
|
|
3817
|
-
i++;
|
|
3818
|
-
continue;
|
|
3819
|
-
}
|
|
3820
|
-
let count = 0;
|
|
3821
|
-
let bits = 0;
|
|
3822
|
-
if (code <= 2047) {
|
|
3823
|
-
count = 6;
|
|
3824
|
-
bits = 192;
|
|
3825
|
-
} else if (code <= 65535) {
|
|
3826
|
-
count = 12;
|
|
3827
|
-
bits = 224;
|
|
3828
|
-
} else if (code <= 2097151) {
|
|
3829
|
-
count = 18;
|
|
3830
|
-
bits = 240;
|
|
3831
|
-
}
|
|
3832
|
-
buffer[j++] = bits | code >> count;
|
|
3833
|
-
count -= 6;
|
|
3834
|
-
while (count >= 0) {
|
|
3835
|
-
buffer[j++] = 128 | code >> count & 63;
|
|
3836
|
-
count -= 6;
|
|
3837
|
-
}
|
|
3838
|
-
i += code >= 65536 ? 2 : 1;
|
|
3839
|
-
}
|
|
3840
|
-
return len;
|
|
3841
|
-
};
|
|
3842
|
-
}
|
|
3843
|
-
module.exports = {
|
|
3844
|
-
byteLength,
|
|
3845
|
-
toString,
|
|
3846
|
-
write
|
|
3847
|
-
};
|
|
3848
|
-
}
|
|
3849
|
-
});
|
|
3850
|
-
|
|
3851
|
-
// ../../node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/utf16le.js
|
|
3852
|
-
var require_utf16le = __commonJS({
|
|
3853
|
-
"../../node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/lib/utf16le.js"(exports, module) {
|
|
3854
|
-
function byteLength(string) {
|
|
3855
|
-
return string.length * 2;
|
|
3856
|
-
}
|
|
3857
|
-
function toString(buffer) {
|
|
3858
|
-
const len = buffer.byteLength;
|
|
3859
|
-
let result = "";
|
|
3860
|
-
for (let i = 0; i < len - 1; i += 2) {
|
|
3861
|
-
result += String.fromCharCode(buffer[i] + buffer[i + 1] * 256);
|
|
3862
|
-
}
|
|
3863
|
-
return result;
|
|
3864
|
-
}
|
|
3865
|
-
function write(buffer, string, offset = 0, length = byteLength(string)) {
|
|
3866
|
-
const len = Math.min(length, buffer.byteLength - offset);
|
|
3867
|
-
let units = len;
|
|
3868
|
-
for (let i = 0; i < string.length; ++i) {
|
|
3869
|
-
if ((units -= 2) < 0) break;
|
|
3870
|
-
const c = string.charCodeAt(i);
|
|
3871
|
-
const hi = c >> 8;
|
|
3872
|
-
const lo = c % 256;
|
|
3873
|
-
buffer[offset + i * 2] = lo;
|
|
3874
|
-
buffer[offset + i * 2 + 1] = hi;
|
|
3875
|
-
}
|
|
3876
|
-
return len;
|
|
3877
|
-
}
|
|
3878
|
-
module.exports = {
|
|
3879
|
-
byteLength,
|
|
3880
|
-
toString,
|
|
3881
|
-
write
|
|
3882
|
-
};
|
|
3883
|
-
}
|
|
3884
|
-
});
|
|
3885
|
-
|
|
3886
|
-
// ../../node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/browser.js
|
|
3887
|
-
var require_browser2 = __commonJS({
|
|
3888
|
-
"../../node_modules/.pnpm/b4a@1.6.4/node_modules/b4a/browser.js"(exports, module) {
|
|
3889
|
-
var ascii = require_ascii();
|
|
3890
|
-
var base64 = require_base64();
|
|
3891
|
-
var hex = require_hex();
|
|
3892
|
-
var utf8 = require_utf8();
|
|
3893
|
-
var utf16le = require_utf16le();
|
|
3894
|
-
var LE = new Uint8Array(Uint16Array.of(255).buffer)[0] === 255;
|
|
3895
|
-
function codecFor(encoding) {
|
|
3896
|
-
switch (encoding) {
|
|
3897
|
-
case "ascii":
|
|
3898
|
-
return ascii;
|
|
3899
|
-
case "base64":
|
|
3900
|
-
return base64;
|
|
3901
|
-
case "hex":
|
|
3902
|
-
return hex;
|
|
3903
|
-
case "utf8":
|
|
3904
|
-
case "utf-8":
|
|
3905
|
-
case void 0:
|
|
3906
|
-
return utf8;
|
|
3907
|
-
case "ucs2":
|
|
3908
|
-
case "ucs-2":
|
|
3909
|
-
case "utf16le":
|
|
3910
|
-
case "utf-16le":
|
|
3911
|
-
return utf16le;
|
|
3912
|
-
default:
|
|
3913
|
-
throw new Error(`Unknown encoding: ${encoding}`);
|
|
3914
|
-
}
|
|
3915
|
-
}
|
|
3916
|
-
function isBuffer(value) {
|
|
3917
|
-
return value instanceof Uint8Array;
|
|
3918
|
-
}
|
|
3919
|
-
function isEncoding(encoding) {
|
|
3920
|
-
try {
|
|
3921
|
-
codecFor(encoding);
|
|
3922
|
-
return true;
|
|
3923
|
-
} catch {
|
|
3924
|
-
return false;
|
|
3925
|
-
}
|
|
3926
|
-
}
|
|
3927
|
-
function alloc(size, fill2, encoding) {
|
|
3928
|
-
const buffer = new Uint8Array(size);
|
|
3929
|
-
if (fill2 !== void 0) exports.fill(buffer, fill2, 0, buffer.byteLength, encoding);
|
|
3930
|
-
return buffer;
|
|
3931
|
-
}
|
|
3932
|
-
function allocUnsafe(size) {
|
|
3933
|
-
return new Uint8Array(size);
|
|
3934
|
-
}
|
|
3935
|
-
function allocUnsafeSlow(size) {
|
|
3936
|
-
return new Uint8Array(size);
|
|
3937
|
-
}
|
|
3938
|
-
function byteLength(string, encoding) {
|
|
3939
|
-
return codecFor(encoding).byteLength(string);
|
|
3940
|
-
}
|
|
3941
|
-
function compare(a, b) {
|
|
3942
|
-
if (a === b) return 0;
|
|
3943
|
-
const len = Math.min(a.byteLength, b.byteLength);
|
|
3944
|
-
a = new DataView(a.buffer, a.byteOffset, a.byteLength);
|
|
3945
|
-
b = new DataView(b.buffer, b.byteOffset, b.byteLength);
|
|
3946
|
-
let i = 0;
|
|
3947
|
-
for (let n = len - len % 4; i < n; i += 4) {
|
|
3948
|
-
const x = a.getUint32(i, LE);
|
|
3949
|
-
const y = b.getUint32(i, LE);
|
|
3950
|
-
if (x !== y) break;
|
|
3951
|
-
}
|
|
3952
|
-
for (; i < len; i++) {
|
|
3953
|
-
const x = a.getUint8(i);
|
|
3954
|
-
const y = b.getUint8(i);
|
|
3955
|
-
if (x < y) return -1;
|
|
3956
|
-
if (x > y) return 1;
|
|
3957
|
-
}
|
|
3958
|
-
return a.byteLength > b.byteLength ? 1 : a.byteLength < b.byteLength ? -1 : 0;
|
|
3959
|
-
}
|
|
3960
|
-
function concat(buffers, totalLength) {
|
|
3961
|
-
if (totalLength === void 0) {
|
|
3962
|
-
totalLength = buffers.reduce((len, buffer) => len + buffer.byteLength, 0);
|
|
3963
|
-
}
|
|
3964
|
-
const result = new Uint8Array(totalLength);
|
|
3965
|
-
let offset = 0;
|
|
3966
|
-
for (const buffer of buffers) {
|
|
3967
|
-
if (offset + buffer.byteLength > result.byteLength) {
|
|
3968
|
-
const sub = buffer.subarray(0, result.byteLength - offset);
|
|
3969
|
-
result.set(sub, offset);
|
|
3970
|
-
return result;
|
|
3971
|
-
}
|
|
3972
|
-
result.set(buffer, offset);
|
|
3973
|
-
offset += buffer.byteLength;
|
|
3974
|
-
}
|
|
3975
|
-
return result;
|
|
3976
|
-
}
|
|
3977
|
-
function copy(source, target, targetStart = 0, start = 0, end = source.byteLength) {
|
|
3978
|
-
if (end > 0 && end < start) return 0;
|
|
3979
|
-
if (end === start) return 0;
|
|
3980
|
-
if (source.byteLength === 0 || target.byteLength === 0) return 0;
|
|
3981
|
-
if (targetStart < 0) throw new RangeError("targetStart is out of range");
|
|
3982
|
-
if (start < 0 || start >= source.byteLength) throw new RangeError("sourceStart is out of range");
|
|
3983
|
-
if (end < 0) throw new RangeError("sourceEnd is out of range");
|
|
3984
|
-
if (targetStart >= target.byteLength) targetStart = target.byteLength;
|
|
3985
|
-
if (end > source.byteLength) end = source.byteLength;
|
|
3986
|
-
if (target.byteLength - targetStart < end - start) {
|
|
3987
|
-
end = target.length - targetStart + start;
|
|
3988
|
-
}
|
|
3989
|
-
const len = end - start;
|
|
3990
|
-
if (source === target) {
|
|
3991
|
-
target.copyWithin(targetStart, start, end);
|
|
3992
|
-
} else {
|
|
3993
|
-
target.set(source.subarray(start, end), targetStart);
|
|
3994
|
-
}
|
|
3995
|
-
return len;
|
|
3996
|
-
}
|
|
3997
|
-
function equals(a, b) {
|
|
3998
|
-
if (a === b) return true;
|
|
3999
|
-
if (a.byteLength !== b.byteLength) return false;
|
|
4000
|
-
const len = a.byteLength;
|
|
4001
|
-
a = new DataView(a.buffer, a.byteOffset, a.byteLength);
|
|
4002
|
-
b = new DataView(b.buffer, b.byteOffset, b.byteLength);
|
|
4003
|
-
let i = 0;
|
|
4004
|
-
for (let n = len - len % 4; i < n; i += 4) {
|
|
4005
|
-
if (a.getUint32(i, LE) !== b.getUint32(i, LE)) return false;
|
|
4006
|
-
}
|
|
4007
|
-
for (; i < len; i++) {
|
|
4008
|
-
if (a.getUint8(i) !== b.getUint8(i)) return false;
|
|
4009
|
-
}
|
|
4010
|
-
return true;
|
|
4011
|
-
}
|
|
4012
|
-
function fill(buffer, value, offset, end, encoding) {
|
|
4013
|
-
if (typeof value === "string") {
|
|
4014
|
-
if (typeof offset === "string") {
|
|
4015
|
-
encoding = offset;
|
|
4016
|
-
offset = 0;
|
|
4017
|
-
end = buffer.byteLength;
|
|
4018
|
-
} else if (typeof end === "string") {
|
|
4019
|
-
encoding = end;
|
|
4020
|
-
end = buffer.byteLength;
|
|
4021
|
-
}
|
|
4022
|
-
} else if (typeof value === "number") {
|
|
4023
|
-
value = value & 255;
|
|
4024
|
-
} else if (typeof value === "boolean") {
|
|
4025
|
-
value = +value;
|
|
4026
|
-
}
|
|
4027
|
-
if (offset < 0 || buffer.byteLength < offset || buffer.byteLength < end) {
|
|
4028
|
-
throw new RangeError("Out of range index");
|
|
4029
|
-
}
|
|
4030
|
-
if (offset === void 0) offset = 0;
|
|
4031
|
-
if (end === void 0) end = buffer.byteLength;
|
|
4032
|
-
if (end <= offset) return buffer;
|
|
4033
|
-
if (!value) value = 0;
|
|
4034
|
-
if (typeof value === "number") {
|
|
4035
|
-
for (let i = offset; i < end; ++i) {
|
|
4036
|
-
buffer[i] = value;
|
|
4037
|
-
}
|
|
4038
|
-
} else {
|
|
4039
|
-
value = isBuffer(value) ? value : from(value, encoding);
|
|
4040
|
-
const len = value.byteLength;
|
|
4041
|
-
for (let i = 0; i < end - offset; ++i) {
|
|
4042
|
-
buffer[i + offset] = value[i % len];
|
|
4043
|
-
}
|
|
4044
|
-
}
|
|
4045
|
-
return buffer;
|
|
4046
|
-
}
|
|
4047
|
-
function from(value, encodingOrOffset, length) {
|
|
4048
|
-
if (typeof value === "string") return fromString(value, encodingOrOffset);
|
|
4049
|
-
if (Array.isArray(value)) return fromArray(value);
|
|
4050
|
-
if (ArrayBuffer.isView(value)) return fromBuffer(value);
|
|
4051
|
-
return fromArrayBuffer(value, encodingOrOffset, length);
|
|
4052
|
-
}
|
|
4053
|
-
function fromString(string, encoding) {
|
|
4054
|
-
const codec = codecFor(encoding);
|
|
4055
|
-
const buffer = new Uint8Array(codec.byteLength(string));
|
|
4056
|
-
codec.write(buffer, string, 0, buffer.byteLength);
|
|
4057
|
-
return buffer;
|
|
4058
|
-
}
|
|
4059
|
-
function fromArray(array) {
|
|
4060
|
-
const buffer = new Uint8Array(array.length);
|
|
4061
|
-
buffer.set(array);
|
|
4062
|
-
return buffer;
|
|
4063
|
-
}
|
|
4064
|
-
function fromBuffer(buffer) {
|
|
4065
|
-
const copy2 = new Uint8Array(buffer.byteLength);
|
|
4066
|
-
copy2.set(buffer);
|
|
4067
|
-
return copy2;
|
|
4068
|
-
}
|
|
4069
|
-
function fromArrayBuffer(arrayBuffer, byteOffset, length) {
|
|
4070
|
-
return new Uint8Array(arrayBuffer, byteOffset, length);
|
|
4071
|
-
}
|
|
4072
|
-
function includes(buffer, value, byteOffset, encoding) {
|
|
4073
|
-
return indexOf(buffer, value, byteOffset, encoding) !== -1;
|
|
4074
|
-
}
|
|
4075
|
-
function bidirectionalIndexOf(buffer, value, byteOffset, encoding, first) {
|
|
4076
|
-
if (buffer.byteLength === 0) return -1;
|
|
4077
|
-
if (typeof byteOffset === "string") {
|
|
4078
|
-
encoding = byteOffset;
|
|
4079
|
-
byteOffset = 0;
|
|
4080
|
-
} else if (byteOffset === void 0) {
|
|
4081
|
-
byteOffset = first ? 0 : buffer.length - 1;
|
|
4082
|
-
} else if (byteOffset < 0) {
|
|
4083
|
-
byteOffset += buffer.byteLength;
|
|
4084
|
-
}
|
|
4085
|
-
if (byteOffset >= buffer.byteLength) {
|
|
4086
|
-
if (first) return -1;
|
|
4087
|
-
else byteOffset = buffer.byteLength - 1;
|
|
4088
|
-
} else if (byteOffset < 0) {
|
|
4089
|
-
if (first) byteOffset = 0;
|
|
4090
|
-
else return -1;
|
|
4091
|
-
}
|
|
4092
|
-
if (typeof value === "string") {
|
|
4093
|
-
value = from(value, encoding);
|
|
4094
|
-
} else if (typeof value === "number") {
|
|
4095
|
-
value = value & 255;
|
|
4096
|
-
if (first) {
|
|
4097
|
-
return buffer.indexOf(value, byteOffset);
|
|
4098
|
-
} else {
|
|
4099
|
-
return buffer.lastIndexOf(value, byteOffset);
|
|
4100
|
-
}
|
|
4101
|
-
}
|
|
4102
|
-
if (value.byteLength === 0) return -1;
|
|
4103
|
-
if (first) {
|
|
4104
|
-
let foundIndex = -1;
|
|
4105
|
-
for (let i = byteOffset; i < buffer.byteLength; i++) {
|
|
4106
|
-
if (buffer[i] === value[foundIndex === -1 ? 0 : i - foundIndex]) {
|
|
4107
|
-
if (foundIndex === -1) foundIndex = i;
|
|
4108
|
-
if (i - foundIndex + 1 === value.byteLength) return foundIndex;
|
|
4109
|
-
} else {
|
|
4110
|
-
if (foundIndex !== -1) i -= i - foundIndex;
|
|
4111
|
-
foundIndex = -1;
|
|
4112
|
-
}
|
|
4113
|
-
}
|
|
4114
|
-
} else {
|
|
4115
|
-
if (byteOffset + value.byteLength > buffer.byteLength) {
|
|
4116
|
-
byteOffset = buffer.byteLength - value.byteLength;
|
|
4117
|
-
}
|
|
4118
|
-
for (let i = byteOffset; i >= 0; i--) {
|
|
4119
|
-
let found = true;
|
|
4120
|
-
for (let j = 0; j < value.byteLength; j++) {
|
|
4121
|
-
if (buffer[i + j] !== value[j]) {
|
|
4122
|
-
found = false;
|
|
4123
|
-
break;
|
|
4124
|
-
}
|
|
4125
|
-
}
|
|
4126
|
-
if (found) return i;
|
|
4127
|
-
}
|
|
4128
|
-
}
|
|
4129
|
-
return -1;
|
|
4130
|
-
}
|
|
4131
|
-
function indexOf(buffer, value, byteOffset, encoding) {
|
|
4132
|
-
return bidirectionalIndexOf(
|
|
4133
|
-
buffer,
|
|
4134
|
-
value,
|
|
4135
|
-
byteOffset,
|
|
4136
|
-
encoding,
|
|
4137
|
-
true
|
|
4138
|
-
/* first */
|
|
4139
|
-
);
|
|
4140
|
-
}
|
|
4141
|
-
function lastIndexOf(buffer, value, byteOffset, encoding) {
|
|
4142
|
-
return bidirectionalIndexOf(
|
|
4143
|
-
buffer,
|
|
4144
|
-
value,
|
|
4145
|
-
byteOffset,
|
|
4146
|
-
encoding,
|
|
4147
|
-
false
|
|
4148
|
-
/* last */
|
|
4149
|
-
);
|
|
4150
|
-
}
|
|
4151
|
-
function swap(buffer, n, m) {
|
|
4152
|
-
const i = buffer[n];
|
|
4153
|
-
buffer[n] = buffer[m];
|
|
4154
|
-
buffer[m] = i;
|
|
4155
|
-
}
|
|
4156
|
-
function swap16(buffer) {
|
|
4157
|
-
const len = buffer.byteLength;
|
|
4158
|
-
if (len % 2 !== 0) throw new RangeError("Buffer size must be a multiple of 16-bits");
|
|
4159
|
-
for (let i = 0; i < len; i += 2) swap(buffer, i, i + 1);
|
|
4160
|
-
return buffer;
|
|
4161
|
-
}
|
|
4162
|
-
function swap32(buffer) {
|
|
4163
|
-
const len = buffer.byteLength;
|
|
4164
|
-
if (len % 4 !== 0) throw new RangeError("Buffer size must be a multiple of 32-bits");
|
|
4165
|
-
for (let i = 0; i < len; i += 4) {
|
|
4166
|
-
swap(buffer, i, i + 3);
|
|
4167
|
-
swap(buffer, i + 1, i + 2);
|
|
4168
|
-
}
|
|
4169
|
-
return buffer;
|
|
4170
|
-
}
|
|
4171
|
-
function swap64(buffer) {
|
|
4172
|
-
const len = buffer.byteLength;
|
|
4173
|
-
if (len % 8 !== 0) throw new RangeError("Buffer size must be a multiple of 64-bits");
|
|
4174
|
-
for (let i = 0; i < len; i += 8) {
|
|
4175
|
-
swap(buffer, i, i + 7);
|
|
4176
|
-
swap(buffer, i + 1, i + 6);
|
|
4177
|
-
swap(buffer, i + 2, i + 5);
|
|
4178
|
-
swap(buffer, i + 3, i + 4);
|
|
4179
|
-
}
|
|
4180
|
-
return buffer;
|
|
4181
|
-
}
|
|
4182
|
-
function toBuffer(buffer) {
|
|
4183
|
-
return buffer;
|
|
4184
|
-
}
|
|
4185
|
-
function toString(buffer, encoding, start = 0, end = buffer.byteLength) {
|
|
4186
|
-
const len = buffer.byteLength;
|
|
4187
|
-
if (start >= len) return "";
|
|
4188
|
-
if (end <= start) return "";
|
|
4189
|
-
if (start < 0) start = 0;
|
|
4190
|
-
if (end > len) end = len;
|
|
4191
|
-
if (start !== 0 || end < len) buffer = buffer.subarray(start, end);
|
|
4192
|
-
return codecFor(encoding).toString(buffer);
|
|
4193
|
-
}
|
|
4194
|
-
function write(buffer, string, offset, length, encoding) {
|
|
4195
|
-
if (offset === void 0) {
|
|
4196
|
-
encoding = "utf8";
|
|
4197
|
-
} else if (length === void 0 && typeof offset === "string") {
|
|
4198
|
-
encoding = offset;
|
|
4199
|
-
offset = void 0;
|
|
4200
|
-
} else if (encoding === void 0 && typeof length === "string") {
|
|
4201
|
-
encoding = length;
|
|
4202
|
-
length = void 0;
|
|
4203
|
-
}
|
|
4204
|
-
return codecFor(encoding).write(buffer, string, offset, length);
|
|
4205
|
-
}
|
|
4206
|
-
function writeDoubleLE(buffer, value, offset) {
|
|
4207
|
-
if (offset === void 0) offset = 0;
|
|
4208
|
-
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
4209
|
-
view.setFloat64(offset, value, true);
|
|
4210
|
-
return offset + 8;
|
|
4211
|
-
}
|
|
4212
|
-
function writeFloatLE(buffer, value, offset) {
|
|
4213
|
-
if (offset === void 0) offset = 0;
|
|
4214
|
-
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
4215
|
-
view.setFloat32(offset, value, true);
|
|
4216
|
-
return offset + 4;
|
|
4217
|
-
}
|
|
4218
|
-
function writeUInt32LE(buffer, value, offset) {
|
|
4219
|
-
if (offset === void 0) offset = 0;
|
|
4220
|
-
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
4221
|
-
view.setUint32(offset, value, true);
|
|
4222
|
-
return offset + 4;
|
|
4223
|
-
}
|
|
4224
|
-
function writeInt32LE(buffer, value, offset) {
|
|
4225
|
-
if (offset === void 0) offset = 0;
|
|
4226
|
-
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
4227
|
-
view.setInt32(offset, value, true);
|
|
4228
|
-
return offset + 4;
|
|
4229
|
-
}
|
|
4230
|
-
function readDoubleLE(buffer, offset) {
|
|
4231
|
-
if (offset === void 0) offset = 0;
|
|
4232
|
-
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
4233
|
-
return view.getFloat64(offset, true);
|
|
4234
|
-
}
|
|
4235
|
-
function readFloatLE(buffer, offset) {
|
|
4236
|
-
if (offset === void 0) offset = 0;
|
|
4237
|
-
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
4238
|
-
return view.getFloat32(offset, true);
|
|
4239
|
-
}
|
|
4240
|
-
function readUInt32LE(buffer, offset) {
|
|
4241
|
-
if (offset === void 0) offset = 0;
|
|
4242
|
-
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
4243
|
-
return view.getUint32(offset, true);
|
|
4244
|
-
}
|
|
4245
|
-
function readInt32LE(buffer, offset) {
|
|
4246
|
-
if (offset === void 0) offset = 0;
|
|
4247
|
-
const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
4248
|
-
return view.getInt32(offset, true);
|
|
4249
|
-
}
|
|
4250
|
-
module.exports = exports = {
|
|
4251
|
-
isBuffer,
|
|
4252
|
-
isEncoding,
|
|
4253
|
-
alloc,
|
|
4254
|
-
allocUnsafe,
|
|
4255
|
-
allocUnsafeSlow,
|
|
4256
|
-
byteLength,
|
|
4257
|
-
compare,
|
|
4258
|
-
concat,
|
|
4259
|
-
copy,
|
|
4260
|
-
equals,
|
|
4261
|
-
fill,
|
|
4262
|
-
from,
|
|
4263
|
-
includes,
|
|
4264
|
-
indexOf,
|
|
4265
|
-
lastIndexOf,
|
|
4266
|
-
swap16,
|
|
4267
|
-
swap32,
|
|
4268
|
-
swap64,
|
|
4269
|
-
toBuffer,
|
|
4270
|
-
toString,
|
|
4271
|
-
write,
|
|
4272
|
-
writeDoubleLE,
|
|
4273
|
-
writeFloatLE,
|
|
4274
|
-
writeUInt32LE,
|
|
4275
|
-
writeInt32LE,
|
|
4276
|
-
readDoubleLE,
|
|
4277
|
-
readFloatLE,
|
|
4278
|
-
readUInt32LE,
|
|
4279
|
-
readInt32LE
|
|
4280
|
-
};
|
|
4281
|
-
}
|
|
4282
|
-
});
|
|
4283
|
-
|
|
4284
3588
|
// ../../node_modules/.pnpm/protocol-buffers-encodings@1.2.0/node_modules/protocol-buffers-encodings/index.js
|
|
4285
3589
|
var require_protocol_buffers_encodings = __commonJS({
|
|
4286
3590
|
"../../node_modules/.pnpm/protocol-buffers-encodings@1.2.0/node_modules/protocol-buffers-encodings/index.js"(exports) {
|
|
4287
3591
|
var varint = require_varint3();
|
|
4288
3592
|
var svarint = require_signed_varint();
|
|
4289
|
-
var b4a =
|
|
3593
|
+
var b4a = require_browser();
|
|
4290
3594
|
exports.make = encoder;
|
|
4291
3595
|
exports.name = function(enc) {
|
|
4292
3596
|
var keys = Object.keys(exports);
|
|
@@ -5651,405 +4955,10 @@ var require_messages = __commonJS({
|
|
|
5651
4955
|
}
|
|
5652
4956
|
});
|
|
5653
4957
|
|
|
5654
|
-
// ../../node_modules/.pnpm/xsalsa20@1.2.0/node_modules/xsalsa20/xsalsa20.js
|
|
5655
|
-
var require_xsalsa20 = __commonJS({
|
|
5656
|
-
"../../node_modules/.pnpm/xsalsa20@1.2.0/node_modules/xsalsa20/xsalsa20.js"(exports, module) {
|
|
5657
|
-
var __commonJS2 = (cb, mod) => function __require2() {
|
|
5658
|
-
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
5659
|
-
};
|
|
5660
|
-
var __toBinary = /* @__PURE__ */ (() => {
|
|
5661
|
-
var table = new Uint8Array(128);
|
|
5662
|
-
for (var i = 0; i < 64; i++)
|
|
5663
|
-
table[i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i * 4 - 205] = i;
|
|
5664
|
-
return (base64) => {
|
|
5665
|
-
var n = base64.length, bytes2 = new Uint8Array((n - (base64[n - 1] == "=") - (base64[n - 2] == "=")) * 3 / 4 | 0);
|
|
5666
|
-
for (var i2 = 0, j = 0; i2 < n; ) {
|
|
5667
|
-
var c0 = table[base64.charCodeAt(i2++)], c1 = table[base64.charCodeAt(i2++)];
|
|
5668
|
-
var c2 = table[base64.charCodeAt(i2++)], c3 = table[base64.charCodeAt(i2++)];
|
|
5669
|
-
bytes2[j++] = c0 << 2 | c1 >> 4;
|
|
5670
|
-
bytes2[j++] = c1 << 4 | c2 >> 2;
|
|
5671
|
-
bytes2[j++] = c2 << 6 | c3;
|
|
5672
|
-
}
|
|
5673
|
-
return bytes2;
|
|
5674
|
-
};
|
|
5675
|
-
})();
|
|
5676
|
-
var require_xsalsa203 = __commonJS2({
|
|
5677
|
-
"wasm-binary:./xsalsa20.wat"(exports2, module2) {
|
|
5678
|
-
module2.exports = __toBinary("AGFzbQEAAAABGgNgBn9/f39/fwBgBn9/f39+fwF+YAN/f38AAwcGAAEBAgICBQUBAQroBwcoAwZtZW1vcnkCAAx4c2Fsc2EyMF94b3IAAAxjb3JlX3NhbHNhMjAABArqEQYYACAAIAEgAiADIAQgACkDACAFEAE3AwALPQBB8AAgAyAFEAMgACABIAIgA0EQaiAEQfAAEAJB8ABCADcDAEH4AEIANwMAQYABQgA3AwBBiAFCADcDAAuHBQEBfyACQQBGBEBCAA8LQdAAIAUpAwA3AwBB2AAgBUEIaikDADcDAEHgACAFQRBqKQMANwMAQegAIAVBGGopAwA3AwBBACADKQMANwMAQQggBDcDAAJAA0AgAkHAAEkNAUEQQQBB0AAQBSAAIAEpAwBBECkDAIU3AwAgAEEIaiABQQhqKQMAQRgpAwCFNwMAIABBEGogAUEQaikDAEEgKQMAhTcDACAAQRhqIAFBGGopAwBBKCkDAIU3AwAgAEEgaiABQSBqKQMAQTApAwCFNwMAIABBKGogAUEoaikDAEE4KQMAhTcDACAAQTBqIAFBMGopAwBBwAApAwCFNwMAIABBOGogAUE4aikDAEHIACkDAIU3AwBBCEEIKQMAQgF8NwMAIABBwABqIQAgAUHAAGohASACQcAAayECDAALC0EIKQMAIQQgAkEASwRAQRBBAEHQABAFAkACQAJAAkACQAJAAkACQCACQQhuDgcHBgUEAwIBAAsgAEE4aiABQThqKQMAQcgAKQMAhTcDAAsgAEEwaiABQTBqKQMAQcAAKQMAhTcDAAsgAEEoaiABQShqKQMAQTgpAwCFNwMACyAAQSBqIAFBIGopAwBBMCkDAIU3AwALIABBGGogAUEYaikDAEEoKQMAhTcDAAsgAEEQaiABQRBqKQMAQSApAwCFNwMACyAAQQhqIAFBCGopAwBBGCkDAIU3AwALIAAgASkDAEEQKQMAhTcDAAtBEEIANwMAQRhCADcDAEEgQgA3AwBBKEIANwMAQTBCADcDAEE4QgA3AwBBwABCADcDAEHIAEIANwMAQdAAQgA3AwBB2ABCADcDAEHgAEIANwMAQegAQgA3AwAgBA8LnQUBEX9B5fDBiwYhA0HuyIGZAyEIQbLaiMsHIQ1B9MqB2QYhEiACKAIAIQQgAkEEaigCACEFIAJBCGooAgAhBiACQQxqKAIAIQcgAkEQaigCACEOIAJBFGooAgAhDyACQRhqKAIAIRAgAkEcaigCACERIAEoAgAhCSABQQRqKAIAIQogAUEIaigCACELIAFBDGooAgAhDEEUIRMCQANAIBNBAEYNASAHIAMgD2pBB3dzIQcgCyAHIANqQQl3cyELIA8gCyAHakENd3MhDyADIA8gC2pBEndzIQMgDCAIIARqQQd3cyEMIBAgDCAIakEJd3MhECAEIBAgDGpBDXdzIQQgCCAEIBBqQRJ3cyEIIBEgDSAJakEHd3MhESAFIBEgDWpBCXdzIQUgCSAFIBFqQQ13cyEJIA0gCSAFakESd3MhDSAGIBIgDmpBB3dzIQYgCiAGIBJqQQl3cyEKIA4gCiAGakENd3MhDiASIA4gCmpBEndzIRIgBCADIAZqQQd3cyEEIAUgBCADakEJd3MhBSAGIAUgBGpBDXdzIQYgAyAGIAVqQRJ3cyEDIAkgCCAHakEHd3MhCSAKIAkgCGpBCXdzIQogByAKIAlqQQ13cyEHIAggByAKakESd3MhCCAOIA0gDGpBB3dzIQ4gCyAOIA1qQQl3cyELIAwgCyAOakENd3MhDCANIAwgC2pBEndzIQ0gDyASIBFqQQd3cyEPIBAgDyASakEJd3MhECARIBAgD2pBDXdzIREgEiARIBBqQRJ3cyESIBNBAmshEwwACwsgACADNgIAIABBBGogCDYCACAAQQhqIA02AgAgAEEMaiASNgIAIABBEGogCTYCACAAQRRqIAo2AgAgAEEYaiALNgIAIABBHGogDDYCAAsKACAAIAEgAhAFC90GASF/QeXwwYsGIQNB7siBmQMhCEGy2ojLByENQfTKgdkGIRIgAigCACEEIAJBBGooAgAhBSACQQhqKAIAIQYgAkEMaigCACEHIAJBEGooAgAhDiACQRRqKAIAIQ8gAkEYaigCACEQIAJBHGooAgAhESABKAIAIQkgAUEEaigCACEKIAFBCGooAgAhCyABQQxqKAIAIQwgAyETIAQhFCAFIRUgBiEWIAchFyAIIRggCSEZIAohGiALIRsgDCEcIA0hHSAOIR4gDyEfIBAhICARISEgEiEiQRQhIwJAA0AgI0EARg0BIAcgAyAPakEHd3MhByALIAcgA2pBCXdzIQsgDyALIAdqQQ13cyEPIAMgDyALakESd3MhAyAMIAggBGpBB3dzIQwgECAMIAhqQQl3cyEQIAQgECAMakENd3MhBCAIIAQgEGpBEndzIQggESANIAlqQQd3cyERIAUgESANakEJd3MhBSAJIAUgEWpBDXdzIQkgDSAJIAVqQRJ3cyENIAYgEiAOakEHd3MhBiAKIAYgEmpBCXdzIQogDiAKIAZqQQ13cyEOIBIgDiAKakESd3MhEiAEIAMgBmpBB3dzIQQgBSAEIANqQQl3cyEFIAYgBSAEakENd3MhBiADIAYgBWpBEndzIQMgCSAIIAdqQQd3cyEJIAogCSAIakEJd3MhCiAHIAogCWpBDXdzIQcgCCAHIApqQRJ3cyEIIA4gDSAMakEHd3MhDiALIA4gDWpBCXdzIQsgDCALIA5qQQ13cyEMIA0gDCALakESd3MhDSAPIBIgEWpBB3dzIQ8gECAPIBJqQQl3cyEQIBEgECAPakENd3MhESASIBEgEGpBEndzIRIgI0ECayEjDAALCyAAIAMgE2o2AgAgAEEEaiAEIBRqNgIAIABBCGogBSAVajYCACAAQQxqIAYgFmo2AgAgAEEQaiAHIBdqNgIAIABBFGogCCAYajYCACAAQRhqIAkgGWo2AgAgAEEcaiAKIBpqNgIAIABBIGogCyAbajYCACAAQSRqIAwgHGo2AgAgAEEoaiANIB1qNgIAIABBLGogDiAeajYCACAAQTBqIA8gH2o2AgAgAEE0aiAQICBqNgIAIABBOGogESAhajYCACAAQTxqIBIgImo2AgAL");
|
|
5679
|
-
}
|
|
5680
|
-
});
|
|
5681
|
-
var bytes = require_xsalsa203();
|
|
5682
|
-
var compiled = new WebAssembly.Module(bytes);
|
|
5683
|
-
module.exports = (imports) => {
|
|
5684
|
-
const instance = new WebAssembly.Instance(compiled, imports);
|
|
5685
|
-
return instance.exports;
|
|
5686
|
-
};
|
|
5687
|
-
}
|
|
5688
|
-
});
|
|
5689
|
-
|
|
5690
|
-
// ../../node_modules/.pnpm/xsalsa20@1.2.0/node_modules/xsalsa20/index.js
|
|
5691
|
-
var require_xsalsa202 = __commonJS({
|
|
5692
|
-
"../../node_modules/.pnpm/xsalsa20@1.2.0/node_modules/xsalsa20/index.js"(exports, module) {
|
|
5693
|
-
var xsalsa20 = typeof WebAssembly !== "undefined" && require_xsalsa20()();
|
|
5694
|
-
var SIGMA = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
|
|
5695
|
-
var head = 144;
|
|
5696
|
-
var top = head;
|
|
5697
|
-
var free = [];
|
|
5698
|
-
module.exports = XSalsa20;
|
|
5699
|
-
XSalsa20.NONCEBYTES = 24;
|
|
5700
|
-
XSalsa20.KEYBYTES = 32;
|
|
5701
|
-
XSalsa20.core_hsalsa20 = core_hsalsa20;
|
|
5702
|
-
XSalsa20.SIGMA = SIGMA;
|
|
5703
|
-
function XSalsa20(nonce, key) {
|
|
5704
|
-
if (!(this instanceof XSalsa20)) return new XSalsa20(nonce, key);
|
|
5705
|
-
if (!nonce || nonce.length < 24) throw new Error("nonce must be at least 24 bytes");
|
|
5706
|
-
if (!key || key.length < 32) throw new Error("key must be at least 32 bytes");
|
|
5707
|
-
this._xor = xsalsa20 ? new WASM(nonce, key) : new Fallback(nonce, key);
|
|
5708
|
-
}
|
|
5709
|
-
XSalsa20.prototype.update = function(input, output) {
|
|
5710
|
-
if (!input) throw new Error("input must be Uint8Array or Buffer");
|
|
5711
|
-
if (!output) output = new Uint8Array(input.length);
|
|
5712
|
-
if (input.length) this._xor.update(input, output);
|
|
5713
|
-
return output;
|
|
5714
|
-
};
|
|
5715
|
-
XSalsa20.prototype.final = XSalsa20.prototype.finalize = function() {
|
|
5716
|
-
this._xor.finalize();
|
|
5717
|
-
this._xor = null;
|
|
5718
|
-
};
|
|
5719
|
-
function WASM(nonce, key) {
|
|
5720
|
-
if (!free.length) {
|
|
5721
|
-
free.push(head);
|
|
5722
|
-
head += 64;
|
|
5723
|
-
}
|
|
5724
|
-
this._pointer = free.pop();
|
|
5725
|
-
this._nonce = this._pointer + 8;
|
|
5726
|
-
this._key = this._nonce + 24;
|
|
5727
|
-
this._overflow = 0;
|
|
5728
|
-
this._memory = new Uint8Array(xsalsa20.memory.buffer);
|
|
5729
|
-
this._memory.fill(0, this._pointer, this._pointer + 8);
|
|
5730
|
-
this._memory.set(nonce, this._nonce);
|
|
5731
|
-
this._memory.set(key, this._key);
|
|
5732
|
-
}
|
|
5733
|
-
WASM.prototype.realloc = function(size) {
|
|
5734
|
-
xsalsa20.memory.grow(Math.ceil(Math.abs(size - this._memory.length) / 65536));
|
|
5735
|
-
this._memory = new Uint8Array(xsalsa20.memory.buffer);
|
|
5736
|
-
};
|
|
5737
|
-
WASM.prototype.update = function(input, output) {
|
|
5738
|
-
var len = this._overflow + input.length;
|
|
5739
|
-
var start = head + this._overflow;
|
|
5740
|
-
top = head + len;
|
|
5741
|
-
if (top >= this._memory.length) this.realloc(top);
|
|
5742
|
-
this._memory.set(input, start);
|
|
5743
|
-
xsalsa20.xsalsa20_xor(this._pointer, head, head, len, this._nonce, this._key);
|
|
5744
|
-
output.set(this._memory.subarray(start, head + len));
|
|
5745
|
-
this._overflow = len & 63;
|
|
5746
|
-
};
|
|
5747
|
-
WASM.prototype.finalize = function() {
|
|
5748
|
-
this._memory.fill(0, this._pointer, this._key + 32);
|
|
5749
|
-
if (top > head) {
|
|
5750
|
-
this._memory.fill(0, head, top);
|
|
5751
|
-
top = 0;
|
|
5752
|
-
}
|
|
5753
|
-
free.push(this._pointer);
|
|
5754
|
-
};
|
|
5755
|
-
function Fallback(nonce, key) {
|
|
5756
|
-
this._s = new Uint8Array(32);
|
|
5757
|
-
this._z = new Uint8Array(16);
|
|
5758
|
-
this._overflow = 0;
|
|
5759
|
-
core_hsalsa20(this._s, nonce, key, SIGMA);
|
|
5760
|
-
for (var i = 0; i < 8; i++) this._z[i] = nonce[i + 16];
|
|
5761
|
-
}
|
|
5762
|
-
Fallback.prototype.update = function(input, output) {
|
|
5763
|
-
var x = new Uint8Array(64);
|
|
5764
|
-
var u = 0;
|
|
5765
|
-
var i = this._overflow;
|
|
5766
|
-
var b = input.length + this._overflow;
|
|
5767
|
-
var z = this._z;
|
|
5768
|
-
var mpos = -this._overflow;
|
|
5769
|
-
var cpos = -this._overflow;
|
|
5770
|
-
while (b >= 64) {
|
|
5771
|
-
core_salsa20(x, z, this._s, SIGMA);
|
|
5772
|
-
for (; i < 64; i++) output[cpos + i] = input[mpos + i] ^ x[i];
|
|
5773
|
-
u = 1;
|
|
5774
|
-
for (i = 8; i < 16; i++) {
|
|
5775
|
-
u += z[i] & 255 | 0;
|
|
5776
|
-
z[i] = u & 255;
|
|
5777
|
-
u >>>= 8;
|
|
5778
|
-
}
|
|
5779
|
-
b -= 64;
|
|
5780
|
-
cpos += 64;
|
|
5781
|
-
mpos += 64;
|
|
5782
|
-
i = 0;
|
|
5783
|
-
}
|
|
5784
|
-
if (b > 0) {
|
|
5785
|
-
core_salsa20(x, z, this._s, SIGMA);
|
|
5786
|
-
for (; i < b; i++) output[cpos + i] = input[mpos + i] ^ x[i];
|
|
5787
|
-
}
|
|
5788
|
-
this._overflow = b & 63;
|
|
5789
|
-
};
|
|
5790
|
-
Fallback.prototype.finalize = function() {
|
|
5791
|
-
this._s.fill(0);
|
|
5792
|
-
this._z.fill(0);
|
|
5793
|
-
};
|
|
5794
|
-
function core_salsa20(o, p, k, c) {
|
|
5795
|
-
var j0 = c[0] & 255 | (c[1] & 255) << 8 | (c[2] & 255) << 16 | (c[3] & 255) << 24, j1 = k[0] & 255 | (k[1] & 255) << 8 | (k[2] & 255) << 16 | (k[3] & 255) << 24, j2 = k[4] & 255 | (k[5] & 255) << 8 | (k[6] & 255) << 16 | (k[7] & 255) << 24, j3 = k[8] & 255 | (k[9] & 255) << 8 | (k[10] & 255) << 16 | (k[11] & 255) << 24, j4 = k[12] & 255 | (k[13] & 255) << 8 | (k[14] & 255) << 16 | (k[15] & 255) << 24, j5 = c[4] & 255 | (c[5] & 255) << 8 | (c[6] & 255) << 16 | (c[7] & 255) << 24, j6 = p[0] & 255 | (p[1] & 255) << 8 | (p[2] & 255) << 16 | (p[3] & 255) << 24, j7 = p[4] & 255 | (p[5] & 255) << 8 | (p[6] & 255) << 16 | (p[7] & 255) << 24, j8 = p[8] & 255 | (p[9] & 255) << 8 | (p[10] & 255) << 16 | (p[11] & 255) << 24, j9 = p[12] & 255 | (p[13] & 255) << 8 | (p[14] & 255) << 16 | (p[15] & 255) << 24, j10 = c[8] & 255 | (c[9] & 255) << 8 | (c[10] & 255) << 16 | (c[11] & 255) << 24, j11 = k[16] & 255 | (k[17] & 255) << 8 | (k[18] & 255) << 16 | (k[19] & 255) << 24, j12 = k[20] & 255 | (k[21] & 255) << 8 | (k[22] & 255) << 16 | (k[23] & 255) << 24, j13 = k[24] & 255 | (k[25] & 255) << 8 | (k[26] & 255) << 16 | (k[27] & 255) << 24, j14 = k[28] & 255 | (k[29] & 255) << 8 | (k[30] & 255) << 16 | (k[31] & 255) << 24, j15 = c[12] & 255 | (c[13] & 255) << 8 | (c[14] & 255) << 16 | (c[15] & 255) << 24;
|
|
5796
|
-
var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, x15 = j15, u;
|
|
5797
|
-
for (var i = 0; i < 20; i += 2) {
|
|
5798
|
-
u = x0 + x12 | 0;
|
|
5799
|
-
x4 ^= u << 7 | u >>> 25;
|
|
5800
|
-
u = x4 + x0 | 0;
|
|
5801
|
-
x8 ^= u << 9 | u >>> 23;
|
|
5802
|
-
u = x8 + x4 | 0;
|
|
5803
|
-
x12 ^= u << 13 | u >>> 19;
|
|
5804
|
-
u = x12 + x8 | 0;
|
|
5805
|
-
x0 ^= u << 18 | u >>> 14;
|
|
5806
|
-
u = x5 + x1 | 0;
|
|
5807
|
-
x9 ^= u << 7 | u >>> 25;
|
|
5808
|
-
u = x9 + x5 | 0;
|
|
5809
|
-
x13 ^= u << 9 | u >>> 23;
|
|
5810
|
-
u = x13 + x9 | 0;
|
|
5811
|
-
x1 ^= u << 13 | u >>> 19;
|
|
5812
|
-
u = x1 + x13 | 0;
|
|
5813
|
-
x5 ^= u << 18 | u >>> 14;
|
|
5814
|
-
u = x10 + x6 | 0;
|
|
5815
|
-
x14 ^= u << 7 | u >>> 25;
|
|
5816
|
-
u = x14 + x10 | 0;
|
|
5817
|
-
x2 ^= u << 9 | u >>> 23;
|
|
5818
|
-
u = x2 + x14 | 0;
|
|
5819
|
-
x6 ^= u << 13 | u >>> 19;
|
|
5820
|
-
u = x6 + x2 | 0;
|
|
5821
|
-
x10 ^= u << 18 | u >>> 14;
|
|
5822
|
-
u = x15 + x11 | 0;
|
|
5823
|
-
x3 ^= u << 7 | u >>> 25;
|
|
5824
|
-
u = x3 + x15 | 0;
|
|
5825
|
-
x7 ^= u << 9 | u >>> 23;
|
|
5826
|
-
u = x7 + x3 | 0;
|
|
5827
|
-
x11 ^= u << 13 | u >>> 19;
|
|
5828
|
-
u = x11 + x7 | 0;
|
|
5829
|
-
x15 ^= u << 18 | u >>> 14;
|
|
5830
|
-
u = x0 + x3 | 0;
|
|
5831
|
-
x1 ^= u << 7 | u >>> 25;
|
|
5832
|
-
u = x1 + x0 | 0;
|
|
5833
|
-
x2 ^= u << 9 | u >>> 23;
|
|
5834
|
-
u = x2 + x1 | 0;
|
|
5835
|
-
x3 ^= u << 13 | u >>> 19;
|
|
5836
|
-
u = x3 + x2 | 0;
|
|
5837
|
-
x0 ^= u << 18 | u >>> 14;
|
|
5838
|
-
u = x5 + x4 | 0;
|
|
5839
|
-
x6 ^= u << 7 | u >>> 25;
|
|
5840
|
-
u = x6 + x5 | 0;
|
|
5841
|
-
x7 ^= u << 9 | u >>> 23;
|
|
5842
|
-
u = x7 + x6 | 0;
|
|
5843
|
-
x4 ^= u << 13 | u >>> 19;
|
|
5844
|
-
u = x4 + x7 | 0;
|
|
5845
|
-
x5 ^= u << 18 | u >>> 14;
|
|
5846
|
-
u = x10 + x9 | 0;
|
|
5847
|
-
x11 ^= u << 7 | u >>> 25;
|
|
5848
|
-
u = x11 + x10 | 0;
|
|
5849
|
-
x8 ^= u << 9 | u >>> 23;
|
|
5850
|
-
u = x8 + x11 | 0;
|
|
5851
|
-
x9 ^= u << 13 | u >>> 19;
|
|
5852
|
-
u = x9 + x8 | 0;
|
|
5853
|
-
x10 ^= u << 18 | u >>> 14;
|
|
5854
|
-
u = x15 + x14 | 0;
|
|
5855
|
-
x12 ^= u << 7 | u >>> 25;
|
|
5856
|
-
u = x12 + x15 | 0;
|
|
5857
|
-
x13 ^= u << 9 | u >>> 23;
|
|
5858
|
-
u = x13 + x12 | 0;
|
|
5859
|
-
x14 ^= u << 13 | u >>> 19;
|
|
5860
|
-
u = x14 + x13 | 0;
|
|
5861
|
-
x15 ^= u << 18 | u >>> 14;
|
|
5862
|
-
}
|
|
5863
|
-
x0 = x0 + j0 | 0;
|
|
5864
|
-
x1 = x1 + j1 | 0;
|
|
5865
|
-
x2 = x2 + j2 | 0;
|
|
5866
|
-
x3 = x3 + j3 | 0;
|
|
5867
|
-
x4 = x4 + j4 | 0;
|
|
5868
|
-
x5 = x5 + j5 | 0;
|
|
5869
|
-
x6 = x6 + j6 | 0;
|
|
5870
|
-
x7 = x7 + j7 | 0;
|
|
5871
|
-
x8 = x8 + j8 | 0;
|
|
5872
|
-
x9 = x9 + j9 | 0;
|
|
5873
|
-
x10 = x10 + j10 | 0;
|
|
5874
|
-
x11 = x11 + j11 | 0;
|
|
5875
|
-
x12 = x12 + j12 | 0;
|
|
5876
|
-
x13 = x13 + j13 | 0;
|
|
5877
|
-
x14 = x14 + j14 | 0;
|
|
5878
|
-
x15 = x15 + j15 | 0;
|
|
5879
|
-
o[0] = x0 >>> 0 & 255;
|
|
5880
|
-
o[1] = x0 >>> 8 & 255;
|
|
5881
|
-
o[2] = x0 >>> 16 & 255;
|
|
5882
|
-
o[3] = x0 >>> 24 & 255;
|
|
5883
|
-
o[4] = x1 >>> 0 & 255;
|
|
5884
|
-
o[5] = x1 >>> 8 & 255;
|
|
5885
|
-
o[6] = x1 >>> 16 & 255;
|
|
5886
|
-
o[7] = x1 >>> 24 & 255;
|
|
5887
|
-
o[8] = x2 >>> 0 & 255;
|
|
5888
|
-
o[9] = x2 >>> 8 & 255;
|
|
5889
|
-
o[10] = x2 >>> 16 & 255;
|
|
5890
|
-
o[11] = x2 >>> 24 & 255;
|
|
5891
|
-
o[12] = x3 >>> 0 & 255;
|
|
5892
|
-
o[13] = x3 >>> 8 & 255;
|
|
5893
|
-
o[14] = x3 >>> 16 & 255;
|
|
5894
|
-
o[15] = x3 >>> 24 & 255;
|
|
5895
|
-
o[16] = x4 >>> 0 & 255;
|
|
5896
|
-
o[17] = x4 >>> 8 & 255;
|
|
5897
|
-
o[18] = x4 >>> 16 & 255;
|
|
5898
|
-
o[19] = x4 >>> 24 & 255;
|
|
5899
|
-
o[20] = x5 >>> 0 & 255;
|
|
5900
|
-
o[21] = x5 >>> 8 & 255;
|
|
5901
|
-
o[22] = x5 >>> 16 & 255;
|
|
5902
|
-
o[23] = x5 >>> 24 & 255;
|
|
5903
|
-
o[24] = x6 >>> 0 & 255;
|
|
5904
|
-
o[25] = x6 >>> 8 & 255;
|
|
5905
|
-
o[26] = x6 >>> 16 & 255;
|
|
5906
|
-
o[27] = x6 >>> 24 & 255;
|
|
5907
|
-
o[28] = x7 >>> 0 & 255;
|
|
5908
|
-
o[29] = x7 >>> 8 & 255;
|
|
5909
|
-
o[30] = x7 >>> 16 & 255;
|
|
5910
|
-
o[31] = x7 >>> 24 & 255;
|
|
5911
|
-
o[32] = x8 >>> 0 & 255;
|
|
5912
|
-
o[33] = x8 >>> 8 & 255;
|
|
5913
|
-
o[34] = x8 >>> 16 & 255;
|
|
5914
|
-
o[35] = x8 >>> 24 & 255;
|
|
5915
|
-
o[36] = x9 >>> 0 & 255;
|
|
5916
|
-
o[37] = x9 >>> 8 & 255;
|
|
5917
|
-
o[38] = x9 >>> 16 & 255;
|
|
5918
|
-
o[39] = x9 >>> 24 & 255;
|
|
5919
|
-
o[40] = x10 >>> 0 & 255;
|
|
5920
|
-
o[41] = x10 >>> 8 & 255;
|
|
5921
|
-
o[42] = x10 >>> 16 & 255;
|
|
5922
|
-
o[43] = x10 >>> 24 & 255;
|
|
5923
|
-
o[44] = x11 >>> 0 & 255;
|
|
5924
|
-
o[45] = x11 >>> 8 & 255;
|
|
5925
|
-
o[46] = x11 >>> 16 & 255;
|
|
5926
|
-
o[47] = x11 >>> 24 & 255;
|
|
5927
|
-
o[48] = x12 >>> 0 & 255;
|
|
5928
|
-
o[49] = x12 >>> 8 & 255;
|
|
5929
|
-
o[50] = x12 >>> 16 & 255;
|
|
5930
|
-
o[51] = x12 >>> 24 & 255;
|
|
5931
|
-
o[52] = x13 >>> 0 & 255;
|
|
5932
|
-
o[53] = x13 >>> 8 & 255;
|
|
5933
|
-
o[54] = x13 >>> 16 & 255;
|
|
5934
|
-
o[55] = x13 >>> 24 & 255;
|
|
5935
|
-
o[56] = x14 >>> 0 & 255;
|
|
5936
|
-
o[57] = x14 >>> 8 & 255;
|
|
5937
|
-
o[58] = x14 >>> 16 & 255;
|
|
5938
|
-
o[59] = x14 >>> 24 & 255;
|
|
5939
|
-
o[60] = x15 >>> 0 & 255;
|
|
5940
|
-
o[61] = x15 >>> 8 & 255;
|
|
5941
|
-
o[62] = x15 >>> 16 & 255;
|
|
5942
|
-
o[63] = x15 >>> 24 & 255;
|
|
5943
|
-
}
|
|
5944
|
-
function core_hsalsa20(o, p, k, c) {
|
|
5945
|
-
var j0 = c[0] & 255 | (c[1] & 255) << 8 | (c[2] & 255) << 16 | (c[3] & 255) << 24, j1 = k[0] & 255 | (k[1] & 255) << 8 | (k[2] & 255) << 16 | (k[3] & 255) << 24, j2 = k[4] & 255 | (k[5] & 255) << 8 | (k[6] & 255) << 16 | (k[7] & 255) << 24, j3 = k[8] & 255 | (k[9] & 255) << 8 | (k[10] & 255) << 16 | (k[11] & 255) << 24, j4 = k[12] & 255 | (k[13] & 255) << 8 | (k[14] & 255) << 16 | (k[15] & 255) << 24, j5 = c[4] & 255 | (c[5] & 255) << 8 | (c[6] & 255) << 16 | (c[7] & 255) << 24, j6 = p[0] & 255 | (p[1] & 255) << 8 | (p[2] & 255) << 16 | (p[3] & 255) << 24, j7 = p[4] & 255 | (p[5] & 255) << 8 | (p[6] & 255) << 16 | (p[7] & 255) << 24, j8 = p[8] & 255 | (p[9] & 255) << 8 | (p[10] & 255) << 16 | (p[11] & 255) << 24, j9 = p[12] & 255 | (p[13] & 255) << 8 | (p[14] & 255) << 16 | (p[15] & 255) << 24, j10 = c[8] & 255 | (c[9] & 255) << 8 | (c[10] & 255) << 16 | (c[11] & 255) << 24, j11 = k[16] & 255 | (k[17] & 255) << 8 | (k[18] & 255) << 16 | (k[19] & 255) << 24, j12 = k[20] & 255 | (k[21] & 255) << 8 | (k[22] & 255) << 16 | (k[23] & 255) << 24, j13 = k[24] & 255 | (k[25] & 255) << 8 | (k[26] & 255) << 16 | (k[27] & 255) << 24, j14 = k[28] & 255 | (k[29] & 255) << 8 | (k[30] & 255) << 16 | (k[31] & 255) << 24, j15 = c[12] & 255 | (c[13] & 255) << 8 | (c[14] & 255) << 16 | (c[15] & 255) << 24;
|
|
5946
|
-
var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, x15 = j15, u;
|
|
5947
|
-
for (var i = 0; i < 20; i += 2) {
|
|
5948
|
-
u = x0 + x12 | 0;
|
|
5949
|
-
x4 ^= u << 7 | u >>> 25;
|
|
5950
|
-
u = x4 + x0 | 0;
|
|
5951
|
-
x8 ^= u << 9 | u >>> 23;
|
|
5952
|
-
u = x8 + x4 | 0;
|
|
5953
|
-
x12 ^= u << 13 | u >>> 19;
|
|
5954
|
-
u = x12 + x8 | 0;
|
|
5955
|
-
x0 ^= u << 18 | u >>> 14;
|
|
5956
|
-
u = x5 + x1 | 0;
|
|
5957
|
-
x9 ^= u << 7 | u >>> 25;
|
|
5958
|
-
u = x9 + x5 | 0;
|
|
5959
|
-
x13 ^= u << 9 | u >>> 23;
|
|
5960
|
-
u = x13 + x9 | 0;
|
|
5961
|
-
x1 ^= u << 13 | u >>> 19;
|
|
5962
|
-
u = x1 + x13 | 0;
|
|
5963
|
-
x5 ^= u << 18 | u >>> 14;
|
|
5964
|
-
u = x10 + x6 | 0;
|
|
5965
|
-
x14 ^= u << 7 | u >>> 25;
|
|
5966
|
-
u = x14 + x10 | 0;
|
|
5967
|
-
x2 ^= u << 9 | u >>> 23;
|
|
5968
|
-
u = x2 + x14 | 0;
|
|
5969
|
-
x6 ^= u << 13 | u >>> 19;
|
|
5970
|
-
u = x6 + x2 | 0;
|
|
5971
|
-
x10 ^= u << 18 | u >>> 14;
|
|
5972
|
-
u = x15 + x11 | 0;
|
|
5973
|
-
x3 ^= u << 7 | u >>> 25;
|
|
5974
|
-
u = x3 + x15 | 0;
|
|
5975
|
-
x7 ^= u << 9 | u >>> 23;
|
|
5976
|
-
u = x7 + x3 | 0;
|
|
5977
|
-
x11 ^= u << 13 | u >>> 19;
|
|
5978
|
-
u = x11 + x7 | 0;
|
|
5979
|
-
x15 ^= u << 18 | u >>> 14;
|
|
5980
|
-
u = x0 + x3 | 0;
|
|
5981
|
-
x1 ^= u << 7 | u >>> 25;
|
|
5982
|
-
u = x1 + x0 | 0;
|
|
5983
|
-
x2 ^= u << 9 | u >>> 23;
|
|
5984
|
-
u = x2 + x1 | 0;
|
|
5985
|
-
x3 ^= u << 13 | u >>> 19;
|
|
5986
|
-
u = x3 + x2 | 0;
|
|
5987
|
-
x0 ^= u << 18 | u >>> 14;
|
|
5988
|
-
u = x5 + x4 | 0;
|
|
5989
|
-
x6 ^= u << 7 | u >>> 25;
|
|
5990
|
-
u = x6 + x5 | 0;
|
|
5991
|
-
x7 ^= u << 9 | u >>> 23;
|
|
5992
|
-
u = x7 + x6 | 0;
|
|
5993
|
-
x4 ^= u << 13 | u >>> 19;
|
|
5994
|
-
u = x4 + x7 | 0;
|
|
5995
|
-
x5 ^= u << 18 | u >>> 14;
|
|
5996
|
-
u = x10 + x9 | 0;
|
|
5997
|
-
x11 ^= u << 7 | u >>> 25;
|
|
5998
|
-
u = x11 + x10 | 0;
|
|
5999
|
-
x8 ^= u << 9 | u >>> 23;
|
|
6000
|
-
u = x8 + x11 | 0;
|
|
6001
|
-
x9 ^= u << 13 | u >>> 19;
|
|
6002
|
-
u = x9 + x8 | 0;
|
|
6003
|
-
x10 ^= u << 18 | u >>> 14;
|
|
6004
|
-
u = x15 + x14 | 0;
|
|
6005
|
-
x12 ^= u << 7 | u >>> 25;
|
|
6006
|
-
u = x12 + x15 | 0;
|
|
6007
|
-
x13 ^= u << 9 | u >>> 23;
|
|
6008
|
-
u = x13 + x12 | 0;
|
|
6009
|
-
x14 ^= u << 13 | u >>> 19;
|
|
6010
|
-
u = x14 + x13 | 0;
|
|
6011
|
-
x15 ^= u << 18 | u >>> 14;
|
|
6012
|
-
}
|
|
6013
|
-
o[0] = x0 >>> 0 & 255;
|
|
6014
|
-
o[1] = x0 >>> 8 & 255;
|
|
6015
|
-
o[2] = x0 >>> 16 & 255;
|
|
6016
|
-
o[3] = x0 >>> 24 & 255;
|
|
6017
|
-
o[4] = x5 >>> 0 & 255;
|
|
6018
|
-
o[5] = x5 >>> 8 & 255;
|
|
6019
|
-
o[6] = x5 >>> 16 & 255;
|
|
6020
|
-
o[7] = x5 >>> 24 & 255;
|
|
6021
|
-
o[8] = x10 >>> 0 & 255;
|
|
6022
|
-
o[9] = x10 >>> 8 & 255;
|
|
6023
|
-
o[10] = x10 >>> 16 & 255;
|
|
6024
|
-
o[11] = x10 >>> 24 & 255;
|
|
6025
|
-
o[12] = x15 >>> 0 & 255;
|
|
6026
|
-
o[13] = x15 >>> 8 & 255;
|
|
6027
|
-
o[14] = x15 >>> 16 & 255;
|
|
6028
|
-
o[15] = x15 >>> 24 & 255;
|
|
6029
|
-
o[16] = x6 >>> 0 & 255;
|
|
6030
|
-
o[17] = x6 >>> 8 & 255;
|
|
6031
|
-
o[18] = x6 >>> 16 & 255;
|
|
6032
|
-
o[19] = x6 >>> 24 & 255;
|
|
6033
|
-
o[20] = x7 >>> 0 & 255;
|
|
6034
|
-
o[21] = x7 >>> 8 & 255;
|
|
6035
|
-
o[22] = x7 >>> 16 & 255;
|
|
6036
|
-
o[23] = x7 >>> 24 & 255;
|
|
6037
|
-
o[24] = x8 >>> 0 & 255;
|
|
6038
|
-
o[25] = x8 >>> 8 & 255;
|
|
6039
|
-
o[26] = x8 >>> 16 & 255;
|
|
6040
|
-
o[27] = x8 >>> 24 & 255;
|
|
6041
|
-
o[28] = x9 >>> 0 & 255;
|
|
6042
|
-
o[29] = x9 >>> 8 & 255;
|
|
6043
|
-
o[30] = x9 >>> 16 & 255;
|
|
6044
|
-
o[31] = x9 >>> 24 & 255;
|
|
6045
|
-
}
|
|
6046
|
-
}
|
|
6047
|
-
});
|
|
6048
|
-
|
|
6049
4958
|
// ../../node_modules/.pnpm/xsalsa20-universal@1.0.0/node_modules/xsalsa20-universal/browser.js
|
|
6050
4959
|
var require_browser3 = __commonJS({
|
|
6051
4960
|
"../../node_modules/.pnpm/xsalsa20-universal@1.0.0/node_modules/xsalsa20-universal/browser.js"(exports, module) {
|
|
6052
|
-
var xsalsa20 =
|
|
4961
|
+
var xsalsa20 = require_xsalsa20();
|
|
6053
4962
|
module.exports = class XORJS {
|
|
6054
4963
|
constructor(nonce, key) {
|
|
6055
4964
|
this.instance = xsalsa20(nonce, key);
|
|
@@ -6657,6 +5566,991 @@ var require_abstract_extension = __commonJS({
|
|
|
6657
5566
|
}
|
|
6658
5567
|
});
|
|
6659
5568
|
|
|
5569
|
+
// ../../node_modules/.pnpm/queue-tick@1.0.1/node_modules/queue-tick/queue-microtask.js
|
|
5570
|
+
var require_queue_microtask = __commonJS({
|
|
5571
|
+
"../../node_modules/.pnpm/queue-tick@1.0.1/node_modules/queue-tick/queue-microtask.js"(exports, module) {
|
|
5572
|
+
module.exports = typeof queueMicrotask === "function" ? queueMicrotask : (fn) => Promise.resolve().then(fn);
|
|
5573
|
+
}
|
|
5574
|
+
});
|
|
5575
|
+
|
|
5576
|
+
// ../../node_modules/.pnpm/fast-fifo@1.3.2/node_modules/fast-fifo/fixed-size.js
|
|
5577
|
+
var require_fixed_size = __commonJS({
|
|
5578
|
+
"../../node_modules/.pnpm/fast-fifo@1.3.2/node_modules/fast-fifo/fixed-size.js"(exports, module) {
|
|
5579
|
+
module.exports = class FixedFIFO {
|
|
5580
|
+
constructor(hwm) {
|
|
5581
|
+
if (!(hwm > 0) || (hwm - 1 & hwm) !== 0) throw new Error("Max size for a FixedFIFO should be a power of two");
|
|
5582
|
+
this.buffer = new Array(hwm);
|
|
5583
|
+
this.mask = hwm - 1;
|
|
5584
|
+
this.top = 0;
|
|
5585
|
+
this.btm = 0;
|
|
5586
|
+
this.next = null;
|
|
5587
|
+
}
|
|
5588
|
+
clear() {
|
|
5589
|
+
this.top = this.btm = 0;
|
|
5590
|
+
this.next = null;
|
|
5591
|
+
this.buffer.fill(void 0);
|
|
5592
|
+
}
|
|
5593
|
+
push(data) {
|
|
5594
|
+
if (this.buffer[this.top] !== void 0) return false;
|
|
5595
|
+
this.buffer[this.top] = data;
|
|
5596
|
+
this.top = this.top + 1 & this.mask;
|
|
5597
|
+
return true;
|
|
5598
|
+
}
|
|
5599
|
+
shift() {
|
|
5600
|
+
const last = this.buffer[this.btm];
|
|
5601
|
+
if (last === void 0) return void 0;
|
|
5602
|
+
this.buffer[this.btm] = void 0;
|
|
5603
|
+
this.btm = this.btm + 1 & this.mask;
|
|
5604
|
+
return last;
|
|
5605
|
+
}
|
|
5606
|
+
peek() {
|
|
5607
|
+
return this.buffer[this.btm];
|
|
5608
|
+
}
|
|
5609
|
+
isEmpty() {
|
|
5610
|
+
return this.buffer[this.btm] === void 0;
|
|
5611
|
+
}
|
|
5612
|
+
};
|
|
5613
|
+
}
|
|
5614
|
+
});
|
|
5615
|
+
|
|
5616
|
+
// ../../node_modules/.pnpm/fast-fifo@1.3.2/node_modules/fast-fifo/index.js
|
|
5617
|
+
var require_fast_fifo = __commonJS({
|
|
5618
|
+
"../../node_modules/.pnpm/fast-fifo@1.3.2/node_modules/fast-fifo/index.js"(exports, module) {
|
|
5619
|
+
var FixedFIFO = require_fixed_size();
|
|
5620
|
+
module.exports = class FastFIFO {
|
|
5621
|
+
constructor(hwm) {
|
|
5622
|
+
this.hwm = hwm || 16;
|
|
5623
|
+
this.head = new FixedFIFO(this.hwm);
|
|
5624
|
+
this.tail = this.head;
|
|
5625
|
+
this.length = 0;
|
|
5626
|
+
}
|
|
5627
|
+
clear() {
|
|
5628
|
+
this.head = this.tail;
|
|
5629
|
+
this.head.clear();
|
|
5630
|
+
this.length = 0;
|
|
5631
|
+
}
|
|
5632
|
+
push(val) {
|
|
5633
|
+
this.length++;
|
|
5634
|
+
if (!this.head.push(val)) {
|
|
5635
|
+
const prev = this.head;
|
|
5636
|
+
this.head = prev.next = new FixedFIFO(2 * this.head.buffer.length);
|
|
5637
|
+
this.head.push(val);
|
|
5638
|
+
}
|
|
5639
|
+
}
|
|
5640
|
+
shift() {
|
|
5641
|
+
if (this.length !== 0) this.length--;
|
|
5642
|
+
const val = this.tail.shift();
|
|
5643
|
+
if (val === void 0 && this.tail.next) {
|
|
5644
|
+
const next = this.tail.next;
|
|
5645
|
+
this.tail.next = null;
|
|
5646
|
+
this.tail = next;
|
|
5647
|
+
return this.tail.shift();
|
|
5648
|
+
}
|
|
5649
|
+
return val;
|
|
5650
|
+
}
|
|
5651
|
+
peek() {
|
|
5652
|
+
const val = this.tail.peek();
|
|
5653
|
+
if (val === void 0 && this.tail.next) return this.tail.next.peek();
|
|
5654
|
+
return val;
|
|
5655
|
+
}
|
|
5656
|
+
isEmpty() {
|
|
5657
|
+
return this.length === 0;
|
|
5658
|
+
}
|
|
5659
|
+
};
|
|
5660
|
+
}
|
|
5661
|
+
});
|
|
5662
|
+
|
|
5663
|
+
// ../../node_modules/.pnpm/streamx@2.15.6/node_modules/streamx/index.js
|
|
5664
|
+
var require_streamx = __commonJS({
|
|
5665
|
+
"../../node_modules/.pnpm/streamx@2.15.6/node_modules/streamx/index.js"(exports, module) {
|
|
5666
|
+
var { EventEmitter } = import$n$_dxos_node_std_events;
|
|
5667
|
+
var STREAM_DESTROYED = new Error("Stream was destroyed");
|
|
5668
|
+
var PREMATURE_CLOSE = new Error("Premature close");
|
|
5669
|
+
var queueTick = require_queue_microtask();
|
|
5670
|
+
var FIFO = require_fast_fifo();
|
|
5671
|
+
var MAX = (1 << 27) - 1;
|
|
5672
|
+
var OPENING = 1;
|
|
5673
|
+
var PREDESTROYING = 2;
|
|
5674
|
+
var DESTROYING = 4;
|
|
5675
|
+
var DESTROYED = 8;
|
|
5676
|
+
var NOT_OPENING = MAX ^ OPENING;
|
|
5677
|
+
var NOT_PREDESTROYING = MAX ^ PREDESTROYING;
|
|
5678
|
+
var READ_ACTIVE = 1 << 4;
|
|
5679
|
+
var READ_UPDATING = 2 << 4;
|
|
5680
|
+
var READ_PRIMARY = 4 << 4;
|
|
5681
|
+
var READ_QUEUED = 8 << 4;
|
|
5682
|
+
var READ_RESUMED = 16 << 4;
|
|
5683
|
+
var READ_PIPE_DRAINED = 32 << 4;
|
|
5684
|
+
var READ_ENDING = 64 << 4;
|
|
5685
|
+
var READ_EMIT_DATA = 128 << 4;
|
|
5686
|
+
var READ_EMIT_READABLE = 256 << 4;
|
|
5687
|
+
var READ_EMITTED_READABLE = 512 << 4;
|
|
5688
|
+
var READ_DONE = 1024 << 4;
|
|
5689
|
+
var READ_NEXT_TICK = 2048 << 4;
|
|
5690
|
+
var READ_NEEDS_PUSH = 4096 << 4;
|
|
5691
|
+
var READ_FLOWING = READ_RESUMED | READ_PIPE_DRAINED;
|
|
5692
|
+
var READ_ACTIVE_AND_NEEDS_PUSH = READ_ACTIVE | READ_NEEDS_PUSH;
|
|
5693
|
+
var READ_PRIMARY_AND_ACTIVE = READ_PRIMARY | READ_ACTIVE;
|
|
5694
|
+
var READ_EMIT_READABLE_AND_QUEUED = READ_EMIT_READABLE | READ_QUEUED;
|
|
5695
|
+
var READ_NOT_ACTIVE = MAX ^ READ_ACTIVE;
|
|
5696
|
+
var READ_NON_PRIMARY = MAX ^ READ_PRIMARY;
|
|
5697
|
+
var READ_NON_PRIMARY_AND_PUSHED = MAX ^ (READ_PRIMARY | READ_NEEDS_PUSH);
|
|
5698
|
+
var READ_PUSHED = MAX ^ READ_NEEDS_PUSH;
|
|
5699
|
+
var READ_PAUSED = MAX ^ READ_RESUMED;
|
|
5700
|
+
var READ_NOT_QUEUED = MAX ^ (READ_QUEUED | READ_EMITTED_READABLE);
|
|
5701
|
+
var READ_NOT_ENDING = MAX ^ READ_ENDING;
|
|
5702
|
+
var READ_PIPE_NOT_DRAINED = MAX ^ READ_FLOWING;
|
|
5703
|
+
var READ_NOT_NEXT_TICK = MAX ^ READ_NEXT_TICK;
|
|
5704
|
+
var READ_NOT_UPDATING = MAX ^ READ_UPDATING;
|
|
5705
|
+
var WRITE_ACTIVE = 1 << 17;
|
|
5706
|
+
var WRITE_UPDATING = 2 << 17;
|
|
5707
|
+
var WRITE_PRIMARY = 4 << 17;
|
|
5708
|
+
var WRITE_QUEUED = 8 << 17;
|
|
5709
|
+
var WRITE_UNDRAINED = 16 << 17;
|
|
5710
|
+
var WRITE_DONE = 32 << 17;
|
|
5711
|
+
var WRITE_EMIT_DRAIN = 64 << 17;
|
|
5712
|
+
var WRITE_NEXT_TICK = 128 << 17;
|
|
5713
|
+
var WRITE_WRITING = 256 << 17;
|
|
5714
|
+
var WRITE_FINISHING = 512 << 17;
|
|
5715
|
+
var WRITE_NOT_ACTIVE = MAX ^ (WRITE_ACTIVE | WRITE_WRITING);
|
|
5716
|
+
var WRITE_NON_PRIMARY = MAX ^ WRITE_PRIMARY;
|
|
5717
|
+
var WRITE_NOT_FINISHING = MAX ^ WRITE_FINISHING;
|
|
5718
|
+
var WRITE_DRAINED = MAX ^ WRITE_UNDRAINED;
|
|
5719
|
+
var WRITE_NOT_QUEUED = MAX ^ WRITE_QUEUED;
|
|
5720
|
+
var WRITE_NOT_NEXT_TICK = MAX ^ WRITE_NEXT_TICK;
|
|
5721
|
+
var WRITE_NOT_UPDATING = MAX ^ WRITE_UPDATING;
|
|
5722
|
+
var ACTIVE = READ_ACTIVE | WRITE_ACTIVE;
|
|
5723
|
+
var NOT_ACTIVE = MAX ^ ACTIVE;
|
|
5724
|
+
var DONE = READ_DONE | WRITE_DONE;
|
|
5725
|
+
var DESTROY_STATUS = DESTROYING | DESTROYED | PREDESTROYING;
|
|
5726
|
+
var OPEN_STATUS = DESTROY_STATUS | OPENING;
|
|
5727
|
+
var AUTO_DESTROY = DESTROY_STATUS | DONE;
|
|
5728
|
+
var NON_PRIMARY = WRITE_NON_PRIMARY & READ_NON_PRIMARY;
|
|
5729
|
+
var ACTIVE_OR_TICKING = WRITE_NEXT_TICK | READ_NEXT_TICK;
|
|
5730
|
+
var TICKING = ACTIVE_OR_TICKING & NOT_ACTIVE;
|
|
5731
|
+
var IS_OPENING = OPEN_STATUS | TICKING;
|
|
5732
|
+
var READ_PRIMARY_STATUS = OPEN_STATUS | READ_ENDING | READ_DONE;
|
|
5733
|
+
var READ_STATUS = OPEN_STATUS | READ_DONE | READ_QUEUED;
|
|
5734
|
+
var READ_ENDING_STATUS = OPEN_STATUS | READ_ENDING | READ_QUEUED;
|
|
5735
|
+
var READ_READABLE_STATUS = OPEN_STATUS | READ_EMIT_READABLE | READ_QUEUED | READ_EMITTED_READABLE;
|
|
5736
|
+
var SHOULD_NOT_READ = OPEN_STATUS | READ_ACTIVE | READ_ENDING | READ_DONE | READ_NEEDS_PUSH;
|
|
5737
|
+
var READ_BACKPRESSURE_STATUS = DESTROY_STATUS | READ_ENDING | READ_DONE;
|
|
5738
|
+
var READ_UPDATE_SYNC_STATUS = READ_UPDATING | OPEN_STATUS | READ_NEXT_TICK | READ_PRIMARY;
|
|
5739
|
+
var WRITE_PRIMARY_STATUS = OPEN_STATUS | WRITE_FINISHING | WRITE_DONE;
|
|
5740
|
+
var WRITE_QUEUED_AND_UNDRAINED = WRITE_QUEUED | WRITE_UNDRAINED;
|
|
5741
|
+
var WRITE_QUEUED_AND_ACTIVE = WRITE_QUEUED | WRITE_ACTIVE;
|
|
5742
|
+
var WRITE_DRAIN_STATUS = WRITE_QUEUED | WRITE_UNDRAINED | OPEN_STATUS | WRITE_ACTIVE;
|
|
5743
|
+
var WRITE_STATUS = OPEN_STATUS | WRITE_ACTIVE | WRITE_QUEUED;
|
|
5744
|
+
var WRITE_PRIMARY_AND_ACTIVE = WRITE_PRIMARY | WRITE_ACTIVE;
|
|
5745
|
+
var WRITE_ACTIVE_AND_WRITING = WRITE_ACTIVE | WRITE_WRITING;
|
|
5746
|
+
var WRITE_FINISHING_STATUS = OPEN_STATUS | WRITE_FINISHING | WRITE_QUEUED_AND_ACTIVE | WRITE_DONE;
|
|
5747
|
+
var WRITE_BACKPRESSURE_STATUS = WRITE_UNDRAINED | DESTROY_STATUS | WRITE_FINISHING | WRITE_DONE;
|
|
5748
|
+
var WRITE_UPDATE_SYNC_STATUS = WRITE_UPDATING | OPEN_STATUS | WRITE_NEXT_TICK | WRITE_PRIMARY;
|
|
5749
|
+
var asyncIterator = Symbol.asyncIterator || Symbol("asyncIterator");
|
|
5750
|
+
var WritableState = class {
|
|
5751
|
+
constructor(stream, { highWaterMark = 16384, map = null, mapWritable, byteLength, byteLengthWritable } = {}) {
|
|
5752
|
+
this.stream = stream;
|
|
5753
|
+
this.queue = new FIFO();
|
|
5754
|
+
this.highWaterMark = highWaterMark;
|
|
5755
|
+
this.buffered = 0;
|
|
5756
|
+
this.error = null;
|
|
5757
|
+
this.pipeline = null;
|
|
5758
|
+
this.drains = null;
|
|
5759
|
+
this.byteLength = byteLengthWritable || byteLength || defaultByteLength;
|
|
5760
|
+
this.map = mapWritable || map;
|
|
5761
|
+
this.afterWrite = afterWrite.bind(this);
|
|
5762
|
+
this.afterUpdateNextTick = updateWriteNT.bind(this);
|
|
5763
|
+
}
|
|
5764
|
+
get ended() {
|
|
5765
|
+
return (this.stream._duplexState & WRITE_DONE) !== 0;
|
|
5766
|
+
}
|
|
5767
|
+
push(data) {
|
|
5768
|
+
if (this.map !== null) data = this.map(data);
|
|
5769
|
+
this.buffered += this.byteLength(data);
|
|
5770
|
+
this.queue.push(data);
|
|
5771
|
+
if (this.buffered < this.highWaterMark) {
|
|
5772
|
+
this.stream._duplexState |= WRITE_QUEUED;
|
|
5773
|
+
return true;
|
|
5774
|
+
}
|
|
5775
|
+
this.stream._duplexState |= WRITE_QUEUED_AND_UNDRAINED;
|
|
5776
|
+
return false;
|
|
5777
|
+
}
|
|
5778
|
+
shift() {
|
|
5779
|
+
const data = this.queue.shift();
|
|
5780
|
+
this.buffered -= this.byteLength(data);
|
|
5781
|
+
if (this.buffered === 0) this.stream._duplexState &= WRITE_NOT_QUEUED;
|
|
5782
|
+
return data;
|
|
5783
|
+
}
|
|
5784
|
+
end(data) {
|
|
5785
|
+
if (typeof data === "function") this.stream.once("finish", data);
|
|
5786
|
+
else if (data !== void 0 && data !== null) this.push(data);
|
|
5787
|
+
this.stream._duplexState = (this.stream._duplexState | WRITE_FINISHING) & WRITE_NON_PRIMARY;
|
|
5788
|
+
}
|
|
5789
|
+
autoBatch(data, cb) {
|
|
5790
|
+
const buffer = [];
|
|
5791
|
+
const stream = this.stream;
|
|
5792
|
+
buffer.push(data);
|
|
5793
|
+
while ((stream._duplexState & WRITE_STATUS) === WRITE_QUEUED_AND_ACTIVE) {
|
|
5794
|
+
buffer.push(stream._writableState.shift());
|
|
5795
|
+
}
|
|
5796
|
+
if ((stream._duplexState & OPEN_STATUS) !== 0) return cb(null);
|
|
5797
|
+
stream._writev(buffer, cb);
|
|
5798
|
+
}
|
|
5799
|
+
update() {
|
|
5800
|
+
const stream = this.stream;
|
|
5801
|
+
stream._duplexState |= WRITE_UPDATING;
|
|
5802
|
+
do {
|
|
5803
|
+
while ((stream._duplexState & WRITE_STATUS) === WRITE_QUEUED) {
|
|
5804
|
+
const data = this.shift();
|
|
5805
|
+
stream._duplexState |= WRITE_ACTIVE_AND_WRITING;
|
|
5806
|
+
stream._write(data, this.afterWrite);
|
|
5807
|
+
}
|
|
5808
|
+
if ((stream._duplexState & WRITE_PRIMARY_AND_ACTIVE) === 0) this.updateNonPrimary();
|
|
5809
|
+
} while (this.continueUpdate() === true);
|
|
5810
|
+
stream._duplexState &= WRITE_NOT_UPDATING;
|
|
5811
|
+
}
|
|
5812
|
+
updateNonPrimary() {
|
|
5813
|
+
const stream = this.stream;
|
|
5814
|
+
if ((stream._duplexState & WRITE_FINISHING_STATUS) === WRITE_FINISHING) {
|
|
5815
|
+
stream._duplexState = (stream._duplexState | WRITE_ACTIVE) & WRITE_NOT_FINISHING;
|
|
5816
|
+
stream._final(afterFinal.bind(this));
|
|
5817
|
+
return;
|
|
5818
|
+
}
|
|
5819
|
+
if ((stream._duplexState & DESTROY_STATUS) === DESTROYING) {
|
|
5820
|
+
if ((stream._duplexState & ACTIVE_OR_TICKING) === 0) {
|
|
5821
|
+
stream._duplexState |= ACTIVE;
|
|
5822
|
+
stream._destroy(afterDestroy.bind(this));
|
|
5823
|
+
}
|
|
5824
|
+
return;
|
|
5825
|
+
}
|
|
5826
|
+
if ((stream._duplexState & IS_OPENING) === OPENING) {
|
|
5827
|
+
stream._duplexState = (stream._duplexState | ACTIVE) & NOT_OPENING;
|
|
5828
|
+
stream._open(afterOpen.bind(this));
|
|
5829
|
+
}
|
|
5830
|
+
}
|
|
5831
|
+
continueUpdate() {
|
|
5832
|
+
if ((this.stream._duplexState & WRITE_NEXT_TICK) === 0) return false;
|
|
5833
|
+
this.stream._duplexState &= WRITE_NOT_NEXT_TICK;
|
|
5834
|
+
return true;
|
|
5835
|
+
}
|
|
5836
|
+
updateCallback() {
|
|
5837
|
+
if ((this.stream._duplexState & WRITE_UPDATE_SYNC_STATUS) === WRITE_PRIMARY) this.update();
|
|
5838
|
+
else this.updateNextTick();
|
|
5839
|
+
}
|
|
5840
|
+
updateNextTick() {
|
|
5841
|
+
if ((this.stream._duplexState & WRITE_NEXT_TICK) !== 0) return;
|
|
5842
|
+
this.stream._duplexState |= WRITE_NEXT_TICK;
|
|
5843
|
+
if ((this.stream._duplexState & WRITE_UPDATING) === 0) queueTick(this.afterUpdateNextTick);
|
|
5844
|
+
}
|
|
5845
|
+
};
|
|
5846
|
+
var ReadableState = class {
|
|
5847
|
+
constructor(stream, { highWaterMark = 16384, map = null, mapReadable, byteLength, byteLengthReadable } = {}) {
|
|
5848
|
+
this.stream = stream;
|
|
5849
|
+
this.queue = new FIFO();
|
|
5850
|
+
this.highWaterMark = highWaterMark;
|
|
5851
|
+
this.buffered = 0;
|
|
5852
|
+
this.error = null;
|
|
5853
|
+
this.pipeline = null;
|
|
5854
|
+
this.byteLength = byteLengthReadable || byteLength || defaultByteLength;
|
|
5855
|
+
this.map = mapReadable || map;
|
|
5856
|
+
this.pipeTo = null;
|
|
5857
|
+
this.afterRead = afterRead.bind(this);
|
|
5858
|
+
this.afterUpdateNextTick = updateReadNT.bind(this);
|
|
5859
|
+
}
|
|
5860
|
+
get ended() {
|
|
5861
|
+
return (this.stream._duplexState & READ_DONE) !== 0;
|
|
5862
|
+
}
|
|
5863
|
+
pipe(pipeTo, cb) {
|
|
5864
|
+
if (this.pipeTo !== null) throw new Error("Can only pipe to one destination");
|
|
5865
|
+
if (typeof cb !== "function") cb = null;
|
|
5866
|
+
this.stream._duplexState |= READ_PIPE_DRAINED;
|
|
5867
|
+
this.pipeTo = pipeTo;
|
|
5868
|
+
this.pipeline = new Pipeline(this.stream, pipeTo, cb);
|
|
5869
|
+
if (cb) this.stream.on("error", noop);
|
|
5870
|
+
if (isStreamx(pipeTo)) {
|
|
5871
|
+
pipeTo._writableState.pipeline = this.pipeline;
|
|
5872
|
+
if (cb) pipeTo.on("error", noop);
|
|
5873
|
+
pipeTo.on("finish", this.pipeline.finished.bind(this.pipeline));
|
|
5874
|
+
} else {
|
|
5875
|
+
const onerror = this.pipeline.done.bind(this.pipeline, pipeTo);
|
|
5876
|
+
const onclose = this.pipeline.done.bind(this.pipeline, pipeTo, null);
|
|
5877
|
+
pipeTo.on("error", onerror);
|
|
5878
|
+
pipeTo.on("close", onclose);
|
|
5879
|
+
pipeTo.on("finish", this.pipeline.finished.bind(this.pipeline));
|
|
5880
|
+
}
|
|
5881
|
+
pipeTo.on("drain", afterDrain.bind(this));
|
|
5882
|
+
this.stream.emit("piping", pipeTo);
|
|
5883
|
+
pipeTo.emit("pipe", this.stream);
|
|
5884
|
+
}
|
|
5885
|
+
push(data) {
|
|
5886
|
+
const stream = this.stream;
|
|
5887
|
+
if (data === null) {
|
|
5888
|
+
this.highWaterMark = 0;
|
|
5889
|
+
stream._duplexState = (stream._duplexState | READ_ENDING) & READ_NON_PRIMARY_AND_PUSHED;
|
|
5890
|
+
return false;
|
|
5891
|
+
}
|
|
5892
|
+
if (this.map !== null) data = this.map(data);
|
|
5893
|
+
this.buffered += this.byteLength(data);
|
|
5894
|
+
this.queue.push(data);
|
|
5895
|
+
stream._duplexState = (stream._duplexState | READ_QUEUED) & READ_PUSHED;
|
|
5896
|
+
return this.buffered < this.highWaterMark;
|
|
5897
|
+
}
|
|
5898
|
+
shift() {
|
|
5899
|
+
const data = this.queue.shift();
|
|
5900
|
+
this.buffered -= this.byteLength(data);
|
|
5901
|
+
if (this.buffered === 0) this.stream._duplexState &= READ_NOT_QUEUED;
|
|
5902
|
+
return data;
|
|
5903
|
+
}
|
|
5904
|
+
unshift(data) {
|
|
5905
|
+
const pending = [this.map !== null ? this.map(data) : data];
|
|
5906
|
+
while (this.buffered > 0) pending.push(this.shift());
|
|
5907
|
+
for (let i = 0; i < pending.length - 1; i++) {
|
|
5908
|
+
const data2 = pending[i];
|
|
5909
|
+
this.buffered += this.byteLength(data2);
|
|
5910
|
+
this.queue.push(data2);
|
|
5911
|
+
}
|
|
5912
|
+
this.push(pending[pending.length - 1]);
|
|
5913
|
+
}
|
|
5914
|
+
read() {
|
|
5915
|
+
const stream = this.stream;
|
|
5916
|
+
if ((stream._duplexState & READ_STATUS) === READ_QUEUED) {
|
|
5917
|
+
const data = this.shift();
|
|
5918
|
+
if (this.pipeTo !== null && this.pipeTo.write(data) === false) stream._duplexState &= READ_PIPE_NOT_DRAINED;
|
|
5919
|
+
if ((stream._duplexState & READ_EMIT_DATA) !== 0) stream.emit("data", data);
|
|
5920
|
+
return data;
|
|
5921
|
+
}
|
|
5922
|
+
return null;
|
|
5923
|
+
}
|
|
5924
|
+
drain() {
|
|
5925
|
+
const stream = this.stream;
|
|
5926
|
+
while ((stream._duplexState & READ_STATUS) === READ_QUEUED && (stream._duplexState & READ_FLOWING) !== 0) {
|
|
5927
|
+
const data = this.shift();
|
|
5928
|
+
if (this.pipeTo !== null && this.pipeTo.write(data) === false) stream._duplexState &= READ_PIPE_NOT_DRAINED;
|
|
5929
|
+
if ((stream._duplexState & READ_EMIT_DATA) !== 0) stream.emit("data", data);
|
|
5930
|
+
}
|
|
5931
|
+
}
|
|
5932
|
+
update() {
|
|
5933
|
+
const stream = this.stream;
|
|
5934
|
+
stream._duplexState |= READ_UPDATING;
|
|
5935
|
+
do {
|
|
5936
|
+
this.drain();
|
|
5937
|
+
while (this.buffered < this.highWaterMark && (stream._duplexState & SHOULD_NOT_READ) === 0) {
|
|
5938
|
+
stream._duplexState |= READ_ACTIVE_AND_NEEDS_PUSH;
|
|
5939
|
+
stream._read(this.afterRead);
|
|
5940
|
+
this.drain();
|
|
5941
|
+
}
|
|
5942
|
+
if ((stream._duplexState & READ_READABLE_STATUS) === READ_EMIT_READABLE_AND_QUEUED) {
|
|
5943
|
+
stream._duplexState |= READ_EMITTED_READABLE;
|
|
5944
|
+
stream.emit("readable");
|
|
5945
|
+
}
|
|
5946
|
+
if ((stream._duplexState & READ_PRIMARY_AND_ACTIVE) === 0) this.updateNonPrimary();
|
|
5947
|
+
} while (this.continueUpdate() === true);
|
|
5948
|
+
stream._duplexState &= READ_NOT_UPDATING;
|
|
5949
|
+
}
|
|
5950
|
+
updateNonPrimary() {
|
|
5951
|
+
const stream = this.stream;
|
|
5952
|
+
if ((stream._duplexState & READ_ENDING_STATUS) === READ_ENDING) {
|
|
5953
|
+
stream._duplexState = (stream._duplexState | READ_DONE) & READ_NOT_ENDING;
|
|
5954
|
+
stream.emit("end");
|
|
5955
|
+
if ((stream._duplexState & AUTO_DESTROY) === DONE) stream._duplexState |= DESTROYING;
|
|
5956
|
+
if (this.pipeTo !== null) this.pipeTo.end();
|
|
5957
|
+
}
|
|
5958
|
+
if ((stream._duplexState & DESTROY_STATUS) === DESTROYING) {
|
|
5959
|
+
if ((stream._duplexState & ACTIVE_OR_TICKING) === 0) {
|
|
5960
|
+
stream._duplexState |= ACTIVE;
|
|
5961
|
+
stream._destroy(afterDestroy.bind(this));
|
|
5962
|
+
}
|
|
5963
|
+
return;
|
|
5964
|
+
}
|
|
5965
|
+
if ((stream._duplexState & IS_OPENING) === OPENING) {
|
|
5966
|
+
stream._duplexState = (stream._duplexState | ACTIVE) & NOT_OPENING;
|
|
5967
|
+
stream._open(afterOpen.bind(this));
|
|
5968
|
+
}
|
|
5969
|
+
}
|
|
5970
|
+
continueUpdate() {
|
|
5971
|
+
if ((this.stream._duplexState & READ_NEXT_TICK) === 0) return false;
|
|
5972
|
+
this.stream._duplexState &= READ_NOT_NEXT_TICK;
|
|
5973
|
+
return true;
|
|
5974
|
+
}
|
|
5975
|
+
updateCallback() {
|
|
5976
|
+
if ((this.stream._duplexState & READ_UPDATE_SYNC_STATUS) === READ_PRIMARY) this.update();
|
|
5977
|
+
else this.updateNextTick();
|
|
5978
|
+
}
|
|
5979
|
+
updateNextTick() {
|
|
5980
|
+
if ((this.stream._duplexState & READ_NEXT_TICK) !== 0) return;
|
|
5981
|
+
this.stream._duplexState |= READ_NEXT_TICK;
|
|
5982
|
+
if ((this.stream._duplexState & READ_UPDATING) === 0) queueTick(this.afterUpdateNextTick);
|
|
5983
|
+
}
|
|
5984
|
+
};
|
|
5985
|
+
var TransformState = class {
|
|
5986
|
+
constructor(stream) {
|
|
5987
|
+
this.data = null;
|
|
5988
|
+
this.afterTransform = afterTransform.bind(stream);
|
|
5989
|
+
this.afterFinal = null;
|
|
5990
|
+
}
|
|
5991
|
+
};
|
|
5992
|
+
var Pipeline = class {
|
|
5993
|
+
constructor(src, dst, cb) {
|
|
5994
|
+
this.from = src;
|
|
5995
|
+
this.to = dst;
|
|
5996
|
+
this.afterPipe = cb;
|
|
5997
|
+
this.error = null;
|
|
5998
|
+
this.pipeToFinished = false;
|
|
5999
|
+
}
|
|
6000
|
+
finished() {
|
|
6001
|
+
this.pipeToFinished = true;
|
|
6002
|
+
}
|
|
6003
|
+
done(stream, err) {
|
|
6004
|
+
if (err) this.error = err;
|
|
6005
|
+
if (stream === this.to) {
|
|
6006
|
+
this.to = null;
|
|
6007
|
+
if (this.from !== null) {
|
|
6008
|
+
if ((this.from._duplexState & READ_DONE) === 0 || !this.pipeToFinished) {
|
|
6009
|
+
this.from.destroy(this.error || new Error("Writable stream closed prematurely"));
|
|
6010
|
+
}
|
|
6011
|
+
return;
|
|
6012
|
+
}
|
|
6013
|
+
}
|
|
6014
|
+
if (stream === this.from) {
|
|
6015
|
+
this.from = null;
|
|
6016
|
+
if (this.to !== null) {
|
|
6017
|
+
if ((stream._duplexState & READ_DONE) === 0) {
|
|
6018
|
+
this.to.destroy(this.error || new Error("Readable stream closed before ending"));
|
|
6019
|
+
}
|
|
6020
|
+
return;
|
|
6021
|
+
}
|
|
6022
|
+
}
|
|
6023
|
+
if (this.afterPipe !== null) this.afterPipe(this.error);
|
|
6024
|
+
this.to = this.from = this.afterPipe = null;
|
|
6025
|
+
}
|
|
6026
|
+
};
|
|
6027
|
+
function afterDrain() {
|
|
6028
|
+
this.stream._duplexState |= READ_PIPE_DRAINED;
|
|
6029
|
+
this.updateCallback();
|
|
6030
|
+
}
|
|
6031
|
+
function afterFinal(err) {
|
|
6032
|
+
const stream = this.stream;
|
|
6033
|
+
if (err) stream.destroy(err);
|
|
6034
|
+
if ((stream._duplexState & DESTROY_STATUS) === 0) {
|
|
6035
|
+
stream._duplexState |= WRITE_DONE;
|
|
6036
|
+
stream.emit("finish");
|
|
6037
|
+
}
|
|
6038
|
+
if ((stream._duplexState & AUTO_DESTROY) === DONE) {
|
|
6039
|
+
stream._duplexState |= DESTROYING;
|
|
6040
|
+
}
|
|
6041
|
+
stream._duplexState &= WRITE_NOT_ACTIVE;
|
|
6042
|
+
if ((stream._duplexState & WRITE_UPDATING) === 0) this.update();
|
|
6043
|
+
else this.updateNextTick();
|
|
6044
|
+
}
|
|
6045
|
+
function afterDestroy(err) {
|
|
6046
|
+
const stream = this.stream;
|
|
6047
|
+
if (!err && this.error !== STREAM_DESTROYED) err = this.error;
|
|
6048
|
+
if (err) stream.emit("error", err);
|
|
6049
|
+
stream._duplexState |= DESTROYED;
|
|
6050
|
+
stream.emit("close");
|
|
6051
|
+
const rs = stream._readableState;
|
|
6052
|
+
const ws = stream._writableState;
|
|
6053
|
+
if (rs !== null && rs.pipeline !== null) rs.pipeline.done(stream, err);
|
|
6054
|
+
if (ws !== null) {
|
|
6055
|
+
while (ws.drains !== null && ws.drains.length > 0) ws.drains.shift().resolve(false);
|
|
6056
|
+
if (ws.pipeline !== null) ws.pipeline.done(stream, err);
|
|
6057
|
+
}
|
|
6058
|
+
}
|
|
6059
|
+
function afterWrite(err) {
|
|
6060
|
+
const stream = this.stream;
|
|
6061
|
+
if (err) stream.destroy(err);
|
|
6062
|
+
stream._duplexState &= WRITE_NOT_ACTIVE;
|
|
6063
|
+
if (this.drains !== null) tickDrains(this.drains);
|
|
6064
|
+
if ((stream._duplexState & WRITE_DRAIN_STATUS) === WRITE_UNDRAINED) {
|
|
6065
|
+
stream._duplexState &= WRITE_DRAINED;
|
|
6066
|
+
if ((stream._duplexState & WRITE_EMIT_DRAIN) === WRITE_EMIT_DRAIN) {
|
|
6067
|
+
stream.emit("drain");
|
|
6068
|
+
}
|
|
6069
|
+
}
|
|
6070
|
+
this.updateCallback();
|
|
6071
|
+
}
|
|
6072
|
+
function afterRead(err) {
|
|
6073
|
+
if (err) this.stream.destroy(err);
|
|
6074
|
+
this.stream._duplexState &= READ_NOT_ACTIVE;
|
|
6075
|
+
this.updateCallback();
|
|
6076
|
+
}
|
|
6077
|
+
function updateReadNT() {
|
|
6078
|
+
if ((this.stream._duplexState & READ_UPDATING) === 0) {
|
|
6079
|
+
this.stream._duplexState &= READ_NOT_NEXT_TICK;
|
|
6080
|
+
this.update();
|
|
6081
|
+
}
|
|
6082
|
+
}
|
|
6083
|
+
function updateWriteNT() {
|
|
6084
|
+
if ((this.stream._duplexState & WRITE_UPDATING) === 0) {
|
|
6085
|
+
this.stream._duplexState &= WRITE_NOT_NEXT_TICK;
|
|
6086
|
+
this.update();
|
|
6087
|
+
}
|
|
6088
|
+
}
|
|
6089
|
+
function tickDrains(drains) {
|
|
6090
|
+
for (let i = 0; i < drains.length; i++) {
|
|
6091
|
+
if (--drains[i].writes === 0) {
|
|
6092
|
+
drains.shift().resolve(true);
|
|
6093
|
+
i--;
|
|
6094
|
+
}
|
|
6095
|
+
}
|
|
6096
|
+
}
|
|
6097
|
+
function afterOpen(err) {
|
|
6098
|
+
const stream = this.stream;
|
|
6099
|
+
if (err) stream.destroy(err);
|
|
6100
|
+
if ((stream._duplexState & DESTROYING) === 0) {
|
|
6101
|
+
if ((stream._duplexState & READ_PRIMARY_STATUS) === 0) stream._duplexState |= READ_PRIMARY;
|
|
6102
|
+
if ((stream._duplexState & WRITE_PRIMARY_STATUS) === 0) stream._duplexState |= WRITE_PRIMARY;
|
|
6103
|
+
stream.emit("open");
|
|
6104
|
+
}
|
|
6105
|
+
stream._duplexState &= NOT_ACTIVE;
|
|
6106
|
+
if (stream._writableState !== null) {
|
|
6107
|
+
stream._writableState.updateCallback();
|
|
6108
|
+
}
|
|
6109
|
+
if (stream._readableState !== null) {
|
|
6110
|
+
stream._readableState.updateCallback();
|
|
6111
|
+
}
|
|
6112
|
+
}
|
|
6113
|
+
function afterTransform(err, data) {
|
|
6114
|
+
if (data !== void 0 && data !== null) this.push(data);
|
|
6115
|
+
this._writableState.afterWrite(err);
|
|
6116
|
+
}
|
|
6117
|
+
function newListener(name) {
|
|
6118
|
+
if (this._readableState !== null) {
|
|
6119
|
+
if (name === "data") {
|
|
6120
|
+
this._duplexState |= READ_EMIT_DATA | READ_RESUMED;
|
|
6121
|
+
this._readableState.updateNextTick();
|
|
6122
|
+
}
|
|
6123
|
+
if (name === "readable") {
|
|
6124
|
+
this._duplexState |= READ_EMIT_READABLE;
|
|
6125
|
+
this._readableState.updateNextTick();
|
|
6126
|
+
}
|
|
6127
|
+
}
|
|
6128
|
+
if (this._writableState !== null) {
|
|
6129
|
+
if (name === "drain") {
|
|
6130
|
+
this._duplexState |= WRITE_EMIT_DRAIN;
|
|
6131
|
+
this._writableState.updateNextTick();
|
|
6132
|
+
}
|
|
6133
|
+
}
|
|
6134
|
+
}
|
|
6135
|
+
var Stream = class extends EventEmitter {
|
|
6136
|
+
constructor(opts) {
|
|
6137
|
+
super();
|
|
6138
|
+
this._duplexState = 0;
|
|
6139
|
+
this._readableState = null;
|
|
6140
|
+
this._writableState = null;
|
|
6141
|
+
if (opts) {
|
|
6142
|
+
if (opts.open) this._open = opts.open;
|
|
6143
|
+
if (opts.destroy) this._destroy = opts.destroy;
|
|
6144
|
+
if (opts.predestroy) this._predestroy = opts.predestroy;
|
|
6145
|
+
if (opts.signal) {
|
|
6146
|
+
opts.signal.addEventListener("abort", abort.bind(this));
|
|
6147
|
+
}
|
|
6148
|
+
}
|
|
6149
|
+
this.on("newListener", newListener);
|
|
6150
|
+
}
|
|
6151
|
+
_open(cb) {
|
|
6152
|
+
cb(null);
|
|
6153
|
+
}
|
|
6154
|
+
_destroy(cb) {
|
|
6155
|
+
cb(null);
|
|
6156
|
+
}
|
|
6157
|
+
_predestroy() {
|
|
6158
|
+
}
|
|
6159
|
+
get readable() {
|
|
6160
|
+
return this._readableState !== null ? true : void 0;
|
|
6161
|
+
}
|
|
6162
|
+
get writable() {
|
|
6163
|
+
return this._writableState !== null ? true : void 0;
|
|
6164
|
+
}
|
|
6165
|
+
get destroyed() {
|
|
6166
|
+
return (this._duplexState & DESTROYED) !== 0;
|
|
6167
|
+
}
|
|
6168
|
+
get destroying() {
|
|
6169
|
+
return (this._duplexState & DESTROY_STATUS) !== 0;
|
|
6170
|
+
}
|
|
6171
|
+
destroy(err) {
|
|
6172
|
+
if ((this._duplexState & DESTROY_STATUS) === 0) {
|
|
6173
|
+
if (!err) err = STREAM_DESTROYED;
|
|
6174
|
+
this._duplexState = (this._duplexState | DESTROYING) & NON_PRIMARY;
|
|
6175
|
+
if (this._readableState !== null) {
|
|
6176
|
+
this._readableState.highWaterMark = 0;
|
|
6177
|
+
this._readableState.error = err;
|
|
6178
|
+
}
|
|
6179
|
+
if (this._writableState !== null) {
|
|
6180
|
+
this._writableState.highWaterMark = 0;
|
|
6181
|
+
this._writableState.error = err;
|
|
6182
|
+
}
|
|
6183
|
+
this._duplexState |= PREDESTROYING;
|
|
6184
|
+
this._predestroy();
|
|
6185
|
+
this._duplexState &= NOT_PREDESTROYING;
|
|
6186
|
+
if (this._readableState !== null) this._readableState.updateNextTick();
|
|
6187
|
+
if (this._writableState !== null) this._writableState.updateNextTick();
|
|
6188
|
+
}
|
|
6189
|
+
}
|
|
6190
|
+
};
|
|
6191
|
+
var Readable = class _Readable extends Stream {
|
|
6192
|
+
constructor(opts) {
|
|
6193
|
+
super(opts);
|
|
6194
|
+
this._duplexState |= OPENING | WRITE_DONE;
|
|
6195
|
+
this._readableState = new ReadableState(this, opts);
|
|
6196
|
+
if (opts) {
|
|
6197
|
+
if (opts.read) this._read = opts.read;
|
|
6198
|
+
if (opts.eagerOpen) this._readableState.updateNextTick();
|
|
6199
|
+
}
|
|
6200
|
+
}
|
|
6201
|
+
_read(cb) {
|
|
6202
|
+
cb(null);
|
|
6203
|
+
}
|
|
6204
|
+
pipe(dest, cb) {
|
|
6205
|
+
this._readableState.updateNextTick();
|
|
6206
|
+
this._readableState.pipe(dest, cb);
|
|
6207
|
+
return dest;
|
|
6208
|
+
}
|
|
6209
|
+
read() {
|
|
6210
|
+
this._readableState.updateNextTick();
|
|
6211
|
+
return this._readableState.read();
|
|
6212
|
+
}
|
|
6213
|
+
push(data) {
|
|
6214
|
+
this._readableState.updateNextTick();
|
|
6215
|
+
return this._readableState.push(data);
|
|
6216
|
+
}
|
|
6217
|
+
unshift(data) {
|
|
6218
|
+
this._readableState.updateNextTick();
|
|
6219
|
+
return this._readableState.unshift(data);
|
|
6220
|
+
}
|
|
6221
|
+
resume() {
|
|
6222
|
+
this._duplexState |= READ_RESUMED;
|
|
6223
|
+
this._readableState.updateNextTick();
|
|
6224
|
+
return this;
|
|
6225
|
+
}
|
|
6226
|
+
pause() {
|
|
6227
|
+
this._duplexState &= READ_PAUSED;
|
|
6228
|
+
return this;
|
|
6229
|
+
}
|
|
6230
|
+
static _fromAsyncIterator(ite, opts) {
|
|
6231
|
+
let destroy;
|
|
6232
|
+
const rs = new _Readable({
|
|
6233
|
+
...opts,
|
|
6234
|
+
read(cb) {
|
|
6235
|
+
ite.next().then(push).then(cb.bind(null, null)).catch(cb);
|
|
6236
|
+
},
|
|
6237
|
+
predestroy() {
|
|
6238
|
+
destroy = ite.return();
|
|
6239
|
+
},
|
|
6240
|
+
destroy(cb) {
|
|
6241
|
+
if (!destroy) return cb(null);
|
|
6242
|
+
destroy.then(cb.bind(null, null)).catch(cb);
|
|
6243
|
+
}
|
|
6244
|
+
});
|
|
6245
|
+
return rs;
|
|
6246
|
+
function push(data) {
|
|
6247
|
+
if (data.done) rs.push(null);
|
|
6248
|
+
else rs.push(data.value);
|
|
6249
|
+
}
|
|
6250
|
+
}
|
|
6251
|
+
static from(data, opts) {
|
|
6252
|
+
if (isReadStreamx(data)) return data;
|
|
6253
|
+
if (data[asyncIterator]) return this._fromAsyncIterator(data[asyncIterator](), opts);
|
|
6254
|
+
if (!Array.isArray(data)) data = data === void 0 ? [] : [data];
|
|
6255
|
+
let i = 0;
|
|
6256
|
+
return new _Readable({
|
|
6257
|
+
...opts,
|
|
6258
|
+
read(cb) {
|
|
6259
|
+
this.push(i === data.length ? null : data[i++]);
|
|
6260
|
+
cb(null);
|
|
6261
|
+
}
|
|
6262
|
+
});
|
|
6263
|
+
}
|
|
6264
|
+
static isBackpressured(rs) {
|
|
6265
|
+
return (rs._duplexState & READ_BACKPRESSURE_STATUS) !== 0 || rs._readableState.buffered >= rs._readableState.highWaterMark;
|
|
6266
|
+
}
|
|
6267
|
+
static isPaused(rs) {
|
|
6268
|
+
return (rs._duplexState & READ_RESUMED) === 0;
|
|
6269
|
+
}
|
|
6270
|
+
[asyncIterator]() {
|
|
6271
|
+
const stream = this;
|
|
6272
|
+
let error = null;
|
|
6273
|
+
let promiseResolve = null;
|
|
6274
|
+
let promiseReject = null;
|
|
6275
|
+
this.on("error", (err) => {
|
|
6276
|
+
error = err;
|
|
6277
|
+
});
|
|
6278
|
+
this.on("readable", onreadable);
|
|
6279
|
+
this.on("close", onclose);
|
|
6280
|
+
return {
|
|
6281
|
+
[asyncIterator]() {
|
|
6282
|
+
return this;
|
|
6283
|
+
},
|
|
6284
|
+
next() {
|
|
6285
|
+
return new Promise(function(resolve, reject) {
|
|
6286
|
+
promiseResolve = resolve;
|
|
6287
|
+
promiseReject = reject;
|
|
6288
|
+
const data = stream.read();
|
|
6289
|
+
if (data !== null) ondata(data);
|
|
6290
|
+
else if ((stream._duplexState & DESTROYED) !== 0) ondata(null);
|
|
6291
|
+
});
|
|
6292
|
+
},
|
|
6293
|
+
return() {
|
|
6294
|
+
return destroy(null);
|
|
6295
|
+
},
|
|
6296
|
+
throw(err) {
|
|
6297
|
+
return destroy(err);
|
|
6298
|
+
}
|
|
6299
|
+
};
|
|
6300
|
+
function onreadable() {
|
|
6301
|
+
if (promiseResolve !== null) ondata(stream.read());
|
|
6302
|
+
}
|
|
6303
|
+
function onclose() {
|
|
6304
|
+
if (promiseResolve !== null) ondata(null);
|
|
6305
|
+
}
|
|
6306
|
+
function ondata(data) {
|
|
6307
|
+
if (promiseReject === null) return;
|
|
6308
|
+
if (error) promiseReject(error);
|
|
6309
|
+
else if (data === null && (stream._duplexState & READ_DONE) === 0) promiseReject(STREAM_DESTROYED);
|
|
6310
|
+
else promiseResolve({ value: data, done: data === null });
|
|
6311
|
+
promiseReject = promiseResolve = null;
|
|
6312
|
+
}
|
|
6313
|
+
function destroy(err) {
|
|
6314
|
+
stream.destroy(err);
|
|
6315
|
+
return new Promise((resolve, reject) => {
|
|
6316
|
+
if (stream._duplexState & DESTROYED) return resolve({ value: void 0, done: true });
|
|
6317
|
+
stream.once("close", function() {
|
|
6318
|
+
if (err) reject(err);
|
|
6319
|
+
else resolve({ value: void 0, done: true });
|
|
6320
|
+
});
|
|
6321
|
+
});
|
|
6322
|
+
}
|
|
6323
|
+
}
|
|
6324
|
+
};
|
|
6325
|
+
var Writable = class extends Stream {
|
|
6326
|
+
constructor(opts) {
|
|
6327
|
+
super(opts);
|
|
6328
|
+
this._duplexState |= OPENING | READ_DONE;
|
|
6329
|
+
this._writableState = new WritableState(this, opts);
|
|
6330
|
+
if (opts) {
|
|
6331
|
+
if (opts.writev) this._writev = opts.writev;
|
|
6332
|
+
if (opts.write) this._write = opts.write;
|
|
6333
|
+
if (opts.final) this._final = opts.final;
|
|
6334
|
+
if (opts.eagerOpen) this._writableState.updateNextTick();
|
|
6335
|
+
}
|
|
6336
|
+
}
|
|
6337
|
+
_writev(batch, cb) {
|
|
6338
|
+
cb(null);
|
|
6339
|
+
}
|
|
6340
|
+
_write(data, cb) {
|
|
6341
|
+
this._writableState.autoBatch(data, cb);
|
|
6342
|
+
}
|
|
6343
|
+
_final(cb) {
|
|
6344
|
+
cb(null);
|
|
6345
|
+
}
|
|
6346
|
+
static isBackpressured(ws) {
|
|
6347
|
+
return (ws._duplexState & WRITE_BACKPRESSURE_STATUS) !== 0;
|
|
6348
|
+
}
|
|
6349
|
+
static drained(ws) {
|
|
6350
|
+
if (ws.destroyed) return Promise.resolve(false);
|
|
6351
|
+
const state = ws._writableState;
|
|
6352
|
+
const pending = isWritev(ws) ? Math.min(1, state.queue.length) : state.queue.length;
|
|
6353
|
+
const writes = pending + (ws._duplexState & WRITE_WRITING ? 1 : 0);
|
|
6354
|
+
if (writes === 0) return Promise.resolve(true);
|
|
6355
|
+
if (state.drains === null) state.drains = [];
|
|
6356
|
+
return new Promise((resolve) => {
|
|
6357
|
+
state.drains.push({ writes, resolve });
|
|
6358
|
+
});
|
|
6359
|
+
}
|
|
6360
|
+
write(data) {
|
|
6361
|
+
this._writableState.updateNextTick();
|
|
6362
|
+
return this._writableState.push(data);
|
|
6363
|
+
}
|
|
6364
|
+
end(data) {
|
|
6365
|
+
this._writableState.updateNextTick();
|
|
6366
|
+
this._writableState.end(data);
|
|
6367
|
+
return this;
|
|
6368
|
+
}
|
|
6369
|
+
};
|
|
6370
|
+
var Duplex = class extends Readable {
|
|
6371
|
+
// and Writable
|
|
6372
|
+
constructor(opts) {
|
|
6373
|
+
super(opts);
|
|
6374
|
+
this._duplexState = OPENING;
|
|
6375
|
+
this._writableState = new WritableState(this, opts);
|
|
6376
|
+
if (opts) {
|
|
6377
|
+
if (opts.writev) this._writev = opts.writev;
|
|
6378
|
+
if (opts.write) this._write = opts.write;
|
|
6379
|
+
if (opts.final) this._final = opts.final;
|
|
6380
|
+
}
|
|
6381
|
+
}
|
|
6382
|
+
_writev(batch, cb) {
|
|
6383
|
+
cb(null);
|
|
6384
|
+
}
|
|
6385
|
+
_write(data, cb) {
|
|
6386
|
+
this._writableState.autoBatch(data, cb);
|
|
6387
|
+
}
|
|
6388
|
+
_final(cb) {
|
|
6389
|
+
cb(null);
|
|
6390
|
+
}
|
|
6391
|
+
write(data) {
|
|
6392
|
+
this._writableState.updateNextTick();
|
|
6393
|
+
return this._writableState.push(data);
|
|
6394
|
+
}
|
|
6395
|
+
end(data) {
|
|
6396
|
+
this._writableState.updateNextTick();
|
|
6397
|
+
this._writableState.end(data);
|
|
6398
|
+
return this;
|
|
6399
|
+
}
|
|
6400
|
+
};
|
|
6401
|
+
var Transform = class extends Duplex {
|
|
6402
|
+
constructor(opts) {
|
|
6403
|
+
super(opts);
|
|
6404
|
+
this._transformState = new TransformState(this);
|
|
6405
|
+
if (opts) {
|
|
6406
|
+
if (opts.transform) this._transform = opts.transform;
|
|
6407
|
+
if (opts.flush) this._flush = opts.flush;
|
|
6408
|
+
}
|
|
6409
|
+
}
|
|
6410
|
+
_write(data, cb) {
|
|
6411
|
+
if (this._readableState.buffered >= this._readableState.highWaterMark) {
|
|
6412
|
+
this._transformState.data = data;
|
|
6413
|
+
} else {
|
|
6414
|
+
this._transform(data, this._transformState.afterTransform);
|
|
6415
|
+
}
|
|
6416
|
+
}
|
|
6417
|
+
_read(cb) {
|
|
6418
|
+
if (this._transformState.data !== null) {
|
|
6419
|
+
const data = this._transformState.data;
|
|
6420
|
+
this._transformState.data = null;
|
|
6421
|
+
cb(null);
|
|
6422
|
+
this._transform(data, this._transformState.afterTransform);
|
|
6423
|
+
} else {
|
|
6424
|
+
cb(null);
|
|
6425
|
+
}
|
|
6426
|
+
}
|
|
6427
|
+
destroy(err) {
|
|
6428
|
+
super.destroy(err);
|
|
6429
|
+
if (this._transformState.data !== null) {
|
|
6430
|
+
this._transformState.data = null;
|
|
6431
|
+
this._transformState.afterTransform();
|
|
6432
|
+
}
|
|
6433
|
+
}
|
|
6434
|
+
_transform(data, cb) {
|
|
6435
|
+
cb(null, data);
|
|
6436
|
+
}
|
|
6437
|
+
_flush(cb) {
|
|
6438
|
+
cb(null);
|
|
6439
|
+
}
|
|
6440
|
+
_final(cb) {
|
|
6441
|
+
this._transformState.afterFinal = cb;
|
|
6442
|
+
this._flush(transformAfterFlush.bind(this));
|
|
6443
|
+
}
|
|
6444
|
+
};
|
|
6445
|
+
var PassThrough = class extends Transform {
|
|
6446
|
+
};
|
|
6447
|
+
function transformAfterFlush(err, data) {
|
|
6448
|
+
const cb = this._transformState.afterFinal;
|
|
6449
|
+
if (err) return cb(err);
|
|
6450
|
+
if (data !== null && data !== void 0) this.push(data);
|
|
6451
|
+
this.push(null);
|
|
6452
|
+
cb(null);
|
|
6453
|
+
}
|
|
6454
|
+
function pipelinePromise(...streams) {
|
|
6455
|
+
return new Promise((resolve, reject) => {
|
|
6456
|
+
return pipeline(...streams, (err) => {
|
|
6457
|
+
if (err) return reject(err);
|
|
6458
|
+
resolve();
|
|
6459
|
+
});
|
|
6460
|
+
});
|
|
6461
|
+
}
|
|
6462
|
+
function pipeline(stream, ...streams) {
|
|
6463
|
+
const all = Array.isArray(stream) ? [...stream, ...streams] : [stream, ...streams];
|
|
6464
|
+
const done = all.length && typeof all[all.length - 1] === "function" ? all.pop() : null;
|
|
6465
|
+
if (all.length < 2) throw new Error("Pipeline requires at least 2 streams");
|
|
6466
|
+
let src = all[0];
|
|
6467
|
+
let dest = null;
|
|
6468
|
+
let error = null;
|
|
6469
|
+
for (let i = 1; i < all.length; i++) {
|
|
6470
|
+
dest = all[i];
|
|
6471
|
+
if (isStreamx(src)) {
|
|
6472
|
+
src.pipe(dest, onerror);
|
|
6473
|
+
} else {
|
|
6474
|
+
errorHandle(src, true, i > 1, onerror);
|
|
6475
|
+
src.pipe(dest);
|
|
6476
|
+
}
|
|
6477
|
+
src = dest;
|
|
6478
|
+
}
|
|
6479
|
+
if (done) {
|
|
6480
|
+
let fin = false;
|
|
6481
|
+
const autoDestroy = isStreamx(dest) || !!(dest._writableState && dest._writableState.autoDestroy);
|
|
6482
|
+
dest.on("error", (err) => {
|
|
6483
|
+
if (error === null) error = err;
|
|
6484
|
+
});
|
|
6485
|
+
dest.on("finish", () => {
|
|
6486
|
+
fin = true;
|
|
6487
|
+
if (!autoDestroy) done(error);
|
|
6488
|
+
});
|
|
6489
|
+
if (autoDestroy) {
|
|
6490
|
+
dest.on("close", () => done(error || (fin ? null : PREMATURE_CLOSE)));
|
|
6491
|
+
}
|
|
6492
|
+
}
|
|
6493
|
+
return dest;
|
|
6494
|
+
function errorHandle(s, rd, wr, onerror2) {
|
|
6495
|
+
s.on("error", onerror2);
|
|
6496
|
+
s.on("close", onclose);
|
|
6497
|
+
function onclose() {
|
|
6498
|
+
if (rd && s._readableState && !s._readableState.ended) return onerror2(PREMATURE_CLOSE);
|
|
6499
|
+
if (wr && s._writableState && !s._writableState.ended) return onerror2(PREMATURE_CLOSE);
|
|
6500
|
+
}
|
|
6501
|
+
}
|
|
6502
|
+
function onerror(err) {
|
|
6503
|
+
if (!err || error) return;
|
|
6504
|
+
error = err;
|
|
6505
|
+
for (const s of all) {
|
|
6506
|
+
s.destroy(err);
|
|
6507
|
+
}
|
|
6508
|
+
}
|
|
6509
|
+
}
|
|
6510
|
+
function isStream(stream) {
|
|
6511
|
+
return !!stream._readableState || !!stream._writableState;
|
|
6512
|
+
}
|
|
6513
|
+
function isStreamx(stream) {
|
|
6514
|
+
return typeof stream._duplexState === "number" && isStream(stream);
|
|
6515
|
+
}
|
|
6516
|
+
function getStreamError(stream) {
|
|
6517
|
+
const err = stream._readableState && stream._readableState.error || stream._writableState && stream._writableState.error;
|
|
6518
|
+
return err === STREAM_DESTROYED ? null : err;
|
|
6519
|
+
}
|
|
6520
|
+
function isReadStreamx(stream) {
|
|
6521
|
+
return isStreamx(stream) && stream.readable;
|
|
6522
|
+
}
|
|
6523
|
+
function isTypedArray(data) {
|
|
6524
|
+
return typeof data === "object" && data !== null && typeof data.byteLength === "number";
|
|
6525
|
+
}
|
|
6526
|
+
function defaultByteLength(data) {
|
|
6527
|
+
return isTypedArray(data) ? data.byteLength : 1024;
|
|
6528
|
+
}
|
|
6529
|
+
function noop() {
|
|
6530
|
+
}
|
|
6531
|
+
function abort() {
|
|
6532
|
+
this.destroy(new Error("Stream aborted."));
|
|
6533
|
+
}
|
|
6534
|
+
function isWritev(s) {
|
|
6535
|
+
return s._writev !== Writable.prototype._writev && s._writev !== Duplex.prototype._writev;
|
|
6536
|
+
}
|
|
6537
|
+
module.exports = {
|
|
6538
|
+
pipeline,
|
|
6539
|
+
pipelinePromise,
|
|
6540
|
+
isStream,
|
|
6541
|
+
isStreamx,
|
|
6542
|
+
getStreamError,
|
|
6543
|
+
Stream,
|
|
6544
|
+
Writable,
|
|
6545
|
+
Readable,
|
|
6546
|
+
Duplex,
|
|
6547
|
+
Transform,
|
|
6548
|
+
// Export PassThrough for compatibility with Node.js core's stream module
|
|
6549
|
+
PassThrough
|
|
6550
|
+
};
|
|
6551
|
+
}
|
|
6552
|
+
});
|
|
6553
|
+
|
|
6660
6554
|
// ../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js
|
|
6661
6555
|
var require_ms = __commonJS({
|
|
6662
6556
|
"../../node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js"(exports, module) {
|
|
@@ -6773,9 +6667,9 @@ var require_ms = __commonJS({
|
|
|
6773
6667
|
}
|
|
6774
6668
|
});
|
|
6775
6669
|
|
|
6776
|
-
// ../../node_modules/.pnpm/debug@4.4.
|
|
6670
|
+
// ../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js
|
|
6777
6671
|
var require_common = __commonJS({
|
|
6778
|
-
"../../node_modules/.pnpm/debug@4.4.
|
|
6672
|
+
"../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js"(exports, module) {
|
|
6779
6673
|
function setup(env) {
|
|
6780
6674
|
createDebug.debug = createDebug;
|
|
6781
6675
|
createDebug.default = createDebug;
|
|
@@ -6950,9 +6844,9 @@ var require_common = __commonJS({
|
|
|
6950
6844
|
}
|
|
6951
6845
|
});
|
|
6952
6846
|
|
|
6953
|
-
// ../../node_modules/.pnpm/debug@4.4.
|
|
6847
|
+
// ../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js
|
|
6954
6848
|
var require_browser5 = __commonJS({
|
|
6955
|
-
"../../node_modules/.pnpm/debug@4.4.
|
|
6849
|
+
"../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js"(exports, module) {
|
|
6956
6850
|
exports.formatArgs = formatArgs;
|
|
6957
6851
|
exports.save = save;
|
|
6958
6852
|
exports.load = load;
|
|
@@ -7126,11 +7020,11 @@ var require_hypercore_protocol = __commonJS({
|
|
|
7126
7020
|
var SHP = require_simple_hypercore_protocol();
|
|
7127
7021
|
var crypto = require_hypercore_crypto();
|
|
7128
7022
|
var timeout = require_browser4();
|
|
7129
|
-
var inspect =
|
|
7023
|
+
var inspect = require_browser2();
|
|
7130
7024
|
var Nanoguard = require_nanoguard();
|
|
7131
7025
|
var pretty = require_pretty_hash();
|
|
7132
7026
|
var Message = require_abstract_extension();
|
|
7133
|
-
var { Duplex } =
|
|
7027
|
+
var { Duplex } = require_streamx();
|
|
7134
7028
|
var debug = require_browser5()("hypercore-protocol");
|
|
7135
7029
|
var StreamExtension = class extends Message {
|
|
7136
7030
|
send(message) {
|
|
@@ -8588,7 +8482,7 @@ var require_replicate = __commonJS({
|
|
|
8588
8482
|
// ../../node_modules/.pnpm/nanoresource@1.3.0/node_modules/nanoresource/emitter.js
|
|
8589
8483
|
var require_emitter = __commonJS({
|
|
8590
8484
|
"../../node_modules/.pnpm/nanoresource@1.3.0/node_modules/nanoresource/emitter.js"(exports, module) {
|
|
8591
|
-
var events = import$_dxos_node_std_events;
|
|
8485
|
+
var events = import$d$_dxos_node_std_events;
|
|
8592
8486
|
var inherits = require_inherits_browser();
|
|
8593
8487
|
var opening = Symbol("opening queue");
|
|
8594
8488
|
var preclosing = Symbol("closing when inactive");
|
|
@@ -8720,7 +8614,7 @@ var require_empty = __commonJS({
|
|
|
8720
8614
|
// ../../node_modules/.pnpm/hypercore-streams@1.0.1/node_modules/hypercore-streams/index.js
|
|
8721
8615
|
var require_hypercore_streams = __commonJS({
|
|
8722
8616
|
"../../node_modules/.pnpm/hypercore-streams@1.0.1/node_modules/hypercore-streams/index.js"(exports, module) {
|
|
8723
|
-
var { Writable, Readable } =
|
|
8617
|
+
var { Writable, Readable } = require_streamx();
|
|
8724
8618
|
var WriteStream = class extends Writable {
|
|
8725
8619
|
constructor(feed, opts) {
|
|
8726
8620
|
super();
|
|
@@ -8804,7 +8698,7 @@ var require_hypercore = __commonJS({
|
|
|
8804
8698
|
var treeIndex = require_tree_index();
|
|
8805
8699
|
var storage = require_storage();
|
|
8806
8700
|
var crypto = require_hypercore_crypto();
|
|
8807
|
-
var inspect =
|
|
8701
|
+
var inspect = require_browser2();
|
|
8808
8702
|
var pretty = require_pretty_hash();
|
|
8809
8703
|
var Nanoguard = require_nanoguard();
|
|
8810
8704
|
var safeBufferEquals = require_safe_buffer_equals();
|