@jokio/sdk 0.4.2 → 0.6.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,49 +178,49 @@ 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;
193
- let g;
194
- typeof f.getTransports == "function" && (g = f.getTransports());
192
+ const { id: o, rawId: a, response: d, type: p } = n;
193
+ let _;
194
+ typeof d.getTransports == "function" && (_ = 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),
223
- transports: g,
221
+ attestationObject: Me(d.attestationObject),
222
+ clientDataJSON: Me(d.clientDataJSON),
223
+ transports: _,
224
224
  publicKeyAlgorithm: y,
225
225
  publicKey: x,
226
226
  authenticatorData: A
@@ -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,20 +308,20 @@ 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: _, type: y } = a;
317
317
  let x;
318
- return g.userHandle && (x = Me(g.userHandle)), {
319
- id: f,
318
+ return _.userHandle && (x = Me(_.userHandle)), {
319
+ id: d,
320
320
  rawId: Me(p),
321
321
  response: {
322
- authenticatorData: Me(g.authenticatorData),
323
- clientDataJSON: Me(g.clientDataJSON),
324
- signature: Me(g.signature),
322
+ authenticatorData: Me(_.authenticatorData),
323
+ clientDataJSON: Me(_.clientDataJSON),
324
+ signature: Me(_.signature),
325
325
  userHandle: x
326
326
  },
327
327
  type: y,
@@ -364,35 +364,47 @@ class Xr {
364
364
  s.accessToken
365
365
  ), await this.options.storage.setItem(wt, s.jwtData), (i = this.onUserDataUpdate) == null || i.call(this, s.jwtData), s.jwtData;
366
366
  }
367
- async requestPasskeyLogin(e = {}) {
368
- var f, p;
369
- const {
370
- displayName: t = "",
371
- isRegistration: s = !1,
372
- addAsAdditionalDevice: i = !1
373
- } = e, n = await fetch(
367
+ /**
368
+ * Fetch WebAuthn challenge options ahead of the user gesture
369
+ * (e.g. on page load or pointerdown). Pass the result to
370
+ * completePasskeyLogin() inside the click handler so
371
+ * navigator.credentials.get() runs while the user activation is
372
+ * still fresh — iOS Safari rejects it otherwise.
373
+ */
374
+ async requestPasskeyChallenge(e = {}) {
375
+ const { displayName: t = "", isRegistration: s = !1 } = e;
376
+ return await fetch(
374
377
  this.options.authUrl + `/webauth-challenge-request?registration=${s ? "true" : ""}&displayName=${t}`,
375
378
  {
376
379
  headers: await this.getAuthHeader()
377
380
  }
378
381
  ).then(xt);
379
- let o;
382
+ }
383
+ /**
384
+ * Prompt for the passkey and verify it. Call synchronously from
385
+ * the click handler with a challenge obtained earlier via
386
+ * requestPasskeyChallenge().
387
+ */
388
+ async completePasskeyLogin(e, t = {}) {
389
+ var a, d;
390
+ const { displayName: s = "", addAsAdditionalDevice: i = !1 } = t;
391
+ let n;
380
392
  try {
381
- (f = n.user) != null && f.id ? o = await Bi({
382
- optionsJSON: n
383
- }) : o = await Ji({
384
- optionsJSON: n
393
+ !("user" in e) || !((a = e.user) != null && a.id) ? n = await Ji({
394
+ optionsJSON: e
395
+ }) : n = await Bi({
396
+ optionsJSON: e
385
397
  });
386
- } catch (g) {
387
- throw g.name === "InvalidStateError" ? alert(
398
+ } catch (p) {
399
+ throw p.name === "InvalidStateError" ? alert(
388
400
  "Error: Authenticator was probably already registered by user"
389
- ) : alert(g.message), g;
401
+ ) : alert(p.message), p;
390
402
  }
391
- const a = await fetch(
392
- this.options.authUrl + `/webauth-challenge-complete?displayName=${t}&addAsAdditionalDevice=${i ? "true" : ""}`,
403
+ const o = await fetch(
404
+ this.options.authUrl + `/webauth-challenge-complete?displayName=${s}&addAsAdditionalDevice=${i ? "true" : ""}`,
393
405
  {
394
406
  method: "POST",
395
- body: JSON.stringify(o),
407
+ body: JSON.stringify(n),
396
408
  headers: {
397
409
  "Content-Type": "application/json",
398
410
  ...await this.getAuthHeader()
@@ -401,8 +413,18 @@ class Xr {
401
413
  ).then(xt);
402
414
  return await this.options.storage.setItem(
403
415
  yt,
404
- a.accessToken
405
- ), await this.options.storage.setItem(wt, a.jwtData), (p = this.onUserDataUpdate) == null || p.call(this, a.jwtData), a.jwtData;
416
+ o.accessToken
417
+ ), await this.options.storage.setItem(wt, o.jwtData), (d = this.onUserDataUpdate) == null || d.call(this, o.jwtData), o.jwtData;
418
+ }
419
+ /**
420
+ * Fetches the challenge and prompts for the passkey in one call.
421
+ * Note: on iOS Safari the fetch may consume the user activation,
422
+ * causing credentials.get() to be blocked. Prefer
423
+ * requestPasskeyChallenge() + completePasskeyLogin().
424
+ */
425
+ async requestPasskeyLogin(e = {}) {
426
+ const t = await this.requestPasskeyChallenge(e);
427
+ return this.completePasskeyLogin(t, e);
406
428
  }
407
429
  async guestLogin() {
408
430
  var t;
@@ -519,7 +541,7 @@ function Wi(...r) {
519
541
  t.set(r[i], s), s += r[i].length;
520
542
  return t;
521
543
  }
522
- function Pt(...r) {
544
+ function kt(...r) {
523
545
  const e = [];
524
546
  for (let t = 0; t < r.length; t++)
525
547
  e.push(We.encode(r[t]));
@@ -642,10 +664,10 @@ var Ne;
642
664
  (function(r) {
643
665
  r.Timer = "timer", r.Count = "count", r.JitterTimer = "jitterTimer", r.SentinelMsg = "sentinelMsg";
644
666
  })(Ne || (Ne = {}));
645
- var kt;
667
+ var Ot;
646
668
  (function(r) {
647
669
  r.STATS = "io.nats.micro.v1.stats_response", r.INFO = "io.nats.micro.v1.info_response", r.PING = "io.nats.micro.v1.ping_response";
648
- })(kt || (kt = {}));
670
+ })(Ot || (Ot = {}));
649
671
  const Qt = "Nats-Service-Error", es = "Nats-Service-Error-Code";
650
672
  class ts extends Error {
651
673
  constructor(t, s) {
@@ -688,7 +710,7 @@ function cs(r, ...e) {
688
710
  }
689
711
  return r;
690
712
  }
691
- function Kt(r) {
713
+ function zt(r) {
692
714
  return xe.decode(r).replace(/\n/g, "␊").replace(/\r/g, "␍");
693
715
  }
694
716
  function ut(r, e = !0) {
@@ -837,8 +859,8 @@ class Ke {
837
859
  if (o) {
838
860
  const a = o.indexOf(":");
839
861
  if (a > -1) {
840
- const f = o.slice(0, a), p = o.slice(a + 1).trim();
841
- t.append(f, p);
862
+ const d = o.slice(0, a), p = o.slice(a + 1).trim();
863
+ t.append(d, p);
842
864
  }
843
865
  }
844
866
  }), t;
@@ -1075,7 +1097,7 @@ function hs(r, e = "") {
1075
1097
  }
1076
1098
  }), "";
1077
1099
  }
1078
- function Et(r, e = "") {
1100
+ function At(r, e = "") {
1079
1101
  if (e === "")
1080
1102
  throw Error(`${r} name required`);
1081
1103
  const t = nn(e);
@@ -1285,10 +1307,10 @@ var qs;
1285
1307
  (function(r) {
1286
1308
  r.Limits = "limits", r.Interest = "interest", r.Workqueue = "workqueue";
1287
1309
  })(qs || (qs = {}));
1288
- var It;
1310
+ var jt;
1289
1311
  (function(r) {
1290
1312
  r.Old = "old", r.New = "new";
1291
- })(It || (It = {}));
1313
+ })(jt || (jt = {}));
1292
1314
  var Fs;
1293
1315
  (function(r) {
1294
1316
  r.File = "file", r.Memory = "memory";
@@ -1645,7 +1667,7 @@ Os = us, function() {
1645
1667
  t.JS_SHA256_NO_WINDOW && (e = !1);
1646
1668
  var s = !e && typeof self == "object", i = !t.JS_SHA256_NO_NODE_JS && Ir.versions && Ir.versions.node;
1647
1669
  i ? t = dn : s && (t = self);
1648
- var n = !t.JS_SHA256_NO_COMMON_JS && Os.exports, o = !t.JS_SHA256_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", a = "0123456789abcdef".split(""), f = [
1670
+ var n = !t.JS_SHA256_NO_COMMON_JS && Os.exports, o = !t.JS_SHA256_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", a = "0123456789abcdef".split(""), d = [
1649
1671
  -2147483648,
1650
1672
  8388608,
1651
1673
  32768,
@@ -1655,7 +1677,7 @@ Os = us, function() {
1655
1677
  16,
1656
1678
  8,
1657
1679
  0
1658
- ], g = [
1680
+ ], _ = [
1659
1681
  1116352408,
1660
1682
  1899447441,
1661
1683
  3049323471,
@@ -1731,50 +1753,50 @@ Os = us, function() {
1731
1753
  }), !o || !t.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW && ArrayBuffer.isView || (ArrayBuffer.isView = function(w) {
1732
1754
  return typeof w == "object" && w.buffer && w.buffer.constructor === ArrayBuffer;
1733
1755
  });
1734
- var A = function(w, j) {
1756
+ var A = function(w, R) {
1735
1757
  return function(F) {
1736
- return new L(j, !0).update(F)[w]();
1758
+ return new L(R, !0).update(F)[w]();
1737
1759
  };
1738
- }, I = function(w) {
1739
- var j = A("hex", w);
1740
- i && (j = N(j, w)), j.create = function() {
1760
+ }, O = function(w) {
1761
+ var R = A("hex", w);
1762
+ i && (R = j(R, w)), R.create = function() {
1741
1763
  return new L(w);
1742
- }, j.update = function(P) {
1743
- return j.create().update(P);
1764
+ }, R.update = function(P) {
1765
+ return R.create().update(P);
1744
1766
  };
1745
1767
  for (var F = 0; F < y.length; ++F) {
1746
- var R = y[F];
1747
- j[R] = A(R, w);
1768
+ var N = y[F];
1769
+ R[N] = A(N, w);
1748
1770
  }
1749
- return j;
1750
- }, N = function(w, j) {
1751
- var F, R = Rr, P = Rr.Buffer, U = j ? "sha224" : "sha256";
1771
+ return R;
1772
+ }, j = function(w, R) {
1773
+ var F, N = Rr, P = Rr.Buffer, U = R ? "sha224" : "sha256";
1752
1774
  return F = P.from && !t.JS_SHA256_NO_BUFFER_FROM ? P.from : function(q) {
1753
1775
  return new P(q);
1754
1776
  }, function(q) {
1755
- if (typeof q == "string") return R.createHash(U).update(q, "utf8").digest("hex");
1777
+ if (typeof q == "string") return N.createHash(U).update(q, "utf8").digest("hex");
1756
1778
  if (q == null) throw new Error(r);
1757
- 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);
1779
+ 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);
1758
1780
  };
1759
- }, J = function(w, j) {
1760
- return function(F, R) {
1761
- return new Q(F, j, !0).update(R)[w]();
1781
+ }, B = function(w, R) {
1782
+ return function(F, N) {
1783
+ return new ee(F, R, !0).update(N)[w]();
1762
1784
  };
1763
- }, ee = function(w) {
1764
- var j = J("hex", w);
1765
- j.create = function(P) {
1766
- return new Q(P, w);
1767
- }, j.update = function(P, U) {
1768
- return j.create(P).update(U);
1785
+ }, Q = function(w) {
1786
+ var R = B("hex", w);
1787
+ R.create = function(P) {
1788
+ return new ee(P, w);
1789
+ }, R.update = function(P, U) {
1790
+ return R.create(P).update(U);
1769
1791
  };
1770
1792
  for (var F = 0; F < y.length; ++F) {
1771
- var R = y[F];
1772
- j[R] = J(R, w);
1793
+ var N = y[F];
1794
+ R[N] = B(N, w);
1773
1795
  }
1774
- return j;
1796
+ return R;
1775
1797
  };
1776
- function L(w, j) {
1777
- 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 = [
1798
+ function L(w, R) {
1799
+ 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 = [
1778
1800
  0,
1779
1801
  0,
1780
1802
  0,
@@ -1794,11 +1816,11 @@ Os = us, function() {
1794
1816
  0
1795
1817
  ], 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;
1796
1818
  }
1797
- function Q(w, j, F) {
1798
- var R, P = typeof w;
1819
+ function ee(w, R, F) {
1820
+ var N, P = typeof w;
1799
1821
  if (P === "string") {
1800
1822
  var U, q = [], $ = w.length, V = 0;
1801
- 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);
1823
+ 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);
1802
1824
  w = q;
1803
1825
  } else {
1804
1826
  if (P !== "object") throw new Error(r);
@@ -1806,27 +1828,27 @@ Os = us, function() {
1806
1828
  if (o && w.constructor === ArrayBuffer) w = new Uint8Array(w);
1807
1829
  else if (!(Array.isArray(w) || o && ArrayBuffer.isView(w))) throw new Error(r);
1808
1830
  }
1809
- w.length > 64 && (w = new L(j, !0).update(w).array());
1831
+ w.length > 64 && (w = new L(R, !0).update(w).array());
1810
1832
  var re = [], ne = [];
1811
- for (R = 0; R < 64; ++R) {
1812
- var ie = w[R] || 0;
1813
- re[R] = 92 ^ ie, ne[R] = 54 ^ ie;
1833
+ for (N = 0; N < 64; ++N) {
1834
+ var ie = w[N] || 0;
1835
+ re[N] = 92 ^ ie, ne[N] = 54 ^ ie;
1814
1836
  }
1815
- L.call(this, j, F), this.update(ne), this.oKeyPad = re, this.inner = !0, this.sharedMemory = F;
1837
+ L.call(this, R, F), this.update(ne), this.oKeyPad = re, this.inner = !0, this.sharedMemory = F;
1816
1838
  }
1817
1839
  L.prototype.update = function(w) {
1818
1840
  if (!this.finalized) {
1819
- var j, F = typeof w;
1841
+ var R, F = typeof w;
1820
1842
  if (F !== "string") {
1821
1843
  if (F !== "object") throw new Error(r);
1822
1844
  if (w === null) throw new Error(r);
1823
1845
  if (o && w.constructor === ArrayBuffer) w = new Uint8Array(w);
1824
1846
  else if (!(Array.isArray(w) || o && ArrayBuffer.isView(w))) throw new Error(r);
1825
- j = !0;
1847
+ R = !0;
1826
1848
  }
1827
- for (var R, 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), j) 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) (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++]);
1849
+ for (var N, P, U = 0, q = w.length, $ = this.blocks; U < q; ) {
1850
+ 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++];
1851
+ 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++]);
1830
1852
  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;
1831
1853
  }
1832
1854
  return this.bytes > 4294967295 && (this.hBytes += this.bytes / 4294967296 | 0, this.bytes = this.bytes % 4294967296), this;
@@ -1834,37 +1856,37 @@ Os = us, function() {
1834
1856
  }, L.prototype.finalize = function() {
1835
1857
  if (!this.finalized) {
1836
1858
  this.finalized = !0;
1837
- var w = this.blocks, j = this.lastByteIndex;
1838
- 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();
1859
+ var w = this.blocks, R = this.lastByteIndex;
1860
+ 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();
1839
1861
  }
1840
1862
  }, L.prototype.hash = function() {
1841
- 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;
1842
- 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;
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) : (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;
1863
+ 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;
1864
+ 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;
1865
+ 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) + _[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) + _[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) + _[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) + _[w + 3] + ae[w + 3]) | 0, re = P + (R + N) | 0, this.chromeBugWorkAround = !0;
1844
1866
  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;
1845
1867
  }, L.prototype.hex = function() {
1846
1868
  this.finalize();
1847
- 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];
1869
+ 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];
1848
1870
  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;
1849
1871
  }, L.prototype.toString = L.prototype.hex, L.prototype.digest = function() {
1850
1872
  this.finalize();
1851
- 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 = [
1873
+ 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 = [
1852
1874
  w >>> 24 & 255,
1853
1875
  w >>> 16 & 255,
1854
1876
  w >>> 8 & 255,
1855
1877
  255 & w,
1856
- j >>> 24 & 255,
1857
- j >>> 16 & 255,
1858
- j >>> 8 & 255,
1859
- 255 & j,
1860
- F >>> 24 & 255,
1861
- F >>> 16 & 255,
1862
- F >>> 8 & 255,
1863
- 255 & F,
1864
1878
  R >>> 24 & 255,
1865
1879
  R >>> 16 & 255,
1866
1880
  R >>> 8 & 255,
1867
1881
  255 & R,
1882
+ F >>> 24 & 255,
1883
+ F >>> 16 & 255,
1884
+ F >>> 8 & 255,
1885
+ 255 & F,
1886
+ N >>> 24 & 255,
1887
+ N >>> 16 & 255,
1888
+ N >>> 8 & 255,
1889
+ 255 & N,
1868
1890
  P >>> 24 & 255,
1869
1891
  P >>> 16 & 255,
1870
1892
  P >>> 8 & 255,
@@ -1881,17 +1903,17 @@ Os = us, function() {
1881
1903
  return this.is224 || V.push($ >>> 24 & 255, $ >>> 16 & 255, $ >>> 8 & 255, 255 & $), V;
1882
1904
  }, L.prototype.array = L.prototype.digest, L.prototype.arrayBuffer = function() {
1883
1905
  this.finalize();
1884
- var w = new ArrayBuffer(this.is224 ? 28 : 32), j = new DataView(w);
1885
- 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;
1886
- }, Q.prototype = new L(), Q.prototype.finalize = function() {
1906
+ var w = new ArrayBuffer(this.is224 ? 28 : 32), R = new DataView(w);
1907
+ 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;
1908
+ }, ee.prototype = new L(), ee.prototype.finalize = function() {
1887
1909
  if (L.prototype.finalize.call(this), this.inner) {
1888
1910
  this.inner = !1;
1889
1911
  var w = this.array();
1890
1912
  L.call(this, this.is224, this.sharedMemory), this.update(this.oKeyPad), this.update(w), L.prototype.finalize.call(this);
1891
1913
  }
1892
1914
  };
1893
- var de = I();
1894
- 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);
1915
+ var de = O();
1916
+ 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);
1895
1917
  }();
1896
1918
  us.exports;
1897
1919
  us.exports.sha224;
@@ -2006,7 +2028,7 @@ function En(r) {
2006
2028
  timeout: 5e3
2007
2029
  }, r);
2008
2030
  }
2009
- class Tt {
2031
+ class Mt {
2010
2032
  constructor(e, t) {
2011
2033
  h(this, "nc");
2012
2034
  h(this, "opts");
@@ -2033,14 +2055,14 @@ class Tt {
2033
2055
  const o = Xs();
2034
2056
  for (let a = 0; a < n; a++)
2035
2057
  try {
2036
- const f = await this.nc.request(e, i, s);
2037
- return this.parseJsResponse(f);
2038
- } catch (f) {
2039
- const p = f;
2058
+ const d = await this.nc.request(e, i, s);
2059
+ return this.parseJsResponse(d);
2060
+ } catch (d) {
2061
+ const p = d;
2040
2062
  if ((p.code === "503" || p.code === k.Timeout) && a + 1 < n)
2041
2063
  await dt(o.backoff(a));
2042
2064
  else
2043
- throw f;
2065
+ throw d;
2044
2066
  }
2045
2067
  }
2046
2068
  async findStream(e) {
@@ -2064,7 +2086,7 @@ class Tt {
2064
2086
  return t;
2065
2087
  }
2066
2088
  }
2067
- class At {
2089
+ class Pt {
2068
2090
  constructor(e, t, s, i) {
2069
2091
  h(this, "err");
2070
2092
  h(this, "offset");
@@ -2132,10 +2154,10 @@ function Ze(r = "") {
2132
2154
  function Ds(r, e) {
2133
2155
  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;
2134
2156
  }
2135
- var H;
2157
+ var J;
2136
2158
  (function(r) {
2137
2159
  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";
2138
- })(H || (H = {}));
2160
+ })(J || (J = {}));
2139
2161
  class An {
2140
2162
  constructor(e) {
2141
2163
  h(this, "server");
@@ -2153,7 +2175,7 @@ class An {
2153
2175
  return this.disabled.indexOf(e) !== -1;
2154
2176
  }
2155
2177
  update(e) {
2156
- typeof e == "string" && (e = Ze(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) => {
2178
+ 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) => {
2157
2179
  this.features.delete(t);
2158
2180
  });
2159
2181
  }
@@ -2177,7 +2199,7 @@ class An {
2177
2199
  return typeof e == "string" && (e = Ze(e)), Ds(this.server, e) >= 0;
2178
2200
  }
2179
2201
  }
2180
- class rs extends Tt {
2202
+ class rs extends Mt {
2181
2203
  constructor(e, t) {
2182
2204
  super(e, t);
2183
2205
  }
@@ -2189,32 +2211,32 @@ class rs extends Tt {
2189
2211
  const i = {};
2190
2212
  i.config = t, i.stream_name = e, i.action = s, i.config.durable_name && ot(i.config.durable_name);
2191
2213
  const n = this.nc;
2192
- let { min: o, ok: a } = n.features.get(H.JS_NEW_CONSUMER_CREATE_API);
2193
- const f = t.name === "" ? void 0 : t.name;
2194
- if (f && !a)
2214
+ let { min: o, ok: a } = n.features.get(J.JS_NEW_CONSUMER_CREATE_API);
2215
+ const d = t.name === "" ? void 0 : t.name;
2216
+ if (d && !a)
2195
2217
  throw new Error(`consumer 'name' requires server ${o}`);
2196
- if (f)
2218
+ if (d)
2197
2219
  try {
2198
- hs("name", f);
2220
+ hs("name", d);
2199
2221
  } catch (x) {
2200
- const A = x.message, I = A.indexOf("cannot contain");
2201
- throw I !== -1 ? new Error(`consumer 'name' ${A.substring(I)}`) : x;
2222
+ const A = x.message, O = A.indexOf("cannot contain");
2223
+ throw O !== -1 ? new Error(`consumer 'name' ${A.substring(O)}`) : x;
2202
2224
  }
2203
- let p, g = "";
2225
+ let p, _ = "";
2204
2226
  if (Array.isArray(t.filter_subjects)) {
2205
- const { min: x, ok: A } = n.features.get(H.JS_MULTIPLE_CONSUMER_FILTER);
2227
+ const { min: x, ok: A } = n.features.get(J.JS_MULTIPLE_CONSUMER_FILTER);
2206
2228
  if (!A)
2207
2229
  throw new Error(`consumer 'filter_subjects' requires server ${x}`);
2208
2230
  a = !1;
2209
2231
  }
2210
2232
  if (t.metadata) {
2211
- const { min: x, ok: A } = n.features.get(H.JS_STREAM_CONSUMER_METADATA);
2233
+ const { min: x, ok: A } = n.features.get(J.JS_STREAM_CONSUMER_METADATA);
2212
2234
  if (!A)
2213
2235
  throw new Error(`consumer 'metadata' requires server ${x}`);
2214
2236
  }
2215
- if (a && (g = t.name ?? t.durable_name ?? ""), g !== "") {
2237
+ if (a && (_ = t.name ?? t.durable_name ?? ""), _ !== "") {
2216
2238
  let x = t.filter_subject ?? void 0;
2217
- x === ">" && (x = void 0), p = x !== void 0 ? `${this.prefix}.CONSUMER.CREATE.${e}.${g}.${x}` : `${this.prefix}.CONSUMER.CREATE.${e}.${g}`;
2239
+ x === ">" && (x = void 0), p = x !== void 0 ? `${this.prefix}.CONSUMER.CREATE.${e}.${_}.${x}` : `${this.prefix}.CONSUMER.CREATE.${e}.${_}`;
2218
2240
  } else
2219
2241
  p = t.durable_name ? `${this.prefix}.CONSUMER.DURABLE.CREATE.${e}.${t.durable_name}` : `${this.prefix}.CONSUMER.CREATE.${e}`;
2220
2242
  return await this._request(p, i);
@@ -2232,7 +2254,7 @@ class rs extends Tt {
2232
2254
  list(e) {
2233
2255
  pe(e);
2234
2256
  const t = (i) => i.consumers, s = `${this.prefix}.CONSUMER.LIST.${e}`;
2235
- return new At(s, t, this);
2257
+ return new Pt(s, t, this);
2236
2258
  }
2237
2259
  pause(e, t, s) {
2238
2260
  const i = `${this.prefix}.CONSUMER.PAUSE.${e}.${t}`, n = {
@@ -2257,26 +2279,26 @@ class Pn extends he {
2257
2279
  h(this, "adapter");
2258
2280
  h(this, "subIterDone");
2259
2281
  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");
2260
- let n = (g, y) => {
2261
- this.callback(g, y);
2282
+ let n = (_, y) => {
2283
+ this.callback(_, y);
2262
2284
  };
2263
2285
  if (i.callback) {
2264
- const g = i.callback;
2286
+ const _ = i.callback;
2265
2287
  n = (y, x) => {
2266
- const [A, I] = this.adapter(y, x);
2288
+ const [A, O] = this.adapter(y, x);
2267
2289
  if (A) {
2268
- g(A, null);
2290
+ _(A, null);
2269
2291
  return;
2270
2292
  }
2271
- const { ingest: N } = this.ingestionFilterFn ? this.ingestionFilterFn(I, this) : {
2293
+ const { ingest: j } = this.ingestionFilterFn ? this.ingestionFilterFn(O, this) : {
2272
2294
  ingest: !0
2273
2295
  };
2274
- N && (!this.protocolFilterFn || this.protocolFilterFn(I)) && (g(A, I), this.dispatchedFn && I && this.dispatchedFn(I));
2296
+ j && (!this.protocolFilterFn || this.protocolFilterFn(O)) && (_(A, O), this.dispatchedFn && O && this.dispatchedFn(O));
2275
2297
  };
2276
2298
  }
2277
- const { max: o, queue: a, timeout: f } = i, p = {
2299
+ const { max: o, queue: a, timeout: d } = i, p = {
2278
2300
  queue: a,
2279
- timeout: f,
2301
+ timeout: d,
2280
2302
  callback: n
2281
2303
  };
2282
2304
  o && o > 0 && (p.max = o), this.sub = t.subscribe(s, p), i.cleanupFn && (this.sub.cleanupFn = i.cleanupFn), this.noIterator || this.iterClosed.then(() => {
@@ -2288,8 +2310,8 @@ class Pn extends he {
2288
2310
  this.subIterDone.resolve();
2289
2311
  }).catch(() => {
2290
2312
  this.subIterDone.resolve();
2291
- }), (async (g) => {
2292
- await g.closed, this.stop();
2313
+ }), (async (_) => {
2314
+ await _.closed, this.stop();
2293
2315
  })(this.sub).then().catch();
2294
2316
  }
2295
2317
  unsubscribe(t) {
@@ -2532,7 +2554,7 @@ function Hn(r) {
2532
2554
  port: t
2533
2555
  };
2534
2556
  }
2535
- class Ot {
2557
+ class Ct {
2536
2558
  constructor(e, t = !1) {
2537
2559
  h(this, "src");
2538
2560
  h(this, "listen");
@@ -2567,7 +2589,7 @@ class Ot {
2567
2589
  for (const i of s) {
2568
2590
  const n = this.port === 80 ? "https" : "http", o = new URL(`${n}://${Ks(i) ? "[" + i + "]" : i}`);
2569
2591
  o.port = `${this.port}`;
2570
- const a = new Ot(o.host, !1);
2592
+ const a = new Ct(o.host, !1);
2571
2593
  a.tlsName = this.hostname, t.push(a);
2572
2594
  }
2573
2595
  }
@@ -2584,7 +2606,7 @@ class Jn {
2584
2606
  this.firstSelect = !0, this.servers = [], this.tlsName = "", this.randomize = t.randomize || !1;
2585
2607
  const s = Cs();
2586
2608
  e && (e.forEach((i) => {
2587
- i = s ? s(i) : i, this.servers.push(new Ot(i));
2609
+ i = s ? s(i) : i, this.servers.push(new Ct(i));
2588
2610
  }), this.randomize && (this.servers = Qr(this.servers))), this.servers.length === 0 && this.addServer(`${Ms}:${ii()}`, !1), this.currentServer = this.servers[0];
2589
2611
  }
2590
2612
  clear() {
@@ -2602,7 +2624,7 @@ class Jn {
2602
2624
  addServer(e, t = !1) {
2603
2625
  const s = Cs();
2604
2626
  e = s ? s(e) : e;
2605
- const i = new Ot(e, t);
2627
+ const i = new Ct(e, t);
2606
2628
  Js(i.hostname) && (i.tlsName = this.tlsName), this.servers.push(i);
2607
2629
  }
2608
2630
  selectServer() {
@@ -2633,20 +2655,20 @@ class Jn {
2633
2655
  const s = [];
2634
2656
  let i = [];
2635
2657
  const n = Cs(), o = /* @__PURE__ */ new Map();
2636
- e.connect_urls && e.connect_urls.length > 0 && e.connect_urls.forEach((f) => {
2637
- f = n ? n(f, t) : f;
2638
- const p = new Ot(f, !0);
2639
- o.set(f, p);
2658
+ e.connect_urls && e.connect_urls.length > 0 && e.connect_urls.forEach((d) => {
2659
+ d = n ? n(d, t) : d;
2660
+ const p = new Ct(d, !0);
2661
+ o.set(d, p);
2640
2662
  });
2641
2663
  const a = [];
2642
- return this.servers.forEach((f, p) => {
2643
- const g = f.listen;
2644
- f.gossiped && this.currentServer.listen !== g && o.get(g) === void 0 && a.push(p), o.delete(g);
2645
- }), a.reverse(), a.forEach((f) => {
2646
- const p = this.servers.splice(f, 1);
2664
+ return this.servers.forEach((d, p) => {
2665
+ const _ = d.listen;
2666
+ d.gossiped && this.currentServer.listen !== _ && o.get(_) === void 0 && a.push(p), o.delete(_);
2667
+ }), a.reverse(), a.forEach((d) => {
2668
+ const p = this.servers.splice(d, 1);
2647
2669
  i = i.concat(p[0].listen);
2648
- }), o.forEach((f, p) => {
2649
- this.servers.push(f), s.push(p);
2670
+ }), o.forEach((d, p) => {
2671
+ this.servers.push(d), s.push(p);
2650
2672
  }), {
2651
2673
  added: s,
2652
2674
  deleted: i
@@ -2758,7 +2780,7 @@ function Vn(r, e = "Assertion failed.") {
2758
2780
  throw new Gn(e);
2759
2781
  }
2760
2782
  const Tr = 32 * 1024, Is = 2 ** 32 - 2;
2761
- function zt(r, e, t = 0) {
2783
+ function Gt(r, e, t = 0) {
2762
2784
  const s = e.byteLength - t;
2763
2785
  return r.byteLength > s && (r = r.subarray(0, s)), e.set(r, t), r.byteLength;
2764
2786
  }
@@ -2812,7 +2834,7 @@ class js {
2812
2834
  read(e) {
2813
2835
  if (this.empty())
2814
2836
  return this.reset(), e.byteLength === 0 ? 0 : null;
2815
- const t = zt(this._buf.subarray(this._off), e);
2837
+ const t = Gt(this._buf.subarray(this._off), e);
2816
2838
  return this._off += t, t;
2817
2839
  }
2818
2840
  writeByte(e) {
@@ -2823,7 +2845,7 @@ class js {
2823
2845
  }
2824
2846
  write(e) {
2825
2847
  const t = this._grow(e.byteLength);
2826
- return zt(e, this._buf, t);
2848
+ return Gt(e, this._buf, t);
2827
2849
  }
2828
2850
  _grow(e) {
2829
2851
  const t = this.length;
@@ -2833,13 +2855,13 @@ class js {
2833
2855
  return s;
2834
2856
  const i = this.capacity;
2835
2857
  if (e <= Math.floor(i / 2) - t)
2836
- zt(this._buf.subarray(this._off), this._buf);
2858
+ Gt(this._buf.subarray(this._off), this._buf);
2837
2859
  else {
2838
2860
  if (i + e > Is)
2839
2861
  throw new Error("The buffer cannot be grown beyond the maximum size.");
2840
2862
  {
2841
2863
  const n = new Uint8Array(Math.min(2 * i + e, Is));
2842
- zt(this._buf.subarray(this._off), n), this._buf = n;
2864
+ Gt(this._buf.subarray(this._off), n), this._buf = n;
2843
2865
  }
2844
2866
  }
2845
2867
  return this._off = 0, this._reslice(Math.min(t + e, Is)), t;
@@ -2880,105 +2902,105 @@ class Ur {
2880
2902
  h(this, "ma");
2881
2903
  h(this, "argBuf");
2882
2904
  h(this, "msgBuf");
2883
- this.dispatcher = e, this.state = O.OP_START, this.as = 0, this.drop = 0, this.hdr = 0;
2905
+ this.dispatcher = e, this.state = C.OP_START, this.as = 0, this.drop = 0, this.hdr = 0;
2884
2906
  }
2885
2907
  parse(e) {
2886
2908
  let t;
2887
2909
  for (t = 0; t < e.length; t++) {
2888
2910
  const s = e[t];
2889
2911
  switch (this.state) {
2890
- case O.OP_START:
2912
+ case C.OP_START:
2891
2913
  switch (s) {
2892
- case C.M:
2893
- case C.m:
2894
- this.state = O.OP_M, this.hdr = -1, this.ma = Mr();
2914
+ case I.M:
2915
+ case I.m:
2916
+ this.state = C.OP_M, this.hdr = -1, this.ma = Mr();
2895
2917
  break;
2896
- case C.H:
2897
- case C.h:
2898
- this.state = O.OP_H, this.hdr = 0, this.ma = Mr();
2918
+ case I.H:
2919
+ case I.h:
2920
+ this.state = C.OP_H, this.hdr = 0, this.ma = Mr();
2899
2921
  break;
2900
- case C.P:
2901
- case C.p:
2902
- this.state = O.OP_P;
2922
+ case I.P:
2923
+ case I.p:
2924
+ this.state = C.OP_P;
2903
2925
  break;
2904
- case C.PLUS:
2905
- this.state = O.OP_PLUS;
2926
+ case I.PLUS:
2927
+ this.state = C.OP_PLUS;
2906
2928
  break;
2907
- case C.MINUS:
2908
- this.state = O.OP_MINUS;
2929
+ case I.MINUS:
2930
+ this.state = C.OP_MINUS;
2909
2931
  break;
2910
- case C.I:
2911
- case C.i:
2912
- this.state = O.OP_I;
2932
+ case I.I:
2933
+ case I.i:
2934
+ this.state = C.OP_I;
2913
2935
  break;
2914
2936
  default:
2915
2937
  throw this.fail(e.subarray(t));
2916
2938
  }
2917
2939
  break;
2918
- case O.OP_H:
2940
+ case C.OP_H:
2919
2941
  switch (s) {
2920
- case C.M:
2921
- case C.m:
2922
- this.state = O.OP_M;
2942
+ case I.M:
2943
+ case I.m:
2944
+ this.state = C.OP_M;
2923
2945
  break;
2924
2946
  default:
2925
2947
  throw this.fail(e.subarray(t));
2926
2948
  }
2927
2949
  break;
2928
- case O.OP_M:
2950
+ case C.OP_M:
2929
2951
  switch (s) {
2930
- case C.S:
2931
- case C.s:
2932
- this.state = O.OP_MS;
2952
+ case I.S:
2953
+ case I.s:
2954
+ this.state = C.OP_MS;
2933
2955
  break;
2934
2956
  default:
2935
2957
  throw this.fail(e.subarray(t));
2936
2958
  }
2937
2959
  break;
2938
- case O.OP_MS:
2960
+ case C.OP_MS:
2939
2961
  switch (s) {
2940
- case C.G:
2941
- case C.g:
2942
- this.state = O.OP_MSG;
2962
+ case I.G:
2963
+ case I.g:
2964
+ this.state = C.OP_MSG;
2943
2965
  break;
2944
2966
  default:
2945
2967
  throw this.fail(e.subarray(t));
2946
2968
  }
2947
2969
  break;
2948
- case O.OP_MSG:
2970
+ case C.OP_MSG:
2949
2971
  switch (s) {
2950
- case C.SPACE:
2951
- case C.TAB:
2952
- this.state = O.OP_MSG_SPC;
2972
+ case I.SPACE:
2973
+ case I.TAB:
2974
+ this.state = C.OP_MSG_SPC;
2953
2975
  break;
2954
2976
  default:
2955
2977
  throw this.fail(e.subarray(t));
2956
2978
  }
2957
2979
  break;
2958
- case O.OP_MSG_SPC:
2980
+ case C.OP_MSG_SPC:
2959
2981
  switch (s) {
2960
- case C.SPACE:
2961
- case C.TAB:
2982
+ case I.SPACE:
2983
+ case I.TAB:
2962
2984
  continue;
2963
2985
  default:
2964
- this.state = O.MSG_ARG, this.as = t;
2986
+ this.state = C.MSG_ARG, this.as = t;
2965
2987
  }
2966
2988
  break;
2967
- case O.MSG_ARG:
2989
+ case C.MSG_ARG:
2968
2990
  switch (s) {
2969
- case C.CR:
2991
+ case I.CR:
2970
2992
  this.drop = 1;
2971
2993
  break;
2972
- case C.NL: {
2994
+ case I.NL: {
2973
2995
  const i = this.argBuf ? this.argBuf.bytes() : e.subarray(this.as, t - this.drop);
2974
- this.processMsgArgs(i), this.drop = 0, this.as = t + 1, this.state = O.MSG_PAYLOAD, t = this.as + this.ma.size - 1;
2996
+ this.processMsgArgs(i), this.drop = 0, this.as = t + 1, this.state = C.MSG_PAYLOAD, t = this.as + this.ma.size - 1;
2975
2997
  break;
2976
2998
  }
2977
2999
  default:
2978
3000
  this.argBuf && this.argBuf.writeByte(s);
2979
3001
  }
2980
3002
  break;
2981
- case O.MSG_PAYLOAD:
3003
+ case C.MSG_PAYLOAD:
2982
3004
  if (this.msgBuf)
2983
3005
  if (this.msgBuf.length >= this.ma.size) {
2984
3006
  const i = this.msgBuf.bytes({
@@ -2988,7 +3010,7 @@ class Ur {
2988
3010
  kind: me.MSG,
2989
3011
  msg: this.ma,
2990
3012
  data: i
2991
- }), this.argBuf = void 0, this.msgBuf = void 0, this.state = O.MSG_END;
3013
+ }), this.argBuf = void 0, this.msgBuf = void 0, this.state = C.MSG_END;
2992
3014
  } else {
2993
3015
  let i = this.ma.size - this.msgBuf.length;
2994
3016
  const n = e.length - t;
@@ -2998,244 +3020,244 @@ class Ur {
2998
3020
  kind: me.MSG,
2999
3021
  msg: this.ma,
3000
3022
  data: e.subarray(this.as, t)
3001
- }), this.argBuf = void 0, this.msgBuf = void 0, this.state = O.MSG_END);
3023
+ }), this.argBuf = void 0, this.msgBuf = void 0, this.state = C.MSG_END);
3002
3024
  break;
3003
- case O.MSG_END:
3025
+ case C.MSG_END:
3004
3026
  switch (s) {
3005
- case C.NL:
3006
- this.drop = 0, this.as = t + 1, this.state = O.OP_START;
3027
+ case I.NL:
3028
+ this.drop = 0, this.as = t + 1, this.state = C.OP_START;
3007
3029
  break;
3008
3030
  default:
3009
3031
  continue;
3010
3032
  }
3011
3033
  break;
3012
- case O.OP_PLUS:
3034
+ case C.OP_PLUS:
3013
3035
  switch (s) {
3014
- case C.O:
3015
- case C.o:
3016
- this.state = O.OP_PLUS_O;
3036
+ case I.O:
3037
+ case I.o:
3038
+ this.state = C.OP_PLUS_O;
3017
3039
  break;
3018
3040
  default:
3019
3041
  throw this.fail(e.subarray(t));
3020
3042
  }
3021
3043
  break;
3022
- case O.OP_PLUS_O:
3044
+ case C.OP_PLUS_O:
3023
3045
  switch (s) {
3024
- case C.K:
3025
- case C.k:
3026
- this.state = O.OP_PLUS_OK;
3046
+ case I.K:
3047
+ case I.k:
3048
+ this.state = C.OP_PLUS_OK;
3027
3049
  break;
3028
3050
  default:
3029
3051
  throw this.fail(e.subarray(t));
3030
3052
  }
3031
3053
  break;
3032
- case O.OP_PLUS_OK:
3054
+ case C.OP_PLUS_OK:
3033
3055
  switch (s) {
3034
- case C.NL:
3056
+ case I.NL:
3035
3057
  this.dispatcher.push({
3036
3058
  kind: me.OK
3037
- }), this.drop = 0, this.state = O.OP_START;
3059
+ }), this.drop = 0, this.state = C.OP_START;
3038
3060
  break;
3039
3061
  }
3040
3062
  break;
3041
- case O.OP_MINUS:
3063
+ case C.OP_MINUS:
3042
3064
  switch (s) {
3043
- case C.E:
3044
- case C.e:
3045
- this.state = O.OP_MINUS_E;
3065
+ case I.E:
3066
+ case I.e:
3067
+ this.state = C.OP_MINUS_E;
3046
3068
  break;
3047
3069
  default:
3048
3070
  throw this.fail(e.subarray(t));
3049
3071
  }
3050
3072
  break;
3051
- case O.OP_MINUS_E:
3073
+ case C.OP_MINUS_E:
3052
3074
  switch (s) {
3053
- case C.R:
3054
- case C.r:
3055
- this.state = O.OP_MINUS_ER;
3075
+ case I.R:
3076
+ case I.r:
3077
+ this.state = C.OP_MINUS_ER;
3056
3078
  break;
3057
3079
  default:
3058
3080
  throw this.fail(e.subarray(t));
3059
3081
  }
3060
3082
  break;
3061
- case O.OP_MINUS_ER:
3083
+ case C.OP_MINUS_ER:
3062
3084
  switch (s) {
3063
- case C.R:
3064
- case C.r:
3065
- this.state = O.OP_MINUS_ERR;
3085
+ case I.R:
3086
+ case I.r:
3087
+ this.state = C.OP_MINUS_ERR;
3066
3088
  break;
3067
3089
  default:
3068
3090
  throw this.fail(e.subarray(t));
3069
3091
  }
3070
3092
  break;
3071
- case O.OP_MINUS_ERR:
3093
+ case C.OP_MINUS_ERR:
3072
3094
  switch (s) {
3073
- case C.SPACE:
3074
- case C.TAB:
3075
- this.state = O.OP_MINUS_ERR_SPC;
3095
+ case I.SPACE:
3096
+ case I.TAB:
3097
+ this.state = C.OP_MINUS_ERR_SPC;
3076
3098
  break;
3077
3099
  default:
3078
3100
  throw this.fail(e.subarray(t));
3079
3101
  }
3080
3102
  break;
3081
- case O.OP_MINUS_ERR_SPC:
3103
+ case C.OP_MINUS_ERR_SPC:
3082
3104
  switch (s) {
3083
- case C.SPACE:
3084
- case C.TAB:
3105
+ case I.SPACE:
3106
+ case I.TAB:
3085
3107
  continue;
3086
3108
  default:
3087
- this.state = O.MINUS_ERR_ARG, this.as = t;
3109
+ this.state = C.MINUS_ERR_ARG, this.as = t;
3088
3110
  }
3089
3111
  break;
3090
- case O.MINUS_ERR_ARG:
3112
+ case C.MINUS_ERR_ARG:
3091
3113
  switch (s) {
3092
- case C.CR:
3114
+ case I.CR:
3093
3115
  this.drop = 1;
3094
3116
  break;
3095
- case C.NL: {
3117
+ case I.NL: {
3096
3118
  let i;
3097
3119
  this.argBuf ? (i = this.argBuf.bytes(), this.argBuf = void 0) : i = e.subarray(this.as, t - this.drop), this.dispatcher.push({
3098
3120
  kind: me.ERR,
3099
3121
  data: i
3100
- }), this.drop = 0, this.as = t + 1, this.state = O.OP_START;
3122
+ }), this.drop = 0, this.as = t + 1, this.state = C.OP_START;
3101
3123
  break;
3102
3124
  }
3103
3125
  default:
3104
3126
  this.argBuf && this.argBuf.write(Uint8Array.of(s));
3105
3127
  }
3106
3128
  break;
3107
- case O.OP_P:
3129
+ case C.OP_P:
3108
3130
  switch (s) {
3109
- case C.I:
3110
- case C.i:
3111
- this.state = O.OP_PI;
3131
+ case I.I:
3132
+ case I.i:
3133
+ this.state = C.OP_PI;
3112
3134
  break;
3113
- case C.O:
3114
- case C.o:
3115
- this.state = O.OP_PO;
3135
+ case I.O:
3136
+ case I.o:
3137
+ this.state = C.OP_PO;
3116
3138
  break;
3117
3139
  default:
3118
3140
  throw this.fail(e.subarray(t));
3119
3141
  }
3120
3142
  break;
3121
- case O.OP_PO:
3143
+ case C.OP_PO:
3122
3144
  switch (s) {
3123
- case C.N:
3124
- case C.n:
3125
- this.state = O.OP_PON;
3145
+ case I.N:
3146
+ case I.n:
3147
+ this.state = C.OP_PON;
3126
3148
  break;
3127
3149
  default:
3128
3150
  throw this.fail(e.subarray(t));
3129
3151
  }
3130
3152
  break;
3131
- case O.OP_PON:
3153
+ case C.OP_PON:
3132
3154
  switch (s) {
3133
- case C.G:
3134
- case C.g:
3135
- this.state = O.OP_PONG;
3155
+ case I.G:
3156
+ case I.g:
3157
+ this.state = C.OP_PONG;
3136
3158
  break;
3137
3159
  default:
3138
3160
  throw this.fail(e.subarray(t));
3139
3161
  }
3140
3162
  break;
3141
- case O.OP_PONG:
3163
+ case C.OP_PONG:
3142
3164
  switch (s) {
3143
- case C.NL:
3165
+ case I.NL:
3144
3166
  this.dispatcher.push({
3145
3167
  kind: me.PONG
3146
- }), this.drop = 0, this.state = O.OP_START;
3168
+ }), this.drop = 0, this.state = C.OP_START;
3147
3169
  break;
3148
3170
  }
3149
3171
  break;
3150
- case O.OP_PI:
3172
+ case C.OP_PI:
3151
3173
  switch (s) {
3152
- case C.N:
3153
- case C.n:
3154
- this.state = O.OP_PIN;
3174
+ case I.N:
3175
+ case I.n:
3176
+ this.state = C.OP_PIN;
3155
3177
  break;
3156
3178
  default:
3157
3179
  throw this.fail(e.subarray(t));
3158
3180
  }
3159
3181
  break;
3160
- case O.OP_PIN:
3182
+ case C.OP_PIN:
3161
3183
  switch (s) {
3162
- case C.G:
3163
- case C.g:
3164
- this.state = O.OP_PING;
3184
+ case I.G:
3185
+ case I.g:
3186
+ this.state = C.OP_PING;
3165
3187
  break;
3166
3188
  default:
3167
3189
  throw this.fail(e.subarray(t));
3168
3190
  }
3169
3191
  break;
3170
- case O.OP_PING:
3192
+ case C.OP_PING:
3171
3193
  switch (s) {
3172
- case C.NL:
3194
+ case I.NL:
3173
3195
  this.dispatcher.push({
3174
3196
  kind: me.PING
3175
- }), this.drop = 0, this.state = O.OP_START;
3197
+ }), this.drop = 0, this.state = C.OP_START;
3176
3198
  break;
3177
3199
  }
3178
3200
  break;
3179
- case O.OP_I:
3201
+ case C.OP_I:
3180
3202
  switch (s) {
3181
- case C.N:
3182
- case C.n:
3183
- this.state = O.OP_IN;
3203
+ case I.N:
3204
+ case I.n:
3205
+ this.state = C.OP_IN;
3184
3206
  break;
3185
3207
  default:
3186
3208
  throw this.fail(e.subarray(t));
3187
3209
  }
3188
3210
  break;
3189
- case O.OP_IN:
3211
+ case C.OP_IN:
3190
3212
  switch (s) {
3191
- case C.F:
3192
- case C.f:
3193
- this.state = O.OP_INF;
3213
+ case I.F:
3214
+ case I.f:
3215
+ this.state = C.OP_INF;
3194
3216
  break;
3195
3217
  default:
3196
3218
  throw this.fail(e.subarray(t));
3197
3219
  }
3198
3220
  break;
3199
- case O.OP_INF:
3221
+ case C.OP_INF:
3200
3222
  switch (s) {
3201
- case C.O:
3202
- case C.o:
3203
- this.state = O.OP_INFO;
3223
+ case I.O:
3224
+ case I.o:
3225
+ this.state = C.OP_INFO;
3204
3226
  break;
3205
3227
  default:
3206
3228
  throw this.fail(e.subarray(t));
3207
3229
  }
3208
3230
  break;
3209
- case O.OP_INFO:
3231
+ case C.OP_INFO:
3210
3232
  switch (s) {
3211
- case C.SPACE:
3212
- case C.TAB:
3213
- this.state = O.OP_INFO_SPC;
3233
+ case I.SPACE:
3234
+ case I.TAB:
3235
+ this.state = C.OP_INFO_SPC;
3214
3236
  break;
3215
3237
  default:
3216
3238
  throw this.fail(e.subarray(t));
3217
3239
  }
3218
3240
  break;
3219
- case O.OP_INFO_SPC:
3241
+ case C.OP_INFO_SPC:
3220
3242
  switch (s) {
3221
- case C.SPACE:
3222
- case C.TAB:
3243
+ case I.SPACE:
3244
+ case I.TAB:
3223
3245
  continue;
3224
3246
  default:
3225
- this.state = O.INFO_ARG, this.as = t;
3247
+ this.state = C.INFO_ARG, this.as = t;
3226
3248
  }
3227
3249
  break;
3228
- case O.INFO_ARG:
3250
+ case C.INFO_ARG:
3229
3251
  switch (s) {
3230
- case C.CR:
3252
+ case I.CR:
3231
3253
  this.drop = 1;
3232
3254
  break;
3233
- case C.NL: {
3255
+ case I.NL: {
3234
3256
  let i;
3235
3257
  this.argBuf ? (i = this.argBuf.bytes(), this.argBuf = void 0) : i = e.subarray(this.as, t - this.drop), this.dispatcher.push({
3236
3258
  kind: me.INFO,
3237
3259
  data: i
3238
- }), this.drop = 0, this.as = t + 1, this.state = O.OP_START;
3260
+ }), this.drop = 0, this.as = t + 1, this.state = C.OP_START;
3239
3261
  break;
3240
3262
  }
3241
3263
  default:
@@ -3246,7 +3268,7 @@ class Ur {
3246
3268
  throw this.fail(e.subarray(t));
3247
3269
  }
3248
3270
  }
3249
- (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)));
3271
+ (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)));
3250
3272
  }
3251
3273
  cloneMsgArg() {
3252
3274
  const e = this.ma.subject.length, t = this.ma.reply ? this.ma.reply.length : 0, s = new Uint8Array(e + t);
@@ -3259,10 +3281,10 @@ class Ur {
3259
3281
  let s = -1;
3260
3282
  for (let i = 0; i < e.length; i++)
3261
3283
  switch (e[i]) {
3262
- case C.SPACE:
3263
- case C.TAB:
3264
- case C.CR:
3265
- case C.NL:
3284
+ case I.SPACE:
3285
+ case I.TAB:
3286
+ case I.CR:
3287
+ case I.NL:
3266
3288
  s >= 0 && (t.push(e.subarray(s, i)), s = -1);
3267
3289
  break;
3268
3290
  default:
@@ -3291,10 +3313,10 @@ class Ur {
3291
3313
  let s = -1;
3292
3314
  for (let i = 0; i < e.length; i++)
3293
3315
  switch (e[i]) {
3294
- case C.SPACE:
3295
- case C.TAB:
3296
- case C.CR:
3297
- case C.NL:
3316
+ case I.SPACE:
3317
+ case I.TAB:
3318
+ case I.CR:
3319
+ case I.NL:
3298
3320
  s >= 0 && (t.push(e.subarray(s, i)), s = -1);
3299
3321
  break;
3300
3322
  default:
@@ -3329,14 +3351,14 @@ class Ur {
3329
3351
  return t;
3330
3352
  }
3331
3353
  }
3332
- var O;
3354
+ var C;
3333
3355
  (function(r) {
3334
3356
  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";
3335
- })(O || (O = {}));
3336
- var C;
3357
+ })(C || (C = {}));
3358
+ var I;
3337
3359
  (function(r) {
3338
3360
  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";
3339
- })(C || (C = {}));
3361
+ })(I || (I = {}));
3340
3362
  (function(r) {
3341
3363
  var e = function(c, l) {
3342
3364
  this.hi = c | 0, this.lo = l | 0;
@@ -3350,7 +3372,7 @@ var C;
3350
3372
  n[0] = 9;
3351
3373
  var o = t(), a = t([
3352
3374
  1
3353
- ]), f = t([
3375
+ ]), d = t([
3354
3376
  56129,
3355
3377
  1
3356
3378
  ]), p = t([
@@ -3370,7 +3392,7 @@ var C;
3370
3392
  11119,
3371
3393
  27886,
3372
3394
  20995
3373
- ]), g = t([
3395
+ ]), _ = t([
3374
3396
  61785,
3375
3397
  9906,
3376
3398
  39828,
@@ -3439,62 +3461,62 @@ var C;
3439
3461
  9344,
3440
3462
  11139
3441
3463
  ]);
3442
- function I(c, l) {
3464
+ function O(c, l) {
3443
3465
  return c << l | c >>> 32 - l;
3444
3466
  }
3445
- function N(c, l) {
3467
+ function j(c, l) {
3446
3468
  var u = c[l + 3] & 255;
3447
3469
  return u = u << 8 | c[l + 2] & 255, u = u << 8 | c[l + 1] & 255, u << 8 | c[l + 0] & 255;
3448
3470
  }
3449
- function J(c, l) {
3450
- 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];
3451
- return new e(u, d);
3471
+ function B(c, l) {
3472
+ 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];
3473
+ return new e(u, f);
3452
3474
  }
3453
- function ee(c, l, u) {
3454
- var d;
3455
- for (d = 0; d < 4; d++)
3456
- c[l + d] = u & 255, u >>>= 8;
3475
+ function Q(c, l, u) {
3476
+ var f;
3477
+ for (f = 0; f < 4; f++)
3478
+ c[l + f] = u & 255, u >>>= 8;
3457
3479
  }
3458
3480
  function L(c, l, u) {
3459
3481
  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;
3460
3482
  }
3461
- function Q(c, l, u, d, m) {
3483
+ function ee(c, l, u, f, m) {
3462
3484
  var b, v = 0;
3463
- for (b = 0; b < m; b++) v |= c[l + b] ^ u[d + b];
3485
+ for (b = 0; b < m; b++) v |= c[l + b] ^ u[f + b];
3464
3486
  return (1 & v - 1 >>> 8) - 1;
3465
3487
  }
3466
- function de(c, l, u, d) {
3467
- return Q(c, l, u, d, 16);
3488
+ function de(c, l, u, f) {
3489
+ return ee(c, l, u, f, 16);
3468
3490
  }
3469
- function w(c, l, u, d) {
3470
- return Q(c, l, u, d, 32);
3491
+ function w(c, l, u, f) {
3492
+ return ee(c, l, u, f, 32);
3471
3493
  }
3472
- function j(c, l, u, d, m) {
3473
- var b = new Uint32Array(16), v = new Uint32Array(16), E = new Uint32Array(16), _ = new Uint32Array(4), S, M, D;
3494
+ function R(c, l, u, f, m) {
3495
+ var b = new Uint32Array(16), v = new Uint32Array(16), E = new Uint32Array(16), g = new Uint32Array(4), S, M, H;
3474
3496
  for (S = 0; S < 4; S++)
3475
- 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);
3497
+ 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);
3476
3498
  for (S = 0; S < 16; S++) E[S] = v[S];
3477
3499
  for (S = 0; S < 20; S++) {
3478
3500
  for (M = 0; M < 4; M++) {
3479
- for (D = 0; D < 4; D++) _[D] = v[(5 * M + 4 * D) % 16];
3480
- 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];
3501
+ for (H = 0; H < 4; H++) g[H] = v[(5 * M + 4 * H) % 16];
3502
+ for (g[1] ^= O(g[0] + g[3] | 0, 7), g[2] ^= O(g[1] + g[0] | 0, 9), g[3] ^= O(g[2] + g[1] | 0, 13), g[0] ^= O(g[3] + g[2] | 0, 18), H = 0; H < 4; H++) b[4 * M + (M + H) % 4] = g[H];
3481
3503
  }
3482
- for (D = 0; D < 16; D++) v[D] = b[D];
3504
+ for (H = 0; H < 16; H++) v[H] = b[H];
3483
3505
  }
3484
3506
  if (m) {
3485
3507
  for (S = 0; S < 16; S++) v[S] = v[S] + E[S] | 0;
3486
3508
  for (S = 0; S < 4; S++)
3487
- v[5 * S] = v[5 * S] - N(d, 4 * S) | 0, v[6 + S] = v[6 + S] - N(l, 4 * S) | 0;
3509
+ v[5 * S] = v[5 * S] - j(f, 4 * S) | 0, v[6 + S] = v[6 + S] - j(l, 4 * S) | 0;
3488
3510
  for (S = 0; S < 4; S++)
3489
- ee(c, 4 * S, v[5 * S]), ee(c, 16 + 4 * S, v[6 + S]);
3511
+ Q(c, 4 * S, v[5 * S]), Q(c, 16 + 4 * S, v[6 + S]);
3490
3512
  } else
3491
- for (S = 0; S < 16; S++) ee(c, 4 * S, v[S] + E[S] | 0);
3513
+ for (S = 0; S < 16; S++) Q(c, 4 * S, v[S] + E[S] | 0);
3492
3514
  }
3493
- function F(c, l, u, d) {
3494
- return j(c, l, u, d, !1), 0;
3515
+ function F(c, l, u, f) {
3516
+ return R(c, l, u, f, !1), 0;
3495
3517
  }
3496
- function R(c, l, u, d) {
3497
- return j(c, l, u, d, !0), 0;
3518
+ function N(c, l, u, f) {
3519
+ return R(c, l, u, f, !0), 0;
3498
3520
  }
3499
3521
  var P = new Uint8Array([
3500
3522
  101,
@@ -3514,36 +3536,36 @@ var C;
3514
3536
  32,
3515
3537
  107
3516
3538
  ]);
3517
- function U(c, l, u, d, m, b, v) {
3518
- var E = new Uint8Array(16), _ = new Uint8Array(64), S, M;
3539
+ function U(c, l, u, f, m, b, v) {
3540
+ var E = new Uint8Array(16), g = new Uint8Array(64), S, M;
3519
3541
  if (!m) return 0;
3520
3542
  for (M = 0; M < 16; M++) E[M] = 0;
3521
3543
  for (M = 0; M < 8; M++) E[M] = b[M];
3522
3544
  for (; m >= 64; ) {
3523
- for (F(_, E, v, P), M = 0; M < 64; M++) c[l + M] = (u ? u[d + M] : 0) ^ _[M];
3545
+ for (F(g, E, v, P), M = 0; M < 64; M++) c[l + M] = (u ? u[f + M] : 0) ^ g[M];
3524
3546
  for (S = 1, M = 8; M < 16; M++)
3525
3547
  S = S + (E[M] & 255) | 0, E[M] = S & 255, S >>>= 8;
3526
- m -= 64, l += 64, u && (d += 64);
3548
+ m -= 64, l += 64, u && (f += 64);
3527
3549
  }
3528
3550
  if (m > 0)
3529
- for (F(_, E, v, P), M = 0; M < m; M++) c[l + M] = (u ? u[d + M] : 0) ^ _[M];
3551
+ for (F(g, E, v, P), M = 0; M < m; M++) c[l + M] = (u ? u[f + M] : 0) ^ g[M];
3530
3552
  return 0;
3531
3553
  }
3532
- function q(c, l, u, d, m) {
3533
- return U(c, l, null, 0, u, d, m);
3554
+ function q(c, l, u, f, m) {
3555
+ return U(c, l, null, 0, u, f, m);
3534
3556
  }
3535
- function $(c, l, u, d, m) {
3557
+ function $(c, l, u, f, m) {
3536
3558
  var b = new Uint8Array(32);
3537
- return R(b, d, m, P), q(c, l, u, d.subarray(16), b);
3559
+ return N(b, f, m, P), q(c, l, u, f.subarray(16), b);
3538
3560
  }
3539
- function V(c, l, u, d, m, b, v) {
3561
+ function V(c, l, u, f, m, b, v) {
3540
3562
  var E = new Uint8Array(32);
3541
- return R(E, b, v, P), U(c, l, u, d, m, b.subarray(16), E);
3563
+ return N(E, b, v, P), U(c, l, u, f, m, b.subarray(16), E);
3542
3564
  }
3543
3565
  function re(c, l) {
3544
- var u, d = 0;
3566
+ var u, f = 0;
3545
3567
  for (u = 0; u < 17; u++)
3546
- d = d + (c[u] + l[u] | 0) | 0, c[u] = d & 255, d >>>= 8;
3568
+ f = f + (c[u] + l[u] | 0) | 0, c[u] = f & 255, f >>>= 8;
3547
3569
  }
3548
3570
  var ne = new Uint32Array([
3549
3571
  5,
@@ -3564,42 +3586,42 @@ var C;
3564
3586
  0,
3565
3587
  252
3566
3588
  ]);
3567
- function ie(c, l, u, d, m, b) {
3568
- var v, E, _, S, M = new Uint32Array(17), D = new Uint32Array(17), Z = new Uint32Array(17), je = new Uint32Array(17), st = new Uint32Array(17);
3569
- for (_ = 0; _ < 17; _++) D[_] = Z[_] = 0;
3570
- for (_ = 0; _ < 16; _++) D[_] = b[_];
3571
- for (D[3] &= 15, D[4] &= 252, D[7] &= 15, D[8] &= 252, D[11] &= 15, D[12] &= 252, D[15] &= 15; m > 0; ) {
3572
- for (_ = 0; _ < 17; _++) je[_] = 0;
3573
- for (_ = 0; _ < 16 && _ < m; ++_) je[_] = u[d + _];
3574
- for (je[_] = 1, d += _, m -= _, re(Z, je), E = 0; E < 17; E++)
3575
- for (M[E] = 0, _ = 0; _ < 17; _++) M[E] = M[E] + Z[_] * (_ <= E ? D[E - _] : 320 * D[E + 17 - _] | 0) | 0 | 0;
3589
+ function ie(c, l, u, f, m, b) {
3590
+ var v, E, g, S, M = new Uint32Array(17), H = new Uint32Array(17), Z = new Uint32Array(17), je = new Uint32Array(17), st = new Uint32Array(17);
3591
+ for (g = 0; g < 17; g++) H[g] = Z[g] = 0;
3592
+ for (g = 0; g < 16; g++) H[g] = b[g];
3593
+ for (H[3] &= 15, H[4] &= 252, H[7] &= 15, H[8] &= 252, H[11] &= 15, H[12] &= 252, H[15] &= 15; m > 0; ) {
3594
+ for (g = 0; g < 17; g++) je[g] = 0;
3595
+ for (g = 0; g < 16 && g < m; ++g) je[g] = u[f + g];
3596
+ for (je[g] = 1, f += g, m -= g, re(Z, je), E = 0; E < 17; E++)
3597
+ for (M[E] = 0, g = 0; g < 17; g++) M[E] = M[E] + Z[g] * (g <= E ? H[E - g] : 320 * H[E + 17 - g] | 0) | 0 | 0;
3576
3598
  for (E = 0; E < 17; E++) Z[E] = M[E];
3577
- for (S = 0, _ = 0; _ < 16; _++)
3578
- S = S + Z[_] | 0, Z[_] = S & 255, S >>>= 8;
3579
- for (S = S + Z[16] | 0, Z[16] = S & 3, S = 5 * (S >>> 2) | 0, _ = 0; _ < 16; _++)
3580
- S = S + Z[_] | 0, Z[_] = S & 255, S >>>= 8;
3599
+ for (S = 0, g = 0; g < 16; g++)
3600
+ S = S + Z[g] | 0, Z[g] = S & 255, S >>>= 8;
3601
+ for (S = S + Z[16] | 0, Z[16] = S & 3, S = 5 * (S >>> 2) | 0, g = 0; g < 16; g++)
3602
+ S = S + Z[g] | 0, Z[g] = S & 255, S >>>= 8;
3581
3603
  S = S + Z[16] | 0, Z[16] = S;
3582
3604
  }
3583
- for (_ = 0; _ < 17; _++) st[_] = Z[_];
3584
- for (re(Z, ne), v = -(Z[16] >>> 7) | 0, _ = 0; _ < 17; _++) Z[_] ^= v & (st[_] ^ Z[_]);
3585
- for (_ = 0; _ < 16; _++) je[_] = b[_ + 16];
3586
- for (je[16] = 0, re(Z, je), _ = 0; _ < 16; _++) c[l + _] = Z[_];
3605
+ for (g = 0; g < 17; g++) st[g] = Z[g];
3606
+ for (re(Z, ne), v = -(Z[16] >>> 7) | 0, g = 0; g < 17; g++) Z[g] ^= v & (st[g] ^ Z[g]);
3607
+ for (g = 0; g < 16; g++) je[g] = b[g + 16];
3608
+ for (je[16] = 0, re(Z, je), g = 0; g < 16; g++) c[l + g] = Z[g];
3587
3609
  return 0;
3588
3610
  }
3589
- function oe(c, l, u, d, m, b) {
3611
+ function oe(c, l, u, f, m, b) {
3590
3612
  var v = new Uint8Array(16);
3591
- return ie(v, 0, u, d, m, b), de(c, l, v, 0);
3613
+ return ie(v, 0, u, f, m, b), de(c, l, v, 0);
3592
3614
  }
3593
- function ue(c, l, u, d, m) {
3615
+ function ue(c, l, u, f, m) {
3594
3616
  var b;
3595
3617
  if (u < 32) return -1;
3596
- 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;
3618
+ 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;
3597
3619
  return 0;
3598
3620
  }
3599
- function le(c, l, u, d, m) {
3621
+ function le(c, l, u, f, m) {
3600
3622
  var b, v = new Uint8Array(32);
3601
- if (u < 32 || ($(v, 0, 32, d, m), oe(l, 16, l, 32, u - 32, v) !== 0)) return -1;
3602
- for (V(c, 0, l, 0, u, d, m), b = 0; b < 32; b++) c[b] = 0;
3623
+ if (u < 32 || ($(v, 0, 32, f, m), oe(l, 16, l, 32, u - 32, v) !== 0)) return -1;
3624
+ for (V(c, 0, l, 0, u, f, m), b = 0; b < 32; b++) c[b] = 0;
3603
3625
  return 0;
3604
3626
  }
3605
3627
  function X(c, l) {
@@ -3612,13 +3634,13 @@ var C;
3612
3634
  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;
3613
3635
  }
3614
3636
  function ae(c, l, u) {
3615
- for (var d, m = ~(u - 1), b = 0; b < 16; b++)
3616
- d = m & (c[b] ^ l[b]), c[b] ^= d, l[b] ^= d;
3637
+ for (var f, m = ~(u - 1), b = 0; b < 16; b++)
3638
+ f = m & (c[b] ^ l[b]), c[b] ^= f, l[b] ^= f;
3617
3639
  }
3618
3640
  function Qe(c, l) {
3619
- var u, d, m, b = t(), v = t();
3641
+ var u, f, m, b = t(), v = t();
3620
3642
  for (u = 0; u < 16; u++) v[u] = l[u];
3621
- for (te(v), te(v), te(v), d = 0; d < 2; d++) {
3643
+ for (te(v), te(v), te(v), f = 0; f < 2; f++) {
3622
3644
  for (b[0] = v[0] - 65517, u = 1; u < 15; u++)
3623
3645
  b[u] = v[u] - 65535 - (b[u - 1] >> 16 & 1), b[u - 1] &= 65535;
3624
3646
  b[15] = v[15] - 32767 - (b[14] >> 16 & 1), m = b[15] >> 16 & 1, b[14] &= 65535, ae(v, b, 1 - m);
@@ -3627,8 +3649,8 @@ var C;
3627
3649
  c[2 * u] = v[u] & 255, c[2 * u + 1] = v[u] >> 8;
3628
3650
  }
3629
3651
  function nr(c, l) {
3630
- var u = new Uint8Array(32), d = new Uint8Array(32);
3631
- return Qe(u, c), Qe(d, l), w(u, 0, d, 0);
3652
+ var u = new Uint8Array(32), f = new Uint8Array(32);
3653
+ return Qe(u, c), Qe(f, l), w(u, 0, f, 0);
3632
3654
  }
3633
3655
  function or(c) {
3634
3656
  var l = new Uint8Array(32);
@@ -3640,110 +3662,110 @@ var C;
3640
3662
  c[15] &= 32767;
3641
3663
  }
3642
3664
  function Ce(c, l, u) {
3643
- var d;
3644
- for (d = 0; d < 16; d++) c[d] = l[d] + u[d] | 0;
3665
+ var f;
3666
+ for (f = 0; f < 16; f++) c[f] = l[f] + u[f] | 0;
3645
3667
  }
3646
3668
  function Ie(c, l, u) {
3647
- var d;
3648
- for (d = 0; d < 16; d++) c[d] = l[d] - u[d] | 0;
3669
+ var f;
3670
+ for (f = 0; f < 16; f++) c[f] = l[f] - u[f] | 0;
3649
3671
  }
3650
- function B(c, l, u) {
3651
- var d, m, b = new Float64Array(31);
3652
- for (d = 0; d < 31; d++) b[d] = 0;
3653
- for (d = 0; d < 16; d++)
3672
+ function D(c, l, u) {
3673
+ var f, m, b = new Float64Array(31);
3674
+ for (f = 0; f < 31; f++) b[f] = 0;
3675
+ for (f = 0; f < 16; f++)
3654
3676
  for (m = 0; m < 16; m++)
3655
- b[d + m] += l[d] * u[m];
3656
- for (d = 0; d < 15; d++)
3657
- b[d] += 38 * b[d + 16];
3658
- for (d = 0; d < 16; d++) c[d] = b[d];
3677
+ b[f + m] += l[f] * u[m];
3678
+ for (f = 0; f < 15; f++)
3679
+ b[f] += 38 * b[f + 16];
3680
+ for (f = 0; f < 16; f++) c[f] = b[f];
3659
3681
  te(c), te(c);
3660
3682
  }
3661
3683
  function Ee(c, l) {
3662
- B(c, l, l);
3684
+ D(c, l, l);
3663
3685
  }
3664
3686
  function ar(c, l) {
3665
- var u = t(), d;
3666
- for (d = 0; d < 16; d++) u[d] = l[d];
3667
- for (d = 253; d >= 0; d--)
3668
- Ee(u, u), d !== 2 && d !== 4 && B(u, u, l);
3669
- for (d = 0; d < 16; d++) c[d] = u[d];
3687
+ var u = t(), f;
3688
+ for (f = 0; f < 16; f++) u[f] = l[f];
3689
+ for (f = 253; f >= 0; f--)
3690
+ Ee(u, u), f !== 2 && f !== 4 && D(u, u, l);
3691
+ for (f = 0; f < 16; f++) c[f] = u[f];
3670
3692
  }
3671
3693
  function cr(c, l) {
3672
- var u = t(), d;
3673
- for (d = 0; d < 16; d++) u[d] = l[d];
3674
- for (d = 250; d >= 0; d--)
3675
- Ee(u, u), d !== 1 && B(u, u, l);
3676
- for (d = 0; d < 16; d++) c[d] = u[d];
3677
- }
3678
- function Ut(c, l, u) {
3679
- var d = new Uint8Array(32), m = new Float64Array(80), b, v, E = t(), _ = t(), S = t(), M = t(), D = t(), Z = t();
3680
- for (v = 0; v < 31; v++) d[v] = l[v];
3681
- for (d[31] = l[31] & 127 | 64, d[0] &= 248, ds(m, u), v = 0; v < 16; v++)
3682
- _[v] = m[v], M[v] = E[v] = S[v] = 0;
3694
+ var u = t(), f;
3695
+ for (f = 0; f < 16; f++) u[f] = l[f];
3696
+ for (f = 250; f >= 0; f--)
3697
+ Ee(u, u), f !== 1 && D(u, u, l);
3698
+ for (f = 0; f < 16; f++) c[f] = u[f];
3699
+ }
3700
+ function $t(c, l, u) {
3701
+ var f = new Uint8Array(32), m = new Float64Array(80), b, v, E = t(), g = t(), S = t(), M = t(), H = t(), Z = t();
3702
+ for (v = 0; v < 31; v++) f[v] = l[v];
3703
+ for (f[31] = l[31] & 127 | 64, f[0] &= 248, ds(m, u), v = 0; v < 16; v++)
3704
+ g[v] = m[v], M[v] = E[v] = S[v] = 0;
3683
3705
  for (E[0] = M[0] = 1, v = 254; v >= 0; --v)
3684
- 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);
3706
+ b = f[v >>> 3] >>> (v & 7) & 1, ae(E, g, b), ae(S, M, b), Ce(H, E, S), Ie(E, E, S), Ce(S, g, M), Ie(g, g, M), Ee(M, H), Ee(Z, E), D(E, S, E), D(S, g, H), Ce(H, E, S), Ie(E, E, S), Ee(g, E), Ie(S, M, Z), D(E, S, d), Ce(E, E, M), D(S, S, E), D(E, M, Z), D(M, g, m), Ee(g, H), ae(E, g, b), ae(S, M, b);
3685
3707
  for (v = 0; v < 16; v++)
3686
- m[v + 16] = E[v], m[v + 32] = S[v], m[v + 48] = _[v], m[v + 64] = M[v];
3708
+ m[v + 16] = E[v], m[v + 32] = S[v], m[v + 48] = g[v], m[v + 64] = M[v];
3687
3709
  var je = m.subarray(32), st = m.subarray(16);
3688
- return ar(je, je), B(st, st, je), Qe(c, st), 0;
3710
+ return ar(je, je), D(st, st, je), Qe(c, st), 0;
3689
3711
  }
3690
- function $t(c, l) {
3691
- return Ut(c, l, n);
3712
+ function Lt(c, l) {
3713
+ return $t(c, l, n);
3692
3714
  }
3693
3715
  function hr(c, l) {
3694
- return s(l, 32), $t(c, l);
3716
+ return s(l, 32), Lt(c, l);
3695
3717
  }
3696
- function Lt(c, l, u) {
3697
- var d = new Uint8Array(32);
3698
- return Ut(d, u, l), R(c, i, d, P);
3718
+ function qt(c, l, u) {
3719
+ var f = new Uint8Array(32);
3720
+ return $t(f, u, l), N(c, i, f, P);
3699
3721
  }
3700
3722
  var ur = ue, wi = le;
3701
- function xi(c, l, u, d, m, b) {
3723
+ function xi(c, l, u, f, m, b) {
3702
3724
  var v = new Uint8Array(32);
3703
- return Lt(v, m, b), ur(c, l, u, d, v);
3725
+ return qt(v, m, b), ur(c, l, u, f, v);
3704
3726
  }
3705
- function Si(c, l, u, d, m, b) {
3727
+ function Si(c, l, u, f, m, b) {
3706
3728
  var v = new Uint8Array(32);
3707
- return Lt(v, m, b), wi(c, l, u, d, v);
3729
+ return qt(v, m, b), wi(c, l, u, f, v);
3708
3730
  }
3709
3731
  function pt() {
3710
- var c = 0, l = 0, u = 0, d = 0, m = 65535, b, v, E;
3732
+ var c = 0, l = 0, u = 0, f = 0, m = 65535, b, v, E;
3711
3733
  for (E = 0; E < arguments.length; E++)
3712
- b = arguments[E].lo, v = arguments[E].hi, c += b & m, l += b >>> 16, u += v & m, d += v >>> 16;
3713
- return l += c >>> 16, u += l >>> 16, d += u >>> 16, new e(u & m | d << 16, c & m | l << 16);
3734
+ b = arguments[E].lo, v = arguments[E].hi, c += b & m, l += b >>> 16, u += v & m, f += v >>> 16;
3735
+ return l += c >>> 16, u += l >>> 16, f += u >>> 16, new e(u & m | f << 16, c & m | l << 16);
3714
3736
  }
3715
3737
  function lr(c, l) {
3716
3738
  return new e(c.hi >>> l, c.lo >>> l | c.hi << 32 - l);
3717
3739
  }
3718
- function qt() {
3740
+ function Ft() {
3719
3741
  var c = 0, l = 0, u;
3720
3742
  for (u = 0; u < arguments.length; u++)
3721
3743
  c ^= arguments[u].lo, l ^= arguments[u].hi;
3722
3744
  return new e(l, c);
3723
3745
  }
3724
3746
  function Te(c, l) {
3725
- var u, d, m = 32 - l;
3726
- 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);
3747
+ var u, f, m = 32 - l;
3748
+ 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);
3727
3749
  }
3728
3750
  function vi(c, l, u) {
3729
- var d = c.hi & l.hi ^ ~c.hi & u.hi, m = c.lo & l.lo ^ ~c.lo & u.lo;
3730
- return new e(d, m);
3751
+ var f = c.hi & l.hi ^ ~c.hi & u.hi, m = c.lo & l.lo ^ ~c.lo & u.lo;
3752
+ return new e(f, m);
3731
3753
  }
3732
3754
  function Ei(c, l, u) {
3733
- 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;
3734
- return new e(d, m);
3755
+ 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;
3756
+ return new e(f, m);
3735
3757
  }
3736
3758
  function Ai(c) {
3737
- return qt(Te(c, 28), Te(c, 34), Te(c, 39));
3759
+ return Ft(Te(c, 28), Te(c, 34), Te(c, 39));
3738
3760
  }
3739
3761
  function Pi(c) {
3740
- return qt(Te(c, 14), Te(c, 18), Te(c, 41));
3762
+ return Ft(Te(c, 14), Te(c, 18), Te(c, 41));
3741
3763
  }
3742
3764
  function ki(c) {
3743
- return qt(Te(c, 1), Te(c, 8), lr(c, 7));
3765
+ return Ft(Te(c, 1), Te(c, 8), lr(c, 7));
3744
3766
  }
3745
3767
  function Oi(c) {
3746
- return qt(Te(c, 19), Te(c, 61), lr(c, 6));
3768
+ return Ft(Te(c, 19), Te(c, 61), lr(c, 6));
3747
3769
  }
3748
3770
  var Ci = [
3749
3771
  new e(1116352408, 3609767458),
@@ -3828,22 +3850,22 @@ var C;
3828
3850
  new e(1816402316, 1246189591)
3829
3851
  ];
3830
3852
  function fr(c, l, u) {
3831
- var d = [], m = [], b = [], v = [], E, _, S;
3832
- for (_ = 0; _ < 8; _++) d[_] = b[_] = J(c, 8 * _);
3853
+ var f = [], m = [], b = [], v = [], E, g, S;
3854
+ for (g = 0; g < 8; g++) f[g] = b[g] = B(c, 8 * g);
3833
3855
  for (var M = 0; u >= 128; ) {
3834
- for (_ = 0; _ < 16; _++) v[_] = J(l, 8 * _ + M);
3835
- for (_ = 0; _ < 80; _++) {
3856
+ for (g = 0; g < 16; g++) v[g] = B(l, 8 * g + M);
3857
+ for (g = 0; g < 80; g++) {
3836
3858
  for (S = 0; S < 8; S++) m[S] = b[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];
3838
- if (_ % 16 === 15)
3859
+ for (E = pt(b[7], Pi(b[4]), vi(b[4], b[5], b[6]), Ci[g], v[g % 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];
3860
+ if (g % 16 === 15)
3839
3861
  for (S = 0; S < 16; S++)
3840
3862
  v[S] = pt(v[S], v[(S + 9) % 16], ki(v[(S + 1) % 16]), Oi(v[(S + 14) % 16]));
3841
3863
  }
3842
- for (_ = 0; _ < 8; _++)
3843
- b[_] = pt(b[_], d[_]), d[_] = b[_];
3864
+ for (g = 0; g < 8; g++)
3865
+ b[g] = pt(b[g], f[g]), f[g] = b[g];
3844
3866
  M += 128, u -= 128;
3845
3867
  }
3846
- for (_ = 0; _ < 8; _++) L(c, 8 * _, d[_]);
3868
+ for (g = 0; g < 8; g++) L(c, 8 * g, f[g]);
3847
3869
  return u;
3848
3870
  }
3849
3871
  var Ii = new Uint8Array([
@@ -3913,51 +3935,51 @@ var C;
3913
3935
  121
3914
3936
  ]);
3915
3937
  function Ye(c, l, u) {
3916
- var d = new Uint8Array(64), m = new Uint8Array(256), b, v = u;
3917
- for (b = 0; b < 64; b++) d[b] = Ii[b];
3918
- for (fr(d, l, u), u %= 128, b = 0; b < 256; b++) m[b] = 0;
3938
+ var f = new Uint8Array(64), m = new Uint8Array(256), b, v = u;
3939
+ for (b = 0; b < 64; b++) f[b] = Ii[b];
3940
+ for (fr(f, l, u), u %= 128, b = 0; b < 256; b++) m[b] = 0;
3919
3941
  for (b = 0; b < u; b++) m[b] = l[v - u + 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(d, m, u), b = 0; b < 64; b++) c[b] = d[b];
3942
+ 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];
3921
3943
  return 0;
3922
3944
  }
3923
- function Ft(c, l) {
3924
- var u = t(), d = 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]), 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);
3945
+ function Bt(c, l) {
3946
+ var u = t(), f = t(), m = t(), b = t(), v = t(), E = t(), g = t(), S = t(), M = t();
3947
+ 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, _), D(b, c[2], l[2]), Ce(b, b, b), Ie(v, f, u), Ie(E, b, m), Ce(g, b, m), Ce(S, f, u), D(c[0], v, E), D(c[1], S, g), D(c[2], g, E), D(c[3], v, S);
3926
3948
  }
3927
3949
  function dr(c, l, u) {
3928
- var d;
3929
- for (d = 0; d < 4; d++)
3930
- ae(c[d], l[d], u);
3950
+ var f;
3951
+ for (f = 0; f < 4; f++)
3952
+ ae(c[f], l[f], u);
3931
3953
  }
3932
3954
  function ps(c, l) {
3933
- var u = t(), d = t(), m = t();
3934
- ar(m, l[2]), B(u, l[0], m), B(d, l[1], m), Qe(c, d), c[31] ^= or(u) << 7;
3955
+ var u = t(), f = t(), m = t();
3956
+ ar(m, l[2]), D(u, l[0], m), D(f, l[1], m), Qe(c, f), c[31] ^= or(u) << 7;
3935
3957
  }
3936
3958
  function ms(c, l, u) {
3937
- var d, m;
3959
+ var f, m;
3938
3960
  for (X(c[0], o), X(c[1], a), X(c[2], a), X(c[3], o), m = 255; m >= 0; --m)
3939
- d = u[m / 8 | 0] >> (m & 7) & 1, dr(c, l, d), Ft(l, c), Ft(c, c), dr(c, l, d);
3961
+ f = u[m / 8 | 0] >> (m & 7) & 1, dr(c, l, f), Bt(l, c), Bt(c, c), dr(c, l, f);
3940
3962
  }
3941
- function Bt(c, l) {
3963
+ function Dt(c, l) {
3942
3964
  var u = [
3943
3965
  t(),
3944
3966
  t(),
3945
3967
  t(),
3946
3968
  t()
3947
3969
  ];
3948
- X(u[0], y), X(u[1], x), X(u[2], a), B(u[3], y, x), ms(c, u, l);
3970
+ X(u[0], y), X(u[1], x), X(u[2], a), D(u[3], y, x), ms(c, u, l);
3949
3971
  }
3950
3972
  function bs(c, l, u) {
3951
- var d = new Uint8Array(64), m = [
3973
+ var f = new Uint8Array(64), m = [
3952
3974
  t(),
3953
3975
  t(),
3954
3976
  t(),
3955
3977
  t()
3956
3978
  ], b;
3957
- 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];
3979
+ 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];
3958
3980
  return 0;
3959
3981
  }
3960
- var Dt = new Float64Array([
3982
+ var Ht = new Float64Array([
3961
3983
  237,
3962
3984
  211,
3963
3985
  245,
@@ -3992,17 +4014,17 @@ var C;
3992
4014
  16
3993
4015
  ]);
3994
4016
  function gs(c, l) {
3995
- var u, d, m, b;
3996
- for (d = 63; d >= 32; --d) {
3997
- for (u = 0, m = d - 32, b = d - 12; m < b; ++m)
3998
- l[m] += u - 16 * l[d] * Dt[m - (d - 32)], u = Math.floor((l[m] + 128) / 256), l[m] -= u * 256;
3999
- l[m] += u, l[d] = 0;
4017
+ var u, f, m, b;
4018
+ for (f = 63; f >= 32; --f) {
4019
+ for (u = 0, m = f - 32, b = f - 12; m < b; ++m)
4020
+ l[m] += u - 16 * l[f] * Ht[m - (f - 32)], u = Math.floor((l[m] + 128) / 256), l[m] -= u * 256;
4021
+ l[m] += u, l[f] = 0;
4000
4022
  }
4001
4023
  for (u = 0, m = 0; m < 32; m++)
4002
- l[m] += u - (l[31] >> 4) * Dt[m], u = l[m] >> 8, l[m] &= 255;
4003
- for (m = 0; m < 32; m++) l[m] -= u * Dt[m];
4004
- for (d = 0; d < 32; d++)
4005
- l[d + 1] += l[d] >> 8, c[d] = l[d] & 255;
4024
+ l[m] += u - (l[31] >> 4) * Ht[m], u = l[m] >> 8, l[m] &= 255;
4025
+ for (m = 0; m < 32; m++) l[m] -= u * Ht[m];
4026
+ for (f = 0; f < 32; f++)
4027
+ l[f + 1] += l[f] >> 8, c[f] = l[f] & 255;
4006
4028
  }
4007
4029
  function _s(c) {
4008
4030
  var l = new Float64Array(64), u;
@@ -4010,54 +4032,54 @@ var C;
4010
4032
  for (u = 0; u < 64; u++) c[u] = 0;
4011
4033
  gs(c, l);
4012
4034
  }
4013
- function pr(c, l, u, d) {
4014
- var m = new Uint8Array(64), b = new Uint8Array(64), v = new Uint8Array(64), E, _, S = new Float64Array(64), M = [
4035
+ function pr(c, l, u, f) {
4036
+ var m = new Uint8Array(64), b = new Uint8Array(64), v = new Uint8Array(64), E, g, S = new Float64Array(64), M = [
4015
4037
  t(),
4016
4038
  t(),
4017
4039
  t(),
4018
4040
  t()
4019
4041
  ];
4020
- Ye(m, d, 32), m[0] &= 248, m[31] &= 127, m[31] |= 64;
4021
- var D = u + 64;
4042
+ Ye(m, f, 32), m[0] &= 248, m[31] &= 127, m[31] |= 64;
4043
+ var H = u + 64;
4022
4044
  for (E = 0; E < u; E++) c[64 + E] = l[E];
4023
4045
  for (E = 0; E < 32; E++) c[32 + E] = m[32 + E];
4024
- 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];
4046
+ 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];
4025
4047
  for (Ye(b, c, u + 64), _s(b), E = 0; E < 64; E++) S[E] = 0;
4026
4048
  for (E = 0; E < 32; E++) S[E] = v[E];
4027
4049
  for (E = 0; E < 32; E++)
4028
- for (_ = 0; _ < 32; _++)
4029
- S[E + _] += b[E] * m[_];
4030
- return gs(c.subarray(32), S), D;
4050
+ for (g = 0; g < 32; g++)
4051
+ S[E + g] += b[E] * m[g];
4052
+ return gs(c.subarray(32), S), H;
4031
4053
  }
4032
4054
  function ji(c, l) {
4033
- var u = t(), d = t(), m = t(), b = t(), v = t(), E = t(), _ = t();
4034
- 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);
4055
+ var u = t(), f = t(), m = t(), b = t(), v = t(), E = t(), g = t();
4056
+ 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(g, E, v), D(u, g, 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);
4035
4057
  }
4036
- function ys(c, l, u, d) {
4058
+ function ys(c, l, u, f) {
4037
4059
  var m, b = new Uint8Array(32), v = new Uint8Array(64), E = [
4038
4060
  t(),
4039
4061
  t(),
4040
4062
  t(),
4041
4063
  t()
4042
- ], _ = [
4064
+ ], g = [
4043
4065
  t(),
4044
4066
  t(),
4045
4067
  t(),
4046
4068
  t()
4047
4069
  ];
4048
- if (u < 64 || ji(_, d)) return -1;
4070
+ if (u < 64 || ji(g, f)) return -1;
4049
4071
  for (m = 0; m < u; m++) c[m] = l[m];
4050
- for (m = 0; m < 32; m++) c[m + 32] = d[m];
4051
- 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)) {
4072
+ for (m = 0; m < 32; m++) c[m + 32] = f[m];
4073
+ if (Ye(v, c, u), _s(v), ms(E, g, v), Dt(g, l.subarray(32)), Bt(E, g), ps(b, E), u -= 64, w(l, 0, b, 0)) {
4052
4074
  for (m = 0; m < u; m++) c[m] = 0;
4053
4075
  return -1;
4054
4076
  }
4055
4077
  for (m = 0; m < u; m++) c[m] = l[m + 64];
4056
4078
  return u;
4057
4079
  }
4058
- var ws = 32, Ht = 24, mt = 32, et = 16, bt = 32, Jt = 32, gt = 32, _t = 32, xs = 32, mr = Ht, Ri = mt, Ni = et, Le = 64, Xe = 32, tt = 64, Ss = 32, vs = 64;
4080
+ 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;
4059
4081
  r.lowlevel = {
4060
- crypto_core_hsalsa20: R,
4082
+ crypto_core_hsalsa20: N,
4061
4083
  crypto_stream_xor: V,
4062
4084
  crypto_stream: $,
4063
4085
  crypto_stream_salsa20_xor: U,
@@ -4068,9 +4090,9 @@ var C;
4068
4090
  crypto_verify_32: w,
4069
4091
  crypto_secretbox: ue,
4070
4092
  crypto_secretbox_open: le,
4071
- crypto_scalarmult: Ut,
4072
- crypto_scalarmult_base: $t,
4073
- crypto_box_beforenm: Lt,
4093
+ crypto_scalarmult: $t,
4094
+ crypto_scalarmult_base: Lt,
4095
+ crypto_box_beforenm: qt,
4074
4096
  crypto_box_afternm: ur,
4075
4097
  crypto_box: xi,
4076
4098
  crypto_box_open: Si,
@@ -4080,11 +4102,11 @@ var C;
4080
4102
  crypto_sign_keypair: bs,
4081
4103
  crypto_sign_open: ys,
4082
4104
  crypto_secretbox_KEYBYTES: ws,
4083
- crypto_secretbox_NONCEBYTES: Ht,
4105
+ crypto_secretbox_NONCEBYTES: Jt,
4084
4106
  crypto_secretbox_ZEROBYTES: mt,
4085
4107
  crypto_secretbox_BOXZEROBYTES: et,
4086
4108
  crypto_scalarmult_BYTES: bt,
4087
- crypto_scalarmult_SCALARBYTES: Jt,
4109
+ crypto_scalarmult_SCALARBYTES: Kt,
4088
4110
  crypto_box_PUBLICKEYBYTES: gt,
4089
4111
  crypto_box_SECRETKEYBYTES: _t,
4090
4112
  crypto_box_BEFORENMBYTES: xs,
@@ -4098,23 +4120,23 @@ var C;
4098
4120
  crypto_hash_BYTES: vs,
4099
4121
  gf: t,
4100
4122
  D: p,
4101
- L: Dt,
4123
+ L: Ht,
4102
4124
  pack25519: Qe,
4103
4125
  unpack25519: ds,
4104
- M: B,
4126
+ M: D,
4105
4127
  A: Ce,
4106
4128
  S: Ee,
4107
4129
  Z: Ie,
4108
4130
  pow2523: cr,
4109
- add: Ft,
4131
+ add: Bt,
4110
4132
  set25519: X,
4111
4133
  modL: gs,
4112
4134
  scalarmult: ms,
4113
- scalarbase: Bt
4135
+ scalarbase: Dt
4114
4136
  };
4115
4137
  function br(c, l) {
4116
4138
  if (c.length !== ws) throw new Error("bad key size");
4117
- if (l.length !== Ht) throw new Error("bad nonce size");
4139
+ if (l.length !== Jt) throw new Error("bad nonce size");
4118
4140
  }
4119
4141
  function Ti(c, l) {
4120
4142
  if (c.length !== gt) throw new Error("bad public key size");
@@ -4132,30 +4154,30 @@ var C;
4132
4154
  return s(l, c), l;
4133
4155
  }, r.secretbox = function(c, l, u) {
4134
4156
  _e(c, l, u), br(u, l);
4135
- for (var d = new Uint8Array(mt + c.length), m = new Uint8Array(d.length), b = 0; b < c.length; b++) d[b + mt] = c[b];
4136
- return ue(m, d, d.length, l, u), m.subarray(et);
4157
+ for (var f = new Uint8Array(mt + c.length), m = new Uint8Array(f.length), b = 0; b < c.length; b++) f[b + mt] = c[b];
4158
+ return ue(m, f, f.length, l, u), m.subarray(et);
4137
4159
  }, r.secretbox.open = function(c, l, u) {
4138
4160
  _e(c, l, u), br(u, l);
4139
- for (var d = new Uint8Array(et + c.length), m = new Uint8Array(d.length), b = 0; b < c.length; b++) d[b + et] = c[b];
4140
- return d.length < 32 || le(m, d, d.length, l, u) !== 0 ? null : m.subarray(mt);
4141
- }, r.secretbox.keyLength = ws, r.secretbox.nonceLength = Ht, r.secretbox.overheadLength = et, r.scalarMult = function(c, l) {
4142
- if (_e(c, l), c.length !== Jt) throw new Error("bad n size");
4161
+ for (var f = new Uint8Array(et + c.length), m = new Uint8Array(f.length), b = 0; b < c.length; b++) f[b + et] = c[b];
4162
+ return f.length < 32 || le(m, f, f.length, l, u) !== 0 ? null : m.subarray(mt);
4163
+ }, r.secretbox.keyLength = ws, r.secretbox.nonceLength = Jt, r.secretbox.overheadLength = et, r.scalarMult = function(c, l) {
4164
+ if (_e(c, l), c.length !== Kt) throw new Error("bad n size");
4143
4165
  if (l.length !== bt) throw new Error("bad p size");
4144
4166
  var u = new Uint8Array(bt);
4145
- return Ut(u, c, l), u;
4167
+ return $t(u, c, l), u;
4146
4168
  }, r.scalarMult.base = function(c) {
4147
- if (_e(c), c.length !== Jt) throw new Error("bad n size");
4169
+ if (_e(c), c.length !== Kt) throw new Error("bad n size");
4148
4170
  var l = new Uint8Array(bt);
4149
- return $t(l, c), l;
4150
- }, r.scalarMult.scalarLength = Jt, r.scalarMult.groupElementLength = bt, r.box = function(c, l, u, d) {
4151
- var m = r.box.before(u, d);
4171
+ return Lt(l, c), l;
4172
+ }, r.scalarMult.scalarLength = Kt, r.scalarMult.groupElementLength = bt, r.box = function(c, l, u, f) {
4173
+ var m = r.box.before(u, f);
4152
4174
  return r.secretbox(c, l, m);
4153
4175
  }, r.box.before = function(c, l) {
4154
4176
  _e(c, l), Ti(c, l);
4155
4177
  var u = new Uint8Array(xs);
4156
- return Lt(u, c, l), u;
4157
- }, r.box.after = r.secretbox, r.box.open = function(c, l, u, d) {
4158
- var m = r.box.before(u, d);
4178
+ return qt(u, c, l), u;
4179
+ }, r.box.after = r.secretbox, r.box.open = function(c, l, u, f) {
4180
+ var m = r.box.before(u, f);
4159
4181
  return r.secretbox.open(c, l, m);
4160
4182
  }, r.box.open.after = r.secretbox.open, r.box.keyPair = function() {
4161
4183
  var c = new Uint8Array(gt), l = new Uint8Array(_t);
@@ -4166,7 +4188,7 @@ var C;
4166
4188
  }, r.box.keyPair.fromSecretKey = function(c) {
4167
4189
  if (_e(c), c.length !== _t) throw new Error("bad secret key size");
4168
4190
  var l = new Uint8Array(gt);
4169
- return $t(l, c), {
4191
+ return Lt(l, c), {
4170
4192
  publicKey: l,
4171
4193
  secretKey: new Uint8Array(c)
4172
4194
  };
@@ -4176,20 +4198,20 @@ var C;
4176
4198
  return pr(u, c, c.length, l), u;
4177
4199
  }, r.sign.open = function(c, l) {
4178
4200
  if (_e(c, l), l.length !== Xe) throw new Error("bad public key size");
4179
- var u = new Uint8Array(c.length), d = ys(u, c, c.length, l);
4180
- if (d < 0) return null;
4181
- for (var m = new Uint8Array(d), b = 0; b < m.length; b++) m[b] = u[b];
4201
+ var u = new Uint8Array(c.length), f = ys(u, c, c.length, l);
4202
+ if (f < 0) return null;
4203
+ for (var m = new Uint8Array(f), b = 0; b < m.length; b++) m[b] = u[b];
4182
4204
  return m;
4183
4205
  }, r.sign.detached = function(c, l) {
4184
- for (var u = r.sign(c, l), d = new Uint8Array(Le), m = 0; m < d.length; m++) d[m] = u[m];
4185
- return d;
4206
+ for (var u = r.sign(c, l), f = new Uint8Array(Le), m = 0; m < f.length; m++) f[m] = u[m];
4207
+ return f;
4186
4208
  }, r.sign.detached.verify = function(c, l, u) {
4187
4209
  if (_e(c, l, u), l.length !== Le) throw new Error("bad signature size");
4188
4210
  if (u.length !== Xe) throw new Error("bad public key size");
4189
- var d = new Uint8Array(Le + c.length), m = new Uint8Array(Le + c.length), b;
4190
- for (b = 0; b < Le; b++) d[b] = l[b];
4191
- for (b = 0; b < c.length; b++) d[b + Le] = c[b];
4192
- return ys(m, d, d.length, u) >= 0;
4211
+ var f = new Uint8Array(Le + c.length), m = new Uint8Array(Le + c.length), b;
4212
+ for (b = 0; b < Le; b++) f[b] = l[b];
4213
+ for (b = 0; b < c.length; b++) f[b + Le] = c[b];
4214
+ return ys(m, f, f.length, u) >= 0;
4193
4215
  }, r.sign.keyPair = function() {
4194
4216
  var c = new Uint8Array(Xe), l = new Uint8Array(tt);
4195
4217
  return bs(c, l), {
@@ -4205,7 +4227,7 @@ var C;
4205
4227
  };
4206
4228
  }, r.sign.keyPair.fromSeed = function(c) {
4207
4229
  if (_e(c), c.length !== Ss) throw new Error("bad seed size");
4208
- for (var l = new Uint8Array(Xe), u = new Uint8Array(tt), d = 0; d < 32; d++) u[d] = c[d];
4230
+ for (var l = new Uint8Array(Xe), u = new Uint8Array(tt), f = 0; f < 32; f++) u[f] = c[f];
4209
4231
  return bs(l, u, !0), {
4210
4232
  publicKey: l,
4211
4233
  secretKey: u
@@ -4215,32 +4237,32 @@ var C;
4215
4237
  var l = new Uint8Array(vs);
4216
4238
  return Ye(l, c, c.length), l;
4217
4239
  }, r.hash.hashLength = vs, r.verify = function(c, l) {
4218
- return _e(c, l), c.length === 0 || l.length === 0 || c.length !== l.length ? !1 : Q(c, 0, l, 0, c.length) === 0;
4240
+ return _e(c, l), c.length === 0 || l.length === 0 || c.length !== l.length ? !1 : ee(c, 0, l, 0, c.length) === 0;
4219
4241
  }, r.setPRNG = function(c) {
4220
4242
  s = c;
4221
4243
  }, function() {
4222
4244
  var c = typeof globalThis < "u" ? globalThis.crypto || globalThis.msCrypto : null;
4223
4245
  if (c && c.getRandomValues) {
4224
4246
  var l = 65536;
4225
- r.setPRNG(function(u, d) {
4226
- var m, b = new Uint8Array(d);
4227
- for (m = 0; m < d; m += l)
4228
- c.getRandomValues(b.subarray(m, m + Math.min(d - m, l)));
4229
- for (m = 0; m < d; m++) u[m] = b[m];
4247
+ r.setPRNG(function(u, f) {
4248
+ var m, b = new Uint8Array(f);
4249
+ for (m = 0; m < f; m += l)
4250
+ c.getRandomValues(b.subarray(m, m + Math.min(f - m, l)));
4251
+ for (m = 0; m < f; m++) u[m] = b[m];
4230
4252
  gr(b);
4231
4253
  });
4232
- } else typeof require < "u" && (crypto = window.crypto || globalThis.crypto, c && c.randomBytes && r.setPRNG(function(u, d) {
4233
- var m, b = c.randomBytes(d);
4234
- for (m = 0; m < d; m++) u[m] = b[m];
4254
+ } else typeof require < "u" && (crypto = window.crypto || globalThis.crypto, c && c.randomBytes && r.setPRNG(function(u, f) {
4255
+ var m, b = c.randomBytes(f);
4256
+ for (m = 0; m < f; m++) u[m] = b[m];
4235
4257
  gr(b);
4236
4258
  }));
4237
4259
  }();
4238
4260
  })(typeof module < "u" && module.exports ? module.exports : globalThis.nacl = globalThis.nacl || {});
4239
- const Gt = typeof module < "u" && module.exports ? module.exports : globalThis.nacl, Yn = {
4240
- fromSeed: Gt.sign.keyPair.fromSeed,
4241
- sign: Gt.sign.detached,
4242
- verify: Gt.sign.detached.verify,
4243
- randomBytes: Gt.randomBytes
4261
+ const Vt = typeof module < "u" && module.exports ? module.exports : globalThis.nacl, Yn = {
4262
+ fromSeed: Vt.sign.keyPair.fromSeed,
4263
+ sign: Vt.sign.detached,
4264
+ verify: Vt.sign.detached.verify,
4265
+ randomBytes: Vt.randomBytes
4244
4266
  };
4245
4267
  let ai;
4246
4268
  function Xn(r) {
@@ -4526,8 +4548,8 @@ class $r {
4526
4548
  let t = 0, s = 0, i = new Uint8Array(e), n = new Uint8Array(e.byteLength * 2), o = 0;
4527
4549
  for (let a = 0; a < i.byteLength; a++)
4528
4550
  for (s = s << 8 | i[a], t += 8; t >= 5; ) {
4529
- let f = s >>> t - 5 & 31;
4530
- n[o++] = Rs.charAt(f).charCodeAt(0), t -= 5;
4551
+ let d = s >>> t - 5 & 31;
4552
+ n[o++] = Rs.charAt(d).charCodeAt(0), t -= 5;
4531
4553
  }
4532
4554
  if (t > 0) {
4533
4555
  let a = s << 5 - t & 31;
@@ -4538,7 +4560,7 @@ class $r {
4538
4560
  static decode(e) {
4539
4561
  let t = 0, s = 0, i = 0, n = new Uint8Array(e), o = new Uint8Array(n.byteLength * 5 / 8 | 0);
4540
4562
  for (let a = 0; a < n.byteLength; a++) {
4541
- let f = String.fromCharCode(n[a]), p = Rs.indexOf(f);
4563
+ let d = String.fromCharCode(n[a]), p = Rs.indexOf(d);
4542
4564
  if (p === -1)
4543
4565
  throw new Error("Illegal Base32 character: " + n[a]);
4544
4566
  s = s << 5 | p, t += 5, t >= 8 && (o[i++] = s >>> t - 8 & 255, t -= 8);
@@ -4641,15 +4663,15 @@ class be {
4641
4663
  };
4642
4664
  }
4643
4665
  static _encode(e, t, s) {
4644
- const i = e ? 2 : 1, n = s.byteLength, o = i + n + 2, a = i + n, f = new Uint8Array(o);
4666
+ const i = e ? 2 : 1, n = s.byteLength, o = i + n + 2, a = i + n, d = new Uint8Array(o);
4645
4667
  if (e) {
4646
4668
  const y = be._encodePrefix(z.Seed, t);
4647
- f.set(y);
4669
+ d.set(y);
4648
4670
  } else
4649
- f[0] = t;
4650
- f.set(s, i);
4651
- const p = ns.checksum(f.slice(0, a));
4652
- return new DataView(f.buffer).setUint16(a, p, !0), $r.encode(f);
4671
+ d[0] = t;
4672
+ d.set(s, i);
4673
+ const p = ns.checksum(d.slice(0, a));
4674
+ return new DataView(d.buffer).setUint16(a, p, !0), $r.encode(d);
4653
4675
  }
4654
4676
  static _decode(e) {
4655
4677
  if (e.byteLength < 4)
@@ -4900,8 +4922,8 @@ function _o(r, e) {
4900
4922
  if (e.tls && !n)
4901
4923
  throw new T("tls", k.ServerOptionNotAvailable);
4902
4924
  }
4903
- const yo = 1024 * 32, wo = /^INFO\s+([^\r\n]+)\r\n/i, xo = Pt(`PONG\r
4904
- `), qr = Pt(`PING\r
4925
+ const yo = 1024 * 32, wo = /^INFO\s+([^\r\n]+)\r\n/i, xo = kt(`PONG\r
4926
+ `), qr = kt(`PING\r
4905
4927
  `);
4906
4928
  class So {
4907
4929
  constructor(e, t, s) {
@@ -4959,9 +4981,9 @@ class li extends he {
4959
4981
  protocol: !1
4960
4982
  }), n = t.protocolFilterFn ? t.protocolFilterFn : () => !0, o = t.dispatchedFn ? t.dispatchedFn : () => {
4961
4983
  };
4962
- this.callback = (a, f) => {
4963
- const { ingest: p } = i(f);
4964
- p && n(f) && (s(a, f), o(f));
4984
+ this.callback = (a, d) => {
4985
+ const { ingest: p } = i(d);
4986
+ p && n(d) && (s(a, d), o(d));
4965
4987
  };
4966
4988
  } else
4967
4989
  this.protocolFilterFn = t.protocolFilterFn, this.dispatchedFn = t.dispatchedFn;
@@ -5312,8 +5334,8 @@ class os {
5312
5334
  lang: o
5313
5335
  }, this.options, t.nonce);
5314
5336
  t.headers && (a.headers = !0, a.no_responders = !0);
5315
- const f = JSON.stringify(a);
5316
- this.transport.send(Pt(`CONNECT ${f}${Yt}`)), this.transport.send(qr);
5337
+ const d = JSON.stringify(a);
5338
+ this.transport.send(kt(`CONNECT ${d}${Yt}`)), this.transport.send(qr);
5317
5339
  } catch (a) {
5318
5340
  this._close(a);
5319
5341
  }
@@ -5352,7 +5374,7 @@ class os {
5352
5374
  sendCommand(e, ...t) {
5353
5375
  const s = this.outbound.length();
5354
5376
  let i;
5355
- typeof e == "string" ? i = Pt(e) : i = e, this.outbound.fill(i, ...t), s === 0 ? queueMicrotask(() => {
5377
+ typeof e == "string" ? i = kt(e) : i = e, this.outbound.fill(i, ...t), s === 0 ? queueMicrotask(() => {
5356
5378
  this.flushPending();
5357
5379
  }) : this.outbound.size() >= this.pendingLimit && this.flushPending();
5358
5380
  }
@@ -5375,12 +5397,12 @@ class os {
5375
5397
  if (this.info && n > this.info.max_payload)
5376
5398
  throw T.errorForCode(k.MaxPayloadExceeded);
5377
5399
  this.outBytes += n, this.outMsgs++;
5378
- let f;
5379
- s.headers ? (s.reply ? f = `HPUB ${e} ${s.reply} ${a} ${n}\r
5380
- ` : f = `HPUB ${e} ${a} ${n}\r
5381
- `, this.sendCommand(f, o, i, is)) : (s.reply ? f = `PUB ${e} ${s.reply} ${n}\r
5382
- ` : f = `PUB ${e} ${n}\r
5383
- `, this.sendCommand(f, i, is));
5400
+ let d;
5401
+ s.headers ? (s.reply ? d = `HPUB ${e} ${s.reply} ${a} ${n}\r
5402
+ ` : d = `HPUB ${e} ${a} ${n}\r
5403
+ `, this.sendCommand(d, o, i, is)) : (s.reply ? d = `PUB ${e} ${s.reply} ${n}\r
5404
+ ` : d = `PUB ${e} ${n}\r
5405
+ `, this.sendCommand(d, i, is));
5384
5406
  }
5385
5407
  request(e) {
5386
5408
  return this.initMux(), this.muxSubscriptions.add(e), e;
@@ -5415,7 +5437,7 @@ class os {
5415
5437
  this.subscriptions.all().forEach((t) => {
5416
5438
  const s = t;
5417
5439
  s.queue ? e.push(`SUB ${s.subject} ${s.queue} ${s.sid}${Yt}`) : e.push(`SUB ${s.subject} ${s.sid}${Yt}`);
5418
- }), e.length && this.transport.send(Pt(e.join("")));
5440
+ }), e.length && this.transport.send(kt(e.join("")));
5419
5441
  }
5420
5442
  async _close(e) {
5421
5443
  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) => {
@@ -5491,16 +5513,16 @@ class Fr {
5491
5513
  return this.msg.string();
5492
5514
  }
5493
5515
  }
5494
- class jt {
5516
+ class Rt {
5495
5517
  constructor(e, t = "", s = "") {
5496
5518
  h(this, "subject");
5497
5519
  h(this, "queue");
5498
5520
  h(this, "srv");
5499
5521
  t !== "" && Po("service group", t);
5500
5522
  let i = "";
5501
- if (e instanceof Mt)
5523
+ if (e instanceof Ut)
5502
5524
  this.srv = e, i = "";
5503
- else if (e instanceof jt) {
5525
+ else if (e instanceof Rt) {
5504
5526
  const n = e;
5505
5527
  this.srv = n.srv, s === "" && n.queue !== "" && (s = n.queue), i = n.subject;
5506
5528
  } else
@@ -5518,20 +5540,20 @@ class jt {
5518
5540
  handler: t,
5519
5541
  subject: e
5520
5542
  } : t;
5521
- Et("endpoint", e);
5543
+ At("endpoint", e);
5522
5544
  let { subject: i, handler: n, metadata: o, queue: a } = s;
5523
5545
  i = i || e, a = a || this.queue, Ao("endpoint subject", i), i = this.calcSubject(this.subject, i);
5524
- const f = {
5546
+ const d = {
5525
5547
  name: e,
5526
5548
  subject: i,
5527
5549
  queue: a,
5528
5550
  handler: n,
5529
5551
  metadata: o
5530
5552
  };
5531
- return this.srv._addEndpoint(f);
5553
+ return this.srv._addEndpoint(d);
5532
5554
  }
5533
5555
  addGroup(e = "", t = "") {
5534
- return new jt(this, e, t);
5556
+ return new Rt(this, e, t);
5535
5557
  }
5536
5558
  }
5537
5559
  function Ao(r, e) {
@@ -5553,7 +5575,7 @@ function Po(r, e) {
5553
5575
  throw new Error(`${r} name cannot contain internal '>': '${e}'`);
5554
5576
  });
5555
5577
  }
5556
- class Mt {
5578
+ class Ut {
5557
5579
  constructor(e, t = {
5558
5580
  name: "",
5559
5581
  version: ""
@@ -5566,7 +5588,7 @@ class Mt {
5566
5588
  h(this, "_stopped");
5567
5589
  h(this, "_done");
5568
5590
  h(this, "started");
5569
- 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), 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(() => {
5591
+ 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(() => {
5570
5592
  this.close().catch();
5571
5593
  }).catch((s) => {
5572
5594
  this.close(s).catch();
@@ -5574,7 +5596,7 @@ class Mt {
5574
5596
  }
5575
5597
  static controlSubject(e, t = "", s = "", i) {
5576
5598
  const n = i ?? Eo;
5577
- return t === "" && s === "" ? `${n}.${e}` : (Et("control subject name", t), s !== "" ? (Et("control subject id", s), `${n}.${e}.${t}.${s}`) : `${n}.${e}.${t}`);
5599
+ return t === "" && s === "" ? `${n}.${e}` : (At("control subject name", t), s !== "" ? (At("control subject id", s), `${n}.${e}.${t}.${s}`) : `${n}.${e}.${t}`);
5578
5600
  }
5579
5601
  get subjects() {
5580
5602
  return this.handlers.filter((e) => e.internal === !1).map((e) => e.subject);
@@ -5606,16 +5628,16 @@ class Mt {
5606
5628
  setupHandler(e, t = !1) {
5607
5629
  const s = t ? "" : e.queue ? e.queue : this.config.queue, { name: i, subject: n, handler: o } = e, a = e;
5608
5630
  a.internal = t, t && this.internal.push(a), a.stats = new ko(i, n, s), a.queue = s;
5609
- const f = o ? (p, g) => {
5631
+ const d = o ? (p, _) => {
5610
5632
  if (p) {
5611
5633
  this.close(p);
5612
5634
  return;
5613
5635
  }
5614
5636
  const y = Date.now();
5615
5637
  try {
5616
- o(p, new Fr(g));
5638
+ o(p, new Fr(_));
5617
5639
  } catch (x) {
5618
- a.stats.countError(x), g == null || g.respond(ve, {
5640
+ a.stats.countError(x), _ == null || _.respond(ve, {
5619
5641
  headers: this.errorToHeader(x)
5620
5642
  });
5621
5643
  } finally {
@@ -5623,20 +5645,20 @@ class Mt {
5623
5645
  }
5624
5646
  } : void 0;
5625
5647
  return a.sub = this.nc.subscribe(n, {
5626
- callback: f,
5648
+ callback: d,
5627
5649
  queue: s
5628
5650
  }), a.sub.closed.then(() => {
5629
5651
  this._stopped || this.close(new Error(`required subscription ${e.subject} stopped`)).catch();
5630
5652
  }).catch((p) => {
5631
5653
  if (!this._stopped) {
5632
- const g = new Error(`required subscription ${e.subject} errored: ${p.message}`);
5633
- g.stack = p.stack, this.close(g).catch();
5654
+ const _ = new Error(`required subscription ${e.subject} errored: ${p.message}`);
5655
+ _.stack = p.stack, this.close(_).catch();
5634
5656
  }
5635
5657
  }), a;
5636
5658
  }
5637
5659
  info() {
5638
5660
  return {
5639
- type: kt.INFO,
5661
+ type: Ot.INFO,
5640
5662
  name: this.name,
5641
5663
  id: this.id,
5642
5664
  version: this.version,
@@ -5668,7 +5690,7 @@ class Mt {
5668
5690
  e.push(t.stats.stats(t.qi));
5669
5691
  }
5670
5692
  return {
5671
- type: kt.STATS,
5693
+ type: Ot.STATS,
5672
5694
  name: this.name,
5673
5695
  id: this.id,
5674
5696
  version: this.version,
@@ -5683,10 +5705,10 @@ class Mt {
5683
5705
  }
5684
5706
  _doAddInternalHandler(e, t, s, i = "", n = "") {
5685
5707
  const o = {};
5686
- o.name = e, o.subject = Mt.controlSubject(t, i, n), o.handler = s, this.setupHandler(o, !0);
5708
+ o.name = e, o.subject = Ut.controlSubject(t, i, n), o.handler = s, this.setupHandler(o, !0);
5687
5709
  }
5688
5710
  start() {
5689
- 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());
5711
+ 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());
5690
5712
  return this.addInternalHandler(Je.PING, n), this.addInternalHandler(Je.STATS, t), this.addInternalHandler(Je.INFO, s), this.handlers.forEach((o) => {
5691
5713
  const { subject: a } = o;
5692
5714
  typeof a == "string" && o.handler !== null && this.setupHandler(o);
@@ -5712,7 +5734,7 @@ class Mt {
5712
5734
  }
5713
5735
  ping() {
5714
5736
  return {
5715
- type: kt.PING,
5737
+ type: Ot.PING,
5716
5738
  name: this.name,
5717
5739
  id: this.id,
5718
5740
  version: this.version,
@@ -5725,10 +5747,10 @@ class Mt {
5725
5747
  e.stats.reset(e.qi);
5726
5748
  }
5727
5749
  addGroup(e, t) {
5728
- return new jt(this, e, t);
5750
+ return new Rt(this, e, t);
5729
5751
  }
5730
5752
  addEndpoint(e, t) {
5731
- return new jt(this).addEndpoint(e, t);
5753
+ return new Rt(this).addEndpoint(e, t);
5732
5754
  }
5733
5755
  _addEndpoint(e) {
5734
5756
  const t = new he();
@@ -5767,7 +5789,7 @@ class ko {
5767
5789
  this.num_errors++, this.last_error = e.message;
5768
5790
  }
5769
5791
  _stats() {
5770
- 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;
5792
+ 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;
5771
5793
  return {
5772
5794
  name: e,
5773
5795
  subject: t,
@@ -5776,7 +5798,7 @@ class ko {
5776
5798
  num_requests: n,
5777
5799
  processing_time: o,
5778
5800
  last_error: a,
5779
- data: f,
5801
+ data: d,
5780
5802
  queue_group: p
5781
5803
  };
5782
5804
  }
@@ -5805,11 +5827,11 @@ class Oo {
5805
5827
  return this.q(Je.INFO, e, t);
5806
5828
  }
5807
5829
  async q(e, t = "", s = "") {
5808
- const i = new he(), n = Oe(), o = Mt.controlSubject(e, t, s, this.prefix), a = await this.nc.requestMany(o, ve, this.opts);
5830
+ const i = new he(), n = Oe(), o = Ut.controlSubject(e, t, s, this.prefix), a = await this.nc.requestMany(o, ve, this.opts);
5809
5831
  return (async () => {
5810
- for await (const f of a)
5832
+ for await (const d of a)
5811
5833
  try {
5812
- const p = n.decode(f.data);
5834
+ const p = n.decode(d.data);
5813
5835
  i.push(p);
5814
5836
  } catch (p) {
5815
5837
  i.push(() => {
@@ -5819,8 +5841,8 @@ class Oo {
5819
5841
  i.push(() => {
5820
5842
  i.stop();
5821
5843
  });
5822
- })().catch((f) => {
5823
- i.stop(f);
5844
+ })().catch((d) => {
5845
+ i.stop(d);
5824
5846
  }), i;
5825
5847
  }
5826
5848
  }
@@ -5890,7 +5912,7 @@ var Ue;
5890
5912
  (function(r) {
5891
5913
  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";
5892
5914
  })(Ue || (Ue = {}));
5893
- class Rt {
5915
+ class Nt {
5894
5916
  constructor(e, t, s) {
5895
5917
  h(this, "js");
5896
5918
  h(this, "jsm");
@@ -5909,7 +5931,7 @@ class Rt {
5909
5931
  }
5910
5932
  static async create(e, t, s = {}) {
5911
5933
  Xt(t);
5912
- const i = await e.jetstreamManager(), n = new Rt(t, e, i);
5934
+ const i = await e.jetstreamManager(), n = new Nt(t, e, i);
5913
5935
  return await n.init(s), n;
5914
5936
  }
5915
5937
  static async bind(e, t, s = {}) {
@@ -5919,7 +5941,7 @@ class Rt {
5919
5941
  }
5920
5942
  };
5921
5943
  Xt(t);
5922
- const o = new Rt(t, e, i);
5944
+ const o = new Nt(t, e, i);
5923
5945
  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;
5924
5946
  }
5925
5947
  async init(e = {}) {
@@ -5933,10 +5955,10 @@ class Rt {
5933
5955
  y.name.startsWith(we) || (y.name = `${we}${y.name}`), s.mirror = y, s.mirror_direct = !0;
5934
5956
  } else if (e.sources) {
5935
5957
  const y = e.sources.map((x) => {
5936
- const A = Object.assign({}, x), I = A.name.startsWith(we) ? A.name.substring(we.length) : A.name;
5937
- return A.name.startsWith(we) || (A.name = `${we}${A.name}`), !x.external && I !== this.bucket && (A.subject_transforms = [
5958
+ const A = Object.assign({}, x), O = A.name.startsWith(we) ? A.name.substring(we.length) : A.name;
5959
+ return A.name.startsWith(we) || (A.name = `${we}${A.name}`), !x.external && O !== this.bucket && (A.subject_transforms = [
5938
5960
  {
5939
- src: `$KV.${I}.>`,
5961
+ src: `$KV.${O}.>`,
5940
5962
  dest: `$KV.${this.bucket}.>`
5941
5963
  }
5942
5964
  ]), A;
@@ -5950,23 +5972,23 @@ class Rt {
5950
5972
  ];
5951
5973
  e.metadata && (s.metadata = e.metadata), typeof e.compression == "boolean" && (s.compression = e.compression ? Ve.S2 : Ve.None);
5952
5974
  const n = this.js.nc, o = n.getServerVersion(), a = o ? Ds(o, Ze("2.7.2")) >= 0 : !1;
5953
- s.discard = a ? It.New : It.Old;
5954
- const { ok: f, min: p } = n.features.get(H.JS_ALLOW_DIRECT);
5955
- if (!f && e.allow_direct === !0) {
5975
+ s.discard = a ? jt.New : jt.Old;
5976
+ const { ok: d, min: p } = n.features.get(J.JS_ALLOW_DIRECT);
5977
+ if (!d && e.allow_direct === !0) {
5956
5978
  const y = o ? `${o.major}.${o.minor}.${o.micro}` : "unknown";
5957
5979
  return Promise.reject(new Error(`allow_direct is not available on server version ${y} - requires ${p}`));
5958
5980
  }
5959
- 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;
5960
- let g;
5981
+ 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;
5982
+ let _;
5961
5983
  try {
5962
- g = await this.jsm.streams.info(s.name), !g.config.allow_direct && this.direct === !0 && (this.direct = !1);
5984
+ _ = await this.jsm.streams.info(s.name), !_.config.allow_direct && this.direct === !0 && (this.direct = !1);
5963
5985
  } catch (y) {
5964
5986
  if (y.message === "stream not found")
5965
- g = await this.jsm.streams.add(s);
5987
+ _ = await this.jsm.streams.add(s);
5966
5988
  else
5967
5989
  throw y;
5968
5990
  }
5969
- this.initializePrefixes(g);
5991
+ this.initializePrefixes(_);
5970
5992
  }
5971
5993
  initializePrefixes(e) {
5972
5994
  this._prefixLen = 0, this.prefix = `$KV.${this.bucket}`, this.useJsPrefix = this.js.apiPrefix !== "$JS.API";
@@ -6071,14 +6093,14 @@ class Rt {
6071
6093
  this.validateKey(i);
6072
6094
  const n = {};
6073
6095
  if (s.previousSeq !== void 0) {
6074
- const f = Fe();
6075
- n.headers = f, f.set(Ue.ExpectedLastSubjectSequenceHdr, `${s.previousSeq}`);
6096
+ const d = Fe();
6097
+ n.headers = d, d.set(Ue.ExpectedLastSubjectSequenceHdr, `${s.previousSeq}`);
6076
6098
  }
6077
6099
  try {
6078
6100
  return (await this.js.publish(this.subjectForKey(i, !0), t, n)).seq;
6079
- } catch (f) {
6080
- const p = f;
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(f);
6101
+ } catch (d) {
6102
+ const p = d;
6103
+ 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);
6082
6104
  }
6083
6105
  }
6084
6106
  async get(e, t) {
@@ -6115,12 +6137,12 @@ class Rt {
6115
6137
  }
6116
6138
  });
6117
6139
  (async () => {
6118
- for await (const f of i)
6119
- (f.operation === "DEL" || f.operation === "PURGE") && s.push(f);
6140
+ for await (const d of i)
6141
+ (d.operation === "DEL" || d.operation === "PURGE") && s.push(d);
6120
6142
  })().then(), await t, i.stop();
6121
- const n = Date.now() - e, o = s.map((f) => {
6122
- const p = this.subjectForKey(f.key);
6123
- return f.created.getTime() >= n ? this.jsm.streams.purge(this.stream, {
6143
+ const n = Date.now() - e, o = s.map((d) => {
6144
+ const p = this.subjectForKey(d.key);
6145
+ return d.created.getTime() >= n ? this.jsm.streams.purge(this.stream, {
6124
6146
  filter: p,
6125
6147
  keep: 1
6126
6148
  }) : this.jsm.streams.purge(this.stream, {
@@ -6131,7 +6153,7 @@ class Rt {
6131
6153
  return a.unshift({
6132
6154
  success: !0,
6133
6155
  purged: 0
6134
- }), a.reduce((f, p) => (f.purged += p.purged, f));
6156
+ }), a.reduce((d, p) => (d.purged += p.purged, d));
6135
6157
  }
6136
6158
  async _deleteOrPurge(e, t, s) {
6137
6159
  if (!this.hasWildcards(e))
@@ -6152,9 +6174,9 @@ class Rt {
6152
6174
  _buildCC(e, t, s = {}) {
6153
6175
  let n = (Array.isArray(e) ? e : [
6154
6176
  e
6155
- ]).map((f) => {
6156
- const p = this.encodeKey(f);
6157
- return this.validateSearchKey(f), this.fullKeyName(p);
6177
+ ]).map((d) => {
6178
+ const p = this.encodeKey(d);
6179
+ return this.validateSearchKey(d), this.fullKeyName(p);
6158
6180
  }), o = se.LastPerSubject;
6159
6181
  t === Re.AllHistory && (o = se.All), t === Re.UpdatesOnly && (o = se.New);
6160
6182
  let a;
@@ -6178,7 +6200,7 @@ class Rt {
6178
6200
  s.stop();
6179
6201
  };
6180
6202
  let o = 0;
6181
- const a = this._buildCC(t, Re.AllHistory, i), f = a.filter_subject, p = ze(a);
6203
+ const a = this._buildCC(t, Re.AllHistory, i), d = a.filter_subject, p = ze(a);
6182
6204
  p.bindStream(this.stream), p.orderedConsumer(), p.callback((y, x) => {
6183
6205
  if (y) {
6184
6206
  s.stop(y);
@@ -6189,9 +6211,9 @@ class Rt {
6189
6211
  s.push(A), s.received++, (n && o > 0 && s.received >= o || x.info.pending === 0) && (s.push(n), n = void 0);
6190
6212
  }
6191
6213
  });
6192
- const g = await this.js.subscribe(f, p);
6214
+ const _ = await this.js.subscribe(d, p);
6193
6215
  if (n) {
6194
- const { info: { last: y } } = g, x = y.num_pending + y.delivered.consumer_seq;
6216
+ const { info: { last: y } } = _, x = y.num_pending + y.delivered.consumer_seq;
6195
6217
  if (x === 0 || s.received >= x)
6196
6218
  try {
6197
6219
  n();
@@ -6203,16 +6225,16 @@ class Rt {
6203
6225
  else
6204
6226
  o = x;
6205
6227
  }
6206
- return s._data = g, s.iterClosed.then(() => {
6207
- g.unsubscribe();
6208
- }), g.closed.then(() => {
6228
+ return s._data = _, s.iterClosed.then(() => {
6229
+ _.unsubscribe();
6230
+ }), _.closed.then(() => {
6209
6231
  s.stop();
6210
6232
  }).catch((y) => {
6211
6233
  s.stop(y);
6212
6234
  }), s;
6213
6235
  }
6214
6236
  canSetWatcherName() {
6215
- const t = this.js.nc, { ok: s } = t.features.get(H.JS_NEW_CONSUMER_CREATE_API);
6237
+ const t = this.js.nc, { ok: s } = t.features.get(J.JS_NEW_CONSUMER_CREATE_API);
6216
6238
  return s;
6217
6239
  }
6218
6240
  async watch(e = {}) {
@@ -6221,33 +6243,33 @@ class Rt {
6221
6243
  let n = Re.LastValue;
6222
6244
  e.include === Re.AllHistory ? n = Re.AllHistory : e.include === Re.UpdatesOnly && (n = Re.UpdatesOnly);
6223
6245
  const o = e.ignoreDeletes === !0;
6224
- let a = e.initializedFn, f = 0;
6225
- const p = this._buildCC(t, n, i), g = p.filter_subject, y = ze(p);
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, I) => {
6246
+ let a = e.initializedFn, d = 0;
6247
+ const p = this._buildCC(t, n, i), _ = p.filter_subject, y = ze(p);
6248
+ 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) => {
6227
6249
  if (A) {
6228
6250
  s.stop(A);
6229
6251
  return;
6230
6252
  }
6231
- if (I) {
6232
- const N = this.jmToEntry(I);
6233
- if (o && N.operation === "DEL")
6253
+ if (O) {
6254
+ const j = this.jmToEntry(O);
6255
+ if (o && j.operation === "DEL")
6234
6256
  return;
6235
- s.push(N), s.received++, a && (f > 0 && s.received >= f || I.info.pending === 0) && (s.push(a), a = void 0);
6257
+ s.push(j), s.received++, a && (d > 0 && s.received >= d || O.info.pending === 0) && (s.push(a), a = void 0);
6236
6258
  }
6237
6259
  });
6238
- const x = await this.js.subscribe(g, y);
6260
+ const x = await this.js.subscribe(_, y);
6239
6261
  if (a) {
6240
- const { info: { last: A } } = x, I = A.num_pending + A.delivered.consumer_seq;
6241
- if (I === 0 || s.received >= I)
6262
+ const { info: { last: A } } = x, O = A.num_pending + A.delivered.consumer_seq;
6263
+ if (O === 0 || s.received >= O)
6242
6264
  try {
6243
6265
  a();
6244
- } catch (N) {
6245
- s.stop(N);
6266
+ } catch (j) {
6267
+ s.stop(j);
6246
6268
  } finally {
6247
6269
  a = void 0;
6248
6270
  }
6249
6271
  else
6250
- f = I;
6272
+ d = O;
6251
6273
  }
6252
6274
  return s._data = x, s.iterClosed.then(() => {
6253
6275
  x.unsubscribe();
@@ -6264,10 +6286,10 @@ class Rt {
6264
6286
  n.bindStream(this.stream), n.orderedConsumer();
6265
6287
  const o = await this.js.subscribe(i, n);
6266
6288
  return (async () => {
6267
- var f;
6289
+ var d;
6268
6290
  for await (const p of o) {
6269
- const g = (f = p.headers) == null ? void 0 : f.get(as);
6270
- if (g !== "DEL" && g !== "PURGE") {
6291
+ const _ = (d = p.headers) == null ? void 0 : d.get(as);
6292
+ if (_ !== "DEL" && _ !== "PURGE") {
6271
6293
  const y = this.decodeKey(p.subject.substring(this.prefixLen));
6272
6294
  t.push(y);
6273
6295
  }
@@ -6275,8 +6297,8 @@ class Rt {
6275
6297
  }
6276
6298
  })().then(() => {
6277
6299
  t.stop();
6278
- }).catch((f) => {
6279
- t.stop(f);
6300
+ }).catch((d) => {
6301
+ t.stop(d);
6280
6302
  }), o.info.last.num_pending === 0 && o.unsubscribe(), t;
6281
6303
  }
6282
6304
  purgeBucket(e) {
@@ -6406,7 +6428,7 @@ class zs {
6406
6428
  return this.si.config.compression ? this.si.config.compression !== Ve.None : !1;
6407
6429
  }
6408
6430
  }
6409
- function Vt(r) {
6431
+ function Wt(r) {
6410
6432
  if (r === void 0)
6411
6433
  return;
6412
6434
  const { domain: e } = r;
@@ -6434,7 +6456,7 @@ var ht;
6434
6456
  r.DebugEvent = "debug", r.Discard = "discard", r.Reset = "reset", r.Next = "next";
6435
6457
  })(ht || (ht = {}));
6436
6458
  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);
6437
- function Nt(r, e = 5e3) {
6459
+ function Tt(r, e = 5e3) {
6438
6460
  return new ia(r, e);
6439
6461
  }
6440
6462
  class Ns extends he {
@@ -6468,53 +6490,53 @@ class Ns extends he {
6468
6490
  }
6469
6491
  start() {
6470
6492
  const { max_messages: t, max_bytes: s, idle_heartbeat: i, threshold_bytes: n, threshold_messages: o } = this.opts;
6471
- this.closed().then((f) => {
6493
+ this.closed().then((d) => {
6472
6494
  if (this.cleanupHandler)
6473
6495
  try {
6474
- this.cleanupHandler(f);
6496
+ this.cleanupHandler(d);
6475
6497
  } catch {
6476
6498
  }
6477
6499
  });
6478
6500
  const { sub: a } = this;
6479
6501
  a && a.unsubscribe(), this.sub = this.consumer.api.nc.subscribe(this.inbox, {
6480
- callback: (f, p) => {
6481
- var y, x, A, I;
6482
- if (f) {
6483
- this.stop(f);
6502
+ callback: (d, p) => {
6503
+ var y, x, A, O;
6504
+ if (d) {
6505
+ this.stop(d);
6484
6506
  return;
6485
6507
  }
6486
6508
  if ((y = this.monitor) == null || y.work(), p.subject === this.inbox) {
6487
6509
  if (Ls(p))
6488
6510
  return;
6489
- 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);
6490
- if (ee > 0 || L > 0)
6491
- this.pending.msgs -= ee, this.pending.bytes -= L, this.pending.requests--, this.notify(ht.Discard, {
6492
- msgsLeft: ee,
6511
+ 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);
6512
+ if (Q > 0 || L > 0)
6513
+ this.pending.msgs -= Q, this.pending.bytes -= L, this.pending.requests--, this.notify(ht.Discard, {
6514
+ msgsLeft: Q,
6493
6515
  bytesLeft: L
6494
6516
  });
6495
- else if (N === 400) {
6496
- this.stop(new T(J, `${N}`));
6517
+ else if (j === 400) {
6518
+ this.stop(new T(B, `${j}`));
6497
6519
  return;
6498
- } else if (N === 409 && J === "consumer deleted") {
6499
- if (this.notify($e.ConsumerDeleted, `${N} ${J}`), !this.refilling || this.abortOnMissingResource) {
6500
- const Q = new T(J, `${N}`);
6501
- this.stop(Q);
6520
+ } else if (j === 409 && B === "consumer deleted") {
6521
+ if (this.notify($e.ConsumerDeleted, `${j} ${B}`), !this.refilling || this.abortOnMissingResource) {
6522
+ const ee = new T(B, `${j}`);
6523
+ this.stop(ee);
6502
6524
  return;
6503
6525
  }
6504
- } else if (N === 503) {
6505
- if (this.notify($e.NoResponders, `${N} No Responders`), !this.refilling || this.abortOnMissingResource) {
6506
- const Q = new T("no responders", `${N}`);
6507
- this.stop(Q);
6526
+ } else if (j === 503) {
6527
+ if (this.notify($e.NoResponders, `${j} No Responders`), !this.refilling || this.abortOnMissingResource) {
6528
+ const ee = new T("no responders", `${j}`);
6529
+ this.stop(ee);
6508
6530
  return;
6509
6531
  }
6510
6532
  } else
6511
- this.notify(ht.DebugEvent, `${N} ${J}`);
6533
+ this.notify(ht.DebugEvent, `${j} ${B}`);
6512
6534
  } else
6513
- this._push(Nt(p, this.consumer.api.timeout)), this.received++, this.pending.msgs && this.pending.msgs--, this.pending.bytes && (this.pending.bytes -= p.size());
6535
+ this._push(Tt(p, this.consumer.api.timeout)), this.received++, this.pending.msgs && this.pending.msgs--, this.pending.bytes && (this.pending.bytes -= p.size());
6514
6536
  if (this.pending.msgs === 0 && this.pending.bytes === 0 && (this.pending.requests = 0), this.refilling) {
6515
6537
  if (t && this.pending.msgs <= o || s && this.pending.bytes <= n) {
6516
- const N = this.pullOptions();
6517
- this.pull(N);
6538
+ const j = this.pullOptions();
6539
+ this.pull(j);
6518
6540
  }
6519
6541
  } else this.pending.requests === 0 && this._push(() => {
6520
6542
  this.stop();
@@ -6524,16 +6546,16 @@ class Ns extends he {
6524
6546
  this.sub.draining && this._push(() => {
6525
6547
  this.stop();
6526
6548
  });
6527
- }), i && (this.monitor = new er(i, (f) => (this.notify($e.HeartbeatsMissed, f), this.resetPending().then(() => {
6549
+ }), i && (this.monitor = new er(i, (d) => (this.notify($e.HeartbeatsMissed, d), this.resetPending().then(() => {
6528
6550
  }).catch(() => {
6529
6551
  }), !1), {
6530
6552
  maxOut: 2
6531
6553
  })), (async () => {
6532
6554
  var p;
6533
- const f = this.consumer.api.nc.status();
6534
- this.statusIterator = f;
6535
- for await (const g of f)
6536
- switch (g.type) {
6555
+ const d = this.consumer.api.nc.status();
6556
+ this.statusIterator = d;
6557
+ for await (const _ of d)
6558
+ switch (_.type) {
6537
6559
  case ke.Disconnect:
6538
6560
  (p = this.monitor) == null || p.cancel();
6539
6561
  break;
@@ -6605,11 +6627,11 @@ class Ns extends he {
6605
6627
  } else
6606
6628
  t = 0, s = 0;
6607
6629
  this.inBackOff = !0;
6608
- const a = i.backoff(n), f = dt(a);
6630
+ const a = i.backoff(n), d = dt(a);
6609
6631
  await Promise.race([
6610
- f,
6632
+ d,
6611
6633
  this.consumer.api.nc.closed()
6612
- ]), f.cancel(), n++;
6634
+ ]), d.cancel(), n++;
6613
6635
  }
6614
6636
  }
6615
6637
  }
@@ -6828,7 +6850,7 @@ class Ho {
6828
6850
  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;
6829
6851
  }
6830
6852
  async resetConsumer(e = 0) {
6831
- var o, a, f, p, g;
6853
+ var o, a, d, p, _;
6832
6854
  Ge.next();
6833
6855
  const t = this.serial === 0;
6834
6856
  (o = this.consumer) == null || o.delete().catch(() => {
@@ -6841,11 +6863,11 @@ class Ho {
6841
6863
  let n;
6842
6864
  for (let y = 0; ; y++)
6843
6865
  try {
6844
- n = await this.api.add(this.stream, s), (f = this.iter) == null || f.notify($e.OrderedConsumerRecreated, n.name);
6866
+ n = await this.api.add(this.stream, s), (d = this.iter) == null || d.notify($e.OrderedConsumerRecreated, n.name);
6845
6867
  break;
6846
6868
  } catch (x) {
6847
6869
  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))
6848
- return (g = this.iter) == null || g.stop(x), Promise.reject(x);
6870
+ return (_ = this.iter) == null || _.stop(x), Promise.reject(x);
6849
6871
  if (t && y >= this.maxInitialReset)
6850
6872
  throw x;
6851
6873
  await dt(i.backoff(y + 1));
@@ -6869,11 +6891,11 @@ class Ho {
6869
6891
  max_messages: 100,
6870
6892
  expires: 3e4
6871
6893
  }, t) {
6872
- var f, p;
6894
+ var d, p;
6873
6895
  t = t || {};
6874
6896
  const s = t.fromFetch || !1, i = t.orderedReset || !1;
6875
6897
  if (this.type === Ae.Fetch && i) {
6876
- (f = this.iter) == null || f.src.stop(), await ((p = this.iter) == null ? void 0 : p.closed()), this.currentConsumer = null;
6898
+ (d = this.iter) == null || d.src.stop(), await ((p = this.iter) == null ? void 0 : p.closed()), this.currentConsumer = null;
6877
6899
  return;
6878
6900
  }
6879
6901
  (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);
@@ -6953,7 +6975,7 @@ class Vs {
6953
6975
  this.api = e, this.notified = !1;
6954
6976
  }
6955
6977
  checkVersion() {
6956
- const e = this.api.nc.features.get(H.JS_SIMPLIFICATION);
6978
+ const e = this.api.nc.features.get(J.JS_SIMPLIFICATION);
6957
6979
  return e.ok ? Promise.resolve() : Promise.reject(new Error(`consumers framework is only supported on servers ${e.min} or better`));
6958
6980
  }
6959
6981
  getPullConsumerFor(e) {
@@ -7005,43 +7027,43 @@ class fs {
7005
7027
  return this.api.deleteMessage(this.name, e, t);
7006
7028
  }
7007
7029
  }
7008
- class sr extends Tt {
7030
+ class sr extends Mt {
7009
7031
  constructor(e, t) {
7010
7032
  super(e, t);
7011
7033
  }
7012
7034
  checkStreamConfigVersions(e) {
7013
7035
  const t = this.nc;
7014
7036
  if (e.metadata) {
7015
- const { min: i, ok: n } = t.features.get(H.JS_STREAM_CONSUMER_METADATA);
7037
+ const { min: i, ok: n } = t.features.get(J.JS_STREAM_CONSUMER_METADATA);
7016
7038
  if (!n)
7017
7039
  throw new Error(`stream 'metadata' requires server ${i}`);
7018
7040
  }
7019
7041
  if (e.first_seq) {
7020
- const { min: i, ok: n } = t.features.get(H.JS_STREAM_FIRST_SEQ);
7042
+ const { min: i, ok: n } = t.features.get(J.JS_STREAM_FIRST_SEQ);
7021
7043
  if (!n)
7022
7044
  throw new Error(`stream 'first_seq' requires server ${i}`);
7023
7045
  }
7024
7046
  if (e.subject_transform) {
7025
- const { min: i, ok: n } = t.features.get(H.JS_STREAM_SUBJECT_TRANSFORM);
7047
+ const { min: i, ok: n } = t.features.get(J.JS_STREAM_SUBJECT_TRANSFORM);
7026
7048
  if (!n)
7027
7049
  throw new Error(`stream 'subject_transform' requires server ${i}`);
7028
7050
  }
7029
7051
  if (e.compression) {
7030
- const { min: i, ok: n } = t.features.get(H.JS_STREAM_COMPRESSION);
7052
+ const { min: i, ok: n } = t.features.get(J.JS_STREAM_COMPRESSION);
7031
7053
  if (!n)
7032
7054
  throw new Error(`stream 'compression' requires server ${i}`);
7033
7055
  }
7034
7056
  if (e.consumer_limits) {
7035
- const { min: i, ok: n } = t.features.get(H.JS_DEFAULT_CONSUMER_LIMITS);
7057
+ const { min: i, ok: n } = t.features.get(J.JS_DEFAULT_CONSUMER_LIMITS);
7036
7058
  if (!n)
7037
7059
  throw new Error(`stream 'consumer_limits' requires server ${i}`);
7038
7060
  }
7039
7061
  function s(i, n) {
7040
7062
  var a;
7041
7063
  if ((((a = n == null ? void 0 : n.subject_transforms) == null ? void 0 : a.length) || 0) > 0) {
7042
- const { min: f, ok: p } = t.features.get(H.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);
7064
+ const { min: d, ok: p } = t.features.get(J.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);
7043
7065
  if (!p)
7044
- throw new Error(`${i} 'subject_transforms' requires server ${f}`);
7066
+ throw new Error(`${i} 'subject_transforms' requires server ${d}`);
7045
7067
  }
7046
7068
  }
7047
7069
  e.sources && e.sources.forEach((i) => {
@@ -7050,7 +7072,7 @@ class sr extends Tt {
7050
7072
  }
7051
7073
  async add(e = {}) {
7052
7074
  var i;
7053
- this.checkStreamConfigVersions(e), pe(e.name), e.mirror = Vt(e.mirror), e.sources = (i = e.sources) == null ? void 0 : i.map(Vt);
7075
+ this.checkStreamConfigVersions(e), pe(e.name), e.mirror = Wt(e.mirror), e.sources = (i = e.sources) == null ? void 0 : i.map(Wt);
7054
7076
  const s = await this._request(`${this.prefix}.STREAM.CREATE.${e.name}`, e);
7055
7077
  return this._fixInfo(s), s;
7056
7078
  }
@@ -7060,30 +7082,30 @@ class sr extends Tt {
7060
7082
  async update(e, t = {}) {
7061
7083
  var a;
7062
7084
  if (typeof e == "object") {
7063
- const f = e;
7064
- 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");
7085
+ const d = e;
7086
+ 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");
7065
7087
  }
7066
7088
  this.checkStreamConfigVersions(t), pe(e);
7067
7089
  const s = await this.info(e), i = Object.assign(s.config, t);
7068
- i.mirror = Vt(i.mirror), i.sources = (a = i.sources) == null ? void 0 : a.map(Vt);
7090
+ i.mirror = Wt(i.mirror), i.sources = (a = i.sources) == null ? void 0 : a.map(Wt);
7069
7091
  const o = await this._request(`${this.prefix}.STREAM.UPDATE.${e}`, i);
7070
7092
  return this._fixInfo(o), o;
7071
7093
  }
7072
7094
  async info(e, t) {
7073
7095
  pe(e);
7074
7096
  const s = `${this.prefix}.STREAM.INFO.${e}`;
7075
- let n = await this._request(s, t), { total: o, limit: a } = n, f = n.state.subjects ? Object.getOwnPropertyNames(n.state.subjects).length : 1;
7076
- if (o && o > f) {
7097
+ let n = await this._request(s, t), { total: o, limit: a } = n, d = n.state.subjects ? Object.getOwnPropertyNames(n.state.subjects).length : 1;
7098
+ if (o && o > d) {
7077
7099
  const p = [
7078
7100
  n
7079
- ], g = t || {};
7101
+ ], _ = t || {};
7080
7102
  let y = 0;
7081
- for (; o > f; ) {
7082
- y++, g.offset = a * y;
7083
- const A = await this._request(s, g);
7103
+ for (; o > d; ) {
7104
+ y++, _.offset = a * y;
7105
+ const A = await this._request(s, _);
7084
7106
  o = A.total, p.push(A);
7085
- const I = Object.getOwnPropertyNames(A.state.subjects).length;
7086
- if (f += I, I < a)
7107
+ const O = Object.getOwnPropertyNames(A.state.subjects).length;
7108
+ if (d += O, O < a)
7087
7109
  break;
7088
7110
  }
7089
7111
  let x = {};
@@ -7102,7 +7124,7 @@ class sr extends Tt {
7102
7124
  this._fixInfo(a);
7103
7125
  }), o.streams;
7104
7126
  }, i = `${this.prefix}.STREAM.LIST`;
7105
- return new At(i, s, this, t);
7127
+ return new Pt(i, s, this, t);
7106
7128
  }
7107
7129
  _fixInfo(e) {
7108
7130
  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;
@@ -7132,15 +7154,15 @@ class sr extends Tt {
7132
7154
  }
7133
7155
  listKvs() {
7134
7156
  const e = (s) => {
7135
- var f;
7157
+ var d;
7136
7158
  const n = s.streams.filter((p) => p.config.name.startsWith(we));
7137
7159
  n.forEach((p) => {
7138
7160
  this._fixInfo(p);
7139
7161
  });
7140
7162
  let o = "";
7141
- return n.length && (o = ((f = this.nc.info) == null ? void 0 : f.cluster) ?? ""), n.map((p) => new di(p, o));
7163
+ return n.length && (o = ((d = this.nc.info) == null ? void 0 : d.cluster) ?? ""), n.map((p) => new di(p, o));
7142
7164
  }, t = `${this.prefix}.STREAM.LIST`;
7143
- return new At(t, e, this);
7165
+ return new Pt(t, e, this);
7144
7166
  }
7145
7167
  listObjectStores() {
7146
7168
  const e = (s) => {
@@ -7149,20 +7171,20 @@ class sr extends Tt {
7149
7171
  this._fixInfo(a);
7150
7172
  }), n.map((a) => new zs(a));
7151
7173
  }, t = `${this.prefix}.STREAM.LIST`;
7152
- return new At(t, e, this);
7174
+ return new Pt(t, e, this);
7153
7175
  }
7154
7176
  names(e = "") {
7155
7177
  const t = e != null && e.length ? {
7156
7178
  subject: e
7157
7179
  } : {}, s = (n) => n.streams, i = `${this.prefix}.STREAM.NAMES`;
7158
- return new At(i, s, this, t);
7180
+ return new Pt(i, s, this, t);
7159
7181
  }
7160
7182
  async get(e) {
7161
7183
  const t = await this.info(e);
7162
7184
  return Promise.resolve(new fs(this, t));
7163
7185
  }
7164
7186
  }
7165
- class Jo extends Tt {
7187
+ class Jo extends Mt {
7166
7188
  constructor(e, t) {
7167
7189
  super(e, t);
7168
7190
  }
@@ -7171,47 +7193,47 @@ class Jo extends Tt {
7171
7193
  let s = t;
7172
7194
  const { last_by_subj: i } = s;
7173
7195
  i && (s = null);
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}`, f = await this.nc.request(a, n, {
7196
+ 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, {
7175
7197
  timeout: this.timeout
7176
- }), p = at(f);
7198
+ }), p = at(d);
7177
7199
  if (p)
7178
7200
  return Promise.reject(p);
7179
- const g = new Ws(f);
7180
- return Promise.resolve(g);
7201
+ const _ = new Ws(d);
7202
+ return Promise.resolve(_);
7181
7203
  }
7182
7204
  async getBatch(e, t) {
7183
7205
  pe(e);
7184
7206
  const i = `${this.opts.apiPrefix || "$JS.API"}.DIRECT.GET.${e}`;
7185
7207
  if (!Array.isArray(t.multi_last) || t.multi_last.length === 0)
7186
7208
  return Promise.reject("multi_last is required");
7187
- 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, {
7209
+ 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, {
7188
7210
  strategy: Ne.SentinelMsg
7189
7211
  });
7190
7212
  return (async () => {
7191
7213
  var y, x, A;
7192
- let f = !1, p = !1, g;
7193
- for await (const I of a) {
7194
- if (!f) {
7195
- f = !0;
7196
- const N = ((y = I.headers) == null ? void 0 : y.code) || 0;
7197
- if (N !== 0 && N < 200 || N > 299) {
7198
- g = (x = I.headers) == null ? void 0 : x.description.toLowerCase();
7214
+ let d = !1, p = !1, _;
7215
+ for await (const O of a) {
7216
+ if (!d) {
7217
+ d = !0;
7218
+ const j = ((y = O.headers) == null ? void 0 : y.code) || 0;
7219
+ if (j !== 0 && j < 200 || j > 299) {
7220
+ _ = (x = O.headers) == null ? void 0 : x.description.toLowerCase();
7199
7221
  break;
7200
7222
  }
7201
- if (((A = I.headers) == null ? void 0 : A.get("Nats-Num-Pending")) === "") {
7223
+ if (((A = O.headers) == null ? void 0 : A.get("Nats-Num-Pending")) === "") {
7202
7224
  p = !0;
7203
7225
  break;
7204
7226
  }
7205
7227
  }
7206
- if (I.data.length === 0)
7228
+ if (O.data.length === 0)
7207
7229
  break;
7208
- o.push(new Ws(I));
7230
+ o.push(new Ws(O));
7209
7231
  }
7210
7232
  o.push(() => {
7211
7233
  if (p)
7212
7234
  throw new Error("batch direct get not supported by the server");
7213
- if (g)
7214
- throw new Error(`bad request: ${g}`);
7235
+ if (_)
7236
+ throw new Error(`bad request: ${_}`);
7215
7237
  o.stop();
7216
7238
  });
7217
7239
  })(), Promise.resolve(o);
@@ -7249,7 +7271,7 @@ class Ws {
7249
7271
  }
7250
7272
  }
7251
7273
  h(Ws, "jc");
7252
- class Ko extends Tt {
7274
+ class Ko extends Mt {
7253
7275
  constructor(t, s) {
7254
7276
  super(t, s);
7255
7277
  h(this, "streams");
@@ -7405,7 +7427,7 @@ function Go() {
7405
7427
  }
7406
7428
  });
7407
7429
  }
7408
- class Ct {
7430
+ class It {
7409
7431
  constructor(e, t, s) {
7410
7432
  h(this, "jsm");
7411
7433
  h(this, "js");
@@ -7475,67 +7497,67 @@ class Ct {
7475
7497
  s = s || {
7476
7498
  timeout: i.timeout
7477
7499
  }, s.timeout = s.timeout || i.timeout, s.previousRevision = s.previousRevision ?? void 0;
7478
- const { timeout: n, previousRevision: o } = s, a = this.js.nc.info, f = (a == null ? void 0 : a.max_payload) || 1024;
7500
+ const { timeout: n, previousRevision: o } = s, a = this.js.nc.info, d = (a == null ? void 0 : a.max_payload) || 1024;
7479
7501
  e = e || {}, e.options = e.options || {};
7480
7502
  let p = ((de = e.options) == null ? void 0 : de.max_chunk_size) || 128 * 1024;
7481
- p = p > f ? f : p, e.options.max_chunk_size = p;
7482
- const g = await this.info(e.name), { name: y, error: x } = this._checkNotEmpty(e.name);
7503
+ p = p > d ? d : p, e.options.max_chunk_size = p;
7504
+ const _ = await this.info(e.name), { name: y, error: x } = this._checkNotEmpty(e.name);
7483
7505
  if (x)
7484
7506
  return Promise.reject(x);
7485
- const A = Ge.next(), I = this._chunkSubject(A), N = this._metaSubject(y), J = Object.assign({
7507
+ const A = Ge.next(), O = this._chunkSubject(A), j = this._metaSubject(y), B = Object.assign({
7486
7508
  bucket: this.name,
7487
7509
  nuid: A,
7488
7510
  size: 0,
7489
7511
  chunks: 0
7490
- }, Jr(e)), ee = Y(), L = [], Q = new ft();
7512
+ }, Jr(e)), Q = Y(), L = [], ee = new ft();
7491
7513
  try {
7492
- const w = t ? t.getReader() : null, j = Nr.create();
7514
+ const w = t ? t.getReader() : null, R = Nr.create();
7493
7515
  for (; ; ) {
7494
- const { done: F, value: R } = w ? await w.read() : {
7516
+ const { done: F, value: N } = w ? await w.read() : {
7495
7517
  done: !0,
7496
7518
  value: void 0
7497
7519
  };
7498
7520
  if (F) {
7499
- if (Q.size() > 0) {
7500
- const $ = Q.drain();
7501
- j.update($), J.chunks++, J.size += $.length, L.push(this.js.publish(I, $, {
7521
+ if (ee.size() > 0) {
7522
+ const $ = ee.drain();
7523
+ R.update($), B.chunks++, B.size += $.length, L.push(this.js.publish(O, $, {
7502
7524
  timeout: n
7503
7525
  }));
7504
7526
  }
7505
- await Promise.all(L), L.length = 0, J.mtime = (/* @__PURE__ */ new Date()).toISOString();
7506
- const P = ct.encode(j.digest());
7507
- J.digest = `${Dr}${P}`, J.deleted = !1;
7527
+ await Promise.all(L), L.length = 0, B.mtime = (/* @__PURE__ */ new Date()).toISOString();
7528
+ const P = ct.encode(R.digest());
7529
+ B.digest = `${Dr}${P}`, B.deleted = !1;
7508
7530
  const U = Fe();
7509
7531
  typeof o == "number" && U.set(Ue.ExpectedLastSubjectSequenceHdr, `${o}`), U.set(ge.RollupHdr, ge.RollupValueSubject);
7510
- const q = await this.js.publish(N, Oe().encode(J), {
7532
+ const q = await this.js.publish(j, Oe().encode(B), {
7511
7533
  headers: U,
7512
7534
  timeout: n
7513
7535
  });
7514
- if (J.revision = q.seq, g)
7536
+ if (B.revision = q.seq, _)
7515
7537
  try {
7516
7538
  await this.jsm.streams.purge(this.stream, {
7517
- filter: `$O.${this.name}.C.${g.nuid}`
7539
+ filter: `$O.${this.name}.C.${_.nuid}`
7518
7540
  });
7519
7541
  } catch {
7520
7542
  }
7521
- ee.resolve(new Ts(J));
7543
+ Q.resolve(new Ts(B));
7522
7544
  break;
7523
7545
  }
7524
- if (R)
7525
- for (Q.fill(R); Q.size() > p; ) {
7526
- J.chunks++, J.size += p;
7527
- const P = Q.drain(e.options.max_chunk_size);
7528
- j.update(P), L.push(this.js.publish(I, P, {
7546
+ if (N)
7547
+ for (ee.fill(N); ee.size() > p; ) {
7548
+ B.chunks++, B.size += p;
7549
+ const P = ee.drain(e.options.max_chunk_size);
7550
+ R.update(P), L.push(this.js.publish(O, P, {
7529
7551
  timeout: n
7530
7552
  }));
7531
7553
  }
7532
7554
  }
7533
7555
  } catch (w) {
7534
7556
  await this.jsm.streams.purge(this.stream, {
7535
- filter: I
7536
- }), ee.reject(w);
7557
+ filter: O
7558
+ }), Q.reject(w);
7537
7559
  }
7538
- return ee;
7560
+ return Q;
7539
7561
  }
7540
7562
  putBlob(e, t, s) {
7541
7563
  function i(n) {
@@ -7555,8 +7577,8 @@ class Ct {
7555
7577
  async function t(n) {
7556
7578
  const o = new ft(), a = n.getReader();
7557
7579
  for (; ; ) {
7558
- const { done: f, value: p } = await a.read();
7559
- if (f)
7580
+ const { done: d, value: p } = await a.read();
7581
+ if (d)
7560
7582
  return o.drain();
7561
7583
  p && p.length && o.fill(p);
7562
7584
  }
@@ -7578,7 +7600,7 @@ class Ct {
7578
7600
  const y = t.options.link.name || "";
7579
7601
  if (y === "")
7580
7602
  throw new Error("link is a bucket");
7581
- return (t.options.link.bucket !== this.name ? await Ct.create(this.js, t.options.link.bucket) : this).get(y);
7603
+ return (t.options.link.bucket !== this.name ? await It.create(this.js, t.options.link.bucket) : this).get(y);
7582
7604
  }
7583
7605
  if (!t.digest.startsWith(Dr))
7584
7606
  return Promise.reject(new Error(`unknown digest type: ${t.digest}`));
@@ -7594,10 +7616,10 @@ class Ct {
7594
7616
  let o;
7595
7617
  const a = ze();
7596
7618
  a.orderedConsumer();
7597
- const f = Nr.create(), p = `$O.${this.name}.C.${t.nuid}`, g = await this.js.subscribe(p, a);
7619
+ const d = Nr.create(), p = `$O.${this.name}.C.${t.nuid}`, _ = await this.js.subscribe(p, a);
7598
7620
  return (async () => {
7599
- for await (const y of g)
7600
- 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());
7621
+ for await (const y of _)
7622
+ 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}`)), _.unsubscribe());
7601
7623
  })().then(() => {
7602
7624
  i.resolve();
7603
7625
  }).catch((y) => {
@@ -7607,12 +7629,12 @@ class Ct {
7607
7629
  o = y;
7608
7630
  },
7609
7631
  cancel() {
7610
- g.unsubscribe();
7632
+ _.unsubscribe();
7611
7633
  }
7612
7634
  }), n;
7613
7635
  }
7614
7636
  linkStore(e, t) {
7615
- if (!(t instanceof Ct))
7637
+ if (!(t instanceof It))
7616
7638
  return Promise.reject("bucket required");
7617
7639
  const s = t, { name: i, error: n } = this._checkNotEmpty(e);
7618
7640
  if (n)
@@ -7649,8 +7671,8 @@ class Ct {
7649
7671
  }
7650
7672
  };
7651
7673
  await this.js.publish(this._metaSubject(e), JSON.stringify(a));
7652
- const f = await this.info(e);
7653
- return Promise.resolve(f);
7674
+ const d = await this.info(e);
7675
+ return Promise.resolve(d);
7654
7676
  }
7655
7677
  async delete(e) {
7656
7678
  const t = await this.rawInfo(e);
@@ -7678,8 +7700,8 @@ class Ct {
7678
7700
  if (n)
7679
7701
  return Promise.reject(n);
7680
7702
  if (e !== t.name) {
7681
- const f = await this.info(t.name);
7682
- if (f && !f.deleted)
7703
+ const d = await this.info(t.name);
7704
+ if (d && !d.deleted)
7683
7705
  return Promise.reject(new Error("an object already exists with that name"));
7684
7706
  }
7685
7707
  t.name = i;
@@ -7696,19 +7718,19 @@ class Ct {
7696
7718
  await this.jsm.streams.getMessage(this.stream, {
7697
7719
  last_by_subj: i
7698
7720
  });
7699
- } catch (f) {
7700
- f.code === "404" ? (s.push(null), t = !0) : s.stop(f);
7721
+ } catch (d) {
7722
+ d.code === "404" ? (s.push(null), t = !0) : s.stop(d);
7701
7723
  }
7702
7724
  const n = Oe(), o = ze();
7703
- o.orderedConsumer(), e.includeHistory ? o.deliverLastPerSubject() : (t = !0, o.deliverNew()), o.callback((f, p) => {
7704
- var g;
7705
- if (f) {
7706
- s.stop(f);
7725
+ o.orderedConsumer(), e.includeHistory ? o.deliverLastPerSubject() : (t = !0, o.deliverNew()), o.callback((d, p) => {
7726
+ var _;
7727
+ if (d) {
7728
+ s.stop(d);
7707
7729
  return;
7708
7730
  }
7709
7731
  if (p !== null) {
7710
7732
  const y = n.decode(p.data);
7711
- y.deleted && e.ignoreDeletes === !0 || s.push(y), ((g = p.info) == null ? void 0 : g.pending) === 0 && !t && (t = !0, s.push(null));
7733
+ y.deleted && e.ignoreDeletes === !0 || s.push(y), ((_ = p.info) == null ? void 0 : _.pending) === 0 && !t && (t = !0, s.push(null));
7712
7734
  }
7713
7735
  });
7714
7736
  const a = await this.js.subscribe(i, o);
@@ -7716,8 +7738,8 @@ class Ct {
7716
7738
  a.unsubscribe();
7717
7739
  }), a.closed.then(() => {
7718
7740
  s.stop();
7719
- }).catch((f) => {
7720
- s.stop(f);
7741
+ }).catch((d) => {
7742
+ s.stop(d);
7721
7743
  }), s;
7722
7744
  }
7723
7745
  _chunkSubject(e) {
@@ -7740,7 +7762,7 @@ class Ct {
7740
7762
  const s = Object.assign({
7741
7763
  max_age: t
7742
7764
  }, e);
7743
- 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 = [
7765
+ 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 = [
7744
7766
  `$O.${this.name}.C.>`,
7745
7767
  `$O.${this.name}.M.>`
7746
7768
  ], e.placement && (s.placement = e.placement), e.metadata && (s.metadata = e.metadata), typeof e.compression == "boolean" && (s.compression = e.compression ? Ve.S2 : Ve.None);
@@ -7751,7 +7773,7 @@ class Ct {
7751
7773
  }
7752
7774
  }
7753
7775
  static async create(e, t, s = {}) {
7754
- const i = await e.jetstreamManager(), n = new Ct(t, i, e);
7776
+ const i = await e.jetstreamManager(), n = new It(t, i, e);
7755
7777
  return await n.init(s), Promise.resolve(n);
7756
7778
  }
7757
7779
  }
@@ -7761,18 +7783,18 @@ class Vo {
7761
7783
  this.js = e;
7762
7784
  }
7763
7785
  kv(e, t = {}) {
7764
- const s = this.js, { ok: i, min: n } = s.nc.features.get(H.JS_KV);
7765
- 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`));
7786
+ const s = this.js, { ok: i, min: n } = s.nc.features.get(J.JS_KV);
7787
+ 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`));
7766
7788
  }
7767
7789
  os(e, t = {}) {
7768
7790
  var o;
7769
7791
  if (typeof ((o = crypto == null ? void 0 : crypto.subtle) == null ? void 0 : o.digest) != "function")
7770
7792
  return Promise.reject(new Error("objectstore: unable to calculate hashes - crypto.subtle.digest with sha256 support is required"));
7771
- const s = this.js, { ok: i, min: n } = s.nc.features.get(H.JS_OBJECTSTORE);
7772
- return i ? Ct.create(this.js, e, t) : Promise.reject(new Error(`objectstore is only supported on servers ${n} or better`));
7793
+ const s = this.js, { ok: i, min: n } = s.nc.features.get(J.JS_OBJECTSTORE);
7794
+ return i ? It.create(this.js, e, t) : Promise.reject(new Error(`objectstore is only supported on servers ${n} or better`));
7773
7795
  }
7774
7796
  }
7775
- class rr extends Tt {
7797
+ class rr extends Mt {
7776
7798
  constructor(t, s) {
7777
7799
  super(t, s);
7778
7800
  h(this, "consumers");
@@ -7800,20 +7822,20 @@ class rr extends Tt {
7800
7822
  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}`));
7801
7823
  const o = i.timeout || this.timeout, a = {};
7802
7824
  o && (a.timeout = o), i && (a.headers = n);
7803
- let { retries: f, retry_delay: p } = i;
7804
- f = f || 1, p = p || 250;
7805
- let g;
7806
- for (let x = 0; x < f; x++)
7825
+ let { retries: d, retry_delay: p } = i;
7826
+ d = d || 1, p = p || 250;
7827
+ let _;
7828
+ for (let x = 0; x < d; x++)
7807
7829
  try {
7808
- g = await this.nc.request(t, s, a);
7830
+ _ = await this.nc.request(t, s, a);
7809
7831
  break;
7810
7832
  } catch (A) {
7811
- if (A.code === "503" && x + 1 < f)
7833
+ if (A.code === "503" && x + 1 < d)
7812
7834
  await dt(p);
7813
7835
  else
7814
7836
  throw A;
7815
7837
  }
7816
- const y = this.parseJsResponse(g);
7838
+ const y = this.parseJsResponse(_);
7817
7839
  if (y.stream === "")
7818
7840
  throw T.errorForCode(k.JetStreamInvalidAck);
7819
7841
  return y.duplicate = y.duplicate ? y.duplicate : !1, y;
@@ -7829,48 +7851,48 @@ class rr extends Tt {
7829
7851
  }, a = await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${s}`, this.jc.encode(o), {
7830
7852
  noMux: !0,
7831
7853
  timeout: n
7832
- }), f = at(a);
7833
- if (f)
7834
- throw f;
7835
- return Nt(a, this.timeout);
7854
+ }), d = at(a);
7855
+ if (d)
7856
+ throw d;
7857
+ return Tt(a, this.timeout);
7836
7858
  }
7837
7859
  fetch(t, s, i = {}) {
7838
7860
  pe(t), ot(s);
7839
7861
  let n = null;
7840
7862
  const o = (i.max_bytes ?? 0) > 0;
7841
7863
  let a = 0;
7842
- const f = o ? i.max_bytes : 0;
7864
+ const d = o ? i.max_bytes : 0;
7843
7865
  let p = null;
7844
- const g = {};
7845
- if (g.batch = i.batch || 1, f) {
7846
- const L = this.nc.features.get(H.JS_PULL_MAX_BYTES);
7866
+ const _ = {};
7867
+ if (_.batch = i.batch || 1, d) {
7868
+ const L = this.nc.features.get(J.JS_PULL_MAX_BYTES);
7847
7869
  if (!L.ok)
7848
7870
  throw new Error(`max_bytes is only supported on servers ${L.min} or better`);
7849
- g.max_bytes = f;
7871
+ _.max_bytes = d;
7850
7872
  }
7851
- g.no_wait = i.no_wait || !1, g.no_wait && g.expires && (g.expires = 0);
7873
+ _.no_wait = i.no_wait || !1, _.no_wait && _.expires && (_.expires = 0);
7852
7874
  const y = i.expires || 0;
7853
- if (y && (g.expires = W(y)), y === 0 && g.no_wait === !1)
7875
+ if (y && (_.expires = W(y)), y === 0 && _.no_wait === !1)
7854
7876
  throw new Error("expires or no_wait is required");
7855
7877
  const x = i.idle_heartbeat || 0;
7856
- x && (g.idle_heartbeat = W(x), i.delay_heartbeat === !0 && (g.idle_heartbeat = W(x * 4)));
7857
- const A = new he(), I = g.batch;
7858
- let N = 0;
7859
- A.protocolFilterFn = (L, Q = !1) => Ls(L.msg) ? (p == null || p.work(), !1) : !0, A.dispatchedFn = (L) => {
7878
+ x && (_.idle_heartbeat = W(x), i.delay_heartbeat === !0 && (_.idle_heartbeat = W(x * 4)));
7879
+ const A = new he(), O = _.batch;
7880
+ let j = 0;
7881
+ A.protocolFilterFn = (L, ee = !1) => Ls(L.msg) ? (p == null || p.work(), !1) : !0, A.dispatchedFn = (L) => {
7860
7882
  if (L) {
7861
- if (o && (a += L.data.length), N++, n && L.info.pending === 0)
7883
+ if (o && (a += L.data.length), j++, n && L.info.pending === 0)
7862
7884
  return;
7863
- (A.getPending() === 1 && L.info.pending === 0 || I === N || f > 0 && a >= f) && A.stop();
7885
+ (A.getPending() === 1 && L.info.pending === 0 || O === j || d > 0 && a >= d) && A.stop();
7864
7886
  }
7865
7887
  };
7866
- const J = qe(this.nc.options.inboxPrefix), ee = this.nc.subscribe(J, {
7888
+ const B = qe(this.nc.options.inboxPrefix), Q = this.nc.subscribe(B, {
7867
7889
  max: i.batch,
7868
- callback: (L, Q) => {
7869
- L === null && (L = at(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)));
7890
+ callback: (L, ee) => {
7891
+ 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)));
7870
7892
  }
7871
7893
  });
7872
7894
  return y && (n = ut(y), n.catch(() => {
7873
- ee.isClosed() || (ee.drain().catch(() => {
7895
+ Q.isClosed() || (Q.drain().catch(() => {
7874
7896
  }), n = null), p && p.cancel();
7875
7897
  })), (async () => {
7876
7898
  try {
@@ -7879,9 +7901,9 @@ class rr extends Tt {
7879
7901
  }), !0)));
7880
7902
  } catch {
7881
7903
  }
7882
- await ee.closed, n !== null && (n.cancel(), n = null), p && p.cancel(), A.stop();
7883
- })().catch(), this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${s}`, this.jc.encode(g), {
7884
- reply: J
7904
+ await Q.closed, n !== null && (n.cancel(), n = null), p && p.cancel(), A.stop();
7905
+ })().catch(), this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${s}`, this.jc.encode(_), {
7906
+ reply: B
7885
7907
  }), A;
7886
7908
  }
7887
7909
  async pullSubscribe(t, s = ze()) {
@@ -7897,8 +7919,8 @@ class rr extends Tt {
7897
7919
  a.info = i;
7898
7920
  try {
7899
7921
  await this._maybeCreateConsumer(i);
7900
- } catch (f) {
7901
- throw a.unsubscribe(), f;
7922
+ } catch (d) {
7923
+ throw a.unsubscribe(), d;
7902
7924
  }
7903
7925
  return a;
7904
7926
  }
@@ -7982,14 +8004,14 @@ class rr extends Tt {
7982
8004
  }
7983
8005
  static ingestionFn(t) {
7984
8006
  return (s, i) => {
7985
- var f;
8007
+ var d;
7986
8008
  const n = i;
7987
8009
  if (!s) return {
7988
8010
  ingest: !1,
7989
8011
  protocol: !1
7990
8012
  };
7991
8013
  const o = s;
7992
- if (at(o.msg) || (f = n.monitor) == null || f.work(), Ls(o.msg)) {
8014
+ if (at(o.msg) || (d = n.monitor) == null || d.work(), Ls(o.msg)) {
7993
8015
  const p = t ? n._checkHbOrderConsumer(o.msg) : !0;
7994
8016
  return t || n.info.flow_control.heartbeat_count++, {
7995
8017
  ingest: p,
@@ -8077,62 +8099,62 @@ class ir {
8077
8099
  const i = !this.protocol.options.noAsyncTraces;
8078
8100
  try {
8079
8101
  this._check(e, !0, !0);
8080
- } catch (f) {
8081
- return Promise.reject(f);
8102
+ } catch (d) {
8103
+ return Promise.reject(d);
8082
8104
  }
8083
8105
  if (s.strategy = s.strategy || Ne.Timer, s.maxWait = s.maxWait || 1e3, s.maxWait < 1)
8084
8106
  return Promise.reject(new T("timeout", k.InvalidOption));
8085
8107
  const n = new he();
8086
- function o(f) {
8108
+ function o(d) {
8087
8109
  n.push(() => {
8088
- n.stop(f);
8110
+ n.stop(d);
8089
8111
  });
8090
8112
  }
8091
- function a(f, p) {
8092
- f || p === null ? o(f === null ? void 0 : f) : n.push(p);
8113
+ function a(d, p) {
8114
+ d || p === null ? o(d === null ? void 0 : d) : n.push(p);
8093
8115
  }
8094
8116
  if (s.noMux) {
8095
- const f = i ? new Error().stack : null;
8117
+ const d = i ? new Error().stack : null;
8096
8118
  let p = typeof s.maxMessages == "number" && s.maxMessages > 0 ? s.maxMessages : -1;
8097
- const g = this.subscribe(qe(this.options.inboxPrefix), {
8098
- callback: (I, N) => {
8099
- var J, ee;
8100
- 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) {
8101
- f && (I.stack += `
8119
+ const _ = this.subscribe(qe(this.options.inboxPrefix), {
8120
+ callback: (O, j) => {
8121
+ var B, Q;
8122
+ 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) {
8123
+ d && (O.stack += `
8102
8124
 
8103
- ${f}`), y(I);
8125
+ ${d}`), y(O);
8104
8126
  return;
8105
8127
  }
8106
- a(null, N), s.strategy === Ne.Count && (p--, p === 0 && y()), s.strategy === Ne.JitterTimer && (A(), x = setTimeout(() => {
8128
+ a(null, j), s.strategy === Ne.Count && (p--, p === 0 && y()), s.strategy === Ne.JitterTimer && (A(), x = setTimeout(() => {
8107
8129
  y();
8108
- }, 300)), s.strategy === Ne.SentinelMsg && N && N.data.length === 0 && y();
8130
+ }, 300)), s.strategy === Ne.SentinelMsg && j && j.data.length === 0 && y();
8109
8131
  }
8110
8132
  });
8111
- g.requestSubject = e, g.closed.then(() => {
8133
+ _.requestSubject = e, _.closed.then(() => {
8112
8134
  o();
8113
- }).catch((I) => {
8114
- n.stop(I);
8135
+ }).catch((O) => {
8136
+ n.stop(O);
8115
8137
  });
8116
- const y = (I) => {
8117
- I && n.push(() => {
8118
- throw I;
8119
- }), A(), g.drain().then(() => {
8138
+ const y = (O) => {
8139
+ O && n.push(() => {
8140
+ throw O;
8141
+ }), A(), _.drain().then(() => {
8120
8142
  o();
8121
- }).catch((N) => {
8143
+ }).catch((j) => {
8122
8144
  o();
8123
8145
  });
8124
8146
  };
8125
8147
  n.iterClosed.then(() => {
8126
- A(), g == null || g.unsubscribe();
8127
- }).catch((I) => {
8128
- A(), g == null || g.unsubscribe();
8148
+ A(), _ == null || _.unsubscribe();
8149
+ }).catch((O) => {
8150
+ A(), _ == null || _.unsubscribe();
8129
8151
  });
8130
8152
  try {
8131
8153
  this.publish(e, t, {
8132
- reply: g.getSubject()
8154
+ reply: _.getSubject()
8133
8155
  });
8134
- } catch (I) {
8135
- y(I);
8156
+ } catch (O) {
8157
+ y(O);
8136
8158
  }
8137
8159
  let x = setTimeout(() => {
8138
8160
  y();
@@ -8141,21 +8163,21 @@ ${f}`), y(I);
8141
8163
  x && clearTimeout(x);
8142
8164
  };
8143
8165
  } else {
8144
- const f = s;
8145
- f.callback = a, n.iterClosed.then(() => {
8166
+ const d = s;
8167
+ d.callback = a, n.iterClosed.then(() => {
8146
8168
  p.cancel();
8147
- }).catch((g) => {
8148
- p.cancel(g);
8169
+ }).catch((_) => {
8170
+ p.cancel(_);
8149
8171
  });
8150
- const p = new Sn(this.protocol.muxSubscriptions, e, f);
8172
+ const p = new Sn(this.protocol.muxSubscriptions, e, d);
8151
8173
  this.protocol.request(p);
8152
8174
  try {
8153
8175
  this.publish(e, t, {
8154
8176
  reply: `${this.protocol.muxSubscriptions.baseInbox}${p.token}`,
8155
8177
  headers: s.headers
8156
8178
  });
8157
- } catch (g) {
8158
- p.cancel(g);
8179
+ } catch (_) {
8180
+ p.cancel(_);
8159
8181
  }
8160
8182
  }
8161
8183
  return Promise.resolve(n);
@@ -8175,18 +8197,18 @@ ${f}`), y(I);
8175
8197
  if (!s.noMux && s.reply)
8176
8198
  return Promise.reject(new T("reply can only be used with noMux", k.InvalidOption));
8177
8199
  if (s.noMux) {
8178
- const n = s.reply ? s.reply : qe(this.options.inboxPrefix), o = Y(), a = i ? new Error() : null, f = this.subscribe(n, {
8200
+ const n = s.reply ? s.reply : qe(this.options.inboxPrefix), o = Y(), a = i ? new Error() : null, d = this.subscribe(n, {
8179
8201
  max: 1,
8180
8202
  timeout: s.timeout,
8181
- callback: (p, g) => {
8203
+ callback: (p, _) => {
8182
8204
  p ? (a && p.code !== k.Timeout && (p.stack += `
8183
8205
 
8184
- ${a.stack}`), f.unsubscribe(), o.reject(p)) : (p = ei(g), p ? (a && (p.stack += `
8206
+ ${a.stack}`), d.unsubscribe(), o.reject(p)) : (p = ei(_), p ? (a && (p.stack += `
8185
8207
 
8186
- ${a.stack}`), o.reject(p)) : o.resolve(g));
8208
+ ${a.stack}`), o.reject(p)) : o.resolve(_));
8187
8209
  }
8188
8210
  });
8189
- return f.requestSubject = e, this.protocol.publish(e, t, {
8211
+ return d.requestSubject = e, this.protocol.publish(e, t, {
8190
8212
  reply: n,
8191
8213
  headers: s.headers
8192
8214
  }), o;
@@ -8288,7 +8310,7 @@ class Wo {
8288
8310
  }
8289
8311
  add(e) {
8290
8312
  try {
8291
- return new Mt(this.nc, e).start();
8313
+ return new Ut(this.nc, e).start();
8292
8314
  } catch (t) {
8293
8315
  return Promise.reject(t);
8294
8316
  }
@@ -8395,11 +8417,11 @@ class mi extends Pn {
8395
8417
  const a = `${n.api.prefix}.CONSUMER.CREATE.${n.stream}`;
8396
8418
  this.js._request(a, o, {
8397
8419
  retries: -1
8398
- }).then((f) => {
8399
- const p = f, g = this.sub.info;
8400
- g.last = p, this.info.config = p.config, this.info.name = p.name;
8401
- }).catch((f) => {
8402
- const p = new T(`unable to recreate ordered consumer ${n.stream} at seq ${t}`, k.RequestError, f);
8420
+ }).then((d) => {
8421
+ const p = d, _ = this.sub.info;
8422
+ _.last = p, this.info.config = p.config, this.info.name = p.name;
8423
+ }).catch((d) => {
8424
+ const p = new T(`unable to recreate ordered consumer ${n.stream} at seq ${t}`, k.RequestError, d);
8403
8425
  this.sub.callback(p, {});
8404
8426
  });
8405
8427
  }
@@ -8415,15 +8437,15 @@ class mi extends Pn {
8415
8437
  };
8416
8438
  s && (i.cancelAfter = s);
8417
8439
  const n = this.sub, o = (a) => {
8418
- var g, y, x, A;
8419
- const f = on(409, `${Pe.IdleHeartbeatMissed}: ${a}`, this.sub.subject);
8420
- if (!((g = this.info) == null ? void 0 : g.ordered))
8421
- this.sub.callback(null, f);
8440
+ var _, y, x, A;
8441
+ const d = on(409, `${Pe.IdleHeartbeatMissed}: ${a}`, this.sub.subject);
8442
+ if (!((_ = this.info) == null ? void 0 : _.ordered))
8443
+ this.sub.callback(null, d);
8422
8444
  else {
8423
8445
  if (!this.js.nc.protocol.connected)
8424
8446
  return !1;
8425
- const I = ((x = (y = this.info) == null ? void 0 : y.ordered_consumer_sequence) == null ? void 0 : x.stream_seq) || 0;
8426
- return this._resetOrderedConsumer(I + 1), (A = this.monitor) == null || A.restart(), !1;
8447
+ const O = ((x = (y = this.info) == null ? void 0 : y.ordered_consumer_sequence) == null ? void 0 : x.stream_seq) || 0;
8448
+ return this._resetOrderedConsumer(O + 1), (A = this.monitor) == null || A.restart(), !1;
8427
8449
  }
8428
8450
  return !n.noIterator;
8429
8451
  };
@@ -8458,22 +8480,22 @@ class Zo extends mi {
8458
8480
  }) {
8459
8481
  const { stream: t, config: s, name: i } = this.sub.info, n = s.durable_name ?? i, o = {};
8460
8482
  if (o.batch = e.batch || 1, o.no_wait = e.no_wait || !1, (e.max_bytes ?? 0) > 0) {
8461
- const p = this.js.nc.features.get(H.JS_PULL_MAX_BYTES);
8483
+ const p = this.js.nc.features.get(J.JS_PULL_MAX_BYTES);
8462
8484
  if (!p.ok)
8463
8485
  throw new Error(`max_bytes is only supported on servers ${p.min} or better`);
8464
8486
  o.max_bytes = e.max_bytes;
8465
8487
  }
8466
8488
  let a = 0;
8467
8489
  e.expires && e.expires > 0 && (a = e.expires, o.expires = W(a));
8468
- let f = 0;
8469
- if (e.idle_heartbeat && e.idle_heartbeat > 0 && (f = e.idle_heartbeat, o.idle_heartbeat = W(f)), f && a === 0)
8490
+ let d = 0;
8491
+ if (e.idle_heartbeat && e.idle_heartbeat > 0 && (d = e.idle_heartbeat, o.idle_heartbeat = W(d)), d && a === 0)
8470
8492
  throw new Error("idle_heartbeat requires expires");
8471
- if (f > a)
8493
+ if (d > a)
8472
8494
  throw new Error("expires must be greater than idle_heartbeat");
8473
8495
  if (this.info) {
8474
- this.monitor && this.monitor.cancel(), a && f && (this.monitor ? this.monitor._change(f, a) : this._setupHbMonitoring(f, a));
8475
- const p = this.info.api, g = `${p.prefix}.CONSUMER.MSG.NEXT.${t}.${n}`, y = this.sub.subject;
8476
- p.nc.publish(g, p.jc.encode(o), {
8496
+ this.monitor && this.monitor.cancel(), a && d && (this.monitor ? this.monitor._change(d, a) : this._setupHbMonitoring(d, a));
8497
+ const p = this.info.api, _ = `${p.prefix}.CONSUMER.MSG.NEXT.${t}.${n}`, y = this.sub.subject;
8498
+ p.nc.publish(_, p.jc.encode(o), {
8477
8499
  reply: y
8478
8500
  });
8479
8501
  }
@@ -8491,7 +8513,7 @@ function ea(r) {
8491
8513
  null
8492
8514
  ] : [
8493
8515
  null,
8494
- Nt(t, r)
8516
+ Tt(t, r)
8495
8517
  ]);
8496
8518
  }
8497
8519
  function ta(r) {
@@ -8507,7 +8529,7 @@ function ta(r) {
8507
8529
  null
8508
8530
  ] : [
8509
8531
  null,
8510
- Nt(t, r)
8532
+ Tt(t, r)
8511
8533
  ];
8512
8534
  };
8513
8535
  }
@@ -8587,16 +8609,16 @@ class ia {
8587
8609
  n.publish(this.msg.reply, Hr, {
8588
8610
  reply: `${n.muxSubscriptions.baseInbox}${a.token}`
8589
8611
  });
8590
- } catch (f) {
8591
- a.cancel(f);
8612
+ } catch (d) {
8613
+ a.cancel(d);
8592
8614
  }
8593
8615
  try {
8594
8616
  await Promise.race([
8595
8617
  a.timer,
8596
8618
  a.deferred
8597
8619
  ]), t.resolve(!0);
8598
- } catch (f) {
8599
- a.cancel(f), t.reject(f);
8620
+ } catch (d) {
8621
+ a.cancel(d), t.reject(d);
8600
8622
  }
8601
8623
  } else
8602
8624
  t.resolve(!1);
@@ -8675,13 +8697,13 @@ class aa {
8675
8697
  }
8676
8698
  const o = ft.concat(...this.yields), a = Rn(o);
8677
8699
  if (a !== "") {
8678
- const f = wo.exec(a);
8679
- if (!f) {
8680
- t.debug && console.error("!!!", Kt(o)), s.reject(new Error("unexpected response from server"));
8700
+ const d = wo.exec(a);
8701
+ if (!d) {
8702
+ t.debug && console.error("!!!", zt(o)), s.reject(new Error("unexpected response from server"));
8681
8703
  return;
8682
8704
  }
8683
8705
  try {
8684
- const p = JSON.parse(f[1]);
8706
+ const p = JSON.parse(d[1]);
8685
8707
  _o(p, this.options), this.peeked = !0, this.connected = !0, this.signal.resolve(), s.resolve();
8686
8708
  } catch (p) {
8687
8709
  s.reject(p);
@@ -8731,7 +8753,7 @@ class aa {
8731
8753
  const e = this.yields;
8732
8754
  this.yields = [];
8733
8755
  for (let t = 0; t < e.length; t++)
8734
- this.options.debug && console.info(`> ${Kt(e[t])}`), yield e[t];
8756
+ this.options.debug && console.info(`> ${zt(e[t])}`), yield e[t];
8735
8757
  if (this.done)
8736
8758
  break;
8737
8759
  this.yields.length === 0 && (e.length = 0, this.yields = e, this.signal = Y());
@@ -8743,10 +8765,10 @@ class aa {
8743
8765
  send(e) {
8744
8766
  if (!this.isDiscarded())
8745
8767
  try {
8746
- this.socket.send(e.buffer), this.options.debug && console.info(`< ${Kt(e)}`);
8768
+ this.socket.send(e.buffer), this.options.debug && console.info(`< ${zt(e)}`);
8747
8769
  return;
8748
8770
  } catch (t) {
8749
- this.options.debug && console.error(`!!! ${Kt(e)}: ${t}`);
8771
+ this.options.debug && console.error(`!!! ${zt(e)}: ${t}`);
8750
8772
  }
8751
8773
  }
8752
8774
  close(e) {
@@ -8773,7 +8795,7 @@ function ca(r, e) {
8773
8795
  const i = s.protocol.toLowerCase();
8774
8796
  i === "ws:" && (e = !1), i === "wss:" && (e = !0), i !== "https:" && i !== "http" && (r = r.replace(/^(.*:\/\/)(.*)/gm, "$2"), s = new URL(`http://${r}`));
8775
8797
  let n, o;
8776
- const a = s.hostname, f = s.pathname, p = s.search || "";
8798
+ const a = s.hostname, d = s.pathname, p = s.search || "";
8777
8799
  switch (i) {
8778
8800
  case "http:":
8779
8801
  case "ws:":
@@ -8789,7 +8811,7 @@ function ca(r, e) {
8789
8811
  o = s.port || e === !0 ? "443" : "80", n = e === !0 ? "wss:" : "ws:";
8790
8812
  break;
8791
8813
  }
8792
- return `${n}//${a}:${o}${f}${p}`;
8814
+ return `${n}//${a}:${o}${d}${p}`;
8793
8815
  }
8794
8816
  function ha(r = {}) {
8795
8817
  return kn({
@@ -8818,18 +8840,18 @@ class Kr {
8818
8840
  }
8819
8841
  async connect(e = {}) {
8820
8842
  var x;
8821
- const { natsWsUrls: t, user: s, prefix: i, accessToken: n, sessionSeed: o } = e, a = t ?? [this.config.natsUrl], f = n ?? await this.config.auth.getAccessToken();
8822
- if (!f)
8843
+ const { natsWsUrls: t, user: s, prefix: i, accessToken: n, sessionSeed: o } = e, a = t ?? [this.config.natsUrl], d = n ?? await this.config.auth.getAccessToken();
8844
+ if (!d)
8823
8845
  throw new Error("Please provide auth token");
8824
8846
  const p = o ?? await this.config.auth.getSessionSeed();
8825
8847
  if (!p)
8826
8848
  throw new Error("Please provide session seed");
8827
- const g = Us();
8849
+ const _ = Us();
8828
8850
  this.nc = await ha({
8829
8851
  servers: a,
8830
8852
  authenticator: fo(
8831
- f,
8832
- g.encode(p)
8853
+ d,
8854
+ _.encode(p)
8833
8855
  )
8834
8856
  });
8835
8857
  const y = s ?? await this.config.auth.getLastLoginData();
@@ -8841,16 +8863,16 @@ class Kr {
8841
8863
  "[nats] connected.",
8842
8864
  this.globalPrefix ? `(prefix: ${this.globalPrefix})` : ""
8843
8865
  ), (async () => {
8844
- var A, I;
8845
- for await (const N of this.nc.status())
8846
- switch (N.type !== He.PingTimer && console.log("[nats] connection status:", N.type), N.type) {
8866
+ var A, O;
8867
+ for await (const j of this.nc.status())
8868
+ switch (j.type !== He.PingTimer && console.log("[nats] connection status:", j.type), j.type) {
8847
8869
  case ke.Reconnect:
8848
8870
  (A = this.onStatusChange) == null || A.call(this, !0);
8849
8871
  break;
8850
8872
  case ke.Disconnect:
8851
8873
  case ke.Error:
8852
8874
  case He.Reconnecting:
8853
- (I = this.onStatusChange) == null || I.call(this, !1);
8875
+ (O = this.onStatusChange) == null || O.call(this, !1);
8854
8876
  break;
8855
8877
  }
8856
8878
  })();
@@ -8900,11 +8922,11 @@ class Kr {
8900
8922
  continue;
8901
8923
  }
8902
8924
  a[0] === "dev" && a.shift();
8903
- const f = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], g = a[a.length - 1], y = Be.decode(o.data);
8925
+ const d = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], _ = a[a.length - 1], y = Be.decode(o.data);
8904
8926
  t(y, {
8905
- subject: f,
8927
+ subject: d,
8906
8928
  userId: p,
8907
- sessionId: g
8929
+ sessionId: _
8908
8930
  });
8909
8931
  } catch (a) {
8910
8932
  console.error("[nats] subscribe error", a);
@@ -8928,12 +8950,12 @@ class Kr {
8928
8950
  continue;
8929
8951
  }
8930
8952
  a[0] === "dev" && a.shift();
8931
- const f = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], g = a[a.length - 1], y = Be.decode(o.data);
8953
+ const d = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], _ = a[a.length - 1], y = Be.decode(o.data);
8932
8954
  try {
8933
8955
  const x = await t(y, {
8934
- subject: f,
8956
+ subject: d,
8935
8957
  userId: p,
8936
- sessionId: g
8958
+ sessionId: _
8937
8959
  });
8938
8960
  o.reply && o.respond(
8939
8961
  Be.encode({
@@ -8992,50 +9014,50 @@ function _i(r) {
8992
9014
  }
8993
9015
  class ua {
8994
9016
  async getAudioBuffer(e, t, s) {
8995
- const i = [], n = crypto.randomUUID();
8996
- return new Promise((o, a) => {
8997
- const f = new WebSocket(
8998
- `${Wt.WSS_URL}?trustedclienttoken=${Wt.TRUSTED_CLIENT_TOKEN}&ConnectionId=${n}`
8999
- );
9000
- f.binaryType = "arraybuffer";
9001
- const p = fa(e, t, s);
9002
- f.addEventListener("open", () => {
9003
- const g = la();
9004
- f.send(g);
9005
- const y = `X-RequestId:${n}\r
9017
+ const i = [], n = crypto.randomUUID(), o = await pa(
9018
+ Et.TRUSTED_CLIENT_TOKEN
9019
+ );
9020
+ return new Promise((a, d) => {
9021
+ 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}`, _ = new WebSocket(p);
9022
+ _.binaryType = "arraybuffer";
9023
+ const y = fa(e, t, s);
9024
+ _.addEventListener("open", () => {
9025
+ const x = la();
9026
+ _.send(x);
9027
+ const A = `X-RequestId:${n}\r
9006
9028
  Content-Type:application/ssml+xml\r
9007
9029
  X-Timestamp:${(/* @__PURE__ */ new Date()).toISOString()}Z\r
9008
9030
  Path:ssml\r
9009
9031
  \r
9010
- ` + p;
9011
- f.send(y);
9012
- }), f.addEventListener("message", (g) => {
9013
- const y = g.data;
9014
- if (y instanceof ArrayBuffer) {
9015
- const x = new Uint8Array(y), A = new TextEncoder().encode(`Path:audio\r
9016
- `), I = da(x, A);
9017
- if (I !== -1) {
9018
- const J = x.subarray(I + A.length);
9019
- i.push(J);
9032
+ ` + y;
9033
+ _.send(A);
9034
+ }), _.addEventListener("message", (x) => {
9035
+ const A = x.data;
9036
+ if (A instanceof ArrayBuffer) {
9037
+ const O = new Uint8Array(A), j = new TextEncoder().encode(`Path:audio\r
9038
+ `), B = da(O, j);
9039
+ if (B !== -1) {
9040
+ const L = O.subarray(B + j.length);
9041
+ i.push(L);
9020
9042
  }
9021
- new TextDecoder().decode(x).includes("Path:turn.end") && f.close();
9043
+ new TextDecoder().decode(O).includes("Path:turn.end") && _.close();
9022
9044
  } else
9023
- y.includes("Path:turn.end") && f.close();
9024
- }), f.addEventListener("close", () => {
9045
+ A.includes("Path:turn.end") && _.close();
9046
+ }), _.addEventListener("close", () => {
9025
9047
  if (!i.length) {
9026
- a("No audio data available to save.");
9048
+ d("No audio data available to save.");
9027
9049
  return;
9028
9050
  }
9029
- const g = i.reduce(
9030
- (A, I) => A + I.length,
9051
+ const x = i.reduce(
9052
+ (j, B) => j + B.length,
9031
9053
  0
9032
- ), y = new Uint8Array(g);
9033
- let x = 0;
9034
- for (const A of i)
9035
- y.set(A, x), x += A.length;
9036
- o(y.buffer);
9037
- }), f.addEventListener("error", (g) => {
9038
- a(g);
9054
+ ), A = new Uint8Array(x);
9055
+ let O = 0;
9056
+ for (const j of i)
9057
+ A.set(j, O), O += j.length;
9058
+ a(A.buffer);
9059
+ }), _.addEventListener("error", (x) => {
9060
+ d(x);
9039
9061
  });
9040
9062
  });
9041
9063
  }
@@ -9046,7 +9068,7 @@ Path:ssml\r
9046
9068
  }
9047
9069
  async getVoices() {
9048
9070
  return (await (await fetch(
9049
- `${Wt.VOICES_URL}?trustedclienttoken=${Wt.TRUSTED_CLIENT_TOKEN}`
9071
+ `${Et.VOICES_URL}?trustedclienttoken=${Et.TRUSTED_CLIENT_TOKEN}`
9050
9072
  )).json()).map((s) => ({
9051
9073
  id: s.ShortName,
9052
9074
  locale: s.Locale,
@@ -9054,7 +9076,7 @@ Path:ssml\r
9054
9076
  }));
9055
9077
  }
9056
9078
  }
9057
- const Wt = {
9079
+ const Et = {
9058
9080
  TRUSTED_CLIENT_TOKEN: "6A5AA1D4EAFF4E9FB37E23D68491D6F4",
9059
9081
  WSS_URL: "wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1",
9060
9082
  VOICES_URL: "https://speech.platform.bing.com/consumer/speech/synthesize/readaloud/voices/list"
@@ -9080,7 +9102,11 @@ function da(r, e) {
9080
9102
  }
9081
9103
  return -1;
9082
9104
  }
9083
- class ma {
9105
+ const pa = async (r) => {
9106
+ 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);
9107
+ return Array.from(new Uint8Array(o)).map((a) => a.toString(16).padStart(2, "0")).join("").toUpperCase();
9108
+ };
9109
+ class ba {
9084
9110
  constructor(e) {
9085
9111
  this.config = e;
9086
9112
  }
@@ -9117,13 +9143,13 @@ class ma {
9117
9143
  if (y) break;
9118
9144
  a.push(x);
9119
9145
  }
9120
- const f = a.reduce(
9146
+ const d = a.reduce(
9121
9147
  (y, x) => y + x.length,
9122
9148
  0
9123
- ), p = new Uint8Array(f);
9124
- let g = 0;
9149
+ ), p = new Uint8Array(d);
9150
+ let _ = 0;
9125
9151
  for (const y of a)
9126
- p.set(y, g), g += y.length;
9152
+ p.set(y, _), _ += y.length;
9127
9153
  return p.buffer;
9128
9154
  }
9129
9155
  async getAudio(e, t) {
@@ -9148,7 +9174,7 @@ const yi = {
9148
9174
  authUrl: "https://auth.jok.io",
9149
9175
  natsUrl: "https://nats.jok.io",
9150
9176
  storage: new gi()
9151
- }, zr = new Xr(yi), ba = {
9177
+ }, zr = new Xr(yi), ga = {
9152
9178
  setup(r) {
9153
9179
  if (r.authUrl || r.storage) {
9154
9180
  const e = this.auth.onUserDataUpdate;
@@ -9170,6 +9196,6 @@ const yi = {
9170
9196
  };
9171
9197
  export {
9172
9198
  Kr as NatsService,
9173
- ma as VoicevoxTtsService,
9174
- ba as jok
9199
+ ba as VoicevoxTtsService,
9200
+ ga as jok
9175
9201
  };