@jokio/sdk 0.4.1 → 0.5.0

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.
@@ -166,7 +166,7 @@ function Yr(r) {
166
166
  return r;
167
167
  }
168
168
  async function Bi(r) {
169
- var I;
169
+ var O;
170
170
  !r.optionsJSON && r.challenge && (console.warn("startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."), r = { optionsJSON: r });
171
171
  const { optionsJSON: e, useAutoRegister: t = !1 } = r;
172
172
  if (!Ys())
@@ -178,48 +178,48 @@ async function Bi(r) {
178
178
  ...e.user,
179
179
  id: Zt(e.user.id)
180
180
  },
181
- excludeCredentials: (I = e.excludeCredentials) == null ? void 0 : I.map(Gr)
181
+ excludeCredentials: (O = e.excludeCredentials) == null ? void 0 : O.map(Gr)
182
182
  }, i = {};
183
183
  t && (i.mediation = "conditional"), i.publicKey = s, i.signal = Wr.createNewAbortSignal();
184
184
  let n;
185
185
  try {
186
186
  n = await navigator.credentials.create(i);
187
- } catch (N) {
188
- throw Li({ error: N, options: i });
187
+ } catch (j) {
188
+ throw Li({ error: j, options: i });
189
189
  }
190
190
  if (!n)
191
191
  throw new Error("Registration was not completed");
192
- const { id: o, rawId: a, response: f, type: p } = n;
192
+ const { id: o, rawId: a, response: d, type: p } = n;
193
193
  let g;
194
- typeof f.getTransports == "function" && (g = f.getTransports());
194
+ typeof d.getTransports == "function" && (g = d.getTransports());
195
195
  let y;
196
- if (typeof f.getPublicKeyAlgorithm == "function")
196
+ if (typeof d.getPublicKeyAlgorithm == "function")
197
197
  try {
198
- y = f.getPublicKeyAlgorithm();
199
- } catch (N) {
200
- Es("getPublicKeyAlgorithm()", N);
198
+ y = d.getPublicKeyAlgorithm();
199
+ } catch (j) {
200
+ Es("getPublicKeyAlgorithm()", j);
201
201
  }
202
202
  let x;
203
- if (typeof f.getPublicKey == "function")
203
+ if (typeof d.getPublicKey == "function")
204
204
  try {
205
- const N = f.getPublicKey();
206
- N !== null && (x = Me(N));
207
- } catch (N) {
208
- Es("getPublicKey()", N);
205
+ const j = d.getPublicKey();
206
+ j !== null && (x = Me(j));
207
+ } catch (j) {
208
+ Es("getPublicKey()", j);
209
209
  }
210
210
  let A;
211
- if (typeof f.getAuthenticatorData == "function")
211
+ if (typeof d.getAuthenticatorData == "function")
212
212
  try {
213
- A = Me(f.getAuthenticatorData());
214
- } catch (N) {
215
- Es("getAuthenticatorData()", N);
213
+ A = Me(d.getAuthenticatorData());
214
+ } catch (j) {
215
+ Es("getAuthenticatorData()", j);
216
216
  }
