@gardenfi/core 0.2.0-beta.57 → 0.2.0-beta.58
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 +630 -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,30 @@ 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("log", r.create_order.create_id, "already redeemed"), this.orderExecutorCache.set(
|
|
2996
|
+
r,
|
|
2997
|
+
ce.Redeem,
|
|
2998
|
+
r.destination_swap.redeem_tx_hash,
|
|
2999
|
+
a
|
|
3000
|
+
);
|
|
3001
|
+
return;
|
|
3002
|
+
}
|
|
3003
|
+
f = !0;
|
|
3004
|
+
} catch (b) {
|
|
3005
|
+
this.emit("error", r, "Failed to get redeem tx: " + b);
|
|
3006
|
+
return;
|
|
3007
|
+
}
|
|
3008
|
+
this.emit("log", r.create_order.create_id, "executing btc redeem");
|
|
2983
3009
|
try {
|
|
2984
3010
|
const g = await (await pr.from(
|
|
2985
3011
|
t,
|
|
@@ -2993,14 +3019,14 @@ class ll {
|
|
|
2993
3019
|
nt(n),
|
|
2994
3020
|
(l = r.create_order.additional_data) == null ? void 0 : l.bitcoin_optional_recipient
|
|
2995
3021
|
);
|
|
2996
|
-
this.emit("success", r,
|
|
2997
|
-
} catch (
|
|
2998
|
-
this.emit("error", r, "Failed btc redeem: " +
|
|
3022
|
+
this.emit("success", r, ce.Redeem, g), this.orderExecutorCache.set(r, ce.Redeem, g, a);
|
|
3023
|
+
} catch (b) {
|
|
3024
|
+
this.emit("error", r, "Failed btc redeem: " + b);
|
|
2999
3025
|
}
|
|
3000
3026
|
}
|
|
3001
3027
|
async btcRefund(t, r) {
|
|
3002
3028
|
var n;
|
|
3003
|
-
if (!this.orderExecutorCache.get(r,
|
|
3029
|
+
if (!this.orderExecutorCache.get(r, ce.Refund)) {
|
|
3004
3030
|
this.emit("log", r.create_order.create_id, "executing btc refund");
|
|
3005
3031
|
try {
|
|
3006
3032
|
const a = await (await pr.from(
|
|
@@ -3013,7 +3039,7 @@ class ll {
|
|
|
3013
3039
|
)).refund(
|
|
3014
3040
|
(n = r.create_order.additional_data) == null ? void 0 : n.bitcoin_optional_recipient
|
|
3015
3041
|
);
|
|
3016
|
-
this.emit("success", r,
|
|
3042
|
+
this.emit("success", r, ce.Refund, a), this.orderExecutorCache.set(r, ce.Refund, a);
|
|
3017
3043
|
} catch (i) {
|
|
3018
3044
|
this.emit("error", r, "Failed btc refund: " + i);
|
|
3019
3045
|
}
|
|
@@ -3026,7 +3052,7 @@ class ll {
|
|
|
3026
3052
|
case ke.Bitcoin:
|
|
3027
3053
|
return fe(this.wallets.btcWallet);
|
|
3028
3054
|
default:
|
|
3029
|
-
return
|
|
3055
|
+
return N("Unsupported chain for wallet");
|
|
3030
3056
|
}
|
|
3031
3057
|
}
|
|
3032
3058
|
on(t, r) {
|
|
@@ -3039,15 +3065,15 @@ class ll {
|
|
|
3039
3065
|
}
|
|
3040
3066
|
async fetchCurrentBlockNumbers(t, r) {
|
|
3041
3067
|
if (!r || !r.source || !r.destination)
|
|
3042
|
-
return
|
|
3068
|
+
return N("Provide wallets to fetch the current block number");
|
|
3043
3069
|
const n = nr(t.source_swap.chain) ? await Ln(
|
|
3044
3070
|
await r.source.getProvider()
|
|
3045
3071
|
) : await Zr(r.source);
|
|
3046
|
-
if (n.error) return
|
|
3072
|
+
if (n.error) return N(n.error);
|
|
3047
3073
|
const i = nr(t.destination_swap.chain) ? await Ln(
|
|
3048
3074
|
await r.destination.getProvider()
|
|
3049
3075
|
) : await Zr(r.destination);
|
|
3050
|
-
return i.error ?
|
|
3076
|
+
return i.error ? N(i.error) : fe({
|
|
3051
3077
|
source: n.val,
|
|
3052
3078
|
destination: i.val
|
|
3053
3079
|
});
|
|
@@ -3190,9 +3216,9 @@ var ts = {
|
|
|
3190
3216
|
tfSubError: ff,
|
|
3191
3217
|
tfJSON: br,
|
|
3192
3218
|
getValueTypeName: Bn
|
|
3193
|
-
},
|
|
3219
|
+
}, Mr, Xn;
|
|
3194
3220
|
function uf() {
|
|
3195
|
-
if (Xn) return
|
|
3221
|
+
if (Xn) return Mr;
|
|
3196
3222
|
Xn = 1;
|
|
3197
3223
|
var e = En, t = ts;
|
|
3198
3224
|
function r(S) {
|
|
@@ -3202,28 +3228,28 @@ function uf() {
|
|
|
3202
3228
|
return typeof S == "string" && /^([0-9a-f]{2})+$/i.test(S);
|
|
3203
3229
|
}
|
|
3204
3230
|
function i(S, z) {
|
|
3205
|
-
var
|
|
3231
|
+
var M = S.toJSON();
|
|
3206
3232
|
function $(se) {
|
|
3207
3233
|
if (!S(se)) return !1;
|
|
3208
3234
|
if (se.length === z) return !0;
|
|
3209
|
-
throw t.tfCustomError(
|
|
3235
|
+
throw t.tfCustomError(M + "(Length: " + z + ")", M + "(Length: " + se.length + ")");
|
|
3210
3236
|
}
|
|
3211
3237
|
return $.toJSON = function() {
|
|
3212
|
-
return
|
|
3238
|
+
return M;
|
|
3213
3239
|
}, $;
|
|
3214
3240
|
}
|
|
3215
3241
|
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
|
-
|
|
3242
|
+
function b(S, z, M) {
|
|
3243
|
+
M = M || e.Number;
|
|
3218
3244
|
function $(se, Te) {
|
|
3219
|
-
return
|
|
3245
|
+
return M(se, Te) && se > S && se < z;
|
|
3220
3246
|
}
|
|
3221
3247
|
return $.toJSON = function() {
|
|
3222
|
-
return `${
|
|
3248
|
+
return `${M.toJSON()} between [${S}, ${z}]`;
|
|
3223
3249
|
}, $;
|
|
3224
3250
|
}
|
|
3225
3251
|
var g = Math.pow(2, 53) - 1;
|
|
3226
|
-
function
|
|
3252
|
+
function m(S) {
|
|
3227
3253
|
return typeof S == "number" && isFinite(S);
|
|
3228
3254
|
}
|
|
3229
3255
|
function E(S) {
|
|
@@ -3254,14 +3280,14 @@ function uf() {
|
|
|
3254
3280
|
ArrayN: a,
|
|
3255
3281
|
Buffer: r,
|
|
3256
3282
|
BufferN: f,
|
|
3257
|
-
Finite:
|
|
3283
|
+
Finite: m,
|
|
3258
3284
|
Hex: n,
|
|
3259
3285
|
HexN: u,
|
|
3260
3286
|
Int8: E,
|
|
3261
3287
|
Int16: I,
|
|
3262
3288
|
Int32: v,
|
|
3263
3289
|
Int53: P,
|
|
3264
|
-
Range:
|
|
3290
|
+
Range: b,
|
|
3265
3291
|
StringN: l,
|
|
3266
3292
|
UInt8: T,
|
|
3267
3293
|
UInt16: C,
|
|
@@ -3272,17 +3298,17 @@ function uf() {
|
|
|
3272
3298
|
L[U].toJSON = (function(S) {
|
|
3273
3299
|
return S;
|
|
3274
3300
|
}).bind(null, U);
|
|
3275
|
-
return
|
|
3301
|
+
return Mr = L, Mr;
|
|
3276
3302
|
}
|
|
3277
|
-
var Jt = ts,
|
|
3303
|
+
var Jt = ts, le = En, De = Jt.tfJSON, rs = Jt.TfTypeError, ns = Jt.TfPropertyTypeError, Nt = Jt.tfSubError, cf = Jt.getValueTypeName, $e = {
|
|
3278
3304
|
arrayOf: function(t, r) {
|
|
3279
3305
|
t = Ue(t), r = r || {};
|
|
3280
3306
|
function n(i, a) {
|
|
3281
|
-
return !
|
|
3307
|
+
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
3308
|
try {
|
|
3283
3309
|
return _e(t, f, a);
|
|
3284
3310
|
} catch (l) {
|
|
3285
|
-
throw
|
|
3311
|
+
throw Nt(l, u);
|
|
3286
3312
|
}
|
|
3287
3313
|
});
|
|
3288
3314
|
}
|
|
@@ -3294,7 +3320,7 @@ var Jt = ts, ce = En, De = Jt.tfJSON, rs = Jt.TfTypeError, ns = Jt.TfPropertyTyp
|
|
|
3294
3320
|
maybe: function e(t) {
|
|
3295
3321
|
t = Ue(t);
|
|
3296
3322
|
function r(n, i) {
|
|
3297
|
-
return
|
|
3323
|
+
return le.Nil(n) || t(n, i, e);
|
|
3298
3324
|
}
|
|
3299
3325
|
return r.toJSON = function() {
|
|
3300
3326
|
return "?" + De(t);
|
|
@@ -3303,18 +3329,18 @@ var Jt = ts, ce = En, De = Jt.tfJSON, rs = Jt.TfTypeError, ns = Jt.TfPropertyTyp
|
|
|
3303
3329
|
map: function(t, r) {
|
|
3304
3330
|
t = Ue(t), r && (r = Ue(r));
|
|
3305
3331
|
function n(i, a) {
|
|
3306
|
-
if (!
|
|
3332
|
+
if (!le.Object(i) || le.Nil(i)) return !1;
|
|
3307
3333
|
for (var f in i) {
|
|
3308
3334
|
try {
|
|
3309
3335
|
r && _e(r, f, a);
|
|
3310
3336
|
} catch (l) {
|
|
3311
|
-
throw
|
|
3337
|
+
throw Nt(l, f, "key");
|
|
3312
3338
|
}
|
|
3313
3339
|
try {
|
|
3314
3340
|
var u = i[f];
|
|
3315
3341
|
_e(t, u, a);
|
|
3316
3342
|
} catch (l) {
|
|
3317
|
-
throw
|
|
3343
|
+
throw Nt(l, f);
|
|
3318
3344
|
}
|
|
3319
3345
|
}
|
|
3320
3346
|
return !0;
|
|
@@ -3330,15 +3356,15 @@ var Jt = ts, ce = En, De = Jt.tfJSON, rs = Jt.TfTypeError, ns = Jt.TfPropertyTyp
|
|
|
3330
3356
|
for (var n in t)
|
|
3331
3357
|
r[n] = Ue(t[n]);
|
|
3332
3358
|
function i(a, f) {
|
|
3333
|
-
if (!
|
|
3359
|
+
if (!le.Object(a) || le.Nil(a)) return !1;
|
|
3334
3360
|
var u;
|
|
3335
3361
|
try {
|
|
3336
3362
|
for (u in r) {
|
|
3337
|
-
var l = r[u],
|
|
3338
|
-
_e(l,
|
|
3363
|
+
var l = r[u], b = a[u];
|
|
3364
|
+
_e(l, b, f);
|
|
3339
3365
|
}
|
|
3340
3366
|
} catch (g) {
|
|
3341
|
-
throw
|
|
3367
|
+
throw Nt(g, u);
|
|
3342
3368
|
}
|
|
3343
3369
|
if (f) {
|
|
3344
3370
|
for (u in a)
|
|
@@ -3392,11 +3418,11 @@ var Jt = ts, ce = En, De = Jt.tfJSON, rs = Jt.TfTypeError, ns = Jt.TfPropertyTyp
|
|
|
3392
3418
|
tuple: function() {
|
|
3393
3419
|
var t = [].slice.call(arguments).map(Ue);
|
|
3394
3420
|
function r(n, i) {
|
|
3395
|
-
return
|
|
3421
|
+
return le.Nil(n) || le.Nil(n.length) || i && n.length !== t.length ? !1 : t.every(function(a, f) {
|
|
3396
3422
|
try {
|
|
3397
3423
|
return _e(a, n[f], i);
|
|
3398
3424
|
} catch (u) {
|
|
3399
|
-
throw
|
|
3425
|
+
throw Nt(u, f);
|
|
3400
3426
|
}
|
|
3401
3427
|
});
|
|
3402
3428
|
}
|
|
@@ -3415,27 +3441,27 @@ var Jt = ts, ce = En, De = Jt.tfJSON, rs = Jt.TfTypeError, ns = Jt.TfPropertyTyp
|
|
|
3415
3441
|
};
|
|
3416
3442
|
$e.oneOf = $e.anyOf;
|
|
3417
3443
|
function Ue(e) {
|
|
3418
|
-
if (
|
|
3419
|
-
return e[0] === "?" ? $e.maybe(e.slice(1)) :
|
|
3420
|
-
if (e &&
|
|
3421
|
-
if (
|
|
3444
|
+
if (le.String(e))
|
|
3445
|
+
return e[0] === "?" ? $e.maybe(e.slice(1)) : le[e] || $e.quacksLike(e);
|
|
3446
|
+
if (e && le.Object(e)) {
|
|
3447
|
+
if (le.Array(e)) {
|
|
3422
3448
|
if (e.length !== 1) throw new TypeError("Expected compile() parameter of type Array of length 1");
|
|
3423
3449
|
return $e.arrayOf(e[0]);
|
|
3424
3450
|
}
|
|
3425
3451
|
return $e.object(e);
|
|
3426
|
-
} else if (
|
|
3452
|
+
} else if (le.Function(e))
|
|
3427
3453
|
return e;
|
|
3428
3454
|
return $e.value(e);
|
|
3429
3455
|
}
|
|
3430
3456
|
function _e(e, t, r, n) {
|
|
3431
|
-
if (
|
|
3457
|
+
if (le.Function(e)) {
|
|
3432
3458
|
if (e(t, r)) return !0;
|
|
3433
3459
|
throw new rs(n || e, t);
|
|
3434
3460
|
}
|
|
3435
3461
|
return _e(Ue(e), t, r);
|
|
3436
3462
|
}
|
|
3437
|
-
for (var Je in
|
|
3438
|
-
_e[Je] =
|
|
3463
|
+
for (var Je in le)
|
|
3464
|
+
_e[Je] = le[Je];
|
|
3439
3465
|
for (Je in $e)
|
|
3440
3466
|
_e[Je] = $e[Je];
|
|
3441
3467
|
var Qn = uf();
|
|
@@ -3511,25 +3537,25 @@ function wf(e) {
|
|
|
3511
3537
|
var In = {};
|
|
3512
3538
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
3513
3539
|
In.read = function(e, t, r, n, i) {
|
|
3514
|
-
var a, f, u = i * 8 - n - 1, l = (1 << u) - 1,
|
|
3515
|
-
for (
|
|
3540
|
+
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];
|
|
3541
|
+
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
3542
|
;
|
|
3517
|
-
for (f = a & (1 << -g) - 1, a >>= -g, g += n; g > 0; f = f * 256 + e[t +
|
|
3543
|
+
for (f = a & (1 << -g) - 1, a >>= -g, g += n; g > 0; f = f * 256 + e[t + m], m += E, g -= 8)
|
|
3518
3544
|
;
|
|
3519
3545
|
if (a === 0)
|
|
3520
|
-
a = 1 -
|
|
3546
|
+
a = 1 - b;
|
|
3521
3547
|
else {
|
|
3522
3548
|
if (a === l)
|
|
3523
3549
|
return f ? NaN : (I ? -1 : 1) * (1 / 0);
|
|
3524
|
-
f = f + Math.pow(2, n), a = a -
|
|
3550
|
+
f = f + Math.pow(2, n), a = a - b;
|
|
3525
3551
|
}
|
|
3526
3552
|
return (I ? -1 : 1) * f * Math.pow(2, a - n);
|
|
3527
3553
|
};
|
|
3528
3554
|
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 +
|
|
3555
|
+
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;
|
|
3556
|
+
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
3557
|
;
|
|
3532
|
-
for (f = f << i | u,
|
|
3558
|
+
for (f = f << i | u, b += i; b > 0; e[r + I] = f & 255, I += v, f /= 256, b -= 8)
|
|
3533
3559
|
;
|
|
3534
3560
|
e[r + I - v] |= P * 128;
|
|
3535
3561
|
};
|
|
@@ -3581,7 +3607,7 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3581
3607
|
throw new TypeError(
|
|
3582
3608
|
'The "string" argument must be of type string. Received type number'
|
|
3583
3609
|
);
|
|
3584
|
-
return
|
|
3610
|
+
return m(c);
|
|
3585
3611
|
}
|
|
3586
3612
|
return l(c, s, o);
|
|
3587
3613
|
}
|
|
@@ -3604,8 +3630,8 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3604
3630
|
const h = c.valueOf && c.valueOf();
|
|
3605
3631
|
if (h != null && h !== c)
|
|
3606
3632
|
return u.from(h, s, o);
|
|
3607
|
-
const
|
|
3608
|
-
if (
|
|
3633
|
+
const y = T(c);
|
|
3634
|
+
if (y) return y;
|
|
3609
3635
|
if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof c[Symbol.toPrimitive] == "function")
|
|
3610
3636
|
return u.from(c[Symbol.toPrimitive]("string"), s, o);
|
|
3611
3637
|
throw new TypeError(
|
|
@@ -3615,33 +3641,33 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3615
3641
|
u.from = function(c, s, o) {
|
|
3616
3642
|
return l(c, s, o);
|
|
3617
3643
|
}, Object.setPrototypeOf(u.prototype, Uint8Array.prototype), Object.setPrototypeOf(u, Uint8Array);
|
|
3618
|
-
function
|
|
3644
|
+
function b(c) {
|
|
3619
3645
|
if (typeof c != "number")
|
|
3620
3646
|
throw new TypeError('"size" argument must be of type number');
|
|
3621
3647
|
if (c < 0)
|
|
3622
3648
|
throw new RangeError('The value "' + c + '" is invalid for option "size"');
|
|
3623
3649
|
}
|
|
3624
3650
|
function g(c, s, o) {
|
|
3625
|
-
return
|
|
3651
|
+
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
3652
|
}
|
|
3627
3653
|
u.alloc = function(c, s, o) {
|
|
3628
3654
|
return g(c, s, o);
|
|
3629
3655
|
};
|
|
3630
|
-
function
|
|
3631
|
-
return
|
|
3656
|
+
function m(c) {
|
|
3657
|
+
return b(c), f(c < 0 ? 0 : C(c) | 0);
|
|
3632
3658
|
}
|
|
3633
3659
|
u.allocUnsafe = function(c) {
|
|
3634
|
-
return
|
|
3660
|
+
return m(c);
|
|
3635
3661
|
}, u.allocUnsafeSlow = function(c) {
|
|
3636
|
-
return
|
|
3662
|
+
return m(c);
|
|
3637
3663
|
};
|
|
3638
3664
|
function E(c, s) {
|
|
3639
3665
|
if ((typeof s != "string" || s === "") && (s = "utf8"), !u.isEncoding(s))
|
|
3640
3666
|
throw new TypeError("Unknown encoding: " + s);
|
|
3641
3667
|
const o = k(c, s) | 0;
|
|
3642
3668
|
let h = f(o);
|
|
3643
|
-
const
|
|
3644
|
-
return
|
|
3669
|
+
const y = h.write(c, s);
|
|
3670
|
+
return y !== o && (h = h.slice(0, y)), h;
|
|
3645
3671
|
}
|
|
3646
3672
|
function I(c) {
|
|
3647
3673
|
const s = c.length < 0 ? 0 : C(c.length) | 0, o = f(s);
|
|
@@ -3690,13 +3716,13 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3690
3716
|
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
|
|
3691
3717
|
);
|
|
3692
3718
|
if (s === o) return 0;
|
|
3693
|
-
let h = s.length,
|
|
3694
|
-
for (let x = 0, B = Math.min(h,
|
|
3719
|
+
let h = s.length, y = o.length;
|
|
3720
|
+
for (let x = 0, B = Math.min(h, y); x < B; ++x)
|
|
3695
3721
|
if (s[x] !== o[x]) {
|
|
3696
|
-
h = s[x],
|
|
3722
|
+
h = s[x], y = o[x];
|
|
3697
3723
|
break;
|
|
3698
3724
|
}
|
|
3699
|
-
return h <
|
|
3725
|
+
return h < y ? -1 : y < h ? 1 : 0;
|
|
3700
3726
|
}, u.isEncoding = function(s) {
|
|
3701
3727
|
switch (String(s).toLowerCase()) {
|
|
3702
3728
|
case "hex":
|
|
@@ -3723,23 +3749,23 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3723
3749
|
if (o === void 0)
|
|
3724
3750
|
for (o = 0, h = 0; h < s.length; ++h)
|
|
3725
3751
|
o += s[h].length;
|
|
3726
|
-
const
|
|
3752
|
+
const y = u.allocUnsafe(o);
|
|
3727
3753
|
let x = 0;
|
|
3728
3754
|
for (h = 0; h < s.length; ++h) {
|
|
3729
3755
|
let B = s[h];
|
|
3730
3756
|
if (Se(B, Uint8Array))
|
|
3731
|
-
x + B.length >
|
|
3732
|
-
|
|
3757
|
+
x + B.length > y.length ? (u.isBuffer(B) || (B = u.from(B)), B.copy(y, x)) : Uint8Array.prototype.set.call(
|
|
3758
|
+
y,
|
|
3733
3759
|
B,
|
|
3734
3760
|
x
|
|
3735
3761
|
);
|
|
3736
3762
|
else if (u.isBuffer(B))
|
|
3737
|
-
B.copy(
|
|
3763
|
+
B.copy(y, x);
|
|
3738
3764
|
else
|
|
3739
3765
|
throw new TypeError('"list" argument must be an Array of Buffers');
|
|
3740
3766
|
x += B.length;
|
|
3741
3767
|
}
|
|
3742
|
-
return
|
|
3768
|
+
return y;
|
|
3743
3769
|
};
|
|
3744
3770
|
function k(c, s) {
|
|
3745
3771
|
if (u.isBuffer(c))
|
|
@@ -3752,7 +3778,7 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3752
3778
|
);
|
|
3753
3779
|
const o = c.length, h = arguments.length > 2 && arguments[2] === !0;
|
|
3754
3780
|
if (!h && o === 0) return 0;
|
|
3755
|
-
let
|
|
3781
|
+
let y = !1;
|
|
3756
3782
|
for (; ; )
|
|
3757
3783
|
switch (s) {
|
|
3758
3784
|
case "ascii":
|
|
@@ -3772,9 +3798,9 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3772
3798
|
case "base64":
|
|
3773
3799
|
return Pt(c).length;
|
|
3774
3800
|
default:
|
|
3775
|
-
if (
|
|
3801
|
+
if (y)
|
|
3776
3802
|
return h ? -1 : V(c).length;
|
|
3777
|
-
s = ("" + s).toLowerCase(),
|
|
3803
|
+
s = ("" + s).toLowerCase(), y = !0;
|
|
3778
3804
|
}
|
|
3779
3805
|
}
|
|
3780
3806
|
u.byteLength = k;
|
|
@@ -3842,22 +3868,22 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3842
3868
|
let s = "";
|
|
3843
3869
|
const o = e.INSPECT_MAX_BYTES;
|
|
3844
3870
|
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,
|
|
3871
|
+
}, n && (u.prototype[n] = u.prototype.inspect), u.prototype.compare = function(s, o, h, y, x) {
|
|
3846
3872
|
if (Se(s, Uint8Array) && (s = u.from(s, s.offset, s.byteLength)), !u.isBuffer(s))
|
|
3847
3873
|
throw new TypeError(
|
|
3848
3874
|
'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof s
|
|
3849
3875
|
);
|
|
3850
|
-
if (o === void 0 && (o = 0), h === void 0 && (h = s ? s.length : 0),
|
|
3876
|
+
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
3877
|
throw new RangeError("out of range index");
|
|
3852
|
-
if (
|
|
3878
|
+
if (y >= x && o >= h)
|
|
3853
3879
|
return 0;
|
|
3854
|
-
if (
|
|
3880
|
+
if (y >= x)
|
|
3855
3881
|
return -1;
|
|
3856
3882
|
if (o >= h)
|
|
3857
3883
|
return 1;
|
|
3858
|
-
if (o >>>= 0, h >>>= 0,
|
|
3859
|
-
let B = x -
|
|
3860
|
-
const ne = Math.min(B, q), ee = this.slice(
|
|
3884
|
+
if (o >>>= 0, h >>>= 0, y >>>= 0, x >>>= 0, this === s) return 0;
|
|
3885
|
+
let B = x - y, q = h - o;
|
|
3886
|
+
const ne = Math.min(B, q), ee = this.slice(y, x), ie = s.slice(o, h);
|
|
3861
3887
|
for (let Y = 0; Y < ne; ++Y)
|
|
3862
3888
|
if (ee[Y] !== ie[Y]) {
|
|
3863
3889
|
B = ee[Y], q = ie[Y];
|
|
@@ -3865,21 +3891,21 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3865
3891
|
}
|
|
3866
3892
|
return B < q ? -1 : q < B ? 1 : 0;
|
|
3867
3893
|
};
|
|
3868
|
-
function S(c, s, o, h,
|
|
3894
|
+
function S(c, s, o, h, y) {
|
|
3869
3895
|
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 (
|
|
3896
|
+
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) {
|
|
3897
|
+
if (y) return -1;
|
|
3872
3898
|
o = c.length - 1;
|
|
3873
3899
|
} else if (o < 0)
|
|
3874
|
-
if (
|
|
3900
|
+
if (y) o = 0;
|
|
3875
3901
|
else return -1;
|
|
3876
3902
|
if (typeof s == "string" && (s = u.from(s, h)), u.isBuffer(s))
|
|
3877
|
-
return s.length === 0 ? -1 : z(c, s, o, h,
|
|
3903
|
+
return s.length === 0 ? -1 : z(c, s, o, h, y);
|
|
3878
3904
|
if (typeof s == "number")
|
|
3879
|
-
return s = s & 255, typeof Uint8Array.prototype.indexOf == "function" ?
|
|
3905
|
+
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
3906
|
throw new TypeError("val must be string, number or Buffer");
|
|
3881
3907
|
}
|
|
3882
|
-
function z(c, s, o, h,
|
|
3908
|
+
function z(c, s, o, h, y) {
|
|
3883
3909
|
let x = 1, B = c.length, q = s.length;
|
|
3884
3910
|
if (h !== void 0 && (h = String(h).toLowerCase(), h === "ucs2" || h === "ucs-2" || h === "utf16le" || h === "utf-16le")) {
|
|
3885
3911
|
if (c.length < 2 || s.length < 2)
|
|
@@ -3890,7 +3916,7 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3890
3916
|
return x === 1 ? ie[Y] : ie.readUInt16BE(Y * x);
|
|
3891
3917
|
}
|
|
3892
3918
|
let ee;
|
|
3893
|
-
if (
|
|
3919
|
+
if (y) {
|
|
3894
3920
|
let ie = -1;
|
|
3895
3921
|
for (ee = o; ee < B; ee++)
|
|
3896
3922
|
if (ne(c, ee) === ne(s, ie === -1 ? 0 : ee - ie)) {
|
|
@@ -3916,10 +3942,10 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3916
3942
|
}, u.prototype.lastIndexOf = function(s, o, h) {
|
|
3917
3943
|
return S(this, s, o, h, !1);
|
|
3918
3944
|
};
|
|
3919
|
-
function
|
|
3945
|
+
function M(c, s, o, h) {
|
|
3920
3946
|
o = Number(o) || 0;
|
|
3921
|
-
const
|
|
3922
|
-
h ? (h = Number(h), h >
|
|
3947
|
+
const y = c.length - o;
|
|
3948
|
+
h ? (h = Number(h), h > y && (h = y)) : h = y;
|
|
3923
3949
|
const x = s.length;
|
|
3924
3950
|
h > x / 2 && (h = x / 2);
|
|
3925
3951
|
let B;
|
|
@@ -3942,13 +3968,13 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3942
3968
|
function Ge(c, s, o, h) {
|
|
3943
3969
|
return dt(ht(s, c.length - o), c, o, h);
|
|
3944
3970
|
}
|
|
3945
|
-
u.prototype.write = function(s, o, h,
|
|
3971
|
+
u.prototype.write = function(s, o, h, y) {
|
|
3946
3972
|
if (o === void 0)
|
|
3947
|
-
|
|
3973
|
+
y = "utf8", h = this.length, o = 0;
|
|
3948
3974
|
else if (h === void 0 && typeof o == "string")
|
|
3949
|
-
|
|
3975
|
+
y = o, h = this.length, o = 0;
|
|
3950
3976
|
else if (isFinite(o))
|
|
3951
|
-
o = o >>> 0, isFinite(h) ? (h = h >>> 0,
|
|
3977
|
+
o = o >>> 0, isFinite(h) ? (h = h >>> 0, y === void 0 && (y = "utf8")) : (y = h, h = void 0);
|
|
3952
3978
|
else
|
|
3953
3979
|
throw new Error(
|
|
3954
3980
|
"Buffer.write(string, encoding, offset[, length]) is no longer supported"
|
|
@@ -3956,12 +3982,12 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3956
3982
|
const x = this.length - o;
|
|
3957
3983
|
if ((h === void 0 || h > x) && (h = x), s.length > 0 && (h < 0 || o < 0) || o > this.length)
|
|
3958
3984
|
throw new RangeError("Attempt to write outside buffer bounds");
|
|
3959
|
-
|
|
3985
|
+
y || (y = "utf8");
|
|
3960
3986
|
let B = !1;
|
|
3961
3987
|
for (; ; )
|
|
3962
|
-
switch (
|
|
3988
|
+
switch (y) {
|
|
3963
3989
|
case "hex":
|
|
3964
|
-
return
|
|
3990
|
+
return M(this, s, o, h);
|
|
3965
3991
|
case "utf8":
|
|
3966
3992
|
case "utf-8":
|
|
3967
3993
|
return $(this, s, o, h);
|
|
@@ -3977,8 +4003,8 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3977
4003
|
case "utf-16le":
|
|
3978
4004
|
return Ge(this, s, o, h);
|
|
3979
4005
|
default:
|
|
3980
|
-
if (B) throw new TypeError("Unknown encoding: " +
|
|
3981
|
-
|
|
4006
|
+
if (B) throw new TypeError("Unknown encoding: " + y);
|
|
4007
|
+
y = ("" + y).toLowerCase(), B = !0;
|
|
3982
4008
|
}
|
|
3983
4009
|
}, u.prototype.toJSON = function() {
|
|
3984
4010
|
return {
|
|
@@ -3992,27 +4018,27 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
3992
4018
|
function xe(c, s, o) {
|
|
3993
4019
|
o = Math.min(c.length, o);
|
|
3994
4020
|
const h = [];
|
|
3995
|
-
let
|
|
3996
|
-
for (;
|
|
3997
|
-
const x = c[
|
|
4021
|
+
let y = s;
|
|
4022
|
+
for (; y < o; ) {
|
|
4023
|
+
const x = c[y];
|
|
3998
4024
|
let B = null, q = x > 239 ? 4 : x > 223 ? 3 : x > 191 ? 2 : 1;
|
|
3999
|
-
if (
|
|
4025
|
+
if (y + q <= o) {
|
|
4000
4026
|
let ne, ee, ie, Y;
|
|
4001
4027
|
switch (q) {
|
|
4002
4028
|
case 1:
|
|
4003
4029
|
x < 128 && (B = x);
|
|
4004
4030
|
break;
|
|
4005
4031
|
case 2:
|
|
4006
|
-
ne = c[
|
|
4032
|
+
ne = c[y + 1], (ne & 192) === 128 && (Y = (x & 31) << 6 | ne & 63, Y > 127 && (B = Y));
|
|
4007
4033
|
break;
|
|
4008
4034
|
case 3:
|
|
4009
|
-
ne = c[
|
|
4035
|
+
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
4036
|
break;
|
|
4011
4037
|
case 4:
|
|
4012
|
-
ne = c[
|
|
4038
|
+
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
4039
|
}
|
|
4014
4040
|
}
|
|
4015
|
-
B === null ? (B = 65533, q = 1) : B > 65535 && (B -= 65536, h.push(B >>> 10 & 1023 | 55296), B = 56320 | B & 1023), h.push(B),
|
|
4041
|
+
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
4042
|
}
|
|
4017
4043
|
return et(h);
|
|
4018
4044
|
}
|
|
@@ -4032,37 +4058,37 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4032
4058
|
function Pe(c, s, o) {
|
|
4033
4059
|
let h = "";
|
|
4034
4060
|
o = Math.min(c.length, o);
|
|
4035
|
-
for (let
|
|
4036
|
-
h += String.fromCharCode(c[
|
|
4061
|
+
for (let y = s; y < o; ++y)
|
|
4062
|
+
h += String.fromCharCode(c[y] & 127);
|
|
4037
4063
|
return h;
|
|
4038
4064
|
}
|
|
4039
4065
|
function je(c, s, o) {
|
|
4040
4066
|
let h = "";
|
|
4041
4067
|
o = Math.min(c.length, o);
|
|
4042
|
-
for (let
|
|
4043
|
-
h += String.fromCharCode(c[
|
|
4068
|
+
for (let y = s; y < o; ++y)
|
|
4069
|
+
h += String.fromCharCode(c[y]);
|
|
4044
4070
|
return h;
|
|
4045
4071
|
}
|
|
4046
4072
|
function Ce(c, s, o) {
|
|
4047
4073
|
const h = c.length;
|
|
4048
4074
|
(!s || s < 0) && (s = 0), (!o || o < 0 || o > h) && (o = h);
|
|
4049
|
-
let
|
|
4075
|
+
let y = "";
|
|
4050
4076
|
for (let x = s; x < o; ++x)
|
|
4051
|
-
|
|
4052
|
-
return
|
|
4077
|
+
y += Ct[c[x]];
|
|
4078
|
+
return y;
|
|
4053
4079
|
}
|
|
4054
4080
|
function We(c, s, o) {
|
|
4055
4081
|
const h = c.slice(s, o);
|
|
4056
|
-
let
|
|
4082
|
+
let y = "";
|
|
4057
4083
|
for (let x = 0; x < h.length - 1; x += 2)
|
|
4058
|
-
|
|
4059
|
-
return
|
|
4084
|
+
y += String.fromCharCode(h[x] + h[x + 1] * 256);
|
|
4085
|
+
return y;
|
|
4060
4086
|
}
|
|
4061
4087
|
u.prototype.slice = function(s, o) {
|
|
4062
4088
|
const h = this.length;
|
|
4063
4089
|
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(
|
|
4090
|
+
const y = this.subarray(s, o);
|
|
4091
|
+
return Object.setPrototypeOf(y, u.prototype), y;
|
|
4066
4092
|
};
|
|
4067
4093
|
function Q(c, s, o) {
|
|
4068
4094
|
if (c % 1 !== 0 || c < 0) throw new RangeError("offset is not uint");
|
|
@@ -4070,16 +4096,16 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4070
4096
|
}
|
|
4071
4097
|
u.prototype.readUintLE = u.prototype.readUIntLE = function(s, o, h) {
|
|
4072
4098
|
s = s >>> 0, o = o >>> 0, h || Q(s, o, this.length);
|
|
4073
|
-
let
|
|
4099
|
+
let y = this[s], x = 1, B = 0;
|
|
4074
4100
|
for (; ++B < o && (x *= 256); )
|
|
4075
|
-
|
|
4076
|
-
return
|
|
4101
|
+
y += this[s + B] * x;
|
|
4102
|
+
return y;
|
|
4077
4103
|
}, u.prototype.readUintBE = u.prototype.readUIntBE = function(s, o, h) {
|
|
4078
4104
|
s = s >>> 0, o = o >>> 0, h || Q(s, o, this.length);
|
|
4079
|
-
let
|
|
4105
|
+
let y = this[s + --o], x = 1;
|
|
4080
4106
|
for (; o > 0 && (x *= 256); )
|
|
4081
|
-
|
|
4082
|
-
return
|
|
4107
|
+
y += this[s + --o] * x;
|
|
4108
|
+
return y;
|
|
4083
4109
|
}, u.prototype.readUint8 = u.prototype.readUInt8 = function(s, o) {
|
|
4084
4110
|
return s = s >>> 0, o || Q(s, 1, this.length), this[s];
|
|
4085
4111
|
}, u.prototype.readUint16LE = u.prototype.readUInt16LE = function(s, o) {
|
|
@@ -4094,25 +4120,25 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4094
4120
|
s = s >>> 0, A(s, "offset");
|
|
4095
4121
|
const o = this[s], h = this[s + 7];
|
|
4096
4122
|
(o === void 0 || h === void 0) && O(s, this.length - 8);
|
|
4097
|
-
const
|
|
4098
|
-
return BigInt(
|
|
4123
|
+
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;
|
|
4124
|
+
return BigInt(y) + (BigInt(x) << BigInt(32));
|
|
4099
4125
|
}), u.prototype.readBigUInt64BE = Ie(function(s) {
|
|
4100
4126
|
s = s >>> 0, A(s, "offset");
|
|
4101
4127
|
const o = this[s], h = this[s + 7];
|
|
4102
4128
|
(o === void 0 || h === void 0) && O(s, this.length - 8);
|
|
4103
|
-
const
|
|
4104
|
-
return (BigInt(
|
|
4129
|
+
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;
|
|
4130
|
+
return (BigInt(y) << BigInt(32)) + BigInt(x);
|
|
4105
4131
|
}), u.prototype.readIntLE = function(s, o, h) {
|
|
4106
4132
|
s = s >>> 0, o = o >>> 0, h || Q(s, o, this.length);
|
|
4107
|
-
let
|
|
4133
|
+
let y = this[s], x = 1, B = 0;
|
|
4108
4134
|
for (; ++B < o && (x *= 256); )
|
|
4109
|
-
|
|
4110
|
-
return x *= 128,
|
|
4135
|
+
y += this[s + B] * x;
|
|
4136
|
+
return x *= 128, y >= x && (y -= Math.pow(2, 8 * o)), y;
|
|
4111
4137
|
}, u.prototype.readIntBE = function(s, o, h) {
|
|
4112
4138
|
s = s >>> 0, o = o >>> 0, h || Q(s, o, this.length);
|
|
4113
|
-
let
|
|
4114
|
-
for (;
|
|
4115
|
-
B += this[s + --
|
|
4139
|
+
let y = o, x = 1, B = this[s + --y];
|
|
4140
|
+
for (; y > 0 && (x *= 256); )
|
|
4141
|
+
B += this[s + --y] * x;
|
|
4116
4142
|
return x *= 128, B >= x && (B -= Math.pow(2, 8 * o)), B;
|
|
4117
4143
|
}, u.prototype.readInt8 = function(s, o) {
|
|
4118
4144
|
return s = s >>> 0, o || Q(s, 1, this.length), this[s] & 128 ? (255 - this[s] + 1) * -1 : this[s];
|
|
@@ -4132,15 +4158,15 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4132
4158
|
s = s >>> 0, A(s, "offset");
|
|
4133
4159
|
const o = this[s], h = this[s + 7];
|
|
4134
4160
|
(o === void 0 || h === void 0) && O(s, this.length - 8);
|
|
4135
|
-
const
|
|
4136
|
-
return (BigInt(
|
|
4161
|
+
const y = this[s + 4] + this[s + 5] * 2 ** 8 + this[s + 6] * 2 ** 16 + (h << 24);
|
|
4162
|
+
return (BigInt(y) << BigInt(32)) + BigInt(o + this[++s] * 2 ** 8 + this[++s] * 2 ** 16 + this[++s] * 2 ** 24);
|
|
4137
4163
|
}), u.prototype.readBigInt64BE = Ie(function(s) {
|
|
4138
4164
|
s = s >>> 0, A(s, "offset");
|
|
4139
4165
|
const o = this[s], h = this[s + 7];
|
|
4140
4166
|
(o === void 0 || h === void 0) && O(s, this.length - 8);
|
|
4141
|
-
const
|
|
4167
|
+
const y = (o << 24) + // Overflow
|
|
4142
4168
|
this[++s] * 2 ** 16 + this[++s] * 2 ** 8 + this[++s];
|
|
4143
|
-
return (BigInt(
|
|
4169
|
+
return (BigInt(y) << BigInt(32)) + BigInt(this[++s] * 2 ** 24 + this[++s] * 2 ** 16 + this[++s] * 2 ** 8 + h);
|
|
4144
4170
|
}), u.prototype.readFloatLE = function(s, o) {
|
|
4145
4171
|
return s = s >>> 0, o || Q(s, 4, this.length), r.read(this, s, !0, 23, 4);
|
|
4146
4172
|
}, u.prototype.readFloatBE = function(s, o) {
|
|
@@ -4150,13 +4176,13 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4150
4176
|
}, u.prototype.readDoubleBE = function(s, o) {
|
|
4151
4177
|
return s = s >>> 0, o || Q(s, 8, this.length), r.read(this, s, !1, 52, 8);
|
|
4152
4178
|
};
|
|
4153
|
-
function oe(c, s, o, h,
|
|
4179
|
+
function oe(c, s, o, h, y, x) {
|
|
4154
4180
|
if (!u.isBuffer(c)) throw new TypeError('"buffer" argument must be a Buffer instance');
|
|
4155
|
-
if (s >
|
|
4181
|
+
if (s > y || s < x) throw new RangeError('"value" argument is out of bounds');
|
|
4156
4182
|
if (o + h > c.length) throw new RangeError("Index out of range");
|
|
4157
4183
|
}
|
|
4158
|
-
u.prototype.writeUintLE = u.prototype.writeUIntLE = function(s, o, h,
|
|
4159
|
-
if (s = +s, o = o >>> 0, h = h >>> 0, !
|
|
4184
|
+
u.prototype.writeUintLE = u.prototype.writeUIntLE = function(s, o, h, y) {
|
|
4185
|
+
if (s = +s, o = o >>> 0, h = h >>> 0, !y) {
|
|
4160
4186
|
const q = Math.pow(2, 8 * h) - 1;
|
|
4161
4187
|
oe(this, s, o, h, q, 0);
|
|
4162
4188
|
}
|
|
@@ -4164,8 +4190,8 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4164
4190
|
for (this[o] = s & 255; ++B < h && (x *= 256); )
|
|
4165
4191
|
this[o + B] = s / x & 255;
|
|
4166
4192
|
return o + h;
|
|
4167
|
-
}, u.prototype.writeUintBE = u.prototype.writeUIntBE = function(s, o, h,
|
|
4168
|
-
if (s = +s, o = o >>> 0, h = h >>> 0, !
|
|
4193
|
+
}, u.prototype.writeUintBE = u.prototype.writeUIntBE = function(s, o, h, y) {
|
|
4194
|
+
if (s = +s, o = o >>> 0, h = h >>> 0, !y) {
|
|
4169
4195
|
const q = Math.pow(2, 8 * h) - 1;
|
|
4170
4196
|
oe(this, s, o, h, q, 0);
|
|
4171
4197
|
}
|
|
@@ -4184,15 +4210,15 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4184
4210
|
}, u.prototype.writeUint32BE = u.prototype.writeUInt32BE = function(s, o, h) {
|
|
4185
4211
|
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
4212
|
};
|
|
4187
|
-
function Be(c, s, o, h,
|
|
4188
|
-
p(s, h,
|
|
4213
|
+
function Be(c, s, o, h, y) {
|
|
4214
|
+
p(s, h, y, c, o, 7);
|
|
4189
4215
|
let x = Number(s & BigInt(4294967295));
|
|
4190
4216
|
c[o++] = x, x = x >> 8, c[o++] = x, x = x >> 8, c[o++] = x, x = x >> 8, c[o++] = x;
|
|
4191
4217
|
let B = Number(s >> BigInt(32) & BigInt(4294967295));
|
|
4192
4218
|
return c[o++] = B, B = B >> 8, c[o++] = B, B = B >> 8, c[o++] = B, B = B >> 8, c[o++] = B, o;
|
|
4193
4219
|
}
|
|
4194
|
-
function qe(c, s, o, h,
|
|
4195
|
-
p(s, h,
|
|
4220
|
+
function qe(c, s, o, h, y) {
|
|
4221
|
+
p(s, h, y, c, o, 7);
|
|
4196
4222
|
let x = Number(s & BigInt(4294967295));
|
|
4197
4223
|
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
4224
|
let B = Number(s >> BigInt(32) & BigInt(4294967295));
|
|
@@ -4202,8 +4228,8 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4202
4228
|
return Be(this, s, o, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
4203
4229
|
}), u.prototype.writeBigUInt64BE = Ie(function(s, o = 0) {
|
|
4204
4230
|
return qe(this, s, o, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
4205
|
-
}), u.prototype.writeIntLE = function(s, o, h,
|
|
4206
|
-
if (s = +s, o = o >>> 0, !
|
|
4231
|
+
}), u.prototype.writeIntLE = function(s, o, h, y) {
|
|
4232
|
+
if (s = +s, o = o >>> 0, !y) {
|
|
4207
4233
|
const ne = Math.pow(2, 8 * h - 1);
|
|
4208
4234
|
oe(this, s, o, h, ne - 1, -ne);
|
|
4209
4235
|
}
|
|
@@ -4211,8 +4237,8 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4211
4237
|
for (this[o] = s & 255; ++x < h && (B *= 256); )
|
|
4212
4238
|
s < 0 && q === 0 && this[o + x - 1] !== 0 && (q = 1), this[o + x] = (s / B >> 0) - q & 255;
|
|
4213
4239
|
return o + h;
|
|
4214
|
-
}, u.prototype.writeIntBE = function(s, o, h,
|
|
4215
|
-
if (s = +s, o = o >>> 0, !
|
|
4240
|
+
}, u.prototype.writeIntBE = function(s, o, h, y) {
|
|
4241
|
+
if (s = +s, o = o >>> 0, !y) {
|
|
4216
4242
|
const ne = Math.pow(2, 8 * h - 1);
|
|
4217
4243
|
oe(this, s, o, h, ne - 1, -ne);
|
|
4218
4244
|
}
|
|
@@ -4235,48 +4261,48 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4235
4261
|
}), u.prototype.writeBigInt64BE = Ie(function(s, o = 0) {
|
|
4236
4262
|
return qe(this, s, o, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
4237
4263
|
});
|
|
4238
|
-
function
|
|
4264
|
+
function Ne(c, s, o, h, y, x) {
|
|
4239
4265
|
if (o + h > c.length) throw new RangeError("Index out of range");
|
|
4240
4266
|
if (o < 0) throw new RangeError("Index out of range");
|
|
4241
4267
|
}
|
|
4242
|
-
function _(c, s, o, h,
|
|
4243
|
-
return s = +s, o = o >>> 0,
|
|
4268
|
+
function _(c, s, o, h, y) {
|
|
4269
|
+
return s = +s, o = o >>> 0, y || Ne(c, s, o, 4), r.write(c, s, o, h, 23, 4), o + 4;
|
|
4244
4270
|
}
|
|
4245
4271
|
u.prototype.writeFloatLE = function(s, o, h) {
|
|
4246
4272
|
return _(this, s, o, !0, h);
|
|
4247
4273
|
}, u.prototype.writeFloatBE = function(s, o, h) {
|
|
4248
4274
|
return _(this, s, o, !1, h);
|
|
4249
4275
|
};
|
|
4250
|
-
function
|
|
4251
|
-
return s = +s, o = o >>> 0,
|
|
4276
|
+
function w(c, s, o, h, y) {
|
|
4277
|
+
return s = +s, o = o >>> 0, y || Ne(c, s, o, 8), r.write(c, s, o, h, 52, 8), o + 8;
|
|
4252
4278
|
}
|
|
4253
4279
|
u.prototype.writeDoubleLE = function(s, o, h) {
|
|
4254
|
-
return
|
|
4280
|
+
return w(this, s, o, !0, h);
|
|
4255
4281
|
}, u.prototype.writeDoubleBE = function(s, o, h) {
|
|
4256
|
-
return
|
|
4257
|
-
}, u.prototype.copy = function(s, o, h,
|
|
4282
|
+
return w(this, s, o, !1, h);
|
|
4283
|
+
}, u.prototype.copy = function(s, o, h, y) {
|
|
4258
4284
|
if (!u.isBuffer(s)) throw new TypeError("argument should be a Buffer");
|
|
4259
|
-
if (h || (h = 0), !
|
|
4285
|
+
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
4286
|
if (o < 0)
|
|
4261
4287
|
throw new RangeError("targetStart out of bounds");
|
|
4262
4288
|
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,
|
|
4289
|
+
if (y < 0) throw new RangeError("sourceEnd out of bounds");
|
|
4290
|
+
y > this.length && (y = this.length), s.length - o < y - h && (y = s.length - o + h);
|
|
4291
|
+
const x = y - h;
|
|
4292
|
+
return this === s && typeof Uint8Array.prototype.copyWithin == "function" ? this.copyWithin(o, h, y) : Uint8Array.prototype.set.call(
|
|
4267
4293
|
s,
|
|
4268
|
-
this.subarray(h,
|
|
4294
|
+
this.subarray(h, y),
|
|
4269
4295
|
o
|
|
4270
4296
|
), x;
|
|
4271
|
-
}, u.prototype.fill = function(s, o, h,
|
|
4297
|
+
}, u.prototype.fill = function(s, o, h, y) {
|
|
4272
4298
|
if (typeof s == "string") {
|
|
4273
|
-
if (typeof o == "string" ? (
|
|
4299
|
+
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
4300
|
throw new TypeError("encoding must be a string");
|
|
4275
|
-
if (typeof
|
|
4276
|
-
throw new TypeError("Unknown encoding: " +
|
|
4301
|
+
if (typeof y == "string" && !u.isEncoding(y))
|
|
4302
|
+
throw new TypeError("Unknown encoding: " + y);
|
|
4277
4303
|
if (s.length === 1) {
|
|
4278
4304
|
const B = s.charCodeAt(0);
|
|
4279
|
-
(
|
|
4305
|
+
(y === "utf8" && B < 128 || y === "latin1") && (s = B);
|
|
4280
4306
|
}
|
|
4281
4307
|
} else typeof s == "number" ? s = s & 255 : typeof s == "boolean" && (s = Number(s));
|
|
4282
4308
|
if (o < 0 || this.length < o || this.length < h)
|
|
@@ -4289,7 +4315,7 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4289
4315
|
for (x = o; x < h; ++x)
|
|
4290
4316
|
this[x] = s;
|
|
4291
4317
|
else {
|
|
4292
|
-
const B = u.isBuffer(s) ? s : u.from(s,
|
|
4318
|
+
const B = u.isBuffer(s) ? s : u.from(s, y), q = B.length;
|
|
4293
4319
|
if (q === 0)
|
|
4294
4320
|
throw new TypeError('The value "' + s + '" is invalid for argument "value"');
|
|
4295
4321
|
for (x = 0; x < h - o; ++x)
|
|
@@ -4310,11 +4336,11 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4310
4336
|
get code() {
|
|
4311
4337
|
return c;
|
|
4312
4338
|
}
|
|
4313
|
-
set code(
|
|
4339
|
+
set code(y) {
|
|
4314
4340
|
Object.defineProperty(this, "code", {
|
|
4315
4341
|
configurable: !0,
|
|
4316
4342
|
enumerable: !0,
|
|
4317
|
-
value:
|
|
4343
|
+
value: y,
|
|
4318
4344
|
writable: !0
|
|
4319
4345
|
});
|
|
4320
4346
|
}
|
|
@@ -4338,8 +4364,8 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4338
4364
|
), D(
|
|
4339
4365
|
"ERR_OUT_OF_RANGE",
|
|
4340
4366
|
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 ?
|
|
4367
|
+
let h = `The value of "${c}" is out of range.`, y = o;
|
|
4368
|
+
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
4369
|
},
|
|
4344
4370
|
RangeError
|
|
4345
4371
|
);
|
|
@@ -4353,13 +4379,13 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4353
4379
|
function d(c, s, o) {
|
|
4354
4380
|
A(s, "offset"), (c[s] === void 0 || c[s + o] === void 0) && O(s, c.length - (o + 1));
|
|
4355
4381
|
}
|
|
4356
|
-
function p(c, s, o, h,
|
|
4382
|
+
function p(c, s, o, h, y, x) {
|
|
4357
4383
|
if (c > o || c < s) {
|
|
4358
4384
|
const B = typeof s == "bigint" ? "n" : "";
|
|
4359
4385
|
let q;
|
|
4360
4386
|
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
4387
|
}
|
|
4362
|
-
d(h,
|
|
4388
|
+
d(h, y, x);
|
|
4363
4389
|
}
|
|
4364
4390
|
function A(c, s) {
|
|
4365
4391
|
if (typeof c != "number")
|
|
@@ -4383,11 +4409,11 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4383
4409
|
s = s || 1 / 0;
|
|
4384
4410
|
let o;
|
|
4385
4411
|
const h = c.length;
|
|
4386
|
-
let
|
|
4412
|
+
let y = null;
|
|
4387
4413
|
const x = [];
|
|
4388
4414
|
for (let B = 0; B < h; ++B) {
|
|
4389
4415
|
if (o = c.charCodeAt(B), o > 55295 && o < 57344) {
|
|
4390
|
-
if (!
|
|
4416
|
+
if (!y) {
|
|
4391
4417
|
if (o > 56319) {
|
|
4392
4418
|
(s -= 3) > -1 && x.push(239, 191, 189);
|
|
4393
4419
|
continue;
|
|
@@ -4395,16 +4421,16 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4395
4421
|
(s -= 3) > -1 && x.push(239, 191, 189);
|
|
4396
4422
|
continue;
|
|
4397
4423
|
}
|
|
4398
|
-
|
|
4424
|
+
y = o;
|
|
4399
4425
|
continue;
|
|
4400
4426
|
}
|
|
4401
4427
|
if (o < 56320) {
|
|
4402
|
-
(s -= 3) > -1 && x.push(239, 191, 189),
|
|
4428
|
+
(s -= 3) > -1 && x.push(239, 191, 189), y = o;
|
|
4403
4429
|
continue;
|
|
4404
4430
|
}
|
|
4405
|
-
o = (
|
|
4406
|
-
} else
|
|
4407
|
-
if (
|
|
4431
|
+
o = (y - 55296 << 10 | o - 56320) + 65536;
|
|
4432
|
+
} else y && (s -= 3) > -1 && x.push(239, 191, 189);
|
|
4433
|
+
if (y = null, o < 128) {
|
|
4408
4434
|
if ((s -= 1) < 0) break;
|
|
4409
4435
|
x.push(o);
|
|
4410
4436
|
} else if (o < 2048) {
|
|
@@ -4440,20 +4466,20 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4440
4466
|
return s;
|
|
4441
4467
|
}
|
|
4442
4468
|
function ht(c, s) {
|
|
4443
|
-
let o, h,
|
|
4469
|
+
let o, h, y;
|
|
4444
4470
|
const x = [];
|
|
4445
4471
|
for (let B = 0; B < c.length && !((s -= 2) < 0); ++B)
|
|
4446
|
-
o = c.charCodeAt(B), h = o >> 8,
|
|
4472
|
+
o = c.charCodeAt(B), h = o >> 8, y = o % 256, x.push(y), x.push(h);
|
|
4447
4473
|
return x;
|
|
4448
4474
|
}
|
|
4449
4475
|
function Pt(c) {
|
|
4450
4476
|
return t.toByteArray(j(c));
|
|
4451
4477
|
}
|
|
4452
4478
|
function dt(c, s, o, h) {
|
|
4453
|
-
let
|
|
4454
|
-
for (
|
|
4455
|
-
s[
|
|
4456
|
-
return
|
|
4479
|
+
let y;
|
|
4480
|
+
for (y = 0; y < h && !(y + o >= s.length || y >= c.length); ++y)
|
|
4481
|
+
s[y + o] = c[y];
|
|
4482
|
+
return y;
|
|
4457
4483
|
}
|
|
4458
4484
|
function Se(c, s) {
|
|
4459
4485
|
return c instanceof s || c != null && c.constructor != null && c.constructor.name != null && c.constructor.name === s.name;
|
|
@@ -4465,8 +4491,8 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4465
4491
|
const c = "0123456789abcdef", s = new Array(256);
|
|
4466
4492
|
for (let o = 0; o < 16; ++o) {
|
|
4467
4493
|
const h = o * 16;
|
|
4468
|
-
for (let
|
|
4469
|
-
s[h +
|
|
4494
|
+
for (let y = 0; y < 16; ++y)
|
|
4495
|
+
s[h + y] = c[o] + c[y];
|
|
4470
4496
|
}
|
|
4471
4497
|
return s;
|
|
4472
4498
|
}();
|
|
@@ -4495,8 +4521,8 @@ In.write = function(e, t, r, n, i, a) {
|
|
|
4495
4521
|
}, a.alloc = function(f, u, l) {
|
|
4496
4522
|
if (typeof f != "number")
|
|
4497
4523
|
throw new TypeError("Argument must be a number");
|
|
4498
|
-
var
|
|
4499
|
-
return u !== void 0 ? typeof l == "string" ?
|
|
4524
|
+
var b = n(f);
|
|
4525
|
+
return u !== void 0 ? typeof l == "string" ? b.fill(u, l) : b.fill(u) : b.fill(0), b;
|
|
4500
4526
|
}, a.allocUnsafe = function(f) {
|
|
4501
4527
|
if (typeof f != "number")
|
|
4502
4528
|
throw new TypeError("Argument must be a number");
|
|
@@ -4618,7 +4644,7 @@ K.prototype.emit = function(t) {
|
|
|
4618
4644
|
if (typeof l == "function")
|
|
4619
4645
|
Zn(l, this, r);
|
|
4620
4646
|
else
|
|
4621
|
-
for (var
|
|
4647
|
+
for (var b = l.length, g = ls(l, b), n = 0; n < b; ++n)
|
|
4622
4648
|
Zn(g[n], this, r);
|
|
4623
4649
|
return !0;
|
|
4624
4650
|
};
|
|
@@ -4828,9 +4854,9 @@ function kf() {
|
|
|
4828
4854
|
}
|
|
4829
4855
|
return (P === "string" ? String : Number)(v);
|
|
4830
4856
|
}
|
|
4831
|
-
var l = Rt,
|
|
4857
|
+
var l = Rt, b = l.Buffer, g = Rn, m = g.inspect, E = m && m.custom || "inspect";
|
|
4832
4858
|
function I(v, P, T) {
|
|
4833
|
-
|
|
4859
|
+
b.prototype.copy.call(v, P, T);
|
|
4834
4860
|
}
|
|
4835
4861
|
return Hr = /* @__PURE__ */ function() {
|
|
4836
4862
|
function v() {
|
|
@@ -4877,8 +4903,8 @@ function kf() {
|
|
|
4877
4903
|
}, {
|
|
4878
4904
|
key: "concat",
|
|
4879
4905
|
value: function(T) {
|
|
4880
|
-
if (this.length === 0) return
|
|
4881
|
-
for (var C =
|
|
4906
|
+
if (this.length === 0) return b.alloc(0);
|
|
4907
|
+
for (var C = b.allocUnsafe(T >>> 0), F = this.head, k = 0; F; )
|
|
4882
4908
|
I(F.data, C, k), k += F.data.length, F = F.next;
|
|
4883
4909
|
return C;
|
|
4884
4910
|
}
|
|
@@ -4913,7 +4939,7 @@ function kf() {
|
|
|
4913
4939
|
}, {
|
|
4914
4940
|
key: "_getBuffer",
|
|
4915
4941
|
value: function(T) {
|
|
4916
|
-
var C =
|
|
4942
|
+
var C = b.allocUnsafe(T), F = this.head, k = 1;
|
|
4917
4943
|
for (F.data.copy(C), T -= F.data.length; F = F.next; ) {
|
|
4918
4944
|
var L = F.data, U = T > L.length ? L.length : T;
|
|
4919
4945
|
if (L.copy(C, C.length - T, 0, U), T -= U, T === 0) {
|
|
@@ -4928,7 +4954,7 @@ function kf() {
|
|
|
4928
4954
|
}, {
|
|
4929
4955
|
key: E,
|
|
4930
4956
|
value: function(T, C) {
|
|
4931
|
-
return
|
|
4957
|
+
return m(this, t(t({}, C), {}, {
|
|
4932
4958
|
// Only inspect one level.
|
|
4933
4959
|
depth: 0,
|
|
4934
4960
|
// It should not recurse.
|
|
@@ -4965,7 +4991,7 @@ var bs = {
|
|
|
4965
4991
|
undestroy: Uf,
|
|
4966
4992
|
errorOrDestroy: Of
|
|
4967
4993
|
}, ct = {};
|
|
4968
|
-
function
|
|
4994
|
+
function Nf(e, t) {
|
|
4969
4995
|
e.prototype = Object.create(t.prototype), e.prototype.constructor = e, e.__proto__ = t;
|
|
4970
4996
|
}
|
|
4971
4997
|
var ys = {};
|
|
@@ -4975,9 +5001,9 @@ function Re(e, t, r) {
|
|
|
4975
5001
|
return typeof t == "string" ? t : t(a, f, u);
|
|
4976
5002
|
}
|
|
4977
5003
|
var i = /* @__PURE__ */ function(a) {
|
|
4978
|
-
|
|
4979
|
-
function f(u, l,
|
|
4980
|
-
return a.call(this, n(u, l,
|
|
5004
|
+
Nf(f, a);
|
|
5005
|
+
function f(u, l, b) {
|
|
5006
|
+
return a.call(this, n(u, l, b)) || this;
|
|
4981
5007
|
}
|
|
4982
5008
|
return f;
|
|
4983
5009
|
}(r);
|
|
@@ -4992,7 +5018,7 @@ function ni(e, t) {
|
|
|
4992
5018
|
} else
|
|
4993
5019
|
return "of ".concat(t, " ").concat(String(e));
|
|
4994
5020
|
}
|
|
4995
|
-
function
|
|
5021
|
+
function Mf(e, t, r) {
|
|
4996
5022
|
return e.substr(0, t.length) === t;
|
|
4997
5023
|
}
|
|
4998
5024
|
function Df(e, t, r) {
|
|
@@ -5006,7 +5032,7 @@ Re("ERR_INVALID_OPT_VALUE", function(e, t) {
|
|
|
5006
5032
|
}, TypeError);
|
|
5007
5033
|
Re("ERR_INVALID_ARG_TYPE", function(e, t, r) {
|
|
5008
5034
|
var n;
|
|
5009
|
-
typeof t == "string" &&
|
|
5035
|
+
typeof t == "string" && Mf(t, "not ") ? (n = "must not be", t = t.replace(/^not /, "")) : n = "must be";
|
|
5010
5036
|
var i;
|
|
5011
5037
|
if (Df(e, " argument"))
|
|
5012
5038
|
i = "The ".concat(e, " ").concat(n, " ").concat(ni(t, "type"));
|
|
@@ -5077,15 +5103,15 @@ function zr(e) {
|
|
|
5077
5103
|
var Gr, ii;
|
|
5078
5104
|
function ms() {
|
|
5079
5105
|
if (ii) return Gr;
|
|
5080
|
-
ii = 1, Gr =
|
|
5106
|
+
ii = 1, Gr = M;
|
|
5081
5107
|
function e(_) {
|
|
5082
|
-
var
|
|
5108
|
+
var w = this;
|
|
5083
5109
|
this.next = null, this.entry = null, this.finish = function() {
|
|
5084
|
-
|
|
5110
|
+
Ne(w, _);
|
|
5085
5111
|
};
|
|
5086
5112
|
}
|
|
5087
5113
|
var t;
|
|
5088
|
-
|
|
5114
|
+
M.WritableState = S;
|
|
5089
5115
|
var r = {
|
|
5090
5116
|
deprecate: jf
|
|
5091
5117
|
}, n = ps, i = Rt.Buffer, a = (typeof Xe < "u" ? Xe : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
|
|
@@ -5096,20 +5122,20 @@ function ms() {
|
|
|
5096
5122
|
function u(_) {
|
|
5097
5123
|
return i.isBuffer(_) || _ instanceof a;
|
|
5098
5124
|
}
|
|
5099
|
-
var l = bs,
|
|
5100
|
-
ge(
|
|
5125
|
+
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;
|
|
5126
|
+
ge(M, n);
|
|
5101
5127
|
function U() {
|
|
5102
5128
|
}
|
|
5103
|
-
function S(_,
|
|
5104
|
-
t = t || St(), _ = _ || {}, typeof R != "boolean" && (R =
|
|
5129
|
+
function S(_, w, R) {
|
|
5130
|
+
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
5131
|
var D = _.decodeStrings === !1;
|
|
5106
5132
|
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(
|
|
5133
|
+
et(w, G);
|
|
5108
5134
|
}, 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
5135
|
}
|
|
5110
5136
|
S.prototype.getBuffer = function() {
|
|
5111
|
-
for (var
|
|
5112
|
-
R.push(
|
|
5137
|
+
for (var w = this.bufferedRequest, R = []; w; )
|
|
5138
|
+
R.push(w), w = w.next;
|
|
5113
5139
|
return R;
|
|
5114
5140
|
}, function() {
|
|
5115
5141
|
try {
|
|
@@ -5122,42 +5148,42 @@ function ms() {
|
|
|
5122
5148
|
}
|
|
5123
5149
|
}();
|
|
5124
5150
|
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,
|
|
5151
|
+
typeof Symbol == "function" && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] == "function" ? (z = Function.prototype[Symbol.hasInstance], Object.defineProperty(M, Symbol.hasInstance, {
|
|
5152
|
+
value: function(w) {
|
|
5153
|
+
return z.call(this, w) ? !0 : this !== M ? !1 : w && w._writableState instanceof S;
|
|
5128
5154
|
}
|
|
5129
|
-
})) : z = function(
|
|
5130
|
-
return
|
|
5155
|
+
})) : z = function(w) {
|
|
5156
|
+
return w instanceof this;
|
|
5131
5157
|
};
|
|
5132
|
-
function
|
|
5158
|
+
function M(_) {
|
|
5133
5159
|
t = t || St();
|
|
5134
|
-
var
|
|
5135
|
-
if (!
|
|
5136
|
-
this._writableState = new S(_, this,
|
|
5160
|
+
var w = this instanceof t;
|
|
5161
|
+
if (!w && !z.call(M, this)) return new M(_);
|
|
5162
|
+
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
5163
|
}
|
|
5138
|
-
|
|
5164
|
+
M.prototype.pipe = function() {
|
|
5139
5165
|
L(this, new P());
|
|
5140
5166
|
};
|
|
5141
|
-
function $(_,
|
|
5167
|
+
function $(_, w) {
|
|
5142
5168
|
var R = new F();
|
|
5143
|
-
L(_, R), process.nextTick(
|
|
5169
|
+
L(_, R), process.nextTick(w, R);
|
|
5144
5170
|
}
|
|
5145
|
-
function se(_,
|
|
5171
|
+
function se(_, w, R, D) {
|
|
5146
5172
|
var G;
|
|
5147
|
-
return R === null ? G = new C() : typeof R != "string" && !
|
|
5173
|
+
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
5174
|
}
|
|
5149
|
-
|
|
5175
|
+
M.prototype.write = function(_, w, R) {
|
|
5150
5176
|
var D = this._writableState, G = !1, d = !D.objectMode && u(_);
|
|
5151
|
-
return d && !i.isBuffer(_) && (_ = f(_)), typeof
|
|
5152
|
-
},
|
|
5177
|
+
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;
|
|
5178
|
+
}, M.prototype.cork = function() {
|
|
5153
5179
|
this._writableState.corked++;
|
|
5154
|
-
},
|
|
5180
|
+
}, M.prototype.uncork = function() {
|
|
5155
5181
|
var _ = this._writableState;
|
|
5156
5182
|
_.corked && (_.corked--, !_.writing && !_.corked && !_.bufferProcessing && _.bufferedRequest && Ce(this, _));
|
|
5157
|
-
},
|
|
5158
|
-
if (typeof
|
|
5159
|
-
return this._writableState.defaultEncoding =
|
|
5160
|
-
}, Object.defineProperty(
|
|
5183
|
+
}, M.prototype.setDefaultEncoding = function(w) {
|
|
5184
|
+
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);
|
|
5185
|
+
return this._writableState.defaultEncoding = w, this;
|
|
5186
|
+
}, Object.defineProperty(M.prototype, "writableBuffer", {
|
|
5161
5187
|
// making it explicit this property is not enumerable
|
|
5162
5188
|
// because otherwise some prototype manipulation in
|
|
5163
5189
|
// userland will fail
|
|
@@ -5166,10 +5192,10 @@ function ms() {
|
|
|
5166
5192
|
return this._writableState && this._writableState.getBuffer();
|
|
5167
5193
|
}
|
|
5168
5194
|
});
|
|
5169
|
-
function Te(_,
|
|
5170
|
-
return !_.objectMode && _.decodeStrings !== !1 && typeof
|
|
5195
|
+
function Te(_, w, R) {
|
|
5196
|
+
return !_.objectMode && _.decodeStrings !== !1 && typeof w == "string" && (w = i.from(w, R)), w;
|
|
5171
5197
|
}
|
|
5172
|
-
Object.defineProperty(
|
|
5198
|
+
Object.defineProperty(M.prototype, "writableHighWaterMark", {
|
|
5173
5199
|
// making it explicit this property is not enumerable
|
|
5174
5200
|
// because otherwise some prototype manipulation in
|
|
5175
5201
|
// userland will fail
|
|
@@ -5178,76 +5204,76 @@ function ms() {
|
|
|
5178
5204
|
return this._writableState.highWaterMark;
|
|
5179
5205
|
}
|
|
5180
5206
|
});
|
|
5181
|
-
function Ge(_,
|
|
5207
|
+
function Ge(_, w, R, D, G, d) {
|
|
5182
5208
|
if (!R) {
|
|
5183
|
-
var p = Te(
|
|
5209
|
+
var p = Te(w, D, G);
|
|
5184
5210
|
D !== p && (R = !0, G = "buffer", D = p);
|
|
5185
5211
|
}
|
|
5186
|
-
var A =
|
|
5187
|
-
|
|
5188
|
-
var O =
|
|
5189
|
-
if (O || (
|
|
5190
|
-
var Z =
|
|
5191
|
-
|
|
5212
|
+
var A = w.objectMode ? 1 : D.length;
|
|
5213
|
+
w.length += A;
|
|
5214
|
+
var O = w.length < w.highWaterMark;
|
|
5215
|
+
if (O || (w.needDrain = !0), w.writing || w.corked) {
|
|
5216
|
+
var Z = w.lastBufferedRequest;
|
|
5217
|
+
w.lastBufferedRequest = {
|
|
5192
5218
|
chunk: D,
|
|
5193
5219
|
encoding: G,
|
|
5194
5220
|
isBuf: R,
|
|
5195
5221
|
callback: d,
|
|
5196
5222
|
next: null
|
|
5197
|
-
}, Z ? Z.next =
|
|
5223
|
+
}, Z ? Z.next = w.lastBufferedRequest : w.bufferedRequest = w.lastBufferedRequest, w.bufferedRequestCount += 1;
|
|
5198
5224
|
} else
|
|
5199
|
-
ae(_,
|
|
5225
|
+
ae(_, w, !1, A, D, G, d);
|
|
5200
5226
|
return O;
|
|
5201
5227
|
}
|
|
5202
|
-
function ae(_,
|
|
5203
|
-
|
|
5228
|
+
function ae(_, w, R, D, G, d, p) {
|
|
5229
|
+
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
5230
|
}
|
|
5205
|
-
function xe(_,
|
|
5206
|
-
--
|
|
5231
|
+
function xe(_, w, R, D, G) {
|
|
5232
|
+
--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
5233
|
}
|
|
5208
5234
|
function ve(_) {
|
|
5209
5235
|
_.writing = !1, _.writecb = null, _.length -= _.writelen, _.writelen = 0;
|
|
5210
5236
|
}
|
|
5211
|
-
function et(_,
|
|
5237
|
+
function et(_, w) {
|
|
5212
5238
|
var R = _._writableState, D = R.sync, G = R.writecb;
|
|
5213
5239
|
if (typeof G != "function") throw new v();
|
|
5214
|
-
if (ve(R),
|
|
5240
|
+
if (ve(R), w) xe(_, R, D, w, G);
|
|
5215
5241
|
else {
|
|
5216
5242
|
var d = We(R) || _.destroyed;
|
|
5217
5243
|
!d && !R.corked && !R.bufferProcessing && R.bufferedRequest && Ce(_, R), D ? process.nextTick(Pe, _, R, d, G) : Pe(_, R, d, G);
|
|
5218
5244
|
}
|
|
5219
5245
|
}
|
|
5220
|
-
function Pe(_,
|
|
5221
|
-
R || je(_,
|
|
5246
|
+
function Pe(_, w, R, D) {
|
|
5247
|
+
R || je(_, w), w.pendingcb--, D(), Be(_, w);
|
|
5222
5248
|
}
|
|
5223
|
-
function je(_,
|
|
5224
|
-
|
|
5249
|
+
function je(_, w) {
|
|
5250
|
+
w.length === 0 && w.needDrain && (w.needDrain = !1, _.emit("drain"));
|
|
5225
5251
|
}
|
|
5226
|
-
function Ce(_,
|
|
5227
|
-
|
|
5228
|
-
var R =
|
|
5252
|
+
function Ce(_, w) {
|
|
5253
|
+
w.bufferProcessing = !0;
|
|
5254
|
+
var R = w.bufferedRequest;
|
|
5229
5255
|
if (_._writev && R && R.next) {
|
|
5230
|
-
var D =
|
|
5256
|
+
var D = w.bufferedRequestCount, G = new Array(D), d = w.corkedRequestsFree;
|
|
5231
5257
|
d.entry = R;
|
|
5232
5258
|
for (var p = 0, A = !0; R; )
|
|
5233
5259
|
G[p] = R, R.isBuf || (A = !1), R = R.next, p += 1;
|
|
5234
|
-
G.allBuffers = A, ae(_,
|
|
5260
|
+
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
5261
|
} else {
|
|
5236
5262
|
for (; R; ) {
|
|
5237
|
-
var O = R.chunk, Z = R.encoding, j = R.callback, V =
|
|
5238
|
-
if (ae(_,
|
|
5263
|
+
var O = R.chunk, Z = R.encoding, j = R.callback, V = w.objectMode ? 1 : O.length;
|
|
5264
|
+
if (ae(_, w, !1, V, O, Z, j), R = R.next, w.bufferedRequestCount--, w.writing)
|
|
5239
5265
|
break;
|
|
5240
5266
|
}
|
|
5241
|
-
R === null && (
|
|
5267
|
+
R === null && (w.lastBufferedRequest = null);
|
|
5242
5268
|
}
|
|
5243
|
-
|
|
5269
|
+
w.bufferedRequest = R, w.bufferProcessing = !1;
|
|
5244
5270
|
}
|
|
5245
|
-
|
|
5271
|
+
M.prototype._write = function(_, w, R) {
|
|
5246
5272
|
R(new I("_write()"));
|
|
5247
|
-
},
|
|
5273
|
+
}, M.prototype._writev = null, M.prototype.end = function(_, w, R) {
|
|
5248
5274
|
var D = this._writableState;
|
|
5249
|
-
return typeof _ == "function" ? (R = _, _ = null,
|
|
5250
|
-
}, Object.defineProperty(
|
|
5275
|
+
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;
|
|
5276
|
+
}, Object.defineProperty(M.prototype, "writableLength", {
|
|
5251
5277
|
// making it explicit this property is not enumerable
|
|
5252
5278
|
// because otherwise some prototype manipulation in
|
|
5253
5279
|
// userland will fail
|
|
@@ -5259,34 +5285,34 @@ function ms() {
|
|
|
5259
5285
|
function We(_) {
|
|
5260
5286
|
return _.ending && _.length === 0 && _.bufferedRequest === null && !_.finished && !_.writing;
|
|
5261
5287
|
}
|
|
5262
|
-
function Q(_,
|
|
5288
|
+
function Q(_, w) {
|
|
5263
5289
|
_._final(function(R) {
|
|
5264
|
-
|
|
5290
|
+
w.pendingcb--, R && L(_, R), w.prefinished = !0, _.emit("prefinish"), Be(_, w);
|
|
5265
5291
|
});
|
|
5266
5292
|
}
|
|
5267
|
-
function oe(_,
|
|
5268
|
-
!
|
|
5293
|
+
function oe(_, w) {
|
|
5294
|
+
!w.prefinished && !w.finalCalled && (typeof _._final == "function" && !w.destroyed ? (w.pendingcb++, w.finalCalled = !0, process.nextTick(Q, _, w)) : (w.prefinished = !0, _.emit("prefinish")));
|
|
5269
5295
|
}
|
|
5270
|
-
function Be(_,
|
|
5271
|
-
var R = We(
|
|
5272
|
-
if (R && (oe(_,
|
|
5296
|
+
function Be(_, w) {
|
|
5297
|
+
var R = We(w);
|
|
5298
|
+
if (R && (oe(_, w), w.pendingcb === 0 && (w.finished = !0, _.emit("finish"), w.autoDestroy))) {
|
|
5273
5299
|
var D = _._readableState;
|
|
5274
5300
|
(!D || D.autoDestroy && D.endEmitted) && _.destroy();
|
|
5275
5301
|
}
|
|
5276
5302
|
return R;
|
|
5277
5303
|
}
|
|
5278
|
-
function qe(_,
|
|
5279
|
-
|
|
5304
|
+
function qe(_, w, R) {
|
|
5305
|
+
w.ending = !0, Be(_, w), R && (w.finished ? process.nextTick(R) : _.once("finish", R)), w.ended = !0, _.writable = !1;
|
|
5280
5306
|
}
|
|
5281
|
-
function
|
|
5307
|
+
function Ne(_, w, R) {
|
|
5282
5308
|
var D = _.entry;
|
|
5283
5309
|
for (_.entry = null; D; ) {
|
|
5284
5310
|
var G = D.callback;
|
|
5285
|
-
|
|
5311
|
+
w.pendingcb--, G(R), D = D.next;
|
|
5286
5312
|
}
|
|
5287
|
-
|
|
5313
|
+
w.corkedRequestsFree.next = _;
|
|
5288
5314
|
}
|
|
5289
|
-
return Object.defineProperty(
|
|
5315
|
+
return Object.defineProperty(M.prototype, "destroyed", {
|
|
5290
5316
|
// making it explicit this property is not enumerable
|
|
5291
5317
|
// because otherwise some prototype manipulation in
|
|
5292
5318
|
// userland will fail
|
|
@@ -5294,20 +5320,20 @@ function ms() {
|
|
|
5294
5320
|
get: function() {
|
|
5295
5321
|
return this._writableState === void 0 ? !1 : this._writableState.destroyed;
|
|
5296
5322
|
},
|
|
5297
|
-
set: function(
|
|
5298
|
-
this._writableState && (this._writableState.destroyed =
|
|
5323
|
+
set: function(w) {
|
|
5324
|
+
this._writableState && (this._writableState.destroyed = w);
|
|
5299
5325
|
}
|
|
5300
|
-
}),
|
|
5301
|
-
|
|
5326
|
+
}), M.prototype.destroy = l.destroy, M.prototype._undestroy = l.undestroy, M.prototype._destroy = function(_, w) {
|
|
5327
|
+
w(_);
|
|
5302
5328
|
}, Gr;
|
|
5303
5329
|
}
|
|
5304
5330
|
var jr, si;
|
|
5305
5331
|
function St() {
|
|
5306
5332
|
if (si) return jr;
|
|
5307
5333
|
si = 1;
|
|
5308
|
-
var e = Object.keys || function(
|
|
5334
|
+
var e = Object.keys || function(b) {
|
|
5309
5335
|
var g = [];
|
|
5310
|
-
for (var
|
|
5336
|
+
for (var m in b) g.push(m);
|
|
5311
5337
|
return g;
|
|
5312
5338
|
};
|
|
5313
5339
|
jr = f;
|
|
@@ -5317,9 +5343,9 @@ function St() {
|
|
|
5317
5343
|
var a = n[i];
|
|
5318
5344
|
f.prototype[a] || (f.prototype[a] = r.prototype[a]);
|
|
5319
5345
|
}
|
|
5320
|
-
function f(
|
|
5321
|
-
if (!(this instanceof f)) return new f(
|
|
5322
|
-
t.call(this,
|
|
5346
|
+
function f(b) {
|
|
5347
|
+
if (!(this instanceof f)) return new f(b);
|
|
5348
|
+
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
5349
|
}
|
|
5324
5350
|
Object.defineProperty(f.prototype, "writableHighWaterMark", {
|
|
5325
5351
|
// making it explicit this property is not enumerable
|
|
@@ -5349,8 +5375,8 @@ function St() {
|
|
|
5349
5375
|
function u() {
|
|
5350
5376
|
this._writableState.ended || process.nextTick(l, this);
|
|
5351
5377
|
}
|
|
5352
|
-
function l(
|
|
5353
|
-
|
|
5378
|
+
function l(b) {
|
|
5379
|
+
b.end();
|
|
5354
5380
|
}
|
|
5355
5381
|
return Object.defineProperty(f.prototype, "destroyed", {
|
|
5356
5382
|
// making it explicit this property is not enumerable
|
|
@@ -5544,11 +5570,11 @@ function ws(e, t, r) {
|
|
|
5544
5570
|
e.writable || u();
|
|
5545
5571
|
}, f = e._writableState && e._writableState.finished, u = function() {
|
|
5546
5572
|
i = !1, f = !0, n || r.call(e);
|
|
5547
|
-
}, l = e._readableState && e._readableState.endEmitted,
|
|
5573
|
+
}, l = e._readableState && e._readableState.endEmitted, b = function() {
|
|
5548
5574
|
n = !1, l = !0, i || r.call(e);
|
|
5549
5575
|
}, g = function(v) {
|
|
5550
5576
|
r.call(e, v);
|
|
5551
|
-
},
|
|
5577
|
+
}, m = function() {
|
|
5552
5578
|
var v;
|
|
5553
5579
|
if (n && !l)
|
|
5554
5580
|
return (!e._readableState || !e._readableState.ended) && (v = new ai()), r.call(e, v);
|
|
@@ -5557,8 +5583,8 @@ function ws(e, t, r) {
|
|
|
5557
5583
|
}, E = function() {
|
|
5558
5584
|
e.req.on("finish", u);
|
|
5559
5585
|
};
|
|
5560
|
-
return au(e) ? (e.on("complete", u), e.on("abort",
|
|
5561
|
-
e.removeListener("complete", u), e.removeListener("abort",
|
|
5586
|
+
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() {
|
|
5587
|
+
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
5588
|
};
|
|
5563
5589
|
}
|
|
5564
5590
|
var Pn = ws, qr, fi;
|
|
@@ -5583,7 +5609,7 @@ function fu() {
|
|
|
5583
5609
|
}
|
|
5584
5610
|
return (L === "string" ? String : Number)(k);
|
|
5585
5611
|
}
|
|
5586
|
-
var i = Pn, a = Symbol("lastResolve"), f = Symbol("lastReject"), u = Symbol("error"), l = Symbol("ended"),
|
|
5612
|
+
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
5613
|
function E(k, L) {
|
|
5588
5614
|
return {
|
|
5589
5615
|
value: k,
|
|
@@ -5593,8 +5619,8 @@ function fu() {
|
|
|
5593
5619
|
function I(k) {
|
|
5594
5620
|
var L = k[a];
|
|
5595
5621
|
if (L !== null) {
|
|
5596
|
-
var U = k[
|
|
5597
|
-
U !== null && (k[
|
|
5622
|
+
var U = k[m].read();
|
|
5623
|
+
U !== null && (k[b] = null, k[a] = null, k[f] = null, L(E(U, !1)));
|
|
5598
5624
|
}
|
|
5599
5625
|
}
|
|
5600
5626
|
function v(k) {
|
|
@@ -5614,7 +5640,7 @@ function fu() {
|
|
|
5614
5640
|
var T = Object.getPrototypeOf(function() {
|
|
5615
5641
|
}), C = Object.setPrototypeOf((e = {
|
|
5616
5642
|
get stream() {
|
|
5617
|
-
return this[
|
|
5643
|
+
return this[m];
|
|
5618
5644
|
},
|
|
5619
5645
|
next: function() {
|
|
5620
5646
|
var L = this, U = this[u];
|
|
@@ -5622,29 +5648,29 @@ function fu() {
|
|
|
5622
5648
|
return Promise.reject(U);
|
|
5623
5649
|
if (this[l])
|
|
5624
5650
|
return Promise.resolve(E(void 0, !0));
|
|
5625
|
-
if (this[
|
|
5651
|
+
if (this[m].destroyed)
|
|
5626
5652
|
return new Promise(function($, se) {
|
|
5627
5653
|
process.nextTick(function() {
|
|
5628
5654
|
L[u] ? se(L[u]) : $(E(void 0, !0));
|
|
5629
5655
|
});
|
|
5630
5656
|
});
|
|
5631
|
-
var S = this[
|
|
5657
|
+
var S = this[b], z;
|
|
5632
5658
|
if (S)
|
|
5633
5659
|
z = new Promise(P(S, this));
|
|
5634
5660
|
else {
|
|
5635
|
-
var
|
|
5636
|
-
if (
|
|
5637
|
-
return Promise.resolve(E(
|
|
5661
|
+
var M = this[m].read();
|
|
5662
|
+
if (M !== null)
|
|
5663
|
+
return Promise.resolve(E(M, !1));
|
|
5638
5664
|
z = new Promise(this[g]);
|
|
5639
5665
|
}
|
|
5640
|
-
return this[
|
|
5666
|
+
return this[b] = z, z;
|
|
5641
5667
|
}
|
|
5642
5668
|
}, t(e, Symbol.asyncIterator, function() {
|
|
5643
5669
|
return this;
|
|
5644
5670
|
}), t(e, "return", function() {
|
|
5645
5671
|
var L = this;
|
|
5646
5672
|
return new Promise(function(U, S) {
|
|
5647
|
-
L[
|
|
5673
|
+
L[m].destroy(null, function(z) {
|
|
5648
5674
|
if (z) {
|
|
5649
5675
|
S(z);
|
|
5650
5676
|
return;
|
|
@@ -5653,7 +5679,7 @@ function fu() {
|
|
|
5653
5679
|
});
|
|
5654
5680
|
});
|
|
5655
5681
|
}), e), T), F = function(L) {
|
|
5656
|
-
var U, S = Object.create(C, (U = {}, t(U,
|
|
5682
|
+
var U, S = Object.create(C, (U = {}, t(U, m, {
|
|
5657
5683
|
value: L,
|
|
5658
5684
|
writable: !0
|
|
5659
5685
|
}), t(U, a, {
|
|
@@ -5669,20 +5695,20 @@ function fu() {
|
|
|
5669
5695
|
value: L._readableState.endEmitted,
|
|
5670
5696
|
writable: !0
|
|
5671
5697
|
}), t(U, g, {
|
|
5672
|
-
value: function(
|
|
5673
|
-
var se = S[
|
|
5674
|
-
se ? (S[
|
|
5698
|
+
value: function(M, $) {
|
|
5699
|
+
var se = S[m].read();
|
|
5700
|
+
se ? (S[b] = null, S[a] = null, S[f] = null, M(E(se, !1))) : (S[a] = M, S[f] = $);
|
|
5675
5701
|
},
|
|
5676
5702
|
writable: !0
|
|
5677
5703
|
}), U));
|
|
5678
|
-
return S[
|
|
5704
|
+
return S[b] = null, i(L, function(z) {
|
|
5679
5705
|
if (z && z.code !== "ERR_STREAM_PREMATURE_CLOSE") {
|
|
5680
|
-
var
|
|
5681
|
-
|
|
5706
|
+
var M = S[f];
|
|
5707
|
+
M !== null && (S[b] = null, S[a] = null, S[f] = null, M(z)), S[u] = z;
|
|
5682
5708
|
return;
|
|
5683
5709
|
}
|
|
5684
5710
|
var $ = S[a];
|
|
5685
|
-
$ !== null && (S[
|
|
5711
|
+
$ !== null && (S[b] = null, S[a] = null, S[f] = null, $(E(void 0, !0))), S[l] = !0;
|
|
5686
5712
|
}), L.on("readable", v.bind(null, S)), S;
|
|
5687
5713
|
};
|
|
5688
5714
|
return qr = F, qr;
|
|
@@ -5698,7 +5724,7 @@ function _s() {
|
|
|
5698
5724
|
if (ci) return Kr;
|
|
5699
5725
|
ci = 1, Kr = $;
|
|
5700
5726
|
var e;
|
|
5701
|
-
$.ReadableState =
|
|
5727
|
+
$.ReadableState = M, ds.EventEmitter;
|
|
5702
5728
|
var t = function(p, A) {
|
|
5703
5729
|
return p.listeners(A).length;
|
|
5704
5730
|
}, r = ps, n = Rt.Buffer, i = (typeof Xe < "u" ? Xe : typeof window < "u" ? window : typeof self < "u" ? self : {}).Uint8Array || function() {
|
|
@@ -5712,20 +5738,20 @@ function _s() {
|
|
|
5712
5738
|
var u = Rn, l;
|
|
5713
5739
|
u && u.debuglog ? l = u.debuglog("stream") : l = function() {
|
|
5714
5740
|
};
|
|
5715
|
-
var
|
|
5741
|
+
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
5742
|
ge($, r);
|
|
5717
5743
|
var U = g.errorOrDestroy, S = ["error", "close", "destroy", "pause", "resume"];
|
|
5718
5744
|
function z(d, p, A) {
|
|
5719
5745
|
if (typeof d.prependListener == "function") return d.prependListener(p, A);
|
|
5720
5746
|
!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
5747
|
}
|
|
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
|
|
5748
|
+
function M(d, p, A) {
|
|
5749
|
+
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
5750
|
}
|
|
5725
5751
|
function $(d) {
|
|
5726
5752
|
if (e = e || St(), !(this instanceof $)) return new $(d);
|
|
5727
5753
|
var p = this instanceof e;
|
|
5728
|
-
this._readableState = new
|
|
5754
|
+
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
5755
|
}
|
|
5730
5756
|
Object.defineProperty($.prototype, "destroyed", {
|
|
5731
5757
|
// making it explicit this property is not enumerable
|
|
@@ -5803,7 +5829,7 @@ function _s() {
|
|
|
5803
5829
|
var O = p.needReadable;
|
|
5804
5830
|
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
5831
|
var Z;
|
|
5806
|
-
return d > 0 ? Z =
|
|
5832
|
+
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
5833
|
};
|
|
5808
5834
|
function et(d, p) {
|
|
5809
5835
|
if (l("onEofChunk"), !p.ended) {
|
|
@@ -5931,9 +5957,9 @@ function _s() {
|
|
|
5931
5957
|
return d.flowing || (l("resume"), d.flowing = !d.readableListening, qe(this, d)), d.paused = !1, this;
|
|
5932
5958
|
};
|
|
5933
5959
|
function qe(d, p) {
|
|
5934
|
-
p.resumeScheduled || (p.resumeScheduled = !0, process.nextTick(
|
|
5960
|
+
p.resumeScheduled || (p.resumeScheduled = !0, process.nextTick(Ne, d, p));
|
|
5935
5961
|
}
|
|
5936
|
-
function
|
|
5962
|
+
function Ne(d, p) {
|
|
5937
5963
|
l("resume", p.reading), p.reading || d.read(0), p.resumeScheduled = !1, d.emit("resume"), _(d), p.flowing && !p.reading && d.read(0);
|
|
5938
5964
|
}
|
|
5939
5965
|
$.prototype.pause = function() {
|
|
@@ -5997,7 +6023,7 @@ function _s() {
|
|
|
5997
6023
|
set: function(p) {
|
|
5998
6024
|
this._readableState && (this._readableState.flowing = p);
|
|
5999
6025
|
}
|
|
6000
|
-
}), $._fromList =
|
|
6026
|
+
}), $._fromList = w, Object.defineProperty($.prototype, "readableLength", {
|
|
6001
6027
|
// making it explicit this property is not enumerable
|
|
6002
6028
|
// because otherwise some prototype manipulation in
|
|
6003
6029
|
// userland will fail
|
|
@@ -6006,7 +6032,7 @@ function _s() {
|
|
|
6006
6032
|
return this._readableState.length;
|
|
6007
6033
|
}
|
|
6008
6034
|
});
|
|
6009
|
-
function
|
|
6035
|
+
function w(d, p) {
|
|
6010
6036
|
if (p.length === 0) return null;
|
|
6011
6037
|
var A;
|
|
6012
6038
|
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 +6174,8 @@ function Bu() {
|
|
|
6148
6174
|
if (Array.isArray(t[0]) && (t = t[0]), t.length < 2)
|
|
6149
6175
|
throw new mu("streams");
|
|
6150
6176
|
var i, a = t.map(function(f, u) {
|
|
6151
|
-
var l = u < t.length - 1,
|
|
6152
|
-
return xu(f, l,
|
|
6177
|
+
var l = u < t.length - 1, b = u > 0;
|
|
6178
|
+
return xu(f, l, b, function(g) {
|
|
6153
6179
|
i || (i = g), g && a.forEach(di), !l && (a.forEach(di), n(i));
|
|
6154
6180
|
});
|
|
6155
6181
|
});
|
|
@@ -6220,7 +6246,7 @@ Tu(Ir, Is);
|
|
|
6220
6246
|
Ir.prototype._update = function() {
|
|
6221
6247
|
for (var e = Cu, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(t * 4);
|
|
6222
6248
|
var r = this._a, n = this._b, i = this._c, a = this._d;
|
|
6223
|
-
r =
|
|
6249
|
+
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
6250
|
};
|
|
6225
6251
|
Ir.prototype._digest = function() {
|
|
6226
6252
|
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 +6256,19 @@ Ir.prototype._digest = function() {
|
|
|
6230
6256
|
function Ar(e, t) {
|
|
6231
6257
|
return e << t | e >>> 32 - t;
|
|
6232
6258
|
}
|
|
6233
|
-
function
|
|
6259
|
+
function he(e, t, r, n, i, a, f) {
|
|
6234
6260
|
return Ar(e + (t & r | ~t & n) + i + a | 0, f) + t | 0;
|
|
6235
6261
|
}
|
|
6236
|
-
function
|
|
6262
|
+
function de(e, t, r, n, i, a, f) {
|
|
6237
6263
|
return Ar(e + (t & n | r & ~n) + i + a | 0, f) + t | 0;
|
|
6238
6264
|
}
|
|
6239
|
-
function
|
|
6265
|
+
function pe(e, t, r, n, i, a, f) {
|
|
6240
6266
|
return Ar(e + (t ^ r ^ n) + i + a | 0, f) + t | 0;
|
|
6241
6267
|
}
|
|
6242
|
-
function
|
|
6268
|
+
function be(e, t, r, n, i, a, f) {
|
|
6243
6269
|
return Ar(e + (r ^ (t | ~n)) + i + a | 0, f) + t | 0;
|
|
6244
6270
|
}
|
|
6245
|
-
var Lu = Ir, Jr = Rt.Buffer, ku = ge, As = Ss, Fu = new Array(16),
|
|
6271
|
+
var Lu = Ir, Jr = Rt.Buffer, ku = ge, As = Ss, Fu = new Array(16), Mt = [
|
|
6246
6272
|
0,
|
|
6247
6273
|
1,
|
|
6248
6274
|
2,
|
|
@@ -6573,12 +6599,12 @@ function Rr() {
|
|
|
6573
6599
|
ku(Rr, As);
|
|
6574
6600
|
Rr.prototype._update = function() {
|
|
6575
6601
|
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,
|
|
6602
|
+
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
6603
|
var I, v;
|
|
6578
|
-
E < 16 ? (I = pi(r, n, i, a, f, e[
|
|
6604
|
+
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
6605
|
}
|
|
6580
6606
|
var P = this._b + i + g | 0;
|
|
6581
|
-
this._b = this._c + a +
|
|
6607
|
+
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
6608
|
};
|
|
6583
6609
|
Rr.prototype._digest = function() {
|
|
6584
6610
|
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 +6636,8 @@ function Tr(e, t) {
|
|
|
6610
6636
|
Tr.prototype.update = function(e, t) {
|
|
6611
6637
|
typeof e == "string" && (t = t || "utf8", e = Ts.from(e, t));
|
|
6612
6638
|
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 +
|
|
6639
|
+
for (var u = a % n, l = Math.min(i - f, n - u), b = 0; b < l; b++)
|
|
6640
|
+
r[u + b] = e[f + b];
|
|
6615
6641
|
a += l, f += l, a % n === 0 && this._update(r);
|
|
6616
6642
|
}
|
|
6617
6643
|
return this._len += i, this;
|
|
@@ -6633,7 +6659,7 @@ Tr.prototype.digest = function(e) {
|
|
|
6633
6659
|
Tr.prototype._update = function() {
|
|
6634
6660
|
throw new Error("_update must be implemented by subclass");
|
|
6635
6661
|
};
|
|
6636
|
-
var Tt = Tr, Ou = ge, Ps = Tt,
|
|
6662
|
+
var Tt = Tr, Ou = ge, Ps = Tt, Nu = Ee.Buffer, Mu = [
|
|
6637
6663
|
1518500249,
|
|
6638
6664
|
1859775393,
|
|
6639
6665
|
-1894007588,
|
|
@@ -6659,13 +6685,13 @@ Qt.prototype._update = function(e) {
|
|
|
6659
6685
|
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
6686
|
for (; u < 80; ++u) t[u] = t[u - 3] ^ t[u - 8] ^ t[u - 14] ^ t[u - 16];
|
|
6661
6687
|
for (var l = 0; l < 80; ++l) {
|
|
6662
|
-
var
|
|
6688
|
+
var b = ~~(l / 20), g = $u(r) + zu(b, n, i, a) + f + t[l] + Mu[b] | 0;
|
|
6663
6689
|
f = a, a = i, i = Hu(n), n = r, r = g;
|
|
6664
6690
|
}
|
|
6665
6691
|
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
6692
|
};
|
|
6667
6693
|
Qt.prototype._hash = function() {
|
|
6668
|
-
var e =
|
|
6694
|
+
var e = Nu.allocUnsafe(20);
|
|
6669
6695
|
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
6696
|
};
|
|
6671
6697
|
var Gu = Qt, ju = ge, Cs = Tt, Wu = Ee.Buffer, qu = [
|
|
@@ -6697,7 +6723,7 @@ Zt.prototype._update = function(e) {
|
|
|
6697
6723
|
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
6724
|
for (; u < 80; ++u) t[u] = Ku(t[u - 3] ^ t[u - 8] ^ t[u - 14] ^ t[u - 16]);
|
|
6699
6725
|
for (var l = 0; l < 80; ++l) {
|
|
6700
|
-
var
|
|
6726
|
+
var b = ~~(l / 20), g = Yu(r) + Xu(b, n, i, a) + f + t[l] + qu[b] | 0;
|
|
6701
6727
|
f = a, a = i, i = Ju(n), n = r, r = g;
|
|
6702
6728
|
}
|
|
6703
6729
|
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 +6824,13 @@ function fc(e) {
|
|
|
6798
6824
|
return (e >>> 17 | e << 15) ^ (e >>> 19 | e << 13) ^ e >>> 10;
|
|
6799
6825
|
}
|
|
6800
6826
|
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,
|
|
6827
|
+
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
6828
|
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
|
-
|
|
6829
|
+
for (var m = 0; m < 64; ++m) {
|
|
6830
|
+
var E = b + oc(f) + nc(f, u, l) + tc[m] + t[m] | 0, I = sc(r) + ic(r, n, i) | 0;
|
|
6831
|
+
b = l, l = u, u = f, f = a + E | 0, a = i, i = n, n = r, r = E + I | 0;
|
|
6806
6832
|
}
|
|
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 =
|
|
6833
|
+
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
6834
|
};
|
|
6809
6835
|
er.prototype._hash = function() {
|
|
6810
6836
|
var e = ec.allocUnsafe(32);
|
|
@@ -7019,22 +7045,22 @@ function ue(e, t) {
|
|
|
7019
7045
|
return e >>> 0 < t >>> 0 ? 1 : 0;
|
|
7020
7046
|
}
|
|
7021
7047
|
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,
|
|
7048
|
+
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
7049
|
t[F] = e.readInt32BE(F * 4), t[F + 1] = e.readInt32BE(F * 4 + 4);
|
|
7024
7050
|
for (; F < 160; F += 2) {
|
|
7025
7051
|
var k = t[F - 30], L = t[F - 15 * 2 + 1], U = mc(k, L), S = wc(L, k);
|
|
7026
7052
|
k = t[F - 2 * 2], L = t[F - 2 * 2 + 1];
|
|
7027
|
-
var z = _c(k, L),
|
|
7028
|
-
ae = ae +
|
|
7053
|
+
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;
|
|
7054
|
+
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
7055
|
}
|
|
7030
7056
|
for (var ve = 0; ve < 160; ve += 2) {
|
|
7031
7057
|
xe = t[ve], ae = t[ve + 1];
|
|
7032
|
-
var et = xi(r, n, i), Pe = xi(g,
|
|
7033
|
-
_ = _ +
|
|
7058
|
+
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;
|
|
7059
|
+
_ = _ + 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
7060
|
var R = Ce + Pe | 0, D = je + et + ue(R, Ce) | 0;
|
|
7035
|
-
|
|
7061
|
+
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
7062
|
}
|
|
7037
|
-
this._al = this._al + g | 0, this._bl = this._bl +
|
|
7063
|
+
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
7064
|
};
|
|
7039
7065
|
tr.prototype._hash = function() {
|
|
7040
7066
|
var e = yc.allocUnsafe(64);
|
|
@@ -7070,11 +7096,11 @@ lt.sha224 = pc;
|
|
|
7070
7096
|
lt.sha256 = ks;
|
|
7071
7097
|
lt.sha384 = Ac;
|
|
7072
7098
|
lt.sha512 = Us;
|
|
7073
|
-
var Rc = Rs.exports, Os = Ee.Buffer,
|
|
7099
|
+
var Rc = Rs.exports, Os = Ee.Buffer, Ns = Rn.Transform, Tc = gr.StringDecoder, Pc = ge;
|
|
7074
7100
|
function Le(e) {
|
|
7075
|
-
|
|
7101
|
+
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
7102
|
}
|
|
7077
|
-
Pc(Le,
|
|
7103
|
+
Pc(Le, Ns);
|
|
7078
7104
|
Le.prototype.update = function(e, t, r) {
|
|
7079
7105
|
typeof e == "string" && (e = Os.from(e, t));
|
|
7080
7106
|
var n = this._update(e);
|
|
@@ -7119,11 +7145,11 @@ Le.prototype._toString = function(e, t, r) {
|
|
|
7119
7145
|
var n = this._decoder.write(e);
|
|
7120
7146
|
return r && (n += this._decoder.end()), n;
|
|
7121
7147
|
};
|
|
7122
|
-
var Cc = Le, Lc = ge, kc = Lu, Fc = Uu, Uc = Rc,
|
|
7148
|
+
var Cc = Le, Lc = ge, kc = Lu, Fc = Uu, Uc = Rc, Ms = Cc;
|
|
7123
7149
|
function Lr(e) {
|
|
7124
|
-
|
|
7150
|
+
Ms.call(this, "digest"), this._hash = e;
|
|
7125
7151
|
}
|
|
7126
|
-
Lc(Lr,
|
|
7152
|
+
Lc(Lr, Ms);
|
|
7127
7153
|
Lr.prototype._update = function(e) {
|
|
7128
7154
|
this._hash.update(e);
|
|
7129
7155
|
};
|
|
@@ -7133,7 +7159,7 @@ Lr.prototype._final = function() {
|
|
|
7133
7159
|
var Oc = function(t) {
|
|
7134
7160
|
return t = t.toLowerCase(), t === "md5" ? new kc() : t === "rmd160" || t === "ripemd160" ? new Fc() : new Lr(Uc(t));
|
|
7135
7161
|
}, ar = Ee.Buffer;
|
|
7136
|
-
function
|
|
7162
|
+
function Nc(e) {
|
|
7137
7163
|
if (e.length >= 255)
|
|
7138
7164
|
throw new TypeError("Alphabet too long");
|
|
7139
7165
|
for (var t = new Uint8Array(256), r = 0; r < t.length; r++)
|
|
@@ -7144,7 +7170,7 @@ function Mc(e) {
|
|
|
7144
7170
|
throw new TypeError(i + " is ambiguous");
|
|
7145
7171
|
t[a] = n;
|
|
7146
7172
|
}
|
|
7147
|
-
var f = e.length, u = e.charAt(0), l = Math.log(f) / Math.log(256),
|
|
7173
|
+
var f = e.length, u = e.charAt(0), l = Math.log(f) / Math.log(256), b = Math.log(256) / Math.log(f);
|
|
7148
7174
|
function g(I) {
|
|
7149
7175
|
if ((Array.isArray(I) || I instanceof Uint8Array) && (I = ar.from(I)), !ar.isBuffer(I))
|
|
7150
7176
|
throw new TypeError("Expected Buffer");
|
|
@@ -7152,7 +7178,7 @@ function Mc(e) {
|
|
|
7152
7178
|
return "";
|
|
7153
7179
|
for (var v = 0, P = 0, T = 0, C = I.length; T !== C && I[T] === 0; )
|
|
7154
7180
|
T++, v++;
|
|
7155
|
-
for (var F = (C - T) *
|
|
7181
|
+
for (var F = (C - T) * b + 1 >>> 0, k = new Uint8Array(F); T !== C; ) {
|
|
7156
7182
|
for (var L = I[T], U = 0, S = F - 1; (L !== 0 || U < P) && S !== -1; S--, U++)
|
|
7157
7183
|
L += 256 * k[S] >>> 0, k[S] = L % f >>> 0, L = L / f >>> 0;
|
|
7158
7184
|
if (L !== 0)
|
|
@@ -7161,11 +7187,11 @@ function Mc(e) {
|
|
|
7161
7187
|
}
|
|
7162
7188
|
for (var z = F - P; z !== F && k[z] === 0; )
|
|
7163
7189
|
z++;
|
|
7164
|
-
for (var
|
|
7165
|
-
|
|
7166
|
-
return
|
|
7190
|
+
for (var M = u.repeat(v); z < F; ++z)
|
|
7191
|
+
M += e.charAt(k[z]);
|
|
7192
|
+
return M;
|
|
7167
7193
|
}
|
|
7168
|
-
function
|
|
7194
|
+
function m(I) {
|
|
7169
7195
|
if (typeof I != "string")
|
|
7170
7196
|
throw new TypeError("Expected String");
|
|
7171
7197
|
if (I.length === 0)
|
|
@@ -7186,23 +7212,23 @@ function Mc(e) {
|
|
|
7186
7212
|
S++;
|
|
7187
7213
|
var z = ar.allocUnsafe(P + (C - S));
|
|
7188
7214
|
z.fill(0, 0, P);
|
|
7189
|
-
for (var
|
|
7190
|
-
z[
|
|
7215
|
+
for (var M = P; S !== C; )
|
|
7216
|
+
z[M++] = F[S++];
|
|
7191
7217
|
return z;
|
|
7192
7218
|
}
|
|
7193
7219
|
function E(I) {
|
|
7194
|
-
var v =
|
|
7220
|
+
var v = m(I);
|
|
7195
7221
|
if (v)
|
|
7196
7222
|
return v;
|
|
7197
7223
|
throw new Error("Non-base" + f + " character");
|
|
7198
7224
|
}
|
|
7199
7225
|
return {
|
|
7200
7226
|
encode: g,
|
|
7201
|
-
decodeUnsafe:
|
|
7227
|
+
decodeUnsafe: m,
|
|
7202
7228
|
decode: E
|
|
7203
7229
|
};
|
|
7204
7230
|
}
|
|
7205
|
-
var
|
|
7231
|
+
var Mc = Nc, Dc = Mc, $c = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz", Hc = Dc($c), Xr = Hc, zc = Ee.Buffer, Gc = function(e) {
|
|
7206
7232
|
function t(a) {
|
|
7207
7233
|
var f = e(a);
|
|
7208
7234
|
return Xr.encode(zc.concat([
|
|
@@ -7495,32 +7521,32 @@ function el(e) {
|
|
|
7495
7521
|
return we.typeforce(e.isPoint, u), we.typeforce(Qr, l), new f(void 0, u, l);
|
|
7496
7522
|
}
|
|
7497
7523
|
function i(u, l) {
|
|
7498
|
-
const
|
|
7524
|
+
const b = Si.decode(u), g = b.version;
|
|
7499
7525
|
if (we.Array(l)) {
|
|
7500
|
-
if (l = l.filter((
|
|
7526
|
+
if (l = l.filter((m) => g === m.wif).pop(), !l) throw new Error("Unknown network version");
|
|
7501
7527
|
} else if (l = l || hn.bitcoin, g !== l.wif) throw new Error("Invalid network version");
|
|
7502
|
-
return r(
|
|
7503
|
-
compressed:
|
|
7528
|
+
return r(b.privateKey, {
|
|
7529
|
+
compressed: b.compressed,
|
|
7504
7530
|
network: l
|
|
7505
7531
|
});
|
|
7506
7532
|
}
|
|
7507
7533
|
function a(u) {
|
|
7508
7534
|
we.typeforce(Qr, u), u === void 0 && (u = {});
|
|
7509
7535
|
const l = u.rng || Xc;
|
|
7510
|
-
let
|
|
7536
|
+
let b;
|
|
7511
7537
|
do
|
|
7512
|
-
|
|
7513
|
-
while (!e.isPrivate(
|
|
7514
|
-
return r(
|
|
7538
|
+
b = l(32), we.typeforce(we.Buffer256bit, b);
|
|
7539
|
+
while (!e.isPrivate(b));
|
|
7540
|
+
return r(b, u);
|
|
7515
7541
|
}
|
|
7516
7542
|
class f {
|
|
7517
|
-
constructor(l,
|
|
7543
|
+
constructor(l, b, g) {
|
|
7518
7544
|
pt(this, "__D");
|
|
7519
7545
|
pt(this, "__Q");
|
|
7520
7546
|
pt(this, "compressed");
|
|
7521
7547
|
pt(this, "network");
|
|
7522
7548
|
pt(this, "lowR");
|
|
7523
|
-
this.__D = l, this.__Q =
|
|
7549
|
+
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
7550
|
}
|
|
7525
7551
|
get privateKey() {
|
|
7526
7552
|
return this.__D;
|
|
@@ -7539,16 +7565,16 @@ function el(e) {
|
|
|
7539
7565
|
tweak(l) {
|
|
7540
7566
|
return this.privateKey ? this.tweakFromPrivateKey(l) : this.tweakFromPublicKey(l);
|
|
7541
7567
|
}
|
|
7542
|
-
sign(l,
|
|
7568
|
+
sign(l, b) {
|
|
7543
7569
|
if (!this.__D) throw new Error("Missing private key");
|
|
7544
|
-
if (
|
|
7570
|
+
if (b === void 0 && (b = this.lowR), b === !1)
|
|
7545
7571
|
return Buffer.from(e.sign(l, this.__D));
|
|
7546
7572
|
{
|
|
7547
7573
|
let g = e.sign(l, this.__D);
|
|
7548
|
-
const
|
|
7574
|
+
const m = Buffer.alloc(32, 0);
|
|
7549
7575
|
let E = 0;
|
|
7550
7576
|
for (; g[0] > 127; )
|
|
7551
|
-
E++,
|
|
7577
|
+
E++, m.writeUIntLE(E, 0, 6), g = e.sign(l, this.__D, m);
|
|
7552
7578
|
return Buffer.from(g);
|
|
7553
7579
|
}
|
|
7554
7580
|
}
|
|
@@ -7558,30 +7584,30 @@ function el(e) {
|
|
|
7558
7584
|
throw new Error("signSchnorr not supported by ecc library");
|
|
7559
7585
|
return Buffer.from(e.signSchnorr(l, this.privateKey));
|
|
7560
7586
|
}
|
|
7561
|
-
verify(l,
|
|
7562
|
-
return e.verify(l, this.publicKey,
|
|
7587
|
+
verify(l, b) {
|
|
7588
|
+
return e.verify(l, this.publicKey, b);
|
|
7563
7589
|
}
|
|
7564
|
-
verifySchnorr(l,
|
|
7590
|
+
verifySchnorr(l, b) {
|
|
7565
7591
|
if (!e.verifySchnorr)
|
|
7566
7592
|
throw new Error("verifySchnorr not supported by ecc library");
|
|
7567
|
-
return e.verifySchnorr(l, this.publicKey.subarray(1, 33),
|
|
7593
|
+
return e.verifySchnorr(l, this.publicKey.subarray(1, 33), b);
|
|
7568
7594
|
}
|
|
7569
7595
|
tweakFromPublicKey(l) {
|
|
7570
|
-
const
|
|
7596
|
+
const b = Zc(this.publicKey), g = e.xOnlyPointAddTweak(b, l);
|
|
7571
7597
|
if (!g || g.xOnlyPubkey === null)
|
|
7572
7598
|
throw new Error("Cannot tweak public key!");
|
|
7573
|
-
const
|
|
7599
|
+
const m = Buffer.from([
|
|
7574
7600
|
g.parity === 0 ? 2 : 3
|
|
7575
7601
|
]);
|
|
7576
7602
|
return n(
|
|
7577
|
-
Buffer.concat([
|
|
7603
|
+
Buffer.concat([m, g.xOnlyPubkey]),
|
|
7578
7604
|
{ network: this.network, compressed: this.compressed }
|
|
7579
7605
|
);
|
|
7580
7606
|
}
|
|
7581
7607
|
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(
|
|
7608
|
+
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);
|
|
7609
|
+
if (!m) throw new Error("Invalid tweaked private key!");
|
|
7610
|
+
return r(Buffer.from(m), {
|
|
7585
7611
|
network: this.network,
|
|
7586
7612
|
compressed: this.compressed
|
|
7587
7613
|
});
|
|
@@ -7624,7 +7650,7 @@ class dn {
|
|
|
7624
7650
|
return new dn(nt(t));
|
|
7625
7651
|
}
|
|
7626
7652
|
static async fromWalletClient(t) {
|
|
7627
|
-
if (!t.account) return
|
|
7653
|
+
if (!t.account) return N("No account found");
|
|
7628
7654
|
try {
|
|
7629
7655
|
const r = await t.signTypedData({
|
|
7630
7656
|
account: t.account,
|
|
@@ -7652,7 +7678,7 @@ class dn {
|
|
|
7652
7678
|
});
|
|
7653
7679
|
return fe(new dn(nt(ir(r))));
|
|
7654
7680
|
} catch (r) {
|
|
7655
|
-
return
|
|
7681
|
+
return N("Failed to initialize: " + r);
|
|
7656
7682
|
}
|
|
7657
7683
|
}
|
|
7658
7684
|
getMasterPrivKey() {
|
|
@@ -7680,9 +7706,9 @@ class dl {
|
|
|
7680
7706
|
amount: r.toString(),
|
|
7681
7707
|
exact_out: n.toString()
|
|
7682
7708
|
}), a = await mt.get(i);
|
|
7683
|
-
return a.error ?
|
|
7709
|
+
return a.error ? N(a.error) : a.result ? fe(a.result) : N("GetQuote: Unexpected error, result is undefined");
|
|
7684
7710
|
} catch (i) {
|
|
7685
|
-
return
|
|
7711
|
+
return N("GetQuote:", String(i));
|
|
7686
7712
|
}
|
|
7687
7713
|
}
|
|
7688
7714
|
async getAttestedQuote(t) {
|
|
@@ -7693,9 +7719,9 @@ class dl {
|
|
|
7693
7719
|
"Content-Type": "application/json"
|
|
7694
7720
|
}
|
|
7695
7721
|
});
|
|
7696
|
-
return r.error ?
|
|
7722
|
+
return r.error ? N(r.error) : r.result ? fe(r.result) : N("GetAttestedQuote: Unexpected error, result is undefined");
|
|
7697
7723
|
} catch (r) {
|
|
7698
|
-
return console.log("error :", r),
|
|
7724
|
+
return console.log("error :", r), N("GetAttestedQuote:", String(r));
|
|
7699
7725
|
}
|
|
7700
7726
|
}
|
|
7701
7727
|
async getStrategies() {
|
|
@@ -7703,9 +7729,9 @@ class dl {
|
|
|
7703
7729
|
const t = await mt.get(
|
|
7704
7730
|
this.quoteUrl.endpoint("/strategies")
|
|
7705
7731
|
);
|
|
7706
|
-
if (t.error) return
|
|
7732
|
+
if (t.error) return N(t.error);
|
|
7707
7733
|
if (!t.result)
|
|
7708
|
-
return
|
|
7734
|
+
return N("GetStrategies: Unexpected error, result is undefined");
|
|
7709
7735
|
const r = {};
|
|
7710
7736
|
for (const n of Object.values(t.result)) {
|
|
7711
7737
|
const i = Wa(
|
|
@@ -7722,7 +7748,7 @@ class dl {
|
|
|
7722
7748
|
}
|
|
7723
7749
|
return fe(r);
|
|
7724
7750
|
} catch (t) {
|
|
7725
|
-
return
|
|
7751
|
+
return N("GetStrategies:", String(t));
|
|
7726
7752
|
}
|
|
7727
7753
|
}
|
|
7728
7754
|
}
|
|
@@ -7730,7 +7756,7 @@ export {
|
|
|
7730
7756
|
rf as BlockNumberFetcher,
|
|
7731
7757
|
Ya as EvmRelay,
|
|
7732
7758
|
ll as Garden,
|
|
7733
|
-
|
|
7759
|
+
ce as OrderActions,
|
|
7734
7760
|
re as OrderStatus,
|
|
7735
7761
|
qa as ParseOrderStatus,
|
|
7736
7762
|
nn as ParseSwapStatus,
|