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