@codingfactory/messenger-client 0.2.29 → 0.2.31

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.
Files changed (2) hide show
  1. package/dist/index.js +898 -859
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ref as be, getCurrentInstance as zt, computed as se, watch as ot, onUnmounted as qe, toValue as is, onMounted as jt } from "vue";
1
+ import { ref as ye, getCurrentInstance as zt, computed as re, watch as ot, onUnmounted as qe, toValue as is, onMounted as jt } from "vue";
2
2
  import { defineStore as Di, storeToRefs as Ni } from "pinia";
3
3
  import $t, { isAxiosError as qi, AxiosHeaders as An } from "axios";
4
4
  import { isAxiosError as vc } from "axios";
@@ -14,7 +14,7 @@ const os = () => () => {
14
14
  throw new Error("messenger-client subscribeToConversation is not configured");
15
15
  }, ps = () => {
16
16
  throw new Error("messenger-client subscribeToTyping is not configured");
17
- }, gs = async () => null, H = {
17
+ }, gs = async () => null, $ = {
18
18
  ECHO_INITIALIZED_EVENT: "messenger-client:echo-initialized",
19
19
  getEcho: () => null,
20
20
  waitForEcho: gs,
@@ -29,14 +29,14 @@ const os = () => () => {
29
29
  unsubscribeFromConversation: ds,
30
30
  subscribeToTyping: ps,
31
31
  unsubscribeFromTyping: hs
32
- }, Je = () => H.ECHO_INITIALIZED_EVENT, Ae = () => H.getEcho(), ms = async () => H.waitForEcho(), vs = () => H.getConnectionStatus(), Rn = () => vs(), Ot = () => H.getAccessState(), ht = (e) => H.onConnectionStatusChange(e), ji = (e) => H.onAccessStateChange(e), $i = async () => {
33
- await H.reconnect();
34
- }, Hi = (e) => H.subscribeToPresenceStatus(e), Bi = () => H.unsubscribeFromPresenceStatus(), Vi = (e, n) => H.subscribeToConversation(e, n), Xi = (e) => H.unsubscribeFromConversation(e), Wi = (e, n) => H.subscribeToTyping(e, n), Gi = (e) => H.unsubscribeFromTyping(e);
32
+ }, Je = () => $.ECHO_INITIALIZED_EVENT, Ae = () => $.getEcho(), ms = async () => $.waitForEcho(), vs = () => $.getConnectionStatus(), Rn = () => vs(), Ot = () => $.getAccessState(), ht = (e) => $.onConnectionStatusChange(e), ji = (e) => $.onAccessStateChange(e), $i = async () => {
33
+ await $.reconnect();
34
+ }, Hi = (e) => $.subscribeToPresenceStatus(e), Bi = () => $.unsubscribeFromPresenceStatus(), Vi = (e, n) => $.subscribeToConversation(e, n), Xi = (e) => $.unsubscribeFromConversation(e), Wi = (e, n) => $.subscribeToTyping(e, n), Gi = (e) => $.unsubscribeFromTyping(e);
35
35
  function Ji(e) {
36
- e.initializedEvent && (H.ECHO_INITIALIZED_EVENT = e.initializedEvent), e.getEcho && (H.getEcho = e.getEcho), e.waitForEcho && (H.waitForEcho = e.waitForEcho), e.getConnectionStatus && (H.getConnectionStatus = e.getConnectionStatus), e.getAccessState && (H.getAccessState = e.getAccessState), e.onConnectionStatusChange && (H.onConnectionStatusChange = e.onConnectionStatusChange), e.onAccessStateChange && (H.onAccessStateChange = e.onAccessStateChange), e.reconnect && (H.reconnect = e.reconnect), e.subscribeToPresenceStatus && (H.subscribeToPresenceStatus = e.subscribeToPresenceStatus), e.unsubscribeFromPresenceStatus && (H.unsubscribeFromPresenceStatus = e.unsubscribeFromPresenceStatus), e.subscribeToConversation && (H.subscribeToConversation = e.subscribeToConversation), e.unsubscribeFromConversation && (H.unsubscribeFromConversation = e.unsubscribeFromConversation), e.subscribeToTyping && (H.subscribeToTyping = e.subscribeToTyping), e.unsubscribeFromTyping && (H.unsubscribeFromTyping = e.unsubscribeFromTyping);
36
+ e.initializedEvent && ($.ECHO_INITIALIZED_EVENT = e.initializedEvent), e.getEcho && ($.getEcho = e.getEcho), e.waitForEcho && ($.waitForEcho = e.waitForEcho), e.getConnectionStatus && ($.getConnectionStatus = e.getConnectionStatus), e.getAccessState && ($.getAccessState = e.getAccessState), e.onConnectionStatusChange && ($.onConnectionStatusChange = e.onConnectionStatusChange), e.onAccessStateChange && ($.onAccessStateChange = e.onAccessStateChange), e.reconnect && ($.reconnect = e.reconnect), e.subscribeToPresenceStatus && ($.subscribeToPresenceStatus = e.subscribeToPresenceStatus), e.unsubscribeFromPresenceStatus && ($.unsubscribeFromPresenceStatus = e.unsubscribeFromPresenceStatus), e.subscribeToConversation && ($.subscribeToConversation = e.subscribeToConversation), e.unsubscribeFromConversation && ($.unsubscribeFromConversation = e.unsubscribeFromConversation), e.subscribeToTyping && ($.subscribeToTyping = e.subscribeToTyping), e.unsubscribeFromTyping && ($.unsubscribeFromTyping = e.unsubscribeFromTyping);
37
37
  }
38
38
  function Ki() {
39
- H.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", H.getEcho = () => null, H.waitForEcho = gs, H.getConnectionStatus = () => "disconnected", H.getAccessState = () => "available", H.onConnectionStatusChange = os, H.onAccessStateChange = as, H.reconnect = cs, H.subscribeToPresenceStatus = us, H.unsubscribeFromPresenceStatus = ls, H.subscribeToConversation = fs, H.unsubscribeFromConversation = ds, H.subscribeToTyping = ps, H.unsubscribeFromTyping = hs;
39
+ $.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", $.getEcho = () => null, $.waitForEcho = gs, $.getConnectionStatus = () => "disconnected", $.getAccessState = () => "available", $.onConnectionStatusChange = os, $.onAccessStateChange = as, $.reconnect = cs, $.subscribeToPresenceStatus = us, $.unsubscribeFromPresenceStatus = ls, $.subscribeToConversation = fs, $.unsubscribeFromConversation = ds, $.subscribeToTyping = ps, $.unsubscribeFromTyping = hs;
40
40
  }