217
217
  return {
218
218
  id: o,
219
219
  rawId: Me(a),
220
220
  response: {
221
- attestationObject: Me(f.attestationObject),
222
- clientDataJSON: Me(f.clientDataJSON),
221
+ attestationObject: Me(d.attestationObject),
222
+ clientDataJSON: Me(d.clientDataJSON),
223
223
  transports: g,
224
224
  publicKeyAlgorithm: y,
225
225
  publicKey: x,
@@ -285,13 +285,13 @@ function Hi({ error: r, options: e }) {
285
285
  return r;
286
286
  }
287
287
  async function Ji(r) {
288
- var A, I;
288
+ var A, O;
289
289
  !r.optionsJSON && r.challenge && (console.warn("startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."), r = { optionsJSON: r });
290
290
  const { optionsJSON: e, useBrowserAutofill: t = !1, verifyBrowserAutofillInput: s = !0 } = r;
291
291
  if (!Ys())
292
292
  throw new Error("WebAuthn is not supported in this browser");
293
293
  let i;
294
- ((A = e.allowCredentials) == null ? void 0 : A.length) !== 0 && (i = (I = e.allowCredentials) == null ? void 0 : I.map(Gr));
294
+ ((A = e.allowCredentials) == null ? void 0 : A.length) !== 0 && (i = (O = e.allowCredentials) == null ? void 0 : O.map(Gr));
295
295
  const n = {
296
296
  ...e,
297
297
  challenge: Zt(e.challenge),
@@ -308,15 +308,15 @@ async function Ji(r) {
308
308
  let a;
309
309
  try {
310
310
  a = await navigator.credentials.get(o);
311
- } catch (N) {
312
- throw Hi({ error: N, options: o });
311
+ } catch (j) {
312
+ throw Hi({ error: j, options: o });
313
313
  }
314
314
  if (!a)
315
315
  throw new Error("Authentication was not completed");
316
- const { id: f, rawId: p, response: g, type: y } = a;
316
+ const { id: d, rawId: p, response: g, type: y } = a;
317
317
  let x;
318
318
  return g.userHandle && (x = Me(g.userHandle)), {
319
- id: f,
319
+ id: d,
320
320
  rawId: Me(p),
321
321
  response: {
322
322
  authenticatorData: Me(g.authenticatorData),
@@ -329,34 +329,15 @@ async function Ji(r) {
329
329
  authenticatorAttachment: Yr(a.authenticatorAttachment)
330
330
  };
331
331
  }
332
- const wt = "ACCESS_TOKEN", _r = "SESSION_SEED", Ze = "LAST_AUTH_DATA";
332
+ const yt = "ACCESS_TOKEN", _r = "SESSION_SEED", wt = "LAST_AUTH_DATA";
333
333
  class Xr {
334
334
  constructor(e) {
335
335
  h(this, "onUserDataUpdate");
336
- h(this, "isAuthenticated");
337
- h(this, "isAuthenticatedResolver", () => {
338
- });
339
- this.options = e, this.isAuthenticated = new Promise(
340
- (t) => this.isAuthenticatedResolver = t
341
- );
336
+ this.options = e;
342
337
  }
343
338
  get url() {
344
339
  return this.options.authUrl;
345
340
  }
346
- async init() {
347
- var t, s;
348
- const e = localStorage.getItem(Ze);
349
- if (e)
350
- try {
351
- const i = JSON.parse(e);
352
- (t = this.onUserDataUpdate) == null || t.call(this, i), this.isAuthenticatedResolver();
353
- } catch {
354
- }
355
- else {
356
- const i = await this.me();
357
- await this.options.storage.setItem(Ze, i), (s = this.onUserDataUpdate) == null || s.call(this, i), this.isAuthenticatedResolver();
358
- }
359
- }
360
341
  async me() {
361
342
  return await fetch(this.options.authUrl + "/me", {
362
343
  headers: await this.getAuthHeader()
@@ -379,12 +360,12 @@ class Xr {
379
360
  }
380
361
  ).then(xt);
381
362
  return await this.options.storage.setItem(
382
- wt,
363
+ yt,
383
364
  s.accessToken
384
- ), await this.options.storage.setItem(Ze, s.jwtData), (i = this.onUserDataUpdate) == null || i.call(this, s.jwtData), s.jwtData;
365
+ ), await this.options.storage.setItem(wt, s.jwtData), (i = this.onUserDataUpdate) == null || i.call(this, s.jwtData), s.jwtData;
385
366
  }
386
367
  async requestPasskeyLogin(e = {}) {
387
- var f, p;
368
+ var d, p;
388
369
  const {
389
370
  displayName: t = "",
390
371
  isRegistration: s = !1,
@@ -397,7 +378,7 @@ class Xr {
397
378
  ).then(xt);
398
379
  let o;
399
380
  try {
400
- (f = n.user) != null && f.id ? o = await Bi({
381
+ (d = n.user) != null && d.id ? o = await Bi({
401
382
  optionsJSON: n
402
383
  }) : o = await Ji({
403
384
  optionsJSON: n
@@ -419,9 +400,9 @@ class Xr {
419
400
  }
420
401
  ).then(xt);
421
402
  return await this.options.storage.setItem(
422
- wt,
403
+ yt,
423
404
  a.accessToken
424
- ), await this.options.storage.setItem(Ze, a.jwtData), (p = this.onUserDataUpdate) == null || p.call(this, a.jwtData), a.jwtData;
405
+ ), await this.options.storage.setItem(wt, a.jwtData), (p = this.onUserDataUpdate) == null || p.call(this, a.jwtData), a.jwtData;
425
406
  }
426
407
  async guestLogin() {
427
408
  var t;
@@ -429,24 +410,24 @@ class Xr {
429
410
  this.options.authUrl + "/guest-session"
430
411
  ).then(xt);
431
412
  return await this.options.storage.setItem(
432
- wt,
413
+ yt,
433
414
  e.accessToken
434
415
  ), await this.options.storage.setItem(
435
416
  _r,
436
417
  e.sessionSeed
437
- ), await this.options.storage.setItem(Ze, e.jwtData), (t = this.onUserDataUpdate) == null || t.call(this, e.jwtData), e.jwtData;
418
+ ), await this.options.storage.setItem(wt, e.jwtData), (t = this.onUserDataUpdate) == null || t.call(this, e.jwtData), e.jwtData;
438
419
  }
439
420
  signOut() {
440
421
  var e;
441
- this.options.storage.removeItem(wt), this.options.storage.removeItem(Ze), (e = this.onUserDataUpdate) == null || e.call(this, null);
422
+ this.options.storage.removeItem(yt), this.options.storage.removeItem(wt), (e = this.onUserDataUpdate) == null || e.call(this, null);
442
423
  }
443
424
  getLastLoginData() {
444
425
  return this.options.storage.getItem(
445
- Ze
426
+ wt
446
427
  );
447
428
  }
448
429
  getAccessToken() {
449
- return this.options.storage.getItem(wt);
430
+ return this.options.storage.getItem(yt);
450
431
  }
451
432
  getSessionSeed() {
452
433
  return this.options.storage.getItem(_r);
@@ -538,7 +519,7 @@ function Wi(...r) {
538
519
  t.set(r[i], s), s += r[i].length;
539
520
  return t;
540
521
  }
541
- function Pt(...r) {
522
+ function kt(...r) {
542
523
  const e = [];
543
524
  for (let t = 0; t < r.length; t++)
544
525
  e.push(We.encode(r[t]));
@@ -661,10 +642,10 @@ var Ne;
661
642
  (function(r) {
662
643
  r.Timer = "timer", r.Count = "count", r.JitterTimer = "jitterTimer", r.SentinelMsg = "sentinelMsg";
663
644
  })(Ne || (Ne = {}));
664
- var kt;
645
+ var Ot;
665
646
  (function(r) {
666
647
  r.STATS = "io.nats.micro.v1.stats_response", r.INFO = "io.nats.micro.v1.info_response", r.PING = "io.nats.micro.v1.ping_response";
667
- })(kt || (kt = {}));
648
+ })(Ot || (Ot = {}));
668
649
  const Qt = "Nats-Service-Error", es = "Nats-Service-Error-Code";
669
650
  class ts extends Error {
670
651
  constructor(t, s) {
@@ -707,10 +688,10 @@ function cs(r, ...e) {
707
688
  }
708
689
  return r;
709
690
  }
710
- function Kt(r) {
691
+ function zt(r) {
711
692
  return xe.decode(r).replace(/\n/g, "␊").replace(/\r/g, "␍");
712
693
  }
713
- function lt(r, e = !0) {
694
+ function ut(r, e = !0) {
714
695
  const t = e ? T.errorForCode(k.Timeout) : null;
715
696
  let s, i;
716
697
  const n = new Promise((o, a) => {
@@ -724,7 +705,7 @@ function lt(r, e = !0) {
724
705
  });
725
706
  return Object.assign(n, s);
726
707
  }
727
- function pt(r = 0) {
708
+ function dt(r = 0) {
728
709
  let e;
729
710
  const t = new Promise((s) => {
730
711
  const i = setTimeout(() => {
@@ -856,8 +837,8 @@ class Ke {
856
837
  if (o) {
857
838
  const a = o.indexOf(":");
858
839
  if (a > -1) {
859
- const f = o.slice(0, a), p = o.slice(a + 1).trim();
860
- t.append(f, p);
840
+ const d = o.slice(0, a), p = o.slice(a + 1).trim();
841
+ t.append(d, p);
861
842
  }
862
843
  }
863
844
  }), t;
@@ -1056,7 +1037,7 @@ class Qs {
1056
1037
  }
1057
1038
  }
1058
1039
  h(Qs, "jc");
1059
- function at(r) {
1040
+ function ot(r) {
1060
1041
  return hs("durable", r);
1061
1042
  }
1062
1043
  function pe(r) {
@@ -1094,7 +1075,7 @@ function hs(r, e = "") {
1094
1075
  }
1095
1076
  }), "";
1096
1077
  }
1097
- function Et(r, e = "") {
1078
+ function At(r, e = "") {
1098
1079
  if (e === "")
1099
1080
  throw Error(`${r} name required`);
1100
1081
  const t = nn(e);
@@ -1130,7 +1111,7 @@ function on(r, e, t) {
1130
1111
  }, n = new Qs(i, ve, {});
1131
1112
  return n._headers = s, n._subject = t, n;
1132
1113
  }
1133
- function ct(r) {
1114
+ function at(r) {
1134
1115
  if (r.data.length !== 0)
1135
1116
  return null;
1136
1117
  const e = r.headers;
@@ -1304,10 +1285,10 @@ var qs;
1304
1285
  (function(r) {
1305
1286
  r.Limits = "limits", r.Interest = "interest", r.Workqueue = "workqueue";
1306
1287
  })(qs || (qs = {}));
1307
- var It;
1288
+ var jt;
1308
1289
  (function(r) {
1309
1290
  r.Old = "old", r.New = "new";
1310
- })(It || (It = {}));
1291
+ })(jt || (jt = {}));
1311
1292
  var Fs;
1312
1293
  (function(r) {
1313
1294
  r.File = "file", r.Memory = "memory";
@@ -1320,10 +1301,10 @@ var ce;
1320
1301
  (function(r) {
1321
1302
  r.None = "none", r.All = "all", r.Explicit = "explicit", r.NotSet = "";
1322
1303
  })(ce || (ce = {}));
1323
- var ft;
1304
+ var lt;
1324
1305
  (function(r) {
1325
1306
  r.Instant = "instant", r.Original = "original";
1326
- })(ft || (ft = {}));
1307
+ })(lt || (lt = {}));
1327
1308
  var Ve;
1328
1309
  (function(r) {
1329
1310
  r.None = "none", r.S2 = "s2";
@@ -1338,7 +1319,7 @@ function cn(r, e = {}) {
1338
1319
  deliver_policy: se.All,
1339
1320
  ack_policy: ce.Explicit,
1340
1321
  ack_wait: W(30 * 1e3),
1341
- replay_policy: ft.Instant
1322
+ replay_policy: lt.Instant
1342
1323
  }, e);
1343
1324
  }
1344
1325
  var kr;
@@ -1353,10 +1334,10 @@ var Re;
1353
1334
  (function(r) {
1354
1335
  r.LastValue = "", r.AllHistory = "history", r.UpdatesOnly = "updates";
1355
1336
  })(Re || (Re = {}));
1356
- var nt;
1337
+ var it;
1357
1338
  (function(r) {
1358
1339
  r.Stream = "Nats-Stream", r.Sequence = "Nats-Sequence", r.TimeStamp = "Nats-Time-Stamp", r.Subject = "Nats-Subject";
1359
- })(nt || (nt = {}));
1340
+ })(it || (it = {}));
1360
1341
  var Or;
1361
1342
  (function(r) {
1362
1343
  r.Stream = "Nats-Stream", r.Subject = "Nats-Subject", r.Sequence = "Nats-Sequence", r.LastSequence = "Nats-Last-Sequence", r.Size = "Nats-Msg-Size";
@@ -1399,7 +1380,7 @@ class hn {
1399
1380
  return this.config.deliver_subject = e, this;
1400
1381
  }
1401
1382
  durable(e) {
1402
- return at(e), this.config.durable_name = e, this;
1383
+ return ot(e), this.config.durable_name = e, this;
1403
1384
  }
1404
1385
  startSequence(e) {
1405
1386
  if (e <= 0)
@@ -1446,10 +1427,10 @@ class hn {
1446
1427
  return this.filters = this.filters || [], this.filters.push(e), this;
1447
1428
  }
1448
1429
  replayInstantly() {
1449
- return this.config.replay_policy = ft.Instant, this;
1430
+ return this.config.replay_policy = lt.Instant, this;
1450
1431
  }
1451
1432
  replayOriginal() {
1452
- return this.config.replay_policy = ft.Original, this;
1433
+ return this.config.replay_policy = lt.Original, this;
1453
1434
  }
1454
1435
  sample(e) {
1455
1436
  if (e = Math.trunc(e), e < 0 || e > 100)
@@ -1532,12 +1513,12 @@ class un {
1532
1513
  return t ? Uint8Array.from(s, (i) => i.charCodeAt(0)) : s;
1533
1514
  }
1534
1515
  }
1535
- class ht {
1516
+ class ct {
1536
1517
  static encode(e) {
1537
- return ht.toB64URLEncoding(un.encode(e));
1518
+ return ct.toB64URLEncoding(un.encode(e));
1538
1519
  }
1539
1520
  static decode(e, t = !1) {
1540
- return ht.decode(ht.fromB64URLEncoding(e), t);
1521
+ return ct.decode(ct.fromB64URLEncoding(e), t);
1541
1522
  }
1542
1523
  static toB64URLEncoding(e) {
1543
1524
  return e.replace(/\+/g, "-").replace(/\//g, "_");
@@ -1546,7 +1527,7 @@ class ht {
1546
1527
  return e.replace(/_/g, "/").replace(/-/g, "+");
1547
1528
  }
1548
1529
  }
1549
- class dt {
1530
+ class ft {
1550
1531
  constructor() {
1551
1532
  h(this, "buffers");
1552
1533
  h(this, "byteLength");
@@ -1664,7 +1645,7 @@ Os = us, function() {
1664
1645
  t.JS_SHA256_NO_WINDOW && (e = !1);
1665
1646
  var s = !e && typeof self == "object", i = !t.JS_SHA256_NO_NODE_JS && Ir.versions && Ir.versions.node;
1666
1647
  i ? t = dn : s && (t = self);
1667
- var n = !t.JS_SHA256_NO_COMMON_JS && Os.exports, o = !t.JS_SHA256_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", a = "0123456789abcdef".split(""), f = [
1648
+ var n = !t.JS_SHA256_NO_COMMON_JS && Os.exports, o = !t.JS_SHA256_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", a = "0123456789abcdef".split(""), d = [
1668
1649
  -2147483648,
1669
1650
  8388608,
1670
1651
  32768,
@@ -1750,50 +1731,50 @@ Os = us, function() {
1750
1731
  }), !o || !t.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW && ArrayBuffer.isView || (ArrayBuffer.isView = function(w) {
1751
1732
  return typeof w == "object" && w.buffer && w.buffer.constructor === ArrayBuffer;
1752
1733
  });
1753
- var A = function(w, j) {
1734
+ var A = function(w, R) {
1754
1735
  return function(F) {
1755
- return new L(j, !0).update(F)[w]();
1736
+ return new L(R, !0).update(F)[w]();
1756
1737
  };
1757
- }, I = function(w) {
1758
- var j = A("hex", w);
1759
- i && (j = N(j, w)), j.create = function() {
1738
+ }, O = function(w) {
1739
+ var R = A("hex", w);
1740
+ i && (R = j(R, w)), R.create = function() {
1760
1741
  return new L(w);
1761
- }, j.update = function(P) {
1762
- return j.create().update(P);
1742
+ }, R.update = function(P) {
1743
+ return R.create().update(P);
1763
1744
  };
1764
1745
  for (var F = 0; F < y.length; ++F) {
1765
- var R = y[F];
1766
- j[R] = A(R, w);
1746
+ var N = y[F];
1747
+ R[N] = A(N, w);
1767
1748
  }
1768
- return j;
1769
- }, N = function(w, j) {
1770
- var F, R = Rr, P = Rr.Buffer, U = j ? "sha224" : "sha256";
1749
+ return R;
1750
+ }, j = function(w, R) {
1751
+ var F, N = Rr, P = Rr.Buffer, U = R ? "sha224" : "sha256";
1771
1752
  return F = P.from && !t.JS_SHA256_NO_BUFFER_FROM ? P.from : function(q) {
1772
1753
  return new P(q);
1773
1754
  }, function(q) {
1774
- if (typeof q == "string") return R.createHash(U).update(q, "utf8").digest("hex");
1755
+ if (typeof q == "string") return N.createHash(U).update(q, "utf8").digest("hex");
1775
1756
  if (q == null) throw new Error(r);
1776
- return q.constructor === ArrayBuffer && (q = new Uint8Array(q)), Array.isArray(q) || ArrayBuffer.isView(q) || q.constructor === P ? R.createHash(U).update(F(q)).digest("hex") : w(q);
1757
+ return q.constructor === ArrayBuffer && (q = new Uint8Array(q)), Array.isArray(q) || ArrayBuffer.isView(q) || q.constructor === P ? N.createHash(U).update(F(q)).digest("hex") : w(q);
1777
1758
  };
1778
- }, J = function(w, j) {
1779
- return function(F, R) {
1780
- return new Q(F, j, !0).update(R)[w]();
1759
+ }, B = function(w, R) {
1760
+ return function(F, N) {
1761
+ return new ee(F, R, !0).update(N)[w]();
1781
1762
  };
1782
- }, ee = function(w) {
1783
- var j = J("hex", w);
1784
- j.create = function(P) {
1785
- return new Q(P, w);
1786
- }, j.update = function(P, U) {
1787
- return j.create(P).update(U);
1763
+ }, Q = function(w) {
1764
+ var R = B("hex", w);
1765
+ R.create = function(P) {
1766
+ return new ee(P, w);
1767
+ }, R.update = function(P, U) {
1768
+ return R.create(P).update(U);
1788
1769
  };
1789
1770
  for (var F = 0; F < y.length; ++F) {
1790
- var R = y[F];
1791
- j[R] = J(R, w);
1771
+ var N = y[F];
1772
+ R[N] = B(N, w);
1792
1773
  }
1793
- return j;
1774
+ return R;
1794
1775
  };
1795
- function L(w, j) {
1796
- j ? (x[0] = x[16] = x[1] = x[2] = x[3] = x[4] = x[5] = x[6] = x[7] = x[8] = x[9] = x[10] = x[11] = x[12] = x[13] = x[14] = x[15] = 0, this.blocks = x) : this.blocks = [
1776
+ function L(w, R) {
1777
+ R ? (x[0] = x[16] = x[1] = x[2] = x[3] = x[4] = x[5] = x[6] = x[7] = x[8] = x[9] = x[10] = x[11] = x[12] = x[13] = x[14] = x[15] = 0, this.blocks = x) : this.blocks = [
1797
1778
  0,
1798
1779
  0,
1799
1780
  0,
@@ -1813,11 +1794,11 @@ Os = us, function() {
1813
1794
  0
1814
1795
  ], w ? (this.h0 = 3238371032, this.h1 = 914150663, this.h2 = 812702999, this.h3 = 4144912697, this.h4 = 4290775857, this.h5 = 1750603025, this.h6 = 1694076839, this.h7 = 3204075428) : (this.h0 = 1779033703, this.h1 = 3144134277, this.h2 = 1013904242, this.h3 = 2773480762, this.h4 = 1359893119, this.h5 = 2600822924, this.h6 = 528734635, this.h7 = 1541459225), this.block = this.start = this.bytes = this.hBytes = 0, this.finalized = this.hashed = !1, this.first = !0, this.is224 = w;
1815
1796
  }
1816
- function Q(w, j, F) {
1817
- var R, P = typeof w;
1797
+ function ee(w, R, F) {
1798
+ var N, P = typeof w;
1818
1799
  if (P === "string") {
1819
1800
  var U, q = [], $ = w.length, V = 0;
1820
- for (R = 0; R < $; ++R) (U = w.charCodeAt(R)) < 128 ? q[V++] = U : U < 2048 ? (q[V++] = 192 | U >>> 6, q[V++] = 128 | 63 & U) : U < 55296 || U >= 57344 ? (q[V++] = 224 | U >>> 12, q[V++] = 128 | U >>> 6 & 63, q[V++] = 128 | 63 & U) : (U = 65536 + ((1023 & U) << 10 | 1023 & w.charCodeAt(++R)), q[V++] = 240 | U >>> 18, q[V++] = 128 | U >>> 12 & 63, q[V++] = 128 | U >>> 6 & 63, q[V++] = 128 | 63 & U);
1801
+ for (N = 0; N < $; ++N) (U = w.charCodeAt(N)) < 128 ? q[V++] = U : U < 2048 ? (q[V++] = 192 | U >>> 6, q[V++] = 128 | 63 & U) : U < 55296 || U >= 57344 ? (q[V++] = 224 | U >>> 12, q[V++] = 128 | U >>> 6 & 63, q[V++] = 128 | 63 & U) : (U = 65536 + ((1023 & U) << 10 | 1023 & w.charCodeAt(++N)), q[V++] = 240 | U >>> 18, q[V++] = 128 | U >>> 12 & 63, q[V++] = 128 | U >>> 6 & 63, q[V++] = 128 | 63 & U);
1821
1802
  w = q;
1822
1803
  } else {
1823
1804
  if (P !== "object") throw new Error(r);
@@ -1825,27 +1806,27 @@ Os = us, function() {
1825
1806
  if (o && w.constructor === ArrayBuffer) w = new Uint8Array(w);
1826
1807
  else if (!(Array.isArray(w) || o && ArrayBuffer.isView(w))) throw new Error(r);
1827
1808
  }
1828
- w.length > 64 && (w = new L(j, !0).update(w).array());
1809
+ w.length > 64 && (w = new L(R, !0).update(w).array());
1829
1810
  var re = [], ne = [];
1830
- for (R = 0; R < 64; ++R) {
1831
- var ie = w[R] || 0;
1832
- re[R] = 92 ^ ie, ne[R] = 54 ^ ie;
1811
+ for (N = 0; N < 64; ++N) {
1812
+ var ie = w[N] || 0;
1813
+ re[N] = 92 ^ ie, ne[N] = 54 ^ ie;
1833
1814
  }
1834
- L.call(this, j, F), this.update(ne), this.oKeyPad = re, this.inner = !0, this.sharedMemory = F;
1815
+ L.call(this, R, F), this.update(ne), this.oKeyPad = re, this.inner = !0, this.sharedMemory = F;
1835
1816
  }
1836
1817
  L.prototype.update = function(w) {
1837
1818
  if (!this.finalized) {
1838
- var j, F = typeof w;
1819
+ var R, F = typeof w;
1839
1820
  if (F !== "string") {
1840
1821
  if (F !== "object") throw new Error(r);
1841
1822
  if (w === null) throw new Error(r);
1842
1823
  if (o && w.constructor === ArrayBuffer) w = new Uint8Array(w);
1843
1824
  else if (!(Array.isArray(w) || o && ArrayBuffer.isView(w))) throw new Error(r);
1844
- j = !0;
1825
+ R = !0;
1845
1826
  }
1846
- for (var R, P, U = 0, q = w.length, $ = this.blocks; U < q; ) {
1847
- if (this.hashed && (this.hashed = !1, $[0] = this.block, this.block = $[16] = $[1] = $[2] = $[3] = $[4] = $[5] = $[6] = $[7] = $[8] = $[9] = $[10] = $[11] = $[12] = $[13] = $[14] = $[15] = 0), j) for (P = this.start; U < q && P < 64; ++U) $[P >>> 2] |= w[U] << p[3 & P++];
1848
- else for (P = this.start; U < q && P < 64; ++U) (R = w.charCodeAt(U)) < 128 ? $[P >>> 2] |= R << p[3 & P++] : R < 2048 ? ($[P >>> 2] |= (192 | R >>> 6) << p[3 & P++], $[P >>> 2] |= (128 | 63 & R) << p[3 & P++]) : R < 55296 || R >= 57344 ? ($[P >>> 2] |= (224 | R >>> 12) << p[3 & P++], $[P >>> 2] |= (128 | R >>> 6 & 63) << p[3 & P++], $[P >>> 2] |= (128 | 63 & R) << p[3 & P++]) : (R = 65536 + ((1023 & R) << 10 | 1023 & w.charCodeAt(++U)), $[P >>> 2] |= (240 | R >>> 18) << p[3 & P++], $[P >>> 2] |= (128 | R >>> 12 & 63) << p[3 & P++], $[P >>> 2] |= (128 | R >>> 6 & 63) << p[3 & P++], $[P >>> 2] |= (128 | 63 & R) << p[3 & P++]);
1827
+ for (var N, P, U = 0, q = w.length, $ = this.blocks; U < q; ) {
1828
+ if (this.hashed && (this.hashed = !1, $[0] = this.block, this.block = $[16] = $[1] = $[2] = $[3] = $[4] = $[5] = $[6] = $[7] = $[8] = $[9] = $[10] = $[11] = $[12] = $[13] = $[14] = $[15] = 0), R) for (P = this.start; U < q && P < 64; ++U) $[P >>> 2] |= w[U] << p[3 & P++];
1829
+ else for (P = this.start; U < q && P < 64; ++U) (N = w.charCodeAt(U)) < 128 ? $[P >>> 2] |= N << p[3 & P++] : N < 2048 ? ($[P >>> 2] |= (192 | N >>> 6) << p[3 & P++], $[P >>> 2] |= (128 | 63 & N) << p[3 & P++]) : N < 55296 || N >= 57344 ? ($[P >>> 2] |= (224 | N >>> 12) << p[3 & P++], $[P >>> 2] |= (128 | N >>> 6 & 63) << p[3 & P++], $[P >>> 2] |= (128 | 63 & N) << p[3 & P++]) : (N = 65536 + ((1023 & N) << 10 | 1023 & w.charCodeAt(++U)), $[P >>> 2] |= (240 | N >>> 18) << p[3 & P++], $[P >>> 2] |= (128 | N >>> 12 & 63) << p[3 & P++], $[P >>> 2] |= (128 | N >>> 6 & 63) << p[3 & P++], $[P >>> 2] |= (128 | 63 & N) << p[3 & P++]);
1849
1830
  this.lastByteIndex = P, this.bytes += P - this.start, P >= 64 ? (this.block = $[16], this.start = P - 64, this.hash(), this.hashed = !0) : this.start = P;
1850
1831
  }
1851
1832
  return this.bytes > 4294967295 && (this.hBytes += this.bytes / 4294967296 | 0, this.bytes = this.bytes % 4294967296), this;
@@ -1853,37 +1834,37 @@ Os = us, function() {
1853
1834
  }, L.prototype.finalize = function() {
1854
1835
  if (!this.finalized) {
1855
1836
  this.finalized = !0;
1856
- var w = this.blocks, j = this.lastByteIndex;
1857
- 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();
1837
+ var w = this.blocks, R = this.lastByteIndex;
1838
+ w[16] = this.block, w[R >>> 2] |= d[3 & R], this.block = w[16], R >= 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();
1858
1839
  }
1859
1840
  }, L.prototype.hash = function() {
1860
- var w, j, F, R, P, U, q, $, V, re = this.h0, ne = this.h1, ie = this.h2, oe = this.h3, ue = this.h4, le = this.h5, X = this.h6, te = this.h7, ae = this.blocks;
1861
- for (w = 16; w < 64; ++w) j = ((P = ae[w - 15]) >>> 7 | P << 25) ^ (P >>> 18 | P << 14) ^ P >>> 3, F = ((P = ae[w - 2]) >>> 17 | P << 15) ^ (P >>> 19 | P << 13) ^ P >>> 10, ae[w] = ae[w - 16] + j + ae[w - 7] + F | 0;
1862
- for (V = ne & ie, w = 0; w < 64; w += 4) this.first ? (this.is224 ? (U = 300032, te = (P = ae[0] - 1413257819) - 150054599 | 0, oe = P + 24177077 | 0) : (U = 704751109, te = (P = ae[0] - 210244248) - 1521486534 | 0, oe = P + 143694565 | 0), this.first = !1) : (j = (re >>> 2 | re << 30) ^ (re >>> 13 | re << 19) ^ (re >>> 22 | re << 10), R = (U = re & ne) ^ re & ie ^ V, te = oe + (P = te + (F = (ue >>> 6 | ue << 26) ^ (ue >>> 11 | ue << 21) ^ (ue >>> 25 | ue << 7)) + (ue & le ^ ~ue & X) + g[w] + ae[w]) | 0, oe = P + (j + R) | 0), j = (oe >>> 2 | oe << 30) ^ (oe >>> 13 | oe << 19) ^ (oe >>> 22 | oe << 10), R = (q = oe & re) ^ oe & ne ^ U, X = ie + (P = X + (F = (te >>> 6 | te << 26) ^ (te >>> 11 | te << 21) ^ (te >>> 25 | te << 7)) + (te & ue ^ ~te & le) + g[w + 1] + ae[w + 1]) | 0, j = ((ie = P + (j + R) | 0) >>> 2 | ie << 30) ^ (ie >>> 13 | ie << 19) ^ (ie >>> 22 | ie << 10), R = ($ = ie & oe) ^ ie & re ^ q, le = ne + (P = le + (F = (X >>> 6 | X << 26) ^ (X >>> 11 | X << 21) ^ (X >>> 25 | X << 7)) + (X & te ^ ~X & ue) + g[w + 2] + ae[w + 2]) | 0, j = ((ne = P + (j + R) | 0) >>> 2 | ne << 30) ^ (ne >>> 13 | ne << 19) ^ (ne >>> 22 | ne << 10), R = (V = ne & ie) ^ ne & oe ^ $, ue = re + (P = ue + (F = (le >>> 6 | le << 26) ^ (le >>> 11 | le << 21) ^ (le >>> 25 | le << 7)) + (le & X ^ ~le & te) + g[w + 3] + ae[w + 3]) | 0, re = P + (j + R) | 0, this.chromeBugWorkAround = !0;
1841
+ var w, R, F, N, P, U, q, $, V, re = this.h0, ne = this.h1, ie = this.h2, oe = this.h3, ue = this.h4, le = this.h5, X = this.h6, te = this.h7, ae = this.blocks;
1842
+ for (w = 16; w < 64; ++w) R = ((P = ae[w - 15]) >>> 7 | P << 25) ^ (P >>> 18 | P << 14) ^ P >>> 3, F = ((P = ae[w - 2]) >>> 17 | P << 15) ^ (P >>> 19 | P << 13) ^ P >>> 10, ae[w] = ae[w - 16] + R + ae[w - 7] + F | 0;
1843
+ for (V = ne & ie, w = 0; w < 64; w += 4) this.first ? (this.is224 ? (U = 300032, te = (P = ae[0] - 1413257819) - 150054599 | 0, oe = P + 24177077 | 0) : (U = 704751109, te = (P = ae[0] - 210244248) - 1521486534 | 0, oe = P + 143694565 | 0), this.first = !1) : (R = (re >>> 2 | re << 30) ^ (re >>> 13 | re << 19) ^ (re >>> 22 | re << 10), N = (U = re & ne) ^ re & ie ^ V, te = oe + (P = te + (F = (ue >>> 6 | ue << 26) ^ (ue >>> 11 | ue << 21) ^ (ue >>> 25 | ue << 7)) + (ue & le ^ ~ue & X) + g[w] + ae[w]) | 0, oe = P + (R + N) | 0), R = (oe >>> 2 | oe << 30) ^ (oe >>> 13 | oe << 19) ^ (oe >>> 22 | oe << 10), N = (q = oe & re) ^ oe & ne ^ U, X = ie + (P = X + (F = (te >>> 6 | te << 26) ^ (te >>> 11 | te << 21) ^ (te >>> 25 | te << 7)) + (te & ue ^ ~te & le) + g[w + 1] + ae[w + 1]) | 0, R = ((ie = P + (R + N) | 0) >>> 2 | ie << 30) ^ (ie >>> 13 | ie << 19) ^ (ie >>> 22 | ie << 10), N = ($ = ie & oe) ^ ie & re ^ q, le = ne + (P = le + (F = (X >>> 6 | X << 26) ^ (X >>> 11 | X << 21) ^ (X >>> 25 | X << 7)) + (X & te ^ ~X & ue) + g[w + 2] + ae[w + 2]) | 0, R = ((ne = P + (R + N) | 0) >>> 2 | ne << 30) ^ (ne >>> 13 | ne << 19) ^ (ne >>> 22 | ne << 10), N = (V = ne & ie) ^ ne & oe ^ $, ue = re + (P = ue + (F = (le >>> 6 | le << 26) ^ (le >>> 11 | le << 21) ^ (le >>> 25 | le << 7)) + (le & X ^ ~le & te) + g[w + 3] + ae[w + 3]) | 0, re = P + (R + N) | 0, this.chromeBugWorkAround = !0;
1863
1844
  this.h0 = this.h0 + re | 0, this.h1 = this.h1 + ne | 0, this.h2 = this.h2 + ie | 0, this.h3 = this.h3 + oe | 0, this.h4 = this.h4 + ue | 0, this.h5 = this.h5 + le | 0, this.h6 = this.h6 + X | 0, this.h7 = this.h7 + te | 0;
1864
1845
  }, L.prototype.hex = function() {
1865
1846
  this.finalize();
1866
- var w = this.h0, j = this.h1, F = this.h2, R = this.h3, P = this.h4, U = this.h5, q = this.h6, $ = this.h7, V = a[w >>> 28 & 15] + a[w >>> 24 & 15] + a[w >>> 20 & 15] + a[w >>> 16 & 15] + a[w >>> 12 & 15] + a[w >>> 8 & 15] + a[w >>> 4 & 15] + a[15 & w] + a[j >>> 28 & 15] + a[j >>> 24 & 15] + a[j >>> 20 & 15] + a[j >>> 16 & 15] + a[j >>> 12 & 15] + a[j >>> 8 & 15] + a[j >>> 4 & 15] + a[15 & j] + a[F >>> 28 & 15] + a[F >>> 24 & 15] + a[F >>> 20 & 15] + a[F >>> 16 & 15] + a[F >>> 12 & 15] + a[F >>> 8 & 15] + a[F >>> 4 & 15] + a[15 & F] + a[R >>> 28 & 15] + a[R >>> 24 & 15] + a[R >>> 20 & 15] + a[R >>> 16 & 15] + a[R >>> 12 & 15] + a[R >>> 8 & 15] + a[R >>> 4 & 15] + a[15 & R] + a[P >>> 28 & 15] + a[P >>> 24 & 15] + a[P >>> 20 & 15] + a[P >>> 16 & 15] + a[P >>> 12 & 15] + a[P >>> 8 & 15] + a[P >>> 4 & 15] + a[15 & P] + a[U >>> 28 & 15] + a[U >>> 24 & 15] + a[U >>> 20 & 15] + a[U >>> 16 & 15] + a[U >>> 12 & 15] + a[U >>> 8 & 15] + a[U >>> 4 & 15] + a[15 & U] + a[q >>> 28 & 15] + a[q >>> 24 & 15] + a[q >>> 20 & 15] + a[q >>> 16 & 15] + a[q >>> 12 & 15] + a[q >>> 8 & 15] + a[q >>> 4 & 15] + a[15 & q];
1847
+ var w = this.h0, R = this.h1, F = this.h2, N = this.h3, P = this.h4, U = this.h5, q = this.h6, $ = this.h7, V = a[w >>> 28 & 15] + a[w >>> 24 & 15] + a[w >>> 20 & 15] + a[w >>> 16 & 15] + a[w >>> 12 & 15] + a[w >>> 8 & 15] + a[w >>> 4 & 15] + a[15 & w] + a[R >>> 28 & 15] + a[R >>> 24 & 15] + a[R >>> 20 & 15] + a[R >>> 16 & 15] + a[R >>> 12 & 15] + a[R >>> 8 & 15] + a[R >>> 4 & 15] + a[15 & R] + a[F >>> 28 & 15] + a[F >>> 24 & 15] + a[F >>> 20 & 15] + a[F >>> 16 & 15] + a[F >>> 12 & 15] + a[F >>> 8 & 15] + a[F >>> 4 & 15] + a[15 & F] + a[N >>> 28 & 15] + a[N >>> 24 & 15] + a[N >>> 20 & 15] + a[N >>> 16 & 15] + a[N >>> 12 & 15] + a[N >>> 8 & 15] + a[N >>> 4 & 15] + a[15 & N] + a[P >>> 28 & 15] + a[P >>> 24 & 15] + a[P >>> 20 & 15] + a[P >>> 16 & 15] + a[P >>> 12 & 15] + a[P >>> 8 & 15] + a[P >>> 4 & 15] + a[15 & P] + a[U >>> 28 & 15] + a[U >>> 24 & 15] + a[U >>> 20 & 15] + a[U >>> 16 & 15] + a[U >>> 12 & 15] + a[U >>> 8 & 15] + a[U >>> 4 & 15] + a[15 & U] + a[q >>> 28 & 15] + a[q >>> 24 & 15] + a[q >>> 20 & 15] + a[q >>> 16 & 15] + a[q >>> 12 & 15] + a[q >>> 8 & 15] + a[q >>> 4 & 15] + a[15 & q];
1867
1848
  return this.is224 || (V += a[$ >>> 28 & 15] + a[$ >>> 24 & 15] + a[$ >>> 20 & 15] + a[$ >>> 16 & 15] + a[$ >>> 12 & 15] + a[$ >>> 8 & 15] + a[$ >>> 4 & 15] + a[15 & $]), V;
1868
1849
  }, L.prototype.toString = L.prototype.hex, L.prototype.digest = function() {
1869
1850
  this.finalize();
1870
- var w = this.h0, j = this.h1, F = this.h2, R = this.h3, P = this.h4, U = this.h5, q = this.h6, $ = this.h7, V = [
1851
+ var w = this.h0, R = this.h1, F = this.h2, N = this.h3, P = this.h4, U = this.h5, q = this.h6, $ = this.h7, V = [
1871
1852
  w >>> 24 & 255,
1872
1853
  w >>> 16 & 255,
1873
1854
  w >>> 8 & 255,
1874
1855
  255 & w,
1875
- j >>> 24 & 255,
1876
- j >>> 16 & 255,
1877
- j >>> 8 & 255,
1878
- 255 & j,
1879
- F >>> 24 & 255,
1880
- F >>> 16 & 255,
1881
- F >>> 8 & 255,
1882
- 255 & F,
1883
1856
  R >>> 24 & 255,
1884
1857
  R >>> 16 & 255,
1885
1858
  R >>> 8 & 255,
1886
1859
  255 & R,
1860
+ F >>> 24 & 255,
1861
+ F >>> 16 & 255,
1862
+ F >>> 8 & 255,
1863
+ 255 & F,
1864
+ N >>> 24 & 255,
1865
+ N >>> 16 & 255,
1866
+ N >>> 8 & 255,
1867
+ 255 & N,
1887
1868
  P >>> 24 & 255,
1888
1869
  P >>> 16 & 255,
1889
1870
  P >>> 8 & 255,
@@ -1900,17 +1881,17 @@ Os = us, function() {
1900
1881
  return this.is224 || V.push($ >>> 24 & 255, $ >>> 16 & 255, $ >>> 8 & 255, 255 & $), V;
1901
1882
  }, L.prototype.array = L.prototype.digest, L.prototype.arrayBuffer = function() {
1902
1883
  this.finalize();
1903
- var w = new ArrayBuffer(this.is224 ? 28 : 32), j = new DataView(w);
1904
- return j.setUint32(0, this.h0), j.setUint32(4, this.h1), j.setUint32(8, this.h2), j.setUint32(12, this.h3), j.setUint32(16, this.h4), j.setUint32(20, this.h5), j.setUint32(24, this.h6), this.is224 || j.setUint32(28, this.h7), w;
1905
- }, Q.prototype = new L(), Q.prototype.finalize = function() {
1884
+ var w = new ArrayBuffer(this.is224 ? 28 : 32), R = new DataView(w);
1885
+ return R.setUint32(0, this.h0), R.setUint32(4, this.h1), R.setUint32(8, this.h2), R.setUint32(12, this.h3), R.setUint32(16, this.h4), R.setUint32(20, this.h5), R.setUint32(24, this.h6), this.is224 || R.setUint32(28, this.h7), w;
1886
+ }, ee.prototype = new L(), ee.prototype.finalize = function() {
1906
1887
  if (L.prototype.finalize.call(this), this.inner) {
1907
1888
  this.inner = !1;
1908
1889
  var w = this.array();
1909
1890
  L.call(this, this.is224, this.sharedMemory), this.update(this.oKeyPad), this.update(w), L.prototype.finalize.call(this);
1910
1891
  }
1911
1892
  };
1912
- var de = I();
1913
- de.sha256 = de, de.sha224 = I(!0), de.sha256.hmac = ee(), de.sha224.hmac = ee(!0), n ? Os.exports = de : (t.sha256 = de.sha256, t.sha224 = de.sha224);
1893
+ var de = O();
1894
+ de.sha256 = de, de.sha224 = O(!0), de.sha256.hmac = Q(), de.sha224.hmac = Q(!0), n ? Os.exports = de : (t.sha256 = de.sha256, t.sha224 = de.sha224);
1914
1895
  }();
1915
1896
  us.exports;
1916
1897
  us.exports.sha224;
@@ -2007,7 +1988,7 @@ class ri extends si {
2007
1988
  super(t, s, n);
2008
1989
  h(this, "deferred");
2009
1990
  h(this, "timer");
2010
- this.deferred = Y(), this.timer = lt(i.timeout, n);
1991
+ this.deferred = Y(), this.timer = ut(i.timeout, n);
2011
1992
  }
2012
1993
  resolver(t, s) {
2013
1994
  this.timer && this.timer.cancel(), t ? (this.ctx && (t.stack += `
@@ -2025,7 +2006,7 @@ function En(r) {
2025
2006
  timeout: 5e3
2026
2007
  }, r);
2027
2008
  }
2028
- class Tt {
2009
+ class Mt {
2029
2010
  constructor(e, t) {
2030
2011
  h(this, "nc");
2031
2012
  h(this, "opts");
@@ -2052,14 +2033,14 @@ class Tt {
2052
2033
  const o = Xs();
2053
2034
  for (let a = 0; a < n; a++)
2054
2035
  try {
2055
- const f = await this.nc.request(e, i, s);
2056
- return this.parseJsResponse(f);
2057
- } catch (f) {
2058
- const p = f;
2036
+ const d = await this.nc.request(e, i, s);
2037
+ return this.parseJsResponse(d);
2038
+ } catch (d) {
2039
+ const p = d;
2059
2040
  if ((p.code === "503" || p.code === k.Timeout) && a + 1 < n)
2060
- await pt(o.backoff(a));
2041
+ await dt(o.backoff(a));
2061
2042
  else
2062
- throw f;
2043
+ throw d;
2063
2044
  }
2064
2045
  }
2065
2046
  async findStream(e) {
@@ -2083,7 +2064,7 @@ class Tt {
2083
2064
  return t;
2084
2065
  }
2085
2066
  }
2086
- class At {
2067
+ class Pt {
2087
2068
  constructor(e, t, s, i) {
2088
2069
  h(this, "err");
2089
2070
  h(this, "offset");
@@ -2138,7 +2119,7 @@ class At {
2138
2119
  }
2139
2120
  }
2140
2121
  }
2141
- function Qe(r = "") {
2122
+ function Ze(r = "") {
2142
2123
  const e = r.match(/(\d+).(\d+).(\d+)/);
2143
2124
  if (e)
2144
2125
  return {
@@ -2151,10 +2132,10 @@ function Qe(r = "") {
2151
2132
  function Ds(r, e) {
2152
2133
  return r.major < e.major ? -1 : r.major > e.major ? 1 : r.minor < e.minor ? -1 : r.minor > e.minor ? 1 : r.micro < e.micro ? -1 : r.micro > e.micro ? 1 : 0;
2153
2134
  }
2154
- var H;
2135
+ var J;
2155
2136
  (function(r) {
2156
2137
  r.JS_KV = "js_kv", r.JS_OBJECTSTORE = "js_objectstore", r.JS_PULL_MAX_BYTES = "js_pull_max_bytes", r.JS_NEW_CONSUMER_CREATE_API = "js_new_consumer_create", r.JS_ALLOW_DIRECT = "js_allow_direct", r.JS_MULTIPLE_CONSUMER_FILTER = "js_multiple_consumer_filter", r.JS_SIMPLIFICATION = "js_simplification", r.JS_STREAM_CONSUMER_METADATA = "js_stream_consumer_metadata", r.JS_CONSUMER_FILTER_SUBJECTS = "js_consumer_filter_subjects", r.JS_STREAM_FIRST_SEQ = "js_stream_first_seq", r.JS_STREAM_SUBJECT_TRANSFORM = "js_stream_subject_transform", r.JS_STREAM_SOURCE_SUBJECT_TRANSFORM = "js_stream_source_subject_transform", r.JS_STREAM_COMPRESSION = "js_stream_compression", r.JS_DEFAULT_CONSUMER_LIMITS = "js_default_consumer_limits", r.JS_BATCH_DIRECT_GET = "js_batch_direct_get";
2157
- })(H || (H = {}));
2138
+ })(J || (J = {}));
2158
2139
  class An {
2159
2140
  constructor(e) {
2160
2141
  h(this, "server");
@@ -2172,14 +2153,14 @@ class An {
2172
2153
  return this.disabled.indexOf(e) !== -1;
2173
2154
  }
2174
2155
  update(e) {
2175
- typeof e == "string" && (e = Qe(e)), this.server = e, this.set(H.JS_KV, "2.6.2"), this.set(H.JS_OBJECTSTORE, "2.6.3"), this.set(H.JS_PULL_MAX_BYTES, "2.8.3"), this.set(H.JS_NEW_CONSUMER_CREATE_API, "2.9.0"), this.set(H.JS_ALLOW_DIRECT, "2.9.0"), this.set(H.JS_MULTIPLE_CONSUMER_FILTER, "2.10.0"), this.set(H.JS_SIMPLIFICATION, "2.9.4"), this.set(H.JS_STREAM_CONSUMER_METADATA, "2.10.0"), this.set(H.JS_CONSUMER_FILTER_SUBJECTS, "2.10.0"), this.set(H.JS_STREAM_FIRST_SEQ, "2.10.0"), this.set(H.JS_STREAM_SUBJECT_TRANSFORM, "2.10.0"), this.set(H.JS_STREAM_SOURCE_SUBJECT_TRANSFORM, "2.10.0"), this.set(H.JS_STREAM_COMPRESSION, "2.10.0"), this.set(H.JS_DEFAULT_CONSUMER_LIMITS, "2.10.0"), this.set(H.JS_BATCH_DIRECT_GET, "2.11.0"), this.disabled.forEach((t) => {
2156
+ typeof e == "string" && (e = Ze(e)), this.server = e, this.set(J.JS_KV, "2.6.2"), this.set(J.JS_OBJECTSTORE, "2.6.3"), this.set(J.JS_PULL_MAX_BYTES, "2.8.3"), this.set(J.JS_NEW_CONSUMER_CREATE_API, "2.9.0"), this.set(J.JS_ALLOW_DIRECT, "2.9.0"), this.set(J.JS_MULTIPLE_CONSUMER_FILTER, "2.10.0"), this.set(J.JS_SIMPLIFICATION, "2.9.4"), this.set(J.JS_STREAM_CONSUMER_METADATA, "2.10.0"), this.set(J.JS_CONSUMER_FILTER_SUBJECTS, "2.10.0"), this.set(J.JS_STREAM_FIRST_SEQ, "2.10.0"), this.set(J.JS_STREAM_SUBJECT_TRANSFORM, "2.10.0"), this.set(J.JS_STREAM_SOURCE_SUBJECT_TRANSFORM, "2.10.0"), this.set(J.JS_STREAM_COMPRESSION, "2.10.0"), this.set(J.JS_DEFAULT_CONSUMER_LIMITS, "2.10.0"), this.set(J.JS_BATCH_DIRECT_GET, "2.11.0"), this.disabled.forEach((t) => {
2176
2157
  this.features.delete(t);
2177
2158
  });
2178
2159
  }
2179
2160
  set(e, t) {
2180
2161
  this.features.set(e, {
2181
2162
  min: t,
2182
- ok: Ds(this.server, Qe(t)) >= 0
2163
+ ok: Ds(this.server, Ze(t)) >= 0
2183
2164
  });
2184
2165
  }
2185
2166
  get(e) {
@@ -2193,10 +2174,10 @@ class An {
2193
2174
  return ((t = this.get(e)) == null ? void 0 : t.ok) || !1;
2194
2175
  }
2195
2176
  require(e) {
2196
- return typeof e == "string" && (e = Qe(e)), Ds(this.server, e) >= 0;
2177
+ return typeof e == "string" && (e = Ze(e)), Ds(this.server, e) >= 0;
2197
2178
  }
2198
2179
  }
2199
- class rs extends Tt {
2180
+ class rs extends Mt {
2200
2181
  constructor(e, t) {
2201
2182
  super(e, t);
2202
2183
  }
@@ -2206,28 +2187,28 @@ class rs extends Tt {
2206
2187
  if (t.deliver_group && t.idle_heartbeat)
2207
2188
  throw new Error("jetstream idle heartbeat is not supported with queue groups");
2208
2189
  const i = {};
2209
- i.config = t, i.stream_name = e, i.action = s, i.config.durable_name && at(i.config.durable_name);
2190
+ i.config = t, i.stream_name = e, i.action = s, i.config.durable_name && ot(i.config.durable_name);
2210
2191
  const n = this.nc;
2211
- let { min: o, ok: a } = n.features.get(H.JS_NEW_CONSUMER_CREATE_API);
2212
- const f = t.name === "" ? void 0 : t.name;
2213
- if (f && !a)
2192
+ let { min: o, ok: a } = n.features.get(J.JS_NEW_CONSUMER_CREATE_API);
2193
+ const d = t.name === "" ? void 0 : t.name;
2194
+ if (d && !a)
2214
2195
  throw new Error(`consumer 'name' requires server ${o}`);
2215
- if (f)
2196
+ if (d)
2216
2197
  try {
2217
- hs("name", f);
2198
+ hs("name", d);
2218
2199
  } catch (x) {
2219
- const A = x.message, I = A.indexOf("cannot contain");
2220
- throw I !== -1 ? new Error(`consumer 'name' ${A.substring(I)}`) : x;
2200
+ const A = x.message, O = A.indexOf("cannot contain");
2201
+ throw O !== -1 ? new Error(`consumer 'name' ${A.substring(O)}`) : x;
2221
2202
  }
2222
2203
  let p, g = "";
2223
2204
  if (Array.isArray(t.filter_subjects)) {
2224
- const { min: x, ok: A } = n.features.get(H.JS_MULTIPLE_CONSUMER_FILTER);
2205
+ const { min: x, ok: A } = n.features.get(J.JS_MULTIPLE_CONSUMER_FILTER);
2225
2206
  if (!A)
2226
2207
  throw new Error(`consumer 'filter_subjects' requires server ${x}`);
2227
2208
  a = !1;
2228
2209
  }
2229
2210
  if (t.metadata) {
2230
- const { min: x, ok: A } = n.features.get(H.JS_STREAM_CONSUMER_METADATA);
2211
+ const { min: x, ok: A } = n.features.get(J.JS_STREAM_CONSUMER_METADATA);
2231
2212
  if (!A)
2232
2213
  throw new Error(`consumer 'metadata' requires server ${x}`);
2233
2214
  }
@@ -2243,15 +2224,15 @@ class rs extends Tt {
2243
2224
  return this.add(e, Object.assign(i.config, n), ss.Update);
2244
2225
  }
2245
2226
  async info(e, t) {
2246
- return pe(e), at(t), await this._request(`${this.prefix}.CONSUMER.INFO.${e}.${t}`);
2227
+ return pe(e), ot(t), await this._request(`${this.prefix}.CONSUMER.INFO.${e}.${t}`);
2247
2228
  }
2248
2229
  async delete(e, t) {
2249
- return pe(e), at(t), (await this._request(`${this.prefix}.CONSUMER.DELETE.${e}.${t}`)).success;
2230
+ return pe(e), ot(t), (await this._request(`${this.prefix}.CONSUMER.DELETE.${e}.${t}`)).success;
2250
2231
  }
2251
2232
  list(e) {
2252
2233
  pe(e);
2253
2234
  const t = (i) => i.consumers, s = `${this.prefix}.CONSUMER.LIST.${e}`;
2254
- return new At(s, t, this);
2235
+ return new Pt(s, t, this);
2255
2236
  }
2256
2237
  pause(e, t, s) {
2257
2238
  const i = `${this.prefix}.CONSUMER.PAUSE.${e}.${t}`, n = {
@@ -2263,7 +2244,7 @@ class rs extends Tt {
2263
2244
  return this.pause(e, t, /* @__PURE__ */ new Date(0));
2264
2245
  }
2265
2246
  }
2266
- function it(r, e, t = !1) {
2247
+ function rt(r, e, t = !1) {
2267
2248
  if (t === !0 && !r)
2268
2249
  throw T.errorForCode(k.ApiError, new Error(`${e} is not a function`));
2269
2250
  if (r && typeof r != "function")
@@ -2275,27 +2256,27 @@ class Pn extends he {
2275
2256
  h(this, "sub");
2276
2257
  h(this, "adapter");
2277
2258
  h(this, "subIterDone");
2278
- it(i.adapter, "adapter", !0), this.adapter = i.adapter, i.callback && it(i.callback, "callback"), this.noIterator = typeof i.callback == "function", i.ingestionFilterFn && (it(i.ingestionFilterFn, "ingestionFilterFn"), this.ingestionFilterFn = i.ingestionFilterFn), i.protocolFilterFn && (it(i.protocolFilterFn, "protocolFilterFn"), this.protocolFilterFn = i.protocolFilterFn), i.dispatchedFn && (it(i.dispatchedFn, "dispatchedFn"), this.dispatchedFn = i.dispatchedFn), i.cleanupFn && it(i.cleanupFn, "cleanupFn");
2259
+ rt(i.adapter, "adapter", !0), this.adapter = i.adapter, i.callback && rt(i.callback, "callback"), this.noIterator = typeof i.callback == "function", i.ingestionFilterFn && (rt(i.ingestionFilterFn, "ingestionFilterFn"), this.ingestionFilterFn = i.ingestionFilterFn), i.protocolFilterFn && (rt(i.protocolFilterFn, "protocolFilterFn"), this.protocolFilterFn = i.protocolFilterFn), i.dispatchedFn && (rt(i.dispatchedFn, "dispatchedFn"), this.dispatchedFn = i.dispatchedFn), i.cleanupFn && rt(i.cleanupFn, "cleanupFn");
2279
2260
  let n = (g, y) => {
2280
2261
  this.callback(g, y);
2281
2262
  };
2282
2263
  if (i.callback) {
2283
2264
  const g = i.callback;
2284
2265
  n = (y, x) => {
2285
- const [A, I] = this.adapter(y, x);
2266
+ const [A, O] = this.adapter(y, x);
2286
2267
  if (A) {
2287
2268
  g(A, null);
2288
2269
  return;
2289
2270
  }
2290
- const { ingest: N } = this.ingestionFilterFn ? this.ingestionFilterFn(I, this) : {
2271
+ const { ingest: j } = this.ingestionFilterFn ? this.ingestionFilterFn(O, this) : {
2291
2272
  ingest: !0
2292
2273
  };
2293
- N && (!this.protocolFilterFn || this.protocolFilterFn(I)) && (g(A, I), this.dispatchedFn && I && this.dispatchedFn(I));
2274
+ j && (!this.protocolFilterFn || this.protocolFilterFn(O)) && (g(A, O), this.dispatchedFn && O && this.dispatchedFn(O));
2294
2275
  };
2295
2276
  }
2296
- const { max: o, queue: a, timeout: f } = i, p = {
2277
+ const { max: o, queue: a, timeout: d } = i, p = {
2297
2278
  queue: a,
2298
- timeout: f,
2279
+ timeout: d,
2299
2280
  callback: n
2300
2281
  };
2301
2282
  o && o > 0 && (p.max = o), this.sub = t.subscribe(s, p), i.cleanupFn && (this.sub.cleanupFn = i.cleanupFn), this.noIterator || this.iterClosed.then(() => {
@@ -2369,7 +2350,7 @@ function Hs() {
2369
2350
  return Se !== void 0 && Se.dnsResolveFn ? Se.dnsResolveFn : void 0;
2370
2351
  }
2371
2352
  const Yt = `\r
2372
- `, is = dt.fromAscii(Yt), Cn = new Uint8Array(is)[0], In = new Uint8Array(is)[1];
2353
+ `, is = ft.fromAscii(Yt), Cn = new Uint8Array(is)[0], In = new Uint8Array(is)[1];
2373
2354
  function jn(r) {
2374
2355
  for (let e = 0; e < r.length; e++) {
2375
2356
  const t = e + 1;
@@ -2551,7 +2532,7 @@ function Hn(r) {
2551
2532
  port: t
2552
2533
  };
2553
2534
  }
2554
- class Ot {
2535
+ class Ct {
2555
2536
  constructor(e, t = !1) {
2556
2537
  h(this, "src");
2557
2538
  h(this, "listen");
@@ -2586,7 +2567,7 @@ class Ot {
2586
2567
  for (const i of s) {
2587
2568
  const n = this.port === 80 ? "https" : "http", o = new URL(`${n}://${Ks(i) ? "[" + i + "]" : i}`);
2588
2569
  o.port = `${this.port}`;
2589
- const a = new Ot(o.host, !1);
2570
+ const a = new Ct(o.host, !1);
2590
2571
  a.tlsName = this.hostname, t.push(a);
2591
2572
  }
2592
2573
  }
@@ -2603,7 +2584,7 @@ class Jn {
2603
2584
  this.firstSelect = !0, this.servers = [], this.tlsName = "", this.randomize = t.randomize || !1;
2604
2585
  const s = Cs();
2605
2586
  e && (e.forEach((i) => {
2606
- i = s ? s(i) : i, this.servers.push(new Ot(i));
2587
+ i = s ? s(i) : i, this.servers.push(new Ct(i));
2607
2588
  }), this.randomize && (this.servers = Qr(this.servers))), this.servers.length === 0 && this.addServer(`${Ms}:${ii()}`, !1), this.currentServer = this.servers[0];
2608
2589
  }
2609
2590
  clear() {
@@ -2621,7 +2602,7 @@ class Jn {
2621
2602
  addServer(e, t = !1) {
2622
2603
  const s = Cs();
2623
2604
  e = s ? s(e) : e;
2624
- const i = new Ot(e, t);
2605
+ const i = new Ct(e, t);
2625
2606
  Js(i.hostname) && (i.tlsName = this.tlsName), this.servers.push(i);
2626
2607
  }
2627
2608
  selectServer() {
@@ -2652,20 +2633,20 @@ class Jn {
2652
2633
  const s = [];
2653
2634
  let i = [];
2654
2635
  const n = Cs(), o = /* @__PURE__ */ new Map();
2655
- e.connect_urls && e.connect_urls.length > 0 && e.connect_urls.forEach((f) => {
2656
- f = n ? n(f, t) : f;
2657
- const p = new Ot(f, !0);
2658
- o.set(f, p);
2636
+ e.connect_urls && e.connect_urls.length > 0 && e.connect_urls.forEach((d) => {
2637
+ d = n ? n(d, t) : d;
2638
+ const p = new Ct(d, !0);
2639
+ o.set(d, p);
2659
2640
  });
2660
2641
  const a = [];
2661
- return this.servers.forEach((f, p) => {
2662
- const g = f.listen;
2663
- f.gossiped && this.currentServer.listen !== g && o.get(g) === void 0 && a.push(p), o.delete(g);
2664
- }), a.reverse(), a.forEach((f) => {
2665
- const p = this.servers.splice(f, 1);
2642
+ return this.servers.forEach((d, p) => {
2643
+ const g = d.listen;
2644
+ d.gossiped && this.currentServer.listen !== g && o.get(g) === void 0 && a.push(p), o.delete(g);
2645
+ }), a.reverse(), a.forEach((d) => {
2646
+ const p = this.servers.splice(d, 1);
2666
2647
  i = i.concat(p[0].listen);
2667
- }), o.forEach((f, p) => {
2668
- this.servers.push(f), s.push(p);
2648
+ }), o.forEach((d, p) => {
2649
+ this.servers.push(d), s.push(p);
2669
2650
  }), {
2670
2651
  added: s,
2671
2652
  deleted: i
@@ -2777,7 +2758,7 @@ function Vn(r, e = "Assertion failed.") {
2777
2758
  throw new Gn(e);
2778
2759
  }
2779
2760
  const Tr = 32 * 1024, Is = 2 ** 32 - 2;
2780
- function zt(r, e, t = 0) {
2761
+ function Gt(r, e, t = 0) {
2781
2762
  const s = e.byteLength - t;
2782
2763
  return r.byteLength > s && (r = r.subarray(0, s)), e.set(r, t), r.byteLength;
2783
2764
  }
@@ -2831,7 +2812,7 @@ class js {
2831
2812
  read(e) {
2832
2813
  if (this.empty())
2833
2814
  return this.reset(), e.byteLength === 0 ? 0 : null;
2834
- const t = zt(this._buf.subarray(this._off), e);
2815
+ const t = Gt(this._buf.subarray(this._off), e);
2835
2816
  return this._off += t, t;
2836
2817
  }
2837
2818
  writeByte(e) {
@@ -2842,7 +2823,7 @@ class js {
2842
2823
  }
2843
2824
  write(e) {
2844
2825
  const t = this._grow(e.byteLength);
2845
- return zt(e, this._buf, t);
2826
+ return Gt(e, this._buf, t);
2846
2827
  }
2847
2828
  _grow(e) {
2848
2829
  const t = this.length;
@@ -2852,13 +2833,13 @@ class js {
2852
2833
  return s;
2853
2834
  const i = this.capacity;
2854
2835
  if (e <= Math.floor(i / 2) - t)
2855
- zt(this._buf.subarray(this._off), this._buf);
2836
+ Gt(this._buf.subarray(this._off), this._buf);
2856
2837
  else {
2857
2838
  if (i + e > Is)
2858
2839
  throw new Error("The buffer cannot be grown beyond the maximum size.");
2859
2840
  {
2860
2841
  const n = new Uint8Array(Math.min(2 * i + e, Is));
2861
- zt(this._buf.subarray(this._off), n), this._buf = n;
2842
+ Gt(this._buf.subarray(this._off), n), this._buf = n;
2862
2843
  }
2863
2844
  }
2864
2845
  return this._off = 0, this._reslice(Math.min(t + e, Is)), t;
@@ -2899,105 +2880,105 @@ class Ur {
2899
2880
  h(this, "ma");
2900
2881
  h(this, "argBuf");
2901
2882
  h(this, "msgBuf");
2902
- this.dispatcher = e, this.state = O.OP_START, this.as = 0, this.drop = 0, this.hdr = 0;
2883
+ this.dispatcher = e, this.state = C.OP_START, this.as = 0, this.drop = 0, this.hdr = 0;
2903
2884
  }
2904
2885
  parse(e) {
2905
2886
  let t;
2906
2887
  for (t = 0; t < e.length; t++) {
2907
2888
  const s = e[t];
2908
2889
  switch (this.state) {
2909
- case O.OP_START:
2890
+ case C.OP_START:
2910
2891
  switch (s) {
2911
- case C.M:
2912
- case C.m:
2913
- this.state = O.OP_M, this.hdr = -1, this.ma = Mr();
2892
+ case I.M:
2893
+ case I.m:
2894
+ this.state = C.OP_M, this.hdr = -1, this.ma = Mr();
2914
2895
  break;
2915
- case C.H:
2916
- case C.h:
2917
- this.state = O.OP_H, this.hdr = 0, this.ma = Mr();
2896
+ case I.H:
2897
+ case I.h:
2898
+ this.state = C.OP_H, this.hdr = 0, this.ma = Mr();
2918
2899
  break;
2919
- case C.P:
2920
- case C.p:
2921
- this.state = O.OP_P;
2900
+ case I.P:
2901
+ case I.p:
2902
+ this.state = C.OP_P;
2922
2903
  break;
2923
- case C.PLUS:
2924
- this.state = O.OP_PLUS;
2904
+ case I.PLUS:
2905
+ this.state = C.OP_PLUS;
2925
2906
  break;
2926
- case C.MINUS:
2927
- this.state = O.OP_MINUS;
2907
+ case I.MINUS:
2908
+ this.state = C.OP_MINUS;
2928
2909
  break;
2929
- case C.I:
2930
- case C.i:
2931
- this.state = O.OP_I;
2910
+ case I.I:
2911
+ case I.i:
2912
+ this.state = C.OP_I;
2932
2913
  break;
2933
2914
  default:
2934
2915
  throw this.fail(e.subarray(t));
2935
2916
  }
2936
2917
  break;
2937
- case O.OP_H:
2918
+ case C.OP_H:
2938
2919
  switch (s) {
2939
- case C.M:
2940
- case C.m:
2941
- this.state = O.OP_M;
2920
+ case I.M:
2921
+ case I.m:
2922
+ this.state = C.OP_M;
2942
2923
  break;
2943
2924
  default:
2944
2925
  throw this.fail(e.subarray(t));
2945
2926
  }
2946
2927
  break;
2947
- case O.OP_M:
2928
+ case C.OP_M:
2948
2929
  switch (s) {
2949
- case C.S:
2950
- case C.s:
2951
- this.state = O.OP_MS;
2930
+ case I.S:
2931
+ case I.s:
2932
+ this.state = C.OP_MS;
2952
2933
  break;
2953
2934
  default:
2954
2935
  throw this.fail(e.subarray(t));
2955
2936
  }
2956
2937
  break;
2957
- case O.OP_MS:
2938
+ case C.OP_MS:
2958
2939
  switch (s) {
2959
- case C.G:
2960
- case C.g:
2961
- this.state = O.OP_MSG;
2940
+ case I.G:
2941
+ case I.g:
2942
+ this.state = C.OP_MSG;
2962
2943
  break;
2963
2944
  default:
2964
2945
  throw this.fail(e.subarray(t));
2965
2946
  }
2966
2947
  break;
2967
- case O.OP_MSG:
2948
+ case C.OP_MSG:
2968
2949
  switch (s) {
2969
- case C.SPACE:
2970
- case C.TAB:
2971
- this.state = O.OP_MSG_SPC;
2950
+ case I.SPACE:
2951
+ case I.TAB:
2952
+ this.state = C.OP_MSG_SPC;
2972
2953
  break;
2973
2954
  default:
2974
2955
  throw this.fail(e.subarray(t));
2975
2956
  }
2976
2957
  break;
2977
- case O.OP_MSG_SPC:
2958
+ case C.OP_MSG_SPC:
2978
2959
  switch (s) {
2979
- case C.SPACE:
2980
- case C.TAB:
2960
+ case I.SPACE:
2961
+ case I.TAB:
2981
2962
  continue;
2982
2963
  default:
2983
- this.state = O.MSG_ARG, this.as = t;
2964
+ this.state = C.MSG_ARG, this.as = t;
2984
2965
  }
2985
2966
  break;
2986
- case O.MSG_ARG:
2967
+ case C.MSG_ARG:
2987
2968
  switch (s) {
2988
- case C.CR:
2969
+ case I.CR:
2989
2970
  this.drop = 1;
2990
2971
  break;
2991
- case C.NL: {
2972
+ case I.NL: {
2992
2973
  const i = this.argBuf ? this.argBuf.bytes() : e.subarray(this.as, t - this.drop);
2993
- this.processMsgArgs(i), this.drop = 0, this.as = t + 1, this.state = O.MSG_PAYLOAD, t = this.as + this.ma.size - 1;
2974
+ this.processMsgArgs(i), this.drop = 0, this.as = t + 1, this.state = C.MSG_PAYLOAD, t = this.as + this.ma.size - 1;
2994
2975
  break;
2995
2976
  }
2996
2977
  default:
2997
2978
  this.argBuf && this.argBuf.writeByte(s);
2998
2979
  }
2999
2980
  break;
3000
- case O.MSG_PAYLOAD:
2981
+ case C.MSG_PAYLOAD:
3001
2982
  if (this.msgBuf)
3002
2983
  if (this.msgBuf.length >= this.ma.size) {
3003
2984
  const i = this.msgBuf.bytes({
@@ -3007,7 +2988,7 @@ class Ur {
3007
2988
  kind: me.MSG,
3008
2989
  msg: this.ma,
3009
2990
  data: i
3010
- }), this.argBuf = void 0, this.msgBuf = void 0, this.state = O.MSG_END;
2991
+ }), this.argBuf = void 0, this.msgBuf = void 0, this.state = C.MSG_END;
3011
2992
  } else {
3012
2993
  let i = this.ma.size - this.msgBuf.length;
3013
2994
  const n = e.length - t;
@@ -3017,244 +2998,244 @@ class Ur {
3017
2998
  kind: me.MSG,
3018
2999
  msg: this.ma,
3019
3000
  data: e.subarray(this.as, t)
3020
- }), this.argBuf = void 0, this.msgBuf = void 0, this.state = O.MSG_END);
3001
+ }), this.argBuf = void 0, this.msgBuf = void 0, this.state = C.MSG_END);
3021
3002
  break;
3022
- case O.MSG_END:
3003
+ case C.MSG_END:
3023
3004
  switch (s) {
3024
- case C.NL:
3025
- this.drop = 0, this.as = t + 1, this.state = O.OP_START;
3005
+ case I.NL:
3006
+ this.drop = 0, this.as = t + 1, this.state = C.OP_START;
3026
3007
  break;
3027
3008
  default:
3028
3009
  continue;
3029
3010
  }
3030
3011
  break;
3031
- case O.OP_PLUS:
3012
+ case C.OP_PLUS:
3032
3013
  switch (s) {
3033
- case C.O:
3034
- case C.o:
3035
- this.state = O.OP_PLUS_O;
3014
+ case I.O:
3015
+ case I.o:
3016
+ this.state = C.OP_PLUS_O;
3036
3017
  break;
3037
3018
  default:
3038
3019
  throw this.fail(e.subarray(t));
3039
3020
  }
3040
3021
  break;
3041
- case O.OP_PLUS_O:
3022
+ case C.OP_PLUS_O:
3042
3023
  switch (s) {
3043
- case C.K:
3044
- case C.k:
3045
- this.state = O.OP_PLUS_OK;
3024
+ case I.K:
3025
+ case I.k:
3026
+ this.state = C.OP_PLUS_OK;
3046
3027
  break;
3047
3028
  default:
3048
3029
  throw this.fail(e.subarray(t));
3049
3030
  }
3050
3031
  break;
3051
- case O.OP_PLUS_OK:
3032
+ case C.OP_PLUS_OK:
3052
3033
  switch (s) {
3053
- case C.NL:
3034
+ case I.NL:
3054
3035
  this.dispatcher.push({
3055
3036
  kind: me.OK
3056
- }), this.drop = 0, this.state = O.OP_START;
3037
+ }), this.drop = 0, this.state = C.OP_START;
3057
3038
  break;
3058
3039
  }
3059
3040
  break;
3060
- case O.OP_MINUS:
3041
+ case C.OP_MINUS:
3061
3042
  switch (s) {
3062
- case C.E:
3063
- case C.e:
3064
- this.state = O.OP_MINUS_E;
3043
+ case I.E:
3044
+ case I.e:
3045
+ this.state = C.OP_MINUS_E;
3065
3046
  break;
3066
3047
  default:
3067
3048
  throw this.fail(e.subarray(t));
3068
3049
  }
3069
3050
  break;
3070
- case O.OP_MINUS_E:
3051
+ case C.OP_MINUS_E:
3071
3052
  switch (s) {
3072
- case C.R:
3073
- case C.r:
3074
- this.state = O.OP_MINUS_ER;
3053
+ case I.R:
3054
+ case I.r:
3055
+ this.state = C.OP_MINUS_ER;
3075
3056
  break;
3076
3057
  default:
3077
3058
  throw this.fail(e.subarray(t));
3078
3059
  }
3079
3060
  break;
3080
- case O.OP_MINUS_ER:
3061
+ case C.OP_MINUS_ER:
3081
3062
  switch (s) {
3082
- case C.R:
3083
- case C.r:
3084
- this.state = O.OP_MINUS_ERR;
3063
+ case I.R:
3064
+ case I.r:
3065
+ this.state = C.OP_MINUS_ERR;
3085
3066
  break;
3086
3067
  default:
3087
3068
  throw this.fail(e.subarray(t));
3088
3069
  }
3089
3070
  break;
3090
- case O.OP_MINUS_ERR:
3071
+ case C.OP_MINUS_ERR:
3091
3072
  switch (s) {
3092
- case C.SPACE:
3093
- case C.TAB:
3094
- this.state = O.OP_MINUS_ERR_SPC;
3073
+ case I.SPACE:
3074
+ case I.TAB:
3075
+ this.state = C.OP_MINUS_ERR_SPC;
3095
3076
  break;
3096
3077
  default:
3097
3078
  throw this.fail(e.subarray(t));
3098
3079
  }
3099
3080
  break;
3100
- case O.OP_MINUS_ERR_SPC:
3081
+ case C.OP_MINUS_ERR_SPC:
3101
3082
  switch (s) {
3102
- case C.SPACE:
3103
- case C.TAB:
3083
+ case I.SPACE:
3084
+ case I.TAB:
3104
3085
  continue;
3105
3086
  default:
3106
- this.state = O.MINUS_ERR_ARG, this.as = t;
3087
+ this.state = C.MINUS_ERR_ARG, this.as = t;
3107
3088
  }
3108
3089
  break;
3109
- case O.MINUS_ERR_ARG:
3090
+ case C.MINUS_ERR_ARG:
3110
3091
  switch (s) {
3111
- case C.CR:
3092
+ case I.CR:
3112
3093
  this.drop = 1;
3113
3094
  break;
3114
- case C.NL: {
3095
+ case I.NL: {
3115
3096
  let i;
3116
3097
  this.argBuf ? (i = this.argBuf.bytes(), this.argBuf = void 0) : i = e.subarray(this.as, t - this.drop), this.dispatcher.push({
3117
3098
  kind: me.ERR,
3118
3099
  data: i
3119
- }), this.drop = 0, this.as = t + 1, this.state = O.OP_START;
3100
+ }), this.drop = 0, this.as = t + 1, this.state = C.OP_START;
3120
3101
  break;
3121
3102
  }
3122
3103
  default:
3123
3104
  this.argBuf && this.argBuf.write(Uint8Array.of(s));
3124
3105
  }
3125
3106
  break;
3126
- case O.OP_P:
3107
+ case C.OP_P:
3127
3108
  switch (s) {
3128
- case C.I:
3129
- case C.i:
3130
- this.state = O.OP_PI;
3109
+ case I.I:
3110
+ case I.i:
3111
+ this.state = C.OP_PI;
3131
3112
  break;
3132
- case C.O:
3133
- case C.o:
3134
- this.state = O.OP_PO;
3113
+ case I.O:
3114
+ case I.o:
3115
+ this.state = C.OP_PO;
3135
3116
  break;
3136
3117
  default:
3137
3118
  throw this.fail(e.subarray(t));
3138
3119
  }
3139
3120
  break;
3140
- case O.OP_PO:
3121
+ case C.OP_PO:
3141
3122
  switch (s) {
3142
- case C.N:
3143
- case C.n:
3144
- this.state = O.OP_PON;
3123
+ case I.N:
3124
+ case I.n:
3125
+ this.state = C.OP_PON;
3145
3126
  break;
3146
3127
  default:
3147
3128
  throw this.fail(e.subarray(t));
3148
3129
  }
3149
3130
  break;
3150
- case O.OP_PON:
3131
+ case C.OP_PON:
3151
3132
  switch (s) {
3152
- case C.G:
3153
- case C.g:
3154
- this.state = O.OP_PONG;
3133
+ case I.G:
3134
+ case I.g:
3135
+ this.state = C.OP_PONG;
3155
3136
  break;
3156
3137
  default:
3157
3138
  throw this.fail(e.subarray(t));
3158
3139
  }
3159
3140
  break;
3160
- case O.OP_PONG:
3141
+ case C.OP_PONG:
3161
3142
  switch (s) {
3162
- case C.NL:
3143
+ case I.NL:
3163
3144
  this.dispatcher.push({
3164
3145
  kind: me.PONG
3165
- }), this.drop = 0, this.state = O.OP_START;
3146
+ }), this.drop = 0, this.state = C.OP_START;
3166
3147
  break;
3167
3148
  }
3168
3149
  break;
3169
- case O.OP_PI:
3150
+ case C.OP_PI:
3170
3151
  switch (s) {
3171
- case C.N:
3172
- case C.n:
3173
- this.state = O.OP_PIN;
3152
+ case I.N:
3153
+ case I.n:
3154
+ this.state = C.OP_PIN;
3174
3155
  break;
3175
3156
  default:
3176
3157
  throw this.fail(e.subarray(t));
3177
3158
  }
3178
3159
  break;
3179
- case O.OP_PIN:
3160
+ case C.OP_PIN:
3180
3161
  switch (s) {
3181
- case C.G:
3182
- case C.g:
3183
- this.state = O.OP_PING;
3162
+ case I.G:
3163
+ case I.g:
3164
+ this.state = C.OP_PING;
3184
3165
  break;
3185
3166
  default:
3186
3167
  throw this.fail(e.subarray(t));
3187
3168
  }
3188
3169
  break;
3189
- case O.OP_PING:
3170
+ case C.OP_PING:
3190
3171
  switch (s) {
3191
- case C.NL:
3172
+ case I.NL:
3192
3173
  this.dispatcher.push({
3193
3174
  kind: me.PING
3194
- }), this.drop = 0, this.state = O.OP_START;
3175
+ }), this.drop = 0, this.state = C.OP_START;
3195
3176
  break;
3196
3177
  }
3197
3178
  break;
3198
- case O.OP_I:
3179
+ case C.OP_I:
3199
3180
  switch (s) {
3200
- case C.N:
3201
- case C.n:
3202
- this.state = O.OP_IN;
3181
+ case I.N:
3182
+ case I.n:
3183
+ this.state = C.OP_IN;
3203
3184
  break;
3204
3185
  default:
3205
3186
  throw this.fail(e.subarray(t));
3206
3187
  }
3207
3188
  break;
3208
- case O.OP_IN:
3189
+ case C.OP_IN:
3209
3190
  switch (s) {
3210
- case C.F:
3211
- case C.f:
3212
- this.state = O.OP_INF;
3191
+ case I.F:
3192
+ case I.f:
3193
+ this.state = C.OP_INF;
3213
3194
  break;
3214
3195
  default:
3215
3196
  throw this.fail(e.subarray(t));
3216
3197
  }
3217
3198
  break;
3218
- case O.OP_INF:
3199
+ case C.OP_INF:
3219
3200
  switch (s) {
3220
- case C.O:
3221
- case C.o:
3222
- this.state = O.OP_INFO;
3201
+ case I.O:
3202
+ case I.o:
3203
+ this.state = C.OP_INFO;
3223
3204
  break;
3224
3205
  default:
3225
3206
  throw this.fail(e.subarray(t));
3226
3207
  }
3227
3208
  break;
3228
- case O.OP_INFO:
3209
+ case C.OP_INFO:
3229
3210
  switch (s) {
3230
- case C.SPACE:
3231
- case C.TAB:
3232
- this.state = O.OP_INFO_SPC;
3211
+ case I.SPACE:
3212
+ case I.TAB:
3213
+ this.state = C.OP_INFO_SPC;
3233
3214
  break;
3234
3215
  default:
3235
3216
  throw this.fail(e.subarray(t));
3236
3217
  }
3237
3218
  break;
3238
- case O.OP_INFO_SPC:
3219
+ case C.OP_INFO_SPC:
3239
3220
  switch (s) {
3240
- case C.SPACE:
3241
- case C.TAB:
3221
+ case I.SPACE:
3222
+ case I.TAB:
3242
3223
  continue;
3243
3224
  default:
3244
- this.state = O.INFO_ARG, this.as = t;
3225
+ this.state = C.INFO_ARG, this.as = t;
3245
3226
  }
3246
3227
  break;
3247
- case O.INFO_ARG:
3228
+ case C.INFO_ARG:
3248
3229
  switch (s) {
3249
- case C.CR:
3230
+ case I.CR:
3250
3231
  this.drop = 1;
3251
3232
  break;
3252
- case C.NL: {
3233
+ case I.NL: {
3253
3234
  let i;
3254
3235
  this.argBuf ? (i = this.argBuf.bytes(), this.argBuf = void 0) : i = e.subarray(this.as, t - this.drop), this.dispatcher.push({
3255
3236
  kind: me.INFO,
3256
3237
  data: i
3257
- }), this.drop = 0, this.as = t + 1, this.state = O.OP_START;
3238
+ }), this.drop = 0, this.as = t + 1, this.state = C.OP_START;
3258
3239
  break;
3259
3240
  }
3260
3241
  default:
@@ -3265,7 +3246,7 @@ class Ur {
3265
3246
  throw this.fail(e.subarray(t));
3266
3247
  }
3267
3248
  }
3268
- (this.state === O.MSG_ARG || this.state === O.MINUS_ERR_ARG || this.state === O.INFO_ARG) && !this.argBuf && (this.argBuf = new js(e.subarray(this.as, t - this.drop))), this.state === O.MSG_PAYLOAD && !this.msgBuf && (this.argBuf || this.cloneMsgArg(), this.msgBuf = new js(e.subarray(this.as)));
3249
+ (this.state === C.MSG_ARG || this.state === C.MINUS_ERR_ARG || this.state === C.INFO_ARG) && !this.argBuf && (this.argBuf = new js(e.subarray(this.as, t - this.drop))), this.state === C.MSG_PAYLOAD && !this.msgBuf && (this.argBuf || this.cloneMsgArg(), this.msgBuf = new js(e.subarray(this.as)));
3269
3250
  }
3270
3251
  cloneMsgArg() {
3271
3252
  const e = this.ma.subject.length, t = this.ma.reply ? this.ma.reply.length : 0, s = new Uint8Array(e + t);
@@ -3278,10 +3259,10 @@ class Ur {
3278
3259
  let s = -1;
3279
3260
  for (let i = 0; i < e.length; i++)
3280
3261
  switch (e[i]) {
3281
- case C.SPACE:
3282
- case C.TAB:
3283
- case C.CR:
3284
- case C.NL:
3262
+ case I.SPACE:
3263
+ case I.TAB:
3264
+ case I.CR:
3265
+ case I.NL:
3285
3266
  s >= 0 && (t.push(e.subarray(s, i)), s = -1);
3286
3267
  break;
3287
3268
  default:
@@ -3310,10 +3291,10 @@ class Ur {
3310
3291
  let s = -1;
3311
3292
  for (let i = 0; i < e.length; i++)
3312
3293
  switch (e[i]) {
3313
- case C.SPACE:
3314
- case C.TAB:
3315
- case C.CR:
3316
- case C.NL:
3294
+ case I.SPACE:
3295
+ case I.TAB:
3296
+ case I.CR:
3297
+ case I.NL:
3317
3298
  s >= 0 && (t.push(e.subarray(s, i)), s = -1);
3318
3299
  break;
3319
3300
  default:
@@ -3348,14 +3329,14 @@ class Ur {
3348
3329
  return t;
3349
3330
  }
3350
3331
  }
3351
- var O;
3332
+ var C;
3352
3333
  (function(r) {
3353
3334
  r[r.OP_START = 0] = "OP_START", r[r.OP_PLUS = 1] = "OP_PLUS", r[r.OP_PLUS_O = 2] = "OP_PLUS_O", r[r.OP_PLUS_OK = 3] = "OP_PLUS_OK", r[r.OP_MINUS = 4] = "OP_MINUS", r[r.OP_MINUS_E = 5] = "OP_MINUS_E", r[r.OP_MINUS_ER = 6] = "OP_MINUS_ER", r[r.OP_MINUS_ERR = 7] = "OP_MINUS_ERR", r[r.OP_MINUS_ERR_SPC = 8] = "OP_MINUS_ERR_SPC", r[r.MINUS_ERR_ARG = 9] = "MINUS_ERR_ARG", r[r.OP_M = 10] = "OP_M", r[r.OP_MS = 11] = "OP_MS", r[r.OP_MSG = 12] = "OP_MSG", r[r.OP_MSG_SPC = 13] = "OP_MSG_SPC", r[r.MSG_ARG = 14] = "MSG_ARG", r[r.MSG_PAYLOAD = 15] = "MSG_PAYLOAD", r[r.MSG_END = 16] = "MSG_END", r[r.OP_H = 17] = "OP_H", r[r.OP_P = 18] = "OP_P", r[r.OP_PI = 19] = "OP_PI", r[r.OP_PIN = 20] = "OP_PIN", r[r.OP_PING = 21] = "OP_PING", r[r.OP_PO = 22] = "OP_PO", r[r.OP_PON = 23] = "OP_PON", r[r.OP_PONG = 24] = "OP_PONG", r[r.OP_I = 25] = "OP_I", r[r.OP_IN = 26] = "OP_IN", r[r.OP_INF = 27] = "OP_INF", r[r.OP_INFO = 28] = "OP_INFO", r[r.OP_INFO_SPC = 29] = "OP_INFO_SPC", r[r.INFO_ARG = 30] = "INFO_ARG";
3354
- })(O || (O = {}));
3355
- var C;
3335
+ })(C || (C = {}));
3336
+ var I;
3356
3337
  (function(r) {
3357
3338
  r[r.CR = 13] = "CR", r[r.E = 69] = "E", r[r.e = 101] = "e", r[r.F = 70] = "F", r[r.f = 102] = "f", r[r.G = 71] = "G", r[r.g = 103] = "g", r[r.H = 72] = "H", r[r.h = 104] = "h", r[r.I = 73] = "I", r[r.i = 105] = "i", r[r.K = 75] = "K", r[r.k = 107] = "k", r[r.M = 77] = "M", r[r.m = 109] = "m", r[r.MINUS = 45] = "MINUS", r[r.N = 78] = "N", r[r.n = 110] = "n", r[r.NL = 10] = "NL", r[r.O = 79] = "O", r[r.o = 111] = "o", r[r.P = 80] = "P", r[r.p = 112] = "p", r[r.PLUS = 43] = "PLUS", r[r.R = 82] = "R", r[r.r = 114] = "r", r[r.S = 83] = "S", r[r.s = 115] = "s", r[r.SPACE = 32] = "SPACE", r[r.TAB = 9] = "TAB";
3358
- })(C || (C = {}));
3339
+ })(I || (I = {}));
3359
3340
  (function(r) {
3360
3341
  var e = function(c, l) {
3361
3342
  this.hi = c | 0, this.lo = l | 0;
@@ -3369,7 +3350,7 @@ var C;
3369
3350
  n[0] = 9;
3370
3351
  var o = t(), a = t([
3371
3352
  1
3372
- ]), f = t([
3353
+ ]), d = t([
3373
3354
  56129,
3374
3355
  1
3375
3356
  ]), p = t([
@@ -3458,62 +3439,62 @@ var C;
3458
3439
  9344,
3459
3440
  11139
3460
3441
  ]);
3461
- function I(c, l) {
3442
+ function O(c, l) {
3462
3443
  return c << l | c >>> 32 - l;
3463
3444
  }
3464
- function N(c, l) {
3445
+ function j(c, l) {
3465
3446
  var u = c[l + 3] & 255;
3466
3447
  return u = u << 8 | c[l + 2] & 255, u = u << 8 | c[l + 1] & 255, u << 8 | c[l + 0] & 255;
3467
3448
  }
3468
- function J(c, l) {
3469
- 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];
3470
- return new e(u, d);
3449
+ function B(c, l) {
3450
+ var u = c[l] << 24 | c[l + 1] << 16 | c[l + 2] << 8 | c[l + 3], f = c[l + 4] << 24 | c[l + 5] << 16 | c[l + 6] << 8 | c[l + 7];
3451
+ return new e(u, f);
3471
3452
  }
3472
- function ee(c, l, u) {
3473
- var d;
3474
- for (d = 0; d < 4; d++)
3475
- c[l + d] = u & 255, u >>>= 8;
3453
+ function Q(c, l, u) {
3454
+ var f;
3455
+ for (f = 0; f < 4; f++)
3456
+ c[l + f] = u & 255, u >>>= 8;
3476
3457
  }
3477
3458
  function L(c, l, u) {
3478
3459
  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;
3479
3460
  }
3480
- function Q(c, l, u, d, m) {
3461
+ function ee(c, l, u, f, m) {
3481
3462
  var b, v = 0;
3482
- for (b = 0; b < m; b++) v |= c[l + b] ^ u[d + b];
3463
+ for (b = 0; b < m; b++) v |= c[l + b] ^ u[f + b];
3483
3464
  return (1 & v - 1 >>> 8) - 1;
3484
3465
  }
3485
- function de(c, l, u, d) {
3486
- return Q(c, l, u, d, 16);
3466
+ function de(c, l, u, f) {
3467
+ return ee(c, l, u, f, 16);
3487
3468
  }
3488
- function w(c, l, u, d) {
3489
- return Q(c, l, u, d, 32);
3469
+ function w(c, l, u, f) {
3470
+ return ee(c, l, u, f, 32);
3490
3471
  }
3491
- function j(c, l, u, d, m) {
3492
- var b = new Uint32Array(16), v = new Uint32Array(16), E = new Uint32Array(16), _ = new Uint32Array(4), S, M, D;
3472
+ function R(c, l, u, f, m) {
3473
+ var b = new Uint32Array(16), v = new Uint32Array(16), E = new Uint32Array(16), _ = new Uint32Array(4), S, M, H;
3493
3474
  for (S = 0; S < 4; S++)
3494
- v[5 * S] = N(d, 4 * S), v[1 + S] = N(u, 4 * S), v[6 + S] = N(l, 4 * S), v[11 + S] = N(u, 16 + 4 * S);
3475
+ v[5 * S] = j(f, 4 * S), v[1 + S] = j(u, 4 * S), v[6 + S] = j(l, 4 * S), v[11 + S] = j(u, 16 + 4 * S);
3495
3476
  for (S = 0; S < 16; S++) E[S] = v[S];
3496
3477
  for (S = 0; S < 20; S++) {
3497
3478
  for (M = 0; M < 4; M++) {
3498
- for (D = 0; D < 4; D++) _[D] = v[(5 * M + 4 * D) % 16];
3499
- for (_[1] ^= I(_[0] + _[3] | 0, 7), _[2] ^= I(_[1] + _[0] | 0, 9), _[3] ^= I(_[2] + _[1] | 0, 13), _[0] ^= I(_[3] + _[2] | 0, 18), D = 0; D < 4; D++) b[4 * M + (M + D) % 4] = _[D];
3479
+ for (H = 0; H < 4; H++) _[H] = v[(5 * M + 4 * H) % 16];
3480
+ for (_[1] ^= O(_[0] + _[3] | 0, 7), _[2] ^= O(_[1] + _[0] | 0, 9), _[3] ^= O(_[2] + _[1] | 0, 13), _[0] ^= O(_[3] + _[2] | 0, 18), H = 0; H < 4; H++) b[4 * M + (M + H) % 4] = _[H];
3500
3481
  }
3501
- for (D = 0; D < 16; D++) v[D] = b[D];
3482
+ for (H = 0; H < 16; H++) v[H] = b[H];
3502
3483
  }
3503
3484
  if (m) {
3504
3485
  for (S = 0; S < 16; S++) v[S] = v[S] + E[S] | 0;
3505
3486
  for (S = 0; S < 4; S++)
3506
- v[5 * S] = v[5 * S] - N(d, 4 * S) | 0, v[6 + S] = v[6 + S] - N(l, 4 * S) | 0;
3487
+ v[5 * S] = v[5 * S] - j(f, 4 * S) | 0, v[6 + S] = v[6 + S] - j(l, 4 * S) | 0;
3507
3488
  for (S = 0; S < 4; S++)
3508
- ee(c, 4 * S, v[5 * S]), ee(c, 16 + 4 * S, v[6 + S]);
3489
+ Q(c, 4 * S, v[5 * S]), Q(c, 16 + 4 * S, v[6 + S]);
3509
3490
  } else
3510
- for (S = 0; S < 16; S++) ee(c, 4 * S, v[S] + E[S] | 0);
3491
+ for (S = 0; S < 16; S++) Q(c, 4 * S, v[S] + E[S] | 0);
3511
3492
  }
3512
- function F(c, l, u, d) {
3513
- return j(c, l, u, d, !1), 0;
3493
+ function F(c, l, u, f) {
3494
+ return R(c, l, u, f, !1), 0;
3514
3495
  }
3515
- function R(c, l, u, d) {
3516
- return j(c, l, u, d, !0), 0;
3496
+ function N(c, l, u, f) {
3497
+ return R(c, l, u, f, !0), 0;
3517
3498
  }
3518
3499
  var P = new Uint8Array([
3519
3500
  101,
@@ -3533,36 +3514,36 @@ var C;
3533
3514
  32,
3534
3515
  107
3535
3516
  ]);
3536
- function U(c, l, u, d, m, b, v) {
3517
+ function U(c, l, u, f, m, b, v) {
3537
3518
  var E = new Uint8Array(16), _ = new Uint8Array(64), S, M;
3538
3519
  if (!m) return 0;
3539
3520
  for (M = 0; M < 16; M++) E[M] = 0;
3540
3521
  for (M = 0; M < 8; M++) E[M] = b[M];
3541
3522
  for (; m >= 64; ) {
3542
- for (F(_, E, v, P), M = 0; M < 64; M++) c[l + M] = (u ? u[d + M] : 0) ^ _[M];
3523
+ for (F(_, E, v, P), M = 0; M < 64; M++) c[l + M] = (u ? u[f + M] : 0) ^ _[M];
3543
3524
  for (S = 1, M = 8; M < 16; M++)
3544
3525
  S = S + (E[M] & 255) | 0, E[M] = S & 255, S >>>= 8;
3545
- m -= 64, l += 64, u && (d += 64);
3526
+ m -= 64, l += 64, u && (f += 64);
3546
3527
  }
3547
3528
  if (m > 0)
3548
- for (F(_, E, v, P), M = 0; M < m; M++) c[l + M] = (u ? u[d + M] : 0) ^ _[M];
3529
+ for (F(_, E, v, P), M = 0; M < m; M++) c[l + M] = (u ? u[f + M] : 0) ^ _[M];
3549
3530
  return 0;
3550
3531
  }
3551
- function q(c, l, u, d, m) {
3552
- return U(c, l, null, 0, u, d, m);
3532
+ function q(c, l, u, f, m) {
3533
+ return U(c, l, null, 0, u, f, m);
3553
3534
  }
3554
- function $(c, l, u, d, m) {
3535
+ function $(c, l, u, f, m) {
3555
3536
  var b = new Uint8Array(32);
3556
- return R(b, d, m, P), q(c, l, u, d.subarray(16), b);
3537
+ return N(b, f, m, P), q(c, l, u, f.subarray(16), b);
3557
3538
  }
3558
- function V(c, l, u, d, m, b, v) {
3539
+ function V(c, l, u, f, m, b, v) {
3559
3540
  var E = new Uint8Array(32);
3560
- return R(E, b, v, P), U(c, l, u, d, m, b.subarray(16), E);
3541
+ return N(E, b, v, P), U(c, l, u, f, m, b.subarray(16), E);
3561
3542
  }
3562
3543
  function re(c, l) {
3563
- var u, d = 0;
3544
+ var u, f = 0;
3564
3545
  for (u = 0; u < 17; u++)
3565
- d = d + (c[u] + l[u] | 0) | 0, c[u] = d & 255, d >>>= 8;
3546
+ f = f + (c[u] + l[u] | 0) | 0, c[u] = f & 255, f >>>= 8;
3566
3547
  }
3567
3548
  var ne = new Uint32Array([
3568
3549
  5,
@@ -3583,15 +3564,15 @@ var C;
3583
3564
  0,
3584
3565
  252
3585
3566
  ]);
3586
- function ie(c, l, u, d, m, b) {
3587
- var v, E, _, S, M = new Uint32Array(17), D = new Uint32Array(17), Z = new Uint32Array(17), je = new Uint32Array(17), rt = new Uint32Array(17);
3588
- for (_ = 0; _ < 17; _++) D[_] = Z[_] = 0;
3589
- for (_ = 0; _ < 16; _++) D[_] = b[_];
3590
- for (D[3] &= 15, D[4] &= 252, D[7] &= 15, D[8] &= 252, D[11] &= 15, D[12] &= 252, D[15] &= 15; m > 0; ) {
3567
+ function ie(c, l, u, f, m, b) {
3568
+ var v, E, _, S, M = new Uint32Array(17), H = new Uint32Array(17), Z = new Uint32Array(17), je = new Uint32Array(17), st = new Uint32Array(17);
3569
+ for (_ = 0; _ < 17; _++) H[_] = Z[_] = 0;
3570
+ for (_ = 0; _ < 16; _++) H[_] = b[_];
3571
+ for (H[3] &= 15, H[4] &= 252, H[7] &= 15, H[8] &= 252, H[11] &= 15, H[12] &= 252, H[15] &= 15; m > 0; ) {
3591
3572
  for (_ = 0; _ < 17; _++) je[_] = 0;
3592
- for (_ = 0; _ < 16 && _ < m; ++_) je[_] = u[d + _];
3593
- for (je[_] = 1, d += _, m -= _, re(Z, je), E = 0; E < 17; E++)
3594
- for (M[E] = 0, _ = 0; _ < 17; _++) M[E] = M[E] + Z[_] * (_ <= E ? D[E - _] : 320 * D[E + 17 - _] | 0) | 0 | 0;
3573
+ for (_ = 0; _ < 16 && _ < m; ++_) je[_] = u[f + _];
3574
+ for (je[_] = 1, f += _, m -= _, re(Z, je), E = 0; E < 17; E++)
3575
+ for (M[E] = 0, _ = 0; _ < 17; _++) M[E] = M[E] + Z[_] * (_ <= E ? H[E - _] : 320 * H[E + 17 - _] | 0) | 0 | 0;
3595
3576
  for (E = 0; E < 17; E++) Z[E] = M[E];
3596
3577
  for (S = 0, _ = 0; _ < 16; _++)
3597
3578
  S = S + Z[_] | 0, Z[_] = S & 255, S >>>= 8;
@@ -3599,26 +3580,26 @@ var C;
3599
3580
  S = S + Z[_] | 0, Z[_] = S & 255, S >>>= 8;
3600
3581
  S = S + Z[16] | 0, Z[16] = S;
3601
3582
  }
3602
- for (_ = 0; _ < 17; _++) rt[_] = Z[_];
3603
- for (re(Z, ne), v = -(Z[16] >>> 7) | 0, _ = 0; _ < 17; _++) Z[_] ^= v & (rt[_] ^ Z[_]);
3583
+ for (_ = 0; _ < 17; _++) st[_] = Z[_];
3584
+ for (re(Z, ne), v = -(Z[16] >>> 7) | 0, _ = 0; _ < 17; _++) Z[_] ^= v & (st[_] ^ Z[_]);
3604
3585
  for (_ = 0; _ < 16; _++) je[_] = b[_ + 16];
3605
3586
  for (je[16] = 0, re(Z, je), _ = 0; _ < 16; _++) c[l + _] = Z[_];
3606
3587
  return 0;
3607
3588
  }
3608
- function oe(c, l, u, d, m, b) {
3589
+ function oe(c, l, u, f, m, b) {
3609
3590
  var v = new Uint8Array(16);
3610
- return ie(v, 0, u, d, m, b), de(c, l, v, 0);
3591
+ return ie(v, 0, u, f, m, b), de(c, l, v, 0);
3611
3592
  }
3612
- function ue(c, l, u, d, m) {
3593
+ function ue(c, l, u, f, m) {
3613
3594
  var b;
3614
3595
  if (u < 32) return -1;
3615
- for (V(c, 0, l, 0, u, d, m), ie(c, 16, c, 32, u - 32, c), b = 0; b < 16; b++) c[b] = 0;
3596
+ for (V(c, 0, l, 0, u, f, m), ie(c, 16, c, 32, u - 32, c), b = 0; b < 16; b++) c[b] = 0;
3616
3597
  return 0;
3617
3598
  }
3618
- function le(c, l, u, d, m) {
3599
+ function le(c, l, u, f, m) {
3619
3600
  var b, v = new Uint8Array(32);
3620
- if (u < 32 || ($(v, 0, 32, d, m), oe(l, 16, l, 32, u - 32, v) !== 0)) return -1;
3621
- for (V(c, 0, l, 0, u, d, m), b = 0; b < 32; b++) c[b] = 0;
3601
+ if (u < 32 || ($(v, 0, 32, f, m), oe(l, 16, l, 32, u - 32, v) !== 0)) return -1;
3602
+ for (V(c, 0, l, 0, u, f, m), b = 0; b < 32; b++) c[b] = 0;
3622
3603
  return 0;
3623
3604
  }
3624
3605
  function X(c, l) {
@@ -3631,13 +3612,13 @@ var C;
3631
3612
  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;
3632
3613
  }
3633
3614
  function ae(c, l, u) {
3634
- for (var d, m = ~(u - 1), b = 0; b < 16; b++)
3635
- d = m & (c[b] ^ l[b]), c[b] ^= d, l[b] ^= d;
3615
+ for (var f, m = ~(u - 1), b = 0; b < 16; b++)
3616
+ f = m & (c[b] ^ l[b]), c[b] ^= f, l[b] ^= f;
3636
3617
  }
3637
- function et(c, l) {
3638
- var u, d, m, b = t(), v = t();
3618
+ function Qe(c, l) {
3619
+ var u, f, m, b = t(), v = t();
3639
3620
  for (u = 0; u < 16; u++) v[u] = l[u];
3640
- for (te(v), te(v), te(v), d = 0; d < 2; d++) {
3621
+ for (te(v), te(v), te(v), f = 0; f < 2; f++) {
3641
3622
  for (b[0] = v[0] - 65517, u = 1; u < 15; u++)
3642
3623
  b[u] = v[u] - 65535 - (b[u - 1] >> 16 & 1), b[u - 1] &= 65535;
3643
3624
  b[15] = v[15] - 32767 - (b[14] >> 16 & 1), m = b[15] >> 16 & 1, b[14] &= 65535, ae(v, b, 1 - m);
@@ -3646,12 +3627,12 @@ var C;
3646
3627
  c[2 * u] = v[u] & 255, c[2 * u + 1] = v[u] >> 8;
3647
3628
  }
3648
3629
  function nr(c, l) {
3649
- var u = new Uint8Array(32), d = new Uint8Array(32);
3650
- return et(u, c), et(d, l), w(u, 0, d, 0);
3630
+ var u = new Uint8Array(32), f = new Uint8Array(32);
3631
+ return Qe(u, c), Qe(f, l), w(u, 0, f, 0);
3651
3632
  }
3652
3633
  function or(c) {
3653
3634
  var l = new Uint8Array(32);
3654
- return et(l, c), l[0] & 1;
3635
+ return Qe(l, c), l[0] & 1;
3655
3636
  }
3656
3637
  function ds(c, l) {
3657
3638
  var u;
@@ -3659,110 +3640,110 @@ var C;
3659
3640
  c[15] &= 32767;
3660
3641
  }
3661
3642
  function Ce(c, l, u) {
3662
- var d;
3663
- for (d = 0; d < 16; d++) c[d] = l[d] + u[d] | 0;
3643
+ var f;
3644
+ for (f = 0; f < 16; f++) c[f] = l[f] + u[f] | 0;
3664
3645
  }
3665
3646
  function Ie(c, l, u) {
3666
- var d;
3667
- for (d = 0; d < 16; d++) c[d] = l[d] - u[d] | 0;
3647
+ var f;
3648
+ for (f = 0; f < 16; f++) c[f] = l[f] - u[f] | 0;
3668
3649
  }
3669
- function B(c, l, u) {
3670
- var d, m, b = new Float64Array(31);
3671
- for (d = 0; d < 31; d++) b[d] = 0;
3672
- for (d = 0; d < 16; d++)
3650
+ function D(c, l, u) {
3651
+ var f, m, b = new Float64Array(31);
3652
+ for (f = 0; f < 31; f++) b[f] = 0;
3653
+ for (f = 0; f < 16; f++)
3673
3654
  for (m = 0; m < 16; m++)
3674
- b[d + m] += l[d] * u[m];
3675
- for (d = 0; d < 15; d++)
3676
- b[d] += 38 * b[d + 16];
3677
- for (d = 0; d < 16; d++) c[d] = b[d];
3655
+ b[f + m] += l[f] * u[m];
3656
+ for (f = 0; f < 15; f++)
3657
+ b[f] += 38 * b[f + 16];
3658
+ for (f = 0; f < 16; f++) c[f] = b[f];
3678
3659
  te(c), te(c);
3679
3660
  }
3680
3661
  function Ee(c, l) {
3681
- B(c, l, l);
3662
+ D(c, l, l);
3682
3663
  }
3683
3664
  function ar(c, l) {
3684
- var u = t(), d;
3685
- for (d = 0; d < 16; d++) u[d] = l[d];
3686
- for (d = 253; d >= 0; d--)
3687
- Ee(u, u), d !== 2 && d !== 4 && B(u, u, l);
3688
- for (d = 0; d < 16; d++) c[d] = u[d];
3665
+ var u = t(), f;
3666
+ for (f = 0; f < 16; f++) u[f] = l[f];
3667
+ for (f = 253; f >= 0; f--)
3668
+ Ee(u, u), f !== 2 && f !== 4 && D(u, u, l);
3669
+ for (f = 0; f < 16; f++) c[f] = u[f];
3689
3670
  }
3690
3671
  function cr(c, l) {
3691
- var u = t(), d;
3692
- for (d = 0; d < 16; d++) u[d] = l[d];
3693
- for (d = 250; d >= 0; d--)
3694
- Ee(u, u), d !== 1 && B(u, u, l);
3695
- for (d = 0; d < 16; d++) c[d] = u[d];
3696
- }
3697
- function Ut(c, l, u) {
3698
- var d = new Uint8Array(32), m = new Float64Array(80), b, v, E = t(), _ = t(), S = t(), M = t(), D = t(), Z = t();
3699
- for (v = 0; v < 31; v++) d[v] = l[v];
3700
- for (d[31] = l[31] & 127 | 64, d[0] &= 248, ds(m, u), v = 0; v < 16; v++)
3672
+ var u = t(), f;
3673
+ for (f = 0; f < 16; f++) u[f] = l[f];
3674
+ for (f = 250; f >= 0; f--)
3675
+ Ee(u, u), f !== 1 && D(u, u, l);
3676
+ for (f = 0; f < 16; f++) c[f] = u[f];
3677
+ }
3678
+ function $t(c, l, u) {
3679
+ var f = new Uint8Array(32), m = new Float64Array(80), b, v, E = t(), _ = t(), S = t(), M = t(), H = t(), Z = t();
3680
+ for (v = 0; v < 31; v++) f[v] = l[v];
3681
+ for (f[31] = l[31] & 127 | 64, f[0] &= 248, ds(m, u), v = 0; v < 16; v++)
3701
3682
  _[v] = m[v], M[v] = E[v] = S[v] = 0;
3702
3683
  for (E[0] = M[0] = 1, v = 254; v >= 0; --v)
3703
- b = d[v >>> 3] >>> (v & 7) & 1, ae(E, _, b), ae(S, M, b), Ce(D, E, S), Ie(E, E, S), Ce(S, _, M), Ie(_, _, M), Ee(M, D), Ee(Z, E), B(E, S, E), B(S, _, D), Ce(D, E, S), Ie(E, E, S), Ee(_, E), Ie(S, M, Z), B(E, S, f), Ce(E, E, M), B(S, S, E), B(E, M, Z), B(M, _, m), Ee(_, D), ae(E, _, b), ae(S, M, b);
3684
+ b = f[v >>> 3] >>> (v & 7) & 1, ae(E, _, b), ae(S, M, b), Ce(H, E, S), Ie(E, E, S), Ce(S, _, M), Ie(_, _, M), Ee(M, H), Ee(Z, E), D(E, S, E), D(S, _, H), Ce(H, E, S), Ie(E, E, S), Ee(_, E), Ie(S, M, Z), D(E, S, d), Ce(E, E, M), D(S, S, E), D(E, M, Z), D(M, _, m), Ee(_, H), ae(E, _, b), ae(S, M, b);
3704
3685
  for (v = 0; v < 16; v++)
3705
3686
  m[v + 16] = E[v], m[v + 32] = S[v], m[v + 48] = _[v], m[v + 64] = M[v];
3706
- var je = m.subarray(32), rt = m.subarray(16);
3707
- return ar(je, je), B(rt, rt, je), et(c, rt), 0;
3687
+ var je = m.subarray(32), st = m.subarray(16);
3688
+ return ar(je, je), D(st, st, je), Qe(c, st), 0;
3708
3689
  }
3709
- function $t(c, l) {
3710
- return Ut(c, l, n);
3690
+ function Lt(c, l) {
3691
+ return $t(c, l, n);
3711
3692
  }
3712
3693
  function hr(c, l) {
3713
- return s(l, 32), $t(c, l);
3694
+ return s(l, 32), Lt(c, l);
3714
3695
  }
3715
- function Lt(c, l, u) {
3716
- var d = new Uint8Array(32);
3717
- return Ut(d, u, l), R(c, i, d, P);
3696
+ function qt(c, l, u) {
3697
+ var f = new Uint8Array(32);
3698
+ return $t(f, u, l), N(c, i, f, P);
3718
3699
  }
3719
3700
  var ur = ue, wi = le;
3720
- function xi(c, l, u, d, m, b) {
3701
+ function xi(c, l, u, f, m, b) {
3721
3702
  var v = new Uint8Array(32);
3722
- return Lt(v, m, b), ur(c, l, u, d, v);
3703
+ return qt(v, m, b), ur(c, l, u, f, v);
3723
3704
  }
3724
- function Si(c, l, u, d, m, b) {
3705
+ function Si(c, l, u, f, m, b) {
3725
3706
  var v = new Uint8Array(32);
3726
- return Lt(v, m, b), wi(c, l, u, d, v);
3707
+ return qt(v, m, b), wi(c, l, u, f, v);
3727
3708
  }
3728
- function mt() {
3729
- var c = 0, l = 0, u = 0, d = 0, m = 65535, b, v, E;
3709
+ function pt() {
3710
+ var c = 0, l = 0, u = 0, f = 0, m = 65535, b, v, E;
3730
3711
  for (E = 0; E < arguments.length; E++)
3731
- b = arguments[E].lo, v = arguments[E].hi, c += b & m, l += b >>> 16, u += v & m, d += v >>> 16;
3732
- return l += c >>> 16, u += l >>> 16, d += u >>> 16, new e(u & m | d << 16, c & m | l << 16);
3712
+ b = arguments[E].lo, v = arguments[E].hi, c += b & m, l += b >>> 16, u += v & m, f += v >>> 16;
3713
+ return l += c >>> 16, u += l >>> 16, f += u >>> 16, new e(u & m | f << 16, c & m | l << 16);
3733
3714
  }
3734
3715
  function lr(c, l) {
3735
3716
  return new e(c.hi >>> l, c.lo >>> l | c.hi << 32 - l);
3736
3717
  }
3737
- function qt() {
3718
+ function Ft() {
3738
3719
  var c = 0, l = 0, u;
3739
3720
  for (u = 0; u < arguments.length; u++)
3740
3721
  c ^= arguments[u].lo, l ^= arguments[u].hi;
3741
3722
  return new e(l, c);
3742
3723
  }
3743
3724
  function Te(c, l) {
3744
- var u, d, m = 32 - l;
3745
- 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);
3725
+ var u, f, m = 32 - l;
3726
+ return l < 32 ? (u = c.hi >>> l | c.lo << m, f = c.lo >>> l | c.hi << m) : l < 64 && (u = c.lo >>> l | c.hi << m, f = c.hi >>> l | c.lo << m), new e(u, f);
3746
3727
  }
3747
3728
  function vi(c, l, u) {
3748
- var d = c.hi & l.hi ^ ~c.hi & u.hi, m = c.lo & l.lo ^ ~c.lo & u.lo;
3749
- return new e(d, m);
3729
+ var f = c.hi & l.hi ^ ~c.hi & u.hi, m = c.lo & l.lo ^ ~c.lo & u.lo;
3730
+ return new e(f, m);
3750
3731
  }
3751
3732
  function Ei(c, l, u) {
3752
- 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;
3753
- return new e(d, m);
3733
+ var f = 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;
3734
+ return new e(f, m);
3754
3735
  }
3755
3736
  function Ai(c) {
3756
- return qt(Te(c, 28), Te(c, 34), Te(c, 39));
3737
+ return Ft(Te(c, 28), Te(c, 34), Te(c, 39));
3757
3738
  }
3758
3739
  function Pi(c) {
3759
- return qt(Te(c, 14), Te(c, 18), Te(c, 41));
3740
+ return Ft(Te(c, 14), Te(c, 18), Te(c, 41));
3760
3741
  }
3761
3742
  function ki(c) {
3762
- return qt(Te(c, 1), Te(c, 8), lr(c, 7));
3743
+ return Ft(Te(c, 1), Te(c, 8), lr(c, 7));
3763
3744
  }
3764
3745
  function Oi(c) {
3765
- return qt(Te(c, 19), Te(c, 61), lr(c, 6));
3746
+ return Ft(Te(c, 19), Te(c, 61), lr(c, 6));
3766
3747
  }
3767
3748
  var Ci = [
3768
3749
  new e(1116352408, 3609767458),
@@ -3847,22 +3828,22 @@ var C;
3847
3828
  new e(1816402316, 1246189591)
3848
3829
  ];
3849
3830
  function fr(c, l, u) {
3850
- var d = [], m = [], b = [], v = [], E, _, S;
3851
- for (_ = 0; _ < 8; _++) d[_] = b[_] = J(c, 8 * _);
3831
+ var f = [], m = [], b = [], v = [], E, _, S;
3832
+ for (_ = 0; _ < 8; _++) f[_] = b[_] = B(c, 8 * _);
3852
3833
  for (var M = 0; u >= 128; ) {
3853
- for (_ = 0; _ < 16; _++) v[_] = J(l, 8 * _ + M);
3834
+ for (_ = 0; _ < 16; _++) v[_] = B(l, 8 * _ + M);
3854
3835
  for (_ = 0; _ < 80; _++) {
3855
3836
  for (S = 0; S < 8; S++) m[S] = b[S];
3856
- for (E = mt(b[7], Pi(b[4]), vi(b[4], b[5], b[6]), Ci[_], v[_ % 16]), m[7] = mt(E, Ai(b[0]), Ei(b[0], b[1], b[2])), m[3] = mt(m[3], E), S = 0; S < 8; S++) b[(S + 1) % 8] = m[S];
3837
+ for (E = pt(b[7], Pi(b[4]), vi(b[4], b[5], b[6]), Ci[_], v[_ % 16]), m[7] = pt(E, Ai(b[0]), Ei(b[0], b[1], b[2])), m[3] = pt(m[3], E), S = 0; S < 8; S++) b[(S + 1) % 8] = m[S];
3857
3838
  if (_ % 16 === 15)
3858
3839
  for (S = 0; S < 16; S++)
3859
- v[S] = mt(v[S], v[(S + 9) % 16], ki(v[(S + 1) % 16]), Oi(v[(S + 14) % 16]));
3840
+ v[S] = pt(v[S], v[(S + 9) % 16], ki(v[(S + 1) % 16]), Oi(v[(S + 14) % 16]));
3860
3841
  }
3861
3842
  for (_ = 0; _ < 8; _++)
3862
- b[_] = mt(b[_], d[_]), d[_] = b[_];
3843
+ b[_] = pt(b[_], f[_]), f[_] = b[_];
3863
3844
  M += 128, u -= 128;
3864
3845
  }
3865
- for (_ = 0; _ < 8; _++) L(c, 8 * _, d[_]);
3846
+ for (_ = 0; _ < 8; _++) L(c, 8 * _, f[_]);
3866
3847
  return u;
3867
3848
  }
3868
3849
  var Ii = new Uint8Array([
@@ -3932,51 +3913,51 @@ var C;
3932
3913
  121
3933
3914
  ]);
3934
3915
  function Ye(c, l, u) {
3935
- var d = new Uint8Array(64), m = new Uint8Array(256), b, v = u;
3936
- for (b = 0; b < 64; b++) d[b] = Ii[b];
3937
- for (fr(d, l, u), u %= 128, b = 0; b < 256; b++) m[b] = 0;
3916
+ var f = new Uint8Array(64), m = new Uint8Array(256), b, v = u;
3917
+ for (b = 0; b < 64; b++) f[b] = Ii[b];
3918
+ for (fr(f, l, u), u %= 128, b = 0; b < 256; b++) m[b] = 0;
3938
3919
  for (b = 0; b < u; b++) m[b] = l[v - u + b];
3939
- 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)), fr(d, m, u), b = 0; b < 64; b++) c[b] = d[b];
3920
+ 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)), fr(f, m, u), b = 0; b < 64; b++) c[b] = f[b];
3940
3921
  return 0;
3941
3922
  }
3942
- function Ft(c, l) {
3943
- var u = t(), d = t(), m = t(), b = t(), v = t(), E = t(), _ = t(), S = t(), M = t();
3944
- Ie(u, c[1], c[0]), Ie(M, l[1], l[0]), B(u, u, M), Ce(d, c[0], c[1]), Ce(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]), Ce(b, b, b), Ie(v, d, u), Ie(E, b, m), Ce(_, b, m), Ce(S, d, u), B(c[0], v, E), B(c[1], S, _), B(c[2], _, E), B(c[3], v, S);
3923
+ function Bt(c, l) {
3924
+ var u = t(), f = t(), m = t(), b = t(), v = t(), E = t(), _ = t(), S = t(), M = t();
3925
+ Ie(u, c[1], c[0]), Ie(M, l[1], l[0]), D(u, u, M), Ce(f, c[0], c[1]), Ce(M, l[0], l[1]), D(f, f, M), D(m, c[3], l[3]), D(m, m, g), D(b, c[2], l[2]), Ce(b, b, b), Ie(v, f, u), Ie(E, b, m), Ce(_, b, m), Ce(S, f, u), D(c[0], v, E), D(c[1], S, _), D(c[2], _, E), D(c[3], v, S);
3945
3926
  }
3946
3927
  function dr(c, l, u) {
3947
- var d;
3948
- for (d = 0; d < 4; d++)
3949
- ae(c[d], l[d], u);
3928
+ var f;
3929
+ for (f = 0; f < 4; f++)
3930
+ ae(c[f], l[f], u);
3950
3931
  }
3951
3932
  function ps(c, l) {
3952
- var u = t(), d = t(), m = t();
3953
- ar(m, l[2]), B(u, l[0], m), B(d, l[1], m), et(c, d), c[31] ^= or(u) << 7;
3933
+ var u = t(), f = t(), m = t();
3934
+ ar(m, l[2]), D(u, l[0], m), D(f, l[1], m), Qe(c, f), c[31] ^= or(u) << 7;
3954
3935
  }
3955
3936
  function ms(c, l, u) {
3956
- var d, m;
3937
+ var f, m;
3957
3938
  for (X(c[0], o), X(c[1], a), X(c[2], a), X(c[3], o), m = 255; m >= 0; --m)
3958
- d = u[m / 8 | 0] >> (m & 7) & 1, dr(c, l, d), Ft(l, c), Ft(c, c), dr(c, l, d);
3939
+ f = u[m / 8 | 0] >> (m & 7) & 1, dr(c, l, f), Bt(l, c), Bt(c, c), dr(c, l, f);
3959
3940
  }
3960
- function Bt(c, l) {
3941
+ function Dt(c, l) {
3961
3942
  var u = [
3962
3943
  t(),
3963
3944
  t(),
3964
3945
  t(),
3965
3946
  t()
3966
3947
  ];
3967
- X(u[0], y), X(u[1], x), X(u[2], a), B(u[3], y, x), ms(c, u, l);
3948
+ X(u[0], y), X(u[1], x), X(u[2], a), D(u[3], y, x), ms(c, u, l);
3968
3949
  }
3969
3950
  function bs(c, l, u) {
3970
- var d = new Uint8Array(64), m = [
3951
+ var f = new Uint8Array(64), m = [
3971
3952
  t(),
3972
3953
  t(),
3973
3954
  t(),
3974
3955
  t()
3975
3956
  ], b;
3976
- for (u || s(l, 32), Ye(d, l, 32), d[0] &= 248, d[31] &= 127, d[31] |= 64, Bt(m, d), ps(c, m), b = 0; b < 32; b++) l[b + 32] = c[b];
3957
+ for (u || s(l, 32), Ye(f, l, 32), f[0] &= 248, f[31] &= 127, f[31] |= 64, Dt(m, f), ps(c, m), b = 0; b < 32; b++) l[b + 32] = c[b];
3977
3958
  return 0;
3978
3959
  }
3979
- var Dt = new Float64Array([
3960
+ var Ht = new Float64Array([
3980
3961
  237,
3981
3962
  211,
3982
3963
  245,
@@ -4011,17 +3992,17 @@ var C;
4011
3992
  16
4012
3993
  ]);
4013
3994
  function gs(c, l) {
4014
- var u, d, m, b;
4015
- for (d = 63; d >= 32; --d) {
4016
- for (u = 0, m = d - 32, b = d - 12; m < b; ++m)
4017
- l[m] += u - 16 * l[d] * Dt[m - (d - 32)], u = Math.floor((l[m] + 128) / 256), l[m] -= u * 256;
4018
- l[m] += u, l[d] = 0;
3995
+ var u, f, m, b;
3996
+ for (f = 63; f >= 32; --f) {
3997
+ for (u = 0, m = f - 32, b = f - 12; m < b; ++m)
3998
+ l[m] += u - 16 * l[f] * Ht[m - (f - 32)], u = Math.floor((l[m] + 128) / 256), l[m] -= u * 256;
3999
+ l[m] += u, l[f] = 0;
4019
4000
  }
4020
4001
  for (u = 0, m = 0; m < 32; m++)
4021
- l[m] += u - (l[31] >> 4) * Dt[m], u = l[m] >> 8, l[m] &= 255;
4022
- for (m = 0; m < 32; m++) l[m] -= u * Dt[m];
4023
- for (d = 0; d < 32; d++)
4024
- l[d + 1] += l[d] >> 8, c[d] = l[d] & 255;
4002
+ l[m] += u - (l[31] >> 4) * Ht[m], u = l[m] >> 8, l[m] &= 255;
4003
+ for (m = 0; m < 32; m++) l[m] -= u * Ht[m];
4004
+ for (f = 0; f < 32; f++)
4005
+ l[f + 1] += l[f] >> 8, c[f] = l[f] & 255;
4025
4006
  }
4026
4007
  function _s(c) {
4027
4008
  var l = new Float64Array(64), u;
@@ -4029,30 +4010,30 @@ var C;
4029
4010
  for (u = 0; u < 64; u++) c[u] = 0;
4030
4011
  gs(c, l);
4031
4012
  }
4032
- function pr(c, l, u, d) {
4013
+ function pr(c, l, u, f) {
4033
4014
  var m = new Uint8Array(64), b = new Uint8Array(64), v = new Uint8Array(64), E, _, S = new Float64Array(64), M = [
4034
4015
  t(),
4035
4016
  t(),
4036
4017
  t(),
4037
4018
  t()
4038
4019
  ];
4039
- Ye(m, d, 32), m[0] &= 248, m[31] &= 127, m[31] |= 64;
4040
- var D = u + 64;
4020
+ Ye(m, f, 32), m[0] &= 248, m[31] &= 127, m[31] |= 64;
4021
+ var H = u + 64;
4041
4022
  for (E = 0; E < u; E++) c[64 + E] = l[E];
4042
4023
  for (E = 0; E < 32; E++) c[32 + E] = m[32 + E];
4043
- for (Ye(v, c.subarray(32), u + 32), _s(v), Bt(M, v), ps(c, M), E = 32; E < 64; E++) c[E] = d[E];
4024
+ for (Ye(v, c.subarray(32), u + 32), _s(v), Dt(M, v), ps(c, M), E = 32; E < 64; E++) c[E] = f[E];
4044
4025
  for (Ye(b, c, u + 64), _s(b), E = 0; E < 64; E++) S[E] = 0;
4045
4026
  for (E = 0; E < 32; E++) S[E] = v[E];
4046
4027
  for (E = 0; E < 32; E++)
4047
4028
  for (_ = 0; _ < 32; _++)
4048
4029
  S[E + _] += b[E] * m[_];
4049
- return gs(c.subarray(32), S), D;
4030
+ return gs(c.subarray(32), S), H;
4050
4031
  }
4051
4032
  function ji(c, l) {
4052
- var u = t(), d = t(), m = t(), b = t(), v = t(), E = t(), _ = t();
4053
- return X(c[2], a), ds(c[1], l), Ee(m, c[1]), B(b, m, p), Ie(m, m, c[2]), Ce(b, c[2], b), Ee(v, b), Ee(E, v), B(_, E, v), B(u, _, m), B(u, u, b), cr(u, u), B(u, u, m), B(u, u, b), B(u, u, b), B(c[0], u, b), Ee(d, c[0]), B(d, d, b), nr(d, m) && B(c[0], c[0], A), Ee(d, c[0]), B(d, d, b), nr(d, m) ? -1 : (or(c[0]) === l[31] >> 7 && Ie(c[0], o, c[0]), B(c[3], c[0], c[1]), 0);
4033
+ var u = t(), f = t(), m = t(), b = t(), v = t(), E = t(), _ = t();
4034
+ return X(c[2], a), ds(c[1], l), Ee(m, c[1]), D(b, m, p), Ie(m, m, c[2]), Ce(b, c[2], b), Ee(v, b), Ee(E, v), D(_, E, v), D(u, _, m), D(u, u, b), cr(u, u), D(u, u, m), D(u, u, b), D(u, u, b), D(c[0], u, b), Ee(f, c[0]), D(f, f, b), nr(f, m) && D(c[0], c[0], A), Ee(f, c[0]), D(f, f, b), nr(f, m) ? -1 : (or(c[0]) === l[31] >> 7 && Ie(c[0], o, c[0]), D(c[3], c[0], c[1]), 0);
4054
4035
  }
4055
- function ys(c, l, u, d) {
4036
+ function ys(c, l, u, f) {
4056
4037
  var m, b = new Uint8Array(32), v = new Uint8Array(64), E = [
4057
4038
  t(),
4058
4039
  t(),
@@ -4064,19 +4045,19 @@ var C;
4064
4045
  t(),
4065
4046
  t()
4066
4047
  ];
4067
- if (u < 64 || ji(_, d)) return -1;
4048
+ if (u < 64 || ji(_, f)) return -1;
4068
4049
  for (m = 0; m < u; m++) c[m] = l[m];
4069
- for (m = 0; m < 32; m++) c[m + 32] = d[m];
4070
- if (Ye(v, c, u), _s(v), ms(E, _, v), Bt(_, l.subarray(32)), Ft(E, _), ps(b, E), u -= 64, w(l, 0, b, 0)) {
4050
+ for (m = 0; m < 32; m++) c[m + 32] = f[m];
4051
+ if (Ye(v, c, u), _s(v), ms(E, _, v), Dt(_, l.subarray(32)), Bt(E, _), ps(b, E), u -= 64, w(l, 0, b, 0)) {
4071
4052
  for (m = 0; m < u; m++) c[m] = 0;
4072
4053
  return -1;
4073
4054
  }
4074
4055
  for (m = 0; m < u; m++) c[m] = l[m + 64];
4075
4056
  return u;
4076
4057
  }
4077
- var ws = 32, Ht = 24, bt = 32, tt = 16, gt = 32, Jt = 32, _t = 32, yt = 32, xs = 32, mr = Ht, Ri = bt, Ni = tt, Le = 64, Xe = 32, st = 64, Ss = 32, vs = 64;
4058
+ var ws = 32, Jt = 24, mt = 32, et = 16, bt = 32, Kt = 32, gt = 32, _t = 32, xs = 32, mr = Jt, Ri = mt, Ni = et, Le = 64, Xe = 32, tt = 64, Ss = 32, vs = 64;
4078
4059
  r.lowlevel = {
4079
- crypto_core_hsalsa20: R,
4060
+ crypto_core_hsalsa20: N,
4080
4061
  crypto_stream_xor: V,
4081
4062
  crypto_stream: $,
4082
4063
  crypto_stream_salsa20_xor: U,
@@ -4087,9 +4068,9 @@ var C;
4087
4068
  crypto_verify_32: w,
4088
4069
  crypto_secretbox: ue,
4089
4070
  crypto_secretbox_open: le,
4090
- crypto_scalarmult: Ut,
4091
- crypto_scalarmult_base: $t,
4092
- crypto_box_beforenm: Lt,
4071
+ crypto_scalarmult: $t,
4072
+ crypto_scalarmult_base: Lt,
4073
+ crypto_box_beforenm: qt,
4093
4074
  crypto_box_afternm: ur,
4094
4075
  crypto_box: xi,
4095
4076
  crypto_box_open: Si,
@@ -4099,45 +4080,45 @@ var C;
4099
4080
  crypto_sign_keypair: bs,
4100
4081
  crypto_sign_open: ys,
4101
4082
  crypto_secretbox_KEYBYTES: ws,
4102
- crypto_secretbox_NONCEBYTES: Ht,
4103
- crypto_secretbox_ZEROBYTES: bt,
4104
- crypto_secretbox_BOXZEROBYTES: tt,
4105
- crypto_scalarmult_BYTES: gt,
4106
- crypto_scalarmult_SCALARBYTES: Jt,
4107
- crypto_box_PUBLICKEYBYTES: _t,
4108
- crypto_box_SECRETKEYBYTES: yt,
4083
+ crypto_secretbox_NONCEBYTES: Jt,
4084
+ crypto_secretbox_ZEROBYTES: mt,
4085
+ crypto_secretbox_BOXZEROBYTES: et,
4086
+ crypto_scalarmult_BYTES: bt,
4087
+ crypto_scalarmult_SCALARBYTES: Kt,
4088
+ crypto_box_PUBLICKEYBYTES: gt,
4089
+ crypto_box_SECRETKEYBYTES: _t,
4109
4090
  crypto_box_BEFORENMBYTES: xs,
4110
4091
  crypto_box_NONCEBYTES: mr,
4111
4092
  crypto_box_ZEROBYTES: Ri,
4112
4093
  crypto_box_BOXZEROBYTES: Ni,
4113
4094
  crypto_sign_BYTES: Le,
4114
4095
  crypto_sign_PUBLICKEYBYTES: Xe,
4115
- crypto_sign_SECRETKEYBYTES: st,
4096
+ crypto_sign_SECRETKEYBYTES: tt,
4116
4097
  crypto_sign_SEEDBYTES: Ss,
4117
4098
  crypto_hash_BYTES: vs,
4118
4099
  gf: t,
4119
4100
  D: p,
4120
- L: Dt,
4121
- pack25519: et,
4101
+ L: Ht,
4102
+ pack25519: Qe,
4122
4103
  unpack25519: ds,
4123
- M: B,
4104
+ M: D,
4124
4105
  A: Ce,
4125
4106
  S: Ee,
4126
4107
  Z: Ie,
4127
4108
  pow2523: cr,
4128
- add: Ft,
4109
+ add: Bt,
4129
4110
  set25519: X,
4130
4111
  modL: gs,
4131
4112
  scalarmult: ms,
4132
- scalarbase: Bt
4113
+ scalarbase: Dt
4133
4114
  };
4134
4115
  function br(c, l) {
4135
4116
  if (c.length !== ws) throw new Error("bad key size");
4136
- if (l.length !== Ht) throw new Error("bad nonce size");
4117
+ if (l.length !== Jt) throw new Error("bad nonce size");
4137
4118
  }
4138
4119
  function Ti(c, l) {
4139
- if (c.length !== _t) throw new Error("bad public key size");
4140
- if (l.length !== yt) throw new Error("bad secret key size");
4120
+ if (c.length !== gt) throw new Error("bad public key size");
4121
+ if (l.length !== _t) throw new Error("bad secret key size");
4141
4122
  }
4142
4123
  function _e() {
4143
4124
  for (var c = 0; c < arguments.length; c++)
@@ -4151,72 +4132,72 @@ var C;
4151
4132
  return s(l, c), l;
4152
4133
  }, r.secretbox = function(c, l, u) {
4153
4134
  _e(c, l, u), br(u, l);
4154
- for (var d = new Uint8Array(bt + c.length), m = new Uint8Array(d.length), b = 0; b < c.length; b++) d[b + bt] = c[b];
4155
- return ue(m, d, d.length, l, u), m.subarray(tt);
4135
+ for (var f = new Uint8Array(mt + c.length), m = new Uint8Array(f.length), b = 0; b < c.length; b++) f[b + mt] = c[b];
4136
+ return ue(m, f, f.length, l, u), m.subarray(et);
4156
4137
  }, r.secretbox.open = function(c, l, u) {
4157
4138
  _e(c, l, u), br(u, l);
4158
- for (var d = new Uint8Array(tt + c.length), m = new Uint8Array(d.length), b = 0; b < c.length; b++) d[b + tt] = c[b];
4159
- return d.length < 32 || le(m, d, d.length, l, u) !== 0 ? null : m.subarray(bt);
4160
- }, r.secretbox.keyLength = ws, r.secretbox.nonceLength = Ht, r.secretbox.overheadLength = tt, r.scalarMult = function(c, l) {
4161
- if (_e(c, l), c.length !== Jt) throw new Error("bad n size");
4162
- if (l.length !== gt) throw new Error("bad p size");
4163
- var u = new Uint8Array(gt);
4164
- return Ut(u, c, l), u;
4139
+ for (var f = new Uint8Array(et + c.length), m = new Uint8Array(f.length), b = 0; b < c.length; b++) f[b + et] = c[b];
4140
+ return f.length < 32 || le(m, f, f.length, l, u) !== 0 ? null : m.subarray(mt);
4141
+ }, r.secretbox.keyLength = ws, r.secretbox.nonceLength = Jt, r.secretbox.overheadLength = et, r.scalarMult = function(c, l) {
4142
+ if (_e(c, l), c.length !== Kt) throw new Error("bad n size");
4143
+ if (l.length !== bt) throw new Error("bad p size");
4144
+ var u = new Uint8Array(bt);
4145
+ return $t(u, c, l), u;
4165
4146
  }, r.scalarMult.base = function(c) {
4166
- if (_e(c), c.length !== Jt) throw new Error("bad n size");
4167
- var l = new Uint8Array(gt);
4168
- return $t(l, c), l;
4169
- }, r.scalarMult.scalarLength = Jt, r.scalarMult.groupElementLength = gt, r.box = function(c, l, u, d) {
4170
- var m = r.box.before(u, d);
4147
+ if (_e(c), c.length !== Kt) throw new Error("bad n size");
4148
+ var l = new Uint8Array(bt);
4149
+ return Lt(l, c), l;
4150
+ }, r.scalarMult.scalarLength = Kt, r.scalarMult.groupElementLength = bt, r.box = function(c, l, u, f) {
4151
+ var m = r.box.before(u, f);
4171
4152
  return r.secretbox(c, l, m);
4172
4153
  }, r.box.before = function(c, l) {
4173
4154
  _e(c, l), Ti(c, l);
4174
4155
  var u = new Uint8Array(xs);
4175
- return Lt(u, c, l), u;
4176
- }, r.box.after = r.secretbox, r.box.open = function(c, l, u, d) {
4177
- var m = r.box.before(u, d);
4156
+ return qt(u, c, l), u;
4157
+ }, r.box.after = r.secretbox, r.box.open = function(c, l, u, f) {
4158
+ var m = r.box.before(u, f);
4178
4159
  return r.secretbox.open(c, l, m);
4179
4160
  }, r.box.open.after = r.secretbox.open, r.box.keyPair = function() {
4180
- var c = new Uint8Array(_t), l = new Uint8Array(yt);
4161
+ var c = new Uint8Array(gt), l = new Uint8Array(_t);
4181
4162
  return hr(c, l), {
4182
4163
  publicKey: c,
4183
4164
  secretKey: l
4184
4165
  };
4185
4166
  }, r.box.keyPair.fromSecretKey = function(c) {
4186
- if (_e(c), c.length !== yt) throw new Error("bad secret key size");
4187
- var l = new Uint8Array(_t);
4188
- return $t(l, c), {
4167
+ if (_e(c), c.length !== _t) throw new Error("bad secret key size");
4168
+ var l = new Uint8Array(gt);
4169
+ return Lt(l, c), {
4189
4170
  publicKey: l,
4190
4171
  secretKey: new Uint8Array(c)
4191
4172
  };
4192
- }, r.box.publicKeyLength = _t, r.box.secretKeyLength = yt, r.box.sharedKeyLength = xs, r.box.nonceLength = mr, r.box.overheadLength = r.secretbox.overheadLength, r.sign = function(c, l) {
4193
- if (_e(c, l), l.length !== st) throw new Error("bad secret key size");
4173
+ }, r.box.publicKeyLength = gt, r.box.secretKeyLength = _t, r.box.sharedKeyLength = xs, r.box.nonceLength = mr, r.box.overheadLength = r.secretbox.overheadLength, r.sign = function(c, l) {
4174
+ if (_e(c, l), l.length !== tt) throw new Error("bad secret key size");
4194
4175
  var u = new Uint8Array(Le + c.length);
4195
4176
  return pr(u, c, c.length, l), u;
4196
4177
  }, r.sign.open = function(c, l) {
4197
4178
  if (_e(c, l), l.length !== Xe) throw new Error("bad public key size");
4198
- var u = new Uint8Array(c.length), d = ys(u, c, c.length, l);
4199
- if (d < 0) return null;
4200
- for (var m = new Uint8Array(d), b = 0; b < m.length; b++) m[b] = u[b];
4179
+ var u = new Uint8Array(c.length), f = ys(u, c, c.length, l);
4180
+ if (f < 0) return null;
4181
+ for (var m = new Uint8Array(f), b = 0; b < m.length; b++) m[b] = u[b];
4201
4182
  return m;
4202
4183
  }, r.sign.detached = function(c, l) {
4203
- for (var u = r.sign(c, l), d = new Uint8Array(Le), m = 0; m < d.length; m++) d[m] = u[m];
4204
- return d;
4184
+ for (var u = r.sign(c, l), f = new Uint8Array(Le), m = 0; m < f.length; m++) f[m] = u[m];
4185
+ return f;
4205
4186
  }, r.sign.detached.verify = function(c, l, u) {
4206
4187
  if (_e(c, l, u), l.length !== Le) throw new Error("bad signature size");
4207
4188
  if (u.length !== Xe) throw new Error("bad public key size");
4208
- var d = new Uint8Array(Le + c.length), m = new Uint8Array(Le + c.length), b;
4209
- for (b = 0; b < Le; b++) d[b] = l[b];
4210
- for (b = 0; b < c.length; b++) d[b + Le] = c[b];
4211
- return ys(m, d, d.length, u) >= 0;
4189
+ var f = new Uint8Array(Le + c.length), m = new Uint8Array(Le + c.length), b;
4190
+ for (b = 0; b < Le; b++) f[b] = l[b];
4191
+ for (b = 0; b < c.length; b++) f[b + Le] = c[b];
4192
+ return ys(m, f, f.length, u) >= 0;
4212
4193
  }, r.sign.keyPair = function() {
4213
- var c = new Uint8Array(Xe), l = new Uint8Array(st);
4194
+ var c = new Uint8Array(Xe), l = new Uint8Array(tt);
4214
4195
  return bs(c, l), {
4215
4196
  publicKey: c,
4216
4197
  secretKey: l
4217
4198
  };
4218
4199
  }, r.sign.keyPair.fromSecretKey = function(c) {
4219
- if (_e(c), c.length !== st) throw new Error("bad secret key size");
4200
+ if (_e(c), c.length !== tt) throw new Error("bad secret key size");
4220
4201
  for (var l = new Uint8Array(Xe), u = 0; u < l.length; u++) l[u] = c[32 + u];
4221
4202
  return {
4222
4203
  publicKey: l,
@@ -4224,42 +4205,42 @@ var C;
4224
4205
  };
4225
4206
  }, r.sign.keyPair.fromSeed = function(c) {
4226
4207
  if (_e(c), c.length !== Ss) throw new Error("bad seed size");
4227
- for (var l = new Uint8Array(Xe), u = new Uint8Array(st), d = 0; d < 32; d++) u[d] = c[d];
4208
+ for (var l = new Uint8Array(Xe), u = new Uint8Array(tt), f = 0; f < 32; f++) u[f] = c[f];
4228
4209
  return bs(l, u, !0), {
4229
4210
  publicKey: l,
4230
4211
  secretKey: u
4231
4212
  };
4232
- }, r.sign.publicKeyLength = Xe, r.sign.secretKeyLength = st, r.sign.seedLength = Ss, r.sign.signatureLength = Le, r.hash = function(c) {
4213
+ }, r.sign.publicKeyLength = Xe, r.sign.secretKeyLength = tt, r.sign.seedLength = Ss, r.sign.signatureLength = Le, r.hash = function(c) {
4233
4214
  _e(c);
4234
4215
  var l = new Uint8Array(vs);
4235
4216
  return Ye(l, c, c.length), l;
4236
4217
  }, r.hash.hashLength = vs, r.verify = function(c, l) {
4237
- return _e(c, l), c.length === 0 || l.length === 0 || c.length !== l.length ? !1 : Q(c, 0, l, 0, c.length) === 0;
4218
+ return _e(c, l), c.length === 0 || l.length === 0 || c.length !== l.length ? !1 : ee(c, 0, l, 0, c.length) === 0;
4238
4219
  }, r.setPRNG = function(c) {
4239
4220
  s = c;
4240
4221
  }, function() {
4241
4222
  var c = typeof globalThis < "u" ? globalThis.crypto || globalThis.msCrypto : null;
4242
4223
  if (c && c.getRandomValues) {
4243
4224
  var l = 65536;
4244
- r.setPRNG(function(u, d) {
4245
- var m, b = new Uint8Array(d);
4246
- for (m = 0; m < d; m += l)
4247
- c.getRandomValues(b.subarray(m, m + Math.min(d - m, l)));
4248
- for (m = 0; m < d; m++) u[m] = b[m];
4225
+ r.setPRNG(function(u, f) {
4226
+ var m, b = new Uint8Array(f);
4227
+ for (m = 0; m < f; m += l)
4228
+ c.getRandomValues(b.subarray(m, m + Math.min(f - m, l)));
4229
+ for (m = 0; m < f; m++) u[m] = b[m];
4249
4230
  gr(b);
4250
4231
  });
4251
- } else typeof require < "u" && (crypto = window.crypto || globalThis.crypto, c && c.randomBytes && r.setPRNG(function(u, d) {
4252
- var m, b = c.randomBytes(d);
4253
- for (m = 0; m < d; m++) u[m] = b[m];
4232
+ } else typeof require < "u" && (crypto = window.crypto || globalThis.crypto, c && c.randomBytes && r.setPRNG(function(u, f) {
4233
+ var m, b = c.randomBytes(f);
4234
+ for (m = 0; m < f; m++) u[m] = b[m];
4254
4235
  gr(b);
4255
4236
  }));
4256
4237
  }();
4257
4238
  })(typeof module < "u" && module.exports ? module.exports : globalThis.nacl = globalThis.nacl || {});
4258
- const Gt = typeof module < "u" && module.exports ? module.exports : globalThis.nacl, Yn = {
4259
- fromSeed: Gt.sign.keyPair.fromSeed,
4260
- sign: Gt.sign.detached,
4261
- verify: Gt.sign.detached.verify,
4262
- randomBytes: Gt.randomBytes
4239
+ const Vt = typeof module < "u" && module.exports ? module.exports : globalThis.nacl, Yn = {
4240
+ fromSeed: Vt.sign.keyPair.fromSeed,
4241
+ sign: Vt.sign.detached,
4242
+ verify: Vt.sign.detached.verify,
4243
+ randomBytes: Vt.randomBytes
4263
4244
  };
4264
4245
  let ai;
4265
4246
  function Xn(r) {
@@ -4545,8 +4526,8 @@ class $r {
4545
4526
  let t = 0, s = 0, i = new Uint8Array(e), n = new Uint8Array(e.byteLength * 2), o = 0;
4546
4527
  for (let a = 0; a < i.byteLength; a++)
4547
4528
  for (s = s << 8 | i[a], t += 8; t >= 5; ) {
4548
- let f = s >>> t - 5 & 31;
4549
- n[o++] = Rs.charAt(f).charCodeAt(0), t -= 5;
4529
+ let d = s >>> t - 5 & 31;
4530
+ n[o++] = Rs.charAt(d).charCodeAt(0), t -= 5;
4550
4531
  }
4551
4532
  if (t > 0) {
4552
4533
  let a = s << 5 - t & 31;
@@ -4557,7 +4538,7 @@ class $r {
4557
4538
  static decode(e) {
4558
4539
  let t = 0, s = 0, i = 0, n = new Uint8Array(e), o = new Uint8Array(n.byteLength * 5 / 8 | 0);
4559
4540
  for (let a = 0; a < n.byteLength; a++) {
4560
- let f = String.fromCharCode(n[a]), p = Rs.indexOf(f);
4541
+ let d = String.fromCharCode(n[a]), p = Rs.indexOf(d);
4561
4542
  if (p === -1)
4562
4543
  throw new Error("Illegal Base32 character: " + n[a]);
4563
4544
  s = s << 5 | p, t += 5, t >= 8 && (o[i++] = s >>> t - 8 & 255, t -= 8);
@@ -4591,7 +4572,7 @@ var z;
4591
4572
  (function(r) {
4592
4573
  r[r.Seed = 144] = "Seed", r[r.Private = 120] = "Private", r[r.Operator = 112] = "Operator", r[r.Server = 104] = "Server", r[r.Cluster = 16] = "Cluster", r[r.Account = 0] = "Account", r[r.User = 160] = "User";
4593
4574
  })(z || (z = {}));
4594
- class ot {
4575
+ class nt {
4595
4576
  static isValidPublicPrefix(e) {
4596
4577
  return e == z.Server || e == z.Operator || e == z.Cluster || e == z.Account || e == z.User;
4597
4578
  }
@@ -4627,21 +4608,21 @@ class be {
4627
4608
  static encode(e, t) {
4628
4609
  if (!t || !(t instanceof Uint8Array))
4629
4610
  throw new G(K.SerializationError);
4630
- if (!ot.isValidPrefix(e))
4611
+ if (!nt.isValidPrefix(e))
4631
4612
  throw new G(K.InvalidPrefixByte);
4632
4613
  return be._encode(!1, e, t);
4633
4614
  }
4634
4615
  static encodeSeed(e, t) {
4635
4616
  if (!t)
4636
4617
  throw new G(K.ApiError);
4637
- if (!ot.isValidPublicPrefix(e))
4618
+ if (!nt.isValidPublicPrefix(e))
4638
4619
  throw new G(K.InvalidPrefixByte);
4639
4620
  if (t.byteLength !== 32)
4640
4621
  throw new G(K.InvalidSeedLen);
4641
4622
  return be._encode(!0, e, t);
4642
4623
  }
4643
4624
  static decode(e, t) {
4644
- if (!ot.isValidPrefix(e))
4625
+ if (!nt.isValidPrefix(e))
4645
4626
  throw new G(K.InvalidPrefixByte);
4646
4627
  const s = be._decode(t);
4647
4628
  if (s[0] !== e)
@@ -4652,7 +4633,7 @@ class be {
4652
4633
  const t = be._decode(e), s = be._decodePrefix(t);
4653
4634
  if (s[0] != z.Seed)
4654
4635
  throw new G(K.InvalidSeed);
4655
- if (!ot.isValidPublicPrefix(s[1]))
4636
+ if (!nt.isValidPublicPrefix(s[1]))
4656
4637
  throw new G(K.InvalidPrefixByte);
4657
4638
  return {
4658
4639
  buf: t.slice(2),
@@ -4660,15 +4641,15 @@ class be {
4660
4641
  };
4661
4642
  }
4662
4643
  static _encode(e, t, s) {
4663
- const i = e ? 2 : 1, n = s.byteLength, o = i + n + 2, a = i + n, f = new Uint8Array(o);
4644
+ const i = e ? 2 : 1, n = s.byteLength, o = i + n + 2, a = i + n, d = new Uint8Array(o);
4664
4645
  if (e) {
4665
4646
  const y = be._encodePrefix(z.Seed, t);
4666
- f.set(y);
4647
+ d.set(y);
4667
4648
  } else
4668
- f[0] = t;
4669
- f.set(s, i);
4670
- const p = ns.checksum(f.slice(0, a));
4671
- return new DataView(f.buffer).setUint16(a, p, !0), $r.encode(f);
4649
+ d[0] = t;
4650
+ d.set(s, i);
4651
+ const p = ns.checksum(d.slice(0, a));
4652
+ return new DataView(d.buffer).setUint16(a, p, !0), $r.encode(d);
4672
4653
  }
4673
4654
  static _decode(e) {
4674
4655
  if (e.byteLength < 4)
@@ -4777,8 +4758,8 @@ class so {
4777
4758
  }
4778
4759
  }
4779
4760
  function ro(r) {
4780
- const e = new TextEncoder().encode(r), t = be._decode(e), s = ot.parsePrefix(t[0]);
4781
- if (ot.isValidPublicPrefix(s))
4761
+ const e = new TextEncoder().encode(r), t = be._decode(e), s = nt.parsePrefix(t[0]);
4762
+ if (nt.isValidPublicPrefix(s))
4782
4763
  return new so(e);
4783
4764
  throw new G(K.InvalidPublicKey);
4784
4765
  }
@@ -4919,8 +4900,8 @@ function _o(r, e) {
4919
4900
  if (e.tls && !n)
4920
4901
  throw new T("tls", k.ServerOptionNotAvailable);
4921
4902
  }
4922
- const yo = 1024 * 32, wo = /^INFO\s+([^\r\n]+)\r\n/i, xo = Pt(`PONG\r
4923
- `), qr = Pt(`PING\r
4903
+ const yo = 1024 * 32, wo = /^INFO\s+([^\r\n]+)\r\n/i, xo = kt(`PONG\r
4904
+ `), qr = kt(`PING\r
4924
4905
  `);
4925
4906
  class So {
4926
4907
  constructor(e, t, s) {
@@ -4963,7 +4944,7 @@ class li extends he {
4963
4944
  h(this, "requestSubject");
4964
4945
  cs(this, i), this.protocol = t, this.subject = s, this.draining = !1, this.noIterator = typeof i.callback == "function", this.closed = Y();
4965
4946
  const n = !((o = t.options) != null && o.noAsyncTraces);
4966
- i.timeout && (this.timer = lt(i.timeout, n), this.timer.then(() => {
4947
+ i.timeout && (this.timer = ut(i.timeout, n), this.timer.then(() => {
4967
4948
  this.timer = void 0;
4968
4949
  }).catch((a) => {
4969
4950
  this.stop(a), this.noIterator && this.callback(a, {});
@@ -4978,9 +4959,9 @@ class li extends he {
4978
4959
  protocol: !1
4979
4960
  }), n = t.protocolFilterFn ? t.protocolFilterFn : () => !0, o = t.dispatchedFn ? t.dispatchedFn : () => {
4980
4961
  };
4981
- this.callback = (a, f) => {
4982
- const { ingest: p } = i(f);
4983
- p && n(f) && (s(a, f), o(f));
4962
+ this.callback = (a, d) => {
4963
+ const { ingest: p } = i(d);
4964
+ p && n(d) && (s(a, d), o(d));
4984
4965
  };
4985
4966
  } else
4986
4967
  this.protocolFilterFn = t.protocolFilterFn, this.dispatchedFn = t.dispatchedFn;
@@ -5109,7 +5090,7 @@ class os {
5109
5090
  h(this, "server");
5110
5091
  h(this, "features");
5111
5092
  h(this, "connectPromise");
5112
- this._closed = !1, this.connected = !1, this.connectedOnce = !1, this.infoReceived = !1, this.noMorePublishing = !1, this.abortReconnect = !1, this.listeners = [], this.pendingLimit = yo, this.outMsgs = 0, this.inMsgs = 0, this.outBytes = 0, this.inBytes = 0, this.options = e, this.publisher = t, this.subscriptions = new vo(), this.muxSubscriptions = new Kn(), this.outbound = new dt(), this.pongs = [], this.whyClosed = "", this.pendingLimit = e.pendingLimit || this.pendingLimit, this.features = new An({
5093
+ this._closed = !1, this.connected = !1, this.connectedOnce = !1, this.infoReceived = !1, this.noMorePublishing = !1, this.abortReconnect = !1, this.listeners = [], this.pendingLimit = yo, this.outMsgs = 0, this.inMsgs = 0, this.outBytes = 0, this.inBytes = 0, this.options = e, this.publisher = t, this.subscriptions = new vo(), this.muxSubscriptions = new Kn(), this.outbound = new ft(), this.pongs = [], this.whyClosed = "", this.pendingLimit = e.pendingLimit || this.pendingLimit, this.features = new An({
5113
5094
  major: 0,
5114
5095
  minor: 0,
5115
5096
  micro: 0
@@ -5182,7 +5163,7 @@ class os {
5182
5163
  const t = this.prepare();
5183
5164
  let s;
5184
5165
  try {
5185
- s = lt(this.options.timeout || 2e4);
5166
+ s = ut(this.options.timeout || 2e4);
5186
5167
  const i = this.transport.connect(e, this.options);
5187
5168
  await Promise.race([
5188
5169
  i,
@@ -5260,7 +5241,7 @@ class os {
5260
5241
  a !== -1 && i.reconnects >= a && this.servers.removeCurrentServer();
5261
5242
  }
5262
5243
  } else
5263
- s = Math.min(s, i.lastConnect + t - n), await pt(s);
5244
+ s = Math.min(s, i.lastConnect + t - n), await dt(s);
5264
5245
  }
5265
5246
  }
5266
5247
  static async connect(e, t) {
@@ -5323,7 +5304,7 @@ class os {
5323
5304
  this.info = t;
5324
5305
  const s = this.options && this.options.ignoreClusterUpdates ? void 0 : this.servers.update(t, this.transport.isEncrypted());
5325
5306
  if (!this.infoReceived) {
5326
- this.features.update(Qe(t.version)), this.infoReceived = !0, this.transport.isEncrypted() && this.servers.updateTLSName();
5307
+ this.features.update(Ze(t.version)), this.infoReceived = !0, this.transport.isEncrypted() && this.servers.updateTLSName();
5327
5308
  const { version: n, lang: o } = this.transport;
5328
5309
  try {
5329
5310
  const a = new So({
@@ -5331,8 +5312,8 @@ class os {
5331
5312
  lang: o
5332
5313
  }, this.options, t.nonce);
5333
5314
  t.headers && (a.headers = !0, a.no_responders = !0);
5334
- const f = JSON.stringify(a);
5335
- this.transport.send(Pt(`CONNECT ${f}${Yt}`)), this.transport.send(qr);
5315
+ const d = JSON.stringify(a);
5316
+ this.transport.send(kt(`CONNECT ${d}${Yt}`)), this.transport.send(qr);
5336
5317
  } catch (a) {
5337
5318
  this._close(a);
5338
5319
  }
@@ -5371,7 +5352,7 @@ class os {
5371
5352
  sendCommand(e, ...t) {
5372
5353
  const s = this.outbound.length();
5373
5354
  let i;
5374
- typeof e == "string" ? i = Pt(e) : i = e, this.outbound.fill(i, ...t), s === 0 ? queueMicrotask(() => {
5355
+ typeof e == "string" ? i = kt(e) : i = e, this.outbound.fill(i, ...t), s === 0 ? queueMicrotask(() => {
5375
5356
  this.flushPending();
5376
5357
  }) : this.outbound.size() >= this.pendingLimit && this.flushPending();
5377
5358
  }
@@ -5394,12 +5375,12 @@ class os {
5394
5375
  if (this.info && n > this.info.max_payload)
5395
5376
  throw T.errorForCode(k.MaxPayloadExceeded);
5396
5377
  this.outBytes += n, this.outMsgs++;
5397
- let f;
5398
- s.headers ? (s.reply ? f = `HPUB ${e} ${s.reply} ${a} ${n}\r
5399
- ` : f = `HPUB ${e} ${a} ${n}\r
5400
- `, this.sendCommand(f, o, i, is)) : (s.reply ? f = `PUB ${e} ${s.reply} ${n}\r
5401
- ` : f = `PUB ${e} ${n}\r
5402
- `, this.sendCommand(f, i, is));
5378
+ let d;
5379
+ s.headers ? (s.reply ? d = `HPUB ${e} ${s.reply} ${a} ${n}\r
5380
+ ` : d = `HPUB ${e} ${a} ${n}\r
5381
+ `, this.sendCommand(d, o, i, is)) : (s.reply ? d = `PUB ${e} ${s.reply} ${n}\r
5382
+ ` : d = `PUB ${e} ${n}\r
5383
+ `, this.sendCommand(d, i, is));
5403
5384
  }
5404
5385
  request(e) {
5405
5386
  return this.initMux(), this.muxSubscriptions.add(e), e;
@@ -5434,7 +5415,7 @@ class os {
5434
5415
  this.subscriptions.all().forEach((t) => {
5435
5416
  const s = t;
5436
5417
  s.queue ? e.push(`SUB ${s.subject} ${s.queue} ${s.sid}${Yt}`) : e.push(`SUB ${s.subject} ${s.sid}${Yt}`);
5437
- }), e.length && this.transport.send(Pt(e.join("")));
5418
+ }), e.length && this.transport.send(kt(e.join("")));
5438
5419
  }
5439
5420
  async _close(e) {
5440
5421
  this._closed || (this.whyClosed = new Error("close trace").stack || "", this.heartbeats.cancel(), this.connectError && (this.connectError(e), this.connectError = void 0), this.muxSubscriptions.close(), this.subscriptions.close(), this.listeners.forEach((t) => {
@@ -5510,16 +5491,16 @@ class Fr {
5510
5491
  return this.msg.string();
5511
5492
  }
5512
5493
  }
5513
- class jt {
5494
+ class Rt {
5514
5495
  constructor(e, t = "", s = "") {
5515
5496
  h(this, "subject");
5516
5497
  h(this, "queue");
5517
5498
  h(this, "srv");
5518
5499
  t !== "" && Po("service group", t);
5519
5500
  let i = "";
5520
- if (e instanceof Mt)
5501
+ if (e instanceof Ut)
5521
5502
  this.srv = e, i = "";
5522
- else if (e instanceof jt) {
5503
+ else if (e instanceof Rt) {
5523
5504
  const n = e;
5524
5505
  this.srv = n.srv, s === "" && n.queue !== "" && (s = n.queue), i = n.subject;
5525
5506
  } else
@@ -5537,20 +5518,20 @@ class jt {
5537
5518
  handler: t,
5538
5519
  subject: e
5539
5520
  } : t;
5540
- Et("endpoint", e);
5521
+ At("endpoint", e);
5541
5522
  let { subject: i, handler: n, metadata: o, queue: a } = s;
5542
5523
  i = i || e, a = a || this.queue, Ao("endpoint subject", i), i = this.calcSubject(this.subject, i);
5543
- const f = {
5524
+ const d = {
5544
5525
  name: e,
5545
5526
  subject: i,
5546
5527
  queue: a,
5547
5528
  handler: n,
5548
5529
  metadata: o
5549
5530
  };
5550
- return this.srv._addEndpoint(f);
5531
+ return this.srv._addEndpoint(d);
5551
5532
  }
5552
5533
  addGroup(e = "", t = "") {
5553
- return new jt(this, e, t);
5534
+ return new Rt(this, e, t);
5554
5535
  }
5555
5536
  }
5556
5537
  function Ao(r, e) {
@@ -5572,7 +5553,7 @@ function Po(r, e) {
5572
5553
  throw new Error(`${r} name cannot contain internal '>': '${e}'`);
5573
5554
  });
5574
5555
  }
5575
- class Mt {
5556
+ class Ut {
5576
5557
  constructor(e, t = {
5577
5558
  name: "",
5578
5559
  version: ""
@@ -5585,7 +5566,7 @@ class Mt {
5585
5566
  h(this, "_stopped");
5586
5567
  h(this, "_done");
5587
5568
  h(this, "started");
5588
- this.nc = e, this.config = Object.assign({}, t), this.config.queue || (this.config.queue = "q"), Et("name", this.config.name), Et("queue", this.config.queue), Qe(this.config.version), this._id = Ge.next(), this.internal = [], this._done = Y(), this._stopped = !1, this.handlers = [], this.started = (/* @__PURE__ */ new Date()).toISOString(), this.reset(), this.nc.closed().then(() => {
5569
+ this.nc = e, this.config = Object.assign({}, t), this.config.queue || (this.config.queue = "q"), At("name", this.config.name), At("queue", this.config.queue), Ze(this.config.version), this._id = Ge.next(), this.internal = [], this._done = Y(), this._stopped = !1, this.handlers = [], this.started = (/* @__PURE__ */ new Date()).toISOString(), this.reset(), this.nc.closed().then(() => {
5589
5570
  this.close().catch();
5590
5571
  }).catch((s) => {
5591
5572
  this.close(s).catch();
@@ -5593,7 +5574,7 @@ class Mt {
5593
5574
  }
5594
5575
  static controlSubject(e, t = "", s = "", i) {
5595
5576
  const n = i ?? Eo;
5596
- return t === "" && s === "" ? `${n}.${e}` : (Et("control subject name", t), s !== "" ? (Et("control subject id", s), `${n}.${e}.${t}.${s}`) : `${n}.${e}.${t}`);
5577
+ return t === "" && s === "" ? `${n}.${e}` : (At("control subject name", t), s !== "" ? (At("control subject id", s), `${n}.${e}.${t}.${s}`) : `${n}.${e}.${t}`);
5597
5578
  }
5598
5579
  get subjects() {
5599
5580
  return this.handlers.filter((e) => e.internal === !1).map((e) => e.subject);
@@ -5625,7 +5606,7 @@ class Mt {
5625
5606
  setupHandler(e, t = !1) {
5626
5607
  const s = t ? "" : e.queue ? e.queue : this.config.queue, { name: i, subject: n, handler: o } = e, a = e;
5627
5608
  a.internal = t, t && this.internal.push(a), a.stats = new ko(i, n, s), a.queue = s;
5628
- const f = o ? (p, g) => {
5609
+ const d = o ? (p, g) => {
5629
5610
  if (p) {
5630
5611
  this.close(p);
5631
5612
  return;
@@ -5642,7 +5623,7 @@ class Mt {
5642
5623
  }
5643
5624
  } : void 0;
5644
5625
  return a.sub = this.nc.subscribe(n, {
5645
- callback: f,
5626
+ callback: d,
5646
5627
  queue: s
5647
5628
  }), a.sub.closed.then(() => {
5648
5629
  this._stopped || this.close(new Error(`required subscription ${e.subject} stopped`)).catch();
@@ -5655,7 +5636,7 @@ class Mt {
5655
5636
  }
5656
5637
  info() {
5657
5638
  return {
5658
- type: kt.INFO,
5639
+ type: Ot.INFO,
5659
5640
  name: this.name,
5660
5641
  id: this.id,
5661
5642
  version: this.version,
@@ -5687,7 +5668,7 @@ class Mt {
5687
5668
  e.push(t.stats.stats(t.qi));
5688
5669
  }
5689
5670
  return {
5690
- type: kt.STATS,
5671
+ type: Ot.STATS,
5691
5672
  name: this.name,
5692
5673
  id: this.id,
5693
5674
  version: this.version,
@@ -5702,10 +5683,10 @@ class Mt {
5702
5683
  }
5703
5684
  _doAddInternalHandler(e, t, s, i = "", n = "") {
5704
5685
  const o = {};
5705
- o.name = e, o.subject = Mt.controlSubject(t, i, n), o.handler = s, this.setupHandler(o, !0);
5686
+ o.name = e, o.subject = Ut.controlSubject(t, i, n), o.handler = s, this.setupHandler(o, !0);
5706
5687
  }
5707
5688
  start() {
5708
- const e = Oe(), 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());
5689
+ const e = Oe(), t = (o, a) => o ? (this.close(o), Promise.reject(o)) : this.stats().then((d) => (a == null || a.respond(e.encode(d)), 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());
5709
5690
  return this.addInternalHandler(Je.PING, n), this.addInternalHandler(Je.STATS, t), this.addInternalHandler(Je.INFO, s), this.handlers.forEach((o) => {
5710
5691
  const { subject: a } = o;
5711
5692
  typeof a == "string" && o.handler !== null && this.setupHandler(o);
@@ -5731,7 +5712,7 @@ class Mt {
5731
5712
  }
5732
5713
  ping() {
5733
5714
  return {
5734
- type: kt.PING,
5715
+ type: Ot.PING,
5735
5716
  name: this.name,
5736
5717
  id: this.id,
5737
5718
  version: this.version,
@@ -5744,10 +5725,10 @@ class Mt {
5744
5725
  e.stats.reset(e.qi);
5745
5726
  }
5746
5727
  addGroup(e, t) {
5747
- return new jt(this, e, t);
5728
+ return new Rt(this, e, t);
5748
5729
  }
5749
5730
  addEndpoint(e, t) {
5750
- return new jt(this).addEndpoint(e, t);
5731
+ return new Rt(this).addEndpoint(e, t);
5751
5732
  }
5752
5733
  _addEndpoint(e) {
5753
5734
  const t = new he();
@@ -5786,7 +5767,7 @@ class ko {
5786
5767
  this.num_errors++, this.last_error = e.message;
5787
5768
  }
5788
5769
  _stats() {
5789
- 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;
5770
+ const { name: e, subject: t, average_processing_time: s, num_errors: i, num_requests: n, processing_time: o, last_error: a, data: d, queue: p } = this;
5790
5771
  return {
5791
5772
  name: e,
5792
5773
  subject: t,
@@ -5795,7 +5776,7 @@ class ko {
5795
5776
  num_requests: n,
5796
5777
  processing_time: o,
5797
5778
  last_error: a,
5798
- data: f,
5779
+ data: d,
5799
5780
  queue_group: p
5800
5781
  };
5801
5782
  }
@@ -5824,11 +5805,11 @@ class Oo {
5824
5805
  return this.q(Je.INFO, e, t);
5825
5806
  }
5826
5807
  async q(e, t = "", s = "") {
5827
- const i = new he(), n = Oe(), o = Mt.controlSubject(e, t, s, this.prefix), a = await this.nc.requestMany(o, ve, this.opts);
5808
+ const i = new he(), n = Oe(), o = Ut.controlSubject(e, t, s, this.prefix), a = await this.nc.requestMany(o, ve, this.opts);
5828
5809
  return (async () => {
5829
- for await (const f of a)
5810
+ for await (const d of a)
5830
5811
  try {
5831
- const p = n.decode(f.data);
5812
+ const p = n.decode(d.data);
5832
5813
  i.push(p);
5833
5814
  } catch (p) {
5834
5815
  i.push(() => {
@@ -5838,8 +5819,8 @@ class Oo {
5838
5819
  i.push(() => {
5839
5820
  i.stop();
5840
5821
  });
5841
- })().catch((f) => {
5842
- i.stop(f);
5822
+ })().catch((d) => {
5823
+ i.stop(d);
5843
5824
  }), i;
5844
5825
  }
5845
5826
  }
@@ -5909,7 +5890,7 @@ var Ue;
5909
5890
  (function(r) {
5910
5891
  r.MsgIdHdr = "Nats-Msg-Id", r.ExpectedStreamHdr = "Nats-Expected-Stream", r.ExpectedLastSeqHdr = "Nats-Expected-Last-Sequence", r.ExpectedLastMsgIdHdr = "Nats-Expected-Last-Msg-Id", r.ExpectedLastSubjectSequenceHdr = "Nats-Expected-Last-Subject-Sequence";
5911
5892
  })(Ue || (Ue = {}));
5912
- class Rt {
5893
+ class Nt {
5913
5894
  constructor(e, t, s) {
5914
5895
  h(this, "js");
5915
5896
  h(this, "jsm");
@@ -5928,7 +5909,7 @@ class Rt {
5928
5909
  }
5929
5910
  static async create(e, t, s = {}) {
5930
5911
  Xt(t);
5931
- const i = await e.jetstreamManager(), n = new Rt(t, e, i);
5912
+ const i = await e.jetstreamManager(), n = new Nt(t, e, i);
5932
5913
  return await n.init(s), n;
5933
5914
  }
5934
5915
  static async bind(e, t, s = {}) {
@@ -5938,7 +5919,7 @@ class Rt {
5938
5919
  }
5939
5920
  };
5940
5921
  Xt(t);
5941
- const o = new Rt(t, e, i);
5922
+ const o = new Nt(t, e, i);
5942
5923
  return n.config.name = s.streamName ?? o.bucketName(), Object.assign(o, n), o.stream = n.config.name, o.codec = s.codec || fi(), o.direct = n.config.allow_direct ?? !1, o.initializePrefixes(n), o;
5943
5924
  }
5944
5925
  async init(e = {}) {
@@ -5952,10 +5933,10 @@ class Rt {
5952
5933
  y.name.startsWith(we) || (y.name = `${we}${y.name}`), s.mirror = y, s.mirror_direct = !0;
5953
5934
  } else if (e.sources) {
5954
5935
  const y = e.sources.map((x) => {
5955
- const A = Object.assign({}, x), I = A.name.startsWith(we) ? A.name.substring(we.length) : A.name;
5956
- return A.name.startsWith(we) || (A.name = `${we}${A.name}`), !x.external && I !== this.bucket && (A.subject_transforms = [
5936
+ const A = Object.assign({}, x), O = A.name.startsWith(we) ? A.name.substring(we.length) : A.name;
5937
+ return A.name.startsWith(we) || (A.name = `${we}${A.name}`), !x.external && O !== this.bucket && (A.subject_transforms = [
5957
5938
  {
5958
- src: `$KV.${I}.>`,
5939
+ src: `$KV.${O}.>`,
5959
5940
  dest: `$KV.${this.bucket}.>`
5960
5941
  }
5961
5942
  ]), A;
@@ -5968,14 +5949,14 @@ class Rt {
5968
5949
  this.subjectForBucket()
5969
5950
  ];
5970
5951
  e.metadata && (s.metadata = e.metadata), typeof e.compression == "boolean" && (s.compression = e.compression ? Ve.S2 : Ve.None);
5971
- const n = this.js.nc, o = n.getServerVersion(), a = o ? Ds(o, Qe("2.7.2")) >= 0 : !1;
5972
- s.discard = a ? It.New : It.Old;
5973
- const { ok: f, min: p } = n.features.get(H.JS_ALLOW_DIRECT);
5974
- if (!f && e.allow_direct === !0) {
5952
+ const n = this.js.nc, o = n.getServerVersion(), a = o ? Ds(o, Ze("2.7.2")) >= 0 : !1;
5953
+ s.discard = a ? jt.New : jt.Old;
5954
+ const { ok: d, min: p } = n.features.get(J.JS_ALLOW_DIRECT);
5955
+ if (!d && e.allow_direct === !0) {
5975
5956
  const y = o ? `${o.major}.${o.minor}.${o.micro}` : "unknown";
5976
5957
  return Promise.reject(new Error(`allow_direct is not available on server version ${y} - requires ${p}`));
5977
5958
  }
5978
- 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 = W(t.ttl)), s.allow_rollup_hdrs = !0;
5959
+ e.allow_direct = typeof e.allow_direct == "boolean" ? e.allow_direct : d, s.allow_direct = e.allow_direct, this.direct = s.allow_direct, s.num_replicas = t.replicas, t.ttl && (s.max_age = W(t.ttl)), s.allow_rollup_hdrs = !0;
5979
5960
  let g;
5980
5961
  try {
5981
5962
  g = await this.jsm.streams.info(s.name), !g.config.allow_direct && this.direct === !0 && (this.direct = !1);
@@ -6090,14 +6071,14 @@ class Rt {
6090
6071
  this.validateKey(i);
6091
6072
  const n = {};
6092
6073
  if (s.previousSeq !== void 0) {
6093
- const f = Fe();
6094
- n.headers = f, f.set(Ue.ExpectedLastSubjectSequenceHdr, `${s.previousSeq}`);
6074
+ const d = Fe();
6075
+ n.headers = d, d.set(Ue.ExpectedLastSubjectSequenceHdr, `${s.previousSeq}`);
6095
6076
  }
6096
6077
  try {
6097
6078
  return (await this.js.publish(this.subjectForKey(i, !0), t, n)).seq;
6098
- } catch (f) {
6099
- const p = f;
6100
- 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);
6079
+ } catch (d) {
6080
+ const p = d;
6081
+ 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(d);
6101
6082
  }
6102
6083
  }
6103
6084
  async get(e, t) {
@@ -6134,12 +6115,12 @@ class Rt {
6134
6115
  }
6135
6116
  });
6136
6117
  (async () => {
6137
- for await (const f of i)
6138
- (f.operation === "DEL" || f.operation === "PURGE") && s.push(f);
6118
+ for await (const d of i)
6119
+ (d.operation === "DEL" || d.operation === "PURGE") && s.push(d);
6139
6120
  })().then(), await t, i.stop();
6140
- const n = Date.now() - e, o = s.map((f) => {
6141
- const p = this.subjectForKey(f.key);
6142
- return f.created.getTime() >= n ? this.jsm.streams.purge(this.stream, {
6121
+ const n = Date.now() - e, o = s.map((d) => {
6122
+ const p = this.subjectForKey(d.key);
6123
+ return d.created.getTime() >= n ? this.jsm.streams.purge(this.stream, {
6143
6124
  filter: p,
6144
6125
  keep: 1
6145
6126
  }) : this.jsm.streams.purge(this.stream, {
@@ -6150,7 +6131,7 @@ class Rt {
6150
6131
  return a.unshift({
6151
6132
  success: !0,
6152
6133
  purged: 0
6153
- }), a.reduce((f, p) => (f.purged += p.purged, f));
6134
+ }), a.reduce((d, p) => (d.purged += p.purged, d));
6154
6135
  }
6155
6136
  async _deleteOrPurge(e, t, s) {
6156
6137
  if (!this.hasWildcards(e))
@@ -6171,9 +6152,9 @@ class Rt {
6171
6152
  _buildCC(e, t, s = {}) {
6172
6153
  let n = (Array.isArray(e) ? e : [
6173
6154
  e
6174
- ]).map((f) => {
6175
- const p = this.encodeKey(f);
6176
- return this.validateSearchKey(f), this.fullKeyName(p);
6155
+ ]).map((d) => {
6156
+ const p = this.encodeKey(d);
6157
+ return this.validateSearchKey(d), this.fullKeyName(p);
6177
6158
  }), o = se.LastPerSubject;
6178
6159
  t === Re.AllHistory && (o = se.All), t === Re.UpdatesOnly && (o = se.New);
6179
6160
  let a;
@@ -6197,7 +6178,7 @@ class Rt {
6197
6178
  s.stop();
6198
6179
  };
6199
6180
  let o = 0;
6200
- const a = this._buildCC(t, Re.AllHistory, i), f = a.filter_subject, p = ze(a);
6181
+ const a = this._buildCC(t, Re.AllHistory, i), d = a.filter_subject, p = ze(a);
6201
6182
  p.bindStream(this.stream), p.orderedConsumer(), p.callback((y, x) => {
6202
6183
  if (y) {
6203
6184
  s.stop(y);
@@ -6208,7 +6189,7 @@ class Rt {
6208
6189
  s.push(A), s.received++, (n && o > 0 && s.received >= o || x.info.pending === 0) && (s.push(n), n = void 0);
6209
6190
  }
6210
6191
  });
6211
- const g = await this.js.subscribe(f, p);
6192
+ const g = await this.js.subscribe(d, p);
6212
6193
  if (n) {
6213
6194
  const { info: { last: y } } = g, x = y.num_pending + y.delivered.consumer_seq;
6214
6195
  if (x === 0 || s.received >= x)
@@ -6231,7 +6212,7 @@ class Rt {
6231
6212
  }), s;
6232
6213
  }
6233
6214
  canSetWatcherName() {
6234
- const t = this.js.nc, { ok: s } = t.features.get(H.JS_NEW_CONSUMER_CREATE_API);
6215
+ const t = this.js.nc, { ok: s } = t.features.get(J.JS_NEW_CONSUMER_CREATE_API);
6235
6216
  return s;
6236
6217
  }
6237
6218
  async watch(e = {}) {
@@ -6240,33 +6221,33 @@ class Rt {
6240
6221
  let n = Re.LastValue;
6241
6222
  e.include === Re.AllHistory ? n = Re.AllHistory : e.include === Re.UpdatesOnly && (n = Re.UpdatesOnly);
6242
6223
  const o = e.ignoreDeletes === !0;
6243
- let a = e.initializedFn, f = 0;
6224
+ let a = e.initializedFn, d = 0;
6244
6225
  const p = this._buildCC(t, n, i), g = p.filter_subject, y = ze(p);
6245
- this.canSetWatcherName() && y.consumerName(Ge.next()), y.bindStream(this.stream), e.resumeFromRevision && e.resumeFromRevision > 0 && y.startSequence(e.resumeFromRevision), y.orderedConsumer(), y.callback((A, I) => {
6226
+ this.canSetWatcherName() && y.consumerName(Ge.next()), y.bindStream(this.stream), e.resumeFromRevision && e.resumeFromRevision > 0 && y.startSequence(e.resumeFromRevision), y.orderedConsumer(), y.callback((A, O) => {
6246
6227
  if (A) {
6247
6228
  s.stop(A);
6248
6229
  return;
6249
6230
  }
6250
- if (I) {
6251
- const N = this.jmToEntry(I);
6252
- if (o && N.operation === "DEL")
6231
+ if (O) {
6232
+ const j = this.jmToEntry(O);
6233
+ if (o && j.operation === "DEL")
6253
6234
  return;
6254
- s.push(N), s.received++, a && (f > 0 && s.received >= f || I.info.pending === 0) && (s.push(a), a = void 0);
6235
+ s.push(j), s.received++, a && (d > 0 && s.received >= d || O.info.pending === 0) && (s.push(a), a = void 0);
6255
6236
  }
6256
6237
  });
6257
6238
  const x = await this.js.subscribe(g, y);
6258
6239
  if (a) {
6259
- const { info: { last: A } } = x, I = A.num_pending + A.delivered.consumer_seq;
6260
- if (I === 0 || s.received >= I)
6240
+ const { info: { last: A } } = x, O = A.num_pending + A.delivered.consumer_seq;
6241
+ if (O === 0 || s.received >= O)
6261
6242
  try {
6262
6243
  a();
6263
- } catch (N) {
6264
- s.stop(N);
6244
+ } catch (j) {
6245
+ s.stop(j);
6265
6246
  } finally {
6266
6247
  a = void 0;
6267
6248
  }
6268
6249
  else
6269
- f = I;
6250
+ d = O;
6270
6251
  }
6271
6252
  return s._data = x, s.iterClosed.then(() => {
6272
6253
  x.unsubscribe();
@@ -6283,9 +6264,9 @@ class Rt {
6283
6264
  n.bindStream(this.stream), n.orderedConsumer();
6284
6265
  const o = await this.js.subscribe(i, n);
6285
6266
  return (async () => {
6286
- var f;
6267
+ var d;
6287
6268
  for await (const p of o) {
6288
- const g = (f = p.headers) == null ? void 0 : f.get(as);
6269
+ const g = (d = p.headers) == null ? void 0 : d.get(as);
6289
6270
  if (g !== "DEL" && g !== "PURGE") {
6290
6271
  const y = this.decodeKey(p.subject.substring(this.prefixLen));
6291
6272
  t.push(y);
@@ -6294,8 +6275,8 @@ class Rt {
6294
6275
  }
6295
6276
  })().then(() => {
6296
6277
  t.stop();
6297
- }).catch((f) => {
6298
- t.stop(f);
6278
+ }).catch((d) => {
6279
+ t.stop(d);
6299
6280
  }), o.info.last.num_pending === 0 && o.unsubscribe(), t;
6300
6281
  }
6301
6282
  purgeBucket(e) {
@@ -6425,7 +6406,7 @@ class zs {
6425
6406
  return this.si.config.compression ? this.si.config.compression !== Ve.None : !1;
6426
6407
  }
6427
6408
  }
6428
- function Vt(r) {
6409
+ function Wt(r) {
6429
6410
  if (r === void 0)
6430
6411
  return;
6431
6412
  const { domain: e } = r;
@@ -6448,12 +6429,12 @@ var $e;
6448
6429
  (function(r) {
6449
6430
  r.HeartbeatsMissed = "heartbeats_missed", r.ConsumerNotFound = "consumer_not_found", r.StreamNotFound = "stream_not_found", r.ConsumerDeleted = "consumer_deleted", r.OrderedConsumerRecreated = "ordered_consumer_recreated", r.NoResponders = "no_responders";
6450
6431
  })($e || ($e = {}));
6451
- var ut;
6432
+ var ht;
6452
6433
  (function(r) {
6453
6434
  r.DebugEvent = "debug", r.Discard = "discard", r.Reset = "reset", r.Next = "next";
6454
- })(ut || (ut = {}));
6435
+ })(ht || (ht = {}));
6455
6436
  const Hr = Uint8Array.of(43, 65, 67, 75), Lo = Uint8Array.of(45, 78, 65, 75), vt = Uint8Array.of(43, 87, 80, 73), qo = Uint8Array.of(43, 78, 88, 84), Fo = Uint8Array.of(43, 84, 69, 82, 77), Bo = Uint8Array.of(32);
6456
- function Nt(r, e = 5e3) {
6437
+ function Tt(r, e = 5e3) {
6457
6438
  return new ia(r, e);
6458
6439
  }
6459
6440
  class Ns extends he {
@@ -6487,53 +6468,53 @@ class Ns extends he {
6487
6468
  }
6488
6469
  start() {
6489
6470
  const { max_messages: t, max_bytes: s, idle_heartbeat: i, threshold_bytes: n, threshold_messages: o } = this.opts;
6490
- this.closed().then((f) => {
6471
+ this.closed().then((d) => {
6491
6472
  if (this.cleanupHandler)
6492
6473
  try {
6493
- this.cleanupHandler(f);
6474
+ this.cleanupHandler(d);
6494
6475
  } catch {
6495
6476
  }
6496
6477
  });
6497
6478
  const { sub: a } = this;
6498
6479
  a && a.unsubscribe(), this.sub = this.consumer.api.nc.subscribe(this.inbox, {
6499
- callback: (f, p) => {
6500
- var y, x, A, I;
6501
- if (f) {
6502
- this.stop(f);
6480
+ callback: (d, p) => {
6481
+ var y, x, A, O;
6482
+ if (d) {
6483
+ this.stop(d);
6503
6484
  return;
6504
6485
  }
6505
6486
  if ((y = this.monitor) == null || y.work(), p.subject === this.inbox) {
6506
6487
  if (Ls(p))
6507
6488
  return;
6508
- const N = (x = p.headers) == null ? void 0 : x.code, J = ((I = (A = p.headers) == null ? void 0 : A.description) == null ? void 0 : I.toLowerCase()) || "unknown", { msgsLeft: ee, bytesLeft: L } = this.parseDiscard(p.headers);
6509
- if (ee > 0 || L > 0)
6510
- this.pending.msgs -= ee, this.pending.bytes -= L, this.pending.requests--, this.notify(ut.Discard, {
6511
- msgsLeft: ee,
6489
+ const j = (x = p.headers) == null ? void 0 : x.code, B = ((O = (A = p.headers) == null ? void 0 : A.description) == null ? void 0 : O.toLowerCase()) || "unknown", { msgsLeft: Q, bytesLeft: L } = this.parseDiscard(p.headers);
6490
+ if (Q > 0 || L > 0)
6491
+ this.pending.msgs -= Q, this.pending.bytes -= L, this.pending.requests--, this.notify(ht.Discard, {
6492
+ msgsLeft: Q,
6512
6493
  bytesLeft: L
6513
6494
  });
6514
- else if (N === 400) {
6515
- this.stop(new T(J, `${N}`));
6495
+ else if (j === 400) {
6496
+ this.stop(new T(B, `${j}`));
6516
6497
  return;
6517
- } else if (N === 409 && J === "consumer deleted") {
6518
- if (this.notify($e.ConsumerDeleted, `${N} ${J}`), !this.refilling || this.abortOnMissingResource) {
6519
- const Q = new T(J, `${N}`);
6520
- this.stop(Q);
6498
+ } else if (j === 409 && B === "consumer deleted") {
6499
+ if (this.notify($e.ConsumerDeleted, `${j} ${B}`), !this.refilling || this.abortOnMissingResource) {
6500
+ const ee = new T(B, `${j}`);
6501
+ this.stop(ee);
6521
6502
  return;
6522
6503
  }
6523
- } else if (N === 503) {
6524
- if (this.notify($e.NoResponders, `${N} No Responders`), !this.refilling || this.abortOnMissingResource) {
6525
- const Q = new T("no responders", `${N}`);
6526
- this.stop(Q);
6504
+ } else if (j === 503) {
6505
+ if (this.notify($e.NoResponders, `${j} No Responders`), !this.refilling || this.abortOnMissingResource) {
6506
+ const ee = new T("no responders", `${j}`);
6507
+ this.stop(ee);
6527
6508
  return;
6528
6509
  }
6529
6510
  } else
6530
- this.notify(ut.DebugEvent, `${N} ${J}`);
6511
+ this.notify(ht.DebugEvent, `${j} ${B}`);
6531
6512
  } else
6532
- this._push(Nt(p, this.consumer.api.timeout)), this.received++, this.pending.msgs && this.pending.msgs--, this.pending.bytes && (this.pending.bytes -= p.size());
6513
+ this._push(Tt(p, this.consumer.api.timeout)), this.received++, this.pending.msgs && this.pending.msgs--, this.pending.bytes && (this.pending.bytes -= p.size());
6533
6514
  if (this.pending.msgs === 0 && this.pending.bytes === 0 && (this.pending.requests = 0), this.refilling) {
6534
6515
  if (t && this.pending.msgs <= o || s && this.pending.bytes <= n) {
6535
- const N = this.pullOptions();
6536
- this.pull(N);
6516
+ const j = this.pullOptions();
6517
+ this.pull(j);
6537
6518
  }
6538
6519
  } else this.pending.requests === 0 && this._push(() => {
6539
6520
  this.stop();
@@ -6543,15 +6524,15 @@ class Ns extends he {
6543
6524
  this.sub.draining && this._push(() => {
6544
6525
  this.stop();
6545
6526
  });
6546
- }), i && (this.monitor = new er(i, (f) => (this.notify($e.HeartbeatsMissed, f), this.resetPending().then(() => {
6527
+ }), i && (this.monitor = new er(i, (d) => (this.notify($e.HeartbeatsMissed, d), this.resetPending().then(() => {
6547
6528
  }).catch(() => {
6548
6529
  }), !1), {
6549
6530
  maxOut: 2
6550
6531
  })), (async () => {
6551
6532
  var p;
6552
- const f = this.consumer.api.nc.status();
6553
- this.statusIterator = f;
6554
- for await (const g of f)
6533
+ const d = this.consumer.api.nc.status();
6534
+ this.statusIterator = d;
6535
+ for await (const g of d)
6555
6536
  switch (g.type) {
6556
6537
  case ke.Disconnect:
6557
6538
  (p = this.monitor) == null || p.cancel();
@@ -6624,11 +6605,11 @@ class Ns extends he {
6624
6605
  } else
6625
6606
  t = 0, s = 0;
6626
6607
  this.inBackOff = !0;
6627
- const a = i.backoff(n), f = pt(a);
6608
+ const a = i.backoff(n), d = dt(a);
6628
6609
  await Promise.race([
6629
- f,
6610
+ d,
6630
6611
  this.consumer.api.nc.closed()
6631
- ]), f.cancel(), n++;
6612
+ ]), d.cancel(), n++;
6632
6613
  }
6633
6614
  }
6634
6615
  }
@@ -6638,7 +6619,7 @@ class Ns extends he {
6638
6619
  this._push(() => {
6639
6620
  s.publish(`${this.consumer.api.prefix}.CONSUMER.MSG.NEXT.${this.consumer.stream}.${this.consumer.name}`, this.consumer.api.jc.encode(t), {
6640
6621
  reply: this.inbox
6641
- }), this.notify(ut.Next, t);
6622
+ }), this.notify(ht.Next, t);
6642
6623
  });
6643
6624
  }
6644
6625
  pullOptions() {
@@ -6762,7 +6743,7 @@ class Gs {
6762
6743
  max_messages: 100,
6763
6744
  expires: 3e4
6764
6745
  }) {
6765
- const t = new Ns(this, e, !1), s = Math.round(t.opts.expires * 1.05), i = lt(s);
6746
+ const t = new Ns(this, e, !1), s = Math.round(t.opts.expires * 1.05), i = ut(s);
6766
6747
  return t.closed().catch(() => {
6767
6748
  }).finally(() => {
6768
6749
  i.cancel();
@@ -6789,7 +6770,7 @@ class Gs {
6789
6770
  }
6790
6771
  })().catch(() => {
6791
6772
  });
6792
- const o = lt(n);
6773
+ const o = ut(n);
6793
6774
  return i.closed().then((a) => {
6794
6775
  a ? t.reject(a) : t.resolve(null);
6795
6776
  }).catch((a) => {
@@ -6847,7 +6828,7 @@ class Ho {
6847
6828
  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 || se.StartSequence, (this.consumerOpts.deliver_policy === se.LastPerSubject || this.consumerOpts.deliver_policy === se.New || this.consumerOpts.deliver_policy === se.Last) && (delete s.opt_start_seq, s.deliver_policy = this.consumerOpts.deliver_policy), s.deliver_policy === se.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 = se.StartTime, s.opt_start_time = this.consumerOpts.opt_start_time), this.consumerOpts.inactive_threshold && (s.inactive_threshold = W(this.consumerOpts.inactive_threshold))), s;
6848
6829
  }
6849
6830
  async resetConsumer(e = 0) {
6850
- var o, a, f, p, g;
6831
+ var o, a, d, p, g;
6851
6832
  Ge.next();
6852
6833
  const t = this.serial === 0;
6853
6834
  (o = this.consumer) == null || o.delete().catch(() => {
@@ -6860,14 +6841,14 @@ class Ho {
6860
6841
  let n;
6861
6842
  for (let y = 0; ; y++)
6862
6843
  try {
6863
- n = await this.api.add(this.stream, s), (f = this.iter) == null || f.notify($e.OrderedConsumerRecreated, n.name);
6844
+ n = await this.api.add(this.stream, s), (d = this.iter) == null || d.notify($e.OrderedConsumerRecreated, n.name);
6864
6845
  break;
6865
6846
  } catch (x) {
6866
6847
  if (x.message === "stream not found" && ((p = this.iter) == null || p.notify($e.StreamNotFound, y), this.type === Ae.Fetch || this.opts.abort_on_missing_resource === !0))
6867
6848
  return (g = this.iter) == null || g.stop(x), Promise.reject(x);
6868
6849
  if (t && y >= this.maxInitialReset)
6869
6850
  throw x;
6870
- await pt(i.backoff(y + 1));
6851
+ await dt(i.backoff(y + 1));
6871
6852
  }
6872
6853
  return n;
6873
6854
  }
@@ -6888,11 +6869,11 @@ class Ho {
6888
6869
  max_messages: 100,
6889
6870
  expires: 3e4
6890
6871
  }, t) {
6891
- var f, p;
6872
+ var d, p;
6892
6873
  t = t || {};
6893
6874
  const s = t.fromFetch || !1, i = t.orderedReset || !1;
6894
6875
  if (this.type === Ae.Fetch && i) {
6895
- (f = this.iter) == null || f.src.stop(), await ((p = this.iter) == null ? void 0 : p.closed()), this.currentConsumer = null;
6876
+ (d = this.iter) == null || d.src.stop(), await ((p = this.iter) == null ? void 0 : p.closed()), this.currentConsumer = null;
6896
6877
  return;
6897
6878
  }
6898
6879
  (this.currentConsumer === null || i) && (this.currentConsumer = await this.resetConsumer(this.cursor.stream_seq + 1)), (this.iter === null || s) && (this.iter = new Do()), this.consumer = new Gs(this.api, this.currentConsumer);
@@ -6907,7 +6888,7 @@ class Ho {
6907
6888
  }
6908
6889
  notifyOrderedResetAndReset() {
6909
6890
  var e;
6910
- (e = this.iter) == null || e.notify(ut.Reset, ""), this.reset(this.opts, {
6891
+ (e = this.iter) == null || e.notify(ht.Reset, ""), this.reset(this.opts, {
6911
6892
  orderedReset: !0
6912
6893
  });
6913
6894
  }
@@ -6972,7 +6953,7 @@ class Vs {
6972
6953
  this.api = e, this.notified = !1;
6973
6954
  }
6974
6955
  checkVersion() {
6975
- const e = this.api.nc.features.get(H.JS_SIMPLIFICATION);
6956
+ const e = this.api.nc.features.get(J.JS_SIMPLIFICATION);
6976
6957
  return e.ok ? Promise.resolve() : Promise.reject(new Error(`consumers framework is only supported on servers ${e.min} or better`));
6977
6958
  }
6978
6959
  getPullConsumerFor(e) {
@@ -7024,43 +7005,43 @@ class fs {
7024
7005
  return this.api.deleteMessage(this.name, e, t);
7025
7006
  }
7026
7007
  }
7027
- class sr extends Tt {
7008
+ class sr extends Mt {
7028
7009
  constructor(e, t) {
7029
7010
  super(e, t);
7030
7011
  }
7031
7012
  checkStreamConfigVersions(e) {
7032
7013
  const t = this.nc;
7033
7014
  if (e.metadata) {
7034
- const { min: i, ok: n } = t.features.get(H.JS_STREAM_CONSUMER_METADATA);
7015
+ const { min: i, ok: n } = t.features.get(J.JS_STREAM_CONSUMER_METADATA);
7035
7016
  if (!n)
7036
7017
  throw new Error(`stream 'metadata' requires server ${i}`);
7037
7018
  }
7038
7019
  if (e.first_seq) {
7039
- const { min: i, ok: n } = t.features.get(H.JS_STREAM_FIRST_SEQ);
7020
+ const { min: i, ok: n } = t.features.get(J.JS_STREAM_FIRST_SEQ);
7040
7021
  if (!n)
7041
7022
  throw new Error(`stream 'first_seq' requires server ${i}`);
7042
7023
  }
7043
7024
  if (e.subject_transform) {
7044
- const { min: i, ok: n } = t.features.get(H.JS_STREAM_SUBJECT_TRANSFORM);
7025
+ const { min: i, ok: n } = t.features.get(J.JS_STREAM_SUBJECT_TRANSFORM);
7045
7026
  if (!n)
7046
7027
  throw new Error(`stream 'subject_transform' requires server ${i}`);
7047
7028
  }
7048
7029
  if (e.compression) {
7049
- const { min: i, ok: n } = t.features.get(H.JS_STREAM_COMPRESSION);
7030
+ const { min: i, ok: n } = t.features.get(J.JS_STREAM_COMPRESSION);
7050
7031
  if (!n)
7051
7032
  throw new Error(`stream 'compression' requires server ${i}`);
7052
7033
  }
7053
7034
  if (e.consumer_limits) {
7054
- const { min: i, ok: n } = t.features.get(H.JS_DEFAULT_CONSUMER_LIMITS);
7035
+ const { min: i, ok: n } = t.features.get(J.JS_DEFAULT_CONSUMER_LIMITS);
7055
7036
  if (!n)
7056
7037
  throw new Error(`stream 'consumer_limits' requires server ${i}`);
7057
7038
  }
7058
7039
  function s(i, n) {
7059
7040
  var a;
7060
7041
  if ((((a = n == null ? void 0 : n.subject_transforms) == null ? void 0 : a.length) || 0) > 0) {
7061
- const { min: f, ok: p } = t.features.get(H.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);
7042
+ const { min: d, ok: p } = t.features.get(J.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);
7062
7043
  if (!p)
7063
- throw new Error(`${i} 'subject_transforms' requires server ${f}`);
7044
+ throw new Error(`${i} 'subject_transforms' requires server ${d}`);
7064
7045
  }
7065
7046
  }
7066
7047
  e.sources && e.sources.forEach((i) => {
@@ -7069,7 +7050,7 @@ class sr extends Tt {
7069
7050
  }
7070
7051
  async add(e = {}) {
7071
7052
  var i;
7072
- this.checkStreamConfigVersions(e), pe(e.name), e.mirror = Vt(e.mirror), e.sources = (i = e.sources) == null ? void 0 : i.map(Vt);
7053
+ this.checkStreamConfigVersions(e), pe(e.name), e.mirror = Wt(e.mirror), e.sources = (i = e.sources) == null ? void 0 : i.map(Wt);
7073
7054
  const s = await this._request(`${this.prefix}.STREAM.CREATE.${e.name}`, e);
7074
7055
  return this._fixInfo(s), s;
7075
7056
  }
@@ -7079,30 +7060,30 @@ class sr extends Tt {
7079
7060
  async update(e, t = {}) {
7080
7061
  var a;
7081
7062
  if (typeof e == "object") {
7082
- const f = e;
7083
- 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");
7063
+ const d = e;
7064
+ e = d.name, t = d, 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");
7084
7065
  }
7085
7066
  this.checkStreamConfigVersions(t), pe(e);
7086
7067
  const s = await this.info(e), i = Object.assign(s.config, t);
7087
- i.mirror = Vt(i.mirror), i.sources = (a = i.sources) == null ? void 0 : a.map(Vt);
7068
+ i.mirror = Wt(i.mirror), i.sources = (a = i.sources) == null ? void 0 : a.map(Wt);
7088
7069
  const o = await this._request(`${this.prefix}.STREAM.UPDATE.${e}`, i);
7089
7070
  return this._fixInfo(o), o;
7090
7071
  }
7091
7072
  async info(e, t) {
7092
7073
  pe(e);
7093
7074
  const s = `${this.prefix}.STREAM.INFO.${e}`;
7094
- let n = await this._request(s, t), { total: o, limit: a } = n, f = n.state.subjects ? Object.getOwnPropertyNames(n.state.subjects).length : 1;
7095
- if (o && o > f) {
7075
+ let n = await this._request(s, t), { total: o, limit: a } = n, d = n.state.subjects ? Object.getOwnPropertyNames(n.state.subjects).length : 1;
7076
+ if (o && o > d) {
7096
7077
  const p = [
7097
7078
  n
7098
7079
  ], g = t || {};
7099
7080
  let y = 0;
7100
- for (; o > f; ) {
7081
+ for (; o > d; ) {
7101
7082
  y++, g.offset = a * y;
7102
7083
  const A = await this._request(s, g);
7103
7084
  o = A.total, p.push(A);
7104
- const I = Object.getOwnPropertyNames(A.state.subjects).length;
7105
- if (f += I, I < a)
7085
+ const O = Object.getOwnPropertyNames(A.state.subjects).length;
7086
+ if (d += O, O < a)
7106
7087
  break;
7107
7088
  }
7108
7089
  let x = {};
@@ -7121,7 +7102,7 @@ class sr extends Tt {
7121
7102
  this._fixInfo(a);
7122
7103
  }), o.streams;
7123
7104
  }, i = `${this.prefix}.STREAM.LIST`;
7124
- return new At(i, s, this, t);
7105
+ return new Pt(i, s, this, t);
7125
7106
  }
7126
7107
  _fixInfo(e) {
7127
7108
  e.config.sealed = e.config.sealed || !1, e.config.deny_delete = e.config.deny_delete || !1, e.config.deny_purge = e.config.deny_purge || !1, e.config.allow_rollup_hdrs = e.config.allow_rollup_hdrs || !1;
@@ -7151,15 +7132,15 @@ class sr extends Tt {
7151
7132
  }
7152
7133
  listKvs() {
7153
7134
  const e = (s) => {
7154
- var f;
7135
+ var d;
7155
7136
  const n = s.streams.filter((p) => p.config.name.startsWith(we));
7156
7137
  n.forEach((p) => {
7157
7138
  this._fixInfo(p);
7158
7139
  });
7159
7140
  let o = "";
7160
- return n.length && (o = ((f = this.nc.info) == null ? void 0 : f.cluster) ?? ""), n.map((p) => new di(p, o));
7141
+ return n.length && (o = ((d = this.nc.info) == null ? void 0 : d.cluster) ?? ""), n.map((p) => new di(p, o));
7161
7142
  }, t = `${this.prefix}.STREAM.LIST`;
7162
- return new At(t, e, this);
7143
+ return new Pt(t, e, this);
7163
7144
  }
7164
7145
  listObjectStores() {
7165
7146
  const e = (s) => {
@@ -7168,20 +7149,20 @@ class sr extends Tt {
7168
7149
  this._fixInfo(a);
7169
7150
  }), n.map((a) => new zs(a));
7170
7151
  }, t = `${this.prefix}.STREAM.LIST`;
7171
- return new At(t, e, this);
7152
+ return new Pt(t, e, this);
7172
7153
  }
7173
7154
  names(e = "") {
7174
7155
  const t = e != null && e.length ? {
7175
7156
  subject: e
7176
7157
  } : {}, s = (n) => n.streams, i = `${this.prefix}.STREAM.NAMES`;
7177
- return new At(i, s, this, t);
7158
+ return new Pt(i, s, this, t);
7178
7159
  }
7179
7160
  async get(e) {
7180
7161
  const t = await this.info(e);
7181
7162
  return Promise.resolve(new fs(this, t));
7182
7163
  }
7183
7164
  }
7184
- class Jo extends Tt {
7165
+ class Jo extends Mt {
7185
7166
  constructor(e, t) {
7186
7167
  super(e, t);
7187
7168
  }
@@ -7190,12 +7171,12 @@ class Jo extends Tt {
7190
7171
  let s = t;
7191
7172
  const { last_by_subj: i } = s;
7192
7173
  i && (s = null);
7193
- const n = s ? this.jc.encode(s) : ve, o = this.opts.apiPrefix || "$JS.API", a = i ? `${o}.DIRECT.GET.${e}.${i}` : `${o}.DIRECT.GET.${e}`, f = await this.nc.request(a, n, {
7174
+ const n = s ? this.jc.encode(s) : ve, o = this.opts.apiPrefix || "$JS.API", a = i ? `${o}.DIRECT.GET.${e}.${i}` : `${o}.DIRECT.GET.${e}`, d = await this.nc.request(a, n, {
7194
7175
  timeout: this.timeout
7195
- }), p = ct(f);
7176
+ }), p = at(d);
7196
7177
  if (p)
7197
7178
  return Promise.reject(p);
7198
- const g = new Ws(f);
7179
+ const g = new Ws(d);
7199
7180
  return Promise.resolve(g);
7200
7181
  }
7201
7182
  async getBatch(e, t) {
@@ -7203,28 +7184,28 @@ class Jo extends Tt {
7203
7184
  const i = `${this.opts.apiPrefix || "$JS.API"}.DIRECT.GET.${e}`;
7204
7185
  if (!Array.isArray(t.multi_last) || t.multi_last.length === 0)
7205
7186
  return Promise.reject("multi_last is required");
7206
- const n = JSON.stringify(t, (f, p) => f === "up_to_time" && p instanceof Date ? p.toISOString() : p), o = new he(), a = await this.nc.requestMany(i, n, {
7187
+ const n = JSON.stringify(t, (d, p) => d === "up_to_time" && p instanceof Date ? p.toISOString() : p), o = new he(), a = await this.nc.requestMany(i, n, {
7207
7188
  strategy: Ne.SentinelMsg
7208
7189
  });
7209
7190
  return (async () => {
7210
7191
  var y, x, A;
7211
- let f = !1, p = !1, g;
7212
- for await (const I of a) {
7213
- if (!f) {
7214
- f = !0;
7215
- const N = ((y = I.headers) == null ? void 0 : y.code) || 0;
7216
- if (N !== 0 && N < 200 || N > 299) {
7217
- g = (x = I.headers) == null ? void 0 : x.description.toLowerCase();
7192
+ let d = !1, p = !1, g;
7193
+ for await (const O of a) {
7194
+ if (!d) {
7195
+ d = !0;
7196
+ const j = ((y = O.headers) == null ? void 0 : y.code) || 0;
7197
+ if (j !== 0 && j < 200 || j > 299) {
7198
+ g = (x = O.headers) == null ? void 0 : x.description.toLowerCase();
7218
7199
  break;
7219
7200
  }
7220
- if (((A = I.headers) == null ? void 0 : A.get("Nats-Num-Pending")) === "") {
7201
+ if (((A = O.headers) == null ? void 0 : A.get("Nats-Num-Pending")) === "") {
7221
7202
  p = !0;
7222
7203
  break;
7223
7204
  }
7224
7205
  }
7225
- if (I.data.length === 0)
7206
+ if (O.data.length === 0)
7226
7207
  break;
7227
- o.push(new Ws(I));
7208
+ o.push(new Ws(O));
7228
7209
  }
7229
7210
  o.push(() => {
7230
7211
  if (p)
@@ -7245,20 +7226,20 @@ class Ws {
7245
7226
  this.data = e.data, this.header = e.headers;
7246
7227
  }
7247
7228
  get subject() {
7248
- return this.header.last(nt.Subject);
7229
+ return this.header.last(it.Subject);
7249
7230
  }
7250
7231
  get seq() {
7251
- const e = this.header.last(nt.Sequence);
7232
+ const e = this.header.last(it.Sequence);
7252
7233
  return typeof e == "string" ? parseInt(e) : 0;
7253
7234
  }
7254
7235
  get time() {
7255
7236
  return new Date(Date.parse(this.timestamp));
7256
7237
  }
7257
7238
  get timestamp() {
7258
- return this.header.last(nt.TimeStamp);
7239
+ return this.header.last(it.TimeStamp);
7259
7240
  }
7260
7241
  get stream() {
7261
- return this.header.last(nt.Stream);
7242
+ return this.header.last(it.Stream);
7262
7243
  }
7263
7244
  json(e) {
7264
7245
  return Oe(e).decode(this.data);
@@ -7268,7 +7249,7 @@ class Ws {
7268
7249
  }
7269
7250
  }
7270
7251
  h(Ws, "jc");
7271
- class Ko extends Tt {
7252
+ class Ko extends Mt {
7272
7253
  constructor(t, s) {
7273
7254
  super(t, s);
7274
7255
  h(this, "streams");
@@ -7424,7 +7405,7 @@ function Go() {
7424
7405
  }
7425
7406
  });
7426
7407
  }
7427
- class Ct {
7408
+ class It {
7428
7409
  constructor(e, t, s) {
7429
7410
  h(this, "jsm");
7430
7411
  h(this, "js");
@@ -7494,67 +7475,67 @@ class Ct {
7494
7475
  s = s || {
7495
7476
  timeout: i.timeout
7496
7477
  }, s.timeout = s.timeout || i.timeout, s.previousRevision = s.previousRevision ?? void 0;
7497
- const { timeout: n, previousRevision: o } = s, a = this.js.nc.info, f = (a == null ? void 0 : a.max_payload) || 1024;
7478
+ const { timeout: n, previousRevision: o } = s, a = this.js.nc.info, d = (a == null ? void 0 : a.max_payload) || 1024;
7498
7479
  e = e || {}, e.options = e.options || {};
7499
7480
  let p = ((de = e.options) == null ? void 0 : de.max_chunk_size) || 128 * 1024;
7500
- p = p > f ? f : p, e.options.max_chunk_size = p;
7481
+ p = p > d ? d : p, e.options.max_chunk_size = p;
7501
7482
  const g = await this.info(e.name), { name: y, error: x } = this._checkNotEmpty(e.name);
7502
7483
  if (x)
7503
7484
  return Promise.reject(x);
7504
- const A = Ge.next(), I = this._chunkSubject(A), N = this._metaSubject(y), J = Object.assign({
7485
+ const A = Ge.next(), O = this._chunkSubject(A), j = this._metaSubject(y), B = Object.assign({
7505
7486
  bucket: this.name,
7506
7487
  nuid: A,
7507
7488
  size: 0,
7508
7489
  chunks: 0
7509
- }, Jr(e)), ee = Y(), L = [], Q = new dt();
7490
+ }, Jr(e)), Q = Y(), L = [], ee = new ft();
7510
7491
  try {
7511
- const w = t ? t.getReader() : null, j = Nr.create();
7492
+ const w = t ? t.getReader() : null, R = Nr.create();
7512
7493
  for (; ; ) {
7513
- const { done: F, value: R } = w ? await w.read() : {
7494
+ const { done: F, value: N } = w ? await w.read() : {
7514
7495
  done: !0,
7515
7496
  value: void 0
7516
7497
  };
7517
7498
  if (F) {
7518
- if (Q.size() > 0) {
7519
- const $ = Q.drain();
7520
- j.update($), J.chunks++, J.size += $.length, L.push(this.js.publish(I, $, {
7499
+ if (ee.size() > 0) {
7500
+ const $ = ee.drain();
7501
+ R.update($), B.chunks++, B.size += $.length, L.push(this.js.publish(O, $, {
7521
7502
  timeout: n
7522
7503
  }));
7523
7504
  }
7524
- await Promise.all(L), L.length = 0, J.mtime = (/* @__PURE__ */ new Date()).toISOString();
7525
- const P = ht.encode(j.digest());
7526
- J.digest = `${Dr}${P}`, J.deleted = !1;
7505
+ await Promise.all(L), L.length = 0, B.mtime = (/* @__PURE__ */ new Date()).toISOString();
7506
+ const P = ct.encode(R.digest());
7507
+ B.digest = `${Dr}${P}`, B.deleted = !1;
7527
7508
  const U = Fe();
7528
7509
  typeof o == "number" && U.set(Ue.ExpectedLastSubjectSequenceHdr, `${o}`), U.set(ge.RollupHdr, ge.RollupValueSubject);
7529
- const q = await this.js.publish(N, Oe().encode(J), {
7510
+ const q = await this.js.publish(j, Oe().encode(B), {
7530
7511
  headers: U,
7531
7512
  timeout: n
7532
7513
  });
7533
- if (J.revision = q.seq, g)
7514
+ if (B.revision = q.seq, g)
7534
7515
  try {
7535
7516
  await this.jsm.streams.purge(this.stream, {
7536
7517
  filter: `$O.${this.name}.C.${g.nuid}`
7537
7518
  });
7538
7519
  } catch {
7539
7520
  }
7540
- ee.resolve(new Ts(J));
7521
+ Q.resolve(new Ts(B));
7541
7522
  break;
7542
7523
  }
7543
- if (R)
7544
- for (Q.fill(R); Q.size() > p; ) {
7545
- J.chunks++, J.size += p;
7546
- const P = Q.drain(e.options.max_chunk_size);
7547
- j.update(P), L.push(this.js.publish(I, P, {
7524
+ if (N)
7525
+ for (ee.fill(N); ee.size() > p; ) {
7526
+ B.chunks++, B.size += p;
7527
+ const P = ee.drain(e.options.max_chunk_size);
7528
+ R.update(P), L.push(this.js.publish(O, P, {
7548
7529
  timeout: n
7549
7530
  }));
7550
7531
  }
7551
7532
  }
7552
7533
  } catch (w) {
7553
7534
  await this.jsm.streams.purge(this.stream, {
7554
- filter: I
7555
- }), ee.reject(w);
7535
+ filter: O
7536
+ }), Q.reject(w);
7556
7537
  }
7557
- return ee;
7538
+ return Q;
7558
7539
  }
7559
7540
  putBlob(e, t, s) {
7560
7541
  function i(n) {
@@ -7572,10 +7553,10 @@ class Ct {
7572
7553
  }
7573
7554
  async getBlob(e) {
7574
7555
  async function t(n) {
7575
- const o = new dt(), a = n.getReader();
7556
+ const o = new ft(), a = n.getReader();
7576
7557
  for (; ; ) {
7577
- const { done: f, value: p } = await a.read();
7578
- if (f)
7558
+ const { done: d, value: p } = await a.read();
7559
+ if (d)
7579
7560
  return o.drain();
7580
7561
  p && p.length && o.fill(p);
7581
7562
  }
@@ -7597,7 +7578,7 @@ class Ct {
7597
7578
  const y = t.options.link.name || "";
7598
7579
  if (y === "")
7599
7580
  throw new Error("link is a bucket");
7600
- return (t.options.link.bucket !== this.name ? await Ct.create(this.js, t.options.link.bucket) : this).get(y);
7581
+ return (t.options.link.bucket !== this.name ? await It.create(this.js, t.options.link.bucket) : this).get(y);
7601
7582
  }
7602
7583
  if (!t.digest.startsWith(Dr))
7603
7584
  return Promise.reject(new Error(`unknown digest type: ${t.digest}`));
@@ -7613,10 +7594,10 @@ class Ct {
7613
7594
  let o;
7614
7595
  const a = ze();
7615
7596
  a.orderedConsumer();
7616
- const f = Nr.create(), p = `$O.${this.name}.C.${t.nuid}`, g = await this.js.subscribe(p, a);
7597
+ const d = Nr.create(), p = `$O.${this.name}.C.${t.nuid}`, g = await this.js.subscribe(p, a);
7617
7598
  return (async () => {
7618
7599
  for await (const y of g)
7619
- y.data.length > 0 && (f.update(y.data), o.enqueue(y.data)), y.info.pending === 0 && (xn(s, f.digest()) ? o.close() : o.error(new Error(`received a corrupt object, digests do not match received: ${t.digest} calculated ${s}`)), g.unsubscribe());
7600
+ y.data.length > 0 && (d.update(y.data), o.enqueue(y.data)), y.info.pending === 0 && (xn(s, d.digest()) ? o.close() : o.error(new Error(`received a corrupt object, digests do not match received: ${t.digest} calculated ${s}`)), g.unsubscribe());
7620
7601
  })().then(() => {
7621
7602
  i.resolve();
7622
7603
  }).catch((y) => {
@@ -7631,7 +7612,7 @@ class Ct {
7631
7612
  }), n;
7632
7613
  }
7633
7614
  linkStore(e, t) {
7634
- if (!(t instanceof Ct))
7615
+ if (!(t instanceof It))
7635
7616
  return Promise.reject("bucket required");
7636
7617
  const s = t, { name: i, error: n } = this._checkNotEmpty(e);
7637
7618
  if (n)
@@ -7668,8 +7649,8 @@ class Ct {
7668
7649
  }
7669
7650
  };
7670
7651
  await this.js.publish(this._metaSubject(e), JSON.stringify(a));
7671
- const f = await this.info(e);
7672
- return Promise.resolve(f);
7652
+ const d = await this.info(e);
7653
+ return Promise.resolve(d);
7673
7654
  }
7674
7655
  async delete(e) {
7675
7656
  const t = await this.rawInfo(e);
@@ -7697,8 +7678,8 @@ class Ct {
7697
7678
  if (n)
7698
7679
  return Promise.reject(n);
7699
7680
  if (e !== t.name) {
7700
- const f = await this.info(t.name);
7701
- if (f && !f.deleted)
7681
+ const d = await this.info(t.name);
7682
+ if (d && !d.deleted)
7702
7683
  return Promise.reject(new Error("an object already exists with that name"));
7703
7684
  }
7704
7685
  t.name = i;
@@ -7715,14 +7696,14 @@ class Ct {
7715
7696
  await this.jsm.streams.getMessage(this.stream, {
7716
7697
  last_by_subj: i
7717
7698
  });
7718
- } catch (f) {
7719
- f.code === "404" ? (s.push(null), t = !0) : s.stop(f);
7699
+ } catch (d) {
7700
+ d.code === "404" ? (s.push(null), t = !0) : s.stop(d);
7720
7701
  }
7721
7702
  const n = Oe(), o = ze();
7722
- o.orderedConsumer(), e.includeHistory ? o.deliverLastPerSubject() : (t = !0, o.deliverNew()), o.callback((f, p) => {
7703
+ o.orderedConsumer(), e.includeHistory ? o.deliverLastPerSubject() : (t = !0, o.deliverNew()), o.callback((d, p) => {
7723
7704
  var g;
7724
- if (f) {
7725
- s.stop(f);
7705
+ if (d) {
7706
+ s.stop(d);
7726
7707
  return;
7727
7708
  }
7728
7709
  if (p !== null) {
@@ -7735,15 +7716,15 @@ class Ct {
7735
7716
  a.unsubscribe();
7736
7717
  }), a.closed.then(() => {
7737
7718
  s.stop();
7738
- }).catch((f) => {
7739
- s.stop(f);
7719
+ }).catch((d) => {
7720
+ s.stop(d);
7740
7721
  }), s;
7741
7722
  }
7742
7723
  _chunkSubject(e) {
7743
7724
  return `$O.${this.name}.C.${e}`;
7744
7725
  }
7745
7726
  _metaSubject(e) {
7746
- return `$O.${this.name}.M.${ht.encode(e)}`;
7727
+ return `$O.${this.name}.M.${ct.encode(e)}`;
7747
7728
  }
7748
7729
  _metaSubjectAll() {
7749
7730
  return `$O.${this.name}.M.>`;
@@ -7759,7 +7740,7 @@ class Ct {
7759
7740
  const s = Object.assign({
7760
7741
  max_age: t
7761
7742
  }, e);
7762
- s.name = this.stream, s.num_replicas = e.replicas ?? 1, s.allow_direct = !0, s.allow_rollup_hdrs = !0, s.discard = It.New, s.subjects = [
7743
+ s.name = this.stream, s.num_replicas = e.replicas ?? 1, s.allow_direct = !0, s.allow_rollup_hdrs = !0, s.discard = jt.New, s.subjects = [
7763
7744
  `$O.${this.name}.C.>`,
7764
7745
  `$O.${this.name}.M.>`
7765
7746
  ], e.placement && (s.placement = e.placement), e.metadata && (s.metadata = e.metadata), typeof e.compression == "boolean" && (s.compression = e.compression ? Ve.S2 : Ve.None);
@@ -7770,7 +7751,7 @@ class Ct {
7770
7751
  }
7771
7752
  }
7772
7753
  static async create(e, t, s = {}) {
7773
- const i = await e.jetstreamManager(), n = new Ct(t, i, e);
7754
+ const i = await e.jetstreamManager(), n = new It(t, i, e);
7774
7755
  return await n.init(s), Promise.resolve(n);
7775
7756
  }
7776
7757
  }
@@ -7780,18 +7761,18 @@ class Vo {
7780
7761
  this.js = e;
7781
7762
  }
7782
7763
  kv(e, t = {}) {
7783
- const s = this.js, { ok: i, min: n } = s.nc.features.get(H.JS_KV);
7784
- return i ? t.bindOnly ? Rt.bind(this.js, e, t) : Rt.create(this.js, e, t) : Promise.reject(new Error(`kv is only supported on servers ${n} or better`));
7764
+ const s = this.js, { ok: i, min: n } = s.nc.features.get(J.JS_KV);
7765
+ return i ? t.bindOnly ? Nt.bind(this.js, e, t) : Nt.create(this.js, e, t) : Promise.reject(new Error(`kv is only supported on servers ${n} or better`));
7785
7766
  }
7786
7767
  os(e, t = {}) {
7787
7768
  var o;
7788
7769
  if (typeof ((o = crypto == null ? void 0 : crypto.subtle) == null ? void 0 : o.digest) != "function")
7789
7770
  return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));
7790
- const s = this.js, { ok: i, min: n } = s.nc.features.get(H.JS_OBJECTSTORE);
7791
- return i ? Ct.create(this.js, e, t) : Promise.reject(new Error(`objectstore is only supported on servers ${n} or better`));
7771
+ const s = this.js, { ok: i, min: n } = s.nc.features.get(J.JS_OBJECTSTORE);
7772
+ return i ? It.create(this.js, e, t) : Promise.reject(new Error(`objectstore is only supported on servers ${n} or better`));
7792
7773
  }
7793
7774
  }
7794
- class rr extends Tt {
7775
+ class rr extends Mt {
7795
7776
  constructor(t, s) {
7796
7777
  super(t, s);
7797
7778
  h(this, "consumers");
@@ -7819,16 +7800,16 @@ class rr extends Tt {
7819
7800
  i && (i.msgID && n.set(Ue.MsgIdHdr, i.msgID), i.expect.lastMsgID && n.set(Ue.ExpectedLastMsgIdHdr, i.expect.lastMsgID), i.expect.streamName && n.set(Ue.ExpectedStreamHdr, i.expect.streamName), typeof i.expect.lastSequence == "number" && n.set(Ue.ExpectedLastSeqHdr, `${i.expect.lastSequence}`), typeof i.expect.lastSubjectSequence == "number" && n.set(Ue.ExpectedLastSubjectSequenceHdr, `${i.expect.lastSubjectSequence}`));
7820
7801
  const o = i.timeout || this.timeout, a = {};
7821
7802
  o && (a.timeout = o), i && (a.headers = n);
7822
- let { retries: f, retry_delay: p } = i;
7823
- f = f || 1, p = p || 250;
7803
+ let { retries: d, retry_delay: p } = i;
7804
+ d = d || 1, p = p || 250;
7824
7805
  let g;
7825
- for (let x = 0; x < f; x++)
7806
+ for (let x = 0; x < d; x++)
7826
7807
  try {
7827
7808
  g = await this.nc.request(t, s, a);
7828
7809
  break;
7829
7810
  } catch (A) {
7830
- if (A.code === "503" && x + 1 < f)
7831
- await pt(p);
7811
+ if (A.code === "503" && x + 1 < d)
7812
+ await dt(p);
7832
7813
  else
7833
7814
  throw A;
7834
7815
  }
@@ -7838,7 +7819,7 @@ class rr extends Tt {
7838
7819
  return y.duplicate = y.duplicate ? y.duplicate : !1, y;
7839
7820
  }
7840
7821
  async pull(t, s, i = 0) {
7841
- pe(t), at(s);
7822
+ pe(t), ot(s);
7842
7823
  let n = this.timeout;
7843
7824
  i > n && (n = i), i = i < 0 ? 0 : W(i);
7844
7825
  const o = {
@@ -7848,24 +7829,24 @@ class rr extends Tt {
7848
7829
  }, a = await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${s}`, this.jc.encode(o), {
7849
7830
  noMux: !0,
7850
7831
  timeout: n
7851
- }), f = ct(a);
7852
- if (f)
7853
- throw f;
7854
- return Nt(a, this.timeout);
7832
+ }), d = at(a);
7833
+ if (d)
7834
+ throw d;
7835
+ return Tt(a, this.timeout);
7855
7836
  }
7856
7837
  fetch(t, s, i = {}) {
7857
- pe(t), at(s);
7838
+ pe(t), ot(s);
7858
7839
  let n = null;
7859
7840
  const o = (i.max_bytes ?? 0) > 0;
7860
7841
  let a = 0;
7861
- const f = o ? i.max_bytes : 0;
7842
+ const d = o ? i.max_bytes : 0;
7862
7843
  let p = null;
7863
7844
  const g = {};
7864
- if (g.batch = i.batch || 1, f) {
7865
- const L = this.nc.features.get(H.JS_PULL_MAX_BYTES);
7845
+ if (g.batch = i.batch || 1, d) {
7846
+ const L = this.nc.features.get(J.JS_PULL_MAX_BYTES);
7866
7847
  if (!L.ok)
7867
7848
  throw new Error(`max_bytes is only supported on servers ${L.min} or better`);
7868
- g.max_bytes = f;
7849
+ g.max_bytes = d;
7869
7850
  }
7870
7851
  g.no_wait = i.no_wait || !1, g.no_wait && g.expires && (g.expires = 0);
7871
7852
  const y = i.expires || 0;
@@ -7873,23 +7854,23 @@ class rr extends Tt {
7873
7854
  throw new Error("expires or no_wait is required");
7874
7855
  const x = i.idle_heartbeat || 0;
7875
7856
  x && (g.idle_heartbeat = W(x), i.delay_heartbeat === !0 && (g.idle_heartbeat = W(x * 4)));
7876
- const A = new he(), I = g.batch;
7877
- let N = 0;
7878
- A.protocolFilterFn = (L, Q = !1) => Ls(L.msg) ? (p == null || p.work(), !1) : !0, A.dispatchedFn = (L) => {
7857
+ const A = new he(), O = g.batch;
7858
+ let j = 0;
7859
+ A.protocolFilterFn = (L, ee = !1) => Ls(L.msg) ? (p == null || p.work(), !1) : !0, A.dispatchedFn = (L) => {
7879
7860
  if (L) {
7880
- if (o && (a += L.data.length), N++, n && L.info.pending === 0)
7861
+ if (o && (a += L.data.length), j++, n && L.info.pending === 0)
7881
7862
  return;
7882
- (A.getPending() === 1 && L.info.pending === 0 || I === N || f > 0 && a >= f) && A.stop();
7863
+ (A.getPending() === 1 && L.info.pending === 0 || O === j || d > 0 && a >= d) && A.stop();
7883
7864
  }
7884
7865
  };
7885
- const J = qe(this.nc.options.inboxPrefix), ee = this.nc.subscribe(J, {
7866
+ const B = qe(this.nc.options.inboxPrefix), Q = this.nc.subscribe(B, {
7886
7867
  max: i.batch,
7887
- callback: (L, Q) => {
7888
- L === null && (L = ct(Q)), L !== null ? (n && (n.cancel(), n = null), tn(L) ? A.stop(bi(L) === null ? void 0 : L) : A.stop(L)) : (p == null || p.work(), A.received++, A.push(Nt(Q, this.timeout)));
7868
+ callback: (L, ee) => {
7869
+ L === null && (L = at(ee)), L !== null ? (n && (n.cancel(), n = null), tn(L) ? A.stop(bi(L) === null ? void 0 : L) : A.stop(L)) : (p == null || p.work(), A.received++, A.push(Tt(ee, this.timeout)));
7889
7870
  }
7890
7871
  });
7891
- return y && (n = lt(y), n.catch(() => {
7892
- ee.isClosed() || (ee.drain().catch(() => {
7872
+ return y && (n = ut(y), n.catch(() => {
7873
+ Q.isClosed() || (Q.drain().catch(() => {
7893
7874
  }), n = null), p && p.cancel();
7894
7875
  })), (async () => {
7895
7876
  try {
@@ -7898,9 +7879,9 @@ class rr extends Tt {
7898
7879
  }), !0)));
7899
7880
  } catch {
7900
7881
  }
7901
- await ee.closed, n !== null && (n.cancel(), n = null), p && p.cancel(), A.stop();
7882
+ await Q.closed, n !== null && (n.cancel(), n = null), p && p.cancel(), A.stop();
7902
7883
  })().catch(), this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${s}`, this.jc.encode(g), {
7903
- reply: J
7884
+ reply: B
7904
7885
  }), A;
7905
7886
  }
7906
7887
  async pullSubscribe(t, s = ze()) {
@@ -7916,8 +7897,8 @@ class rr extends Tt {
7916
7897
  a.info = i;
7917
7898
  try {
7918
7899
  await this._maybeCreateConsumer(i);
7919
- } catch (f) {
7920
- throw a.unsubscribe(), f;
7900
+ } catch (d) {
7901
+ throw a.unsubscribe(), d;
7921
7902
  }
7922
7903
  return a;
7923
7904
  }
@@ -7992,7 +7973,7 @@ class rr extends Tt {
7992
7973
  deliver_policy: se.All,
7993
7974
  ack_policy: ce.Explicit,
7994
7975
  ack_wait: W(30 * 1e3),
7995
- replay_policy: ft.Instant
7976
+ replay_policy: lt.Instant
7996
7977
  }, t.config);
7997
7978
  const s = await this.consumerAPI.add(t.stream, t.config);
7998
7979
  if (Array.isArray(t.config.filter_subjects && !Array.isArray(s.config.filter_subjects)))
@@ -8001,14 +7982,14 @@ class rr extends Tt {
8001
7982
  }
8002
7983
  static ingestionFn(t) {
8003
7984
  return (s, i) => {
8004
- var f;
7985
+ var d;
8005
7986
  const n = i;
8006
7987
  if (!s) return {
8007
7988
  ingest: !1,
8008
7989
  protocol: !1
8009
7990
  };
8010
7991
  const o = s;
8011
- if (ct(o.msg) || (f = n.monitor) == null || f.work(), Ls(o.msg)) {
7992
+ if (at(o.msg) || (d = n.monitor) == null || d.work(), Ls(o.msg)) {
8012
7993
  const p = t ? n._checkHbOrderConsumer(o.msg) : !0;
8013
7994
  return t || n.info.flow_control.heartbeat_count++, {
8014
7995
  ingest: p,
@@ -8096,62 +8077,62 @@ class ir {
8096
8077
  const i = !this.protocol.options.noAsyncTraces;
8097
8078
  try {
8098
8079
  this._check(e, !0, !0);
8099
- } catch (f) {
8100
- return Promise.reject(f);
8080
+ } catch (d) {
8081
+ return Promise.reject(d);
8101
8082
  }
8102
8083
  if (s.strategy = s.strategy || Ne.Timer, s.maxWait = s.maxWait || 1e3, s.maxWait < 1)
8103
8084
  return Promise.reject(new T("timeout", k.InvalidOption));
8104
8085
  const n = new he();
8105
- function o(f) {
8086
+ function o(d) {
8106
8087
  n.push(() => {
8107
- n.stop(f);
8088
+ n.stop(d);
8108
8089
  });
8109
8090
  }
8110
- function a(f, p) {
8111
- f || p === null ? o(f === null ? void 0 : f) : n.push(p);
8091
+ function a(d, p) {
8092
+ d || p === null ? o(d === null ? void 0 : d) : n.push(p);
8112
8093
  }
8113
8094
  if (s.noMux) {
8114
- const f = i ? new Error().stack : null;
8095
+ const d = i ? new Error().stack : null;
8115
8096
  let p = typeof s.maxMessages == "number" && s.maxMessages > 0 ? s.maxMessages : -1;
8116
8097
  const g = this.subscribe(qe(this.options.inboxPrefix), {
8117
- callback: (I, N) => {
8118
- var J, ee;
8119
- if (((J = N == null ? void 0 : N.data) == null ? void 0 : J.length) === 0 && ((ee = N == null ? void 0 : N.headers) == null ? void 0 : ee.status) === k.NoResponders && (I = T.errorForCode(k.NoResponders)), I) {
8120
- f && (I.stack += `
8098
+ callback: (O, j) => {
8099
+ var B, Q;
8100
+ if (((B = j == null ? void 0 : j.data) == null ? void 0 : B.length) === 0 && ((Q = j == null ? void 0 : j.headers) == null ? void 0 : Q.status) === k.NoResponders && (O = T.errorForCode(k.NoResponders)), O) {
8101
+ d && (O.stack += `
8121
8102
 
8122
- ${f}`), y(I);
8103
+ ${d}`), y(O);
8123
8104
  return;
8124
8105
  }
8125
- a(null, N), s.strategy === Ne.Count && (p--, p === 0 && y()), s.strategy === Ne.JitterTimer && (A(), x = setTimeout(() => {
8106
+ a(null, j), s.strategy === Ne.Count && (p--, p === 0 && y()), s.strategy === Ne.JitterTimer && (A(), x = setTimeout(() => {
8126
8107
  y();
8127
- }, 300)), s.strategy === Ne.SentinelMsg && N && N.data.length === 0 && y();
8108
+ }, 300)), s.strategy === Ne.SentinelMsg && j && j.data.length === 0 && y();
8128
8109
  }
8129
8110
  });
8130
8111
  g.requestSubject = e, g.closed.then(() => {
8131
8112
  o();
8132
- }).catch((I) => {
8133
- n.stop(I);
8113
+ }).catch((O) => {
8114
+ n.stop(O);
8134
8115
  });
8135
- const y = (I) => {
8136
- I && n.push(() => {
8137
- throw I;
8116
+ const y = (O) => {
8117
+ O && n.push(() => {
8118
+ throw O;
8138
8119
  }), A(), g.drain().then(() => {
8139
8120
  o();
8140
- }).catch((N) => {
8121
+ }).catch((j) => {
8141
8122
  o();
8142
8123
  });
8143
8124
  };
8144
8125
  n.iterClosed.then(() => {
8145
8126
  A(), g == null || g.unsubscribe();
8146
- }).catch((I) => {
8127
+ }).catch((O) => {
8147
8128
  A(), g == null || g.unsubscribe();
8148
8129
  });
8149
8130
  try {
8150
8131
  this.publish(e, t, {
8151
8132
  reply: g.getSubject()
8152
8133
  });
8153
- } catch (I) {
8154
- y(I);
8134
+ } catch (O) {
8135
+ y(O);
8155
8136
  }
8156
8137
  let x = setTimeout(() => {
8157
8138
  y();
@@ -8160,13 +8141,13 @@ ${f}`), y(I);
8160
8141
  x && clearTimeout(x);
8161
8142
  };
8162
8143
  } else {
8163
- const f = s;
8164
- f.callback = a, n.iterClosed.then(() => {
8144
+ const d = s;
8145
+ d.callback = a, n.iterClosed.then(() => {
8165
8146
  p.cancel();
8166
8147
  }).catch((g) => {
8167
8148
  p.cancel(g);
8168
8149
  });
8169
- const p = new Sn(this.protocol.muxSubscriptions, e, f);
8150
+ const p = new Sn(this.protocol.muxSubscriptions, e, d);
8170
8151
  this.protocol.request(p);
8171
8152
  try {
8172
8153
  this.publish(e, t, {
@@ -8194,18 +8175,18 @@ ${f}`), y(I);
8194
8175
  if (!s.noMux && s.reply)
8195
8176
  return Promise.reject(new T("reply can only be used with noMux", k.InvalidOption));
8196
8177
  if (s.noMux) {
8197
- const n = s.reply ? s.reply : qe(this.options.inboxPrefix), o = Y(), a = i ? new Error() : null, f = this.subscribe(n, {
8178
+ const n = s.reply ? s.reply : qe(this.options.inboxPrefix), o = Y(), a = i ? new Error() : null, d = this.subscribe(n, {
8198
8179
  max: 1,
8199
8180
  timeout: s.timeout,
8200
8181
  callback: (p, g) => {
8201
8182
  p ? (a && p.code !== k.Timeout && (p.stack += `
8202
8183
 
8203
- ${a.stack}`), f.unsubscribe(), o.reject(p)) : (p = ei(g), p ? (a && (p.stack += `
8184
+ ${a.stack}`), d.unsubscribe(), o.reject(p)) : (p = ei(g), p ? (a && (p.stack += `
8204
8185
 
8205
8186
  ${a.stack}`), o.reject(p)) : o.resolve(g));
8206
8187
  }
8207
8188
  });
8208
- return f.requestSubject = e, this.protocol.publish(e, t, {
8189
+ return d.requestSubject = e, this.protocol.publish(e, t, {
8209
8190
  reply: n,
8210
8191
  headers: s.headers
8211
8192
  }), o;
@@ -8282,7 +8263,7 @@ ${a.stack}`), o.reject(p)) : o.resolve(g));
8282
8263
  }
8283
8264
  getServerVersion() {
8284
8265
  const e = this.info;
8285
- return e ? Qe(e.version) : void 0;
8266
+ return e ? Ze(e.version) : void 0;
8286
8267
  }
8287
8268
  async rtt() {
8288
8269
  if (!this.protocol._closed && !this.protocol.connected)
@@ -8307,7 +8288,7 @@ class Wo {
8307
8288
  }
8308
8289
  add(e) {
8309
8290
  try {
8310
- return new Mt(this.nc, e).start();
8291
+ return new Ut(this.nc, e).start();
8311
8292
  } catch (t) {
8312
8293
  return Promise.reject(t);
8313
8294
  }
@@ -8414,11 +8395,11 @@ class mi extends Pn {
8414
8395
  const a = `${n.api.prefix}.CONSUMER.CREATE.${n.stream}`;
8415
8396
  this.js._request(a, o, {
8416
8397
  retries: -1
8417
- }).then((f) => {
8418
- const p = f, g = this.sub.info;
8398
+ }).then((d) => {
8399
+ const p = d, g = this.sub.info;
8419
8400
  g.last = p, this.info.config = p.config, this.info.name = p.name;
8420
- }).catch((f) => {
8421
- const p = new T(`unable to recreate ordered consumer ${n.stream} at seq ${t}`, k.RequestError, f);
8401
+ }).catch((d) => {
8402
+ const p = new T(`unable to recreate ordered consumer ${n.stream} at seq ${t}`, k.RequestError, d);
8422
8403
  this.sub.callback(p, {});
8423
8404
  });
8424
8405
  }
@@ -8435,14 +8416,14 @@ class mi extends Pn {
8435
8416
  s && (i.cancelAfter = s);
8436
8417
  const n = this.sub, o = (a) => {
8437
8418
  var g, y, x, A;
8438
- const f = on(409, `${Pe.IdleHeartbeatMissed}: ${a}`, this.sub.subject);
8419
+ const d = on(409, `${Pe.IdleHeartbeatMissed}: ${a}`, this.sub.subject);
8439
8420
  if (!((g = this.info) == null ? void 0 : g.ordered))
8440
- this.sub.callback(null, f);
8421
+ this.sub.callback(null, d);
8441
8422
  else {
8442
8423
  if (!this.js.nc.protocol.connected)
8443
8424
  return !1;
8444
- const I = ((x = (y = this.info) == null ? void 0 : y.ordered_consumer_sequence) == null ? void 0 : x.stream_seq) || 0;
8445
- return this._resetOrderedConsumer(I + 1), (A = this.monitor) == null || A.restart(), !1;
8425
+ const O = ((x = (y = this.info) == null ? void 0 : y.ordered_consumer_sequence) == null ? void 0 : x.stream_seq) || 0;
8426
+ return this._resetOrderedConsumer(O + 1), (A = this.monitor) == null || A.restart(), !1;
8446
8427
  }
8447
8428
  return !n.noIterator;
8448
8429
  };
@@ -8477,20 +8458,20 @@ class Zo extends mi {
8477
8458
  }) {
8478
8459
  const { stream: t, config: s, name: i } = this.sub.info, n = s.durable_name ?? i, o = {};
8479
8460
  if (o.batch = e.batch || 1, o.no_wait = e.no_wait || !1, (e.max_bytes ?? 0) > 0) {
8480
- const p = this.js.nc.features.get(H.JS_PULL_MAX_BYTES);
8461
+ const p = this.js.nc.features.get(J.JS_PULL_MAX_BYTES);
8481
8462
  if (!p.ok)
8482
8463
  throw new Error(`max_bytes is only supported on servers ${p.min} or better`);
8483
8464
  o.max_bytes = e.max_bytes;
8484
8465
  }
8485
8466
  let a = 0;
8486
8467
  e.expires && e.expires > 0 && (a = e.expires, o.expires = W(a));
8487
- let f = 0;
8488
- if (e.idle_heartbeat && e.idle_heartbeat > 0 && (f = e.idle_heartbeat, o.idle_heartbeat = W(f)), f && a === 0)
8468
+ let d = 0;
8469
+ if (e.idle_heartbeat && e.idle_heartbeat > 0 && (d = e.idle_heartbeat, o.idle_heartbeat = W(d)), d && a === 0)
8489
8470
  throw new Error("idle_heartbeat requires expires");
8490
- if (f > a)
8471
+ if (d > a)
8491
8472
  throw new Error("expires must be greater than idle_heartbeat");
8492
8473
  if (this.info) {
8493
- this.monitor && this.monitor.cancel(), a && f && (this.monitor ? this.monitor._change(f, a) : this._setupHbMonitoring(f, a));
8474
+ this.monitor && this.monitor.cancel(), a && d && (this.monitor ? this.monitor._change(d, a) : this._setupHbMonitoring(d, a));
8494
8475
  const p = this.info.api, g = `${p.prefix}.CONSUMER.MSG.NEXT.${t}.${n}`, y = this.sub.subject;
8495
8476
  p.nc.publish(g, p.jc.encode(o), {
8496
8477
  reply: y
@@ -8505,12 +8486,12 @@ function ea(r) {
8505
8486
  return (e, t) => e ? [
8506
8487
  e,
8507
8488
  null
8508
- ] : (e = ct(t), e ? [
8489
+ ] : (e = at(t), e ? [
8509
8490
  e,
8510
8491
  null
8511
8492
  ] : [
8512
8493
  null,
8513
- Nt(t, r)
8494
+ Tt(t, r)
8514
8495
  ]);
8515
8496
  }
8516
8497
  function ta(r) {
@@ -8520,13 +8501,13 @@ function ta(r) {
8520
8501
  e,
8521
8502
  null
8522
8503
  ];
8523
- const s = ct(t);
8504
+ const s = at(t);
8524
8505
  return s !== null ? [
8525
8506
  bi(s),
8526
8507
  null
8527
8508
  ] : [
8528
8509
  null,
8529
- Nt(t, r)
8510
+ Tt(t, r)
8530
8511
  ];
8531
8512
  };
8532
8513
  }
@@ -8606,16 +8587,16 @@ class ia {
8606
8587
  n.publish(this.msg.reply, Hr, {
8607
8588
  reply: `${n.muxSubscriptions.baseInbox}${a.token}`
8608
8589
  });
8609
- } catch (f) {
8610
- a.cancel(f);
8590
+ } catch (d) {
8591
+ a.cancel(d);
8611
8592
  }
8612
8593
  try {
8613
8594
  await Promise.race([
8614
8595
  a.timer,
8615
8596
  a.deferred
8616
8597
  ]), t.resolve(!0);
8617
- } catch (f) {
8618
- a.cancel(f), t.reject(f);
8598
+ } catch (d) {
8599
+ a.cancel(d), t.reject(d);
8619
8600
  }
8620
8601
  } else
8621
8602
  t.resolve(!1);
@@ -8638,7 +8619,7 @@ class ia {
8638
8619
  }) {
8639
8620
  const s = {};
8640
8621
  s.batch = t.batch || 1, s.no_wait = t.no_wait || !1, t.expires && t.expires > 0 && (s.expires = W(t.expires));
8641
- const i = Oe().encode(s), n = dt.concat(qo, Bo, i), o = e ? {
8622
+ const i = Oe().encode(s), n = ft.concat(qo, Bo, i), o = e ? {
8642
8623
  reply: e
8643
8624
  } : void 0;
8644
8625
  this.msg.respond(n, o);
@@ -8692,15 +8673,15 @@ class aa {
8692
8673
  this.signal.resolve();
8693
8674
  return;
8694
8675
  }
8695
- const o = dt.concat(...this.yields), a = Rn(o);
8676
+ const o = ft.concat(...this.yields), a = Rn(o);
8696
8677
  if (a !== "") {
8697
- const f = wo.exec(a);
8698
- if (!f) {
8699
- t.debug && console.error("!!!", Kt(o)), s.reject(new Error("unexpected response from server"));
8678
+ const d = wo.exec(a);
8679
+ if (!d) {
8680
+ t.debug && console.error("!!!", zt(o)), s.reject(new Error("unexpected response from server"));
8700
8681
  return;
8701
8682
  }
8702
8683
  try {
8703
- const p = JSON.parse(f[1]);
8684
+ const p = JSON.parse(d[1]);
8704
8685
  _o(p, this.options), this.peeked = !0, this.connected = !0, this.signal.resolve(), s.resolve();
8705
8686
  } catch (p) {
8706
8687
  s.reject(p);
@@ -8727,7 +8708,7 @@ class aa {
8727
8708
  if (!this.isDiscarded() && this.connected && !this.done) {
8728
8709
  if (this.closeError = e, !e)
8729
8710
  for (; !this.socketClosed && this.socket.bufferedAmount > 0; )
8730
- await pt(100);
8711
+ await dt(100);
8731
8712
  this.done = !0;
8732
8713
  try {
8733
8714
  this.socket.close(e ? 1002 : 1e3, e ? e.message : void 0);
@@ -8750,7 +8731,7 @@ class aa {
8750
8731
  const e = this.yields;
8751
8732
  this.yields = [];
8752
8733
  for (let t = 0; t < e.length; t++)
8753
- this.options.debug && console.info(`> ${Kt(e[t])}`), yield e[t];
8734
+ this.options.debug && console.info(`> ${zt(e[t])}`), yield e[t];
8754
8735
  if (this.done)
8755
8736
  break;
8756
8737
  this.yields.length === 0 && (e.length = 0, this.yields = e, this.signal = Y());
@@ -8762,10 +8743,10 @@ class aa {
8762
8743
  send(e) {
8763
8744
  if (!this.isDiscarded())
8764
8745
  try {
8765
- this.socket.send(e.buffer), this.options.debug && console.info(`< ${Kt(e)}`);
8746
+ this.socket.send(e.buffer), this.options.debug && console.info(`< ${zt(e)}`);
8766
8747
  return;
8767
8748
  } catch (t) {
8768
- this.options.debug && console.error(`!!! ${Kt(e)}: ${t}`);
8749
+ this.options.debug && console.error(`!!! ${zt(e)}: ${t}`);
8769
8750
  }
8770
8751
  }
8771
8752
  close(e) {
@@ -8792,7 +8773,7 @@ function ca(r, e) {
8792
8773
  const i = s.protocol.toLowerCase();
8793
8774
  i === "ws:" && (e = !1), i === "wss:" && (e = !0), i !== "https:" && i !== "http" && (r = r.replace(/^(.*:\/\/)(.*)/gm, "$2"), s = new URL(`http://${r}`));
8794
8775
  let n, o;
8795
- const a = s.hostname, f = s.pathname, p = s.search || "";
8776
+ const a = s.hostname, d = s.pathname, p = s.search || "";
8796
8777
  switch (i) {
8797
8778
  case "http:":
8798
8779
  case "ws:":
@@ -8808,7 +8789,7 @@ function ca(r, e) {
8808
8789
  o = s.port || e === !0 ? "443" : "80", n = e === !0 ? "wss:" : "ws:";
8809
8790
  break;
8810
8791
  }
8811
- return `${n}//${a}:${o}${f}${p}`;
8792
+ return `${n}//${a}:${o}${d}${p}`;
8812
8793
  }
8813
8794
  function ha(r = {}) {
8814
8795
  return kn({
@@ -8837,8 +8818,8 @@ class Kr {
8837
8818
  }
8838
8819
  async connect(e = {}) {
8839
8820
  var x;
8840
- const { natsWsUrls: t, user: s, prefix: i, accessToken: n, sessionSeed: o } = e, a = t ?? [this.config.natsUrl], f = n ?? await this.config.auth.getAccessToken();
8841
- if (!f)
8821
+ const { natsWsUrls: t, user: s, prefix: i, accessToken: n, sessionSeed: o } = e, a = t ?? [this.config.natsUrl], d = n ?? await this.config.auth.getAccessToken();
8822
+ if (!d)
8842
8823
  throw new Error("Please provide auth token");
8843
8824
  const p = o ?? await this.config.auth.getSessionSeed();
8844
8825
  if (!p)
@@ -8847,7 +8828,7 @@ class Kr {
8847
8828
  this.nc = await ha({
8848
8829
  servers: a,
8849
8830
  authenticator: fo(
8850
- f,
8831
+ d,
8851
8832
  g.encode(p)
8852
8833
  )
8853
8834
  });
@@ -8860,16 +8841,16 @@ class Kr {
8860
8841
  "[nats] connected.",
8861
8842
  this.globalPrefix ? `(prefix: ${this.globalPrefix})` : ""
8862
8843
  ), (async () => {
8863
- var A, I;
8864
- for await (const N of this.nc.status())
8865
- switch (N.type !== He.PingTimer && console.log("[nats] connection status:", N.type), N.type) {
8844
+ var A, O;
8845
+ for await (const j of this.nc.status())
8846
+ switch (j.type !== He.PingTimer && console.log("[nats] connection status:", j.type), j.type) {
8866
8847
  case ke.Reconnect:
8867
8848
  (A = this.onStatusChange) == null || A.call(this, !0);
8868
8849
  break;
8869
8850
  case ke.Disconnect:
8870
8851
  case ke.Error:
8871
8852
  case He.Reconnecting:
8872
- (I = this.onStatusChange) == null || I.call(this, !1);
8853
+ (O = this.onStatusChange) == null || O.call(this, !1);
8873
8854
  break;
8874
8855
  }
8875
8856
  })();
@@ -8919,9 +8900,9 @@ class Kr {
8919
8900
  continue;
8920
8901
  }
8921
8902
  a[0] === "dev" && a.shift();
8922
- const f = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], g = a[a.length - 1], y = Be.decode(o.data);
8903
+ const d = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], g = a[a.length - 1], y = Be.decode(o.data);
8923
8904
  t(y, {
8924
- subject: f,
8905
+ subject: d,
8925
8906
  userId: p,
8926
8907
  sessionId: g
8927
8908
  });
@@ -8947,10 +8928,10 @@ class Kr {
8947
8928
  continue;
8948
8929
  }
8949
8930
  a[0] === "dev" && a.shift();
8950
- const f = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], g = a[a.length - 1], y = Be.decode(o.data);
8931
+ const d = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], g = a[a.length - 1], y = Be.decode(o.data);
8951
8932
  try {
8952
8933
  const x = await t(y, {
8953
- subject: f,
8934
+ subject: d,
8954
8935
  userId: p,
8955
8936
  sessionId: g
8956
8937
  });
@@ -9011,50 +8992,50 @@ function _i(r) {
9011
8992
  }
9012
8993
  class ua {
9013
8994
  async getAudioBuffer(e, t, s) {
9014
- const i = [], n = crypto.randomUUID();
9015
- return new Promise((o, a) => {
9016
- const f = new WebSocket(
9017
- `${Wt.WSS_URL}?trustedclienttoken=${Wt.TRUSTED_CLIENT_TOKEN}&ConnectionId=${n}`
9018
- );
9019
- f.binaryType = "arraybuffer";
9020
- const p = fa(e, t, s);
9021
- f.addEventListener("open", () => {
9022
- const g = la();
9023
- f.send(g);
9024
- const y = `X-RequestId:${n}\r
8995
+ const i = [], n = crypto.randomUUID(), o = await pa(
8996
+ Et.TRUSTED_CLIENT_TOKEN
8997
+ );
8998
+ return new Promise((a, d) => {
8999
+ const p = `${Et.WSS_URL}?TrustedClientToken=${Et.TRUSTED_CLIENT_TOKEN}&Sec-MS-GEC=${o}&Sec-MS-GEC-Version=1-130.0.2849.68&ConnectionId=${n}`, g = new WebSocket(p);
9000
+ g.binaryType = "arraybuffer";
9001
+ const y = fa(e, t, s);
9002
+ g.addEventListener("open", () => {
9003
+ const x = la();
9004
+ g.send(x);
9005
+ const A = `X-RequestId:${n}\r
9025
9006
  Content-Type:application/ssml+xml\r
9026
9007
  X-Timestamp:${(/* @__PURE__ */ new Date()).toISOString()}Z\r
9027
9008
  Path:ssml\r
9028
9009
  \r
9029
- ` + p;
9030
- f.send(y);
9031
- }), f.addEventListener("message", (g) => {
9032
- const y = g.data;
9033
- if (y instanceof ArrayBuffer) {
9034
- const x = new Uint8Array(y), A = new TextEncoder().encode(`Path:audio\r
9035
- `), I = da(x, A);
9036
- if (I !== -1) {
9037
- const J = x.subarray(I + A.length);
9038
- i.push(J);
9010
+ ` + y;
9011
+ g.send(A);
9012
+ }), g.addEventListener("message", (x) => {
9013
+ const A = x.data;
9014
+ if (A instanceof ArrayBuffer) {
9015
+ const O = new Uint8Array(A), j = new TextEncoder().encode(`Path:audio\r
9016
+ `), B = da(O, j);
9017
+ if (B !== -1) {
9018
+ const L = O.subarray(B + j.length);
9019
+ i.push(L);
9039
9020
  }
9040
- new TextDecoder().decode(x).includes("Path:turn.end") && f.close();
9021
+ new TextDecoder().decode(O).includes("Path:turn.end") && g.close();
9041
9022
  } else
9042
- y.includes("Path:turn.end") && f.close();
9043
- }), f.addEventListener("close", () => {
9023
+ A.includes("Path:turn.end") && g.close();
9024
+ }), g.addEventListener("close", () => {
9044
9025
  if (!i.length) {
9045
- a("No audio data available to save.");
9026
+ d("No audio data available to save.");
9046
9027
  return;
9047
9028
  }
9048
- const g = i.reduce(
9049
- (A, I) => A + I.length,
9029
+ const x = i.reduce(
9030
+ (j, B) => j + B.length,
9050
9031
  0
9051
- ), y = new Uint8Array(g);
9052
- let x = 0;
9053
- for (const A of i)
9054
- y.set(A, x), x += A.length;
9055
- o(y.buffer);
9056
- }), f.addEventListener("error", (g) => {
9057
- a(g);
9032
+ ), A = new Uint8Array(x);
9033
+ let O = 0;
9034
+ for (const j of i)
9035
+ A.set(j, O), O += j.length;
9036
+ a(A.buffer);
9037
+ }), g.addEventListener("error", (x) => {
9038
+ d(x);
9058
9039
  });
9059
9040
  });
9060
9041
  }
@@ -9065,7 +9046,7 @@ Path:ssml\r
9065
9046
  }
9066
9047
  async getVoices() {
9067
9048
  return (await (await fetch(
9068
- `${Wt.VOICES_URL}?trustedclienttoken=${Wt.TRUSTED_CLIENT_TOKEN}`
9049
+ `${Et.VOICES_URL}?trustedclienttoken=${Et.TRUSTED_CLIENT_TOKEN}`
9069
9050
  )).json()).map((s) => ({
9070
9051
  id: s.ShortName,
9071
9052
  locale: s.Locale,
@@ -9073,7 +9054,7 @@ Path:ssml\r
9073
9054
  }));
9074
9055
  }
9075
9056
  }
9076
- const Wt = {
9057
+ const Et = {
9077
9058
  TRUSTED_CLIENT_TOKEN: "6A5AA1D4EAFF4E9FB37E23D68491D6F4",
9078
9059
  WSS_URL: "wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1",
9079
9060
  VOICES_URL: "https://speech.platform.bing.com/consumer/speech/synthesize/readaloud/voices/list"
@@ -9099,7 +9080,11 @@ function da(r, e) {
9099
9080
  }
9100
9081
  return -1;
9101
9082
  }
9102
- class ma {
9083
+ const pa = async (r) => {
9084
+ const e = Math.floor(Date.now() / 1e3) + 11644473600, s = (e - e % 300) * 1e7, n = new TextEncoder().encode(`${s}${r}`), o = await crypto.subtle.digest("SHA-256", n);
9085
+ return Array.from(new Uint8Array(o)).map((a) => a.toString(16).padStart(2, "0")).join("").toUpperCase();
9086
+ };
9087
+ class ba {
9103
9088
  constructor(e) {
9104
9089
  this.config = e;
9105
9090
  }
@@ -9136,10 +9121,10 @@ class ma {
9136
9121
  if (y) break;
9137
9122
  a.push(x);
9138
9123
  }
9139
- const f = a.reduce(
9124
+ const d = a.reduce(
9140
9125
  (y, x) => y + x.length,
9141
9126
  0
9142
- ), p = new Uint8Array(f);
9127
+ ), p = new Uint8Array(d);
9143
9128
  let g = 0;
9144
9129
  for (const y of a)
9145
9130
  p.set(y, g), g += y.length;
@@ -9167,7 +9152,7 @@ const yi = {
9167
9152
  authUrl: "https://auth.jok.io",
9168
9153
  natsUrl: "https://nats.jok.io",
9169
9154
  storage: new gi()
9170
- }, zr = new Xr(yi), ba = {
9155
+ }, zr = new Xr(yi), ga = {
9171
9156
  setup(r) {
9172
9157
  if (r.authUrl || r.storage) {
9173
9158
  const e = this.auth.onUserDataUpdate;
@@ -9189,6 +9174,6 @@ const yi = {
9189
9174
  };
9190
9175
  export {
9191
9176
  Kr as NatsService,
9192
- ma as VoicevoxTtsService,
9193
- ba as jok
9177
+ ba as VoicevoxTtsService,
9178
+ ga as jok
9194
9179
  };