@codingfactory/messenger-client 0.2.15 → 0.2.16
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 +1060 -1029
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
import { ref as ve, getCurrentInstance as qt, computed as ie, watch as Ut, onUnmounted as De, toValue as
|
|
2
|
-
import { defineStore as
|
|
3
|
-
import jt, { isAxiosError as
|
|
4
|
-
import { isAxiosError as
|
|
5
|
-
import { useRoute as
|
|
6
|
-
const
|
|
7
|
-
},
|
|
8
|
-
},
|
|
9
|
-
}, Gn = () => {
|
|
1
|
+
import { ref as ve, getCurrentInstance as qt, computed as ie, watch as Ut, onUnmounted as De, toValue as Vn, onMounted as zt } from "vue";
|
|
2
|
+
import { defineStore as yi, storeToRefs as _i } from "pinia";
|
|
3
|
+
import jt, { isAxiosError as Si, AxiosHeaders as Cn } from "axios";
|
|
4
|
+
import { isAxiosError as ac } from "axios";
|
|
5
|
+
import { useRoute as Ci } from "vue-router";
|
|
6
|
+
const Xn = () => () => {
|
|
7
|
+
}, Wn = () => () => {
|
|
8
|
+
}, Gn = async () => {
|
|
10
9
|
}, Jn = () => {
|
|
11
10
|
}, Kn = () => {
|
|
12
11
|
}, Qn = () => {
|
|
13
12
|
}, Yn = () => {
|
|
14
|
-
throw new Error("messenger-client subscribeToConversation is not configured");
|
|
15
13
|
}, Zn = () => {
|
|
14
|
+
throw new Error("messenger-client subscribeToConversation is not configured");
|
|
15
|
+
}, es = () => {
|
|
16
16
|
throw new Error("messenger-client subscribeToTyping is not configured");
|
|
17
|
-
},
|
|
17
|
+
}, ts = async () => null, $ = {
|
|
18
18
|
ECHO_INITIALIZED_EVENT: "messenger-client:echo-initialized",
|
|
19
19
|
getEcho: () => null,
|
|
20
|
-
waitForEcho:
|
|
20
|
+
waitForEcho: ts,
|
|
21
21
|
getConnectionStatus: () => "disconnected",
|
|
22
22
|
getAccessState: () => "available",
|
|
23
|
-
onConnectionStatusChange:
|
|
24
|
-
onAccessStateChange:
|
|
25
|
-
reconnect:
|
|
26
|
-
subscribeToPresenceStatus:
|
|
27
|
-
unsubscribeFromPresenceStatus:
|
|
28
|
-
subscribeToConversation:
|
|
29
|
-
unsubscribeFromConversation:
|
|
30
|
-
subscribeToTyping:
|
|
31
|
-
unsubscribeFromTyping:
|
|
32
|
-
}, We = () => $.ECHO_INITIALIZED_EVENT, Pe = () => $.getEcho(),
|
|
23
|
+
onConnectionStatusChange: Xn,
|
|
24
|
+
onAccessStateChange: Wn,
|
|
25
|
+
reconnect: Gn,
|
|
26
|
+
subscribeToPresenceStatus: Jn,
|
|
27
|
+
unsubscribeFromPresenceStatus: Kn,
|
|
28
|
+
subscribeToConversation: Zn,
|
|
29
|
+
unsubscribeFromConversation: Qn,
|
|
30
|
+
subscribeToTyping: es,
|
|
31
|
+
unsubscribeFromTyping: Yn
|
|
32
|
+
}, We = () => $.ECHO_INITIALIZED_EVENT, Pe = () => $.getEcho(), wi = async () => $.waitForEcho(), ns = () => $.getConnectionStatus(), wn = () => ns(), Ot = () => $.getAccessState(), ht = (e) => $.onConnectionStatusChange(e), Ti = (e) => $.onAccessStateChange(e), Ei = async () => {
|
|
33
33
|
await $.reconnect();
|
|
34
|
-
},
|
|
35
|
-
function
|
|
34
|
+
}, Ai = (e) => $.subscribeToPresenceStatus(e), Ri = () => $.unsubscribeFromPresenceStatus(), Pi = (e, n) => $.subscribeToConversation(e, n), Mi = (e) => $.unsubscribeFromConversation(e), xi = (e, n) => $.subscribeToTyping(e, n), ki = (e) => $.unsubscribeFromTyping(e);
|
|
35
|
+
function Li(e) {
|
|
36
36
|
e.initializedEvent && ($.ECHO_INITIALIZED_EVENT = e.initializedEvent), e.getEcho && ($.getEcho = e.getEcho), e.waitForEcho && ($.waitForEcho = e.waitForEcho), e.getConnectionStatus && ($.getConnectionStatus = e.getConnectionStatus), e.getAccessState && ($.getAccessState = e.getAccessState), e.onConnectionStatusChange && ($.onConnectionStatusChange = e.onConnectionStatusChange), e.onAccessStateChange && ($.onAccessStateChange = e.onAccessStateChange), e.reconnect && ($.reconnect = e.reconnect), e.subscribeToPresenceStatus && ($.subscribeToPresenceStatus = e.subscribeToPresenceStatus), e.unsubscribeFromPresenceStatus && ($.unsubscribeFromPresenceStatus = e.unsubscribeFromPresenceStatus), e.subscribeToConversation && ($.subscribeToConversation = e.subscribeToConversation), e.unsubscribeFromConversation && ($.unsubscribeFromConversation = e.unsubscribeFromConversation), e.subscribeToTyping && ($.subscribeToTyping = e.subscribeToTyping), e.unsubscribeFromTyping && ($.unsubscribeFromTyping = e.unsubscribeFromTyping);
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
$.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", $.getEcho = () => null, $.waitForEcho =
|
|
38
|
+
function Ii() {
|
|
39
|
+
$.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", $.getEcho = () => null, $.waitForEcho = ts, $.getConnectionStatus = () => "disconnected", $.getAccessState = () => "available", $.onConnectionStatusChange = Xn, $.onAccessStateChange = Wn, $.reconnect = Gn, $.subscribeToPresenceStatus = Jn, $.unsubscribeFromPresenceStatus = Kn, $.subscribeToConversation = Zn, $.unsubscribeFromConversation = Qn, $.subscribeToTyping = es, $.unsubscribeFromTyping = Yn;
|
|
40
40
|
}
|
|
41
41
|
function Me(e) {
|
|
42
42
|
return typeof e == "object" && e !== null;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function Ui(e) {
|
|
45
45
|
return Me(e) && typeof e.conversation_id == "string" && Me(e.message) && typeof e.message.id == "string" && typeof e.message.conversation_id == "string" && typeof e.message.author_id == "string";
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Oi(e) {
|
|
48
48
|
return Me(e) && typeof e.conversation_id == "string" && typeof e.user_id == "string" && typeof e.message_id == "string";
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function Fi(e) {
|
|
51
51
|
return Me(e) && typeof e.conversation_id == "string" && Me(e.message) && typeof e.message.id == "string";
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function Ni(e) {
|
|
54
54
|
return Me(e) && typeof e.conversation_id == "string" && typeof e.message_id == "string";
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function Di(e) {
|
|
57
57
|
return Me(e) && typeof e.conversation_id == "string" && typeof e.message_id == "string" && Array.isArray(e.reactions);
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function qi(e) {
|
|
60
60
|
return Me(e) && typeof e.conversation_id == "string";
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
let $t =
|
|
62
|
+
const ss = jt;
|
|
63
|
+
let $t = ss;
|
|
64
64
|
function W() {
|
|
65
65
|
return $t;
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function zi(e) {
|
|
68
68
|
$t = e;
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
$t =
|
|
70
|
+
function ji() {
|
|
71
|
+
$t = ss;
|
|
72
72
|
}
|
|
73
|
-
const
|
|
73
|
+
const rs = {
|
|
74
74
|
currentUser: null
|
|
75
75
|
};
|
|
76
|
-
let Ht = () =>
|
|
76
|
+
let Ht = () => rs;
|
|
77
77
|
function Fe() {
|
|
78
78
|
return Ht;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function $i(e) {
|
|
81
81
|
Ht = e;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
Ht = () =>
|
|
83
|
+
function Hi() {
|
|
84
|
+
Ht = () => rs;
|
|
85
85
|
}
|
|
86
86
|
function Z(e) {
|
|
87
|
-
if (
|
|
87
|
+
if (Si(e)) {
|
|
88
88
|
const n = e.response?.data?.message || e.message || "An error occurred";
|
|
89
89
|
return n.includes("SQLSTATE") || n.includes("Connection:") || n.includes("\\Illuminate\\") ? "Something went wrong. Please try again later." : n;
|
|
90
90
|
}
|
|
91
91
|
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";
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function Ga(e) {
|
|
94
94
|
return e instanceof Error;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function Ja(e) {
|
|
97
97
|
return typeof e == "object" && e !== null && "response" in e && typeof e.response == "object";
|
|
98
98
|
}
|
|
99
|
-
const
|
|
99
|
+
const is = {
|
|
100
100
|
async uploadImage() {
|
|
101
101
|
throw new Error("messenger-client mediaApi.uploadImage is not configured");
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
-
let Bt =
|
|
105
|
-
function
|
|
104
|
+
let Bt = is;
|
|
105
|
+
function Bi() {
|
|
106
106
|
return Bt;
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function Vi(e) {
|
|
109
109
|
Bt = e;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
Bt =
|
|
111
|
+
function Xi() {
|
|
112
|
+
Bt = is;
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function Wi(e) {
|
|
115
115
|
return e !== null && typeof e == "object" && "id" in e && "type" in e && "participants" in e;
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function os(e) {
|
|
118
118
|
return typeof e == "object" && e !== null;
|
|
119
119
|
}
|
|
120
120
|
function $e(e) {
|
|
121
|
-
return !
|
|
121
|
+
return !os(e) || !("data" in e) ? e : e.data;
|
|
122
122
|
}
|
|
123
123
|
function st(e, n) {
|
|
124
124
|
const i = e[n];
|
|
@@ -146,7 +146,7 @@ function Rt(e, n) {
|
|
|
146
146
|
throw new Error(`Invalid messaging folder payload: missing numeric ${n}`);
|
|
147
147
|
}
|
|
148
148
|
function Ft(e) {
|
|
149
|
-
if (!
|
|
149
|
+
if (!os(e))
|
|
150
150
|
throw new Error("Invalid messaging folder payload: expected object");
|
|
151
151
|
return {
|
|
152
152
|
id: st(e, "id"),
|
|
@@ -160,20 +160,20 @@ function Ft(e) {
|
|
|
160
160
|
updated_at: st(e, "updated_at")
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function Gi(e) {
|
|
164
164
|
if (!Array.isArray(e))
|
|
165
165
|
throw new Error("Invalid messaging folder payload: expected array");
|
|
166
166
|
return e.map((n) => Ft(n));
|
|
167
167
|
}
|
|
168
168
|
function En(e) {
|
|
169
|
-
if (!
|
|
169
|
+
if (!Wi(e))
|
|
170
170
|
throw new Error("Invalid conversation payload from folder assignment endpoint");
|
|
171
171
|
return e;
|
|
172
172
|
}
|
|
173
173
|
const Re = {
|
|
174
174
|
async fetchFolders() {
|
|
175
175
|
const e = await W().get("/v1/messaging/folders");
|
|
176
|
-
return
|
|
176
|
+
return Gi($e(e.data));
|
|
177
177
|
},
|
|
178
178
|
async createFolder(e) {
|
|
179
179
|
const n = await W().post("/v1/messaging/folders", e);
|
|
@@ -202,7 +202,7 @@ const Re = {
|
|
|
202
202
|
async declineRequest(e) {
|
|
203
203
|
await W().post(`/v1/messaging/conversations/${e}/decline`);
|
|
204
204
|
}
|
|
205
|
-
}, An = 1e3, Vt = 4e3,
|
|
205
|
+
}, An = 1e3, Vt = 4e3, Ji = 12e4, Ki = 300, Qi = 1, Yi = 1600, Xt = (e) => {
|
|
206
206
|
if (typeof e == "number" && Number.isFinite(e))
|
|
207
207
|
return e;
|
|
208
208
|
if (typeof e == "string") {
|
|
@@ -210,10 +210,10 @@ const Re = {
|
|
|
210
210
|
if (Number.isFinite(n))
|
|
211
211
|
return n;
|
|
212
212
|
}
|
|
213
|
-
},
|
|
213
|
+
}, as = (e) => typeof e == "number" && e >= 500 && e < 600, Rn = (e) => {
|
|
214
214
|
const i = Xt(e.response?.status);
|
|
215
|
-
return i === void 0 ? !0 : i === 429 ||
|
|
216
|
-
},
|
|
215
|
+
return i === void 0 ? !0 : i === 429 || as(i);
|
|
216
|
+
}, cs = (e) => {
|
|
217
217
|
if (typeof e == "number" && Number.isFinite(e) && e > 0)
|
|
218
218
|
return Math.max(An, e * 1e3);
|
|
219
219
|
if (typeof e == "string") {
|
|
@@ -222,12 +222,12 @@ const Re = {
|
|
|
222
222
|
return Math.max(An, n * 1e3);
|
|
223
223
|
}
|
|
224
224
|
return Vt;
|
|
225
|
-
}, Yi = (e) => {
|
|
226
|
-
const n = Math.max(0, e), i = 2 ** Math.min(n, 6), o = Vt * i;
|
|
227
|
-
return Math.min(Gi, o);
|
|
228
225
|
}, Zi = (e) => {
|
|
226
|
+
const n = Math.max(0, e), i = 2 ** Math.min(n, 6), o = Vt * i;
|
|
227
|
+
return Math.min(Ji, o);
|
|
228
|
+
}, eo = (e) => {
|
|
229
229
|
const n = e;
|
|
230
|
-
return Xt(n.response?.status) === 429 ?
|
|
230
|
+
return Xt(n.response?.status) === 429 ? cs(n.response?.headers?.["retry-after"]) : Ki;
|
|
231
231
|
}, Pn = async (e) => {
|
|
232
232
|
await new Promise((n) => {
|
|
233
233
|
setTimeout(n, e);
|
|
@@ -235,7 +235,7 @@ const Re = {
|
|
|
235
235
|
}, Mn = () => ({
|
|
236
236
|
data: [],
|
|
237
237
|
has_more: !1
|
|
238
|
-
}), xn = () => Ot() === "account_suspended",
|
|
238
|
+
}), xn = () => Ot() === "account_suspended", to = (e) => {
|
|
239
239
|
if (!he(e))
|
|
240
240
|
return !1;
|
|
241
241
|
const i = (he(e.data) ? e.data : e).throttled;
|
|
@@ -249,27 +249,27 @@ const Re = {
|
|
|
249
249
|
}
|
|
250
250
|
return !1;
|
|
251
251
|
};
|
|
252
|
-
function
|
|
252
|
+
function no(e, n, i) {
|
|
253
253
|
const o = typeof e == "string" && e.trim().length > 0 ? e.trim().toLowerCase() : void 0;
|
|
254
254
|
if (o)
|
|
255
255
|
return o;
|
|
256
|
-
const
|
|
257
|
-
if (
|
|
258
|
-
return
|
|
259
|
-
const
|
|
260
|
-
return
|
|
256
|
+
const c = typeof n == "string" && n.trim().length > 0 ? n.trim().toLowerCase() : void 0;
|
|
257
|
+
if (c)
|
|
258
|
+
return c;
|
|
259
|
+
const l = typeof i == "string" && i.trim().length > 0 ? i.trim().toLowerCase() : void 0;
|
|
260
|
+
return l ? l === "image" ? "image/*" : l === "video" ? "video/*" : l === "audio" ? "audio/*" : l : "application/octet-stream";
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function so(e) {
|
|
263
263
|
const n = e.url || "", i = e.thumbnail_url ?? e.thumbnail, o = {
|
|
264
264
|
id: e.media_id ?? e.id ?? "",
|
|
265
|
-
name: e.name ??
|
|
265
|
+
name: e.name ?? ro(n),
|
|
266
266
|
url: n,
|
|
267
|
-
type:
|
|
267
|
+
type: no(e.mime, e.mime_type, e.type),
|
|
268
268
|
size: e.size ?? 0
|
|
269
269
|
};
|
|
270
270
|
return i !== void 0 && (o.thumbnail = i), o;
|
|
271
271
|
}
|
|
272
|
-
function
|
|
272
|
+
function ro(e) {
|
|
273
273
|
if (!e) return "attachment";
|
|
274
274
|
try {
|
|
275
275
|
const i = new URL(e).pathname.split("/");
|
|
@@ -278,8 +278,8 @@ function so(e) {
|
|
|
278
278
|
return "attachment";
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
function
|
|
282
|
-
return !Array.isArray(e) || e.length === 0 ? [] : e.map(
|
|
281
|
+
function io(e) {
|
|
282
|
+
return !Array.isArray(e) || e.length === 0 ? [] : e.map(so);
|
|
283
283
|
}
|
|
284
284
|
function ut(e) {
|
|
285
285
|
if (typeof e != "string")
|
|
@@ -288,7 +288,7 @@ function ut(e) {
|
|
|
288
288
|
if (n.length !== 0)
|
|
289
289
|
return n;
|
|
290
290
|
}
|
|
291
|
-
function
|
|
291
|
+
function oo(e) {
|
|
292
292
|
if (!e)
|
|
293
293
|
return;
|
|
294
294
|
const n = ut(e.avatar) ?? ut(e.avatar_url), i = typeof e.handle == "string" && e.handle.length > 0 ? e.handle : void 0;
|
|
@@ -315,24 +315,24 @@ function at(e) {
|
|
|
315
315
|
} : null;
|
|
316
316
|
return {
|
|
317
317
|
...e,
|
|
318
|
-
...i ? { author:
|
|
318
|
+
...i ? { author: oo(i) } : {},
|
|
319
319
|
shared_post: o,
|
|
320
|
-
attachments:
|
|
320
|
+
attachments: io(e.attachments)
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
|
-
function
|
|
323
|
+
function ao(e) {
|
|
324
324
|
if (!e || !he(e))
|
|
325
325
|
return;
|
|
326
326
|
const n = typeof e.id == "string" ? e.id.trim() : "", i = typeof e.title == "string" ? e.title.trim() : "", o = typeof e.url == "string" ? e.url.trim() : "";
|
|
327
327
|
if (n.length === 0 || i.length === 0 || o.length === 0)
|
|
328
328
|
return;
|
|
329
|
-
const
|
|
329
|
+
const c = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, l = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, d = he(e.author) ? e.author : null, g = d && typeof d.id == "string" ? d.id.trim() : "", h = d && typeof d.name == "string" ? d.name.trim() : "", x = d && typeof d.avatar == "string" && d.avatar.trim().length > 0 ? d.avatar.trim() : null, M = d && typeof d.handle == "string" && d.handle.trim().length > 0 ? d.handle.trim() : null;
|
|
330
330
|
return {
|
|
331
331
|
id: n,
|
|
332
332
|
title: i,
|
|
333
333
|
url: o,
|
|
334
|
-
...
|
|
335
|
-
...
|
|
334
|
+
...c ? { excerpt: c } : {},
|
|
335
|
+
...l ? { media_thumbnail: l } : {},
|
|
336
336
|
...g.length > 0 && h.length > 0 ? {
|
|
337
337
|
author: {
|
|
338
338
|
id: g,
|
|
@@ -343,7 +343,7 @@ function oo(e) {
|
|
|
343
343
|
} : {}
|
|
344
344
|
};
|
|
345
345
|
}
|
|
346
|
-
function
|
|
346
|
+
function co(e) {
|
|
347
347
|
return typeof e != "string" || e.length === 0 ? null : e;
|
|
348
348
|
}
|
|
349
349
|
function kn(e) {
|
|
@@ -353,45 +353,45 @@ function kn(e) {
|
|
|
353
353
|
function Nt(e) {
|
|
354
354
|
return typeof e == "string" && e.length > 0 && !e.startsWith("temp-");
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function uo(e, n = []) {
|
|
357
357
|
const i = /* @__PURE__ */ new Map();
|
|
358
358
|
for (const o of n) {
|
|
359
|
-
const
|
|
360
|
-
|
|
359
|
+
const c = kn(o.last_read_message_id);
|
|
360
|
+
c && i.set(o.user_id, c);
|
|
361
361
|
}
|
|
362
362
|
return e.map((o) => {
|
|
363
|
-
const
|
|
363
|
+
const c = Object.prototype.hasOwnProperty.call(o, "last_read_message_id"), l = ut(o.user?.avatar) ?? ut(o.user?.avatar_url), d = o.user ? {
|
|
364
364
|
id: o.user.id,
|
|
365
365
|
name: o.user.name,
|
|
366
|
-
...
|
|
366
|
+
...l ? { avatar: l } : {},
|
|
367
367
|
...o.user.handle ? { handle: o.user.handle } : {}
|
|
368
368
|
} : void 0, g = kn(o.last_read_message_id);
|
|
369
369
|
if (g)
|
|
370
370
|
return {
|
|
371
371
|
...o,
|
|
372
|
-
...
|
|
372
|
+
...d ? { user: d } : {},
|
|
373
373
|
last_read_message_id: g
|
|
374
374
|
};
|
|
375
|
-
if (
|
|
375
|
+
if (c)
|
|
376
376
|
return {
|
|
377
377
|
...o,
|
|
378
|
-
...
|
|
378
|
+
...d ? { user: d } : {},
|
|
379
379
|
last_read_message_id: ""
|
|
380
380
|
};
|
|
381
381
|
const h = i.get(o.user_id);
|
|
382
382
|
return h ? {
|
|
383
383
|
...o,
|
|
384
|
-
...
|
|
384
|
+
...d ? { user: d } : {},
|
|
385
385
|
last_read_message_id: h
|
|
386
386
|
} : {
|
|
387
387
|
...o,
|
|
388
|
-
...
|
|
388
|
+
...d ? { user: d } : {},
|
|
389
389
|
last_read_message_id: ""
|
|
390
390
|
};
|
|
391
391
|
});
|
|
392
392
|
}
|
|
393
393
|
function He(e, n) {
|
|
394
|
-
const i =
|
|
394
|
+
const i = co(e.muted_until), o = e.is_muted ?? i !== null, c = e.last_message ? at(e.last_message) : n?.last_message, l = e.last_message_at ?? n?.last_message_at, d = (() => {
|
|
395
395
|
if (!n || n.unread_count !== 0 || e.unread_count <= 0)
|
|
396
396
|
return !1;
|
|
397
397
|
const g = n.last_message?.id, h = e.last_message?.id;
|
|
@@ -399,34 +399,34 @@ function He(e, n) {
|
|
|
399
399
|
})();
|
|
400
400
|
return {
|
|
401
401
|
...e,
|
|
402
|
-
unread_count: o ||
|
|
403
|
-
participants:
|
|
402
|
+
unread_count: o || d ? 0 : e.unread_count,
|
|
403
|
+
participants: uo(e.participants, n?.participants),
|
|
404
404
|
is_muted: o,
|
|
405
405
|
muted_until: i,
|
|
406
|
-
...
|
|
407
|
-
...
|
|
406
|
+
...c ? { last_message: c } : {},
|
|
407
|
+
...l ? { last_message_at: l } : {}
|
|
408
408
|
};
|
|
409
409
|
}
|
|
410
|
-
function
|
|
410
|
+
function lo(e) {
|
|
411
411
|
return e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
412
412
|
}
|
|
413
413
|
function Pt(e) {
|
|
414
|
-
return
|
|
414
|
+
return lo(e) ? 0 : e.unread_count || 0;
|
|
415
415
|
}
|
|
416
416
|
function Ln(e, n) {
|
|
417
417
|
const i = n[e.id];
|
|
418
418
|
if (Array.isArray(i))
|
|
419
419
|
for (let o = i.length - 1; o >= 0; o -= 1) {
|
|
420
|
-
const
|
|
421
|
-
if (Nt(
|
|
422
|
-
return
|
|
420
|
+
const c = i[o]?.id;
|
|
421
|
+
if (Nt(c))
|
|
422
|
+
return c;
|
|
423
423
|
}
|
|
424
424
|
return Nt(e.last_message?.id) ? e.last_message.id : null;
|
|
425
425
|
}
|
|
426
426
|
function he(e) {
|
|
427
427
|
return typeof e == "object" && e !== null;
|
|
428
428
|
}
|
|
429
|
-
function
|
|
429
|
+
function ho(e) {
|
|
430
430
|
return he(e) ? (he(e.response) ? e.response : null)?.status === 401 : !1;
|
|
431
431
|
}
|
|
432
432
|
function In(e) {
|
|
@@ -436,11 +436,11 @@ function In(e) {
|
|
|
436
436
|
for (const i of e) {
|
|
437
437
|
if (!he(i) || typeof i.reaction != "string" || typeof i.count != "number" || !Array.isArray(i.users))
|
|
438
438
|
continue;
|
|
439
|
-
const o = i.users.filter((
|
|
440
|
-
(
|
|
441
|
-
).map((
|
|
442
|
-
id:
|
|
443
|
-
name:
|
|
439
|
+
const o = i.users.filter((c) => he(c)).filter(
|
|
440
|
+
(c) => typeof c.id == "string" && typeof c.name == "string"
|
|
441
|
+
).map((c) => ({
|
|
442
|
+
id: c.id,
|
|
443
|
+
name: c.name
|
|
444
444
|
}));
|
|
445
445
|
n.push({
|
|
446
446
|
reaction: i.reaction,
|
|
@@ -450,17 +450,17 @@ function In(e) {
|
|
|
450
450
|
}
|
|
451
451
|
return n;
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function fo(e, n) {
|
|
454
454
|
const i = he(n) ? n : null, o = i?.next ?? i?.next_cursor ?? e.next_cursor;
|
|
455
455
|
if (!(typeof o != "string" || o.length === 0))
|
|
456
456
|
return o;
|
|
457
457
|
}
|
|
458
458
|
function rt(e, n) {
|
|
459
459
|
const i = he(e) ? e : {}, o = i.data ?? e;
|
|
460
|
-
let
|
|
461
|
-
return Array.isArray(o) ?
|
|
462
|
-
items:
|
|
463
|
-
nextCursor:
|
|
460
|
+
let c = [];
|
|
461
|
+
return Array.isArray(o) ? c = o : he(o) && (Array.isArray(o.items) ? c = o.items : Array.isArray(o[n]) ? c = o[n] : Array.isArray(o.data) && (c = o.data)), {
|
|
462
|
+
items: c,
|
|
463
|
+
nextCursor: fo(i, o)
|
|
464
464
|
};
|
|
465
465
|
}
|
|
466
466
|
function Un(e) {
|
|
@@ -472,8 +472,8 @@ function On(e) {
|
|
|
472
472
|
function ct(e, n) {
|
|
473
473
|
if (e.is_pinned !== n.is_pinned)
|
|
474
474
|
return e.is_pinned ? -1 : 1;
|
|
475
|
-
const i = e.last_message_at ?? e.created_at,
|
|
476
|
-
return
|
|
475
|
+
const i = e.last_message_at ?? e.created_at, c = (n.last_message_at ?? n.created_at).localeCompare(i);
|
|
476
|
+
return c !== 0 ? c : e.id.localeCompare(n.id);
|
|
477
477
|
}
|
|
478
478
|
function it(e, n) {
|
|
479
479
|
return [n, ...e.filter((i) => i.id !== n.id)];
|
|
@@ -481,18 +481,39 @@ function it(e, n) {
|
|
|
481
481
|
function Be(e) {
|
|
482
482
|
return [...e].sort((n, i) => n.sort_order !== i.sort_order ? n.sort_order - i.sort_order : n.name.localeCompare(i.name));
|
|
483
483
|
}
|
|
484
|
-
function
|
|
484
|
+
function po(e, n) {
|
|
485
485
|
return typeof e != "string" || e.length === 0 ? null : n.has(e) ? e : null;
|
|
486
486
|
}
|
|
487
487
|
function Fn(e, n) {
|
|
488
488
|
return e.map((i) => {
|
|
489
|
-
const o =
|
|
489
|
+
const o = po(i.folder_id, n);
|
|
490
490
|
return (i.folder_id ?? null) === o ? i : {
|
|
491
491
|
...i,
|
|
492
492
|
folder_id: o
|
|
493
493
|
};
|
|
494
494
|
});
|
|
495
495
|
}
|
|
496
|
+
function Nn(e, n, i) {
|
|
497
|
+
let o = !1;
|
|
498
|
+
const c = e.map((l) => l.id !== n || (l.folder_id ?? null) === i ? l : (o = !0, {
|
|
499
|
+
...l,
|
|
500
|
+
folder_id: i
|
|
501
|
+
}));
|
|
502
|
+
return o ? c : e;
|
|
503
|
+
}
|
|
504
|
+
function go(e, n, i) {
|
|
505
|
+
if (n === i)
|
|
506
|
+
return e;
|
|
507
|
+
let o = !1;
|
|
508
|
+
const c = e.map((l) => {
|
|
509
|
+
let d = l.conversation_count;
|
|
510
|
+
return l.id === n && (d = Math.max(0, d - 1)), l.id === i && (d += 1), d === l.conversation_count ? l : (o = !0, {
|
|
511
|
+
...l,
|
|
512
|
+
conversation_count: d
|
|
513
|
+
});
|
|
514
|
+
});
|
|
515
|
+
return o ? c : e;
|
|
516
|
+
}
|
|
496
517
|
function Mt(e) {
|
|
497
518
|
const n = /* @__PURE__ */ new Map();
|
|
498
519
|
for (const i of e.requests)
|
|
@@ -501,7 +522,7 @@ function Mt(e) {
|
|
|
501
522
|
i.is_request === !0 && n.set(i.id, i);
|
|
502
523
|
return Array.from(n.values()).sort(ct);
|
|
503
524
|
}
|
|
504
|
-
const Wt =
|
|
525
|
+
const Wt = yi("messaging", {
|
|
505
526
|
state: () => ({
|
|
506
527
|
conversations: [],
|
|
507
528
|
requests: [],
|
|
@@ -584,18 +605,18 @@ const Wt = bi("messaging", {
|
|
|
584
605
|
async reorderFolders(e) {
|
|
585
606
|
try {
|
|
586
607
|
await Re.reorderFolders(e);
|
|
587
|
-
const n = new Map(this.folders.map((
|
|
588
|
-
for (const
|
|
589
|
-
const
|
|
590
|
-
|
|
591
|
-
...
|
|
608
|
+
const n = new Map(this.folders.map((c) => [c.id, c])), i = [];
|
|
609
|
+
for (const c of e) {
|
|
610
|
+
const l = n.get(c);
|
|
611
|
+
l && (i.push({
|
|
612
|
+
...l,
|
|
592
613
|
sort_order: i.length + 1
|
|
593
|
-
}), n.delete(
|
|
614
|
+
}), n.delete(c));
|
|
594
615
|
}
|
|
595
616
|
const o = Be(Array.from(n.values()));
|
|
596
|
-
for (const
|
|
617
|
+
for (const c of o)
|
|
597
618
|
i.push({
|
|
598
|
-
...
|
|
619
|
+
...c,
|
|
599
620
|
sort_order: i.length + 1
|
|
600
621
|
});
|
|
601
622
|
this.folders = i;
|
|
@@ -605,17 +626,27 @@ const Wt = bi("messaging", {
|
|
|
605
626
|
},
|
|
606
627
|
async assignToFolder(e, n) {
|
|
607
628
|
try {
|
|
608
|
-
const i = await Re.assignFolder(e, n), o = this.conversations.
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
629
|
+
const i = await Re.assignFolder(e, n), o = this.conversations.find(
|
|
630
|
+
(d) => d.id === e
|
|
631
|
+
) ?? this.requests.find(
|
|
632
|
+
(d) => d.id === e
|
|
633
|
+
);
|
|
634
|
+
if (!o)
|
|
613
635
|
return;
|
|
614
|
-
const
|
|
615
|
-
this.conversations
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
636
|
+
const c = o.folder_id ?? null, l = typeof i.folder_id == "string" || i.folder_id === null ? i.folder_id : n;
|
|
637
|
+
this.conversations = Nn(
|
|
638
|
+
this.conversations,
|
|
639
|
+
e,
|
|
640
|
+
l
|
|
641
|
+
), this.requests = Nn(
|
|
642
|
+
this.requests,
|
|
643
|
+
e,
|
|
644
|
+
l
|
|
645
|
+
), this.folders = go(
|
|
646
|
+
this.folders,
|
|
647
|
+
c,
|
|
648
|
+
l
|
|
649
|
+
);
|
|
619
650
|
} catch (i) {
|
|
620
651
|
throw this.error = Z(i), i;
|
|
621
652
|
}
|
|
@@ -625,10 +656,10 @@ const Wt = bi("messaging", {
|
|
|
625
656
|
try {
|
|
626
657
|
if (xn())
|
|
627
658
|
return e || (this.conversations = [], this.normalizeFolderAssignmentsState()), Mn();
|
|
628
|
-
const
|
|
629
|
-
|
|
630
|
-
const
|
|
631
|
-
|
|
659
|
+
const c = o?.includePresence ?? !0, l = {};
|
|
660
|
+
c && (l.include_presence = 1), e && (l.cursor = e), n && (l.filter = n), typeof i == "string" && i.length > 0 && (l.folder_id = i);
|
|
661
|
+
const d = await W().get("/v1/messaging/conversations", { params: l }), { items: g, nextCursor: h } = rt(
|
|
662
|
+
d.data,
|
|
632
663
|
"conversations"
|
|
633
664
|
), x = g.map((_) => {
|
|
634
665
|
const T = this.conversations.find(
|
|
@@ -642,8 +673,8 @@ const Wt = bi("messaging", {
|
|
|
642
673
|
has_more: !!h
|
|
643
674
|
};
|
|
644
675
|
return h !== void 0 && (M.next_cursor = h), M;
|
|
645
|
-
} catch (
|
|
646
|
-
throw o?.background && Rn(
|
|
676
|
+
} catch (c) {
|
|
677
|
+
throw o?.background && Rn(c) || (this.error = Z(c)), c;
|
|
647
678
|
} finally {
|
|
648
679
|
this.loading = !1;
|
|
649
680
|
}
|
|
@@ -658,7 +689,7 @@ const Wt = bi("messaging", {
|
|
|
658
689
|
}), this.backgroundPollRetryAfterUntil = 0, this.backgroundPollTransientFailureCount = 0, !0;
|
|
659
690
|
} catch (e) {
|
|
660
691
|
const n = e, i = Xt(n.response?.status);
|
|
661
|
-
return i === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() +
|
|
692
|
+
return i === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() + cs(n.response?.headers?.["retry-after"]), !1) : (this.backgroundPollTransientFailureCount += 1, i === void 0 || as(i) ? (this.backgroundPollRetryAfterUntil = Date.now() + Zi(this.backgroundPollTransientFailureCount), !1) : (this.backgroundPollRetryAfterUntil = Date.now() + Vt, !1));
|
|
662
693
|
}
|
|
663
694
|
},
|
|
664
695
|
async fetchConversation(e) {
|
|
@@ -666,10 +697,10 @@ const Wt = bi("messaging", {
|
|
|
666
697
|
try {
|
|
667
698
|
const n = await W().get(`/v1/messaging/conversations/${e}`, {
|
|
668
699
|
params: { include_presence: 1 }
|
|
669
|
-
}), i = this.conversations.find((
|
|
670
|
-
|
|
671
|
-
const
|
|
672
|
-
return
|
|
700
|
+
}), i = this.conversations.find((d) => d.id === e), o = He(n.data.data || n.data, i), c = this.conversations.findIndex((d) => d.id === e);
|
|
701
|
+
c >= 0 ? this.conversations[c] = o : this.conversations.push(o);
|
|
702
|
+
const l = this.requests.findIndex((d) => d.id === e);
|
|
703
|
+
return l >= 0 && (this.requests[l] = o), this.normalizeFolderAssignmentsState(), o;
|
|
673
704
|
} catch (n) {
|
|
674
705
|
throw this.error = Z(n), n;
|
|
675
706
|
} finally {
|
|
@@ -686,19 +717,19 @@ const Wt = bi("messaging", {
|
|
|
686
717
|
filter: "requests"
|
|
687
718
|
};
|
|
688
719
|
e && (n.cursor = e);
|
|
689
|
-
const i = await W().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor:
|
|
720
|
+
const i = await W().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: c } = rt(
|
|
690
721
|
i.data,
|
|
691
722
|
"conversations"
|
|
692
|
-
),
|
|
723
|
+
), l = o.map((g) => {
|
|
693
724
|
const h = this.requests.find((x) => x.id === g.id);
|
|
694
725
|
return He(g, h);
|
|
695
726
|
});
|
|
696
|
-
e ? this.requests.push(...
|
|
697
|
-
const
|
|
698
|
-
data:
|
|
699
|
-
has_more: !!
|
|
727
|
+
e ? this.requests.push(...l) : this.requests = l, this.normalizeFolderAssignmentsState();
|
|
728
|
+
const d = {
|
|
729
|
+
data: l,
|
|
730
|
+
has_more: !!c
|
|
700
731
|
};
|
|
701
|
-
return
|
|
732
|
+
return c !== void 0 && (d.next_cursor = c), d;
|
|
702
733
|
} catch (n) {
|
|
703
734
|
throw this.error = Z(n), n;
|
|
704
735
|
} finally {
|
|
@@ -709,20 +740,20 @@ const Wt = bi("messaging", {
|
|
|
709
740
|
this.loadingMessages[e] = !0, n || (this.loading = !0), this.error = null;
|
|
710
741
|
try {
|
|
711
742
|
const i = n ? { cursor: n } : {};
|
|
712
|
-
let o = 0,
|
|
743
|
+
let o = 0, c;
|
|
713
744
|
for (; ; )
|
|
714
745
|
try {
|
|
715
|
-
|
|
746
|
+
c = await W().get(`/v1/messaging/conversations/${e}/messages`, { params: i });
|
|
716
747
|
break;
|
|
717
748
|
} catch (_) {
|
|
718
|
-
if (!(o <
|
|
749
|
+
if (!(o < Qi && Rn(_)))
|
|
719
750
|
throw _;
|
|
720
|
-
o += 1, await Pn(
|
|
751
|
+
o += 1, await Pn(eo(_));
|
|
721
752
|
}
|
|
722
|
-
const { items:
|
|
723
|
-
|
|
753
|
+
const { items: l, nextCursor: d } = rt(
|
|
754
|
+
c.data,
|
|
724
755
|
"messages"
|
|
725
|
-
), g =
|
|
756
|
+
), g = l.map(at), h = [...g].reverse();
|
|
726
757
|
if (n ? this.messages[e] = [...h, ...this.messages[e] || []] : this.messages[e] = h, (() => {
|
|
727
758
|
const _ = this.conversations.find((T) => T.id === e) ?? this.requests.find((T) => T.id === e);
|
|
728
759
|
return _ ? !_.last_message || !_.last_message_at : !1;
|
|
@@ -730,20 +761,20 @@ const Wt = bi("messaging", {
|
|
|
730
761
|
const _ = this.messages[e]?.at(-1);
|
|
731
762
|
_ && this.updateConversationLastMessage(e, _);
|
|
732
763
|
}
|
|
733
|
-
|
|
764
|
+
d ? (this.conversationCursors[e] = d, this.conversationHasMore[e] = !0) : (delete this.conversationCursors[e], this.conversationHasMore[e] = !1);
|
|
734
765
|
const M = {
|
|
735
766
|
data: g,
|
|
736
|
-
has_more: !!
|
|
767
|
+
has_more: !!d
|
|
737
768
|
};
|
|
738
|
-
return
|
|
769
|
+
return d !== void 0 && (M.next_cursor = d), M;
|
|
739
770
|
} catch (i) {
|
|
740
771
|
throw this.error = Z(i), i;
|
|
741
772
|
} finally {
|
|
742
773
|
this.loadingMessages[e] = !1, this.loading = !1;
|
|
743
774
|
}
|
|
744
775
|
},
|
|
745
|
-
async sendMessage(e, n, i, o,
|
|
746
|
-
const g = Fe()(), h = `temp-${Date.now()}-${Math.random()}`, x = typeof
|
|
776
|
+
async sendMessage(e, n, i, o, c, l, d) {
|
|
777
|
+
const g = Fe()(), h = `temp-${Date.now()}-${Math.random()}`, x = typeof l == "string" && l.trim().length > 0 ? l.trim() : null, M = ao(d), _ = g.currentUser, T = {
|
|
747
778
|
id: h,
|
|
748
779
|
conversation_id: e,
|
|
749
780
|
author_id: _?.id || "",
|
|
@@ -760,7 +791,7 @@ const Wt = bi("messaging", {
|
|
|
760
791
|
name: _.name,
|
|
761
792
|
..._.avatar ? { avatar: _.avatar } : {},
|
|
762
793
|
..._.handle ? { handle: _.handle } : {}
|
|
763
|
-
}), o != null && (T.reply_to_id = o),
|
|
794
|
+
}), o != null && (T.reply_to_id = o), c != null && (T.reply_to = c), this.messages[e] || (this.messages[e] = []), this.messages[e].push(T), this._pendingSendIds.add(h);
|
|
764
795
|
try {
|
|
765
796
|
let y;
|
|
766
797
|
const w = {
|
|
@@ -772,7 +803,7 @@ const Wt = bi("messaging", {
|
|
|
772
803
|
if (i && i.length > 0) {
|
|
773
804
|
const k = await Promise.all(
|
|
774
805
|
i.map(async (O) => {
|
|
775
|
-
const H = await
|
|
806
|
+
const H = await Bi().uploadImage(O);
|
|
776
807
|
return {
|
|
777
808
|
media_id: H.id,
|
|
778
809
|
mime: H.mime_type,
|
|
@@ -806,12 +837,12 @@ const Wt = bi("messaging", {
|
|
|
806
837
|
try {
|
|
807
838
|
const o = await W().patch(`/v1/messaging/conversations/${e}/messages/${n}`, {
|
|
808
839
|
body: i
|
|
809
|
-
}),
|
|
810
|
-
if (
|
|
811
|
-
const g = d
|
|
812
|
-
return d
|
|
840
|
+
}), c = o.data.data || o.data, l = this.messages[e] || [], d = l.findIndex((g) => g.id === n);
|
|
841
|
+
if (d >= 0) {
|
|
842
|
+
const g = l[d], h = c.id ? { ...g, ...c } : { ...g, body: i, edited_at: (/* @__PURE__ */ new Date()).toISOString() };
|
|
843
|
+
return l[d] = h, h;
|
|
813
844
|
}
|
|
814
|
-
return
|
|
845
|
+
return c;
|
|
815
846
|
} catch (o) {
|
|
816
847
|
throw this.error = Z(o), o;
|
|
817
848
|
}
|
|
@@ -819,13 +850,13 @@ const Wt = bi("messaging", {
|
|
|
819
850
|
async deleteMessage(e, n) {
|
|
820
851
|
try {
|
|
821
852
|
await W().delete(`/v1/messaging/conversations/${e}/messages/${n}`);
|
|
822
|
-
const i = this.messages[e] || [], o = i.findIndex((
|
|
853
|
+
const i = this.messages[e] || [], o = i.findIndex((c) => c.id === n);
|
|
823
854
|
if (o >= 0) {
|
|
824
|
-
const
|
|
825
|
-
if (!
|
|
855
|
+
const c = i[o];
|
|
856
|
+
if (!c)
|
|
826
857
|
return;
|
|
827
|
-
const
|
|
828
|
-
delete
|
|
858
|
+
const l = { ...c, is_deleted: !0 };
|
|
859
|
+
delete l.body, i[o] = l;
|
|
829
860
|
}
|
|
830
861
|
} catch (i) {
|
|
831
862
|
throw this.error = Z(i), i;
|
|
@@ -833,14 +864,14 @@ const Wt = bi("messaging", {
|
|
|
833
864
|
},
|
|
834
865
|
async markAsRead(e) {
|
|
835
866
|
try {
|
|
836
|
-
const n = this.conversations.find((
|
|
837
|
-
const
|
|
838
|
-
if (!Array.isArray(
|
|
867
|
+
const n = this.conversations.find((c) => c.id === e) ?? this.requests.find((c) => c.id === e), i = (() => {
|
|
868
|
+
const c = this.messages[e];
|
|
869
|
+
if (!Array.isArray(c))
|
|
839
870
|
return null;
|
|
840
|
-
for (let
|
|
841
|
-
const
|
|
842
|
-
if (Nt(
|
|
843
|
-
return
|
|
871
|
+
for (let l = c.length - 1; l >= 0; l -= 1) {
|
|
872
|
+
const d = c[l]?.id;
|
|
873
|
+
if (Nt(d))
|
|
874
|
+
return d;
|
|
844
875
|
}
|
|
845
876
|
return null;
|
|
846
877
|
})(), o = n ? Ln(n, this.messages) : i;
|
|
@@ -848,45 +879,45 @@ const Wt = bi("messaging", {
|
|
|
848
879
|
return;
|
|
849
880
|
await W().post(`/v1/messaging/conversations/${e}/read`, {
|
|
850
881
|
message_id: o
|
|
851
|
-
}), this.conversations.forEach((
|
|
852
|
-
|
|
853
|
-
}), this.requests.forEach((
|
|
854
|
-
|
|
882
|
+
}), this.conversations.forEach((c) => {
|
|
883
|
+
c.id === e && (c.unread_count = 0);
|
|
884
|
+
}), this.requests.forEach((c) => {
|
|
885
|
+
c.id === e && (c.unread_count = 0);
|
|
855
886
|
});
|
|
856
887
|
} catch (n) {
|
|
857
888
|
throw this.error = Z(n), n;
|
|
858
889
|
}
|
|
859
890
|
},
|
|
860
891
|
async markAllAsRead() {
|
|
861
|
-
const e = this.conversations.filter((
|
|
892
|
+
const e = this.conversations.filter((c) => c.unread_count > 0);
|
|
862
893
|
if (e.length === 0)
|
|
863
894
|
return;
|
|
864
|
-
const n = e.map((
|
|
865
|
-
const
|
|
866
|
-
return
|
|
867
|
-
conversationId:
|
|
868
|
-
messageId:
|
|
895
|
+
const n = e.map((c) => {
|
|
896
|
+
const l = Ln(c, this.messages);
|
|
897
|
+
return l ? {
|
|
898
|
+
conversationId: c.id,
|
|
899
|
+
messageId: l
|
|
869
900
|
} : null;
|
|
870
|
-
}).filter((
|
|
901
|
+
}).filter((c) => c !== null);
|
|
871
902
|
if (n.length === 0)
|
|
872
903
|
return;
|
|
873
904
|
const i = await Promise.allSettled(
|
|
874
905
|
n.map(
|
|
875
|
-
(
|
|
876
|
-
message_id:
|
|
906
|
+
(c) => W().post(`/v1/messaging/conversations/${c.conversationId}/read`, {
|
|
907
|
+
message_id: c.messageId
|
|
877
908
|
})
|
|
878
909
|
)
|
|
879
910
|
);
|
|
880
911
|
let o = null;
|
|
881
|
-
if (i.forEach((
|
|
882
|
-
const
|
|
883
|
-
if (
|
|
884
|
-
if (
|
|
885
|
-
const g = this.conversations.find((h) => h.id ===
|
|
912
|
+
if (i.forEach((c, l) => {
|
|
913
|
+
const d = n[l];
|
|
914
|
+
if (d) {
|
|
915
|
+
if (c.status === "fulfilled") {
|
|
916
|
+
const g = this.conversations.find((h) => h.id === d.conversationId);
|
|
886
917
|
g && (g.unread_count = 0);
|
|
887
918
|
return;
|
|
888
919
|
}
|
|
889
|
-
o === null && (o =
|
|
920
|
+
o === null && (o = c.reason);
|
|
890
921
|
}
|
|
891
922
|
}), o !== null)
|
|
892
923
|
throw this.error = Z(o), o;
|
|
@@ -894,17 +925,17 @@ const Wt = bi("messaging", {
|
|
|
894
925
|
async sendTyping(e, n = "start") {
|
|
895
926
|
try {
|
|
896
927
|
const i = await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
897
|
-
if (n !== "start" || !
|
|
928
|
+
if (n !== "start" || !to(i.data))
|
|
898
929
|
return;
|
|
899
|
-
await Pn(
|
|
930
|
+
await Pn(Yi), await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
900
931
|
} catch (i) {
|
|
901
932
|
console.warn("Failed to send typing indicator:", i);
|
|
902
933
|
}
|
|
903
934
|
},
|
|
904
935
|
async muteConversation(e, n) {
|
|
905
936
|
try {
|
|
906
|
-
const i = { minutes: n }, o = await W().patch(`/v1/messaging/conversations/${e}/mute`, i),
|
|
907
|
-
|
|
937
|
+
const i = { minutes: n }, o = await W().patch(`/v1/messaging/conversations/${e}/mute`, i), l = (o.data.data || o.data).muted_until || null, d = this.conversations.find((g) => g.id === e);
|
|
938
|
+
d && (d.is_muted = l !== null, d.muted_until = l);
|
|
908
939
|
} catch (i) {
|
|
909
940
|
throw this.error = Z(i), i;
|
|
910
941
|
}
|
|
@@ -913,8 +944,8 @@ const Wt = bi("messaging", {
|
|
|
913
944
|
try {
|
|
914
945
|
const n = await W().patch(`/v1/messaging/conversations/${e}/mute`, {
|
|
915
946
|
minutes: 0
|
|
916
|
-
}), o = (n.data.data || n.data).muted_until || null,
|
|
917
|
-
|
|
947
|
+
}), o = (n.data.data || n.data).muted_until || null, c = this.conversations.find((l) => l.id === e);
|
|
948
|
+
c && (c.is_muted = o !== null, c.muted_until = o);
|
|
918
949
|
} catch (n) {
|
|
919
950
|
throw this.error = Z(n), n;
|
|
920
951
|
}
|
|
@@ -923,11 +954,11 @@ const Wt = bi("messaging", {
|
|
|
923
954
|
try {
|
|
924
955
|
const i = await W().patch(`/v1/messaging/conversations/${e}`, {
|
|
925
956
|
title: n
|
|
926
|
-
}), o = i.data.data || i.data,
|
|
957
|
+
}), o = i.data.data || i.data, c = typeof o?.title == "string" ? o.title : n, l = (d) => d.map((g) => g.id !== e ? g : {
|
|
927
958
|
...g,
|
|
928
|
-
title:
|
|
959
|
+
title: c
|
|
929
960
|
});
|
|
930
|
-
this.conversations =
|
|
961
|
+
this.conversations = l(this.conversations), this.requests = l(this.requests);
|
|
931
962
|
} catch (i) {
|
|
932
963
|
throw this.error = Z(i), i;
|
|
933
964
|
}
|
|
@@ -961,11 +992,11 @@ const Wt = bi("messaging", {
|
|
|
961
992
|
user_id: e
|
|
962
993
|
};
|
|
963
994
|
n && (i.message = n);
|
|
964
|
-
const o = await W().post("/v1/messaging/conversations/dm", i),
|
|
965
|
-
if (!Un(
|
|
995
|
+
const o = await W().post("/v1/messaging/conversations/dm", i), c = o.data.data || o.data;
|
|
996
|
+
if (!Un(c))
|
|
966
997
|
throw new Error("Invalid conversation payload from DM create endpoint.");
|
|
967
|
-
const
|
|
968
|
-
return
|
|
998
|
+
const l = On(c) ? He(c) : await this.fetchConversation(c.id);
|
|
999
|
+
return l.is_request === !0 ? (this.requests = it(this.requests, l), this.conversations = this.conversations.filter((d) => d.id !== l.id), l) : (this.conversations = it(this.conversations, l), this.requests = this.requests.filter((d) => d.id !== l.id), l);
|
|
969
1000
|
} catch (i) {
|
|
970
1001
|
throw this.error = Z(i), i;
|
|
971
1002
|
}
|
|
@@ -978,8 +1009,8 @@ const Wt = bi("messaging", {
|
|
|
978
1009
|
}), o = i.data.data || i.data;
|
|
979
1010
|
if (!Un(o))
|
|
980
1011
|
throw new Error("Invalid conversation payload from group create endpoint.");
|
|
981
|
-
const
|
|
982
|
-
return this.conversations = it(this.conversations,
|
|
1012
|
+
const c = On(o) ? o : await this.fetchConversation(o.id);
|
|
1013
|
+
return this.conversations = it(this.conversations, c), c;
|
|
983
1014
|
} catch (i) {
|
|
984
1015
|
throw this.error = Z(i), i;
|
|
985
1016
|
}
|
|
@@ -1012,11 +1043,11 @@ const Wt = bi("messaging", {
|
|
|
1012
1043
|
if (!n)
|
|
1013
1044
|
return;
|
|
1014
1045
|
let i = !1;
|
|
1015
|
-
const o = n.participants.map((
|
|
1016
|
-
...
|
|
1046
|
+
const o = n.participants.map((d) => d.user_id !== e.user_id || d.last_read_message_id === e.message_id ? d : (i = !0, {
|
|
1047
|
+
...d,
|
|
1017
1048
|
last_read_message_id: e.message_id
|
|
1018
1049
|
}));
|
|
1019
|
-
i && (n.participants = o), !this.getMessagesByConversationId(e.conversation_id).some((
|
|
1050
|
+
i && (n.participants = o), !this.getMessagesByConversationId(e.conversation_id).some((d) => d.id === e.message_id) && this.fetchConversation(e.conversation_id).catch(() => {
|
|
1020
1051
|
});
|
|
1021
1052
|
},
|
|
1022
1053
|
// Real-time event handlers
|
|
@@ -1030,8 +1061,8 @@ const Wt = bi("messaging", {
|
|
|
1030
1061
|
const i = at({ ...e, attachments: e.attachments ?? [] }), o = this.messages[n];
|
|
1031
1062
|
if (o.find((h) => h.id === i.id))
|
|
1032
1063
|
return;
|
|
1033
|
-
const
|
|
1034
|
-
if (i.author_id ===
|
|
1064
|
+
const l = Fe()();
|
|
1065
|
+
if (i.author_id === l.currentUser?.id) {
|
|
1035
1066
|
const h = o.findIndex((x) => x.id.startsWith("temp-"));
|
|
1036
1067
|
if (h >= 0) {
|
|
1037
1068
|
const x = o[h]?.id ?? "";
|
|
@@ -1039,11 +1070,11 @@ const Wt = bi("messaging", {
|
|
|
1039
1070
|
return;
|
|
1040
1071
|
}
|
|
1041
1072
|
}
|
|
1042
|
-
const
|
|
1073
|
+
const d = i.created_at;
|
|
1043
1074
|
let g = o.length;
|
|
1044
1075
|
for (let h = o.length - 1; h >= 0; h--) {
|
|
1045
1076
|
const x = o[h];
|
|
1046
|
-
if (x && x.created_at <=
|
|
1077
|
+
if (x && x.created_at <= d)
|
|
1047
1078
|
break;
|
|
1048
1079
|
g = h;
|
|
1049
1080
|
}
|
|
@@ -1059,41 +1090,41 @@ const Wt = bi("messaging", {
|
|
|
1059
1090
|
return delete x.body, x;
|
|
1060
1091
|
};
|
|
1061
1092
|
let o = null;
|
|
1062
|
-
const
|
|
1063
|
-
|
|
1064
|
-
const
|
|
1065
|
-
if (
|
|
1066
|
-
const h = i(
|
|
1067
|
-
|
|
1093
|
+
const c = this.conversations.find((h) => h.id === e);
|
|
1094
|
+
c?.last_message?.id === n && (o = i(c.last_message), c.last_message = o);
|
|
1095
|
+
const l = this.requests.find((h) => h.id === e);
|
|
1096
|
+
if (l?.last_message?.id === n) {
|
|
1097
|
+
const h = i(l.last_message);
|
|
1098
|
+
l.last_message = h, o === null && (o = h);
|
|
1068
1099
|
}
|
|
1069
|
-
const
|
|
1070
|
-
if (!
|
|
1100
|
+
const d = this.messages[e];
|
|
1101
|
+
if (!d) {
|
|
1071
1102
|
o && this.addMessage(o);
|
|
1072
1103
|
return;
|
|
1073
1104
|
}
|
|
1074
|
-
const g =
|
|
1105
|
+
const g = d.findIndex((h) => h.id === n);
|
|
1075
1106
|
if (g >= 0) {
|
|
1076
|
-
const h =
|
|
1077
|
-
h && (
|
|
1107
|
+
const h = d[g];
|
|
1108
|
+
h && (d[g] = i(h));
|
|
1078
1109
|
return;
|
|
1079
1110
|
}
|
|
1080
1111
|
o && this.addMessage(o);
|
|
1081
1112
|
},
|
|
1082
1113
|
async toggleReaction(e, n, i) {
|
|
1083
|
-
const o = `/v1/messaging/conversations/${e}/messages/${n}/reactions`,
|
|
1114
|
+
const o = `/v1/messaging/conversations/${e}/messages/${n}/reactions`, c = { reaction: i }, d = this.messages[e]?.find((g) => g.id === n)?.reactions ?? [];
|
|
1084
1115
|
try {
|
|
1085
1116
|
let g;
|
|
1086
1117
|
try {
|
|
1087
|
-
g = await W().post(o,
|
|
1118
|
+
g = await W().post(o, c);
|
|
1088
1119
|
} catch (_) {
|
|
1089
|
-
if (!
|
|
1120
|
+
if (!ho(_))
|
|
1090
1121
|
throw _;
|
|
1091
|
-
g = await W().post(o,
|
|
1122
|
+
g = await W().post(o, c);
|
|
1092
1123
|
}
|
|
1093
1124
|
const h = he(g.data) && "data" in g.data ? g.data.data : g.data, x = In(
|
|
1094
1125
|
he(h) ? h.reactions : void 0
|
|
1095
1126
|
);
|
|
1096
|
-
(x.length > 0 ||
|
|
1127
|
+
(x.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, x);
|
|
1097
1128
|
try {
|
|
1098
1129
|
const _ = await W().get(o), T = he(_.data) && "data" in _.data ? _.data.data : _.data, y = In(
|
|
1099
1130
|
he(T) ? T.reactions : void 0
|
|
@@ -1110,10 +1141,10 @@ const Wt = bi("messaging", {
|
|
|
1110
1141
|
return;
|
|
1111
1142
|
const o = this.messages[e];
|
|
1112
1143
|
if (!o) return;
|
|
1113
|
-
const
|
|
1114
|
-
if (
|
|
1115
|
-
const
|
|
1116
|
-
|
|
1144
|
+
const c = o.findIndex((l) => l.id === n);
|
|
1145
|
+
if (c >= 0) {
|
|
1146
|
+
const l = o[c];
|
|
1147
|
+
l && (o[c] = { ...l, reactions: i });
|
|
1117
1148
|
}
|
|
1118
1149
|
},
|
|
1119
1150
|
addTypingUser(e, n) {
|
|
@@ -1123,16 +1154,16 @@ const Wt = bi("messaging", {
|
|
|
1123
1154
|
this.typingUsers[e] && (this.typingUsers[e] = this.typingUsers[e].filter((i) => i.id !== n));
|
|
1124
1155
|
},
|
|
1125
1156
|
updateConversationLastMessage(e, n) {
|
|
1126
|
-
const i = (
|
|
1127
|
-
const
|
|
1128
|
-
return
|
|
1129
|
-
}, o = i(this.conversations),
|
|
1130
|
-
o && this.conversations.sort(ct),
|
|
1157
|
+
const i = (l) => {
|
|
1158
|
+
const d = l.find((g) => g.id === e);
|
|
1159
|
+
return d ? (d.last_message = n, d.last_message_at = n.created_at, !0) : !1;
|
|
1160
|
+
}, o = i(this.conversations), c = i(this.requests);
|
|
1161
|
+
o && this.conversations.sort(ct), c && this.requests.sort(ct);
|
|
1131
1162
|
},
|
|
1132
1163
|
updatePresenceForUser(e, n, i) {
|
|
1133
1164
|
const o = n === "online" || n === "idle" || n === "dnd";
|
|
1134
|
-
for (const
|
|
1135
|
-
|
|
1165
|
+
for (const c of this.conversations)
|
|
1166
|
+
c.type === "dm" && c.other_user_id === e && (c.other_presence_status = n, c.other_online = o, i !== void 0 && (c.other_last_seen_at = i));
|
|
1136
1167
|
},
|
|
1137
1168
|
async acceptRequest(e) {
|
|
1138
1169
|
try {
|
|
@@ -1161,13 +1192,13 @@ const Wt = bi("messaging", {
|
|
|
1161
1192
|
try {
|
|
1162
1193
|
const o = { search: e, limit: 20 };
|
|
1163
1194
|
n && (o.filter = n), typeof i == "string" && i.length > 0 && (o.folder_id = i);
|
|
1164
|
-
const
|
|
1195
|
+
const c = await W().get("/v1/messaging/conversations", {
|
|
1165
1196
|
params: o
|
|
1166
|
-
}), { items:
|
|
1167
|
-
|
|
1197
|
+
}), { items: l } = rt(
|
|
1198
|
+
c.data,
|
|
1168
1199
|
"conversations"
|
|
1169
1200
|
);
|
|
1170
|
-
return
|
|
1201
|
+
return l;
|
|
1171
1202
|
} catch (o) {
|
|
1172
1203
|
return this.error = Z(o), [];
|
|
1173
1204
|
} finally {
|
|
@@ -1222,10 +1253,10 @@ const Wt = bi("messaging", {
|
|
|
1222
1253
|
}
|
|
1223
1254
|
}
|
|
1224
1255
|
});
|
|
1225
|
-
function
|
|
1226
|
-
const n = Wt(), i = Fe()(), o = ve(!1),
|
|
1256
|
+
function Ka(e) {
|
|
1257
|
+
const n = Wt(), i = Fe()(), o = ve(!1), c = ve(null), l = ve(null), d = qt(), g = d !== null, h = 20, x = 250;
|
|
1227
1258
|
let M = 0, _ = null, T = null;
|
|
1228
|
-
const y = ie(() => i.currentUser?.id), w = () =>
|
|
1259
|
+
const y = ie(() => i.currentUser?.id), w = () => Vn(e)?.trim() ?? "";
|
|
1229
1260
|
function C() {
|
|
1230
1261
|
_ && (clearTimeout(_), _ = null), M = 0;
|
|
1231
1262
|
}
|
|
@@ -1276,8 +1307,8 @@ function Ga(e) {
|
|
|
1276
1307
|
}));
|
|
1277
1308
|
}
|
|
1278
1309
|
function H(b) {
|
|
1279
|
-
const I =
|
|
1280
|
-
T && (T(), T = null), I && (b && !n.hasGlobalConversationSubscription(I) &&
|
|
1310
|
+
const I = l.value;
|
|
1311
|
+
T && (T(), T = null), I && (b && !n.hasGlobalConversationSubscription(I) && Mi(I), n.unregisterDetailSubscription(I), l.value = null), o.value = !1;
|
|
1281
1312
|
}
|
|
1282
1313
|
function F() {
|
|
1283
1314
|
const b = w();
|
|
@@ -1286,9 +1317,9 @@ function Ga(e) {
|
|
|
1286
1317
|
f();
|
|
1287
1318
|
return;
|
|
1288
1319
|
}
|
|
1289
|
-
|
|
1320
|
+
c.value = null;
|
|
1290
1321
|
try {
|
|
1291
|
-
T =
|
|
1322
|
+
T = Pi(b, {
|
|
1292
1323
|
onMessageSent: m,
|
|
1293
1324
|
onMessageRead: v,
|
|
1294
1325
|
onMessageEdited: N,
|
|
@@ -1296,9 +1327,9 @@ function Ga(e) {
|
|
|
1296
1327
|
onReactionToggled: G,
|
|
1297
1328
|
onRequestAccepted: k,
|
|
1298
1329
|
onParticipantRemoved: O
|
|
1299
|
-
}), o.value = !0,
|
|
1330
|
+
}), o.value = !0, l.value = b, n.registerDetailSubscription(b), C();
|
|
1300
1331
|
} catch (I) {
|
|
1301
|
-
|
|
1332
|
+
c.value = I instanceof Error ? I.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", I);
|
|
1302
1333
|
}
|
|
1303
1334
|
}
|
|
1304
1335
|
}
|
|
@@ -1314,11 +1345,11 @@ function Ga(e) {
|
|
|
1314
1345
|
(b === "disconnected" || b === "error") && (C(), H(!1));
|
|
1315
1346
|
});
|
|
1316
1347
|
function ee() {
|
|
1317
|
-
if (C(), !(!o.value || !
|
|
1348
|
+
if (C(), !(!o.value || !l.value))
|
|
1318
1349
|
try {
|
|
1319
|
-
H(!0),
|
|
1350
|
+
H(!0), c.value = null;
|
|
1320
1351
|
} catch (b) {
|
|
1321
|
-
|
|
1352
|
+
c.value = b instanceof Error ? b.message : "Failed to unsubscribe from conversation", console.error("ConversationChannel: Unsubscribe error", b);
|
|
1322
1353
|
}
|
|
1323
1354
|
}
|
|
1324
1355
|
return Ut(
|
|
@@ -1326,52 +1357,52 @@ function Ga(e) {
|
|
|
1326
1357
|
(b, I) => {
|
|
1327
1358
|
if (b !== I) {
|
|
1328
1359
|
if (C(), o.value && H(!0), !b) {
|
|
1329
|
-
|
|
1360
|
+
c.value = null;
|
|
1330
1361
|
return;
|
|
1331
1362
|
}
|
|
1332
1363
|
F();
|
|
1333
1364
|
}
|
|
1334
1365
|
}
|
|
1335
|
-
),
|
|
1366
|
+
), d !== null && De(() => {
|
|
1336
1367
|
C(), me(), ee(), typeof window < "u" && window.removeEventListener(We(), J);
|
|
1337
1368
|
}), {
|
|
1338
1369
|
isSubscribed: ie(() => o.value),
|
|
1339
|
-
error: ie(() =>
|
|
1370
|
+
error: ie(() => c.value),
|
|
1340
1371
|
subscribe: F,
|
|
1341
1372
|
unsubscribe: ee
|
|
1342
1373
|
};
|
|
1343
1374
|
}
|
|
1344
|
-
const
|
|
1345
|
-
},
|
|
1375
|
+
const us = () => () => {
|
|
1376
|
+
}, ls = async () => {
|
|
1346
1377
|
}, be = {
|
|
1347
1378
|
initializedEvent: "messenger-client:main-echo-initialized",
|
|
1348
1379
|
getEcho: () => null,
|
|
1349
1380
|
getConnectionStatus: () => "disconnected",
|
|
1350
|
-
onConnectionStatusChange:
|
|
1351
|
-
reconnect:
|
|
1381
|
+
onConnectionStatusChange: us,
|
|
1382
|
+
reconnect: ls
|
|
1352
1383
|
};
|
|
1353
|
-
function
|
|
1384
|
+
function mo() {
|
|
1354
1385
|
return be.initializedEvent;
|
|
1355
1386
|
}
|
|
1356
|
-
function
|
|
1387
|
+
function vo() {
|
|
1357
1388
|
return be.getEcho();
|
|
1358
1389
|
}
|
|
1359
|
-
function
|
|
1390
|
+
function bo() {
|
|
1360
1391
|
return be.getConnectionStatus();
|
|
1361
1392
|
}
|
|
1362
|
-
function
|
|
1393
|
+
function yo(e) {
|
|
1363
1394
|
return be.onConnectionStatusChange(e);
|
|
1364
1395
|
}
|
|
1365
|
-
async function
|
|
1396
|
+
async function _o() {
|
|
1366
1397
|
await be.reconnect();
|
|
1367
1398
|
}
|
|
1368
|
-
function
|
|
1399
|
+
function So(e) {
|
|
1369
1400
|
e.initializedEvent && (be.initializedEvent = e.initializedEvent), e.getEcho && (be.getEcho = e.getEcho), e.getConnectionStatus && (be.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (be.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (be.reconnect = e.reconnect);
|
|
1370
1401
|
}
|
|
1371
|
-
function
|
|
1372
|
-
be.initializedEvent = "messenger-client:main-echo-initialized", be.getEcho = () => null, be.getConnectionStatus = () => "disconnected", be.onConnectionStatusChange =
|
|
1402
|
+
function Co() {
|
|
1403
|
+
be.initializedEvent = "messenger-client:main-echo-initialized", be.getEcho = () => null, be.getConnectionStatus = () => "disconnected", be.onConnectionStatusChange = us, be.reconnect = ls;
|
|
1373
1404
|
}
|
|
1374
|
-
const
|
|
1405
|
+
const wo = {
|
|
1375
1406
|
debug: () => {
|
|
1376
1407
|
},
|
|
1377
1408
|
info: () => {
|
|
@@ -1380,53 +1411,53 @@ const So = {
|
|
|
1380
1411
|
},
|
|
1381
1412
|
error: () => {
|
|
1382
1413
|
}
|
|
1383
|
-
},
|
|
1384
|
-
let Gt =
|
|
1414
|
+
}, ds = () => wo;
|
|
1415
|
+
let Gt = ds;
|
|
1385
1416
|
function Jt() {
|
|
1386
1417
|
return Gt;
|
|
1387
1418
|
}
|
|
1388
|
-
function
|
|
1419
|
+
function To(e) {
|
|
1389
1420
|
Gt = e;
|
|
1390
1421
|
}
|
|
1391
|
-
function
|
|
1392
|
-
Gt =
|
|
1422
|
+
function Eo() {
|
|
1423
|
+
Gt = ds;
|
|
1393
1424
|
}
|
|
1394
|
-
const
|
|
1425
|
+
const Ao = {
|
|
1395
1426
|
connected: "",
|
|
1396
1427
|
connecting: "",
|
|
1397
1428
|
disconnected: "",
|
|
1398
1429
|
error: "",
|
|
1399
1430
|
unknown: ""
|
|
1400
|
-
},
|
|
1401
|
-
function
|
|
1431
|
+
}, Dn = Jt()("ConnectionStatus");
|
|
1432
|
+
function qn(e) {
|
|
1402
1433
|
return e?.connector?.pusher?.connection ?? null;
|
|
1403
1434
|
}
|
|
1404
|
-
function
|
|
1435
|
+
function Ro(e) {
|
|
1405
1436
|
return e === "messenger" ? {
|
|
1406
1437
|
initializedEvent: We(),
|
|
1407
|
-
getConnectionStatus:
|
|
1438
|
+
getConnectionStatus: ns,
|
|
1408
1439
|
onConnectionStatusChange: ht,
|
|
1409
|
-
reconnect:
|
|
1410
|
-
getEchoConnection: () =>
|
|
1440
|
+
reconnect: Ei,
|
|
1441
|
+
getEchoConnection: () => qn(Pe())
|
|
1411
1442
|
} : {
|
|
1412
|
-
initializedEvent:
|
|
1413
|
-
getConnectionStatus:
|
|
1414
|
-
onConnectionStatusChange:
|
|
1415
|
-
reconnect:
|
|
1416
|
-
getEchoConnection: () =>
|
|
1443
|
+
initializedEvent: mo(),
|
|
1444
|
+
getConnectionStatus: bo,
|
|
1445
|
+
onConnectionStatusChange: yo,
|
|
1446
|
+
reconnect: _o,
|
|
1447
|
+
getEchoConnection: () => qn(vo())
|
|
1417
1448
|
};
|
|
1418
1449
|
}
|
|
1419
|
-
function
|
|
1450
|
+
function zn(e) {
|
|
1420
1451
|
return e.getEchoConnection()?.state ?? null;
|
|
1421
1452
|
}
|
|
1422
|
-
function
|
|
1423
|
-
const o =
|
|
1424
|
-
...
|
|
1453
|
+
function Qa(e = {}) {
|
|
1454
|
+
const o = Ro(e.source ?? "app"), c = {
|
|
1455
|
+
...Ao,
|
|
1425
1456
|
...e.icons
|
|
1426
|
-
},
|
|
1457
|
+
}, l = ve(o.getConnectionStatus()), d = ve(null), g = ve(0), h = ve(!1), x = ve(!1), M = ve(!1), _ = ve(!1);
|
|
1427
1458
|
let T = null, y = null, w = null, C = null, f = null, m = null, v = null;
|
|
1428
|
-
const N = ie(() =>
|
|
1429
|
-
switch (
|
|
1459
|
+
const N = ie(() => l.value === "connected"), q = ie(() => l.value === "connecting"), G = ie(() => l.value === "disconnected"), k = ie(() => l.value === "error"), O = ie(() => G.value || k.value), H = ie(() => {
|
|
1460
|
+
switch (l.value) {
|
|
1430
1461
|
case "connecting":
|
|
1431
1462
|
return g.value > 0 ? "Reconnecting..." : "Connecting...";
|
|
1432
1463
|
case "connected":
|
|
@@ -1439,7 +1470,7 @@ function Ja(e = {}) {
|
|
|
1439
1470
|
return "Unknown connection state";
|
|
1440
1471
|
}
|
|
1441
1472
|
}), F = ie(() => {
|
|
1442
|
-
switch (
|
|
1473
|
+
switch (l.value) {
|
|
1443
1474
|
case "connected":
|
|
1444
1475
|
return "success";
|
|
1445
1476
|
case "connecting":
|
|
@@ -1451,26 +1482,26 @@ function Ja(e = {}) {
|
|
|
1451
1482
|
return "medium";
|
|
1452
1483
|
}
|
|
1453
1484
|
}), J = ie(() => {
|
|
1454
|
-
switch (
|
|
1485
|
+
switch (l.value) {
|
|
1455
1486
|
case "connected":
|
|
1456
|
-
return
|
|
1487
|
+
return c.connected;
|
|
1457
1488
|
case "connecting":
|
|
1458
|
-
return
|
|
1489
|
+
return c.connecting;
|
|
1459
1490
|
case "disconnected":
|
|
1460
|
-
return
|
|
1491
|
+
return c.disconnected;
|
|
1461
1492
|
case "error":
|
|
1462
|
-
return
|
|
1493
|
+
return c.error;
|
|
1463
1494
|
default:
|
|
1464
|
-
return
|
|
1495
|
+
return c.unknown;
|
|
1465
1496
|
}
|
|
1466
1497
|
}), me = async () => {
|
|
1467
|
-
|
|
1468
|
-
}, ee = (A, V =
|
|
1498
|
+
Dn.debug("Manual reconnect triggered"), g.value += 1, await o.reconnect();
|
|
1499
|
+
}, ee = (A, V = l.value) => {
|
|
1469
1500
|
if (A !== "connecting" && y && (clearTimeout(y), y = null), A === "disconnected" || A === "error") {
|
|
1470
1501
|
const ne = !_.value && V === A, _e = !x.value && (ne || V === "connected" || V === "connecting");
|
|
1471
1502
|
if (M.value = !0, _e) {
|
|
1472
1503
|
h.value = !1, w && clearTimeout(w), w = setTimeout(() => {
|
|
1473
|
-
w = null,
|
|
1504
|
+
w = null, l.value !== "connected" && (h.value = !0);
|
|
1474
1505
|
}, 2e3);
|
|
1475
1506
|
return;
|
|
1476
1507
|
}
|
|
@@ -1489,24 +1520,24 @@ function Ja(e = {}) {
|
|
|
1489
1520
|
if (M.value || (h.value = !1), y)
|
|
1490
1521
|
return;
|
|
1491
1522
|
y = setTimeout(() => {
|
|
1492
|
-
if (y = null,
|
|
1493
|
-
if (
|
|
1523
|
+
if (y = null, l.value === "connecting") {
|
|
1524
|
+
if (zn(o) === "connected") {
|
|
1494
1525
|
b("connected");
|
|
1495
1526
|
return;
|
|
1496
1527
|
}
|
|
1497
|
-
x.value = !0,
|
|
1528
|
+
x.value = !0, Dn.warn("Still connecting after 10s, treating as disconnected"), b("disconnected"), g.value += 1, o.reconnect();
|
|
1498
1529
|
}
|
|
1499
1530
|
}, 1e4);
|
|
1500
1531
|
}
|
|
1501
1532
|
}, b = (A) => {
|
|
1502
|
-
const V =
|
|
1533
|
+
const V = l.value;
|
|
1503
1534
|
if (A === "connecting" && x.value) {
|
|
1504
|
-
|
|
1535
|
+
l.value = "disconnected", ee("disconnected", V);
|
|
1505
1536
|
return;
|
|
1506
1537
|
}
|
|
1507
|
-
|
|
1538
|
+
l.value = A, A === "connecting" && (V === "disconnected" || V === "error") && g.value === 0 && (g.value = 1), A === "connected" && (d.value = /* @__PURE__ */ new Date(), g.value = 0), ee(A, V);
|
|
1508
1539
|
}, I = () => {
|
|
1509
|
-
const A =
|
|
1540
|
+
const A = zn(o), V = l.value;
|
|
1510
1541
|
if (A === "connected" && V !== "connected") {
|
|
1511
1542
|
b("connected");
|
|
1512
1543
|
return;
|
|
@@ -1554,13 +1585,13 @@ function Ja(e = {}) {
|
|
|
1554
1585
|
}
|
|
1555
1586
|
(A === "unavailable" || A === "failed" || A === "disconnected") && b("disconnected");
|
|
1556
1587
|
}, B = ie(() => {
|
|
1557
|
-
if (!
|
|
1588
|
+
if (!d.value || !N.value)
|
|
1558
1589
|
return null;
|
|
1559
|
-
const A = Date.now() -
|
|
1590
|
+
const A = Date.now() - d.value.getTime(), V = Math.floor(A / 6e4), ne = Math.floor(A % 6e4 / 1e3);
|
|
1560
1591
|
return V > 0 ? `${V}m ${ne}s` : `${ne}s`;
|
|
1561
1592
|
});
|
|
1562
1593
|
return zt(() => {
|
|
1563
|
-
|
|
1594
|
+
l.value = o.getConnectionStatus(), T = o.onConnectionStatusChange(b), N.value && (d.value = /* @__PURE__ */ new Date()), ee(l.value, l.value), _.value = !0, ae(), m = () => {
|
|
1564
1595
|
ae(), I();
|
|
1565
1596
|
}, window.addEventListener(o.initializedEvent, m), I(), C = setInterval(() => {
|
|
1566
1597
|
I();
|
|
@@ -1568,7 +1599,7 @@ function Ja(e = {}) {
|
|
|
1568
1599
|
}), De(() => {
|
|
1569
1600
|
T?.(), y && (clearTimeout(y), y = null), w && (clearTimeout(w), w = null), C && (clearInterval(C), C = null), m && (window.removeEventListener(o.initializedEvent, m), m = null), f?.unbind && v && (f.unbind("connected", v.connected), f.unbind("connecting", v.connecting), f.unbind("disconnected", v.disconnected), f.unbind("unavailable", v.unavailable), f.unbind("error", v.error), f.unbind("state_change", v.stateChange)), f = null, v = null;
|
|
1570
1601
|
}), {
|
|
1571
|
-
connectionStatus: ie(() =>
|
|
1602
|
+
connectionStatus: ie(() => l.value),
|
|
1572
1603
|
isConnected: N,
|
|
1573
1604
|
isConnecting: q,
|
|
1574
1605
|
isDisconnected: G,
|
|
@@ -1578,47 +1609,47 @@ function Ja(e = {}) {
|
|
|
1578
1609
|
statusColor: F,
|
|
1579
1610
|
statusIcon: J,
|
|
1580
1611
|
showConnectionBanner: ie(() => h.value),
|
|
1581
|
-
lastConnectionTime: ie(() =>
|
|
1612
|
+
lastConnectionTime: ie(() => d.value),
|
|
1582
1613
|
connectionUptime: B,
|
|
1583
1614
|
reconnectAttempts: ie(() => g.value),
|
|
1584
1615
|
reconnect: me
|
|
1585
1616
|
};
|
|
1586
1617
|
}
|
|
1587
|
-
const
|
|
1588
|
-
let Kt =
|
|
1589
|
-
function
|
|
1618
|
+
const hs = jt;
|
|
1619
|
+
let Kt = hs;
|
|
1620
|
+
function fs() {
|
|
1590
1621
|
return Kt;
|
|
1591
1622
|
}
|
|
1592
|
-
function
|
|
1623
|
+
function Po(e) {
|
|
1593
1624
|
Kt = e;
|
|
1594
1625
|
}
|
|
1595
|
-
function
|
|
1596
|
-
Kt =
|
|
1626
|
+
function Mo() {
|
|
1627
|
+
Kt = hs;
|
|
1597
1628
|
}
|
|
1598
|
-
const
|
|
1599
|
-
function
|
|
1629
|
+
const xo = 6e4;
|
|
1630
|
+
function ko(e) {
|
|
1600
1631
|
return e === "online" || e === "idle" || e === "dnd" || e === "offline";
|
|
1601
1632
|
}
|
|
1602
|
-
function
|
|
1633
|
+
function Lo(e) {
|
|
1603
1634
|
if (typeof e != "string")
|
|
1604
1635
|
return null;
|
|
1605
1636
|
const n = e.trim().toLowerCase();
|
|
1606
|
-
return
|
|
1637
|
+
return ko(n) ? n : null;
|
|
1607
1638
|
}
|
|
1608
|
-
function
|
|
1639
|
+
function ps(e) {
|
|
1609
1640
|
if (typeof e != "string")
|
|
1610
1641
|
return null;
|
|
1611
1642
|
const n = e.trim();
|
|
1612
1643
|
return n.length > 0 ? n : null;
|
|
1613
1644
|
}
|
|
1614
1645
|
function Dt(e) {
|
|
1615
|
-
const n =
|
|
1646
|
+
const n = ps(e);
|
|
1616
1647
|
if (n === null)
|
|
1617
1648
|
return null;
|
|
1618
|
-
const i = n.includes("T") ? n : n.replace(" ", "T"), o = /(?:Z|[+-]\d{2}:\d{2})$/i.test(i) ? i : `${i}Z`,
|
|
1619
|
-
return Number.isNaN(
|
|
1649
|
+
const i = n.includes("T") ? n : n.replace(" ", "T"), o = /(?:Z|[+-]\d{2}:\d{2})$/i.test(i) ? i : `${i}Z`, c = new Date(o);
|
|
1650
|
+
return Number.isNaN(c.getTime()) ? null : c;
|
|
1620
1651
|
}
|
|
1621
|
-
function
|
|
1652
|
+
function Io(e, n, i = {}) {
|
|
1622
1653
|
if (e === null)
|
|
1623
1654
|
return null;
|
|
1624
1655
|
if (e === "offline")
|
|
@@ -1626,31 +1657,31 @@ function ko(e, n, i = {}) {
|
|
|
1626
1657
|
const o = Dt(n);
|
|
1627
1658
|
if (o === null)
|
|
1628
1659
|
return e;
|
|
1629
|
-
const
|
|
1630
|
-
return
|
|
1660
|
+
const c = i.now ?? Date.now(), l = i.staleAfterMs ?? xo;
|
|
1661
|
+
return c - o.getTime() > l ? "offline" : e;
|
|
1631
1662
|
}
|
|
1632
|
-
function
|
|
1633
|
-
const i =
|
|
1663
|
+
function jn(e, n = {}) {
|
|
1664
|
+
const i = ps(e?.last_seen_at), o = Lo(e?.status);
|
|
1634
1665
|
return {
|
|
1635
|
-
status:
|
|
1666
|
+
status: Io(o, i, n),
|
|
1636
1667
|
lastSeenAt: i
|
|
1637
1668
|
};
|
|
1638
1669
|
}
|
|
1639
|
-
const
|
|
1670
|
+
const gs = () => {
|
|
1640
1671
|
};
|
|
1641
|
-
let Qt =
|
|
1642
|
-
function
|
|
1672
|
+
let Qt = gs;
|
|
1673
|
+
function Uo() {
|
|
1643
1674
|
return Qt;
|
|
1644
1675
|
}
|
|
1645
|
-
function
|
|
1676
|
+
function Oo(e) {
|
|
1646
1677
|
Qt = e;
|
|
1647
1678
|
}
|
|
1648
|
-
function
|
|
1649
|
-
Qt =
|
|
1679
|
+
function Fo() {
|
|
1680
|
+
Qt = gs;
|
|
1650
1681
|
}
|
|
1651
|
-
const Ue = Jt()("GlobalMessaging"),
|
|
1652
|
-
function
|
|
1653
|
-
const e = Wt(), n = Fe()(), i =
|
|
1682
|
+
const Ue = Jt()("GlobalMessaging"), No = 3, Do = (e) => e.replace(/\/+$/, ""), qo = (e) => Do(window.location.pathname) === `/messages/${e}`, zo = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
1683
|
+
function Ya() {
|
|
1684
|
+
const e = Wt(), n = Fe()(), i = Uo(), o = fs(), c = Ci(), l = qt(), { conversations: d } = _i(e), g = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map();
|
|
1654
1685
|
let x = !1;
|
|
1655
1686
|
function M(k) {
|
|
1656
1687
|
const O = h.get(k);
|
|
@@ -1672,14 +1703,14 @@ function Ka() {
|
|
|
1672
1703
|
const H = `conversation.${k}`;
|
|
1673
1704
|
M(k);
|
|
1674
1705
|
const F = O.private(H), J = (B) => {
|
|
1675
|
-
if (!
|
|
1706
|
+
if (!Ui(B)) {
|
|
1676
1707
|
Ue.warn("Dropping malformed ConversationMessageSent event", B);
|
|
1677
1708
|
return;
|
|
1678
1709
|
}
|
|
1679
1710
|
const A = B, V = n.currentUser?.id;
|
|
1680
1711
|
if (!V || A.message.author_id === V) return;
|
|
1681
1712
|
e.addMessage(A.message);
|
|
1682
|
-
const ne = e.hasDetailSubscription(A.conversation_id), _e =
|
|
1713
|
+
const ne = e.hasDetailSubscription(A.conversation_id), _e = qo(A.conversation_id);
|
|
1683
1714
|
if (ne || _e) {
|
|
1684
1715
|
const U = e.getConversationById(A.conversation_id);
|
|
1685
1716
|
U && (U.unread_count = 0), e.markAsRead(A.conversation_id).catch(() => {
|
|
@@ -1688,24 +1719,24 @@ function Ka() {
|
|
|
1688
1719
|
}
|
|
1689
1720
|
const R = e.getConversationById(A.conversation_id);
|
|
1690
1721
|
if (R) {
|
|
1691
|
-
const U =
|
|
1722
|
+
const U = zo(R);
|
|
1692
1723
|
U || R.unread_count++, i(U);
|
|
1693
1724
|
}
|
|
1694
1725
|
}, me = (B) => {
|
|
1695
|
-
if (!
|
|
1726
|
+
if (!Oi(B)) {
|
|
1696
1727
|
Ue.warn("Dropping malformed ConversationMessageRead event", B);
|
|
1697
1728
|
return;
|
|
1698
1729
|
}
|
|
1699
1730
|
e.applyParticipantReadState(B);
|
|
1700
1731
|
}, ee = (B) => {
|
|
1701
|
-
if (!
|
|
1732
|
+
if (!Di(B)) {
|
|
1702
1733
|
Ue.warn("Dropping malformed MessageReactionToggled event", B);
|
|
1703
1734
|
return;
|
|
1704
1735
|
}
|
|
1705
1736
|
const A = B;
|
|
1706
1737
|
e.updateMessageReactions(A.conversation_id, A.message_id, A.reactions);
|
|
1707
1738
|
}, b = (B) => {
|
|
1708
|
-
if (!
|
|
1739
|
+
if (!Fi(B)) {
|
|
1709
1740
|
Ue.warn("Dropping malformed ConversationMessageEdited event", B);
|
|
1710
1741
|
return;
|
|
1711
1742
|
}
|
|
@@ -1723,14 +1754,14 @@ function Ka() {
|
|
|
1723
1754
|
body: A.message.body
|
|
1724
1755
|
});
|
|
1725
1756
|
}, I = (B) => {
|
|
1726
|
-
if (!
|
|
1757
|
+
if (!Ni(B)) {
|
|
1727
1758
|
Ue.warn("Dropping malformed ConversationMessageDeleted event", B);
|
|
1728
1759
|
return;
|
|
1729
1760
|
}
|
|
1730
1761
|
const A = B;
|
|
1731
1762
|
e.removeMessage(A.conversation_id, A.message_id);
|
|
1732
1763
|
}, ae = (B) => {
|
|
1733
|
-
if (!
|
|
1764
|
+
if (!qi(B)) {
|
|
1734
1765
|
Ue.warn("Dropping malformed ConversationRequestAccepted event", B);
|
|
1735
1766
|
return;
|
|
1736
1767
|
}
|
|
@@ -1770,7 +1801,7 @@ function Ka() {
|
|
|
1770
1801
|
function w() {
|
|
1771
1802
|
const k = Pe();
|
|
1772
1803
|
if (!k) return;
|
|
1773
|
-
const O = e.conversations.slice(0,
|
|
1804
|
+
const O = e.conversations.slice(0, No), H = new Set(O.map((F) => F.id));
|
|
1774
1805
|
for (const F of g)
|
|
1775
1806
|
if (!H.has(F) && !e.hasDetailSubscription(F)) {
|
|
1776
1807
|
try {
|
|
@@ -1783,7 +1814,7 @@ function Ka() {
|
|
|
1783
1814
|
T(F.id);
|
|
1784
1815
|
}
|
|
1785
1816
|
function C(k) {
|
|
1786
|
-
const O =
|
|
1817
|
+
const O = jn({
|
|
1787
1818
|
status: k.status,
|
|
1788
1819
|
last_seen_at: k.last_seen_at ?? null
|
|
1789
1820
|
});
|
|
@@ -1803,7 +1834,7 @@ function Ka() {
|
|
|
1803
1834
|
params: { ids: k }
|
|
1804
1835
|
}), H = O.data?.data?.items ?? O.data?.items ?? [];
|
|
1805
1836
|
for (const F of H) {
|
|
1806
|
-
const J =
|
|
1837
|
+
const J = jn(F);
|
|
1807
1838
|
J.status !== null && e.updatePresenceForUser(F.id, J.status, J.lastSeenAt);
|
|
1808
1839
|
}
|
|
1809
1840
|
} catch (O) {
|
|
@@ -1811,34 +1842,34 @@ function Ka() {
|
|
|
1811
1842
|
}
|
|
1812
1843
|
}
|
|
1813
1844
|
function m() {
|
|
1814
|
-
!Pe() || x || (
|
|
1845
|
+
!Pe() || x || (Ai(C), x = !0);
|
|
1815
1846
|
}
|
|
1816
1847
|
function v() {
|
|
1817
|
-
x && (
|
|
1848
|
+
x && (Ri(), x = !1);
|
|
1818
1849
|
}
|
|
1819
1850
|
const N = Ut(
|
|
1820
|
-
|
|
1851
|
+
d,
|
|
1821
1852
|
() => {
|
|
1822
1853
|
w();
|
|
1823
1854
|
},
|
|
1824
1855
|
{ deep: !1, immediate: !0 }
|
|
1825
1856
|
), q = Ut(
|
|
1826
|
-
() =>
|
|
1857
|
+
() => c.fullPath,
|
|
1827
1858
|
() => {
|
|
1828
1859
|
w();
|
|
1829
1860
|
}
|
|
1830
1861
|
), G = ht((k) => {
|
|
1831
1862
|
k === "connected" ? (_(), w(), v(), m(), f()) : (k === "disconnected" || k === "error") && (_(), v());
|
|
1832
1863
|
});
|
|
1833
|
-
w(), m(), f(),
|
|
1864
|
+
w(), m(), f(), l !== null && De(() => {
|
|
1834
1865
|
N(), q(), G(), y(), v();
|
|
1835
1866
|
});
|
|
1836
1867
|
}
|
|
1837
|
-
function
|
|
1868
|
+
function Za() {
|
|
1838
1869
|
const e = ve(Ot());
|
|
1839
1870
|
let n = null;
|
|
1840
1871
|
return zt(() => {
|
|
1841
|
-
e.value = Ot(), n =
|
|
1872
|
+
e.value = Ot(), n = Ti((i) => {
|
|
1842
1873
|
e.value = i;
|
|
1843
1874
|
});
|
|
1844
1875
|
}), De(() => {
|
|
@@ -1849,7 +1880,7 @@ function Qa() {
|
|
|
1849
1880
|
isSuspended: ie(() => e.value === "account_suspended")
|
|
1850
1881
|
};
|
|
1851
1882
|
}
|
|
1852
|
-
const
|
|
1883
|
+
const ms = () => null, vs = {
|
|
1853
1884
|
sessionOpenUrl: "/v1/presence/session/open",
|
|
1854
1885
|
sessionHeartbeatUrl: "/v1/presence/heartbeat",
|
|
1855
1886
|
sessionCloseUrl: "/v1/presence/session/close",
|
|
@@ -1860,29 +1891,29 @@ const gs = () => null, ms = {
|
|
|
1860
1891
|
activityDebounceMs: 5e3,
|
|
1861
1892
|
heartbeatIntervalMs: 3e4,
|
|
1862
1893
|
userAgentResolver: () => navigator.userAgent.slice(0, 256),
|
|
1863
|
-
authTokenResolver:
|
|
1894
|
+
authTokenResolver: ms
|
|
1864
1895
|
};
|
|
1865
|
-
let lt = { ...
|
|
1866
|
-
function
|
|
1896
|
+
let lt = { ...vs };
|
|
1897
|
+
function jo() {
|
|
1867
1898
|
return lt;
|
|
1868
1899
|
}
|
|
1869
|
-
function
|
|
1900
|
+
function $o(e) {
|
|
1870
1901
|
lt = {
|
|
1871
1902
|
...lt,
|
|
1872
1903
|
...e
|
|
1873
1904
|
};
|
|
1874
1905
|
}
|
|
1875
|
-
function
|
|
1876
|
-
lt = { ...
|
|
1906
|
+
function Ho() {
|
|
1907
|
+
lt = { ...vs };
|
|
1877
1908
|
}
|
|
1878
|
-
function
|
|
1879
|
-
return e.authTokenResolver !==
|
|
1909
|
+
function Bo(e) {
|
|
1910
|
+
return e.authTokenResolver !== ms;
|
|
1880
1911
|
}
|
|
1881
|
-
const
|
|
1912
|
+
const Vo = 429, Xo = 403, Wo = 423, Go = "ACCOUNT_LIMITED", Jo = "ACCOUNT_SUSPENDED", Ko = "ACCOUNT_WRITE_TIMEOUT", Qo = 2, Yo = 5 * 6e4;
|
|
1882
1913
|
function Xe(e) {
|
|
1883
1914
|
return typeof e == "object" && e !== null;
|
|
1884
1915
|
}
|
|
1885
|
-
function
|
|
1916
|
+
function bs(e) {
|
|
1886
1917
|
if (!Xe(e))
|
|
1887
1918
|
return null;
|
|
1888
1919
|
const n = e.response;
|
|
@@ -1897,7 +1928,7 @@ function vs(e) {
|
|
|
1897
1928
|
}
|
|
1898
1929
|
return null;
|
|
1899
1930
|
}
|
|
1900
|
-
function
|
|
1931
|
+
function ys(e) {
|
|
1901
1932
|
if (!Xe(e))
|
|
1902
1933
|
return null;
|
|
1903
1934
|
const n = e.response;
|
|
@@ -1907,24 +1938,24 @@ function bs(e) {
|
|
|
1907
1938
|
return Xe(i) && typeof i.code == "string" ? i.code : null;
|
|
1908
1939
|
}
|
|
1909
1940
|
function xt(e) {
|
|
1910
|
-
const n =
|
|
1911
|
-
return n ===
|
|
1941
|
+
const n = bs(e), i = ys(e);
|
|
1942
|
+
return n === Vo && i === Go || n === Wo && i === Ko;
|
|
1912
1943
|
}
|
|
1913
1944
|
function kt(e) {
|
|
1914
|
-
const n =
|
|
1915
|
-
return n ===
|
|
1945
|
+
const n = bs(e), i = ys(e);
|
|
1946
|
+
return n === Xo && i === Jo ? !0 : e instanceof Error ? e.message.toLowerCase().includes("suspended") : !1;
|
|
1916
1947
|
}
|
|
1917
1948
|
function Ge() {
|
|
1918
1949
|
return typeof sessionStorage > "u" ? null : sessionStorage;
|
|
1919
1950
|
}
|
|
1920
|
-
function
|
|
1951
|
+
function Zo(e) {
|
|
1921
1952
|
const n = Ge(), i = n?.getItem(e);
|
|
1922
1953
|
if (i)
|
|
1923
1954
|
return i;
|
|
1924
1955
|
const o = `web-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
1925
1956
|
return n?.setItem(e, o), o;
|
|
1926
1957
|
}
|
|
1927
|
-
function
|
|
1958
|
+
function ea(e) {
|
|
1928
1959
|
const n = Ge(), i = n?.getItem(e);
|
|
1929
1960
|
if (!i)
|
|
1930
1961
|
return null;
|
|
@@ -1932,19 +1963,19 @@ function Yo(e) {
|
|
|
1932
1963
|
return Number.isFinite(o) ? o : (n?.removeItem(e), null);
|
|
1933
1964
|
}
|
|
1934
1965
|
function Lt(e, n = Date.now()) {
|
|
1935
|
-
const i = Ge(), o =
|
|
1966
|
+
const i = Ge(), o = ea(e);
|
|
1936
1967
|
return o === null ? !1 : o <= n ? (i?.removeItem(e), !1) : !0;
|
|
1937
1968
|
}
|
|
1938
|
-
function
|
|
1939
|
-
Ge()?.setItem(e, String(n +
|
|
1969
|
+
function ta(e, n = Date.now()) {
|
|
1970
|
+
Ge()?.setItem(e, String(n + Yo));
|
|
1940
1971
|
}
|
|
1941
|
-
function
|
|
1972
|
+
function na(e) {
|
|
1942
1973
|
Ge()?.removeItem(e);
|
|
1943
1974
|
}
|
|
1944
|
-
function
|
|
1975
|
+
function sa(e) {
|
|
1945
1976
|
return e.startsWith("/v1/") ? `/api${e}` : e;
|
|
1946
1977
|
}
|
|
1947
|
-
function
|
|
1978
|
+
function ra(e, n, i) {
|
|
1948
1979
|
if (typeof fetch > "u")
|
|
1949
1980
|
return null;
|
|
1950
1981
|
const o = {
|
|
@@ -1953,7 +1984,7 @@ function na(e, n, i) {
|
|
|
1953
1984
|
};
|
|
1954
1985
|
i && (o.Authorization = `Bearer ${i}`);
|
|
1955
1986
|
try {
|
|
1956
|
-
return fetch(
|
|
1987
|
+
return fetch(sa(e), {
|
|
1957
1988
|
method: "POST",
|
|
1958
1989
|
headers: o,
|
|
1959
1990
|
body: JSON.stringify({ client_id: n }),
|
|
@@ -1965,21 +1996,21 @@ function na(e, n, i) {
|
|
|
1965
1996
|
return null;
|
|
1966
1997
|
}
|
|
1967
1998
|
}
|
|
1968
|
-
function
|
|
1969
|
-
const e = Fe()(), n =
|
|
1970
|
-
let
|
|
1971
|
-
const T = () =>
|
|
1972
|
-
|
|
1999
|
+
function ec() {
|
|
2000
|
+
const e = Fe()(), n = jo(), i = fs(), o = Zo(n.clientIdStorageKey);
|
|
2001
|
+
let c = null, l = null, d = !1, g = Lt(n.accountLimitedUntilStorageKey), h = !1, x = !1, M = null, _ = 0;
|
|
2002
|
+
const T = () => Bo(n) ? n.authTokenResolver() !== null : !0, y = () => {
|
|
2003
|
+
c && (clearInterval(c), c = null);
|
|
1973
2004
|
}, w = () => {
|
|
1974
|
-
|
|
2005
|
+
l && (clearTimeout(l), l = null);
|
|
1975
2006
|
}, C = () => {
|
|
1976
|
-
y(),
|
|
2007
|
+
y(), c = setInterval(() => {
|
|
1977
2008
|
F();
|
|
1978
2009
|
}, n.heartbeatIntervalMs);
|
|
1979
2010
|
}, f = (I) => {
|
|
1980
|
-
g || console.warn(I),
|
|
2011
|
+
g || console.warn(I), ta(n.accountLimitedUntilStorageKey), g = !0, d = !1, M = null, y(), w();
|
|
1981
2012
|
}, m = async (I) => {
|
|
1982
|
-
if (!(!
|
|
2013
|
+
if (!(!d || x || g || h) && T() && M !== I)
|
|
1983
2014
|
try {
|
|
1984
2015
|
await i.patch(n.statusUrl, { status: I }), M = I;
|
|
1985
2016
|
} catch (ae) {
|
|
@@ -1987,14 +2018,14 @@ function Ya() {
|
|
|
1987
2018
|
f("[Presence] Presence updates paused: account is temporarily limited");
|
|
1988
2019
|
return;
|
|
1989
2020
|
}
|
|
1990
|
-
kt(ae) && (h = !0,
|
|
2021
|
+
kt(ae) && (h = !0, d = !1, M = null, y(), w());
|
|
1991
2022
|
}
|
|
1992
2023
|
}, v = () => {
|
|
1993
|
-
w(), !(!
|
|
1994
|
-
|
|
2024
|
+
w(), !(!d || x || g || h || document.visibilityState !== "visible") && (l = setTimeout(() => {
|
|
2025
|
+
l = null, m("idle");
|
|
1995
2026
|
}, n.idleAfterMs));
|
|
1996
2027
|
}, N = () => {
|
|
1997
|
-
if (x || !
|
|
2028
|
+
if (x || !d || g || h || document.visibilityState !== "visible")
|
|
1998
2029
|
return;
|
|
1999
2030
|
const I = Date.now();
|
|
2000
2031
|
I - _ < n.activityDebounceMs || (_ = I, m("online"), v());
|
|
@@ -2011,17 +2042,17 @@ function Ya() {
|
|
|
2011
2042
|
return await i.post(n.sessionOpenUrl, {
|
|
2012
2043
|
client_id: o,
|
|
2013
2044
|
user_agent: n.userAgentResolver()
|
|
2014
|
-
}),
|
|
2045
|
+
}), na(n.accountLimitedUntilStorageKey), g = !1, h = !1, d = !0, M = null, "opened";
|
|
2015
2046
|
} catch (I) {
|
|
2016
|
-
return xt(I) ? (f("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : kt(I) ? (h = !0,
|
|
2047
|
+
return xt(I) ? (f("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : kt(I) ? (h = !0, d = !1, M = null, y(), w(), "account_suspended") : "failed";
|
|
2017
2048
|
}
|
|
2018
2049
|
}, H = async () => {
|
|
2019
|
-
for (let I = 0; I <
|
|
2050
|
+
for (let I = 0; I < Qo; I += 1)
|
|
2020
2051
|
if (await O() !== "failed")
|
|
2021
2052
|
return;
|
|
2022
2053
|
console.warn("[Presence] Failed to open session");
|
|
2023
2054
|
}, F = async () => {
|
|
2024
|
-
if (
|
|
2055
|
+
if (d && T())
|
|
2025
2056
|
try {
|
|
2026
2057
|
await i.post(n.sessionHeartbeatUrl, { client_id: o });
|
|
2027
2058
|
} catch (I) {
|
|
@@ -2029,13 +2060,13 @@ function Ya() {
|
|
|
2029
2060
|
f("[Presence] Heartbeat paused: account is temporarily limited");
|
|
2030
2061
|
return;
|
|
2031
2062
|
}
|
|
2032
|
-
kt(I) && (h = !0,
|
|
2063
|
+
kt(I) && (h = !0, d = !1, M = null, y(), w());
|
|
2033
2064
|
}
|
|
2034
2065
|
}, J = () => {
|
|
2035
|
-
if (!
|
|
2066
|
+
if (!d)
|
|
2036
2067
|
return;
|
|
2037
|
-
|
|
2038
|
-
const I =
|
|
2068
|
+
d = !1, M = null, w();
|
|
2069
|
+
const I = ra(
|
|
2039
2070
|
n.sessionCloseUrl,
|
|
2040
2071
|
o,
|
|
2041
2072
|
n.authTokenResolver()
|
|
@@ -2053,7 +2084,7 @@ function Ya() {
|
|
|
2053
2084
|
J();
|
|
2054
2085
|
return;
|
|
2055
2086
|
}
|
|
2056
|
-
|
|
2087
|
+
d && (C(), m("online"), v());
|
|
2057
2088
|
}
|
|
2058
2089
|
}, ee = () => {
|
|
2059
2090
|
if (!x) {
|
|
@@ -2061,11 +2092,11 @@ function Ya() {
|
|
|
2061
2092
|
J(), y(), w();
|
|
2062
2093
|
return;
|
|
2063
2094
|
}
|
|
2064
|
-
if (document.visibilityState === "visible" && !
|
|
2095
|
+
if (document.visibilityState === "visible" && !d) {
|
|
2065
2096
|
g = Lt(n.accountLimitedUntilStorageKey), !g && !h && me();
|
|
2066
2097
|
return;
|
|
2067
2098
|
}
|
|
2068
|
-
document.visibilityState === "visible" &&
|
|
2099
|
+
document.visibilityState === "visible" && d && !g && !h && N();
|
|
2069
2100
|
}
|
|
2070
2101
|
}, b = () => {
|
|
2071
2102
|
x || (J(), y(), w());
|
|
@@ -2076,27 +2107,27 @@ function Ya() {
|
|
|
2076
2107
|
J();
|
|
2077
2108
|
return;
|
|
2078
2109
|
}
|
|
2079
|
-
|
|
2110
|
+
d && (C(), m("online"), v()), G(), document.addEventListener("visibilitychange", ee), window.addEventListener("pagehide", b), window.addEventListener("beforeunload", b);
|
|
2080
2111
|
}
|
|
2081
2112
|
}), De(() => {
|
|
2082
2113
|
x = !0, k(), w(), y(), J(), document.removeEventListener("visibilitychange", ee), window.removeEventListener("pagehide", b), window.removeEventListener("beforeunload", b);
|
|
2083
2114
|
});
|
|
2084
2115
|
}
|
|
2085
|
-
const
|
|
2086
|
-
function
|
|
2087
|
-
const n = Wt(), i = Fe()(), o = ve(!1),
|
|
2116
|
+
const ia = 12e3;
|
|
2117
|
+
function tc(e) {
|
|
2118
|
+
const n = Wt(), i = Fe()(), o = ve(!1), c = ve(null), l = ve(null), d = ve([]), g = /* @__PURE__ */ new Map(), h = qt(), x = h !== null, M = 20, _ = 250;
|
|
2088
2119
|
let T = !1, y = null, w = 0, C = null;
|
|
2089
|
-
const f = ie(() => i.currentUser?.id), m = () =>
|
|
2090
|
-
const R =
|
|
2120
|
+
const f = ie(() => i.currentUser?.id), m = () => Vn(e)?.trim() ?? "", v = () => {
|
|
2121
|
+
const R = l.value?.trim() ?? "";
|
|
2091
2122
|
if (R.length > 0)
|
|
2092
2123
|
return R;
|
|
2093
2124
|
const U = m();
|
|
2094
|
-
return U.length > 0 && (
|
|
2125
|
+
return U.length > 0 && (l.value = U), U;
|
|
2095
2126
|
}, N = (R) => n.getTypingUsers(R), q = (R) => {
|
|
2096
2127
|
const U = N(R);
|
|
2097
2128
|
for (const re of U)
|
|
2098
2129
|
n.removeTypingUser(R, re.id);
|
|
2099
|
-
|
|
2130
|
+
d.value = [];
|
|
2100
2131
|
}, G = (R) => {
|
|
2101
2132
|
const U = g.get(R);
|
|
2102
2133
|
U && (clearTimeout(U), g.delete(R));
|
|
@@ -2113,28 +2144,28 @@ function Za(e) {
|
|
|
2113
2144
|
}, F = (R, U) => {
|
|
2114
2145
|
G(R);
|
|
2115
2146
|
const re = setTimeout(() => {
|
|
2116
|
-
g.delete(R), n.removeTypingUser(U, R),
|
|
2117
|
-
},
|
|
2147
|
+
g.delete(R), n.removeTypingUser(U, R), d.value = d.value.filter((fe) => fe.id !== R);
|
|
2148
|
+
}, ia);
|
|
2118
2149
|
g.set(R, re);
|
|
2119
2150
|
}, J = () => {
|
|
2120
2151
|
T = !0, O();
|
|
2121
2152
|
}, me = (R) => {
|
|
2122
2153
|
try {
|
|
2123
|
-
y && (y(), y = null), y =
|
|
2154
|
+
y && (y(), y = null), y = xi(R, {
|
|
2124
2155
|
onTypingStart: I,
|
|
2125
2156
|
onTypingStop: ae
|
|
2126
|
-
}), O(), o.value = !0,
|
|
2157
|
+
}), O(), o.value = !0, l.value = R;
|
|
2127
2158
|
} catch (U) {
|
|
2128
|
-
|
|
2159
|
+
c.value = U instanceof Error ? U.message : "Failed to subscribe to typing channel";
|
|
2129
2160
|
}
|
|
2130
2161
|
}, ee = () => {
|
|
2131
2162
|
const R = m();
|
|
2132
2163
|
if (!(o.value || !R)) {
|
|
2133
|
-
if (
|
|
2164
|
+
if (c.value = null, Pe() && wn() === "connected") {
|
|
2134
2165
|
me(R);
|
|
2135
2166
|
return;
|
|
2136
2167
|
}
|
|
2137
|
-
T = !1,
|
|
2168
|
+
T = !1, wi().then((U) => {
|
|
2138
2169
|
if (T || o.value || !U)
|
|
2139
2170
|
return;
|
|
2140
2171
|
const re = m();
|
|
@@ -2146,12 +2177,12 @@ function Za(e) {
|
|
|
2146
2177
|
}), H();
|
|
2147
2178
|
}
|
|
2148
2179
|
}, b = () => {
|
|
2149
|
-
const R =
|
|
2180
|
+
const R = l.value;
|
|
2150
2181
|
if (J(), !(!o.value || !R))
|
|
2151
2182
|
try {
|
|
2152
|
-
y && (y(), y = null),
|
|
2183
|
+
y && (y(), y = null), ki(R), k(), q(R), o.value = !1, l.value = null, c.value = null;
|
|
2153
2184
|
} catch (U) {
|
|
2154
|
-
|
|
2185
|
+
c.value = U instanceof Error ? U.message : "Failed to unsubscribe from typing channel";
|
|
2155
2186
|
}
|
|
2156
2187
|
};
|
|
2157
2188
|
function I(R) {
|
|
@@ -2165,28 +2196,28 @@ function Za(e) {
|
|
|
2165
2196
|
name: R.user.name,
|
|
2166
2197
|
...R.user.avatar !== void 0 ? { avatar: R.user.avatar } : {}
|
|
2167
2198
|
};
|
|
2168
|
-
|
|
2199
|
+
d.value.some((fe) => fe.id === re.id) || (d.value = [...d.value, re]), n.addTypingUser(U, re), F(R.user_id, U);
|
|
2169
2200
|
}
|
|
2170
2201
|
function ae(R) {
|
|
2171
2202
|
if (R.user_id === f.value)
|
|
2172
2203
|
return;
|
|
2173
2204
|
G(R.user_id);
|
|
2174
2205
|
const U = v();
|
|
2175
|
-
U && (
|
|
2206
|
+
U && (d.value = d.value.filter((re) => re.id !== R.user_id), n.removeTypingUser(U, R.user_id));
|
|
2176
2207
|
}
|
|
2177
2208
|
const B = ie(() => {
|
|
2178
2209
|
const R = v();
|
|
2179
2210
|
if (!R)
|
|
2180
|
-
return
|
|
2211
|
+
return d.value;
|
|
2181
2212
|
const U = N(R);
|
|
2182
|
-
if (
|
|
2213
|
+
if (d.value.length === 0)
|
|
2183
2214
|
return U;
|
|
2184
2215
|
if (U.length === 0)
|
|
2185
|
-
return
|
|
2216
|
+
return d.value;
|
|
2186
2217
|
const re = /* @__PURE__ */ new Map();
|
|
2187
2218
|
for (const fe of U)
|
|
2188
2219
|
re.set(fe.id, fe);
|
|
2189
|
-
for (const fe of
|
|
2220
|
+
for (const fe of d.value)
|
|
2190
2221
|
re.set(fe.id, fe);
|
|
2191
2222
|
return [...re.values()];
|
|
2192
2223
|
}), A = ie(() => {
|
|
@@ -2217,14 +2248,14 @@ function Za(e) {
|
|
|
2217
2248
|
if (R === "disconnected" || R === "error") {
|
|
2218
2249
|
J(), y && (y(), y = null);
|
|
2219
2250
|
const U = v();
|
|
2220
|
-
U && q(U), o.value = !1,
|
|
2251
|
+
U && q(U), o.value = !1, l.value = null, k();
|
|
2221
2252
|
}
|
|
2222
2253
|
});
|
|
2223
2254
|
return h !== null && De(() => {
|
|
2224
2255
|
J(), _e(), k(), b(), typeof window < "u" && window.removeEventListener(We(), ne);
|
|
2225
2256
|
}), {
|
|
2226
2257
|
isSubscribed: ie(() => o.value),
|
|
2227
|
-
error: ie(() =>
|
|
2258
|
+
error: ie(() => c.value),
|
|
2228
2259
|
typingUsers: B,
|
|
2229
2260
|
formatTypingIndicator: A,
|
|
2230
2261
|
hasTypingUsers: V,
|
|
@@ -2232,11 +2263,11 @@ function Za(e) {
|
|
|
2232
2263
|
unsubscribe: b
|
|
2233
2264
|
};
|
|
2234
2265
|
}
|
|
2235
|
-
function
|
|
2236
|
-
e.apiClient &&
|
|
2266
|
+
function nc(e) {
|
|
2267
|
+
e.apiClient && zi(e.apiClient), e.mainApiClient && Po(e.mainApiClient), e.authStore && $i(e.authStore), e.mediaApi && Vi(e.mediaApi), e.createLogger && To(e.createLogger), e.playMessageNotification && Oo(e.playMessageNotification), e.echo && Li(e.echo), e.mainEcho && So(e.mainEcho), e.presence && $o(e.presence);
|
|
2237
2268
|
}
|
|
2238
|
-
function
|
|
2239
|
-
|
|
2269
|
+
function sc() {
|
|
2270
|
+
ji(), Mo(), Hi(), Xi(), Eo(), Fo(), Ii(), Co(), Ho();
|
|
2240
2271
|
}
|
|
2241
2272
|
class Yt {
|
|
2242
2273
|
constructor() {
|
|
@@ -2267,7 +2298,7 @@ class Yt {
|
|
|
2267
2298
|
return this.stopListening(".client-" + n, i);
|
|
2268
2299
|
}
|
|
2269
2300
|
}
|
|
2270
|
-
class
|
|
2301
|
+
class _s {
|
|
2271
2302
|
/**
|
|
2272
2303
|
* Create a new class instance.
|
|
2273
2304
|
*/
|
|
@@ -2287,7 +2318,7 @@ class ys {
|
|
|
2287
2318
|
this.namespace = n;
|
|
2288
2319
|
}
|
|
2289
2320
|
}
|
|
2290
|
-
function
|
|
2321
|
+
function oa(e) {
|
|
2291
2322
|
try {
|
|
2292
2323
|
new e();
|
|
2293
2324
|
} catch (n) {
|
|
@@ -2301,7 +2332,7 @@ class Zt extends Yt {
|
|
|
2301
2332
|
* Create a new class instance.
|
|
2302
2333
|
*/
|
|
2303
2334
|
constructor(n, i, o) {
|
|
2304
|
-
super(), this.name = i, this.pusher = n, this.options = o, this.eventFormatter = new
|
|
2335
|
+
super(), this.name = i, this.pusher = n, this.options = o, this.eventFormatter = new _s(this.options.namespace), this.subscribe();
|
|
2305
2336
|
}
|
|
2306
2337
|
/**
|
|
2307
2338
|
* Subscribe to a Pusher channel.
|
|
@@ -2328,11 +2359,11 @@ class Zt extends Yt {
|
|
|
2328
2359
|
return this.subscription.bind_global((i, o) => {
|
|
2329
2360
|
if (i.startsWith("pusher:"))
|
|
2330
2361
|
return;
|
|
2331
|
-
let
|
|
2362
|
+
let c = String(this.options.namespace ?? "").replace(
|
|
2332
2363
|
/\./g,
|
|
2333
2364
|
"\\"
|
|
2334
|
-
),
|
|
2335
|
-
n(
|
|
2365
|
+
), l = i.startsWith(c) ? i.substring(c.length + 1) : "." + i;
|
|
2366
|
+
n(l, o);
|
|
2336
2367
|
}), this;
|
|
2337
2368
|
}
|
|
2338
2369
|
/**
|
|
@@ -2373,7 +2404,7 @@ class Zt extends Yt {
|
|
|
2373
2404
|
return this.subscription.bind(n, i), this;
|
|
2374
2405
|
}
|
|
2375
2406
|
}
|
|
2376
|
-
class
|
|
2407
|
+
class Ss extends Zt {
|
|
2377
2408
|
/**
|
|
2378
2409
|
* Send a whisper event to other clients in the channel.
|
|
2379
2410
|
*/
|
|
@@ -2384,7 +2415,7 @@ class _s extends Zt {
|
|
|
2384
2415
|
), this;
|
|
2385
2416
|
}
|
|
2386
2417
|
}
|
|
2387
|
-
class
|
|
2418
|
+
class aa extends Zt {
|
|
2388
2419
|
/**
|
|
2389
2420
|
* Send a whisper event to other clients in the channel.
|
|
2390
2421
|
*/
|
|
@@ -2395,7 +2426,7 @@ class ia extends Zt {
|
|
|
2395
2426
|
), this;
|
|
2396
2427
|
}
|
|
2397
2428
|
}
|
|
2398
|
-
class
|
|
2429
|
+
class ca extends Ss {
|
|
2399
2430
|
/**
|
|
2400
2431
|
* Register a callback to be called anytime the member list changes.
|
|
2401
2432
|
*/
|
|
@@ -2430,12 +2461,12 @@ class oa extends _s {
|
|
|
2430
2461
|
}), this;
|
|
2431
2462
|
}
|
|
2432
2463
|
}
|
|
2433
|
-
class
|
|
2464
|
+
class Cs extends Yt {
|
|
2434
2465
|
/**
|
|
2435
2466
|
* Create a new class instance.
|
|
2436
2467
|
*/
|
|
2437
2468
|
constructor(n, i, o) {
|
|
2438
|
-
super(), this.events = {}, this.listeners = {}, this.name = i, this.socket = n, this.options = o, this.eventFormatter = new
|
|
2469
|
+
super(), this.events = {}, this.listeners = {}, this.name = i, this.socket = n, this.options = o, this.eventFormatter = new _s(this.options.namespace), this.subscribe();
|
|
2439
2470
|
}
|
|
2440
2471
|
/**
|
|
2441
2472
|
* Subscribe to a Socket.io channel.
|
|
@@ -2485,8 +2516,8 @@ class Ss extends Yt {
|
|
|
2485
2516
|
* Bind the channel's socket to an event and store the callback.
|
|
2486
2517
|
*/
|
|
2487
2518
|
on(n, i) {
|
|
2488
|
-
return this.listeners[n] = this.listeners[n] || [], this.events[n] || (this.events[n] = (o,
|
|
2489
|
-
this.name === o && this.listeners[n] && this.listeners[n].forEach((
|
|
2519
|
+
return this.listeners[n] = this.listeners[n] || [], this.events[n] || (this.events[n] = (o, c) => {
|
|
2520
|
+
this.name === o && this.listeners[n] && this.listeners[n].forEach((l) => l(c));
|
|
2490
2521
|
}, this.socket.on(n, this.events[n])), this.listeners[n].push(i), this;
|
|
2491
2522
|
}
|
|
2492
2523
|
/**
|
|
@@ -2506,7 +2537,7 @@ class Ss extends Yt {
|
|
|
2506
2537
|
)), (!i || this.listeners[n].length === 0) && (this.events[n] && (this.socket.removeListener(n, this.events[n]), delete this.events[n]), delete this.listeners[n]);
|
|
2507
2538
|
}
|
|
2508
2539
|
}
|
|
2509
|
-
class
|
|
2540
|
+
class ws extends Cs {
|
|
2510
2541
|
/**
|
|
2511
2542
|
* Send a whisper event to other clients in the channel.
|
|
2512
2543
|
*/
|
|
@@ -2518,7 +2549,7 @@ class Cs extends Ss {
|
|
|
2518
2549
|
}), this;
|
|
2519
2550
|
}
|
|
2520
2551
|
}
|
|
2521
|
-
class
|
|
2552
|
+
class ua extends ws {
|
|
2522
2553
|
/**
|
|
2523
2554
|
* Register a callback to be called anytime the member list changes.
|
|
2524
2555
|
*/
|
|
@@ -2604,7 +2635,7 @@ class dt extends Yt {
|
|
|
2604
2635
|
return this;
|
|
2605
2636
|
}
|
|
2606
2637
|
}
|
|
2607
|
-
class
|
|
2638
|
+
class Ts extends dt {
|
|
2608
2639
|
/**
|
|
2609
2640
|
* Send a whisper event to other clients in the channel.
|
|
2610
2641
|
*/
|
|
@@ -2612,7 +2643,7 @@ class ws extends dt {
|
|
|
2612
2643
|
return this;
|
|
2613
2644
|
}
|
|
2614
2645
|
}
|
|
2615
|
-
class
|
|
2646
|
+
class la extends dt {
|
|
2616
2647
|
/**
|
|
2617
2648
|
* Send a whisper event to other clients in the channel.
|
|
2618
2649
|
*/
|
|
@@ -2620,7 +2651,7 @@ class ca extends dt {
|
|
|
2620
2651
|
return this;
|
|
2621
2652
|
}
|
|
2622
2653
|
}
|
|
2623
|
-
class
|
|
2654
|
+
class da extends Ts {
|
|
2624
2655
|
/**
|
|
2625
2656
|
* Register a callback to be called anytime the member list changes.
|
|
2626
2657
|
*/
|
|
@@ -2646,7 +2677,7 @@ class ua extends ws {
|
|
|
2646
2677
|
return this;
|
|
2647
2678
|
}
|
|
2648
2679
|
}
|
|
2649
|
-
const
|
|
2680
|
+
const Es = class As {
|
|
2650
2681
|
/**
|
|
2651
2682
|
* Create a new class instance.
|
|
2652
2683
|
*/
|
|
@@ -2658,7 +2689,7 @@ const Ts = class Es {
|
|
|
2658
2689
|
*/
|
|
2659
2690
|
setOptions(n) {
|
|
2660
2691
|
this.options = {
|
|
2661
|
-
...
|
|
2692
|
+
...As._defaultOptions,
|
|
2662
2693
|
...n,
|
|
2663
2694
|
broadcaster: n.broadcaster
|
|
2664
2695
|
};
|
|
@@ -2673,7 +2704,7 @@ const Ts = class Es {
|
|
|
2673
2704
|
return typeof window < "u" && (n = window.Laravel) != null && n.csrfToken ? window.Laravel.csrfToken : this.options.csrfToken ? this.options.csrfToken : typeof document < "u" && typeof document.querySelector == "function" ? ((i = document.querySelector('meta[name="csrf-token"]')) == null ? void 0 : i.getAttribute("content")) ?? null : null;
|
|
2674
2705
|
}
|
|
2675
2706
|
};
|
|
2676
|
-
|
|
2707
|
+
Es._defaultOptions = {
|
|
2677
2708
|
auth: {
|
|
2678
2709
|
headers: {}
|
|
2679
2710
|
},
|
|
@@ -2688,7 +2719,7 @@ Ts._defaultOptions = {
|
|
|
2688
2719
|
key: null,
|
|
2689
2720
|
namespace: "App.Events"
|
|
2690
2721
|
};
|
|
2691
|
-
let en =
|
|
2722
|
+
let en = Es;
|
|
2692
2723
|
class ot extends en {
|
|
2693
2724
|
constructor() {
|
|
2694
2725
|
super(...arguments), this.channels = {};
|
|
@@ -2737,7 +2768,7 @@ class ot extends en {
|
|
|
2737
2768
|
* Get a private channel instance by name.
|
|
2738
2769
|
*/
|
|
2739
2770
|
privateChannel(n) {
|
|
2740
|
-
return this.channels["private-" + n] || (this.channels["private-" + n] = new
|
|
2771
|
+
return this.channels["private-" + n] || (this.channels["private-" + n] = new Ss(
|
|
2741
2772
|
this.pusher,
|
|
2742
2773
|
"private-" + n,
|
|
2743
2774
|
this.options
|
|
@@ -2747,7 +2778,7 @@ class ot extends en {
|
|
|
2747
2778
|
* Get a private encrypted channel instance by name.
|
|
2748
2779
|
*/
|
|
2749
2780
|
encryptedPrivateChannel(n) {
|
|
2750
|
-
return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new
|
|
2781
|
+
return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new aa(
|
|
2751
2782
|
this.pusher,
|
|
2752
2783
|
"private-encrypted-" + n,
|
|
2753
2784
|
this.options
|
|
@@ -2757,7 +2788,7 @@ class ot extends en {
|
|
|
2757
2788
|
* Get a presence channel instance by name.
|
|
2758
2789
|
*/
|
|
2759
2790
|
presenceChannel(n) {
|
|
2760
|
-
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new
|
|
2791
|
+
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new ca(
|
|
2761
2792
|
this.pusher,
|
|
2762
2793
|
"presence-" + n,
|
|
2763
2794
|
this.options
|
|
@@ -2811,11 +2842,11 @@ class ot extends en {
|
|
|
2811
2842
|
const i = () => {
|
|
2812
2843
|
n(this.connectionStatus());
|
|
2813
2844
|
}, o = ["state_change", "connected", "disconnected"];
|
|
2814
|
-
return o.forEach((
|
|
2815
|
-
this.pusher.connection.bind(
|
|
2845
|
+
return o.forEach((c) => {
|
|
2846
|
+
this.pusher.connection.bind(c, i);
|
|
2816
2847
|
}), () => {
|
|
2817
|
-
o.forEach((
|
|
2818
|
-
this.pusher.connection.unbind(
|
|
2848
|
+
o.forEach((c) => {
|
|
2849
|
+
this.pusher.connection.unbind(c, i);
|
|
2819
2850
|
});
|
|
2820
2851
|
};
|
|
2821
2852
|
}
|
|
@@ -2826,7 +2857,7 @@ class ot extends en {
|
|
|
2826
2857
|
this.pusher.disconnect();
|
|
2827
2858
|
}
|
|
2828
2859
|
}
|
|
2829
|
-
class
|
|
2860
|
+
class ha extends en {
|
|
2830
2861
|
constructor() {
|
|
2831
2862
|
super(...arguments), this.channels = {};
|
|
2832
2863
|
}
|
|
@@ -2866,7 +2897,7 @@ class la extends en {
|
|
|
2866
2897
|
* Get a channel instance by name.
|
|
2867
2898
|
*/
|
|
2868
2899
|
channel(n) {
|
|
2869
|
-
return this.channels[n] || (this.channels[n] = new
|
|
2900
|
+
return this.channels[n] || (this.channels[n] = new Cs(
|
|
2870
2901
|
this.socket,
|
|
2871
2902
|
n,
|
|
2872
2903
|
this.options
|
|
@@ -2876,7 +2907,7 @@ class la extends en {
|
|
|
2876
2907
|
* Get a private channel instance by name.
|
|
2877
2908
|
*/
|
|
2878
2909
|
privateChannel(n) {
|
|
2879
|
-
return this.channels["private-" + n] || (this.channels["private-" + n] = new
|
|
2910
|
+
return this.channels["private-" + n] || (this.channels["private-" + n] = new ws(
|
|
2880
2911
|
this.socket,
|
|
2881
2912
|
"private-" + n,
|
|
2882
2913
|
this.options
|
|
@@ -2886,7 +2917,7 @@ class la extends en {
|
|
|
2886
2917
|
* Get a presence channel instance by name.
|
|
2887
2918
|
*/
|
|
2888
2919
|
presenceChannel(n) {
|
|
2889
|
-
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new
|
|
2920
|
+
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new ua(
|
|
2890
2921
|
this.socket,
|
|
2891
2922
|
"presence-" + n,
|
|
2892
2923
|
this.options
|
|
@@ -2933,11 +2964,11 @@ class la extends en {
|
|
|
2933
2964
|
"reconnect_error",
|
|
2934
2965
|
"reconnect_failed"
|
|
2935
2966
|
];
|
|
2936
|
-
return o.forEach((
|
|
2937
|
-
this.socket.on(
|
|
2967
|
+
return o.forEach((c) => {
|
|
2968
|
+
this.socket.on(c, i);
|
|
2938
2969
|
}), () => {
|
|
2939
|
-
o.forEach((
|
|
2940
|
-
this.socket.off(
|
|
2970
|
+
o.forEach((c) => {
|
|
2971
|
+
this.socket.off(c, i);
|
|
2941
2972
|
});
|
|
2942
2973
|
};
|
|
2943
2974
|
}
|
|
@@ -2948,7 +2979,7 @@ class la extends en {
|
|
|
2948
2979
|
this.socket.disconnect();
|
|
2949
2980
|
}
|
|
2950
2981
|
}
|
|
2951
|
-
class
|
|
2982
|
+
class $n extends en {
|
|
2952
2983
|
constructor() {
|
|
2953
2984
|
super(...arguments), this.channels = {};
|
|
2954
2985
|
}
|
|
@@ -2973,19 +3004,19 @@ class jn extends en {
|
|
|
2973
3004
|
* Get a private channel instance by name.
|
|
2974
3005
|
*/
|
|
2975
3006
|
privateChannel(n) {
|
|
2976
|
-
return new
|
|
3007
|
+
return new Ts();
|
|
2977
3008
|
}
|
|
2978
3009
|
/**
|
|
2979
3010
|
* Get a private encrypted channel instance by name.
|
|
2980
3011
|
*/
|
|
2981
3012
|
encryptedPrivateChannel(n) {
|
|
2982
|
-
return new
|
|
3013
|
+
return new la();
|
|
2983
3014
|
}
|
|
2984
3015
|
/**
|
|
2985
3016
|
* Get a presence channel instance by name.
|
|
2986
3017
|
*/
|
|
2987
3018
|
presenceChannel(n) {
|
|
2988
|
-
return new
|
|
3019
|
+
return new da();
|
|
2989
3020
|
}
|
|
2990
3021
|
/**
|
|
2991
3022
|
* Leave the given channel, as well as its private and presence variants.
|
|
@@ -3022,7 +3053,7 @@ class jn extends en {
|
|
|
3022
3053
|
disconnect() {
|
|
3023
3054
|
}
|
|
3024
3055
|
}
|
|
3025
|
-
class
|
|
3056
|
+
class fa {
|
|
3026
3057
|
/**
|
|
3027
3058
|
* Create a new class instance.
|
|
3028
3059
|
*/
|
|
@@ -3053,10 +3084,10 @@ class da {
|
|
|
3053
3084
|
broadcaster: "pusher"
|
|
3054
3085
|
});
|
|
3055
3086
|
else if (this.options.broadcaster === "socket.io")
|
|
3056
|
-
this.connector = new
|
|
3087
|
+
this.connector = new ha(this.options);
|
|
3057
3088
|
else if (this.options.broadcaster === "null")
|
|
3058
|
-
this.connector = new
|
|
3059
|
-
else if (typeof this.options.broadcaster == "function" &&
|
|
3089
|
+
this.connector = new $n(this.options);
|
|
3090
|
+
else if (typeof this.options.broadcaster == "function" && oa(this.options.broadcaster))
|
|
3060
3091
|
this.connector = new this.options.broadcaster(this.options);
|
|
3061
3092
|
else
|
|
3062
3093
|
throw new Error(
|
|
@@ -3119,7 +3150,7 @@ class da {
|
|
|
3119
3150
|
);
|
|
3120
3151
|
}
|
|
3121
3152
|
connectorSupportsEncryptedPrivateChannels(n) {
|
|
3122
|
-
return n instanceof ot || n instanceof
|
|
3153
|
+
return n instanceof ot || n instanceof $n;
|
|
3123
3154
|
}
|
|
3124
3155
|
/**
|
|
3125
3156
|
* Get the Socket ID for the connection.
|
|
@@ -3180,66 +3211,66 @@ class da {
|
|
|
3180
3211
|
);
|
|
3181
3212
|
}
|
|
3182
3213
|
}
|
|
3183
|
-
function
|
|
3214
|
+
function pa(e) {
|
|
3184
3215
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3185
3216
|
}
|
|
3186
3217
|
var It = { exports: {} };
|
|
3187
|
-
var
|
|
3188
|
-
function
|
|
3189
|
-
return
|
|
3190
|
-
(function(o,
|
|
3191
|
-
e.exports =
|
|
3218
|
+
var Hn;
|
|
3219
|
+
function ga() {
|
|
3220
|
+
return Hn || (Hn = 1, (function(e, n) {
|
|
3221
|
+
(function(o, c) {
|
|
3222
|
+
e.exports = c();
|
|
3192
3223
|
})(window, function() {
|
|
3193
3224
|
return (
|
|
3194
3225
|
/******/
|
|
3195
3226
|
(function(i) {
|
|
3196
3227
|
var o = {};
|
|
3197
|
-
function
|
|
3198
|
-
if (o[
|
|
3199
|
-
return o[
|
|
3200
|
-
var
|
|
3228
|
+
function c(l) {
|
|
3229
|
+
if (o[l])
|
|
3230
|
+
return o[l].exports;
|
|
3231
|
+
var d = o[l] = {
|
|
3201
3232
|
/******/
|
|
3202
|
-
i:
|
|
3233
|
+
i: l,
|
|
3203
3234
|
/******/
|
|
3204
3235
|
l: !1,
|
|
3205
3236
|
/******/
|
|
3206
3237
|
exports: {}
|
|
3207
3238
|
/******/
|
|
3208
3239
|
};
|
|
3209
|
-
return i[
|
|
3240
|
+
return i[l].call(d.exports, d, d.exports, c), d.l = !0, d.exports;
|
|
3210
3241
|
}
|
|
3211
|
-
return
|
|
3212
|
-
|
|
3213
|
-
},
|
|
3214
|
-
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(
|
|
3215
|
-
},
|
|
3216
|
-
if (
|
|
3242
|
+
return c.m = i, c.c = o, c.d = function(l, d, g) {
|
|
3243
|
+
c.o(l, d) || Object.defineProperty(l, d, { enumerable: !0, get: g });
|
|
3244
|
+
}, c.r = function(l) {
|
|
3245
|
+
typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(l, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(l, "__esModule", { value: !0 });
|
|
3246
|
+
}, c.t = function(l, d) {
|
|
3247
|
+
if (d & 1 && (l = c(l)), d & 8 || d & 4 && typeof l == "object" && l && l.__esModule) return l;
|
|
3217
3248
|
var g = /* @__PURE__ */ Object.create(null);
|
|
3218
|
-
if (
|
|
3219
|
-
return
|
|
3249
|
+
if (c.r(g), Object.defineProperty(g, "default", { enumerable: !0, value: l }), d & 2 && typeof l != "string") for (var h in l) c.d(g, h, (function(x) {
|
|
3250
|
+
return l[x];
|
|
3220
3251
|
}).bind(null, h));
|
|
3221
3252
|
return g;
|
|
3222
|
-
},
|
|
3223
|
-
var
|
|
3253
|
+
}, c.n = function(l) {
|
|
3254
|
+
var d = l && l.__esModule ? (
|
|
3224
3255
|
/******/
|
|
3225
3256
|
function() {
|
|
3226
|
-
return
|
|
3257
|
+
return l.default;
|
|
3227
3258
|
}
|
|
3228
3259
|
) : (
|
|
3229
3260
|
/******/
|
|
3230
3261
|
function() {
|
|
3231
|
-
return
|
|
3262
|
+
return l;
|
|
3232
3263
|
}
|
|
3233
3264
|
);
|
|
3234
|
-
return
|
|
3235
|
-
},
|
|
3236
|
-
return Object.prototype.hasOwnProperty.call(
|
|
3237
|
-
},
|
|
3265
|
+
return c.d(d, "a", d), d;
|
|
3266
|
+
}, c.o = function(l, d) {
|
|
3267
|
+
return Object.prototype.hasOwnProperty.call(l, d);
|
|
3268
|
+
}, c.p = "", c(c.s = 2);
|
|
3238
3269
|
})([
|
|
3239
3270
|
/* 0 */
|
|
3240
3271
|
/***/
|
|
3241
|
-
(function(i, o,
|
|
3242
|
-
var
|
|
3272
|
+
(function(i, o, c) {
|
|
3273
|
+
var l = this && this.__extends || /* @__PURE__ */ (function() {
|
|
3243
3274
|
var C = function(f, m) {
|
|
3244
3275
|
return C = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(v, N) {
|
|
3245
3276
|
v.__proto__ = N;
|
|
@@ -3256,7 +3287,7 @@ function fa() {
|
|
|
3256
3287
|
};
|
|
3257
3288
|
})();
|
|
3258
3289
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
3259
|
-
var
|
|
3290
|
+
var d = 256, g = (
|
|
3260
3291
|
/** @class */
|
|
3261
3292
|
(function() {
|
|
3262
3293
|
function C(f) {
|
|
@@ -3283,16 +3314,16 @@ function fa() {
|
|
|
3283
3314
|
if (f.length === 0)
|
|
3284
3315
|
return new Uint8Array(0);
|
|
3285
3316
|
for (var m = this._getPaddingLength(f), v = f.length - m, N = new Uint8Array(this.maxDecodedLength(v)), q = 0, G = 0, k = 0, O = 0, H = 0, F = 0, J = 0; G < v - 4; G += 4)
|
|
3286
|
-
O = this._decodeChar(f.charCodeAt(G + 0)), H = this._decodeChar(f.charCodeAt(G + 1)), F = this._decodeChar(f.charCodeAt(G + 2)), J = this._decodeChar(f.charCodeAt(G + 3)), N[q++] = O << 2 | H >>> 4, N[q++] = H << 4 | F >>> 2, N[q++] = F << 6 | J, k |= O &
|
|
3287
|
-
if (G < v - 1 && (O = this._decodeChar(f.charCodeAt(G)), H = this._decodeChar(f.charCodeAt(G + 1)), N[q++] = O << 2 | H >>> 4, k |= O &
|
|
3317
|
+
O = this._decodeChar(f.charCodeAt(G + 0)), H = this._decodeChar(f.charCodeAt(G + 1)), F = this._decodeChar(f.charCodeAt(G + 2)), J = this._decodeChar(f.charCodeAt(G + 3)), N[q++] = O << 2 | H >>> 4, N[q++] = H << 4 | F >>> 2, N[q++] = F << 6 | J, k |= O & d, k |= H & d, k |= F & d, k |= J & d;
|
|
3318
|
+
if (G < v - 1 && (O = this._decodeChar(f.charCodeAt(G)), H = this._decodeChar(f.charCodeAt(G + 1)), N[q++] = O << 2 | H >>> 4, k |= O & d, k |= H & d), G < v - 2 && (F = this._decodeChar(f.charCodeAt(G + 2)), N[q++] = H << 4 | F >>> 2, k |= F & d), G < v - 3 && (J = this._decodeChar(f.charCodeAt(G + 3)), N[q++] = F << 6 | J, k |= J & d), k !== 0)
|
|
3288
3319
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
3289
3320
|
return N;
|
|
3290
3321
|
}, C.prototype._encodeByte = function(f) {
|
|
3291
3322
|
var m = f;
|
|
3292
3323
|
return m += 65, m += 25 - f >>> 8 & 6, m += 51 - f >>> 8 & -75, m += 61 - f >>> 8 & -15, m += 62 - f >>> 8 & 3, String.fromCharCode(m);
|
|
3293
3324
|
}, C.prototype._decodeChar = function(f) {
|
|
3294
|
-
var m =
|
|
3295
|
-
return m += (42 - f & f - 44) >>> 8 & -
|
|
3325
|
+
var m = d;
|
|
3326
|
+
return m += (42 - f & f - 44) >>> 8 & -d + f - 43 + 62, m += (46 - f & f - 48) >>> 8 & -d + f - 47 + 63, m += (47 - f & f - 58) >>> 8 & -d + f - 48 + 52, m += (64 - f & f - 91) >>> 8 & -d + f - 65 + 0, m += (96 - f & f - 123) >>> 8 & -d + f - 97 + 26, m;
|
|
3296
3327
|
}, C.prototype._getPaddingLength = function(f) {
|
|
3297
3328
|
var m = 0;
|
|
3298
3329
|
if (this._paddingCharacter) {
|
|
@@ -3318,7 +3349,7 @@ function fa() {
|
|
|
3318
3349
|
var _ = (
|
|
3319
3350
|
/** @class */
|
|
3320
3351
|
(function(C) {
|
|
3321
|
-
|
|
3352
|
+
l(f, C);
|
|
3322
3353
|
function f() {
|
|
3323
3354
|
return C !== null && C.apply(this, arguments) || this;
|
|
3324
3355
|
}
|
|
@@ -3326,8 +3357,8 @@ function fa() {
|
|
|
3326
3357
|
var v = m;
|
|
3327
3358
|
return v += 65, v += 25 - m >>> 8 & 6, v += 51 - m >>> 8 & -75, v += 61 - m >>> 8 & -13, v += 62 - m >>> 8 & 49, String.fromCharCode(v);
|
|
3328
3359
|
}, f.prototype._decodeChar = function(m) {
|
|
3329
|
-
var v =
|
|
3330
|
-
return v += (44 - m & m - 46) >>> 8 & -
|
|
3360
|
+
var v = d;
|
|
3361
|
+
return v += (44 - m & m - 46) >>> 8 & -d + m - 45 + 62, v += (94 - m & m - 96) >>> 8 & -d + m - 95 + 63, v += (47 - m & m - 58) >>> 8 & -d + m - 48 + 52, v += (64 - m & m - 91) >>> 8 & -d + m - 65 + 0, v += (96 - m & m - 123) >>> 8 & -d + m - 97 + 26, v;
|
|
3331
3362
|
}, f;
|
|
3332
3363
|
})(g)
|
|
3333
3364
|
);
|
|
@@ -3350,9 +3381,9 @@ function fa() {
|
|
|
3350
3381
|
}),
|
|
3351
3382
|
/* 1 */
|
|
3352
3383
|
/***/
|
|
3353
|
-
(function(i, o,
|
|
3384
|
+
(function(i, o, c) {
|
|
3354
3385
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
3355
|
-
var
|
|
3386
|
+
var l = "utf8: invalid string", d = "utf8: invalid source encoding";
|
|
3356
3387
|
function g(M) {
|
|
3357
3388
|
for (var _ = new Uint8Array(h(M)), T = 0, y = 0; y < M.length; y++) {
|
|
3358
3389
|
var w = M.charCodeAt(y);
|
|
@@ -3372,10 +3403,10 @@ function fa() {
|
|
|
3372
3403
|
_ += 3;
|
|
3373
3404
|
else if (y <= 57343) {
|
|
3374
3405
|
if (T >= M.length - 1)
|
|
3375
|
-
throw new Error(
|
|
3406
|
+
throw new Error(l);
|
|
3376
3407
|
T++, _ += 4;
|
|
3377
3408
|
} else
|
|
3378
|
-
throw new Error(
|
|
3409
|
+
throw new Error(l);
|
|
3379
3410
|
}
|
|
3380
3411
|
return _;
|
|
3381
3412
|
}
|
|
@@ -3387,32 +3418,32 @@ function fa() {
|
|
|
3387
3418
|
var w = void 0;
|
|
3388
3419
|
if (y < 224) {
|
|
3389
3420
|
if (T >= M.length)
|
|
3390
|
-
throw new Error(
|
|
3421
|
+
throw new Error(d);
|
|
3391
3422
|
var C = M[++T];
|
|
3392
3423
|
if ((C & 192) !== 128)
|
|
3393
|
-
throw new Error(
|
|
3424
|
+
throw new Error(d);
|
|
3394
3425
|
y = (y & 31) << 6 | C & 63, w = 128;
|
|
3395
3426
|
} else if (y < 240) {
|
|
3396
3427
|
if (T >= M.length - 1)
|
|
3397
|
-
throw new Error(
|
|
3428
|
+
throw new Error(d);
|
|
3398
3429
|
var C = M[++T], f = M[++T];
|
|
3399
3430
|
if ((C & 192) !== 128 || (f & 192) !== 128)
|
|
3400
|
-
throw new Error(
|
|
3431
|
+
throw new Error(d);
|
|
3401
3432
|
y = (y & 15) << 12 | (C & 63) << 6 | f & 63, w = 2048;
|
|
3402
3433
|
} else if (y < 248) {
|
|
3403
3434
|
if (T >= M.length - 2)
|
|
3404
|
-
throw new Error(
|
|
3435
|
+
throw new Error(d);
|
|
3405
3436
|
var C = M[++T], f = M[++T], m = M[++T];
|
|
3406
3437
|
if ((C & 192) !== 128 || (f & 192) !== 128 || (m & 192) !== 128)
|
|
3407
|
-
throw new Error(
|
|
3438
|
+
throw new Error(d);
|
|
3408
3439
|
y = (y & 15) << 18 | (C & 63) << 12 | (f & 63) << 6 | m & 63, w = 65536;
|
|
3409
3440
|
} else
|
|
3410
|
-
throw new Error(
|
|
3441
|
+
throw new Error(d);
|
|
3411
3442
|
if (y < w || y >= 55296 && y <= 57343)
|
|
3412
|
-
throw new Error(
|
|
3443
|
+
throw new Error(d);
|
|
3413
3444
|
if (y >= 65536) {
|
|
3414
3445
|
if (y > 1114111)
|
|
3415
|
-
throw new Error(
|
|
3446
|
+
throw new Error(d);
|
|
3416
3447
|
y -= 65536, _.push(String.fromCharCode(55296 | y >> 10)), y = 56320 | y & 1023;
|
|
3417
3448
|
}
|
|
3418
3449
|
}
|
|
@@ -3424,29 +3455,29 @@ function fa() {
|
|
|
3424
3455
|
}),
|
|
3425
3456
|
/* 2 */
|
|
3426
3457
|
/***/
|
|
3427
|
-
(function(i, o,
|
|
3428
|
-
i.exports =
|
|
3458
|
+
(function(i, o, c) {
|
|
3459
|
+
i.exports = c(3).default;
|
|
3429
3460
|
}),
|
|
3430
3461
|
/* 3 */
|
|
3431
3462
|
/***/
|
|
3432
|
-
(function(i, o,
|
|
3433
|
-
|
|
3434
|
-
class
|
|
3463
|
+
(function(i, o, c) {
|
|
3464
|
+
c.r(o);
|
|
3465
|
+
class l {
|
|
3435
3466
|
constructor(t, s) {
|
|
3436
3467
|
this.lastId = 0, this.prefix = t, this.name = s;
|
|
3437
3468
|
}
|
|
3438
3469
|
create(t) {
|
|
3439
3470
|
this.lastId++;
|
|
3440
|
-
var s = this.lastId, a = this.prefix + s,
|
|
3471
|
+
var s = this.lastId, a = this.prefix + s, u = this.name + "[" + s + "]", p = !1, S = function() {
|
|
3441
3472
|
p || (t.apply(null, arguments), p = !0);
|
|
3442
3473
|
};
|
|
3443
|
-
return this[s] = S, { number: s, id: a, name:
|
|
3474
|
+
return this[s] = S, { number: s, id: a, name: u, callback: S };
|
|
3444
3475
|
}
|
|
3445
3476
|
remove(t) {
|
|
3446
3477
|
delete this[t.number];
|
|
3447
3478
|
}
|
|
3448
3479
|
}
|
|
3449
|
-
var
|
|
3480
|
+
var d = new l("_pusher_script_", "Pusher.ScriptReceivers"), g = {
|
|
3450
3481
|
VERSION: "8.4.0",
|
|
3451
3482
|
PROTOCOL: 7,
|
|
3452
3483
|
wsPort: 80,
|
|
@@ -3476,18 +3507,18 @@ function fa() {
|
|
|
3476
3507
|
}, h = g;
|
|
3477
3508
|
class x {
|
|
3478
3509
|
constructor(t) {
|
|
3479
|
-
this.options = t, this.receivers = t.receivers ||
|
|
3510
|
+
this.options = t, this.receivers = t.receivers || d, this.loading = {};
|
|
3480
3511
|
}
|
|
3481
3512
|
load(t, s, a) {
|
|
3482
|
-
var
|
|
3483
|
-
if (
|
|
3484
|
-
|
|
3513
|
+
var u = this;
|
|
3514
|
+
if (u.loading[t] && u.loading[t].length > 0)
|
|
3515
|
+
u.loading[t].push(a);
|
|
3485
3516
|
else {
|
|
3486
|
-
|
|
3487
|
-
var p = j.createScriptRequest(
|
|
3488
|
-
if (
|
|
3489
|
-
var z =
|
|
3490
|
-
delete
|
|
3517
|
+
u.loading[t] = [a];
|
|
3518
|
+
var p = j.createScriptRequest(u.getPath(t, s)), S = u.receivers.create(function(L) {
|
|
3519
|
+
if (u.receivers.remove(S), u.loading[t]) {
|
|
3520
|
+
var z = u.loading[t];
|
|
3521
|
+
delete u.loading[t];
|
|
3491
3522
|
for (var Q = function(ce) {
|
|
3492
3523
|
ce || p.cleanup();
|
|
3493
3524
|
}, te = 0; te < z.length; te++)
|
|
@@ -3505,7 +3536,7 @@ function fa() {
|
|
|
3505
3536
|
return this.getRoot(s) + "/" + t + this.options.suffix + ".js";
|
|
3506
3537
|
}
|
|
3507
3538
|
}
|
|
3508
|
-
var M = new
|
|
3539
|
+
var M = new l("_pusher_dependencies", "Pusher.DependenciesReceivers"), _ = new x({
|
|
3509
3540
|
cdn_http: h.cdn_http,
|
|
3510
3541
|
cdn_https: h.cdn_https,
|
|
3511
3542
|
version: h.VERSION,
|
|
@@ -3587,7 +3618,7 @@ function fa() {
|
|
|
3587
3618
|
super(s), this.status = t, Object.setPrototypeOf(this, new.target.prototype);
|
|
3588
3619
|
}
|
|
3589
3620
|
}
|
|
3590
|
-
var J = function(r, t, s, a,
|
|
3621
|
+
var J = function(r, t, s, a, u) {
|
|
3591
3622
|
const p = j.createXHR();
|
|
3592
3623
|
p.open("POST", s.endpoint, !0), p.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
3593
3624
|
for (var S in s.headers)
|
|
@@ -3604,9 +3635,9 @@ function fa() {
|
|
|
3604
3635
|
try {
|
|
3605
3636
|
L = JSON.parse(p.responseText), z = !0;
|
|
3606
3637
|
} catch {
|
|
3607
|
-
|
|
3638
|
+
u(new H(200, `JSON returned from ${a.toString()} endpoint was invalid, yet status code was 200. Data was: ${p.responseText}`), null);
|
|
3608
3639
|
}
|
|
3609
|
-
z &&
|
|
3640
|
+
z && u(null, L);
|
|
3610
3641
|
} else {
|
|
3611
3642
|
let L = "";
|
|
3612
3643
|
switch (a) {
|
|
@@ -3617,7 +3648,7 @@ function fa() {
|
|
|
3617
3648
|
L = `Clients must be authorized to join private or presence channels. ${w.buildLogSuffix("authorizationEndpoint")}`;
|
|
3618
3649
|
break;
|
|
3619
3650
|
}
|
|
3620
|
-
|
|
3651
|
+
u(new H(p.status, `Unable to retrieve auth string from ${a.toString()} endpoint - received status: ${p.status} from ${s.endpoint}. ${L}`), null);
|
|
3621
3652
|
}
|
|
3622
3653
|
}, p.send(t), p;
|
|
3623
3654
|
};
|
|
@@ -3641,9 +3672,9 @@ function fa() {
|
|
|
3641
3672
|
return r.replace(/[\s\S]{1,3}/g, B);
|
|
3642
3673
|
};
|
|
3643
3674
|
class V {
|
|
3644
|
-
constructor(t, s, a,
|
|
3675
|
+
constructor(t, s, a, u) {
|
|
3645
3676
|
this.clear = s, this.timer = t(() => {
|
|
3646
|
-
this.timer && (this.timer =
|
|
3677
|
+
this.timer && (this.timer = u(this.timer));
|
|
3647
3678
|
}, a);
|
|
3648
3679
|
}
|
|
3649
3680
|
isRunning() {
|
|
@@ -3691,8 +3722,8 @@ function fa() {
|
|
|
3691
3722
|
function pe(r, ...t) {
|
|
3692
3723
|
for (var s = 0; s < t.length; s++) {
|
|
3693
3724
|
var a = t[s];
|
|
3694
|
-
for (var
|
|
3695
|
-
a[
|
|
3725
|
+
for (var u in a)
|
|
3726
|
+
a[u] && a[u].constructor && a[u].constructor === Object ? r[u] = pe(r[u] || {}, a[u]) : r[u] = a[u];
|
|
3696
3727
|
}
|
|
3697
3728
|
return r;
|
|
3698
3729
|
}
|
|
@@ -3707,7 +3738,7 @@ function fa() {
|
|
|
3707
3738
|
return -1;
|
|
3708
3739
|
if (s && r.indexOf === s)
|
|
3709
3740
|
return r.indexOf(t);
|
|
3710
|
-
for (var a = 0,
|
|
3741
|
+
for (var a = 0, u = r.length; a < u; a++)
|
|
3711
3742
|
if (r[a] === t)
|
|
3712
3743
|
return a;
|
|
3713
3744
|
return -1;
|
|
@@ -3739,13 +3770,13 @@ function fa() {
|
|
|
3739
3770
|
}
|
|
3740
3771
|
function we(r, t) {
|
|
3741
3772
|
var s = {};
|
|
3742
|
-
return P(r, function(a,
|
|
3743
|
-
s[
|
|
3773
|
+
return P(r, function(a, u) {
|
|
3774
|
+
s[u] = t(a);
|
|
3744
3775
|
}), s;
|
|
3745
3776
|
}
|
|
3746
3777
|
function Ke(r, t) {
|
|
3747
|
-
t = t || function(
|
|
3748
|
-
return !!
|
|
3778
|
+
t = t || function(u) {
|
|
3779
|
+
return !!u;
|
|
3749
3780
|
};
|
|
3750
3781
|
for (var s = [], a = 0; a < r.length; a++)
|
|
3751
3782
|
t(r[a], a, r, s) && s.push(r[a]);
|
|
@@ -3753,8 +3784,8 @@ function fa() {
|
|
|
3753
3784
|
}
|
|
3754
3785
|
function Qe(r, t) {
|
|
3755
3786
|
var s = {};
|
|
3756
|
-
return P(r, function(a,
|
|
3757
|
-
(t && t(a,
|
|
3787
|
+
return P(r, function(a, u) {
|
|
3788
|
+
(t && t(a, u, r, s) || a) && (s[u] = a);
|
|
3758
3789
|
}), s;
|
|
3759
3790
|
}
|
|
3760
3791
|
function ft(r) {
|
|
@@ -3788,28 +3819,28 @@ function fa() {
|
|
|
3788
3819
|
}
|
|
3789
3820
|
function qe(r) {
|
|
3790
3821
|
var t = [], s = [];
|
|
3791
|
-
return (function a(
|
|
3822
|
+
return (function a(u, p) {
|
|
3792
3823
|
var S, L, z;
|
|
3793
|
-
switch (typeof
|
|
3824
|
+
switch (typeof u) {
|
|
3794
3825
|
case "object":
|
|
3795
|
-
if (!
|
|
3826
|
+
if (!u)
|
|
3796
3827
|
return null;
|
|
3797
3828
|
for (S = 0; S < t.length; S += 1)
|
|
3798
|
-
if (t[S] ===
|
|
3829
|
+
if (t[S] === u)
|
|
3799
3830
|
return { $ref: s[S] };
|
|
3800
|
-
if (t.push(
|
|
3801
|
-
for (z = [], S = 0; S <
|
|
3802
|
-
z[S] = a(
|
|
3831
|
+
if (t.push(u), s.push(p), Object.prototype.toString.apply(u) === "[object Array]")
|
|
3832
|
+
for (z = [], S = 0; S < u.length; S += 1)
|
|
3833
|
+
z[S] = a(u[S], p + "[" + S + "]");
|
|
3803
3834
|
else {
|
|
3804
3835
|
z = {};
|
|
3805
|
-
for (L in
|
|
3806
|
-
Object.prototype.hasOwnProperty.call(
|
|
3836
|
+
for (L in u)
|
|
3837
|
+
Object.prototype.hasOwnProperty.call(u, L) && (z[L] = a(u[L], p + "[" + JSON.stringify(L) + "]"));
|
|
3807
3838
|
}
|
|
3808
3839
|
return z;
|
|
3809
3840
|
case "number":
|
|
3810
3841
|
case "string":
|
|
3811
3842
|
case "boolean":
|
|
3812
|
-
return
|
|
3843
|
+
return u;
|
|
3813
3844
|
}
|
|
3814
3845
|
})(r, "$");
|
|
3815
3846
|
}
|
|
@@ -3820,7 +3851,7 @@ function fa() {
|
|
|
3820
3851
|
return JSON.stringify(qe(r));
|
|
3821
3852
|
}
|
|
3822
3853
|
}
|
|
3823
|
-
class
|
|
3854
|
+
class Rs {
|
|
3824
3855
|
constructor() {
|
|
3825
3856
|
this.globalLog = (t) => {
|
|
3826
3857
|
window.console && window.console.log && window.console.log(t);
|
|
@@ -3846,20 +3877,20 @@ function fa() {
|
|
|
3846
3877
|
Tt.log ? Tt.log(a) : Tt.logToConsole && t.bind(this)(a);
|
|
3847
3878
|
}
|
|
3848
3879
|
}
|
|
3849
|
-
var oe = new
|
|
3880
|
+
var oe = new Rs(), Ps = function(r, t, s, a, u) {
|
|
3850
3881
|
(s.headers !== void 0 || s.headersProvider != null) && oe.warn(`To send headers with the ${a.toString()} request, you must use AJAX, rather than JSONP.`);
|
|
3851
3882
|
var p = r.nextAuthCallbackID.toString();
|
|
3852
3883
|
r.nextAuthCallbackID++;
|
|
3853
3884
|
var S = r.getDocument(), L = S.createElement("script");
|
|
3854
3885
|
r.auth_callbacks[p] = function(te) {
|
|
3855
|
-
|
|
3886
|
+
u(null, te);
|
|
3856
3887
|
};
|
|
3857
3888
|
var z = "Pusher.auth_callbacks['" + p + "']";
|
|
3858
3889
|
L.src = s.endpoint + "?callback=" + encodeURIComponent(z) + "&" + t;
|
|
3859
3890
|
var Q = S.getElementsByTagName("head")[0] || S.documentElement;
|
|
3860
3891
|
Q.insertBefore(L, Q.firstChild);
|
|
3861
|
-
},
|
|
3862
|
-
class
|
|
3892
|
+
}, Ms = Ps;
|
|
3893
|
+
class xs {
|
|
3863
3894
|
constructor(t) {
|
|
3864
3895
|
this.src = t;
|
|
3865
3896
|
}
|
|
@@ -3872,14 +3903,14 @@ function fa() {
|
|
|
3872
3903
|
}) : s.script.onreadystatechange = function() {
|
|
3873
3904
|
(s.script.readyState === "loaded" || s.script.readyState === "complete") && t.callback(null);
|
|
3874
3905
|
}, s.script.async === void 0 && document.attachEvent && /opera/i.test(navigator.userAgent) ? (s.errorScript = document.createElement("script"), s.errorScript.id = t.id + "_error", s.errorScript.text = t.name + "('" + a + "');", s.script.async = s.errorScript.async = !1) : s.script.async = !0;
|
|
3875
|
-
var
|
|
3876
|
-
|
|
3906
|
+
var u = document.getElementsByTagName("head")[0];
|
|
3907
|
+
u.insertBefore(s.script, u.firstChild), s.errorScript && u.insertBefore(s.errorScript, s.script.nextSibling);
|
|
3877
3908
|
}
|
|
3878
3909
|
cleanup() {
|
|
3879
3910
|
this.script && (this.script.onload = this.script.onerror = null, this.script.onreadystatechange = null), this.script && this.script.parentNode && this.script.parentNode.removeChild(this.script), this.errorScript && this.errorScript.parentNode && this.errorScript.parentNode.removeChild(this.errorScript), this.script = null, this.errorScript = null;
|
|
3880
3911
|
}
|
|
3881
3912
|
}
|
|
3882
|
-
class
|
|
3913
|
+
class ks {
|
|
3883
3914
|
constructor(t, s) {
|
|
3884
3915
|
this.url = t, this.data = s;
|
|
3885
3916
|
}
|
|
@@ -3893,36 +3924,36 @@ function fa() {
|
|
|
3893
3924
|
this.request && this.request.cleanup();
|
|
3894
3925
|
}
|
|
3895
3926
|
}
|
|
3896
|
-
var
|
|
3927
|
+
var Ls = function(r, t) {
|
|
3897
3928
|
return function(s, a) {
|
|
3898
|
-
var
|
|
3899
|
-
|
|
3929
|
+
var u = "http" + (t ? "s" : "") + "://", p = u + (r.host || r.options.host) + r.options.path, S = j.createJSONPRequest(p, s), L = j.ScriptReceivers.create(function(z, Q) {
|
|
3930
|
+
d.remove(L), S.cleanup(), Q && Q.host && (r.host = Q.host), a && a(z, Q);
|
|
3900
3931
|
});
|
|
3901
3932
|
S.send(L);
|
|
3902
3933
|
};
|
|
3903
|
-
},
|
|
3934
|
+
}, Is = {
|
|
3904
3935
|
name: "jsonp",
|
|
3905
|
-
getAgent:
|
|
3906
|
-
},
|
|
3936
|
+
getAgent: Ls
|
|
3937
|
+
}, Us = Is;
|
|
3907
3938
|
function pt(r, t, s) {
|
|
3908
|
-
var a = r + (t.useTLS ? "s" : ""),
|
|
3909
|
-
return a + "://" +
|
|
3939
|
+
var a = r + (t.useTLS ? "s" : ""), u = t.useTLS ? t.hostTLS : t.hostNonTLS;
|
|
3940
|
+
return a + "://" + u + s;
|
|
3910
3941
|
}
|
|
3911
3942
|
function gt(r, t) {
|
|
3912
3943
|
var s = "/app/" + r, a = "?protocol=" + h.PROTOCOL + "&client=js&version=" + h.VERSION + (t ? "&" + t : "");
|
|
3913
3944
|
return s + a;
|
|
3914
3945
|
}
|
|
3915
|
-
var
|
|
3946
|
+
var Os = {
|
|
3916
3947
|
getInitial: function(r, t) {
|
|
3917
3948
|
var s = (t.httpPath || "") + gt(r, "flash=false");
|
|
3918
3949
|
return pt("ws", t, s);
|
|
3919
3950
|
}
|
|
3920
|
-
},
|
|
3951
|
+
}, Fs = {
|
|
3921
3952
|
getInitial: function(r, t) {
|
|
3922
3953
|
var s = (t.httpPath || "/pusher") + gt(r);
|
|
3923
3954
|
return pt("http", t, s);
|
|
3924
3955
|
}
|
|
3925
|
-
},
|
|
3956
|
+
}, Ns = {
|
|
3926
3957
|
getInitial: function(r, t) {
|
|
3927
3958
|
return pt("http", t, t.httpPath || "/pusher");
|
|
3928
3959
|
},
|
|
@@ -3930,7 +3961,7 @@ function fa() {
|
|
|
3930
3961
|
return gt(r);
|
|
3931
3962
|
}
|
|
3932
3963
|
};
|
|
3933
|
-
class
|
|
3964
|
+
class Ds {
|
|
3934
3965
|
constructor() {
|
|
3935
3966
|
this._callbacks = {};
|
|
3936
3967
|
}
|
|
@@ -3938,8 +3969,8 @@ function fa() {
|
|
|
3938
3969
|
return this._callbacks[mt(t)];
|
|
3939
3970
|
}
|
|
3940
3971
|
add(t, s, a) {
|
|
3941
|
-
var
|
|
3942
|
-
this._callbacks[
|
|
3972
|
+
var u = mt(t);
|
|
3973
|
+
this._callbacks[u] = this._callbacks[u] || [], this._callbacks[u].push({
|
|
3943
3974
|
fn: s,
|
|
3944
3975
|
context: a
|
|
3945
3976
|
});
|
|
@@ -3949,14 +3980,14 @@ function fa() {
|
|
|
3949
3980
|
this._callbacks = {};
|
|
3950
3981
|
return;
|
|
3951
3982
|
}
|
|
3952
|
-
var
|
|
3953
|
-
s || a ? this.removeCallback(
|
|
3983
|
+
var u = t ? [mt(t)] : D(this._callbacks);
|
|
3984
|
+
s || a ? this.removeCallback(u, s, a) : this.removeAllCallbacks(u);
|
|
3954
3985
|
}
|
|
3955
3986
|
removeCallback(t, s, a) {
|
|
3956
|
-
Y(t, function(
|
|
3957
|
-
this._callbacks[
|
|
3987
|
+
Y(t, function(u) {
|
|
3988
|
+
this._callbacks[u] = Ke(this._callbacks[u] || [], function(p) {
|
|
3958
3989
|
return s && s !== p.fn || a && a !== p.context;
|
|
3959
|
-
}), this._callbacks[
|
|
3990
|
+
}), this._callbacks[u].length === 0 && delete this._callbacks[u];
|
|
3960
3991
|
}, this);
|
|
3961
3992
|
}
|
|
3962
3993
|
removeAllCallbacks(t) {
|
|
@@ -3970,7 +4001,7 @@ function fa() {
|
|
|
3970
4001
|
}
|
|
3971
4002
|
class Te {
|
|
3972
4003
|
constructor(t) {
|
|
3973
|
-
this.callbacks = new
|
|
4004
|
+
this.callbacks = new Ds(), this.global_callbacks = [], this.failThrough = t;
|
|
3974
4005
|
}
|
|
3975
4006
|
bind(t, s, a) {
|
|
3976
4007
|
return this.callbacks.add(t, s, a), this;
|
|
@@ -3988,19 +4019,19 @@ function fa() {
|
|
|
3988
4019
|
return this.unbind(), this.unbind_global(), this;
|
|
3989
4020
|
}
|
|
3990
4021
|
emit(t, s, a) {
|
|
3991
|
-
for (var
|
|
3992
|
-
this.global_callbacks[
|
|
4022
|
+
for (var u = 0; u < this.global_callbacks.length; u++)
|
|
4023
|
+
this.global_callbacks[u](t, s);
|
|
3993
4024
|
var p = this.callbacks.get(t), S = [];
|
|
3994
4025
|
if (a ? S.push(s, a) : s && S.push(s), p && p.length > 0)
|
|
3995
|
-
for (var
|
|
3996
|
-
p[
|
|
4026
|
+
for (var u = 0; u < p.length; u++)
|
|
4027
|
+
p[u].fn.apply(p[u].context || window, S);
|
|
3997
4028
|
else this.failThrough && this.failThrough(t, s);
|
|
3998
4029
|
return this;
|
|
3999
4030
|
}
|
|
4000
4031
|
}
|
|
4001
|
-
class
|
|
4002
|
-
constructor(t, s, a,
|
|
4003
|
-
super(), this.initialize = j.transportConnectionInitializer, this.hooks = t, this.name = s, this.priority = a, this.key =
|
|
4032
|
+
class qs extends Te {
|
|
4033
|
+
constructor(t, s, a, u, p) {
|
|
4034
|
+
super(), this.initialize = j.transportConnectionInitializer, this.hooks = t, this.name = s, this.priority = a, this.key = u, this.options = p, this.state = "new", this.timeline = p.timeline, this.activityTimeout = p.activityTimeout, this.id = this.timeline.generateUniqueID();
|
|
4004
4035
|
}
|
|
4005
4036
|
handlesActivityChecks() {
|
|
4006
4037
|
return !!this.hooks.handlesActivityChecks;
|
|
@@ -4084,12 +4115,12 @@ function fa() {
|
|
|
4084
4115
|
isSupported(t) {
|
|
4085
4116
|
return this.hooks.isSupported(t);
|
|
4086
4117
|
}
|
|
4087
|
-
createConnection(t, s, a,
|
|
4088
|
-
return new
|
|
4118
|
+
createConnection(t, s, a, u) {
|
|
4119
|
+
return new qs(this.hooks, t, s, a, u);
|
|
4089
4120
|
}
|
|
4090
4121
|
}
|
|
4091
|
-
var
|
|
4092
|
-
urls:
|
|
4122
|
+
var zs = new Ne({
|
|
4123
|
+
urls: Os,
|
|
4093
4124
|
handlesActivityChecks: !1,
|
|
4094
4125
|
supportsPing: !1,
|
|
4095
4126
|
isInitialized: function() {
|
|
@@ -4102,7 +4133,7 @@ function fa() {
|
|
|
4102
4133
|
return j.createWebSocket(r);
|
|
4103
4134
|
}
|
|
4104
4135
|
}), tn = {
|
|
4105
|
-
urls:
|
|
4136
|
+
urls: Fs,
|
|
4106
4137
|
handlesActivityChecks: !1,
|
|
4107
4138
|
supportsPing: !0,
|
|
4108
4139
|
isInitialized: function() {
|
|
@@ -4120,13 +4151,13 @@ function fa() {
|
|
|
4120
4151
|
isSupported: function() {
|
|
4121
4152
|
return j.isXHRSupported();
|
|
4122
4153
|
}
|
|
4123
|
-
},
|
|
4124
|
-
ws:
|
|
4125
|
-
xhr_streaming:
|
|
4126
|
-
xhr_polling:
|
|
4127
|
-
}, Ze =
|
|
4154
|
+
}, js = new Ne(pe({}, nn, rn)), $s = new Ne(pe({}, sn, rn)), Hs = {
|
|
4155
|
+
ws: zs,
|
|
4156
|
+
xhr_streaming: js,
|
|
4157
|
+
xhr_polling: $s
|
|
4158
|
+
}, Ze = Hs, Bs = new Ne({
|
|
4128
4159
|
file: "sockjs",
|
|
4129
|
-
urls:
|
|
4160
|
+
urls: Ns,
|
|
4130
4161
|
handlesActivityChecks: !0,
|
|
4131
4162
|
supportsPing: !1,
|
|
4132
4163
|
isSupported: function() {
|
|
@@ -4153,10 +4184,10 @@ function fa() {
|
|
|
4153
4184
|
var t = j.isXDRSupported(r.useTLS);
|
|
4154
4185
|
return t;
|
|
4155
4186
|
}
|
|
4156
|
-
},
|
|
4157
|
-
Ze.xdr_streaming =
|
|
4158
|
-
var
|
|
4159
|
-
class
|
|
4187
|
+
}, Vs = new Ne(pe({}, nn, on)), Xs = new Ne(pe({}, sn, on));
|
|
4188
|
+
Ze.xdr_streaming = Vs, Ze.xdr_polling = Xs, Ze.sockjs = Bs;
|
|
4189
|
+
var Ws = Ze;
|
|
4190
|
+
class Gs extends Te {
|
|
4160
4191
|
constructor() {
|
|
4161
4192
|
super();
|
|
4162
4193
|
var t = this;
|
|
@@ -4170,16 +4201,16 @@ function fa() {
|
|
|
4170
4201
|
return window.navigator.onLine === void 0 ? !0 : window.navigator.onLine;
|
|
4171
4202
|
}
|
|
4172
4203
|
}
|
|
4173
|
-
var
|
|
4174
|
-
class
|
|
4204
|
+
var Js = new Gs();
|
|
4205
|
+
class Ks {
|
|
4175
4206
|
constructor(t, s, a) {
|
|
4176
4207
|
this.manager = t, this.transport = s, this.minPingDelay = a.minPingDelay, this.maxPingDelay = a.maxPingDelay, this.pingDelay = void 0;
|
|
4177
4208
|
}
|
|
4178
|
-
createConnection(t, s, a,
|
|
4179
|
-
|
|
4209
|
+
createConnection(t, s, a, u) {
|
|
4210
|
+
u = pe({}, u, {
|
|
4180
4211
|
activityTimeout: this.pingDelay
|
|
4181
4212
|
});
|
|
4182
|
-
var p = this.transport.createConnection(t, s, a,
|
|
4213
|
+
var p = this.transport.createConnection(t, s, a, u), S = null, L = function() {
|
|
4183
4214
|
p.unbind("open", L), p.bind("closed", z), S = ue.now();
|
|
4184
4215
|
}, z = (Q) => {
|
|
4185
4216
|
if (p.unbind("closed", z), Q.code === 1002 || Q.code === 1003)
|
|
@@ -4210,8 +4241,8 @@ function fa() {
|
|
|
4210
4241
|
data: s
|
|
4211
4242
|
};
|
|
4212
4243
|
return t.user_id && (a.user_id = t.user_id), a;
|
|
4213
|
-
} catch (
|
|
4214
|
-
throw { type: "MessageParseError", error:
|
|
4244
|
+
} catch (u) {
|
|
4245
|
+
throw { type: "MessageParseError", error: u, data: r.data };
|
|
4215
4246
|
}
|
|
4216
4247
|
},
|
|
4217
4248
|
encodeMessage: function(r) {
|
|
@@ -4250,7 +4281,7 @@ function fa() {
|
|
|
4250
4281
|
}
|
|
4251
4282
|
};
|
|
4252
4283
|
var ke = an;
|
|
4253
|
-
class
|
|
4284
|
+
class Qs extends Te {
|
|
4254
4285
|
constructor(t, s) {
|
|
4255
4286
|
super(), this.id = t, this.transport = s, this.activityTimeout = s.activityTimeout, this.bindListeners();
|
|
4256
4287
|
}
|
|
@@ -4261,8 +4292,8 @@ function fa() {
|
|
|
4261
4292
|
return this.transport.send(t);
|
|
4262
4293
|
}
|
|
4263
4294
|
send_event(t, s, a) {
|
|
4264
|
-
var
|
|
4265
|
-
return a && (
|
|
4295
|
+
var u = { event: t, data: s };
|
|
4296
|
+
return a && (u.channel = a), oe.debug("Event sent", u), this.send(ke.encodeMessage(u));
|
|
4266
4297
|
}
|
|
4267
4298
|
ping() {
|
|
4268
4299
|
this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
|
|
@@ -4273,9 +4304,9 @@ function fa() {
|
|
|
4273
4304
|
bindListeners() {
|
|
4274
4305
|
var t = {
|
|
4275
4306
|
message: (a) => {
|
|
4276
|
-
var
|
|
4307
|
+
var u;
|
|
4277
4308
|
try {
|
|
4278
|
-
|
|
4309
|
+
u = ke.decodeMessage(a);
|
|
4279
4310
|
} catch (p) {
|
|
4280
4311
|
this.emit("error", {
|
|
4281
4312
|
type: "MessageParseError",
|
|
@@ -4283,12 +4314,12 @@ function fa() {
|
|
|
4283
4314
|
data: a.data
|
|
4284
4315
|
});
|
|
4285
4316
|
}
|
|
4286
|
-
if (
|
|
4287
|
-
switch (oe.debug("Event recd",
|
|
4317
|
+
if (u !== void 0) {
|
|
4318
|
+
switch (oe.debug("Event recd", u), u.event) {
|
|
4288
4319
|
case "pusher:error":
|
|
4289
4320
|
this.emit("error", {
|
|
4290
4321
|
type: "PusherError",
|
|
4291
|
-
data:
|
|
4322
|
+
data: u.data
|
|
4292
4323
|
});
|
|
4293
4324
|
break;
|
|
4294
4325
|
case "pusher:ping":
|
|
@@ -4298,7 +4329,7 @@ function fa() {
|
|
|
4298
4329
|
this.emit("pong");
|
|
4299
4330
|
break;
|
|
4300
4331
|
}
|
|
4301
|
-
this.emit("message",
|
|
4332
|
+
this.emit("message", u);
|
|
4302
4333
|
}
|
|
4303
4334
|
},
|
|
4304
4335
|
activity: () => {
|
|
@@ -4311,12 +4342,12 @@ function fa() {
|
|
|
4311
4342
|
s(), a && a.code && this.handleCloseEvent(a), this.transport = null, this.emit("closed");
|
|
4312
4343
|
}
|
|
4313
4344
|
}, s = () => {
|
|
4314
|
-
P(t, (a,
|
|
4315
|
-
this.transport.unbind(
|
|
4345
|
+
P(t, (a, u) => {
|
|
4346
|
+
this.transport.unbind(u, a);
|
|
4316
4347
|
});
|
|
4317
4348
|
};
|
|
4318
|
-
P(t, (a,
|
|
4319
|
-
this.transport.bind(
|
|
4349
|
+
P(t, (a, u) => {
|
|
4350
|
+
this.transport.bind(u, a);
|
|
4320
4351
|
});
|
|
4321
4352
|
}
|
|
4322
4353
|
handleCloseEvent(t) {
|
|
@@ -4324,7 +4355,7 @@ function fa() {
|
|
|
4324
4355
|
a && this.emit("error", a), s && this.emit(s, { action: s, error: a });
|
|
4325
4356
|
}
|
|
4326
4357
|
}
|
|
4327
|
-
class
|
|
4358
|
+
class Ys {
|
|
4328
4359
|
constructor(t, s) {
|
|
4329
4360
|
this.transport = t, this.callback = s, this.bindListeners();
|
|
4330
4361
|
}
|
|
@@ -4342,7 +4373,7 @@ function fa() {
|
|
|
4342
4373
|
return;
|
|
4343
4374
|
}
|
|
4344
4375
|
s.action === "connected" ? this.finish("connected", {
|
|
4345
|
-
connection: new
|
|
4376
|
+
connection: new Qs(s.id, this.transport),
|
|
4346
4377
|
activityTimeout: s.activityTimeout
|
|
4347
4378
|
}) : (this.finish(s.action, { error: s.error }), this.transport.close());
|
|
4348
4379
|
}, this.onClosed = (t) => {
|
|
@@ -4358,7 +4389,7 @@ function fa() {
|
|
|
4358
4389
|
this.callback(pe({ transport: this.transport, action: t }, s));
|
|
4359
4390
|
}
|
|
4360
4391
|
}
|
|
4361
|
-
class
|
|
4392
|
+
class Zs {
|
|
4362
4393
|
constructor(t, s) {
|
|
4363
4394
|
this.timeline = t, this.options = s || {};
|
|
4364
4395
|
}
|
|
@@ -4368,7 +4399,7 @@ function fa() {
|
|
|
4368
4399
|
}
|
|
4369
4400
|
class vt extends Te {
|
|
4370
4401
|
constructor(t, s) {
|
|
4371
|
-
super(function(a,
|
|
4402
|
+
super(function(a, u) {
|
|
4372
4403
|
oe.debug("No callbacks on " + t + " for " + a);
|
|
4373
4404
|
}), this.name = t, this.pusher = s, this.subscribed = !1, this.subscriptionPending = !1, this.subscriptionCancelled = !1;
|
|
4374
4405
|
}
|
|
@@ -4394,8 +4425,8 @@ function fa() {
|
|
|
4394
4425
|
else if (s === "pusher_internal:subscription_count")
|
|
4395
4426
|
this.handleSubscriptionCountEvent(t);
|
|
4396
4427
|
else if (s.indexOf("pusher_internal:") !== 0) {
|
|
4397
|
-
var
|
|
4398
|
-
this.emit(s, a,
|
|
4428
|
+
var u = {};
|
|
4429
|
+
this.emit(s, a, u);
|
|
4399
4430
|
}
|
|
4400
4431
|
}
|
|
4401
4432
|
handleSubscriptionSucceededEvent(t) {
|
|
@@ -4436,7 +4467,7 @@ function fa() {
|
|
|
4436
4467
|
}, s);
|
|
4437
4468
|
}
|
|
4438
4469
|
}
|
|
4439
|
-
class
|
|
4470
|
+
class er {
|
|
4440
4471
|
constructor() {
|
|
4441
4472
|
this.reset();
|
|
4442
4473
|
}
|
|
@@ -4468,8 +4499,8 @@ function fa() {
|
|
|
4468
4499
|
this.members = {}, this.count = 0, this.myID = null, this.me = null;
|
|
4469
4500
|
}
|
|
4470
4501
|
}
|
|
4471
|
-
var
|
|
4472
|
-
function
|
|
4502
|
+
var tr = function(r, t, s, a) {
|
|
4503
|
+
function u(p) {
|
|
4473
4504
|
return p instanceof s ? p : new s(function(S) {
|
|
4474
4505
|
S(p);
|
|
4475
4506
|
});
|
|
@@ -4490,20 +4521,20 @@ function fa() {
|
|
|
4490
4521
|
}
|
|
4491
4522
|
}
|
|
4492
4523
|
function Q(te) {
|
|
4493
|
-
te.done ? p(te.value) :
|
|
4524
|
+
te.done ? p(te.value) : u(te.value).then(L, z);
|
|
4494
4525
|
}
|
|
4495
4526
|
Q((a = a.apply(r, t || [])).next());
|
|
4496
4527
|
});
|
|
4497
4528
|
};
|
|
4498
|
-
class
|
|
4529
|
+
class nr extends bt {
|
|
4499
4530
|
constructor(t, s) {
|
|
4500
|
-
super(t, s), this.members = new
|
|
4531
|
+
super(t, s), this.members = new er();
|
|
4501
4532
|
}
|
|
4502
4533
|
authorize(t, s) {
|
|
4503
|
-
super.authorize(t, (a,
|
|
4534
|
+
super.authorize(t, (a, u) => tr(this, void 0, void 0, function* () {
|
|
4504
4535
|
if (!a)
|
|
4505
|
-
if (
|
|
4506
|
-
var p = JSON.parse(
|
|
4536
|
+
if (u = u, u.channel_data != null) {
|
|
4537
|
+
var p = JSON.parse(u.channel_data);
|
|
4507
4538
|
this.members.setMyID(p.user_id);
|
|
4508
4539
|
} else if (yield this.pusher.user.signinDonePromise, this.pusher.user.user_data != null)
|
|
4509
4540
|
this.members.setMyID(this.pusher.user.user_data.id);
|
|
@@ -4512,7 +4543,7 @@ function fa() {
|
|
|
4512
4543
|
oe.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${S}, or the user should be signed in.`), s("Invalid auth response");
|
|
4513
4544
|
return;
|
|
4514
4545
|
}
|
|
4515
|
-
s(a,
|
|
4546
|
+
s(a, u);
|
|
4516
4547
|
}));
|
|
4517
4548
|
}
|
|
4518
4549
|
handleEvent(t) {
|
|
@@ -4520,8 +4551,8 @@ function fa() {
|
|
|
4520
4551
|
if (s.indexOf("pusher_internal:") === 0)
|
|
4521
4552
|
this.handleInternalEvent(t);
|
|
4522
4553
|
else {
|
|
4523
|
-
var a = t.data,
|
|
4524
|
-
t.user_id && (
|
|
4554
|
+
var a = t.data, u = {};
|
|
4555
|
+
t.user_id && (u.user_id = t.user_id), this.emit(s, a, u);
|
|
4525
4556
|
}
|
|
4526
4557
|
}
|
|
4527
4558
|
handleInternalEvent(t) {
|
|
@@ -4534,8 +4565,8 @@ function fa() {
|
|
|
4534
4565
|
this.handleSubscriptionCountEvent(t);
|
|
4535
4566
|
break;
|
|
4536
4567
|
case "pusher_internal:member_added":
|
|
4537
|
-
var
|
|
4538
|
-
this.emit("pusher:member_added",
|
|
4568
|
+
var u = this.members.addMember(a);
|
|
4569
|
+
this.emit("pusher:member_added", u);
|
|
4539
4570
|
break;
|
|
4540
4571
|
case "pusher_internal:member_removed":
|
|
4541
4572
|
var p = this.members.removeMember(a);
|
|
@@ -4550,23 +4581,23 @@ function fa() {
|
|
|
4550
4581
|
this.members.reset(), super.disconnect();
|
|
4551
4582
|
}
|
|
4552
4583
|
}
|
|
4553
|
-
var
|
|
4554
|
-
class
|
|
4584
|
+
var sr = c(1), yt = c(0);
|
|
4585
|
+
class rr extends bt {
|
|
4555
4586
|
constructor(t, s, a) {
|
|
4556
4587
|
super(t, s), this.key = null, this.nacl = a;
|
|
4557
4588
|
}
|
|
4558
4589
|
authorize(t, s) {
|
|
4559
|
-
super.authorize(t, (a,
|
|
4590
|
+
super.authorize(t, (a, u) => {
|
|
4560
4591
|
if (a) {
|
|
4561
|
-
s(a,
|
|
4592
|
+
s(a, u);
|
|
4562
4593
|
return;
|
|
4563
4594
|
}
|
|
4564
|
-
let p =
|
|
4595
|
+
let p = u.shared_secret;
|
|
4565
4596
|
if (!p) {
|
|
4566
4597
|
s(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
|
|
4567
4598
|
return;
|
|
4568
4599
|
}
|
|
4569
|
-
this.key = Object(yt.decode)(p), delete
|
|
4600
|
+
this.key = Object(yt.decode)(p), delete u.shared_secret, s(null, u);
|
|
4570
4601
|
});
|
|
4571
4602
|
}
|
|
4572
4603
|
trigger(t, s) {
|
|
@@ -4594,19 +4625,19 @@ function fa() {
|
|
|
4594
4625
|
oe.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${a.length}`);
|
|
4595
4626
|
return;
|
|
4596
4627
|
}
|
|
4597
|
-
let
|
|
4598
|
-
if (
|
|
4599
|
-
oe.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${
|
|
4628
|
+
let u = Object(yt.decode)(s.nonce);
|
|
4629
|
+
if (u.length < this.nacl.secretbox.nonceLength) {
|
|
4630
|
+
oe.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${u.length}`);
|
|
4600
4631
|
return;
|
|
4601
4632
|
}
|
|
4602
|
-
let p = this.nacl.secretbox.open(a,
|
|
4633
|
+
let p = this.nacl.secretbox.open(a, u, this.key);
|
|
4603
4634
|
if (p === null) {
|
|
4604
4635
|
oe.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, L) => {
|
|
4605
4636
|
if (S) {
|
|
4606
4637
|
oe.error(`Failed to make a request to the authEndpoint: ${L}. Unable to fetch new key, so dropping encrypted event`);
|
|
4607
4638
|
return;
|
|
4608
4639
|
}
|
|
4609
|
-
if (p = this.nacl.secretbox.open(a,
|
|
4640
|
+
if (p = this.nacl.secretbox.open(a, u, this.key), p === null) {
|
|
4610
4641
|
oe.error("Failed to decrypt event with new key. Dropping encrypted event");
|
|
4611
4642
|
return;
|
|
4612
4643
|
}
|
|
@@ -4617,7 +4648,7 @@ function fa() {
|
|
|
4617
4648
|
this.emit(t, this.getDataToEmit(p));
|
|
4618
4649
|
}
|
|
4619
4650
|
getDataToEmit(t) {
|
|
4620
|
-
let s = Object(
|
|
4651
|
+
let s = Object(sr.decode)(t);
|
|
4621
4652
|
try {
|
|
4622
4653
|
return JSON.parse(s);
|
|
4623
4654
|
} catch {
|
|
@@ -4625,7 +4656,7 @@ function fa() {
|
|
|
4625
4656
|
}
|
|
4626
4657
|
}
|
|
4627
4658
|
}
|
|
4628
|
-
class
|
|
4659
|
+
class ir extends Te {
|
|
4629
4660
|
constructor(t, s) {
|
|
4630
4661
|
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);
|
|
4631
4662
|
var a = j.getNetwork();
|
|
@@ -4773,20 +4804,20 @@ function fa() {
|
|
|
4773
4804
|
updateState(t, s) {
|
|
4774
4805
|
var a = this.state;
|
|
4775
4806
|
if (this.state = t, a !== t) {
|
|
4776
|
-
var
|
|
4777
|
-
|
|
4807
|
+
var u = t;
|
|
4808
|
+
u === "connected" && (u += " with new socket ID " + s.socket_id), oe.debug("State changed", a + " -> " + u), this.timeline.info({ state: t, params: s }), this.emit("state_change", { previous: a, current: t }), this.emit(t, s);
|
|
4778
4809
|
}
|
|
4779
4810
|
}
|
|
4780
4811
|
shouldRetry() {
|
|
4781
4812
|
return this.state === "connecting" || this.state === "connected";
|
|
4782
4813
|
}
|
|
4783
4814
|
}
|
|
4784
|
-
class
|
|
4815
|
+
class or {
|
|
4785
4816
|
constructor() {
|
|
4786
4817
|
this.channels = {};
|
|
4787
4818
|
}
|
|
4788
4819
|
add(t, s) {
|
|
4789
|
-
return this.channels[t] || (this.channels[t] =
|
|
4820
|
+
return this.channels[t] || (this.channels[t] = ar(t, s)), this.channels[t];
|
|
4790
4821
|
}
|
|
4791
4822
|
all() {
|
|
4792
4823
|
return X(this.channels);
|
|
@@ -4804,7 +4835,7 @@ function fa() {
|
|
|
4804
4835
|
});
|
|
4805
4836
|
}
|
|
4806
4837
|
}
|
|
4807
|
-
function
|
|
4838
|
+
function ar(r, t) {
|
|
4808
4839
|
if (r.indexOf("private-encrypted-") === 0) {
|
|
4809
4840
|
if (t.config.nacl)
|
|
4810
4841
|
return Ee.createEncryptedChannel(r, t, t.config.nacl);
|
|
@@ -4820,12 +4851,12 @@ function fa() {
|
|
|
4820
4851
|
return Ee.createChannel(r, t);
|
|
4821
4852
|
}
|
|
4822
4853
|
}
|
|
4823
|
-
var
|
|
4854
|
+
var cr = {
|
|
4824
4855
|
createChannels() {
|
|
4825
|
-
return new
|
|
4856
|
+
return new or();
|
|
4826
4857
|
},
|
|
4827
4858
|
createConnectionManager(r, t) {
|
|
4828
|
-
return new
|
|
4859
|
+
return new ir(r, t);
|
|
4829
4860
|
},
|
|
4830
4861
|
createChannel(r, t) {
|
|
4831
4862
|
return new vt(r, t);
|
|
@@ -4834,21 +4865,21 @@ function fa() {
|
|
|
4834
4865
|
return new bt(r, t);
|
|
4835
4866
|
},
|
|
4836
4867
|
createPresenceChannel(r, t) {
|
|
4837
|
-
return new
|
|
4868
|
+
return new nr(r, t);
|
|
4838
4869
|
},
|
|
4839
4870
|
createEncryptedChannel(r, t, s) {
|
|
4840
|
-
return new
|
|
4871
|
+
return new rr(r, t, s);
|
|
4841
4872
|
},
|
|
4842
4873
|
createTimelineSender(r, t) {
|
|
4843
|
-
return new
|
|
4874
|
+
return new Zs(r, t);
|
|
4844
4875
|
},
|
|
4845
4876
|
createHandshake(r, t) {
|
|
4846
|
-
return new
|
|
4877
|
+
return new Ys(r, t);
|
|
4847
4878
|
},
|
|
4848
4879
|
createAssistantToTheTransportManager(r, t, s) {
|
|
4849
|
-
return new
|
|
4880
|
+
return new Ks(r, t, s);
|
|
4850
4881
|
}
|
|
4851
|
-
}, Ee =
|
|
4882
|
+
}, Ee = cr;
|
|
4852
4883
|
class cn {
|
|
4853
4884
|
constructor(t) {
|
|
4854
4885
|
this.options = t || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
@@ -4874,10 +4905,10 @@ function fa() {
|
|
|
4874
4905
|
return ye(this.strategies, ue.method("isSupported"));
|
|
4875
4906
|
}
|
|
4876
4907
|
connect(t, s) {
|
|
4877
|
-
var a = this.strategies,
|
|
4878
|
-
Q ? s(null, Q) : (
|
|
4908
|
+
var a = this.strategies, u = 0, p = this.timeout, S = null, L = (z, Q) => {
|
|
4909
|
+
Q ? s(null, Q) : (u = u + 1, this.loop && (u = u % a.length), u < a.length ? (p && (p = p * 2, this.timeoutLimit && (p = Math.min(p, this.timeoutLimit))), S = this.tryStrategy(a[u], t, { timeout: p, failFast: this.failFast }, L)) : s(!0));
|
|
4879
4910
|
};
|
|
4880
|
-
return S = this.tryStrategy(a[
|
|
4911
|
+
return S = this.tryStrategy(a[u], t, { timeout: p, failFast: this.failFast }, L), {
|
|
4881
4912
|
abort: function() {
|
|
4882
4913
|
S.abort();
|
|
4883
4914
|
},
|
|
@@ -4886,12 +4917,12 @@ function fa() {
|
|
|
4886
4917
|
}
|
|
4887
4918
|
};
|
|
4888
4919
|
}
|
|
4889
|
-
tryStrategy(t, s, a,
|
|
4920
|
+
tryStrategy(t, s, a, u) {
|
|
4890
4921
|
var p = null, S = null;
|
|
4891
4922
|
return a.timeout > 0 && (p = new U(a.timeout, function() {
|
|
4892
|
-
S.abort(),
|
|
4923
|
+
S.abort(), u(!0);
|
|
4893
4924
|
})), S = t.connect(s, function(L, z) {
|
|
4894
|
-
L && p && p.isRunning() && !a.failFast || (p && p.ensureAborted(),
|
|
4925
|
+
L && p && p.isRunning() && !a.failFast || (p && p.ensureAborted(), u(L, z));
|
|
4895
4926
|
}), {
|
|
4896
4927
|
abort: function() {
|
|
4897
4928
|
p && p.ensureAborted(), S.abort();
|
|
@@ -4910,43 +4941,43 @@ function fa() {
|
|
|
4910
4941
|
return ye(this.strategies, ue.method("isSupported"));
|
|
4911
4942
|
}
|
|
4912
4943
|
connect(t, s) {
|
|
4913
|
-
return
|
|
4944
|
+
return ur(this.strategies, t, function(a, u) {
|
|
4914
4945
|
return function(p, S) {
|
|
4915
|
-
if (
|
|
4916
|
-
|
|
4946
|
+
if (u[a].error = p, p) {
|
|
4947
|
+
lr(u) && s(!0);
|
|
4917
4948
|
return;
|
|
4918
4949
|
}
|
|
4919
|
-
Y(
|
|
4950
|
+
Y(u, function(L) {
|
|
4920
4951
|
L.forceMinPriority(S.transport.priority);
|
|
4921
4952
|
}), s(null, S);
|
|
4922
4953
|
};
|
|
4923
4954
|
});
|
|
4924
4955
|
}
|
|
4925
4956
|
}
|
|
4926
|
-
function
|
|
4927
|
-
var a = ge(r, function(
|
|
4928
|
-
return
|
|
4957
|
+
function ur(r, t, s) {
|
|
4958
|
+
var a = ge(r, function(u, p, S, L) {
|
|
4959
|
+
return u.connect(t, s(p, L));
|
|
4929
4960
|
});
|
|
4930
4961
|
return {
|
|
4931
4962
|
abort: function() {
|
|
4932
|
-
Y(a,
|
|
4963
|
+
Y(a, dr);
|
|
4933
4964
|
},
|
|
4934
|
-
forceMinPriority: function(
|
|
4965
|
+
forceMinPriority: function(u) {
|
|
4935
4966
|
Y(a, function(p) {
|
|
4936
|
-
p.forceMinPriority(
|
|
4967
|
+
p.forceMinPriority(u);
|
|
4937
4968
|
});
|
|
4938
4969
|
}
|
|
4939
4970
|
};
|
|
4940
4971
|
}
|
|
4941
|
-
function
|
|
4972
|
+
function lr(r) {
|
|
4942
4973
|
return Ce(r, function(t) {
|
|
4943
4974
|
return !!t.error;
|
|
4944
4975
|
});
|
|
4945
4976
|
}
|
|
4946
|
-
function
|
|
4977
|
+
function dr(r) {
|
|
4947
4978
|
!r.error && !r.aborted && (r.abort(), r.aborted = !0);
|
|
4948
4979
|
}
|
|
4949
|
-
class
|
|
4980
|
+
class hr {
|
|
4950
4981
|
constructor(t, s, a) {
|
|
4951
4982
|
this.strategy = t, this.transports = s, this.ttl = a.ttl || 1800 * 1e3, this.usingTLS = a.useTLS, this.timeline = a.timeline;
|
|
4952
4983
|
}
|
|
@@ -4954,20 +4985,20 @@ function fa() {
|
|
|
4954
4985
|
return this.strategy.isSupported();
|
|
4955
4986
|
}
|
|
4956
4987
|
connect(t, s) {
|
|
4957
|
-
var a = this.usingTLS,
|
|
4958
|
-
if (
|
|
4959
|
-
var L = this.transports[
|
|
4960
|
-
L && (["ws", "wss"].includes(
|
|
4988
|
+
var a = this.usingTLS, u = fr(a), p = u && u.cacheSkipCount ? u.cacheSkipCount : 0, S = [this.strategy];
|
|
4989
|
+
if (u && u.timestamp + this.ttl >= ue.now()) {
|
|
4990
|
+
var L = this.transports[u.transport];
|
|
4991
|
+
L && (["ws", "wss"].includes(u.transport) || p > 3 ? (this.timeline.info({
|
|
4961
4992
|
cached: !0,
|
|
4962
|
-
transport:
|
|
4963
|
-
latency:
|
|
4993
|
+
transport: u.transport,
|
|
4994
|
+
latency: u.latency
|
|
4964
4995
|
}), S.push(new Le([L], {
|
|
4965
|
-
timeout:
|
|
4996
|
+
timeout: u.latency * 2 + 1e3,
|
|
4966
4997
|
failFast: !0
|
|
4967
4998
|
}))) : p++);
|
|
4968
4999
|
}
|
|
4969
5000
|
var z = ue.now(), Q = S.pop().connect(t, function te(ce, nt) {
|
|
4970
|
-
ce ? (un(a), S.length > 0 ? (z = ue.now(), Q = S.pop().connect(t, te)) : s(ce)) : (
|
|
5001
|
+
ce ? (un(a), S.length > 0 ? (z = ue.now(), Q = S.pop().connect(t, te)) : s(ce)) : (pr(a, nt.transport.name, ue.now() - z, p), s(null, nt));
|
|
4971
5002
|
});
|
|
4972
5003
|
return {
|
|
4973
5004
|
abort: function() {
|
|
@@ -4982,7 +5013,7 @@ function fa() {
|
|
|
4982
5013
|
function St(r) {
|
|
4983
5014
|
return "pusherTransport" + (r ? "TLS" : "NonTLS");
|
|
4984
5015
|
}
|
|
4985
|
-
function
|
|
5016
|
+
function fr(r) {
|
|
4986
5017
|
var t = j.getLocalStorage();
|
|
4987
5018
|
if (t)
|
|
4988
5019
|
try {
|
|
@@ -4994,11 +5025,11 @@ function fa() {
|
|
|
4994
5025
|
}
|
|
4995
5026
|
return null;
|
|
4996
5027
|
}
|
|
4997
|
-
function
|
|
4998
|
-
var
|
|
4999
|
-
if (
|
|
5028
|
+
function pr(r, t, s, a) {
|
|
5029
|
+
var u = j.getLocalStorage();
|
|
5030
|
+
if (u)
|
|
5000
5031
|
try {
|
|
5001
|
-
|
|
5032
|
+
u[St(r)] = Ye({
|
|
5002
5033
|
timestamp: ue.now(),
|
|
5003
5034
|
transport: t,
|
|
5004
5035
|
latency: s,
|
|
@@ -5023,15 +5054,15 @@ function fa() {
|
|
|
5023
5054
|
return this.strategy.isSupported();
|
|
5024
5055
|
}
|
|
5025
5056
|
connect(t, s) {
|
|
5026
|
-
var a = this.strategy,
|
|
5027
|
-
|
|
5057
|
+
var a = this.strategy, u, p = new U(this.options.delay, function() {
|
|
5058
|
+
u = a.connect(t, s);
|
|
5028
5059
|
});
|
|
5029
5060
|
return {
|
|
5030
5061
|
abort: function() {
|
|
5031
|
-
p.ensureAborted(),
|
|
5062
|
+
p.ensureAborted(), u && u.abort();
|
|
5032
5063
|
},
|
|
5033
5064
|
forceMinPriority: function(S) {
|
|
5034
|
-
t = S,
|
|
5065
|
+
t = S, u && u.forceMinPriority(S);
|
|
5035
5066
|
}
|
|
5036
5067
|
};
|
|
5037
5068
|
}
|
|
@@ -5049,7 +5080,7 @@ function fa() {
|
|
|
5049
5080
|
return a.connect(t, s);
|
|
5050
5081
|
}
|
|
5051
5082
|
}
|
|
5052
|
-
class
|
|
5083
|
+
class gr {
|
|
5053
5084
|
constructor(t) {
|
|
5054
5085
|
this.strategy = t;
|
|
5055
5086
|
}
|
|
@@ -5057,8 +5088,8 @@ function fa() {
|
|
|
5057
5088
|
return this.strategy.isSupported();
|
|
5058
5089
|
}
|
|
5059
5090
|
connect(t, s) {
|
|
5060
|
-
var a = this.strategy.connect(t, function(
|
|
5061
|
-
p && a.abort(), s(
|
|
5091
|
+
var a = this.strategy.connect(t, function(u, p) {
|
|
5092
|
+
p && a.abort(), s(u, p);
|
|
5062
5093
|
});
|
|
5063
5094
|
return a;
|
|
5064
5095
|
}
|
|
@@ -5068,10 +5099,10 @@ function fa() {
|
|
|
5068
5099
|
return r.isSupported();
|
|
5069
5100
|
};
|
|
5070
5101
|
}
|
|
5071
|
-
var
|
|
5102
|
+
var mr = function(r, t, s) {
|
|
5072
5103
|
var a = {};
|
|
5073
|
-
function
|
|
5074
|
-
var Sn = s(r, _n,
|
|
5104
|
+
function u(_n, gi, mi, vi, bi) {
|
|
5105
|
+
var Sn = s(r, _n, gi, mi, vi, bi);
|
|
5075
5106
|
return a[_n] = Sn, Sn;
|
|
5076
5107
|
}
|
|
5077
5108
|
var p = Object.assign({}, t, {
|
|
@@ -5095,36 +5126,36 @@ function fa() {
|
|
|
5095
5126
|
lives: 2,
|
|
5096
5127
|
minPingDelay: 1e4,
|
|
5097
5128
|
maxPingDelay: r.activityTimeout
|
|
5098
|
-
}), ce =
|
|
5099
|
-
new ze(je(pn), pn,
|
|
5129
|
+
}), ce = u("ws", "ws", 3, p, Q), nt = u("wss", "ws", 3, S, Q), li = u("sockjs", "sockjs", 1, L), pn = u("xhr_streaming", "xhr_streaming", 1, L, te), di = u("xdr_streaming", "xdr_streaming", 1, L, te), gn = u("xhr_polling", "xhr_polling", 1, L), hi = u("xdr_polling", "xdr_polling", 1, L), mn = new Le([ce], z), fi = new Le([nt], z), pi = new Le([li], z), vn = new Le([
|
|
5130
|
+
new ze(je(pn), pn, di)
|
|
5100
5131
|
], z), bn = new Le([
|
|
5101
|
-
new ze(je(gn), gn,
|
|
5132
|
+
new ze(je(gn), gn, hi)
|
|
5102
5133
|
], z), yn = new Le([
|
|
5103
5134
|
new ze(je(vn), new _t([
|
|
5104
5135
|
vn,
|
|
5105
5136
|
new et(bn, { delay: 4e3 })
|
|
5106
5137
|
]), bn)
|
|
5107
|
-
], z), Et = new ze(je(yn), yn,
|
|
5138
|
+
], z), Et = new ze(je(yn), yn, pi), At;
|
|
5108
5139
|
return t.useTLS ? At = new _t([
|
|
5109
5140
|
mn,
|
|
5110
5141
|
new et(Et, { delay: 2e3 })
|
|
5111
5142
|
]) : At = new _t([
|
|
5112
5143
|
mn,
|
|
5113
|
-
new et(
|
|
5144
|
+
new et(fi, { delay: 2e3 }),
|
|
5114
5145
|
new et(Et, { delay: 5e3 })
|
|
5115
|
-
]), new
|
|
5146
|
+
]), new hr(new gr(new ze(je(ce), At, Et)), a, {
|
|
5116
5147
|
ttl: 18e5,
|
|
5117
5148
|
timeline: t.timeline,
|
|
5118
5149
|
useTLS: t.useTLS
|
|
5119
5150
|
});
|
|
5120
|
-
},
|
|
5151
|
+
}, vr = mr, br = (function() {
|
|
5121
5152
|
var r = this;
|
|
5122
5153
|
r.timeline.info(r.buildTimelineMessage({
|
|
5123
5154
|
transport: r.name + (r.options.useTLS ? "s" : "")
|
|
5124
5155
|
})), r.hooks.isInitialized() ? r.changeState("initialized") : r.hooks.file ? (r.changeState("initializing"), _.load(r.hooks.file, { useTLS: r.options.useTLS }, function(t, s) {
|
|
5125
5156
|
r.hooks.isInitialized() ? (r.changeState("initialized"), s(!0)) : (t && r.onError(t), r.onClose(), s(!1));
|
|
5126
5157
|
})) : r.onClose();
|
|
5127
|
-
}),
|
|
5158
|
+
}), yr = {
|
|
5128
5159
|
getRequest: function(r) {
|
|
5129
5160
|
var t = new window.XDomainRequest();
|
|
5130
5161
|
return t.ontimeout = function() {
|
|
@@ -5140,9 +5171,9 @@ function fa() {
|
|
|
5140
5171
|
abortRequest: function(r) {
|
|
5141
5172
|
r.ontimeout = r.onerror = r.onprogress = r.onload = null, r.abort();
|
|
5142
5173
|
}
|
|
5143
|
-
},
|
|
5144
|
-
const
|
|
5145
|
-
class
|
|
5174
|
+
}, _r = yr;
|
|
5175
|
+
const Sr = 256 * 1024;
|
|
5176
|
+
class Cr extends Te {
|
|
5146
5177
|
constructor(t, s, a) {
|
|
5147
5178
|
super(), this.hooks = t, this.method = s, this.url = a;
|
|
5148
5179
|
}
|
|
@@ -5170,17 +5201,17 @@ function fa() {
|
|
|
5170
5201
|
return a !== -1 ? (this.position += a + 1, s.slice(0, a)) : null;
|
|
5171
5202
|
}
|
|
5172
5203
|
isBufferTooLong(t) {
|
|
5173
|
-
return this.position === t.length && t.length >
|
|
5204
|
+
return this.position === t.length && t.length > Sr;
|
|
5174
5205
|
}
|
|
5175
5206
|
}
|
|
5176
5207
|
var Ct;
|
|
5177
5208
|
(function(r) {
|
|
5178
5209
|
r[r.CONNECTING = 0] = "CONNECTING", r[r.OPEN = 1] = "OPEN", r[r.CLOSED = 3] = "CLOSED";
|
|
5179
5210
|
})(Ct || (Ct = {}));
|
|
5180
|
-
var Ie = Ct,
|
|
5181
|
-
class
|
|
5211
|
+
var Ie = Ct, wr = 1;
|
|
5212
|
+
class Tr {
|
|
5182
5213
|
constructor(t, s) {
|
|
5183
|
-
this.hooks = t, this.session = dn(1e3) + "/" +
|
|
5214
|
+
this.hooks = t, this.session = dn(1e3) + "/" + Pr(8), this.location = Er(s), this.readyState = Ie.CONNECTING, this.openStream();
|
|
5184
5215
|
}
|
|
5185
5216
|
send(t) {
|
|
5186
5217
|
return this.sendRaw(JSON.stringify([t]));
|
|
@@ -5194,7 +5225,7 @@ function fa() {
|
|
|
5194
5225
|
sendRaw(t) {
|
|
5195
5226
|
if (this.readyState === Ie.OPEN)
|
|
5196
5227
|
try {
|
|
5197
|
-
return j.createSocketRequest("POST", ln(
|
|
5228
|
+
return j.createSocketRequest("POST", ln(Ar(this.location, this.session))).start(t), !0;
|
|
5198
5229
|
} catch {
|
|
5199
5230
|
return !1;
|
|
5200
5231
|
}
|
|
@@ -5221,8 +5252,8 @@ function fa() {
|
|
|
5221
5252
|
break;
|
|
5222
5253
|
case "a":
|
|
5223
5254
|
s = JSON.parse(t.data.slice(1) || "[]");
|
|
5224
|
-
for (var
|
|
5225
|
-
this.onEvent(s[
|
|
5255
|
+
for (var u = 0; u < s.length; u++)
|
|
5256
|
+
this.onEvent(s[u]);
|
|
5226
5257
|
break;
|
|
5227
5258
|
case "m":
|
|
5228
5259
|
s = JSON.parse(t.data.slice(1) || "null"), this.onEvent(s);
|
|
@@ -5237,7 +5268,7 @@ function fa() {
|
|
|
5237
5268
|
}
|
|
5238
5269
|
}
|
|
5239
5270
|
onOpen(t) {
|
|
5240
|
-
this.readyState === Ie.CONNECTING ? (t && t.hostname && (this.location.base =
|
|
5271
|
+
this.readyState === Ie.CONNECTING ? (t && t.hostname && (this.location.base = Rr(this.location.base, t.hostname)), this.readyState = Ie.OPEN, this.onopen && this.onopen()) : this.onClose(1006, "Server lost session", !0);
|
|
5241
5272
|
}
|
|
5242
5273
|
onEvent(t) {
|
|
5243
5274
|
this.readyState === Ie.OPEN && this.onmessage && this.onmessage({ data: t });
|
|
@@ -5268,33 +5299,33 @@ function fa() {
|
|
|
5268
5299
|
this.stream && (this.stream.unbind_all(), this.stream.close(), this.stream = null);
|
|
5269
5300
|
}
|
|
5270
5301
|
}
|
|
5271
|
-
function
|
|
5302
|
+
function Er(r) {
|
|
5272
5303
|
var t = /([^\?]*)\/*(\??.*)/.exec(r);
|
|
5273
5304
|
return {
|
|
5274
5305
|
base: t[1],
|
|
5275
5306
|
queryString: t[2]
|
|
5276
5307
|
};
|
|
5277
5308
|
}
|
|
5278
|
-
function
|
|
5309
|
+
function Ar(r, t) {
|
|
5279
5310
|
return r.base + "/" + t + "/xhr_send";
|
|
5280
5311
|
}
|
|
5281
5312
|
function ln(r) {
|
|
5282
5313
|
var t = r.indexOf("?") === -1 ? "?" : "&";
|
|
5283
|
-
return r + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" +
|
|
5314
|
+
return r + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" + wr++;
|
|
5284
5315
|
}
|
|
5285
|
-
function
|
|
5316
|
+
function Rr(r, t) {
|
|
5286
5317
|
var s = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(r);
|
|
5287
5318
|
return s[1] + t + s[3];
|
|
5288
5319
|
}
|
|
5289
5320
|
function dn(r) {
|
|
5290
5321
|
return j.randomInt(r);
|
|
5291
5322
|
}
|
|
5292
|
-
function
|
|
5323
|
+
function Pr(r) {
|
|
5293
5324
|
for (var t = [], s = 0; s < r; s++)
|
|
5294
5325
|
t.push(dn(32).toString(32));
|
|
5295
5326
|
return t.join("");
|
|
5296
5327
|
}
|
|
5297
|
-
var
|
|
5328
|
+
var Mr = Tr, xr = {
|
|
5298
5329
|
getReceiveURL: function(r, t) {
|
|
5299
5330
|
return r.base + "/" + t + "/xhr_streaming" + r.queryString;
|
|
5300
5331
|
},
|
|
@@ -5307,7 +5338,7 @@ function fa() {
|
|
|
5307
5338
|
onFinished: function(r, t) {
|
|
5308
5339
|
r.onClose(1006, "Connection interrupted (" + t + ")", !1);
|
|
5309
5340
|
}
|
|
5310
|
-
},
|
|
5341
|
+
}, kr = xr, Lr = {
|
|
5311
5342
|
getReceiveURL: function(r, t) {
|
|
5312
5343
|
return r.base + "/" + t + "/xhr" + r.queryString;
|
|
5313
5344
|
},
|
|
@@ -5319,7 +5350,7 @@ function fa() {
|
|
|
5319
5350
|
onFinished: function(r, t) {
|
|
5320
5351
|
t === 200 ? r.reconnect() : r.onClose(1006, "Connection interrupted (" + t + ")", !1);
|
|
5321
5352
|
}
|
|
5322
|
-
},
|
|
5353
|
+
}, Ir = Lr, Ur = {
|
|
5323
5354
|
getRequest: function(r) {
|
|
5324
5355
|
var t = j.getXHRAPI(), s = new t();
|
|
5325
5356
|
return s.onreadystatechange = s.onprogress = function() {
|
|
@@ -5336,36 +5367,36 @@ function fa() {
|
|
|
5336
5367
|
abortRequest: function(r) {
|
|
5337
5368
|
r.onreadystatechange = null, r.abort();
|
|
5338
5369
|
}
|
|
5339
|
-
},
|
|
5370
|
+
}, Or = Ur, Fr = {
|
|
5340
5371
|
createStreamingSocket(r) {
|
|
5341
|
-
return this.createSocket(
|
|
5372
|
+
return this.createSocket(kr, r);
|
|
5342
5373
|
},
|
|
5343
5374
|
createPollingSocket(r) {
|
|
5344
|
-
return this.createSocket(
|
|
5375
|
+
return this.createSocket(Ir, r);
|
|
5345
5376
|
},
|
|
5346
5377
|
createSocket(r, t) {
|
|
5347
|
-
return new
|
|
5378
|
+
return new Mr(r, t);
|
|
5348
5379
|
},
|
|
5349
5380
|
createXHR(r, t) {
|
|
5350
|
-
return this.createRequest(
|
|
5381
|
+
return this.createRequest(Or, r, t);
|
|
5351
5382
|
},
|
|
5352
5383
|
createRequest(r, t, s) {
|
|
5353
|
-
return new
|
|
5384
|
+
return new Cr(r, t, s);
|
|
5354
5385
|
}
|
|
5355
|
-
}, hn =
|
|
5386
|
+
}, hn = Fr;
|
|
5356
5387
|
hn.createXDR = function(r, t) {
|
|
5357
|
-
return this.createRequest(
|
|
5388
|
+
return this.createRequest(_r, r, t);
|
|
5358
5389
|
};
|
|
5359
|
-
var
|
|
5390
|
+
var Nr = hn, Dr = {
|
|
5360
5391
|
nextAuthCallbackID: 1,
|
|
5361
5392
|
auth_callbacks: {},
|
|
5362
|
-
ScriptReceivers:
|
|
5393
|
+
ScriptReceivers: d,
|
|
5363
5394
|
DependenciesReceivers: M,
|
|
5364
|
-
getDefaultStrategy:
|
|
5365
|
-
Transports:
|
|
5366
|
-
transportConnectionInitializer:
|
|
5367
|
-
HTTPFactory:
|
|
5368
|
-
TimelineTransport:
|
|
5395
|
+
getDefaultStrategy: vr,
|
|
5396
|
+
Transports: Ws,
|
|
5397
|
+
transportConnectionInitializer: br,
|
|
5398
|
+
HTTPFactory: Nr,
|
|
5399
|
+
TimelineTransport: Us,
|
|
5369
5400
|
getXHRAPI() {
|
|
5370
5401
|
return window.XMLHttpRequest;
|
|
5371
5402
|
},
|
|
@@ -5386,7 +5417,7 @@ function fa() {
|
|
|
5386
5417
|
return this.getDocument().location.protocol;
|
|
5387
5418
|
},
|
|
5388
5419
|
getAuthorizers() {
|
|
5389
|
-
return { ajax: J, jsonp:
|
|
5420
|
+
return { ajax: J, jsonp: Ms };
|
|
5390
5421
|
},
|
|
5391
5422
|
onDocumentBody(r) {
|
|
5392
5423
|
document.body ? r() : setTimeout(() => {
|
|
@@ -5394,10 +5425,10 @@ function fa() {
|
|
|
5394
5425
|
}, 0);
|
|
5395
5426
|
},
|
|
5396
5427
|
createJSONPRequest(r, t) {
|
|
5397
|
-
return new
|
|
5428
|
+
return new ks(r, t);
|
|
5398
5429
|
},
|
|
5399
5430
|
createScriptRequest(r) {
|
|
5400
|
-
return new
|
|
5431
|
+
return new xs(r);
|
|
5401
5432
|
},
|
|
5402
5433
|
getLocalStorage() {
|
|
5403
5434
|
try {
|
|
@@ -5417,7 +5448,7 @@ function fa() {
|
|
|
5417
5448
|
return new ActiveXObject("Microsoft.XMLHTTP");
|
|
5418
5449
|
},
|
|
5419
5450
|
getNetwork() {
|
|
5420
|
-
return
|
|
5451
|
+
return Js;
|
|
5421
5452
|
},
|
|
5422
5453
|
createWebSocket(r) {
|
|
5423
5454
|
var t = this.getWebSocketAPI();
|
|
@@ -5449,12 +5480,12 @@ function fa() {
|
|
|
5449
5480
|
return (window.crypto || window.msCrypto).getRandomValues(new Uint32Array(1))[0] / Math.pow(2, 32);
|
|
5450
5481
|
}() * r);
|
|
5451
5482
|
}
|
|
5452
|
-
}, j =
|
|
5483
|
+
}, j = Dr, wt;
|
|
5453
5484
|
(function(r) {
|
|
5454
5485
|
r[r.ERROR = 3] = "ERROR", r[r.INFO = 6] = "INFO", r[r.DEBUG = 7] = "DEBUG";
|
|
5455
5486
|
})(wt || (wt = {}));
|
|
5456
5487
|
var tt = wt;
|
|
5457
|
-
class
|
|
5488
|
+
class qr {
|
|
5458
5489
|
constructor(t, s, a) {
|
|
5459
5490
|
this.key = t, this.session = s, this.events = [], this.options = a || {}, this.sent = 0, this.uniqueID = 0;
|
|
5460
5491
|
}
|
|
@@ -5484,17 +5515,17 @@ function fa() {
|
|
|
5484
5515
|
features: this.options.features,
|
|
5485
5516
|
timeline: this.events
|
|
5486
5517
|
}, this.options.params);
|
|
5487
|
-
return this.events = [], t(a, (
|
|
5488
|
-
|
|
5518
|
+
return this.events = [], t(a, (u, p) => {
|
|
5519
|
+
u || this.sent++, s && s(u, p);
|
|
5489
5520
|
}), !0;
|
|
5490
5521
|
}
|
|
5491
5522
|
generateUniqueID() {
|
|
5492
5523
|
return this.uniqueID++, this.uniqueID;
|
|
5493
5524
|
}
|
|
5494
5525
|
}
|
|
5495
|
-
class
|
|
5496
|
-
constructor(t, s, a,
|
|
5497
|
-
this.name = t, this.priority = s, this.transport = a, this.options =
|
|
5526
|
+
class zr {
|
|
5527
|
+
constructor(t, s, a, u) {
|
|
5528
|
+
this.name = t, this.priority = s, this.transport = a, this.options = u || {};
|
|
5498
5529
|
}
|
|
5499
5530
|
isSupported() {
|
|
5500
5531
|
return this.transport.isSupported({
|
|
@@ -5506,10 +5537,10 @@ function fa() {
|
|
|
5506
5537
|
if (this.priority < t)
|
|
5507
5538
|
return fn(new N(), s);
|
|
5508
5539
|
} else return fn(new O(), s);
|
|
5509
|
-
var a = !1,
|
|
5510
|
-
|
|
5540
|
+
var a = !1, u = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), p = null, S = function() {
|
|
5541
|
+
u.unbind("initialized", S), u.connect();
|
|
5511
5542
|
}, L = function() {
|
|
5512
|
-
p = Ee.createHandshake(
|
|
5543
|
+
p = Ee.createHandshake(u, function(ce) {
|
|
5513
5544
|
a = !0, te(), s(null, ce);
|
|
5514
5545
|
});
|
|
5515
5546
|
}, z = function(ce) {
|
|
@@ -5517,16 +5548,16 @@ function fa() {
|
|
|
5517
5548
|
}, Q = function() {
|
|
5518
5549
|
te();
|
|
5519
5550
|
var ce;
|
|
5520
|
-
ce = Ye(
|
|
5551
|
+
ce = Ye(u), s(new q(ce));
|
|
5521
5552
|
}, te = function() {
|
|
5522
|
-
|
|
5553
|
+
u.unbind("initialized", S), u.unbind("open", L), u.unbind("error", z), u.unbind("closed", Q);
|
|
5523
5554
|
};
|
|
5524
|
-
return
|
|
5555
|
+
return u.bind("initialized", S), u.bind("open", L), u.bind("error", z), u.bind("closed", Q), u.initialize(), {
|
|
5525
5556
|
abort: () => {
|
|
5526
|
-
a || (te(), p ? p.close() :
|
|
5557
|
+
a || (te(), p ? p.close() : u.close());
|
|
5527
5558
|
},
|
|
5528
5559
|
forceMinPriority: (ce) => {
|
|
5529
|
-
a || this.priority < ce && (p ? p.close() :
|
|
5560
|
+
a || this.priority < ce && (p ? p.close() : u.close());
|
|
5530
5561
|
}
|
|
5531
5562
|
};
|
|
5532
5563
|
}
|
|
@@ -5541,14 +5572,14 @@ function fa() {
|
|
|
5541
5572
|
}
|
|
5542
5573
|
};
|
|
5543
5574
|
}
|
|
5544
|
-
const { Transports:
|
|
5545
|
-
var
|
|
5546
|
-
var S =
|
|
5575
|
+
const { Transports: jr } = j;
|
|
5576
|
+
var $r = function(r, t, s, a, u, p) {
|
|
5577
|
+
var S = jr[s];
|
|
5547
5578
|
if (!S)
|
|
5548
5579
|
throw new k(s);
|
|
5549
5580
|
var L = (!r.enabledTransports || E(r.enabledTransports, t) !== -1) && (!r.disabledTransports || E(r.disabledTransports, t) === -1), z;
|
|
5550
|
-
return L ? (
|
|
5551
|
-
},
|
|
5581
|
+
return L ? (u = Object.assign({ ignoreNullOrigin: r.ignoreNullOrigin }, u), z = new zr(t, a, p ? p.getAssistant(S) : S, u)) : z = Hr, z;
|
|
5582
|
+
}, Hr = {
|
|
5552
5583
|
isSupported: function() {
|
|
5553
5584
|
return !1;
|
|
5554
5585
|
},
|
|
@@ -5565,53 +5596,53 @@ function fa() {
|
|
|
5565
5596
|
};
|
|
5566
5597
|
}
|
|
5567
5598
|
};
|
|
5568
|
-
function
|
|
5599
|
+
function Br(r) {
|
|
5569
5600
|
if (r == null)
|
|
5570
5601
|
throw "You must pass an options object";
|
|
5571
5602
|
if (r.cluster == null)
|
|
5572
5603
|
throw "Options object must provide a cluster";
|
|
5573
5604
|
"disableStats" in r && oe.warn("The disableStats option is deprecated in favor of enableStats");
|
|
5574
5605
|
}
|
|
5575
|
-
const
|
|
5606
|
+
const Vr = (r, t) => {
|
|
5576
5607
|
var s = "socket_id=" + encodeURIComponent(r.socketId);
|
|
5577
5608
|
for (var a in t.params)
|
|
5578
5609
|
s += "&" + encodeURIComponent(a) + "=" + encodeURIComponent(t.params[a]);
|
|
5579
5610
|
if (t.paramsProvider != null) {
|
|
5580
|
-
let
|
|
5581
|
-
for (var a in
|
|
5582
|
-
s += "&" + encodeURIComponent(a) + "=" + encodeURIComponent(
|
|
5611
|
+
let u = t.paramsProvider();
|
|
5612
|
+
for (var a in u)
|
|
5613
|
+
s += "&" + encodeURIComponent(a) + "=" + encodeURIComponent(u[a]);
|
|
5583
5614
|
}
|
|
5584
5615
|
return s;
|
|
5585
5616
|
};
|
|
5586
|
-
var
|
|
5617
|
+
var Xr = (r) => {
|
|
5587
5618
|
if (typeof j.getAuthorizers()[r.transport] > "u")
|
|
5588
5619
|
throw `'${r.transport}' is not a recognized auth transport`;
|
|
5589
5620
|
return (t, s) => {
|
|
5590
|
-
const a =
|
|
5621
|
+
const a = Vr(t, r);
|
|
5591
5622
|
j.getAuthorizers()[r.transport](j, a, r, C.UserAuthentication, s);
|
|
5592
5623
|
};
|
|
5593
5624
|
};
|
|
5594
|
-
const
|
|
5625
|
+
const Wr = (r, t) => {
|
|
5595
5626
|
var s = "socket_id=" + encodeURIComponent(r.socketId);
|
|
5596
5627
|
s += "&channel_name=" + encodeURIComponent(r.channelName);
|
|
5597
5628
|
for (var a in t.params)
|
|
5598
5629
|
s += "&" + encodeURIComponent(a) + "=" + encodeURIComponent(t.params[a]);
|
|
5599
5630
|
if (t.paramsProvider != null) {
|
|
5600
|
-
let
|
|
5601
|
-
for (var a in
|
|
5602
|
-
s += "&" + encodeURIComponent(a) + "=" + encodeURIComponent(
|
|
5631
|
+
let u = t.paramsProvider();
|
|
5632
|
+
for (var a in u)
|
|
5633
|
+
s += "&" + encodeURIComponent(a) + "=" + encodeURIComponent(u[a]);
|
|
5603
5634
|
}
|
|
5604
5635
|
return s;
|
|
5605
5636
|
};
|
|
5606
|
-
var
|
|
5637
|
+
var Gr = (r) => {
|
|
5607
5638
|
if (typeof j.getAuthorizers()[r.transport] > "u")
|
|
5608
5639
|
throw `'${r.transport}' is not a recognized auth transport`;
|
|
5609
5640
|
return (t, s) => {
|
|
5610
|
-
const a =
|
|
5641
|
+
const a = Wr(t, r);
|
|
5611
5642
|
j.getAuthorizers()[r.transport](j, a, r, C.ChannelAuthorization, s);
|
|
5612
5643
|
};
|
|
5613
5644
|
};
|
|
5614
|
-
const
|
|
5645
|
+
const Jr = (r, t, s) => {
|
|
5615
5646
|
const a = {
|
|
5616
5647
|
authTransport: t.transport,
|
|
5617
5648
|
authEndpoint: t.endpoint,
|
|
@@ -5620,12 +5651,12 @@ function fa() {
|
|
|
5620
5651
|
headers: t.headers
|
|
5621
5652
|
}
|
|
5622
5653
|
};
|
|
5623
|
-
return (
|
|
5624
|
-
const S = r.channel(
|
|
5625
|
-
s(S, a).authorize(
|
|
5654
|
+
return (u, p) => {
|
|
5655
|
+
const S = r.channel(u.channelName);
|
|
5656
|
+
s(S, a).authorize(u.socketId, p);
|
|
5626
5657
|
};
|
|
5627
5658
|
};
|
|
5628
|
-
function
|
|
5659
|
+
function Kr(r, t) {
|
|
5629
5660
|
let s = {
|
|
5630
5661
|
activityTimeout: r.activityTimeout || h.activityTimeout,
|
|
5631
5662
|
cluster: r.cluster,
|
|
@@ -5638,46 +5669,46 @@ function fa() {
|
|
|
5638
5669
|
wsPath: r.wsPath || h.wsPath,
|
|
5639
5670
|
wsPort: r.wsPort || h.wsPort,
|
|
5640
5671
|
wssPort: r.wssPort || h.wssPort,
|
|
5641
|
-
enableStats:
|
|
5642
|
-
httpHost:
|
|
5643
|
-
useTLS:
|
|
5644
|
-
wsHost:
|
|
5645
|
-
userAuthenticator:
|
|
5646
|
-
channelAuthorizer:
|
|
5672
|
+
enableStats: ti(r),
|
|
5673
|
+
httpHost: Qr(r),
|
|
5674
|
+
useTLS: ei(r),
|
|
5675
|
+
wsHost: Yr(r),
|
|
5676
|
+
userAuthenticator: ni(r),
|
|
5677
|
+
channelAuthorizer: ri(r, t)
|
|
5647
5678
|
};
|
|
5648
5679
|
return "disabledTransports" in r && (s.disabledTransports = r.disabledTransports), "enabledTransports" in r && (s.enabledTransports = r.enabledTransports), "ignoreNullOrigin" in r && (s.ignoreNullOrigin = r.ignoreNullOrigin), "timelineParams" in r && (s.timelineParams = r.timelineParams), "nacl" in r && (s.nacl = r.nacl), s;
|
|
5649
5680
|
}
|
|
5650
|
-
function Kr(r) {
|
|
5651
|
-
return r.httpHost ? r.httpHost : r.cluster ? `sockjs-${r.cluster}.pusher.com` : h.httpHost;
|
|
5652
|
-
}
|
|
5653
5681
|
function Qr(r) {
|
|
5654
|
-
return r.
|
|
5682
|
+
return r.httpHost ? r.httpHost : r.cluster ? `sockjs-${r.cluster}.pusher.com` : h.httpHost;
|
|
5655
5683
|
}
|
|
5656
5684
|
function Yr(r) {
|
|
5657
|
-
return
|
|
5685
|
+
return r.wsHost ? r.wsHost : Zr(r.cluster);
|
|
5658
5686
|
}
|
|
5659
5687
|
function Zr(r) {
|
|
5660
|
-
return
|
|
5688
|
+
return `ws-${r}.pusher.com`;
|
|
5661
5689
|
}
|
|
5662
5690
|
function ei(r) {
|
|
5663
|
-
return
|
|
5691
|
+
return j.getProtocol() === "https:" ? !0 : r.forceTLS !== !1;
|
|
5664
5692
|
}
|
|
5665
5693
|
function ti(r) {
|
|
5694
|
+
return "enableStats" in r ? r.enableStats : "disableStats" in r ? !r.disableStats : !1;
|
|
5695
|
+
}
|
|
5696
|
+
function ni(r) {
|
|
5666
5697
|
const t = Object.assign(Object.assign({}, h.userAuthentication), r.userAuthentication);
|
|
5667
|
-
return "customHandler" in t && t.customHandler != null ? t.customHandler :
|
|
5698
|
+
return "customHandler" in t && t.customHandler != null ? t.customHandler : Xr(t);
|
|
5668
5699
|
}
|
|
5669
|
-
function
|
|
5700
|
+
function si(r, t) {
|
|
5670
5701
|
let s;
|
|
5671
5702
|
return "channelAuthorization" in r ? s = Object.assign(Object.assign({}, h.channelAuthorization), r.channelAuthorization) : (s = {
|
|
5672
5703
|
transport: r.authTransport || h.authTransport,
|
|
5673
5704
|
endpoint: r.authEndpoint || h.authEndpoint
|
|
5674
|
-
}, "auth" in r && ("params" in r.auth && (s.params = r.auth.params), "headers" in r.auth && (s.headers = r.auth.headers)), "authorizer" in r && (s.customHandler =
|
|
5705
|
+
}, "auth" in r && ("params" in r.auth && (s.params = r.auth.params), "headers" in r.auth && (s.headers = r.auth.headers)), "authorizer" in r && (s.customHandler = Jr(t, s, r.authorizer))), s;
|
|
5675
5706
|
}
|
|
5676
|
-
function
|
|
5677
|
-
const s =
|
|
5678
|
-
return "customHandler" in s && s.customHandler != null ? s.customHandler :
|
|
5707
|
+
function ri(r, t) {
|
|
5708
|
+
const s = si(r, t);
|
|
5709
|
+
return "customHandler" in s && s.customHandler != null ? s.customHandler : Gr(s);
|
|
5679
5710
|
}
|
|
5680
|
-
class
|
|
5711
|
+
class ii extends Te {
|
|
5681
5712
|
constructor(t) {
|
|
5682
5713
|
super(function(s, a) {
|
|
5683
5714
|
oe.debug(`No callbacks on watchlist events for ${s}`);
|
|
@@ -5695,14 +5726,14 @@ function fa() {
|
|
|
5695
5726
|
});
|
|
5696
5727
|
}
|
|
5697
5728
|
}
|
|
5698
|
-
function
|
|
5729
|
+
function oi() {
|
|
5699
5730
|
let r, t;
|
|
5700
|
-
return { promise: new Promise((a,
|
|
5701
|
-
r = a, t =
|
|
5731
|
+
return { promise: new Promise((a, u) => {
|
|
5732
|
+
r = a, t = u;
|
|
5702
5733
|
}), resolve: r, reject: t };
|
|
5703
5734
|
}
|
|
5704
|
-
var
|
|
5705
|
-
class
|
|
5735
|
+
var ai = oi;
|
|
5736
|
+
class ci extends Te {
|
|
5706
5737
|
constructor(t) {
|
|
5707
5738
|
super(function(s, a) {
|
|
5708
5739
|
oe.debug("No callbacks on user for " + s);
|
|
@@ -5717,7 +5748,7 @@ function fa() {
|
|
|
5717
5748
|
});
|
|
5718
5749
|
}, this.pusher = t, this.pusher.connection.bind("state_change", ({ previous: s, current: a }) => {
|
|
5719
5750
|
s !== "connected" && a === "connected" && this._signin(), s === "connected" && a !== "connected" && (this._cleanup(), this._newSigninPromiseIfNeeded());
|
|
5720
|
-
}), this.watchlist = new
|
|
5751
|
+
}), this.watchlist = new ii(t), this.pusher.connection.bind("message", (s) => {
|
|
5721
5752
|
var a = s.event;
|
|
5722
5753
|
a === "pusher:signin_success" && this._onSigninSuccess(s.data), this.serverToUserChannel && this.serverToUserChannel.name === s.channel && this.serverToUserChannel.handleEvent(s);
|
|
5723
5754
|
});
|
|
@@ -5757,7 +5788,7 @@ function fa() {
|
|
|
5757
5788
|
_newSigninPromiseIfNeeded() {
|
|
5758
5789
|
if (!this.signin_requested || this.signinDonePromise && !this.signinDonePromise.done)
|
|
5759
5790
|
return;
|
|
5760
|
-
const { promise: t, resolve: s } =
|
|
5791
|
+
const { promise: t, resolve: s } = ai();
|
|
5761
5792
|
t.done = !1;
|
|
5762
5793
|
const a = () => {
|
|
5763
5794
|
t.done = !0;
|
|
@@ -5777,7 +5808,7 @@ function fa() {
|
|
|
5777
5808
|
}));
|
|
5778
5809
|
}
|
|
5779
5810
|
constructor(t, s) {
|
|
5780
|
-
|
|
5811
|
+
ui(t), Br(s), this.key = t, this.config = Kr(s, this), this.channels = Ee.createChannels(), this.global_emitter = new Te(), this.sessionID = j.randomInt(1e9), this.timeline = new qr(this.key, this.sessionID, {
|
|
5781
5812
|
cluster: this.config.cluster,
|
|
5782
5813
|
features: de.getClientFeatures(),
|
|
5783
5814
|
params: this.config.timelineParams || {},
|
|
@@ -5788,7 +5819,7 @@ function fa() {
|
|
|
5788
5819
|
host: this.config.statsHost,
|
|
5789
5820
|
path: "/timeline/v2/" + j.TimelineTransport.name
|
|
5790
5821
|
}));
|
|
5791
|
-
var a = (
|
|
5822
|
+
var a = (u) => j.getDefaultStrategy(this.config, u, $r);
|
|
5792
5823
|
this.connection = Ee.createConnectionManager(this.key, {
|
|
5793
5824
|
getStrategy: a,
|
|
5794
5825
|
timeline: this.timeline,
|
|
@@ -5798,20 +5829,20 @@ function fa() {
|
|
|
5798
5829
|
useTLS: !!this.config.useTLS
|
|
5799
5830
|
}), this.connection.bind("connected", () => {
|
|
5800
5831
|
this.subscribeAll(), this.timelineSender && this.timelineSender.send(this.connection.isUsingTLS());
|
|
5801
|
-
}), this.connection.bind("message", (
|
|
5802
|
-
var p =
|
|
5803
|
-
if (
|
|
5804
|
-
var L = this.channel(
|
|
5805
|
-
L && L.handleEvent(
|
|
5832
|
+
}), this.connection.bind("message", (u) => {
|
|
5833
|
+
var p = u.event, S = p.indexOf("pusher_internal:") === 0;
|
|
5834
|
+
if (u.channel) {
|
|
5835
|
+
var L = this.channel(u.channel);
|
|
5836
|
+
L && L.handleEvent(u);
|
|
5806
5837
|
}
|
|
5807
|
-
S || this.global_emitter.emit(
|
|
5838
|
+
S || this.global_emitter.emit(u.event, u.data);
|
|
5808
5839
|
}), this.connection.bind("connecting", () => {
|
|
5809
5840
|
this.channels.disconnect();
|
|
5810
5841
|
}), this.connection.bind("disconnected", () => {
|
|
5811
5842
|
this.channels.disconnect();
|
|
5812
|
-
}), this.connection.bind("error", (
|
|
5813
|
-
oe.warn(
|
|
5814
|
-
}), de.instances.push(this), this.timeline.info({ instances: de.instances.length }), this.user = new
|
|
5843
|
+
}), this.connection.bind("error", (u) => {
|
|
5844
|
+
oe.warn(u);
|
|
5845
|
+
}), de.instances.push(this), this.timeline.info({ instances: de.instances.length }), this.user = new ci(this), de.isReady && this.connect();
|
|
5815
5846
|
}
|
|
5816
5847
|
channel(t) {
|
|
5817
5848
|
return this.channels.find(t);
|
|
@@ -5870,7 +5901,7 @@ function fa() {
|
|
|
5870
5901
|
}
|
|
5871
5902
|
de.instances = [], de.isReady = !1, de.logToConsole = !1, de.Runtime = j, de.ScriptReceivers = j.ScriptReceivers, de.DependenciesReceivers = j.DependenciesReceivers, de.auth_callbacks = j.auth_callbacks;
|
|
5872
5903
|
var Tt = o.default = de;
|
|
5873
|
-
function
|
|
5904
|
+
function ui(r) {
|
|
5874
5905
|
if (r == null)
|
|
5875
5906
|
throw "You must pass your app key when you instantiate Pusher.";
|
|
5876
5907
|
}
|
|
@@ -5882,8 +5913,8 @@ function fa() {
|
|
|
5882
5913
|
});
|
|
5883
5914
|
})(It)), It.exports;
|
|
5884
5915
|
}
|
|
5885
|
-
var
|
|
5886
|
-
const
|
|
5916
|
+
var ma = ga();
|
|
5917
|
+
const va = /* @__PURE__ */ pa(ma), ba = "/v1/messenger/bootstrap", ya = 3e4, _a = 3e4, Sa = 5 * 6e4;
|
|
5887
5918
|
function se(e) {
|
|
5888
5919
|
return typeof e == "object" && e !== null;
|
|
5889
5920
|
}
|
|
@@ -5905,7 +5936,7 @@ function Ve(e, n) {
|
|
|
5905
5936
|
const o = i.trim();
|
|
5906
5937
|
return o === "" ? null : o;
|
|
5907
5938
|
}
|
|
5908
|
-
function
|
|
5939
|
+
function Ca(e, n) {
|
|
5909
5940
|
const i = e[n];
|
|
5910
5941
|
if (typeof i == "number" && Number.isFinite(i))
|
|
5911
5942
|
return i;
|
|
@@ -5916,24 +5947,24 @@ function _a(e, n) {
|
|
|
5916
5947
|
}
|
|
5917
5948
|
throw new Error(`Invalid messenger bootstrap payload: missing integer ${n}`);
|
|
5918
5949
|
}
|
|
5919
|
-
function
|
|
5950
|
+
function wa(e) {
|
|
5920
5951
|
return e.toLowerCase() === "http" ? "http" : "https";
|
|
5921
5952
|
}
|
|
5922
|
-
function
|
|
5953
|
+
function Ta(e) {
|
|
5923
5954
|
if (e !== null)
|
|
5924
5955
|
return e.startsWith("/") ? e : `/${e}`;
|
|
5925
5956
|
}
|
|
5926
|
-
function
|
|
5957
|
+
function Ea(e) {
|
|
5927
5958
|
const n = se(e) && se(e.data) ? e.data : e;
|
|
5928
5959
|
if (!se(n))
|
|
5929
5960
|
throw new Error("Invalid messenger bootstrap payload: expected object");
|
|
5930
5961
|
const i = n.auth, o = n.service;
|
|
5931
5962
|
if (!se(i) || !se(o))
|
|
5932
5963
|
throw new Error("Invalid messenger bootstrap payload: missing auth or service data");
|
|
5933
|
-
const
|
|
5934
|
-
if (!se(
|
|
5964
|
+
const c = i.user, l = o.reverb;
|
|
5965
|
+
if (!se(c) || !se(l))
|
|
5935
5966
|
throw new Error("Invalid messenger bootstrap payload: missing user or reverb data");
|
|
5936
|
-
const
|
|
5967
|
+
const d = Ta(Ve(l, "path"));
|
|
5937
5968
|
return {
|
|
5938
5969
|
auth: {
|
|
5939
5970
|
token: Se(i, "token"),
|
|
@@ -5941,11 +5972,11 @@ function wa(e) {
|
|
|
5941
5972
|
expiresAt: Ve(i, "expires_at"),
|
|
5942
5973
|
tenantId: Ve(i, "tenant_id"),
|
|
5943
5974
|
user: {
|
|
5944
|
-
id: Se(
|
|
5945
|
-
handle: Se(
|
|
5946
|
-
name: Se(
|
|
5947
|
-
avatarUrl: Ve(
|
|
5948
|
-
email: Ve(
|
|
5975
|
+
id: Se(c, "id"),
|
|
5976
|
+
handle: Se(c, "handle"),
|
|
5977
|
+
name: Se(c, "name"),
|
|
5978
|
+
avatarUrl: Ve(c, "avatar_url"),
|
|
5979
|
+
email: Ve(c, "email")
|
|
5949
5980
|
}
|
|
5950
5981
|
},
|
|
5951
5982
|
service: {
|
|
@@ -5953,19 +5984,19 @@ function wa(e) {
|
|
|
5953
5984
|
apiBaseUrl: Se(o, "api_base_url"),
|
|
5954
5985
|
broadcastingAuthUrl: Se(o, "broadcasting_auth_url"),
|
|
5955
5986
|
reverb: {
|
|
5956
|
-
appKey: Se(
|
|
5957
|
-
host: Se(
|
|
5958
|
-
port:
|
|
5959
|
-
scheme:
|
|
5960
|
-
...
|
|
5987
|
+
appKey: Se(l, "app_key"),
|
|
5988
|
+
host: Se(l, "host"),
|
|
5989
|
+
port: Ca(l, "port"),
|
|
5990
|
+
scheme: wa(Se(l, "scheme")),
|
|
5991
|
+
...d ? { path: d } : {}
|
|
5961
5992
|
}
|
|
5962
5993
|
}
|
|
5963
5994
|
};
|
|
5964
5995
|
}
|
|
5965
|
-
function
|
|
5996
|
+
function Aa(e) {
|
|
5966
5997
|
return e.replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/:\d+$/, "");
|
|
5967
5998
|
}
|
|
5968
|
-
function
|
|
5999
|
+
function Ra(e) {
|
|
5969
6000
|
if (!se(e))
|
|
5970
6001
|
return !1;
|
|
5971
6002
|
const n = se(e.response) ? e.response : null;
|
|
@@ -5974,7 +6005,7 @@ function Ea(e) {
|
|
|
5974
6005
|
const i = n.data;
|
|
5975
6006
|
return i?.code === "ACCOUNT_SUSPENDED" || i?.errors?.reason === "account_suspended" ? !0 : typeof i?.message == "string" && i.message.toLowerCase().includes("suspended");
|
|
5976
6007
|
}
|
|
5977
|
-
function
|
|
6008
|
+
function Bn(e, n) {
|
|
5978
6009
|
if (e.headers instanceof Cn) {
|
|
5979
6010
|
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"));
|
|
5980
6011
|
return;
|
|
@@ -5991,53 +6022,53 @@ function Ae(e, n, i) {
|
|
|
5991
6022
|
const o = e[n];
|
|
5992
6023
|
if (typeof o == "string" && o.trim() !== "")
|
|
5993
6024
|
return o;
|
|
5994
|
-
const
|
|
5995
|
-
return typeof
|
|
6025
|
+
const c = e[i];
|
|
6026
|
+
return typeof c == "string" && c.trim() !== "" ? c : null;
|
|
5996
6027
|
}
|
|
5997
|
-
function
|
|
6028
|
+
function Pa(e) {
|
|
5998
6029
|
if (typeof e != "string")
|
|
5999
6030
|
return null;
|
|
6000
6031
|
const n = e.trim().toLowerCase();
|
|
6001
6032
|
return n === "online" || n === "idle" || n === "dnd" || n === "offline" ? n : null;
|
|
6002
6033
|
}
|
|
6003
|
-
function
|
|
6034
|
+
function Ma(e, n) {
|
|
6004
6035
|
if (!se(e))
|
|
6005
6036
|
return null;
|
|
6006
|
-
const i = Ae(e, "user_id", "userId"), o =
|
|
6037
|
+
const i = Ae(e, "user_id", "userId"), o = Pa(e.status);
|
|
6007
6038
|
if (!i || !o)
|
|
6008
6039
|
return null;
|
|
6009
|
-
const
|
|
6040
|
+
const c = {
|
|
6010
6041
|
user_id: i,
|
|
6011
6042
|
tenant_scope: Ae(e, "tenant_scope", "tenantScope") ?? n,
|
|
6012
6043
|
status: o,
|
|
6013
6044
|
ts: Ae(e, "ts", "timestamp") ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6014
|
-
},
|
|
6015
|
-
typeof
|
|
6016
|
-
const
|
|
6017
|
-
return typeof
|
|
6045
|
+
}, l = e.tenant_id ?? e.tenantId;
|
|
6046
|
+
typeof l == "string" ? c.tenant_id = l : l === null && (c.tenant_id = null);
|
|
6047
|
+
const d = e.last_seen_at ?? e.lastSeenAt;
|
|
6048
|
+
return typeof d == "string" ? c.last_seen_at = d : d === null && (c.last_seen_at = null), c;
|
|
6018
6049
|
}
|
|
6019
|
-
function
|
|
6050
|
+
function xa(e) {
|
|
6020
6051
|
if (!se(e))
|
|
6021
6052
|
return null;
|
|
6022
6053
|
const n = Ae(e, "user_id", "userId"), i = Ae(e, "conversation_id", "conversationId");
|
|
6023
6054
|
if (!n || !i)
|
|
6024
6055
|
return null;
|
|
6025
|
-
const o = e.user,
|
|
6056
|
+
const o = e.user, c = se(o) ? {
|
|
6026
6057
|
id: typeof o.id == "string" && o.id !== "" ? o.id : n,
|
|
6027
6058
|
name: typeof o.name == "string" ? o.name : "",
|
|
6028
6059
|
...typeof o.avatar == "string" && o.avatar !== "" ? { avatar: o.avatar } : {}
|
|
6029
|
-
} : void 0,
|
|
6060
|
+
} : void 0, l = e.state, d = l === "start" || l === "stop" || l === "typing" || l === "idle" || l === "viewing" ? l : e.type === "typing" ? "typing" : void 0;
|
|
6030
6061
|
return {
|
|
6031
6062
|
user_id: n,
|
|
6032
6063
|
conversation_id: i,
|
|
6033
|
-
...
|
|
6034
|
-
...
|
|
6064
|
+
...d ? { state: d } : {},
|
|
6065
|
+
...c ? { user: c } : {},
|
|
6035
6066
|
...typeof e.ts == "string" ? { ts: e.ts } : {},
|
|
6036
6067
|
...typeof e.started_at == "string" ? { started_at: e.started_at } : {},
|
|
6037
6068
|
...typeof e.stopped_at == "string" ? { stopped_at: e.stopped_at } : {}
|
|
6038
6069
|
};
|
|
6039
6070
|
}
|
|
6040
|
-
function
|
|
6071
|
+
function ka(e) {
|
|
6041
6072
|
if (!se(e))
|
|
6042
6073
|
return null;
|
|
6043
6074
|
const n = Ae(e, "user_id", "userId"), i = Ae(e, "conversation_id", "conversationId");
|
|
@@ -6056,7 +6087,7 @@ function Ma(e) {
|
|
|
6056
6087
|
...typeof e.ts == "string" ? { ts: e.ts } : {}
|
|
6057
6088
|
};
|
|
6058
6089
|
}
|
|
6059
|
-
function
|
|
6090
|
+
function La(e) {
|
|
6060
6091
|
if (!se(e))
|
|
6061
6092
|
return null;
|
|
6062
6093
|
const n = Ae(e, "user_id", "userId"), i = Ae(e, "conversation_id", "conversationId");
|
|
@@ -6067,43 +6098,43 @@ function xa(e) {
|
|
|
6067
6098
|
...typeof e.ts == "string" ? { ts: e.ts } : {}
|
|
6068
6099
|
};
|
|
6069
6100
|
}
|
|
6070
|
-
function
|
|
6101
|
+
function Ia(e) {
|
|
6071
6102
|
return se(e) && le(e, "id") && le(e, "name");
|
|
6072
6103
|
}
|
|
6073
|
-
function
|
|
6074
|
-
return !se(e) || !le(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) =>
|
|
6104
|
+
function Ua(e) {
|
|
6105
|
+
return !se(e) || !le(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => Ia(n));
|
|
6075
6106
|
}
|
|
6076
|
-
function
|
|
6107
|
+
function Oa(e) {
|
|
6077
6108
|
return se(e) && se(e.message) && le(e.message, "id") && le(e.message, "conversation_id") && le(e.message, "author_id");
|
|
6078
6109
|
}
|
|
6079
|
-
function
|
|
6110
|
+
function Fa(e) {
|
|
6080
6111
|
return se(e) && le(e, "conversation_id") && le(e, "user_id") && le(e, "message_id");
|
|
6081
6112
|
}
|
|
6082
|
-
function
|
|
6113
|
+
function Na(e) {
|
|
6083
6114
|
return se(e) && le(e, "conversation_id") && se(e.message) && le(e.message, "id");
|
|
6084
6115
|
}
|
|
6085
|
-
function
|
|
6116
|
+
function Da(e) {
|
|
6086
6117
|
return se(e) && le(e, "conversation_id") && le(e, "message_id");
|
|
6087
6118
|
}
|
|
6088
|
-
function
|
|
6089
|
-
return se(e) && le(e, "conversation_id") && le(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) =>
|
|
6119
|
+
function qa(e) {
|
|
6120
|
+
return se(e) && le(e, "conversation_id") && le(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => Ua(n));
|
|
6090
6121
|
}
|
|
6091
|
-
function
|
|
6122
|
+
function za(e) {
|
|
6092
6123
|
return se(e) && le(e, "conversation_id");
|
|
6093
6124
|
}
|
|
6094
|
-
function
|
|
6125
|
+
function ja(e) {
|
|
6095
6126
|
return se(e) && le(e, "conversation_id") && le(e, "removed_user_id");
|
|
6096
6127
|
}
|
|
6097
6128
|
function Oe(e, n, i, o) {
|
|
6098
|
-
const
|
|
6099
|
-
i(
|
|
6129
|
+
const c = (l) => {
|
|
6130
|
+
i(l) && o(l);
|
|
6100
6131
|
};
|
|
6101
|
-
return e.listen(n,
|
|
6132
|
+
return e.listen(n, c), c;
|
|
6102
6133
|
}
|
|
6103
|
-
function
|
|
6104
|
-
const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ??
|
|
6105
|
-
typeof window < "u" && (window.Pusher =
|
|
6106
|
-
let
|
|
6134
|
+
function rc(e) {
|
|
6135
|
+
const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ?? ba, o = e.bootstrapRefreshSkewMs ?? ya, c = e.presenceFreshnessTtlMs ?? Sa, l = (e.createLogger ?? Jt())("MessengerEcho");
|
|
6136
|
+
typeof window < "u" && (window.Pusher = va);
|
|
6137
|
+
let d = null, g = null, h = null, x = null, M = "disconnected", _ = "available", T = null, y = null;
|
|
6107
6138
|
const w = /* @__PURE__ */ new Set(), C = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Map(), m = (E) => {
|
|
6108
6139
|
M = E;
|
|
6109
6140
|
for (const P of w)
|
|
@@ -6117,12 +6148,12 @@ function nc(e) {
|
|
|
6117
6148
|
}, q = (E = !0) => {
|
|
6118
6149
|
h !== null && (h.disconnect(), h = null), x = null, E && m("disconnected");
|
|
6119
6150
|
}, G = () => {
|
|
6120
|
-
N(),
|
|
6151
|
+
N(), d = null, g = null, T = null, v("available"), q(), f.clear();
|
|
6121
6152
|
}, k = () => {
|
|
6122
6153
|
if (!e.getSourceToken)
|
|
6123
6154
|
return null;
|
|
6124
6155
|
const E = e.getSourceToken();
|
|
6125
|
-
return E === null ? (G(), null) : (T !== null && T !== E && (N(),
|
|
6156
|
+
return E === null ? (G(), null) : (T !== null && T !== E && (N(), d = null, g = null, v("available"), q()), T = E, E);
|
|
6126
6157
|
}, O = (E) => {
|
|
6127
6158
|
if (E === null)
|
|
6128
6159
|
return !1;
|
|
@@ -6140,16 +6171,16 @@ function nc(e) {
|
|
|
6140
6171
|
y = setTimeout(() => {
|
|
6141
6172
|
J();
|
|
6142
6173
|
}, D);
|
|
6143
|
-
}, F = async (E = !1) => e.getSourceToken && k() === null || !E && _ === "account_suspended" ? null : !E && O(
|
|
6174
|
+
}, F = async (E = !1) => e.getSourceToken && k() === null || !E && _ === "account_suspended" ? null : !E && O(d) ? d : !E && g !== null ? await g : (g = (async () => {
|
|
6144
6175
|
try {
|
|
6145
6176
|
const D = await e.bootstrapClient.get(
|
|
6146
6177
|
i,
|
|
6147
6178
|
E ? { params: { refresh: 1 } } : void 0
|
|
6148
|
-
), X =
|
|
6149
|
-
return
|
|
6179
|
+
), X = Ea(D.data);
|
|
6180
|
+
return d = X, v("available"), H(X), X;
|
|
6150
6181
|
} catch (D) {
|
|
6151
|
-
if (
|
|
6152
|
-
return
|
|
6182
|
+
if (Ra(D))
|
|
6183
|
+
return d = null, N(), v("account_suspended"), q(), m("disconnected"), null;
|
|
6153
6184
|
throw D;
|
|
6154
6185
|
}
|
|
6155
6186
|
})().finally(() => {
|
|
@@ -6161,12 +6192,12 @@ function nc(e) {
|
|
|
6161
6192
|
return;
|
|
6162
6193
|
q(!1), await ee(!0);
|
|
6163
6194
|
} catch (P) {
|
|
6164
|
-
|
|
6195
|
+
l.warn("Failed to refresh messenger bootstrap", P);
|
|
6165
6196
|
}
|
|
6166
6197
|
}, me = (E) => {
|
|
6167
6198
|
const P = E.connector?.pusher?.connection;
|
|
6168
6199
|
if (!P) {
|
|
6169
|
-
|
|
6200
|
+
l.warn("Messenger echo connector does not expose a Pusher connection");
|
|
6170
6201
|
return;
|
|
6171
6202
|
}
|
|
6172
6203
|
P.bind("connecting", () => {
|
|
@@ -6191,7 +6222,7 @@ function nc(e) {
|
|
|
6191
6222
|
}
|
|
6192
6223
|
(X === "unavailable" || X === "failed" || X === "disconnected") && m("disconnected");
|
|
6193
6224
|
}), P.state === "connected" && m("connected");
|
|
6194
|
-
}, ee = async (E = !1) => !E && h !== null && O(
|
|
6225
|
+
}, ee = async (E = !1) => !E && h !== null && O(d) ? h : !E && x !== null ? await x : (x = (async () => {
|
|
6195
6226
|
const D = await F(E);
|
|
6196
6227
|
if (D === null)
|
|
6197
6228
|
return null;
|
|
@@ -6199,7 +6230,7 @@ function nc(e) {
|
|
|
6199
6230
|
const X = D.service.reverb.scheme === "https", Y = {
|
|
6200
6231
|
broadcaster: "reverb",
|
|
6201
6232
|
key: D.service.reverb.appKey,
|
|
6202
|
-
wsHost:
|
|
6233
|
+
wsHost: Aa(D.service.reverb.host),
|
|
6203
6234
|
wsPort: D.service.reverb.port,
|
|
6204
6235
|
wssPort: D.service.reverb.port,
|
|
6205
6236
|
forceTLS: X,
|
|
@@ -6214,11 +6245,11 @@ function nc(e) {
|
|
|
6214
6245
|
}
|
|
6215
6246
|
}
|
|
6216
6247
|
};
|
|
6217
|
-
return D.service.reverb.path && (Y.wsPath = D.service.reverb.path), h = new
|
|
6248
|
+
return D.service.reverb.path && (Y.wsPath = D.service.reverb.path), h = new fa(Y), me(h), m("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
|
|
6218
6249
|
})().finally(() => {
|
|
6219
6250
|
x = null;
|
|
6220
6251
|
}), await x), b = jt.create({
|
|
6221
|
-
timeout: e.requestTimeoutMs ??
|
|
6252
|
+
timeout: e.requestTimeoutMs ?? _a,
|
|
6222
6253
|
withCredentials: !1,
|
|
6223
6254
|
headers: {
|
|
6224
6255
|
Accept: "application/json",
|
|
@@ -6229,7 +6260,7 @@ function nc(e) {
|
|
|
6229
6260
|
const P = await F();
|
|
6230
6261
|
if (P === null)
|
|
6231
6262
|
throw new Error("Messenger bootstrap is unavailable.");
|
|
6232
|
-
return E.baseURL = P.service.apiBaseUrl,
|
|
6263
|
+
return E.baseURL = P.service.apiBaseUrl, Bn(E, P.auth.token), E;
|
|
6233
6264
|
}), b.interceptors.response.use(
|
|
6234
6265
|
(E) => E,
|
|
6235
6266
|
async (E) => {
|
|
@@ -6238,18 +6269,18 @@ function nc(e) {
|
|
|
6238
6269
|
P._messengerRetry = !0;
|
|
6239
6270
|
const D = await F(!0);
|
|
6240
6271
|
if (D !== null)
|
|
6241
|
-
return P.baseURL = D.service.apiBaseUrl,
|
|
6272
|
+
return P.baseURL = D.service.apiBaseUrl, Bn(P, D.auth.token), await b(P);
|
|
6242
6273
|
}
|
|
6243
6274
|
return Promise.reject(E);
|
|
6244
6275
|
}
|
|
6245
6276
|
);
|
|
6246
6277
|
const I = () => _ === "account_suspended" ? null : (ee().catch((E) => {
|
|
6247
|
-
|
|
6278
|
+
l.warn("Failed to initialize messenger echo", E);
|
|
6248
6279
|
}), h), ae = (E) => (w.add(E), E(M), () => {
|
|
6249
6280
|
w.delete(E);
|
|
6250
6281
|
}), B = (E) => (C.add(E), E(_), () => {
|
|
6251
6282
|
C.delete(E);
|
|
6252
|
-
}), A = () =>
|
|
6283
|
+
}), A = () => d?.auth.tenantId ?? "global", V = (E) => {
|
|
6253
6284
|
const P = Dt(E.ts)?.getTime() ?? Dt(E.last_seen_at)?.getTime() ?? null;
|
|
6254
6285
|
if (P === null)
|
|
6255
6286
|
return !0;
|
|
@@ -6262,7 +6293,7 @@ function nc(e) {
|
|
|
6262
6293
|
seenAt: Y
|
|
6263
6294
|
});
|
|
6264
6295
|
for (const [ge, we] of f.entries())
|
|
6265
|
-
Y - we.seenAt >
|
|
6296
|
+
Y - we.seenAt > c && f.delete(ge);
|
|
6266
6297
|
return !0;
|
|
6267
6298
|
}, ne = (E) => {
|
|
6268
6299
|
const P = I();
|
|
@@ -6280,7 +6311,7 @@ function nc(e) {
|
|
|
6280
6311
|
];
|
|
6281
6312
|
for (const Y of X)
|
|
6282
6313
|
D.listen(Y, (ge) => {
|
|
6283
|
-
const we =
|
|
6314
|
+
const we = Ma(ge, A());
|
|
6284
6315
|
!we || !V(we) || E(we);
|
|
6285
6316
|
});
|
|
6286
6317
|
}, _e = () => {
|
|
@@ -6293,25 +6324,25 @@ function nc(e) {
|
|
|
6293
6324
|
const X = D.private(`conversation.${E}`), Y = [];
|
|
6294
6325
|
return P.onMessageSent && Y.push({
|
|
6295
6326
|
event: ".ConversationMessageSent",
|
|
6296
|
-
handler: Oe(X, ".ConversationMessageSent",
|
|
6327
|
+
handler: Oe(X, ".ConversationMessageSent", Oa, P.onMessageSent)
|
|
6297
6328
|
}), P.onMessageRead && Y.push({
|
|
6298
6329
|
event: ".ConversationMessageRead",
|
|
6299
|
-
handler: Oe(X, ".ConversationMessageRead",
|
|
6330
|
+
handler: Oe(X, ".ConversationMessageRead", Fa, P.onMessageRead)
|
|
6300
6331
|
}), P.onMessageEdited && Y.push({
|
|
6301
6332
|
event: ".ConversationMessageEdited",
|
|
6302
|
-
handler: Oe(X, ".ConversationMessageEdited",
|
|
6333
|
+
handler: Oe(X, ".ConversationMessageEdited", Na, P.onMessageEdited)
|
|
6303
6334
|
}), P.onMessageDeleted && Y.push({
|
|
6304
6335
|
event: ".ConversationMessageDeleted",
|
|
6305
|
-
handler: Oe(X, ".ConversationMessageDeleted",
|
|
6336
|
+
handler: Oe(X, ".ConversationMessageDeleted", Da, P.onMessageDeleted)
|
|
6306
6337
|
}), P.onReactionToggled && Y.push({
|
|
6307
6338
|
event: ".MessageReactionToggled",
|
|
6308
|
-
handler: Oe(X, ".MessageReactionToggled",
|
|
6339
|
+
handler: Oe(X, ".MessageReactionToggled", qa, P.onReactionToggled)
|
|
6309
6340
|
}), P.onRequestAccepted && Y.push({
|
|
6310
6341
|
event: ".ConversationRequestAccepted",
|
|
6311
|
-
handler: Oe(X, ".ConversationRequestAccepted",
|
|
6342
|
+
handler: Oe(X, ".ConversationRequestAccepted", za, P.onRequestAccepted)
|
|
6312
6343
|
}), P.onParticipantRemoved && Y.push({
|
|
6313
6344
|
event: ".ConversationParticipantRemoved",
|
|
6314
|
-
handler: Oe(X, ".ConversationParticipantRemoved",
|
|
6345
|
+
handler: Oe(X, ".ConversationParticipantRemoved", ja, P.onParticipantRemoved)
|
|
6315
6346
|
}), () => {
|
|
6316
6347
|
if (typeof X.stopListening == "function")
|
|
6317
6348
|
for (const ge of Y)
|
|
@@ -6332,7 +6363,7 @@ function nc(e) {
|
|
|
6332
6363
|
], we = [".typing.start", "typing.start", ".TypingStarted", "TypingStarted", ".TypingStart", "TypingStart"], Ke = [".typing.stop", "typing.stop", ".TypingStopped", "TypingStopped", ".TypingStop", "TypingStop"], Qe = /* @__PURE__ */ new Set(["start", "typing"]), ft = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]);
|
|
6333
6364
|
for (const ye of ge) {
|
|
6334
6365
|
const Ce = (xe) => {
|
|
6335
|
-
const K =
|
|
6366
|
+
const K = xa(xe);
|
|
6336
6367
|
if (K) {
|
|
6337
6368
|
if (Qe.has(K.state)) {
|
|
6338
6369
|
D.onTypingStart?.({
|
|
@@ -6357,7 +6388,7 @@ function nc(e) {
|
|
|
6357
6388
|
}
|
|
6358
6389
|
for (const ye of we) {
|
|
6359
6390
|
const Ce = (xe) => {
|
|
6360
|
-
const K =
|
|
6391
|
+
const K = ka(xe);
|
|
6361
6392
|
if (!K)
|
|
6362
6393
|
return;
|
|
6363
6394
|
const qe = {
|
|
@@ -6376,7 +6407,7 @@ function nc(e) {
|
|
|
6376
6407
|
}
|
|
6377
6408
|
for (const ye of Ke) {
|
|
6378
6409
|
const Ce = (xe) => {
|
|
6379
|
-
const K =
|
|
6410
|
+
const K = La(xe);
|
|
6380
6411
|
if (!K)
|
|
6381
6412
|
return;
|
|
6382
6413
|
const qe = {
|
|
@@ -6401,7 +6432,7 @@ function nc(e) {
|
|
|
6401
6432
|
return Je().then((ge) => {
|
|
6402
6433
|
X || !ge || (Y = re(ge, E, P));
|
|
6403
6434
|
}).catch((ge) => {
|
|
6404
|
-
|
|
6435
|
+
l.warn("Failed to defer typing subscription", ge);
|
|
6405
6436
|
}), () => {
|
|
6406
6437
|
X = !0, Y?.();
|
|
6407
6438
|
};
|
|
@@ -6430,74 +6461,74 @@ function nc(e) {
|
|
|
6430
6461
|
};
|
|
6431
6462
|
}
|
|
6432
6463
|
export {
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6464
|
+
xo as DEFAULT_PRESENCE_STALE_AFTER_MS,
|
|
6465
|
+
nc as configureMessengerClient,
|
|
6466
|
+
rc as createMessengerEcho,
|
|
6436
6467
|
W as getApi,
|
|
6437
6468
|
Fe as getAuthStore,
|
|
6438
6469
|
wn as getConnectionStatus,
|
|
6439
6470
|
Pe as getEcho,
|
|
6440
|
-
|
|
6471
|
+
ns as getEchoConnectionStatus,
|
|
6441
6472
|
We as getEchoInitializedEvent,
|
|
6442
6473
|
Z as getErrorMessage,
|
|
6443
6474
|
Jt as getLoggerFactory,
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
|
|
6447
|
-
|
|
6448
|
-
|
|
6475
|
+
fs as getMainApi,
|
|
6476
|
+
vo as getMainEcho,
|
|
6477
|
+
bo as getMainEchoConnectionStatus,
|
|
6478
|
+
mo as getMainEchoInitializedEvent,
|
|
6479
|
+
Bi as getMediaApi,
|
|
6449
6480
|
Ot as getMessagingAccessState,
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6481
|
+
jo as getPresenceRuntimeConfig,
|
|
6482
|
+
Bo as hasConfiguredPresenceAuthTokenResolver,
|
|
6483
|
+
Ja as hasResponse,
|
|
6484
|
+
ac as isAxiosError,
|
|
6485
|
+
Ga as isError,
|
|
6486
|
+
Ni as isValidMessageDeletedEvent,
|
|
6487
|
+
Fi as isValidMessageEditedEvent,
|
|
6488
|
+
Oi as isValidMessageReadEvent,
|
|
6489
|
+
Ui as isValidMessageSentEvent,
|
|
6490
|
+
Di as isValidReactionToggledEvent,
|
|
6491
|
+
qi as isValidRequestAcceptedEvent,
|
|
6461
6492
|
Re as messagingApi,
|
|
6462
|
-
|
|
6463
|
-
|
|
6493
|
+
Lo as normalizePresenceStatus,
|
|
6494
|
+
ps as normalizePresenceTimestamp,
|
|
6464
6495
|
ht as onConnectionStatusChange,
|
|
6465
|
-
|
|
6466
|
-
|
|
6496
|
+
yo as onMainEchoConnectionStatusChange,
|
|
6497
|
+
Ti as onMessagingAccessStateChange,
|
|
6467
6498
|
Dt as parsePresenceTimestamp,
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
+
Ei as reconnectEcho,
|
|
6500
|
+
_o as reconnectMainEcho,
|
|
6501
|
+
Ii as resetEchoRuntimeConfig,
|
|
6502
|
+
Eo as resetLoggerFactory,
|
|
6503
|
+
Mo as resetMainApiClient,
|
|
6504
|
+
Co as resetMainEchoRuntimeConfig,
|
|
6505
|
+
ji as resetMessagingApiClient,
|
|
6506
|
+
Hi as resetMessagingAuthStoreResolver,
|
|
6507
|
+
Xi as resetMessagingMediaApi,
|
|
6508
|
+
sc as resetMessengerClientConfig,
|
|
6509
|
+
Ho as resetPresenceRuntimeConfig,
|
|
6510
|
+
Io as resolveFreshPresenceStatus,
|
|
6511
|
+
jn as resolvePresenceSnapshot,
|
|
6512
|
+
Li as setEchoRuntimeConfig,
|
|
6513
|
+
To as setLoggerFactory,
|
|
6514
|
+
Po as setMainApiClient,
|
|
6515
|
+
So as setMainEchoRuntimeConfig,
|
|
6516
|
+
zi as setMessagingApiClient,
|
|
6517
|
+
$i as setMessagingAuthStoreResolver,
|
|
6518
|
+
Vi as setMessagingMediaApi,
|
|
6519
|
+
$o as setPresenceRuntimeConfig,
|
|
6520
|
+
Pi as subscribeToConversation,
|
|
6521
|
+
Ai as subscribeToPresenceStatus,
|
|
6522
|
+
xi as subscribeToTyping,
|
|
6523
|
+
Mi as unsubscribeFromConversation,
|
|
6524
|
+
Ri as unsubscribeFromPresenceStatus,
|
|
6525
|
+
ki as unsubscribeFromTyping,
|
|
6526
|
+
Qa as useConnectionStatus,
|
|
6527
|
+
Ka as useConversationChannel,
|
|
6528
|
+
Ya as useGlobalMessaging,
|
|
6529
|
+
Za as useMessagingAccessState,
|
|
6499
6530
|
Wt as useMessagingStore,
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6531
|
+
ec as usePresence,
|
|
6532
|
+
tc as useTypingChannel,
|
|
6533
|
+
wi as waitForEcho
|
|
6503
6534
|
};
|