@jokio/sdk 0.4.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -166,7 +166,7 @@ function Yr(r) {
166
166
  return r;
167
167
  }
168
168
  async function Bi(r) {
169
- var I;
169
+ var O;
170
170
  !r.optionsJSON && r.challenge && (console.warn("startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."), r = { optionsJSON: r });
171
171
  const { optionsJSON: e, useAutoRegister: t = !1 } = r;
172
172
  if (!Ys())
@@ -178,48 +178,48 @@ async function Bi(r) {
178
178
  ...e.user,
179
179
  id: Zt(e.user.id)
180
180
  },
181
- excludeCredentials: (I = e.excludeCredentials) == null ? void 0 : I.map(Gr)
181
+ excludeCredentials: (O = e.excludeCredentials) == null ? void 0 : O.map(Gr)
182
182
  }, i = {};
183
183
  t && (i.mediation = "conditional"), i.publicKey = s, i.signal = Wr.createNewAbortSignal();
184
184
  let n;
185
185
  try {
186
186
  n = await navigator.credentials.create(i);
187
- } catch (N) {
188
- throw Li({ error: N, options: i });
187
+ } catch (j) {
188
+ throw Li({ error: j, options: i });
189
189
  }
190
190
  if (!n)
191
191
  throw new Error("Registration was not completed");
192
- const { id: o, rawId: a, response: f, type: p } = n;
192
+ const { id: o, rawId: a, response: d, type: p } = n;
193
193
  let g;
194
- typeof f.getTransports == "function" && (g = f.getTransports());
194
+ typeof d.getTransports == "function" && (g = d.getTransports());
195
195
  let y;
196
- if (typeof f.getPublicKeyAlgorithm == "function")
196
+ if (typeof d.getPublicKeyAlgorithm == "function")
197
197
  try {
198
- y = f.getPublicKeyAlgorithm();
199
- } catch (N) {
200
- Es("getPublicKeyAlgorithm()", N);
198
+ y = d.getPublicKeyAlgorithm();
199
+ } catch (j) {
200
+ Es("getPublicKeyAlgorithm()", j);
201
201
  }
202
202
  let x;
203
- if (typeof f.getPublicKey == "function")
203
+ if (typeof d.getPublicKey == "function")
204
204
  try {
205
- const N = f.getPublicKey();
206
- N !== null && (x = Me(N));
207
- } catch (N) {
208
- Es("getPublicKey()", N);
205
+ const j = d.getPublicKey();
206
+ j !== null && (x = Me(j));
207
+ } catch (j) {
208
+ Es("getPublicKey()", j);
209
209
  }
210
210
  let A;
211
- if (typeof f.getAuthenticatorData == "function")
211
+ if (typeof d.getAuthenticatorData == "function")
212
212
  try {
213
- A = Me(f.getAuthenticatorData());
214
- } catch (N) {
215
- Es("getAuthenticatorData()", N);
213
+ A = Me(d.getAuthenticatorData());
214
+ } catch (j) {
215
+ Es("getAuthenticatorData()", j);
216
216
  }
