@codingfactory/messenger-client 0.2.4 → 0.2.5
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 +890 -878
- package/dist/services/echo.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ref as de, getCurrentInstance as Mt, computed as
|
|
1
|
+
import { ref as de, getCurrentInstance as Mt, computed as se, watch as Rt, onUnmounted as $e, toValue as Ln, onMounted as Un } from "vue";
|
|
2
2
|
import { defineStore as ci, storeToRefs as ui } from "pinia";
|
|
3
3
|
import kt, { isAxiosError as li, AxiosHeaders as pn } from "axios";
|
|
4
|
-
import { isAxiosError as
|
|
4
|
+
import { isAxiosError as Ba } from "axios";
|
|
5
5
|
import { useRoute as hi } from "vue-router";
|
|
6
6
|
const On = () => () => {
|
|
7
7
|
}, Nn = async () => {
|
|
@@ -25,7 +25,7 @@ const On = () => () => {
|
|
|
25
25
|
unsubscribeFromConversation: qn,
|
|
26
26
|
subscribeToTyping: $n,
|
|
27
27
|
unsubscribeFromTyping: zn
|
|
28
|
-
},
|
|
28
|
+
}, ze = () => J.ECHO_INITIALIZED_EVENT, Pe = () => J.getEcho(), Hn = () => J.getConnectionStatus(), ka = () => Hn(), it = (e) => J.onConnectionStatusChange(e), di = async () => {
|
|
29
29
|
await J.reconnect();
|
|
30
30
|
}, fi = (e) => J.subscribeToPresenceStatus(e), pi = () => J.unsubscribeFromPresenceStatus(), gi = (e, n) => J.subscribeToConversation(e, n), mi = (e) => J.unsubscribeFromConversation(e), vi = (e, n) => J.subscribeToTyping(e, n), bi = (e) => J.unsubscribeFromTyping(e);
|
|
31
31
|
function yi(e) {
|
|
@@ -34,40 +34,43 @@ function yi(e) {
|
|
|
34
34
|
function _i() {
|
|
35
35
|
J.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", J.getEcho = () => null, J.getConnectionStatus = () => "disconnected", J.onConnectionStatusChange = On, J.reconnect = Nn, J.subscribeToPresenceStatus = Fn, J.unsubscribeFromPresenceStatus = Dn, J.subscribeToConversation = jn, J.unsubscribeFromConversation = qn, J.subscribeToTyping = $n, J.unsubscribeFromTyping = zn;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function je(e) {
|
|
38
38
|
return typeof e == "object" && e !== null;
|
|
39
39
|
}
|
|
40
40
|
function Si(e) {
|
|
41
|
-
return
|
|
41
|
+
return je(e) && typeof e.conversation_id == "string" && je(e.message) && typeof e.message.id == "string" && typeof e.message.conversation_id == "string" && typeof e.message.author_id == "string";
|
|
42
42
|
}
|
|
43
43
|
function wi(e) {
|
|
44
|
-
return
|
|
44
|
+
return je(e) && typeof e.conversation_id == "string" && typeof e.user_id == "string" && typeof e.message_id == "string";
|
|
45
45
|
}
|
|
46
46
|
function Ci(e) {
|
|
47
|
-
return
|
|
47
|
+
return je(e) && typeof e.conversation_id == "string" && typeof e.message_id == "string" && Array.isArray(e.reactions);
|
|
48
|
+
}
|
|
49
|
+
function Ti(e) {
|
|
50
|
+
return je(e) && typeof e.conversation_id == "string";
|
|
48
51
|
}
|
|
49
52
|
const Bn = kt;
|
|
50
53
|
let It = Bn;
|
|
51
54
|
function W() {
|
|
52
55
|
return It;
|
|
53
56
|
}
|
|
54
|
-
function
|
|
57
|
+
function Ei(e) {
|
|
55
58
|
It = e;
|
|
56
59
|
}
|
|
57
|
-
function
|
|
60
|
+
function Ri() {
|
|
58
61
|
It = Bn;
|
|
59
62
|
}
|
|
60
63
|
const Vn = {
|
|
61
64
|
currentUser: null
|
|
62
65
|
};
|
|
63
66
|
let Lt = () => Vn;
|
|
64
|
-
function
|
|
67
|
+
function xe() {
|
|
65
68
|
return Lt;
|
|
66
69
|
}
|
|
67
|
-
function
|
|
70
|
+
function Ai(e) {
|
|
68
71
|
Lt = e;
|
|
69
72
|
}
|
|
70
|
-
function
|
|
73
|
+
function Pi() {
|
|
71
74
|
Lt = () => Vn;
|
|
72
75
|
}
|
|
73
76
|
function Z(e) {
|
|
@@ -77,10 +80,10 @@ function Z(e) {
|
|
|
77
80
|
}
|
|
78
81
|
return e instanceof Error ? e.message : typeof e == "string" ? e : typeof e == "object" && e !== null && "message" in e && typeof e.message == "string" ? e.message : "An unexpected error occurred";
|
|
79
82
|
}
|
|
80
|
-
function
|
|
83
|
+
function Ia(e) {
|
|
81
84
|
return e instanceof Error;
|
|
82
85
|
}
|
|
83
|
-
function
|
|
86
|
+
function La(e) {
|
|
84
87
|
return typeof e == "object" && e !== null && "response" in e && typeof e.response == "object";
|
|
85
88
|
}
|
|
86
89
|
const Xn = {
|
|
@@ -89,25 +92,25 @@ const Xn = {
|
|
|
89
92
|
}
|
|
90
93
|
};
|
|
91
94
|
let Ut = Xn;
|
|
92
|
-
function
|
|
95
|
+
function xi() {
|
|
93
96
|
return Ut;
|
|
94
97
|
}
|
|
95
|
-
function
|
|
98
|
+
function Mi(e) {
|
|
96
99
|
Ut = e;
|
|
97
100
|
}
|
|
98
|
-
function
|
|
101
|
+
function ki() {
|
|
99
102
|
Ut = Xn;
|
|
100
103
|
}
|
|
101
|
-
function
|
|
104
|
+
function Ii(e) {
|
|
102
105
|
return e !== null && typeof e == "object" && "id" in e && "type" in e && "participants" in e;
|
|
103
106
|
}
|
|
104
107
|
function Wn(e) {
|
|
105
108
|
return typeof e == "object" && e !== null;
|
|
106
109
|
}
|
|
107
|
-
function
|
|
110
|
+
function Ue(e) {
|
|
108
111
|
return !Wn(e) || !("data" in e) ? e : e.data;
|
|
109
112
|
}
|
|
110
|
-
function
|
|
113
|
+
function Ke(e, n) {
|
|
111
114
|
const i = e[n];
|
|
112
115
|
if (typeof i != "string")
|
|
113
116
|
throw new Error(`Invalid messaging folder payload: missing string ${n}`);
|
|
@@ -136,39 +139,39 @@ function At(e) {
|
|
|
136
139
|
if (!Wn(e))
|
|
137
140
|
throw new Error("Invalid messaging folder payload: expected object");
|
|
138
141
|
return {
|
|
139
|
-
id:
|
|
140
|
-
name:
|
|
142
|
+
id: Ke(e, "id"),
|
|
143
|
+
name: Ke(e, "name"),
|
|
141
144
|
color: gn(e, "color"),
|
|
142
145
|
icon: gn(e, "icon"),
|
|
143
146
|
sort_order: _t(e, "sort_order"),
|
|
144
147
|
conversation_count: _t(e, "conversation_count"),
|
|
145
148
|
unread_count: _t(e, "unread_count"),
|
|
146
|
-
created_at:
|
|
147
|
-
updated_at:
|
|
149
|
+
created_at: Ke(e, "created_at"),
|
|
150
|
+
updated_at: Ke(e, "updated_at")
|
|
148
151
|
};
|
|
149
152
|
}
|
|
150
|
-
function
|
|
153
|
+
function Li(e) {
|
|
151
154
|
if (!Array.isArray(e))
|
|
152
155
|
throw new Error("Invalid messaging folder payload: expected array");
|
|
153
156
|
return e.map((n) => At(n));
|
|
154
157
|
}
|
|
155
158
|
function mn(e) {
|
|
156
|
-
if (!
|
|
159
|
+
if (!Ii(e))
|
|
157
160
|
throw new Error("Invalid conversation payload from folder assignment endpoint");
|
|
158
161
|
return e;
|
|
159
162
|
}
|
|
160
|
-
const
|
|
163
|
+
const we = {
|
|
161
164
|
async fetchFolders() {
|
|
162
165
|
const e = await W().get("/v1/messaging/folders");
|
|
163
|
-
return
|
|
166
|
+
return Li(Ue(e.data));
|
|
164
167
|
},
|
|
165
168
|
async createFolder(e) {
|
|
166
169
|
const n = await W().post("/v1/messaging/folders", e);
|
|
167
|
-
return At(
|
|
170
|
+
return At(Ue(n.data));
|
|
168
171
|
},
|
|
169
172
|
async updateFolder(e, n) {
|
|
170
173
|
const i = await W().patch(`/v1/messaging/folders/${e}`, n);
|
|
171
|
-
return At(
|
|
174
|
+
return At(Ue(i.data));
|
|
172
175
|
},
|
|
173
176
|
async deleteFolder(e) {
|
|
174
177
|
await W().delete(`/v1/messaging/folders/${e}`);
|
|
@@ -180,16 +183,16 @@ const Se = {
|
|
|
180
183
|
const i = await W().patch(`/v1/messaging/conversations/${e}/folder`, {
|
|
181
184
|
folder_id: n
|
|
182
185
|
});
|
|
183
|
-
return mn(
|
|
186
|
+
return mn(Ue(i.data));
|
|
184
187
|
},
|
|
185
188
|
async acceptRequest(e) {
|
|
186
189
|
const n = await W().post(`/v1/messaging/conversations/${e}/accept`);
|
|
187
|
-
return mn(
|
|
190
|
+
return mn(Ue(n.data));
|
|
188
191
|
},
|
|
189
192
|
async declineRequest(e) {
|
|
190
193
|
await W().post(`/v1/messaging/conversations/${e}/decline`);
|
|
191
194
|
}
|
|
192
|
-
}, vn = 1e3, Ot = 4e3,
|
|
195
|
+
}, vn = 1e3, Ot = 4e3, Ui = 12e4, Oi = 300, Ni = 1, Fi = 1600, Nt = (e) => {
|
|
193
196
|
if (typeof e == "number" && Number.isFinite(e))
|
|
194
197
|
return e;
|
|
195
198
|
if (typeof e == "string") {
|
|
@@ -209,17 +212,17 @@ const Se = {
|
|
|
209
212
|
return Math.max(vn, n * 1e3);
|
|
210
213
|
}
|
|
211
214
|
return Ot;
|
|
212
|
-
}, Fi = (e) => {
|
|
213
|
-
const n = Math.max(0, e), i = 2 ** Math.min(n, 6), o = Ot * i;
|
|
214
|
-
return Math.min(Li, o);
|
|
215
215
|
}, Di = (e) => {
|
|
216
|
+
const n = Math.max(0, e), i = 2 ** Math.min(n, 6), o = Ot * i;
|
|
217
|
+
return Math.min(Ui, o);
|
|
218
|
+
}, qi = (e) => {
|
|
216
219
|
const n = e;
|
|
217
|
-
return Nt(n.response?.status) === 429 ? Jn(n.response?.headers?.["retry-after"]) :
|
|
220
|
+
return Nt(n.response?.status) === 429 ? Jn(n.response?.headers?.["retry-after"]) : Oi;
|
|
218
221
|
}, yn = async (e) => {
|
|
219
222
|
await new Promise((n) => {
|
|
220
223
|
setTimeout(n, e);
|
|
221
224
|
});
|
|
222
|
-
},
|
|
225
|
+
}, zi = (e) => {
|
|
223
226
|
if (!he(e))
|
|
224
227
|
return !1;
|
|
225
228
|
const i = (he(e.data) ? e.data : e).throttled;
|
|
@@ -233,7 +236,7 @@ const Se = {
|
|
|
233
236
|
}
|
|
234
237
|
return !1;
|
|
235
238
|
};
|
|
236
|
-
function
|
|
239
|
+
function ji(e, n, i) {
|
|
237
240
|
const o = typeof e == "string" && e.trim().length > 0 ? e.trim().toLowerCase() : void 0;
|
|
238
241
|
if (o)
|
|
239
242
|
return o;
|
|
@@ -243,17 +246,17 @@ function zi(e, n, i) {
|
|
|
243
246
|
const l = typeof i == "string" && i.trim().length > 0 ? i.trim().toLowerCase() : void 0;
|
|
244
247
|
return l ? l === "image" ? "image/*" : l === "video" ? "video/*" : l === "audio" ? "audio/*" : l : "application/octet-stream";
|
|
245
248
|
}
|
|
246
|
-
function
|
|
249
|
+
function $i(e) {
|
|
247
250
|
const n = e.url || "", i = e.thumbnail_url ?? e.thumbnail, o = {
|
|
248
251
|
id: e.media_id ?? e.id ?? "",
|
|
249
|
-
name: e.name ??
|
|
252
|
+
name: e.name ?? Hi(n),
|
|
250
253
|
url: n,
|
|
251
|
-
type:
|
|
254
|
+
type: ji(e.mime, e.mime_type, e.type),
|
|
252
255
|
size: e.size ?? 0
|
|
253
256
|
};
|
|
254
257
|
return i !== void 0 && (o.thumbnail = i), o;
|
|
255
258
|
}
|
|
256
|
-
function
|
|
259
|
+
function Hi(e) {
|
|
257
260
|
if (!e) return "attachment";
|
|
258
261
|
try {
|
|
259
262
|
const i = new URL(e).pathname.split("/");
|
|
@@ -262,8 +265,8 @@ function $i(e) {
|
|
|
262
265
|
return "attachment";
|
|
263
266
|
}
|
|
264
267
|
}
|
|
265
|
-
function
|
|
266
|
-
return !Array.isArray(e) || e.length === 0 ? [] : e.map(
|
|
268
|
+
function Bi(e) {
|
|
269
|
+
return !Array.isArray(e) || e.length === 0 ? [] : e.map($i);
|
|
267
270
|
}
|
|
268
271
|
function nt(e) {
|
|
269
272
|
if (typeof e != "string")
|
|
@@ -272,7 +275,7 @@ function nt(e) {
|
|
|
272
275
|
if (n.length !== 0)
|
|
273
276
|
return n;
|
|
274
277
|
}
|
|
275
|
-
function
|
|
278
|
+
function Vi(e) {
|
|
276
279
|
if (!e)
|
|
277
280
|
return;
|
|
278
281
|
const n = nt(e.avatar) ?? nt(e.avatar_url), i = typeof e.handle == "string" && e.handle.length > 0 ? e.handle : void 0;
|
|
@@ -283,7 +286,7 @@ function Bi(e) {
|
|
|
283
286
|
...i ? { handle: i } : {}
|
|
284
287
|
};
|
|
285
288
|
}
|
|
286
|
-
function
|
|
289
|
+
function et(e) {
|
|
287
290
|
const n = e.shared_post, i = e.author, o = n && typeof n == "object" ? {
|
|
288
291
|
id: n.id ?? "",
|
|
289
292
|
title: n.title ?? "",
|
|
@@ -299,12 +302,12 @@ function Ze(e) {
|
|
|
299
302
|
} : null;
|
|
300
303
|
return {
|
|
301
304
|
...e,
|
|
302
|
-
...i ? { author:
|
|
305
|
+
...i ? { author: Vi(i) } : {},
|
|
303
306
|
shared_post: o,
|
|
304
|
-
attachments:
|
|
307
|
+
attachments: Bi(e.attachments)
|
|
305
308
|
};
|
|
306
309
|
}
|
|
307
|
-
function
|
|
310
|
+
function Xi(e) {
|
|
308
311
|
return typeof e != "string" || e.length === 0 ? null : e;
|
|
309
312
|
}
|
|
310
313
|
function _n(e) {
|
|
@@ -314,7 +317,7 @@ function _n(e) {
|
|
|
314
317
|
function Pt(e) {
|
|
315
318
|
return typeof e == "string" && e.length > 0 && !e.startsWith("temp-");
|
|
316
319
|
}
|
|
317
|
-
function
|
|
320
|
+
function Wi(e, n = []) {
|
|
318
321
|
const i = /* @__PURE__ */ new Map();
|
|
319
322
|
for (const o of n) {
|
|
320
323
|
const u = _n(o.last_read_message_id);
|
|
@@ -351,8 +354,8 @@ function Xi(e, n = []) {
|
|
|
351
354
|
};
|
|
352
355
|
});
|
|
353
356
|
}
|
|
354
|
-
function
|
|
355
|
-
const i =
|
|
357
|
+
function Oe(e, n) {
|
|
358
|
+
const i = Xi(e.muted_until), o = e.is_muted ?? i !== null, u = e.last_message ? et(e.last_message) : n?.last_message, l = e.last_message_at ?? n?.last_message_at, h = (() => {
|
|
356
359
|
if (!n || n.unread_count !== 0 || e.unread_count <= 0)
|
|
357
360
|
return !1;
|
|
358
361
|
const g = n.last_message?.id, d = e.last_message?.id;
|
|
@@ -361,18 +364,18 @@ function Ue(e, n) {
|
|
|
361
364
|
return {
|
|
362
365
|
...e,
|
|
363
366
|
unread_count: o || h ? 0 : e.unread_count,
|
|
364
|
-
participants:
|
|
367
|
+
participants: Wi(e.participants, n?.participants),
|
|
365
368
|
is_muted: o,
|
|
366
369
|
muted_until: i,
|
|
367
370
|
...u ? { last_message: u } : {},
|
|
368
371
|
...l ? { last_message_at: l } : {}
|
|
369
372
|
};
|
|
370
373
|
}
|
|
371
|
-
function
|
|
374
|
+
function Gi(e) {
|
|
372
375
|
return e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
373
376
|
}
|
|
374
377
|
function St(e) {
|
|
375
|
-
return
|
|
378
|
+
return Gi(e) ? 0 : e.unread_count || 0;
|
|
376
379
|
}
|
|
377
380
|
function Sn(e, n) {
|
|
378
381
|
const i = n[e.id];
|
|
@@ -387,7 +390,7 @@ function Sn(e, n) {
|
|
|
387
390
|
function he(e) {
|
|
388
391
|
return typeof e == "object" && e !== null;
|
|
389
392
|
}
|
|
390
|
-
function
|
|
393
|
+
function Ji(e) {
|
|
391
394
|
return he(e) ? (he(e.response) ? e.response : null)?.status === 401 : !1;
|
|
392
395
|
}
|
|
393
396
|
function wn(e) {
|
|
@@ -411,17 +414,17 @@ function wn(e) {
|
|
|
411
414
|
}
|
|
412
415
|
return n;
|
|
413
416
|
}
|
|
414
|
-
function
|
|
417
|
+
function Ki(e, n) {
|
|
415
418
|
const i = he(n) ? n : null, o = i?.next ?? i?.next_cursor ?? e.next_cursor;
|
|
416
419
|
if (!(typeof o != "string" || o.length === 0))
|
|
417
420
|
return o;
|
|
418
421
|
}
|
|
419
|
-
function
|
|
422
|
+
function Ye(e, n) {
|
|
420
423
|
const i = he(e) ? e : {}, o = i.data ?? e;
|
|
421
424
|
let u = [];
|
|
422
425
|
return Array.isArray(o) ? u = o : he(o) && (Array.isArray(o.items) ? u = o.items : Array.isArray(o[n]) ? u = o[n] : Array.isArray(o.data) && (u = o.data)), {
|
|
423
426
|
items: u,
|
|
424
|
-
nextCursor:
|
|
427
|
+
nextCursor: Ki(i, o)
|
|
425
428
|
};
|
|
426
429
|
}
|
|
427
430
|
function Cn(e) {
|
|
@@ -430,24 +433,24 @@ function Cn(e) {
|
|
|
430
433
|
function Tn(e) {
|
|
431
434
|
return he(e) ? typeof e.id == "string" && (e.type === "dm" || e.type === "group") && Array.isArray(e.participants) : !1;
|
|
432
435
|
}
|
|
433
|
-
function
|
|
436
|
+
function tt(e, n) {
|
|
434
437
|
if (e.is_pinned !== n.is_pinned)
|
|
435
438
|
return e.is_pinned ? -1 : 1;
|
|
436
439
|
const i = e.last_message_at ?? e.created_at, u = (n.last_message_at ?? n.created_at).localeCompare(i);
|
|
437
440
|
return u !== 0 ? u : e.id.localeCompare(n.id);
|
|
438
441
|
}
|
|
439
|
-
function
|
|
442
|
+
function Qe(e, n) {
|
|
440
443
|
return [n, ...e.filter((i) => i.id !== n.id)];
|
|
441
444
|
}
|
|
442
|
-
function
|
|
445
|
+
function Ne(e) {
|
|
443
446
|
return [...e].sort((n, i) => n.sort_order !== i.sort_order ? n.sort_order - i.sort_order : n.name.localeCompare(i.name));
|
|
444
447
|
}
|
|
445
|
-
function
|
|
448
|
+
function Yi(e, n) {
|
|
446
449
|
return typeof e != "string" || e.length === 0 ? null : n.has(e) ? e : null;
|
|
447
450
|
}
|
|
448
451
|
function En(e, n) {
|
|
449
452
|
return e.map((i) => {
|
|
450
|
-
const o =
|
|
453
|
+
const o = Yi(i.folder_id, n);
|
|
451
454
|
return (i.folder_id ?? null) === o ? i : {
|
|
452
455
|
...i,
|
|
453
456
|
folder_id: o
|
|
@@ -460,7 +463,7 @@ function wt(e) {
|
|
|
460
463
|
i.is_request === !0 && n.set(i.id, i);
|
|
461
464
|
for (const i of e.conversations)
|
|
462
465
|
i.is_request === !0 && n.set(i.id, i);
|
|
463
|
-
return Array.from(n.values()).sort(
|
|
466
|
+
return Array.from(n.values()).sort(tt);
|
|
464
467
|
}
|
|
465
468
|
const Ft = ci("messaging", {
|
|
466
469
|
state: () => ({
|
|
@@ -492,7 +495,7 @@ const Ft = ci("messaging", {
|
|
|
492
495
|
unreadConversationsCount: (e) => e.conversations.filter((n) => St(n) > 0).length,
|
|
493
496
|
unreadCount: (e) => e.conversations.reduce((n, i) => n + St(i), 0),
|
|
494
497
|
totalUnreadCount: (e) => e.conversations.reduce((n, i) => n + St(i), 0),
|
|
495
|
-
sortedFolders: (e) =>
|
|
498
|
+
sortedFolders: (e) => Ne(e.folders),
|
|
496
499
|
folderById: (e) => (n) => e.folders.find((i) => i.id === n),
|
|
497
500
|
conversationsInFolder: (e) => (n) => e.conversations.filter((i) => i.folder_id === n),
|
|
498
501
|
hasMoreMessages: (e) => (n) => e.conversationHasMore[n] ?? !1,
|
|
@@ -511,24 +514,24 @@ const Ft = ci("messaging", {
|
|
|
511
514
|
},
|
|
512
515
|
async fetchFolders() {
|
|
513
516
|
try {
|
|
514
|
-
const e = await
|
|
515
|
-
return this.folders =
|
|
517
|
+
const e = await we.fetchFolders();
|
|
518
|
+
return this.folders = Ne(e), this.foldersLoaded = !0, this.normalizeFolderAssignmentsState(), this.folders;
|
|
516
519
|
} catch (e) {
|
|
517
520
|
throw this.error = Z(e), e;
|
|
518
521
|
}
|
|
519
522
|
},
|
|
520
523
|
async createFolder(e) {
|
|
521
524
|
try {
|
|
522
|
-
const n = await
|
|
523
|
-
return this.folders =
|
|
525
|
+
const n = await we.createFolder(e);
|
|
526
|
+
return this.folders = Ne([...this.folders, n]), n;
|
|
524
527
|
} catch (n) {
|
|
525
528
|
throw this.error = Z(n), n;
|
|
526
529
|
}
|
|
527
530
|
},
|
|
528
531
|
async updateFolder(e, n) {
|
|
529
532
|
try {
|
|
530
|
-
const i = await
|
|
531
|
-
return this.folders =
|
|
533
|
+
const i = await we.updateFolder(e, n);
|
|
534
|
+
return this.folders = Ne(
|
|
532
535
|
this.folders.map((o) => o.id === e ? i : o)
|
|
533
536
|
), i;
|
|
534
537
|
} catch (i) {
|
|
@@ -537,14 +540,14 @@ const Ft = ci("messaging", {
|
|
|
537
540
|
},
|
|
538
541
|
async deleteFolder(e) {
|
|
539
542
|
try {
|
|
540
|
-
await
|
|
543
|
+
await we.deleteFolder(e), this.folders = this.folders.filter((n) => n.id !== e), this.foldersLoaded = !0, this.activeFolderId === e && (this.activeFolderId = null), this.normalizeFolderAssignmentsState();
|
|
541
544
|
} catch (n) {
|
|
542
545
|
throw this.error = Z(n), n;
|
|
543
546
|
}
|
|
544
547
|
},
|
|
545
548
|
async reorderFolders(e) {
|
|
546
549
|
try {
|
|
547
|
-
await
|
|
550
|
+
await we.reorderFolders(e);
|
|
548
551
|
const n = new Map(this.folders.map((u) => [u.id, u])), i = [];
|
|
549
552
|
for (const u of e) {
|
|
550
553
|
const l = n.get(u);
|
|
@@ -553,7 +556,7 @@ const Ft = ci("messaging", {
|
|
|
553
556
|
sort_order: i.length + 1
|
|
554
557
|
}), n.delete(u));
|
|
555
558
|
}
|
|
556
|
-
const o =
|
|
559
|
+
const o = Ne(Array.from(n.values()));
|
|
557
560
|
for (const u of o)
|
|
558
561
|
i.push({
|
|
559
562
|
...u,
|
|
@@ -566,7 +569,7 @@ const Ft = ci("messaging", {
|
|
|
566
569
|
},
|
|
567
570
|
async assignToFolder(e, n) {
|
|
568
571
|
try {
|
|
569
|
-
const i = await
|
|
572
|
+
const i = await we.assignFolder(e, n), o = this.conversations.findIndex((h) => h.id === e);
|
|
570
573
|
if (o < 0)
|
|
571
574
|
return;
|
|
572
575
|
const u = this.conversations[o];
|
|
@@ -586,14 +589,14 @@ const Ft = ci("messaging", {
|
|
|
586
589
|
try {
|
|
587
590
|
const u = o?.includePresence ?? !0, l = {};
|
|
588
591
|
u && (l.include_presence = 1), e && (l.cursor = e), n && (l.filter = n), typeof i == "string" && i.length > 0 && (l.folder_id = i);
|
|
589
|
-
const h = await W().get("/v1/messaging/conversations", { params: l }), { items: g, nextCursor: d } =
|
|
592
|
+
const h = await W().get("/v1/messaging/conversations", { params: l }), { items: g, nextCursor: d } = Ye(
|
|
590
593
|
h.data,
|
|
591
594
|
"conversations"
|
|
592
|
-
), A = g.map((
|
|
595
|
+
), A = g.map((m) => {
|
|
593
596
|
const w = this.conversations.find(
|
|
594
|
-
(R) => R.id ===
|
|
597
|
+
(R) => R.id === m.id
|
|
595
598
|
);
|
|
596
|
-
return
|
|
599
|
+
return Oe(m, w);
|
|
597
600
|
});
|
|
598
601
|
e ? this.conversations.push(...A) : this.conversations = A, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
|
|
599
602
|
const x = {
|
|
@@ -617,7 +620,7 @@ const Ft = ci("messaging", {
|
|
|
617
620
|
}), this.backgroundPollRetryAfterUntil = 0, this.backgroundPollTransientFailureCount = 0, !0;
|
|
618
621
|
} catch (e) {
|
|
619
622
|
const n = e, i = Nt(n.response?.status);
|
|
620
|
-
return i === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() + Jn(n.response?.headers?.["retry-after"]), !1) : (this.backgroundPollTransientFailureCount += 1, i === void 0 || Gn(i) ? (this.backgroundPollRetryAfterUntil = Date.now() +
|
|
623
|
+
return i === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() + Jn(n.response?.headers?.["retry-after"]), !1) : (this.backgroundPollTransientFailureCount += 1, i === void 0 || Gn(i) ? (this.backgroundPollRetryAfterUntil = Date.now() + Di(this.backgroundPollTransientFailureCount), !1) : (this.backgroundPollRetryAfterUntil = Date.now() + Ot, !1));
|
|
621
624
|
}
|
|
622
625
|
},
|
|
623
626
|
async fetchConversation(e) {
|
|
@@ -625,7 +628,7 @@ const Ft = ci("messaging", {
|
|
|
625
628
|
try {
|
|
626
629
|
const n = await W().get(`/v1/messaging/conversations/${e}`, {
|
|
627
630
|
params: { include_presence: 1 }
|
|
628
|
-
}), i = this.conversations.find((h) => h.id === e), o =
|
|
631
|
+
}), i = this.conversations.find((h) => h.id === e), o = Oe(n.data.data || n.data, i), u = this.conversations.findIndex((h) => h.id === e);
|
|
629
632
|
u >= 0 ? this.conversations[u] = o : this.conversations.push(o);
|
|
630
633
|
const l = this.requests.findIndex((h) => h.id === e);
|
|
631
634
|
return l >= 0 && (this.requests[l] = o), this.normalizeFolderAssignmentsState(), o;
|
|
@@ -643,12 +646,12 @@ const Ft = ci("messaging", {
|
|
|
643
646
|
filter: "requests"
|
|
644
647
|
};
|
|
645
648
|
e && (n.cursor = e);
|
|
646
|
-
const i = await W().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: u } =
|
|
649
|
+
const i = await W().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: u } = Ye(
|
|
647
650
|
i.data,
|
|
648
651
|
"conversations"
|
|
649
652
|
), l = o.map((g) => {
|
|
650
653
|
const d = this.requests.find((A) => A.id === g.id);
|
|
651
|
-
return
|
|
654
|
+
return Oe(g, d);
|
|
652
655
|
});
|
|
653
656
|
e ? this.requests.push(...l) : this.requests = l, this.normalizeFolderAssignmentsState();
|
|
654
657
|
const h = {
|
|
@@ -671,21 +674,21 @@ const Ft = ci("messaging", {
|
|
|
671
674
|
try {
|
|
672
675
|
u = await W().get(`/v1/messaging/conversations/${e}/messages`, { params: i });
|
|
673
676
|
break;
|
|
674
|
-
} catch (
|
|
675
|
-
if (!(o <
|
|
676
|
-
throw
|
|
677
|
-
o += 1, await yn(
|
|
677
|
+
} catch (m) {
|
|
678
|
+
if (!(o < Ni && bn(m)))
|
|
679
|
+
throw m;
|
|
680
|
+
o += 1, await yn(qi(m));
|
|
678
681
|
}
|
|
679
|
-
const { items: l, nextCursor: h } =
|
|
682
|
+
const { items: l, nextCursor: h } = Ye(
|
|
680
683
|
u.data,
|
|
681
684
|
"messages"
|
|
682
|
-
), g = l.map(
|
|
685
|
+
), g = l.map(et), d = [...g].reverse();
|
|
683
686
|
if (n ? this.messages[e] = [...d, ...this.messages[e] || []] : this.messages[e] = d, (() => {
|
|
684
|
-
const
|
|
685
|
-
return
|
|
687
|
+
const m = this.conversations.find((w) => w.id === e) ?? this.requests.find((w) => w.id === e);
|
|
688
|
+
return m ? !m.last_message || !m.last_message_at : !1;
|
|
686
689
|
})()) {
|
|
687
|
-
const
|
|
688
|
-
|
|
690
|
+
const m = this.messages[e]?.at(-1);
|
|
691
|
+
m && this.updateConversationLastMessage(e, m);
|
|
689
692
|
}
|
|
690
693
|
h ? (this.conversationCursors[e] = h, this.conversationHasMore[e] = !0) : (delete this.conversationCursors[e], this.conversationHasMore[e] = !1);
|
|
691
694
|
const x = {
|
|
@@ -700,7 +703,7 @@ const Ft = ci("messaging", {
|
|
|
700
703
|
}
|
|
701
704
|
},
|
|
702
705
|
async sendMessage(e, n, i, o, u, l) {
|
|
703
|
-
const h =
|
|
706
|
+
const h = xe()(), g = `temp-${Date.now()}-${Math.random()}`, d = typeof l == "string" && l.trim().length > 0 ? l.trim() : null, A = h.currentUser, x = {
|
|
704
707
|
id: g,
|
|
705
708
|
conversation_id: e,
|
|
706
709
|
author_id: A?.id || "",
|
|
@@ -718,7 +721,7 @@ const Ft = ci("messaging", {
|
|
|
718
721
|
...A.handle ? { handle: A.handle } : {}
|
|
719
722
|
}), o != null && (x.reply_to_id = o), u != null && (x.reply_to = u), this.messages[e] || (this.messages[e] = []), this.messages[e].push(x), this._pendingSendIds.add(g);
|
|
720
723
|
try {
|
|
721
|
-
let
|
|
724
|
+
let m;
|
|
722
725
|
const w = {
|
|
723
726
|
body: n || "",
|
|
724
727
|
...o ? { reply_to_id: o } : {},
|
|
@@ -727,7 +730,7 @@ const Ft = ci("messaging", {
|
|
|
727
730
|
if (i && i.length > 0) {
|
|
728
731
|
const H = await Promise.all(
|
|
729
732
|
i.map(async (B) => {
|
|
730
|
-
const P = await
|
|
733
|
+
const P = await xi().uploadImage(B);
|
|
731
734
|
return {
|
|
732
735
|
media_id: P.id,
|
|
733
736
|
mime: P.mime_type,
|
|
@@ -735,26 +738,26 @@ const Ft = ci("messaging", {
|
|
|
735
738
|
};
|
|
736
739
|
})
|
|
737
740
|
);
|
|
738
|
-
|
|
741
|
+
m = await W().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
739
742
|
...w,
|
|
740
743
|
attachments: H
|
|
741
744
|
});
|
|
742
745
|
} else
|
|
743
|
-
|
|
746
|
+
m = await W().post(`/v1/messaging/conversations/${e}/messages`, {
|
|
744
747
|
...w,
|
|
745
748
|
type: "text"
|
|
746
749
|
});
|
|
747
|
-
const R =
|
|
748
|
-
|
|
749
|
-
const
|
|
750
|
-
let
|
|
750
|
+
const R = m.data.data || m.data, E = { ...x, ...R, attachments: R.attachments ?? x.attachments }, _ = et(E), f = this.messages[e], v = f.findIndex((H) => H.id === g);
|
|
751
|
+
v >= 0 && (f[v] = _), this._pendingSendIds.delete(g);
|
|
752
|
+
const b = _.id;
|
|
753
|
+
let D = 0;
|
|
751
754
|
for (let H = f.length - 1; H >= 0; H--) {
|
|
752
755
|
const B = f[H];
|
|
753
|
-
B && B.id ===
|
|
756
|
+
B && B.id === b && (D++, D > 1 && f.splice(H, 1));
|
|
754
757
|
}
|
|
755
758
|
return this.updateConversationLastMessage(e, _), _;
|
|
756
|
-
} catch (
|
|
757
|
-
throw this._pendingSendIds.delete(g), this.messages[e] = this.messages[e].filter((w) => w.id !== g), this.error = Z(
|
|
759
|
+
} catch (m) {
|
|
760
|
+
throw this._pendingSendIds.delete(g), this.messages[e] = this.messages[e].filter((w) => w.id !== g), this.error = Z(m), m;
|
|
758
761
|
}
|
|
759
762
|
},
|
|
760
763
|
async editMessage(e, n, i) {
|
|
@@ -849,9 +852,9 @@ const Ft = ci("messaging", {
|
|
|
849
852
|
async sendTyping(e, n = "start") {
|
|
850
853
|
try {
|
|
851
854
|
const i = await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
852
|
-
if (n !== "start" || !
|
|
855
|
+
if (n !== "start" || !zi(i.data))
|
|
853
856
|
return;
|
|
854
|
-
await yn(
|
|
857
|
+
await yn(Fi), await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
855
858
|
} catch (i) {
|
|
856
859
|
console.warn("Failed to send typing indicator:", i);
|
|
857
860
|
}
|
|
@@ -891,7 +894,7 @@ const Ft = ci("messaging", {
|
|
|
891
894
|
try {
|
|
892
895
|
await W().patch(`/v1/messaging/conversations/${e}/pin`, { pinned: n });
|
|
893
896
|
const i = this.conversations.find((o) => o.id === e);
|
|
894
|
-
i && (i.is_pinned = n), this.conversations.sort(
|
|
897
|
+
i && (i.is_pinned = n), this.conversations.sort(tt);
|
|
895
898
|
} catch (i) {
|
|
896
899
|
throw this.error = Z(i), i;
|
|
897
900
|
}
|
|
@@ -919,8 +922,8 @@ const Ft = ci("messaging", {
|
|
|
919
922
|
const o = await W().post("/v1/messaging/conversations/dm", i), u = o.data.data || o.data;
|
|
920
923
|
if (!Cn(u))
|
|
921
924
|
throw new Error("Invalid conversation payload from DM create endpoint.");
|
|
922
|
-
const l = Tn(u) ?
|
|
923
|
-
return l.is_request === !0 ? (this.requests =
|
|
925
|
+
const l = Tn(u) ? Oe(u) : await this.fetchConversation(u.id);
|
|
926
|
+
return l.is_request === !0 ? (this.requests = Qe(this.requests, l), this.conversations = this.conversations.filter((h) => h.id !== l.id), l) : (this.conversations = Qe(this.conversations, l), this.requests = this.requests.filter((h) => h.id !== l.id), l);
|
|
924
927
|
} catch (i) {
|
|
925
928
|
throw this.error = Z(i), i;
|
|
926
929
|
}
|
|
@@ -934,7 +937,7 @@ const Ft = ci("messaging", {
|
|
|
934
937
|
if (!Cn(o))
|
|
935
938
|
throw new Error("Invalid conversation payload from group create endpoint.");
|
|
936
939
|
const u = Tn(o) ? o : await this.fetchConversation(o.id);
|
|
937
|
-
return this.conversations =
|
|
940
|
+
return this.conversations = Qe(this.conversations, u), u;
|
|
938
941
|
} catch (i) {
|
|
939
942
|
throw this.error = Z(i), i;
|
|
940
943
|
}
|
|
@@ -952,7 +955,7 @@ const Ft = ci("messaging", {
|
|
|
952
955
|
async removeParticipant(e, n) {
|
|
953
956
|
try {
|
|
954
957
|
await W().delete(`/v1/messaging/conversations/${e}/participants/${n}`);
|
|
955
|
-
const i =
|
|
958
|
+
const i = xe()();
|
|
956
959
|
if (n === i.currentUser?.id) {
|
|
957
960
|
this.conversations = this.conversations.filter((o) => o.id !== e), this.requests = this.requests.filter((o) => o.id !== e), delete this.messages[e], delete this.typingUsers[e], delete this.conversationCursors[e], delete this.conversationHasMore[e], delete this.loadingMessages[e];
|
|
958
961
|
return;
|
|
@@ -982,10 +985,10 @@ const Ft = ci("messaging", {
|
|
|
982
985
|
if (!n)
|
|
983
986
|
return;
|
|
984
987
|
this.messages[n] || (this.messages[n] = []);
|
|
985
|
-
const i =
|
|
988
|
+
const i = et({ ...e, attachments: e.attachments ?? [] }), o = this.messages[n];
|
|
986
989
|
if (o.find((d) => d.id === i.id))
|
|
987
990
|
return;
|
|
988
|
-
const l =
|
|
991
|
+
const l = xe()();
|
|
989
992
|
if (i.author_id === l.currentUser?.id) {
|
|
990
993
|
const d = o.findIndex((A) => A.id.startsWith("temp-"));
|
|
991
994
|
if (d >= 0) {
|
|
@@ -1040,9 +1043,9 @@ const Ft = ci("messaging", {
|
|
|
1040
1043
|
let g;
|
|
1041
1044
|
try {
|
|
1042
1045
|
g = await W().post(o, u);
|
|
1043
|
-
} catch (
|
|
1044
|
-
if (!
|
|
1045
|
-
throw
|
|
1046
|
+
} catch (m) {
|
|
1047
|
+
if (!Ji(m))
|
|
1048
|
+
throw m;
|
|
1046
1049
|
g = await W().post(o, u);
|
|
1047
1050
|
}
|
|
1048
1051
|
const d = he(g.data) && "data" in g.data ? g.data.data : g.data, A = wn(
|
|
@@ -1050,7 +1053,7 @@ const Ft = ci("messaging", {
|
|
|
1050
1053
|
);
|
|
1051
1054
|
(A.length > 0 || h.length === 0) && this.updateMessageReactions(e, n, A);
|
|
1052
1055
|
try {
|
|
1053
|
-
const
|
|
1056
|
+
const m = await W().get(o), w = he(m.data) && "data" in m.data ? m.data.data : m.data, R = wn(
|
|
1054
1057
|
he(w) ? w.reactions : void 0
|
|
1055
1058
|
);
|
|
1056
1059
|
this.updateMessageReactions(e, n, R);
|
|
@@ -1082,7 +1085,7 @@ const Ft = ci("messaging", {
|
|
|
1082
1085
|
const h = l.find((g) => g.id === e);
|
|
1083
1086
|
return h ? (h.last_message = n, h.last_message_at = n.created_at, !0) : !1;
|
|
1084
1087
|
}, o = i(this.conversations), u = i(this.requests);
|
|
1085
|
-
o && this.conversations.sort(
|
|
1088
|
+
o && this.conversations.sort(tt), u && this.requests.sort(tt);
|
|
1086
1089
|
},
|
|
1087
1090
|
updatePresenceForUser(e, n, i) {
|
|
1088
1091
|
const o = n === "online" || n === "idle" || n === "dnd";
|
|
@@ -1091,22 +1094,22 @@ const Ft = ci("messaging", {
|
|
|
1091
1094
|
},
|
|
1092
1095
|
async acceptRequest(e) {
|
|
1093
1096
|
try {
|
|
1094
|
-
const n = await
|
|
1097
|
+
const n = await we.acceptRequest(e);
|
|
1095
1098
|
this.requests = this.requests.filter((o) => o.id !== e);
|
|
1096
|
-
const i =
|
|
1099
|
+
const i = Oe({
|
|
1097
1100
|
...n,
|
|
1098
1101
|
is_pinned: n.is_pinned ?? !1,
|
|
1099
1102
|
is_archived: n.is_archived ?? !1,
|
|
1100
1103
|
is_muted: n.is_muted ?? !1
|
|
1101
1104
|
});
|
|
1102
|
-
this.conversations =
|
|
1105
|
+
this.conversations = Qe(this.conversations, i);
|
|
1103
1106
|
} catch (n) {
|
|
1104
1107
|
throw this.error = Z(n), n;
|
|
1105
1108
|
}
|
|
1106
1109
|
},
|
|
1107
1110
|
async declineRequest(e) {
|
|
1108
1111
|
try {
|
|
1109
|
-
await
|
|
1112
|
+
await we.declineRequest(e), this.requests = this.requests.filter((n) => n.id !== e);
|
|
1110
1113
|
} catch (n) {
|
|
1111
1114
|
throw this.error = Z(n), n;
|
|
1112
1115
|
}
|
|
@@ -1118,7 +1121,7 @@ const Ft = ci("messaging", {
|
|
|
1118
1121
|
n && (o.filter = n), typeof i == "string" && i.length > 0 && (o.folder_id = i);
|
|
1119
1122
|
const u = await W().get("/v1/messaging/conversations", {
|
|
1120
1123
|
params: o
|
|
1121
|
-
}), { items: l } =
|
|
1124
|
+
}), { items: l } = Ye(
|
|
1122
1125
|
u.data,
|
|
1123
1126
|
"conversations"
|
|
1124
1127
|
);
|
|
@@ -1177,123 +1180,123 @@ const Ft = ci("messaging", {
|
|
|
1177
1180
|
}
|
|
1178
1181
|
}
|
|
1179
1182
|
});
|
|
1180
|
-
function
|
|
1181
|
-
const n = Ft(), i =
|
|
1182
|
-
let x = 0,
|
|
1183
|
-
const R =
|
|
1183
|
+
function Ua(e) {
|
|
1184
|
+
const n = Ft(), i = xe()(), o = de(!1), u = de(null), l = de(null), h = Mt(), g = h !== null, d = 20, A = 250;
|
|
1185
|
+
let x = 0, m = null, w = null;
|
|
1186
|
+
const R = se(() => i.currentUser?.id), E = () => Ln(e)?.trim() ?? "";
|
|
1184
1187
|
function _() {
|
|
1185
|
-
|
|
1188
|
+
m && (clearTimeout(m), m = null), x = 0;
|
|
1186
1189
|
}
|
|
1187
1190
|
function f() {
|
|
1188
|
-
!g || o.value ||
|
|
1189
|
-
|
|
1191
|
+
!g || o.value || m || x >= d || (m = setTimeout(() => {
|
|
1192
|
+
m = null, x += 1, N();
|
|
1190
1193
|
}, A));
|
|
1191
1194
|
}
|
|
1192
|
-
function
|
|
1193
|
-
if (n.addMessage(
|
|
1194
|
-
const
|
|
1195
|
-
|
|
1195
|
+
function v(y) {
|
|
1196
|
+
if (n.addMessage(y.message), y.message.author_id !== R.value) {
|
|
1197
|
+
const O = n.getConversationById(y.conversation_id);
|
|
1198
|
+
O && (O.unread_count = 0), n.markAsRead(y.conversation_id).catch(() => {
|
|
1196
1199
|
});
|
|
1197
1200
|
}
|
|
1198
1201
|
}
|
|
1199
|
-
function y
|
|
1200
|
-
n.applyParticipantReadState(
|
|
1202
|
+
function b(y) {
|
|
1203
|
+
n.applyParticipantReadState(y);
|
|
1201
1204
|
}
|
|
1202
|
-
function
|
|
1203
|
-
const
|
|
1205
|
+
function D(y) {
|
|
1206
|
+
const O = n.getMessagesByConversationId(y.conversation_id), C = O.findIndex((L) => L.id === y.message.id);
|
|
1204
1207
|
if (C >= 0) {
|
|
1205
|
-
const
|
|
1206
|
-
if (!
|
|
1207
|
-
const I = { ...
|
|
1208
|
-
|
|
1209
|
-
const
|
|
1210
|
-
|
|
1208
|
+
const L = O[C];
|
|
1209
|
+
if (!L) return;
|
|
1210
|
+
const I = { ...L };
|
|
1211
|
+
y.message.body !== void 0 && (I.body = y.message.body), y.message.edited_at !== void 0 && (I.edited_at = y.message.edited_at), y.message.meta !== void 0 && (I.meta = y.message.meta), O[C] = I;
|
|
1212
|
+
const $ = n.getConversationById(y.conversation_id);
|
|
1213
|
+
$ && $.last_message?.id === y.message.id && ($.last_message = I);
|
|
1211
1214
|
}
|
|
1212
1215
|
}
|
|
1213
|
-
function H(
|
|
1214
|
-
n.removeMessage(
|
|
1216
|
+
function H(y) {
|
|
1217
|
+
n.removeMessage(y.conversation_id, y.message_id);
|
|
1215
1218
|
}
|
|
1216
|
-
function B(
|
|
1219
|
+
function B(y) {
|
|
1217
1220
|
n.updateMessageReactions(
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
+
y.conversation_id,
|
|
1222
|
+
y.message_id,
|
|
1223
|
+
y.reactions
|
|
1221
1224
|
);
|
|
1222
1225
|
}
|
|
1223
|
-
function P(
|
|
1224
|
-
const
|
|
1225
|
-
|
|
1226
|
-
(C) => C.id !==
|
|
1226
|
+
function P(y) {
|
|
1227
|
+
const O = n.getConversationById(y.conversation_id);
|
|
1228
|
+
O && (O.is_request = !1), n.requests = n.requests.filter(
|
|
1229
|
+
(C) => C.id !== y.conversation_id
|
|
1227
1230
|
);
|
|
1228
1231
|
}
|
|
1229
|
-
function
|
|
1230
|
-
|
|
1232
|
+
function U(y) {
|
|
1233
|
+
y.removed_user_id === R.value && (j(), n.deleteConversation(y.conversation_id).catch(() => {
|
|
1231
1234
|
}));
|
|
1232
1235
|
}
|
|
1233
|
-
function V(
|
|
1234
|
-
const
|
|
1235
|
-
w && (w(), w = null),
|
|
1236
|
+
function V(y) {
|
|
1237
|
+
const O = l.value;
|
|
1238
|
+
w && (w(), w = null), O && (y && !n.hasGlobalConversationSubscription(O) && mi(O), n.unregisterDetailSubscription(O), l.value = null), o.value = !1;
|
|
1236
1239
|
}
|
|
1237
|
-
function
|
|
1238
|
-
const
|
|
1239
|
-
if (!(o.value || !
|
|
1240
|
-
if (!
|
|
1240
|
+
function N() {
|
|
1241
|
+
const y = E();
|
|
1242
|
+
if (!(o.value || !y)) {
|
|
1243
|
+
if (!Pe()) {
|
|
1241
1244
|
f();
|
|
1242
1245
|
return;
|
|
1243
1246
|
}
|
|
1244
1247
|
u.value = null;
|
|
1245
1248
|
try {
|
|
1246
|
-
w = gi(
|
|
1247
|
-
onMessageSent:
|
|
1248
|
-
onMessageRead:
|
|
1249
|
-
onMessageEdited:
|
|
1249
|
+
w = gi(y, {
|
|
1250
|
+
onMessageSent: v,
|
|
1251
|
+
onMessageRead: b,
|
|
1252
|
+
onMessageEdited: D,
|
|
1250
1253
|
onMessageDeleted: H,
|
|
1251
1254
|
onReactionToggled: B,
|
|
1252
1255
|
onRequestAccepted: P,
|
|
1253
|
-
onParticipantRemoved:
|
|
1254
|
-
}), o.value = !0, l.value =
|
|
1255
|
-
} catch (
|
|
1256
|
-
u.value =
|
|
1256
|
+
onParticipantRemoved: U
|
|
1257
|
+
}), o.value = !0, l.value = y, n.registerDetailSubscription(y), _();
|
|
1258
|
+
} catch (O) {
|
|
1259
|
+
u.value = O instanceof Error ? O.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", O);
|
|
1257
1260
|
}
|
|
1258
1261
|
}
|
|
1259
1262
|
}
|
|
1260
1263
|
function K() {
|
|
1261
|
-
o.value ||
|
|
1264
|
+
o.value || N();
|
|
1262
1265
|
}
|
|
1263
|
-
typeof window < "u" && window.addEventListener(
|
|
1264
|
-
const
|
|
1265
|
-
if (
|
|
1266
|
-
o.value ||
|
|
1266
|
+
typeof window < "u" && window.addEventListener(ze(), K);
|
|
1267
|
+
const re = it((y) => {
|
|
1268
|
+
if (y === "connected") {
|
|
1269
|
+
o.value || N();
|
|
1267
1270
|
return;
|
|
1268
1271
|
}
|
|
1269
|
-
(
|
|
1272
|
+
(y === "disconnected" || y === "error") && (_(), V(!1));
|
|
1270
1273
|
});
|
|
1271
|
-
function
|
|
1274
|
+
function j() {
|
|
1272
1275
|
if (_(), !(!o.value || !l.value))
|
|
1273
1276
|
try {
|
|
1274
1277
|
V(!0), u.value = null;
|
|
1275
|
-
} catch (
|
|
1276
|
-
u.value =
|
|
1278
|
+
} catch (y) {
|
|
1279
|
+
u.value = y instanceof Error ? y.message : "Failed to unsubscribe from conversation", console.error("ConversationChannel: Unsubscribe error", y);
|
|
1277
1280
|
}
|
|
1278
1281
|
}
|
|
1279
1282
|
return Rt(
|
|
1280
1283
|
() => E(),
|
|
1281
|
-
(
|
|
1282
|
-
if (
|
|
1283
|
-
if (_(), o.value && V(!0), !
|
|
1284
|
+
(y, O) => {
|
|
1285
|
+
if (y !== O) {
|
|
1286
|
+
if (_(), o.value && V(!0), !y) {
|
|
1284
1287
|
u.value = null;
|
|
1285
1288
|
return;
|
|
1286
1289
|
}
|
|
1287
|
-
|
|
1290
|
+
N();
|
|
1288
1291
|
}
|
|
1289
1292
|
}
|
|
1290
|
-
), h !== null &&
|
|
1291
|
-
_(),
|
|
1293
|
+
), h !== null && $e(() => {
|
|
1294
|
+
_(), re(), j(), typeof window < "u" && window.removeEventListener(ze(), K);
|
|
1292
1295
|
}), {
|
|
1293
|
-
isSubscribed:
|
|
1294
|
-
error:
|
|
1295
|
-
subscribe:
|
|
1296
|
-
unsubscribe:
|
|
1296
|
+
isSubscribed: se(() => o.value),
|
|
1297
|
+
error: se(() => u.value),
|
|
1298
|
+
subscribe: N,
|
|
1299
|
+
unsubscribe: j
|
|
1297
1300
|
};
|
|
1298
1301
|
}
|
|
1299
1302
|
const Kn = () => () => {
|
|
@@ -1305,28 +1308,28 @@ const Kn = () => () => {
|
|
|
1305
1308
|
onConnectionStatusChange: Kn,
|
|
1306
1309
|
reconnect: Yn
|
|
1307
1310
|
};
|
|
1308
|
-
function
|
|
1311
|
+
function Qi() {
|
|
1309
1312
|
return le.initializedEvent;
|
|
1310
1313
|
}
|
|
1311
|
-
function
|
|
1314
|
+
function Zi() {
|
|
1312
1315
|
return le.getEcho();
|
|
1313
1316
|
}
|
|
1314
|
-
function
|
|
1317
|
+
function eo() {
|
|
1315
1318
|
return le.getConnectionStatus();
|
|
1316
1319
|
}
|
|
1317
|
-
function
|
|
1320
|
+
function to(e) {
|
|
1318
1321
|
return le.onConnectionStatusChange(e);
|
|
1319
1322
|
}
|
|
1320
|
-
async function
|
|
1323
|
+
async function no() {
|
|
1321
1324
|
await le.reconnect();
|
|
1322
1325
|
}
|
|
1323
|
-
function
|
|
1326
|
+
function so(e) {
|
|
1324
1327
|
e.initializedEvent && (le.initializedEvent = e.initializedEvent), e.getEcho && (le.getEcho = e.getEcho), e.getConnectionStatus && (le.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (le.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (le.reconnect = e.reconnect);
|
|
1325
1328
|
}
|
|
1326
|
-
function
|
|
1329
|
+
function ro() {
|
|
1327
1330
|
le.initializedEvent = "messenger-client:main-echo-initialized", le.getEcho = () => null, le.getConnectionStatus = () => "disconnected", le.onConnectionStatusChange = Kn, le.reconnect = Yn;
|
|
1328
1331
|
}
|
|
1329
|
-
const
|
|
1332
|
+
const io = {
|
|
1330
1333
|
debug: () => {
|
|
1331
1334
|
},
|
|
1332
1335
|
info: () => {
|
|
@@ -1335,18 +1338,18 @@ const ro = {
|
|
|
1335
1338
|
},
|
|
1336
1339
|
error: () => {
|
|
1337
1340
|
}
|
|
1338
|
-
}, Qn = () =>
|
|
1341
|
+
}, Qn = () => io;
|
|
1339
1342
|
let Dt = Qn;
|
|
1340
1343
|
function qt() {
|
|
1341
1344
|
return Dt;
|
|
1342
1345
|
}
|
|
1343
|
-
function
|
|
1346
|
+
function oo(e) {
|
|
1344
1347
|
Dt = e;
|
|
1345
1348
|
}
|
|
1346
|
-
function
|
|
1349
|
+
function ao() {
|
|
1347
1350
|
Dt = Qn;
|
|
1348
1351
|
}
|
|
1349
|
-
const
|
|
1352
|
+
const co = {
|
|
1350
1353
|
connected: "",
|
|
1351
1354
|
connecting: "",
|
|
1352
1355
|
disconnected: "",
|
|
@@ -1356,31 +1359,31 @@ const ao = {
|
|
|
1356
1359
|
function An(e) {
|
|
1357
1360
|
return e?.connector?.pusher?.connection ?? null;
|
|
1358
1361
|
}
|
|
1359
|
-
function
|
|
1362
|
+
function uo(e) {
|
|
1360
1363
|
return e === "messenger" ? {
|
|
1361
|
-
initializedEvent:
|
|
1364
|
+
initializedEvent: ze(),
|
|
1362
1365
|
getConnectionStatus: Hn,
|
|
1363
1366
|
onConnectionStatusChange: it,
|
|
1364
1367
|
reconnect: di,
|
|
1365
|
-
getEchoConnection: () => An(
|
|
1368
|
+
getEchoConnection: () => An(Pe())
|
|
1366
1369
|
} : {
|
|
1367
|
-
initializedEvent:
|
|
1368
|
-
getConnectionStatus:
|
|
1369
|
-
onConnectionStatusChange:
|
|
1370
|
-
reconnect:
|
|
1371
|
-
getEchoConnection: () => An(
|
|
1370
|
+
initializedEvent: Qi(),
|
|
1371
|
+
getConnectionStatus: eo,
|
|
1372
|
+
onConnectionStatusChange: to,
|
|
1373
|
+
reconnect: no,
|
|
1374
|
+
getEchoConnection: () => An(Zi())
|
|
1372
1375
|
};
|
|
1373
1376
|
}
|
|
1374
1377
|
function Pn(e) {
|
|
1375
1378
|
return e.getEchoConnection()?.state ?? null;
|
|
1376
1379
|
}
|
|
1377
|
-
function
|
|
1378
|
-
const o =
|
|
1379
|
-
...
|
|
1380
|
+
function Oa(e = {}) {
|
|
1381
|
+
const o = uo(e.source ?? "app"), u = {
|
|
1382
|
+
...co,
|
|
1380
1383
|
...e.icons
|
|
1381
|
-
}, l = de(o.getConnectionStatus()), h = de(null), g = de(0), d = de(!1), A = de(!1), x = de(!1),
|
|
1382
|
-
let w = null, R = null, E = null, _ = null, f = null,
|
|
1383
|
-
const
|
|
1384
|
+
}, l = de(o.getConnectionStatus()), h = de(null), g = de(0), d = de(!1), A = de(!1), x = de(!1), m = de(!1);
|
|
1385
|
+
let w = null, R = null, E = null, _ = null, f = null, v = null, b = null;
|
|
1386
|
+
const D = se(() => l.value === "connected"), H = se(() => l.value === "connecting"), B = se(() => l.value === "disconnected"), P = se(() => l.value === "error"), U = se(() => B.value || P.value), V = se(() => {
|
|
1384
1387
|
switch (l.value) {
|
|
1385
1388
|
case "connecting":
|
|
1386
1389
|
return g.value > 0 ? "Reconnecting..." : "Connecting...";
|
|
@@ -1393,7 +1396,7 @@ function Ua(e = {}) {
|
|
|
1393
1396
|
default:
|
|
1394
1397
|
return "Unknown connection state";
|
|
1395
1398
|
}
|
|
1396
|
-
}),
|
|
1399
|
+
}), N = se(() => {
|
|
1397
1400
|
switch (l.value) {
|
|
1398
1401
|
case "connected":
|
|
1399
1402
|
return "success";
|
|
@@ -1405,7 +1408,7 @@ function Ua(e = {}) {
|
|
|
1405
1408
|
default:
|
|
1406
1409
|
return "medium";
|
|
1407
1410
|
}
|
|
1408
|
-
}), K =
|
|
1411
|
+
}), K = se(() => {
|
|
1409
1412
|
switch (l.value) {
|
|
1410
1413
|
case "connected":
|
|
1411
1414
|
return u.connected;
|
|
@@ -1418,12 +1421,12 @@ function Ua(e = {}) {
|
|
|
1418
1421
|
default:
|
|
1419
1422
|
return u.unknown;
|
|
1420
1423
|
}
|
|
1421
|
-
}),
|
|
1424
|
+
}), re = async () => {
|
|
1422
1425
|
Rn.debug("Manual reconnect triggered"), g.value += 1, await o.reconnect();
|
|
1423
|
-
},
|
|
1426
|
+
}, j = (I, $ = l.value) => {
|
|
1424
1427
|
if (I !== "connecting" && R && (clearTimeout(R), R = null), I === "disconnected" || I === "error") {
|
|
1425
|
-
const
|
|
1426
|
-
if (x.value = !0,
|
|
1428
|
+
const ie = !m.value && $ === I, me = !A.value && (ie || $ === "connected" || $ === "connecting");
|
|
1429
|
+
if (x.value = !0, me) {
|
|
1427
1430
|
d.value = !1, E && clearTimeout(E), E = setTimeout(() => {
|
|
1428
1431
|
E = null, l.value !== "connected" && (d.value = !0);
|
|
1429
1432
|
}, 2e3);
|
|
@@ -1446,97 +1449,97 @@ function Ua(e = {}) {
|
|
|
1446
1449
|
R = setTimeout(() => {
|
|
1447
1450
|
if (R = null, l.value === "connecting") {
|
|
1448
1451
|
if (Pn(o) === "connected") {
|
|
1449
|
-
|
|
1452
|
+
y("connected");
|
|
1450
1453
|
return;
|
|
1451
1454
|
}
|
|
1452
|
-
A.value = !0, Rn.warn("Still connecting after 10s, treating as disconnected"),
|
|
1455
|
+
A.value = !0, Rn.warn("Still connecting after 10s, treating as disconnected"), y("disconnected"), g.value += 1, o.reconnect();
|
|
1453
1456
|
}
|
|
1454
1457
|
}, 1e4);
|
|
1455
1458
|
}
|
|
1456
|
-
},
|
|
1457
|
-
const
|
|
1459
|
+
}, y = (I) => {
|
|
1460
|
+
const $ = l.value;
|
|
1458
1461
|
if (I === "connecting" && A.value) {
|
|
1459
|
-
l.value = "disconnected",
|
|
1462
|
+
l.value = "disconnected", j("disconnected", $);
|
|
1460
1463
|
return;
|
|
1461
1464
|
}
|
|
1462
|
-
l.value = I, I === "connecting" && (
|
|
1463
|
-
},
|
|
1464
|
-
const I = Pn(o),
|
|
1465
|
-
if (I === "connected" &&
|
|
1466
|
-
|
|
1465
|
+
l.value = I, I === "connecting" && ($ === "disconnected" || $ === "error") && g.value === 0 && (g.value = 1), I === "connected" && (h.value = /* @__PURE__ */ new Date(), g.value = 0), j(I, $);
|
|
1466
|
+
}, O = () => {
|
|
1467
|
+
const I = Pn(o), $ = l.value;
|
|
1468
|
+
if (I === "connected" && $ !== "connected") {
|
|
1469
|
+
y("connected");
|
|
1467
1470
|
return;
|
|
1468
1471
|
}
|
|
1469
|
-
if (I === "connecting" &&
|
|
1470
|
-
|
|
1472
|
+
if (I === "connecting" && $ !== "connecting") {
|
|
1473
|
+
y("connecting");
|
|
1471
1474
|
return;
|
|
1472
1475
|
}
|
|
1473
|
-
if ((I === "unavailable" || I === "failed" || I === "disconnected") &&
|
|
1474
|
-
|
|
1476
|
+
if ((I === "unavailable" || I === "failed" || I === "disconnected") && $ !== "disconnected") {
|
|
1477
|
+
y("disconnected");
|
|
1475
1478
|
return;
|
|
1476
1479
|
}
|
|
1477
|
-
const
|
|
1478
|
-
!I &&
|
|
1480
|
+
const ie = o.getConnectionStatus();
|
|
1481
|
+
!I && ie === "connected" && $ !== "connected" && y("connected");
|
|
1479
1482
|
}, C = () => {
|
|
1480
|
-
if (f?.unbind &&
|
|
1483
|
+
if (f?.unbind && b && (f.unbind("connected", b.connected), f.unbind("connecting", b.connecting), f.unbind("disconnected", b.disconnected), f.unbind("unavailable", b.unavailable), f.unbind("error", b.error), f.unbind("state_change", b.stateChange)), f = o.getEchoConnection(), b = null, !f?.bind)
|
|
1481
1484
|
return;
|
|
1482
|
-
|
|
1483
|
-
connected: () =>
|
|
1484
|
-
connecting: () =>
|
|
1485
|
-
disconnected: () =>
|
|
1486
|
-
unavailable: () =>
|
|
1487
|
-
error: () =>
|
|
1488
|
-
stateChange: (
|
|
1489
|
-
const
|
|
1490
|
-
if (
|
|
1491
|
-
|
|
1485
|
+
b = {
|
|
1486
|
+
connected: () => y("connected"),
|
|
1487
|
+
connecting: () => y("connecting"),
|
|
1488
|
+
disconnected: () => y("disconnected"),
|
|
1489
|
+
unavailable: () => y("disconnected"),
|
|
1490
|
+
error: () => y("error"),
|
|
1491
|
+
stateChange: ($) => {
|
|
1492
|
+
const ie = $?.current;
|
|
1493
|
+
if (ie === "connected") {
|
|
1494
|
+
y("connected");
|
|
1492
1495
|
return;
|
|
1493
1496
|
}
|
|
1494
|
-
if (
|
|
1495
|
-
|
|
1497
|
+
if (ie === "connecting") {
|
|
1498
|
+
y("connecting");
|
|
1496
1499
|
return;
|
|
1497
1500
|
}
|
|
1498
|
-
(
|
|
1501
|
+
(ie === "unavailable" || ie === "failed" || ie === "disconnected") && y("disconnected");
|
|
1499
1502
|
}
|
|
1500
|
-
}, f.bind("connected",
|
|
1503
|
+
}, f.bind("connected", b.connected), f.bind("connecting", b.connecting), f.bind("disconnected", b.disconnected), f.bind("unavailable", b.unavailable), f.bind("error", b.error), f.bind("state_change", b.stateChange);
|
|
1501
1504
|
const I = f.state ?? null;
|
|
1502
1505
|
if (I === "connected") {
|
|
1503
|
-
|
|
1506
|
+
y("connected");
|
|
1504
1507
|
return;
|
|
1505
1508
|
}
|
|
1506
1509
|
if (I === "connecting") {
|
|
1507
|
-
|
|
1510
|
+
y("connecting");
|
|
1508
1511
|
return;
|
|
1509
1512
|
}
|
|
1510
|
-
(I === "unavailable" || I === "failed" || I === "disconnected") &&
|
|
1511
|
-
},
|
|
1512
|
-
if (!h.value || !
|
|
1513
|
+
(I === "unavailable" || I === "failed" || I === "disconnected") && y("disconnected");
|
|
1514
|
+
}, L = se(() => {
|
|
1515
|
+
if (!h.value || !D.value)
|
|
1513
1516
|
return null;
|
|
1514
|
-
const I = Date.now() - h.value.getTime(),
|
|
1515
|
-
return
|
|
1517
|
+
const I = Date.now() - h.value.getTime(), $ = Math.floor(I / 6e4), ie = Math.floor(I % 6e4 / 1e3);
|
|
1518
|
+
return $ > 0 ? `${$}m ${ie}s` : `${ie}s`;
|
|
1516
1519
|
});
|
|
1517
1520
|
return Un(() => {
|
|
1518
|
-
l.value = o.getConnectionStatus(), w = o.onConnectionStatusChange(
|
|
1519
|
-
C(),
|
|
1520
|
-
}, window.addEventListener(o.initializedEvent,
|
|
1521
|
-
|
|
1521
|
+
l.value = o.getConnectionStatus(), w = o.onConnectionStatusChange(y), D.value && (h.value = /* @__PURE__ */ new Date()), j(l.value, l.value), m.value = !0, C(), v = () => {
|
|
1522
|
+
C(), O();
|
|
1523
|
+
}, window.addEventListener(o.initializedEvent, v), O(), _ = setInterval(() => {
|
|
1524
|
+
O();
|
|
1522
1525
|
}, 3e3);
|
|
1523
|
-
}),
|
|
1524
|
-
w?.(), R && (clearTimeout(R), R = null), E && (clearTimeout(E), E = null), _ && (clearInterval(_), _ = null),
|
|
1526
|
+
}), $e(() => {
|
|
1527
|
+
w?.(), R && (clearTimeout(R), R = null), E && (clearTimeout(E), E = null), _ && (clearInterval(_), _ = null), v && (window.removeEventListener(o.initializedEvent, v), v = null), f?.unbind && b && (f.unbind("connected", b.connected), f.unbind("connecting", b.connecting), f.unbind("disconnected", b.disconnected), f.unbind("unavailable", b.unavailable), f.unbind("error", b.error), f.unbind("state_change", b.stateChange)), f = null, b = null;
|
|
1525
1528
|
}), {
|
|
1526
|
-
connectionStatus:
|
|
1527
|
-
isConnected:
|
|
1529
|
+
connectionStatus: se(() => l.value),
|
|
1530
|
+
isConnected: D,
|
|
1528
1531
|
isConnecting: H,
|
|
1529
1532
|
isDisconnected: B,
|
|
1530
1533
|
isError: P,
|
|
1531
|
-
hasConnectionIssues:
|
|
1534
|
+
hasConnectionIssues: U,
|
|
1532
1535
|
statusMessage: V,
|
|
1533
|
-
statusColor:
|
|
1536
|
+
statusColor: N,
|
|
1534
1537
|
statusIcon: K,
|
|
1535
|
-
showConnectionBanner:
|
|
1536
|
-
lastConnectionTime:
|
|
1537
|
-
connectionUptime:
|
|
1538
|
-
reconnectAttempts:
|
|
1539
|
-
reconnect:
|
|
1538
|
+
showConnectionBanner: se(() => d.value),
|
|
1539
|
+
lastConnectionTime: se(() => h.value),
|
|
1540
|
+
connectionUptime: L,
|
|
1541
|
+
reconnectAttempts: se(() => g.value),
|
|
1542
|
+
reconnect: re
|
|
1540
1543
|
};
|
|
1541
1544
|
}
|
|
1542
1545
|
const Zn = kt;
|
|
@@ -1544,21 +1547,21 @@ let zt = Zn;
|
|
|
1544
1547
|
function es() {
|
|
1545
1548
|
return zt;
|
|
1546
1549
|
}
|
|
1547
|
-
function
|
|
1550
|
+
function lo(e) {
|
|
1548
1551
|
zt = e;
|
|
1549
1552
|
}
|
|
1550
|
-
function
|
|
1553
|
+
function ho() {
|
|
1551
1554
|
zt = Zn;
|
|
1552
1555
|
}
|
|
1553
|
-
const
|
|
1554
|
-
function
|
|
1556
|
+
const fo = 6e4;
|
|
1557
|
+
function po(e) {
|
|
1555
1558
|
return e === "online" || e === "idle" || e === "dnd" || e === "offline";
|
|
1556
1559
|
}
|
|
1557
|
-
function
|
|
1560
|
+
function go(e) {
|
|
1558
1561
|
if (typeof e != "string")
|
|
1559
1562
|
return null;
|
|
1560
1563
|
const n = e.trim().toLowerCase();
|
|
1561
|
-
return
|
|
1564
|
+
return po(n) ? n : null;
|
|
1562
1565
|
}
|
|
1563
1566
|
function ts(e) {
|
|
1564
1567
|
if (typeof e != "string")
|
|
@@ -1573,7 +1576,7 @@ function xt(e) {
|
|
|
1573
1576
|
const i = n.includes("T") ? n : n.replace(" ", "T"), o = /(?:Z|[+-]\d{2}:\d{2})$/i.test(i) ? i : `${i}Z`, u = new Date(o);
|
|
1574
1577
|
return Number.isNaN(u.getTime()) ? null : u;
|
|
1575
1578
|
}
|
|
1576
|
-
function
|
|
1579
|
+
function mo(e, n, i = {}) {
|
|
1577
1580
|
if (e === null)
|
|
1578
1581
|
return null;
|
|
1579
1582
|
if (e === "offline")
|
|
@@ -1581,162 +1584,170 @@ function go(e, n, i = {}) {
|
|
|
1581
1584
|
const o = xt(n);
|
|
1582
1585
|
if (o === null)
|
|
1583
1586
|
return e;
|
|
1584
|
-
const u = i.now ?? Date.now(), l = i.staleAfterMs ??
|
|
1587
|
+
const u = i.now ?? Date.now(), l = i.staleAfterMs ?? fo;
|
|
1585
1588
|
return u - o.getTime() > l ? "offline" : e;
|
|
1586
1589
|
}
|
|
1587
1590
|
function xn(e, n = {}) {
|
|
1588
|
-
const i = ts(e?.last_seen_at), o =
|
|
1591
|
+
const i = ts(e?.last_seen_at), o = go(e?.status);
|
|
1589
1592
|
return {
|
|
1590
|
-
status:
|
|
1593
|
+
status: mo(o, i, n),
|
|
1591
1594
|
lastSeenAt: i
|
|
1592
1595
|
};
|
|
1593
1596
|
}
|
|
1594
1597
|
const ns = () => {
|
|
1595
1598
|
};
|
|
1596
1599
|
let jt = ns;
|
|
1597
|
-
function
|
|
1600
|
+
function vo() {
|
|
1598
1601
|
return jt;
|
|
1599
1602
|
}
|
|
1600
|
-
function
|
|
1603
|
+
function bo(e) {
|
|
1601
1604
|
jt = e;
|
|
1602
1605
|
}
|
|
1603
|
-
function
|
|
1606
|
+
function yo() {
|
|
1604
1607
|
jt = ns;
|
|
1605
1608
|
}
|
|
1606
|
-
const
|
|
1607
|
-
function
|
|
1608
|
-
const e = Ft(), n =
|
|
1609
|
+
const Fe = qt()("GlobalMessaging"), _o = 3, So = (e) => e.replace(/\/+$/, ""), wo = (e) => So(window.location.pathname) === `/messages/${e}`, Co = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
1610
|
+
function Na() {
|
|
1611
|
+
const e = Ft(), n = xe()(), i = vo(), o = es(), u = hi(), l = Mt(), { conversations: h } = ui(e), g = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Map();
|
|
1609
1612
|
let A = !1;
|
|
1610
1613
|
function x(P) {
|
|
1611
|
-
const
|
|
1612
|
-
if (
|
|
1613
|
-
for (const V of
|
|
1614
|
+
const U = d.get(P);
|
|
1615
|
+
if (U && (d.delete(P), typeof U.channel.stopListening == "function"))
|
|
1616
|
+
for (const V of U.bindings)
|
|
1614
1617
|
try {
|
|
1615
|
-
|
|
1618
|
+
U.channel.stopListening(V.event, V.handler);
|
|
1616
1619
|
} catch {
|
|
1617
1620
|
}
|
|
1618
1621
|
}
|
|
1619
|
-
function
|
|
1622
|
+
function m() {
|
|
1620
1623
|
for (const P of g)
|
|
1621
1624
|
x(P), e.unregisterGlobalConversationSubscription(P);
|
|
1622
1625
|
g.clear();
|
|
1623
1626
|
}
|
|
1624
1627
|
function w(P) {
|
|
1625
|
-
const
|
|
1626
|
-
if (!
|
|
1628
|
+
const U = Pe();
|
|
1629
|
+
if (!U || g.has(P)) return;
|
|
1627
1630
|
const V = `conversation.${P}`;
|
|
1628
1631
|
x(P);
|
|
1629
|
-
const
|
|
1630
|
-
if (!Si(
|
|
1631
|
-
|
|
1632
|
+
const N = U.private(V), K = (O) => {
|
|
1633
|
+
if (!Si(O)) {
|
|
1634
|
+
Fe.warn("Dropping malformed ConversationMessageSent event", O);
|
|
1632
1635
|
return;
|
|
1633
1636
|
}
|
|
1634
|
-
const
|
|
1635
|
-
if (!
|
|
1636
|
-
e.addMessage(
|
|
1637
|
-
const
|
|
1638
|
-
if (
|
|
1639
|
-
const
|
|
1640
|
-
|
|
1637
|
+
const C = O, L = n.currentUser?.id;
|
|
1638
|
+
if (!L || C.message.author_id === L) return;
|
|
1639
|
+
e.addMessage(C.message);
|
|
1640
|
+
const I = e.hasDetailSubscription(C.conversation_id), $ = wo(C.conversation_id);
|
|
1641
|
+
if (I || $) {
|
|
1642
|
+
const me = e.getConversationById(C.conversation_id);
|
|
1643
|
+
me && (me.unread_count = 0), e.markAsRead(C.conversation_id).catch(() => {
|
|
1641
1644
|
});
|
|
1642
1645
|
return;
|
|
1643
1646
|
}
|
|
1644
|
-
const
|
|
1645
|
-
if (
|
|
1646
|
-
const
|
|
1647
|
-
|
|
1647
|
+
const ie = e.getConversationById(C.conversation_id);
|
|
1648
|
+
if (ie) {
|
|
1649
|
+
const me = Co(ie);
|
|
1650
|
+
me || ie.unread_count++, i(me);
|
|
1648
1651
|
}
|
|
1649
|
-
},
|
|
1650
|
-
if (!wi(
|
|
1651
|
-
|
|
1652
|
+
}, re = (O) => {
|
|
1653
|
+
if (!wi(O)) {
|
|
1654
|
+
Fe.warn("Dropping malformed ConversationMessageRead event", O);
|
|
1652
1655
|
return;
|
|
1653
1656
|
}
|
|
1654
|
-
e.applyParticipantReadState(
|
|
1655
|
-
},
|
|
1656
|
-
if (!Ci(
|
|
1657
|
-
|
|
1657
|
+
e.applyParticipantReadState(O);
|
|
1658
|
+
}, j = (O) => {
|
|
1659
|
+
if (!Ci(O)) {
|
|
1660
|
+
Fe.warn("Dropping malformed MessageReactionToggled event", O);
|
|
1658
1661
|
return;
|
|
1659
1662
|
}
|
|
1660
|
-
const
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
+
const C = O;
|
|
1664
|
+
e.updateMessageReactions(C.conversation_id, C.message_id, C.reactions);
|
|
1665
|
+
}, y = (O) => {
|
|
1666
|
+
if (!Ti(O)) {
|
|
1667
|
+
Fe.warn("Dropping malformed ConversationRequestAccepted event", O);
|
|
1668
|
+
return;
|
|
1669
|
+
}
|
|
1670
|
+
const C = O, L = e.getConversationById(C.conversation_id);
|
|
1671
|
+
L && (L.is_request = !1), e.requests = e.requests.filter(
|
|
1672
|
+
(I) => I.id !== C.conversation_id
|
|
1663
1673
|
);
|
|
1664
1674
|
};
|
|
1665
|
-
|
|
1666
|
-
channel:
|
|
1675
|
+
N.listen(".ConversationMessageSent", K), N.listen(".ConversationMessageRead", re), N.listen(".MessageReactionToggled", j), N.listen(".ConversationRequestAccepted", y), d.set(P, {
|
|
1676
|
+
channel: N,
|
|
1667
1677
|
bindings: [
|
|
1668
1678
|
{ event: ".ConversationMessageSent", handler: K },
|
|
1669
|
-
{ event: ".ConversationMessageRead", handler:
|
|
1670
|
-
{ event: ".
|
|
1679
|
+
{ event: ".ConversationMessageRead", handler: re },
|
|
1680
|
+
{ event: ".MessageReactionToggled", handler: j },
|
|
1681
|
+
{ event: ".ConversationRequestAccepted", handler: y }
|
|
1671
1682
|
]
|
|
1672
1683
|
}), g.add(P), e.registerGlobalConversationSubscription(P);
|
|
1673
1684
|
}
|
|
1674
1685
|
function R() {
|
|
1675
|
-
const P =
|
|
1686
|
+
const P = Pe();
|
|
1676
1687
|
if (!P) {
|
|
1677
|
-
|
|
1688
|
+
m();
|
|
1678
1689
|
return;
|
|
1679
1690
|
}
|
|
1680
|
-
for (const
|
|
1681
|
-
x(
|
|
1691
|
+
for (const U of g) {
|
|
1692
|
+
x(U);
|
|
1682
1693
|
try {
|
|
1683
|
-
P.leave(`conversation.${
|
|
1694
|
+
P.leave(`conversation.${U}`);
|
|
1684
1695
|
} catch {
|
|
1685
1696
|
}
|
|
1686
|
-
e.unregisterGlobalConversationSubscription(
|
|
1697
|
+
e.unregisterGlobalConversationSubscription(U);
|
|
1687
1698
|
}
|
|
1688
1699
|
g.clear();
|
|
1689
1700
|
}
|
|
1690
1701
|
function E() {
|
|
1691
|
-
const P =
|
|
1702
|
+
const P = Pe();
|
|
1692
1703
|
if (!P) return;
|
|
1693
|
-
const
|
|
1694
|
-
for (const
|
|
1695
|
-
if (!V.has(
|
|
1704
|
+
const U = e.conversations.slice(0, _o), V = new Set(U.map((N) => N.id));
|
|
1705
|
+
for (const N of g)
|
|
1706
|
+
if (!V.has(N) && !e.hasDetailSubscription(N)) {
|
|
1696
1707
|
try {
|
|
1697
|
-
x(
|
|
1708
|
+
x(N), P.leave(`conversation.${N}`);
|
|
1698
1709
|
} catch {
|
|
1699
1710
|
}
|
|
1700
|
-
g.delete(
|
|
1711
|
+
g.delete(N), e.unregisterGlobalConversationSubscription(N);
|
|
1701
1712
|
}
|
|
1702
|
-
for (const
|
|
1703
|
-
w(
|
|
1713
|
+
for (const N of U)
|
|
1714
|
+
w(N.id);
|
|
1704
1715
|
}
|
|
1705
1716
|
function _(P) {
|
|
1706
|
-
const
|
|
1717
|
+
const U = xn({
|
|
1707
1718
|
status: P.status,
|
|
1708
1719
|
last_seen_at: P.last_seen_at ?? null
|
|
1709
1720
|
});
|
|
1710
|
-
|
|
1721
|
+
U.status !== null && e.updatePresenceForUser(
|
|
1711
1722
|
P.user_id,
|
|
1712
|
-
|
|
1713
|
-
|
|
1723
|
+
U.status,
|
|
1724
|
+
U.lastSeenAt
|
|
1714
1725
|
);
|
|
1715
1726
|
}
|
|
1716
1727
|
async function f() {
|
|
1717
1728
|
const P = [...new Set(
|
|
1718
|
-
e.conversations.filter((
|
|
1729
|
+
e.conversations.filter((U) => U.type === "dm" && typeof U.other_user_id == "string" && U.other_user_id.length > 0).map((U) => U.other_user_id)
|
|
1719
1730
|
)];
|
|
1720
1731
|
if (P.length !== 0)
|
|
1721
1732
|
try {
|
|
1722
|
-
const
|
|
1733
|
+
const U = await o.get("/v1/presence/users", {
|
|
1723
1734
|
params: { ids: P }
|
|
1724
|
-
}), V =
|
|
1725
|
-
for (const
|
|
1726
|
-
const K = xn(
|
|
1727
|
-
K.status !== null && e.updatePresenceForUser(
|
|
1735
|
+
}), V = U.data?.data?.items ?? U.data?.items ?? [];
|
|
1736
|
+
for (const N of V) {
|
|
1737
|
+
const K = xn(N);
|
|
1738
|
+
K.status !== null && e.updatePresenceForUser(N.id, K.status, K.lastSeenAt);
|
|
1728
1739
|
}
|
|
1729
|
-
} catch (
|
|
1730
|
-
|
|
1740
|
+
} catch (U) {
|
|
1741
|
+
Fe.warn("Failed to refresh messaging presence snapshot", U);
|
|
1731
1742
|
}
|
|
1732
1743
|
}
|
|
1733
|
-
function
|
|
1734
|
-
!
|
|
1744
|
+
function v() {
|
|
1745
|
+
!Pe() || A || (fi(_), A = !0);
|
|
1735
1746
|
}
|
|
1736
|
-
function
|
|
1747
|
+
function b() {
|
|
1737
1748
|
A && (pi(), A = !1);
|
|
1738
1749
|
}
|
|
1739
|
-
const
|
|
1750
|
+
const D = Rt(
|
|
1740
1751
|
h,
|
|
1741
1752
|
() => {
|
|
1742
1753
|
E();
|
|
@@ -1748,10 +1759,10 @@ function Oa() {
|
|
|
1748
1759
|
E();
|
|
1749
1760
|
}
|
|
1750
1761
|
), B = it((P) => {
|
|
1751
|
-
P === "connected" ? (
|
|
1762
|
+
P === "connected" ? (m(), E(), b(), v(), f()) : (P === "disconnected" || P === "error") && (m(), b());
|
|
1752
1763
|
});
|
|
1753
|
-
E(),
|
|
1754
|
-
|
|
1764
|
+
E(), v(), f(), l !== null && $e(() => {
|
|
1765
|
+
D(), H(), B(), R(), b();
|
|
1755
1766
|
});
|
|
1756
1767
|
}
|
|
1757
1768
|
const ss = {
|
|
@@ -1768,27 +1779,27 @@ const ss = {
|
|
|
1768
1779
|
authTokenResolver: () => null
|
|
1769
1780
|
};
|
|
1770
1781
|
let st = { ...ss };
|
|
1771
|
-
function
|
|
1782
|
+
function To() {
|
|
1772
1783
|
return st;
|
|
1773
1784
|
}
|
|
1774
|
-
function
|
|
1785
|
+
function Eo(e) {
|
|
1775
1786
|
st = {
|
|
1776
1787
|
...st,
|
|
1777
1788
|
...e
|
|
1778
1789
|
};
|
|
1779
1790
|
}
|
|
1780
|
-
function
|
|
1791
|
+
function Ro() {
|
|
1781
1792
|
st = { ...ss };
|
|
1782
1793
|
}
|
|
1783
|
-
const
|
|
1784
|
-
function
|
|
1794
|
+
const Ao = 429, Po = 423, xo = "ACCOUNT_LIMITED", Mo = "ACCOUNT_WRITE_TIMEOUT", ko = 2, Io = 5 * 6e4;
|
|
1795
|
+
function qe(e) {
|
|
1785
1796
|
return typeof e == "object" && e !== null;
|
|
1786
1797
|
}
|
|
1787
|
-
function
|
|
1788
|
-
if (!
|
|
1798
|
+
function Lo(e) {
|
|
1799
|
+
if (!qe(e))
|
|
1789
1800
|
return null;
|
|
1790
1801
|
const n = e.response;
|
|
1791
|
-
if (!
|
|
1802
|
+
if (!qe(n))
|
|
1792
1803
|
return null;
|
|
1793
1804
|
const i = n.status;
|
|
1794
1805
|
if (typeof i == "number")
|
|
@@ -1799,50 +1810,50 @@ function Io(e) {
|
|
|
1799
1810
|
}
|
|
1800
1811
|
return null;
|
|
1801
1812
|
}
|
|
1802
|
-
function
|
|
1803
|
-
if (!
|
|
1813
|
+
function Uo(e) {
|
|
1814
|
+
if (!qe(e))
|
|
1804
1815
|
return null;
|
|
1805
1816
|
const n = e.response;
|
|
1806
|
-
if (!
|
|
1817
|
+
if (!qe(n))
|
|
1807
1818
|
return null;
|
|
1808
1819
|
const i = n.data;
|
|
1809
|
-
return
|
|
1820
|
+
return qe(i) && typeof i.code == "string" ? i.code : null;
|
|
1810
1821
|
}
|
|
1811
1822
|
function Ct(e) {
|
|
1812
|
-
const n =
|
|
1813
|
-
return n ===
|
|
1823
|
+
const n = Lo(e), i = Uo(e);
|
|
1824
|
+
return n === Ao && i === xo || n === Po && i === Mo;
|
|
1814
1825
|
}
|
|
1815
|
-
function
|
|
1826
|
+
function He() {
|
|
1816
1827
|
return typeof sessionStorage > "u" ? null : sessionStorage;
|
|
1817
1828
|
}
|
|
1818
|
-
function
|
|
1819
|
-
const n =
|
|
1829
|
+
function Oo(e) {
|
|
1830
|
+
const n = He(), i = n?.getItem(e);
|
|
1820
1831
|
if (i)
|
|
1821
1832
|
return i;
|
|
1822
1833
|
const o = `web-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
1823
1834
|
return n?.setItem(e, o), o;
|
|
1824
1835
|
}
|
|
1825
|
-
function
|
|
1826
|
-
const n =
|
|
1836
|
+
function No(e) {
|
|
1837
|
+
const n = He(), i = n?.getItem(e);
|
|
1827
1838
|
if (!i)
|
|
1828
1839
|
return null;
|
|
1829
1840
|
const o = Number.parseInt(i, 10);
|
|
1830
1841
|
return Number.isFinite(o) ? o : (n?.removeItem(e), null);
|
|
1831
1842
|
}
|
|
1832
1843
|
function Tt(e, n = Date.now()) {
|
|
1833
|
-
const i =
|
|
1844
|
+
const i = He(), o = No(e);
|
|
1834
1845
|
return o === null ? !1 : o <= n ? (i?.removeItem(e), !1) : !0;
|
|
1835
1846
|
}
|
|
1836
|
-
function
|
|
1837
|
-
|
|
1838
|
-
}
|
|
1839
|
-
function Fo(e) {
|
|
1840
|
-
ze()?.removeItem(e);
|
|
1847
|
+
function Fo(e, n = Date.now()) {
|
|
1848
|
+
He()?.setItem(e, String(n + Io));
|
|
1841
1849
|
}
|
|
1842
1850
|
function Do(e) {
|
|
1851
|
+
He()?.removeItem(e);
|
|
1852
|
+
}
|
|
1853
|
+
function qo(e) {
|
|
1843
1854
|
return e.startsWith("/v1/") ? `/api${e}` : e;
|
|
1844
1855
|
}
|
|
1845
|
-
function
|
|
1856
|
+
function zo(e, n, i) {
|
|
1846
1857
|
if (typeof fetch > "u")
|
|
1847
1858
|
return null;
|
|
1848
1859
|
const o = {
|
|
@@ -1851,7 +1862,7 @@ function qo(e, n, i) {
|
|
|
1851
1862
|
};
|
|
1852
1863
|
i && (o.Authorization = `Bearer ${i}`);
|
|
1853
1864
|
try {
|
|
1854
|
-
return fetch(
|
|
1865
|
+
return fetch(qo(e), {
|
|
1855
1866
|
method: "POST",
|
|
1856
1867
|
headers: o,
|
|
1857
1868
|
body: JSON.stringify({ client_id: n }),
|
|
@@ -1863,41 +1874,41 @@ function qo(e, n, i) {
|
|
|
1863
1874
|
return null;
|
|
1864
1875
|
}
|
|
1865
1876
|
}
|
|
1866
|
-
function
|
|
1867
|
-
const e =
|
|
1877
|
+
function Fa() {
|
|
1878
|
+
const e = xe()(), n = To(), i = es(), o = Oo(n.clientIdStorageKey);
|
|
1868
1879
|
let u = null, l = null, h = !1, g = Tt(n.accountLimitedUntilStorageKey), d = !1, A = null, x = 0;
|
|
1869
|
-
const
|
|
1880
|
+
const m = () => {
|
|
1870
1881
|
u && (clearInterval(u), u = null);
|
|
1871
1882
|
}, w = () => {
|
|
1872
1883
|
l && (clearTimeout(l), l = null);
|
|
1873
1884
|
}, R = () => {
|
|
1874
|
-
|
|
1875
|
-
|
|
1885
|
+
m(), u = setInterval(() => {
|
|
1886
|
+
U();
|
|
1876
1887
|
}, n.heartbeatIntervalMs);
|
|
1877
|
-
}, E = (
|
|
1878
|
-
g || console.warn(
|
|
1879
|
-
}, _ = async (
|
|
1880
|
-
if (!(!h || d || g) && A !==
|
|
1888
|
+
}, E = (j) => {
|
|
1889
|
+
g || console.warn(j), Fo(n.accountLimitedUntilStorageKey), g = !0, h = !1, A = null, m(), w();
|
|
1890
|
+
}, _ = async (j) => {
|
|
1891
|
+
if (!(!h || d || g) && A !== j)
|
|
1881
1892
|
try {
|
|
1882
|
-
await i.patch(n.statusUrl, { status:
|
|
1883
|
-
} catch (
|
|
1884
|
-
Ct(
|
|
1893
|
+
await i.patch(n.statusUrl, { status: j }), A = j;
|
|
1894
|
+
} catch (y) {
|
|
1895
|
+
Ct(y) && E("[Presence] Presence updates paused: account is temporarily limited");
|
|
1885
1896
|
}
|
|
1886
1897
|
}, f = () => {
|
|
1887
1898
|
w(), !(!h || d || g || document.visibilityState !== "visible") && (l = setTimeout(() => {
|
|
1888
1899
|
l = null, _("idle");
|
|
1889
1900
|
}, n.idleAfterMs));
|
|
1890
|
-
},
|
|
1901
|
+
}, v = () => {
|
|
1891
1902
|
if (d || !h || g || document.visibilityState !== "visible")
|
|
1892
1903
|
return;
|
|
1893
|
-
const
|
|
1894
|
-
|
|
1895
|
-
},
|
|
1896
|
-
|
|
1897
|
-
},
|
|
1898
|
-
typeof document > "u" || typeof window > "u" || (document.addEventListener("pointerdown",
|
|
1904
|
+
const j = Date.now();
|
|
1905
|
+
j - x < n.activityDebounceMs || (x = j, _("online"), f());
|
|
1906
|
+
}, b = () => {
|
|
1907
|
+
v();
|
|
1908
|
+
}, D = () => {
|
|
1909
|
+
typeof document > "u" || typeof window > "u" || (document.addEventListener("pointerdown", b, { passive: !0 }), document.addEventListener("keydown", b), document.addEventListener("touchstart", b, { passive: !0 }), window.addEventListener("focus", b));
|
|
1899
1910
|
}, H = () => {
|
|
1900
|
-
typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown",
|
|
1911
|
+
typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", b), document.removeEventListener("keydown", b), document.removeEventListener("touchstart", b), window.removeEventListener("focus", b));
|
|
1901
1912
|
}, B = async () => {
|
|
1902
1913
|
if (Tt(n.accountLimitedUntilStorageKey))
|
|
1903
1914
|
return g = !0, "account_limited";
|
|
@@ -1905,39 +1916,39 @@ function Na() {
|
|
|
1905
1916
|
return await i.post(n.sessionOpenUrl, {
|
|
1906
1917
|
client_id: o,
|
|
1907
1918
|
user_agent: n.userAgentResolver()
|
|
1908
|
-
}),
|
|
1909
|
-
} catch (
|
|
1910
|
-
return Ct(
|
|
1919
|
+
}), Do(n.accountLimitedUntilStorageKey), g = !1, h = !0, A = null, "opened";
|
|
1920
|
+
} catch (j) {
|
|
1921
|
+
return Ct(j) ? (E("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : "failed";
|
|
1911
1922
|
}
|
|
1912
1923
|
}, P = async () => {
|
|
1913
|
-
for (let
|
|
1924
|
+
for (let j = 0; j < ko; j += 1)
|
|
1914
1925
|
if (await B() !== "failed")
|
|
1915
1926
|
return;
|
|
1916
1927
|
console.warn("[Presence] Failed to open session");
|
|
1917
|
-
},
|
|
1928
|
+
}, U = async () => {
|
|
1918
1929
|
if (h)
|
|
1919
1930
|
try {
|
|
1920
1931
|
await i.post(n.sessionHeartbeatUrl, { client_id: o });
|
|
1921
|
-
} catch (
|
|
1922
|
-
Ct(
|
|
1932
|
+
} catch (j) {
|
|
1933
|
+
Ct(j) && E("[Presence] Heartbeat paused: account is temporarily limited");
|
|
1923
1934
|
}
|
|
1924
1935
|
}, V = () => {
|
|
1925
1936
|
if (!h)
|
|
1926
1937
|
return;
|
|
1927
1938
|
h = !1, A = null, w();
|
|
1928
|
-
const
|
|
1939
|
+
const j = zo(
|
|
1929
1940
|
n.sessionCloseUrl,
|
|
1930
1941
|
o,
|
|
1931
1942
|
n.authTokenResolver()
|
|
1932
1943
|
);
|
|
1933
|
-
if (
|
|
1934
|
-
|
|
1944
|
+
if (j) {
|
|
1945
|
+
j.catch(() => {
|
|
1935
1946
|
});
|
|
1936
1947
|
return;
|
|
1937
1948
|
}
|
|
1938
1949
|
i.post(n.sessionCloseUrl, { client_id: o }).catch(() => {
|
|
1939
1950
|
});
|
|
1940
|
-
},
|
|
1951
|
+
}, N = async () => {
|
|
1941
1952
|
if (!d) {
|
|
1942
1953
|
if (await P(), d) {
|
|
1943
1954
|
V();
|
|
@@ -1948,17 +1959,17 @@ function Na() {
|
|
|
1948
1959
|
}, K = () => {
|
|
1949
1960
|
if (!d) {
|
|
1950
1961
|
if (document.visibilityState === "hidden") {
|
|
1951
|
-
V(),
|
|
1962
|
+
V(), m(), w();
|
|
1952
1963
|
return;
|
|
1953
1964
|
}
|
|
1954
1965
|
if (document.visibilityState === "visible" && !h) {
|
|
1955
|
-
g = Tt(n.accountLimitedUntilStorageKey), g ||
|
|
1966
|
+
g = Tt(n.accountLimitedUntilStorageKey), g || N();
|
|
1956
1967
|
return;
|
|
1957
1968
|
}
|
|
1958
|
-
document.visibilityState === "visible" && h && !g &&
|
|
1969
|
+
document.visibilityState === "visible" && h && !g && v();
|
|
1959
1970
|
}
|
|
1960
|
-
},
|
|
1961
|
-
d || (V(),
|
|
1971
|
+
}, re = () => {
|
|
1972
|
+
d || (V(), m(), w());
|
|
1962
1973
|
};
|
|
1963
1974
|
Un(async () => {
|
|
1964
1975
|
if (e.isAuthenticated ?? e.currentUser !== null) {
|
|
@@ -1966,152 +1977,152 @@ function Na() {
|
|
|
1966
1977
|
V();
|
|
1967
1978
|
return;
|
|
1968
1979
|
}
|
|
1969
|
-
h && (R(), _("online"), f()),
|
|
1980
|
+
h && (R(), _("online"), f()), D(), document.addEventListener("visibilitychange", K), window.addEventListener("pagehide", re), window.addEventListener("beforeunload", re);
|
|
1970
1981
|
}
|
|
1971
|
-
}),
|
|
1972
|
-
d = !0, H(), w(),
|
|
1982
|
+
}), $e(() => {
|
|
1983
|
+
d = !0, H(), w(), m(), V(), document.removeEventListener("visibilitychange", K), window.removeEventListener("pagehide", re), window.removeEventListener("beforeunload", re);
|
|
1973
1984
|
});
|
|
1974
1985
|
}
|
|
1975
|
-
const
|
|
1976
|
-
function
|
|
1977
|
-
const n = Ft(), i =
|
|
1978
|
-
let x = 0,
|
|
1979
|
-
const R =
|
|
1986
|
+
const jo = 12e3, $o = 250, Ho = 20;
|
|
1987
|
+
function Da(e) {
|
|
1988
|
+
const n = Ft(), i = xe()(), o = de(!1), u = de(null), l = de(null), h = de([]), g = /* @__PURE__ */ new Map(), d = Mt(), A = d !== null;
|
|
1989
|
+
let x = 0, m = null, w = null;
|
|
1990
|
+
const R = se(() => i.currentUser?.id), E = () => Ln(e)?.trim() ?? "", _ = () => {
|
|
1980
1991
|
const C = l.value?.trim() ?? "";
|
|
1981
1992
|
if (C.length > 0)
|
|
1982
1993
|
return C;
|
|
1983
|
-
const
|
|
1984
|
-
return
|
|
1985
|
-
}, f = (C) => n.getTypingUsers(C),
|
|
1986
|
-
const
|
|
1987
|
-
for (const I of
|
|
1994
|
+
const L = E();
|
|
1995
|
+
return L.length > 0 && (l.value = L), L;
|
|
1996
|
+
}, f = (C) => n.getTypingUsers(C), v = (C) => {
|
|
1997
|
+
const L = f(C);
|
|
1998
|
+
for (const I of L)
|
|
1988
1999
|
n.removeTypingUser(C, I.id);
|
|
1989
2000
|
h.value = [];
|
|
1990
|
-
},
|
|
1991
|
-
const
|
|
1992
|
-
|
|
1993
|
-
},
|
|
2001
|
+
}, b = (C) => {
|
|
2002
|
+
const L = g.get(C);
|
|
2003
|
+
L && (clearTimeout(L), g.delete(C));
|
|
2004
|
+
}, D = () => {
|
|
1994
2005
|
for (const C of g.values())
|
|
1995
2006
|
clearTimeout(C);
|
|
1996
2007
|
g.clear();
|
|
1997
|
-
}, H = (C,
|
|
1998
|
-
|
|
2008
|
+
}, H = (C, L) => {
|
|
2009
|
+
b(C);
|
|
1999
2010
|
const I = setTimeout(() => {
|
|
2000
|
-
g.delete(C), n.removeTypingUser(
|
|
2001
|
-
},
|
|
2011
|
+
g.delete(C), n.removeTypingUser(L, C), h.value = h.value.filter(($) => $.id !== C);
|
|
2012
|
+
}, jo);
|
|
2002
2013
|
g.set(C, I);
|
|
2003
2014
|
}, B = () => {
|
|
2004
|
-
|
|
2015
|
+
m && (clearTimeout(m), m = null), x = 0;
|
|
2005
2016
|
}, P = () => {
|
|
2006
2017
|
const C = E();
|
|
2007
2018
|
if (!(o.value || !C)) {
|
|
2008
|
-
if (u.value = null, !
|
|
2009
|
-
A && !
|
|
2010
|
-
|
|
2011
|
-
},
|
|
2019
|
+
if (u.value = null, !Pe()) {
|
|
2020
|
+
A && !m && x < Ho && (m = setTimeout(() => {
|
|
2021
|
+
m = null, x += 1, P();
|
|
2022
|
+
}, $o));
|
|
2012
2023
|
return;
|
|
2013
2024
|
}
|
|
2014
2025
|
try {
|
|
2015
2026
|
w && (w(), w = null), w = vi(C, {
|
|
2016
2027
|
onTypingStart: V,
|
|
2017
|
-
onTypingStop:
|
|
2028
|
+
onTypingStop: N
|
|
2018
2029
|
}), o.value = !0, l.value = C, B();
|
|
2019
|
-
} catch (
|
|
2020
|
-
u.value =
|
|
2030
|
+
} catch (L) {
|
|
2031
|
+
u.value = L instanceof Error ? L.message : "Failed to subscribe to typing channel";
|
|
2021
2032
|
}
|
|
2022
2033
|
}
|
|
2023
|
-
},
|
|
2034
|
+
}, U = () => {
|
|
2024
2035
|
const C = l.value;
|
|
2025
2036
|
if (B(), !(!o.value || !C))
|
|
2026
2037
|
try {
|
|
2027
|
-
w && (w(), w = null), bi(C),
|
|
2028
|
-
} catch (
|
|
2029
|
-
u.value =
|
|
2038
|
+
w && (w(), w = null), bi(C), D(), v(C), o.value = !1, l.value = null, u.value = null;
|
|
2039
|
+
} catch (L) {
|
|
2040
|
+
u.value = L instanceof Error ? L.message : "Failed to unsubscribe from typing channel";
|
|
2030
2041
|
}
|
|
2031
2042
|
};
|
|
2032
2043
|
function V(C) {
|
|
2033
2044
|
if (C.user_id === R.value)
|
|
2034
2045
|
return;
|
|
2035
|
-
const
|
|
2036
|
-
if (!
|
|
2046
|
+
const L = _();
|
|
2047
|
+
if (!L)
|
|
2037
2048
|
return;
|
|
2038
2049
|
const I = {
|
|
2039
2050
|
id: C.user.id,
|
|
2040
2051
|
name: C.user.name,
|
|
2041
2052
|
...C.user.avatar !== void 0 ? { avatar: C.user.avatar } : {}
|
|
2042
2053
|
};
|
|
2043
|
-
h.value.some((
|
|
2054
|
+
h.value.some(($) => $.id === I.id) || (h.value = [...h.value, I]), n.addTypingUser(L, I), H(C.user_id, L);
|
|
2044
2055
|
}
|
|
2045
|
-
function
|
|
2056
|
+
function N(C) {
|
|
2046
2057
|
if (C.user_id === R.value)
|
|
2047
2058
|
return;
|
|
2048
|
-
|
|
2049
|
-
const
|
|
2050
|
-
|
|
2059
|
+
b(C.user_id);
|
|
2060
|
+
const L = _();
|
|
2061
|
+
L && (h.value = h.value.filter((I) => I.id !== C.user_id), n.removeTypingUser(L, C.user_id));
|
|
2051
2062
|
}
|
|
2052
|
-
const K =
|
|
2063
|
+
const K = se(() => {
|
|
2053
2064
|
const C = _();
|
|
2054
2065
|
if (!C)
|
|
2055
2066
|
return h.value;
|
|
2056
|
-
const
|
|
2067
|
+
const L = f(C);
|
|
2057
2068
|
if (h.value.length === 0)
|
|
2058
|
-
return
|
|
2059
|
-
if (
|
|
2069
|
+
return L;
|
|
2070
|
+
if (L.length === 0)
|
|
2060
2071
|
return h.value;
|
|
2061
2072
|
const I = /* @__PURE__ */ new Map();
|
|
2062
|
-
for (const
|
|
2063
|
-
I.set(
|
|
2064
|
-
for (const
|
|
2065
|
-
I.set(
|
|
2073
|
+
for (const $ of L)
|
|
2074
|
+
I.set($.id, $);
|
|
2075
|
+
for (const $ of h.value)
|
|
2076
|
+
I.set($.id, $);
|
|
2066
2077
|
return [...I.values()];
|
|
2067
|
-
}),
|
|
2078
|
+
}), re = se(() => {
|
|
2068
2079
|
const C = K.value;
|
|
2069
2080
|
if (C.length === 0)
|
|
2070
2081
|
return "";
|
|
2071
|
-
const
|
|
2072
|
-
if (!
|
|
2082
|
+
const L = C[0];
|
|
2083
|
+
if (!L)
|
|
2073
2084
|
return "";
|
|
2074
2085
|
if (C.length === 1)
|
|
2075
|
-
return `${
|
|
2086
|
+
return `${L.name} is typing...`;
|
|
2076
2087
|
const I = C[1];
|
|
2077
2088
|
if (!I)
|
|
2078
2089
|
return `${C.length} people are typing...`;
|
|
2079
2090
|
if (C.length === 2)
|
|
2080
|
-
return `${
|
|
2081
|
-
const
|
|
2082
|
-
return
|
|
2083
|
-
}),
|
|
2091
|
+
return `${L.name} and ${I.name} are typing...`;
|
|
2092
|
+
const $ = C[2];
|
|
2093
|
+
return $ ? C.length === 3 ? `${L.name}, ${I.name} and ${$.name} are typing...` : `${C.length} people are typing...` : `${C.length} people are typing...`;
|
|
2094
|
+
}), j = se(() => K.value.length > 0), y = () => {
|
|
2084
2095
|
o.value || P();
|
|
2085
2096
|
};
|
|
2086
|
-
typeof window < "u" && window.addEventListener(
|
|
2087
|
-
const
|
|
2097
|
+
typeof window < "u" && window.addEventListener(ze(), y);
|
|
2098
|
+
const O = it((C) => {
|
|
2088
2099
|
if (C === "connected") {
|
|
2089
2100
|
o.value || P();
|
|
2090
2101
|
return;
|
|
2091
2102
|
}
|
|
2092
2103
|
if (C === "disconnected" || C === "error") {
|
|
2093
2104
|
B(), w && (w(), w = null);
|
|
2094
|
-
const
|
|
2095
|
-
|
|
2105
|
+
const L = _();
|
|
2106
|
+
L && v(L), o.value = !1, l.value = null, D();
|
|
2096
2107
|
}
|
|
2097
2108
|
});
|
|
2098
|
-
return d !== null &&
|
|
2099
|
-
B(),
|
|
2109
|
+
return d !== null && $e(() => {
|
|
2110
|
+
B(), O(), D(), U(), typeof window < "u" && window.removeEventListener(ze(), y);
|
|
2100
2111
|
}), {
|
|
2101
|
-
isSubscribed:
|
|
2102
|
-
error:
|
|
2112
|
+
isSubscribed: se(() => o.value),
|
|
2113
|
+
error: se(() => u.value),
|
|
2103
2114
|
typingUsers: K,
|
|
2104
|
-
formatTypingIndicator:
|
|
2105
|
-
hasTypingUsers:
|
|
2115
|
+
formatTypingIndicator: re,
|
|
2116
|
+
hasTypingUsers: j,
|
|
2106
2117
|
subscribe: P,
|
|
2107
|
-
unsubscribe:
|
|
2118
|
+
unsubscribe: U
|
|
2108
2119
|
};
|
|
2109
2120
|
}
|
|
2110
|
-
function
|
|
2111
|
-
e.apiClient &&
|
|
2121
|
+
function qa(e) {
|
|
2122
|
+
e.apiClient && Ei(e.apiClient), e.mainApiClient && lo(e.mainApiClient), e.authStore && Ai(e.authStore), e.mediaApi && Mi(e.mediaApi), e.createLogger && oo(e.createLogger), e.playMessageNotification && bo(e.playMessageNotification), e.echo && yi(e.echo), e.mainEcho && so(e.mainEcho), e.presence && Eo(e.presence);
|
|
2112
2123
|
}
|
|
2113
|
-
function
|
|
2114
|
-
|
|
2124
|
+
function za() {
|
|
2125
|
+
Ri(), ho(), Pi(), ki(), ao(), yo(), _i(), ro(), Ro();
|
|
2115
2126
|
}
|
|
2116
2127
|
class $t {
|
|
2117
2128
|
constructor() {
|
|
@@ -2162,7 +2173,7 @@ class rs {
|
|
|
2162
2173
|
this.namespace = n;
|
|
2163
2174
|
}
|
|
2164
2175
|
}
|
|
2165
|
-
function
|
|
2176
|
+
function Bo(e) {
|
|
2166
2177
|
try {
|
|
2167
2178
|
new e();
|
|
2168
2179
|
} catch (n) {
|
|
@@ -2259,7 +2270,7 @@ class is extends Ht {
|
|
|
2259
2270
|
), this;
|
|
2260
2271
|
}
|
|
2261
2272
|
}
|
|
2262
|
-
class
|
|
2273
|
+
class Vo extends Ht {
|
|
2263
2274
|
/**
|
|
2264
2275
|
* Send a whisper event to other clients in the channel.
|
|
2265
2276
|
*/
|
|
@@ -2270,7 +2281,7 @@ class Bo extends Ht {
|
|
|
2270
2281
|
), this;
|
|
2271
2282
|
}
|
|
2272
2283
|
}
|
|
2273
|
-
class
|
|
2284
|
+
class Xo extends is {
|
|
2274
2285
|
/**
|
|
2275
2286
|
* Register a callback to be called anytime the member list changes.
|
|
2276
2287
|
*/
|
|
@@ -2393,7 +2404,7 @@ class as extends os {
|
|
|
2393
2404
|
}), this;
|
|
2394
2405
|
}
|
|
2395
2406
|
}
|
|
2396
|
-
class
|
|
2407
|
+
class Wo extends as {
|
|
2397
2408
|
/**
|
|
2398
2409
|
* Register a callback to be called anytime the member list changes.
|
|
2399
2410
|
*/
|
|
@@ -2487,7 +2498,7 @@ class cs extends rt {
|
|
|
2487
2498
|
return this;
|
|
2488
2499
|
}
|
|
2489
2500
|
}
|
|
2490
|
-
class
|
|
2501
|
+
class Go extends rt {
|
|
2491
2502
|
/**
|
|
2492
2503
|
* Send a whisper event to other clients in the channel.
|
|
2493
2504
|
*/
|
|
@@ -2495,7 +2506,7 @@ class Wo extends rt {
|
|
|
2495
2506
|
return this;
|
|
2496
2507
|
}
|
|
2497
2508
|
}
|
|
2498
|
-
class
|
|
2509
|
+
class Jo extends cs {
|
|
2499
2510
|
/**
|
|
2500
2511
|
* Register a callback to be called anytime the member list changes.
|
|
2501
2512
|
*/
|
|
@@ -2564,7 +2575,7 @@ us._defaultOptions = {
|
|
|
2564
2575
|
namespace: "App.Events"
|
|
2565
2576
|
};
|
|
2566
2577
|
let Bt = us;
|
|
2567
|
-
class
|
|
2578
|
+
class Ze extends Bt {
|
|
2568
2579
|
constructor() {
|
|
2569
2580
|
super(...arguments), this.channels = {};
|
|
2570
2581
|
}
|
|
@@ -2622,7 +2633,7 @@ class Qe extends Bt {
|
|
|
2622
2633
|
* Get a private encrypted channel instance by name.
|
|
2623
2634
|
*/
|
|
2624
2635
|
encryptedPrivateChannel(n) {
|
|
2625
|
-
return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new
|
|
2636
|
+
return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new Vo(
|
|
2626
2637
|
this.pusher,
|
|
2627
2638
|
"private-encrypted-" + n,
|
|
2628
2639
|
this.options
|
|
@@ -2632,7 +2643,7 @@ class Qe extends Bt {
|
|
|
2632
2643
|
* Get a presence channel instance by name.
|
|
2633
2644
|
*/
|
|
2634
2645
|
presenceChannel(n) {
|
|
2635
|
-
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new
|
|
2646
|
+
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new Xo(
|
|
2636
2647
|
this.pusher,
|
|
2637
2648
|
"presence-" + n,
|
|
2638
2649
|
this.options
|
|
@@ -2701,7 +2712,7 @@ class Qe extends Bt {
|
|
|
2701
2712
|
this.pusher.disconnect();
|
|
2702
2713
|
}
|
|
2703
2714
|
}
|
|
2704
|
-
class
|
|
2715
|
+
class Ko extends Bt {
|
|
2705
2716
|
constructor() {
|
|
2706
2717
|
super(...arguments), this.channels = {};
|
|
2707
2718
|
}
|
|
@@ -2761,7 +2772,7 @@ class Jo extends Bt {
|
|
|
2761
2772
|
* Get a presence channel instance by name.
|
|
2762
2773
|
*/
|
|
2763
2774
|
presenceChannel(n) {
|
|
2764
|
-
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new
|
|
2775
|
+
return this.channels["presence-" + n] || (this.channels["presence-" + n] = new Wo(
|
|
2765
2776
|
this.socket,
|
|
2766
2777
|
"presence-" + n,
|
|
2767
2778
|
this.options
|
|
@@ -2854,13 +2865,13 @@ class Mn extends Bt {
|
|
|
2854
2865
|
* Get a private encrypted channel instance by name.
|
|
2855
2866
|
*/
|
|
2856
2867
|
encryptedPrivateChannel(n) {
|
|
2857
|
-
return new
|
|
2868
|
+
return new Go();
|
|
2858
2869
|
}
|
|
2859
2870
|
/**
|
|
2860
2871
|
* Get a presence channel instance by name.
|
|
2861
2872
|
*/
|
|
2862
2873
|
presenceChannel(n) {
|
|
2863
|
-
return new
|
|
2874
|
+
return new Jo();
|
|
2864
2875
|
}
|
|
2865
2876
|
/**
|
|
2866
2877
|
* Leave the given channel, as well as its private and presence variants.
|
|
@@ -2897,7 +2908,7 @@ class Mn extends Bt {
|
|
|
2897
2908
|
disconnect() {
|
|
2898
2909
|
}
|
|
2899
2910
|
}
|
|
2900
|
-
class
|
|
2911
|
+
class Yo {
|
|
2901
2912
|
/**
|
|
2902
2913
|
* Create a new class instance.
|
|
2903
2914
|
*/
|
|
@@ -2915,23 +2926,23 @@ class Ko {
|
|
|
2915
2926
|
*/
|
|
2916
2927
|
connect() {
|
|
2917
2928
|
if (this.options.broadcaster === "reverb")
|
|
2918
|
-
this.connector = new
|
|
2929
|
+
this.connector = new Ze({
|
|
2919
2930
|
...this.options,
|
|
2920
2931
|
cluster: ""
|
|
2921
2932
|
});
|
|
2922
2933
|
else if (this.options.broadcaster === "pusher")
|
|
2923
|
-
this.connector = new
|
|
2934
|
+
this.connector = new Ze(this.options);
|
|
2924
2935
|
else if (this.options.broadcaster === "ably")
|
|
2925
|
-
this.connector = new
|
|
2936
|
+
this.connector = new Ze({
|
|
2926
2937
|
...this.options,
|
|
2927
2938
|
cluster: "",
|
|
2928
2939
|
broadcaster: "pusher"
|
|
2929
2940
|
});
|
|
2930
2941
|
else if (this.options.broadcaster === "socket.io")
|
|
2931
|
-
this.connector = new
|
|
2942
|
+
this.connector = new Ko(this.options);
|
|
2932
2943
|
else if (this.options.broadcaster === "null")
|
|
2933
2944
|
this.connector = new Mn(this.options);
|
|
2934
|
-
else if (typeof this.options.broadcaster == "function" &&
|
|
2945
|
+
else if (typeof this.options.broadcaster == "function" && Bo(this.options.broadcaster))
|
|
2935
2946
|
this.connector = new this.options.broadcaster(this.options);
|
|
2936
2947
|
else
|
|
2937
2948
|
throw new Error(
|
|
@@ -2994,7 +3005,7 @@ class Ko {
|
|
|
2994
3005
|
);
|
|
2995
3006
|
}
|
|
2996
3007
|
connectorSupportsEncryptedPrivateChannels(n) {
|
|
2997
|
-
return n instanceof
|
|
3008
|
+
return n instanceof Ze || n instanceof Mn;
|
|
2998
3009
|
}
|
|
2999
3010
|
/**
|
|
3000
3011
|
* Get the Socket ID for the connection.
|
|
@@ -3055,12 +3066,12 @@ class Ko {
|
|
|
3055
3066
|
);
|
|
3056
3067
|
}
|
|
3057
3068
|
}
|
|
3058
|
-
function
|
|
3069
|
+
function Qo(e) {
|
|
3059
3070
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3060
3071
|
}
|
|
3061
3072
|
var Et = { exports: {} };
|
|
3062
3073
|
var kn;
|
|
3063
|
-
function
|
|
3074
|
+
function Zo() {
|
|
3064
3075
|
return kn || (kn = 1, (function(e, n) {
|
|
3065
3076
|
(function(o, u) {
|
|
3066
3077
|
e.exports = u();
|
|
@@ -3115,19 +3126,19 @@ function Qo() {
|
|
|
3115
3126
|
/***/
|
|
3116
3127
|
(function(i, o, u) {
|
|
3117
3128
|
var l = this && this.__extends || /* @__PURE__ */ (function() {
|
|
3118
|
-
var _ = function(f,
|
|
3119
|
-
return _ = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(
|
|
3120
|
-
|
|
3121
|
-
} || function(
|
|
3122
|
-
for (var H in
|
|
3123
|
-
}, _(f,
|
|
3129
|
+
var _ = function(f, v) {
|
|
3130
|
+
return _ = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(b, D) {
|
|
3131
|
+
b.__proto__ = D;
|
|
3132
|
+
} || function(b, D) {
|
|
3133
|
+
for (var H in D) D.hasOwnProperty(H) && (b[H] = D[H]);
|
|
3134
|
+
}, _(f, v);
|
|
3124
3135
|
};
|
|
3125
|
-
return function(f,
|
|
3126
|
-
_(f,
|
|
3127
|
-
function
|
|
3136
|
+
return function(f, v) {
|
|
3137
|
+
_(f, v);
|
|
3138
|
+
function b() {
|
|
3128
3139
|
this.constructor = f;
|
|
3129
3140
|
}
|
|
3130
|
-
f.prototype =
|
|
3141
|
+
f.prototype = v === null ? Object.create(v) : (b.prototype = v.prototype, new b());
|
|
3131
3142
|
};
|
|
3132
3143
|
})();
|
|
3133
3144
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
@@ -3140,16 +3151,16 @@ function Qo() {
|
|
|
3140
3151
|
return _.prototype.encodedLength = function(f) {
|
|
3141
3152
|
return this._paddingCharacter ? (f + 2) / 3 * 4 | 0 : (f * 8 + 5) / 6 | 0;
|
|
3142
3153
|
}, _.prototype.encode = function(f) {
|
|
3143
|
-
for (var
|
|
3144
|
-
var
|
|
3145
|
-
|
|
3154
|
+
for (var v = "", b = 0; b < f.length - 2; b += 3) {
|
|
3155
|
+
var D = f[b] << 16 | f[b + 1] << 8 | f[b + 2];
|
|
3156
|
+
v += this._encodeByte(D >>> 18 & 63), v += this._encodeByte(D >>> 12 & 63), v += this._encodeByte(D >>> 6 & 63), v += this._encodeByte(D >>> 0 & 63);
|
|
3146
3157
|
}
|
|
3147
|
-
var H = f.length -
|
|
3158
|
+
var H = f.length - b;
|
|
3148
3159
|
if (H > 0) {
|
|
3149
|
-
var
|
|
3150
|
-
|
|
3160
|
+
var D = f[b] << 16 | (H === 2 ? f[b + 1] << 8 : 0);
|
|
3161
|
+
v += this._encodeByte(D >>> 18 & 63), v += this._encodeByte(D >>> 12 & 63), H === 2 ? v += this._encodeByte(D >>> 6 & 63) : v += this._paddingCharacter || "", v += this._paddingCharacter || "";
|
|
3151
3162
|
}
|
|
3152
|
-
return
|
|
3163
|
+
return v;
|
|
3153
3164
|
}, _.prototype.maxDecodedLength = function(f) {
|
|
3154
3165
|
return this._paddingCharacter ? f / 4 * 3 | 0 : (f * 6 + 7) / 8 | 0;
|
|
3155
3166
|
}, _.prototype.decodedLength = function(f) {
|
|
@@ -3157,26 +3168,26 @@ function Qo() {
|
|
|
3157
3168
|
}, _.prototype.decode = function(f) {
|
|
3158
3169
|
if (f.length === 0)
|
|
3159
3170
|
return new Uint8Array(0);
|
|
3160
|
-
for (var
|
|
3161
|
-
|
|
3162
|
-
if (B <
|
|
3171
|
+
for (var v = this._getPaddingLength(f), b = f.length - v, D = new Uint8Array(this.maxDecodedLength(b)), H = 0, B = 0, P = 0, U = 0, V = 0, N = 0, K = 0; B < b - 4; B += 4)
|
|
3172
|
+
U = this._decodeChar(f.charCodeAt(B + 0)), V = this._decodeChar(f.charCodeAt(B + 1)), N = this._decodeChar(f.charCodeAt(B + 2)), K = this._decodeChar(f.charCodeAt(B + 3)), D[H++] = U << 2 | V >>> 4, D[H++] = V << 4 | N >>> 2, D[H++] = N << 6 | K, P |= U & h, P |= V & h, P |= N & h, P |= K & h;
|
|
3173
|
+
if (B < b - 1 && (U = this._decodeChar(f.charCodeAt(B)), V = this._decodeChar(f.charCodeAt(B + 1)), D[H++] = U << 2 | V >>> 4, P |= U & h, P |= V & h), B < b - 2 && (N = this._decodeChar(f.charCodeAt(B + 2)), D[H++] = V << 4 | N >>> 2, P |= N & h), B < b - 3 && (K = this._decodeChar(f.charCodeAt(B + 3)), D[H++] = N << 6 | K, P |= K & h), P !== 0)
|
|
3163
3174
|
throw new Error("Base64Coder: incorrect characters for decoding");
|
|
3164
|
-
return
|
|
3175
|
+
return D;
|
|
3165
3176
|
}, _.prototype._encodeByte = function(f) {
|
|
3166
|
-
var
|
|
3167
|
-
return
|
|
3177
|
+
var v = f;
|
|
3178
|
+
return v += 65, v += 25 - f >>> 8 & 6, v += 51 - f >>> 8 & -75, v += 61 - f >>> 8 & -15, v += 62 - f >>> 8 & 3, String.fromCharCode(v);
|
|
3168
3179
|
}, _.prototype._decodeChar = function(f) {
|
|
3169
|
-
var
|
|
3170
|
-
return
|
|
3180
|
+
var v = h;
|
|
3181
|
+
return v += (42 - f & f - 44) >>> 8 & -h + f - 43 + 62, v += (46 - f & f - 48) >>> 8 & -h + f - 47 + 63, v += (47 - f & f - 58) >>> 8 & -h + f - 48 + 52, v += (64 - f & f - 91) >>> 8 & -h + f - 65 + 0, v += (96 - f & f - 123) >>> 8 & -h + f - 97 + 26, v;
|
|
3171
3182
|
}, _.prototype._getPaddingLength = function(f) {
|
|
3172
|
-
var
|
|
3183
|
+
var v = 0;
|
|
3173
3184
|
if (this._paddingCharacter) {
|
|
3174
|
-
for (var
|
|
3175
|
-
|
|
3176
|
-
if (f.length < 4 ||
|
|
3185
|
+
for (var b = f.length - 1; b >= 0 && f[b] === this._paddingCharacter; b--)
|
|
3186
|
+
v++;
|
|
3187
|
+
if (f.length < 4 || v > 2)
|
|
3177
3188
|
throw new Error("Base64Coder: incorrect padding");
|
|
3178
3189
|
}
|
|
3179
|
-
return
|
|
3190
|
+
return v;
|
|
3180
3191
|
}, _;
|
|
3181
3192
|
})()
|
|
3182
3193
|
);
|
|
@@ -3190,24 +3201,24 @@ function Qo() {
|
|
|
3190
3201
|
return d.decode(_);
|
|
3191
3202
|
}
|
|
3192
3203
|
o.decode = x;
|
|
3193
|
-
var
|
|
3204
|
+
var m = (
|
|
3194
3205
|
/** @class */
|
|
3195
3206
|
(function(_) {
|
|
3196
3207
|
l(f, _);
|
|
3197
3208
|
function f() {
|
|
3198
3209
|
return _ !== null && _.apply(this, arguments) || this;
|
|
3199
3210
|
}
|
|
3200
|
-
return f.prototype._encodeByte = function(
|
|
3201
|
-
var
|
|
3202
|
-
return
|
|
3203
|
-
}, f.prototype._decodeChar = function(
|
|
3204
|
-
var
|
|
3205
|
-
return
|
|
3211
|
+
return f.prototype._encodeByte = function(v) {
|
|
3212
|
+
var b = v;
|
|
3213
|
+
return b += 65, b += 25 - v >>> 8 & 6, b += 51 - v >>> 8 & -75, b += 61 - v >>> 8 & -13, b += 62 - v >>> 8 & 49, String.fromCharCode(b);
|
|
3214
|
+
}, f.prototype._decodeChar = function(v) {
|
|
3215
|
+
var b = h;
|
|
3216
|
+
return b += (44 - v & v - 46) >>> 8 & -h + v - 45 + 62, b += (94 - v & v - 96) >>> 8 & -h + v - 95 + 63, b += (47 - v & v - 58) >>> 8 & -h + v - 48 + 52, b += (64 - v & v - 91) >>> 8 & -h + v - 65 + 0, b += (96 - v & v - 123) >>> 8 & -h + v - 97 + 26, b;
|
|
3206
3217
|
}, f;
|
|
3207
3218
|
})(g)
|
|
3208
3219
|
);
|
|
3209
|
-
o.URLSafeCoder =
|
|
3210
|
-
var w = new
|
|
3220
|
+
o.URLSafeCoder = m;
|
|
3221
|
+
var w = new m();
|
|
3211
3222
|
function R(_) {
|
|
3212
3223
|
return w.encode(_);
|
|
3213
3224
|
}
|
|
@@ -3229,34 +3240,34 @@ function Qo() {
|
|
|
3229
3240
|
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
3230
3241
|
var l = "utf8: invalid string", h = "utf8: invalid source encoding";
|
|
3231
3242
|
function g(x) {
|
|
3232
|
-
for (var
|
|
3243
|
+
for (var m = new Uint8Array(d(x)), w = 0, R = 0; R < x.length; R++) {
|
|
3233
3244
|
var E = x.charCodeAt(R);
|
|
3234
|
-
E < 128 ?
|
|
3245
|
+
E < 128 ? m[w++] = E : E < 2048 ? (m[w++] = 192 | E >> 6, m[w++] = 128 | E & 63) : E < 55296 ? (m[w++] = 224 | E >> 12, m[w++] = 128 | E >> 6 & 63, m[w++] = 128 | E & 63) : (R++, E = (E & 1023) << 10, E |= x.charCodeAt(R) & 1023, E += 65536, m[w++] = 240 | E >> 18, m[w++] = 128 | E >> 12 & 63, m[w++] = 128 | E >> 6 & 63, m[w++] = 128 | E & 63);
|
|
3235
3246
|
}
|
|
3236
|
-
return
|
|
3247
|
+
return m;
|
|
3237
3248
|
}
|
|
3238
3249
|
o.encode = g;
|
|
3239
3250
|
function d(x) {
|
|
3240
|
-
for (var
|
|
3251
|
+
for (var m = 0, w = 0; w < x.length; w++) {
|
|
3241
3252
|
var R = x.charCodeAt(w);
|
|
3242
3253
|
if (R < 128)
|
|
3243
|
-
|
|
3254
|
+
m += 1;
|
|
3244
3255
|
else if (R < 2048)
|
|
3245
|
-
|
|
3256
|
+
m += 2;
|
|
3246
3257
|
else if (R < 55296)
|
|
3247
|
-
|
|
3258
|
+
m += 3;
|
|
3248
3259
|
else if (R <= 57343) {
|
|
3249
3260
|
if (w >= x.length - 1)
|
|
3250
3261
|
throw new Error(l);
|
|
3251
|
-
w++,
|
|
3262
|
+
w++, m += 4;
|
|
3252
3263
|
} else
|
|
3253
3264
|
throw new Error(l);
|
|
3254
3265
|
}
|
|
3255
|
-
return
|
|
3266
|
+
return m;
|
|
3256
3267
|
}
|
|
3257
3268
|
o.encodedLength = d;
|
|
3258
3269
|
function A(x) {
|
|
3259
|
-
for (var
|
|
3270
|
+
for (var m = [], w = 0; w < x.length; w++) {
|
|
3260
3271
|
var R = x[w];
|
|
3261
3272
|
if (R & 128) {
|
|
3262
3273
|
var E = void 0;
|
|
@@ -3277,10 +3288,10 @@ function Qo() {
|
|
|
3277
3288
|
} else if (R < 248) {
|
|
3278
3289
|
if (w >= x.length - 2)
|
|
3279
3290
|
throw new Error(h);
|
|
3280
|
-
var _ = x[++w], f = x[++w],
|
|
3281
|
-
if ((_ & 192) !== 128 || (f & 192) !== 128 || (
|
|
3291
|
+
var _ = x[++w], f = x[++w], v = x[++w];
|
|
3292
|
+
if ((_ & 192) !== 128 || (f & 192) !== 128 || (v & 192) !== 128)
|
|
3282
3293
|
throw new Error(h);
|
|
3283
|
-
R = (R & 15) << 18 | (_ & 63) << 12 | (f & 63) << 6 |
|
|
3294
|
+
R = (R & 15) << 18 | (_ & 63) << 12 | (f & 63) << 6 | v & 63, E = 65536;
|
|
3284
3295
|
} else
|
|
3285
3296
|
throw new Error(h);
|
|
3286
3297
|
if (R < E || R >= 55296 && R <= 57343)
|
|
@@ -3288,12 +3299,12 @@ function Qo() {
|
|
|
3288
3299
|
if (R >= 65536) {
|
|
3289
3300
|
if (R > 1114111)
|
|
3290
3301
|
throw new Error(h);
|
|
3291
|
-
R -= 65536,
|
|
3302
|
+
R -= 65536, m.push(String.fromCharCode(55296 | R >> 10)), R = 56320 | R & 1023;
|
|
3292
3303
|
}
|
|
3293
3304
|
}
|
|
3294
|
-
|
|
3305
|
+
m.push(String.fromCharCode(R));
|
|
3295
3306
|
}
|
|
3296
|
-
return
|
|
3307
|
+
return m.join("");
|
|
3297
3308
|
}
|
|
3298
3309
|
o.decode = A;
|
|
3299
3310
|
}),
|
|
@@ -3361,12 +3372,12 @@ function Qo() {
|
|
|
3361
3372
|
c.loading[t] = [a];
|
|
3362
3373
|
var p = z.createScriptRequest(c.getPath(t, s)), S = c.receivers.create(function(k) {
|
|
3363
3374
|
if (c.receivers.remove(S), c.loading[t]) {
|
|
3364
|
-
var
|
|
3375
|
+
var q = c.loading[t];
|
|
3365
3376
|
delete c.loading[t];
|
|
3366
3377
|
for (var Y = function(oe) {
|
|
3367
3378
|
oe || p.cleanup();
|
|
3368
|
-
}, ee = 0; ee <
|
|
3369
|
-
|
|
3379
|
+
}, ee = 0; ee < q.length; ee++)
|
|
3380
|
+
q[ee](k, Y);
|
|
3370
3381
|
}
|
|
3371
3382
|
});
|
|
3372
3383
|
p.send(S);
|
|
@@ -3380,7 +3391,7 @@ function Qo() {
|
|
|
3380
3391
|
return this.getRoot(s) + "/" + t + this.options.suffix + ".js";
|
|
3381
3392
|
}
|
|
3382
3393
|
}
|
|
3383
|
-
var x = new l("_pusher_dependencies", "Pusher.DependenciesReceivers"),
|
|
3394
|
+
var x = new l("_pusher_dependencies", "Pusher.DependenciesReceivers"), m = new A({
|
|
3384
3395
|
cdn_http: d.cdn_http,
|
|
3385
3396
|
cdn_https: d.cdn_https,
|
|
3386
3397
|
version: d.VERSION,
|
|
@@ -3422,17 +3433,17 @@ function Qo() {
|
|
|
3422
3433
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3423
3434
|
}
|
|
3424
3435
|
}
|
|
3425
|
-
class
|
|
3436
|
+
class v extends Error {
|
|
3426
3437
|
constructor(t) {
|
|
3427
3438
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3428
3439
|
}
|
|
3429
3440
|
}
|
|
3430
|
-
class
|
|
3441
|
+
class b extends Error {
|
|
3431
3442
|
constructor(t) {
|
|
3432
3443
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3433
3444
|
}
|
|
3434
3445
|
}
|
|
3435
|
-
class
|
|
3446
|
+
class D extends Error {
|
|
3436
3447
|
constructor(t) {
|
|
3437
3448
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3438
3449
|
}
|
|
@@ -3452,7 +3463,7 @@ function Qo() {
|
|
|
3452
3463
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3453
3464
|
}
|
|
3454
3465
|
}
|
|
3455
|
-
class
|
|
3466
|
+
class U extends Error {
|
|
3456
3467
|
constructor(t) {
|
|
3457
3468
|
super(t), Object.setPrototypeOf(this, new.target.prototype);
|
|
3458
3469
|
}
|
|
@@ -3475,13 +3486,13 @@ function Qo() {
|
|
|
3475
3486
|
return p.onreadystatechange = function() {
|
|
3476
3487
|
if (p.readyState === 4)
|
|
3477
3488
|
if (p.status === 200) {
|
|
3478
|
-
let k,
|
|
3489
|
+
let k, q = !1;
|
|
3479
3490
|
try {
|
|
3480
|
-
k = JSON.parse(p.responseText),
|
|
3491
|
+
k = JSON.parse(p.responseText), q = !0;
|
|
3481
3492
|
} catch {
|
|
3482
3493
|
c(new V(200, `JSON returned from ${a.toString()} endpoint was invalid, yet status code was 200. Data was: ${p.responseText}`), null);
|
|
3483
3494
|
}
|
|
3484
|
-
|
|
3495
|
+
q && c(null, k);
|
|
3485
3496
|
} else {
|
|
3486
3497
|
let k = "";
|
|
3487
3498
|
switch (a) {
|
|
@@ -3496,26 +3507,26 @@ function Qo() {
|
|
|
3496
3507
|
}
|
|
3497
3508
|
}, p.send(t), p;
|
|
3498
3509
|
};
|
|
3499
|
-
function
|
|
3510
|
+
function re(r) {
|
|
3500
3511
|
return I(C(r));
|
|
3501
3512
|
}
|
|
3502
|
-
var
|
|
3513
|
+
var j = String.fromCharCode, y = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", O = function(r) {
|
|
3503
3514
|
var t = r.charCodeAt(0);
|
|
3504
|
-
return t < 128 ? r : t < 2048 ?
|
|
3515
|
+
return t < 128 ? r : t < 2048 ? j(192 | t >>> 6) + j(128 | t & 63) : j(224 | t >>> 12 & 15) + j(128 | t >>> 6 & 63) + j(128 | t & 63);
|
|
3505
3516
|
}, C = function(r) {
|
|
3506
|
-
return r.replace(/[^\x00-\x7F]/g,
|
|
3507
|
-
},
|
|
3517
|
+
return r.replace(/[^\x00-\x7F]/g, O);
|
|
3518
|
+
}, L = function(r) {
|
|
3508
3519
|
var t = [0, 2, 1][r.length % 3], s = r.charCodeAt(0) << 16 | (r.length > 1 ? r.charCodeAt(1) : 0) << 8 | (r.length > 2 ? r.charCodeAt(2) : 0), a = [
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
t >= 2 ? "=" :
|
|
3512
|
-
t >= 1 ? "=" :
|
|
3520
|
+
y.charAt(s >>> 18),
|
|
3521
|
+
y.charAt(s >>> 12 & 63),
|
|
3522
|
+
t >= 2 ? "=" : y.charAt(s >>> 6 & 63),
|
|
3523
|
+
t >= 1 ? "=" : y.charAt(s & 63)
|
|
3513
3524
|
];
|
|
3514
3525
|
return a.join("");
|
|
3515
3526
|
}, I = window.btoa || function(r) {
|
|
3516
|
-
return r.replace(/[\s\S]{1,3}/g,
|
|
3527
|
+
return r.replace(/[\s\S]{1,3}/g, L);
|
|
3517
3528
|
};
|
|
3518
|
-
class
|
|
3529
|
+
class $ {
|
|
3519
3530
|
constructor(t, s, a, c) {
|
|
3520
3531
|
this.clear = s, this.timer = t(() => {
|
|
3521
3532
|
this.timer && (this.timer = c(this.timer));
|
|
@@ -3528,21 +3539,21 @@ function Qo() {
|
|
|
3528
3539
|
this.timer && (this.clear(this.timer), this.timer = null);
|
|
3529
3540
|
}
|
|
3530
3541
|
}
|
|
3531
|
-
var
|
|
3532
|
-
function
|
|
3542
|
+
var ie = $;
|
|
3543
|
+
function me(r) {
|
|
3533
3544
|
window.clearTimeout(r);
|
|
3534
3545
|
}
|
|
3535
3546
|
function Vt(r) {
|
|
3536
3547
|
window.clearInterval(r);
|
|
3537
3548
|
}
|
|
3538
|
-
class T extends
|
|
3549
|
+
class T extends ie {
|
|
3539
3550
|
constructor(t, s) {
|
|
3540
|
-
super(setTimeout,
|
|
3551
|
+
super(setTimeout, me, t, function(a) {
|
|
3541
3552
|
return s(), null;
|
|
3542
3553
|
});
|
|
3543
3554
|
}
|
|
3544
3555
|
}
|
|
3545
|
-
class M extends
|
|
3556
|
+
class M extends ie {
|
|
3546
3557
|
constructor(t, s) {
|
|
3547
3558
|
super(setInterval, Vt, t, function(a) {
|
|
3548
3559
|
return s(), a;
|
|
@@ -3562,7 +3573,7 @@ function Qo() {
|
|
|
3562
3573
|
return a[r].apply(a, s.concat(arguments));
|
|
3563
3574
|
};
|
|
3564
3575
|
}
|
|
3565
|
-
},
|
|
3576
|
+
}, F = Q;
|
|
3566
3577
|
function X(r, ...t) {
|
|
3567
3578
|
for (var s = 0; s < t.length; s++) {
|
|
3568
3579
|
var a = t[s];
|
|
@@ -3571,12 +3582,12 @@ function Qo() {
|
|
|
3571
3582
|
}
|
|
3572
3583
|
return r;
|
|
3573
3584
|
}
|
|
3574
|
-
function
|
|
3585
|
+
function ve() {
|
|
3575
3586
|
for (var r = ["Pusher"], t = 0; t < arguments.length; t++)
|
|
3576
|
-
typeof arguments[t] == "string" ? r.push(arguments[t]) : r.push(
|
|
3587
|
+
typeof arguments[t] == "string" ? r.push(arguments[t]) : r.push(Ve(arguments[t]));
|
|
3577
3588
|
return r.join(" : ");
|
|
3578
3589
|
}
|
|
3579
|
-
function
|
|
3590
|
+
function be(r, t) {
|
|
3580
3591
|
var s = Array.prototype.indexOf;
|
|
3581
3592
|
if (r === null)
|
|
3582
3593
|
return -1;
|
|
@@ -3591,7 +3602,7 @@ function Qo() {
|
|
|
3591
3602
|
for (var s in r)
|
|
3592
3603
|
Object.prototype.hasOwnProperty.call(r, s) && t(r[s], s, r);
|
|
3593
3604
|
}
|
|
3594
|
-
function
|
|
3605
|
+
function Be(r) {
|
|
3595
3606
|
var t = [];
|
|
3596
3607
|
return fe(r, function(s, a) {
|
|
3597
3608
|
t.push(a);
|
|
@@ -3612,7 +3623,7 @@ function Qo() {
|
|
|
3612
3623
|
s.push(t(r[a], a, r, s));
|
|
3613
3624
|
return s;
|
|
3614
3625
|
}
|
|
3615
|
-
function
|
|
3626
|
+
function Ce(r, t) {
|
|
3616
3627
|
var s = {};
|
|
3617
3628
|
return fe(r, function(a, c) {
|
|
3618
3629
|
s[c] = t(a);
|
|
@@ -3626,7 +3637,7 @@ function Qo() {
|
|
|
3626
3637
|
t(r[a], a, r, s) && s.push(r[a]);
|
|
3627
3638
|
return s;
|
|
3628
3639
|
}
|
|
3629
|
-
function
|
|
3640
|
+
function Me(r, t) {
|
|
3630
3641
|
var s = {};
|
|
3631
3642
|
return fe(r, function(a, c) {
|
|
3632
3643
|
(t && t(a, c, r, s) || a) && (s[c] = a);
|
|
@@ -3651,20 +3662,20 @@ function Qo() {
|
|
|
3651
3662
|
return !0;
|
|
3652
3663
|
}
|
|
3653
3664
|
function fs(r) {
|
|
3654
|
-
return
|
|
3655
|
-
return typeof t == "object" && (t =
|
|
3665
|
+
return Ce(r, function(t) {
|
|
3666
|
+
return typeof t == "object" && (t = Ve(t)), encodeURIComponent(re(t.toString()));
|
|
3656
3667
|
});
|
|
3657
3668
|
}
|
|
3658
3669
|
function ps(r) {
|
|
3659
|
-
var t =
|
|
3670
|
+
var t = Me(r, function(a) {
|
|
3660
3671
|
return a !== void 0;
|
|
3661
|
-
}), s = pe(hs(fs(t)),
|
|
3672
|
+
}), s = pe(hs(fs(t)), F.method("join", "=")).join("&");
|
|
3662
3673
|
return s;
|
|
3663
3674
|
}
|
|
3664
3675
|
function gs(r) {
|
|
3665
3676
|
var t = [], s = [];
|
|
3666
3677
|
return (function a(c, p) {
|
|
3667
|
-
var S, k,
|
|
3678
|
+
var S, k, q;
|
|
3668
3679
|
switch (typeof c) {
|
|
3669
3680
|
case "object":
|
|
3670
3681
|
if (!c)
|
|
@@ -3673,14 +3684,14 @@ function Qo() {
|
|
|
3673
3684
|
if (t[S] === c)
|
|
3674
3685
|
return { $ref: s[S] };
|
|
3675
3686
|
if (t.push(c), s.push(p), Object.prototype.toString.apply(c) === "[object Array]")
|
|
3676
|
-
for (
|
|
3677
|
-
|
|
3687
|
+
for (q = [], S = 0; S < c.length; S += 1)
|
|
3688
|
+
q[S] = a(c[S], p + "[" + S + "]");
|
|
3678
3689
|
else {
|
|
3679
|
-
|
|
3690
|
+
q = {};
|
|
3680
3691
|
for (k in c)
|
|
3681
|
-
Object.prototype.hasOwnProperty.call(c, k) && (
|
|
3692
|
+
Object.prototype.hasOwnProperty.call(c, k) && (q[k] = a(c[k], p + "[" + JSON.stringify(k) + "]"));
|
|
3682
3693
|
}
|
|
3683
|
-
return
|
|
3694
|
+
return q;
|
|
3684
3695
|
case "number":
|
|
3685
3696
|
case "string":
|
|
3686
3697
|
case "boolean":
|
|
@@ -3688,7 +3699,7 @@ function Qo() {
|
|
|
3688
3699
|
}
|
|
3689
3700
|
})(r, "$");
|
|
3690
3701
|
}
|
|
3691
|
-
function
|
|
3702
|
+
function Ve(r) {
|
|
3692
3703
|
try {
|
|
3693
3704
|
return JSON.stringify(r);
|
|
3694
3705
|
} catch {
|
|
@@ -3717,7 +3728,7 @@ function Qo() {
|
|
|
3717
3728
|
window.console && window.console.error ? window.console.error(t) : this.globalLogWarn(t);
|
|
3718
3729
|
}
|
|
3719
3730
|
log(t, ...s) {
|
|
3720
|
-
var a =
|
|
3731
|
+
var a = ve.apply(this, arguments);
|
|
3721
3732
|
vt.log ? vt.log(a) : vt.logToConsole && t.bind(this)(a);
|
|
3722
3733
|
}
|
|
3723
3734
|
}
|
|
@@ -3729,8 +3740,8 @@ function Qo() {
|
|
|
3729
3740
|
r.auth_callbacks[p] = function(ee) {
|
|
3730
3741
|
c(null, ee);
|
|
3731
3742
|
};
|
|
3732
|
-
var
|
|
3733
|
-
k.src = s.endpoint + "?callback=" + encodeURIComponent(
|
|
3743
|
+
var q = "Pusher.auth_callbacks['" + p + "']";
|
|
3744
|
+
k.src = s.endpoint + "?callback=" + encodeURIComponent(q) + "&" + t;
|
|
3734
3745
|
var Y = S.getElementsByTagName("head")[0] || S.documentElement;
|
|
3735
3746
|
Y.insertBefore(k, Y.firstChild);
|
|
3736
3747
|
}, bs = vs;
|
|
@@ -3770,8 +3781,8 @@ function Qo() {
|
|
|
3770
3781
|
}
|
|
3771
3782
|
var Ss = function(r, t) {
|
|
3772
3783
|
return function(s, a) {
|
|
3773
|
-
var c = "http" + (t ? "s" : "") + "://", p = c + (r.host || r.options.host) + r.options.path, S = z.createJSONPRequest(p, s), k = z.ScriptReceivers.create(function(
|
|
3774
|
-
h.remove(k), S.cleanup(), Y && Y.host && (r.host = Y.host), a && a(
|
|
3784
|
+
var c = "http" + (t ? "s" : "") + "://", p = c + (r.host || r.options.host) + r.options.path, S = z.createJSONPRequest(p, s), k = z.ScriptReceivers.create(function(q, Y) {
|
|
3785
|
+
h.remove(k), S.cleanup(), Y && Y.host && (r.host = Y.host), a && a(q, Y);
|
|
3775
3786
|
});
|
|
3776
3787
|
S.send(k);
|
|
3777
3788
|
};
|
|
@@ -3824,7 +3835,7 @@ function Qo() {
|
|
|
3824
3835
|
this._callbacks = {};
|
|
3825
3836
|
return;
|
|
3826
3837
|
}
|
|
3827
|
-
var c = t ? [ut(t)] :
|
|
3838
|
+
var c = t ? [ut(t)] : Be(this._callbacks);
|
|
3828
3839
|
s || a ? this.removeCallback(c, s, a) : this.removeAllCallbacks(c);
|
|
3829
3840
|
}
|
|
3830
3841
|
removeCallback(t, s, a) {
|
|
@@ -3843,7 +3854,7 @@ function Qo() {
|
|
|
3843
3854
|
function ut(r) {
|
|
3844
3855
|
return "_" + r;
|
|
3845
3856
|
}
|
|
3846
|
-
class
|
|
3857
|
+
class ye {
|
|
3847
3858
|
constructor(t) {
|
|
3848
3859
|
this.callbacks = new As(), this.global_callbacks = [], this.failThrough = t;
|
|
3849
3860
|
}
|
|
@@ -3873,7 +3884,7 @@ function Qo() {
|
|
|
3873
3884
|
return this;
|
|
3874
3885
|
}
|
|
3875
3886
|
}
|
|
3876
|
-
class Ps extends
|
|
3887
|
+
class Ps extends ye {
|
|
3877
3888
|
constructor(t, s, a, c, p) {
|
|
3878
3889
|
super(), this.initialize = z.transportConnectionInitializer, this.hooks = t, this.name = s, this.priority = a, this.key = c, this.options = p, this.state = "new", this.timeline = p.timeline, this.activityTimeout = p.activityTimeout, this.id = this.timeline.generateUniqueID();
|
|
3879
3890
|
}
|
|
@@ -3890,7 +3901,7 @@ function Qo() {
|
|
|
3890
3901
|
try {
|
|
3891
3902
|
this.socket = this.hooks.getSocket(t, this.options);
|
|
3892
3903
|
} catch (s) {
|
|
3893
|
-
return
|
|
3904
|
+
return F.defer(() => {
|
|
3894
3905
|
this.onError(s), this.changeState("closed");
|
|
3895
3906
|
}), !1;
|
|
3896
3907
|
}
|
|
@@ -3900,7 +3911,7 @@ function Qo() {
|
|
|
3900
3911
|
return this.socket ? (this.socket.close(), !0) : !1;
|
|
3901
3912
|
}
|
|
3902
3913
|
send(t) {
|
|
3903
|
-
return this.state === "open" ? (
|
|
3914
|
+
return this.state === "open" ? (F.defer(() => {
|
|
3904
3915
|
this.socket && this.socket.send(t);
|
|
3905
3916
|
}), !0) : !1;
|
|
3906
3917
|
}
|
|
@@ -3952,7 +3963,7 @@ function Qo() {
|
|
|
3952
3963
|
return X({ cid: this.id }, t);
|
|
3953
3964
|
}
|
|
3954
3965
|
}
|
|
3955
|
-
class
|
|
3966
|
+
class ke {
|
|
3956
3967
|
constructor(t) {
|
|
3957
3968
|
this.hooks = t;
|
|
3958
3969
|
}
|
|
@@ -3963,7 +3974,7 @@ function Qo() {
|
|
|
3963
3974
|
return new Ps(this.hooks, t, s, a, c);
|
|
3964
3975
|
}
|
|
3965
3976
|
}
|
|
3966
|
-
var xs = new
|
|
3977
|
+
var xs = new ke({
|
|
3967
3978
|
urls: Ts,
|
|
3968
3979
|
handlesActivityChecks: !1,
|
|
3969
3980
|
supportsPing: !1,
|
|
@@ -3995,11 +4006,11 @@ function Qo() {
|
|
|
3995
4006
|
isSupported: function() {
|
|
3996
4007
|
return z.isXHRSupported();
|
|
3997
4008
|
}
|
|
3998
|
-
}, Ms = new
|
|
4009
|
+
}, Ms = new ke(X({}, Gt, Kt)), ks = new ke(X({}, Jt, Kt)), Is = {
|
|
3999
4010
|
ws: xs,
|
|
4000
4011
|
xhr_streaming: Ms,
|
|
4001
4012
|
xhr_polling: ks
|
|
4002
|
-
},
|
|
4013
|
+
}, Xe = Is, Ls = new ke({
|
|
4003
4014
|
file: "sockjs",
|
|
4004
4015
|
urls: Rs,
|
|
4005
4016
|
handlesActivityChecks: !0,
|
|
@@ -4012,7 +4023,7 @@ function Qo() {
|
|
|
4012
4023
|
},
|
|
4013
4024
|
getSocket: function(r, t) {
|
|
4014
4025
|
return new window.SockJS(r, null, {
|
|
4015
|
-
js_path:
|
|
4026
|
+
js_path: m.getPath("sockjs", {
|
|
4016
4027
|
useTLS: t.useTLS
|
|
4017
4028
|
}),
|
|
4018
4029
|
ignore_null_origin: t.ignoreNullOrigin
|
|
@@ -4028,10 +4039,10 @@ function Qo() {
|
|
|
4028
4039
|
var t = z.isXDRSupported(r.useTLS);
|
|
4029
4040
|
return t;
|
|
4030
4041
|
}
|
|
4031
|
-
}, Us = new
|
|
4032
|
-
|
|
4033
|
-
var Ns =
|
|
4034
|
-
class Fs extends
|
|
4042
|
+
}, Us = new ke(X({}, Gt, Yt)), Os = new ke(X({}, Jt, Yt));
|
|
4043
|
+
Xe.xdr_streaming = Us, Xe.xdr_polling = Os, Xe.sockjs = Ls;
|
|
4044
|
+
var Ns = Xe;
|
|
4045
|
+
class Fs extends ye {
|
|
4035
4046
|
constructor() {
|
|
4036
4047
|
super();
|
|
4037
4048
|
var t = this;
|
|
@@ -4055,12 +4066,12 @@ function Qo() {
|
|
|
4055
4066
|
activityTimeout: this.pingDelay
|
|
4056
4067
|
});
|
|
4057
4068
|
var p = this.transport.createConnection(t, s, a, c), S = null, k = function() {
|
|
4058
|
-
p.unbind("open", k), p.bind("closed",
|
|
4059
|
-
},
|
|
4060
|
-
if (p.unbind("closed",
|
|
4069
|
+
p.unbind("open", k), p.bind("closed", q), S = F.now();
|
|
4070
|
+
}, q = (Y) => {
|
|
4071
|
+
if (p.unbind("closed", q), Y.code === 1002 || Y.code === 1003)
|
|
4061
4072
|
this.manager.reportDeath();
|
|
4062
4073
|
else if (!Y.wasClean && S) {
|
|
4063
|
-
var ee =
|
|
4074
|
+
var ee = F.now() - S;
|
|
4064
4075
|
ee < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(ee / 2, this.minPingDelay));
|
|
4065
4076
|
}
|
|
4066
4077
|
};
|
|
@@ -4124,8 +4135,8 @@ function Qo() {
|
|
|
4124
4135
|
} : null;
|
|
4125
4136
|
}
|
|
4126
4137
|
};
|
|
4127
|
-
var
|
|
4128
|
-
class zs extends
|
|
4138
|
+
var Te = Qt;
|
|
4139
|
+
class zs extends ye {
|
|
4129
4140
|
constructor(t, s) {
|
|
4130
4141
|
super(), this.id = t, this.transport = s, this.activityTimeout = s.activityTimeout, this.bindListeners();
|
|
4131
4142
|
}
|
|
@@ -4137,7 +4148,7 @@ function Qo() {
|
|
|
4137
4148
|
}
|
|
4138
4149
|
send_event(t, s, a) {
|
|
4139
4150
|
var c = { event: t, data: s };
|
|
4140
|
-
return a && (c.channel = a), ne.debug("Event sent", c), this.send(
|
|
4151
|
+
return a && (c.channel = a), ne.debug("Event sent", c), this.send(Te.encodeMessage(c));
|
|
4141
4152
|
}
|
|
4142
4153
|
ping() {
|
|
4143
4154
|
this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
|
|
@@ -4150,7 +4161,7 @@ function Qo() {
|
|
|
4150
4161
|
message: (a) => {
|
|
4151
4162
|
var c;
|
|
4152
4163
|
try {
|
|
4153
|
-
c =
|
|
4164
|
+
c = Te.decodeMessage(a);
|
|
4154
4165
|
} catch (p) {
|
|
4155
4166
|
this.emit("error", {
|
|
4156
4167
|
type: "MessageParseError",
|
|
@@ -4195,7 +4206,7 @@ function Qo() {
|
|
|
4195
4206
|
});
|
|
4196
4207
|
}
|
|
4197
4208
|
handleCloseEvent(t) {
|
|
4198
|
-
var s =
|
|
4209
|
+
var s = Te.getCloseAction(t), a = Te.getCloseError(t);
|
|
4199
4210
|
a && this.emit("error", a), s && this.emit(s, { action: s, error: a });
|
|
4200
4211
|
}
|
|
4201
4212
|
}
|
|
@@ -4211,7 +4222,7 @@ function Qo() {
|
|
|
4211
4222
|
this.unbindListeners();
|
|
4212
4223
|
var s;
|
|
4213
4224
|
try {
|
|
4214
|
-
s =
|
|
4225
|
+
s = Te.processHandshake(t);
|
|
4215
4226
|
} catch (a) {
|
|
4216
4227
|
this.finish("error", { error: a }), this.transport.close();
|
|
4217
4228
|
return;
|
|
@@ -4222,7 +4233,7 @@ function Qo() {
|
|
|
4222
4233
|
}) : (this.finish(s.action, { error: s.error }), this.transport.close());
|
|
4223
4234
|
}, this.onClosed = (t) => {
|
|
4224
4235
|
this.unbindListeners();
|
|
4225
|
-
var s =
|
|
4236
|
+
var s = Te.getCloseAction(t) || "backoff", a = Te.getCloseError(t);
|
|
4226
4237
|
this.finish(s, { error: a });
|
|
4227
4238
|
}, this.transport.bind("message", this.onMessage), this.transport.bind("closed", this.onClosed);
|
|
4228
4239
|
}
|
|
@@ -4241,7 +4252,7 @@ function Qo() {
|
|
|
4241
4252
|
this.timeline.isEmpty() || this.timeline.send(z.TimelineTransport.getAgent(this, t), s);
|
|
4242
4253
|
}
|
|
4243
4254
|
}
|
|
4244
|
-
class lt extends
|
|
4255
|
+
class lt extends ye {
|
|
4245
4256
|
constructor(t, s) {
|
|
4246
4257
|
super(function(a, c) {
|
|
4247
4258
|
ne.debug("No callbacks on " + t + " for " + a);
|
|
@@ -4357,7 +4368,7 @@ function Qo() {
|
|
|
4357
4368
|
S(oe);
|
|
4358
4369
|
}
|
|
4359
4370
|
}
|
|
4360
|
-
function
|
|
4371
|
+
function q(ee) {
|
|
4361
4372
|
try {
|
|
4362
4373
|
Y(a.throw(ee));
|
|
4363
4374
|
} catch (oe) {
|
|
@@ -4365,7 +4376,7 @@ function Qo() {
|
|
|
4365
4376
|
}
|
|
4366
4377
|
}
|
|
4367
4378
|
function Y(ee) {
|
|
4368
|
-
ee.done ? p(ee.value) : c(ee.value).then(k,
|
|
4379
|
+
ee.done ? p(ee.value) : c(ee.value).then(k, q);
|
|
4369
4380
|
}
|
|
4370
4381
|
Y((a = a.apply(r, t || [])).next());
|
|
4371
4382
|
});
|
|
@@ -4500,7 +4511,7 @@ function Qo() {
|
|
|
4500
4511
|
}
|
|
4501
4512
|
}
|
|
4502
4513
|
}
|
|
4503
|
-
class Gs extends
|
|
4514
|
+
class Gs extends ye {
|
|
4504
4515
|
constructor(t, s) {
|
|
4505
4516
|
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);
|
|
4506
4517
|
var a = z.getNetwork();
|
|
@@ -4682,17 +4693,17 @@ function Qo() {
|
|
|
4682
4693
|
function Ks(r, t) {
|
|
4683
4694
|
if (r.indexOf("private-encrypted-") === 0) {
|
|
4684
4695
|
if (t.config.nacl)
|
|
4685
|
-
return
|
|
4696
|
+
return _e.createEncryptedChannel(r, t, t.config.nacl);
|
|
4686
4697
|
let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a = E.buildLogSuffix("encryptedChannelSupport");
|
|
4687
4698
|
throw new B(`${s}. ${a}`);
|
|
4688
4699
|
} else {
|
|
4689
4700
|
if (r.indexOf("private-") === 0)
|
|
4690
|
-
return
|
|
4701
|
+
return _e.createPrivateChannel(r, t);
|
|
4691
4702
|
if (r.indexOf("presence-") === 0)
|
|
4692
|
-
return
|
|
4703
|
+
return _e.createPresenceChannel(r, t);
|
|
4693
4704
|
if (r.indexOf("#") === 0)
|
|
4694
|
-
throw new
|
|
4695
|
-
return
|
|
4705
|
+
throw new v('Cannot create a channel with name "' + r + '".');
|
|
4706
|
+
return _e.createChannel(r, t);
|
|
4696
4707
|
}
|
|
4697
4708
|
}
|
|
4698
4709
|
var Ys = {
|
|
@@ -4723,13 +4734,13 @@ function Qo() {
|
|
|
4723
4734
|
createAssistantToTheTransportManager(r, t, s) {
|
|
4724
4735
|
return new qs(r, t, s);
|
|
4725
4736
|
}
|
|
4726
|
-
},
|
|
4737
|
+
}, _e = Ys;
|
|
4727
4738
|
class Zt {
|
|
4728
4739
|
constructor(t) {
|
|
4729
4740
|
this.options = t || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
4730
4741
|
}
|
|
4731
4742
|
getAssistant(t) {
|
|
4732
|
-
return
|
|
4743
|
+
return _e.createAssistantToTheTransportManager(this, t, {
|
|
4733
4744
|
minPingDelay: this.options.minPingDelay,
|
|
4734
4745
|
maxPingDelay: this.options.maxPingDelay
|
|
4735
4746
|
});
|
|
@@ -4741,23 +4752,23 @@ function Qo() {
|
|
|
4741
4752
|
this.livesLeft -= 1;
|
|
4742
4753
|
}
|
|
4743
4754
|
}
|
|
4744
|
-
class
|
|
4755
|
+
class Ee {
|
|
4745
4756
|
constructor(t, s) {
|
|
4746
4757
|
this.strategies = t, this.loop = !!s.loop, this.failFast = !!s.failFast, this.timeout = s.timeout, this.timeoutLimit = s.timeoutLimit;
|
|
4747
4758
|
}
|
|
4748
4759
|
isSupported() {
|
|
4749
|
-
return Xt(this.strategies,
|
|
4760
|
+
return Xt(this.strategies, F.method("isSupported"));
|
|
4750
4761
|
}
|
|
4751
4762
|
connect(t, s) {
|
|
4752
|
-
var a = this.strategies, c = 0, p = this.timeout, S = null, k = (
|
|
4763
|
+
var a = this.strategies, c = 0, p = this.timeout, S = null, k = (q, Y) => {
|
|
4753
4764
|
Y ? s(null, Y) : (c = c + 1, this.loop && (c = c % a.length), c < a.length ? (p && (p = p * 2, this.timeoutLimit && (p = Math.min(p, this.timeoutLimit))), S = this.tryStrategy(a[c], t, { timeout: p, failFast: this.failFast }, k)) : s(!0));
|
|
4754
4765
|
};
|
|
4755
4766
|
return S = this.tryStrategy(a[c], t, { timeout: p, failFast: this.failFast }, k), {
|
|
4756
4767
|
abort: function() {
|
|
4757
4768
|
S.abort();
|
|
4758
4769
|
},
|
|
4759
|
-
forceMinPriority: function(
|
|
4760
|
-
t =
|
|
4770
|
+
forceMinPriority: function(q) {
|
|
4771
|
+
t = q, S && S.forceMinPriority(q);
|
|
4761
4772
|
}
|
|
4762
4773
|
};
|
|
4763
4774
|
}
|
|
@@ -4765,8 +4776,8 @@ function Qo() {
|
|
|
4765
4776
|
var p = null, S = null;
|
|
4766
4777
|
return a.timeout > 0 && (p = new T(a.timeout, function() {
|
|
4767
4778
|
S.abort(), c(!0);
|
|
4768
|
-
})), S = t.connect(s, function(k,
|
|
4769
|
-
k && p && p.isRunning() && !a.failFast || (p && p.ensureAborted(), c(k,
|
|
4779
|
+
})), S = t.connect(s, function(k, q) {
|
|
4780
|
+
k && p && p.isRunning() && !a.failFast || (p && p.ensureAborted(), c(k, q));
|
|
4770
4781
|
}), {
|
|
4771
4782
|
abort: function() {
|
|
4772
4783
|
p && p.ensureAborted(), S.abort();
|
|
@@ -4782,7 +4793,7 @@ function Qo() {
|
|
|
4782
4793
|
this.strategies = t;
|
|
4783
4794
|
}
|
|
4784
4795
|
isSupported() {
|
|
4785
|
-
return Xt(this.strategies,
|
|
4796
|
+
return Xt(this.strategies, F.method("isSupported"));
|
|
4786
4797
|
}
|
|
4787
4798
|
connect(t, s) {
|
|
4788
4799
|
return Qs(this.strategies, t, function(a, c) {
|
|
@@ -4830,19 +4841,19 @@ function Qo() {
|
|
|
4830
4841
|
}
|
|
4831
4842
|
connect(t, s) {
|
|
4832
4843
|
var a = this.usingTLS, c = nr(a), p = c && c.cacheSkipCount ? c.cacheSkipCount : 0, S = [this.strategy];
|
|
4833
|
-
if (c && c.timestamp + this.ttl >=
|
|
4844
|
+
if (c && c.timestamp + this.ttl >= F.now()) {
|
|
4834
4845
|
var k = this.transports[c.transport];
|
|
4835
4846
|
k && (["ws", "wss"].includes(c.transport) || p > 3 ? (this.timeline.info({
|
|
4836
4847
|
cached: !0,
|
|
4837
4848
|
transport: c.transport,
|
|
4838
4849
|
latency: c.latency
|
|
4839
|
-
}), S.push(new
|
|
4850
|
+
}), S.push(new Ee([k], {
|
|
4840
4851
|
timeout: c.latency * 2 + 1e3,
|
|
4841
4852
|
failFast: !0
|
|
4842
4853
|
}))) : p++);
|
|
4843
4854
|
}
|
|
4844
|
-
var
|
|
4845
|
-
oe ? (en(a), S.length > 0 ? (
|
|
4855
|
+
var q = F.now(), Y = S.pop().connect(t, function ee(oe, Je) {
|
|
4856
|
+
oe ? (en(a), S.length > 0 ? (q = F.now(), Y = S.pop().connect(t, ee)) : s(oe)) : (sr(a, Je.transport.name, F.now() - q, p), s(null, Je));
|
|
4846
4857
|
});
|
|
4847
4858
|
return {
|
|
4848
4859
|
abort: function() {
|
|
@@ -4873,8 +4884,8 @@ function Qo() {
|
|
|
4873
4884
|
var c = z.getLocalStorage();
|
|
4874
4885
|
if (c)
|
|
4875
4886
|
try {
|
|
4876
|
-
c[pt(r)] =
|
|
4877
|
-
timestamp:
|
|
4887
|
+
c[pt(r)] = Ve({
|
|
4888
|
+
timestamp: F.now(),
|
|
4878
4889
|
transport: t,
|
|
4879
4890
|
latency: s,
|
|
4880
4891
|
cacheSkipCount: a
|
|
@@ -4890,7 +4901,7 @@ function Qo() {
|
|
|
4890
4901
|
} catch {
|
|
4891
4902
|
}
|
|
4892
4903
|
}
|
|
4893
|
-
class
|
|
4904
|
+
class We {
|
|
4894
4905
|
constructor(t, { delay: s }) {
|
|
4895
4906
|
this.strategy = t, this.options = { delay: s };
|
|
4896
4907
|
}
|
|
@@ -4911,7 +4922,7 @@ function Qo() {
|
|
|
4911
4922
|
};
|
|
4912
4923
|
}
|
|
4913
4924
|
}
|
|
4914
|
-
class
|
|
4925
|
+
class Ie {
|
|
4915
4926
|
constructor(t, s, a) {
|
|
4916
4927
|
this.test = t, this.trueBranch = s, this.falseBranch = a;
|
|
4917
4928
|
}
|
|
@@ -4938,7 +4949,7 @@ function Qo() {
|
|
|
4938
4949
|
return a;
|
|
4939
4950
|
}
|
|
4940
4951
|
}
|
|
4941
|
-
function
|
|
4952
|
+
function Le(r) {
|
|
4942
4953
|
return function() {
|
|
4943
4954
|
return r.isSupported();
|
|
4944
4955
|
};
|
|
@@ -4959,7 +4970,7 @@ function Qo() {
|
|
|
4959
4970
|
hostNonTLS: r.httpHost + ":" + r.httpPort,
|
|
4960
4971
|
hostTLS: r.httpHost + ":" + r.httpsPort,
|
|
4961
4972
|
httpPath: r.httpPath
|
|
4962
|
-
}),
|
|
4973
|
+
}), q = {
|
|
4963
4974
|
loop: !0,
|
|
4964
4975
|
timeout: 15e3,
|
|
4965
4976
|
timeoutLimit: 6e4
|
|
@@ -4970,24 +4981,24 @@ function Qo() {
|
|
|
4970
4981
|
lives: 2,
|
|
4971
4982
|
minPingDelay: 1e4,
|
|
4972
4983
|
maxPingDelay: r.activityTimeout
|
|
4973
|
-
}), oe = c("ws", "ws", 3, p, Y),
|
|
4974
|
-
new
|
|
4975
|
-
],
|
|
4976
|
-
new
|
|
4977
|
-
],
|
|
4978
|
-
new
|
|
4984
|
+
}), oe = c("ws", "ws", 3, p, Y), Je = c("wss", "ws", 3, S, Y), Zr = c("sockjs", "sockjs", 1, k), on = c("xhr_streaming", "xhr_streaming", 1, k, ee), ei = c("xdr_streaming", "xdr_streaming", 1, k, ee), an = c("xhr_polling", "xhr_polling", 1, k), ti = c("xdr_polling", "xdr_polling", 1, k), cn = new Ee([oe], q), ni = new Ee([Je], q), si = new Ee([Zr], q), un = new Ee([
|
|
4985
|
+
new Ie(Le(on), on, ei)
|
|
4986
|
+
], q), ln = new Ee([
|
|
4987
|
+
new Ie(Le(an), an, ti)
|
|
4988
|
+
], q), hn = new Ee([
|
|
4989
|
+
new Ie(Le(un), new ft([
|
|
4979
4990
|
un,
|
|
4980
|
-
new
|
|
4991
|
+
new We(ln, { delay: 4e3 })
|
|
4981
4992
|
]), ln)
|
|
4982
|
-
],
|
|
4993
|
+
], q), bt = new Ie(Le(hn), hn, si), yt;
|
|
4983
4994
|
return t.useTLS ? yt = new ft([
|
|
4984
4995
|
cn,
|
|
4985
|
-
new
|
|
4996
|
+
new We(bt, { delay: 2e3 })
|
|
4986
4997
|
]) : yt = new ft([
|
|
4987
4998
|
cn,
|
|
4988
|
-
new
|
|
4989
|
-
new
|
|
4990
|
-
]), new tr(new rr(new
|
|
4999
|
+
new We(ni, { delay: 2e3 }),
|
|
5000
|
+
new We(bt, { delay: 5e3 })
|
|
5001
|
+
]), new tr(new rr(new Ie(Le(oe), yt, bt)), a, {
|
|
4991
5002
|
ttl: 18e5,
|
|
4992
5003
|
timeline: t.timeline,
|
|
4993
5004
|
useTLS: t.useTLS
|
|
@@ -4996,14 +5007,14 @@ function Qo() {
|
|
|
4996
5007
|
var r = this;
|
|
4997
5008
|
r.timeline.info(r.buildTimelineMessage({
|
|
4998
5009
|
transport: r.name + (r.options.useTLS ? "s" : "")
|
|
4999
|
-
})), r.hooks.isInitialized() ? r.changeState("initialized") : r.hooks.file ? (r.changeState("initializing"),
|
|
5010
|
+
})), r.hooks.isInitialized() ? r.changeState("initialized") : r.hooks.file ? (r.changeState("initializing"), m.load(r.hooks.file, { useTLS: r.options.useTLS }, function(t, s) {
|
|
5000
5011
|
r.hooks.isInitialized() ? (r.changeState("initialized"), s(!0)) : (t && r.onError(t), r.onClose(), s(!1));
|
|
5001
5012
|
})) : r.onClose();
|
|
5002
5013
|
}), cr = {
|
|
5003
5014
|
getRequest: function(r) {
|
|
5004
5015
|
var t = new window.XDomainRequest();
|
|
5005
5016
|
return t.ontimeout = function() {
|
|
5006
|
-
r.emit("error", new
|
|
5017
|
+
r.emit("error", new b()), r.close();
|
|
5007
5018
|
}, t.onerror = function(s) {
|
|
5008
5019
|
r.emit("error", s), r.close();
|
|
5009
5020
|
}, t.onprogress = function() {
|
|
@@ -5017,7 +5028,7 @@ function Qo() {
|
|
|
5017
5028
|
}
|
|
5018
5029
|
}, ur = cr;
|
|
5019
5030
|
const lr = 256 * 1024;
|
|
5020
|
-
class hr extends
|
|
5031
|
+
class hr extends ye {
|
|
5021
5032
|
constructor(t, s, a) {
|
|
5022
5033
|
super(), this.hooks = t, this.method = s, this.url = a;
|
|
5023
5034
|
}
|
|
@@ -5052,10 +5063,10 @@ function Qo() {
|
|
|
5052
5063
|
(function(r) {
|
|
5053
5064
|
r[r.CONNECTING = 0] = "CONNECTING", r[r.OPEN = 1] = "OPEN", r[r.CLOSED = 3] = "CLOSED";
|
|
5054
5065
|
})(gt || (gt = {}));
|
|
5055
|
-
var
|
|
5066
|
+
var Re = gt, dr = 1;
|
|
5056
5067
|
class fr {
|
|
5057
5068
|
constructor(t, s) {
|
|
5058
|
-
this.hooks = t, this.session = nn(1e3) + "/" + vr(8), this.location = pr(s), this.readyState =
|
|
5069
|
+
this.hooks = t, this.session = nn(1e3) + "/" + vr(8), this.location = pr(s), this.readyState = Re.CONNECTING, this.openStream();
|
|
5059
5070
|
}
|
|
5060
5071
|
send(t) {
|
|
5061
5072
|
return this.sendRaw(JSON.stringify([t]));
|
|
@@ -5067,7 +5078,7 @@ function Qo() {
|
|
|
5067
5078
|
this.onClose(t, s, !0);
|
|
5068
5079
|
}
|
|
5069
5080
|
sendRaw(t) {
|
|
5070
|
-
if (this.readyState ===
|
|
5081
|
+
if (this.readyState === Re.OPEN)
|
|
5071
5082
|
try {
|
|
5072
5083
|
return z.createSocketRequest("POST", tn(gr(this.location, this.session))).start(t), !0;
|
|
5073
5084
|
} catch {
|
|
@@ -5080,7 +5091,7 @@ function Qo() {
|
|
|
5080
5091
|
this.closeStream(), this.openStream();
|
|
5081
5092
|
}
|
|
5082
5093
|
onClose(t, s, a) {
|
|
5083
|
-
this.closeStream(), this.readyState =
|
|
5094
|
+
this.closeStream(), this.readyState = Re.CLOSED, this.onclose && this.onclose({
|
|
5084
5095
|
code: t,
|
|
5085
5096
|
reason: s,
|
|
5086
5097
|
wasClean: a
|
|
@@ -5088,7 +5099,7 @@ function Qo() {
|
|
|
5088
5099
|
}
|
|
5089
5100
|
onChunk(t) {
|
|
5090
5101
|
if (t.status === 200) {
|
|
5091
|
-
this.readyState ===
|
|
5102
|
+
this.readyState === Re.OPEN && this.onActivity();
|
|
5092
5103
|
var s, a = t.data.slice(0, 1);
|
|
5093
5104
|
switch (a) {
|
|
5094
5105
|
case "o":
|
|
@@ -5112,10 +5123,10 @@ function Qo() {
|
|
|
5112
5123
|
}
|
|
5113
5124
|
}
|
|
5114
5125
|
onOpen(t) {
|
|
5115
|
-
this.readyState ===
|
|
5126
|
+
this.readyState === Re.CONNECTING ? (t && t.hostname && (this.location.base = mr(this.location.base, t.hostname)), this.readyState = Re.OPEN, this.onopen && this.onopen()) : this.onClose(1006, "Server lost session", !0);
|
|
5116
5127
|
}
|
|
5117
5128
|
onEvent(t) {
|
|
5118
|
-
this.readyState ===
|
|
5129
|
+
this.readyState === Re.OPEN && this.onmessage && this.onmessage({ data: t });
|
|
5119
5130
|
}
|
|
5120
5131
|
onActivity() {
|
|
5121
5132
|
this.onactivity && this.onactivity();
|
|
@@ -5134,7 +5145,7 @@ function Qo() {
|
|
|
5134
5145
|
try {
|
|
5135
5146
|
this.stream.start();
|
|
5136
5147
|
} catch (t) {
|
|
5137
|
-
|
|
5148
|
+
F.defer(() => {
|
|
5138
5149
|
this.onError(t), this.onClose(1006, "Could not start streaming", !1);
|
|
5139
5150
|
});
|
|
5140
5151
|
}
|
|
@@ -5252,7 +5263,7 @@ function Qo() {
|
|
|
5252
5263
|
var t = () => {
|
|
5253
5264
|
this.onDocumentBody(r.ready);
|
|
5254
5265
|
};
|
|
5255
|
-
window.JSON ? t() :
|
|
5266
|
+
window.JSON ? t() : m.load("json2", {}, t);
|
|
5256
5267
|
},
|
|
5257
5268
|
getDocument() {
|
|
5258
5269
|
return document;
|
|
@@ -5328,22 +5339,22 @@ function Qo() {
|
|
|
5328
5339
|
(function(r) {
|
|
5329
5340
|
r[r.ERROR = 3] = "ERROR", r[r.INFO = 6] = "INFO", r[r.DEBUG = 7] = "DEBUG";
|
|
5330
5341
|
})(mt || (mt = {}));
|
|
5331
|
-
var
|
|
5342
|
+
var Ge = mt;
|
|
5332
5343
|
class Pr {
|
|
5333
5344
|
constructor(t, s, a) {
|
|
5334
5345
|
this.key = t, this.session = s, this.events = [], this.options = a || {}, this.sent = 0, this.uniqueID = 0;
|
|
5335
5346
|
}
|
|
5336
5347
|
log(t, s) {
|
|
5337
|
-
t <= this.options.level && (this.events.push(X({}, s, { timestamp:
|
|
5348
|
+
t <= this.options.level && (this.events.push(X({}, s, { timestamp: F.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
|
|
5338
5349
|
}
|
|
5339
5350
|
error(t) {
|
|
5340
|
-
this.log(
|
|
5351
|
+
this.log(Ge.ERROR, t);
|
|
5341
5352
|
}
|
|
5342
5353
|
info(t) {
|
|
5343
|
-
this.log(
|
|
5354
|
+
this.log(Ge.INFO, t);
|
|
5344
5355
|
}
|
|
5345
5356
|
debug(t) {
|
|
5346
|
-
this.log(
|
|
5357
|
+
this.log(Ge.DEBUG, t);
|
|
5347
5358
|
}
|
|
5348
5359
|
isEmpty() {
|
|
5349
5360
|
return this.events.length === 0;
|
|
@@ -5379,24 +5390,24 @@ function Qo() {
|
|
|
5379
5390
|
connect(t, s) {
|
|
5380
5391
|
if (this.isSupported()) {
|
|
5381
5392
|
if (this.priority < t)
|
|
5382
|
-
return rn(new
|
|
5383
|
-
} else return rn(new
|
|
5393
|
+
return rn(new D(), s);
|
|
5394
|
+
} else return rn(new U(), s);
|
|
5384
5395
|
var a = !1, c = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), p = null, S = function() {
|
|
5385
5396
|
c.unbind("initialized", S), c.connect();
|
|
5386
5397
|
}, k = function() {
|
|
5387
|
-
p =
|
|
5398
|
+
p = _e.createHandshake(c, function(oe) {
|
|
5388
5399
|
a = !0, ee(), s(null, oe);
|
|
5389
5400
|
});
|
|
5390
|
-
},
|
|
5401
|
+
}, q = function(oe) {
|
|
5391
5402
|
ee(), s(oe);
|
|
5392
5403
|
}, Y = function() {
|
|
5393
5404
|
ee();
|
|
5394
5405
|
var oe;
|
|
5395
|
-
oe =
|
|
5406
|
+
oe = Ve(c), s(new H(oe));
|
|
5396
5407
|
}, ee = function() {
|
|
5397
|
-
c.unbind("initialized", S), c.unbind("open", k), c.unbind("error",
|
|
5408
|
+
c.unbind("initialized", S), c.unbind("open", k), c.unbind("error", q), c.unbind("closed", Y);
|
|
5398
5409
|
};
|
|
5399
|
-
return c.bind("initialized", S), c.bind("open", k), c.bind("error",
|
|
5410
|
+
return c.bind("initialized", S), c.bind("open", k), c.bind("error", q), c.bind("closed", Y), c.initialize(), {
|
|
5400
5411
|
abort: () => {
|
|
5401
5412
|
a || (ee(), p ? p.close() : c.close());
|
|
5402
5413
|
},
|
|
@@ -5407,7 +5418,7 @@ function Qo() {
|
|
|
5407
5418
|
}
|
|
5408
5419
|
}
|
|
5409
5420
|
function rn(r, t) {
|
|
5410
|
-
return
|
|
5421
|
+
return F.defer(function() {
|
|
5411
5422
|
t(r);
|
|
5412
5423
|
}), {
|
|
5413
5424
|
abort: function() {
|
|
@@ -5421,15 +5432,15 @@ function Qo() {
|
|
|
5421
5432
|
var S = Mr[s];
|
|
5422
5433
|
if (!S)
|
|
5423
5434
|
throw new P(s);
|
|
5424
|
-
var k = (!r.enabledTransports ||
|
|
5425
|
-
return k ? (c = Object.assign({ ignoreNullOrigin: r.ignoreNullOrigin }, c),
|
|
5435
|
+
var k = (!r.enabledTransports || be(r.enabledTransports, t) !== -1) && (!r.disabledTransports || be(r.disabledTransports, t) === -1), q;
|
|
5436
|
+
return k ? (c = Object.assign({ ignoreNullOrigin: r.ignoreNullOrigin }, c), q = new xr(t, a, p ? p.getAssistant(S) : S, c)) : q = Ir, q;
|
|
5426
5437
|
}, Ir = {
|
|
5427
5438
|
isSupported: function() {
|
|
5428
5439
|
return !1;
|
|
5429
5440
|
},
|
|
5430
5441
|
connect: function(r, t) {
|
|
5431
|
-
var s =
|
|
5432
|
-
t(new
|
|
5442
|
+
var s = F.defer(function() {
|
|
5443
|
+
t(new U());
|
|
5433
5444
|
});
|
|
5434
5445
|
return {
|
|
5435
5446
|
abort: function() {
|
|
@@ -5552,7 +5563,7 @@ function Qo() {
|
|
|
5552
5563
|
const s = Xr(r, t);
|
|
5553
5564
|
return "customHandler" in s && s.customHandler != null ? s.customHandler : Fr(s);
|
|
5554
5565
|
}
|
|
5555
|
-
class Gr extends
|
|
5566
|
+
class Gr extends ye {
|
|
5556
5567
|
constructor(t) {
|
|
5557
5568
|
super(function(s, a) {
|
|
5558
5569
|
ne.debug(`No callbacks on watchlist events for ${s}`);
|
|
@@ -5577,7 +5588,7 @@ function Qo() {
|
|
|
5577
5588
|
}), resolve: r, reject: t };
|
|
5578
5589
|
}
|
|
5579
5590
|
var Kr = Jr;
|
|
5580
|
-
class Yr extends
|
|
5591
|
+
class Yr extends ye {
|
|
5581
5592
|
constructor(t) {
|
|
5582
5593
|
super(function(s, a) {
|
|
5583
5594
|
ne.debug("No callbacks on user for " + s);
|
|
@@ -5647,24 +5658,24 @@ function Qo() {
|
|
|
5647
5658
|
ue.instances[t].connect();
|
|
5648
5659
|
}
|
|
5649
5660
|
static getClientFeatures() {
|
|
5650
|
-
return
|
|
5661
|
+
return Be(Me({ ws: z.Transports.ws }, function(t) {
|
|
5651
5662
|
return t.isSupported({});
|
|
5652
5663
|
}));
|
|
5653
5664
|
}
|
|
5654
5665
|
constructor(t, s) {
|
|
5655
|
-
Qr(t), Lr(s), this.key = t, this.config = qr(s, this), this.channels =
|
|
5666
|
+
Qr(t), Lr(s), this.key = t, this.config = qr(s, this), this.channels = _e.createChannels(), this.global_emitter = new ye(), this.sessionID = z.randomInt(1e9), this.timeline = new Pr(this.key, this.sessionID, {
|
|
5656
5667
|
cluster: this.config.cluster,
|
|
5657
5668
|
features: ue.getClientFeatures(),
|
|
5658
5669
|
params: this.config.timelineParams || {},
|
|
5659
5670
|
limit: 50,
|
|
5660
|
-
level:
|
|
5671
|
+
level: Ge.INFO,
|
|
5661
5672
|
version: d.VERSION
|
|
5662
|
-
}), this.config.enableStats && (this.timelineSender =
|
|
5673
|
+
}), this.config.enableStats && (this.timelineSender = _e.createTimelineSender(this.timeline, {
|
|
5663
5674
|
host: this.config.statsHost,
|
|
5664
5675
|
path: "/timeline/v2/" + z.TimelineTransport.name
|
|
5665
5676
|
}));
|
|
5666
5677
|
var a = (c) => z.getDefaultStrategy(this.config, c, kr);
|
|
5667
|
-
this.connection =
|
|
5678
|
+
this.connection = _e.createConnectionManager(this.key, {
|
|
5668
5679
|
getStrategy: a,
|
|
5669
5680
|
timeline: this.timeline,
|
|
5670
5681
|
activityTimeout: this.config.activityTimeout,
|
|
@@ -5757,8 +5768,8 @@ function Qo() {
|
|
|
5757
5768
|
});
|
|
5758
5769
|
})(Et)), Et.exports;
|
|
5759
5770
|
}
|
|
5760
|
-
var
|
|
5761
|
-
const
|
|
5771
|
+
var ea = Zo();
|
|
5772
|
+
const ta = /* @__PURE__ */ Qo(ea), na = "/v1/messenger/bootstrap", sa = 3e4, ra = 3e4, ia = 5 * 6e4;
|
|
5762
5773
|
function te(e) {
|
|
5763
5774
|
return typeof e == "object" && e !== null;
|
|
5764
5775
|
}
|
|
@@ -5771,7 +5782,7 @@ function ge(e, n) {
|
|
|
5771
5782
|
throw new Error(`Invalid messenger bootstrap payload: missing string ${n}`);
|
|
5772
5783
|
return i.trim();
|
|
5773
5784
|
}
|
|
5774
|
-
function
|
|
5785
|
+
function De(e, n) {
|
|
5775
5786
|
const i = e[n];
|
|
5776
5787
|
if (i == null)
|
|
5777
5788
|
return null;
|
|
@@ -5780,7 +5791,7 @@ function Ne(e, n) {
|
|
|
5780
5791
|
const o = i.trim();
|
|
5781
5792
|
return o === "" ? null : o;
|
|
5782
5793
|
}
|
|
5783
|
-
function
|
|
5794
|
+
function oa(e, n) {
|
|
5784
5795
|
const i = e[n];
|
|
5785
5796
|
if (typeof i == "number" && Number.isFinite(i))
|
|
5786
5797
|
return i;
|
|
@@ -5791,14 +5802,14 @@ function ia(e, n) {
|
|
|
5791
5802
|
}
|
|
5792
5803
|
throw new Error(`Invalid messenger bootstrap payload: missing integer ${n}`);
|
|
5793
5804
|
}
|
|
5794
|
-
function
|
|
5805
|
+
function aa(e) {
|
|
5795
5806
|
return e.toLowerCase() === "http" ? "http" : "https";
|
|
5796
5807
|
}
|
|
5797
|
-
function
|
|
5808
|
+
function ca(e) {
|
|
5798
5809
|
if (e !== null)
|
|
5799
5810
|
return e.startsWith("/") ? e : `/${e}`;
|
|
5800
5811
|
}
|
|
5801
|
-
function
|
|
5812
|
+
function ua(e) {
|
|
5802
5813
|
const n = te(e) && te(e.data) ? e.data : e;
|
|
5803
5814
|
if (!te(n))
|
|
5804
5815
|
throw new Error("Invalid messenger bootstrap payload: expected object");
|
|
@@ -5808,19 +5819,19 @@ function ca(e) {
|
|
|
5808
5819
|
const u = i.user, l = o.reverb;
|
|
5809
5820
|
if (!te(u) || !te(l))
|
|
5810
5821
|
throw new Error("Invalid messenger bootstrap payload: missing user or reverb data");
|
|
5811
|
-
const h =
|
|
5822
|
+
const h = ca(De(l, "path"));
|
|
5812
5823
|
return {
|
|
5813
5824
|
auth: {
|
|
5814
5825
|
token: ge(i, "token"),
|
|
5815
5826
|
tokenType: ge(i, "token_type"),
|
|
5816
|
-
expiresAt:
|
|
5817
|
-
tenantId:
|
|
5827
|
+
expiresAt: De(i, "expires_at"),
|
|
5828
|
+
tenantId: De(i, "tenant_id"),
|
|
5818
5829
|
user: {
|
|
5819
5830
|
id: ge(u, "id"),
|
|
5820
5831
|
handle: ge(u, "handle"),
|
|
5821
5832
|
name: ge(u, "name"),
|
|
5822
|
-
avatarUrl:
|
|
5823
|
-
email:
|
|
5833
|
+
avatarUrl: De(u, "avatar_url"),
|
|
5834
|
+
email: De(u, "email")
|
|
5824
5835
|
}
|
|
5825
5836
|
},
|
|
5826
5837
|
service: {
|
|
@@ -5830,14 +5841,14 @@ function ca(e) {
|
|
|
5830
5841
|
reverb: {
|
|
5831
5842
|
appKey: ge(l, "app_key"),
|
|
5832
5843
|
host: ge(l, "host"),
|
|
5833
|
-
port:
|
|
5834
|
-
scheme:
|
|
5844
|
+
port: oa(l, "port"),
|
|
5845
|
+
scheme: aa(ge(l, "scheme")),
|
|
5835
5846
|
...h ? { path: h } : {}
|
|
5836
5847
|
}
|
|
5837
5848
|
}
|
|
5838
5849
|
};
|
|
5839
5850
|
}
|
|
5840
|
-
function
|
|
5851
|
+
function la(e) {
|
|
5841
5852
|
return e.replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/:\d+$/, "");
|
|
5842
5853
|
}
|
|
5843
5854
|
function In(e, n) {
|
|
@@ -5853,39 +5864,39 @@ function In(e, n) {
|
|
|
5853
5864
|
"X-Requested-With": "XMLHttpRequest"
|
|
5854
5865
|
}), typeof FormData < "u" && e.data instanceof FormData && (e.headers.delete("Content-Type"), e.headers.delete("content-type"));
|
|
5855
5866
|
}
|
|
5856
|
-
function
|
|
5867
|
+
function Se(e, n, i) {
|
|
5857
5868
|
const o = e[n];
|
|
5858
5869
|
if (typeof o == "string" && o.trim() !== "")
|
|
5859
5870
|
return o;
|
|
5860
5871
|
const u = e[i];
|
|
5861
5872
|
return typeof u == "string" && u.trim() !== "" ? u : null;
|
|
5862
5873
|
}
|
|
5863
|
-
function
|
|
5874
|
+
function ha(e) {
|
|
5864
5875
|
if (typeof e != "string")
|
|
5865
5876
|
return null;
|
|
5866
5877
|
const n = e.trim().toLowerCase();
|
|
5867
5878
|
return n === "online" || n === "idle" || n === "dnd" || n === "offline" ? n : null;
|
|
5868
5879
|
}
|
|
5869
|
-
function
|
|
5880
|
+
function da(e, n) {
|
|
5870
5881
|
if (!te(e))
|
|
5871
5882
|
return null;
|
|
5872
|
-
const i =
|
|
5883
|
+
const i = Se(e, "user_id", "userId"), o = ha(e.status);
|
|
5873
5884
|
if (!i || !o)
|
|
5874
5885
|
return null;
|
|
5875
5886
|
const u = {
|
|
5876
5887
|
user_id: i,
|
|
5877
|
-
tenant_scope:
|
|
5888
|
+
tenant_scope: Se(e, "tenant_scope", "tenantScope") ?? n,
|
|
5878
5889
|
status: o,
|
|
5879
|
-
ts:
|
|
5890
|
+
ts: Se(e, "ts", "timestamp") ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
5880
5891
|
}, l = e.tenant_id ?? e.tenantId;
|
|
5881
5892
|
typeof l == "string" ? u.tenant_id = l : l === null && (u.tenant_id = null);
|
|
5882
5893
|
const h = e.last_seen_at ?? e.lastSeenAt;
|
|
5883
5894
|
return typeof h == "string" ? u.last_seen_at = h : h === null && (u.last_seen_at = null), u;
|
|
5884
5895
|
}
|
|
5885
|
-
function
|
|
5896
|
+
function fa(e) {
|
|
5886
5897
|
if (!te(e))
|
|
5887
5898
|
return null;
|
|
5888
|
-
const n =
|
|
5899
|
+
const n = Se(e, "user_id", "userId"), i = Se(e, "conversation_id", "conversationId");
|
|
5889
5900
|
if (!n || !i)
|
|
5890
5901
|
return null;
|
|
5891
5902
|
const o = e.user, u = te(o) ? {
|
|
@@ -5903,10 +5914,10 @@ function da(e) {
|
|
|
5903
5914
|
...typeof e.stopped_at == "string" ? { stopped_at: e.stopped_at } : {}
|
|
5904
5915
|
};
|
|
5905
5916
|
}
|
|
5906
|
-
function
|
|
5917
|
+
function pa(e) {
|
|
5907
5918
|
if (!te(e))
|
|
5908
5919
|
return null;
|
|
5909
|
-
const n =
|
|
5920
|
+
const n = Se(e, "user_id", "userId"), i = Se(e, "conversation_id", "conversationId");
|
|
5910
5921
|
if (!n || !i)
|
|
5911
5922
|
return null;
|
|
5912
5923
|
const o = te(e.user) ? {
|
|
@@ -5922,10 +5933,10 @@ function fa(e) {
|
|
|
5922
5933
|
...typeof e.ts == "string" ? { ts: e.ts } : {}
|
|
5923
5934
|
};
|
|
5924
5935
|
}
|
|
5925
|
-
function
|
|
5936
|
+
function ga(e) {
|
|
5926
5937
|
if (!te(e))
|
|
5927
5938
|
return null;
|
|
5928
|
-
const n =
|
|
5939
|
+
const n = Se(e, "user_id", "userId"), i = Se(e, "conversation_id", "conversationId");
|
|
5929
5940
|
return !n || !i ? null : {
|
|
5930
5941
|
user_id: n,
|
|
5931
5942
|
conversation_id: i,
|
|
@@ -5933,58 +5944,58 @@ function pa(e) {
|
|
|
5933
5944
|
...typeof e.ts == "string" ? { ts: e.ts } : {}
|
|
5934
5945
|
};
|
|
5935
5946
|
}
|
|
5936
|
-
function ga(e) {
|
|
5937
|
-
return te(e) && ae(e, "id") && ae(e, "name");
|
|
5938
|
-
}
|
|
5939
5947
|
function ma(e) {
|
|
5940
|
-
return
|
|
5948
|
+
return te(e) && ae(e, "id") && ae(e, "name");
|
|
5941
5949
|
}
|
|
5942
5950
|
function va(e) {
|
|
5943
|
-
return te(e)
|
|
5951
|
+
return !te(e) || !ae(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => ma(n));
|
|
5944
5952
|
}
|
|
5945
5953
|
function ba(e) {
|
|
5946
|
-
return te(e) && ae(e, "
|
|
5954
|
+
return te(e) && te(e.message) && ae(e.message, "id") && ae(e.message, "conversation_id") && ae(e.message, "author_id");
|
|
5947
5955
|
}
|
|
5948
5956
|
function ya(e) {
|
|
5949
|
-
return te(e) && ae(e, "conversation_id") &&
|
|
5957
|
+
return te(e) && ae(e, "conversation_id") && ae(e, "user_id") && ae(e, "message_id");
|
|
5950
5958
|
}
|
|
5951
5959
|
function _a(e) {
|
|
5952
|
-
return te(e) && ae(e, "conversation_id") && ae(e, "
|
|
5960
|
+
return te(e) && ae(e, "conversation_id") && te(e.message) && ae(e.message, "id");
|
|
5953
5961
|
}
|
|
5954
5962
|
function Sa(e) {
|
|
5955
|
-
return te(e) && ae(e, "conversation_id") && ae(e, "message_id")
|
|
5963
|
+
return te(e) && ae(e, "conversation_id") && ae(e, "message_id");
|
|
5956
5964
|
}
|
|
5957
5965
|
function wa(e) {
|
|
5958
|
-
return te(e) && ae(e, "conversation_id");
|
|
5966
|
+
return te(e) && ae(e, "conversation_id") && ae(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => va(n));
|
|
5959
5967
|
}
|
|
5960
5968
|
function Ca(e) {
|
|
5969
|
+
return te(e) && ae(e, "conversation_id");
|
|
5970
|
+
}
|
|
5971
|
+
function Ta(e) {
|
|
5961
5972
|
return te(e) && ae(e, "conversation_id") && ae(e, "removed_user_id");
|
|
5962
5973
|
}
|
|
5963
|
-
function
|
|
5974
|
+
function Ae(e, n, i, o) {
|
|
5964
5975
|
const u = (l) => {
|
|
5965
5976
|
i(l) && o(l);
|
|
5966
5977
|
};
|
|
5967
5978
|
return e.listen(n, u), u;
|
|
5968
5979
|
}
|
|
5969
|
-
function
|
|
5970
|
-
const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ??
|
|
5971
|
-
typeof window < "u" && (window.Pusher =
|
|
5972
|
-
let h = null, g = null, d = null, A = null, x = "disconnected",
|
|
5980
|
+
function ja(e) {
|
|
5981
|
+
const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ?? na, o = e.bootstrapRefreshSkewMs ?? sa, u = e.presenceFreshnessTtlMs ?? ia, l = (e.createLogger ?? qt())("MessengerEcho");
|
|
5982
|
+
typeof window < "u" && (window.Pusher = ta);
|
|
5983
|
+
let h = null, g = null, d = null, A = null, x = "disconnected", m = null, w = null;
|
|
5973
5984
|
const R = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Map(), _ = (T) => {
|
|
5974
5985
|
x = T;
|
|
5975
5986
|
for (const M of R)
|
|
5976
5987
|
M(T);
|
|
5977
5988
|
}, f = () => {
|
|
5978
5989
|
w !== null && (clearTimeout(w), w = null);
|
|
5979
|
-
},
|
|
5990
|
+
}, v = (T = !0) => {
|
|
5980
5991
|
d !== null && (d.disconnect(), d = null), A = null, T && _("disconnected");
|
|
5981
|
-
},
|
|
5982
|
-
f(), h = null, g = null,
|
|
5983
|
-
},
|
|
5992
|
+
}, b = () => {
|
|
5993
|
+
f(), h = null, g = null, m = null, v(), E.clear();
|
|
5994
|
+
}, D = () => {
|
|
5984
5995
|
if (!e.getSourceToken)
|
|
5985
5996
|
return null;
|
|
5986
5997
|
const T = e.getSourceToken();
|
|
5987
|
-
return T === null ? (
|
|
5998
|
+
return T === null ? (b(), null) : (m !== null && m !== T && (f(), h = null, g = null, v()), m = T, T);
|
|
5988
5999
|
}, H = (T) => {
|
|
5989
6000
|
if (T === null)
|
|
5990
6001
|
return !1;
|
|
@@ -6000,22 +6011,22 @@ function za(e) {
|
|
|
6000
6011
|
return;
|
|
6001
6012
|
const Q = Math.max(0, M - Date.now() - o);
|
|
6002
6013
|
w = setTimeout(() => {
|
|
6003
|
-
|
|
6014
|
+
U();
|
|
6004
6015
|
}, Q);
|
|
6005
|
-
}, P = async (T = !1) => e.getSourceToken &&
|
|
6016
|
+
}, P = async (T = !1) => e.getSourceToken && D() === null ? null : !T && H(h) ? h : !T && g !== null ? await g : (g = (async () => {
|
|
6006
6017
|
const Q = await e.bootstrapClient.get(
|
|
6007
6018
|
i,
|
|
6008
6019
|
T ? { params: { refresh: 1 } } : void 0
|
|
6009
|
-
),
|
|
6010
|
-
return h =
|
|
6020
|
+
), F = ua(Q.data);
|
|
6021
|
+
return h = F, B(F), F;
|
|
6011
6022
|
})().finally(() => {
|
|
6012
6023
|
g = null;
|
|
6013
|
-
}), await g),
|
|
6024
|
+
}), await g), U = async () => {
|
|
6014
6025
|
const T = d !== null;
|
|
6015
6026
|
try {
|
|
6016
6027
|
if (await P(!0), !T)
|
|
6017
6028
|
return;
|
|
6018
|
-
|
|
6029
|
+
v(!1), await N(!0);
|
|
6019
6030
|
} catch (M) {
|
|
6020
6031
|
l.warn("Failed to refresh messenger bootstrap", M);
|
|
6021
6032
|
}
|
|
@@ -6036,19 +6047,19 @@ function za(e) {
|
|
|
6036
6047
|
}), M.bind("error", () => {
|
|
6037
6048
|
_("error");
|
|
6038
6049
|
}), M.state === "connected" && _("connected");
|
|
6039
|
-
},
|
|
6050
|
+
}, N = async (T = !1) => !T && d !== null && H(h) ? d : !T && A !== null ? await A : (A = (async () => {
|
|
6040
6051
|
const Q = await P(T);
|
|
6041
6052
|
if (Q === null)
|
|
6042
6053
|
return null;
|
|
6043
|
-
d !== null &&
|
|
6044
|
-
const
|
|
6054
|
+
d !== null && v(!1);
|
|
6055
|
+
const F = Q.service.reverb.scheme === "https", X = {
|
|
6045
6056
|
broadcaster: "reverb",
|
|
6046
6057
|
key: Q.service.reverb.appKey,
|
|
6047
|
-
wsHost:
|
|
6058
|
+
wsHost: la(Q.service.reverb.host),
|
|
6048
6059
|
wsPort: Q.service.reverb.port,
|
|
6049
6060
|
wssPort: Q.service.reverb.port,
|
|
6050
|
-
forceTLS:
|
|
6051
|
-
encrypted:
|
|
6061
|
+
forceTLS: F,
|
|
6062
|
+
encrypted: F,
|
|
6052
6063
|
disableStats: !0,
|
|
6053
6064
|
enabledTransports: ["ws", "wss"],
|
|
6054
6065
|
authEndpoint: Q.service.broadcastingAuthUrl,
|
|
@@ -6059,11 +6070,11 @@ function za(e) {
|
|
|
6059
6070
|
}
|
|
6060
6071
|
}
|
|
6061
6072
|
};
|
|
6062
|
-
return Q.service.reverb.path && (X.wsPath = Q.service.reverb.path), d = new
|
|
6073
|
+
return Q.service.reverb.path && (X.wsPath = Q.service.reverb.path), d = new Yo(X), V(d), _("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), d;
|
|
6063
6074
|
})().finally(() => {
|
|
6064
6075
|
A = null;
|
|
6065
6076
|
}), await A), K = kt.create({
|
|
6066
|
-
timeout: e.requestTimeoutMs ??
|
|
6077
|
+
timeout: e.requestTimeoutMs ?? ra,
|
|
6067
6078
|
withCredentials: !1,
|
|
6068
6079
|
headers: {
|
|
6069
6080
|
Accept: "application/json",
|
|
@@ -6088,40 +6099,40 @@ function za(e) {
|
|
|
6088
6099
|
return Promise.reject(T);
|
|
6089
6100
|
}
|
|
6090
6101
|
);
|
|
6091
|
-
const
|
|
6102
|
+
const re = () => (N().catch((T) => {
|
|
6092
6103
|
l.warn("Failed to initialize messenger echo", T);
|
|
6093
|
-
}), d),
|
|
6104
|
+
}), d), j = (T) => (R.add(T), T(x), () => {
|
|
6094
6105
|
R.delete(T);
|
|
6095
|
-
}),
|
|
6106
|
+
}), y = () => h?.auth.tenantId ?? "global", O = (T) => {
|
|
6096
6107
|
const M = xt(T.ts)?.getTime() ?? xt(T.last_seen_at)?.getTime() ?? null;
|
|
6097
6108
|
if (M === null)
|
|
6098
6109
|
return !0;
|
|
6099
|
-
const Q = `${T.tenant_scope ?? "global"}:${T.user_id}`,
|
|
6100
|
-
if (
|
|
6110
|
+
const Q = `${T.tenant_scope ?? "global"}:${T.user_id}`, F = E.get(Q);
|
|
6111
|
+
if (F && M < F.timestampMs)
|
|
6101
6112
|
return !1;
|
|
6102
6113
|
const X = Date.now();
|
|
6103
6114
|
E.set(Q, {
|
|
6104
6115
|
timestampMs: M,
|
|
6105
6116
|
seenAt: X
|
|
6106
6117
|
});
|
|
6107
|
-
for (const [
|
|
6108
|
-
X -
|
|
6118
|
+
for (const [ve, be] of E.entries())
|
|
6119
|
+
X - be.seenAt > u && E.delete(ve);
|
|
6109
6120
|
return !0;
|
|
6110
6121
|
};
|
|
6111
6122
|
return {
|
|
6112
6123
|
apiClient: K,
|
|
6113
6124
|
initializedEvent: n,
|
|
6114
|
-
getEcho:
|
|
6125
|
+
getEcho: re,
|
|
6115
6126
|
getConnectionStatus: () => x,
|
|
6116
|
-
onConnectionStatusChange:
|
|
6127
|
+
onConnectionStatusChange: j,
|
|
6117
6128
|
reconnect: async () => {
|
|
6118
|
-
|
|
6129
|
+
v(), await N(!0);
|
|
6119
6130
|
},
|
|
6120
6131
|
subscribeToPresenceStatus: (T) => {
|
|
6121
|
-
const M =
|
|
6132
|
+
const M = re();
|
|
6122
6133
|
if (!M || typeof M.join != "function")
|
|
6123
6134
|
return;
|
|
6124
|
-
const Q = M.join(`online-users.${
|
|
6135
|
+
const Q = M.join(`online-users.${y()}`), F = [
|
|
6125
6136
|
".PresenceStatusChanged",
|
|
6126
6137
|
"PresenceStatusChanged",
|
|
6127
6138
|
".presence.status.changed",
|
|
@@ -6131,57 +6142,57 @@ function za(e) {
|
|
|
6131
6142
|
".Modules\\Presence\\Events\\UserPresenceStatusChanged",
|
|
6132
6143
|
"Modules\\Presence\\Events\\UserPresenceStatusChanged"
|
|
6133
6144
|
];
|
|
6134
|
-
for (const X of
|
|
6135
|
-
Q.listen(X, (
|
|
6136
|
-
const
|
|
6137
|
-
!
|
|
6145
|
+
for (const X of F)
|
|
6146
|
+
Q.listen(X, (ve) => {
|
|
6147
|
+
const be = da(ve, y());
|
|
6148
|
+
!be || !O(be) || T(be);
|
|
6138
6149
|
});
|
|
6139
6150
|
},
|
|
6140
6151
|
unsubscribeFromPresenceStatus: () => {
|
|
6141
|
-
d?.leave(`online-users.${
|
|
6152
|
+
d?.leave(`online-users.${y()}`);
|
|
6142
6153
|
},
|
|
6143
6154
|
subscribeToConversation: (T, M) => {
|
|
6144
|
-
const Q =
|
|
6155
|
+
const Q = re();
|
|
6145
6156
|
if (!Q)
|
|
6146
6157
|
return () => {
|
|
6147
6158
|
};
|
|
6148
|
-
const
|
|
6159
|
+
const F = Q.private(`conversation.${T}`), X = [];
|
|
6149
6160
|
return M.onMessageSent && X.push({
|
|
6150
6161
|
event: ".ConversationMessageSent",
|
|
6151
|
-
handler:
|
|
6162
|
+
handler: Ae(F, ".ConversationMessageSent", ba, M.onMessageSent)
|
|
6152
6163
|
}), M.onMessageRead && X.push({
|
|
6153
6164
|
event: ".ConversationMessageRead",
|
|
6154
|
-
handler:
|
|
6165
|
+
handler: Ae(F, ".ConversationMessageRead", ya, M.onMessageRead)
|
|
6155
6166
|
}), M.onMessageEdited && X.push({
|
|
6156
6167
|
event: ".ConversationMessageEdited",
|
|
6157
|
-
handler:
|
|
6168
|
+
handler: Ae(F, ".ConversationMessageEdited", _a, M.onMessageEdited)
|
|
6158
6169
|
}), M.onMessageDeleted && X.push({
|
|
6159
6170
|
event: ".ConversationMessageDeleted",
|
|
6160
|
-
handler:
|
|
6171
|
+
handler: Ae(F, ".ConversationMessageDeleted", Sa, M.onMessageDeleted)
|
|
6161
6172
|
}), M.onReactionToggled && X.push({
|
|
6162
6173
|
event: ".MessageReactionToggled",
|
|
6163
|
-
handler:
|
|
6174
|
+
handler: Ae(F, ".MessageReactionToggled", wa, M.onReactionToggled)
|
|
6164
6175
|
}), M.onRequestAccepted && X.push({
|
|
6165
6176
|
event: ".ConversationRequestAccepted",
|
|
6166
|
-
handler:
|
|
6177
|
+
handler: Ae(F, ".ConversationRequestAccepted", Ca, M.onRequestAccepted)
|
|
6167
6178
|
}), M.onParticipantRemoved && X.push({
|
|
6168
6179
|
event: ".ConversationParticipantRemoved",
|
|
6169
|
-
handler:
|
|
6180
|
+
handler: Ae(F, ".ConversationParticipantRemoved", Ta, M.onParticipantRemoved)
|
|
6170
6181
|
}), () => {
|
|
6171
|
-
if (typeof
|
|
6172
|
-
for (const
|
|
6173
|
-
|
|
6182
|
+
if (typeof F.stopListening == "function")
|
|
6183
|
+
for (const ve of X)
|
|
6184
|
+
F.stopListening(ve.event, ve.handler);
|
|
6174
6185
|
};
|
|
6175
6186
|
},
|
|
6176
6187
|
unsubscribeFromConversation: (T) => {
|
|
6177
6188
|
d?.leave(`conversation.${T}`);
|
|
6178
6189
|
},
|
|
6179
6190
|
subscribeToTyping: (T, M) => {
|
|
6180
|
-
const Q =
|
|
6191
|
+
const Q = re();
|
|
6181
6192
|
if (!Q)
|
|
6182
6193
|
return () => {
|
|
6183
6194
|
};
|
|
6184
|
-
const
|
|
6195
|
+
const F = Q.private(`typing-conversation.${T}`), X = [], ve = [
|
|
6185
6196
|
".TypingStateChanged",
|
|
6186
6197
|
"TypingStateChanged",
|
|
6187
6198
|
".typing.changed",
|
|
@@ -6190,12 +6201,12 @@ function za(e) {
|
|
|
6190
6201
|
"typing.state.changed",
|
|
6191
6202
|
".Modules\\Messaging\\Events\\Broadcast\\TypingStateChanged",
|
|
6192
6203
|
"Modules\\Messaging\\Events\\Broadcast\\TypingStateChanged"
|
|
6193
|
-
],
|
|
6194
|
-
for (const ce of
|
|
6195
|
-
const pe = (
|
|
6196
|
-
const G =
|
|
6204
|
+
], be = [".typing.start", "typing.start", ".TypingStarted", "TypingStarted", ".TypingStart", "TypingStart"], fe = [".typing.stop", "typing.stop", ".TypingStopped", "TypingStopped", ".TypingStop", "TypingStop"], Be = /* @__PURE__ */ new Set(["start", "typing"]), ot = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]);
|
|
6205
|
+
for (const ce of ve) {
|
|
6206
|
+
const pe = (Ce) => {
|
|
6207
|
+
const G = fa(Ce);
|
|
6197
6208
|
if (G) {
|
|
6198
|
-
if (
|
|
6209
|
+
if (Be.has(G.state)) {
|
|
6199
6210
|
M.onTypingStart?.({
|
|
6200
6211
|
user_id: G.user_id,
|
|
6201
6212
|
user: G.user ?? {
|
|
@@ -6214,14 +6225,14 @@ function za(e) {
|
|
|
6214
6225
|
});
|
|
6215
6226
|
}
|
|
6216
6227
|
};
|
|
6217
|
-
|
|
6228
|
+
F.listen(ce, pe), X.push({ event: ce, handler: pe });
|
|
6218
6229
|
}
|
|
6219
|
-
for (const ce of
|
|
6220
|
-
const pe = (
|
|
6221
|
-
const G =
|
|
6230
|
+
for (const ce of be) {
|
|
6231
|
+
const pe = (Ce) => {
|
|
6232
|
+
const G = pa(Ce);
|
|
6222
6233
|
if (!G)
|
|
6223
6234
|
return;
|
|
6224
|
-
const
|
|
6235
|
+
const Me = {
|
|
6225
6236
|
user_id: G.user_id,
|
|
6226
6237
|
user: {
|
|
6227
6238
|
id: G.user?.id ?? G.user_id,
|
|
@@ -6231,97 +6242,98 @@ function za(e) {
|
|
|
6231
6242
|
conversation_id: G.conversation_id,
|
|
6232
6243
|
started_at: G.started_at ?? G.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6233
6244
|
};
|
|
6234
|
-
M.onTypingStart?.(
|
|
6245
|
+
M.onTypingStart?.(Me);
|
|
6235
6246
|
};
|
|
6236
|
-
|
|
6247
|
+
F.listen(ce, pe), X.push({ event: ce, handler: pe });
|
|
6237
6248
|
}
|
|
6238
6249
|
for (const ce of fe) {
|
|
6239
|
-
const pe = (
|
|
6240
|
-
const G =
|
|
6250
|
+
const pe = (Ce) => {
|
|
6251
|
+
const G = ga(Ce);
|
|
6241
6252
|
if (!G)
|
|
6242
6253
|
return;
|
|
6243
|
-
const
|
|
6254
|
+
const Me = {
|
|
6244
6255
|
user_id: G.user_id,
|
|
6245
6256
|
conversation_id: G.conversation_id,
|
|
6246
6257
|
stopped_at: G.stopped_at ?? G.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6247
6258
|
};
|
|
6248
|
-
M.onTypingStop?.(
|
|
6259
|
+
M.onTypingStop?.(Me);
|
|
6249
6260
|
};
|
|
6250
|
-
|
|
6261
|
+
F.listen(ce, pe), X.push({ event: ce, handler: pe });
|
|
6251
6262
|
}
|
|
6252
6263
|
return () => {
|
|
6253
|
-
if (typeof
|
|
6264
|
+
if (typeof F.stopListening == "function")
|
|
6254
6265
|
for (const ce of X)
|
|
6255
|
-
|
|
6266
|
+
F.stopListening(ce.event, ce.handler);
|
|
6256
6267
|
};
|
|
6257
6268
|
},
|
|
6258
6269
|
unsubscribeFromTyping: (T) => {
|
|
6259
6270
|
d?.leave(`typing-conversation.${T}`);
|
|
6260
6271
|
},
|
|
6261
|
-
clearRuntime:
|
|
6272
|
+
clearRuntime: b
|
|
6262
6273
|
};
|
|
6263
6274
|
}
|
|
6264
6275
|
export {
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6276
|
+
fo as DEFAULT_PRESENCE_STALE_AFTER_MS,
|
|
6277
|
+
qa as configureMessengerClient,
|
|
6278
|
+
ja as createMessengerEcho,
|
|
6268
6279
|
W as getApi,
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6280
|
+
xe as getAuthStore,
|
|
6281
|
+
ka as getConnectionStatus,
|
|
6282
|
+
Pe as getEcho,
|
|
6272
6283
|
Hn as getEchoConnectionStatus,
|
|
6273
|
-
|
|
6284
|
+
ze as getEchoInitializedEvent,
|
|
6274
6285
|
Z as getErrorMessage,
|
|
6275
6286
|
qt as getLoggerFactory,
|
|
6276
6287
|
es as getMainApi,
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6288
|
+
Zi as getMainEcho,
|
|
6289
|
+
eo as getMainEchoConnectionStatus,
|
|
6290
|
+
Qi as getMainEchoInitializedEvent,
|
|
6291
|
+
xi as getMediaApi,
|
|
6292
|
+
To as getPresenceRuntimeConfig,
|
|
6293
|
+
La as hasResponse,
|
|
6294
|
+
Ba as isAxiosError,
|
|
6295
|
+
Ia as isError,
|
|
6285
6296
|
wi as isValidMessageReadEvent,
|
|
6286
6297
|
Si as isValidMessageSentEvent,
|
|
6287
|
-
Ci as
|
|
6288
|
-
|
|
6289
|
-
|
|
6298
|
+
Ci as isValidReactionToggledEvent,
|
|
6299
|
+
Ti as isValidRequestAcceptedEvent,
|
|
6300
|
+
we as messagingApi,
|
|
6301
|
+
go as normalizePresenceStatus,
|
|
6290
6302
|
ts as normalizePresenceTimestamp,
|
|
6291
6303
|
it as onConnectionStatusChange,
|
|
6292
|
-
|
|
6304
|
+
to as onMainEchoConnectionStatusChange,
|
|
6293
6305
|
xt as parsePresenceTimestamp,
|
|
6294
6306
|
di as reconnectEcho,
|
|
6295
|
-
|
|
6307
|
+
no as reconnectMainEcho,
|
|
6296
6308
|
_i as resetEchoRuntimeConfig,
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6309
|
+
ao as resetLoggerFactory,
|
|
6310
|
+
ho as resetMainApiClient,
|
|
6311
|
+
ro as resetMainEchoRuntimeConfig,
|
|
6312
|
+
Ri as resetMessagingApiClient,
|
|
6313
|
+
Pi as resetMessagingAuthStoreResolver,
|
|
6314
|
+
ki as resetMessagingMediaApi,
|
|
6315
|
+
za as resetMessengerClientConfig,
|
|
6316
|
+
Ro as resetPresenceRuntimeConfig,
|
|
6317
|
+
mo as resolveFreshPresenceStatus,
|
|
6306
6318
|
xn as resolvePresenceSnapshot,
|
|
6307
6319
|
yi as setEchoRuntimeConfig,
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6320
|
+
oo as setLoggerFactory,
|
|
6321
|
+
lo as setMainApiClient,
|
|
6322
|
+
so as setMainEchoRuntimeConfig,
|
|
6323
|
+
Ei as setMessagingApiClient,
|
|
6324
|
+
Ai as setMessagingAuthStoreResolver,
|
|
6325
|
+
Mi as setMessagingMediaApi,
|
|
6326
|
+
Eo as setPresenceRuntimeConfig,
|
|
6315
6327
|
gi as subscribeToConversation,
|
|
6316
6328
|
fi as subscribeToPresenceStatus,
|
|
6317
6329
|
vi as subscribeToTyping,
|
|
6318
6330
|
mi as unsubscribeFromConversation,
|
|
6319
6331
|
pi as unsubscribeFromPresenceStatus,
|
|
6320
6332
|
bi as unsubscribeFromTyping,
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6333
|
+
Oa as useConnectionStatus,
|
|
6334
|
+
Ua as useConversationChannel,
|
|
6335
|
+
Na as useGlobalMessaging,
|
|
6324
6336
|
Ft as useMessagingStore,
|
|
6325
|
-
|
|
6326
|
-
|
|
6337
|
+
Fa as usePresence,
|
|
6338
|
+
Da as useTypingChannel
|
|
6327
6339
|
};
|