41
41
  function xe(e) {
42
42
  return typeof e == "object" && e !== null;
@@ -61,7 +61,7 @@ function no(e) {
61
61
  }
62
62
  const bs = $t;
63
63
  let Ht = bs;
64
- function X() {
64
+ function W() {
65
65
  return Ht;
66
66
  }
67
67
  function so(e) {
@@ -94,7 +94,7 @@ function ao(e) {
94
94
  function co() {
95
95
  Xt = () => _s;
96
96
  }
97
- function Y(e) {
97
+ function Z(e) {
98
98
  if (qi(e)) {
99
99
  const n = e.response?.data?.message || e.message || "An error occurred";
100
100
  return n.includes("SQLSTATE") || n.includes("Connection:") || n.includes("\\Illuminate\\") ? "Something went wrong. Please try again later." : n;
@@ -183,35 +183,35 @@ function Mn(e) {
183
183
  }
184
184
  const Pe = {
185
185
  async fetchFolders() {
186
- const e = await X().get("/v1/messaging/folders");
186
+ const e = await W().get("/v1/messaging/folders");
187
187
  return po($e(e.data));
188
188
  },
189
189
  async createFolder(e) {
190
- const n = await X().post("/v1/messaging/folders", e);
190
+ const n = await W().post("/v1/messaging/folders", e);
191
191
  return Ft($e(n.data));
192
192
  },
193
193
  async updateFolder(e, n) {
194
- const r = await X().patch(`/v1/messaging/folders/${e}`, n);
194
+ const r = await W().patch(`/v1/messaging/folders/${e}`, n);
195
195
  return Ft($e(r.data));
196
196
  },
197
197
  async deleteFolder(e) {
198
- await X().delete(`/v1/messaging/folders/${e}`);
198
+ await W().delete(`/v1/messaging/folders/${e}`);
199
199
  },
200
200
  async reorderFolders(e) {
201
- await X().patch("/v1/messaging/folders/reorder", { order: e });
201
+ await W().patch("/v1/messaging/folders/reorder", { order: e });
202
202
  },
203
203
  async assignFolder(e, n) {
204
- const r = await X().patch(`/v1/messaging/conversations/${e}/folder`, {
204
+ const r = await W().patch(`/v1/messaging/conversations/${e}/folder`, {
205
205
  folder_id: n
206
206
  });
207
207
  return Mn($e(r.data));
208
208
  },
209
209
  async acceptRequest(e) {
210
- const n = await X().post(`/v1/messaging/conversations/${e}/accept`);
210
+ const n = await W().post(`/v1/messaging/conversations/${e}/accept`);
211
211
  return Mn($e(n.data));
212
212
  },
213
213
  async declineRequest(e) {
214
- await X().post(`/v1/messaging/conversations/${e}/decline`);
214
+ await W().post(`/v1/messaging/conversations/${e}/decline`);
215
215
  }
216
216
  }, go = 6e4;
217
217
  function mo(e) {
@@ -288,9 +288,9 @@ const kn = 1e3, Gt = 4e3, yo = 12e4, _o = 300, So = 1, Co = 1600, Jt = (e) => {
288
288
  data: [],
289
289
  has_more: !1
290
290
  }), Un = () => Ot() === "account_suspended", Eo = (e) => {
291
- if (!le(e))
291
+ if (!he(e))
292
292
  return !1;
293
- const r = (le(e.data) ? e.data : e).throttled;
293
+ const r = (he(e.data) ? e.data : e).throttled;
294
294
  if (typeof r == "boolean")
295
295
  return r;
296
296
  if (typeof r == "number")
@@ -373,12 +373,12 @@ function at(e) {
373
373
  };
374
374
  }
375
375
  function xo(e) {
376
- if (!e || !le(e))
376
+ if (!e || !he(e))
377
377
  return;
378
378
  const n = typeof e.id == "string" ? e.id.trim() : "", r = typeof e.title == "string" ? e.title.trim() : "", o = typeof e.url == "string" ? e.url.trim() : "";
379
379
  if (n.length === 0 || r.length === 0 || o.length === 0)
380
380
  return;
381
- const c = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, u = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, d = le(e.author) ? e.author : null, f = d && typeof d.id == "string" ? d.id.trim() : "", h = d && typeof d.name == "string" ? d.name.trim() : "", P = d && typeof d.avatar == "string" && d.avatar.trim().length > 0 ? d.avatar.trim() : null, C = d && typeof d.handle == "string" && d.handle.trim().length > 0 ? d.handle.trim() : null;
381
+ const c = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, u = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, d = he(e.author) ? e.author : null, f = d && typeof d.id == "string" ? d.id.trim() : "", h = d && typeof d.name == "string" ? d.name.trim() : "", R = d && typeof d.avatar == "string" && d.avatar.trim().length > 0 ? d.avatar.trim() : null, C = d && typeof d.handle == "string" && d.handle.trim().length > 0 ? d.handle.trim() : null;
382
382
  return {
383
383
  id: n,
384
384
  title: r,
@@ -389,7 +389,7 @@ function xo(e) {
389
389
  author: {
390
390
  id: f,
391
391
  name: h,
392
- ...P ? { avatar: P } : {},
392
+ ...R ? { avatar: R } : {},
393
393
  ...C ? { handle: C } : {}
394
394
  }
395
395
  } : {}
@@ -449,7 +449,7 @@ function Uo(e, n) {
449
449
  return Object.prototype.hasOwnProperty.call(e, "folder_id") ? e.folder_id ?? null : e.me?.folder_id === null ? null : typeof e.me?.folder_id == "string" ? e.me.folder_id : n?.folder_id;
450
450
  }
451
451
  function He(e, n) {
452
- const r = Io(e, n), o = typeof e.is_muted == "boolean" ? e.is_muted : r !== null || n?.is_muted === !0, c = e.last_message ? at(e.last_message) : n?.last_message, u = e.last_message_at ?? n?.last_message_at, d = typeof e.unread_count == "number" ? e.unread_count : n?.unread_count ?? 0, f = typeof e.is_pinned == "boolean" ? e.is_pinned : e.me?.is_pinned ?? n?.is_pinned ?? !1, h = typeof e.is_archived == "boolean" ? e.is_archived : e.me?.is_archived ?? n?.is_archived ?? !1, P = Uo(e, n), C = typeof e.created_at == "string" ? e.created_at : n?.created_at ?? "", v = (() => {
452
+ const r = Io(e, n), o = typeof e.is_muted == "boolean" ? e.is_muted : r !== null || n?.is_muted === !0, c = e.last_message ? at(e.last_message) : n?.last_message, u = e.last_message_at ?? n?.last_message_at, d = typeof e.unread_count == "number" ? e.unread_count : n?.unread_count ?? 0, f = typeof e.is_pinned == "boolean" ? e.is_pinned : e.me?.is_pinned ?? n?.is_pinned ?? !1, h = typeof e.is_archived == "boolean" ? e.is_archived : e.me?.is_archived ?? n?.is_archived ?? !1, R = Uo(e, n), C = typeof e.created_at == "string" ? e.created_at : n?.created_at ?? "", v = (() => {
453
453
  if (!n || n.unread_count !== 0 || d <= 0)
454
454
  return !1;
455
455
  const E = n.last_message?.id, b = e.last_message?.id;
@@ -463,7 +463,7 @@ function He(e, n) {
463
463
  muted_until: r,
464
464
  is_pinned: f,
465
465
  is_archived: h,
466
- folder_id: P,
466
+ folder_id: R,
467
467
  created_at: C,
468
468
  ...c ? { last_message: c } : {},
469
469
  ...u ? { last_message_at: u } : {}
@@ -485,20 +485,20 @@ function Fn(e, n) {
485
485
  }
486
486
  return qt(e.last_message?.id) ? e.last_message.id : null;
487
487
  }
488
- function le(e) {
488
+ function he(e) {
489
489
  return typeof e == "object" && e !== null;
490
490
  }
491
491
  function Fo(e) {
492
- return le(e) ? (le(e.response) ? e.response : null)?.status === 401 : !1;
492
+ return he(e) ? (he(e.response) ? e.response : null)?.status === 401 : !1;
493
493
  }
494
494
  function Dn(e) {
495
495
  if (!Array.isArray(e))
496
496
  return [];
497
497
  const n = [];
498
498
  for (const r of e) {
499
- if (!le(r) || typeof r.reaction != "string" || typeof r.count != "number" || !Array.isArray(r.users))
499
+ if (!he(r) || typeof r.reaction != "string" || typeof r.count != "number" || !Array.isArray(r.users))
500
500
  continue;
501
- const o = r.users.filter((c) => le(c)).filter(
501
+ const o = r.users.filter((c) => he(c)).filter(
502
502
  (c) => typeof c.id == "string" && typeof c.name == "string"
503
503
  ).map((c) => ({
504
504
  id: c.id,
@@ -513,23 +513,23 @@ function Dn(e) {
513
513
  return n;
514
514
  }
515
515
  function Do(e, n) {
516
- const r = le(n) ? n : null, o = r?.next ?? r?.next_cursor ?? e.next_cursor;
516
+ const r = he(n) ? n : null, o = r?.next ?? r?.next_cursor ?? e.next_cursor;
517
517
  if (!(typeof o != "string" || o.length === 0))
518
518
  return o;
519
519
  }
520
520
  function st(e, n) {
521
- const r = le(e) ? e : {}, o = r.data ?? e;
521
+ const r = he(e) ? e : {}, o = r.data ?? e;
522
522
  let c = [];
523
- return Array.isArray(o) ? c = o : le(o) && (Array.isArray(o.items) ? c = o.items : Array.isArray(o[n]) ? c = o[n] : Array.isArray(o.data) && (c = o.data)), {
523
+ return Array.isArray(o) ? c = o : he(o) && (Array.isArray(o.items) ? c = o.items : Array.isArray(o[n]) ? c = o[n] : Array.isArray(o.data) && (c = o.data)), {
524
524
  items: c,
525
525
  nextCursor: Do(r, o)
526
526
  };
527
527
  }
528
528
  function Nn(e) {
529
- return le(e) && typeof e.id == "string" && e.id.length > 0;
529
+ return he(e) && typeof e.id == "string" && e.id.length > 0;
530
530
  }
531
531
  function qn(e) {
532
- return le(e) ? typeof e.id == "string" && (e.type === "dm" || e.type === "group") && Array.isArray(e.participants) : !1;
532
+ return he(e) ? typeof e.id == "string" && (e.type === "dm" || e.type === "group") && Array.isArray(e.participants) : !1;
533
533
  }
534
534
  function Kt(e, n) {
535
535
  if (e.type !== "dm")
@@ -541,7 +541,7 @@ function Kt(e, n) {
541
541
  return r.user.id === n && o.length > 0 && o.toLowerCase() !== "pending user";
542
542
  }
543
543
  function zn(e) {
544
- if (!le(e) || typeof e.id != "string" || typeof e.name != "string")
544
+ if (!he(e) || typeof e.id != "string" || typeof e.name != "string")
545
545
  return null;
546
546
  const n = {
547
547
  id: e.id,
@@ -552,8 +552,8 @@ function zn(e) {
552
552
  return c && (n.avatar = c, n.avatar_url = c), n;
553
553
  }
554
554
  function No(e) {
555
- const r = (le(e) ? e : {}).data ?? e;
556
- return Array.isArray(r) ? r.map((o) => zn(o)).filter((o) => o !== null) : le(r) ? Object.values(r).map((o) => zn(o)).filter((o) => o !== null) : [];
555
+ const r = (he(e) ? e : {}).data ?? e;
556
+ return Array.isArray(r) ? r.map((o) => zn(o)).filter((o) => o !== null) : he(r) ? Object.values(r).map((o) => zn(o)).filter((o) => o !== null) : [];
557
557
  }
558
558
  function As(e) {
559
559
  if (e.type !== "dm")
@@ -738,7 +738,7 @@ const Qt = Di("messaging", {
738
738
  const e = await Pe.fetchFolders();
739
739
  return this.folders = Be(e), this.foldersLoaded = !0, this.normalizeFolderAssignmentsState(), this.folders;
740
740
  } catch (e) {
741
- throw this.error = Y(e), e;
741
+ throw this.error = Z(e), e;
742
742
  }
743
743
  },
744
744
  async createFolder(e) {
@@ -746,7 +746,7 @@ const Qt = Di("messaging", {
746
746
  const n = await Pe.createFolder(e);
747
747
  return this.folders = Be([...this.folders, n]), n;
748
748
  } catch (n) {
749
- throw this.error = Y(n), n;
749
+ throw this.error = Z(n), n;
750
750
  }
751
751
  },
752
752
  async updateFolder(e, n) {
@@ -756,14 +756,14 @@ const Qt = Di("messaging", {
756
756
  this.folders.map((o) => o.id === e ? r : o)
757
757
  ), r;
758
758
  } catch (r) {
759
- throw this.error = Y(r), r;
759
+ throw this.error = Z(r), r;
760
760
  }
761
761
  },
762
762
  async deleteFolder(e) {
763
763
  try {
764
764
  await Pe.deleteFolder(e), this.folders = this.folders.filter((n) => n.id !== e), this.foldersLoaded = !0, this.activeFolderId === e && (this.activeFolderId = null), this.normalizeFolderAssignmentsState();
765
765
  } catch (n) {
766
- throw this.error = Y(n), n;
766
+ throw this.error = Z(n), n;
767
767
  }
768
768
  },
769
769
  async reorderFolders(e) {
@@ -785,7 +785,7 @@ const Qt = Di("messaging", {
785
785
  });
786
786
  this.folders = r;
787
787
  } catch (n) {
788
- throw this.error = Y(n), n;
788
+ throw this.error = Z(n), n;
789
789
  }
790
790
  },
791
791
  async assignToFolder(e, n) {
@@ -812,7 +812,7 @@ const Qt = Di("messaging", {
812
812
  u
813
813
  );
814
814
  } catch (r) {
815
- throw this.error = Y(r), r;
815
+ throw this.error = Z(r), r;
816
816
  }
817
817
  },
818
818
  async fetchConversations(e, n, r, o) {
@@ -822,15 +822,15 @@ const Qt = Di("messaging", {
822
822
  return e || (this.conversations = [], this.normalizeFolderAssignmentsState()), In();
823
823
  const c = o?.includePresence ?? !0, u = {};
824
824
  c && (u.include_presence = 1), e && (u.cursor = e), n && (u.filter = n), typeof r == "string" && r.length > 0 && (u.folder_id = r);
825
- const d = await X().get("/v1/messaging/conversations", { params: u }), { items: f, nextCursor: h } = st(
825
+ const d = await W().get("/v1/messaging/conversations", { params: u }), { items: f, nextCursor: h } = st(
826
826
  d.data,
827
827
  "conversations"
828
- ), P = f.map((E) => {
828
+ ), R = f.map((E) => {
829
829
  const b = this.conversations.find(
830
830
  (A) => A.id === E.id
831
831
  );
832
832
  return He(E, b);
833
- }), C = await $n(P);
833
+ }), C = await $n(R);
834
834
  e ? this.conversations.push(...C) : this.conversations = C, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
835
835
  const v = {
836
836
  data: C,
@@ -838,7 +838,7 @@ const Qt = Di("messaging", {
838
838
  };
839
839
  return h !== void 0 && (v.next_cursor = h), v;
840
840
  } catch (c) {
841
- throw o?.background && xn(c) || (this.error = Y(c)), c;
841
+ throw o?.background && xn(c) || (this.error = Z(c)), c;
842
842
  } finally {
843
843
  this.loading = !1;
844
844
  }
@@ -859,7 +859,7 @@ const Qt = Di("messaging", {
859
859
  async fetchConversation(e) {
860
860
  this.loading = !0, this.error = null;
861
861
  try {
862
- const n = await X().get(`/v1/messaging/conversations/${e}`, {
862
+ const n = await W().get(`/v1/messaging/conversations/${e}`, {
863
863
  params: { include_presence: 1 }
864
864
  }), r = this.conversations.find((f) => f.id === e);
865
865
  let o = He(n.data.data || n.data, r);
@@ -870,7 +870,7 @@ const Qt = Di("messaging", {
870
870
  const d = this.requests.findIndex((f) => f.id === e);
871
871
  return d >= 0 && (this.requests[d] = o), this.normalizeFolderAssignmentsState(), o;
872
872
  } catch (n) {
873
- throw this.error = Y(n), n;
873
+ throw this.error = Z(n), n;
874
874
  } finally {
875
875
  this.loading = !1;
876
876
  }
@@ -885,12 +885,12 @@ const Qt = Di("messaging", {
885
885
  filter: "requests"
886
886
  };
887
887
  e && (n.cursor = e);
888
- const r = await X().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: c } = st(
888
+ const r = await W().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: c } = st(
889
889
  r.data,
890
890
  "conversations"
891
891
  ), u = o.map((h) => {
892
- const P = this.requests.find((C) => C.id === h.id);
893
- return He(h, P);
892
+ const R = this.requests.find((C) => C.id === h.id);
893
+ return He(h, R);
894
894
  }), d = await $n(u);
895
895
  e ? this.requests.push(...d) : this.requests = d, this.normalizeFolderAssignmentsState();
896
896
  const f = {
@@ -899,7 +899,7 @@ const Qt = Di("messaging", {
899
899
  };
900
900
  return c !== void 0 && (f.next_cursor = c), f;
901
901
  } catch (n) {
902
- throw this.error = Y(n), n;
902
+ throw this.error = Z(n), n;
903
903
  } finally {
904
904
  this.loading = !1;
905
905
  }
@@ -911,7 +911,7 @@ const Qt = Di("messaging", {
911
911
  let o = 0, c;
912
912
  for (; ; )
913
913
  try {
914
- c = await X().get(`/v1/messaging/conversations/${e}/messages`, { params: r });
914
+ c = await W().get(`/v1/messaging/conversations/${e}/messages`, { params: r });
915
915
  break;
916
916
  } catch (v) {
917
917
  if (!(o < So && xn(v)))
@@ -936,19 +936,19 @@ const Qt = Di("messaging", {
936
936
  };
937
937
  return d !== void 0 && (C.next_cursor = d), C;
938
938
  } catch (r) {
939
- throw this.error = Y(r), r;
939
+ throw this.error = Z(r), r;
940
940
  } finally {
941
941
  this.loadingMessages[e] = !1, this.loading = !1;
942
942
  }
943
943
  },
944
944
  async sendMessage(e, n, r, o, c, u, d) {
945
- const f = ke()(), h = `temp-${Date.now()}-${Math.random()}`, P = typeof u == "string" && u.trim().length > 0 ? u.trim() : null, C = xo(d), v = f.currentUser, E = {
945
+ const f = ke()(), h = `temp-${Date.now()}-${Math.random()}`, R = typeof u == "string" && u.trim().length > 0 ? u.trim() : null, C = xo(d), v = f.currentUser, E = {
946
946
  id: h,
947
947
  conversation_id: e,
948
948
  author_id: v?.id || "",
949
949
  body: n || "",
950
950
  attachments: [],
951
- meta: P ? { shared_post_id: P } : {},
951
+ meta: R ? { shared_post_id: R } : {},
952
952
  ...C ? { shared_post: C } : {},
953
953
  is_deleted: !1,
954
954
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
@@ -965,11 +965,11 @@ const Qt = Di("messaging", {
965
965
  const A = {
966
966
  body: n || "",
967
967
  ...o ? { reply_to_id: o } : {},
968
- ...P ? { shared_post_id: P } : {},
968
+ ...R ? { shared_post_id: R } : {},
969
969
  ...C ? { shared_post_preview: C } : {}
970
970
  };
971
971
  if (r && r.length > 0) {
972
- const W = await Promise.all(
972
+ const G = await Promise.all(
973
973
  r.map(async (te) => {
974
974
  const k = await uo().uploadImage(te);
975
975
  return {
@@ -979,31 +979,31 @@ const Qt = Di("messaging", {
979
979
  };
980
980
  })
981
981
  );
982
- b = await X().post(`/v1/messaging/conversations/${e}/messages`, {
982
+ b = await W().post(`/v1/messaging/conversations/${e}/messages`, {
983
983
  ...A,
984
- attachments: W
984
+ attachments: G
985
985
  });
986
986
  } else
987
- b = await X().post(`/v1/messaging/conversations/${e}/messages`, {
987
+ b = await W().post(`/v1/messaging/conversations/${e}/messages`, {
988
988
  ...A,
989
989
  type: "text"
990
990
  });
991
- const w = b.data.data || b.data, p = { ...E, ...w, attachments: w.attachments ?? E.attachments }, m = at(p), y = this.messages[e], O = y.findIndex((W) => W.id === h);
992
- O >= 0 && (y[O] = m), this._pendingSendIds.delete(h);
993
- const z = m.id;
991
+ const w = b.data.data || b.data, p = { ...E, ...w, attachments: w.attachments ?? E.attachments }, m = at(p), y = this.messages[e], F = y.findIndex((G) => G.id === h);
992
+ F >= 0 && (y[F] = m), this._pendingSendIds.delete(h);
993
+ const q = m.id;
994
994
  let J = 0;
995
- for (let W = y.length - 1; W >= 0; W--) {
996
- const te = y[W];
997
- te && te.id === z && (J++, J > 1 && y.splice(W, 1));
995
+ for (let G = y.length - 1; G >= 0; G--) {
996
+ const te = y[G];
997
+ te && te.id === q && (J++, J > 1 && y.splice(G, 1));
998
998
  }
999
999
  return this.updateConversationLastMessage(e, m), m;
1000
1000
  } catch (b) {
1001
- throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((A) => A.id !== h), this.error = Y(b), b;
1001
+ throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((A) => A.id !== h), this.error = Z(b), b;
1002
1002
  }
1003
1003
  },
1004
1004
  async editMessage(e, n, r) {
1005
1005
  try {
1006
- const o = await X().patch(`/v1/messaging/conversations/${e}/messages/${n}`, {
1006
+ const o = await W().patch(`/v1/messaging/conversations/${e}/messages/${n}`, {
1007
1007
  body: r
1008
1008
  }), c = o.data.data || o.data, u = this.messages[e] || [], d = u.findIndex((f) => f.id === n);
1009
1009
  if (d >= 0) {
@@ -1012,22 +1012,29 @@ const Qt = Di("messaging", {
1012
1012
  }
1013
1013
  return c;
1014
1014
  } catch (o) {
1015
- throw this.error = Y(o), o;
1015
+ throw this.error = Z(o), o;
1016
1016
  }
1017
1017
  },
1018
1018
  async deleteMessage(e, n) {
1019
1019
  try {
1020
- await X().delete(`/v1/messaging/conversations/${e}/messages/${n}`);
1021
- const r = this.messages[e] || [], o = r.findIndex((c) => c.id === n);
1022
- if (o >= 0) {
1023
- const c = r[o];
1024
- if (!c)
1025
- return;
1026
- const u = { ...c, is_deleted: !0 };
1027
- delete u.body, r[o] = u;
1020
+ await W().delete(`/v1/messaging/conversations/${e}/messages/${n}`);
1021
+ const r = this.messages[e];
1022
+ if (r) {
1023
+ const o = r.findIndex((c) => c.id === n);
1024
+ if (o >= 0) {
1025
+ const c = r[o];
1026
+ if (c) {
1027
+ const u = { ...c, is_deleted: !0 };
1028
+ delete u.body, this.messages[e] = [
1029
+ ...r.slice(0, o),
1030
+ u,
1031
+ ...r.slice(o + 1)
1032
+ ];
1033
+ }
1034
+ }
1028
1035
  }
1029
1036
  } catch (r) {
1030
- throw this.error = Y(r), r;
1037
+ throw this.error = Z(r), r;
1031
1038
  }
1032
1039
  },
1033
1040
  async markAsRead(e) {
@@ -1045,7 +1052,7 @@ const Qt = Di("messaging", {
1045
1052
  })(), o = n ? Fn(n, this.messages) : r;
1046
1053
  if (!o)
1047
1054
  return;
1048
- await X().post(`/v1/messaging/conversations/${e}/read`, {
1055
+ await W().post(`/v1/messaging/conversations/${e}/read`, {
1049
1056
  message_id: o
1050
1057
  }), this.conversations.forEach((c) => {
1051
1058
  c.id === e && (c.unread_count = 0);
@@ -1053,7 +1060,7 @@ const Qt = Di("messaging", {
1053
1060
  c.id === e && (c.unread_count = 0);
1054
1061
  });
1055
1062
  } catch (n) {
1056
- throw this.error = Y(n), n;
1063
+ throw this.error = Z(n), n;
1057
1064
  }
1058
1065
  },
1059
1066
  async markAllAsRead() {
@@ -1071,7 +1078,7 @@ const Qt = Di("messaging", {
1071
1078
  return;
1072
1079
  const r = await Promise.allSettled(
1073
1080
  n.map(
1074
- (c) => X().post(`/v1/messaging/conversations/${c.conversationId}/read`, {
1081
+ (c) => W().post(`/v1/messaging/conversations/${c.conversationId}/read`, {
1075
1082
  message_id: c.messageId
1076
1083
  })
1077
1084
  )
@@ -1088,39 +1095,39 @@ const Qt = Di("messaging", {
1088
1095
  o === null && (o = c.reason);
1089
1096
  }
1090
1097
  }), o !== null)
1091
- throw this.error = Y(o), o;
1098
+ throw this.error = Z(o), o;
1092
1099
  },
1093
1100
  async sendTyping(e, n = "start") {
1094
1101
  try {
1095
- const r = await X().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
1102
+ const r = await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
1096
1103
  if (n !== "start" || !Eo(r.data))
1097
1104
  return;
1098
- await Ln(Co), await X().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
1105
+ await Ln(Co), await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
1099
1106
  } catch (r) {
1100
1107
  console.warn("Failed to send typing indicator:", r);
1101
1108
  }
1102
1109
  },
1103
1110
  async muteConversation(e, n) {
1104
1111
  try {
1105
- const r = { minutes: n }, o = await X().patch(`/v1/messaging/conversations/${e}/mute`, r), u = (o.data.data || o.data).muted_until || null, d = this.conversations.find((f) => f.id === e);
1112
+ const r = { minutes: n }, o = await W().patch(`/v1/messaging/conversations/${e}/mute`, r), u = (o.data.data || o.data).muted_until || null, d = this.conversations.find((f) => f.id === e);
1106
1113
  d && (d.is_muted = u !== null, d.muted_until = u);
1107
1114
  } catch (r) {
1108
- throw this.error = Y(r), r;
1115
+ throw this.error = Z(r), r;
1109
1116
  }
1110
1117
  },
1111
1118
  async unmuteConversation(e) {
1112
1119
  try {
1113
- const n = await X().patch(`/v1/messaging/conversations/${e}/mute`, {
1120
+ const n = await W().patch(`/v1/messaging/conversations/${e}/mute`, {
1114
1121
  minutes: 0
1115
1122
  }), o = (n.data.data || n.data).muted_until || null, c = this.conversations.find((u) => u.id === e);
1116
1123
  c && (c.is_muted = o !== null, c.muted_until = o);
1117
1124
  } catch (n) {
1118
- throw this.error = Y(n), n;
1125
+ throw this.error = Z(n), n;
1119
1126
  }
1120
1127
  },
1121
1128
  async updateConversationTitle(e, n) {
1122
1129
  try {
1123
- const r = await X().patch(`/v1/messaging/conversations/${e}`, {
1130
+ const r = await W().patch(`/v1/messaging/conversations/${e}`, {
1124
1131
  title: n
1125
1132
  }), o = r.data.data || r.data, c = typeof o?.title == "string" ? o.title : n, u = (d) => d.map((f) => f.id !== e ? f : {
1126
1133
  ...f,
@@ -1128,32 +1135,32 @@ const Qt = Di("messaging", {
1128
1135
  });
1129
1136
  this.conversations = u(this.conversations), this.requests = u(this.requests);
1130
1137
  } catch (r) {
1131
- throw this.error = Y(r), r;
1138
+ throw this.error = Z(r), r;
1132
1139
  }
1133
1140
  },
1134
1141
  async pinConversation(e, n) {
1135
1142
  const r = this.conversations.find((c) => c.id === e), o = r?.is_pinned;
1136
1143
  r && (r.is_pinned = n), this.conversations.sort(Xe);
1137
1144
  try {
1138
- await X().patch(`/v1/messaging/conversations/${e}/pin`, { pinned: n });
1145
+ await W().patch(`/v1/messaging/conversations/${e}/pin`, { pinned: n });
1139
1146
  } catch (c) {
1140
- throw r && o !== void 0 && (r.is_pinned = o, this.conversations.sort(Xe)), this.error = Y(c), c;
1147
+ throw r && o !== void 0 && (r.is_pinned = o, this.conversations.sort(Xe)), this.error = Z(c), c;
1141
1148
  }
1142
1149
  },
1143
1150
  async archiveConversation(e, n) {
1144
1151
  try {
1145
- await X().patch(`/v1/messaging/conversations/${e}/archive`, { archived: n });
1152
+ await W().patch(`/v1/messaging/conversations/${e}/archive`, { archived: n });
1146
1153
  const r = this.conversations.find((o) => o.id === e);
1147
1154
  r && (r.is_archived = n);
1148
1155
  } catch (r) {
1149
- throw this.error = Y(r), r;
1156
+ throw this.error = Z(r), r;
1150
1157
  }
1151
1158
  },
1152
1159
  async deleteConversation(e) {
1153
1160
  try {
1154
- await X().delete(`/v1/messaging/conversations/${e}`), this.conversations = this.conversations.filter((n) => n.id !== e), delete this.messages[e], delete this.typingUsers[e], delete this.conversationCursors[e], delete this.conversationHasMore[e], delete this.loadingMessages[e];
1161
+ await W().delete(`/v1/messaging/conversations/${e}`), this.conversations = this.conversations.filter((n) => n.id !== e), delete this.messages[e], delete this.typingUsers[e], delete this.conversationCursors[e], delete this.conversationHasMore[e], delete this.loadingMessages[e];
1155
1162
  } catch (n) {
1156
- throw this.error = Y(n), n;
1163
+ throw this.error = Z(n), n;
1157
1164
  }
1158
1165
  },
1159
1166
  async createDMConversation(e, n) {
@@ -1162,18 +1169,18 @@ const Qt = Di("messaging", {
1162
1169
  user_id: e
1163
1170
  };
1164
1171
  n && (r.message = n);
1165
- const o = await X().post("/v1/messaging/conversations/dm", r), c = o.data.data || o.data;
1172
+ const o = await W().post("/v1/messaging/conversations/dm", r), c = o.data.data || o.data;
1166
1173
  if (!Nn(c))
1167
1174
  throw new Error("Invalid conversation payload from DM create endpoint.");
1168
1175
  let u = qn(c) && Kt(c, e) ? He(c) : await this.fetchConversation(c.id);
1169
1176
  return u = await jn(u, e), u.is_request === !0 ? (this.requests = rt(this.requests, u), this.conversations = this.conversations.filter((d) => d.id !== u.id), u) : (this.conversations = rt(this.conversations, u), this.requests = this.requests.filter((d) => d.id !== u.id), u);
1170
1177
  } catch (r) {
1171
- throw this.error = Y(r), r;
1178
+ throw this.error = Z(r), r;
1172
1179
  }
1173
1180
  },
1174
1181
  async createGroupConversation(e, n) {
1175
1182
  try {
1176
- const r = await X().post("/v1/messaging/conversations/group", {
1183
+ const r = await W().post("/v1/messaging/conversations/group", {
1177
1184
  title: e,
1178
1185
  participant_ids: n
1179
1186
  }), o = r.data.data || r.data;
@@ -1182,22 +1189,22 @@ const Qt = Di("messaging", {
1182
1189
  const c = qn(o) ? o : await this.fetchConversation(o.id);
1183
1190
  return this.conversations = rt(this.conversations, c), c;
1184
1191
  } catch (r) {
1185
- throw this.error = Y(r), r;
1192
+ throw this.error = Z(r), r;
1186
1193
  }
1187
1194
  },
1188
1195
  async addParticipants(e, n) {
1189
1196
  try {
1190
- await X().post(`/v1/messaging/conversations/${e}/participants`, {
1197
+ await W().post(`/v1/messaging/conversations/${e}/participants`, {
1191
1198
  user_ids: n
1192
1199
  // Changed from participant_ids to user_ids to match backend
1193
1200
  }), await this.fetchConversation(e);
1194
1201
  } catch (r) {
1195
- throw this.error = Y(r), r;
1202
+ throw this.error = Z(r), r;
1196
1203
  }
1197
1204
  },
1198
1205
  async removeParticipant(e, n) {
1199
1206
  try {
1200
- await X().delete(`/v1/messaging/conversations/${e}/participants/${n}`);
1207
+ await W().delete(`/v1/messaging/conversations/${e}/participants/${n}`);
1201
1208
  const r = ke()();
1202
1209
  if (n === r.currentUser?.id) {
1203
1210
  this.conversations = this.conversations.filter((o) => o.id !== e), this.requests = this.requests.filter((o) => o.id !== e), delete this.messages[e], delete this.typingUsers[e], delete this.conversationCursors[e], delete this.conversationHasMore[e], delete this.loadingMessages[e];
@@ -1205,7 +1212,7 @@ const Qt = Di("messaging", {
1205
1212
  }
1206
1213
  await this.fetchConversation(e);
1207
1214
  } catch (r) {
1208
- throw this.error = Y(r), r;
1215
+ throw this.error = Z(r), r;
1209
1216
  }
1210
1217
  },
1211
1218
  applyParticipantReadState(e) {
@@ -1229,28 +1236,28 @@ const Qt = Di("messaging", {
1229
1236
  return;
1230
1237
  this.messages[n] || (this.messages[n] = []);
1231
1238
  const r = at({ ...e, attachments: e.attachments ?? [] }), o = this.messages[n];
1232
- if (o.find((P) => P.id === r.id))
1239
+ if (o.find((R) => R.id === r.id))
1233
1240
  return;
1234
1241
  const u = ke()();
1235
1242
  if (r.author_id === u.currentUser?.id) {
1236
- const P = o.findIndex((C) => C.id.startsWith("temp-"));
1237
- if (P >= 0) {
1238
- const C = o[P]?.id ?? "";
1243
+ const R = o.findIndex((C) => C.id.startsWith("temp-"));
1244
+ if (R >= 0) {
1245
+ const C = o[R]?.id ?? "";
1239
1246
  this.messages[n] = [
1240
- ...o.slice(0, P),
1247
+ ...o.slice(0, R),
1241
1248
  r,
1242
- ...o.slice(P + 1)
1249
+ ...o.slice(R + 1)
1243
1250
  ], this._pendingSendIds.delete(C), this.updateConversationLastMessage(n, r);
1244
1251
  return;
1245
1252
  }
1246
1253
  }
1247
1254
  const d = r.created_at;
1248
1255
  let f = o.length;
1249
- for (let P = o.length - 1; P >= 0; P--) {
1250
- const C = o[P];
1256
+ for (let R = o.length - 1; R >= 0; R--) {
1257
+ const C = o[R];
1251
1258
  if (C && C.created_at <= d)
1252
1259
  break;
1253
- f = P;
1260
+ f = R;
1254
1261
  }
1255
1262
  const h = f === o.length;
1256
1263
  this.messages[n] = [
@@ -1265,8 +1272,8 @@ const Qt = Di("messaging", {
1265
1272
  },
1266
1273
  removeMessage(e, n) {
1267
1274
  const r = (h) => {
1268
- const P = { ...h, is_deleted: !0 };
1269
- return delete P.body, P;
1275
+ const R = { ...h, is_deleted: !0 };
1276
+ return delete R.body, R;
1270
1277
  };
1271
1278
  let o = null;
1272
1279
  const c = this.conversations.find((h) => h.id === e);
@@ -1284,7 +1291,11 @@ const Qt = Di("messaging", {
1284
1291
  const f = d.findIndex((h) => h.id === n);
1285
1292
  if (f >= 0) {
1286
1293
  const h = d[f];
1287
- h && (d[f] = r(h));
1294
+ h && (this.messages[e] = [
1295
+ ...d.slice(0, f),
1296
+ r(h),
1297
+ ...d.slice(f + 1)
1298
+ ]);
1288
1299
  return;
1289
1300
  }
1290
1301
  o && this.addMessage(o);
@@ -1294,25 +1305,25 @@ const Qt = Di("messaging", {
1294
1305
  try {
1295
1306
  let f;
1296
1307
  try {
1297
- f = await X().post(o, c);
1308
+ f = await W().post(o, c);
1298
1309
  } catch (v) {
1299
1310
  if (!Fo(v))
1300
1311
  throw v;
1301
- f = await X().post(o, c);
1312
+ f = await W().post(o, c);
1302
1313
  }
1303
- const h = le(f.data) && "data" in f.data ? f.data.data : f.data, P = Dn(
1304
- le(h) ? h.reactions : void 0
1314
+ const h = he(f.data) && "data" in f.data ? f.data.data : f.data, R = Dn(
1315
+ he(h) ? h.reactions : void 0
1305
1316
  );
1306
- (P.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, P);
1317
+ (R.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, R);
1307
1318
  try {
1308
- const v = await X().get(o), E = le(v.data) && "data" in v.data ? v.data.data : v.data, b = Dn(
1309
- le(E) ? E.reactions : void 0
1319
+ const v = await W().get(o), E = he(v.data) && "data" in v.data ? v.data.data : v.data, b = Dn(
1320
+ he(E) ? E.reactions : void 0
1310
1321
  );
1311
1322
  this.updateMessageReactions(e, n, b);
1312
1323
  } catch {
1313
1324
  }
1314
1325
  } catch (f) {
1315
- throw this.error = Y(f), f;
1326
+ throw this.error = Z(f), f;
1316
1327
  }
1317
1328
  },
1318
1329
  updateMessageReactions(e, n, r) {
@@ -1334,9 +1345,13 @@ const Qt = Di("messaging", {
1334
1345
  const f = u[d];
1335
1346
  if (!f) return;
1336
1347
  const h = { ...f };
1337
- r !== void 0 && (h.body = r), o !== void 0 && (h.edited_at = o), c !== void 0 && (h.meta = c), u[d] = h;
1338
- const P = this.conversations.find((v) => v.id === e);
1339
- P?.last_message?.id === n && (P.last_message = h);
1348
+ r !== void 0 && (h.body = r), o !== void 0 && (h.edited_at = o), c !== void 0 && (h.meta = c), this.messages[e] = [
1349
+ ...u.slice(0, d),
1350
+ h,
1351
+ ...u.slice(d + 1)
1352
+ ];
1353
+ const R = this.conversations.find((v) => v.id === e);
1354
+ R?.last_message?.id === n && (R.last_message = h);
1340
1355
  const C = this.requests.find((v) => v.id === e);
1341
1356
  C?.last_message?.id === n && (C.last_message = h);
1342
1357
  },
@@ -1367,7 +1382,7 @@ const Qt = Di("messaging", {
1367
1382
  )];
1368
1383
  if (n.length === 0)
1369
1384
  return;
1370
- const r = await X().get("/v1/presence/users", {
1385
+ const r = await W().get("/v1/presence/users", {
1371
1386
  params: { ids: n }
1372
1387
  }), o = r.data?.data?.items ?? r.data?.items ?? [];
1373
1388
  for (const c of o) {
@@ -1387,14 +1402,14 @@ const Qt = Di("messaging", {
1387
1402
  });
1388
1403
  this.conversations = rt(this.conversations, r);
1389
1404
  } catch (n) {
1390
- throw this.error = Y(n), n;
1405
+ throw this.error = Z(n), n;
1391
1406
  }
1392
1407
  },
1393
1408
  async declineRequest(e) {
1394
1409
  try {
1395
1410
  await Pe.declineRequest(e), this.requests = this.requests.filter((n) => n.id !== e);
1396
1411
  } catch (n) {
1397
- throw this.error = Y(n), n;
1412
+ throw this.error = Z(n), n;
1398
1413
  }
1399
1414
  },
1400
1415
  async searchConversations(e, n, r) {
@@ -1402,7 +1417,7 @@ const Qt = Di("messaging", {
1402
1417
  try {
1403
1418
  const o = { search: e, limit: 20 };
1404
1419
  n && (o.filter = n), typeof r == "string" && r.length > 0 && (o.folder_id = r);
1405
- const c = await X().get("/v1/messaging/conversations", {
1420
+ const c = await W().get("/v1/messaging/conversations", {
1406
1421
  params: o
1407
1422
  }), { items: u } = st(
1408
1423
  c.data,
@@ -1410,7 +1425,7 @@ const Qt = Di("messaging", {
1410
1425
  );
1411
1426
  return u;
1412
1427
  } catch (o) {
1413
- return this.error = Y(o), [];
1428
+ return this.error = Z(o), [];
1414
1429
  } finally {
1415
1430
  this.searchLoading = !1;
1416
1431
  }
@@ -1418,12 +1433,12 @@ const Qt = Di("messaging", {
1418
1433
  async searchMessages(e, n) {
1419
1434
  this.searchLoading = !0;
1420
1435
  try {
1421
- const r = await X().get(`/v1/messaging/conversations/${e}/search`, {
1436
+ const r = await W().get(`/v1/messaging/conversations/${e}/search`, {
1422
1437
  params: { q: n }
1423
1438
  }), o = r.data.data || r.data || [];
1424
1439
  return this.searchResults = o, o;
1425
1440
  } catch (r) {
1426
- return this.error = Y(r), [];
1441
+ return this.error = Z(r), [];
1427
1442
  } finally {
1428
1443
  this.searchLoading = !1;
1429
1444
  }
@@ -1464,28 +1479,28 @@ const Qt = Di("messaging", {
1464
1479
  }
1465
1480
  });
1466
1481
  function oc(e) {
1467
- const n = Qt(), r = ke()(), o = be(!1), c = be(null), u = be(null), d = zt(), f = d !== null, h = 20, P = 250;
1482
+ const n = Qt(), r = ke()(), o = ye(!1), c = ye(null), u = ye(null), d = zt(), f = d !== null, h = 20, R = 250;
1468
1483
  let C = 0, v = null, E = null;
1469
- const b = se(() => r.currentUser?.id), A = () => is(e)?.trim() ?? "";
1484
+ const b = re(() => r.currentUser?.id), A = () => is(e)?.trim() ?? "";
1470
1485
  function w() {
1471
1486
  v && (clearTimeout(v), v = null), C = 0;
1472
1487
  }
1473
1488
  function p() {
1474
1489
  !f || o.value || v || C >= h || (v = setTimeout(() => {
1475
- v = null, C += 1, I();
1476
- }, P));
1490
+ v = null, C += 1, L();
1491
+ }, R));
1477
1492
  }
1478
1493
  function m(_) {
1479
1494
  if (n.addMessage(_.message), _.message.author_id !== b.value) {
1480
- const L = n.getConversationById(_.conversation_id);
1481
- L && (L.unread_count = 0), n.markAsRead(_.conversation_id).catch(() => {
1495
+ const I = n.getConversationById(_.conversation_id);
1496
+ I && (I.unread_count = 0), n.markAsRead(_.conversation_id).catch(() => {
1482
1497
  });
1483
1498
  }
1484
1499
  }
1485
1500
  function y(_) {
1486
1501
  n.applyParticipantReadState(_);
1487
1502
  }
1488
- function O(_) {
1503
+ function F(_) {
1489
1504
  n.applyMessageEdit(
1490
1505
  _.conversation_id,
1491
1506
  _.message.id,
@@ -1494,7 +1509,7 @@ function oc(e) {
1494
1509
  _.message.meta
1495
1510
  );
1496
1511
  }
1497
- function z(_) {
1512
+ function q(_) {
1498
1513
  n.removeMessage(_.conversation_id, _.message_id);
1499
1514
  }
1500
1515
  function J(_) {
@@ -1504,21 +1519,21 @@ function oc(e) {
1504
1519
  _.reactions
1505
1520
  );
1506
1521
  }
1507
- function W(_) {
1508
- const L = n.getConversationById(_.conversation_id);
1509
- L && (L.is_request = !1), n.requests = n.requests.filter(
1510
- (he) => he.id !== _.conversation_id
1522
+ function G(_) {
1523
+ const I = n.getConversationById(_.conversation_id);
1524
+ I && (I.is_request = !1), n.requests = n.requests.filter(
1525
+ (fe) => fe.id !== _.conversation_id
1511
1526
  );
1512
1527
  }
1513
1528
  function te(_) {
1514
- _.removed_user_id === b.value && (G(), n.deleteConversation(_.conversation_id).catch(() => {
1529
+ _.removed_user_id === b.value && (X(), n.deleteConversation(_.conversation_id).catch(() => {
1515
1530
  }));
1516
1531
  }
1517
1532
  function k(_) {
1518
- const L = u.value;
1519
- E && (E(), E = null), L && (_ && !n.hasGlobalConversationSubscription(L) && Xi(L), n.unregisterDetailSubscription(L), u.value = null), o.value = !1;
1533
+ const I = u.value;
1534
+ E && (E(), E = null), I && (_ && !n.hasGlobalConversationSubscription(I) && Xi(I), n.unregisterDetailSubscription(I), u.value = null), o.value = !1;
1520
1535
  }
1521
- function I() {
1536
+ function L() {
1522
1537
  const _ = A();
1523
1538
  if (!(o.value || !_)) {
1524
1539
  if (!Ae()) {
@@ -1530,29 +1545,29 @@ function oc(e) {
1530
1545
  E = Vi(_, {
1531
1546
  onMessageSent: m,
1532
1547
  onMessageRead: y,
1533
- onMessageEdited: O,
1534
- onMessageDeleted: z,
1548
+ onMessageEdited: F,
1549
+ onMessageDeleted: q,
1535
1550
  onReactionToggled: J,
1536
- onRequestAccepted: W,
1551
+ onRequestAccepted: G,
1537
1552
  onParticipantRemoved: te
1538
1553
  }), o.value = !0, u.value = _, n.registerDetailSubscription(_), w();
1539
- } catch (L) {
1540
- c.value = L instanceof Error ? L.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", L);
1554
+ } catch (I) {
1555
+ c.value = I instanceof Error ? I.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", I);
1541
1556
  }
1542
1557
  }
1543
1558
  }
1544
- function K() {
1545
- o.value || I();
1559
+ function V() {
1560
+ o.value || L();
1546
1561
  }
1547
- typeof window < "u" && window.addEventListener(Je(), K);
1548
- const V = ht((_) => {
1562
+ typeof window < "u" && window.addEventListener(Je(), V);
1563
+ const H = ht((_) => {
1549
1564
  if (_ === "connected") {
1550
- o.value || I();
1565
+ o.value || L();
1551
1566
  return;
1552
1567
  }
1553
1568
  (_ === "disconnected" || _ === "error") && (w(), k(!1));
1554
1569
  });
1555
- function G() {
1570
+ function X() {
1556
1571
  if (w(), !(!o.value || !u.value))
1557
1572
  try {
1558
1573
  k(!0), c.value = null;
@@ -1562,27 +1577,27 @@ function oc(e) {
1562
1577
  }
1563
1578
  return ot(
1564
1579
  () => A(),
1565
- (_, L) => {
1566
- if (_ !== L) {
1580
+ (_, I) => {
1581
+ if (_ !== I) {
1567
1582
  if (w(), o.value && k(!0), !_) {
1568
1583
  c.value = null;
1569
1584
  return;
1570
1585
  }
1571
- I();
1586
+ L();
1572
1587
  }
1573
1588
  }
1574
1589
  ), d !== null && qe(() => {
1575
- w(), V(), G(), typeof window < "u" && window.removeEventListener(Je(), K);
1590
+ w(), H(), X(), typeof window < "u" && window.removeEventListener(Je(), V);
1576
1591
  }), {
1577
- isSubscribed: se(() => o.value),
1578
- error: se(() => c.value),
1579
- subscribe: I,
1580
- unsubscribe: G
1592
+ isSubscribed: re(() => o.value),
1593
+ error: re(() => c.value),
1594
+ subscribe: L,
1595
+ unsubscribe: X
1581
1596
  };
1582
1597
  }
1583
1598
  const Ps = () => () => {
1584
1599
  }, Ms = async () => {
1585
- }, ye = {
1600
+ }, _e = {
1586
1601
  initializedEvent: "messenger-client:main-echo-initialized",
1587
1602
  getEcho: () => null,
1588
1603
  getConnectionStatus: () => "disconnected",
@@ -1590,25 +1605,25 @@ const Ps = () => () => {
1590
1605
  reconnect: Ms
1591
1606
  };
1592
1607
  function ct() {
1593
- return ye.initializedEvent;
1608
+ return _e.initializedEvent;
1594
1609
  }
1595
1610
  function ut() {
1596
- return ye.getEcho();
1611
+ return _e.getEcho();
1597
1612
  }
1598
1613
  function $o() {
1599
- return ye.getConnectionStatus();
1614
+ return _e.getConnectionStatus();
1600
1615
  }
1601
1616
  function Ho(e) {
1602
- return ye.onConnectionStatusChange(e);
1617
+ return _e.onConnectionStatusChange(e);
1603
1618
  }
1604
1619
  async function Bo() {
1605
- await ye.reconnect();
1620
+ await _e.reconnect();
1606
1621
  }
1607
1622
  function Vo(e) {
1608
- e.initializedEvent && (ye.initializedEvent = e.initializedEvent), e.getEcho && (ye.getEcho = e.getEcho), e.getConnectionStatus && (ye.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (ye.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (ye.reconnect = e.reconnect);
1623
+ e.initializedEvent && (_e.initializedEvent = e.initializedEvent), e.getEcho && (_e.getEcho = e.getEcho), e.getConnectionStatus && (_e.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (_e.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (_e.reconnect = e.reconnect);
1609
1624
  }
1610
1625
  function Xo() {
1611
- ye.initializedEvent = "messenger-client:main-echo-initialized", ye.getEcho = () => null, ye.getConnectionStatus = () => "disconnected", ye.onConnectionStatusChange = Ps, ye.reconnect = Ms;
1626
+ _e.initializedEvent = "messenger-client:main-echo-initialized", _e.getEcho = () => null, _e.getConnectionStatus = () => "disconnected", _e.onConnectionStatusChange = Ps, _e.reconnect = Ms;
1612
1627
  }
1613
1628
  const Wo = {
1614
1629
  debug: () => {
@@ -1662,9 +1677,9 @@ function ac(e = {}) {
1662
1677
  const o = Qo(e.source ?? "app"), c = {
1663
1678
  ...Ko,
1664
1679
  ...e.icons
1665
- }, u = be(o.getConnectionStatus()), d = be(null), f = be(0), h = be(!1), P = be(!1), C = be(!1), v = be(!1);
1680
+ }, u = ye(o.getConnectionStatus()), d = ye(null), f = ye(0), h = ye(!1), R = ye(!1), C = ye(!1), v = ye(!1);
1666
1681
  let E = null, b = null, A = null, w = null, p = null, m = null, y = null;
1667
- const O = se(() => u.value === "connected"), z = se(() => u.value === "connecting"), J = se(() => u.value === "disconnected"), W = se(() => u.value === "error"), te = se(() => J.value || W.value), k = se(() => {
1682
+ const F = re(() => u.value === "connected"), q = re(() => u.value === "connecting"), J = re(() => u.value === "disconnected"), G = re(() => u.value === "error"), te = re(() => J.value || G.value), k = re(() => {
1668
1683
  switch (u.value) {
1669
1684
  case "connecting":
1670
1685
  return f.value > 0 ? "Reconnecting..." : "Connecting...";
@@ -1677,7 +1692,7 @@ function ac(e = {}) {
1677
1692
  default:
1678
1693
  return "Unknown connection state";
1679
1694
  }
1680
- }), I = se(() => {
1695
+ }), L = re(() => {
1681
1696
  switch (u.value) {
1682
1697
  case "connected":
1683
1698
  return "success";
@@ -1689,7 +1704,7 @@ function ac(e = {}) {
1689
1704
  default:
1690
1705
  return "medium";
1691
1706
  }
1692
- }), K = se(() => {
1707
+ }), V = re(() => {
1693
1708
  switch (u.value) {
1694
1709
  case "connected":
1695
1710
  return c.connected;
@@ -1702,12 +1717,12 @@ function ac(e = {}) {
1702
1717
  default:
1703
1718
  return c.unknown;
1704
1719
  }
1705
- }), V = async () => {
1720
+ }), H = async () => {
1706
1721
  Vn.debug("Manual reconnect triggered"), f.value += 1, await o.reconnect();
1707
- }, G = (B, D = u.value) => {
1722
+ }, X = (B, K = u.value) => {
1708
1723
  if (B !== "connecting" && b && (clearTimeout(b), b = null), B === "disconnected" || B === "error") {
1709
- const q = !v.value && D === B, _e = !P.value && (q || D === "connected" || D === "connecting");
1710
- if (C.value = !0, _e) {
1724
+ const N = !v.value && K === B, Y = !R.value && (N || K === "connected" || K === "connecting");
1725
+ if (C.value = !0, Y) {
1711
1726
  h.value = !1, A && clearTimeout(A), A = setTimeout(() => {
1712
1727
  A = null, u.value !== "connected" && (h.value = !0);
1713
1728
  }, 5e3);
@@ -1717,11 +1732,11 @@ function ac(e = {}) {
1717
1732
  return;
1718
1733
  }
1719
1734
  if (B === "connected") {
1720
- A && (clearTimeout(A), A = null), h.value = !1, P.value = !1, C.value = !1;
1735
+ A && (clearTimeout(A), A = null), h.value = !1, R.value = !1, C.value = !1;
1721
1736
  return;
1722
1737
  }
1723
1738
  if (B === "connecting") {
1724
- if (A && (clearTimeout(A), A = null), P.value) {
1739
+ if (A && (clearTimeout(A), A = null), R.value) {
1725
1740
  h.value = !0;
1726
1741
  return;
1727
1742
  }
@@ -1733,34 +1748,34 @@ function ac(e = {}) {
1733
1748
  _("connected");
1734
1749
  return;
1735
1750
  }
1736
- P.value = !0, Vn.warn("Still connecting after 10s, treating as disconnected"), _("disconnected"), f.value += 1, o.reconnect();
1751
+ R.value = !0, Vn.warn("Still connecting after 10s, treating as disconnected"), _("disconnected"), f.value += 1, o.reconnect();
1737
1752
  }
1738
1753
  }, 1e4);
1739
1754
  }
1740
1755
  }, _ = (B) => {
1741
- const D = u.value;
1742
- if (B === "connecting" && P.value) {
1743
- u.value = "disconnected", G("disconnected", D);
1756
+ const K = u.value;
1757
+ if (B === "connecting" && R.value) {
1758
+ u.value = "disconnected", X("disconnected", K);
1744
1759
  return;
1745
1760
  }
1746
- u.value = B, B === "connecting" && (D === "disconnected" || D === "error") && f.value === 0 && (f.value = 1), B === "connected" && (d.value = /* @__PURE__ */ new Date(), f.value = 0), G(B, D);
1747
- }, L = () => {
1748
- const B = Wn(o), D = u.value;
1749
- if (B === "connected" && D !== "connected") {
1761
+ u.value = B, B === "connecting" && (K === "disconnected" || K === "error") && f.value === 0 && (f.value = 1), B === "connected" && (d.value = /* @__PURE__ */ new Date(), f.value = 0), X(B, K);
1762
+ }, I = () => {
1763
+ const B = Wn(o), K = u.value;
1764
+ if (B === "connected" && K !== "connected") {
1750
1765
  _("connected");
1751
1766
  return;
1752
1767
  }
1753
- if (B === "connecting" && D !== "connecting") {
1768
+ if (B === "connecting" && K !== "connecting") {
1754
1769
  _("connecting");
1755
1770
  return;
1756
1771
  }
1757
- if ((B === "unavailable" || B === "failed" || B === "disconnected") && D !== "disconnected") {
1772
+ if ((B === "unavailable" || B === "failed" || B === "disconnected") && K !== "disconnected") {
1758
1773
  _("disconnected");
1759
1774
  return;
1760
1775
  }
1761
- const q = o.getConnectionStatus();
1762
- !B && q === "connected" && D !== "connected" && _("connected");
1763
- }, he = () => {
1776
+ const N = o.getConnectionStatus();
1777
+ !B && N === "connected" && K !== "connected" && _("connected");
1778
+ }, fe = () => {
1764
1779
  if (p?.unbind && y && (p.unbind("connected", y.connected), p.unbind("connecting", y.connecting), p.unbind("disconnected", y.disconnected), p.unbind("unavailable", y.unavailable), p.unbind("error", y.error), p.unbind("state_change", y.stateChange)), p = o.getEchoConnection(), y = null, !p?.bind)
1765
1780
  return;
1766
1781
  y = {
@@ -1769,17 +1784,17 @@ function ac(e = {}) {
1769
1784
  disconnected: () => _("disconnected"),
1770
1785
  unavailable: () => _("disconnected"),
1771
1786
  error: () => _("error"),
1772
- stateChange: (D) => {
1773
- const q = D?.current;
1774
- if (q === "connected") {
1787
+ stateChange: (K) => {
1788
+ const N = K?.current;
1789
+ if (N === "connected") {
1775
1790
  _("connected");
1776
1791
  return;
1777
1792
  }
1778
- if (q === "connecting") {
1793
+ if (N === "connecting") {
1779
1794
  _("connecting");
1780
1795
  return;
1781
1796
  }
1782
- (q === "unavailable" || q === "failed" || q === "disconnected") && _("disconnected");
1797
+ (N === "unavailable" || N === "failed" || N === "disconnected") && _("disconnected");
1783
1798
  }
1784
1799
  }, p.bind("connected", y.connected), p.bind("connecting", y.connecting), p.bind("disconnected", y.disconnected), p.bind("unavailable", y.unavailable), p.bind("error", y.error), p.bind("state_change", y.stateChange);
1785
1800
  const B = p.state ?? null;
@@ -1792,35 +1807,35 @@ function ac(e = {}) {
1792
1807
  return;
1793
1808
  }
1794
1809
  (B === "unavailable" || B === "failed" || B === "disconnected") && _("disconnected");
1795
- }, Se = se(() => {
1796
- if (!d.value || !O.value)
1810
+ }, Se = re(() => {
1811
+ if (!d.value || !F.value)
1797
1812
  return null;
1798
- const B = Date.now() - d.value.getTime(), D = Math.floor(B / 6e4), q = Math.floor(B % 6e4 / 1e3);
1799
- return D > 0 ? `${D}m ${q}s` : `${q}s`;
1813
+ const B = Date.now() - d.value.getTime(), K = Math.floor(B / 6e4), N = Math.floor(B % 6e4 / 1e3);
1814
+ return K > 0 ? `${K}m ${N}s` : `${N}s`;
1800
1815
  });
1801
1816
  return jt(() => {
1802
- u.value = o.getConnectionStatus(), E = o.onConnectionStatusChange(_), O.value && (d.value = /* @__PURE__ */ new Date()), G(u.value, u.value), v.value = !0, he(), m = () => {
1803
- he(), L();
1804
- }, window.addEventListener(o.initializedEvent, m), L(), w = setInterval(() => {
1805
- L();
1817
+ u.value = o.getConnectionStatus(), E = o.onConnectionStatusChange(_), F.value && (d.value = /* @__PURE__ */ new Date()), X(u.value, u.value), v.value = !0, fe(), m = () => {
1818
+ fe(), I();
1819
+ }, window.addEventListener(o.initializedEvent, m), I(), w = setInterval(() => {
1820
+ I();
1806
1821
  }, 3e3);
1807
1822
  }), qe(() => {
1808
1823
  E?.(), b && (clearTimeout(b), b = null), A && (clearTimeout(A), A = null), w && (clearInterval(w), w = null), m && (window.removeEventListener(o.initializedEvent, m), m = null), p?.unbind && y && (p.unbind("connected", y.connected), p.unbind("connecting", y.connecting), p.unbind("disconnected", y.disconnected), p.unbind("unavailable", y.unavailable), p.unbind("error", y.error), p.unbind("state_change", y.stateChange)), p = null, y = null;
1809
1824
  }), {
1810
- connectionStatus: se(() => u.value),
1811
- isConnected: O,
1812
- isConnecting: z,
1825
+ connectionStatus: re(() => u.value),
1826
+ isConnected: F,
1827
+ isConnecting: q,
1813
1828
  isDisconnected: J,
1814
- isError: W,
1829
+ isError: G,
1815
1830
  hasConnectionIssues: te,
1816
1831
  statusMessage: k,
1817
- statusColor: I,
1818
- statusIcon: K,
1819
- showConnectionBanner: se(() => h.value),
1820
- lastConnectionTime: se(() => d.value),
1832
+ statusColor: L,
1833
+ statusIcon: V,
1834
+ showConnectionBanner: re(() => h.value),
1835
+ lastConnectionTime: re(() => d.value),
1821
1836
  connectionUptime: Se,
1822
- reconnectAttempts: se(() => f.value),
1823
- reconnect: V
1837
+ reconnectAttempts: re(() => f.value),
1838
+ reconnect: H
1824
1839
  };
1825
1840
  }
1826
1841
  const xs = () => {
@@ -1837,16 +1852,28 @@ function ea() {
1837
1852
  }
1838
1853
  const Me = Zt()("GlobalMessaging"), ta = 3, na = (e) => e.replace(/\/+$/, ""), sa = (e) => na(window.location.pathname) === `/messages/${e}`, ra = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
1839
1854
  function cc() {
1840
- const e = Qt(), n = ke()(), r = Yo(), o = Vt(), c = zi(), u = zt(), { conversations: d, requestConversations: f } = Ni(e), h = /* @__PURE__ */ new Set(), P = /* @__PURE__ */ new Map();
1855
+ const e = Qt(), n = ke()(), r = Yo(), o = Vt(), c = zi(), u = zt(), { conversations: d, requestConversations: f } = Ni(e), h = /* @__PURE__ */ new Set(), R = /* @__PURE__ */ new Map();
1841
1856
  let C = !1;
1842
1857
  function v(k) {
1843
- const I = P.get(k);
1844
- if (I && (P.delete(k), typeof I.channel.stopListening == "function"))
1845
- for (const K of I.bindings)
1846
- try {
1847
- I.channel.stopListening(K.event, K.handler);
1848
- } catch {
1849
- }
1858
+ const L = R.get(k);
1859
+ if (L) {
1860
+ if (R.delete(k), L.directBound) {
1861
+ const V = L.channel.subscription;
1862
+ if (V)
1863
+ for (const H of L.bindings)
1864
+ try {
1865
+ V.unbind(H.event, H.handler);
1866
+ } catch {
1867
+ }
1868
+ return;
1869
+ }
1870
+ if (typeof L.channel.stopListening == "function")
1871
+ for (const V of L.bindings)
1872
+ try {
1873
+ L.channel.stopListening(V.event, V.handler);
1874
+ } catch {
1875
+ }
1876
+ }
1850
1877
  }
1851
1878
  function E() {
1852
1879
  for (const k of h)
@@ -1854,84 +1881,96 @@ function cc() {
1854
1881
  h.clear();
1855
1882
  }
1856
1883
  function b(k) {
1857
- const I = Ae();
1858
- if (!I || h.has(k)) return;
1859
- const K = `conversation.${k}`;
1884
+ const L = Ae();
1885
+ if (!L || h.has(k)) return;
1886
+ const V = `conversation.${k}`;
1860
1887
  v(k);
1861
- const V = I.private(K), G = (D) => {
1862
- if (!Qi(D)) {
1863
- Me.warn("Dropping malformed ConversationMessageSent event", D);
1888
+ const H = L.private(V), X = (N) => {
1889
+ if (!Qi(N)) {
1890
+ Me.warn("Dropping malformed ConversationMessageSent event", N);
1864
1891
  return;
1865
1892
  }
1866
- const q = D, _e = n.currentUser?.id;
1867
- if (!_e || q.message.author_id === _e) return;
1868
- e.addMessage(q.message);
1869
- const M = e.hasDetailSubscription(q.conversation_id), F = sa(q.conversation_id);
1870
- if (M || F) {
1871
- const ie = e.getConversationById(q.conversation_id);
1872
- ie && (ie.unread_count = 0), e.markAsRead(q.conversation_id).catch(() => {
1893
+ const Y = N, M = n.currentUser?.id;
1894
+ if (!M || Y.message.author_id === M) return;
1895
+ e.addMessage(Y.message);
1896
+ const U = e.hasDetailSubscription(Y.conversation_id), ne = sa(Y.conversation_id);
1897
+ if (U || ne) {
1898
+ const oe = e.getConversationById(Y.conversation_id);
1899
+ oe && (oe.unread_count = 0), e.markAsRead(Y.conversation_id).catch(() => {
1873
1900
  });
1874
1901
  return;
1875
1902
  }
1876
- const Z = e.getConversationById(q.conversation_id);
1877
- if (Z) {
1878
- const ie = ra(Z);
1879
- ie || Z.unread_count++, r(ie);
1903
+ const ue = e.getConversationById(Y.conversation_id);
1904
+ if (ue) {
1905
+ const oe = ra(ue);
1906
+ oe || ue.unread_count++, r(oe);
1880
1907
  }
1881
- }, _ = (D) => {
1882
- if (!Yi(D)) {
1883
- Me.warn("Dropping malformed ConversationMessageRead event", D);
1908
+ }, _ = (N) => {
1909
+ if (!Yi(N)) {
1910
+ Me.warn("Dropping malformed ConversationMessageRead event", N);
1884
1911
  return;
1885
1912
  }
1886
- e.applyParticipantReadState(D);
1887
- }, L = (D) => {
1888
- if (!to(D)) {
1889
- Me.warn("Dropping malformed MessageReactionToggled event", D);
1913
+ e.applyParticipantReadState(N);
1914
+ }, I = (N) => {
1915
+ if (!to(N)) {
1916
+ Me.warn("Dropping malformed MessageReactionToggled event", N);
1890
1917
  return;
1891
1918
  }
1892
- const q = D;
1893
- e.updateMessageReactions(q.conversation_id, q.message_id, q.reactions);
1894
- }, he = (D) => {
1895
- if (!Zi(D)) {
1896
- Me.warn("Dropping malformed ConversationMessageEdited event", D);
1919
+ const Y = N;
1920
+ e.updateMessageReactions(Y.conversation_id, Y.message_id, Y.reactions);
1921
+ }, fe = (N) => {
1922
+ if (!Zi(N)) {
1923
+ Me.warn("Dropping malformed ConversationMessageEdited event", N);
1897
1924
  return;
1898
1925
  }
1899
- const q = D;
1926
+ const Y = N;
1900
1927
  e.applyMessageEdit(
1901
- q.conversation_id,
1902
- q.message.id,
1903
- q.message.body,
1904
- q.message.edited_at,
1905
- q.message.meta
1928
+ Y.conversation_id,
1929
+ Y.message.id,
1930
+ Y.message.body,
1931
+ Y.message.edited_at,
1932
+ Y.message.meta
1906
1933
  );
1907
- }, Se = (D) => {
1908
- if (!eo(D)) {
1909
- Me.warn("Dropping malformed ConversationMessageDeleted event", D);
1934
+ }, Se = (N) => {
1935
+ if (!eo(N)) {
1936
+ Me.warn("Dropping malformed ConversationMessageDeleted event", N);
1910
1937
  return;
1911
1938
  }
1912
- const q = D;
1913
- e.removeMessage(q.conversation_id, q.message_id);
1914
- }, B = (D) => {
1915
- if (!no(D)) {
1916
- Me.warn("Dropping malformed ConversationRequestAccepted event", D);
1939
+ const Y = N;
1940
+ e.removeMessage(Y.conversation_id, Y.message_id);
1941
+ }, B = (N) => {
1942
+ if (!no(N)) {
1943
+ Me.warn("Dropping malformed ConversationRequestAccepted event", N);
1917
1944
  return;
1918
1945
  }
1919
- const q = D, _e = e.getConversationById(q.conversation_id);
1920
- _e && (_e.is_request = !1), e.requests = e.requests.filter(
1921
- (M) => M.id !== q.conversation_id
1946
+ const Y = N, M = e.getConversationById(Y.conversation_id);
1947
+ M && (M.is_request = !1), e.requests = e.requests.filter(
1948
+ (U) => U.id !== Y.conversation_id
1922
1949
  );
1923
- };
1924
- V.listen(".ConversationMessageSent", G), V.listen(".ConversationMessageRead", _), V.listen(".ConversationMessageEdited", he), V.listen(".ConversationMessageDeleted", Se), V.listen(".MessageReactionToggled", L), V.listen(".ConversationRequestAccepted", B), P.set(k, {
1925
- channel: V,
1950
+ }, K = H.subscription;
1951
+ K ? (K.bind("ConversationMessageSent", X), K.bind("ConversationMessageRead", _), K.bind("ConversationMessageEdited", fe), K.bind("ConversationMessageDeleted", Se), K.bind("MessageReactionToggled", I), K.bind("ConversationRequestAccepted", B), R.set(k, {
1952
+ channel: H,
1953
+ directBound: !0,
1954
+ bindings: [
1955
+ { event: "ConversationMessageSent", handler: X },
1956
+ { event: "ConversationMessageRead", handler: _ },
1957
+ { event: "ConversationMessageEdited", handler: fe },
1958
+ { event: "ConversationMessageDeleted", handler: Se },
1959
+ { event: "MessageReactionToggled", handler: I },
1960
+ { event: "ConversationRequestAccepted", handler: B }
1961
+ ]
1962
+ })) : (H.listen(".ConversationMessageSent", X), H.listen(".ConversationMessageRead", _), H.listen(".ConversationMessageEdited", fe), H.listen(".ConversationMessageDeleted", Se), H.listen(".MessageReactionToggled", I), H.listen(".ConversationRequestAccepted", B), R.set(k, {
1963
+ channel: H,
1964
+ directBound: !1,
1926
1965
  bindings: [
1927
- { event: ".ConversationMessageSent", handler: G },
1966
+ { event: ".ConversationMessageSent", handler: X },
1928
1967
  { event: ".ConversationMessageRead", handler: _ },
1929
- { event: ".ConversationMessageEdited", handler: he },
1968
+ { event: ".ConversationMessageEdited", handler: fe },
1930
1969
  { event: ".ConversationMessageDeleted", handler: Se },
1931
- { event: ".MessageReactionToggled", handler: L },
1970
+ { event: ".MessageReactionToggled", handler: I },
1932
1971
  { event: ".ConversationRequestAccepted", handler: B }
1933
1972
  ]
1934
- }), h.add(k), e.registerGlobalConversationSubscription(k);
1973
+ })), h.add(k), e.registerGlobalConversationSubscription(k);
1935
1974
  }
1936
1975
  function A() {
1937
1976
  const k = Ae();
@@ -1939,72 +1978,72 @@ function cc() {
1939
1978
  E();
1940
1979
  return;
1941
1980
  }
1942
- for (const I of h) {
1943
- v(I);
1981
+ for (const L of h) {
1982
+ v(L);
1944
1983
  try {
1945
- k.leave(`conversation.${I}`);
1984
+ k.leave(`conversation.${L}`);
1946
1985
  } catch {
1947
1986
  }
1948
- e.unregisterGlobalConversationSubscription(I);
1987
+ e.unregisterGlobalConversationSubscription(L);
1949
1988
  }
1950
1989
  h.clear();
1951
1990
  }
1952
1991
  function w() {
1953
1992
  const k = Ae();
1954
1993
  if (!k) return;
1955
- const I = (() => {
1956
- const V = [...e.conversations, ...e.requestConversations], G = /* @__PURE__ */ new Set(), _ = [];
1957
- for (const L of V)
1958
- if (!G.has(L.id) && (G.add(L.id), _.push(L), _.length >= ta))
1994
+ const L = (() => {
1995
+ const H = [...e.conversations, ...e.requestConversations], X = /* @__PURE__ */ new Set(), _ = [];
1996
+ for (const I of H)
1997
+ if (!X.has(I.id) && (X.add(I.id), _.push(I), _.length >= ta))
1959
1998
  break;
1960
1999
  return _;
1961
- })(), K = new Set(I.map((V) => V.id));
1962
- for (const V of h)
1963
- if (!K.has(V) && !e.hasDetailSubscription(V)) {
2000
+ })(), V = new Set(L.map((H) => H.id));
2001
+ for (const H of h)
2002
+ if (!V.has(H) && !e.hasDetailSubscription(H)) {
1964
2003
  try {
1965
- v(V), k.leave(`conversation.${V}`);
2004
+ v(H), k.leave(`conversation.${H}`);
1966
2005
  } catch {
1967
2006
  }
1968
- h.delete(V), e.unregisterGlobalConversationSubscription(V);
2007
+ h.delete(H), e.unregisterGlobalConversationSubscription(H);
1969
2008
  }
1970
- for (const V of I)
1971
- b(V.id);
2009
+ for (const H of L)
2010
+ b(H.id);
1972
2011
  }
1973
2012
  function p(k) {
1974
- const I = Nt({
2013
+ const L = Nt({
1975
2014
  status: k.status,
1976
2015
  last_seen_at: k.last_seen_at ?? null
1977
2016
  });
1978
- I.status !== null && e.updatePresenceForUser(
2017
+ L.status !== null && e.updatePresenceForUser(
1979
2018
  k.user_id,
1980
- I.status,
1981
- I.lastSeenAt
2019
+ L.status,
2020
+ L.lastSeenAt
1982
2021
  );
1983
2022
  }
1984
2023
  async function m() {
1985
2024
  const k = [...new Set(
1986
- e.conversations.filter((I) => I.type === "dm" && typeof I.other_user_id == "string" && I.other_user_id.length > 0).map((I) => I.other_user_id)
2025
+ e.conversations.filter((L) => L.type === "dm" && typeof L.other_user_id == "string" && L.other_user_id.length > 0).map((L) => L.other_user_id)
1987
2026
  )];
1988
2027
  if (k.length !== 0)
1989
2028
  try {
1990
- const I = await o.get("/v1/presence/users", {
2029
+ const L = await o.get("/v1/presence/users", {
1991
2030
  params: { ids: k }
1992
- }), K = I.data?.data?.items ?? I.data?.items ?? [];
1993
- for (const V of K) {
1994
- const G = Nt(V);
1995
- G.status !== null && e.updatePresenceForUser(V.id, G.status, G.lastSeenAt);
2031
+ }), V = L.data?.data?.items ?? L.data?.items ?? [];
2032
+ for (const H of V) {
2033
+ const X = Nt(H);
2034
+ X.status !== null && e.updatePresenceForUser(H.id, X.status, X.lastSeenAt);
1996
2035
  }
1997
- } catch (I) {
1998
- Me.warn("Failed to refresh messaging presence snapshot", I);
2036
+ } catch (L) {
2037
+ Me.warn("Failed to refresh messaging presence snapshot", L);
1999
2038
  }
2000
2039
  }
2001
2040
  function y() {
2002
2041
  !Ae() || C || (Hi(p), C = !0);
2003
2042
  }
2004
- function O() {
2043
+ function F() {
2005
2044
  C && (Bi(), C = !1);
2006
2045
  }
2007
- const z = ot(
2046
+ const q = ot(
2008
2047
  d,
2009
2048
  () => {
2010
2049
  w();
@@ -2016,24 +2055,24 @@ function cc() {
2016
2055
  w();
2017
2056
  },
2018
2057
  { deep: !1, immediate: !0 }
2019
- ), W = ot(
2058
+ ), G = ot(
2020
2059
  () => c.fullPath,
2021
2060
  () => {
2022
2061
  w();
2023
2062
  }
2024
2063
  ), te = ht((k) => {
2025
- k === "connected" ? (E(), w(), O(), y(), m()) : (k === "disconnected" || k === "error") && (E(), O());
2064
+ k === "connected" ? (E(), w(), F(), y(), m()) : (k === "disconnected" || k === "error") && (E(), F());
2026
2065
  });
2027
2066
  w(), y(), m(), Ae() || ms().then((k) => {
2028
- k && (E(), w(), O(), y(), m());
2067
+ k && (E(), w(), F(), y(), m());
2029
2068
  }).catch((k) => {
2030
2069
  Me.warn("Failed to eagerly initialize messenger echo", k);
2031
2070
  }), u !== null && qe(() => {
2032
- z(), J(), W(), te(), A(), O();
2071
+ q(), J(), G(), te(), A(), F();
2033
2072
  });
2034
2073
  }
2035
2074
  function uc() {
2036
- const e = be(Ot());
2075
+ const e = ye(Ot());
2037
2076
  let n = null;
2038
2077
  return jt(() => {
2039
2078
  e.value = Ot(), n = ji((r) => {
@@ -2042,9 +2081,9 @@ function uc() {
2042
2081
  }), qe(() => {
2043
2082
  n?.(), n = null;
2044
2083
  }), {
2045
- accessState: se(() => e.value),
2046
- isBlocked: se(() => e.value !== "available"),
2047
- isSuspended: se(() => e.value === "account_suspended")
2084
+ accessState: re(() => e.value),
2085
+ isBlocked: re(() => e.value !== "available"),
2086
+ isSuspended: re(() => e.value === "account_suspended")
2048
2087
  };
2049
2088
  }
2050
2089
  const Ls = () => null, Is = {
@@ -2186,43 +2225,43 @@ function Ta(e, n, r) {
2186
2225
  }
2187
2226
  function lc() {
2188
2227
  const e = ke()(), n = ia(), r = Vt(), o = va(n.clientIdStorageKey);
2189
- let c = null, u = null, d = !1, f = It(n.accountLimitedUntilStorageKey), h = !1, P = !1, C = null, v = 0;
2228
+ let c = null, u = null, d = !1, f = It(n.accountLimitedUntilStorageKey), h = !1, R = !1, C = null, v = 0;
2190
2229
  const E = () => ca(n) ? n.authTokenResolver() !== null : !0, b = () => {
2191
2230
  c && (clearInterval(c), c = null);
2192
2231
  }, A = () => {
2193
2232
  u && (clearTimeout(u), u = null);
2194
2233
  }, w = () => {
2195
2234
  b(), c = setInterval(() => {
2196
- I();
2235
+ L();
2197
2236
  }, n.heartbeatIntervalMs);
2198
- }, p = (L) => {
2199
- f || console.warn(L), ya(n.accountLimitedUntilStorageKey), f = !0, d = !1, C = null, b(), A();
2200
- }, m = async (L) => {
2201
- if (!(!d || P || f || h) && E() && C !== L)
2237
+ }, p = (I) => {
2238
+ f || console.warn(I), ya(n.accountLimitedUntilStorageKey), f = !0, d = !1, C = null, b(), A();
2239
+ }, m = async (I) => {
2240
+ if (!(!d || R || f || h) && E() && C !== I)
2202
2241
  try {
2203
- await r.patch(n.statusUrl, { status: L }), C = L;
2204
- } catch (he) {
2205
- if (xt(he)) {
2242
+ await r.patch(n.statusUrl, { status: I }), C = I;
2243
+ } catch (fe) {
2244
+ if (xt(fe)) {
2206
2245
  p("[Presence] Presence updates paused: account is temporarily limited");
2207
2246
  return;
2208
2247
  }
2209
- Lt(he) && (h = !0, d = !1, C = null, b(), A());
2248
+ Lt(fe) && (h = !0, d = !1, C = null, b(), A());
2210
2249
  }
2211
2250
  }, y = () => {
2212
- A(), !(!d || P || f || h || document.visibilityState !== "visible") && (u = setTimeout(() => {
2251
+ A(), !(!d || R || f || h || document.visibilityState !== "visible") && (u = setTimeout(() => {
2213
2252
  u = null, m("idle");
2214
2253
  }, n.idleAfterMs));
2215
- }, O = () => {
2216
- if (P || !d || f || h || document.visibilityState !== "visible")
2254
+ }, F = () => {
2255
+ if (R || !d || f || h || document.visibilityState !== "visible")
2217
2256
  return;
2218
- const L = Date.now();
2219
- L - v < n.activityDebounceMs || (v = L, m("online"), y());
2220
- }, z = () => {
2221
- O();
2257
+ const I = Date.now();
2258
+ I - v < n.activityDebounceMs || (v = I, m("online"), y());
2259
+ }, q = () => {
2260
+ F();
2222
2261
  }, J = () => {
2223
- typeof document > "u" || typeof window > "u" || (document.addEventListener("pointerdown", z, { passive: !0 }), document.addEventListener("keydown", z), document.addEventListener("touchstart", z, { passive: !0 }), window.addEventListener("focus", z));
2224
- }, W = () => {
2225
- typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", z), document.removeEventListener("keydown", z), document.removeEventListener("touchstart", z), window.removeEventListener("focus", z));
2262
+ typeof document > "u" || typeof window > "u" || (document.addEventListener("pointerdown", q, { passive: !0 }), document.addEventListener("keydown", q), document.addEventListener("touchstart", q, { passive: !0 }), window.addEventListener("focus", q));
2263
+ }, G = () => {
2264
+ typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", q), document.removeEventListener("keydown", q), document.removeEventListener("touchstart", q), window.removeEventListener("focus", q));
2226
2265
  }, te = async () => {
2227
2266
  if (It(n.accountLimitedUntilStorageKey))
2228
2267
  return f = !0, "account_limited";
@@ -2231,134 +2270,134 @@ function lc() {
2231
2270
  client_id: o,
2232
2271
  user_agent: n.userAgentResolver()
2233
2272
  }), _a(n.accountLimitedUntilStorageKey), f = !1, h = !1, d = !0, C = null, "opened";
2234
- } catch (L) {
2235
- return xt(L) ? (p("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : Lt(L) ? (h = !0, d = !1, C = null, b(), A(), "account_suspended") : "failed";
2273
+ } catch (I) {
2274
+ return xt(I) ? (p("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : Lt(I) ? (h = !0, d = !1, C = null, b(), A(), "account_suspended") : "failed";
2236
2275
  }
2237
2276
  }, k = async () => {
2238
- for (let L = 0; L < ga; L += 1)
2277
+ for (let I = 0; I < ga; I += 1)
2239
2278
  if (await te() !== "failed")
2240
2279
  return;
2241
2280
  console.warn("[Presence] Failed to open session");
2242
- }, I = async () => {
2281
+ }, L = async () => {
2243
2282
  if (d && E())
2244
2283
  try {
2245
2284
  await r.post(n.sessionHeartbeatUrl, { client_id: o });
2246
- } catch (L) {
2247
- if (xt(L)) {
2285
+ } catch (I) {
2286
+ if (xt(I)) {
2248
2287
  p("[Presence] Heartbeat paused: account is temporarily limited");
2249
2288
  return;
2250
2289
  }
2251
- Lt(L) && (h = !0, d = !1, C = null, b(), A());
2290
+ Lt(I) && (h = !0, d = !1, C = null, b(), A());
2252
2291
  }
2253
- }, K = () => {
2292
+ }, V = () => {
2254
2293
  if (!d)
2255
2294
  return;
2256
2295
  d = !1, C = null, A();
2257
- const L = Ta(
2296
+ const I = Ta(
2258
2297
  n.sessionCloseUrl,
2259
2298
  o,
2260
2299
  n.authTokenResolver()
2261
2300
  );
2262
- if (L) {
2263
- L.catch(() => {
2301
+ if (I) {
2302
+ I.catch(() => {
2264
2303
  });
2265
2304
  return;
2266
2305
  }
2267
2306
  r.post(n.sessionCloseUrl, { client_id: o }).catch(() => {
2268
2307
  });
2269
- }, V = async () => {
2270
- if (!P) {
2271
- if (await k(), P) {
2272
- K();
2308
+ }, H = async () => {
2309
+ if (!R) {
2310
+ if (await k(), R) {
2311
+ V();
2273
2312
  return;
2274
2313
  }
2275
2314
  d && (w(), m("online"), y());
2276
2315
  }
2277
- }, G = () => {
2278
- if (!P) {
2316
+ }, X = () => {
2317
+ if (!R) {
2279
2318
  if (document.visibilityState === "hidden") {
2280
- K(), b(), A();
2319
+ V(), b(), A();
2281
2320
  return;
2282
2321
  }
2283
2322
  if (document.visibilityState === "visible" && !d) {
2284
- f = It(n.accountLimitedUntilStorageKey), !f && !h && V();
2323
+ f = It(n.accountLimitedUntilStorageKey), !f && !h && H();
2285
2324
  return;
2286
2325
  }
2287
- document.visibilityState === "visible" && d && !f && !h && O();
2326
+ document.visibilityState === "visible" && d && !f && !h && F();
2288
2327
  }
2289
2328
  }, _ = () => {
2290
- P || (K(), b(), A());
2329
+ R || (V(), b(), A());
2291
2330
  };
2292
2331
  jt(async () => {
2293
2332
  if (e.isAuthenticated ?? e.currentUser !== null) {
2294
- if (await k(), P) {
2295
- K();
2333
+ if (await k(), R) {
2334
+ V();
2296
2335
  return;
2297
2336
  }
2298
- d && (w(), m("online"), y()), J(), document.addEventListener("visibilitychange", G), window.addEventListener("pagehide", _), window.addEventListener("beforeunload", _);
2337
+ d && (w(), m("online"), y()), J(), document.addEventListener("visibilitychange", X), window.addEventListener("pagehide", _), window.addEventListener("beforeunload", _);
2299
2338
  }
2300
2339
  }), qe(() => {
2301
- P = !0, W(), A(), b(), K(), document.removeEventListener("visibilitychange", G), window.removeEventListener("pagehide", _), window.removeEventListener("beforeunload", _);
2340
+ R = !0, G(), A(), b(), V(), document.removeEventListener("visibilitychange", X), window.removeEventListener("pagehide", _), window.removeEventListener("beforeunload", _);
2302
2341
  });
2303
2342
  }
2304
2343
  const Ea = 12e3;
2305
2344
  function dc(e) {
2306
- const n = Qt(), r = ke()(), o = be(!1), c = be(null), u = be(null), d = be([]), f = /* @__PURE__ */ new Map(), h = zt(), P = h !== null, C = 20, v = 250;
2345
+ const n = Qt(), r = ke()(), o = ye(!1), c = ye(null), u = ye(null), d = ye([]), f = /* @__PURE__ */ new Map(), h = zt(), R = h !== null, C = 20, v = 250;
2307
2346
  let E = !1, b = null, A = 0, w = null;
2308
- const p = se(() => r.currentUser?.id), m = () => is(e)?.trim() ?? "", y = () => {
2347
+ const p = re(() => r.currentUser?.id), m = () => is(e)?.trim() ?? "", y = () => {
2309
2348
  const M = u.value?.trim() ?? "";
2310
2349
  if (M.length > 0)
2311
2350
  return M;
2312
- const F = m();
2313
- return F.length > 0 && (u.value = F), F;
2314
- }, O = (M) => n.getTypingUsers(M), z = (M) => {
2315
- const F = O(M);
2316
- for (const Z of F)
2317
- n.removeTypingUser(M, Z.id);
2351
+ const U = m();
2352
+ return U.length > 0 && (u.value = U), U;
2353
+ }, F = (M) => n.getTypingUsers(M), q = (M) => {
2354
+ const U = F(M);
2355
+ for (const ne of U)
2356
+ n.removeTypingUser(M, ne.id);
2318
2357
  d.value = [];
2319
2358
  }, J = (M) => {
2320
- const F = f.get(M);
2321
- F && (clearTimeout(F), f.delete(M));
2322
- }, W = () => {
2359
+ const U = f.get(M);
2360
+ U && (clearTimeout(U), f.delete(M));
2361
+ }, G = () => {
2323
2362
  for (const M of f.values())
2324
2363
  clearTimeout(M);
2325
2364
  f.clear();
2326
2365
  }, te = () => {
2327
2366
  w && (clearTimeout(w), w = null), A = 0;
2328
2367
  }, k = () => {
2329
- !P || o.value || w || A >= C || (w = setTimeout(() => {
2330
- w = null, A += 1, G();
2368
+ !R || o.value || w || A >= C || (w = setTimeout(() => {
2369
+ w = null, A += 1, X();
2331
2370
  }, v));
2332
- }, I = (M, F) => {
2371
+ }, L = (M, U) => {
2333
2372
  J(M);
2334
- const Z = setTimeout(() => {
2335
- f.delete(M), n.removeTypingUser(F, M), d.value = d.value.filter((ie) => ie.id !== M);
2373
+ const ne = setTimeout(() => {
2374
+ f.delete(M), n.removeTypingUser(U, M), d.value = d.value.filter((ue) => ue.id !== M);
2336
2375
  }, Ea);
2337
- f.set(M, Z);
2338
- }, K = () => {
2376
+ f.set(M, ne);
2377
+ }, V = () => {
2339
2378
  E = !0, te();
2340
- }, V = (M) => {
2379
+ }, H = (M) => {
2341
2380
  try {
2342
2381
  b && (b(), b = null), b = Wi(M, {
2343
- onTypingStart: L,
2344
- onTypingStop: he
2382
+ onTypingStart: I,
2383
+ onTypingStop: fe
2345
2384
  }), te(), o.value = !0, u.value = M;
2346
- } catch (F) {
2347
- c.value = F instanceof Error ? F.message : "Failed to subscribe to typing channel";
2385
+ } catch (U) {
2386
+ c.value = U instanceof Error ? U.message : "Failed to subscribe to typing channel";
2348
2387
  }
2349
- }, G = () => {
2388
+ }, X = () => {
2350
2389
  const M = m();
2351
2390
  if (!(o.value || !M)) {
2352
2391
  if (c.value = null, Ae() && Rn() === "connected") {
2353
- V(M);
2392
+ H(M);
2354
2393
  return;
2355
2394
  }
2356
- E = !1, ms().then((F) => {
2357
- if (E || o.value || !F)
2395
+ E = !1, ms().then((U) => {
2396
+ if (E || o.value || !U)
2358
2397
  return;
2359
- const Z = m();
2360
- if (Z && Z === M && Ae() && Rn() === "connected") {
2361
- V(Z);
2398
+ const ne = m();
2399
+ if (ne && ne === M && Ae() && Rn() === "connected") {
2400
+ H(ne);
2362
2401
  return;
2363
2402
  }
2364
2403
  k();
@@ -2366,88 +2405,88 @@ function dc(e) {
2366
2405
  }
2367
2406
  }, _ = () => {
2368
2407
  const M = u.value;
2369
- if (K(), !(!o.value || !M))
2408
+ if (V(), !(!o.value || !M))
2370
2409
  try {
2371
- b && (b(), b = null), Gi(M), W(), z(M), o.value = !1, u.value = null, c.value = null;
2372
- } catch (F) {
2373
- c.value = F instanceof Error ? F.message : "Failed to unsubscribe from typing channel";
2410
+ b && (b(), b = null), Gi(M), G(), q(M), o.value = !1, u.value = null, c.value = null;
2411
+ } catch (U) {
2412
+ c.value = U instanceof Error ? U.message : "Failed to unsubscribe from typing channel";
2374
2413
  }
2375
2414
  };
2376
- function L(M) {
2415
+ function I(M) {
2377
2416
  if (M.user_id === p.value)
2378
2417
  return;
2379
- const F = y();
2380
- if (!F)
2418
+ const U = y();
2419
+ if (!U)
2381
2420
  return;
2382
- const Z = {
2421
+ const ne = {
2383
2422
  id: M.user.id,
2384
2423
  name: M.user.name,
2385
2424
  ...M.user.avatar !== void 0 ? { avatar: M.user.avatar } : {}
2386
2425
  };
2387
- d.value.some((ie) => ie.id === Z.id) || (d.value = [...d.value, Z]), n.addTypingUser(F, Z), I(M.user_id, F);
2426
+ d.value.some((ue) => ue.id === ne.id) || (d.value = [...d.value, ne]), n.addTypingUser(U, ne), L(M.user_id, U);
2388
2427
  }
2389
- function he(M) {
2428
+ function fe(M) {
2390
2429
  if (M.user_id === p.value)
2391
2430
  return;
2392
2431
  J(M.user_id);
2393
- const F = y();
2394
- F && (d.value = d.value.filter((Z) => Z.id !== M.user_id), n.removeTypingUser(F, M.user_id));
2432
+ const U = y();
2433
+ U && (d.value = d.value.filter((ne) => ne.id !== M.user_id), n.removeTypingUser(U, M.user_id));
2395
2434
  }
2396
- const Se = se(() => {
2435
+ const Se = re(() => {
2397
2436
  const M = y();
2398
2437
  if (!M)
2399
2438
  return d.value;
2400
- const F = O(M);
2439
+ const U = F(M);
2401
2440
  if (d.value.length === 0)
2402
- return F;
2403
- if (F.length === 0)
2441
+ return U;
2442
+ if (U.length === 0)
2404
2443
  return d.value;
2405
- const Z = /* @__PURE__ */ new Map();
2406
- for (const ie of F)
2407
- Z.set(ie.id, ie);
2408
- for (const ie of d.value)
2409
- Z.set(ie.id, ie);
2410
- return [...Z.values()];
2411
- }), B = se(() => {
2444
+ const ne = /* @__PURE__ */ new Map();
2445
+ for (const ue of U)
2446
+ ne.set(ue.id, ue);
2447
+ for (const ue of d.value)
2448
+ ne.set(ue.id, ue);
2449
+ return [...ne.values()];
2450
+ }), B = re(() => {
2412
2451
  const M = Se.value;
2413
2452
  if (M.length === 0)
2414
2453
  return "";
2415
- const F = M[0];
2416
- if (!F)
2454
+ const U = M[0];
2455
+ if (!U)
2417
2456
  return "";
2418
2457
  if (M.length === 1)
2419
- return `${F.name} is typing...`;
2420
- const Z = M[1];
2421
- if (!Z)
2458
+ return `${U.name} is typing...`;
2459
+ const ne = M[1];
2460
+ if (!ne)
2422
2461
  return `${M.length} people are typing...`;
2423
2462
  if (M.length === 2)
2424
- return `${F.name} and ${Z.name} are typing...`;
2425
- const ie = M[2];
2426
- return ie ? M.length === 3 ? `${F.name}, ${Z.name} and ${ie.name} are typing...` : `${M.length} people are typing...` : `${M.length} people are typing...`;
2427
- }), D = se(() => Se.value.length > 0), q = () => {
2428
- m() && (b && (b(), b = null), o.value = !1, u.value = null, G());
2463
+ return `${U.name} and ${ne.name} are typing...`;
2464
+ const ue = M[2];
2465
+ return ue ? M.length === 3 ? `${U.name}, ${ne.name} and ${ue.name} are typing...` : `${M.length} people are typing...` : `${M.length} people are typing...`;
2466
+ }), K = re(() => Se.value.length > 0), N = () => {
2467
+ m() && (b && (b(), b = null), o.value = !1, u.value = null, X());
2429
2468
  };
2430
- typeof window < "u" && window.addEventListener(Je(), q);
2431
- const _e = ht((M) => {
2469
+ typeof window < "u" && window.addEventListener(Je(), N);
2470
+ const Y = ht((M) => {
2432
2471
  if (M === "connected") {
2433
- o.value || G();
2472
+ o.value || X();
2434
2473
  return;
2435
2474
  }
2436
2475
  if (M === "disconnected" || M === "error") {
2437
- K(), b && (b(), b = null);
2438
- const F = y();
2439
- F && z(F), o.value = !1, u.value = null, W();
2476
+ V(), b && (b(), b = null);
2477
+ const U = y();
2478
+ U && q(U), o.value = !1, u.value = null, G();
2440
2479
  }
2441
2480
  });
2442
2481
  return h !== null && qe(() => {
2443
- K(), _e(), W(), _(), typeof window < "u" && window.removeEventListener(Je(), q);
2482
+ V(), Y(), G(), _(), typeof window < "u" && window.removeEventListener(Je(), N);
2444
2483
  }), {
2445
- isSubscribed: se(() => o.value),
2446
- error: se(() => c.value),
2484
+ isSubscribed: re(() => o.value),
2485
+ error: re(() => c.value),
2447
2486
  typingUsers: Se,
2448
2487
  formatTypingIndicator: B,
2449
- hasTypingUsers: D,
2450
- subscribe: G,
2488
+ hasTypingUsers: K,
2489
+ subscribe: X,
2451
2490
  unsubscribe: _
2452
2491
  };
2453
2492
  }
@@ -3434,8 +3473,8 @@ function Oa() {
3434
3473
  }, c.t = function(u, d) {
3435
3474
  if (d & 1 && (u = c(u)), d & 8 || d & 4 && typeof u == "object" && u && u.__esModule) return u;
3436
3475
  var f = /* @__PURE__ */ Object.create(null);
3437
- if (c.r(f), Object.defineProperty(f, "default", { enumerable: !0, value: u }), d & 2 && typeof u != "string") for (var h in u) c.d(f, h, (function(P) {
3438
- return u[P];
3476
+ if (c.r(f), Object.defineProperty(f, "default", { enumerable: !0, value: u }), d & 2 && typeof u != "string") for (var h in u) c.d(f, h, (function(R) {
3477
+ return u[R];
3439
3478
  }).bind(null, h));
3440
3479
  return f;
3441
3480
  }, c.n = function(u) {
@@ -3460,10 +3499,10 @@ function Oa() {
3460
3499
  (function(r, o, c) {
3461
3500
  var u = this && this.__extends || /* @__PURE__ */ (function() {
3462
3501
  var w = function(p, m) {
3463
- return w = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(y, O) {
3464
- y.__proto__ = O;
3465
- } || function(y, O) {
3466
- for (var z in O) O.hasOwnProperty(z) && (y[z] = O[z]);
3502
+ return w = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(y, F) {
3503
+ y.__proto__ = F;
3504
+ } || function(y, F) {
3505
+ for (var q in F) F.hasOwnProperty(q) && (y[q] = F[q]);
3467
3506
  }, w(p, m);
3468
3507
  };
3469
3508
  return function(p, m) {
@@ -3485,13 +3524,13 @@ function Oa() {
3485
3524
  return this._paddingCharacter ? (p + 2) / 3 * 4 | 0 : (p * 8 + 5) / 6 | 0;
3486
3525
  }, w.prototype.encode = function(p) {
3487
3526
  for (var m = "", y = 0; y < p.length - 2; y += 3) {
3488
- var O = p[y] << 16 | p[y + 1] << 8 | p[y + 2];
3489
- m += this._encodeByte(O >>> 18 & 63), m += this._encodeByte(O >>> 12 & 63), m += this._encodeByte(O >>> 6 & 63), m += this._encodeByte(O >>> 0 & 63);
3527
+ var F = p[y] << 16 | p[y + 1] << 8 | p[y + 2];
3528
+ m += this._encodeByte(F >>> 18 & 63), m += this._encodeByte(F >>> 12 & 63), m += this._encodeByte(F >>> 6 & 63), m += this._encodeByte(F >>> 0 & 63);
3490
3529
  }
3491
- var z = p.length - y;
3492
- if (z > 0) {
3493
- var O = p[y] << 16 | (z === 2 ? p[y + 1] << 8 : 0);
3494
- m += this._encodeByte(O >>> 18 & 63), m += this._encodeByte(O >>> 12 & 63), z === 2 ? m += this._encodeByte(O >>> 6 & 63) : m += this._paddingCharacter || "", m += this._paddingCharacter || "";
3530
+ var q = p.length - y;
3531
+ if (q > 0) {
3532
+ var F = p[y] << 16 | (q === 2 ? p[y + 1] << 8 : 0);
3533
+ m += this._encodeByte(F >>> 18 & 63), m += this._encodeByte(F >>> 12 & 63), q === 2 ? m += this._encodeByte(F >>> 6 & 63) : m += this._paddingCharacter || "", m += this._paddingCharacter || "";
3495
3534
  }
3496
3535
  return m;
3497
3536
  }, w.prototype.maxDecodedLength = function(p) {
@@ -3501,11 +3540,11 @@ function Oa() {
3501
3540
  }, w.prototype.decode = function(p) {
3502
3541
  if (p.length === 0)
3503
3542
  return new Uint8Array(0);
3504
- for (var m = this._getPaddingLength(p), y = p.length - m, O = new Uint8Array(this.maxDecodedLength(y)), z = 0, J = 0, W = 0, te = 0, k = 0, I = 0, K = 0; J < y - 4; J += 4)
3505
- te = this._decodeChar(p.charCodeAt(J + 0)), k = this._decodeChar(p.charCodeAt(J + 1)), I = this._decodeChar(p.charCodeAt(J + 2)), K = this._decodeChar(p.charCodeAt(J + 3)), O[z++] = te << 2 | k >>> 4, O[z++] = k << 4 | I >>> 2, O[z++] = I << 6 | K, W |= te & d, W |= k & d, W |= I & d, W |= K & d;
3506
- if (J < y - 1 && (te = this._decodeChar(p.charCodeAt(J)), k = this._decodeChar(p.charCodeAt(J + 1)), O[z++] = te << 2 | k >>> 4, W |= te & d, W |= k & d), J < y - 2 && (I = this._decodeChar(p.charCodeAt(J + 2)), O[z++] = k << 4 | I >>> 2, W |= I & d), J < y - 3 && (K = this._decodeChar(p.charCodeAt(J + 3)), O[z++] = I << 6 | K, W |= K & d), W !== 0)
3543
+ for (var m = this._getPaddingLength(p), y = p.length - m, F = new Uint8Array(this.maxDecodedLength(y)), q = 0, J = 0, G = 0, te = 0, k = 0, L = 0, V = 0; J < y - 4; J += 4)
3544
+ te = this._decodeChar(p.charCodeAt(J + 0)), k = this._decodeChar(p.charCodeAt(J + 1)), L = this._decodeChar(p.charCodeAt(J + 2)), V = this._decodeChar(p.charCodeAt(J + 3)), F[q++] = te << 2 | k >>> 4, F[q++] = k << 4 | L >>> 2, F[q++] = L << 6 | V, G |= te & d, G |= k & d, G |= L & d, G |= V & d;
3545
+ if (J < y - 1 && (te = this._decodeChar(p.charCodeAt(J)), k = this._decodeChar(p.charCodeAt(J + 1)), F[q++] = te << 2 | k >>> 4, G |= te & d, G |= k & d), J < y - 2 && (L = this._decodeChar(p.charCodeAt(J + 2)), F[q++] = k << 4 | L >>> 2, G |= L & d), J < y - 3 && (V = this._decodeChar(p.charCodeAt(J + 3)), F[q++] = L << 6 | V, G |= V & d), G !== 0)
3507
3546
  throw new Error("Base64Coder: incorrect characters for decoding");
3508
- return O;
3547
+ return F;
3509
3548
  }, w.prototype._encodeByte = function(p) {
3510
3549
  var m = p;
3511
3550
  return m += 65, m += 25 - p >>> 8 & 6, m += 51 - p >>> 8 & -75, m += 61 - p >>> 8 & -15, m += 62 - p >>> 8 & 3, String.fromCharCode(m);
@@ -3526,10 +3565,10 @@ function Oa() {
3526
3565
  );
3527
3566
  o.Coder = f;
3528
3567
  var h = new f();
3529
- function P(w) {
3568
+ function R(w) {
3530
3569
  return h.encode(w);
3531
3570
  }
3532
- o.encode = P;
3571
+ o.encode = R;
3533
3572
  function C(w) {
3534
3573
  return h.decode(w);
3535
3574
  }
@@ -3599,7 +3638,7 @@ function Oa() {
3599
3638
  return v;
3600
3639
  }
3601
3640
  o.encodedLength = h;
3602
- function P(C) {
3641
+ function R(C) {
3603
3642
  for (var v = [], E = 0; E < C.length; E++) {
3604
3643
  var b = C[E];
3605
3644
  if (b & 128) {
@@ -3639,7 +3678,7 @@ function Oa() {
3639
3678
  }
3640
3679
  return v.join("");
3641
3680
  }
3642
- o.decode = P;
3681
+ o.decode = R;
3643
3682
  }),
3644
3683
  /* 2 */
3645
3684
  /***/
@@ -3693,7 +3732,7 @@ function Oa() {
3693
3732
  cdn_https: "https://js.pusher.com",
3694
3733
  dependency_suffix: ""
3695
3734
  }, h = f;
3696
- class P {
3735
+ class R {
3697
3736
  constructor(t) {
3698
3737
  this.options = t, this.receivers = t.receivers || d, this.loading = {};
3699
3738
  }
@@ -3703,28 +3742,28 @@ function Oa() {
3703
3742
  l.loading[t].push(a);
3704
3743
  else {
3705
3744
  l.loading[t] = [a];
3706
- var g = $.createScriptRequest(l.getPath(t, s)), S = l.receivers.create(function(x) {
3745
+ var g = j.createScriptRequest(l.getPath(t, s)), S = l.receivers.create(function(x) {
3707
3746
  if (l.receivers.remove(S), l.loading[t]) {
3708
- var j = l.loading[t];
3747
+ var z = l.loading[t];
3709
3748
  delete l.loading[t];
3710
- for (var Q = function(ue) {
3711
- ue || g.cleanup();
3712
- }, ee = 0; ee < j.length; ee++)
3713
- j[ee](x, Q);
3749
+ for (var Q = function(de) {
3750
+ de || g.cleanup();
3751
+ }, ee = 0; ee < z.length; ee++)
3752
+ z[ee](x, Q);
3714
3753
  }
3715
3754
  });
3716
3755
  g.send(S);
3717
3756
  }
3718
3757
  }
3719
3758
  getRoot(t) {
3720
- var s, a = $.getDocument().location.protocol;
3759
+ var s, a = j.getDocument().location.protocol;
3721
3760
  return t && t.useTLS || a === "https:" ? s = this.options.cdn_https : s = this.options.cdn_http, s.replace(/\/*$/, "") + "/" + this.options.version;
3722
3761
  }
3723
3762
  getPath(t, s) {
3724
3763
  return this.getRoot(s) + "/" + t + this.options.suffix + ".js";
3725
3764
  }
3726
3765
  }
3727
- var C = new u("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new P({
3766
+ var C = new u("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new R({
3728
3767
  cdn_http: h.cdn_http,
3729
3768
  cdn_https: h.cdn_https,
3730
3769
  version: h.VERSION,
@@ -3776,12 +3815,12 @@ function Oa() {
3776
3815
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3777
3816
  }
3778
3817
  }
3779
- class O extends Error {
3818
+ class F extends Error {
3780
3819
  constructor(t) {
3781
3820
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3782
3821
  }
3783
3822
  }
3784
- class z extends Error {
3823
+ class q extends Error {
3785
3824
  constructor(t) {
3786
3825
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3787
3826
  }
@@ -3791,7 +3830,7 @@ function Oa() {
3791
3830
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3792
3831
  }
3793
3832
  }
3794
- class W extends Error {
3833
+ class G extends Error {
3795
3834
  constructor(t) {
3796
3835
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3797
3836
  }
@@ -3806,8 +3845,8 @@ function Oa() {
3806
3845
  super(s), this.status = t, Object.setPrototypeOf(this, new.target.prototype);
3807
3846
  }
3808
3847
  }
3809
- var K = function(i, t, s, a, l) {
3810
- const g = $.createXHR();
3848
+ var V = function(i, t, s, a, l) {
3849
+ const g = j.createXHR();
3811
3850
  g.open("POST", s.endpoint, !0), g.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
3812
3851
  for (var S in s.headers)
3813
3852
  g.setRequestHeader(S, s.headers[S]);
@@ -3819,13 +3858,13 @@ function Oa() {
3819
3858
  return g.onreadystatechange = function() {
3820
3859
  if (g.readyState === 4)
3821
3860
  if (g.status === 200) {
3822
- let x, j = !1;
3861
+ let x, z = !1;
3823
3862
  try {
3824
- x = JSON.parse(g.responseText), j = !0;
3863
+ x = JSON.parse(g.responseText), z = !0;
3825
3864
  } catch {
3826
3865
  l(new k(200, `JSON returned from ${a.toString()} endpoint was invalid, yet status code was 200. Data was: ${g.responseText}`), null);
3827
3866
  }
3828
- j && l(null, x);
3867
+ z && l(null, x);
3829
3868
  } else {
3830
3869
  let x = "";
3831
3870
  switch (a) {
@@ -3840,14 +3879,14 @@ function Oa() {
3840
3879
  }
3841
3880
  }, g.send(t), g;
3842
3881
  };
3843
- function V(i) {
3844
- return B(he(i));
3882
+ function H(i) {
3883
+ return B(fe(i));
3845
3884
  }
3846
- var G = String.fromCharCode, _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", L = function(i) {
3885
+ var X = String.fromCharCode, _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", I = function(i) {
3847
3886
  var t = i.charCodeAt(0);
3848
- return t < 128 ? i : t < 2048 ? G(192 | t >>> 6) + G(128 | t & 63) : G(224 | t >>> 12 & 15) + G(128 | t >>> 6 & 63) + G(128 | t & 63);
3849
- }, he = function(i) {
3850
- return i.replace(/[^\x00-\x7F]/g, L);
3887
+ return t < 128 ? i : t < 2048 ? X(192 | t >>> 6) + X(128 | t & 63) : X(224 | t >>> 12 & 15) + X(128 | t >>> 6 & 63) + X(128 | t & 63);
3888
+ }, fe = function(i) {
3889
+ return i.replace(/[^\x00-\x7F]/g, I);
3851
3890
  }, Se = function(i) {
3852
3891
  var t = [0, 2, 1][i.length % 3], s = i.charCodeAt(0) << 16 | (i.length > 1 ? i.charCodeAt(1) : 0) << 8 | (i.length > 2 ? i.charCodeAt(2) : 0), a = [
3853
3892
  _.charAt(s >>> 18),
@@ -3859,7 +3898,7 @@ function Oa() {
3859
3898
  }, B = window.btoa || function(i) {
3860
3899
  return i.replace(/[\s\S]{1,3}/g, Se);
3861
3900
  };
3862
- class D {
3901
+ class K {
3863
3902
  constructor(t, s, a, l) {
3864
3903
  this.clear = s, this.timer = t(() => {
3865
3904
  this.timer && (this.timer = l(this.timer));
@@ -3872,33 +3911,33 @@ function Oa() {
3872
3911
  this.timer && (this.clear(this.timer), this.timer = null);
3873
3912
  }
3874
3913
  }
3875
- var q = D;
3876
- function _e(i) {
3914
+ var N = K;
3915
+ function Y(i) {
3877
3916
  window.clearTimeout(i);
3878
3917
  }
3879
3918
  function M(i) {
3880
3919
  window.clearInterval(i);
3881
3920
  }
3882
- class F extends q {
3921
+ class U extends N {
3883
3922
  constructor(t, s) {
3884
- super(setTimeout, _e, t, function(a) {
3923
+ super(setTimeout, Y, t, function(a) {
3885
3924
  return s(), null;
3886
3925
  });
3887
3926
  }
3888
3927
  }
3889
- class Z extends q {
3928
+ class ne extends N {
3890
3929
  constructor(t, s) {
3891
3930
  super(setInterval, M, t, function(a) {
3892
3931
  return s(), a;
3893
3932
  });
3894
3933
  }
3895
3934
  }
3896
- var ie = {
3935
+ var ue = {
3897
3936
  now() {
3898
3937
  return Date.now ? Date.now() : (/* @__PURE__ */ new Date()).valueOf();
3899
3938
  },
3900
3939
  defer(i) {
3901
- return new F(0, i);
3940
+ return new U(0, i);
3902
3941
  },
3903
3942
  method(i, ...t) {
3904
3943
  var s = Array.prototype.slice.call(arguments, 1);
@@ -3906,12 +3945,12 @@ function Oa() {
3906
3945
  return a[i].apply(a, s.concat(arguments));
3907
3946
  };
3908
3947
  }
3909
- }, fe = ie;
3910
- function me(i, ...t) {
3948
+ }, oe = ue;
3949
+ function ve(i, ...t) {
3911
3950
  for (var s = 0; s < t.length; s++) {
3912
3951
  var a = t[s];
3913
3952
  for (var l in a)
3914
- a[l] && a[l].constructor && a[l].constructor === Object ? i[l] = me(i[l] || {}, a[l]) : i[l] = a[l];
3953
+ a[l] && a[l].constructor && a[l].constructor === Object ? i[l] = ve(i[l] || {}, a[l]) : i[l] = a[l];
3915
3954
  }
3916
3955
  return i;
3917
3956
  }
@@ -3935,34 +3974,34 @@ function Oa() {
3935
3974
  for (var s in i)
3936
3975
  Object.prototype.hasOwnProperty.call(i, s) && t(i[s], s, i);
3937
3976
  }
3938
- function R(i) {
3977
+ function P(i) {
3939
3978
  var t = [];
3940
3979
  return T(i, function(s, a) {
3941
3980
  t.push(a);
3942
3981
  }), t;
3943
3982
  }
3944
- function N(i) {
3983
+ function D(i) {
3945
3984
  var t = [];
3946
3985
  return T(i, function(s) {
3947
3986
  t.push(s);
3948
3987
  }), t;
3949
3988
  }
3950
- function U(i, t, s) {
3989
+ function O(i, t, s) {
3951
3990
  for (var a = 0; a < i.length; a++)
3952
3991
  t.call(s || window, i[a], a, i);
3953
3992
  }
3954
- function ne(i, t) {
3993
+ function se(i, t) {
3955
3994
  for (var s = [], a = 0; a < i.length; a++)
3956
3995
  s.push(t(i[a], a, i, s));
3957
3996
  return s;
3958
3997
  }
3959
- function oe(i, t) {
3998
+ function ae(i, t) {
3960
3999
  var s = {};
3961
4000
  return T(i, function(a, l) {
3962
4001
  s[l] = t(a);
3963
4002
  }), s;
3964
4003
  }
3965
- function ce(i, t) {
4004
+ function le(i, t) {
3966
4005
  t = t || function(l) {
3967
4006
  return !!l;
3968
4007
  };
@@ -3988,27 +4027,27 @@ function Oa() {
3988
4027
  return !0;
3989
4028
  return !1;
3990
4029
  }
3991
- function pe(i, t) {
4030
+ function ge(i, t) {
3992
4031
  for (var s = 0; s < i.length; s++)
3993
4032
  if (!t(i[s], s, i))
3994
4033
  return !1;
3995
4034
  return !0;
3996
4035
  }
3997
- function ve(i) {
3998
- return oe(i, function(t) {
3999
- return typeof t == "object" && (t = Qe(t)), encodeURIComponent(V(t.toString()));
4036
+ function be(i) {
4037
+ return ae(i, function(t) {
4038
+ return typeof t == "object" && (t = Qe(t)), encodeURIComponent(H(t.toString()));
4000
4039
  });
4001
4040
  }
4002
4041
  function Hs(i) {
4003
4042
  var t = Re(i, function(a) {
4004
4043
  return a !== void 0;
4005
- }), s = ne(Le(ve(t)), fe.method("join", "=")).join("&");
4044
+ }), s = se(Le(be(t)), oe.method("join", "=")).join("&");
4006
4045
  return s;
4007
4046
  }
4008
4047
  function Bs(i) {
4009
4048
  var t = [], s = [];
4010
4049
  return (function a(l, g) {
4011
- var S, x, j;
4050
+ var S, x, z;
4012
4051
  switch (typeof l) {
4013
4052
  case "object":
4014
4053
  if (!l)
@@ -4017,14 +4056,14 @@ function Oa() {
4017
4056
  if (t[S] === l)
4018
4057
  return { $ref: s[S] };
4019
4058
  if (t.push(l), s.push(g), Object.prototype.toString.apply(l) === "[object Array]")
4020
- for (j = [], S = 0; S < l.length; S += 1)
4021
- j[S] = a(l[S], g + "[" + S + "]");
4059
+ for (z = [], S = 0; S < l.length; S += 1)
4060
+ z[S] = a(l[S], g + "[" + S + "]");
4022
4061
  else {
4023
- j = {};
4062
+ z = {};
4024
4063
  for (x in l)
4025
- Object.prototype.hasOwnProperty.call(l, x) && (j[x] = a(l[x], g + "[" + JSON.stringify(x) + "]"));
4064
+ Object.prototype.hasOwnProperty.call(l, x) && (z[x] = a(l[x], g + "[" + JSON.stringify(x) + "]"));
4026
4065
  }
4027
- return j;
4066
+ return z;
4028
4067
  case "number":
4029
4068
  case "string":
4030
4069
  case "boolean":
@@ -4065,16 +4104,16 @@ function Oa() {
4065
4104
  Tt.log ? Tt.log(a) : Tt.logToConsole && t.bind(this)(a);
4066
4105
  }
4067
4106
  }
4068
- var ae = new Vs(), Xs = function(i, t, s, a, l) {
4069
- (s.headers !== void 0 || s.headersProvider != null) && ae.warn(`To send headers with the ${a.toString()} request, you must use AJAX, rather than JSONP.`);
4107
+ var ce = new Vs(), Xs = function(i, t, s, a, l) {
4108
+ (s.headers !== void 0 || s.headersProvider != null) && ce.warn(`To send headers with the ${a.toString()} request, you must use AJAX, rather than JSONP.`);
4070
4109
  var g = i.nextAuthCallbackID.toString();
4071
4110
  i.nextAuthCallbackID++;
4072
4111
  var S = i.getDocument(), x = S.createElement("script");
4073
4112
  i.auth_callbacks[g] = function(ee) {
4074
4113
  l(null, ee);
4075
4114
  };
4076
- var j = "Pusher.auth_callbacks['" + g + "']";
4077
- x.src = s.endpoint + "?callback=" + encodeURIComponent(j) + "&" + t;
4115
+ var z = "Pusher.auth_callbacks['" + g + "']";
4116
+ x.src = s.endpoint + "?callback=" + encodeURIComponent(z) + "&" + t;
4078
4117
  var Q = S.getElementsByTagName("head")[0] || S.documentElement;
4079
4118
  Q.insertBefore(x, Q.firstChild);
4080
4119
  }, Ws = Xs;
@@ -4105,7 +4144,7 @@ function Oa() {
4105
4144
  send(t) {
4106
4145
  if (!this.request) {
4107
4146
  var s = Hs(this.data), a = this.url + "/" + t.number + "?" + s;
4108
- this.request = $.createScriptRequest(a), this.request.send(t);
4147
+ this.request = j.createScriptRequest(a), this.request.send(t);
4109
4148
  }
4110
4149
  }
4111
4150
  cleanup() {
@@ -4114,8 +4153,8 @@ function Oa() {
4114
4153
  }
4115
4154
  var Ks = function(i, t) {
4116
4155
  return function(s, a) {
4117
- var l = "http" + (t ? "s" : "") + "://", g = l + (i.host || i.options.host) + i.options.path, S = $.createJSONPRequest(g, s), x = $.ScriptReceivers.create(function(j, Q) {
4118
- d.remove(x), S.cleanup(), Q && Q.host && (i.host = Q.host), a && a(j, Q);
4156
+ var l = "http" + (t ? "s" : "") + "://", g = l + (i.host || i.options.host) + i.options.path, S = j.createJSONPRequest(g, s), x = j.ScriptReceivers.create(function(z, Q) {
4157
+ d.remove(x), S.cleanup(), Q && Q.host && (i.host = Q.host), a && a(z, Q);
4119
4158
  });
4120
4159
  S.send(x);
4121
4160
  };
@@ -4168,18 +4207,18 @@ function Oa() {
4168
4207
  this._callbacks = {};
4169
4208
  return;
4170
4209
  }
4171
- var l = t ? [mt(t)] : R(this._callbacks);
4210
+ var l = t ? [mt(t)] : P(this._callbacks);
4172
4211
  s || a ? this.removeCallback(l, s, a) : this.removeAllCallbacks(l);
4173
4212
  }
4174
4213
  removeCallback(t, s, a) {
4175
- U(t, function(l) {
4176
- this._callbacks[l] = ce(this._callbacks[l] || [], function(g) {
4214
+ O(t, function(l) {
4215
+ this._callbacks[l] = le(this._callbacks[l] || [], function(g) {
4177
4216
  return s && s !== g.fn || a && a !== g.context;
4178
4217
  }), this._callbacks[l].length === 0 && delete this._callbacks[l];
4179
4218
  }, this);
4180
4219
  }
4181
4220
  removeAllCallbacks(t) {
4182
- U(t, function(s) {
4221
+ O(t, function(s) {
4183
4222
  delete this._callbacks[s];
4184
4223
  }, this);
4185
4224
  }
@@ -4201,7 +4240,7 @@ function Oa() {
4201
4240
  return this.callbacks.remove(t, s, a), this;
4202
4241
  }
4203
4242
  unbind_global(t) {
4204
- return t ? (this.global_callbacks = ce(this.global_callbacks || [], (s) => s !== t), this) : (this.global_callbacks = [], this);
4243
+ return t ? (this.global_callbacks = le(this.global_callbacks || [], (s) => s !== t), this) : (this.global_callbacks = [], this);
4205
4244
  }
4206
4245
  unbind_all() {
4207
4246
  return this.unbind(), this.unbind_global(), this;
@@ -4219,7 +4258,7 @@ function Oa() {
4219
4258
  }
4220
4259
  class sr extends Te {
4221
4260
  constructor(t, s, a, l, g) {
4222
- super(), this.initialize = $.transportConnectionInitializer, this.hooks = t, this.name = s, this.priority = a, this.key = l, this.options = g, this.state = "new", this.timeline = g.timeline, this.activityTimeout = g.activityTimeout, this.id = this.timeline.generateUniqueID();
4261
+ super(), this.initialize = j.transportConnectionInitializer, this.hooks = t, this.name = s, this.priority = a, this.key = l, this.options = g, this.state = "new", this.timeline = g.timeline, this.activityTimeout = g.activityTimeout, this.id = this.timeline.generateUniqueID();
4223
4262
  }
4224
4263
  handlesActivityChecks() {
4225
4264
  return !!this.hooks.handlesActivityChecks;
@@ -4234,17 +4273,17 @@ function Oa() {
4234
4273
  try {
4235
4274
  this.socket = this.hooks.getSocket(t, this.options);
4236
4275
  } catch (s) {
4237
- return fe.defer(() => {
4276
+ return oe.defer(() => {
4238
4277
  this.onError(s), this.changeState("closed");
4239
4278
  }), !1;
4240
4279
  }
4241
- return this.bindListeners(), ae.debug("Connecting", { transport: this.name, url: t }), this.changeState("connecting"), !0;
4280
+ return this.bindListeners(), ce.debug("Connecting", { transport: this.name, url: t }), this.changeState("connecting"), !0;
4242
4281
  }
4243
4282
  close() {
4244
4283
  return this.socket ? (this.socket.close(), !0) : !1;
4245
4284
  }
4246
4285
  send(t) {
4247
- return this.state === "open" ? (fe.defer(() => {
4286
+ return this.state === "open" ? (oe.defer(() => {
4248
4287
  this.socket && this.socket.send(t);
4249
4288
  }), !0) : !1;
4250
4289
  }
@@ -4293,7 +4332,7 @@ function Oa() {
4293
4332
  })), this.emit(t, s);
4294
4333
  }
4295
4334
  buildTimelineMessage(t) {
4296
- return me({ cid: this.id }, t);
4335
+ return ve({ cid: this.id }, t);
4297
4336
  }
4298
4337
  }
4299
4338
  class De {
@@ -4312,13 +4351,13 @@ function Oa() {
4312
4351
  handlesActivityChecks: !1,
4313
4352
  supportsPing: !1,
4314
4353
  isInitialized: function() {
4315
- return !!$.getWebSocketAPI();
4354
+ return !!j.getWebSocketAPI();
4316
4355
  },
4317
4356
  isSupported: function() {
4318
- return !!$.getWebSocketAPI();
4357
+ return !!j.getWebSocketAPI();
4319
4358
  },
4320
4359
  getSocket: function(i) {
4321
- return $.createWebSocket(i);
4360
+ return j.createWebSocket(i);
4322
4361
  }
4323
4362
  }), on = {
4324
4363
  urls: er,
@@ -4327,19 +4366,19 @@ function Oa() {
4327
4366
  isInitialized: function() {
4328
4367
  return !0;
4329
4368
  }
4330
- }, an = me({
4369
+ }, an = ve({
4331
4370
  getSocket: function(i) {
4332
- return $.HTTPFactory.createStreamingSocket(i);
4371
+ return j.HTTPFactory.createStreamingSocket(i);
4333
4372
  }
4334
- }, on), cn = me({
4373
+ }, on), cn = ve({
4335
4374
  getSocket: function(i) {
4336
- return $.HTTPFactory.createPollingSocket(i);
4375
+ return j.HTTPFactory.createPollingSocket(i);
4337
4376
  }
4338
4377
  }, on), un = {
4339
4378
  isSupported: function() {
4340
- return $.isXHRSupported();
4379
+ return j.isXHRSupported();
4341
4380
  }
4342
- }, ir = new De(me({}, an, un)), or = new De(me({}, cn, un)), ar = {
4381
+ }, ir = new De(ve({}, an, un)), or = new De(ve({}, cn, un)), ar = {
4343
4382
  ws: rr,
4344
4383
  xhr_streaming: ir,
4345
4384
  xhr_polling: or
@@ -4369,10 +4408,10 @@ function Oa() {
4369
4408
  }
4370
4409
  }), ln = {
4371
4410
  isSupported: function(i) {
4372
- var t = $.isXDRSupported(i.useTLS);
4411
+ var t = j.isXDRSupported(i.useTLS);
4373
4412
  return t;
4374
4413
  }
4375
- }, ur = new De(me({}, an, ln)), lr = new De(me({}, cn, ln));
4414
+ }, ur = new De(ve({}, an, ln)), lr = new De(ve({}, cn, ln));
4376
4415
  Ye.xdr_streaming = ur, Ye.xdr_polling = lr, Ye.sockjs = cr;
4377
4416
  var dr = Ye;
4378
4417
  class hr extends Te {
@@ -4395,16 +4434,16 @@ function Oa() {
4395
4434
  this.manager = t, this.transport = s, this.minPingDelay = a.minPingDelay, this.maxPingDelay = a.maxPingDelay, this.pingDelay = void 0;
4396
4435
  }
4397
4436
  createConnection(t, s, a, l) {
4398
- l = me({}, l, {
4437
+ l = ve({}, l, {
4399
4438
  activityTimeout: this.pingDelay
4400
4439
  });
4401
4440
  var g = this.transport.createConnection(t, s, a, l), S = null, x = function() {
4402
- g.unbind("open", x), g.bind("closed", j), S = fe.now();
4403
- }, j = (Q) => {
4404
- if (g.unbind("closed", j), Q.code === 1002 || Q.code === 1003)
4441
+ g.unbind("open", x), g.bind("closed", z), S = oe.now();
4442
+ }, z = (Q) => {
4443
+ if (g.unbind("closed", z), Q.code === 1002 || Q.code === 1003)
4405
4444
  this.manager.reportDeath();
4406
4445
  else if (!Q.wasClean && S) {
4407
- var ee = fe.now() - S;
4446
+ var ee = oe.now() - S;
4408
4447
  ee < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(ee / 2, this.minPingDelay));
4409
4448
  }
4410
4449
  };
@@ -4481,7 +4520,7 @@ function Oa() {
4481
4520
  }
4482
4521
  send_event(t, s, a) {
4483
4522
  var l = { event: t, data: s };
4484
- return a && (l.channel = a), ae.debug("Event sent", l), this.send(Ie.encodeMessage(l));
4523
+ return a && (l.channel = a), ce.debug("Event sent", l), this.send(Ie.encodeMessage(l));
4485
4524
  }
4486
4525
  ping() {
4487
4526
  this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
@@ -4503,7 +4542,7 @@ function Oa() {
4503
4542
  });
4504
4543
  }
4505
4544
  if (l !== void 0) {
4506
- switch (ae.debug("Event recd", l), l.event) {
4545
+ switch (ce.debug("Event recd", l), l.event) {
4507
4546
  case "pusher:error":
4508
4547
  this.emit("error", {
4509
4548
  type: "PusherError",
@@ -4574,7 +4613,7 @@ function Oa() {
4574
4613
  this.transport.unbind("message", this.onMessage), this.transport.unbind("closed", this.onClosed);
4575
4614
  }
4576
4615
  finish(t, s) {
4577
- this.callback(me({ transport: this.transport, action: t }, s));
4616
+ this.callback(ve({ transport: this.transport, action: t }, s));
4578
4617
  }
4579
4618
  }
4580
4619
  class vr {
@@ -4582,13 +4621,13 @@ function Oa() {
4582
4621
  this.timeline = t, this.options = s || {};
4583
4622
  }
4584
4623
  send(t, s) {
4585
- this.timeline.isEmpty() || this.timeline.send($.TimelineTransport.getAgent(this, t), s);
4624
+ this.timeline.isEmpty() || this.timeline.send(j.TimelineTransport.getAgent(this, t), s);
4586
4625
  }
4587
4626
  }
4588
4627
  class vt extends Te {
4589
4628
  constructor(t, s) {
4590
4629
  super(function(a, l) {
4591
- ae.debug("No callbacks on " + t + " for " + a);
4630
+ ce.debug("No callbacks on " + t + " for " + a);
4592
4631
  }), this.name = t, this.pusher = s, this.subscribed = !1, this.subscriptionPending = !1, this.subscriptionCancelled = !1;
4593
4632
  }
4594
4633
  authorize(t, s) {
@@ -4599,7 +4638,7 @@ function Oa() {
4599
4638
  throw new p("Event '" + t + "' does not start with 'client-'");
4600
4639
  if (!this.subscribed) {
4601
4640
  var a = A.buildLogSuffix("triggeringClientEvents");
4602
- ae.warn(`Client event triggered before channel 'subscription_succeeded' event . ${a}`);
4641
+ ce.warn(`Client event triggered before channel 'subscription_succeeded' event . ${a}`);
4603
4642
  }
4604
4643
  return this.pusher.send_event(t, s, this.name);
4605
4644
  }
@@ -4625,7 +4664,7 @@ function Oa() {
4625
4664
  }
4626
4665
  subscribe() {
4627
4666
  this.subscribed || (this.subscriptionPending = !0, this.subscriptionCancelled = !1, this.authorize(this.pusher.connection.socket_id, (t, s) => {
4628
- t ? (this.subscriptionPending = !1, ae.error(t.toString()), this.emit("pusher:subscription_error", Object.assign({}, {
4667
+ t ? (this.subscriptionPending = !1, ce.error(t.toString()), this.emit("pusher:subscription_error", Object.assign({}, {
4629
4668
  type: "AuthError",
4630
4669
  error: t.message
4631
4670
  }, t instanceof k ? { status: t.status } : {}))) : this.pusher.send_event("pusher:subscribe", {
@@ -4697,19 +4736,19 @@ function Oa() {
4697
4736
  function x(ee) {
4698
4737
  try {
4699
4738
  Q(a.next(ee));
4700
- } catch (ue) {
4701
- S(ue);
4739
+ } catch (de) {
4740
+ S(de);
4702
4741
  }
4703
4742
  }
4704
- function j(ee) {
4743
+ function z(ee) {
4705
4744
  try {
4706
4745
  Q(a.throw(ee));
4707
- } catch (ue) {
4708
- S(ue);
4746
+ } catch (de) {
4747
+ S(de);
4709
4748
  }
4710
4749
  }
4711
4750
  function Q(ee) {
4712
- ee.done ? g(ee.value) : l(ee.value).then(x, j);
4751
+ ee.done ? g(ee.value) : l(ee.value).then(x, z);
4713
4752
  }
4714
4753
  Q((a = a.apply(i, t || [])).next());
4715
4754
  });
@@ -4728,7 +4767,7 @@ function Oa() {
4728
4767
  this.members.setMyID(this.pusher.user.user_data.id);
4729
4768
  else {
4730
4769
  let S = A.buildLogSuffix("authorizationEndpoint");
4731
- ae.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${S}, or the user should be signed in.`), s("Invalid auth response");
4770
+ ce.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${S}, or the user should be signed in.`), s("Invalid auth response");
4732
4771
  return;
4733
4772
  }
4734
4773
  s(a, l);
@@ -4801,32 +4840,32 @@ function Oa() {
4801
4840
  }
4802
4841
  handleEncryptedEvent(t, s) {
4803
4842
  if (!this.key) {
4804
- ae.debug("Received encrypted event before key has been retrieved from the authEndpoint");
4843
+ ce.debug("Received encrypted event before key has been retrieved from the authEndpoint");
4805
4844
  return;
4806
4845
  }
4807
4846
  if (!s.ciphertext || !s.nonce) {
4808
- ae.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + s);
4847
+ ce.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + s);
4809
4848
  return;
4810
4849
  }
4811
4850
  let a = Object(yt.decode)(s.ciphertext);
4812
4851
  if (a.length < this.nacl.secretbox.overheadLength) {
4813
- ae.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${a.length}`);
4852
+ ce.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${a.length}`);
4814
4853
  return;
4815
4854
  }
4816
4855
  let l = Object(yt.decode)(s.nonce);
4817
4856
  if (l.length < this.nacl.secretbox.nonceLength) {
4818
- ae.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${l.length}`);
4857
+ ce.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${l.length}`);
4819
4858
  return;
4820
4859
  }
4821
4860
  let g = this.nacl.secretbox.open(a, l, this.key);
4822
4861
  if (g === null) {
4823
- ae.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."), this.authorize(this.pusher.connection.socket_id, (S, x) => {
4862
+ ce.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."), this.authorize(this.pusher.connection.socket_id, (S, x) => {
4824
4863
  if (S) {
4825
- ae.error(`Failed to make a request to the authEndpoint: ${x}. Unable to fetch new key, so dropping encrypted event`);
4864
+ ce.error(`Failed to make a request to the authEndpoint: ${x}. Unable to fetch new key, so dropping encrypted event`);
4826
4865
  return;
4827
4866
  }
4828
4867
  if (g = this.nacl.secretbox.open(a, l, this.key), g === null) {
4829
- ae.error("Failed to decrypt event with new key. Dropping encrypted event");
4868
+ ce.error("Failed to decrypt event with new key. Dropping encrypted event");
4830
4869
  return;
4831
4870
  }
4832
4871
  this.emit(t, this.getDataToEmit(g));
@@ -4847,7 +4886,7 @@ function Oa() {
4847
4886
  class wr extends Te {
4848
4887
  constructor(t, s) {
4849
4888
  super(), this.state = "initialized", this.connection = null, this.key = t, this.options = s, this.timeline = this.options.timeline, this.usingTLS = this.options.useTLS, this.errorCallbacks = this.buildErrorCallbacks(), this.connectionCallbacks = this.buildConnectionCallbacks(this.errorCallbacks), this.handshakeCallbacks = this.buildHandshakeCallbacks(this.errorCallbacks);
4850
- var a = $.getNetwork();
4889
+ var a = j.getNetwork();
4851
4890
  a.bind("online", () => {
4852
4891
  this.timeline.info({ netinfo: "online" }), (this.state === "connecting" || this.state === "unavailable") && this.retryIn(0);
4853
4892
  }), a.bind("offline", () => {
@@ -4901,7 +4940,7 @@ function Oa() {
4901
4940
  });
4902
4941
  }
4903
4942
  retryIn(t) {
4904
- this.timeline.info({ action: "retry", delay: t }), t > 0 && this.emit("connecting_in", Math.round(t / 1e3)), this.retryTimer = new F(t || 0, () => {
4943
+ this.timeline.info({ action: "retry", delay: t }), t > 0 && this.emit("connecting_in", Math.round(t / 1e3)), this.retryTimer = new U(t || 0, () => {
4905
4944
  this.disconnectInternally(), this.connect();
4906
4945
  });
4907
4946
  }
@@ -4909,7 +4948,7 @@ function Oa() {
4909
4948
  this.retryTimer && (this.retryTimer.ensureAborted(), this.retryTimer = null);
4910
4949
  }
4911
4950
  setUnavailableTimer() {
4912
- this.unavailableTimer = new F(this.options.unavailableTimeout, () => {
4951
+ this.unavailableTimer = new U(this.options.unavailableTimeout, () => {
4913
4952
  this.updateState("unavailable");
4914
4953
  });
4915
4954
  }
@@ -4917,12 +4956,12 @@ function Oa() {
4917
4956
  this.unavailableTimer && this.unavailableTimer.ensureAborted();
4918
4957
  }
4919
4958
  sendActivityCheck() {
4920
- this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new F(this.options.pongTimeout, () => {
4959
+ this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new U(this.options.pongTimeout, () => {
4921
4960
  this.timeline.error({ pong_timed_out: this.options.pongTimeout }), this.retryIn(0);
4922
4961
  });
4923
4962
  }
4924
4963
  resetActivityCheck() {
4925
- this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new F(this.activityTimeout, () => {
4964
+ this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new U(this.activityTimeout, () => {
4926
4965
  this.sendActivityCheck();
4927
4966
  }));
4928
4967
  }
@@ -4930,7 +4969,7 @@ function Oa() {
4930
4969
  this.activityTimer && this.activityTimer.ensureAborted();
4931
4970
  }
4932
4971
  buildConnectionCallbacks(t) {
4933
- return me({}, t, {
4972
+ return ve({}, t, {
4934
4973
  message: (s) => {
4935
4974
  this.resetActivityCheck(), this.emit("message", s);
4936
4975
  },
@@ -4949,7 +4988,7 @@ function Oa() {
4949
4988
  });
4950
4989
  }
4951
4990
  buildHandshakeCallbacks(t) {
4952
- return me({}, t, {
4991
+ return ve({}, t, {
4953
4992
  connected: (s) => {
4954
4993
  this.activityTimeout = Math.min(this.options.activityTimeout, s.activityTimeout, s.connection.activityTimeout || 1 / 0), this.clearUnavailableTimer(), this.setConnection(s.connection), this.socket_id = this.connection.id, this.updateState("connected", { socket_id: this.socket_id });
4955
4994
  }
@@ -4993,7 +5032,7 @@ function Oa() {
4993
5032
  var a = this.state;
4994
5033
  if (this.state = t, a !== t) {
4995
5034
  var l = t;
4996
- l === "connected" && (l += " with new socket ID " + s.socket_id), ae.debug("State changed", a + " -> " + l), this.timeline.info({ state: t, params: s }), this.emit("state_change", { previous: a, current: t }), this.emit(t, s);
5035
+ l === "connected" && (l += " with new socket ID " + s.socket_id), ce.debug("State changed", a + " -> " + l), this.timeline.info({ state: t, params: s }), this.emit("state_change", { previous: a, current: t }), this.emit(t, s);
4997
5036
  }
4998
5037
  }
4999
5038
  shouldRetry() {
@@ -5008,7 +5047,7 @@ function Oa() {
5008
5047
  return this.channels[t] || (this.channels[t] = Er(t, s)), this.channels[t];
5009
5048
  }
5010
5049
  all() {
5011
- return N(this.channels);
5050
+ return D(this.channels);
5012
5051
  }
5013
5052
  find(t) {
5014
5053
  return this.channels[t];
@@ -5090,27 +5129,27 @@ function Oa() {
5090
5129
  this.strategies = t, this.loop = !!s.loop, this.failFast = !!s.failFast, this.timeout = s.timeout, this.timeoutLimit = s.timeoutLimit;
5091
5130
  }
5092
5131
  isSupported() {
5093
- return we(this.strategies, fe.method("isSupported"));
5132
+ return we(this.strategies, oe.method("isSupported"));
5094
5133
  }
5095
5134
  connect(t, s) {
5096
- var a = this.strategies, l = 0, g = this.timeout, S = null, x = (j, Q) => {
5135
+ var a = this.strategies, l = 0, g = this.timeout, S = null, x = (z, Q) => {
5097
5136
  Q ? s(null, Q) : (l = l + 1, this.loop && (l = l % a.length), l < a.length ? (g && (g = g * 2, this.timeoutLimit && (g = Math.min(g, this.timeoutLimit))), S = this.tryStrategy(a[l], t, { timeout: g, failFast: this.failFast }, x)) : s(!0));
5098
5137
  };
5099
5138
  return S = this.tryStrategy(a[l], t, { timeout: g, failFast: this.failFast }, x), {
5100
5139
  abort: function() {
5101
5140
  S.abort();
5102
5141
  },
5103
- forceMinPriority: function(j) {
5104
- t = j, S && S.forceMinPriority(j);
5142
+ forceMinPriority: function(z) {
5143
+ t = z, S && S.forceMinPriority(z);
5105
5144
  }
5106
5145
  };
5107
5146
  }
5108
5147
  tryStrategy(t, s, a, l) {
5109
5148
  var g = null, S = null;
5110
- return a.timeout > 0 && (g = new F(a.timeout, function() {
5149
+ return a.timeout > 0 && (g = new U(a.timeout, function() {
5111
5150
  S.abort(), l(!0);
5112
- })), S = t.connect(s, function(x, j) {
5113
- x && g && g.isRunning() && !a.failFast || (g && g.ensureAborted(), l(x, j));
5151
+ })), S = t.connect(s, function(x, z) {
5152
+ x && g && g.isRunning() && !a.failFast || (g && g.ensureAborted(), l(x, z));
5114
5153
  }), {
5115
5154
  abort: function() {
5116
5155
  g && g.ensureAborted(), S.abort();
@@ -5126,7 +5165,7 @@ function Oa() {
5126
5165
  this.strategies = t;
5127
5166
  }
5128
5167
  isSupported() {
5129
- return we(this.strategies, fe.method("isSupported"));
5168
+ return we(this.strategies, oe.method("isSupported"));
5130
5169
  }
5131
5170
  connect(t, s) {
5132
5171
  return Rr(this.strategies, t, function(a, l) {
@@ -5135,7 +5174,7 @@ function Oa() {
5135
5174
  Pr(l) && s(!0);
5136
5175
  return;
5137
5176
  }
5138
- U(l, function(x) {
5177
+ O(l, function(x) {
5139
5178
  x.forceMinPriority(S.transport.priority);
5140
5179
  }), s(null, S);
5141
5180
  };
@@ -5143,22 +5182,22 @@ function Oa() {
5143
5182
  }
5144
5183
  }
5145
5184
  function Rr(i, t, s) {
5146
- var a = ne(i, function(l, g, S, x) {
5185
+ var a = se(i, function(l, g, S, x) {
5147
5186
  return l.connect(t, s(g, x));
5148
5187
  });
5149
5188
  return {
5150
5189
  abort: function() {
5151
- U(a, Mr);
5190
+ O(a, Mr);
5152
5191
  },
5153
5192
  forceMinPriority: function(l) {
5154
- U(a, function(g) {
5193
+ O(a, function(g) {
5155
5194
  g.forceMinPriority(l);
5156
5195
  });
5157
5196
  }
5158
5197
  };
5159
5198
  }
5160
5199
  function Pr(i) {
5161
- return pe(i, function(t) {
5200
+ return ge(i, function(t) {
5162
5201
  return !!t.error;
5163
5202
  });
5164
5203
  }
@@ -5174,7 +5213,7 @@ function Oa() {
5174
5213
  }
5175
5214
  connect(t, s) {
5176
5215
  var a = this.usingTLS, l = xr(a), g = l && l.cacheSkipCount ? l.cacheSkipCount : 0, S = [this.strategy];
5177
- if (l && l.timestamp + this.ttl >= fe.now()) {
5216
+ if (l && l.timestamp + this.ttl >= oe.now()) {
5178
5217
  var x = this.transports[l.transport];
5179
5218
  x && (["ws", "wss"].includes(l.transport) || g > 3 ? (this.timeline.info({
5180
5219
  cached: !0,
@@ -5185,8 +5224,8 @@ function Oa() {
5185
5224
  failFast: !0
5186
5225
  }))) : g++);
5187
5226
  }
5188
- var j = fe.now(), Q = S.pop().connect(t, function ee(ue, tt) {
5189
- ue ? (fn(a), S.length > 0 ? (j = fe.now(), Q = S.pop().connect(t, ee)) : s(ue)) : (Lr(a, tt.transport.name, fe.now() - j, g), s(null, tt));
5227
+ var z = oe.now(), Q = S.pop().connect(t, function ee(de, tt) {
5228
+ de ? (fn(a), S.length > 0 ? (z = oe.now(), Q = S.pop().connect(t, ee)) : s(de)) : (Lr(a, tt.transport.name, oe.now() - z, g), s(null, tt));
5190
5229
  });
5191
5230
  return {
5192
5231
  abort: function() {
@@ -5202,7 +5241,7 @@ function Oa() {
5202
5241
  return "pusherTransport" + (i ? "TLS" : "NonTLS");
5203
5242
  }
5204
5243
  function xr(i) {
5205
- var t = $.getLocalStorage();
5244
+ var t = j.getLocalStorage();
5206
5245
  if (t)
5207
5246
  try {
5208
5247
  var s = t[St(i)];
@@ -5214,11 +5253,11 @@ function Oa() {
5214
5253
  return null;
5215
5254
  }
5216
5255
  function Lr(i, t, s, a) {
5217
- var l = $.getLocalStorage();
5256
+ var l = j.getLocalStorage();
5218
5257
  if (l)
5219
5258
  try {
5220
5259
  l[St(i)] = Qe({
5221
- timestamp: fe.now(),
5260
+ timestamp: oe.now(),
5222
5261
  transport: t,
5223
5262
  latency: s,
5224
5263
  cacheSkipCount: a
@@ -5227,7 +5266,7 @@ function Oa() {
5227
5266
  }
5228
5267
  }
5229
5268
  function fn(i) {
5230
- var t = $.getLocalStorage();
5269
+ var t = j.getLocalStorage();
5231
5270
  if (t)
5232
5271
  try {
5233
5272
  delete t[St(i)];
@@ -5242,7 +5281,7 @@ function Oa() {
5242
5281
  return this.strategy.isSupported();
5243
5282
  }
5244
5283
  connect(t, s) {
5245
- var a = this.strategy, l, g = new F(this.options.delay, function() {
5284
+ var a = this.strategy, l, g = new U(this.options.delay, function() {
5246
5285
  l = a.connect(t, s);
5247
5286
  });
5248
5287
  return {
@@ -5303,7 +5342,7 @@ function Oa() {
5303
5342
  hostNonTLS: i.httpHost + ":" + i.httpPort,
5304
5343
  hostTLS: i.httpHost + ":" + i.httpsPort,
5305
5344
  httpPath: i.httpPath
5306
- }), j = {
5345
+ }), z = {
5307
5346
  loop: !0,
5308
5347
  timeout: 15e3,
5309
5348
  timeoutLimit: 6e4
@@ -5314,16 +5353,16 @@ function Oa() {
5314
5353
  lives: 2,
5315
5354
  minPingDelay: 1e4,
5316
5355
  maxPingDelay: i.activityTimeout
5317
- }), ue = l("ws", "ws", 3, g, Q), tt = l("wss", "ws", 3, S, Q), Pi = l("sockjs", "sockjs", 1, x), bn = l("xhr_streaming", "xhr_streaming", 1, x, ee), Mi = l("xdr_streaming", "xdr_streaming", 1, x, ee), yn = l("xhr_polling", "xhr_polling", 1, x), ki = l("xdr_polling", "xdr_polling", 1, x), _n = new Ue([ue], j), xi = new Ue([tt], j), Li = new Ue([Pi], j), Sn = new Ue([
5356
+ }), de = l("ws", "ws", 3, g, Q), tt = l("wss", "ws", 3, S, Q), Pi = l("sockjs", "sockjs", 1, x), bn = l("xhr_streaming", "xhr_streaming", 1, x, ee), Mi = l("xdr_streaming", "xdr_streaming", 1, x, ee), yn = l("xhr_polling", "xhr_polling", 1, x), ki = l("xdr_polling", "xdr_polling", 1, x), _n = new Ue([de], z), xi = new Ue([tt], z), Li = new Ue([Pi], z), Sn = new Ue([
5318
5357
  new ze(je(bn), bn, Mi)
5319
- ], j), Cn = new Ue([
5358
+ ], z), Cn = new Ue([
5320
5359
  new ze(je(yn), yn, ki)
5321
- ], j), wn = new Ue([
5360
+ ], z), wn = new Ue([
5322
5361
  new ze(je(Sn), new _t([
5323
5362
  Sn,
5324
5363
  new Ze(Cn, { delay: 4e3 })
5325
5364
  ]), Cn)
5326
- ], j), Et = new ze(je(wn), wn, Li), At;
5365
+ ], z), Et = new ze(je(wn), wn, Li), At;
5327
5366
  return t.useTLS ? At = new _t([
5328
5367
  _n,
5329
5368
  new Ze(Et, { delay: 2e3 })
@@ -5331,7 +5370,7 @@ function Oa() {
5331
5370
  _n,
5332
5371
  new Ze(xi, { delay: 2e3 }),
5333
5372
  new Ze(Et, { delay: 5e3 })
5334
- ]), new kr(new Ir(new ze(je(ue), At, Et)), a, {
5373
+ ]), new kr(new Ir(new ze(je(de), At, Et)), a, {
5335
5374
  ttl: 18e5,
5336
5375
  timeline: t.timeline,
5337
5376
  useTLS: t.useTLS
@@ -5368,10 +5407,10 @@ function Oa() {
5368
5407
  start(t) {
5369
5408
  this.position = 0, this.xhr = this.hooks.getRequest(this), this.unloader = () => {
5370
5409
  this.close();
5371
- }, $.addUnloadListener(this.unloader), this.xhr.open(this.method, this.url, !0), this.xhr.setRequestHeader && this.xhr.setRequestHeader("Content-Type", "application/json"), this.xhr.send(t);
5410
+ }, j.addUnloadListener(this.unloader), this.xhr.open(this.method, this.url, !0), this.xhr.setRequestHeader && this.xhr.setRequestHeader("Content-Type", "application/json"), this.xhr.send(t);
5372
5411
  }
5373
5412
  close() {
5374
- this.unloader && ($.removeUnloadListener(this.unloader), this.unloader = null), this.xhr && (this.hooks.abortRequest(this.xhr), this.xhr = null);
5413
+ this.unloader && (j.removeUnloadListener(this.unloader), this.unloader = null), this.xhr && (this.hooks.abortRequest(this.xhr), this.xhr = null);
5375
5414
  }
5376
5415
  onChunk(t, s) {
5377
5416
  for (; ; ) {
@@ -5413,7 +5452,7 @@ function Oa() {
5413
5452
  sendRaw(t) {
5414
5453
  if (this.readyState === Oe.OPEN)
5415
5454
  try {
5416
- return $.createSocketRequest("POST", pn(Br(this.location, this.session))).start(t), !0;
5455
+ return j.createSocketRequest("POST", pn(Br(this.location, this.session))).start(t), !0;
5417
5456
  } catch {
5418
5457
  return !1;
5419
5458
  }
@@ -5468,7 +5507,7 @@ function Oa() {
5468
5507
  this.onerror && this.onerror(t);
5469
5508
  }
5470
5509
  openStream() {
5471
- this.stream = $.createSocketRequest("POST", pn(this.hooks.getReceiveURL(this.location, this.session))), this.stream.bind("chunk", (t) => {
5510
+ this.stream = j.createSocketRequest("POST", pn(this.hooks.getReceiveURL(this.location, this.session))), this.stream.bind("chunk", (t) => {
5472
5511
  this.onChunk(t);
5473
5512
  }), this.stream.bind("finished", (t) => {
5474
5513
  this.hooks.onFinished(this, t);
@@ -5478,7 +5517,7 @@ function Oa() {
5478
5517
  try {
5479
5518
  this.stream.start();
5480
5519
  } catch (t) {
5481
- fe.defer(() => {
5520
+ oe.defer(() => {
5482
5521
  this.onError(t), this.onClose(1006, "Could not start streaming", !1);
5483
5522
  });
5484
5523
  }
@@ -5506,7 +5545,7 @@ function Oa() {
5506
5545
  return s[1] + t + s[3];
5507
5546
  }
5508
5547
  function gn(i) {
5509
- return $.randomInt(i);
5548
+ return j.randomInt(i);
5510
5549
  }
5511
5550
  function Xr(i) {
5512
5551
  for (var t = [], s = 0; s < i; s++)
@@ -5540,7 +5579,7 @@ function Oa() {
5540
5579
  }
5541
5580
  }, Qr = Kr, Yr = {
5542
5581
  getRequest: function(i) {
5543
- var t = $.getXHRAPI(), s = new t();
5582
+ var t = j.getXHRAPI(), s = new t();
5544
5583
  return s.onreadystatechange = s.onprogress = function() {
5545
5584
  switch (s.readyState) {
5546
5585
  case 3:
@@ -5605,7 +5644,7 @@ function Oa() {
5605
5644
  return this.getDocument().location.protocol;
5606
5645
  },
5607
5646
  getAuthorizers() {
5608
- return { ajax: K, jsonp: Ws };
5647
+ return { ajax: V, jsonp: Ws };
5609
5648
  },
5610
5649
  onDocumentBody(i) {
5611
5650
  document.body ? i() : setTimeout(() => {
@@ -5668,7 +5707,7 @@ function Oa() {
5668
5707
  return (window.crypto || window.msCrypto).getRandomValues(new Uint32Array(1))[0] / Math.pow(2, 32);
5669
5708
  }() * i);
5670
5709
  }
5671
- }, $ = ni, wt;
5710
+ }, j = ni, wt;
5672
5711
  (function(i) {
5673
5712
  i[i.ERROR = 3] = "ERROR", i[i.INFO = 6] = "INFO", i[i.DEBUG = 7] = "DEBUG";
5674
5713
  })(wt || (wt = {}));
@@ -5678,7 +5717,7 @@ function Oa() {
5678
5717
  this.key = t, this.session = s, this.events = [], this.options = a || {}, this.sent = 0, this.uniqueID = 0;
5679
5718
  }
5680
5719
  log(t, s) {
5681
- t <= this.options.level && (this.events.push(me({}, s, { timestamp: fe.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
5720
+ t <= this.options.level && (this.events.push(ve({}, s, { timestamp: oe.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
5682
5721
  }
5683
5722
  error(t) {
5684
5723
  this.log(et.ERROR, t);
@@ -5693,7 +5732,7 @@ function Oa() {
5693
5732
  return this.events.length === 0;
5694
5733
  }
5695
5734
  send(t, s) {
5696
- var a = me({
5735
+ var a = ve({
5697
5736
  session: this.session,
5698
5737
  bundle: this.sent + 1,
5699
5738
  key: this.key,
@@ -5723,35 +5762,35 @@ function Oa() {
5723
5762
  connect(t, s) {
5724
5763
  if (this.isSupported()) {
5725
5764
  if (this.priority < t)
5726
- return vn(new O(), s);
5765
+ return vn(new F(), s);
5727
5766
  } else return vn(new te(), s);
5728
5767
  var a = !1, l = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), g = null, S = function() {
5729
5768
  l.unbind("initialized", S), l.connect();
5730
5769
  }, x = function() {
5731
- g = Ee.createHandshake(l, function(ue) {
5732
- a = !0, ee(), s(null, ue);
5770
+ g = Ee.createHandshake(l, function(de) {
5771
+ a = !0, ee(), s(null, de);
5733
5772
  });
5734
- }, j = function(ue) {
5735
- ee(), s(ue);
5773
+ }, z = function(de) {
5774
+ ee(), s(de);
5736
5775
  }, Q = function() {
5737
5776
  ee();
5738
- var ue;
5739
- ue = Qe(l), s(new z(ue));
5777
+ var de;
5778
+ de = Qe(l), s(new q(de));
5740
5779
  }, ee = function() {
5741
- l.unbind("initialized", S), l.unbind("open", x), l.unbind("error", j), l.unbind("closed", Q);
5780
+ l.unbind("initialized", S), l.unbind("open", x), l.unbind("error", z), l.unbind("closed", Q);
5742
5781
  };
5743
- return l.bind("initialized", S), l.bind("open", x), l.bind("error", j), l.bind("closed", Q), l.initialize(), {
5782
+ return l.bind("initialized", S), l.bind("open", x), l.bind("error", z), l.bind("closed", Q), l.initialize(), {
5744
5783
  abort: () => {
5745
5784
  a || (ee(), g ? g.close() : l.close());
5746
5785
  },
5747
- forceMinPriority: (ue) => {
5748
- a || this.priority < ue && (g ? g.close() : l.close());
5786
+ forceMinPriority: (de) => {
5787
+ a || this.priority < de && (g ? g.close() : l.close());
5749
5788
  }
5750
5789
  };
5751
5790
  }
5752
5791
  }
5753
5792
  function vn(i, t) {
5754
- return fe.defer(function() {
5793
+ return oe.defer(function() {
5755
5794
  t(i);
5756
5795
  }), {
5757
5796
  abort: function() {
@@ -5760,19 +5799,19 @@ function Oa() {
5760
5799
  }
5761
5800
  };
5762
5801
  }
5763
- const { Transports: ii } = $;
5802
+ const { Transports: ii } = j;
5764
5803
  var oi = function(i, t, s, a, l, g) {
5765
5804
  var S = ii[s];
5766
5805
  if (!S)
5767
- throw new W(s);
5768
- var x = (!i.enabledTransports || ft(i.enabledTransports, t) !== -1) && (!i.disabledTransports || ft(i.disabledTransports, t) === -1), j;
5769
- return x ? (l = Object.assign({ ignoreNullOrigin: i.ignoreNullOrigin }, l), j = new ri(t, a, g ? g.getAssistant(S) : S, l)) : j = ai, j;
5806
+ throw new G(s);
5807
+ var x = (!i.enabledTransports || ft(i.enabledTransports, t) !== -1) && (!i.disabledTransports || ft(i.disabledTransports, t) === -1), z;
5808
+ return x ? (l = Object.assign({ ignoreNullOrigin: i.ignoreNullOrigin }, l), z = new ri(t, a, g ? g.getAssistant(S) : S, l)) : z = ai, z;
5770
5809
  }, ai = {
5771
5810
  isSupported: function() {
5772
5811
  return !1;
5773
5812
  },
5774
5813
  connect: function(i, t) {
5775
- var s = fe.defer(function() {
5814
+ var s = oe.defer(function() {
5776
5815
  t(new te());
5777
5816
  });
5778
5817
  return {
@@ -5789,7 +5828,7 @@ function Oa() {
5789
5828
  throw "You must pass an options object";
5790
5829
  if (i.cluster == null)
5791
5830
  throw "Options object must provide a cluster";
5792
- "disableStats" in i && ae.warn("The disableStats option is deprecated in favor of enableStats");
5831
+ "disableStats" in i && ce.warn("The disableStats option is deprecated in favor of enableStats");
5793
5832
  }
5794
5833
  const ui = (i, t) => {
5795
5834
  var s = "socket_id=" + encodeURIComponent(i.socketId);
@@ -5803,11 +5842,11 @@ function Oa() {
5803
5842
  return s;
5804
5843
  };
5805
5844
  var li = (i) => {
5806
- if (typeof $.getAuthorizers()[i.transport] > "u")
5845
+ if (typeof j.getAuthorizers()[i.transport] > "u")
5807
5846
  throw `'${i.transport}' is not a recognized auth transport`;
5808
5847
  return (t, s) => {
5809
5848
  const a = ui(t, i);
5810
- $.getAuthorizers()[i.transport]($, a, i, w.UserAuthentication, s);
5849
+ j.getAuthorizers()[i.transport](j, a, i, w.UserAuthentication, s);
5811
5850
  };
5812
5851
  };
5813
5852
  const di = (i, t) => {
@@ -5823,11 +5862,11 @@ function Oa() {
5823
5862
  return s;
5824
5863
  };
5825
5864
  var hi = (i) => {
5826
- if (typeof $.getAuthorizers()[i.transport] > "u")
5865
+ if (typeof j.getAuthorizers()[i.transport] > "u")
5827
5866
  throw `'${i.transport}' is not a recognized auth transport`;
5828
5867
  return (t, s) => {
5829
5868
  const a = di(t, i);
5830
- $.getAuthorizers()[i.transport]($, a, i, w.ChannelAuthorization, s);
5869
+ j.getAuthorizers()[i.transport](j, a, i, w.ChannelAuthorization, s);
5831
5870
  };
5832
5871
  };
5833
5872
  const fi = (i, t, s) => {
@@ -5876,7 +5915,7 @@ function Oa() {
5876
5915
  return `ws-${i}.pusher.com`;
5877
5916
  }
5878
5917
  function bi(i) {
5879
- return $.getProtocol() === "https:" ? !0 : i.forceTLS !== !1;
5918
+ return j.getProtocol() === "https:" ? !0 : i.forceTLS !== !1;
5880
5919
  }
5881
5920
  function yi(i) {
5882
5921
  return "enableStats" in i ? i.enableStats : "disableStats" in i ? !i.disableStats : !1;
@@ -5899,7 +5938,7 @@ function Oa() {
5899
5938
  class wi extends Te {
5900
5939
  constructor(t) {
5901
5940
  super(function(s, a) {
5902
- ae.debug(`No callbacks on watchlist events for ${s}`);
5941
+ ce.debug(`No callbacks on watchlist events for ${s}`);
5903
5942
  }), this.pusher = t, this.bindWatchlistInternalEvent();
5904
5943
  }
5905
5944
  handleEvent(t) {
@@ -5924,10 +5963,10 @@ function Oa() {
5924
5963
  class Ai extends Te {
5925
5964
  constructor(t) {
5926
5965
  super(function(s, a) {
5927
- ae.debug("No callbacks on user for " + s);
5966
+ ce.debug("No callbacks on user for " + s);
5928
5967
  }), this.signin_requested = !1, this.user_data = null, this.serverToUserChannel = null, this.signinDonePromise = null, this._signinDoneResolve = null, this._onAuthorize = (s, a) => {
5929
5968
  if (s) {
5930
- ae.warn(`Error during signin: ${s}`), this._cleanup();
5969
+ ce.warn(`Error during signin: ${s}`), this._cleanup();
5931
5970
  return;
5932
5971
  }
5933
5972
  this.pusher.send_event("pusher:signin", {
@@ -5953,11 +5992,11 @@ function Oa() {
5953
5992
  try {
5954
5993
  this.user_data = JSON.parse(t.user_data);
5955
5994
  } catch {
5956
- ae.error(`Failed parsing user data after signin: ${t.user_data}`), this._cleanup();
5995
+ ce.error(`Failed parsing user data after signin: ${t.user_data}`), this._cleanup();
5957
5996
  return;
5958
5997
  }
5959
5998
  if (typeof this.user_data.id != "string" || this.user_data.id === "") {
5960
- ae.error(`user_data doesn't contain an id. user_data: ${this.user_data}`), this._cleanup();
5999
+ ce.error(`user_data doesn't contain an id. user_data: ${this.user_data}`), this._cleanup();
5961
6000
  return;
5962
6001
  }
5963
6002
  this._signinDoneResolve(), this._subscribeChannels();
@@ -5984,30 +6023,30 @@ function Oa() {
5984
6023
  t.then(a).catch(a), this.signinDonePromise = t, this._signinDoneResolve = s;
5985
6024
  }
5986
6025
  }
5987
- class ge {
6026
+ class me {
5988
6027
  static ready() {
5989
- ge.isReady = !0;
5990
- for (var t = 0, s = ge.instances.length; t < s; t++)
5991
- ge.instances[t].connect();
6028
+ me.isReady = !0;
6029
+ for (var t = 0, s = me.instances.length; t < s; t++)
6030
+ me.instances[t].connect();
5992
6031
  }
5993
6032
  static getClientFeatures() {
5994
- return R(Re({ ws: $.Transports.ws }, function(t) {
6033
+ return P(Re({ ws: j.Transports.ws }, function(t) {
5995
6034
  return t.isSupported({});
5996
6035
  }));
5997
6036
  }
5998
6037
  constructor(t, s) {
5999
- Ri(t), ci(s), this.key = t, this.config = pi(s, this), this.channels = Ee.createChannels(), this.global_emitter = new Te(), this.sessionID = $.randomInt(1e9), this.timeline = new si(this.key, this.sessionID, {
6038
+ Ri(t), ci(s), this.key = t, this.config = pi(s, this), this.channels = Ee.createChannels(), this.global_emitter = new Te(), this.sessionID = j.randomInt(1e9), this.timeline = new si(this.key, this.sessionID, {
6000
6039
  cluster: this.config.cluster,
6001
- features: ge.getClientFeatures(),
6040
+ features: me.getClientFeatures(),
6002
6041
  params: this.config.timelineParams || {},
6003
6042
  limit: 50,
6004
6043
  level: et.INFO,
6005
6044
  version: h.VERSION
6006
6045
  }), this.config.enableStats && (this.timelineSender = Ee.createTimelineSender(this.timeline, {
6007
6046
  host: this.config.statsHost,
6008
- path: "/timeline/v2/" + $.TimelineTransport.name
6047
+ path: "/timeline/v2/" + j.TimelineTransport.name
6009
6048
  }));
6010
- var a = (l) => $.getDefaultStrategy(this.config, l, oi);
6049
+ var a = (l) => j.getDefaultStrategy(this.config, l, oi);
6011
6050
  this.connection = Ee.createConnectionManager(this.key, {
6012
6051
  getStrategy: a,
6013
6052
  timeline: this.timeline,
@@ -6029,8 +6068,8 @@ function Oa() {
6029
6068
  }), this.connection.bind("disconnected", () => {
6030
6069
  this.channels.disconnect();
6031
6070
  }), this.connection.bind("error", (l) => {
6032
- ae.warn(l);
6033
- }), ge.instances.push(this), this.timeline.info({ instances: ge.instances.length }), this.user = new Ai(this), ge.isReady && this.connect();
6071
+ ce.warn(l);
6072
+ }), me.instances.push(this), this.timeline.info({ instances: me.instances.length }), this.user = new Ai(this), me.isReady && this.connect();
6034
6073
  }
6035
6074
  channel(t) {
6036
6075
  return this.channels.find(t);
@@ -6041,7 +6080,7 @@ function Oa() {
6041
6080
  connect() {
6042
6081
  if (this.connection.connect(), this.timelineSender && !this.timelineSenderTimer) {
6043
6082
  var t = this.connection.isUsingTLS(), s = this.timelineSender;
6044
- this.timelineSenderTimer = new Z(6e4, function() {
6083
+ this.timelineSenderTimer = new ne(6e4, function() {
6045
6084
  s.send(t);
6046
6085
  });
6047
6086
  }
@@ -6087,13 +6126,13 @@ function Oa() {
6087
6126
  this.user.signin();
6088
6127
  }
6089
6128
  }
6090
- ge.instances = [], ge.isReady = !1, ge.logToConsole = !1, ge.Runtime = $, ge.ScriptReceivers = $.ScriptReceivers, ge.DependenciesReceivers = $.DependenciesReceivers, ge.auth_callbacks = $.auth_callbacks;
6091
- var Tt = o.default = ge;
6129
+ me.instances = [], me.isReady = !1, me.logToConsole = !1, me.Runtime = j, me.ScriptReceivers = j.ScriptReceivers, me.DependenciesReceivers = j.DependenciesReceivers, me.auth_callbacks = j.auth_callbacks;
6130
+ var Tt = o.default = me;
6092
6131
  function Ri(i) {
6093
6132
  if (i == null)
6094
6133
  throw "You must pass your app key when you instantiate Pusher.";
6095
6134
  }
6096
- $.setup(ge);
6135
+ j.setup(me);
6097
6136
  })
6098
6137
  /******/
6099
6138
  ])
@@ -6103,10 +6142,10 @@ function Oa() {
6103
6142
  }
6104
6143
  var Fa = Oa();
6105
6144
  const Da = /* @__PURE__ */ Ua(Fa), Na = "/v1/messenger/bootstrap", qa = 3e4, za = 3e4, ja = 5 * 6e4;
6106
- function re(e) {
6145
+ function ie(e) {
6107
6146
  return typeof e == "object" && e !== null;
6108
6147
  }
6109
- function de(e, n) {
6148
+ function pe(e, n) {
6110
6149
  return typeof e[n] == "string";
6111
6150
  }
6112
6151
  function Ce(e, n) {
@@ -6143,14 +6182,14 @@ function Ba(e) {
6143
6182
  return e.startsWith("/") ? e : `/${e}`;
6144
6183
  }
6145
6184
  function Va(e) {
6146
- const n = re(e) && re(e.data) ? e.data : e;
6147
- if (!re(n))
6185
+ const n = ie(e) && ie(e.data) ? e.data : e;
6186
+ if (!ie(n))
6148
6187
  throw new Error("Invalid messenger bootstrap payload: expected object");
6149
6188
  const r = n.auth, o = n.service;
6150
- if (!re(r) || !re(o))
6189
+ if (!ie(r) || !ie(o))
6151
6190
  throw new Error("Invalid messenger bootstrap payload: missing auth or service data");
6152
6191
  const c = r.user, u = o.reverb;
6153
- if (!re(c) || !re(u))
6192
+ if (!ie(c) || !ie(u))
6154
6193
  throw new Error("Invalid messenger bootstrap payload: missing user or reverb data");
6155
6194
  const d = Ba(Ve(u, "path"));
6156
6195
  return {
@@ -6185,9 +6224,9 @@ function Xa(e) {
6185
6224
  return e.replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/:\d+$/, "");
6186
6225
  }
6187
6226
  function Wa(e) {
6188
- if (!re(e))
6227
+ if (!ie(e))
6189
6228
  return !1;
6190
- const n = re(e.response) ? e.response : null;
6229
+ const n = ie(e.response) ? e.response : null;
6191
6230
  if (n?.status !== 403)
6192
6231
  return !1;
6193
6232
  const r = n.data;
@@ -6198,7 +6237,7 @@ function Kn(e, n) {
6198
6237
  e.headers.set("Authorization", `Bearer ${n}`), e.headers.set("Accept", "application/json"), e.headers.set("X-Requested-With", "XMLHttpRequest"), typeof FormData < "u" && e.data instanceof FormData && (e.headers.delete("Content-Type"), e.headers.delete("content-type"));
6199
6238
  return;
6200
6239
  }
6201
- const r = re(e.headers) ? e.headers : {};
6240
+ const r = ie(e.headers) ? e.headers : {};
6202
6241
  e.headers = new An({
6203
6242
  ...r,
6204
6243
  Authorization: `Bearer ${n}`,
@@ -6220,7 +6259,7 @@ function Ga(e) {
6220
6259
  return n === "online" || n === "idle" || n === "dnd" || n === "offline" ? n : null;
6221
6260
  }
6222
6261
  function Ja(e, n) {
6223
- if (!re(e))
6262
+ if (!ie(e))
6224
6263
  return null;
6225
6264
  const r = Ge(e, "user_id", "userId"), o = Ga(e.status);
6226
6265
  if (!r || !o)
@@ -6236,12 +6275,12 @@ function Ja(e, n) {
6236
6275
  return typeof d == "string" ? c.last_seen_at = d : d === null && (c.last_seen_at = null), c;
6237
6276
  }
6238
6277
  function Qn(e) {
6239
- if (!re(e))
6278
+ if (!ie(e))
6240
6279
  return null;
6241
6280
  const n = Ge(e, "user_id", "userId"), r = Ge(e, "conversation_id", "conversationId");
6242
6281
  if (!n || !r)
6243
6282
  return null;
6244
- const o = e.user, c = re(o) ? {
6283
+ const o = e.user, c = ie(o) ? {
6245
6284
  id: typeof o.id == "string" && o.id !== "" ? o.id : n,
6246
6285
  name: typeof o.name == "string" ? o.name : "",
6247
6286
  ...typeof o.avatar == "string" && o.avatar !== "" ? { avatar: o.avatar } : {}
@@ -6257,31 +6296,31 @@ function Qn(e) {
6257
6296
  };
6258
6297
  }
6259
6298
  function Ka(e) {
6260
- return re(e) && de(e, "id") && de(e, "name");
6299
+ return ie(e) && pe(e, "id") && pe(e, "name");
6261
6300
  }
6262
6301
  function Qa(e) {
6263
- return !re(e) || !de(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => Ka(n));
6302
+ return !ie(e) || !pe(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => Ka(n));
6264
6303
  }
6265
6304
  function Yn(e) {
6266
- return re(e) && re(e.message) && de(e.message, "id") && de(e.message, "conversation_id") && de(e.message, "author_id");
6305
+ return ie(e) && ie(e.message) && pe(e.message, "id") && pe(e.message, "conversation_id") && pe(e.message, "author_id");
6267
6306
  }
6268
6307
  function Zn(e) {
6269
- return re(e) && de(e, "conversation_id") && de(e, "user_id") && de(e, "message_id");
6308
+ return ie(e) && pe(e, "conversation_id") && pe(e, "user_id") && pe(e, "message_id");
6270
6309
  }
6271
6310
  function es(e) {
6272
- return re(e) && de(e, "conversation_id") && re(e.message) && de(e.message, "id");
6311
+ return ie(e) && pe(e, "conversation_id") && ie(e.message) && pe(e.message, "id");
6273
6312
  }
6274
6313
  function ts(e) {
6275
- return re(e) && de(e, "conversation_id") && de(e, "message_id");
6314
+ return ie(e) && pe(e, "conversation_id") && pe(e, "message_id");
6276
6315
  }
6277
6316
  function ns(e) {
6278
- return re(e) && de(e, "conversation_id") && de(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => Qa(n));
6317
+ return ie(e) && pe(e, "conversation_id") && pe(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => Qa(n));
6279
6318
  }
6280
6319
  function ss(e) {
6281
- return re(e) && de(e, "conversation_id");
6320
+ return ie(e) && pe(e, "conversation_id");
6282
6321
  }
6283
6322
  function rs(e) {
6284
- return re(e) && de(e, "conversation_id") && de(e, "removed_user_id");
6323
+ return ie(e) && pe(e, "conversation_id") && pe(e, "removed_user_id");
6285
6324
  }
6286
6325
  function Fe(e, n, r, o) {
6287
6326
  const c = (u) => {
@@ -6292,121 +6331,121 @@ function Fe(e, n, r, o) {
6292
6331
  function pc(e) {
6293
6332
  const n = e.initializedEvent ?? "messenger-client:echo-initialized", r = e.bootstrapEndpoint ?? Na, o = e.bootstrapRefreshSkewMs ?? qa, c = e.presenceFreshnessTtlMs ?? ja, u = (e.createLogger ?? Zt())("MessengerEcho");
6294
6333
  typeof window < "u" && (window.Pusher = Da);
6295
- let d = null, f = null, h = null, P = null, C = "disconnected", v = "available", E = null, b = null;
6334
+ let d = null, f = null, h = null, R = null, C = "disconnected", v = "available", E = null, b = null;
6296
6335
  const A = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Map(), m = (T) => {
6297
6336
  C = T;
6298
- for (const R of A)
6299
- R(T);
6337
+ for (const P of A)
6338
+ P(T);
6300
6339
  }, y = (T) => {
6301
6340
  v = T;
6302
- for (const R of w)
6303
- R(T);
6304
- }, O = () => {
6341
+ for (const P of w)
6342
+ P(T);
6343
+ }, F = () => {
6305
6344
  b !== null && (clearTimeout(b), b = null);
6306
- }, z = (T = !0) => {
6307
- h !== null && (h.disconnect(), h = null), P = null, T && m("disconnected");
6345
+ }, q = (T = !0) => {
6346
+ h !== null && (h.disconnect(), h = null), R = null, T && m("disconnected");
6308
6347
  }, J = () => {
6309
- O(), d = null, f = null, E = null, y("available"), z(), p.clear();
6310
- }, W = () => {
6348
+ F(), d = null, f = null, E = null, y("available"), q(), p.clear();
6349
+ }, G = () => {
6311
6350
  if (!e.getSourceToken)
6312
6351
  return null;
6313
6352
  const T = e.getSourceToken();
6314
- return T === null ? (J(), null) : (E !== null && E !== T && (O(), d = null, f = null, y("available"), z()), E = T, T);
6353
+ return T === null ? (J(), null) : (E !== null && E !== T && (F(), d = null, f = null, y("available"), q()), E = T, T);
6315
6354
  }, te = (T) => {
6316
6355
  if (T === null)
6317
6356
  return !1;
6318
6357
  if (T.auth.expiresAt === null)
6319
6358
  return T.auth.token !== "";
6320
- const R = Date.parse(T.auth.expiresAt);
6321
- return Number.isNaN(R) ? !1 : R - Date.now() > o;
6359
+ const P = Date.parse(T.auth.expiresAt);
6360
+ return Number.isNaN(P) ? !1 : P - Date.now() > o;
6322
6361
  }, k = (T) => {
6323
- if (O(), T.auth.expiresAt === null)
6362
+ if (F(), T.auth.expiresAt === null)
6324
6363
  return;
6325
- const R = Date.parse(T.auth.expiresAt);
6326
- if (Number.isNaN(R))
6364
+ const P = Date.parse(T.auth.expiresAt);
6365
+ if (Number.isNaN(P))
6327
6366
  return;
6328
- const N = Math.max(0, R - Date.now() - o);
6367
+ const D = Math.max(0, P - Date.now() - o);
6329
6368
  b = setTimeout(() => {
6330
- K();
6331
- }, N);
6332
- }, I = async (T = !1) => e.getSourceToken && W() === null || !T && v === "account_suspended" ? null : !T && te(d) ? d : !T && f !== null ? await f : (f = (async () => {
6369
+ V();
6370
+ }, D);
6371
+ }, L = async (T = !1) => e.getSourceToken && G() === null || !T && v === "account_suspended" ? null : !T && te(d) ? d : !T && f !== null ? await f : (f = (async () => {
6333
6372
  try {
6334
- const N = await e.bootstrapClient.get(
6373
+ const D = await e.bootstrapClient.get(
6335
6374
  r,
6336
6375
  T ? { params: { refresh: 1 } } : void 0
6337
- ), U = Va(N.data);
6338
- return d = U, y("available"), k(U), U;
6339
- } catch (N) {
6340
- if (Wa(N))
6341
- return d = null, O(), y("account_suspended"), z(), m("disconnected"), null;
6342
- throw N;
6376
+ ), O = Va(D.data);
6377
+ return d = O, y("available"), k(O), O;
6378
+ } catch (D) {
6379
+ if (Wa(D))
6380
+ return d = null, F(), y("account_suspended"), q(), m("disconnected"), null;
6381
+ throw D;
6343
6382
  }
6344
6383
  })().finally(() => {
6345
6384
  f = null;
6346
- }), await f), K = async () => {
6385
+ }), await f), V = async () => {
6347
6386
  const T = h !== null;
6348
6387
  try {
6349
- if (await I(!0), !T)
6388
+ if (await L(!0), !T)
6350
6389
  return;
6351
- z(!1), await G(!0);
6352
- } catch (R) {
6353
- u.warn("Failed to refresh messenger bootstrap", R);
6390
+ q(!1), await X(!0);
6391
+ } catch (P) {
6392
+ u.warn("Failed to refresh messenger bootstrap", P);
6354
6393
  }
6355
- }, V = (T) => {
6356
- const R = T.connector?.pusher?.connection;
6357
- if (!R) {
6394
+ }, H = (T) => {
6395
+ const P = T.connector?.pusher?.connection;
6396
+ if (!P) {
6358
6397
  u.warn("Messenger echo connector does not expose a Pusher connection");
6359
6398
  return;
6360
6399
  }
6361
- R.bind("connecting", () => {
6400
+ P.bind("connecting", () => {
6362
6401
  m("connecting");
6363
- }), R.bind("connected", () => {
6402
+ }), P.bind("connected", () => {
6364
6403
  m("connected");
6365
- }), R.bind("disconnected", () => {
6404
+ }), P.bind("disconnected", () => {
6366
6405
  m("disconnected");
6367
- }), R.bind("unavailable", () => {
6406
+ }), P.bind("unavailable", () => {
6368
6407
  m("disconnected");
6369
- }), R.bind("error", () => {
6408
+ }), P.bind("error", () => {
6370
6409
  m("error");
6371
- }), R.bind("state_change", (N) => {
6372
- const U = typeof N == "object" && N !== null && "current" in N && typeof N.current == "string" ? N.current : R.state;
6373
- if (U === "connected") {
6410
+ }), P.bind("state_change", (D) => {
6411
+ const O = typeof D == "object" && D !== null && "current" in D && typeof D.current == "string" ? D.current : P.state;
6412
+ if (O === "connected") {
6374
6413
  m("connected");
6375
6414
  return;
6376
6415
  }
6377
- if (U === "connecting") {
6416
+ if (O === "connecting") {
6378
6417
  m("connecting");
6379
6418
  return;
6380
6419
  }
6381
- (U === "unavailable" || U === "failed" || U === "disconnected") && m("disconnected");
6382
- }), R.state === "connected" && m("connected");
6383
- }, G = async (T = !1) => !T && h !== null && te(d) ? h : !T && P !== null ? await P : (P = (async () => {
6384
- const N = await I(T);
6385
- if (N === null)
6420
+ (O === "unavailable" || O === "failed" || O === "disconnected") && m("disconnected");
6421
+ }), P.state === "connected" && m("connected");
6422
+ }, X = async (T = !1) => !T && h !== null && te(d) ? h : !T && R !== null ? await R : (R = (async () => {
6423
+ const D = await L(T);
6424
+ if (D === null)
6386
6425
  return null;
6387
- h !== null && z(!1);
6388
- const U = N.service.reverb.scheme === "https", ne = {
6426
+ h !== null && q(!1);
6427
+ const O = D.service.reverb.scheme === "https", se = {
6389
6428
  broadcaster: "reverb",
6390
- key: N.service.reverb.appKey,
6391
- wsHost: Xa(N.service.reverb.host),
6392
- wsPort: N.service.reverb.port,
6393
- wssPort: N.service.reverb.port,
6394
- forceTLS: U,
6395
- encrypted: U,
6429
+ key: D.service.reverb.appKey,
6430
+ wsHost: Xa(D.service.reverb.host),
6431
+ wsPort: D.service.reverb.port,
6432
+ wssPort: D.service.reverb.port,
6433
+ forceTLS: O,
6434
+ encrypted: O,
6396
6435
  disableStats: !0,
6397
6436
  enabledTransports: ["ws", "wss"],
6398
- authEndpoint: N.service.broadcastingAuthUrl,
6437
+ authEndpoint: D.service.broadcastingAuthUrl,
6399
6438
  auth: {
6400
6439
  headers: {
6401
- Authorization: `Bearer ${N.auth.token}`,
6440
+ Authorization: `Bearer ${D.auth.token}`,
6402
6441
  Accept: "application/json"
6403
6442
  }
6404
6443
  }
6405
6444
  };
6406
- return N.service.reverb.path && (ne.wsPath = N.service.reverb.path), h = new Ia(ne), V(h), m("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
6445
+ return D.service.reverb.path && (se.wsPath = D.service.reverb.path), h = new Ia(se), H(h), m("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
6407
6446
  })().finally(() => {
6408
- P = null;
6409
- }), await P), _ = $t.create({
6447
+ R = null;
6448
+ }), await R), _ = $t.create({
6410
6449
  timeout: e.requestTimeoutMs ?? za,
6411
6450
  withCredentials: !1,
6412
6451
  headers: {
@@ -6415,47 +6454,47 @@ function pc(e) {
6415
6454
  }
6416
6455
  });
6417
6456
  _.interceptors.request.use(async (T) => {
6418
- const R = await I();
6419
- if (R === null)
6457
+ const P = await L();
6458
+ if (P === null)
6420
6459
  throw new Error("Messenger bootstrap is unavailable.");
6421
- return T.baseURL = R.service.apiBaseUrl, Kn(T, R.auth.token), T;
6460
+ return T.baseURL = P.service.apiBaseUrl, Kn(T, P.auth.token), T;
6422
6461
  }), _.interceptors.response.use(
6423
6462
  (T) => T,
6424
6463
  async (T) => {
6425
- const R = T.config;
6426
- if (T.response?.status === 401 && R && R._messengerRetry !== !0) {
6427
- R._messengerRetry = !0;
6428
- const N = await I(!0);
6429
- if (N !== null)
6430
- return R.baseURL = N.service.apiBaseUrl, Kn(R, N.auth.token), await _(R);
6464
+ const P = T.config;
6465
+ if (T.response?.status === 401 && P && P._messengerRetry !== !0) {
6466
+ P._messengerRetry = !0;
6467
+ const D = await L(!0);
6468
+ if (D !== null)
6469
+ return P.baseURL = D.service.apiBaseUrl, Kn(P, D.auth.token), await _(P);
6431
6470
  }
6432
6471
  return Promise.reject(T);
6433
6472
  }
6434
6473
  );
6435
- const L = () => v === "account_suspended" ? null : h, he = (T) => (A.add(T), T(C), () => {
6474
+ const I = () => v === "account_suspended" ? null : h, fe = (T) => (A.add(T), T(C), () => {
6436
6475
  A.delete(T);
6437
6476
  }), Se = (T) => (w.add(T), T(v), () => {
6438
6477
  w.delete(T);
6439
- }), B = () => d?.auth.tenantId ?? "global", D = (T) => {
6440
- const R = Dt(T.ts)?.getTime() ?? Dt(T.last_seen_at)?.getTime() ?? null;
6441
- if (R === null)
6478
+ }), B = () => d?.auth.tenantId ?? "global", K = (T) => {
6479
+ const P = Dt(T.ts)?.getTime() ?? Dt(T.last_seen_at)?.getTime() ?? null;
6480
+ if (P === null)
6442
6481
  return !0;
6443
- const N = `${T.tenant_scope ?? "global"}:${T.user_id}`, U = p.get(N);
6444
- if (U && R < U.timestampMs)
6482
+ const D = `${T.tenant_scope ?? "global"}:${T.user_id}`, O = p.get(D);
6483
+ if (O && P < O.timestampMs)
6445
6484
  return !1;
6446
- const ne = Date.now();
6447
- p.set(N, {
6448
- timestampMs: R,
6449
- seenAt: ne
6485
+ const se = Date.now();
6486
+ p.set(D, {
6487
+ timestampMs: P,
6488
+ seenAt: se
6450
6489
  });
6451
- for (const [oe, ce] of p.entries())
6452
- ne - ce.seenAt > c && p.delete(oe);
6490
+ for (const [ae, le] of p.entries())
6491
+ se - le.seenAt > c && p.delete(ae);
6453
6492
  return !0;
6454
- }, q = (T) => {
6455
- const R = L();
6456
- if (!R || typeof R.join != "function")
6493
+ }, N = (T) => {
6494
+ const P = I();
6495
+ if (!P || typeof P.join != "function")
6457
6496
  return;
6458
- const N = R.join(`online-users.${B()}`), U = [
6497
+ const D = P.join(`online-users.${B()}`), O = [
6459
6498
  ".PresenceStatusChanged",
6460
6499
  "PresenceStatusChanged",
6461
6500
  ".presence.status.changed",
@@ -6465,152 +6504,152 @@ function pc(e) {
6465
6504
  ".Modules\\Presence\\Events\\UserPresenceStatusChanged",
6466
6505
  "Modules\\Presence\\Events\\UserPresenceStatusChanged"
6467
6506
  ];
6468
- for (const ne of U)
6469
- N.listen(ne, (oe) => {
6470
- const ce = Ja(oe, B());
6471
- !ce || !D(ce) || T(ce);
6507
+ for (const se of O)
6508
+ D.listen(se, (ae) => {
6509
+ const le = Ja(ae, B());
6510
+ !le || !K(le) || T(le);
6472
6511
  });
6473
- }, _e = () => {
6512
+ }, Y = () => {
6474
6513
  h?.leave(`online-users.${B()}`);
6475
6514
  };
6476
- function M(T, R) {
6477
- const N = [];
6478
- function U(ne, oe, ce) {
6479
- if (!ce)
6515
+ function M(T, P) {
6516
+ const D = [];
6517
+ function O(se, ae, le) {
6518
+ if (!le)
6480
6519
  return;
6481
6520
  const Re = (Le) => {
6482
- oe(Le) && ce(Le);
6521
+ ae(Le) && le(Le);
6483
6522
  };
6484
- T.bind(ne, Re), N.push({ event: ne, handler: Re });
6523
+ T.bind(se, Re), D.push({ event: se, handler: Re });
6485
6524
  }
6486
- return U("ConversationMessageSent", Yn, R.onMessageSent), U("ConversationMessageRead", Zn, R.onMessageRead), U("ConversationMessageEdited", es, R.onMessageEdited), U("ConversationMessageDeleted", ts, R.onMessageDeleted), U("MessageReactionToggled", ns, R.onReactionToggled), U("ConversationRequestAccepted", ss, R.onRequestAccepted), U("ConversationParticipantRemoved", rs, R.onParticipantRemoved), () => {
6487
- for (const ne of N)
6488
- T.unbind(ne.event, ne.handler);
6525
+ return O("ConversationMessageSent", Yn, P.onMessageSent), O("ConversationMessageRead", Zn, P.onMessageRead), O("ConversationMessageEdited", es, P.onMessageEdited), O("ConversationMessageDeleted", ts, P.onMessageDeleted), O("MessageReactionToggled", ns, P.onReactionToggled), O("ConversationRequestAccepted", ss, P.onRequestAccepted), O("ConversationParticipantRemoved", rs, P.onParticipantRemoved), () => {
6526
+ for (const se of D)
6527
+ T.unbind(se.event, se.handler);
6489
6528
  };
6490
6529
  }
6491
- const F = (T, R) => {
6492
- const N = L();
6493
- if (!N)
6530
+ const U = (T, P) => {
6531
+ const D = I();
6532
+ if (!D)
6494
6533
  return () => {
6495
6534
  };
6496
- const U = N.private(`conversation.${T}`), ne = U.subscription;
6497
- if (ne)
6498
- return M(ne, R);
6499
- const oe = [];
6500
- return R.onMessageSent && oe.push({
6535
+ const O = D.private(`conversation.${T}`), se = O.subscription;
6536
+ if (se)
6537
+ return M(se, P);
6538
+ const ae = [];
6539
+ return P.onMessageSent && ae.push({
6501
6540
  event: ".ConversationMessageSent",
6502
- handler: Fe(U, ".ConversationMessageSent", Yn, R.onMessageSent)
6503
- }), R.onMessageRead && oe.push({
6541
+ handler: Fe(O, ".ConversationMessageSent", Yn, P.onMessageSent)
6542
+ }), P.onMessageRead && ae.push({
6504
6543
  event: ".ConversationMessageRead",
6505
- handler: Fe(U, ".ConversationMessageRead", Zn, R.onMessageRead)
6506
- }), R.onMessageEdited && oe.push({
6544
+ handler: Fe(O, ".ConversationMessageRead", Zn, P.onMessageRead)
6545
+ }), P.onMessageEdited && ae.push({
6507
6546
  event: ".ConversationMessageEdited",
6508
- handler: Fe(U, ".ConversationMessageEdited", es, R.onMessageEdited)
6509
- }), R.onMessageDeleted && oe.push({
6547
+ handler: Fe(O, ".ConversationMessageEdited", es, P.onMessageEdited)
6548
+ }), P.onMessageDeleted && ae.push({
6510
6549
  event: ".ConversationMessageDeleted",
6511
- handler: Fe(U, ".ConversationMessageDeleted", ts, R.onMessageDeleted)
6512
- }), R.onReactionToggled && oe.push({
6550
+ handler: Fe(O, ".ConversationMessageDeleted", ts, P.onMessageDeleted)
6551
+ }), P.onReactionToggled && ae.push({
6513
6552
  event: ".MessageReactionToggled",
6514
- handler: Fe(U, ".MessageReactionToggled", ns, R.onReactionToggled)
6515
- }), R.onRequestAccepted && oe.push({
6553
+ handler: Fe(O, ".MessageReactionToggled", ns, P.onReactionToggled)
6554
+ }), P.onRequestAccepted && ae.push({
6516
6555
  event: ".ConversationRequestAccepted",
6517
- handler: Fe(U, ".ConversationRequestAccepted", ss, R.onRequestAccepted)
6518
- }), R.onParticipantRemoved && oe.push({
6556
+ handler: Fe(O, ".ConversationRequestAccepted", ss, P.onRequestAccepted)
6557
+ }), P.onParticipantRemoved && ae.push({
6519
6558
  event: ".ConversationParticipantRemoved",
6520
- handler: Fe(U, ".ConversationParticipantRemoved", rs, R.onParticipantRemoved)
6559
+ handler: Fe(O, ".ConversationParticipantRemoved", rs, P.onParticipantRemoved)
6521
6560
  }), () => {
6522
- if (typeof U.stopListening == "function")
6523
- for (const ce of oe)
6524
- U.stopListening(ce.event, ce.handler);
6561
+ if (typeof O.stopListening == "function")
6562
+ for (const le of ae)
6563
+ O.stopListening(le.event, le.handler);
6525
6564
  };
6526
- }, Z = (T) => {
6565
+ }, ne = (T) => {
6527
6566
  h?.leave(`conversation.${T}`);
6528
- }, ie = (T, R, N) => {
6529
- const U = T.private(`typing-conversation.${R}`), ne = /* @__PURE__ */ new Set(["start", "typing"]), oe = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]), ce = U.subscription;
6530
- if (ce) {
6531
- const we = (pe) => {
6532
- const ve = Qn(pe);
6533
- if (ve) {
6534
- if (ne.has(ve.state)) {
6535
- N.onTypingStart?.({
6536
- user_id: ve.user_id,
6537
- user: ve.user ?? {
6538
- id: ve.user_id,
6567
+ }, ue = (T, P, D) => {
6568
+ const O = T.private(`typing-conversation.${P}`), se = /* @__PURE__ */ new Set(["start", "typing"]), ae = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]), le = O.subscription;
6569
+ if (le) {
6570
+ const we = (ge) => {
6571
+ const be = Qn(ge);
6572
+ if (be) {
6573
+ if (se.has(be.state)) {
6574
+ D.onTypingStart?.({
6575
+ user_id: be.user_id,
6576
+ user: be.user ?? {
6577
+ id: be.user_id,
6539
6578
  name: ""
6540
6579
  },
6541
- conversation_id: ve.conversation_id,
6542
- started_at: ve.started_at ?? ve.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6580
+ conversation_id: be.conversation_id,
6581
+ started_at: be.started_at ?? be.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6543
6582
  });
6544
6583
  return;
6545
6584
  }
6546
- oe.has(ve.state) && N.onTypingStop?.({
6547
- user_id: ve.user_id,
6548
- conversation_id: ve.conversation_id,
6549
- stopped_at: ve.stopped_at ?? ve.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6585
+ ae.has(be.state) && D.onTypingStop?.({
6586
+ user_id: be.user_id,
6587
+ conversation_id: be.conversation_id,
6588
+ stopped_at: be.stopped_at ?? be.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6550
6589
  });
6551
6590
  }
6552
6591
  };
6553
- return ce.bind("TypingStateChanged", we), () => {
6554
- ce.unbind("TypingStateChanged", we);
6592
+ return le.bind("TypingStateChanged", we), () => {
6593
+ le.unbind("TypingStateChanged", we);
6555
6594
  };
6556
6595
  }
6557
6596
  const Re = [], Le = (we) => {
6558
- const pe = Qn(we);
6559
- if (pe) {
6560
- if (ne.has(pe.state)) {
6561
- N.onTypingStart?.({
6562
- user_id: pe.user_id,
6563
- user: pe.user ?? {
6564
- id: pe.user_id,
6597
+ const ge = Qn(we);
6598
+ if (ge) {
6599
+ if (se.has(ge.state)) {
6600
+ D.onTypingStart?.({
6601
+ user_id: ge.user_id,
6602
+ user: ge.user ?? {
6603
+ id: ge.user_id,
6565
6604
  name: ""
6566
6605
  },
6567
- conversation_id: pe.conversation_id,
6568
- started_at: pe.started_at ?? pe.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6606
+ conversation_id: ge.conversation_id,
6607
+ started_at: ge.started_at ?? ge.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6569
6608
  });
6570
6609
  return;
6571
6610
  }
6572
- oe.has(pe.state) && N.onTypingStop?.({
6573
- user_id: pe.user_id,
6574
- conversation_id: pe.conversation_id,
6575
- stopped_at: pe.stopped_at ?? pe.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6611
+ ae.has(ge.state) && D.onTypingStop?.({
6612
+ user_id: ge.user_id,
6613
+ conversation_id: ge.conversation_id,
6614
+ stopped_at: ge.stopped_at ?? ge.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6576
6615
  });
6577
6616
  }
6578
6617
  };
6579
- return U.listen(".TypingStateChanged", Le), Re.push({ event: ".TypingStateChanged", handler: Le }), () => {
6580
- if (typeof U.stopListening == "function")
6618
+ return O.listen(".TypingStateChanged", Le), Re.push({ event: ".TypingStateChanged", handler: Le }), () => {
6619
+ if (typeof O.stopListening == "function")
6581
6620
  for (const we of Re)
6582
- U.stopListening(we.event, we.handler);
6621
+ O.stopListening(we.event, we.handler);
6583
6622
  };
6584
6623
  };
6585
6624
  return {
6586
6625
  apiClient: _,
6587
6626
  initializedEvent: n,
6588
- getEcho: L,
6589
- waitForEcho: async () => v === "account_suspended" ? null : await G(),
6627
+ getEcho: I,
6628
+ waitForEcho: async () => v === "account_suspended" ? null : await X(),
6590
6629
  getConnectionStatus: () => C,
6591
6630
  getAccessState: () => v,
6592
- onConnectionStatusChange: he,
6631
+ onConnectionStatusChange: fe,
6593
6632
  onAccessStateChange: Se,
6594
6633
  reconnect: async () => {
6595
- y("available"), z(), await G(!0);
6634
+ y("available"), q(), await X(!0);
6596
6635
  },
6597
- subscribeToPresenceStatus: q,
6598
- unsubscribeFromPresenceStatus: _e,
6599
- subscribeToConversation: F,
6600
- unsubscribeFromConversation: Z,
6601
- subscribeToTyping: (T, R) => {
6602
- const N = ut();
6603
- if (N)
6604
- return ie(N, T, R);
6605
- let U = !1, ne = null;
6606
- const oe = () => {
6607
- if (U)
6636
+ subscribeToPresenceStatus: N,
6637
+ unsubscribeFromPresenceStatus: Y,
6638
+ subscribeToConversation: U,
6639
+ unsubscribeFromConversation: ne,
6640
+ subscribeToTyping: (T, P) => {
6641
+ const D = ut();
6642
+ if (D)
6643
+ return ue(D, T, P);
6644
+ let O = !1, se = null;
6645
+ const ae = () => {
6646
+ if (O)
6608
6647
  return;
6609
- const ce = ut();
6610
- ce && (ne = ie(ce, T, R), typeof window < "u" && window.removeEventListener(ct(), oe));
6648
+ const le = ut();
6649
+ le && (se = ue(le, T, P), typeof window < "u" && window.removeEventListener(ct(), ae));
6611
6650
  };
6612
- return typeof window < "u" && window.addEventListener(ct(), oe), () => {
6613
- U = !0, typeof window < "u" && window.removeEventListener(ct(), oe), ne?.();
6651
+ return typeof window < "u" && window.addEventListener(ct(), ae), () => {
6652
+ O = !0, typeof window < "u" && window.removeEventListener(ct(), ae), se?.();
6614
6653
  };
6615
6654
  },
6616
6655
  unsubscribeFromTyping: (T) => {
@@ -6623,13 +6662,13 @@ export {
6623
6662
  go as DEFAULT_PRESENCE_STALE_AFTER_MS,
6624
6663
  hc as configureMessengerClient,
6625
6664
  pc as createMessengerEcho,
6626
- X as getApi,
6665
+ W as getApi,
6627
6666
  ke as getAuthStore,
6628
6667
  Rn as getConnectionStatus,
6629
6668
  Ae as getEcho,
6630
6669
  vs as getEchoConnectionStatus,
6631
6670
  Je as getEchoInitializedEvent,
6632
- Y as getErrorMessage,
6671
+ Z as getErrorMessage,
6633
6672
  Zt as getLoggerFactory,
6634
6673
  Vt as getMainApi,
6635
6674
  ut as getMainEcho,