217
217
  return {
218
218
  id: o,
219
219
  rawId: Me(a),
220
220
  response: {
221
- attestationObject: Me(f.attestationObject),
222
- clientDataJSON: Me(f.clientDataJSON),
221
+ attestationObject: Me(d.attestationObject),
222
+ clientDataJSON: Me(d.clientDataJSON),
223
223
  transports: g,
224
224
  publicKeyAlgorithm: y,
225
225
  publicKey: x,
@@ -285,13 +285,13 @@ function Hi({ error: r, options: e }) {
285
285
  return r;
286
286
  }
287
287
  async function Ji(r) {
288
- var A, I;
288
+ var A, O;
289
289
  !r.optionsJSON && r.challenge && (console.warn("startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."), r = { optionsJSON: r });
290
290
  const { optionsJSON: e, useBrowserAutofill: t = !1, verifyBrowserAutofillInput: s = !0 } = r;
291
291
  if (!Ys())
292
292
  throw new Error("WebAuthn is not supported in this browser");
293
293
  let i;
294
- ((A = e.allowCredentials) == null ? void 0 : A.length) !== 0 && (i = (I = e.allowCredentials) == null ? void 0 : I.map(Gr));
294
+ ((A = e.allowCredentials) == null ? void 0 : A.length) !== 0 && (i = (O = e.allowCredentials) == null ? void 0 : O.map(Gr));
295
295
  const n = {
296
296
  ...e,
297
297
  challenge: Zt(e.challenge),
@@ -308,15 +308,15 @@ async function Ji(r) {
308
308
  let a;
309
309
  try {
310
310
  a = await navigator.credentials.get(o);
311
- } catch (N) {
312
- throw Hi({ error: N, options: o });
311
+ } catch (j) {
312
+ throw Hi({ error: j, options: o });
313
313
  }
314
314
  if (!a)
315
315
  throw new Error("Authentication was not completed");
316
- const { id: f, rawId: p, response: g, type: y } = a;
316
+ const { id: d, rawId: p, response: g, type: y } = a;
317
317
  let x;
318
318
  return g.userHandle && (x = Me(g.userHandle)), {
319
- id: f,
319
+ id: d,
320
320
  rawId: Me(p),
321
321
  response: {
322
322
  authenticatorData: Me(g.authenticatorData),
@@ -365,7 +365,7 @@ class Xr {
365
365
  ), await this.options.storage.setItem(wt, s.jwtData), (i = this.onUserDataUpdate) == null || i.call(this, s.jwtData), s.jwtData;
366
366
  }
367
367
  async requestPasskeyLogin(e = {}) {
368
- var f, p;
368
+ var d, p;
369
369
  const {
370
370
  displayName: t = "",
371
371
  isRegistration: s = !1,
@@ -378,7 +378,7 @@ class Xr {
378
378
  ).then(xt);
379
379
  let o;
380
380
  try {
381
- (f = n.user) != null && f.id ? o = await Bi({
381
+ (d = n.user) != null && d.id ? o = await Bi({
382
382
  optionsJSON: n
383
383
  }) : o = await Ji({
384
384
  optionsJSON: n
@@ -519,7 +519,7 @@ function Wi(...r) {
519
519
  t.set(r[i], s), s += r[i].length;
520
520
  return t;
521
521
  }
522
- function Pt(...r) {
522
+ function kt(...r) {
523
523
  const e = [];
524
524
  for (let t = 0; t < r.length; t++)
525
525
  e.push(We.encode(r[t]));
@@ -642,10 +642,10 @@ var Ne;
642
642
  (function(r) {
643
643
  r.Timer = "timer", r.Count = "count", r.JitterTimer = "jitterTimer", r.SentinelMsg = "sentinelMsg";
644
644
  })(Ne || (Ne = {}));
645
- var kt;
645
+ var Ot;
646
646
  (function(r) {
647
647
  r.STATS = "io.nats.micro.v1.stats_response", r.INFO = "io.nats.micro.v1.info_response", r.PING = "io.nats.micro.v1.ping_response";
648
- })(kt || (kt = {}));
648
+ })(Ot || (Ot = {}));
649
649
  const Qt = "Nats-Service-Error", es = "Nats-Service-Error-Code";
650
650
  class ts extends Error {
651
651
  constructor(t, s) {
@@ -688,7 +688,7 @@ function cs(r, ...e) {
688
688
  }
689
689
  return r;
690
690
  }
691
- function Kt(r) {
691
+ function zt(r) {
692
692
  return xe.decode(r).replace(/\n/g, "␊").replace(/\r/g, "␍");
693
693
  }
694
694
  function ut(r, e = !0) {
@@ -837,8 +837,8 @@ class Ke {
837
837
  if (o) {
838
838
  const a = o.indexOf(":");
839
839
  if (a > -1) {
840
- const f = o.slice(0, a), p = o.slice(a + 1).trim();
841
- t.append(f, p);
840
+ const d = o.slice(0, a), p = o.slice(a + 1).trim();
841
+ t.append(d, p);
842
842
  }
843
843
  }
844
844
  }), t;
@@ -1075,7 +1075,7 @@ function hs(r, e = "") {
1075
1075
  }
1076
1076
  }), "";
1077
1077
  }
1078
- function Et(r, e = "") {
1078
+ function At(r, e = "") {
1079
1079
  if (e === "")
1080
1080
  throw Error(`${r} name required`);
1081
1081
  const t = nn(e);
@@ -1285,10 +1285,10 @@ var qs;
1285
1285
  (function(r) {
1286
1286
  r.Limits = "limits", r.Interest = "interest", r.Workqueue = "workqueue";
1287
1287
  })(qs || (qs = {}));
1288
- var It;
1288
+ var jt;
1289
1289
  (function(r) {
1290
1290
  r.Old = "old", r.New = "new";
1291
- })(It || (It = {}));
1291
+ })(jt || (jt = {}));
1292
1292
  var Fs;
1293
1293
  (function(r) {
1294
1294
  r.File = "file", r.Memory = "memory";
@@ -1645,7 +1645,7 @@ Os = us, function() {
1645
1645
  t.JS_SHA256_NO_WINDOW && (e = !1);
1646
1646
  var s = !e && typeof self == "object", i = !t.JS_SHA256_NO_NODE_JS && Ir.versions && Ir.versions.node;
1647
1647
  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 = [
1648
+ var n = !t.JS_SHA256_NO_COMMON_JS && Os.exports, o = !t.JS_SHA256_NO_ARRAY_BUFFER && typeof ArrayBuffer < "u", a = "0123456789abcdef".split(""), d = [
1649
1649
  -2147483648,
1650
1650
  8388608,
1651
1651
  32768,
@@ -1731,50 +1731,50 @@ Os = us, function() {
1731
1731
  }), !o || !t.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW && ArrayBuffer.isView || (ArrayBuffer.isView = function(w) {
1732
1732
  return typeof w == "object" && w.buffer && w.buffer.constructor === ArrayBuffer;
1733
1733
  });
1734
- var A = function(w, j) {
1734
+ var A = function(w, R) {
1735
1735
  return function(F) {
1736
- return new L(j, !0).update(F)[w]();
1736
+ return new L(R, !0).update(F)[w]();
1737
1737
  };
1738
- }, I = function(w) {
1739
- var j = A("hex", w);
1740
- i && (j = N(j, w)), j.create = function() {
1738
+ }, O = function(w) {
1739
+ var R = A("hex", w);
1740
+ i && (R = j(R, w)), R.create = function() {
1741
1741
  return new L(w);
1742
- }, j.update = function(P) {
1743
- return j.create().update(P);
1742
+ }, R.update = function(P) {
1743
+ return R.create().update(P);
1744
1744
  };
1745
1745
  for (var F = 0; F < y.length; ++F) {
1746
- var R = y[F];
1747
- j[R] = A(R, w);
1746
+ var N = y[F];
1747
+ R[N] = A(N, w);
1748
1748
  }
1749
- return j;
1750
- }, N = function(w, j) {
1751
- var F, R = Rr, P = Rr.Buffer, U = j ? "sha224" : "sha256";
1749
+ return R;
1750
+ }, j = function(w, R) {
1751
+ var F, N = Rr, P = Rr.Buffer, U = R ? "sha224" : "sha256";
1752
1752
  return F = P.from && !t.JS_SHA256_NO_BUFFER_FROM ? P.from : function(q) {
1753
1753
  return new P(q);
1754
1754
  }, function(q) {
1755
- if (typeof q == "string") return R.createHash(U).update(q, "utf8").digest("hex");
1755
+ if (typeof q == "string") return N.createHash(U).update(q, "utf8").digest("hex");
1756
1756
  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);
1757
+ return q.constructor === ArrayBuffer && (q = new Uint8Array(q)), Array.isArray(q) || ArrayBuffer.isView(q) || q.constructor === P ? N.createHash(U).update(F(q)).digest("hex") : w(q);
1758
1758
  };
1759
- }, J = function(w, j) {
1760
- return function(F, R) {
1761
- return new Q(F, j, !0).update(R)[w]();
1759
+ }, B = function(w, R) {
1760
+ return function(F, N) {
1761
+ return new ee(F, R, !0).update(N)[w]();
1762
1762
  };
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);
1763
+ }, Q = function(w) {
1764
+ var R = B("hex", w);
1765
+ R.create = function(P) {
1766
+ return new ee(P, w);
1767
+ }, R.update = function(P, U) {
1768
+ return R.create(P).update(U);
1769
1769
  };
1770
1770
  for (var F = 0; F < y.length; ++F) {
1771
- var R = y[F];
1772
- j[R] = J(R, w);
1771
+ var N = y[F];
1772
+ R[N] = B(N, w);
1773
1773
  }
1774
- return j;
1774
+ return R;
1775
1775
  };
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 = [
1776
+ function L(w, R) {
1777
+ R ? (x[0] = x[16] = x[1] = x[2] = x[3] = x[4] = x[5] = x[6] = x[7] = x[8] = x[9] = x[10] = x[11] = x[12] = x[13] = x[14] = x[15] = 0, this.blocks = x) : this.blocks = [
1778
1778
  0,
1779
1779
  0,
1780
1780
  0,
@@ -1794,11 +1794,11 @@ Os = us, function() {
1794
1794
  0
1795
1795
  ], w ? (this.h0 = 3238371032, this.h1 = 914150663, this.h2 = 812702999, this.h3 = 4144912697, this.h4 = 4290775857, this.h5 = 1750603025, this.h6 = 1694076839, this.h7 = 3204075428) : (this.h0 = 1779033703, this.h1 = 3144134277, this.h2 = 1013904242, this.h3 = 2773480762, this.h4 = 1359893119, this.h5 = 2600822924, this.h6 = 528734635, this.h7 = 1541459225), this.block = this.start = this.bytes = this.hBytes = 0, this.finalized = this.hashed = !1, this.first = !0, this.is224 = w;
1796
1796
  }
1797
- function Q(w, j, F) {
1798
- var R, P = typeof w;
1797
+ function ee(w, R, F) {
1798
+ var N, P = typeof w;
1799
1799
  if (P === "string") {
1800
1800
  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);
1801
+ for (N = 0; N < $; ++N) (U = w.charCodeAt(N)) < 128 ? q[V++] = U : U < 2048 ? (q[V++] = 192 | U >>> 6, q[V++] = 128 | 63 & U) : U < 55296 || U >= 57344 ? (q[V++] = 224 | U >>> 12, q[V++] = 128 | U >>> 6 & 63, q[V++] = 128 | 63 & U) : (U = 65536 + ((1023 & U) << 10 | 1023 & w.charCodeAt(++N)), q[V++] = 240 | U >>> 18, q[V++] = 128 | U >>> 12 & 63, q[V++] = 128 | U >>> 6 & 63, q[V++] = 128 | 63 & U);
1802
1802
  w = q;
1803
1803
  } else {
1804
1804
  if (P !== "object") throw new Error(r);
@@ -1806,27 +1806,27 @@ Os = us, function() {
1806
1806
  if (o && w.constructor === ArrayBuffer) w = new Uint8Array(w);
1807
1807
  else if (!(Array.isArray(w) || o && ArrayBuffer.isView(w))) throw new Error(r);
1808
1808
  }
1809
- w.length > 64 && (w = new L(j, !0).update(w).array());
1809
+ w.length > 64 && (w = new L(R, !0).update(w).array());
1810
1810
  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;
1811
+ for (N = 0; N < 64; ++N) {
1812
+ var ie = w[N] || 0;
1813
+ re[N] = 92 ^ ie, ne[N] = 54 ^ ie;
1814
1814
  }
1815
- L.call(this, j, F), this.update(ne), this.oKeyPad = re, this.inner = !0, this.sharedMemory = F;
1815
+ L.call(this, R, F), this.update(ne), this.oKeyPad = re, this.inner = !0, this.sharedMemory = F;
1816
1816
  }
1817
1817
  L.prototype.update = function(w) {
1818
1818
  if (!this.finalized) {
1819
- var j, F = typeof w;
1819
+ var R, F = typeof w;
1820
1820
  if (F !== "string") {
1821
1821
  if (F !== "object") throw new Error(r);
1822
1822
  if (w === null) throw new Error(r);
1823
1823
  if (o && w.constructor === ArrayBuffer) w = new Uint8Array(w);
1824
1824
  else if (!(Array.isArray(w) || o && ArrayBuffer.isView(w))) throw new Error(r);
1825
- j = !0;
1825
+ R = !0;
1826
1826
  }
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++]);
1827
+ for (var N, P, U = 0, q = w.length, $ = this.blocks; U < q; ) {
1828
+ if (this.hashed && (this.hashed = !1, $[0] = this.block, this.block = $[16] = $[1] = $[2] = $[3] = $[4] = $[5] = $[6] = $[7] = $[8] = $[9] = $[10] = $[11] = $[12] = $[13] = $[14] = $[15] = 0), R) for (P = this.start; U < q && P < 64; ++U) $[P >>> 2] |= w[U] << p[3 & P++];
1829
+ else for (P = this.start; U < q && P < 64; ++U) (N = w.charCodeAt(U)) < 128 ? $[P >>> 2] |= N << p[3 & P++] : N < 2048 ? ($[P >>> 2] |= (192 | N >>> 6) << p[3 & P++], $[P >>> 2] |= (128 | 63 & N) << p[3 & P++]) : N < 55296 || N >= 57344 ? ($[P >>> 2] |= (224 | N >>> 12) << p[3 & P++], $[P >>> 2] |= (128 | N >>> 6 & 63) << p[3 & P++], $[P >>> 2] |= (128 | 63 & N) << p[3 & P++]) : (N = 65536 + ((1023 & N) << 10 | 1023 & w.charCodeAt(++U)), $[P >>> 2] |= (240 | N >>> 18) << p[3 & P++], $[P >>> 2] |= (128 | N >>> 12 & 63) << p[3 & P++], $[P >>> 2] |= (128 | N >>> 6 & 63) << p[3 & P++], $[P >>> 2] |= (128 | 63 & N) << p[3 & P++]);
1830
1830
  this.lastByteIndex = P, this.bytes += P - this.start, P >= 64 ? (this.block = $[16], this.start = P - 64, this.hash(), this.hashed = !0) : this.start = P;
1831
1831
  }
1832
1832
  return this.bytes > 4294967295 && (this.hBytes += this.bytes / 4294967296 | 0, this.bytes = this.bytes % 4294967296), this;
@@ -1834,37 +1834,37 @@ Os = us, function() {
1834
1834
  }, L.prototype.finalize = function() {
1835
1835
  if (!this.finalized) {
1836
1836
  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();
1837
+ var w = this.blocks, R = this.lastByteIndex;
1838
+ w[16] = this.block, w[R >>> 2] |= d[3 & R], this.block = w[16], R >= 56 && (this.hashed || this.hash(), w[0] = this.block, w[16] = w[1] = w[2] = w[3] = w[4] = w[5] = w[6] = w[7] = w[8] = w[9] = w[10] = w[11] = w[12] = w[13] = w[14] = w[15] = 0), w[14] = this.hBytes << 3 | this.bytes >>> 29, w[15] = this.bytes << 3, this.hash();
1839
1839
  }
1840
1840
  }, 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;
1841
+ var w, R, F, N, P, U, q, $, V, re = this.h0, ne = this.h1, ie = this.h2, oe = this.h3, ue = this.h4, le = this.h5, X = this.h6, te = this.h7, ae = this.blocks;
1842
+ for (w = 16; w < 64; ++w) R = ((P = ae[w - 15]) >>> 7 | P << 25) ^ (P >>> 18 | P << 14) ^ P >>> 3, F = ((P = ae[w - 2]) >>> 17 | P << 15) ^ (P >>> 19 | P << 13) ^ P >>> 10, ae[w] = ae[w - 16] + R + ae[w - 7] + F | 0;
1843
+ for (V = ne & ie, w = 0; w < 64; w += 4) this.first ? (this.is224 ? (U = 300032, te = (P = ae[0] - 1413257819) - 150054599 | 0, oe = P + 24177077 | 0) : (U = 704751109, te = (P = ae[0] - 210244248) - 1521486534 | 0, oe = P + 143694565 | 0), this.first = !1) : (R = (re >>> 2 | re << 30) ^ (re >>> 13 | re << 19) ^ (re >>> 22 | re << 10), N = (U = re & ne) ^ re & ie ^ V, te = oe + (P = te + (F = (ue >>> 6 | ue << 26) ^ (ue >>> 11 | ue << 21) ^ (ue >>> 25 | ue << 7)) + (ue & le ^ ~ue & X) + g[w] + ae[w]) | 0, oe = P + (R + N) | 0), R = (oe >>> 2 | oe << 30) ^ (oe >>> 13 | oe << 19) ^ (oe >>> 22 | oe << 10), N = (q = oe & re) ^ oe & ne ^ U, X = ie + (P = X + (F = (te >>> 6 | te << 26) ^ (te >>> 11 | te << 21) ^ (te >>> 25 | te << 7)) + (te & ue ^ ~te & le) + g[w + 1] + ae[w + 1]) | 0, R = ((ie = P + (R + N) | 0) >>> 2 | ie << 30) ^ (ie >>> 13 | ie << 19) ^ (ie >>> 22 | ie << 10), N = ($ = ie & oe) ^ ie & re ^ q, le = ne + (P = le + (F = (X >>> 6 | X << 26) ^ (X >>> 11 | X << 21) ^ (X >>> 25 | X << 7)) + (X & te ^ ~X & ue) + g[w + 2] + ae[w + 2]) | 0, R = ((ne = P + (R + N) | 0) >>> 2 | ne << 30) ^ (ne >>> 13 | ne << 19) ^ (ne >>> 22 | ne << 10), N = (V = ne & ie) ^ ne & oe ^ $, ue = re + (P = ue + (F = (le >>> 6 | le << 26) ^ (le >>> 11 | le << 21) ^ (le >>> 25 | le << 7)) + (le & X ^ ~le & te) + g[w + 3] + ae[w + 3]) | 0, re = P + (R + N) | 0, this.chromeBugWorkAround = !0;
1844
1844
  this.h0 = this.h0 + re | 0, this.h1 = this.h1 + ne | 0, this.h2 = this.h2 + ie | 0, this.h3 = this.h3 + oe | 0, this.h4 = this.h4 + ue | 0, this.h5 = this.h5 + le | 0, this.h6 = this.h6 + X | 0, this.h7 = this.h7 + te | 0;
1845
1845
  }, L.prototype.hex = function() {
1846
1846
  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];
1847
+ var w = this.h0, R = this.h1, F = this.h2, N = this.h3, P = this.h4, U = this.h5, q = this.h6, $ = this.h7, V = a[w >>> 28 & 15] + a[w >>> 24 & 15] + a[w >>> 20 & 15] + a[w >>> 16 & 15] + a[w >>> 12 & 15] + a[w >>> 8 & 15] + a[w >>> 4 & 15] + a[15 & w] + a[R >>> 28 & 15] + a[R >>> 24 & 15] + a[R >>> 20 & 15] + a[R >>> 16 & 15] + a[R >>> 12 & 15] + a[R >>> 8 & 15] + a[R >>> 4 & 15] + a[15 & R] + a[F >>> 28 & 15] + a[F >>> 24 & 15] + a[F >>> 20 & 15] + a[F >>> 16 & 15] + a[F >>> 12 & 15] + a[F >>> 8 & 15] + a[F >>> 4 & 15] + a[15 & F] + a[N >>> 28 & 15] + a[N >>> 24 & 15] + a[N >>> 20 & 15] + a[N >>> 16 & 15] + a[N >>> 12 & 15] + a[N >>> 8 & 15] + a[N >>> 4 & 15] + a[15 & N] + a[P >>> 28 & 15] + a[P >>> 24 & 15] + a[P >>> 20 & 15] + a[P >>> 16 & 15] + a[P >>> 12 & 15] + a[P >>> 8 & 15] + a[P >>> 4 & 15] + a[15 & P] + a[U >>> 28 & 15] + a[U >>> 24 & 15] + a[U >>> 20 & 15] + a[U >>> 16 & 15] + a[U >>> 12 & 15] + a[U >>> 8 & 15] + a[U >>> 4 & 15] + a[15 & U] + a[q >>> 28 & 15] + a[q >>> 24 & 15] + a[q >>> 20 & 15] + a[q >>> 16 & 15] + a[q >>> 12 & 15] + a[q >>> 8 & 15] + a[q >>> 4 & 15] + a[15 & q];
1848
1848
  return this.is224 || (V += a[$ >>> 28 & 15] + a[$ >>> 24 & 15] + a[$ >>> 20 & 15] + a[$ >>> 16 & 15] + a[$ >>> 12 & 15] + a[$ >>> 8 & 15] + a[$ >>> 4 & 15] + a[15 & $]), V;
1849
1849
  }, L.prototype.toString = L.prototype.hex, L.prototype.digest = function() {
1850
1850
  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 = [
1851
+ var w = this.h0, R = this.h1, F = this.h2, N = this.h3, P = this.h4, U = this.h5, q = this.h6, $ = this.h7, V = [
1852
1852
  w >>> 24 & 255,
1853
1853
  w >>> 16 & 255,
1854
1854
  w >>> 8 & 255,
1855
1855
  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
1856
  R >>> 24 & 255,
1865
1857
  R >>> 16 & 255,
1866
1858
  R >>> 8 & 255,
1867
1859
  255 & R,
1860
+ F >>> 24 & 255,
1861
+ F >>> 16 & 255,
1862
+ F >>> 8 & 255,
1863
+ 255 & F,
1864
+ N >>> 24 & 255,
1865
+ N >>> 16 & 255,
1866
+ N >>> 8 & 255,
1867
+ 255 & N,
1868
1868
  P >>> 24 & 255,
1869
1869
  P >>> 16 & 255,
1870
1870
  P >>> 8 & 255,
@@ -1881,17 +1881,17 @@ Os = us, function() {
1881
1881
  return this.is224 || V.push($ >>> 24 & 255, $ >>> 16 & 255, $ >>> 8 & 255, 255 & $), V;
1882
1882
  }, L.prototype.array = L.prototype.digest, L.prototype.arrayBuffer = function() {
1883
1883
  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() {
1884
+ var w = new ArrayBuffer(this.is224 ? 28 : 32), R = new DataView(w);
1885
+ return R.setUint32(0, this.h0), R.setUint32(4, this.h1), R.setUint32(8, this.h2), R.setUint32(12, this.h3), R.setUint32(16, this.h4), R.setUint32(20, this.h5), R.setUint32(24, this.h6), this.is224 || R.setUint32(28, this.h7), w;
1886
+ }, ee.prototype = new L(), ee.prototype.finalize = function() {
1887
1887
  if (L.prototype.finalize.call(this), this.inner) {
1888
1888
  this.inner = !1;
1889
1889
  var w = this.array();
1890
1890
  L.call(this, this.is224, this.sharedMemory), this.update(this.oKeyPad), this.update(w), L.prototype.finalize.call(this);
1891
1891
  }
1892
1892
  };
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);
1893
+ var de = O();
1894
+ de.sha256 = de, de.sha224 = O(!0), de.sha256.hmac = Q(), de.sha224.hmac = Q(!0), n ? Os.exports = de : (t.sha256 = de.sha256, t.sha224 = de.sha224);
1895
1895
  }();
1896
1896
  us.exports;
1897
1897
  us.exports.sha224;
@@ -2006,7 +2006,7 @@ function En(r) {
2006
2006
  timeout: 5e3
2007
2007
  }, r);
2008
2008
  }
2009
- class Tt {
2009
+ class Mt {
2010
2010
  constructor(e, t) {
2011
2011
  h(this, "nc");
2012
2012
  h(this, "opts");
@@ -2033,14 +2033,14 @@ class Tt {
2033
2033
  const o = Xs();
2034
2034
  for (let a = 0; a < n; a++)
2035
2035
  try {
2036
- const f = await this.nc.request(e, i, s);
2037
- return this.parseJsResponse(f);
2038
- } catch (f) {
2039
- const p = f;
2036
+ const d = await this.nc.request(e, i, s);
2037
+ return this.parseJsResponse(d);
2038
+ } catch (d) {
2039
+ const p = d;
2040
2040
  if ((p.code === "503" || p.code === k.Timeout) && a + 1 < n)
2041
2041
  await dt(o.backoff(a));
2042
2042
  else
2043
- throw f;
2043
+ throw d;
2044
2044
  }
2045
2045
  }
2046
2046
  async findStream(e) {
@@ -2064,7 +2064,7 @@ class Tt {
2064
2064
  return t;
2065
2065
  }
2066
2066
  }
2067
- class At {
2067
+ class Pt {
2068
2068
  constructor(e, t, s, i) {
2069
2069
  h(this, "err");
2070
2070
  h(this, "offset");
@@ -2132,10 +2132,10 @@ function Ze(r = "") {
2132
2132
  function Ds(r, e) {
2133
2133
  return r.major < e.major ? -1 : r.major > e.major ? 1 : r.minor < e.minor ? -1 : r.minor > e.minor ? 1 : r.micro < e.micro ? -1 : r.micro > e.micro ? 1 : 0;
2134
2134
  }
2135
- var H;
2135
+ var J;
2136
2136
  (function(r) {
2137
2137
  r.JS_KV = "js_kv", r.JS_OBJECTSTORE = "js_objectstore", r.JS_PULL_MAX_BYTES = "js_pull_max_bytes", r.JS_NEW_CONSUMER_CREATE_API = "js_new_consumer_create", r.JS_ALLOW_DIRECT = "js_allow_direct", r.JS_MULTIPLE_CONSUMER_FILTER = "js_multiple_consumer_filter", r.JS_SIMPLIFICATION = "js_simplification", r.JS_STREAM_CONSUMER_METADATA = "js_stream_consumer_metadata", r.JS_CONSUMER_FILTER_SUBJECTS = "js_consumer_filter_subjects", r.JS_STREAM_FIRST_SEQ = "js_stream_first_seq", r.JS_STREAM_SUBJECT_TRANSFORM = "js_stream_subject_transform", r.JS_STREAM_SOURCE_SUBJECT_TRANSFORM = "js_stream_source_subject_transform", r.JS_STREAM_COMPRESSION = "js_stream_compression", r.JS_DEFAULT_CONSUMER_LIMITS = "js_default_consumer_limits", r.JS_BATCH_DIRECT_GET = "js_batch_direct_get";
2138
- })(H || (H = {}));
2138
+ })(J || (J = {}));
2139
2139
  class An {
2140
2140
  constructor(e) {
2141
2141
  h(this, "server");
@@ -2153,7 +2153,7 @@ class An {
2153
2153
  return this.disabled.indexOf(e) !== -1;
2154
2154
  }
2155
2155
  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) => {
2156
+ typeof e == "string" && (e = Ze(e)), this.server = e, this.set(J.JS_KV, "2.6.2"), this.set(J.JS_OBJECTSTORE, "2.6.3"), this.set(J.JS_PULL_MAX_BYTES, "2.8.3"), this.set(J.JS_NEW_CONSUMER_CREATE_API, "2.9.0"), this.set(J.JS_ALLOW_DIRECT, "2.9.0"), this.set(J.JS_MULTIPLE_CONSUMER_FILTER, "2.10.0"), this.set(J.JS_SIMPLIFICATION, "2.9.4"), this.set(J.JS_STREAM_CONSUMER_METADATA, "2.10.0"), this.set(J.JS_CONSUMER_FILTER_SUBJECTS, "2.10.0"), this.set(J.JS_STREAM_FIRST_SEQ, "2.10.0"), this.set(J.JS_STREAM_SUBJECT_TRANSFORM, "2.10.0"), this.set(J.JS_STREAM_SOURCE_SUBJECT_TRANSFORM, "2.10.0"), this.set(J.JS_STREAM_COMPRESSION, "2.10.0"), this.set(J.JS_DEFAULT_CONSUMER_LIMITS, "2.10.0"), this.set(J.JS_BATCH_DIRECT_GET, "2.11.0"), this.disabled.forEach((t) => {
2157
2157
  this.features.delete(t);
2158
2158
  });
2159
2159
  }
@@ -2177,7 +2177,7 @@ class An {
2177
2177
  return typeof e == "string" && (e = Ze(e)), Ds(this.server, e) >= 0;
2178
2178
  }
2179
2179
  }
2180
- class rs extends Tt {
2180
+ class rs extends Mt {
2181
2181
  constructor(e, t) {
2182
2182
  super(e, t);
2183
2183
  }
@@ -2189,26 +2189,26 @@ class rs extends Tt {
2189
2189
  const i = {};
2190
2190
  i.config = t, i.stream_name = e, i.action = s, i.config.durable_name && ot(i.config.durable_name);
2191
2191
  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)
2192
+ let { min: o, ok: a } = n.features.get(J.JS_NEW_CONSUMER_CREATE_API);
2193
+ const d = t.name === "" ? void 0 : t.name;
2194
+ if (d && !a)
2195
2195
  throw new Error(`consumer 'name' requires server ${o}`);
2196
- if (f)
2196
+ if (d)
2197
2197
  try {
2198
- hs("name", f);
2198
+ hs("name", d);
2199
2199
  } catch (x) {
2200
- const A = x.message, I = A.indexOf("cannot contain");
2201
- throw I !== -1 ? new Error(`consumer 'name' ${A.substring(I)}`) : x;
2200
+ const A = x.message, O = A.indexOf("cannot contain");
2201
+ throw O !== -1 ? new Error(`consumer 'name' ${A.substring(O)}`) : x;
2202
2202
  }
2203
2203
  let p, g = "";
2204
2204
  if (Array.isArray(t.filter_subjects)) {
2205
- const { min: x, ok: A } = n.features.get(H.JS_MULTIPLE_CONSUMER_FILTER);
2205
+ const { min: x, ok: A } = n.features.get(J.JS_MULTIPLE_CONSUMER_FILTER);
2206
2206
  if (!A)
2207
2207
  throw new Error(`consumer 'filter_subjects' requires server ${x}`);
2208
2208
  a = !1;
2209
2209
  }
2210
2210
  if (t.metadata) {
2211
- const { min: x, ok: A } = n.features.get(H.JS_STREAM_CONSUMER_METADATA);
2211
+ const { min: x, ok: A } = n.features.get(J.JS_STREAM_CONSUMER_METADATA);
2212
2212
  if (!A)
2213
2213
  throw new Error(`consumer 'metadata' requires server ${x}`);
2214
2214
  }
@@ -2232,7 +2232,7 @@ class rs extends Tt {
2232
2232
  list(e) {
2233
2233
  pe(e);
2234
2234
  const t = (i) => i.consumers, s = `${this.prefix}.CONSUMER.LIST.${e}`;
2235
- return new At(s, t, this);
2235
+ return new Pt(s, t, this);
2236
2236
  }
2237
2237
  pause(e, t, s) {
2238
2238
  const i = `${this.prefix}.CONSUMER.PAUSE.${e}.${t}`, n = {
@@ -2263,20 +2263,20 @@ class Pn extends he {
2263
2263
  if (i.callback) {
2264
2264
  const g = i.callback;
2265
2265
  n = (y, x) => {
2266
- const [A, I] = this.adapter(y, x);
2266
+ const [A, O] = this.adapter(y, x);
2267
2267
  if (A) {
2268
2268
  g(A, null);
2269
2269
  return;
2270
2270
  }
2271
- const { ingest: N } = this.ingestionFilterFn ? this.ingestionFilterFn(I, this) : {
2271
+ const { ingest: j } = this.ingestionFilterFn ? this.ingestionFilterFn(O, this) : {
2272
2272
  ingest: !0
2273
2273
  };
2274
- N && (!this.protocolFilterFn || this.protocolFilterFn(I)) && (g(A, I), this.dispatchedFn && I && this.dispatchedFn(I));
2274
+ j && (!this.protocolFilterFn || this.protocolFilterFn(O)) && (g(A, O), this.dispatchedFn && O && this.dispatchedFn(O));
2275
2275
  };
2276
2276
  }
2277
- const { max: o, queue: a, timeout: f } = i, p = {
2277
+ const { max: o, queue: a, timeout: d } = i, p = {
2278
2278
  queue: a,
2279
- timeout: f,
2279
+ timeout: d,
2280
2280
  callback: n
2281
2281
  };
2282
2282
  o && o > 0 && (p.max = o), this.sub = t.subscribe(s, p), i.cleanupFn && (this.sub.cleanupFn = i.cleanupFn), this.noIterator || this.iterClosed.then(() => {
@@ -2532,7 +2532,7 @@ function Hn(r) {
2532
2532
  port: t
2533
2533
  };
2534
2534
  }
2535
- class Ot {
2535
+ class Ct {
2536
2536
  constructor(e, t = !1) {
2537
2537
  h(this, "src");
2538
2538
  h(this, "listen");
@@ -2567,7 +2567,7 @@ class Ot {
2567
2567
  for (const i of s) {
2568
2568
  const n = this.port === 80 ? "https" : "http", o = new URL(`${n}://${Ks(i) ? "[" + i + "]" : i}`);
2569
2569
  o.port = `${this.port}`;
2570
- const a = new Ot(o.host, !1);
2570
+ const a = new Ct(o.host, !1);
2571
2571
  a.tlsName = this.hostname, t.push(a);
2572
2572
  }
2573
2573
  }
@@ -2584,7 +2584,7 @@ class Jn {
2584
2584
  this.firstSelect = !0, this.servers = [], this.tlsName = "", this.randomize = t.randomize || !1;
2585
2585
  const s = Cs();
2586
2586
  e && (e.forEach((i) => {
2587
- i = s ? s(i) : i, this.servers.push(new Ot(i));
2587
+ i = s ? s(i) : i, this.servers.push(new Ct(i));
2588
2588
  }), this.randomize && (this.servers = Qr(this.servers))), this.servers.length === 0 && this.addServer(`${Ms}:${ii()}`, !1), this.currentServer = this.servers[0];
2589
2589
  }
2590
2590
  clear() {
@@ -2602,7 +2602,7 @@ class Jn {
2602
2602
  addServer(e, t = !1) {
2603
2603
  const s = Cs();
2604
2604
  e = s ? s(e) : e;
2605
- const i = new Ot(e, t);
2605
+ const i = new Ct(e, t);
2606
2606
  Js(i.hostname) && (i.tlsName = this.tlsName), this.servers.push(i);
2607
2607
  }
2608
2608
  selectServer() {
@@ -2633,20 +2633,20 @@ class Jn {
2633
2633
  const s = [];
2634
2634
  let i = [];
2635
2635
  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);
2636
+ e.connect_urls && e.connect_urls.length > 0 && e.connect_urls.forEach((d) => {
2637
+ d = n ? n(d, t) : d;
2638
+ const p = new Ct(d, !0);
2639
+ o.set(d, p);
2640
2640
  });
2641
2641
  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);
2642
+ return this.servers.forEach((d, p) => {
2643
+ const g = d.listen;
2644
+ d.gossiped && this.currentServer.listen !== g && o.get(g) === void 0 && a.push(p), o.delete(g);
2645
+ }), a.reverse(), a.forEach((d) => {
2646
+ const p = this.servers.splice(d, 1);
2647
2647
  i = i.concat(p[0].listen);
2648
- }), o.forEach((f, p) => {
2649
- this.servers.push(f), s.push(p);
2648
+ }), o.forEach((d, p) => {
2649
+ this.servers.push(d), s.push(p);
2650
2650
  }), {
2651
2651
  added: s,
2652
2652
  deleted: i
@@ -2758,7 +2758,7 @@ function Vn(r, e = "Assertion failed.") {
2758
2758
  throw new Gn(e);
2759
2759
  }
2760
2760
  const Tr = 32 * 1024, Is = 2 ** 32 - 2;
2761
- function zt(r, e, t = 0) {
2761
+ function Gt(r, e, t = 0) {
2762
2762
  const s = e.byteLength - t;
2763
2763
  return r.byteLength > s && (r = r.subarray(0, s)), e.set(r, t), r.byteLength;
2764
2764
  }
@@ -2812,7 +2812,7 @@ class js {
2812
2812
  read(e) {
2813
2813
  if (this.empty())
2814
2814
  return this.reset(), e.byteLength === 0 ? 0 : null;
2815
- const t = zt(this._buf.subarray(this._off), e);
2815
+ const t = Gt(this._buf.subarray(this._off), e);
2816
2816
  return this._off += t, t;
2817
2817
  }
2818
2818
  writeByte(e) {
@@ -2823,7 +2823,7 @@ class js {
2823
2823
  }
2824
2824
  write(e) {
2825
2825
  const t = this._grow(e.byteLength);
2826
- return zt(e, this._buf, t);
2826
+ return Gt(e, this._buf, t);
2827
2827
  }
2828
2828
  _grow(e) {
2829
2829
  const t = this.length;
@@ -2833,13 +2833,13 @@ class js {
2833
2833
  return s;
2834
2834
  const i = this.capacity;
2835
2835
  if (e <= Math.floor(i / 2) - t)
2836
- zt(this._buf.subarray(this._off), this._buf);
2836
+ Gt(this._buf.subarray(this._off), this._buf);
2837
2837
  else {
2838
2838
  if (i + e > Is)
2839
2839
  throw new Error("The buffer cannot be grown beyond the maximum size.");
2840
2840
  {
2841
2841
  const n = new Uint8Array(Math.min(2 * i + e, Is));
2842
- zt(this._buf.subarray(this._off), n), this._buf = n;
2842
+ Gt(this._buf.subarray(this._off), n), this._buf = n;
2843
2843
  }
2844
2844
  }
2845
2845
  return this._off = 0, this._reslice(Math.min(t + e, Is)), t;
@@ -2880,105 +2880,105 @@ class Ur {
2880
2880
  h(this, "ma");
2881
2881
  h(this, "argBuf");
2882
2882
  h(this, "msgBuf");
2883
- this.dispatcher = e, this.state = O.OP_START, this.as = 0, this.drop = 0, this.hdr = 0;
2883
+ this.dispatcher = e, this.state = C.OP_START, this.as = 0, this.drop = 0, this.hdr = 0;
2884
2884
  }
2885
2885
  parse(e) {
2886
2886
  let t;
2887
2887
  for (t = 0; t < e.length; t++) {
2888
2888
  const s = e[t];
2889
2889
  switch (this.state) {
2890
- case O.OP_START:
2890
+ case C.OP_START:
2891
2891
  switch (s) {
2892
- case C.M:
2893
- case C.m:
2894
- this.state = O.OP_M, this.hdr = -1, this.ma = Mr();
2892
+ case I.M:
2893
+ case I.m:
2894
+ this.state = C.OP_M, this.hdr = -1, this.ma = Mr();
2895
2895
  break;
2896
- case C.H:
2897
- case C.h:
2898
- this.state = O.OP_H, this.hdr = 0, this.ma = Mr();
2896
+ case I.H:
2897
+ case I.h:
2898
+ this.state = C.OP_H, this.hdr = 0, this.ma = Mr();
2899
2899
  break;
2900
- case C.P:
2901
- case C.p:
2902
- this.state = O.OP_P;
2900
+ case I.P:
2901
+ case I.p:
2902
+ this.state = C.OP_P;
2903
2903
  break;
2904
- case C.PLUS:
2905
- this.state = O.OP_PLUS;
2904
+ case I.PLUS:
2905
+ this.state = C.OP_PLUS;
2906
2906
  break;
2907
- case C.MINUS:
2908
- this.state = O.OP_MINUS;
2907
+ case I.MINUS:
2908
+ this.state = C.OP_MINUS;
2909
2909
  break;
2910
- case C.I:
2911
- case C.i:
2912
- this.state = O.OP_I;
2910
+ case I.I:
2911
+ case I.i:
2912
+ this.state = C.OP_I;
2913
2913
  break;
2914
2914
  default:
2915
2915
  throw this.fail(e.subarray(t));
2916
2916
  }
2917
2917
  break;
2918
- case O.OP_H:
2918
+ case C.OP_H:
2919
2919
  switch (s) {
2920
- case C.M:
2921
- case C.m:
2922
- this.state = O.OP_M;
2920
+ case I.M:
2921
+ case I.m:
2922
+ this.state = C.OP_M;
2923
2923
  break;
2924
2924
  default:
2925
2925
  throw this.fail(e.subarray(t));
2926
2926
  }
2927
2927
  break;
2928
- case O.OP_M:
2928
+ case C.OP_M:
2929
2929
  switch (s) {
2930
- case C.S:
2931
- case C.s:
2932
- this.state = O.OP_MS;
2930
+ case I.S:
2931
+ case I.s:
2932
+ this.state = C.OP_MS;
2933
2933
  break;
2934
2934
  default:
2935
2935
  throw this.fail(e.subarray(t));
2936
2936
  }
2937
2937
  break;
2938
- case O.OP_MS:
2938
+ case C.OP_MS:
2939
2939
  switch (s) {
2940
- case C.G:
2941
- case C.g:
2942
- this.state = O.OP_MSG;
2940
+ case I.G:
2941
+ case I.g:
2942
+ this.state = C.OP_MSG;
2943
2943
  break;
2944
2944
  default:
2945
2945
  throw this.fail(e.subarray(t));
2946
2946
  }
2947
2947
  break;
2948
- case O.OP_MSG:
2948
+ case C.OP_MSG:
2949
2949
  switch (s) {
2950
- case C.SPACE:
2951
- case C.TAB:
2952
- this.state = O.OP_MSG_SPC;
2950
+ case I.SPACE:
2951
+ case I.TAB:
2952
+ this.state = C.OP_MSG_SPC;
2953
2953
  break;
2954
2954
  default:
2955
2955
  throw this.fail(e.subarray(t));
2956
2956
  }
2957
2957
  break;
2958
- case O.OP_MSG_SPC:
2958
+ case C.OP_MSG_SPC:
2959
2959
  switch (s) {
2960
- case C.SPACE:
2961
- case C.TAB:
2960
+ case I.SPACE:
2961
+ case I.TAB:
2962
2962
  continue;
2963
2963
  default:
2964
- this.state = O.MSG_ARG, this.as = t;
2964
+ this.state = C.MSG_ARG, this.as = t;
2965
2965
  }
2966
2966
  break;
2967
- case O.MSG_ARG:
2967
+ case C.MSG_ARG:
2968
2968
  switch (s) {
2969
- case C.CR:
2969
+ case I.CR:
2970
2970
  this.drop = 1;
2971
2971
  break;
2972
- case C.NL: {
2972
+ case I.NL: {
2973
2973
  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;
2974
+ this.processMsgArgs(i), this.drop = 0, this.as = t + 1, this.state = C.MSG_PAYLOAD, t = this.as + this.ma.size - 1;
2975
2975
  break;
2976
2976
  }
2977
2977
  default:
2978
2978
  this.argBuf && this.argBuf.writeByte(s);
2979
2979
  }
2980
2980
  break;
2981
- case O.MSG_PAYLOAD:
2981
+ case C.MSG_PAYLOAD:
2982
2982
  if (this.msgBuf)
2983
2983
  if (this.msgBuf.length >= this.ma.size) {
2984
2984
  const i = this.msgBuf.bytes({
@@ -2988,7 +2988,7 @@ class Ur {
2988
2988
  kind: me.MSG,
2989
2989
  msg: this.ma,
2990
2990
  data: i
2991
- }), this.argBuf = void 0, this.msgBuf = void 0, this.state = O.MSG_END;
2991
+ }), this.argBuf = void 0, this.msgBuf = void 0, this.state = C.MSG_END;
2992
2992
  } else {
2993
2993
  let i = this.ma.size - this.msgBuf.length;
2994
2994
  const n = e.length - t;
@@ -2998,244 +2998,244 @@ class Ur {
2998
2998
  kind: me.MSG,
2999
2999
  msg: this.ma,
3000
3000
  data: e.subarray(this.as, t)
3001
- }), this.argBuf = void 0, this.msgBuf = void 0, this.state = O.MSG_END);
3001
+ }), this.argBuf = void 0, this.msgBuf = void 0, this.state = C.MSG_END);
3002
3002
  break;
3003
- case O.MSG_END:
3003
+ case C.MSG_END:
3004
3004
  switch (s) {
3005
- case C.NL:
3006
- this.drop = 0, this.as = t + 1, this.state = O.OP_START;
3005
+ case I.NL:
3006
+ this.drop = 0, this.as = t + 1, this.state = C.OP_START;
3007
3007
  break;
3008
3008
  default:
3009
3009
  continue;
3010
3010
  }
3011
3011
  break;
3012
- case O.OP_PLUS:
3012
+ case C.OP_PLUS:
3013
3013
  switch (s) {
3014
- case C.O:
3015
- case C.o:
3016
- this.state = O.OP_PLUS_O;
3014
+ case I.O:
3015
+ case I.o:
3016
+ this.state = C.OP_PLUS_O;
3017
3017
  break;
3018
3018
  default:
3019
3019
  throw this.fail(e.subarray(t));
3020
3020
  }
3021
3021
  break;
3022
- case O.OP_PLUS_O:
3022
+ case C.OP_PLUS_O:
3023
3023
  switch (s) {
3024
- case C.K:
3025
- case C.k:
3026
- this.state = O.OP_PLUS_OK;
3024
+ case I.K:
3025
+ case I.k:
3026
+ this.state = C.OP_PLUS_OK;
3027
3027
  break;
3028
3028
  default:
3029
3029
  throw this.fail(e.subarray(t));
3030
3030
  }
3031
3031
  break;
3032
- case O.OP_PLUS_OK:
3032
+ case C.OP_PLUS_OK:
3033
3033
  switch (s) {
3034
- case C.NL:
3034
+ case I.NL:
3035
3035
  this.dispatcher.push({
3036
3036
  kind: me.OK
3037
- }), this.drop = 0, this.state = O.OP_START;
3037
+ }), this.drop = 0, this.state = C.OP_START;
3038
3038
  break;
3039
3039
  }
3040
3040
  break;
3041
- case O.OP_MINUS:
3041
+ case C.OP_MINUS:
3042
3042
  switch (s) {
3043
- case C.E:
3044
- case C.e:
3045
- this.state = O.OP_MINUS_E;
3043
+ case I.E:
3044
+ case I.e:
3045
+ this.state = C.OP_MINUS_E;
3046
3046
  break;
3047
3047
  default:
3048
3048
  throw this.fail(e.subarray(t));
3049
3049
  }
3050
3050
  break;
3051
- case O.OP_MINUS_E:
3051
+ case C.OP_MINUS_E:
3052
3052
  switch (s) {
3053
- case C.R:
3054
- case C.r:
3055
- this.state = O.OP_MINUS_ER;
3053
+ case I.R:
3054
+ case I.r:
3055
+ this.state = C.OP_MINUS_ER;
3056
3056
  break;
3057
3057
  default:
3058
3058
  throw this.fail(e.subarray(t));
3059
3059
  }
3060
3060
  break;
3061
- case O.OP_MINUS_ER:
3061
+ case C.OP_MINUS_ER:
3062
3062
  switch (s) {
3063
- case C.R:
3064
- case C.r:
3065
- this.state = O.OP_MINUS_ERR;
3063
+ case I.R:
3064
+ case I.r:
3065
+ this.state = C.OP_MINUS_ERR;
3066
3066
  break;
3067
3067
  default:
3068
3068
  throw this.fail(e.subarray(t));
3069
3069
  }
3070
3070
  break;
3071
- case O.OP_MINUS_ERR:
3071
+ case C.OP_MINUS_ERR:
3072
3072
  switch (s) {
3073
- case C.SPACE:
3074
- case C.TAB:
3075
- this.state = O.OP_MINUS_ERR_SPC;
3073
+ case I.SPACE:
3074
+ case I.TAB:
3075
+ this.state = C.OP_MINUS_ERR_SPC;
3076
3076
  break;
3077
3077
  default:
3078
3078
  throw this.fail(e.subarray(t));
3079
3079
  }
3080
3080
  break;
3081
- case O.OP_MINUS_ERR_SPC:
3081
+ case C.OP_MINUS_ERR_SPC:
3082
3082
  switch (s) {
3083
- case C.SPACE:
3084
- case C.TAB:
3083
+ case I.SPACE:
3084
+ case I.TAB:
3085
3085
  continue;
3086
3086
  default:
3087
- this.state = O.MINUS_ERR_ARG, this.as = t;
3087
+ this.state = C.MINUS_ERR_ARG, this.as = t;
3088
3088
  }
3089
3089
  break;
3090
- case O.MINUS_ERR_ARG:
3090
+ case C.MINUS_ERR_ARG:
3091
3091
  switch (s) {
3092
- case C.CR:
3092
+ case I.CR:
3093
3093
  this.drop = 1;
3094
3094
  break;
3095
- case C.NL: {
3095
+ case I.NL: {
3096
3096
  let i;
3097
3097
  this.argBuf ? (i = this.argBuf.bytes(), this.argBuf = void 0) : i = e.subarray(this.as, t - this.drop), this.dispatcher.push({
3098
3098
  kind: me.ERR,
3099
3099
  data: i
3100
- }), this.drop = 0, this.as = t + 1, this.state = O.OP_START;
3100
+ }), this.drop = 0, this.as = t + 1, this.state = C.OP_START;
3101
3101
  break;
3102
3102
  }
3103
3103
  default:
3104
3104
  this.argBuf && this.argBuf.write(Uint8Array.of(s));
3105
3105
  }
3106
3106
  break;
3107
- case O.OP_P:
3107
+ case C.OP_P:
3108
3108
  switch (s) {
3109
- case C.I:
3110
- case C.i:
3111
- this.state = O.OP_PI;
3109
+ case I.I:
3110
+ case I.i:
3111
+ this.state = C.OP_PI;
3112
3112
  break;
3113
- case C.O:
3114
- case C.o:
3115
- this.state = O.OP_PO;
3113
+ case I.O:
3114
+ case I.o:
3115
+ this.state = C.OP_PO;
3116
3116
  break;
3117
3117
  default:
3118
3118
  throw this.fail(e.subarray(t));
3119
3119
  }
3120
3120
  break;
3121
- case O.OP_PO:
3121
+ case C.OP_PO:
3122
3122
  switch (s) {
3123
- case C.N:
3124
- case C.n:
3125
- this.state = O.OP_PON;
3123
+ case I.N:
3124
+ case I.n:
3125
+ this.state = C.OP_PON;
3126
3126
  break;
3127
3127
  default:
3128
3128
  throw this.fail(e.subarray(t));
3129
3129
  }
3130
3130
  break;
3131
- case O.OP_PON:
3131
+ case C.OP_PON:
3132
3132
  switch (s) {
3133
- case C.G:
3134
- case C.g:
3135
- this.state = O.OP_PONG;
3133
+ case I.G:
3134
+ case I.g:
3135
+ this.state = C.OP_PONG;
3136
3136
  break;
3137
3137
  default:
3138
3138
  throw this.fail(e.subarray(t));
3139
3139
  }
3140
3140
  break;
3141
- case O.OP_PONG:
3141
+ case C.OP_PONG:
3142
3142
  switch (s) {
3143
- case C.NL:
3143
+ case I.NL:
3144
3144
  this.dispatcher.push({
3145
3145
  kind: me.PONG
3146
- }), this.drop = 0, this.state = O.OP_START;
3146
+ }), this.drop = 0, this.state = C.OP_START;
3147
3147
  break;
3148
3148
  }
3149
3149
  break;
3150
- case O.OP_PI:
3150
+ case C.OP_PI:
3151
3151
  switch (s) {
3152
- case C.N:
3153
- case C.n:
3154
- this.state = O.OP_PIN;
3152
+ case I.N:
3153
+ case I.n:
3154
+ this.state = C.OP_PIN;
3155
3155
  break;
3156
3156
  default:
3157
3157
  throw this.fail(e.subarray(t));
3158
3158
  }
3159
3159
  break;
3160
- case O.OP_PIN:
3160
+ case C.OP_PIN:
3161
3161
  switch (s) {
3162
- case C.G:
3163
- case C.g:
3164
- this.state = O.OP_PING;
3162
+ case I.G:
3163
+ case I.g:
3164
+ this.state = C.OP_PING;
3165
3165
  break;
3166
3166
  default:
3167
3167
  throw this.fail(e.subarray(t));
3168
3168
  }
3169
3169
  break;
3170
- case O.OP_PING:
3170
+ case C.OP_PING:
3171
3171
  switch (s) {
3172
- case C.NL:
3172
+ case I.NL:
3173
3173
  this.dispatcher.push({
3174
3174
  kind: me.PING
3175
- }), this.drop = 0, this.state = O.OP_START;
3175
+ }), this.drop = 0, this.state = C.OP_START;
3176
3176
  break;
3177
3177
  }
3178
3178
  break;
3179
- case O.OP_I:
3179
+ case C.OP_I:
3180
3180
  switch (s) {
3181
- case C.N:
3182
- case C.n:
3183
- this.state = O.OP_IN;
3181
+ case I.N:
3182
+ case I.n:
3183
+ this.state = C.OP_IN;
3184
3184
  break;
3185
3185
  default:
3186
3186
  throw this.fail(e.subarray(t));
3187
3187
  }
3188
3188
  break;
3189
- case O.OP_IN:
3189
+ case C.OP_IN:
3190
3190
  switch (s) {
3191
- case C.F:
3192
- case C.f:
3193
- this.state = O.OP_INF;
3191
+ case I.F:
3192
+ case I.f:
3193
+ this.state = C.OP_INF;
3194
3194
  break;
3195
3195
  default:
3196
3196
  throw this.fail(e.subarray(t));
3197
3197
  }
3198
3198
  break;
3199
- case O.OP_INF:
3199
+ case C.OP_INF:
3200
3200
  switch (s) {
3201
- case C.O:
3202
- case C.o:
3203
- this.state = O.OP_INFO;
3201
+ case I.O:
3202
+ case I.o:
3203
+ this.state = C.OP_INFO;
3204
3204
  break;
3205
3205
  default:
3206
3206
  throw this.fail(e.subarray(t));
3207
3207
  }
3208
3208
  break;
3209
- case O.OP_INFO:
3209
+ case C.OP_INFO:
3210
3210
  switch (s) {
3211
- case C.SPACE:
3212
- case C.TAB:
3213
- this.state = O.OP_INFO_SPC;
3211
+ case I.SPACE:
3212
+ case I.TAB:
3213
+ this.state = C.OP_INFO_SPC;
3214
3214
  break;
3215
3215
  default:
3216
3216
  throw this.fail(e.subarray(t));
3217
3217
  }
3218
3218
  break;
3219
- case O.OP_INFO_SPC:
3219
+ case C.OP_INFO_SPC:
3220
3220
  switch (s) {
3221
- case C.SPACE:
3222
- case C.TAB:
3221
+ case I.SPACE:
3222
+ case I.TAB:
3223
3223
  continue;
3224
3224
  default:
3225
- this.state = O.INFO_ARG, this.as = t;
3225
+ this.state = C.INFO_ARG, this.as = t;
3226
3226
  }
3227
3227
  break;
3228
- case O.INFO_ARG:
3228
+ case C.INFO_ARG:
3229
3229
  switch (s) {
3230
- case C.CR:
3230
+ case I.CR:
3231
3231
  this.drop = 1;
3232
3232
  break;
3233
- case C.NL: {
3233
+ case I.NL: {
3234
3234
  let i;
3235
3235
  this.argBuf ? (i = this.argBuf.bytes(), this.argBuf = void 0) : i = e.subarray(this.as, t - this.drop), this.dispatcher.push({
3236
3236
  kind: me.INFO,
3237
3237
  data: i
3238
- }), this.drop = 0, this.as = t + 1, this.state = O.OP_START;
3238
+ }), this.drop = 0, this.as = t + 1, this.state = C.OP_START;
3239
3239
  break;
3240
3240
  }
3241
3241
  default:
@@ -3246,7 +3246,7 @@ class Ur {
3246
3246
  throw this.fail(e.subarray(t));
3247
3247
  }
3248
3248
  }
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)));
3249
+ (this.state === C.MSG_ARG || this.state === C.MINUS_ERR_ARG || this.state === C.INFO_ARG) && !this.argBuf && (this.argBuf = new js(e.subarray(this.as, t - this.drop))), this.state === C.MSG_PAYLOAD && !this.msgBuf && (this.argBuf || this.cloneMsgArg(), this.msgBuf = new js(e.subarray(this.as)));
3250
3250
  }
3251
3251
  cloneMsgArg() {
3252
3252
  const e = this.ma.subject.length, t = this.ma.reply ? this.ma.reply.length : 0, s = new Uint8Array(e + t);
@@ -3259,10 +3259,10 @@ class Ur {
3259
3259
  let s = -1;
3260
3260
  for (let i = 0; i < e.length; i++)
3261
3261
  switch (e[i]) {
3262
- case C.SPACE:
3263
- case C.TAB:
3264
- case C.CR:
3265
- case C.NL:
3262
+ case I.SPACE:
3263
+ case I.TAB:
3264
+ case I.CR:
3265
+ case I.NL:
3266
3266
  s >= 0 && (t.push(e.subarray(s, i)), s = -1);
3267
3267
  break;
3268
3268
  default:
@@ -3291,10 +3291,10 @@ class Ur {
3291
3291
  let s = -1;
3292
3292
  for (let i = 0; i < e.length; i++)
3293
3293
  switch (e[i]) {
3294
- case C.SPACE:
3295
- case C.TAB:
3296
- case C.CR:
3297
- case C.NL:
3294
+ case I.SPACE:
3295
+ case I.TAB:
3296
+ case I.CR:
3297
+ case I.NL:
3298
3298
  s >= 0 && (t.push(e.subarray(s, i)), s = -1);
3299
3299
  break;
3300
3300
  default:
@@ -3329,14 +3329,14 @@ class Ur {
3329
3329
  return t;
3330
3330
  }
3331
3331
  }
3332
- var O;
3332
+ var C;
3333
3333
  (function(r) {
3334
3334
  r[r.OP_START = 0] = "OP_START", r[r.OP_PLUS = 1] = "OP_PLUS", r[r.OP_PLUS_O = 2] = "OP_PLUS_O", r[r.OP_PLUS_OK = 3] = "OP_PLUS_OK", r[r.OP_MINUS = 4] = "OP_MINUS", r[r.OP_MINUS_E = 5] = "OP_MINUS_E", r[r.OP_MINUS_ER = 6] = "OP_MINUS_ER", r[r.OP_MINUS_ERR = 7] = "OP_MINUS_ERR", r[r.OP_MINUS_ERR_SPC = 8] = "OP_MINUS_ERR_SPC", r[r.MINUS_ERR_ARG = 9] = "MINUS_ERR_ARG", r[r.OP_M = 10] = "OP_M", r[r.OP_MS = 11] = "OP_MS", r[r.OP_MSG = 12] = "OP_MSG", r[r.OP_MSG_SPC = 13] = "OP_MSG_SPC", r[r.MSG_ARG = 14] = "MSG_ARG", r[r.MSG_PAYLOAD = 15] = "MSG_PAYLOAD", r[r.MSG_END = 16] = "MSG_END", r[r.OP_H = 17] = "OP_H", r[r.OP_P = 18] = "OP_P", r[r.OP_PI = 19] = "OP_PI", r[r.OP_PIN = 20] = "OP_PIN", r[r.OP_PING = 21] = "OP_PING", r[r.OP_PO = 22] = "OP_PO", r[r.OP_PON = 23] = "OP_PON", r[r.OP_PONG = 24] = "OP_PONG", r[r.OP_I = 25] = "OP_I", r[r.OP_IN = 26] = "OP_IN", r[r.OP_INF = 27] = "OP_INF", r[r.OP_INFO = 28] = "OP_INFO", r[r.OP_INFO_SPC = 29] = "OP_INFO_SPC", r[r.INFO_ARG = 30] = "INFO_ARG";
3335
- })(O || (O = {}));
3336
- var C;
3335
+ })(C || (C = {}));
3336
+ var I;
3337
3337
  (function(r) {
3338
3338
  r[r.CR = 13] = "CR", r[r.E = 69] = "E", r[r.e = 101] = "e", r[r.F = 70] = "F", r[r.f = 102] = "f", r[r.G = 71] = "G", r[r.g = 103] = "g", r[r.H = 72] = "H", r[r.h = 104] = "h", r[r.I = 73] = "I", r[r.i = 105] = "i", r[r.K = 75] = "K", r[r.k = 107] = "k", r[r.M = 77] = "M", r[r.m = 109] = "m", r[r.MINUS = 45] = "MINUS", r[r.N = 78] = "N", r[r.n = 110] = "n", r[r.NL = 10] = "NL", r[r.O = 79] = "O", r[r.o = 111] = "o", r[r.P = 80] = "P", r[r.p = 112] = "p", r[r.PLUS = 43] = "PLUS", r[r.R = 82] = "R", r[r.r = 114] = "r", r[r.S = 83] = "S", r[r.s = 115] = "s", r[r.SPACE = 32] = "SPACE", r[r.TAB = 9] = "TAB";
3339
- })(C || (C = {}));
3339
+ })(I || (I = {}));
3340
3340
  (function(r) {
3341
3341
  var e = function(c, l) {
3342
3342
  this.hi = c | 0, this.lo = l | 0;
@@ -3350,7 +3350,7 @@ var C;
3350
3350
  n[0] = 9;
3351
3351
  var o = t(), a = t([
3352
3352
  1
3353
- ]), f = t([
3353
+ ]), d = t([
3354
3354
  56129,
3355
3355
  1
3356
3356
  ]), p = t([
@@ -3439,62 +3439,62 @@ var C;
3439
3439
  9344,
3440
3440
  11139
3441
3441
  ]);
3442
- function I(c, l) {
3442
+ function O(c, l) {
3443
3443
  return c << l | c >>> 32 - l;
3444
3444
  }
3445
- function N(c, l) {
3445
+ function j(c, l) {
3446
3446
  var u = c[l + 3] & 255;
3447
3447
  return u = u << 8 | c[l + 2] & 255, u = u << 8 | c[l + 1] & 255, u << 8 | c[l + 0] & 255;
3448
3448
  }
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);
3449
+ function B(c, l) {
3450
+ var u = c[l] << 24 | c[l + 1] << 16 | c[l + 2] << 8 | c[l + 3], f = c[l + 4] << 24 | c[l + 5] << 16 | c[l + 6] << 8 | c[l + 7];
3451
+ return new e(u, f);
3452
3452
  }
3453
- function ee(c, l, u) {
3454
- var d;
3455
- for (d = 0; d < 4; d++)
3456
- c[l + d] = u & 255, u >>>= 8;
3453
+ function Q(c, l, u) {
3454
+ var f;
3455
+ for (f = 0; f < 4; f++)
3456
+ c[l + f] = u & 255, u >>>= 8;
3457
3457
  }
3458
3458
  function L(c, l, u) {
3459
3459
  c[l] = u.hi >> 24 & 255, c[l + 1] = u.hi >> 16 & 255, c[l + 2] = u.hi >> 8 & 255, c[l + 3] = u.hi & 255, c[l + 4] = u.lo >> 24 & 255, c[l + 5] = u.lo >> 16 & 255, c[l + 6] = u.lo >> 8 & 255, c[l + 7] = u.lo & 255;
3460
3460
  }
3461
- function Q(c, l, u, d, m) {
3461
+ function ee(c, l, u, f, m) {
3462
3462
  var b, v = 0;
3463
- for (b = 0; b < m; b++) v |= c[l + b] ^ u[d + b];
3463
+ for (b = 0; b < m; b++) v |= c[l + b] ^ u[f + b];
3464
3464
  return (1 & v - 1 >>> 8) - 1;
3465
3465
  }
3466
- function de(c, l, u, d) {
3467
- return Q(c, l, u, d, 16);
3466
+ function de(c, l, u, f) {
3467
+ return ee(c, l, u, f, 16);
3468
3468
  }
3469
- function w(c, l, u, d) {
3470
- return Q(c, l, u, d, 32);
3469
+ function w(c, l, u, f) {
3470
+ return ee(c, l, u, f, 32);
3471
3471
  }
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;
3472
+ function R(c, l, u, f, m) {
3473
+ var b = new Uint32Array(16), v = new Uint32Array(16), E = new Uint32Array(16), _ = new Uint32Array(4), S, M, H;
3474
3474
  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);
3475
+ v[5 * S] = j(f, 4 * S), v[1 + S] = j(u, 4 * S), v[6 + S] = j(l, 4 * S), v[11 + S] = j(u, 16 + 4 * S);
3476
3476
  for (S = 0; S < 16; S++) E[S] = v[S];
3477
3477
  for (S = 0; S < 20; S++) {
3478
3478
  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];
3479
+ for (H = 0; H < 4; H++) _[H] = v[(5 * M + 4 * H) % 16];
3480
+ for (_[1] ^= O(_[0] + _[3] | 0, 7), _[2] ^= O(_[1] + _[0] | 0, 9), _[3] ^= O(_[2] + _[1] | 0, 13), _[0] ^= O(_[3] + _[2] | 0, 18), H = 0; H < 4; H++) b[4 * M + (M + H) % 4] = _[H];
3481
3481
  }
3482
- for (D = 0; D < 16; D++) v[D] = b[D];
3482
+ for (H = 0; H < 16; H++) v[H] = b[H];
3483
3483
  }
3484
3484
  if (m) {
3485
3485
  for (S = 0; S < 16; S++) v[S] = v[S] + E[S] | 0;
3486
3486
  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;
3487
+ v[5 * S] = v[5 * S] - j(f, 4 * S) | 0, v[6 + S] = v[6 + S] - j(l, 4 * S) | 0;
3488
3488
  for (S = 0; S < 4; S++)
3489
- ee(c, 4 * S, v[5 * S]), ee(c, 16 + 4 * S, v[6 + S]);
3489
+ Q(c, 4 * S, v[5 * S]), Q(c, 16 + 4 * S, v[6 + S]);
3490
3490
  } else
3491
- for (S = 0; S < 16; S++) ee(c, 4 * S, v[S] + E[S] | 0);
3491
+ for (S = 0; S < 16; S++) Q(c, 4 * S, v[S] + E[S] | 0);
3492
3492
  }
3493
- function F(c, l, u, d) {
3494
- return j(c, l, u, d, !1), 0;
3493
+ function F(c, l, u, f) {
3494
+ return R(c, l, u, f, !1), 0;
3495
3495
  }
3496
- function R(c, l, u, d) {
3497
- return j(c, l, u, d, !0), 0;
3496
+ function N(c, l, u, f) {
3497
+ return R(c, l, u, f, !0), 0;
3498
3498
  }
3499
3499
  var P = new Uint8Array([
3500
3500
  101,
@@ -3514,36 +3514,36 @@ var C;
3514
3514
  32,
3515
3515
  107
3516
3516
  ]);
3517
- function U(c, l, u, d, m, b, v) {
3517
+ function U(c, l, u, f, m, b, v) {
3518
3518
  var E = new Uint8Array(16), _ = new Uint8Array(64), S, M;
3519
3519
  if (!m) return 0;
3520
3520
  for (M = 0; M < 16; M++) E[M] = 0;
3521
3521
  for (M = 0; M < 8; M++) E[M] = b[M];
3522
3522
  for (; m >= 64; ) {
3523
- for (F(_, E, v, P), M = 0; M < 64; M++) c[l + M] = (u ? u[d + M] : 0) ^ _[M];
3523
+ for (F(_, E, v, P), M = 0; M < 64; M++) c[l + M] = (u ? u[f + M] : 0) ^ _[M];
3524
3524
  for (S = 1, M = 8; M < 16; M++)
3525
3525
  S = S + (E[M] & 255) | 0, E[M] = S & 255, S >>>= 8;
3526
- m -= 64, l += 64, u && (d += 64);
3526
+ m -= 64, l += 64, u && (f += 64);
3527
3527
  }
3528
3528
  if (m > 0)
3529
- for (F(_, E, v, P), M = 0; M < m; M++) c[l + M] = (u ? u[d + M] : 0) ^ _[M];
3529
+ for (F(_, E, v, P), M = 0; M < m; M++) c[l + M] = (u ? u[f + M] : 0) ^ _[M];
3530
3530
  return 0;
3531
3531
  }
3532
- function q(c, l, u, d, m) {
3533
- return U(c, l, null, 0, u, d, m);
3532
+ function q(c, l, u, f, m) {
3533
+ return U(c, l, null, 0, u, f, m);
3534
3534
  }
3535
- function $(c, l, u, d, m) {
3535
+ function $(c, l, u, f, m) {
3536
3536
  var b = new Uint8Array(32);
3537
- return R(b, d, m, P), q(c, l, u, d.subarray(16), b);
3537
+ return N(b, f, m, P), q(c, l, u, f.subarray(16), b);
3538
3538
  }
3539
- function V(c, l, u, d, m, b, v) {
3539
+ function V(c, l, u, f, m, b, v) {
3540
3540
  var E = new Uint8Array(32);
3541
- return R(E, b, v, P), U(c, l, u, d, m, b.subarray(16), E);
3541
+ return N(E, b, v, P), U(c, l, u, f, m, b.subarray(16), E);
3542
3542
  }
3543
3543
  function re(c, l) {
3544
- var u, d = 0;
3544
+ var u, f = 0;
3545
3545
  for (u = 0; u < 17; u++)
3546
- d = d + (c[u] + l[u] | 0) | 0, c[u] = d & 255, d >>>= 8;
3546
+ f = f + (c[u] + l[u] | 0) | 0, c[u] = f & 255, f >>>= 8;
3547
3547
  }
3548
3548
  var ne = new Uint32Array([
3549
3549
  5,
@@ -3564,15 +3564,15 @@ var C;
3564
3564
  0,
3565
3565
  252
3566
3566
  ]);
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; ) {
3567
+ function ie(c, l, u, f, m, b) {
3568
+ var v, E, _, S, M = new Uint32Array(17), H = new Uint32Array(17), Z = new Uint32Array(17), je = new Uint32Array(17), st = new Uint32Array(17);
3569
+ for (_ = 0; _ < 17; _++) H[_] = Z[_] = 0;
3570
+ for (_ = 0; _ < 16; _++) H[_] = b[_];
3571
+ for (H[3] &= 15, H[4] &= 252, H[7] &= 15, H[8] &= 252, H[11] &= 15, H[12] &= 252, H[15] &= 15; m > 0; ) {
3572
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;
3573
+ for (_ = 0; _ < 16 && _ < m; ++_) je[_] = u[f + _];
3574
+ for (je[_] = 1, f += _, m -= _, re(Z, je), E = 0; E < 17; E++)
3575
+ for (M[E] = 0, _ = 0; _ < 17; _++) M[E] = M[E] + Z[_] * (_ <= E ? H[E - _] : 320 * H[E + 17 - _] | 0) | 0 | 0;
3576
3576
  for (E = 0; E < 17; E++) Z[E] = M[E];
3577
3577
  for (S = 0, _ = 0; _ < 16; _++)
3578
3578
  S = S + Z[_] | 0, Z[_] = S & 255, S >>>= 8;
@@ -3586,20 +3586,20 @@ var C;
3586
3586
  for (je[16] = 0, re(Z, je), _ = 0; _ < 16; _++) c[l + _] = Z[_];
3587
3587
  return 0;
3588
3588
  }
3589
- function oe(c, l, u, d, m, b) {
3589
+ function oe(c, l, u, f, m, b) {
3590
3590
  var v = new Uint8Array(16);
3591
- return ie(v, 0, u, d, m, b), de(c, l, v, 0);
3591
+ return ie(v, 0, u, f, m, b), de(c, l, v, 0);
3592
3592
  }
3593
- function ue(c, l, u, d, m) {
3593
+ function ue(c, l, u, f, m) {
3594
3594
  var b;
3595
3595
  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;
3596
+ for (V(c, 0, l, 0, u, f, m), ie(c, 16, c, 32, u - 32, c), b = 0; b < 16; b++) c[b] = 0;
3597
3597
  return 0;
3598
3598
  }
3599
- function le(c, l, u, d, m) {
3599
+ function le(c, l, u, f, m) {
3600
3600
  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;
3601
+ if (u < 32 || ($(v, 0, 32, f, m), oe(l, 16, l, 32, u - 32, v) !== 0)) return -1;
3602
+ for (V(c, 0, l, 0, u, f, m), b = 0; b < 32; b++) c[b] = 0;
3603
3603
  return 0;
3604
3604
  }
3605
3605
  function X(c, l) {
@@ -3612,13 +3612,13 @@ var C;
3612
3612
  c[u] += 65536, l = Math.floor(c[u] / 65536), c[(u + 1) * (u < 15 ? 1 : 0)] += l - 1 + 37 * (l - 1) * (u === 15 ? 1 : 0), c[u] -= l * 65536;
3613
3613
  }
3614
3614
  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;
3615
+ for (var f, m = ~(u - 1), b = 0; b < 16; b++)
3616
+ f = m & (c[b] ^ l[b]), c[b] ^= f, l[b] ^= f;
3617
3617
  }
3618
3618
  function Qe(c, l) {
3619
- var u, d, m, b = t(), v = t();
3619
+ var u, f, m, b = t(), v = t();
3620
3620
  for (u = 0; u < 16; u++) v[u] = l[u];
3621
- for (te(v), te(v), te(v), d = 0; d < 2; d++) {
3621
+ for (te(v), te(v), te(v), f = 0; f < 2; f++) {
3622
3622
  for (b[0] = v[0] - 65517, u = 1; u < 15; u++)
3623
3623
  b[u] = v[u] - 65535 - (b[u - 1] >> 16 & 1), b[u - 1] &= 65535;
3624
3624
  b[15] = v[15] - 32767 - (b[14] >> 16 & 1), m = b[15] >> 16 & 1, b[14] &= 65535, ae(v, b, 1 - m);
@@ -3627,8 +3627,8 @@ var C;
3627
3627
  c[2 * u] = v[u] & 255, c[2 * u + 1] = v[u] >> 8;
3628
3628
  }
3629
3629
  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);
3630
+ var u = new Uint8Array(32), f = new Uint8Array(32);
3631
+ return Qe(u, c), Qe(f, l), w(u, 0, f, 0);
3632
3632
  }
3633
3633
  function or(c) {
3634
3634
  var l = new Uint8Array(32);
@@ -3640,110 +3640,110 @@ var C;
3640
3640
  c[15] &= 32767;
3641
3641
  }
3642
3642
  function Ce(c, l, u) {
3643
- var d;
3644
- for (d = 0; d < 16; d++) c[d] = l[d] + u[d] | 0;
3643
+ var f;
3644
+ for (f = 0; f < 16; f++) c[f] = l[f] + u[f] | 0;
3645
3645
  }
3646
3646
  function Ie(c, l, u) {
3647
- var d;
3648
- for (d = 0; d < 16; d++) c[d] = l[d] - u[d] | 0;
3647
+ var f;
3648
+ for (f = 0; f < 16; f++) c[f] = l[f] - u[f] | 0;
3649
3649
  }
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++)
3650
+ function D(c, l, u) {
3651
+ var f, m, b = new Float64Array(31);
3652
+ for (f = 0; f < 31; f++) b[f] = 0;
3653
+ for (f = 0; f < 16; f++)
3654
3654
  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];
3655
+ b[f + m] += l[f] * u[m];
3656
+ for (f = 0; f < 15; f++)
3657
+ b[f] += 38 * b[f + 16];
3658
+ for (f = 0; f < 16; f++) c[f] = b[f];
3659
3659
  te(c), te(c);
3660
3660
  }
3661
3661
  function Ee(c, l) {
3662
- B(c, l, l);
3662
+ D(c, l, l);
3663
3663
  }
3664
3664
  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];
3665
+ var u = t(), f;
3666
+ for (f = 0; f < 16; f++) u[f] = l[f];
3667
+ for (f = 253; f >= 0; f--)
3668
+ Ee(u, u), f !== 2 && f !== 4 && D(u, u, l);
3669
+ for (f = 0; f < 16; f++) c[f] = u[f];
3670
3670
  }
3671
3671
  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++)
3672
+ var u = t(), f;
3673
+ for (f = 0; f < 16; f++) u[f] = l[f];
3674
+ for (f = 250; f >= 0; f--)
3675
+ Ee(u, u), f !== 1 && D(u, u, l);
3676
+ for (f = 0; f < 16; f++) c[f] = u[f];
3677
+ }
3678
+ function $t(c, l, u) {
3679
+ var f = new Uint8Array(32), m = new Float64Array(80), b, v, E = t(), _ = t(), S = t(), M = t(), H = t(), Z = t();
3680
+ for (v = 0; v < 31; v++) f[v] = l[v];
3681
+ for (f[31] = l[31] & 127 | 64, f[0] &= 248, ds(m, u), v = 0; v < 16; v++)
3682
3682
  _[v] = m[v], M[v] = E[v] = S[v] = 0;
3683
3683
  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);
3684
+ b = f[v >>> 3] >>> (v & 7) & 1, ae(E, _, b), ae(S, M, b), Ce(H, E, S), Ie(E, E, S), Ce(S, _, M), Ie(_, _, M), Ee(M, H), Ee(Z, E), D(E, S, E), D(S, _, H), Ce(H, E, S), Ie(E, E, S), Ee(_, E), Ie(S, M, Z), D(E, S, d), Ce(E, E, M), D(S, S, E), D(E, M, Z), D(M, _, m), Ee(_, H), ae(E, _, b), ae(S, M, b);
3685
3685
  for (v = 0; v < 16; v++)
3686
3686
  m[v + 16] = E[v], m[v + 32] = S[v], m[v + 48] = _[v], m[v + 64] = M[v];
3687
3687
  var je = m.subarray(32), st = m.subarray(16);
3688
- return ar(je, je), B(st, st, je), Qe(c, st), 0;
3688
+ return ar(je, je), D(st, st, je), Qe(c, st), 0;
3689
3689
  }
3690
- function $t(c, l) {
3691
- return Ut(c, l, n);
3690
+ function Lt(c, l) {
3691
+ return $t(c, l, n);
3692
3692
  }
3693
3693
  function hr(c, l) {
3694
- return s(l, 32), $t(c, l);
3694
+ return s(l, 32), Lt(c, l);
3695
3695
  }
3696
- function Lt(c, l, u) {
3697
- var d = new Uint8Array(32);
3698
- return Ut(d, u, l), R(c, i, d, P);
3696
+ function qt(c, l, u) {
3697
+ var f = new Uint8Array(32);
3698
+ return $t(f, u, l), N(c, i, f, P);
3699
3699
  }
3700
3700
  var ur = ue, wi = le;
3701
- function xi(c, l, u, d, m, b) {
3701
+ function xi(c, l, u, f, m, b) {
3702
3702
  var v = new Uint8Array(32);
3703
- return Lt(v, m, b), ur(c, l, u, d, v);
3703
+ return qt(v, m, b), ur(c, l, u, f, v);
3704
3704
  }
3705
- function Si(c, l, u, d, m, b) {
3705
+ function Si(c, l, u, f, m, b) {
3706
3706
  var v = new Uint8Array(32);
3707
- return Lt(v, m, b), wi(c, l, u, d, v);
3707
+ return qt(v, m, b), wi(c, l, u, f, v);
3708
3708
  }
3709
3709
  function pt() {
3710
- var c = 0, l = 0, u = 0, d = 0, m = 65535, b, v, E;
3710
+ var c = 0, l = 0, u = 0, f = 0, m = 65535, b, v, E;
3711
3711
  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);
3712
+ b = arguments[E].lo, v = arguments[E].hi, c += b & m, l += b >>> 16, u += v & m, f += v >>> 16;
3713
+ return l += c >>> 16, u += l >>> 16, f += u >>> 16, new e(u & m | f << 16, c & m | l << 16);
3714
3714
  }
3715
3715
  function lr(c, l) {
3716
3716
  return new e(c.hi >>> l, c.lo >>> l | c.hi << 32 - l);
3717
3717
  }
3718
- function qt() {
3718
+ function Ft() {
3719
3719
  var c = 0, l = 0, u;
3720
3720
  for (u = 0; u < arguments.length; u++)
3721
3721
  c ^= arguments[u].lo, l ^= arguments[u].hi;
3722
3722
  return new e(l, c);
3723
3723
  }
3724
3724
  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);
3725
+ var u, f, m = 32 - l;
3726
+ return l < 32 ? (u = c.hi >>> l | c.lo << m, f = c.lo >>> l | c.hi << m) : l < 64 && (u = c.lo >>> l | c.hi << m, f = c.hi >>> l | c.lo << m), new e(u, f);
3727
3727
  }
3728
3728
  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);
3729
+ var f = c.hi & l.hi ^ ~c.hi & u.hi, m = c.lo & l.lo ^ ~c.lo & u.lo;
3730
+ return new e(f, m);
3731
3731
  }
3732
3732
  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);
3733
+ var f = c.hi & l.hi ^ c.hi & u.hi ^ l.hi & u.hi, m = c.lo & l.lo ^ c.lo & u.lo ^ l.lo & u.lo;
3734
+ return new e(f, m);
3735
3735
  }
3736
3736
  function Ai(c) {
3737
- return qt(Te(c, 28), Te(c, 34), Te(c, 39));
3737
+ return Ft(Te(c, 28), Te(c, 34), Te(c, 39));
3738
3738
  }
3739
3739
  function Pi(c) {
3740
- return qt(Te(c, 14), Te(c, 18), Te(c, 41));
3740
+ return Ft(Te(c, 14), Te(c, 18), Te(c, 41));
3741
3741
  }
3742
3742
  function ki(c) {
3743
- return qt(Te(c, 1), Te(c, 8), lr(c, 7));
3743
+ return Ft(Te(c, 1), Te(c, 8), lr(c, 7));
3744
3744
  }
3745
3745
  function Oi(c) {
3746
- return qt(Te(c, 19), Te(c, 61), lr(c, 6));
3746
+ return Ft(Te(c, 19), Te(c, 61), lr(c, 6));
3747
3747
  }
3748
3748
  var Ci = [
3749
3749
  new e(1116352408, 3609767458),
@@ -3828,10 +3828,10 @@ var C;
3828
3828
  new e(1816402316, 1246189591)
3829
3829
  ];
3830
3830
  function fr(c, l, u) {
3831
- var d = [], m = [], b = [], v = [], E, _, S;
3832
- for (_ = 0; _ < 8; _++) d[_] = b[_] = J(c, 8 * _);
3831
+ var f = [], m = [], b = [], v = [], E, _, S;
3832
+ for (_ = 0; _ < 8; _++) f[_] = b[_] = B(c, 8 * _);
3833
3833
  for (var M = 0; u >= 128; ) {
3834
- for (_ = 0; _ < 16; _++) v[_] = J(l, 8 * _ + M);
3834
+ for (_ = 0; _ < 16; _++) v[_] = B(l, 8 * _ + M);
3835
3835
  for (_ = 0; _ < 80; _++) {
3836
3836
  for (S = 0; S < 8; S++) m[S] = b[S];
3837
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];
@@ -3840,10 +3840,10 @@ var C;
3840
3840
  v[S] = pt(v[S], v[(S + 9) % 16], ki(v[(S + 1) % 16]), Oi(v[(S + 14) % 16]));
3841
3841
  }
3842
3842
  for (_ = 0; _ < 8; _++)
3843
- b[_] = pt(b[_], d[_]), d[_] = b[_];
3843
+ b[_] = pt(b[_], f[_]), f[_] = b[_];
3844
3844
  M += 128, u -= 128;
3845
3845
  }
3846
- for (_ = 0; _ < 8; _++) L(c, 8 * _, d[_]);
3846
+ for (_ = 0; _ < 8; _++) L(c, 8 * _, f[_]);
3847
3847
  return u;
3848
3848
  }
3849
3849
  var Ii = new Uint8Array([
@@ -3913,51 +3913,51 @@ var C;
3913
3913
  121
3914
3914
  ]);
3915
3915
  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;
3916
+ var f = new Uint8Array(64), m = new Uint8Array(256), b, v = u;
3917
+ for (b = 0; b < 64; b++) f[b] = Ii[b];
3918
+ for (fr(f, l, u), u %= 128, b = 0; b < 256; b++) m[b] = 0;
3919
3919
  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];
3920
+ for (m[u] = 128, u = 256 - 128 * (u < 112 ? 1 : 0), m[u - 9] = 0, L(m, u - 8, new e(v / 536870912 | 0, v << 3)), fr(f, m, u), b = 0; b < 64; b++) c[b] = f[b];
3921
3921
  return 0;
3922
3922
  }
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);
3923
+ function Bt(c, l) {
3924
+ var u = t(), f = t(), m = t(), b = t(), v = t(), E = t(), _ = t(), S = t(), M = t();
3925
+ Ie(u, c[1], c[0]), Ie(M, l[1], l[0]), D(u, u, M), Ce(f, c[0], c[1]), Ce(M, l[0], l[1]), D(f, f, M), D(m, c[3], l[3]), D(m, m, g), D(b, c[2], l[2]), Ce(b, b, b), Ie(v, f, u), Ie(E, b, m), Ce(_, b, m), Ce(S, f, u), D(c[0], v, E), D(c[1], S, _), D(c[2], _, E), D(c[3], v, S);
3926
3926
  }
3927
3927
  function dr(c, l, u) {
3928
- var d;
3929
- for (d = 0; d < 4; d++)
3930
- ae(c[d], l[d], u);
3928
+ var f;
3929
+ for (f = 0; f < 4; f++)
3930
+ ae(c[f], l[f], u);
3931
3931
  }
3932
3932
  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;
3933
+ var u = t(), f = t(), m = t();
3934
+ ar(m, l[2]), D(u, l[0], m), D(f, l[1], m), Qe(c, f), c[31] ^= or(u) << 7;
3935
3935
  }
3936
3936
  function ms(c, l, u) {
3937
- var d, m;
3937
+ var f, m;
3938
3938
  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);
3939
+ f = u[m / 8 | 0] >> (m & 7) & 1, dr(c, l, f), Bt(l, c), Bt(c, c), dr(c, l, f);
3940
3940
  }
3941
- function Bt(c, l) {
3941
+ function Dt(c, l) {
3942
3942
  var u = [
3943
3943
  t(),
3944
3944
  t(),
3945
3945
  t(),
3946
3946
  t()
3947
3947
  ];
3948
- X(u[0], y), X(u[1], x), X(u[2], a), B(u[3], y, x), ms(c, u, l);
3948
+ X(u[0], y), X(u[1], x), X(u[2], a), D(u[3], y, x), ms(c, u, l);
3949
3949
  }
3950
3950
  function bs(c, l, u) {
3951
- var d = new Uint8Array(64), m = [
3951
+ var f = new Uint8Array(64), m = [
3952
3952
  t(),
3953
3953
  t(),
3954
3954
  t(),
3955
3955
  t()
3956
3956
  ], 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];
3957
+ for (u || s(l, 32), Ye(f, l, 32), f[0] &= 248, f[31] &= 127, f[31] |= 64, Dt(m, f), ps(c, m), b = 0; b < 32; b++) l[b + 32] = c[b];
3958
3958
  return 0;
3959
3959
  }
3960
- var Dt = new Float64Array([
3960
+ var Ht = new Float64Array([
3961
3961
  237,
3962
3962
  211,
3963
3963
  245,
@@ -3992,17 +3992,17 @@ var C;
3992
3992
  16
3993
3993
  ]);
3994
3994
  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;
3995
+ var u, f, m, b;
3996
+ for (f = 63; f >= 32; --f) {
3997
+ for (u = 0, m = f - 32, b = f - 12; m < b; ++m)
3998
+ l[m] += u - 16 * l[f] * Ht[m - (f - 32)], u = Math.floor((l[m] + 128) / 256), l[m] -= u * 256;
3999
+ l[m] += u, l[f] = 0;
4000
4000
  }
4001
4001
  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;
4002
+ l[m] += u - (l[31] >> 4) * Ht[m], u = l[m] >> 8, l[m] &= 255;
4003
+ for (m = 0; m < 32; m++) l[m] -= u * Ht[m];
4004
+ for (f = 0; f < 32; f++)
4005
+ l[f + 1] += l[f] >> 8, c[f] = l[f] & 255;
4006
4006
  }
4007
4007
  function _s(c) {
4008
4008
  var l = new Float64Array(64), u;
@@ -4010,30 +4010,30 @@ var C;
4010
4010
  for (u = 0; u < 64; u++) c[u] = 0;
4011
4011
  gs(c, l);
4012
4012
  }
4013
- function pr(c, l, u, d) {
4013
+ function pr(c, l, u, f) {
4014
4014
  var m = new Uint8Array(64), b = new Uint8Array(64), v = new Uint8Array(64), E, _, S = new Float64Array(64), M = [
4015
4015
  t(),
4016
4016
  t(),
4017
4017
  t(),
4018
4018
  t()
4019
4019
  ];
4020
- Ye(m, d, 32), m[0] &= 248, m[31] &= 127, m[31] |= 64;
4021
- var D = u + 64;
4020
+ Ye(m, f, 32), m[0] &= 248, m[31] &= 127, m[31] |= 64;
4021
+ var H = u + 64;
4022
4022
  for (E = 0; E < u; E++) c[64 + E] = l[E];
4023
4023
  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];
4024
+ for (Ye(v, c.subarray(32), u + 32), _s(v), Dt(M, v), ps(c, M), E = 32; E < 64; E++) c[E] = f[E];
4025
4025
  for (Ye(b, c, u + 64), _s(b), E = 0; E < 64; E++) S[E] = 0;
4026
4026
  for (E = 0; E < 32; E++) S[E] = v[E];
4027
4027
  for (E = 0; E < 32; E++)
4028
4028
  for (_ = 0; _ < 32; _++)
4029
4029
  S[E + _] += b[E] * m[_];
4030
- return gs(c.subarray(32), S), D;
4030
+ return gs(c.subarray(32), S), H;
4031
4031
  }
4032
4032
  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);
4033
+ var u = t(), f = t(), m = t(), b = t(), v = t(), E = t(), _ = t();
4034
+ return X(c[2], a), ds(c[1], l), Ee(m, c[1]), D(b, m, p), Ie(m, m, c[2]), Ce(b, c[2], b), Ee(v, b), Ee(E, v), D(_, E, v), D(u, _, m), D(u, u, b), cr(u, u), D(u, u, m), D(u, u, b), D(u, u, b), D(c[0], u, b), Ee(f, c[0]), D(f, f, b), nr(f, m) && D(c[0], c[0], A), Ee(f, c[0]), D(f, f, b), nr(f, m) ? -1 : (or(c[0]) === l[31] >> 7 && Ie(c[0], o, c[0]), D(c[3], c[0], c[1]), 0);
4035
4035
  }
4036
- function ys(c, l, u, d) {
4036
+ function ys(c, l, u, f) {
4037
4037
  var m, b = new Uint8Array(32), v = new Uint8Array(64), E = [
4038
4038
  t(),
4039
4039
  t(),
@@ -4045,19 +4045,19 @@ var C;
4045
4045
  t(),
4046
4046
  t()
4047
4047
  ];
4048
- if (u < 64 || ji(_, d)) return -1;
4048
+ if (u < 64 || ji(_, f)) return -1;
4049
4049
  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)) {
4050
+ for (m = 0; m < 32; m++) c[m + 32] = f[m];
4051
+ if (Ye(v, c, u), _s(v), ms(E, _, v), Dt(_, l.subarray(32)), Bt(E, _), ps(b, E), u -= 64, w(l, 0, b, 0)) {
4052
4052
  for (m = 0; m < u; m++) c[m] = 0;
4053
4053
  return -1;
4054
4054
  }
4055
4055
  for (m = 0; m < u; m++) c[m] = l[m + 64];
4056
4056
  return u;
4057
4057
  }
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;
4058
+ var ws = 32, Jt = 24, mt = 32, et = 16, bt = 32, Kt = 32, gt = 32, _t = 32, xs = 32, mr = Jt, Ri = mt, Ni = et, Le = 64, Xe = 32, tt = 64, Ss = 32, vs = 64;
4059
4059
  r.lowlevel = {
4060
- crypto_core_hsalsa20: R,
4060
+ crypto_core_hsalsa20: N,
4061
4061
  crypto_stream_xor: V,
4062
4062
  crypto_stream: $,
4063
4063
  crypto_stream_salsa20_xor: U,
@@ -4068,9 +4068,9 @@ var C;
4068
4068
  crypto_verify_32: w,
4069
4069
  crypto_secretbox: ue,
4070
4070
  crypto_secretbox_open: le,
4071
- crypto_scalarmult: Ut,
4072
- crypto_scalarmult_base: $t,
4073
- crypto_box_beforenm: Lt,
4071
+ crypto_scalarmult: $t,
4072
+ crypto_scalarmult_base: Lt,
4073
+ crypto_box_beforenm: qt,
4074
4074
  crypto_box_afternm: ur,
4075
4075
  crypto_box: xi,
4076
4076
  crypto_box_open: Si,
@@ -4080,11 +4080,11 @@ var C;
4080
4080
  crypto_sign_keypair: bs,
4081
4081
  crypto_sign_open: ys,
4082
4082
  crypto_secretbox_KEYBYTES: ws,
4083
- crypto_secretbox_NONCEBYTES: Ht,
4083
+ crypto_secretbox_NONCEBYTES: Jt,
4084
4084
  crypto_secretbox_ZEROBYTES: mt,
4085
4085
  crypto_secretbox_BOXZEROBYTES: et,
4086
4086
  crypto_scalarmult_BYTES: bt,
4087
- crypto_scalarmult_SCALARBYTES: Jt,
4087
+ crypto_scalarmult_SCALARBYTES: Kt,
4088
4088
  crypto_box_PUBLICKEYBYTES: gt,
4089
4089
  crypto_box_SECRETKEYBYTES: _t,
4090
4090
  crypto_box_BEFORENMBYTES: xs,
@@ -4098,23 +4098,23 @@ var C;
4098
4098
  crypto_hash_BYTES: vs,
4099
4099
  gf: t,
4100
4100
  D: p,
4101
- L: Dt,
4101
+ L: Ht,
4102
4102
  pack25519: Qe,
4103
4103
  unpack25519: ds,
4104
- M: B,
4104
+ M: D,
4105
4105
  A: Ce,
4106
4106
  S: Ee,
4107
4107
  Z: Ie,
4108
4108
  pow2523: cr,
4109
- add: Ft,
4109
+ add: Bt,
4110
4110
  set25519: X,
4111
4111
  modL: gs,
4112
4112
  scalarmult: ms,
4113
- scalarbase: Bt
4113
+ scalarbase: Dt
4114
4114
  };
4115
4115
  function br(c, l) {
4116
4116
  if (c.length !== ws) throw new Error("bad key size");
4117
- if (l.length !== Ht) throw new Error("bad nonce size");
4117
+ if (l.length !== Jt) throw new Error("bad nonce size");
4118
4118
  }
4119
4119
  function Ti(c, l) {
4120
4120
  if (c.length !== gt) throw new Error("bad public key size");
@@ -4132,30 +4132,30 @@ var C;
4132
4132
  return s(l, c), l;
4133
4133
  }, r.secretbox = function(c, l, u) {
4134
4134
  _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);
4135
+ for (var f = new Uint8Array(mt + c.length), m = new Uint8Array(f.length), b = 0; b < c.length; b++) f[b + mt] = c[b];
4136
+ return ue(m, f, f.length, l, u), m.subarray(et);
4137
4137
  }, r.secretbox.open = function(c, l, u) {
4138
4138
  _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");
4139
+ for (var f = new Uint8Array(et + c.length), m = new Uint8Array(f.length), b = 0; b < c.length; b++) f[b + et] = c[b];
4140
+ return f.length < 32 || le(m, f, f.length, l, u) !== 0 ? null : m.subarray(mt);
4141
+ }, r.secretbox.keyLength = ws, r.secretbox.nonceLength = Jt, r.secretbox.overheadLength = et, r.scalarMult = function(c, l) {
4142
+ if (_e(c, l), c.length !== Kt) throw new Error("bad n size");
4143
4143
  if (l.length !== bt) throw new Error("bad p size");
4144
4144
  var u = new Uint8Array(bt);
4145
- return Ut(u, c, l), u;
4145
+ return $t(u, c, l), u;
4146
4146
  }, r.scalarMult.base = function(c) {
4147
- if (_e(c), c.length !== Jt) throw new Error("bad n size");
4147
+ if (_e(c), c.length !== Kt) throw new Error("bad n size");
4148
4148
  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);
4149
+ return Lt(l, c), l;
4150
+ }, r.scalarMult.scalarLength = Kt, r.scalarMult.groupElementLength = bt, r.box = function(c, l, u, f) {
4151
+ var m = r.box.before(u, f);
4152
4152
  return r.secretbox(c, l, m);
4153
4153
  }, r.box.before = function(c, l) {
4154
4154
  _e(c, l), Ti(c, l);
4155
4155
  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);
4156
+ return qt(u, c, l), u;
4157
+ }, r.box.after = r.secretbox, r.box.open = function(c, l, u, f) {
4158
+ var m = r.box.before(u, f);
4159
4159
  return r.secretbox.open(c, l, m);
4160
4160
  }, r.box.open.after = r.secretbox.open, r.box.keyPair = function() {
4161
4161
  var c = new Uint8Array(gt), l = new Uint8Array(_t);
@@ -4166,7 +4166,7 @@ var C;
4166
4166
  }, r.box.keyPair.fromSecretKey = function(c) {
4167
4167
  if (_e(c), c.length !== _t) throw new Error("bad secret key size");
4168
4168
  var l = new Uint8Array(gt);
4169
- return $t(l, c), {
4169
+ return Lt(l, c), {
4170
4170
  publicKey: l,
4171
4171
  secretKey: new Uint8Array(c)
4172
4172
  };
@@ -4176,20 +4176,20 @@ var C;
4176
4176
  return pr(u, c, c.length, l), u;
4177
4177
  }, r.sign.open = function(c, l) {
4178
4178
  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];
4179
+ var u = new Uint8Array(c.length), f = ys(u, c, c.length, l);
4180
+ if (f < 0) return null;
4181
+ for (var m = new Uint8Array(f), b = 0; b < m.length; b++) m[b] = u[b];
4182
4182
  return m;
4183
4183
  }, 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;
4184
+ for (var u = r.sign(c, l), f = new Uint8Array(Le), m = 0; m < f.length; m++) f[m] = u[m];
4185
+ return f;
4186
4186
  }, r.sign.detached.verify = function(c, l, u) {
4187
4187
  if (_e(c, l, u), l.length !== Le) throw new Error("bad signature size");
4188
4188
  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;
4189
+ var f = new Uint8Array(Le + c.length), m = new Uint8Array(Le + c.length), b;
4190
+ for (b = 0; b < Le; b++) f[b] = l[b];
4191
+ for (b = 0; b < c.length; b++) f[b + Le] = c[b];
4192
+ return ys(m, f, f.length, u) >= 0;
4193
4193
  }, r.sign.keyPair = function() {
4194
4194
  var c = new Uint8Array(Xe), l = new Uint8Array(tt);
4195
4195
  return bs(c, l), {
@@ -4205,7 +4205,7 @@ var C;
4205
4205
  };
4206
4206
  }, r.sign.keyPair.fromSeed = function(c) {
4207
4207
  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];
4208
+ for (var l = new Uint8Array(Xe), u = new Uint8Array(tt), f = 0; f < 32; f++) u[f] = c[f];
4209
4209
  return bs(l, u, !0), {
4210
4210
  publicKey: l,
4211
4211
  secretKey: u
@@ -4215,32 +4215,32 @@ var C;
4215
4215
  var l = new Uint8Array(vs);
4216
4216
  return Ye(l, c, c.length), l;
4217
4217
  }, 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;
4218
+ return _e(c, l), c.length === 0 || l.length === 0 || c.length !== l.length ? !1 : ee(c, 0, l, 0, c.length) === 0;
4219
4219
  }, r.setPRNG = function(c) {
4220
4220
  s = c;
4221
4221
  }, function() {
4222
4222
  var c = typeof globalThis < "u" ? globalThis.crypto || globalThis.msCrypto : null;
4223
4223
  if (c && c.getRandomValues) {
4224
4224
  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];
4225
+ r.setPRNG(function(u, f) {
4226
+ var m, b = new Uint8Array(f);
4227
+ for (m = 0; m < f; m += l)
4228
+ c.getRandomValues(b.subarray(m, m + Math.min(f - m, l)));
4229
+ for (m = 0; m < f; m++) u[m] = b[m];
4230
4230
  gr(b);
4231
4231
  });
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];
4232
+ } else typeof require < "u" && (crypto = window.crypto || globalThis.crypto, c && c.randomBytes && r.setPRNG(function(u, f) {
4233
+ var m, b = c.randomBytes(f);
4234
+ for (m = 0; m < f; m++) u[m] = b[m];
4235
4235
  gr(b);
4236
4236
  }));
4237
4237
  }();
4238
4238
  })(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
4239
+ const Vt = typeof module < "u" && module.exports ? module.exports : globalThis.nacl, Yn = {
4240
+ fromSeed: Vt.sign.keyPair.fromSeed,
4241
+ sign: Vt.sign.detached,
4242
+ verify: Vt.sign.detached.verify,
4243
+ randomBytes: Vt.randomBytes
4244
4244
  };
4245
4245
  let ai;
4246
4246
  function Xn(r) {
@@ -4526,8 +4526,8 @@ class $r {
4526
4526
  let t = 0, s = 0, i = new Uint8Array(e), n = new Uint8Array(e.byteLength * 2), o = 0;
4527
4527
  for (let a = 0; a < i.byteLength; a++)
4528
4528
  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;
4529
+ let d = s >>> t - 5 & 31;
4530
+ n[o++] = Rs.charAt(d).charCodeAt(0), t -= 5;
4531
4531
  }
4532
4532
  if (t > 0) {
4533
4533
  let a = s << 5 - t & 31;
@@ -4538,7 +4538,7 @@ class $r {
4538
4538
  static decode(e) {
4539
4539
  let t = 0, s = 0, i = 0, n = new Uint8Array(e), o = new Uint8Array(n.byteLength * 5 / 8 | 0);
4540
4540
  for (let a = 0; a < n.byteLength; a++) {
4541
- let f = String.fromCharCode(n[a]), p = Rs.indexOf(f);
4541
+ let d = String.fromCharCode(n[a]), p = Rs.indexOf(d);
4542
4542
  if (p === -1)
4543
4543
  throw new Error("Illegal Base32 character: " + n[a]);
4544
4544
  s = s << 5 | p, t += 5, t >= 8 && (o[i++] = s >>> t - 8 & 255, t -= 8);
@@ -4641,15 +4641,15 @@ class be {
4641
4641
  };
4642
4642
  }
4643
4643
  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);
4644
+ const i = e ? 2 : 1, n = s.byteLength, o = i + n + 2, a = i + n, d = new Uint8Array(o);
4645
4645
  if (e) {
4646
4646
  const y = be._encodePrefix(z.Seed, t);
4647
- f.set(y);
4647
+ d.set(y);
4648
4648
  } 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);
4649
+ d[0] = t;
4650
+ d.set(s, i);
4651
+ const p = ns.checksum(d.slice(0, a));
4652
+ return new DataView(d.buffer).setUint16(a, p, !0), $r.encode(d);
4653
4653
  }
4654
4654
  static _decode(e) {
4655
4655
  if (e.byteLength < 4)
@@ -4900,8 +4900,8 @@ function _o(r, e) {
4900
4900
  if (e.tls && !n)
4901
4901
  throw new T("tls", k.ServerOptionNotAvailable);
4902
4902
  }
4903
- const yo = 1024 * 32, wo = /^INFO\s+([^\r\n]+)\r\n/i, xo = Pt(`PONG\r
4904
- `), qr = Pt(`PING\r
4903
+ const yo = 1024 * 32, wo = /^INFO\s+([^\r\n]+)\r\n/i, xo = kt(`PONG\r
4904
+ `), qr = kt(`PING\r
4905
4905
  `);
4906
4906
  class So {
4907
4907
  constructor(e, t, s) {
@@ -4959,9 +4959,9 @@ class li extends he {
4959
4959
  protocol: !1
4960
4960
  }), n = t.protocolFilterFn ? t.protocolFilterFn : () => !0, o = t.dispatchedFn ? t.dispatchedFn : () => {
4961
4961
  };
4962
- this.callback = (a, f) => {
4963
- const { ingest: p } = i(f);
4964
- p && n(f) && (s(a, f), o(f));
4962
+ this.callback = (a, d) => {
4963
+ const { ingest: p } = i(d);
4964
+ p && n(d) && (s(a, d), o(d));
4965
4965
  };
4966
4966
  } else
4967
4967
  this.protocolFilterFn = t.protocolFilterFn, this.dispatchedFn = t.dispatchedFn;
@@ -5312,8 +5312,8 @@ class os {
5312
5312
  lang: o
5313
5313
  }, this.options, t.nonce);
5314
5314
  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);
5315
+ const d = JSON.stringify(a);
5316
+ this.transport.send(kt(`CONNECT ${d}${Yt}`)), this.transport.send(qr);
5317
5317
  } catch (a) {
5318
5318
  this._close(a);
5319
5319
  }
@@ -5352,7 +5352,7 @@ class os {
5352
5352
  sendCommand(e, ...t) {
5353
5353
  const s = this.outbound.length();
5354
5354
  let i;
5355
- typeof e == "string" ? i = Pt(e) : i = e, this.outbound.fill(i, ...t), s === 0 ? queueMicrotask(() => {
5355
+ typeof e == "string" ? i = kt(e) : i = e, this.outbound.fill(i, ...t), s === 0 ? queueMicrotask(() => {
5356
5356
  this.flushPending();
5357
5357
  }) : this.outbound.size() >= this.pendingLimit && this.flushPending();
5358
5358
  }
@@ -5375,12 +5375,12 @@ class os {
5375
5375
  if (this.info && n > this.info.max_payload)
5376
5376
  throw T.errorForCode(k.MaxPayloadExceeded);
5377
5377
  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));
5378
+ let d;
5379
+ s.headers ? (s.reply ? d = `HPUB ${e} ${s.reply} ${a} ${n}\r
5380
+ ` : d = `HPUB ${e} ${a} ${n}\r
5381
+ `, this.sendCommand(d, o, i, is)) : (s.reply ? d = `PUB ${e} ${s.reply} ${n}\r
5382
+ ` : d = `PUB ${e} ${n}\r
5383
+ `, this.sendCommand(d, i, is));
5384
5384
  }
5385
5385
  request(e) {
5386
5386
  return this.initMux(), this.muxSubscriptions.add(e), e;
@@ -5415,7 +5415,7 @@ class os {
5415
5415
  this.subscriptions.all().forEach((t) => {
5416
5416
  const s = t;
5417
5417
  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("")));
5418
+ }), e.length && this.transport.send(kt(e.join("")));
5419
5419
  }
5420
5420
  async _close(e) {
5421
5421
  this._closed || (this.whyClosed = new Error("close trace").stack || "", this.heartbeats.cancel(), this.connectError && (this.connectError(e), this.connectError = void 0), this.muxSubscriptions.close(), this.subscriptions.close(), this.listeners.forEach((t) => {
@@ -5491,16 +5491,16 @@ class Fr {
5491
5491
  return this.msg.string();
5492
5492
  }
5493
5493
  }
5494
- class jt {
5494
+ class Rt {
5495
5495
  constructor(e, t = "", s = "") {
5496
5496
  h(this, "subject");
5497
5497
  h(this, "queue");
5498
5498
  h(this, "srv");
5499
5499
  t !== "" && Po("service group", t);
5500
5500
  let i = "";
5501
- if (e instanceof Mt)
5501
+ if (e instanceof Ut)
5502
5502
  this.srv = e, i = "";
5503
- else if (e instanceof jt) {
5503
+ else if (e instanceof Rt) {
5504
5504
  const n = e;
5505
5505
  this.srv = n.srv, s === "" && n.queue !== "" && (s = n.queue), i = n.subject;
5506
5506
  } else
@@ -5518,20 +5518,20 @@ class jt {
5518
5518
  handler: t,
5519
5519
  subject: e
5520
5520
  } : t;
5521
- Et("endpoint", e);
5521
+ At("endpoint", e);
5522
5522
  let { subject: i, handler: n, metadata: o, queue: a } = s;
5523
5523
  i = i || e, a = a || this.queue, Ao("endpoint subject", i), i = this.calcSubject(this.subject, i);
5524
- const f = {
5524
+ const d = {
5525
5525
  name: e,
5526
5526
  subject: i,
5527
5527
  queue: a,
5528
5528
  handler: n,
5529
5529
  metadata: o
5530
5530
  };
5531
- return this.srv._addEndpoint(f);
5531
+ return this.srv._addEndpoint(d);
5532
5532
  }
5533
5533
  addGroup(e = "", t = "") {
5534
- return new jt(this, e, t);
5534
+ return new Rt(this, e, t);
5535
5535
  }
5536
5536
  }
5537
5537
  function Ao(r, e) {
@@ -5553,7 +5553,7 @@ function Po(r, e) {
5553
5553
  throw new Error(`${r} name cannot contain internal '>': '${e}'`);
5554
5554
  });
5555
5555
  }
5556
- class Mt {
5556
+ class Ut {
5557
5557
  constructor(e, t = {
5558
5558
  name: "",
5559
5559
  version: ""
@@ -5566,7 +5566,7 @@ class Mt {
5566
5566
  h(this, "_stopped");
5567
5567
  h(this, "_done");
5568
5568
  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(() => {
5569
+ this.nc = e, this.config = Object.assign({}, t), this.config.queue || (this.config.queue = "q"), At("name", this.config.name), At("queue", this.config.queue), Ze(this.config.version), this._id = Ge.next(), this.internal = [], this._done = Y(), this._stopped = !1, this.handlers = [], this.started = (/* @__PURE__ */ new Date()).toISOString(), this.reset(), this.nc.closed().then(() => {
5570
5570
  this.close().catch();
5571
5571
  }).catch((s) => {
5572
5572
  this.close(s).catch();
@@ -5574,7 +5574,7 @@ class Mt {
5574
5574
  }
5575
5575
  static controlSubject(e, t = "", s = "", i) {
5576
5576
  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}`);
5577
+ return t === "" && s === "" ? `${n}.${e}` : (At("control subject name", t), s !== "" ? (At("control subject id", s), `${n}.${e}.${t}.${s}`) : `${n}.${e}.${t}`);
5578
5578
  }
5579
5579
  get subjects() {
5580
5580
  return this.handlers.filter((e) => e.internal === !1).map((e) => e.subject);
@@ -5606,7 +5606,7 @@ class Mt {
5606
5606
  setupHandler(e, t = !1) {
5607
5607
  const s = t ? "" : e.queue ? e.queue : this.config.queue, { name: i, subject: n, handler: o } = e, a = e;
5608
5608
  a.internal = t, t && this.internal.push(a), a.stats = new ko(i, n, s), a.queue = s;
5609
- const f = o ? (p, g) => {
5609
+ const d = o ? (p, g) => {
5610
5610
  if (p) {
5611
5611
  this.close(p);
5612
5612
  return;
@@ -5623,7 +5623,7 @@ class Mt {
5623
5623
  }
5624
5624
  } : void 0;
5625
5625
  return a.sub = this.nc.subscribe(n, {
5626
- callback: f,
5626
+ callback: d,
5627
5627
  queue: s
5628
5628
  }), a.sub.closed.then(() => {
5629
5629
  this._stopped || this.close(new Error(`required subscription ${e.subject} stopped`)).catch();
@@ -5636,7 +5636,7 @@ class Mt {
5636
5636
  }
5637
5637
  info() {
5638
5638
  return {
5639
- type: kt.INFO,
5639
+ type: Ot.INFO,
5640
5640
  name: this.name,
5641
5641
  id: this.id,
5642
5642
  version: this.version,
@@ -5668,7 +5668,7 @@ class Mt {
5668
5668
  e.push(t.stats.stats(t.qi));
5669
5669
  }
5670
5670
  return {
5671
- type: kt.STATS,
5671
+ type: Ot.STATS,
5672
5672
  name: this.name,
5673
5673
  id: this.id,
5674
5674
  version: this.version,
@@ -5683,10 +5683,10 @@ class Mt {
5683
5683
  }
5684
5684
  _doAddInternalHandler(e, t, s, i = "", n = "") {
5685
5685
  const o = {};
5686
- o.name = e, o.subject = Mt.controlSubject(t, i, n), o.handler = s, this.setupHandler(o, !0);
5686
+ o.name = e, o.subject = Ut.controlSubject(t, i, n), o.handler = s, this.setupHandler(o, !0);
5687
5687
  }
5688
5688
  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());
5689
+ const e = Oe(), t = (o, a) => o ? (this.close(o), Promise.reject(o)) : this.stats().then((d) => (a == null || a.respond(e.encode(d)), Promise.resolve())), s = (o, a) => o ? (this.close(o), Promise.reject(o)) : (a == null || a.respond(e.encode(this.info())), Promise.resolve()), i = e.encode(this.ping()), n = (o, a) => o ? (this.close(o).then().catch(), Promise.reject(o)) : (a.respond(i), Promise.resolve());
5690
5690
  return this.addInternalHandler(Je.PING, n), this.addInternalHandler(Je.STATS, t), this.addInternalHandler(Je.INFO, s), this.handlers.forEach((o) => {
5691
5691
  const { subject: a } = o;
5692
5692
  typeof a == "string" && o.handler !== null && this.setupHandler(o);
@@ -5712,7 +5712,7 @@ class Mt {
5712
5712
  }
5713
5713
  ping() {
5714
5714
  return {
5715
- type: kt.PING,
5715
+ type: Ot.PING,
5716
5716
  name: this.name,
5717
5717
  id: this.id,
5718
5718
  version: this.version,
@@ -5725,10 +5725,10 @@ class Mt {
5725
5725
  e.stats.reset(e.qi);
5726
5726
  }
5727
5727
  addGroup(e, t) {
5728
- return new jt(this, e, t);
5728
+ return new Rt(this, e, t);
5729
5729
  }
5730
5730
  addEndpoint(e, t) {
5731
- return new jt(this).addEndpoint(e, t);
5731
+ return new Rt(this).addEndpoint(e, t);
5732
5732
  }
5733
5733
  _addEndpoint(e) {
5734
5734
  const t = new he();
@@ -5767,7 +5767,7 @@ class ko {
5767
5767
  this.num_errors++, this.last_error = e.message;
5768
5768
  }
5769
5769
  _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;
5770
+ const { name: e, subject: t, average_processing_time: s, num_errors: i, num_requests: n, processing_time: o, last_error: a, data: d, queue: p } = this;
5771
5771
  return {
5772
5772
  name: e,
5773
5773
  subject: t,
@@ -5776,7 +5776,7 @@ class ko {
5776
5776
  num_requests: n,
5777
5777
  processing_time: o,
5778
5778
  last_error: a,
5779
- data: f,
5779
+ data: d,
5780
5780
  queue_group: p
5781
5781
  };
5782
5782
  }
@@ -5805,11 +5805,11 @@ class Oo {
5805
5805
  return this.q(Je.INFO, e, t);
5806
5806
  }
5807
5807
  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);
5808
+ const i = new he(), n = Oe(), o = Ut.controlSubject(e, t, s, this.prefix), a = await this.nc.requestMany(o, ve, this.opts);
5809
5809
  return (async () => {
5810
- for await (const f of a)
5810
+ for await (const d of a)
5811
5811
  try {
5812
- const p = n.decode(f.data);
5812
+ const p = n.decode(d.data);
5813
5813
  i.push(p);
5814
5814
  } catch (p) {
5815
5815
  i.push(() => {
@@ -5819,8 +5819,8 @@ class Oo {
5819
5819
  i.push(() => {
5820
5820
  i.stop();
5821
5821
  });
5822
- })().catch((f) => {
5823
- i.stop(f);
5822
+ })().catch((d) => {
5823
+ i.stop(d);
5824
5824
  }), i;
5825
5825
  }
5826
5826
  }
@@ -5890,7 +5890,7 @@ var Ue;
5890
5890
  (function(r) {
5891
5891
  r.MsgIdHdr = "Nats-Msg-Id", r.ExpectedStreamHdr = "Nats-Expected-Stream", r.ExpectedLastSeqHdr = "Nats-Expected-Last-Sequence", r.ExpectedLastMsgIdHdr = "Nats-Expected-Last-Msg-Id", r.ExpectedLastSubjectSequenceHdr = "Nats-Expected-Last-Subject-Sequence";
5892
5892
  })(Ue || (Ue = {}));
5893
- class Rt {
5893
+ class Nt {
5894
5894
  constructor(e, t, s) {
5895
5895
  h(this, "js");
5896
5896
  h(this, "jsm");
@@ -5909,7 +5909,7 @@ class Rt {
5909
5909
  }
5910
5910
  static async create(e, t, s = {}) {
5911
5911
  Xt(t);
5912
- const i = await e.jetstreamManager(), n = new Rt(t, e, i);
5912
+ const i = await e.jetstreamManager(), n = new Nt(t, e, i);
5913
5913
  return await n.init(s), n;
5914
5914
  }
5915
5915
  static async bind(e, t, s = {}) {
@@ -5919,7 +5919,7 @@ class Rt {
5919
5919
  }
5920
5920
  };
5921
5921
  Xt(t);
5922
- const o = new Rt(t, e, i);
5922
+ const o = new Nt(t, e, i);
5923
5923
  return n.config.name = s.streamName ?? o.bucketName(), Object.assign(o, n), o.stream = n.config.name, o.codec = s.codec || fi(), o.direct = n.config.allow_direct ?? !1, o.initializePrefixes(n), o;
5924
5924
  }
5925
5925
  async init(e = {}) {
@@ -5933,10 +5933,10 @@ class Rt {
5933
5933
  y.name.startsWith(we) || (y.name = `${we}${y.name}`), s.mirror = y, s.mirror_direct = !0;
5934
5934
  } else if (e.sources) {
5935
5935
  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 = [
5936
+ const A = Object.assign({}, x), O = A.name.startsWith(we) ? A.name.substring(we.length) : A.name;
5937
+ return A.name.startsWith(we) || (A.name = `${we}${A.name}`), !x.external && O !== this.bucket && (A.subject_transforms = [
5938
5938
  {
5939
- src: `$KV.${I}.>`,
5939
+ src: `$KV.${O}.>`,
5940
5940
  dest: `$KV.${this.bucket}.>`
5941
5941
  }
5942
5942
  ]), A;
@@ -5950,13 +5950,13 @@ class Rt {
5950
5950
  ];
5951
5951
  e.metadata && (s.metadata = e.metadata), typeof e.compression == "boolean" && (s.compression = e.compression ? Ve.S2 : Ve.None);
5952
5952
  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) {
5953
+ s.discard = a ? jt.New : jt.Old;
5954
+ const { ok: d, min: p } = n.features.get(J.JS_ALLOW_DIRECT);
5955
+ if (!d && e.allow_direct === !0) {
5956
5956
  const y = o ? `${o.major}.${o.minor}.${o.micro}` : "unknown";
5957
5957
  return Promise.reject(new Error(`allow_direct is not available on server version ${y} - requires ${p}`));
5958
5958
  }
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;
5959
+ e.allow_direct = typeof e.allow_direct == "boolean" ? e.allow_direct : d, s.allow_direct = e.allow_direct, this.direct = s.allow_direct, s.num_replicas = t.replicas, t.ttl && (s.max_age = W(t.ttl)), s.allow_rollup_hdrs = !0;
5960
5960
  let g;
5961
5961
  try {
5962
5962
  g = await this.jsm.streams.info(s.name), !g.config.allow_direct && this.direct === !0 && (this.direct = !1);
@@ -6071,14 +6071,14 @@ class Rt {
6071
6071
  this.validateKey(i);
6072
6072
  const n = {};
6073
6073
  if (s.previousSeq !== void 0) {
6074
- const f = Fe();
6075
- n.headers = f, f.set(Ue.ExpectedLastSubjectSequenceHdr, `${s.previousSeq}`);
6074
+ const d = Fe();
6075
+ n.headers = d, d.set(Ue.ExpectedLastSubjectSequenceHdr, `${s.previousSeq}`);
6076
6076
  }
6077
6077
  try {
6078
6078
  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);
6079
+ } catch (d) {
6080
+ const p = d;
6081
+ return p.isJetStreamError() ? (p.message = (o = p.api_error) == null ? void 0 : o.description, p.code = `${(a = p.api_error) == null ? void 0 : a.code}`, Promise.reject(p)) : Promise.reject(d);
6082
6082
  }
6083
6083
  }
6084
6084
  async get(e, t) {
@@ -6115,12 +6115,12 @@ class Rt {
6115
6115
  }
6116
6116
  });
6117
6117
  (async () => {
6118
- for await (const f of i)
6119
- (f.operation === "DEL" || f.operation === "PURGE") && s.push(f);
6118
+ for await (const d of i)
6119
+ (d.operation === "DEL" || d.operation === "PURGE") && s.push(d);
6120
6120
  })().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, {
6121
+ const n = Date.now() - e, o = s.map((d) => {
6122
+ const p = this.subjectForKey(d.key);
6123
+ return d.created.getTime() >= n ? this.jsm.streams.purge(this.stream, {
6124
6124
  filter: p,
6125
6125
  keep: 1
6126
6126
  }) : this.jsm.streams.purge(this.stream, {
@@ -6131,7 +6131,7 @@ class Rt {
6131
6131
  return a.unshift({
6132
6132
  success: !0,
6133
6133
  purged: 0
6134
- }), a.reduce((f, p) => (f.purged += p.purged, f));
6134
+ }), a.reduce((d, p) => (d.purged += p.purged, d));
6135
6135
  }
6136
6136
  async _deleteOrPurge(e, t, s) {
6137
6137
  if (!this.hasWildcards(e))
@@ -6152,9 +6152,9 @@ class Rt {
6152
6152
  _buildCC(e, t, s = {}) {
6153
6153
  let n = (Array.isArray(e) ? e : [
6154
6154
  e
6155
- ]).map((f) => {
6156
- const p = this.encodeKey(f);
6157
- return this.validateSearchKey(f), this.fullKeyName(p);
6155
+ ]).map((d) => {
6156
+ const p = this.encodeKey(d);
6157
+ return this.validateSearchKey(d), this.fullKeyName(p);
6158
6158
  }), o = se.LastPerSubject;
6159
6159
  t === Re.AllHistory && (o = se.All), t === Re.UpdatesOnly && (o = se.New);
6160
6160
  let a;
@@ -6178,7 +6178,7 @@ class Rt {
6178
6178
  s.stop();
6179
6179
  };
6180
6180
  let o = 0;
6181
- const a = this._buildCC(t, Re.AllHistory, i), f = a.filter_subject, p = ze(a);
6181
+ const a = this._buildCC(t, Re.AllHistory, i), d = a.filter_subject, p = ze(a);
6182
6182
  p.bindStream(this.stream), p.orderedConsumer(), p.callback((y, x) => {
6183
6183
  if (y) {
6184
6184
  s.stop(y);
@@ -6189,7 +6189,7 @@ class Rt {
6189
6189
  s.push(A), s.received++, (n && o > 0 && s.received >= o || x.info.pending === 0) && (s.push(n), n = void 0);
6190
6190
  }
6191
6191
  });
6192
- const g = await this.js.subscribe(f, p);
6192
+ const g = await this.js.subscribe(d, p);
6193
6193
  if (n) {
6194
6194
  const { info: { last: y } } = g, x = y.num_pending + y.delivered.consumer_seq;
6195
6195
  if (x === 0 || s.received >= x)
@@ -6212,7 +6212,7 @@ class Rt {
6212
6212
  }), s;
6213
6213
  }
6214
6214
  canSetWatcherName() {
6215
- const t = this.js.nc, { ok: s } = t.features.get(H.JS_NEW_CONSUMER_CREATE_API);
6215
+ const t = this.js.nc, { ok: s } = t.features.get(J.JS_NEW_CONSUMER_CREATE_API);
6216
6216
  return s;
6217
6217
  }
6218
6218
  async watch(e = {}) {
@@ -6221,33 +6221,33 @@ class Rt {
6221
6221
  let n = Re.LastValue;
6222
6222
  e.include === Re.AllHistory ? n = Re.AllHistory : e.include === Re.UpdatesOnly && (n = Re.UpdatesOnly);
6223
6223
  const o = e.ignoreDeletes === !0;
6224
- let a = e.initializedFn, f = 0;
6224
+ let a = e.initializedFn, d = 0;
6225
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) => {
6226
+ this.canSetWatcherName() && y.consumerName(Ge.next()), y.bindStream(this.stream), e.resumeFromRevision && e.resumeFromRevision > 0 && y.startSequence(e.resumeFromRevision), y.orderedConsumer(), y.callback((A, O) => {
6227
6227
  if (A) {
6228
6228
  s.stop(A);
6229
6229
  return;
6230
6230
  }
6231
- if (I) {
6232
- const N = this.jmToEntry(I);
6233
- if (o && N.operation === "DEL")
6231
+ if (O) {
6232
+ const j = this.jmToEntry(O);
6233
+ if (o && j.operation === "DEL")
6234
6234
  return;
6235
- s.push(N), s.received++, a && (f > 0 && s.received >= f || I.info.pending === 0) && (s.push(a), a = void 0);
6235
+ s.push(j), s.received++, a && (d > 0 && s.received >= d || O.info.pending === 0) && (s.push(a), a = void 0);
6236
6236
  }
6237
6237
  });
6238
6238
  const x = await this.js.subscribe(g, y);
6239
6239
  if (a) {
6240
- const { info: { last: A } } = x, I = A.num_pending + A.delivered.consumer_seq;
6241
- if (I === 0 || s.received >= I)
6240
+ const { info: { last: A } } = x, O = A.num_pending + A.delivered.consumer_seq;
6241
+ if (O === 0 || s.received >= O)
6242
6242
  try {
6243
6243
  a();
6244
- } catch (N) {
6245
- s.stop(N);
6244
+ } catch (j) {
6245
+ s.stop(j);
6246
6246
  } finally {
6247
6247
  a = void 0;
6248
6248
  }
6249
6249
  else
6250
- f = I;
6250
+ d = O;
6251
6251
  }
6252
6252
  return s._data = x, s.iterClosed.then(() => {
6253
6253
  x.unsubscribe();
@@ -6264,9 +6264,9 @@ class Rt {
6264
6264
  n.bindStream(this.stream), n.orderedConsumer();
6265
6265
  const o = await this.js.subscribe(i, n);
6266
6266
  return (async () => {
6267
- var f;
6267
+ var d;
6268
6268
  for await (const p of o) {
6269
- const g = (f = p.headers) == null ? void 0 : f.get(as);
6269
+ const g = (d = p.headers) == null ? void 0 : d.get(as);
6270
6270
  if (g !== "DEL" && g !== "PURGE") {
6271
6271
  const y = this.decodeKey(p.subject.substring(this.prefixLen));
6272
6272
  t.push(y);
@@ -6275,8 +6275,8 @@ class Rt {
6275
6275
  }
6276
6276
  })().then(() => {
6277
6277
  t.stop();
6278
- }).catch((f) => {
6279
- t.stop(f);
6278
+ }).catch((d) => {
6279
+ t.stop(d);
6280
6280
  }), o.info.last.num_pending === 0 && o.unsubscribe(), t;
6281
6281
  }
6282
6282
  purgeBucket(e) {
@@ -6406,7 +6406,7 @@ class zs {
6406
6406
  return this.si.config.compression ? this.si.config.compression !== Ve.None : !1;
6407
6407
  }
6408
6408
  }
6409
- function Vt(r) {
6409
+ function Wt(r) {
6410
6410
  if (r === void 0)
6411
6411
  return;
6412
6412
  const { domain: e } = r;
@@ -6434,7 +6434,7 @@ var ht;
6434
6434
  r.DebugEvent = "debug", r.Discard = "discard", r.Reset = "reset", r.Next = "next";
6435
6435
  })(ht || (ht = {}));
6436
6436
  const Hr = Uint8Array.of(43, 65, 67, 75), Lo = Uint8Array.of(45, 78, 65, 75), vt = Uint8Array.of(43, 87, 80, 73), qo = Uint8Array.of(43, 78, 88, 84), Fo = Uint8Array.of(43, 84, 69, 82, 77), Bo = Uint8Array.of(32);
6437
- function Nt(r, e = 5e3) {
6437
+ function Tt(r, e = 5e3) {
6438
6438
  return new ia(r, e);
6439
6439
  }
6440
6440
  class Ns extends he {
@@ -6468,53 +6468,53 @@ class Ns extends he {
6468
6468
  }
6469
6469
  start() {
6470
6470
  const { max_messages: t, max_bytes: s, idle_heartbeat: i, threshold_bytes: n, threshold_messages: o } = this.opts;
6471
- this.closed().then((f) => {
6471
+ this.closed().then((d) => {
6472
6472
  if (this.cleanupHandler)
6473
6473
  try {
6474
- this.cleanupHandler(f);
6474
+ this.cleanupHandler(d);
6475
6475
  } catch {
6476
6476
  }
6477
6477
  });
6478
6478
  const { sub: a } = this;
6479
6479
  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);
6480
+ callback: (d, p) => {
6481
+ var y, x, A, O;
6482
+ if (d) {
6483
+ this.stop(d);
6484
6484
  return;
6485
6485
  }
6486
6486
  if ((y = this.monitor) == null || y.work(), p.subject === this.inbox) {
6487
6487
  if (Ls(p))
6488
6488
  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,
6489
+ const j = (x = p.headers) == null ? void 0 : x.code, B = ((O = (A = p.headers) == null ? void 0 : A.description) == null ? void 0 : O.toLowerCase()) || "unknown", { msgsLeft: Q, bytesLeft: L } = this.parseDiscard(p.headers);
6490
+ if (Q > 0 || L > 0)
6491
+ this.pending.msgs -= Q, this.pending.bytes -= L, this.pending.requests--, this.notify(ht.Discard, {
6492
+ msgsLeft: Q,
6493
6493
  bytesLeft: L
6494
6494
  });
6495
- else if (N === 400) {
6496
- this.stop(new T(J, `${N}`));
6495
+ else if (j === 400) {
6496
+ this.stop(new T(B, `${j}`));
6497
6497
  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);
6498
+ } else if (j === 409 && B === "consumer deleted") {
6499
+ if (this.notify($e.ConsumerDeleted, `${j} ${B}`), !this.refilling || this.abortOnMissingResource) {
6500
+ const ee = new T(B, `${j}`);
6501
+ this.stop(ee);
6502
6502
  return;
6503
6503
  }
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);
6504
+ } else if (j === 503) {
6505
+ if (this.notify($e.NoResponders, `${j} No Responders`), !this.refilling || this.abortOnMissingResource) {
6506
+ const ee = new T("no responders", `${j}`);
6507
+ this.stop(ee);
6508
6508
  return;
6509
6509
  }
6510
6510
  } else
6511
- this.notify(ht.DebugEvent, `${N} ${J}`);
6511
+ this.notify(ht.DebugEvent, `${j} ${B}`);
6512
6512
  } 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());
6513
+ this._push(Tt(p, this.consumer.api.timeout)), this.received++, this.pending.msgs && this.pending.msgs--, this.pending.bytes && (this.pending.bytes -= p.size());
6514
6514
  if (this.pending.msgs === 0 && this.pending.bytes === 0 && (this.pending.requests = 0), this.refilling) {
6515
6515
  if (t && this.pending.msgs <= o || s && this.pending.bytes <= n) {
6516
- const N = this.pullOptions();
6517
- this.pull(N);
6516
+ const j = this.pullOptions();
6517
+ this.pull(j);
6518
6518
  }
6519
6519
  } else this.pending.requests === 0 && this._push(() => {
6520
6520
  this.stop();
@@ -6524,15 +6524,15 @@ class Ns extends he {
6524
6524
  this.sub.draining && this._push(() => {
6525
6525
  this.stop();
6526
6526
  });
6527
- }), i && (this.monitor = new er(i, (f) => (this.notify($e.HeartbeatsMissed, f), this.resetPending().then(() => {
6527
+ }), i && (this.monitor = new er(i, (d) => (this.notify($e.HeartbeatsMissed, d), this.resetPending().then(() => {
6528
6528
  }).catch(() => {
6529
6529
  }), !1), {
6530
6530
  maxOut: 2
6531
6531
  })), (async () => {
6532
6532
  var p;
6533
- const f = this.consumer.api.nc.status();
6534
- this.statusIterator = f;
6535
- for await (const g of f)
6533
+ const d = this.consumer.api.nc.status();
6534
+ this.statusIterator = d;
6535
+ for await (const g of d)
6536
6536
  switch (g.type) {
6537
6537
  case ke.Disconnect:
6538
6538
  (p = this.monitor) == null || p.cancel();
@@ -6605,11 +6605,11 @@ class Ns extends he {
6605
6605
  } else
6606
6606
  t = 0, s = 0;
6607
6607
  this.inBackOff = !0;
6608
- const a = i.backoff(n), f = dt(a);
6608
+ const a = i.backoff(n), d = dt(a);
6609
6609
  await Promise.race([
6610
- f,
6610
+ d,
6611
6611
  this.consumer.api.nc.closed()
6612
- ]), f.cancel(), n++;
6612
+ ]), d.cancel(), n++;
6613
6613
  }
6614
6614
  }
6615
6615
  }
@@ -6828,7 +6828,7 @@ class Ho {
6828
6828
  return this.consumerOpts.headers_only === !0 && (s.headers_only = !0), Array.isArray(this.consumerOpts.filterSubjects) && (s.filter_subjects = this.consumerOpts.filterSubjects), typeof this.consumerOpts.filterSubjects == "string" && (s.filter_subject = this.consumerOpts.filterSubjects), this.consumerOpts.replay_policy && (s.replay_policy = this.consumerOpts.replay_policy), e === this.startSeq + 1 && (s.deliver_policy = this.consumerOpts.deliver_policy || se.StartSequence, (this.consumerOpts.deliver_policy === se.LastPerSubject || this.consumerOpts.deliver_policy === se.New || this.consumerOpts.deliver_policy === se.Last) && (delete s.opt_start_seq, s.deliver_policy = this.consumerOpts.deliver_policy), s.deliver_policy === se.LastPerSubject && typeof s.filter_subjects > "u" && typeof s.filter_subject > "u" && (s.filter_subject = ">"), this.consumerOpts.opt_start_time && (delete s.opt_start_seq, s.deliver_policy = se.StartTime, s.opt_start_time = this.consumerOpts.opt_start_time), this.consumerOpts.inactive_threshold && (s.inactive_threshold = W(this.consumerOpts.inactive_threshold))), s;
6829
6829
  }
6830
6830
  async resetConsumer(e = 0) {
6831
- var o, a, f, p, g;
6831
+ var o, a, d, p, g;
6832
6832
  Ge.next();
6833
6833
  const t = this.serial === 0;
6834
6834
  (o = this.consumer) == null || o.delete().catch(() => {
@@ -6841,7 +6841,7 @@ class Ho {
6841
6841
  let n;
6842
6842
  for (let y = 0; ; y++)
6843
6843
  try {
6844
- n = await this.api.add(this.stream, s), (f = this.iter) == null || f.notify($e.OrderedConsumerRecreated, n.name);
6844
+ n = await this.api.add(this.stream, s), (d = this.iter) == null || d.notify($e.OrderedConsumerRecreated, n.name);
6845
6845
  break;
6846
6846
  } catch (x) {
6847
6847
  if (x.message === "stream not found" && ((p = this.iter) == null || p.notify($e.StreamNotFound, y), this.type === Ae.Fetch || this.opts.abort_on_missing_resource === !0))
@@ -6869,11 +6869,11 @@ class Ho {
6869
6869
  max_messages: 100,
6870
6870
  expires: 3e4
6871
6871
  }, t) {
6872
- var f, p;
6872
+ var d, p;
6873
6873
  t = t || {};
6874
6874
  const s = t.fromFetch || !1, i = t.orderedReset || !1;
6875
6875
  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;
6876
+ (d = this.iter) == null || d.src.stop(), await ((p = this.iter) == null ? void 0 : p.closed()), this.currentConsumer = null;
6877
6877
  return;
6878
6878
  }
6879
6879
  (this.currentConsumer === null || i) && (this.currentConsumer = await this.resetConsumer(this.cursor.stream_seq + 1)), (this.iter === null || s) && (this.iter = new Do()), this.consumer = new Gs(this.api, this.currentConsumer);
@@ -6953,7 +6953,7 @@ class Vs {
6953
6953
  this.api = e, this.notified = !1;
6954
6954
  }
6955
6955
  checkVersion() {
6956
- const e = this.api.nc.features.get(H.JS_SIMPLIFICATION);
6956
+ const e = this.api.nc.features.get(J.JS_SIMPLIFICATION);
6957
6957
  return e.ok ? Promise.resolve() : Promise.reject(new Error(`consumers framework is only supported on servers ${e.min} or better`));
6958
6958
  }
6959
6959
  getPullConsumerFor(e) {
@@ -7005,43 +7005,43 @@ class fs {
7005
7005
  return this.api.deleteMessage(this.name, e, t);
7006
7006
  }
7007
7007
  }
7008
- class sr extends Tt {
7008
+ class sr extends Mt {
7009
7009
  constructor(e, t) {
7010
7010
  super(e, t);
7011
7011
  }
7012
7012
  checkStreamConfigVersions(e) {
7013
7013
  const t = this.nc;
7014
7014
  if (e.metadata) {
7015
- const { min: i, ok: n } = t.features.get(H.JS_STREAM_CONSUMER_METADATA);
7015
+ const { min: i, ok: n } = t.features.get(J.JS_STREAM_CONSUMER_METADATA);
7016
7016
  if (!n)
7017
7017
  throw new Error(`stream 'metadata' requires server ${i}`);
7018
7018
  }
7019
7019
  if (e.first_seq) {
7020
- const { min: i, ok: n } = t.features.get(H.JS_STREAM_FIRST_SEQ);
7020
+ const { min: i, ok: n } = t.features.get(J.JS_STREAM_FIRST_SEQ);
7021
7021
  if (!n)
7022
7022
  throw new Error(`stream 'first_seq' requires server ${i}`);
7023
7023
  }
7024
7024
  if (e.subject_transform) {
7025
- const { min: i, ok: n } = t.features.get(H.JS_STREAM_SUBJECT_TRANSFORM);
7025
+ const { min: i, ok: n } = t.features.get(J.JS_STREAM_SUBJECT_TRANSFORM);
7026
7026
  if (!n)
7027
7027
  throw new Error(`stream 'subject_transform' requires server ${i}`);
7028
7028
  }
7029
7029
  if (e.compression) {
7030
- const { min: i, ok: n } = t.features.get(H.JS_STREAM_COMPRESSION);
7030
+ const { min: i, ok: n } = t.features.get(J.JS_STREAM_COMPRESSION);
7031
7031
  if (!n)
7032
7032
  throw new Error(`stream 'compression' requires server ${i}`);
7033
7033
  }
7034
7034
  if (e.consumer_limits) {
7035
- const { min: i, ok: n } = t.features.get(H.JS_DEFAULT_CONSUMER_LIMITS);
7035
+ const { min: i, ok: n } = t.features.get(J.JS_DEFAULT_CONSUMER_LIMITS);
7036
7036
  if (!n)
7037
7037
  throw new Error(`stream 'consumer_limits' requires server ${i}`);
7038
7038
  }
7039
7039
  function s(i, n) {
7040
7040
  var a;
7041
7041
  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);
7042
+ const { min: d, ok: p } = t.features.get(J.JS_STREAM_SOURCE_SUBJECT_TRANSFORM);
7043
7043
  if (!p)
7044
- throw new Error(`${i} 'subject_transforms' requires server ${f}`);
7044
+ throw new Error(`${i} 'subject_transforms' requires server ${d}`);
7045
7045
  }
7046
7046
  }
7047
7047
  e.sources && e.sources.forEach((i) => {
@@ -7050,7 +7050,7 @@ class sr extends Tt {
7050
7050
  }
7051
7051
  async add(e = {}) {
7052
7052
  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);
7053
+ this.checkStreamConfigVersions(e), pe(e.name), e.mirror = Wt(e.mirror), e.sources = (i = e.sources) == null ? void 0 : i.map(Wt);
7054
7054
  const s = await this._request(`${this.prefix}.STREAM.CREATE.${e.name}`, e);
7055
7055
  return this._fixInfo(s), s;
7056
7056
  }
@@ -7060,30 +7060,30 @@ class sr extends Tt {
7060
7060
  async update(e, t = {}) {
7061
7061
  var a;
7062
7062
  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");
7063
+ const d = e;
7064
+ e = d.name, t = d, console.trace("\x1B[33m >> streams.update(config: StreamConfig) api changed to streams.update(name: string, config: StreamUpdateConfig) - this shim will be removed - update your code. \x1B[0m");
7065
7065
  }
7066
7066
  this.checkStreamConfigVersions(t), pe(e);
7067
7067
  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);
7068
+ i.mirror = Wt(i.mirror), i.sources = (a = i.sources) == null ? void 0 : a.map(Wt);
7069
7069
  const o = await this._request(`${this.prefix}.STREAM.UPDATE.${e}`, i);
7070
7070
  return this._fixInfo(o), o;
7071
7071
  }
7072
7072
  async info(e, t) {
7073
7073
  pe(e);
7074
7074
  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) {
7075
+ let n = await this._request(s, t), { total: o, limit: a } = n, d = n.state.subjects ? Object.getOwnPropertyNames(n.state.subjects).length : 1;
7076
+ if (o && o > d) {
7077
7077
  const p = [
7078
7078
  n
7079
7079
  ], g = t || {};
7080
7080
  let y = 0;
7081
- for (; o > f; ) {
7081
+ for (; o > d; ) {
7082
7082
  y++, g.offset = a * y;
7083
7083
  const A = await this._request(s, g);
7084
7084
  o = A.total, p.push(A);
7085
- const I = Object.getOwnPropertyNames(A.state.subjects).length;
7086
- if (f += I, I < a)
7085
+ const O = Object.getOwnPropertyNames(A.state.subjects).length;
7086
+ if (d += O, O < a)
7087
7087
  break;
7088
7088
  }
7089
7089
  let x = {};
@@ -7102,7 +7102,7 @@ class sr extends Tt {
7102
7102
  this._fixInfo(a);
7103
7103
  }), o.streams;
7104
7104
  }, i = `${this.prefix}.STREAM.LIST`;
7105
- return new At(i, s, this, t);
7105
+ return new Pt(i, s, this, t);
7106
7106
  }
7107
7107
  _fixInfo(e) {
7108
7108
  e.config.sealed = e.config.sealed || !1, e.config.deny_delete = e.config.deny_delete || !1, e.config.deny_purge = e.config.deny_purge || !1, e.config.allow_rollup_hdrs = e.config.allow_rollup_hdrs || !1;
@@ -7132,15 +7132,15 @@ class sr extends Tt {
7132
7132
  }
7133
7133
  listKvs() {
7134
7134
  const e = (s) => {
7135
- var f;
7135
+ var d;
7136
7136
  const n = s.streams.filter((p) => p.config.name.startsWith(we));
7137
7137
  n.forEach((p) => {
7138
7138
  this._fixInfo(p);
7139
7139
  });
7140
7140
  let o = "";
7141
- return n.length && (o = ((f = this.nc.info) == null ? void 0 : f.cluster) ?? ""), n.map((p) => new di(p, o));
7141
+ return n.length && (o = ((d = this.nc.info) == null ? void 0 : d.cluster) ?? ""), n.map((p) => new di(p, o));
7142
7142
  }, t = `${this.prefix}.STREAM.LIST`;
7143
- return new At(t, e, this);
7143
+ return new Pt(t, e, this);
7144
7144
  }
7145
7145
  listObjectStores() {
7146
7146
  const e = (s) => {
@@ -7149,20 +7149,20 @@ class sr extends Tt {
7149
7149
  this._fixInfo(a);
7150
7150
  }), n.map((a) => new zs(a));
7151
7151
  }, t = `${this.prefix}.STREAM.LIST`;
7152
- return new At(t, e, this);
7152
+ return new Pt(t, e, this);
7153
7153
  }
7154
7154
  names(e = "") {
7155
7155
  const t = e != null && e.length ? {
7156
7156
  subject: e
7157
7157
  } : {}, s = (n) => n.streams, i = `${this.prefix}.STREAM.NAMES`;
7158
- return new At(i, s, this, t);
7158
+ return new Pt(i, s, this, t);
7159
7159
  }
7160
7160
  async get(e) {
7161
7161
  const t = await this.info(e);
7162
7162
  return Promise.resolve(new fs(this, t));
7163
7163
  }
7164
7164
  }
7165
- class Jo extends Tt {
7165
+ class Jo extends Mt {
7166
7166
  constructor(e, t) {
7167
7167
  super(e, t);
7168
7168
  }
@@ -7171,12 +7171,12 @@ class Jo extends Tt {
7171
7171
  let s = t;
7172
7172
  const { last_by_subj: i } = s;
7173
7173
  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, {
7174
+ const n = s ? this.jc.encode(s) : ve, o = this.opts.apiPrefix || "$JS.API", a = i ? `${o}.DIRECT.GET.${e}.${i}` : `${o}.DIRECT.GET.${e}`, d = await this.nc.request(a, n, {
7175
7175
  timeout: this.timeout
7176
- }), p = at(f);
7176
+ }), p = at(d);
7177
7177
  if (p)
7178
7178
  return Promise.reject(p);
7179
- const g = new Ws(f);
7179
+ const g = new Ws(d);
7180
7180
  return Promise.resolve(g);
7181
7181
  }
7182
7182
  async getBatch(e, t) {
@@ -7184,28 +7184,28 @@ class Jo extends Tt {
7184
7184
  const i = `${this.opts.apiPrefix || "$JS.API"}.DIRECT.GET.${e}`;
7185
7185
  if (!Array.isArray(t.multi_last) || t.multi_last.length === 0)
7186
7186
  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, {
7187
+ const n = JSON.stringify(t, (d, p) => d === "up_to_time" && p instanceof Date ? p.toISOString() : p), o = new he(), a = await this.nc.requestMany(i, n, {
7188
7188
  strategy: Ne.SentinelMsg
7189
7189
  });
7190
7190
  return (async () => {
7191
7191
  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();
7192
+ let d = !1, p = !1, g;
7193
+ for await (const O of a) {
7194
+ if (!d) {
7195
+ d = !0;
7196
+ const j = ((y = O.headers) == null ? void 0 : y.code) || 0;
7197
+ if (j !== 0 && j < 200 || j > 299) {
7198
+ g = (x = O.headers) == null ? void 0 : x.description.toLowerCase();
7199
7199
  break;
7200
7200
  }
7201
- if (((A = I.headers) == null ? void 0 : A.get("Nats-Num-Pending")) === "") {
7201
+ if (((A = O.headers) == null ? void 0 : A.get("Nats-Num-Pending")) === "") {
7202
7202
  p = !0;
7203
7203
  break;
7204
7204
  }
7205
7205
  }
7206
- if (I.data.length === 0)
7206
+ if (O.data.length === 0)
7207
7207
  break;
7208
- o.push(new Ws(I));
7208
+ o.push(new Ws(O));
7209
7209
  }
7210
7210
  o.push(() => {
7211
7211
  if (p)
@@ -7249,7 +7249,7 @@ class Ws {
7249
7249
  }
7250
7250
  }
7251
7251
  h(Ws, "jc");
7252
- class Ko extends Tt {
7252
+ class Ko extends Mt {
7253
7253
  constructor(t, s) {
7254
7254
  super(t, s);
7255
7255
  h(this, "streams");
@@ -7405,7 +7405,7 @@ function Go() {
7405
7405
  }
7406
7406
  });
7407
7407
  }
7408
- class Ct {
7408
+ class It {
7409
7409
  constructor(e, t, s) {
7410
7410
  h(this, "jsm");
7411
7411
  h(this, "js");
@@ -7475,67 +7475,67 @@ class Ct {
7475
7475
  s = s || {
7476
7476
  timeout: i.timeout
7477
7477
  }, 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;
7478
+ const { timeout: n, previousRevision: o } = s, a = this.js.nc.info, d = (a == null ? void 0 : a.max_payload) || 1024;
7479
7479
  e = e || {}, e.options = e.options || {};
7480
7480
  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;
7481
+ p = p > d ? d : p, e.options.max_chunk_size = p;
7482
7482
  const g = await this.info(e.name), { name: y, error: x } = this._checkNotEmpty(e.name);
7483
7483
  if (x)
7484
7484
  return Promise.reject(x);
7485
- const A = Ge.next(), I = this._chunkSubject(A), N = this._metaSubject(y), J = Object.assign({
7485
+ const A = Ge.next(), O = this._chunkSubject(A), j = this._metaSubject(y), B = Object.assign({
7486
7486
  bucket: this.name,
7487
7487
  nuid: A,
7488
7488
  size: 0,
7489
7489
  chunks: 0
7490
- }, Jr(e)), ee = Y(), L = [], Q = new ft();
7490
+ }, Jr(e)), Q = Y(), L = [], ee = new ft();
7491
7491
  try {
7492
- const w = t ? t.getReader() : null, j = Nr.create();
7492
+ const w = t ? t.getReader() : null, R = Nr.create();
7493
7493
  for (; ; ) {
7494
- const { done: F, value: R } = w ? await w.read() : {
7494
+ const { done: F, value: N } = w ? await w.read() : {
7495
7495
  done: !0,
7496
7496
  value: void 0
7497
7497
  };
7498
7498
  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, $, {
7499
+ if (ee.size() > 0) {
7500
+ const $ = ee.drain();
7501
+ R.update($), B.chunks++, B.size += $.length, L.push(this.js.publish(O, $, {
7502
7502
  timeout: n
7503
7503
  }));
7504
7504
  }
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;
7505
+ await Promise.all(L), L.length = 0, B.mtime = (/* @__PURE__ */ new Date()).toISOString();
7506
+ const P = ct.encode(R.digest());
7507
+ B.digest = `${Dr}${P}`, B.deleted = !1;
7508
7508
  const U = Fe();
7509
7509
  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), {
7510
+ const q = await this.js.publish(j, Oe().encode(B), {
7511
7511
  headers: U,
7512
7512
  timeout: n
7513
7513
  });
7514
- if (J.revision = q.seq, g)
7514
+ if (B.revision = q.seq, g)
7515
7515
  try {
7516
7516
  await this.jsm.streams.purge(this.stream, {
7517
7517
  filter: `$O.${this.name}.C.${g.nuid}`
7518
7518
  });
7519
7519
  } catch {
7520
7520
  }
7521
- ee.resolve(new Ts(J));
7521
+ Q.resolve(new Ts(B));
7522
7522
  break;
7523
7523
  }
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, {
7524
+ if (N)
7525
+ for (ee.fill(N); ee.size() > p; ) {
7526
+ B.chunks++, B.size += p;
7527
+ const P = ee.drain(e.options.max_chunk_size);
7528
+ R.update(P), L.push(this.js.publish(O, P, {
7529
7529
  timeout: n
7530
7530
  }));
7531
7531
  }
7532
7532
  }
7533
7533
  } catch (w) {
7534
7534
  await this.jsm.streams.purge(this.stream, {
7535
- filter: I
7536
- }), ee.reject(w);
7535
+ filter: O
7536
+ }), Q.reject(w);
7537
7537
  }
7538
- return ee;
7538
+ return Q;
7539
7539
  }
7540
7540
  putBlob(e, t, s) {
7541
7541
  function i(n) {
@@ -7555,8 +7555,8 @@ class Ct {
7555
7555
  async function t(n) {
7556
7556
  const o = new ft(), a = n.getReader();
7557
7557
  for (; ; ) {
7558
- const { done: f, value: p } = await a.read();
7559
- if (f)
7558
+ const { done: d, value: p } = await a.read();
7559
+ if (d)
7560
7560
  return o.drain();
7561
7561
  p && p.length && o.fill(p);
7562
7562
  }
@@ -7578,7 +7578,7 @@ class Ct {
7578
7578
  const y = t.options.link.name || "";
7579
7579
  if (y === "")
7580
7580
  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);
7581
+ return (t.options.link.bucket !== this.name ? await It.create(this.js, t.options.link.bucket) : this).get(y);
7582
7582
  }
7583
7583
  if (!t.digest.startsWith(Dr))
7584
7584
  return Promise.reject(new Error(`unknown digest type: ${t.digest}`));
@@ -7594,10 +7594,10 @@ class Ct {
7594
7594
  let o;
7595
7595
  const a = ze();
7596
7596
  a.orderedConsumer();
7597
- const f = Nr.create(), p = `$O.${this.name}.C.${t.nuid}`, g = await this.js.subscribe(p, a);
7597
+ const d = Nr.create(), p = `$O.${this.name}.C.${t.nuid}`, g = await this.js.subscribe(p, a);
7598
7598
  return (async () => {
7599
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());
7600
+ y.data.length > 0 && (d.update(y.data), o.enqueue(y.data)), y.info.pending === 0 && (xn(s, d.digest()) ? o.close() : o.error(new Error(`received a corrupt object, digests do not match received: ${t.digest} calculated ${s}`)), g.unsubscribe());
7601
7601
  })().then(() => {
7602
7602
  i.resolve();
7603
7603
  }).catch((y) => {
@@ -7612,7 +7612,7 @@ class Ct {
7612
7612
  }), n;
7613
7613
  }
7614
7614
  linkStore(e, t) {
7615
- if (!(t instanceof Ct))
7615
+ if (!(t instanceof It))
7616
7616
  return Promise.reject("bucket required");
7617
7617
  const s = t, { name: i, error: n } = this._checkNotEmpty(e);
7618
7618
  if (n)
@@ -7649,8 +7649,8 @@ class Ct {
7649
7649
  }
7650
7650
  };
7651
7651
  await this.js.publish(this._metaSubject(e), JSON.stringify(a));
7652
- const f = await this.info(e);
7653
- return Promise.resolve(f);
7652
+ const d = await this.info(e);
7653
+ return Promise.resolve(d);
7654
7654
  }
7655
7655
  async delete(e) {
7656
7656
  const t = await this.rawInfo(e);
@@ -7678,8 +7678,8 @@ class Ct {
7678
7678
  if (n)
7679
7679
  return Promise.reject(n);
7680
7680
  if (e !== t.name) {
7681
- const f = await this.info(t.name);
7682
- if (f && !f.deleted)
7681
+ const d = await this.info(t.name);
7682
+ if (d && !d.deleted)
7683
7683
  return Promise.reject(new Error("an object already exists with that name"));
7684
7684
  }
7685
7685
  t.name = i;
@@ -7696,14 +7696,14 @@ class Ct {
7696
7696
  await this.jsm.streams.getMessage(this.stream, {
7697
7697
  last_by_subj: i
7698
7698
  });
7699
- } catch (f) {
7700
- f.code === "404" ? (s.push(null), t = !0) : s.stop(f);
7699
+ } catch (d) {
7700
+ d.code === "404" ? (s.push(null), t = !0) : s.stop(d);
7701
7701
  }
7702
7702
  const n = Oe(), o = ze();
7703
- o.orderedConsumer(), e.includeHistory ? o.deliverLastPerSubject() : (t = !0, o.deliverNew()), o.callback((f, p) => {
7703
+ o.orderedConsumer(), e.includeHistory ? o.deliverLastPerSubject() : (t = !0, o.deliverNew()), o.callback((d, p) => {
7704
7704
  var g;
7705
- if (f) {
7706
- s.stop(f);
7705
+ if (d) {
7706
+ s.stop(d);
7707
7707
  return;
7708
7708
  }
7709
7709
  if (p !== null) {
@@ -7716,8 +7716,8 @@ class Ct {
7716
7716
  a.unsubscribe();
7717
7717
  }), a.closed.then(() => {
7718
7718
  s.stop();
7719
- }).catch((f) => {
7720
- s.stop(f);
7719
+ }).catch((d) => {
7720
+ s.stop(d);
7721
7721
  }), s;
7722
7722
  }
7723
7723
  _chunkSubject(e) {
@@ -7740,7 +7740,7 @@ class Ct {
7740
7740
  const s = Object.assign({
7741
7741
  max_age: t
7742
7742
  }, 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 = [
7743
+ s.name = this.stream, s.num_replicas = e.replicas ?? 1, s.allow_direct = !0, s.allow_rollup_hdrs = !0, s.discard = jt.New, s.subjects = [
7744
7744
  `$O.${this.name}.C.>`,
7745
7745
  `$O.${this.name}.M.>`
7746
7746
  ], e.placement && (s.placement = e.placement), e.metadata && (s.metadata = e.metadata), typeof e.compression == "boolean" && (s.compression = e.compression ? Ve.S2 : Ve.None);
@@ -7751,7 +7751,7 @@ class Ct {
7751
7751
  }
7752
7752
  }
7753
7753
  static async create(e, t, s = {}) {
7754
- const i = await e.jetstreamManager(), n = new Ct(t, i, e);
7754
+ const i = await e.jetstreamManager(), n = new It(t, i, e);
7755
7755
  return await n.init(s), Promise.resolve(n);
7756
7756
  }
7757
7757
  }
@@ -7761,18 +7761,18 @@ class Vo {
7761
7761
  this.js = e;
7762
7762
  }
7763
7763
  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`));
7764
+ const s = this.js, { ok: i, min: n } = s.nc.features.get(J.JS_KV);
7765
+ return i ? t.bindOnly ? Nt.bind(this.js, e, t) : Nt.create(this.js, e, t) : Promise.reject(new Error(`kv is only supported on servers ${n} or better`));
7766
7766
  }
7767
7767
  os(e, t = {}) {
7768
7768
  var o;
7769
7769
  if (typeof ((o = crypto == null ? void 0 : crypto.subtle) == null ? void 0 : o.digest) != "function")
7770
7770
  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`));
7771
+ const s = this.js, { ok: i, min: n } = s.nc.features.get(J.JS_OBJECTSTORE);
7772
+ return i ? It.create(this.js, e, t) : Promise.reject(new Error(`objectstore is only supported on servers ${n} or better`));
7773
7773
  }
7774
7774
  }
7775
- class rr extends Tt {
7775
+ class rr extends Mt {
7776
7776
  constructor(t, s) {
7777
7777
  super(t, s);
7778
7778
  h(this, "consumers");
@@ -7800,15 +7800,15 @@ class rr extends Tt {
7800
7800
  i && (i.msgID && n.set(Ue.MsgIdHdr, i.msgID), i.expect.lastMsgID && n.set(Ue.ExpectedLastMsgIdHdr, i.expect.lastMsgID), i.expect.streamName && n.set(Ue.ExpectedStreamHdr, i.expect.streamName), typeof i.expect.lastSequence == "number" && n.set(Ue.ExpectedLastSeqHdr, `${i.expect.lastSequence}`), typeof i.expect.lastSubjectSequence == "number" && n.set(Ue.ExpectedLastSubjectSequenceHdr, `${i.expect.lastSubjectSequence}`));
7801
7801
  const o = i.timeout || this.timeout, a = {};
7802
7802
  o && (a.timeout = o), i && (a.headers = n);
7803
- let { retries: f, retry_delay: p } = i;
7804
- f = f || 1, p = p || 250;
7803
+ let { retries: d, retry_delay: p } = i;
7804
+ d = d || 1, p = p || 250;
7805
7805
  let g;
7806
- for (let x = 0; x < f; x++)
7806
+ for (let x = 0; x < d; x++)
7807
7807
  try {
7808
7808
  g = await this.nc.request(t, s, a);
7809
7809
  break;
7810
7810
  } catch (A) {
7811
- if (A.code === "503" && x + 1 < f)
7811
+ if (A.code === "503" && x + 1 < d)
7812
7812
  await dt(p);
7813
7813
  else
7814
7814
  throw A;
@@ -7829,24 +7829,24 @@ class rr extends Tt {
7829
7829
  }, a = await this.nc.request(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${s}`, this.jc.encode(o), {
7830
7830
  noMux: !0,
7831
7831
  timeout: n
7832
- }), f = at(a);
7833
- if (f)
7834
- throw f;
7835
- return Nt(a, this.timeout);
7832
+ }), d = at(a);
7833
+ if (d)
7834
+ throw d;
7835
+ return Tt(a, this.timeout);
7836
7836
  }
7837
7837
  fetch(t, s, i = {}) {
7838
7838
  pe(t), ot(s);
7839
7839
  let n = null;
7840
7840
  const o = (i.max_bytes ?? 0) > 0;
7841
7841
  let a = 0;
7842
- const f = o ? i.max_bytes : 0;
7842
+ const d = o ? i.max_bytes : 0;
7843
7843
  let p = null;
7844
7844
  const g = {};
7845
- if (g.batch = i.batch || 1, f) {
7846
- const L = this.nc.features.get(H.JS_PULL_MAX_BYTES);
7845
+ if (g.batch = i.batch || 1, d) {
7846
+ const L = this.nc.features.get(J.JS_PULL_MAX_BYTES);
7847
7847
  if (!L.ok)
7848
7848
  throw new Error(`max_bytes is only supported on servers ${L.min} or better`);
7849
- g.max_bytes = f;
7849
+ g.max_bytes = d;
7850
7850
  }
7851
7851
  g.no_wait = i.no_wait || !1, g.no_wait && g.expires && (g.expires = 0);
7852
7852
  const y = i.expires || 0;
@@ -7854,23 +7854,23 @@ class rr extends Tt {
7854
7854
  throw new Error("expires or no_wait is required");
7855
7855
  const x = i.idle_heartbeat || 0;
7856
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) => {
7857
+ const A = new he(), O = g.batch;
7858
+ let j = 0;
7859
+ A.protocolFilterFn = (L, ee = !1) => Ls(L.msg) ? (p == null || p.work(), !1) : !0, A.dispatchedFn = (L) => {
7860
7860
  if (L) {
7861
- if (o && (a += L.data.length), N++, n && L.info.pending === 0)
7861
+ if (o && (a += L.data.length), j++, n && L.info.pending === 0)
7862
7862
  return;
7863
- (A.getPending() === 1 && L.info.pending === 0 || I === N || f > 0 && a >= f) && A.stop();
7863
+ (A.getPending() === 1 && L.info.pending === 0 || O === j || d > 0 && a >= d) && A.stop();
7864
7864
  }
7865
7865
  };
7866
- const J = qe(this.nc.options.inboxPrefix), ee = this.nc.subscribe(J, {
7866
+ const B = qe(this.nc.options.inboxPrefix), Q = this.nc.subscribe(B, {
7867
7867
  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)));
7868
+ callback: (L, ee) => {
7869
+ L === null && (L = at(ee)), L !== null ? (n && (n.cancel(), n = null), tn(L) ? A.stop(bi(L) === null ? void 0 : L) : A.stop(L)) : (p == null || p.work(), A.received++, A.push(Tt(ee, this.timeout)));
7870
7870
  }
7871
7871
  });
7872
7872
  return y && (n = ut(y), n.catch(() => {
7873
- ee.isClosed() || (ee.drain().catch(() => {
7873
+ Q.isClosed() || (Q.drain().catch(() => {
7874
7874
  }), n = null), p && p.cancel();
7875
7875
  })), (async () => {
7876
7876
  try {
@@ -7879,9 +7879,9 @@ class rr extends Tt {
7879
7879
  }), !0)));
7880
7880
  } catch {
7881
7881
  }
7882
- await ee.closed, n !== null && (n.cancel(), n = null), p && p.cancel(), A.stop();
7882
+ await Q.closed, n !== null && (n.cancel(), n = null), p && p.cancel(), A.stop();
7883
7883
  })().catch(), this.nc.publish(`${this.prefix}.CONSUMER.MSG.NEXT.${t}.${s}`, this.jc.encode(g), {
7884
- reply: J
7884
+ reply: B
7885
7885
  }), A;
7886
7886
  }
7887
7887
  async pullSubscribe(t, s = ze()) {
@@ -7897,8 +7897,8 @@ class rr extends Tt {
7897
7897
  a.info = i;
7898
7898
  try {
7899
7899
  await this._maybeCreateConsumer(i);
7900
- } catch (f) {
7901
- throw a.unsubscribe(), f;
7900
+ } catch (d) {
7901
+ throw a.unsubscribe(), d;
7902
7902
  }
7903
7903
  return a;
7904
7904
  }
@@ -7982,14 +7982,14 @@ class rr extends Tt {
7982
7982
  }
7983
7983
  static ingestionFn(t) {
7984
7984
  return (s, i) => {
7985
- var f;
7985
+ var d;
7986
7986
  const n = i;
7987
7987
  if (!s) return {
7988
7988
  ingest: !1,
7989
7989
  protocol: !1
7990
7990
  };
7991
7991
  const o = s;
7992
- if (at(o.msg) || (f = n.monitor) == null || f.work(), Ls(o.msg)) {
7992
+ if (at(o.msg) || (d = n.monitor) == null || d.work(), Ls(o.msg)) {
7993
7993
  const p = t ? n._checkHbOrderConsumer(o.msg) : !0;
7994
7994
  return t || n.info.flow_control.heartbeat_count++, {
7995
7995
  ingest: p,
@@ -8077,62 +8077,62 @@ class ir {
8077
8077
  const i = !this.protocol.options.noAsyncTraces;
8078
8078
  try {
8079
8079
  this._check(e, !0, !0);
8080
- } catch (f) {
8081
- return Promise.reject(f);
8080
+ } catch (d) {
8081
+ return Promise.reject(d);
8082
8082
  }
8083
8083
  if (s.strategy = s.strategy || Ne.Timer, s.maxWait = s.maxWait || 1e3, s.maxWait < 1)
8084
8084
  return Promise.reject(new T("timeout", k.InvalidOption));
8085
8085
  const n = new he();
8086
- function o(f) {
8086
+ function o(d) {
8087
8087
  n.push(() => {
8088
- n.stop(f);
8088
+ n.stop(d);
8089
8089
  });
8090
8090
  }
8091
- function a(f, p) {
8092
- f || p === null ? o(f === null ? void 0 : f) : n.push(p);
8091
+ function a(d, p) {
8092
+ d || p === null ? o(d === null ? void 0 : d) : n.push(p);
8093
8093
  }
8094
8094
  if (s.noMux) {
8095
- const f = i ? new Error().stack : null;
8095
+ const d = i ? new Error().stack : null;
8096
8096
  let p = typeof s.maxMessages == "number" && s.maxMessages > 0 ? s.maxMessages : -1;
8097
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 += `
8098
+ callback: (O, j) => {
8099
+ var B, Q;
8100
+ if (((B = j == null ? void 0 : j.data) == null ? void 0 : B.length) === 0 && ((Q = j == null ? void 0 : j.headers) == null ? void 0 : Q.status) === k.NoResponders && (O = T.errorForCode(k.NoResponders)), O) {
8101
+ d && (O.stack += `
8102
8102
 
8103
- ${f}`), y(I);
8103
+ ${d}`), y(O);
8104
8104
  return;
8105
8105
  }
8106
- a(null, N), s.strategy === Ne.Count && (p--, p === 0 && y()), s.strategy === Ne.JitterTimer && (A(), x = setTimeout(() => {
8106
+ a(null, j), s.strategy === Ne.Count && (p--, p === 0 && y()), s.strategy === Ne.JitterTimer && (A(), x = setTimeout(() => {
8107
8107
  y();
8108
- }, 300)), s.strategy === Ne.SentinelMsg && N && N.data.length === 0 && y();
8108
+ }, 300)), s.strategy === Ne.SentinelMsg && j && j.data.length === 0 && y();
8109
8109
  }
8110
8110
  });
8111
8111
  g.requestSubject = e, g.closed.then(() => {
8112
8112
  o();
8113
- }).catch((I) => {
8114
- n.stop(I);
8113
+ }).catch((O) => {
8114
+ n.stop(O);
8115
8115
  });
8116
- const y = (I) => {
8117
- I && n.push(() => {
8118
- throw I;
8116
+ const y = (O) => {
8117
+ O && n.push(() => {
8118
+ throw O;
8119
8119
  }), A(), g.drain().then(() => {
8120
8120
  o();
8121
- }).catch((N) => {
8121
+ }).catch((j) => {
8122
8122
  o();
8123
8123
  });
8124
8124
  };
8125
8125
  n.iterClosed.then(() => {
8126
8126
  A(), g == null || g.unsubscribe();
8127
- }).catch((I) => {
8127
+ }).catch((O) => {
8128
8128
  A(), g == null || g.unsubscribe();
8129
8129
  });
8130
8130
  try {
8131
8131
  this.publish(e, t, {
8132
8132
  reply: g.getSubject()
8133
8133
  });
8134
- } catch (I) {
8135
- y(I);
8134
+ } catch (O) {
8135
+ y(O);
8136
8136
  }
8137
8137
  let x = setTimeout(() => {
8138
8138
  y();
@@ -8141,13 +8141,13 @@ ${f}`), y(I);
8141
8141
  x && clearTimeout(x);
8142
8142
  };
8143
8143
  } else {
8144
- const f = s;
8145
- f.callback = a, n.iterClosed.then(() => {
8144
+ const d = s;
8145
+ d.callback = a, n.iterClosed.then(() => {
8146
8146
  p.cancel();
8147
8147
  }).catch((g) => {
8148
8148
  p.cancel(g);
8149
8149
  });
8150
- const p = new Sn(this.protocol.muxSubscriptions, e, f);
8150
+ const p = new Sn(this.protocol.muxSubscriptions, e, d);
8151
8151
  this.protocol.request(p);
8152
8152
  try {
8153
8153
  this.publish(e, t, {
@@ -8175,18 +8175,18 @@ ${f}`), y(I);
8175
8175
  if (!s.noMux && s.reply)
8176
8176
  return Promise.reject(new T("reply can only be used with noMux", k.InvalidOption));
8177
8177
  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, {
8178
+ const n = s.reply ? s.reply : qe(this.options.inboxPrefix), o = Y(), a = i ? new Error() : null, d = this.subscribe(n, {
8179
8179
  max: 1,
8180
8180
  timeout: s.timeout,
8181
8181
  callback: (p, g) => {
8182
8182
  p ? (a && p.code !== k.Timeout && (p.stack += `
8183
8183
 
8184
- ${a.stack}`), f.unsubscribe(), o.reject(p)) : (p = ei(g), p ? (a && (p.stack += `
8184
+ ${a.stack}`), d.unsubscribe(), o.reject(p)) : (p = ei(g), p ? (a && (p.stack += `
8185
8185
 
8186
8186
  ${a.stack}`), o.reject(p)) : o.resolve(g));
8187
8187
  }
8188
8188
  });
8189
- return f.requestSubject = e, this.protocol.publish(e, t, {
8189
+ return d.requestSubject = e, this.protocol.publish(e, t, {
8190
8190
  reply: n,
8191
8191
  headers: s.headers
8192
8192
  }), o;
@@ -8288,7 +8288,7 @@ class Wo {
8288
8288
  }
8289
8289
  add(e) {
8290
8290
  try {
8291
- return new Mt(this.nc, e).start();
8291
+ return new Ut(this.nc, e).start();
8292
8292
  } catch (t) {
8293
8293
  return Promise.reject(t);
8294
8294
  }
@@ -8395,11 +8395,11 @@ class mi extends Pn {
8395
8395
  const a = `${n.api.prefix}.CONSUMER.CREATE.${n.stream}`;
8396
8396
  this.js._request(a, o, {
8397
8397
  retries: -1
8398
- }).then((f) => {
8399
- const p = f, g = this.sub.info;
8398
+ }).then((d) => {
8399
+ const p = d, g = this.sub.info;
8400
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);
8401
+ }).catch((d) => {
8402
+ const p = new T(`unable to recreate ordered consumer ${n.stream} at seq ${t}`, k.RequestError, d);
8403
8403
  this.sub.callback(p, {});
8404
8404
  });
8405
8405
  }
@@ -8416,14 +8416,14 @@ class mi extends Pn {
8416
8416
  s && (i.cancelAfter = s);
8417
8417
  const n = this.sub, o = (a) => {
8418
8418
  var g, y, x, A;
8419
- const f = on(409, `${Pe.IdleHeartbeatMissed}: ${a}`, this.sub.subject);
8419
+ const d = on(409, `${Pe.IdleHeartbeatMissed}: ${a}`, this.sub.subject);
8420
8420
  if (!((g = this.info) == null ? void 0 : g.ordered))
8421
- this.sub.callback(null, f);
8421
+ this.sub.callback(null, d);
8422
8422
  else {
8423
8423
  if (!this.js.nc.protocol.connected)
8424
8424
  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;
8425
+ const O = ((x = (y = this.info) == null ? void 0 : y.ordered_consumer_sequence) == null ? void 0 : x.stream_seq) || 0;
8426
+ return this._resetOrderedConsumer(O + 1), (A = this.monitor) == null || A.restart(), !1;
8427
8427
  }
8428
8428
  return !n.noIterator;
8429
8429
  };
@@ -8458,20 +8458,20 @@ class Zo extends mi {
8458
8458
  }) {
8459
8459
  const { stream: t, config: s, name: i } = this.sub.info, n = s.durable_name ?? i, o = {};
8460
8460
  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);
8461
+ const p = this.js.nc.features.get(J.JS_PULL_MAX_BYTES);
8462
8462
  if (!p.ok)
8463
8463
  throw new Error(`max_bytes is only supported on servers ${p.min} or better`);
8464
8464
  o.max_bytes = e.max_bytes;
8465
8465
  }
8466
8466
  let a = 0;
8467
8467
  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)
8468
+ let d = 0;
8469
+ if (e.idle_heartbeat && e.idle_heartbeat > 0 && (d = e.idle_heartbeat, o.idle_heartbeat = W(d)), d && a === 0)
8470
8470
  throw new Error("idle_heartbeat requires expires");
8471
- if (f > a)
8471
+ if (d > a)
8472
8472
  throw new Error("expires must be greater than idle_heartbeat");
8473
8473
  if (this.info) {
8474
- this.monitor && this.monitor.cancel(), a && f && (this.monitor ? this.monitor._change(f, a) : this._setupHbMonitoring(f, a));
8474
+ this.monitor && this.monitor.cancel(), a && d && (this.monitor ? this.monitor._change(d, a) : this._setupHbMonitoring(d, a));
8475
8475
  const p = this.info.api, g = `${p.prefix}.CONSUMER.MSG.NEXT.${t}.${n}`, y = this.sub.subject;
8476
8476
  p.nc.publish(g, p.jc.encode(o), {
8477
8477
  reply: y
@@ -8491,7 +8491,7 @@ function ea(r) {
8491
8491
  null
8492
8492
  ] : [
8493
8493
  null,
8494
- Nt(t, r)
8494
+ Tt(t, r)
8495
8495
  ]);
8496
8496
  }
8497
8497
  function ta(r) {
@@ -8507,7 +8507,7 @@ function ta(r) {
8507
8507
  null
8508
8508
  ] : [
8509
8509
  null,
8510
- Nt(t, r)
8510
+ Tt(t, r)
8511
8511
  ];
8512
8512
  };
8513
8513
  }
@@ -8587,16 +8587,16 @@ class ia {
8587
8587
  n.publish(this.msg.reply, Hr, {
8588
8588
  reply: `${n.muxSubscriptions.baseInbox}${a.token}`
8589
8589
  });
8590
- } catch (f) {
8591
- a.cancel(f);
8590
+ } catch (d) {
8591
+ a.cancel(d);
8592
8592
  }
8593
8593
  try {
8594
8594
  await Promise.race([
8595
8595
  a.timer,
8596
8596
  a.deferred
8597
8597
  ]), t.resolve(!0);
8598
- } catch (f) {
8599
- a.cancel(f), t.reject(f);
8598
+ } catch (d) {
8599
+ a.cancel(d), t.reject(d);
8600
8600
  }
8601
8601
  } else
8602
8602
  t.resolve(!1);
@@ -8675,13 +8675,13 @@ class aa {
8675
8675
  }
8676
8676
  const o = ft.concat(...this.yields), a = Rn(o);
8677
8677
  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"));
8678
+ const d = wo.exec(a);
8679
+ if (!d) {
8680
+ t.debug && console.error("!!!", zt(o)), s.reject(new Error("unexpected response from server"));
8681
8681
  return;
8682
8682
  }
8683
8683
  try {
8684
- const p = JSON.parse(f[1]);
8684
+ const p = JSON.parse(d[1]);
8685
8685
  _o(p, this.options), this.peeked = !0, this.connected = !0, this.signal.resolve(), s.resolve();
8686
8686
  } catch (p) {
8687
8687
  s.reject(p);
@@ -8731,7 +8731,7 @@ class aa {
8731
8731
  const e = this.yields;
8732
8732
  this.yields = [];
8733
8733
  for (let t = 0; t < e.length; t++)
8734
- this.options.debug && console.info(`> ${Kt(e[t])}`), yield e[t];
8734
+ this.options.debug && console.info(`> ${zt(e[t])}`), yield e[t];
8735
8735
  if (this.done)
8736
8736
  break;
8737
8737
  this.yields.length === 0 && (e.length = 0, this.yields = e, this.signal = Y());
@@ -8743,10 +8743,10 @@ class aa {
8743
8743
  send(e) {
8744
8744
  if (!this.isDiscarded())
8745
8745
  try {
8746
- this.socket.send(e.buffer), this.options.debug && console.info(`< ${Kt(e)}`);
8746
+ this.socket.send(e.buffer), this.options.debug && console.info(`< ${zt(e)}`);
8747
8747
  return;
8748
8748
  } catch (t) {
8749
- this.options.debug && console.error(`!!! ${Kt(e)}: ${t}`);
8749
+ this.options.debug && console.error(`!!! ${zt(e)}: ${t}`);
8750
8750
  }
8751
8751
  }
8752
8752
  close(e) {
@@ -8773,7 +8773,7 @@ function ca(r, e) {
8773
8773
  const i = s.protocol.toLowerCase();
8774
8774
  i === "ws:" && (e = !1), i === "wss:" && (e = !0), i !== "https:" && i !== "http" && (r = r.replace(/^(.*:\/\/)(.*)/gm, "$2"), s = new URL(`http://${r}`));
8775
8775
  let n, o;
8776
- const a = s.hostname, f = s.pathname, p = s.search || "";
8776
+ const a = s.hostname, d = s.pathname, p = s.search || "";
8777
8777
  switch (i) {
8778
8778
  case "http:":
8779
8779
  case "ws:":
@@ -8789,7 +8789,7 @@ function ca(r, e) {
8789
8789
  o = s.port || e === !0 ? "443" : "80", n = e === !0 ? "wss:" : "ws:";
8790
8790
  break;
8791
8791
  }
8792
- return `${n}//${a}:${o}${f}${p}`;
8792
+ return `${n}//${a}:${o}${d}${p}`;
8793
8793
  }
8794
8794
  function ha(r = {}) {
8795
8795
  return kn({
@@ -8818,8 +8818,8 @@ class Kr {
8818
8818
  }
8819
8819
  async connect(e = {}) {
8820
8820
  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)
8821
+ const { natsWsUrls: t, user: s, prefix: i, accessToken: n, sessionSeed: o } = e, a = t ?? [this.config.natsUrl], d = n ?? await this.config.auth.getAccessToken();
8822
+ if (!d)
8823
8823
  throw new Error("Please provide auth token");
8824
8824
  const p = o ?? await this.config.auth.getSessionSeed();
8825
8825
  if (!p)
@@ -8828,7 +8828,7 @@ class Kr {
8828
8828
  this.nc = await ha({
8829
8829
  servers: a,
8830
8830
  authenticator: fo(
8831
- f,
8831
+ d,
8832
8832
  g.encode(p)
8833
8833
  )
8834
8834
  });
@@ -8841,16 +8841,16 @@ class Kr {
8841
8841
  "[nats] connected.",
8842
8842
  this.globalPrefix ? `(prefix: ${this.globalPrefix})` : ""
8843
8843
  ), (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) {
8844
+ var A, O;
8845
+ for await (const j of this.nc.status())
8846
+ switch (j.type !== He.PingTimer && console.log("[nats] connection status:", j.type), j.type) {
8847
8847
  case ke.Reconnect:
8848
8848
  (A = this.onStatusChange) == null || A.call(this, !0);
8849
8849
  break;
8850
8850
  case ke.Disconnect:
8851
8851
  case ke.Error:
8852
8852
  case He.Reconnecting:
8853
- (I = this.onStatusChange) == null || I.call(this, !1);
8853
+ (O = this.onStatusChange) == null || O.call(this, !1);
8854
8854
  break;
8855
8855
  }
8856
8856
  })();
@@ -8900,9 +8900,9 @@ class Kr {
8900
8900
  continue;
8901
8901
  }
8902
8902
  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);
8903
+ const d = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], g = a[a.length - 1], y = Be.decode(o.data);
8904
8904
  t(y, {
8905
- subject: f,
8905
+ subject: d,
8906
8906
  userId: p,
8907
8907
  sessionId: g
8908
8908
  });
@@ -8928,10 +8928,10 @@ class Kr {
8928
8928
  continue;
8929
8929
  }
8930
8930
  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);
8931
+ const d = a.slice(0, a.length - 2).join("."), p = a[a.length - 2], g = a[a.length - 1], y = Be.decode(o.data);
8932
8932
  try {
8933
8933
  const x = await t(y, {
8934
- subject: f,
8934
+ subject: d,
8935
8935
  userId: p,
8936
8936
  sessionId: g
8937
8937
  });
@@ -8992,50 +8992,50 @@ function _i(r) {
8992
8992
  }
8993
8993
  class ua {
8994
8994
  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
8995
+ const i = [], n = crypto.randomUUID(), o = await pa(
8996
+ Et.TRUSTED_CLIENT_TOKEN
8997
+ );
8998
+ return new Promise((a, d) => {
8999
+ const p = `${Et.WSS_URL}?TrustedClientToken=${Et.TRUSTED_CLIENT_TOKEN}&Sec-MS-GEC=${o}&Sec-MS-GEC-Version=1-130.0.2849.68&ConnectionId=${n}`, g = new WebSocket(p);
9000
+ g.binaryType = "arraybuffer";
9001
+ const y = fa(e, t, s);
9002
+ g.addEventListener("open", () => {
9003
+ const x = la();
9004
+ g.send(x);
9005
+ const A = `X-RequestId:${n}\r
9006
9006
  Content-Type:application/ssml+xml\r
9007
9007
  X-Timestamp:${(/* @__PURE__ */ new Date()).toISOString()}Z\r
9008
9008
  Path:ssml\r
9009
9009
  \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);
9010
+ ` + y;
9011
+ g.send(A);
9012
+ }), g.addEventListener("message", (x) => {
9013
+ const A = x.data;
9014
+ if (A instanceof ArrayBuffer) {
9015
+ const O = new Uint8Array(A), j = new TextEncoder().encode(`Path:audio\r
9016
+ `), B = da(O, j);
9017
+ if (B !== -1) {
9018
+ const L = O.subarray(B + j.length);
9019
+ i.push(L);
9020
9020
  }
9021
- new TextDecoder().decode(x).includes("Path:turn.end") && f.close();
9021
+ new TextDecoder().decode(O).includes("Path:turn.end") && g.close();
9022
9022
  } else
9023
- y.includes("Path:turn.end") && f.close();
9024
- }), f.addEventListener("close", () => {
9023
+ A.includes("Path:turn.end") && g.close();
9024
+ }), g.addEventListener("close", () => {
9025
9025
  if (!i.length) {
9026
- a("No audio data available to save.");
9026
+ d("No audio data available to save.");
9027
9027
  return;
9028
9028
  }
9029
- const g = i.reduce(
9030
- (A, I) => A + I.length,
9029
+ const x = i.reduce(
9030
+ (j, B) => j + B.length,
9031
9031
  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);
9032
+ ), A = new Uint8Array(x);
9033
+ let O = 0;
9034
+ for (const j of i)
9035
+ A.set(j, O), O += j.length;
9036
+ a(A.buffer);
9037
+ }), g.addEventListener("error", (x) => {
9038
+ d(x);
9039
9039
  });
9040
9040
  });
9041
9041
  }
@@ -9046,7 +9046,7 @@ Path:ssml\r
9046
9046
  }
9047
9047
  async getVoices() {
9048
9048
  return (await (await fetch(
9049
- `${Wt.VOICES_URL}?trustedclienttoken=${Wt.TRUSTED_CLIENT_TOKEN}`
9049
+ `${Et.VOICES_URL}?trustedclienttoken=${Et.TRUSTED_CLIENT_TOKEN}`
9050
9050
  )).json()).map((s) => ({
9051
9051
  id: s.ShortName,
9052
9052
  locale: s.Locale,
@@ -9054,7 +9054,7 @@ Path:ssml\r
9054
9054
  }));
9055
9055
  }
9056
9056
  }
9057
- const Wt = {
9057
+ const Et = {
9058
9058
  TRUSTED_CLIENT_TOKEN: "6A5AA1D4EAFF4E9FB37E23D68491D6F4",
9059
9059
  WSS_URL: "wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1",
9060
9060
  VOICES_URL: "https://speech.platform.bing.com/consumer/speech/synthesize/readaloud/voices/list"
@@ -9080,7 +9080,11 @@ function da(r, e) {
9080
9080
  }
9081
9081
  return -1;
9082
9082
  }
9083
- class ma {
9083
+ const pa = async (r) => {
9084
+ const e = Math.floor(Date.now() / 1e3) + 11644473600, s = (e - e % 300) * 1e7, n = new TextEncoder().encode(`${s}${r}`), o = await crypto.subtle.digest("SHA-256", n);
9085
+ return Array.from(new Uint8Array(o)).map((a) => a.toString(16).padStart(2, "0")).join("").toUpperCase();
9086
+ };
9087
+ class ba {
9084
9088
  constructor(e) {
9085
9089
  this.config = e;
9086
9090
  }
@@ -9117,10 +9121,10 @@ class ma {
9117
9121
  if (y) break;
9118
9122
  a.push(x);
9119
9123
  }
9120
- const f = a.reduce(
9124
+ const d = a.reduce(
9121
9125
  (y, x) => y + x.length,
9122
9126
  0
9123
- ), p = new Uint8Array(f);
9127
+ ), p = new Uint8Array(d);
9124
9128
  let g = 0;
9125
9129
  for (const y of a)
9126
9130
  p.set(y, g), g += y.length;
@@ -9148,7 +9152,7 @@ const yi = {
9148
9152
  authUrl: "https://auth.jok.io",
9149
9153
  natsUrl: "https://nats.jok.io",
9150
9154
  storage: new gi()
9151
- }, zr = new Xr(yi), ba = {
9155
+ }, zr = new Xr(yi), ga = {
9152
9156
  setup(r) {
9153
9157
  if (r.authUrl || r.storage) {
9154
9158
  const e = this.auth.onUserDataUpdate;
@@ -9170,6 +9174,6 @@ const yi = {
9170
9174
  };
9171
9175
  export {
9172
9176
  Kr as NatsService,
9173
- ma as VoicevoxTtsService,
9174
- ba as jok
9177
+ ba as VoicevoxTtsService,
9178
+ ga as jok
9175
9179
  };