@codingfactory/messenger-client 0.2.18 → 0.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +646 -641
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ref as ve, getCurrentInstance as zt, computed as ie, watch as
|
|
2
|
-
import { defineStore as
|
|
3
|
-
import $t, { isAxiosError as
|
|
1
|
+
import { ref as ve, getCurrentInstance as zt, computed as ie, watch as Ut, onUnmounted as De, toValue as Xn, onMounted as jt } from "vue";
|
|
2
|
+
import { defineStore as Si, storeToRefs as Ci } from "pinia";
|
|
3
|
+
import $t, { isAxiosError as wi, AxiosHeaders as wn } from "axios";
|
|
4
4
|
import { isAxiosError as uc } from "axios";
|
|
5
|
-
import { useRoute as
|
|
5
|
+
import { useRoute as Ti } from "vue-router";
|
|
6
6
|
const Wn = () => () => {
|
|
7
7
|
}, Gn = () => () => {
|
|
8
8
|
}, Jn = async () => {
|
|
@@ -29,38 +29,38 @@ const Wn = () => () => {
|
|
|
29
29
|
unsubscribeFromConversation: Yn,
|
|
30
30
|
subscribeToTyping: ts,
|
|
31
31
|
unsubscribeFromTyping: Zn
|
|
32
|
-
}, We = () => $.ECHO_INITIALIZED_EVENT,
|
|
32
|
+
}, We = () => $.ECHO_INITIALIZED_EVENT, Ae = () => $.getEcho(), ss = async () => $.waitForEcho(), rs = () => $.getConnectionStatus(), Tn = () => rs(), Ft = () => $.getAccessState(), ht = (e) => $.onConnectionStatusChange(e), Ei = (e) => $.onAccessStateChange(e), Ai = async () => {
|
|
33
33
|
await $.reconnect();
|
|
34
34
|
}, Ri = (e) => $.subscribeToPresenceStatus(e), Pi = () => $.unsubscribeFromPresenceStatus(), Mi = (e, n) => $.subscribeToConversation(e, n), xi = (e) => $.unsubscribeFromConversation(e), ki = (e, n) => $.subscribeToTyping(e, n), Li = (e) => $.unsubscribeFromTyping(e);
|
|
35
35
|
function Ii(e) {
|
|
36
36
|
e.initializedEvent && ($.ECHO_INITIALIZED_EVENT = e.initializedEvent), e.getEcho && ($.getEcho = e.getEcho), e.waitForEcho && ($.waitForEcho = e.waitForEcho), e.getConnectionStatus && ($.getConnectionStatus = e.getConnectionStatus), e.getAccessState && ($.getAccessState = e.getAccessState), e.onConnectionStatusChange && ($.onConnectionStatusChange = e.onConnectionStatusChange), e.onAccessStateChange && ($.onAccessStateChange = e.onAccessStateChange), e.reconnect && ($.reconnect = e.reconnect), e.subscribeToPresenceStatus && ($.subscribeToPresenceStatus = e.subscribeToPresenceStatus), e.unsubscribeFromPresenceStatus && ($.unsubscribeFromPresenceStatus = e.unsubscribeFromPresenceStatus), e.subscribeToConversation && ($.subscribeToConversation = e.subscribeToConversation), e.unsubscribeFromConversation && ($.unsubscribeFromConversation = e.unsubscribeFromConversation), e.subscribeToTyping && ($.subscribeToTyping = e.subscribeToTyping), e.unsubscribeFromTyping && ($.unsubscribeFromTyping = e.unsubscribeFromTyping);
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function Oi() {
|
|
39
39
|
$.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", $.getEcho = () => null, $.waitForEcho = ns, $.getConnectionStatus = () => "disconnected", $.getAccessState = () => "available", $.onConnectionStatusChange = Wn, $.onAccessStateChange = Gn, $.reconnect = Jn, $.subscribeToPresenceStatus = Kn, $.unsubscribeFromPresenceStatus = Qn, $.subscribeToConversation = es, $.unsubscribeFromConversation = Yn, $.subscribeToTyping = ts, $.unsubscribeFromTyping = Zn;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function xe(e) {
|
|
42
42
|
return typeof e == "object" && e !== null;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
return
|
|
44
|
+
function Ui(e) {
|
|
45
|
+
return xe(e) && typeof e.conversation_id == "string" && xe(e.message) && typeof e.message.id == "string" && typeof e.message.conversation_id == "string" && typeof e.message.author_id == "string";
|
|
46
46
|
}
|
|
47
47
|
function Fi(e) {
|
|
48
|
-
return
|
|
48
|
+
return xe(e) && typeof e.conversation_id == "string" && typeof e.user_id == "string" && typeof e.message_id == "string";
|
|
49
49
|
}
|
|
50
50
|
function Ni(e) {
|
|
51
|
-
return
|
|
51
|
+
return xe(e) && typeof e.conversation_id == "string" && xe(e.message) && typeof e.message.id == "string";
|
|
52
52
|
}
|
|
53
53
|
function Di(e) {
|
|
54
|
-
return
|
|
54
|
+
return xe(e) && typeof e.conversation_id == "string" && typeof e.message_id == "string";
|
|
55
55
|
}
|
|
56
56
|
function qi(e) {
|
|
57
|
-
return
|
|
57
|
+
return xe(e) && typeof e.conversation_id == "string" && typeof e.message_id == "string" && Array.isArray(e.reactions);
|
|
58
58
|
}
|
|
59
59
|
function zi(e) {
|
|
60
|
-
return
|
|
60
|
+
return xe(e) && typeof e.conversation_id == "string";
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
let Ht =
|
|
62
|
+
const is = $t;
|
|
63
|
+
let Ht = is;
|
|
64
64
|
function W() {
|
|
65
65
|
return Ht;
|
|
66
66
|
}
|
|
@@ -68,12 +68,12 @@ function ji(e) {
|
|
|
68
68
|
Ht = e;
|
|
69
69
|
}
|
|
70
70
|
function $i() {
|
|
71
|
-
Ht =
|
|
71
|
+
Ht = is;
|
|
72
72
|
}
|
|
73
|
-
const
|
|
73
|
+
const os = {
|
|
74
74
|
currentUser: null
|
|
75
75
|
};
|
|
76
|
-
let Bt = () =>
|
|
76
|
+
let Bt = () => os;
|
|
77
77
|
function Fe() {
|
|
78
78
|
return Bt;
|
|
79
79
|
}
|
|
@@ -81,10 +81,10 @@ function Hi(e) {
|
|
|
81
81
|
Bt = e;
|
|
82
82
|
}
|
|
83
83
|
function Bi() {
|
|
84
|
-
Bt = () =>
|
|
84
|
+
Bt = () => os;
|
|
85
85
|
}
|
|
86
86
|
function Z(e) {
|
|
87
|
-
if (
|
|
87
|
+
if (wi(e)) {
|
|
88
88
|
const n = e.response?.data?.message || e.message || "An error occurred";
|
|
89
89
|
return n.includes("SQLSTATE") || n.includes("Connection:") || n.includes("\\Illuminate\\") ? "Something went wrong. Please try again later." : n;
|
|
90
90
|
}
|
|
@@ -96,12 +96,12 @@ function Ka(e) {
|
|
|
96
96
|
function Qa(e) {
|
|
97
97
|
return typeof e == "object" && e !== null && "response" in e && typeof e.response == "object";
|
|
98
98
|
}
|
|
99
|
-
const
|
|
99
|
+
const as = {
|
|
100
100
|
async uploadImage() {
|
|
101
101
|
throw new Error("messenger-client mediaApi.uploadImage is not configured");
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
-
let Vt =
|
|
104
|
+
let Vt = as;
|
|
105
105
|
function Vi() {
|
|
106
106
|
return Vt;
|
|
107
107
|
}
|
|
@@ -109,16 +109,16 @@ function Xi(e) {
|
|
|
109
109
|
Vt = e;
|
|
110
110
|
}
|
|
111
111
|
function Wi() {
|
|
112
|
-
Vt =
|
|
112
|
+
Vt = as;
|
|
113
113
|
}
|
|
114
114
|
function Gi(e) {
|
|
115
115
|
return e !== null && typeof e == "object" && "id" in e && "type" in e && "participants" in e;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function cs(e) {
|
|
118
118
|
return typeof e == "object" && e !== null;
|
|
119
119
|
}
|
|
120
120
|
function $e(e) {
|
|
121
|
-
return !
|
|
121
|
+
return !cs(e) || !("data" in e) ? e : e.data;
|
|
122
122
|
}
|
|
123
123
|
function st(e, n) {
|
|
124
124
|
const i = e[n];
|
|
@@ -146,7 +146,7 @@ function Rt(e, n) {
|
|
|
146
146
|
throw new Error(`Invalid messaging folder payload: missing numeric ${n}`);
|
|
147
147
|
}
|
|
148
148
|
function Nt(e) {
|
|
149
|
-
if (!
|
|
149
|
+
if (!cs(e))
|
|
150
150
|
throw new Error("Invalid messaging folder payload: expected object");
|
|
151
151
|
return {
|
|
152
152
|
id: st(e, "id"),
|
|
@@ -170,7 +170,7 @@ function An(e) {
|
|
|
170
170
|
throw new Error("Invalid conversation payload from folder assignment endpoint");
|
|
171
171
|
return e;
|
|
172
172
|
}
|
|
173
|
-
const
|
|
173
|
+
const Pe = {
|
|
174
174
|
async fetchFolders() {
|
|
175
175
|
const e = await W().get("/v1/messaging/folders");
|
|
176
176
|
return Ji($e(e.data));
|
|
@@ -210,10 +210,10 @@ const Re = {
|
|
|
210
210
|
if (Number.isFinite(n))
|
|
211
211
|
return n;
|
|
212
212
|
}
|
|
213
|
-
},
|
|
213
|
+
}, us = (e) => typeof e == "number" && e >= 500 && e < 600, Pn = (e) => {
|
|
214
214
|
const i = Wt(e.response?.status);
|
|
215
|
-
return i === void 0 ? !0 : i === 429 ||
|
|
216
|
-
},
|
|
215
|
+
return i === void 0 ? !0 : i === 429 || us(i);
|
|
216
|
+
}, ls = (e) => {
|
|
217
217
|
if (typeof e == "number" && Number.isFinite(e) && e > 0)
|
|
218
218
|
return Math.max(Rn, e * 1e3);
|
|
219
219
|
if (typeof e == "string") {
|
|
@@ -227,7 +227,7 @@ const Re = {
|
|
|
227
227
|
return Math.min(Ki, o);
|
|
228
228
|
}, to = (e) => {
|
|
229
229
|
const n = e;
|
|
230
|
-
return Wt(n.response?.status) === 429 ?
|
|
230
|
+
return Wt(n.response?.status) === 429 ? ls(n.response?.headers?.["retry-after"]) : Qi;
|
|
231
231
|
}, Mn = async (e) => {
|
|
232
232
|
await new Promise((n) => {
|
|
233
233
|
setTimeout(n, e);
|
|
@@ -397,15 +397,15 @@ function ho(e, n) {
|
|
|
397
397
|
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;
|
|
398
398
|
}
|
|
399
399
|
function He(e, n) {
|
|
400
|
-
const i = lo(e, n), o = typeof e.is_muted == "boolean" ? e.is_muted : i !== null || n?.is_muted === !0, c = e.last_message ? at(e.last_message) : n?.last_message, l = e.last_message_at ?? n?.last_message_at, d = typeof e.unread_count == "number" ? e.unread_count : n?.unread_count ?? 0, g = 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, x = ho(e, n), M = typeof e.created_at == "string" ? e.created_at : n?.created_at ?? "",
|
|
400
|
+
const i = lo(e, n), o = typeof e.is_muted == "boolean" ? e.is_muted : i !== null || n?.is_muted === !0, c = e.last_message ? at(e.last_message) : n?.last_message, l = e.last_message_at ?? n?.last_message_at, d = typeof e.unread_count == "number" ? e.unread_count : n?.unread_count ?? 0, g = 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, x = ho(e, n), M = typeof e.created_at == "string" ? e.created_at : n?.created_at ?? "", y = (() => {
|
|
401
401
|
if (!n || n.unread_count !== 0 || d <= 0)
|
|
402
402
|
return !1;
|
|
403
|
-
const C = n.last_message?.id,
|
|
404
|
-
return !C || !
|
|
403
|
+
const C = n.last_message?.id, b = e.last_message?.id;
|
|
404
|
+
return !C || !b ? !1 : C === b;
|
|
405
405
|
})();
|
|
406
406
|
return {
|
|
407
407
|
...e,
|
|
408
|
-
unread_count: o ||
|
|
408
|
+
unread_count: o || y ? 0 : d,
|
|
409
409
|
participants: uo(e.participants, n?.participants),
|
|
410
410
|
is_muted: o,
|
|
411
411
|
muted_until: i,
|
|
@@ -439,7 +439,7 @@ function he(e) {
|
|
|
439
439
|
function po(e) {
|
|
440
440
|
return he(e) ? (he(e.response) ? e.response : null)?.status === 401 : !1;
|
|
441
441
|
}
|
|
442
|
-
function
|
|
442
|
+
function On(e) {
|
|
443
443
|
if (!Array.isArray(e))
|
|
444
444
|
return [];
|
|
445
445
|
const n = [];
|
|
@@ -473,7 +473,7 @@ function rt(e, n) {
|
|
|
473
473
|
nextCursor: go(i, o)
|
|
474
474
|
};
|
|
475
475
|
}
|
|
476
|
-
function
|
|
476
|
+
function Un(e) {
|
|
477
477
|
return he(e) && typeof e.id == "string" && e.id.length > 0;
|
|
478
478
|
}
|
|
479
479
|
function Fn(e) {
|
|
@@ -532,7 +532,7 @@ function xt(e) {
|
|
|
532
532
|
i.is_request === !0 && n.set(i.id, i);
|
|
533
533
|
return Array.from(n.values()).sort(ct);
|
|
534
534
|
}
|
|
535
|
-
const Gt =
|
|
535
|
+
const Gt = Si("messaging", {
|
|
536
536
|
state: () => ({
|
|
537
537
|
conversations: [],
|
|
538
538
|
requests: [],
|
|
@@ -581,7 +581,7 @@ const Gt = _i("messaging", {
|
|
|
581
581
|
},
|
|
582
582
|
async fetchFolders() {
|
|
583
583
|
try {
|
|
584
|
-
const e = await
|
|
584
|
+
const e = await Pe.fetchFolders();
|
|
585
585
|
return this.folders = Be(e), this.foldersLoaded = !0, this.normalizeFolderAssignmentsState(), this.folders;
|
|
586
586
|
} catch (e) {
|
|
587
587
|
throw this.error = Z(e), e;
|
|
@@ -589,7 +589,7 @@ const Gt = _i("messaging", {
|
|
|
589
589
|
},
|
|
590
590
|
async createFolder(e) {
|
|
591
591
|
try {
|
|
592
|
-
const n = await
|
|
592
|
+
const n = await Pe.createFolder(e);
|
|
593
593
|
return this.folders = Be([...this.folders, n]), n;
|
|
594
594
|
} catch (n) {
|
|
595
595
|
throw this.error = Z(n), n;
|
|
@@ -597,7 +597,7 @@ const Gt = _i("messaging", {
|
|
|
597
597
|
},
|
|
598
598
|
async updateFolder(e, n) {
|
|
599
599
|
try {
|
|
600
|
-
const i = await
|
|
600
|
+
const i = await Pe.updateFolder(e, n);
|
|
601
601
|
return this.folders = Be(
|
|
602
602
|
this.folders.map((o) => o.id === e ? i : o)
|
|
603
603
|
), i;
|
|
@@ -607,14 +607,14 @@ const Gt = _i("messaging", {
|
|
|
607
607
|
},
|
|
608
608
|
async deleteFolder(e) {
|
|
609
609
|
try {
|
|
610
|
-
await
|
|
610
|
+
await Pe.deleteFolder(e), this.folders = this.folders.filter((n) => n.id !== e), this.foldersLoaded = !0, this.activeFolderId === e && (this.activeFolderId = null), this.normalizeFolderAssignmentsState();
|
|
611
611
|
} catch (n) {
|
|
612
612
|
throw this.error = Z(n), n;
|
|
613
613
|
}
|
|
614
614
|
},
|
|
615
615
|
async reorderFolders(e) {
|
|
616
616
|
try {
|
|
617
|
-
await
|
|
617
|
+
await Pe.reorderFolders(e);
|
|
618
618
|
const n = new Map(this.folders.map((c) => [c.id, c])), i = [];
|
|
619
619
|
for (const c of e) {
|
|
620
620
|
const l = n.get(c);
|
|
@@ -636,7 +636,7 @@ const Gt = _i("messaging", {
|
|
|
636
636
|
},
|
|
637
637
|
async assignToFolder(e, n) {
|
|
638
638
|
try {
|
|
639
|
-
const i = await
|
|
639
|
+
const i = await Pe.assignFolder(e, n), o = this.conversations.find(
|
|
640
640
|
(d) => d.id === e
|
|
641
641
|
) ?? this.requests.find(
|
|
642
642
|
(d) => d.id === e
|
|
@@ -671,11 +671,11 @@ const Gt = _i("messaging", {
|
|
|
671
671
|
const d = await W().get("/v1/messaging/conversations", { params: l }), { items: g, nextCursor: h } = rt(
|
|
672
672
|
d.data,
|
|
673
673
|
"conversations"
|
|
674
|
-
), x = g.map((
|
|
674
|
+
), x = g.map((y) => {
|
|
675
675
|
const C = this.conversations.find(
|
|
676
|
-
(
|
|
676
|
+
(b) => b.id === y.id
|
|
677
677
|
);
|
|
678
|
-
return He(
|
|
678
|
+
return He(y, C);
|
|
679
679
|
});
|
|
680
680
|
e ? this.conversations.push(...x) : this.conversations = x, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
|
|
681
681
|
const M = {
|
|
@@ -699,7 +699,7 @@ const Gt = _i("messaging", {
|
|
|
699
699
|
}), this.backgroundPollRetryAfterUntil = 0, this.backgroundPollTransientFailureCount = 0, !0;
|
|
700
700
|
} catch (e) {
|
|
701
701
|
const n = e, i = Wt(n.response?.status);
|
|
702
|
-
return i === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() +
|
|
702
|
+
return i === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() + ls(n.response?.headers?.["retry-after"]), !1) : (this.backgroundPollTransientFailureCount += 1, i === void 0 || us(i) ? (this.backgroundPollRetryAfterUntil = Date.now() + eo(this.backgroundPollTransientFailureCount), !1) : (this.backgroundPollRetryAfterUntil = Date.now() + Xt, !1));
|
|
703
703
|
}
|
|
704
704
|
},
|
|
705
705
|
async fetchConversation(e) {
|
|
@@ -755,21 +755,21 @@ const Gt = _i("messaging", {
|
|
|
755
755
|
try {
|
|
756
756
|
c = await W().get(`/v1/messaging/conversations/${e}/messages`, { params: i });
|
|
757
757
|
break;
|
|
758
|
-
} catch (
|
|
759
|
-
if (!(o < Yi && Pn(
|
|
760
|
-
throw
|
|
761
|
-
o += 1, await Mn(to(
|
|
758
|
+
} catch (y) {
|
|
759
|
+
if (!(o < Yi && Pn(y)))
|
|
760
|
+
throw y;
|
|
761
|
+
o += 1, await Mn(to(y));
|
|
762
762
|
}
|
|
763
763
|
const { items: l, nextCursor: d } = rt(
|
|
764
764
|
c.data,
|
|
765
765
|
"messages"
|
|
766
766
|
), g = l.map(at), h = [...g].reverse();
|
|
767
767
|
if (n ? this.messages[e] = [...h, ...this.messages[e] || []] : this.messages[e] = h, (() => {
|
|
768
|
-
const
|
|
769
|
-
return
|
|
768
|
+
const y = this.conversations.find((C) => C.id === e) ?? this.requests.find((C) => C.id === e);
|
|
769
|
+
return y ? !y.last_message || !y.last_message_at : !1;
|
|
770
770
|
})()) {
|
|
771
|
-
const
|
|
772
|
-
|
|
771
|
+
const y = this.messages[e]?.at(-1);
|
|
772
|
+
y && this.updateConversationLastMessage(e, y);
|
|
773
773
|
}
|
|
774
774
|
d ? (this.conversationCursors[e] = d, this.conversationHasMore[e] = !0) : (delete this.conversationCursors[e], this.conversationHasMore[e] = !1);
|
|
775
775
|
const M = {
|
|
@@ -784,10 +784,10 @@ const Gt = _i("messaging", {
|
|
|
784
784
|
}
|
|
785
785
|
},
|
|
786
786
|
async sendMessage(e, n, i, o, c, l, d) {
|
|
787
|
-
const g = Fe()(), h = `temp-${Date.now()}-${Math.random()}`, x = typeof l == "string" && l.trim().length > 0 ? l.trim() : null, M = co(d),
|
|
787
|
+
const g = Fe()(), h = `temp-${Date.now()}-${Math.random()}`, x = typeof l == "string" && l.trim().length > 0 ? l.trim() : null, M = co(d), y = g.currentUser, C = {
|
|
788
788
|
id: h,
|
|
789
789
|
conversation_id: e,
|
|
790
|
-
author_id:
|
|
790
|
+
author_id: y?.id || "",
|
|
791
791
|
body: n || "",
|
|
792
792
|
attachments: [],
|
|
793
793
|
meta: x ? { shared_post_id: x } : {},
|
|
@@ -796,14 +796,14 @@ const Gt = _i("messaging", {
|
|
|
796
796
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
797
797
|
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
798
798
|
};
|
|
799
|
-
|
|
800
|
-
id:
|
|
801
|
-
name:
|
|
802
|
-
...
|
|
803
|
-
...
|
|
799
|
+
y && (C.author = {
|
|
800
|
+
id: y.id,
|
|
801
|
+
name: y.name,
|
|
802
|
+
...y.avatar ? { avatar: y.avatar } : {},
|
|
803
|
+
...y.handle ? { handle: y.handle } : {}
|
|
804
804
|
}), o != null && (C.reply_to_id = o), c != null && (C.reply_to = c), this.messages[e] || (this.messages[e] = []), this.messages[e].push(C), this._pendingSendIds.add(h);
|
|
805
805
|
try {
|
|
806
|
-
let
|
|
806
|
+
let b;
|
|
807
807
|
const T = {
|
|
808
808
|
body: n || "",
|
|
809
809
|
...o ? { reply_to_id: o } : {},
|
|
@@ -812,8 +812,8 @@ const Gt = _i("messaging", {
|
|
|
812
812
|
};
|
|
813
813
|
if (i && i.length > 0) {
|
|
814
814
|
const k = await Promise.all(
|
|
815
|
-
i.map(async (
|
|
816
|
-
const H = await Vi().uploadImage(
|
|
815
|
+
i.map(async (U) => {
|
|
816
|
+
const H = await Vi().uploadImage(U);
|
|
817
817
|
return {
|
|
818
818
|
media_id: H.id,
|
|
819
819
|
mime: H.mime_type,
|
|
@@ -821,26 +821,26 @@ const Gt = _i("messaging", {
|
|
|
821
821
|
};
|
|
822
822
|
})
|
|
823
823
|
);
|
|
824
|
-
|
|
824
|
+
b = await W().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
825
825
|
...T,
|
|
826
826
|
attachments: k
|
|
827
827
|
});
|
|
828
828
|
} else
|
|
829
|
-
|
|
829
|
+
b = await W().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
830
830
|
...T,
|
|
831
831
|
type: "text"
|
|
832
832
|
});
|
|
833
|
-
const w =
|
|
834
|
-
N >= 0 && (
|
|
833
|
+
const w = b.data.data || b.data, f = { ...C, ...w, attachments: w.attachments ?? C.attachments }, m = at(f), v = this.messages[e], N = v.findIndex((k) => k.id === h);
|
|
834
|
+
N >= 0 && (v[N] = m), this._pendingSendIds.delete(h);
|
|
835
835
|
const q = m.id;
|
|
836
836
|
let G = 0;
|
|
837
|
-
for (let k =
|
|
838
|
-
const
|
|
839
|
-
|
|
837
|
+
for (let k = v.length - 1; k >= 0; k--) {
|
|
838
|
+
const U = v[k];
|
|
839
|
+
U && U.id === q && (G++, G > 1 && v.splice(k, 1));
|
|
840
840
|
}
|
|
841
841
|
return this.updateConversationLastMessage(e, m), m;
|
|
842
|
-
} catch (
|
|
843
|
-
throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((T) => T.id !== h), this.error = Z(
|
|
842
|
+
} catch (b) {
|
|
843
|
+
throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((T) => T.id !== h), this.error = Z(b), b;
|
|
844
844
|
}
|
|
845
845
|
},
|
|
846
846
|
async editMessage(e, n, i) {
|
|
@@ -1003,7 +1003,7 @@ const Gt = _i("messaging", {
|
|
|
1003
1003
|
};
|
|
1004
1004
|
n && (i.message = n);
|
|
1005
1005
|
const o = await W().post("/v1/messaging/conversations/dm", i), c = o.data.data || o.data;
|
|
1006
|
-
if (!
|
|
1006
|
+
if (!Un(c))
|
|
1007
1007
|
throw new Error("Invalid conversation payload from DM create endpoint.");
|
|
1008
1008
|
const l = Fn(c) ? He(c) : await this.fetchConversation(c.id);
|
|
1009
1009
|
return l.is_request === !0 ? (this.requests = it(this.requests, l), this.conversations = this.conversations.filter((d) => d.id !== l.id), l) : (this.conversations = it(this.conversations, l), this.requests = this.requests.filter((d) => d.id !== l.id), l);
|
|
@@ -1017,7 +1017,7 @@ const Gt = _i("messaging", {
|
|
|
1017
1017
|
title: e,
|
|
1018
1018
|
participant_ids: n
|
|
1019
1019
|
}), o = i.data.data || i.data;
|
|
1020
|
-
if (!
|
|
1020
|
+
if (!Un(o))
|
|
1021
1021
|
throw new Error("Invalid conversation payload from group create endpoint.");
|
|
1022
1022
|
const c = Fn(o) ? o : await this.fetchConversation(o.id);
|
|
1023
1023
|
return this.conversations = it(this.conversations, c), c;
|
|
@@ -1126,20 +1126,20 @@ const Gt = _i("messaging", {
|
|
|
1126
1126
|
let g;
|
|
1127
1127
|
try {
|
|
1128
1128
|
g = await W().post(o, c);
|
|
1129
|
-
} catch (
|
|
1130
|
-
if (!po(
|
|
1131
|
-
throw
|
|
1129
|
+
} catch (y) {
|
|
1130
|
+
if (!po(y))
|
|
1131
|
+
throw y;
|
|
1132
1132
|
g = await W().post(o, c);
|
|
1133
1133
|
}
|
|
1134
|
-
const h = he(g.data) && "data" in g.data ? g.data.data : g.data, x =
|
|
1134
|
+
const h = he(g.data) && "data" in g.data ? g.data.data : g.data, x = On(
|
|
1135
1135
|
he(h) ? h.reactions : void 0
|
|
1136
1136
|
);
|
|
1137
1137
|
(x.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, x);
|
|
1138
1138
|
try {
|
|
1139
|
-
const
|
|
1139
|
+
const y = await W().get(o), C = he(y.data) && "data" in y.data ? y.data.data : y.data, b = On(
|
|
1140
1140
|
he(C) ? C.reactions : void 0
|
|
1141
1141
|
);
|
|
1142
|
-
this.updateMessageReactions(e, n,
|
|
1142
|
+
this.updateMessageReactions(e, n, b);
|
|
1143
1143
|
} catch {
|
|
1144
1144
|
}
|
|
1145
1145
|
} catch (g) {
|
|
@@ -1158,7 +1158,8 @@ const Gt = _i("messaging", {
|
|
|
1158
1158
|
}
|
|
1159
1159
|
},
|
|
1160
1160
|
addTypingUser(e, n) {
|
|
1161
|
-
|
|
1161
|
+
const i = this.typingUsers[e] ?? [];
|
|
1162
|
+
i.find((c) => c.id === n.id) || (this.typingUsers[e] = [...i, n]);
|
|
1162
1163
|
},
|
|
1163
1164
|
removeTypingUser(e, n) {
|
|
1164
1165
|
this.typingUsers[e] && (this.typingUsers[e] = this.typingUsers[e].filter((i) => i.id !== n));
|
|
@@ -1177,7 +1178,7 @@ const Gt = _i("messaging", {
|
|
|
1177
1178
|
},
|
|
1178
1179
|
async acceptRequest(e) {
|
|
1179
1180
|
try {
|
|
1180
|
-
const n = await
|
|
1181
|
+
const n = await Pe.acceptRequest(e);
|
|
1181
1182
|
this.requests = this.requests.filter((o) => o.id !== e);
|
|
1182
1183
|
const i = He({
|
|
1183
1184
|
...n,
|
|
@@ -1192,7 +1193,7 @@ const Gt = _i("messaging", {
|
|
|
1192
1193
|
},
|
|
1193
1194
|
async declineRequest(e) {
|
|
1194
1195
|
try {
|
|
1195
|
-
await
|
|
1196
|
+
await Pe.declineRequest(e), this.requests = this.requests.filter((n) => n.id !== e);
|
|
1196
1197
|
} catch (n) {
|
|
1197
1198
|
throw this.error = Z(n), n;
|
|
1198
1199
|
}
|
|
@@ -1265,79 +1266,79 @@ const Gt = _i("messaging", {
|
|
|
1265
1266
|
});
|
|
1266
1267
|
function Ya(e) {
|
|
1267
1268
|
const n = Gt(), i = Fe()(), o = ve(!1), c = ve(null), l = ve(null), d = zt(), g = d !== null, h = 20, x = 250;
|
|
1268
|
-
let M = 0,
|
|
1269
|
-
const
|
|
1269
|
+
let M = 0, y = null, C = null;
|
|
1270
|
+
const b = ie(() => i.currentUser?.id), T = () => Xn(e)?.trim() ?? "";
|
|
1270
1271
|
function w() {
|
|
1271
|
-
|
|
1272
|
+
y && (clearTimeout(y), y = null), M = 0;
|
|
1272
1273
|
}
|
|
1273
1274
|
function f() {
|
|
1274
|
-
!g || o.value ||
|
|
1275
|
-
|
|
1275
|
+
!g || o.value || y || M >= h || (y = setTimeout(() => {
|
|
1276
|
+
y = null, M += 1, F();
|
|
1276
1277
|
}, x));
|
|
1277
1278
|
}
|
|
1278
|
-
function m(
|
|
1279
|
-
if (n.addMessage(
|
|
1280
|
-
const I = n.getConversationById(
|
|
1281
|
-
I && (I.unread_count = 0), n.markAsRead(
|
|
1279
|
+
function m(_) {
|
|
1280
|
+
if (n.addMessage(_.message), _.message.author_id !== b.value) {
|
|
1281
|
+
const I = n.getConversationById(_.conversation_id);
|
|
1282
|
+
I && (I.unread_count = 0), n.markAsRead(_.conversation_id).catch(() => {
|
|
1282
1283
|
});
|
|
1283
1284
|
}
|
|
1284
1285
|
}
|
|
1285
|
-
function
|
|
1286
|
-
n.applyParticipantReadState(
|
|
1286
|
+
function v(_) {
|
|
1287
|
+
n.applyParticipantReadState(_);
|
|
1287
1288
|
}
|
|
1288
|
-
function N(
|
|
1289
|
-
const I = n.getMessagesByConversationId(
|
|
1289
|
+
function N(_) {
|
|
1290
|
+
const I = n.getMessagesByConversationId(_.conversation_id), ae = I.findIndex((B) => B.id === _.message.id);
|
|
1290
1291
|
if (ae >= 0) {
|
|
1291
1292
|
const B = I[ae];
|
|
1292
1293
|
if (!B) return;
|
|
1293
1294
|
const E = { ...B };
|
|
1294
|
-
|
|
1295
|
-
const V = n.getConversationById(
|
|
1296
|
-
V && V.last_message?.id ===
|
|
1295
|
+
_.message.body !== void 0 && (E.body = _.message.body), _.message.edited_at !== void 0 && (E.edited_at = _.message.edited_at), _.message.meta !== void 0 && (E.meta = _.message.meta), I[ae] = E;
|
|
1296
|
+
const V = n.getConversationById(_.conversation_id);
|
|
1297
|
+
V && V.last_message?.id === _.message.id && (V.last_message = E);
|
|
1297
1298
|
}
|
|
1298
1299
|
}
|
|
1299
|
-
function q(
|
|
1300
|
-
n.removeMessage(
|
|
1300
|
+
function q(_) {
|
|
1301
|
+
n.removeMessage(_.conversation_id, _.message_id);
|
|
1301
1302
|
}
|
|
1302
|
-
function G(
|
|
1303
|
+
function G(_) {
|
|
1303
1304
|
n.updateMessageReactions(
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1305
|
+
_.conversation_id,
|
|
1306
|
+
_.message_id,
|
|
1307
|
+
_.reactions
|
|
1307
1308
|
);
|
|
1308
1309
|
}
|
|
1309
|
-
function k(
|
|
1310
|
-
const I = n.getConversationById(
|
|
1310
|
+
function k(_) {
|
|
1311
|
+
const I = n.getConversationById(_.conversation_id);
|
|
1311
1312
|
I && (I.is_request = !1), n.requests = n.requests.filter(
|
|
1312
|
-
(ae) => ae.id !==
|
|
1313
|
+
(ae) => ae.id !== _.conversation_id
|
|
1313
1314
|
);
|
|
1314
1315
|
}
|
|
1315
|
-
function
|
|
1316
|
-
|
|
1316
|
+
function U(_) {
|
|
1317
|
+
_.removed_user_id === b.value && (te(), n.deleteConversation(_.conversation_id).catch(() => {
|
|
1317
1318
|
}));
|
|
1318
1319
|
}
|
|
1319
|
-
function H(
|
|
1320
|
+
function H(_) {
|
|
1320
1321
|
const I = l.value;
|
|
1321
|
-
C && (C(), C = null), I && (
|
|
1322
|
+
C && (C(), C = null), I && (_ && !n.hasGlobalConversationSubscription(I) && xi(I), n.unregisterDetailSubscription(I), l.value = null), o.value = !1;
|
|
1322
1323
|
}
|
|
1323
1324
|
function F() {
|
|
1324
|
-
const
|
|
1325
|
-
if (!(o.value || !
|
|
1326
|
-
if (!
|
|
1325
|
+
const _ = T();
|
|
1326
|
+
if (!(o.value || !_)) {
|
|
1327
|
+
if (!Ae()) {
|
|
1327
1328
|
f();
|
|
1328
1329
|
return;
|
|
1329
1330
|
}
|
|
1330
1331
|
c.value = null;
|
|
1331
1332
|
try {
|
|
1332
|
-
C = Mi(
|
|
1333
|
+
C = Mi(_, {
|
|
1333
1334
|
onMessageSent: m,
|
|
1334
|
-
onMessageRead:
|
|
1335
|
+
onMessageRead: v,
|
|
1335
1336
|
onMessageEdited: N,
|
|
1336
1337
|
onMessageDeleted: q,
|
|
1337
1338
|
onReactionToggled: G,
|
|
1338
1339
|
onRequestAccepted: k,
|
|
1339
|
-
onParticipantRemoved:
|
|
1340
|
-
}), o.value = !0, l.value =
|
|
1340
|
+
onParticipantRemoved: U
|
|
1341
|
+
}), o.value = !0, l.value = _, n.registerDetailSubscription(_), w();
|
|
1341
1342
|
} catch (I) {
|
|
1342
1343
|
c.value = I instanceof Error ? I.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", I);
|
|
1343
1344
|
}
|
|
@@ -1347,26 +1348,26 @@ function Ya(e) {
|
|
|
1347
1348
|
o.value || F();
|
|
1348
1349
|
}
|
|
1349
1350
|
typeof window < "u" && window.addEventListener(We(), J);
|
|
1350
|
-
const me = ht((
|
|
1351
|
-
if (
|
|
1351
|
+
const me = ht((_) => {
|
|
1352
|
+
if (_ === "connected") {
|
|
1352
1353
|
o.value || F();
|
|
1353
1354
|
return;
|
|
1354
1355
|
}
|
|
1355
|
-
(
|
|
1356
|
+
(_ === "disconnected" || _ === "error") && (w(), H(!1));
|
|
1356
1357
|
});
|
|
1357
1358
|
function te() {
|
|
1358
1359
|
if (w(), !(!o.value || !l.value))
|
|
1359
1360
|
try {
|
|
1360
1361
|
H(!0), c.value = null;
|
|
1361
|
-
} catch (
|
|
1362
|
-
c.value =
|
|
1362
|
+
} catch (_) {
|
|
1363
|
+
c.value = _ instanceof Error ? _.message : "Failed to unsubscribe from conversation", console.error("ConversationChannel: Unsubscribe error", _);
|
|
1363
1364
|
}
|
|
1364
1365
|
}
|
|
1365
|
-
return
|
|
1366
|
+
return Ut(
|
|
1366
1367
|
() => T(),
|
|
1367
|
-
(
|
|
1368
|
-
if (
|
|
1369
|
-
if (w(), o.value && H(!0), !
|
|
1368
|
+
(_, I) => {
|
|
1369
|
+
if (_ !== I) {
|
|
1370
|
+
if (w(), o.value && H(!0), !_) {
|
|
1370
1371
|
c.value = null;
|
|
1371
1372
|
return;
|
|
1372
1373
|
}
|
|
@@ -1382,14 +1383,14 @@ function Ya(e) {
|
|
|
1382
1383
|
unsubscribe: te
|
|
1383
1384
|
};
|
|
1384
1385
|
}
|
|
1385
|
-
const
|
|
1386
|
-
},
|
|
1386
|
+
const ds = () => () => {
|
|
1387
|
+
}, hs = async () => {
|
|
1387
1388
|
}, be = {
|
|
1388
1389
|
initializedEvent: "messenger-client:main-echo-initialized",
|
|
1389
1390
|
getEcho: () => null,
|
|
1390
1391
|
getConnectionStatus: () => "disconnected",
|
|
1391
|
-
onConnectionStatusChange:
|
|
1392
|
-
reconnect:
|
|
1392
|
+
onConnectionStatusChange: ds,
|
|
1393
|
+
reconnect: hs
|
|
1393
1394
|
};
|
|
1394
1395
|
function bo() {
|
|
1395
1396
|
return be.initializedEvent;
|
|
@@ -1410,7 +1411,7 @@ function wo(e) {
|
|
|
1410
1411
|
e.initializedEvent && (be.initializedEvent = e.initializedEvent), e.getEcho && (be.getEcho = e.getEcho), e.getConnectionStatus && (be.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (be.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (be.reconnect = e.reconnect);
|
|
1411
1412
|
}
|
|
1412
1413
|
function To() {
|
|
1413
|
-
be.initializedEvent = "messenger-client:main-echo-initialized", be.getEcho = () => null, be.getConnectionStatus = () => "disconnected", be.onConnectionStatusChange =
|
|
1414
|
+
be.initializedEvent = "messenger-client:main-echo-initialized", be.getEcho = () => null, be.getConnectionStatus = () => "disconnected", be.onConnectionStatusChange = ds, be.reconnect = hs;
|
|
1414
1415
|
}
|
|
1415
1416
|
const Eo = {
|
|
1416
1417
|
debug: () => {
|
|
@@ -1421,8 +1422,8 @@ const Eo = {
|
|
|
1421
1422
|
},
|
|
1422
1423
|
error: () => {
|
|
1423
1424
|
}
|
|
1424
|
-
},
|
|
1425
|
-
let Jt =
|
|
1425
|
+
}, fs = () => Eo;
|
|
1426
|
+
let Jt = fs;
|
|
1426
1427
|
function Kt() {
|
|
1427
1428
|
return Jt;
|
|
1428
1429
|
}
|
|
@@ -1430,7 +1431,7 @@ function Ao(e) {
|
|
|
1430
1431
|
Jt = e;
|
|
1431
1432
|
}
|
|
1432
1433
|
function Ro() {
|
|
1433
|
-
Jt =
|
|
1434
|
+
Jt = fs;
|
|
1434
1435
|
}
|
|
1435
1436
|
const Po = {
|
|
1436
1437
|
connected: "",
|
|
@@ -1445,10 +1446,10 @@ function zn(e) {
|
|
|
1445
1446
|
function Mo(e) {
|
|
1446
1447
|
return e === "messenger" ? {
|
|
1447
1448
|
initializedEvent: We(),
|
|
1448
|
-
getConnectionStatus:
|
|
1449
|
+
getConnectionStatus: rs,
|
|
1449
1450
|
onConnectionStatusChange: ht,
|
|
1450
1451
|
reconnect: Ai,
|
|
1451
|
-
getEchoConnection: () => zn(
|
|
1452
|
+
getEchoConnection: () => zn(Ae())
|
|
1452
1453
|
} : {
|
|
1453
1454
|
initializedEvent: bo(),
|
|
1454
1455
|
getConnectionStatus: _o,
|
|
@@ -1464,9 +1465,9 @@ function Za(e = {}) {
|
|
|
1464
1465
|
const o = Mo(e.source ?? "app"), c = {
|
|
1465
1466
|
...Po,
|
|
1466
1467
|
...e.icons
|
|
1467
|
-
}, l = ve(o.getConnectionStatus()), d = ve(null), g = ve(0), h = ve(!1), x = ve(!1), M = ve(!1),
|
|
1468
|
-
let C = null,
|
|
1469
|
-
const N = ie(() => l.value === "connected"), q = ie(() => l.value === "connecting"), G = ie(() => l.value === "disconnected"), k = ie(() => l.value === "error"),
|
|
1468
|
+
}, l = ve(o.getConnectionStatus()), d = ve(null), g = ve(0), h = ve(!1), x = ve(!1), M = ve(!1), y = ve(!1);
|
|
1469
|
+
let C = null, b = null, T = null, w = null, f = null, m = null, v = null;
|
|
1470
|
+
const N = ie(() => l.value === "connected"), q = ie(() => l.value === "connecting"), G = ie(() => l.value === "disconnected"), k = ie(() => l.value === "error"), U = ie(() => G.value || k.value), H = ie(() => {
|
|
1470
1471
|
switch (l.value) {
|
|
1471
1472
|
case "connecting":
|
|
1472
1473
|
return g.value > 0 ? "Reconnecting..." : "Connecting...";
|
|
@@ -1507,8 +1508,8 @@ function Za(e = {}) {
|
|
|
1507
1508
|
}), me = async () => {
|
|
1508
1509
|
qn.debug("Manual reconnect triggered"), g.value += 1, await o.reconnect();
|
|
1509
1510
|
}, te = (E, V = l.value) => {
|
|
1510
|
-
if (E !== "connecting" &&
|
|
1511
|
-
const ne = !
|
|
1511
|
+
if (E !== "connecting" && b && (clearTimeout(b), b = null), E === "disconnected" || E === "error") {
|
|
1512
|
+
const ne = !y.value && V === E, _e = !x.value && (ne || V === "connected" || V === "connecting");
|
|
1512
1513
|
if (M.value = !0, _e) {
|
|
1513
1514
|
h.value = !1, T && clearTimeout(T), T = setTimeout(() => {
|
|
1514
1515
|
T = null, l.value !== "connected" && (h.value = !0);
|
|
@@ -1527,19 +1528,19 @@ function Za(e = {}) {
|
|
|
1527
1528
|
h.value = !0;
|
|
1528
1529
|
return;
|
|
1529
1530
|
}
|
|
1530
|
-
if (M.value || (h.value = !1),
|
|
1531
|
+
if (M.value || (h.value = !1), b)
|
|
1531
1532
|
return;
|
|
1532
|
-
|
|
1533
|
-
if (
|
|
1533
|
+
b = setTimeout(() => {
|
|
1534
|
+
if (b = null, l.value === "connecting") {
|
|
1534
1535
|
if (jn(o) === "connected") {
|
|
1535
|
-
|
|
1536
|
+
_("connected");
|
|
1536
1537
|
return;
|
|
1537
1538
|
}
|
|
1538
|
-
x.value = !0, qn.warn("Still connecting after 10s, treating as disconnected"),
|
|
1539
|
+
x.value = !0, qn.warn("Still connecting after 10s, treating as disconnected"), _("disconnected"), g.value += 1, o.reconnect();
|
|
1539
1540
|
}
|
|
1540
1541
|
}, 1e4);
|
|
1541
1542
|
}
|
|
1542
|
-
},
|
|
1543
|
+
}, _ = (E) => {
|
|
1543
1544
|
const V = l.value;
|
|
1544
1545
|
if (E === "connecting" && x.value) {
|
|
1545
1546
|
l.value = "disconnected", te("disconnected", V);
|
|
@@ -1549,51 +1550,51 @@ function Za(e = {}) {
|
|
|
1549
1550
|
}, I = () => {
|
|
1550
1551
|
const E = jn(o), V = l.value;
|
|
1551
1552
|
if (E === "connected" && V !== "connected") {
|
|
1552
|
-
|
|
1553
|
+
_("connected");
|
|
1553
1554
|
return;
|
|
1554
1555
|
}
|
|
1555
1556
|
if (E === "connecting" && V !== "connecting") {
|
|
1556
|
-
|
|
1557
|
+
_("connecting");
|
|
1557
1558
|
return;
|
|
1558
1559
|
}
|
|
1559
1560
|
if ((E === "unavailable" || E === "failed" || E === "disconnected") && V !== "disconnected") {
|
|
1560
|
-
|
|
1561
|
+
_("disconnected");
|
|
1561
1562
|
return;
|
|
1562
1563
|
}
|
|
1563
1564
|
const ne = o.getConnectionStatus();
|
|
1564
|
-
!E && ne === "connected" && V !== "connected" &&
|
|
1565
|
+
!E && ne === "connected" && V !== "connected" && _("connected");
|
|
1565
1566
|
}, ae = () => {
|
|
1566
|
-
if (f?.unbind &&
|
|
1567
|
+
if (f?.unbind && v && (f.unbind("connected", v.connected), f.unbind("connecting", v.connecting), f.unbind("disconnected", v.disconnected), f.unbind("unavailable", v.unavailable), f.unbind("error", v.error), f.unbind("state_change", v.stateChange)), f = o.getEchoConnection(), v = null, !f?.bind)
|
|
1567
1568
|
return;
|
|
1568
|
-
|
|
1569
|
-
connected: () =>
|
|
1570
|
-
connecting: () =>
|
|
1571
|
-
disconnected: () =>
|
|
1572
|
-
unavailable: () =>
|
|
1573
|
-
error: () =>
|
|
1569
|
+
v = {
|
|
1570
|
+
connected: () => _("connected"),
|
|
1571
|
+
connecting: () => _("connecting"),
|
|
1572
|
+
disconnected: () => _("disconnected"),
|
|
1573
|
+
unavailable: () => _("disconnected"),
|
|
1574
|
+
error: () => _("error"),
|
|
1574
1575
|
stateChange: (V) => {
|
|
1575
1576
|
const ne = V?.current;
|
|
1576
1577
|
if (ne === "connected") {
|
|
1577
|
-
|
|
1578
|
+
_("connected");
|
|
1578
1579
|
return;
|
|
1579
1580
|
}
|
|
1580
1581
|
if (ne === "connecting") {
|
|
1581
|
-
|
|
1582
|
+
_("connecting");
|
|
1582
1583
|
return;
|
|
1583
1584
|
}
|
|
1584
|
-
(ne === "unavailable" || ne === "failed" || ne === "disconnected") &&
|
|
1585
|
+
(ne === "unavailable" || ne === "failed" || ne === "disconnected") && _("disconnected");
|
|
1585
1586
|
}
|
|
1586
|
-
}, f.bind("connected",
|
|
1587
|
+
}, f.bind("connected", v.connected), f.bind("connecting", v.connecting), f.bind("disconnected", v.disconnected), f.bind("unavailable", v.unavailable), f.bind("error", v.error), f.bind("state_change", v.stateChange);
|
|
1587
1588
|
const E = f.state ?? null;
|
|
1588
1589
|
if (E === "connected") {
|
|
1589
|
-
|
|
1590
|
+
_("connected");
|
|
1590
1591
|
return;
|
|
1591
1592
|
}
|
|
1592
1593
|
if (E === "connecting") {
|
|
1593
|
-
|
|
1594
|
+
_("connecting");
|
|
1594
1595
|
return;
|
|
1595
1596
|
}
|
|
1596
|
-
(E === "unavailable" || E === "failed" || E === "disconnected") &&
|
|
1597
|
+
(E === "unavailable" || E === "failed" || E === "disconnected") && _("disconnected");
|
|
1597
1598
|
}, B = ie(() => {
|
|
1598
1599
|
if (!d.value || !N.value)
|
|
1599
1600
|
return null;
|
|
@@ -1601,20 +1602,20 @@ function Za(e = {}) {
|
|
|
1601
1602
|
return V > 0 ? `${V}m ${ne}s` : `${ne}s`;
|
|
1602
1603
|
});
|
|
1603
1604
|
return jt(() => {
|
|
1604
|
-
l.value = o.getConnectionStatus(), C = o.onConnectionStatusChange(
|
|
1605
|
+
l.value = o.getConnectionStatus(), C = o.onConnectionStatusChange(_), N.value && (d.value = /* @__PURE__ */ new Date()), te(l.value, l.value), y.value = !0, ae(), m = () => {
|
|
1605
1606
|
ae(), I();
|
|
1606
1607
|
}, window.addEventListener(o.initializedEvent, m), I(), w = setInterval(() => {
|
|
1607
1608
|
I();
|
|
1608
1609
|
}, 3e3);
|
|
1609
1610
|
}), De(() => {
|
|
1610
|
-
C?.(),
|
|
1611
|
+
C?.(), b && (clearTimeout(b), b = null), T && (clearTimeout(T), T = null), w && (clearInterval(w), w = null), m && (window.removeEventListener(o.initializedEvent, m), m = null), f?.unbind && v && (f.unbind("connected", v.connected), f.unbind("connecting", v.connecting), f.unbind("disconnected", v.disconnected), f.unbind("unavailable", v.unavailable), f.unbind("error", v.error), f.unbind("state_change", v.stateChange)), f = null, v = null;
|
|
1611
1612
|
}), {
|
|
1612
1613
|
connectionStatus: ie(() => l.value),
|
|
1613
1614
|
isConnected: N,
|
|
1614
1615
|
isConnecting: q,
|
|
1615
1616
|
isDisconnected: G,
|
|
1616
1617
|
isError: k,
|
|
1617
|
-
hasConnectionIssues:
|
|
1618
|
+
hasConnectionIssues: U,
|
|
1618
1619
|
statusMessage: H,
|
|
1619
1620
|
statusColor: F,
|
|
1620
1621
|
statusIcon: J,
|
|
@@ -1625,41 +1626,41 @@ function Za(e = {}) {
|
|
|
1625
1626
|
reconnect: me
|
|
1626
1627
|
};
|
|
1627
1628
|
}
|
|
1628
|
-
const
|
|
1629
|
-
let Qt =
|
|
1630
|
-
function
|
|
1629
|
+
const ps = $t;
|
|
1630
|
+
let Qt = ps;
|
|
1631
|
+
function gs() {
|
|
1631
1632
|
return Qt;
|
|
1632
1633
|
}
|
|
1633
1634
|
function xo(e) {
|
|
1634
1635
|
Qt = e;
|
|
1635
1636
|
}
|
|
1636
1637
|
function ko() {
|
|
1637
|
-
Qt =
|
|
1638
|
+
Qt = ps;
|
|
1638
1639
|
}
|
|
1639
1640
|
const Lo = 6e4;
|
|
1640
1641
|
function Io(e) {
|
|
1641
1642
|
return e === "online" || e === "idle" || e === "dnd" || e === "offline";
|
|
1642
1643
|
}
|
|
1643
|
-
function
|
|
1644
|
+
function Oo(e) {
|
|
1644
1645
|
if (typeof e != "string")
|
|
1645
1646
|
return null;
|
|
1646
1647
|
const n = e.trim().toLowerCase();
|
|
1647
1648
|
return Io(n) ? n : null;
|
|
1648
1649
|
}
|
|
1649
|
-
function
|
|
1650
|
+
function ms(e) {
|
|
1650
1651
|
if (typeof e != "string")
|
|
1651
1652
|
return null;
|
|
1652
1653
|
const n = e.trim();
|
|
1653
1654
|
return n.length > 0 ? n : null;
|
|
1654
1655
|
}
|
|
1655
1656
|
function qt(e) {
|
|
1656
|
-
const n =
|
|
1657
|
+
const n = ms(e);
|
|
1657
1658
|
if (n === null)
|
|
1658
1659
|
return null;
|
|
1659
1660
|
const i = n.includes("T") ? n : n.replace(" ", "T"), o = /(?:Z|[+-]\d{2}:\d{2})$/i.test(i) ? i : `${i}Z`, c = new Date(o);
|
|
1660
1661
|
return Number.isNaN(c.getTime()) ? null : c;
|
|
1661
1662
|
}
|
|
1662
|
-
function
|
|
1663
|
+
function Uo(e, n, i = {}) {
|
|
1663
1664
|
if (e === null)
|
|
1664
1665
|
return null;
|
|
1665
1666
|
if (e === "offline")
|
|
@@ -1671,15 +1672,15 @@ function Oo(e, n, i = {}) {
|
|
|
1671
1672
|
return c - o.getTime() > l ? "offline" : e;
|
|
1672
1673
|
}
|
|
1673
1674
|
function $n(e, n = {}) {
|
|
1674
|
-
const i =
|
|
1675
|
+
const i = ms(e?.last_seen_at), o = Oo(e?.status);
|
|
1675
1676
|
return {
|
|
1676
|
-
status:
|
|
1677
|
+
status: Uo(o, i, n),
|
|
1677
1678
|
lastSeenAt: i
|
|
1678
1679
|
};
|
|
1679
1680
|
}
|
|
1680
|
-
const
|
|
1681
|
+
const vs = () => {
|
|
1681
1682
|
};
|
|
1682
|
-
let Yt =
|
|
1683
|
+
let Yt = vs;
|
|
1683
1684
|
function Fo() {
|
|
1684
1685
|
return Yt;
|
|
1685
1686
|
}
|
|
@@ -1687,34 +1688,34 @@ function No(e) {
|
|
|
1687
1688
|
Yt = e;
|
|
1688
1689
|
}
|
|
1689
1690
|
function Do() {
|
|
1690
|
-
Yt =
|
|
1691
|
+
Yt = vs;
|
|
1691
1692
|
}
|
|
1692
|
-
const
|
|
1693
|
+
const Me = Kt()("GlobalMessaging"), qo = 3, zo = (e) => e.replace(/\/+$/, ""), jo = (e) => zo(window.location.pathname) === `/messages/${e}`, $o = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
1693
1694
|
function ec() {
|
|
1694
|
-
const e = Gt(), n = Fe()(), i = Fo(), o =
|
|
1695
|
+
const e = Gt(), n = Fe()(), i = Fo(), o = gs(), c = Ti(), l = zt(), { conversations: d } = Ci(e), g = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map();
|
|
1695
1696
|
let x = !1;
|
|
1696
1697
|
function M(k) {
|
|
1697
|
-
const
|
|
1698
|
-
if (
|
|
1699
|
-
for (const H of
|
|
1698
|
+
const U = h.get(k);
|
|
1699
|
+
if (U && (h.delete(k), typeof U.channel.stopListening == "function"))
|
|
1700
|
+
for (const H of U.bindings)
|
|
1700
1701
|
try {
|
|
1701
|
-
|
|
1702
|
+
U.channel.stopListening(H.event, H.handler);
|
|
1702
1703
|
} catch {
|
|
1703
1704
|
}
|
|
1704
1705
|
}
|
|
1705
|
-
function
|
|
1706
|
+
function y() {
|
|
1706
1707
|
for (const k of g)
|
|
1707
1708
|
M(k), e.unregisterGlobalConversationSubscription(k);
|
|
1708
1709
|
g.clear();
|
|
1709
1710
|
}
|
|
1710
1711
|
function C(k) {
|
|
1711
|
-
const
|
|
1712
|
-
if (!
|
|
1712
|
+
const U = Ae();
|
|
1713
|
+
if (!U || g.has(k)) return;
|
|
1713
1714
|
const H = `conversation.${k}`;
|
|
1714
1715
|
M(k);
|
|
1715
|
-
const F =
|
|
1716
|
-
if (!
|
|
1717
|
-
|
|
1716
|
+
const F = U.private(H), J = (B) => {
|
|
1717
|
+
if (!Ui(B)) {
|
|
1718
|
+
Me.warn("Dropping malformed ConversationMessageSent event", B);
|
|
1718
1719
|
return;
|
|
1719
1720
|
}
|
|
1720
1721
|
const E = B, V = n.currentUser?.id;
|
|
@@ -1722,40 +1723,40 @@ function ec() {
|
|
|
1722
1723
|
e.addMessage(E.message);
|
|
1723
1724
|
const ne = e.hasDetailSubscription(E.conversation_id), _e = jo(E.conversation_id);
|
|
1724
1725
|
if (ne || _e) {
|
|
1725
|
-
const
|
|
1726
|
-
|
|
1726
|
+
const O = e.getConversationById(E.conversation_id);
|
|
1727
|
+
O && (O.unread_count = 0), e.markAsRead(E.conversation_id).catch(() => {
|
|
1727
1728
|
});
|
|
1728
1729
|
return;
|
|
1729
1730
|
}
|
|
1730
1731
|
const A = e.getConversationById(E.conversation_id);
|
|
1731
1732
|
if (A) {
|
|
1732
|
-
const
|
|
1733
|
-
|
|
1733
|
+
const O = $o(A);
|
|
1734
|
+
O || A.unread_count++, i(O);
|
|
1734
1735
|
}
|
|
1735
1736
|
}, me = (B) => {
|
|
1736
1737
|
if (!Fi(B)) {
|
|
1737
|
-
|
|
1738
|
+
Me.warn("Dropping malformed ConversationMessageRead event", B);
|
|
1738
1739
|
return;
|
|
1739
1740
|
}
|
|
1740
1741
|
e.applyParticipantReadState(B);
|
|
1741
1742
|
}, te = (B) => {
|
|
1742
1743
|
if (!qi(B)) {
|
|
1743
|
-
|
|
1744
|
+
Me.warn("Dropping malformed MessageReactionToggled event", B);
|
|
1744
1745
|
return;
|
|
1745
1746
|
}
|
|
1746
1747
|
const E = B;
|
|
1747
1748
|
e.updateMessageReactions(E.conversation_id, E.message_id, E.reactions);
|
|
1748
|
-
},
|
|
1749
|
+
}, _ = (B) => {
|
|
1749
1750
|
if (!Ni(B)) {
|
|
1750
|
-
|
|
1751
|
+
Me.warn("Dropping malformed ConversationMessageEdited event", B);
|
|
1751
1752
|
return;
|
|
1752
1753
|
}
|
|
1753
1754
|
const E = B, V = e.getMessagesByConversationId(E.conversation_id), ne = V.findIndex((A) => A.id === E.message.id);
|
|
1754
1755
|
if (ne >= 0) {
|
|
1755
1756
|
const A = V[ne];
|
|
1756
1757
|
if (A) {
|
|
1757
|
-
const
|
|
1758
|
-
E.message.body !== void 0 && (
|
|
1758
|
+
const O = { ...A };
|
|
1759
|
+
E.message.body !== void 0 && (O.body = E.message.body), E.message.edited_at !== void 0 && (O.edited_at = E.message.edited_at), E.message.meta !== void 0 && (O.meta = E.message.meta), V[ne] = O;
|
|
1759
1760
|
}
|
|
1760
1761
|
}
|
|
1761
1762
|
const _e = e.getConversationById(E.conversation_id);
|
|
@@ -1765,14 +1766,14 @@ function ec() {
|
|
|
1765
1766
|
});
|
|
1766
1767
|
}, I = (B) => {
|
|
1767
1768
|
if (!Di(B)) {
|
|
1768
|
-
|
|
1769
|
+
Me.warn("Dropping malformed ConversationMessageDeleted event", B);
|
|
1769
1770
|
return;
|
|
1770
1771
|
}
|
|
1771
1772
|
const E = B;
|
|
1772
1773
|
e.removeMessage(E.conversation_id, E.message_id);
|
|
1773
1774
|
}, ae = (B) => {
|
|
1774
1775
|
if (!zi(B)) {
|
|
1775
|
-
|
|
1776
|
+
Me.warn("Dropping malformed ConversationRequestAccepted event", B);
|
|
1776
1777
|
return;
|
|
1777
1778
|
}
|
|
1778
1779
|
const E = B, V = e.getConversationById(E.conversation_id);
|
|
@@ -1780,38 +1781,38 @@ function ec() {
|
|
|
1780
1781
|
(ne) => ne.id !== E.conversation_id
|
|
1781
1782
|
);
|
|
1782
1783
|
};
|
|
1783
|
-
F.listen(".ConversationMessageSent", J), F.listen(".ConversationMessageRead", me), F.listen(".ConversationMessageEdited",
|
|
1784
|
+
F.listen(".ConversationMessageSent", J), F.listen(".ConversationMessageRead", me), F.listen(".ConversationMessageEdited", _), F.listen(".ConversationMessageDeleted", I), F.listen(".MessageReactionToggled", te), F.listen(".ConversationRequestAccepted", ae), h.set(k, {
|
|
1784
1785
|
channel: F,
|
|
1785
1786
|
bindings: [
|
|
1786
1787
|
{ event: ".ConversationMessageSent", handler: J },
|
|
1787
1788
|
{ event: ".ConversationMessageRead", handler: me },
|
|
1788
|
-
{ event: ".ConversationMessageEdited", handler:
|
|
1789
|
+
{ event: ".ConversationMessageEdited", handler: _ },
|
|
1789
1790
|
{ event: ".ConversationMessageDeleted", handler: I },
|
|
1790
1791
|
{ event: ".MessageReactionToggled", handler: te },
|
|
1791
1792
|
{ event: ".ConversationRequestAccepted", handler: ae }
|
|
1792
1793
|
]
|
|
1793
1794
|
}), g.add(k), e.registerGlobalConversationSubscription(k);
|
|
1794
1795
|
}
|
|
1795
|
-
function
|
|
1796
|
-
const k =
|
|
1796
|
+
function b() {
|
|
1797
|
+
const k = Ae();
|
|
1797
1798
|
if (!k) {
|
|
1798
|
-
|
|
1799
|
+
y();
|
|
1799
1800
|
return;
|
|
1800
1801
|
}
|
|
1801
|
-
for (const
|
|
1802
|
-
M(
|
|
1802
|
+
for (const U of g) {
|
|
1803
|
+
M(U);
|
|
1803
1804
|
try {
|
|
1804
|
-
k.leave(`conversation.${
|
|
1805
|
+
k.leave(`conversation.${U}`);
|
|
1805
1806
|
} catch {
|
|
1806
1807
|
}
|
|
1807
|
-
e.unregisterGlobalConversationSubscription(
|
|
1808
|
+
e.unregisterGlobalConversationSubscription(U);
|
|
1808
1809
|
}
|
|
1809
1810
|
g.clear();
|
|
1810
1811
|
}
|
|
1811
1812
|
function T() {
|
|
1812
|
-
const k =
|
|
1813
|
+
const k = Ae();
|
|
1813
1814
|
if (!k) return;
|
|
1814
|
-
const
|
|
1815
|
+
const U = e.conversations.slice(0, qo), H = new Set(U.map((F) => F.id));
|
|
1815
1816
|
for (const F of g)
|
|
1816
1817
|
if (!H.has(F) && !e.hasDetailSubscription(F)) {
|
|
1817
1818
|
try {
|
|
@@ -1820,59 +1821,63 @@ function ec() {
|
|
|
1820
1821
|
}
|
|
1821
1822
|
g.delete(F), e.unregisterGlobalConversationSubscription(F);
|
|
1822
1823
|
}
|
|
1823
|
-
for (const F of
|
|
1824
|
+
for (const F of U)
|
|
1824
1825
|
C(F.id);
|
|
1825
1826
|
}
|
|
1826
1827
|
function w(k) {
|
|
1827
|
-
const
|
|
1828
|
+
const U = $n({
|
|
1828
1829
|
status: k.status,
|
|
1829
1830
|
last_seen_at: k.last_seen_at ?? null
|
|
1830
1831
|
});
|
|
1831
|
-
|
|
1832
|
+
U.status !== null && e.updatePresenceForUser(
|
|
1832
1833
|
k.user_id,
|
|
1833
|
-
|
|
1834
|
-
|
|
1834
|
+
U.status,
|
|
1835
|
+
U.lastSeenAt
|
|
1835
1836
|
);
|
|
1836
1837
|
}
|
|
1837
1838
|
async function f() {
|
|
1838
1839
|
const k = [...new Set(
|
|
1839
|
-
e.conversations.filter((
|
|
1840
|
+
e.conversations.filter((U) => U.type === "dm" && typeof U.other_user_id == "string" && U.other_user_id.length > 0).map((U) => U.other_user_id)
|
|
1840
1841
|
)];
|
|
1841
1842
|
if (k.length !== 0)
|
|
1842
1843
|
try {
|
|
1843
|
-
const
|
|
1844
|
+
const U = await o.get("/v1/presence/users", {
|
|
1844
1845
|
params: { ids: k }
|
|
1845
|
-
}), H =
|
|
1846
|
+
}), H = U.data?.data?.items ?? U.data?.items ?? [];
|
|
1846
1847
|
for (const F of H) {
|
|
1847
1848
|
const J = $n(F);
|
|
1848
1849
|
J.status !== null && e.updatePresenceForUser(F.id, J.status, J.lastSeenAt);
|
|
1849
1850
|
}
|
|
1850
|
-
} catch (
|
|
1851
|
-
|
|
1851
|
+
} catch (U) {
|
|
1852
|
+
Me.warn("Failed to refresh messaging presence snapshot", U);
|
|
1852
1853
|
}
|
|
1853
1854
|
}
|
|
1854
1855
|
function m() {
|
|
1855
|
-
!
|
|
1856
|
+
!Ae() || x || (Ri(w), x = !0);
|
|
1856
1857
|
}
|
|
1857
|
-
function
|
|
1858
|
+
function v() {
|
|
1858
1859
|
x && (Pi(), x = !1);
|
|
1859
1860
|
}
|
|
1860
|
-
const N =
|
|
1861
|
+
const N = Ut(
|
|
1861
1862
|
d,
|
|
1862
1863
|
() => {
|
|
1863
1864
|
T();
|
|
1864
1865
|
},
|
|
1865
1866
|
{ deep: !1, immediate: !0 }
|
|
1866
|
-
), q =
|
|
1867
|
+
), q = Ut(
|
|
1867
1868
|
() => c.fullPath,
|
|
1868
1869
|
() => {
|
|
1869
1870
|
T();
|
|
1870
1871
|
}
|
|
1871
1872
|
), G = ht((k) => {
|
|
1872
|
-
k === "connected" ? (
|
|
1873
|
+
k === "connected" ? (y(), T(), v(), m(), f()) : (k === "disconnected" || k === "error") && (y(), v());
|
|
1873
1874
|
});
|
|
1874
|
-
T(), m(), f(),
|
|
1875
|
-
|
|
1875
|
+
T(), m(), f(), Ae() || ss().then((k) => {
|
|
1876
|
+
k && (y(), T(), v(), m(), f());
|
|
1877
|
+
}).catch((k) => {
|
|
1878
|
+
Me.warn("Failed to eagerly initialize messenger echo", k);
|
|
1879
|
+
}), l !== null && De(() => {
|
|
1880
|
+
N(), q(), G(), b(), v();
|
|
1876
1881
|
});
|
|
1877
1882
|
}
|
|
1878
1883
|
function tc() {
|
|
@@ -1890,7 +1895,7 @@ function tc() {
|
|
|
1890
1895
|
isSuspended: ie(() => e.value === "account_suspended")
|
|
1891
1896
|
};
|
|
1892
1897
|
}
|
|
1893
|
-
const
|
|
1898
|
+
const bs = () => null, ys = {
|
|
1894
1899
|
sessionOpenUrl: "/v1/presence/session/open",
|
|
1895
1900
|
sessionHeartbeatUrl: "/v1/presence/heartbeat",
|
|
1896
1901
|
sessionCloseUrl: "/v1/presence/session/close",
|
|
@@ -1901,9 +1906,9 @@ const vs = () => null, bs = {
|
|
|
1901
1906
|
activityDebounceMs: 5e3,
|
|
1902
1907
|
heartbeatIntervalMs: 3e4,
|
|
1903
1908
|
userAgentResolver: () => navigator.userAgent.slice(0, 256),
|
|
1904
|
-
authTokenResolver:
|
|
1909
|
+
authTokenResolver: bs
|
|
1905
1910
|
};
|
|
1906
|
-
let lt = { ...
|
|
1911
|
+
let lt = { ...ys };
|
|
1907
1912
|
function Ho() {
|
|
1908
1913
|
return lt;
|
|
1909
1914
|
}
|
|
@@ -1914,16 +1919,16 @@ function Bo(e) {
|
|
|
1914
1919
|
};
|
|
1915
1920
|
}
|
|
1916
1921
|
function Vo() {
|
|
1917
|
-
lt = { ...
|
|
1922
|
+
lt = { ...ys };
|
|
1918
1923
|
}
|
|
1919
1924
|
function Xo(e) {
|
|
1920
|
-
return e.authTokenResolver !==
|
|
1925
|
+
return e.authTokenResolver !== bs;
|
|
1921
1926
|
}
|
|
1922
1927
|
const Wo = 429, Go = 403, Jo = 423, Ko = "ACCOUNT_LIMITED", Qo = "ACCOUNT_SUSPENDED", Yo = "ACCOUNT_WRITE_TIMEOUT", Zo = 2, ea = 5 * 6e4;
|
|
1923
1928
|
function Xe(e) {
|
|
1924
1929
|
return typeof e == "object" && e !== null;
|
|
1925
1930
|
}
|
|
1926
|
-
function
|
|
1931
|
+
function _s(e) {
|
|
1927
1932
|
if (!Xe(e))
|
|
1928
1933
|
return null;
|
|
1929
1934
|
const n = e.response;
|
|
@@ -1938,7 +1943,7 @@ function ys(e) {
|
|
|
1938
1943
|
}
|
|
1939
1944
|
return null;
|
|
1940
1945
|
}
|
|
1941
|
-
function
|
|
1946
|
+
function Ss(e) {
|
|
1942
1947
|
if (!Xe(e))
|
|
1943
1948
|
return null;
|
|
1944
1949
|
const n = e.response;
|
|
@@ -1948,11 +1953,11 @@ function _s(e) {
|
|
|
1948
1953
|
return Xe(i) && typeof i.code == "string" ? i.code : null;
|
|
1949
1954
|
}
|
|
1950
1955
|
function kt(e) {
|
|
1951
|
-
const n =
|
|
1956
|
+
const n = _s(e), i = Ss(e);
|
|
1952
1957
|
return n === Wo && i === Ko || n === Jo && i === Yo;
|
|
1953
1958
|
}
|
|
1954
1959
|
function Lt(e) {
|
|
1955
|
-
const n =
|
|
1960
|
+
const n = _s(e), i = Ss(e);
|
|
1956
1961
|
return n === Go && i === Qo ? !0 : e instanceof Error ? e.message.toLowerCase().includes("suspended") : !1;
|
|
1957
1962
|
}
|
|
1958
1963
|
function Ge() {
|
|
@@ -2007,18 +2012,18 @@ function oa(e, n, i) {
|
|
|
2007
2012
|
}
|
|
2008
2013
|
}
|
|
2009
2014
|
function nc() {
|
|
2010
|
-
const e = Fe()(), n = Ho(), i =
|
|
2011
|
-
let c = null, l = null, d = !1, g = It(n.accountLimitedUntilStorageKey), h = !1, x = !1, M = null,
|
|
2012
|
-
const C = () => Xo(n) ? n.authTokenResolver() !== null : !0,
|
|
2015
|
+
const e = Fe()(), n = Ho(), i = gs(), o = ta(n.clientIdStorageKey);
|
|
2016
|
+
let c = null, l = null, d = !1, g = It(n.accountLimitedUntilStorageKey), h = !1, x = !1, M = null, y = 0;
|
|
2017
|
+
const C = () => Xo(n) ? n.authTokenResolver() !== null : !0, b = () => {
|
|
2013
2018
|
c && (clearInterval(c), c = null);
|
|
2014
2019
|
}, T = () => {
|
|
2015
2020
|
l && (clearTimeout(l), l = null);
|
|
2016
2021
|
}, w = () => {
|
|
2017
|
-
|
|
2022
|
+
b(), c = setInterval(() => {
|
|
2018
2023
|
F();
|
|
2019
2024
|
}, n.heartbeatIntervalMs);
|
|
2020
2025
|
}, f = (I) => {
|
|
2021
|
-
g || console.warn(I), sa(n.accountLimitedUntilStorageKey), g = !0, d = !1, M = null,
|
|
2026
|
+
g || console.warn(I), sa(n.accountLimitedUntilStorageKey), g = !0, d = !1, M = null, b(), T();
|
|
2022
2027
|
}, m = async (I) => {
|
|
2023
2028
|
if (!(!d || x || g || h) && C() && M !== I)
|
|
2024
2029
|
try {
|
|
@@ -2028,9 +2033,9 @@ function nc() {
|
|
|
2028
2033
|
f("[Presence] Presence updates paused: account is temporarily limited");
|
|
2029
2034
|
return;
|
|
2030
2035
|
}
|
|
2031
|
-
Lt(ae) && (h = !0, d = !1, M = null,
|
|
2036
|
+
Lt(ae) && (h = !0, d = !1, M = null, b(), T());
|
|
2032
2037
|
}
|
|
2033
|
-
},
|
|
2038
|
+
}, v = () => {
|
|
2034
2039
|
T(), !(!d || x || g || h || document.visibilityState !== "visible") && (l = setTimeout(() => {
|
|
2035
2040
|
l = null, m("idle");
|
|
2036
2041
|
}, n.idleAfterMs));
|
|
@@ -2038,14 +2043,14 @@ function nc() {
|
|
|
2038
2043
|
if (x || !d || g || h || document.visibilityState !== "visible")
|
|
2039
2044
|
return;
|
|
2040
2045
|
const I = Date.now();
|
|
2041
|
-
I -
|
|
2046
|
+
I - y < n.activityDebounceMs || (y = I, m("online"), v());
|
|
2042
2047
|
}, q = () => {
|
|
2043
2048
|
N();
|
|
2044
2049
|
}, G = () => {
|
|
2045
2050
|
typeof document > "u" || typeof window > "u" || (document.addEventListener("pointerdown", q, { passive: !0 }), document.addEventListener("keydown", q), document.addEventListener("touchstart", q, { passive: !0 }), window.addEventListener("focus", q));
|
|
2046
2051
|
}, k = () => {
|
|
2047
2052
|
typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", q), document.removeEventListener("keydown", q), document.removeEventListener("touchstart", q), window.removeEventListener("focus", q));
|
|
2048
|
-
},
|
|
2053
|
+
}, U = async () => {
|
|
2049
2054
|
if (It(n.accountLimitedUntilStorageKey))
|
|
2050
2055
|
return g = !0, "account_limited";
|
|
2051
2056
|
try {
|
|
@@ -2054,11 +2059,11 @@ function nc() {
|
|
|
2054
2059
|
user_agent: n.userAgentResolver()
|
|
2055
2060
|
}), ra(n.accountLimitedUntilStorageKey), g = !1, h = !1, d = !0, M = null, "opened";
|
|
2056
2061
|
} catch (I) {
|
|
2057
|
-
return kt(I) ? (f("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : Lt(I) ? (h = !0, d = !1, M = null,
|
|
2062
|
+
return kt(I) ? (f("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : Lt(I) ? (h = !0, d = !1, M = null, b(), T(), "account_suspended") : "failed";
|
|
2058
2063
|
}
|
|
2059
2064
|
}, H = async () => {
|
|
2060
2065
|
for (let I = 0; I < Zo; I += 1)
|
|
2061
|
-
if (await
|
|
2066
|
+
if (await U() !== "failed")
|
|
2062
2067
|
return;
|
|
2063
2068
|
console.warn("[Presence] Failed to open session");
|
|
2064
2069
|
}, F = async () => {
|
|
@@ -2070,7 +2075,7 @@ function nc() {
|
|
|
2070
2075
|
f("[Presence] Heartbeat paused: account is temporarily limited");
|
|
2071
2076
|
return;
|
|
2072
2077
|
}
|
|
2073
|
-
Lt(I) && (h = !0, d = !1, M = null,
|
|
2078
|
+
Lt(I) && (h = !0, d = !1, M = null, b(), T());
|
|
2074
2079
|
}
|
|
2075
2080
|
}, J = () => {
|
|
2076
2081
|
if (!d)
|
|
@@ -2094,12 +2099,12 @@ function nc() {
|
|
|
2094
2099
|
J();
|
|
2095
2100
|
return;
|
|
2096
2101
|
}
|
|
2097
|
-
d && (w(), m("online"),
|
|
2102
|
+
d && (w(), m("online"), v());
|
|
2098
2103
|
}
|
|
2099
2104
|
}, te = () => {
|
|
2100
2105
|
if (!x) {
|
|
2101
2106
|
if (document.visibilityState === "hidden") {
|
|
2102
|
-
J(),
|
|
2107
|
+
J(), b(), T();
|
|
2103
2108
|
return;
|
|
2104
2109
|
}
|
|
2105
2110
|
if (document.visibilityState === "visible" && !d) {
|
|
@@ -2108,8 +2113,8 @@ function nc() {
|
|
|
2108
2113
|
}
|
|
2109
2114
|
document.visibilityState === "visible" && d && !g && !h && N();
|
|
2110
2115
|
}
|
|
2111
|
-
},
|
|
2112
|
-
x || (J(),
|
|
2116
|
+
}, _ = () => {
|
|
2117
|
+
x || (J(), b(), T());
|
|
2113
2118
|
};
|
|
2114
2119
|
jt(async () => {
|
|
2115
2120
|
if (e.isAuthenticated ?? e.currentUser !== null) {
|
|
@@ -2117,115 +2122,115 @@ function nc() {
|
|
|
2117
2122
|
J();
|
|
2118
2123
|
return;
|
|
2119
2124
|
}
|
|
2120
|
-
d && (w(), m("online"),
|
|
2125
|
+
d && (w(), m("online"), v()), G(), document.addEventListener("visibilitychange", te), window.addEventListener("pagehide", _), window.addEventListener("beforeunload", _);
|
|
2121
2126
|
}
|
|
2122
2127
|
}), De(() => {
|
|
2123
|
-
x = !0, k(), T(),
|
|
2128
|
+
x = !0, k(), T(), b(), J(), document.removeEventListener("visibilitychange", te), window.removeEventListener("pagehide", _), window.removeEventListener("beforeunload", _);
|
|
2124
2129
|
});
|
|
2125
2130
|
}
|
|
2126
2131
|
const aa = 12e3;
|
|
2127
2132
|
function sc(e) {
|
|
2128
|
-
const n = Gt(), i = Fe()(), o = ve(!1), c = ve(null), l = ve(null), d = ve([]), g = /* @__PURE__ */ new Map(), h = zt(), x = h !== null, M = 20,
|
|
2129
|
-
let C = !1,
|
|
2130
|
-
const f = ie(() => i.currentUser?.id), m = () => Xn(e)?.trim() ?? "",
|
|
2133
|
+
const n = Gt(), i = Fe()(), o = ve(!1), c = ve(null), l = ve(null), d = ve([]), g = /* @__PURE__ */ new Map(), h = zt(), x = h !== null, M = 20, y = 250;
|
|
2134
|
+
let C = !1, b = null, T = 0, w = null;
|
|
2135
|
+
const f = ie(() => i.currentUser?.id), m = () => Xn(e)?.trim() ?? "", v = () => {
|
|
2131
2136
|
const A = l.value?.trim() ?? "";
|
|
2132
2137
|
if (A.length > 0)
|
|
2133
2138
|
return A;
|
|
2134
|
-
const
|
|
2135
|
-
return
|
|
2139
|
+
const O = m();
|
|
2140
|
+
return O.length > 0 && (l.value = O), O;
|
|
2136
2141
|
}, N = (A) => n.getTypingUsers(A), q = (A) => {
|
|
2137
|
-
const
|
|
2138
|
-
for (const re of
|
|
2142
|
+
const O = N(A);
|
|
2143
|
+
for (const re of O)
|
|
2139
2144
|
n.removeTypingUser(A, re.id);
|
|
2140
2145
|
d.value = [];
|
|
2141
2146
|
}, G = (A) => {
|
|
2142
|
-
const
|
|
2143
|
-
|
|
2147
|
+
const O = g.get(A);
|
|
2148
|
+
O && (clearTimeout(O), g.delete(A));
|
|
2144
2149
|
}, k = () => {
|
|
2145
2150
|
for (const A of g.values())
|
|
2146
2151
|
clearTimeout(A);
|
|
2147
2152
|
g.clear();
|
|
2148
|
-
},
|
|
2153
|
+
}, U = () => {
|
|
2149
2154
|
w && (clearTimeout(w), w = null), T = 0;
|
|
2150
2155
|
}, H = () => {
|
|
2151
2156
|
!x || o.value || w || T >= M || (w = setTimeout(() => {
|
|
2152
2157
|
w = null, T += 1, te();
|
|
2153
|
-
},
|
|
2154
|
-
}, F = (A,
|
|
2158
|
+
}, y));
|
|
2159
|
+
}, F = (A, O) => {
|
|
2155
2160
|
G(A);
|
|
2156
2161
|
const re = setTimeout(() => {
|
|
2157
|
-
g.delete(A), n.removeTypingUser(
|
|
2162
|
+
g.delete(A), n.removeTypingUser(O, A), d.value = d.value.filter((fe) => fe.id !== A);
|
|
2158
2163
|
}, aa);
|
|
2159
2164
|
g.set(A, re);
|
|
2160
2165
|
}, J = () => {
|
|
2161
|
-
C = !0,
|
|
2166
|
+
C = !0, U();
|
|
2162
2167
|
}, me = (A) => {
|
|
2163
2168
|
try {
|
|
2164
|
-
|
|
2169
|
+
b && (b(), b = null), b = ki(A, {
|
|
2165
2170
|
onTypingStart: I,
|
|
2166
2171
|
onTypingStop: ae
|
|
2167
|
-
}),
|
|
2168
|
-
} catch (
|
|
2169
|
-
c.value =
|
|
2172
|
+
}), U(), o.value = !0, l.value = A;
|
|
2173
|
+
} catch (O) {
|
|
2174
|
+
c.value = O instanceof Error ? O.message : "Failed to subscribe to typing channel";
|
|
2170
2175
|
}
|
|
2171
2176
|
}, te = () => {
|
|
2172
2177
|
const A = m();
|
|
2173
2178
|
if (!(o.value || !A)) {
|
|
2174
|
-
if (c.value = null,
|
|
2179
|
+
if (c.value = null, Ae() && Tn() === "connected") {
|
|
2175
2180
|
me(A);
|
|
2176
2181
|
return;
|
|
2177
2182
|
}
|
|
2178
|
-
C = !1,
|
|
2179
|
-
if (C || o.value || !
|
|
2183
|
+
C = !1, ss().then((O) => {
|
|
2184
|
+
if (C || o.value || !O)
|
|
2180
2185
|
return;
|
|
2181
2186
|
const re = m();
|
|
2182
|
-
if (re && re === A &&
|
|
2187
|
+
if (re && re === A && Ae() && Tn() === "connected") {
|
|
2183
2188
|
me(re);
|
|
2184
2189
|
return;
|
|
2185
2190
|
}
|
|
2186
2191
|
H();
|
|
2187
2192
|
}), H();
|
|
2188
2193
|
}
|
|
2189
|
-
},
|
|
2194
|
+
}, _ = () => {
|
|
2190
2195
|
const A = l.value;
|
|
2191
2196
|
if (J(), !(!o.value || !A))
|
|
2192
2197
|
try {
|
|
2193
|
-
|
|
2194
|
-
} catch (
|
|
2195
|
-
c.value =
|
|
2198
|
+
b && (b(), b = null), Li(A), k(), q(A), o.value = !1, l.value = null, c.value = null;
|
|
2199
|
+
} catch (O) {
|
|
2200
|
+
c.value = O instanceof Error ? O.message : "Failed to unsubscribe from typing channel";
|
|
2196
2201
|
}
|
|
2197
2202
|
};
|
|
2198
2203
|
function I(A) {
|
|
2199
2204
|
if (A.user_id === f.value)
|
|
2200
2205
|
return;
|
|
2201
|
-
const
|
|
2202
|
-
if (!
|
|
2206
|
+
const O = v();
|
|
2207
|
+
if (!O)
|
|
2203
2208
|
return;
|
|
2204
2209
|
const re = {
|
|
2205
2210
|
id: A.user.id,
|
|
2206
2211
|
name: A.user.name,
|
|
2207
2212
|
...A.user.avatar !== void 0 ? { avatar: A.user.avatar } : {}
|
|
2208
2213
|
};
|
|
2209
|
-
d.value.some((fe) => fe.id === re.id) || (d.value = [...d.value, re]), n.addTypingUser(
|
|
2214
|
+
d.value.some((fe) => fe.id === re.id) || (d.value = [...d.value, re]), n.addTypingUser(O, re), F(A.user_id, O);
|
|
2210
2215
|
}
|
|
2211
2216
|
function ae(A) {
|
|
2212
2217
|
if (A.user_id === f.value)
|
|
2213
2218
|
return;
|
|
2214
2219
|
G(A.user_id);
|
|
2215
|
-
const
|
|
2216
|
-
|
|
2220
|
+
const O = v();
|
|
2221
|
+
O && (d.value = d.value.filter((re) => re.id !== A.user_id), n.removeTypingUser(O, A.user_id));
|
|
2217
2222
|
}
|
|
2218
2223
|
const B = ie(() => {
|
|
2219
|
-
const A =
|
|
2224
|
+
const A = v();
|
|
2220
2225
|
if (!A)
|
|
2221
2226
|
return d.value;
|
|
2222
|
-
const
|
|
2227
|
+
const O = N(A);
|
|
2223
2228
|
if (d.value.length === 0)
|
|
2224
|
-
return
|
|
2225
|
-
if (
|
|
2229
|
+
return O;
|
|
2230
|
+
if (O.length === 0)
|
|
2226
2231
|
return d.value;
|
|
2227
2232
|
const re = /* @__PURE__ */ new Map();
|
|
2228
|
-
for (const fe of
|
|
2233
|
+
for (const fe of O)
|
|
2229
2234
|
re.set(fe.id, fe);
|
|
2230
2235
|
for (const fe of d.value)
|
|
2231
2236
|
re.set(fe.id, fe);
|
|
@@ -2234,20 +2239,20 @@ function sc(e) {
|
|
|
2234
2239
|
const A = B.value;
|
|
2235
2240
|
if (A.length === 0)
|
|
2236
2241
|
return "";
|
|
2237
|
-
const
|
|
2238
|
-
if (!
|
|
2242
|
+
const O = A[0];
|
|
2243
|
+
if (!O)
|
|
2239
2244
|
return "";
|
|
2240
2245
|
if (A.length === 1)
|
|
2241
|
-
return `${
|
|
2246
|
+
return `${O.name} is typing...`;
|
|
2242
2247
|
const re = A[1];
|
|
2243
2248
|
if (!re)
|
|
2244
2249
|
return `${A.length} people are typing...`;
|
|
2245
2250
|
if (A.length === 2)
|
|
2246
|
-
return `${
|
|
2251
|
+
return `${O.name} and ${re.name} are typing...`;
|
|
2247
2252
|
const fe = A[2];
|
|
2248
|
-
return fe ? A.length === 3 ? `${
|
|
2253
|
+
return fe ? A.length === 3 ? `${O.name}, ${re.name} and ${fe.name} are typing...` : `${A.length} people are typing...` : `${A.length} people are typing...`;
|
|
2249
2254
|
}), V = ie(() => B.value.length > 0), ne = () => {
|
|
2250
|
-
m() && (
|
|
2255
|
+
m() && (b && (b(), b = null), o.value = !1, l.value = null, te());
|
|
2251
2256
|
};
|
|
2252
2257
|
typeof window < "u" && window.addEventListener(We(), ne);
|
|
2253
2258
|
const _e = ht((A) => {
|
|
@@ -2256,13 +2261,13 @@ function sc(e) {
|
|
|
2256
2261
|
return;
|
|
2257
2262
|
}
|
|
2258
2263
|
if (A === "disconnected" || A === "error") {
|
|
2259
|
-
J(),
|
|
2260
|
-
const
|
|
2261
|
-
|
|
2264
|
+
J(), b && (b(), b = null);
|
|
2265
|
+
const O = v();
|
|
2266
|
+
O && q(O), o.value = !1, l.value = null, k();
|
|
2262
2267
|
}
|
|
2263
2268
|
});
|
|
2264
2269
|
return h !== null && De(() => {
|
|
2265
|
-
J(), _e(), k(),
|
|
2270
|
+
J(), _e(), k(), _(), typeof window < "u" && window.removeEventListener(We(), ne);
|
|
2266
2271
|
}), {
|
|
2267
2272
|
isSubscribed: ie(() => o.value),
|
|
2268
2273
|
error: ie(() => c.value),
|
|
@@ -2270,14 +2275,14 @@ function sc(e) {
|
|
|
2270
2275
|
formatTypingIndicator: E,
|
|
2271
2276
|
hasTypingUsers: V,
|
|
2272
2277
|
subscribe: te,
|
|
2273
|
-
unsubscribe:
|
|
2278
|
+
unsubscribe: _
|
|
2274
2279
|
};
|
|
2275
2280
|
}
|
|
2276
2281
|
function rc(e) {
|
|
2277
2282
|
e.apiClient && ji(e.apiClient), e.mainApiClient && xo(e.mainApiClient), e.authStore && Hi(e.authStore), e.mediaApi && Xi(e.mediaApi), e.createLogger && Ao(e.createLogger), e.playMessageNotification && No(e.playMessageNotification), e.echo && Ii(e.echo), e.mainEcho && wo(e.mainEcho), e.presence && Bo(e.presence);
|
|
2278
2283
|
}
|
|
2279
2284
|
function ic() {
|
|
2280
|
-
$i(), ko(), Bi(), Wi(), Ro(), Do(),
|
|
2285
|
+
$i(), ko(), Bi(), Wi(), Ro(), Do(), Oi(), To(), Vo();
|
|
2281
2286
|
}
|
|
2282
2287
|
class Zt {
|
|
2283
2288
|
constructor() {
|
|
@@ -2308,7 +2313,7 @@ class Zt {
|
|
|
2308
2313
|
return this.stopListening(".client-" + n, i);
|
|
2309
2314
|
}
|
|
2310
2315
|
}
|
|
2311
|
-
class
|
|
2316
|
+
class Cs {
|
|
2312
2317
|
/**
|
|
2313
2318
|
* Create a new class instance.
|
|
2314
2319
|
*/
|
|
@@ -2342,7 +2347,7 @@ class en extends Zt {
|
|
|
2342
2347
|
* Create a new class instance.
|
|
2343
2348
|
*/
|
|
2344
2349
|
constructor(n, i, o) {
|
|
2345
|
-
super(), this.name = i, this.pusher = n, this.options = o, this.eventFormatter = new
|
|
2350
|
+
super(), this.name = i, this.pusher = n, this.options = o, this.eventFormatter = new Cs(this.options.namespace), this.subscribe();
|
|
2346
2351
|
}
|
|
2347
2352
|
/**
|
|
2348
2353
|
* Subscribe to a Pusher channel.
|
|
@@ -2414,7 +2419,7 @@ class en extends Zt {
|
|
|
2414
2419
|
return this.subscription.bind(n, i), this;
|
|
2415
2420
|
}
|
|
2416
2421
|
}
|
|
2417
|
-
class
|
|
2422
|
+
class ws extends en {
|
|
2418
2423
|
/**
|
|
2419
2424
|
* Send a whisper event to other clients in the channel.
|
|
2420
2425
|
*/
|
|
@@ -2436,7 +2441,7 @@ class ua extends en {
|
|
|
2436
2441
|
), this;
|
|
2437
2442
|
}
|
|
2438
2443
|
}
|
|
2439
|
-
class la extends
|
|
2444
|
+
class la extends ws {
|
|
2440
2445
|
/**
|
|
2441
2446
|
* Register a callback to be called anytime the member list changes.
|
|
2442
2447
|
*/
|
|
@@ -2471,12 +2476,12 @@ class la extends Cs {
|
|
|
2471
2476
|
}), this;
|
|
2472
2477
|
}
|
|
2473
2478
|
}
|
|
2474
|
-
class
|
|
2479
|
+
class Ts extends Zt {
|
|
2475
2480
|
/**
|
|
2476
2481
|
* Create a new class instance.
|
|
2477
2482
|
*/
|
|
2478
2483
|
constructor(n, i, o) {
|
|
2479
|
-
super(), this.events = {}, this.listeners = {}, this.name = i, this.socket = n, this.options = o, this.eventFormatter = new
|
|
2484
|
+
super(), this.events = {}, this.listeners = {}, this.name = i, this.socket = n, this.options = o, this.eventFormatter = new Cs(this.options.namespace), this.subscribe();
|
|
2480
2485
|
}
|
|
2481
2486
|
/**
|
|
2482
2487
|
* Subscribe to a Socket.io channel.
|
|
@@ -2547,7 +2552,7 @@ class ws extends Zt {
|
|
|
2547
2552
|
)), (!i || this.listeners[n].length === 0) && (this.events[n] && (this.socket.removeListener(n, this.events[n]), delete this.events[n]), delete this.listeners[n]);
|
|
2548
2553
|
}
|
|
2549
2554
|
}
|
|
2550
|
-
class
|
|
2555
|
+
class Es extends Ts {
|
|
2551
2556
|
/**
|
|
2552
2557
|
* Send a whisper event to other clients in the channel.
|
|
2553
2558
|
*/
|
|
@@ -2559,7 +2564,7 @@ class Ts extends ws {
|
|
|
2559
2564
|
}), this;
|
|
2560
2565
|
}
|
|
2561
2566
|
}
|
|
2562
|
-
class da extends
|
|
2567
|
+
class da extends Es {
|
|
2563
2568
|
/**
|
|
2564
2569
|
* Register a callback to be called anytime the member list changes.
|
|
2565
2570
|
*/
|
|
@@ -2645,7 +2650,7 @@ class dt extends Zt {
|
|
|
2645
2650
|
return this;
|
|
2646
2651
|
}
|
|
2647
2652
|
}
|
|
2648
|
-
class
|
|
2653
|
+
class As extends dt {
|
|
2649
2654
|
/**
|
|
2650
2655
|
* Send a whisper event to other clients in the channel.
|
|
2651
2656
|
*/
|
|
@@ -2661,7 +2666,7 @@ class ha extends dt {
|
|
|
2661
2666
|
return this;
|
|
2662
2667
|
}
|
|
2663
2668
|
}
|
|
2664
|
-
class fa extends
|
|
2669
|
+
class fa extends As {
|
|
2665
2670
|
/**
|
|
2666
2671
|
* Register a callback to be called anytime the member list changes.
|
|
2667
2672
|
*/
|
|
@@ -2687,7 +2692,7 @@ class fa extends Es {
|
|
|
2687
2692
|
return this;
|
|
2688
2693
|
}
|
|
2689
2694
|
}
|
|
2690
|
-
const
|
|
2695
|
+
const Rs = class Ps {
|
|
2691
2696
|
/**
|
|
2692
2697
|
* Create a new class instance.
|
|
2693
2698
|
*/
|
|
@@ -2699,7 +2704,7 @@ const As = class Rs {
|
|
|
2699
2704
|
*/
|
|
2700
2705
|
setOptions(n) {
|
|
2701
2706
|
this.options = {
|
|
2702
|
-
...
|
|
2707
|
+
...Ps._defaultOptions,
|
|
2703
2708
|
...n,
|
|
2704
2709
|
broadcaster: n.broadcaster
|
|
2705
2710
|
};
|
|
@@ -2714,7 +2719,7 @@ const As = class Rs {
|
|
|
2714
2719
|
return typeof window < "u" && (n = window.Laravel) != null && n.csrfToken ? window.Laravel.csrfToken : this.options.csrfToken ? this.options.csrfToken : typeof document < "u" && typeof document.querySelector == "function" ? ((i = document.querySelector('meta[name="csrf-token"]')) == null ? void 0 : i.getAttribute("content")) ?? null : null;
|
|
2715
2720
|
}
|
|
2716
2721
|
};
|
|
2717
|
-
|
|
2722
|
+
Rs._defaultOptions = {
|
|
2718
2723
|
auth: {
|
|
2719
2724
|
headers: {}
|
|
2720
2725
|
},
|
|
@@ -2729,7 +2734,7 @@ As._defaultOptions = {
|
|
|
2729
2734
|
key: null,
|
|
2730
2735
|
namespace: "App.Events"
|
|
2731
2736
|
};
|
|
2732
|
-
let tn =
|
|
2737
|
+
let tn = Rs;
|
|
2733
2738
|
class ot extends tn {
|
|
2734
2739
|
constructor() {
|
|
2735
2740
|
super(...arguments), this.channels = {};
|
|
@@ -2778,7 +2783,7 @@ class ot extends tn {
|
|
|
2778
2783
|
* Get a private channel instance by name.
|
|
2779
2784
|
*/
|
|
2780
2785
|
privateChannel(n) {
|
|
2781
|
-
return this.channels["private-" + n] || (this.channels["private-" + n] = new
|
|
2786
|
+
return this.channels["private-" + n] || (this.channels["private-" + n] = new ws(
|
|
2782
2787
|
this.pusher,
|
|
2783
2788
|
"private-" + n,
|
|
2784
2789
|
this.options
|
|
@@ -2907,7 +2912,7 @@ class pa extends tn {
|
|
|
2907
2912
|
* Get a channel instance by name.
|
|
2908
2913
|
*/
|
|
2909
2914
|
channel(n) {
|
|
2910
|
-
return this.channels[n] || (this.channels[n] = new
|
|
2915
|
+
return this.channels[n] || (this.channels[n] = new Ts(
|
|
2911
2916
|
this.socket,
|
|
2912
2917
|
n,
|
|
2913
2918
|
this.options
|
|
@@ -2917,7 +2922,7 @@ class pa extends tn {
|
|
|
2917
2922
|
* Get a private channel instance by name.
|
|
2918
2923
|
*/
|
|
2919
2924
|
privateChannel(n) {
|
|
2920
|
-
return this.channels["private-" + n] || (this.channels["private-" + n] = new
|
|
2925
|
+
return this.channels["private-" + n] || (this.channels["private-" + n] = new Es(
|
|
2921
2926
|
this.socket,
|
|
2922
2927
|
"private-" + n,
|
|
2923
2928
|
this.options
|
|
@@ -3014,7 +3019,7 @@ class Hn extends tn {
|
|
|
3014
3019
|
* Get a private channel instance by name.
|
|
3015
3020
|
*/
|
|
3016
3021
|
privateChannel(n) {
|
|
3017
|
-
return new
|
|
3022
|
+
return new As();
|
|
3018
3023
|
}
|
|
3019
3024
|
/**
|
|
3020
3025
|
* Get a private encrypted channel instance by name.
|
|
@@ -3224,7 +3229,7 @@ class ga {
|
|
|
3224
3229
|
function ma(e) {
|
|
3225
3230
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3226
3231
|
}
|
|
3227
|
-
var
|
|
3232
|
+
var Ot = { exports: {} };
|
|
3228
3233
|
var Bn;
|
|
3229
3234
|
function va() {
|
|
3230
3235
|
return Bn || (Bn = 1, (function(e, n) {
|
|
@@ -3282,18 +3287,18 @@ function va() {
|
|
|
3282
3287
|
(function(i, o, c) {
|
|
3283
3288
|
var l = this && this.__extends || /* @__PURE__ */ (function() {
|
|
3284
3289
|
var w = function(f, m) {
|
|
3285
|
-
return w = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(
|
|
3286
|
-
|
|
3287
|
-
} || function(
|
|
3288
|
-
for (var q in N) N.hasOwnProperty(q) && (
|
|
3290
|
+
return w = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(v, N) {
|
|
3291
|
+
v.__proto__ = N;
|
|
3292
|
+
} || function(v, N) {
|
|
3293
|
+
for (var q in N) N.hasOwnProperty(q) && (v[q] = N[q]);
|
|
3289
3294
|
}, w(f, m);
|
|
3290
3295
|
};
|
|
3291
3296
|
return function(f, m) {
|
|
3292
3297
|
w(f, m);
|
|
3293
|
-
function
|
|
3298
|
+
function v() {
|
|
3294
3299
|
this.constructor = f;
|
|
3295
3300
|
}
|
|
3296
|
-
f.prototype = m === null ? Object.create(m) : (
|
|
3301
|
+
f.prototype = m === null ? Object.create(m) : (v.prototype = m.prototype, new v());
|
|
3297
3302
|
};
|
|
3298
3303
|
})();
|
|
3299
3304
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
@@ -3306,13 +3311,13 @@ function va() {
|
|
|
3306
3311
|
return w.prototype.encodedLength = function(f) {
|
|
3307
3312
|
return this._paddingCharacter ? (f + 2) / 3 * 4 | 0 : (f * 8 + 5) / 6 | 0;
|
|
3308
3313
|
}, w.prototype.encode = function(f) {
|
|
3309
|
-
for (var m = "",
|
|
3310
|
-
var N = f[
|
|
3314
|
+
for (var m = "", v = 0; v < f.length - 2; v += 3) {
|
|
3315
|
+
var N = f[v] << 16 | f[v + 1] << 8 | f[v + 2];
|
|
3311
3316
|
m += this._encodeByte(N >>> 18 & 63), m += this._encodeByte(N >>> 12 & 63), m += this._encodeByte(N >>> 6 & 63), m += this._encodeByte(N >>> 0 & 63);
|
|
3312
3317
|
}
|
|
3313
|
-
var q = f.length -
|
|
3318
|
+
var q = f.length - v;
|
|
3314
3319
|
if (q > 0) {
|
|
3315
|
-
var N = f[
|
|
3320
|
+
var N = f[v] << 16 | (q === 2 ? f[v + 1] << 8 : 0);
|
|
3316
3321
|
m += this._encodeByte(N >>> 18 & 63), m += this._encodeByte(N >>> 12 & 63), q === 2 ? m += this._encodeByte(N >>> 6 & 63) : m += this._paddingCharacter || "", m += this._paddingCharacter || "";
|
|
3317
3322
|
}
|
|
3318
3323
|
return m;
|
|
@@ -3323,9 +3328,9 @@ function va() {
|
|
|
3323
3328
|
}, w.prototype.decode = function(f) {
|
|
3324
3329
|
if (f.length === 0)
|
|
3325
3330
|
return new Uint8Array(0);
|
|
3326
|
-
for (var m = this._getPaddingLength(f),
|
|
3327
|
-
|
|
3328
|
-
if (G <
|
|
3331
|
+
for (var m = this._getPaddingLength(f), v = f.length - m, N = new Uint8Array(this.maxDecodedLength(v)), q = 0, G = 0, k = 0, U = 0, H = 0, F = 0, J = 0; G < v - 4; G += 4)
|
|
3332
|
+
U = this._decodeChar(f.charCodeAt(G + 0)), H = this._decodeChar(f.charCodeAt(G + 1)), F = this._decodeChar(f.charCodeAt(G + 2)), J = this._decodeChar(f.charCodeAt(G + 3)), N[q++] = U << 2 | H >>> 4, N[q++] = H << 4 | F >>> 2, N[q++] = F << 6 | J, k |= U & d, k |= H & d, k |= F & d, k |= J & d;
|
|
3333
|
+
if (G < v - 1 && (U = this._decodeChar(f.charCodeAt(G)), H = this._decodeChar(f.charCodeAt(G + 1)), N[q++] = U << 2 | H >>> 4, k |= U & d, k |= H & d), G < v - 2 && (F = this._decodeChar(f.charCodeAt(G + 2)), N[q++] = H << 4 | F >>> 2, k |= F & d), G < v - 3 && (J = this._decodeChar(f.charCodeAt(G + 3)), N[q++] = F << 6 | J, k |= J & d), k !== 0)
|
|
3329
3334
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
3330
3335
|
return N;
|
|
3331
3336
|
}, w.prototype._encodeByte = function(f) {
|
|
@@ -3337,7 +3342,7 @@ function va() {
|
|
|
3337
3342
|
}, w.prototype._getPaddingLength = function(f) {
|
|
3338
3343
|
var m = 0;
|
|
3339
3344
|
if (this._paddingCharacter) {
|
|
3340
|
-
for (var
|
|
3345
|
+
for (var v = f.length - 1; v >= 0 && f[v] === this._paddingCharacter; v--)
|
|
3341
3346
|
m++;
|
|
3342
3347
|
if (f.length < 4 || m > 2)
|
|
3343
3348
|
throw new Error("Base64Coder: incorrect padding");
|
|
@@ -3356,7 +3361,7 @@ function va() {
|
|
|
3356
3361
|
return h.decode(w);
|
|
3357
3362
|
}
|
|
3358
3363
|
o.decode = M;
|
|
3359
|
-
var
|
|
3364
|
+
var y = (
|
|
3360
3365
|
/** @class */
|
|
3361
3366
|
(function(w) {
|
|
3362
3367
|
l(f, w);
|
|
@@ -3364,20 +3369,20 @@ function va() {
|
|
|
3364
3369
|
return w !== null && w.apply(this, arguments) || this;
|
|
3365
3370
|
}
|
|
3366
3371
|
return f.prototype._encodeByte = function(m) {
|
|
3367
|
-
var
|
|
3368
|
-
return
|
|
3372
|
+
var v = m;
|
|
3373
|
+
return v += 65, v += 25 - m >>> 8 & 6, v += 51 - m >>> 8 & -75, v += 61 - m >>> 8 & -13, v += 62 - m >>> 8 & 49, String.fromCharCode(v);
|
|
3369
3374
|
}, f.prototype._decodeChar = function(m) {
|
|
3370
|
-
var
|
|
3371
|
-
return
|
|
3375
|
+
var v = d;
|
|
3376
|
+
return v += (44 - m & m - 46) >>> 8 & -d + m - 45 + 62, v += (94 - m & m - 96) >>> 8 & -d + m - 95 + 63, v += (47 - m & m - 58) >>> 8 & -d + m - 48 + 52, v += (64 - m & m - 91) >>> 8 & -d + m - 65 + 0, v += (96 - m & m - 123) >>> 8 & -d + m - 97 + 26, v;
|
|
3372
3377
|
}, f;
|
|
3373
3378
|
})(g)
|
|
3374
3379
|
);
|
|
3375
|
-
o.URLSafeCoder =
|
|
3376
|
-
var C = new
|
|
3377
|
-
function
|
|
3380
|
+
o.URLSafeCoder = y;
|
|
3381
|
+
var C = new y();
|
|
3382
|
+
function b(w) {
|
|
3378
3383
|
return C.encode(w);
|
|
3379
3384
|
}
|
|
3380
|
-
o.encodeURLSafe =
|
|
3385
|
+
o.encodeURLSafe = b;
|
|
3381
3386
|
function T(w) {
|
|
3382
3387
|
return C.decode(w);
|
|
3383
3388
|
}
|
|
@@ -3395,71 +3400,71 @@ function va() {
|
|
|
3395
3400
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
3396
3401
|
var l = "utf8: invalid string", d = "utf8: invalid source encoding";
|
|
3397
3402
|
function g(M) {
|
|
3398
|
-
for (var
|
|
3399
|
-
var T = M.charCodeAt(
|
|
3400
|
-
T < 128 ?
|
|
3403
|
+
for (var y = new Uint8Array(h(M)), C = 0, b = 0; b < M.length; b++) {
|
|
3404
|
+
var T = M.charCodeAt(b);
|
|
3405
|
+
T < 128 ? y[C++] = T : T < 2048 ? (y[C++] = 192 | T >> 6, y[C++] = 128 | T & 63) : T < 55296 ? (y[C++] = 224 | T >> 12, y[C++] = 128 | T >> 6 & 63, y[C++] = 128 | T & 63) : (b++, T = (T & 1023) << 10, T |= M.charCodeAt(b) & 1023, T += 65536, y[C++] = 240 | T >> 18, y[C++] = 128 | T >> 12 & 63, y[C++] = 128 | T >> 6 & 63, y[C++] = 128 | T & 63);
|
|
3401
3406
|
}
|
|
3402
|
-
return
|
|
3407
|
+
return y;
|
|
3403
3408
|
}
|
|
3404
3409
|
o.encode = g;
|
|
3405
3410
|
function h(M) {
|
|
3406
|
-
for (var
|
|
3407
|
-
var
|
|
3408
|
-
if (
|
|
3409
|
-
|
|
3410
|
-
else if (
|
|
3411
|
-
|
|
3412
|
-
else if (
|
|
3413
|
-
|
|
3414
|
-
else if (
|
|
3411
|
+
for (var y = 0, C = 0; C < M.length; C++) {
|
|
3412
|
+
var b = M.charCodeAt(C);
|
|
3413
|
+
if (b < 128)
|
|
3414
|
+
y += 1;
|
|
3415
|
+
else if (b < 2048)
|
|
3416
|
+
y += 2;
|
|
3417
|
+
else if (b < 55296)
|
|
3418
|
+
y += 3;
|
|
3419
|
+
else if (b <= 57343) {
|
|
3415
3420
|
if (C >= M.length - 1)
|
|
3416
3421
|
throw new Error(l);
|
|
3417
|
-
C++,
|
|
3422
|
+
C++, y += 4;
|
|
3418
3423
|
} else
|
|
3419
3424
|
throw new Error(l);
|
|
3420
3425
|
}
|
|
3421
|
-
return
|
|
3426
|
+
return y;
|
|
3422
3427
|
}
|
|
3423
3428
|
o.encodedLength = h;
|
|
3424
3429
|
function x(M) {
|
|
3425
|
-
for (var
|
|
3426
|
-
var
|
|
3427
|
-
if (
|
|
3430
|
+
for (var y = [], C = 0; C < M.length; C++) {
|
|
3431
|
+
var b = M[C];
|
|
3432
|
+
if (b & 128) {
|
|
3428
3433
|
var T = void 0;
|
|
3429
|
-
if (
|
|
3434
|
+
if (b < 224) {
|
|
3430
3435
|
if (C >= M.length)
|
|
3431
3436
|
throw new Error(d);
|
|
3432
3437
|
var w = M[++C];
|
|
3433
3438
|
if ((w & 192) !== 128)
|
|
3434
3439
|
throw new Error(d);
|
|
3435
|
-
|
|
3436
|
-
} else if (
|
|
3440
|
+
b = (b & 31) << 6 | w & 63, T = 128;
|
|
3441
|
+
} else if (b < 240) {
|
|
3437
3442
|
if (C >= M.length - 1)
|
|
3438
3443
|
throw new Error(d);
|
|
3439
3444
|
var w = M[++C], f = M[++C];
|
|
3440
3445
|
if ((w & 192) !== 128 || (f & 192) !== 128)
|
|
3441
3446
|
throw new Error(d);
|
|
3442
|
-
|
|
3443
|
-
} else if (
|
|
3447
|
+
b = (b & 15) << 12 | (w & 63) << 6 | f & 63, T = 2048;
|
|
3448
|
+
} else if (b < 248) {
|
|
3444
3449
|
if (C >= M.length - 2)
|
|
3445
3450
|
throw new Error(d);
|
|
3446
3451
|
var w = M[++C], f = M[++C], m = M[++C];
|
|
3447
3452
|
if ((w & 192) !== 128 || (f & 192) !== 128 || (m & 192) !== 128)
|
|
3448
3453
|
throw new Error(d);
|
|
3449
|
-
|
|
3454
|
+
b = (b & 15) << 18 | (w & 63) << 12 | (f & 63) << 6 | m & 63, T = 65536;
|
|
3450
3455
|
} else
|
|
3451
3456
|
throw new Error(d);
|
|
3452
|
-
if (
|
|
3457
|
+
if (b < T || b >= 55296 && b <= 57343)
|
|
3453
3458
|
throw new Error(d);
|
|
3454
|
-
if (
|
|
3455
|
-
if (
|
|
3459
|
+
if (b >= 65536) {
|
|
3460
|
+
if (b > 1114111)
|
|
3456
3461
|
throw new Error(d);
|
|
3457
|
-
|
|
3462
|
+
b -= 65536, y.push(String.fromCharCode(55296 | b >> 10)), b = 56320 | b & 1023;
|
|
3458
3463
|
}
|
|
3459
3464
|
}
|
|
3460
|
-
|
|
3465
|
+
y.push(String.fromCharCode(b));
|
|
3461
3466
|
}
|
|
3462
|
-
return
|
|
3467
|
+
return y.join("");
|
|
3463
3468
|
}
|
|
3464
3469
|
o.decode = x;
|
|
3465
3470
|
}),
|
|
@@ -3546,7 +3551,7 @@ function va() {
|
|
|
3546
3551
|
return this.getRoot(s) + "/" + t + this.options.suffix + ".js";
|
|
3547
3552
|
}
|
|
3548
3553
|
}
|
|
3549
|
-
var M = new l("_pusher_dependencies", "Pusher.DependenciesReceivers"),
|
|
3554
|
+
var M = new l("_pusher_dependencies", "Pusher.DependenciesReceivers"), y = new x({
|
|
3550
3555
|
cdn_http: h.cdn_http,
|
|
3551
3556
|
cdn_https: h.cdn_https,
|
|
3552
3557
|
version: h.VERSION,
|
|
@@ -3593,7 +3598,7 @@ function va() {
|
|
|
3593
3598
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3594
3599
|
}
|
|
3595
3600
|
}
|
|
3596
|
-
class
|
|
3601
|
+
class v extends Error {
|
|
3597
3602
|
constructor(t) {
|
|
3598
3603
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3599
3604
|
}
|
|
@@ -3618,7 +3623,7 @@ function va() {
|
|
|
3618
3623
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3619
3624
|
}
|
|
3620
3625
|
}
|
|
3621
|
-
class
|
|
3626
|
+
class U extends Error {
|
|
3622
3627
|
constructor(t) {
|
|
3623
3628
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3624
3629
|
}
|
|
@@ -3665,17 +3670,17 @@ function va() {
|
|
|
3665
3670
|
function me(r) {
|
|
3666
3671
|
return E(ae(r));
|
|
3667
3672
|
}
|
|
3668
|
-
var te = String.fromCharCode,
|
|
3673
|
+
var te = String.fromCharCode, _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", I = function(r) {
|
|
3669
3674
|
var t = r.charCodeAt(0);
|
|
3670
3675
|
return t < 128 ? r : t < 2048 ? te(192 | t >>> 6) + te(128 | t & 63) : te(224 | t >>> 12 & 15) + te(128 | t >>> 6 & 63) + te(128 | t & 63);
|
|
3671
3676
|
}, ae = function(r) {
|
|
3672
3677
|
return r.replace(/[^\x00-\x7F]/g, I);
|
|
3673
3678
|
}, B = function(r) {
|
|
3674
3679
|
var t = [0, 2, 1][r.length % 3], s = r.charCodeAt(0) << 16 | (r.length > 1 ? r.charCodeAt(1) : 0) << 8 | (r.length > 2 ? r.charCodeAt(2) : 0), a = [
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
t >= 2 ? "=" :
|
|
3678
|
-
t >= 1 ? "=" :
|
|
3680
|
+
_.charAt(s >>> 18),
|
|
3681
|
+
_.charAt(s >>> 12 & 63),
|
|
3682
|
+
t >= 2 ? "=" : _.charAt(s >>> 6 & 63),
|
|
3683
|
+
t >= 1 ? "=" : _.charAt(s & 63)
|
|
3679
3684
|
];
|
|
3680
3685
|
return a.join("");
|
|
3681
3686
|
}, E = window.btoa || function(r) {
|
|
@@ -3701,7 +3706,7 @@ function va() {
|
|
|
3701
3706
|
function A(r) {
|
|
3702
3707
|
window.clearInterval(r);
|
|
3703
3708
|
}
|
|
3704
|
-
class
|
|
3709
|
+
class O extends ne {
|
|
3705
3710
|
constructor(t, s) {
|
|
3706
3711
|
super(setTimeout, _e, t, function(a) {
|
|
3707
3712
|
return s(), null;
|
|
@@ -3720,7 +3725,7 @@ function va() {
|
|
|
3720
3725
|
return Date.now ? Date.now() : (/* @__PURE__ */ new Date()).valueOf();
|
|
3721
3726
|
},
|
|
3722
3727
|
defer(r) {
|
|
3723
|
-
return new
|
|
3728
|
+
return new O(0, r);
|
|
3724
3729
|
},
|
|
3725
3730
|
method(r, ...t) {
|
|
3726
3731
|
var s = Array.prototype.slice.call(arguments, 1);
|
|
@@ -3816,7 +3821,7 @@ function va() {
|
|
|
3816
3821
|
return !1;
|
|
3817
3822
|
return !0;
|
|
3818
3823
|
}
|
|
3819
|
-
function
|
|
3824
|
+
function ke(r) {
|
|
3820
3825
|
return we(r, function(t) {
|
|
3821
3826
|
return typeof t == "object" && (t = Ye(t)), encodeURIComponent(me(t.toString()));
|
|
3822
3827
|
});
|
|
@@ -3824,7 +3829,7 @@ function va() {
|
|
|
3824
3829
|
function K(r) {
|
|
3825
3830
|
var t = Qe(r, function(a) {
|
|
3826
3831
|
return a !== void 0;
|
|
3827
|
-
}), s = ge(ft(
|
|
3832
|
+
}), s = ge(ft(ke(t)), ue.method("join", "=")).join("&");
|
|
3828
3833
|
return s;
|
|
3829
3834
|
}
|
|
3830
3835
|
function qe(r) {
|
|
@@ -3861,7 +3866,7 @@ function va() {
|
|
|
3861
3866
|
return JSON.stringify(qe(r));
|
|
3862
3867
|
}
|
|
3863
3868
|
}
|
|
3864
|
-
class
|
|
3869
|
+
class Ms {
|
|
3865
3870
|
constructor() {
|
|
3866
3871
|
this.globalLog = (t) => {
|
|
3867
3872
|
window.console && window.console.log && window.console.log(t);
|
|
@@ -3887,7 +3892,7 @@ function va() {
|
|
|
3887
3892
|
Tt.log ? Tt.log(a) : Tt.logToConsole && t.bind(this)(a);
|
|
3888
3893
|
}
|
|
3889
3894
|
}
|
|
3890
|
-
var oe = new
|
|
3895
|
+
var oe = new Ms(), xs = function(r, t, s, a, u) {
|
|
3891
3896
|
(s.headers !== void 0 || s.headersProvider != null) && oe.warn(`To send headers with the ${a.toString()} request, you must use AJAX, rather than JSONP.`);
|
|
3892
3897
|
var p = r.nextAuthCallbackID.toString();
|
|
3893
3898
|
r.nextAuthCallbackID++;
|
|
@@ -3899,8 +3904,8 @@ function va() {
|
|
|
3899
3904
|
L.src = s.endpoint + "?callback=" + encodeURIComponent(z) + "&" + t;
|
|
3900
3905
|
var Q = S.getElementsByTagName("head")[0] || S.documentElement;
|
|
3901
3906
|
Q.insertBefore(L, Q.firstChild);
|
|
3902
|
-
},
|
|
3903
|
-
class
|
|
3907
|
+
}, ks = xs;
|
|
3908
|
+
class Ls {
|
|
3904
3909
|
constructor(t) {
|
|
3905
3910
|
this.src = t;
|
|
3906
3911
|
}
|
|
@@ -3920,7 +3925,7 @@ function va() {
|
|
|
3920
3925
|
this.script && (this.script.onload = this.script.onerror = null, this.script.onreadystatechange = null), this.script && this.script.parentNode && this.script.parentNode.removeChild(this.script), this.errorScript && this.errorScript.parentNode && this.errorScript.parentNode.removeChild(this.errorScript), this.script = null, this.errorScript = null;
|
|
3921
3926
|
}
|
|
3922
3927
|
}
|
|
3923
|
-
class
|
|
3928
|
+
class Is {
|
|
3924
3929
|
constructor(t, s) {
|
|
3925
3930
|
this.url = t, this.data = s;
|
|
3926
3931
|
}
|
|
@@ -3934,7 +3939,7 @@ function va() {
|
|
|
3934
3939
|
this.request && this.request.cleanup();
|
|
3935
3940
|
}
|
|
3936
3941
|
}
|
|
3937
|
-
var
|
|
3942
|
+
var Os = function(r, t) {
|
|
3938
3943
|
return function(s, a) {
|
|
3939
3944
|
var u = "http" + (t ? "s" : "") + "://", p = u + (r.host || r.options.host) + r.options.path, S = j.createJSONPRequest(p, s), L = j.ScriptReceivers.create(function(z, Q) {
|
|
3940
3945
|
d.remove(L), S.cleanup(), Q && Q.host && (r.host = Q.host), a && a(z, Q);
|
|
@@ -3943,8 +3948,8 @@ function va() {
|
|
|
3943
3948
|
};
|
|
3944
3949
|
}, Us = {
|
|
3945
3950
|
name: "jsonp",
|
|
3946
|
-
getAgent:
|
|
3947
|
-
},
|
|
3951
|
+
getAgent: Os
|
|
3952
|
+
}, Fs = Us;
|
|
3948
3953
|
function pt(r, t, s) {
|
|
3949
3954
|
var a = r + (t.useTLS ? "s" : ""), u = t.useTLS ? t.hostTLS : t.hostNonTLS;
|
|
3950
3955
|
return a + "://" + u + s;
|
|
@@ -3953,17 +3958,17 @@ function va() {
|
|
|
3953
3958
|
var s = "/app/" + r, a = "?protocol=" + h.PROTOCOL + "&client=js&version=" + h.VERSION + (t ? "&" + t : "");
|
|
3954
3959
|
return s + a;
|
|
3955
3960
|
}
|
|
3956
|
-
var
|
|
3961
|
+
var Ns = {
|
|
3957
3962
|
getInitial: function(r, t) {
|
|
3958
3963
|
var s = (t.httpPath || "") + gt(r, "flash=false");
|
|
3959
3964
|
return pt("ws", t, s);
|
|
3960
3965
|
}
|
|
3961
|
-
},
|
|
3966
|
+
}, Ds = {
|
|
3962
3967
|
getInitial: function(r, t) {
|
|
3963
3968
|
var s = (t.httpPath || "/pusher") + gt(r);
|
|
3964
3969
|
return pt("http", t, s);
|
|
3965
3970
|
}
|
|
3966
|
-
},
|
|
3971
|
+
}, qs = {
|
|
3967
3972
|
getInitial: function(r, t) {
|
|
3968
3973
|
return pt("http", t, t.httpPath || "/pusher");
|
|
3969
3974
|
},
|
|
@@ -3971,7 +3976,7 @@ function va() {
|
|
|
3971
3976
|
return gt(r);
|
|
3972
3977
|
}
|
|
3973
3978
|
};
|
|
3974
|
-
class
|
|
3979
|
+
class zs {
|
|
3975
3980
|
constructor() {
|
|
3976
3981
|
this._callbacks = {};
|
|
3977
3982
|
}
|
|
@@ -4011,7 +4016,7 @@ function va() {
|
|
|
4011
4016
|
}
|
|
4012
4017
|
class Te {
|
|
4013
4018
|
constructor(t) {
|
|
4014
|
-
this.callbacks = new
|
|
4019
|
+
this.callbacks = new zs(), this.global_callbacks = [], this.failThrough = t;
|
|
4015
4020
|
}
|
|
4016
4021
|
bind(t, s, a) {
|
|
4017
4022
|
return this.callbacks.add(t, s, a), this;
|
|
@@ -4039,7 +4044,7 @@ function va() {
|
|
|
4039
4044
|
return this;
|
|
4040
4045
|
}
|
|
4041
4046
|
}
|
|
4042
|
-
class
|
|
4047
|
+
class js extends Te {
|
|
4043
4048
|
constructor(t, s, a, u, p) {
|
|
4044
4049
|
super(), this.initialize = j.transportConnectionInitializer, this.hooks = t, this.name = s, this.priority = a, this.key = u, this.options = p, this.state = "new", this.timeline = p.timeline, this.activityTimeout = p.activityTimeout, this.id = this.timeline.generateUniqueID();
|
|
4045
4050
|
}
|
|
@@ -4126,11 +4131,11 @@ function va() {
|
|
|
4126
4131
|
return this.hooks.isSupported(t);
|
|
4127
4132
|
}
|
|
4128
4133
|
createConnection(t, s, a, u) {
|
|
4129
|
-
return new
|
|
4134
|
+
return new js(this.hooks, t, s, a, u);
|
|
4130
4135
|
}
|
|
4131
4136
|
}
|
|
4132
|
-
var
|
|
4133
|
-
urls:
|
|
4137
|
+
var $s = new Ne({
|
|
4138
|
+
urls: Ns,
|
|
4134
4139
|
handlesActivityChecks: !1,
|
|
4135
4140
|
supportsPing: !1,
|
|
4136
4141
|
isInitialized: function() {
|
|
@@ -4143,7 +4148,7 @@ function va() {
|
|
|
4143
4148
|
return j.createWebSocket(r);
|
|
4144
4149
|
}
|
|
4145
4150
|
}), nn = {
|
|
4146
|
-
urls:
|
|
4151
|
+
urls: Ds,
|
|
4147
4152
|
handlesActivityChecks: !1,
|
|
4148
4153
|
supportsPing: !0,
|
|
4149
4154
|
isInitialized: function() {
|
|
@@ -4161,13 +4166,13 @@ function va() {
|
|
|
4161
4166
|
isSupported: function() {
|
|
4162
4167
|
return j.isXHRSupported();
|
|
4163
4168
|
}
|
|
4164
|
-
},
|
|
4165
|
-
ws:
|
|
4166
|
-
xhr_streaming:
|
|
4167
|
-
xhr_polling:
|
|
4168
|
-
}, Ze =
|
|
4169
|
+
}, Hs = new Ne(pe({}, sn, on)), Bs = new Ne(pe({}, rn, on)), Vs = {
|
|
4170
|
+
ws: $s,
|
|
4171
|
+
xhr_streaming: Hs,
|
|
4172
|
+
xhr_polling: Bs
|
|
4173
|
+
}, Ze = Vs, Xs = new Ne({
|
|
4169
4174
|
file: "sockjs",
|
|
4170
|
-
urls:
|
|
4175
|
+
urls: qs,
|
|
4171
4176
|
handlesActivityChecks: !0,
|
|
4172
4177
|
supportsPing: !1,
|
|
4173
4178
|
isSupported: function() {
|
|
@@ -4178,7 +4183,7 @@ function va() {
|
|
|
4178
4183
|
},
|
|
4179
4184
|
getSocket: function(r, t) {
|
|
4180
4185
|
return new window.SockJS(r, null, {
|
|
4181
|
-
js_path:
|
|
4186
|
+
js_path: y.getPath("sockjs", {
|
|
4182
4187
|
useTLS: t.useTLS
|
|
4183
4188
|
}),
|
|
4184
4189
|
ignore_null_origin: t.ignoreNullOrigin
|
|
@@ -4194,10 +4199,10 @@ function va() {
|
|
|
4194
4199
|
var t = j.isXDRSupported(r.useTLS);
|
|
4195
4200
|
return t;
|
|
4196
4201
|
}
|
|
4197
|
-
},
|
|
4198
|
-
Ze.xdr_streaming =
|
|
4199
|
-
var
|
|
4200
|
-
class
|
|
4202
|
+
}, Ws = new Ne(pe({}, sn, an)), Gs = new Ne(pe({}, rn, an));
|
|
4203
|
+
Ze.xdr_streaming = Ws, Ze.xdr_polling = Gs, Ze.sockjs = Xs;
|
|
4204
|
+
var Js = Ze;
|
|
4205
|
+
class Ks extends Te {
|
|
4201
4206
|
constructor() {
|
|
4202
4207
|
super();
|
|
4203
4208
|
var t = this;
|
|
@@ -4211,8 +4216,8 @@ function va() {
|
|
|
4211
4216
|
return window.navigator.onLine === void 0 ? !0 : window.navigator.onLine;
|
|
4212
4217
|
}
|
|
4213
4218
|
}
|
|
4214
|
-
var
|
|
4215
|
-
class
|
|
4219
|
+
var Qs = new Ks();
|
|
4220
|
+
class Ys {
|
|
4216
4221
|
constructor(t, s, a) {
|
|
4217
4222
|
this.manager = t, this.transport = s, this.minPingDelay = a.minPingDelay, this.maxPingDelay = a.maxPingDelay, this.pingDelay = void 0;
|
|
4218
4223
|
}
|
|
@@ -4290,8 +4295,8 @@ function va() {
|
|
|
4290
4295
|
} : null;
|
|
4291
4296
|
}
|
|
4292
4297
|
};
|
|
4293
|
-
var
|
|
4294
|
-
class
|
|
4298
|
+
var Le = cn;
|
|
4299
|
+
class Zs extends Te {
|
|
4295
4300
|
constructor(t, s) {
|
|
4296
4301
|
super(), this.id = t, this.transport = s, this.activityTimeout = s.activityTimeout, this.bindListeners();
|
|
4297
4302
|
}
|
|
@@ -4303,7 +4308,7 @@ function va() {
|
|
|
4303
4308
|
}
|
|
4304
4309
|
send_event(t, s, a) {
|
|
4305
4310
|
var u = { event: t, data: s };
|
|
4306
|
-
return a && (u.channel = a), oe.debug("Event sent", u), this.send(
|
|
4311
|
+
return a && (u.channel = a), oe.debug("Event sent", u), this.send(Le.encodeMessage(u));
|
|
4307
4312
|
}
|
|
4308
4313
|
ping() {
|
|
4309
4314
|
this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
|
|
@@ -4316,7 +4321,7 @@ function va() {
|
|
|
4316
4321
|
message: (a) => {
|
|
4317
4322
|
var u;
|
|
4318
4323
|
try {
|
|
4319
|
-
u =
|
|
4324
|
+
u = Le.decodeMessage(a);
|
|
4320
4325
|
} catch (p) {
|
|
4321
4326
|
this.emit("error", {
|
|
4322
4327
|
type: "MessageParseError",
|
|
@@ -4361,11 +4366,11 @@ function va() {
|
|
|
4361
4366
|
});
|
|
4362
4367
|
}
|
|
4363
4368
|
handleCloseEvent(t) {
|
|
4364
|
-
var s =
|
|
4369
|
+
var s = Le.getCloseAction(t), a = Le.getCloseError(t);
|
|
4365
4370
|
a && this.emit("error", a), s && this.emit(s, { action: s, error: a });
|
|
4366
4371
|
}
|
|
4367
4372
|
}
|
|
4368
|
-
class
|
|
4373
|
+
class er {
|
|
4369
4374
|
constructor(t, s) {
|
|
4370
4375
|
this.transport = t, this.callback = s, this.bindListeners();
|
|
4371
4376
|
}
|
|
@@ -4377,18 +4382,18 @@ function va() {
|
|
|
4377
4382
|
this.unbindListeners();
|
|
4378
4383
|
var s;
|
|
4379
4384
|
try {
|
|
4380
|
-
s =
|
|
4385
|
+
s = Le.processHandshake(t);
|
|
4381
4386
|
} catch (a) {
|
|
4382
4387
|
this.finish("error", { error: a }), this.transport.close();
|
|
4383
4388
|
return;
|
|
4384
4389
|
}
|
|
4385
4390
|
s.action === "connected" ? this.finish("connected", {
|
|
4386
|
-
connection: new
|
|
4391
|
+
connection: new Zs(s.id, this.transport),
|
|
4387
4392
|
activityTimeout: s.activityTimeout
|
|
4388
4393
|
}) : (this.finish(s.action, { error: s.error }), this.transport.close());
|
|
4389
4394
|
}, this.onClosed = (t) => {
|
|
4390
4395
|
this.unbindListeners();
|
|
4391
|
-
var s =
|
|
4396
|
+
var s = Le.getCloseAction(t) || "backoff", a = Le.getCloseError(t);
|
|
4392
4397
|
this.finish(s, { error: a });
|
|
4393
4398
|
}, this.transport.bind("message", this.onMessage), this.transport.bind("closed", this.onClosed);
|
|
4394
4399
|
}
|
|
@@ -4399,7 +4404,7 @@ function va() {
|
|
|
4399
4404
|
this.callback(pe({ transport: this.transport, action: t }, s));
|
|
4400
4405
|
}
|
|
4401
4406
|
}
|
|
4402
|
-
class
|
|
4407
|
+
class tr {
|
|
4403
4408
|
constructor(t, s) {
|
|
4404
4409
|
this.timeline = t, this.options = s || {};
|
|
4405
4410
|
}
|
|
@@ -4477,7 +4482,7 @@ function va() {
|
|
|
4477
4482
|
}, s);
|
|
4478
4483
|
}
|
|
4479
4484
|
}
|
|
4480
|
-
class
|
|
4485
|
+
class nr {
|
|
4481
4486
|
constructor() {
|
|
4482
4487
|
this.reset();
|
|
4483
4488
|
}
|
|
@@ -4509,7 +4514,7 @@ function va() {
|
|
|
4509
4514
|
this.members = {}, this.count = 0, this.myID = null, this.me = null;
|
|
4510
4515
|
}
|
|
4511
4516
|
}
|
|
4512
|
-
var
|
|
4517
|
+
var sr = function(r, t, s, a) {
|
|
4513
4518
|
function u(p) {
|
|
4514
4519
|
return p instanceof s ? p : new s(function(S) {
|
|
4515
4520
|
S(p);
|
|
@@ -4536,12 +4541,12 @@ function va() {
|
|
|
4536
4541
|
Q((a = a.apply(r, t || [])).next());
|
|
4537
4542
|
});
|
|
4538
4543
|
};
|
|
4539
|
-
class
|
|
4544
|
+
class rr extends bt {
|
|
4540
4545
|
constructor(t, s) {
|
|
4541
|
-
super(t, s), this.members = new
|
|
4546
|
+
super(t, s), this.members = new nr();
|
|
4542
4547
|
}
|
|
4543
4548
|
authorize(t, s) {
|
|
4544
|
-
super.authorize(t, (a, u) =>
|
|
4549
|
+
super.authorize(t, (a, u) => sr(this, void 0, void 0, function* () {
|
|
4545
4550
|
if (!a)
|
|
4546
4551
|
if (u = u, u.channel_data != null) {
|
|
4547
4552
|
var p = JSON.parse(u.channel_data);
|
|
@@ -4591,8 +4596,8 @@ function va() {
|
|
|
4591
4596
|
this.members.reset(), super.disconnect();
|
|
4592
4597
|
}
|
|
4593
4598
|
}
|
|
4594
|
-
var
|
|
4595
|
-
class
|
|
4599
|
+
var ir = c(1), yt = c(0);
|
|
4600
|
+
class or extends bt {
|
|
4596
4601
|
constructor(t, s, a) {
|
|
4597
4602
|
super(t, s), this.key = null, this.nacl = a;
|
|
4598
4603
|
}
|
|
@@ -4658,7 +4663,7 @@ function va() {
|
|
|
4658
4663
|
this.emit(t, this.getDataToEmit(p));
|
|
4659
4664
|
}
|
|
4660
4665
|
getDataToEmit(t) {
|
|
4661
|
-
let s = Object(
|
|
4666
|
+
let s = Object(ir.decode)(t);
|
|
4662
4667
|
try {
|
|
4663
4668
|
return JSON.parse(s);
|
|
4664
4669
|
} catch {
|
|
@@ -4666,7 +4671,7 @@ function va() {
|
|
|
4666
4671
|
}
|
|
4667
4672
|
}
|
|
4668
4673
|
}
|
|
4669
|
-
class
|
|
4674
|
+
class ar extends Te {
|
|
4670
4675
|
constructor(t, s) {
|
|
4671
4676
|
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);
|
|
4672
4677
|
var a = j.getNetwork();
|
|
@@ -4723,7 +4728,7 @@ function va() {
|
|
|
4723
4728
|
});
|
|
4724
4729
|
}
|
|
4725
4730
|
retryIn(t) {
|
|
4726
|
-
this.timeline.info({ action: "retry", delay: t }), t > 0 && this.emit("connecting_in", Math.round(t / 1e3)), this.retryTimer = new
|
|
4731
|
+
this.timeline.info({ action: "retry", delay: t }), t > 0 && this.emit("connecting_in", Math.round(t / 1e3)), this.retryTimer = new O(t || 0, () => {
|
|
4727
4732
|
this.disconnectInternally(), this.connect();
|
|
4728
4733
|
});
|
|
4729
4734
|
}
|
|
@@ -4731,7 +4736,7 @@ function va() {
|
|
|
4731
4736
|
this.retryTimer && (this.retryTimer.ensureAborted(), this.retryTimer = null);
|
|
4732
4737
|
}
|
|
4733
4738
|
setUnavailableTimer() {
|
|
4734
|
-
this.unavailableTimer = new
|
|
4739
|
+
this.unavailableTimer = new O(this.options.unavailableTimeout, () => {
|
|
4735
4740
|
this.updateState("unavailable");
|
|
4736
4741
|
});
|
|
4737
4742
|
}
|
|
@@ -4739,12 +4744,12 @@ function va() {
|
|
|
4739
4744
|
this.unavailableTimer && this.unavailableTimer.ensureAborted();
|
|
4740
4745
|
}
|
|
4741
4746
|
sendActivityCheck() {
|
|
4742
|
-
this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new
|
|
4747
|
+
this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new O(this.options.pongTimeout, () => {
|
|
4743
4748
|
this.timeline.error({ pong_timed_out: this.options.pongTimeout }), this.retryIn(0);
|
|
4744
4749
|
});
|
|
4745
4750
|
}
|
|
4746
4751
|
resetActivityCheck() {
|
|
4747
|
-
this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new
|
|
4752
|
+
this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new O(this.activityTimeout, () => {
|
|
4748
4753
|
this.sendActivityCheck();
|
|
4749
4754
|
}));
|
|
4750
4755
|
}
|
|
@@ -4822,12 +4827,12 @@ function va() {
|
|
|
4822
4827
|
return this.state === "connecting" || this.state === "connected";
|
|
4823
4828
|
}
|
|
4824
4829
|
}
|
|
4825
|
-
class
|
|
4830
|
+
class cr {
|
|
4826
4831
|
constructor() {
|
|
4827
4832
|
this.channels = {};
|
|
4828
4833
|
}
|
|
4829
4834
|
add(t, s) {
|
|
4830
|
-
return this.channels[t] || (this.channels[t] =
|
|
4835
|
+
return this.channels[t] || (this.channels[t] = ur(t, s)), this.channels[t];
|
|
4831
4836
|
}
|
|
4832
4837
|
all() {
|
|
4833
4838
|
return X(this.channels);
|
|
@@ -4845,7 +4850,7 @@ function va() {
|
|
|
4845
4850
|
});
|
|
4846
4851
|
}
|
|
4847
4852
|
}
|
|
4848
|
-
function
|
|
4853
|
+
function ur(r, t) {
|
|
4849
4854
|
if (r.indexOf("private-encrypted-") === 0) {
|
|
4850
4855
|
if (t.config.nacl)
|
|
4851
4856
|
return Ee.createEncryptedChannel(r, t, t.config.nacl);
|
|
@@ -4861,12 +4866,12 @@ function va() {
|
|
|
4861
4866
|
return Ee.createChannel(r, t);
|
|
4862
4867
|
}
|
|
4863
4868
|
}
|
|
4864
|
-
var
|
|
4869
|
+
var lr = {
|
|
4865
4870
|
createChannels() {
|
|
4866
|
-
return new
|
|
4871
|
+
return new cr();
|
|
4867
4872
|
},
|
|
4868
4873
|
createConnectionManager(r, t) {
|
|
4869
|
-
return new
|
|
4874
|
+
return new ar(r, t);
|
|
4870
4875
|
},
|
|
4871
4876
|
createChannel(r, t) {
|
|
4872
4877
|
return new vt(r, t);
|
|
@@ -4875,21 +4880,21 @@ function va() {
|
|
|
4875
4880
|
return new bt(r, t);
|
|
4876
4881
|
},
|
|
4877
4882
|
createPresenceChannel(r, t) {
|
|
4878
|
-
return new
|
|
4883
|
+
return new rr(r, t);
|
|
4879
4884
|
},
|
|
4880
4885
|
createEncryptedChannel(r, t, s) {
|
|
4881
|
-
return new
|
|
4886
|
+
return new or(r, t, s);
|
|
4882
4887
|
},
|
|
4883
4888
|
createTimelineSender(r, t) {
|
|
4884
|
-
return new
|
|
4889
|
+
return new tr(r, t);
|
|
4885
4890
|
},
|
|
4886
4891
|
createHandshake(r, t) {
|
|
4887
|
-
return new
|
|
4892
|
+
return new er(r, t);
|
|
4888
4893
|
},
|
|
4889
4894
|
createAssistantToTheTransportManager(r, t, s) {
|
|
4890
|
-
return new
|
|
4895
|
+
return new Ys(r, t, s);
|
|
4891
4896
|
}
|
|
4892
|
-
}, Ee =
|
|
4897
|
+
}, Ee = lr;
|
|
4893
4898
|
class un {
|
|
4894
4899
|
constructor(t) {
|
|
4895
4900
|
this.options = t || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
@@ -4907,7 +4912,7 @@ function va() {
|
|
|
4907
4912
|
this.livesLeft -= 1;
|
|
4908
4913
|
}
|
|
4909
4914
|
}
|
|
4910
|
-
class
|
|
4915
|
+
class Ie {
|
|
4911
4916
|
constructor(t, s) {
|
|
4912
4917
|
this.strategies = t, this.loop = !!s.loop, this.failFast = !!s.failFast, this.timeout = s.timeout, this.timeoutLimit = s.timeoutLimit;
|
|
4913
4918
|
}
|
|
@@ -4929,7 +4934,7 @@ function va() {
|
|
|
4929
4934
|
}
|
|
4930
4935
|
tryStrategy(t, s, a, u) {
|
|
4931
4936
|
var p = null, S = null;
|
|
4932
|
-
return a.timeout > 0 && (p = new
|
|
4937
|
+
return a.timeout > 0 && (p = new O(a.timeout, function() {
|
|
4933
4938
|
S.abort(), u(!0);
|
|
4934
4939
|
})), S = t.connect(s, function(L, z) {
|
|
4935
4940
|
L && p && p.isRunning() && !a.failFast || (p && p.ensureAborted(), u(L, z));
|
|
@@ -4951,10 +4956,10 @@ function va() {
|
|
|
4951
4956
|
return ye(this.strategies, ue.method("isSupported"));
|
|
4952
4957
|
}
|
|
4953
4958
|
connect(t, s) {
|
|
4954
|
-
return
|
|
4959
|
+
return dr(this.strategies, t, function(a, u) {
|
|
4955
4960
|
return function(p, S) {
|
|
4956
4961
|
if (u[a].error = p, p) {
|
|
4957
|
-
|
|
4962
|
+
hr(u) && s(!0);
|
|
4958
4963
|
return;
|
|
4959
4964
|
}
|
|
4960
4965
|
Y(u, function(L) {
|
|
@@ -4964,13 +4969,13 @@ function va() {
|
|
|
4964
4969
|
});
|
|
4965
4970
|
}
|
|
4966
4971
|
}
|
|
4967
|
-
function
|
|
4972
|
+
function dr(r, t, s) {
|
|
4968
4973
|
var a = ge(r, function(u, p, S, L) {
|
|
4969
4974
|
return u.connect(t, s(p, L));
|
|
4970
4975
|
});
|
|
4971
4976
|
return {
|
|
4972
4977
|
abort: function() {
|
|
4973
|
-
Y(a,
|
|
4978
|
+
Y(a, fr);
|
|
4974
4979
|
},
|
|
4975
4980
|
forceMinPriority: function(u) {
|
|
4976
4981
|
Y(a, function(p) {
|
|
@@ -4979,15 +4984,15 @@ function va() {
|
|
|
4979
4984
|
}
|
|
4980
4985
|
};
|
|
4981
4986
|
}
|
|
4982
|
-
function
|
|
4987
|
+
function hr(r) {
|
|
4983
4988
|
return Ce(r, function(t) {
|
|
4984
4989
|
return !!t.error;
|
|
4985
4990
|
});
|
|
4986
4991
|
}
|
|
4987
|
-
function
|
|
4992
|
+
function fr(r) {
|
|
4988
4993
|
!r.error && !r.aborted && (r.abort(), r.aborted = !0);
|
|
4989
4994
|
}
|
|
4990
|
-
class
|
|
4995
|
+
class pr {
|
|
4991
4996
|
constructor(t, s, a) {
|
|
4992
4997
|
this.strategy = t, this.transports = s, this.ttl = a.ttl || 1800 * 1e3, this.usingTLS = a.useTLS, this.timeline = a.timeline;
|
|
4993
4998
|
}
|
|
@@ -4995,20 +5000,20 @@ function va() {
|
|
|
4995
5000
|
return this.strategy.isSupported();
|
|
4996
5001
|
}
|
|
4997
5002
|
connect(t, s) {
|
|
4998
|
-
var a = this.usingTLS, u =
|
|
5003
|
+
var a = this.usingTLS, u = gr(a), p = u && u.cacheSkipCount ? u.cacheSkipCount : 0, S = [this.strategy];
|
|
4999
5004
|
if (u && u.timestamp + this.ttl >= ue.now()) {
|
|
5000
5005
|
var L = this.transports[u.transport];
|
|
5001
5006
|
L && (["ws", "wss"].includes(u.transport) || p > 3 ? (this.timeline.info({
|
|
5002
5007
|
cached: !0,
|
|
5003
5008
|
transport: u.transport,
|
|
5004
5009
|
latency: u.latency
|
|
5005
|
-
}), S.push(new
|
|
5010
|
+
}), S.push(new Ie([L], {
|
|
5006
5011
|
timeout: u.latency * 2 + 1e3,
|
|
5007
5012
|
failFast: !0
|
|
5008
5013
|
}))) : p++);
|
|
5009
5014
|
}
|
|
5010
5015
|
var z = ue.now(), Q = S.pop().connect(t, function ee(ce, nt) {
|
|
5011
|
-
ce ? (ln(a), S.length > 0 ? (z = ue.now(), Q = S.pop().connect(t, ee)) : s(ce)) : (
|
|
5016
|
+
ce ? (ln(a), S.length > 0 ? (z = ue.now(), Q = S.pop().connect(t, ee)) : s(ce)) : (mr(a, nt.transport.name, ue.now() - z, p), s(null, nt));
|
|
5012
5017
|
});
|
|
5013
5018
|
return {
|
|
5014
5019
|
abort: function() {
|
|
@@ -5023,7 +5028,7 @@ function va() {
|
|
|
5023
5028
|
function St(r) {
|
|
5024
5029
|
return "pusherTransport" + (r ? "TLS" : "NonTLS");
|
|
5025
5030
|
}
|
|
5026
|
-
function
|
|
5031
|
+
function gr(r) {
|
|
5027
5032
|
var t = j.getLocalStorage();
|
|
5028
5033
|
if (t)
|
|
5029
5034
|
try {
|
|
@@ -5035,7 +5040,7 @@ function va() {
|
|
|
5035
5040
|
}
|
|
5036
5041
|
return null;
|
|
5037
5042
|
}
|
|
5038
|
-
function
|
|
5043
|
+
function mr(r, t, s, a) {
|
|
5039
5044
|
var u = j.getLocalStorage();
|
|
5040
5045
|
if (u)
|
|
5041
5046
|
try {
|
|
@@ -5064,7 +5069,7 @@ function va() {
|
|
|
5064
5069
|
return this.strategy.isSupported();
|
|
5065
5070
|
}
|
|
5066
5071
|
connect(t, s) {
|
|
5067
|
-
var a = this.strategy, u, p = new
|
|
5072
|
+
var a = this.strategy, u, p = new O(this.options.delay, function() {
|
|
5068
5073
|
u = a.connect(t, s);
|
|
5069
5074
|
});
|
|
5070
5075
|
return {
|
|
@@ -5090,7 +5095,7 @@ function va() {
|
|
|
5090
5095
|
return a.connect(t, s);
|
|
5091
5096
|
}
|
|
5092
5097
|
}
|
|
5093
|
-
class
|
|
5098
|
+
class vr {
|
|
5094
5099
|
constructor(t) {
|
|
5095
5100
|
this.strategy = t;
|
|
5096
5101
|
}
|
|
@@ -5109,10 +5114,10 @@ function va() {
|
|
|
5109
5114
|
return r.isSupported();
|
|
5110
5115
|
};
|
|
5111
5116
|
}
|
|
5112
|
-
var
|
|
5117
|
+
var br = function(r, t, s) {
|
|
5113
5118
|
var a = {};
|
|
5114
|
-
function u(Sn,
|
|
5115
|
-
var Cn = s(r, Sn,
|
|
5119
|
+
function u(Sn, vi, bi, yi, _i) {
|
|
5120
|
+
var Cn = s(r, Sn, vi, bi, yi, _i);
|
|
5116
5121
|
return a[Sn] = Cn, Cn;
|
|
5117
5122
|
}
|
|
5118
5123
|
var p = Object.assign({}, t, {
|
|
@@ -5136,40 +5141,40 @@ function va() {
|
|
|
5136
5141
|
lives: 2,
|
|
5137
5142
|
minPingDelay: 1e4,
|
|
5138
5143
|
maxPingDelay: r.activityTimeout
|
|
5139
|
-
}), ce = u("ws", "ws", 3, p, Q), nt = u("wss", "ws", 3, S, Q),
|
|
5140
|
-
new ze(je(gn), gn,
|
|
5141
|
-
], z), yn = new
|
|
5142
|
-
new ze(je(mn), mn,
|
|
5143
|
-
], z), _n = new
|
|
5144
|
+
}), ce = u("ws", "ws", 3, p, Q), nt = u("wss", "ws", 3, S, Q), hi = u("sockjs", "sockjs", 1, L), gn = u("xhr_streaming", "xhr_streaming", 1, L, ee), fi = u("xdr_streaming", "xdr_streaming", 1, L, ee), mn = u("xhr_polling", "xhr_polling", 1, L), pi = u("xdr_polling", "xdr_polling", 1, L), vn = new Ie([ce], z), gi = new Ie([nt], z), mi = new Ie([hi], z), bn = new Ie([
|
|
5145
|
+
new ze(je(gn), gn, fi)
|
|
5146
|
+
], z), yn = new Ie([
|
|
5147
|
+
new ze(je(mn), mn, pi)
|
|
5148
|
+
], z), _n = new Ie([
|
|
5144
5149
|
new ze(je(bn), new _t([
|
|
5145
5150
|
bn,
|
|
5146
5151
|
new et(yn, { delay: 4e3 })
|
|
5147
5152
|
]), yn)
|
|
5148
|
-
], z), Et = new ze(je(_n), _n,
|
|
5153
|
+
], z), Et = new ze(je(_n), _n, mi), At;
|
|
5149
5154
|
return t.useTLS ? At = new _t([
|
|
5150
5155
|
vn,
|
|
5151
5156
|
new et(Et, { delay: 2e3 })
|
|
5152
5157
|
]) : At = new _t([
|
|
5153
5158
|
vn,
|
|
5154
|
-
new et(
|
|
5159
|
+
new et(gi, { delay: 2e3 }),
|
|
5155
5160
|
new et(Et, { delay: 5e3 })
|
|
5156
|
-
]), new
|
|
5161
|
+
]), new pr(new vr(new ze(je(ce), At, Et)), a, {
|
|
5157
5162
|
ttl: 18e5,
|
|
5158
5163
|
timeline: t.timeline,
|
|
5159
5164
|
useTLS: t.useTLS
|
|
5160
5165
|
});
|
|
5161
|
-
},
|
|
5166
|
+
}, yr = br, _r = (function() {
|
|
5162
5167
|
var r = this;
|
|
5163
5168
|
r.timeline.info(r.buildTimelineMessage({
|
|
5164
5169
|
transport: r.name + (r.options.useTLS ? "s" : "")
|
|
5165
|
-
})), r.hooks.isInitialized() ? r.changeState("initialized") : r.hooks.file ? (r.changeState("initializing"),
|
|
5170
|
+
})), r.hooks.isInitialized() ? r.changeState("initialized") : r.hooks.file ? (r.changeState("initializing"), y.load(r.hooks.file, { useTLS: r.options.useTLS }, function(t, s) {
|
|
5166
5171
|
r.hooks.isInitialized() ? (r.changeState("initialized"), s(!0)) : (t && r.onError(t), r.onClose(), s(!1));
|
|
5167
5172
|
})) : r.onClose();
|
|
5168
|
-
}),
|
|
5173
|
+
}), Sr = {
|
|
5169
5174
|
getRequest: function(r) {
|
|
5170
5175
|
var t = new window.XDomainRequest();
|
|
5171
5176
|
return t.ontimeout = function() {
|
|
5172
|
-
r.emit("error", new
|
|
5177
|
+
r.emit("error", new v()), r.close();
|
|
5173
5178
|
}, t.onerror = function(s) {
|
|
5174
5179
|
r.emit("error", s), r.close();
|
|
5175
5180
|
}, t.onprogress = function() {
|
|
@@ -5181,9 +5186,9 @@ function va() {
|
|
|
5181
5186
|
abortRequest: function(r) {
|
|
5182
5187
|
r.ontimeout = r.onerror = r.onprogress = r.onload = null, r.abort();
|
|
5183
5188
|
}
|
|
5184
|
-
},
|
|
5185
|
-
const
|
|
5186
|
-
class
|
|
5189
|
+
}, Cr = Sr;
|
|
5190
|
+
const wr = 256 * 1024;
|
|
5191
|
+
class Tr extends Te {
|
|
5187
5192
|
constructor(t, s, a) {
|
|
5188
5193
|
super(), this.hooks = t, this.method = s, this.url = a;
|
|
5189
5194
|
}
|
|
@@ -5211,17 +5216,17 @@ function va() {
|
|
|
5211
5216
|
return a !== -1 ? (this.position += a + 1, s.slice(0, a)) : null;
|
|
5212
5217
|
}
|
|
5213
5218
|
isBufferTooLong(t) {
|
|
5214
|
-
return this.position === t.length && t.length >
|
|
5219
|
+
return this.position === t.length && t.length > wr;
|
|
5215
5220
|
}
|
|
5216
5221
|
}
|
|
5217
5222
|
var Ct;
|
|
5218
5223
|
(function(r) {
|
|
5219
5224
|
r[r.CONNECTING = 0] = "CONNECTING", r[r.OPEN = 1] = "OPEN", r[r.CLOSED = 3] = "CLOSED";
|
|
5220
5225
|
})(Ct || (Ct = {}));
|
|
5221
|
-
var
|
|
5222
|
-
class
|
|
5226
|
+
var Oe = Ct, Er = 1;
|
|
5227
|
+
class Ar {
|
|
5223
5228
|
constructor(t, s) {
|
|
5224
|
-
this.hooks = t, this.session = hn(1e3) + "/" +
|
|
5229
|
+
this.hooks = t, this.session = hn(1e3) + "/" + xr(8), this.location = Rr(s), this.readyState = Oe.CONNECTING, this.openStream();
|
|
5225
5230
|
}
|
|
5226
5231
|
send(t) {
|
|
5227
5232
|
return this.sendRaw(JSON.stringify([t]));
|
|
@@ -5233,9 +5238,9 @@ function va() {
|
|
|
5233
5238
|
this.onClose(t, s, !0);
|
|
5234
5239
|
}
|
|
5235
5240
|
sendRaw(t) {
|
|
5236
|
-
if (this.readyState ===
|
|
5241
|
+
if (this.readyState === Oe.OPEN)
|
|
5237
5242
|
try {
|
|
5238
|
-
return j.createSocketRequest("POST", dn(
|
|
5243
|
+
return j.createSocketRequest("POST", dn(Pr(this.location, this.session))).start(t), !0;
|
|
5239
5244
|
} catch {
|
|
5240
5245
|
return !1;
|
|
5241
5246
|
}
|
|
@@ -5246,7 +5251,7 @@ function va() {
|
|
|
5246
5251
|
this.closeStream(), this.openStream();
|
|
5247
5252
|
}
|
|
5248
5253
|
onClose(t, s, a) {
|
|
5249
|
-
this.closeStream(), this.readyState =
|
|
5254
|
+
this.closeStream(), this.readyState = Oe.CLOSED, this.onclose && this.onclose({
|
|
5250
5255
|
code: t,
|
|
5251
5256
|
reason: s,
|
|
5252
5257
|
wasClean: a
|
|
@@ -5254,7 +5259,7 @@ function va() {
|
|
|
5254
5259
|
}
|
|
5255
5260
|
onChunk(t) {
|
|
5256
5261
|
if (t.status === 200) {
|
|
5257
|
-
this.readyState ===
|
|
5262
|
+
this.readyState === Oe.OPEN && this.onActivity();
|
|
5258
5263
|
var s, a = t.data.slice(0, 1);
|
|
5259
5264
|
switch (a) {
|
|
5260
5265
|
case "o":
|
|
@@ -5278,10 +5283,10 @@ function va() {
|
|
|
5278
5283
|
}
|
|
5279
5284
|
}
|
|
5280
5285
|
onOpen(t) {
|
|
5281
|
-
this.readyState ===
|
|
5286
|
+
this.readyState === Oe.CONNECTING ? (t && t.hostname && (this.location.base = Mr(this.location.base, t.hostname)), this.readyState = Oe.OPEN, this.onopen && this.onopen()) : this.onClose(1006, "Server lost session", !0);
|
|
5282
5287
|
}
|
|
5283
5288
|
onEvent(t) {
|
|
5284
|
-
this.readyState ===
|
|
5289
|
+
this.readyState === Oe.OPEN && this.onmessage && this.onmessage({ data: t });
|
|
5285
5290
|
}
|
|
5286
5291
|
onActivity() {
|
|
5287
5292
|
this.onactivity && this.onactivity();
|
|
@@ -5309,33 +5314,33 @@ function va() {
|
|
|
5309
5314
|
this.stream && (this.stream.unbind_all(), this.stream.close(), this.stream = null);
|
|
5310
5315
|
}
|
|
5311
5316
|
}
|
|
5312
|
-
function
|
|
5317
|
+
function Rr(r) {
|
|
5313
5318
|
var t = /([^\?]*)\/*(\??.*)/.exec(r);
|
|
5314
5319
|
return {
|
|
5315
5320
|
base: t[1],
|
|
5316
5321
|
queryString: t[2]
|
|
5317
5322
|
};
|
|
5318
5323
|
}
|
|
5319
|
-
function
|
|
5324
|
+
function Pr(r, t) {
|
|
5320
5325
|
return r.base + "/" + t + "/xhr_send";
|
|
5321
5326
|
}
|
|
5322
5327
|
function dn(r) {
|
|
5323
5328
|
var t = r.indexOf("?") === -1 ? "?" : "&";
|
|
5324
|
-
return r + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" +
|
|
5329
|
+
return r + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" + Er++;
|
|
5325
5330
|
}
|
|
5326
|
-
function
|
|
5331
|
+
function Mr(r, t) {
|
|
5327
5332
|
var s = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(r);
|
|
5328
5333
|
return s[1] + t + s[3];
|
|
5329
5334
|
}
|
|
5330
5335
|
function hn(r) {
|
|
5331
5336
|
return j.randomInt(r);
|
|
5332
5337
|
}
|
|
5333
|
-
function
|
|
5338
|
+
function xr(r) {
|
|
5334
5339
|
for (var t = [], s = 0; s < r; s++)
|
|
5335
5340
|
t.push(hn(32).toString(32));
|
|
5336
5341
|
return t.join("");
|
|
5337
5342
|
}
|
|
5338
|
-
var
|
|
5343
|
+
var kr = Ar, Lr = {
|
|
5339
5344
|
getReceiveURL: function(r, t) {
|
|
5340
5345
|
return r.base + "/" + t + "/xhr_streaming" + r.queryString;
|
|
5341
5346
|
},
|
|
@@ -5348,7 +5353,7 @@ function va() {
|
|
|
5348
5353
|
onFinished: function(r, t) {
|
|
5349
5354
|
r.onClose(1006, "Connection interrupted (" + t + ")", !1);
|
|
5350
5355
|
}
|
|
5351
|
-
},
|
|
5356
|
+
}, Ir = Lr, Or = {
|
|
5352
5357
|
getReceiveURL: function(r, t) {
|
|
5353
5358
|
return r.base + "/" + t + "/xhr" + r.queryString;
|
|
5354
5359
|
},
|
|
@@ -5360,7 +5365,7 @@ function va() {
|
|
|
5360
5365
|
onFinished: function(r, t) {
|
|
5361
5366
|
t === 200 ? r.reconnect() : r.onClose(1006, "Connection interrupted (" + t + ")", !1);
|
|
5362
5367
|
}
|
|
5363
|
-
}, Ur =
|
|
5368
|
+
}, Ur = Or, Fr = {
|
|
5364
5369
|
getRequest: function(r) {
|
|
5365
5370
|
var t = j.getXHRAPI(), s = new t();
|
|
5366
5371
|
return s.onreadystatechange = s.onprogress = function() {
|
|
@@ -5377,36 +5382,36 @@ function va() {
|
|
|
5377
5382
|
abortRequest: function(r) {
|
|
5378
5383
|
r.onreadystatechange = null, r.abort();
|
|
5379
5384
|
}
|
|
5380
|
-
},
|
|
5385
|
+
}, Nr = Fr, Dr = {
|
|
5381
5386
|
createStreamingSocket(r) {
|
|
5382
|
-
return this.createSocket(
|
|
5387
|
+
return this.createSocket(Ir, r);
|
|
5383
5388
|
},
|
|
5384
5389
|
createPollingSocket(r) {
|
|
5385
5390
|
return this.createSocket(Ur, r);
|
|
5386
5391
|
},
|
|
5387
5392
|
createSocket(r, t) {
|
|
5388
|
-
return new
|
|
5393
|
+
return new kr(r, t);
|
|
5389
5394
|
},
|
|
5390
5395
|
createXHR(r, t) {
|
|
5391
|
-
return this.createRequest(
|
|
5396
|
+
return this.createRequest(Nr, r, t);
|
|
5392
5397
|
},
|
|
5393
5398
|
createRequest(r, t, s) {
|
|
5394
|
-
return new
|
|
5399
|
+
return new Tr(r, t, s);
|
|
5395
5400
|
}
|
|
5396
|
-
}, fn =
|
|
5401
|
+
}, fn = Dr;
|
|
5397
5402
|
fn.createXDR = function(r, t) {
|
|
5398
|
-
return this.createRequest(
|
|
5403
|
+
return this.createRequest(Cr, r, t);
|
|
5399
5404
|
};
|
|
5400
|
-
var
|
|
5405
|
+
var qr = fn, zr = {
|
|
5401
5406
|
nextAuthCallbackID: 1,
|
|
5402
5407
|
auth_callbacks: {},
|
|
5403
5408
|
ScriptReceivers: d,
|
|
5404
5409
|
DependenciesReceivers: M,
|
|
5405
|
-
getDefaultStrategy:
|
|
5406
|
-
Transports:
|
|
5407
|
-
transportConnectionInitializer:
|
|
5408
|
-
HTTPFactory:
|
|
5409
|
-
TimelineTransport:
|
|
5410
|
+
getDefaultStrategy: yr,
|
|
5411
|
+
Transports: Js,
|
|
5412
|
+
transportConnectionInitializer: _r,
|
|
5413
|
+
HTTPFactory: qr,
|
|
5414
|
+
TimelineTransport: Fs,
|
|
5410
5415
|
getXHRAPI() {
|
|
5411
5416
|
return window.XMLHttpRequest;
|
|
5412
5417
|
},
|
|
@@ -5418,7 +5423,7 @@ function va() {
|
|
|
5418
5423
|
var t = () => {
|
|
5419
5424
|
this.onDocumentBody(r.ready);
|
|
5420
5425
|
};
|
|
5421
|
-
window.JSON ? t() :
|
|
5426
|
+
window.JSON ? t() : y.load("json2", {}, t);
|
|
5422
5427
|
},
|
|
5423
5428
|
getDocument() {
|
|
5424
5429
|
return document;
|
|
@@ -5427,7 +5432,7 @@ function va() {
|
|
|
5427
5432
|
return this.getDocument().location.protocol;
|
|
5428
5433
|
},
|
|
5429
5434
|
getAuthorizers() {
|
|
5430
|
-
return { ajax: J, jsonp:
|
|
5435
|
+
return { ajax: J, jsonp: ks };
|
|
5431
5436
|
},
|
|
5432
5437
|
onDocumentBody(r) {
|
|
5433
5438
|
document.body ? r() : setTimeout(() => {
|
|
@@ -5435,10 +5440,10 @@ function va() {
|
|
|
5435
5440
|
}, 0);
|
|
5436
5441
|
},
|
|
5437
5442
|
createJSONPRequest(r, t) {
|
|
5438
|
-
return new
|
|
5443
|
+
return new Is(r, t);
|
|
5439
5444
|
},
|
|
5440
5445
|
createScriptRequest(r) {
|
|
5441
|
-
return new
|
|
5446
|
+
return new Ls(r);
|
|
5442
5447
|
},
|
|
5443
5448
|
getLocalStorage() {
|
|
5444
5449
|
try {
|
|
@@ -5458,7 +5463,7 @@ function va() {
|
|
|
5458
5463
|
return new ActiveXObject("Microsoft.XMLHTTP");
|
|
5459
5464
|
},
|
|
5460
5465
|
getNetwork() {
|
|
5461
|
-
return
|
|
5466
|
+
return Qs;
|
|
5462
5467
|
},
|
|
5463
5468
|
createWebSocket(r) {
|
|
5464
5469
|
var t = this.getWebSocketAPI();
|
|
@@ -5490,12 +5495,12 @@ function va() {
|
|
|
5490
5495
|
return (window.crypto || window.msCrypto).getRandomValues(new Uint32Array(1))[0] / Math.pow(2, 32);
|
|
5491
5496
|
}() * r);
|
|
5492
5497
|
}
|
|
5493
|
-
}, j =
|
|
5498
|
+
}, j = zr, wt;
|
|
5494
5499
|
(function(r) {
|
|
5495
5500
|
r[r.ERROR = 3] = "ERROR", r[r.INFO = 6] = "INFO", r[r.DEBUG = 7] = "DEBUG";
|
|
5496
5501
|
})(wt || (wt = {}));
|
|
5497
5502
|
var tt = wt;
|
|
5498
|
-
class
|
|
5503
|
+
class jr {
|
|
5499
5504
|
constructor(t, s, a) {
|
|
5500
5505
|
this.key = t, this.session = s, this.events = [], this.options = a || {}, this.sent = 0, this.uniqueID = 0;
|
|
5501
5506
|
}
|
|
@@ -5533,7 +5538,7 @@ function va() {
|
|
|
5533
5538
|
return this.uniqueID++, this.uniqueID;
|
|
5534
5539
|
}
|
|
5535
5540
|
}
|
|
5536
|
-
class
|
|
5541
|
+
class $r {
|
|
5537
5542
|
constructor(t, s, a, u) {
|
|
5538
5543
|
this.name = t, this.priority = s, this.transport = a, this.options = u || {};
|
|
5539
5544
|
}
|
|
@@ -5546,7 +5551,7 @@ function va() {
|
|
|
5546
5551
|
if (this.isSupported()) {
|
|
5547
5552
|
if (this.priority < t)
|
|
5548
5553
|
return pn(new N(), s);
|
|
5549
|
-
} else return pn(new
|
|
5554
|
+
} else return pn(new U(), s);
|
|
5550
5555
|
var a = !1, u = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), p = null, S = function() {
|
|
5551
5556
|
u.unbind("initialized", S), u.connect();
|
|
5552
5557
|
}, L = function() {
|
|
@@ -5582,20 +5587,20 @@ function va() {
|
|
|
5582
5587
|
}
|
|
5583
5588
|
};
|
|
5584
5589
|
}
|
|
5585
|
-
const { Transports:
|
|
5586
|
-
var
|
|
5587
|
-
var S =
|
|
5590
|
+
const { Transports: Hr } = j;
|
|
5591
|
+
var Br = function(r, t, s, a, u, p) {
|
|
5592
|
+
var S = Hr[s];
|
|
5588
5593
|
if (!S)
|
|
5589
5594
|
throw new k(s);
|
|
5590
5595
|
var L = (!r.enabledTransports || R(r.enabledTransports, t) !== -1) && (!r.disabledTransports || R(r.disabledTransports, t) === -1), z;
|
|
5591
|
-
return L ? (u = Object.assign({ ignoreNullOrigin: r.ignoreNullOrigin }, u), z = new
|
|
5592
|
-
},
|
|
5596
|
+
return L ? (u = Object.assign({ ignoreNullOrigin: r.ignoreNullOrigin }, u), z = new $r(t, a, p ? p.getAssistant(S) : S, u)) : z = Vr, z;
|
|
5597
|
+
}, Vr = {
|
|
5593
5598
|
isSupported: function() {
|
|
5594
5599
|
return !1;
|
|
5595
5600
|
},
|
|
5596
5601
|
connect: function(r, t) {
|
|
5597
5602
|
var s = ue.defer(function() {
|
|
5598
|
-
t(new
|
|
5603
|
+
t(new U());
|
|
5599
5604
|
});
|
|
5600
5605
|
return {
|
|
5601
5606
|
abort: function() {
|
|
@@ -5606,14 +5611,14 @@ function va() {
|
|
|
5606
5611
|
};
|
|
5607
5612
|
}
|
|
5608
5613
|
};
|
|
5609
|
-
function
|
|
5614
|
+
function Xr(r) {
|
|
5610
5615
|
if (r == null)
|
|
5611
5616
|
throw "You must pass an options object";
|
|
5612
5617
|
if (r.cluster == null)
|
|
5613
5618
|
throw "Options object must provide a cluster";
|
|
5614
5619
|
"disableStats" in r && oe.warn("The disableStats option is deprecated in favor of enableStats");
|
|
5615
5620
|
}
|
|
5616
|
-
const
|
|
5621
|
+
const Wr = (r, t) => {
|
|
5617
5622
|
var s = "socket_id=" + encodeURIComponent(r.socketId);
|
|
5618
5623
|
for (var a in t.params)
|
|
5619
5624
|
s += "&" + encodeURIComponent(a) + "=" + encodeURIComponent(t.params[a]);
|
|
@@ -5624,15 +5629,15 @@ function va() {
|
|
|
5624
5629
|
}
|
|
5625
5630
|
return s;
|
|
5626
5631
|
};
|
|
5627
|
-
var
|
|
5632
|
+
var Gr = (r) => {
|
|
5628
5633
|
if (typeof j.getAuthorizers()[r.transport] > "u")
|
|
5629
5634
|
throw `'${r.transport}' is not a recognized auth transport`;
|
|
5630
5635
|
return (t, s) => {
|
|
5631
|
-
const a =
|
|
5636
|
+
const a = Wr(t, r);
|
|
5632
5637
|
j.getAuthorizers()[r.transport](j, a, r, w.UserAuthentication, s);
|
|
5633
5638
|
};
|
|
5634
5639
|
};
|
|
5635
|
-
const
|
|
5640
|
+
const Jr = (r, t) => {
|
|
5636
5641
|
var s = "socket_id=" + encodeURIComponent(r.socketId);
|
|
5637
5642
|
s += "&channel_name=" + encodeURIComponent(r.channelName);
|
|
5638
5643
|
for (var a in t.params)
|
|
@@ -5644,15 +5649,15 @@ function va() {
|
|
|
5644
5649
|
}
|
|
5645
5650
|
return s;
|
|
5646
5651
|
};
|
|
5647
|
-
var
|
|
5652
|
+
var Kr = (r) => {
|
|
5648
5653
|
if (typeof j.getAuthorizers()[r.transport] > "u")
|
|
5649
5654
|
throw `'${r.transport}' is not a recognized auth transport`;
|
|
5650
5655
|
return (t, s) => {
|
|
5651
|
-
const a =
|
|
5656
|
+
const a = Jr(t, r);
|
|
5652
5657
|
j.getAuthorizers()[r.transport](j, a, r, w.ChannelAuthorization, s);
|
|
5653
5658
|
};
|
|
5654
5659
|
};
|
|
5655
|
-
const
|
|
5660
|
+
const Qr = (r, t, s) => {
|
|
5656
5661
|
const a = {
|
|
5657
5662
|
authTransport: t.transport,
|
|
5658
5663
|
authEndpoint: t.endpoint,
|
|
@@ -5666,7 +5671,7 @@ function va() {
|
|
|
5666
5671
|
s(S, a).authorize(u.socketId, p);
|
|
5667
5672
|
};
|
|
5668
5673
|
};
|
|
5669
|
-
function
|
|
5674
|
+
function Yr(r, t) {
|
|
5670
5675
|
let s = {
|
|
5671
5676
|
activityTimeout: r.activityTimeout || h.activityTimeout,
|
|
5672
5677
|
cluster: r.cluster,
|
|
@@ -5679,46 +5684,46 @@ function va() {
|
|
|
5679
5684
|
wsPath: r.wsPath || h.wsPath,
|
|
5680
5685
|
wsPort: r.wsPort || h.wsPort,
|
|
5681
5686
|
wssPort: r.wssPort || h.wssPort,
|
|
5682
|
-
enableStats:
|
|
5683
|
-
httpHost:
|
|
5684
|
-
useTLS:
|
|
5685
|
-
wsHost:
|
|
5686
|
-
userAuthenticator:
|
|
5687
|
-
channelAuthorizer:
|
|
5687
|
+
enableStats: si(r),
|
|
5688
|
+
httpHost: Zr(r),
|
|
5689
|
+
useTLS: ni(r),
|
|
5690
|
+
wsHost: ei(r),
|
|
5691
|
+
userAuthenticator: ri(r),
|
|
5692
|
+
channelAuthorizer: oi(r, t)
|
|
5688
5693
|
};
|
|
5689
5694
|
return "disabledTransports" in r && (s.disabledTransports = r.disabledTransports), "enabledTransports" in r && (s.enabledTransports = r.enabledTransports), "ignoreNullOrigin" in r && (s.ignoreNullOrigin = r.ignoreNullOrigin), "timelineParams" in r && (s.timelineParams = r.timelineParams), "nacl" in r && (s.nacl = r.nacl), s;
|
|
5690
5695
|
}
|
|
5691
|
-
function Yr(r) {
|
|
5692
|
-
return r.httpHost ? r.httpHost : r.cluster ? `sockjs-${r.cluster}.pusher.com` : h.httpHost;
|
|
5693
|
-
}
|
|
5694
5696
|
function Zr(r) {
|
|
5695
|
-
return r.
|
|
5697
|
+
return r.httpHost ? r.httpHost : r.cluster ? `sockjs-${r.cluster}.pusher.com` : h.httpHost;
|
|
5696
5698
|
}
|
|
5697
5699
|
function ei(r) {
|
|
5698
|
-
return
|
|
5700
|
+
return r.wsHost ? r.wsHost : ti(r.cluster);
|
|
5699
5701
|
}
|
|
5700
5702
|
function ti(r) {
|
|
5701
|
-
return
|
|
5703
|
+
return `ws-${r}.pusher.com`;
|
|
5702
5704
|
}
|
|
5703
5705
|
function ni(r) {
|
|
5704
|
-
return
|
|
5706
|
+
return j.getProtocol() === "https:" ? !0 : r.forceTLS !== !1;
|
|
5705
5707
|
}
|
|
5706
5708
|
function si(r) {
|
|
5709
|
+
return "enableStats" in r ? r.enableStats : "disableStats" in r ? !r.disableStats : !1;
|
|
5710
|
+
}
|
|
5711
|
+
function ri(r) {
|
|
5707
5712
|
const t = Object.assign(Object.assign({}, h.userAuthentication), r.userAuthentication);
|
|
5708
|
-
return "customHandler" in t && t.customHandler != null ? t.customHandler :
|
|
5713
|
+
return "customHandler" in t && t.customHandler != null ? t.customHandler : Gr(t);
|
|
5709
5714
|
}
|
|
5710
|
-
function
|
|
5715
|
+
function ii(r, t) {
|
|
5711
5716
|
let s;
|
|
5712
5717
|
return "channelAuthorization" in r ? s = Object.assign(Object.assign({}, h.channelAuthorization), r.channelAuthorization) : (s = {
|
|
5713
5718
|
transport: r.authTransport || h.authTransport,
|
|
5714
5719
|
endpoint: r.authEndpoint || h.authEndpoint
|
|
5715
|
-
}, "auth" in r && ("params" in r.auth && (s.params = r.auth.params), "headers" in r.auth && (s.headers = r.auth.headers)), "authorizer" in r && (s.customHandler =
|
|
5720
|
+
}, "auth" in r && ("params" in r.auth && (s.params = r.auth.params), "headers" in r.auth && (s.headers = r.auth.headers)), "authorizer" in r && (s.customHandler = Qr(t, s, r.authorizer))), s;
|
|
5716
5721
|
}
|
|
5717
|
-
function
|
|
5718
|
-
const s =
|
|
5719
|
-
return "customHandler" in s && s.customHandler != null ? s.customHandler :
|
|
5722
|
+
function oi(r, t) {
|
|
5723
|
+
const s = ii(r, t);
|
|
5724
|
+
return "customHandler" in s && s.customHandler != null ? s.customHandler : Kr(s);
|
|
5720
5725
|
}
|
|
5721
|
-
class
|
|
5726
|
+
class ai extends Te {
|
|
5722
5727
|
constructor(t) {
|
|
5723
5728
|
super(function(s, a) {
|
|
5724
5729
|
oe.debug(`No callbacks on watchlist events for ${s}`);
|
|
@@ -5736,14 +5741,14 @@ function va() {
|
|
|
5736
5741
|
});
|
|
5737
5742
|
}
|
|
5738
5743
|
}
|
|
5739
|
-
function
|
|
5744
|
+
function ci() {
|
|
5740
5745
|
let r, t;
|
|
5741
5746
|
return { promise: new Promise((a, u) => {
|
|
5742
5747
|
r = a, t = u;
|
|
5743
5748
|
}), resolve: r, reject: t };
|
|
5744
5749
|
}
|
|
5745
|
-
var
|
|
5746
|
-
class
|
|
5750
|
+
var ui = ci;
|
|
5751
|
+
class li extends Te {
|
|
5747
5752
|
constructor(t) {
|
|
5748
5753
|
super(function(s, a) {
|
|
5749
5754
|
oe.debug("No callbacks on user for " + s);
|
|
@@ -5758,7 +5763,7 @@ function va() {
|
|
|
5758
5763
|
});
|
|
5759
5764
|
}, this.pusher = t, this.pusher.connection.bind("state_change", ({ previous: s, current: a }) => {
|
|
5760
5765
|
s !== "connected" && a === "connected" && this._signin(), s === "connected" && a !== "connected" && (this._cleanup(), this._newSigninPromiseIfNeeded());
|
|
5761
|
-
}), this.watchlist = new
|
|
5766
|
+
}), this.watchlist = new ai(t), this.pusher.connection.bind("message", (s) => {
|
|
5762
5767
|
var a = s.event;
|
|
5763
5768
|
a === "pusher:signin_success" && this._onSigninSuccess(s.data), this.serverToUserChannel && this.serverToUserChannel.name === s.channel && this.serverToUserChannel.handleEvent(s);
|
|
5764
5769
|
});
|
|
@@ -5798,7 +5803,7 @@ function va() {
|
|
|
5798
5803
|
_newSigninPromiseIfNeeded() {
|
|
5799
5804
|
if (!this.signin_requested || this.signinDonePromise && !this.signinDonePromise.done)
|
|
5800
5805
|
return;
|
|
5801
|
-
const { promise: t, resolve: s } =
|
|
5806
|
+
const { promise: t, resolve: s } = ui();
|
|
5802
5807
|
t.done = !1;
|
|
5803
5808
|
const a = () => {
|
|
5804
5809
|
t.done = !0;
|
|
@@ -5818,7 +5823,7 @@ function va() {
|
|
|
5818
5823
|
}));
|
|
5819
5824
|
}
|
|
5820
5825
|
constructor(t, s) {
|
|
5821
|
-
|
|
5826
|
+
di(t), Xr(s), this.key = t, this.config = Yr(s, this), this.channels = Ee.createChannels(), this.global_emitter = new Te(), this.sessionID = j.randomInt(1e9), this.timeline = new jr(this.key, this.sessionID, {
|
|
5822
5827
|
cluster: this.config.cluster,
|
|
5823
5828
|
features: de.getClientFeatures(),
|
|
5824
5829
|
params: this.config.timelineParams || {},
|
|
@@ -5829,7 +5834,7 @@ function va() {
|
|
|
5829
5834
|
host: this.config.statsHost,
|
|
5830
5835
|
path: "/timeline/v2/" + j.TimelineTransport.name
|
|
5831
5836
|
}));
|
|
5832
|
-
var a = (u) => j.getDefaultStrategy(this.config, u,
|
|
5837
|
+
var a = (u) => j.getDefaultStrategy(this.config, u, Br);
|
|
5833
5838
|
this.connection = Ee.createConnectionManager(this.key, {
|
|
5834
5839
|
getStrategy: a,
|
|
5835
5840
|
timeline: this.timeline,
|
|
@@ -5852,7 +5857,7 @@ function va() {
|
|
|
5852
5857
|
this.channels.disconnect();
|
|
5853
5858
|
}), this.connection.bind("error", (u) => {
|
|
5854
5859
|
oe.warn(u);
|
|
5855
|
-
}), de.instances.push(this), this.timeline.info({ instances: de.instances.length }), this.user = new
|
|
5860
|
+
}), de.instances.push(this), this.timeline.info({ instances: de.instances.length }), this.user = new li(this), de.isReady && this.connect();
|
|
5856
5861
|
}
|
|
5857
5862
|
channel(t) {
|
|
5858
5863
|
return this.channels.find(t);
|
|
@@ -5911,7 +5916,7 @@ function va() {
|
|
|
5911
5916
|
}
|
|
5912
5917
|
de.instances = [], de.isReady = !1, de.logToConsole = !1, de.Runtime = j, de.ScriptReceivers = j.ScriptReceivers, de.DependenciesReceivers = j.DependenciesReceivers, de.auth_callbacks = j.auth_callbacks;
|
|
5913
5918
|
var Tt = o.default = de;
|
|
5914
|
-
function
|
|
5919
|
+
function di(r) {
|
|
5915
5920
|
if (r == null)
|
|
5916
5921
|
throw "You must pass your app key when you instantiate Pusher.";
|
|
5917
5922
|
}
|
|
@@ -5921,7 +5926,7 @@ function va() {
|
|
|
5921
5926
|
])
|
|
5922
5927
|
);
|
|
5923
5928
|
});
|
|
5924
|
-
})(
|
|
5929
|
+
})(Ot)), Ot.exports;
|
|
5925
5930
|
}
|
|
5926
5931
|
var ba = va();
|
|
5927
5932
|
const ya = /* @__PURE__ */ ma(ba), _a = "/v1/messenger/bootstrap", Sa = 3e4, Ca = 3e4, wa = 5 * 6e4;
|
|
@@ -6028,7 +6033,7 @@ function Vn(e, n) {
|
|
|
6028
6033
|
"X-Requested-With": "XMLHttpRequest"
|
|
6029
6034
|
}), typeof FormData < "u" && e.data instanceof FormData && (e.headers.delete("Content-Type"), e.headers.delete("content-type"));
|
|
6030
6035
|
}
|
|
6031
|
-
function
|
|
6036
|
+
function Re(e, n, i) {
|
|
6032
6037
|
const o = e[n];
|
|
6033
6038
|
if (typeof o == "string" && o.trim() !== "")
|
|
6034
6039
|
return o;
|
|
@@ -6044,14 +6049,14 @@ function xa(e) {
|
|
|
6044
6049
|
function ka(e, n) {
|
|
6045
6050
|
if (!se(e))
|
|
6046
6051
|
return null;
|
|
6047
|
-
const i =
|
|
6052
|
+
const i = Re(e, "user_id", "userId"), o = xa(e.status);
|
|
6048
6053
|
if (!i || !o)
|
|
6049
6054
|
return null;
|
|
6050
6055
|
const c = {
|
|
6051
6056
|
user_id: i,
|
|
6052
|
-
tenant_scope:
|
|
6057
|
+
tenant_scope: Re(e, "tenant_scope", "tenantScope") ?? n,
|
|
6053
6058
|
status: o,
|
|
6054
|
-
ts:
|
|
6059
|
+
ts: Re(e, "ts", "timestamp") ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6055
6060
|
}, l = e.tenant_id ?? e.tenantId;
|
|
6056
6061
|
typeof l == "string" ? c.tenant_id = l : l === null && (c.tenant_id = null);
|
|
6057
6062
|
const d = e.last_seen_at ?? e.lastSeenAt;
|
|
@@ -6060,7 +6065,7 @@ function ka(e, n) {
|
|
|
6060
6065
|
function La(e) {
|
|
6061
6066
|
if (!se(e))
|
|
6062
6067
|
return null;
|
|
6063
|
-
const n =
|
|
6068
|
+
const n = Re(e, "user_id", "userId"), i = Re(e, "conversation_id", "conversationId");
|
|
6064
6069
|
if (!n || !i)
|
|
6065
6070
|
return null;
|
|
6066
6071
|
const o = e.user, c = se(o) ? {
|
|
@@ -6081,7 +6086,7 @@ function La(e) {
|
|
|
6081
6086
|
function Ia(e) {
|
|
6082
6087
|
if (!se(e))
|
|
6083
6088
|
return null;
|
|
6084
|
-
const n =
|
|
6089
|
+
const n = Re(e, "user_id", "userId"), i = Re(e, "conversation_id", "conversationId");
|
|
6085
6090
|
if (!n || !i)
|
|
6086
6091
|
return null;
|
|
6087
6092
|
const o = se(e.user) ? {
|
|
@@ -6097,10 +6102,10 @@ function Ia(e) {
|
|
|
6097
6102
|
...typeof e.ts == "string" ? { ts: e.ts } : {}
|
|
6098
6103
|
};
|
|
6099
6104
|
}
|
|
6100
|
-
function
|
|
6105
|
+
function Oa(e) {
|
|
6101
6106
|
if (!se(e))
|
|
6102
6107
|
return null;
|
|
6103
|
-
const n =
|
|
6108
|
+
const n = Re(e, "user_id", "userId"), i = Re(e, "conversation_id", "conversationId");
|
|
6104
6109
|
return !n || !i ? null : {
|
|
6105
6110
|
user_id: n,
|
|
6106
6111
|
conversation_id: i,
|
|
@@ -6108,11 +6113,11 @@ function Ua(e) {
|
|
|
6108
6113
|
...typeof e.ts == "string" ? { ts: e.ts } : {}
|
|
6109
6114
|
};
|
|
6110
6115
|
}
|
|
6111
|
-
function
|
|
6116
|
+
function Ua(e) {
|
|
6112
6117
|
return se(e) && le(e, "id") && le(e, "name");
|
|
6113
6118
|
}
|
|
6114
6119
|
function Fa(e) {
|
|
6115
|
-
return !se(e) || !le(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) =>
|
|
6120
|
+
return !se(e) || !le(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => Ua(n));
|
|
6116
6121
|
}
|
|
6117
6122
|
function Na(e) {
|
|
6118
6123
|
return se(e) && se(e.message) && le(e.message, "id") && le(e.message, "conversation_id") && le(e.message, "author_id");
|
|
@@ -6135,7 +6140,7 @@ function $a(e) {
|
|
|
6135
6140
|
function Ha(e) {
|
|
6136
6141
|
return se(e) && le(e, "conversation_id") && le(e, "removed_user_id");
|
|
6137
6142
|
}
|
|
6138
|
-
function
|
|
6143
|
+
function Ue(e, n, i, o) {
|
|
6139
6144
|
const c = (l) => {
|
|
6140
6145
|
i(l) && o(l);
|
|
6141
6146
|
};
|
|
@@ -6144,27 +6149,27 @@ function Oe(e, n, i, o) {
|
|
|
6144
6149
|
function oc(e) {
|
|
6145
6150
|
const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ?? _a, o = e.bootstrapRefreshSkewMs ?? Sa, c = e.presenceFreshnessTtlMs ?? wa, l = (e.createLogger ?? Kt())("MessengerEcho");
|
|
6146
6151
|
typeof window < "u" && (window.Pusher = ya);
|
|
6147
|
-
let d = null, g = null, h = null, x = null, M = "disconnected",
|
|
6152
|
+
let d = null, g = null, h = null, x = null, M = "disconnected", y = "available", C = null, b = null;
|
|
6148
6153
|
const T = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Map(), m = (R) => {
|
|
6149
6154
|
M = R;
|
|
6150
6155
|
for (const P of T)
|
|
6151
6156
|
P(R);
|
|
6152
|
-
},
|
|
6153
|
-
|
|
6157
|
+
}, v = (R) => {
|
|
6158
|
+
y = R;
|
|
6154
6159
|
for (const P of w)
|
|
6155
6160
|
P(R);
|
|
6156
6161
|
}, N = () => {
|
|
6157
|
-
|
|
6162
|
+
b !== null && (clearTimeout(b), b = null);
|
|
6158
6163
|
}, q = (R = !0) => {
|
|
6159
6164
|
h !== null && (h.disconnect(), h = null), x = null, R && m("disconnected");
|
|
6160
6165
|
}, G = () => {
|
|
6161
|
-
N(), d = null, g = null, C = null,
|
|
6166
|
+
N(), d = null, g = null, C = null, v("available"), q(), f.clear();
|
|
6162
6167
|
}, k = () => {
|
|
6163
6168
|
if (!e.getSourceToken)
|
|
6164
6169
|
return null;
|
|
6165
6170
|
const R = e.getSourceToken();
|
|
6166
|
-
return R === null ? (G(), null) : (C !== null && C !== R && (N(), d = null, g = null,
|
|
6167
|
-
},
|
|
6171
|
+
return R === null ? (G(), null) : (C !== null && C !== R && (N(), d = null, g = null, v("available"), q()), C = R, R);
|
|
6172
|
+
}, U = (R) => {
|
|
6168
6173
|
if (R === null)
|
|
6169
6174
|
return !1;
|
|
6170
6175
|
if (R.auth.expiresAt === null)
|
|
@@ -6178,19 +6183,19 @@ function oc(e) {
|
|
|
6178
6183
|
if (Number.isNaN(P))
|
|
6179
6184
|
return;
|
|
6180
6185
|
const D = Math.max(0, P - Date.now() - o);
|
|
6181
|
-
|
|
6186
|
+
b = setTimeout(() => {
|
|
6182
6187
|
J();
|
|
6183
6188
|
}, D);
|
|
6184
|
-
}, F = async (R = !1) => e.getSourceToken && k() === null || !R &&
|
|
6189
|
+
}, F = async (R = !1) => e.getSourceToken && k() === null || !R && y === "account_suspended" ? null : !R && U(d) ? d : !R && g !== null ? await g : (g = (async () => {
|
|
6185
6190
|
try {
|
|
6186
6191
|
const D = await e.bootstrapClient.get(
|
|
6187
6192
|
i,
|
|
6188
6193
|
R ? { params: { refresh: 1 } } : void 0
|
|
6189
6194
|
), X = Ra(D.data);
|
|
6190
|
-
return d = X,
|
|
6195
|
+
return d = X, v("available"), H(X), X;
|
|
6191
6196
|
} catch (D) {
|
|
6192
6197
|
if (Ma(D))
|
|
6193
|
-
return d = null, N(),
|
|
6198
|
+
return d = null, N(), v("account_suspended"), q(), m("disconnected"), null;
|
|
6194
6199
|
throw D;
|
|
6195
6200
|
}
|
|
6196
6201
|
})().finally(() => {
|
|
@@ -6232,7 +6237,7 @@ function oc(e) {
|
|
|
6232
6237
|
}
|
|
6233
6238
|
(X === "unavailable" || X === "failed" || X === "disconnected") && m("disconnected");
|
|
6234
6239
|
}), P.state === "connected" && m("connected");
|
|
6235
|
-
}, te = async (R = !1) => !R && h !== null &&
|
|
6240
|
+
}, te = async (R = !1) => !R && h !== null && U(d) ? h : !R && x !== null ? await x : (x = (async () => {
|
|
6236
6241
|
const D = await F(R);
|
|
6237
6242
|
if (D === null)
|
|
6238
6243
|
return null;
|
|
@@ -6258,7 +6263,7 @@ function oc(e) {
|
|
|
6258
6263
|
return D.service.reverb.path && (Y.wsPath = D.service.reverb.path), h = new ga(Y), me(h), m("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
|
|
6259
6264
|
})().finally(() => {
|
|
6260
6265
|
x = null;
|
|
6261
|
-
}), await x),
|
|
6266
|
+
}), await x), _ = $t.create({
|
|
6262
6267
|
timeout: e.requestTimeoutMs ?? Ca,
|
|
6263
6268
|
withCredentials: !1,
|
|
6264
6269
|
headers: {
|
|
@@ -6266,12 +6271,12 @@ function oc(e) {
|
|
|
6266
6271
|
"X-Requested-With": "XMLHttpRequest"
|
|
6267
6272
|
}
|
|
6268
6273
|
});
|
|
6269
|
-
|
|
6274
|
+
_.interceptors.request.use(async (R) => {
|
|
6270
6275
|
const P = await F();
|
|
6271
6276
|
if (P === null)
|
|
6272
6277
|
throw new Error("Messenger bootstrap is unavailable.");
|
|
6273
6278
|
return R.baseURL = P.service.apiBaseUrl, Vn(R, P.auth.token), R;
|
|
6274
|
-
}),
|
|
6279
|
+
}), _.interceptors.response.use(
|
|
6275
6280
|
(R) => R,
|
|
6276
6281
|
async (R) => {
|
|
6277
6282
|
const P = R.config;
|
|
@@ -6279,14 +6284,14 @@ function oc(e) {
|
|
|
6279
6284
|
P._messengerRetry = !0;
|
|
6280
6285
|
const D = await F(!0);
|
|
6281
6286
|
if (D !== null)
|
|
6282
|
-
return P.baseURL = D.service.apiBaseUrl, Vn(P, D.auth.token), await
|
|
6287
|
+
return P.baseURL = D.service.apiBaseUrl, Vn(P, D.auth.token), await _(P);
|
|
6283
6288
|
}
|
|
6284
6289
|
return Promise.reject(R);
|
|
6285
6290
|
}
|
|
6286
6291
|
);
|
|
6287
|
-
const I = () =>
|
|
6292
|
+
const I = () => y === "account_suspended" ? null : h, ae = (R) => (T.add(R), R(M), () => {
|
|
6288
6293
|
T.delete(R);
|
|
6289
|
-
}), B = (R) => (w.add(R), R(
|
|
6294
|
+
}), B = (R) => (w.add(R), R(y), () => {
|
|
6290
6295
|
w.delete(R);
|
|
6291
6296
|
}), E = () => d?.auth.tenantId ?? "global", V = (R) => {
|
|
6292
6297
|
const P = qt(R.ts)?.getTime() ?? qt(R.last_seen_at)?.getTime() ?? null;
|
|
@@ -6332,31 +6337,31 @@ function oc(e) {
|
|
|
6332
6337
|
const X = D.private(`conversation.${R}`), Y = [];
|
|
6333
6338
|
return P.onMessageSent && Y.push({
|
|
6334
6339
|
event: ".ConversationMessageSent",
|
|
6335
|
-
handler:
|
|
6340
|
+
handler: Ue(X, ".ConversationMessageSent", Na, P.onMessageSent)
|
|
6336
6341
|
}), P.onMessageRead && Y.push({
|
|
6337
6342
|
event: ".ConversationMessageRead",
|
|
6338
|
-
handler:
|
|
6343
|
+
handler: Ue(X, ".ConversationMessageRead", Da, P.onMessageRead)
|
|
6339
6344
|
}), P.onMessageEdited && Y.push({
|
|
6340
6345
|
event: ".ConversationMessageEdited",
|
|
6341
|
-
handler:
|
|
6346
|
+
handler: Ue(X, ".ConversationMessageEdited", qa, P.onMessageEdited)
|
|
6342
6347
|
}), P.onMessageDeleted && Y.push({
|
|
6343
6348
|
event: ".ConversationMessageDeleted",
|
|
6344
|
-
handler:
|
|
6349
|
+
handler: Ue(X, ".ConversationMessageDeleted", za, P.onMessageDeleted)
|
|
6345
6350
|
}), P.onReactionToggled && Y.push({
|
|
6346
6351
|
event: ".MessageReactionToggled",
|
|
6347
|
-
handler:
|
|
6352
|
+
handler: Ue(X, ".MessageReactionToggled", ja, P.onReactionToggled)
|
|
6348
6353
|
}), P.onRequestAccepted && Y.push({
|
|
6349
6354
|
event: ".ConversationRequestAccepted",
|
|
6350
|
-
handler:
|
|
6355
|
+
handler: Ue(X, ".ConversationRequestAccepted", $a, P.onRequestAccepted)
|
|
6351
6356
|
}), P.onParticipantRemoved && Y.push({
|
|
6352
6357
|
event: ".ConversationParticipantRemoved",
|
|
6353
|
-
handler:
|
|
6358
|
+
handler: Ue(X, ".ConversationParticipantRemoved", Ha, P.onParticipantRemoved)
|
|
6354
6359
|
}), () => {
|
|
6355
6360
|
if (typeof X.stopListening == "function")
|
|
6356
6361
|
for (const ge of Y)
|
|
6357
6362
|
X.stopListening(ge.event, ge.handler);
|
|
6358
6363
|
};
|
|
6359
|
-
},
|
|
6364
|
+
}, O = (R) => {
|
|
6360
6365
|
h?.leave(`conversation.${R}`);
|
|
6361
6366
|
}, re = (R, P, D) => {
|
|
6362
6367
|
const X = R.private(`typing-conversation.${P}`), Y = [], ge = [
|
|
@@ -6370,8 +6375,8 @@ function oc(e) {
|
|
|
6370
6375
|
"Modules\\Messaging\\Events\\Broadcast\\TypingStateChanged"
|
|
6371
6376
|
], we = [".typing.start", "typing.start", ".TypingStarted", "TypingStarted", ".TypingStart", "TypingStart"], Ke = [".typing.stop", "typing.stop", ".TypingStopped", "TypingStopped", ".TypingStop", "TypingStop"], Qe = /* @__PURE__ */ new Set(["start", "typing"]), ft = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]);
|
|
6372
6377
|
for (const ye of ge) {
|
|
6373
|
-
const Ce = (
|
|
6374
|
-
const K = La(
|
|
6378
|
+
const Ce = (ke) => {
|
|
6379
|
+
const K = La(ke);
|
|
6375
6380
|
if (K) {
|
|
6376
6381
|
if (Qe.has(K.state)) {
|
|
6377
6382
|
D.onTypingStart?.({
|
|
@@ -6395,8 +6400,8 @@ function oc(e) {
|
|
|
6395
6400
|
X.listen(ye, Ce), Y.push({ event: ye, handler: Ce });
|
|
6396
6401
|
}
|
|
6397
6402
|
for (const ye of we) {
|
|
6398
|
-
const Ce = (
|
|
6399
|
-
const K = Ia(
|
|
6403
|
+
const Ce = (ke) => {
|
|
6404
|
+
const K = Ia(ke);
|
|
6400
6405
|
if (!K)
|
|
6401
6406
|
return;
|
|
6402
6407
|
const qe = {
|
|
@@ -6414,8 +6419,8 @@ function oc(e) {
|
|
|
6414
6419
|
X.listen(ye, Ce), Y.push({ event: ye, handler: Ce });
|
|
6415
6420
|
}
|
|
6416
6421
|
for (const ye of Ke) {
|
|
6417
|
-
const Ce = (
|
|
6418
|
-
const K =
|
|
6422
|
+
const Ce = (ke) => {
|
|
6423
|
+
const K = Oa(ke);
|
|
6419
6424
|
if (!K)
|
|
6420
6425
|
return;
|
|
6421
6426
|
const qe = {
|
|
@@ -6447,22 +6452,22 @@ function oc(e) {
|
|
|
6447
6452
|
}, ue = (R) => {
|
|
6448
6453
|
h?.leave(`typing-conversation.${R}`);
|
|
6449
6454
|
}, pe = async () => {
|
|
6450
|
-
|
|
6451
|
-
}, Je = async () =>
|
|
6455
|
+
v("available"), q(), await te(!0);
|
|
6456
|
+
}, Je = async () => y === "account_suspended" ? null : await te();
|
|
6452
6457
|
return {
|
|
6453
|
-
apiClient:
|
|
6458
|
+
apiClient: _,
|
|
6454
6459
|
initializedEvent: n,
|
|
6455
6460
|
getEcho: I,
|
|
6456
6461
|
waitForEcho: Je,
|
|
6457
6462
|
getConnectionStatus: () => M,
|
|
6458
|
-
getAccessState: () =>
|
|
6463
|
+
getAccessState: () => y,
|
|
6459
6464
|
onConnectionStatusChange: ae,
|
|
6460
6465
|
onAccessStateChange: B,
|
|
6461
6466
|
reconnect: pe,
|
|
6462
6467
|
subscribeToPresenceStatus: ne,
|
|
6463
6468
|
unsubscribeFromPresenceStatus: _e,
|
|
6464
6469
|
subscribeToConversation: A,
|
|
6465
|
-
unsubscribeFromConversation:
|
|
6470
|
+
unsubscribeFromConversation: O,
|
|
6466
6471
|
subscribeToTyping: fe,
|
|
6467
6472
|
unsubscribeFromTyping: ue,
|
|
6468
6473
|
clearRuntime: G
|
|
@@ -6475,12 +6480,12 @@ export {
|
|
|
6475
6480
|
W as getApi,
|
|
6476
6481
|
Fe as getAuthStore,
|
|
6477
6482
|
Tn as getConnectionStatus,
|
|
6478
|
-
|
|
6479
|
-
|
|
6483
|
+
Ae as getEcho,
|
|
6484
|
+
rs as getEchoConnectionStatus,
|
|
6480
6485
|
We as getEchoInitializedEvent,
|
|
6481
6486
|
Z as getErrorMessage,
|
|
6482
6487
|
Kt as getLoggerFactory,
|
|
6483
|
-
|
|
6488
|
+
gs as getMainApi,
|
|
6484
6489
|
yo as getMainEcho,
|
|
6485
6490
|
_o as getMainEchoConnectionStatus,
|
|
6486
6491
|
bo as getMainEchoInitializedEvent,
|
|
@@ -6494,19 +6499,19 @@ export {
|
|
|
6494
6499
|
Di as isValidMessageDeletedEvent,
|
|
6495
6500
|
Ni as isValidMessageEditedEvent,
|
|
6496
6501
|
Fi as isValidMessageReadEvent,
|
|
6497
|
-
|
|
6502
|
+
Ui as isValidMessageSentEvent,
|
|
6498
6503
|
qi as isValidReactionToggledEvent,
|
|
6499
6504
|
zi as isValidRequestAcceptedEvent,
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6505
|
+
Pe as messagingApi,
|
|
6506
|
+
Oo as normalizePresenceStatus,
|
|
6507
|
+
ms as normalizePresenceTimestamp,
|
|
6503
6508
|
ht as onConnectionStatusChange,
|
|
6504
6509
|
So as onMainEchoConnectionStatusChange,
|
|
6505
6510
|
Ei as onMessagingAccessStateChange,
|
|
6506
6511
|
qt as parsePresenceTimestamp,
|
|
6507
6512
|
Ai as reconnectEcho,
|
|
6508
6513
|
Co as reconnectMainEcho,
|
|
6509
|
-
|
|
6514
|
+
Oi as resetEchoRuntimeConfig,
|
|
6510
6515
|
Ro as resetLoggerFactory,
|
|
6511
6516
|
ko as resetMainApiClient,
|
|
6512
6517
|
To as resetMainEchoRuntimeConfig,
|
|
@@ -6515,7 +6520,7 @@ export {
|
|
|
6515
6520
|
Wi as resetMessagingMediaApi,
|
|
6516
6521
|
ic as resetMessengerClientConfig,
|
|
6517
6522
|
Vo as resetPresenceRuntimeConfig,
|
|
6518
|
-
|
|
6523
|
+
Uo as resolveFreshPresenceStatus,
|
|
6519
6524
|
$n as resolvePresenceSnapshot,
|
|
6520
6525
|
Ii as setEchoRuntimeConfig,
|
|
6521
6526
|
Ao as setLoggerFactory,
|
|
@@ -6538,5 +6543,5 @@ export {
|
|
|
6538
6543
|
Gt as useMessagingStore,
|
|
6539
6544
|
nc as usePresence,
|
|
6540
6545
|
sc as useTypingChannel,
|
|
6541
|
-
|
|
6546
|
+
ss as waitForEcho
|
|
6542
6547
|
};
|