@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 +780 -740
- package/dist/services/presenceRuntime.d.ts +2 -0
- package/package.json +1 -1
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
|
|
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
|
-
},
|
|
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 = () =>
|
|
29
|
-
await
|
|
30
|
-
}, fi = (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 && (
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
80
|
+
function ka(e) {
|
|
81
81
|
return e instanceof Error;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
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
|
|
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
|
|
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
|
|
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) =>
|
|
502
|
-
requestCount: (e) =>
|
|
503
|
-
unreadRequestCount: (e) =>
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
-
),
|
|
592
|
+
), A = g.map((m) => {
|
|
593
593
|
const y = this.conversations.find(
|
|
594
|
-
(
|
|
594
|
+
(E) => E.id === m.id
|
|
595
595
|
);
|
|
596
|
-
return Ue(
|
|
596
|
+
return Ue(m, y);
|
|
597
597
|
});
|
|
598
|
-
e ? this.conversations.push(...
|
|
598
|
+
e ? this.conversations.push(...A) : this.conversations = A, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
|
|
599
599
|
const x = {
|
|
600
|
-
data:
|
|
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 =
|
|
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 =
|
|
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((
|
|
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 =
|
|
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 (
|
|
675
|
-
if (!(o < Oi && bn(
|
|
676
|
-
throw
|
|
677
|
-
o += 1, await yn(Di(
|
|
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
|
|
685
|
-
return
|
|
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
|
|
688
|
-
|
|
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 =
|
|
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,
|
|
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:
|
|
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
|
-
|
|
715
|
-
id:
|
|
716
|
-
name:
|
|
717
|
-
...
|
|
718
|
-
...
|
|
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
|
|
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 (
|
|
730
|
-
const
|
|
729
|
+
i.map(async (B) => {
|
|
730
|
+
const P = await Pi().uploadImage(B);
|
|
731
731
|
return {
|
|
732
|
-
media_id:
|
|
733
|
-
mime:
|
|
734
|
-
size:
|
|
732
|
+
media_id: P.id,
|
|
733
|
+
mime: P.mime_type,
|
|
734
|
+
size: P.size
|
|
735
735
|
};
|
|
736
736
|
})
|
|
737
737
|
);
|
|
738
|
-
|
|
738
|
+
m = await X().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
739
739
|
...y,
|
|
740
740
|
attachments: j
|
|
741
741
|
});
|
|
742
742
|
} else
|
|
743
|
-
|
|
743
|
+
m = await X().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
744
744
|
...y,
|
|
745
745
|
type: "text"
|
|
746
746
|
});
|
|
747
|
-
const
|
|
748
|
-
|
|
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
|
|
753
|
-
|
|
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 (
|
|
757
|
-
throw this._pendingSendIds.delete(g), this.messages[e] = this.messages[e].filter((y) => y.id !== g), this.error =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 (!
|
|
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 =
|
|
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 (!
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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((
|
|
990
|
+
const d = o.findIndex((A) => A.id.startsWith("temp-"));
|
|
991
991
|
if (d >= 0) {
|
|
992
|
-
const
|
|
993
|
-
o[d] = i, this._pendingSendIds.delete(
|
|
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
|
|
1001
|
-
if (
|
|
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
|
|
1014
|
-
return delete
|
|
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 (
|
|
1044
|
-
if (!Gi(
|
|
1045
|
-
throw
|
|
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,
|
|
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
|
-
(
|
|
1051
|
+
(A.length > 0 || h.length === 0) && this.updateMessageReactions(e, n, A);
|
|
1052
1052
|
try {
|
|
1053
|
-
const
|
|
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,
|
|
1056
|
+
this.updateMessageReactions(e, n, E);
|
|
1057
1057
|
} catch {
|
|
1058
1058
|
}
|
|
1059
1059
|
} catch (g) {
|
|
1060
|
-
throw this.error =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
|
1181
|
-
const n = Nt(), i = Pe()(), o = de(!1), u = de(null), l = de(null), h = xt(), g = h !== null, d = 20,
|
|
1182
|
-
let x = 0,
|
|
1183
|
-
const
|
|
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
|
-
|
|
1185
|
+
m && (clearTimeout(m), m = null), x = 0;
|
|
1186
1186
|
}
|
|
1187
1187
|
function f() {
|
|
1188
|
-
!g || o.value ||
|
|
1189
|
-
|
|
1190
|
-
},
|
|
1191
|
-
}
|
|
1192
|
-
function
|
|
1193
|
-
if (n.addMessage(
|
|
1194
|
-
const M = n.getConversationById(
|
|
1195
|
-
M && (M.unread_count = 0), n.markAsRead(
|
|
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(
|
|
1200
|
-
n.applyParticipantReadState(
|
|
1199
|
+
function b(w) {
|
|
1200
|
+
n.applyParticipantReadState(w);
|
|
1201
1201
|
}
|
|
1202
|
-
function F(
|
|
1203
|
-
const M = n.getMessagesByConversationId(
|
|
1204
|
-
if (
|
|
1205
|
-
const C = M[
|
|
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
|
-
|
|
1209
|
-
const L = n.getConversationById(
|
|
1210
|
-
L && L.last_message?.id ===
|
|
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(
|
|
1214
|
-
n.removeMessage(
|
|
1213
|
+
function j(w) {
|
|
1214
|
+
n.removeMessage(w.conversation_id, w.message_id);
|
|
1215
1215
|
}
|
|
1216
|
-
function
|
|
1216
|
+
function B(w) {
|
|
1217
1217
|
n.updateMessageReactions(
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1218
|
+
w.conversation_id,
|
|
1219
|
+
w.message_id,
|
|
1220
|
+
w.reactions
|
|
1221
1221
|
);
|
|
1222
1222
|
}
|
|
1223
|
-
function
|
|
1224
|
-
const M = n.getConversationById(
|
|
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
|
-
(
|
|
1226
|
+
(ee) => ee.id !== w.conversation_id
|
|
1227
1227
|
);
|
|
1228
1228
|
}
|
|
1229
|
-
function U(
|
|
1230
|
-
|
|
1229
|
+
function U(w) {
|
|
1230
|
+
w.removed_user_id === E.value && (se(), n.deleteConversation(w.conversation_id).catch(() => {
|
|
1231
1231
|
}));
|
|
1232
1232
|
}
|
|
1233
|
-
function
|
|
1234
|
-
const
|
|
1235
|
-
if (!(o.value || !
|
|
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(
|
|
1243
|
-
onMessageSent:
|
|
1242
|
+
y = gi(w, {
|
|
1243
|
+
onMessageSent: v,
|
|
1244
1244
|
onMessageRead: b,
|
|
1245
1245
|
onMessageEdited: F,
|
|
1246
1246
|
onMessageDeleted: j,
|
|
1247
|
-
onReactionToggled:
|
|
1248
|
-
onRequestAccepted:
|
|
1247
|
+
onReactionToggled: B,
|
|
1248
|
+
onRequestAccepted: P,
|
|
1249
1249
|
onParticipantRemoved: U
|
|
1250
|
-
}), o.value = !0, l.value =
|
|
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 ||
|
|
1257
|
+
o.value || $();
|
|
1258
1258
|
}
|
|
1259
1259
|
typeof window < "u" && window.addEventListener(De(), z);
|
|
1260
|
-
const
|
|
1261
|
-
if (
|
|
1262
|
-
o.value ||
|
|
1260
|
+
const K = it((w) => {
|
|
1261
|
+
if (w === "connected") {
|
|
1262
|
+
o.value || $();
|
|
1263
1263
|
return;
|
|
1264
1264
|
}
|
|
1265
|
-
(
|
|
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
|
|
1268
|
-
const
|
|
1269
|
-
if (S(), !(!o.value || !
|
|
1267
|
+
function se() {
|
|
1268
|
+
const w = l.value;
|
|
1269
|
+
if (S(), !(!o.value || !w))
|
|
1270
1270
|
try {
|
|
1271
|
-
y && (y(), y = null), n.hasGlobalConversationSubscription(
|
|
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(),
|
|
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:
|
|
1282
|
-
unsubscribe:
|
|
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
|
|
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),
|
|
1368
|
-
let y = null,
|
|
1369
|
-
const F = ie(() => l.value === "connected"), j = ie(() => l.value === "connecting"),
|
|
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
|
-
}),
|
|
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
|
-
}),
|
|
1407
|
+
}), se = async () => {
|
|
1408
1408
|
Rn.debug("Manual reconnect triggered"), g.value += 1, await o.reconnect();
|
|
1409
|
-
},
|
|
1410
|
-
if (L !== "connecting" &&
|
|
1411
|
-
const re = !
|
|
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,
|
|
1414
|
-
|
|
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
|
-
|
|
1418
|
+
R && (clearTimeout(R), R = null), d.value = !0;
|
|
1419
1419
|
return;
|
|
1420
1420
|
}
|
|
1421
1421
|
if (L === "connected") {
|
|
1422
|
-
|
|
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 (
|
|
1426
|
+
if (A.value) {
|
|
1427
1427
|
d.value = !0;
|
|
1428
1428
|
return;
|
|
1429
1429
|
}
|
|
1430
|
-
if (x.value || (d.value = !1),
|
|
1430
|
+
if (x.value || (d.value = !1), E)
|
|
1431
1431
|
return;
|
|
1432
|
-
|
|
1433
|
-
if (
|
|
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
|
-
|
|
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
|
|
1444
|
-
if (L === "connecting" &&
|
|
1445
|
-
l.value = "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" && (
|
|
1449
|
-
},
|
|
1450
|
-
const L = Pn(o),
|
|
1451
|
-
if (L === "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" &&
|
|
1455
|
+
if (L === "connecting" && H !== "connecting") {
|
|
1456
1456
|
M("connecting");
|
|
1457
1457
|
return;
|
|
1458
1458
|
}
|
|
1459
|
-
if ((L === "unavailable" || L === "failed" || L === "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" &&
|
|
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 =
|
|
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(),
|
|
1501
|
-
return
|
|
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()),
|
|
1505
|
-
C(),
|
|
1506
|
-
}, window.addEventListener(o.initializedEvent,
|
|
1507
|
-
|
|
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?.(),
|
|
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:
|
|
1516
|
-
isError:
|
|
1515
|
+
isDisconnected: B,
|
|
1516
|
+
isError: P,
|
|
1517
1517
|
hasConnectionIssues: U,
|
|
1518
|
-
statusMessage:
|
|
1518
|
+
statusMessage: $,
|
|
1519
1519
|
statusColor: z,
|
|
1520
|
-
statusIcon:
|
|
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:
|
|
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}`,
|
|
1593
|
-
function
|
|
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
|
|
1596
|
-
function x(
|
|
1597
|
-
const U = d.get(
|
|
1598
|
-
if (U && (d.delete(
|
|
1599
|
-
for (const
|
|
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(
|
|
1601
|
+
U.channel.stopListening($.event, $.handler);
|
|
1602
1602
|
} catch {
|
|
1603
1603
|
}
|
|
1604
1604
|
}
|
|
1605
|
-
function
|
|
1606
|
-
for (const
|
|
1607
|
-
x(
|
|
1605
|
+
function m() {
|
|
1606
|
+
for (const P of g)
|
|
1607
|
+
x(P), e.unregisterGlobalConversationSubscription(P);
|
|
1608
1608
|
g.clear();
|
|
1609
1609
|
}
|
|
1610
|
-
function y(
|
|
1610
|
+
function y(P) {
|
|
1611
1611
|
const U = Ae();
|
|
1612
|
-
if (!U || g.has(
|
|
1613
|
-
const
|
|
1614
|
-
x(
|
|
1615
|
-
const z = U.private(
|
|
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
|
|
1621
|
-
if (!C ||
|
|
1622
|
-
e.addMessage(
|
|
1623
|
-
const O = e.hasDetailSubscription(
|
|
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(
|
|
1626
|
-
re && (re.unread_count = 0), e.markAsRead(
|
|
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
|
|
1631
|
-
if (
|
|
1632
|
-
const re =
|
|
1633
|
-
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
|
-
},
|
|
1636
|
-
if (!
|
|
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
|
-
},
|
|
1642
|
-
if (!
|
|
1641
|
+
}, w = (M) => {
|
|
1642
|
+
if (!Ci(M)) {
|
|
1643
1643
|
Ye.warn("Dropping malformed ConversationRequestAccepted event", M);
|
|
1644
1644
|
return;
|
|
1645
1645
|
}
|
|
1646
|
-
const
|
|
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 !==
|
|
1648
|
+
(O) => O.id !== ee.conversation_id
|
|
1649
1649
|
);
|
|
1650
1650
|
};
|
|
1651
|
-
z.listen(".ConversationMessageSent",
|
|
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:
|
|
1655
|
-
{ event: ".ConversationMessageRead", handler:
|
|
1656
|
-
{ event: ".ConversationRequestAccepted", handler:
|
|
1654
|
+
{ event: ".ConversationMessageSent", handler: K },
|
|
1655
|
+
{ event: ".ConversationMessageRead", handler: se },
|
|
1656
|
+
{ event: ".ConversationRequestAccepted", handler: w }
|
|
1657
1657
|
]
|
|
1658
|
-
}), g.add(
|
|
1658
|
+
}), g.add(P), e.registerGlobalConversationSubscription(P);
|
|
1659
1659
|
}
|
|
1660
|
-
function
|
|
1661
|
-
const
|
|
1662
|
-
if (!
|
|
1663
|
-
|
|
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
|
-
|
|
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
|
|
1677
|
-
const
|
|
1678
|
-
if (!
|
|
1679
|
-
const U = e.conversations.slice(0, yo),
|
|
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 (
|
|
1681
|
+
if (!$.has(z) && !e.hasDetailSubscription(z)) {
|
|
1682
1682
|
try {
|
|
1683
|
-
x(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(
|
|
1691
|
+
function S(P) {
|
|
1692
1692
|
const U = xn({
|
|
1693
|
-
status:
|
|
1694
|
-
last_seen_at:
|
|
1693
|
+
status: P.status,
|
|
1694
|
+
last_seen_at: P.last_seen_at ?? null
|
|
1695
1695
|
});
|
|
1696
1696
|
U.status !== null && e.updatePresenceForUser(
|
|
1697
|
-
|
|
1697
|
+
P.user_id,
|
|
1698
1698
|
U.status,
|
|
1699
1699
|
U.lastSeenAt
|
|
1700
1700
|
);
|
|
1701
1701
|
}
|
|
1702
1702
|
async function f() {
|
|
1703
|
-
const
|
|
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 (
|
|
1706
|
+
if (P.length !== 0)
|
|
1707
1707
|
try {
|
|
1708
1708
|
const U = await o.get("/v1/presence/users", {
|
|
1709
|
-
params: { ids:
|
|
1710
|
-
}),
|
|
1711
|
-
for (const z of
|
|
1712
|
-
const
|
|
1713
|
-
|
|
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
|
|
1720
|
-
!Ae() ||
|
|
1719
|
+
function v() {
|
|
1720
|
+
!Ae() || A || (fi(S), A = !0);
|
|
1721
1721
|
}
|
|
1722
1722
|
function b() {
|
|
1723
|
-
|
|
1723
|
+
A && (pi(), A = !1);
|
|
1724
1724
|
}
|
|
1725
1725
|
const F = fn(
|
|
1726
1726
|
h,
|
|
1727
1727
|
() => {
|
|
1728
|
-
|
|
1728
|
+
R();
|
|
1729
1729
|
},
|
|
1730
1730
|
{ deep: !1, immediate: !0 }
|
|
1731
1731
|
), j = fn(
|
|
1732
1732
|
() => u.fullPath,
|
|
1733
1733
|
() => {
|
|
1734
|
-
|
|
1734
|
+
R();
|
|
1735
1735
|
}
|
|
1736
|
-
),
|
|
1737
|
-
|
|
1736
|
+
), B = it((P) => {
|
|
1737
|
+
P === "connected" ? (m(), R(), b(), v(), f()) : (P === "disconnected" || P === "error") && (m(), b());
|
|
1738
1738
|
});
|
|
1739
|
-
|
|
1740
|
-
F(), j(),
|
|
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
|
|
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
|
|
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
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
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
|
-
},
|
|
1835
|
-
|
|
1859
|
+
}, E = () => {
|
|
1860
|
+
m(), u = setInterval(() => {
|
|
1836
1861
|
U();
|
|
1837
1862
|
}, n.heartbeatIntervalMs);
|
|
1838
|
-
},
|
|
1839
|
-
g || console.warn(
|
|
1840
|
-
}, S = async (
|
|
1841
|
-
if (!(!h || d || g) &&
|
|
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:
|
|
1844
|
-
} catch (
|
|
1845
|
-
|
|
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
|
-
},
|
|
1876
|
+
}, v = () => {
|
|
1852
1877
|
if (d || !h || g || document.visibilityState !== "visible")
|
|
1853
1878
|
return;
|
|
1854
|
-
const
|
|
1855
|
-
|
|
1879
|
+
const w = Date.now();
|
|
1880
|
+
w - x < n.activityDebounceMs || (x = w, S("online"), f());
|
|
1856
1881
|
}, b = () => {
|
|
1857
|
-
|
|
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
|
-
},
|
|
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,
|
|
1870
|
-
} catch (
|
|
1871
|
-
return
|
|
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
|
-
},
|
|
1874
|
-
for (let
|
|
1875
|
-
if (await
|
|
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 (
|
|
1883
|
-
|
|
1907
|
+
} catch (w) {
|
|
1908
|
+
Ct(w) && R("[Presence] Heartbeat paused: account is temporarily limited");
|
|
1884
1909
|
}
|
|
1885
|
-
},
|
|
1886
|
-
|
|
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
|
|
1891
|
-
|
|
1928
|
+
if (await P(), d) {
|
|
1929
|
+
$();
|
|
1892
1930
|
return;
|
|
1893
1931
|
}
|
|
1894
|
-
h && (
|
|
1932
|
+
h && (E(), S("online"), f());
|
|
1895
1933
|
}
|
|
1896
|
-
},
|
|
1934
|
+
}, K = () => {
|
|
1897
1935
|
if (!d) {
|
|
1898
1936
|
if (document.visibilityState === "hidden") {
|
|
1899
|
-
|
|
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 &&
|
|
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
|
|
1912
|
-
|
|
1951
|
+
if (await P(), d) {
|
|
1952
|
+
$();
|
|
1913
1953
|
return;
|
|
1914
1954
|
}
|
|
1915
|
-
h && (
|
|
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(),
|
|
1958
|
+
d = !0, j(), y(), m(), $(), document.removeEventListener("visibilitychange", K), window.removeEventListener("pagehide", se), window.removeEventListener("beforeunload", se);
|
|
1919
1959
|
});
|
|
1920
1960
|
}
|
|
1921
|
-
const
|
|
1922
|
-
function
|
|
1923
|
-
const n = Nt(), i = Pe()(), o = de(!1), u = de(null), l = de(null), h = de([]), g = /* @__PURE__ */ new Map(), d = xt(),
|
|
1924
|
-
let x = 0,
|
|
1925
|
-
const
|
|
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 =
|
|
1969
|
+
const O = R();
|
|
1930
1970
|
return O.length > 0 && (l.value = O), O;
|
|
1931
|
-
}, f = (C) => n.getTypingUsers(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((
|
|
1947
|
-
},
|
|
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
|
-
},
|
|
1950
|
-
|
|
1951
|
-
},
|
|
1952
|
-
const C =
|
|
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
|
-
|
|
1956
|
-
|
|
1957
|
-
},
|
|
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:
|
|
2002
|
+
onTypingStart: $,
|
|
1963
2003
|
onTypingStop: z
|
|
1964
|
-
}), o.value = !0, l.value = C,
|
|
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 (
|
|
2011
|
+
if (B(), !(!o.value || !C))
|
|
1972
2012
|
try {
|
|
1973
|
-
y && (y(), y = null), bi(C), F(),
|
|
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
|
|
1979
|
-
if (C.user_id ===
|
|
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((
|
|
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 ===
|
|
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
|
|
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
|
|
2009
|
-
L.set(
|
|
2010
|
-
for (const
|
|
2011
|
-
L.set(
|
|
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
|
-
}),
|
|
2014
|
-
const C =
|
|
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
|
|
2028
|
-
return
|
|
2029
|
-
}),
|
|
2030
|
-
o.value ||
|
|
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
|
|
2073
|
+
const ee = it((C) => {
|
|
2034
2074
|
if (C === "connected") {
|
|
2035
|
-
o.value ||
|
|
2075
|
+
o.value || P();
|
|
2036
2076
|
return;
|
|
2037
2077
|
}
|
|
2038
2078
|
if (C === "disconnected" || C === "error") {
|
|
2039
|
-
|
|
2079
|
+
B(), y && (y(), y = null);
|
|
2040
2080
|
const O = S();
|
|
2041
|
-
O &&
|
|
2081
|
+
O && v(O), o.value = !1, l.value = null, F();
|
|
2042
2082
|
}
|
|
2043
2083
|
});
|
|
2044
2084
|
return d !== null && qe(() => {
|
|
2045
|
-
|
|
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:
|
|
2050
|
-
formatTypingIndicator:
|
|
2051
|
-
hasTypingUsers:
|
|
2052
|
-
subscribe:
|
|
2089
|
+
typingUsers: K,
|
|
2090
|
+
formatTypingIndicator: se,
|
|
2091
|
+
hasTypingUsers: w,
|
|
2092
|
+
subscribe: P,
|
|
2053
2093
|
unsubscribe: U
|
|
2054
2094
|
};
|
|
2055
2095
|
}
|
|
2056
|
-
function
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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" &&
|
|
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
|
|
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
|
|
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(
|
|
3040
|
-
return l[
|
|
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,
|
|
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,
|
|
3109
|
+
}, S(f, v);
|
|
3070
3110
|
};
|
|
3071
|
-
return function(f,
|
|
3072
|
-
S(f,
|
|
3111
|
+
return function(f, v) {
|
|
3112
|
+
S(f, v);
|
|
3073
3113
|
function b() {
|
|
3074
3114
|
this.constructor = f;
|
|
3075
3115
|
}
|
|
3076
|
-
f.prototype =
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
3107
|
-
U = this._decodeChar(f.charCodeAt(
|
|
3108
|
-
if (
|
|
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
|
|
3113
|
-
return
|
|
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
|
|
3116
|
-
return
|
|
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
|
|
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
|
-
|
|
3122
|
-
if (f.length < 4 ||
|
|
3161
|
+
v++;
|
|
3162
|
+
if (f.length < 4 || v > 2)
|
|
3123
3163
|
throw new Error("Base64Coder: incorrect padding");
|
|
3124
3164
|
}
|
|
3125
|
-
return
|
|
3165
|
+
return v;
|
|
3126
3166
|
}, S;
|
|
3127
3167
|
})()
|
|
3128
3168
|
);
|
|
3129
3169
|
o.Coder = g;
|
|
3130
3170
|
var d = new g();
|
|
3131
|
-
function
|
|
3171
|
+
function A(S) {
|
|
3132
3172
|
return d.encode(S);
|
|
3133
3173
|
}
|
|
3134
|
-
o.encode =
|
|
3174
|
+
o.encode = A;
|
|
3135
3175
|
function x(S) {
|
|
3136
3176
|
return d.decode(S);
|
|
3137
3177
|
}
|
|
3138
3178
|
o.decode = x;
|
|
3139
|
-
var
|
|
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(
|
|
3147
|
-
var b =
|
|
3148
|
-
return b += 65, b += 25 -
|
|
3149
|
-
}, f.prototype._decodeChar = function(
|
|
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 -
|
|
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 =
|
|
3156
|
-
var y = new
|
|
3157
|
-
function
|
|
3195
|
+
o.URLSafeCoder = m;
|
|
3196
|
+
var y = new m();
|
|
3197
|
+
function E(S) {
|
|
3158
3198
|
return y.encode(S);
|
|
3159
3199
|
}
|
|
3160
|
-
o.encodeURLSafe =
|
|
3161
|
-
function
|
|
3200
|
+
o.encodeURLSafe = E;
|
|
3201
|
+
function R(S) {
|
|
3162
3202
|
return y.decode(S);
|
|
3163
3203
|
}
|
|
3164
|
-
o.decodeURLSafe =
|
|
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
|
|
3179
|
-
var
|
|
3180
|
-
|
|
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
|
|
3222
|
+
return m;
|
|
3183
3223
|
}
|
|
3184
3224
|
o.encode = g;
|
|
3185
3225
|
function d(x) {
|
|
3186
|
-
for (var
|
|
3187
|
-
var
|
|
3188
|
-
if (
|
|
3189
|
-
|
|
3190
|
-
else if (
|
|
3191
|
-
|
|
3192
|
-
else if (
|
|
3193
|
-
|
|
3194
|
-
else if (
|
|
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++,
|
|
3237
|
+
y++, m += 4;
|
|
3198
3238
|
} else
|
|
3199
3239
|
throw new Error(l);
|
|
3200
3240
|
}
|
|
3201
|
-
return
|
|
3241
|
+
return m;
|
|
3202
3242
|
}
|
|
3203
3243
|
o.encodedLength = d;
|
|
3204
|
-
function
|
|
3205
|
-
for (var
|
|
3206
|
-
var
|
|
3207
|
-
if (
|
|
3208
|
-
var
|
|
3209
|
-
if (
|
|
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
|
-
|
|
3216
|
-
} else if (
|
|
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
|
-
|
|
3223
|
-
} else if (
|
|
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],
|
|
3227
|
-
if ((S & 192) !== 128 || (f & 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
|
-
|
|
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 (
|
|
3272
|
+
if (E < R || E >= 55296 && E <= 57343)
|
|
3233
3273
|
throw new Error(h);
|
|
3234
|
-
if (
|
|
3235
|
-
if (
|
|
3274
|
+
if (E >= 65536) {
|
|
3275
|
+
if (E > 1114111)
|
|
3236
3276
|
throw new Error(h);
|
|
3237
|
-
|
|
3277
|
+
E -= 65536, m.push(String.fromCharCode(55296 | E >> 10)), E = 56320 | E & 1023;
|
|
3238
3278
|
}
|
|
3239
3279
|
}
|
|
3240
|
-
|
|
3280
|
+
m.push(String.fromCharCode(E));
|
|
3241
3281
|
}
|
|
3242
|
-
return
|
|
3282
|
+
return m.join("");
|
|
3243
3283
|
}
|
|
3244
|
-
o.decode =
|
|
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
|
|
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
|
|
3352
|
+
for (var J = function(oe) {
|
|
3313
3353
|
oe || p.cleanup();
|
|
3314
|
-
},
|
|
3315
|
-
D[
|
|
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"),
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
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. ${
|
|
3478
|
+
I = `Clients must be authorized to join private or presence channels. ${R.buildLogSuffix("authorizationEndpoint")}`;
|
|
3439
3479
|
break;
|
|
3440
3480
|
}
|
|
3441
|
-
c(new
|
|
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
|
|
3485
|
+
function se(r) {
|
|
3446
3486
|
return L(C(r));
|
|
3447
3487
|
}
|
|
3448
|
-
var
|
|
3488
|
+
var w = String.fromCharCode, M = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", ee = function(r) {
|
|
3449
3489
|
var t = r.charCodeAt(0);
|
|
3450
|
-
return t < 128 ? r : t < 2048 ?
|
|
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,
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
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
|
|
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
|
|
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
|
|
3601
|
-
return typeof t == "object" && (t = He(t)), encodeURIComponent(
|
|
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
|
|
3671
|
-
(s.headers !== void 0 || s.headersProvider != null) &&
|
|
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(
|
|
3676
|
-
c(null,
|
|
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
|
|
3681
|
-
|
|
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,
|
|
3720
|
-
h.remove(I), _.cleanup(),
|
|
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
|
-
},
|
|
3764
|
+
}, ws = {
|
|
3725
3765
|
name: "jsonp",
|
|
3726
3766
|
getAgent: Ss
|
|
3727
|
-
},
|
|
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] =
|
|
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 =
|
|
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(),
|
|
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:
|
|
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 = (
|
|
4006
|
-
if (p.unbind("closed", D),
|
|
4045
|
+
}, D = (J) => {
|
|
4046
|
+
if (p.unbind("closed", D), J.code === 1002 || J.code === 1003)
|
|
4007
4047
|
this.manager.reportDeath();
|
|
4008
|
-
else if (!
|
|
4009
|
-
var
|
|
4010
|
-
|
|
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
|
|
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),
|
|
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 =
|
|
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 (
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
4204
|
-
|
|
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,
|
|
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
|
|
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(
|
|
4339
|
+
function I(Z) {
|
|
4300
4340
|
try {
|
|
4301
|
-
|
|
4341
|
+
J(a.next(Z));
|
|
4302
4342
|
} catch (oe) {
|
|
4303
4343
|
_(oe);
|
|
4304
4344
|
}
|
|
4305
4345
|
}
|
|
4306
|
-
function D(
|
|
4346
|
+
function D(Z) {
|
|
4307
4347
|
try {
|
|
4308
|
-
|
|
4348
|
+
J(a.throw(Z));
|
|
4309
4349
|
} catch (oe) {
|
|
4310
4350
|
_(oe);
|
|
4311
4351
|
}
|
|
4312
4352
|
}
|
|
4313
|
-
function
|
|
4314
|
-
|
|
4353
|
+
function J(Z) {
|
|
4354
|
+
Z.done ? p(Z.value) : c(Z.value).then(I, D);
|
|
4315
4355
|
}
|
|
4316
|
-
|
|
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 _ =
|
|
4333
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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),
|
|
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 =
|
|
4633
|
-
throw new
|
|
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
|
|
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,
|
|
4699
|
-
|
|
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
|
|
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(),
|
|
4791
|
-
oe ? (Zt(a), _.length > 0 ? (D = N.now(),
|
|
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
|
-
|
|
4835
|
+
J.abort();
|
|
4796
4836
|
},
|
|
4797
|
-
forceMinPriority: function(
|
|
4798
|
-
t =
|
|
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
|
|
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
|
-
},
|
|
4952
|
+
}, J = new Qt({
|
|
4913
4953
|
minPingDelay: 1e4,
|
|
4914
4954
|
maxPingDelay: r.activityTimeout
|
|
4915
|
-
}),
|
|
4955
|
+
}), Z = new Qt({
|
|
4916
4956
|
lives: 2,
|
|
4917
4957
|
minPingDelay: 1e4,
|
|
4918
4958
|
maxPingDelay: r.activityTimeout
|
|
4919
|
-
}), oe = c("ws", "ws", 3, p,
|
|
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"),
|
|
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
|
-
},
|
|
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 =
|
|
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(
|
|
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:
|
|
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() :
|
|
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:
|
|
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,
|
|
5374
|
+
a = !0, Z(), s(null, oe);
|
|
5335
5375
|
});
|
|
5336
5376
|
}, D = function(oe) {
|
|
5337
|
-
|
|
5338
|
-
},
|
|
5339
|
-
|
|
5377
|
+
Z(), s(oe);
|
|
5378
|
+
}, J = function() {
|
|
5379
|
+
Z();
|
|
5340
5380
|
var oe;
|
|
5341
5381
|
oe = He(c), s(new j(oe));
|
|
5342
|
-
},
|
|
5343
|
-
c.unbind("initialized", _), c.unbind("open", I), c.unbind("error", D), c.unbind("closed",
|
|
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",
|
|
5385
|
+
return c.bind("initialized", _), c.bind("open", I), c.bind("error", D), c.bind("closed", J), c.initialize(), {
|
|
5346
5386
|
abort: () => {
|
|
5347
|
-
a || (
|
|
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
|
|
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 &&
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
5707
|
-
const
|
|
5708
|
-
function
|
|
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
|
|
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
|
|
5780
|
+
function oa(e) {
|
|
5741
5781
|
return e.toLowerCase() === "http" ? "http" : "https";
|
|
5742
5782
|
}
|
|
5743
|
-
function
|
|
5783
|
+
function aa(e) {
|
|
5744
5784
|
if (e !== null)
|
|
5745
5785
|
return e.startsWith("/") ? e : `/${e}`;
|
|
5746
5786
|
}
|
|
5747
|
-
function
|
|
5748
|
-
if (!
|
|
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 (!
|
|
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 (!
|
|
5794
|
+
if (!ne(o) || !ne(u))
|
|
5755
5795
|
throw new Error("Invalid messenger bootstrap payload: missing user or reverb data");
|
|
5756
|
-
const l =
|
|
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:
|
|
5779
|
-
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
|
|
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 =
|
|
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
|
|
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
|
|
5815
|
-
if (!
|
|
5854
|
+
function ha(e, n) {
|
|
5855
|
+
if (!ne(e))
|
|
5816
5856
|
return null;
|
|
5817
|
-
const i = _e(e, "user_id", "userId"), o =
|
|
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
|
|
5831
|
-
if (!
|
|
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 =
|
|
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
|
|
5852
|
-
if (!
|
|
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 =
|
|
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
|
|
5871
|
-
if (!
|
|
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
|
|
5922
|
+
return ne(e) && ae(e, "id") && ae(e, "name");
|
|
5889
5923
|
}
|
|
5890
5924
|
function ma(e) {
|
|
5891
|
-
return
|
|
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
|
|
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
|
|
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
|
|
5934
|
+
return ne(e) && ae(e, "conversation_id") && ne(e.message) && ae(e.message, "id");
|
|
5901
5935
|
}
|
|
5902
5936
|
function _a(e) {
|
|
5903
|
-
return
|
|
5937
|
+
return ne(e) && ae(e, "conversation_id") && ae(e, "message_id");
|
|
5904
5938
|
}
|
|
5905
5939
|
function Sa(e) {
|
|
5906
|
-
return
|
|
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
|
|
5915
|
-
const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ??
|
|
5916
|
-
typeof window < "u" && (window.Pusher =
|
|
5917
|
-
let h = null, g = null, d = null,
|
|
5918
|
-
const
|
|
5919
|
-
x =
|
|
5920
|
-
for (const k of
|
|
5921
|
-
k(
|
|
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
|
-
},
|
|
5925
|
-
d !== null && (d.disconnect(), d = null),
|
|
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,
|
|
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
|
|
5932
|
-
return
|
|
5933
|
-
}, j = (
|
|
5934
|
-
if (
|
|
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 (
|
|
5937
|
-
return
|
|
5938
|
-
const k = Date.parse(
|
|
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
|
-
},
|
|
5941
|
-
if (f(),
|
|
5980
|
+
}, B = (T) => {
|
|
5981
|
+
if (f(), T.auth.expiresAt === null)
|
|
5942
5982
|
return;
|
|
5943
|
-
const k = Date.parse(
|
|
5983
|
+
const k = Date.parse(T.auth.expiresAt);
|
|
5944
5984
|
if (Number.isNaN(k))
|
|
5945
5985
|
return;
|
|
5946
|
-
const
|
|
5986
|
+
const Y = Math.max(0, k - Date.now() - o);
|
|
5947
5987
|
y = setTimeout(() => {
|
|
5948
5988
|
U();
|
|
5949
|
-
},
|
|
5950
|
-
},
|
|
5951
|
-
const
|
|
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
|
-
|
|
5954
|
-
), N =
|
|
5955
|
-
return h = 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
|
|
5999
|
+
const T = d !== null;
|
|
5960
6000
|
try {
|
|
5961
|
-
if (await
|
|
6001
|
+
if (await P(!0), !T)
|
|
5962
6002
|
return;
|
|
5963
|
-
|
|
6003
|
+
v(!1), await z(!0);
|
|
5964
6004
|
} catch (k) {
|
|
5965
6005
|
l.warn("Failed to refresh messenger bootstrap", k);
|
|
5966
6006
|
}
|
|
5967
|
-
},
|
|
5968
|
-
const k =
|
|
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 (
|
|
5985
|
-
const
|
|
5986
|
-
if (
|
|
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 &&
|
|
5989
|
-
const N =
|
|
6028
|
+
d !== null && v(!1);
|
|
6029
|
+
const N = Y.service.reverb.scheme === "https", V = {
|
|
5990
6030
|
broadcaster: "reverb",
|
|
5991
|
-
key:
|
|
5992
|
-
wsHost:
|
|
5993
|
-
wsPort:
|
|
5994
|
-
wssPort:
|
|
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:
|
|
6039
|
+
authEndpoint: Y.service.broadcastingAuthUrl,
|
|
6000
6040
|
auth: {
|
|
6001
6041
|
headers: {
|
|
6002
|
-
Authorization: `Bearer ${
|
|
6042
|
+
Authorization: `Bearer ${Y.auth.token}`,
|
|
6003
6043
|
Accept: "application/json"
|
|
6004
6044
|
}
|
|
6005
6045
|
}
|
|
6006
6046
|
};
|
|
6007
|
-
return
|
|
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
|
-
|
|
6010
|
-
}), await
|
|
6011
|
-
timeout: e.requestTimeoutMs ??
|
|
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
|
-
|
|
6019
|
-
const k = await
|
|
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
|
|
6023
|
-
}),
|
|
6024
|
-
(
|
|
6025
|
-
async (
|
|
6026
|
-
const k =
|
|
6027
|
-
if (
|
|
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
|
|
6030
|
-
if (
|
|
6031
|
-
return k.baseURL =
|
|
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(
|
|
6073
|
+
return Promise.reject(T);
|
|
6034
6074
|
}
|
|
6035
6075
|
);
|
|
6036
|
-
const
|
|
6037
|
-
l.warn("Failed to initialize messenger echo",
|
|
6038
|
-
}), d),
|
|
6039
|
-
|
|
6040
|
-
}), M = () => h?.auth.tenantId ?? "global",
|
|
6041
|
-
const k = Pt(
|
|
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
|
|
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
|
-
|
|
6088
|
+
R.set(Y, {
|
|
6049
6089
|
timestampMs: k,
|
|
6050
6090
|
seenAt: V
|
|
6051
6091
|
});
|
|
6052
|
-
for (const [me, ve] of
|
|
6053
|
-
V - ve.seenAt > u &&
|
|
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:
|
|
6097
|
+
apiClient: K,
|
|
6058
6098
|
initializedEvent: n,
|
|
6059
|
-
getEcho:
|
|
6099
|
+
getEcho: se,
|
|
6060
6100
|
getConnectionStatus: () => x,
|
|
6061
|
-
onConnectionStatusChange:
|
|
6101
|
+
onConnectionStatusChange: w,
|
|
6062
6102
|
reconnect: async () => {
|
|
6063
|
-
|
|
6103
|
+
v(), await z(!0);
|
|
6064
6104
|
},
|
|
6065
|
-
subscribeToPresenceStatus: (
|
|
6066
|
-
const k =
|
|
6105
|
+
subscribeToPresenceStatus: (T) => {
|
|
6106
|
+
const k = se();
|
|
6067
6107
|
if (!k || typeof k.join != "function")
|
|
6068
6108
|
return;
|
|
6069
|
-
const
|
|
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
|
-
|
|
6081
|
-
const ve =
|
|
6082
|
-
!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: (
|
|
6089
|
-
const
|
|
6090
|
-
if (!
|
|
6128
|
+
subscribeToConversation: (T, k) => {
|
|
6129
|
+
const Y = se();
|
|
6130
|
+
if (!Y)
|
|
6091
6131
|
return () => {
|
|
6092
6132
|
};
|
|
6093
|
-
const N =
|
|
6133
|
+
const N = Y.private(`conversation.${T}`), V = [];
|
|
6094
6134
|
return k.onMessageSent && V.push({
|
|
6095
6135
|
event: ".ConversationMessageSent",
|
|
6096
|
-
handler: Re(N, ".ConversationMessageSent",
|
|
6136
|
+
handler: Re(N, ".ConversationMessageSent", va, k.onMessageSent)
|
|
6097
6137
|
}), k.onMessageRead && V.push({
|
|
6098
6138
|
event: ".ConversationMessageRead",
|
|
6099
|
-
handler: Re(N, ".ConversationMessageRead",
|
|
6139
|
+
handler: Re(N, ".ConversationMessageRead", ba, k.onMessageRead)
|
|
6100
6140
|
}), k.onMessageEdited && V.push({
|
|
6101
6141
|
event: ".ConversationMessageEdited",
|
|
6102
|
-
handler: Re(N, ".ConversationMessageEdited",
|
|
6142
|
+
handler: Re(N, ".ConversationMessageEdited", ya, k.onMessageEdited)
|
|
6103
6143
|
}), k.onMessageDeleted && V.push({
|
|
6104
6144
|
event: ".ConversationMessageDeleted",
|
|
6105
|
-
handler: Re(N, ".ConversationMessageDeleted",
|
|
6145
|
+
handler: Re(N, ".ConversationMessageDeleted", _a, k.onMessageDeleted)
|
|
6106
6146
|
}), k.onReactionToggled && V.push({
|
|
6107
6147
|
event: ".MessageReactionToggled",
|
|
6108
|
-
handler: Re(N, ".MessageReactionToggled",
|
|
6148
|
+
handler: Re(N, ".MessageReactionToggled", Sa, k.onReactionToggled)
|
|
6109
6149
|
}), k.onRequestAccepted && V.push({
|
|
6110
6150
|
event: ".ConversationRequestAccepted",
|
|
6111
|
-
handler: Re(N, ".ConversationRequestAccepted",
|
|
6151
|
+
handler: Re(N, ".ConversationRequestAccepted", wa, k.onRequestAccepted)
|
|
6112
6152
|
}), k.onParticipantRemoved && V.push({
|
|
6113
6153
|
event: ".ConversationParticipantRemoved",
|
|
6114
|
-
handler: Re(N, ".ConversationParticipantRemoved",
|
|
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: (
|
|
6122
|
-
d?.leave(`conversation.${
|
|
6161
|
+
unsubscribeFromConversation: (T) => {
|
|
6162
|
+
d?.leave(`conversation.${T}`);
|
|
6123
6163
|
},
|
|
6124
|
-
subscribeToTyping: (
|
|
6125
|
-
const
|
|
6126
|
-
if (!
|
|
6164
|
+
subscribeToTyping: (T, k) => {
|
|
6165
|
+
const Y = se();
|
|
6166
|
+
if (!Y)
|
|
6127
6167
|
return () => {
|
|
6128
6168
|
};
|
|
6129
|
-
const N =
|
|
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 = (
|
|
6141
|
-
const
|
|
6142
|
-
if (
|
|
6143
|
-
if ($e.has(
|
|
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:
|
|
6146
|
-
user:
|
|
6147
|
-
id:
|
|
6185
|
+
user_id: W.user_id,
|
|
6186
|
+
user: W.user ?? {
|
|
6187
|
+
id: W.user_id,
|
|
6148
6188
|
name: ""
|
|
6149
6189
|
},
|
|
6150
|
-
conversation_id:
|
|
6151
|
-
started_at:
|
|
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(
|
|
6156
|
-
user_id:
|
|
6157
|
-
conversation_id:
|
|
6158
|
-
stopped_at:
|
|
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 = (
|
|
6166
|
-
const
|
|
6167
|
-
if (!
|
|
6205
|
+
const pe = (we) => {
|
|
6206
|
+
const W = fa(we);
|
|
6207
|
+
if (!W)
|
|
6168
6208
|
return;
|
|
6169
6209
|
const xe = {
|
|
6170
|
-
user_id:
|
|
6210
|
+
user_id: W.user_id,
|
|
6171
6211
|
user: {
|
|
6172
|
-
id:
|
|
6173
|
-
name:
|
|
6174
|
-
...
|
|
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:
|
|
6177
|
-
started_at:
|
|
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 = (
|
|
6185
|
-
const
|
|
6186
|
-
if (!
|
|
6224
|
+
const pe = (we) => {
|
|
6225
|
+
const W = pa(we);
|
|
6226
|
+
if (!W)
|
|
6187
6227
|
return;
|
|
6188
6228
|
const xe = {
|
|
6189
|
-
user_id:
|
|
6190
|
-
conversation_id:
|
|
6191
|
-
stopped_at:
|
|
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: (
|
|
6204
|
-
d?.leave(`typing-conversation.${
|
|
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
|
-
|
|
6212
|
-
|
|
6251
|
+
Da as configureMessengerClient,
|
|
6252
|
+
za as createMessengerEcho,
|
|
6213
6253
|
X as getApi,
|
|
6214
6254
|
Pe as getAuthStore,
|
|
6215
|
-
|
|
6255
|
+
Ma as getConnectionStatus,
|
|
6216
6256
|
Ae as getEcho,
|
|
6217
6257
|
Hn as getEchoConnectionStatus,
|
|
6218
6258
|
De as getEchoInitializedEvent,
|
|
6219
|
-
|
|
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
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6306
|
+
Ua as useConnectionStatus,
|
|
6307
|
+
La as useConversationChannel,
|
|
6308
|
+
Oa as useGlobalMessaging,
|
|
6269
6309
|
Nt as useMessagingStore,
|
|
6270
|
-
|
|
6271
|
-
|
|
6310
|
+
Na as usePresence,
|
|
6311
|
+
Fa as useTypingChannel
|
|
6272
6312
|
};
|