@developer.notchatbot/webchat 1.0.5 → 1.0.6

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.
@@ -286,8 +286,8 @@ var Bl = { exports: {} }, Qe = {}, _l = { exports: {} }, zl = {};
286
286
  var z = j.length;
287
287
  j.push(U);
288
288
  e: for (; 0 < z; ) {
289
- var V = z - 1 >>> 1, G = j[V];
290
- if (0 < o(G, U)) j[V] = U, j[z] = G, z = V;
289
+ var W = z - 1 >>> 1, G = j[W];
290
+ if (0 < o(G, U)) j[W] = U, j[z] = G, z = W;
291
291
  else break e;
292
292
  }
293
293
  }
@@ -299,10 +299,10 @@ var Bl = { exports: {} }, Qe = {}, _l = { exports: {} }, zl = {};
299
299
  var U = j[0], z = j.pop();
300
300
  if (z !== U) {
301
301
  j[0] = z;
302
- e: for (var V = 0, G = j.length, F = G >>> 1; V < F; ) {
303
- var b = 2 * (V + 1) - 1, L = j[b], B = b + 1, _ = j[B];
304
- if (0 > o(L, z)) B < G && 0 > o(_, L) ? (j[V] = _, j[B] = z, V = B) : (j[V] = L, j[b] = z, V = b);
305
- else if (B < G && 0 > o(_, z)) j[V] = _, j[B] = z, V = B;
302
+ e: for (var W = 0, G = j.length, F = G >>> 1; W < F; ) {
303
+ var b = 2 * (W + 1) - 1, L = j[b], B = b + 1, _ = j[B];
304
+ if (0 > o(L, z)) B < G && 0 > o(_, L) ? (j[W] = _, j[B] = z, W = B) : (j[W] = L, j[b] = z, W = b);
305
+ else if (B < G && 0 > o(_, z)) j[W] = _, j[B] = z, W = B;
306
306
  else break e;
307
307
  }
308
308
  }
@@ -345,10 +345,10 @@ var Bl = { exports: {} }, Qe = {}, _l = { exports: {} }, zl = {};
345
345
  var z = C;
346
346
  try {
347
347
  for (h(U), R = n(m); R !== null && (!(R.expirationTime > U) || j && !x()); ) {
348
- var V = R.callback;
349
- if (typeof V == "function") {
348
+ var W = R.callback;
349
+ if (typeof W == "function") {
350
350
  R.callback = null, C = R.priorityLevel;
351
- var G = V(R.expirationTime <= U);
351
+ var G = W(R.expirationTime <= U);
352
352
  U = e.unstable_now(), typeof G == "function" ? R.callback = G : R === n(m) && r(m), h(U);
353
353
  } else r(m);
354
354
  R = n(m);
@@ -447,8 +447,8 @@ var Bl = { exports: {} }, Qe = {}, _l = { exports: {} }, zl = {};
447
447
  C = z;
448
448
  }
449
449
  }, e.unstable_scheduleCallback = function(j, U, z) {
450
- var V = e.unstable_now();
451
- switch (typeof z == "object" && z !== null ? (z = z.delay, z = typeof z == "number" && 0 < z ? V + z : V) : z = V, j) {
450
+ var W = e.unstable_now();
451
+ switch (typeof z == "object" && z !== null ? (z = z.delay, z = typeof z == "number" && 0 < z ? W + z : W) : z = W, j) {
452
452
  case 1:
453
453
  var G = -1;
454
454
  break;
@@ -464,7 +464,7 @@ var Bl = { exports: {} }, Qe = {}, _l = { exports: {} }, zl = {};
464
464
  default:
465
465
  G = 5e3;
466
466
  }
467
- return G = z + G, j = { id: T++, callback: U, priorityLevel: j, startTime: z, expirationTime: G, sortIndex: -1 }, z > V ? (j.sortIndex = z, t(S, j), n(m) === null && j === n(S) && (E ? (y(s), s = -1) : E = !0, A(w, z - V))) : (j.sortIndex = G, t(m, j), f || O || (f = !0, M(c))), j;
467
+ return G = z + G, j = { id: T++, callback: U, priorityLevel: j, startTime: z, expirationTime: G, sortIndex: -1 }, z > W ? (j.sortIndex = z, t(S, j), n(m) === null && j === n(S) && (E ? (y(s), s = -1) : E = !0, A(w, z - W))) : (j.sortIndex = G, t(m, j), f || O || (f = !0, M(c))), j;
468
468
  }, e.unstable_shouldYield = x, e.unstable_wrapCallback = function(j) {
469
469
  var U = C;
470
470
  return function() {
@@ -5838,19 +5838,20 @@ const Dh = ({
5838
5838
  ]
5839
5839
  }
5840
5840
  );
5841
+ }, jh = (e) => {
5842
+ if (e instanceof Date)
5843
+ return e;
5844
+ const t = e.endsWith("Z") ? e : `${e}Z`;
5845
+ return new Date(t);
5841
5846
  };
5842
- function jh(e) {
5847
+ function Ol(e) {
5843
5848
  if (!e) return "";
5844
- const t = new Date(e), n = t.getDate().toString().padStart(2, "0"), r = (t.getMonth() + 1).toString().padStart(2, "0"), o = t.getFullYear(), i = t.getHours().toString().padStart(2, "0"), a = t.getMinutes().toString().padStart(2, "0");
5849
+ const t = jh(e), n = t.getDate().toString().padStart(2, "0"), r = (t.getMonth() + 1).toString().padStart(2, "0"), o = t.getFullYear(), i = t.getHours().toString().padStart(2, "0"), a = t.getMinutes().toString().padStart(2, "0");
5845
5850
  return `${n}/${r}/${o} ${i}:${a}`;
5846
5851
  }
5847
- const Ol = (e) => {
5848
- var o, i;
5849
- const t = new Date(e), n = /* @__PURE__ */ new Date(), r = new Date(n);
5850
- return r.setDate(r.getDate() - 1), t.toDateString() === n.toDateString() ? (i = (o = jh(e.toString())) == null ? void 0 : o.split(" ")[1]) != null ? i : "" : t.toDateString() === r.toDateString() ? "Yesterday" : t.getFullYear() === n.getFullYear() ? t.toLocaleDateString("en-US", { month: "short", day: "numeric" }) : t.toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" });
5851
- }, Uh = ({ message: e, avatar: t }) => e.sender === "user" ? /* @__PURE__ */ J.jsx("div", { className: "nbc-flex nbc-justify-end nbc-mb-4", children: /* @__PURE__ */ J.jsxs("div", { className: "nbc-max-w-xs nbc-px-4 nbc-py-3 nbc-rounded-2xl nbc-text-sm nbc-leading-relaxed nbc-bg-gray-100 nbc-text-gray-900 nbc-rounded-br-md", children: [
5852
+ const Uh = ({ message: e, avatar: t }) => e.sender === "user" ? /* @__PURE__ */ J.jsx("div", { className: "nbc-flex nbc-justify-end nbc-mb-4", children: /* @__PURE__ */ J.jsxs("div", { className: "nbc-max-w-xs nbc-px-4 nbc-py-3 nbc-rounded-2xl nbc-text-sm nbc-leading-relaxed nbc-bg-gray-100 nbc-text-gray-900 nbc-rounded-br-md", children: [
5852
5853
  /* @__PURE__ */ J.jsx("div", { className: "nbc-whitespace-pre-wrap nbc-break-words", children: e.text }),
5853
- /* @__PURE__ */ J.jsx("div", { className: "nbc-text-xs nbc-mt-1 nbc-opacity-70 nbc-text-right", children: Ol(e.timestamp) })
5854
+ /* @__PURE__ */ J.jsx("div", { className: "nbc-text-xs nbc-mt-1 nbc-opacity-70 nbc-text-right", children: Ol(String(e.timestamp)).split(" ")[1].substring(0, 5) })
5854
5855
  ] }) }) : /* @__PURE__ */ J.jsx("div", { className: "nbc-flex nbc-justify-start nbc-mb-4", children: /* @__PURE__ */ J.jsxs("div", { className: "nbc-flex nbc-items-start nbc-space-x-3", children: [
5855
5856
  /* @__PURE__ */ J.jsxs("div", { className: "nbc-flex nbc-flex-col nbc-items-center nbc-py-3", children: [
5856
5857
  t && /* @__PURE__ */ J.jsx(
@@ -5861,7 +5862,7 @@ const Ol = (e) => {
5861
5862
  className: "nbc-w-7 nbc-h-7 nbc-rounded-full nbc-object-cover nbc-flex-shrink-0"
5862
5863
  }
5863
5864
  ),
5864
- /* @__PURE__ */ J.jsx("div", { className: "nbc-text-xs nbc-text-gray-500 nbc-opacity-70 nbc-whitespace-nowrap", children: Ol(e.timestamp) })
5865
+ /* @__PURE__ */ J.jsx("div", { className: "nbc-text-xs nbc-text-gray-500 nbc-opacity-70 nbc-whitespace-nowrap", children: Ol(String(e.timestamp)).split(" ")[1].substring(0, 5) })
5865
5866
  ] }),
5866
5867
  /* @__PURE__ */ J.jsx("div", { className: "nbc-max-w-xs nbc-py-3 nbc-rounded-2xl nbc-text-sm nbc-leading-relaxed nbc-bg-white nbc-text-gray-800 nbc-rounded-bl-md", children: /* @__PURE__ */ J.jsx("div", { className: "nbc-whitespace-pre-wrap nbc-break-words", children: e.text }) })
5867
5868
  ] }) }), Bh = ({ avatar: e }) => /* @__PURE__ */ J.jsx("div", { className: "nbc-flex nbc-justify-start nbc-mb-4", children: /* @__PURE__ */ J.jsxs("div", { className: "nbc-flex nbc-items-start nbc-space-x-3", children: [
@@ -6238,17 +6239,20 @@ const Zh = (e, t) => rt(void 0, null, function* () {
6238
6239
  } catch (n) {
6239
6240
  return console.error("WebChat: Error fetching conversation history:", n), null;
6240
6241
  }
6241
- }), qh = (e) => e.map((t, n) => ({
6242
- id: t.id || (Date.now() + n).toString(),
6243
- text: t.content || t.text || "",
6244
- sender: t.role === "user" ? "user" : "bot",
6245
- timestamp: t.createdAt ? new Date(t.createdAt) : /* @__PURE__ */ new Date()
6246
- })), ep = (e, t) => e.map((n) => ({
6242
+ }), qh = (e) => e.map((t, n) => {
6243
+ let r;
6244
+ return t.createdAt ? r = t.createdAt.endsWith("Z") ? t.createdAt : `${t.createdAt}Z` : r = (/* @__PURE__ */ new Date()).toISOString(), {
6245
+ id: t.id || (Date.now() + n).toString(),
6246
+ text: t.content || t.text || "",
6247
+ sender: t.role === "user" ? "user" : "bot",
6248
+ timestamp: r
6249
+ };
6250
+ }), ep = (e, t) => e.map((n) => ({
6247
6251
  id: n.id,
6248
6252
  content: n.text,
6249
6253
  role: n.sender === "user" ? "user" : "assistant",
6250
6254
  type: "text",
6251
- createdAt: n.timestamp.toISOString(),
6255
+ createdAt: n.timestamp instanceof Date ? n.timestamp.toISOString() : n.timestamp,
6252
6256
  conversationId: t
6253
6257
  }));
6254
6258
  var Yc = { exports: {} };
@@ -6410,9 +6414,9 @@ var Yc = { exports: {} };
6410
6414
  return A;
6411
6415
  }
6412
6416
  function S(I, M, A, j) {
6413
- var U = arguments.length, z = U < 3 ? M : j === null ? j = Object.getOwnPropertyDescriptor(M, A) : j, V;
6417
+ var U = arguments.length, z = U < 3 ? M : j === null ? j = Object.getOwnPropertyDescriptor(M, A) : j, W;
6414
6418
  if (typeof Reflect == "object" && typeof Reflect.decorate == "function") z = Reflect.decorate(I, M, A, j);
6415
- else for (var G = I.length - 1; G >= 0; G--) (V = I[G]) && (z = (U < 3 ? V(z) : U > 3 ? V(M, A, z) : V(M, A)) || z);
6419
+ else for (var G = I.length - 1; G >= 0; G--) (W = I[G]) && (z = (U < 3 ? W(z) : U > 3 ? W(M, A, z) : W(M, A)) || z);
6416
6420
  return U > 3 && z && Object.defineProperty(M, A, z), z;
6417
6421
  }
6418
6422
  function T(I, M) {
@@ -6425,23 +6429,23 @@ var Yc = { exports: {} };
6425
6429
  }
6426
6430
  function C(I, M, A, j) {
6427
6431
  function U(z) {
6428
- return z instanceof A ? z : new A(function(V) {
6429
- V(z);
6432
+ return z instanceof A ? z : new A(function(W) {
6433
+ W(z);
6430
6434
  });
6431
6435
  }
6432
- return new (A || (A = Promise))(function(z, V) {
6436
+ return new (A || (A = Promise))(function(z, W) {
6433
6437
  function G(L) {
6434
6438
  try {
6435
6439
  b(j.next(L));
6436
6440
  } catch (B) {
6437
- V(B);
6441
+ W(B);
6438
6442
  }
6439
6443
  }
6440
6444
  function F(L) {
6441
6445
  try {
6442
6446
  b(j.throw(L));
6443
6447
  } catch (B) {
6444
- V(B);
6448
+ W(B);
6445
6449
  }
6446
6450
  }
6447
6451
  function b(L) {
@@ -6454,10 +6458,10 @@ var Yc = { exports: {} };
6454
6458
  var A = { label: 0, sent: function() {
6455
6459
  if (z[0] & 1) throw z[1];
6456
6460
  return z[1];
6457
- }, trys: [], ops: [] }, j, U, z, V;
6458
- return V = { next: G(0), throw: G(1), return: G(2) }, typeof Symbol == "function" && (V[Symbol.iterator] = function() {
6461
+ }, trys: [], ops: [] }, j, U, z, W;
6462
+ return W = { next: G(0), throw: G(1), return: G(2) }, typeof Symbol == "function" && (W[Symbol.iterator] = function() {
6459
6463
  return this;
6460
- }), V;
6464
+ }), W;
6461
6465
  function G(b) {
6462
6466
  return function(L) {
6463
6467
  return F([b, L]);
@@ -6533,16 +6537,16 @@ var Yc = { exports: {} };
6533
6537
  function y(I, M) {
6534
6538
  var A = typeof Symbol == "function" && I[Symbol.iterator];
6535
6539
  if (!A) return I;
6536
- var j = A.call(I), U, z = [], V;
6540
+ var j = A.call(I), U, z = [], W;
6537
6541
  try {
6538
6542
  for (; (M === void 0 || M-- > 0) && !(U = j.next()).done; ) z.push(U.value);
6539
6543
  } catch (G) {
6540
- V = { error: G };
6544
+ W = { error: G };
6541
6545
  } finally {
6542
6546
  try {
6543
6547
  U && !U.done && (A = j.return) && A.call(j);
6544
6548
  } finally {
6545
- if (V) throw V.error;
6549
+ if (W) throw W.error;
6546
6550
  }
6547
6551
  }
6548
6552
  return z;
@@ -6555,8 +6559,8 @@ var Yc = { exports: {} };
6555
6559
  function h() {
6556
6560
  for (var I = 0, M = 0, A = arguments.length; M < A; M++) I += arguments[M].length;
6557
6561
  for (var j = Array(I), U = 0, M = 0; M < A; M++)
6558
- for (var z = arguments[M], V = 0, G = z.length; V < G; V++, U++)
6559
- j[U] = z[V];
6562
+ for (var z = arguments[M], W = 0, G = z.length; W < G; W++, U++)
6563
+ j[U] = z[W];
6560
6564
  return j;
6561
6565
  }
6562
6566
  function w(I, M, A) {
@@ -6570,19 +6574,19 @@ var Yc = { exports: {} };
6570
6574
  function u(I, M, A) {
6571
6575
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
6572
6576
  var j = A.apply(I, M || []), U, z = [];
6573
- return U = {}, V("next"), V("throw"), V("return"), U[Symbol.asyncIterator] = function() {
6577
+ return U = {}, W("next"), W("throw"), W("return"), U[Symbol.asyncIterator] = function() {
6574
6578
  return this;
6575
6579
  }, U;
6576
- function V(_) {
6577
- j[_] && (U[_] = function(W) {
6580
+ function W(_) {
6581
+ j[_] && (U[_] = function(V) {
6578
6582
  return new Promise(function(Y, X) {
6579
- z.push([_, W, Y, X]) > 1 || G(_, W);
6583
+ z.push([_, V, Y, X]) > 1 || G(_, V);
6580
6584
  });
6581
6585
  });
6582
6586
  }
6583
- function G(_, W) {
6587
+ function G(_, V) {
6584
6588
  try {
6585
- F(j[_](W));
6589
+ F(j[_](V));
6586
6590
  } catch (Y) {
6587
6591
  B(z[0][3], Y);
6588
6592
  }
@@ -6596,8 +6600,8 @@ var Yc = { exports: {} };
6596
6600
  function L(_) {
6597
6601
  G("throw", _);
6598
6602
  }
6599
- function B(_, W) {
6600
- _(W), z.shift(), z.length && G(z[0][0], z[0][1]);
6603
+ function B(_, V) {
6604
+ _(V), z.shift(), z.length && G(z[0][0], z[0][1]);
6601
6605
  }
6602
6606
  }
6603
6607
  function l(I) {
@@ -6608,8 +6612,8 @@ var Yc = { exports: {} };
6608
6612
  return this;
6609
6613
  }, M;
6610
6614
  function j(U, z) {
6611
- M[U] = I[U] ? function(V) {
6612
- return (A = !A) ? { value: c(I[U](V)), done: U === "return" } : z ? z(V) : V;
6615
+ M[U] = I[U] ? function(W) {
6616
+ return (A = !A) ? { value: c(I[U](W)), done: U === "return" } : z ? z(W) : W;
6613
6617
  } : z;
6614
6618
  }
6615
6619
  }
@@ -6620,16 +6624,16 @@ var Yc = { exports: {} };
6620
6624
  return this;
6621
6625
  }, A);
6622
6626
  function j(z) {
6623
- A[z] = I[z] && function(V) {
6627
+ A[z] = I[z] && function(W) {
6624
6628
  return new Promise(function(G, F) {
6625
- V = I[z](V), U(G, F, V.done, V.value);
6629
+ W = I[z](W), U(G, F, W.done, W.value);
6626
6630
  });
6627
6631
  };
6628
6632
  }
6629
- function U(z, V, G, F) {
6633
+ function U(z, W, G, F) {
6630
6634
  Promise.resolve(F).then(function(b) {
6631
6635
  z({ value: b, done: G });
6632
- }, V);
6636
+ }, W);
6633
6637
  }
6634
6638
  }
6635
6639
  function g(I, M) {
@@ -6864,7 +6868,7 @@ var Yc = { exports: {} };
6864
6868
  html: "text/html",
6865
6869
  msgpack: "application/x-msgpack"
6866
6870
  };
6867
- function V(H, $) {
6871
+ function W(H, $) {
6868
6872
  var K = z[$ || de.json];
6869
6873
  return {
6870
6874
  accept: K,
@@ -6872,7 +6876,7 @@ var Yc = { exports: {} };
6872
6876
  "Ably-Agent": (0, m.getAgentString)(H)
6873
6877
  };
6874
6878
  }
6875
- r.defaultGetHeaders = V;
6879
+ r.defaultGetHeaders = W;
6876
6880
  function G(H, $) {
6877
6881
  var K, ee = K = z[$ || de.json];
6878
6882
  return {
@@ -6912,10 +6916,10 @@ var Yc = { exports: {} };
6912
6916
  return H instanceof Error || (($ = H == null ? void 0 : H.constructor) === null || $ === void 0 ? void 0 : $.name) === "ErrorInfo" || ((K = H == null ? void 0 : H.constructor) === null || K === void 0 ? void 0 : K.name) === "PartialErrorInfo" ? H.toString() : v.default.Config.inspect(H);
6913
6917
  }
6914
6918
  r.inspectError = _;
6915
- function W(H) {
6919
+ function V(H) {
6916
6920
  return v.default.BufferUtils.isBuffer(H) ? H.toString() : typeof H == "string" ? H : v.default.Config.inspect(H);
6917
6921
  }
6918
- r.inspectBody = W;
6922
+ r.inspectBody = V;
6919
6923
  function Y(H) {
6920
6924
  if (v.default.BufferUtils.isBuffer(H))
6921
6925
  return v.default.BufferUtils.byteLength(H);
@@ -7971,8 +7975,8 @@ var Yc = { exports: {} };
7971
7975
  "idempotentRestPublishing" in p || (p.idempotentRestPublishing = !0), p.promises && !a.default.Config.Promise && (m.default.logAction(m.default.LOG_ERROR, "Defaults.normaliseOptions", "{promises: true} was specified, but no Promise constructor found; disabling promises"), p.promises = !1);
7972
7976
  var j = null, U = p.connectivityCheckUrl;
7973
7977
  if (p.connectivityCheckUrl) {
7974
- var z = p.connectivityCheckUrl.split("?"), V = z[0], G = z[1];
7975
- j = G ? v.parseQueryString(G) : {}, V.indexOf("://") === -1 && (V = "https://" + V), U = V;
7978
+ var z = p.connectivityCheckUrl.split("?"), W = z[0], G = z[1];
7979
+ j = G ? v.parseQueryString(G) : {}, W.indexOf("://") === -1 && (W = "https://" + W), U = W;
7976
7980
  }
7977
7981
  return i.__assign(i.__assign({}, p), { useBinaryProtocol: "useBinaryProtocol" in p ? a.default.Config.supportsBinary && p.useBinaryProtocol : a.default.Config.preferBinary, realtimeHost: I, restHost: k, maxMessageSize: p.maxMessageSize || C.maxMessageSize, timeouts: M, connectivityCheckParams: j, connectivityCheckUrl: U });
7978
7982
  }
@@ -8580,7 +8584,7 @@ var Yc = { exports: {} };
8580
8584
  }
8581
8585
  m.default.logAction(m.default.LOG_MICRO, "Resource." + w + "()", "Sending; " + P(u, k) + "; Body: " + M);
8582
8586
  }
8583
- c.http.do(w, c, u, N, l, k, function(A, j, U, z, V) {
8587
+ c.http.do(w, c, u, N, l, k, function(A, j, U, z, W) {
8584
8588
  if (A && S.default.isTokenErr(A)) {
8585
8589
  c.auth.authorize(null, null, function(G) {
8586
8590
  if (G) {
@@ -8591,7 +8595,7 @@ var Yc = { exports: {} };
8591
8595
  });
8592
8596
  return;
8593
8597
  }
8594
- x(A, j, U, z, V);
8598
+ x(A, j, U, z, W);
8595
8599
  });
8596
8600
  }
8597
8601
  O(c, s, g, x, D);
@@ -8734,8 +8738,8 @@ var Yc = { exports: {} };
8734
8738
  D.timedOut = !0, A.abort();
8735
8739
  }, k), M = this.method, A = this.xhr = new XMLHttpRequest(), j = N.accept, U = this.body, z = "text";
8736
8740
  if (j ? j.indexOf("application/x-msgpack") === 0 && (z = "arraybuffer") : N.accept = "application/json", U) {
8737
- var V = N["content-type"] || (N["content-type"] = "application/json");
8738
- V.indexOf("application/json") > -1 && typeof U != "string" && (U = JSON.stringify(U));
8741
+ var W = N["content-type"] || (N["content-type"] = "application/json");
8742
+ W.indexOf("application/json") > -1 && typeof U != "string" && (U = JSON.stringify(U));
8739
8743
  }
8740
8744
  A.open(M, this.uri, !0), A.responseType = z, "authorization" in N && (A.withCredentials = !0);
8741
8745
  for (var G in N)
@@ -8751,7 +8755,7 @@ var Yc = { exports: {} };
8751
8755
  }, A.ontimeout = function(Z) {
8752
8756
  F(Z, "Request timed out", null, 408);
8753
8757
  };
8754
- var b, L, B, _ = 0, W = !1, Y = function() {
8758
+ var b, L, B, _ = 0, V = !1, Y = function() {
8755
8759
  if (clearTimeout(I), B = L < 400, L == 204) {
8756
8760
  D.complete(null, null, null, null, L);
8757
8761
  return;
@@ -8763,7 +8767,7 @@ var Yc = { exports: {} };
8763
8767
  var de = u(A, "content-type"), Re = de ? de.indexOf("application/json") >= 0 : A.responseType == "text";
8764
8768
  if (Re) {
8765
8769
  var Ne = A.responseType === "arraybuffer" ? O.default.BufferUtils.utf8Decode(A.response) : String(A.responseText);
8766
- Ne.length ? Z = JSON.parse(Ne) : Z = Ne, W = !0;
8770
+ Ne.length ? Z = JSON.parse(Ne) : Z = Ne, V = !0;
8767
8771
  } else
8768
8772
  Z = A.response;
8769
8773
  Z.response !== void 0 ? (L = Z.statusCode, B = L < 400, N = Z.headers, Z = Z.response) : N = s(A);
@@ -8772,11 +8776,11 @@ var Yc = { exports: {} };
8772
8776
  return;
8773
8777
  }
8774
8778
  if (B || v.isArray(Z)) {
8775
- D.complete(null, Z, N, W, L);
8779
+ D.complete(null, Z, N, V, L);
8776
8780
  return;
8777
8781
  }
8778
8782
  var Se = E(Z, N);
8779
- Se || (Se = new S.PartialErrorInfo("Error response received from server: " + L + " body was: " + O.default.Config.inspect(Z), null, L)), D.complete(Se, Z, N, W, L);
8783
+ Se || (Se = new S.PartialErrorInfo("Error response received from server: " + L + " body was: " + O.default.Config.inspect(Z), null, L)), D.complete(Se, Z, N, V, L);
8780
8784
  };
8781
8785
  function te() {
8782
8786
  for (var Z = A.responseText, de = Z.length - 1, Re, Ne; _ < de && (Re = Z.indexOf(`
@@ -8900,12 +8904,12 @@ var Yc = { exports: {} };
8900
8904
  return v.promisify(this, "authorize", arguments);
8901
8905
  if (U && U.key && this.authOptions.key !== U.key)
8902
8906
  throw new S.default("Unable to update auth options with incompatible key", 40102, 401);
8903
- U && "force" in U && (a.default.deprecated("The `force` auth option", "If you’re using this option to force `authorize()` to fetch a new token even if the current token has not expired, this is no longer necessary, as `authorize()` now always fetches a new token. Update your code to no longer pass the `force` auth option. Note that, in general, passing an auth options argument to `authorize()` will overwrite the library’s stored auth options, which may not be what you want. The library currently contains a special case behavior where passing an auth options object which only contains `{ force: true }` will _not_ overwrite the stored options. This special case behavior will be removed alongside support for the `force` option, so if you’re currently passing `authorize()` an auth options object which only contains `{ force: true }`, you should stop passing it an auth options object entirely."), v.isOnlyPropIn(U, "force") && (U = null)), this._forceNewToken(I, U, function(z, V) {
8907
+ U && "force" in U && (a.default.deprecated("The `force` auth option", "If you’re using this option to force `authorize()` to fetch a new token even if the current token has not expired, this is no longer necessary, as `authorize()` now always fetches a new token. Update your code to no longer pass the `force` auth option. Note that, in general, passing an auth options argument to `authorize()` will overwrite the library’s stored auth options, which may not be what you want. The library currently contains a special case behavior where passing an auth options object which only contains `{ force: true }` will _not_ overwrite the stored options. This special case behavior will be removed alongside support for the `force` option, so if you’re currently passing `authorize()` an auth options object which only contains `{ force: true }`, you should stop passing it an auth options object entirely."), v.isOnlyPropIn(U, "force") && (U = null)), this._forceNewToken(I, U, function(z, W) {
8904
8908
  if (z) {
8905
8909
  j.client.connection && z.statusCode === O.default.Forbidden && j.client.connection.connectionManager.actOnErrorFromAuthorize(z), A == null || A(z);
8906
8910
  return;
8907
8911
  }
8908
- h(j.client) ? j.client.connection.connectionManager.onAuthUpdated(V, A || y) : A == null || A(null, V);
8912
+ h(j.client) ? j.client.connection.connectionManager.onAuthUpdated(W, A || y) : A == null || A(null, W);
8909
8913
  });
8910
8914
  }, k.prototype.authorise = function(I, M, A) {
8911
8915
  a.default.renamedMethod("Auth", "authorise", "authorize"), this.authorize(I, M, A);
@@ -8919,51 +8923,51 @@ var Yc = { exports: {} };
8919
8923
  if (typeof I == "function" && !A ? (A = I, M = I = null) : typeof M == "function" && !A && (A = M, M = null), !A && this.client.options.promises)
8920
8924
  return v.promisify(this, "requestToken", arguments);
8921
8925
  M = M || this.authOptions, I = I || v.copy(this.tokenParams);
8922
- var U = A || y, z, V = this.client;
8926
+ var U = A || y, z, W = this.client;
8923
8927
  if (M.authCallback)
8924
8928
  a.default.logAction(a.default.LOG_MINOR, "Auth.requestToken()", "using token auth with authCallback"), z = M.authCallback;
8925
8929
  else if (M.authUrl)
8926
- a.default.logAction(a.default.LOG_MINOR, "Auth.requestToken()", "using token auth with authUrl"), z = function(_, W) {
8930
+ a.default.logAction(a.default.LOG_MINOR, "Auth.requestToken()", "using token auth with authUrl"), z = function(_, V) {
8927
8931
  var Y = v.mixin({ accept: "application/json, text/plain" }, M.authHeaders), X = M.authMethod && M.authMethod.toLowerCase() === "post", te, ne = M.authUrl.indexOf("?");
8928
8932
  ne > -1 && (te = v.parseQueryString(M.authUrl.slice(ne)), M.authUrl = M.authUrl.slice(0, ne), X || (M.authParams = v.mixin(te, M.authParams)));
8929
8933
  var le = v.mixin({}, M.authParams || {}, _), Z = function(Ne, Se, gt, Mr) {
8930
8934
  var nt;
8931
8935
  if (Ne ? a.default.logAction(a.default.LOG_MICRO, "Auth.requestToken().tokenRequestCallback", "Received Error: " + v.inspectError(Ne)) : (nt = gt["content-type"], a.default.logAction(a.default.LOG_MICRO, "Auth.requestToken().tokenRequestCallback", "Received; content-type: " + nt + "; body: " + v.inspectBody(Se))), Ne || Mr)
8932
- return W(Ne, Se);
8936
+ return V(Ne, Se);
8933
8937
  if (f.default.BufferUtils.isBuffer(Se) && (Se = Se.toString()), !nt) {
8934
- W(new S.default("authUrl response is missing a content-type header", 40170, 401));
8938
+ V(new S.default("authUrl response is missing a content-type header", 40170, 401));
8935
8939
  return;
8936
8940
  }
8937
8941
  var Pr = nt.indexOf("application/json") > -1, Jo = nt.indexOf("text/plain") > -1 || nt.indexOf("application/jwt") > -1;
8938
8942
  if (!Pr && !Jo) {
8939
- W(new S.default("authUrl responded with unacceptable content-type " + nt + ", should be either text/plain, application/jwt or application/json", 40170, 401));
8943
+ V(new S.default("authUrl responded with unacceptable content-type " + nt + ", should be either text/plain, application/jwt or application/json", 40170, 401));
8940
8944
  return;
8941
8945
  }
8942
8946
  if (Pr) {
8943
8947
  if (Se.length > P) {
8944
- W(new S.default("authUrl response exceeded max permitted length", 40170, 401));
8948
+ V(new S.default("authUrl response exceeded max permitted length", 40170, 401));
8945
8949
  return;
8946
8950
  }
8947
8951
  try {
8948
8952
  Se = JSON.parse(Se);
8949
8953
  } catch (Yo) {
8950
- W(new S.default("Unexpected error processing authURL response; err = " + Yo.message, 40170, 401));
8954
+ V(new S.default("Unexpected error processing authURL response; err = " + Yo.message, 40170, 401));
8951
8955
  return;
8952
8956
  }
8953
8957
  }
8954
- W(null, Se, nt);
8958
+ V(null, Se, nt);
8955
8959
  };
8956
8960
  if (a.default.logAction(a.default.LOG_MICRO, "Auth.requestToken().tokenRequestCallback", "Requesting token from " + M.authUrl + "; Params: " + JSON.stringify(le) + "; method: " + (X ? "POST" : "GET")), X) {
8957
8961
  var de = Y || {};
8958
8962
  de["content-type"] = "application/x-www-form-urlencoded";
8959
8963
  var Re = v.toQueryString(le).slice(1);
8960
- j.client.http.doUri(C.default.Post, V, M.authUrl, de, Re, te, Z);
8964
+ j.client.http.doUri(C.default.Post, W, M.authUrl, de, Re, te, Z);
8961
8965
  } else
8962
- j.client.http.doUri(C.default.Get, V, M.authUrl, Y || {}, null, le, Z);
8966
+ j.client.http.doUri(C.default.Get, W, M.authUrl, Y || {}, null, le, Z);
8963
8967
  };
8964
8968
  else if (M.key)
8965
- a.default.logAction(a.default.LOG_MINOR, "Auth.requestToken()", "using token auth with client-side signing"), z = function(_, W) {
8966
- j.createTokenRequest(_, M, W);
8969
+ a.default.logAction(a.default.LOG_MINOR, "Auth.requestToken()", "using token auth with client-side signing"), z = function(_, V) {
8970
+ j.createTokenRequest(_, M, V);
8967
8971
  };
8968
8972
  else {
8969
8973
  var G = "Need a new token, but authOptions does not include any way to request one (no authUrl, authCallback, or key)";
@@ -8971,46 +8975,46 @@ var Yc = { exports: {} };
8971
8975
  return;
8972
8976
  }
8973
8977
  "capability" in I && (I.capability = u(I.capability));
8974
- var F = function(_, W) {
8978
+ var F = function(_, V) {
8975
8979
  var Y = _.keyName, X = "/keys/" + Y + "/requestToken", te = function(le) {
8976
- return V.baseUri(le) + X;
8980
+ return W.baseUri(le) + X;
8977
8981
  }, ne = v.defaultPostHeaders(j.client.options);
8978
- M.requestHeaders && v.mixin(ne, M.requestHeaders), a.default.logAction(a.default.LOG_MICRO, "Auth.requestToken().requestToken", "Sending POST to " + X + "; Token params: " + JSON.stringify(_)), j.client.http.do(C.default.Post, V, te, ne, JSON.stringify(_), null, W);
8982
+ M.requestHeaders && v.mixin(ne, M.requestHeaders), a.default.logAction(a.default.LOG_MICRO, "Auth.requestToken().requestToken", "Sending POST to " + X + "; Token params: " + JSON.stringify(_)), j.client.http.do(C.default.Post, W, te, ne, JSON.stringify(_), null, V);
8979
8983
  }, b = !1, L = this.client.options.timeouts.realtimeRequestTimeout, B = setTimeout(function() {
8980
8984
  b = !0;
8981
8985
  var _ = "Token request callback timed out after " + L / 1e3 + " seconds";
8982
8986
  a.default.logAction(a.default.LOG_ERROR, "Auth.requestToken()", _), U(new S.default(_, 40170, 401));
8983
8987
  }, L);
8984
- z(I, function(_, W, Y) {
8988
+ z(I, function(_, V, Y) {
8985
8989
  if (!b) {
8986
8990
  if (clearTimeout(B), _) {
8987
8991
  a.default.logAction(a.default.LOG_ERROR, "Auth.requestToken()", "token request signing call returned error; err = " + v.inspectError(_)), U(w(_));
8988
8992
  return;
8989
8993
  }
8990
- if (typeof W == "string") {
8991
- W.length === 0 ? U(new S.default("Token string is empty", 40170, 401)) : W.length > P ? U(new S.default("Token string exceeded max permitted length (was " + W.length + " bytes)", 40170, 401)) : W === "undefined" || W === "null" ? U(new S.default("Token string was literal null/undefined", 40170, 401)) : W[0] === "{" && !(Y && Y.indexOf("application/jwt") > -1) ? U(new S.default("Token was double-encoded; make sure you're not JSON-encoding an already encoded token request or details", 40170, 401)) : U(null, { token: W });
8994
+ if (typeof V == "string") {
8995
+ V.length === 0 ? U(new S.default("Token string is empty", 40170, 401)) : V.length > P ? U(new S.default("Token string exceeded max permitted length (was " + V.length + " bytes)", 40170, 401)) : V === "undefined" || V === "null" ? U(new S.default("Token string was literal null/undefined", 40170, 401)) : V[0] === "{" && !(Y && Y.indexOf("application/jwt") > -1) ? U(new S.default("Token was double-encoded; make sure you're not JSON-encoding an already encoded token request or details", 40170, 401)) : U(null, { token: V });
8992
8996
  return;
8993
8997
  }
8994
- if (typeof W != "object") {
8995
- var X = "Expected token request callback to call back with a token string or token request/details object, but got a " + typeof W;
8998
+ if (typeof V != "object") {
8999
+ var X = "Expected token request callback to call back with a token string or token request/details object, but got a " + typeof V;
8996
9000
  a.default.logAction(a.default.LOG_ERROR, "Auth.requestToken()", X), U(new S.default(X, 40170, 401));
8997
9001
  return;
8998
9002
  }
8999
- var te = JSON.stringify(W).length;
9003
+ var te = JSON.stringify(V).length;
9000
9004
  if (te > P && !M.suppressMaxLengthCheck) {
9001
9005
  U(new S.default("Token request/details object exceeded max permitted stringified size (was " + te + " bytes)", 40170, 401));
9002
9006
  return;
9003
9007
  }
9004
- if ("issued" in W) {
9005
- U(null, W);
9008
+ if ("issued" in V) {
9009
+ U(null, V);
9006
9010
  return;
9007
9011
  }
9008
- if (!("keyName" in W)) {
9012
+ if (!("keyName" in V)) {
9009
9013
  var X = "Expected token request callback to call back with a token string, token request object, or token details object";
9010
9014
  a.default.logAction(a.default.LOG_ERROR, "Auth.requestToken()", X), U(new S.default(X, 40170, 401));
9011
9015
  return;
9012
9016
  }
9013
- F(W, function(ne, le, Z, de) {
9017
+ F(V, function(ne, le, Z, de) {
9014
9018
  if (ne) {
9015
9019
  a.default.logAction(a.default.LOG_ERROR, "Auth.requestToken()", "token request API call returned error; err = " + v.inspectError(ne)), U(w(ne));
9016
9020
  return;
@@ -9029,7 +9033,7 @@ var Yc = { exports: {} };
9029
9033
  A(new S.default("No key specified", 40101, 403));
9030
9034
  return;
9031
9035
  }
9032
- var z = U.split(":"), V = z[0], G = z[1];
9036
+ var z = U.split(":"), W = z[0], G = z[1];
9033
9037
  if (!G) {
9034
9038
  A(new S.default("Invalid key specified", 40101, 403));
9035
9039
  return;
@@ -9039,25 +9043,25 @@ var Yc = { exports: {} };
9039
9043
  return;
9040
9044
  }
9041
9045
  "capability" in I && (I.capability = u(I.capability));
9042
- var F = v.mixin({ keyName: V }, I), b = I.clientId || "", L = I.ttl || "", B = I.capability || "";
9046
+ var F = v.mixin({ keyName: W }, I), b = I.clientId || "", L = I.ttl || "", B = I.capability || "";
9043
9047
  (function(_) {
9044
9048
  if (F.timestamp) {
9045
9049
  _();
9046
9050
  return;
9047
9051
  }
9048
- j.getTimestamp(M && M.queryTime, function(W, Y) {
9049
- if (W) {
9050
- A(W);
9052
+ j.getTimestamp(M && M.queryTime, function(V, Y) {
9053
+ if (V) {
9054
+ A(V);
9051
9055
  return;
9052
9056
  }
9053
9057
  F.timestamp = Y, _();
9054
9058
  });
9055
9059
  })(function() {
9056
- var _ = F.nonce || (F.nonce = d()), W = F.timestamp, Y = F.keyName + `
9060
+ var _ = F.nonce || (F.nonce = d()), V = F.timestamp, Y = F.keyName + `
9057
9061
  ` + L + `
9058
9062
  ` + B + `
9059
9063
  ` + b + `
9060
- ` + W + `
9064
+ ` + V + `
9061
9065
  ` + _ + `
9062
9066
  `;
9063
9067
  F.mac = F.mac || c(Y, G), a.default.logAction(a.default.LOG_MINOR, "Auth.getTokenRequest()", "generated signed request"), A(null, F);
@@ -9107,7 +9111,7 @@ var Yc = { exports: {} };
9107
9111
  }
9108
9112
  if ((this.waitingForTokenRequest || (this.waitingForTokenRequest = m.default.create())).push(M), !(this.currentTokenRequestId !== null && !I)) {
9109
9113
  var U = this.currentTokenRequestId = D();
9110
- this.requestToken(this.tokenParams, this.authOptions, function(z, V) {
9114
+ this.requestToken(this.tokenParams, this.authOptions, function(z, W) {
9111
9115
  if (A.currentTokenRequestId > U) {
9112
9116
  a.default.logAction(a.default.LOG_MINOR, "Auth._ensureValidAuthCredentials()", "Discarding token request response; overtaken by newer one");
9113
9117
  return;
@@ -9118,7 +9122,7 @@ var Yc = { exports: {} };
9118
9122
  G(z);
9119
9123
  return;
9120
9124
  }
9121
- G(null, A.tokenDetails = V);
9125
+ G(null, A.tokenDetails = W);
9122
9126
  });
9123
9127
  }
9124
9128
  }, k.prototype._userSetClientId = function(I) {
@@ -9148,17 +9152,17 @@ var Yc = { exports: {} };
9148
9152
  return v.promisify(this, "revokeTokens", [I, U]);
9149
9153
  A = y;
9150
9154
  }
9151
- var z = A, V = i.__assign({ targets: I.map(function(L) {
9155
+ var z = A, W = i.__assign({ targets: I.map(function(L) {
9152
9156
  return "".concat(L.type, ":").concat(L.value);
9153
9157
  }) }, U), G = this.client.options.useBinaryProtocol ? v.Format.msgpack : v.Format.json, F = v.defaultPostHeaders(this.client.options, G);
9154
9158
  this.client.options.headers && v.mixin(F, this.client.options.headers);
9155
- var b = v.encodeBody(V, G);
9156
- E.default.post(this.client, "/keys/".concat(j, "/revokeTokens"), b, F, { newBatchResponse: "true" }, null, function(L, B, _, W) {
9159
+ var b = v.encodeBody(W, G);
9160
+ E.default.post(this.client, "/keys/".concat(j, "/revokeTokens"), b, F, { newBatchResponse: "true" }, null, function(L, B, _, V) {
9157
9161
  if (L) {
9158
9162
  z(L);
9159
9163
  return;
9160
9164
  }
9161
- var Y = W ? B : v.decodeBody(B, G);
9165
+ var Y = V ? B : v.decodeBody(B, G);
9162
9166
  z(null, Y);
9163
9167
  });
9164
9168
  }, k;
@@ -10272,8 +10276,8 @@ var Yc = { exports: {} };
10272
10276
  else if (U.statusCode < 400 || a.isArray(z))
10273
10277
  g.complete(null, z, U.headers, U.statusCode);
10274
10278
  else {
10275
- var V = z.error || new T.PartialErrorInfo("Error response received from server", null, U.statusCode);
10276
- g.complete(V);
10279
+ var W = z.error || new T.PartialErrorInfo("Error response received from server", null, U.statusCode);
10280
+ g.complete(W);
10277
10281
  }
10278
10282
  } else
10279
10283
  g.complete(null, U);
@@ -10396,7 +10400,7 @@ var Yc = { exports: {} };
10396
10400
  N = w;
10397
10401
  }
10398
10402
  typeof x != "string" && (x = I(x)), this.options.headers && a.mixin(z, this.options.headers), D && a.mixin(z, D);
10399
- var V = new R.default(
10403
+ var W = new R.default(
10400
10404
  this,
10401
10405
  g,
10402
10406
  z,
@@ -10409,7 +10413,7 @@ var Yc = { exports: {} };
10409
10413
  );
10410
10414
  if (!a.arrIn(P.default.Http.methods, U))
10411
10415
  throw new O.default("Unsupported method " + U, 40500, 405);
10412
- a.arrIn(P.default.Http.methodsWithBody, U) ? V[U](p, x, N) : V[U](p, N);
10416
+ a.arrIn(P.default.Http.methodsWithBody, U) ? W[U](p, x, N) : W[U](p, N);
10413
10417
  }, l.prototype.batchPublish = function(s, g) {
10414
10418
  if (g === void 0) {
10415
10419
  if (this.options.promises)
@@ -10511,8 +10515,8 @@ var Yc = { exports: {} };
10511
10515
  var D = f[x - 15], N = (D << 25 | D >>> 7) ^ (D << 14 | D >>> 18) ^ D >>> 3, k = f[x - 2], I = (k << 15 | k >>> 17) ^ (k << 13 | k >>> 19) ^ k >>> 10;
10512
10516
  f[x] = N + f[x - 7] + I + f[x - 16];
10513
10517
  }
10514
- var M = l & s ^ ~l & g, A = h & w ^ h & c ^ w & c, j = (h << 30 | h >>> 2) ^ (h << 19 | h >>> 13) ^ (h << 10 | h >>> 22), U = (l << 26 | l >>> 6) ^ (l << 21 | l >>> 11) ^ (l << 7 | l >>> 25), z = p + U + M + O[x] + f[x], V = j + A;
10515
- p = g, g = s, s = l, l = u + z | 0, u = c, c = w, w = h, h = z + V | 0;
10518
+ var M = l & s ^ ~l & g, A = h & w ^ h & c ^ w & c, j = (h << 30 | h >>> 2) ^ (h << 19 | h >>> 13) ^ (h << 10 | h >>> 22), U = (l << 26 | l >>> 6) ^ (l << 21 | l >>> 11) ^ (l << 7 | l >>> 25), z = p + U + M + O[x] + f[x], W = j + A;
10519
+ p = g, g = s, s = l, l = u + z | 0, u = c, c = w, w = h, h = z + W | 0;
10516
10520
  }
10517
10521
  d[0] = d[0] + h | 0, d[1] = d[1] + w | 0, d[2] = d[2] + c | 0, d[3] = d[3] + u | 0, d[4] = d[4] + l | 0, d[5] = d[5] + s | 0, d[6] = d[6] + g | 0, d[7] = d[7] + p | 0;
10518
10522
  },
@@ -10607,9 +10611,9 @@ var Yc = { exports: {} };
10607
10611
  p(U);
10608
10612
  return;
10609
10613
  }
10610
- var z = T.default.getMessagesSize(x), V = k.maxMessageSize;
10611
- if (z > V) {
10612
- p(new R.default("Maximum size of messages that can be published at once exceeded ( was " + z + " bytes; limit is " + V + " bytes)", 40009, 400));
10614
+ var z = T.default.getMessagesSize(x), W = k.maxMessageSize;
10615
+ if (z > W) {
10616
+ p(new R.default("Maximum size of messages that can be published at once exceeded ( was " + z + " bytes; limit is " + W + " bytes)", 40009, 400));
10613
10617
  return;
10614
10618
  }
10615
10619
  u._publish(T.default.serialize(x, I), A, D, p);
@@ -10710,8 +10714,8 @@ var Yc = { exports: {} };
10710
10714
  var L;
10711
10715
  if (G.channel !== F.channel || (L = G.action) !== p.PRESENCE && L !== p.MESSAGE || L !== F.action)
10712
10716
  return !1;
10713
- var B = L === p.PRESENCE ? "presence" : "messages", _ = G[B].concat(F[B]), W = h.default.getMessagesSize(_);
10714
- return W > b || !m.allSame(_, "clientId") || !m.arrEvery(_, function(Y) {
10717
+ var B = L === p.PRESENCE ? "presence" : "messages", _ = G[B].concat(F[B]), V = h.default.getMessagesSize(_);
10718
+ return V > b || !m.allSame(_, "clientId") || !m.arrEvery(_, function(Y) {
10715
10719
  return !Y.id;
10716
10720
  }) ? !1 : (G[B] = _, !0);
10717
10721
  }
@@ -10751,14 +10755,14 @@ var Yc = { exports: {} };
10751
10755
  }()
10752
10756
  );
10753
10757
  r.TransportParams = z;
10754
- var V = (
10758
+ var W = (
10755
10759
  /** @class */
10756
10760
  function(G) {
10757
10761
  a.__extends(F, G);
10758
10762
  function F(b, L) {
10759
10763
  var B = G.call(this) || this;
10760
10764
  B.disconnectedRetryCount = 0, F.initTransports(), B.realtime = b, B.options = L;
10761
- var _ = L.timeouts, W = _.preferenceConnectTimeout + _.realtimeRequestTimeout;
10765
+ var _ = L.timeouts, V = _.preferenceConnectTimeout + _.realtimeRequestTimeout;
10762
10766
  if (B.states = {
10763
10767
  initialized: {
10764
10768
  state: "initialized",
@@ -10772,7 +10776,7 @@ var Yc = { exports: {} };
10772
10776
  terminal: !1,
10773
10777
  queueEvents: !0,
10774
10778
  sendEvents: !1,
10775
- retryDelay: W,
10779
+ retryDelay: V,
10776
10780
  failState: "disconnected"
10777
10781
  },
10778
10782
  connected: {
@@ -10847,9 +10851,9 @@ var Yc = { exports: {} };
10847
10851
  _("recover");
10848
10852
  return;
10849
10853
  }
10850
- var W = L.options.recover, Y = k();
10851
- if (Y && typeof W == "function") {
10852
- f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.getTransportParams()", "Calling clientOptions-provided recover function with last session data"), W(Y, function(X) {
10854
+ var V = L.options.recover, Y = k();
10855
+ if (Y && typeof V == "function") {
10856
+ f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.getTransportParams()", "Calling clientOptions-provided recover function with last session data"), V(Y, function(X) {
10853
10857
  X ? (L.options.recover = Y.recoveryKey, _("recover")) : _("clean");
10854
10858
  });
10855
10859
  return;
@@ -10857,31 +10861,31 @@ var Yc = { exports: {} };
10857
10861
  _("clean");
10858
10862
  };
10859
10863
  B(function(_) {
10860
- var W = L.createTransportParams(null, _);
10864
+ var V = L.createTransportParams(null, _);
10861
10865
  if (_ === "recover") {
10862
10866
  f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.getTransportParams()", "Transport recovery mode = recover; recoveryKey = " + L.options.recover);
10863
10867
  var Y = U(L.options.recover);
10864
10868
  Y && (L.msgSerial = Y.msgSerial);
10865
10869
  } else
10866
- f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.getTransportParams()", "Transport params = " + W.toString());
10867
- b(W);
10870
+ f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.getTransportParams()", "Transport params = " + V.toString());
10871
+ b(V);
10868
10872
  });
10869
10873
  }, F.prototype.tryATransport = function(b, L, B) {
10870
10874
  var _ = this;
10871
- f.default.logAction(f.default.LOG_MICRO, "ConnectionManager.tryATransport()", "trying " + L), u.default.tryConnect(F.supportedTransports[L], this, this.realtime.auth, b, function(W, Y) {
10875
+ f.default.logAction(f.default.LOG_MICRO, "ConnectionManager.tryATransport()", "trying " + L), u.default.tryConnect(F.supportedTransports[L], this, this.realtime.auth, b, function(V, Y) {
10872
10876
  var X = _.state;
10873
10877
  if (X == _.states.closing || X == _.states.closed || X == _.states.failed) {
10874
10878
  Y && (f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.tryATransport()", "connection " + X.state + " while we were attempting the transport; closing " + Y), Y.close()), B(!0);
10875
10879
  return;
10876
10880
  }
10877
- if (W) {
10878
- f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.tryATransport()", "transport " + L + " " + W.event + ", err: " + W.error.toString()), d.default.isTokenErr(W.error) && !(_.errorReason && d.default.isTokenErr(_.errorReason)) ? (_.errorReason = W.error, _.realtime.auth._forceNewToken(null, null, function(te) {
10881
+ if (V) {
10882
+ f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.tryATransport()", "transport " + L + " " + V.event + ", err: " + V.error.toString()), d.default.isTokenErr(V.error) && !(_.errorReason && d.default.isTokenErr(_.errorReason)) ? (_.errorReason = V.error, _.realtime.auth._forceNewToken(null, null, function(te) {
10879
10883
  if (te) {
10880
10884
  _.actOnErrorFromAuthorize(te);
10881
10885
  return;
10882
10886
  }
10883
10887
  _.tryATransport(b, L, B);
10884
- })) : W.event === "failed" ? (_.notifyState({ state: "failed", error: W.error }), B(!0)) : W.event === "disconnected" && ((0, P.isRetriable)(W.error) ? B(!1) : (_.notifyState({ state: _.states.connecting.failState, error: W.error }), B(!0)));
10888
+ })) : V.event === "failed" ? (_.notifyState({ state: "failed", error: V.error }), B(!0)) : V.event === "disconnected" && ((0, P.isRetriable)(V.error) ? B(!1) : (_.notifyState({ state: _.states.connecting.failState, error: V.error }), B(!0)));
10885
10889
  return;
10886
10890
  }
10887
10891
  f.default.logAction(f.default.LOG_MICRO, "ConnectionManager.tryATransport()", "viable transport " + L + "; setting pending"), _.setTransportPending(Y, b), B(null, Y);
@@ -10889,9 +10893,9 @@ var Yc = { exports: {} };
10889
10893
  }, F.prototype.setTransportPending = function(b, L) {
10890
10894
  var B = this, _ = L.mode;
10891
10895
  f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.setTransportPending()", "transport = " + b + "; mode = " + _), m.arrDeleteValue(this.proposedTransports, b), this.pendingTransports.push(b);
10892
- var W = R.default.Defaults.transportPreferenceOrder[R.default.Defaults.transportPreferenceOrder.length - 1];
10896
+ var V = R.default.Defaults.transportPreferenceOrder[R.default.Defaults.transportPreferenceOrder.length - 1];
10893
10897
  b.once("connected", function(X, te, ne) {
10894
- _ == "upgrade" && B.activeProtocol ? b.shortName !== W && m.arrIn(B.getUpgradePossibilities(), W) && B.activeProtocol ? setTimeout(function() {
10898
+ _ == "upgrade" && B.activeProtocol ? b.shortName !== V && m.arrIn(B.getUpgradePossibilities(), V) && B.activeProtocol ? setTimeout(function() {
10895
10899
  B.scheduleTransportActivation(X, b, te, ne);
10896
10900
  }, B.options.timeouts.parallelUpgradeDelay) : B.scheduleTransportActivation(X, b, te, ne) : (B.activateTransport(X, b, te, ne), R.default.Config.nextTick(function() {
10897
10901
  B.connectImpl(L);
@@ -10902,8 +10906,8 @@ var Yc = { exports: {} };
10902
10906
  Y.deactivateTransport(b, this.event, X);
10903
10907
  }), this.emit("transport.pending", b);
10904
10908
  }, F.prototype.scheduleTransportActivation = function(b, L, B, _) {
10905
- var W = this, Y = this.activeProtocol && this.activeProtocol.getTransport(), X = function() {
10906
- L.disconnect(), m.arrDeleteValue(W.pendingTransports, L);
10909
+ var V = this, Y = this.activeProtocol && this.activeProtocol.getTransport(), X = function() {
10910
+ L.disconnect(), m.arrDeleteValue(V.pendingTransports, L);
10907
10911
  };
10908
10912
  if (this.state !== this.states.connected && this.state !== this.states.connecting) {
10909
10913
  f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.scheduleTransportActivation()", "Current connection state (" + this.state.state + (this.state === this.states.synchronizing ? ", but with an upgrade already in progress" : "") + ") is not valid to upgrade in; abandoning upgrade to " + L.shortName), X();
@@ -10929,11 +10933,11 @@ var Yc = { exports: {} };
10929
10933
  var ne = function() {
10930
10934
  f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.scheduleTransportActivation()", "Activating transport; transport = " + L), L.send(v.default.fromValues({
10931
10935
  action: p.ACTIVATE
10932
- })), W.activateTransport(b, L, B, _), W.state === W.states.synchronizing ? (f.default.logAction(f.default.LOG_MICRO, "ConnectionManager.scheduleTransportActivation()", "Pre-upgrade protocol idle, sending queued messages on upgraded transport; transport = " + L), W.state = W.states.connected) : f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.scheduleTransportActivation()", "Pre-upgrade protocol idle, but state is now " + W.state.state + ", so leaving unchanged"), W.state.sendEvents && W.sendQueuedMessages();
10936
+ })), V.activateTransport(b, L, B, _), V.state === V.states.synchronizing ? (f.default.logAction(f.default.LOG_MICRO, "ConnectionManager.scheduleTransportActivation()", "Pre-upgrade protocol idle, sending queued messages on upgraded transport; transport = " + L), V.state = V.states.connected) : f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.scheduleTransportActivation()", "Pre-upgrade protocol idle, but state is now " + V.state.state + ", so leaving unchanged"), V.state.sendEvents && V.sendQueuedMessages();
10933
10937
  };
10934
10938
  te ? te.onceIdle(ne) : ne();
10935
10939
  }, F.prototype.activateTransport = function(b, L, B, _) {
10936
- var W = this;
10940
+ var V = this;
10937
10941
  f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.activateTransport()", "transport = " + L), b && f.default.logAction(f.default.LOG_ERROR, "ConnectionManager.activateTransport()", "error = " + b), B && f.default.logAction(f.default.LOG_MICRO, "ConnectionManager.activateTransport()", "connectionId = " + B), _ && f.default.logAction(f.default.LOG_MICRO, "ConnectionManager.activateTransport()", "connectionDetails = " + JSON.stringify(_)), this.persistTransportPreference(L);
10938
10942
  var Y = this.state, X = this.states.connected.state;
10939
10943
  if (f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.activateTransport()", "current state = " + Y.state), Y.state == this.states.closing.state || Y.state == this.states.closed.state || Y.state == this.states.failed.state)
@@ -10945,7 +10949,7 @@ var Yc = { exports: {} };
10945
10949
  var ne = _.connectionKey;
10946
10950
  if (ne && this.connectionKey != ne && this.setConnection(B, _, !!b), this.onConnectionDetailsUpdate(_, L), R.default.Config.nextTick(function() {
10947
10951
  L.on("connected", function(Z, de, Re) {
10948
- W.onConnectionDetailsUpdate(Re, L), W.emit("update", new E.default(X, X, null, Z));
10952
+ V.onConnectionDetailsUpdate(Re, L), V.emit("update", new E.default(X, X, null, Z));
10949
10953
  });
10950
10954
  }), Y.state === this.states.connected.state ? b && (this.errorReason = this.realtime.connection.errorReason = b, this.emit("update", new E.default(X, X, null, b))) : (this.notifyState({ state: "connected", error: b }), this.errorReason = this.realtime.connection.errorReason = b || null), this.emit("transport.active", L), te)
10951
10955
  if (te.messageQueue.count() > 0 && f.default.logAction(f.default.LOG_ERROR, "ConnectionManager.activateTransport()", "Previous active protocol (for transport " + te.transport.shortName + ", new one is " + L.shortName + ") finishing with " + te.messageQueue.count() + " messages still pending"), te.transport === L) {
@@ -10956,17 +10960,17 @@ var Yc = { exports: {} };
10956
10960
  return m.safeArrForEach(this.pendingTransports, function(Z) {
10957
10961
  if (Z === L) {
10958
10962
  var de = "Assumption violated: activating a transport that is still marked as a pending transport; transport = " + L.shortName + "; stack = " + new Error().stack;
10959
- f.default.logAction(f.default.LOG_ERROR, "ConnectionManager.activateTransport()", de), m.arrDeleteValue(W.pendingTransports, L);
10963
+ f.default.logAction(f.default.LOG_ERROR, "ConnectionManager.activateTransport()", de), m.arrDeleteValue(V.pendingTransports, L);
10960
10964
  } else
10961
10965
  Z.disconnect();
10962
10966
  }), m.safeArrForEach(this.proposedTransports, function(Z) {
10963
- Z === L ? (f.default.logAction(f.default.LOG_ERROR, "ConnectionManager.activateTransport()", "Assumption violated: activating a transport that is still marked as a proposed transport; transport = " + L.shortName + "; stack = " + new Error().stack), m.arrDeleteValue(W.proposedTransports, L)) : Z.dispose();
10967
+ Z === L ? (f.default.logAction(f.default.LOG_ERROR, "ConnectionManager.activateTransport()", "Assumption violated: activating a transport that is still marked as a proposed transport; transport = " + L.shortName + "; stack = " + new Error().stack), m.arrDeleteValue(V.proposedTransports, L)) : Z.dispose();
10964
10968
  }), !0;
10965
10969
  }, F.prototype.deactivateTransport = function(b, L, B) {
10966
- var _ = this.activeProtocol, W = _ && _.getTransport() === b, Y = m.arrDeleteValue(this.pendingTransports, b), X = m.arrDeleteValue(this.proposedTransports, b), te = this.noTransportsScheduledForActivation();
10967
- if (f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.deactivateTransport()", "transport = " + b), f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.deactivateTransport()", "state = " + L + (W ? "; was active" : Y ? "; was pending" : X ? "; was proposed" : "") + (te ? "" : "; another transport is scheduled for activation")), B && B.message && f.default.logAction(f.default.LOG_MICRO, "ConnectionManager.deactivateTransport()", "reason = " + B.message), W && (f.default.logAction(f.default.LOG_MICRO, "ConnectionManager.deactivateTransport()", "Getting, clearing, and requeuing " + this.activeProtocol.messageQueue.count() + " pending messages"), this.queuePendingMessages(_.getPendingMessages()), R.default.Config.nextTick(function() {
10970
+ var _ = this.activeProtocol, V = _ && _.getTransport() === b, Y = m.arrDeleteValue(this.pendingTransports, b), X = m.arrDeleteValue(this.proposedTransports, b), te = this.noTransportsScheduledForActivation();
10971
+ if (f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.deactivateTransport()", "transport = " + b), f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.deactivateTransport()", "state = " + L + (V ? "; was active" : Y ? "; was pending" : X ? "; was proposed" : "") + (te ? "" : "; another transport is scheduled for activation")), B && B.message && f.default.logAction(f.default.LOG_MICRO, "ConnectionManager.deactivateTransport()", "reason = " + B.message), V && (f.default.logAction(f.default.LOG_MICRO, "ConnectionManager.deactivateTransport()", "Getting, clearing, and requeuing " + this.activeProtocol.messageQueue.count() + " pending messages"), this.queuePendingMessages(_.getPendingMessages()), R.default.Config.nextTick(function() {
10968
10972
  _.clearPendingMessages();
10969
- }), this.activeProtocol = this.host = null), this.emit("transport.inactive", b), W && te || W && L === "failed" || L === "closed" || _ === null && Y && this.pendingTransports.length === 0) {
10973
+ }), this.activeProtocol = this.host = null), this.emit("transport.inactive", b), V && te || V && L === "failed" || L === "closed" || _ === null && Y && this.pendingTransports.length === 0) {
10970
10974
  if (L === "disconnected" && B && B.statusCode > 500 && this.httpHosts.length > 1) {
10971
10975
  this.unpersistTransportPreference(), this.forceFallbackHost = !0, this.notifyState({ state: L, error: B, retryImmediately: !0 });
10972
10976
  return;
@@ -10975,14 +10979,14 @@ var Yc = { exports: {} };
10975
10979
  this.notifyState({ state: ne, error: B });
10976
10980
  return;
10977
10981
  }
10978
- W && L === "disconnected" && this.state !== this.states.synchronizing && (f.default.logAction(f.default.LOG_MICRO, "ConnectionManager.deactivateTransport()", "wasActive but another transport is connected and scheduled for activation, so going into the connecting state until it activates"), this.startSuspendTimer(), this.startTransitionTimer(this.states.connecting), this.notifyState({ state: "connecting", error: B }));
10982
+ V && L === "disconnected" && this.state !== this.states.synchronizing && (f.default.logAction(f.default.LOG_MICRO, "ConnectionManager.deactivateTransport()", "wasActive but another transport is connected and scheduled for activation, so going into the connecting state until it activates"), this.startSuspendTimer(), this.startTransitionTimer(this.states.connecting), this.notifyState({ state: "connecting", error: B }));
10979
10983
  }, F.prototype.noTransportsScheduledForActivation = function() {
10980
10984
  return m.isEmpty(this.pendingTransports) || this.pendingTransports.every(function(b) {
10981
10985
  return !b.isConnected;
10982
10986
  });
10983
10987
  }, F.prototype.setConnection = function(b, L, B) {
10984
- var _ = this.connectionId, W = _ && _ !== b, Y = !_ && B;
10985
- (W || Y) && (f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.setConnection()", "Resetting msgSerial"), this.msgSerial = 0, this.queuedMessages.resetSendAttempted()), this.connectionId !== b && f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.setConnection()", "New connectionId; reattaching any attached channels"), this.realtime.connection.id = this.connectionId = b, this.realtime.connection.key = this.connectionKey = L.connectionKey;
10988
+ var _ = this.connectionId, V = _ && _ !== b, Y = !_ && B;
10989
+ (V || Y) && (f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.setConnection()", "Resetting msgSerial"), this.msgSerial = 0, this.queuedMessages.resetSendAttempted()), this.connectionId !== b && f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.setConnection()", "New connectionId; reattaching any attached channels"), this.realtime.connection.id = this.connectionId = b, this.realtime.connection.key = this.connectionKey = L.connectionKey;
10986
10990
  }, F.prototype.clearConnection = function() {
10987
10991
  this.realtime.connection.id = this.connectionId = void 0, this.realtime.connection.key = this.connectionKey = void 0, this.msgSerial = 0, this.unpersistConnection();
10988
10992
  }, F.prototype.createRecoveryKey = function() {
@@ -11044,8 +11048,8 @@ var Yc = { exports: {} };
11044
11048
  }, F.prototype.cancelRetryTimer = function() {
11045
11049
  this.retryTimer && (clearTimeout(this.retryTimer), this.retryTimer = null);
11046
11050
  }, F.prototype.notifyState = function(b) {
11047
- var L = this, B, _, W = b.state, Y = W === "disconnected" && (this.state === this.states.connected || this.state === this.states.synchronizing || b.retryImmediately || this.state === this.states.connecting && b.error && d.default.isTokenErr(b.error) && !(this.errorReason && d.default.isTokenErr(this.errorReason)));
11048
- if (f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.notifyState()", "new state: " + W + (Y ? "; will retry connection immediately" : "")), W != this.state.state && (this.cancelTransitionTimer(), this.cancelRetryTimer(), this.checkSuspendTimer(b.state), (W === "suspended" || W === "connected") && (this.disconnectedRetryCount = 0), !this.state.terminal)) {
11051
+ var L = this, B, _, V = b.state, Y = V === "disconnected" && (this.state === this.states.connected || this.state === this.states.synchronizing || b.retryImmediately || this.state === this.states.connecting && b.error && d.default.isTokenErr(b.error) && !(this.errorReason && d.default.isTokenErr(this.errorReason)));
11052
+ if (f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.notifyState()", "new state: " + V + (Y ? "; will retry connection immediately" : "")), V != this.state.state && (this.cancelTransitionTimer(), this.cancelRetryTimer(), this.checkSuspendTimer(b.state), (V === "suspended" || V === "connected") && (this.disconnectedRetryCount = 0), !this.state.terminal)) {
11049
11053
  var X = this.states[b.state], te = X.retryDelay;
11050
11054
  X.state === "disconnected" && (this.disconnectedRetryCount++, te = m.getRetryTime(X.retryDelay, this.disconnectedRetryCount));
11051
11055
  var ne = new E.default(this.state.state, X.state, te, b.error || ((_ = (B = P.default)[X.state]) === null || _ === void 0 ? void 0 : _.call(B)));
@@ -11054,18 +11058,18 @@ var Yc = { exports: {} };
11054
11058
  L.state === L.states.disconnected && (L.lastAutoReconnectAttempt = m.now(), L.requestState({ state: "connecting" }));
11055
11059
  }, Z = this.lastAutoReconnectAttempt && m.now() - this.lastAutoReconnectAttempt + 1;
11056
11060
  Z && Z < 1e3 ? (f.default.logAction(f.default.LOG_MICRO, "ConnectionManager.notifyState()", "Last reconnect attempt was only " + Z + "ms ago, waiting another " + (1e3 - Z) + "ms before trying again"), setTimeout(le, 1e3 - Z)) : R.default.Config.nextTick(le);
11057
- } else (W === "disconnected" || W === "suspended") && this.startRetryTimer(te);
11058
- (W === "disconnected" && !Y || W === "suspended" || X.terminal) && R.default.Config.nextTick(function() {
11061
+ } else (V === "disconnected" || V === "suspended") && this.startRetryTimer(te);
11062
+ (V === "disconnected" && !Y || V === "suspended" || X.terminal) && R.default.Config.nextTick(function() {
11059
11063
  L.disconnectAllTransports();
11060
- }), W == "connected" && !this.activeProtocol && f.default.logAction(f.default.LOG_ERROR, "ConnectionManager.notifyState()", "Broken invariant: attempted to go into connected state, but there is no active protocol"), this.enactStateChange(ne), this.state.sendEvents ? this.sendQueuedMessages() : this.state.queueEvents || (this.realtime.channels.propogateConnectionInterruption(W, ne.reason), this.failQueuedMessages(ne.reason));
11064
+ }), V == "connected" && !this.activeProtocol && f.default.logAction(f.default.LOG_ERROR, "ConnectionManager.notifyState()", "Broken invariant: attempted to go into connected state, but there is no active protocol"), this.enactStateChange(ne), this.state.sendEvents ? this.sendQueuedMessages() : this.state.queueEvents || (this.realtime.channels.propogateConnectionInterruption(V, ne.reason), this.failQueuedMessages(ne.reason));
11061
11065
  }
11062
11066
  }, F.prototype.requestState = function(b) {
11063
- var L = this, B, _, W = b.state;
11064
- if (f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.requestState()", "requested state: " + W + "; current state: " + this.state.state), W != this.state.state && (this.cancelTransitionTimer(), this.cancelRetryTimer(), this.checkSuspendTimer(W), !(W == "connecting" && this.state.state == "connected") && !(W == "closing" && this.state.state == "closed"))) {
11065
- var Y = this.states[W], X = new E.default(this.state.state, Y.state, null, b.error || ((_ = (B = P.default)[Y.state]) === null || _ === void 0 ? void 0 : _.call(B)));
11066
- this.enactStateChange(X), W == "connecting" && R.default.Config.nextTick(function() {
11067
+ var L = this, B, _, V = b.state;
11068
+ if (f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.requestState()", "requested state: " + V + "; current state: " + this.state.state), V != this.state.state && (this.cancelTransitionTimer(), this.cancelRetryTimer(), this.checkSuspendTimer(V), !(V == "connecting" && this.state.state == "connected") && !(V == "closing" && this.state.state == "closed"))) {
11069
+ var Y = this.states[V], X = new E.default(this.state.state, Y.state, null, b.error || ((_ = (B = P.default)[Y.state]) === null || _ === void 0 ? void 0 : _.call(B)));
11070
+ this.enactStateChange(X), V == "connecting" && R.default.Config.nextTick(function() {
11067
11071
  L.startConnect();
11068
- }), W == "closing" && this.closeImpl();
11072
+ }), V == "closing" && this.closeImpl();
11069
11073
  }
11070
11074
  }, F.prototype.startConnect = function() {
11071
11075
  var b = this;
@@ -11085,38 +11089,38 @@ var Yc = { exports: {} };
11085
11089
  if (f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.startConnect()", "starting connection"), this.startSuspendTimer(), this.startTransitionTimer(this.states.connecting), L.method === "basic")
11086
11090
  _();
11087
11091
  else {
11088
- var W = function(Y) {
11092
+ var V = function(Y) {
11089
11093
  B === b.connectCounter && (Y ? b.actOnErrorFromAuthorize(Y) : _());
11090
11094
  };
11091
- this.errorReason && d.default.isTokenErr(this.errorReason) ? L._forceNewToken(null, null, W) : L._ensureValidAuthCredentials(!1, W);
11095
+ this.errorReason && d.default.isTokenErr(this.errorReason) ? L._forceNewToken(null, null, V) : L._ensureValidAuthCredentials(!1, V);
11092
11096
  }
11093
11097
  }, F.prototype.connectImpl = function(b, L) {
11094
11098
  var B = this.state.state;
11095
11099
  B !== this.states.connecting.state && B !== this.states.connected.state ? f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.connectImpl()", "Must be in connecting state to connect (or connected to upgrade), but was " + B) : this.pendingTransports.length ? f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.connectImpl()", "Transports " + this.pendingTransports[0].toString() + " currently pending; taking no action") : B == this.states.connected.state ? this.upgradeIfNeeded(b) : this.transports.length > 1 && this.getTransportPreference() ? this.connectPreference(b, L) : this.connectBase(b, L);
11096
11100
  }, F.prototype.connectPreference = function(b, L) {
11097
- var B = this, _ = this.getTransportPreference(), W = !1;
11101
+ var B = this, _ = this.getTransportPreference(), V = !1;
11098
11102
  m.arrIn(this.transports, _) || (this.unpersistTransportPreference(), this.connectImpl(b, L)), f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.connectPreference()", "Trying to connect with stored transport preference " + _);
11099
11103
  var Y = setTimeout(function() {
11100
- W = !0, B.state.state !== B.states.connected.state && (f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.connectPreference()", "Shortcircuit connection attempt with " + _ + " failed; clearing preference and trying from scratch"), B.disconnectAllTransports(), B.unpersistTransportPreference()), B.connectImpl(b, L);
11104
+ V = !0, B.state.state !== B.states.connected.state && (f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.connectPreference()", "Shortcircuit connection attempt with " + _ + " failed; clearing preference and trying from scratch"), B.disconnectAllTransports(), B.unpersistTransportPreference()), B.connectImpl(b, L);
11101
11105
  }, this.options.timeouts.preferenceConnectTimeout);
11102
11106
  b.host = this.httpHosts[0], this.tryATransport(b, _, function(X, te) {
11103
- clearTimeout(Y), W && te ? (te.off(), te.disconnect(), m.arrDeleteValue(B.pendingTransports, te)) : !te && !X && (B.unpersistTransportPreference(), B.connectImpl(b, L));
11107
+ clearTimeout(Y), V && te ? (te.off(), te.disconnect(), m.arrDeleteValue(B.pendingTransports, te)) : !te && !X && (B.unpersistTransportPreference(), B.connectImpl(b, L));
11104
11108
  });
11105
11109
  }, F.prototype.connectBase = function(b, L) {
11106
11110
  var B = this, _ = function(ne) {
11107
11111
  B.notifyState({ state: B.states.connecting.failState, error: ne });
11108
- }, W = this.httpHosts.slice(), Y = function(ne, le) {
11112
+ }, V = this.httpHosts.slice(), Y = function(ne, le) {
11109
11113
  L === B.connectCounter && !le && !ne && te();
11110
11114
  };
11111
11115
  f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.connectBase()", "Trying to connect with base transport " + this.baseTransport);
11112
- var X = W.shift();
11116
+ var X = V.shift();
11113
11117
  if (!X) {
11114
11118
  _(new y.default("Unable to connect (no available host)", 80003, 404));
11115
11119
  return;
11116
11120
  }
11117
11121
  b.host = X;
11118
11122
  var te = function() {
11119
- if (!W.length) {
11123
+ if (!V.length) {
11120
11124
  _(new y.default("Unable to connect (and no more fallback hosts to try)", 80003, 404));
11121
11125
  return;
11122
11126
  }
@@ -11134,11 +11138,11 @@ var Yc = { exports: {} };
11134
11138
  _(new y.default("Unable to connect (network unreachable)", 80003, 404));
11135
11139
  return;
11136
11140
  }
11137
- b.host = m.arrPopRandomElement(W), B.tryATransport(b, B.baseTransport, Y);
11141
+ b.host = m.arrPopRandomElement(V), B.tryATransport(b, B.baseTransport, Y);
11138
11142
  }
11139
11143
  });
11140
11144
  };
11141
- if (this.forceFallbackHost && W.length) {
11145
+ if (this.forceFallbackHost && V.length) {
11142
11146
  this.forceFallbackHost = !1, te();
11143
11147
  return;
11144
11148
  }
@@ -11149,8 +11153,8 @@ var Yc = { exports: {} };
11149
11153
  }, F.prototype.upgradeIfNeeded = function(b) {
11150
11154
  var L = this, B = this.getUpgradePossibilities();
11151
11155
  f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.upgradeIfNeeded()", "upgrade possibilities: " + R.default.Config.inspect(B)), B.length && m.arrForEach(B, function(_) {
11152
- var W = L.createTransportParams(b.host, "upgrade");
11153
- L.tryATransport(W, _, x);
11156
+ var V = L.createTransportParams(b.host, "upgrade");
11157
+ L.tryATransport(V, _, x);
11154
11158
  });
11155
11159
  }, F.prototype.closeImpl = function() {
11156
11160
  f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.closeImpl()", "closing connection"), this.cancelSuspendTimer(), this.startTransitionTimer(this.states.closing), m.safeArrForEach(this.pendingTransports, function(b) {
@@ -11167,9 +11171,9 @@ var Yc = { exports: {} };
11167
11171
  /* exceptActive: */
11168
11172
  !0
11169
11173
  );
11170
- var W = this.activeProtocol.getTransport().params;
11174
+ var V = this.activeProtocol.getTransport().params;
11171
11175
  R.default.Config.nextTick(function() {
11172
- B.state.state === "connected" && B.upgradeIfNeeded(W);
11176
+ B.state.state === "connected" && B.upgradeIfNeeded(V);
11173
11177
  });
11174
11178
  }
11175
11179
  var Y = (_ = this.activeProtocol) === null || _ === void 0 ? void 0 : _.getTransport();
@@ -11221,8 +11225,8 @@ var Yc = { exports: {} };
11221
11225
  f.default.logAction(f.default.LOG_MICRO, "ConnectionManager.send()", "sending event"), this.sendImpl(new S.PendingMessage(b, B));
11222
11226
  return;
11223
11227
  }
11224
- var W = L && _.queueEvents || _.forceQueueEvents;
11225
- if (!W) {
11228
+ var V = L && _.queueEvents || _.forceQueueEvents;
11229
+ if (!V) {
11226
11230
  var Y = "rejecting event, queueEvent was " + L + ", state was " + _.state;
11227
11231
  f.default.logAction(f.default.LOG_MICRO, "ConnectionManager.send()", Y), B(this.errorReason || new y.default(Y, 9e4, 400));
11228
11232
  return;
@@ -11258,10 +11262,10 @@ var Yc = { exports: {} };
11258
11262
  f.default.logAction(f.default.LOG_MINOR, "ConnectionManager.ping()", "transport = " + b);
11259
11263
  var _ = function() {
11260
11264
  b.off("heartbeat", X), L(new y.default("Timeout waiting for heartbeat response", 5e4, 500));
11261
- }, W = m.now(), Y = m.cheapRandStr(), X = function(de) {
11265
+ }, V = m.now(), Y = m.cheapRandStr(), X = function(de) {
11262
11266
  if (de === Y) {
11263
11267
  b.off("heartbeat", X), clearTimeout(te);
11264
- var Re = m.now() - W;
11268
+ var Re = m.now() - V;
11265
11269
  L(null, Re);
11266
11270
  }
11267
11271
  }, te = setTimeout(_, this.options.timeouts.realtimeRequestTimeout);
@@ -11316,13 +11320,13 @@ var Yc = { exports: {} };
11316
11320
  return;
11317
11321
  }
11318
11322
  }
11319
- var W = b.connectionStateTtl;
11320
- W && (this.connectionStateTtl = W), this.maxIdleInterval = b.maxIdleInterval, this.emit("connectiondetails", b);
11323
+ var V = b.connectionStateTtl;
11324
+ V && (this.connectionStateTtl = V), this.maxIdleInterval = b.maxIdleInterval, this.emit("connectiondetails", b);
11321
11325
  }
11322
11326
  }, F.supportedTransports = {}, F;
11323
11327
  }(C.default)
11324
11328
  );
11325
- r.default = V;
11329
+ r.default = W;
11326
11330
  }).call(this, o(13));
11327
11331
  },
11328
11332
  /* 36 */
@@ -11663,8 +11667,8 @@ var Yc = { exports: {} };
11663
11667
  clientId: x.clientId
11664
11668
  };
11665
11669
  Object.entries(s).find(function(U) {
11666
- var z = U[0], V = U[1];
11667
- return V !== void 0 ? j[z] !== V : !1;
11670
+ var z = U[0], W = U[1];
11671
+ return W !== void 0 ? j[z] !== W : !1;
11668
11672
  }) || g(x);
11669
11673
  };
11670
11674
  this._addFilteredSubscription(s, g, p), this.subscriptions.on(p);
@@ -11755,9 +11759,9 @@ var Yc = { exports: {} };
11755
11759
  if (p = !0, g = this.syncChannelSerial = s.channelSerial, !s.presence)
11756
11760
  break;
11757
11761
  case y.PRESENCE: {
11758
- for (var A = s.presence, j = s.id, U = s.connectionId, z = s.timestamp, V = this.channelOptions, G = void 0, F = 0; F < A.length; F++)
11762
+ for (var A = s.presence, j = s.id, U = s.connectionId, z = s.timestamp, W = this.channelOptions, G = void 0, F = 0; F < A.length; F++)
11759
11763
  try {
11760
- G = A[F], E.default.decode(G, V), G.connectionId || (G.connectionId = U), G.timestamp || (G.timestamp = z), G.id || (G.id = j + ":" + F);
11764
+ G = A[F], E.default.decode(G, W), G.connectionId || (G.connectionId = U), G.timestamp || (G.timestamp = z), G.id || (G.id = j + ":" + F);
11761
11765
  } catch (Y) {
11762
11766
  T.default.logAction(T.default.LOG_ERROR, "RealtimeChannel.onMessage()", Y.toString());
11763
11767
  }
@@ -11796,8 +11800,8 @@ var Yc = { exports: {} };
11796
11800
  break;
11797
11801
  }
11798
11802
  case y.ERROR: {
11799
- var W = s.error;
11800
- W && W.code == 80016 ? this.checkPendingState() : this.notifyState("failed", f.default.fromValues(W));
11803
+ var V = s.error;
11804
+ V && V.code == 80016 ? this.checkPendingState() : this.notifyState("failed", f.default.fromValues(V));
11801
11805
  break;
11802
11806
  }
11803
11807
  default:
@@ -13516,8 +13520,8 @@ var Yc = { exports: {} };
13516
13520
  var g = new Uint32Array(c);
13517
13521
  s = function(A, j) {
13518
13522
  var U = A / 4, z = U == c ? g : new Uint32Array(U);
13519
- E.getRandomValues(z, function(V) {
13520
- typeof j != "undefined" && j(V, P.toWordArray(z));
13523
+ E.getRandomValues(z, function(W) {
13524
+ typeof j != "undefined" && j(W, P.toWordArray(z));
13521
13525
  });
13522
13526
  };
13523
13527
  } else
@@ -13527,8 +13531,8 @@ var Yc = { exports: {} };
13527
13531
  "Ably.Crypto.generateRandom()",
13528
13532
  "Warning: the browser you are using does not support secure cryptographically secure randomness generation; falling back to insecure Math.random()"
13529
13533
  );
13530
- for (var U = A / 4, z = new Array(U), V = 0; V < U; V++)
13531
- z[V] = Math.floor(Math.random() * u) - l;
13534
+ for (var U = A / 4, z = new Array(U), W = 0; W < U; W++)
13535
+ z[W] = Math.floor(Math.random() * u) - l;
13532
13536
  j(null, a.a.create(z));
13533
13537
  };
13534
13538
  function p(A) {
@@ -13614,13 +13618,13 @@ var Yc = { exports: {} };
13614
13618
  }
13615
13619
  return M.prototype.encrypt = function(A, j) {
13616
13620
  R.a.logAction(R.a.LOG_MICRO, "CBCCipher.encrypt()", ""), A = P.toWordArray(A);
13617
- var U = A.sigBytes, z = p(U), V = this, G = function() {
13618
- V.getIv(function(F, b) {
13621
+ var U = A.sigBytes, z = p(U), W = this, G = function() {
13622
+ W.getIv(function(F, b) {
13619
13623
  if (F) {
13620
13624
  j(F);
13621
13625
  return;
13622
13626
  }
13623
- var L = V.encryptCipher.process(A.concat(N[z - U])), B = b.concat(L);
13627
+ var L = W.encryptCipher.process(A.concat(N[z - U])), B = b.concat(L);
13624
13628
  j(null, B);
13625
13629
  });
13626
13630
  };
@@ -13629,11 +13633,11 @@ var Yc = { exports: {} };
13629
13633
  j(F);
13630
13634
  return;
13631
13635
  }
13632
- V.encryptCipher = S.a.algo[V.cjsAlgorithm].createEncryptor(V.key, { iv: b }), V.iv = b, G();
13636
+ W.encryptCipher = S.a.algo[W.cjsAlgorithm].createEncryptor(W.key, { iv: b }), W.iv = b, G();
13633
13637
  });
13634
13638
  }, M.prototype.decrypt = function(A) {
13635
13639
  R.a.logAction(R.a.LOG_MICRO, "CBCCipher.decrypt()", ""), A = P.toWordArray(A);
13636
- var j = this.blockLengthWords, U = A.words, z = a.a.create(U.slice(0, j)), V = a.a.create(U.slice(j)), G = S.a.algo[this.cjsAlgorithm].createDecryptor(this.key, { iv: z }), F = G.process(V), b = G.finalize();
13640
+ var j = this.blockLengthWords, U = A.words, z = a.a.create(U.slice(0, j)), W = a.a.create(U.slice(j)), G = S.a.algo[this.cjsAlgorithm].createDecryptor(this.key, { iv: z }), F = G.process(W), b = G.finalize();
13637
13641
  return G.reset(), b && b.sigBytes && F.concat(b), F;
13638
13642
  }, M.prototype.getIv = function(A) {
13639
13643
  if (this.iv) {
@@ -13642,12 +13646,12 @@ var Yc = { exports: {} };
13642
13646
  return;
13643
13647
  }
13644
13648
  var U = this;
13645
- s(w, function(z, V) {
13649
+ s(w, function(z, W) {
13646
13650
  if (z) {
13647
13651
  A(z);
13648
13652
  return;
13649
13653
  }
13650
- A(null, U.encryptCipher.process(V));
13654
+ A(null, U.encryptCipher.process(W));
13651
13655
  });
13652
13656
  }, k;
13653
13657
  };
@@ -13839,11 +13843,11 @@ var Yc = { exports: {} };
13839
13843
  },
13840
13844
  _doCryptBlock: function(u, l, s, g, p, x, D, N) {
13841
13845
  for (var k = this._nRounds, I = u[l] ^ s[0], M = u[l + 1] ^ s[1], A = u[l + 2] ^ s[2], j = u[l + 3] ^ s[3], U = 4, z = 1; z < k; z++) {
13842
- var V = g[I >>> 24] ^ p[M >>> 16 & 255] ^ x[A >>> 8 & 255] ^ D[j & 255] ^ s[U++], G = g[M >>> 24] ^ p[A >>> 16 & 255] ^ x[j >>> 8 & 255] ^ D[I & 255] ^ s[U++], F = g[A >>> 24] ^ p[j >>> 16 & 255] ^ x[I >>> 8 & 255] ^ D[M & 255] ^ s[U++], b = g[j >>> 24] ^ p[I >>> 16 & 255] ^ x[M >>> 8 & 255] ^ D[A & 255] ^ s[U++];
13843
- I = V, M = G, A = F, j = b;
13846
+ var W = g[I >>> 24] ^ p[M >>> 16 & 255] ^ x[A >>> 8 & 255] ^ D[j & 255] ^ s[U++], G = g[M >>> 24] ^ p[A >>> 16 & 255] ^ x[j >>> 8 & 255] ^ D[I & 255] ^ s[U++], F = g[A >>> 24] ^ p[j >>> 16 & 255] ^ x[I >>> 8 & 255] ^ D[M & 255] ^ s[U++], b = g[j >>> 24] ^ p[I >>> 16 & 255] ^ x[M >>> 8 & 255] ^ D[A & 255] ^ s[U++];
13847
+ I = W, M = G, A = F, j = b;
13844
13848
  }
13845
- var V = (N[I >>> 24] << 24 | N[M >>> 16 & 255] << 16 | N[A >>> 8 & 255] << 8 | N[j & 255]) ^ s[U++], G = (N[M >>> 24] << 24 | N[A >>> 16 & 255] << 16 | N[j >>> 8 & 255] << 8 | N[I & 255]) ^ s[U++], F = (N[A >>> 24] << 24 | N[j >>> 16 & 255] << 16 | N[I >>> 8 & 255] << 8 | N[M & 255]) ^ s[U++], b = (N[j >>> 24] << 24 | N[I >>> 16 & 255] << 16 | N[M >>> 8 & 255] << 8 | N[A & 255]) ^ s[U++];
13846
- u[l] = V, u[l + 1] = G, u[l + 2] = F, u[l + 3] = b;
13849
+ var W = (N[I >>> 24] << 24 | N[M >>> 16 & 255] << 16 | N[A >>> 8 & 255] << 8 | N[j & 255]) ^ s[U++], G = (N[M >>> 24] << 24 | N[A >>> 16 & 255] << 16 | N[j >>> 8 & 255] << 8 | N[I & 255]) ^ s[U++], F = (N[A >>> 24] << 24 | N[j >>> 16 & 255] << 16 | N[I >>> 8 & 255] << 8 | N[M & 255]) ^ s[U++], b = (N[j >>> 24] << 24 | N[I >>> 16 & 255] << 16 | N[M >>> 8 & 255] << 8 | N[A & 255]) ^ s[U++];
13850
+ u[l] = W, u[l + 1] = G, u[l + 2] = F, u[l + 3] = b;
13847
13851
  },
13848
13852
  keySize: 256 / 32
13849
13853
  });
@@ -13877,8 +13881,8 @@ var Yc = { exports: {} };
13877
13881
  var c = h + w, u = d[c];
13878
13882
  d[c] = (u << 8 | u >>> 24) & 16711935 | (u << 24 | u >>> 8) & 4278255360;
13879
13883
  }
13880
- var l = this._hash.words, s = d[h + 0], g = d[h + 1], p = d[h + 2], x = d[h + 3], D = d[h + 4], N = d[h + 5], k = d[h + 6], I = d[h + 7], M = d[h + 8], A = d[h + 9], j = d[h + 10], U = d[h + 11], z = d[h + 12], V = d[h + 13], G = d[h + 14], F = d[h + 15], b = l[0], L = l[1], B = l[2], _ = l[3];
13881
- b = f(b, L, B, _, s, 7, C[0]), _ = f(_, b, L, B, g, 12, C[1]), B = f(B, _, b, L, p, 17, C[2]), L = f(L, B, _, b, x, 22, C[3]), b = f(b, L, B, _, D, 7, C[4]), _ = f(_, b, L, B, N, 12, C[5]), B = f(B, _, b, L, k, 17, C[6]), L = f(L, B, _, b, I, 22, C[7]), b = f(b, L, B, _, M, 7, C[8]), _ = f(_, b, L, B, A, 12, C[9]), B = f(B, _, b, L, j, 17, C[10]), L = f(L, B, _, b, U, 22, C[11]), b = f(b, L, B, _, z, 7, C[12]), _ = f(_, b, L, B, V, 12, C[13]), B = f(B, _, b, L, G, 17, C[14]), L = f(L, B, _, b, F, 22, C[15]), b = E(b, L, B, _, g, 5, C[16]), _ = E(_, b, L, B, k, 9, C[17]), B = E(B, _, b, L, U, 14, C[18]), L = E(L, B, _, b, s, 20, C[19]), b = E(b, L, B, _, N, 5, C[20]), _ = E(_, b, L, B, j, 9, C[21]), B = E(B, _, b, L, F, 14, C[22]), L = E(L, B, _, b, D, 20, C[23]), b = E(b, L, B, _, A, 5, C[24]), _ = E(_, b, L, B, G, 9, C[25]), B = E(B, _, b, L, x, 14, C[26]), L = E(L, B, _, b, M, 20, C[27]), b = E(b, L, B, _, V, 5, C[28]), _ = E(_, b, L, B, p, 9, C[29]), B = E(B, _, b, L, I, 14, C[30]), L = E(L, B, _, b, z, 20, C[31]), b = P(b, L, B, _, N, 4, C[32]), _ = P(_, b, L, B, M, 11, C[33]), B = P(B, _, b, L, U, 16, C[34]), L = P(L, B, _, b, G, 23, C[35]), b = P(b, L, B, _, g, 4, C[36]), _ = P(_, b, L, B, D, 11, C[37]), B = P(B, _, b, L, I, 16, C[38]), L = P(L, B, _, b, j, 23, C[39]), b = P(b, L, B, _, V, 4, C[40]), _ = P(_, b, L, B, s, 11, C[41]), B = P(B, _, b, L, x, 16, C[42]), L = P(L, B, _, b, k, 23, C[43]), b = P(b, L, B, _, A, 4, C[44]), _ = P(_, b, L, B, z, 11, C[45]), B = P(B, _, b, L, F, 16, C[46]), L = P(L, B, _, b, p, 23, C[47]), b = y(b, L, B, _, s, 6, C[48]), _ = y(_, b, L, B, I, 10, C[49]), B = y(B, _, b, L, G, 15, C[50]), L = y(L, B, _, b, N, 21, C[51]), b = y(b, L, B, _, z, 6, C[52]), _ = y(_, b, L, B, x, 10, C[53]), B = y(B, _, b, L, j, 15, C[54]), L = y(L, B, _, b, g, 21, C[55]), b = y(b, L, B, _, M, 6, C[56]), _ = y(_, b, L, B, F, 10, C[57]), B = y(B, _, b, L, k, 15, C[58]), L = y(L, B, _, b, V, 21, C[59]), b = y(b, L, B, _, D, 6, C[60]), _ = y(_, b, L, B, U, 10, C[61]), B = y(B, _, b, L, p, 15, C[62]), L = y(L, B, _, b, A, 21, C[63]), l[0] = l[0] + b | 0, l[1] = l[1] + L | 0, l[2] = l[2] + B | 0, l[3] = l[3] + _ | 0;
13884
+ var l = this._hash.words, s = d[h + 0], g = d[h + 1], p = d[h + 2], x = d[h + 3], D = d[h + 4], N = d[h + 5], k = d[h + 6], I = d[h + 7], M = d[h + 8], A = d[h + 9], j = d[h + 10], U = d[h + 11], z = d[h + 12], W = d[h + 13], G = d[h + 14], F = d[h + 15], b = l[0], L = l[1], B = l[2], _ = l[3];
13885
+ b = f(b, L, B, _, s, 7, C[0]), _ = f(_, b, L, B, g, 12, C[1]), B = f(B, _, b, L, p, 17, C[2]), L = f(L, B, _, b, x, 22, C[3]), b = f(b, L, B, _, D, 7, C[4]), _ = f(_, b, L, B, N, 12, C[5]), B = f(B, _, b, L, k, 17, C[6]), L = f(L, B, _, b, I, 22, C[7]), b = f(b, L, B, _, M, 7, C[8]), _ = f(_, b, L, B, A, 12, C[9]), B = f(B, _, b, L, j, 17, C[10]), L = f(L, B, _, b, U, 22, C[11]), b = f(b, L, B, _, z, 7, C[12]), _ = f(_, b, L, B, W, 12, C[13]), B = f(B, _, b, L, G, 17, C[14]), L = f(L, B, _, b, F, 22, C[15]), b = E(b, L, B, _, g, 5, C[16]), _ = E(_, b, L, B, k, 9, C[17]), B = E(B, _, b, L, U, 14, C[18]), L = E(L, B, _, b, s, 20, C[19]), b = E(b, L, B, _, N, 5, C[20]), _ = E(_, b, L, B, j, 9, C[21]), B = E(B, _, b, L, F, 14, C[22]), L = E(L, B, _, b, D, 20, C[23]), b = E(b, L, B, _, A, 5, C[24]), _ = E(_, b, L, B, G, 9, C[25]), B = E(B, _, b, L, x, 14, C[26]), L = E(L, B, _, b, M, 20, C[27]), b = E(b, L, B, _, W, 5, C[28]), _ = E(_, b, L, B, p, 9, C[29]), B = E(B, _, b, L, I, 14, C[30]), L = E(L, B, _, b, z, 20, C[31]), b = P(b, L, B, _, N, 4, C[32]), _ = P(_, b, L, B, M, 11, C[33]), B = P(B, _, b, L, U, 16, C[34]), L = P(L, B, _, b, G, 23, C[35]), b = P(b, L, B, _, g, 4, C[36]), _ = P(_, b, L, B, D, 11, C[37]), B = P(B, _, b, L, I, 16, C[38]), L = P(L, B, _, b, j, 23, C[39]), b = P(b, L, B, _, W, 4, C[40]), _ = P(_, b, L, B, s, 11, C[41]), B = P(B, _, b, L, x, 16, C[42]), L = P(L, B, _, b, k, 23, C[43]), b = P(b, L, B, _, A, 4, C[44]), _ = P(_, b, L, B, z, 11, C[45]), B = P(B, _, b, L, F, 16, C[46]), L = P(L, B, _, b, p, 23, C[47]), b = y(b, L, B, _, s, 6, C[48]), _ = y(_, b, L, B, I, 10, C[49]), B = y(B, _, b, L, G, 15, C[50]), L = y(L, B, _, b, N, 21, C[51]), b = y(b, L, B, _, z, 6, C[52]), _ = y(_, b, L, B, x, 10, C[53]), B = y(B, _, b, L, j, 15, C[54]), L = y(L, B, _, b, g, 21, C[55]), b = y(b, L, B, _, M, 6, C[56]), _ = y(_, b, L, B, F, 10, C[57]), B = y(B, _, b, L, k, 15, C[58]), L = y(L, B, _, b, W, 21, C[59]), b = y(b, L, B, _, D, 6, C[60]), _ = y(_, b, L, B, U, 10, C[61]), B = y(B, _, b, L, p, 15, C[62]), L = y(L, B, _, b, A, 21, C[63]), l[0] = l[0] + b | 0, l[1] = l[1] + L | 0, l[2] = l[2] + B | 0, l[3] = l[3] + _ | 0;
13882
13886
  },
13883
13887
  _doFinalize: function() {
13884
13888
  var d = this._data, h = d.words, w = this._nDataBytes * 8, c = d.sigBytes * 8;
@@ -14007,17 +14011,17 @@ var Yc = { exports: {} };
14007
14011
  }
14008
14012
  var A = function(j, U) {
14009
14013
  var z = j.shift();
14010
- N.doUri(u, l, k(z), g, p, x, function(V) {
14014
+ N.doUri(u, l, k(z), g, p, x, function(W) {
14011
14015
  for (var G = [], F = 1; F < arguments.length; F++)
14012
14016
  G[F - 1] = arguments[F];
14013
- if (V && d(V) && j.length) {
14017
+ if (W && d(W) && j.length) {
14014
14018
  A(j, !0);
14015
14019
  return;
14016
14020
  }
14017
14021
  U && (l._currentFallback = {
14018
14022
  host: z,
14019
14023
  validUntil: m.now() + l.options.timeouts.fallbackRetryTimeout
14020
- }), D == null || D.apply(void 0, a.__spreadArray([V], G, !1));
14024
+ }), D == null || D.apply(void 0, a.__spreadArray([W], G, !1));
14021
14025
  });
14022
14026
  };
14023
14027
  A(M);
@@ -14308,7 +14312,7 @@ const np = /* @__PURE__ */ Al(tp), Ei = (e, t, n, r, o) => rt(void 0, null, func
14308
14312
  id: $t(),
14309
14313
  text: "Lo siento, hubo un problema con la conexión. Esta es una respuesta de demostración.",
14310
14314
  sender: "bot",
14311
- timestamp: /* @__PURE__ */ new Date()
14315
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
14312
14316
  }), ip = (e, t, n, r) => {
14313
14317
  const o = ep(t, e), i = {
14314
14318
  id: e,
@@ -14338,12 +14342,18 @@ const np = /* @__PURE__ */ Al(tp), Ei = (e, t, n, r, o) => rt(void 0, null, func
14338
14342
  } catch (t) {
14339
14343
  return console.error("WebChat: Error sending message to API:", t), null;
14340
14344
  }
14341
- }), sp = (e) => e && e.content ? {
14342
- id: e.id || $t(),
14343
- text: e.content,
14344
- sender: "bot",
14345
- timestamp: /* @__PURE__ */ new Date()
14346
- } : null, lp = (e) => `¡Hola! Soy ${e || "tu asistente"}, ¿En qué te puedo ayudar?
14345
+ }), sp = (e) => {
14346
+ if (e && e.content) {
14347
+ let t;
14348
+ return e.createdAt ? t = e.createdAt.endsWith("Z") ? e.createdAt : `${e.createdAt}Z` : t = (/* @__PURE__ */ new Date()).toISOString(), {
14349
+ id: e.id || $t(),
14350
+ text: e.content,
14351
+ sender: "bot",
14352
+ timestamp: t
14353
+ };
14354
+ }
14355
+ return null;
14356
+ }, lp = (e) => `¡Hola! Soy ${e || "tu asistente"}, ¿En qué te puedo ayudar?
14347
14357
 
14348
14358
  Aunque no lo creas, soy una inteligencia artificial! Puedo resolver todas tus dudas 😊
14349
14359
 
@@ -14351,7 +14361,7 @@ También puedes pedir hablar con nuestro equipo de los sueños!`, up = (e) => ({
14351
14361
  id: $t(),
14352
14362
  text: lp(e),
14353
14363
  sender: "bot",
14354
- timestamp: /* @__PURE__ */ new Date()
14364
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
14355
14365
  }), bl = () => typeof window != "undefined" && window.innerWidth < 640, cp = ({ config: e }) => {
14356
14366
  e.apiKey || console.warn("WebChat: apiKey is required but not provided in config");
14357
14367
  const [t, n] = ie.useState(() => so(e)), [r, o] = ie.useState(!1), [i, a] = ie.useState(() => bl()), [v, m] = ie.useState(""), [S, T] = ie.useState(!1), [R, C] = ie.useState(!1), [O, f] = ie.useState(!1), [E, P] = ie.useState(""), [, y] = ie.useState(null), d = ie.useRef(null), [h, w] = ie.useState(!1), [c, u] = ie.useState(!1), [l, s] = ie.useState(""), [g, p] = ie.useState([
@@ -14359,10 +14369,10 @@ También puedes pedir hablar con nuestro equipo de los sueños!`, up = (e) => ({
14359
14369
  id: $t(),
14360
14370
  text: e.initialMessage,
14361
14371
  sender: "bot",
14362
- timestamp: /* @__PURE__ */ new Date()
14372
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
14363
14373
  } : up(e.title)
14364
14374
  ]), x = ie.useCallback((U, z = "bot") => {
14365
- p((V) => [...V, U]), !r && (U.sender === "bot" || z === "bot") && U.id !== l && w(!0);
14375
+ p((W) => [...W, U]), !r && (U.sender === "bot" || z === "bot") && U.id !== l && w(!0);
14366
14376
  }, [r, l]);
14367
14377
  ie.useEffect(() => {
14368
14378
  const U = () => {
@@ -14378,8 +14388,8 @@ También puedes pedir hablar con nuestro equipo de los sueños!`, up = (e) => ({
14378
14388
  rt(void 0, null, function* () {
14379
14389
  const z = Kc();
14380
14390
  m(z);
14381
- const V = yield Jh();
14382
- P(V);
14391
+ const W = yield Jh();
14392
+ P(W);
14383
14393
  });
14384
14394
  }, []), ie.useEffect(() => {
14385
14395
  if (g.length > 0) {
@@ -14421,7 +14431,7 @@ También puedes pedir hablar con nuestro equipo de los sueños!`, up = (e) => ({
14421
14431
  console.error("[❌ ABLY SETUP ERROR from endpoint]", U);
14422
14432
  }
14423
14433
  }), [c, v, e.apiKey, D]), I = ie.useCallback(() => rt(void 0, null, function* () {
14424
- var z, V;
14434
+ var z, W;
14425
14435
  const U = r;
14426
14436
  if (o((G) => !G), !U) {
14427
14437
  w(!1);
@@ -14431,7 +14441,7 @@ También puedes pedir hablar con nuestro equipo de los sueños!`, up = (e) => ({
14431
14441
  if (!U && !S && v && Rl() && !c) {
14432
14442
  C(!0);
14433
14443
  const G = yield Zh(v, e.apiKey || "");
14434
- if (((V = (z = G == null ? void 0 : G.conversation) == null ? void 0 : z.messages) == null ? void 0 : V.length) > 0) {
14444
+ if (((W = (z = G == null ? void 0 : G.conversation) == null ? void 0 : z.messages) == null ? void 0 : W.length) > 0) {
14435
14445
  const F = qh(G.conversation.messages);
14436
14446
  p(F);
14437
14447
  const b = F.filter((L) => L.sender === "bot").slice(-1)[0];
@@ -14452,44 +14462,44 @@ También puedes pedir hablar con nuestro equipo de los sueños!`, up = (e) => ({
14452
14462
  ]), M = ie.useCallback(() => {
14453
14463
  o(!1);
14454
14464
  }, []), A = ie.useCallback((U) => rt(void 0, null, function* () {
14455
- const z = {
14465
+ const z = (/* @__PURE__ */ new Date()).toISOString(), W = {
14456
14466
  id: $t(),
14457
14467
  text: U,
14458
14468
  sender: "user",
14459
- timestamp: /* @__PURE__ */ new Date()
14469
+ timestamp: z
14460
14470
  };
14461
- p((G) => [...G, z]), f(!0);
14462
- const V = [...g, z];
14471
+ p((F) => [...F, W]), f(!0);
14472
+ const G = [...g, W];
14463
14473
  try {
14464
- const G = ip(
14474
+ const F = ip(
14465
14475
  v,
14466
- V,
14476
+ G,
14467
14477
  { apiKey: e.apiKey || "" },
14468
14478
  E
14469
- ), F = yield ap(G);
14470
- if (F) {
14471
- if (F.response.tokenDetails && !d.current) {
14472
- const L = yield Ei(
14473
- F.response.tokenDetails,
14479
+ ), b = yield ap(F);
14480
+ if (b) {
14481
+ if (b.response.tokenDetails && !d.current) {
14482
+ const B = yield Ei(
14483
+ b.response.tokenDetails,
14474
14484
  e.apiKey || "",
14475
14485
  v,
14476
14486
  D
14477
14487
  );
14478
- y(L), d.current = L.client, u(!0);
14488
+ y(B), d.current = B.client, u(!0);
14479
14489
  }
14480
- const b = sp(F.response.message);
14481
- b && x(b, "bot");
14490
+ const L = sp(b.response.message);
14491
+ L && x(L, "bot");
14482
14492
  } else {
14483
14493
  setTimeout(() => {
14484
- const b = Tl();
14485
- x(b, "bot"), f(!1);
14494
+ const L = Tl();
14495
+ x(L, "bot"), f(!1);
14486
14496
  }, 1e3);
14487
14497
  return;
14488
14498
  }
14489
- } catch (G) {
14490
- console.error("WebChat: Error in message handling:", G), setTimeout(() => {
14491
- const F = Tl();
14492
- x(F, "bot"), f(!1);
14499
+ } catch (F) {
14500
+ console.error("WebChat: Error in message handling:", F), setTimeout(() => {
14501
+ const b = Tl();
14502
+ x(b, "bot"), f(!1);
14493
14503
  }, 1e3);
14494
14504
  return;
14495
14505
  }