@jokio/sdk 0.3.1 → 0.3.3
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/jokio.sdk.es.js +373 -368
- package/dist/jokio.sdk.umd.js +18 -18
- package/package.json +1 -2
package/dist/jokio.sdk.es.js
CHANGED
|
@@ -189,28 +189,28 @@ async function ki(r) {
|
|
|
189
189
|
}
|
|
190
190
|
if (!n)
|
|
191
191
|
throw new Error("Registration was not completed");
|
|
192
|
-
const { id: o, rawId: a, response:
|
|
192
|
+
const { id: o, rawId: a, response: f, type: p } = n;
|
|
193
193
|
let g;
|
|
194
|
-
typeof
|
|
194
|
+
typeof f.getTransports == "function" && (g = f.getTransports());
|
|
195
195
|
let y;
|
|
196
|
-
if (typeof
|
|
196
|
+
if (typeof f.getPublicKeyAlgorithm == "function")
|
|
197
197
|
try {
|
|
198
|
-
y =
|
|
198
|
+
y = f.getPublicKeyAlgorithm();
|
|
199
199
|
} catch (T) {
|
|
200
200
|
ms("getPublicKeyAlgorithm()", T);
|
|
201
201
|
}
|
|
202
202
|
let x;
|
|
203
|
-
if (typeof
|
|
203
|
+
if (typeof f.getPublicKey == "function")
|
|
204
204
|
try {
|
|
205
|
-
const T =
|
|
205
|
+
const T = f.getPublicKey();
|
|
206
206
|
T !== null && (x = je(T));
|
|
207
207
|
} catch (T) {
|
|
208
208
|
ms("getPublicKey()", T);
|
|
209
209
|
}
|
|
210
210
|
let P;
|
|
211
|
-
if (typeof
|
|
211
|
+
if (typeof f.getAuthenticatorData == "function")
|
|
212
212
|
try {
|
|
213
|
-
P = je(
|
|
213
|
+
P = je(f.getAuthenticatorData());
|
|
214
214
|
} catch (T) {
|
|
215
215
|
ms("getAuthenticatorData()", T);
|
|
216
216
|
}
|
|
@@ -218,8 +218,8 @@ async function ki(r) {
|
|
|
218
218
|
id: o,
|
|
219
219
|
rawId: je(a),
|
|
220
220
|
response: {
|
|
221
|
-
attestationObject: je(
|
|
222
|
-
clientDataJSON: je(
|
|
221
|
+
attestationObject: je(f.attestationObject),
|
|
222
|
+
clientDataJSON: je(f.clientDataJSON),
|
|
223
223
|
transports: g,
|
|
224
224
|
publicKeyAlgorithm: y,
|
|
225
225
|
publicKey: x,
|
|
@@ -313,10 +313,10 @@ async function ji(r) {
|
|
|
313
313
|
}
|
|
314
314
|
if (!a)
|
|
315
315
|
throw new Error("Authentication was not completed");
|
|
316
|
-
const { id:
|
|
316
|
+
const { id: f, rawId: p, response: g, type: y } = a;
|
|
317
317
|
let x;
|
|
318
318
|
return g.userHandle && (x = je(g.userHandle)), {
|
|
319
|
-
id:
|
|
319
|
+
id: f,
|
|
320
320
|
rawId: je(p),
|
|
321
321
|
response: {
|
|
322
322
|
authenticatorData: je(g.authenticatorData),
|
|
@@ -377,7 +377,7 @@ class Fr {
|
|
|
377
377
|
return await this.options.storage.setItem(Ze, s), (i = this.onUserDataUpdate) == null || i.call(this, s), s;
|
|
378
378
|
}
|
|
379
379
|
async requestPasskeyLogin(e = {}) {
|
|
380
|
-
var
|
|
380
|
+
var f, p;
|
|
381
381
|
const {
|
|
382
382
|
displayName: t = "",
|
|
383
383
|
isRegistration: s = !1,
|
|
@@ -388,7 +388,7 @@ class Fr {
|
|
|
388
388
|
).then(pt);
|
|
389
389
|
let o;
|
|
390
390
|
try {
|
|
391
|
-
(
|
|
391
|
+
(f = n.user) != null && f.id ? o = await ki({
|
|
392
392
|
optionsJSON: n
|
|
393
393
|
}) : o = await ji({
|
|
394
394
|
optionsJSON: n
|
|
@@ -821,8 +821,8 @@ class Fe {
|
|
|
821
821
|
if (o) {
|
|
822
822
|
const a = o.indexOf(":");
|
|
823
823
|
if (a > -1) {
|
|
824
|
-
const
|
|
825
|
-
t.append(
|
|
824
|
+
const f = o.slice(0, a), p = o.slice(a + 1).trim();
|
|
825
|
+
t.append(f, p);
|
|
826
826
|
}
|
|
827
827
|
}
|
|
828
828
|
}), t;
|
|
@@ -1629,7 +1629,7 @@ ys = ss, function() {
|
|
|
1629
1629
|
t.JS_SHA256_NO_WINDOW && (e = !1);
|
|
1630
1630
|
var s = !e && typeof self == "object", i = !t.JS_SHA256_NO_NODE_JS && yr.versions && yr.versions.node;
|
|
1631
1631
|
i ? t = Qi : s && (t = self);
|
|
1632
|
-
var n = !t.JS_SHA256_NO_COMMON_JS && ys.exports, o = !t.JS_SHA256_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", a = "0123456789abcdef".split(""),
|
|
1632
|
+
var n = !t.JS_SHA256_NO_COMMON_JS && ys.exports, o = !t.JS_SHA256_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", a = "0123456789abcdef".split(""), f = [
|
|
1633
1633
|
-2147483648,
|
|
1634
1634
|
8388608,
|
|
1635
1635
|
32768,
|
|
@@ -1819,7 +1819,7 @@ ys = ss, function() {
|
|
|
1819
1819
|
if (!this.finalized) {
|
|
1820
1820
|
this.finalized = !0;
|
|
1821
1821
|
var w = this.blocks, j = this.lastByteIndex;
|
|
1822
|
-
w[16] = this.block, w[j >>> 2] |=
|
|
1822
|
+
w[16] = this.block, w[j >>> 2] |= f[3 & j], this.block = w[16], j >= 56 && (this.hashed || this.hash(), w[0] = this.block, w[16] = w[1] = w[2] = w[3] = w[4] = w[5] = w[6] = w[7] = w[8] = w[9] = w[10] = w[11] = w[12] = w[13] = w[14] = w[15] = 0), w[14] = this.hBytes << 3 | this.bytes >>> 29, w[15] = this.bytes << 3, this.hash();
|
|
1823
1823
|
}
|
|
1824
1824
|
}, L.prototype.hash = function() {
|
|
1825
1825
|
var w, j, F, R, A, U, q, $, z, ee = this.h0, se = this.h1, te = this.h2, re = this.h3, ae = this.h4, ce = this.h5, V = this.h6, Z = this.h7, ie = this.blocks;
|
|
@@ -2017,14 +2017,14 @@ class Ot {
|
|
|
2017
2017
|
const o = Fs();
|
|
2018
2018
|
for (let a = 0; a < n; a++)
|
|
2019
2019
|
try {
|
|
2020
|
-
const
|
|
2021
|
-
return this.parseJsResponse(
|
|
2022
|
-
} catch (
|
|
2023
|
-
const p =
|
|
2020
|
+
const f = await this.nc.request(e, i, s);
|
|
2021
|
+
return this.parseJsResponse(f);
|
|
2022
|
+
} catch (f) {
|
|
2023
|
+
const p = f;
|
|
2024
2024
|
if ((p.code === "503" || p.code === O.Timeout) && a + 1 < n)
|
|
2025
2025
|
await ct(o.backoff(a));
|
|
2026
2026
|
else
|
|
2027
|
-
throw
|
|
2027
|
+
throw f;
|
|
2028
2028
|
}
|
|
2029
2029
|
}
|
|
2030
2030
|
async findStream(e) {
|
|
@@ -2174,12 +2174,12 @@ class Yt extends Ot {
|
|
|
2174
2174
|
i.config = t, i.stream_name = e, i.action = s, i.config.durable_name && tt(i.config.durable_name);
|
|
2175
2175
|
const n = this.nc;
|
|
2176
2176
|
let { min: o, ok: a } = n.features.get(H.JS_NEW_CONSUMER_CREATE_API);
|
|
2177
|
-
const
|
|
2178
|
-
if (
|
|
2177
|
+
const f = t.name === "" ? void 0 : t.name;
|
|
2178
|
+
if (f && !a)
|
|
2179
2179
|
throw new Error(`consumer 'name' requires server ${o}`);
|
|
2180
|
-
if (
|
|
2180
|
+
if (f)
|
|
2181
2181
|
try {
|
|
2182
|
-
ts("name",
|
|
2182
|
+
ts("name", f);
|
|
2183
2183
|
} catch (x) {
|
|
2184
2184
|
const P = x.message, I = P.indexOf("cannot contain");
|
|
2185
2185
|
throw I !== -1 ? new Error(`consumer 'name' ${P.substring(I)}`) : x;
|
|
@@ -2258,9 +2258,9 @@ class dn extends oe {
|
|
|
2258
2258
|
T && (!this.protocolFilterFn || this.protocolFilterFn(I)) && (g(P, I), this.dispatchedFn && I && this.dispatchedFn(I));
|
|
2259
2259
|
};
|
|
2260
2260
|
}
|
|
2261
|
-
const { max: o, queue: a, timeout:
|
|
2261
|
+
const { max: o, queue: a, timeout: f } = i, p = {
|
|
2262
2262
|
queue: a,
|
|
2263
|
-
timeout:
|
|
2263
|
+
timeout: f,
|
|
2264
2264
|
callback: n
|
|
2265
2265
|
};
|
|
2266
2266
|
o && o > 0 && (p.max = o), this.sub = t.subscribe(s, p), i.cleanupFn && (this.sub.cleanupFn = i.cleanupFn), this.noIterator || this.iterClosed.then(() => {
|
|
@@ -2617,20 +2617,20 @@ class jn {
|
|
|
2617
2617
|
const s = [];
|
|
2618
2618
|
let i = [];
|
|
2619
2619
|
const n = ws(), o = /* @__PURE__ */ new Map();
|
|
2620
|
-
e.connect_urls && e.connect_urls.length > 0 && e.connect_urls.forEach((
|
|
2621
|
-
|
|
2622
|
-
const p = new xt(
|
|
2623
|
-
o.set(
|
|
2620
|
+
e.connect_urls && e.connect_urls.length > 0 && e.connect_urls.forEach((f) => {
|
|
2621
|
+
f = n ? n(f, t) : f;
|
|
2622
|
+
const p = new xt(f, !0);
|
|
2623
|
+
o.set(f, p);
|
|
2624
2624
|
});
|
|
2625
2625
|
const a = [];
|
|
2626
|
-
return this.servers.forEach((
|
|
2627
|
-
const g =
|
|
2628
|
-
|
|
2629
|
-
}), a.reverse(), a.forEach((
|
|
2630
|
-
const p = this.servers.splice(
|
|
2626
|
+
return this.servers.forEach((f, p) => {
|
|
2627
|
+
const g = f.listen;
|
|
2628
|
+
f.gossiped && this.currentServer.listen !== g && o.get(g) === void 0 && a.push(p), o.delete(g);
|
|
2629
|
+
}), a.reverse(), a.forEach((f) => {
|
|
2630
|
+
const p = this.servers.splice(f, 1);
|
|
2631
2631
|
i = i.concat(p[0].listen);
|
|
2632
|
-
}), o.forEach((
|
|
2633
|
-
this.servers.push(
|
|
2632
|
+
}), o.forEach((f, p) => {
|
|
2633
|
+
this.servers.push(f), s.push(p);
|
|
2634
2634
|
}), {
|
|
2635
2635
|
added: s,
|
|
2636
2636
|
deleted: i
|
|
@@ -3334,7 +3334,7 @@ var C;
|
|
|
3334
3334
|
n[0] = 9;
|
|
3335
3335
|
var o = t(), a = t([
|
|
3336
3336
|
1
|
|
3337
|
-
]),
|
|
3337
|
+
]), f = t([
|
|
3338
3338
|
56129,
|
|
3339
3339
|
1
|
|
3340
3340
|
]), p = t([
|
|
@@ -3431,32 +3431,32 @@ var C;
|
|
|
3431
3431
|
return u = u << 8 | c[l + 2] & 255, u = u << 8 | c[l + 1] & 255, u << 8 | c[l + 0] & 255;
|
|
3432
3432
|
}
|
|
3433
3433
|
function J(c, l) {
|
|
3434
|
-
var u = c[l] << 24 | c[l + 1] << 16 | c[l + 2] << 8 | c[l + 3],
|
|
3435
|
-
return new e(u,
|
|
3434
|
+
var u = c[l] << 24 | c[l + 1] << 16 | c[l + 2] << 8 | c[l + 3], d = c[l + 4] << 24 | c[l + 5] << 16 | c[l + 6] << 8 | c[l + 7];
|
|
3435
|
+
return new e(u, d);
|
|
3436
3436
|
}
|
|
3437
3437
|
function X(c, l, u) {
|
|
3438
|
-
var
|
|
3439
|
-
for (
|
|
3440
|
-
c[l +
|
|
3438
|
+
var d;
|
|
3439
|
+
for (d = 0; d < 4; d++)
|
|
3440
|
+
c[l + d] = u & 255, u >>>= 8;
|
|
3441
3441
|
}
|
|
3442
3442
|
function L(c, l, u) {
|
|
3443
3443
|
c[l] = u.hi >> 24 & 255, c[l + 1] = u.hi >> 16 & 255, c[l + 2] = u.hi >> 8 & 255, c[l + 3] = u.hi & 255, c[l + 4] = u.lo >> 24 & 255, c[l + 5] = u.lo >> 16 & 255, c[l + 6] = u.lo >> 8 & 255, c[l + 7] = u.lo & 255;
|
|
3444
3444
|
}
|
|
3445
|
-
function Y(c, l, u,
|
|
3445
|
+
function Y(c, l, u, d, m) {
|
|
3446
3446
|
var b, v = 0;
|
|
3447
|
-
for (b = 0; b < m; b++) v |= c[l + b] ^ u[
|
|
3447
|
+
for (b = 0; b < m; b++) v |= c[l + b] ^ u[d + b];
|
|
3448
3448
|
return (1 & v - 1 >>> 8) - 1;
|
|
3449
3449
|
}
|
|
3450
|
-
function ue(c, l, u,
|
|
3451
|
-
return Y(c, l, u,
|
|
3450
|
+
function ue(c, l, u, d) {
|
|
3451
|
+
return Y(c, l, u, d, 16);
|
|
3452
3452
|
}
|
|
3453
|
-
function w(c, l, u,
|
|
3454
|
-
return Y(c, l, u,
|
|
3453
|
+
function w(c, l, u, d) {
|
|
3454
|
+
return Y(c, l, u, d, 32);
|
|
3455
3455
|
}
|
|
3456
|
-
function j(c, l, u,
|
|
3456
|
+
function j(c, l, u, d, m) {
|
|
3457
3457
|
var b = new Uint32Array(16), v = new Uint32Array(16), E = new Uint32Array(16), _ = new Uint32Array(4), S, M, D;
|
|
3458
3458
|
for (S = 0; S < 4; S++)
|
|
3459
|
-
v[5 * S] = T(
|
|
3459
|
+
v[5 * S] = T(d, 4 * S), v[1 + S] = T(u, 4 * S), v[6 + S] = T(l, 4 * S), v[11 + S] = T(u, 16 + 4 * S);
|
|
3460
3460
|
for (S = 0; S < 16; S++) E[S] = v[S];
|
|
3461
3461
|
for (S = 0; S < 20; S++) {
|
|
3462
3462
|
for (M = 0; M < 4; M++) {
|
|
@@ -3468,17 +3468,17 @@ var C;
|
|
|
3468
3468
|
if (m) {
|
|
3469
3469
|
for (S = 0; S < 16; S++) v[S] = v[S] + E[S] | 0;
|
|
3470
3470
|
for (S = 0; S < 4; S++)
|
|
3471
|
-
v[5 * S] = v[5 * S] - T(
|
|
3471
|
+
v[5 * S] = v[5 * S] - T(d, 4 * S) | 0, v[6 + S] = v[6 + S] - T(l, 4 * S) | 0;
|
|
3472
3472
|
for (S = 0; S < 4; S++)
|
|
3473
3473
|
X(c, 4 * S, v[5 * S]), X(c, 16 + 4 * S, v[6 + S]);
|
|
3474
3474
|
} else
|
|
3475
3475
|
for (S = 0; S < 16; S++) X(c, 4 * S, v[S] + E[S] | 0);
|
|
3476
3476
|
}
|
|
3477
|
-
function F(c, l, u,
|
|
3478
|
-
return j(c, l, u,
|
|
3477
|
+
function F(c, l, u, d) {
|
|
3478
|
+
return j(c, l, u, d, !1), 0;
|
|
3479
3479
|
}
|
|
3480
|
-
function R(c, l, u,
|
|
3481
|
-
return j(c, l, u,
|
|
3480
|
+
function R(c, l, u, d) {
|
|
3481
|
+
return j(c, l, u, d, !0), 0;
|
|
3482
3482
|
}
|
|
3483
3483
|
var A = new Uint8Array([
|
|
3484
3484
|
101,
|
|
@@ -3498,36 +3498,36 @@ var C;
|
|
|
3498
3498
|
32,
|
|
3499
3499
|
107
|
|
3500
3500
|
]);
|
|
3501
|
-
function U(c, l, u,
|
|
3501
|
+
function U(c, l, u, d, m, b, v) {
|
|
3502
3502
|
var E = new Uint8Array(16), _ = new Uint8Array(64), S, M;
|
|
3503
3503
|
if (!m) return 0;
|
|
3504
3504
|
for (M = 0; M < 16; M++) E[M] = 0;
|
|
3505
3505
|
for (M = 0; M < 8; M++) E[M] = b[M];
|
|
3506
3506
|
for (; m >= 64; ) {
|
|
3507
|
-
for (F(_, E, v, A), M = 0; M < 64; M++) c[l + M] = (u ? u[
|
|
3507
|
+
for (F(_, E, v, A), M = 0; M < 64; M++) c[l + M] = (u ? u[d + M] : 0) ^ _[M];
|
|
3508
3508
|
for (S = 1, M = 8; M < 16; M++)
|
|
3509
3509
|
S = S + (E[M] & 255) | 0, E[M] = S & 255, S >>>= 8;
|
|
3510
|
-
m -= 64, l += 64, u && (
|
|
3510
|
+
m -= 64, l += 64, u && (d += 64);
|
|
3511
3511
|
}
|
|
3512
3512
|
if (m > 0)
|
|
3513
|
-
for (F(_, E, v, A), M = 0; M < m; M++) c[l + M] = (u ? u[
|
|
3513
|
+
for (F(_, E, v, A), M = 0; M < m; M++) c[l + M] = (u ? u[d + M] : 0) ^ _[M];
|
|
3514
3514
|
return 0;
|
|
3515
3515
|
}
|
|
3516
|
-
function q(c, l, u,
|
|
3517
|
-
return U(c, l, null, 0, u,
|
|
3516
|
+
function q(c, l, u, d, m) {
|
|
3517
|
+
return U(c, l, null, 0, u, d, m);
|
|
3518
3518
|
}
|
|
3519
|
-
function $(c, l, u,
|
|
3519
|
+
function $(c, l, u, d, m) {
|
|
3520
3520
|
var b = new Uint8Array(32);
|
|
3521
|
-
return R(b,
|
|
3521
|
+
return R(b, d, m, A), q(c, l, u, d.subarray(16), b);
|
|
3522
3522
|
}
|
|
3523
|
-
function z(c, l, u,
|
|
3523
|
+
function z(c, l, u, d, m, b, v) {
|
|
3524
3524
|
var E = new Uint8Array(32);
|
|
3525
|
-
return R(E, b, v, A), U(c, l, u,
|
|
3525
|
+
return R(E, b, v, A), U(c, l, u, d, m, b.subarray(16), E);
|
|
3526
3526
|
}
|
|
3527
3527
|
function ee(c, l) {
|
|
3528
|
-
var u,
|
|
3528
|
+
var u, d = 0;
|
|
3529
3529
|
for (u = 0; u < 17; u++)
|
|
3530
|
-
|
|
3530
|
+
d = d + (c[u] + l[u] | 0) | 0, c[u] = d & 255, d >>>= 8;
|
|
3531
3531
|
}
|
|
3532
3532
|
var se = new Uint32Array([
|
|
3533
3533
|
5,
|
|
@@ -3548,14 +3548,14 @@ var C;
|
|
|
3548
3548
|
0,
|
|
3549
3549
|
252
|
|
3550
3550
|
]);
|
|
3551
|
-
function te(c, l, u,
|
|
3551
|
+
function te(c, l, u, d, m, b) {
|
|
3552
3552
|
var v, E, _, S, M = new Uint32Array(17), D = new Uint32Array(17), W = new Uint32Array(17), Oe = new Uint32Array(17), Xe = new Uint32Array(17);
|
|
3553
3553
|
for (_ = 0; _ < 17; _++) D[_] = W[_] = 0;
|
|
3554
3554
|
for (_ = 0; _ < 16; _++) D[_] = b[_];
|
|
3555
3555
|
for (D[3] &= 15, D[4] &= 252, D[7] &= 15, D[8] &= 252, D[11] &= 15, D[12] &= 252, D[15] &= 15; m > 0; ) {
|
|
3556
3556
|
for (_ = 0; _ < 17; _++) Oe[_] = 0;
|
|
3557
|
-
for (_ = 0; _ < 16 && _ < m; ++_) Oe[_] = u[
|
|
3558
|
-
for (Oe[_] = 1,
|
|
3557
|
+
for (_ = 0; _ < 16 && _ < m; ++_) Oe[_] = u[d + _];
|
|
3558
|
+
for (Oe[_] = 1, d += _, m -= _, ee(W, Oe), E = 0; E < 17; E++)
|
|
3559
3559
|
for (M[E] = 0, _ = 0; _ < 17; _++) M[E] = M[E] + W[_] * (_ <= E ? D[E - _] : 320 * D[E + 17 - _] | 0) | 0 | 0;
|
|
3560
3560
|
for (E = 0; E < 17; E++) W[E] = M[E];
|
|
3561
3561
|
for (S = 0, _ = 0; _ < 16; _++)
|
|
@@ -3570,20 +3570,20 @@ var C;
|
|
|
3570
3570
|
for (Oe[16] = 0, ee(W, Oe), _ = 0; _ < 16; _++) c[l + _] = W[_];
|
|
3571
3571
|
return 0;
|
|
3572
3572
|
}
|
|
3573
|
-
function re(c, l, u,
|
|
3573
|
+
function re(c, l, u, d, m, b) {
|
|
3574
3574
|
var v = new Uint8Array(16);
|
|
3575
|
-
return te(v, 0, u,
|
|
3575
|
+
return te(v, 0, u, d, m, b), ue(c, l, v, 0);
|
|
3576
3576
|
}
|
|
3577
|
-
function ae(c, l, u,
|
|
3577
|
+
function ae(c, l, u, d, m) {
|
|
3578
3578
|
var b;
|
|
3579
3579
|
if (u < 32) return -1;
|
|
3580
|
-
for (z(c, 0, l, 0, u,
|
|
3580
|
+
for (z(c, 0, l, 0, u, d, m), te(c, 16, c, 32, u - 32, c), b = 0; b < 16; b++) c[b] = 0;
|
|
3581
3581
|
return 0;
|
|
3582
3582
|
}
|
|
3583
|
-
function ce(c, l, u,
|
|
3583
|
+
function ce(c, l, u, d, m) {
|
|
3584
3584
|
var b, v = new Uint8Array(32);
|
|
3585
|
-
if (u < 32 || ($(v, 0, 32,
|
|
3586
|
-
for (z(c, 0, l, 0, u,
|
|
3585
|
+
if (u < 32 || ($(v, 0, 32, d, m), re(l, 16, l, 32, u - 32, v) !== 0)) return -1;
|
|
3586
|
+
for (z(c, 0, l, 0, u, d, m), b = 0; b < 32; b++) c[b] = 0;
|
|
3587
3587
|
return 0;
|
|
3588
3588
|
}
|
|
3589
3589
|
function V(c, l) {
|
|
@@ -3596,13 +3596,13 @@ var C;
|
|
|
3596
3596
|
c[u] += 65536, l = Math.floor(c[u] / 65536), c[(u + 1) * (u < 15 ? 1 : 0)] += l - 1 + 37 * (l - 1) * (u === 15 ? 1 : 0), c[u] -= l * 65536;
|
|
3597
3597
|
}
|
|
3598
3598
|
function ie(c, l, u) {
|
|
3599
|
-
for (var
|
|
3600
|
-
|
|
3599
|
+
for (var d, m = ~(u - 1), b = 0; b < 16; b++)
|
|
3600
|
+
d = m & (c[b] ^ l[b]), c[b] ^= d, l[b] ^= d;
|
|
3601
3601
|
}
|
|
3602
3602
|
function Ve(c, l) {
|
|
3603
|
-
var u,
|
|
3603
|
+
var u, d, m, b = t(), v = t();
|
|
3604
3604
|
for (u = 0; u < 16; u++) v[u] = l[u];
|
|
3605
|
-
for (Z(v), Z(v), Z(v),
|
|
3605
|
+
for (Z(v), Z(v), Z(v), d = 0; d < 2; d++) {
|
|
3606
3606
|
for (b[0] = v[0] - 65517, u = 1; u < 15; u++)
|
|
3607
3607
|
b[u] = v[u] - 65535 - (b[u - 1] >> 16 & 1), b[u - 1] &= 65535;
|
|
3608
3608
|
b[15] = v[15] - 32767 - (b[14] >> 16 & 1), m = b[15] >> 16 & 1, b[14] &= 65535, ie(v, b, 1 - m);
|
|
@@ -3611,8 +3611,8 @@ var C;
|
|
|
3611
3611
|
c[2 * u] = v[u] & 255, c[2 * u + 1] = v[u] >> 8;
|
|
3612
3612
|
}
|
|
3613
3613
|
function Vs(c, l) {
|
|
3614
|
-
var u = new Uint8Array(32),
|
|
3615
|
-
return Ve(u, c), Ve(
|
|
3614
|
+
var u = new Uint8Array(32), d = new Uint8Array(32);
|
|
3615
|
+
return Ve(u, c), Ve(d, l), w(u, 0, d, 0);
|
|
3616
3616
|
}
|
|
3617
3617
|
function Ws(c) {
|
|
3618
3618
|
var l = new Uint8Array(32);
|
|
@@ -3624,48 +3624,48 @@ var C;
|
|
|
3624
3624
|
c[15] &= 32767;
|
|
3625
3625
|
}
|
|
3626
3626
|
function Ae(c, l, u) {
|
|
3627
|
-
var
|
|
3628
|
-
for (
|
|
3627
|
+
var d;
|
|
3628
|
+
for (d = 0; d < 16; d++) c[d] = l[d] + u[d] | 0;
|
|
3629
3629
|
}
|
|
3630
3630
|
function Pe(c, l, u) {
|
|
3631
|
-
var
|
|
3632
|
-
for (
|
|
3631
|
+
var d;
|
|
3632
|
+
for (d = 0; d < 16; d++) c[d] = l[d] - u[d] | 0;
|
|
3633
3633
|
}
|
|
3634
3634
|
function B(c, l, u) {
|
|
3635
|
-
var
|
|
3636
|
-
for (
|
|
3637
|
-
for (
|
|
3635
|
+
var d, m, b = new Float64Array(31);
|
|
3636
|
+
for (d = 0; d < 31; d++) b[d] = 0;
|
|
3637
|
+
for (d = 0; d < 16; d++)
|
|
3638
3638
|
for (m = 0; m < 16; m++)
|
|
3639
|
-
b[
|
|
3640
|
-
for (
|
|
3641
|
-
b[
|
|
3642
|
-
for (
|
|
3639
|
+
b[d + m] += l[d] * u[m];
|
|
3640
|
+
for (d = 0; d < 15; d++)
|
|
3641
|
+
b[d] += 38 * b[d + 16];
|
|
3642
|
+
for (d = 0; d < 16; d++) c[d] = b[d];
|
|
3643
3643
|
Z(c), Z(c);
|
|
3644
3644
|
}
|
|
3645
3645
|
function we(c, l) {
|
|
3646
3646
|
B(c, l, l);
|
|
3647
3647
|
}
|
|
3648
3648
|
function Ys(c, l) {
|
|
3649
|
-
var u = t(),
|
|
3650
|
-
for (
|
|
3651
|
-
for (
|
|
3652
|
-
we(u, u),
|
|
3653
|
-
for (
|
|
3649
|
+
var u = t(), d;
|
|
3650
|
+
for (d = 0; d < 16; d++) u[d] = l[d];
|
|
3651
|
+
for (d = 253; d >= 0; d--)
|
|
3652
|
+
we(u, u), d !== 2 && d !== 4 && B(u, u, l);
|
|
3653
|
+
for (d = 0; d < 16; d++) c[d] = u[d];
|
|
3654
3654
|
}
|
|
3655
3655
|
function Xs(c, l) {
|
|
3656
|
-
var u = t(),
|
|
3657
|
-
for (
|
|
3658
|
-
for (
|
|
3659
|
-
we(u, u),
|
|
3660
|
-
for (
|
|
3656
|
+
var u = t(), d;
|
|
3657
|
+
for (d = 0; d < 16; d++) u[d] = l[d];
|
|
3658
|
+
for (d = 250; d >= 0; d--)
|
|
3659
|
+
we(u, u), d !== 1 && B(u, u, l);
|
|
3660
|
+
for (d = 0; d < 16; d++) c[d] = u[d];
|
|
3661
3661
|
}
|
|
3662
3662
|
function Ct(c, l, u) {
|
|
3663
|
-
var
|
|
3664
|
-
for (v = 0; v < 31; v++)
|
|
3665
|
-
for (
|
|
3663
|
+
var d = new Uint8Array(32), m = new Float64Array(80), b, v, E = t(), _ = t(), S = t(), M = t(), D = t(), W = t();
|
|
3664
|
+
for (v = 0; v < 31; v++) d[v] = l[v];
|
|
3665
|
+
for (d[31] = l[31] & 127 | 64, d[0] &= 248, is(m, u), v = 0; v < 16; v++)
|
|
3666
3666
|
_[v] = m[v], M[v] = E[v] = S[v] = 0;
|
|
3667
3667
|
for (E[0] = M[0] = 1, v = 254; v >= 0; --v)
|
|
3668
|
-
b =
|
|
3668
|
+
b = d[v >>> 3] >>> (v & 7) & 1, ie(E, _, b), ie(S, M, b), Ae(D, E, S), Pe(E, E, S), Ae(S, _, M), Pe(_, _, M), we(M, D), we(W, E), B(E, S, E), B(S, _, D), Ae(D, E, S), Pe(E, E, S), we(_, E), Pe(S, M, W), B(E, S, f), Ae(E, E, M), B(S, S, E), B(E, M, W), B(M, _, m), we(_, D), ie(E, _, b), ie(S, M, b);
|
|
3669
3669
|
for (v = 0; v < 16; v++)
|
|
3670
3670
|
m[v + 16] = E[v], m[v + 32] = S[v], m[v + 48] = _[v], m[v + 64] = M[v];
|
|
3671
3671
|
var Oe = m.subarray(32), Xe = m.subarray(16);
|
|
@@ -3678,23 +3678,23 @@ var C;
|
|
|
3678
3678
|
return s(l, 32), It(c, l);
|
|
3679
3679
|
}
|
|
3680
3680
|
function jt(c, l, u) {
|
|
3681
|
-
var
|
|
3682
|
-
return Ct(
|
|
3681
|
+
var d = new Uint8Array(32);
|
|
3682
|
+
return Ct(d, u, l), R(c, i, d, A);
|
|
3683
3683
|
}
|
|
3684
3684
|
var Qs = ae, ai = ce;
|
|
3685
|
-
function ci(c, l, u,
|
|
3685
|
+
function ci(c, l, u, d, m, b) {
|
|
3686
3686
|
var v = new Uint8Array(32);
|
|
3687
|
-
return jt(v, m, b), Qs(c, l, u,
|
|
3687
|
+
return jt(v, m, b), Qs(c, l, u, d, v);
|
|
3688
3688
|
}
|
|
3689
|
-
function hi(c, l, u,
|
|
3689
|
+
function hi(c, l, u, d, m, b) {
|
|
3690
3690
|
var v = new Uint8Array(32);
|
|
3691
|
-
return jt(v, m, b), ai(c, l, u,
|
|
3691
|
+
return jt(v, m, b), ai(c, l, u, d, v);
|
|
3692
3692
|
}
|
|
3693
3693
|
function ht() {
|
|
3694
|
-
var c = 0, l = 0, u = 0,
|
|
3694
|
+
var c = 0, l = 0, u = 0, d = 0, m = 65535, b, v, E;
|
|
3695
3695
|
for (E = 0; E < arguments.length; E++)
|
|
3696
|
-
b = arguments[E].lo, v = arguments[E].hi, c += b & m, l += b >>> 16, u += v & m,
|
|
3697
|
-
return l += c >>> 16, u += l >>> 16,
|
|
3696
|
+
b = arguments[E].lo, v = arguments[E].hi, c += b & m, l += b >>> 16, u += v & m, d += v >>> 16;
|
|
3697
|
+
return l += c >>> 16, u += l >>> 16, d += u >>> 16, new e(u & m | d << 16, c & m | l << 16);
|
|
3698
3698
|
}
|
|
3699
3699
|
function er(c, l) {
|
|
3700
3700
|
return new e(c.hi >>> l, c.lo >>> l | c.hi << 32 - l);
|
|
@@ -3706,16 +3706,16 @@ var C;
|
|
|
3706
3706
|
return new e(l, c);
|
|
3707
3707
|
}
|
|
3708
3708
|
function Ie(c, l) {
|
|
3709
|
-
var u,
|
|
3710
|
-
return l < 32 ? (u = c.hi >>> l | c.lo << m,
|
|
3709
|
+
var u, d, m = 32 - l;
|
|
3710
|
+
return l < 32 ? (u = c.hi >>> l | c.lo << m, d = c.lo >>> l | c.hi << m) : l < 64 && (u = c.lo >>> l | c.hi << m, d = c.hi >>> l | c.lo << m), new e(u, d);
|
|
3711
3711
|
}
|
|
3712
3712
|
function ui(c, l, u) {
|
|
3713
|
-
var
|
|
3714
|
-
return new e(
|
|
3713
|
+
var d = c.hi & l.hi ^ ~c.hi & u.hi, m = c.lo & l.lo ^ ~c.lo & u.lo;
|
|
3714
|
+
return new e(d, m);
|
|
3715
3715
|
}
|
|
3716
3716
|
function li(c, l, u) {
|
|
3717
|
-
var
|
|
3718
|
-
return new e(
|
|
3717
|
+
var d = c.hi & l.hi ^ c.hi & u.hi ^ l.hi & u.hi, m = c.lo & l.lo ^ c.lo & u.lo ^ l.lo & u.lo;
|
|
3718
|
+
return new e(d, m);
|
|
3719
3719
|
}
|
|
3720
3720
|
function fi(c) {
|
|
3721
3721
|
return Rt(Ie(c, 28), Ie(c, 34), Ie(c, 39));
|
|
@@ -3812,8 +3812,8 @@ var C;
|
|
|
3812
3812
|
new e(1816402316, 1246189591)
|
|
3813
3813
|
];
|
|
3814
3814
|
function tr(c, l, u) {
|
|
3815
|
-
var
|
|
3816
|
-
for (_ = 0; _ < 8; _++)
|
|
3815
|
+
var d = [], m = [], b = [], v = [], E, _, S;
|
|
3816
|
+
for (_ = 0; _ < 8; _++) d[_] = b[_] = J(c, 8 * _);
|
|
3817
3817
|
for (var M = 0; u >= 128; ) {
|
|
3818
3818
|
for (_ = 0; _ < 16; _++) v[_] = J(l, 8 * _ + M);
|
|
3819
3819
|
for (_ = 0; _ < 80; _++) {
|
|
@@ -3824,10 +3824,10 @@ var C;
|
|
|
3824
3824
|
v[S] = ht(v[S], v[(S + 9) % 16], pi(v[(S + 1) % 16]), mi(v[(S + 14) % 16]));
|
|
3825
3825
|
}
|
|
3826
3826
|
for (_ = 0; _ < 8; _++)
|
|
3827
|
-
b[_] = ht(b[_],
|
|
3827
|
+
b[_] = ht(b[_], d[_]), d[_] = b[_];
|
|
3828
3828
|
M += 128, u -= 128;
|
|
3829
3829
|
}
|
|
3830
|
-
for (_ = 0; _ < 8; _++) L(c, 8 * _,
|
|
3830
|
+
for (_ = 0; _ < 8; _++) L(c, 8 * _, d[_]);
|
|
3831
3831
|
return u;
|
|
3832
3832
|
}
|
|
3833
3833
|
var gi = new Uint8Array([
|
|
@@ -3897,30 +3897,30 @@ var C;
|
|
|
3897
3897
|
121
|
|
3898
3898
|
]);
|
|
3899
3899
|
function Je(c, l, u) {
|
|
3900
|
-
var
|
|
3901
|
-
for (b = 0; b < 64; b++)
|
|
3902
|
-
for (tr(
|
|
3900
|
+
var d = new Uint8Array(64), m = new Uint8Array(256), b, v = u;
|
|
3901
|
+
for (b = 0; b < 64; b++) d[b] = gi[b];
|
|
3902
|
+
for (tr(d, l, u), u %= 128, b = 0; b < 256; b++) m[b] = 0;
|
|
3903
3903
|
for (b = 0; b < u; b++) m[b] = l[v - u + b];
|
|
3904
|
-
for (m[u] = 128, u = 256 - 128 * (u < 112 ? 1 : 0), m[u - 9] = 0, L(m, u - 8, new e(v / 536870912 | 0, v << 3)), tr(
|
|
3904
|
+
for (m[u] = 128, u = 256 - 128 * (u < 112 ? 1 : 0), m[u - 9] = 0, L(m, u - 8, new e(v / 536870912 | 0, v << 3)), tr(d, m, u), b = 0; b < 64; b++) c[b] = d[b];
|
|
3905
3905
|
return 0;
|
|
3906
3906
|
}
|
|
3907
3907
|
function Nt(c, l) {
|
|
3908
|
-
var u = t(),
|
|
3909
|
-
Pe(u, c[1], c[0]), Pe(M, l[1], l[0]), B(u, u, M), Ae(
|
|
3908
|
+
var u = t(), d = t(), m = t(), b = t(), v = t(), E = t(), _ = t(), S = t(), M = t();
|
|
3909
|
+
Pe(u, c[1], c[0]), Pe(M, l[1], l[0]), B(u, u, M), Ae(d, c[0], c[1]), Ae(M, l[0], l[1]), B(d, d, M), B(m, c[3], l[3]), B(m, m, g), B(b, c[2], l[2]), Ae(b, b, b), Pe(v, d, u), Pe(E, b, m), Ae(_, b, m), Ae(S, d, u), B(c[0], v, E), B(c[1], S, _), B(c[2], _, E), B(c[3], v, S);
|
|
3910
3910
|
}
|
|
3911
3911
|
function sr(c, l, u) {
|
|
3912
|
-
var
|
|
3913
|
-
for (
|
|
3914
|
-
ie(c[
|
|
3912
|
+
var d;
|
|
3913
|
+
for (d = 0; d < 4; d++)
|
|
3914
|
+
ie(c[d], l[d], u);
|
|
3915
3915
|
}
|
|
3916
3916
|
function ns(c, l) {
|
|
3917
|
-
var u = t(),
|
|
3918
|
-
Ys(m, l[2]), B(u, l[0], m), B(
|
|
3917
|
+
var u = t(), d = t(), m = t();
|
|
3918
|
+
Ys(m, l[2]), B(u, l[0], m), B(d, l[1], m), Ve(c, d), c[31] ^= Ws(u) << 7;
|
|
3919
3919
|
}
|
|
3920
3920
|
function os(c, l, u) {
|
|
3921
|
-
var
|
|
3921
|
+
var d, m;
|
|
3922
3922
|
for (V(c[0], o), V(c[1], a), V(c[2], a), V(c[3], o), m = 255; m >= 0; --m)
|
|
3923
|
-
|
|
3923
|
+
d = u[m / 8 | 0] >> (m & 7) & 1, sr(c, l, d), Nt(l, c), Nt(c, c), sr(c, l, d);
|
|
3924
3924
|
}
|
|
3925
3925
|
function Tt(c, l) {
|
|
3926
3926
|
var u = [
|
|
@@ -3932,13 +3932,13 @@ var C;
|
|
|
3932
3932
|
V(u[0], y), V(u[1], x), V(u[2], a), B(u[3], y, x), os(c, u, l);
|
|
3933
3933
|
}
|
|
3934
3934
|
function as(c, l, u) {
|
|
3935
|
-
var
|
|
3935
|
+
var d = new Uint8Array(64), m = [
|
|
3936
3936
|
t(),
|
|
3937
3937
|
t(),
|
|
3938
3938
|
t(),
|
|
3939
3939
|
t()
|
|
3940
3940
|
], b;
|
|
3941
|
-
for (u || s(l, 32), Je(
|
|
3941
|
+
for (u || s(l, 32), Je(d, l, 32), d[0] &= 248, d[31] &= 127, d[31] |= 64, Tt(m, d), ns(c, m), b = 0; b < 32; b++) l[b + 32] = c[b];
|
|
3942
3942
|
return 0;
|
|
3943
3943
|
}
|
|
3944
3944
|
var Mt = new Float64Array([
|
|
@@ -3976,17 +3976,17 @@ var C;
|
|
|
3976
3976
|
16
|
|
3977
3977
|
]);
|
|
3978
3978
|
function cs(c, l) {
|
|
3979
|
-
var u,
|
|
3980
|
-
for (
|
|
3981
|
-
for (u = 0, m =
|
|
3982
|
-
l[m] += u - 16 * l[
|
|
3983
|
-
l[m] += u, l[
|
|
3979
|
+
var u, d, m, b;
|
|
3980
|
+
for (d = 63; d >= 32; --d) {
|
|
3981
|
+
for (u = 0, m = d - 32, b = d - 12; m < b; ++m)
|
|
3982
|
+
l[m] += u - 16 * l[d] * Mt[m - (d - 32)], u = Math.floor((l[m] + 128) / 256), l[m] -= u * 256;
|
|
3983
|
+
l[m] += u, l[d] = 0;
|
|
3984
3984
|
}
|
|
3985
3985
|
for (u = 0, m = 0; m < 32; m++)
|
|
3986
3986
|
l[m] += u - (l[31] >> 4) * Mt[m], u = l[m] >> 8, l[m] &= 255;
|
|
3987
3987
|
for (m = 0; m < 32; m++) l[m] -= u * Mt[m];
|
|
3988
|
-
for (
|
|
3989
|
-
l[
|
|
3988
|
+
for (d = 0; d < 32; d++)
|
|
3989
|
+
l[d + 1] += l[d] >> 8, c[d] = l[d] & 255;
|
|
3990
3990
|
}
|
|
3991
3991
|
function hs(c) {
|
|
3992
3992
|
var l = new Float64Array(64), u;
|
|
@@ -3994,18 +3994,18 @@ var C;
|
|
|
3994
3994
|
for (u = 0; u < 64; u++) c[u] = 0;
|
|
3995
3995
|
cs(c, l);
|
|
3996
3996
|
}
|
|
3997
|
-
function rr(c, l, u,
|
|
3997
|
+
function rr(c, l, u, d) {
|
|
3998
3998
|
var m = new Uint8Array(64), b = new Uint8Array(64), v = new Uint8Array(64), E, _, S = new Float64Array(64), M = [
|
|
3999
3999
|
t(),
|
|
4000
4000
|
t(),
|
|
4001
4001
|
t(),
|
|
4002
4002
|
t()
|
|
4003
4003
|
];
|
|
4004
|
-
Je(m,
|
|
4004
|
+
Je(m, d, 32), m[0] &= 248, m[31] &= 127, m[31] |= 64;
|
|
4005
4005
|
var D = u + 64;
|
|
4006
4006
|
for (E = 0; E < u; E++) c[64 + E] = l[E];
|
|
4007
4007
|
for (E = 0; E < 32; E++) c[32 + E] = m[32 + E];
|
|
4008
|
-
for (Je(v, c.subarray(32), u + 32), hs(v), Tt(M, v), ns(c, M), E = 32; E < 64; E++) c[E] =
|
|
4008
|
+
for (Je(v, c.subarray(32), u + 32), hs(v), Tt(M, v), ns(c, M), E = 32; E < 64; E++) c[E] = d[E];
|
|
4009
4009
|
for (Je(b, c, u + 64), hs(b), E = 0; E < 64; E++) S[E] = 0;
|
|
4010
4010
|
for (E = 0; E < 32; E++) S[E] = v[E];
|
|
4011
4011
|
for (E = 0; E < 32; E++)
|
|
@@ -4014,10 +4014,10 @@ var C;
|
|
|
4014
4014
|
return cs(c.subarray(32), S), D;
|
|
4015
4015
|
}
|
|
4016
4016
|
function _i(c, l) {
|
|
4017
|
-
var u = t(),
|
|
4018
|
-
return V(c[2], a), is(c[1], l), we(m, c[1]), B(b, m, p), Pe(m, m, c[2]), Ae(b, c[2], b), we(v, b), we(E, v), B(_, E, v), B(u, _, m), B(u, u, b), Xs(u, u), B(u, u, m), B(u, u, b), B(u, u, b), B(c[0], u, b), we(
|
|
4017
|
+
var u = t(), d = t(), m = t(), b = t(), v = t(), E = t(), _ = t();
|
|
4018
|
+
return V(c[2], a), is(c[1], l), we(m, c[1]), B(b, m, p), Pe(m, m, c[2]), Ae(b, c[2], b), we(v, b), we(E, v), B(_, E, v), B(u, _, m), B(u, u, b), Xs(u, u), B(u, u, m), B(u, u, b), B(u, u, b), B(c[0], u, b), we(d, c[0]), B(d, d, b), Vs(d, m) && B(c[0], c[0], P), we(d, c[0]), B(d, d, b), Vs(d, m) ? -1 : (Ws(c[0]) === l[31] >> 7 && Pe(c[0], o, c[0]), B(c[3], c[0], c[1]), 0);
|
|
4019
4019
|
}
|
|
4020
|
-
function us(c, l, u,
|
|
4020
|
+
function us(c, l, u, d) {
|
|
4021
4021
|
var m, b = new Uint8Array(32), v = new Uint8Array(64), E = [
|
|
4022
4022
|
t(),
|
|
4023
4023
|
t(),
|
|
@@ -4029,9 +4029,9 @@ var C;
|
|
|
4029
4029
|
t(),
|
|
4030
4030
|
t()
|
|
4031
4031
|
];
|
|
4032
|
-
if (u < 64 || _i(_,
|
|
4032
|
+
if (u < 64 || _i(_, d)) return -1;
|
|
4033
4033
|
for (m = 0; m < u; m++) c[m] = l[m];
|
|
4034
|
-
for (m = 0; m < 32; m++) c[m + 32] =
|
|
4034
|
+
for (m = 0; m < 32; m++) c[m + 32] = d[m];
|
|
4035
4035
|
if (Je(v, c, u), hs(v), os(E, _, v), Tt(_, l.subarray(32)), Nt(E, _), ns(b, E), u -= 64, w(l, 0, b, 0)) {
|
|
4036
4036
|
for (m = 0; m < u; m++) c[m] = 0;
|
|
4037
4037
|
return -1;
|
|
@@ -4116,12 +4116,12 @@ var C;
|
|
|
4116
4116
|
return s(l, c), l;
|
|
4117
4117
|
}, r.secretbox = function(c, l, u) {
|
|
4118
4118
|
pe(c, l, u), nr(u, l);
|
|
4119
|
-
for (var
|
|
4120
|
-
return ae(m,
|
|
4119
|
+
for (var d = new Uint8Array(ut + c.length), m = new Uint8Array(d.length), b = 0; b < c.length; b++) d[b + ut] = c[b];
|
|
4120
|
+
return ae(m, d, d.length, l, u), m.subarray(We);
|
|
4121
4121
|
}, r.secretbox.open = function(c, l, u) {
|
|
4122
4122
|
pe(c, l, u), nr(u, l);
|
|
4123
|
-
for (var
|
|
4124
|
-
return
|
|
4123
|
+
for (var d = new Uint8Array(We + c.length), m = new Uint8Array(d.length), b = 0; b < c.length; b++) d[b + We] = c[b];
|
|
4124
|
+
return d.length < 32 || ce(m, d, d.length, l, u) !== 0 ? null : m.subarray(ut);
|
|
4125
4125
|
}, r.secretbox.keyLength = ls, r.secretbox.nonceLength = Ut, r.secretbox.overheadLength = We, r.scalarMult = function(c, l) {
|
|
4126
4126
|
if (pe(c, l), c.length !== $t) throw new Error("bad n size");
|
|
4127
4127
|
if (l.length !== lt) throw new Error("bad p size");
|
|
@@ -4131,15 +4131,15 @@ var C;
|
|
|
4131
4131
|
if (pe(c), c.length !== $t) throw new Error("bad n size");
|
|
4132
4132
|
var l = new Uint8Array(lt);
|
|
4133
4133
|
return It(l, c), l;
|
|
4134
|
-
}, r.scalarMult.scalarLength = $t, r.scalarMult.groupElementLength = lt, r.box = function(c, l, u,
|
|
4135
|
-
var m = r.box.before(u,
|
|
4134
|
+
}, r.scalarMult.scalarLength = $t, r.scalarMult.groupElementLength = lt, r.box = function(c, l, u, d) {
|
|
4135
|
+
var m = r.box.before(u, d);
|
|
4136
4136
|
return r.secretbox(c, l, m);
|
|
4137
4137
|
}, r.box.before = function(c, l) {
|
|
4138
4138
|
pe(c, l), xi(c, l);
|
|
4139
4139
|
var u = new Uint8Array(fs);
|
|
4140
4140
|
return jt(u, c, l), u;
|
|
4141
|
-
}, r.box.after = r.secretbox, r.box.open = function(c, l, u,
|
|
4142
|
-
var m = r.box.before(u,
|
|
4141
|
+
}, r.box.after = r.secretbox, r.box.open = function(c, l, u, d) {
|
|
4142
|
+
var m = r.box.before(u, d);
|
|
4143
4143
|
return r.secretbox.open(c, l, m);
|
|
4144
4144
|
}, r.box.open.after = r.secretbox.open, r.box.keyPair = function() {
|
|
4145
4145
|
var c = new Uint8Array(ft), l = new Uint8Array(dt);
|
|
@@ -4160,20 +4160,20 @@ var C;
|
|
|
4160
4160
|
return rr(u, c, c.length, l), u;
|
|
4161
4161
|
}, r.sign.open = function(c, l) {
|
|
4162
4162
|
if (pe(c, l), l.length !== ze) throw new Error("bad public key size");
|
|
4163
|
-
var u = new Uint8Array(c.length),
|
|
4164
|
-
if (
|
|
4165
|
-
for (var m = new Uint8Array(
|
|
4163
|
+
var u = new Uint8Array(c.length), d = us(u, c, c.length, l);
|
|
4164
|
+
if (d < 0) return null;
|
|
4165
|
+
for (var m = new Uint8Array(d), b = 0; b < m.length; b++) m[b] = u[b];
|
|
4166
4166
|
return m;
|
|
4167
4167
|
}, r.sign.detached = function(c, l) {
|
|
4168
|
-
for (var u = r.sign(c, l),
|
|
4169
|
-
return
|
|
4168
|
+
for (var u = r.sign(c, l), d = new Uint8Array(Te), m = 0; m < d.length; m++) d[m] = u[m];
|
|
4169
|
+
return d;
|
|
4170
4170
|
}, r.sign.detached.verify = function(c, l, u) {
|
|
4171
4171
|
if (pe(c, l, u), l.length !== Te) throw new Error("bad signature size");
|
|
4172
4172
|
if (u.length !== ze) throw new Error("bad public key size");
|
|
4173
|
-
var
|
|
4174
|
-
for (b = 0; b < Te; b++)
|
|
4175
|
-
for (b = 0; b < c.length; b++)
|
|
4176
|
-
return us(m,
|
|
4173
|
+
var d = new Uint8Array(Te + c.length), m = new Uint8Array(Te + c.length), b;
|
|
4174
|
+
for (b = 0; b < Te; b++) d[b] = l[b];
|
|
4175
|
+
for (b = 0; b < c.length; b++) d[b + Te] = c[b];
|
|
4176
|
+
return us(m, d, d.length, u) >= 0;
|
|
4177
4177
|
}, r.sign.keyPair = function() {
|
|
4178
4178
|
var c = new Uint8Array(ze), l = new Uint8Array(Ye);
|
|
4179
4179
|
return as(c, l), {
|
|
@@ -4189,7 +4189,7 @@ var C;
|
|
|
4189
4189
|
};
|
|
4190
4190
|
}, r.sign.keyPair.fromSeed = function(c) {
|
|
4191
4191
|
if (pe(c), c.length !== ds) throw new Error("bad seed size");
|
|
4192
|
-
for (var l = new Uint8Array(ze), u = new Uint8Array(Ye),
|
|
4192
|
+
for (var l = new Uint8Array(ze), u = new Uint8Array(Ye), d = 0; d < 32; d++) u[d] = c[d];
|
|
4193
4193
|
return as(l, u, !0), {
|
|
4194
4194
|
publicKey: l,
|
|
4195
4195
|
secretKey: u
|
|
@@ -4206,16 +4206,16 @@ var C;
|
|
|
4206
4206
|
var c = typeof globalThis < "u" ? globalThis.crypto || globalThis.msCrypto : null;
|
|
4207
4207
|
if (c && c.getRandomValues) {
|
|
4208
4208
|
var l = 65536;
|
|
4209
|
-
r.setPRNG(function(u,
|
|
4210
|
-
var m, b = new Uint8Array(
|
|
4211
|
-
for (m = 0; m <
|
|
4212
|
-
c.getRandomValues(b.subarray(m, m + Math.min(
|
|
4213
|
-
for (m = 0; m <
|
|
4209
|
+
r.setPRNG(function(u, d) {
|
|
4210
|
+
var m, b = new Uint8Array(d);
|
|
4211
|
+
for (m = 0; m < d; m += l)
|
|
4212
|
+
c.getRandomValues(b.subarray(m, m + Math.min(d - m, l)));
|
|
4213
|
+
for (m = 0; m < d; m++) u[m] = b[m];
|
|
4214
4214
|
or(b);
|
|
4215
4215
|
});
|
|
4216
|
-
} else typeof require < "u" && (crypto = window.crypto || globalThis.crypto, c && c.randomBytes && r.setPRNG(function(u,
|
|
4217
|
-
var m, b = c.randomBytes(
|
|
4218
|
-
for (m = 0; m <
|
|
4216
|
+
} else typeof require < "u" && (crypto = window.crypto || globalThis.crypto, c && c.randomBytes && r.setPRNG(function(u, d) {
|
|
4217
|
+
var m, b = c.randomBytes(d);
|
|
4218
|
+
for (m = 0; m < d; m++) u[m] = b[m];
|
|
4219
4219
|
or(b);
|
|
4220
4220
|
}));
|
|
4221
4221
|
}();
|
|
@@ -4381,9 +4381,9 @@ class Zr extends oe {
|
|
|
4381
4381
|
protocol: !1
|
|
4382
4382
|
}), n = t.protocolFilterFn ? t.protocolFilterFn : () => !0, o = t.dispatchedFn ? t.dispatchedFn : () => {
|
|
4383
4383
|
};
|
|
4384
|
-
this.callback = (a,
|
|
4385
|
-
const { ingest: p } = i(
|
|
4386
|
-
p && n(
|
|
4384
|
+
this.callback = (a, f) => {
|
|
4385
|
+
const { ingest: p } = i(f);
|
|
4386
|
+
p && n(f) && (s(a, f), o(f));
|
|
4387
4387
|
};
|
|
4388
4388
|
} else
|
|
4389
4389
|
this.protocolFilterFn = t.protocolFilterFn, this.dispatchedFn = t.dispatchedFn;
|
|
@@ -4734,8 +4734,8 @@ class Zt {
|
|
|
4734
4734
|
lang: o
|
|
4735
4735
|
}, this.options, t.nonce);
|
|
4736
4736
|
t.headers && (a.headers = !0, a.no_responders = !0);
|
|
4737
|
-
const
|
|
4738
|
-
this.transport.send(yt(`CONNECT ${
|
|
4737
|
+
const f = JSON.stringify(a);
|
|
4738
|
+
this.transport.send(yt(`CONNECT ${f}${Ht}`)), this.transport.send(kr);
|
|
4739
4739
|
} catch (a) {
|
|
4740
4740
|
this._close(a);
|
|
4741
4741
|
}
|
|
@@ -4797,12 +4797,12 @@ class Zt {
|
|
|
4797
4797
|
if (this.info && n > this.info.max_payload)
|
|
4798
4798
|
throw N.errorForCode(O.MaxPayloadExceeded);
|
|
4799
4799
|
this.outBytes += n, this.outMsgs++;
|
|
4800
|
-
let
|
|
4801
|
-
s.headers ? (s.reply ?
|
|
4802
|
-
` :
|
|
4803
|
-
`, this.sendCommand(
|
|
4804
|
-
` :
|
|
4805
|
-
`, this.sendCommand(
|
|
4800
|
+
let f;
|
|
4801
|
+
s.headers ? (s.reply ? f = `HPUB ${e} ${s.reply} ${a} ${n}\r
|
|
4802
|
+
` : f = `HPUB ${e} ${a} ${n}\r
|
|
4803
|
+
`, this.sendCommand(f, o, i, Xt)) : (s.reply ? f = `PUB ${e} ${s.reply} ${n}\r
|
|
4804
|
+
` : f = `PUB ${e} ${n}\r
|
|
4805
|
+
`, this.sendCommand(f, i, Xt));
|
|
4806
4806
|
}
|
|
4807
4807
|
request(e) {
|
|
4808
4808
|
return this.initMux(), this.muxSubscriptions.add(e), e;
|
|
@@ -4943,14 +4943,14 @@ class Et {
|
|
|
4943
4943
|
gt("endpoint", e);
|
|
4944
4944
|
let { subject: i, handler: n, metadata: o, queue: a } = s;
|
|
4945
4945
|
i = i || e, a = a || this.queue, Zn("endpoint subject", i), i = this.calcSubject(this.subject, i);
|
|
4946
|
-
const
|
|
4946
|
+
const f = {
|
|
4947
4947
|
name: e,
|
|
4948
4948
|
subject: i,
|
|
4949
4949
|
queue: a,
|
|
4950
4950
|
handler: n,
|
|
4951
4951
|
metadata: o
|
|
4952
4952
|
};
|
|
4953
|
-
return this.srv._addEndpoint(
|
|
4953
|
+
return this.srv._addEndpoint(f);
|
|
4954
4954
|
}
|
|
4955
4955
|
addGroup(e = "", t = "") {
|
|
4956
4956
|
return new Et(this, e, t);
|
|
@@ -5028,7 +5028,7 @@ class kt {
|
|
|
5028
5028
|
setupHandler(e, t = !1) {
|
|
5029
5029
|
const s = t ? "" : e.queue ? e.queue : this.config.queue, { name: i, subject: n, handler: o } = e, a = e;
|
|
5030
5030
|
a.internal = t, t && this.internal.push(a), a.stats = new eo(i, n, s), a.queue = s;
|
|
5031
|
-
const
|
|
5031
|
+
const f = o ? (p, g) => {
|
|
5032
5032
|
if (p) {
|
|
5033
5033
|
this.close(p);
|
|
5034
5034
|
return;
|
|
@@ -5045,7 +5045,7 @@ class kt {
|
|
|
5045
5045
|
}
|
|
5046
5046
|
} : void 0;
|
|
5047
5047
|
return a.sub = this.nc.subscribe(n, {
|
|
5048
|
-
callback:
|
|
5048
|
+
callback: f,
|
|
5049
5049
|
queue: s
|
|
5050
5050
|
}), a.sub.closed.then(() => {
|
|
5051
5051
|
this._stopped || this.close(new Error(`required subscription ${e.subject} stopped`)).catch();
|
|
@@ -5108,7 +5108,7 @@ class kt {
|
|
|
5108
5108
|
o.name = e, o.subject = kt.controlSubject(t, i, n), o.handler = s, this.setupHandler(o, !0);
|
|
5109
5109
|
}
|
|
5110
5110
|
start() {
|
|
5111
|
-
const e = Ee(), t = (o, a) => o ? (this.close(o), Promise.reject(o)) : this.stats().then((
|
|
5111
|
+
const e = Ee(), t = (o, a) => o ? (this.close(o), Promise.reject(o)) : this.stats().then((f) => (a == null || a.respond(e.encode(f)), Promise.resolve())), s = (o, a) => o ? (this.close(o), Promise.reject(o)) : (a == null || a.respond(e.encode(this.info())), Promise.resolve()), i = e.encode(this.ping()), n = (o, a) => o ? (this.close(o).then().catch(), Promise.reject(o)) : (a.respond(i), Promise.resolve());
|
|
5112
5112
|
return this.addInternalHandler(qe.PING, n), this.addInternalHandler(qe.STATS, t), this.addInternalHandler(qe.INFO, s), this.handlers.forEach((o) => {
|
|
5113
5113
|
const { subject: a } = o;
|
|
5114
5114
|
typeof a == "string" && o.handler !== null && this.setupHandler(o);
|
|
@@ -5189,7 +5189,7 @@ class eo {
|
|
|
5189
5189
|
this.num_errors++, this.last_error = e.message;
|
|
5190
5190
|
}
|
|
5191
5191
|
_stats() {
|
|
5192
|
-
const { name: e, subject: t, average_processing_time: s, num_errors: i, num_requests: n, processing_time: o, last_error: a, data:
|
|
5192
|
+
const { name: e, subject: t, average_processing_time: s, num_errors: i, num_requests: n, processing_time: o, last_error: a, data: f, queue: p } = this;
|
|
5193
5193
|
return {
|
|
5194
5194
|
name: e,
|
|
5195
5195
|
subject: t,
|
|
@@ -5198,7 +5198,7 @@ class eo {
|
|
|
5198
5198
|
num_requests: n,
|
|
5199
5199
|
processing_time: o,
|
|
5200
5200
|
last_error: a,
|
|
5201
|
-
data:
|
|
5201
|
+
data: f,
|
|
5202
5202
|
queue_group: p
|
|
5203
5203
|
};
|
|
5204
5204
|
}
|
|
@@ -5229,9 +5229,9 @@ class to {
|
|
|
5229
5229
|
async q(e, t = "", s = "") {
|
|
5230
5230
|
const i = new oe(), n = Ee(), o = kt.controlSubject(e, t, s, this.prefix), a = await this.nc.requestMany(o, ye, this.opts);
|
|
5231
5231
|
return (async () => {
|
|
5232
|
-
for await (const
|
|
5232
|
+
for await (const f of a)
|
|
5233
5233
|
try {
|
|
5234
|
-
const p = n.decode(
|
|
5234
|
+
const p = n.decode(f.data);
|
|
5235
5235
|
i.push(p);
|
|
5236
5236
|
} catch (p) {
|
|
5237
5237
|
i.push(() => {
|
|
@@ -5241,8 +5241,8 @@ class to {
|
|
|
5241
5241
|
i.push(() => {
|
|
5242
5242
|
i.stop();
|
|
5243
5243
|
});
|
|
5244
|
-
})().catch((
|
|
5245
|
-
i.stop(
|
|
5244
|
+
})().catch((f) => {
|
|
5245
|
+
i.stop(f);
|
|
5246
5246
|
}), i;
|
|
5247
5247
|
}
|
|
5248
5248
|
}
|
|
@@ -5373,12 +5373,12 @@ class At {
|
|
|
5373
5373
|
e.metadata && (s.metadata = e.metadata), typeof e.compression == "boolean" && (s.compression = e.compression ? He.S2 : He.None);
|
|
5374
5374
|
const n = this.js.nc, o = n.getServerVersion(), a = o ? js(o, Ge("2.7.2")) >= 0 : !1;
|
|
5375
5375
|
s.discard = a ? vt.New : vt.Old;
|
|
5376
|
-
const { ok:
|
|
5377
|
-
if (!
|
|
5376
|
+
const { ok: f, min: p } = n.features.get(H.JS_ALLOW_DIRECT);
|
|
5377
|
+
if (!f && e.allow_direct === !0) {
|
|
5378
5378
|
const y = o ? `${o.major}.${o.minor}.${o.micro}` : "unknown";
|
|
5379
5379
|
return Promise.reject(new Error(`allow_direct is not available on server version ${y} - requires ${p}`));
|
|
5380
5380
|
}
|
|
5381
|
-
e.allow_direct = typeof e.allow_direct == "boolean" ? e.allow_direct :
|
|
5381
|
+
e.allow_direct = typeof e.allow_direct == "boolean" ? e.allow_direct : f, s.allow_direct = e.allow_direct, this.direct = s.allow_direct, s.num_replicas = t.replicas, t.ttl && (s.max_age = G(t.ttl)), s.allow_rollup_hdrs = !0;
|
|
5382
5382
|
let g;
|
|
5383
5383
|
try {
|
|
5384
5384
|
g = await this.jsm.streams.info(s.name), !g.config.allow_direct && this.direct === !0 && (this.direct = !1);
|
|
@@ -5493,14 +5493,14 @@ class At {
|
|
|
5493
5493
|
this.validateKey(i);
|
|
5494
5494
|
const n = {};
|
|
5495
5495
|
if (s.previousSeq !== void 0) {
|
|
5496
|
-
const
|
|
5497
|
-
n.headers =
|
|
5496
|
+
const f = Ue();
|
|
5497
|
+
n.headers = f, f.set(Re.ExpectedLastSubjectSequenceHdr, `${s.previousSeq}`);
|
|
5498
5498
|
}
|
|
5499
5499
|
try {
|
|
5500
5500
|
return (await this.js.publish(this.subjectForKey(i, !0), t, n)).seq;
|
|
5501
|
-
} catch (
|
|
5502
|
-
const p =
|
|
5503
|
-
return p.isJetStreamError() ? (p.message = (o = p.api_error) == null ? void 0 : o.description, p.code = `${(a = p.api_error) == null ? void 0 : a.code}`, Promise.reject(p)) : Promise.reject(
|
|
5501
|
+
} catch (f) {
|
|
5502
|
+
const p = f;
|
|
5503
|
+
return p.isJetStreamError() ? (p.message = (o = p.api_error) == null ? void 0 : o.description, p.code = `${(a = p.api_error) == null ? void 0 : a.code}`, Promise.reject(p)) : Promise.reject(f);
|
|
5504
5504
|
}
|
|
5505
5505
|
}
|
|
5506
5506
|
async get(e, t) {
|
|
@@ -5537,12 +5537,12 @@ class At {
|
|
|
5537
5537
|
}
|
|
5538
5538
|
});
|
|
5539
5539
|
(async () => {
|
|
5540
|
-
for await (const
|
|
5541
|
-
(
|
|
5540
|
+
for await (const f of i)
|
|
5541
|
+
(f.operation === "DEL" || f.operation === "PURGE") && s.push(f);
|
|
5542
5542
|
})().then(), await t, i.stop();
|
|
5543
|
-
const n = Date.now() - e, o = s.map((
|
|
5544
|
-
const p = this.subjectForKey(
|
|
5545
|
-
return
|
|
5543
|
+
const n = Date.now() - e, o = s.map((f) => {
|
|
5544
|
+
const p = this.subjectForKey(f.key);
|
|
5545
|
+
return f.created.getTime() >= n ? this.jsm.streams.purge(this.stream, {
|
|
5546
5546
|
filter: p,
|
|
5547
5547
|
keep: 1
|
|
5548
5548
|
}) : this.jsm.streams.purge(this.stream, {
|
|
@@ -5553,7 +5553,7 @@ class At {
|
|
|
5553
5553
|
return a.unshift({
|
|
5554
5554
|
success: !0,
|
|
5555
5555
|
purged: 0
|
|
5556
|
-
}), a.reduce((
|
|
5556
|
+
}), a.reduce((f, p) => (f.purged += p.purged, f));
|
|
5557
5557
|
}
|
|
5558
5558
|
async _deleteOrPurge(e, t, s) {
|
|
5559
5559
|
if (!this.hasWildcards(e))
|
|
@@ -5574,9 +5574,9 @@ class At {
|
|
|
5574
5574
|
_buildCC(e, t, s = {}) {
|
|
5575
5575
|
let n = (Array.isArray(e) ? e : [
|
|
5576
5576
|
e
|
|
5577
|
-
]).map((
|
|
5578
|
-
const p = this.encodeKey(
|
|
5579
|
-
return this.validateSearchKey(
|
|
5577
|
+
]).map((f) => {
|
|
5578
|
+
const p = this.encodeKey(f);
|
|
5579
|
+
return this.validateSearchKey(f), this.fullKeyName(p);
|
|
5580
5580
|
}), o = Q.LastPerSubject;
|
|
5581
5581
|
t === ke.AllHistory && (o = Q.All), t === ke.UpdatesOnly && (o = Q.New);
|
|
5582
5582
|
let a;
|
|
@@ -5600,7 +5600,7 @@ class At {
|
|
|
5600
5600
|
s.stop();
|
|
5601
5601
|
};
|
|
5602
5602
|
let o = 0;
|
|
5603
|
-
const a = this._buildCC(t, ke.AllHistory, i),
|
|
5603
|
+
const a = this._buildCC(t, ke.AllHistory, i), f = a.filter_subject, p = Be(a);
|
|
5604
5604
|
p.bindStream(this.stream), p.orderedConsumer(), p.callback((y, x) => {
|
|
5605
5605
|
if (y) {
|
|
5606
5606
|
s.stop(y);
|
|
@@ -5611,7 +5611,7 @@ class At {
|
|
|
5611
5611
|
s.push(P), s.received++, (n && o > 0 && s.received >= o || x.info.pending === 0) && (s.push(n), n = void 0);
|
|
5612
5612
|
}
|
|
5613
5613
|
});
|
|
5614
|
-
const g = await this.js.subscribe(
|
|
5614
|
+
const g = await this.js.subscribe(f, p);
|
|
5615
5615
|
if (n) {
|
|
5616
5616
|
const { info: { last: y } } = g, x = y.num_pending + y.delivered.consumer_seq;
|
|
5617
5617
|
if (x === 0 || s.received >= x)
|
|
@@ -5643,7 +5643,7 @@ class At {
|
|
|
5643
5643
|
let n = ke.LastValue;
|
|
5644
5644
|
e.include === ke.AllHistory ? n = ke.AllHistory : e.include === ke.UpdatesOnly && (n = ke.UpdatesOnly);
|
|
5645
5645
|
const o = e.ignoreDeletes === !0;
|
|
5646
|
-
let a = e.initializedFn,
|
|
5646
|
+
let a = e.initializedFn, f = 0;
|
|
5647
5647
|
const p = this._buildCC(t, n, i), g = p.filter_subject, y = Be(p);
|
|
5648
5648
|
this.canSetWatcherName() && y.consumerName(De.next()), y.bindStream(this.stream), e.resumeFromRevision && e.resumeFromRevision > 0 && y.startSequence(e.resumeFromRevision), y.orderedConsumer(), y.callback((P, I) => {
|
|
5649
5649
|
if (P) {
|
|
@@ -5654,7 +5654,7 @@ class At {
|
|
|
5654
5654
|
const T = this.jmToEntry(I);
|
|
5655
5655
|
if (o && T.operation === "DEL")
|
|
5656
5656
|
return;
|
|
5657
|
-
s.push(T), s.received++, a && (
|
|
5657
|
+
s.push(T), s.received++, a && (f > 0 && s.received >= f || I.info.pending === 0) && (s.push(a), a = void 0);
|
|
5658
5658
|
}
|
|
5659
5659
|
});
|
|
5660
5660
|
const x = await this.js.subscribe(g, y);
|
|
@@ -5669,7 +5669,7 @@ class At {
|
|
|
5669
5669
|
a = void 0;
|
|
5670
5670
|
}
|
|
5671
5671
|
else
|
|
5672
|
-
|
|
5672
|
+
f = I;
|
|
5673
5673
|
}
|
|
5674
5674
|
return s._data = x, s.iterClosed.then(() => {
|
|
5675
5675
|
x.unsubscribe();
|
|
@@ -5686,9 +5686,9 @@ class At {
|
|
|
5686
5686
|
n.bindStream(this.stream), n.orderedConsumer();
|
|
5687
5687
|
const o = await this.js.subscribe(i, n);
|
|
5688
5688
|
return (async () => {
|
|
5689
|
-
var
|
|
5689
|
+
var f;
|
|
5690
5690
|
for await (const p of o) {
|
|
5691
|
-
const g = (
|
|
5691
|
+
const g = (f = p.headers) == null ? void 0 : f.get(Qt);
|
|
5692
5692
|
if (g !== "DEL" && g !== "PURGE") {
|
|
5693
5693
|
const y = this.decodeKey(p.subject.substring(this.prefixLen));
|
|
5694
5694
|
t.push(y);
|
|
@@ -5697,8 +5697,8 @@ class At {
|
|
|
5697
5697
|
}
|
|
5698
5698
|
})().then(() => {
|
|
5699
5699
|
t.stop();
|
|
5700
|
-
}).catch((
|
|
5701
|
-
t.stop(
|
|
5700
|
+
}).catch((f) => {
|
|
5701
|
+
t.stop(f);
|
|
5702
5702
|
}), o.info.last.num_pending === 0 && o.unsubscribe(), t;
|
|
5703
5703
|
}
|
|
5704
5704
|
purgeBucket(e) {
|
|
@@ -5890,19 +5890,19 @@ class vs extends oe {
|
|
|
5890
5890
|
}
|
|
5891
5891
|
start() {
|
|
5892
5892
|
const { max_messages: t, max_bytes: s, idle_heartbeat: i, threshold_bytes: n, threshold_messages: o } = this.opts;
|
|
5893
|
-
this.closed().then((
|
|
5893
|
+
this.closed().then((f) => {
|
|
5894
5894
|
if (this.cleanupHandler)
|
|
5895
5895
|
try {
|
|
5896
|
-
this.cleanupHandler(
|
|
5896
|
+
this.cleanupHandler(f);
|
|
5897
5897
|
} catch {
|
|
5898
5898
|
}
|
|
5899
5899
|
});
|
|
5900
5900
|
const { sub: a } = this;
|
|
5901
5901
|
a && a.unsubscribe(), this.sub = this.consumer.api.nc.subscribe(this.inbox, {
|
|
5902
|
-
callback: (
|
|
5902
|
+
callback: (f, p) => {
|
|
5903
5903
|
var y, x, P, I;
|
|
5904
|
-
if (
|
|
5905
|
-
this.stop(
|
|
5904
|
+
if (f) {
|
|
5905
|
+
this.stop(f);
|
|
5906
5906
|
return;
|
|
5907
5907
|
}
|
|
5908
5908
|
if ((y = this.monitor) == null || y.work(), p.subject === this.inbox) {
|
|
@@ -5946,15 +5946,15 @@ class vs extends oe {
|
|
|
5946
5946
|
this.sub.draining && this._push(() => {
|
|
5947
5947
|
this.stop();
|
|
5948
5948
|
});
|
|
5949
|
-
}), i && (this.monitor = new Hs(i, (
|
|
5949
|
+
}), i && (this.monitor = new Hs(i, (f) => (this.notify(Ne.HeartbeatsMissed, f), this.resetPending().then(() => {
|
|
5950
5950
|
}).catch(() => {
|
|
5951
5951
|
}), !1), {
|
|
5952
5952
|
maxOut: 2
|
|
5953
5953
|
})), (async () => {
|
|
5954
5954
|
var p;
|
|
5955
|
-
const
|
|
5956
|
-
this.statusIterator =
|
|
5957
|
-
for await (const g of
|
|
5955
|
+
const f = this.consumer.api.nc.status();
|
|
5956
|
+
this.statusIterator = f;
|
|
5957
|
+
for await (const g of f)
|
|
5958
5958
|
switch (g.type) {
|
|
5959
5959
|
case ve.Disconnect:
|
|
5960
5960
|
(p = this.monitor) == null || p.cancel();
|
|
@@ -6027,11 +6027,11 @@ class vs extends oe {
|
|
|
6027
6027
|
} else
|
|
6028
6028
|
t = 0, s = 0;
|
|
6029
6029
|
this.inBackOff = !0;
|
|
6030
|
-
const a = i.backoff(n),
|
|
6030
|
+
const a = i.backoff(n), f = ct(a);
|
|
6031
6031
|
await Promise.race([
|
|
6032
|
-
|
|
6032
|
+
f,
|
|
6033
6033
|
this.consumer.api.nc.closed()
|
|
6034
|
-
]),
|
|
6034
|
+
]), f.cancel(), n++;
|
|
6035
6035
|
}
|
|
6036
6036
|
}
|
|
6037
6037
|
}
|
|
@@ -6250,7 +6250,7 @@ class go {
|
|
|
6250
6250
|
return this.consumerOpts.headers_only === !0 && (s.headers_only = !0), Array.isArray(this.consumerOpts.filterSubjects) && (s.filter_subjects = this.consumerOpts.filterSubjects), typeof this.consumerOpts.filterSubjects == "string" && (s.filter_subject = this.consumerOpts.filterSubjects), this.consumerOpts.replay_policy && (s.replay_policy = this.consumerOpts.replay_policy), e === this.startSeq + 1 && (s.deliver_policy = this.consumerOpts.deliver_policy || Q.StartSequence, (this.consumerOpts.deliver_policy === Q.LastPerSubject || this.consumerOpts.deliver_policy === Q.New || this.consumerOpts.deliver_policy === Q.Last) && (delete s.opt_start_seq, s.deliver_policy = this.consumerOpts.deliver_policy), s.deliver_policy === Q.LastPerSubject && typeof s.filter_subjects > "u" && typeof s.filter_subject > "u" && (s.filter_subject = ">"), this.consumerOpts.opt_start_time && (delete s.opt_start_seq, s.deliver_policy = Q.StartTime, s.opt_start_time = this.consumerOpts.opt_start_time), this.consumerOpts.inactive_threshold && (s.inactive_threshold = G(this.consumerOpts.inactive_threshold))), s;
|
|
6251
6251
|
}
|
|
6252
6252
|
async resetConsumer(e = 0) {
|
|
6253
|
-
var o, a,
|
|
6253
|
+
var o, a, f, p, g;
|
|
6254
6254
|
De.next();
|
|
6255
6255
|
const t = this.serial === 0;
|
|
6256
6256
|
(o = this.consumer) == null || o.delete().catch(() => {
|
|
@@ -6263,7 +6263,7 @@ class go {
|
|
|
6263
6263
|
let n;
|
|
6264
6264
|
for (let y = 0; ; y++)
|
|
6265
6265
|
try {
|
|
6266
|
-
n = await this.api.add(this.stream, s), (
|
|
6266
|
+
n = await this.api.add(this.stream, s), (f = this.iter) == null || f.notify(Ne.OrderedConsumerRecreated, n.name);
|
|
6267
6267
|
break;
|
|
6268
6268
|
} catch (x) {
|
|
6269
6269
|
if (x.message === "stream not found" && ((p = this.iter) == null || p.notify(Ne.StreamNotFound, y), this.type === xe.Fetch || this.opts.abort_on_missing_resource === !0))
|
|
@@ -6291,11 +6291,11 @@ class go {
|
|
|
6291
6291
|
max_messages: 100,
|
|
6292
6292
|
expires: 3e4
|
|
6293
6293
|
}, t) {
|
|
6294
|
-
var
|
|
6294
|
+
var f, p;
|
|
6295
6295
|
t = t || {};
|
|
6296
6296
|
const s = t.fromFetch || !1, i = t.orderedReset || !1;
|
|
6297
6297
|
if (this.type === xe.Fetch && i) {
|
|
6298
|
-
(
|
|
6298
|
+
(f = this.iter) == null || f.src.stop(), await ((p = this.iter) == null ? void 0 : p.closed()), this.currentConsumer = null;
|
|
6299
6299
|
return;
|
|
6300
6300
|
}
|
|
6301
6301
|
(this.currentConsumer === null || i) && (this.currentConsumer = await this.resetConsumer(this.cursor.stream_seq + 1)), (this.iter === null || s) && (this.iter = new bo()), this.consumer = new Us(this.api, this.currentConsumer);
|
|
@@ -6461,9 +6461,9 @@ class zs extends Ot {
|
|
|
6461
6461
|
function s(i, n) {
|
|
6462
6462
|
var a;
|
|
6463
6463
|
if ((((a = n == null ? void 0 : n.subject_transforms) == null ? void 0 : a.length) || 0) > 0) {
|
|
6464
|
-
const { min:
|
|
6464
|
+
const { min: f, ok: p } = t.features.get(H.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);
|
|
6465
6465
|
if (!p)
|
|
6466
|
-
throw new Error(`${i} 'subject_transforms' requires server ${
|
|
6466
|
+
throw new Error(`${i} 'subject_transforms' requires server ${f}`);
|
|
6467
6467
|
}
|
|
6468
6468
|
}
|
|
6469
6469
|
e.sources && e.sources.forEach((i) => {
|
|
@@ -6482,8 +6482,8 @@ class zs extends Ot {
|
|
|
6482
6482
|
async update(e, t = {}) {
|
|
6483
6483
|
var a;
|
|
6484
6484
|
if (typeof e == "object") {
|
|
6485
|
-
const
|
|
6486
|
-
e =
|
|
6485
|
+
const f = e;
|
|
6486
|
+
e = f.name, t = f, console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m");
|
|
6487
6487
|
}
|
|
6488
6488
|
this.checkStreamConfigVersions(t), le(e);
|
|
6489
6489
|
const s = await this.info(e), i = Object.assign(s.config, t);
|
|
@@ -6494,18 +6494,18 @@ class zs extends Ot {
|
|
|
6494
6494
|
async info(e, t) {
|
|
6495
6495
|
le(e);
|
|
6496
6496
|
const s = `${this.prefix}.STREAM.INFO.${e}`;
|
|
6497
|
-
let n = await this._request(s, t), { total: o, limit: a } = n,
|
|
6498
|
-
if (o && o >
|
|
6497
|
+
let n = await this._request(s, t), { total: o, limit: a } = n, f = n.state.subjects ? Object.getOwnPropertyNames(n.state.subjects).length : 1;
|
|
6498
|
+
if (o && o > f) {
|
|
6499
6499
|
const p = [
|
|
6500
6500
|
n
|
|
6501
6501
|
], g = t || {};
|
|
6502
6502
|
let y = 0;
|
|
6503
|
-
for (; o >
|
|
6503
|
+
for (; o > f; ) {
|
|
6504
6504
|
y++, g.offset = a * y;
|
|
6505
6505
|
const P = await this._request(s, g);
|
|
6506
6506
|
o = P.total, p.push(P);
|
|
6507
6507
|
const I = Object.getOwnPropertyNames(P.state.subjects).length;
|
|
6508
|
-
if (
|
|
6508
|
+
if (f += I, I < a)
|
|
6509
6509
|
break;
|
|
6510
6510
|
}
|
|
6511
6511
|
let x = {};
|
|
@@ -6554,13 +6554,13 @@ class zs extends Ot {
|
|
|
6554
6554
|
}
|
|
6555
6555
|
listKvs() {
|
|
6556
6556
|
const e = (s) => {
|
|
6557
|
-
var
|
|
6557
|
+
var f;
|
|
6558
6558
|
const n = s.streams.filter((p) => p.config.name.startsWith(be));
|
|
6559
6559
|
n.forEach((p) => {
|
|
6560
6560
|
this._fixInfo(p);
|
|
6561
6561
|
});
|
|
6562
6562
|
let o = "";
|
|
6563
|
-
return n.length && (o = ((
|
|
6563
|
+
return n.length && (o = ((f = this.nc.info) == null ? void 0 : f.cluster) ?? ""), n.map((p) => new ei(p, o));
|
|
6564
6564
|
}, t = `${this.prefix}.STREAM.LIST`;
|
|
6565
6565
|
return new _t(t, e, this);
|
|
6566
6566
|
}
|
|
@@ -6593,12 +6593,12 @@ class _o extends Ot {
|
|
|
6593
6593
|
let s = t;
|
|
6594
6594
|
const { last_by_subj: i } = s;
|
|
6595
6595
|
i && (s = null);
|
|
6596
|
-
const n = s ? this.jc.encode(s) : ye, o = this.opts.apiPrefix || "$JS.API", a = i ? `${o}.DIRECT.GET.${e}.${i}` : `${o}.DIRECT.GET.${e}`,
|
|
6596
|
+
const n = s ? this.jc.encode(s) : ye, o = this.opts.apiPrefix || "$JS.API", a = i ? `${o}.DIRECT.GET.${e}.${i}` : `${o}.DIRECT.GET.${e}`, f = await this.nc.request(a, n, {
|
|
6597
6597
|
timeout: this.timeout
|
|
6598
|
-
}), p = st(
|
|
6598
|
+
}), p = st(f);
|
|
6599
6599
|
if (p)
|
|
6600
6600
|
return Promise.reject(p);
|
|
6601
|
-
const g = new Ls(
|
|
6601
|
+
const g = new Ls(f);
|
|
6602
6602
|
return Promise.resolve(g);
|
|
6603
6603
|
}
|
|
6604
6604
|
async getBatch(e, t) {
|
|
@@ -6606,15 +6606,15 @@ class _o extends Ot {
|
|
|
6606
6606
|
const i = `${this.opts.apiPrefix || "$JS.API"}.DIRECT.GET.${e}`;
|
|
6607
6607
|
if (!Array.isArray(t.multi_last) || t.multi_last.length === 0)
|
|
6608
6608
|
return Promise.reject("multi_last is required");
|
|
6609
|
-
const n = JSON.stringify(t, (
|
|
6609
|
+
const n = JSON.stringify(t, (f, p) => f === "up_to_time" && p instanceof Date ? p.toISOString() : p), o = new oe(), a = await this.nc.requestMany(i, n, {
|
|
6610
6610
|
strategy: Ce.SentinelMsg
|
|
6611
6611
|
});
|
|
6612
6612
|
return (async () => {
|
|
6613
6613
|
var y, x, P;
|
|
6614
|
-
let
|
|
6614
|
+
let f = !1, p = !1, g;
|
|
6615
6615
|
for await (const I of a) {
|
|
6616
|
-
if (!
|
|
6617
|
-
|
|
6616
|
+
if (!f) {
|
|
6617
|
+
f = !0;
|
|
6618
6618
|
const T = ((y = I.headers) == null ? void 0 : y.code) || 0;
|
|
6619
6619
|
if (T !== 0 && T < 200 || T > 299) {
|
|
6620
6620
|
g = (x = I.headers) == null ? void 0 : x.description.toLowerCase();
|
|
@@ -6897,10 +6897,10 @@ class St {
|
|
|
6897
6897
|
s = s || {
|
|
6898
6898
|
timeout: i.timeout
|
|
6899
6899
|
}, s.timeout = s.timeout || i.timeout, s.previousRevision = s.previousRevision ?? void 0;
|
|
6900
|
-
const { timeout: n, previousRevision: o } = s, a = this.js.nc.info,
|
|
6900
|
+
const { timeout: n, previousRevision: o } = s, a = this.js.nc.info, f = (a == null ? void 0 : a.max_payload) || 1024;
|
|
6901
6901
|
e = e || {}, e.options = e.options || {};
|
|
6902
6902
|
let p = ((ue = e.options) == null ? void 0 : ue.max_chunk_size) || 128 * 1024;
|
|
6903
|
-
p = p >
|
|
6903
|
+
p = p > f ? f : p, e.options.max_chunk_size = p;
|
|
6904
6904
|
const g = await this.info(e.name), { name: y, error: x } = this._checkNotEmpty(e.name);
|
|
6905
6905
|
if (x)
|
|
6906
6906
|
return Promise.reject(x);
|
|
@@ -6977,8 +6977,8 @@ class St {
|
|
|
6977
6977
|
async function t(n) {
|
|
6978
6978
|
const o = new at(), a = n.getReader();
|
|
6979
6979
|
for (; ; ) {
|
|
6980
|
-
const { done:
|
|
6981
|
-
if (
|
|
6980
|
+
const { done: f, value: p } = await a.read();
|
|
6981
|
+
if (f)
|
|
6982
6982
|
return o.drain();
|
|
6983
6983
|
p && p.length && o.fill(p);
|
|
6984
6984
|
}
|
|
@@ -7016,10 +7016,10 @@ class St {
|
|
|
7016
7016
|
let o;
|
|
7017
7017
|
const a = Be();
|
|
7018
7018
|
a.orderedConsumer();
|
|
7019
|
-
const
|
|
7019
|
+
const f = Sr.create(), p = `$O.${this.name}.C.${t.nuid}`, g = await this.js.subscribe(p, a);
|
|
7020
7020
|
return (async () => {
|
|
7021
7021
|
for await (const y of g)
|
|
7022
|
-
y.data.length > 0 && (
|
|
7022
|
+
y.data.length > 0 && (f.update(y.data), o.enqueue(y.data)), y.info.pending === 0 && (cn(s, f.digest()) ? o.close() : o.error(new Error(`received a corrupt object, digests do not match received: ${t.digest} calculated ${s}`)), g.unsubscribe());
|
|
7023
7023
|
})().then(() => {
|
|
7024
7024
|
i.resolve();
|
|
7025
7025
|
}).catch((y) => {
|
|
@@ -7071,8 +7071,8 @@ class St {
|
|
|
7071
7071
|
}
|
|
7072
7072
|
};
|
|
7073
7073
|
await this.js.publish(this._metaSubject(e), JSON.stringify(a));
|
|
7074
|
-
const
|
|
7075
|
-
return Promise.resolve(
|
|
7074
|
+
const f = await this.info(e);
|
|
7075
|
+
return Promise.resolve(f);
|
|
7076
7076
|
}
|
|
7077
7077
|
async delete(e) {
|
|
7078
7078
|
const t = await this.rawInfo(e);
|
|
@@ -7100,8 +7100,8 @@ class St {
|
|
|
7100
7100
|
if (n)
|
|
7101
7101
|
return Promise.reject(n);
|
|
7102
7102
|
if (e !== t.name) {
|
|
7103
|
-
const
|
|
7104
|
-
if (
|
|
7103
|
+
const f = await this.info(t.name);
|
|
7104
|
+
if (f && !f.deleted)
|
|
7105
7105
|
return Promise.reject(new Error("an object already exists with that name"));
|
|
7106
7106
|
}
|
|
7107
7107
|
t.name = i;
|
|
@@ -7118,14 +7118,14 @@ class St {
|
|
|
7118
7118
|
await this.jsm.streams.getMessage(this.stream, {
|
|
7119
7119
|
last_by_subj: i
|
|
7120
7120
|
});
|
|
7121
|
-
} catch (
|
|
7122
|
-
|
|
7121
|
+
} catch (f) {
|
|
7122
|
+
f.code === "404" ? (s.push(null), t = !0) : s.stop(f);
|
|
7123
7123
|
}
|
|
7124
7124
|
const n = Ee(), o = Be();
|
|
7125
|
-
o.orderedConsumer(), e.includeHistory ? o.deliverLastPerSubject() : (t = !0, o.deliverNew()), o.callback((
|
|
7125
|
+
o.orderedConsumer(), e.includeHistory ? o.deliverLastPerSubject() : (t = !0, o.deliverNew()), o.callback((f, p) => {
|
|
7126
7126
|
var g;
|
|
7127
|
-
if (
|
|
7128
|
-
s.stop(
|
|
7127
|
+
if (f) {
|
|
7128
|
+
s.stop(f);
|
|
7129
7129
|
return;
|
|
7130
7130
|
}
|
|
7131
7131
|
if (p !== null) {
|
|
@@ -7138,8 +7138,8 @@ class St {
|
|
|
7138
7138
|
a.unsubscribe();
|
|
7139
7139
|
}), a.closed.then(() => {
|
|
7140
7140
|
s.stop();
|
|
7141
|
-
}).catch((
|
|
7142
|
-
s.stop(
|
|
7141
|
+
}).catch((f) => {
|
|
7142
|
+
s.stop(f);
|
|
7143
7143
|
}), s;
|
|
7144
7144
|
}
|
|
7145
7145
|
_chunkSubject(e) {
|
|
@@ -7222,15 +7222,15 @@ class Gs extends Ot {
|
|
|
7222
7222
|
i && (i.msgID && n.set(Re.MsgIdHdr, i.msgID), i.expect.lastMsgID && n.set(Re.ExpectedLastMsgIdHdr, i.expect.lastMsgID), i.expect.streamName && n.set(Re.ExpectedStreamHdr, i.expect.streamName), typeof i.expect.lastSequence == "number" && n.set(Re.ExpectedLastSeqHdr, `${i.expect.lastSequence}`), typeof i.expect.lastSubjectSequence == "number" && n.set(Re.ExpectedLastSubjectSequenceHdr, `${i.expect.lastSubjectSequence}`));
|
|
7223
7223
|
const o = i.timeout || this.timeout, a = {};
|
|
7224
7224
|
o && (a.timeout = o), i && (a.headers = n);
|
|
7225
|
-
let { retries:
|
|
7226
|
-
|
|
7225
|
+
let { retries: f, retry_delay: p } = i;
|
|
7226
|
+
f = f || 1, p = p || 250;
|
|
7227
7227
|
let g;
|
|
7228
|
-
for (let x = 0; x <
|
|
7228
|
+
for (let x = 0; x < f; x++)
|
|
7229
7229
|
try {
|
|
7230
7230
|
g = await this.nc.request(t, s, a);
|
|
7231
7231
|
break;
|
|
7232
7232
|
} catch (P) {
|
|
7233
|
-
if (P.code === "503" && x + 1 <
|
|
7233
|
+
if (P.code === "503" && x + 1 < f)
|
|
7234
7234
|
await ct(p);
|
|
7235
7235
|
else
|
|
7236
7236
|
throw P;
|
|
@@ -7251,9 +7251,9 @@ class Gs extends Ot {
|
|
|
7251
7251
|
}, a = await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${s}`, this.jc.encode(o), {
|
|
7252
7252
|
noMux: !0,
|
|
7253
7253
|
timeout: n
|
|
7254
|
-
}),
|
|
7255
|
-
if (
|
|
7256
|
-
throw
|
|
7254
|
+
}), f = st(a);
|
|
7255
|
+
if (f)
|
|
7256
|
+
throw f;
|
|
7257
7257
|
return Pt(a, this.timeout);
|
|
7258
7258
|
}
|
|
7259
7259
|
fetch(t, s, i = {}) {
|
|
@@ -7261,14 +7261,14 @@ class Gs extends Ot {
|
|
|
7261
7261
|
let n = null;
|
|
7262
7262
|
const o = (i.max_bytes ?? 0) > 0;
|
|
7263
7263
|
let a = 0;
|
|
7264
|
-
const
|
|
7264
|
+
const f = o ? i.max_bytes : 0;
|
|
7265
7265
|
let p = null;
|
|
7266
7266
|
const g = {};
|
|
7267
|
-
if (g.batch = i.batch || 1,
|
|
7267
|
+
if (g.batch = i.batch || 1, f) {
|
|
7268
7268
|
const L = this.nc.features.get(H.JS_PULL_MAX_BYTES);
|
|
7269
7269
|
if (!L.ok)
|
|
7270
7270
|
throw new Error(`max_bytes is only supported on servers ${L.min} or better`);
|
|
7271
|
-
g.max_bytes =
|
|
7271
|
+
g.max_bytes = f;
|
|
7272
7272
|
}
|
|
7273
7273
|
g.no_wait = i.no_wait || !1, g.no_wait && g.expires && (g.expires = 0);
|
|
7274
7274
|
const y = i.expires || 0;
|
|
@@ -7282,7 +7282,7 @@ class Gs extends Ot {
|
|
|
7282
7282
|
if (L) {
|
|
7283
7283
|
if (o && (a += L.data.length), T++, n && L.info.pending === 0)
|
|
7284
7284
|
return;
|
|
7285
|
-
(P.getPending() === 1 && L.info.pending === 0 || I === T ||
|
|
7285
|
+
(P.getPending() === 1 && L.info.pending === 0 || I === T || f > 0 && a >= f) && P.stop();
|
|
7286
7286
|
}
|
|
7287
7287
|
};
|
|
7288
7288
|
const J = Me(this.nc.options.inboxPrefix), X = this.nc.subscribe(J, {
|
|
@@ -7319,8 +7319,8 @@ class Gs extends Ot {
|
|
|
7319
7319
|
a.info = i;
|
|
7320
7320
|
try {
|
|
7321
7321
|
await this._maybeCreateConsumer(i);
|
|
7322
|
-
} catch (
|
|
7323
|
-
throw a.unsubscribe(),
|
|
7322
|
+
} catch (f) {
|
|
7323
|
+
throw a.unsubscribe(), f;
|
|
7324
7324
|
}
|
|
7325
7325
|
return a;
|
|
7326
7326
|
}
|
|
@@ -7404,14 +7404,14 @@ class Gs extends Ot {
|
|
|
7404
7404
|
}
|
|
7405
7405
|
static ingestionFn(t) {
|
|
7406
7406
|
return (s, i) => {
|
|
7407
|
-
var
|
|
7407
|
+
var f;
|
|
7408
7408
|
const n = i;
|
|
7409
7409
|
if (!s) return {
|
|
7410
7410
|
ingest: !1,
|
|
7411
7411
|
protocol: !1
|
|
7412
7412
|
};
|
|
7413
7413
|
const o = s;
|
|
7414
|
-
if (st(o.msg) || (
|
|
7414
|
+
if (st(o.msg) || (f = n.monitor) == null || f.work(), Os(o.msg)) {
|
|
7415
7415
|
const p = t ? n._checkHbOrderConsumer(o.msg) : !0;
|
|
7416
7416
|
return t || n.info.flow_control.heartbeat_count++, {
|
|
7417
7417
|
ingest: p,
|
|
@@ -7499,30 +7499,30 @@ class Ks {
|
|
|
7499
7499
|
const i = !this.protocol.options.noAsyncTraces;
|
|
7500
7500
|
try {
|
|
7501
7501
|
this._check(e, !0, !0);
|
|
7502
|
-
} catch (
|
|
7503
|
-
return Promise.reject(
|
|
7502
|
+
} catch (f) {
|
|
7503
|
+
return Promise.reject(f);
|
|
7504
7504
|
}
|
|
7505
7505
|
if (s.strategy = s.strategy || Ce.Timer, s.maxWait = s.maxWait || 1e3, s.maxWait < 1)
|
|
7506
7506
|
return Promise.reject(new N("timeout", O.InvalidOption));
|
|
7507
7507
|
const n = new oe();
|
|
7508
|
-
function o(
|
|
7508
|
+
function o(f) {
|
|
7509
7509
|
n.push(() => {
|
|
7510
|
-
n.stop(
|
|
7510
|
+
n.stop(f);
|
|
7511
7511
|
});
|
|
7512
7512
|
}
|
|
7513
|
-
function a(
|
|
7514
|
-
|
|
7513
|
+
function a(f, p) {
|
|
7514
|
+
f || p === null ? o(f === null ? void 0 : f) : n.push(p);
|
|
7515
7515
|
}
|
|
7516
7516
|
if (s.noMux) {
|
|
7517
|
-
const
|
|
7517
|
+
const f = i ? new Error().stack : null;
|
|
7518
7518
|
let p = typeof s.maxMessages == "number" && s.maxMessages > 0 ? s.maxMessages : -1;
|
|
7519
7519
|
const g = this.subscribe(Me(this.options.inboxPrefix), {
|
|
7520
7520
|
callback: (I, T) => {
|
|
7521
7521
|
var J, X;
|
|
7522
7522
|
if (((J = T == null ? void 0 : T.data) == null ? void 0 : J.length) === 0 && ((X = T == null ? void 0 : T.headers) == null ? void 0 : X.status) === O.NoResponders && (I = N.errorForCode(O.NoResponders)), I) {
|
|
7523
|
-
|
|
7523
|
+
f && (I.stack += `
|
|
7524
7524
|
|
|
7525
|
-
${
|
|
7525
|
+
${f}`), y(I);
|
|
7526
7526
|
return;
|
|
7527
7527
|
}
|
|
7528
7528
|
a(null, T), s.strategy === Ce.Count && (p--, p === 0 && y()), s.strategy === Ce.JitterTimer && (P(), x = setTimeout(() => {
|
|
@@ -7563,13 +7563,13 @@ ${d}`), y(I);
|
|
|
7563
7563
|
x && clearTimeout(x);
|
|
7564
7564
|
};
|
|
7565
7565
|
} else {
|
|
7566
|
-
const
|
|
7567
|
-
|
|
7566
|
+
const f = s;
|
|
7567
|
+
f.callback = a, n.iterClosed.then(() => {
|
|
7568
7568
|
p.cancel();
|
|
7569
7569
|
}).catch((g) => {
|
|
7570
7570
|
p.cancel(g);
|
|
7571
7571
|
});
|
|
7572
|
-
const p = new hn(this.protocol.muxSubscriptions, e,
|
|
7572
|
+
const p = new hn(this.protocol.muxSubscriptions, e, f);
|
|
7573
7573
|
this.protocol.request(p);
|
|
7574
7574
|
try {
|
|
7575
7575
|
this.publish(e, t, {
|
|
@@ -7597,18 +7597,18 @@ ${d}`), y(I);
|
|
|
7597
7597
|
if (!s.noMux && s.reply)
|
|
7598
7598
|
return Promise.reject(new N("reply can only be used with noMux", O.InvalidOption));
|
|
7599
7599
|
if (s.noMux) {
|
|
7600
|
-
const n = s.reply ? s.reply : Me(this.options.inboxPrefix), o = K(), a = i ? new Error() : null,
|
|
7600
|
+
const n = s.reply ? s.reply : Me(this.options.inboxPrefix), o = K(), a = i ? new Error() : null, f = this.subscribe(n, {
|
|
7601
7601
|
max: 1,
|
|
7602
7602
|
timeout: s.timeout,
|
|
7603
7603
|
callback: (p, g) => {
|
|
7604
7604
|
p ? (a && p.code !== O.Timeout && (p.stack += `
|
|
7605
7605
|
|
|
7606
|
-
${a.stack}`),
|
|
7606
|
+
${a.stack}`), f.unsubscribe(), o.reject(p)) : (p = Hr(g), p ? (a && (p.stack += `
|
|
7607
7607
|
|
|
7608
7608
|
${a.stack}`), o.reject(p)) : o.resolve(g));
|
|
7609
7609
|
}
|
|
7610
7610
|
});
|
|
7611
|
-
return
|
|
7611
|
+
return f.requestSubject = e, this.protocol.publish(e, t, {
|
|
7612
7612
|
reply: n,
|
|
7613
7613
|
headers: s.headers
|
|
7614
7614
|
}), o;
|
|
@@ -7817,11 +7817,11 @@ class si extends dn {
|
|
|
7817
7817
|
const a = `${n.api.prefix}.CONSUMER.CREATE.${n.stream}`;
|
|
7818
7818
|
this.js._request(a, o, {
|
|
7819
7819
|
retries: -1
|
|
7820
|
-
}).then((
|
|
7821
|
-
const p =
|
|
7820
|
+
}).then((f) => {
|
|
7821
|
+
const p = f, g = this.sub.info;
|
|
7822
7822
|
g.last = p, this.info.config = p.config, this.info.name = p.name;
|
|
7823
|
-
}).catch((
|
|
7824
|
-
const p = new N(`unable to recreate ordered consumer ${n.stream} at seq ${t}`, O.RequestError,
|
|
7823
|
+
}).catch((f) => {
|
|
7824
|
+
const p = new N(`unable to recreate ordered consumer ${n.stream} at seq ${t}`, O.RequestError, f);
|
|
7825
7825
|
this.sub.callback(p, {});
|
|
7826
7826
|
});
|
|
7827
7827
|
}
|
|
@@ -7838,9 +7838,9 @@ class si extends dn {
|
|
|
7838
7838
|
s && (i.cancelAfter = s);
|
|
7839
7839
|
const n = this.sub, o = (a) => {
|
|
7840
7840
|
var g, y, x, P;
|
|
7841
|
-
const
|
|
7841
|
+
const f = Gi(409, `${Se.IdleHeartbeatMissed}: ${a}`, this.sub.subject);
|
|
7842
7842
|
if (!((g = this.info) == null ? void 0 : g.ordered))
|
|
7843
|
-
this.sub.callback(null,
|
|
7843
|
+
this.sub.callback(null, f);
|
|
7844
7844
|
else {
|
|
7845
7845
|
if (!this.js.nc.protocol.connected)
|
|
7846
7846
|
return !1;
|
|
@@ -7887,13 +7887,13 @@ class Po extends si {
|
|
|
7887
7887
|
}
|
|
7888
7888
|
let a = 0;
|
|
7889
7889
|
e.expires && e.expires > 0 && (a = e.expires, o.expires = G(a));
|
|
7890
|
-
let
|
|
7891
|
-
if (e.idle_heartbeat && e.idle_heartbeat > 0 && (
|
|
7890
|
+
let f = 0;
|
|
7891
|
+
if (e.idle_heartbeat && e.idle_heartbeat > 0 && (f = e.idle_heartbeat, o.idle_heartbeat = G(f)), f && a === 0)
|
|
7892
7892
|
throw new Error("idle_heartbeat requires expires");
|
|
7893
|
-
if (
|
|
7893
|
+
if (f > a)
|
|
7894
7894
|
throw new Error("expires must be greater than idle_heartbeat");
|
|
7895
7895
|
if (this.info) {
|
|
7896
|
-
this.monitor && this.monitor.cancel(), a &&
|
|
7896
|
+
this.monitor && this.monitor.cancel(), a && f && (this.monitor ? this.monitor._change(f, a) : this._setupHbMonitoring(f, a));
|
|
7897
7897
|
const p = this.info.api, g = `${p.prefix}.CONSUMER.MSG.NEXT.${t}.${n}`, y = this.sub.subject;
|
|
7898
7898
|
p.nc.publish(g, p.jc.encode(o), {
|
|
7899
7899
|
reply: y
|
|
@@ -8009,16 +8009,16 @@ class Ro {
|
|
|
8009
8009
|
n.publish(this.msg.reply, Rr, {
|
|
8010
8010
|
reply: `${n.muxSubscriptions.baseInbox}${a.token}`
|
|
8011
8011
|
});
|
|
8012
|
-
} catch (
|
|
8013
|
-
a.cancel(
|
|
8012
|
+
} catch (f) {
|
|
8013
|
+
a.cancel(f);
|
|
8014
8014
|
}
|
|
8015
8015
|
try {
|
|
8016
8016
|
await Promise.race([
|
|
8017
8017
|
a.timer,
|
|
8018
8018
|
a.deferred
|
|
8019
8019
|
]), t.resolve(!0);
|
|
8020
|
-
} catch (
|
|
8021
|
-
a.cancel(
|
|
8020
|
+
} catch (f) {
|
|
8021
|
+
a.cancel(f), t.reject(f);
|
|
8022
8022
|
}
|
|
8023
8023
|
} else
|
|
8024
8024
|
t.resolve(!1);
|
|
@@ -8097,13 +8097,13 @@ class Mo {
|
|
|
8097
8097
|
}
|
|
8098
8098
|
const o = at.concat(...this.yields), a = yn(o);
|
|
8099
8099
|
if (a !== "") {
|
|
8100
|
-
const
|
|
8101
|
-
if (!
|
|
8100
|
+
const f = Kn.exec(a);
|
|
8101
|
+
if (!f) {
|
|
8102
8102
|
t.debug && console.error("!!!", Lt(o)), s.reject(new Error("unexpected response from server"));
|
|
8103
8103
|
return;
|
|
8104
8104
|
}
|
|
8105
8105
|
try {
|
|
8106
|
-
const p = JSON.parse(
|
|
8106
|
+
const p = JSON.parse(f[1]);
|
|
8107
8107
|
zn(p, this.options), this.peeked = !0, this.connected = !0, this.signal.resolve(), s.resolve();
|
|
8108
8108
|
} catch (p) {
|
|
8109
8109
|
s.reject(p);
|
|
@@ -8195,7 +8195,7 @@ function Uo(r, e) {
|
|
|
8195
8195
|
const i = s.protocol.toLowerCase();
|
|
8196
8196
|
i === "ws:" && (e = !1), i === "wss:" && (e = !0), i !== "https:" && i !== "http" && (r = r.replace(/^(.*:\/\/)(.*)/gm, "$2"), s = new URL(`http://${r}`));
|
|
8197
8197
|
let n, o;
|
|
8198
|
-
const a = s.hostname,
|
|
8198
|
+
const a = s.hostname, f = s.pathname, p = s.search || "";
|
|
8199
8199
|
switch (i) {
|
|
8200
8200
|
case "http:":
|
|
8201
8201
|
case "ws:":
|
|
@@ -8211,7 +8211,7 @@ function Uo(r, e) {
|
|
|
8211
8211
|
o = s.port || e === !0 ? "443" : "80", n = e === !0 ? "wss:" : "ws:";
|
|
8212
8212
|
break;
|
|
8213
8213
|
}
|
|
8214
|
-
return `${n}//${a}:${o}${
|
|
8214
|
+
return `${n}//${a}:${o}${f}${p}`;
|
|
8215
8215
|
}
|
|
8216
8216
|
function $o(r = {}) {
|
|
8217
8217
|
return pn({
|
|
@@ -8255,11 +8255,11 @@ class Tr {
|
|
|
8255
8255
|
"[nats] connected.",
|
|
8256
8256
|
this.globalPrefix ? `(prefix: ${this.globalPrefix})` : ""
|
|
8257
8257
|
), (async () => {
|
|
8258
|
-
var
|
|
8258
|
+
var f, p;
|
|
8259
8259
|
for await (const g of this.nc.status())
|
|
8260
8260
|
switch (g.type !== Le.PingTimer && console.log("[nats] connection status:", g.type), g.type) {
|
|
8261
8261
|
case ve.Reconnect:
|
|
8262
|
-
(
|
|
8262
|
+
(f = this.onStatusChange) == null || f.call(this, !0);
|
|
8263
8263
|
break;
|
|
8264
8264
|
case ve.Disconnect:
|
|
8265
8265
|
case ve.Error:
|
|
@@ -8284,23 +8284,24 @@ class Tr {
|
|
|
8284
8284
|
}
|
|
8285
8285
|
}
|
|
8286
8286
|
async call(e, t, s) {
|
|
8287
|
+
var i, n;
|
|
8287
8288
|
if (await this.isConnected, !this.nc)
|
|
8288
8289
|
throw new Error("[nats] not connected");
|
|
8289
8290
|
try {
|
|
8290
|
-
const
|
|
8291
|
-
console.debug("[nats]>>",
|
|
8292
|
-
const
|
|
8293
|
-
|
|
8291
|
+
const o = this.buildSubject(e);
|
|
8292
|
+
console.debug("[nats]>>", o);
|
|
8293
|
+
const a = await this.nc.request(
|
|
8294
|
+
o,
|
|
8294
8295
|
$e.encode(t),
|
|
8295
8296
|
{ timeout: (s == null ? void 0 : s.timeoutInMs) ?? 5e3 }
|
|
8296
|
-
),
|
|
8297
|
-
|
|
8298
|
-
|
|
8299
|
-
if (
|
|
8300
|
-
throw new Error(
|
|
8301
|
-
return
|
|
8302
|
-
} catch (
|
|
8303
|
-
throw console.error("[nats] request failed:",
|
|
8297
|
+
), f = $e.decode(a.data);
|
|
8298
|
+
if (f.error)
|
|
8299
|
+
throw new Error(f.error.message);
|
|
8300
|
+
if ((i = f.payload) != null && i.errorData)
|
|
8301
|
+
throw new Error((n = f.payload) == null ? void 0 : n.errorData.errorMessage);
|
|
8302
|
+
return f.data ?? f.payload;
|
|
8303
|
+
} catch (o) {
|
|
8304
|
+
throw console.error("[nats] request failed:", o), new Error("Api call failed.");
|
|
8304
8305
|
}
|
|
8305
8306
|
}
|
|
8306
8307
|
async on(e, t) {
|
|
@@ -8317,9 +8318,9 @@ class Tr {
|
|
|
8317
8318
|
continue;
|
|
8318
8319
|
}
|
|
8319
8320
|
a[0] === "dev" && a.shift();
|
|
8320
|
-
const
|
|
8321
|
+
const f = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], g = a[a.length - 1], y = $e.decode(o.data);
|
|
8321
8322
|
t(y, {
|
|
8322
|
-
subject:
|
|
8323
|
+
subject: f,
|
|
8323
8324
|
userId: p,
|
|
8324
8325
|
sessionId: g
|
|
8325
8326
|
});
|
|
@@ -8345,10 +8346,10 @@ class Tr {
|
|
|
8345
8346
|
continue;
|
|
8346
8347
|
}
|
|
8347
8348
|
a[0] === "dev" && a.shift();
|
|
8348
|
-
const
|
|
8349
|
+
const f = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], g = a[a.length - 1], y = $e.decode(o.data);
|
|
8349
8350
|
try {
|
|
8350
8351
|
const x = await t(y, {
|
|
8351
|
-
subject:
|
|
8352
|
+
subject: f,
|
|
8352
8353
|
userId: p,
|
|
8353
8354
|
sessionId: g
|
|
8354
8355
|
});
|
|
@@ -8410,22 +8411,22 @@ class Lo {
|
|
|
8410
8411
|
async getAudioBuffer(e, t, s) {
|
|
8411
8412
|
const i = [], n = crypto.randomUUID();
|
|
8412
8413
|
return new Promise((o, a) => {
|
|
8413
|
-
const
|
|
8414
|
+
const f = new WebSocket(
|
|
8414
8415
|
`${Dt.WSS_URL}?trustedclienttoken=${Dt.TRUSTED_CLIENT_TOKEN}&ConnectionId=${n}`
|
|
8415
8416
|
);
|
|
8416
|
-
|
|
8417
|
+
f.binaryType = "arraybuffer";
|
|
8417
8418
|
const p = Fo(e, t, s);
|
|
8418
|
-
|
|
8419
|
+
f.addEventListener("open", () => {
|
|
8419
8420
|
const g = qo();
|
|
8420
|
-
|
|
8421
|
+
f.send(g);
|
|
8421
8422
|
const y = `X-RequestId:${n}\r
|
|
8422
8423
|
Content-Type:application/ssml+xml\r
|
|
8423
8424
|
X-Timestamp:${(/* @__PURE__ */ new Date()).toISOString()}Z\r
|
|
8424
8425
|
Path:ssml\r
|
|
8425
8426
|
\r
|
|
8426
8427
|
` + p;
|
|
8427
|
-
|
|
8428
|
-
}),
|
|
8428
|
+
f.send(y);
|
|
8429
|
+
}), f.addEventListener("message", (g) => {
|
|
8429
8430
|
const y = g.data;
|
|
8430
8431
|
if (y instanceof ArrayBuffer) {
|
|
8431
8432
|
const x = new Uint8Array(y), P = new TextEncoder().encode(`Path:audio\r
|
|
@@ -8434,10 +8435,10 @@ Path:ssml\r
|
|
|
8434
8435
|
const J = x.subarray(I + P.length);
|
|
8435
8436
|
i.push(J);
|
|
8436
8437
|
}
|
|
8437
|
-
new TextDecoder().decode(x).includes("Path:turn.end") &&
|
|
8438
|
+
new TextDecoder().decode(x).includes("Path:turn.end") && f.close();
|
|
8438
8439
|
} else
|
|
8439
|
-
y.includes("Path:turn.end") &&
|
|
8440
|
-
}),
|
|
8440
|
+
y.includes("Path:turn.end") && f.close();
|
|
8441
|
+
}), f.addEventListener("close", () => {
|
|
8441
8442
|
if (!i.length) {
|
|
8442
8443
|
a("No audio data available to save.");
|
|
8443
8444
|
return;
|
|
@@ -8450,7 +8451,7 @@ Path:ssml\r
|
|
|
8450
8451
|
for (const P of i)
|
|
8451
8452
|
y.set(P, x), x += P.length;
|
|
8452
8453
|
o(y.buffer);
|
|
8453
|
-
}),
|
|
8454
|
+
}), f.addEventListener("error", (g) => {
|
|
8454
8455
|
a(g);
|
|
8455
8456
|
});
|
|
8456
8457
|
});
|
|
@@ -8533,10 +8534,10 @@ class Ho {
|
|
|
8533
8534
|
if (y) break;
|
|
8534
8535
|
a.push(x);
|
|
8535
8536
|
}
|
|
8536
|
-
const
|
|
8537
|
+
const f = a.reduce(
|
|
8537
8538
|
(y, x) => y + x.length,
|
|
8538
8539
|
0
|
|
8539
|
-
), p = new Uint8Array(
|
|
8540
|
+
), p = new Uint8Array(f);
|
|
8540
8541
|
let g = 0;
|
|
8541
8542
|
for (const y of a)
|
|
8542
8543
|
p.set(y, g), g += y.length;
|
|
@@ -8566,10 +8567,14 @@ const oi = {
|
|
|
8566
8567
|
storage: new ii()
|
|
8567
8568
|
}, Mr = new Fr(oi), Jo = {
|
|
8568
8569
|
setup(r) {
|
|
8569
|
-
(r.authUrl || r.storage)
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
8570
|
+
if (r.authUrl || r.storage) {
|
|
8571
|
+
const e = this.auth.onUserDataUpdate;
|
|
8572
|
+
this.auth = new Fr({
|
|
8573
|
+
authUrl: r.authUrl ?? this.auth.url,
|
|
8574
|
+
storage: r.storage ?? this.storage
|
|
8575
|
+
}), this.auth.onUserDataUpdate = e;
|
|
8576
|
+
}
|
|
8577
|
+
(r.natsUrl || r.storage) && (this.nats = new Tr({
|
|
8573
8578
|
natsUrl: r.natsUrl ?? this.nats.url,
|
|
8574
8579
|
auth: this.auth
|
|
8575
8580
|
}));
|