@codingfactory/messenger-client 0.2.19 → 0.2.20
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 +142 -141
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref as ve, getCurrentInstance as zt, computed as ie, watch as
|
|
1
|
+
import { ref as ve, getCurrentInstance as zt, computed as ie, watch as Ut, onUnmounted as De, toValue as Xn, onMounted as jt } from "vue";
|
|
2
2
|
import { defineStore as Si, storeToRefs as Ci } from "pinia";
|
|
3
3
|
import $t, { isAxiosError as wi, AxiosHeaders as wn } from "axios";
|
|
4
4
|
import { isAxiosError as uc } from "axios";
|
|
@@ -35,13 +35,13 @@ const Wn = () => () => {
|
|
|
35
35
|
function Ii(e) {
|
|
36
36
|
e.initializedEvent && ($.ECHO_INITIALIZED_EVENT = e.initializedEvent), e.getEcho && ($.getEcho = e.getEcho), e.waitForEcho && ($.waitForEcho = e.waitForEcho), e.getConnectionStatus && ($.getConnectionStatus = e.getConnectionStatus), e.getAccessState && ($.getAccessState = e.getAccessState), e.onConnectionStatusChange && ($.onConnectionStatusChange = e.onConnectionStatusChange), e.onAccessStateChange && ($.onAccessStateChange = e.onAccessStateChange), e.reconnect && ($.reconnect = e.reconnect), e.subscribeToPresenceStatus && ($.subscribeToPresenceStatus = e.subscribeToPresenceStatus), e.unsubscribeFromPresenceStatus && ($.unsubscribeFromPresenceStatus = e.unsubscribeFromPresenceStatus), e.subscribeToConversation && ($.subscribeToConversation = e.subscribeToConversation), e.unsubscribeFromConversation && ($.unsubscribeFromConversation = e.unsubscribeFromConversation), e.subscribeToTyping && ($.subscribeToTyping = e.subscribeToTyping), e.unsubscribeFromTyping && ($.unsubscribeFromTyping = e.unsubscribeFromTyping);
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function Oi() {
|
|
39
39
|
$.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", $.getEcho = () => null, $.waitForEcho = ns, $.getConnectionStatus = () => "disconnected", $.getAccessState = () => "available", $.onConnectionStatusChange = Wn, $.onAccessStateChange = Gn, $.reconnect = Jn, $.subscribeToPresenceStatus = Kn, $.unsubscribeFromPresenceStatus = Qn, $.subscribeToConversation = es, $.unsubscribeFromConversation = Yn, $.subscribeToTyping = ts, $.unsubscribeFromTyping = Zn;
|
|
40
40
|
}
|
|
41
41
|
function xe(e) {
|
|
42
42
|
return typeof e == "object" && e !== null;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function Ui(e) {
|
|
45
45
|
return xe(e) && typeof e.conversation_id == "string" && xe(e.message) && typeof e.message.id == "string" && typeof e.message.conversation_id == "string" && typeof e.message.author_id == "string";
|
|
46
46
|
}
|
|
47
47
|
function Fi(e) {
|
|
@@ -439,7 +439,7 @@ function he(e) {
|
|
|
439
439
|
function po(e) {
|
|
440
440
|
return he(e) ? (he(e.response) ? e.response : null)?.status === 401 : !1;
|
|
441
441
|
}
|
|
442
|
-
function
|
|
442
|
+
function On(e) {
|
|
443
443
|
if (!Array.isArray(e))
|
|
444
444
|
return [];
|
|
445
445
|
const n = [];
|
|
@@ -473,7 +473,7 @@ function rt(e, n) {
|
|
|
473
473
|
nextCursor: go(i, o)
|
|
474
474
|
};
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function Un(e) {
|
|
477
477
|
return he(e) && typeof e.id == "string" && e.id.length > 0;
|
|
478
478
|
}
|
|
479
479
|
function Fn(e) {
|
|
@@ -812,8 +812,8 @@ const Gt = Si("messaging", {
|
|
|
812
812
|
};
|
|
813
813
|
if (i && i.length > 0) {
|
|
814
814
|
const k = await Promise.all(
|
|
815
|
-
i.map(async (
|
|
816
|
-
const H = await Vi().uploadImage(
|
|
815
|
+
i.map(async (U) => {
|
|
816
|
+
const H = await Vi().uploadImage(U);
|
|
817
817
|
return {
|
|
818
818
|
media_id: H.id,
|
|
819
819
|
mime: H.mime_type,
|
|
@@ -835,8 +835,8 @@ const Gt = Si("messaging", {
|
|
|
835
835
|
const q = m.id;
|
|
836
836
|
let G = 0;
|
|
837
837
|
for (let k = v.length - 1; k >= 0; k--) {
|
|
838
|
-
const
|
|
839
|
-
|
|
838
|
+
const U = v[k];
|
|
839
|
+
U && U.id === q && (G++, G > 1 && v.splice(k, 1));
|
|
840
840
|
}
|
|
841
841
|
return this.updateConversationLastMessage(e, m), m;
|
|
842
842
|
} catch (b) {
|
|
@@ -1003,7 +1003,7 @@ const Gt = Si("messaging", {
|
|
|
1003
1003
|
};
|
|
1004
1004
|
n && (i.message = n);
|
|
1005
1005
|
const o = await W().post("/v1/messaging/conversations/dm", i), c = o.data.data || o.data;
|
|
1006
|
-
if (!
|
|
1006
|
+
if (!Un(c))
|
|
1007
1007
|
throw new Error("Invalid conversation payload from DM create endpoint.");
|
|
1008
1008
|
const l = Fn(c) ? He(c) : await this.fetchConversation(c.id);
|
|
1009
1009
|
return l.is_request === !0 ? (this.requests = it(this.requests, l), this.conversations = this.conversations.filter((d) => d.id !== l.id), l) : (this.conversations = it(this.conversations, l), this.requests = this.requests.filter((d) => d.id !== l.id), l);
|
|
@@ -1017,7 +1017,7 @@ const Gt = Si("messaging", {
|
|
|
1017
1017
|
title: e,
|
|
1018
1018
|
participant_ids: n
|
|
1019
1019
|
}), o = i.data.data || i.data;
|
|
1020
|
-
if (!
|
|
1020
|
+
if (!Un(o))
|
|
1021
1021
|
throw new Error("Invalid conversation payload from group create endpoint.");
|
|
1022
1022
|
const c = Fn(o) ? o : await this.fetchConversation(o.id);
|
|
1023
1023
|
return this.conversations = it(this.conversations, c), c;
|
|
@@ -1131,12 +1131,12 @@ const Gt = Si("messaging", {
|
|
|
1131
1131
|
throw y;
|
|
1132
1132
|
g = await W().post(o, c);
|
|
1133
1133
|
}
|
|
1134
|
-
const h = he(g.data) && "data" in g.data ? g.data.data : g.data, x =
|
|
1134
|
+
const h = he(g.data) && "data" in g.data ? g.data.data : g.data, x = On(
|
|
1135
1135
|
he(h) ? h.reactions : void 0
|
|
1136
1136
|
);
|
|
1137
1137
|
(x.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, x);
|
|
1138
1138
|
try {
|
|
1139
|
-
const y = await W().get(o), C = he(y.data) && "data" in y.data ? y.data.data : y.data, b =
|
|
1139
|
+
const y = await W().get(o), C = he(y.data) && "data" in y.data ? y.data.data : y.data, b = On(
|
|
1140
1140
|
he(C) ? C.reactions : void 0
|
|
1141
1141
|
);
|
|
1142
1142
|
this.updateMessageReactions(e, n, b);
|
|
@@ -1158,7 +1158,8 @@ const Gt = Si("messaging", {
|
|
|
1158
1158
|
}
|
|
1159
1159
|
},
|
|
1160
1160
|
addTypingUser(e, n) {
|
|
1161
|
-
|
|
1161
|
+
const i = this.typingUsers[e] ?? [];
|
|
1162
|
+
i.find((c) => c.id === n.id) || (this.typingUsers[e] = [...i, n]);
|
|
1162
1163
|
},
|
|
1163
1164
|
removeTypingUser(e, n) {
|
|
1164
1165
|
this.typingUsers[e] && (this.typingUsers[e] = this.typingUsers[e].filter((i) => i.id !== n));
|
|
@@ -1312,7 +1313,7 @@ function Ya(e) {
|
|
|
1312
1313
|
(ae) => ae.id !== _.conversation_id
|
|
1313
1314
|
);
|
|
1314
1315
|
}
|
|
1315
|
-
function
|
|
1316
|
+
function U(_) {
|
|
1316
1317
|
_.removed_user_id === b.value && (te(), n.deleteConversation(_.conversation_id).catch(() => {
|
|
1317
1318
|
}));
|
|
1318
1319
|
}
|
|
@@ -1336,7 +1337,7 @@ function Ya(e) {
|
|
|
1336
1337
|
onMessageDeleted: q,
|
|
1337
1338
|
onReactionToggled: G,
|
|
1338
1339
|
onRequestAccepted: k,
|
|
1339
|
-
onParticipantRemoved:
|
|
1340
|
+
onParticipantRemoved: U
|
|
1340
1341
|
}), o.value = !0, l.value = _, n.registerDetailSubscription(_), w();
|
|
1341
1342
|
} catch (I) {
|
|
1342
1343
|
c.value = I instanceof Error ? I.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", I);
|
|
@@ -1362,7 +1363,7 @@ function Ya(e) {
|
|
|
1362
1363
|
c.value = _ instanceof Error ? _.message : "Failed to unsubscribe from conversation", console.error("ConversationChannel: Unsubscribe error", _);
|
|
1363
1364
|
}
|
|
1364
1365
|
}
|
|
1365
|
-
return
|
|
1366
|
+
return Ut(
|
|
1366
1367
|
() => T(),
|
|
1367
1368
|
(_, I) => {
|
|
1368
1369
|
if (_ !== I) {
|
|
@@ -1466,7 +1467,7 @@ function Za(e = {}) {
|
|
|
1466
1467
|
...e.icons
|
|
1467
1468
|
}, l = ve(o.getConnectionStatus()), d = ve(null), g = ve(0), h = ve(!1), x = ve(!1), M = ve(!1), y = ve(!1);
|
|
1468
1469
|
let C = null, b = null, T = null, w = null, f = null, m = null, v = null;
|
|
1469
|
-
const N = ie(() => l.value === "connected"), q = ie(() => l.value === "connecting"), G = ie(() => l.value === "disconnected"), k = ie(() => l.value === "error"),
|
|
1470
|
+
const N = ie(() => l.value === "connected"), q = ie(() => l.value === "connecting"), G = ie(() => l.value === "disconnected"), k = ie(() => l.value === "error"), U = ie(() => G.value || k.value), H = ie(() => {
|
|
1470
1471
|
switch (l.value) {
|
|
1471
1472
|
case "connecting":
|
|
1472
1473
|
return g.value > 0 ? "Reconnecting..." : "Connecting...";
|
|
@@ -1614,7 +1615,7 @@ function Za(e = {}) {
|
|
|
1614
1615
|
isConnecting: q,
|
|
1615
1616
|
isDisconnected: G,
|
|
1616
1617
|
isError: k,
|
|
1617
|
-
hasConnectionIssues:
|
|
1618
|
+
hasConnectionIssues: U,
|
|
1618
1619
|
statusMessage: H,
|
|
1619
1620
|
statusColor: F,
|
|
1620
1621
|
statusIcon: J,
|
|
@@ -1640,7 +1641,7 @@ const Lo = 6e4;
|
|
|
1640
1641
|
function Io(e) {
|
|
1641
1642
|
return e === "online" || e === "idle" || e === "dnd" || e === "offline";
|
|
1642
1643
|
}
|
|
1643
|
-
function
|
|
1644
|
+
function Oo(e) {
|
|
1644
1645
|
if (typeof e != "string")
|
|
1645
1646
|
return null;
|
|
1646
1647
|
const n = e.trim().toLowerCase();
|
|
@@ -1659,7 +1660,7 @@ function qt(e) {
|
|
|
1659
1660
|
const i = n.includes("T") ? n : n.replace(" ", "T"), o = /(?:Z|[+-]\d{2}:\d{2})$/i.test(i) ? i : `${i}Z`, c = new Date(o);
|
|
1660
1661
|
return Number.isNaN(c.getTime()) ? null : c;
|
|
1661
1662
|
}
|
|
1662
|
-
function
|
|
1663
|
+
function Uo(e, n, i = {}) {
|
|
1663
1664
|
if (e === null)
|
|
1664
1665
|
return null;
|
|
1665
1666
|
if (e === "offline")
|
|
@@ -1671,9 +1672,9 @@ function Oo(e, n, i = {}) {
|
|
|
1671
1672
|
return c - o.getTime() > l ? "offline" : e;
|
|
1672
1673
|
}
|
|
1673
1674
|
function $n(e, n = {}) {
|
|
1674
|
-
const i = ms(e?.last_seen_at), o =
|
|
1675
|
+
const i = ms(e?.last_seen_at), o = Oo(e?.status);
|
|
1675
1676
|
return {
|
|
1676
|
-
status:
|
|
1677
|
+
status: Uo(o, i, n),
|
|
1677
1678
|
lastSeenAt: i
|
|
1678
1679
|
};
|
|
1679
1680
|
}
|
|
@@ -1694,11 +1695,11 @@ function ec() {
|
|
|
1694
1695
|
const e = Gt(), n = Fe()(), i = Fo(), o = gs(), c = Ti(), l = zt(), { conversations: d } = Ci(e), g = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map();
|
|
1695
1696
|
let x = !1;
|
|
1696
1697
|
function M(k) {
|
|
1697
|
-
const
|
|
1698
|
-
if (
|
|
1699
|
-
for (const H of
|
|
1698
|
+
const U = h.get(k);
|
|
1699
|
+
if (U && (h.delete(k), typeof U.channel.stopListening == "function"))
|
|
1700
|
+
for (const H of U.bindings)
|
|
1700
1701
|
try {
|
|
1701
|
-
|
|
1702
|
+
U.channel.stopListening(H.event, H.handler);
|
|
1702
1703
|
} catch {
|
|
1703
1704
|
}
|
|
1704
1705
|
}
|
|
@@ -1708,12 +1709,12 @@ function ec() {
|
|
|
1708
1709
|
g.clear();
|
|
1709
1710
|
}
|
|
1710
1711
|
function C(k) {
|
|
1711
|
-
const
|
|
1712
|
-
if (!
|
|
1712
|
+
const U = Ae();
|
|
1713
|
+
if (!U || g.has(k)) return;
|
|
1713
1714
|
const H = `conversation.${k}`;
|
|
1714
1715
|
M(k);
|
|
1715
|
-
const F =
|
|
1716
|
-
if (!
|
|
1716
|
+
const F = U.private(H), J = (B) => {
|
|
1717
|
+
if (!Ui(B)) {
|
|
1717
1718
|
Me.warn("Dropping malformed ConversationMessageSent event", B);
|
|
1718
1719
|
return;
|
|
1719
1720
|
}
|
|
@@ -1722,15 +1723,15 @@ function ec() {
|
|
|
1722
1723
|
e.addMessage(E.message);
|
|
1723
1724
|
const ne = e.hasDetailSubscription(E.conversation_id), _e = jo(E.conversation_id);
|
|
1724
1725
|
if (ne || _e) {
|
|
1725
|
-
const
|
|
1726
|
-
|
|
1726
|
+
const O = e.getConversationById(E.conversation_id);
|
|
1727
|
+
O && (O.unread_count = 0), e.markAsRead(E.conversation_id).catch(() => {
|
|
1727
1728
|
});
|
|
1728
1729
|
return;
|
|
1729
1730
|
}
|
|
1730
1731
|
const A = e.getConversationById(E.conversation_id);
|
|
1731
1732
|
if (A) {
|
|
1732
|
-
const
|
|
1733
|
-
|
|
1733
|
+
const O = $o(A);
|
|
1734
|
+
O || A.unread_count++, i(O);
|
|
1734
1735
|
}
|
|
1735
1736
|
}, me = (B) => {
|
|
1736
1737
|
if (!Fi(B)) {
|
|
@@ -1754,8 +1755,8 @@ function ec() {
|
|
|
1754
1755
|
if (ne >= 0) {
|
|
1755
1756
|
const A = V[ne];
|
|
1756
1757
|
if (A) {
|
|
1757
|
-
const
|
|
1758
|
-
E.message.body !== void 0 && (
|
|
1758
|
+
const O = { ...A };
|
|
1759
|
+
E.message.body !== void 0 && (O.body = E.message.body), E.message.edited_at !== void 0 && (O.edited_at = E.message.edited_at), E.message.meta !== void 0 && (O.meta = E.message.meta), V[ne] = O;
|
|
1759
1760
|
}
|
|
1760
1761
|
}
|
|
1761
1762
|
const _e = e.getConversationById(E.conversation_id);
|
|
@@ -1798,20 +1799,20 @@ function ec() {
|
|
|
1798
1799
|
y();
|
|
1799
1800
|
return;
|
|
1800
1801
|
}
|
|
1801
|
-
for (const
|
|
1802
|
-
M(
|
|
1802
|
+
for (const U of g) {
|
|
1803
|
+
M(U);
|
|
1803
1804
|
try {
|
|
1804
|
-
k.leave(`conversation.${
|
|
1805
|
+
k.leave(`conversation.${U}`);
|
|
1805
1806
|
} catch {
|
|
1806
1807
|
}
|
|
1807
|
-
e.unregisterGlobalConversationSubscription(
|
|
1808
|
+
e.unregisterGlobalConversationSubscription(U);
|
|
1808
1809
|
}
|
|
1809
1810
|
g.clear();
|
|
1810
1811
|
}
|
|
1811
1812
|
function T() {
|
|
1812
1813
|
const k = Ae();
|
|
1813
1814
|
if (!k) return;
|
|
1814
|
-
const
|
|
1815
|
+
const U = e.conversations.slice(0, qo), H = new Set(U.map((F) => F.id));
|
|
1815
1816
|
for (const F of g)
|
|
1816
1817
|
if (!H.has(F) && !e.hasDetailSubscription(F)) {
|
|
1817
1818
|
try {
|
|
@@ -1820,35 +1821,35 @@ function ec() {
|
|
|
1820
1821
|
}
|
|
1821
1822
|
g.delete(F), e.unregisterGlobalConversationSubscription(F);
|
|
1822
1823
|
}
|
|
1823
|
-
for (const F of
|
|
1824
|
+
for (const F of U)
|
|
1824
1825
|
C(F.id);
|
|
1825
1826
|
}
|
|
1826
1827
|
function w(k) {
|
|
1827
|
-
const
|
|
1828
|
+
const U = $n({
|
|
1828
1829
|
status: k.status,
|
|
1829
1830
|
last_seen_at: k.last_seen_at ?? null
|
|
1830
1831
|
});
|
|
1831
|
-
|
|
1832
|
+
U.status !== null && e.updatePresenceForUser(
|
|
1832
1833
|
k.user_id,
|
|
1833
|
-
|
|
1834
|
-
|
|
1834
|
+
U.status,
|
|
1835
|
+
U.lastSeenAt
|
|
1835
1836
|
);
|
|
1836
1837
|
}
|
|
1837
1838
|
async function f() {
|
|
1838
1839
|
const k = [...new Set(
|
|
1839
|
-
e.conversations.filter((
|
|
1840
|
+
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)
|
|
1840
1841
|
)];
|
|
1841
1842
|
if (k.length !== 0)
|
|
1842
1843
|
try {
|
|
1843
|
-
const
|
|
1844
|
+
const U = await o.get("/v1/presence/users", {
|
|
1844
1845
|
params: { ids: k }
|
|
1845
|
-
}), H =
|
|
1846
|
+
}), H = U.data?.data?.items ?? U.data?.items ?? [];
|
|
1846
1847
|
for (const F of H) {
|
|
1847
1848
|
const J = $n(F);
|
|
1848
1849
|
J.status !== null && e.updatePresenceForUser(F.id, J.status, J.lastSeenAt);
|
|
1849
1850
|
}
|
|
1850
|
-
} catch (
|
|
1851
|
-
Me.warn("Failed to refresh messaging presence snapshot",
|
|
1851
|
+
} catch (U) {
|
|
1852
|
+
Me.warn("Failed to refresh messaging presence snapshot", U);
|
|
1852
1853
|
}
|
|
1853
1854
|
}
|
|
1854
1855
|
function m() {
|
|
@@ -1857,13 +1858,13 @@ function ec() {
|
|
|
1857
1858
|
function v() {
|
|
1858
1859
|
x && (Pi(), x = !1);
|
|
1859
1860
|
}
|
|
1860
|
-
const N =
|
|
1861
|
+
const N = Ut(
|
|
1861
1862
|
d,
|
|
1862
1863
|
() => {
|
|
1863
1864
|
T();
|
|
1864
1865
|
},
|
|
1865
1866
|
{ deep: !1, immediate: !0 }
|
|
1866
|
-
), q =
|
|
1867
|
+
), q = Ut(
|
|
1867
1868
|
() => c.fullPath,
|
|
1868
1869
|
() => {
|
|
1869
1870
|
T();
|
|
@@ -2049,7 +2050,7 @@ function nc() {
|
|
|
2049
2050
|
typeof document > "u" || typeof window > "u" || (document.addEventListener("pointerdown", q, { passive: !0 }), document.addEventListener("keydown", q), document.addEventListener("touchstart", q, { passive: !0 }), window.addEventListener("focus", q));
|
|
2050
2051
|
}, k = () => {
|
|
2051
2052
|
typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", q), document.removeEventListener("keydown", q), document.removeEventListener("touchstart", q), window.removeEventListener("focus", q));
|
|
2052
|
-
},
|
|
2053
|
+
}, U = async () => {
|
|
2053
2054
|
if (It(n.accountLimitedUntilStorageKey))
|
|
2054
2055
|
return g = !0, "account_limited";
|
|
2055
2056
|
try {
|
|
@@ -2062,7 +2063,7 @@ function nc() {
|
|
|
2062
2063
|
}
|
|
2063
2064
|
}, H = async () => {
|
|
2064
2065
|
for (let I = 0; I < Zo; I += 1)
|
|
2065
|
-
if (await
|
|
2066
|
+
if (await U() !== "failed")
|
|
2066
2067
|
return;
|
|
2067
2068
|
console.warn("[Presence] Failed to open session");
|
|
2068
2069
|
}, F = async () => {
|
|
@@ -2135,42 +2136,42 @@ function sc(e) {
|
|
|
2135
2136
|
const A = l.value?.trim() ?? "";
|
|
2136
2137
|
if (A.length > 0)
|
|
2137
2138
|
return A;
|
|
2138
|
-
const
|
|
2139
|
-
return
|
|
2139
|
+
const O = m();
|
|
2140
|
+
return O.length > 0 && (l.value = O), O;
|
|
2140
2141
|
}, N = (A) => n.getTypingUsers(A), q = (A) => {
|
|
2141
|
-
const
|
|
2142
|
-
for (const re of
|
|
2142
|
+
const O = N(A);
|
|
2143
|
+
for (const re of O)
|
|
2143
2144
|
n.removeTypingUser(A, re.id);
|
|
2144
2145
|
d.value = [];
|
|
2145
2146
|
}, G = (A) => {
|
|
2146
|
-
const
|
|
2147
|
-
|
|
2147
|
+
const O = g.get(A);
|
|
2148
|
+
O && (clearTimeout(O), g.delete(A));
|
|
2148
2149
|
}, k = () => {
|
|
2149
2150
|
for (const A of g.values())
|
|
2150
2151
|
clearTimeout(A);
|
|
2151
2152
|
g.clear();
|
|
2152
|
-
},
|
|
2153
|
+
}, U = () => {
|
|
2153
2154
|
w && (clearTimeout(w), w = null), T = 0;
|
|
2154
2155
|
}, H = () => {
|
|
2155
2156
|
!x || o.value || w || T >= M || (w = setTimeout(() => {
|
|
2156
2157
|
w = null, T += 1, te();
|
|
2157
2158
|
}, y));
|
|
2158
|
-
}, F = (A,
|
|
2159
|
+
}, F = (A, O) => {
|
|
2159
2160
|
G(A);
|
|
2160
2161
|
const re = setTimeout(() => {
|
|
2161
|
-
g.delete(A), n.removeTypingUser(
|
|
2162
|
+
g.delete(A), n.removeTypingUser(O, A), d.value = d.value.filter((fe) => fe.id !== A);
|
|
2162
2163
|
}, aa);
|
|
2163
2164
|
g.set(A, re);
|
|
2164
2165
|
}, J = () => {
|
|
2165
|
-
C = !0,
|
|
2166
|
+
C = !0, U();
|
|
2166
2167
|
}, me = (A) => {
|
|
2167
2168
|
try {
|
|
2168
2169
|
b && (b(), b = null), b = ki(A, {
|
|
2169
2170
|
onTypingStart: I,
|
|
2170
2171
|
onTypingStop: ae
|
|
2171
|
-
}),
|
|
2172
|
-
} catch (
|
|
2173
|
-
c.value =
|
|
2172
|
+
}), U(), o.value = !0, l.value = A;
|
|
2173
|
+
} catch (O) {
|
|
2174
|
+
c.value = O instanceof Error ? O.message : "Failed to subscribe to typing channel";
|
|
2174
2175
|
}
|
|
2175
2176
|
}, te = () => {
|
|
2176
2177
|
const A = m();
|
|
@@ -2179,8 +2180,8 @@ function sc(e) {
|
|
|
2179
2180
|
me(A);
|
|
2180
2181
|
return;
|
|
2181
2182
|
}
|
|
2182
|
-
C = !1, ss().then((
|
|
2183
|
-
if (C || o.value || !
|
|
2183
|
+
C = !1, ss().then((O) => {
|
|
2184
|
+
if (C || o.value || !O)
|
|
2184
2185
|
return;
|
|
2185
2186
|
const re = m();
|
|
2186
2187
|
if (re && re === A && Ae() && Tn() === "connected") {
|
|
@@ -2195,41 +2196,41 @@ function sc(e) {
|
|
|
2195
2196
|
if (J(), !(!o.value || !A))
|
|
2196
2197
|
try {
|
|
2197
2198
|
b && (b(), b = null), Li(A), k(), q(A), o.value = !1, l.value = null, c.value = null;
|
|
2198
|
-
} catch (
|
|
2199
|
-
c.value =
|
|
2199
|
+
} catch (O) {
|
|
2200
|
+
c.value = O instanceof Error ? O.message : "Failed to unsubscribe from typing channel";
|
|
2200
2201
|
}
|
|
2201
2202
|
};
|
|
2202
2203
|
function I(A) {
|
|
2203
2204
|
if (A.user_id === f.value)
|
|
2204
2205
|
return;
|
|
2205
|
-
const
|
|
2206
|
-
if (!
|
|
2206
|
+
const O = v();
|
|
2207
|
+
if (!O)
|
|
2207
2208
|
return;
|
|
2208
2209
|
const re = {
|
|
2209
2210
|
id: A.user.id,
|
|
2210
2211
|
name: A.user.name,
|
|
2211
2212
|
...A.user.avatar !== void 0 ? { avatar: A.user.avatar } : {}
|
|
2212
2213
|
};
|
|
2213
|
-
d.value.some((fe) => fe.id === re.id) || (d.value = [...d.value, re]), n.addTypingUser(
|
|
2214
|
+
d.value.some((fe) => fe.id === re.id) || (d.value = [...d.value, re]), n.addTypingUser(O, re), F(A.user_id, O);
|
|
2214
2215
|
}
|
|
2215
2216
|
function ae(A) {
|
|
2216
2217
|
if (A.user_id === f.value)
|
|
2217
2218
|
return;
|
|
2218
2219
|
G(A.user_id);
|
|
2219
|
-
const
|
|
2220
|
-
|
|
2220
|
+
const O = v();
|
|
2221
|
+
O && (d.value = d.value.filter((re) => re.id !== A.user_id), n.removeTypingUser(O, A.user_id));
|
|
2221
2222
|
}
|
|
2222
2223
|
const B = ie(() => {
|
|
2223
2224
|
const A = v();
|
|
2224
2225
|
if (!A)
|
|
2225
2226
|
return d.value;
|
|
2226
|
-
const
|
|
2227
|
+
const O = N(A);
|
|
2227
2228
|
if (d.value.length === 0)
|
|
2228
|
-
return
|
|
2229
|
-
if (
|
|
2229
|
+
return O;
|
|
2230
|
+
if (O.length === 0)
|
|
2230
2231
|
return d.value;
|
|
2231
2232
|
const re = /* @__PURE__ */ new Map();
|
|
2232
|
-
for (const fe of
|
|
2233
|
+
for (const fe of O)
|
|
2233
2234
|
re.set(fe.id, fe);
|
|
2234
2235
|
for (const fe of d.value)
|
|
2235
2236
|
re.set(fe.id, fe);
|
|
@@ -2238,18 +2239,18 @@ function sc(e) {
|
|
|
2238
2239
|
const A = B.value;
|
|
2239
2240
|
if (A.length === 0)
|
|
2240
2241
|
return "";
|
|
2241
|
-
const
|
|
2242
|
-
if (!
|
|
2242
|
+
const O = A[0];
|
|
2243
|
+
if (!O)
|
|
2243
2244
|
return "";
|
|
2244
2245
|
if (A.length === 1)
|
|
2245
|
-
return `${
|
|
2246
|
+
return `${O.name} is typing...`;
|
|
2246
2247
|
const re = A[1];
|
|
2247
2248
|
if (!re)
|
|
2248
2249
|
return `${A.length} people are typing...`;
|
|
2249
2250
|
if (A.length === 2)
|
|
2250
|
-
return `${
|
|
2251
|
+
return `${O.name} and ${re.name} are typing...`;
|
|
2251
2252
|
const fe = A[2];
|
|
2252
|
-
return fe ? A.length === 3 ? `${
|
|
2253
|
+
return fe ? A.length === 3 ? `${O.name}, ${re.name} and ${fe.name} are typing...` : `${A.length} people are typing...` : `${A.length} people are typing...`;
|
|
2253
2254
|
}), V = ie(() => B.value.length > 0), ne = () => {
|
|
2254
2255
|
m() && (b && (b(), b = null), o.value = !1, l.value = null, te());
|
|
2255
2256
|
};
|
|
@@ -2261,8 +2262,8 @@ function sc(e) {
|
|
|
2261
2262
|
}
|
|
2262
2263
|
if (A === "disconnected" || A === "error") {
|
|
2263
2264
|
J(), b && (b(), b = null);
|
|
2264
|
-
const
|
|
2265
|
-
|
|
2265
|
+
const O = v();
|
|
2266
|
+
O && q(O), o.value = !1, l.value = null, k();
|
|
2266
2267
|
}
|
|
2267
2268
|
});
|
|
2268
2269
|
return h !== null && De(() => {
|
|
@@ -2281,7 +2282,7 @@ function rc(e) {
|
|
|
2281
2282
|
e.apiClient && ji(e.apiClient), e.mainApiClient && xo(e.mainApiClient), e.authStore && Hi(e.authStore), e.mediaApi && Xi(e.mediaApi), e.createLogger && Ao(e.createLogger), e.playMessageNotification && No(e.playMessageNotification), e.echo && Ii(e.echo), e.mainEcho && wo(e.mainEcho), e.presence && Bo(e.presence);
|
|
2282
2283
|
}
|
|
2283
2284
|
function ic() {
|
|
2284
|
-
$i(), ko(), Bi(), Wi(), Ro(), Do(),
|
|
2285
|
+
$i(), ko(), Bi(), Wi(), Ro(), Do(), Oi(), To(), Vo();
|
|
2285
2286
|
}
|
|
2286
2287
|
class Zt {
|
|
2287
2288
|
constructor() {
|
|
@@ -3228,7 +3229,7 @@ class ga {
|
|
|
3228
3229
|
function ma(e) {
|
|
3229
3230
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3230
3231
|
}
|
|
3231
|
-
var
|
|
3232
|
+
var Ot = { exports: {} };
|
|
3232
3233
|
var Bn;
|
|
3233
3234
|
function va() {
|
|
3234
3235
|
return Bn || (Bn = 1, (function(e, n) {
|
|
@@ -3327,9 +3328,9 @@ function va() {
|
|
|
3327
3328
|
}, w.prototype.decode = function(f) {
|
|
3328
3329
|
if (f.length === 0)
|
|
3329
3330
|
return new Uint8Array(0);
|
|
3330
|
-
for (var m = this._getPaddingLength(f), v = f.length - m, N = new Uint8Array(this.maxDecodedLength(v)), q = 0, G = 0, k = 0,
|
|
3331
|
-
|
|
3332
|
-
if (G < v - 1 && (
|
|
3331
|
+
for (var m = this._getPaddingLength(f), v = f.length - m, N = new Uint8Array(this.maxDecodedLength(v)), q = 0, G = 0, k = 0, U = 0, H = 0, F = 0, J = 0; G < v - 4; G += 4)
|
|
3332
|
+
U = this._decodeChar(f.charCodeAt(G + 0)), H = this._decodeChar(f.charCodeAt(G + 1)), F = this._decodeChar(f.charCodeAt(G + 2)), J = this._decodeChar(f.charCodeAt(G + 3)), N[q++] = U << 2 | H >>> 4, N[q++] = H << 4 | F >>> 2, N[q++] = F << 6 | J, k |= U & d, k |= H & d, k |= F & d, k |= J & d;
|
|
3333
|
+
if (G < v - 1 && (U = this._decodeChar(f.charCodeAt(G)), H = this._decodeChar(f.charCodeAt(G + 1)), N[q++] = U << 2 | H >>> 4, k |= U & d, k |= H & d), G < v - 2 && (F = this._decodeChar(f.charCodeAt(G + 2)), N[q++] = H << 4 | F >>> 2, k |= F & d), G < v - 3 && (J = this._decodeChar(f.charCodeAt(G + 3)), N[q++] = F << 6 | J, k |= J & d), k !== 0)
|
|
3333
3334
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
3334
3335
|
return N;
|
|
3335
3336
|
}, w.prototype._encodeByte = function(f) {
|
|
@@ -3622,7 +3623,7 @@ function va() {
|
|
|
3622
3623
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3623
3624
|
}
|
|
3624
3625
|
}
|
|
3625
|
-
class
|
|
3626
|
+
class U extends Error {
|
|
3626
3627
|
constructor(t) {
|
|
3627
3628
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3628
3629
|
}
|
|
@@ -3705,7 +3706,7 @@ function va() {
|
|
|
3705
3706
|
function A(r) {
|
|
3706
3707
|
window.clearInterval(r);
|
|
3707
3708
|
}
|
|
3708
|
-
class
|
|
3709
|
+
class O extends ne {
|
|
3709
3710
|
constructor(t, s) {
|
|
3710
3711
|
super(setTimeout, _e, t, function(a) {
|
|
3711
3712
|
return s(), null;
|
|
@@ -3724,7 +3725,7 @@ function va() {
|
|
|
3724
3725
|
return Date.now ? Date.now() : (/* @__PURE__ */ new Date()).valueOf();
|
|
3725
3726
|
},
|
|
3726
3727
|
defer(r) {
|
|
3727
|
-
return new
|
|
3728
|
+
return new O(0, r);
|
|
3728
3729
|
},
|
|
3729
3730
|
method(r, ...t) {
|
|
3730
3731
|
var s = Array.prototype.slice.call(arguments, 1);
|
|
@@ -3938,17 +3939,17 @@ function va() {
|
|
|
3938
3939
|
this.request && this.request.cleanup();
|
|
3939
3940
|
}
|
|
3940
3941
|
}
|
|
3941
|
-
var
|
|
3942
|
+
var Os = function(r, t) {
|
|
3942
3943
|
return function(s, a) {
|
|
3943
3944
|
var u = "http" + (t ? "s" : "") + "://", p = u + (r.host || r.options.host) + r.options.path, S = j.createJSONPRequest(p, s), L = j.ScriptReceivers.create(function(z, Q) {
|
|
3944
3945
|
d.remove(L), S.cleanup(), Q && Q.host && (r.host = Q.host), a && a(z, Q);
|
|
3945
3946
|
});
|
|
3946
3947
|
S.send(L);
|
|
3947
3948
|
};
|
|
3948
|
-
},
|
|
3949
|
+
}, Us = {
|
|
3949
3950
|
name: "jsonp",
|
|
3950
|
-
getAgent:
|
|
3951
|
-
}, Fs =
|
|
3951
|
+
getAgent: Os
|
|
3952
|
+
}, Fs = Us;
|
|
3952
3953
|
function pt(r, t, s) {
|
|
3953
3954
|
var a = r + (t.useTLS ? "s" : ""), u = t.useTLS ? t.hostTLS : t.hostNonTLS;
|
|
3954
3955
|
return a + "://" + u + s;
|
|
@@ -4727,7 +4728,7 @@ function va() {
|
|
|
4727
4728
|
});
|
|
4728
4729
|
}
|
|
4729
4730
|
retryIn(t) {
|
|
4730
|
-
this.timeline.info({ action: "retry", delay: t }), t > 0 && this.emit("connecting_in", Math.round(t / 1e3)), this.retryTimer = new
|
|
4731
|
+
this.timeline.info({ action: "retry", delay: t }), t > 0 && this.emit("connecting_in", Math.round(t / 1e3)), this.retryTimer = new O(t || 0, () => {
|
|
4731
4732
|
this.disconnectInternally(), this.connect();
|
|
4732
4733
|
});
|
|
4733
4734
|
}
|
|
@@ -4735,7 +4736,7 @@ function va() {
|
|
|
4735
4736
|
this.retryTimer && (this.retryTimer.ensureAborted(), this.retryTimer = null);
|
|
4736
4737
|
}
|
|
4737
4738
|
setUnavailableTimer() {
|
|
4738
|
-
this.unavailableTimer = new
|
|
4739
|
+
this.unavailableTimer = new O(this.options.unavailableTimeout, () => {
|
|
4739
4740
|
this.updateState("unavailable");
|
|
4740
4741
|
});
|
|
4741
4742
|
}
|
|
@@ -4743,12 +4744,12 @@ function va() {
|
|
|
4743
4744
|
this.unavailableTimer && this.unavailableTimer.ensureAborted();
|
|
4744
4745
|
}
|
|
4745
4746
|
sendActivityCheck() {
|
|
4746
|
-
this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new
|
|
4747
|
+
this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new O(this.options.pongTimeout, () => {
|
|
4747
4748
|
this.timeline.error({ pong_timed_out: this.options.pongTimeout }), this.retryIn(0);
|
|
4748
4749
|
});
|
|
4749
4750
|
}
|
|
4750
4751
|
resetActivityCheck() {
|
|
4751
|
-
this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new
|
|
4752
|
+
this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new O(this.activityTimeout, () => {
|
|
4752
4753
|
this.sendActivityCheck();
|
|
4753
4754
|
}));
|
|
4754
4755
|
}
|
|
@@ -4933,7 +4934,7 @@ function va() {
|
|
|
4933
4934
|
}
|
|
4934
4935
|
tryStrategy(t, s, a, u) {
|
|
4935
4936
|
var p = null, S = null;
|
|
4936
|
-
return a.timeout > 0 && (p = new
|
|
4937
|
+
return a.timeout > 0 && (p = new O(a.timeout, function() {
|
|
4937
4938
|
S.abort(), u(!0);
|
|
4938
4939
|
})), S = t.connect(s, function(L, z) {
|
|
4939
4940
|
L && p && p.isRunning() && !a.failFast || (p && p.ensureAborted(), u(L, z));
|
|
@@ -5068,7 +5069,7 @@ function va() {
|
|
|
5068
5069
|
return this.strategy.isSupported();
|
|
5069
5070
|
}
|
|
5070
5071
|
connect(t, s) {
|
|
5071
|
-
var a = this.strategy, u, p = new
|
|
5072
|
+
var a = this.strategy, u, p = new O(this.options.delay, function() {
|
|
5072
5073
|
u = a.connect(t, s);
|
|
5073
5074
|
});
|
|
5074
5075
|
return {
|
|
@@ -5222,10 +5223,10 @@ function va() {
|
|
|
5222
5223
|
(function(r) {
|
|
5223
5224
|
r[r.CONNECTING = 0] = "CONNECTING", r[r.OPEN = 1] = "OPEN", r[r.CLOSED = 3] = "CLOSED";
|
|
5224
5225
|
})(Ct || (Ct = {}));
|
|
5225
|
-
var
|
|
5226
|
+
var Oe = Ct, Er = 1;
|
|
5226
5227
|
class Ar {
|
|
5227
5228
|
constructor(t, s) {
|
|
5228
|
-
this.hooks = t, this.session = hn(1e3) + "/" + xr(8), this.location = Rr(s), this.readyState =
|
|
5229
|
+
this.hooks = t, this.session = hn(1e3) + "/" + xr(8), this.location = Rr(s), this.readyState = Oe.CONNECTING, this.openStream();
|
|
5229
5230
|
}
|
|
5230
5231
|
send(t) {
|
|
5231
5232
|
return this.sendRaw(JSON.stringify([t]));
|
|
@@ -5237,7 +5238,7 @@ function va() {
|
|
|
5237
5238
|
this.onClose(t, s, !0);
|
|
5238
5239
|
}
|
|
5239
5240
|
sendRaw(t) {
|
|
5240
|
-
if (this.readyState ===
|
|
5241
|
+
if (this.readyState === Oe.OPEN)
|
|
5241
5242
|
try {
|
|
5242
5243
|
return j.createSocketRequest("POST", dn(Pr(this.location, this.session))).start(t), !0;
|
|
5243
5244
|
} catch {
|
|
@@ -5250,7 +5251,7 @@ function va() {
|
|
|
5250
5251
|
this.closeStream(), this.openStream();
|
|
5251
5252
|
}
|
|
5252
5253
|
onClose(t, s, a) {
|
|
5253
|
-
this.closeStream(), this.readyState =
|
|
5254
|
+
this.closeStream(), this.readyState = Oe.CLOSED, this.onclose && this.onclose({
|
|
5254
5255
|
code: t,
|
|
5255
5256
|
reason: s,
|
|
5256
5257
|
wasClean: a
|
|
@@ -5258,7 +5259,7 @@ function va() {
|
|
|
5258
5259
|
}
|
|
5259
5260
|
onChunk(t) {
|
|
5260
5261
|
if (t.status === 200) {
|
|
5261
|
-
this.readyState ===
|
|
5262
|
+
this.readyState === Oe.OPEN && this.onActivity();
|
|
5262
5263
|
var s, a = t.data.slice(0, 1);
|
|
5263
5264
|
switch (a) {
|
|
5264
5265
|
case "o":
|
|
@@ -5282,10 +5283,10 @@ function va() {
|
|
|
5282
5283
|
}
|
|
5283
5284
|
}
|
|
5284
5285
|
onOpen(t) {
|
|
5285
|
-
this.readyState ===
|
|
5286
|
+
this.readyState === Oe.CONNECTING ? (t && t.hostname && (this.location.base = Mr(this.location.base, t.hostname)), this.readyState = Oe.OPEN, this.onopen && this.onopen()) : this.onClose(1006, "Server lost session", !0);
|
|
5286
5287
|
}
|
|
5287
5288
|
onEvent(t) {
|
|
5288
|
-
this.readyState ===
|
|
5289
|
+
this.readyState === Oe.OPEN && this.onmessage && this.onmessage({ data: t });
|
|
5289
5290
|
}
|
|
5290
5291
|
onActivity() {
|
|
5291
5292
|
this.onactivity && this.onactivity();
|
|
@@ -5352,7 +5353,7 @@ function va() {
|
|
|
5352
5353
|
onFinished: function(r, t) {
|
|
5353
5354
|
r.onClose(1006, "Connection interrupted (" + t + ")", !1);
|
|
5354
5355
|
}
|
|
5355
|
-
}, Ir = Lr,
|
|
5356
|
+
}, Ir = Lr, Or = {
|
|
5356
5357
|
getReceiveURL: function(r, t) {
|
|
5357
5358
|
return r.base + "/" + t + "/xhr" + r.queryString;
|
|
5358
5359
|
},
|
|
@@ -5364,7 +5365,7 @@ function va() {
|
|
|
5364
5365
|
onFinished: function(r, t) {
|
|
5365
5366
|
t === 200 ? r.reconnect() : r.onClose(1006, "Connection interrupted (" + t + ")", !1);
|
|
5366
5367
|
}
|
|
5367
|
-
},
|
|
5368
|
+
}, Ur = Or, Fr = {
|
|
5368
5369
|
getRequest: function(r) {
|
|
5369
5370
|
var t = j.getXHRAPI(), s = new t();
|
|
5370
5371
|
return s.onreadystatechange = s.onprogress = function() {
|
|
@@ -5386,7 +5387,7 @@ function va() {
|
|
|
5386
5387
|
return this.createSocket(Ir, r);
|
|
5387
5388
|
},
|
|
5388
5389
|
createPollingSocket(r) {
|
|
5389
|
-
return this.createSocket(
|
|
5390
|
+
return this.createSocket(Ur, r);
|
|
5390
5391
|
},
|
|
5391
5392
|
createSocket(r, t) {
|
|
5392
5393
|
return new kr(r, t);
|
|
@@ -5550,7 +5551,7 @@ function va() {
|
|
|
5550
5551
|
if (this.isSupported()) {
|
|
5551
5552
|
if (this.priority < t)
|
|
5552
5553
|
return pn(new N(), s);
|
|
5553
|
-
} else return pn(new
|
|
5554
|
+
} else return pn(new U(), s);
|
|
5554
5555
|
var a = !1, u = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), p = null, S = function() {
|
|
5555
5556
|
u.unbind("initialized", S), u.connect();
|
|
5556
5557
|
}, L = function() {
|
|
@@ -5599,7 +5600,7 @@ function va() {
|
|
|
5599
5600
|
},
|
|
5600
5601
|
connect: function(r, t) {
|
|
5601
5602
|
var s = ue.defer(function() {
|
|
5602
|
-
t(new
|
|
5603
|
+
t(new U());
|
|
5603
5604
|
});
|
|
5604
5605
|
return {
|
|
5605
5606
|
abort: function() {
|
|
@@ -5925,7 +5926,7 @@ function va() {
|
|
|
5925
5926
|
])
|
|
5926
5927
|
);
|
|
5927
5928
|
});
|
|
5928
|
-
})(
|
|
5929
|
+
})(Ot)), Ot.exports;
|
|
5929
5930
|
}
|
|
5930
5931
|
var ba = va();
|
|
5931
5932
|
const ya = /* @__PURE__ */ ma(ba), _a = "/v1/messenger/bootstrap", Sa = 3e4, Ca = 3e4, wa = 5 * 6e4;
|
|
@@ -6101,7 +6102,7 @@ function Ia(e) {
|
|
|
6101
6102
|
...typeof e.ts == "string" ? { ts: e.ts } : {}
|
|
6102
6103
|
};
|
|
6103
6104
|
}
|
|
6104
|
-
function
|
|
6105
|
+
function Oa(e) {
|
|
6105
6106
|
if (!se(e))
|
|
6106
6107
|
return null;
|
|
6107
6108
|
const n = Re(e, "user_id", "userId"), i = Re(e, "conversation_id", "conversationId");
|
|
@@ -6112,11 +6113,11 @@ function Ua(e) {
|
|
|
6112
6113
|
...typeof e.ts == "string" ? { ts: e.ts } : {}
|
|
6113
6114
|
};
|
|
6114
6115
|
}
|
|
6115
|
-
function
|
|
6116
|
+
function Ua(e) {
|
|
6116
6117
|
return se(e) && le(e, "id") && le(e, "name");
|
|
6117
6118
|
}
|
|
6118
6119
|
function Fa(e) {
|
|
6119
|
-
return !se(e) || !le(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) =>
|
|
6120
|
+
return !se(e) || !le(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => Ua(n));
|
|
6120
6121
|
}
|
|
6121
6122
|
function Na(e) {
|
|
6122
6123
|
return se(e) && se(e.message) && le(e.message, "id") && le(e.message, "conversation_id") && le(e.message, "author_id");
|
|
@@ -6139,7 +6140,7 @@ function $a(e) {
|
|
|
6139
6140
|
function Ha(e) {
|
|
6140
6141
|
return se(e) && le(e, "conversation_id") && le(e, "removed_user_id");
|
|
6141
6142
|
}
|
|
6142
|
-
function
|
|
6143
|
+
function Ue(e, n, i, o) {
|
|
6143
6144
|
const c = (l) => {
|
|
6144
6145
|
i(l) && o(l);
|
|
6145
6146
|
};
|
|
@@ -6168,7 +6169,7 @@ function oc(e) {
|
|
|
6168
6169
|
return null;
|
|
6169
6170
|
const R = e.getSourceToken();
|
|
6170
6171
|
return R === null ? (G(), null) : (C !== null && C !== R && (N(), d = null, g = null, v("available"), q()), C = R, R);
|
|
6171
|
-
},
|
|
6172
|
+
}, U = (R) => {
|
|
6172
6173
|
if (R === null)
|
|
6173
6174
|
return !1;
|
|
6174
6175
|
if (R.auth.expiresAt === null)
|
|
@@ -6185,7 +6186,7 @@ function oc(e) {
|
|
|
6185
6186
|
b = setTimeout(() => {
|
|
6186
6187
|
J();
|
|
6187
6188
|
}, D);
|
|
6188
|
-
}, F = async (R = !1) => e.getSourceToken && k() === null || !R && y === "account_suspended" ? null : !R &&
|
|
6189
|
+
}, F = async (R = !1) => e.getSourceToken && k() === null || !R && y === "account_suspended" ? null : !R && U(d) ? d : !R && g !== null ? await g : (g = (async () => {
|
|
6189
6190
|
try {
|
|
6190
6191
|
const D = await e.bootstrapClient.get(
|
|
6191
6192
|
i,
|
|
@@ -6236,7 +6237,7 @@ function oc(e) {
|
|
|
6236
6237
|
}
|
|
6237
6238
|
(X === "unavailable" || X === "failed" || X === "disconnected") && m("disconnected");
|
|
6238
6239
|
}), P.state === "connected" && m("connected");
|
|
6239
|
-
}, te = async (R = !1) => !R && h !== null &&
|
|
6240
|
+
}, te = async (R = !1) => !R && h !== null && U(d) ? h : !R && x !== null ? await x : (x = (async () => {
|
|
6240
6241
|
const D = await F(R);
|
|
6241
6242
|
if (D === null)
|
|
6242
6243
|
return null;
|
|
@@ -6336,31 +6337,31 @@ function oc(e) {
|
|
|
6336
6337
|
const X = D.private(`conversation.${R}`), Y = [];
|
|
6337
6338
|
return P.onMessageSent && Y.push({
|
|
6338
6339
|
event: ".ConversationMessageSent",
|
|
6339
|
-
handler:
|
|
6340
|
+
handler: Ue(X, ".ConversationMessageSent", Na, P.onMessageSent)
|
|
6340
6341
|
}), P.onMessageRead && Y.push({
|
|
6341
6342
|
event: ".ConversationMessageRead",
|
|
6342
|
-
handler:
|
|
6343
|
+
handler: Ue(X, ".ConversationMessageRead", Da, P.onMessageRead)
|
|
6343
6344
|
}), P.onMessageEdited && Y.push({
|
|
6344
6345
|
event: ".ConversationMessageEdited",
|
|
6345
|
-
handler:
|
|
6346
|
+
handler: Ue(X, ".ConversationMessageEdited", qa, P.onMessageEdited)
|
|
6346
6347
|
}), P.onMessageDeleted && Y.push({
|
|
6347
6348
|
event: ".ConversationMessageDeleted",
|
|
6348
|
-
handler:
|
|
6349
|
+
handler: Ue(X, ".ConversationMessageDeleted", za, P.onMessageDeleted)
|
|
6349
6350
|
}), P.onReactionToggled && Y.push({
|
|
6350
6351
|
event: ".MessageReactionToggled",
|
|
6351
|
-
handler:
|
|
6352
|
+
handler: Ue(X, ".MessageReactionToggled", ja, P.onReactionToggled)
|
|
6352
6353
|
}), P.onRequestAccepted && Y.push({
|
|
6353
6354
|
event: ".ConversationRequestAccepted",
|
|
6354
|
-
handler:
|
|
6355
|
+
handler: Ue(X, ".ConversationRequestAccepted", $a, P.onRequestAccepted)
|
|
6355
6356
|
}), P.onParticipantRemoved && Y.push({
|
|
6356
6357
|
event: ".ConversationParticipantRemoved",
|
|
6357
|
-
handler:
|
|
6358
|
+
handler: Ue(X, ".ConversationParticipantRemoved", Ha, P.onParticipantRemoved)
|
|
6358
6359
|
}), () => {
|
|
6359
6360
|
if (typeof X.stopListening == "function")
|
|
6360
6361
|
for (const ge of Y)
|
|
6361
6362
|
X.stopListening(ge.event, ge.handler);
|
|
6362
6363
|
};
|
|
6363
|
-
},
|
|
6364
|
+
}, O = (R) => {
|
|
6364
6365
|
h?.leave(`conversation.${R}`);
|
|
6365
6366
|
}, re = (R, P, D) => {
|
|
6366
6367
|
const X = R.private(`typing-conversation.${P}`), Y = [], ge = [
|
|
@@ -6419,7 +6420,7 @@ function oc(e) {
|
|
|
6419
6420
|
}
|
|
6420
6421
|
for (const ye of Ke) {
|
|
6421
6422
|
const Ce = (ke) => {
|
|
6422
|
-
const K =
|
|
6423
|
+
const K = Oa(ke);
|
|
6423
6424
|
if (!K)
|
|
6424
6425
|
return;
|
|
6425
6426
|
const qe = {
|
|
@@ -6466,7 +6467,7 @@ function oc(e) {
|
|
|
6466
6467
|
subscribeToPresenceStatus: ne,
|
|
6467
6468
|
unsubscribeFromPresenceStatus: _e,
|
|
6468
6469
|
subscribeToConversation: A,
|
|
6469
|
-
unsubscribeFromConversation:
|
|
6470
|
+
unsubscribeFromConversation: O,
|
|
6470
6471
|
subscribeToTyping: fe,
|
|
6471
6472
|
unsubscribeFromTyping: ue,
|
|
6472
6473
|
clearRuntime: G
|
|
@@ -6498,11 +6499,11 @@ export {
|
|
|
6498
6499
|
Di as isValidMessageDeletedEvent,
|
|
6499
6500
|
Ni as isValidMessageEditedEvent,
|
|
6500
6501
|
Fi as isValidMessageReadEvent,
|
|
6501
|
-
|
|
6502
|
+
Ui as isValidMessageSentEvent,
|
|
6502
6503
|
qi as isValidReactionToggledEvent,
|
|
6503
6504
|
zi as isValidRequestAcceptedEvent,
|
|
6504
6505
|
Pe as messagingApi,
|
|
6505
|
-
|
|
6506
|
+
Oo as normalizePresenceStatus,
|
|
6506
6507
|
ms as normalizePresenceTimestamp,
|
|
6507
6508
|
ht as onConnectionStatusChange,
|
|
6508
6509
|
So as onMainEchoConnectionStatusChange,
|
|
@@ -6510,7 +6511,7 @@ export {
|
|
|
6510
6511
|
qt as parsePresenceTimestamp,
|
|
6511
6512
|
Ai as reconnectEcho,
|
|
6512
6513
|
Co as reconnectMainEcho,
|
|
6513
|
-
|
|
6514
|
+
Oi as resetEchoRuntimeConfig,
|
|
6514
6515
|
Ro as resetLoggerFactory,
|
|
6515
6516
|
ko as resetMainApiClient,
|
|
6516
6517
|
To as resetMainEchoRuntimeConfig,
|
|
@@ -6519,7 +6520,7 @@ export {
|
|
|
6519
6520
|
Wi as resetMessagingMediaApi,
|
|
6520
6521
|
ic as resetMessengerClientConfig,
|
|
6521
6522
|
Vo as resetPresenceRuntimeConfig,
|
|
6522
|
-
|
|
6523
|
+
Uo as resolveFreshPresenceStatus,
|
|
6523
6524
|
$n as resolvePresenceSnapshot,
|
|
6524
6525
|
Ii as setEchoRuntimeConfig,
|
|
6525
6526
|
Ao as setLoggerFactory,
|