@codingfactory/messenger-client 0.2.0 → 0.2.2

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.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ref as de, getCurrentInstance as xt, computed as ie, onUnmounted as qe, toValue as Ln, onMounted as Un, watch as fn } from "vue";
2
2
  import { defineStore as ci, storeToRefs as ui } from "pinia";
3
3
  import Mt, { isAxiosError as li, AxiosHeaders as pn } from "axios";
4
- import { isAxiosError as ja } from "axios";
4
+ import { isAxiosError as Ha } from "axios";
5
5
  import { useRoute as hi } from "vue-router";
6
6
  const On = () => () => {
7
7
  }, Nn = async () => {
@@ -13,7 +13,7 @@ const On = () => () => {
13
13
  throw new Error("messenger-client subscribeToConversation is not configured");
14
14
  }, $n = () => {
15
15
  throw new Error("messenger-client subscribeToTyping is not configured");
16
- }, J = {
16
+ }, G = {
17
17
  ECHO_INITIALIZED_EVENT: "messenger-client:echo-initialized",
18
18
  getEcho: () => null,
19
19
  getConnectionStatus: () => "disconnected",
@@ -25,14 +25,14 @@ const On = () => () => {
25
25
  unsubscribeFromConversation: qn,
26
26
  subscribeToTyping: $n,
27
27
  unsubscribeFromTyping: zn
28
- }, De = () => J.ECHO_INITIALIZED_EVENT, Ae = () => J.getEcho(), Hn = () => J.getConnectionStatus(), Pa = () => Hn(), it = (e) => J.onConnectionStatusChange(e), di = async () => {
29
- await J.reconnect();
30
- }, fi = (e) => J.subscribeToPresenceStatus(e), pi = () => J.unsubscribeFromPresenceStatus(), gi = (e, n) => J.subscribeToConversation(e, n), mi = (e) => J.unsubscribeFromConversation(e), vi = (e, n) => J.subscribeToTyping(e, n), bi = (e) => J.unsubscribeFromTyping(e);
28
+ }, De = () => G.ECHO_INITIALIZED_EVENT, Ae = () => G.getEcho(), Hn = () => G.getConnectionStatus(), Ma = () => Hn(), it = (e) => G.onConnectionStatusChange(e), di = async () => {
29
+ await G.reconnect();
30
+ }, fi = (e) => G.subscribeToPresenceStatus(e), pi = () => G.unsubscribeFromPresenceStatus(), gi = (e, n) => G.subscribeToConversation(e, n), mi = (e) => G.unsubscribeFromConversation(e), vi = (e, n) => G.subscribeToTyping(e, n), bi = (e) => G.unsubscribeFromTyping(e);
31
31
  function yi(e) {
32
- e.initializedEvent && (J.ECHO_INITIALIZED_EVENT = e.initializedEvent), e.getEcho && (J.getEcho = e.getEcho), e.getConnectionStatus && (J.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (J.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (J.reconnect = e.reconnect), e.subscribeToPresenceStatus && (J.subscribeToPresenceStatus = e.subscribeToPresenceStatus), e.unsubscribeFromPresenceStatus && (J.unsubscribeFromPresenceStatus = e.unsubscribeFromPresenceStatus), e.subscribeToConversation && (J.subscribeToConversation = e.subscribeToConversation), e.unsubscribeFromConversation && (J.unsubscribeFromConversation = e.unsubscribeFromConversation), e.subscribeToTyping && (J.subscribeToTyping = e.subscribeToTyping), e.unsubscribeFromTyping && (J.unsubscribeFromTyping = e.unsubscribeFromTyping);
32
+ e.initializedEvent && (G.ECHO_INITIALIZED_EVENT = e.initializedEvent), e.getEcho && (G.getEcho = e.getEcho), e.getConnectionStatus && (G.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (G.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (G.reconnect = e.reconnect), e.subscribeToPresenceStatus && (G.subscribeToPresenceStatus = e.subscribeToPresenceStatus), e.unsubscribeFromPresenceStatus && (G.unsubscribeFromPresenceStatus = e.unsubscribeFromPresenceStatus), e.subscribeToConversation && (G.subscribeToConversation = e.subscribeToConversation), e.unsubscribeFromConversation && (G.unsubscribeFromConversation = e.unsubscribeFromConversation), e.subscribeToTyping && (G.subscribeToTyping = e.subscribeToTyping), e.unsubscribeFromTyping && (G.unsubscribeFromTyping = e.unsubscribeFromTyping);
33
33
  }
34
34
  function _i() {
35
- J.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", J.getEcho = () => null, J.getConnectionStatus = () => "disconnected", J.onConnectionStatusChange = On, J.reconnect = Nn, J.subscribeToPresenceStatus = Fn, J.unsubscribeFromPresenceStatus = Dn, J.subscribeToConversation = jn, J.unsubscribeFromConversation = qn, J.subscribeToTyping = $n, J.unsubscribeFromTyping = zn;
35
+ G.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", G.getEcho = () => null, G.getConnectionStatus = () => "disconnected", G.onConnectionStatusChange = On, G.reconnect = Nn, G.subscribeToPresenceStatus = Fn, G.unsubscribeFromPresenceStatus = Dn, G.subscribeToConversation = jn, G.unsubscribeFromConversation = qn, G.subscribeToTyping = $n, G.unsubscribeFromTyping = zn;
36
36
  }
37
37
  function tt(e) {
38
38
  return typeof e == "object" && e !== null;
@@ -40,10 +40,10 @@ function tt(e) {
40
40
  function Si(e) {
41
41
  return tt(e) && typeof e.conversation_id == "string" && tt(e.message) && typeof e.message.id == "string" && typeof e.message.conversation_id == "string" && typeof e.message.author_id == "string";
42
42
  }
43
- function Ci(e) {
43
+ function wi(e) {
44
44
  return tt(e) && typeof e.conversation_id == "string" && typeof e.user_id == "string" && typeof e.message_id == "string";
45
45
  }
46
- function wi(e) {
46
+ function Ci(e) {
47
47
  return tt(e) && typeof e.conversation_id == "string";
48
48
  }
49
49
  const Bn = Mt;
@@ -70,17 +70,17 @@ function Ri(e) {
70
70
  function Ai() {
71
71
  It = () => Vn;
72
72
  }
73
- function Z(e) {
73
+ function Q(e) {
74
74
  if (li(e)) {
75
75
  const n = e.response?.data?.message || e.message || "An error occurred";
76
76
  return n.includes("SQLSTATE") || n.includes("Connection:") || n.includes("\\Illuminate\\") ? "Something went wrong. Please try again later." : n;
77
77
  }
78
78
  return e instanceof Error ? e.message : typeof e == "string" ? e : typeof e == "object" && e !== null && "message" in e && typeof e.message == "string" ? e.message : "An unexpected error occurred";
79
79
  }
80
- function xa(e) {
80
+ function ka(e) {
81
81
  return e instanceof Error;
82
82
  }
83
- function Ma(e) {
83
+ function Ia(e) {
84
84
  return typeof e == "object" && e !== null && "response" in e && typeof e.response == "object";
85
85
  }
86
86
  const Xn = {
@@ -390,7 +390,7 @@ function he(e) {
390
390
  function Gi(e) {
391
391
  return he(e) ? (he(e.response) ? e.response : null)?.status === 401 : !1;
392
392
  }
393
- function Cn(e) {
393
+ function wn(e) {
394
394
  if (!Array.isArray(e))
395
395
  return [];
396
396
  const n = [];
@@ -424,7 +424,7 @@ function Je(e, n) {
424
424
  nextCursor: Ji(i, o)
425
425
  };
426
426
  }
427
- function wn(e) {
427
+ function Cn(e) {
428
428
  return he(e) && typeof e.id == "string" && e.id.length > 0;
429
429
  }
430
430
  function Tn(e) {
@@ -454,7 +454,7 @@ function En(e, n) {
454
454
  };
455
455
  });
456
456
  }
457
- function Ct(e) {
457
+ function wt(e) {
458
458
  const n = /* @__PURE__ */ new Map();
459
459
  for (const i of e.requests)
460
460
  i.is_request === !0 && n.set(i.id, i);
@@ -498,9 +498,9 @@ const Nt = ci("messaging", {
498
498
  hasMoreMessages: (e) => (n) => e.conversationHasMore[n] ?? !1,
499
499
  isLoadingMessages: (e) => (n) => e.loadingMessages[n] ?? !1,
500
500
  // Message request getters
501
- requestConversations: (e) => Ct(e),
502
- requestCount: (e) => Ct(e).length,
503
- unreadRequestCount: (e) => Ct(e).filter((n) => n.unread_count > 0).length
501
+ requestConversations: (e) => wt(e),
502
+ requestCount: (e) => wt(e).length,
503
+ unreadRequestCount: (e) => wt(e).filter((n) => n.unread_count > 0).length
504
504
  },
505
505
  actions: {
506
506
  normalizeFolderAssignmentsState() {
@@ -514,7 +514,7 @@ const Nt = ci("messaging", {
514
514
  const e = await Se.fetchFolders();
515
515
  return this.folders = Oe(e), this.foldersLoaded = !0, this.normalizeFolderAssignmentsState(), this.folders;
516
516
  } catch (e) {
517
- throw this.error = Z(e), e;
517
+ throw this.error = Q(e), e;
518
518
  }
519
519
  },
520
520
  async createFolder(e) {
@@ -522,7 +522,7 @@ const Nt = ci("messaging", {
522
522
  const n = await Se.createFolder(e);
523
523
  return this.folders = Oe([...this.folders, n]), n;
524
524
  } catch (n) {
525
- throw this.error = Z(n), n;
525
+ throw this.error = Q(n), n;
526
526
  }
527
527
  },
528
528
  async updateFolder(e, n) {
@@ -532,14 +532,14 @@ const Nt = ci("messaging", {
532
532
  this.folders.map((o) => o.id === e ? i : o)
533
533
  ), i;
534
534
  } catch (i) {
535
- throw this.error = Z(i), i;
535
+ throw this.error = Q(i), i;
536
536
  }
537
537
  },
538
538
  async deleteFolder(e) {
539
539
  try {
540
540
  await Se.deleteFolder(e), this.folders = this.folders.filter((n) => n.id !== e), this.foldersLoaded = !0, this.activeFolderId === e && (this.activeFolderId = null), this.normalizeFolderAssignmentsState();
541
541
  } catch (n) {
542
- throw this.error = Z(n), n;
542
+ throw this.error = Q(n), n;
543
543
  }
544
544
  },
545
545
  async reorderFolders(e) {
@@ -561,7 +561,7 @@ const Nt = ci("messaging", {
561
561
  });
562
562
  this.folders = i;
563
563
  } catch (n) {
564
- throw this.error = Z(n), n;
564
+ throw this.error = Q(n), n;
565
565
  }
566
566
  },
567
567
  async assignToFolder(e, n) {
@@ -578,7 +578,7 @@ const Nt = ci("messaging", {
578
578
  folder_id: l
579
579
  };
580
580
  } catch (i) {
581
- throw this.error = Z(i), i;
581
+ throw this.error = Q(i), i;
582
582
  }
583
583
  },
584
584
  async fetchConversations(e, n, i, o) {
@@ -589,20 +589,20 @@ const Nt = ci("messaging", {
589
589
  const h = await X().get("/v1/messaging/conversations", { params: l }), { items: g, nextCursor: d } = Je(
590
590
  h.data,
591
591
  "conversations"
592
- ), P = g.map((v) => {
592
+ ), A = g.map((m) => {
593
593
  const y = this.conversations.find(
594
- (T) => T.id === v.id
594
+ (E) => E.id === m.id
595
595
  );
596
- return Ue(v, y);
596
+ return Ue(m, y);
597
597
  });
598
- e ? this.conversations.push(...P) : this.conversations = P, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
598
+ e ? this.conversations.push(...A) : this.conversations = A, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
599
599
  const x = {
600
- data: P,
600
+ data: A,
601
601
  has_more: !!d
602
602
  };
603
603
  return d !== void 0 && (x.next_cursor = d), x;
604
604
  } catch (u) {
605
- throw o?.background && bn(u) || (this.error = Z(u)), u;
605
+ throw o?.background && bn(u) || (this.error = Q(u)), u;
606
606
  } finally {
607
607
  this.loading = !1;
608
608
  }
@@ -630,7 +630,7 @@ const Nt = ci("messaging", {
630
630
  const l = this.requests.findIndex((h) => h.id === e);
631
631
  return l >= 0 && (this.requests[l] = o), this.normalizeFolderAssignmentsState(), o;
632
632
  } catch (n) {
633
- throw this.error = Z(n), n;
633
+ throw this.error = Q(n), n;
634
634
  } finally {
635
635
  this.loading = !1;
636
636
  }
@@ -647,7 +647,7 @@ const Nt = ci("messaging", {
647
647
  i.data,
648
648
  "conversations"
649
649
  ), l = o.map((g) => {
650
- const d = this.requests.find((P) => P.id === g.id);
650
+ const d = this.requests.find((A) => A.id === g.id);
651
651
  return Ue(g, d);
652
652
  });
653
653
  e ? this.requests.push(...l) : this.requests = l, this.normalizeFolderAssignmentsState();
@@ -657,7 +657,7 @@ const Nt = ci("messaging", {
657
657
  };
658
658
  return u !== void 0 && (h.next_cursor = u), h;
659
659
  } catch (n) {
660
- throw this.error = Z(n), n;
660
+ throw this.error = Q(n), n;
661
661
  } finally {
662
662
  this.loading = !1;
663
663
  }
@@ -671,21 +671,21 @@ const Nt = ci("messaging", {
671
671
  try {
672
672
  u = await X().get(`/v1/messaging/conversations/${e}/messages`, { params: i });
673
673
  break;
674
- } catch (v) {
675
- if (!(o < Oi && bn(v)))
676
- throw v;
677
- o += 1, await yn(Di(v));
674
+ } catch (m) {
675
+ if (!(o < Oi && bn(m)))
676
+ throw m;
677
+ o += 1, await yn(Di(m));
678
678
  }
679
679
  const { items: l, nextCursor: h } = Je(
680
680
  u.data,
681
681
  "messages"
682
682
  ), g = l.map(Ze), d = [...g].reverse();
683
683
  if (n ? this.messages[e] = [...d, ...this.messages[e] || []] : this.messages[e] = d, (() => {
684
- const v = this.conversations.find((y) => y.id === e) ?? this.requests.find((y) => y.id === e);
685
- return v ? !v.last_message || !v.last_message_at : !1;
684
+ const m = this.conversations.find((y) => y.id === e) ?? this.requests.find((y) => y.id === e);
685
+ return m ? !m.last_message || !m.last_message_at : !1;
686
686
  })()) {
687
- const v = this.messages[e]?.at(-1);
688
- v && this.updateConversationLastMessage(e, v);
687
+ const m = this.messages[e]?.at(-1);
688
+ m && this.updateConversationLastMessage(e, m);
689
689
  }
690
690
  h ? (this.conversationCursors[e] = h, this.conversationHasMore[e] = !0) : (delete this.conversationCursors[e], this.conversationHasMore[e] = !1);
691
691
  const x = {
@@ -694,16 +694,16 @@ const Nt = ci("messaging", {
694
694
  };
695
695
  return h !== void 0 && (x.next_cursor = h), x;
696
696
  } catch (i) {
697
- throw this.error = Z(i), i;
697
+ throw this.error = Q(i), i;
698
698
  } finally {
699
699
  this.loadingMessages[e] = !1, this.loading = !1;
700
700
  }
701
701
  },
702
702
  async sendMessage(e, n, i, o, u, l) {
703
- const h = Pe()(), g = `temp-${Date.now()}-${Math.random()}`, d = typeof l == "string" && l.trim().length > 0 ? l.trim() : null, P = h.currentUser, x = {
703
+ const h = Pe()(), g = `temp-${Date.now()}-${Math.random()}`, d = typeof l == "string" && l.trim().length > 0 ? l.trim() : null, A = h.currentUser, x = {
704
704
  id: g,
705
705
  conversation_id: e,
706
- author_id: P?.id || "",
706
+ author_id: A?.id || "",
707
707
  body: n || "",
708
708
  attachments: [],
709
709
  meta: d ? { shared_post_id: d } : {},
@@ -711,14 +711,14 @@ const Nt = ci("messaging", {
711
711
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
712
712
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
713
713
  };
714
- P && (x.author = {
715
- id: P.id,
716
- name: P.name,
717
- ...P.avatar ? { avatar: P.avatar } : {},
718
- ...P.handle ? { handle: P.handle } : {}
714
+ A && (x.author = {
715
+ id: A.id,
716
+ name: A.name,
717
+ ...A.avatar ? { avatar: A.avatar } : {},
718
+ ...A.handle ? { handle: A.handle } : {}
719
719
  }), o != null && (x.reply_to_id = o), u != null && (x.reply_to = u), this.messages[e] || (this.messages[e] = []), this.messages[e].push(x), this._pendingSendIds.add(g);
720
720
  try {
721
- let v;
721
+ let m;
722
722
  const y = {
723
723
  body: n || "",
724
724
  ...o ? { reply_to_id: o } : {},
@@ -726,35 +726,35 @@ const Nt = ci("messaging", {
726
726
  };
727
727
  if (i && i.length > 0) {
728
728
  const j = await Promise.all(
729
- i.map(async (H) => {
730
- const R = await Pi().uploadImage(H);
729
+ i.map(async (B) => {
730
+ const P = await Pi().uploadImage(B);
731
731
  return {
732
- media_id: R.id,
733
- mime: R.mime_type,
734
- size: R.size
732
+ media_id: P.id,
733
+ mime: P.mime_type,
734
+ size: P.size
735
735
  };
736
736
  })
737
737
  );
738
- v = await X().post(`/v1/messaging/conversations/${e}/messages`, {
738
+ m = await X().post(`/v1/messaging/conversations/${e}/messages`, {
739
739
  ...y,
740
740
  attachments: j
741
741
  });
742
742
  } else
743
- v = await X().post(`/v1/messaging/conversations/${e}/messages`, {
743
+ m = await X().post(`/v1/messaging/conversations/${e}/messages`, {
744
744
  ...y,
745
745
  type: "text"
746
746
  });
747
- const T = v.data.data || v.data, E = { ...x, ...T, attachments: T.attachments ?? x.attachments }, S = Ze(E), f = this.messages[e], m = f.findIndex((j) => j.id === g);
748
- m >= 0 && (f[m] = S), this._pendingSendIds.delete(g);
747
+ const E = m.data.data || m.data, R = { ...x, ...E, attachments: E.attachments ?? x.attachments }, S = Ze(R), f = this.messages[e], v = f.findIndex((j) => j.id === g);
748
+ v >= 0 && (f[v] = S), this._pendingSendIds.delete(g);
749
749
  const b = S.id;
750
750
  let F = 0;
751
751
  for (let j = f.length - 1; j >= 0; j--) {
752
- const H = f[j];
753
- H && H.id === b && (F++, F > 1 && f.splice(j, 1));
752
+ const B = f[j];
753
+ B && B.id === b && (F++, F > 1 && f.splice(j, 1));
754
754
  }
755
755
  return this.updateConversationLastMessage(e, S), S;
756
- } catch (v) {
757
- throw this._pendingSendIds.delete(g), this.messages[e] = this.messages[e].filter((y) => y.id !== g), this.error = Z(v), v;
756
+ } catch (m) {
757
+ throw this._pendingSendIds.delete(g), this.messages[e] = this.messages[e].filter((y) => y.id !== g), this.error = Q(m), m;
758
758
  }
759
759
  },
760
760
  async editMessage(e, n, i) {
@@ -768,7 +768,7 @@ const Nt = ci("messaging", {
768
768
  }
769
769
  return u;
770
770
  } catch (o) {
771
- throw this.error = Z(o), o;
771
+ throw this.error = Q(o), o;
772
772
  }
773
773
  },
774
774
  async deleteMessage(e, n) {
@@ -783,7 +783,7 @@ const Nt = ci("messaging", {
783
783
  delete l.body, i[o] = l;
784
784
  }
785
785
  } catch (i) {
786
- throw this.error = Z(i), i;
786
+ throw this.error = Q(i), i;
787
787
  }
788
788
  },
789
789
  async markAsRead(e) {
@@ -809,7 +809,7 @@ const Nt = ci("messaging", {
809
809
  u.id === e && (u.unread_count = 0);
810
810
  });
811
811
  } catch (n) {
812
- throw this.error = Z(n), n;
812
+ throw this.error = Q(n), n;
813
813
  }
814
814
  },
815
815
  async markAllAsRead() {
@@ -844,7 +844,7 @@ const Nt = ci("messaging", {
844
844
  o === null && (o = u.reason);
845
845
  }
846
846
  }), o !== null)
847
- throw this.error = Z(o), o;
847
+ throw this.error = Q(o), o;
848
848
  },
849
849
  async sendTyping(e, n = "start") {
850
850
  try {
@@ -861,7 +861,7 @@ const Nt = ci("messaging", {
861
861
  const i = { minutes: n }, o = await X().patch(`/v1/messaging/conversations/${e}/mute`, i), l = (o.data.data || o.data).muted_until || null, h = this.conversations.find((g) => g.id === e);
862
862
  h && (h.is_muted = l !== null, h.muted_until = l);
863
863
  } catch (i) {
864
- throw this.error = Z(i), i;
864
+ throw this.error = Q(i), i;
865
865
  }
866
866
  },
867
867
  async unmuteConversation(e) {
@@ -871,7 +871,7 @@ const Nt = ci("messaging", {
871
871
  }), o = (n.data.data || n.data).muted_until || null, u = this.conversations.find((l) => l.id === e);
872
872
  u && (u.is_muted = o !== null, u.muted_until = o);
873
873
  } catch (n) {
874
- throw this.error = Z(n), n;
874
+ throw this.error = Q(n), n;
875
875
  }
876
876
  },
877
877
  async updateConversationTitle(e, n) {
@@ -884,7 +884,7 @@ const Nt = ci("messaging", {
884
884
  });
885
885
  this.conversations = l(this.conversations), this.requests = l(this.requests);
886
886
  } catch (i) {
887
- throw this.error = Z(i), i;
887
+ throw this.error = Q(i), i;
888
888
  }
889
889
  },
890
890
  async pinConversation(e, n) {
@@ -893,21 +893,21 @@ const Nt = ci("messaging", {
893
893
  const i = this.conversations.find((o) => o.id === e);
894
894
  i && (i.is_pinned = n), this.conversations.sort(et);
895
895
  } catch (i) {
896
- throw this.error = Z(i), i;
896
+ throw this.error = Q(i), i;
897
897
  }
898
898
  },
899
899
  async archiveConversation(e, n) {
900
900
  try {
901
901
  await X().patch(`/v1/messaging/conversations/${e}/archive`, { archived: n }), this.conversations = this.conversations.filter((i) => i.id !== e);
902
902
  } catch (i) {
903
- throw this.error = Z(i), i;
903
+ throw this.error = Q(i), i;
904
904
  }
905
905
  },
906
906
  async deleteConversation(e) {
907
907
  try {
908
908
  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];
909
909
  } catch (n) {
910
- throw this.error = Z(n), n;
910
+ throw this.error = Q(n), n;
911
911
  }
912
912
  },
913
913
  async createDMConversation(e, n) {
@@ -917,12 +917,12 @@ const Nt = ci("messaging", {
917
917
  };
918
918
  n && (i.message = n);
919
919
  const o = await X().post("/v1/messaging/conversations/dm", i), u = o.data.data || o.data;
920
- if (!wn(u))
920
+ if (!Cn(u))
921
921
  throw new Error("Invalid conversation payload from DM create endpoint.");
922
922
  const l = Tn(u) ? Ue(u) : await this.fetchConversation(u.id);
923
923
  return l.is_request === !0 ? (this.requests = Ke(this.requests, l), this.conversations = this.conversations.filter((h) => h.id !== l.id), l) : (this.conversations = Ke(this.conversations, l), this.requests = this.requests.filter((h) => h.id !== l.id), l);
924
924
  } catch (i) {
925
- throw this.error = Z(i), i;
925
+ throw this.error = Q(i), i;
926
926
  }
927
927
  },
928
928
  async createGroupConversation(e, n) {
@@ -931,12 +931,12 @@ const Nt = ci("messaging", {
931
931
  title: e,
932
932
  participant_ids: n
933
933
  }), o = i.data.data || i.data;
934
- if (!wn(o))
934
+ if (!Cn(o))
935
935
  throw new Error("Invalid conversation payload from group create endpoint.");
936
936
  const u = Tn(o) ? o : await this.fetchConversation(o.id);
937
937
  return this.conversations = Ke(this.conversations, u), u;
938
938
  } catch (i) {
939
- throw this.error = Z(i), i;
939
+ throw this.error = Q(i), i;
940
940
  }
941
941
  },
942
942
  async addParticipants(e, n) {
@@ -946,7 +946,7 @@ const Nt = ci("messaging", {
946
946
  // Changed from participant_ids to user_ids to match backend
947
947
  }), await this.fetchConversation(e);
948
948
  } catch (i) {
949
- throw this.error = Z(i), i;
949
+ throw this.error = Q(i), i;
950
950
  }
951
951
  },
952
952
  async removeParticipant(e, n) {
@@ -959,7 +959,7 @@ const Nt = ci("messaging", {
959
959
  }
960
960
  await this.fetchConversation(e);
961
961
  } catch (i) {
962
- throw this.error = Z(i), i;
962
+ throw this.error = Q(i), i;
963
963
  }
964
964
  },
965
965
  applyParticipantReadState(e) {
@@ -987,18 +987,18 @@ const Nt = ci("messaging", {
987
987
  return;
988
988
  const l = Pe()();
989
989
  if (i.author_id === l.currentUser?.id) {
990
- const d = o.findIndex((P) => P.id.startsWith("temp-"));
990
+ const d = o.findIndex((A) => A.id.startsWith("temp-"));
991
991
  if (d >= 0) {
992
- const P = o[d]?.id ?? "";
993
- o[d] = i, this._pendingSendIds.delete(P), this.updateConversationLastMessage(n, i);
992
+ const A = o[d]?.id ?? "";
993
+ o[d] = i, this._pendingSendIds.delete(A), this.updateConversationLastMessage(n, i);
994
994
  return;
995
995
  }
996
996
  }
997
997
  const h = i.created_at;
998
998
  let g = o.length;
999
999
  for (let d = o.length - 1; d >= 0; d--) {
1000
- const P = o[d];
1001
- if (P && P.created_at <= h)
1000
+ const A = o[d];
1001
+ if (A && A.created_at <= h)
1002
1002
  break;
1003
1003
  g = d;
1004
1004
  }
@@ -1010,8 +1010,8 @@ const Nt = ci("messaging", {
1010
1010
  },
1011
1011
  removeMessage(e, n) {
1012
1012
  const i = (d) => {
1013
- const P = { ...d, is_deleted: !0 };
1014
- return delete P.body, P;
1013
+ const A = { ...d, is_deleted: !0 };
1014
+ return delete A.body, A;
1015
1015
  };
1016
1016
  let o = null;
1017
1017
  const u = this.conversations.find((d) => d.id === e);
@@ -1040,24 +1040,24 @@ const Nt = ci("messaging", {
1040
1040
  let g;
1041
1041
  try {
1042
1042
  g = await X().post(o, u);
1043
- } catch (v) {
1044
- if (!Gi(v))
1045
- throw v;
1043
+ } catch (m) {
1044
+ if (!Gi(m))
1045
+ throw m;
1046
1046
  g = await X().post(o, u);
1047
1047
  }
1048
- const d = he(g.data) && "data" in g.data ? g.data.data : g.data, P = Cn(
1048
+ const d = he(g.data) && "data" in g.data ? g.data.data : g.data, A = wn(
1049
1049
  he(d) ? d.reactions : void 0
1050
1050
  );
1051
- (P.length > 0 || h.length === 0) && this.updateMessageReactions(e, n, P);
1051
+ (A.length > 0 || h.length === 0) && this.updateMessageReactions(e, n, A);
1052
1052
  try {
1053
- const v = await X().get(o), y = he(v.data) && "data" in v.data ? v.data.data : v.data, T = Cn(
1053
+ const m = await X().get(o), y = he(m.data) && "data" in m.data ? m.data.data : m.data, E = wn(
1054
1054
  he(y) ? y.reactions : void 0
1055
1055
  );
1056
- this.updateMessageReactions(e, n, T);
1056
+ this.updateMessageReactions(e, n, E);
1057
1057
  } catch {
1058
1058
  }
1059
1059
  } catch (g) {
1060
- throw this.error = Z(g), g;
1060
+ throw this.error = Q(g), g;
1061
1061
  }
1062
1062
  },
1063
1063
  updateMessageReactions(e, n, i) {
@@ -1101,14 +1101,14 @@ const Nt = ci("messaging", {
1101
1101
  });
1102
1102
  this.conversations = Ke(this.conversations, i);
1103
1103
  } catch (n) {
1104
- throw this.error = Z(n), n;
1104
+ throw this.error = Q(n), n;
1105
1105
  }
1106
1106
  },
1107
1107
  async declineRequest(e) {
1108
1108
  try {
1109
1109
  await Se.declineRequest(e), this.requests = this.requests.filter((n) => n.id !== e);
1110
1110
  } catch (n) {
1111
- throw this.error = Z(n), n;
1111
+ throw this.error = Q(n), n;
1112
1112
  }
1113
1113
  },
1114
1114
  async searchConversations(e, n, i) {
@@ -1124,7 +1124,7 @@ const Nt = ci("messaging", {
1124
1124
  );
1125
1125
  return l;
1126
1126
  } catch (o) {
1127
- return this.error = Z(o), [];
1127
+ return this.error = Q(o), [];
1128
1128
  } finally {
1129
1129
  this.searchLoading = !1;
1130
1130
  }
@@ -1137,7 +1137,7 @@ const Nt = ci("messaging", {
1137
1137
  }), o = i.data.data || i.data || [];
1138
1138
  return this.searchResults = o, o;
1139
1139
  } catch (i) {
1140
- return this.error = Z(i), [];
1140
+ return this.error = Q(i), [];
1141
1141
  } finally {
1142
1142
  this.searchLoading = !1;
1143
1143
  }
@@ -1177,109 +1177,109 @@ const Nt = ci("messaging", {
1177
1177
  }
1178
1178
  }
1179
1179
  });
1180
- function ka(e) {
1181
- const n = Nt(), i = Pe()(), o = de(!1), u = de(null), l = de(null), h = xt(), g = h !== null, d = 20, P = 250;
1182
- let x = 0, v = null, y = null;
1183
- const T = ie(() => i.currentUser?.id), E = () => Ln(e)?.trim() ?? "";
1180
+ function La(e) {
1181
+ const n = Nt(), i = Pe()(), o = de(!1), u = de(null), l = de(null), h = xt(), g = h !== null, d = 20, A = 250;
1182
+ let x = 0, m = null, y = null;
1183
+ const E = ie(() => i.currentUser?.id), R = () => Ln(e)?.trim() ?? "";
1184
1184
  function S() {
1185
- v && (clearTimeout(v), v = null), x = 0;
1185
+ m && (clearTimeout(m), m = null), x = 0;
1186
1186
  }
1187
1187
  function f() {
1188
- !g || o.value || v || x >= d || (v = setTimeout(() => {
1189
- v = null, x += 1, B();
1190
- }, P));
1191
- }
1192
- function m(A) {
1193
- if (n.addMessage(A.message), A.message.author_id !== T.value) {
1194
- const M = n.getConversationById(A.conversation_id);
1195
- M && (M.unread_count = 0), n.markAsRead(A.conversation_id).catch(() => {
1188
+ !g || o.value || m || x >= d || (m = setTimeout(() => {
1189
+ m = null, x += 1, $();
1190
+ }, A));
1191
+ }
1192
+ function v(w) {
1193
+ if (n.addMessage(w.message), w.message.author_id !== E.value) {
1194
+ const M = n.getConversationById(w.conversation_id);
1195
+ M && (M.unread_count = 0), n.markAsRead(w.conversation_id).catch(() => {
1196
1196
  });
1197
1197
  }
1198
1198
  }
1199
- function b(A) {
1200
- n.applyParticipantReadState(A);
1199
+ function b(w) {
1200
+ n.applyParticipantReadState(w);
1201
1201
  }
1202
- function F(A) {
1203
- const M = n.getMessagesByConversationId(A.conversation_id), te = M.findIndex((C) => C.id === A.message.id);
1204
- if (te >= 0) {
1205
- const C = M[te];
1202
+ function F(w) {
1203
+ const M = n.getMessagesByConversationId(w.conversation_id), ee = M.findIndex((C) => C.id === w.message.id);
1204
+ if (ee >= 0) {
1205
+ const C = M[ee];
1206
1206
  if (!C) return;
1207
1207
  const O = { ...C };
1208
- A.message.body !== void 0 && (O.body = A.message.body), A.message.edited_at !== void 0 && (O.edited_at = A.message.edited_at), A.message.meta !== void 0 && (O.meta = A.message.meta), M[te] = O;
1209
- const L = n.getConversationById(A.conversation_id);
1210
- L && L.last_message?.id === A.message.id && (L.last_message = O);
1208
+ w.message.body !== void 0 && (O.body = w.message.body), w.message.edited_at !== void 0 && (O.edited_at = w.message.edited_at), w.message.meta !== void 0 && (O.meta = w.message.meta), M[ee] = O;
1209
+ const L = n.getConversationById(w.conversation_id);
1210
+ L && L.last_message?.id === w.message.id && (L.last_message = O);
1211
1211
  }
1212
1212
  }
1213
- function j(A) {
1214
- n.removeMessage(A.conversation_id, A.message_id);
1213
+ function j(w) {
1214
+ n.removeMessage(w.conversation_id, w.message_id);
1215
1215
  }
1216
- function H(A) {
1216
+ function B(w) {
1217
1217
  n.updateMessageReactions(
1218
- A.conversation_id,
1219
- A.message_id,
1220
- A.reactions
1218
+ w.conversation_id,
1219
+ w.message_id,
1220
+ w.reactions
1221
1221
  );
1222
1222
  }
1223
- function R(A) {
1224
- const M = n.getConversationById(A.conversation_id);
1223
+ function P(w) {
1224
+ const M = n.getConversationById(w.conversation_id);
1225
1225
  M && (M.is_request = !1), n.requests = n.requests.filter(
1226
- (te) => te.id !== A.conversation_id
1226
+ (ee) => ee.id !== w.conversation_id
1227
1227
  );
1228
1228
  }
1229
- function U(A) {
1230
- A.removed_user_id === T.value && (W(), n.deleteConversation(A.conversation_id).catch(() => {
1229
+ function U(w) {
1230
+ w.removed_user_id === E.value && (se(), n.deleteConversation(w.conversation_id).catch(() => {
1231
1231
  }));
1232
1232
  }
1233
- function B() {
1234
- const A = E();
1235
- if (!(o.value || !A)) {
1233
+ function $() {
1234
+ const w = R();
1235
+ if (!(o.value || !w)) {
1236
1236
  if (!Ae()) {
1237
1237
  f();
1238
1238
  return;
1239
1239
  }
1240
1240
  u.value = null;
1241
1241
  try {
1242
- y = gi(A, {
1243
- onMessageSent: m,
1242
+ y = gi(w, {
1243
+ onMessageSent: v,
1244
1244
  onMessageRead: b,
1245
1245
  onMessageEdited: F,
1246
1246
  onMessageDeleted: j,
1247
- onReactionToggled: H,
1248
- onRequestAccepted: R,
1247
+ onReactionToggled: B,
1248
+ onRequestAccepted: P,
1249
1249
  onParticipantRemoved: U
1250
- }), o.value = !0, l.value = A, n.registerDetailSubscription(A), S();
1250
+ }), o.value = !0, l.value = w, n.registerDetailSubscription(w), S();
1251
1251
  } catch (M) {
1252
1252
  u.value = M instanceof Error ? M.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", M);
1253
1253
  }
1254
1254
  }
1255
1255
  }
1256
1256
  function z() {
1257
- o.value || B();
1257
+ o.value || $();
1258
1258
  }
1259
1259
  typeof window < "u" && window.addEventListener(De(), z);
1260
- const Y = it((A) => {
1261
- if (A === "connected") {
1262
- o.value || B();
1260
+ const K = it((w) => {
1261
+ if (w === "connected") {
1262
+ o.value || $();
1263
1263
  return;
1264
1264
  }
1265
- (A === "disconnected" || A === "error") && (S(), y && (y(), y = null), l.value && (n.unregisterDetailSubscription(l.value), l.value = null), o.value = !1);
1265
+ (w === "disconnected" || w === "error") && (S(), y && (y(), y = null), l.value && (n.unregisterDetailSubscription(l.value), l.value = null), o.value = !1);
1266
1266
  });
1267
- function W() {
1268
- const A = l.value;
1269
- if (S(), !(!o.value || !A))
1267
+ function se() {
1268
+ const w = l.value;
1269
+ if (S(), !(!o.value || !w))
1270
1270
  try {
1271
- y && (y(), y = null), n.hasGlobalConversationSubscription(A) || mi(A), o.value = !1, n.unregisterDetailSubscription(A), l.value = null, u.value = null;
1271
+ y && (y(), y = null), n.hasGlobalConversationSubscription(w) || mi(w), o.value = !1, n.unregisterDetailSubscription(w), l.value = null, u.value = null;
1272
1272
  } catch (M) {
1273
1273
  u.value = M instanceof Error ? M.message : "Failed to unsubscribe from conversation", console.error("ConversationChannel: Unsubscribe error", M);
1274
1274
  }
1275
1275
  }
1276
1276
  return h !== null && qe(() => {
1277
- S(), Y(), W(), typeof window < "u" && window.removeEventListener(De(), z);
1277
+ S(), K(), se(), typeof window < "u" && window.removeEventListener(De(), z);
1278
1278
  }), {
1279
1279
  isSubscribed: ie(() => o.value),
1280
1280
  error: ie(() => u.value),
1281
- subscribe: B,
1282
- unsubscribe: W
1281
+ subscribe: $,
1282
+ unsubscribe: se
1283
1283
  };
1284
1284
  }
1285
1285
  const Kn = () => () => {
@@ -1360,13 +1360,13 @@ function co(e) {
1360
1360
  function Pn(e) {
1361
1361
  return e.getEchoConnection()?.state ?? null;
1362
1362
  }
1363
- function Ia(e = {}) {
1363
+ function Ua(e = {}) {
1364
1364
  const o = co(e.source ?? "app"), u = {
1365
1365
  ...ao,
1366
1366
  ...e.icons
1367
- }, l = de(o.getConnectionStatus()), h = de(null), g = de(0), d = de(!1), P = de(!1), x = de(!1), v = de(!1);
1368
- let y = null, T = null, E = null, S = null, f = null, m = null, b = null;
1369
- const F = ie(() => l.value === "connected"), j = ie(() => l.value === "connecting"), H = ie(() => l.value === "disconnected"), R = ie(() => l.value === "error"), U = ie(() => H.value || R.value), B = ie(() => {
1367
+ }, l = de(o.getConnectionStatus()), h = de(null), g = de(0), d = de(!1), A = de(!1), x = de(!1), m = de(!1);
1368
+ let y = null, E = null, R = null, S = null, f = null, v = null, b = null;
1369
+ const F = ie(() => l.value === "connected"), j = ie(() => l.value === "connecting"), B = ie(() => l.value === "disconnected"), P = ie(() => l.value === "error"), U = ie(() => B.value || P.value), $ = ie(() => {
1370
1370
  switch (l.value) {
1371
1371
  case "connecting":
1372
1372
  return g.value > 0 ? "Reconnecting..." : "Connecting...";
@@ -1391,7 +1391,7 @@ function Ia(e = {}) {
1391
1391
  default:
1392
1392
  return "medium";
1393
1393
  }
1394
- }), Y = ie(() => {
1394
+ }), K = ie(() => {
1395
1395
  switch (l.value) {
1396
1396
  case "connected":
1397
1397
  return u.connected;
@@ -1404,64 +1404,64 @@ function Ia(e = {}) {
1404
1404
  default:
1405
1405
  return u.unknown;
1406
1406
  }
1407
- }), W = async () => {
1407
+ }), se = async () => {
1408
1408
  Rn.debug("Manual reconnect triggered"), g.value += 1, await o.reconnect();
1409
- }, A = (L, $ = l.value) => {
1410
- if (L !== "connecting" && T && (clearTimeout(T), T = null), L === "disconnected" || L === "error") {
1411
- const re = !v.value && $ === L, je = !P.value && (re || $ === "connected" || $ === "connecting");
1409
+ }, w = (L, H = l.value) => {
1410
+ if (L !== "connecting" && E && (clearTimeout(E), E = null), L === "disconnected" || L === "error") {
1411
+ const re = !m.value && H === L, je = !A.value && (re || H === "connected" || H === "connecting");
1412
1412
  if (x.value = !0, je) {
1413
- d.value = !1, E && clearTimeout(E), E = setTimeout(() => {
1414
- E = null, l.value !== "connected" && (d.value = !0);
1413
+ d.value = !1, R && clearTimeout(R), R = setTimeout(() => {
1414
+ R = null, l.value !== "connected" && (d.value = !0);
1415
1415
  }, 2e3);
1416
1416
  return;
1417
1417
  }
1418
- E && (clearTimeout(E), E = null), d.value = !0;
1418
+ R && (clearTimeout(R), R = null), d.value = !0;
1419
1419
  return;
1420
1420
  }
1421
1421
  if (L === "connected") {
1422
- E && (clearTimeout(E), E = null), d.value = !1, P.value = !1, x.value = !1;
1422
+ R && (clearTimeout(R), R = null), d.value = !1, A.value = !1, x.value = !1;
1423
1423
  return;
1424
1424
  }
1425
1425
  if (L === "connecting") {
1426
- if (P.value) {
1426
+ if (A.value) {
1427
1427
  d.value = !0;
1428
1428
  return;
1429
1429
  }
1430
- if (x.value || (d.value = !1), T)
1430
+ if (x.value || (d.value = !1), E)
1431
1431
  return;
1432
- T = setTimeout(() => {
1433
- if (T = null, l.value === "connecting") {
1432
+ E = setTimeout(() => {
1433
+ if (E = null, l.value === "connecting") {
1434
1434
  if (Pn(o) === "connected") {
1435
1435
  M("connected");
1436
1436
  return;
1437
1437
  }
1438
- P.value = !0, Rn.warn("Still connecting after 10s, treating as disconnected"), M("disconnected"), g.value += 1, o.reconnect();
1438
+ A.value = !0, Rn.warn("Still connecting after 10s, treating as disconnected"), M("disconnected"), g.value += 1, o.reconnect();
1439
1439
  }
1440
1440
  }, 1e4);
1441
1441
  }
1442
1442
  }, M = (L) => {
1443
- const $ = l.value;
1444
- if (L === "connecting" && P.value) {
1445
- l.value = "disconnected", A("disconnected", $);
1443
+ const H = l.value;
1444
+ if (L === "connecting" && A.value) {
1445
+ l.value = "disconnected", w("disconnected", H);
1446
1446
  return;
1447
1447
  }
1448
- l.value = L, L === "connecting" && ($ === "disconnected" || $ === "error") && g.value === 0 && (g.value = 1), L === "connected" && (h.value = /* @__PURE__ */ new Date(), g.value = 0), A(L, $);
1449
- }, te = () => {
1450
- const L = Pn(o), $ = l.value;
1451
- if (L === "connected" && $ !== "connected") {
1448
+ l.value = L, L === "connecting" && (H === "disconnected" || H === "error") && g.value === 0 && (g.value = 1), L === "connected" && (h.value = /* @__PURE__ */ new Date(), g.value = 0), w(L, H);
1449
+ }, ee = () => {
1450
+ const L = Pn(o), H = l.value;
1451
+ if (L === "connected" && H !== "connected") {
1452
1452
  M("connected");
1453
1453
  return;
1454
1454
  }
1455
- if (L === "connecting" && $ !== "connecting") {
1455
+ if (L === "connecting" && H !== "connecting") {
1456
1456
  M("connecting");
1457
1457
  return;
1458
1458
  }
1459
- if ((L === "unavailable" || L === "failed" || L === "disconnected") && $ !== "disconnected") {
1459
+ if ((L === "unavailable" || L === "failed" || L === "disconnected") && H !== "disconnected") {
1460
1460
  M("disconnected");
1461
1461
  return;
1462
1462
  }
1463
1463
  const re = o.getConnectionStatus();
1464
- !L && re === "connected" && $ !== "connected" && M("connected");
1464
+ !L && re === "connected" && H !== "connected" && M("connected");
1465
1465
  }, C = () => {
1466
1466
  if (f?.unbind && b && (f.unbind("connected", b.connected), f.unbind("connecting", b.connecting), f.unbind("disconnected", b.disconnected), f.unbind("unavailable", b.unavailable), f.unbind("error", b.error), f.unbind("state_change", b.stateChange)), f = o.getEchoConnection(), b = null, !f?.bind)
1467
1467
  return;
@@ -1471,8 +1471,8 @@ function Ia(e = {}) {
1471
1471
  disconnected: () => M("disconnected"),
1472
1472
  unavailable: () => M("disconnected"),
1473
1473
  error: () => M("error"),
1474
- stateChange: ($) => {
1475
- const re = $?.current;
1474
+ stateChange: (H) => {
1475
+ const re = H?.current;
1476
1476
  if (re === "connected") {
1477
1477
  M("connected");
1478
1478
  return;
@@ -1497,32 +1497,32 @@ function Ia(e = {}) {
1497
1497
  }, O = ie(() => {
1498
1498
  if (!h.value || !F.value)
1499
1499
  return null;
1500
- const L = Date.now() - h.value.getTime(), $ = Math.floor(L / 6e4), re = Math.floor(L % 6e4 / 1e3);
1501
- return $ > 0 ? `${$}m ${re}s` : `${re}s`;
1500
+ const L = Date.now() - h.value.getTime(), H = Math.floor(L / 6e4), re = Math.floor(L % 6e4 / 1e3);
1501
+ return H > 0 ? `${H}m ${re}s` : `${re}s`;
1502
1502
  });
1503
1503
  return Un(() => {
1504
- l.value = o.getConnectionStatus(), y = o.onConnectionStatusChange(M), F.value && (h.value = /* @__PURE__ */ new Date()), A(l.value, l.value), v.value = !0, C(), m = () => {
1505
- C(), te();
1506
- }, window.addEventListener(o.initializedEvent, m), te(), S = setInterval(() => {
1507
- te();
1504
+ l.value = o.getConnectionStatus(), y = o.onConnectionStatusChange(M), F.value && (h.value = /* @__PURE__ */ new Date()), w(l.value, l.value), m.value = !0, C(), v = () => {
1505
+ C(), ee();
1506
+ }, window.addEventListener(o.initializedEvent, v), ee(), S = setInterval(() => {
1507
+ ee();
1508
1508
  }, 3e3);
1509
1509
  }), qe(() => {
1510
- y?.(), T && (clearTimeout(T), T = null), E && (clearTimeout(E), E = null), S && (clearInterval(S), S = null), m && (window.removeEventListener(o.initializedEvent, m), m = null), f?.unbind && b && (f.unbind("connected", b.connected), f.unbind("connecting", b.connecting), f.unbind("disconnected", b.disconnected), f.unbind("unavailable", b.unavailable), f.unbind("error", b.error), f.unbind("state_change", b.stateChange)), f = null, b = null;
1510
+ y?.(), E && (clearTimeout(E), E = null), R && (clearTimeout(R), R = null), S && (clearInterval(S), S = null), v && (window.removeEventListener(o.initializedEvent, v), v = null), f?.unbind && b && (f.unbind("connected", b.connected), f.unbind("connecting", b.connecting), f.unbind("disconnected", b.disconnected), f.unbind("unavailable", b.unavailable), f.unbind("error", b.error), f.unbind("state_change", b.stateChange)), f = null, b = null;
1511
1511
  }), {
1512
1512
  connectionStatus: ie(() => l.value),
1513
1513
  isConnected: F,
1514
1514
  isConnecting: j,
1515
- isDisconnected: H,
1516
- isError: R,
1515
+ isDisconnected: B,
1516
+ isError: P,
1517
1517
  hasConnectionIssues: U,
1518
- statusMessage: B,
1518
+ statusMessage: $,
1519
1519
  statusColor: z,
1520
- statusIcon: Y,
1520
+ statusIcon: K,
1521
1521
  showConnectionBanner: ie(() => d.value),
1522
1522
  lastConnectionTime: ie(() => h.value),
1523
1523
  connectionUptime: O,
1524
1524
  reconnectAttempts: ie(() => g.value),
1525
- reconnect: W
1525
+ reconnect: se
1526
1526
  };
1527
1527
  }
1528
1528
  const Zn = Mt;
@@ -1589,98 +1589,98 @@ function vo(e) {
1589
1589
  function bo() {
1590
1590
  zt = ns;
1591
1591
  }
1592
- const Ye = Dt()("GlobalMessaging"), yo = 3, _o = (e) => e.replace(/\/+$/, ""), So = (e) => _o(window.location.pathname) === `/messages/${e}`, Co = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
1593
- function La() {
1592
+ const Ye = Dt()("GlobalMessaging"), yo = 3, _o = (e) => e.replace(/\/+$/, ""), So = (e) => _o(window.location.pathname) === `/messages/${e}`, wo = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
1593
+ function Oa() {
1594
1594
  const e = Nt(), n = Pe()(), i = mo(), o = es(), u = hi(), l = xt(), { conversations: h } = ui(e), g = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Map();
1595
- let P = !1;
1596
- function x(R) {
1597
- const U = d.get(R);
1598
- if (U && (d.delete(R), typeof U.channel.stopListening == "function"))
1599
- for (const B of U.bindings)
1595
+ let A = !1;
1596
+ function x(P) {
1597
+ const U = d.get(P);
1598
+ if (U && (d.delete(P), typeof U.channel.stopListening == "function"))
1599
+ for (const $ of U.bindings)
1600
1600
  try {
1601
- U.channel.stopListening(B.event, B.handler);
1601
+ U.channel.stopListening($.event, $.handler);
1602
1602
  } catch {
1603
1603
  }
1604
1604
  }
1605
- function v() {
1606
- for (const R of g)
1607
- x(R), e.unregisterGlobalConversationSubscription(R);
1605
+ function m() {
1606
+ for (const P of g)
1607
+ x(P), e.unregisterGlobalConversationSubscription(P);
1608
1608
  g.clear();
1609
1609
  }
1610
- function y(R) {
1610
+ function y(P) {
1611
1611
  const U = Ae();
1612
- if (!U || g.has(R)) return;
1613
- const B = `conversation.${R}`;
1614
- x(R);
1615
- const z = U.private(B), Y = (M) => {
1612
+ if (!U || g.has(P)) return;
1613
+ const $ = `conversation.${P}`;
1614
+ x(P);
1615
+ const z = U.private($), K = (M) => {
1616
1616
  if (!Si(M)) {
1617
1617
  Ye.warn("Dropping malformed ConversationMessageSent event", M);
1618
1618
  return;
1619
1619
  }
1620
- const te = M, C = n.currentUser?.id;
1621
- if (!C || te.message.author_id === C) return;
1622
- e.addMessage(te.message);
1623
- const O = e.hasDetailSubscription(te.conversation_id), L = So(te.conversation_id);
1620
+ const ee = M, C = n.currentUser?.id;
1621
+ if (!C || ee.message.author_id === C) return;
1622
+ e.addMessage(ee.message);
1623
+ const O = e.hasDetailSubscription(ee.conversation_id), L = So(ee.conversation_id);
1624
1624
  if (O || L) {
1625
- const re = e.getConversationById(te.conversation_id);
1626
- re && (re.unread_count = 0), e.markAsRead(te.conversation_id).catch(() => {
1625
+ const re = e.getConversationById(ee.conversation_id);
1626
+ re && (re.unread_count = 0), e.markAsRead(ee.conversation_id).catch(() => {
1627
1627
  });
1628
1628
  return;
1629
1629
  }
1630
- const $ = e.getConversationById(te.conversation_id);
1631
- if ($) {
1632
- const re = Co($);
1633
- re || $.unread_count++, i(re);
1630
+ const H = e.getConversationById(ee.conversation_id);
1631
+ if (H) {
1632
+ const re = wo(H);
1633
+ re || H.unread_count++, i(re);
1634
1634
  }
1635
- }, W = (M) => {
1636
- if (!Ci(M)) {
1635
+ }, se = (M) => {
1636
+ if (!wi(M)) {
1637
1637
  Ye.warn("Dropping malformed ConversationMessageRead event", M);
1638
1638
  return;
1639
1639
  }
1640
1640
  e.applyParticipantReadState(M);
1641
- }, A = (M) => {
1642
- if (!wi(M)) {
1641
+ }, w = (M) => {
1642
+ if (!Ci(M)) {
1643
1643
  Ye.warn("Dropping malformed ConversationRequestAccepted event", M);
1644
1644
  return;
1645
1645
  }
1646
- const te = M, C = e.getConversationById(te.conversation_id);
1646
+ const ee = M, C = e.getConversationById(ee.conversation_id);
1647
1647
  C && (C.is_request = !1), e.requests = e.requests.filter(
1648
- (O) => O.id !== te.conversation_id
1648
+ (O) => O.id !== ee.conversation_id
1649
1649
  );
1650
1650
  };
1651
- z.listen(".ConversationMessageSent", Y), z.listen(".ConversationMessageRead", W), z.listen(".ConversationRequestAccepted", A), d.set(R, {
1651
+ z.listen(".ConversationMessageSent", K), z.listen(".ConversationMessageRead", se), z.listen(".ConversationRequestAccepted", w), d.set(P, {
1652
1652
  channel: z,
1653
1653
  bindings: [
1654
- { event: ".ConversationMessageSent", handler: Y },
1655
- { event: ".ConversationMessageRead", handler: W },
1656
- { event: ".ConversationRequestAccepted", handler: A }
1654
+ { event: ".ConversationMessageSent", handler: K },
1655
+ { event: ".ConversationMessageRead", handler: se },
1656
+ { event: ".ConversationRequestAccepted", handler: w }
1657
1657
  ]
1658
- }), g.add(R), e.registerGlobalConversationSubscription(R);
1658
+ }), g.add(P), e.registerGlobalConversationSubscription(P);
1659
1659
  }
1660
- function T() {
1661
- const R = Ae();
1662
- if (!R) {
1663
- v();
1660
+ function E() {
1661
+ const P = Ae();
1662
+ if (!P) {
1663
+ m();
1664
1664
  return;
1665
1665
  }
1666
1666
  for (const U of g) {
1667
1667
  x(U);
1668
1668
  try {
1669
- R.leave(`conversation.${U}`);
1669
+ P.leave(`conversation.${U}`);
1670
1670
  } catch {
1671
1671
  }
1672
1672
  e.unregisterGlobalConversationSubscription(U);
1673
1673
  }
1674
1674
  g.clear();
1675
1675
  }
1676
- function E() {
1677
- const R = Ae();
1678
- if (!R) return;
1679
- const U = e.conversations.slice(0, yo), B = new Set(U.map((z) => z.id));
1676
+ function R() {
1677
+ const P = Ae();
1678
+ if (!P) return;
1679
+ const U = e.conversations.slice(0, yo), $ = new Set(U.map((z) => z.id));
1680
1680
  for (const z of g)
1681
- if (!B.has(z) && !e.hasDetailSubscription(z)) {
1681
+ if (!$.has(z) && !e.hasDetailSubscription(z)) {
1682
1682
  try {
1683
- x(z), R.leave(`conversation.${z}`);
1683
+ x(z), P.leave(`conversation.${z}`);
1684
1684
  } catch {
1685
1685
  }
1686
1686
  g.delete(z), e.unregisterGlobalConversationSubscription(z);
@@ -1688,56 +1688,56 @@ function La() {
1688
1688
  for (const z of U)
1689
1689
  y(z.id);
1690
1690
  }
1691
- function S(R) {
1691
+ function S(P) {
1692
1692
  const U = xn({
1693
- status: R.status,
1694
- last_seen_at: R.last_seen_at ?? null
1693
+ status: P.status,
1694
+ last_seen_at: P.last_seen_at ?? null
1695
1695
  });
1696
1696
  U.status !== null && e.updatePresenceForUser(
1697
- R.user_id,
1697
+ P.user_id,
1698
1698
  U.status,
1699
1699
  U.lastSeenAt
1700
1700
  );
1701
1701
  }
1702
1702
  async function f() {
1703
- const R = [...new Set(
1703
+ const P = [...new Set(
1704
1704
  e.conversations.filter((U) => U.type === "dm" && typeof U.other_user_id == "string" && U.other_user_id.length > 0).map((U) => U.other_user_id)
1705
1705
  )];
1706
- if (R.length !== 0)
1706
+ if (P.length !== 0)
1707
1707
  try {
1708
1708
  const U = await o.get("/v1/presence/users", {
1709
- params: { ids: R }
1710
- }), B = U.data?.data?.items ?? U.data?.items ?? [];
1711
- for (const z of B) {
1712
- const Y = xn(z);
1713
- Y.status !== null && e.updatePresenceForUser(z.id, Y.status, Y.lastSeenAt);
1709
+ params: { ids: P }
1710
+ }), $ = U.data?.data?.items ?? U.data?.items ?? [];
1711
+ for (const z of $) {
1712
+ const K = xn(z);
1713
+ K.status !== null && e.updatePresenceForUser(z.id, K.status, K.lastSeenAt);
1714
1714
  }
1715
1715
  } catch (U) {
1716
1716
  Ye.warn("Failed to refresh messaging presence snapshot", U);
1717
1717
  }
1718
1718
  }
1719
- function m() {
1720
- !Ae() || P || (fi(S), P = !0);
1719
+ function v() {
1720
+ !Ae() || A || (fi(S), A = !0);
1721
1721
  }
1722
1722
  function b() {
1723
- P && (pi(), P = !1);
1723
+ A && (pi(), A = !1);
1724
1724
  }
1725
1725
  const F = fn(
1726
1726
  h,
1727
1727
  () => {
1728
- E();
1728
+ R();
1729
1729
  },
1730
1730
  { deep: !1, immediate: !0 }
1731
1731
  ), j = fn(
1732
1732
  () => u.fullPath,
1733
1733
  () => {
1734
- E();
1734
+ R();
1735
1735
  }
1736
- ), H = it((R) => {
1737
- R === "connected" ? (v(), E(), b(), m(), f()) : (R === "disconnected" || R === "error") && (v(), b());
1736
+ ), B = it((P) => {
1737
+ P === "connected" ? (m(), R(), b(), v(), f()) : (P === "disconnected" || P === "error") && (m(), b());
1738
1738
  });
1739
- E(), m(), f(), l !== null && qe(() => {
1740
- F(), j(), H(), T(), b();
1739
+ R(), v(), f(), l !== null && qe(() => {
1740
+ F(), j(), B(), E(), b();
1741
1741
  });
1742
1742
  }
1743
1743
  const ss = {
@@ -1750,10 +1750,11 @@ const ss = {
1750
1750
  idleAfterMs: 6e4,
1751
1751
  activityDebounceMs: 5e3,
1752
1752
  heartbeatIntervalMs: 3e4,
1753
- userAgentResolver: () => navigator.userAgent.slice(0, 256)
1753
+ userAgentResolver: () => navigator.userAgent.slice(0, 256),
1754
+ authTokenResolver: () => null
1754
1755
  };
1755
1756
  let st = { ...ss };
1756
- function wo() {
1757
+ function Co() {
1757
1758
  return st;
1758
1759
  }
1759
1760
  function To(e) {
@@ -1793,7 +1794,7 @@ function Lo(e) {
1793
1794
  const i = n.data;
1794
1795
  return Fe(i) && typeof i.code == "string" ? i.code : null;
1795
1796
  }
1796
- function wt(e) {
1797
+ function Ct(e) {
1797
1798
  const n = Io(e), i = Lo(e);
1798
1799
  return n === Ro && i === Po || n === Ao && i === xo;
1799
1800
  }
@@ -1824,111 +1825,150 @@ function No(e, n = Date.now()) {
1824
1825
  function Fo(e) {
1825
1826
  ze()?.removeItem(e);
1826
1827
  }
1827
- function Ua() {
1828
- const e = Pe()(), n = wo(), i = es(), o = Uo(n.clientIdStorageKey);
1829
- let u = null, l = null, h = !1, g = Tt(n.accountLimitedUntilStorageKey), d = !1, P = null, x = 0;
1830
- const v = () => {
1828
+ function Do(e) {
1829
+ return e.startsWith("/v1/") ? `/api${e}` : e;
1830
+ }
1831
+ function qo(e, n, i) {
1832
+ if (typeof fetch > "u")
1833
+ return null;
1834
+ const o = {
1835
+ Accept: "application/json",
1836
+ "Content-Type": "application/json"
1837
+ };
1838
+ i && (o.Authorization = `Bearer ${i}`);
1839
+ try {
1840
+ return fetch(Do(e), {
1841
+ method: "POST",
1842
+ headers: o,
1843
+ body: JSON.stringify({ client_id: n }),
1844
+ keepalive: !0,
1845
+ credentials: "same-origin"
1846
+ }).then(() => {
1847
+ });
1848
+ } catch {
1849
+ return null;
1850
+ }
1851
+ }
1852
+ function Na() {
1853
+ const e = Pe()(), n = Co(), i = es(), o = Uo(n.clientIdStorageKey);
1854
+ let u = null, l = null, h = !1, g = Tt(n.accountLimitedUntilStorageKey), d = !1, A = null, x = 0;
1855
+ const m = () => {
1831
1856
  u && (clearInterval(u), u = null);
1832
1857
  }, y = () => {
1833
1858
  l && (clearTimeout(l), l = null);
1834
- }, T = () => {
1835
- v(), u = setInterval(() => {
1859
+ }, E = () => {
1860
+ m(), u = setInterval(() => {
1836
1861
  U();
1837
1862
  }, n.heartbeatIntervalMs);
1838
- }, E = (W) => {
1839
- g || console.warn(W), No(n.accountLimitedUntilStorageKey), g = !0, h = !1, P = null, v(), y();
1840
- }, S = async (W) => {
1841
- if (!(!h || d || g) && P !== W)
1863
+ }, R = (w) => {
1864
+ g || console.warn(w), No(n.accountLimitedUntilStorageKey), g = !0, h = !1, A = null, m(), y();
1865
+ }, S = async (w) => {
1866
+ if (!(!h || d || g) && A !== w)
1842
1867
  try {
1843
- await i.patch(n.statusUrl, { status: W }), P = W;
1844
- } catch (A) {
1845
- wt(A) && E("[Presence] Presence updates paused: account is temporarily limited");
1868
+ await i.patch(n.statusUrl, { status: w }), A = w;
1869
+ } catch (M) {
1870
+ Ct(M) && R("[Presence] Presence updates paused: account is temporarily limited");
1846
1871
  }
1847
1872
  }, f = () => {
1848
1873
  y(), !(!h || d || g || document.visibilityState !== "visible") && (l = setTimeout(() => {
1849
1874
  l = null, S("idle");
1850
1875
  }, n.idleAfterMs));
1851
- }, m = () => {
1876
+ }, v = () => {
1852
1877
  if (d || !h || g || document.visibilityState !== "visible")
1853
1878
  return;
1854
- const W = Date.now();
1855
- W - x < n.activityDebounceMs || (x = W, S("online"), f());
1879
+ const w = Date.now();
1880
+ w - x < n.activityDebounceMs || (x = w, S("online"), f());
1856
1881
  }, b = () => {
1857
- m();
1882
+ v();
1858
1883
  }, F = () => {
1859
1884
  typeof document > "u" || typeof window > "u" || (document.addEventListener("pointerdown", b, { passive: !0 }), document.addEventListener("keydown", b), document.addEventListener("touchstart", b, { passive: !0 }), window.addEventListener("focus", b));
1860
1885
  }, j = () => {
1861
1886
  typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", b), document.removeEventListener("keydown", b), document.removeEventListener("touchstart", b), window.removeEventListener("focus", b));
1862
- }, H = async () => {
1887
+ }, B = async () => {
1863
1888
  if (Tt(n.accountLimitedUntilStorageKey))
1864
1889
  return g = !0, "account_limited";
1865
1890
  try {
1866
1891
  return await i.post(n.sessionOpenUrl, {
1867
1892
  client_id: o,
1868
1893
  user_agent: n.userAgentResolver()
1869
- }), Fo(n.accountLimitedUntilStorageKey), g = !1, h = !0, P = null, "opened";
1870
- } catch (W) {
1871
- return wt(W) ? (E("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : "failed";
1894
+ }), Fo(n.accountLimitedUntilStorageKey), g = !1, h = !0, A = null, "opened";
1895
+ } catch (w) {
1896
+ return Ct(w) ? (R("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : "failed";
1872
1897
  }
1873
- }, R = async () => {
1874
- for (let W = 0; W < Mo; W += 1)
1875
- if (await H() !== "failed")
1898
+ }, P = async () => {
1899
+ for (let w = 0; w < Mo; w += 1)
1900
+ if (await B() !== "failed")
1876
1901
  return;
1877
1902
  console.warn("[Presence] Failed to open session");
1878
1903
  }, U = async () => {
1879
1904
  if (h)
1880
1905
  try {
1881
1906
  await i.post(n.sessionHeartbeatUrl, { client_id: o });
1882
- } catch (W) {
1883
- wt(W) && E("[Presence] Heartbeat paused: account is temporarily limited");
1907
+ } catch (w) {
1908
+ Ct(w) && R("[Presence] Heartbeat paused: account is temporarily limited");
1884
1909
  }
1885
- }, B = () => {
1886
- h && (h = !1, y(), i.post(n.sessionCloseUrl, { client_id: o }).catch(() => {
1887
- }));
1910
+ }, $ = () => {
1911
+ if (!h)
1912
+ return;
1913
+ h = !1, A = null, y();
1914
+ const w = qo(
1915
+ n.sessionCloseUrl,
1916
+ o,
1917
+ n.authTokenResolver()
1918
+ );
1919
+ if (w) {
1920
+ w.catch(() => {
1921
+ });
1922
+ return;
1923
+ }
1924
+ i.post(n.sessionCloseUrl, { client_id: o }).catch(() => {
1925
+ });
1888
1926
  }, z = async () => {
1889
1927
  if (!d) {
1890
- if (await R(), d) {
1891
- B();
1928
+ if (await P(), d) {
1929
+ $();
1892
1930
  return;
1893
1931
  }
1894
- h && (T(), S("online"), f());
1932
+ h && (E(), S("online"), f());
1895
1933
  }
1896
- }, Y = () => {
1934
+ }, K = () => {
1897
1935
  if (!d) {
1898
1936
  if (document.visibilityState === "hidden") {
1899
- B(), v(), y();
1937
+ $(), m(), y();
1900
1938
  return;
1901
1939
  }
1902
1940
  if (document.visibilityState === "visible" && !h) {
1903
1941
  g = Tt(n.accountLimitedUntilStorageKey), g || z();
1904
1942
  return;
1905
1943
  }
1906
- document.visibilityState === "visible" && h && !g && m();
1944
+ document.visibilityState === "visible" && h && !g && v();
1907
1945
  }
1946
+ }, se = () => {
1947
+ d || ($(), m(), y());
1908
1948
  };
1909
1949
  Un(async () => {
1910
1950
  if (e.isAuthenticated ?? e.currentUser !== null) {
1911
- if (await R(), d) {
1912
- B();
1951
+ if (await P(), d) {
1952
+ $();
1913
1953
  return;
1914
1954
  }
1915
- h && (T(), S("online"), f()), F(), document.addEventListener("visibilitychange", Y);
1955
+ h && (E(), S("online"), f()), F(), document.addEventListener("visibilitychange", K), window.addEventListener("pagehide", se), window.addEventListener("beforeunload", se);
1916
1956
  }
1917
1957
  }), qe(() => {
1918
- d = !0, j(), y(), v(), B(), document.removeEventListener("visibilitychange", Y);
1958
+ d = !0, j(), y(), m(), $(), document.removeEventListener("visibilitychange", K), window.removeEventListener("pagehide", se), window.removeEventListener("beforeunload", se);
1919
1959
  });
1920
1960
  }
1921
- const Do = 12e3, qo = 250, zo = 20;
1922
- function Oa(e) {
1923
- const n = Nt(), i = Pe()(), o = de(!1), u = de(null), l = de(null), h = de([]), g = /* @__PURE__ */ new Map(), d = xt(), P = d !== null;
1924
- let x = 0, v = null, y = null;
1925
- const T = ie(() => i.currentUser?.id), E = () => Ln(e)?.trim() ?? "", S = () => {
1961
+ const zo = 12e3, jo = 250, $o = 20;
1962
+ function Fa(e) {
1963
+ const n = Nt(), i = Pe()(), o = de(!1), u = de(null), l = de(null), h = de([]), g = /* @__PURE__ */ new Map(), d = xt(), A = d !== null;
1964
+ let x = 0, m = null, y = null;
1965
+ const E = ie(() => i.currentUser?.id), R = () => Ln(e)?.trim() ?? "", S = () => {
1926
1966
  const C = l.value?.trim() ?? "";
1927
1967
  if (C.length > 0)
1928
1968
  return C;
1929
- const O = E();
1969
+ const O = R();
1930
1970
  return O.length > 0 && (l.value = O), O;
1931
- }, f = (C) => n.getTypingUsers(C), m = (C) => {
1971
+ }, f = (C) => n.getTypingUsers(C), v = (C) => {
1932
1972
  const O = f(C);
1933
1973
  for (const L of O)
1934
1974
  n.removeTypingUser(C, L.id);
@@ -1943,40 +1983,40 @@ function Oa(e) {
1943
1983
  }, j = (C, O) => {
1944
1984
  b(C);
1945
1985
  const L = setTimeout(() => {
1946
- g.delete(C), n.removeTypingUser(O, C), h.value = h.value.filter(($) => $.id !== C);
1947
- }, Do);
1986
+ g.delete(C), n.removeTypingUser(O, C), h.value = h.value.filter((H) => H.id !== C);
1987
+ }, zo);
1948
1988
  g.set(C, L);
1949
- }, H = () => {
1950
- v && (clearTimeout(v), v = null), x = 0;
1951
- }, R = () => {
1952
- const C = E();
1989
+ }, B = () => {
1990
+ m && (clearTimeout(m), m = null), x = 0;
1991
+ }, P = () => {
1992
+ const C = R();
1953
1993
  if (!(o.value || !C)) {
1954
1994
  if (u.value = null, !Ae()) {
1955
- P && !v && x < zo && (v = setTimeout(() => {
1956
- v = null, x += 1, R();
1957
- }, qo));
1995
+ A && !m && x < $o && (m = setTimeout(() => {
1996
+ m = null, x += 1, P();
1997
+ }, jo));
1958
1998
  return;
1959
1999
  }
1960
2000
  try {
1961
2001
  y && (y(), y = null), y = vi(C, {
1962
- onTypingStart: B,
2002
+ onTypingStart: $,
1963
2003
  onTypingStop: z
1964
- }), o.value = !0, l.value = C, H();
2004
+ }), o.value = !0, l.value = C, B();
1965
2005
  } catch (O) {
1966
2006
  u.value = O instanceof Error ? O.message : "Failed to subscribe to typing channel";
1967
2007
  }
1968
2008
  }
1969
2009
  }, U = () => {
1970
2010
  const C = l.value;
1971
- if (H(), !(!o.value || !C))
2011
+ if (B(), !(!o.value || !C))
1972
2012
  try {
1973
- y && (y(), y = null), bi(C), F(), m(C), o.value = !1, l.value = null, u.value = null;
2013
+ y && (y(), y = null), bi(C), F(), v(C), o.value = !1, l.value = null, u.value = null;
1974
2014
  } catch (O) {
1975
2015
  u.value = O instanceof Error ? O.message : "Failed to unsubscribe from typing channel";
1976
2016
  }
1977
2017
  };
1978
- function B(C) {
1979
- if (C.user_id === T.value)
2018
+ function $(C) {
2019
+ if (C.user_id === E.value)
1980
2020
  return;
1981
2021
  const O = S();
1982
2022
  if (!O)
@@ -1986,16 +2026,16 @@ function Oa(e) {
1986
2026
  name: C.user.name,
1987
2027
  ...C.user.avatar !== void 0 ? { avatar: C.user.avatar } : {}
1988
2028
  };
1989
- h.value.some(($) => $.id === L.id) || (h.value = [...h.value, L]), n.addTypingUser(O, L), j(C.user_id, O);
2029
+ h.value.some((H) => H.id === L.id) || (h.value = [...h.value, L]), n.addTypingUser(O, L), j(C.user_id, O);
1990
2030
  }
1991
2031
  function z(C) {
1992
- if (C.user_id === T.value)
2032
+ if (C.user_id === E.value)
1993
2033
  return;
1994
2034
  b(C.user_id);
1995
2035
  const O = S();
1996
2036
  O && (h.value = h.value.filter((L) => L.id !== C.user_id), n.removeTypingUser(O, C.user_id));
1997
2037
  }
1998
- const Y = ie(() => {
2038
+ const K = ie(() => {
1999
2039
  const C = S();
2000
2040
  if (!C)
2001
2041
  return h.value;
@@ -2005,13 +2045,13 @@ function Oa(e) {
2005
2045
  if (O.length === 0)
2006
2046
  return h.value;
2007
2047
  const L = /* @__PURE__ */ new Map();
2008
- for (const $ of O)
2009
- L.set($.id, $);
2010
- for (const $ of h.value)
2011
- L.set($.id, $);
2048
+ for (const H of O)
2049
+ L.set(H.id, H);
2050
+ for (const H of h.value)
2051
+ L.set(H.id, H);
2012
2052
  return [...L.values()];
2013
- }), W = ie(() => {
2014
- const C = Y.value;
2053
+ }), se = ie(() => {
2054
+ const C = K.value;
2015
2055
  if (C.length === 0)
2016
2056
  return "";
2017
2057
  const O = C[0];
@@ -2024,39 +2064,39 @@ function Oa(e) {
2024
2064
  return `${C.length} people are typing...`;
2025
2065
  if (C.length === 2)
2026
2066
  return `${O.name} and ${L.name} are typing...`;
2027
- const $ = C[2];
2028
- return $ ? C.length === 3 ? `${O.name}, ${L.name} and ${$.name} are typing...` : `${C.length} people are typing...` : `${C.length} people are typing...`;
2029
- }), A = ie(() => Y.value.length > 0), M = () => {
2030
- o.value || R();
2067
+ const H = C[2];
2068
+ return H ? C.length === 3 ? `${O.name}, ${L.name} and ${H.name} are typing...` : `${C.length} people are typing...` : `${C.length} people are typing...`;
2069
+ }), w = ie(() => K.value.length > 0), M = () => {
2070
+ o.value || P();
2031
2071
  };
2032
2072
  typeof window < "u" && window.addEventListener(De(), M);
2033
- const te = it((C) => {
2073
+ const ee = it((C) => {
2034
2074
  if (C === "connected") {
2035
- o.value || R();
2075
+ o.value || P();
2036
2076
  return;
2037
2077
  }
2038
2078
  if (C === "disconnected" || C === "error") {
2039
- H(), y && (y(), y = null);
2079
+ B(), y && (y(), y = null);
2040
2080
  const O = S();
2041
- O && m(O), o.value = !1, l.value = null, F();
2081
+ O && v(O), o.value = !1, l.value = null, F();
2042
2082
  }
2043
2083
  });
2044
2084
  return d !== null && qe(() => {
2045
- H(), te(), F(), U(), typeof window < "u" && window.removeEventListener(De(), M);
2085
+ B(), ee(), F(), U(), typeof window < "u" && window.removeEventListener(De(), M);
2046
2086
  }), {
2047
2087
  isSubscribed: ie(() => o.value),
2048
2088
  error: ie(() => u.value),
2049
- typingUsers: Y,
2050
- formatTypingIndicator: W,
2051
- hasTypingUsers: A,
2052
- subscribe: R,
2089
+ typingUsers: K,
2090
+ formatTypingIndicator: se,
2091
+ hasTypingUsers: w,
2092
+ subscribe: P,
2053
2093
  unsubscribe: U
2054
2094
  };
2055
2095
  }
2056
- function Na(e) {
2096
+ function Da(e) {
2057
2097
  e.apiClient && Ti(e.apiClient), e.mainApiClient && uo(e.mainApiClient), e.authStore && Ri(e.authStore), e.mediaApi && xi(e.mediaApi), e.createLogger && io(e.createLogger), e.playMessageNotification && vo(e.playMessageNotification), e.echo && yi(e.echo), e.mainEcho && no(e.mainEcho), e.presence && To(e.presence);
2058
2098
  }
2059
- function Fa() {
2099
+ function qa() {
2060
2100
  Ei(), lo(), Ai(), Mi(), oo(), bo(), _i(), so(), Eo();
2061
2101
  }
2062
2102
  class jt {
@@ -2108,7 +2148,7 @@ class rs {
2108
2148
  this.namespace = n;
2109
2149
  }
2110
2150
  }
2111
- function jo(e) {
2151
+ function Ho(e) {
2112
2152
  try {
2113
2153
  new e();
2114
2154
  } catch (n) {
@@ -2205,7 +2245,7 @@ class is extends $t {
2205
2245
  ), this;
2206
2246
  }
2207
2247
  }
2208
- class $o extends $t {
2248
+ class Bo extends $t {
2209
2249
  /**
2210
2250
  * Send a whisper event to other clients in the channel.
2211
2251
  */
@@ -2216,7 +2256,7 @@ class $o extends $t {
2216
2256
  ), this;
2217
2257
  }
2218
2258
  }
2219
- class Ho extends is {
2259
+ class Vo extends is {
2220
2260
  /**
2221
2261
  * Register a callback to be called anytime the member list changes.
2222
2262
  */
@@ -2339,7 +2379,7 @@ class as extends os {
2339
2379
  }), this;
2340
2380
  }
2341
2381
  }
2342
- class Bo extends as {
2382
+ class Xo extends as {
2343
2383
  /**
2344
2384
  * Register a callback to be called anytime the member list changes.
2345
2385
  */
@@ -2433,7 +2473,7 @@ class cs extends rt {
2433
2473
  return this;
2434
2474
  }
2435
2475
  }
2436
- class Vo extends rt {
2476
+ class Wo extends rt {
2437
2477
  /**
2438
2478
  * Send a whisper event to other clients in the channel.
2439
2479
  */
@@ -2441,7 +2481,7 @@ class Vo extends rt {
2441
2481
  return this;
2442
2482
  }
2443
2483
  }
2444
- class Xo extends cs {
2484
+ class Go extends cs {
2445
2485
  /**
2446
2486
  * Register a callback to be called anytime the member list changes.
2447
2487
  */
@@ -2568,7 +2608,7 @@ class Qe extends Ht {
2568
2608
  * Get a private encrypted channel instance by name.
2569
2609
  */
2570
2610
  encryptedPrivateChannel(n) {
2571
- return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new $o(
2611
+ return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new Bo(
2572
2612
  this.pusher,
2573
2613
  "private-encrypted-" + n,
2574
2614
  this.options
@@ -2578,7 +2618,7 @@ class Qe extends Ht {
2578
2618
  * Get a presence channel instance by name.
2579
2619
  */
2580
2620
  presenceChannel(n) {
2581
- return this.channels["presence-" + n] || (this.channels["presence-" + n] = new Ho(
2621
+ return this.channels["presence-" + n] || (this.channels["presence-" + n] = new Vo(
2582
2622
  this.pusher,
2583
2623
  "presence-" + n,
2584
2624
  this.options
@@ -2647,7 +2687,7 @@ class Qe extends Ht {
2647
2687
  this.pusher.disconnect();
2648
2688
  }
2649
2689
  }
2650
- class Wo extends Ht {
2690
+ class Jo extends Ht {
2651
2691
  constructor() {
2652
2692
  super(...arguments), this.channels = {};
2653
2693
  }
@@ -2707,7 +2747,7 @@ class Wo extends Ht {
2707
2747
  * Get a presence channel instance by name.
2708
2748
  */
2709
2749
  presenceChannel(n) {
2710
- return this.channels["presence-" + n] || (this.channels["presence-" + n] = new Bo(
2750
+ return this.channels["presence-" + n] || (this.channels["presence-" + n] = new Xo(
2711
2751
  this.socket,
2712
2752
  "presence-" + n,
2713
2753
  this.options
@@ -2800,13 +2840,13 @@ class Mn extends Ht {
2800
2840
  * Get a private encrypted channel instance by name.
2801
2841
  */
2802
2842
  encryptedPrivateChannel(n) {
2803
- return new Vo();
2843
+ return new Wo();
2804
2844
  }
2805
2845
  /**
2806
2846
  * Get a presence channel instance by name.
2807
2847
  */
2808
2848
  presenceChannel(n) {
2809
- return new Xo();
2849
+ return new Go();
2810
2850
  }
2811
2851
  /**
2812
2852
  * Leave the given channel, as well as its private and presence variants.
@@ -2843,7 +2883,7 @@ class Mn extends Ht {
2843
2883
  disconnect() {
2844
2884
  }
2845
2885
  }
2846
- class Go {
2886
+ class Ko {
2847
2887
  /**
2848
2888
  * Create a new class instance.
2849
2889
  */
@@ -2874,10 +2914,10 @@ class Go {
2874
2914
  broadcaster: "pusher"
2875
2915
  });
2876
2916
  else if (this.options.broadcaster === "socket.io")
2877
- this.connector = new Wo(this.options);
2917
+ this.connector = new Jo(this.options);
2878
2918
  else if (this.options.broadcaster === "null")
2879
2919
  this.connector = new Mn(this.options);
2880
- else if (typeof this.options.broadcaster == "function" && jo(this.options.broadcaster))
2920
+ else if (typeof this.options.broadcaster == "function" && Ho(this.options.broadcaster))
2881
2921
  this.connector = new this.options.broadcaster(this.options);
2882
2922
  else
2883
2923
  throw new Error(
@@ -3001,12 +3041,12 @@ class Go {
3001
3041
  );
3002
3042
  }
3003
3043
  }
3004
- function Jo(e) {
3044
+ function Yo(e) {
3005
3045
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
3006
3046
  }
3007
3047
  var Et = { exports: {} };
3008
3048
  var kn;
3009
- function Ko() {
3049
+ function Qo() {
3010
3050
  return kn || (kn = 1, (function(e, n) {
3011
3051
  (function(o, u) {
3012
3052
  e.exports = u();
@@ -3036,8 +3076,8 @@ function Ko() {
3036
3076
  }, u.t = function(l, h) {
3037
3077
  if (h & 1 && (l = u(l)), h & 8 || h & 4 && typeof l == "object" && l && l.__esModule) return l;
3038
3078
  var g = /* @__PURE__ */ Object.create(null);
3039
- if (u.r(g), Object.defineProperty(g, "default", { enumerable: !0, value: l }), h & 2 && typeof l != "string") for (var d in l) u.d(g, d, (function(P) {
3040
- return l[P];
3079
+ if (u.r(g), Object.defineProperty(g, "default", { enumerable: !0, value: l }), h & 2 && typeof l != "string") for (var d in l) u.d(g, d, (function(A) {
3080
+ return l[A];
3041
3081
  }).bind(null, d));
3042
3082
  return g;
3043
3083
  }, u.n = function(l) {
@@ -3061,19 +3101,19 @@ function Ko() {
3061
3101
  /***/
3062
3102
  (function(i, o, u) {
3063
3103
  var l = this && this.__extends || /* @__PURE__ */ (function() {
3064
- var S = function(f, m) {
3104
+ var S = function(f, v) {
3065
3105
  return S = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(b, F) {
3066
3106
  b.__proto__ = F;
3067
3107
  } || function(b, F) {
3068
3108
  for (var j in F) F.hasOwnProperty(j) && (b[j] = F[j]);
3069
- }, S(f, m);
3109
+ }, S(f, v);
3070
3110
  };
3071
- return function(f, m) {
3072
- S(f, m);
3111
+ return function(f, v) {
3112
+ S(f, v);
3073
3113
  function b() {
3074
3114
  this.constructor = f;
3075
3115
  }
3076
- f.prototype = m === null ? Object.create(m) : (b.prototype = m.prototype, new b());
3116
+ f.prototype = v === null ? Object.create(v) : (b.prototype = v.prototype, new b());
3077
3117
  };
3078
3118
  })();
3079
3119
  Object.defineProperty(o, "__esModule", { value: !0 });
@@ -3086,16 +3126,16 @@ function Ko() {
3086
3126
  return S.prototype.encodedLength = function(f) {
3087
3127
  return this._paddingCharacter ? (f + 2) / 3 * 4 | 0 : (f * 8 + 5) / 6 | 0;
3088
3128
  }, S.prototype.encode = function(f) {
3089
- for (var m = "", b = 0; b < f.length - 2; b += 3) {
3129
+ for (var v = "", b = 0; b < f.length - 2; b += 3) {
3090
3130
  var F = f[b] << 16 | f[b + 1] << 8 | f[b + 2];
3091
- m += this._encodeByte(F >>> 18 & 63), m += this._encodeByte(F >>> 12 & 63), m += this._encodeByte(F >>> 6 & 63), m += this._encodeByte(F >>> 0 & 63);
3131
+ v += this._encodeByte(F >>> 18 & 63), v += this._encodeByte(F >>> 12 & 63), v += this._encodeByte(F >>> 6 & 63), v += this._encodeByte(F >>> 0 & 63);
3092
3132
  }
3093
3133
  var j = f.length - b;
3094
3134
  if (j > 0) {
3095
3135
  var F = f[b] << 16 | (j === 2 ? f[b + 1] << 8 : 0);
3096
- m += this._encodeByte(F >>> 18 & 63), m += this._encodeByte(F >>> 12 & 63), j === 2 ? m += this._encodeByte(F >>> 6 & 63) : m += this._paddingCharacter || "", m += this._paddingCharacter || "";
3136
+ v += this._encodeByte(F >>> 18 & 63), v += this._encodeByte(F >>> 12 & 63), j === 2 ? v += this._encodeByte(F >>> 6 & 63) : v += this._paddingCharacter || "", v += this._paddingCharacter || "";
3097
3137
  }
3098
- return m;
3138
+ return v;
3099
3139
  }, S.prototype.maxDecodedLength = function(f) {
3100
3140
  return this._paddingCharacter ? f / 4 * 3 | 0 : (f * 6 + 7) / 8 | 0;
3101
3141
  }, S.prototype.decodedLength = function(f) {
@@ -3103,65 +3143,65 @@ function Ko() {
3103
3143
  }, S.prototype.decode = function(f) {
3104
3144
  if (f.length === 0)
3105
3145
  return new Uint8Array(0);
3106
- for (var m = this._getPaddingLength(f), b = f.length - m, F = new Uint8Array(this.maxDecodedLength(b)), j = 0, H = 0, R = 0, U = 0, B = 0, z = 0, Y = 0; H < b - 4; H += 4)
3107
- U = this._decodeChar(f.charCodeAt(H + 0)), B = this._decodeChar(f.charCodeAt(H + 1)), z = this._decodeChar(f.charCodeAt(H + 2)), Y = this._decodeChar(f.charCodeAt(H + 3)), F[j++] = U << 2 | B >>> 4, F[j++] = B << 4 | z >>> 2, F[j++] = z << 6 | Y, R |= U & h, R |= B & h, R |= z & h, R |= Y & h;
3108
- if (H < b - 1 && (U = this._decodeChar(f.charCodeAt(H)), B = this._decodeChar(f.charCodeAt(H + 1)), F[j++] = U << 2 | B >>> 4, R |= U & h, R |= B & h), H < b - 2 && (z = this._decodeChar(f.charCodeAt(H + 2)), F[j++] = B << 4 | z >>> 2, R |= z & h), H < b - 3 && (Y = this._decodeChar(f.charCodeAt(H + 3)), F[j++] = z << 6 | Y, R |= Y & h), R !== 0)
3146
+ for (var v = this._getPaddingLength(f), b = f.length - v, F = new Uint8Array(this.maxDecodedLength(b)), j = 0, B = 0, P = 0, U = 0, $ = 0, z = 0, K = 0; B < b - 4; B += 4)
3147
+ U = this._decodeChar(f.charCodeAt(B + 0)), $ = this._decodeChar(f.charCodeAt(B + 1)), z = this._decodeChar(f.charCodeAt(B + 2)), K = this._decodeChar(f.charCodeAt(B + 3)), F[j++] = U << 2 | $ >>> 4, F[j++] = $ << 4 | z >>> 2, F[j++] = z << 6 | K, P |= U & h, P |= $ & h, P |= z & h, P |= K & h;
3148
+ if (B < b - 1 && (U = this._decodeChar(f.charCodeAt(B)), $ = this._decodeChar(f.charCodeAt(B + 1)), F[j++] = U << 2 | $ >>> 4, P |= U & h, P |= $ & h), B < b - 2 && (z = this._decodeChar(f.charCodeAt(B + 2)), F[j++] = $ << 4 | z >>> 2, P |= z & h), B < b - 3 && (K = this._decodeChar(f.charCodeAt(B + 3)), F[j++] = z << 6 | K, P |= K & h), P !== 0)
3109
3149
  throw new Error("Base64Coder: incorrect characters for decoding");
3110
3150
  return F;
3111
3151
  }, S.prototype._encodeByte = function(f) {
3112
- var m = f;
3113
- return m += 65, m += 25 - f >>> 8 & 6, m += 51 - f >>> 8 & -75, m += 61 - f >>> 8 & -15, m += 62 - f >>> 8 & 3, String.fromCharCode(m);
3152
+ var v = f;
3153
+ return v += 65, v += 25 - f >>> 8 & 6, v += 51 - f >>> 8 & -75, v += 61 - f >>> 8 & -15, v += 62 - f >>> 8 & 3, String.fromCharCode(v);
3114
3154
  }, S.prototype._decodeChar = function(f) {
3115
- var m = h;
3116
- return m += (42 - f & f - 44) >>> 8 & -h + f - 43 + 62, m += (46 - f & f - 48) >>> 8 & -h + f - 47 + 63, m += (47 - f & f - 58) >>> 8 & -h + f - 48 + 52, m += (64 - f & f - 91) >>> 8 & -h + f - 65 + 0, m += (96 - f & f - 123) >>> 8 & -h + f - 97 + 26, m;
3155
+ var v = h;
3156
+ return v += (42 - f & f - 44) >>> 8 & -h + f - 43 + 62, v += (46 - f & f - 48) >>> 8 & -h + f - 47 + 63, v += (47 - f & f - 58) >>> 8 & -h + f - 48 + 52, v += (64 - f & f - 91) >>> 8 & -h + f - 65 + 0, v += (96 - f & f - 123) >>> 8 & -h + f - 97 + 26, v;
3117
3157
  }, S.prototype._getPaddingLength = function(f) {
3118
- var m = 0;
3158
+ var v = 0;
3119
3159
  if (this._paddingCharacter) {
3120
3160
  for (var b = f.length - 1; b >= 0 && f[b] === this._paddingCharacter; b--)
3121
- m++;
3122
- if (f.length < 4 || m > 2)
3161
+ v++;
3162
+ if (f.length < 4 || v > 2)
3123
3163
  throw new Error("Base64Coder: incorrect padding");
3124
3164
  }
3125
- return m;
3165
+ return v;
3126
3166
  }, S;
3127
3167
  })()
3128
3168
  );
3129
3169
  o.Coder = g;
3130
3170
  var d = new g();
3131
- function P(S) {
3171
+ function A(S) {
3132
3172
  return d.encode(S);
3133
3173
  }
3134
- o.encode = P;
3174
+ o.encode = A;
3135
3175
  function x(S) {
3136
3176
  return d.decode(S);
3137
3177
  }
3138
3178
  o.decode = x;
3139
- var v = (
3179
+ var m = (
3140
3180
  /** @class */
3141
3181
  (function(S) {
3142
3182
  l(f, S);
3143
3183
  function f() {
3144
3184
  return S !== null && S.apply(this, arguments) || this;
3145
3185
  }
3146
- return f.prototype._encodeByte = function(m) {
3147
- var b = m;
3148
- return b += 65, b += 25 - m >>> 8 & 6, b += 51 - m >>> 8 & -75, b += 61 - m >>> 8 & -13, b += 62 - m >>> 8 & 49, String.fromCharCode(b);
3149
- }, f.prototype._decodeChar = function(m) {
3186
+ return f.prototype._encodeByte = function(v) {
3187
+ var b = v;
3188
+ return b += 65, b += 25 - v >>> 8 & 6, b += 51 - v >>> 8 & -75, b += 61 - v >>> 8 & -13, b += 62 - v >>> 8 & 49, String.fromCharCode(b);
3189
+ }, f.prototype._decodeChar = function(v) {
3150
3190
  var b = h;
3151
- return b += (44 - m & m - 46) >>> 8 & -h + m - 45 + 62, b += (94 - m & m - 96) >>> 8 & -h + m - 95 + 63, b += (47 - m & m - 58) >>> 8 & -h + m - 48 + 52, b += (64 - m & m - 91) >>> 8 & -h + m - 65 + 0, b += (96 - m & m - 123) >>> 8 & -h + m - 97 + 26, b;
3191
+ return b += (44 - v & v - 46) >>> 8 & -h + v - 45 + 62, b += (94 - v & v - 96) >>> 8 & -h + v - 95 + 63, b += (47 - v & v - 58) >>> 8 & -h + v - 48 + 52, b += (64 - v & v - 91) >>> 8 & -h + v - 65 + 0, b += (96 - v & v - 123) >>> 8 & -h + v - 97 + 26, b;
3152
3192
  }, f;
3153
3193
  })(g)
3154
3194
  );
3155
- o.URLSafeCoder = v;
3156
- var y = new v();
3157
- function T(S) {
3195
+ o.URLSafeCoder = m;
3196
+ var y = new m();
3197
+ function E(S) {
3158
3198
  return y.encode(S);
3159
3199
  }
3160
- o.encodeURLSafe = T;
3161
- function E(S) {
3200
+ o.encodeURLSafe = E;
3201
+ function R(S) {
3162
3202
  return y.decode(S);
3163
3203
  }
3164
- o.decodeURLSafe = E, o.encodedLength = function(S) {
3204
+ o.decodeURLSafe = R, o.encodedLength = function(S) {
3165
3205
  return d.encodedLength(S);
3166
3206
  }, o.maxDecodedLength = function(S) {
3167
3207
  return d.maxDecodedLength(S);
@@ -3175,73 +3215,73 @@ function Ko() {
3175
3215
  Object.defineProperty(o, "__esModule", { value: !0 });
3176
3216
  var l = "utf8: invalid string", h = "utf8: invalid source encoding";
3177
3217
  function g(x) {
3178
- for (var v = new Uint8Array(d(x)), y = 0, T = 0; T < x.length; T++) {
3179
- var E = x.charCodeAt(T);
3180
- E < 128 ? v[y++] = E : E < 2048 ? (v[y++] = 192 | E >> 6, v[y++] = 128 | E & 63) : E < 55296 ? (v[y++] = 224 | E >> 12, v[y++] = 128 | E >> 6 & 63, v[y++] = 128 | E & 63) : (T++, E = (E & 1023) << 10, E |= x.charCodeAt(T) & 1023, E += 65536, v[y++] = 240 | E >> 18, v[y++] = 128 | E >> 12 & 63, v[y++] = 128 | E >> 6 & 63, v[y++] = 128 | E & 63);
3218
+ for (var m = new Uint8Array(d(x)), y = 0, E = 0; E < x.length; E++) {
3219
+ var R = x.charCodeAt(E);
3220
+ R < 128 ? m[y++] = R : R < 2048 ? (m[y++] = 192 | R >> 6, m[y++] = 128 | R & 63) : R < 55296 ? (m[y++] = 224 | R >> 12, m[y++] = 128 | R >> 6 & 63, m[y++] = 128 | R & 63) : (E++, R = (R & 1023) << 10, R |= x.charCodeAt(E) & 1023, R += 65536, m[y++] = 240 | R >> 18, m[y++] = 128 | R >> 12 & 63, m[y++] = 128 | R >> 6 & 63, m[y++] = 128 | R & 63);
3181
3221
  }
3182
- return v;
3222
+ return m;
3183
3223
  }
3184
3224
  o.encode = g;
3185
3225
  function d(x) {
3186
- for (var v = 0, y = 0; y < x.length; y++) {
3187
- var T = x.charCodeAt(y);
3188
- if (T < 128)
3189
- v += 1;
3190
- else if (T < 2048)
3191
- v += 2;
3192
- else if (T < 55296)
3193
- v += 3;
3194
- else if (T <= 57343) {
3226
+ for (var m = 0, y = 0; y < x.length; y++) {
3227
+ var E = x.charCodeAt(y);
3228
+ if (E < 128)
3229
+ m += 1;
3230
+ else if (E < 2048)
3231
+ m += 2;
3232
+ else if (E < 55296)
3233
+ m += 3;
3234
+ else if (E <= 57343) {
3195
3235
  if (y >= x.length - 1)
3196
3236
  throw new Error(l);
3197
- y++, v += 4;
3237
+ y++, m += 4;
3198
3238
  } else
3199
3239
  throw new Error(l);
3200
3240
  }
3201
- return v;
3241
+ return m;
3202
3242
  }
3203
3243
  o.encodedLength = d;
3204
- function P(x) {
3205
- for (var v = [], y = 0; y < x.length; y++) {
3206
- var T = x[y];
3207
- if (T & 128) {
3208
- var E = void 0;
3209
- if (T < 224) {
3244
+ function A(x) {
3245
+ for (var m = [], y = 0; y < x.length; y++) {
3246
+ var E = x[y];
3247
+ if (E & 128) {
3248
+ var R = void 0;
3249
+ if (E < 224) {
3210
3250
  if (y >= x.length)
3211
3251
  throw new Error(h);
3212
3252
  var S = x[++y];
3213
3253
  if ((S & 192) !== 128)
3214
3254
  throw new Error(h);
3215
- T = (T & 31) << 6 | S & 63, E = 128;
3216
- } else if (T < 240) {
3255
+ E = (E & 31) << 6 | S & 63, R = 128;
3256
+ } else if (E < 240) {
3217
3257
  if (y >= x.length - 1)
3218
3258
  throw new Error(h);
3219
3259
  var S = x[++y], f = x[++y];
3220
3260
  if ((S & 192) !== 128 || (f & 192) !== 128)
3221
3261
  throw new Error(h);
3222
- T = (T & 15) << 12 | (S & 63) << 6 | f & 63, E = 2048;
3223
- } else if (T < 248) {
3262
+ E = (E & 15) << 12 | (S & 63) << 6 | f & 63, R = 2048;
3263
+ } else if (E < 248) {
3224
3264
  if (y >= x.length - 2)
3225
3265
  throw new Error(h);
3226
- var S = x[++y], f = x[++y], m = x[++y];
3227
- if ((S & 192) !== 128 || (f & 192) !== 128 || (m & 192) !== 128)
3266
+ var S = x[++y], f = x[++y], v = x[++y];
3267
+ if ((S & 192) !== 128 || (f & 192) !== 128 || (v & 192) !== 128)
3228
3268
  throw new Error(h);
3229
- T = (T & 15) << 18 | (S & 63) << 12 | (f & 63) << 6 | m & 63, E = 65536;
3269
+ E = (E & 15) << 18 | (S & 63) << 12 | (f & 63) << 6 | v & 63, R = 65536;
3230
3270
  } else
3231
3271
  throw new Error(h);
3232
- if (T < E || T >= 55296 && T <= 57343)
3272
+ if (E < R || E >= 55296 && E <= 57343)
3233
3273
  throw new Error(h);
3234
- if (T >= 65536) {
3235
- if (T > 1114111)
3274
+ if (E >= 65536) {
3275
+ if (E > 1114111)
3236
3276
  throw new Error(h);
3237
- T -= 65536, v.push(String.fromCharCode(55296 | T >> 10)), T = 56320 | T & 1023;
3277
+ E -= 65536, m.push(String.fromCharCode(55296 | E >> 10)), E = 56320 | E & 1023;
3238
3278
  }
3239
3279
  }
3240
- v.push(String.fromCharCode(T));
3280
+ m.push(String.fromCharCode(E));
3241
3281
  }
3242
- return v.join("");
3282
+ return m.join("");
3243
3283
  }
3244
- o.decode = P;
3284
+ o.decode = A;
3245
3285
  }),
3246
3286
  /* 2 */
3247
3287
  /***/
@@ -3295,7 +3335,7 @@ function Ko() {
3295
3335
  cdn_https: "https://js.pusher.com",
3296
3336
  dependency_suffix: ""
3297
3337
  }, d = g;
3298
- class P {
3338
+ class A {
3299
3339
  constructor(t) {
3300
3340
  this.options = t, this.receivers = t.receivers || h, this.loading = {};
3301
3341
  }
@@ -3309,10 +3349,10 @@ function Ko() {
3309
3349
  if (c.receivers.remove(_), c.loading[t]) {
3310
3350
  var D = c.loading[t];
3311
3351
  delete c.loading[t];
3312
- for (var K = function(oe) {
3352
+ for (var J = function(oe) {
3313
3353
  oe || p.cleanup();
3314
- }, ee = 0; ee < D.length; ee++)
3315
- D[ee](I, K);
3354
+ }, Z = 0; Z < D.length; Z++)
3355
+ D[Z](I, J);
3316
3356
  }
3317
3357
  });
3318
3358
  p.send(_);
@@ -3326,7 +3366,7 @@ function Ko() {
3326
3366
  return this.getRoot(s) + "/" + t + this.options.suffix + ".js";
3327
3367
  }
3328
3368
  }
3329
- var x = new l("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new P({
3369
+ var x = new l("_pusher_dependencies", "Pusher.DependenciesReceivers"), m = new A({
3330
3370
  cdn_http: d.cdn_http,
3331
3371
  cdn_https: d.cdn_https,
3332
3372
  version: d.VERSION,
@@ -3353,7 +3393,7 @@ function Ko() {
3353
3393
  }
3354
3394
  }
3355
3395
  };
3356
- var E = { buildLogSuffix: function(r) {
3396
+ var R = { buildLogSuffix: function(r) {
3357
3397
  const t = "See:", s = y.urls[r];
3358
3398
  if (!s)
3359
3399
  return "";
@@ -3368,7 +3408,7 @@ function Ko() {
3368
3408
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3369
3409
  }
3370
3410
  }
3371
- class m extends Error {
3411
+ class v extends Error {
3372
3412
  constructor(t) {
3373
3413
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3374
3414
  }
@@ -3388,12 +3428,12 @@ function Ko() {
3388
3428
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3389
3429
  }
3390
3430
  }
3391
- class H extends Error {
3431
+ class B extends Error {
3392
3432
  constructor(t) {
3393
3433
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3394
3434
  }
3395
3435
  }
3396
- class R extends Error {
3436
+ class P extends Error {
3397
3437
  constructor(t) {
3398
3438
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3399
3439
  }
@@ -3403,12 +3443,12 @@ function Ko() {
3403
3443
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3404
3444
  }
3405
3445
  }
3406
- class B extends Error {
3446
+ class $ extends Error {
3407
3447
  constructor(t, s) {
3408
3448
  super(s), this.status = t, Object.setPrototypeOf(this, new.target.prototype);
3409
3449
  }
3410
3450
  }
3411
- var Y = function(r, t, s, a, c) {
3451
+ var K = function(r, t, s, a, c) {
3412
3452
  const p = q.createXHR();
3413
3453
  p.open("POST", s.endpoint, !0), p.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
3414
3454
  for (var _ in s.headers)
@@ -3425,31 +3465,31 @@ function Ko() {
3425
3465
  try {
3426
3466
  I = JSON.parse(p.responseText), D = !0;
3427
3467
  } catch {
3428
- c(new B(200, `JSON returned from ${a.toString()} endpoint was invalid, yet status code was 200. Data was: ${p.responseText}`), null);
3468
+ c(new $(200, `JSON returned from ${a.toString()} endpoint was invalid, yet status code was 200. Data was: ${p.responseText}`), null);
3429
3469
  }
3430
3470
  D && c(null, I);
3431
3471
  } else {
3432
3472
  let I = "";
3433
3473
  switch (a) {
3434
3474
  case S.UserAuthentication:
3435
- I = E.buildLogSuffix("authenticationEndpoint");
3475
+ I = R.buildLogSuffix("authenticationEndpoint");
3436
3476
  break;
3437
3477
  case S.ChannelAuthorization:
3438
- I = `Clients must be authorized to join private or presence channels. ${E.buildLogSuffix("authorizationEndpoint")}`;
3478
+ I = `Clients must be authorized to join private or presence channels. ${R.buildLogSuffix("authorizationEndpoint")}`;
3439
3479
  break;
3440
3480
  }
3441
- c(new B(p.status, `Unable to retrieve auth string from ${a.toString()} endpoint - received status: ${p.status} from ${s.endpoint}. ${I}`), null);
3481
+ c(new $(p.status, `Unable to retrieve auth string from ${a.toString()} endpoint - received status: ${p.status} from ${s.endpoint}. ${I}`), null);
3442
3482
  }
3443
3483
  }, p.send(t), p;
3444
3484
  };
3445
- function W(r) {
3485
+ function se(r) {
3446
3486
  return L(C(r));
3447
3487
  }
3448
- var A = String.fromCharCode, M = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", te = function(r) {
3488
+ var w = String.fromCharCode, M = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", ee = function(r) {
3449
3489
  var t = r.charCodeAt(0);
3450
- return t < 128 ? r : t < 2048 ? A(192 | t >>> 6) + A(128 | t & 63) : A(224 | t >>> 12 & 15) + A(128 | t >>> 6 & 63) + A(128 | t & 63);
3490
+ return t < 128 ? r : t < 2048 ? w(192 | t >>> 6) + w(128 | t & 63) : w(224 | t >>> 12 & 15) + w(128 | t >>> 6 & 63) + w(128 | t & 63);
3451
3491
  }, C = function(r) {
3452
- return r.replace(/[^\x00-\x7F]/g, te);
3492
+ return r.replace(/[^\x00-\x7F]/g, ee);
3453
3493
  }, O = function(r) {
3454
3494
  var t = [0, 2, 1][r.length % 3], s = r.charCodeAt(0) << 16 | (r.length > 1 ? r.charCodeAt(1) : 0) << 8 | (r.length > 2 ? r.charCodeAt(2) : 0), a = [
3455
3495
  M.charAt(s >>> 18),
@@ -3461,7 +3501,7 @@ function Ko() {
3461
3501
  }, L = window.btoa || function(r) {
3462
3502
  return r.replace(/[\s\S]{1,3}/g, O);
3463
3503
  };
3464
- class $ {
3504
+ class H {
3465
3505
  constructor(t, s, a, c) {
3466
3506
  this.clear = s, this.timer = t(() => {
3467
3507
  this.timer && (this.timer = c(this.timer));
@@ -3474,14 +3514,14 @@ function Ko() {
3474
3514
  this.timer && (this.clear(this.timer), this.timer = null);
3475
3515
  }
3476
3516
  }
3477
- var re = $;
3517
+ var re = H;
3478
3518
  function je(r) {
3479
3519
  window.clearTimeout(r);
3480
3520
  }
3481
3521
  function Bt(r) {
3482
3522
  window.clearInterval(r);
3483
3523
  }
3484
- class w extends re {
3524
+ class T extends re {
3485
3525
  constructor(t, s) {
3486
3526
  super(setTimeout, je, t, function(a) {
3487
3527
  return s(), null;
@@ -3495,12 +3535,12 @@ function Ko() {
3495
3535
  });
3496
3536
  }
3497
3537
  }
3498
- var Q = {
3538
+ var Y = {
3499
3539
  now() {
3500
3540
  return Date.now ? Date.now() : (/* @__PURE__ */ new Date()).valueOf();
3501
3541
  },
3502
3542
  defer(r) {
3503
- return new w(0, r);
3543
+ return new T(0, r);
3504
3544
  },
3505
3545
  method(r, ...t) {
3506
3546
  var s = Array.prototype.slice.call(arguments, 1);
@@ -3508,7 +3548,7 @@ function Ko() {
3508
3548
  return a[r].apply(a, s.concat(arguments));
3509
3549
  };
3510
3550
  }
3511
- }, N = Q;
3551
+ }, N = Y;
3512
3552
  function V(r, ...t) {
3513
3553
  for (var s = 0; s < t.length; s++) {
3514
3554
  var a = t[s];
@@ -3558,13 +3598,13 @@ function Ko() {
3558
3598
  s.push(t(r[a], a, r, s));
3559
3599
  return s;
3560
3600
  }
3561
- function Ce(r, t) {
3601
+ function we(r, t) {
3562
3602
  var s = {};
3563
3603
  return fe(r, function(a, c) {
3564
3604
  s[c] = t(a);
3565
3605
  }), s;
3566
3606
  }
3567
- function G(r, t) {
3607
+ function W(r, t) {
3568
3608
  t = t || function(c) {
3569
3609
  return !!c;
3570
3610
  };
@@ -3597,8 +3637,8 @@ function Ko() {
3597
3637
  return !0;
3598
3638
  }
3599
3639
  function fs(r) {
3600
- return Ce(r, function(t) {
3601
- return typeof t == "object" && (t = He(t)), encodeURIComponent(W(t.toString()));
3640
+ return we(r, function(t) {
3641
+ return typeof t == "object" && (t = He(t)), encodeURIComponent(se(t.toString()));
3602
3642
  });
3603
3643
  }
3604
3644
  function ps(r) {
@@ -3667,18 +3707,18 @@ function Ko() {
3667
3707
  vt.log ? vt.log(a) : vt.logToConsole && t.bind(this)(a);
3668
3708
  }
3669
3709
  }
3670
- var ne = new ms(), vs = function(r, t, s, a, c) {
3671
- (s.headers !== void 0 || s.headersProvider != null) && ne.warn(`To send headers with the ${a.toString()} request, you must use AJAX, rather than JSONP.`);
3710
+ var te = new ms(), vs = function(r, t, s, a, c) {
3711
+ (s.headers !== void 0 || s.headersProvider != null) && te.warn(`To send headers with the ${a.toString()} request, you must use AJAX, rather than JSONP.`);
3672
3712
  var p = r.nextAuthCallbackID.toString();
3673
3713
  r.nextAuthCallbackID++;
3674
3714
  var _ = r.getDocument(), I = _.createElement("script");
3675
- r.auth_callbacks[p] = function(ee) {
3676
- c(null, ee);
3715
+ r.auth_callbacks[p] = function(Z) {
3716
+ c(null, Z);
3677
3717
  };
3678
3718
  var D = "Pusher.auth_callbacks['" + p + "']";
3679
3719
  I.src = s.endpoint + "?callback=" + encodeURIComponent(D) + "&" + t;
3680
- var K = _.getElementsByTagName("head")[0] || _.documentElement;
3681
- K.insertBefore(I, K.firstChild);
3720
+ var J = _.getElementsByTagName("head")[0] || _.documentElement;
3721
+ J.insertBefore(I, J.firstChild);
3682
3722
  }, bs = vs;
3683
3723
  class ys {
3684
3724
  constructor(t) {
@@ -3716,15 +3756,15 @@ function Ko() {
3716
3756
  }
3717
3757
  var Ss = function(r, t) {
3718
3758
  return function(s, a) {
3719
- var c = "http" + (t ? "s" : "") + "://", p = c + (r.host || r.options.host) + r.options.path, _ = q.createJSONPRequest(p, s), I = q.ScriptReceivers.create(function(D, K) {
3720
- h.remove(I), _.cleanup(), K && K.host && (r.host = K.host), a && a(D, K);
3759
+ var c = "http" + (t ? "s" : "") + "://", p = c + (r.host || r.options.host) + r.options.path, _ = q.createJSONPRequest(p, s), I = q.ScriptReceivers.create(function(D, J) {
3760
+ h.remove(I), _.cleanup(), J && J.host && (r.host = J.host), a && a(D, J);
3721
3761
  });
3722
3762
  _.send(I);
3723
3763
  };
3724
- }, Cs = {
3764
+ }, ws = {
3725
3765
  name: "jsonp",
3726
3766
  getAgent: Ss
3727
- }, ws = Cs;
3767
+ }, Cs = ws;
3728
3768
  function at(r, t, s) {
3729
3769
  var a = r + (t.useTLS ? "s" : ""), c = t.useTLS ? t.hostTLS : t.hostNonTLS;
3730
3770
  return a + "://" + c + s;
@@ -3775,7 +3815,7 @@ function Ko() {
3775
3815
  }
3776
3816
  removeCallback(t, s, a) {
3777
3817
  ce(t, function(c) {
3778
- this._callbacks[c] = G(this._callbacks[c] || [], function(p) {
3818
+ this._callbacks[c] = W(this._callbacks[c] || [], function(p) {
3779
3819
  return s && s !== p.fn || a && a !== p.context;
3780
3820
  }), this._callbacks[c].length === 0 && delete this._callbacks[c];
3781
3821
  }, this);
@@ -3803,7 +3843,7 @@ function Ko() {
3803
3843
  return this.callbacks.remove(t, s, a), this;
3804
3844
  }
3805
3845
  unbind_global(t) {
3806
- return t ? (this.global_callbacks = G(this.global_callbacks || [], (s) => s !== t), this) : (this.global_callbacks = [], this);
3846
+ return t ? (this.global_callbacks = W(this.global_callbacks || [], (s) => s !== t), this) : (this.global_callbacks = [], this);
3807
3847
  }
3808
3848
  unbind_all() {
3809
3849
  return this.unbind(), this.unbind_global(), this;
@@ -3840,7 +3880,7 @@ function Ko() {
3840
3880
  this.onError(s), this.changeState("closed");
3841
3881
  }), !1;
3842
3882
  }
3843
- return this.bindListeners(), ne.debug("Connecting", { transport: this.name, url: t }), this.changeState("connecting"), !0;
3883
+ return this.bindListeners(), te.debug("Connecting", { transport: this.name, url: t }), this.changeState("connecting"), !0;
3844
3884
  }
3845
3885
  close() {
3846
3886
  return this.socket ? (this.socket.close(), !0) : !1;
@@ -3958,7 +3998,7 @@ function Ko() {
3958
3998
  },
3959
3999
  getSocket: function(r, t) {
3960
4000
  return new window.SockJS(r, null, {
3961
- js_path: v.getPath("sockjs", {
4001
+ js_path: m.getPath("sockjs", {
3962
4002
  useTLS: t.useTLS
3963
4003
  }),
3964
4004
  ignore_null_origin: t.ignoreNullOrigin
@@ -4002,12 +4042,12 @@ function Ko() {
4002
4042
  });
4003
4043
  var p = this.transport.createConnection(t, s, a, c), _ = null, I = function() {
4004
4044
  p.unbind("open", I), p.bind("closed", D), _ = N.now();
4005
- }, D = (K) => {
4006
- if (p.unbind("closed", D), K.code === 1002 || K.code === 1003)
4045
+ }, D = (J) => {
4046
+ if (p.unbind("closed", D), J.code === 1002 || J.code === 1003)
4007
4047
  this.manager.reportDeath();
4008
- else if (!K.wasClean && _) {
4009
- var ee = N.now() - _;
4010
- ee < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(ee / 2, this.minPingDelay));
4048
+ else if (!J.wasClean && _) {
4049
+ var Z = N.now() - _;
4050
+ Z < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(Z / 2, this.minPingDelay));
4011
4051
  }
4012
4052
  };
4013
4053
  return p.bind("open", I), p;
@@ -4070,7 +4110,7 @@ function Ko() {
4070
4110
  } : null;
4071
4111
  }
4072
4112
  };
4073
- var we = Yt;
4113
+ var Ce = Yt;
4074
4114
  class zs extends be {
4075
4115
  constructor(t, s) {
4076
4116
  super(), this.id = t, this.transport = s, this.activityTimeout = s.activityTimeout, this.bindListeners();
@@ -4083,7 +4123,7 @@ function Ko() {
4083
4123
  }
4084
4124
  send_event(t, s, a) {
4085
4125
  var c = { event: t, data: s };
4086
- return a && (c.channel = a), ne.debug("Event sent", c), this.send(we.encodeMessage(c));
4126
+ return a && (c.channel = a), te.debug("Event sent", c), this.send(Ce.encodeMessage(c));
4087
4127
  }
4088
4128
  ping() {
4089
4129
  this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
@@ -4096,7 +4136,7 @@ function Ko() {
4096
4136
  message: (a) => {
4097
4137
  var c;
4098
4138
  try {
4099
- c = we.decodeMessage(a);
4139
+ c = Ce.decodeMessage(a);
4100
4140
  } catch (p) {
4101
4141
  this.emit("error", {
4102
4142
  type: "MessageParseError",
@@ -4105,7 +4145,7 @@ function Ko() {
4105
4145
  });
4106
4146
  }
4107
4147
  if (c !== void 0) {
4108
- switch (ne.debug("Event recd", c), c.event) {
4148
+ switch (te.debug("Event recd", c), c.event) {
4109
4149
  case "pusher:error":
4110
4150
  this.emit("error", {
4111
4151
  type: "PusherError",
@@ -4141,7 +4181,7 @@ function Ko() {
4141
4181
  });
4142
4182
  }
4143
4183
  handleCloseEvent(t) {
4144
- var s = we.getCloseAction(t), a = we.getCloseError(t);
4184
+ var s = Ce.getCloseAction(t), a = Ce.getCloseError(t);
4145
4185
  a && this.emit("error", a), s && this.emit(s, { action: s, error: a });
4146
4186
  }
4147
4187
  }
@@ -4157,7 +4197,7 @@ function Ko() {
4157
4197
  this.unbindListeners();
4158
4198
  var s;
4159
4199
  try {
4160
- s = we.processHandshake(t);
4200
+ s = Ce.processHandshake(t);
4161
4201
  } catch (a) {
4162
4202
  this.finish("error", { error: a }), this.transport.close();
4163
4203
  return;
@@ -4168,7 +4208,7 @@ function Ko() {
4168
4208
  }) : (this.finish(s.action, { error: s.error }), this.transport.close());
4169
4209
  }, this.onClosed = (t) => {
4170
4210
  this.unbindListeners();
4171
- var s = we.getCloseAction(t) || "backoff", a = we.getCloseError(t);
4211
+ var s = Ce.getCloseAction(t) || "backoff", a = Ce.getCloseError(t);
4172
4212
  this.finish(s, { error: a });
4173
4213
  }, this.transport.bind("message", this.onMessage), this.transport.bind("closed", this.onClosed);
4174
4214
  }
@@ -4190,7 +4230,7 @@ function Ko() {
4190
4230
  class lt extends be {
4191
4231
  constructor(t, s) {
4192
4232
  super(function(a, c) {
4193
- ne.debug("No callbacks on " + t + " for " + a);
4233
+ te.debug("No callbacks on " + t + " for " + a);
4194
4234
  }), this.name = t, this.pusher = s, this.subscribed = !1, this.subscriptionPending = !1, this.subscriptionCancelled = !1;
4195
4235
  }
4196
4236
  authorize(t, s) {
@@ -4200,8 +4240,8 @@ function Ko() {
4200
4240
  if (t.indexOf("client-") !== 0)
4201
4241
  throw new f("Event '" + t + "' does not start with 'client-'");
4202
4242
  if (!this.subscribed) {
4203
- var a = E.buildLogSuffix("triggeringClientEvents");
4204
- ne.warn(`Client event triggered before channel 'subscription_succeeded' event . ${a}`);
4243
+ var a = R.buildLogSuffix("triggeringClientEvents");
4244
+ te.warn(`Client event triggered before channel 'subscription_succeeded' event . ${a}`);
4205
4245
  }
4206
4246
  return this.pusher.send_event(t, s, this.name);
4207
4247
  }
@@ -4227,10 +4267,10 @@ function Ko() {
4227
4267
  }
4228
4268
  subscribe() {
4229
4269
  this.subscribed || (this.subscriptionPending = !0, this.subscriptionCancelled = !1, this.authorize(this.pusher.connection.socket_id, (t, s) => {
4230
- t ? (this.subscriptionPending = !1, ne.error(t.toString()), this.emit("pusher:subscription_error", Object.assign({}, {
4270
+ t ? (this.subscriptionPending = !1, te.error(t.toString()), this.emit("pusher:subscription_error", Object.assign({}, {
4231
4271
  type: "AuthError",
4232
4272
  error: t.message
4233
- }, t instanceof B ? { status: t.status } : {}))) : this.pusher.send_event("pusher:subscribe", {
4273
+ }, t instanceof $ ? { status: t.status } : {}))) : this.pusher.send_event("pusher:subscribe", {
4234
4274
  auth: s.auth,
4235
4275
  channel_data: s.channel_data,
4236
4276
  channel: this.name
@@ -4296,24 +4336,24 @@ function Ko() {
4296
4336
  });
4297
4337
  }
4298
4338
  return new (s || (s = Promise))(function(p, _) {
4299
- function I(ee) {
4339
+ function I(Z) {
4300
4340
  try {
4301
- K(a.next(ee));
4341
+ J(a.next(Z));
4302
4342
  } catch (oe) {
4303
4343
  _(oe);
4304
4344
  }
4305
4345
  }
4306
- function D(ee) {
4346
+ function D(Z) {
4307
4347
  try {
4308
- K(a.throw(ee));
4348
+ J(a.throw(Z));
4309
4349
  } catch (oe) {
4310
4350
  _(oe);
4311
4351
  }
4312
4352
  }
4313
- function K(ee) {
4314
- ee.done ? p(ee.value) : c(ee.value).then(I, D);
4353
+ function J(Z) {
4354
+ Z.done ? p(Z.value) : c(Z.value).then(I, D);
4315
4355
  }
4316
- K((a = a.apply(r, t || [])).next());
4356
+ J((a = a.apply(r, t || [])).next());
4317
4357
  });
4318
4358
  };
4319
4359
  class Vs extends ht {
@@ -4329,8 +4369,8 @@ function Ko() {
4329
4369
  } else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null)
4330
4370
  this.members.setMyID(this.pusher.user.user_data.id);
4331
4371
  else {
4332
- let _ = E.buildLogSuffix("authorizationEndpoint");
4333
- ne.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${_}, or the user should be signed in.`), s("Invalid auth response");
4372
+ let _ = R.buildLogSuffix("authorizationEndpoint");
4373
+ te.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${_}, or the user should be signed in.`), s("Invalid auth response");
4334
4374
  return;
4335
4375
  }
4336
4376
  s(a, c);
@@ -4391,7 +4431,7 @@ function Ko() {
4391
4431
  });
4392
4432
  }
4393
4433
  trigger(t, s) {
4394
- throw new H("Client events are not currently supported for encrypted channels");
4434
+ throw new B("Client events are not currently supported for encrypted channels");
4395
4435
  }
4396
4436
  handleEvent(t) {
4397
4437
  var s = t.event, a = t.data;
@@ -4403,32 +4443,32 @@ function Ko() {
4403
4443
  }
4404
4444
  handleEncryptedEvent(t, s) {
4405
4445
  if (!this.key) {
4406
- ne.debug("Received encrypted event before key has been retrieved from the authEndpoint");
4446
+ te.debug("Received encrypted event before key has been retrieved from the authEndpoint");
4407
4447
  return;
4408
4448
  }
4409
4449
  if (!s.ciphertext || !s.nonce) {
4410
- ne.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + s);
4450
+ te.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + s);
4411
4451
  return;
4412
4452
  }
4413
4453
  let a = Object(dt.decode)(s.ciphertext);
4414
4454
  if (a.length < this.nacl.secretbox.overheadLength) {
4415
- ne.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${a.length}`);
4455
+ te.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${a.length}`);
4416
4456
  return;
4417
4457
  }
4418
4458
  let c = Object(dt.decode)(s.nonce);
4419
4459
  if (c.length < this.nacl.secretbox.nonceLength) {
4420
- ne.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${c.length}`);
4460
+ te.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${c.length}`);
4421
4461
  return;
4422
4462
  }
4423
4463
  let p = this.nacl.secretbox.open(a, c, this.key);
4424
4464
  if (p === null) {
4425
- ne.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, (_, I) => {
4465
+ te.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, (_, I) => {
4426
4466
  if (_) {
4427
- ne.error(`Failed to make a request to the authEndpoint: ${I}. Unable to fetch new key, so dropping encrypted event`);
4467
+ te.error(`Failed to make a request to the authEndpoint: ${I}. Unable to fetch new key, so dropping encrypted event`);
4428
4468
  return;
4429
4469
  }
4430
4470
  if (p = this.nacl.secretbox.open(a, c, this.key), p === null) {
4431
- ne.error("Failed to decrypt event with new key. Dropping encrypted event");
4471
+ te.error("Failed to decrypt event with new key. Dropping encrypted event");
4432
4472
  return;
4433
4473
  }
4434
4474
  this.emit(t, this.getDataToEmit(p));
@@ -4503,7 +4543,7 @@ function Ko() {
4503
4543
  });
4504
4544
  }
4505
4545
  retryIn(t) {
4506
- this.timeline.info({ action: "retry", delay: t }), t > 0 && this.emit("connecting_in", Math.round(t / 1e3)), this.retryTimer = new w(t || 0, () => {
4546
+ this.timeline.info({ action: "retry", delay: t }), t > 0 && this.emit("connecting_in", Math.round(t / 1e3)), this.retryTimer = new T(t || 0, () => {
4507
4547
  this.disconnectInternally(), this.connect();
4508
4548
  });
4509
4549
  }
@@ -4511,7 +4551,7 @@ function Ko() {
4511
4551
  this.retryTimer && (this.retryTimer.ensureAborted(), this.retryTimer = null);
4512
4552
  }
4513
4553
  setUnavailableTimer() {
4514
- this.unavailableTimer = new w(this.options.unavailableTimeout, () => {
4554
+ this.unavailableTimer = new T(this.options.unavailableTimeout, () => {
4515
4555
  this.updateState("unavailable");
4516
4556
  });
4517
4557
  }
@@ -4519,12 +4559,12 @@ function Ko() {
4519
4559
  this.unavailableTimer && this.unavailableTimer.ensureAborted();
4520
4560
  }
4521
4561
  sendActivityCheck() {
4522
- this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new w(this.options.pongTimeout, () => {
4562
+ this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new T(this.options.pongTimeout, () => {
4523
4563
  this.timeline.error({ pong_timed_out: this.options.pongTimeout }), this.retryIn(0);
4524
4564
  });
4525
4565
  }
4526
4566
  resetActivityCheck() {
4527
- this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new w(this.activityTimeout, () => {
4567
+ this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new T(this.activityTimeout, () => {
4528
4568
  this.sendActivityCheck();
4529
4569
  }));
4530
4570
  }
@@ -4595,7 +4635,7 @@ function Ko() {
4595
4635
  var a = this.state;
4596
4636
  if (this.state = t, a !== t) {
4597
4637
  var c = t;
4598
- c === "connected" && (c += " with new socket ID " + s.socket_id), ne.debug("State changed", a + " -> " + c), this.timeline.info({ state: t, params: s }), this.emit("state_change", { previous: a, current: t }), this.emit(t, s);
4638
+ c === "connected" && (c += " with new socket ID " + s.socket_id), te.debug("State changed", a + " -> " + c), this.timeline.info({ state: t, params: s }), this.emit("state_change", { previous: a, current: t }), this.emit(t, s);
4599
4639
  }
4600
4640
  }
4601
4641
  shouldRetry() {
@@ -4629,15 +4669,15 @@ function Ko() {
4629
4669
  if (r.indexOf("private-encrypted-") === 0) {
4630
4670
  if (t.config.nacl)
4631
4671
  return ye.createEncryptedChannel(r, t, t.config.nacl);
4632
- let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a = E.buildLogSuffix("encryptedChannelSupport");
4633
- throw new H(`${s}. ${a}`);
4672
+ let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a = R.buildLogSuffix("encryptedChannelSupport");
4673
+ throw new B(`${s}. ${a}`);
4634
4674
  } else {
4635
4675
  if (r.indexOf("private-") === 0)
4636
4676
  return ye.createPrivateChannel(r, t);
4637
4677
  if (r.indexOf("presence-") === 0)
4638
4678
  return ye.createPresenceChannel(r, t);
4639
4679
  if (r.indexOf("#") === 0)
4640
- throw new m('Cannot create a channel with name "' + r + '".');
4680
+ throw new v('Cannot create a channel with name "' + r + '".');
4641
4681
  return ye.createChannel(r, t);
4642
4682
  }
4643
4683
  }
@@ -4695,8 +4735,8 @@ function Ko() {
4695
4735
  return Vt(this.strategies, N.method("isSupported"));
4696
4736
  }
4697
4737
  connect(t, s) {
4698
- var a = this.strategies, c = 0, p = this.timeout, _ = null, I = (D, K) => {
4699
- K ? s(null, K) : (c = c + 1, this.loop && (c = c % a.length), c < a.length ? (p && (p = p * 2, this.timeoutLimit && (p = Math.min(p, this.timeoutLimit))), _ = this.tryStrategy(a[c], t, { timeout: p, failFast: this.failFast }, I)) : s(!0));
4738
+ var a = this.strategies, c = 0, p = this.timeout, _ = null, I = (D, J) => {
4739
+ J ? s(null, J) : (c = c + 1, this.loop && (c = c % a.length), c < a.length ? (p && (p = p * 2, this.timeoutLimit && (p = Math.min(p, this.timeoutLimit))), _ = this.tryStrategy(a[c], t, { timeout: p, failFast: this.failFast }, I)) : s(!0));
4700
4740
  };
4701
4741
  return _ = this.tryStrategy(a[c], t, { timeout: p, failFast: this.failFast }, I), {
4702
4742
  abort: function() {
@@ -4709,7 +4749,7 @@ function Ko() {
4709
4749
  }
4710
4750
  tryStrategy(t, s, a, c) {
4711
4751
  var p = null, _ = null;
4712
- return a.timeout > 0 && (p = new w(a.timeout, function() {
4752
+ return a.timeout > 0 && (p = new T(a.timeout, function() {
4713
4753
  _.abort(), c(!0);
4714
4754
  })), _ = t.connect(s, function(I, D) {
4715
4755
  I && p && p.isRunning() && !a.failFast || (p && p.ensureAborted(), c(I, D));
@@ -4787,15 +4827,15 @@ function Ko() {
4787
4827
  failFast: !0
4788
4828
  }))) : p++);
4789
4829
  }
4790
- var D = N.now(), K = _.pop().connect(t, function ee(oe, We) {
4791
- oe ? (Zt(a), _.length > 0 ? (D = N.now(), K = _.pop().connect(t, ee)) : s(oe)) : (sr(a, We.transport.name, N.now() - D, p), s(null, We));
4830
+ var D = N.now(), J = _.pop().connect(t, function Z(oe, We) {
4831
+ oe ? (Zt(a), _.length > 0 ? (D = N.now(), J = _.pop().connect(t, Z)) : s(oe)) : (sr(a, We.transport.name, N.now() - D, p), s(null, We));
4792
4832
  });
4793
4833
  return {
4794
4834
  abort: function() {
4795
- K.abort();
4835
+ J.abort();
4796
4836
  },
4797
- forceMinPriority: function(ee) {
4798
- t = ee, K && K.forceMinPriority(ee);
4837
+ forceMinPriority: function(Z) {
4838
+ t = Z, J && J.forceMinPriority(Z);
4799
4839
  }
4800
4840
  };
4801
4841
  }
@@ -4844,7 +4884,7 @@ function Ko() {
4844
4884
  return this.strategy.isSupported();
4845
4885
  }
4846
4886
  connect(t, s) {
4847
- var a = this.strategy, c, p = new w(this.options.delay, function() {
4887
+ var a = this.strategy, c, p = new T(this.options.delay, function() {
4848
4888
  c = a.connect(t, s);
4849
4889
  });
4850
4890
  return {
@@ -4909,14 +4949,14 @@ function Ko() {
4909
4949
  loop: !0,
4910
4950
  timeout: 15e3,
4911
4951
  timeoutLimit: 6e4
4912
- }, K = new Qt({
4952
+ }, J = new Qt({
4913
4953
  minPingDelay: 1e4,
4914
4954
  maxPingDelay: r.activityTimeout
4915
- }), ee = new Qt({
4955
+ }), Z = new Qt({
4916
4956
  lives: 2,
4917
4957
  minPingDelay: 1e4,
4918
4958
  maxPingDelay: r.activityTimeout
4919
- }), oe = c("ws", "ws", 3, p, K), We = c("wss", "ws", 3, _, K), Zr = c("sockjs", "sockjs", 1, I), rn = c("xhr_streaming", "xhr_streaming", 1, I, ee), ei = c("xdr_streaming", "xdr_streaming", 1, I, ee), on = c("xhr_polling", "xhr_polling", 1, I), ti = c("xdr_polling", "xdr_polling", 1, I), an = new Te([oe], D), ni = new Te([We], D), si = new Te([Zr], D), cn = new Te([
4959
+ }), oe = c("ws", "ws", 3, p, J), We = c("wss", "ws", 3, _, J), Zr = c("sockjs", "sockjs", 1, I), rn = c("xhr_streaming", "xhr_streaming", 1, I, Z), ei = c("xdr_streaming", "xdr_streaming", 1, I, Z), on = c("xhr_polling", "xhr_polling", 1, I), ti = c("xdr_polling", "xdr_polling", 1, I), an = new Te([oe], D), ni = new Te([We], D), si = new Te([Zr], D), cn = new Te([
4920
4960
  new ke(Ie(rn), rn, ei)
4921
4961
  ], D), un = new Te([
4922
4962
  new ke(Ie(on), on, ti)
@@ -4942,7 +4982,7 @@ function Ko() {
4942
4982
  var r = this;
4943
4983
  r.timeline.info(r.buildTimelineMessage({
4944
4984
  transport: r.name + (r.options.useTLS ? "s" : "")
4945
- })), r.hooks.isInitialized() ? r.changeState("initialized") : r.hooks.file ? (r.changeState("initializing"), v.load(r.hooks.file, { useTLS: r.options.useTLS }, function(t, s) {
4985
+ })), r.hooks.isInitialized() ? r.changeState("initialized") : r.hooks.file ? (r.changeState("initializing"), m.load(r.hooks.file, { useTLS: r.options.useTLS }, function(t, s) {
4946
4986
  r.hooks.isInitialized() ? (r.changeState("initialized"), s(!0)) : (t && r.onError(t), r.onClose(), s(!1));
4947
4987
  })) : r.onClose();
4948
4988
  }), cr = {
@@ -5140,7 +5180,7 @@ function Ko() {
5140
5180
  onFinished: function(r, t) {
5141
5181
  t === 200 ? r.reconnect() : r.onClose(1006, "Connection interrupted (" + t + ")", !1);
5142
5182
  }
5143
- }, Cr = Sr, wr = {
5183
+ }, wr = Sr, Cr = {
5144
5184
  getRequest: function(r) {
5145
5185
  var t = q.getXHRAPI(), s = new t();
5146
5186
  return s.onreadystatechange = s.onprogress = function() {
@@ -5157,12 +5197,12 @@ function Ko() {
5157
5197
  abortRequest: function(r) {
5158
5198
  r.onreadystatechange = null, r.abort();
5159
5199
  }
5160
- }, Tr = wr, Er = {
5200
+ }, Tr = Cr, Er = {
5161
5201
  createStreamingSocket(r) {
5162
5202
  return this.createSocket(_r, r);
5163
5203
  },
5164
5204
  createPollingSocket(r) {
5165
- return this.createSocket(Cr, r);
5205
+ return this.createSocket(wr, r);
5166
5206
  },
5167
5207
  createSocket(r, t) {
5168
5208
  return new br(r, t);
@@ -5186,7 +5226,7 @@ function Ko() {
5186
5226
  Transports: Ns,
5187
5227
  transportConnectionInitializer: ar,
5188
5228
  HTTPFactory: Rr,
5189
- TimelineTransport: ws,
5229
+ TimelineTransport: Cs,
5190
5230
  getXHRAPI() {
5191
5231
  return window.XMLHttpRequest;
5192
5232
  },
@@ -5198,7 +5238,7 @@ function Ko() {
5198
5238
  var t = () => {
5199
5239
  this.onDocumentBody(r.ready);
5200
5240
  };
5201
- window.JSON ? t() : v.load("json2", {}, t);
5241
+ window.JSON ? t() : m.load("json2", {}, t);
5202
5242
  },
5203
5243
  getDocument() {
5204
5244
  return document;
@@ -5207,7 +5247,7 @@ function Ko() {
5207
5247
  return this.getDocument().location.protocol;
5208
5248
  },
5209
5249
  getAuthorizers() {
5210
- return { ajax: Y, jsonp: bs };
5250
+ return { ajax: K, jsonp: bs };
5211
5251
  },
5212
5252
  onDocumentBody(r) {
5213
5253
  document.body ? r() : setTimeout(() => {
@@ -5331,20 +5371,20 @@ function Ko() {
5331
5371
  c.unbind("initialized", _), c.connect();
5332
5372
  }, I = function() {
5333
5373
  p = ye.createHandshake(c, function(oe) {
5334
- a = !0, ee(), s(null, oe);
5374
+ a = !0, Z(), s(null, oe);
5335
5375
  });
5336
5376
  }, D = function(oe) {
5337
- ee(), s(oe);
5338
- }, K = function() {
5339
- ee();
5377
+ Z(), s(oe);
5378
+ }, J = function() {
5379
+ Z();
5340
5380
  var oe;
5341
5381
  oe = He(c), s(new j(oe));
5342
- }, ee = function() {
5343
- c.unbind("initialized", _), c.unbind("open", I), c.unbind("error", D), c.unbind("closed", K);
5382
+ }, Z = function() {
5383
+ c.unbind("initialized", _), c.unbind("open", I), c.unbind("error", D), c.unbind("closed", J);
5344
5384
  };
5345
- return c.bind("initialized", _), c.bind("open", I), c.bind("error", D), c.bind("closed", K), c.initialize(), {
5385
+ return c.bind("initialized", _), c.bind("open", I), c.bind("error", D), c.bind("closed", J), c.initialize(), {
5346
5386
  abort: () => {
5347
- a || (ee(), p ? p.close() : c.close());
5387
+ a || (Z(), p ? p.close() : c.close());
5348
5388
  },
5349
5389
  forceMinPriority: (oe) => {
5350
5390
  a || this.priority < oe && (p ? p.close() : c.close());
@@ -5366,7 +5406,7 @@ function Ko() {
5366
5406
  var kr = function(r, t, s, a, c, p) {
5367
5407
  var _ = Mr[s];
5368
5408
  if (!_)
5369
- throw new R(s);
5409
+ throw new P(s);
5370
5410
  var I = (!r.enabledTransports || ve(r.enabledTransports, t) !== -1) && (!r.disabledTransports || ve(r.disabledTransports, t) === -1), D;
5371
5411
  return I ? (c = Object.assign({ ignoreNullOrigin: r.ignoreNullOrigin }, c), D = new xr(t, a, p ? p.getAssistant(_) : _, c)) : D = Ir, D;
5372
5412
  }, Ir = {
@@ -5391,7 +5431,7 @@ function Ko() {
5391
5431
  throw "You must pass an options object";
5392
5432
  if (r.cluster == null)
5393
5433
  throw "Options object must provide a cluster";
5394
- "disableStats" in r && ne.warn("The disableStats option is deprecated in favor of enableStats");
5434
+ "disableStats" in r && te.warn("The disableStats option is deprecated in favor of enableStats");
5395
5435
  }
5396
5436
  const Ur = (r, t) => {
5397
5437
  var s = "socket_id=" + encodeURIComponent(r.socketId);
@@ -5501,7 +5541,7 @@ function Ko() {
5501
5541
  class Gr extends be {
5502
5542
  constructor(t) {
5503
5543
  super(function(s, a) {
5504
- ne.debug(`No callbacks on watchlist events for ${s}`);
5544
+ te.debug(`No callbacks on watchlist events for ${s}`);
5505
5545
  }), this.pusher = t, this.bindWatchlistInternalEvent();
5506
5546
  }
5507
5547
  handleEvent(t) {
@@ -5526,10 +5566,10 @@ function Ko() {
5526
5566
  class Yr extends be {
5527
5567
  constructor(t) {
5528
5568
  super(function(s, a) {
5529
- ne.debug("No callbacks on user for " + s);
5569
+ te.debug("No callbacks on user for " + s);
5530
5570
  }), this.signin_requested = !1, this.user_data = null, this.serverToUserChannel = null, this.signinDonePromise = null, this._signinDoneResolve = null, this._onAuthorize = (s, a) => {
5531
5571
  if (s) {
5532
- ne.warn(`Error during signin: ${s}`), this._cleanup();
5572
+ te.warn(`Error during signin: ${s}`), this._cleanup();
5533
5573
  return;
5534
5574
  }
5535
5575
  this.pusher.send_event("pusher:signin", {
@@ -5555,11 +5595,11 @@ function Ko() {
5555
5595
  try {
5556
5596
  this.user_data = JSON.parse(t.user_data);
5557
5597
  } catch {
5558
- ne.error(`Failed parsing user data after signin: ${t.user_data}`), this._cleanup();
5598
+ te.error(`Failed parsing user data after signin: ${t.user_data}`), this._cleanup();
5559
5599
  return;
5560
5600
  }
5561
5601
  if (typeof this.user_data.id != "string" || this.user_data.id === "") {
5562
- ne.error(`user_data doesn't contain an id. user_data: ${this.user_data}`), this._cleanup();
5602
+ te.error(`user_data doesn't contain an id. user_data: ${this.user_data}`), this._cleanup();
5563
5603
  return;
5564
5604
  }
5565
5605
  this._signinDoneResolve(), this._subscribeChannels();
@@ -5631,7 +5671,7 @@ function Ko() {
5631
5671
  }), this.connection.bind("disconnected", () => {
5632
5672
  this.channels.disconnect();
5633
5673
  }), this.connection.bind("error", (c) => {
5634
- ne.warn(c);
5674
+ te.warn(c);
5635
5675
  }), ue.instances.push(this), this.timeline.info({ instances: ue.instances.length }), this.user = new Yr(this), ue.isReady && this.connect();
5636
5676
  }
5637
5677
  channel(t) {
@@ -5703,9 +5743,9 @@ function Ko() {
5703
5743
  });
5704
5744
  })(Et)), Et.exports;
5705
5745
  }
5706
- var Yo = Ko();
5707
- const Qo = /* @__PURE__ */ Jo(Yo), Zo = "/v1/messenger/bootstrap", ea = 3e4, ta = 3e4, na = 5 * 6e4;
5708
- function se(e) {
5746
+ var Zo = Qo();
5747
+ const ea = /* @__PURE__ */ Yo(Zo), ta = "/v1/messenger/bootstrap", na = 3e4, sa = 3e4, ra = 5 * 6e4;
5748
+ function ne(e) {
5709
5749
  return typeof e == "object" && e !== null;
5710
5750
  }
5711
5751
  function ae(e, n) {
@@ -5726,7 +5766,7 @@ function Ne(e, n) {
5726
5766
  const o = i.trim();
5727
5767
  return o === "" ? null : o;
5728
5768
  }
5729
- function sa(e, n) {
5769
+ function ia(e, n) {
5730
5770
  const i = e[n];
5731
5771
  if (typeof i == "number" && Number.isFinite(i))
5732
5772
  return i;
@@ -5737,23 +5777,23 @@ function sa(e, n) {
5737
5777
  }
5738
5778
  throw new Error(`Invalid messenger bootstrap payload: missing integer ${n}`);
5739
5779
  }
5740
- function ra(e) {
5780
+ function oa(e) {
5741
5781
  return e.toLowerCase() === "http" ? "http" : "https";
5742
5782
  }
5743
- function ia(e) {
5783
+ function aa(e) {
5744
5784
  if (e !== null)
5745
5785
  return e.startsWith("/") ? e : `/${e}`;
5746
5786
  }
5747
- function oa(e) {
5748
- if (!se(e))
5787
+ function ca(e) {
5788
+ if (!ne(e))
5749
5789
  throw new Error("Invalid messenger bootstrap payload: expected object");
5750
5790
  const n = e.auth, i = e.service;
5751
- if (!se(n) || !se(i))
5791
+ if (!ne(n) || !ne(i))
5752
5792
  throw new Error("Invalid messenger bootstrap payload: missing auth or service data");
5753
5793
  const o = n.user, u = i.reverb;
5754
- if (!se(o) || !se(u))
5794
+ if (!ne(o) || !ne(u))
5755
5795
  throw new Error("Invalid messenger bootstrap payload: missing user or reverb data");
5756
- const l = ia(Ne(u, "path"));
5796
+ const l = aa(Ne(u, "path"));
5757
5797
  return {
5758
5798
  auth: {
5759
5799
  token: ge(n, "token"),
@@ -5775,14 +5815,14 @@ function oa(e) {
5775
5815
  reverb: {
5776
5816
  appKey: ge(u, "app_key"),
5777
5817
  host: ge(u, "host"),
5778
- port: sa(u, "port"),
5779
- scheme: ra(ge(u, "scheme")),
5818
+ port: ia(u, "port"),
5819
+ scheme: oa(ge(u, "scheme")),
5780
5820
  ...l ? { path: l } : {}
5781
5821
  }
5782
5822
  }
5783
5823
  };
5784
5824
  }
5785
- function aa(e) {
5825
+ function ua(e) {
5786
5826
  return e.replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/:\d+$/, "");
5787
5827
  }
5788
5828
  function In(e, n) {
@@ -5790,7 +5830,7 @@ function In(e, n) {
5790
5830
  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"));
5791
5831
  return;
5792
5832
  }
5793
- const i = se(e.headers) ? e.headers : {};
5833
+ const i = ne(e.headers) ? e.headers : {};
5794
5834
  e.headers = new pn({
5795
5835
  ...i,
5796
5836
  Authorization: `Bearer ${n}`,
@@ -5805,16 +5845,16 @@ function _e(e, n, i) {
5805
5845
  const u = e[i];
5806
5846
  return typeof u == "string" && u.trim() !== "" ? u : null;
5807
5847
  }
5808
- function ca(e) {
5848
+ function la(e) {
5809
5849
  if (typeof e != "string")
5810
5850
  return null;
5811
5851
  const n = e.trim().toLowerCase();
5812
5852
  return n === "online" || n === "idle" || n === "dnd" || n === "offline" ? n : null;
5813
5853
  }
5814
- function ua(e, n) {
5815
- if (!se(e))
5854
+ function ha(e, n) {
5855
+ if (!ne(e))
5816
5856
  return null;
5817
- const i = _e(e, "user_id", "userId"), o = ca(e.status);
5857
+ const i = _e(e, "user_id", "userId"), o = la(e.status);
5818
5858
  if (!i || !o)
5819
5859
  return null;
5820
5860
  const u = {
@@ -5827,13 +5867,13 @@ function ua(e, n) {
5827
5867
  const h = e.last_seen_at ?? e.lastSeenAt;
5828
5868
  return typeof h == "string" ? u.last_seen_at = h : h === null && (u.last_seen_at = null), u;
5829
5869
  }
5830
- function la(e) {
5831
- if (!se(e))
5870
+ function da(e) {
5871
+ if (!ne(e))
5832
5872
  return null;
5833
5873
  const n = _e(e, "user_id", "userId"), i = _e(e, "conversation_id", "conversationId");
5834
5874
  if (!n || !i)
5835
5875
  return null;
5836
- const o = e.user, u = se(o) ? {
5876
+ const o = e.user, u = ne(o) ? {
5837
5877
  id: typeof o.id == "string" && o.id !== "" ? o.id : n,
5838
5878
  name: typeof o.name == "string" ? o.name : "",
5839
5879
  ...typeof o.avatar == "string" && o.avatar !== "" ? { avatar: o.avatar } : {}
@@ -5848,13 +5888,13 @@ function la(e) {
5848
5888
  ...typeof e.stopped_at == "string" ? { stopped_at: e.stopped_at } : {}
5849
5889
  };
5850
5890
  }
5851
- function ha(e) {
5852
- if (!se(e))
5891
+ function fa(e) {
5892
+ if (!ne(e))
5853
5893
  return null;
5854
5894
  const n = _e(e, "user_id", "userId"), i = _e(e, "conversation_id", "conversationId");
5855
5895
  if (!n || !i)
5856
5896
  return null;
5857
- const o = se(e.user) ? {
5897
+ const o = ne(e.user) ? {
5858
5898
  ...typeof e.user.id == "string" && e.user.id !== "" ? { id: e.user.id } : {},
5859
5899
  ...typeof e.user.name == "string" ? { name: e.user.name } : {},
5860
5900
  ...typeof e.user.avatar == "string" && e.user.avatar !== "" ? { avatar: e.user.avatar } : {}
@@ -5867,8 +5907,8 @@ function ha(e) {
5867
5907
  ...typeof e.ts == "string" ? { ts: e.ts } : {}
5868
5908
  };
5869
5909
  }
5870
- function da(e) {
5871
- if (!se(e))
5910
+ function pa(e) {
5911
+ if (!ne(e))
5872
5912
  return null;
5873
5913
  const n = _e(e, "user_id", "userId"), i = _e(e, "conversation_id", "conversationId");
5874
5914
  return !n || !i ? null : {
@@ -5878,32 +5918,32 @@ function da(e) {
5878
5918
  ...typeof e.ts == "string" ? { ts: e.ts } : {}
5879
5919
  };
5880
5920
  }
5881
- function fa(e) {
5882
- return se(e) && ae(e, "id") && ae(e, "name");
5883
- }
5884
- function pa(e) {
5885
- return !se(e) || !ae(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => fa(n));
5886
- }
5887
5921
  function ga(e) {
5888
- return se(e) && se(e.message) && ae(e.message, "id") && ae(e.message, "conversation_id") && ae(e.message, "author_id");
5922
+ return ne(e) && ae(e, "id") && ae(e, "name");
5889
5923
  }
5890
5924
  function ma(e) {
5891
- return se(e) && ae(e, "conversation_id") && ae(e, "user_id") && ae(e, "message_id");
5925
+ return !ne(e) || !ae(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => ga(n));
5892
5926
  }
5893
5927
  function va(e) {
5894
- return se(e) && ae(e, "conversation_id") && se(e.message) && ae(e.message, "id");
5928
+ return ne(e) && ne(e.message) && ae(e.message, "id") && ae(e.message, "conversation_id") && ae(e.message, "author_id");
5895
5929
  }
5896
5930
  function ba(e) {
5897
- return se(e) && ae(e, "conversation_id") && ae(e, "message_id");
5931
+ return ne(e) && ae(e, "conversation_id") && ae(e, "user_id") && ae(e, "message_id");
5898
5932
  }
5899
5933
  function ya(e) {
5900
- return se(e) && ae(e, "conversation_id") && ae(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => pa(n));
5934
+ return ne(e) && ae(e, "conversation_id") && ne(e.message) && ae(e.message, "id");
5901
5935
  }
5902
5936
  function _a(e) {
5903
- return se(e) && ae(e, "conversation_id");
5937
+ return ne(e) && ae(e, "conversation_id") && ae(e, "message_id");
5904
5938
  }
5905
5939
  function Sa(e) {
5906
- return se(e) && ae(e, "conversation_id") && ae(e, "removed_user_id");
5940
+ return ne(e) && ae(e, "conversation_id") && ae(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => ma(n));
5941
+ }
5942
+ function wa(e) {
5943
+ return ne(e) && ae(e, "conversation_id");
5944
+ }
5945
+ function Ca(e) {
5946
+ return ne(e) && ae(e, "conversation_id") && ae(e, "removed_user_id");
5907
5947
  }
5908
5948
  function Re(e, n, i, o) {
5909
5949
  const u = (l) => {
@@ -5911,61 +5951,61 @@ function Re(e, n, i, o) {
5911
5951
  };
5912
5952
  return e.listen(n, u), u;
5913
5953
  }
5914
- function Da(e) {
5915
- const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ?? Zo, o = e.bootstrapRefreshSkewMs ?? ea, u = e.presenceFreshnessTtlMs ?? na, l = (e.createLogger ?? Dt())("MessengerEcho");
5916
- typeof window < "u" && (window.Pusher = Qo);
5917
- let h = null, g = null, d = null, P = null, x = "disconnected", v = null, y = null;
5918
- const T = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Map(), S = (w) => {
5919
- x = w;
5920
- for (const k of T)
5921
- k(w);
5954
+ function za(e) {
5955
+ const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ?? ta, o = e.bootstrapRefreshSkewMs ?? na, u = e.presenceFreshnessTtlMs ?? ra, l = (e.createLogger ?? Dt())("MessengerEcho");
5956
+ typeof window < "u" && (window.Pusher = ea);
5957
+ let h = null, g = null, d = null, A = null, x = "disconnected", m = null, y = null;
5958
+ const E = /* @__PURE__ */ new Set(), R = /* @__PURE__ */ new Map(), S = (T) => {
5959
+ x = T;
5960
+ for (const k of E)
5961
+ k(T);
5922
5962
  }, f = () => {
5923
5963
  y !== null && (clearTimeout(y), y = null);
5924
- }, m = (w = !0) => {
5925
- d !== null && (d.disconnect(), d = null), P = null, w && S("disconnected");
5964
+ }, v = (T = !0) => {
5965
+ d !== null && (d.disconnect(), d = null), A = null, T && S("disconnected");
5926
5966
  }, b = () => {
5927
- f(), h = null, g = null, v = null, m(), E.clear();
5967
+ f(), h = null, g = null, m = null, v(), R.clear();
5928
5968
  }, F = () => {
5929
5969
  if (!e.getSourceToken)
5930
5970
  return null;
5931
- const w = e.getSourceToken();
5932
- return w === null ? (b(), null) : (v !== null && v !== w && (f(), h = null, g = null, m()), v = w, w);
5933
- }, j = (w) => {
5934
- if (w === null)
5971
+ const T = e.getSourceToken();
5972
+ return T === null ? (b(), null) : (m !== null && m !== T && (f(), h = null, g = null, v()), m = T, T);
5973
+ }, j = (T) => {
5974
+ if (T === null)
5935
5975
  return !1;
5936
- if (w.auth.expiresAt === null)
5937
- return w.auth.token !== "";
5938
- const k = Date.parse(w.auth.expiresAt);
5976
+ if (T.auth.expiresAt === null)
5977
+ return T.auth.token !== "";
5978
+ const k = Date.parse(T.auth.expiresAt);
5939
5979
  return Number.isNaN(k) ? !1 : k - Date.now() > o;
5940
- }, H = (w) => {
5941
- if (f(), w.auth.expiresAt === null)
5980
+ }, B = (T) => {
5981
+ if (f(), T.auth.expiresAt === null)
5942
5982
  return;
5943
- const k = Date.parse(w.auth.expiresAt);
5983
+ const k = Date.parse(T.auth.expiresAt);
5944
5984
  if (Number.isNaN(k))
5945
5985
  return;
5946
- const Q = Math.max(0, k - Date.now() - o);
5986
+ const Y = Math.max(0, k - Date.now() - o);
5947
5987
  y = setTimeout(() => {
5948
5988
  U();
5949
- }, Q);
5950
- }, R = async (w = !1) => e.getSourceToken && F() === null ? null : !w && j(h) ? h : !w && g !== null ? await g : (g = (async () => {
5951
- const Q = await e.bootstrapClient.get(
5989
+ }, Y);
5990
+ }, P = async (T = !1) => e.getSourceToken && F() === null ? null : !T && j(h) ? h : !T && g !== null ? await g : (g = (async () => {
5991
+ const Y = await e.bootstrapClient.get(
5952
5992
  i,
5953
- w ? { params: { refresh: 1 } } : void 0
5954
- ), N = oa(Q.data);
5955
- return h = N, H(N), N;
5993
+ T ? { params: { refresh: 1 } } : void 0
5994
+ ), N = ca(Y.data);
5995
+ return h = N, B(N), N;
5956
5996
  })().finally(() => {
5957
5997
  g = null;
5958
5998
  }), await g), U = async () => {
5959
- const w = d !== null;
5999
+ const T = d !== null;
5960
6000
  try {
5961
- if (await R(!0), !w)
6001
+ if (await P(!0), !T)
5962
6002
  return;
5963
- m(!1), await z(!0);
6003
+ v(!1), await z(!0);
5964
6004
  } catch (k) {
5965
6005
  l.warn("Failed to refresh messenger bootstrap", k);
5966
6006
  }
5967
- }, B = (w) => {
5968
- const k = w.connector?.pusher?.connection;
6007
+ }, $ = (T) => {
6008
+ const k = T.connector?.pusher?.connection;
5969
6009
  if (!k) {
5970
6010
  l.warn("Messenger echo connector does not expose a Pusher connection");
5971
6011
  return;
@@ -5981,92 +6021,92 @@ function Da(e) {
5981
6021
  }), k.bind("error", () => {
5982
6022
  S("error");
5983
6023
  }), k.state === "connected" && S("connected");
5984
- }, z = async (w = !1) => !w && d !== null && j(h) ? d : !w && P !== null ? await P : (P = (async () => {
5985
- const Q = await R(w);
5986
- if (Q === null)
6024
+ }, z = async (T = !1) => !T && d !== null && j(h) ? d : !T && A !== null ? await A : (A = (async () => {
6025
+ const Y = await P(T);
6026
+ if (Y === null)
5987
6027
  return null;
5988
- d !== null && m(!1);
5989
- const N = Q.service.reverb.scheme === "https", V = {
6028
+ d !== null && v(!1);
6029
+ const N = Y.service.reverb.scheme === "https", V = {
5990
6030
  broadcaster: "reverb",
5991
- key: Q.service.reverb.appKey,
5992
- wsHost: aa(Q.service.reverb.host),
5993
- wsPort: Q.service.reverb.port,
5994
- wssPort: Q.service.reverb.port,
6031
+ key: Y.service.reverb.appKey,
6032
+ wsHost: ua(Y.service.reverb.host),
6033
+ wsPort: Y.service.reverb.port,
6034
+ wssPort: Y.service.reverb.port,
5995
6035
  forceTLS: N,
5996
6036
  encrypted: N,
5997
6037
  disableStats: !0,
5998
6038
  enabledTransports: ["ws", "wss"],
5999
- authEndpoint: Q.service.broadcastingAuthUrl,
6039
+ authEndpoint: Y.service.broadcastingAuthUrl,
6000
6040
  auth: {
6001
6041
  headers: {
6002
- Authorization: `Bearer ${Q.auth.token}`,
6042
+ Authorization: `Bearer ${Y.auth.token}`,
6003
6043
  Accept: "application/json"
6004
6044
  }
6005
6045
  }
6006
6046
  };
6007
- return Q.service.reverb.path && (V.wsPath = Q.service.reverb.path), d = new Go(V), B(d), S("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), d;
6047
+ return Y.service.reverb.path && (V.wsPath = Y.service.reverb.path), d = new Ko(V), $(d), S("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), d;
6008
6048
  })().finally(() => {
6009
- P = null;
6010
- }), await P), Y = Mt.create({
6011
- timeout: e.requestTimeoutMs ?? ta,
6049
+ A = null;
6050
+ }), await A), K = Mt.create({
6051
+ timeout: e.requestTimeoutMs ?? sa,
6012
6052
  withCredentials: !1,
6013
6053
  headers: {
6014
6054
  Accept: "application/json",
6015
6055
  "X-Requested-With": "XMLHttpRequest"
6016
6056
  }
6017
6057
  });
6018
- Y.interceptors.request.use(async (w) => {
6019
- const k = await R();
6058
+ K.interceptors.request.use(async (T) => {
6059
+ const k = await P();
6020
6060
  if (k === null)
6021
6061
  throw new Error("Messenger bootstrap is unavailable.");
6022
- return w.baseURL = k.service.apiBaseUrl, In(w, k.auth.token), w;
6023
- }), Y.interceptors.response.use(
6024
- (w) => w,
6025
- async (w) => {
6026
- const k = w.config;
6027
- if (w.response?.status === 401 && k && k._messengerRetry !== !0) {
6062
+ return T.baseURL = k.service.apiBaseUrl, In(T, k.auth.token), T;
6063
+ }), K.interceptors.response.use(
6064
+ (T) => T,
6065
+ async (T) => {
6066
+ const k = T.config;
6067
+ if (T.response?.status === 401 && k && k._messengerRetry !== !0) {
6028
6068
  k._messengerRetry = !0;
6029
- const Q = await R(!0);
6030
- if (Q !== null)
6031
- return k.baseURL = Q.service.apiBaseUrl, In(k, Q.auth.token), await Y(k);
6069
+ const Y = await P(!0);
6070
+ if (Y !== null)
6071
+ return k.baseURL = Y.service.apiBaseUrl, In(k, Y.auth.token), await K(k);
6032
6072
  }
6033
- return Promise.reject(w);
6073
+ return Promise.reject(T);
6034
6074
  }
6035
6075
  );
6036
- const W = () => (z().catch((w) => {
6037
- l.warn("Failed to initialize messenger echo", w);
6038
- }), d), A = (w) => (T.add(w), w(x), () => {
6039
- T.delete(w);
6040
- }), M = () => h?.auth.tenantId ?? "global", te = (w) => {
6041
- const k = Pt(w.ts)?.getTime() ?? Pt(w.last_seen_at)?.getTime() ?? null;
6076
+ const se = () => (z().catch((T) => {
6077
+ l.warn("Failed to initialize messenger echo", T);
6078
+ }), d), w = (T) => (E.add(T), T(x), () => {
6079
+ E.delete(T);
6080
+ }), M = () => h?.auth.tenantId ?? "global", ee = (T) => {
6081
+ const k = Pt(T.ts)?.getTime() ?? Pt(T.last_seen_at)?.getTime() ?? null;
6042
6082
  if (k === null)
6043
6083
  return !0;
6044
- const Q = `${w.tenant_scope ?? "global"}:${w.user_id}`, N = E.get(Q);
6084
+ const Y = `${T.tenant_scope ?? "global"}:${T.user_id}`, N = R.get(Y);
6045
6085
  if (N && k < N.timestampMs)
6046
6086
  return !1;
6047
6087
  const V = Date.now();
6048
- E.set(Q, {
6088
+ R.set(Y, {
6049
6089
  timestampMs: k,
6050
6090
  seenAt: V
6051
6091
  });
6052
- for (const [me, ve] of E.entries())
6053
- V - ve.seenAt > u && E.delete(me);
6092
+ for (const [me, ve] of R.entries())
6093
+ V - ve.seenAt > u && R.delete(me);
6054
6094
  return !0;
6055
6095
  };
6056
6096
  return {
6057
- apiClient: Y,
6097
+ apiClient: K,
6058
6098
  initializedEvent: n,
6059
- getEcho: W,
6099
+ getEcho: se,
6060
6100
  getConnectionStatus: () => x,
6061
- onConnectionStatusChange: A,
6101
+ onConnectionStatusChange: w,
6062
6102
  reconnect: async () => {
6063
- m(), await z(!0);
6103
+ v(), await z(!0);
6064
6104
  },
6065
- subscribeToPresenceStatus: (w) => {
6066
- const k = W();
6105
+ subscribeToPresenceStatus: (T) => {
6106
+ const k = se();
6067
6107
  if (!k || typeof k.join != "function")
6068
6108
  return;
6069
- const Q = k.join(`online-users.${M()}`), N = [
6109
+ const Y = k.join(`online-users.${M()}`), N = [
6070
6110
  ".PresenceStatusChanged",
6071
6111
  "PresenceStatusChanged",
6072
6112
  ".presence.status.changed",
@@ -6077,56 +6117,56 @@ function Da(e) {
6077
6117
  "Modules\\Presence\\Events\\UserPresenceStatusChanged"
6078
6118
  ];
6079
6119
  for (const V of N)
6080
- Q.listen(V, (me) => {
6081
- const ve = ua(me, M());
6082
- !ve || !te(ve) || w(ve);
6120
+ Y.listen(V, (me) => {
6121
+ const ve = ha(me, M());
6122
+ !ve || !ee(ve) || T(ve);
6083
6123
  });
6084
6124
  },
6085
6125
  unsubscribeFromPresenceStatus: () => {
6086
6126
  d?.leave(`online-users.${M()}`);
6087
6127
  },
6088
- subscribeToConversation: (w, k) => {
6089
- const Q = W();
6090
- if (!Q)
6128
+ subscribeToConversation: (T, k) => {
6129
+ const Y = se();
6130
+ if (!Y)
6091
6131
  return () => {
6092
6132
  };
6093
- const N = Q.private(`conversation.${w}`), V = [];
6133
+ const N = Y.private(`conversation.${T}`), V = [];
6094
6134
  return k.onMessageSent && V.push({
6095
6135
  event: ".ConversationMessageSent",
6096
- handler: Re(N, ".ConversationMessageSent", ga, k.onMessageSent)
6136
+ handler: Re(N, ".ConversationMessageSent", va, k.onMessageSent)
6097
6137
  }), k.onMessageRead && V.push({
6098
6138
  event: ".ConversationMessageRead",
6099
- handler: Re(N, ".ConversationMessageRead", ma, k.onMessageRead)
6139
+ handler: Re(N, ".ConversationMessageRead", ba, k.onMessageRead)
6100
6140
  }), k.onMessageEdited && V.push({
6101
6141
  event: ".ConversationMessageEdited",
6102
- handler: Re(N, ".ConversationMessageEdited", va, k.onMessageEdited)
6142
+ handler: Re(N, ".ConversationMessageEdited", ya, k.onMessageEdited)
6103
6143
  }), k.onMessageDeleted && V.push({
6104
6144
  event: ".ConversationMessageDeleted",
6105
- handler: Re(N, ".ConversationMessageDeleted", ba, k.onMessageDeleted)
6145
+ handler: Re(N, ".ConversationMessageDeleted", _a, k.onMessageDeleted)
6106
6146
  }), k.onReactionToggled && V.push({
6107
6147
  event: ".MessageReactionToggled",
6108
- handler: Re(N, ".MessageReactionToggled", ya, k.onReactionToggled)
6148
+ handler: Re(N, ".MessageReactionToggled", Sa, k.onReactionToggled)
6109
6149
  }), k.onRequestAccepted && V.push({
6110
6150
  event: ".ConversationRequestAccepted",
6111
- handler: Re(N, ".ConversationRequestAccepted", _a, k.onRequestAccepted)
6151
+ handler: Re(N, ".ConversationRequestAccepted", wa, k.onRequestAccepted)
6112
6152
  }), k.onParticipantRemoved && V.push({
6113
6153
  event: ".ConversationParticipantRemoved",
6114
- handler: Re(N, ".ConversationParticipantRemoved", Sa, k.onParticipantRemoved)
6154
+ handler: Re(N, ".ConversationParticipantRemoved", Ca, k.onParticipantRemoved)
6115
6155
  }), () => {
6116
6156
  if (typeof N.stopListening == "function")
6117
6157
  for (const me of V)
6118
6158
  N.stopListening(me.event, me.handler);
6119
6159
  };
6120
6160
  },
6121
- unsubscribeFromConversation: (w) => {
6122
- d?.leave(`conversation.${w}`);
6161
+ unsubscribeFromConversation: (T) => {
6162
+ d?.leave(`conversation.${T}`);
6123
6163
  },
6124
- subscribeToTyping: (w, k) => {
6125
- const Q = W();
6126
- if (!Q)
6164
+ subscribeToTyping: (T, k) => {
6165
+ const Y = se();
6166
+ if (!Y)
6127
6167
  return () => {
6128
6168
  };
6129
- const N = Q.private(`typing-conversation.${w}`), V = [], me = [
6169
+ const N = Y.private(`typing-conversation.${T}`), V = [], me = [
6130
6170
  ".TypingStateChanged",
6131
6171
  "TypingStateChanged",
6132
6172
  ".typing.changed",
@@ -6137,58 +6177,58 @@ function Da(e) {
6137
6177
  "Modules\\Messaging\\Events\\Broadcast\\TypingStateChanged"
6138
6178
  ], ve = [".typing.start", "typing.start", ".TypingStarted", "TypingStarted", ".TypingStart", "TypingStart"], fe = [".typing.stop", "typing.stop", ".TypingStopped", "TypingStopped", ".TypingStop", "TypingStop"], $e = /* @__PURE__ */ new Set(["start", "typing"]), ot = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]);
6139
6179
  for (const ce of me) {
6140
- const pe = (Ce) => {
6141
- const G = la(Ce);
6142
- if (G) {
6143
- if ($e.has(G.state)) {
6180
+ const pe = (we) => {
6181
+ const W = da(we);
6182
+ if (W) {
6183
+ if ($e.has(W.state)) {
6144
6184
  k.onTypingStart?.({
6145
- user_id: G.user_id,
6146
- user: G.user ?? {
6147
- id: G.user_id,
6185
+ user_id: W.user_id,
6186
+ user: W.user ?? {
6187
+ id: W.user_id,
6148
6188
  name: ""
6149
6189
  },
6150
- conversation_id: G.conversation_id,
6151
- started_at: G.started_at ?? G.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6190
+ conversation_id: W.conversation_id,
6191
+ started_at: W.started_at ?? W.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6152
6192
  });
6153
6193
  return;
6154
6194
  }
6155
- ot.has(G.state) && k.onTypingStop?.({
6156
- user_id: G.user_id,
6157
- conversation_id: G.conversation_id,
6158
- stopped_at: G.stopped_at ?? G.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6195
+ ot.has(W.state) && k.onTypingStop?.({
6196
+ user_id: W.user_id,
6197
+ conversation_id: W.conversation_id,
6198
+ stopped_at: W.stopped_at ?? W.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6159
6199
  });
6160
6200
  }
6161
6201
  };
6162
6202
  N.listen(ce, pe), V.push({ event: ce, handler: pe });
6163
6203
  }
6164
6204
  for (const ce of ve) {
6165
- const pe = (Ce) => {
6166
- const G = ha(Ce);
6167
- if (!G)
6205
+ const pe = (we) => {
6206
+ const W = fa(we);
6207
+ if (!W)
6168
6208
  return;
6169
6209
  const xe = {
6170
- user_id: G.user_id,
6210
+ user_id: W.user_id,
6171
6211
  user: {
6172
- id: G.user?.id ?? G.user_id,
6173
- name: G.user?.name ?? "",
6174
- ...G.user?.avatar ? { avatar: G.user.avatar } : {}
6212
+ id: W.user?.id ?? W.user_id,
6213
+ name: W.user?.name ?? "",
6214
+ ...W.user?.avatar ? { avatar: W.user.avatar } : {}
6175
6215
  },
6176
- conversation_id: G.conversation_id,
6177
- started_at: G.started_at ?? G.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6216
+ conversation_id: W.conversation_id,
6217
+ started_at: W.started_at ?? W.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6178
6218
  };
6179
6219
  k.onTypingStart?.(xe);
6180
6220
  };
6181
6221
  N.listen(ce, pe), V.push({ event: ce, handler: pe });
6182
6222
  }
6183
6223
  for (const ce of fe) {
6184
- const pe = (Ce) => {
6185
- const G = da(Ce);
6186
- if (!G)
6224
+ const pe = (we) => {
6225
+ const W = pa(we);
6226
+ if (!W)
6187
6227
  return;
6188
6228
  const xe = {
6189
- user_id: G.user_id,
6190
- conversation_id: G.conversation_id,
6191
- stopped_at: G.stopped_at ?? G.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6229
+ user_id: W.user_id,
6230
+ conversation_id: W.conversation_id,
6231
+ stopped_at: W.stopped_at ?? W.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6192
6232
  };
6193
6233
  k.onTypingStop?.(xe);
6194
6234
  };
@@ -6200,36 +6240,36 @@ function Da(e) {
6200
6240
  N.stopListening(ce.event, ce.handler);
6201
6241
  };
6202
6242
  },
6203
- unsubscribeFromTyping: (w) => {
6204
- d?.leave(`typing-conversation.${w}`);
6243
+ unsubscribeFromTyping: (T) => {
6244
+ d?.leave(`typing-conversation.${T}`);
6205
6245
  },
6206
6246
  clearRuntime: b
6207
6247
  };
6208
6248
  }
6209
6249
  export {
6210
6250
  ho as DEFAULT_PRESENCE_STALE_AFTER_MS,
6211
- Na as configureMessengerClient,
6212
- Da as createMessengerEcho,
6251
+ Da as configureMessengerClient,
6252
+ za as createMessengerEcho,
6213
6253
  X as getApi,
6214
6254
  Pe as getAuthStore,
6215
- Pa as getConnectionStatus,
6255
+ Ma as getConnectionStatus,
6216
6256
  Ae as getEcho,
6217
6257
  Hn as getEchoConnectionStatus,
6218
6258
  De as getEchoInitializedEvent,
6219
- Z as getErrorMessage,
6259
+ Q as getErrorMessage,
6220
6260
  Dt as getLoggerFactory,
6221
6261
  es as getMainApi,
6222
6262
  Qi as getMainEcho,
6223
6263
  Zi as getMainEchoConnectionStatus,
6224
6264
  Yi as getMainEchoInitializedEvent,
6225
6265
  Pi as getMediaApi,
6226
- wo as getPresenceRuntimeConfig,
6227
- Ma as hasResponse,
6228
- ja as isAxiosError,
6229
- xa as isError,
6230
- Ci as isValidMessageReadEvent,
6266
+ Co as getPresenceRuntimeConfig,
6267
+ Ia as hasResponse,
6268
+ Ha as isAxiosError,
6269
+ ka as isError,
6270
+ wi as isValidMessageReadEvent,
6231
6271
  Si as isValidMessageSentEvent,
6232
- wi as isValidRequestAcceptedEvent,
6272
+ Ci as isValidRequestAcceptedEvent,
6233
6273
  Se as messagingApi,
6234
6274
  po as normalizePresenceStatus,
6235
6275
  ts as normalizePresenceTimestamp,
@@ -6245,7 +6285,7 @@ export {
6245
6285
  Ei as resetMessagingApiClient,
6246
6286
  Ai as resetMessagingAuthStoreResolver,
6247
6287
  Mi as resetMessagingMediaApi,
6248
- Fa as resetMessengerClientConfig,
6288
+ qa as resetMessengerClientConfig,
6249
6289
  Eo as resetPresenceRuntimeConfig,
6250
6290
  go as resolveFreshPresenceStatus,
6251
6291
  xn as resolvePresenceSnapshot,
@@ -6263,10 +6303,10 @@ export {
6263
6303
  mi as unsubscribeFromConversation,
6264
6304
  pi as unsubscribeFromPresenceStatus,
6265
6305
  bi as unsubscribeFromTyping,
6266
- Ia as useConnectionStatus,
6267
- ka as useConversationChannel,
6268
- La as useGlobalMessaging,
6306
+ Ua as useConnectionStatus,
6307
+ La as useConversationChannel,
6308
+ Oa as useGlobalMessaging,
6269
6309
  Nt as useMessagingStore,
6270
- Ua as usePresence,
6271
- Oa as useTypingChannel
6310
+ Na as usePresence,
6311
+ Fa as useTypingChannel
6272
6312
  };