@gardenfi/core 0.2.0-beta.57 → 0.2.0-beta.59
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/index.cjs +8 -8
- package/dist/index.js +638 -604
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var $s = Object.defineProperty;
|
|
2
2
|
var Hs = (e, t, r) => t in e ? $s(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var pt = (e, t, r) => Hs(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
-
import { Ok as fe, Err as
|
|
4
|
+
import { Ok as fe, Err as N, Fetcher as mt, trim0x as nt } from "@catalogfi/utils";
|
|
5
5
|
import { EthereumLocalnet as zs, ArbitrumLocalnet as Gs, Orderbook as js, isMainnet as rr, isBitcoin as nr, getBlockchainType as Lt, BlockchainType as ke } from "@gardenfi/orderbook";
|
|
6
6
|
import { Url as pn, fetchEVMBlockNumber as Zr, with0x as fr, checkAllowanceAndApprove as Ws, Authorization as Cn, sleep as qs, fetchBitcoinBlockNumber as Ln } from "@gardenfi/utils";
|
|
7
7
|
import { createWalletClient as kn, custom as Fn, getContract as Vs, sha256 as ir } from "viem";
|
|
8
8
|
import * as Un from "varuint-bitcoin";
|
|
9
9
|
import * as xt from "tiny-secp256k1";
|
|
10
10
|
import { Urgency as On } from "@catalogfi/wallets";
|
|
11
|
-
import * as
|
|
11
|
+
import * as ye from "bitcoinjs-lib";
|
|
12
12
|
import { crypto as Ks } from "bitcoinjs-lib";
|
|
13
13
|
import Ys from "bignumber.js";
|
|
14
|
-
var en = /* @__PURE__ */ ((e) => (e[e.evm = 14400] = "evm", e[e.btc = 288] = "btc", e))(en || {}),
|
|
14
|
+
var en = /* @__PURE__ */ ((e) => (e[e.evm = 14400] = "evm", e[e.btc = 288] = "btc", e))(en || {}), ce = /* @__PURE__ */ ((e) => (e.Idle = "Idle", e.Initiate = "Initiate", e.Redeem = "Redeem", e.Refund = "Refund", e))(ce || {});
|
|
15
15
|
function qt(e) {
|
|
16
16
|
return {
|
|
17
17
|
formatters: void 0,
|
|
@@ -188,7 +188,7 @@ function oo(e, t = {}) {
|
|
|
188
188
|
const r = new Uint8Array(1);
|
|
189
189
|
return r[0] = Number(e), typeof t.size == "number" ? (At(r, { size: t.size }), It(r, { size: t.size })) : r;
|
|
190
190
|
}
|
|
191
|
-
const
|
|
191
|
+
const Me = {
|
|
192
192
|
zero: 48,
|
|
193
193
|
nine: 57,
|
|
194
194
|
A: 65,
|
|
@@ -196,13 +196,13 @@ const Ne = {
|
|
|
196
196
|
a: 97,
|
|
197
197
|
f: 102
|
|
198
198
|
};
|
|
199
|
-
function
|
|
200
|
-
if (e >=
|
|
201
|
-
return e -
|
|
202
|
-
if (e >=
|
|
203
|
-
return e - (
|
|
204
|
-
if (e >=
|
|
205
|
-
return e - (
|
|
199
|
+
function Nn(e) {
|
|
200
|
+
if (e >= Me.zero && e <= Me.nine)
|
|
201
|
+
return e - Me.zero;
|
|
202
|
+
if (e >= Me.A && e <= Me.F)
|
|
203
|
+
return e - (Me.A - 10);
|
|
204
|
+
if (e >= Me.a && e <= Me.f)
|
|
205
|
+
return e - (Me.a - 10);
|
|
206
206
|
}
|
|
207
207
|
function st(e, t = {}) {
|
|
208
208
|
let r = e;
|
|
@@ -211,10 +211,10 @@ function st(e, t = {}) {
|
|
|
211
211
|
n.length % 2 && (n = `0${n}`);
|
|
212
212
|
const i = n.length / 2, a = new Uint8Array(i);
|
|
213
213
|
for (let f = 0, u = 0; f < i; f++) {
|
|
214
|
-
const l =
|
|
215
|
-
if (l === void 0 ||
|
|
214
|
+
const l = Nn(n.charCodeAt(u++)), b = Nn(n.charCodeAt(u++));
|
|
215
|
+
if (l === void 0 || b === void 0)
|
|
216
216
|
throw new X(`Invalid byte sequence ("${n[u - 2]}${n[u - 1]}" in "${n}").`);
|
|
217
|
-
a[f] = l * 16 +
|
|
217
|
+
a[f] = l * 16 + b;
|
|
218
218
|
}
|
|
219
219
|
return a;
|
|
220
220
|
}
|
|
@@ -368,7 +368,7 @@ const yo = /* @__PURE__ */ bn("transactionReceipt", bo), gn = 2n ** 256n - 1n;
|
|
|
368
368
|
function Kt(e) {
|
|
369
369
|
return `0x${e.reduce((t, r) => t + r.replace("0x", ""), "")}`;
|
|
370
370
|
}
|
|
371
|
-
class
|
|
371
|
+
class Mn extends X {
|
|
372
372
|
constructor({ offset: t }) {
|
|
373
373
|
super(`Offset \`${t}\` cannot be negative.`, {
|
|
374
374
|
name: "NegativeOffsetError"
|
|
@@ -408,7 +408,7 @@ const wo = {
|
|
|
408
408
|
},
|
|
409
409
|
decrementPosition(e) {
|
|
410
410
|
if (e < 0)
|
|
411
|
-
throw new
|
|
411
|
+
throw new Mn({ offset: e });
|
|
412
412
|
const t = this.position - e;
|
|
413
413
|
this.assertPosition(t), this.position = t;
|
|
414
414
|
},
|
|
@@ -417,7 +417,7 @@ const wo = {
|
|
|
417
417
|
},
|
|
418
418
|
incrementPosition(e) {
|
|
419
419
|
if (e < 0)
|
|
420
|
-
throw new
|
|
420
|
+
throw new Mn({ offset: e });
|
|
421
421
|
const t = this.position + e;
|
|
422
422
|
this.assertPosition(t), this.position = t;
|
|
423
423
|
},
|
|
@@ -610,7 +610,7 @@ function Oi(e) {
|
|
|
610
610
|
i.push(Uint8Array.from(t.blobToKzgCommitment(a)));
|
|
611
611
|
return r === "bytes" ? i : i.map((a) => Qe(a));
|
|
612
612
|
}
|
|
613
|
-
function
|
|
613
|
+
function Ni(e) {
|
|
614
614
|
const { kzg: t } = e, r = e.to ?? (typeof e.blobs[0] == "string" ? "hex" : "bytes"), n = typeof e.blobs[0] == "string" ? e.blobs.map((f) => st(f)) : e.blobs, i = typeof e.commitments[0] == "string" ? e.commitments.map((f) => st(f)) : e.commitments, a = [];
|
|
615
615
|
for (let f = 0; f < n.length; f++) {
|
|
616
616
|
const u = n[f], l = i[f];
|
|
@@ -637,7 +637,7 @@ function dr(e, t = !0) {
|
|
|
637
637
|
if (t && e.finished)
|
|
638
638
|
throw new Error("Hash#digest() has already been called");
|
|
639
639
|
}
|
|
640
|
-
function
|
|
640
|
+
function Mi(e, t) {
|
|
641
641
|
mn(e);
|
|
642
642
|
const r = t.outputLen;
|
|
643
643
|
if (e.length < r)
|
|
@@ -670,8 +670,8 @@ function $i(e) {
|
|
|
670
670
|
function Lo(e, t, r, n) {
|
|
671
671
|
if (typeof e.setBigUint64 == "function")
|
|
672
672
|
return e.setBigUint64(t, r, n);
|
|
673
|
-
const i = BigInt(32), a = BigInt(4294967295), f = Number(r >> i & a), u = Number(r & a), l = n ? 4 : 0,
|
|
674
|
-
e.setUint32(t + l, f, n), e.setUint32(t +
|
|
673
|
+
const i = BigInt(32), a = BigInt(4294967295), f = Number(r >> i & a), u = Number(r & a), l = n ? 4 : 0, b = n ? 0 : 4;
|
|
674
|
+
e.setUint32(t + l, f, n), e.setUint32(t + b, u, n);
|
|
675
675
|
}
|
|
676
676
|
const ko = (e, t, r) => e & t ^ ~e & r, Fo = (e, t, r) => e & t ^ e & r ^ t & r;
|
|
677
677
|
class Uo extends Di {
|
|
@@ -696,21 +696,21 @@ class Uo extends Di {
|
|
|
696
696
|
return this.length += t.length, this.roundClean(), this;
|
|
697
697
|
}
|
|
698
698
|
digestInto(t) {
|
|
699
|
-
dr(this),
|
|
699
|
+
dr(this), Mi(t, this), this.finished = !0;
|
|
700
700
|
const { buffer: r, view: n, blockLen: i, isLE: a } = this;
|
|
701
701
|
let { pos: f } = this;
|
|
702
702
|
r[f++] = 128, this.buffer.subarray(f).fill(0), this.padOffset > i - f && (this.process(n, 0), f = 0);
|
|
703
|
-
for (let
|
|
704
|
-
r[
|
|
703
|
+
for (let m = f; m < i; m++)
|
|
704
|
+
r[m] = 0;
|
|
705
705
|
Lo(n, i - 8, BigInt(this.length * 8), a), this.process(n, 0);
|
|
706
706
|
const u = Fr(t), l = this.outputLen;
|
|
707
707
|
if (l % 4)
|
|
708
708
|
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
709
|
-
const
|
|
710
|
-
if (
|
|
709
|
+
const b = l / 4, g = this.get();
|
|
710
|
+
if (b > g.length)
|
|
711
711
|
throw new Error("_sha2: outputLen bigger than state");
|
|
712
|
-
for (let
|
|
713
|
-
u.setUint32(4 *
|
|
712
|
+
for (let m = 0; m < b; m++)
|
|
713
|
+
u.setUint32(4 * m, g[m], a);
|
|
714
714
|
}
|
|
715
715
|
digest() {
|
|
716
716
|
const { buffer: t, outputLen: r } = this;
|
|
@@ -799,7 +799,7 @@ const Oo = /* @__PURE__ */ new Uint32Array([
|
|
|
799
799
|
528734635,
|
|
800
800
|
1541459225
|
|
801
801
|
]), Ye = /* @__PURE__ */ new Uint32Array(64);
|
|
802
|
-
class
|
|
802
|
+
class No extends Uo {
|
|
803
803
|
constructor() {
|
|
804
804
|
super(64, 32, 8, !1), this.A = Ke[0] | 0, this.B = Ke[1] | 0, this.C = Ke[2] | 0, this.D = Ke[3] | 0, this.E = Ke[4] | 0, this.F = Ke[5] | 0, this.G = Ke[6] | 0, this.H = Ke[7] | 0;
|
|
805
805
|
}
|
|
@@ -812,18 +812,18 @@ class Mo extends Uo {
|
|
|
812
812
|
this.A = t | 0, this.B = r | 0, this.C = n | 0, this.D = i | 0, this.E = a | 0, this.F = f | 0, this.G = u | 0, this.H = l | 0;
|
|
813
813
|
}
|
|
814
814
|
process(t, r) {
|
|
815
|
-
for (let
|
|
816
|
-
Ye[
|
|
817
|
-
for (let
|
|
818
|
-
const E = Ye[
|
|
819
|
-
Ye[
|
|
815
|
+
for (let m = 0; m < 16; m++, r += 4)
|
|
816
|
+
Ye[m] = t.getUint32(r, !1);
|
|
817
|
+
for (let m = 16; m < 64; m++) {
|
|
818
|
+
const E = Ye[m - 15], I = Ye[m - 2], v = Fe(E, 7) ^ Fe(E, 18) ^ E >>> 3, P = Fe(I, 17) ^ Fe(I, 19) ^ I >>> 10;
|
|
819
|
+
Ye[m] = P + Ye[m - 7] + v + Ye[m - 16] | 0;
|
|
820
820
|
}
|
|
821
|
-
let { A: n, B: i, C: a, D: f, E: u, F: l, G:
|
|
822
|
-
for (let
|
|
823
|
-
const E = Fe(u, 6) ^ Fe(u, 11) ^ Fe(u, 25), I = g + E + ko(u, l,
|
|
824
|
-
g =
|
|
821
|
+
let { A: n, B: i, C: a, D: f, E: u, F: l, G: b, H: g } = this;
|
|
822
|
+
for (let m = 0; m < 64; m++) {
|
|
823
|
+
const E = Fe(u, 6) ^ Fe(u, 11) ^ Fe(u, 25), I = g + E + ko(u, l, b) + Oo[m] + Ye[m] | 0, P = (Fe(n, 2) ^ Fe(n, 13) ^ Fe(n, 22)) + Fo(n, i, a) | 0;
|
|
824
|
+
g = b, b = l, l = u, u = f + I | 0, f = a, a = i, i = n, n = I + P | 0;
|
|
825
825
|
}
|
|
826
|
-
n = n + this.A | 0, i = i + this.B | 0, a = a + this.C | 0, f = f + this.D | 0, u = u + this.E | 0, l = l + this.F | 0,
|
|
826
|
+
n = n + this.A | 0, i = i + this.B | 0, a = a + this.C | 0, f = f + this.D | 0, u = u + this.E | 0, l = l + this.F | 0, b = b + this.G | 0, g = g + this.H | 0, this.set(n, i, a, f, u, l, b, g);
|
|
827
827
|
}
|
|
828
828
|
roundClean() {
|
|
829
829
|
Ye.fill(0);
|
|
@@ -832,9 +832,9 @@ class Mo extends Uo {
|
|
|
832
832
|
this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
|
|
833
833
|
}
|
|
834
834
|
}
|
|
835
|
-
const
|
|
835
|
+
const Mo = /* @__PURE__ */ $i(() => new No());
|
|
836
836
|
function Do(e, t) {
|
|
837
|
-
return
|
|
837
|
+
return Mo(Vt(e, { strict: !1 }) ? Pi(e) : e);
|
|
838
838
|
}
|
|
839
839
|
function $o(e) {
|
|
840
840
|
const { commitment: t, version: r = 1 } = e, n = e.to ?? (typeof t == "string" ? "hex" : "bytes"), i = Do(t);
|
|
@@ -900,8 +900,8 @@ function Wo(e) {
|
|
|
900
900
|
const u = ki(new Uint8Array(zi));
|
|
901
901
|
let l = 0;
|
|
902
902
|
for (; l < _n; ) {
|
|
903
|
-
const
|
|
904
|
-
if (u.pushByte(0), u.pushBytes(
|
|
903
|
+
const b = r.slice(f, f + (Hi - 1));
|
|
904
|
+
if (u.pushByte(0), u.pushBytes(b), b.length < 31) {
|
|
905
905
|
u.pushByte(128), a = !1;
|
|
906
906
|
break;
|
|
907
907
|
}
|
|
@@ -912,7 +912,7 @@ function Wo(e) {
|
|
|
912
912
|
return t === "bytes" ? i.map((u) => u.bytes) : i.map((u) => Qe(u.bytes));
|
|
913
913
|
}
|
|
914
914
|
function qo(e) {
|
|
915
|
-
const { data: t, kzg: r, to: n } = e, i = e.blobs ?? Wo({ data: t, to: n }), a = e.commitments ?? Oi({ blobs: i, kzg: r, to: n }), f = e.proofs ??
|
|
915
|
+
const { data: t, kzg: r, to: n } = e, i = e.blobs ?? Wo({ data: t, to: n }), a = e.commitments ?? Oi({ blobs: i, kzg: r, to: n }), f = e.proofs ?? Ni({ blobs: i, commitments: a, kzg: r, to: n }), u = [];
|
|
916
916
|
for (let l = 0; l < i.length; l++)
|
|
917
917
|
u.push({
|
|
918
918
|
blob: i[l],
|
|
@@ -1031,14 +1031,14 @@ function aa(e, t = 24) {
|
|
|
1031
1031
|
for (let f = 0; f < 10; f++)
|
|
1032
1032
|
r[f] = e[f] ^ e[f + 10] ^ e[f + 20] ^ e[f + 30] ^ e[f + 40];
|
|
1033
1033
|
for (let f = 0; f < 10; f += 2) {
|
|
1034
|
-
const u = (f + 8) % 10, l = (f + 2) % 10,
|
|
1034
|
+
const u = (f + 8) % 10, l = (f + 2) % 10, b = r[l], g = r[l + 1], m = Wn(b, g, 1) ^ r[u], E = qn(b, g, 1) ^ r[u + 1];
|
|
1035
1035
|
for (let I = 0; I < 50; I += 10)
|
|
1036
|
-
e[f + I] ^=
|
|
1036
|
+
e[f + I] ^= m, e[f + I + 1] ^= E;
|
|
1037
1037
|
}
|
|
1038
1038
|
let i = e[2], a = e[3];
|
|
1039
1039
|
for (let f = 0; f < 24; f++) {
|
|
1040
|
-
const u = Ki[f], l = Wn(i, a, u),
|
|
1041
|
-
i = e[g], a = e[g + 1], e[g] = l, e[g + 1] =
|
|
1040
|
+
const u = Ki[f], l = Wn(i, a, u), b = qn(i, a, u), g = Vi[f];
|
|
1041
|
+
i = e[g], a = e[g + 1], e[g] = l, e[g + 1] = b;
|
|
1042
1042
|
}
|
|
1043
1043
|
for (let f = 0; f < 50; f += 10) {
|
|
1044
1044
|
for (let u = 0; u < 10; u++)
|
|
@@ -1099,7 +1099,7 @@ class xn extends Di {
|
|
|
1099
1099
|
return Dn(t), this.xofInto(new Uint8Array(t));
|
|
1100
1100
|
}
|
|
1101
1101
|
digestInto(t) {
|
|
1102
|
-
if (
|
|
1102
|
+
if (Mi(t, this), this.finished)
|
|
1103
1103
|
throw new Error("digest() was already called");
|
|
1104
1104
|
return this.writeInto(t), this.destroy(), t;
|
|
1105
1105
|
}
|
|
@@ -1255,7 +1255,7 @@ function xa(e, t) {
|
|
|
1255
1255
|
return r === "eip1559" ? Ba(e, t) : r === "eip2930" ? Sa(e, t) : r === "eip4844" ? Ea(e, t) : r === "eip7702" ? va(e, t) : Ia(e, t);
|
|
1256
1256
|
}
|
|
1257
1257
|
function va(e, t) {
|
|
1258
|
-
const { authorizationList: r, chainId: n, gas: i, nonce: a, to: f, value: u, maxFeePerGas: l, maxPriorityFeePerGas:
|
|
1258
|
+
const { authorizationList: r, chainId: n, gas: i, nonce: a, to: f, value: u, maxFeePerGas: l, maxPriorityFeePerGas: b, accessList: g, data: m } = e;
|
|
1259
1259
|
ya(e);
|
|
1260
1260
|
const E = xr(g), I = Vo(r);
|
|
1261
1261
|
return Kt([
|
|
@@ -1263,12 +1263,12 @@ function va(e, t) {
|
|
|
1263
1263
|
ot([
|
|
1264
1264
|
W(n),
|
|
1265
1265
|
a ? W(a) : "0x",
|
|
1266
|
-
|
|
1266
|
+
b ? W(b) : "0x",
|
|
1267
1267
|
l ? W(l) : "0x",
|
|
1268
1268
|
i ? W(i) : "0x",
|
|
1269
1269
|
f ?? "0x",
|
|
1270
1270
|
u ? W(u) : "0x",
|
|
1271
|
-
|
|
1271
|
+
m ?? "0x",
|
|
1272
1272
|
E,
|
|
1273
1273
|
I,
|
|
1274
1274
|
...Yt(e, t)
|
|
@@ -1276,7 +1276,7 @@ function va(e, t) {
|
|
|
1276
1276
|
]);
|
|
1277
1277
|
}
|
|
1278
1278
|
function Ea(e, t) {
|
|
1279
|
-
const { chainId: r, gas: n, nonce: i, to: a, value: f, maxFeePerBlobGas: u, maxFeePerGas: l, maxPriorityFeePerGas:
|
|
1279
|
+
const { chainId: r, gas: n, nonce: i, to: a, value: f, maxFeePerBlobGas: u, maxFeePerGas: l, maxPriorityFeePerGas: b, accessList: g, data: m } = e;
|
|
1280
1280
|
ga(e);
|
|
1281
1281
|
let E = e.blobVersionedHashes, I = e.sidecars;
|
|
1282
1282
|
if (e.blobs && (typeof E > "u" || typeof I > "u")) {
|
|
@@ -1287,19 +1287,19 @@ function Ea(e, t) {
|
|
|
1287
1287
|
if (typeof E > "u" && (E = Ho({
|
|
1288
1288
|
commitments: U
|
|
1289
1289
|
})), typeof I > "u") {
|
|
1290
|
-
const S =
|
|
1290
|
+
const S = Ni({ blobs: k, commitments: U, kzg: L });
|
|
1291
1291
|
I = qo({ blobs: k, commitments: U, proofs: S });
|
|
1292
1292
|
}
|
|
1293
1293
|
}
|
|
1294
1294
|
const v = xr(g), P = [
|
|
1295
1295
|
W(r),
|
|
1296
1296
|
i ? W(i) : "0x",
|
|
1297
|
-
|
|
1297
|
+
b ? W(b) : "0x",
|
|
1298
1298
|
l ? W(l) : "0x",
|
|
1299
1299
|
n ? W(n) : "0x",
|
|
1300
1300
|
a ?? "0x",
|
|
1301
1301
|
f ? W(f) : "0x",
|
|
1302
|
-
|
|
1302
|
+
m ?? "0x",
|
|
1303
1303
|
v,
|
|
1304
1304
|
u ? W(u) : "0x",
|
|
1305
1305
|
E ?? [],
|
|
@@ -1317,9 +1317,9 @@ function Ea(e, t) {
|
|
|
1317
1317
|
]);
|
|
1318
1318
|
}
|
|
1319
1319
|
function Ba(e, t) {
|
|
1320
|
-
const { chainId: r, gas: n, nonce: i, to: a, value: f, maxFeePerGas: u, maxPriorityFeePerGas: l, accessList:
|
|
1320
|
+
const { chainId: r, gas: n, nonce: i, to: a, value: f, maxFeePerGas: u, maxPriorityFeePerGas: l, accessList: b, data: g } = e;
|
|
1321
1321
|
vn(e);
|
|
1322
|
-
const
|
|
1322
|
+
const m = xr(b), E = [
|
|
1323
1323
|
W(r),
|
|
1324
1324
|
i ? W(i) : "0x",
|
|
1325
1325
|
l ? W(l) : "0x",
|
|
@@ -1328,7 +1328,7 @@ function Ba(e, t) {
|
|
|
1328
1328
|
a ?? "0x",
|
|
1329
1329
|
f ? W(f) : "0x",
|
|
1330
1330
|
g ?? "0x",
|
|
1331
|
-
|
|
1331
|
+
m,
|
|
1332
1332
|
...Yt(e, t)
|
|
1333
1333
|
];
|
|
1334
1334
|
return Kt([
|
|
@@ -1337,12 +1337,12 @@ function Ba(e, t) {
|
|
|
1337
1337
|
]);
|
|
1338
1338
|
}
|
|
1339
1339
|
function Sa(e, t) {
|
|
1340
|
-
const { chainId: r, gas: n, data: i, nonce: a, to: f, value: u, accessList: l, gasPrice:
|
|
1340
|
+
const { chainId: r, gas: n, data: i, nonce: a, to: f, value: u, accessList: l, gasPrice: b } = e;
|
|
1341
1341
|
ma(e);
|
|
1342
|
-
const g = xr(l),
|
|
1342
|
+
const g = xr(l), m = [
|
|
1343
1343
|
W(r),
|
|
1344
1344
|
a ? W(a) : "0x",
|
|
1345
|
-
|
|
1345
|
+
b ? W(b) : "0x",
|
|
1346
1346
|
n ? W(n) : "0x",
|
|
1347
1347
|
f ?? "0x",
|
|
1348
1348
|
u ? W(u) : "0x",
|
|
@@ -1352,13 +1352,13 @@ function Sa(e, t) {
|
|
|
1352
1352
|
];
|
|
1353
1353
|
return Kt([
|
|
1354
1354
|
"0x01",
|
|
1355
|
-
ot(
|
|
1355
|
+
ot(m)
|
|
1356
1356
|
]);
|
|
1357
1357
|
}
|
|
1358
1358
|
function Ia(e, t) {
|
|
1359
1359
|
const { chainId: r = 0, gas: n, data: i, nonce: a, to: f, value: u, gasPrice: l } = e;
|
|
1360
1360
|
wa(e);
|
|
1361
|
-
let
|
|
1361
|
+
let b = [
|
|
1362
1362
|
a ? W(a) : "0x",
|
|
1363
1363
|
l ? W(l) : "0x",
|
|
1364
1364
|
n ? W(n) : "0x",
|
|
@@ -1376,20 +1376,20 @@ function Ia(e, t) {
|
|
|
1376
1376
|
if (t.v !== I)
|
|
1377
1377
|
throw new So({ v: t.v });
|
|
1378
1378
|
return I;
|
|
1379
|
-
})(),
|
|
1380
|
-
|
|
1381
|
-
...
|
|
1379
|
+
})(), m = lr(t.r), E = lr(t.s);
|
|
1380
|
+
b = [
|
|
1381
|
+
...b,
|
|
1382
1382
|
W(g),
|
|
1383
|
-
|
|
1383
|
+
m === "0x00" ? "0x" : m,
|
|
1384
1384
|
E === "0x00" ? "0x" : E
|
|
1385
1385
|
];
|
|
1386
|
-
} else r > 0 && (
|
|
1387
|
-
...
|
|
1386
|
+
} else r > 0 && (b = [
|
|
1387
|
+
...b,
|
|
1388
1388
|
W(r),
|
|
1389
1389
|
"0x",
|
|
1390
1390
|
"0x"
|
|
1391
1391
|
]);
|
|
1392
|
-
return ot(
|
|
1392
|
+
return ot(b);
|
|
1393
1393
|
}
|
|
1394
1394
|
function Yt(e, t) {
|
|
1395
1395
|
const r = t ?? e, { v: n, yParity: i } = r;
|
|
@@ -1453,7 +1453,7 @@ const Pa = {
|
|
|
1453
1453
|
};
|
|
1454
1454
|
function Ca(e) {
|
|
1455
1455
|
ka(e);
|
|
1456
|
-
const { sourceHash: t, data: r, from: n, gas: i, isSystemTx: a, mint: f, to: u, value: l } = e,
|
|
1456
|
+
const { sourceHash: t, data: r, from: n, gas: i, isSystemTx: a, mint: f, to: u, value: l } = e, b = [
|
|
1457
1457
|
t,
|
|
1458
1458
|
n,
|
|
1459
1459
|
u ?? "0x",
|
|
@@ -1465,7 +1465,7 @@ function Ca(e) {
|
|
|
1465
1465
|
];
|
|
1466
1466
|
return Kt([
|
|
1467
1467
|
"0x7e",
|
|
1468
|
-
ot(
|
|
1468
|
+
ot(b)
|
|
1469
1469
|
]);
|
|
1470
1470
|
}
|
|
1471
1471
|
function La(e) {
|
|
@@ -1580,7 +1580,7 @@ const Vn = {
|
|
|
1580
1580
|
},
|
|
1581
1581
|
testnet: !0,
|
|
1582
1582
|
sourceId: Ut
|
|
1583
|
-
}),
|
|
1583
|
+
}), Na = /* @__PURE__ */ qt({
|
|
1584
1584
|
id: 1,
|
|
1585
1585
|
name: "Ethereum",
|
|
1586
1586
|
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
|
|
@@ -1609,7 +1609,7 @@ const Vn = {
|
|
|
1609
1609
|
blockCreated: 14353601
|
|
1610
1610
|
}
|
|
1611
1611
|
}
|
|
1612
|
-
}),
|
|
1612
|
+
}), Ma = /* @__PURE__ */ qt({
|
|
1613
1613
|
id: 11155111,
|
|
1614
1614
|
name: "Sepolia",
|
|
1615
1615
|
nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
|
|
@@ -1670,9 +1670,9 @@ const Ot = (e) => e.length === 64 ? e : e.slice(2), za = (e) => {
|
|
|
1670
1670
|
return !1;
|
|
1671
1671
|
}
|
|
1672
1672
|
}, Ga = {
|
|
1673
|
-
ethereum:
|
|
1673
|
+
ethereum: Na,
|
|
1674
1674
|
ethereum_arbitrum: Fa,
|
|
1675
|
-
ethereum_sepolia:
|
|
1675
|
+
ethereum_sepolia: Ma,
|
|
1676
1676
|
arbitrum_sepolia: Ua,
|
|
1677
1677
|
ethereum_localnet: zs,
|
|
1678
1678
|
arbitrum_localnet: Gs,
|
|
@@ -1708,13 +1708,13 @@ const Ot = (e) => e.length === 64 ? e : e.slice(2), za = (e) => {
|
|
|
1708
1708
|
walletClient: a
|
|
1709
1709
|
});
|
|
1710
1710
|
} catch {
|
|
1711
|
-
return
|
|
1711
|
+
return N("Failed to add network");
|
|
1712
1712
|
}
|
|
1713
1713
|
else
|
|
1714
|
-
return
|
|
1714
|
+
return N("Failed to switch network");
|
|
1715
1715
|
}
|
|
1716
1716
|
else
|
|
1717
|
-
return
|
|
1717
|
+
return N("Chain not supported");
|
|
1718
1718
|
}, ja = (e) => typeof e == "object" && e !== null && "code" in e && e.code === 4902, Wa = (e, t, r, n) => e + ":" + t.toLowerCase() + "::" + r + ":" + n.toLowerCase();
|
|
1719
1719
|
var re = /* @__PURE__ */ ((e) => (e.Created = "Created", e.Matched = "Matched", e.InitiateDetected = "InitiateDetected", e.Initiated = "Initiated", e.CounterPartyInitiateDetected = "CounterPartyInitiateDetected", e.CounterPartyInitiated = "CounterPartyInitiated", e.RedeemDetected = "RedeemDetected", e.Redeemed = "Redeemed", e.CounterPartyRedeemDetected = "CounterPartyRedeemDetected", e.CounterPartyRedeemed = "CounterPartyRedeemed", e.Completed = "Completed", e.CounterPartySwapExpired = "CounterPartySwapExpired", e.Expired = "Expired", e.RefundDetected = "RefundDetected", e.Refunded = "Refunded", e.CounterPartyRefundDetected = "CounterPartyRefundDetected", e.CounterPartyRefunded = "CounterPartyRefunded", e.Cancelled = "Cancelled", e.DeadLineExceeded = "DeadLineExceeded", e))(re || {}), te = /* @__PURE__ */ ((e) => (e.Idle = "Idle", e.InitiateDetected = "InitiateDetected", e.Initiated = "Initiated", e.RedeemDetected = "RedeemDetected", e.Redeemed = "Redeemed", e.RefundDetected = "RefundDetected", e.Refunded = "Refunded", e.Expired = "Expired", e))(te || {});
|
|
1720
1720
|
const qa = (e, t, r) => {
|
|
@@ -1763,15 +1763,15 @@ const qa = (e, t, r) => {
|
|
|
1763
1763
|
r
|
|
1764
1764
|
)) {
|
|
1765
1765
|
case re.Matched:
|
|
1766
|
-
return
|
|
1766
|
+
return ce.Initiate;
|
|
1767
1767
|
case re.CounterPartyInitiated:
|
|
1768
1768
|
case re.CounterPartyInitiateDetected:
|
|
1769
1769
|
case re.RedeemDetected:
|
|
1770
|
-
return
|
|
1770
|
+
return ce.Redeem;
|
|
1771
1771
|
case re.Expired:
|
|
1772
|
-
return
|
|
1772
|
+
return ce.Refund;
|
|
1773
1773
|
default:
|
|
1774
|
-
return
|
|
1774
|
+
return ce.Idle;
|
|
1775
1775
|
}
|
|
1776
1776
|
}, Kn = (e, t = 0) => {
|
|
1777
1777
|
const r = Date.now(), n = e * 1e3 + t * 36e5;
|
|
@@ -2174,37 +2174,37 @@ class Ya {
|
|
|
2174
2174
|
this.url = new pn("/relayer", r), this.auth = n, this.order = t;
|
|
2175
2175
|
}
|
|
2176
2176
|
async init(t, r) {
|
|
2177
|
-
if (!t.account) return
|
|
2177
|
+
if (!t.account) return N("No account found");
|
|
2178
2178
|
if (t.account.address.toLowerCase() !== this.order.source_swap.initiator.toLowerCase())
|
|
2179
|
-
return
|
|
2179
|
+
return N("Account address and order initiator mismatch");
|
|
2180
2180
|
if (!r) {
|
|
2181
2181
|
const g = await Zr(t);
|
|
2182
|
-
if (g.error) return
|
|
2182
|
+
if (g.error) return N(g.error);
|
|
2183
2183
|
r = g.val;
|
|
2184
2184
|
}
|
|
2185
2185
|
if (nn(
|
|
2186
2186
|
this.order.source_swap,
|
|
2187
2187
|
r
|
|
2188
|
-
) !== te.Idle) return
|
|
2188
|
+
) !== te.Idle) return N("Invalid swap status");
|
|
2189
2189
|
const { create_order: i, source_swap: a } = this.order;
|
|
2190
2190
|
if (!a.amount || !a.redeemer || !i.timelock || !i.secret_hash)
|
|
2191
|
-
return
|
|
2192
|
-
const f = fr(i.secret_hash), u = BigInt(i.timelock), l = fr(a.redeemer),
|
|
2191
|
+
return N("Invalid order");
|
|
2192
|
+
const f = fr(i.secret_hash), u = BigInt(i.timelock), l = fr(a.redeemer), b = BigInt(a.amount);
|
|
2193
2193
|
try {
|
|
2194
2194
|
const g = await this.auth.getToken();
|
|
2195
|
-
if (g.error) return
|
|
2196
|
-
const
|
|
2195
|
+
if (g.error) return N(g.error);
|
|
2196
|
+
const m = Vs({
|
|
2197
2197
|
address: fr(this.order.source_swap.asset),
|
|
2198
2198
|
abi: Ka,
|
|
2199
2199
|
client: t
|
|
2200
|
-
}), E = await
|
|
2201
|
-
Number(
|
|
2200
|
+
}), E = await m.read.token(), I = await Ws(
|
|
2201
|
+
Number(b),
|
|
2202
2202
|
E,
|
|
2203
2203
|
this.order.source_swap.asset,
|
|
2204
2204
|
t
|
|
2205
2205
|
);
|
|
2206
|
-
if (I.error) return
|
|
2207
|
-
const v = await
|
|
2206
|
+
if (I.error) return N(I.error);
|
|
2207
|
+
const v = await m.read.eip712Domain(), P = await t.signTypedData({
|
|
2208
2208
|
account: t.account,
|
|
2209
2209
|
domain: {
|
|
2210
2210
|
name: v[1],
|
|
@@ -2224,7 +2224,7 @@ class Ya {
|
|
|
2224
2224
|
message: {
|
|
2225
2225
|
redeemer: l,
|
|
2226
2226
|
timelock: u,
|
|
2227
|
-
amount:
|
|
2227
|
+
amount: b,
|
|
2228
2228
|
secretHash: f
|
|
2229
2229
|
}
|
|
2230
2230
|
}), T = await mt.post(
|
|
@@ -2241,15 +2241,15 @@ class Ya {
|
|
|
2241
2241
|
}
|
|
2242
2242
|
}
|
|
2243
2243
|
);
|
|
2244
|
-
return T.error ?
|
|
2244
|
+
return T.error ? N(T.error) : T.result ? fe(T.result) : N("Init: No result found");
|
|
2245
2245
|
} catch (g) {
|
|
2246
|
-
return console.log("init error :", g),
|
|
2246
|
+
return console.log("init error :", g), N(String(g));
|
|
2247
2247
|
}
|
|
2248
2248
|
}
|
|
2249
2249
|
async redeem(t, r) {
|
|
2250
2250
|
try {
|
|
2251
2251
|
const n = await this.auth.getToken();
|
|
2252
|
-
if (n.error) return
|
|
2252
|
+
if (n.error) return N(n.error);
|
|
2253
2253
|
const i = await mt.post(
|
|
2254
2254
|
this.url.endpoint("redeem"),
|
|
2255
2255
|
{
|
|
@@ -2264,9 +2264,9 @@ class Ya {
|
|
|
2264
2264
|
}
|
|
2265
2265
|
}
|
|
2266
2266
|
);
|
|
2267
|
-
return i.error ?
|
|
2267
|
+
return i.error ? N(i.error) : i.result ? fe(i.result) : N("Redeem: No result found");
|
|
2268
2268
|
} catch (n) {
|
|
2269
|
-
return
|
|
2269
|
+
return N(String(n));
|
|
2270
2270
|
}
|
|
2271
2271
|
}
|
|
2272
2272
|
}
|
|
@@ -2308,7 +2308,7 @@ const me = {
|
|
|
2308
2308
|
controlBlockGenerationFailed: "failed to generate control block",
|
|
2309
2309
|
invalidLeaf: "invalid leaf"
|
|
2310
2310
|
}, or = 192;
|
|
2311
|
-
|
|
2311
|
+
ye.initEccLib(xt);
|
|
2312
2312
|
class pr {
|
|
2313
2313
|
/**
|
|
2314
2314
|
* Note: redeemerAddress and initiatorAddress should be x-only public key without 02 or 03 prefix
|
|
@@ -2353,7 +2353,7 @@ class pr {
|
|
|
2353
2353
|
* Generates a taproot address for receiving the funds
|
|
2354
2354
|
*/
|
|
2355
2355
|
address() {
|
|
2356
|
-
const { address: t } =
|
|
2356
|
+
const { address: t } = ye.payments.p2tr({
|
|
2357
2357
|
internalPubkey: this.internalPubkey,
|
|
2358
2358
|
network: this.network,
|
|
2359
2359
|
scriptTree: this.leaves()
|
|
@@ -2368,31 +2368,31 @@ class pr {
|
|
|
2368
2368
|
return this.address();
|
|
2369
2369
|
}
|
|
2370
2370
|
async _buildRawTx(t, r) {
|
|
2371
|
-
const n = new
|
|
2371
|
+
const n = new ye.Transaction();
|
|
2372
2372
|
n.version = 2;
|
|
2373
2373
|
const i = this.address(), a = await this.signer.getProvider();
|
|
2374
2374
|
let f = [];
|
|
2375
2375
|
if (this.utxoHashes && this.utxoHashes.length > 0)
|
|
2376
2376
|
for (const l of this.utxoHashes) {
|
|
2377
|
-
const
|
|
2378
|
-
for (let g = 0; g <
|
|
2379
|
-
const
|
|
2380
|
-
|
|
2381
|
-
txid:
|
|
2377
|
+
const b = await a.getTransaction(l);
|
|
2378
|
+
for (let g = 0; g < b.vout.length; g++) {
|
|
2379
|
+
const m = b.vout[g];
|
|
2380
|
+
m.scriptpubkey_address === i && f.push({
|
|
2381
|
+
txid: b.txid,
|
|
2382
2382
|
vout: g,
|
|
2383
|
-
value:
|
|
2383
|
+
value: m.value,
|
|
2384
2384
|
status: { confirmed: !1 }
|
|
2385
2385
|
});
|
|
2386
2386
|
}
|
|
2387
2387
|
}
|
|
2388
2388
|
else
|
|
2389
2389
|
f = await a.getUTXOs(i);
|
|
2390
|
-
const u = f.reduce((l,
|
|
2390
|
+
const u = f.reduce((l, b) => l + b.value, 0);
|
|
2391
2391
|
if (u === 0) throw new Error(`${i} ${me.notFunded}`);
|
|
2392
2392
|
for (let l = 0; l < f.length; l++)
|
|
2393
2393
|
n.addInput(Buffer.from(f[l].txid, "hex").reverse(), f[l].vout);
|
|
2394
2394
|
return r ?? (r = await a.suggestFee(i, u, On.MEDIUM)), n.addOutput(
|
|
2395
|
-
|
|
2395
|
+
ye.address.toOutputScript(t, this.network),
|
|
2396
2396
|
u - r
|
|
2397
2397
|
), { tx: n, usedUtxos: f };
|
|
2398
2398
|
}
|
|
@@ -2407,7 +2407,7 @@ class pr {
|
|
|
2407
2407
|
* prevout script for the gardenHTLC address
|
|
2408
2408
|
*/
|
|
2409
2409
|
getOutputScript() {
|
|
2410
|
-
return
|
|
2410
|
+
return ye.address.toOutputScript(this.address(), this.network);
|
|
2411
2411
|
}
|
|
2412
2412
|
async init(t) {
|
|
2413
2413
|
return t ?? (t = await (await this.signer.getProvider()).suggestFee(
|
|
@@ -2424,17 +2424,17 @@ class pr {
|
|
|
2424
2424
|
async instantRefund(t, r) {
|
|
2425
2425
|
bt(t.length > 0, me.noCounterpartySigs);
|
|
2426
2426
|
const { tx: n, usedUtxos: i } = await this.buildRawTx(r);
|
|
2427
|
-
for (const
|
|
2428
|
-
if (!t.find((E) => E.utxo ===
|
|
2429
|
-
throw new Error(me.counterPartySigNotFound(
|
|
2430
|
-
const a = this.getOutputScript(), f =
|
|
2427
|
+
for (const m of i)
|
|
2428
|
+
if (!t.find((E) => E.utxo === m.txid))
|
|
2429
|
+
throw new Error(me.counterPartySigNotFound(m.txid));
|
|
2430
|
+
const a = this.getOutputScript(), f = ye.Transaction.SIGHASH_DEFAULT, u = this.leafHash(
|
|
2431
2431
|
2
|
|
2432
2432
|
/* INSTANT_REFUND */
|
|
2433
|
-
), l = i.map((
|
|
2434
|
-
for (let
|
|
2433
|
+
), l = i.map((m) => m.value), b = Nr(a, i.length);
|
|
2434
|
+
for (let m = 0; m < n.ins.length; m++) {
|
|
2435
2435
|
const E = n.hashForWitnessV1(
|
|
2436
|
-
|
|
2437
|
-
|
|
2436
|
+
m,
|
|
2437
|
+
b,
|
|
2438
2438
|
l,
|
|
2439
2439
|
f,
|
|
2440
2440
|
u
|
|
@@ -2442,15 +2442,15 @@ class pr {
|
|
|
2442
2442
|
if (!xt.verifySchnorr(
|
|
2443
2443
|
E,
|
|
2444
2444
|
Buffer.from(this.redeemerPubkey, "hex"),
|
|
2445
|
-
Buffer.from(t[
|
|
2445
|
+
Buffer.from(t[m].sig, "hex")
|
|
2446
2446
|
))
|
|
2447
2447
|
throw new Error(
|
|
2448
|
-
me.invalidCounterpartySigForUTXO(t[
|
|
2448
|
+
me.invalidCounterpartySigForUTXO(t[m].utxo)
|
|
2449
2449
|
);
|
|
2450
|
-
const I = await this.signer.signSchnorr(E), v = Buffer.from(n.ins[
|
|
2450
|
+
const I = await this.signer.signSchnorr(E), v = Buffer.from(n.ins[m].hash).reverse().toString("hex"), P = t.find((T) => T.utxo === v);
|
|
2451
2451
|
if (!P)
|
|
2452
2452
|
throw new Error(me.counterPartySigNotFound(v));
|
|
2453
|
-
n.setWitness(
|
|
2453
|
+
n.setWitness(m, [
|
|
2454
2454
|
Buffer.from(P.sig, "hex"),
|
|
2455
2455
|
I,
|
|
2456
2456
|
this.instantRefundLeaf(),
|
|
@@ -2467,7 +2467,7 @@ class pr {
|
|
|
2467
2467
|
*/
|
|
2468
2468
|
async redeem(t, r, n) {
|
|
2469
2469
|
bt(
|
|
2470
|
-
|
|
2470
|
+
ye.crypto.sha256(Buffer.from(t, "hex")).toString("hex") === this.secretHash,
|
|
2471
2471
|
me.secretMismatch
|
|
2472
2472
|
);
|
|
2473
2473
|
const { tx: i, usedUtxos: a } = await this._buildRawTx(
|
|
@@ -2476,16 +2476,16 @@ class pr {
|
|
|
2476
2476
|
), f = this.leafHash(
|
|
2477
2477
|
1
|
|
2478
2478
|
/* REDEEM */
|
|
2479
|
-
), u = a.map((
|
|
2480
|
-
for (let
|
|
2479
|
+
), u = a.map((m) => m.value), l = Nr(this.getOutputScript(), a.length), b = ye.Transaction.SIGHASH_DEFAULT;
|
|
2480
|
+
for (let m = 0; m < i.ins.length; m++) {
|
|
2481
2481
|
const E = i.hashForWitnessV1(
|
|
2482
|
-
|
|
2482
|
+
m,
|
|
2483
2483
|
l,
|
|
2484
2484
|
u,
|
|
2485
|
-
|
|
2485
|
+
b,
|
|
2486
2486
|
f
|
|
2487
2487
|
), I = await this.signer.signSchnorr(E);
|
|
2488
|
-
i.setWitness(
|
|
2488
|
+
i.setWitness(m, [
|
|
2489
2489
|
I,
|
|
2490
2490
|
Buffer.from(t, "hex"),
|
|
2491
2491
|
this.redeemLeaf(),
|
|
@@ -2510,12 +2510,12 @@ class pr {
|
|
|
2510
2510
|
const u = this.leafHash(
|
|
2511
2511
|
0
|
|
2512
2512
|
/* REFUND */
|
|
2513
|
-
), l = i.map((E) => E.value),
|
|
2513
|
+
), l = i.map((E) => E.value), b = Nr(this.getOutputScript(), i.length), g = ye.Transaction.SIGHASH_DEFAULT;
|
|
2514
2514
|
for (let E = 0; E < n.ins.length; E++) {
|
|
2515
2515
|
n.ins[E].sequence = this.expiry;
|
|
2516
2516
|
const I = n.hashForWitnessV1(
|
|
2517
2517
|
E,
|
|
2518
|
-
|
|
2518
|
+
b,
|
|
2519
2519
|
l,
|
|
2520
2520
|
g,
|
|
2521
2521
|
u
|
|
@@ -2561,7 +2561,7 @@ class pr {
|
|
|
2561
2561
|
default:
|
|
2562
2562
|
throw new Error(me.invalidLeaf);
|
|
2563
2563
|
}
|
|
2564
|
-
const n =
|
|
2564
|
+
const n = ye.payments.p2tr({
|
|
2565
2565
|
internalPubkey: this.internalPubkey,
|
|
2566
2566
|
network: this.network,
|
|
2567
2567
|
scriptTree: this.leaves(),
|
|
@@ -2581,12 +2581,12 @@ class pr {
|
|
|
2581
2581
|
*/
|
|
2582
2582
|
leafHash(t) {
|
|
2583
2583
|
let r = this.redeemLeaf();
|
|
2584
|
-
return t === 0 && (r = this.refundLeaf()), t === 2 && (r = this.instantRefundLeaf()),
|
|
2584
|
+
return t === 0 && (r = this.refundLeaf()), t === 2 && (r = this.instantRefundLeaf()), ye.crypto.taggedHash("TapLeaf", Da(r));
|
|
2585
2585
|
}
|
|
2586
2586
|
refundLeaf() {
|
|
2587
|
-
return
|
|
2587
|
+
return ye.script.fromASM(
|
|
2588
2588
|
`
|
|
2589
|
-
${
|
|
2589
|
+
${ye.script.number.encode(this.expiry).toString("hex")}
|
|
2590
2590
|
OP_CHECKSEQUENCEVERIFY
|
|
2591
2591
|
OP_DROP
|
|
2592
2592
|
${this.initiatorPubkey}
|
|
@@ -2595,7 +2595,7 @@ class pr {
|
|
|
2595
2595
|
);
|
|
2596
2596
|
}
|
|
2597
2597
|
redeemLeaf() {
|
|
2598
|
-
return
|
|
2598
|
+
return ye.script.fromASM(
|
|
2599
2599
|
`
|
|
2600
2600
|
OP_SHA256
|
|
2601
2601
|
${this.secretHash}
|
|
@@ -2606,7 +2606,7 @@ class pr {
|
|
|
2606
2606
|
);
|
|
2607
2607
|
}
|
|
2608
2608
|
instantRefundLeaf() {
|
|
2609
|
-
return
|
|
2609
|
+
return ye.script.fromASM(
|
|
2610
2610
|
`
|
|
2611
2611
|
${this.initiatorPubkey}
|
|
2612
2612
|
OP_CHECKSIG
|
|
@@ -2657,7 +2657,7 @@ class pr {
|
|
|
2657
2657
|
n
|
|
2658
2658
|
);
|
|
2659
2659
|
return [
|
|
2660
|
-
|
|
2660
|
+
ye.crypto.taggedHash(
|
|
2661
2661
|
"TapBranch",
|
|
2662
2662
|
Buffer.concat(a)
|
|
2663
2663
|
)
|
|
@@ -2672,7 +2672,7 @@ class pr {
|
|
|
2672
2672
|
}
|
|
2673
2673
|
}
|
|
2674
2674
|
}
|
|
2675
|
-
function
|
|
2675
|
+
function Nr(e, t) {
|
|
2676
2676
|
const r = [];
|
|
2677
2677
|
for (let n = 0; n < t; n++)
|
|
2678
2678
|
r.push(e);
|
|
@@ -2706,7 +2706,7 @@ class rf {
|
|
|
2706
2706
|
const t = await mt.get(this.url);
|
|
2707
2707
|
return fe(t);
|
|
2708
2708
|
} catch (t) {
|
|
2709
|
-
return
|
|
2709
|
+
return N("Failed to fetch block numbers", t);
|
|
2710
2710
|
}
|
|
2711
2711
|
}
|
|
2712
2712
|
}
|
|
@@ -2731,13 +2731,13 @@ class ll {
|
|
|
2731
2731
|
}
|
|
2732
2732
|
async swap(t) {
|
|
2733
2733
|
const r = await this.validateAndFillParams(t);
|
|
2734
|
-
if (r.error) return
|
|
2734
|
+
if (r.error) return N(r.error);
|
|
2735
2735
|
const { sendAddress: n, receiveAddress: i, timelock: a } = r.val, f = await this.orderBook.getOrdersCount(this.evmAddress);
|
|
2736
|
-
if (f.error) return
|
|
2736
|
+
if (f.error) return N(f.error);
|
|
2737
2737
|
const u = f.val + 1, l = this.secretManager.generateSecret(u);
|
|
2738
|
-
if (l.error) return
|
|
2739
|
-
const { strategyId:
|
|
2740
|
-
strategy_id:
|
|
2738
|
+
if (l.error) return N(l.error);
|
|
2739
|
+
const { strategyId: b, btcAddress: g } = t.additionalData, m = {
|
|
2740
|
+
strategy_id: b,
|
|
2741
2741
|
...g && {
|
|
2742
2742
|
bitcoin_optional_recipient: g
|
|
2743
2743
|
}
|
|
@@ -2755,66 +2755,66 @@ class ll {
|
|
|
2755
2755
|
timelock: a,
|
|
2756
2756
|
secret_hash: nt(l.val.secretHash),
|
|
2757
2757
|
min_destination_confirmations: t.minDestinationConfirmations ?? 0,
|
|
2758
|
-
additional_data:
|
|
2758
|
+
additional_data: m
|
|
2759
2759
|
}, I = await this.quote.getAttestedQuote(E);
|
|
2760
|
-
if (I.error) return
|
|
2760
|
+
if (I.error) return N(I.error);
|
|
2761
2761
|
const v = await this.orderBook.createOrder(I.val);
|
|
2762
|
-
if (v.error) return
|
|
2762
|
+
if (v.error) return N(v.error);
|
|
2763
2763
|
const P = await this.pollOrder(v.val);
|
|
2764
|
-
return P.error ?
|
|
2764
|
+
return P.error ? N(P.error) : fe(P.val);
|
|
2765
2765
|
}
|
|
2766
2766
|
async validateAndFillParams(t) {
|
|
2767
2767
|
if (t.fromAsset.chain === t.toAsset.chain && t.fromAsset.atomicSwapAddress === t.toAsset.atomicSwapAddress)
|
|
2768
|
-
return
|
|
2768
|
+
return N("Source and destination assets cannot be the same");
|
|
2769
2769
|
if (rr(t.fromAsset.chain) && !rr(t.toAsset.chain) || !rr(t.fromAsset.chain) && rr(t.toAsset.chain))
|
|
2770
|
-
return
|
|
2770
|
+
return N(
|
|
2771
2771
|
"Both assets should be on the same network (either mainnet or testnet)"
|
|
2772
2772
|
);
|
|
2773
2773
|
if (nr(t.fromAsset.chain) || nr(t.toAsset.chain)) {
|
|
2774
2774
|
if (!this.wallets.btcWallet)
|
|
2775
|
-
return
|
|
2775
|
+
return N(
|
|
2776
2776
|
"btcWallet is required for bitcoin chain. Please provide btcWallet in the constructor"
|
|
2777
2777
|
);
|
|
2778
2778
|
if (!t.additionalData.btcAddress)
|
|
2779
|
-
return
|
|
2779
|
+
return N(
|
|
2780
2780
|
"btcAddress in additionalData is required for bitcoin chain"
|
|
2781
2781
|
);
|
|
2782
2782
|
}
|
|
2783
2783
|
const r = await this.getAddresses(t.fromAsset.chain);
|
|
2784
|
-
if (r.error) return
|
|
2784
|
+
if (r.error) return N(r.error);
|
|
2785
2785
|
const n = await this.getAddresses(t.toAsset.chain);
|
|
2786
|
-
if (n.error) return
|
|
2786
|
+
if (n.error) return N(n.error);
|
|
2787
2787
|
const i = this.validateAmount(t.sendAmount);
|
|
2788
|
-
if (i.error) return
|
|
2788
|
+
if (i.error) return N(i.error);
|
|
2789
2789
|
const a = this.validateAmount(t.receiveAmount);
|
|
2790
|
-
if (a.error) return
|
|
2790
|
+
if (a.error) return N(a.error);
|
|
2791
2791
|
if (i < a)
|
|
2792
|
-
return
|
|
2792
|
+
return N("Send amount should be greater than receive amount");
|
|
2793
2793
|
const f = this.getTimelock(t.fromAsset.chain);
|
|
2794
2794
|
return f ? fe({
|
|
2795
2795
|
sendAddress: r.val,
|
|
2796
2796
|
receiveAddress: n.val,
|
|
2797
2797
|
timelock: t.timelock ?? f
|
|
2798
|
-
}) :
|
|
2798
|
+
}) : N("Unsupported chain for timelock");
|
|
2799
2799
|
}
|
|
2800
2800
|
async getAddresses(t) {
|
|
2801
2801
|
var n;
|
|
2802
2802
|
switch (Lt(t)) {
|
|
2803
2803
|
case ke.EVM:
|
|
2804
|
-
return this.wallets.evmWallet.account ? fe(this.wallets.evmWallet.account.address) :
|
|
2804
|
+
return this.wallets.evmWallet.account ? fe(this.wallets.evmWallet.account.address) : N("EVM Wallet not found");
|
|
2805
2805
|
case ke.Bitcoin: {
|
|
2806
2806
|
const i = await ((n = this.wallets.btcWallet) == null ? void 0 : n.getPublicKey());
|
|
2807
|
-
return !i || !za(i) ?
|
|
2807
|
+
return !i || !za(i) ? N("Invalid btc public key") : fe(Ot(i));
|
|
2808
2808
|
}
|
|
2809
2809
|
default:
|
|
2810
|
-
return
|
|
2810
|
+
return N("Unsupported chain");
|
|
2811
2811
|
}
|
|
2812
2812
|
}
|
|
2813
2813
|
validateAmount(t) {
|
|
2814
2814
|
if (t == null || t.includes("."))
|
|
2815
|
-
return
|
|
2815
|
+
return N("Invalid amount ", t);
|
|
2816
2816
|
const r = new Ys(t);
|
|
2817
|
-
return !r.isInteger() || r.isNaN() || r.lt(0) || r.isLessThanOrEqualTo(0) ?
|
|
2817
|
+
return !r.isInteger() || r.isNaN() || r.lt(0) || r.isLessThanOrEqualTo(0) ? N("Invalid amount ", t) : fe(r);
|
|
2818
2818
|
}
|
|
2819
2819
|
getTimelock(t) {
|
|
2820
2820
|
switch (Lt(t)) {
|
|
@@ -2831,12 +2831,12 @@ class ll {
|
|
|
2831
2831
|
for (; n < this.getOrderThreshold; ) {
|
|
2832
2832
|
if (await qs(1e3), n++, r.error) {
|
|
2833
2833
|
if (!r.error.includes("result is undefined"))
|
|
2834
|
-
return
|
|
2834
|
+
return N(r.error);
|
|
2835
2835
|
} else if (r.val && r.val.create_order.create_id.toLowerCase() === t.toLowerCase())
|
|
2836
2836
|
return fe(r.val);
|
|
2837
2837
|
r = await this.orderBook.getOrder(t, !0);
|
|
2838
2838
|
}
|
|
2839
|
-
return
|
|
2839
|
+
return N(`Order not found, createOrder id: ${t}`);
|
|
2840
2840
|
}
|
|
2841
2841
|
emit(t, ...r) {
|
|
2842
2842
|
(this.eventListeners.get(t) ?? []).forEach((i) => {
|
|
@@ -2852,8 +2852,8 @@ class ll {
|
|
|
2852
2852
|
this.pendingOrdersCount = r.data.length, this.emit("onPendingOrdersChanged", r.data);
|
|
2853
2853
|
const n = await ((i = this.blockNumberFetcher) == null ? void 0 : i.fetchBlockNumbers());
|
|
2854
2854
|
for (let a = 0; a < r.data.length; a++) {
|
|
2855
|
-
const f = r.data[a], u = f.source_swap.chain, l = f.destination_swap.chain,
|
|
2856
|
-
if (
|
|
2855
|
+
const f = r.data[a], u = f.source_swap.chain, l = f.destination_swap.chain, b = this.getWallet(u), g = this.getWallet(l);
|
|
2856
|
+
if (b.error || g.error || !b.val || !g.val) {
|
|
2857
2857
|
this.emit(
|
|
2858
2858
|
"error",
|
|
2859
2859
|
f,
|
|
@@ -2861,10 +2861,10 @@ class ll {
|
|
|
2861
2861
|
);
|
|
2862
2862
|
return;
|
|
2863
2863
|
}
|
|
2864
|
-
let
|
|
2865
|
-
if (!
|
|
2864
|
+
let m = n == null ? void 0 : n.val[u], E = n == null ? void 0 : n.val[l];
|
|
2865
|
+
if (!m || !E) {
|
|
2866
2866
|
const v = await this.fetchCurrentBlockNumbers(f, {
|
|
2867
|
-
source:
|
|
2867
|
+
source: b.val,
|
|
2868
2868
|
destination: g.val
|
|
2869
2869
|
});
|
|
2870
2870
|
if (v.error) {
|
|
@@ -2875,14 +2875,14 @@ class ll {
|
|
|
2875
2875
|
);
|
|
2876
2876
|
return;
|
|
2877
2877
|
}
|
|
2878
|
-
|
|
2878
|
+
m = v.val.source, E = v.val.destination;
|
|
2879
2879
|
}
|
|
2880
2880
|
switch (Va(
|
|
2881
2881
|
f,
|
|
2882
|
-
|
|
2882
|
+
m,
|
|
2883
2883
|
E
|
|
2884
2884
|
)) {
|
|
2885
|
-
case
|
|
2885
|
+
case ce.Redeem: {
|
|
2886
2886
|
const v = this.secretManager.generateSecret(
|
|
2887
2887
|
Number(f.create_order.nonce)
|
|
2888
2888
|
);
|
|
@@ -2912,7 +2912,7 @@ class ll {
|
|
|
2912
2912
|
}
|
|
2913
2913
|
break;
|
|
2914
2914
|
}
|
|
2915
|
-
case
|
|
2915
|
+
case ce.Refund: {
|
|
2916
2916
|
switch (Lt(f.source_swap.chain)) {
|
|
2917
2917
|
case ke.EVM: {
|
|
2918
2918
|
this.emit(
|
|
@@ -2924,7 +2924,7 @@ class ll {
|
|
|
2924
2924
|
}
|
|
2925
2925
|
case ke.Bitcoin: {
|
|
2926
2926
|
await this.btcRefund(
|
|
2927
|
-
|
|
2927
|
+
b.val,
|
|
2928
2928
|
f
|
|
2929
2929
|
);
|
|
2930
2930
|
break;
|
|
@@ -2948,28 +2948,31 @@ class ll {
|
|
|
2948
2948
|
);
|
|
2949
2949
|
}
|
|
2950
2950
|
async evmRedeem(t, r) {
|
|
2951
|
-
if (this.emit("log", t.create_order.create_id, "executing evm redeem"), this.orderExecutorCache.get(t,
|
|
2951
|
+
if (this.emit("log", t.create_order.create_id, "executing evm redeem"), this.orderExecutorCache.get(t, ce.Redeem)) {
|
|
2952
2952
|
this.emit("log", t.create_order.create_id, "already redeemed");
|
|
2953
2953
|
return;
|
|
2954
2954
|
}
|
|
2955
2955
|
const a = await new Ya(t, this.orderbookUrl, this.auth).redeem(t.create_order.create_id, r);
|
|
2956
2956
|
if (a.error) {
|
|
2957
|
-
this.emit("error", t, a.error)
|
|
2957
|
+
this.emit("error", t, a.error), a.error.includes("Order already redeemed") && this.orderExecutorCache.set(
|
|
2958
|
+
t,
|
|
2959
|
+
ce.Redeem,
|
|
2960
|
+
t.destination_swap.redeem_tx_hash
|
|
2961
|
+
);
|
|
2958
2962
|
return;
|
|
2959
2963
|
}
|
|
2960
|
-
this.emit("success", t,
|
|
2964
|
+
this.emit("success", t, ce.Redeem, a.val), this.orderExecutorCache.set(t, ce.Redeem, a.val);
|
|
2961
2965
|
}
|
|
2962
2966
|
async btcRedeem(t, r, n) {
|
|
2963
2967
|
var u, l;
|
|
2964
|
-
const i = this.orderExecutorCache.get(r,
|
|
2968
|
+
const i = this.orderExecutorCache.get(r, ce.Redeem), a = (u = r.destination_swap.initiate_tx_hash.split(",").at(-1)) == null ? void 0 : u.split(":").at(0);
|
|
2965
2969
|
if (!a) {
|
|
2966
2970
|
this.emit("error", r, "Failed to get initiate_tx_hash");
|
|
2967
2971
|
return;
|
|
2968
2972
|
}
|
|
2969
|
-
console.log("initTx :", a);
|
|
2970
2973
|
let f = !1;
|
|
2971
2974
|
if (i)
|
|
2972
|
-
if (
|
|
2975
|
+
if (i.btcRedeemUTXO && i.btcRedeemUTXO !== a)
|
|
2973
2976
|
f = !0, this.emit("log", r.create_order.create_id, "rbf btc redeem");
|
|
2974
2977
|
else {
|
|
2975
2978
|
this.emit(
|
|
@@ -2979,7 +2982,38 @@ class ll {
|
|
|
2979
2982
|
);
|
|
2980
2983
|
return;
|
|
2981
2984
|
}
|
|
2982
|
-
|
|
2985
|
+
else if (r.destination_swap.redeem_tx_hash && !Number(r.destination_swap.redeem_block_number))
|
|
2986
|
+
try {
|
|
2987
|
+
const b = await (await t.getProvider()).getTransaction(r.destination_swap.redeem_tx_hash);
|
|
2988
|
+
let g = !1;
|
|
2989
|
+
for (const m of b.vin)
|
|
2990
|
+
if (m.txid === a) {
|
|
2991
|
+
g = !0;
|
|
2992
|
+
break;
|
|
2993
|
+
}
|
|
2994
|
+
if (g) {
|
|
2995
|
+
this.emit(
|
|
2996
|
+
"log",
|
|
2997
|
+
r.create_order.create_id,
|
|
2998
|
+
"already a valid redeem"
|
|
2999
|
+
), this.orderExecutorCache.set(
|
|
3000
|
+
r,
|
|
3001
|
+
ce.Redeem,
|
|
3002
|
+
r.destination_swap.redeem_tx_hash,
|
|
3003
|
+
a
|
|
3004
|
+
);
|
|
3005
|
+
return;
|
|
3006
|
+
}
|
|
3007
|
+
f = !0;
|
|
3008
|
+
} catch (b) {
|
|
3009
|
+
if (b.message.includes("Transaction not found"))
|
|
3010
|
+
f = !0;
|
|
3011
|
+
else {
|
|
3012
|
+
this.emit("error", r, "Failed to get redeem tx: " + b);
|
|
3013
|
+
return;
|
|
3014
|
+
}
|
|
3015
|
+
}
|
|
3016
|
+
this.emit("log", r.create_order.create_id, "executing btc redeem");
|
|
2983
3017
|
try {
|
|
2984
3018
|
const g = await (await pr.from(
|
|
2985
3019
|
t,
|
|
@@ -2993,14 +3027,14 @@ class ll {
|
|
|
2993
3027
|
nt(n),
|
|
2994
3028
|
(l = r.create_order.additional_data) == null ? void 0 : l.bitcoin_optional_recipient
|
|
2995
3029
|
);
|
|
2996
|
-
this.emit("success", r,
|
|
2997
|
-
} catch (
|
|
2998
|
-
this.emit("error", r, "Failed btc redeem: " +
|
|
3030
|
+
this.emit("success", r, ce.Redeem, g), this.orderExecutorCache.set(r, ce.Redeem, g, a);
|
|
3031
|
+
} catch (b) {
|
|
3032
|
+
this.emit("error", r, "Failed btc redeem: " + b);
|
|
2999
3033
|
}
|
|
3000
3034
|
}
|
|
3001
3035
|
async btcRefund(t, r) {
|
|
3002
3036
|
var n;
|
|
3003
|
-
if (!this.orderExecutorCache.get(r,
|
|
3037
|
+
if (!this.orderExecutorCache.get(r, ce.Refund)) {
|
|
3004
3038
|
this.emit("log", r.create_order.create_id, "executing btc refund");
|
|
3005
3039
|
try {
|
|
3006
3040
|
const a = await (await pr.from(
|
|
@@ -3013,7 +3047,7 @@ class ll {
|
|
|
3013
3047
|
)).refund(
|
|
3014
3048
|
(n = r.create_order.additional_data) == null ? void 0 : n.bitcoin_optional_recipient
|
|
3015
3049
|
);
|
|
3016
|
-
this.emit("success", r,
|
|
3050
|
+
this.emit("success", r, ce.Refund, a), this.orderExecutorCache.set(r, ce.Refund, a);
|
|
3017
3051
|
} catch (i) {
|
|
3018
3052
|
this.emit("error", r, "Failed btc refund: " + i);
|
|
3019
3053
|
}
|
|
@@ -3026,7 +3060,7 @@ class ll {
|
|
|
3026
3060
|
case ke.Bitcoin:
|
|
3027
3061
|
return fe(this.wallets.btcWallet);
|
|
3028
3062
|
default:
|
|
3029
|
-
return
|
|
3063
|
+
return N("Unsupported chain for wallet");
|
|
3030
3064
|
}
|
|
3031
3065
|
}
|
|
3032
3066
|
on(t, r) {
|
|
@@ -3039,15 +3073,15 @@ class ll {
|
|
|
3039
3073
|
}
|
|
3040
3074
|
async fetchCurrentBlockNumbers(t, r) {
|
|
3041
3075
|
if (!r || !r.source || !r.destination)
|
|
3042
|
-
return
|
|
3076
|
+
return N("Provide wallets to fetch the current block number");
|
|
3043
3077
|
const n = nr(t.source_swap.chain) ? await Ln(
|
|
3044
3078
|
await r.source.getProvider()
|
|
3045
3079
|
) : await Zr(r.source);
|
|
3046
|
-
if (n.error) return
|
|
3080
|
+
if (n.error) return N(n.error);
|
|
3047
3081
|
const i = nr(t.destination_swap.chain) ? await Ln(
|
|
3048
3082
|
await r.destination.getProvider()
|
|
3049
3083
|
) : await Zr(r.destination);
|
|
3050
|
-
return i.error ?
|
|
3084
|
+
return i.error ? N(i.error) : fe({
|
|
3051
3085
|
source: n.val,
|
|
3052
3086
|
destination: i.val
|
|
3053
3087
|
});
|
|
@@ -3190,9 +3224,9 @@ var ts = {
|
|
|
3190
3224
|
tfSubError: ff,
|
|
3191
3225
|
tfJSON: br,
|
|
3192
3226
|
getValueTypeName: Bn
|
|
3193
|
-
},
|
|
3227
|
+
}, Mr, Xn;
|
|
3194
3228
|
function uf() {
|
|
3195
|
-
if (Xn) return
|
|
3229
|
+
if (Xn) return Mr;
|
|
3196
3230
|
Xn = 1;
|
|
3197
3231
|
var e = En, t = ts;
|
|
3198
3232
|
function r(S) {
|
|
@@ -3202,28 +3236,28 @@ function uf() {
|
|
|
3202
3236
|
return typeof S == "string" && /^([0-9a-f]{2})+$/i.test(S);
|
|
3203
3237
|
}
|
|
3204
3238
|
function i(S, z) {
|
|
3205
|
-
var
|
|
3239
|
+
var M = S.toJSON();
|
|
3206
3240
|
function $(se) {
|
|
3207
3241
|
if (!S(se)) return !1;
|
|
3208
3242
|
if (se.length === z) return !0;
|
|
3209
|
-
throw t.tfCustomError(
|
|
3243
|
+
throw t.tfCustomError(M + "(Length: " + z + ")", M + "(Length: " + se.length + ")");
|
|
3210
3244
|
}
|
|
3211
3245
|
return $.toJSON = function() {
|
|
3212
|
-
return
|
|
3246
|
+
return M;
|
|
3213
3247
|
}, $;
|
|
3214
3248
|
}
|
|
3215
3249
|
var a = i.bind(null, e.Array), f = i.bind(null, r), u = i.bind(null, n), l = i.bind(null, e.String);
|
|
3216
|
-
function
|
|
3217
|
-
|
|
3250
|
+
function b(S, z, M) {
|
|
3251
|
+
M = M || e.Number;
|
|
3218
3252
|
function $(se, Te) {
|
|
3219
|
-
return
|
|
3253
|
+
return M(se, Te) && se > S && se < z;
|
|
3220
3254
|
}
|
|
3221
3255
|
return $.toJSON = function() {
|
|
3222
|
-
return `${
|
|
3256
|
+
return `${M.toJSON()} between [${S}, ${z}]`;
|
|
3223
3257
|
}, $;
|
|
3224
3258
|
}
|
|
3225
3259
|
var g = Math.pow(2, 53) - 1;
|
|
3226
|
-
function
|
|
3260
|
+
function m(S) {
|
|
3227
3261
|
return typeof S == "number" && isFinite(S);
|
|
3228
3262
|
}
|
|
3229
3263
|
function E(S) {
|
|
@@ -3254,14 +3288,14 @@ function uf() {
|
|
|
3254
3288
|
ArrayN: a,
|
|
3255
3289
|
Buffer: r,
|
|
3256
3290
|
BufferN: f,
|
|
3257
|
-
Finite:
|
|
3291
|
+
Finite: m,
|
|
3258
3292
|
Hex: n,
|
|
3259
3293
|
HexN: u,
|
|
3260
3294
|
Int8: E,
|
|
3261
3295
|
Int16: I,
|
|
3262
3296
|
Int32: v,
|
|
3263
3297
|
Int53: P,
|
|
3264
|
-
Range:
|
|
3298
|
+
Range: b,
|
|
3265
3299
|
StringN: l,
|
|
3266
3300
|
UInt8: T,
|
|
3267
3301
|
UInt16: C,
|
|
@@ -3272,17 +3306,17 @@ function uf() {
|
|
|
3272
3306
|
L[U].toJSON = (function(S) {
|
|
3273
3307
|
return S;
|
|
3274
3308
|
}).bind(null, U);
|
|
3275
|
-
return
|
|
3309
|
+
return Mr = L, Mr;
|
|
3276
3310
|
}
|
|
3277
|
-
var Jt = ts,
|
|
3311
|
+
var Jt = ts, le = En, De = Jt.tfJSON, rs = Jt.TfTypeError, ns = Jt.TfPropertyTypeError, Nt = Jt.tfSubError, cf = Jt.getValueTypeName, $e = {
|
|
3278
3312
|
arrayOf: function(t, r) {
|
|
3279
3313
|
t = Ue(t), r = r || {};
|
|
3280
3314
|
function n(i, a) {
|
|
3281
|
-
return !
|
|
3315
|
+
return !le.Array(i) || le.Nil(i) || r.minLength !== void 0 && i.length < r.minLength || r.maxLength !== void 0 && i.length > r.maxLength || r.length !== void 0 && i.length !== r.length ? !1 : i.every(function(f, u) {
|
|
3282
3316
|
try {
|
|
3283
3317
|
return _e(t, f, a);
|
|
3284
3318
|
} catch (l) {
|
|
3285
|
-
throw
|
|
3319
|
+
throw Nt(l, u);
|
|
3286
3320
|
}
|
|
3287
3321
|
});
|
|
3288
3322
|
}
|
|
@@ -3294,7 +3328,7 @@ var Jt = ts, ce = En, De = Jt.tfJSON, rs = Jt.TfTypeError, ns = Jt.TfPropertyTyp
|
|
|
3294
3328
|
maybe: function e(t) {
|
|
3295
3329
|
t = Ue(t);
|
|
3296
3330
|
function r(n, i) {
|
|
3297
|
-
return
|
|
3331
|
+
return le.Nil(n) || t(n, i, e);
|
|
3298
3332
|
}
|
|
3299
3333
|
return r.toJSON = function() {
|
|
3300
3334
|
return "?" + De(t);
|
|
@@ -3303,18 +3337,18 @@ var Jt = ts, ce = En, De = Jt.tfJSON, rs = Jt.TfTypeError, ns = Jt.TfPropertyTyp
|
|
|
3303
3337
|
map: function(t, r) {
|
|
3304
3338
|
t = Ue(t), r && (r = Ue(r));
|
|
3305
3339
|
function n(i, a) {
|
|
3306
|
-
if (!
|
|
3340
|
+
if (!le.Object(i) || le.Nil(i)) return !1;
|
|
3307
3341
|
for (var f in i) {
|
|
3308
3342
|
try {
|
|
3309
3343
|
r && _e(r, f, a);
|
|
3310
3344
|
} catch (l) {
|
|
3311
|
-
throw
|
|
3345
|
+
throw Nt(l, f, "key");
|
|
3312
3346
|
}
|
|
3313
3347
|
try {
|
|
3314
3348
|
var u = i[f];
|
|
3315
3349
|
_e(t, u, a);
|
|
3316
3350
|
} catch (l) {
|
|
3317
|
-
throw
|
|
3351
|
+
throw Nt(l, f);
|
|
3318
3352
|
}
|
|
3319
3353
|
}
|
|
3320
3354
|
return !0;
|
|
@@ -3330,15 +3364,15 @@ var Jt = ts, ce = En, De = Jt.tfJSON, rs = Jt.TfTypeError, ns = Jt.TfPropertyTyp
|
|
|
3330
3364
|
for (var n in t)
|
|
3331
3365
|
r[n] = Ue(t[n]);
|
|
3332
3366
|
function i(a, f) {
|
|
3333
|
-
if (!
|
|
3367
|
+
if (!le.Object(a) || le.Nil(a)) return !1;
|
|
3334
3368
|
var u;
|
|
3335
3369
|
try {
|
|
3336
3370
|
for (u in r) {
|
|
3337
|
-
var l = r[u],
|
|
3338
|
-
_e(l,
|
|
3371
|
+
var l = r[u], b = a[u];
|
|
3372
|
+
_e(l, b, f);
|
|
3339
3373
|
}
|
|
3340
3374
|
} catch (g) {
|
|
3341
|
-
throw
|
|
3375
|
+
throw Nt(g, u);
|
|
3342
3376
|
}
|
|
3343
3377
|
if (f) {
|
|
3344
3378
|
for (u in a)
|
|
@@ -3392,11 +3426,11 @@ var Jt = ts, ce = En, De = Jt.tfJSON, rs = Jt.TfTypeError, ns = Jt.TfPropertyTyp
|
|
|
3392
3426
|
tuple: function() {
|
|
3393
3427
|
var t = [].slice.call(arguments).map(Ue);
|
|
3394
3428
|
function r(n, i) {
|
|
3395
|
-
return
|
|
3429
|
+
return le.Nil(n) || le.Nil(n.length) || i && n.length !== t.length ? !1 : t.every(function(a, f) {
|
|
3396
3430
|
try {
|
|
3397
3431
|
return _e(a, n[f], i);
|
|
3398
3432
|
} catch (u) {
|
|
3399
|
-
throw
|
|
3433
|
+
throw Nt(u, f);
|
|
3400
3434
|
}
|
|
3401
3435
|
});
|
|
3402
3436
|
}
|
|
@@ -3415,27 +3449,27 @@ var Jt = ts, ce = En, De = Jt.tfJSON, rs = Jt.TfTypeError, ns = Jt.TfPropertyTyp
|
|
|
3415
3449
|
};
|
|
3416
3450
|
$e.oneOf = $e.anyOf;
|
|
3417
3451
|
function Ue(e) {
|
|
3418
|
-
if (
|
|
3419
|
-
return e[0] === "?" ? $e.maybe(e.slice(1)) :
|
|
3420
|
-
if (e &&
|
|
3421
|
-
if (
|
|
3452
|
+
if (le.String(e))
|
|
3453
|
+
return e[0] === "?" ? $e.maybe(e.slice(1)) : le[e] || $e.quacksLike(e);
|
|
3454
|
+
if (e && le.Object(e)) {
|
|
3455
|
+
if (le.Array(e)) {
|
|
3422
3456
|
if (e.length !== 1) throw new TypeError("Expected compile() parameter of type Array of length 1");
|
|
3423
3457
|
return $e.arrayOf(e[0]);
|
|
3424
3458
|
}
|
|
3425
3459
|
return $e.object(e);
|
|
3426
|
-
} else if (
|
|
3460
|
+
} else if (le.Function(e))
|
|
3427
3461
|
return e;
|
|
3428
3462
|
return $e.value(e);
|
|
3429
3463
|
}
|
|
3430
3464
|
function _e(e, t, r, n) {
|
|
3431
|
-
if (
|
|
3465
|
+
if (le.Function(e)) {
|
|
3432
3466
|
if (e(t, r)) return !0;
|
|
3433
3467
|
throw new rs(n || e, t);
|
|
3434
3468
|
}
|
|
3435
3469
|
return _e(Ue(e), t, r);
|
|
3436
3470
|
}
|
|
3437
|
-
for (var Je in
|
|
3438
|
-
_e[Je] =
|
|
3471
|
+
for (var Je in le)
|
|
3472
|
+
_e[Je] = le[Je];
|
|
3439
3473
|
for (Je in $e)
|
|
3440
3474
|
_e[Je] = $e[Je];
|
|
3441
3475
|
var Qn = uf();
|
|
@@ -3511,25 +3545,25 @@ function wf(e) {
|
|
|
3511
3545
|
var In = {};
|
|
3512
3546
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
3513
3547
|
In.read = function(e, t, r, n, i) {
|
|
3514
|
-
var a, f, u = i * 8 - n - 1, l = (1 << u) - 1,
|
|
3515
|
-
for (
|
|
3548
|
+
var a, f, u = i * 8 - n - 1, l = (1 << u) - 1, b = l >> 1, g = -7, m = r ? i - 1 : 0, E = r ? -1 : 1, I = e[t + m];
|
|
3549
|
+
for (m += E, a = I & (1 << -g) - 1, I >>= -g, g += u; g > 0; a = a * 256 + e[t + m], m += E, g -= 8)
|
|
3516
3550
|
;
|
|
3517
|
-
for (f = a & (1 << -g) - 1, a >>= -g, g += n; g > 0; f = f * 256 + e[t +
|
|
3551
|
+
for (f = a & (1 << -g) - 1, a >>= -g, g += n; g > 0; f = f * 256 + e[t + m], m += E, g -= 8)
|
|
3518
3552
|
;
|
|
3519
3553
|
if (a === 0)
|
|
3520
|
-
a = 1 -
|
|
3554
|
+
a = 1 - b;
|
|
3521
3555
|
else {
|
|
3522
3556
|
if (a === l)
|
|
3523
3557
|
return f ? NaN : (I ? -1 : 1) * (1 / 0);
|
|
3524
|
-
f = f + Math.pow(2, n), a = a -
|
|
3558
|
+
f = f + Math.pow(2, n), a = a - b;
|
|
3525
3559
|
}
|
|
3526
3560
|
return (I ? -1 : 1) * f * Math.pow(2, a - n);
|
|
3527
3561
|
};
|
|
3528
3562
|
In.write = function(e, t, r, n, i, a) {
|
|
3529
|
-
var f, u, l,
|
|
3530
|
-
for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (u = isNaN(t) ? 1 : 0, f = g) : (f = Math.floor(Math.log(t) / Math.LN2), t * (l = Math.pow(2, -f)) < 1 && (f--, l *= 2), f +
|
|
3563
|
+
var f, u, l, b = a * 8 - i - 1, g = (1 << b) - 1, m = g >> 1, E = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, I = n ? 0 : a - 1, v = n ? 1 : -1, P = t < 0 || t === 0 && 1 / t < 0 ? 1 : 0;
|
|
3564
|
+
for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (u = isNaN(t) ? 1 : 0, f = g) : (f = Math.floor(Math.log(t) / Math.LN2), t * (l = Math.pow(2, -f)) < 1 && (f--, l *= 2), f + m >= 1 ? t += E / l : t += E * Math.pow(2, 1 - m), t * l >= 2 && (f++, l /= 2), f + m >= g ? (u = 0, f = g) : f + m >= 1 ? (u = (t * l - 1) * Math.pow(2, i), f = f + m) : (u = t * Math.pow(2, m - 1) * Math.pow(2, i), f = 0)); i >= 8; e[r + I] = u & 255, I += v, u /= 256, i -= 8)
|
|
3531
3565
|
;
|
|
3532
|
-
for (f = f << i | u,
|
|
3566
|
+
for (f = f << i | u, b += i; b > 0; e[r + I] = f & 255, I += v, f /= 256, b -= 8)
|
|
3533
3567
|
;
|
|
3534
3568
|
e[r + I - v] |= P * 128;
|
|
3535
3569
|
};
|
|
@@ -3581,7 +3615,7 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3581
3615
|
throw new TypeError(
|
|
3582
3616
|
'The "string" argument must be of type string. Received type number'
|
|
3583
3617
|
);
|
|
3584
|
-
return
|
|
3618
|
+
return m(c);
|
|
3585
3619
|
}
|
|
3586
3620
|
return l(c, s, o);
|
|
3587
3621
|
}
|
|
@@ -3604,8 +3638,8 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3604
3638
|
const h = c.valueOf && c.valueOf();
|
|
3605
3639
|
if (h != null && h !== c)
|
|
3606
3640
|
return u.from(h, s, o);
|
|
3607
|
-
const
|
|
3608
|
-
if (
|
|
3641
|
+
const y = T(c);
|
|
3642
|
+
if (y) return y;
|
|
3609
3643
|
if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof c[Symbol.toPrimitive] == "function")
|
|
3610
3644
|
return u.from(c[Symbol.toPrimitive]("string"), s, o);
|
|
3611
3645
|
throw new TypeError(
|
|
@@ -3615,33 +3649,33 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3615
3649
|
u.from = function(c, s, o) {
|
|
3616
3650
|
return l(c, s, o);
|
|
3617
3651
|
}, Object.setPrototypeOf(u.prototype, Uint8Array.prototype), Object.setPrototypeOf(u, Uint8Array);
|
|
3618
|
-
function
|
|
3652
|
+
function b(c) {
|
|
3619
3653
|
if (typeof c != "number")
|
|
3620
3654
|
throw new TypeError('"size" argument must be of type number');
|
|
3621
3655
|
if (c < 0)
|
|
3622
3656
|
throw new RangeError('The value "' + c + '" is invalid for option "size"');
|
|
3623
3657
|
}
|
|
3624
3658
|
function g(c, s, o) {
|
|
3625
|
-
return
|
|
3659
|
+
return b(c), c <= 0 ? f(c) : s !== void 0 ? typeof o == "string" ? f(c).fill(s, o) : f(c).fill(s) : f(c);
|
|
3626
3660
|
}
|
|
3627
3661
|
u.alloc = function(c, s, o) {
|
|
3628
3662
|
return g(c, s, o);
|
|
3629
3663
|
};
|
|
3630
|
-
function
|
|
3631
|
-
return
|
|
3664
|
+
function m(c) {
|
|
3665
|
+
return b(c), f(c < 0 ? 0 : C(c) | 0);
|
|
3632
3666
|
}
|
|
3633
3667
|
u.allocUnsafe = function(c) {
|
|
3634
|
-
return
|
|
3668
|
+
return m(c);
|
|
3635
3669
|
}, u.allocUnsafeSlow = function(c) {
|
|
3636
|
-
return
|
|
3670
|
+
return m(c);
|
|
3637
3671
|
};
|
|
3638
3672
|
function E(c, s) {
|
|
3639
3673
|
if ((typeof s != "string" || s === "") && (s = "utf8"), !u.isEncoding(s))
|
|
3640
3674
|
throw new TypeError("Unknown encoding: " + s);
|
|
3641
3675
|
const o = k(c, s) | 0;
|
|
3642
3676
|
let h = f(o);
|
|
3643
|
-
const
|
|
3644
|
-
return
|
|
3677
|
+
const y = h.write(c, s);
|
|
3678
|
+
return y !== o && (h = h.slice(0, y)), h;
|
|
3645
3679
|
}
|
|
3646
3680
|
function I(c) {
|
|
3647
3681
|
const s = c.length < 0 ? 0 : C(c.length) | 0, o = f(s);
|
|
@@ -3690,13 +3724,13 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3690
3724
|
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
|
3691
3725
|
);
|
|
3692
3726
|
if (s === o) return 0;
|
|
3693
|
-
let h = s.length,
|
|
3694
|
-
for (let x = 0, B = Math.min(h,
|
|
3727
|
+
let h = s.length, y = o.length;
|
|
3728
|
+
for (let x = 0, B = Math.min(h, y); x < B; ++x)
|
|
3695
3729
|
if (s[x] !== o[x]) {
|
|
3696
|
-
h = s[x],
|
|
3730
|
+
h = s[x], y = o[x];
|
|
3697
3731
|
break;
|
|
3698
3732
|
}
|
|
3699
|
-
return h <
|
|
3733
|
+
return h < y ? -1 : y < h ? 1 : 0;
|
|
3700
3734
|
}, u.isEncoding = function(s) {
|
|
3701
3735
|
switch (String(s).toLowerCase()) {
|
|
3702
3736
|
case "hex":
|
|
@@ -3723,23 +3757,23 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3723
3757
|
if (o === void 0)
|
|
3724
3758
|
for (o = 0, h = 0; h < s.length; ++h)
|
|
3725
3759
|
o += s[h].length;
|
|
3726
|
-
const
|
|
3760
|
+
const y = u.allocUnsafe(o);
|
|
3727
3761
|
let x = 0;
|
|
3728
3762
|
for (h = 0; h < s.length; ++h) {
|
|
3729
3763
|
let B = s[h];
|
|
3730
3764
|
if (Se(B, Uint8Array))
|
|
3731
|
-
x + B.length >
|
|
3732
|
-
|
|
3765
|
+
x + B.length > y.length ? (u.isBuffer(B) || (B = u.from(B)), B.copy(y, x)) : Uint8Array.prototype.set.call(
|
|
3766
|
+
y,
|
|
3733
3767
|
B,
|
|
3734
3768
|
x
|
|
3735
3769
|
);
|
|
3736
3770
|
else if (u.isBuffer(B))
|
|
3737
|
-
B.copy(
|
|
3771
|
+
B.copy(y, x);
|
|
3738
3772
|
else
|
|
3739
3773
|
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
3740
3774
|
x += B.length;
|
|
3741
3775
|
}
|
|
3742
|
-
return
|
|
3776
|
+
return y;
|
|
3743
3777
|
};
|
|
3744
3778
|
function k(c, s) {
|
|
3745
3779
|
if (u.isBuffer(c))
|
|
@@ -3752,7 +3786,7 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3752
3786
|
);
|
|
3753
3787
|
const o = c.length, h = arguments.length > 2 && arguments[2] === !0;
|
|
3754
3788
|
if (!h && o === 0) return 0;
|
|
3755
|
-
let
|
|
3789
|
+
let y = !1;
|
|
3756
3790
|
for (; ; )
|
|
3757
3791
|
switch (s) {
|
|
3758
3792
|
case "ascii":
|
|
@@ -3772,9 +3806,9 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3772
3806
|
case "base64":
|
|
3773
3807
|
return Pt(c).length;
|
|
3774
3808
|
default:
|
|
3775
|
-
if (
|
|
3809
|
+
if (y)
|
|
3776
3810
|
return h ? -1 : V(c).length;
|
|
3777
|
-
s = ("" + s).toLowerCase(),
|
|
3811
|
+
s = ("" + s).toLowerCase(), y = !0;
|
|
3778
3812
|
}
|
|
3779
3813
|
}
|
|
3780
3814
|
u.byteLength = k;
|
|
@@ -3842,22 +3876,22 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3842
3876
|
let s = "";
|
|
3843
3877
|
const o = e.INSPECT_MAX_BYTES;
|
|
3844
3878
|
return s = this.toString("hex", 0, o).replace(/(.{2})/g, "$1 ").trim(), this.length > o && (s += " ... "), "<Buffer " + s + ">";
|
|
3845
|
-
}, n && (u.prototype[n] = u.prototype.inspect), u.prototype.compare = function(s, o, h,
|
|
3879
|
+
}, n && (u.prototype[n] = u.prototype.inspect), u.prototype.compare = function(s, o, h, y, x) {
|
|
3846
3880
|
if (Se(s, Uint8Array) && (s = u.from(s, s.offset, s.byteLength)), !u.isBuffer(s))
|
|
3847
3881
|
throw new TypeError(
|
|
3848
3882
|
'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof s
|
|
3849
3883
|
);
|
|
3850
|
-
if (o === void 0 && (o = 0), h === void 0 && (h = s ? s.length : 0),
|
|
3884
|
+
if (o === void 0 && (o = 0), h === void 0 && (h = s ? s.length : 0), y === void 0 && (y = 0), x === void 0 && (x = this.length), o < 0 || h > s.length || y < 0 || x > this.length)
|
|
3851
3885
|
throw new RangeError("out of range index");
|
|
3852
|
-
if (
|
|
3886
|
+
if (y >= x && o >= h)
|
|
3853
3887
|
return 0;
|
|
3854
|
-
if (
|
|
3888
|
+
if (y >= x)
|
|
3855
3889
|
return -1;
|
|
3856
3890
|
if (o >= h)
|
|
3857
3891
|
return 1;
|
|
3858
|
-
if (o >>>= 0, h >>>= 0,
|
|
3859
|
-
let B = x -
|
|
3860
|
-
const ne = Math.min(B, q), ee = this.slice(
|
|
3892
|
+
if (o >>>= 0, h >>>= 0, y >>>= 0, x >>>= 0, this === s) return 0;
|
|
3893
|
+
let B = x - y, q = h - o;
|
|
3894
|
+
const ne = Math.min(B, q), ee = this.slice(y, x), ie = s.slice(o, h);
|
|
3861
3895
|
for (let Y = 0; Y < ne; ++Y)
|
|
3862
3896
|
if (ee[Y] !== ie[Y]) {
|
|
3863
3897
|
B = ee[Y], q = ie[Y];
|
|
@@ -3865,21 +3899,21 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3865
3899
|
}
|
|
3866
3900
|
return B < q ? -1 : q < B ? 1 : 0;
|
|
3867
3901
|
};
|
|
3868
|
-
function S(c, s, o, h,
|
|
3902
|
+
function S(c, s, o, h, y) {
|
|
3869
3903
|
if (c.length === 0) return -1;
|
|
3870
|
-
if (typeof o == "string" ? (h = o, o = 0) : o > 2147483647 ? o = 2147483647 : o < -2147483648 && (o = -2147483648), o = +o, tt(o) && (o =
|
|
3871
|
-
if (
|
|
3904
|
+
if (typeof o == "string" ? (h = o, o = 0) : o > 2147483647 ? o = 2147483647 : o < -2147483648 && (o = -2147483648), o = +o, tt(o) && (o = y ? 0 : c.length - 1), o < 0 && (o = c.length + o), o >= c.length) {
|
|
3905
|
+
if (y) return -1;
|
|
3872
3906
|
o = c.length - 1;
|
|
3873
3907
|
} else if (o < 0)
|
|
3874
|
-
if (
|
|
3908
|
+
if (y) o = 0;
|
|
3875
3909
|
else return -1;
|
|
3876
3910
|
if (typeof s == "string" && (s = u.from(s, h)), u.isBuffer(s))
|
|
3877
|
-
return s.length === 0 ? -1 : z(c, s, o, h,
|
|
3911
|
+
return s.length === 0 ? -1 : z(c, s, o, h, y);
|
|
3878
3912
|
if (typeof s == "number")
|
|
3879
|
-
return s = s & 255, typeof Uint8Array.prototype.indexOf == "function" ?
|
|
3913
|
+
return s = s & 255, typeof Uint8Array.prototype.indexOf == "function" ? y ? Uint8Array.prototype.indexOf.call(c, s, o) : Uint8Array.prototype.lastIndexOf.call(c, s, o) : z(c, [s], o, h, y);
|
|
3880
3914
|
throw new TypeError("val must be string, number or Buffer");
|
|
3881
3915
|
}
|
|
3882
|
-
function z(c, s, o, h,
|
|
3916
|
+
function z(c, s, o, h, y) {
|
|
3883
3917
|
let x = 1, B = c.length, q = s.length;
|
|
3884
3918
|
if (h !== void 0 && (h = String(h).toLowerCase(), h === "ucs2" || h === "ucs-2" || h === "utf16le" || h === "utf-16le")) {
|
|
3885
3919
|
if (c.length < 2 || s.length < 2)
|
|
@@ -3890,7 +3924,7 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3890
3924
|
return x === 1 ? ie[Y] : ie.readUInt16BE(Y * x);
|
|
3891
3925
|
}
|
|
3892
3926
|
let ee;
|
|
3893
|
-
if (
|
|
3927
|
+
if (y) {
|
|
3894
3928
|
let ie = -1;
|
|
3895
3929
|
for (ee = o; ee < B; ee++)
|
|
3896
3930
|
if (ne(c, ee) === ne(s, ie === -1 ? 0 : ee - ie)) {
|
|
@@ -3916,10 +3950,10 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3916
3950
|
}, u.prototype.lastIndexOf = function(s, o, h) {
|
|
3917
3951
|
return S(this, s, o, h, !1);
|
|
3918
3952
|
};
|
|
3919
|
-
function
|
|
3953
|
+
function M(c, s, o, h) {
|
|
3920
3954
|
o = Number(o) || 0;
|
|
3921
|
-
const
|
|
3922
|
-
h ? (h = Number(h), h >
|
|
3955
|
+
const y = c.length - o;
|
|
3956
|
+
h ? (h = Number(h), h > y && (h = y)) : h = y;
|
|
3923
3957
|
const x = s.length;
|
|
3924
3958
|
h > x / 2 && (h = x / 2);
|
|
3925
3959
|
let B;
|
|
@@ -3942,13 +3976,13 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3942
3976
|
function Ge(c, s, o, h) {
|
|
3943
3977
|
return dt(ht(s, c.length - o), c, o, h);
|
|
3944
3978
|
}
|
|
3945
|
-
u.prototype.write = function(s, o, h,
|
|
3979
|
+
u.prototype.write = function(s, o, h, y) {
|
|
3946
3980
|
if (o === void 0)
|
|
3947
|
-
|
|
3981
|
+
y = "utf8", h = this.length, o = 0;
|
|
3948
3982
|
else if (h === void 0 && typeof o == "string")
|
|
3949
|
-
|
|
3983
|
+
y = o, h = this.length, o = 0;
|
|
3950
3984
|
else if (isFinite(o))
|
|
3951
|
-
o = o >>> 0, isFinite(h) ? (h = h >>> 0,
|
|
3985
|
+
o = o >>> 0, isFinite(h) ? (h = h >>> 0, y === void 0 && (y = "utf8")) : (y = h, h = void 0);
|
|
3952
3986
|
else
|
|
3953
3987
|
throw new Error(
|
|
3954
3988
|
"Buffer.write(string, encoding, offset[, length]) is no longer supported"
|
|
@@ -3956,12 +3990,12 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3956
3990
|
const x = this.length - o;
|
|
3957
3991
|
if ((h === void 0 || h > x) && (h = x), s.length > 0 && (h < 0 || o < 0) || o > this.length)
|
|
3958
3992
|
throw new RangeError("Attempt to write outside buffer bounds");
|
|
3959
|
-
|
|
3993
|
+
y || (y = "utf8");
|
|
3960
3994
|
let B = !1;
|
|
3961
3995
|
for (; ; )
|
|
3962
|
-
switch (
|
|
3996
|
+
switch (y) {
|
|
3963
3997
|
case "hex":
|
|
3964
|
-
return
|
|
3998
|
+
return M(this, s, o, h);
|
|
3965
3999
|
case "utf8":
|
|
3966
4000
|
case "utf-8":
|
|
3967
4001
|
return $(this, s, o, h);
|
|
@@ -3977,8 +4011,8 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3977
4011
|
case "utf-16le":
|
|
3978
4012
|
return Ge(this, s, o, h);
|
|
3979
4013
|
default:
|
|
3980
|
-
if (B) throw new TypeError("Unknown encoding: " +
|
|
3981
|
-
|
|
4014
|
+
if (B) throw new TypeError("Unknown encoding: " + y);
|
|
4015
|
+
y = ("" + y).toLowerCase(), B = !0;
|
|
3982
4016
|
}
|
|
3983
4017
|
}, u.prototype.toJSON = function() {
|
|
3984
4018
|
return {
|
|
@@ -3992,27 +4026,27 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3992
4026
|
function xe(c, s, o) {
|
|
3993
4027
|
o = Math.min(c.length, o);
|
|
3994
4028
|
const h = [];
|
|
3995
|
-
let
|
|
3996
|
-
for (;
|
|
3997
|
-
const x = c[
|
|
4029
|
+
let y = s;
|
|
4030
|
+
for (; y < o; ) {
|
|
4031
|
+
const x = c[y];
|
|
3998
4032
|
let B = null, q = x > 239 ? 4 : x > 223 ? 3 : x > 191 ? 2 : 1;
|
|
3999
|
-
if (
|
|
4033
|
+
if (y + q <= o) {
|
|
4000
4034
|
let ne, ee, ie, Y;
|
|
4001
4035
|
switch (q) {
|
|
4002
4036
|
case 1:
|
|
4003
4037
|
x < 128 && (B = x);
|
|
4004
4038
|
break;
|
|
4005
4039
|
case 2:
|
|
4006
|
-
ne = c[
|
|
4040
|
+
ne = c[y + 1], (ne & 192) === 128 && (Y = (x & 31) << 6 | ne & 63, Y > 127 && (B = Y));
|
|
4007
4041
|
break;
|
|
4008
4042
|
case 3:
|
|
4009
|
-
ne = c[
|
|
4043
|
+
ne = c[y + 1], ee = c[y + 2], (ne & 192) === 128 && (ee & 192) === 128 && (Y = (x & 15) << 12 | (ne & 63) << 6 | ee & 63, Y > 2047 && (Y < 55296 || Y > 57343) && (B = Y));
|
|
4010
4044
|
break;
|
|
4011
4045
|
case 4:
|
|
4012
|
-
ne = c[
|
|
4046
|
+
ne = c[y + 1], ee = c[y + 2], ie = c[y + 3], (ne & 192) === 128 && (ee & 192) === 128 && (ie & 192) === 128 && (Y = (x & 15) << 18 | (ne & 63) << 12 | (ee & 63) << 6 | ie & 63, Y > 65535 && Y < 1114112 && (B = Y));
|
|
4013
4047
|
}
|
|
4014
4048
|
}
|
|
4015
|
-
B === null ? (B = 65533, q = 1) : B > 65535 && (B -= 65536, h.push(B >>> 10 & 1023 | 55296), B = 56320 | B & 1023), h.push(B),
|
|
4049
|
+
B === null ? (B = 65533, q = 1) : B > 65535 && (B -= 65536, h.push(B >>> 10 & 1023 | 55296), B = 56320 | B & 1023), h.push(B), y += q;
|
|
4016
4050
|
}
|
|
4017
4051
|
return et(h);
|
|
4018
4052
|
}
|
|
@@ -4032,37 +4066,37 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4032
4066
|
function Pe(c, s, o) {
|
|
4033
4067
|
let h = "";
|
|
4034
4068
|
o = Math.min(c.length, o);
|
|
4035
|
-
for (let
|
|
4036
|
-
h += String.fromCharCode(c[
|
|
4069
|
+
for (let y = s; y < o; ++y)
|
|
4070
|
+
h += String.fromCharCode(c[y] & 127);
|
|
4037
4071
|
return h;
|
|
4038
4072
|
}
|
|
4039
4073
|
function je(c, s, o) {
|
|
4040
4074
|
let h = "";
|
|
4041
4075
|
o = Math.min(c.length, o);
|
|
4042
|
-
for (let
|
|
4043
|
-
h += String.fromCharCode(c[
|
|
4076
|
+
for (let y = s; y < o; ++y)
|
|
4077
|
+
h += String.fromCharCode(c[y]);
|
|
4044
4078
|
return h;
|
|
4045
4079
|
}
|
|
4046
4080
|
function Ce(c, s, o) {
|
|
4047
4081
|
const h = c.length;
|
|
4048
4082
|
(!s || s < 0) && (s = 0), (!o || o < 0 || o > h) && (o = h);
|
|
4049
|
-
let
|
|
4083
|
+
let y = "";
|
|
4050
4084
|
for (let x = s; x < o; ++x)
|
|
4051
|
-
|
|
4052
|
-
return
|
|
4085
|
+
y += Ct[c[x]];
|
|
4086
|
+
return y;
|
|
4053
4087
|
}
|
|
4054
4088
|
function We(c, s, o) {
|
|
4055
4089
|
const h = c.slice(s, o);
|
|
4056
|
-
let
|
|
4090
|
+
let y = "";
|
|
4057
4091
|
for (let x = 0; x < h.length - 1; x += 2)
|
|
4058
|
-
|
|
4059
|
-
return
|
|
4092
|
+
y += String.fromCharCode(h[x] + h[x + 1] * 256);
|
|
4093
|
+
return y;
|
|
4060
4094
|
}
|
|
4061
4095
|
u.prototype.slice = function(s, o) {
|
|
4062
4096
|
const h = this.length;
|
|
4063
4097
|
s = ~~s, o = o === void 0 ? h : ~~o, s < 0 ? (s += h, s < 0 && (s = 0)) : s > h && (s = h), o < 0 ? (o += h, o < 0 && (o = 0)) : o > h && (o = h), o < s && (o = s);
|
|
4064
|
-
const
|
|
4065
|
-
return Object.setPrototypeOf(
|
|
4098
|
+
const y = this.subarray(s, o);
|
|
4099
|
+
return Object.setPrototypeOf(y, u.prototype), y;
|
|
4066
4100
|
};
|
|
4067
4101
|
function Q(c, s, o) {
|
|
4068
4102
|
if (c % 1 !== 0 || c < 0) throw new RangeError("offset is not uint");
|
|
@@ -4070,16 +4104,16 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4070
4104
|
}
|
|
4071
4105
|
u.prototype.readUintLE = u.prototype.readUIntLE = function(s, o, h) {
|
|
4072
4106
|
s = s >>> 0, o = o >>> 0, h || Q(s, o, this.length);
|
|
4073
|
-
let
|
|
4107
|
+
let y = this[s], x = 1, B = 0;
|
|
4074
4108
|
for (; ++B < o && (x *= 256); )
|
|
4075
|
-
|
|
4076
|
-
return
|
|
4109
|
+
y += this[s + B] * x;
|
|
4110
|
+
return y;
|
|
4077
4111
|
}, u.prototype.readUintBE = u.prototype.readUIntBE = function(s, o, h) {
|
|
4078
4112
|
s = s >>> 0, o = o >>> 0, h || Q(s, o, this.length);
|
|
4079
|
-
let
|
|
4113
|
+
let y = this[s + --o], x = 1;
|
|
4080
4114
|
for (; o > 0 && (x *= 256); )
|
|
4081
|
-
|
|
4082
|
-
return
|
|
4115
|
+
y += this[s + --o] * x;
|
|
4116
|
+
return y;
|
|
4083
4117
|
}, u.prototype.readUint8 = u.prototype.readUInt8 = function(s, o) {
|
|
4084
4118
|
return s = s >>> 0, o || Q(s, 1, this.length), this[s];
|
|
4085
4119
|
}, u.prototype.readUint16LE = u.prototype.readUInt16LE = function(s, o) {
|
|
@@ -4094,25 +4128,25 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4094
4128
|
s = s >>> 0, A(s, "offset");
|
|
4095
4129
|
const o = this[s], h = this[s + 7];
|
|
4096
4130
|
(o === void 0 || h === void 0) && O(s, this.length - 8);
|
|
4097
|
-
const
|
|
4098
|
-
return BigInt(
|
|
4131
|
+
const y = o + this[++s] * 2 ** 8 + this[++s] * 2 ** 16 + this[++s] * 2 ** 24, x = this[++s] + this[++s] * 2 ** 8 + this[++s] * 2 ** 16 + h * 2 ** 24;
|
|
4132
|
+
return BigInt(y) + (BigInt(x) << BigInt(32));
|
|
4099
4133
|
}), u.prototype.readBigUInt64BE = Ie(function(s) {
|
|
4100
4134
|
s = s >>> 0, A(s, "offset");
|
|
4101
4135
|
const o = this[s], h = this[s + 7];
|
|
4102
4136
|
(o === void 0 || h === void 0) && O(s, this.length - 8);
|
|
4103
|
-
const
|
|
4104
|
-
return (BigInt(
|
|
4137
|
+
const y = o * 2 ** 24 + this[++s] * 2 ** 16 + this[++s] * 2 ** 8 + this[++s], x = this[++s] * 2 ** 24 + this[++s] * 2 ** 16 + this[++s] * 2 ** 8 + h;
|
|
4138
|
+
return (BigInt(y) << BigInt(32)) + BigInt(x);
|
|
4105
4139
|
}), u.prototype.readIntLE = function(s, o, h) {
|
|
4106
4140
|
s = s >>> 0, o = o >>> 0, h || Q(s, o, this.length);
|
|
4107
|
-
let
|
|
4141
|
+
let y = this[s], x = 1, B = 0;
|
|
4108
4142
|
for (; ++B < o && (x *= 256); )
|
|
4109
|
-
|
|
4110
|
-
return x *= 128,
|
|
4143
|
+
y += this[s + B] * x;
|
|
4144
|
+
return x *= 128, y >= x && (y -= Math.pow(2, 8 * o)), y;
|
|
4111
4145
|
}, u.prototype.readIntBE = function(s, o, h) {
|
|
4112
4146
|
s = s >>> 0, o = o >>> 0, h || Q(s, o, this.length);
|
|
4113
|
-
let
|
|
4114
|
-
for (;
|
|
4115
|
-
B += this[s + --
|
|
4147
|
+
let y = o, x = 1, B = this[s + --y];
|
|
4148
|
+
for (; y > 0 && (x *= 256); )
|
|
4149
|
+
B += this[s + --y] * x;
|
|
4116
4150
|
return x *= 128, B >= x && (B -= Math.pow(2, 8 * o)), B;
|
|
4117
4151
|
}, u.prototype.readInt8 = function(s, o) {
|
|
4118
4152
|
return s = s >>> 0, o || Q(s, 1, this.length), this[s] & 128 ? (255 - this[s] + 1) * -1 : this[s];
|
|
@@ -4132,15 +4166,15 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4132
4166
|
s = s >>> 0, A(s, "offset");
|
|
4133
4167
|
const o = this[s], h = this[s + 7];
|
|
4134
4168
|
(o === void 0 || h === void 0) && O(s, this.length - 8);
|
|
4135
|
-
const
|
|
4136
|
-
return (BigInt(
|
|
4169
|
+
const y = this[s + 4] + this[s + 5] * 2 ** 8 + this[s + 6] * 2 ** 16 + (h << 24);
|
|
4170
|
+
return (BigInt(y) << BigInt(32)) + BigInt(o + this[++s] * 2 ** 8 + this[++s] * 2 ** 16 + this[++s] * 2 ** 24);
|
|
4137
4171
|
}), u.prototype.readBigInt64BE = Ie(function(s) {
|
|
4138
4172
|
s = s >>> 0, A(s, "offset");
|
|
4139
4173
|
const o = this[s], h = this[s + 7];
|
|
4140
4174
|
(o === void 0 || h === void 0) && O(s, this.length - 8);
|
|
4141
|
-
const
|
|
4175
|
+
const y = (o << 24) + // Overflow
|
|
4142
4176
|
this[++s] * 2 ** 16 + this[++s] * 2 ** 8 + this[++s];
|
|
4143
|
-
return (BigInt(
|
|
4177
|
+
return (BigInt(y) << BigInt(32)) + BigInt(this[++s] * 2 ** 24 + this[++s] * 2 ** 16 + this[++s] * 2 ** 8 + h);
|
|
4144
4178
|
}), u.prototype.readFloatLE = function(s, o) {
|
|
4145
4179
|
return s = s >>> 0, o || Q(s, 4, this.length), r.read(this, s, !0, 23, 4);
|
|
4146
4180
|
}, u.prototype.readFloatBE = function(s, o) {
|
|
@@ -4150,13 +4184,13 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4150
4184
|
}, u.prototype.readDoubleBE = function(s, o) {
|
|
4151
4185
|
return s = s >>> 0, o || Q(s, 8, this.length), r.read(this, s, !1, 52, 8);
|
|
4152
4186
|
};
|
|
4153
|
-
function oe(c, s, o, h,
|
|
4187
|
+
function oe(c, s, o, h, y, x) {
|
|
4154
4188
|
if (!u.isBuffer(c)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
4155
|
-
if (s >
|
|
4189
|
+
if (s > y || s < x) throw new RangeError('"value" argument is out of bounds');
|
|
4156
4190
|
if (o + h > c.length) throw new RangeError("Index out of range");
|
|
4157
4191
|
}
|
|
4158
|
-
u.prototype.writeUintLE = u.prototype.writeUIntLE = function(s, o, h,
|
|
4159
|
-
if (s = +s, o = o >>> 0, h = h >>> 0, !
|
|
4192
|
+
u.prototype.writeUintLE = u.prototype.writeUIntLE = function(s, o, h, y) {
|
|
4193
|
+
if (s = +s, o = o >>> 0, h = h >>> 0, !y) {
|
|
4160
4194
|
const q = Math.pow(2, 8 * h) - 1;
|
|
4161
4195
|
oe(this, s, o, h, q, 0);
|
|
4162
4196
|
}
|
|
@@ -4164,8 +4198,8 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4164
4198
|
for (this[o] = s & 255; ++B < h && (x *= 256); )
|
|
4165
4199
|
this[o + B] = s / x & 255;
|
|
4166
4200
|
return o + h;
|
|
4167
|
-
}, u.prototype.writeUintBE = u.prototype.writeUIntBE = function(s, o, h,
|
|
4168
|
-
if (s = +s, o = o >>> 0, h = h >>> 0, !
|
|
4201
|
+
}, u.prototype.writeUintBE = u.prototype.writeUIntBE = function(s, o, h, y) {
|
|
4202
|
+
if (s = +s, o = o >>> 0, h = h >>> 0, !y) {
|
|
4169
4203
|
const q = Math.pow(2, 8 * h) - 1;
|
|
4170
4204
|
oe(this, s, o, h, q, 0);
|
|
4171
4205
|
}
|
|
@@ -4184,15 +4218,15 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4184
4218
|
}, u.prototype.writeUint32BE = u.prototype.writeUInt32BE = function(s, o, h) {
|
|
4185
4219
|
return s = +s, o = o >>> 0, h || oe(this, s, o, 4, 4294967295, 0), this[o] = s >>> 24, this[o + 1] = s >>> 16, this[o + 2] = s >>> 8, this[o + 3] = s & 255, o + 4;
|
|
4186
4220
|
};
|
|
4187
|
-
function Be(c, s, o, h,
|
|
4188
|
-
p(s, h,
|
|
4221
|
+
function Be(c, s, o, h, y) {
|
|
4222
|
+
p(s, h, y, c, o, 7);
|
|
4189
4223
|
let x = Number(s & BigInt(4294967295));
|
|
4190
4224
|
c[o++] = x, x = x >> 8, c[o++] = x, x = x >> 8, c[o++] = x, x = x >> 8, c[o++] = x;
|
|
4191
4225
|
let B = Number(s >> BigInt(32) & BigInt(4294967295));
|
|
4192
4226
|
return c[o++] = B, B = B >> 8, c[o++] = B, B = B >> 8, c[o++] = B, B = B >> 8, c[o++] = B, o;
|
|
4193
4227
|
}
|
|
4194
|
-
function qe(c, s, o, h,
|
|
4195
|
-
p(s, h,
|
|
4228
|
+
function qe(c, s, o, h, y) {
|
|
4229
|
+
p(s, h, y, c, o, 7);
|
|
4196
4230
|
let x = Number(s & BigInt(4294967295));
|
|
4197
4231
|
c[o + 7] = x, x = x >> 8, c[o + 6] = x, x = x >> 8, c[o + 5] = x, x = x >> 8, c[o + 4] = x;
|
|
4198
4232
|
let B = Number(s >> BigInt(32) & BigInt(4294967295));
|
|
@@ -4202,8 +4236,8 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4202
4236
|
return Be(this, s, o, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
4203
4237
|
}), u.prototype.writeBigUInt64BE = Ie(function(s, o = 0) {
|
|
4204
4238
|
return qe(this, s, o, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
4205
|
-
}), u.prototype.writeIntLE = function(s, o, h,
|
|
4206
|
-
if (s = +s, o = o >>> 0, !
|
|
4239
|
+
}), u.prototype.writeIntLE = function(s, o, h, y) {
|
|
4240
|
+
if (s = +s, o = o >>> 0, !y) {
|
|
4207
4241
|
const ne = Math.pow(2, 8 * h - 1);
|
|
4208
4242
|
oe(this, s, o, h, ne - 1, -ne);
|
|
4209
4243
|
}
|
|
@@ -4211,8 +4245,8 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4211
4245
|
for (this[o] = s & 255; ++x < h && (B *= 256); )
|
|
4212
4246
|
s < 0 && q === 0 && this[o + x - 1] !== 0 && (q = 1), this[o + x] = (s / B >> 0) - q & 255;
|
|
4213
4247
|
return o + h;
|
|
4214
|
-
}, u.prototype.writeIntBE = function(s, o, h,
|
|
4215
|
-
if (s = +s, o = o >>> 0, !
|
|
4248
|
+
}, u.prototype.writeIntBE = function(s, o, h, y) {
|
|
4249
|
+
if (s = +s, o = o >>> 0, !y) {
|
|
4216
4250
|
const ne = Math.pow(2, 8 * h - 1);
|
|
4217
4251
|
oe(this, s, o, h, ne - 1, -ne);
|
|
4218
4252
|
}
|
|
@@ -4235,48 +4269,48 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4235
4269
|
}), u.prototype.writeBigInt64BE = Ie(function(s, o = 0) {
|
|
4236
4270
|
return qe(this, s, o, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
4237
4271
|
});
|
|
4238
|
-
function
|
|
4272
|
+
function Ne(c, s, o, h, y, x) {
|
|
4239
4273
|
if (o + h > c.length) throw new RangeError("Index out of range");
|
|
4240
4274
|
if (o < 0) throw new RangeError("Index out of range");
|
|
4241
4275
|
}
|
|
4242
|
-
function _(c, s, o, h,
|
|
4243
|
-
return s = +s, o = o >>> 0,
|
|
4276
|
+
function _(c, s, o, h, y) {
|
|
4277
|
+
return s = +s, o = o >>> 0, y || Ne(c, s, o, 4), r.write(c, s, o, h, 23, 4), o + 4;
|
|
4244
4278
|
}
|
|
4245
4279
|
u.prototype.writeFloatLE = function(s, o, h) {
|
|
4246
4280
|
return _(this, s, o, !0, h);
|
|
4247
4281
|
}, u.prototype.writeFloatBE = function(s, o, h) {
|
|
4248
4282
|
return _(this, s, o, !1, h);
|
|
4249
4283
|
};
|
|
4250
|
-
function
|
|
4251
|
-
return s = +s, o = o >>> 0,
|
|
4284
|
+
function w(c, s, o, h, y) {
|
|
4285
|
+
return s = +s, o = o >>> 0, y || Ne(c, s, o, 8), r.write(c, s, o, h, 52, 8), o + 8;
|
|
4252
4286
|
}
|
|
4253
4287
|
u.prototype.writeDoubleLE = function(s, o, h) {
|
|
4254
|
-
return
|
|
4288
|
+
return w(this, s, o, !0, h);
|
|
4255
4289
|
}, u.prototype.writeDoubleBE = function(s, o, h) {
|
|
4256
|
-
return
|
|
4257
|
-
}, u.prototype.copy = function(s, o, h,
|
|
4290
|
+
return w(this, s, o, !1, h);
|
|
4291
|
+
}, u.prototype.copy = function(s, o, h, y) {
|
|
4258
4292
|
if (!u.isBuffer(s)) throw new TypeError("argument should be a Buffer");
|
|
4259
|
-
if (h || (h = 0), !
|
|
4293
|
+
if (h || (h = 0), !y && y !== 0 && (y = this.length), o >= s.length && (o = s.length), o || (o = 0), y > 0 && y < h && (y = h), y === h || s.length === 0 || this.length === 0) return 0;
|
|
4260
4294
|
if (o < 0)
|
|
4261
4295
|
throw new RangeError("targetStart out of bounds");
|
|
4262
4296
|
if (h < 0 || h >= this.length) throw new RangeError("Index out of range");
|
|
4263
|
-
if (
|
|
4264
|
-
|
|
4265
|
-
const x =
|
|
4266
|
-
return this === s && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(o, h,
|
|
4297
|
+
if (y < 0) throw new RangeError("sourceEnd out of bounds");
|
|
4298
|
+
y > this.length && (y = this.length), s.length - o < y - h && (y = s.length - o + h);
|
|
4299
|
+
const x = y - h;
|
|
4300
|
+
return this === s && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(o, h, y) : Uint8Array.prototype.set.call(
|
|
4267
4301
|
s,
|
|
4268
|
-
this.subarray(h,
|
|
4302
|
+
this.subarray(h, y),
|
|
4269
4303
|
o
|
|
4270
4304
|
), x;
|
|
4271
|
-
}, u.prototype.fill = function(s, o, h,
|
|
4305
|
+
}, u.prototype.fill = function(s, o, h, y) {
|
|
4272
4306
|
if (typeof s == "string") {
|
|
4273
|
-
if (typeof o == "string" ? (
|
|
4307
|
+
if (typeof o == "string" ? (y = o, o = 0, h = this.length) : typeof h == "string" && (y = h, h = this.length), y !== void 0 && typeof y != "string")
|
|
4274
4308
|
throw new TypeError("encoding must be a string");
|
|
4275
|
-
if (typeof
|
|
4276
|
-
throw new TypeError("Unknown encoding: " +
|
|
4309
|
+
if (typeof y == "string" && !u.isEncoding(y))
|
|
4310
|
+
throw new TypeError("Unknown encoding: " + y);
|
|
4277
4311
|
if (s.length === 1) {
|
|
4278
4312
|
const B = s.charCodeAt(0);
|
|
4279
|
-
(
|
|
4313
|
+
(y === "utf8" && B < 128 || y === "latin1") && (s = B);
|
|
4280
4314
|
}
|
|
4281
4315
|
} else typeof s == "number" ? s = s & 255 : typeof s == "boolean" && (s = Number(s));
|
|
4282
4316
|
if (o < 0 || this.length < o || this.length < h)
|
|
@@ -4289,7 +4323,7 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4289
4323
|
for (x = o; x < h; ++x)
|
|
4290
4324
|
this[x] = s;
|
|
4291
4325
|
else {
|
|
4292
|
-
const B = u.isBuffer(s) ? s : u.from(s,
|
|
4326
|
+
const B = u.isBuffer(s) ? s : u.from(s, y), q = B.length;
|
|
4293
4327
|
if (q === 0)
|
|
4294
4328
|
throw new TypeError('The value "' + s + '" is invalid for argument "value"');
|
|
4295
4329
|
for (x = 0; x < h - o; ++x)
|
|
@@ -4310,11 +4344,11 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4310
4344
|
get code() {
|
|
4311
4345
|
return c;
|
|
4312
4346
|
}
|
|
4313
|
-
set code(
|
|
4347
|
+
set code(y) {
|
|
4314
4348
|
Object.defineProperty(this, "code", {
|
|
4315
4349
|
configurable: !0,
|
|
4316
4350
|
enumerable: !0,
|
|
4317
|
-
value:
|
|
4351
|
+
value: y,
|
|
4318
4352
|
writable: !0
|
|
4319
4353
|
});
|
|
4320
4354
|
}
|
|
@@ -4338,8 +4372,8 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4338
4372
|
), D(
|
|
4339
4373
|
"ERR_OUT_OF_RANGE",
|
|
4340
4374
|
function(c, s, o) {
|
|
4341
|
-
let h = `The value of "${c}" is out of range.`,
|
|
4342
|
-
return Number.isInteger(o) && Math.abs(o) > 2 ** 32 ?
|
|
4375
|
+
let h = `The value of "${c}" is out of range.`, y = o;
|
|
4376
|
+
return Number.isInteger(o) && Math.abs(o) > 2 ** 32 ? y = G(String(o)) : typeof o == "bigint" && (y = String(o), (o > BigInt(2) ** BigInt(32) || o < -(BigInt(2) ** BigInt(32))) && (y = G(y)), y += "n"), h += ` It must be ${s}. Received ${y}`, h;
|
|
4343
4377
|
},
|
|
4344
4378
|
RangeError
|
|
4345
4379
|
);
|
|
@@ -4353,13 +4387,13 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4353
4387
|
function d(c, s, o) {
|
|
4354
4388
|
A(s, "offset"), (c[s] === void 0 || c[s + o] === void 0) && O(s, c.length - (o + 1));
|
|
4355
4389
|
}
|
|
4356
|
-
function p(c, s, o, h,
|
|
4390
|
+
function p(c, s, o, h, y, x) {
|
|
4357
4391
|
if (c > o || c < s) {
|
|
4358
4392
|
const B = typeof s == "bigint" ? "n" : "";
|
|
4359
4393
|
let q;
|
|
4360
4394
|
throw s === 0 || s === BigInt(0) ? q = `>= 0${B} and < 2${B} ** ${(x + 1) * 8}${B}` : q = `>= -(2${B} ** ${(x + 1) * 8 - 1}${B}) and < 2 ** ${(x + 1) * 8 - 1}${B}`, new R.ERR_OUT_OF_RANGE("value", q, c);
|
|
4361
4395
|
}
|
|
4362
|
-
d(h,
|
|
4396
|
+
d(h, y, x);
|
|
4363
4397
|
}
|
|
4364
4398
|
function A(c, s) {
|
|
4365
4399
|
if (typeof c != "number")
|
|
@@ -4383,11 +4417,11 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4383
4417
|
s = s || 1 / 0;
|
|
4384
4418
|
let o;
|
|
4385
4419
|
const h = c.length;
|
|
4386
|
-
let
|
|
4420
|
+
let y = null;
|
|
4387
4421
|
const x = [];
|
|
4388
4422
|
for (let B = 0; B < h; ++B) {
|
|
4389
4423
|
if (o = c.charCodeAt(B), o > 55295 && o < 57344) {
|
|
4390
|
-
if (!
|
|
4424
|
+
if (!y) {
|
|
4391
4425
|
if (o > 56319) {
|
|
4392
4426
|
(s -= 3) > -1 && x.push(239, 191, 189);
|
|
4393
4427
|
continue;
|
|
@@ -4395,16 +4429,16 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4395
4429
|
(s -= 3) > -1 && x.push(239, 191, 189);
|
|
4396
4430
|
continue;
|
|
4397
4431
|
}
|
|
4398
|
-
|
|
4432
|
+
y = o;
|
|
4399
4433
|
continue;
|
|
4400
4434
|
}
|
|
4401
4435
|
if (o < 56320) {
|
|
4402
|
-
(s -= 3) > -1 && x.push(239, 191, 189),
|
|
4436
|
+
(s -= 3) > -1 && x.push(239, 191, 189), y = o;
|
|
4403
4437
|
continue;
|
|
4404
4438
|
}
|
|
4405
|
-
o = (
|
|
4406
|
-
} else
|
|
4407
|
-
if (
|
|
4439
|
+
o = (y - 55296 << 10 | o - 56320) + 65536;
|
|
4440
|
+
} else y && (s -= 3) > -1 && x.push(239, 191, 189);
|
|
4441
|
+
if (y = null, o < 128) {
|
|
4408
4442
|
if ((s -= 1) < 0) break;
|
|
4409
4443
|
x.push(o);
|
|
4410
4444
|
} else if (o < 2048) {
|
|
@@ -4440,20 +4474,20 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4440
4474
|
return s;
|
|
4441
4475
|
}
|
|
4442
4476
|
function ht(c, s) {
|
|
4443
|
-
let o, h,
|
|
4477
|
+
let o, h, y;
|
|
4444
4478
|
const x = [];
|
|
4445
4479
|
for (let B = 0; B < c.length && !((s -= 2) < 0); ++B)
|
|
4446
|
-
o = c.charCodeAt(B), h = o >> 8,
|
|
4480
|
+
o = c.charCodeAt(B), h = o >> 8, y = o % 256, x.push(y), x.push(h);
|
|
4447
4481
|
return x;
|
|
4448
4482
|
}
|
|
4449
4483
|
function Pt(c) {
|
|
4450
4484
|
return t.toByteArray(j(c));
|
|
4451
4485
|
}
|
|
4452
4486
|
function dt(c, s, o, h) {
|
|
4453
|
-
let
|
|
4454
|
-
for (
|
|
4455
|
-
s[
|
|
4456
|
-
return
|
|
4487
|
+
let y;
|
|
4488
|
+
for (y = 0; y < h && !(y + o >= s.length || y >= c.length); ++y)
|
|
4489
|
+
s[y + o] = c[y];
|
|
4490
|
+
return y;
|
|
4457
4491
|
}
|
|
4458
4492
|
function Se(c, s) {
|
|
4459
4493
|
return c instanceof s || c != null && c.constructor != null && c.constructor.name != null && c.constructor.name === s.name;
|
|
@@ -4465,8 +4499,8 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4465
4499
|
const c = "0123456789abcdef", s = new Array(256);
|
|
4466
4500
|
for (let o = 0; o < 16; ++o) {
|
|
4467
4501
|
const h = o * 16;
|
|
4468
|
-
for (let
|
|
4469
|
-
s[h +
|
|
4502
|
+
for (let y = 0; y < 16; ++y)
|
|
4503
|
+
s[h + y] = c[o] + c[y];
|
|
4470
4504
|
}
|
|
4471
4505
|
return s;
|
|
4472
4506
|
}();
|
|
@@ -4495,8 +4529,8 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4495
4529
|
}, a.alloc = function(f, u, l) {
|
|
4496
4530
|
if (typeof f != "number")
|
|
4497
4531
|
throw new TypeError("Argument must be a number");
|
|
4498
|
-
var
|
|
4499
|
-
return u !== void 0 ? typeof l == "string" ?
|
|
4532
|
+
var b = n(f);
|
|
4533
|
+
return u !== void 0 ? typeof l == "string" ? b.fill(u, l) : b.fill(u) : b.fill(0), b;
|
|
4500
4534
|
}, a.allocUnsafe = function(f) {
|
|
4501
4535
|
if (typeof f != "number")
|
|
4502
4536
|
throw new TypeError("Argument must be a number");
|
|
@@ -4618,7 +4652,7 @@ K.prototype.emit = function(t) {
|
|
|
4618
4652
|
if (typeof l == "function")
|
|
4619
4653
|
Zn(l, this, r);
|
|
4620
4654
|
else
|
|
4621
|
-
for (var
|
|
4655
|
+
for (var b = l.length, g = ls(l, b), n = 0; n < b; ++n)
|
|
4622
4656
|
Zn(g[n], this, r);
|
|
4623
4657
|
return !0;
|
|
4624
4658
|
};
|
|
@@ -4828,9 +4862,9 @@ function kf() {
|
|
|
4828
4862
|
}
|
|
4829
4863
|
return (P === "string" ? String : Number)(v);
|
|
4830
4864
|
}
|
|
4831
|
-
var l = Rt,
|
|
4865
|
+
var l = Rt, b = l.Buffer, g = Rn, m = g.inspect, E = m && m.custom || "inspect";
|
|
4832
4866
|
function I(v, P, T) {
|
|
4833
|
-
|
|
4867
|
+
b.prototype.copy.call(v, P, T);
|
|
4834
4868
|
}
|
|
4835
4869
|
return Hr = /* @__PURE__ */ function() {
|
|
4836
4870
|
function v() {
|
|
@@ -4877,8 +4911,8 @@ function kf() {
|
|
|
4877
4911
|
}, {
|
|
4878
4912
|
key: "concat",
|
|
4879
4913
|
value: function(T) {
|
|
4880
|
-
if (this.length === 0) return
|
|
4881
|
-
for (var C =
|
|
4914
|
+
if (this.length === 0) return b.alloc(0);
|
|
4915
|
+
for (var C = b.allocUnsafe(T >>> 0), F = this.head, k = 0; F; )
|
|
4882
4916
|
I(F.data, C, k), k += F.data.length, F = F.next;
|
|
4883
4917
|
return C;
|
|
4884
4918
|
}
|
|
@@ -4913,7 +4947,7 @@ function kf() {
|
|
|
4913
4947
|
}, {
|
|
4914
4948
|
key: "_getBuffer",
|
|
4915
4949
|
value: function(T) {
|
|
4916
|
-
var C =
|
|
4950
|
+
var C = b.allocUnsafe(T), F = this.head, k = 1;
|
|
4917
4951
|
for (F.data.copy(C), T -= F.data.length; F = F.next; ) {
|
|
4918
4952
|
var L = F.data, U = T > L.length ? L.length : T;
|
|
4919
4953
|
if (L.copy(C, C.length - T, 0, U), T -= U, T === 0) {
|
|
@@ -4928,7 +4962,7 @@ function kf() {
|
|
|
4928
4962
|
}, {
|
|
4929
4963
|
key: E,
|
|
4930
4964
|
value: function(T, C) {
|
|
4931
|
-
return
|
|
4965
|
+
return m(this, t(t({}, C), {}, {
|
|
4932
4966
|
// Only inspect one level.
|
|
4933
4967
|
depth: 0,
|
|
4934
4968
|
// It should not recurse.
|
|
@@ -4965,7 +4999,7 @@ var bs = {
|
|
|
4965
4999
|
undestroy: Uf,
|
|
4966
5000
|
errorOrDestroy: Of
|
|
4967
5001
|
}, ct = {};
|
|
4968
|
-
function
|
|
5002
|
+
function Nf(e, t) {
|
|
4969
5003
|
e.prototype = Object.create(t.prototype), e.prototype.constructor = e, e.__proto__ = t;
|
|
4970
5004
|
}
|
|
4971
5005
|
var ys = {};
|
|
@@ -4975,9 +5009,9 @@ function Re(e, t, r) {
|
|
|
4975
5009
|
return typeof t == "string" ? t : t(a, f, u);
|
|
4976
5010
|
}
|
|
4977
5011
|
var i = /* @__PURE__ */ function(a) {
|
|
4978
|
-
|
|
4979
|
-
function f(u, l,
|
|
4980
|
-
return a.call(this, n(u, l,
|
|
5012
|
+
Nf(f, a);
|
|
5013
|
+
function f(u, l, b) {
|
|
5014
|
+
return a.call(this, n(u, l, b)) || this;
|
|
4981
5015
|
}
|
|
4982
5016
|
return f;
|
|
4983
5017
|
}(r);
|
|
@@ -4992,7 +5026,7 @@ function ni(e, t) {
|
|
|
4992
5026
|
} else
|
|
4993
5027
|
return "of ".concat(t, " ").concat(String(e));
|
|
4994
5028
|
}
|
|
4995
|
-
function
|
|
5029
|
+
function Mf(e, t, r) {
|
|
4996
5030
|
return e.substr(0, t.length) === t;
|
|
4997
5031
|
}
|
|
4998
5032
|
function Df(e, t, r) {
|
|
@@ -5006,7 +5040,7 @@ Re("ERR_INVALID_OPT_VALUE", function(e, t) {
|
|
|
5006
5040
|
}, TypeError);
|
|
5007
5041
|
Re("ERR_INVALID_ARG_TYPE", function(e, t, r) {
|
|
5008
5042
|
var n;
|
|
5009
|
-
typeof t == "string" &&
|
|
5043
|
+
typeof t == "string" && Mf(t, "not ") ? (n = "must not be", t = t.replace(/^not /, "")) : n = "must be";
|
|
5010
5044
|
var i;
|
|
5011
5045
|
if (Df(e, " argument"))
|
|
5012
5046
|
i = "The ".concat(e, " ").concat(n, " ").concat(ni(t, "type"));
|
|
@@ -5077,15 +5111,15 @@ function zr(e) {
|
|
|
5077
5111
|
var Gr, ii;
|
|
5078
5112
|
function ms() {
|
|
5079
5113
|
if (ii) return Gr;
|
|
5080
|
-
ii = 1, Gr =
|
|
5114
|
+
ii = 1, Gr = M;
|
|
5081
5115
|
function e(_) {
|
|
5082
|
-
var
|
|
5116
|
+
var w = this;
|
|
5083
5117
|
this.next = null, this.entry = null, this.finish = function() {
|
|
5084
|
-
|
|
5118
|
+
Ne(w, _);
|
|
5085
5119
|
};
|
|
5086
5120
|
}
|
|
5087
5121
|
var t;
|
|
5088
|
-
|
|
5122
|
+
M.WritableState = S;
|
|
5089
5123
|
var r = {
|
|
5090
5124
|
deprecate: jf
|
|
5091
5125
|
}, n = ps, i = Rt.Buffer, a = (typeof Xe < "u" ? Xe : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
|
|
@@ -5096,20 +5130,20 @@ function ms() {
|
|
|
5096
5130
|
function u(_) {
|
|
5097
5131
|
return i.isBuffer(_) || _ instanceof a;
|
|
5098
5132
|
}
|
|
5099
|
-
var l = bs,
|
|
5100
|
-
ge(
|
|
5133
|
+
var l = bs, b = gs, g = b.getHighWaterMark, m = ct.codes, E = m.ERR_INVALID_ARG_TYPE, I = m.ERR_METHOD_NOT_IMPLEMENTED, v = m.ERR_MULTIPLE_CALLBACK, P = m.ERR_STREAM_CANNOT_PIPE, T = m.ERR_STREAM_DESTROYED, C = m.ERR_STREAM_NULL_VALUES, F = m.ERR_STREAM_WRITE_AFTER_END, k = m.ERR_UNKNOWN_ENCODING, L = l.errorOrDestroy;
|
|
5134
|
+
ge(M, n);
|
|
5101
5135
|
function U() {
|
|
5102
5136
|
}
|
|
5103
|
-
function S(_,
|
|
5104
|
-
t = t || St(), _ = _ || {}, typeof R != "boolean" && (R =
|
|
5137
|
+
function S(_, w, R) {
|
|
5138
|
+
t = t || St(), _ = _ || {}, typeof R != "boolean" && (R = w instanceof t), this.objectMode = !!_.objectMode, R && (this.objectMode = this.objectMode || !!_.writableObjectMode), this.highWaterMark = g(this, _, "writableHighWaterMark", R), this.finalCalled = !1, this.needDrain = !1, this.ending = !1, this.ended = !1, this.finished = !1, this.destroyed = !1;
|
|
5105
5139
|
var D = _.decodeStrings === !1;
|
|
5106
5140
|
this.decodeStrings = !D, this.defaultEncoding = _.defaultEncoding || "utf8", this.length = 0, this.writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, this.onwrite = function(G) {
|
|
5107
|
-
et(
|
|
5141
|
+
et(w, G);
|
|
5108
5142
|
}, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.emitClose = _.emitClose !== !1, this.autoDestroy = !!_.autoDestroy, this.bufferedRequestCount = 0, this.corkedRequestsFree = new e(this);
|
|
5109
5143
|
}
|
|
5110
5144
|
S.prototype.getBuffer = function() {
|
|
5111
|
-
for (var
|
|
5112
|
-
R.push(
|
|
5145
|
+
for (var w = this.bufferedRequest, R = []; w; )
|
|
5146
|
+
R.push(w), w = w.next;
|
|
5113
5147
|
return R;
|
|
5114
5148
|
}, function() {
|
|
5115
5149
|
try {
|
|
@@ -5122,42 +5156,42 @@ function ms() {
|
|
|
5122
5156
|
}
|
|
5123
5157
|
}();
|
|
5124
5158
|
var z;
|
|
5125
|
-
typeof Symbol == "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] == "function" ? (z = Function.prototype[Symbol.hasInstance], Object.defineProperty(
|
|
5126
|
-
value: function(
|
|
5127
|
-
return z.call(this,
|
|
5159
|
+
typeof Symbol == "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] == "function" ? (z = Function.prototype[Symbol.hasInstance], Object.defineProperty(M, Symbol.hasInstance, {
|
|
5160
|
+
value: function(w) {
|
|
5161
|
+
return z.call(this, w) ? !0 : this !== M ? !1 : w && w._writableState instanceof S;
|
|
5128
5162
|
}
|
|
5129
|
-
})) : z = function(
|
|
5130
|
-
return
|
|
5163
|
+
})) : z = function(w) {
|
|
5164
|
+
return w instanceof this;
|
|
5131
5165
|
};
|
|
5132
|
-
function
|
|
5166
|
+
function M(_) {
|
|
5133
5167
|
t = t || St();
|
|
5134
|
-
var
|
|
5135
|
-
if (!
|
|
5136
|
-
this._writableState = new S(_, this,
|
|
5168
|
+
var w = this instanceof t;
|
|
5169
|
+
if (!w && !z.call(M, this)) return new M(_);
|
|
5170
|
+
this._writableState = new S(_, this, w), this.writable = !0, _ && (typeof _.write == "function" && (this._write = _.write), typeof _.writev == "function" && (this._writev = _.writev), typeof _.destroy == "function" && (this._destroy = _.destroy), typeof _.final == "function" && (this._final = _.final)), n.call(this);
|
|
5137
5171
|
}
|
|
5138
|
-
|
|
5172
|
+
M.prototype.pipe = function() {
|
|
5139
5173
|
L(this, new P());
|
|
5140
5174
|
};
|
|
5141
|
-
function $(_,
|
|
5175
|
+
function $(_, w) {
|
|
5142
5176
|
var R = new F();
|
|
5143
|
-
L(_, R), process.nextTick(
|
|
5177
|
+
L(_, R), process.nextTick(w, R);
|
|
5144
5178
|
}
|
|
5145
|
-
function se(_,
|
|
5179
|
+
function se(_, w, R, D) {
|
|
5146
5180
|
var G;
|
|
5147
|
-
return R === null ? G = new C() : typeof R != "string" && !
|
|
5181
|
+
return R === null ? G = new C() : typeof R != "string" && !w.objectMode && (G = new E("chunk", ["string", "Buffer"], R)), G ? (L(_, G), process.nextTick(D, G), !1) : !0;
|
|
5148
5182
|
}
|
|
5149
|
-
|
|
5183
|
+
M.prototype.write = function(_, w, R) {
|
|
5150
5184
|
var D = this._writableState, G = !1, d = !D.objectMode && u(_);
|
|
5151
|
-
return d && !i.isBuffer(_) && (_ = f(_)), typeof
|
|
5152
|
-
},
|
|
5185
|
+
return d && !i.isBuffer(_) && (_ = f(_)), typeof w == "function" && (R = w, w = null), d ? w = "buffer" : w || (w = D.defaultEncoding), typeof R != "function" && (R = U), D.ending ? $(this, R) : (d || se(this, D, _, R)) && (D.pendingcb++, G = Ge(this, D, d, _, w, R)), G;
|
|
5186
|
+
}, M.prototype.cork = function() {
|
|
5153
5187
|
this._writableState.corked++;
|
|
5154
|
-
},
|
|
5188
|
+
}, M.prototype.uncork = function() {
|
|
5155
5189
|
var _ = this._writableState;
|
|
5156
5190
|
_.corked && (_.corked--, !_.writing && !_.corked && !_.bufferProcessing && _.bufferedRequest && Ce(this, _));
|
|
5157
|
-
},
|
|
5158
|
-
if (typeof
|
|
5159
|
-
return this._writableState.defaultEncoding =
|
|
5160
|
-
}, Object.defineProperty(
|
|
5191
|
+
}, M.prototype.setDefaultEncoding = function(w) {
|
|
5192
|
+
if (typeof w == "string" && (w = w.toLowerCase()), !(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((w + "").toLowerCase()) > -1)) throw new k(w);
|
|
5193
|
+
return this._writableState.defaultEncoding = w, this;
|
|
5194
|
+
}, Object.defineProperty(M.prototype, "writableBuffer", {
|
|
5161
5195
|
// making it explicit this property is not enumerable
|
|
5162
5196
|
// because otherwise some prototype manipulation in
|
|
5163
5197
|
// userland will fail
|
|
@@ -5166,10 +5200,10 @@ function ms() {
|
|
|
5166
5200
|
return this._writableState && this._writableState.getBuffer();
|
|
5167
5201
|
}
|
|
5168
5202
|
});
|
|
5169
|
-
function Te(_,
|
|
5170
|
-
return !_.objectMode && _.decodeStrings !== !1 && typeof
|
|
5203
|
+
function Te(_, w, R) {
|
|
5204
|
+
return !_.objectMode && _.decodeStrings !== !1 && typeof w == "string" && (w = i.from(w, R)), w;
|
|
5171
5205
|
}
|
|
5172
|
-
Object.defineProperty(
|
|
5206
|
+
Object.defineProperty(M.prototype, "writableHighWaterMark", {
|
|
5173
5207
|
// making it explicit this property is not enumerable
|
|
5174
5208
|
// because otherwise some prototype manipulation in
|
|
5175
5209
|
// userland will fail
|
|
@@ -5178,76 +5212,76 @@ function ms() {
|
|
|
5178
5212
|
return this._writableState.highWaterMark;
|
|
5179
5213
|
}
|
|
5180
5214
|
});
|
|
5181
|
-
function Ge(_,
|
|
5215
|
+
function Ge(_, w, R, D, G, d) {
|
|
5182
5216
|
if (!R) {
|
|
5183
|
-
var p = Te(
|
|
5217
|
+
var p = Te(w, D, G);
|
|
5184
5218
|
D !== p && (R = !0, G = "buffer", D = p);
|
|
5185
5219
|
}
|
|
5186
|
-
var A =
|
|
5187
|
-
|
|
5188
|
-
var O =
|
|
5189
|
-
if (O || (
|
|
5190
|
-
var Z =
|
|
5191
|
-
|
|
5220
|
+
var A = w.objectMode ? 1 : D.length;
|
|
5221
|
+
w.length += A;
|
|
5222
|
+
var O = w.length < w.highWaterMark;
|
|
5223
|
+
if (O || (w.needDrain = !0), w.writing || w.corked) {
|
|
5224
|
+
var Z = w.lastBufferedRequest;
|
|
5225
|
+
w.lastBufferedRequest = {
|
|
5192
5226
|
chunk: D,
|
|
5193
5227
|
encoding: G,
|
|
5194
5228
|
isBuf: R,
|
|
5195
5229
|
callback: d,
|
|
5196
5230
|
next: null
|
|
5197
|
-
}, Z ? Z.next =
|
|
5231
|
+
}, Z ? Z.next = w.lastBufferedRequest : w.bufferedRequest = w.lastBufferedRequest, w.bufferedRequestCount += 1;
|
|
5198
5232
|
} else
|
|
5199
|
-
ae(_,
|
|
5233
|
+
ae(_, w, !1, A, D, G, d);
|
|
5200
5234
|
return O;
|
|
5201
5235
|
}
|
|
5202
|
-
function ae(_,
|
|
5203
|
-
|
|
5236
|
+
function ae(_, w, R, D, G, d, p) {
|
|
5237
|
+
w.writelen = D, w.writecb = p, w.writing = !0, w.sync = !0, w.destroyed ? w.onwrite(new T("write")) : R ? _._writev(G, w.onwrite) : _._write(G, d, w.onwrite), w.sync = !1;
|
|
5204
5238
|
}
|
|
5205
|
-
function xe(_,
|
|
5206
|
-
--
|
|
5239
|
+
function xe(_, w, R, D, G) {
|
|
5240
|
+
--w.pendingcb, R ? (process.nextTick(G, D), process.nextTick(Be, _, w), _._writableState.errorEmitted = !0, L(_, D)) : (G(D), _._writableState.errorEmitted = !0, L(_, D), Be(_, w));
|
|
5207
5241
|
}
|
|
5208
5242
|
function ve(_) {
|
|
5209
5243
|
_.writing = !1, _.writecb = null, _.length -= _.writelen, _.writelen = 0;
|
|
5210
5244
|
}
|
|
5211
|
-
function et(_,
|
|
5245
|
+
function et(_, w) {
|
|
5212
5246
|
var R = _._writableState, D = R.sync, G = R.writecb;
|
|
5213
5247
|
if (typeof G != "function") throw new v();
|
|
5214
|
-
if (ve(R),
|
|
5248
|
+
if (ve(R), w) xe(_, R, D, w, G);
|
|
5215
5249
|
else {
|
|
5216
5250
|
var d = We(R) || _.destroyed;
|
|
5217
5251
|
!d && !R.corked && !R.bufferProcessing && R.bufferedRequest && Ce(_, R), D ? process.nextTick(Pe, _, R, d, G) : Pe(_, R, d, G);
|
|
5218
5252
|
}
|
|
5219
5253
|
}
|
|
5220
|
-
function Pe(_,
|
|
5221
|
-
R || je(_,
|
|
5254
|
+
function Pe(_, w, R, D) {
|
|
5255
|
+
R || je(_, w), w.pendingcb--, D(), Be(_, w);
|
|
5222
5256
|
}
|
|
5223
|
-
function je(_,
|
|
5224
|
-
|
|
5257
|
+
function je(_, w) {
|
|
5258
|
+
w.length === 0 && w.needDrain && (w.needDrain = !1, _.emit("drain"));
|
|
5225
5259
|
}
|
|
5226
|
-
function Ce(_,
|
|
5227
|
-
|
|
5228
|
-
var R =
|
|
5260
|
+
function Ce(_, w) {
|
|
5261
|
+
w.bufferProcessing = !0;
|
|
5262
|
+
var R = w.bufferedRequest;
|
|
5229
5263
|
if (_._writev && R && R.next) {
|
|
5230
|
-
var D =
|
|
5264
|
+
var D = w.bufferedRequestCount, G = new Array(D), d = w.corkedRequestsFree;
|
|
5231
5265
|
d.entry = R;
|
|
5232
5266
|
for (var p = 0, A = !0; R; )
|
|
5233
5267
|
G[p] = R, R.isBuf || (A = !1), R = R.next, p += 1;
|
|
5234
|
-
G.allBuffers = A, ae(_,
|
|
5268
|
+
G.allBuffers = A, ae(_, w, !0, w.length, G, "", d.finish), w.pendingcb++, w.lastBufferedRequest = null, d.next ? (w.corkedRequestsFree = d.next, d.next = null) : w.corkedRequestsFree = new e(w), w.bufferedRequestCount = 0;
|
|
5235
5269
|
} else {
|
|
5236
5270
|
for (; R; ) {
|
|
5237
|
-
var O = R.chunk, Z = R.encoding, j = R.callback, V =
|
|
5238
|
-
if (ae(_,
|
|
5271
|
+
var O = R.chunk, Z = R.encoding, j = R.callback, V = w.objectMode ? 1 : O.length;
|
|
5272
|
+
if (ae(_, w, !1, V, O, Z, j), R = R.next, w.bufferedRequestCount--, w.writing)
|
|
5239
5273
|
break;
|
|
5240
5274
|
}
|
|
5241
|
-
R === null && (
|
|
5275
|
+
R === null && (w.lastBufferedRequest = null);
|
|
5242
5276
|
}
|
|
5243
|
-
|
|
5277
|
+
w.bufferedRequest = R, w.bufferProcessing = !1;
|
|
5244
5278
|
}
|
|
5245
|
-
|
|
5279
|
+
M.prototype._write = function(_, w, R) {
|
|
5246
5280
|
R(new I("_write()"));
|
|
5247
|
-
},
|
|
5281
|
+
}, M.prototype._writev = null, M.prototype.end = function(_, w, R) {
|
|
5248
5282
|
var D = this._writableState;
|
|
5249
|
-
return typeof _ == "function" ? (R = _, _ = null,
|
|
5250
|
-
}, Object.defineProperty(
|
|
5283
|
+
return typeof _ == "function" ? (R = _, _ = null, w = null) : typeof w == "function" && (R = w, w = null), _ != null && this.write(_, w), D.corked && (D.corked = 1, this.uncork()), D.ending || qe(this, D, R), this;
|
|
5284
|
+
}, Object.defineProperty(M.prototype, "writableLength", {
|
|
5251
5285
|
// making it explicit this property is not enumerable
|
|
5252
5286
|
// because otherwise some prototype manipulation in
|
|
5253
5287
|
// userland will fail
|
|
@@ -5259,34 +5293,34 @@ function ms() {
|
|
|
5259
5293
|
function We(_) {
|
|
5260
5294
|
return _.ending && _.length === 0 && _.bufferedRequest === null && !_.finished && !_.writing;
|
|
5261
5295
|
}
|
|
5262
|
-
function Q(_,
|
|
5296
|
+
function Q(_, w) {
|
|
5263
5297
|
_._final(function(R) {
|
|
5264
|
-
|
|
5298
|
+
w.pendingcb--, R && L(_, R), w.prefinished = !0, _.emit("prefinish"), Be(_, w);
|
|
5265
5299
|
});
|
|
5266
5300
|
}
|
|
5267
|
-
function oe(_,
|
|
5268
|
-
!
|
|
5301
|
+
function oe(_, w) {
|
|
5302
|
+
!w.prefinished && !w.finalCalled && (typeof _._final == "function" && !w.destroyed ? (w.pendingcb++, w.finalCalled = !0, process.nextTick(Q, _, w)) : (w.prefinished = !0, _.emit("prefinish")));
|
|
5269
5303
|
}
|
|
5270
|
-
function Be(_,
|
|
5271
|
-
var R = We(
|
|
5272
|
-
if (R && (oe(_,
|
|
5304
|
+
function Be(_, w) {
|
|
5305
|
+
var R = We(w);
|
|
5306
|
+
if (R && (oe(_, w), w.pendingcb === 0 && (w.finished = !0, _.emit("finish"), w.autoDestroy))) {
|
|
5273
5307
|
var D = _._readableState;
|
|
5274
5308
|
(!D || D.autoDestroy && D.endEmitted) && _.destroy();
|
|
5275
5309
|
}
|
|
5276
5310
|
return R;
|
|
5277
5311
|
}
|
|
5278
|
-
function qe(_,
|
|
5279
|
-
|
|
5312
|
+
function qe(_, w, R) {
|
|
5313
|
+
w.ending = !0, Be(_, w), R && (w.finished ? process.nextTick(R) : _.once("finish", R)), w.ended = !0, _.writable = !1;
|
|
5280
5314
|
}
|
|
5281
|
-
function
|
|
5315
|
+
function Ne(_, w, R) {
|
|
5282
5316
|
var D = _.entry;
|
|
5283
5317
|
for (_.entry = null; D; ) {
|
|
5284
5318
|
var G = D.callback;
|
|
5285
|
-
|
|
5319
|
+
w.pendingcb--, G(R), D = D.next;
|
|
5286
5320
|
}
|
|
5287
|
-
|
|
5321
|
+
w.corkedRequestsFree.next = _;
|
|
5288
5322
|
}
|
|
5289
|
-
return Object.defineProperty(
|
|
5323
|
+
return Object.defineProperty(M.prototype, "destroyed", {
|
|
5290
5324
|
// making it explicit this property is not enumerable
|
|
5291
5325
|
// because otherwise some prototype manipulation in
|
|
5292
5326
|
// userland will fail
|
|
@@ -5294,20 +5328,20 @@ function ms() {
|
|
|
5294
5328
|
get: function() {
|
|
5295
5329
|
return this._writableState === void 0 ? !1 : this._writableState.destroyed;
|
|
5296
5330
|
},
|
|
5297
|
-
set: function(
|
|
5298
|
-
this._writableState && (this._writableState.destroyed =
|
|
5331
|
+
set: function(w) {
|
|
5332
|
+
this._writableState && (this._writableState.destroyed = w);
|
|
5299
5333
|
}
|
|
5300
|
-
}),
|
|
5301
|
-
|
|
5334
|
+
}), M.prototype.destroy = l.destroy, M.prototype._undestroy = l.undestroy, M.prototype._destroy = function(_, w) {
|
|
5335
|
+
w(_);
|
|
5302
5336
|
}, Gr;
|
|
5303
5337
|
}
|
|
5304
5338
|
var jr, si;
|
|
5305
5339
|
function St() {
|
|
5306
5340
|
if (si) return jr;
|
|
5307
5341
|
si = 1;
|
|
5308
|
-
var e = Object.keys || function(
|
|
5342
|
+
var e = Object.keys || function(b) {
|
|
5309
5343
|
var g = [];
|
|
5310
|
-
for (var
|
|
5344
|
+
for (var m in b) g.push(m);
|
|
5311
5345
|
return g;
|
|
5312
5346
|
};
|
|
5313
5347
|
jr = f;
|
|
@@ -5317,9 +5351,9 @@ function St() {
|
|
|
5317
5351
|
var a = n[i];
|
|
5318
5352
|
f.prototype[a] || (f.prototype[a] = r.prototype[a]);
|
|
5319
5353
|
}
|
|
5320
|
-
function f(
|
|
5321
|
-
if (!(this instanceof f)) return new f(
|
|
5322
|
-
t.call(this,
|
|
5354
|
+
function f(b) {
|
|
5355
|
+
if (!(this instanceof f)) return new f(b);
|
|
5356
|
+
t.call(this, b), r.call(this, b), this.allowHalfOpen = !0, b && (b.readable === !1 && (this.readable = !1), b.writable === !1 && (this.writable = !1), b.allowHalfOpen === !1 && (this.allowHalfOpen = !1, this.once("end", u)));
|
|
5323
5357
|
}
|
|
5324
5358
|
Object.defineProperty(f.prototype, "writableHighWaterMark", {
|
|
5325
5359
|
// making it explicit this property is not enumerable
|
|
@@ -5349,8 +5383,8 @@ function St() {
|
|
|
5349
5383
|
function u() {
|
|
5350
5384
|
this._writableState.ended || process.nextTick(l, this);
|
|
5351
5385
|
}
|
|
5352
|
-
function l(
|
|
5353
|
-
|
|
5386
|
+
function l(b) {
|
|
5387
|
+
b.end();
|
|
5354
5388
|
}
|
|
5355
5389
|
return Object.defineProperty(f.prototype, "destroyed", {
|
|
5356
5390
|
// making it explicit this property is not enumerable
|
|
@@ -5544,11 +5578,11 @@ function ws(e, t, r) {
|
|
|
5544
5578
|
e.writable || u();
|
|
5545
5579
|
}, f = e._writableState && e._writableState.finished, u = function() {
|
|
5546
5580
|
i = !1, f = !0, n || r.call(e);
|
|
5547
|
-
}, l = e._readableState && e._readableState.endEmitted,
|
|
5581
|
+
}, l = e._readableState && e._readableState.endEmitted, b = function() {
|
|
5548
5582
|
n = !1, l = !0, i || r.call(e);
|
|
5549
5583
|
}, g = function(v) {
|
|
5550
5584
|
r.call(e, v);
|
|
5551
|
-
},
|
|
5585
|
+
}, m = function() {
|
|
5552
5586
|
var v;
|
|
5553
5587
|
if (n && !l)
|
|
5554
5588
|
return (!e._readableState || !e._readableState.ended) && (v = new ai()), r.call(e, v);
|
|
@@ -5557,8 +5591,8 @@ function ws(e, t, r) {
|
|
|
5557
5591
|
}, E = function() {
|
|
5558
5592
|
e.req.on("finish", u);
|
|
5559
5593
|
};
|
|
5560
|
-
return au(e) ? (e.on("complete", u), e.on("abort",
|
|
5561
|
-
e.removeListener("complete", u), e.removeListener("abort",
|
|
5594
|
+
return au(e) ? (e.on("complete", u), e.on("abort", m), e.req ? E() : e.on("request", E)) : i && !e._writableState && (e.on("end", a), e.on("close", a)), e.on("end", b), e.on("finish", u), t.error !== !1 && e.on("error", g), e.on("close", m), function() {
|
|
5595
|
+
e.removeListener("complete", u), e.removeListener("abort", m), e.removeListener("request", E), e.req && e.req.removeListener("finish", u), e.removeListener("end", a), e.removeListener("close", a), e.removeListener("finish", u), e.removeListener("end", b), e.removeListener("error", g), e.removeListener("close", m);
|
|
5562
5596
|
};
|
|
5563
5597
|
}
|
|
5564
5598
|
var Pn = ws, qr, fi;
|
|
@@ -5583,7 +5617,7 @@ function fu() {
|
|
|
5583
5617
|
}
|
|
5584
5618
|
return (L === "string" ? String : Number)(k);
|
|
5585
5619
|
}
|
|
5586
|
-
var i = Pn, a = Symbol("lastResolve"), f = Symbol("lastReject"), u = Symbol("error"), l = Symbol("ended"),
|
|
5620
|
+
var i = Pn, a = Symbol("lastResolve"), f = Symbol("lastReject"), u = Symbol("error"), l = Symbol("ended"), b = Symbol("lastPromise"), g = Symbol("handlePromise"), m = Symbol("stream");
|
|
5587
5621
|
function E(k, L) {
|
|
5588
5622
|
return {
|
|
5589
5623
|
value: k,
|
|
@@ -5593,8 +5627,8 @@ function fu() {
|
|
|
5593
5627
|
function I(k) {
|
|
5594
5628
|
var L = k[a];
|
|
5595
5629
|
if (L !== null) {
|
|
5596
|
-
var U = k[
|
|
5597
|
-
U !== null && (k[
|
|
5630
|
+
var U = k[m].read();
|
|
5631
|
+
U !== null && (k[b] = null, k[a] = null, k[f] = null, L(E(U, !1)));
|
|
5598
5632
|
}
|
|
5599
5633
|
}
|
|
5600
5634
|
function v(k) {
|
|
@@ -5614,7 +5648,7 @@ function fu() {
|
|
|
5614
5648
|
var T = Object.getPrototypeOf(function() {
|
|
5615
5649
|
}), C = Object.setPrototypeOf((e = {
|
|
5616
5650
|
get stream() {
|
|
5617
|
-
return this[
|
|
5651
|
+
return this[m];
|
|
5618
5652
|
},
|
|
5619
5653
|
next: function() {
|
|
5620
5654
|
var L = this, U = this[u];
|
|
@@ -5622,29 +5656,29 @@ function fu() {
|
|
|
5622
5656
|
return Promise.reject(U);
|
|
5623
5657
|
if (this[l])
|
|
5624
5658
|
return Promise.resolve(E(void 0, !0));
|
|
5625
|
-
if (this[
|
|
5659
|
+
if (this[m].destroyed)
|
|
5626
5660
|
return new Promise(function($, se) {
|
|
5627
5661
|
process.nextTick(function() {
|
|
5628
5662
|
L[u] ? se(L[u]) : $(E(void 0, !0));
|
|
5629
5663
|
});
|
|
5630
5664
|
});
|
|
5631
|
-
var S = this[
|
|
5665
|
+
var S = this[b], z;
|
|
5632
5666
|
if (S)
|
|
5633
5667
|
z = new Promise(P(S, this));
|
|
5634
5668
|
else {
|
|
5635
|
-
var
|
|
5636
|
-
if (
|
|
5637
|
-
return Promise.resolve(E(
|
|
5669
|
+
var M = this[m].read();
|
|
5670
|
+
if (M !== null)
|
|
5671
|
+
return Promise.resolve(E(M, !1));
|
|
5638
5672
|
z = new Promise(this[g]);
|
|
5639
5673
|
}
|
|
5640
|
-
return this[
|
|
5674
|
+
return this[b] = z, z;
|
|
5641
5675
|
}
|
|
5642
5676
|
}, t(e, Symbol.asyncIterator, function() {
|
|
5643
5677
|
return this;
|
|
5644
5678
|
}), t(e, "return", function() {
|
|
5645
5679
|
var L = this;
|
|
5646
5680
|
return new Promise(function(U, S) {
|
|
5647
|
-
L[
|
|
5681
|
+
L[m].destroy(null, function(z) {
|
|
5648
5682
|
if (z) {
|
|
5649
5683
|
S(z);
|
|
5650
5684
|
return;
|
|
@@ -5653,7 +5687,7 @@ function fu() {
|
|
|
5653
5687
|
});
|
|
5654
5688
|
});
|
|
5655
5689
|
}), e), T), F = function(L) {
|
|
5656
|
-
var U, S = Object.create(C, (U = {}, t(U,
|
|
5690
|
+
var U, S = Object.create(C, (U = {}, t(U, m, {
|
|
5657
5691
|
value: L,
|
|
5658
5692
|
writable: !0
|
|
5659
5693
|
}), t(U, a, {
|
|
@@ -5669,20 +5703,20 @@ function fu() {
|
|
|
5669
5703
|
value: L._readableState.endEmitted,
|
|
5670
5704
|
writable: !0
|
|
5671
5705
|
}), t(U, g, {
|
|
5672
|
-
value: function(
|
|
5673
|
-
var se = S[
|
|
5674
|
-
se ? (S[
|
|
5706
|
+
value: function(M, $) {
|
|
5707
|
+
var se = S[m].read();
|
|
5708
|
+
se ? (S[b] = null, S[a] = null, S[f] = null, M(E(se, !1))) : (S[a] = M, S[f] = $);
|
|
5675
5709
|
},
|
|
5676
5710
|
writable: !0
|
|
5677
5711
|
}), U));
|
|
5678
|
-
return S[
|
|
5712
|
+
return S[b] = null, i(L, function(z) {
|
|
5679
5713
|
if (z && z.code !== "ERR_STREAM_PREMATURE_CLOSE") {
|
|
5680
|
-
var
|
|
5681
|
-
|
|
5714
|
+
var M = S[f];
|
|
5715
|
+
M !== null && (S[b] = null, S[a] = null, S[f] = null, M(z)), S[u] = z;
|
|
5682
5716
|
return;
|
|
5683
5717
|
}
|
|
5684
5718
|
var $ = S[a];
|
|
5685
|
-
$ !== null && (S[
|
|
5719
|
+
$ !== null && (S[b] = null, S[a] = null, S[f] = null, $(E(void 0, !0))), S[l] = !0;
|
|
5686
5720
|
}), L.on("readable", v.bind(null, S)), S;
|
|
5687
5721
|
};
|
|
5688
5722
|
return qr = F, qr;
|
|
@@ -5698,7 +5732,7 @@ function _s() {
|
|
|
5698
5732
|
if (ci) return Kr;
|
|
5699
5733
|
ci = 1, Kr = $;
|
|
5700
5734
|
var e;
|
|
5701
|
-
$.ReadableState =
|
|
5735
|
+
$.ReadableState = M, ds.EventEmitter;
|
|
5702
5736
|
var t = function(p, A) {
|
|
5703
5737
|
return p.listeners(A).length;
|
|
5704
5738
|
}, r = ps, n = Rt.Buffer, i = (typeof Xe < "u" ? Xe : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
|
|
@@ -5712,20 +5746,20 @@ function _s() {
|
|
|
5712
5746
|
var u = Rn, l;
|
|
5713
5747
|
u && u.debuglog ? l = u.debuglog("stream") : l = function() {
|
|
5714
5748
|
};
|
|
5715
|
-
var
|
|
5749
|
+
var b = kf(), g = bs, m = gs, E = m.getHighWaterMark, I = ct.codes, v = I.ERR_INVALID_ARG_TYPE, P = I.ERR_STREAM_PUSH_AFTER_EOF, T = I.ERR_METHOD_NOT_IMPLEMENTED, C = I.ERR_STREAM_UNSHIFT_AFTER_END_EVENT, F, k, L;
|
|
5716
5750
|
ge($, r);
|
|
5717
5751
|
var U = g.errorOrDestroy, S = ["error", "close", "destroy", "pause", "resume"];
|
|
5718
5752
|
function z(d, p, A) {
|
|
5719
5753
|
if (typeof d.prependListener == "function") return d.prependListener(p, A);
|
|
5720
5754
|
!d._events || !d._events[p] ? d.on(p, A) : Array.isArray(d._events[p]) ? d._events[p].unshift(A) : d._events[p] = [A, d._events[p]];
|
|
5721
5755
|
}
|
|
5722
|
-
function
|
|
5723
|
-
e = e || St(), d = d || {}, typeof A != "boolean" && (A = p instanceof e), this.objectMode = !!d.objectMode, A && (this.objectMode = this.objectMode || !!d.readableObjectMode), this.highWaterMark = E(this, d, "readableHighWaterMark", A), this.buffer = new
|
|
5756
|
+
function M(d, p, A) {
|
|
5757
|
+
e = e || St(), d = d || {}, typeof A != "boolean" && (A = p instanceof e), this.objectMode = !!d.objectMode, A && (this.objectMode = this.objectMode || !!d.readableObjectMode), this.highWaterMark = E(this, d, "readableHighWaterMark", A), this.buffer = new b(), this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this.needReadable = !1, this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = !1, this.paused = !0, this.emitClose = d.emitClose !== !1, this.autoDestroy = !!d.autoDestroy, this.destroyed = !1, this.defaultEncoding = d.defaultEncoding || "utf8", this.awaitDrain = 0, this.readingMore = !1, this.decoder = null, this.encoding = null, d.encoding && (F || (F = gr.StringDecoder), this.decoder = new F(d.encoding), this.encoding = d.encoding);
|
|
5724
5758
|
}
|
|
5725
5759
|
function $(d) {
|
|
5726
5760
|
if (e = e || St(), !(this instanceof $)) return new $(d);
|
|
5727
5761
|
var p = this instanceof e;
|
|
5728
|
-
this._readableState = new
|
|
5762
|
+
this._readableState = new M(d, this, p), this.readable = !0, d && (typeof d.read == "function" && (this._read = d.read), typeof d.destroy == "function" && (this._destroy = d.destroy)), r.call(this);
|
|
5729
5763
|
}
|
|
5730
5764
|
Object.defineProperty($.prototype, "destroyed", {
|
|
5731
5765
|
// making it explicit this property is not enumerable
|
|
@@ -5803,7 +5837,7 @@ function _s() {
|
|
|
5803
5837
|
var O = p.needReadable;
|
|
5804
5838
|
l("need readable", O), (p.length === 0 || p.length - d < p.highWaterMark) && (O = !0, l("length less than watermark", O)), p.ended || p.reading ? (O = !1, l("reading or ended", O)) : O && (l("do read"), p.reading = !0, p.sync = !0, p.length === 0 && (p.needReadable = !0), this._read(p.highWaterMark), p.sync = !1, p.reading || (d = ve(A, p)));
|
|
5805
5839
|
var Z;
|
|
5806
|
-
return d > 0 ? Z =
|
|
5840
|
+
return d > 0 ? Z = w(d, p) : Z = null, Z === null ? (p.needReadable = p.length <= p.highWaterMark, d = 0) : (p.length -= d, p.awaitDrain = 0), p.length === 0 && (p.ended || (p.needReadable = !0), A !== d && p.ended && R(this)), Z !== null && this.emit("data", Z), Z;
|
|
5807
5841
|
};
|
|
5808
5842
|
function et(d, p) {
|
|
5809
5843
|
if (l("onEofChunk"), !p.ended) {
|
|
@@ -5931,9 +5965,9 @@ function _s() {
|
|
|
5931
5965
|
return d.flowing || (l("resume"), d.flowing = !d.readableListening, qe(this, d)), d.paused = !1, this;
|
|
5932
5966
|
};
|
|
5933
5967
|
function qe(d, p) {
|
|
5934
|
-
p.resumeScheduled || (p.resumeScheduled = !0, process.nextTick(
|
|
5968
|
+
p.resumeScheduled || (p.resumeScheduled = !0, process.nextTick(Ne, d, p));
|
|
5935
5969
|
}
|
|
5936
|
-
function
|
|
5970
|
+
function Ne(d, p) {
|
|
5937
5971
|
l("resume", p.reading), p.reading || d.read(0), p.resumeScheduled = !1, d.emit("resume"), _(d), p.flowing && !p.reading && d.read(0);
|
|
5938
5972
|
}
|
|
5939
5973
|
$.prototype.pause = function() {
|
|
@@ -5997,7 +6031,7 @@ function _s() {
|
|
|
5997
6031
|
set: function(p) {
|
|
5998
6032
|
this._readableState && (this._readableState.flowing = p);
|
|
5999
6033
|
}
|
|
6000
|
-
}), $._fromList =
|
|
6034
|
+
}), $._fromList = w, Object.defineProperty($.prototype, "readableLength", {
|
|
6001
6035
|
// making it explicit this property is not enumerable
|
|
6002
6036
|
// because otherwise some prototype manipulation in
|
|
6003
6037
|
// userland will fail
|
|
@@ -6006,7 +6040,7 @@ function _s() {
|
|
|
6006
6040
|
return this._readableState.length;
|
|
6007
6041
|
}
|
|
6008
6042
|
});
|
|
6009
|
-
function
|
|
6043
|
+
function w(d, p) {
|
|
6010
6044
|
if (p.length === 0) return null;
|
|
6011
6045
|
var A;
|
|
6012
6046
|
return p.objectMode ? A = p.buffer.shift() : !d || d >= p.length ? (p.decoder ? A = p.buffer.join("") : p.buffer.length === 1 ? A = p.buffer.first() : A = p.buffer.concat(p.length), p.buffer.clear()) : A = p.buffer.consume(d, p.decoder), A;
|
|
@@ -6148,8 +6182,8 @@ function Bu() {
|
|
|
6148
6182
|
if (Array.isArray(t[0]) && (t = t[0]), t.length < 2)
|
|
6149
6183
|
throw new mu("streams");
|
|
6150
6184
|
var i, a = t.map(function(f, u) {
|
|
6151
|
-
var l = u < t.length - 1,
|
|
6152
|
-
return xu(f, l,
|
|
6185
|
+
var l = u < t.length - 1, b = u > 0;
|
|
6186
|
+
return xu(f, l, b, function(g) {
|
|
6153
6187
|
i || (i = g), g && a.forEach(di), !l && (a.forEach(di), n(i));
|
|
6154
6188
|
});
|
|
6155
6189
|
});
|
|
@@ -6220,7 +6254,7 @@ Tu(Ir, Is);
|
|
|
6220
6254
|
Ir.prototype._update = function() {
|
|
6221
6255
|
for (var e = Cu, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(t * 4);
|
|
6222
6256
|
var r = this._a, n = this._b, i = this._c, a = this._d;
|
|
6223
|
-
r =
|
|
6257
|
+
r = he(r, n, i, a, e[0], 3614090360, 7), a = he(a, r, n, i, e[1], 3905402710, 12), i = he(i, a, r, n, e[2], 606105819, 17), n = he(n, i, a, r, e[3], 3250441966, 22), r = he(r, n, i, a, e[4], 4118548399, 7), a = he(a, r, n, i, e[5], 1200080426, 12), i = he(i, a, r, n, e[6], 2821735955, 17), n = he(n, i, a, r, e[7], 4249261313, 22), r = he(r, n, i, a, e[8], 1770035416, 7), a = he(a, r, n, i, e[9], 2336552879, 12), i = he(i, a, r, n, e[10], 4294925233, 17), n = he(n, i, a, r, e[11], 2304563134, 22), r = he(r, n, i, a, e[12], 1804603682, 7), a = he(a, r, n, i, e[13], 4254626195, 12), i = he(i, a, r, n, e[14], 2792965006, 17), n = he(n, i, a, r, e[15], 1236535329, 22), r = de(r, n, i, a, e[1], 4129170786, 5), a = de(a, r, n, i, e[6], 3225465664, 9), i = de(i, a, r, n, e[11], 643717713, 14), n = de(n, i, a, r, e[0], 3921069994, 20), r = de(r, n, i, a, e[5], 3593408605, 5), a = de(a, r, n, i, e[10], 38016083, 9), i = de(i, a, r, n, e[15], 3634488961, 14), n = de(n, i, a, r, e[4], 3889429448, 20), r = de(r, n, i, a, e[9], 568446438, 5), a = de(a, r, n, i, e[14], 3275163606, 9), i = de(i, a, r, n, e[3], 4107603335, 14), n = de(n, i, a, r, e[8], 1163531501, 20), r = de(r, n, i, a, e[13], 2850285829, 5), a = de(a, r, n, i, e[2], 4243563512, 9), i = de(i, a, r, n, e[7], 1735328473, 14), n = de(n, i, a, r, e[12], 2368359562, 20), r = pe(r, n, i, a, e[5], 4294588738, 4), a = pe(a, r, n, i, e[8], 2272392833, 11), i = pe(i, a, r, n, e[11], 1839030562, 16), n = pe(n, i, a, r, e[14], 4259657740, 23), r = pe(r, n, i, a, e[1], 2763975236, 4), a = pe(a, r, n, i, e[4], 1272893353, 11), i = pe(i, a, r, n, e[7], 4139469664, 16), n = pe(n, i, a, r, e[10], 3200236656, 23), r = pe(r, n, i, a, e[13], 681279174, 4), a = pe(a, r, n, i, e[0], 3936430074, 11), i = pe(i, a, r, n, e[3], 3572445317, 16), n = pe(n, i, a, r, e[6], 76029189, 23), r = pe(r, n, i, a, e[9], 3654602809, 4), a = pe(a, r, n, i, e[12], 3873151461, 11), i = pe(i, a, r, n, e[15], 530742520, 16), n = pe(n, i, a, r, e[2], 3299628645, 23), r = be(r, n, i, a, e[0], 4096336452, 6), a = be(a, r, n, i, e[7], 1126891415, 10), i = be(i, a, r, n, e[14], 2878612391, 15), n = be(n, i, a, r, e[5], 4237533241, 21), r = be(r, n, i, a, e[12], 1700485571, 6), a = be(a, r, n, i, e[3], 2399980690, 10), i = be(i, a, r, n, e[10], 4293915773, 15), n = be(n, i, a, r, e[1], 2240044497, 21), r = be(r, n, i, a, e[8], 1873313359, 6), a = be(a, r, n, i, e[15], 4264355552, 10), i = be(i, a, r, n, e[6], 2734768916, 15), n = be(n, i, a, r, e[13], 1309151649, 21), r = be(r, n, i, a, e[4], 4149444226, 6), a = be(a, r, n, i, e[11], 3174756917, 10), i = be(i, a, r, n, e[2], 718787259, 15), n = be(n, i, a, r, e[9], 3951481745, 21), this._a = this._a + r | 0, this._b = this._b + n | 0, this._c = this._c + i | 0, this._d = this._d + a | 0;
|
|
6224
6258
|
};
|
|
6225
6259
|
Ir.prototype._digest = function() {
|
|
6226
6260
|
this._block[this._blockOffset++] = 128, this._blockOffset > 56 && (this._block.fill(0, this._blockOffset, 64), this._update(), this._blockOffset = 0), this._block.fill(0, this._blockOffset, 56), this._block.writeUInt32LE(this._length[0], 56), this._block.writeUInt32LE(this._length[1], 60), this._update();
|
|
@@ -6230,19 +6264,19 @@ Ir.prototype._digest = function() {
|
|
|
6230
6264
|
function Ar(e, t) {
|
|
6231
6265
|
return e << t | e >>> 32 - t;
|
|
6232
6266
|
}
|
|
6233
|
-
function
|
|
6267
|
+
function he(e, t, r, n, i, a, f) {
|
|
6234
6268
|
return Ar(e + (t & r | ~t & n) + i + a | 0, f) + t | 0;
|
|
6235
6269
|
}
|
|
6236
|
-
function
|
|
6270
|
+
function de(e, t, r, n, i, a, f) {
|
|
6237
6271
|
return Ar(e + (t & n | r & ~n) + i + a | 0, f) + t | 0;
|
|
6238
6272
|
}
|
|
6239
|
-
function
|
|
6273
|
+
function pe(e, t, r, n, i, a, f) {
|
|
6240
6274
|
return Ar(e + (t ^ r ^ n) + i + a | 0, f) + t | 0;
|
|
6241
6275
|
}
|
|
6242
|
-
function
|
|
6276
|
+
function be(e, t, r, n, i, a, f) {
|
|
6243
6277
|
return Ar(e + (r ^ (t | ~n)) + i + a | 0, f) + t | 0;
|
|
6244
6278
|
}
|
|
6245
|
-
var Lu = Ir, Jr = Rt.Buffer, ku = ge, As = Ss, Fu = new Array(16),
|
|
6279
|
+
var Lu = Ir, Jr = Rt.Buffer, ku = ge, As = Ss, Fu = new Array(16), Mt = [
|
|
6246
6280
|
0,
|
|
6247
6281
|
1,
|
|
6248
6282
|
2,
|
|
@@ -6573,12 +6607,12 @@ function Rr() {
|
|
|
6573
6607
|
ku(Rr, As);
|
|
6574
6608
|
Rr.prototype._update = function() {
|
|
6575
6609
|
for (var e = Fu, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(t * 4);
|
|
6576
|
-
for (var r = this._a | 0, n = this._b | 0, i = this._c | 0, a = this._d | 0, f = this._e | 0, u = this._a | 0, l = this._b | 0,
|
|
6610
|
+
for (var r = this._a | 0, n = this._b | 0, i = this._c | 0, a = this._d | 0, f = this._e | 0, u = this._a | 0, l = this._b | 0, b = this._c | 0, g = this._d | 0, m = this._e | 0, E = 0; E < 80; E += 1) {
|
|
6577
6611
|
var I, v;
|
|
6578
|
-
E < 16 ? (I = pi(r, n, i, a, f, e[
|
|
6612
|
+
E < 16 ? (I = pi(r, n, i, a, f, e[Mt[E]], zt[0], $t[E]), v = mi(u, l, b, g, m, e[Dt[E]], Gt[0], Ht[E])) : E < 32 ? (I = bi(r, n, i, a, f, e[Mt[E]], zt[1], $t[E]), v = gi(u, l, b, g, m, e[Dt[E]], Gt[1], Ht[E])) : E < 48 ? (I = yi(r, n, i, a, f, e[Mt[E]], zt[2], $t[E]), v = yi(u, l, b, g, m, e[Dt[E]], Gt[2], Ht[E])) : E < 64 ? (I = gi(r, n, i, a, f, e[Mt[E]], zt[3], $t[E]), v = bi(u, l, b, g, m, e[Dt[E]], Gt[3], Ht[E])) : (I = mi(r, n, i, a, f, e[Mt[E]], zt[4], $t[E]), v = pi(u, l, b, g, m, e[Dt[E]], Gt[4], Ht[E])), r = f, f = a, a = ut(i, 10), i = n, n = I, u = m, m = g, g = ut(b, 10), b = l, l = v;
|
|
6579
6613
|
}
|
|
6580
6614
|
var P = this._b + i + g | 0;
|
|
6581
|
-
this._b = this._c + a +
|
|
6615
|
+
this._b = this._c + a + m | 0, this._c = this._d + f + u | 0, this._d = this._e + r + l | 0, this._e = this._a + n + b | 0, this._a = P;
|
|
6582
6616
|
};
|
|
6583
6617
|
Rr.prototype._digest = function() {
|
|
6584
6618
|
this._block[this._blockOffset++] = 128, this._blockOffset > 56 && (this._block.fill(0, this._blockOffset, 64), this._update(), this._blockOffset = 0), this._block.fill(0, this._blockOffset, 56), this._block.writeUInt32LE(this._length[0], 56), this._block.writeUInt32LE(this._length[1], 60), this._update();
|
|
@@ -6610,8 +6644,8 @@ function Tr(e, t) {
|
|
|
6610
6644
|
Tr.prototype.update = function(e, t) {
|
|
6611
6645
|
typeof e == "string" && (t = t || "utf8", e = Ts.from(e, t));
|
|
6612
6646
|
for (var r = this._block, n = this._blockSize, i = e.length, a = this._len, f = 0; f < i; ) {
|
|
6613
|
-
for (var u = a % n, l = Math.min(i - f, n - u),
|
|
6614
|
-
r[u +
|
|
6647
|
+
for (var u = a % n, l = Math.min(i - f, n - u), b = 0; b < l; b++)
|
|
6648
|
+
r[u + b] = e[f + b];
|
|
6615
6649
|
a += l, f += l, a % n === 0 && this._update(r);
|
|
6616
6650
|
}
|
|
6617
6651
|
return this._len += i, this;
|
|
@@ -6633,7 +6667,7 @@ Tr.prototype.digest = function(e) {
|
|
|
6633
6667
|
Tr.prototype._update = function() {
|
|
6634
6668
|
throw new Error("_update must be implemented by subclass");
|
|
6635
6669
|
};
|
|
6636
|
-
var Tt = Tr, Ou = ge, Ps = Tt,
|
|
6670
|
+
var Tt = Tr, Ou = ge, Ps = Tt, Nu = Ee.Buffer, Mu = [
|
|
6637
6671
|
1518500249,
|
|
6638
6672
|
1859775393,
|
|
6639
6673
|
-1894007588,
|
|
@@ -6659,13 +6693,13 @@ Qt.prototype._update = function(e) {
|
|
|
6659
6693
|
for (var t = this._w, r = this._a | 0, n = this._b | 0, i = this._c | 0, a = this._d | 0, f = this._e | 0, u = 0; u < 16; ++u) t[u] = e.readInt32BE(u * 4);
|
|
6660
6694
|
for (; u < 80; ++u) t[u] = t[u - 3] ^ t[u - 8] ^ t[u - 14] ^ t[u - 16];
|
|
6661
6695
|
for (var l = 0; l < 80; ++l) {
|
|
6662
|
-
var
|
|
6696
|
+
var b = ~~(l / 20), g = $u(r) + zu(b, n, i, a) + f + t[l] + Mu[b] | 0;
|
|
6663
6697
|
f = a, a = i, i = Hu(n), n = r, r = g;
|
|
6664
6698
|
}
|
|
6665
6699
|
this._a = r + this._a | 0, this._b = n + this._b | 0, this._c = i + this._c | 0, this._d = a + this._d | 0, this._e = f + this._e | 0;
|
|
6666
6700
|
};
|
|
6667
6701
|
Qt.prototype._hash = function() {
|
|
6668
|
-
var e =
|
|
6702
|
+
var e = Nu.allocUnsafe(20);
|
|
6669
6703
|
return e.writeInt32BE(this._a | 0, 0), e.writeInt32BE(this._b | 0, 4), e.writeInt32BE(this._c | 0, 8), e.writeInt32BE(this._d | 0, 12), e.writeInt32BE(this._e | 0, 16), e;
|
|
6670
6704
|
};
|
|
6671
6705
|
var Gu = Qt, ju = ge, Cs = Tt, Wu = Ee.Buffer, qu = [
|
|
@@ -6697,7 +6731,7 @@ Zt.prototype._update = function(e) {
|
|
|
6697
6731
|
for (var t = this._w, r = this._a | 0, n = this._b | 0, i = this._c | 0, a = this._d | 0, f = this._e | 0, u = 0; u < 16; ++u) t[u] = e.readInt32BE(u * 4);
|
|
6698
6732
|
for (; u < 80; ++u) t[u] = Ku(t[u - 3] ^ t[u - 8] ^ t[u - 14] ^ t[u - 16]);
|
|
6699
6733
|
for (var l = 0; l < 80; ++l) {
|
|
6700
|
-
var
|
|
6734
|
+
var b = ~~(l / 20), g = Yu(r) + Xu(b, n, i, a) + f + t[l] + qu[b] | 0;
|
|
6701
6735
|
f = a, a = i, i = Ju(n), n = r, r = g;
|
|
6702
6736
|
}
|
|
6703
6737
|
this._a = r + this._a | 0, this._b = n + this._b | 0, this._c = i + this._c | 0, this._d = a + this._d | 0, this._e = f + this._e | 0;
|
|
@@ -6798,13 +6832,13 @@ function fc(e) {
|
|
|
6798
6832
|
return (e >>> 17 | e << 15) ^ (e >>> 19 | e << 13) ^ e >>> 10;
|
|
6799
6833
|
}
|
|
6800
6834
|
er.prototype._update = function(e) {
|
|
6801
|
-
for (var t = this._w, r = this._a | 0, n = this._b | 0, i = this._c | 0, a = this._d | 0, f = this._e | 0, u = this._f | 0, l = this._g | 0,
|
|
6835
|
+
for (var t = this._w, r = this._a | 0, n = this._b | 0, i = this._c | 0, a = this._d | 0, f = this._e | 0, u = this._f | 0, l = this._g | 0, b = this._h | 0, g = 0; g < 16; ++g) t[g] = e.readInt32BE(g * 4);
|
|
6802
6836
|
for (; g < 64; ++g) t[g] = fc(t[g - 2]) + t[g - 7] + ac(t[g - 15]) + t[g - 16] | 0;
|
|
6803
|
-
for (var
|
|
6804
|
-
var E =
|
|
6805
|
-
|
|
6837
|
+
for (var m = 0; m < 64; ++m) {
|
|
6838
|
+
var E = b + oc(f) + nc(f, u, l) + tc[m] + t[m] | 0, I = sc(r) + ic(r, n, i) | 0;
|
|
6839
|
+
b = l, l = u, u = f, f = a + E | 0, a = i, i = n, n = r, r = E + I | 0;
|
|
6806
6840
|
}
|
|
6807
|
-
this._a = r + this._a | 0, this._b = n + this._b | 0, this._c = i + this._c | 0, this._d = a + this._d | 0, this._e = f + this._e | 0, this._f = u + this._f | 0, this._g = l + this._g | 0, this._h =
|
|
6841
|
+
this._a = r + this._a | 0, this._b = n + this._b | 0, this._c = i + this._c | 0, this._d = a + this._d | 0, this._e = f + this._e | 0, this._f = u + this._f | 0, this._g = l + this._g | 0, this._h = b + this._h | 0;
|
|
6808
6842
|
};
|
|
6809
6843
|
er.prototype._hash = function() {
|
|
6810
6844
|
var e = ec.allocUnsafe(32);
|
|
@@ -7019,22 +7053,22 @@ function ue(e, t) {
|
|
|
7019
7053
|
return e >>> 0 < t >>> 0 ? 1 : 0;
|
|
7020
7054
|
}
|
|
7021
7055
|
tr.prototype._update = function(e) {
|
|
7022
|
-
for (var t = this._w, r = this._ah | 0, n = this._bh | 0, i = this._ch | 0, a = this._dh | 0, f = this._eh | 0, u = this._fh | 0, l = this._gh | 0,
|
|
7056
|
+
for (var t = this._w, r = this._ah | 0, n = this._bh | 0, i = this._ch | 0, a = this._dh | 0, f = this._eh | 0, u = this._fh | 0, l = this._gh | 0, b = this._hh | 0, g = this._al | 0, m = this._bl | 0, E = this._cl | 0, I = this._dl | 0, v = this._el | 0, P = this._fl | 0, T = this._gl | 0, C = this._hl | 0, F = 0; F < 32; F += 2)
|
|
7023
7057
|
t[F] = e.readInt32BE(F * 4), t[F + 1] = e.readInt32BE(F * 4 + 4);
|
|
7024
7058
|
for (; F < 160; F += 2) {
|
|
7025
7059
|
var k = t[F - 30], L = t[F - 15 * 2 + 1], U = mc(k, L), S = wc(L, k);
|
|
7026
7060
|
k = t[F - 2 * 2], L = t[F - 2 * 2 + 1];
|
|
7027
|
-
var z = _c(k, L),
|
|
7028
|
-
ae = ae +
|
|
7061
|
+
var z = _c(k, L), M = xc(L, k), $ = t[F - 7 * 2], se = t[F - 7 * 2 + 1], Te = t[F - 16 * 2], Ge = t[F - 16 * 2 + 1], ae = S + se | 0, xe = U + $ + ue(ae, S) | 0;
|
|
7062
|
+
ae = ae + M | 0, xe = xe + z + ue(ae, M) | 0, ae = ae + Ge | 0, xe = xe + Te + ue(ae, Ge) | 0, t[F] = xe, t[F + 1] = ae;
|
|
7029
7063
|
}
|
|
7030
7064
|
for (var ve = 0; ve < 160; ve += 2) {
|
|
7031
7065
|
xe = t[ve], ae = t[ve + 1];
|
|
7032
|
-
var et = xi(r, n, i), Pe = xi(g,
|
|
7033
|
-
_ = _ +
|
|
7066
|
+
var et = xi(r, n, i), Pe = xi(g, m, E), je = vi(r, g), Ce = vi(g, r), We = Ei(f, v), Q = Ei(v, f), oe = wi[ve], Be = wi[ve + 1], qe = _i(f, u, l), Ne = _i(v, P, T), _ = C + Q | 0, w = b + We + ue(_, C) | 0;
|
|
7067
|
+
_ = _ + Ne | 0, w = w + qe + ue(_, Ne) | 0, _ = _ + Be | 0, w = w + oe + ue(_, Be) | 0, _ = _ + ae | 0, w = w + xe + ue(_, ae) | 0;
|
|
7034
7068
|
var R = Ce + Pe | 0, D = je + et + ue(R, Ce) | 0;
|
|
7035
|
-
|
|
7069
|
+
b = l, C = T, l = u, T = P, u = f, P = v, v = I + _ | 0, f = a + w + ue(v, I) | 0, a = i, I = E, i = n, E = m, n = r, m = g, g = _ + R | 0, r = w + D + ue(g, _) | 0;
|
|
7036
7070
|
}
|
|
7037
|
-
this._al = this._al + g | 0, this._bl = this._bl +
|
|
7071
|
+
this._al = this._al + g | 0, this._bl = this._bl + m | 0, this._cl = this._cl + E | 0, this._dl = this._dl + I | 0, this._el = this._el + v | 0, this._fl = this._fl + P | 0, this._gl = this._gl + T | 0, this._hl = this._hl + C | 0, this._ah = this._ah + r + ue(this._al, g) | 0, this._bh = this._bh + n + ue(this._bl, m) | 0, this._ch = this._ch + i + ue(this._cl, E) | 0, this._dh = this._dh + a + ue(this._dl, I) | 0, this._eh = this._eh + f + ue(this._el, v) | 0, this._fh = this._fh + u + ue(this._fl, P) | 0, this._gh = this._gh + l + ue(this._gl, T) | 0, this._hh = this._hh + b + ue(this._hl, C) | 0;
|
|
7038
7072
|
};
|
|
7039
7073
|
tr.prototype._hash = function() {
|
|
7040
7074
|
var e = yc.allocUnsafe(64);
|
|
@@ -7070,11 +7104,11 @@ lt.sha224 = pc;
|
|
|
7070
7104
|
lt.sha256 = ks;
|
|
7071
7105
|
lt.sha384 = Ac;
|
|
7072
7106
|
lt.sha512 = Us;
|
|
7073
|
-
var Rc = Rs.exports, Os = Ee.Buffer,
|
|
7107
|
+
var Rc = Rs.exports, Os = Ee.Buffer, Ns = Rn.Transform, Tc = gr.StringDecoder, Pc = ge;
|
|
7074
7108
|
function Le(e) {
|
|
7075
|
-
|
|
7109
|
+
Ns.call(this), this.hashMode = typeof e == "string", this.hashMode ? this[e] = this._finalOrDigest : this.final = this._finalOrDigest, this._final && (this.__final = this._final, this._final = null), this._decoder = null, this._encoding = null;
|
|
7076
7110
|
}
|
|
7077
|
-
Pc(Le,
|
|
7111
|
+
Pc(Le, Ns);
|
|
7078
7112
|
Le.prototype.update = function(e, t, r) {
|
|
7079
7113
|
typeof e == "string" && (e = Os.from(e, t));
|
|
7080
7114
|
var n = this._update(e);
|
|
@@ -7119,11 +7153,11 @@ Le.prototype._toString = function(e, t, r) {
|
|
|
7119
7153
|
var n = this._decoder.write(e);
|
|
7120
7154
|
return r && (n += this._decoder.end()), n;
|
|
7121
7155
|
};
|
|
7122
|
-
var Cc = Le, Lc = ge, kc = Lu, Fc = Uu, Uc = Rc,
|
|
7156
|
+
var Cc = Le, Lc = ge, kc = Lu, Fc = Uu, Uc = Rc, Ms = Cc;
|
|
7123
7157
|
function Lr(e) {
|
|
7124
|
-
|
|
7158
|
+
Ms.call(this, "digest"), this._hash = e;
|
|
7125
7159
|
}
|
|
7126
|
-
Lc(Lr,
|
|
7160
|
+
Lc(Lr, Ms);
|
|
7127
7161
|
Lr.prototype._update = function(e) {
|
|
7128
7162
|
this._hash.update(e);
|
|
7129
7163
|
};
|
|
@@ -7133,7 +7167,7 @@ Lr.prototype._final = function() {
|
|
|
7133
7167
|
var Oc = function(t) {
|
|
7134
7168
|
return t = t.toLowerCase(), t === "md5" ? new kc() : t === "rmd160" || t === "ripemd160" ? new Fc() : new Lr(Uc(t));
|
|
7135
7169
|
}, ar = Ee.Buffer;
|
|
7136
|
-
function
|
|
7170
|
+
function Nc(e) {
|
|
7137
7171
|
if (e.length >= 255)
|
|
7138
7172
|
throw new TypeError("Alphabet too long");
|
|
7139
7173
|
for (var t = new Uint8Array(256), r = 0; r < t.length; r++)
|
|
@@ -7144,7 +7178,7 @@ function Mc(e) {
|
|
|
7144
7178
|
throw new TypeError(i + " is ambiguous");
|
|
7145
7179
|
t[a] = n;
|
|
7146
7180
|
}
|
|
7147
|
-
var f = e.length, u = e.charAt(0), l = Math.log(f) / Math.log(256),
|
|
7181
|
+
var f = e.length, u = e.charAt(0), l = Math.log(f) / Math.log(256), b = Math.log(256) / Math.log(f);
|
|
7148
7182
|
function g(I) {
|
|
7149
7183
|
if ((Array.isArray(I) || I instanceof Uint8Array) && (I = ar.from(I)), !ar.isBuffer(I))
|
|
7150
7184
|
throw new TypeError("Expected Buffer");
|
|
@@ -7152,7 +7186,7 @@ function Mc(e) {
|
|
|
7152
7186
|
return "";
|
|
7153
7187
|
for (var v = 0, P = 0, T = 0, C = I.length; T !== C && I[T] === 0; )
|
|
7154
7188
|
T++, v++;
|
|
7155
|
-
for (var F = (C - T) *
|
|
7189
|
+
for (var F = (C - T) * b + 1 >>> 0, k = new Uint8Array(F); T !== C; ) {
|
|
7156
7190
|
for (var L = I[T], U = 0, S = F - 1; (L !== 0 || U < P) && S !== -1; S--, U++)
|
|
7157
7191
|
L += 256 * k[S] >>> 0, k[S] = L % f >>> 0, L = L / f >>> 0;
|
|
7158
7192
|
if (L !== 0)
|
|
@@ -7161,11 +7195,11 @@ function Mc(e) {
|
|
|
7161
7195
|
}
|
|
7162
7196
|
for (var z = F - P; z !== F && k[z] === 0; )
|
|
7163
7197
|
z++;
|
|
7164
|
-
for (var
|
|
7165
|
-
|
|
7166
|
-
return
|
|
7198
|
+
for (var M = u.repeat(v); z < F; ++z)
|
|
7199
|
+
M += e.charAt(k[z]);
|
|
7200
|
+
return M;
|
|
7167
7201
|
}
|
|
7168
|
-
function
|
|
7202
|
+
function m(I) {
|
|
7169
7203
|
if (typeof I != "string")
|
|
7170
7204
|
throw new TypeError("Expected String");
|
|
7171
7205
|
if (I.length === 0)
|
|
@@ -7186,23 +7220,23 @@ function Mc(e) {
|
|
|
7186
7220
|
S++;
|
|
7187
7221
|
var z = ar.allocUnsafe(P + (C - S));
|
|
7188
7222
|
z.fill(0, 0, P);
|
|
7189
|
-
for (var
|
|
7190
|
-
z[
|
|
7223
|
+
for (var M = P; S !== C; )
|
|
7224
|
+
z[M++] = F[S++];
|
|
7191
7225
|
return z;
|
|
7192
7226
|
}
|
|
7193
7227
|
function E(I) {
|
|
7194
|
-
var v =
|
|
7228
|
+
var v = m(I);
|
|
7195
7229
|
if (v)
|
|
7196
7230
|
return v;
|
|
7197
7231
|
throw new Error("Non-base" + f + " character");
|
|
7198
7232
|
}
|
|
7199
7233
|
return {
|
|
7200
7234
|
encode: g,
|
|
7201
|
-
decodeUnsafe:
|
|
7235
|
+
decodeUnsafe: m,
|
|
7202
7236
|
decode: E
|
|
7203
7237
|
};
|
|
7204
7238
|
}
|
|
7205
|
-
var
|
|
7239
|
+
var Mc = Nc, Dc = Mc, $c = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz", Hc = Dc($c), Xr = Hc, zc = Ee.Buffer, Gc = function(e) {
|
|
7206
7240
|
function t(a) {
|
|
7207
7241
|
var f = e(a);
|
|
7208
7242
|
return Xr.encode(zc.concat([
|
|
@@ -7495,32 +7529,32 @@ function el(e) {
|
|
|
7495
7529
|
return we.typeforce(e.isPoint, u), we.typeforce(Qr, l), new f(void 0, u, l);
|
|
7496
7530
|
}
|
|
7497
7531
|
function i(u, l) {
|
|
7498
|
-
const
|
|
7532
|
+
const b = Si.decode(u), g = b.version;
|
|
7499
7533
|
if (we.Array(l)) {
|
|
7500
|
-
if (l = l.filter((
|
|
7534
|
+
if (l = l.filter((m) => g === m.wif).pop(), !l) throw new Error("Unknown network version");
|
|
7501
7535
|
} else if (l = l || hn.bitcoin, g !== l.wif) throw new Error("Invalid network version");
|
|
7502
|
-
return r(
|
|
7503
|
-
compressed:
|
|
7536
|
+
return r(b.privateKey, {
|
|
7537
|
+
compressed: b.compressed,
|
|
7504
7538
|
network: l
|
|
7505
7539
|
});
|
|
7506
7540
|
}
|
|
7507
7541
|
function a(u) {
|
|
7508
7542
|
we.typeforce(Qr, u), u === void 0 && (u = {});
|
|
7509
7543
|
const l = u.rng || Xc;
|
|
7510
|
-
let
|
|
7544
|
+
let b;
|
|
7511
7545
|
do
|
|
7512
|
-
|
|
7513
|
-
while (!e.isPrivate(
|
|
7514
|
-
return r(
|
|
7546
|
+
b = l(32), we.typeforce(we.Buffer256bit, b);
|
|
7547
|
+
while (!e.isPrivate(b));
|
|
7548
|
+
return r(b, u);
|
|
7515
7549
|
}
|
|
7516
7550
|
class f {
|
|
7517
|
-
constructor(l,
|
|
7551
|
+
constructor(l, b, g) {
|
|
7518
7552
|
pt(this, "__D");
|
|
7519
7553
|
pt(this, "__Q");
|
|
7520
7554
|
pt(this, "compressed");
|
|
7521
7555
|
pt(this, "network");
|
|
7522
7556
|
pt(this, "lowR");
|
|
7523
|
-
this.__D = l, this.__Q =
|
|
7557
|
+
this.__D = l, this.__Q = b, this.lowR = !1, g === void 0 && (g = {}), this.compressed = g.compressed === void 0 ? !0 : g.compressed, this.network = g.network || hn.bitcoin, b !== void 0 && (this.__Q = Buffer.from(e.pointCompress(b, this.compressed)));
|
|
7524
7558
|
}
|
|
7525
7559
|
get privateKey() {
|
|
7526
7560
|
return this.__D;
|
|
@@ -7539,16 +7573,16 @@ function el(e) {
|
|
|
7539
7573
|
tweak(l) {
|
|
7540
7574
|
return this.privateKey ? this.tweakFromPrivateKey(l) : this.tweakFromPublicKey(l);
|
|
7541
7575
|
}
|
|
7542
|
-
sign(l,
|
|
7576
|
+
sign(l, b) {
|
|
7543
7577
|
if (!this.__D) throw new Error("Missing private key");
|
|
7544
|
-
if (
|
|
7578
|
+
if (b === void 0 && (b = this.lowR), b === !1)
|
|
7545
7579
|
return Buffer.from(e.sign(l, this.__D));
|
|
7546
7580
|
{
|
|
7547
7581
|
let g = e.sign(l, this.__D);
|
|
7548
|
-
const
|
|
7582
|
+
const m = Buffer.alloc(32, 0);
|
|
7549
7583
|
let E = 0;
|
|
7550
7584
|
for (; g[0] > 127; )
|
|
7551
|
-
E++,
|
|
7585
|
+
E++, m.writeUIntLE(E, 0, 6), g = e.sign(l, this.__D, m);
|
|
7552
7586
|
return Buffer.from(g);
|
|
7553
7587
|
}
|
|
7554
7588
|
}
|
|
@@ -7558,30 +7592,30 @@ function el(e) {
|
|
|
7558
7592
|
throw new Error("signSchnorr not supported by ecc library");
|
|
7559
7593
|
return Buffer.from(e.signSchnorr(l, this.privateKey));
|
|
7560
7594
|
}
|
|
7561
|
-
verify(l,
|
|
7562
|
-
return e.verify(l, this.publicKey,
|
|
7595
|
+
verify(l, b) {
|
|
7596
|
+
return e.verify(l, this.publicKey, b);
|
|
7563
7597
|
}
|
|
7564
|
-
verifySchnorr(l,
|
|
7598
|
+
verifySchnorr(l, b) {
|
|
7565
7599
|
if (!e.verifySchnorr)
|
|
7566
7600
|
throw new Error("verifySchnorr not supported by ecc library");
|
|
7567
|
-
return e.verifySchnorr(l, this.publicKey.subarray(1, 33),
|
|
7601
|
+
return e.verifySchnorr(l, this.publicKey.subarray(1, 33), b);
|
|
7568
7602
|
}
|
|
7569
7603
|
tweakFromPublicKey(l) {
|
|
7570
|
-
const
|
|
7604
|
+
const b = Zc(this.publicKey), g = e.xOnlyPointAddTweak(b, l);
|
|
7571
7605
|
if (!g || g.xOnlyPubkey === null)
|
|
7572
7606
|
throw new Error("Cannot tweak public key!");
|
|
7573
|
-
const
|
|
7607
|
+
const m = Buffer.from([
|
|
7574
7608
|
g.parity === 0 ? 2 : 3
|
|
7575
7609
|
]);
|
|
7576
7610
|
return n(
|
|
7577
|
-
Buffer.concat([
|
|
7611
|
+
Buffer.concat([m, g.xOnlyPubkey]),
|
|
7578
7612
|
{ network: this.network, compressed: this.compressed }
|
|
7579
7613
|
);
|
|
7580
7614
|
}
|
|
7581
7615
|
tweakFromPrivateKey(l) {
|
|
7582
|
-
const g = this.publicKey[0] === 3 || this.publicKey[0] === 4 && (this.publicKey[64] & 1) === 1 ? e.privateNegate(this.privateKey) : this.privateKey,
|
|
7583
|
-
if (!
|
|
7584
|
-
return r(Buffer.from(
|
|
7616
|
+
const g = this.publicKey[0] === 3 || this.publicKey[0] === 4 && (this.publicKey[64] & 1) === 1 ? e.privateNegate(this.privateKey) : this.privateKey, m = e.privateAdd(g, l);
|
|
7617
|
+
if (!m) throw new Error("Invalid tweaked private key!");
|
|
7618
|
+
return r(Buffer.from(m), {
|
|
7585
7619
|
network: this.network,
|
|
7586
7620
|
compressed: this.compressed
|
|
7587
7621
|
});
|
|
@@ -7624,7 +7658,7 @@ class dn {
|
|
|
7624
7658
|
return new dn(nt(t));
|
|
7625
7659
|
}
|
|
7626
7660
|
static async fromWalletClient(t) {
|
|
7627
|
-
if (!t.account) return
|
|
7661
|
+
if (!t.account) return N("No account found");
|
|
7628
7662
|
try {
|
|
7629
7663
|
const r = await t.signTypedData({
|
|
7630
7664
|
account: t.account,
|
|
@@ -7652,7 +7686,7 @@ class dn {
|
|
|
7652
7686
|
});
|
|
7653
7687
|
return fe(new dn(nt(ir(r))));
|
|
7654
7688
|
} catch (r) {
|
|
7655
|
-
return
|
|
7689
|
+
return N("Failed to initialize: " + r);
|
|
7656
7690
|
}
|
|
7657
7691
|
}
|
|
7658
7692
|
getMasterPrivKey() {
|
|
@@ -7680,9 +7714,9 @@ class dl {
|
|
|
7680
7714
|
amount: r.toString(),
|
|
7681
7715
|
exact_out: n.toString()
|
|
7682
7716
|
}), a = await mt.get(i);
|
|
7683
|
-
return a.error ?
|
|
7717
|
+
return a.error ? N(a.error) : a.result ? fe(a.result) : N("GetQuote: Unexpected error, result is undefined");
|
|
7684
7718
|
} catch (i) {
|
|
7685
|
-
return
|
|
7719
|
+
return N("GetQuote:", String(i));
|
|
7686
7720
|
}
|
|
7687
7721
|
}
|
|
7688
7722
|
async getAttestedQuote(t) {
|
|
@@ -7693,9 +7727,9 @@ class dl {
|
|
|
7693
7727
|
"Content-Type": "application/json"
|
|
7694
7728
|
}
|
|
7695
7729
|
});
|
|
7696
|
-
return r.error ?
|
|
7730
|
+
return r.error ? N(r.error) : r.result ? fe(r.result) : N("GetAttestedQuote: Unexpected error, result is undefined");
|
|
7697
7731
|
} catch (r) {
|
|
7698
|
-
return console.log("error :", r),
|
|
7732
|
+
return console.log("error :", r), N("GetAttestedQuote:", String(r));
|
|
7699
7733
|
}
|
|
7700
7734
|
}
|
|
7701
7735
|
async getStrategies() {
|
|
@@ -7703,9 +7737,9 @@ class dl {
|
|
|
7703
7737
|
const t = await mt.get(
|
|
7704
7738
|
this.quoteUrl.endpoint("/strategies")
|
|
7705
7739
|
);
|
|
7706
|
-
if (t.error) return
|
|
7740
|
+
if (t.error) return N(t.error);
|
|
7707
7741
|
if (!t.result)
|
|
7708
|
-
return
|
|
7742
|
+
return N("GetStrategies: Unexpected error, result is undefined");
|
|
7709
7743
|
const r = {};
|
|
7710
7744
|
for (const n of Object.values(t.result)) {
|
|
7711
7745
|
const i = Wa(
|
|
@@ -7722,7 +7756,7 @@ class dl {
|
|
|
7722
7756
|
}
|
|
7723
7757
|
return fe(r);
|
|
7724
7758
|
} catch (t) {
|
|
7725
|
-
return
|
|
7759
|
+
return N("GetStrategies:", String(t));
|
|
7726
7760
|
}
|
|
7727
7761
|
}
|
|
7728
7762
|
}
|
|
@@ -7730,7 +7764,7 @@ export {
|
|
|
7730
7764
|
rf as BlockNumberFetcher,
|
|
7731
7765
|
Ya as EvmRelay,
|
|
7732
7766
|
ll as Garden,
|
|
7733
|
-
|
|
7767
|
+
ce as OrderActions,
|
|
7734
7768
|
re as OrderStatus,
|
|
7735
7769
|
qa as ParseOrderStatus,
|
|
7736
7770
|
nn as ParseSwapStatus,
|