@codingfactory/messenger-client 0.2.1 → 0.2.4
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 +1143 -1125
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ref as de, getCurrentInstance as
|
|
1
|
+
import { ref as de, getCurrentInstance as Mt, computed as re, watch as Rt, onUnmounted as qe, toValue as Ln, onMounted as Un } from "vue";
|
|
2
2
|
import { defineStore as ci, storeToRefs as ui } from "pinia";
|
|
3
|
-
import
|
|
4
|
-
import { isAxiosError as
|
|
3
|
+
import kt, { isAxiosError as li, AxiosHeaders as pn } from "axios";
|
|
4
|
+
import { isAxiosError as Ha } from "axios";
|
|
5
5
|
import { useRoute as hi } from "vue-router";
|
|
6
6
|
const On = () => () => {
|
|
7
7
|
}, Nn = async () => {
|
|
@@ -13,7 +13,7 @@ const On = () => () => {
|
|
|
13
13
|
throw new Error("messenger-client subscribeToConversation is not configured");
|
|
14
14
|
}, $n = () => {
|
|
15
15
|
throw new Error("messenger-client subscribeToTyping is not configured");
|
|
16
|
-
},
|
|
16
|
+
}, J = {
|
|
17
17
|
ECHO_INITIALIZED_EVENT: "messenger-client:echo-initialized",
|
|
18
18
|
getEcho: () => null,
|
|
19
19
|
getConnectionStatus: () => "disconnected",
|
|
@@ -25,14 +25,14 @@ const On = () => () => {
|
|
|
25
25
|
unsubscribeFromConversation: qn,
|
|
26
26
|
subscribeToTyping: $n,
|
|
27
27
|
unsubscribeFromTyping: zn
|
|
28
|
-
}, De = () =>
|
|
29
|
-
await
|
|
30
|
-
}, fi = (e) =>
|
|
28
|
+
}, De = () => J.ECHO_INITIALIZED_EVENT, Ae = () => J.getEcho(), Hn = () => J.getConnectionStatus(), Ma = () => Hn(), it = (e) => J.onConnectionStatusChange(e), di = async () => {
|
|
29
|
+
await J.reconnect();
|
|
30
|
+
}, fi = (e) => J.subscribeToPresenceStatus(e), pi = () => J.unsubscribeFromPresenceStatus(), gi = (e, n) => J.subscribeToConversation(e, n), mi = (e) => J.unsubscribeFromConversation(e), vi = (e, n) => J.subscribeToTyping(e, n), bi = (e) => J.unsubscribeFromTyping(e);
|
|
31
31
|
function yi(e) {
|
|
32
|
-
e.initializedEvent && (
|
|
32
|
+
e.initializedEvent && (J.ECHO_INITIALIZED_EVENT = e.initializedEvent), e.getEcho && (J.getEcho = e.getEcho), e.getConnectionStatus && (J.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (J.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (J.reconnect = e.reconnect), e.subscribeToPresenceStatus && (J.subscribeToPresenceStatus = e.subscribeToPresenceStatus), e.unsubscribeFromPresenceStatus && (J.unsubscribeFromPresenceStatus = e.unsubscribeFromPresenceStatus), e.subscribeToConversation && (J.subscribeToConversation = e.subscribeToConversation), e.unsubscribeFromConversation && (J.unsubscribeFromConversation = e.unsubscribeFromConversation), e.subscribeToTyping && (J.subscribeToTyping = e.subscribeToTyping), e.unsubscribeFromTyping && (J.unsubscribeFromTyping = e.unsubscribeFromTyping);
|
|
33
33
|
}
|
|
34
34
|
function _i() {
|
|
35
|
-
|
|
35
|
+
J.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", J.getEcho = () => null, J.getConnectionStatus = () => "disconnected", J.onConnectionStatusChange = On, J.reconnect = Nn, J.subscribeToPresenceStatus = Fn, J.unsubscribeFromPresenceStatus = Dn, J.subscribeToConversation = jn, J.unsubscribeFromConversation = qn, J.subscribeToTyping = $n, J.unsubscribeFromTyping = zn;
|
|
36
36
|
}
|
|
37
37
|
function tt(e) {
|
|
38
38
|
return typeof e == "object" && e !== null;
|
|
@@ -46,41 +46,41 @@ function wi(e) {
|
|
|
46
46
|
function Ci(e) {
|
|
47
47
|
return tt(e) && typeof e.conversation_id == "string";
|
|
48
48
|
}
|
|
49
|
-
const Bn =
|
|
50
|
-
let
|
|
51
|
-
function
|
|
52
|
-
return
|
|
49
|
+
const Bn = kt;
|
|
50
|
+
let It = Bn;
|
|
51
|
+
function W() {
|
|
52
|
+
return It;
|
|
53
53
|
}
|
|
54
54
|
function Ti(e) {
|
|
55
|
-
|
|
55
|
+
It = e;
|
|
56
56
|
}
|
|
57
57
|
function Ei() {
|
|
58
|
-
|
|
58
|
+
It = Bn;
|
|
59
59
|
}
|
|
60
60
|
const Vn = {
|
|
61
61
|
currentUser: null
|
|
62
62
|
};
|
|
63
|
-
let
|
|
63
|
+
let Lt = () => Vn;
|
|
64
64
|
function Pe() {
|
|
65
|
-
return
|
|
65
|
+
return Lt;
|
|
66
66
|
}
|
|
67
67
|
function Ri(e) {
|
|
68
|
-
|
|
68
|
+
Lt = e;
|
|
69
69
|
}
|
|
70
70
|
function Ai() {
|
|
71
|
-
|
|
71
|
+
Lt = () => Vn;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function Z(e) {
|
|
74
74
|
if (li(e)) {
|
|
75
75
|
const n = e.response?.data?.message || e.message || "An error occurred";
|
|
76
76
|
return n.includes("SQLSTATE") || n.includes("Connection:") || n.includes("\\Illuminate\\") ? "Something went wrong. Please try again later." : n;
|
|
77
77
|
}
|
|
78
78
|
return e instanceof Error ? e.message : typeof e == "string" ? e : typeof e == "object" && e !== null && "message" in e && typeof e.message == "string" ? e.message : "An unexpected error occurred";
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function ka(e) {
|
|
81
81
|
return e instanceof Error;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function Ia(e) {
|
|
84
84
|
return typeof e == "object" && e !== null && "response" in e && typeof e.response == "object";
|
|
85
85
|
}
|
|
86
86
|
const Xn = {
|
|
@@ -88,15 +88,15 @@ const Xn = {
|
|
|
88
88
|
throw new Error("messenger-client mediaApi.uploadImage is not configured");
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
|
-
let
|
|
91
|
+
let Ut = Xn;
|
|
92
92
|
function Pi() {
|
|
93
|
-
return
|
|
93
|
+
return Ut;
|
|
94
94
|
}
|
|
95
95
|
function xi(e) {
|
|
96
|
-
|
|
96
|
+
Ut = e;
|
|
97
97
|
}
|
|
98
98
|
function Mi() {
|
|
99
|
-
|
|
99
|
+
Ut = Xn;
|
|
100
100
|
}
|
|
101
101
|
function ki(e) {
|
|
102
102
|
return e !== null && typeof e == "object" && "id" in e && "type" in e && "participants" in e;
|
|
@@ -132,7 +132,7 @@ function _t(e, n) {
|
|
|
132
132
|
}
|
|
133
133
|
throw new Error(`Invalid messaging folder payload: missing numeric ${n}`);
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function At(e) {
|
|
136
136
|
if (!Wn(e))
|
|
137
137
|
throw new Error("Invalid messaging folder payload: expected object");
|
|
138
138
|
return {
|
|
@@ -150,7 +150,7 @@ function Rt(e) {
|
|
|
150
150
|
function Ii(e) {
|
|
151
151
|
if (!Array.isArray(e))
|
|
152
152
|
throw new Error("Invalid messaging folder payload: expected array");
|
|
153
|
-
return e.map((n) =>
|
|
153
|
+
return e.map((n) => At(n));
|
|
154
154
|
}
|
|
155
155
|
function mn(e) {
|
|
156
156
|
if (!ki(e))
|
|
@@ -159,37 +159,37 @@ function mn(e) {
|
|
|
159
159
|
}
|
|
160
160
|
const Se = {
|
|
161
161
|
async fetchFolders() {
|
|
162
|
-
const e = await
|
|
162
|
+
const e = await W().get("/v1/messaging/folders");
|
|
163
163
|
return Ii(Le(e.data));
|
|
164
164
|
},
|
|
165
165
|
async createFolder(e) {
|
|
166
|
-
const n = await
|
|
167
|
-
return
|
|
166
|
+
const n = await W().post("/v1/messaging/folders", e);
|
|
167
|
+
return At(Le(n.data));
|
|
168
168
|
},
|
|
169
169
|
async updateFolder(e, n) {
|
|
170
|
-
const i = await
|
|
171
|
-
return
|
|
170
|
+
const i = await W().patch(`/v1/messaging/folders/${e}`, n);
|
|
171
|
+
return At(Le(i.data));
|
|
172
172
|
},
|
|
173
173
|
async deleteFolder(e) {
|
|
174
|
-
await
|
|
174
|
+
await W().delete(`/v1/messaging/folders/${e}`);
|
|
175
175
|
},
|
|
176
176
|
async reorderFolders(e) {
|
|
177
|
-
await
|
|
177
|
+
await W().patch("/v1/messaging/folders/reorder", { order: e });
|
|
178
178
|
},
|
|
179
179
|
async assignFolder(e, n) {
|
|
180
|
-
const i = await
|
|
180
|
+
const i = await W().patch(`/v1/messaging/conversations/${e}/folder`, {
|
|
181
181
|
folder_id: n
|
|
182
182
|
});
|
|
183
183
|
return mn(Le(i.data));
|
|
184
184
|
},
|
|
185
185
|
async acceptRequest(e) {
|
|
186
|
-
const n = await
|
|
186
|
+
const n = await W().post(`/v1/messaging/conversations/${e}/accept`);
|
|
187
187
|
return mn(Le(n.data));
|
|
188
188
|
},
|
|
189
189
|
async declineRequest(e) {
|
|
190
|
-
await
|
|
190
|
+
await W().post(`/v1/messaging/conversations/${e}/decline`);
|
|
191
191
|
}
|
|
192
|
-
}, vn = 1e3,
|
|
192
|
+
}, vn = 1e3, Ot = 4e3, Li = 12e4, Ui = 300, Oi = 1, Ni = 1600, Nt = (e) => {
|
|
193
193
|
if (typeof e == "number" && Number.isFinite(e))
|
|
194
194
|
return e;
|
|
195
195
|
if (typeof e == "string") {
|
|
@@ -198,7 +198,7 @@ const Se = {
|
|
|
198
198
|
return n;
|
|
199
199
|
}
|
|
200
200
|
}, Gn = (e) => typeof e == "number" && e >= 500 && e < 600, bn = (e) => {
|
|
201
|
-
const i =
|
|
201
|
+
const i = Nt(e.response?.status);
|
|
202
202
|
return i === void 0 ? !0 : i === 429 || Gn(i);
|
|
203
203
|
}, Jn = (e) => {
|
|
204
204
|
if (typeof e == "number" && Number.isFinite(e) && e > 0)
|
|
@@ -208,13 +208,13 @@ const Se = {
|
|
|
208
208
|
if (Number.isFinite(n) && n > 0)
|
|
209
209
|
return Math.max(vn, n * 1e3);
|
|
210
210
|
}
|
|
211
|
-
return
|
|
211
|
+
return Ot;
|
|
212
212
|
}, Fi = (e) => {
|
|
213
|
-
const n = Math.max(0, e), i = 2 ** Math.min(n, 6), o =
|
|
213
|
+
const n = Math.max(0, e), i = 2 ** Math.min(n, 6), o = Ot * i;
|
|
214
214
|
return Math.min(Li, o);
|
|
215
215
|
}, Di = (e) => {
|
|
216
216
|
const n = e;
|
|
217
|
-
return
|
|
217
|
+
return Nt(n.response?.status) === 429 ? Jn(n.response?.headers?.["retry-after"]) : Ui;
|
|
218
218
|
}, yn = async (e) => {
|
|
219
219
|
await new Promise((n) => {
|
|
220
220
|
setTimeout(n, e);
|
|
@@ -311,7 +311,7 @@ function _n(e) {
|
|
|
311
311
|
if (!(typeof e != "string" || e.length === 0))
|
|
312
312
|
return e;
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function Pt(e) {
|
|
315
315
|
return typeof e == "string" && e.length > 0 && !e.startsWith("temp-");
|
|
316
316
|
}
|
|
317
317
|
function Xi(e, n = []) {
|
|
@@ -379,10 +379,10 @@ function Sn(e, n) {
|
|
|
379
379
|
if (Array.isArray(i))
|
|
380
380
|
for (let o = i.length - 1; o >= 0; o -= 1) {
|
|
381
381
|
const u = i[o]?.id;
|
|
382
|
-
if (
|
|
382
|
+
if (Pt(u))
|
|
383
383
|
return u;
|
|
384
384
|
}
|
|
385
|
-
return
|
|
385
|
+
return Pt(e.last_message?.id) ? e.last_message.id : null;
|
|
386
386
|
}
|
|
387
387
|
function he(e) {
|
|
388
388
|
return typeof e == "object" && e !== null;
|
|
@@ -462,7 +462,7 @@ function wt(e) {
|
|
|
462
462
|
i.is_request === !0 && n.set(i.id, i);
|
|
463
463
|
return Array.from(n.values()).sort(et);
|
|
464
464
|
}
|
|
465
|
-
const
|
|
465
|
+
const Ft = ci("messaging", {
|
|
466
466
|
state: () => ({
|
|
467
467
|
conversations: [],
|
|
468
468
|
requests: [],
|
|
@@ -514,7 +514,7 @@ const Nt = ci("messaging", {
|
|
|
514
514
|
const e = await Se.fetchFolders();
|
|
515
515
|
return this.folders = Oe(e), this.foldersLoaded = !0, this.normalizeFolderAssignmentsState(), this.folders;
|
|
516
516
|
} catch (e) {
|
|
517
|
-
throw this.error =
|
|
517
|
+
throw this.error = Z(e), e;
|
|
518
518
|
}
|
|
519
519
|
},
|
|
520
520
|
async createFolder(e) {
|
|
@@ -522,7 +522,7 @@ const Nt = ci("messaging", {
|
|
|
522
522
|
const n = await Se.createFolder(e);
|
|
523
523
|
return this.folders = Oe([...this.folders, n]), n;
|
|
524
524
|
} catch (n) {
|
|
525
|
-
throw this.error =
|
|
525
|
+
throw this.error = Z(n), n;
|
|
526
526
|
}
|
|
527
527
|
},
|
|
528
528
|
async updateFolder(e, n) {
|
|
@@ -532,14 +532,14 @@ const Nt = ci("messaging", {
|
|
|
532
532
|
this.folders.map((o) => o.id === e ? i : o)
|
|
533
533
|
), i;
|
|
534
534
|
} catch (i) {
|
|
535
|
-
throw this.error =
|
|
535
|
+
throw this.error = Z(i), i;
|
|
536
536
|
}
|
|
537
537
|
},
|
|
538
538
|
async deleteFolder(e) {
|
|
539
539
|
try {
|
|
540
540
|
await Se.deleteFolder(e), this.folders = this.folders.filter((n) => n.id !== e), this.foldersLoaded = !0, this.activeFolderId === e && (this.activeFolderId = null), this.normalizeFolderAssignmentsState();
|
|
541
541
|
} catch (n) {
|
|
542
|
-
throw this.error =
|
|
542
|
+
throw this.error = Z(n), n;
|
|
543
543
|
}
|
|
544
544
|
},
|
|
545
545
|
async reorderFolders(e) {
|
|
@@ -561,7 +561,7 @@ const Nt = ci("messaging", {
|
|
|
561
561
|
});
|
|
562
562
|
this.folders = i;
|
|
563
563
|
} catch (n) {
|
|
564
|
-
throw this.error =
|
|
564
|
+
throw this.error = Z(n), n;
|
|
565
565
|
}
|
|
566
566
|
},
|
|
567
567
|
async assignToFolder(e, n) {
|
|
@@ -578,7 +578,7 @@ const Nt = ci("messaging", {
|
|
|
578
578
|
folder_id: l
|
|
579
579
|
};
|
|
580
580
|
} catch (i) {
|
|
581
|
-
throw this.error =
|
|
581
|
+
throw this.error = Z(i), i;
|
|
582
582
|
}
|
|
583
583
|
},
|
|
584
584
|
async fetchConversations(e, n, i, o) {
|
|
@@ -586,14 +586,14 @@ const Nt = ci("messaging", {
|
|
|
586
586
|
try {
|
|
587
587
|
const u = o?.includePresence ?? !0, l = {};
|
|
588
588
|
u && (l.include_presence = 1), e && (l.cursor = e), n && (l.filter = n), typeof i == "string" && i.length > 0 && (l.folder_id = i);
|
|
589
|
-
const h = await
|
|
589
|
+
const h = await W().get("/v1/messaging/conversations", { params: l }), { items: g, nextCursor: d } = Je(
|
|
590
590
|
h.data,
|
|
591
591
|
"conversations"
|
|
592
|
-
), A = g.map((
|
|
593
|
-
const
|
|
594
|
-
(
|
|
592
|
+
), A = g.map((v) => {
|
|
593
|
+
const w = this.conversations.find(
|
|
594
|
+
(R) => R.id === v.id
|
|
595
595
|
);
|
|
596
|
-
return Ue(
|
|
596
|
+
return Ue(v, w);
|
|
597
597
|
});
|
|
598
598
|
e ? this.conversations.push(...A) : this.conversations = A, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
|
|
599
599
|
const x = {
|
|
@@ -602,7 +602,7 @@ const Nt = ci("messaging", {
|
|
|
602
602
|
};
|
|
603
603
|
return d !== void 0 && (x.next_cursor = d), x;
|
|
604
604
|
} catch (u) {
|
|
605
|
-
throw o?.background && bn(u) || (this.error =
|
|
605
|
+
throw o?.background && bn(u) || (this.error = Z(u)), u;
|
|
606
606
|
} finally {
|
|
607
607
|
this.loading = !1;
|
|
608
608
|
}
|
|
@@ -616,21 +616,21 @@ const Nt = ci("messaging", {
|
|
|
616
616
|
includePresence: !1
|
|
617
617
|
}), this.backgroundPollRetryAfterUntil = 0, this.backgroundPollTransientFailureCount = 0, !0;
|
|
618
618
|
} catch (e) {
|
|
619
|
-
const n = e, i =
|
|
620
|
-
return i === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() + Jn(n.response?.headers?.["retry-after"]), !1) : (this.backgroundPollTransientFailureCount += 1, i === void 0 || Gn(i) ? (this.backgroundPollRetryAfterUntil = Date.now() + Fi(this.backgroundPollTransientFailureCount), !1) : (this.backgroundPollRetryAfterUntil = Date.now() +
|
|
619
|
+
const n = e, i = Nt(n.response?.status);
|
|
620
|
+
return i === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() + Jn(n.response?.headers?.["retry-after"]), !1) : (this.backgroundPollTransientFailureCount += 1, i === void 0 || Gn(i) ? (this.backgroundPollRetryAfterUntil = Date.now() + Fi(this.backgroundPollTransientFailureCount), !1) : (this.backgroundPollRetryAfterUntil = Date.now() + Ot, !1));
|
|
621
621
|
}
|
|
622
622
|
},
|
|
623
623
|
async fetchConversation(e) {
|
|
624
624
|
this.loading = !0, this.error = null;
|
|
625
625
|
try {
|
|
626
|
-
const n = await
|
|
626
|
+
const n = await W().get(`/v1/messaging/conversations/${e}`, {
|
|
627
627
|
params: { include_presence: 1 }
|
|
628
628
|
}), i = this.conversations.find((h) => h.id === e), o = Ue(n.data.data || n.data, i), u = this.conversations.findIndex((h) => h.id === e);
|
|
629
629
|
u >= 0 ? this.conversations[u] = o : this.conversations.push(o);
|
|
630
630
|
const l = this.requests.findIndex((h) => h.id === e);
|
|
631
631
|
return l >= 0 && (this.requests[l] = o), this.normalizeFolderAssignmentsState(), o;
|
|
632
632
|
} catch (n) {
|
|
633
|
-
throw this.error =
|
|
633
|
+
throw this.error = Z(n), n;
|
|
634
634
|
} finally {
|
|
635
635
|
this.loading = !1;
|
|
636
636
|
}
|
|
@@ -643,7 +643,7 @@ const Nt = ci("messaging", {
|
|
|
643
643
|
filter: "requests"
|
|
644
644
|
};
|
|
645
645
|
e && (n.cursor = e);
|
|
646
|
-
const i = await
|
|
646
|
+
const i = await W().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: u } = Je(
|
|
647
647
|
i.data,
|
|
648
648
|
"conversations"
|
|
649
649
|
), l = o.map((g) => {
|
|
@@ -657,7 +657,7 @@ const Nt = ci("messaging", {
|
|
|
657
657
|
};
|
|
658
658
|
return u !== void 0 && (h.next_cursor = u), h;
|
|
659
659
|
} catch (n) {
|
|
660
|
-
throw this.error =
|
|
660
|
+
throw this.error = Z(n), n;
|
|
661
661
|
} finally {
|
|
662
662
|
this.loading = !1;
|
|
663
663
|
}
|
|
@@ -669,23 +669,23 @@ const Nt = ci("messaging", {
|
|
|
669
669
|
let o = 0, u;
|
|
670
670
|
for (; ; )
|
|
671
671
|
try {
|
|
672
|
-
u = await
|
|
672
|
+
u = await W().get(`/v1/messaging/conversations/${e}/messages`, { params: i });
|
|
673
673
|
break;
|
|
674
|
-
} catch (
|
|
675
|
-
if (!(o < Oi && bn(
|
|
676
|
-
throw
|
|
677
|
-
o += 1, await yn(Di(
|
|
674
|
+
} catch (v) {
|
|
675
|
+
if (!(o < Oi && bn(v)))
|
|
676
|
+
throw v;
|
|
677
|
+
o += 1, await yn(Di(v));
|
|
678
678
|
}
|
|
679
679
|
const { items: l, nextCursor: h } = Je(
|
|
680
680
|
u.data,
|
|
681
681
|
"messages"
|
|
682
682
|
), g = l.map(Ze), d = [...g].reverse();
|
|
683
683
|
if (n ? this.messages[e] = [...d, ...this.messages[e] || []] : this.messages[e] = d, (() => {
|
|
684
|
-
const
|
|
685
|
-
return
|
|
684
|
+
const v = this.conversations.find((w) => w.id === e) ?? this.requests.find((w) => w.id === e);
|
|
685
|
+
return v ? !v.last_message || !v.last_message_at : !1;
|
|
686
686
|
})()) {
|
|
687
|
-
const
|
|
688
|
-
|
|
687
|
+
const v = this.messages[e]?.at(-1);
|
|
688
|
+
v && this.updateConversationLastMessage(e, v);
|
|
689
689
|
}
|
|
690
690
|
h ? (this.conversationCursors[e] = h, this.conversationHasMore[e] = !0) : (delete this.conversationCursors[e], this.conversationHasMore[e] = !1);
|
|
691
691
|
const x = {
|
|
@@ -694,7 +694,7 @@ const Nt = ci("messaging", {
|
|
|
694
694
|
};
|
|
695
695
|
return h !== void 0 && (x.next_cursor = h), x;
|
|
696
696
|
} catch (i) {
|
|
697
|
-
throw this.error =
|
|
697
|
+
throw this.error = Z(i), i;
|
|
698
698
|
} finally {
|
|
699
699
|
this.loadingMessages[e] = !1, this.loading = !1;
|
|
700
700
|
}
|
|
@@ -718,14 +718,14 @@ const Nt = ci("messaging", {
|
|
|
718
718
|
...A.handle ? { handle: A.handle } : {}
|
|
719
719
|
}), o != null && (x.reply_to_id = o), u != null && (x.reply_to = u), this.messages[e] || (this.messages[e] = []), this.messages[e].push(x), this._pendingSendIds.add(g);
|
|
720
720
|
try {
|
|
721
|
-
let
|
|
722
|
-
const
|
|
721
|
+
let v;
|
|
722
|
+
const w = {
|
|
723
723
|
body: n || "",
|
|
724
724
|
...o ? { reply_to_id: o } : {},
|
|
725
725
|
...d ? { shared_post_id: d } : {}
|
|
726
726
|
};
|
|
727
727
|
if (i && i.length > 0) {
|
|
728
|
-
const
|
|
728
|
+
const H = await Promise.all(
|
|
729
729
|
i.map(async (B) => {
|
|
730
730
|
const P = await Pi().uploadImage(B);
|
|
731
731
|
return {
|
|
@@ -735,31 +735,31 @@ const Nt = ci("messaging", {
|
|
|
735
735
|
};
|
|
736
736
|
})
|
|
737
737
|
);
|
|
738
|
-
|
|
739
|
-
...
|
|
740
|
-
attachments:
|
|
738
|
+
v = await W().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
739
|
+
...w,
|
|
740
|
+
attachments: H
|
|
741
741
|
});
|
|
742
742
|
} else
|
|
743
|
-
|
|
744
|
-
...
|
|
743
|
+
v = await W().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
744
|
+
...w,
|
|
745
745
|
type: "text"
|
|
746
746
|
});
|
|
747
|
-
const
|
|
748
|
-
|
|
749
|
-
const
|
|
747
|
+
const R = v.data.data || v.data, E = { ...x, ...R, attachments: R.attachments ?? x.attachments }, _ = Ze(E), f = this.messages[e], b = f.findIndex((H) => H.id === g);
|
|
748
|
+
b >= 0 && (f[b] = _), this._pendingSendIds.delete(g);
|
|
749
|
+
const y = _.id;
|
|
750
750
|
let F = 0;
|
|
751
|
-
for (let
|
|
752
|
-
const B = f[
|
|
753
|
-
B && B.id ===
|
|
751
|
+
for (let H = f.length - 1; H >= 0; H--) {
|
|
752
|
+
const B = f[H];
|
|
753
|
+
B && B.id === y && (F++, F > 1 && f.splice(H, 1));
|
|
754
754
|
}
|
|
755
|
-
return this.updateConversationLastMessage(e,
|
|
756
|
-
} catch (
|
|
757
|
-
throw this._pendingSendIds.delete(g), this.messages[e] = this.messages[e].filter((
|
|
755
|
+
return this.updateConversationLastMessage(e, _), _;
|
|
756
|
+
} catch (v) {
|
|
757
|
+
throw this._pendingSendIds.delete(g), this.messages[e] = this.messages[e].filter((w) => w.id !== g), this.error = Z(v), v;
|
|
758
758
|
}
|
|
759
759
|
},
|
|
760
760
|
async editMessage(e, n, i) {
|
|
761
761
|
try {
|
|
762
|
-
const o = await
|
|
762
|
+
const o = await W().patch(`/v1/messaging/conversations/${e}/messages/${n}`, {
|
|
763
763
|
body: i
|
|
764
764
|
}), u = o.data.data || o.data, l = this.messages[e] || [], h = l.findIndex((g) => g.id === n);
|
|
765
765
|
if (h >= 0) {
|
|
@@ -768,12 +768,12 @@ const Nt = ci("messaging", {
|
|
|
768
768
|
}
|
|
769
769
|
return u;
|
|
770
770
|
} catch (o) {
|
|
771
|
-
throw this.error =
|
|
771
|
+
throw this.error = Z(o), o;
|
|
772
772
|
}
|
|
773
773
|
},
|
|
774
774
|
async deleteMessage(e, n) {
|
|
775
775
|
try {
|
|
776
|
-
await
|
|
776
|
+
await W().delete(`/v1/messaging/conversations/${e}/messages/${n}`);
|
|
777
777
|
const i = this.messages[e] || [], o = i.findIndex((u) => u.id === n);
|
|
778
778
|
if (o >= 0) {
|
|
779
779
|
const u = i[o];
|
|
@@ -783,7 +783,7 @@ const Nt = ci("messaging", {
|
|
|
783
783
|
delete l.body, i[o] = l;
|
|
784
784
|
}
|
|
785
785
|
} catch (i) {
|
|
786
|
-
throw this.error =
|
|
786
|
+
throw this.error = Z(i), i;
|
|
787
787
|
}
|
|
788
788
|
},
|
|
789
789
|
async markAsRead(e) {
|
|
@@ -794,14 +794,14 @@ const Nt = ci("messaging", {
|
|
|
794
794
|
return null;
|
|
795
795
|
for (let l = u.length - 1; l >= 0; l -= 1) {
|
|
796
796
|
const h = u[l]?.id;
|
|
797
|
-
if (
|
|
797
|
+
if (Pt(h))
|
|
798
798
|
return h;
|
|
799
799
|
}
|
|
800
800
|
return null;
|
|
801
801
|
})(), o = n ? Sn(n, this.messages) : i;
|
|
802
802
|
if (!o)
|
|
803
803
|
return;
|
|
804
|
-
await
|
|
804
|
+
await W().post(`/v1/messaging/conversations/${e}/read`, {
|
|
805
805
|
message_id: o
|
|
806
806
|
}), this.conversations.forEach((u) => {
|
|
807
807
|
u.id === e && (u.unread_count = 0);
|
|
@@ -809,7 +809,7 @@ const Nt = ci("messaging", {
|
|
|
809
809
|
u.id === e && (u.unread_count = 0);
|
|
810
810
|
});
|
|
811
811
|
} catch (n) {
|
|
812
|
-
throw this.error =
|
|
812
|
+
throw this.error = Z(n), n;
|
|
813
813
|
}
|
|
814
814
|
},
|
|
815
815
|
async markAllAsRead() {
|
|
@@ -827,7 +827,7 @@ const Nt = ci("messaging", {
|
|
|
827
827
|
return;
|
|
828
828
|
const i = await Promise.allSettled(
|
|
829
829
|
n.map(
|
|
830
|
-
(u) =>
|
|
830
|
+
(u) => W().post(`/v1/messaging/conversations/${u.conversationId}/read`, {
|
|
831
831
|
message_id: u.messageId
|
|
832
832
|
})
|
|
833
833
|
)
|
|
@@ -844,39 +844,39 @@ const Nt = ci("messaging", {
|
|
|
844
844
|
o === null && (o = u.reason);
|
|
845
845
|
}
|
|
846
846
|
}), o !== null)
|
|
847
|
-
throw this.error =
|
|
847
|
+
throw this.error = Z(o), o;
|
|
848
848
|
},
|
|
849
849
|
async sendTyping(e, n = "start") {
|
|
850
850
|
try {
|
|
851
|
-
const i = await
|
|
851
|
+
const i = await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
852
852
|
if (n !== "start" || !qi(i.data))
|
|
853
853
|
return;
|
|
854
|
-
await yn(Ni), await
|
|
854
|
+
await yn(Ni), await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
855
855
|
} catch (i) {
|
|
856
856
|
console.warn("Failed to send typing indicator:", i);
|
|
857
857
|
}
|
|
858
858
|
},
|
|
859
859
|
async muteConversation(e, n) {
|
|
860
860
|
try {
|
|
861
|
-
const i = { minutes: n }, o = await
|
|
861
|
+
const i = { minutes: n }, o = await W().patch(`/v1/messaging/conversations/${e}/mute`, i), l = (o.data.data || o.data).muted_until || null, h = this.conversations.find((g) => g.id === e);
|
|
862
862
|
h && (h.is_muted = l !== null, h.muted_until = l);
|
|
863
863
|
} catch (i) {
|
|
864
|
-
throw this.error =
|
|
864
|
+
throw this.error = Z(i), i;
|
|
865
865
|
}
|
|
866
866
|
},
|
|
867
867
|
async unmuteConversation(e) {
|
|
868
868
|
try {
|
|
869
|
-
const n = await
|
|
869
|
+
const n = await W().patch(`/v1/messaging/conversations/${e}/mute`, {
|
|
870
870
|
minutes: 0
|
|
871
871
|
}), o = (n.data.data || n.data).muted_until || null, u = this.conversations.find((l) => l.id === e);
|
|
872
872
|
u && (u.is_muted = o !== null, u.muted_until = o);
|
|
873
873
|
} catch (n) {
|
|
874
|
-
throw this.error =
|
|
874
|
+
throw this.error = Z(n), n;
|
|
875
875
|
}
|
|
876
876
|
},
|
|
877
877
|
async updateConversationTitle(e, n) {
|
|
878
878
|
try {
|
|
879
|
-
const i = await
|
|
879
|
+
const i = await W().patch(`/v1/messaging/conversations/${e}`, {
|
|
880
880
|
title: n
|
|
881
881
|
}), o = i.data.data || i.data, u = typeof o?.title == "string" ? o.title : n, l = (h) => h.map((g) => g.id !== e ? g : {
|
|
882
882
|
...g,
|
|
@@ -884,30 +884,30 @@ const Nt = ci("messaging", {
|
|
|
884
884
|
});
|
|
885
885
|
this.conversations = l(this.conversations), this.requests = l(this.requests);
|
|
886
886
|
} catch (i) {
|
|
887
|
-
throw this.error =
|
|
887
|
+
throw this.error = Z(i), i;
|
|
888
888
|
}
|
|
889
889
|
},
|
|
890
890
|
async pinConversation(e, n) {
|
|
891
891
|
try {
|
|
892
|
-
await
|
|
892
|
+
await W().patch(`/v1/messaging/conversations/${e}/pin`, { pinned: n });
|
|
893
893
|
const i = this.conversations.find((o) => o.id === e);
|
|
894
894
|
i && (i.is_pinned = n), this.conversations.sort(et);
|
|
895
895
|
} catch (i) {
|
|
896
|
-
throw this.error =
|
|
896
|
+
throw this.error = Z(i), i;
|
|
897
897
|
}
|
|
898
898
|
},
|
|
899
899
|
async archiveConversation(e, n) {
|
|
900
900
|
try {
|
|
901
|
-
await
|
|
901
|
+
await W().patch(`/v1/messaging/conversations/${e}/archive`, { archived: n }), this.conversations = this.conversations.filter((i) => i.id !== e);
|
|
902
902
|
} catch (i) {
|
|
903
|
-
throw this.error =
|
|
903
|
+
throw this.error = Z(i), i;
|
|
904
904
|
}
|
|
905
905
|
},
|
|
906
906
|
async deleteConversation(e) {
|
|
907
907
|
try {
|
|
908
|
-
await
|
|
908
|
+
await W().delete(`/v1/messaging/conversations/${e}`), this.conversations = this.conversations.filter((n) => n.id !== e), delete this.messages[e], delete this.typingUsers[e], delete this.conversationCursors[e], delete this.conversationHasMore[e], delete this.loadingMessages[e];
|
|
909
909
|
} catch (n) {
|
|
910
|
-
throw this.error =
|
|
910
|
+
throw this.error = Z(n), n;
|
|
911
911
|
}
|
|
912
912
|
},
|
|
913
913
|
async createDMConversation(e, n) {
|
|
@@ -916,18 +916,18 @@ const Nt = ci("messaging", {
|
|
|
916
916
|
user_id: e
|
|
917
917
|
};
|
|
918
918
|
n && (i.message = n);
|
|
919
|
-
const o = await
|
|
919
|
+
const o = await W().post("/v1/messaging/conversations/dm", i), u = o.data.data || o.data;
|
|
920
920
|
if (!Cn(u))
|
|
921
921
|
throw new Error("Invalid conversation payload from DM create endpoint.");
|
|
922
922
|
const l = Tn(u) ? Ue(u) : await this.fetchConversation(u.id);
|
|
923
923
|
return l.is_request === !0 ? (this.requests = Ke(this.requests, l), this.conversations = this.conversations.filter((h) => h.id !== l.id), l) : (this.conversations = Ke(this.conversations, l), this.requests = this.requests.filter((h) => h.id !== l.id), l);
|
|
924
924
|
} catch (i) {
|
|
925
|
-
throw this.error =
|
|
925
|
+
throw this.error = Z(i), i;
|
|
926
926
|
}
|
|
927
927
|
},
|
|
928
928
|
async createGroupConversation(e, n) {
|
|
929
929
|
try {
|
|
930
|
-
const i = await
|
|
930
|
+
const i = await W().post("/v1/messaging/conversations/group", {
|
|
931
931
|
title: e,
|
|
932
932
|
participant_ids: n
|
|
933
933
|
}), o = i.data.data || i.data;
|
|
@@ -936,22 +936,22 @@ const Nt = ci("messaging", {
|
|
|
936
936
|
const u = Tn(o) ? o : await this.fetchConversation(o.id);
|
|
937
937
|
return this.conversations = Ke(this.conversations, u), u;
|
|
938
938
|
} catch (i) {
|
|
939
|
-
throw this.error =
|
|
939
|
+
throw this.error = Z(i), i;
|
|
940
940
|
}
|
|
941
941
|
},
|
|
942
942
|
async addParticipants(e, n) {
|
|
943
943
|
try {
|
|
944
|
-
await
|
|
944
|
+
await W().post(`/v1/messaging/conversations/${e}/participants`, {
|
|
945
945
|
user_ids: n
|
|
946
946
|
// Changed from participant_ids to user_ids to match backend
|
|
947
947
|
}), await this.fetchConversation(e);
|
|
948
948
|
} catch (i) {
|
|
949
|
-
throw this.error =
|
|
949
|
+
throw this.error = Z(i), i;
|
|
950
950
|
}
|
|
951
951
|
},
|
|
952
952
|
async removeParticipant(e, n) {
|
|
953
953
|
try {
|
|
954
|
-
await
|
|
954
|
+
await W().delete(`/v1/messaging/conversations/${e}/participants/${n}`);
|
|
955
955
|
const i = Pe()();
|
|
956
956
|
if (n === i.currentUser?.id) {
|
|
957
957
|
this.conversations = this.conversations.filter((o) => o.id !== e), this.requests = this.requests.filter((o) => o.id !== e), delete this.messages[e], delete this.typingUsers[e], delete this.conversationCursors[e], delete this.conversationHasMore[e], delete this.loadingMessages[e];
|
|
@@ -959,7 +959,7 @@ const Nt = ci("messaging", {
|
|
|
959
959
|
}
|
|
960
960
|
await this.fetchConversation(e);
|
|
961
961
|
} catch (i) {
|
|
962
|
-
throw this.error =
|
|
962
|
+
throw this.error = Z(i), i;
|
|
963
963
|
}
|
|
964
964
|
},
|
|
965
965
|
applyParticipantReadState(e) {
|
|
@@ -1039,25 +1039,25 @@ const Nt = ci("messaging", {
|
|
|
1039
1039
|
try {
|
|
1040
1040
|
let g;
|
|
1041
1041
|
try {
|
|
1042
|
-
g = await
|
|
1043
|
-
} catch (
|
|
1044
|
-
if (!Gi(
|
|
1045
|
-
throw
|
|
1046
|
-
g = await
|
|
1042
|
+
g = await W().post(o, u);
|
|
1043
|
+
} catch (v) {
|
|
1044
|
+
if (!Gi(v))
|
|
1045
|
+
throw v;
|
|
1046
|
+
g = await W().post(o, u);
|
|
1047
1047
|
}
|
|
1048
1048
|
const d = he(g.data) && "data" in g.data ? g.data.data : g.data, A = wn(
|
|
1049
1049
|
he(d) ? d.reactions : void 0
|
|
1050
1050
|
);
|
|
1051
1051
|
(A.length > 0 || h.length === 0) && this.updateMessageReactions(e, n, A);
|
|
1052
1052
|
try {
|
|
1053
|
-
const
|
|
1054
|
-
he(
|
|
1053
|
+
const v = await W().get(o), w = he(v.data) && "data" in v.data ? v.data.data : v.data, R = wn(
|
|
1054
|
+
he(w) ? w.reactions : void 0
|
|
1055
1055
|
);
|
|
1056
|
-
this.updateMessageReactions(e, n,
|
|
1056
|
+
this.updateMessageReactions(e, n, R);
|
|
1057
1057
|
} catch {
|
|
1058
1058
|
}
|
|
1059
1059
|
} catch (g) {
|
|
1060
|
-
throw this.error =
|
|
1060
|
+
throw this.error = Z(g), g;
|
|
1061
1061
|
}
|
|
1062
1062
|
},
|
|
1063
1063
|
updateMessageReactions(e, n, i) {
|
|
@@ -1101,14 +1101,14 @@ const Nt = ci("messaging", {
|
|
|
1101
1101
|
});
|
|
1102
1102
|
this.conversations = Ke(this.conversations, i);
|
|
1103
1103
|
} catch (n) {
|
|
1104
|
-
throw this.error =
|
|
1104
|
+
throw this.error = Z(n), n;
|
|
1105
1105
|
}
|
|
1106
1106
|
},
|
|
1107
1107
|
async declineRequest(e) {
|
|
1108
1108
|
try {
|
|
1109
1109
|
await Se.declineRequest(e), this.requests = this.requests.filter((n) => n.id !== e);
|
|
1110
1110
|
} catch (n) {
|
|
1111
|
-
throw this.error =
|
|
1111
|
+
throw this.error = Z(n), n;
|
|
1112
1112
|
}
|
|
1113
1113
|
},
|
|
1114
1114
|
async searchConversations(e, n, i) {
|
|
@@ -1116,7 +1116,7 @@ const Nt = ci("messaging", {
|
|
|
1116
1116
|
try {
|
|
1117
1117
|
const o = { search: e, limit: 20 };
|
|
1118
1118
|
n && (o.filter = n), typeof i == "string" && i.length > 0 && (o.folder_id = i);
|
|
1119
|
-
const u = await
|
|
1119
|
+
const u = await W().get("/v1/messaging/conversations", {
|
|
1120
1120
|
params: o
|
|
1121
1121
|
}), { items: l } = Je(
|
|
1122
1122
|
u.data,
|
|
@@ -1124,7 +1124,7 @@ const Nt = ci("messaging", {
|
|
|
1124
1124
|
);
|
|
1125
1125
|
return l;
|
|
1126
1126
|
} catch (o) {
|
|
1127
|
-
return this.error =
|
|
1127
|
+
return this.error = Z(o), [];
|
|
1128
1128
|
} finally {
|
|
1129
1129
|
this.searchLoading = !1;
|
|
1130
1130
|
}
|
|
@@ -1132,12 +1132,12 @@ const Nt = ci("messaging", {
|
|
|
1132
1132
|
async searchMessages(e, n) {
|
|
1133
1133
|
this.searchLoading = !0;
|
|
1134
1134
|
try {
|
|
1135
|
-
const i = await
|
|
1135
|
+
const i = await W().get(`/v1/messaging/conversations/${e}/search`, {
|
|
1136
1136
|
params: { q: n }
|
|
1137
1137
|
}), o = i.data.data || i.data || [];
|
|
1138
1138
|
return this.searchResults = o, o;
|
|
1139
1139
|
} catch (i) {
|
|
1140
|
-
return this.error =
|
|
1140
|
+
return this.error = Z(i), [];
|
|
1141
1141
|
} finally {
|
|
1142
1142
|
this.searchLoading = !1;
|
|
1143
1143
|
}
|
|
@@ -1177,109 +1177,123 @@ const Nt = ci("messaging", {
|
|
|
1177
1177
|
}
|
|
1178
1178
|
}
|
|
1179
1179
|
});
|
|
1180
|
-
function
|
|
1181
|
-
const n =
|
|
1182
|
-
let x = 0,
|
|
1183
|
-
const
|
|
1184
|
-
function
|
|
1185
|
-
|
|
1180
|
+
function La(e) {
|
|
1181
|
+
const n = Ft(), i = Pe()(), o = de(!1), u = de(null), l = de(null), h = Mt(), g = h !== null, d = 20, A = 250;
|
|
1182
|
+
let x = 0, v = null, w = null;
|
|
1183
|
+
const R = re(() => i.currentUser?.id), E = () => Ln(e)?.trim() ?? "";
|
|
1184
|
+
function _() {
|
|
1185
|
+
v && (clearTimeout(v), v = null), x = 0;
|
|
1186
1186
|
}
|
|
1187
1187
|
function f() {
|
|
1188
|
-
!g || o.value ||
|
|
1189
|
-
|
|
1188
|
+
!g || o.value || v || x >= d || (v = setTimeout(() => {
|
|
1189
|
+
v = null, x += 1, O();
|
|
1190
1190
|
}, A));
|
|
1191
1191
|
}
|
|
1192
|
-
function
|
|
1193
|
-
if (n.addMessage(
|
|
1194
|
-
const
|
|
1195
|
-
|
|
1192
|
+
function b(m) {
|
|
1193
|
+
if (n.addMessage(m.message), m.message.author_id !== R.value) {
|
|
1194
|
+
const j = n.getConversationById(m.conversation_id);
|
|
1195
|
+
j && (j.unread_count = 0), n.markAsRead(m.conversation_id).catch(() => {
|
|
1196
1196
|
});
|
|
1197
1197
|
}
|
|
1198
1198
|
}
|
|
1199
|
-
function
|
|
1200
|
-
n.applyParticipantReadState(
|
|
1201
|
-
}
|
|
1202
|
-
function F(
|
|
1203
|
-
const
|
|
1204
|
-
if (
|
|
1205
|
-
const
|
|
1206
|
-
if (!
|
|
1207
|
-
const
|
|
1208
|
-
|
|
1209
|
-
const
|
|
1210
|
-
|
|
1199
|
+
function y(m) {
|
|
1200
|
+
n.applyParticipantReadState(m);
|
|
1201
|
+
}
|
|
1202
|
+
function F(m) {
|
|
1203
|
+
const j = n.getMessagesByConversationId(m.conversation_id), C = j.findIndex((U) => U.id === m.message.id);
|
|
1204
|
+
if (C >= 0) {
|
|
1205
|
+
const U = j[C];
|
|
1206
|
+
if (!U) return;
|
|
1207
|
+
const I = { ...U };
|
|
1208
|
+
m.message.body !== void 0 && (I.body = m.message.body), m.message.edited_at !== void 0 && (I.edited_at = m.message.edited_at), m.message.meta !== void 0 && (I.meta = m.message.meta), j[C] = I;
|
|
1209
|
+
const q = n.getConversationById(m.conversation_id);
|
|
1210
|
+
q && q.last_message?.id === m.message.id && (q.last_message = I);
|
|
1211
1211
|
}
|
|
1212
1212
|
}
|
|
1213
|
-
function
|
|
1214
|
-
n.removeMessage(
|
|
1213
|
+
function H(m) {
|
|
1214
|
+
n.removeMessage(m.conversation_id, m.message_id);
|
|
1215
1215
|
}
|
|
1216
|
-
function B(
|
|
1216
|
+
function B(m) {
|
|
1217
1217
|
n.updateMessageReactions(
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1218
|
+
m.conversation_id,
|
|
1219
|
+
m.message_id,
|
|
1220
|
+
m.reactions
|
|
1221
1221
|
);
|
|
1222
1222
|
}
|
|
1223
|
-
function P(
|
|
1224
|
-
const
|
|
1225
|
-
|
|
1226
|
-
(
|
|
1223
|
+
function P(m) {
|
|
1224
|
+
const j = n.getConversationById(m.conversation_id);
|
|
1225
|
+
j && (j.is_request = !1), n.requests = n.requests.filter(
|
|
1226
|
+
(C) => C.id !== m.conversation_id
|
|
1227
1227
|
);
|
|
1228
1228
|
}
|
|
1229
|
-
function
|
|
1230
|
-
|
|
1229
|
+
function L(m) {
|
|
1230
|
+
m.removed_user_id === R.value && ($(), n.deleteConversation(m.conversation_id).catch(() => {
|
|
1231
1231
|
}));
|
|
1232
1232
|
}
|
|
1233
|
-
function
|
|
1234
|
-
const
|
|
1235
|
-
|
|
1233
|
+
function V(m) {
|
|
1234
|
+
const j = l.value;
|
|
1235
|
+
w && (w(), w = null), j && (m && !n.hasGlobalConversationSubscription(j) && mi(j), n.unregisterDetailSubscription(j), l.value = null), o.value = !1;
|
|
1236
|
+
}
|
|
1237
|
+
function O() {
|
|
1238
|
+
const m = E();
|
|
1239
|
+
if (!(o.value || !m)) {
|
|
1236
1240
|
if (!Ae()) {
|
|
1237
1241
|
f();
|
|
1238
1242
|
return;
|
|
1239
1243
|
}
|
|
1240
1244
|
u.value = null;
|
|
1241
1245
|
try {
|
|
1242
|
-
|
|
1243
|
-
onMessageSent:
|
|
1244
|
-
onMessageRead:
|
|
1246
|
+
w = gi(m, {
|
|
1247
|
+
onMessageSent: b,
|
|
1248
|
+
onMessageRead: y,
|
|
1245
1249
|
onMessageEdited: F,
|
|
1246
|
-
onMessageDeleted:
|
|
1250
|
+
onMessageDeleted: H,
|
|
1247
1251
|
onReactionToggled: B,
|
|
1248
1252
|
onRequestAccepted: P,
|
|
1249
|
-
onParticipantRemoved:
|
|
1250
|
-
}), o.value = !0, l.value =
|
|
1251
|
-
} catch (
|
|
1252
|
-
u.value =
|
|
1253
|
+
onParticipantRemoved: L
|
|
1254
|
+
}), o.value = !0, l.value = m, n.registerDetailSubscription(m), _();
|
|
1255
|
+
} catch (j) {
|
|
1256
|
+
u.value = j instanceof Error ? j.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", j);
|
|
1253
1257
|
}
|
|
1254
1258
|
}
|
|
1255
1259
|
}
|
|
1256
|
-
function
|
|
1257
|
-
o.value ||
|
|
1260
|
+
function K() {
|
|
1261
|
+
o.value || O();
|
|
1258
1262
|
}
|
|
1259
|
-
typeof window < "u" && window.addEventListener(De(),
|
|
1260
|
-
const
|
|
1261
|
-
if (
|
|
1262
|
-
o.value ||
|
|
1263
|
+
typeof window < "u" && window.addEventListener(De(), K);
|
|
1264
|
+
const ie = it((m) => {
|
|
1265
|
+
if (m === "connected") {
|
|
1266
|
+
o.value || O();
|
|
1263
1267
|
return;
|
|
1264
1268
|
}
|
|
1265
|
-
(
|
|
1269
|
+
(m === "disconnected" || m === "error") && (_(), V(!1));
|
|
1266
1270
|
});
|
|
1267
|
-
function
|
|
1268
|
-
|
|
1269
|
-
if (S(), !(!o.value || !w))
|
|
1271
|
+
function $() {
|
|
1272
|
+
if (_(), !(!o.value || !l.value))
|
|
1270
1273
|
try {
|
|
1271
|
-
|
|
1272
|
-
} catch (
|
|
1273
|
-
u.value =
|
|
1274
|
+
V(!0), u.value = null;
|
|
1275
|
+
} catch (m) {
|
|
1276
|
+
u.value = m instanceof Error ? m.message : "Failed to unsubscribe from conversation", console.error("ConversationChannel: Unsubscribe error", m);
|
|
1274
1277
|
}
|
|
1275
1278
|
}
|
|
1276
|
-
return
|
|
1277
|
-
|
|
1279
|
+
return Rt(
|
|
1280
|
+
() => E(),
|
|
1281
|
+
(m, j) => {
|
|
1282
|
+
if (m !== j) {
|
|
1283
|
+
if (_(), o.value && V(!0), !m) {
|
|
1284
|
+
u.value = null;
|
|
1285
|
+
return;
|
|
1286
|
+
}
|
|
1287
|
+
O();
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
), h !== null && qe(() => {
|
|
1291
|
+
_(), ie(), $(), typeof window < "u" && window.removeEventListener(De(), K);
|
|
1278
1292
|
}), {
|
|
1279
|
-
isSubscribed:
|
|
1280
|
-
error:
|
|
1281
|
-
subscribe:
|
|
1282
|
-
unsubscribe:
|
|
1293
|
+
isSubscribed: re(() => o.value),
|
|
1294
|
+
error: re(() => u.value),
|
|
1295
|
+
subscribe: O,
|
|
1296
|
+
unsubscribe: $
|
|
1283
1297
|
};
|
|
1284
1298
|
}
|
|
1285
1299
|
const Kn = () => () => {
|
|
@@ -1322,15 +1336,15 @@ const ro = {
|
|
|
1322
1336
|
error: () => {
|
|
1323
1337
|
}
|
|
1324
1338
|
}, Qn = () => ro;
|
|
1325
|
-
let
|
|
1326
|
-
function
|
|
1327
|
-
return
|
|
1339
|
+
let Dt = Qn;
|
|
1340
|
+
function qt() {
|
|
1341
|
+
return Dt;
|
|
1328
1342
|
}
|
|
1329
1343
|
function io(e) {
|
|
1330
|
-
|
|
1344
|
+
Dt = e;
|
|
1331
1345
|
}
|
|
1332
1346
|
function oo() {
|
|
1333
|
-
|
|
1347
|
+
Dt = Qn;
|
|
1334
1348
|
}
|
|
1335
1349
|
const ao = {
|
|
1336
1350
|
connected: "",
|
|
@@ -1338,7 +1352,7 @@ const ao = {
|
|
|
1338
1352
|
disconnected: "",
|
|
1339
1353
|
error: "",
|
|
1340
1354
|
unknown: ""
|
|
1341
|
-
}, Rn =
|
|
1355
|
+
}, Rn = qt()("ConnectionStatus");
|
|
1342
1356
|
function An(e) {
|
|
1343
1357
|
return e?.connector?.pusher?.connection ?? null;
|
|
1344
1358
|
}
|
|
@@ -1360,13 +1374,13 @@ function co(e) {
|
|
|
1360
1374
|
function Pn(e) {
|
|
1361
1375
|
return e.getEchoConnection()?.state ?? null;
|
|
1362
1376
|
}
|
|
1363
|
-
function
|
|
1377
|
+
function Ua(e = {}) {
|
|
1364
1378
|
const o = co(e.source ?? "app"), u = {
|
|
1365
1379
|
...ao,
|
|
1366
1380
|
...e.icons
|
|
1367
|
-
}, l = de(o.getConnectionStatus()), h = de(null), g = de(0), d = de(!1), A = de(!1), x = de(!1),
|
|
1368
|
-
let
|
|
1369
|
-
const F =
|
|
1381
|
+
}, l = de(o.getConnectionStatus()), h = de(null), g = de(0), d = de(!1), A = de(!1), x = de(!1), v = de(!1);
|
|
1382
|
+
let w = null, R = null, E = null, _ = null, f = null, b = null, y = null;
|
|
1383
|
+
const F = re(() => l.value === "connected"), H = re(() => l.value === "connecting"), B = re(() => l.value === "disconnected"), P = re(() => l.value === "error"), L = re(() => B.value || P.value), V = re(() => {
|
|
1370
1384
|
switch (l.value) {
|
|
1371
1385
|
case "connecting":
|
|
1372
1386
|
return g.value > 0 ? "Reconnecting..." : "Connecting...";
|
|
@@ -1379,7 +1393,7 @@ function La(e = {}) {
|
|
|
1379
1393
|
default:
|
|
1380
1394
|
return "Unknown connection state";
|
|
1381
1395
|
}
|
|
1382
|
-
}),
|
|
1396
|
+
}), O = re(() => {
|
|
1383
1397
|
switch (l.value) {
|
|
1384
1398
|
case "connected":
|
|
1385
1399
|
return "success";
|
|
@@ -1391,7 +1405,7 @@ function La(e = {}) {
|
|
|
1391
1405
|
default:
|
|
1392
1406
|
return "medium";
|
|
1393
1407
|
}
|
|
1394
|
-
}), K =
|
|
1408
|
+
}), K = re(() => {
|
|
1395
1409
|
switch (l.value) {
|
|
1396
1410
|
case "connected":
|
|
1397
1411
|
return u.connected;
|
|
@@ -1404,137 +1418,137 @@ function La(e = {}) {
|
|
|
1404
1418
|
default:
|
|
1405
1419
|
return u.unknown;
|
|
1406
1420
|
}
|
|
1407
|
-
}),
|
|
1421
|
+
}), ie = async () => {
|
|
1408
1422
|
Rn.debug("Manual reconnect triggered"), g.value += 1, await o.reconnect();
|
|
1409
|
-
},
|
|
1410
|
-
if (
|
|
1411
|
-
const
|
|
1423
|
+
}, $ = (I, q = l.value) => {
|
|
1424
|
+
if (I !== "connecting" && R && (clearTimeout(R), R = null), I === "disconnected" || I === "error") {
|
|
1425
|
+
const se = !v.value && q === I, je = !A.value && (se || q === "connected" || q === "connecting");
|
|
1412
1426
|
if (x.value = !0, je) {
|
|
1413
|
-
d.value = !1,
|
|
1414
|
-
|
|
1427
|
+
d.value = !1, E && clearTimeout(E), E = setTimeout(() => {
|
|
1428
|
+
E = null, l.value !== "connected" && (d.value = !0);
|
|
1415
1429
|
}, 2e3);
|
|
1416
1430
|
return;
|
|
1417
1431
|
}
|
|
1418
|
-
|
|
1432
|
+
E && (clearTimeout(E), E = null), d.value = !0;
|
|
1419
1433
|
return;
|
|
1420
1434
|
}
|
|
1421
|
-
if (
|
|
1422
|
-
|
|
1435
|
+
if (I === "connected") {
|
|
1436
|
+
E && (clearTimeout(E), E = null), d.value = !1, A.value = !1, x.value = !1;
|
|
1423
1437
|
return;
|
|
1424
1438
|
}
|
|
1425
|
-
if (
|
|
1439
|
+
if (I === "connecting") {
|
|
1426
1440
|
if (A.value) {
|
|
1427
1441
|
d.value = !0;
|
|
1428
1442
|
return;
|
|
1429
1443
|
}
|
|
1430
|
-
if (x.value || (d.value = !1),
|
|
1444
|
+
if (x.value || (d.value = !1), R)
|
|
1431
1445
|
return;
|
|
1432
|
-
|
|
1433
|
-
if (
|
|
1446
|
+
R = setTimeout(() => {
|
|
1447
|
+
if (R = null, l.value === "connecting") {
|
|
1434
1448
|
if (Pn(o) === "connected") {
|
|
1435
|
-
|
|
1449
|
+
m("connected");
|
|
1436
1450
|
return;
|
|
1437
1451
|
}
|
|
1438
|
-
A.value = !0, Rn.warn("Still connecting after 10s, treating as disconnected"),
|
|
1452
|
+
A.value = !0, Rn.warn("Still connecting after 10s, treating as disconnected"), m("disconnected"), g.value += 1, o.reconnect();
|
|
1439
1453
|
}
|
|
1440
1454
|
}, 1e4);
|
|
1441
1455
|
}
|
|
1442
|
-
},
|
|
1443
|
-
const
|
|
1444
|
-
if (
|
|
1445
|
-
l.value = "disconnected",
|
|
1456
|
+
}, m = (I) => {
|
|
1457
|
+
const q = l.value;
|
|
1458
|
+
if (I === "connecting" && A.value) {
|
|
1459
|
+
l.value = "disconnected", $("disconnected", q);
|
|
1446
1460
|
return;
|
|
1447
1461
|
}
|
|
1448
|
-
l.value =
|
|
1449
|
-
},
|
|
1450
|
-
const
|
|
1451
|
-
if (
|
|
1452
|
-
|
|
1462
|
+
l.value = I, I === "connecting" && (q === "disconnected" || q === "error") && g.value === 0 && (g.value = 1), I === "connected" && (h.value = /* @__PURE__ */ new Date(), g.value = 0), $(I, q);
|
|
1463
|
+
}, j = () => {
|
|
1464
|
+
const I = Pn(o), q = l.value;
|
|
1465
|
+
if (I === "connected" && q !== "connected") {
|
|
1466
|
+
m("connected");
|
|
1453
1467
|
return;
|
|
1454
1468
|
}
|
|
1455
|
-
if (
|
|
1456
|
-
|
|
1469
|
+
if (I === "connecting" && q !== "connecting") {
|
|
1470
|
+
m("connecting");
|
|
1457
1471
|
return;
|
|
1458
1472
|
}
|
|
1459
|
-
if ((
|
|
1460
|
-
|
|
1473
|
+
if ((I === "unavailable" || I === "failed" || I === "disconnected") && q !== "disconnected") {
|
|
1474
|
+
m("disconnected");
|
|
1461
1475
|
return;
|
|
1462
1476
|
}
|
|
1463
|
-
const
|
|
1464
|
-
!
|
|
1477
|
+
const se = o.getConnectionStatus();
|
|
1478
|
+
!I && se === "connected" && q !== "connected" && m("connected");
|
|
1465
1479
|
}, C = () => {
|
|
1466
|
-
if (f?.unbind &&
|
|
1480
|
+
if (f?.unbind && y && (f.unbind("connected", y.connected), f.unbind("connecting", y.connecting), f.unbind("disconnected", y.disconnected), f.unbind("unavailable", y.unavailable), f.unbind("error", y.error), f.unbind("state_change", y.stateChange)), f = o.getEchoConnection(), y = null, !f?.bind)
|
|
1467
1481
|
return;
|
|
1468
|
-
|
|
1469
|
-
connected: () =>
|
|
1470
|
-
connecting: () =>
|
|
1471
|
-
disconnected: () =>
|
|
1472
|
-
unavailable: () =>
|
|
1473
|
-
error: () =>
|
|
1474
|
-
stateChange: (
|
|
1475
|
-
const
|
|
1476
|
-
if (
|
|
1477
|
-
|
|
1482
|
+
y = {
|
|
1483
|
+
connected: () => m("connected"),
|
|
1484
|
+
connecting: () => m("connecting"),
|
|
1485
|
+
disconnected: () => m("disconnected"),
|
|
1486
|
+
unavailable: () => m("disconnected"),
|
|
1487
|
+
error: () => m("error"),
|
|
1488
|
+
stateChange: (q) => {
|
|
1489
|
+
const se = q?.current;
|
|
1490
|
+
if (se === "connected") {
|
|
1491
|
+
m("connected");
|
|
1478
1492
|
return;
|
|
1479
1493
|
}
|
|
1480
|
-
if (
|
|
1481
|
-
|
|
1494
|
+
if (se === "connecting") {
|
|
1495
|
+
m("connecting");
|
|
1482
1496
|
return;
|
|
1483
1497
|
}
|
|
1484
|
-
(
|
|
1498
|
+
(se === "unavailable" || se === "failed" || se === "disconnected") && m("disconnected");
|
|
1485
1499
|
}
|
|
1486
|
-
}, f.bind("connected",
|
|
1487
|
-
const
|
|
1488
|
-
if (
|
|
1489
|
-
|
|
1500
|
+
}, f.bind("connected", y.connected), f.bind("connecting", y.connecting), f.bind("disconnected", y.disconnected), f.bind("unavailable", y.unavailable), f.bind("error", y.error), f.bind("state_change", y.stateChange);
|
|
1501
|
+
const I = f.state ?? null;
|
|
1502
|
+
if (I === "connected") {
|
|
1503
|
+
m("connected");
|
|
1490
1504
|
return;
|
|
1491
1505
|
}
|
|
1492
|
-
if (
|
|
1493
|
-
|
|
1506
|
+
if (I === "connecting") {
|
|
1507
|
+
m("connecting");
|
|
1494
1508
|
return;
|
|
1495
1509
|
}
|
|
1496
|
-
(
|
|
1497
|
-
},
|
|
1510
|
+
(I === "unavailable" || I === "failed" || I === "disconnected") && m("disconnected");
|
|
1511
|
+
}, U = re(() => {
|
|
1498
1512
|
if (!h.value || !F.value)
|
|
1499
1513
|
return null;
|
|
1500
|
-
const
|
|
1501
|
-
return
|
|
1514
|
+
const I = Date.now() - h.value.getTime(), q = Math.floor(I / 6e4), se = Math.floor(I % 6e4 / 1e3);
|
|
1515
|
+
return q > 0 ? `${q}m ${se}s` : `${se}s`;
|
|
1502
1516
|
});
|
|
1503
1517
|
return Un(() => {
|
|
1504
|
-
l.value = o.getConnectionStatus(),
|
|
1505
|
-
C(),
|
|
1506
|
-
}, window.addEventListener(o.initializedEvent,
|
|
1507
|
-
|
|
1518
|
+
l.value = o.getConnectionStatus(), w = o.onConnectionStatusChange(m), F.value && (h.value = /* @__PURE__ */ new Date()), $(l.value, l.value), v.value = !0, C(), b = () => {
|
|
1519
|
+
C(), j();
|
|
1520
|
+
}, window.addEventListener(o.initializedEvent, b), j(), _ = setInterval(() => {
|
|
1521
|
+
j();
|
|
1508
1522
|
}, 3e3);
|
|
1509
1523
|
}), qe(() => {
|
|
1510
|
-
|
|
1524
|
+
w?.(), R && (clearTimeout(R), R = null), E && (clearTimeout(E), E = null), _ && (clearInterval(_), _ = null), b && (window.removeEventListener(o.initializedEvent, b), b = null), f?.unbind && y && (f.unbind("connected", y.connected), f.unbind("connecting", y.connecting), f.unbind("disconnected", y.disconnected), f.unbind("unavailable", y.unavailable), f.unbind("error", y.error), f.unbind("state_change", y.stateChange)), f = null, y = null;
|
|
1511
1525
|
}), {
|
|
1512
|
-
connectionStatus:
|
|
1526
|
+
connectionStatus: re(() => l.value),
|
|
1513
1527
|
isConnected: F,
|
|
1514
|
-
isConnecting:
|
|
1528
|
+
isConnecting: H,
|
|
1515
1529
|
isDisconnected: B,
|
|
1516
1530
|
isError: P,
|
|
1517
|
-
hasConnectionIssues:
|
|
1518
|
-
statusMessage:
|
|
1519
|
-
statusColor:
|
|
1531
|
+
hasConnectionIssues: L,
|
|
1532
|
+
statusMessage: V,
|
|
1533
|
+
statusColor: O,
|
|
1520
1534
|
statusIcon: K,
|
|
1521
|
-
showConnectionBanner:
|
|
1522
|
-
lastConnectionTime:
|
|
1523
|
-
connectionUptime:
|
|
1524
|
-
reconnectAttempts:
|
|
1525
|
-
reconnect:
|
|
1535
|
+
showConnectionBanner: re(() => d.value),
|
|
1536
|
+
lastConnectionTime: re(() => h.value),
|
|
1537
|
+
connectionUptime: U,
|
|
1538
|
+
reconnectAttempts: re(() => g.value),
|
|
1539
|
+
reconnect: ie
|
|
1526
1540
|
};
|
|
1527
1541
|
}
|
|
1528
|
-
const Zn =
|
|
1529
|
-
let
|
|
1542
|
+
const Zn = kt;
|
|
1543
|
+
let zt = Zn;
|
|
1530
1544
|
function es() {
|
|
1531
|
-
return
|
|
1545
|
+
return zt;
|
|
1532
1546
|
}
|
|
1533
1547
|
function uo(e) {
|
|
1534
|
-
|
|
1548
|
+
zt = e;
|
|
1535
1549
|
}
|
|
1536
1550
|
function lo() {
|
|
1537
|
-
|
|
1551
|
+
zt = Zn;
|
|
1538
1552
|
}
|
|
1539
1553
|
const ho = 6e4;
|
|
1540
1554
|
function fo(e) {
|
|
@@ -1552,7 +1566,7 @@ function ts(e) {
|
|
|
1552
1566
|
const n = e.trim();
|
|
1553
1567
|
return n.length > 0 ? n : null;
|
|
1554
1568
|
}
|
|
1555
|
-
function
|
|
1569
|
+
function xt(e) {
|
|
1556
1570
|
const n = ts(e);
|
|
1557
1571
|
if (n === null)
|
|
1558
1572
|
return null;
|
|
@@ -1564,7 +1578,7 @@ function go(e, n, i = {}) {
|
|
|
1564
1578
|
return null;
|
|
1565
1579
|
if (e === "offline")
|
|
1566
1580
|
return "offline";
|
|
1567
|
-
const o =
|
|
1581
|
+
const o = xt(n);
|
|
1568
1582
|
if (o === null)
|
|
1569
1583
|
return e;
|
|
1570
1584
|
const u = i.now ?? Date.now(), l = i.staleAfterMs ?? ho;
|
|
@@ -1579,165 +1593,165 @@ function xn(e, n = {}) {
|
|
|
1579
1593
|
}
|
|
1580
1594
|
const ns = () => {
|
|
1581
1595
|
};
|
|
1582
|
-
let
|
|
1596
|
+
let jt = ns;
|
|
1583
1597
|
function mo() {
|
|
1584
|
-
return
|
|
1598
|
+
return jt;
|
|
1585
1599
|
}
|
|
1586
1600
|
function vo(e) {
|
|
1587
|
-
|
|
1601
|
+
jt = e;
|
|
1588
1602
|
}
|
|
1589
1603
|
function bo() {
|
|
1590
|
-
|
|
1604
|
+
jt = ns;
|
|
1591
1605
|
}
|
|
1592
|
-
const Ye =
|
|
1593
|
-
function
|
|
1594
|
-
const e =
|
|
1606
|
+
const Ye = qt()("GlobalMessaging"), yo = 3, _o = (e) => e.replace(/\/+$/, ""), So = (e) => _o(window.location.pathname) === `/messages/${e}`, wo = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
1607
|
+
function Oa() {
|
|
1608
|
+
const e = Ft(), n = Pe()(), i = mo(), o = es(), u = hi(), l = Mt(), { conversations: h } = ui(e), g = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Map();
|
|
1595
1609
|
let A = !1;
|
|
1596
1610
|
function x(P) {
|
|
1597
|
-
const
|
|
1598
|
-
if (
|
|
1599
|
-
for (const
|
|
1611
|
+
const L = d.get(P);
|
|
1612
|
+
if (L && (d.delete(P), typeof L.channel.stopListening == "function"))
|
|
1613
|
+
for (const V of L.bindings)
|
|
1600
1614
|
try {
|
|
1601
|
-
|
|
1615
|
+
L.channel.stopListening(V.event, V.handler);
|
|
1602
1616
|
} catch {
|
|
1603
1617
|
}
|
|
1604
1618
|
}
|
|
1605
|
-
function
|
|
1619
|
+
function v() {
|
|
1606
1620
|
for (const P of g)
|
|
1607
1621
|
x(P), e.unregisterGlobalConversationSubscription(P);
|
|
1608
1622
|
g.clear();
|
|
1609
1623
|
}
|
|
1610
|
-
function
|
|
1611
|
-
const
|
|
1612
|
-
if (!
|
|
1613
|
-
const
|
|
1624
|
+
function w(P) {
|
|
1625
|
+
const L = Ae();
|
|
1626
|
+
if (!L || g.has(P)) return;
|
|
1627
|
+
const V = `conversation.${P}`;
|
|
1614
1628
|
x(P);
|
|
1615
|
-
const
|
|
1616
|
-
if (!Si(
|
|
1617
|
-
Ye.warn("Dropping malformed ConversationMessageSent event",
|
|
1629
|
+
const O = L.private(V), K = (m) => {
|
|
1630
|
+
if (!Si(m)) {
|
|
1631
|
+
Ye.warn("Dropping malformed ConversationMessageSent event", m);
|
|
1618
1632
|
return;
|
|
1619
1633
|
}
|
|
1620
|
-
const
|
|
1621
|
-
if (!C ||
|
|
1622
|
-
e.addMessage(
|
|
1623
|
-
const
|
|
1624
|
-
if (
|
|
1625
|
-
const
|
|
1626
|
-
|
|
1634
|
+
const j = m, C = n.currentUser?.id;
|
|
1635
|
+
if (!C || j.message.author_id === C) return;
|
|
1636
|
+
e.addMessage(j.message);
|
|
1637
|
+
const U = e.hasDetailSubscription(j.conversation_id), I = So(j.conversation_id);
|
|
1638
|
+
if (U || I) {
|
|
1639
|
+
const se = e.getConversationById(j.conversation_id);
|
|
1640
|
+
se && (se.unread_count = 0), e.markAsRead(j.conversation_id).catch(() => {
|
|
1627
1641
|
});
|
|
1628
1642
|
return;
|
|
1629
1643
|
}
|
|
1630
|
-
const
|
|
1631
|
-
if (
|
|
1632
|
-
const
|
|
1633
|
-
|
|
1644
|
+
const q = e.getConversationById(j.conversation_id);
|
|
1645
|
+
if (q) {
|
|
1646
|
+
const se = wo(q);
|
|
1647
|
+
se || q.unread_count++, i(se);
|
|
1634
1648
|
}
|
|
1635
|
-
},
|
|
1636
|
-
if (!wi(
|
|
1637
|
-
Ye.warn("Dropping malformed ConversationMessageRead event",
|
|
1649
|
+
}, ie = (m) => {
|
|
1650
|
+
if (!wi(m)) {
|
|
1651
|
+
Ye.warn("Dropping malformed ConversationMessageRead event", m);
|
|
1638
1652
|
return;
|
|
1639
1653
|
}
|
|
1640
|
-
e.applyParticipantReadState(
|
|
1641
|
-
},
|
|
1642
|
-
if (!Ci(
|
|
1643
|
-
Ye.warn("Dropping malformed ConversationRequestAccepted event",
|
|
1654
|
+
e.applyParticipantReadState(m);
|
|
1655
|
+
}, $ = (m) => {
|
|
1656
|
+
if (!Ci(m)) {
|
|
1657
|
+
Ye.warn("Dropping malformed ConversationRequestAccepted event", m);
|
|
1644
1658
|
return;
|
|
1645
1659
|
}
|
|
1646
|
-
const
|
|
1660
|
+
const j = m, C = e.getConversationById(j.conversation_id);
|
|
1647
1661
|
C && (C.is_request = !1), e.requests = e.requests.filter(
|
|
1648
|
-
(
|
|
1662
|
+
(U) => U.id !== j.conversation_id
|
|
1649
1663
|
);
|
|
1650
1664
|
};
|
|
1651
|
-
|
|
1652
|
-
channel:
|
|
1665
|
+
O.listen(".ConversationMessageSent", K), O.listen(".ConversationMessageRead", ie), O.listen(".ConversationRequestAccepted", $), d.set(P, {
|
|
1666
|
+
channel: O,
|
|
1653
1667
|
bindings: [
|
|
1654
1668
|
{ event: ".ConversationMessageSent", handler: K },
|
|
1655
|
-
{ event: ".ConversationMessageRead", handler:
|
|
1656
|
-
{ event: ".ConversationRequestAccepted", handler:
|
|
1669
|
+
{ event: ".ConversationMessageRead", handler: ie },
|
|
1670
|
+
{ event: ".ConversationRequestAccepted", handler: $ }
|
|
1657
1671
|
]
|
|
1658
1672
|
}), g.add(P), e.registerGlobalConversationSubscription(P);
|
|
1659
1673
|
}
|
|
1660
|
-
function
|
|
1674
|
+
function R() {
|
|
1661
1675
|
const P = Ae();
|
|
1662
1676
|
if (!P) {
|
|
1663
|
-
|
|
1677
|
+
v();
|
|
1664
1678
|
return;
|
|
1665
1679
|
}
|
|
1666
|
-
for (const
|
|
1667
|
-
x(
|
|
1680
|
+
for (const L of g) {
|
|
1681
|
+
x(L);
|
|
1668
1682
|
try {
|
|
1669
|
-
P.leave(`conversation.${
|
|
1683
|
+
P.leave(`conversation.${L}`);
|
|
1670
1684
|
} catch {
|
|
1671
1685
|
}
|
|
1672
|
-
e.unregisterGlobalConversationSubscription(
|
|
1686
|
+
e.unregisterGlobalConversationSubscription(L);
|
|
1673
1687
|
}
|
|
1674
1688
|
g.clear();
|
|
1675
1689
|
}
|
|
1676
|
-
function
|
|
1690
|
+
function E() {
|
|
1677
1691
|
const P = Ae();
|
|
1678
1692
|
if (!P) return;
|
|
1679
|
-
const
|
|
1680
|
-
for (const
|
|
1681
|
-
if (
|
|
1693
|
+
const L = e.conversations.slice(0, yo), V = new Set(L.map((O) => O.id));
|
|
1694
|
+
for (const O of g)
|
|
1695
|
+
if (!V.has(O) && !e.hasDetailSubscription(O)) {
|
|
1682
1696
|
try {
|
|
1683
|
-
x(
|
|
1697
|
+
x(O), P.leave(`conversation.${O}`);
|
|
1684
1698
|
} catch {
|
|
1685
1699
|
}
|
|
1686
|
-
g.delete(
|
|
1700
|
+
g.delete(O), e.unregisterGlobalConversationSubscription(O);
|
|
1687
1701
|
}
|
|
1688
|
-
for (const
|
|
1689
|
-
|
|
1702
|
+
for (const O of L)
|
|
1703
|
+
w(O.id);
|
|
1690
1704
|
}
|
|
1691
|
-
function
|
|
1692
|
-
const
|
|
1705
|
+
function _(P) {
|
|
1706
|
+
const L = xn({
|
|
1693
1707
|
status: P.status,
|
|
1694
1708
|
last_seen_at: P.last_seen_at ?? null
|
|
1695
1709
|
});
|
|
1696
|
-
|
|
1710
|
+
L.status !== null && e.updatePresenceForUser(
|
|
1697
1711
|
P.user_id,
|
|
1698
|
-
|
|
1699
|
-
|
|
1712
|
+
L.status,
|
|
1713
|
+
L.lastSeenAt
|
|
1700
1714
|
);
|
|
1701
1715
|
}
|
|
1702
1716
|
async function f() {
|
|
1703
1717
|
const P = [...new Set(
|
|
1704
|
-
e.conversations.filter((
|
|
1718
|
+
e.conversations.filter((L) => L.type === "dm" && typeof L.other_user_id == "string" && L.other_user_id.length > 0).map((L) => L.other_user_id)
|
|
1705
1719
|
)];
|
|
1706
1720
|
if (P.length !== 0)
|
|
1707
1721
|
try {
|
|
1708
|
-
const
|
|
1722
|
+
const L = await o.get("/v1/presence/users", {
|
|
1709
1723
|
params: { ids: P }
|
|
1710
|
-
}),
|
|
1711
|
-
for (const
|
|
1712
|
-
const K = xn(
|
|
1713
|
-
K.status !== null && e.updatePresenceForUser(
|
|
1724
|
+
}), V = L.data?.data?.items ?? L.data?.items ?? [];
|
|
1725
|
+
for (const O of V) {
|
|
1726
|
+
const K = xn(O);
|
|
1727
|
+
K.status !== null && e.updatePresenceForUser(O.id, K.status, K.lastSeenAt);
|
|
1714
1728
|
}
|
|
1715
|
-
} catch (
|
|
1716
|
-
Ye.warn("Failed to refresh messaging presence snapshot",
|
|
1729
|
+
} catch (L) {
|
|
1730
|
+
Ye.warn("Failed to refresh messaging presence snapshot", L);
|
|
1717
1731
|
}
|
|
1718
1732
|
}
|
|
1719
|
-
function v() {
|
|
1720
|
-
!Ae() || A || (fi(S), A = !0);
|
|
1721
|
-
}
|
|
1722
1733
|
function b() {
|
|
1734
|
+
!Ae() || A || (fi(_), A = !0);
|
|
1735
|
+
}
|
|
1736
|
+
function y() {
|
|
1723
1737
|
A && (pi(), A = !1);
|
|
1724
1738
|
}
|
|
1725
|
-
const F =
|
|
1739
|
+
const F = Rt(
|
|
1726
1740
|
h,
|
|
1727
1741
|
() => {
|
|
1728
|
-
|
|
1742
|
+
E();
|
|
1729
1743
|
},
|
|
1730
1744
|
{ deep: !1, immediate: !0 }
|
|
1731
|
-
),
|
|
1745
|
+
), H = Rt(
|
|
1732
1746
|
() => u.fullPath,
|
|
1733
1747
|
() => {
|
|
1734
|
-
|
|
1748
|
+
E();
|
|
1735
1749
|
}
|
|
1736
1750
|
), B = it((P) => {
|
|
1737
|
-
P === "connected" ? (
|
|
1751
|
+
P === "connected" ? (v(), E(), y(), b(), f()) : (P === "disconnected" || P === "error") && (v(), y());
|
|
1738
1752
|
});
|
|
1739
|
-
|
|
1740
|
-
F(),
|
|
1753
|
+
E(), b(), f(), l !== null && qe(() => {
|
|
1754
|
+
F(), H(), B(), R(), y();
|
|
1741
1755
|
});
|
|
1742
1756
|
}
|
|
1743
1757
|
const ss = {
|
|
@@ -1825,7 +1839,10 @@ function No(e, n = Date.now()) {
|
|
|
1825
1839
|
function Fo(e) {
|
|
1826
1840
|
ze()?.removeItem(e);
|
|
1827
1841
|
}
|
|
1828
|
-
function Do(e
|
|
1842
|
+
function Do(e) {
|
|
1843
|
+
return e.startsWith("/v1/") ? `/api${e}` : e;
|
|
1844
|
+
}
|
|
1845
|
+
function qo(e, n, i) {
|
|
1829
1846
|
if (typeof fetch > "u")
|
|
1830
1847
|
return null;
|
|
1831
1848
|
const o = {
|
|
@@ -1834,7 +1851,7 @@ function Do(e, n, i) {
|
|
|
1834
1851
|
};
|
|
1835
1852
|
i && (o.Authorization = `Bearer ${i}`);
|
|
1836
1853
|
try {
|
|
1837
|
-
return fetch(e, {
|
|
1854
|
+
return fetch(Do(e), {
|
|
1838
1855
|
method: "POST",
|
|
1839
1856
|
headers: o,
|
|
1840
1857
|
body: JSON.stringify({ client_id: n }),
|
|
@@ -1846,41 +1863,41 @@ function Do(e, n, i) {
|
|
|
1846
1863
|
return null;
|
|
1847
1864
|
}
|
|
1848
1865
|
}
|
|
1849
|
-
function
|
|
1866
|
+
function Na() {
|
|
1850
1867
|
const e = Pe()(), n = Co(), i = es(), o = Uo(n.clientIdStorageKey);
|
|
1851
1868
|
let u = null, l = null, h = !1, g = Tt(n.accountLimitedUntilStorageKey), d = !1, A = null, x = 0;
|
|
1852
|
-
const
|
|
1869
|
+
const v = () => {
|
|
1853
1870
|
u && (clearInterval(u), u = null);
|
|
1854
|
-
},
|
|
1871
|
+
}, w = () => {
|
|
1855
1872
|
l && (clearTimeout(l), l = null);
|
|
1856
|
-
},
|
|
1857
|
-
|
|
1858
|
-
|
|
1873
|
+
}, R = () => {
|
|
1874
|
+
v(), u = setInterval(() => {
|
|
1875
|
+
L();
|
|
1859
1876
|
}, n.heartbeatIntervalMs);
|
|
1860
|
-
},
|
|
1861
|
-
g || console.warn(
|
|
1862
|
-
},
|
|
1863
|
-
if (!(!h || d || g) && A !==
|
|
1877
|
+
}, E = ($) => {
|
|
1878
|
+
g || console.warn($), No(n.accountLimitedUntilStorageKey), g = !0, h = !1, A = null, v(), w();
|
|
1879
|
+
}, _ = async ($) => {
|
|
1880
|
+
if (!(!h || d || g) && A !== $)
|
|
1864
1881
|
try {
|
|
1865
|
-
await i.patch(n.statusUrl, { status:
|
|
1866
|
-
} catch (
|
|
1867
|
-
Ct(
|
|
1882
|
+
await i.patch(n.statusUrl, { status: $ }), A = $;
|
|
1883
|
+
} catch (m) {
|
|
1884
|
+
Ct(m) && E("[Presence] Presence updates paused: account is temporarily limited");
|
|
1868
1885
|
}
|
|
1869
1886
|
}, f = () => {
|
|
1870
|
-
|
|
1871
|
-
l = null,
|
|
1887
|
+
w(), !(!h || d || g || document.visibilityState !== "visible") && (l = setTimeout(() => {
|
|
1888
|
+
l = null, _("idle");
|
|
1872
1889
|
}, n.idleAfterMs));
|
|
1873
|
-
},
|
|
1890
|
+
}, b = () => {
|
|
1874
1891
|
if (d || !h || g || document.visibilityState !== "visible")
|
|
1875
1892
|
return;
|
|
1876
|
-
const
|
|
1877
|
-
|
|
1878
|
-
},
|
|
1879
|
-
|
|
1893
|
+
const $ = Date.now();
|
|
1894
|
+
$ - x < n.activityDebounceMs || (x = $, _("online"), f());
|
|
1895
|
+
}, y = () => {
|
|
1896
|
+
b();
|
|
1880
1897
|
}, F = () => {
|
|
1881
|
-
typeof document > "u" || typeof window > "u" || (document.addEventListener("pointerdown",
|
|
1882
|
-
},
|
|
1883
|
-
typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown",
|
|
1898
|
+
typeof document > "u" || typeof window > "u" || (document.addEventListener("pointerdown", y, { passive: !0 }), document.addEventListener("keydown", y), document.addEventListener("touchstart", y, { passive: !0 }), window.addEventListener("focus", y));
|
|
1899
|
+
}, H = () => {
|
|
1900
|
+
typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", y), document.removeEventListener("keydown", y), document.removeEventListener("touchstart", y), window.removeEventListener("focus", y));
|
|
1884
1901
|
}, B = async () => {
|
|
1885
1902
|
if (Tt(n.accountLimitedUntilStorageKey))
|
|
1886
1903
|
return g = !0, "account_limited";
|
|
@@ -1889,214 +1906,214 @@ function Oa() {
|
|
|
1889
1906
|
client_id: o,
|
|
1890
1907
|
user_agent: n.userAgentResolver()
|
|
1891
1908
|
}), Fo(n.accountLimitedUntilStorageKey), g = !1, h = !0, A = null, "opened";
|
|
1892
|
-
} catch (
|
|
1893
|
-
return Ct(
|
|
1909
|
+
} catch ($) {
|
|
1910
|
+
return Ct($) ? (E("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : "failed";
|
|
1894
1911
|
}
|
|
1895
1912
|
}, P = async () => {
|
|
1896
|
-
for (let
|
|
1913
|
+
for (let $ = 0; $ < Mo; $ += 1)
|
|
1897
1914
|
if (await B() !== "failed")
|
|
1898
1915
|
return;
|
|
1899
1916
|
console.warn("[Presence] Failed to open session");
|
|
1900
|
-
},
|
|
1917
|
+
}, L = async () => {
|
|
1901
1918
|
if (h)
|
|
1902
1919
|
try {
|
|
1903
1920
|
await i.post(n.sessionHeartbeatUrl, { client_id: o });
|
|
1904
|
-
} catch (
|
|
1905
|
-
Ct(
|
|
1921
|
+
} catch ($) {
|
|
1922
|
+
Ct($) && E("[Presence] Heartbeat paused: account is temporarily limited");
|
|
1906
1923
|
}
|
|
1907
|
-
},
|
|
1924
|
+
}, V = () => {
|
|
1908
1925
|
if (!h)
|
|
1909
1926
|
return;
|
|
1910
|
-
h = !1, A = null,
|
|
1911
|
-
const
|
|
1927
|
+
h = !1, A = null, w();
|
|
1928
|
+
const $ = qo(
|
|
1912
1929
|
n.sessionCloseUrl,
|
|
1913
1930
|
o,
|
|
1914
1931
|
n.authTokenResolver()
|
|
1915
1932
|
);
|
|
1916
|
-
if (
|
|
1917
|
-
|
|
1933
|
+
if ($) {
|
|
1934
|
+
$.catch(() => {
|
|
1918
1935
|
});
|
|
1919
1936
|
return;
|
|
1920
1937
|
}
|
|
1921
1938
|
i.post(n.sessionCloseUrl, { client_id: o }).catch(() => {
|
|
1922
1939
|
});
|
|
1923
|
-
},
|
|
1940
|
+
}, O = async () => {
|
|
1924
1941
|
if (!d) {
|
|
1925
1942
|
if (await P(), d) {
|
|
1926
|
-
|
|
1943
|
+
V();
|
|
1927
1944
|
return;
|
|
1928
1945
|
}
|
|
1929
|
-
h && (
|
|
1946
|
+
h && (R(), _("online"), f());
|
|
1930
1947
|
}
|
|
1931
1948
|
}, K = () => {
|
|
1932
1949
|
if (!d) {
|
|
1933
1950
|
if (document.visibilityState === "hidden") {
|
|
1934
|
-
|
|
1951
|
+
V(), v(), w();
|
|
1935
1952
|
return;
|
|
1936
1953
|
}
|
|
1937
1954
|
if (document.visibilityState === "visible" && !h) {
|
|
1938
|
-
g = Tt(n.accountLimitedUntilStorageKey), g ||
|
|
1955
|
+
g = Tt(n.accountLimitedUntilStorageKey), g || O();
|
|
1939
1956
|
return;
|
|
1940
1957
|
}
|
|
1941
|
-
document.visibilityState === "visible" && h && !g &&
|
|
1958
|
+
document.visibilityState === "visible" && h && !g && b();
|
|
1942
1959
|
}
|
|
1943
|
-
},
|
|
1944
|
-
d || (
|
|
1960
|
+
}, ie = () => {
|
|
1961
|
+
d || (V(), v(), w());
|
|
1945
1962
|
};
|
|
1946
1963
|
Un(async () => {
|
|
1947
1964
|
if (e.isAuthenticated ?? e.currentUser !== null) {
|
|
1948
1965
|
if (await P(), d) {
|
|
1949
|
-
|
|
1966
|
+
V();
|
|
1950
1967
|
return;
|
|
1951
1968
|
}
|
|
1952
|
-
h && (
|
|
1969
|
+
h && (R(), _("online"), f()), F(), document.addEventListener("visibilitychange", K), window.addEventListener("pagehide", ie), window.addEventListener("beforeunload", ie);
|
|
1953
1970
|
}
|
|
1954
1971
|
}), qe(() => {
|
|
1955
|
-
d = !0,
|
|
1972
|
+
d = !0, H(), w(), v(), V(), document.removeEventListener("visibilitychange", K), window.removeEventListener("pagehide", ie), window.removeEventListener("beforeunload", ie);
|
|
1956
1973
|
});
|
|
1957
1974
|
}
|
|
1958
|
-
const
|
|
1959
|
-
function
|
|
1960
|
-
const n =
|
|
1961
|
-
let x = 0,
|
|
1962
|
-
const
|
|
1975
|
+
const zo = 12e3, jo = 250, $o = 20;
|
|
1976
|
+
function Fa(e) {
|
|
1977
|
+
const n = Ft(), i = Pe()(), o = de(!1), u = de(null), l = de(null), h = de([]), g = /* @__PURE__ */ new Map(), d = Mt(), A = d !== null;
|
|
1978
|
+
let x = 0, v = null, w = null;
|
|
1979
|
+
const R = re(() => i.currentUser?.id), E = () => Ln(e)?.trim() ?? "", _ = () => {
|
|
1963
1980
|
const C = l.value?.trim() ?? "";
|
|
1964
1981
|
if (C.length > 0)
|
|
1965
1982
|
return C;
|
|
1966
|
-
const
|
|
1967
|
-
return
|
|
1968
|
-
}, f = (C) => n.getTypingUsers(C),
|
|
1969
|
-
const
|
|
1970
|
-
for (const
|
|
1971
|
-
n.removeTypingUser(C,
|
|
1983
|
+
const U = E();
|
|
1984
|
+
return U.length > 0 && (l.value = U), U;
|
|
1985
|
+
}, f = (C) => n.getTypingUsers(C), b = (C) => {
|
|
1986
|
+
const U = f(C);
|
|
1987
|
+
for (const I of U)
|
|
1988
|
+
n.removeTypingUser(C, I.id);
|
|
1972
1989
|
h.value = [];
|
|
1973
|
-
},
|
|
1974
|
-
const
|
|
1975
|
-
|
|
1990
|
+
}, y = (C) => {
|
|
1991
|
+
const U = g.get(C);
|
|
1992
|
+
U && (clearTimeout(U), g.delete(C));
|
|
1976
1993
|
}, F = () => {
|
|
1977
1994
|
for (const C of g.values())
|
|
1978
1995
|
clearTimeout(C);
|
|
1979
1996
|
g.clear();
|
|
1980
|
-
},
|
|
1981
|
-
|
|
1982
|
-
const
|
|
1983
|
-
g.delete(C), n.removeTypingUser(
|
|
1984
|
-
},
|
|
1985
|
-
g.set(C,
|
|
1997
|
+
}, H = (C, U) => {
|
|
1998
|
+
y(C);
|
|
1999
|
+
const I = setTimeout(() => {
|
|
2000
|
+
g.delete(C), n.removeTypingUser(U, C), h.value = h.value.filter((q) => q.id !== C);
|
|
2001
|
+
}, zo);
|
|
2002
|
+
g.set(C, I);
|
|
1986
2003
|
}, B = () => {
|
|
1987
|
-
|
|
2004
|
+
v && (clearTimeout(v), v = null), x = 0;
|
|
1988
2005
|
}, P = () => {
|
|
1989
|
-
const C =
|
|
2006
|
+
const C = E();
|
|
1990
2007
|
if (!(o.value || !C)) {
|
|
1991
2008
|
if (u.value = null, !Ae()) {
|
|
1992
|
-
A && !
|
|
1993
|
-
|
|
1994
|
-
},
|
|
2009
|
+
A && !v && x < $o && (v = setTimeout(() => {
|
|
2010
|
+
v = null, x += 1, P();
|
|
2011
|
+
}, jo));
|
|
1995
2012
|
return;
|
|
1996
2013
|
}
|
|
1997
2014
|
try {
|
|
1998
|
-
|
|
1999
|
-
onTypingStart:
|
|
2000
|
-
onTypingStop:
|
|
2015
|
+
w && (w(), w = null), w = vi(C, {
|
|
2016
|
+
onTypingStart: V,
|
|
2017
|
+
onTypingStop: O
|
|
2001
2018
|
}), o.value = !0, l.value = C, B();
|
|
2002
|
-
} catch (
|
|
2003
|
-
u.value =
|
|
2019
|
+
} catch (U) {
|
|
2020
|
+
u.value = U instanceof Error ? U.message : "Failed to subscribe to typing channel";
|
|
2004
2021
|
}
|
|
2005
2022
|
}
|
|
2006
|
-
},
|
|
2023
|
+
}, L = () => {
|
|
2007
2024
|
const C = l.value;
|
|
2008
2025
|
if (B(), !(!o.value || !C))
|
|
2009
2026
|
try {
|
|
2010
|
-
|
|
2011
|
-
} catch (
|
|
2012
|
-
u.value =
|
|
2027
|
+
w && (w(), w = null), bi(C), F(), b(C), o.value = !1, l.value = null, u.value = null;
|
|
2028
|
+
} catch (U) {
|
|
2029
|
+
u.value = U instanceof Error ? U.message : "Failed to unsubscribe from typing channel";
|
|
2013
2030
|
}
|
|
2014
2031
|
};
|
|
2015
|
-
function
|
|
2016
|
-
if (C.user_id ===
|
|
2032
|
+
function V(C) {
|
|
2033
|
+
if (C.user_id === R.value)
|
|
2017
2034
|
return;
|
|
2018
|
-
const
|
|
2019
|
-
if (!
|
|
2035
|
+
const U = _();
|
|
2036
|
+
if (!U)
|
|
2020
2037
|
return;
|
|
2021
|
-
const
|
|
2038
|
+
const I = {
|
|
2022
2039
|
id: C.user.id,
|
|
2023
2040
|
name: C.user.name,
|
|
2024
2041
|
...C.user.avatar !== void 0 ? { avatar: C.user.avatar } : {}
|
|
2025
2042
|
};
|
|
2026
|
-
h.value.some((
|
|
2043
|
+
h.value.some((q) => q.id === I.id) || (h.value = [...h.value, I]), n.addTypingUser(U, I), H(C.user_id, U);
|
|
2027
2044
|
}
|
|
2028
|
-
function
|
|
2029
|
-
if (C.user_id ===
|
|
2045
|
+
function O(C) {
|
|
2046
|
+
if (C.user_id === R.value)
|
|
2030
2047
|
return;
|
|
2031
|
-
|
|
2032
|
-
const
|
|
2033
|
-
|
|
2048
|
+
y(C.user_id);
|
|
2049
|
+
const U = _();
|
|
2050
|
+
U && (h.value = h.value.filter((I) => I.id !== C.user_id), n.removeTypingUser(U, C.user_id));
|
|
2034
2051
|
}
|
|
2035
|
-
const K =
|
|
2036
|
-
const C =
|
|
2052
|
+
const K = re(() => {
|
|
2053
|
+
const C = _();
|
|
2037
2054
|
if (!C)
|
|
2038
2055
|
return h.value;
|
|
2039
|
-
const
|
|
2056
|
+
const U = f(C);
|
|
2040
2057
|
if (h.value.length === 0)
|
|
2041
|
-
return
|
|
2042
|
-
if (
|
|
2058
|
+
return U;
|
|
2059
|
+
if (U.length === 0)
|
|
2043
2060
|
return h.value;
|
|
2044
|
-
const
|
|
2045
|
-
for (const
|
|
2046
|
-
|
|
2047
|
-
for (const
|
|
2048
|
-
|
|
2049
|
-
return [...
|
|
2050
|
-
}),
|
|
2061
|
+
const I = /* @__PURE__ */ new Map();
|
|
2062
|
+
for (const q of U)
|
|
2063
|
+
I.set(q.id, q);
|
|
2064
|
+
for (const q of h.value)
|
|
2065
|
+
I.set(q.id, q);
|
|
2066
|
+
return [...I.values()];
|
|
2067
|
+
}), ie = re(() => {
|
|
2051
2068
|
const C = K.value;
|
|
2052
2069
|
if (C.length === 0)
|
|
2053
2070
|
return "";
|
|
2054
|
-
const
|
|
2055
|
-
if (!
|
|
2071
|
+
const U = C[0];
|
|
2072
|
+
if (!U)
|
|
2056
2073
|
return "";
|
|
2057
2074
|
if (C.length === 1)
|
|
2058
|
-
return `${
|
|
2059
|
-
const
|
|
2060
|
-
if (!
|
|
2075
|
+
return `${U.name} is typing...`;
|
|
2076
|
+
const I = C[1];
|
|
2077
|
+
if (!I)
|
|
2061
2078
|
return `${C.length} people are typing...`;
|
|
2062
2079
|
if (C.length === 2)
|
|
2063
|
-
return `${
|
|
2064
|
-
const
|
|
2065
|
-
return
|
|
2066
|
-
}),
|
|
2080
|
+
return `${U.name} and ${I.name} are typing...`;
|
|
2081
|
+
const q = C[2];
|
|
2082
|
+
return q ? C.length === 3 ? `${U.name}, ${I.name} and ${q.name} are typing...` : `${C.length} people are typing...` : `${C.length} people are typing...`;
|
|
2083
|
+
}), $ = re(() => K.value.length > 0), m = () => {
|
|
2067
2084
|
o.value || P();
|
|
2068
2085
|
};
|
|
2069
|
-
typeof window < "u" && window.addEventListener(De(),
|
|
2070
|
-
const
|
|
2086
|
+
typeof window < "u" && window.addEventListener(De(), m);
|
|
2087
|
+
const j = it((C) => {
|
|
2071
2088
|
if (C === "connected") {
|
|
2072
2089
|
o.value || P();
|
|
2073
2090
|
return;
|
|
2074
2091
|
}
|
|
2075
2092
|
if (C === "disconnected" || C === "error") {
|
|
2076
|
-
B(),
|
|
2077
|
-
const
|
|
2078
|
-
|
|
2093
|
+
B(), w && (w(), w = null);
|
|
2094
|
+
const U = _();
|
|
2095
|
+
U && b(U), o.value = !1, l.value = null, F();
|
|
2079
2096
|
}
|
|
2080
2097
|
});
|
|
2081
2098
|
return d !== null && qe(() => {
|
|
2082
|
-
B(),
|
|
2099
|
+
B(), j(), F(), L(), typeof window < "u" && window.removeEventListener(De(), m);
|
|
2083
2100
|
}), {
|
|
2084
|
-
isSubscribed:
|
|
2085
|
-
error:
|
|
2101
|
+
isSubscribed: re(() => o.value),
|
|
2102
|
+
error: re(() => u.value),
|
|
2086
2103
|
typingUsers: K,
|
|
2087
|
-
formatTypingIndicator:
|
|
2088
|
-
hasTypingUsers:
|
|
2104
|
+
formatTypingIndicator: ie,
|
|
2105
|
+
hasTypingUsers: $,
|
|
2089
2106
|
subscribe: P,
|
|
2090
|
-
unsubscribe:
|
|
2107
|
+
unsubscribe: L
|
|
2091
2108
|
};
|
|
2092
2109
|
}
|
|
2093
|
-
function
|
|
2110
|
+
function Da(e) {
|
|
2094
2111
|
e.apiClient && Ti(e.apiClient), e.mainApiClient && uo(e.mainApiClient), e.authStore && Ri(e.authStore), e.mediaApi && xi(e.mediaApi), e.createLogger && io(e.createLogger), e.playMessageNotification && vo(e.playMessageNotification), e.echo && yi(e.echo), e.mainEcho && no(e.mainEcho), e.presence && To(e.presence);
|
|
2095
2112
|
}
|
|
2096
|
-
function
|
|
2113
|
+
function qa() {
|
|
2097
2114
|
Ei(), lo(), Ai(), Mi(), oo(), bo(), _i(), so(), Eo();
|
|
2098
2115
|
}
|
|
2099
|
-
class
|
|
2116
|
+
class $t {
|
|
2100
2117
|
constructor() {
|
|
2101
2118
|
this.notificationCreatedEvent = ".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated";
|
|
2102
2119
|
}
|
|
@@ -2145,7 +2162,7 @@ class rs {
|
|
|
2145
2162
|
this.namespace = n;
|
|
2146
2163
|
}
|
|
2147
2164
|
}
|
|
2148
|
-
function
|
|
2165
|
+
function Ho(e) {
|
|
2149
2166
|
try {
|
|
2150
2167
|
new e();
|
|
2151
2168
|
} catch (n) {
|
|
@@ -2154,7 +2171,7 @@ function $o(e) {
|
|
|
2154
2171
|
}
|
|
2155
2172
|
return !0;
|
|
2156
2173
|
}
|
|
2157
|
-
class
|
|
2174
|
+
class Ht extends $t {
|
|
2158
2175
|
/**
|
|
2159
2176
|
* Create a new class instance.
|
|
2160
2177
|
*/
|
|
@@ -2231,7 +2248,7 @@ class $t extends jt {
|
|
|
2231
2248
|
return this.subscription.bind(n, i), this;
|
|
2232
2249
|
}
|
|
2233
2250
|
}
|
|
2234
|
-
class is extends
|
|
2251
|
+
class is extends Ht {
|
|
2235
2252
|
/**
|
|
2236
2253
|
* Send a whisper event to other clients in the channel.
|
|
2237
2254
|
*/
|
|
@@ -2242,7 +2259,7 @@ class is extends $t {
|
|
|
2242
2259
|
), this;
|
|
2243
2260
|
}
|
|
2244
2261
|
}
|
|
2245
|
-
class
|
|
2262
|
+
class Bo extends Ht {
|
|
2246
2263
|
/**
|
|
2247
2264
|
* Send a whisper event to other clients in the channel.
|
|
2248
2265
|
*/
|
|
@@ -2253,7 +2270,7 @@ class Ho extends $t {
|
|
|
2253
2270
|
), this;
|
|
2254
2271
|
}
|
|
2255
2272
|
}
|
|
2256
|
-
class
|
|
2273
|
+
class Vo extends is {
|
|
2257
2274
|
/**
|
|
2258
2275
|
* Register a callback to be called anytime the member list changes.
|
|
2259
2276
|
*/
|
|
@@ -2288,7 +2305,7 @@ class Bo extends is {
|
|
|
2288
2305
|
}), this;
|
|
2289
2306
|
}
|
|
2290
2307
|
}
|
|
2291
|
-
class os extends
|
|
2308
|
+
class os extends $t {
|
|
2292
2309
|
/**
|
|
2293
2310
|
* Create a new class instance.
|
|
2294
2311
|
*/
|
|
@@ -2376,7 +2393,7 @@ class as extends os {
|
|
|
2376
2393
|
}), this;
|
|
2377
2394
|
}
|
|
2378
2395
|
}
|
|
2379
|
-
class
|
|
2396
|
+
class Xo extends as {
|
|
2380
2397
|
/**
|
|
2381
2398
|
* Register a callback to be called anytime the member list changes.
|
|
2382
2399
|
*/
|
|
@@ -2414,7 +2431,7 @@ class Vo extends as {
|
|
|
2414
2431
|
), this;
|
|
2415
2432
|
}
|
|
2416
2433
|
}
|
|
2417
|
-
class rt extends
|
|
2434
|
+
class rt extends $t {
|
|
2418
2435
|
/**
|
|
2419
2436
|
* Subscribe to a channel.
|
|
2420
2437
|
*/
|
|
@@ -2470,7 +2487,7 @@ class cs extends rt {
|
|
|
2470
2487
|
return this;
|
|
2471
2488
|
}
|
|
2472
2489
|
}
|
|
2473
|
-
class
|
|
2490
|
+
class Wo extends rt {
|
|
2474
2491
|
/**
|
|
2475
2492
|
* Send a whisper event to other clients in the channel.
|
|
2476
2493
|
*/
|
|
@@ -2478,7 +2495,7 @@ class Xo extends rt {
|
|
|
2478
2495
|
return this;
|
|
2479
2496
|
}
|
|
2480
2497
|
}
|
|
2481
|
-
class
|
|
2498
|
+
class Go extends cs {
|
|
2482
2499
|
/**
|
|
2483
2500
|
* Register a callback to be called anytime the member list changes.
|
|
2484
2501
|
*/
|
|
@@ -2546,8 +2563,8 @@ us._defaultOptions = {
|
|
|
2546
2563
|
key: null,
|
|
2547
2564
|
namespace: "App.Events"
|
|
2548
2565
|
};
|
|
2549
|
-
let
|
|
2550
|
-
class Qe extends
|
|
2566
|
+
let Bt = us;
|
|
2567
|
+
class Qe extends Bt {
|
|
2551
2568
|
constructor() {
|
|
2552
2569
|
super(...arguments), this.channels = {};
|
|
2553
2570
|
}
|
|
@@ -2585,7 +2602,7 @@ class Qe extends Ht {
|
|
|
2585
2602
|
* Get a channel instance by name.
|
|
2586
2603
|
*/
|
|
2587
2604
|
channel(n) {
|
|
2588
|
-
return this.channels[n] || (this.channels[n] = new
|
|
2605
|
+
return this.channels[n] || (this.channels[n] = new Ht(
|
|
2589
2606
|
this.pusher,
|
|
2590
2607
|
n,
|
|
2591
2608
|
this.options
|
|
@@ -2605,7 +2622,7 @@ class Qe extends Ht {
|
|
|
2605
2622
|
* Get a private encrypted channel instance by name.
|
|
2606
2623
|
*/
|
|
2607
2624
|
encryptedPrivateChannel(n) {
|
|
2608
|
-
return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new
|
|
2625
|
+
return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new Bo(
|
|
2609
2626
|
this.pusher,
|
|
2610
2627
|
"private-encrypted-" + n,
|
|
2611
2628
|
this.options
|
|
@@ -2615,7 +2632,7 @@ class Qe extends Ht {
|
|
|
2615
2632
|
* Get a presence channel instance by name.
|
|
2616
2633
|
*/
|
|
2617
2634
|
presenceChannel(n) {
|
|
2618
|
-
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new
|
|
2635
|
+
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new Vo(
|
|
2619
2636
|
this.pusher,
|
|
2620
2637
|
"presence-" + n,
|
|
2621
2638
|
this.options
|
|
@@ -2684,7 +2701,7 @@ class Qe extends Ht {
|
|
|
2684
2701
|
this.pusher.disconnect();
|
|
2685
2702
|
}
|
|
2686
2703
|
}
|
|
2687
|
-
class
|
|
2704
|
+
class Jo extends Bt {
|
|
2688
2705
|
constructor() {
|
|
2689
2706
|
super(...arguments), this.channels = {};
|
|
2690
2707
|
}
|
|
@@ -2744,7 +2761,7 @@ class Go extends Ht {
|
|
|
2744
2761
|
* Get a presence channel instance by name.
|
|
2745
2762
|
*/
|
|
2746
2763
|
presenceChannel(n) {
|
|
2747
|
-
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new
|
|
2764
|
+
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new Xo(
|
|
2748
2765
|
this.socket,
|
|
2749
2766
|
"presence-" + n,
|
|
2750
2767
|
this.options
|
|
@@ -2806,7 +2823,7 @@ class Go extends Ht {
|
|
|
2806
2823
|
this.socket.disconnect();
|
|
2807
2824
|
}
|
|
2808
2825
|
}
|
|
2809
|
-
class Mn extends
|
|
2826
|
+
class Mn extends Bt {
|
|
2810
2827
|
constructor() {
|
|
2811
2828
|
super(...arguments), this.channels = {};
|
|
2812
2829
|
}
|
|
@@ -2837,13 +2854,13 @@ class Mn extends Ht {
|
|
|
2837
2854
|
* Get a private encrypted channel instance by name.
|
|
2838
2855
|
*/
|
|
2839
2856
|
encryptedPrivateChannel(n) {
|
|
2840
|
-
return new
|
|
2857
|
+
return new Wo();
|
|
2841
2858
|
}
|
|
2842
2859
|
/**
|
|
2843
2860
|
* Get a presence channel instance by name.
|
|
2844
2861
|
*/
|
|
2845
2862
|
presenceChannel(n) {
|
|
2846
|
-
return new
|
|
2863
|
+
return new Go();
|
|
2847
2864
|
}
|
|
2848
2865
|
/**
|
|
2849
2866
|
* Leave the given channel, as well as its private and presence variants.
|
|
@@ -2880,7 +2897,7 @@ class Mn extends Ht {
|
|
|
2880
2897
|
disconnect() {
|
|
2881
2898
|
}
|
|
2882
2899
|
}
|
|
2883
|
-
class
|
|
2900
|
+
class Ko {
|
|
2884
2901
|
/**
|
|
2885
2902
|
* Create a new class instance.
|
|
2886
2903
|
*/
|
|
@@ -2911,10 +2928,10 @@ class Jo {
|
|
|
2911
2928
|
broadcaster: "pusher"
|
|
2912
2929
|
});
|
|
2913
2930
|
else if (this.options.broadcaster === "socket.io")
|
|
2914
|
-
this.connector = new
|
|
2931
|
+
this.connector = new Jo(this.options);
|
|
2915
2932
|
else if (this.options.broadcaster === "null")
|
|
2916
2933
|
this.connector = new Mn(this.options);
|
|
2917
|
-
else if (typeof this.options.broadcaster == "function" &&
|
|
2934
|
+
else if (typeof this.options.broadcaster == "function" && Ho(this.options.broadcaster))
|
|
2918
2935
|
this.connector = new this.options.broadcaster(this.options);
|
|
2919
2936
|
else
|
|
2920
2937
|
throw new Error(
|
|
@@ -3038,12 +3055,12 @@ class Jo {
|
|
|
3038
3055
|
);
|
|
3039
3056
|
}
|
|
3040
3057
|
}
|
|
3041
|
-
function
|
|
3058
|
+
function Yo(e) {
|
|
3042
3059
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3043
3060
|
}
|
|
3044
3061
|
var Et = { exports: {} };
|
|
3045
3062
|
var kn;
|
|
3046
|
-
function
|
|
3063
|
+
function Qo() {
|
|
3047
3064
|
return kn || (kn = 1, (function(e, n) {
|
|
3048
3065
|
(function(o, u) {
|
|
3049
3066
|
e.exports = u();
|
|
@@ -3098,112 +3115,112 @@ function Yo() {
|
|
|
3098
3115
|
/***/
|
|
3099
3116
|
(function(i, o, u) {
|
|
3100
3117
|
var l = this && this.__extends || /* @__PURE__ */ (function() {
|
|
3101
|
-
var
|
|
3102
|
-
return
|
|
3103
|
-
|
|
3104
|
-
} || function(
|
|
3105
|
-
for (var
|
|
3106
|
-
},
|
|
3118
|
+
var _ = function(f, b) {
|
|
3119
|
+
return _ = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(y, F) {
|
|
3120
|
+
y.__proto__ = F;
|
|
3121
|
+
} || function(y, F) {
|
|
3122
|
+
for (var H in F) F.hasOwnProperty(H) && (y[H] = F[H]);
|
|
3123
|
+
}, _(f, b);
|
|
3107
3124
|
};
|
|
3108
|
-
return function(f,
|
|
3109
|
-
|
|
3110
|
-
function
|
|
3125
|
+
return function(f, b) {
|
|
3126
|
+
_(f, b);
|
|
3127
|
+
function y() {
|
|
3111
3128
|
this.constructor = f;
|
|
3112
3129
|
}
|
|
3113
|
-
f.prototype =
|
|
3130
|
+
f.prototype = b === null ? Object.create(b) : (y.prototype = b.prototype, new y());
|
|
3114
3131
|
};
|
|
3115
3132
|
})();
|
|
3116
3133
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
3117
3134
|
var h = 256, g = (
|
|
3118
3135
|
/** @class */
|
|
3119
3136
|
(function() {
|
|
3120
|
-
function
|
|
3137
|
+
function _(f) {
|
|
3121
3138
|
f === void 0 && (f = "="), this._paddingCharacter = f;
|
|
3122
3139
|
}
|
|
3123
|
-
return
|
|
3140
|
+
return _.prototype.encodedLength = function(f) {
|
|
3124
3141
|
return this._paddingCharacter ? (f + 2) / 3 * 4 | 0 : (f * 8 + 5) / 6 | 0;
|
|
3125
|
-
},
|
|
3126
|
-
for (var
|
|
3127
|
-
var F = f[
|
|
3128
|
-
|
|
3142
|
+
}, _.prototype.encode = function(f) {
|
|
3143
|
+
for (var b = "", y = 0; y < f.length - 2; y += 3) {
|
|
3144
|
+
var F = f[y] << 16 | f[y + 1] << 8 | f[y + 2];
|
|
3145
|
+
b += this._encodeByte(F >>> 18 & 63), b += this._encodeByte(F >>> 12 & 63), b += this._encodeByte(F >>> 6 & 63), b += this._encodeByte(F >>> 0 & 63);
|
|
3129
3146
|
}
|
|
3130
|
-
var
|
|
3131
|
-
if (
|
|
3132
|
-
var F = f[
|
|
3133
|
-
|
|
3147
|
+
var H = f.length - y;
|
|
3148
|
+
if (H > 0) {
|
|
3149
|
+
var F = f[y] << 16 | (H === 2 ? f[y + 1] << 8 : 0);
|
|
3150
|
+
b += this._encodeByte(F >>> 18 & 63), b += this._encodeByte(F >>> 12 & 63), H === 2 ? b += this._encodeByte(F >>> 6 & 63) : b += this._paddingCharacter || "", b += this._paddingCharacter || "";
|
|
3134
3151
|
}
|
|
3135
|
-
return
|
|
3136
|
-
},
|
|
3152
|
+
return b;
|
|
3153
|
+
}, _.prototype.maxDecodedLength = function(f) {
|
|
3137
3154
|
return this._paddingCharacter ? f / 4 * 3 | 0 : (f * 6 + 7) / 8 | 0;
|
|
3138
|
-
},
|
|
3155
|
+
}, _.prototype.decodedLength = function(f) {
|
|
3139
3156
|
return this.maxDecodedLength(f.length - this._getPaddingLength(f));
|
|
3140
|
-
},
|
|
3157
|
+
}, _.prototype.decode = function(f) {
|
|
3141
3158
|
if (f.length === 0)
|
|
3142
3159
|
return new Uint8Array(0);
|
|
3143
|
-
for (var
|
|
3144
|
-
|
|
3145
|
-
if (B <
|
|
3160
|
+
for (var b = this._getPaddingLength(f), y = f.length - b, F = new Uint8Array(this.maxDecodedLength(y)), H = 0, B = 0, P = 0, L = 0, V = 0, O = 0, K = 0; B < y - 4; B += 4)
|
|
3161
|
+
L = this._decodeChar(f.charCodeAt(B + 0)), V = this._decodeChar(f.charCodeAt(B + 1)), O = this._decodeChar(f.charCodeAt(B + 2)), K = this._decodeChar(f.charCodeAt(B + 3)), F[H++] = L << 2 | V >>> 4, F[H++] = V << 4 | O >>> 2, F[H++] = O << 6 | K, P |= L & h, P |= V & h, P |= O & h, P |= K & h;
|
|
3162
|
+
if (B < y - 1 && (L = this._decodeChar(f.charCodeAt(B)), V = this._decodeChar(f.charCodeAt(B + 1)), F[H++] = L << 2 | V >>> 4, P |= L & h, P |= V & h), B < y - 2 && (O = this._decodeChar(f.charCodeAt(B + 2)), F[H++] = V << 4 | O >>> 2, P |= O & h), B < y - 3 && (K = this._decodeChar(f.charCodeAt(B + 3)), F[H++] = O << 6 | K, P |= K & h), P !== 0)
|
|
3146
3163
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
3147
3164
|
return F;
|
|
3148
|
-
},
|
|
3149
|
-
var
|
|
3150
|
-
return
|
|
3151
|
-
},
|
|
3152
|
-
var
|
|
3153
|
-
return
|
|
3154
|
-
},
|
|
3155
|
-
var
|
|
3165
|
+
}, _.prototype._encodeByte = function(f) {
|
|
3166
|
+
var b = f;
|
|
3167
|
+
return b += 65, b += 25 - f >>> 8 & 6, b += 51 - f >>> 8 & -75, b += 61 - f >>> 8 & -15, b += 62 - f >>> 8 & 3, String.fromCharCode(b);
|
|
3168
|
+
}, _.prototype._decodeChar = function(f) {
|
|
3169
|
+
var b = h;
|
|
3170
|
+
return b += (42 - f & f - 44) >>> 8 & -h + f - 43 + 62, b += (46 - f & f - 48) >>> 8 & -h + f - 47 + 63, b += (47 - f & f - 58) >>> 8 & -h + f - 48 + 52, b += (64 - f & f - 91) >>> 8 & -h + f - 65 + 0, b += (96 - f & f - 123) >>> 8 & -h + f - 97 + 26, b;
|
|
3171
|
+
}, _.prototype._getPaddingLength = function(f) {
|
|
3172
|
+
var b = 0;
|
|
3156
3173
|
if (this._paddingCharacter) {
|
|
3157
|
-
for (var
|
|
3158
|
-
|
|
3159
|
-
if (f.length < 4 ||
|
|
3174
|
+
for (var y = f.length - 1; y >= 0 && f[y] === this._paddingCharacter; y--)
|
|
3175
|
+
b++;
|
|
3176
|
+
if (f.length < 4 || b > 2)
|
|
3160
3177
|
throw new Error("Base64Coder: incorrect padding");
|
|
3161
3178
|
}
|
|
3162
|
-
return
|
|
3163
|
-
},
|
|
3179
|
+
return b;
|
|
3180
|
+
}, _;
|
|
3164
3181
|
})()
|
|
3165
3182
|
);
|
|
3166
3183
|
o.Coder = g;
|
|
3167
3184
|
var d = new g();
|
|
3168
|
-
function A(
|
|
3169
|
-
return d.encode(
|
|
3185
|
+
function A(_) {
|
|
3186
|
+
return d.encode(_);
|
|
3170
3187
|
}
|
|
3171
3188
|
o.encode = A;
|
|
3172
|
-
function x(
|
|
3173
|
-
return d.decode(
|
|
3189
|
+
function x(_) {
|
|
3190
|
+
return d.decode(_);
|
|
3174
3191
|
}
|
|
3175
3192
|
o.decode = x;
|
|
3176
|
-
var
|
|
3193
|
+
var v = (
|
|
3177
3194
|
/** @class */
|
|
3178
|
-
(function(
|
|
3179
|
-
l(f,
|
|
3195
|
+
(function(_) {
|
|
3196
|
+
l(f, _);
|
|
3180
3197
|
function f() {
|
|
3181
|
-
return
|
|
3198
|
+
return _ !== null && _.apply(this, arguments) || this;
|
|
3182
3199
|
}
|
|
3183
|
-
return f.prototype._encodeByte = function(
|
|
3184
|
-
var
|
|
3185
|
-
return
|
|
3186
|
-
}, f.prototype._decodeChar = function(
|
|
3187
|
-
var
|
|
3188
|
-
return
|
|
3200
|
+
return f.prototype._encodeByte = function(b) {
|
|
3201
|
+
var y = b;
|
|
3202
|
+
return y += 65, y += 25 - b >>> 8 & 6, y += 51 - b >>> 8 & -75, y += 61 - b >>> 8 & -13, y += 62 - b >>> 8 & 49, String.fromCharCode(y);
|
|
3203
|
+
}, f.prototype._decodeChar = function(b) {
|
|
3204
|
+
var y = h;
|
|
3205
|
+
return y += (44 - b & b - 46) >>> 8 & -h + b - 45 + 62, y += (94 - b & b - 96) >>> 8 & -h + b - 95 + 63, y += (47 - b & b - 58) >>> 8 & -h + b - 48 + 52, y += (64 - b & b - 91) >>> 8 & -h + b - 65 + 0, y += (96 - b & b - 123) >>> 8 & -h + b - 97 + 26, y;
|
|
3189
3206
|
}, f;
|
|
3190
3207
|
})(g)
|
|
3191
3208
|
);
|
|
3192
|
-
o.URLSafeCoder =
|
|
3193
|
-
var
|
|
3194
|
-
function
|
|
3195
|
-
return
|
|
3209
|
+
o.URLSafeCoder = v;
|
|
3210
|
+
var w = new v();
|
|
3211
|
+
function R(_) {
|
|
3212
|
+
return w.encode(_);
|
|
3196
3213
|
}
|
|
3197
|
-
o.encodeURLSafe =
|
|
3198
|
-
function
|
|
3199
|
-
return
|
|
3214
|
+
o.encodeURLSafe = R;
|
|
3215
|
+
function E(_) {
|
|
3216
|
+
return w.decode(_);
|
|
3200
3217
|
}
|
|
3201
|
-
o.decodeURLSafe =
|
|
3202
|
-
return d.encodedLength(
|
|
3203
|
-
}, o.maxDecodedLength = function(
|
|
3204
|
-
return d.maxDecodedLength(
|
|
3205
|
-
}, o.decodedLength = function(
|
|
3206
|
-
return d.decodedLength(
|
|
3218
|
+
o.decodeURLSafe = E, o.encodedLength = function(_) {
|
|
3219
|
+
return d.encodedLength(_);
|
|
3220
|
+
}, o.maxDecodedLength = function(_) {
|
|
3221
|
+
return d.maxDecodedLength(_);
|
|
3222
|
+
}, o.decodedLength = function(_) {
|
|
3223
|
+
return d.decodedLength(_);
|
|
3207
3224
|
};
|
|
3208
3225
|
}),
|
|
3209
3226
|
/* 1 */
|
|
@@ -3212,71 +3229,71 @@ function Yo() {
|
|
|
3212
3229
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
3213
3230
|
var l = "utf8: invalid string", h = "utf8: invalid source encoding";
|
|
3214
3231
|
function g(x) {
|
|
3215
|
-
for (var
|
|
3216
|
-
var
|
|
3217
|
-
|
|
3232
|
+
for (var v = new Uint8Array(d(x)), w = 0, R = 0; R < x.length; R++) {
|
|
3233
|
+
var E = x.charCodeAt(R);
|
|
3234
|
+
E < 128 ? v[w++] = E : E < 2048 ? (v[w++] = 192 | E >> 6, v[w++] = 128 | E & 63) : E < 55296 ? (v[w++] = 224 | E >> 12, v[w++] = 128 | E >> 6 & 63, v[w++] = 128 | E & 63) : (R++, E = (E & 1023) << 10, E |= x.charCodeAt(R) & 1023, E += 65536, v[w++] = 240 | E >> 18, v[w++] = 128 | E >> 12 & 63, v[w++] = 128 | E >> 6 & 63, v[w++] = 128 | E & 63);
|
|
3218
3235
|
}
|
|
3219
|
-
return
|
|
3236
|
+
return v;
|
|
3220
3237
|
}
|
|
3221
3238
|
o.encode = g;
|
|
3222
3239
|
function d(x) {
|
|
3223
|
-
for (var
|
|
3224
|
-
var
|
|
3225
|
-
if (
|
|
3226
|
-
|
|
3227
|
-
else if (
|
|
3228
|
-
|
|
3229
|
-
else if (
|
|
3230
|
-
|
|
3231
|
-
else if (
|
|
3232
|
-
if (
|
|
3240
|
+
for (var v = 0, w = 0; w < x.length; w++) {
|
|
3241
|
+
var R = x.charCodeAt(w);
|
|
3242
|
+
if (R < 128)
|
|
3243
|
+
v += 1;
|
|
3244
|
+
else if (R < 2048)
|
|
3245
|
+
v += 2;
|
|
3246
|
+
else if (R < 55296)
|
|
3247
|
+
v += 3;
|
|
3248
|
+
else if (R <= 57343) {
|
|
3249
|
+
if (w >= x.length - 1)
|
|
3233
3250
|
throw new Error(l);
|
|
3234
|
-
|
|
3251
|
+
w++, v += 4;
|
|
3235
3252
|
} else
|
|
3236
3253
|
throw new Error(l);
|
|
3237
3254
|
}
|
|
3238
|
-
return
|
|
3255
|
+
return v;
|
|
3239
3256
|
}
|
|
3240
3257
|
o.encodedLength = d;
|
|
3241
3258
|
function A(x) {
|
|
3242
|
-
for (var
|
|
3243
|
-
var
|
|
3244
|
-
if (
|
|
3245
|
-
var
|
|
3246
|
-
if (
|
|
3247
|
-
if (
|
|
3259
|
+
for (var v = [], w = 0; w < x.length; w++) {
|
|
3260
|
+
var R = x[w];
|
|
3261
|
+
if (R & 128) {
|
|
3262
|
+
var E = void 0;
|
|
3263
|
+
if (R < 224) {
|
|
3264
|
+
if (w >= x.length)
|
|
3248
3265
|
throw new Error(h);
|
|
3249
|
-
var
|
|
3250
|
-
if ((
|
|
3266
|
+
var _ = x[++w];
|
|
3267
|
+
if ((_ & 192) !== 128)
|
|
3251
3268
|
throw new Error(h);
|
|
3252
|
-
|
|
3253
|
-
} else if (
|
|
3254
|
-
if (
|
|
3269
|
+
R = (R & 31) << 6 | _ & 63, E = 128;
|
|
3270
|
+
} else if (R < 240) {
|
|
3271
|
+
if (w >= x.length - 1)
|
|
3255
3272
|
throw new Error(h);
|
|
3256
|
-
var
|
|
3257
|
-
if ((
|
|
3273
|
+
var _ = x[++w], f = x[++w];
|
|
3274
|
+
if ((_ & 192) !== 128 || (f & 192) !== 128)
|
|
3258
3275
|
throw new Error(h);
|
|
3259
|
-
|
|
3260
|
-
} else if (
|
|
3261
|
-
if (
|
|
3276
|
+
R = (R & 15) << 12 | (_ & 63) << 6 | f & 63, E = 2048;
|
|
3277
|
+
} else if (R < 248) {
|
|
3278
|
+
if (w >= x.length - 2)
|
|
3262
3279
|
throw new Error(h);
|
|
3263
|
-
var
|
|
3264
|
-
if ((
|
|
3280
|
+
var _ = x[++w], f = x[++w], b = x[++w];
|
|
3281
|
+
if ((_ & 192) !== 128 || (f & 192) !== 128 || (b & 192) !== 128)
|
|
3265
3282
|
throw new Error(h);
|
|
3266
|
-
|
|
3283
|
+
R = (R & 15) << 18 | (_ & 63) << 12 | (f & 63) << 6 | b & 63, E = 65536;
|
|
3267
3284
|
} else
|
|
3268
3285
|
throw new Error(h);
|
|
3269
|
-
if (
|
|
3286
|
+
if (R < E || R >= 55296 && R <= 57343)
|
|
3270
3287
|
throw new Error(h);
|
|
3271
|
-
if (
|
|
3272
|
-
if (
|
|
3288
|
+
if (R >= 65536) {
|
|
3289
|
+
if (R > 1114111)
|
|
3273
3290
|
throw new Error(h);
|
|
3274
|
-
|
|
3291
|
+
R -= 65536, v.push(String.fromCharCode(55296 | R >> 10)), R = 56320 | R & 1023;
|
|
3275
3292
|
}
|
|
3276
3293
|
}
|
|
3277
|
-
|
|
3294
|
+
v.push(String.fromCharCode(R));
|
|
3278
3295
|
}
|
|
3279
|
-
return
|
|
3296
|
+
return v.join("");
|
|
3280
3297
|
}
|
|
3281
3298
|
o.decode = A;
|
|
3282
3299
|
}),
|
|
@@ -3295,10 +3312,10 @@ function Yo() {
|
|
|
3295
3312
|
}
|
|
3296
3313
|
create(t) {
|
|
3297
3314
|
this.lastId++;
|
|
3298
|
-
var s = this.lastId, a = this.prefix + s, c = this.name + "[" + s + "]", p = !1,
|
|
3315
|
+
var s = this.lastId, a = this.prefix + s, c = this.name + "[" + s + "]", p = !1, S = function() {
|
|
3299
3316
|
p || (t.apply(null, arguments), p = !0);
|
|
3300
3317
|
};
|
|
3301
|
-
return this[s] =
|
|
3318
|
+
return this[s] = S, { number: s, id: a, name: c, callback: S };
|
|
3302
3319
|
}
|
|
3303
3320
|
remove(t) {
|
|
3304
3321
|
delete this[t.number];
|
|
@@ -3342,35 +3359,35 @@ function Yo() {
|
|
|
3342
3359
|
c.loading[t].push(a);
|
|
3343
3360
|
else {
|
|
3344
3361
|
c.loading[t] = [a];
|
|
3345
|
-
var p =
|
|
3346
|
-
if (c.receivers.remove(
|
|
3362
|
+
var p = z.createScriptRequest(c.getPath(t, s)), S = c.receivers.create(function(k) {
|
|
3363
|
+
if (c.receivers.remove(S), c.loading[t]) {
|
|
3347
3364
|
var D = c.loading[t];
|
|
3348
3365
|
delete c.loading[t];
|
|
3349
|
-
for (var
|
|
3366
|
+
for (var Y = function(oe) {
|
|
3350
3367
|
oe || p.cleanup();
|
|
3351
|
-
},
|
|
3352
|
-
D[
|
|
3368
|
+
}, ee = 0; ee < D.length; ee++)
|
|
3369
|
+
D[ee](k, Y);
|
|
3353
3370
|
}
|
|
3354
3371
|
});
|
|
3355
|
-
p.send(
|
|
3372
|
+
p.send(S);
|
|
3356
3373
|
}
|
|
3357
3374
|
}
|
|
3358
3375
|
getRoot(t) {
|
|
3359
|
-
var s, a =
|
|
3376
|
+
var s, a = z.getDocument().location.protocol;
|
|
3360
3377
|
return t && t.useTLS || a === "https:" ? s = this.options.cdn_https : s = this.options.cdn_http, s.replace(/\/*$/, "") + "/" + this.options.version;
|
|
3361
3378
|
}
|
|
3362
3379
|
getPath(t, s) {
|
|
3363
3380
|
return this.getRoot(s) + "/" + t + this.options.suffix + ".js";
|
|
3364
3381
|
}
|
|
3365
3382
|
}
|
|
3366
|
-
var x = new l("_pusher_dependencies", "Pusher.DependenciesReceivers"),
|
|
3383
|
+
var x = new l("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new A({
|
|
3367
3384
|
cdn_http: d.cdn_http,
|
|
3368
3385
|
cdn_https: d.cdn_https,
|
|
3369
3386
|
version: d.VERSION,
|
|
3370
3387
|
suffix: d.dependency_suffix,
|
|
3371
3388
|
receivers: x
|
|
3372
3389
|
});
|
|
3373
|
-
const
|
|
3390
|
+
const w = {
|
|
3374
3391
|
baseUrl: "https://pusher.com",
|
|
3375
3392
|
urls: {
|
|
3376
3393
|
authenticationEndpoint: {
|
|
@@ -3390,27 +3407,27 @@ function Yo() {
|
|
|
3390
3407
|
}
|
|
3391
3408
|
}
|
|
3392
3409
|
};
|
|
3393
|
-
var
|
|
3394
|
-
const t = "See:", s =
|
|
3410
|
+
var E = { buildLogSuffix: function(r) {
|
|
3411
|
+
const t = "See:", s = w.urls[r];
|
|
3395
3412
|
if (!s)
|
|
3396
3413
|
return "";
|
|
3397
3414
|
let a;
|
|
3398
|
-
return s.fullUrl ? a = s.fullUrl : s.path && (a =
|
|
3399
|
-
} },
|
|
3415
|
+
return s.fullUrl ? a = s.fullUrl : s.path && (a = w.baseUrl + s.path), a ? `${t} ${a}` : "";
|
|
3416
|
+
} }, _;
|
|
3400
3417
|
(function(r) {
|
|
3401
3418
|
r.UserAuthentication = "user-authentication", r.ChannelAuthorization = "channel-authorization";
|
|
3402
|
-
})(
|
|
3419
|
+
})(_ || (_ = {}));
|
|
3403
3420
|
class f extends Error {
|
|
3404
3421
|
constructor(t) {
|
|
3405
3422
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3406
3423
|
}
|
|
3407
3424
|
}
|
|
3408
|
-
class
|
|
3425
|
+
class b extends Error {
|
|
3409
3426
|
constructor(t) {
|
|
3410
3427
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3411
3428
|
}
|
|
3412
3429
|
}
|
|
3413
|
-
class
|
|
3430
|
+
class y extends Error {
|
|
3414
3431
|
constructor(t) {
|
|
3415
3432
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3416
3433
|
}
|
|
@@ -3420,7 +3437,7 @@ function Yo() {
|
|
|
3420
3437
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3421
3438
|
}
|
|
3422
3439
|
}
|
|
3423
|
-
class
|
|
3440
|
+
class H extends Error {
|
|
3424
3441
|
constructor(t) {
|
|
3425
3442
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3426
3443
|
}
|
|
@@ -3435,70 +3452,70 @@ function Yo() {
|
|
|
3435
3452
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3436
3453
|
}
|
|
3437
3454
|
}
|
|
3438
|
-
class
|
|
3455
|
+
class L extends Error {
|
|
3439
3456
|
constructor(t) {
|
|
3440
3457
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3441
3458
|
}
|
|
3442
3459
|
}
|
|
3443
|
-
class
|
|
3460
|
+
class V extends Error {
|
|
3444
3461
|
constructor(t, s) {
|
|
3445
3462
|
super(s), this.status = t, Object.setPrototypeOf(this, new.target.prototype);
|
|
3446
3463
|
}
|
|
3447
3464
|
}
|
|
3448
3465
|
var K = function(r, t, s, a, c) {
|
|
3449
|
-
const p =
|
|
3466
|
+
const p = z.createXHR();
|
|
3450
3467
|
p.open("POST", s.endpoint, !0), p.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
3451
|
-
for (var
|
|
3452
|
-
p.setRequestHeader(
|
|
3468
|
+
for (var S in s.headers)
|
|
3469
|
+
p.setRequestHeader(S, s.headers[S]);
|
|
3453
3470
|
if (s.headersProvider != null) {
|
|
3454
|
-
let
|
|
3455
|
-
for (var
|
|
3456
|
-
p.setRequestHeader(
|
|
3471
|
+
let k = s.headersProvider();
|
|
3472
|
+
for (var S in k)
|
|
3473
|
+
p.setRequestHeader(S, k[S]);
|
|
3457
3474
|
}
|
|
3458
3475
|
return p.onreadystatechange = function() {
|
|
3459
3476
|
if (p.readyState === 4)
|
|
3460
3477
|
if (p.status === 200) {
|
|
3461
|
-
let
|
|
3478
|
+
let k, D = !1;
|
|
3462
3479
|
try {
|
|
3463
|
-
|
|
3480
|
+
k = JSON.parse(p.responseText), D = !0;
|
|
3464
3481
|
} catch {
|
|
3465
|
-
c(new
|
|
3482
|
+
c(new V(200, `JSON returned from ${a.toString()} endpoint was invalid, yet status code was 200. Data was: ${p.responseText}`), null);
|
|
3466
3483
|
}
|
|
3467
|
-
D && c(null,
|
|
3484
|
+
D && c(null, k);
|
|
3468
3485
|
} else {
|
|
3469
|
-
let
|
|
3486
|
+
let k = "";
|
|
3470
3487
|
switch (a) {
|
|
3471
|
-
case
|
|
3472
|
-
|
|
3488
|
+
case _.UserAuthentication:
|
|
3489
|
+
k = E.buildLogSuffix("authenticationEndpoint");
|
|
3473
3490
|
break;
|
|
3474
|
-
case
|
|
3475
|
-
|
|
3491
|
+
case _.ChannelAuthorization:
|
|
3492
|
+
k = `Clients must be authorized to join private or presence channels. ${E.buildLogSuffix("authorizationEndpoint")}`;
|
|
3476
3493
|
break;
|
|
3477
3494
|
}
|
|
3478
|
-
c(new
|
|
3495
|
+
c(new V(p.status, `Unable to retrieve auth string from ${a.toString()} endpoint - received status: ${p.status} from ${s.endpoint}. ${k}`), null);
|
|
3479
3496
|
}
|
|
3480
3497
|
}, p.send(t), p;
|
|
3481
3498
|
};
|
|
3482
|
-
function
|
|
3483
|
-
return
|
|
3499
|
+
function ie(r) {
|
|
3500
|
+
return I(C(r));
|
|
3484
3501
|
}
|
|
3485
|
-
var
|
|
3502
|
+
var $ = String.fromCharCode, m = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", j = function(r) {
|
|
3486
3503
|
var t = r.charCodeAt(0);
|
|
3487
|
-
return t < 128 ? r : t < 2048 ?
|
|
3504
|
+
return t < 128 ? r : t < 2048 ? $(192 | t >>> 6) + $(128 | t & 63) : $(224 | t >>> 12 & 15) + $(128 | t >>> 6 & 63) + $(128 | t & 63);
|
|
3488
3505
|
}, C = function(r) {
|
|
3489
|
-
return r.replace(/[^\x00-\x7F]/g,
|
|
3490
|
-
},
|
|
3506
|
+
return r.replace(/[^\x00-\x7F]/g, j);
|
|
3507
|
+
}, U = function(r) {
|
|
3491
3508
|
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 = [
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
t >= 2 ? "=" :
|
|
3495
|
-
t >= 1 ? "=" :
|
|
3509
|
+
m.charAt(s >>> 18),
|
|
3510
|
+
m.charAt(s >>> 12 & 63),
|
|
3511
|
+
t >= 2 ? "=" : m.charAt(s >>> 6 & 63),
|
|
3512
|
+
t >= 1 ? "=" : m.charAt(s & 63)
|
|
3496
3513
|
];
|
|
3497
3514
|
return a.join("");
|
|
3498
|
-
},
|
|
3499
|
-
return r.replace(/[\s\S]{1,3}/g,
|
|
3515
|
+
}, I = window.btoa || function(r) {
|
|
3516
|
+
return r.replace(/[\s\S]{1,3}/g, U);
|
|
3500
3517
|
};
|
|
3501
|
-
class
|
|
3518
|
+
class q {
|
|
3502
3519
|
constructor(t, s, a, c) {
|
|
3503
3520
|
this.clear = s, this.timer = t(() => {
|
|
3504
3521
|
this.timer && (this.timer = c(this.timer));
|
|
@@ -3511,28 +3528,28 @@ function Yo() {
|
|
|
3511
3528
|
this.timer && (this.clear(this.timer), this.timer = null);
|
|
3512
3529
|
}
|
|
3513
3530
|
}
|
|
3514
|
-
var
|
|
3531
|
+
var se = q;
|
|
3515
3532
|
function je(r) {
|
|
3516
3533
|
window.clearTimeout(r);
|
|
3517
3534
|
}
|
|
3518
|
-
function
|
|
3535
|
+
function Vt(r) {
|
|
3519
3536
|
window.clearInterval(r);
|
|
3520
3537
|
}
|
|
3521
|
-
class T extends
|
|
3538
|
+
class T extends se {
|
|
3522
3539
|
constructor(t, s) {
|
|
3523
3540
|
super(setTimeout, je, t, function(a) {
|
|
3524
3541
|
return s(), null;
|
|
3525
3542
|
});
|
|
3526
3543
|
}
|
|
3527
3544
|
}
|
|
3528
|
-
class
|
|
3545
|
+
class M extends se {
|
|
3529
3546
|
constructor(t, s) {
|
|
3530
|
-
super(setInterval,
|
|
3547
|
+
super(setInterval, Vt, t, function(a) {
|
|
3531
3548
|
return s(), a;
|
|
3532
3549
|
});
|
|
3533
3550
|
}
|
|
3534
3551
|
}
|
|
3535
|
-
var
|
|
3552
|
+
var Q = {
|
|
3536
3553
|
now() {
|
|
3537
3554
|
return Date.now ? Date.now() : (/* @__PURE__ */ new Date()).valueOf();
|
|
3538
3555
|
},
|
|
@@ -3545,12 +3562,12 @@ function Yo() {
|
|
|
3545
3562
|
return a[r].apply(a, s.concat(arguments));
|
|
3546
3563
|
};
|
|
3547
3564
|
}
|
|
3548
|
-
}, N =
|
|
3549
|
-
function
|
|
3565
|
+
}, N = Q;
|
|
3566
|
+
function X(r, ...t) {
|
|
3550
3567
|
for (var s = 0; s < t.length; s++) {
|
|
3551
3568
|
var a = t[s];
|
|
3552
3569
|
for (var c in a)
|
|
3553
|
-
a[c] && a[c].constructor && a[c].constructor === Object ? r[c] =
|
|
3570
|
+
a[c] && a[c].constructor && a[c].constructor === Object ? r[c] = X(r[c] || {}, a[c]) : r[c] = a[c];
|
|
3554
3571
|
}
|
|
3555
3572
|
return r;
|
|
3556
3573
|
}
|
|
@@ -3601,7 +3618,7 @@ function Yo() {
|
|
|
3601
3618
|
s[c] = t(a);
|
|
3602
3619
|
}), s;
|
|
3603
3620
|
}
|
|
3604
|
-
function
|
|
3621
|
+
function G(r, t) {
|
|
3605
3622
|
t = t || function(c) {
|
|
3606
3623
|
return !!c;
|
|
3607
3624
|
};
|
|
@@ -3621,7 +3638,7 @@ function Yo() {
|
|
|
3621
3638
|
t.push([a, s]);
|
|
3622
3639
|
}), t;
|
|
3623
3640
|
}
|
|
3624
|
-
function
|
|
3641
|
+
function Xt(r, t) {
|
|
3625
3642
|
for (var s = 0; s < r.length; s++)
|
|
3626
3643
|
if (t(r[s], s, r))
|
|
3627
3644
|
return !0;
|
|
@@ -3635,7 +3652,7 @@ function Yo() {
|
|
|
3635
3652
|
}
|
|
3636
3653
|
function fs(r) {
|
|
3637
3654
|
return we(r, function(t) {
|
|
3638
|
-
return typeof t == "object" && (t = He(t)), encodeURIComponent(
|
|
3655
|
+
return typeof t == "object" && (t = He(t)), encodeURIComponent(ie(t.toString()));
|
|
3639
3656
|
});
|
|
3640
3657
|
}
|
|
3641
3658
|
function ps(r) {
|
|
@@ -3647,21 +3664,21 @@ function Yo() {
|
|
|
3647
3664
|
function gs(r) {
|
|
3648
3665
|
var t = [], s = [];
|
|
3649
3666
|
return (function a(c, p) {
|
|
3650
|
-
var
|
|
3667
|
+
var S, k, D;
|
|
3651
3668
|
switch (typeof c) {
|
|
3652
3669
|
case "object":
|
|
3653
3670
|
if (!c)
|
|
3654
3671
|
return null;
|
|
3655
|
-
for (
|
|
3656
|
-
if (t[
|
|
3657
|
-
return { $ref: s[
|
|
3672
|
+
for (S = 0; S < t.length; S += 1)
|
|
3673
|
+
if (t[S] === c)
|
|
3674
|
+
return { $ref: s[S] };
|
|
3658
3675
|
if (t.push(c), s.push(p), Object.prototype.toString.apply(c) === "[object Array]")
|
|
3659
|
-
for (D = [],
|
|
3660
|
-
D[
|
|
3676
|
+
for (D = [], S = 0; S < c.length; S += 1)
|
|
3677
|
+
D[S] = a(c[S], p + "[" + S + "]");
|
|
3661
3678
|
else {
|
|
3662
3679
|
D = {};
|
|
3663
|
-
for (
|
|
3664
|
-
Object.prototype.hasOwnProperty.call(c,
|
|
3680
|
+
for (k in c)
|
|
3681
|
+
Object.prototype.hasOwnProperty.call(c, k) && (D[k] = a(c[k], p + "[" + JSON.stringify(k) + "]"));
|
|
3665
3682
|
}
|
|
3666
3683
|
return D;
|
|
3667
3684
|
case "number":
|
|
@@ -3704,18 +3721,18 @@ function Yo() {
|
|
|
3704
3721
|
vt.log ? vt.log(a) : vt.logToConsole && t.bind(this)(a);
|
|
3705
3722
|
}
|
|
3706
3723
|
}
|
|
3707
|
-
var
|
|
3708
|
-
(s.headers !== void 0 || s.headersProvider != null) &&
|
|
3724
|
+
var ne = new ms(), vs = function(r, t, s, a, c) {
|
|
3725
|
+
(s.headers !== void 0 || s.headersProvider != null) && ne.warn(`To send headers with the ${a.toString()} request, you must use AJAX, rather than JSONP.`);
|
|
3709
3726
|
var p = r.nextAuthCallbackID.toString();
|
|
3710
3727
|
r.nextAuthCallbackID++;
|
|
3711
|
-
var
|
|
3712
|
-
r.auth_callbacks[p] = function(
|
|
3713
|
-
c(null,
|
|
3728
|
+
var S = r.getDocument(), k = S.createElement("script");
|
|
3729
|
+
r.auth_callbacks[p] = function(ee) {
|
|
3730
|
+
c(null, ee);
|
|
3714
3731
|
};
|
|
3715
3732
|
var D = "Pusher.auth_callbacks['" + p + "']";
|
|
3716
|
-
|
|
3717
|
-
var
|
|
3718
|
-
|
|
3733
|
+
k.src = s.endpoint + "?callback=" + encodeURIComponent(D) + "&" + t;
|
|
3734
|
+
var Y = S.getElementsByTagName("head")[0] || S.documentElement;
|
|
3735
|
+
Y.insertBefore(k, Y.firstChild);
|
|
3719
3736
|
}, bs = vs;
|
|
3720
3737
|
class ys {
|
|
3721
3738
|
constructor(t) {
|
|
@@ -3744,7 +3761,7 @@ function Yo() {
|
|
|
3744
3761
|
send(t) {
|
|
3745
3762
|
if (!this.request) {
|
|
3746
3763
|
var s = ps(this.data), a = this.url + "/" + t.number + "?" + s;
|
|
3747
|
-
this.request =
|
|
3764
|
+
this.request = z.createScriptRequest(a), this.request.send(t);
|
|
3748
3765
|
}
|
|
3749
3766
|
}
|
|
3750
3767
|
cleanup() {
|
|
@@ -3753,10 +3770,10 @@ function Yo() {
|
|
|
3753
3770
|
}
|
|
3754
3771
|
var Ss = function(r, t) {
|
|
3755
3772
|
return function(s, a) {
|
|
3756
|
-
var c = "http" + (t ? "s" : "") + "://", p = c + (r.host || r.options.host) + r.options.path,
|
|
3757
|
-
h.remove(
|
|
3773
|
+
var c = "http" + (t ? "s" : "") + "://", p = c + (r.host || r.options.host) + r.options.path, S = z.createJSONPRequest(p, s), k = z.ScriptReceivers.create(function(D, Y) {
|
|
3774
|
+
h.remove(k), S.cleanup(), Y && Y.host && (r.host = Y.host), a && a(D, Y);
|
|
3758
3775
|
});
|
|
3759
|
-
|
|
3776
|
+
S.send(k);
|
|
3760
3777
|
};
|
|
3761
3778
|
}, ws = {
|
|
3762
3779
|
name: "jsonp",
|
|
@@ -3812,7 +3829,7 @@ function Yo() {
|
|
|
3812
3829
|
}
|
|
3813
3830
|
removeCallback(t, s, a) {
|
|
3814
3831
|
ce(t, function(c) {
|
|
3815
|
-
this._callbacks[c] =
|
|
3832
|
+
this._callbacks[c] = G(this._callbacks[c] || [], function(p) {
|
|
3816
3833
|
return s && s !== p.fn || a && a !== p.context;
|
|
3817
3834
|
}), this._callbacks[c].length === 0 && delete this._callbacks[c];
|
|
3818
3835
|
}, this);
|
|
@@ -3840,7 +3857,7 @@ function Yo() {
|
|
|
3840
3857
|
return this.callbacks.remove(t, s, a), this;
|
|
3841
3858
|
}
|
|
3842
3859
|
unbind_global(t) {
|
|
3843
|
-
return t ? (this.global_callbacks =
|
|
3860
|
+
return t ? (this.global_callbacks = G(this.global_callbacks || [], (s) => s !== t), this) : (this.global_callbacks = [], this);
|
|
3844
3861
|
}
|
|
3845
3862
|
unbind_all() {
|
|
3846
3863
|
return this.unbind(), this.unbind_global(), this;
|
|
@@ -3848,17 +3865,17 @@ function Yo() {
|
|
|
3848
3865
|
emit(t, s, a) {
|
|
3849
3866
|
for (var c = 0; c < this.global_callbacks.length; c++)
|
|
3850
3867
|
this.global_callbacks[c](t, s);
|
|
3851
|
-
var p = this.callbacks.get(t),
|
|
3852
|
-
if (a ?
|
|
3868
|
+
var p = this.callbacks.get(t), S = [];
|
|
3869
|
+
if (a ? S.push(s, a) : s && S.push(s), p && p.length > 0)
|
|
3853
3870
|
for (var c = 0; c < p.length; c++)
|
|
3854
|
-
p[c].fn.apply(p[c].context || window,
|
|
3871
|
+
p[c].fn.apply(p[c].context || window, S);
|
|
3855
3872
|
else this.failThrough && this.failThrough(t, s);
|
|
3856
3873
|
return this;
|
|
3857
3874
|
}
|
|
3858
3875
|
}
|
|
3859
3876
|
class Ps extends be {
|
|
3860
3877
|
constructor(t, s, a, c, p) {
|
|
3861
|
-
super(), this.initialize =
|
|
3878
|
+
super(), this.initialize = z.transportConnectionInitializer, this.hooks = t, this.name = s, this.priority = a, this.key = c, this.options = p, this.state = "new", this.timeline = p.timeline, this.activityTimeout = p.activityTimeout, this.id = this.timeline.generateUniqueID();
|
|
3862
3879
|
}
|
|
3863
3880
|
handlesActivityChecks() {
|
|
3864
3881
|
return !!this.hooks.handlesActivityChecks;
|
|
@@ -3877,7 +3894,7 @@ function Yo() {
|
|
|
3877
3894
|
this.onError(s), this.changeState("closed");
|
|
3878
3895
|
}), !1;
|
|
3879
3896
|
}
|
|
3880
|
-
return this.bindListeners(),
|
|
3897
|
+
return this.bindListeners(), ne.debug("Connecting", { transport: this.name, url: t }), this.changeState("connecting"), !0;
|
|
3881
3898
|
}
|
|
3882
3899
|
close() {
|
|
3883
3900
|
return this.socket ? (this.socket.close(), !0) : !1;
|
|
@@ -3932,7 +3949,7 @@ function Yo() {
|
|
|
3932
3949
|
})), this.emit(t, s);
|
|
3933
3950
|
}
|
|
3934
3951
|
buildTimelineMessage(t) {
|
|
3935
|
-
return
|
|
3952
|
+
return X({ cid: this.id }, t);
|
|
3936
3953
|
}
|
|
3937
3954
|
}
|
|
3938
3955
|
class Me {
|
|
@@ -3951,34 +3968,34 @@ function Yo() {
|
|
|
3951
3968
|
handlesActivityChecks: !1,
|
|
3952
3969
|
supportsPing: !1,
|
|
3953
3970
|
isInitialized: function() {
|
|
3954
|
-
return !!
|
|
3971
|
+
return !!z.getWebSocketAPI();
|
|
3955
3972
|
},
|
|
3956
3973
|
isSupported: function() {
|
|
3957
|
-
return !!
|
|
3974
|
+
return !!z.getWebSocketAPI();
|
|
3958
3975
|
},
|
|
3959
3976
|
getSocket: function(r) {
|
|
3960
|
-
return
|
|
3977
|
+
return z.createWebSocket(r);
|
|
3961
3978
|
}
|
|
3962
|
-
}),
|
|
3979
|
+
}), Wt = {
|
|
3963
3980
|
urls: Es,
|
|
3964
3981
|
handlesActivityChecks: !1,
|
|
3965
3982
|
supportsPing: !0,
|
|
3966
3983
|
isInitialized: function() {
|
|
3967
3984
|
return !0;
|
|
3968
3985
|
}
|
|
3969
|
-
},
|
|
3986
|
+
}, Gt = X({
|
|
3970
3987
|
getSocket: function(r) {
|
|
3971
|
-
return
|
|
3988
|
+
return z.HTTPFactory.createStreamingSocket(r);
|
|
3972
3989
|
}
|
|
3973
|
-
},
|
|
3990
|
+
}, Wt), Jt = X({
|
|
3974
3991
|
getSocket: function(r) {
|
|
3975
|
-
return
|
|
3992
|
+
return z.HTTPFactory.createPollingSocket(r);
|
|
3976
3993
|
}
|
|
3977
|
-
},
|
|
3994
|
+
}, Wt), Kt = {
|
|
3978
3995
|
isSupported: function() {
|
|
3979
|
-
return
|
|
3996
|
+
return z.isXHRSupported();
|
|
3980
3997
|
}
|
|
3981
|
-
}, Ms = new Me(
|
|
3998
|
+
}, Ms = new Me(X({}, Gt, Kt)), ks = new Me(X({}, Jt, Kt)), Is = {
|
|
3982
3999
|
ws: xs,
|
|
3983
4000
|
xhr_streaming: Ms,
|
|
3984
4001
|
xhr_polling: ks
|
|
@@ -3995,7 +4012,7 @@ function Yo() {
|
|
|
3995
4012
|
},
|
|
3996
4013
|
getSocket: function(r, t) {
|
|
3997
4014
|
return new window.SockJS(r, null, {
|
|
3998
|
-
js_path:
|
|
4015
|
+
js_path: v.getPath("sockjs", {
|
|
3999
4016
|
useTLS: t.useTLS
|
|
4000
4017
|
}),
|
|
4001
4018
|
ignore_null_origin: t.ignoreNullOrigin
|
|
@@ -4006,12 +4023,12 @@ function Yo() {
|
|
|
4006
4023
|
path: t
|
|
4007
4024
|
}));
|
|
4008
4025
|
}
|
|
4009
|
-
}),
|
|
4026
|
+
}), Yt = {
|
|
4010
4027
|
isSupported: function(r) {
|
|
4011
|
-
var t =
|
|
4028
|
+
var t = z.isXDRSupported(r.useTLS);
|
|
4012
4029
|
return t;
|
|
4013
4030
|
}
|
|
4014
|
-
}, Us = new Me(
|
|
4031
|
+
}, Us = new Me(X({}, Gt, Yt)), Os = new Me(X({}, Jt, Yt));
|
|
4015
4032
|
Be.xdr_streaming = Us, Be.xdr_polling = Os, Be.sockjs = Ls;
|
|
4016
4033
|
var Ns = Be;
|
|
4017
4034
|
class Fs extends be {
|
|
@@ -4034,26 +4051,26 @@ function Yo() {
|
|
|
4034
4051
|
this.manager = t, this.transport = s, this.minPingDelay = a.minPingDelay, this.maxPingDelay = a.maxPingDelay, this.pingDelay = void 0;
|
|
4035
4052
|
}
|
|
4036
4053
|
createConnection(t, s, a, c) {
|
|
4037
|
-
c =
|
|
4054
|
+
c = X({}, c, {
|
|
4038
4055
|
activityTimeout: this.pingDelay
|
|
4039
4056
|
});
|
|
4040
|
-
var p = this.transport.createConnection(t, s, a, c),
|
|
4041
|
-
p.unbind("open",
|
|
4042
|
-
}, D = (
|
|
4043
|
-
if (p.unbind("closed", D),
|
|
4057
|
+
var p = this.transport.createConnection(t, s, a, c), S = null, k = function() {
|
|
4058
|
+
p.unbind("open", k), p.bind("closed", D), S = N.now();
|
|
4059
|
+
}, D = (Y) => {
|
|
4060
|
+
if (p.unbind("closed", D), Y.code === 1002 || Y.code === 1003)
|
|
4044
4061
|
this.manager.reportDeath();
|
|
4045
|
-
else if (!
|
|
4046
|
-
var
|
|
4047
|
-
|
|
4062
|
+
else if (!Y.wasClean && S) {
|
|
4063
|
+
var ee = N.now() - S;
|
|
4064
|
+
ee < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(ee / 2, this.minPingDelay));
|
|
4048
4065
|
}
|
|
4049
4066
|
};
|
|
4050
|
-
return p.bind("open",
|
|
4067
|
+
return p.bind("open", k), p;
|
|
4051
4068
|
}
|
|
4052
4069
|
isSupported(t) {
|
|
4053
4070
|
return this.manager.isAlive() && this.transport.isSupported(t);
|
|
4054
4071
|
}
|
|
4055
4072
|
}
|
|
4056
|
-
const
|
|
4073
|
+
const Qt = {
|
|
4057
4074
|
decodeMessage: function(r) {
|
|
4058
4075
|
try {
|
|
4059
4076
|
var t = JSON.parse(r.data), s = t.data;
|
|
@@ -4076,7 +4093,7 @@ function Yo() {
|
|
|
4076
4093
|
return JSON.stringify(r);
|
|
4077
4094
|
},
|
|
4078
4095
|
processHandshake: function(r) {
|
|
4079
|
-
var t =
|
|
4096
|
+
var t = Qt.decodeMessage(r);
|
|
4080
4097
|
if (t.event === "pusher:connection_established") {
|
|
4081
4098
|
if (!t.data.activity_timeout)
|
|
4082
4099
|
throw "No activity timeout specified in handshake";
|
|
@@ -4107,7 +4124,7 @@ function Yo() {
|
|
|
4107
4124
|
} : null;
|
|
4108
4125
|
}
|
|
4109
4126
|
};
|
|
4110
|
-
var Ce =
|
|
4127
|
+
var Ce = Qt;
|
|
4111
4128
|
class zs extends be {
|
|
4112
4129
|
constructor(t, s) {
|
|
4113
4130
|
super(), this.id = t, this.transport = s, this.activityTimeout = s.activityTimeout, this.bindListeners();
|
|
@@ -4120,7 +4137,7 @@ function Yo() {
|
|
|
4120
4137
|
}
|
|
4121
4138
|
send_event(t, s, a) {
|
|
4122
4139
|
var c = { event: t, data: s };
|
|
4123
|
-
return a && (c.channel = a),
|
|
4140
|
+
return a && (c.channel = a), ne.debug("Event sent", c), this.send(Ce.encodeMessage(c));
|
|
4124
4141
|
}
|
|
4125
4142
|
ping() {
|
|
4126
4143
|
this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
|
|
@@ -4142,7 +4159,7 @@ function Yo() {
|
|
|
4142
4159
|
});
|
|
4143
4160
|
}
|
|
4144
4161
|
if (c !== void 0) {
|
|
4145
|
-
switch (
|
|
4162
|
+
switch (ne.debug("Event recd", c), c.event) {
|
|
4146
4163
|
case "pusher:error":
|
|
4147
4164
|
this.emit("error", {
|
|
4148
4165
|
type: "PusherError",
|
|
@@ -4213,7 +4230,7 @@ function Yo() {
|
|
|
4213
4230
|
this.transport.unbind("message", this.onMessage), this.transport.unbind("closed", this.onClosed);
|
|
4214
4231
|
}
|
|
4215
4232
|
finish(t, s) {
|
|
4216
|
-
this.callback(
|
|
4233
|
+
this.callback(X({ transport: this.transport, action: t }, s));
|
|
4217
4234
|
}
|
|
4218
4235
|
}
|
|
4219
4236
|
class $s {
|
|
@@ -4221,13 +4238,13 @@ function Yo() {
|
|
|
4221
4238
|
this.timeline = t, this.options = s || {};
|
|
4222
4239
|
}
|
|
4223
4240
|
send(t, s) {
|
|
4224
|
-
this.timeline.isEmpty() || this.timeline.send(
|
|
4241
|
+
this.timeline.isEmpty() || this.timeline.send(z.TimelineTransport.getAgent(this, t), s);
|
|
4225
4242
|
}
|
|
4226
4243
|
}
|
|
4227
4244
|
class lt extends be {
|
|
4228
4245
|
constructor(t, s) {
|
|
4229
4246
|
super(function(a, c) {
|
|
4230
|
-
|
|
4247
|
+
ne.debug("No callbacks on " + t + " for " + a);
|
|
4231
4248
|
}), this.name = t, this.pusher = s, this.subscribed = !1, this.subscriptionPending = !1, this.subscriptionCancelled = !1;
|
|
4232
4249
|
}
|
|
4233
4250
|
authorize(t, s) {
|
|
@@ -4237,8 +4254,8 @@ function Yo() {
|
|
|
4237
4254
|
if (t.indexOf("client-") !== 0)
|
|
4238
4255
|
throw new f("Event '" + t + "' does not start with 'client-'");
|
|
4239
4256
|
if (!this.subscribed) {
|
|
4240
|
-
var a =
|
|
4241
|
-
|
|
4257
|
+
var a = E.buildLogSuffix("triggeringClientEvents");
|
|
4258
|
+
ne.warn(`Client event triggered before channel 'subscription_succeeded' event . ${a}`);
|
|
4242
4259
|
}
|
|
4243
4260
|
return this.pusher.send_event(t, s, this.name);
|
|
4244
4261
|
}
|
|
@@ -4264,10 +4281,10 @@ function Yo() {
|
|
|
4264
4281
|
}
|
|
4265
4282
|
subscribe() {
|
|
4266
4283
|
this.subscribed || (this.subscriptionPending = !0, this.subscriptionCancelled = !1, this.authorize(this.pusher.connection.socket_id, (t, s) => {
|
|
4267
|
-
t ? (this.subscriptionPending = !1,
|
|
4284
|
+
t ? (this.subscriptionPending = !1, ne.error(t.toString()), this.emit("pusher:subscription_error", Object.assign({}, {
|
|
4268
4285
|
type: "AuthError",
|
|
4269
4286
|
error: t.message
|
|
4270
|
-
}, t instanceof
|
|
4287
|
+
}, t instanceof V ? { status: t.status } : {}))) : this.pusher.send_event("pusher:subscribe", {
|
|
4271
4288
|
auth: s.auth,
|
|
4272
4289
|
channel_data: s.channel_data,
|
|
4273
4290
|
channel: this.name
|
|
@@ -4328,29 +4345,29 @@ function Yo() {
|
|
|
4328
4345
|
}
|
|
4329
4346
|
var Bs = function(r, t, s, a) {
|
|
4330
4347
|
function c(p) {
|
|
4331
|
-
return p instanceof s ? p : new s(function(
|
|
4332
|
-
|
|
4348
|
+
return p instanceof s ? p : new s(function(S) {
|
|
4349
|
+
S(p);
|
|
4333
4350
|
});
|
|
4334
4351
|
}
|
|
4335
|
-
return new (s || (s = Promise))(function(p,
|
|
4336
|
-
function
|
|
4352
|
+
return new (s || (s = Promise))(function(p, S) {
|
|
4353
|
+
function k(ee) {
|
|
4337
4354
|
try {
|
|
4338
|
-
|
|
4355
|
+
Y(a.next(ee));
|
|
4339
4356
|
} catch (oe) {
|
|
4340
|
-
|
|
4357
|
+
S(oe);
|
|
4341
4358
|
}
|
|
4342
4359
|
}
|
|
4343
|
-
function D(
|
|
4360
|
+
function D(ee) {
|
|
4344
4361
|
try {
|
|
4345
|
-
|
|
4362
|
+
Y(a.throw(ee));
|
|
4346
4363
|
} catch (oe) {
|
|
4347
|
-
|
|
4364
|
+
S(oe);
|
|
4348
4365
|
}
|
|
4349
4366
|
}
|
|
4350
|
-
function
|
|
4351
|
-
|
|
4367
|
+
function Y(ee) {
|
|
4368
|
+
ee.done ? p(ee.value) : c(ee.value).then(k, D);
|
|
4352
4369
|
}
|
|
4353
|
-
|
|
4370
|
+
Y((a = a.apply(r, t || [])).next());
|
|
4354
4371
|
});
|
|
4355
4372
|
};
|
|
4356
4373
|
class Vs extends ht {
|
|
@@ -4366,8 +4383,8 @@ function Yo() {
|
|
|
4366
4383
|
} else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null)
|
|
4367
4384
|
this.members.setMyID(this.pusher.user.user_data.id);
|
|
4368
4385
|
else {
|
|
4369
|
-
let
|
|
4370
|
-
|
|
4386
|
+
let S = E.buildLogSuffix("authorizationEndpoint");
|
|
4387
|
+
ne.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${S}, or the user should be signed in.`), s("Invalid auth response");
|
|
4371
4388
|
return;
|
|
4372
4389
|
}
|
|
4373
4390
|
s(a, c);
|
|
@@ -4440,32 +4457,32 @@ function Yo() {
|
|
|
4440
4457
|
}
|
|
4441
4458
|
handleEncryptedEvent(t, s) {
|
|
4442
4459
|
if (!this.key) {
|
|
4443
|
-
|
|
4460
|
+
ne.debug("Received encrypted event before key has been retrieved from the authEndpoint");
|
|
4444
4461
|
return;
|
|
4445
4462
|
}
|
|
4446
4463
|
if (!s.ciphertext || !s.nonce) {
|
|
4447
|
-
|
|
4464
|
+
ne.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + s);
|
|
4448
4465
|
return;
|
|
4449
4466
|
}
|
|
4450
4467
|
let a = Object(dt.decode)(s.ciphertext);
|
|
4451
4468
|
if (a.length < this.nacl.secretbox.overheadLength) {
|
|
4452
|
-
|
|
4469
|
+
ne.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${a.length}`);
|
|
4453
4470
|
return;
|
|
4454
4471
|
}
|
|
4455
4472
|
let c = Object(dt.decode)(s.nonce);
|
|
4456
4473
|
if (c.length < this.nacl.secretbox.nonceLength) {
|
|
4457
|
-
|
|
4474
|
+
ne.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${c.length}`);
|
|
4458
4475
|
return;
|
|
4459
4476
|
}
|
|
4460
4477
|
let p = this.nacl.secretbox.open(a, c, this.key);
|
|
4461
4478
|
if (p === null) {
|
|
4462
|
-
|
|
4463
|
-
if (
|
|
4464
|
-
|
|
4479
|
+
ne.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."), this.authorize(this.pusher.connection.socket_id, (S, k) => {
|
|
4480
|
+
if (S) {
|
|
4481
|
+
ne.error(`Failed to make a request to the authEndpoint: ${k}. Unable to fetch new key, so dropping encrypted event`);
|
|
4465
4482
|
return;
|
|
4466
4483
|
}
|
|
4467
4484
|
if (p = this.nacl.secretbox.open(a, c, this.key), p === null) {
|
|
4468
|
-
|
|
4485
|
+
ne.error("Failed to decrypt event with new key. Dropping encrypted event");
|
|
4469
4486
|
return;
|
|
4470
4487
|
}
|
|
4471
4488
|
this.emit(t, this.getDataToEmit(p));
|
|
@@ -4486,7 +4503,7 @@ function Yo() {
|
|
|
4486
4503
|
class Gs extends be {
|
|
4487
4504
|
constructor(t, s) {
|
|
4488
4505
|
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);
|
|
4489
|
-
var a =
|
|
4506
|
+
var a = z.getNetwork();
|
|
4490
4507
|
a.bind("online", () => {
|
|
4491
4508
|
this.timeline.info({ netinfo: "online" }), (this.state === "connecting" || this.state === "unavailable") && this.retryIn(0);
|
|
4492
4509
|
}), a.bind("offline", () => {
|
|
@@ -4569,7 +4586,7 @@ function Yo() {
|
|
|
4569
4586
|
this.activityTimer && this.activityTimer.ensureAborted();
|
|
4570
4587
|
}
|
|
4571
4588
|
buildConnectionCallbacks(t) {
|
|
4572
|
-
return
|
|
4589
|
+
return X({}, t, {
|
|
4573
4590
|
message: (s) => {
|
|
4574
4591
|
this.resetActivityCheck(), this.emit("message", s);
|
|
4575
4592
|
},
|
|
@@ -4588,7 +4605,7 @@ function Yo() {
|
|
|
4588
4605
|
});
|
|
4589
4606
|
}
|
|
4590
4607
|
buildHandshakeCallbacks(t) {
|
|
4591
|
-
return
|
|
4608
|
+
return X({}, t, {
|
|
4592
4609
|
connected: (s) => {
|
|
4593
4610
|
this.activityTimeout = Math.min(this.options.activityTimeout, s.activityTimeout, s.connection.activityTimeout || 1 / 0), this.clearUnavailableTimer(), this.setConnection(s.connection), this.socket_id = this.connection.id, this.updateState("connected", { socket_id: this.socket_id });
|
|
4594
4611
|
}
|
|
@@ -4632,7 +4649,7 @@ function Yo() {
|
|
|
4632
4649
|
var a = this.state;
|
|
4633
4650
|
if (this.state = t, a !== t) {
|
|
4634
4651
|
var c = t;
|
|
4635
|
-
c === "connected" && (c += " with new socket ID " + s.socket_id),
|
|
4652
|
+
c === "connected" && (c += " with new socket ID " + s.socket_id), ne.debug("State changed", a + " -> " + c), this.timeline.info({ state: t, params: s }), this.emit("state_change", { previous: a, current: t }), this.emit(t, s);
|
|
4636
4653
|
}
|
|
4637
4654
|
}
|
|
4638
4655
|
shouldRetry() {
|
|
@@ -4666,7 +4683,7 @@ function Yo() {
|
|
|
4666
4683
|
if (r.indexOf("private-encrypted-") === 0) {
|
|
4667
4684
|
if (t.config.nacl)
|
|
4668
4685
|
return ye.createEncryptedChannel(r, t, t.config.nacl);
|
|
4669
|
-
let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a =
|
|
4686
|
+
let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a = E.buildLogSuffix("encryptedChannelSupport");
|
|
4670
4687
|
throw new B(`${s}. ${a}`);
|
|
4671
4688
|
} else {
|
|
4672
4689
|
if (r.indexOf("private-") === 0)
|
|
@@ -4674,7 +4691,7 @@ function Yo() {
|
|
|
4674
4691
|
if (r.indexOf("presence-") === 0)
|
|
4675
4692
|
return ye.createPresenceChannel(r, t);
|
|
4676
4693
|
if (r.indexOf("#") === 0)
|
|
4677
|
-
throw new
|
|
4694
|
+
throw new b('Cannot create a channel with name "' + r + '".');
|
|
4678
4695
|
return ye.createChannel(r, t);
|
|
4679
4696
|
}
|
|
4680
4697
|
}
|
|
@@ -4707,7 +4724,7 @@ function Yo() {
|
|
|
4707
4724
|
return new qs(r, t, s);
|
|
4708
4725
|
}
|
|
4709
4726
|
}, ye = Ys;
|
|
4710
|
-
class
|
|
4727
|
+
class Zt {
|
|
4711
4728
|
constructor(t) {
|
|
4712
4729
|
this.options = t || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
4713
4730
|
}
|
|
@@ -4729,33 +4746,33 @@ function Yo() {
|
|
|
4729
4746
|
this.strategies = t, this.loop = !!s.loop, this.failFast = !!s.failFast, this.timeout = s.timeout, this.timeoutLimit = s.timeoutLimit;
|
|
4730
4747
|
}
|
|
4731
4748
|
isSupported() {
|
|
4732
|
-
return
|
|
4749
|
+
return Xt(this.strategies, N.method("isSupported"));
|
|
4733
4750
|
}
|
|
4734
4751
|
connect(t, s) {
|
|
4735
|
-
var a = this.strategies, c = 0, p = this.timeout,
|
|
4736
|
-
|
|
4752
|
+
var a = this.strategies, c = 0, p = this.timeout, S = null, k = (D, Y) => {
|
|
4753
|
+
Y ? s(null, Y) : (c = c + 1, this.loop && (c = c % a.length), c < a.length ? (p && (p = p * 2, this.timeoutLimit && (p = Math.min(p, this.timeoutLimit))), S = this.tryStrategy(a[c], t, { timeout: p, failFast: this.failFast }, k)) : s(!0));
|
|
4737
4754
|
};
|
|
4738
|
-
return
|
|
4755
|
+
return S = this.tryStrategy(a[c], t, { timeout: p, failFast: this.failFast }, k), {
|
|
4739
4756
|
abort: function() {
|
|
4740
|
-
|
|
4757
|
+
S.abort();
|
|
4741
4758
|
},
|
|
4742
4759
|
forceMinPriority: function(D) {
|
|
4743
|
-
t = D,
|
|
4760
|
+
t = D, S && S.forceMinPriority(D);
|
|
4744
4761
|
}
|
|
4745
4762
|
};
|
|
4746
4763
|
}
|
|
4747
4764
|
tryStrategy(t, s, a, c) {
|
|
4748
|
-
var p = null,
|
|
4765
|
+
var p = null, S = null;
|
|
4749
4766
|
return a.timeout > 0 && (p = new T(a.timeout, function() {
|
|
4750
|
-
|
|
4751
|
-
})),
|
|
4752
|
-
|
|
4767
|
+
S.abort(), c(!0);
|
|
4768
|
+
})), S = t.connect(s, function(k, D) {
|
|
4769
|
+
k && p && p.isRunning() && !a.failFast || (p && p.ensureAborted(), c(k, D));
|
|
4753
4770
|
}), {
|
|
4754
4771
|
abort: function() {
|
|
4755
|
-
p && p.ensureAborted(),
|
|
4772
|
+
p && p.ensureAborted(), S.abort();
|
|
4756
4773
|
},
|
|
4757
|
-
forceMinPriority: function(
|
|
4758
|
-
|
|
4774
|
+
forceMinPriority: function(k) {
|
|
4775
|
+
S.forceMinPriority(k);
|
|
4759
4776
|
}
|
|
4760
4777
|
};
|
|
4761
4778
|
}
|
|
@@ -4765,25 +4782,25 @@ function Yo() {
|
|
|
4765
4782
|
this.strategies = t;
|
|
4766
4783
|
}
|
|
4767
4784
|
isSupported() {
|
|
4768
|
-
return
|
|
4785
|
+
return Xt(this.strategies, N.method("isSupported"));
|
|
4769
4786
|
}
|
|
4770
4787
|
connect(t, s) {
|
|
4771
4788
|
return Qs(this.strategies, t, function(a, c) {
|
|
4772
|
-
return function(p,
|
|
4789
|
+
return function(p, S) {
|
|
4773
4790
|
if (c[a].error = p, p) {
|
|
4774
4791
|
Zs(c) && s(!0);
|
|
4775
4792
|
return;
|
|
4776
4793
|
}
|
|
4777
|
-
ce(c, function(
|
|
4778
|
-
|
|
4779
|
-
}), s(null,
|
|
4794
|
+
ce(c, function(k) {
|
|
4795
|
+
k.forceMinPriority(S.transport.priority);
|
|
4796
|
+
}), s(null, S);
|
|
4780
4797
|
};
|
|
4781
4798
|
});
|
|
4782
4799
|
}
|
|
4783
4800
|
}
|
|
4784
4801
|
function Qs(r, t, s) {
|
|
4785
|
-
var a = pe(r, function(c, p,
|
|
4786
|
-
return c.connect(t, s(p,
|
|
4802
|
+
var a = pe(r, function(c, p, S, k) {
|
|
4803
|
+
return c.connect(t, s(p, k));
|
|
4787
4804
|
});
|
|
4788
4805
|
return {
|
|
4789
4806
|
abort: function() {
|
|
@@ -4812,27 +4829,27 @@ function Yo() {
|
|
|
4812
4829
|
return this.strategy.isSupported();
|
|
4813
4830
|
}
|
|
4814
4831
|
connect(t, s) {
|
|
4815
|
-
var a = this.usingTLS, c = nr(a), p = c && c.cacheSkipCount ? c.cacheSkipCount : 0,
|
|
4832
|
+
var a = this.usingTLS, c = nr(a), p = c && c.cacheSkipCount ? c.cacheSkipCount : 0, S = [this.strategy];
|
|
4816
4833
|
if (c && c.timestamp + this.ttl >= N.now()) {
|
|
4817
|
-
var
|
|
4818
|
-
|
|
4834
|
+
var k = this.transports[c.transport];
|
|
4835
|
+
k && (["ws", "wss"].includes(c.transport) || p > 3 ? (this.timeline.info({
|
|
4819
4836
|
cached: !0,
|
|
4820
4837
|
transport: c.transport,
|
|
4821
4838
|
latency: c.latency
|
|
4822
|
-
}),
|
|
4839
|
+
}), S.push(new Te([k], {
|
|
4823
4840
|
timeout: c.latency * 2 + 1e3,
|
|
4824
4841
|
failFast: !0
|
|
4825
4842
|
}))) : p++);
|
|
4826
4843
|
}
|
|
4827
|
-
var D = N.now(),
|
|
4828
|
-
oe ? (
|
|
4844
|
+
var D = N.now(), Y = S.pop().connect(t, function ee(oe, We) {
|
|
4845
|
+
oe ? (en(a), S.length > 0 ? (D = N.now(), Y = S.pop().connect(t, ee)) : s(oe)) : (sr(a, We.transport.name, N.now() - D, p), s(null, We));
|
|
4829
4846
|
});
|
|
4830
4847
|
return {
|
|
4831
4848
|
abort: function() {
|
|
4832
|
-
|
|
4849
|
+
Y.abort();
|
|
4833
4850
|
},
|
|
4834
|
-
forceMinPriority: function(
|
|
4835
|
-
t =
|
|
4851
|
+
forceMinPriority: function(ee) {
|
|
4852
|
+
t = ee, Y && Y.forceMinPriority(ee);
|
|
4836
4853
|
}
|
|
4837
4854
|
};
|
|
4838
4855
|
}
|
|
@@ -4841,19 +4858,19 @@ function Yo() {
|
|
|
4841
4858
|
return "pusherTransport" + (r ? "TLS" : "NonTLS");
|
|
4842
4859
|
}
|
|
4843
4860
|
function nr(r) {
|
|
4844
|
-
var t =
|
|
4861
|
+
var t = z.getLocalStorage();
|
|
4845
4862
|
if (t)
|
|
4846
4863
|
try {
|
|
4847
4864
|
var s = t[pt(r)];
|
|
4848
4865
|
if (s)
|
|
4849
4866
|
return JSON.parse(s);
|
|
4850
4867
|
} catch {
|
|
4851
|
-
|
|
4868
|
+
en(r);
|
|
4852
4869
|
}
|
|
4853
4870
|
return null;
|
|
4854
4871
|
}
|
|
4855
4872
|
function sr(r, t, s, a) {
|
|
4856
|
-
var c =
|
|
4873
|
+
var c = z.getLocalStorage();
|
|
4857
4874
|
if (c)
|
|
4858
4875
|
try {
|
|
4859
4876
|
c[pt(r)] = He({
|
|
@@ -4865,8 +4882,8 @@ function Yo() {
|
|
|
4865
4882
|
} catch {
|
|
4866
4883
|
}
|
|
4867
4884
|
}
|
|
4868
|
-
function
|
|
4869
|
-
var t =
|
|
4885
|
+
function en(r) {
|
|
4886
|
+
var t = z.getLocalStorage();
|
|
4870
4887
|
if (t)
|
|
4871
4888
|
try {
|
|
4872
4889
|
delete t[pt(r)];
|
|
@@ -4888,8 +4905,8 @@ function Yo() {
|
|
|
4888
4905
|
abort: function() {
|
|
4889
4906
|
p.ensureAborted(), c && c.abort();
|
|
4890
4907
|
},
|
|
4891
|
-
forceMinPriority: function(
|
|
4892
|
-
t =
|
|
4908
|
+
forceMinPriority: function(S) {
|
|
4909
|
+
t = S, c && c.forceMinPriority(S);
|
|
4893
4910
|
}
|
|
4894
4911
|
};
|
|
4895
4912
|
}
|
|
@@ -4928,17 +4945,17 @@ function Yo() {
|
|
|
4928
4945
|
}
|
|
4929
4946
|
var ir = function(r, t, s) {
|
|
4930
4947
|
var a = {};
|
|
4931
|
-
function c(
|
|
4932
|
-
var
|
|
4933
|
-
return a[
|
|
4948
|
+
function c(dn, ri, ii, oi, ai) {
|
|
4949
|
+
var fn = s(r, dn, ri, ii, oi, ai);
|
|
4950
|
+
return a[dn] = fn, fn;
|
|
4934
4951
|
}
|
|
4935
4952
|
var p = Object.assign({}, t, {
|
|
4936
4953
|
hostNonTLS: r.wsHost + ":" + r.wsPort,
|
|
4937
4954
|
hostTLS: r.wsHost + ":" + r.wssPort,
|
|
4938
4955
|
httpPath: r.wsPath
|
|
4939
|
-
}),
|
|
4956
|
+
}), S = Object.assign({}, p, {
|
|
4940
4957
|
useTLS: !0
|
|
4941
|
-
}),
|
|
4958
|
+
}), k = Object.assign({}, t, {
|
|
4942
4959
|
hostNonTLS: r.httpHost + ":" + r.httpPort,
|
|
4943
4960
|
hostTLS: r.httpHost + ":" + r.httpsPort,
|
|
4944
4961
|
httpPath: r.httpPath
|
|
@@ -4946,28 +4963,28 @@ function Yo() {
|
|
|
4946
4963
|
loop: !0,
|
|
4947
4964
|
timeout: 15e3,
|
|
4948
4965
|
timeoutLimit: 6e4
|
|
4949
|
-
},
|
|
4966
|
+
}, Y = new Zt({
|
|
4950
4967
|
minPingDelay: 1e4,
|
|
4951
4968
|
maxPingDelay: r.activityTimeout
|
|
4952
|
-
}),
|
|
4969
|
+
}), ee = new Zt({
|
|
4953
4970
|
lives: 2,
|
|
4954
4971
|
minPingDelay: 1e4,
|
|
4955
4972
|
maxPingDelay: r.activityTimeout
|
|
4956
|
-
}), oe = c("ws", "ws", 3, p,
|
|
4957
|
-
new ke(Ie(
|
|
4958
|
-
], D), un = new Te([
|
|
4959
|
-
new ke(Ie(on), on, ti)
|
|
4973
|
+
}), oe = c("ws", "ws", 3, p, Y), We = c("wss", "ws", 3, S, Y), Zr = c("sockjs", "sockjs", 1, k), on = c("xhr_streaming", "xhr_streaming", 1, k, ee), ei = c("xdr_streaming", "xdr_streaming", 1, k, ee), an = c("xhr_polling", "xhr_polling", 1, k), ti = c("xdr_polling", "xdr_polling", 1, k), cn = new Te([oe], D), ni = new Te([We], D), si = new Te([Zr], D), un = new Te([
|
|
4974
|
+
new ke(Ie(on), on, ei)
|
|
4960
4975
|
], D), ln = new Te([
|
|
4961
|
-
new ke(Ie(
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4976
|
+
new ke(Ie(an), an, ti)
|
|
4977
|
+
], D), hn = new Te([
|
|
4978
|
+
new ke(Ie(un), new ft([
|
|
4979
|
+
un,
|
|
4980
|
+
new Ve(ln, { delay: 4e3 })
|
|
4981
|
+
]), ln)
|
|
4982
|
+
], D), bt = new ke(Ie(hn), hn, si), yt;
|
|
4966
4983
|
return t.useTLS ? yt = new ft([
|
|
4967
|
-
|
|
4984
|
+
cn,
|
|
4968
4985
|
new Ve(bt, { delay: 2e3 })
|
|
4969
4986
|
]) : yt = new ft([
|
|
4970
|
-
|
|
4987
|
+
cn,
|
|
4971
4988
|
new Ve(ni, { delay: 2e3 }),
|
|
4972
4989
|
new Ve(bt, { delay: 5e3 })
|
|
4973
4990
|
]), new tr(new rr(new ke(Ie(oe), yt, bt)), a, {
|
|
@@ -4979,14 +4996,14 @@ function Yo() {
|
|
|
4979
4996
|
var r = this;
|
|
4980
4997
|
r.timeline.info(r.buildTimelineMessage({
|
|
4981
4998
|
transport: r.name + (r.options.useTLS ? "s" : "")
|
|
4982
|
-
})), r.hooks.isInitialized() ? r.changeState("initialized") : r.hooks.file ? (r.changeState("initializing"),
|
|
4999
|
+
})), r.hooks.isInitialized() ? r.changeState("initialized") : r.hooks.file ? (r.changeState("initializing"), v.load(r.hooks.file, { useTLS: r.options.useTLS }, function(t, s) {
|
|
4983
5000
|
r.hooks.isInitialized() ? (r.changeState("initialized"), s(!0)) : (t && r.onError(t), r.onClose(), s(!1));
|
|
4984
5001
|
})) : r.onClose();
|
|
4985
5002
|
}), cr = {
|
|
4986
5003
|
getRequest: function(r) {
|
|
4987
5004
|
var t = new window.XDomainRequest();
|
|
4988
5005
|
return t.ontimeout = function() {
|
|
4989
|
-
r.emit("error", new
|
|
5006
|
+
r.emit("error", new y()), r.close();
|
|
4990
5007
|
}, t.onerror = function(s) {
|
|
4991
5008
|
r.emit("error", s), r.close();
|
|
4992
5009
|
}, t.onprogress = function() {
|
|
@@ -5007,10 +5024,10 @@ function Yo() {
|
|
|
5007
5024
|
start(t) {
|
|
5008
5025
|
this.position = 0, this.xhr = this.hooks.getRequest(this), this.unloader = () => {
|
|
5009
5026
|
this.close();
|
|
5010
|
-
},
|
|
5027
|
+
}, z.addUnloadListener(this.unloader), this.xhr.open(this.method, this.url, !0), this.xhr.setRequestHeader && this.xhr.setRequestHeader("Content-Type", "application/json"), this.xhr.send(t);
|
|
5011
5028
|
}
|
|
5012
5029
|
close() {
|
|
5013
|
-
this.unloader && (
|
|
5030
|
+
this.unloader && (z.removeUnloadListener(this.unloader), this.unloader = null), this.xhr && (this.hooks.abortRequest(this.xhr), this.xhr = null);
|
|
5014
5031
|
}
|
|
5015
5032
|
onChunk(t, s) {
|
|
5016
5033
|
for (; ; ) {
|
|
@@ -5038,7 +5055,7 @@ function Yo() {
|
|
|
5038
5055
|
var Ee = gt, dr = 1;
|
|
5039
5056
|
class fr {
|
|
5040
5057
|
constructor(t, s) {
|
|
5041
|
-
this.hooks = t, this.session =
|
|
5058
|
+
this.hooks = t, this.session = nn(1e3) + "/" + vr(8), this.location = pr(s), this.readyState = Ee.CONNECTING, this.openStream();
|
|
5042
5059
|
}
|
|
5043
5060
|
send(t) {
|
|
5044
5061
|
return this.sendRaw(JSON.stringify([t]));
|
|
@@ -5052,7 +5069,7 @@ function Yo() {
|
|
|
5052
5069
|
sendRaw(t) {
|
|
5053
5070
|
if (this.readyState === Ee.OPEN)
|
|
5054
5071
|
try {
|
|
5055
|
-
return
|
|
5072
|
+
return z.createSocketRequest("POST", tn(gr(this.location, this.session))).start(t), !0;
|
|
5056
5073
|
} catch {
|
|
5057
5074
|
return !1;
|
|
5058
5075
|
}
|
|
@@ -5107,7 +5124,7 @@ function Yo() {
|
|
|
5107
5124
|
this.onerror && this.onerror(t);
|
|
5108
5125
|
}
|
|
5109
5126
|
openStream() {
|
|
5110
|
-
this.stream =
|
|
5127
|
+
this.stream = z.createSocketRequest("POST", tn(this.hooks.getReceiveURL(this.location, this.session))), this.stream.bind("chunk", (t) => {
|
|
5111
5128
|
this.onChunk(t);
|
|
5112
5129
|
}), this.stream.bind("finished", (t) => {
|
|
5113
5130
|
this.hooks.onFinished(this, t);
|
|
@@ -5136,7 +5153,7 @@ function Yo() {
|
|
|
5136
5153
|
function gr(r, t) {
|
|
5137
5154
|
return r.base + "/" + t + "/xhr_send";
|
|
5138
5155
|
}
|
|
5139
|
-
function
|
|
5156
|
+
function tn(r) {
|
|
5140
5157
|
var t = r.indexOf("?") === -1 ? "?" : "&";
|
|
5141
5158
|
return r + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" + dr++;
|
|
5142
5159
|
}
|
|
@@ -5144,12 +5161,12 @@ function Yo() {
|
|
|
5144
5161
|
var s = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(r);
|
|
5145
5162
|
return s[1] + t + s[3];
|
|
5146
5163
|
}
|
|
5147
|
-
function
|
|
5148
|
-
return
|
|
5164
|
+
function nn(r) {
|
|
5165
|
+
return z.randomInt(r);
|
|
5149
5166
|
}
|
|
5150
5167
|
function vr(r) {
|
|
5151
5168
|
for (var t = [], s = 0; s < r; s++)
|
|
5152
|
-
t.push(
|
|
5169
|
+
t.push(nn(32).toString(32));
|
|
5153
5170
|
return t.join("");
|
|
5154
5171
|
}
|
|
5155
5172
|
var br = fr, yr = {
|
|
@@ -5179,7 +5196,7 @@ function Yo() {
|
|
|
5179
5196
|
}
|
|
5180
5197
|
}, wr = Sr, Cr = {
|
|
5181
5198
|
getRequest: function(r) {
|
|
5182
|
-
var t =
|
|
5199
|
+
var t = z.getXHRAPI(), s = new t();
|
|
5183
5200
|
return s.onreadystatechange = s.onprogress = function() {
|
|
5184
5201
|
switch (s.readyState) {
|
|
5185
5202
|
case 3:
|
|
@@ -5210,11 +5227,11 @@ function Yo() {
|
|
|
5210
5227
|
createRequest(r, t, s) {
|
|
5211
5228
|
return new hr(r, t, s);
|
|
5212
5229
|
}
|
|
5213
|
-
},
|
|
5214
|
-
|
|
5230
|
+
}, sn = Er;
|
|
5231
|
+
sn.createXDR = function(r, t) {
|
|
5215
5232
|
return this.createRequest(ur, r, t);
|
|
5216
5233
|
};
|
|
5217
|
-
var Rr =
|
|
5234
|
+
var Rr = sn, Ar = {
|
|
5218
5235
|
nextAuthCallbackID: 1,
|
|
5219
5236
|
auth_callbacks: {},
|
|
5220
5237
|
ScriptReceivers: h,
|
|
@@ -5235,7 +5252,7 @@ function Yo() {
|
|
|
5235
5252
|
var t = () => {
|
|
5236
5253
|
this.onDocumentBody(r.ready);
|
|
5237
5254
|
};
|
|
5238
|
-
window.JSON ? t() :
|
|
5255
|
+
window.JSON ? t() : v.load("json2", {}, t);
|
|
5239
5256
|
},
|
|
5240
5257
|
getDocument() {
|
|
5241
5258
|
return document;
|
|
@@ -5307,7 +5324,7 @@ function Yo() {
|
|
|
5307
5324
|
return (window.crypto || window.msCrypto).getRandomValues(new Uint32Array(1))[0] / Math.pow(2, 32);
|
|
5308
5325
|
}() * r);
|
|
5309
5326
|
}
|
|
5310
|
-
},
|
|
5327
|
+
}, z = Ar, mt;
|
|
5311
5328
|
(function(r) {
|
|
5312
5329
|
r[r.ERROR = 3] = "ERROR", r[r.INFO = 6] = "INFO", r[r.DEBUG = 7] = "DEBUG";
|
|
5313
5330
|
})(mt || (mt = {}));
|
|
@@ -5317,7 +5334,7 @@ function Yo() {
|
|
|
5317
5334
|
this.key = t, this.session = s, this.events = [], this.options = a || {}, this.sent = 0, this.uniqueID = 0;
|
|
5318
5335
|
}
|
|
5319
5336
|
log(t, s) {
|
|
5320
|
-
t <= this.options.level && (this.events.push(
|
|
5337
|
+
t <= this.options.level && (this.events.push(X({}, s, { timestamp: N.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
|
|
5321
5338
|
}
|
|
5322
5339
|
error(t) {
|
|
5323
5340
|
this.log(Xe.ERROR, t);
|
|
@@ -5332,7 +5349,7 @@ function Yo() {
|
|
|
5332
5349
|
return this.events.length === 0;
|
|
5333
5350
|
}
|
|
5334
5351
|
send(t, s) {
|
|
5335
|
-
var a =
|
|
5352
|
+
var a = X({
|
|
5336
5353
|
session: this.session,
|
|
5337
5354
|
bundle: this.sent + 1,
|
|
5338
5355
|
key: this.key,
|
|
@@ -5362,26 +5379,26 @@ function Yo() {
|
|
|
5362
5379
|
connect(t, s) {
|
|
5363
5380
|
if (this.isSupported()) {
|
|
5364
5381
|
if (this.priority < t)
|
|
5365
|
-
return
|
|
5366
|
-
} else return
|
|
5367
|
-
var a = !1, c = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), p = null,
|
|
5368
|
-
c.unbind("initialized",
|
|
5369
|
-
},
|
|
5382
|
+
return rn(new F(), s);
|
|
5383
|
+
} else return rn(new L(), s);
|
|
5384
|
+
var a = !1, c = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), p = null, S = function() {
|
|
5385
|
+
c.unbind("initialized", S), c.connect();
|
|
5386
|
+
}, k = function() {
|
|
5370
5387
|
p = ye.createHandshake(c, function(oe) {
|
|
5371
|
-
a = !0,
|
|
5388
|
+
a = !0, ee(), s(null, oe);
|
|
5372
5389
|
});
|
|
5373
5390
|
}, D = function(oe) {
|
|
5374
|
-
|
|
5375
|
-
},
|
|
5376
|
-
|
|
5391
|
+
ee(), s(oe);
|
|
5392
|
+
}, Y = function() {
|
|
5393
|
+
ee();
|
|
5377
5394
|
var oe;
|
|
5378
|
-
oe = He(c), s(new
|
|
5379
|
-
},
|
|
5380
|
-
c.unbind("initialized",
|
|
5395
|
+
oe = He(c), s(new H(oe));
|
|
5396
|
+
}, ee = function() {
|
|
5397
|
+
c.unbind("initialized", S), c.unbind("open", k), c.unbind("error", D), c.unbind("closed", Y);
|
|
5381
5398
|
};
|
|
5382
|
-
return c.bind("initialized",
|
|
5399
|
+
return c.bind("initialized", S), c.bind("open", k), c.bind("error", D), c.bind("closed", Y), c.initialize(), {
|
|
5383
5400
|
abort: () => {
|
|
5384
|
-
a || (
|
|
5401
|
+
a || (ee(), p ? p.close() : c.close());
|
|
5385
5402
|
},
|
|
5386
5403
|
forceMinPriority: (oe) => {
|
|
5387
5404
|
a || this.priority < oe && (p ? p.close() : c.close());
|
|
@@ -5389,7 +5406,7 @@ function Yo() {
|
|
|
5389
5406
|
};
|
|
5390
5407
|
}
|
|
5391
5408
|
}
|
|
5392
|
-
function
|
|
5409
|
+
function rn(r, t) {
|
|
5393
5410
|
return N.defer(function() {
|
|
5394
5411
|
t(r);
|
|
5395
5412
|
}), {
|
|
@@ -5399,20 +5416,20 @@ function Yo() {
|
|
|
5399
5416
|
}
|
|
5400
5417
|
};
|
|
5401
5418
|
}
|
|
5402
|
-
const { Transports: Mr } =
|
|
5419
|
+
const { Transports: Mr } = z;
|
|
5403
5420
|
var kr = function(r, t, s, a, c, p) {
|
|
5404
|
-
var
|
|
5405
|
-
if (!
|
|
5421
|
+
var S = Mr[s];
|
|
5422
|
+
if (!S)
|
|
5406
5423
|
throw new P(s);
|
|
5407
|
-
var
|
|
5408
|
-
return
|
|
5424
|
+
var k = (!r.enabledTransports || ve(r.enabledTransports, t) !== -1) && (!r.disabledTransports || ve(r.disabledTransports, t) === -1), D;
|
|
5425
|
+
return k ? (c = Object.assign({ ignoreNullOrigin: r.ignoreNullOrigin }, c), D = new xr(t, a, p ? p.getAssistant(S) : S, c)) : D = Ir, D;
|
|
5409
5426
|
}, Ir = {
|
|
5410
5427
|
isSupported: function() {
|
|
5411
5428
|
return !1;
|
|
5412
5429
|
},
|
|
5413
5430
|
connect: function(r, t) {
|
|
5414
5431
|
var s = N.defer(function() {
|
|
5415
|
-
t(new
|
|
5432
|
+
t(new L());
|
|
5416
5433
|
});
|
|
5417
5434
|
return {
|
|
5418
5435
|
abort: function() {
|
|
@@ -5428,7 +5445,7 @@ function Yo() {
|
|
|
5428
5445
|
throw "You must pass an options object";
|
|
5429
5446
|
if (r.cluster == null)
|
|
5430
5447
|
throw "Options object must provide a cluster";
|
|
5431
|
-
"disableStats" in r &&
|
|
5448
|
+
"disableStats" in r && ne.warn("The disableStats option is deprecated in favor of enableStats");
|
|
5432
5449
|
}
|
|
5433
5450
|
const Ur = (r, t) => {
|
|
5434
5451
|
var s = "socket_id=" + encodeURIComponent(r.socketId);
|
|
@@ -5442,11 +5459,11 @@ function Yo() {
|
|
|
5442
5459
|
return s;
|
|
5443
5460
|
};
|
|
5444
5461
|
var Or = (r) => {
|
|
5445
|
-
if (typeof
|
|
5462
|
+
if (typeof z.getAuthorizers()[r.transport] > "u")
|
|
5446
5463
|
throw `'${r.transport}' is not a recognized auth transport`;
|
|
5447
5464
|
return (t, s) => {
|
|
5448
5465
|
const a = Ur(t, r);
|
|
5449
|
-
|
|
5466
|
+
z.getAuthorizers()[r.transport](z, a, r, _.UserAuthentication, s);
|
|
5450
5467
|
};
|
|
5451
5468
|
};
|
|
5452
5469
|
const Nr = (r, t) => {
|
|
@@ -5462,11 +5479,11 @@ function Yo() {
|
|
|
5462
5479
|
return s;
|
|
5463
5480
|
};
|
|
5464
5481
|
var Fr = (r) => {
|
|
5465
|
-
if (typeof
|
|
5482
|
+
if (typeof z.getAuthorizers()[r.transport] > "u")
|
|
5466
5483
|
throw `'${r.transport}' is not a recognized auth transport`;
|
|
5467
5484
|
return (t, s) => {
|
|
5468
5485
|
const a = Nr(t, r);
|
|
5469
|
-
|
|
5486
|
+
z.getAuthorizers()[r.transport](z, a, r, _.ChannelAuthorization, s);
|
|
5470
5487
|
};
|
|
5471
5488
|
};
|
|
5472
5489
|
const Dr = (r, t, s) => {
|
|
@@ -5479,8 +5496,8 @@ function Yo() {
|
|
|
5479
5496
|
}
|
|
5480
5497
|
};
|
|
5481
5498
|
return (c, p) => {
|
|
5482
|
-
const
|
|
5483
|
-
s(
|
|
5499
|
+
const S = r.channel(c.channelName);
|
|
5500
|
+
s(S, a).authorize(c.socketId, p);
|
|
5484
5501
|
};
|
|
5485
5502
|
};
|
|
5486
5503
|
function qr(r, t) {
|
|
@@ -5515,7 +5532,7 @@ function Yo() {
|
|
|
5515
5532
|
return `ws-${r}.pusher.com`;
|
|
5516
5533
|
}
|
|
5517
5534
|
function Hr(r) {
|
|
5518
|
-
return
|
|
5535
|
+
return z.getProtocol() === "https:" ? !0 : r.forceTLS !== !1;
|
|
5519
5536
|
}
|
|
5520
5537
|
function Br(r) {
|
|
5521
5538
|
return "enableStats" in r ? r.enableStats : "disableStats" in r ? !r.disableStats : !1;
|
|
@@ -5538,7 +5555,7 @@ function Yo() {
|
|
|
5538
5555
|
class Gr extends be {
|
|
5539
5556
|
constructor(t) {
|
|
5540
5557
|
super(function(s, a) {
|
|
5541
|
-
|
|
5558
|
+
ne.debug(`No callbacks on watchlist events for ${s}`);
|
|
5542
5559
|
}), this.pusher = t, this.bindWatchlistInternalEvent();
|
|
5543
5560
|
}
|
|
5544
5561
|
handleEvent(t) {
|
|
@@ -5563,10 +5580,10 @@ function Yo() {
|
|
|
5563
5580
|
class Yr extends be {
|
|
5564
5581
|
constructor(t) {
|
|
5565
5582
|
super(function(s, a) {
|
|
5566
|
-
|
|
5583
|
+
ne.debug("No callbacks on user for " + s);
|
|
5567
5584
|
}), this.signin_requested = !1, this.user_data = null, this.serverToUserChannel = null, this.signinDonePromise = null, this._signinDoneResolve = null, this._onAuthorize = (s, a) => {
|
|
5568
5585
|
if (s) {
|
|
5569
|
-
|
|
5586
|
+
ne.warn(`Error during signin: ${s}`), this._cleanup();
|
|
5570
5587
|
return;
|
|
5571
5588
|
}
|
|
5572
5589
|
this.pusher.send_event("pusher:signin", {
|
|
@@ -5592,11 +5609,11 @@ function Yo() {
|
|
|
5592
5609
|
try {
|
|
5593
5610
|
this.user_data = JSON.parse(t.user_data);
|
|
5594
5611
|
} catch {
|
|
5595
|
-
|
|
5612
|
+
ne.error(`Failed parsing user data after signin: ${t.user_data}`), this._cleanup();
|
|
5596
5613
|
return;
|
|
5597
5614
|
}
|
|
5598
5615
|
if (typeof this.user_data.id != "string" || this.user_data.id === "") {
|
|
5599
|
-
|
|
5616
|
+
ne.error(`user_data doesn't contain an id. user_data: ${this.user_data}`), this._cleanup();
|
|
5600
5617
|
return;
|
|
5601
5618
|
}
|
|
5602
5619
|
this._signinDoneResolve(), this._subscribeChannels();
|
|
@@ -5630,12 +5647,12 @@ function Yo() {
|
|
|
5630
5647
|
ue.instances[t].connect();
|
|
5631
5648
|
}
|
|
5632
5649
|
static getClientFeatures() {
|
|
5633
|
-
return $e(xe({ ws:
|
|
5650
|
+
return $e(xe({ ws: z.Transports.ws }, function(t) {
|
|
5634
5651
|
return t.isSupported({});
|
|
5635
5652
|
}));
|
|
5636
5653
|
}
|
|
5637
5654
|
constructor(t, s) {
|
|
5638
|
-
Qr(t), Lr(s), this.key = t, this.config = qr(s, this), this.channels = ye.createChannels(), this.global_emitter = new be(), this.sessionID =
|
|
5655
|
+
Qr(t), Lr(s), this.key = t, this.config = qr(s, this), this.channels = ye.createChannels(), this.global_emitter = new be(), this.sessionID = z.randomInt(1e9), this.timeline = new Pr(this.key, this.sessionID, {
|
|
5639
5656
|
cluster: this.config.cluster,
|
|
5640
5657
|
features: ue.getClientFeatures(),
|
|
5641
5658
|
params: this.config.timelineParams || {},
|
|
@@ -5644,9 +5661,9 @@ function Yo() {
|
|
|
5644
5661
|
version: d.VERSION
|
|
5645
5662
|
}), this.config.enableStats && (this.timelineSender = ye.createTimelineSender(this.timeline, {
|
|
5646
5663
|
host: this.config.statsHost,
|
|
5647
|
-
path: "/timeline/v2/" +
|
|
5664
|
+
path: "/timeline/v2/" + z.TimelineTransport.name
|
|
5648
5665
|
}));
|
|
5649
|
-
var a = (c) =>
|
|
5666
|
+
var a = (c) => z.getDefaultStrategy(this.config, c, kr);
|
|
5650
5667
|
this.connection = ye.createConnectionManager(this.key, {
|
|
5651
5668
|
getStrategy: a,
|
|
5652
5669
|
timeline: this.timeline,
|
|
@@ -5657,18 +5674,18 @@ function Yo() {
|
|
|
5657
5674
|
}), this.connection.bind("connected", () => {
|
|
5658
5675
|
this.subscribeAll(), this.timelineSender && this.timelineSender.send(this.connection.isUsingTLS());
|
|
5659
5676
|
}), this.connection.bind("message", (c) => {
|
|
5660
|
-
var p = c.event,
|
|
5677
|
+
var p = c.event, S = p.indexOf("pusher_internal:") === 0;
|
|
5661
5678
|
if (c.channel) {
|
|
5662
|
-
var
|
|
5663
|
-
|
|
5679
|
+
var k = this.channel(c.channel);
|
|
5680
|
+
k && k.handleEvent(c);
|
|
5664
5681
|
}
|
|
5665
|
-
|
|
5682
|
+
S || this.global_emitter.emit(c.event, c.data);
|
|
5666
5683
|
}), this.connection.bind("connecting", () => {
|
|
5667
5684
|
this.channels.disconnect();
|
|
5668
5685
|
}), this.connection.bind("disconnected", () => {
|
|
5669
5686
|
this.channels.disconnect();
|
|
5670
5687
|
}), this.connection.bind("error", (c) => {
|
|
5671
|
-
|
|
5688
|
+
ne.warn(c);
|
|
5672
5689
|
}), ue.instances.push(this), this.timeline.info({ instances: ue.instances.length }), this.user = new Yr(this), ue.isReady && this.connect();
|
|
5673
5690
|
}
|
|
5674
5691
|
channel(t) {
|
|
@@ -5680,7 +5697,7 @@ function Yo() {
|
|
|
5680
5697
|
connect() {
|
|
5681
5698
|
if (this.connection.connect(), this.timelineSender && !this.timelineSenderTimer) {
|
|
5682
5699
|
var t = this.connection.isUsingTLS(), s = this.timelineSender;
|
|
5683
|
-
this.timelineSenderTimer = new
|
|
5700
|
+
this.timelineSenderTimer = new M(6e4, function() {
|
|
5684
5701
|
s.send(t);
|
|
5685
5702
|
});
|
|
5686
5703
|
}
|
|
@@ -5726,13 +5743,13 @@ function Yo() {
|
|
|
5726
5743
|
this.user.signin();
|
|
5727
5744
|
}
|
|
5728
5745
|
}
|
|
5729
|
-
ue.instances = [], ue.isReady = !1, ue.logToConsole = !1, ue.Runtime =
|
|
5746
|
+
ue.instances = [], ue.isReady = !1, ue.logToConsole = !1, ue.Runtime = z, ue.ScriptReceivers = z.ScriptReceivers, ue.DependenciesReceivers = z.DependenciesReceivers, ue.auth_callbacks = z.auth_callbacks;
|
|
5730
5747
|
var vt = o.default = ue;
|
|
5731
5748
|
function Qr(r) {
|
|
5732
5749
|
if (r == null)
|
|
5733
5750
|
throw "You must pass your app key when you instantiate Pusher.";
|
|
5734
5751
|
}
|
|
5735
|
-
|
|
5752
|
+
z.setup(ue);
|
|
5736
5753
|
})
|
|
5737
5754
|
/******/
|
|
5738
5755
|
])
|
|
@@ -5740,9 +5757,9 @@ function Yo() {
|
|
|
5740
5757
|
});
|
|
5741
5758
|
})(Et)), Et.exports;
|
|
5742
5759
|
}
|
|
5743
|
-
var
|
|
5744
|
-
const
|
|
5745
|
-
function
|
|
5760
|
+
var Zo = Qo();
|
|
5761
|
+
const ea = /* @__PURE__ */ Yo(Zo), ta = "/v1/messenger/bootstrap", na = 3e4, sa = 3e4, ra = 5 * 6e4;
|
|
5762
|
+
function te(e) {
|
|
5746
5763
|
return typeof e == "object" && e !== null;
|
|
5747
5764
|
}
|
|
5748
5765
|
function ae(e, n) {
|
|
@@ -5763,7 +5780,7 @@ function Ne(e, n) {
|
|
|
5763
5780
|
const o = i.trim();
|
|
5764
5781
|
return o === "" ? null : o;
|
|
5765
5782
|
}
|
|
5766
|
-
function
|
|
5783
|
+
function ia(e, n) {
|
|
5767
5784
|
const i = e[n];
|
|
5768
5785
|
if (typeof i == "number" && Number.isFinite(i))
|
|
5769
5786
|
return i;
|
|
@@ -5774,52 +5791,53 @@ function ra(e, n) {
|
|
|
5774
5791
|
}
|
|
5775
5792
|
throw new Error(`Invalid messenger bootstrap payload: missing integer ${n}`);
|
|
5776
5793
|
}
|
|
5777
|
-
function
|
|
5794
|
+
function oa(e) {
|
|
5778
5795
|
return e.toLowerCase() === "http" ? "http" : "https";
|
|
5779
5796
|
}
|
|
5780
|
-
function
|
|
5797
|
+
function aa(e) {
|
|
5781
5798
|
if (e !== null)
|
|
5782
5799
|
return e.startsWith("/") ? e : `/${e}`;
|
|
5783
5800
|
}
|
|
5784
|
-
function
|
|
5785
|
-
|
|
5801
|
+
function ca(e) {
|
|
5802
|
+
const n = te(e) && te(e.data) ? e.data : e;
|
|
5803
|
+
if (!te(n))
|
|
5786
5804
|
throw new Error("Invalid messenger bootstrap payload: expected object");
|
|
5787
|
-
const
|
|
5788
|
-
if (!
|
|
5805
|
+
const i = n.auth, o = n.service;
|
|
5806
|
+
if (!te(i) || !te(o))
|
|
5789
5807
|
throw new Error("Invalid messenger bootstrap payload: missing auth or service data");
|
|
5790
|
-
const
|
|
5791
|
-
if (!
|
|
5808
|
+
const u = i.user, l = o.reverb;
|
|
5809
|
+
if (!te(u) || !te(l))
|
|
5792
5810
|
throw new Error("Invalid messenger bootstrap payload: missing user or reverb data");
|
|
5793
|
-
const
|
|
5811
|
+
const h = aa(Ne(l, "path"));
|
|
5794
5812
|
return {
|
|
5795
5813
|
auth: {
|
|
5796
|
-
token: ge(
|
|
5797
|
-
tokenType: ge(
|
|
5798
|
-
expiresAt: Ne(
|
|
5799
|
-
tenantId: Ne(
|
|
5814
|
+
token: ge(i, "token"),
|
|
5815
|
+
tokenType: ge(i, "token_type"),
|
|
5816
|
+
expiresAt: Ne(i, "expires_at"),
|
|
5817
|
+
tenantId: Ne(i, "tenant_id"),
|
|
5800
5818
|
user: {
|
|
5801
|
-
id: ge(
|
|
5802
|
-
handle: ge(
|
|
5803
|
-
name: ge(
|
|
5804
|
-
avatarUrl: Ne(
|
|
5805
|
-
email: Ne(
|
|
5819
|
+
id: ge(u, "id"),
|
|
5820
|
+
handle: ge(u, "handle"),
|
|
5821
|
+
name: ge(u, "name"),
|
|
5822
|
+
avatarUrl: Ne(u, "avatar_url"),
|
|
5823
|
+
email: Ne(u, "email")
|
|
5806
5824
|
}
|
|
5807
5825
|
},
|
|
5808
5826
|
service: {
|
|
5809
|
-
baseUrl: ge(
|
|
5810
|
-
apiBaseUrl: ge(
|
|
5811
|
-
broadcastingAuthUrl: ge(
|
|
5827
|
+
baseUrl: ge(o, "base_url"),
|
|
5828
|
+
apiBaseUrl: ge(o, "api_base_url"),
|
|
5829
|
+
broadcastingAuthUrl: ge(o, "broadcasting_auth_url"),
|
|
5812
5830
|
reverb: {
|
|
5813
|
-
appKey: ge(
|
|
5814
|
-
host: ge(
|
|
5815
|
-
port:
|
|
5816
|
-
scheme:
|
|
5817
|
-
...
|
|
5831
|
+
appKey: ge(l, "app_key"),
|
|
5832
|
+
host: ge(l, "host"),
|
|
5833
|
+
port: ia(l, "port"),
|
|
5834
|
+
scheme: oa(ge(l, "scheme")),
|
|
5835
|
+
...h ? { path: h } : {}
|
|
5818
5836
|
}
|
|
5819
5837
|
}
|
|
5820
5838
|
};
|
|
5821
5839
|
}
|
|
5822
|
-
function
|
|
5840
|
+
function ua(e) {
|
|
5823
5841
|
return e.replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/:\d+$/, "");
|
|
5824
5842
|
}
|
|
5825
5843
|
function In(e, n) {
|
|
@@ -5827,7 +5845,7 @@ function In(e, n) {
|
|
|
5827
5845
|
e.headers.set("Authorization", `Bearer ${n}`), e.headers.set("Accept", "application/json"), e.headers.set("X-Requested-With", "XMLHttpRequest"), typeof FormData < "u" && e.data instanceof FormData && (e.headers.delete("Content-Type"), e.headers.delete("content-type"));
|
|
5828
5846
|
return;
|
|
5829
5847
|
}
|
|
5830
|
-
const i =
|
|
5848
|
+
const i = te(e.headers) ? e.headers : {};
|
|
5831
5849
|
e.headers = new pn({
|
|
5832
5850
|
...i,
|
|
5833
5851
|
Authorization: `Bearer ${n}`,
|
|
@@ -5842,16 +5860,16 @@ function _e(e, n, i) {
|
|
|
5842
5860
|
const u = e[i];
|
|
5843
5861
|
return typeof u == "string" && u.trim() !== "" ? u : null;
|
|
5844
5862
|
}
|
|
5845
|
-
function
|
|
5863
|
+
function la(e) {
|
|
5846
5864
|
if (typeof e != "string")
|
|
5847
5865
|
return null;
|
|
5848
5866
|
const n = e.trim().toLowerCase();
|
|
5849
5867
|
return n === "online" || n === "idle" || n === "dnd" || n === "offline" ? n : null;
|
|
5850
5868
|
}
|
|
5851
|
-
function
|
|
5852
|
-
if (!
|
|
5869
|
+
function ha(e, n) {
|
|
5870
|
+
if (!te(e))
|
|
5853
5871
|
return null;
|
|
5854
|
-
const i = _e(e, "user_id", "userId"), o =
|
|
5872
|
+
const i = _e(e, "user_id", "userId"), o = la(e.status);
|
|
5855
5873
|
if (!i || !o)
|
|
5856
5874
|
return null;
|
|
5857
5875
|
const u = {
|
|
@@ -5864,13 +5882,13 @@ function la(e, n) {
|
|
|
5864
5882
|
const h = e.last_seen_at ?? e.lastSeenAt;
|
|
5865
5883
|
return typeof h == "string" ? u.last_seen_at = h : h === null && (u.last_seen_at = null), u;
|
|
5866
5884
|
}
|
|
5867
|
-
function
|
|
5868
|
-
if (!
|
|
5885
|
+
function da(e) {
|
|
5886
|
+
if (!te(e))
|
|
5869
5887
|
return null;
|
|
5870
5888
|
const n = _e(e, "user_id", "userId"), i = _e(e, "conversation_id", "conversationId");
|
|
5871
5889
|
if (!n || !i)
|
|
5872
5890
|
return null;
|
|
5873
|
-
const o = e.user, u =
|
|
5891
|
+
const o = e.user, u = te(o) ? {
|
|
5874
5892
|
id: typeof o.id == "string" && o.id !== "" ? o.id : n,
|
|
5875
5893
|
name: typeof o.name == "string" ? o.name : "",
|
|
5876
5894
|
...typeof o.avatar == "string" && o.avatar !== "" ? { avatar: o.avatar } : {}
|
|
@@ -5885,13 +5903,13 @@ function ha(e) {
|
|
|
5885
5903
|
...typeof e.stopped_at == "string" ? { stopped_at: e.stopped_at } : {}
|
|
5886
5904
|
};
|
|
5887
5905
|
}
|
|
5888
|
-
function
|
|
5889
|
-
if (!
|
|
5906
|
+
function fa(e) {
|
|
5907
|
+
if (!te(e))
|
|
5890
5908
|
return null;
|
|
5891
5909
|
const n = _e(e, "user_id", "userId"), i = _e(e, "conversation_id", "conversationId");
|
|
5892
5910
|
if (!n || !i)
|
|
5893
5911
|
return null;
|
|
5894
|
-
const o =
|
|
5912
|
+
const o = te(e.user) ? {
|
|
5895
5913
|
...typeof e.user.id == "string" && e.user.id !== "" ? { id: e.user.id } : {},
|
|
5896
5914
|
...typeof e.user.name == "string" ? { name: e.user.name } : {},
|
|
5897
5915
|
...typeof e.user.avatar == "string" && e.user.avatar !== "" ? { avatar: e.user.avatar } : {}
|
|
@@ -5904,8 +5922,8 @@ function da(e) {
|
|
|
5904
5922
|
...typeof e.ts == "string" ? { ts: e.ts } : {}
|
|
5905
5923
|
};
|
|
5906
5924
|
}
|
|
5907
|
-
function
|
|
5908
|
-
if (!
|
|
5925
|
+
function pa(e) {
|
|
5926
|
+
if (!te(e))
|
|
5909
5927
|
return null;
|
|
5910
5928
|
const n = _e(e, "user_id", "userId"), i = _e(e, "conversation_id", "conversationId");
|
|
5911
5929
|
return !n || !i ? null : {
|
|
@@ -5915,32 +5933,32 @@ function fa(e) {
|
|
|
5915
5933
|
...typeof e.ts == "string" ? { ts: e.ts } : {}
|
|
5916
5934
|
};
|
|
5917
5935
|
}
|
|
5918
|
-
function pa(e) {
|
|
5919
|
-
return ne(e) && ae(e, "id") && ae(e, "name");
|
|
5920
|
-
}
|
|
5921
5936
|
function ga(e) {
|
|
5922
|
-
return
|
|
5937
|
+
return te(e) && ae(e, "id") && ae(e, "name");
|
|
5923
5938
|
}
|
|
5924
5939
|
function ma(e) {
|
|
5925
|
-
return
|
|
5940
|
+
return !te(e) || !ae(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => ga(n));
|
|
5926
5941
|
}
|
|
5927
5942
|
function va(e) {
|
|
5928
|
-
return
|
|
5943
|
+
return te(e) && te(e.message) && ae(e.message, "id") && ae(e.message, "conversation_id") && ae(e.message, "author_id");
|
|
5929
5944
|
}
|
|
5930
5945
|
function ba(e) {
|
|
5931
|
-
return
|
|
5946
|
+
return te(e) && ae(e, "conversation_id") && ae(e, "user_id") && ae(e, "message_id");
|
|
5932
5947
|
}
|
|
5933
5948
|
function ya(e) {
|
|
5934
|
-
return
|
|
5949
|
+
return te(e) && ae(e, "conversation_id") && te(e.message) && ae(e.message, "id");
|
|
5935
5950
|
}
|
|
5936
5951
|
function _a(e) {
|
|
5937
|
-
return
|
|
5952
|
+
return te(e) && ae(e, "conversation_id") && ae(e, "message_id");
|
|
5938
5953
|
}
|
|
5939
5954
|
function Sa(e) {
|
|
5940
|
-
return
|
|
5955
|
+
return te(e) && ae(e, "conversation_id") && ae(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => ma(n));
|
|
5941
5956
|
}
|
|
5942
5957
|
function wa(e) {
|
|
5943
|
-
return
|
|
5958
|
+
return te(e) && ae(e, "conversation_id");
|
|
5959
|
+
}
|
|
5960
|
+
function Ca(e) {
|
|
5961
|
+
return te(e) && ae(e, "conversation_id") && ae(e, "removed_user_id");
|
|
5944
5962
|
}
|
|
5945
5963
|
function Re(e, n, i, o) {
|
|
5946
5964
|
const u = (l) => {
|
|
@@ -5948,104 +5966,104 @@ function Re(e, n, i, o) {
|
|
|
5948
5966
|
};
|
|
5949
5967
|
return e.listen(n, u), u;
|
|
5950
5968
|
}
|
|
5951
|
-
function
|
|
5952
|
-
const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ??
|
|
5953
|
-
typeof window < "u" && (window.Pusher =
|
|
5954
|
-
let h = null, g = null, d = null, A = null, x = "disconnected",
|
|
5955
|
-
const
|
|
5969
|
+
function za(e) {
|
|
5970
|
+
const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ?? ta, o = e.bootstrapRefreshSkewMs ?? na, u = e.presenceFreshnessTtlMs ?? ra, l = (e.createLogger ?? qt())("MessengerEcho");
|
|
5971
|
+
typeof window < "u" && (window.Pusher = ea);
|
|
5972
|
+
let h = null, g = null, d = null, A = null, x = "disconnected", v = null, w = null;
|
|
5973
|
+
const R = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Map(), _ = (T) => {
|
|
5956
5974
|
x = T;
|
|
5957
|
-
for (const
|
|
5958
|
-
|
|
5975
|
+
for (const M of R)
|
|
5976
|
+
M(T);
|
|
5959
5977
|
}, f = () => {
|
|
5960
|
-
|
|
5961
|
-
},
|
|
5962
|
-
d !== null && (d.disconnect(), d = null), A = null, T &&
|
|
5963
|
-
},
|
|
5964
|
-
f(), h = null, g = null,
|
|
5978
|
+
w !== null && (clearTimeout(w), w = null);
|
|
5979
|
+
}, b = (T = !0) => {
|
|
5980
|
+
d !== null && (d.disconnect(), d = null), A = null, T && _("disconnected");
|
|
5981
|
+
}, y = () => {
|
|
5982
|
+
f(), h = null, g = null, v = null, b(), E.clear();
|
|
5965
5983
|
}, F = () => {
|
|
5966
5984
|
if (!e.getSourceToken)
|
|
5967
5985
|
return null;
|
|
5968
5986
|
const T = e.getSourceToken();
|
|
5969
|
-
return T === null ? (
|
|
5970
|
-
},
|
|
5987
|
+
return T === null ? (y(), null) : (v !== null && v !== T && (f(), h = null, g = null, b()), v = T, T);
|
|
5988
|
+
}, H = (T) => {
|
|
5971
5989
|
if (T === null)
|
|
5972
5990
|
return !1;
|
|
5973
5991
|
if (T.auth.expiresAt === null)
|
|
5974
5992
|
return T.auth.token !== "";
|
|
5975
|
-
const
|
|
5976
|
-
return Number.isNaN(
|
|
5993
|
+
const M = Date.parse(T.auth.expiresAt);
|
|
5994
|
+
return Number.isNaN(M) ? !1 : M - Date.now() > o;
|
|
5977
5995
|
}, B = (T) => {
|
|
5978
5996
|
if (f(), T.auth.expiresAt === null)
|
|
5979
5997
|
return;
|
|
5980
|
-
const
|
|
5981
|
-
if (Number.isNaN(
|
|
5998
|
+
const M = Date.parse(T.auth.expiresAt);
|
|
5999
|
+
if (Number.isNaN(M))
|
|
5982
6000
|
return;
|
|
5983
|
-
const
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
},
|
|
5987
|
-
}, P = async (T = !1) => e.getSourceToken && F() === null ? null : !T &&
|
|
5988
|
-
const
|
|
6001
|
+
const Q = Math.max(0, M - Date.now() - o);
|
|
6002
|
+
w = setTimeout(() => {
|
|
6003
|
+
L();
|
|
6004
|
+
}, Q);
|
|
6005
|
+
}, P = async (T = !1) => e.getSourceToken && F() === null ? null : !T && H(h) ? h : !T && g !== null ? await g : (g = (async () => {
|
|
6006
|
+
const Q = await e.bootstrapClient.get(
|
|
5989
6007
|
i,
|
|
5990
6008
|
T ? { params: { refresh: 1 } } : void 0
|
|
5991
|
-
), N =
|
|
6009
|
+
), N = ca(Q.data);
|
|
5992
6010
|
return h = N, B(N), N;
|
|
5993
6011
|
})().finally(() => {
|
|
5994
6012
|
g = null;
|
|
5995
|
-
}), await g),
|
|
6013
|
+
}), await g), L = async () => {
|
|
5996
6014
|
const T = d !== null;
|
|
5997
6015
|
try {
|
|
5998
6016
|
if (await P(!0), !T)
|
|
5999
6017
|
return;
|
|
6000
|
-
|
|
6001
|
-
} catch (
|
|
6002
|
-
l.warn("Failed to refresh messenger bootstrap",
|
|
6018
|
+
b(!1), await O(!0);
|
|
6019
|
+
} catch (M) {
|
|
6020
|
+
l.warn("Failed to refresh messenger bootstrap", M);
|
|
6003
6021
|
}
|
|
6004
|
-
},
|
|
6005
|
-
const
|
|
6006
|
-
if (!
|
|
6022
|
+
}, V = (T) => {
|
|
6023
|
+
const M = T.connector?.pusher?.connection;
|
|
6024
|
+
if (!M) {
|
|
6007
6025
|
l.warn("Messenger echo connector does not expose a Pusher connection");
|
|
6008
6026
|
return;
|
|
6009
6027
|
}
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
}),
|
|
6013
|
-
|
|
6014
|
-
}),
|
|
6015
|
-
|
|
6016
|
-
}),
|
|
6017
|
-
|
|
6018
|
-
}),
|
|
6019
|
-
|
|
6020
|
-
}),
|
|
6021
|
-
},
|
|
6022
|
-
const
|
|
6023
|
-
if (
|
|
6028
|
+
M.bind("connecting", () => {
|
|
6029
|
+
_("connecting");
|
|
6030
|
+
}), M.bind("connected", () => {
|
|
6031
|
+
_("connected");
|
|
6032
|
+
}), M.bind("disconnected", () => {
|
|
6033
|
+
_("disconnected");
|
|
6034
|
+
}), M.bind("unavailable", () => {
|
|
6035
|
+
_("disconnected");
|
|
6036
|
+
}), M.bind("error", () => {
|
|
6037
|
+
_("error");
|
|
6038
|
+
}), M.state === "connected" && _("connected");
|
|
6039
|
+
}, O = async (T = !1) => !T && d !== null && H(h) ? d : !T && A !== null ? await A : (A = (async () => {
|
|
6040
|
+
const Q = await P(T);
|
|
6041
|
+
if (Q === null)
|
|
6024
6042
|
return null;
|
|
6025
|
-
d !== null &&
|
|
6026
|
-
const N =
|
|
6043
|
+
d !== null && b(!1);
|
|
6044
|
+
const N = Q.service.reverb.scheme === "https", X = {
|
|
6027
6045
|
broadcaster: "reverb",
|
|
6028
|
-
key:
|
|
6029
|
-
wsHost:
|
|
6030
|
-
wsPort:
|
|
6031
|
-
wssPort:
|
|
6046
|
+
key: Q.service.reverb.appKey,
|
|
6047
|
+
wsHost: ua(Q.service.reverb.host),
|
|
6048
|
+
wsPort: Q.service.reverb.port,
|
|
6049
|
+
wssPort: Q.service.reverb.port,
|
|
6032
6050
|
forceTLS: N,
|
|
6033
6051
|
encrypted: N,
|
|
6034
6052
|
disableStats: !0,
|
|
6035
6053
|
enabledTransports: ["ws", "wss"],
|
|
6036
|
-
authEndpoint:
|
|
6054
|
+
authEndpoint: Q.service.broadcastingAuthUrl,
|
|
6037
6055
|
auth: {
|
|
6038
6056
|
headers: {
|
|
6039
|
-
Authorization: `Bearer ${
|
|
6057
|
+
Authorization: `Bearer ${Q.auth.token}`,
|
|
6040
6058
|
Accept: "application/json"
|
|
6041
6059
|
}
|
|
6042
6060
|
}
|
|
6043
6061
|
};
|
|
6044
|
-
return
|
|
6062
|
+
return Q.service.reverb.path && (X.wsPath = Q.service.reverb.path), d = new Ko(X), V(d), _("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), d;
|
|
6045
6063
|
})().finally(() => {
|
|
6046
6064
|
A = null;
|
|
6047
|
-
}), await A), K =
|
|
6048
|
-
timeout: e.requestTimeoutMs ??
|
|
6065
|
+
}), await A), K = kt.create({
|
|
6066
|
+
timeout: e.requestTimeoutMs ?? sa,
|
|
6049
6067
|
withCredentials: !1,
|
|
6050
6068
|
headers: {
|
|
6051
6069
|
Accept: "application/json",
|
|
@@ -6053,57 +6071,57 @@ function qa(e) {
|
|
|
6053
6071
|
}
|
|
6054
6072
|
});
|
|
6055
6073
|
K.interceptors.request.use(async (T) => {
|
|
6056
|
-
const
|
|
6057
|
-
if (
|
|
6074
|
+
const M = await P();
|
|
6075
|
+
if (M === null)
|
|
6058
6076
|
throw new Error("Messenger bootstrap is unavailable.");
|
|
6059
|
-
return T.baseURL =
|
|
6077
|
+
return T.baseURL = M.service.apiBaseUrl, In(T, M.auth.token), T;
|
|
6060
6078
|
}), K.interceptors.response.use(
|
|
6061
6079
|
(T) => T,
|
|
6062
6080
|
async (T) => {
|
|
6063
|
-
const
|
|
6064
|
-
if (T.response?.status === 401 &&
|
|
6065
|
-
|
|
6066
|
-
const
|
|
6067
|
-
if (
|
|
6068
|
-
return
|
|
6081
|
+
const M = T.config;
|
|
6082
|
+
if (T.response?.status === 401 && M && M._messengerRetry !== !0) {
|
|
6083
|
+
M._messengerRetry = !0;
|
|
6084
|
+
const Q = await P(!0);
|
|
6085
|
+
if (Q !== null)
|
|
6086
|
+
return M.baseURL = Q.service.apiBaseUrl, In(M, Q.auth.token), await K(M);
|
|
6069
6087
|
}
|
|
6070
6088
|
return Promise.reject(T);
|
|
6071
6089
|
}
|
|
6072
6090
|
);
|
|
6073
|
-
const
|
|
6091
|
+
const ie = () => (O().catch((T) => {
|
|
6074
6092
|
l.warn("Failed to initialize messenger echo", T);
|
|
6075
|
-
}), d),
|
|
6076
|
-
|
|
6077
|
-
}),
|
|
6078
|
-
const
|
|
6079
|
-
if (
|
|
6093
|
+
}), d), $ = (T) => (R.add(T), T(x), () => {
|
|
6094
|
+
R.delete(T);
|
|
6095
|
+
}), m = () => h?.auth.tenantId ?? "global", j = (T) => {
|
|
6096
|
+
const M = xt(T.ts)?.getTime() ?? xt(T.last_seen_at)?.getTime() ?? null;
|
|
6097
|
+
if (M === null)
|
|
6080
6098
|
return !0;
|
|
6081
|
-
const
|
|
6082
|
-
if (N &&
|
|
6099
|
+
const Q = `${T.tenant_scope ?? "global"}:${T.user_id}`, N = E.get(Q);
|
|
6100
|
+
if (N && M < N.timestampMs)
|
|
6083
6101
|
return !1;
|
|
6084
|
-
const
|
|
6085
|
-
|
|
6086
|
-
timestampMs:
|
|
6087
|
-
seenAt:
|
|
6102
|
+
const X = Date.now();
|
|
6103
|
+
E.set(Q, {
|
|
6104
|
+
timestampMs: M,
|
|
6105
|
+
seenAt: X
|
|
6088
6106
|
});
|
|
6089
|
-
for (const [me, ve] of
|
|
6090
|
-
|
|
6107
|
+
for (const [me, ve] of E.entries())
|
|
6108
|
+
X - ve.seenAt > u && E.delete(me);
|
|
6091
6109
|
return !0;
|
|
6092
6110
|
};
|
|
6093
6111
|
return {
|
|
6094
6112
|
apiClient: K,
|
|
6095
6113
|
initializedEvent: n,
|
|
6096
|
-
getEcho:
|
|
6114
|
+
getEcho: ie,
|
|
6097
6115
|
getConnectionStatus: () => x,
|
|
6098
|
-
onConnectionStatusChange:
|
|
6116
|
+
onConnectionStatusChange: $,
|
|
6099
6117
|
reconnect: async () => {
|
|
6100
|
-
|
|
6118
|
+
b(), await O(!0);
|
|
6101
6119
|
},
|
|
6102
6120
|
subscribeToPresenceStatus: (T) => {
|
|
6103
|
-
const
|
|
6104
|
-
if (!
|
|
6121
|
+
const M = ie();
|
|
6122
|
+
if (!M || typeof M.join != "function")
|
|
6105
6123
|
return;
|
|
6106
|
-
const
|
|
6124
|
+
const Q = M.join(`online-users.${m()}`), N = [
|
|
6107
6125
|
".PresenceStatusChanged",
|
|
6108
6126
|
"PresenceStatusChanged",
|
|
6109
6127
|
".presence.status.changed",
|
|
@@ -6113,57 +6131,57 @@ function qa(e) {
|
|
|
6113
6131
|
".Modules\\Presence\\Events\\UserPresenceStatusChanged",
|
|
6114
6132
|
"Modules\\Presence\\Events\\UserPresenceStatusChanged"
|
|
6115
6133
|
];
|
|
6116
|
-
for (const
|
|
6117
|
-
|
|
6118
|
-
const ve =
|
|
6119
|
-
!ve || !
|
|
6134
|
+
for (const X of N)
|
|
6135
|
+
Q.listen(X, (me) => {
|
|
6136
|
+
const ve = ha(me, m());
|
|
6137
|
+
!ve || !j(ve) || T(ve);
|
|
6120
6138
|
});
|
|
6121
6139
|
},
|
|
6122
6140
|
unsubscribeFromPresenceStatus: () => {
|
|
6123
|
-
d?.leave(`online-users.${
|
|
6141
|
+
d?.leave(`online-users.${m()}`);
|
|
6124
6142
|
},
|
|
6125
|
-
subscribeToConversation: (T,
|
|
6126
|
-
const
|
|
6127
|
-
if (!
|
|
6143
|
+
subscribeToConversation: (T, M) => {
|
|
6144
|
+
const Q = ie();
|
|
6145
|
+
if (!Q)
|
|
6128
6146
|
return () => {
|
|
6129
6147
|
};
|
|
6130
|
-
const N =
|
|
6131
|
-
return
|
|
6148
|
+
const N = Q.private(`conversation.${T}`), X = [];
|
|
6149
|
+
return M.onMessageSent && X.push({
|
|
6132
6150
|
event: ".ConversationMessageSent",
|
|
6133
|
-
handler: Re(N, ".ConversationMessageSent",
|
|
6134
|
-
}),
|
|
6151
|
+
handler: Re(N, ".ConversationMessageSent", va, M.onMessageSent)
|
|
6152
|
+
}), M.onMessageRead && X.push({
|
|
6135
6153
|
event: ".ConversationMessageRead",
|
|
6136
|
-
handler: Re(N, ".ConversationMessageRead",
|
|
6137
|
-
}),
|
|
6154
|
+
handler: Re(N, ".ConversationMessageRead", ba, M.onMessageRead)
|
|
6155
|
+
}), M.onMessageEdited && X.push({
|
|
6138
6156
|
event: ".ConversationMessageEdited",
|
|
6139
|
-
handler: Re(N, ".ConversationMessageEdited",
|
|
6140
|
-
}),
|
|
6157
|
+
handler: Re(N, ".ConversationMessageEdited", ya, M.onMessageEdited)
|
|
6158
|
+
}), M.onMessageDeleted && X.push({
|
|
6141
6159
|
event: ".ConversationMessageDeleted",
|
|
6142
|
-
handler: Re(N, ".ConversationMessageDeleted",
|
|
6143
|
-
}),
|
|
6160
|
+
handler: Re(N, ".ConversationMessageDeleted", _a, M.onMessageDeleted)
|
|
6161
|
+
}), M.onReactionToggled && X.push({
|
|
6144
6162
|
event: ".MessageReactionToggled",
|
|
6145
|
-
handler: Re(N, ".MessageReactionToggled",
|
|
6146
|
-
}),
|
|
6163
|
+
handler: Re(N, ".MessageReactionToggled", Sa, M.onReactionToggled)
|
|
6164
|
+
}), M.onRequestAccepted && X.push({
|
|
6147
6165
|
event: ".ConversationRequestAccepted",
|
|
6148
|
-
handler: Re(N, ".ConversationRequestAccepted",
|
|
6149
|
-
}),
|
|
6166
|
+
handler: Re(N, ".ConversationRequestAccepted", wa, M.onRequestAccepted)
|
|
6167
|
+
}), M.onParticipantRemoved && X.push({
|
|
6150
6168
|
event: ".ConversationParticipantRemoved",
|
|
6151
|
-
handler: Re(N, ".ConversationParticipantRemoved",
|
|
6169
|
+
handler: Re(N, ".ConversationParticipantRemoved", Ca, M.onParticipantRemoved)
|
|
6152
6170
|
}), () => {
|
|
6153
6171
|
if (typeof N.stopListening == "function")
|
|
6154
|
-
for (const me of
|
|
6172
|
+
for (const me of X)
|
|
6155
6173
|
N.stopListening(me.event, me.handler);
|
|
6156
6174
|
};
|
|
6157
6175
|
},
|
|
6158
6176
|
unsubscribeFromConversation: (T) => {
|
|
6159
6177
|
d?.leave(`conversation.${T}`);
|
|
6160
6178
|
},
|
|
6161
|
-
subscribeToTyping: (T,
|
|
6162
|
-
const
|
|
6163
|
-
if (!
|
|
6179
|
+
subscribeToTyping: (T, M) => {
|
|
6180
|
+
const Q = ie();
|
|
6181
|
+
if (!Q)
|
|
6164
6182
|
return () => {
|
|
6165
6183
|
};
|
|
6166
|
-
const N =
|
|
6184
|
+
const N = Q.private(`typing-conversation.${T}`), X = [], me = [
|
|
6167
6185
|
".TypingStateChanged",
|
|
6168
6186
|
"TypingStateChanged",
|
|
6169
6187
|
".typing.changed",
|
|
@@ -6175,95 +6193,95 @@ function qa(e) {
|
|
|
6175
6193
|
], ve = [".typing.start", "typing.start", ".TypingStarted", "TypingStarted", ".TypingStart", "TypingStart"], fe = [".typing.stop", "typing.stop", ".TypingStopped", "TypingStopped", ".TypingStop", "TypingStop"], $e = /* @__PURE__ */ new Set(["start", "typing"]), ot = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]);
|
|
6176
6194
|
for (const ce of me) {
|
|
6177
6195
|
const pe = (we) => {
|
|
6178
|
-
const
|
|
6179
|
-
if (
|
|
6180
|
-
if ($e.has(
|
|
6181
|
-
|
|
6182
|
-
user_id:
|
|
6183
|
-
user:
|
|
6184
|
-
id:
|
|
6196
|
+
const G = da(we);
|
|
6197
|
+
if (G) {
|
|
6198
|
+
if ($e.has(G.state)) {
|
|
6199
|
+
M.onTypingStart?.({
|
|
6200
|
+
user_id: G.user_id,
|
|
6201
|
+
user: G.user ?? {
|
|
6202
|
+
id: G.user_id,
|
|
6185
6203
|
name: ""
|
|
6186
6204
|
},
|
|
6187
|
-
conversation_id:
|
|
6188
|
-
started_at:
|
|
6205
|
+
conversation_id: G.conversation_id,
|
|
6206
|
+
started_at: G.started_at ?? G.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6189
6207
|
});
|
|
6190
6208
|
return;
|
|
6191
6209
|
}
|
|
6192
|
-
ot.has(
|
|
6193
|
-
user_id:
|
|
6194
|
-
conversation_id:
|
|
6195
|
-
stopped_at:
|
|
6210
|
+
ot.has(G.state) && M.onTypingStop?.({
|
|
6211
|
+
user_id: G.user_id,
|
|
6212
|
+
conversation_id: G.conversation_id,
|
|
6213
|
+
stopped_at: G.stopped_at ?? G.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6196
6214
|
});
|
|
6197
6215
|
}
|
|
6198
6216
|
};
|
|
6199
|
-
N.listen(ce, pe),
|
|
6217
|
+
N.listen(ce, pe), X.push({ event: ce, handler: pe });
|
|
6200
6218
|
}
|
|
6201
6219
|
for (const ce of ve) {
|
|
6202
6220
|
const pe = (we) => {
|
|
6203
|
-
const
|
|
6204
|
-
if (!
|
|
6221
|
+
const G = fa(we);
|
|
6222
|
+
if (!G)
|
|
6205
6223
|
return;
|
|
6206
6224
|
const xe = {
|
|
6207
|
-
user_id:
|
|
6225
|
+
user_id: G.user_id,
|
|
6208
6226
|
user: {
|
|
6209
|
-
id:
|
|
6210
|
-
name:
|
|
6211
|
-
...
|
|
6227
|
+
id: G.user?.id ?? G.user_id,
|
|
6228
|
+
name: G.user?.name ?? "",
|
|
6229
|
+
...G.user?.avatar ? { avatar: G.user.avatar } : {}
|
|
6212
6230
|
},
|
|
6213
|
-
conversation_id:
|
|
6214
|
-
started_at:
|
|
6231
|
+
conversation_id: G.conversation_id,
|
|
6232
|
+
started_at: G.started_at ?? G.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6215
6233
|
};
|
|
6216
|
-
|
|
6234
|
+
M.onTypingStart?.(xe);
|
|
6217
6235
|
};
|
|
6218
|
-
N.listen(ce, pe),
|
|
6236
|
+
N.listen(ce, pe), X.push({ event: ce, handler: pe });
|
|
6219
6237
|
}
|
|
6220
6238
|
for (const ce of fe) {
|
|
6221
6239
|
const pe = (we) => {
|
|
6222
|
-
const
|
|
6223
|
-
if (!
|
|
6240
|
+
const G = pa(we);
|
|
6241
|
+
if (!G)
|
|
6224
6242
|
return;
|
|
6225
6243
|
const xe = {
|
|
6226
|
-
user_id:
|
|
6227
|
-
conversation_id:
|
|
6228
|
-
stopped_at:
|
|
6244
|
+
user_id: G.user_id,
|
|
6245
|
+
conversation_id: G.conversation_id,
|
|
6246
|
+
stopped_at: G.stopped_at ?? G.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6229
6247
|
};
|
|
6230
|
-
|
|
6248
|
+
M.onTypingStop?.(xe);
|
|
6231
6249
|
};
|
|
6232
|
-
N.listen(ce, pe),
|
|
6250
|
+
N.listen(ce, pe), X.push({ event: ce, handler: pe });
|
|
6233
6251
|
}
|
|
6234
6252
|
return () => {
|
|
6235
6253
|
if (typeof N.stopListening == "function")
|
|
6236
|
-
for (const ce of
|
|
6254
|
+
for (const ce of X)
|
|
6237
6255
|
N.stopListening(ce.event, ce.handler);
|
|
6238
6256
|
};
|
|
6239
6257
|
},
|
|
6240
6258
|
unsubscribeFromTyping: (T) => {
|
|
6241
6259
|
d?.leave(`typing-conversation.${T}`);
|
|
6242
6260
|
},
|
|
6243
|
-
clearRuntime:
|
|
6261
|
+
clearRuntime: y
|
|
6244
6262
|
};
|
|
6245
6263
|
}
|
|
6246
6264
|
export {
|
|
6247
6265
|
ho as DEFAULT_PRESENCE_STALE_AFTER_MS,
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6266
|
+
Da as configureMessengerClient,
|
|
6267
|
+
za as createMessengerEcho,
|
|
6268
|
+
W as getApi,
|
|
6251
6269
|
Pe as getAuthStore,
|
|
6252
|
-
|
|
6270
|
+
Ma as getConnectionStatus,
|
|
6253
6271
|
Ae as getEcho,
|
|
6254
6272
|
Hn as getEchoConnectionStatus,
|
|
6255
6273
|
De as getEchoInitializedEvent,
|
|
6256
|
-
|
|
6257
|
-
|
|
6274
|
+
Z as getErrorMessage,
|
|
6275
|
+
qt as getLoggerFactory,
|
|
6258
6276
|
es as getMainApi,
|
|
6259
6277
|
Qi as getMainEcho,
|
|
6260
6278
|
Zi as getMainEchoConnectionStatus,
|
|
6261
6279
|
Yi as getMainEchoInitializedEvent,
|
|
6262
6280
|
Pi as getMediaApi,
|
|
6263
6281
|
Co as getPresenceRuntimeConfig,
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6282
|
+
Ia as hasResponse,
|
|
6283
|
+
Ha as isAxiosError,
|
|
6284
|
+
ka as isError,
|
|
6267
6285
|
wi as isValidMessageReadEvent,
|
|
6268
6286
|
Si as isValidMessageSentEvent,
|
|
6269
6287
|
Ci as isValidRequestAcceptedEvent,
|
|
@@ -6272,7 +6290,7 @@ export {
|
|
|
6272
6290
|
ts as normalizePresenceTimestamp,
|
|
6273
6291
|
it as onConnectionStatusChange,
|
|
6274
6292
|
eo as onMainEchoConnectionStatusChange,
|
|
6275
|
-
|
|
6293
|
+
xt as parsePresenceTimestamp,
|
|
6276
6294
|
di as reconnectEcho,
|
|
6277
6295
|
to as reconnectMainEcho,
|
|
6278
6296
|
_i as resetEchoRuntimeConfig,
|
|
@@ -6282,7 +6300,7 @@ export {
|
|
|
6282
6300
|
Ei as resetMessagingApiClient,
|
|
6283
6301
|
Ai as resetMessagingAuthStoreResolver,
|
|
6284
6302
|
Mi as resetMessagingMediaApi,
|
|
6285
|
-
|
|
6303
|
+
qa as resetMessengerClientConfig,
|
|
6286
6304
|
Eo as resetPresenceRuntimeConfig,
|
|
6287
6305
|
go as resolveFreshPresenceStatus,
|
|
6288
6306
|
xn as resolvePresenceSnapshot,
|
|
@@ -6300,10 +6318,10 @@ export {
|
|
|
6300
6318
|
mi as unsubscribeFromConversation,
|
|
6301
6319
|
pi as unsubscribeFromPresenceStatus,
|
|
6302
6320
|
bi as unsubscribeFromTyping,
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6321
|
+
Ua as useConnectionStatus,
|
|
6322
|
+
La as useConversationChannel,
|
|
6323
|
+
Oa as useGlobalMessaging,
|
|
6324
|
+
Ft as useMessagingStore,
|
|
6325
|
+
Na as usePresence,
|
|
6326
|
+
Fa as useTypingChannel
|
|
6309
6327
|
};
|