@codingfactory/messenger-client 0.2.27 → 0.2.29
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 +897 -892
- package/dist/stores/messaging.d.ts +15 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
import { ref as be, getCurrentInstance as
|
|
2
|
-
import { defineStore as
|
|
3
|
-
import
|
|
1
|
+
import { ref as be, getCurrentInstance as zt, computed as se, watch as ot, onUnmounted as qe, toValue as is, onMounted as jt } from "vue";
|
|
2
|
+
import { defineStore as Di, storeToRefs as Ni } from "pinia";
|
|
3
|
+
import $t, { isAxiosError as qi, AxiosHeaders as An } from "axios";
|
|
4
4
|
import { isAxiosError as vc } from "axios";
|
|
5
|
-
import { useRoute as
|
|
6
|
-
const
|
|
7
|
-
},
|
|
8
|
-
},
|
|
9
|
-
}, as = () => {
|
|
10
|
-
}, cs = () => {
|
|
5
|
+
import { useRoute as zi } from "vue-router";
|
|
6
|
+
const os = () => () => {
|
|
7
|
+
}, as = () => () => {
|
|
8
|
+
}, cs = async () => {
|
|
11
9
|
}, us = () => {
|
|
12
10
|
}, ls = () => {
|
|
13
11
|
}, ds = () => {
|
|
14
|
-
throw new Error("messenger-client subscribeToConversation is not configured");
|
|
15
12
|
}, hs = () => {
|
|
13
|
+
}, fs = () => {
|
|
14
|
+
throw new Error("messenger-client subscribeToConversation is not configured");
|
|
15
|
+
}, ps = () => {
|
|
16
16
|
throw new Error("messenger-client subscribeToTyping is not configured");
|
|
17
|
-
},
|
|
17
|
+
}, gs = async () => null, H = {
|
|
18
18
|
ECHO_INITIALIZED_EVENT: "messenger-client:echo-initialized",
|
|
19
19
|
getEcho: () => null,
|
|
20
|
-
waitForEcho:
|
|
20
|
+
waitForEcho: gs,
|
|
21
21
|
getConnectionStatus: () => "disconnected",
|
|
22
22
|
getAccessState: () => "available",
|
|
23
|
-
onConnectionStatusChange:
|
|
24
|
-
onAccessStateChange:
|
|
25
|
-
reconnect:
|
|
26
|
-
subscribeToPresenceStatus:
|
|
27
|
-
unsubscribeFromPresenceStatus:
|
|
28
|
-
subscribeToConversation:
|
|
29
|
-
unsubscribeFromConversation:
|
|
30
|
-
subscribeToTyping:
|
|
31
|
-
unsubscribeFromTyping:
|
|
32
|
-
}, Je = () => H.ECHO_INITIALIZED_EVENT, Ae = () => H.getEcho(),
|
|
23
|
+
onConnectionStatusChange: os,
|
|
24
|
+
onAccessStateChange: as,
|
|
25
|
+
reconnect: cs,
|
|
26
|
+
subscribeToPresenceStatus: us,
|
|
27
|
+
unsubscribeFromPresenceStatus: ls,
|
|
28
|
+
subscribeToConversation: fs,
|
|
29
|
+
unsubscribeFromConversation: ds,
|
|
30
|
+
subscribeToTyping: ps,
|
|
31
|
+
unsubscribeFromTyping: hs
|
|
32
|
+
}, Je = () => H.ECHO_INITIALIZED_EVENT, Ae = () => H.getEcho(), ms = async () => H.waitForEcho(), vs = () => H.getConnectionStatus(), Rn = () => vs(), Ot = () => H.getAccessState(), ht = (e) => H.onConnectionStatusChange(e), ji = (e) => H.onAccessStateChange(e), $i = async () => {
|
|
33
33
|
await H.reconnect();
|
|
34
|
-
},
|
|
35
|
-
function
|
|
34
|
+
}, Hi = (e) => H.subscribeToPresenceStatus(e), Bi = () => H.unsubscribeFromPresenceStatus(), Vi = (e, n) => H.subscribeToConversation(e, n), Xi = (e) => H.unsubscribeFromConversation(e), Wi = (e, n) => H.subscribeToTyping(e, n), Gi = (e) => H.unsubscribeFromTyping(e);
|
|
35
|
+
function Ji(e) {
|
|
36
36
|
e.initializedEvent && (H.ECHO_INITIALIZED_EVENT = e.initializedEvent), e.getEcho && (H.getEcho = e.getEcho), e.waitForEcho && (H.waitForEcho = e.waitForEcho), e.getConnectionStatus && (H.getConnectionStatus = e.getConnectionStatus), e.getAccessState && (H.getAccessState = e.getAccessState), e.onConnectionStatusChange && (H.onConnectionStatusChange = e.onConnectionStatusChange), e.onAccessStateChange && (H.onAccessStateChange = e.onAccessStateChange), e.reconnect && (H.reconnect = e.reconnect), e.subscribeToPresenceStatus && (H.subscribeToPresenceStatus = e.subscribeToPresenceStatus), e.unsubscribeFromPresenceStatus && (H.unsubscribeFromPresenceStatus = e.unsubscribeFromPresenceStatus), e.subscribeToConversation && (H.subscribeToConversation = e.subscribeToConversation), e.unsubscribeFromConversation && (H.unsubscribeFromConversation = e.unsubscribeFromConversation), e.subscribeToTyping && (H.subscribeToTyping = e.subscribeToTyping), e.unsubscribeFromTyping && (H.unsubscribeFromTyping = e.unsubscribeFromTyping);
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
H.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", H.getEcho = () => null, H.waitForEcho =
|
|
38
|
+
function Ki() {
|
|
39
|
+
H.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", H.getEcho = () => null, H.waitForEcho = gs, H.getConnectionStatus = () => "disconnected", H.getAccessState = () => "available", H.onConnectionStatusChange = os, H.onAccessStateChange = as, H.reconnect = cs, H.subscribeToPresenceStatus = us, H.unsubscribeFromPresenceStatus = ls, H.subscribeToConversation = fs, H.unsubscribeFromConversation = ds, H.subscribeToTyping = ps, H.unsubscribeFromTyping = hs;
|
|
40
40
|
}
|
|
41
41
|
function xe(e) {
|
|
42
42
|
return typeof e == "object" && e !== null;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function Qi(e) {
|
|
45
45
|
return xe(e) && typeof e.conversation_id == "string" && xe(e.message) && typeof e.message.id == "string" && typeof e.message.conversation_id == "string" && typeof e.message.author_id == "string";
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Yi(e) {
|
|
48
48
|
return xe(e) && typeof e.conversation_id == "string" && typeof e.user_id == "string" && typeof e.message_id == "string";
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function Zi(e) {
|
|
51
51
|
return xe(e) && typeof e.conversation_id == "string" && xe(e.message) && typeof e.message.id == "string";
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function eo(e) {
|
|
54
54
|
return xe(e) && typeof e.conversation_id == "string" && typeof e.message_id == "string";
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function to(e) {
|
|
57
57
|
return xe(e) && typeof e.conversation_id == "string" && typeof e.message_id == "string" && Array.isArray(e.reactions);
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function no(e) {
|
|
60
60
|
return xe(e) && typeof e.conversation_id == "string";
|
|
61
61
|
}
|
|
62
|
-
const
|
|
63
|
-
let
|
|
62
|
+
const bs = $t;
|
|
63
|
+
let Ht = bs;
|
|
64
64
|
function X() {
|
|
65
|
-
return $t;
|
|
66
|
-
}
|
|
67
|
-
function to(e) {
|
|
68
|
-
$t = e;
|
|
69
|
-
}
|
|
70
|
-
function no() {
|
|
71
|
-
$t = ms;
|
|
72
|
-
}
|
|
73
|
-
const vs = jt;
|
|
74
|
-
let Ht = vs;
|
|
75
|
-
function Bt() {
|
|
76
65
|
return Ht;
|
|
77
66
|
}
|
|
78
67
|
function so(e) {
|
|
79
68
|
Ht = e;
|
|
80
69
|
}
|
|
81
70
|
function ro() {
|
|
82
|
-
Ht =
|
|
71
|
+
Ht = bs;
|
|
83
72
|
}
|
|
84
|
-
const
|
|
73
|
+
const ys = $t;
|
|
74
|
+
let Bt = ys;
|
|
75
|
+
function Vt() {
|
|
76
|
+
return Bt;
|
|
77
|
+
}
|
|
78
|
+
function io(e) {
|
|
79
|
+
Bt = e;
|
|
80
|
+
}
|
|
81
|
+
function oo() {
|
|
82
|
+
Bt = ys;
|
|
83
|
+
}
|
|
84
|
+
const _s = {
|
|
85
85
|
currentUser: null
|
|
86
86
|
};
|
|
87
|
-
let
|
|
87
|
+
let Xt = () => _s;
|
|
88
88
|
function ke() {
|
|
89
|
-
return
|
|
89
|
+
return Xt;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
91
|
+
function ao(e) {
|
|
92
|
+
Xt = e;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
95
|
-
|
|
94
|
+
function co() {
|
|
95
|
+
Xt = () => _s;
|
|
96
96
|
}
|
|
97
97
|
function Y(e) {
|
|
98
|
-
if (
|
|
98
|
+
if (qi(e)) {
|
|
99
99
|
const n = e.response?.data?.message || e.message || "An error occurred";
|
|
100
100
|
return n.includes("SQLSTATE") || n.includes("Connection:") || n.includes("\\Illuminate\\") ? "Something went wrong. Please try again later." : n;
|
|
101
101
|
}
|
|
@@ -107,29 +107,29 @@ function rc(e) {
|
|
|
107
107
|
function ic(e) {
|
|
108
108
|
return typeof e == "object" && e !== null && "response" in e && typeof e.response == "object";
|
|
109
109
|
}
|
|
110
|
-
const
|
|
110
|
+
const Ss = {
|
|
111
111
|
async uploadImage() {
|
|
112
112
|
throw new Error("messenger-client mediaApi.uploadImage is not configured");
|
|
113
113
|
}
|
|
114
114
|
};
|
|
115
|
-
let
|
|
116
|
-
function ao() {
|
|
117
|
-
return Xt;
|
|
118
|
-
}
|
|
119
|
-
function co(e) {
|
|
120
|
-
Xt = e;
|
|
121
|
-
}
|
|
115
|
+
let Wt = Ss;
|
|
122
116
|
function uo() {
|
|
123
|
-
|
|
117
|
+
return Wt;
|
|
124
118
|
}
|
|
125
119
|
function lo(e) {
|
|
120
|
+
Wt = e;
|
|
121
|
+
}
|
|
122
|
+
function ho() {
|
|
123
|
+
Wt = Ss;
|
|
124
|
+
}
|
|
125
|
+
function fo(e) {
|
|
126
126
|
return e !== null && typeof e == "object" && "id" in e && "type" in e && "participants" in e;
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function Cs(e) {
|
|
129
129
|
return typeof e == "object" && e !== null;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
return !
|
|
131
|
+
function $e(e) {
|
|
132
|
+
return !Cs(e) || !("data" in e) ? e : e.data;
|
|
133
133
|
}
|
|
134
134
|
function nt(e, n) {
|
|
135
135
|
const r = e[n];
|
|
@@ -137,7 +137,7 @@ function nt(e, n) {
|
|
|
137
137
|
throw new Error(`Invalid messaging folder payload: missing string ${n}`);
|
|
138
138
|
return r;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function Pn(e, n) {
|
|
141
141
|
const r = e[n];
|
|
142
142
|
if (r == null)
|
|
143
143
|
return null;
|
|
@@ -145,7 +145,7 @@ function An(e, n) {
|
|
|
145
145
|
throw new Error(`Invalid messaging folder payload: ${n} must be a string or null`);
|
|
146
146
|
return r;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function Rt(e, n) {
|
|
149
149
|
const r = e[n];
|
|
150
150
|
if (typeof r == "number" && Number.isFinite(r))
|
|
151
151
|
return r;
|
|
@@ -156,43 +156,43 @@ function At(e, n) {
|
|
|
156
156
|
}
|
|
157
157
|
throw new Error(`Invalid messaging folder payload: missing numeric ${n}`);
|
|
158
158
|
}
|
|
159
|
-
function
|
|
160
|
-
if (!
|
|
159
|
+
function Ft(e) {
|
|
160
|
+
if (!Cs(e))
|
|
161
161
|
throw new Error("Invalid messaging folder payload: expected object");
|
|
162
162
|
return {
|
|
163
163
|
id: nt(e, "id"),
|
|
164
164
|
name: nt(e, "name"),
|
|
165
|
-
color:
|
|
166
|
-
icon:
|
|
167
|
-
sort_order:
|
|
168
|
-
conversation_count:
|
|
169
|
-
unread_count:
|
|
165
|
+
color: Pn(e, "color"),
|
|
166
|
+
icon: Pn(e, "icon"),
|
|
167
|
+
sort_order: Rt(e, "sort_order"),
|
|
168
|
+
conversation_count: Rt(e, "conversation_count"),
|
|
169
|
+
unread_count: Rt(e, "unread_count"),
|
|
170
170
|
created_at: nt(e, "created_at"),
|
|
171
171
|
updated_at: nt(e, "updated_at")
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function po(e) {
|
|
175
175
|
if (!Array.isArray(e))
|
|
176
176
|
throw new Error("Invalid messaging folder payload: expected array");
|
|
177
|
-
return e.map((n) =>
|
|
177
|
+
return e.map((n) => Ft(n));
|
|
178
178
|
}
|
|
179
|
-
function
|
|
180
|
-
if (!
|
|
179
|
+
function Mn(e) {
|
|
180
|
+
if (!fo(e))
|
|
181
181
|
throw new Error("Invalid conversation payload from folder assignment endpoint");
|
|
182
182
|
return e;
|
|
183
183
|
}
|
|
184
184
|
const Pe = {
|
|
185
185
|
async fetchFolders() {
|
|
186
186
|
const e = await X().get("/v1/messaging/folders");
|
|
187
|
-
return
|
|
187
|
+
return po($e(e.data));
|
|
188
188
|
},
|
|
189
189
|
async createFolder(e) {
|
|
190
190
|
const n = await X().post("/v1/messaging/folders", e);
|
|
191
|
-
return
|
|
191
|
+
return Ft($e(n.data));
|
|
192
192
|
},
|
|
193
193
|
async updateFolder(e, n) {
|
|
194
194
|
const r = await X().patch(`/v1/messaging/folders/${e}`, n);
|
|
195
|
-
return
|
|
195
|
+
return Ft($e(r.data));
|
|
196
196
|
},
|
|
197
197
|
async deleteFolder(e) {
|
|
198
198
|
await X().delete(`/v1/messaging/folders/${e}`);
|
|
@@ -204,57 +204,57 @@ const Pe = {
|
|
|
204
204
|
const r = await X().patch(`/v1/messaging/conversations/${e}/folder`, {
|
|
205
205
|
folder_id: n
|
|
206
206
|
});
|
|
207
|
-
return
|
|
207
|
+
return Mn($e(r.data));
|
|
208
208
|
},
|
|
209
209
|
async acceptRequest(e) {
|
|
210
210
|
const n = await X().post(`/v1/messaging/conversations/${e}/accept`);
|
|
211
|
-
return
|
|
211
|
+
return Mn($e(n.data));
|
|
212
212
|
},
|
|
213
213
|
async declineRequest(e) {
|
|
214
214
|
await X().post(`/v1/messaging/conversations/${e}/decline`);
|
|
215
215
|
}
|
|
216
|
-
},
|
|
217
|
-
function
|
|
216
|
+
}, go = 6e4;
|
|
217
|
+
function mo(e) {
|
|
218
218
|
return e === "online" || e === "idle" || e === "dnd" || e === "offline";
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function vo(e) {
|
|
221
221
|
if (typeof e != "string")
|
|
222
222
|
return null;
|
|
223
223
|
const n = e.trim().toLowerCase();
|
|
224
|
-
return
|
|
224
|
+
return mo(n) ? n : null;
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function ws(e) {
|
|
227
227
|
if (typeof e != "string")
|
|
228
228
|
return null;
|
|
229
229
|
const n = e.trim();
|
|
230
230
|
return n.length > 0 ? n : null;
|
|
231
231
|
}
|
|
232
|
-
function
|
|
233
|
-
const n =
|
|
232
|
+
function Dt(e) {
|
|
233
|
+
const n = ws(e);
|
|
234
234
|
if (n === null)
|
|
235
235
|
return null;
|
|
236
236
|
const r = n.includes("T") ? n : n.replace(" ", "T"), o = /(?:Z|[+-]\d{2}:\d{2})$/i.test(r) ? r : `${r}Z`, c = new Date(o);
|
|
237
237
|
return Number.isNaN(c.getTime()) ? null : c;
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function bo(e, n, r = {}) {
|
|
240
240
|
if (e === null)
|
|
241
241
|
return null;
|
|
242
242
|
if (e === "offline")
|
|
243
243
|
return "offline";
|
|
244
|
-
const o =
|
|
244
|
+
const o = Dt(n);
|
|
245
245
|
if (o === null)
|
|
246
246
|
return e;
|
|
247
|
-
const c = r.now ?? Date.now(), u = r.staleAfterMs ??
|
|
247
|
+
const c = r.now ?? Date.now(), u = r.staleAfterMs ?? go;
|
|
248
248
|
return c - o.getTime() > u ? "offline" : e;
|
|
249
249
|
}
|
|
250
|
-
function
|
|
251
|
-
const r =
|
|
250
|
+
function Nt(e, n = {}) {
|
|
251
|
+
const r = ws(e?.last_seen_at), o = vo(e?.status);
|
|
252
252
|
return {
|
|
253
|
-
status:
|
|
253
|
+
status: bo(o, r, n),
|
|
254
254
|
lastSeenAt: r
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
|
-
const
|
|
257
|
+
const kn = 1e3, Gt = 4e3, yo = 12e4, _o = 300, So = 1, Co = 1600, Jt = (e) => {
|
|
258
258
|
if (typeof e == "number" && Number.isFinite(e))
|
|
259
259
|
return e;
|
|
260
260
|
if (typeof e == "string") {
|
|
@@ -262,35 +262,35 @@ const Pn = 1e3, Wt = 4e3, vo = 12e4, bo = 300, yo = 1, _o = 1600, Gt = (e) => {
|
|
|
262
262
|
if (Number.isFinite(n))
|
|
263
263
|
return n;
|
|
264
264
|
}
|
|
265
|
-
},
|
|
266
|
-
const r =
|
|
267
|
-
return r === void 0 ? !0 : r === 429 ||
|
|
268
|
-
},
|
|
265
|
+
}, Ts = (e) => typeof e == "number" && e >= 500 && e < 600, xn = (e) => {
|
|
266
|
+
const r = Jt(e.response?.status);
|
|
267
|
+
return r === void 0 ? !0 : r === 429 || Ts(r);
|
|
268
|
+
}, Es = (e) => {
|
|
269
269
|
if (typeof e == "number" && Number.isFinite(e) && e > 0)
|
|
270
|
-
return Math.max(
|
|
270
|
+
return Math.max(kn, e * 1e3);
|
|
271
271
|
if (typeof e == "string") {
|
|
272
272
|
const n = Number.parseInt(e, 10);
|
|
273
273
|
if (Number.isFinite(n) && n > 0)
|
|
274
|
-
return Math.max(
|
|
274
|
+
return Math.max(kn, n * 1e3);
|
|
275
275
|
}
|
|
276
|
-
return
|
|
277
|
-
},
|
|
278
|
-
const n = Math.max(0, e), r = 2 ** Math.min(n, 6), o =
|
|
279
|
-
return Math.min(
|
|
280
|
-
},
|
|
276
|
+
return Gt;
|
|
277
|
+
}, wo = (e) => {
|
|
278
|
+
const n = Math.max(0, e), r = 2 ** Math.min(n, 6), o = Gt * r;
|
|
279
|
+
return Math.min(yo, o);
|
|
280
|
+
}, To = (e) => {
|
|
281
281
|
const n = e;
|
|
282
|
-
return
|
|
283
|
-
},
|
|
282
|
+
return Jt(n.response?.status) === 429 ? Es(n.response?.headers?.["retry-after"]) : _o;
|
|
283
|
+
}, Ln = async (e) => {
|
|
284
284
|
await new Promise((n) => {
|
|
285
285
|
setTimeout(n, e);
|
|
286
286
|
});
|
|
287
|
-
},
|
|
287
|
+
}, In = () => ({
|
|
288
288
|
data: [],
|
|
289
289
|
has_more: !1
|
|
290
|
-
}),
|
|
291
|
-
if (!
|
|
290
|
+
}), Un = () => Ot() === "account_suspended", Eo = (e) => {
|
|
291
|
+
if (!le(e))
|
|
292
292
|
return !1;
|
|
293
|
-
const r = (
|
|
293
|
+
const r = (le(e.data) ? e.data : e).throttled;
|
|
294
294
|
if (typeof r == "boolean")
|
|
295
295
|
return r;
|
|
296
296
|
if (typeof r == "number")
|
|
@@ -301,7 +301,7 @@ const Pn = 1e3, Wt = 4e3, vo = 12e4, bo = 300, yo = 1, _o = 1600, Gt = (e) => {
|
|
|
301
301
|
}
|
|
302
302
|
return !1;
|
|
303
303
|
};
|
|
304
|
-
function
|
|
304
|
+
function Ao(e, n, r) {
|
|
305
305
|
const o = typeof e == "string" && e.trim().length > 0 ? e.trim().toLowerCase() : void 0;
|
|
306
306
|
if (o)
|
|
307
307
|
return o;
|
|
@@ -311,17 +311,17 @@ function To(e, n, r) {
|
|
|
311
311
|
const u = typeof r == "string" && r.trim().length > 0 ? r.trim().toLowerCase() : void 0;
|
|
312
312
|
return u ? u === "image" ? "image/*" : u === "video" ? "video/*" : u === "audio" ? "audio/*" : u : "application/octet-stream";
|
|
313
313
|
}
|
|
314
|
-
function
|
|
314
|
+
function Ro(e) {
|
|
315
315
|
const n = e.url || "", r = e.thumbnail_url ?? e.thumbnail, o = {
|
|
316
316
|
id: e.media_id ?? e.id ?? "",
|
|
317
|
-
name: e.name ??
|
|
317
|
+
name: e.name ?? Po(n),
|
|
318
318
|
url: n,
|
|
319
|
-
type:
|
|
319
|
+
type: Ao(e.mime, e.mime_type, e.type),
|
|
320
320
|
size: e.size ?? 0
|
|
321
321
|
};
|
|
322
322
|
return r !== void 0 && (o.thumbnail = r), o;
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function Po(e) {
|
|
325
325
|
if (!e) return "attachment";
|
|
326
326
|
try {
|
|
327
327
|
const r = new URL(e).pathname.split("/");
|
|
@@ -330,8 +330,8 @@ function Ao(e) {
|
|
|
330
330
|
return "attachment";
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
|
-
function
|
|
334
|
-
return !Array.isArray(e) || e.length === 0 ? [] : e.map(
|
|
333
|
+
function Mo(e) {
|
|
334
|
+
return !Array.isArray(e) || e.length === 0 ? [] : e.map(Ro);
|
|
335
335
|
}
|
|
336
336
|
function Ne(e) {
|
|
337
337
|
if (typeof e != "string")
|
|
@@ -340,7 +340,7 @@ function Ne(e) {
|
|
|
340
340
|
if (n.length !== 0)
|
|
341
341
|
return n;
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function ko(e) {
|
|
344
344
|
if (!e)
|
|
345
345
|
return;
|
|
346
346
|
const n = Ne(e.avatar) ?? Ne(e.avatar_url), r = typeof e.handle == "string" && e.handle.length > 0 ? e.handle : void 0;
|
|
@@ -367,18 +367,18 @@ function at(e) {
|
|
|
367
367
|
} : null;
|
|
368
368
|
return {
|
|
369
369
|
...e,
|
|
370
|
-
...r ? { author:
|
|
370
|
+
...r ? { author: ko(r) } : {},
|
|
371
371
|
shared_post: o,
|
|
372
|
-
attachments:
|
|
372
|
+
attachments: Mo(e.attachments)
|
|
373
373
|
};
|
|
374
374
|
}
|
|
375
|
-
function
|
|
376
|
-
if (!e || !
|
|
375
|
+
function xo(e) {
|
|
376
|
+
if (!e || !le(e))
|
|
377
377
|
return;
|
|
378
378
|
const n = typeof e.id == "string" ? e.id.trim() : "", r = typeof e.title == "string" ? e.title.trim() : "", o = typeof e.url == "string" ? e.url.trim() : "";
|
|
379
379
|
if (n.length === 0 || r.length === 0 || o.length === 0)
|
|
380
380
|
return;
|
|
381
|
-
const c = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, u = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, d =
|
|
381
|
+
const c = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, u = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, d = le(e.author) ? e.author : null, f = d && typeof d.id == "string" ? d.id.trim() : "", h = d && typeof d.name == "string" ? d.name.trim() : "", P = d && typeof d.avatar == "string" && d.avatar.trim().length > 0 ? d.avatar.trim() : null, C = d && typeof d.handle == "string" && d.handle.trim().length > 0 ? d.handle.trim() : null;
|
|
382
382
|
return {
|
|
383
383
|
id: n,
|
|
384
384
|
title: r,
|
|
@@ -389,26 +389,26 @@ function Mo(e) {
|
|
|
389
389
|
author: {
|
|
390
390
|
id: f,
|
|
391
391
|
name: h,
|
|
392
|
-
...
|
|
392
|
+
...P ? { avatar: P } : {},
|
|
393
393
|
...C ? { handle: C } : {}
|
|
394
394
|
}
|
|
395
395
|
} : {}
|
|
396
396
|
};
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function Pt(e) {
|
|
399
399
|
return typeof e != "string" || e.length === 0 ? null : e;
|
|
400
400
|
}
|
|
401
|
-
function
|
|
401
|
+
function On(e) {
|
|
402
402
|
if (!(typeof e != "string" || e.length === 0))
|
|
403
403
|
return e;
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function qt(e) {
|
|
406
406
|
return typeof e == "string" && e.length > 0 && !e.startsWith("temp-");
|
|
407
407
|
}
|
|
408
|
-
function
|
|
408
|
+
function Lo(e, n = []) {
|
|
409
409
|
const r = /* @__PURE__ */ new Map();
|
|
410
410
|
for (const o of n) {
|
|
411
|
-
const c =
|
|
411
|
+
const c = On(o.last_read_message_id);
|
|
412
412
|
c && r.set(o.user_id, c);
|
|
413
413
|
}
|
|
414
414
|
return e.map((o) => {
|
|
@@ -417,7 +417,7 @@ function ko(e, n = []) {
|
|
|
417
417
|
name: o.user.name,
|
|
418
418
|
...u ? { avatar: u } : {},
|
|
419
419
|
...o.user.handle ? { handle: o.user.handle } : {}
|
|
420
|
-
} : void 0, f =
|
|
420
|
+
} : void 0, f = On(o.last_read_message_id);
|
|
421
421
|
if (f)
|
|
422
422
|
return {
|
|
423
423
|
...o,
|
|
@@ -442,14 +442,14 @@ function ko(e, n = []) {
|
|
|
442
442
|
};
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
|
-
function
|
|
446
|
-
return Object.prototype.hasOwnProperty.call(e, "muted_until") ?
|
|
445
|
+
function Io(e, n) {
|
|
446
|
+
return Object.prototype.hasOwnProperty.call(e, "muted_until") ? Pt(e.muted_until) : e.me?.muted_until === null ? null : typeof e.me?.muted_until == "string" ? Pt(e.me.muted_until) : Pt(n?.muted_until);
|
|
447
447
|
}
|
|
448
|
-
function
|
|
448
|
+
function Uo(e, n) {
|
|
449
449
|
return Object.prototype.hasOwnProperty.call(e, "folder_id") ? e.folder_id ?? null : e.me?.folder_id === null ? null : typeof e.me?.folder_id == "string" ? e.me.folder_id : n?.folder_id;
|
|
450
450
|
}
|
|
451
|
-
function
|
|
452
|
-
const r =
|
|
451
|
+
function He(e, n) {
|
|
452
|
+
const r = Io(e, n), o = typeof e.is_muted == "boolean" ? e.is_muted : r !== null || n?.is_muted === !0, c = e.last_message ? at(e.last_message) : n?.last_message, u = e.last_message_at ?? n?.last_message_at, d = typeof e.unread_count == "number" ? e.unread_count : n?.unread_count ?? 0, f = typeof e.is_pinned == "boolean" ? e.is_pinned : e.me?.is_pinned ?? n?.is_pinned ?? !1, h = typeof e.is_archived == "boolean" ? e.is_archived : e.me?.is_archived ?? n?.is_archived ?? !1, P = Uo(e, n), C = typeof e.created_at == "string" ? e.created_at : n?.created_at ?? "", v = (() => {
|
|
453
453
|
if (!n || n.unread_count !== 0 || d <= 0)
|
|
454
454
|
return !1;
|
|
455
455
|
const E = n.last_message?.id, b = e.last_message?.id;
|
|
@@ -458,47 +458,47 @@ function Be(e, n) {
|
|
|
458
458
|
return {
|
|
459
459
|
...e,
|
|
460
460
|
unread_count: o || v ? 0 : d,
|
|
461
|
-
participants:
|
|
461
|
+
participants: Lo(e.participants, n?.participants),
|
|
462
462
|
is_muted: o,
|
|
463
463
|
muted_until: r,
|
|
464
464
|
is_pinned: f,
|
|
465
465
|
is_archived: h,
|
|
466
|
-
folder_id:
|
|
466
|
+
folder_id: P,
|
|
467
467
|
created_at: C,
|
|
468
468
|
...c ? { last_message: c } : {},
|
|
469
469
|
...u ? { last_message_at: u } : {}
|
|
470
470
|
};
|
|
471
471
|
}
|
|
472
|
-
function
|
|
472
|
+
function Oo(e) {
|
|
473
473
|
return e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
474
474
|
}
|
|
475
|
-
function
|
|
476
|
-
return
|
|
475
|
+
function Mt(e) {
|
|
476
|
+
return Oo(e) ? 0 : e.unread_count || 0;
|
|
477
477
|
}
|
|
478
|
-
function
|
|
478
|
+
function Fn(e, n) {
|
|
479
479
|
const r = n[e.id];
|
|
480
480
|
if (Array.isArray(r))
|
|
481
481
|
for (let o = r.length - 1; o >= 0; o -= 1) {
|
|
482
482
|
const c = r[o]?.id;
|
|
483
|
-
if (
|
|
483
|
+
if (qt(c))
|
|
484
484
|
return c;
|
|
485
485
|
}
|
|
486
|
-
return
|
|
486
|
+
return qt(e.last_message?.id) ? e.last_message.id : null;
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function le(e) {
|
|
489
489
|
return typeof e == "object" && e !== null;
|
|
490
490
|
}
|
|
491
|
-
function
|
|
492
|
-
return
|
|
491
|
+
function Fo(e) {
|
|
492
|
+
return le(e) ? (le(e.response) ? e.response : null)?.status === 401 : !1;
|
|
493
493
|
}
|
|
494
|
-
function
|
|
494
|
+
function Dn(e) {
|
|
495
495
|
if (!Array.isArray(e))
|
|
496
496
|
return [];
|
|
497
497
|
const n = [];
|
|
498
498
|
for (const r of e) {
|
|
499
|
-
if (!
|
|
499
|
+
if (!le(r) || typeof r.reaction != "string" || typeof r.count != "number" || !Array.isArray(r.users))
|
|
500
500
|
continue;
|
|
501
|
-
const o = r.users.filter((c) =>
|
|
501
|
+
const o = r.users.filter((c) => le(c)).filter(
|
|
502
502
|
(c) => typeof c.id == "string" && typeof c.name == "string"
|
|
503
503
|
).map((c) => ({
|
|
504
504
|
id: c.id,
|
|
@@ -512,26 +512,26 @@ function On(e) {
|
|
|
512
512
|
}
|
|
513
513
|
return n;
|
|
514
514
|
}
|
|
515
|
-
function
|
|
516
|
-
const r =
|
|
515
|
+
function Do(e, n) {
|
|
516
|
+
const r = le(n) ? n : null, o = r?.next ?? r?.next_cursor ?? e.next_cursor;
|
|
517
517
|
if (!(typeof o != "string" || o.length === 0))
|
|
518
518
|
return o;
|
|
519
519
|
}
|
|
520
520
|
function st(e, n) {
|
|
521
|
-
const r =
|
|
521
|
+
const r = le(e) ? e : {}, o = r.data ?? e;
|
|
522
522
|
let c = [];
|
|
523
|
-
return Array.isArray(o) ? c = o :
|
|
523
|
+
return Array.isArray(o) ? c = o : le(o) && (Array.isArray(o.items) ? c = o.items : Array.isArray(o[n]) ? c = o[n] : Array.isArray(o.data) && (c = o.data)), {
|
|
524
524
|
items: c,
|
|
525
|
-
nextCursor:
|
|
525
|
+
nextCursor: Do(r, o)
|
|
526
526
|
};
|
|
527
527
|
}
|
|
528
|
-
function
|
|
529
|
-
return
|
|
528
|
+
function Nn(e) {
|
|
529
|
+
return le(e) && typeof e.id == "string" && e.id.length > 0;
|
|
530
530
|
}
|
|
531
|
-
function
|
|
532
|
-
return
|
|
531
|
+
function qn(e) {
|
|
532
|
+
return le(e) ? typeof e.id == "string" && (e.type === "dm" || e.type === "group") && Array.isArray(e.participants) : !1;
|
|
533
533
|
}
|
|
534
|
-
function
|
|
534
|
+
function Kt(e, n) {
|
|
535
535
|
if (e.type !== "dm")
|
|
536
536
|
return !1;
|
|
537
537
|
const r = e.participants.find((c) => c.user_id === n);
|
|
@@ -540,8 +540,8 @@ function Jt(e, n) {
|
|
|
540
540
|
const o = r.user.name.trim();
|
|
541
541
|
return r.user.id === n && o.length > 0 && o.toLowerCase() !== "pending user";
|
|
542
542
|
}
|
|
543
|
-
function
|
|
544
|
-
if (!
|
|
543
|
+
function zn(e) {
|
|
544
|
+
if (!le(e) || typeof e.id != "string" || typeof e.name != "string")
|
|
545
545
|
return null;
|
|
546
546
|
const n = {
|
|
547
547
|
id: e.id,
|
|
@@ -551,11 +551,11 @@ function Nn(e) {
|
|
|
551
551
|
const r = typeof e.avatar == "string" ? e.avatar : null, o = typeof e.avatar_url == "string" ? e.avatar_url : null, c = Ne(r) ?? Ne(o);
|
|
552
552
|
return c && (n.avatar = c, n.avatar_url = c), n;
|
|
553
553
|
}
|
|
554
|
-
function
|
|
555
|
-
const r = (
|
|
556
|
-
return Array.isArray(r) ? r.map((o) =>
|
|
554
|
+
function No(e) {
|
|
555
|
+
const r = (le(e) ? e : {}).data ?? e;
|
|
556
|
+
return Array.isArray(r) ? r.map((o) => zn(o)).filter((o) => o !== null) : le(r) ? Object.values(r).map((o) => zn(o)).filter((o) => o !== null) : [];
|
|
557
557
|
}
|
|
558
|
-
function
|
|
558
|
+
function As(e) {
|
|
559
559
|
if (e.type !== "dm")
|
|
560
560
|
return null;
|
|
561
561
|
const n = ke()().currentUser?.id;
|
|
@@ -566,19 +566,19 @@ function Ts(e) {
|
|
|
566
566
|
}
|
|
567
567
|
return e.participants.find((o) => o.user ? o.user.name.trim().toLowerCase() === "pending user" : !0)?.user_id ?? null;
|
|
568
568
|
}
|
|
569
|
-
async function
|
|
570
|
-
return (await
|
|
569
|
+
async function qo(e) {
|
|
570
|
+
return (await Rs([e])).get(e) ?? null;
|
|
571
571
|
}
|
|
572
|
-
async function
|
|
572
|
+
async function Rs(e) {
|
|
573
573
|
const n = Array.from(new Set(e.filter((r) => r.length > 0)));
|
|
574
574
|
if (n.length === 0)
|
|
575
575
|
return /* @__PURE__ */ new Map();
|
|
576
576
|
try {
|
|
577
|
-
const r = await
|
|
577
|
+
const r = await Vt().get("/v1/identity/users/by-ids", {
|
|
578
578
|
params: {
|
|
579
579
|
ids: n.join(",")
|
|
580
580
|
}
|
|
581
|
-
}), o =
|
|
581
|
+
}), o = No(r.data), c = /* @__PURE__ */ new Map();
|
|
582
582
|
for (const u of o)
|
|
583
583
|
n.includes(u.id) && c.set(u.id, {
|
|
584
584
|
id: u.id,
|
|
@@ -591,10 +591,10 @@ async function Es(e) {
|
|
|
591
591
|
return /* @__PURE__ */ new Map();
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
async function
|
|
595
|
-
if (e.type !== "dm" ||
|
|
594
|
+
async function jn(e, n) {
|
|
595
|
+
if (e.type !== "dm" || Kt(e, n))
|
|
596
596
|
return e;
|
|
597
|
-
const r = await
|
|
597
|
+
const r = await qo(n);
|
|
598
598
|
if (!r)
|
|
599
599
|
return e;
|
|
600
600
|
const o = e.participants.map((c) => c.user_id !== n ? c : {
|
|
@@ -606,15 +606,15 @@ async function qn(e, n) {
|
|
|
606
606
|
participants: o
|
|
607
607
|
};
|
|
608
608
|
}
|
|
609
|
-
async function
|
|
609
|
+
async function $n(e) {
|
|
610
610
|
const n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
|
|
611
611
|
for (const c of e) {
|
|
612
|
-
const u =
|
|
613
|
-
!u ||
|
|
612
|
+
const u = As(c);
|
|
613
|
+
!u || Kt(c, u) || (n.set(c.id, u), r.add(u));
|
|
614
614
|
}
|
|
615
615
|
if (r.size === 0)
|
|
616
616
|
return e;
|
|
617
|
-
const o = await
|
|
617
|
+
const o = await Rs(Array.from(r));
|
|
618
618
|
return o.size === 0 ? e : e.map((c) => {
|
|
619
619
|
const u = n.get(c.id);
|
|
620
620
|
if (!u)
|
|
@@ -629,7 +629,7 @@ async function zn(e) {
|
|
|
629
629
|
} : c;
|
|
630
630
|
});
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function Xe(e, n) {
|
|
633
633
|
if (e.is_pinned !== n.is_pinned)
|
|
634
634
|
return e.is_pinned ? -1 : 1;
|
|
635
635
|
const r = e.last_message_at ?? e.created_at, c = (n.last_message_at ?? n.created_at).localeCompare(r);
|
|
@@ -638,22 +638,22 @@ function ct(e, n) {
|
|
|
638
638
|
function rt(e, n) {
|
|
639
639
|
return [n, ...e.filter((r) => r.id !== n.id)];
|
|
640
640
|
}
|
|
641
|
-
function
|
|
641
|
+
function Be(e) {
|
|
642
642
|
return [...e].sort((n, r) => n.sort_order !== r.sort_order ? n.sort_order - r.sort_order : n.name.localeCompare(r.name));
|
|
643
643
|
}
|
|
644
|
-
function
|
|
644
|
+
function zo(e, n) {
|
|
645
645
|
return typeof e != "string" || e.length === 0 ? null : n.has(e) ? e : null;
|
|
646
646
|
}
|
|
647
|
-
function
|
|
647
|
+
function Hn(e, n) {
|
|
648
648
|
return e.map((r) => {
|
|
649
|
-
const o =
|
|
649
|
+
const o = zo(r.folder_id, n);
|
|
650
650
|
return (r.folder_id ?? null) === o ? r : {
|
|
651
651
|
...r,
|
|
652
652
|
folder_id: o
|
|
653
653
|
};
|
|
654
654
|
});
|
|
655
655
|
}
|
|
656
|
-
function
|
|
656
|
+
function Bn(e, n, r) {
|
|
657
657
|
let o = !1;
|
|
658
658
|
const c = e.map((u) => u.id !== n || (u.folder_id ?? null) === r ? u : (o = !0, {
|
|
659
659
|
...u,
|
|
@@ -661,7 +661,7 @@ function $n(e, n, r) {
|
|
|
661
661
|
}));
|
|
662
662
|
return o ? c : e;
|
|
663
663
|
}
|
|
664
|
-
function
|
|
664
|
+
function jo(e, n, r) {
|
|
665
665
|
if (n === r)
|
|
666
666
|
return e;
|
|
667
667
|
let o = !1;
|
|
@@ -674,15 +674,15 @@ function qo(e, n, r) {
|
|
|
674
674
|
});
|
|
675
675
|
return o ? c : e;
|
|
676
676
|
}
|
|
677
|
-
function
|
|
677
|
+
function kt(e) {
|
|
678
678
|
const n = /* @__PURE__ */ new Map();
|
|
679
679
|
for (const r of e.requests)
|
|
680
680
|
r.is_request === !0 && n.set(r.id, r);
|
|
681
681
|
for (const r of e.conversations)
|
|
682
682
|
r.is_request === !0 && n.set(r.id, r);
|
|
683
|
-
return Array.from(n.values()).sort(
|
|
683
|
+
return Array.from(n.values()).sort(Xe);
|
|
684
684
|
}
|
|
685
|
-
const
|
|
685
|
+
const Qt = Di("messaging", {
|
|
686
686
|
state: () => ({
|
|
687
687
|
conversations: [],
|
|
688
688
|
requests: [],
|
|
@@ -703,7 +703,8 @@ const Kt = Oi("messaging", {
|
|
|
703
703
|
backgroundPollTransientFailureCount: 0,
|
|
704
704
|
_pendingSendIds: /* @__PURE__ */ new Set(),
|
|
705
705
|
_activeDetailSubscriptions: /* @__PURE__ */ new Set(),
|
|
706
|
-
_activeGlobalConversationSubscriptions: /* @__PURE__ */ new Set()
|
|
706
|
+
_activeGlobalConversationSubscriptions: /* @__PURE__ */ new Set(),
|
|
707
|
+
activeListFilter: void 0
|
|
707
708
|
}),
|
|
708
709
|
getters: {
|
|
709
710
|
getConversationById: (e) => (n) => {
|
|
@@ -712,30 +713,30 @@ const Kt = Oi("messaging", {
|
|
|
712
713
|
},
|
|
713
714
|
getMessagesByConversationId: (e) => (n) => e.messages[n] || [],
|
|
714
715
|
getTypingUsers: (e) => (n) => e.typingUsers[n] || [],
|
|
715
|
-
unreadConversationsCount: (e) => e.conversations.filter((n) =>
|
|
716
|
-
unreadCount: (e) => e.conversations.reduce((n, r) => n +
|
|
717
|
-
totalUnreadCount: (e) => e.conversations.reduce((n, r) => n +
|
|
718
|
-
sortedFolders: (e) =>
|
|
716
|
+
unreadConversationsCount: (e) => e.conversations.filter((n) => Mt(n) > 0).length,
|
|
717
|
+
unreadCount: (e) => e.conversations.reduce((n, r) => n + Mt(r), 0),
|
|
718
|
+
totalUnreadCount: (e) => e.conversations.reduce((n, r) => n + Mt(r), 0),
|
|
719
|
+
sortedFolders: (e) => Be(e.folders),
|
|
719
720
|
folderById: (e) => (n) => e.folders.find((r) => r.id === n),
|
|
720
721
|
conversationsInFolder: (e) => (n) => e.conversations.filter((r) => r.folder_id === n),
|
|
721
722
|
hasMoreMessages: (e) => (n) => e.conversationHasMore[n] ?? !1,
|
|
722
723
|
isLoadingMessages: (e) => (n) => e.loadingMessages[n] ?? !1,
|
|
723
724
|
// Message request getters
|
|
724
|
-
requestConversations: (e) =>
|
|
725
|
-
requestCount: (e) =>
|
|
726
|
-
unreadRequestCount: (e) =>
|
|
725
|
+
requestConversations: (e) => kt(e),
|
|
726
|
+
requestCount: (e) => kt(e).length,
|
|
727
|
+
unreadRequestCount: (e) => kt(e).filter((n) => n.unread_count > 0).length
|
|
727
728
|
},
|
|
728
729
|
actions: {
|
|
729
730
|
normalizeFolderAssignmentsState() {
|
|
730
731
|
if (!this.foldersLoaded)
|
|
731
732
|
return;
|
|
732
733
|
const e = new Set(this.folders.map((n) => n.id));
|
|
733
|
-
this.conversations =
|
|
734
|
+
this.conversations = Hn(this.conversations, e), this.requests = Hn(this.requests, e), this.activeFolderId !== null && !e.has(this.activeFolderId) && (this.activeFolderId = null);
|
|
734
735
|
},
|
|
735
736
|
async fetchFolders() {
|
|
736
737
|
try {
|
|
737
738
|
const e = await Pe.fetchFolders();
|
|
738
|
-
return this.folders =
|
|
739
|
+
return this.folders = Be(e), this.foldersLoaded = !0, this.normalizeFolderAssignmentsState(), this.folders;
|
|
739
740
|
} catch (e) {
|
|
740
741
|
throw this.error = Y(e), e;
|
|
741
742
|
}
|
|
@@ -743,7 +744,7 @@ const Kt = Oi("messaging", {
|
|
|
743
744
|
async createFolder(e) {
|
|
744
745
|
try {
|
|
745
746
|
const n = await Pe.createFolder(e);
|
|
746
|
-
return this.folders =
|
|
747
|
+
return this.folders = Be([...this.folders, n]), n;
|
|
747
748
|
} catch (n) {
|
|
748
749
|
throw this.error = Y(n), n;
|
|
749
750
|
}
|
|
@@ -751,7 +752,7 @@ const Kt = Oi("messaging", {
|
|
|
751
752
|
async updateFolder(e, n) {
|
|
752
753
|
try {
|
|
753
754
|
const r = await Pe.updateFolder(e, n);
|
|
754
|
-
return this.folders =
|
|
755
|
+
return this.folders = Be(
|
|
755
756
|
this.folders.map((o) => o.id === e ? r : o)
|
|
756
757
|
), r;
|
|
757
758
|
} catch (r) {
|
|
@@ -776,7 +777,7 @@ const Kt = Oi("messaging", {
|
|
|
776
777
|
sort_order: r.length + 1
|
|
777
778
|
}), n.delete(c));
|
|
778
779
|
}
|
|
779
|
-
const o =
|
|
780
|
+
const o = Be(Array.from(n.values()));
|
|
780
781
|
for (const c of o)
|
|
781
782
|
r.push({
|
|
782
783
|
...c,
|
|
@@ -797,15 +798,15 @@ const Kt = Oi("messaging", {
|
|
|
797
798
|
if (!o)
|
|
798
799
|
return;
|
|
799
800
|
const c = o.folder_id ?? null, u = typeof r.folder_id == "string" || r.folder_id === null ? r.folder_id : n;
|
|
800
|
-
this.conversations =
|
|
801
|
+
this.conversations = Bn(
|
|
801
802
|
this.conversations,
|
|
802
803
|
e,
|
|
803
804
|
u
|
|
804
|
-
), this.requests =
|
|
805
|
+
), this.requests = Bn(
|
|
805
806
|
this.requests,
|
|
806
807
|
e,
|
|
807
808
|
u
|
|
808
|
-
), this.folders =
|
|
809
|
+
), this.folders = jo(
|
|
809
810
|
this.folders,
|
|
810
811
|
c,
|
|
811
812
|
u
|
|
@@ -817,19 +818,19 @@ const Kt = Oi("messaging", {
|
|
|
817
818
|
async fetchConversations(e, n, r, o) {
|
|
818
819
|
this.loading = !0, this.error = null;
|
|
819
820
|
try {
|
|
820
|
-
if (
|
|
821
|
-
return e || (this.conversations = [], this.normalizeFolderAssignmentsState()),
|
|
821
|
+
if (Un())
|
|
822
|
+
return e || (this.conversations = [], this.normalizeFolderAssignmentsState()), In();
|
|
822
823
|
const c = o?.includePresence ?? !0, u = {};
|
|
823
824
|
c && (u.include_presence = 1), e && (u.cursor = e), n && (u.filter = n), typeof r == "string" && r.length > 0 && (u.folder_id = r);
|
|
824
825
|
const d = await X().get("/v1/messaging/conversations", { params: u }), { items: f, nextCursor: h } = st(
|
|
825
826
|
d.data,
|
|
826
827
|
"conversations"
|
|
827
|
-
),
|
|
828
|
+
), P = f.map((E) => {
|
|
828
829
|
const b = this.conversations.find(
|
|
829
830
|
(A) => A.id === E.id
|
|
830
831
|
);
|
|
831
|
-
return
|
|
832
|
-
}), C = await
|
|
832
|
+
return He(E, b);
|
|
833
|
+
}), C = await $n(P);
|
|
833
834
|
e ? this.conversations.push(...C) : this.conversations = C, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
|
|
834
835
|
const v = {
|
|
835
836
|
data: C,
|
|
@@ -837,7 +838,7 @@ const Kt = Oi("messaging", {
|
|
|
837
838
|
};
|
|
838
839
|
return h !== void 0 && (v.next_cursor = h), v;
|
|
839
840
|
} catch (c) {
|
|
840
|
-
throw o?.background &&
|
|
841
|
+
throw o?.background && xn(c) || (this.error = Y(c)), c;
|
|
841
842
|
} finally {
|
|
842
843
|
this.loading = !1;
|
|
843
844
|
}
|
|
@@ -846,13 +847,13 @@ const Kt = Oi("messaging", {
|
|
|
846
847
|
if (Date.now() < this.backgroundPollRetryAfterUntil)
|
|
847
848
|
return !1;
|
|
848
849
|
try {
|
|
849
|
-
return await this.fetchConversations(void 0,
|
|
850
|
+
return await this.fetchConversations(void 0, this.activeListFilter, void 0, {
|
|
850
851
|
background: !0,
|
|
851
852
|
includePresence: !1
|
|
852
853
|
}), this.backgroundPollRetryAfterUntil = 0, this.backgroundPollTransientFailureCount = 0, !0;
|
|
853
854
|
} catch (e) {
|
|
854
|
-
const n = e, r =
|
|
855
|
-
return r === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() +
|
|
855
|
+
const n = e, r = Jt(n.response?.status);
|
|
856
|
+
return r === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() + Es(n.response?.headers?.["retry-after"]), !1) : (this.backgroundPollTransientFailureCount += 1, r === void 0 || Ts(r) ? (this.backgroundPollRetryAfterUntil = Date.now() + wo(this.backgroundPollTransientFailureCount), !1) : (this.backgroundPollRetryAfterUntil = Date.now() + Gt, !1));
|
|
856
857
|
}
|
|
857
858
|
},
|
|
858
859
|
async fetchConversation(e) {
|
|
@@ -861,9 +862,9 @@ const Kt = Oi("messaging", {
|
|
|
861
862
|
const n = await X().get(`/v1/messaging/conversations/${e}`, {
|
|
862
863
|
params: { include_presence: 1 }
|
|
863
864
|
}), r = this.conversations.find((f) => f.id === e);
|
|
864
|
-
let o =
|
|
865
|
-
const c =
|
|
866
|
-
c && (o = await
|
|
865
|
+
let o = He(n.data.data || n.data, r);
|
|
866
|
+
const c = As(o);
|
|
867
|
+
c && (o = await jn(o, c));
|
|
867
868
|
const u = this.conversations.findIndex((f) => f.id === e);
|
|
868
869
|
u >= 0 ? this.conversations[u] = o : this.conversations.push(o);
|
|
869
870
|
const d = this.requests.findIndex((f) => f.id === e);
|
|
@@ -877,8 +878,8 @@ const Kt = Oi("messaging", {
|
|
|
877
878
|
async fetchRequests(e) {
|
|
878
879
|
this.loading = !0, this.error = null;
|
|
879
880
|
try {
|
|
880
|
-
if (
|
|
881
|
-
return e || (this.requests = [], this.normalizeFolderAssignmentsState()),
|
|
881
|
+
if (Un())
|
|
882
|
+
return e || (this.requests = [], this.normalizeFolderAssignmentsState()), In();
|
|
882
883
|
const n = {
|
|
883
884
|
include_presence: 1,
|
|
884
885
|
filter: "requests"
|
|
@@ -888,9 +889,9 @@ const Kt = Oi("messaging", {
|
|
|
888
889
|
r.data,
|
|
889
890
|
"conversations"
|
|
890
891
|
), u = o.map((h) => {
|
|
891
|
-
const
|
|
892
|
-
return
|
|
893
|
-
}), d = await
|
|
892
|
+
const P = this.requests.find((C) => C.id === h.id);
|
|
893
|
+
return He(h, P);
|
|
894
|
+
}), d = await $n(u);
|
|
894
895
|
e ? this.requests.push(...d) : this.requests = d, this.normalizeFolderAssignmentsState();
|
|
895
896
|
const f = {
|
|
896
897
|
data: d,
|
|
@@ -913,9 +914,9 @@ const Kt = Oi("messaging", {
|
|
|
913
914
|
c = await X().get(`/v1/messaging/conversations/${e}/messages`, { params: r });
|
|
914
915
|
break;
|
|
915
916
|
} catch (v) {
|
|
916
|
-
if (!(o <
|
|
917
|
+
if (!(o < So && xn(v)))
|
|
917
918
|
throw v;
|
|
918
|
-
o += 1, await
|
|
919
|
+
o += 1, await Ln(To(v));
|
|
919
920
|
}
|
|
920
921
|
const { items: u, nextCursor: d } = st(
|
|
921
922
|
c.data,
|
|
@@ -941,13 +942,13 @@ const Kt = Oi("messaging", {
|
|
|
941
942
|
}
|
|
942
943
|
},
|
|
943
944
|
async sendMessage(e, n, r, o, c, u, d) {
|
|
944
|
-
const f = ke()(), h = `temp-${Date.now()}-${Math.random()}`,
|
|
945
|
+
const f = ke()(), h = `temp-${Date.now()}-${Math.random()}`, P = typeof u == "string" && u.trim().length > 0 ? u.trim() : null, C = xo(d), v = f.currentUser, E = {
|
|
945
946
|
id: h,
|
|
946
947
|
conversation_id: e,
|
|
947
948
|
author_id: v?.id || "",
|
|
948
949
|
body: n || "",
|
|
949
950
|
attachments: [],
|
|
950
|
-
meta:
|
|
951
|
+
meta: P ? { shared_post_id: P } : {},
|
|
951
952
|
...C ? { shared_post: C } : {},
|
|
952
953
|
is_deleted: !1,
|
|
953
954
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -964,13 +965,13 @@ const Kt = Oi("messaging", {
|
|
|
964
965
|
const A = {
|
|
965
966
|
body: n || "",
|
|
966
967
|
...o ? { reply_to_id: o } : {},
|
|
967
|
-
...
|
|
968
|
+
...P ? { shared_post_id: P } : {},
|
|
968
969
|
...C ? { shared_post_preview: C } : {}
|
|
969
970
|
};
|
|
970
971
|
if (r && r.length > 0) {
|
|
971
972
|
const W = await Promise.all(
|
|
972
973
|
r.map(async (te) => {
|
|
973
|
-
const k = await
|
|
974
|
+
const k = await uo().uploadImage(te);
|
|
974
975
|
return {
|
|
975
976
|
media_id: k.id,
|
|
976
977
|
mime: k.mime_type,
|
|
@@ -1037,11 +1038,11 @@ const Kt = Oi("messaging", {
|
|
|
1037
1038
|
return null;
|
|
1038
1039
|
for (let u = c.length - 1; u >= 0; u -= 1) {
|
|
1039
1040
|
const d = c[u]?.id;
|
|
1040
|
-
if (
|
|
1041
|
+
if (qt(d))
|
|
1041
1042
|
return d;
|
|
1042
1043
|
}
|
|
1043
1044
|
return null;
|
|
1044
|
-
})(), o = n ?
|
|
1045
|
+
})(), o = n ? Fn(n, this.messages) : r;
|
|
1045
1046
|
if (!o)
|
|
1046
1047
|
return;
|
|
1047
1048
|
await X().post(`/v1/messaging/conversations/${e}/read`, {
|
|
@@ -1060,7 +1061,7 @@ const Kt = Oi("messaging", {
|
|
|
1060
1061
|
if (e.length === 0)
|
|
1061
1062
|
return;
|
|
1062
1063
|
const n = e.map((c) => {
|
|
1063
|
-
const u =
|
|
1064
|
+
const u = Fn(c, this.messages);
|
|
1064
1065
|
return u ? {
|
|
1065
1066
|
conversationId: c.id,
|
|
1066
1067
|
messageId: u
|
|
@@ -1092,9 +1093,9 @@ const Kt = Oi("messaging", {
|
|
|
1092
1093
|
async sendTyping(e, n = "start") {
|
|
1093
1094
|
try {
|
|
1094
1095
|
const r = await X().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
1095
|
-
if (n !== "start" || !
|
|
1096
|
+
if (n !== "start" || !Eo(r.data))
|
|
1096
1097
|
return;
|
|
1097
|
-
await
|
|
1098
|
+
await Ln(Co), await X().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
|
|
1098
1099
|
} catch (r) {
|
|
1099
1100
|
console.warn("Failed to send typing indicator:", r);
|
|
1100
1101
|
}
|
|
@@ -1131,17 +1132,19 @@ const Kt = Oi("messaging", {
|
|
|
1131
1132
|
}
|
|
1132
1133
|
},
|
|
1133
1134
|
async pinConversation(e, n) {
|
|
1135
|
+
const r = this.conversations.find((c) => c.id === e), o = r?.is_pinned;
|
|
1136
|
+
r && (r.is_pinned = n), this.conversations.sort(Xe);
|
|
1134
1137
|
try {
|
|
1135
1138
|
await X().patch(`/v1/messaging/conversations/${e}/pin`, { pinned: n });
|
|
1136
|
-
|
|
1137
|
-
r && (r.is_pinned =
|
|
1138
|
-
} catch (r) {
|
|
1139
|
-
throw this.error = Y(r), r;
|
|
1139
|
+
} catch (c) {
|
|
1140
|
+
throw r && o !== void 0 && (r.is_pinned = o, this.conversations.sort(Xe)), this.error = Y(c), c;
|
|
1140
1141
|
}
|
|
1141
1142
|
},
|
|
1142
1143
|
async archiveConversation(e, n) {
|
|
1143
1144
|
try {
|
|
1144
|
-
await X().patch(`/v1/messaging/conversations/${e}/archive`, { archived: n })
|
|
1145
|
+
await X().patch(`/v1/messaging/conversations/${e}/archive`, { archived: n });
|
|
1146
|
+
const r = this.conversations.find((o) => o.id === e);
|
|
1147
|
+
r && (r.is_archived = n);
|
|
1145
1148
|
} catch (r) {
|
|
1146
1149
|
throw this.error = Y(r), r;
|
|
1147
1150
|
}
|
|
@@ -1160,10 +1163,10 @@ const Kt = Oi("messaging", {
|
|
|
1160
1163
|
};
|
|
1161
1164
|
n && (r.message = n);
|
|
1162
1165
|
const o = await X().post("/v1/messaging/conversations/dm", r), c = o.data.data || o.data;
|
|
1163
|
-
if (!
|
|
1166
|
+
if (!Nn(c))
|
|
1164
1167
|
throw new Error("Invalid conversation payload from DM create endpoint.");
|
|
1165
|
-
let u =
|
|
1166
|
-
return u = await
|
|
1168
|
+
let u = qn(c) && Kt(c, e) ? He(c) : await this.fetchConversation(c.id);
|
|
1169
|
+
return u = await jn(u, e), u.is_request === !0 ? (this.requests = rt(this.requests, u), this.conversations = this.conversations.filter((d) => d.id !== u.id), u) : (this.conversations = rt(this.conversations, u), this.requests = this.requests.filter((d) => d.id !== u.id), u);
|
|
1167
1170
|
} catch (r) {
|
|
1168
1171
|
throw this.error = Y(r), r;
|
|
1169
1172
|
}
|
|
@@ -1174,9 +1177,9 @@ const Kt = Oi("messaging", {
|
|
|
1174
1177
|
title: e,
|
|
1175
1178
|
participant_ids: n
|
|
1176
1179
|
}), o = r.data.data || r.data;
|
|
1177
|
-
if (!
|
|
1180
|
+
if (!Nn(o))
|
|
1178
1181
|
throw new Error("Invalid conversation payload from group create endpoint.");
|
|
1179
|
-
const c =
|
|
1182
|
+
const c = qn(o) ? o : await this.fetchConversation(o.id);
|
|
1180
1183
|
return this.conversations = rt(this.conversations, c), c;
|
|
1181
1184
|
} catch (r) {
|
|
1182
1185
|
throw this.error = Y(r), r;
|
|
@@ -1226,28 +1229,28 @@ const Kt = Oi("messaging", {
|
|
|
1226
1229
|
return;
|
|
1227
1230
|
this.messages[n] || (this.messages[n] = []);
|
|
1228
1231
|
const r = at({ ...e, attachments: e.attachments ?? [] }), o = this.messages[n];
|
|
1229
|
-
if (o.find((
|
|
1232
|
+
if (o.find((P) => P.id === r.id))
|
|
1230
1233
|
return;
|
|
1231
1234
|
const u = ke()();
|
|
1232
1235
|
if (r.author_id === u.currentUser?.id) {
|
|
1233
|
-
const
|
|
1234
|
-
if (
|
|
1235
|
-
const C = o[
|
|
1236
|
+
const P = o.findIndex((C) => C.id.startsWith("temp-"));
|
|
1237
|
+
if (P >= 0) {
|
|
1238
|
+
const C = o[P]?.id ?? "";
|
|
1236
1239
|
this.messages[n] = [
|
|
1237
|
-
...o.slice(0,
|
|
1240
|
+
...o.slice(0, P),
|
|
1238
1241
|
r,
|
|
1239
|
-
...o.slice(
|
|
1242
|
+
...o.slice(P + 1)
|
|
1240
1243
|
], this._pendingSendIds.delete(C), this.updateConversationLastMessage(n, r);
|
|
1241
1244
|
return;
|
|
1242
1245
|
}
|
|
1243
1246
|
}
|
|
1244
1247
|
const d = r.created_at;
|
|
1245
1248
|
let f = o.length;
|
|
1246
|
-
for (let
|
|
1247
|
-
const C = o[
|
|
1249
|
+
for (let P = o.length - 1; P >= 0; P--) {
|
|
1250
|
+
const C = o[P];
|
|
1248
1251
|
if (C && C.created_at <= d)
|
|
1249
1252
|
break;
|
|
1250
|
-
f =
|
|
1253
|
+
f = P;
|
|
1251
1254
|
}
|
|
1252
1255
|
const h = f === o.length;
|
|
1253
1256
|
this.messages[n] = [
|
|
@@ -1262,8 +1265,8 @@ const Kt = Oi("messaging", {
|
|
|
1262
1265
|
},
|
|
1263
1266
|
removeMessage(e, n) {
|
|
1264
1267
|
const r = (h) => {
|
|
1265
|
-
const
|
|
1266
|
-
return delete
|
|
1268
|
+
const P = { ...h, is_deleted: !0 };
|
|
1269
|
+
return delete P.body, P;
|
|
1267
1270
|
};
|
|
1268
1271
|
let o = null;
|
|
1269
1272
|
const c = this.conversations.find((h) => h.id === e);
|
|
@@ -1293,17 +1296,17 @@ const Kt = Oi("messaging", {
|
|
|
1293
1296
|
try {
|
|
1294
1297
|
f = await X().post(o, c);
|
|
1295
1298
|
} catch (v) {
|
|
1296
|
-
if (!
|
|
1299
|
+
if (!Fo(v))
|
|
1297
1300
|
throw v;
|
|
1298
1301
|
f = await X().post(o, c);
|
|
1299
1302
|
}
|
|
1300
|
-
const h =
|
|
1301
|
-
|
|
1303
|
+
const h = le(f.data) && "data" in f.data ? f.data.data : f.data, P = Dn(
|
|
1304
|
+
le(h) ? h.reactions : void 0
|
|
1302
1305
|
);
|
|
1303
|
-
(
|
|
1306
|
+
(P.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, P);
|
|
1304
1307
|
try {
|
|
1305
|
-
const v = await X().get(o), E =
|
|
1306
|
-
|
|
1308
|
+
const v = await X().get(o), E = le(v.data) && "data" in v.data ? v.data.data : v.data, b = Dn(
|
|
1309
|
+
le(E) ? E.reactions : void 0
|
|
1307
1310
|
);
|
|
1308
1311
|
this.updateMessageReactions(e, n, b);
|
|
1309
1312
|
} catch {
|
|
@@ -1332,8 +1335,8 @@ const Kt = Oi("messaging", {
|
|
|
1332
1335
|
if (!f) return;
|
|
1333
1336
|
const h = { ...f };
|
|
1334
1337
|
r !== void 0 && (h.body = r), o !== void 0 && (h.edited_at = o), c !== void 0 && (h.meta = c), u[d] = h;
|
|
1335
|
-
const
|
|
1336
|
-
|
|
1338
|
+
const P = this.conversations.find((v) => v.id === e);
|
|
1339
|
+
P?.last_message?.id === n && (P.last_message = h);
|
|
1337
1340
|
const C = this.requests.find((v) => v.id === e);
|
|
1338
1341
|
C?.last_message?.id === n && (C.last_message = h);
|
|
1339
1342
|
},
|
|
@@ -1349,7 +1352,7 @@ const Kt = Oi("messaging", {
|
|
|
1349
1352
|
const d = u.find((f) => f.id === e);
|
|
1350
1353
|
return d ? (d.last_message = n, d.last_message_at = n.created_at, !0) : !1;
|
|
1351
1354
|
}, o = r(this.conversations), c = r(this.requests);
|
|
1352
|
-
o && this.conversations.sort(
|
|
1355
|
+
o && this.conversations.sort(Xe), c && this.requests.sort(Xe);
|
|
1353
1356
|
},
|
|
1354
1357
|
updatePresenceForUser(e, n, r) {
|
|
1355
1358
|
const o = n === "online" || n === "idle" || n === "dnd", c = (u) => {
|
|
@@ -1368,7 +1371,7 @@ const Kt = Oi("messaging", {
|
|
|
1368
1371
|
params: { ids: n }
|
|
1369
1372
|
}), o = r.data?.data?.items ?? r.data?.items ?? [];
|
|
1370
1373
|
for (const c of o) {
|
|
1371
|
-
const u =
|
|
1374
|
+
const u = Nt(c);
|
|
1372
1375
|
u.status !== null && this.updatePresenceForUser(c.id, u.status, u.lastSeenAt);
|
|
1373
1376
|
}
|
|
1374
1377
|
},
|
|
@@ -1376,7 +1379,7 @@ const Kt = Oi("messaging", {
|
|
|
1376
1379
|
try {
|
|
1377
1380
|
const n = await Pe.acceptRequest(e);
|
|
1378
1381
|
this.requests = this.requests.filter((o) => o.id !== e);
|
|
1379
|
-
const r =
|
|
1382
|
+
const r = He({
|
|
1380
1383
|
...n,
|
|
1381
1384
|
is_pinned: n.is_pinned ?? !1,
|
|
1382
1385
|
is_archived: n.is_archived ?? !1,
|
|
@@ -1461,16 +1464,16 @@ const Kt = Oi("messaging", {
|
|
|
1461
1464
|
}
|
|
1462
1465
|
});
|
|
1463
1466
|
function oc(e) {
|
|
1464
|
-
const n =
|
|
1467
|
+
const n = Qt(), r = ke()(), o = be(!1), c = be(null), u = be(null), d = zt(), f = d !== null, h = 20, P = 250;
|
|
1465
1468
|
let C = 0, v = null, E = null;
|
|
1466
|
-
const b = se(() => r.currentUser?.id), A = () =>
|
|
1469
|
+
const b = se(() => r.currentUser?.id), A = () => is(e)?.trim() ?? "";
|
|
1467
1470
|
function w() {
|
|
1468
1471
|
v && (clearTimeout(v), v = null), C = 0;
|
|
1469
1472
|
}
|
|
1470
1473
|
function p() {
|
|
1471
1474
|
!f || o.value || v || C >= h || (v = setTimeout(() => {
|
|
1472
1475
|
v = null, C += 1, I();
|
|
1473
|
-
},
|
|
1476
|
+
}, P));
|
|
1474
1477
|
}
|
|
1475
1478
|
function m(_) {
|
|
1476
1479
|
if (n.addMessage(_.message), _.message.author_id !== b.value) {
|
|
@@ -1504,7 +1507,7 @@ function oc(e) {
|
|
|
1504
1507
|
function W(_) {
|
|
1505
1508
|
const L = n.getConversationById(_.conversation_id);
|
|
1506
1509
|
L && (L.is_request = !1), n.requests = n.requests.filter(
|
|
1507
|
-
(
|
|
1510
|
+
(he) => he.id !== _.conversation_id
|
|
1508
1511
|
);
|
|
1509
1512
|
}
|
|
1510
1513
|
function te(_) {
|
|
@@ -1513,7 +1516,7 @@ function oc(e) {
|
|
|
1513
1516
|
}
|
|
1514
1517
|
function k(_) {
|
|
1515
1518
|
const L = u.value;
|
|
1516
|
-
E && (E(), E = null), L && (_ && !n.hasGlobalConversationSubscription(L) &&
|
|
1519
|
+
E && (E(), E = null), L && (_ && !n.hasGlobalConversationSubscription(L) && Xi(L), n.unregisterDetailSubscription(L), u.value = null), o.value = !1;
|
|
1517
1520
|
}
|
|
1518
1521
|
function I() {
|
|
1519
1522
|
const _ = A();
|
|
@@ -1524,7 +1527,7 @@ function oc(e) {
|
|
|
1524
1527
|
}
|
|
1525
1528
|
c.value = null;
|
|
1526
1529
|
try {
|
|
1527
|
-
E =
|
|
1530
|
+
E = Vi(_, {
|
|
1528
1531
|
onMessageSent: m,
|
|
1529
1532
|
onMessageRead: y,
|
|
1530
1533
|
onMessageEdited: O,
|
|
@@ -1542,7 +1545,7 @@ function oc(e) {
|
|
|
1542
1545
|
o.value || I();
|
|
1543
1546
|
}
|
|
1544
1547
|
typeof window < "u" && window.addEventListener(Je(), K);
|
|
1545
|
-
const V =
|
|
1548
|
+
const V = ht((_) => {
|
|
1546
1549
|
if (_ === "connected") {
|
|
1547
1550
|
o.value || I();
|
|
1548
1551
|
return;
|
|
@@ -1577,19 +1580,19 @@ function oc(e) {
|
|
|
1577
1580
|
unsubscribe: G
|
|
1578
1581
|
};
|
|
1579
1582
|
}
|
|
1580
|
-
const
|
|
1581
|
-
},
|
|
1583
|
+
const Ps = () => () => {
|
|
1584
|
+
}, Ms = async () => {
|
|
1582
1585
|
}, ye = {
|
|
1583
1586
|
initializedEvent: "messenger-client:main-echo-initialized",
|
|
1584
1587
|
getEcho: () => null,
|
|
1585
1588
|
getConnectionStatus: () => "disconnected",
|
|
1586
|
-
onConnectionStatusChange:
|
|
1587
|
-
reconnect:
|
|
1589
|
+
onConnectionStatusChange: Ps,
|
|
1590
|
+
reconnect: Ms
|
|
1588
1591
|
};
|
|
1589
|
-
function
|
|
1592
|
+
function ct() {
|
|
1590
1593
|
return ye.initializedEvent;
|
|
1591
1594
|
}
|
|
1592
|
-
function
|
|
1595
|
+
function ut() {
|
|
1593
1596
|
return ye.getEcho();
|
|
1594
1597
|
}
|
|
1595
1598
|
function $o() {
|
|
@@ -1605,7 +1608,7 @@ function Vo(e) {
|
|
|
1605
1608
|
e.initializedEvent && (ye.initializedEvent = e.initializedEvent), e.getEcho && (ye.getEcho = e.getEcho), e.getConnectionStatus && (ye.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (ye.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (ye.reconnect = e.reconnect);
|
|
1606
1609
|
}
|
|
1607
1610
|
function Xo() {
|
|
1608
|
-
ye.initializedEvent = "messenger-client:main-echo-initialized", ye.getEcho = () => null, ye.getConnectionStatus = () => "disconnected", ye.onConnectionStatusChange =
|
|
1611
|
+
ye.initializedEvent = "messenger-client:main-echo-initialized", ye.getEcho = () => null, ye.getConnectionStatus = () => "disconnected", ye.onConnectionStatusChange = Ps, ye.reconnect = Ms;
|
|
1609
1612
|
}
|
|
1610
1613
|
const Wo = {
|
|
1611
1614
|
debug: () => {
|
|
@@ -1616,16 +1619,16 @@ const Wo = {
|
|
|
1616
1619
|
},
|
|
1617
1620
|
error: () => {
|
|
1618
1621
|
}
|
|
1619
|
-
},
|
|
1620
|
-
let
|
|
1621
|
-
function
|
|
1622
|
-
return
|
|
1622
|
+
}, ks = () => Wo;
|
|
1623
|
+
let Yt = ks;
|
|
1624
|
+
function Zt() {
|
|
1625
|
+
return Yt;
|
|
1623
1626
|
}
|
|
1624
1627
|
function Go(e) {
|
|
1625
|
-
|
|
1628
|
+
Yt = e;
|
|
1626
1629
|
}
|
|
1627
1630
|
function Jo() {
|
|
1628
|
-
|
|
1631
|
+
Yt = ks;
|
|
1629
1632
|
}
|
|
1630
1633
|
const Ko = {
|
|
1631
1634
|
connected: "",
|
|
@@ -1633,33 +1636,33 @@ const Ko = {
|
|
|
1633
1636
|
disconnected: "",
|
|
1634
1637
|
error: "",
|
|
1635
1638
|
unknown: ""
|
|
1636
|
-
},
|
|
1637
|
-
function
|
|
1639
|
+
}, Vn = Zt()("ConnectionStatus");
|
|
1640
|
+
function Xn(e) {
|
|
1638
1641
|
return e?.connector?.pusher?.connection ?? null;
|
|
1639
1642
|
}
|
|
1640
1643
|
function Qo(e) {
|
|
1641
1644
|
return e === "messenger" ? {
|
|
1642
1645
|
initializedEvent: Je(),
|
|
1643
|
-
getConnectionStatus:
|
|
1644
|
-
onConnectionStatusChange:
|
|
1645
|
-
reconnect:
|
|
1646
|
-
getEchoConnection: () =>
|
|
1646
|
+
getConnectionStatus: vs,
|
|
1647
|
+
onConnectionStatusChange: ht,
|
|
1648
|
+
reconnect: $i,
|
|
1649
|
+
getEchoConnection: () => Xn(Ae())
|
|
1647
1650
|
} : {
|
|
1648
|
-
initializedEvent:
|
|
1651
|
+
initializedEvent: ct(),
|
|
1649
1652
|
getConnectionStatus: $o,
|
|
1650
1653
|
onConnectionStatusChange: Ho,
|
|
1651
1654
|
reconnect: Bo,
|
|
1652
|
-
getEchoConnection: () =>
|
|
1655
|
+
getEchoConnection: () => Xn(ut())
|
|
1653
1656
|
};
|
|
1654
1657
|
}
|
|
1655
|
-
function
|
|
1658
|
+
function Wn(e) {
|
|
1656
1659
|
return e.getEchoConnection()?.state ?? null;
|
|
1657
1660
|
}
|
|
1658
1661
|
function ac(e = {}) {
|
|
1659
1662
|
const o = Qo(e.source ?? "app"), c = {
|
|
1660
1663
|
...Ko,
|
|
1661
1664
|
...e.icons
|
|
1662
|
-
}, u = be(o.getConnectionStatus()), d = be(null), f = be(0), h = be(!1),
|
|
1665
|
+
}, u = be(o.getConnectionStatus()), d = be(null), f = be(0), h = be(!1), P = be(!1), C = be(!1), v = be(!1);
|
|
1663
1666
|
let E = null, b = null, A = null, w = null, p = null, m = null, y = null;
|
|
1664
1667
|
const O = se(() => u.value === "connected"), z = se(() => u.value === "connecting"), J = se(() => u.value === "disconnected"), W = se(() => u.value === "error"), te = se(() => J.value || W.value), k = se(() => {
|
|
1665
1668
|
switch (u.value) {
|
|
@@ -1700,10 +1703,10 @@ function ac(e = {}) {
|
|
|
1700
1703
|
return c.unknown;
|
|
1701
1704
|
}
|
|
1702
1705
|
}), V = async () => {
|
|
1703
|
-
|
|
1706
|
+
Vn.debug("Manual reconnect triggered"), f.value += 1, await o.reconnect();
|
|
1704
1707
|
}, G = (B, D = u.value) => {
|
|
1705
1708
|
if (B !== "connecting" && b && (clearTimeout(b), b = null), B === "disconnected" || B === "error") {
|
|
1706
|
-
const q = !v.value && D === B, _e = !
|
|
1709
|
+
const q = !v.value && D === B, _e = !P.value && (q || D === "connected" || D === "connecting");
|
|
1707
1710
|
if (C.value = !0, _e) {
|
|
1708
1711
|
h.value = !1, A && clearTimeout(A), A = setTimeout(() => {
|
|
1709
1712
|
A = null, u.value !== "connected" && (h.value = !0);
|
|
@@ -1714,11 +1717,11 @@ function ac(e = {}) {
|
|
|
1714
1717
|
return;
|
|
1715
1718
|
}
|
|
1716
1719
|
if (B === "connected") {
|
|
1717
|
-
A && (clearTimeout(A), A = null), h.value = !1,
|
|
1720
|
+
A && (clearTimeout(A), A = null), h.value = !1, P.value = !1, C.value = !1;
|
|
1718
1721
|
return;
|
|
1719
1722
|
}
|
|
1720
1723
|
if (B === "connecting") {
|
|
1721
|
-
if (A && (clearTimeout(A), A = null),
|
|
1724
|
+
if (A && (clearTimeout(A), A = null), P.value) {
|
|
1722
1725
|
h.value = !0;
|
|
1723
1726
|
return;
|
|
1724
1727
|
}
|
|
@@ -1726,23 +1729,23 @@ function ac(e = {}) {
|
|
|
1726
1729
|
return;
|
|
1727
1730
|
b = setTimeout(() => {
|
|
1728
1731
|
if (b = null, u.value === "connecting") {
|
|
1729
|
-
if (
|
|
1732
|
+
if (Wn(o) === "connected") {
|
|
1730
1733
|
_("connected");
|
|
1731
1734
|
return;
|
|
1732
1735
|
}
|
|
1733
|
-
|
|
1736
|
+
P.value = !0, Vn.warn("Still connecting after 10s, treating as disconnected"), _("disconnected"), f.value += 1, o.reconnect();
|
|
1734
1737
|
}
|
|
1735
1738
|
}, 1e4);
|
|
1736
1739
|
}
|
|
1737
1740
|
}, _ = (B) => {
|
|
1738
1741
|
const D = u.value;
|
|
1739
|
-
if (B === "connecting" &&
|
|
1742
|
+
if (B === "connecting" && P.value) {
|
|
1740
1743
|
u.value = "disconnected", G("disconnected", D);
|
|
1741
1744
|
return;
|
|
1742
1745
|
}
|
|
1743
1746
|
u.value = B, B === "connecting" && (D === "disconnected" || D === "error") && f.value === 0 && (f.value = 1), B === "connected" && (d.value = /* @__PURE__ */ new Date(), f.value = 0), G(B, D);
|
|
1744
1747
|
}, L = () => {
|
|
1745
|
-
const B =
|
|
1748
|
+
const B = Wn(o), D = u.value;
|
|
1746
1749
|
if (B === "connected" && D !== "connected") {
|
|
1747
1750
|
_("connected");
|
|
1748
1751
|
return;
|
|
@@ -1757,7 +1760,7 @@ function ac(e = {}) {
|
|
|
1757
1760
|
}
|
|
1758
1761
|
const q = o.getConnectionStatus();
|
|
1759
1762
|
!B && q === "connected" && D !== "connected" && _("connected");
|
|
1760
|
-
},
|
|
1763
|
+
}, he = () => {
|
|
1761
1764
|
if (p?.unbind && y && (p.unbind("connected", y.connected), p.unbind("connecting", y.connecting), p.unbind("disconnected", y.disconnected), p.unbind("unavailable", y.unavailable), p.unbind("error", y.error), p.unbind("state_change", y.stateChange)), p = o.getEchoConnection(), y = null, !p?.bind)
|
|
1762
1765
|
return;
|
|
1763
1766
|
y = {
|
|
@@ -1795,9 +1798,9 @@ function ac(e = {}) {
|
|
|
1795
1798
|
const B = Date.now() - d.value.getTime(), D = Math.floor(B / 6e4), q = Math.floor(B % 6e4 / 1e3);
|
|
1796
1799
|
return D > 0 ? `${D}m ${q}s` : `${q}s`;
|
|
1797
1800
|
});
|
|
1798
|
-
return
|
|
1799
|
-
u.value = o.getConnectionStatus(), E = o.onConnectionStatusChange(_), O.value && (d.value = /* @__PURE__ */ new Date()), G(u.value, u.value), v.value = !0,
|
|
1800
|
-
|
|
1801
|
+
return jt(() => {
|
|
1802
|
+
u.value = o.getConnectionStatus(), E = o.onConnectionStatusChange(_), O.value && (d.value = /* @__PURE__ */ new Date()), G(u.value, u.value), v.value = !0, he(), m = () => {
|
|
1803
|
+
he(), L();
|
|
1801
1804
|
}, window.addEventListener(o.initializedEvent, m), L(), w = setInterval(() => {
|
|
1802
1805
|
L();
|
|
1803
1806
|
}, 3e3);
|
|
@@ -1820,25 +1823,25 @@ function ac(e = {}) {
|
|
|
1820
1823
|
reconnect: V
|
|
1821
1824
|
};
|
|
1822
1825
|
}
|
|
1823
|
-
const
|
|
1826
|
+
const xs = () => {
|
|
1824
1827
|
};
|
|
1825
|
-
let
|
|
1828
|
+
let en = xs;
|
|
1826
1829
|
function Yo() {
|
|
1827
|
-
return
|
|
1830
|
+
return en;
|
|
1828
1831
|
}
|
|
1829
1832
|
function Zo(e) {
|
|
1830
|
-
|
|
1833
|
+
en = e;
|
|
1831
1834
|
}
|
|
1832
1835
|
function ea() {
|
|
1833
|
-
|
|
1836
|
+
en = xs;
|
|
1834
1837
|
}
|
|
1835
|
-
const Me =
|
|
1838
|
+
const Me = Zt()("GlobalMessaging"), ta = 3, na = (e) => e.replace(/\/+$/, ""), sa = (e) => na(window.location.pathname) === `/messages/${e}`, ra = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
|
|
1836
1839
|
function cc() {
|
|
1837
|
-
const e =
|
|
1840
|
+
const e = Qt(), n = ke()(), r = Yo(), o = Vt(), c = zi(), u = zt(), { conversations: d, requestConversations: f } = Ni(e), h = /* @__PURE__ */ new Set(), P = /* @__PURE__ */ new Map();
|
|
1838
1841
|
let C = !1;
|
|
1839
1842
|
function v(k) {
|
|
1840
|
-
const I =
|
|
1841
|
-
if (I && (
|
|
1843
|
+
const I = P.get(k);
|
|
1844
|
+
if (I && (P.delete(k), typeof I.channel.stopListening == "function"))
|
|
1842
1845
|
for (const K of I.bindings)
|
|
1843
1846
|
try {
|
|
1844
1847
|
I.channel.stopListening(K.event, K.handler);
|
|
@@ -1856,7 +1859,7 @@ function cc() {
|
|
|
1856
1859
|
const K = `conversation.${k}`;
|
|
1857
1860
|
v(k);
|
|
1858
1861
|
const V = I.private(K), G = (D) => {
|
|
1859
|
-
if (!
|
|
1862
|
+
if (!Qi(D)) {
|
|
1860
1863
|
Me.warn("Dropping malformed ConversationMessageSent event", D);
|
|
1861
1864
|
return;
|
|
1862
1865
|
}
|
|
@@ -1865,31 +1868,31 @@ function cc() {
|
|
|
1865
1868
|
e.addMessage(q.message);
|
|
1866
1869
|
const M = e.hasDetailSubscription(q.conversation_id), F = sa(q.conversation_id);
|
|
1867
1870
|
if (M || F) {
|
|
1868
|
-
const
|
|
1869
|
-
|
|
1871
|
+
const ie = e.getConversationById(q.conversation_id);
|
|
1872
|
+
ie && (ie.unread_count = 0), e.markAsRead(q.conversation_id).catch(() => {
|
|
1870
1873
|
});
|
|
1871
1874
|
return;
|
|
1872
1875
|
}
|
|
1873
1876
|
const Z = e.getConversationById(q.conversation_id);
|
|
1874
1877
|
if (Z) {
|
|
1875
|
-
const
|
|
1876
|
-
|
|
1878
|
+
const ie = ra(Z);
|
|
1879
|
+
ie || Z.unread_count++, r(ie);
|
|
1877
1880
|
}
|
|
1878
1881
|
}, _ = (D) => {
|
|
1879
|
-
if (!
|
|
1882
|
+
if (!Yi(D)) {
|
|
1880
1883
|
Me.warn("Dropping malformed ConversationMessageRead event", D);
|
|
1881
1884
|
return;
|
|
1882
1885
|
}
|
|
1883
1886
|
e.applyParticipantReadState(D);
|
|
1884
1887
|
}, L = (D) => {
|
|
1885
|
-
if (!
|
|
1888
|
+
if (!to(D)) {
|
|
1886
1889
|
Me.warn("Dropping malformed MessageReactionToggled event", D);
|
|
1887
1890
|
return;
|
|
1888
1891
|
}
|
|
1889
1892
|
const q = D;
|
|
1890
1893
|
e.updateMessageReactions(q.conversation_id, q.message_id, q.reactions);
|
|
1891
|
-
},
|
|
1892
|
-
if (!
|
|
1894
|
+
}, he = (D) => {
|
|
1895
|
+
if (!Zi(D)) {
|
|
1893
1896
|
Me.warn("Dropping malformed ConversationMessageEdited event", D);
|
|
1894
1897
|
return;
|
|
1895
1898
|
}
|
|
@@ -1902,14 +1905,14 @@ function cc() {
|
|
|
1902
1905
|
q.message.meta
|
|
1903
1906
|
);
|
|
1904
1907
|
}, Se = (D) => {
|
|
1905
|
-
if (!
|
|
1908
|
+
if (!eo(D)) {
|
|
1906
1909
|
Me.warn("Dropping malformed ConversationMessageDeleted event", D);
|
|
1907
1910
|
return;
|
|
1908
1911
|
}
|
|
1909
1912
|
const q = D;
|
|
1910
1913
|
e.removeMessage(q.conversation_id, q.message_id);
|
|
1911
1914
|
}, B = (D) => {
|
|
1912
|
-
if (!
|
|
1915
|
+
if (!no(D)) {
|
|
1913
1916
|
Me.warn("Dropping malformed ConversationRequestAccepted event", D);
|
|
1914
1917
|
return;
|
|
1915
1918
|
}
|
|
@@ -1918,12 +1921,12 @@ function cc() {
|
|
|
1918
1921
|
(M) => M.id !== q.conversation_id
|
|
1919
1922
|
);
|
|
1920
1923
|
};
|
|
1921
|
-
V.listen(".ConversationMessageSent", G), V.listen(".ConversationMessageRead", _), V.listen(".ConversationMessageEdited",
|
|
1924
|
+
V.listen(".ConversationMessageSent", G), V.listen(".ConversationMessageRead", _), V.listen(".ConversationMessageEdited", he), V.listen(".ConversationMessageDeleted", Se), V.listen(".MessageReactionToggled", L), V.listen(".ConversationRequestAccepted", B), P.set(k, {
|
|
1922
1925
|
channel: V,
|
|
1923
1926
|
bindings: [
|
|
1924
1927
|
{ event: ".ConversationMessageSent", handler: G },
|
|
1925
1928
|
{ event: ".ConversationMessageRead", handler: _ },
|
|
1926
|
-
{ event: ".ConversationMessageEdited", handler:
|
|
1929
|
+
{ event: ".ConversationMessageEdited", handler: he },
|
|
1927
1930
|
{ event: ".ConversationMessageDeleted", handler: Se },
|
|
1928
1931
|
{ event: ".MessageReactionToggled", handler: L },
|
|
1929
1932
|
{ event: ".ConversationRequestAccepted", handler: B }
|
|
@@ -1968,7 +1971,7 @@ function cc() {
|
|
|
1968
1971
|
b(V.id);
|
|
1969
1972
|
}
|
|
1970
1973
|
function p(k) {
|
|
1971
|
-
const I =
|
|
1974
|
+
const I = Nt({
|
|
1972
1975
|
status: k.status,
|
|
1973
1976
|
last_seen_at: k.last_seen_at ?? null
|
|
1974
1977
|
});
|
|
@@ -1988,7 +1991,7 @@ function cc() {
|
|
|
1988
1991
|
params: { ids: k }
|
|
1989
1992
|
}), K = I.data?.data?.items ?? I.data?.items ?? [];
|
|
1990
1993
|
for (const V of K) {
|
|
1991
|
-
const G =
|
|
1994
|
+
const G = Nt(V);
|
|
1992
1995
|
G.status !== null && e.updatePresenceForUser(V.id, G.status, G.lastSeenAt);
|
|
1993
1996
|
}
|
|
1994
1997
|
} catch (I) {
|
|
@@ -1996,10 +1999,10 @@ function cc() {
|
|
|
1996
1999
|
}
|
|
1997
2000
|
}
|
|
1998
2001
|
function y() {
|
|
1999
|
-
!Ae() || C || (
|
|
2002
|
+
!Ae() || C || (Hi(p), C = !0);
|
|
2000
2003
|
}
|
|
2001
2004
|
function O() {
|
|
2002
|
-
C && (
|
|
2005
|
+
C && (Bi(), C = !1);
|
|
2003
2006
|
}
|
|
2004
2007
|
const z = ot(
|
|
2005
2008
|
d,
|
|
@@ -2018,10 +2021,10 @@ function cc() {
|
|
|
2018
2021
|
() => {
|
|
2019
2022
|
w();
|
|
2020
2023
|
}
|
|
2021
|
-
), te =
|
|
2024
|
+
), te = ht((k) => {
|
|
2022
2025
|
k === "connected" ? (E(), w(), O(), y(), m()) : (k === "disconnected" || k === "error") && (E(), O());
|
|
2023
2026
|
});
|
|
2024
|
-
w(), y(), m(), Ae() ||
|
|
2027
|
+
w(), y(), m(), Ae() || ms().then((k) => {
|
|
2025
2028
|
k && (E(), w(), O(), y(), m());
|
|
2026
2029
|
}).catch((k) => {
|
|
2027
2030
|
Me.warn("Failed to eagerly initialize messenger echo", k);
|
|
@@ -2030,10 +2033,10 @@ function cc() {
|
|
|
2030
2033
|
});
|
|
2031
2034
|
}
|
|
2032
2035
|
function uc() {
|
|
2033
|
-
const e = be(
|
|
2036
|
+
const e = be(Ot());
|
|
2034
2037
|
let n = null;
|
|
2035
|
-
return
|
|
2036
|
-
e.value =
|
|
2038
|
+
return jt(() => {
|
|
2039
|
+
e.value = Ot(), n = ji((r) => {
|
|
2037
2040
|
e.value = r;
|
|
2038
2041
|
});
|
|
2039
2042
|
}), qe(() => {
|
|
@@ -2044,7 +2047,7 @@ function uc() {
|
|
|
2044
2047
|
isSuspended: se(() => e.value === "account_suspended")
|
|
2045
2048
|
};
|
|
2046
2049
|
}
|
|
2047
|
-
const
|
|
2050
|
+
const Ls = () => null, Is = {
|
|
2048
2051
|
sessionOpenUrl: "/v1/presence/session/open",
|
|
2049
2052
|
sessionHeartbeatUrl: "/v1/presence/heartbeat",
|
|
2050
2053
|
sessionCloseUrl: "/v1/presence/session/close",
|
|
@@ -2055,29 +2058,29 @@ const ks = () => null, xs = {
|
|
|
2055
2058
|
activityDebounceMs: 5e3,
|
|
2056
2059
|
heartbeatIntervalMs: 3e4,
|
|
2057
2060
|
userAgentResolver: () => navigator.userAgent.slice(0, 256),
|
|
2058
|
-
authTokenResolver:
|
|
2061
|
+
authTokenResolver: Ls
|
|
2059
2062
|
};
|
|
2060
|
-
let
|
|
2063
|
+
let lt = { ...Is };
|
|
2061
2064
|
function ia() {
|
|
2062
|
-
return
|
|
2065
|
+
return lt;
|
|
2063
2066
|
}
|
|
2064
2067
|
function oa(e) {
|
|
2065
|
-
|
|
2066
|
-
...
|
|
2068
|
+
lt = {
|
|
2069
|
+
...lt,
|
|
2067
2070
|
...e
|
|
2068
2071
|
};
|
|
2069
2072
|
}
|
|
2070
2073
|
function aa() {
|
|
2071
|
-
|
|
2074
|
+
lt = { ...Is };
|
|
2072
2075
|
}
|
|
2073
2076
|
function ca(e) {
|
|
2074
|
-
return e.authTokenResolver !==
|
|
2077
|
+
return e.authTokenResolver !== Ls;
|
|
2075
2078
|
}
|
|
2076
2079
|
const ua = 429, la = 403, da = 423, ha = "ACCOUNT_LIMITED", fa = "ACCOUNT_SUSPENDED", pa = "ACCOUNT_WRITE_TIMEOUT", ga = 2, ma = 5 * 6e4;
|
|
2077
2080
|
function We(e) {
|
|
2078
2081
|
return typeof e == "object" && e !== null;
|
|
2079
2082
|
}
|
|
2080
|
-
function
|
|
2083
|
+
function Us(e) {
|
|
2081
2084
|
if (!We(e))
|
|
2082
2085
|
return null;
|
|
2083
2086
|
const n = e.response;
|
|
@@ -2092,7 +2095,7 @@ function Ls(e) {
|
|
|
2092
2095
|
}
|
|
2093
2096
|
return null;
|
|
2094
2097
|
}
|
|
2095
|
-
function
|
|
2098
|
+
function Os(e) {
|
|
2096
2099
|
if (!We(e))
|
|
2097
2100
|
return null;
|
|
2098
2101
|
const n = e.response;
|
|
@@ -2101,12 +2104,12 @@ function Is(e) {
|
|
|
2101
2104
|
const r = n.data;
|
|
2102
2105
|
return We(r) && typeof r.code == "string" ? r.code : null;
|
|
2103
2106
|
}
|
|
2104
|
-
function
|
|
2105
|
-
const n =
|
|
2107
|
+
function xt(e) {
|
|
2108
|
+
const n = Us(e), r = Os(e);
|
|
2106
2109
|
return n === ua && r === ha || n === da && r === pa;
|
|
2107
2110
|
}
|
|
2108
|
-
function
|
|
2109
|
-
const n =
|
|
2111
|
+
function Lt(e) {
|
|
2112
|
+
const n = Us(e), r = Os(e);
|
|
2110
2113
|
return n === la && r === fa ? !0 : e instanceof Error ? e.message.toLowerCase().includes("suspended") : !1;
|
|
2111
2114
|
}
|
|
2112
2115
|
function Ke() {
|
|
@@ -2126,7 +2129,7 @@ function ba(e) {
|
|
|
2126
2129
|
const o = Number.parseInt(r, 10);
|
|
2127
2130
|
return Number.isFinite(o) ? o : (n?.removeItem(e), null);
|
|
2128
2131
|
}
|
|
2129
|
-
function
|
|
2132
|
+
function It(e, n = Date.now()) {
|
|
2130
2133
|
const r = Ke(), o = ba(e);
|
|
2131
2134
|
return o === null ? !1 : o <= n ? (r?.removeItem(e), !1) : !0;
|
|
2132
2135
|
}
|
|
@@ -2182,8 +2185,8 @@ function Ta(e, n, r) {
|
|
|
2182
2185
|
}
|
|
2183
2186
|
}
|
|
2184
2187
|
function lc() {
|
|
2185
|
-
const e = ke()(), n = ia(), r =
|
|
2186
|
-
let c = null, u = null, d = !1, f =
|
|
2188
|
+
const e = ke()(), n = ia(), r = Vt(), o = va(n.clientIdStorageKey);
|
|
2189
|
+
let c = null, u = null, d = !1, f = It(n.accountLimitedUntilStorageKey), h = !1, P = !1, C = null, v = 0;
|
|
2187
2190
|
const E = () => ca(n) ? n.authTokenResolver() !== null : !0, b = () => {
|
|
2188
2191
|
c && (clearInterval(c), c = null);
|
|
2189
2192
|
}, A = () => {
|
|
@@ -2195,22 +2198,22 @@ function lc() {
|
|
|
2195
2198
|
}, p = (L) => {
|
|
2196
2199
|
f || console.warn(L), ya(n.accountLimitedUntilStorageKey), f = !0, d = !1, C = null, b(), A();
|
|
2197
2200
|
}, m = async (L) => {
|
|
2198
|
-
if (!(!d ||
|
|
2201
|
+
if (!(!d || P || f || h) && E() && C !== L)
|
|
2199
2202
|
try {
|
|
2200
2203
|
await r.patch(n.statusUrl, { status: L }), C = L;
|
|
2201
|
-
} catch (
|
|
2202
|
-
if (
|
|
2204
|
+
} catch (he) {
|
|
2205
|
+
if (xt(he)) {
|
|
2203
2206
|
p("[Presence] Presence updates paused: account is temporarily limited");
|
|
2204
2207
|
return;
|
|
2205
2208
|
}
|
|
2206
|
-
|
|
2209
|
+
Lt(he) && (h = !0, d = !1, C = null, b(), A());
|
|
2207
2210
|
}
|
|
2208
2211
|
}, y = () => {
|
|
2209
|
-
A(), !(!d ||
|
|
2212
|
+
A(), !(!d || P || f || h || document.visibilityState !== "visible") && (u = setTimeout(() => {
|
|
2210
2213
|
u = null, m("idle");
|
|
2211
2214
|
}, n.idleAfterMs));
|
|
2212
2215
|
}, O = () => {
|
|
2213
|
-
if (
|
|
2216
|
+
if (P || !d || f || h || document.visibilityState !== "visible")
|
|
2214
2217
|
return;
|
|
2215
2218
|
const L = Date.now();
|
|
2216
2219
|
L - v < n.activityDebounceMs || (v = L, m("online"), y());
|
|
@@ -2221,7 +2224,7 @@ function lc() {
|
|
|
2221
2224
|
}, W = () => {
|
|
2222
2225
|
typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", z), document.removeEventListener("keydown", z), document.removeEventListener("touchstart", z), window.removeEventListener("focus", z));
|
|
2223
2226
|
}, te = async () => {
|
|
2224
|
-
if (
|
|
2227
|
+
if (It(n.accountLimitedUntilStorageKey))
|
|
2225
2228
|
return f = !0, "account_limited";
|
|
2226
2229
|
try {
|
|
2227
2230
|
return await r.post(n.sessionOpenUrl, {
|
|
@@ -2229,7 +2232,7 @@ function lc() {
|
|
|
2229
2232
|
user_agent: n.userAgentResolver()
|
|
2230
2233
|
}), _a(n.accountLimitedUntilStorageKey), f = !1, h = !1, d = !0, C = null, "opened";
|
|
2231
2234
|
} catch (L) {
|
|
2232
|
-
return
|
|
2235
|
+
return xt(L) ? (p("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : Lt(L) ? (h = !0, d = !1, C = null, b(), A(), "account_suspended") : "failed";
|
|
2233
2236
|
}
|
|
2234
2237
|
}, k = async () => {
|
|
2235
2238
|
for (let L = 0; L < ga; L += 1)
|
|
@@ -2241,11 +2244,11 @@ function lc() {
|
|
|
2241
2244
|
try {
|
|
2242
2245
|
await r.post(n.sessionHeartbeatUrl, { client_id: o });
|
|
2243
2246
|
} catch (L) {
|
|
2244
|
-
if (
|
|
2247
|
+
if (xt(L)) {
|
|
2245
2248
|
p("[Presence] Heartbeat paused: account is temporarily limited");
|
|
2246
2249
|
return;
|
|
2247
2250
|
}
|
|
2248
|
-
|
|
2251
|
+
Lt(L) && (h = !0, d = !1, C = null, b(), A());
|
|
2249
2252
|
}
|
|
2250
2253
|
}, K = () => {
|
|
2251
2254
|
if (!d)
|
|
@@ -2264,45 +2267,45 @@ function lc() {
|
|
|
2264
2267
|
r.post(n.sessionCloseUrl, { client_id: o }).catch(() => {
|
|
2265
2268
|
});
|
|
2266
2269
|
}, V = async () => {
|
|
2267
|
-
if (!
|
|
2268
|
-
if (await k(),
|
|
2270
|
+
if (!P) {
|
|
2271
|
+
if (await k(), P) {
|
|
2269
2272
|
K();
|
|
2270
2273
|
return;
|
|
2271
2274
|
}
|
|
2272
2275
|
d && (w(), m("online"), y());
|
|
2273
2276
|
}
|
|
2274
2277
|
}, G = () => {
|
|
2275
|
-
if (!
|
|
2278
|
+
if (!P) {
|
|
2276
2279
|
if (document.visibilityState === "hidden") {
|
|
2277
2280
|
K(), b(), A();
|
|
2278
2281
|
return;
|
|
2279
2282
|
}
|
|
2280
2283
|
if (document.visibilityState === "visible" && !d) {
|
|
2281
|
-
f =
|
|
2284
|
+
f = It(n.accountLimitedUntilStorageKey), !f && !h && V();
|
|
2282
2285
|
return;
|
|
2283
2286
|
}
|
|
2284
2287
|
document.visibilityState === "visible" && d && !f && !h && O();
|
|
2285
2288
|
}
|
|
2286
2289
|
}, _ = () => {
|
|
2287
|
-
|
|
2290
|
+
P || (K(), b(), A());
|
|
2288
2291
|
};
|
|
2289
|
-
|
|
2292
|
+
jt(async () => {
|
|
2290
2293
|
if (e.isAuthenticated ?? e.currentUser !== null) {
|
|
2291
|
-
if (await k(),
|
|
2294
|
+
if (await k(), P) {
|
|
2292
2295
|
K();
|
|
2293
2296
|
return;
|
|
2294
2297
|
}
|
|
2295
2298
|
d && (w(), m("online"), y()), J(), document.addEventListener("visibilitychange", G), window.addEventListener("pagehide", _), window.addEventListener("beforeunload", _);
|
|
2296
2299
|
}
|
|
2297
2300
|
}), qe(() => {
|
|
2298
|
-
|
|
2301
|
+
P = !0, W(), A(), b(), K(), document.removeEventListener("visibilitychange", G), window.removeEventListener("pagehide", _), window.removeEventListener("beforeunload", _);
|
|
2299
2302
|
});
|
|
2300
2303
|
}
|
|
2301
2304
|
const Ea = 12e3;
|
|
2302
2305
|
function dc(e) {
|
|
2303
|
-
const n =
|
|
2306
|
+
const n = Qt(), r = ke()(), o = be(!1), c = be(null), u = be(null), d = be([]), f = /* @__PURE__ */ new Map(), h = zt(), P = h !== null, C = 20, v = 250;
|
|
2304
2307
|
let E = !1, b = null, A = 0, w = null;
|
|
2305
|
-
const p = se(() => r.currentUser?.id), m = () =>
|
|
2308
|
+
const p = se(() => r.currentUser?.id), m = () => is(e)?.trim() ?? "", y = () => {
|
|
2306
2309
|
const M = u.value?.trim() ?? "";
|
|
2307
2310
|
if (M.length > 0)
|
|
2308
2311
|
return M;
|
|
@@ -2323,22 +2326,22 @@ function dc(e) {
|
|
|
2323
2326
|
}, te = () => {
|
|
2324
2327
|
w && (clearTimeout(w), w = null), A = 0;
|
|
2325
2328
|
}, k = () => {
|
|
2326
|
-
!
|
|
2329
|
+
!P || o.value || w || A >= C || (w = setTimeout(() => {
|
|
2327
2330
|
w = null, A += 1, G();
|
|
2328
2331
|
}, v));
|
|
2329
2332
|
}, I = (M, F) => {
|
|
2330
2333
|
J(M);
|
|
2331
2334
|
const Z = setTimeout(() => {
|
|
2332
|
-
f.delete(M), n.removeTypingUser(F, M), d.value = d.value.filter((
|
|
2335
|
+
f.delete(M), n.removeTypingUser(F, M), d.value = d.value.filter((ie) => ie.id !== M);
|
|
2333
2336
|
}, Ea);
|
|
2334
2337
|
f.set(M, Z);
|
|
2335
2338
|
}, K = () => {
|
|
2336
2339
|
E = !0, te();
|
|
2337
2340
|
}, V = (M) => {
|
|
2338
2341
|
try {
|
|
2339
|
-
b && (b(), b = null), b =
|
|
2342
|
+
b && (b(), b = null), b = Wi(M, {
|
|
2340
2343
|
onTypingStart: L,
|
|
2341
|
-
onTypingStop:
|
|
2344
|
+
onTypingStop: he
|
|
2342
2345
|
}), te(), o.value = !0, u.value = M;
|
|
2343
2346
|
} catch (F) {
|
|
2344
2347
|
c.value = F instanceof Error ? F.message : "Failed to subscribe to typing channel";
|
|
@@ -2346,15 +2349,15 @@ function dc(e) {
|
|
|
2346
2349
|
}, G = () => {
|
|
2347
2350
|
const M = m();
|
|
2348
2351
|
if (!(o.value || !M)) {
|
|
2349
|
-
if (c.value = null, Ae() &&
|
|
2352
|
+
if (c.value = null, Ae() && Rn() === "connected") {
|
|
2350
2353
|
V(M);
|
|
2351
2354
|
return;
|
|
2352
2355
|
}
|
|
2353
|
-
E = !1,
|
|
2356
|
+
E = !1, ms().then((F) => {
|
|
2354
2357
|
if (E || o.value || !F)
|
|
2355
2358
|
return;
|
|
2356
2359
|
const Z = m();
|
|
2357
|
-
if (Z && Z === M && Ae() &&
|
|
2360
|
+
if (Z && Z === M && Ae() && Rn() === "connected") {
|
|
2358
2361
|
V(Z);
|
|
2359
2362
|
return;
|
|
2360
2363
|
}
|
|
@@ -2365,7 +2368,7 @@ function dc(e) {
|
|
|
2365
2368
|
const M = u.value;
|
|
2366
2369
|
if (K(), !(!o.value || !M))
|
|
2367
2370
|
try {
|
|
2368
|
-
b && (b(), b = null),
|
|
2371
|
+
b && (b(), b = null), Gi(M), W(), z(M), o.value = !1, u.value = null, c.value = null;
|
|
2369
2372
|
} catch (F) {
|
|
2370
2373
|
c.value = F instanceof Error ? F.message : "Failed to unsubscribe from typing channel";
|
|
2371
2374
|
}
|
|
@@ -2381,9 +2384,9 @@ function dc(e) {
|
|
|
2381
2384
|
name: M.user.name,
|
|
2382
2385
|
...M.user.avatar !== void 0 ? { avatar: M.user.avatar } : {}
|
|
2383
2386
|
};
|
|
2384
|
-
d.value.some((
|
|
2387
|
+
d.value.some((ie) => ie.id === Z.id) || (d.value = [...d.value, Z]), n.addTypingUser(F, Z), I(M.user_id, F);
|
|
2385
2388
|
}
|
|
2386
|
-
function
|
|
2389
|
+
function he(M) {
|
|
2387
2390
|
if (M.user_id === p.value)
|
|
2388
2391
|
return;
|
|
2389
2392
|
J(M.user_id);
|
|
@@ -2400,10 +2403,10 @@ function dc(e) {
|
|
|
2400
2403
|
if (F.length === 0)
|
|
2401
2404
|
return d.value;
|
|
2402
2405
|
const Z = /* @__PURE__ */ new Map();
|
|
2403
|
-
for (const
|
|
2404
|
-
Z.set(
|
|
2405
|
-
for (const
|
|
2406
|
-
Z.set(
|
|
2406
|
+
for (const ie of F)
|
|
2407
|
+
Z.set(ie.id, ie);
|
|
2408
|
+
for (const ie of d.value)
|
|
2409
|
+
Z.set(ie.id, ie);
|
|
2407
2410
|
return [...Z.values()];
|
|
2408
2411
|
}), B = se(() => {
|
|
2409
2412
|
const M = Se.value;
|
|
@@ -2419,13 +2422,13 @@ function dc(e) {
|
|
|
2419
2422
|
return `${M.length} people are typing...`;
|
|
2420
2423
|
if (M.length === 2)
|
|
2421
2424
|
return `${F.name} and ${Z.name} are typing...`;
|
|
2422
|
-
const
|
|
2423
|
-
return
|
|
2425
|
+
const ie = M[2];
|
|
2426
|
+
return ie ? M.length === 3 ? `${F.name}, ${Z.name} and ${ie.name} are typing...` : `${M.length} people are typing...` : `${M.length} people are typing...`;
|
|
2424
2427
|
}), D = se(() => Se.value.length > 0), q = () => {
|
|
2425
2428
|
m() && (b && (b(), b = null), o.value = !1, u.value = null, G());
|
|
2426
2429
|
};
|
|
2427
2430
|
typeof window < "u" && window.addEventListener(Je(), q);
|
|
2428
|
-
const _e =
|
|
2431
|
+
const _e = ht((M) => {
|
|
2429
2432
|
if (M === "connected") {
|
|
2430
2433
|
o.value || G();
|
|
2431
2434
|
return;
|
|
@@ -2449,12 +2452,12 @@ function dc(e) {
|
|
|
2449
2452
|
};
|
|
2450
2453
|
}
|
|
2451
2454
|
function hc(e) {
|
|
2452
|
-
e.apiClient &&
|
|
2455
|
+
e.apiClient && so(e.apiClient), e.mainApiClient && io(e.mainApiClient), e.authStore && ao(e.authStore), e.mediaApi && lo(e.mediaApi), e.createLogger && Go(e.createLogger), e.playMessageNotification && Zo(e.playMessageNotification), e.echo && Ji(e.echo), e.mainEcho && Vo(e.mainEcho), e.presence && oa(e.presence);
|
|
2453
2456
|
}
|
|
2454
2457
|
function fc() {
|
|
2455
|
-
|
|
2458
|
+
ro(), oo(), co(), ho(), Jo(), ea(), Ki(), Xo(), aa();
|
|
2456
2459
|
}
|
|
2457
|
-
class
|
|
2460
|
+
class tn {
|
|
2458
2461
|
constructor() {
|
|
2459
2462
|
this.notificationCreatedEvent = ".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated";
|
|
2460
2463
|
}
|
|
@@ -2483,7 +2486,7 @@ class en {
|
|
|
2483
2486
|
return this.stopListening(".client-" + n, r);
|
|
2484
2487
|
}
|
|
2485
2488
|
}
|
|
2486
|
-
class
|
|
2489
|
+
class Fs {
|
|
2487
2490
|
/**
|
|
2488
2491
|
* Create a new class instance.
|
|
2489
2492
|
*/
|
|
@@ -2512,12 +2515,12 @@ function Aa(e) {
|
|
|
2512
2515
|
}
|
|
2513
2516
|
return !0;
|
|
2514
2517
|
}
|
|
2515
|
-
class
|
|
2518
|
+
class nn extends tn {
|
|
2516
2519
|
/**
|
|
2517
2520
|
* Create a new class instance.
|
|
2518
2521
|
*/
|
|
2519
2522
|
constructor(n, r, o) {
|
|
2520
|
-
super(), this.name = r, this.pusher = n, this.options = o, this.eventFormatter = new
|
|
2523
|
+
super(), this.name = r, this.pusher = n, this.options = o, this.eventFormatter = new Fs(this.options.namespace), this.subscribe();
|
|
2521
2524
|
}
|
|
2522
2525
|
/**
|
|
2523
2526
|
* Subscribe to a Pusher channel.
|
|
@@ -2589,7 +2592,7 @@ class tn extends en {
|
|
|
2589
2592
|
return this.subscription.bind(n, r), this;
|
|
2590
2593
|
}
|
|
2591
2594
|
}
|
|
2592
|
-
class
|
|
2595
|
+
class Ds extends nn {
|
|
2593
2596
|
/**
|
|
2594
2597
|
* Send a whisper event to other clients in the channel.
|
|
2595
2598
|
*/
|
|
@@ -2600,7 +2603,7 @@ class Os extends tn {
|
|
|
2600
2603
|
), this;
|
|
2601
2604
|
}
|
|
2602
2605
|
}
|
|
2603
|
-
class Ra extends
|
|
2606
|
+
class Ra extends nn {
|
|
2604
2607
|
/**
|
|
2605
2608
|
* Send a whisper event to other clients in the channel.
|
|
2606
2609
|
*/
|
|
@@ -2611,7 +2614,7 @@ class Ra extends tn {
|
|
|
2611
2614
|
), this;
|
|
2612
2615
|
}
|
|
2613
2616
|
}
|
|
2614
|
-
class Pa extends
|
|
2617
|
+
class Pa extends Ds {
|
|
2615
2618
|
/**
|
|
2616
2619
|
* Register a callback to be called anytime the member list changes.
|
|
2617
2620
|
*/
|
|
@@ -2646,12 +2649,12 @@ class Pa extends Os {
|
|
|
2646
2649
|
}), this;
|
|
2647
2650
|
}
|
|
2648
2651
|
}
|
|
2649
|
-
class
|
|
2652
|
+
class Ns extends tn {
|
|
2650
2653
|
/**
|
|
2651
2654
|
* Create a new class instance.
|
|
2652
2655
|
*/
|
|
2653
2656
|
constructor(n, r, o) {
|
|
2654
|
-
super(), this.events = {}, this.listeners = {}, this.name = r, this.socket = n, this.options = o, this.eventFormatter = new
|
|
2657
|
+
super(), this.events = {}, this.listeners = {}, this.name = r, this.socket = n, this.options = o, this.eventFormatter = new Fs(this.options.namespace), this.subscribe();
|
|
2655
2658
|
}
|
|
2656
2659
|
/**
|
|
2657
2660
|
* Subscribe to a Socket.io channel.
|
|
@@ -2722,7 +2725,7 @@ class Fs extends en {
|
|
|
2722
2725
|
)), (!r || this.listeners[n].length === 0) && (this.events[n] && (this.socket.removeListener(n, this.events[n]), delete this.events[n]), delete this.listeners[n]);
|
|
2723
2726
|
}
|
|
2724
2727
|
}
|
|
2725
|
-
class
|
|
2728
|
+
class qs extends Ns {
|
|
2726
2729
|
/**
|
|
2727
2730
|
* Send a whisper event to other clients in the channel.
|
|
2728
2731
|
*/
|
|
@@ -2734,7 +2737,7 @@ class Ds extends Fs {
|
|
|
2734
2737
|
}), this;
|
|
2735
2738
|
}
|
|
2736
2739
|
}
|
|
2737
|
-
class Ma extends
|
|
2740
|
+
class Ma extends qs {
|
|
2738
2741
|
/**
|
|
2739
2742
|
* Register a callback to be called anytime the member list changes.
|
|
2740
2743
|
*/
|
|
@@ -2772,7 +2775,7 @@ class Ma extends Ds {
|
|
|
2772
2775
|
), this;
|
|
2773
2776
|
}
|
|
2774
2777
|
}
|
|
2775
|
-
class
|
|
2778
|
+
class dt extends tn {
|
|
2776
2779
|
/**
|
|
2777
2780
|
* Subscribe to a channel.
|
|
2778
2781
|
*/
|
|
@@ -2820,7 +2823,7 @@ class lt extends en {
|
|
|
2820
2823
|
return this;
|
|
2821
2824
|
}
|
|
2822
2825
|
}
|
|
2823
|
-
class
|
|
2826
|
+
class zs extends dt {
|
|
2824
2827
|
/**
|
|
2825
2828
|
* Send a whisper event to other clients in the channel.
|
|
2826
2829
|
*/
|
|
@@ -2828,7 +2831,7 @@ class Ns extends lt {
|
|
|
2828
2831
|
return this;
|
|
2829
2832
|
}
|
|
2830
2833
|
}
|
|
2831
|
-
class ka extends
|
|
2834
|
+
class ka extends dt {
|
|
2832
2835
|
/**
|
|
2833
2836
|
* Send a whisper event to other clients in the channel.
|
|
2834
2837
|
*/
|
|
@@ -2836,7 +2839,7 @@ class ka extends lt {
|
|
|
2836
2839
|
return this;
|
|
2837
2840
|
}
|
|
2838
2841
|
}
|
|
2839
|
-
class xa extends
|
|
2842
|
+
class xa extends zs {
|
|
2840
2843
|
/**
|
|
2841
2844
|
* Register a callback to be called anytime the member list changes.
|
|
2842
2845
|
*/
|
|
@@ -2862,7 +2865,7 @@ class xa extends Ns {
|
|
|
2862
2865
|
return this;
|
|
2863
2866
|
}
|
|
2864
2867
|
}
|
|
2865
|
-
const
|
|
2868
|
+
const js = class $s {
|
|
2866
2869
|
/**
|
|
2867
2870
|
* Create a new class instance.
|
|
2868
2871
|
*/
|
|
@@ -2874,7 +2877,7 @@ const qs = class zs {
|
|
|
2874
2877
|
*/
|
|
2875
2878
|
setOptions(n) {
|
|
2876
2879
|
this.options = {
|
|
2877
|
-
|
|
2880
|
+
...$s._defaultOptions,
|
|
2878
2881
|
...n,
|
|
2879
2882
|
broadcaster: n.broadcaster
|
|
2880
2883
|
};
|
|
@@ -2889,7 +2892,7 @@ const qs = class zs {
|
|
|
2889
2892
|
return typeof window < "u" && (n = window.Laravel) != null && n.csrfToken ? window.Laravel.csrfToken : this.options.csrfToken ? this.options.csrfToken : typeof document < "u" && typeof document.querySelector == "function" ? ((r = document.querySelector('meta[name="csrf-token"]')) == null ? void 0 : r.getAttribute("content")) ?? null : null;
|
|
2890
2893
|
}
|
|
2891
2894
|
};
|
|
2892
|
-
|
|
2895
|
+
js._defaultOptions = {
|
|
2893
2896
|
auth: {
|
|
2894
2897
|
headers: {}
|
|
2895
2898
|
},
|
|
@@ -2904,8 +2907,8 @@ qs._defaultOptions = {
|
|
|
2904
2907
|
key: null,
|
|
2905
2908
|
namespace: "App.Events"
|
|
2906
2909
|
};
|
|
2907
|
-
let
|
|
2908
|
-
class it extends
|
|
2910
|
+
let sn = js;
|
|
2911
|
+
class it extends sn {
|
|
2909
2912
|
constructor() {
|
|
2910
2913
|
super(...arguments), this.channels = {};
|
|
2911
2914
|
}
|
|
@@ -2943,7 +2946,7 @@ class it extends nn {
|
|
|
2943
2946
|
* Get a channel instance by name.
|
|
2944
2947
|
*/
|
|
2945
2948
|
channel(n) {
|
|
2946
|
-
return this.channels[n] || (this.channels[n] = new
|
|
2949
|
+
return this.channels[n] || (this.channels[n] = new nn(
|
|
2947
2950
|
this.pusher,
|
|
2948
2951
|
n,
|
|
2949
2952
|
this.options
|
|
@@ -2953,7 +2956,7 @@ class it extends nn {
|
|
|
2953
2956
|
* Get a private channel instance by name.
|
|
2954
2957
|
*/
|
|
2955
2958
|
privateChannel(n) {
|
|
2956
|
-
return this.channels["private-" + n] || (this.channels["private-" + n] = new
|
|
2959
|
+
return this.channels["private-" + n] || (this.channels["private-" + n] = new Ds(
|
|
2957
2960
|
this.pusher,
|
|
2958
2961
|
"private-" + n,
|
|
2959
2962
|
this.options
|
|
@@ -3042,7 +3045,7 @@ class it extends nn {
|
|
|
3042
3045
|
this.pusher.disconnect();
|
|
3043
3046
|
}
|
|
3044
3047
|
}
|
|
3045
|
-
class La extends
|
|
3048
|
+
class La extends sn {
|
|
3046
3049
|
constructor() {
|
|
3047
3050
|
super(...arguments), this.channels = {};
|
|
3048
3051
|
}
|
|
@@ -3082,7 +3085,7 @@ class La extends nn {
|
|
|
3082
3085
|
* Get a channel instance by name.
|
|
3083
3086
|
*/
|
|
3084
3087
|
channel(n) {
|
|
3085
|
-
return this.channels[n] || (this.channels[n] = new
|
|
3088
|
+
return this.channels[n] || (this.channels[n] = new Ns(
|
|
3086
3089
|
this.socket,
|
|
3087
3090
|
n,
|
|
3088
3091
|
this.options
|
|
@@ -3092,7 +3095,7 @@ class La extends nn {
|
|
|
3092
3095
|
* Get a private channel instance by name.
|
|
3093
3096
|
*/
|
|
3094
3097
|
privateChannel(n) {
|
|
3095
|
-
return this.channels["private-" + n] || (this.channels["private-" + n] = new
|
|
3098
|
+
return this.channels["private-" + n] || (this.channels["private-" + n] = new qs(
|
|
3096
3099
|
this.socket,
|
|
3097
3100
|
"private-" + n,
|
|
3098
3101
|
this.options
|
|
@@ -3164,7 +3167,7 @@ class La extends nn {
|
|
|
3164
3167
|
this.socket.disconnect();
|
|
3165
3168
|
}
|
|
3166
3169
|
}
|
|
3167
|
-
class
|
|
3170
|
+
class Gn extends sn {
|
|
3168
3171
|
constructor() {
|
|
3169
3172
|
super(...arguments), this.channels = {};
|
|
3170
3173
|
}
|
|
@@ -3177,19 +3180,19 @@ class Xn extends nn {
|
|
|
3177
3180
|
* Listen for an event on a channel instance.
|
|
3178
3181
|
*/
|
|
3179
3182
|
listen(n, r, o) {
|
|
3180
|
-
return new
|
|
3183
|
+
return new dt();
|
|
3181
3184
|
}
|
|
3182
3185
|
/**
|
|
3183
3186
|
* Get a channel instance by name.
|
|
3184
3187
|
*/
|
|
3185
3188
|
channel(n) {
|
|
3186
|
-
return new
|
|
3189
|
+
return new dt();
|
|
3187
3190
|
}
|
|
3188
3191
|
/**
|
|
3189
3192
|
* Get a private channel instance by name.
|
|
3190
3193
|
*/
|
|
3191
3194
|
privateChannel(n) {
|
|
3192
|
-
return new
|
|
3195
|
+
return new zs();
|
|
3193
3196
|
}
|
|
3194
3197
|
/**
|
|
3195
3198
|
* Get a private encrypted channel instance by name.
|
|
@@ -3271,7 +3274,7 @@ class Ia {
|
|
|
3271
3274
|
else if (this.options.broadcaster === "socket.io")
|
|
3272
3275
|
this.connector = new La(this.options);
|
|
3273
3276
|
else if (this.options.broadcaster === "null")
|
|
3274
|
-
this.connector = new
|
|
3277
|
+
this.connector = new Gn(this.options);
|
|
3275
3278
|
else if (typeof this.options.broadcaster == "function" && Aa(this.options.broadcaster))
|
|
3276
3279
|
this.connector = new this.options.broadcaster(this.options);
|
|
3277
3280
|
else
|
|
@@ -3335,7 +3338,7 @@ class Ia {
|
|
|
3335
3338
|
);
|
|
3336
3339
|
}
|
|
3337
3340
|
connectorSupportsEncryptedPrivateChannels(n) {
|
|
3338
|
-
return n instanceof it || n instanceof
|
|
3341
|
+
return n instanceof it || n instanceof Gn;
|
|
3339
3342
|
}
|
|
3340
3343
|
/**
|
|
3341
3344
|
* Get the Socket ID for the connection.
|
|
@@ -3399,10 +3402,10 @@ class Ia {
|
|
|
3399
3402
|
function Ua(e) {
|
|
3400
3403
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3401
3404
|
}
|
|
3402
|
-
var
|
|
3403
|
-
var
|
|
3405
|
+
var Ut = { exports: {} };
|
|
3406
|
+
var Jn;
|
|
3404
3407
|
function Oa() {
|
|
3405
|
-
return
|
|
3408
|
+
return Jn || (Jn = 1, (function(e, n) {
|
|
3406
3409
|
(function(o, c) {
|
|
3407
3410
|
e.exports = c();
|
|
3408
3411
|
})(window, function() {
|
|
@@ -3431,8 +3434,8 @@ function Oa() {
|
|
|
3431
3434
|
}, c.t = function(u, d) {
|
|
3432
3435
|
if (d & 1 && (u = c(u)), d & 8 || d & 4 && typeof u == "object" && u && u.__esModule) return u;
|
|
3433
3436
|
var f = /* @__PURE__ */ Object.create(null);
|
|
3434
|
-
if (c.r(f), Object.defineProperty(f, "default", { enumerable: !0, value: u }), d & 2 && typeof u != "string") for (var h in u) c.d(f, h, (function(
|
|
3435
|
-
return u[
|
|
3437
|
+
if (c.r(f), Object.defineProperty(f, "default", { enumerable: !0, value: u }), d & 2 && typeof u != "string") for (var h in u) c.d(f, h, (function(P) {
|
|
3438
|
+
return u[P];
|
|
3436
3439
|
}).bind(null, h));
|
|
3437
3440
|
return f;
|
|
3438
3441
|
}, c.n = function(u) {
|
|
@@ -3523,10 +3526,10 @@ function Oa() {
|
|
|
3523
3526
|
);
|
|
3524
3527
|
o.Coder = f;
|
|
3525
3528
|
var h = new f();
|
|
3526
|
-
function
|
|
3529
|
+
function P(w) {
|
|
3527
3530
|
return h.encode(w);
|
|
3528
3531
|
}
|
|
3529
|
-
o.encode =
|
|
3532
|
+
o.encode = P;
|
|
3530
3533
|
function C(w) {
|
|
3531
3534
|
return h.decode(w);
|
|
3532
3535
|
}
|
|
@@ -3596,7 +3599,7 @@ function Oa() {
|
|
|
3596
3599
|
return v;
|
|
3597
3600
|
}
|
|
3598
3601
|
o.encodedLength = h;
|
|
3599
|
-
function
|
|
3602
|
+
function P(C) {
|
|
3600
3603
|
for (var v = [], E = 0; E < C.length; E++) {
|
|
3601
3604
|
var b = C[E];
|
|
3602
3605
|
if (b & 128) {
|
|
@@ -3636,7 +3639,7 @@ function Oa() {
|
|
|
3636
3639
|
}
|
|
3637
3640
|
return v.join("");
|
|
3638
3641
|
}
|
|
3639
|
-
o.decode =
|
|
3642
|
+
o.decode = P;
|
|
3640
3643
|
}),
|
|
3641
3644
|
/* 2 */
|
|
3642
3645
|
/***/
|
|
@@ -3690,7 +3693,7 @@ function Oa() {
|
|
|
3690
3693
|
cdn_https: "https://js.pusher.com",
|
|
3691
3694
|
dependency_suffix: ""
|
|
3692
3695
|
}, h = f;
|
|
3693
|
-
class
|
|
3696
|
+
class P {
|
|
3694
3697
|
constructor(t) {
|
|
3695
3698
|
this.options = t, this.receivers = t.receivers || d, this.loading = {};
|
|
3696
3699
|
}
|
|
@@ -3704,8 +3707,8 @@ function Oa() {
|
|
|
3704
3707
|
if (l.receivers.remove(S), l.loading[t]) {
|
|
3705
3708
|
var j = l.loading[t];
|
|
3706
3709
|
delete l.loading[t];
|
|
3707
|
-
for (var Q = function(
|
|
3708
|
-
|
|
3710
|
+
for (var Q = function(ue) {
|
|
3711
|
+
ue || g.cleanup();
|
|
3709
3712
|
}, ee = 0; ee < j.length; ee++)
|
|
3710
3713
|
j[ee](x, Q);
|
|
3711
3714
|
}
|
|
@@ -3721,7 +3724,7 @@ function Oa() {
|
|
|
3721
3724
|
return this.getRoot(s) + "/" + t + this.options.suffix + ".js";
|
|
3722
3725
|
}
|
|
3723
3726
|
}
|
|
3724
|
-
var C = new u("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new
|
|
3727
|
+
var C = new u("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new P({
|
|
3725
3728
|
cdn_http: h.cdn_http,
|
|
3726
3729
|
cdn_https: h.cdn_https,
|
|
3727
3730
|
version: h.VERSION,
|
|
@@ -3838,12 +3841,12 @@ function Oa() {
|
|
|
3838
3841
|
}, g.send(t), g;
|
|
3839
3842
|
};
|
|
3840
3843
|
function V(i) {
|
|
3841
|
-
return B(
|
|
3844
|
+
return B(he(i));
|
|
3842
3845
|
}
|
|
3843
3846
|
var G = String.fromCharCode, _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", L = function(i) {
|
|
3844
3847
|
var t = i.charCodeAt(0);
|
|
3845
3848
|
return t < 128 ? i : t < 2048 ? G(192 | t >>> 6) + G(128 | t & 63) : G(224 | t >>> 12 & 15) + G(128 | t >>> 6 & 63) + G(128 | t & 63);
|
|
3846
|
-
},
|
|
3849
|
+
}, he = function(i) {
|
|
3847
3850
|
return i.replace(/[^\x00-\x7F]/g, L);
|
|
3848
3851
|
}, Se = function(i) {
|
|
3849
3852
|
var t = [0, 2, 1][i.length % 3], s = i.charCodeAt(0) << 16 | (i.length > 1 ? i.charCodeAt(1) : 0) << 8 | (i.length > 2 ? i.charCodeAt(2) : 0), a = [
|
|
@@ -3890,7 +3893,7 @@ function Oa() {
|
|
|
3890
3893
|
});
|
|
3891
3894
|
}
|
|
3892
3895
|
}
|
|
3893
|
-
var
|
|
3896
|
+
var ie = {
|
|
3894
3897
|
now() {
|
|
3895
3898
|
return Date.now ? Date.now() : (/* @__PURE__ */ new Date()).valueOf();
|
|
3896
3899
|
},
|
|
@@ -3903,7 +3906,7 @@ function Oa() {
|
|
|
3903
3906
|
return a[i].apply(a, s.concat(arguments));
|
|
3904
3907
|
};
|
|
3905
3908
|
}
|
|
3906
|
-
},
|
|
3909
|
+
}, fe = ie;
|
|
3907
3910
|
function me(i, ...t) {
|
|
3908
3911
|
for (var s = 0; s < t.length; s++) {
|
|
3909
3912
|
var a = t[s];
|
|
@@ -3912,12 +3915,12 @@ function Oa() {
|
|
|
3912
3915
|
}
|
|
3913
3916
|
return i;
|
|
3914
3917
|
}
|
|
3915
|
-
function
|
|
3918
|
+
function rn() {
|
|
3916
3919
|
for (var i = ["Pusher"], t = 0; t < arguments.length; t++)
|
|
3917
3920
|
typeof arguments[t] == "string" ? i.push(arguments[t]) : i.push(Qe(arguments[t]));
|
|
3918
3921
|
return i.join(" : ");
|
|
3919
3922
|
}
|
|
3920
|
-
function
|
|
3923
|
+
function ft(i, t) {
|
|
3921
3924
|
var s = Array.prototype.indexOf;
|
|
3922
3925
|
if (i === null)
|
|
3923
3926
|
return -1;
|
|
@@ -3932,7 +3935,7 @@ function Oa() {
|
|
|
3932
3935
|
for (var s in i)
|
|
3933
3936
|
Object.prototype.hasOwnProperty.call(i, s) && t(i[s], s, i);
|
|
3934
3937
|
}
|
|
3935
|
-
function
|
|
3938
|
+
function R(i) {
|
|
3936
3939
|
var t = [];
|
|
3937
3940
|
return T(i, function(s, a) {
|
|
3938
3941
|
t.push(a);
|
|
@@ -3953,13 +3956,13 @@ function Oa() {
|
|
|
3953
3956
|
s.push(t(i[a], a, i, s));
|
|
3954
3957
|
return s;
|
|
3955
3958
|
}
|
|
3956
|
-
function
|
|
3959
|
+
function oe(i, t) {
|
|
3957
3960
|
var s = {};
|
|
3958
3961
|
return T(i, function(a, l) {
|
|
3959
3962
|
s[l] = t(a);
|
|
3960
3963
|
}), s;
|
|
3961
3964
|
}
|
|
3962
|
-
function
|
|
3965
|
+
function ce(i, t) {
|
|
3963
3966
|
t = t || function(l) {
|
|
3964
3967
|
return !!l;
|
|
3965
3968
|
};
|
|
@@ -3992,17 +3995,17 @@ function Oa() {
|
|
|
3992
3995
|
return !0;
|
|
3993
3996
|
}
|
|
3994
3997
|
function ve(i) {
|
|
3995
|
-
return
|
|
3998
|
+
return oe(i, function(t) {
|
|
3996
3999
|
return typeof t == "object" && (t = Qe(t)), encodeURIComponent(V(t.toString()));
|
|
3997
4000
|
});
|
|
3998
4001
|
}
|
|
3999
|
-
function
|
|
4002
|
+
function Hs(i) {
|
|
4000
4003
|
var t = Re(i, function(a) {
|
|
4001
4004
|
return a !== void 0;
|
|
4002
|
-
}), s = ne(Le(ve(t)),
|
|
4005
|
+
}), s = ne(Le(ve(t)), fe.method("join", "=")).join("&");
|
|
4003
4006
|
return s;
|
|
4004
4007
|
}
|
|
4005
|
-
function
|
|
4008
|
+
function Bs(i) {
|
|
4006
4009
|
var t = [], s = [];
|
|
4007
4010
|
return (function a(l, g) {
|
|
4008
4011
|
var S, x, j;
|
|
@@ -4033,10 +4036,10 @@ function Oa() {
|
|
|
4033
4036
|
try {
|
|
4034
4037
|
return JSON.stringify(i);
|
|
4035
4038
|
} catch {
|
|
4036
|
-
return JSON.stringify(
|
|
4039
|
+
return JSON.stringify(Bs(i));
|
|
4037
4040
|
}
|
|
4038
4041
|
}
|
|
4039
|
-
class
|
|
4042
|
+
class Vs {
|
|
4040
4043
|
constructor() {
|
|
4041
4044
|
this.globalLog = (t) => {
|
|
4042
4045
|
window.console && window.console.log && window.console.log(t);
|
|
@@ -4058,11 +4061,11 @@ function Oa() {
|
|
|
4058
4061
|
window.console && window.console.error ? window.console.error(t) : this.globalLogWarn(t);
|
|
4059
4062
|
}
|
|
4060
4063
|
log(t, ...s) {
|
|
4061
|
-
var a =
|
|
4062
|
-
|
|
4064
|
+
var a = rn.apply(this, arguments);
|
|
4065
|
+
Tt.log ? Tt.log(a) : Tt.logToConsole && t.bind(this)(a);
|
|
4063
4066
|
}
|
|
4064
4067
|
}
|
|
4065
|
-
var ae = new
|
|
4068
|
+
var ae = new Vs(), Xs = function(i, t, s, a, l) {
|
|
4066
4069
|
(s.headers !== void 0 || s.headersProvider != null) && ae.warn(`To send headers with the ${a.toString()} request, you must use AJAX, rather than JSONP.`);
|
|
4067
4070
|
var g = i.nextAuthCallbackID.toString();
|
|
4068
4071
|
i.nextAuthCallbackID++;
|
|
@@ -4074,8 +4077,8 @@ function Oa() {
|
|
|
4074
4077
|
x.src = s.endpoint + "?callback=" + encodeURIComponent(j) + "&" + t;
|
|
4075
4078
|
var Q = S.getElementsByTagName("head")[0] || S.documentElement;
|
|
4076
4079
|
Q.insertBefore(x, Q.firstChild);
|
|
4077
|
-
},
|
|
4078
|
-
class
|
|
4080
|
+
}, Ws = Xs;
|
|
4081
|
+
class Gs {
|
|
4079
4082
|
constructor(t) {
|
|
4080
4083
|
this.src = t;
|
|
4081
4084
|
}
|
|
@@ -4095,13 +4098,13 @@ function Oa() {
|
|
|
4095
4098
|
this.script && (this.script.onload = this.script.onerror = null, this.script.onreadystatechange = null), this.script && this.script.parentNode && this.script.parentNode.removeChild(this.script), this.errorScript && this.errorScript.parentNode && this.errorScript.parentNode.removeChild(this.errorScript), this.script = null, this.errorScript = null;
|
|
4096
4099
|
}
|
|
4097
4100
|
}
|
|
4098
|
-
class
|
|
4101
|
+
class Js {
|
|
4099
4102
|
constructor(t, s) {
|
|
4100
4103
|
this.url = t, this.data = s;
|
|
4101
4104
|
}
|
|
4102
4105
|
send(t) {
|
|
4103
4106
|
if (!this.request) {
|
|
4104
|
-
var s =
|
|
4107
|
+
var s = Hs(this.data), a = this.url + "/" + t.number + "?" + s;
|
|
4105
4108
|
this.request = $.createScriptRequest(a), this.request.send(t);
|
|
4106
4109
|
}
|
|
4107
4110
|
}
|
|
@@ -4109,52 +4112,52 @@ function Oa() {
|
|
|
4109
4112
|
this.request && this.request.cleanup();
|
|
4110
4113
|
}
|
|
4111
4114
|
}
|
|
4112
|
-
var
|
|
4115
|
+
var Ks = function(i, t) {
|
|
4113
4116
|
return function(s, a) {
|
|
4114
4117
|
var l = "http" + (t ? "s" : "") + "://", g = l + (i.host || i.options.host) + i.options.path, S = $.createJSONPRequest(g, s), x = $.ScriptReceivers.create(function(j, Q) {
|
|
4115
4118
|
d.remove(x), S.cleanup(), Q && Q.host && (i.host = Q.host), a && a(j, Q);
|
|
4116
4119
|
});
|
|
4117
4120
|
S.send(x);
|
|
4118
4121
|
};
|
|
4119
|
-
},
|
|
4122
|
+
}, Qs = {
|
|
4120
4123
|
name: "jsonp",
|
|
4121
|
-
getAgent:
|
|
4122
|
-
},
|
|
4123
|
-
function
|
|
4124
|
+
getAgent: Ks
|
|
4125
|
+
}, Ys = Qs;
|
|
4126
|
+
function pt(i, t, s) {
|
|
4124
4127
|
var a = i + (t.useTLS ? "s" : ""), l = t.useTLS ? t.hostTLS : t.hostNonTLS;
|
|
4125
4128
|
return a + "://" + l + s;
|
|
4126
4129
|
}
|
|
4127
|
-
function
|
|
4130
|
+
function gt(i, t) {
|
|
4128
4131
|
var s = "/app/" + i, a = "?protocol=" + h.PROTOCOL + "&client=js&version=" + h.VERSION + (t ? "&" + t : "");
|
|
4129
4132
|
return s + a;
|
|
4130
4133
|
}
|
|
4131
|
-
var
|
|
4134
|
+
var Zs = {
|
|
4132
4135
|
getInitial: function(i, t) {
|
|
4133
|
-
var s = (t.httpPath || "") +
|
|
4134
|
-
return
|
|
4136
|
+
var s = (t.httpPath || "") + gt(i, "flash=false");
|
|
4137
|
+
return pt("ws", t, s);
|
|
4135
4138
|
}
|
|
4136
|
-
},
|
|
4139
|
+
}, er = {
|
|
4137
4140
|
getInitial: function(i, t) {
|
|
4138
|
-
var s = (t.httpPath || "/pusher") +
|
|
4139
|
-
return
|
|
4141
|
+
var s = (t.httpPath || "/pusher") + gt(i);
|
|
4142
|
+
return pt("http", t, s);
|
|
4140
4143
|
}
|
|
4141
|
-
},
|
|
4144
|
+
}, tr = {
|
|
4142
4145
|
getInitial: function(i, t) {
|
|
4143
|
-
return
|
|
4146
|
+
return pt("http", t, t.httpPath || "/pusher");
|
|
4144
4147
|
},
|
|
4145
4148
|
getPath: function(i, t) {
|
|
4146
|
-
return
|
|
4149
|
+
return gt(i);
|
|
4147
4150
|
}
|
|
4148
4151
|
};
|
|
4149
|
-
class
|
|
4152
|
+
class nr {
|
|
4150
4153
|
constructor() {
|
|
4151
4154
|
this._callbacks = {};
|
|
4152
4155
|
}
|
|
4153
4156
|
get(t) {
|
|
4154
|
-
return this._callbacks[
|
|
4157
|
+
return this._callbacks[mt(t)];
|
|
4155
4158
|
}
|
|
4156
4159
|
add(t, s, a) {
|
|
4157
|
-
var l =
|
|
4160
|
+
var l = mt(t);
|
|
4158
4161
|
this._callbacks[l] = this._callbacks[l] || [], this._callbacks[l].push({
|
|
4159
4162
|
fn: s,
|
|
4160
4163
|
context: a
|
|
@@ -4165,12 +4168,12 @@ function Oa() {
|
|
|
4165
4168
|
this._callbacks = {};
|
|
4166
4169
|
return;
|
|
4167
4170
|
}
|
|
4168
|
-
var l = t ? [
|
|
4171
|
+
var l = t ? [mt(t)] : R(this._callbacks);
|
|
4169
4172
|
s || a ? this.removeCallback(l, s, a) : this.removeAllCallbacks(l);
|
|
4170
4173
|
}
|
|
4171
4174
|
removeCallback(t, s, a) {
|
|
4172
4175
|
U(t, function(l) {
|
|
4173
|
-
this._callbacks[l] =
|
|
4176
|
+
this._callbacks[l] = ce(this._callbacks[l] || [], function(g) {
|
|
4174
4177
|
return s && s !== g.fn || a && a !== g.context;
|
|
4175
4178
|
}), this._callbacks[l].length === 0 && delete this._callbacks[l];
|
|
4176
4179
|
}, this);
|
|
@@ -4181,12 +4184,12 @@ function Oa() {
|
|
|
4181
4184
|
}, this);
|
|
4182
4185
|
}
|
|
4183
4186
|
}
|
|
4184
|
-
function
|
|
4187
|
+
function mt(i) {
|
|
4185
4188
|
return "_" + i;
|
|
4186
4189
|
}
|
|
4187
4190
|
class Te {
|
|
4188
4191
|
constructor(t) {
|
|
4189
|
-
this.callbacks = new
|
|
4192
|
+
this.callbacks = new nr(), this.global_callbacks = [], this.failThrough = t;
|
|
4190
4193
|
}
|
|
4191
4194
|
bind(t, s, a) {
|
|
4192
4195
|
return this.callbacks.add(t, s, a), this;
|
|
@@ -4198,7 +4201,7 @@ function Oa() {
|
|
|
4198
4201
|
return this.callbacks.remove(t, s, a), this;
|
|
4199
4202
|
}
|
|
4200
4203
|
unbind_global(t) {
|
|
4201
|
-
return t ? (this.global_callbacks =
|
|
4204
|
+
return t ? (this.global_callbacks = ce(this.global_callbacks || [], (s) => s !== t), this) : (this.global_callbacks = [], this);
|
|
4202
4205
|
}
|
|
4203
4206
|
unbind_all() {
|
|
4204
4207
|
return this.unbind(), this.unbind_global(), this;
|
|
@@ -4214,7 +4217,7 @@ function Oa() {
|
|
|
4214
4217
|
return this;
|
|
4215
4218
|
}
|
|
4216
4219
|
}
|
|
4217
|
-
class
|
|
4220
|
+
class sr extends Te {
|
|
4218
4221
|
constructor(t, s, a, l, g) {
|
|
4219
4222
|
super(), this.initialize = $.transportConnectionInitializer, this.hooks = t, this.name = s, this.priority = a, this.key = l, this.options = g, this.state = "new", this.timeline = g.timeline, this.activityTimeout = g.activityTimeout, this.id = this.timeline.generateUniqueID();
|
|
4220
4223
|
}
|
|
@@ -4231,7 +4234,7 @@ function Oa() {
|
|
|
4231
4234
|
try {
|
|
4232
4235
|
this.socket = this.hooks.getSocket(t, this.options);
|
|
4233
4236
|
} catch (s) {
|
|
4234
|
-
return
|
|
4237
|
+
return fe.defer(() => {
|
|
4235
4238
|
this.onError(s), this.changeState("closed");
|
|
4236
4239
|
}), !1;
|
|
4237
4240
|
}
|
|
@@ -4241,7 +4244,7 @@ function Oa() {
|
|
|
4241
4244
|
return this.socket ? (this.socket.close(), !0) : !1;
|
|
4242
4245
|
}
|
|
4243
4246
|
send(t) {
|
|
4244
|
-
return this.state === "open" ? (
|
|
4247
|
+
return this.state === "open" ? (fe.defer(() => {
|
|
4245
4248
|
this.socket && this.socket.send(t);
|
|
4246
4249
|
}), !0) : !1;
|
|
4247
4250
|
}
|
|
@@ -4301,11 +4304,11 @@ function Oa() {
|
|
|
4301
4304
|
return this.hooks.isSupported(t);
|
|
4302
4305
|
}
|
|
4303
4306
|
createConnection(t, s, a, l) {
|
|
4304
|
-
return new
|
|
4307
|
+
return new sr(this.hooks, t, s, a, l);
|
|
4305
4308
|
}
|
|
4306
4309
|
}
|
|
4307
|
-
var
|
|
4308
|
-
urls:
|
|
4310
|
+
var rr = new De({
|
|
4311
|
+
urls: Zs,
|
|
4309
4312
|
handlesActivityChecks: !1,
|
|
4310
4313
|
supportsPing: !1,
|
|
4311
4314
|
isInitialized: function() {
|
|
@@ -4317,32 +4320,32 @@ function Oa() {
|
|
|
4317
4320
|
getSocket: function(i) {
|
|
4318
4321
|
return $.createWebSocket(i);
|
|
4319
4322
|
}
|
|
4320
|
-
}),
|
|
4321
|
-
urls:
|
|
4323
|
+
}), on = {
|
|
4324
|
+
urls: er,
|
|
4322
4325
|
handlesActivityChecks: !1,
|
|
4323
4326
|
supportsPing: !0,
|
|
4324
4327
|
isInitialized: function() {
|
|
4325
4328
|
return !0;
|
|
4326
4329
|
}
|
|
4327
|
-
},
|
|
4330
|
+
}, an = me({
|
|
4328
4331
|
getSocket: function(i) {
|
|
4329
4332
|
return $.HTTPFactory.createStreamingSocket(i);
|
|
4330
4333
|
}
|
|
4331
|
-
},
|
|
4334
|
+
}, on), cn = me({
|
|
4332
4335
|
getSocket: function(i) {
|
|
4333
4336
|
return $.HTTPFactory.createPollingSocket(i);
|
|
4334
4337
|
}
|
|
4335
|
-
},
|
|
4338
|
+
}, on), un = {
|
|
4336
4339
|
isSupported: function() {
|
|
4337
4340
|
return $.isXHRSupported();
|
|
4338
4341
|
}
|
|
4339
|
-
},
|
|
4340
|
-
ws:
|
|
4341
|
-
xhr_streaming:
|
|
4342
|
-
xhr_polling:
|
|
4343
|
-
}, Ye =
|
|
4342
|
+
}, ir = new De(me({}, an, un)), or = new De(me({}, cn, un)), ar = {
|
|
4343
|
+
ws: rr,
|
|
4344
|
+
xhr_streaming: ir,
|
|
4345
|
+
xhr_polling: or
|
|
4346
|
+
}, Ye = ar, cr = new De({
|
|
4344
4347
|
file: "sockjs",
|
|
4345
|
-
urls:
|
|
4348
|
+
urls: tr,
|
|
4346
4349
|
handlesActivityChecks: !0,
|
|
4347
4350
|
supportsPing: !1,
|
|
4348
4351
|
isSupported: function() {
|
|
@@ -4364,15 +4367,15 @@ function Oa() {
|
|
|
4364
4367
|
path: t
|
|
4365
4368
|
}));
|
|
4366
4369
|
}
|
|
4367
|
-
}),
|
|
4370
|
+
}), ln = {
|
|
4368
4371
|
isSupported: function(i) {
|
|
4369
4372
|
var t = $.isXDRSupported(i.useTLS);
|
|
4370
4373
|
return t;
|
|
4371
4374
|
}
|
|
4372
|
-
},
|
|
4373
|
-
Ye.xdr_streaming =
|
|
4374
|
-
var
|
|
4375
|
-
class
|
|
4375
|
+
}, ur = new De(me({}, an, ln)), lr = new De(me({}, cn, ln));
|
|
4376
|
+
Ye.xdr_streaming = ur, Ye.xdr_polling = lr, Ye.sockjs = cr;
|
|
4377
|
+
var dr = Ye;
|
|
4378
|
+
class hr extends Te {
|
|
4376
4379
|
constructor() {
|
|
4377
4380
|
super();
|
|
4378
4381
|
var t = this;
|
|
@@ -4386,8 +4389,8 @@ function Oa() {
|
|
|
4386
4389
|
return window.navigator.onLine === void 0 ? !0 : window.navigator.onLine;
|
|
4387
4390
|
}
|
|
4388
4391
|
}
|
|
4389
|
-
var
|
|
4390
|
-
class
|
|
4392
|
+
var fr = new hr();
|
|
4393
|
+
class pr {
|
|
4391
4394
|
constructor(t, s, a) {
|
|
4392
4395
|
this.manager = t, this.transport = s, this.minPingDelay = a.minPingDelay, this.maxPingDelay = a.maxPingDelay, this.pingDelay = void 0;
|
|
4393
4396
|
}
|
|
@@ -4396,12 +4399,12 @@ function Oa() {
|
|
|
4396
4399
|
activityTimeout: this.pingDelay
|
|
4397
4400
|
});
|
|
4398
4401
|
var g = this.transport.createConnection(t, s, a, l), S = null, x = function() {
|
|
4399
|
-
g.unbind("open", x), g.bind("closed", j), S =
|
|
4402
|
+
g.unbind("open", x), g.bind("closed", j), S = fe.now();
|
|
4400
4403
|
}, j = (Q) => {
|
|
4401
4404
|
if (g.unbind("closed", j), Q.code === 1002 || Q.code === 1003)
|
|
4402
4405
|
this.manager.reportDeath();
|
|
4403
4406
|
else if (!Q.wasClean && S) {
|
|
4404
|
-
var ee =
|
|
4407
|
+
var ee = fe.now() - S;
|
|
4405
4408
|
ee < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(ee / 2, this.minPingDelay));
|
|
4406
4409
|
}
|
|
4407
4410
|
};
|
|
@@ -4411,7 +4414,7 @@ function Oa() {
|
|
|
4411
4414
|
return this.manager.isAlive() && this.transport.isSupported(t);
|
|
4412
4415
|
}
|
|
4413
4416
|
}
|
|
4414
|
-
const
|
|
4417
|
+
const dn = {
|
|
4415
4418
|
decodeMessage: function(i) {
|
|
4416
4419
|
try {
|
|
4417
4420
|
var t = JSON.parse(i.data), s = t.data;
|
|
@@ -4434,7 +4437,7 @@ function Oa() {
|
|
|
4434
4437
|
return JSON.stringify(i);
|
|
4435
4438
|
},
|
|
4436
4439
|
processHandshake: function(i) {
|
|
4437
|
-
var t =
|
|
4440
|
+
var t = dn.decodeMessage(i);
|
|
4438
4441
|
if (t.event === "pusher:connection_established") {
|
|
4439
4442
|
if (!t.data.activity_timeout)
|
|
4440
4443
|
throw "No activity timeout specified in handshake";
|
|
@@ -4465,8 +4468,8 @@ function Oa() {
|
|
|
4465
4468
|
} : null;
|
|
4466
4469
|
}
|
|
4467
4470
|
};
|
|
4468
|
-
var Ie =
|
|
4469
|
-
class
|
|
4471
|
+
var Ie = dn;
|
|
4472
|
+
class gr extends Te {
|
|
4470
4473
|
constructor(t, s) {
|
|
4471
4474
|
super(), this.id = t, this.transport = s, this.activityTimeout = s.activityTimeout, this.bindListeners();
|
|
4472
4475
|
}
|
|
@@ -4540,7 +4543,7 @@ function Oa() {
|
|
|
4540
4543
|
a && this.emit("error", a), s && this.emit(s, { action: s, error: a });
|
|
4541
4544
|
}
|
|
4542
4545
|
}
|
|
4543
|
-
class
|
|
4546
|
+
class mr {
|
|
4544
4547
|
constructor(t, s) {
|
|
4545
4548
|
this.transport = t, this.callback = s, this.bindListeners();
|
|
4546
4549
|
}
|
|
@@ -4558,7 +4561,7 @@ function Oa() {
|
|
|
4558
4561
|
return;
|
|
4559
4562
|
}
|
|
4560
4563
|
s.action === "connected" ? this.finish("connected", {
|
|
4561
|
-
connection: new
|
|
4564
|
+
connection: new gr(s.id, this.transport),
|
|
4562
4565
|
activityTimeout: s.activityTimeout
|
|
4563
4566
|
}) : (this.finish(s.action, { error: s.error }), this.transport.close());
|
|
4564
4567
|
}, this.onClosed = (t) => {
|
|
@@ -4574,7 +4577,7 @@ function Oa() {
|
|
|
4574
4577
|
this.callback(me({ transport: this.transport, action: t }, s));
|
|
4575
4578
|
}
|
|
4576
4579
|
}
|
|
4577
|
-
class
|
|
4580
|
+
class vr {
|
|
4578
4581
|
constructor(t, s) {
|
|
4579
4582
|
this.timeline = t, this.options = s || {};
|
|
4580
4583
|
}
|
|
@@ -4582,7 +4585,7 @@ function Oa() {
|
|
|
4582
4585
|
this.timeline.isEmpty() || this.timeline.send($.TimelineTransport.getAgent(this, t), s);
|
|
4583
4586
|
}
|
|
4584
4587
|
}
|
|
4585
|
-
class
|
|
4588
|
+
class vt extends Te {
|
|
4586
4589
|
constructor(t, s) {
|
|
4587
4590
|
super(function(a, l) {
|
|
4588
4591
|
ae.debug("No callbacks on " + t + " for " + a);
|
|
@@ -4644,7 +4647,7 @@ function Oa() {
|
|
|
4644
4647
|
this.subscriptionCancelled = !1;
|
|
4645
4648
|
}
|
|
4646
4649
|
}
|
|
4647
|
-
class
|
|
4650
|
+
class bt extends vt {
|
|
4648
4651
|
authorize(t, s) {
|
|
4649
4652
|
return this.pusher.config.channelAuthorizer({
|
|
4650
4653
|
channelName: this.name,
|
|
@@ -4652,7 +4655,7 @@ function Oa() {
|
|
|
4652
4655
|
}, s);
|
|
4653
4656
|
}
|
|
4654
4657
|
}
|
|
4655
|
-
class
|
|
4658
|
+
class br {
|
|
4656
4659
|
constructor() {
|
|
4657
4660
|
this.reset();
|
|
4658
4661
|
}
|
|
@@ -4684,7 +4687,7 @@ function Oa() {
|
|
|
4684
4687
|
this.members = {}, this.count = 0, this.myID = null, this.me = null;
|
|
4685
4688
|
}
|
|
4686
4689
|
}
|
|
4687
|
-
var
|
|
4690
|
+
var yr = function(i, t, s, a) {
|
|
4688
4691
|
function l(g) {
|
|
4689
4692
|
return g instanceof s ? g : new s(function(S) {
|
|
4690
4693
|
S(g);
|
|
@@ -4694,15 +4697,15 @@ function Oa() {
|
|
|
4694
4697
|
function x(ee) {
|
|
4695
4698
|
try {
|
|
4696
4699
|
Q(a.next(ee));
|
|
4697
|
-
} catch (
|
|
4698
|
-
S(
|
|
4700
|
+
} catch (ue) {
|
|
4701
|
+
S(ue);
|
|
4699
4702
|
}
|
|
4700
4703
|
}
|
|
4701
4704
|
function j(ee) {
|
|
4702
4705
|
try {
|
|
4703
4706
|
Q(a.throw(ee));
|
|
4704
|
-
} catch (
|
|
4705
|
-
S(
|
|
4707
|
+
} catch (ue) {
|
|
4708
|
+
S(ue);
|
|
4706
4709
|
}
|
|
4707
4710
|
}
|
|
4708
4711
|
function Q(ee) {
|
|
@@ -4711,12 +4714,12 @@ function Oa() {
|
|
|
4711
4714
|
Q((a = a.apply(i, t || [])).next());
|
|
4712
4715
|
});
|
|
4713
4716
|
};
|
|
4714
|
-
class
|
|
4717
|
+
class _r extends bt {
|
|
4715
4718
|
constructor(t, s) {
|
|
4716
|
-
super(t, s), this.members = new
|
|
4719
|
+
super(t, s), this.members = new br();
|
|
4717
4720
|
}
|
|
4718
4721
|
authorize(t, s) {
|
|
4719
|
-
super.authorize(t, (a, l) =>
|
|
4722
|
+
super.authorize(t, (a, l) => yr(this, void 0, void 0, function* () {
|
|
4720
4723
|
if (!a)
|
|
4721
4724
|
if (l = l, l.channel_data != null) {
|
|
4722
4725
|
var g = JSON.parse(l.channel_data);
|
|
@@ -4766,8 +4769,8 @@ function Oa() {
|
|
|
4766
4769
|
this.members.reset(), super.disconnect();
|
|
4767
4770
|
}
|
|
4768
4771
|
}
|
|
4769
|
-
var
|
|
4770
|
-
class
|
|
4772
|
+
var Sr = c(1), yt = c(0);
|
|
4773
|
+
class Cr extends bt {
|
|
4771
4774
|
constructor(t, s, a) {
|
|
4772
4775
|
super(t, s), this.key = null, this.nacl = a;
|
|
4773
4776
|
}
|
|
@@ -4782,7 +4785,7 @@ function Oa() {
|
|
|
4782
4785
|
s(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
|
|
4783
4786
|
return;
|
|
4784
4787
|
}
|
|
4785
|
-
this.key = Object(
|
|
4788
|
+
this.key = Object(yt.decode)(g), delete l.shared_secret, s(null, l);
|
|
4786
4789
|
});
|
|
4787
4790
|
}
|
|
4788
4791
|
trigger(t, s) {
|
|
@@ -4805,12 +4808,12 @@ function Oa() {
|
|
|
4805
4808
|
ae.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + s);
|
|
4806
4809
|
return;
|
|
4807
4810
|
}
|
|
4808
|
-
let a = Object(
|
|
4811
|
+
let a = Object(yt.decode)(s.ciphertext);
|
|
4809
4812
|
if (a.length < this.nacl.secretbox.overheadLength) {
|
|
4810
4813
|
ae.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${a.length}`);
|
|
4811
4814
|
return;
|
|
4812
4815
|
}
|
|
4813
|
-
let l = Object(
|
|
4816
|
+
let l = Object(yt.decode)(s.nonce);
|
|
4814
4817
|
if (l.length < this.nacl.secretbox.nonceLength) {
|
|
4815
4818
|
ae.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${l.length}`);
|
|
4816
4819
|
return;
|
|
@@ -4833,7 +4836,7 @@ function Oa() {
|
|
|
4833
4836
|
this.emit(t, this.getDataToEmit(g));
|
|
4834
4837
|
}
|
|
4835
4838
|
getDataToEmit(t) {
|
|
4836
|
-
let s = Object(
|
|
4839
|
+
let s = Object(Sr.decode)(t);
|
|
4837
4840
|
try {
|
|
4838
4841
|
return JSON.parse(s);
|
|
4839
4842
|
} catch {
|
|
@@ -4841,7 +4844,7 @@ function Oa() {
|
|
|
4841
4844
|
}
|
|
4842
4845
|
}
|
|
4843
4846
|
}
|
|
4844
|
-
class
|
|
4847
|
+
class wr extends Te {
|
|
4845
4848
|
constructor(t, s) {
|
|
4846
4849
|
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);
|
|
4847
4850
|
var a = $.getNetwork();
|
|
@@ -4997,12 +5000,12 @@ function Oa() {
|
|
|
4997
5000
|
return this.state === "connecting" || this.state === "connected";
|
|
4998
5001
|
}
|
|
4999
5002
|
}
|
|
5000
|
-
class
|
|
5003
|
+
class Tr {
|
|
5001
5004
|
constructor() {
|
|
5002
5005
|
this.channels = {};
|
|
5003
5006
|
}
|
|
5004
5007
|
add(t, s) {
|
|
5005
|
-
return this.channels[t] || (this.channels[t] =
|
|
5008
|
+
return this.channels[t] || (this.channels[t] = Er(t, s)), this.channels[t];
|
|
5006
5009
|
}
|
|
5007
5010
|
all() {
|
|
5008
5011
|
return N(this.channels);
|
|
@@ -5020,7 +5023,7 @@ function Oa() {
|
|
|
5020
5023
|
});
|
|
5021
5024
|
}
|
|
5022
5025
|
}
|
|
5023
|
-
function
|
|
5026
|
+
function Er(i, t) {
|
|
5024
5027
|
if (i.indexOf("private-encrypted-") === 0) {
|
|
5025
5028
|
if (t.config.nacl)
|
|
5026
5029
|
return Ee.createEncryptedChannel(i, t, t.config.nacl);
|
|
@@ -5036,36 +5039,36 @@ function Oa() {
|
|
|
5036
5039
|
return Ee.createChannel(i, t);
|
|
5037
5040
|
}
|
|
5038
5041
|
}
|
|
5039
|
-
var
|
|
5042
|
+
var Ar = {
|
|
5040
5043
|
createChannels() {
|
|
5041
|
-
return new
|
|
5044
|
+
return new Tr();
|
|
5042
5045
|
},
|
|
5043
5046
|
createConnectionManager(i, t) {
|
|
5044
|
-
return new
|
|
5047
|
+
return new wr(i, t);
|
|
5045
5048
|
},
|
|
5046
5049
|
createChannel(i, t) {
|
|
5047
|
-
return new
|
|
5050
|
+
return new vt(i, t);
|
|
5048
5051
|
},
|
|
5049
5052
|
createPrivateChannel(i, t) {
|
|
5050
|
-
return new
|
|
5053
|
+
return new bt(i, t);
|
|
5051
5054
|
},
|
|
5052
5055
|
createPresenceChannel(i, t) {
|
|
5053
|
-
return new
|
|
5056
|
+
return new _r(i, t);
|
|
5054
5057
|
},
|
|
5055
5058
|
createEncryptedChannel(i, t, s) {
|
|
5056
|
-
return new
|
|
5059
|
+
return new Cr(i, t, s);
|
|
5057
5060
|
},
|
|
5058
5061
|
createTimelineSender(i, t) {
|
|
5059
|
-
return new
|
|
5062
|
+
return new vr(i, t);
|
|
5060
5063
|
},
|
|
5061
5064
|
createHandshake(i, t) {
|
|
5062
|
-
return new
|
|
5065
|
+
return new mr(i, t);
|
|
5063
5066
|
},
|
|
5064
5067
|
createAssistantToTheTransportManager(i, t, s) {
|
|
5065
|
-
return new
|
|
5068
|
+
return new pr(i, t, s);
|
|
5066
5069
|
}
|
|
5067
|
-
}, Ee =
|
|
5068
|
-
class
|
|
5070
|
+
}, Ee = Ar;
|
|
5071
|
+
class hn {
|
|
5069
5072
|
constructor(t) {
|
|
5070
5073
|
this.options = t || {}, this.livesLeft = this.options.lives || 1 / 0;
|
|
5071
5074
|
}
|
|
@@ -5087,7 +5090,7 @@ function Oa() {
|
|
|
5087
5090
|
this.strategies = t, this.loop = !!s.loop, this.failFast = !!s.failFast, this.timeout = s.timeout, this.timeoutLimit = s.timeoutLimit;
|
|
5088
5091
|
}
|
|
5089
5092
|
isSupported() {
|
|
5090
|
-
return we(this.strategies,
|
|
5093
|
+
return we(this.strategies, fe.method("isSupported"));
|
|
5091
5094
|
}
|
|
5092
5095
|
connect(t, s) {
|
|
5093
5096
|
var a = this.strategies, l = 0, g = this.timeout, S = null, x = (j, Q) => {
|
|
@@ -5118,18 +5121,18 @@ function Oa() {
|
|
|
5118
5121
|
};
|
|
5119
5122
|
}
|
|
5120
5123
|
}
|
|
5121
|
-
class
|
|
5124
|
+
class _t {
|
|
5122
5125
|
constructor(t) {
|
|
5123
5126
|
this.strategies = t;
|
|
5124
5127
|
}
|
|
5125
5128
|
isSupported() {
|
|
5126
|
-
return we(this.strategies,
|
|
5129
|
+
return we(this.strategies, fe.method("isSupported"));
|
|
5127
5130
|
}
|
|
5128
5131
|
connect(t, s) {
|
|
5129
|
-
return
|
|
5132
|
+
return Rr(this.strategies, t, function(a, l) {
|
|
5130
5133
|
return function(g, S) {
|
|
5131
5134
|
if (l[a].error = g, g) {
|
|
5132
|
-
|
|
5135
|
+
Pr(l) && s(!0);
|
|
5133
5136
|
return;
|
|
5134
5137
|
}
|
|
5135
5138
|
U(l, function(x) {
|
|
@@ -5139,13 +5142,13 @@ function Oa() {
|
|
|
5139
5142
|
});
|
|
5140
5143
|
}
|
|
5141
5144
|
}
|
|
5142
|
-
function
|
|
5145
|
+
function Rr(i, t, s) {
|
|
5143
5146
|
var a = ne(i, function(l, g, S, x) {
|
|
5144
5147
|
return l.connect(t, s(g, x));
|
|
5145
5148
|
});
|
|
5146
5149
|
return {
|
|
5147
5150
|
abort: function() {
|
|
5148
|
-
U(a,
|
|
5151
|
+
U(a, Mr);
|
|
5149
5152
|
},
|
|
5150
5153
|
forceMinPriority: function(l) {
|
|
5151
5154
|
U(a, function(g) {
|
|
@@ -5154,15 +5157,15 @@ function Oa() {
|
|
|
5154
5157
|
}
|
|
5155
5158
|
};
|
|
5156
5159
|
}
|
|
5157
|
-
function
|
|
5160
|
+
function Pr(i) {
|
|
5158
5161
|
return pe(i, function(t) {
|
|
5159
5162
|
return !!t.error;
|
|
5160
5163
|
});
|
|
5161
5164
|
}
|
|
5162
|
-
function
|
|
5165
|
+
function Mr(i) {
|
|
5163
5166
|
!i.error && !i.aborted && (i.abort(), i.aborted = !0);
|
|
5164
5167
|
}
|
|
5165
|
-
class
|
|
5168
|
+
class kr {
|
|
5166
5169
|
constructor(t, s, a) {
|
|
5167
5170
|
this.strategy = t, this.transports = s, this.ttl = a.ttl || 1800 * 1e3, this.usingTLS = a.useTLS, this.timeline = a.timeline;
|
|
5168
5171
|
}
|
|
@@ -5170,8 +5173,8 @@ function Oa() {
|
|
|
5170
5173
|
return this.strategy.isSupported();
|
|
5171
5174
|
}
|
|
5172
5175
|
connect(t, s) {
|
|
5173
|
-
var a = this.usingTLS, l =
|
|
5174
|
-
if (l && l.timestamp + this.ttl >=
|
|
5176
|
+
var a = this.usingTLS, l = xr(a), g = l && l.cacheSkipCount ? l.cacheSkipCount : 0, S = [this.strategy];
|
|
5177
|
+
if (l && l.timestamp + this.ttl >= fe.now()) {
|
|
5175
5178
|
var x = this.transports[l.transport];
|
|
5176
5179
|
x && (["ws", "wss"].includes(l.transport) || g > 3 ? (this.timeline.info({
|
|
5177
5180
|
cached: !0,
|
|
@@ -5182,8 +5185,8 @@ function Oa() {
|
|
|
5182
5185
|
failFast: !0
|
|
5183
5186
|
}))) : g++);
|
|
5184
5187
|
}
|
|
5185
|
-
var j =
|
|
5186
|
-
|
|
5188
|
+
var j = fe.now(), Q = S.pop().connect(t, function ee(ue, tt) {
|
|
5189
|
+
ue ? (fn(a), S.length > 0 ? (j = fe.now(), Q = S.pop().connect(t, ee)) : s(ue)) : (Lr(a, tt.transport.name, fe.now() - j, g), s(null, tt));
|
|
5187
5190
|
});
|
|
5188
5191
|
return {
|
|
5189
5192
|
abort: function() {
|
|
@@ -5195,27 +5198,27 @@ function Oa() {
|
|
|
5195
5198
|
};
|
|
5196
5199
|
}
|
|
5197
5200
|
}
|
|
5198
|
-
function
|
|
5201
|
+
function St(i) {
|
|
5199
5202
|
return "pusherTransport" + (i ? "TLS" : "NonTLS");
|
|
5200
5203
|
}
|
|
5201
|
-
function
|
|
5204
|
+
function xr(i) {
|
|
5202
5205
|
var t = $.getLocalStorage();
|
|
5203
5206
|
if (t)
|
|
5204
5207
|
try {
|
|
5205
|
-
var s = t[
|
|
5208
|
+
var s = t[St(i)];
|
|
5206
5209
|
if (s)
|
|
5207
5210
|
return JSON.parse(s);
|
|
5208
5211
|
} catch {
|
|
5209
|
-
|
|
5212
|
+
fn(i);
|
|
5210
5213
|
}
|
|
5211
5214
|
return null;
|
|
5212
5215
|
}
|
|
5213
|
-
function
|
|
5216
|
+
function Lr(i, t, s, a) {
|
|
5214
5217
|
var l = $.getLocalStorage();
|
|
5215
5218
|
if (l)
|
|
5216
5219
|
try {
|
|
5217
|
-
l[
|
|
5218
|
-
timestamp:
|
|
5220
|
+
l[St(i)] = Qe({
|
|
5221
|
+
timestamp: fe.now(),
|
|
5219
5222
|
transport: t,
|
|
5220
5223
|
latency: s,
|
|
5221
5224
|
cacheSkipCount: a
|
|
@@ -5223,11 +5226,11 @@ function Oa() {
|
|
|
5223
5226
|
} catch {
|
|
5224
5227
|
}
|
|
5225
5228
|
}
|
|
5226
|
-
function
|
|
5229
|
+
function fn(i) {
|
|
5227
5230
|
var t = $.getLocalStorage();
|
|
5228
5231
|
if (t)
|
|
5229
5232
|
try {
|
|
5230
|
-
delete t[
|
|
5233
|
+
delete t[St(i)];
|
|
5231
5234
|
} catch {
|
|
5232
5235
|
}
|
|
5233
5236
|
}
|
|
@@ -5252,7 +5255,7 @@ function Oa() {
|
|
|
5252
5255
|
};
|
|
5253
5256
|
}
|
|
5254
5257
|
}
|
|
5255
|
-
class
|
|
5258
|
+
class ze {
|
|
5256
5259
|
constructor(t, s, a) {
|
|
5257
5260
|
this.test = t, this.trueBranch = s, this.falseBranch = a;
|
|
5258
5261
|
}
|
|
@@ -5265,7 +5268,7 @@ function Oa() {
|
|
|
5265
5268
|
return a.connect(t, s);
|
|
5266
5269
|
}
|
|
5267
5270
|
}
|
|
5268
|
-
class
|
|
5271
|
+
class Ir {
|
|
5269
5272
|
constructor(t) {
|
|
5270
5273
|
this.strategy = t;
|
|
5271
5274
|
}
|
|
@@ -5279,16 +5282,16 @@ function Oa() {
|
|
|
5279
5282
|
return a;
|
|
5280
5283
|
}
|
|
5281
5284
|
}
|
|
5282
|
-
function
|
|
5285
|
+
function je(i) {
|
|
5283
5286
|
return function() {
|
|
5284
5287
|
return i.isSupported();
|
|
5285
5288
|
};
|
|
5286
5289
|
}
|
|
5287
|
-
var
|
|
5290
|
+
var Ur = function(i, t, s) {
|
|
5288
5291
|
var a = {};
|
|
5289
|
-
function l(
|
|
5290
|
-
var
|
|
5291
|
-
return a[
|
|
5292
|
+
function l(Tn, Ii, Ui, Oi, Fi) {
|
|
5293
|
+
var En = s(i, Tn, Ii, Ui, Oi, Fi);
|
|
5294
|
+
return a[Tn] = En, En;
|
|
5292
5295
|
}
|
|
5293
5296
|
var g = Object.assign({}, t, {
|
|
5294
5297
|
hostNonTLS: i.wsHost + ":" + i.wsPort,
|
|
@@ -5304,43 +5307,43 @@ function Oa() {
|
|
|
5304
5307
|
loop: !0,
|
|
5305
5308
|
timeout: 15e3,
|
|
5306
5309
|
timeoutLimit: 6e4
|
|
5307
|
-
}, Q = new
|
|
5310
|
+
}, Q = new hn({
|
|
5308
5311
|
minPingDelay: 1e4,
|
|
5309
5312
|
maxPingDelay: i.activityTimeout
|
|
5310
|
-
}), ee = new
|
|
5313
|
+
}), ee = new hn({
|
|
5311
5314
|
lives: 2,
|
|
5312
5315
|
minPingDelay: 1e4,
|
|
5313
5316
|
maxPingDelay: i.activityTimeout
|
|
5314
|
-
}),
|
|
5315
|
-
new je(
|
|
5316
|
-
], j),
|
|
5317
|
-
new je(
|
|
5318
|
-
], j),
|
|
5319
|
-
new je(
|
|
5320
|
-
|
|
5321
|
-
new Ze(
|
|
5322
|
-
]),
|
|
5323
|
-
], j),
|
|
5324
|
-
return t.useTLS ?
|
|
5325
|
-
|
|
5326
|
-
new Ze(
|
|
5327
|
-
]) :
|
|
5328
|
-
|
|
5329
|
-
new Ze(
|
|
5330
|
-
new Ze(
|
|
5331
|
-
]), new
|
|
5317
|
+
}), ue = l("ws", "ws", 3, g, Q), tt = l("wss", "ws", 3, S, Q), Pi = l("sockjs", "sockjs", 1, x), bn = l("xhr_streaming", "xhr_streaming", 1, x, ee), Mi = l("xdr_streaming", "xdr_streaming", 1, x, ee), yn = l("xhr_polling", "xhr_polling", 1, x), ki = l("xdr_polling", "xdr_polling", 1, x), _n = new Ue([ue], j), xi = new Ue([tt], j), Li = new Ue([Pi], j), Sn = new Ue([
|
|
5318
|
+
new ze(je(bn), bn, Mi)
|
|
5319
|
+
], j), Cn = new Ue([
|
|
5320
|
+
new ze(je(yn), yn, ki)
|
|
5321
|
+
], j), wn = new Ue([
|
|
5322
|
+
new ze(je(Sn), new _t([
|
|
5323
|
+
Sn,
|
|
5324
|
+
new Ze(Cn, { delay: 4e3 })
|
|
5325
|
+
]), Cn)
|
|
5326
|
+
], j), Et = new ze(je(wn), wn, Li), At;
|
|
5327
|
+
return t.useTLS ? At = new _t([
|
|
5328
|
+
_n,
|
|
5329
|
+
new Ze(Et, { delay: 2e3 })
|
|
5330
|
+
]) : At = new _t([
|
|
5331
|
+
_n,
|
|
5332
|
+
new Ze(xi, { delay: 2e3 }),
|
|
5333
|
+
new Ze(Et, { delay: 5e3 })
|
|
5334
|
+
]), new kr(new Ir(new ze(je(ue), At, Et)), a, {
|
|
5332
5335
|
ttl: 18e5,
|
|
5333
5336
|
timeline: t.timeline,
|
|
5334
5337
|
useTLS: t.useTLS
|
|
5335
5338
|
});
|
|
5336
|
-
},
|
|
5339
|
+
}, Or = Ur, Fr = (function() {
|
|
5337
5340
|
var i = this;
|
|
5338
5341
|
i.timeline.info(i.buildTimelineMessage({
|
|
5339
5342
|
transport: i.name + (i.options.useTLS ? "s" : "")
|
|
5340
5343
|
})), i.hooks.isInitialized() ? i.changeState("initialized") : i.hooks.file ? (i.changeState("initializing"), v.load(i.hooks.file, { useTLS: i.options.useTLS }, function(t, s) {
|
|
5341
5344
|
i.hooks.isInitialized() ? (i.changeState("initialized"), s(!0)) : (t && i.onError(t), i.onClose(), s(!1));
|
|
5342
5345
|
})) : i.onClose();
|
|
5343
|
-
}),
|
|
5346
|
+
}), Dr = {
|
|
5344
5347
|
getRequest: function(i) {
|
|
5345
5348
|
var t = new window.XDomainRequest();
|
|
5346
5349
|
return t.ontimeout = function() {
|
|
@@ -5356,9 +5359,9 @@ function Oa() {
|
|
|
5356
5359
|
abortRequest: function(i) {
|
|
5357
5360
|
i.ontimeout = i.onerror = i.onprogress = i.onload = null, i.abort();
|
|
5358
5361
|
}
|
|
5359
|
-
},
|
|
5360
|
-
const
|
|
5361
|
-
class
|
|
5362
|
+
}, Nr = Dr;
|
|
5363
|
+
const qr = 256 * 1024;
|
|
5364
|
+
class zr extends Te {
|
|
5362
5365
|
constructor(t, s, a) {
|
|
5363
5366
|
super(), this.hooks = t, this.method = s, this.url = a;
|
|
5364
5367
|
}
|
|
@@ -5386,17 +5389,17 @@ function Oa() {
|
|
|
5386
5389
|
return a !== -1 ? (this.position += a + 1, s.slice(0, a)) : null;
|
|
5387
5390
|
}
|
|
5388
5391
|
isBufferTooLong(t) {
|
|
5389
|
-
return this.position === t.length && t.length >
|
|
5392
|
+
return this.position === t.length && t.length > qr;
|
|
5390
5393
|
}
|
|
5391
5394
|
}
|
|
5392
|
-
var
|
|
5395
|
+
var Ct;
|
|
5393
5396
|
(function(i) {
|
|
5394
5397
|
i[i.CONNECTING = 0] = "CONNECTING", i[i.OPEN = 1] = "OPEN", i[i.CLOSED = 3] = "CLOSED";
|
|
5395
|
-
})(
|
|
5396
|
-
var Oe =
|
|
5397
|
-
class
|
|
5398
|
+
})(Ct || (Ct = {}));
|
|
5399
|
+
var Oe = Ct, jr = 1;
|
|
5400
|
+
class $r {
|
|
5398
5401
|
constructor(t, s) {
|
|
5399
|
-
this.hooks = t, this.session =
|
|
5402
|
+
this.hooks = t, this.session = gn(1e3) + "/" + Xr(8), this.location = Hr(s), this.readyState = Oe.CONNECTING, this.openStream();
|
|
5400
5403
|
}
|
|
5401
5404
|
send(t) {
|
|
5402
5405
|
return this.sendRaw(JSON.stringify([t]));
|
|
@@ -5410,7 +5413,7 @@ function Oa() {
|
|
|
5410
5413
|
sendRaw(t) {
|
|
5411
5414
|
if (this.readyState === Oe.OPEN)
|
|
5412
5415
|
try {
|
|
5413
|
-
return $.createSocketRequest("POST",
|
|
5416
|
+
return $.createSocketRequest("POST", pn(Br(this.location, this.session))).start(t), !0;
|
|
5414
5417
|
} catch {
|
|
5415
5418
|
return !1;
|
|
5416
5419
|
}
|
|
@@ -5453,7 +5456,7 @@ function Oa() {
|
|
|
5453
5456
|
}
|
|
5454
5457
|
}
|
|
5455
5458
|
onOpen(t) {
|
|
5456
|
-
this.readyState === Oe.CONNECTING ? (t && t.hostname && (this.location.base =
|
|
5459
|
+
this.readyState === Oe.CONNECTING ? (t && t.hostname && (this.location.base = Vr(this.location.base, t.hostname)), this.readyState = Oe.OPEN, this.onopen && this.onopen()) : this.onClose(1006, "Server lost session", !0);
|
|
5457
5460
|
}
|
|
5458
5461
|
onEvent(t) {
|
|
5459
5462
|
this.readyState === Oe.OPEN && this.onmessage && this.onmessage({ data: t });
|
|
@@ -5465,7 +5468,7 @@ function Oa() {
|
|
|
5465
5468
|
this.onerror && this.onerror(t);
|
|
5466
5469
|
}
|
|
5467
5470
|
openStream() {
|
|
5468
|
-
this.stream = $.createSocketRequest("POST",
|
|
5471
|
+
this.stream = $.createSocketRequest("POST", pn(this.hooks.getReceiveURL(this.location, this.session))), this.stream.bind("chunk", (t) => {
|
|
5469
5472
|
this.onChunk(t);
|
|
5470
5473
|
}), this.stream.bind("finished", (t) => {
|
|
5471
5474
|
this.hooks.onFinished(this, t);
|
|
@@ -5475,7 +5478,7 @@ function Oa() {
|
|
|
5475
5478
|
try {
|
|
5476
5479
|
this.stream.start();
|
|
5477
5480
|
} catch (t) {
|
|
5478
|
-
|
|
5481
|
+
fe.defer(() => {
|
|
5479
5482
|
this.onError(t), this.onClose(1006, "Could not start streaming", !1);
|
|
5480
5483
|
});
|
|
5481
5484
|
}
|
|
@@ -5484,33 +5487,33 @@ function Oa() {
|
|
|
5484
5487
|
this.stream && (this.stream.unbind_all(), this.stream.close(), this.stream = null);
|
|
5485
5488
|
}
|
|
5486
5489
|
}
|
|
5487
|
-
function
|
|
5490
|
+
function Hr(i) {
|
|
5488
5491
|
var t = /([^\?]*)\/*(\??.*)/.exec(i);
|
|
5489
5492
|
return {
|
|
5490
5493
|
base: t[1],
|
|
5491
5494
|
queryString: t[2]
|
|
5492
5495
|
};
|
|
5493
5496
|
}
|
|
5494
|
-
function
|
|
5497
|
+
function Br(i, t) {
|
|
5495
5498
|
return i.base + "/" + t + "/xhr_send";
|
|
5496
5499
|
}
|
|
5497
|
-
function
|
|
5500
|
+
function pn(i) {
|
|
5498
5501
|
var t = i.indexOf("?") === -1 ? "?" : "&";
|
|
5499
|
-
return i + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" +
|
|
5502
|
+
return i + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" + jr++;
|
|
5500
5503
|
}
|
|
5501
|
-
function
|
|
5504
|
+
function Vr(i, t) {
|
|
5502
5505
|
var s = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(i);
|
|
5503
5506
|
return s[1] + t + s[3];
|
|
5504
5507
|
}
|
|
5505
|
-
function
|
|
5508
|
+
function gn(i) {
|
|
5506
5509
|
return $.randomInt(i);
|
|
5507
5510
|
}
|
|
5508
|
-
function
|
|
5511
|
+
function Xr(i) {
|
|
5509
5512
|
for (var t = [], s = 0; s < i; s++)
|
|
5510
|
-
t.push(
|
|
5513
|
+
t.push(gn(32).toString(32));
|
|
5511
5514
|
return t.join("");
|
|
5512
5515
|
}
|
|
5513
|
-
var
|
|
5516
|
+
var Wr = $r, Gr = {
|
|
5514
5517
|
getReceiveURL: function(i, t) {
|
|
5515
5518
|
return i.base + "/" + t + "/xhr_streaming" + i.queryString;
|
|
5516
5519
|
},
|
|
@@ -5523,7 +5526,7 @@ function Oa() {
|
|
|
5523
5526
|
onFinished: function(i, t) {
|
|
5524
5527
|
i.onClose(1006, "Connection interrupted (" + t + ")", !1);
|
|
5525
5528
|
}
|
|
5526
|
-
},
|
|
5529
|
+
}, Jr = Gr, Kr = {
|
|
5527
5530
|
getReceiveURL: function(i, t) {
|
|
5528
5531
|
return i.base + "/" + t + "/xhr" + i.queryString;
|
|
5529
5532
|
},
|
|
@@ -5535,7 +5538,7 @@ function Oa() {
|
|
|
5535
5538
|
onFinished: function(i, t) {
|
|
5536
5539
|
t === 200 ? i.reconnect() : i.onClose(1006, "Connection interrupted (" + t + ")", !1);
|
|
5537
5540
|
}
|
|
5538
|
-
},
|
|
5541
|
+
}, Qr = Kr, Yr = {
|
|
5539
5542
|
getRequest: function(i) {
|
|
5540
5543
|
var t = $.getXHRAPI(), s = new t();
|
|
5541
5544
|
return s.onreadystatechange = s.onprogress = function() {
|
|
@@ -5552,36 +5555,36 @@ function Oa() {
|
|
|
5552
5555
|
abortRequest: function(i) {
|
|
5553
5556
|
i.onreadystatechange = null, i.abort();
|
|
5554
5557
|
}
|
|
5555
|
-
},
|
|
5558
|
+
}, Zr = Yr, ei = {
|
|
5556
5559
|
createStreamingSocket(i) {
|
|
5557
|
-
return this.createSocket(
|
|
5560
|
+
return this.createSocket(Jr, i);
|
|
5558
5561
|
},
|
|
5559
5562
|
createPollingSocket(i) {
|
|
5560
|
-
return this.createSocket(
|
|
5563
|
+
return this.createSocket(Qr, i);
|
|
5561
5564
|
},
|
|
5562
5565
|
createSocket(i, t) {
|
|
5563
|
-
return new
|
|
5566
|
+
return new Wr(i, t);
|
|
5564
5567
|
},
|
|
5565
5568
|
createXHR(i, t) {
|
|
5566
|
-
return this.createRequest(
|
|
5569
|
+
return this.createRequest(Zr, i, t);
|
|
5567
5570
|
},
|
|
5568
5571
|
createRequest(i, t, s) {
|
|
5569
|
-
return new
|
|
5572
|
+
return new zr(i, t, s);
|
|
5570
5573
|
}
|
|
5571
|
-
},
|
|
5572
|
-
|
|
5573
|
-
return this.createRequest(
|
|
5574
|
+
}, mn = ei;
|
|
5575
|
+
mn.createXDR = function(i, t) {
|
|
5576
|
+
return this.createRequest(Nr, i, t);
|
|
5574
5577
|
};
|
|
5575
|
-
var
|
|
5578
|
+
var ti = mn, ni = {
|
|
5576
5579
|
nextAuthCallbackID: 1,
|
|
5577
5580
|
auth_callbacks: {},
|
|
5578
5581
|
ScriptReceivers: d,
|
|
5579
5582
|
DependenciesReceivers: C,
|
|
5580
|
-
getDefaultStrategy:
|
|
5581
|
-
Transports:
|
|
5582
|
-
transportConnectionInitializer:
|
|
5583
|
-
HTTPFactory:
|
|
5584
|
-
TimelineTransport:
|
|
5583
|
+
getDefaultStrategy: Or,
|
|
5584
|
+
Transports: dr,
|
|
5585
|
+
transportConnectionInitializer: Fr,
|
|
5586
|
+
HTTPFactory: ti,
|
|
5587
|
+
TimelineTransport: Ys,
|
|
5585
5588
|
getXHRAPI() {
|
|
5586
5589
|
return window.XMLHttpRequest;
|
|
5587
5590
|
},
|
|
@@ -5602,7 +5605,7 @@ function Oa() {
|
|
|
5602
5605
|
return this.getDocument().location.protocol;
|
|
5603
5606
|
},
|
|
5604
5607
|
getAuthorizers() {
|
|
5605
|
-
return { ajax: K, jsonp:
|
|
5608
|
+
return { ajax: K, jsonp: Ws };
|
|
5606
5609
|
},
|
|
5607
5610
|
onDocumentBody(i) {
|
|
5608
5611
|
document.body ? i() : setTimeout(() => {
|
|
@@ -5610,10 +5613,10 @@ function Oa() {
|
|
|
5610
5613
|
}, 0);
|
|
5611
5614
|
},
|
|
5612
5615
|
createJSONPRequest(i, t) {
|
|
5613
|
-
return new
|
|
5616
|
+
return new Js(i, t);
|
|
5614
5617
|
},
|
|
5615
5618
|
createScriptRequest(i) {
|
|
5616
|
-
return new
|
|
5619
|
+
return new Gs(i);
|
|
5617
5620
|
},
|
|
5618
5621
|
getLocalStorage() {
|
|
5619
5622
|
try {
|
|
@@ -5633,7 +5636,7 @@ function Oa() {
|
|
|
5633
5636
|
return new ActiveXObject("Microsoft.XMLHTTP");
|
|
5634
5637
|
},
|
|
5635
5638
|
getNetwork() {
|
|
5636
|
-
return
|
|
5639
|
+
return fr;
|
|
5637
5640
|
},
|
|
5638
5641
|
createWebSocket(i) {
|
|
5639
5642
|
var t = this.getWebSocketAPI();
|
|
@@ -5665,17 +5668,17 @@ function Oa() {
|
|
|
5665
5668
|
return (window.crypto || window.msCrypto).getRandomValues(new Uint32Array(1))[0] / Math.pow(2, 32);
|
|
5666
5669
|
}() * i);
|
|
5667
5670
|
}
|
|
5668
|
-
}, $ =
|
|
5671
|
+
}, $ = ni, wt;
|
|
5669
5672
|
(function(i) {
|
|
5670
5673
|
i[i.ERROR = 3] = "ERROR", i[i.INFO = 6] = "INFO", i[i.DEBUG = 7] = "DEBUG";
|
|
5671
|
-
})(
|
|
5672
|
-
var et =
|
|
5673
|
-
class
|
|
5674
|
+
})(wt || (wt = {}));
|
|
5675
|
+
var et = wt;
|
|
5676
|
+
class si {
|
|
5674
5677
|
constructor(t, s, a) {
|
|
5675
5678
|
this.key = t, this.session = s, this.events = [], this.options = a || {}, this.sent = 0, this.uniqueID = 0;
|
|
5676
5679
|
}
|
|
5677
5680
|
log(t, s) {
|
|
5678
|
-
t <= this.options.level && (this.events.push(me({}, s, { timestamp:
|
|
5681
|
+
t <= this.options.level && (this.events.push(me({}, s, { timestamp: fe.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
|
|
5679
5682
|
}
|
|
5680
5683
|
error(t) {
|
|
5681
5684
|
this.log(et.ERROR, t);
|
|
@@ -5708,7 +5711,7 @@ function Oa() {
|
|
|
5708
5711
|
return this.uniqueID++, this.uniqueID;
|
|
5709
5712
|
}
|
|
5710
5713
|
}
|
|
5711
|
-
class
|
|
5714
|
+
class ri {
|
|
5712
5715
|
constructor(t, s, a, l) {
|
|
5713
5716
|
this.name = t, this.priority = s, this.transport = a, this.options = l || {};
|
|
5714
5717
|
}
|
|
@@ -5720,20 +5723,20 @@ function Oa() {
|
|
|
5720
5723
|
connect(t, s) {
|
|
5721
5724
|
if (this.isSupported()) {
|
|
5722
5725
|
if (this.priority < t)
|
|
5723
|
-
return
|
|
5724
|
-
} else return
|
|
5726
|
+
return vn(new O(), s);
|
|
5727
|
+
} else return vn(new te(), s);
|
|
5725
5728
|
var a = !1, l = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), g = null, S = function() {
|
|
5726
5729
|
l.unbind("initialized", S), l.connect();
|
|
5727
5730
|
}, x = function() {
|
|
5728
|
-
g = Ee.createHandshake(l, function(
|
|
5729
|
-
a = !0, ee(), s(null,
|
|
5731
|
+
g = Ee.createHandshake(l, function(ue) {
|
|
5732
|
+
a = !0, ee(), s(null, ue);
|
|
5730
5733
|
});
|
|
5731
|
-
}, j = function(
|
|
5732
|
-
ee(), s(
|
|
5734
|
+
}, j = function(ue) {
|
|
5735
|
+
ee(), s(ue);
|
|
5733
5736
|
}, Q = function() {
|
|
5734
5737
|
ee();
|
|
5735
|
-
var
|
|
5736
|
-
|
|
5738
|
+
var ue;
|
|
5739
|
+
ue = Qe(l), s(new z(ue));
|
|
5737
5740
|
}, ee = function() {
|
|
5738
5741
|
l.unbind("initialized", S), l.unbind("open", x), l.unbind("error", j), l.unbind("closed", Q);
|
|
5739
5742
|
};
|
|
@@ -5741,14 +5744,14 @@ function Oa() {
|
|
|
5741
5744
|
abort: () => {
|
|
5742
5745
|
a || (ee(), g ? g.close() : l.close());
|
|
5743
5746
|
},
|
|
5744
|
-
forceMinPriority: (
|
|
5745
|
-
a || this.priority <
|
|
5747
|
+
forceMinPriority: (ue) => {
|
|
5748
|
+
a || this.priority < ue && (g ? g.close() : l.close());
|
|
5746
5749
|
}
|
|
5747
5750
|
};
|
|
5748
5751
|
}
|
|
5749
5752
|
}
|
|
5750
|
-
function
|
|
5751
|
-
return
|
|
5753
|
+
function vn(i, t) {
|
|
5754
|
+
return fe.defer(function() {
|
|
5752
5755
|
t(i);
|
|
5753
5756
|
}), {
|
|
5754
5757
|
abort: function() {
|
|
@@ -5757,19 +5760,19 @@ function Oa() {
|
|
|
5757
5760
|
}
|
|
5758
5761
|
};
|
|
5759
5762
|
}
|
|
5760
|
-
const { Transports:
|
|
5761
|
-
var
|
|
5762
|
-
var S =
|
|
5763
|
+
const { Transports: ii } = $;
|
|
5764
|
+
var oi = function(i, t, s, a, l, g) {
|
|
5765
|
+
var S = ii[s];
|
|
5763
5766
|
if (!S)
|
|
5764
5767
|
throw new W(s);
|
|
5765
|
-
var x = (!i.enabledTransports ||
|
|
5766
|
-
return x ? (l = Object.assign({ ignoreNullOrigin: i.ignoreNullOrigin }, l), j = new
|
|
5767
|
-
},
|
|
5768
|
+
var x = (!i.enabledTransports || ft(i.enabledTransports, t) !== -1) && (!i.disabledTransports || ft(i.disabledTransports, t) === -1), j;
|
|
5769
|
+
return x ? (l = Object.assign({ ignoreNullOrigin: i.ignoreNullOrigin }, l), j = new ri(t, a, g ? g.getAssistant(S) : S, l)) : j = ai, j;
|
|
5770
|
+
}, ai = {
|
|
5768
5771
|
isSupported: function() {
|
|
5769
5772
|
return !1;
|
|
5770
5773
|
},
|
|
5771
5774
|
connect: function(i, t) {
|
|
5772
|
-
var s =
|
|
5775
|
+
var s = fe.defer(function() {
|
|
5773
5776
|
t(new te());
|
|
5774
5777
|
});
|
|
5775
5778
|
return {
|
|
@@ -5781,14 +5784,14 @@ function Oa() {
|
|
|
5781
5784
|
};
|
|
5782
5785
|
}
|
|
5783
5786
|
};
|
|
5784
|
-
function
|
|
5787
|
+
function ci(i) {
|
|
5785
5788
|
if (i == null)
|
|
5786
5789
|
throw "You must pass an options object";
|
|
5787
5790
|
if (i.cluster == null)
|
|
5788
5791
|
throw "Options object must provide a cluster";
|
|
5789
5792
|
"disableStats" in i && ae.warn("The disableStats option is deprecated in favor of enableStats");
|
|
5790
5793
|
}
|
|
5791
|
-
const
|
|
5794
|
+
const ui = (i, t) => {
|
|
5792
5795
|
var s = "socket_id=" + encodeURIComponent(i.socketId);
|
|
5793
5796
|
for (var a in t.params)
|
|
5794
5797
|
s += "&" + encodeURIComponent(a) + "=" + encodeURIComponent(t.params[a]);
|
|
@@ -5799,15 +5802,15 @@ function Oa() {
|
|
|
5799
5802
|
}
|
|
5800
5803
|
return s;
|
|
5801
5804
|
};
|
|
5802
|
-
var
|
|
5805
|
+
var li = (i) => {
|
|
5803
5806
|
if (typeof $.getAuthorizers()[i.transport] > "u")
|
|
5804
5807
|
throw `'${i.transport}' is not a recognized auth transport`;
|
|
5805
5808
|
return (t, s) => {
|
|
5806
|
-
const a =
|
|
5809
|
+
const a = ui(t, i);
|
|
5807
5810
|
$.getAuthorizers()[i.transport]($, a, i, w.UserAuthentication, s);
|
|
5808
5811
|
};
|
|
5809
5812
|
};
|
|
5810
|
-
const
|
|
5813
|
+
const di = (i, t) => {
|
|
5811
5814
|
var s = "socket_id=" + encodeURIComponent(i.socketId);
|
|
5812
5815
|
s += "&channel_name=" + encodeURIComponent(i.channelName);
|
|
5813
5816
|
for (var a in t.params)
|
|
@@ -5819,15 +5822,15 @@ function Oa() {
|
|
|
5819
5822
|
}
|
|
5820
5823
|
return s;
|
|
5821
5824
|
};
|
|
5822
|
-
var
|
|
5825
|
+
var hi = (i) => {
|
|
5823
5826
|
if (typeof $.getAuthorizers()[i.transport] > "u")
|
|
5824
5827
|
throw `'${i.transport}' is not a recognized auth transport`;
|
|
5825
5828
|
return (t, s) => {
|
|
5826
|
-
const a =
|
|
5829
|
+
const a = di(t, i);
|
|
5827
5830
|
$.getAuthorizers()[i.transport]($, a, i, w.ChannelAuthorization, s);
|
|
5828
5831
|
};
|
|
5829
5832
|
};
|
|
5830
|
-
const
|
|
5833
|
+
const fi = (i, t, s) => {
|
|
5831
5834
|
const a = {
|
|
5832
5835
|
authTransport: t.transport,
|
|
5833
5836
|
authEndpoint: t.endpoint,
|
|
@@ -5841,7 +5844,7 @@ function Oa() {
|
|
|
5841
5844
|
s(S, a).authorize(l.socketId, g);
|
|
5842
5845
|
};
|
|
5843
5846
|
};
|
|
5844
|
-
function
|
|
5847
|
+
function pi(i, t) {
|
|
5845
5848
|
let s = {
|
|
5846
5849
|
activityTimeout: i.activityTimeout || h.activityTimeout,
|
|
5847
5850
|
cluster: i.cluster,
|
|
@@ -5854,46 +5857,46 @@ function Oa() {
|
|
|
5854
5857
|
wsPath: i.wsPath || h.wsPath,
|
|
5855
5858
|
wsPort: i.wsPort || h.wsPort,
|
|
5856
5859
|
wssPort: i.wssPort || h.wssPort,
|
|
5857
|
-
enableStats:
|
|
5858
|
-
httpHost:
|
|
5859
|
-
useTLS:
|
|
5860
|
-
wsHost:
|
|
5861
|
-
userAuthenticator:
|
|
5862
|
-
channelAuthorizer:
|
|
5860
|
+
enableStats: yi(i),
|
|
5861
|
+
httpHost: gi(i),
|
|
5862
|
+
useTLS: bi(i),
|
|
5863
|
+
wsHost: mi(i),
|
|
5864
|
+
userAuthenticator: _i(i),
|
|
5865
|
+
channelAuthorizer: Ci(i, t)
|
|
5863
5866
|
};
|
|
5864
5867
|
return "disabledTransports" in i && (s.disabledTransports = i.disabledTransports), "enabledTransports" in i && (s.enabledTransports = i.enabledTransports), "ignoreNullOrigin" in i && (s.ignoreNullOrigin = i.ignoreNullOrigin), "timelineParams" in i && (s.timelineParams = i.timelineParams), "nacl" in i && (s.nacl = i.nacl), s;
|
|
5865
5868
|
}
|
|
5866
|
-
function
|
|
5869
|
+
function gi(i) {
|
|
5867
5870
|
return i.httpHost ? i.httpHost : i.cluster ? `sockjs-${i.cluster}.pusher.com` : h.httpHost;
|
|
5868
5871
|
}
|
|
5869
|
-
function
|
|
5870
|
-
return i.wsHost ? i.wsHost :
|
|
5872
|
+
function mi(i) {
|
|
5873
|
+
return i.wsHost ? i.wsHost : vi(i.cluster);
|
|
5871
5874
|
}
|
|
5872
|
-
function
|
|
5875
|
+
function vi(i) {
|
|
5873
5876
|
return `ws-${i}.pusher.com`;
|
|
5874
5877
|
}
|
|
5875
|
-
function
|
|
5878
|
+
function bi(i) {
|
|
5876
5879
|
return $.getProtocol() === "https:" ? !0 : i.forceTLS !== !1;
|
|
5877
5880
|
}
|
|
5878
|
-
function
|
|
5881
|
+
function yi(i) {
|
|
5879
5882
|
return "enableStats" in i ? i.enableStats : "disableStats" in i ? !i.disableStats : !1;
|
|
5880
5883
|
}
|
|
5881
|
-
function
|
|
5884
|
+
function _i(i) {
|
|
5882
5885
|
const t = Object.assign(Object.assign({}, h.userAuthentication), i.userAuthentication);
|
|
5883
|
-
return "customHandler" in t && t.customHandler != null ? t.customHandler :
|
|
5886
|
+
return "customHandler" in t && t.customHandler != null ? t.customHandler : li(t);
|
|
5884
5887
|
}
|
|
5885
|
-
function
|
|
5888
|
+
function Si(i, t) {
|
|
5886
5889
|
let s;
|
|
5887
5890
|
return "channelAuthorization" in i ? s = Object.assign(Object.assign({}, h.channelAuthorization), i.channelAuthorization) : (s = {
|
|
5888
5891
|
transport: i.authTransport || h.authTransport,
|
|
5889
5892
|
endpoint: i.authEndpoint || h.authEndpoint
|
|
5890
|
-
}, "auth" in i && ("params" in i.auth && (s.params = i.auth.params), "headers" in i.auth && (s.headers = i.auth.headers)), "authorizer" in i && (s.customHandler =
|
|
5893
|
+
}, "auth" in i && ("params" in i.auth && (s.params = i.auth.params), "headers" in i.auth && (s.headers = i.auth.headers)), "authorizer" in i && (s.customHandler = fi(t, s, i.authorizer))), s;
|
|
5891
5894
|
}
|
|
5892
|
-
function
|
|
5893
|
-
const s =
|
|
5894
|
-
return "customHandler" in s && s.customHandler != null ? s.customHandler :
|
|
5895
|
+
function Ci(i, t) {
|
|
5896
|
+
const s = Si(i, t);
|
|
5897
|
+
return "customHandler" in s && s.customHandler != null ? s.customHandler : hi(s);
|
|
5895
5898
|
}
|
|
5896
|
-
class
|
|
5899
|
+
class wi extends Te {
|
|
5897
5900
|
constructor(t) {
|
|
5898
5901
|
super(function(s, a) {
|
|
5899
5902
|
ae.debug(`No callbacks on watchlist events for ${s}`);
|
|
@@ -5911,14 +5914,14 @@ function Oa() {
|
|
|
5911
5914
|
});
|
|
5912
5915
|
}
|
|
5913
5916
|
}
|
|
5914
|
-
function
|
|
5917
|
+
function Ti() {
|
|
5915
5918
|
let i, t;
|
|
5916
5919
|
return { promise: new Promise((a, l) => {
|
|
5917
5920
|
i = a, t = l;
|
|
5918
5921
|
}), resolve: i, reject: t };
|
|
5919
5922
|
}
|
|
5920
|
-
var
|
|
5921
|
-
class
|
|
5923
|
+
var Ei = Ti;
|
|
5924
|
+
class Ai extends Te {
|
|
5922
5925
|
constructor(t) {
|
|
5923
5926
|
super(function(s, a) {
|
|
5924
5927
|
ae.debug("No callbacks on user for " + s);
|
|
@@ -5933,7 +5936,7 @@ function Oa() {
|
|
|
5933
5936
|
});
|
|
5934
5937
|
}, this.pusher = t, this.pusher.connection.bind("state_change", ({ previous: s, current: a }) => {
|
|
5935
5938
|
s !== "connected" && a === "connected" && this._signin(), s === "connected" && a !== "connected" && (this._cleanup(), this._newSigninPromiseIfNeeded());
|
|
5936
|
-
}), this.watchlist = new
|
|
5939
|
+
}), this.watchlist = new wi(t), this.pusher.connection.bind("message", (s) => {
|
|
5937
5940
|
var a = s.event;
|
|
5938
5941
|
a === "pusher:signin_success" && this._onSigninSuccess(s.data), this.serverToUserChannel && this.serverToUserChannel.name === s.channel && this.serverToUserChannel.handleEvent(s);
|
|
5939
5942
|
});
|
|
@@ -5963,7 +5966,7 @@ function Oa() {
|
|
|
5963
5966
|
const t = (s) => {
|
|
5964
5967
|
s.subscriptionPending && s.subscriptionCancelled ? s.reinstateSubscription() : !s.subscriptionPending && this.pusher.connection.state === "connected" && s.subscribe();
|
|
5965
5968
|
};
|
|
5966
|
-
this.serverToUserChannel = new
|
|
5969
|
+
this.serverToUserChannel = new vt(`#server-to-user-${this.user_data.id}`, this.pusher), this.serverToUserChannel.bind_global((s, a) => {
|
|
5967
5970
|
s.indexOf("pusher_internal:") === 0 || s.indexOf("pusher:") === 0 || this.emit(s, a);
|
|
5968
5971
|
}), t(this.serverToUserChannel);
|
|
5969
5972
|
}
|
|
@@ -5973,7 +5976,7 @@ function Oa() {
|
|
|
5973
5976
|
_newSigninPromiseIfNeeded() {
|
|
5974
5977
|
if (!this.signin_requested || this.signinDonePromise && !this.signinDonePromise.done)
|
|
5975
5978
|
return;
|
|
5976
|
-
const { promise: t, resolve: s } =
|
|
5979
|
+
const { promise: t, resolve: s } = Ei();
|
|
5977
5980
|
t.done = !1;
|
|
5978
5981
|
const a = () => {
|
|
5979
5982
|
t.done = !0;
|
|
@@ -5988,12 +5991,12 @@ function Oa() {
|
|
|
5988
5991
|
ge.instances[t].connect();
|
|
5989
5992
|
}
|
|
5990
5993
|
static getClientFeatures() {
|
|
5991
|
-
return
|
|
5994
|
+
return R(Re({ ws: $.Transports.ws }, function(t) {
|
|
5992
5995
|
return t.isSupported({});
|
|
5993
5996
|
}));
|
|
5994
5997
|
}
|
|
5995
5998
|
constructor(t, s) {
|
|
5996
|
-
|
|
5999
|
+
Ri(t), ci(s), this.key = t, this.config = pi(s, this), this.channels = Ee.createChannels(), this.global_emitter = new Te(), this.sessionID = $.randomInt(1e9), this.timeline = new si(this.key, this.sessionID, {
|
|
5997
6000
|
cluster: this.config.cluster,
|
|
5998
6001
|
features: ge.getClientFeatures(),
|
|
5999
6002
|
params: this.config.timelineParams || {},
|
|
@@ -6004,7 +6007,7 @@ function Oa() {
|
|
|
6004
6007
|
host: this.config.statsHost,
|
|
6005
6008
|
path: "/timeline/v2/" + $.TimelineTransport.name
|
|
6006
6009
|
}));
|
|
6007
|
-
var a = (l) => $.getDefaultStrategy(this.config, l,
|
|
6010
|
+
var a = (l) => $.getDefaultStrategy(this.config, l, oi);
|
|
6008
6011
|
this.connection = Ee.createConnectionManager(this.key, {
|
|
6009
6012
|
getStrategy: a,
|
|
6010
6013
|
timeline: this.timeline,
|
|
@@ -6027,7 +6030,7 @@ function Oa() {
|
|
|
6027
6030
|
this.channels.disconnect();
|
|
6028
6031
|
}), this.connection.bind("error", (l) => {
|
|
6029
6032
|
ae.warn(l);
|
|
6030
|
-
}), ge.instances.push(this), this.timeline.info({ instances: ge.instances.length }), this.user = new
|
|
6033
|
+
}), ge.instances.push(this), this.timeline.info({ instances: ge.instances.length }), this.user = new Ai(this), ge.isReady && this.connect();
|
|
6031
6034
|
}
|
|
6032
6035
|
channel(t) {
|
|
6033
6036
|
return this.channels.find(t);
|
|
@@ -6085,8 +6088,8 @@ function Oa() {
|
|
|
6085
6088
|
}
|
|
6086
6089
|
}
|
|
6087
6090
|
ge.instances = [], ge.isReady = !1, ge.logToConsole = !1, ge.Runtime = $, ge.ScriptReceivers = $.ScriptReceivers, ge.DependenciesReceivers = $.DependenciesReceivers, ge.auth_callbacks = $.auth_callbacks;
|
|
6088
|
-
var
|
|
6089
|
-
function
|
|
6091
|
+
var Tt = o.default = ge;
|
|
6092
|
+
function Ri(i) {
|
|
6090
6093
|
if (i == null)
|
|
6091
6094
|
throw "You must pass your app key when you instantiate Pusher.";
|
|
6092
6095
|
}
|
|
@@ -6096,14 +6099,14 @@ function Oa() {
|
|
|
6096
6099
|
])
|
|
6097
6100
|
);
|
|
6098
6101
|
});
|
|
6099
|
-
})(
|
|
6102
|
+
})(Ut)), Ut.exports;
|
|
6100
6103
|
}
|
|
6101
6104
|
var Fa = Oa();
|
|
6102
6105
|
const Da = /* @__PURE__ */ Ua(Fa), Na = "/v1/messenger/bootstrap", qa = 3e4, za = 3e4, ja = 5 * 6e4;
|
|
6103
|
-
function
|
|
6106
|
+
function re(e) {
|
|
6104
6107
|
return typeof e == "object" && e !== null;
|
|
6105
6108
|
}
|
|
6106
|
-
function
|
|
6109
|
+
function de(e, n) {
|
|
6107
6110
|
return typeof e[n] == "string";
|
|
6108
6111
|
}
|
|
6109
6112
|
function Ce(e, n) {
|
|
@@ -6112,7 +6115,7 @@ function Ce(e, n) {
|
|
|
6112
6115
|
throw new Error(`Invalid messenger bootstrap payload: missing string ${n}`);
|
|
6113
6116
|
return r.trim();
|
|
6114
6117
|
}
|
|
6115
|
-
function
|
|
6118
|
+
function Ve(e, n) {
|
|
6116
6119
|
const r = e[n];
|
|
6117
6120
|
if (r == null)
|
|
6118
6121
|
return null;
|
|
@@ -6140,28 +6143,28 @@ function Ba(e) {
|
|
|
6140
6143
|
return e.startsWith("/") ? e : `/${e}`;
|
|
6141
6144
|
}
|
|
6142
6145
|
function Va(e) {
|
|
6143
|
-
const n =
|
|
6144
|
-
if (!
|
|
6146
|
+
const n = re(e) && re(e.data) ? e.data : e;
|
|
6147
|
+
if (!re(n))
|
|
6145
6148
|
throw new Error("Invalid messenger bootstrap payload: expected object");
|
|
6146
6149
|
const r = n.auth, o = n.service;
|
|
6147
|
-
if (!
|
|
6150
|
+
if (!re(r) || !re(o))
|
|
6148
6151
|
throw new Error("Invalid messenger bootstrap payload: missing auth or service data");
|
|
6149
6152
|
const c = r.user, u = o.reverb;
|
|
6150
|
-
if (!
|
|
6153
|
+
if (!re(c) || !re(u))
|
|
6151
6154
|
throw new Error("Invalid messenger bootstrap payload: missing user or reverb data");
|
|
6152
|
-
const d = Ba(
|
|
6155
|
+
const d = Ba(Ve(u, "path"));
|
|
6153
6156
|
return {
|
|
6154
6157
|
auth: {
|
|
6155
6158
|
token: Ce(r, "token"),
|
|
6156
6159
|
tokenType: Ce(r, "token_type"),
|
|
6157
|
-
expiresAt:
|
|
6158
|
-
tenantId:
|
|
6160
|
+
expiresAt: Ve(r, "expires_at"),
|
|
6161
|
+
tenantId: Ve(r, "tenant_id"),
|
|
6159
6162
|
user: {
|
|
6160
6163
|
id: Ce(c, "id"),
|
|
6161
6164
|
handle: Ce(c, "handle"),
|
|
6162
6165
|
name: Ce(c, "name"),
|
|
6163
|
-
avatarUrl:
|
|
6164
|
-
email:
|
|
6166
|
+
avatarUrl: Ve(c, "avatar_url"),
|
|
6167
|
+
email: Ve(c, "email")
|
|
6165
6168
|
}
|
|
6166
6169
|
},
|
|
6167
6170
|
service: {
|
|
@@ -6182,21 +6185,21 @@ function Xa(e) {
|
|
|
6182
6185
|
return e.replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/:\d+$/, "");
|
|
6183
6186
|
}
|
|
6184
6187
|
function Wa(e) {
|
|
6185
|
-
if (!
|
|
6188
|
+
if (!re(e))
|
|
6186
6189
|
return !1;
|
|
6187
|
-
const n =
|
|
6190
|
+
const n = re(e.response) ? e.response : null;
|
|
6188
6191
|
if (n?.status !== 403)
|
|
6189
6192
|
return !1;
|
|
6190
6193
|
const r = n.data;
|
|
6191
6194
|
return r?.code === "ACCOUNT_SUSPENDED" || r?.errors?.reason === "account_suspended" ? !0 : typeof r?.message == "string" && r.message.toLowerCase().includes("suspended");
|
|
6192
6195
|
}
|
|
6193
|
-
function
|
|
6194
|
-
if (e.headers instanceof
|
|
6196
|
+
function Kn(e, n) {
|
|
6197
|
+
if (e.headers instanceof An) {
|
|
6195
6198
|
e.headers.set("Authorization", `Bearer ${n}`), e.headers.set("Accept", "application/json"), e.headers.set("X-Requested-With", "XMLHttpRequest"), typeof FormData < "u" && e.data instanceof FormData && (e.headers.delete("Content-Type"), e.headers.delete("content-type"));
|
|
6196
6199
|
return;
|
|
6197
6200
|
}
|
|
6198
|
-
const r =
|
|
6199
|
-
e.headers = new
|
|
6201
|
+
const r = re(e.headers) ? e.headers : {};
|
|
6202
|
+
e.headers = new An({
|
|
6200
6203
|
...r,
|
|
6201
6204
|
Authorization: `Bearer ${n}`,
|
|
6202
6205
|
Accept: "application/json",
|
|
@@ -6217,7 +6220,7 @@ function Ga(e) {
|
|
|
6217
6220
|
return n === "online" || n === "idle" || n === "dnd" || n === "offline" ? n : null;
|
|
6218
6221
|
}
|
|
6219
6222
|
function Ja(e, n) {
|
|
6220
|
-
if (!
|
|
6223
|
+
if (!re(e))
|
|
6221
6224
|
return null;
|
|
6222
6225
|
const r = Ge(e, "user_id", "userId"), o = Ga(e.status);
|
|
6223
6226
|
if (!r || !o)
|
|
@@ -6232,13 +6235,13 @@ function Ja(e, n) {
|
|
|
6232
6235
|
const d = e.last_seen_at ?? e.lastSeenAt;
|
|
6233
6236
|
return typeof d == "string" ? c.last_seen_at = d : d === null && (c.last_seen_at = null), c;
|
|
6234
6237
|
}
|
|
6235
|
-
function
|
|
6236
|
-
if (!
|
|
6238
|
+
function Qn(e) {
|
|
6239
|
+
if (!re(e))
|
|
6237
6240
|
return null;
|
|
6238
6241
|
const n = Ge(e, "user_id", "userId"), r = Ge(e, "conversation_id", "conversationId");
|
|
6239
6242
|
if (!n || !r)
|
|
6240
6243
|
return null;
|
|
6241
|
-
const o = e.user, c =
|
|
6244
|
+
const o = e.user, c = re(o) ? {
|
|
6242
6245
|
id: typeof o.id == "string" && o.id !== "" ? o.id : n,
|
|
6243
6246
|
name: typeof o.name == "string" ? o.name : "",
|
|
6244
6247
|
...typeof o.avatar == "string" && o.avatar !== "" ? { avatar: o.avatar } : {}
|
|
@@ -6254,31 +6257,31 @@ function Jn(e) {
|
|
|
6254
6257
|
};
|
|
6255
6258
|
}
|
|
6256
6259
|
function Ka(e) {
|
|
6257
|
-
return
|
|
6260
|
+
return re(e) && de(e, "id") && de(e, "name");
|
|
6258
6261
|
}
|
|
6259
6262
|
function Qa(e) {
|
|
6260
|
-
return !
|
|
6261
|
-
}
|
|
6262
|
-
function Kn(e) {
|
|
6263
|
-
return ie(e) && ie(e.message) && he(e.message, "id") && he(e.message, "conversation_id") && he(e.message, "author_id");
|
|
6264
|
-
}
|
|
6265
|
-
function Qn(e) {
|
|
6266
|
-
return ie(e) && he(e, "conversation_id") && he(e, "user_id") && he(e, "message_id");
|
|
6263
|
+
return !re(e) || !de(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => Ka(n));
|
|
6267
6264
|
}
|
|
6268
6265
|
function Yn(e) {
|
|
6269
|
-
return
|
|
6266
|
+
return re(e) && re(e.message) && de(e.message, "id") && de(e.message, "conversation_id") && de(e.message, "author_id");
|
|
6270
6267
|
}
|
|
6271
6268
|
function Zn(e) {
|
|
6272
|
-
return
|
|
6269
|
+
return re(e) && de(e, "conversation_id") && de(e, "user_id") && de(e, "message_id");
|
|
6273
6270
|
}
|
|
6274
6271
|
function es(e) {
|
|
6275
|
-
return
|
|
6272
|
+
return re(e) && de(e, "conversation_id") && re(e.message) && de(e.message, "id");
|
|
6276
6273
|
}
|
|
6277
6274
|
function ts(e) {
|
|
6278
|
-
return
|
|
6275
|
+
return re(e) && de(e, "conversation_id") && de(e, "message_id");
|
|
6279
6276
|
}
|
|
6280
6277
|
function ns(e) {
|
|
6281
|
-
return
|
|
6278
|
+
return re(e) && de(e, "conversation_id") && de(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => Qa(n));
|
|
6279
|
+
}
|
|
6280
|
+
function ss(e) {
|
|
6281
|
+
return re(e) && de(e, "conversation_id");
|
|
6282
|
+
}
|
|
6283
|
+
function rs(e) {
|
|
6284
|
+
return re(e) && de(e, "conversation_id") && de(e, "removed_user_id");
|
|
6282
6285
|
}
|
|
6283
6286
|
function Fe(e, n, r, o) {
|
|
6284
6287
|
const c = (u) => {
|
|
@@ -6287,21 +6290,21 @@ function Fe(e, n, r, o) {
|
|
|
6287
6290
|
return e.listen(n, c), c;
|
|
6288
6291
|
}
|
|
6289
6292
|
function pc(e) {
|
|
6290
|
-
const n = e.initializedEvent ?? "messenger-client:echo-initialized", r = e.bootstrapEndpoint ?? Na, o = e.bootstrapRefreshSkewMs ?? qa, c = e.presenceFreshnessTtlMs ?? ja, u = (e.createLogger ??
|
|
6293
|
+
const n = e.initializedEvent ?? "messenger-client:echo-initialized", r = e.bootstrapEndpoint ?? Na, o = e.bootstrapRefreshSkewMs ?? qa, c = e.presenceFreshnessTtlMs ?? ja, u = (e.createLogger ?? Zt())("MessengerEcho");
|
|
6291
6294
|
typeof window < "u" && (window.Pusher = Da);
|
|
6292
|
-
let d = null, f = null, h = null,
|
|
6295
|
+
let d = null, f = null, h = null, P = null, C = "disconnected", v = "available", E = null, b = null;
|
|
6293
6296
|
const A = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Map(), m = (T) => {
|
|
6294
6297
|
C = T;
|
|
6295
|
-
for (const
|
|
6296
|
-
|
|
6298
|
+
for (const R of A)
|
|
6299
|
+
R(T);
|
|
6297
6300
|
}, y = (T) => {
|
|
6298
6301
|
v = T;
|
|
6299
|
-
for (const
|
|
6300
|
-
|
|
6302
|
+
for (const R of w)
|
|
6303
|
+
R(T);
|
|
6301
6304
|
}, O = () => {
|
|
6302
6305
|
b !== null && (clearTimeout(b), b = null);
|
|
6303
6306
|
}, z = (T = !0) => {
|
|
6304
|
-
h !== null && (h.disconnect(), h = null),
|
|
6307
|
+
h !== null && (h.disconnect(), h = null), P = null, T && m("disconnected");
|
|
6305
6308
|
}, J = () => {
|
|
6306
6309
|
O(), d = null, f = null, E = null, y("available"), z(), p.clear();
|
|
6307
6310
|
}, W = () => {
|
|
@@ -6314,15 +6317,15 @@ function pc(e) {
|
|
|
6314
6317
|
return !1;
|
|
6315
6318
|
if (T.auth.expiresAt === null)
|
|
6316
6319
|
return T.auth.token !== "";
|
|
6317
|
-
const
|
|
6318
|
-
return Number.isNaN(
|
|
6320
|
+
const R = Date.parse(T.auth.expiresAt);
|
|
6321
|
+
return Number.isNaN(R) ? !1 : R - Date.now() > o;
|
|
6319
6322
|
}, k = (T) => {
|
|
6320
6323
|
if (O(), T.auth.expiresAt === null)
|
|
6321
6324
|
return;
|
|
6322
|
-
const
|
|
6323
|
-
if (Number.isNaN(
|
|
6325
|
+
const R = Date.parse(T.auth.expiresAt);
|
|
6326
|
+
if (Number.isNaN(R))
|
|
6324
6327
|
return;
|
|
6325
|
-
const N = Math.max(0,
|
|
6328
|
+
const N = Math.max(0, R - Date.now() - o);
|
|
6326
6329
|
b = setTimeout(() => {
|
|
6327
6330
|
K();
|
|
6328
6331
|
}, N);
|
|
@@ -6346,27 +6349,27 @@ function pc(e) {
|
|
|
6346
6349
|
if (await I(!0), !T)
|
|
6347
6350
|
return;
|
|
6348
6351
|
z(!1), await G(!0);
|
|
6349
|
-
} catch (
|
|
6350
|
-
u.warn("Failed to refresh messenger bootstrap",
|
|
6352
|
+
} catch (R) {
|
|
6353
|
+
u.warn("Failed to refresh messenger bootstrap", R);
|
|
6351
6354
|
}
|
|
6352
6355
|
}, V = (T) => {
|
|
6353
|
-
const
|
|
6354
|
-
if (!
|
|
6356
|
+
const R = T.connector?.pusher?.connection;
|
|
6357
|
+
if (!R) {
|
|
6355
6358
|
u.warn("Messenger echo connector does not expose a Pusher connection");
|
|
6356
6359
|
return;
|
|
6357
6360
|
}
|
|
6358
|
-
|
|
6361
|
+
R.bind("connecting", () => {
|
|
6359
6362
|
m("connecting");
|
|
6360
|
-
}),
|
|
6363
|
+
}), R.bind("connected", () => {
|
|
6361
6364
|
m("connected");
|
|
6362
|
-
}),
|
|
6365
|
+
}), R.bind("disconnected", () => {
|
|
6363
6366
|
m("disconnected");
|
|
6364
|
-
}),
|
|
6367
|
+
}), R.bind("unavailable", () => {
|
|
6365
6368
|
m("disconnected");
|
|
6366
|
-
}),
|
|
6369
|
+
}), R.bind("error", () => {
|
|
6367
6370
|
m("error");
|
|
6368
|
-
}),
|
|
6369
|
-
const U = typeof N == "object" && N !== null && "current" in N && typeof N.current == "string" ? N.current :
|
|
6371
|
+
}), R.bind("state_change", (N) => {
|
|
6372
|
+
const U = typeof N == "object" && N !== null && "current" in N && typeof N.current == "string" ? N.current : R.state;
|
|
6370
6373
|
if (U === "connected") {
|
|
6371
6374
|
m("connected");
|
|
6372
6375
|
return;
|
|
@@ -6376,8 +6379,8 @@ function pc(e) {
|
|
|
6376
6379
|
return;
|
|
6377
6380
|
}
|
|
6378
6381
|
(U === "unavailable" || U === "failed" || U === "disconnected") && m("disconnected");
|
|
6379
|
-
}),
|
|
6380
|
-
}, G = async (T = !1) => !T && h !== null && te(d) ? h : !T &&
|
|
6382
|
+
}), R.state === "connected" && m("connected");
|
|
6383
|
+
}, G = async (T = !1) => !T && h !== null && te(d) ? h : !T && P !== null ? await P : (P = (async () => {
|
|
6381
6384
|
const N = await I(T);
|
|
6382
6385
|
if (N === null)
|
|
6383
6386
|
return null;
|
|
@@ -6402,8 +6405,8 @@ function pc(e) {
|
|
|
6402
6405
|
};
|
|
6403
6406
|
return N.service.reverb.path && (ne.wsPath = N.service.reverb.path), h = new Ia(ne), V(h), m("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
|
|
6404
6407
|
})().finally(() => {
|
|
6405
|
-
|
|
6406
|
-
}), await
|
|
6408
|
+
P = null;
|
|
6409
|
+
}), await P), _ = $t.create({
|
|
6407
6410
|
timeout: e.requestTimeoutMs ?? za,
|
|
6408
6411
|
withCredentials: !1,
|
|
6409
6412
|
headers: {
|
|
@@ -6412,47 +6415,47 @@ function pc(e) {
|
|
|
6412
6415
|
}
|
|
6413
6416
|
});
|
|
6414
6417
|
_.interceptors.request.use(async (T) => {
|
|
6415
|
-
const
|
|
6416
|
-
if (
|
|
6418
|
+
const R = await I();
|
|
6419
|
+
if (R === null)
|
|
6417
6420
|
throw new Error("Messenger bootstrap is unavailable.");
|
|
6418
|
-
return T.baseURL =
|
|
6421
|
+
return T.baseURL = R.service.apiBaseUrl, Kn(T, R.auth.token), T;
|
|
6419
6422
|
}), _.interceptors.response.use(
|
|
6420
6423
|
(T) => T,
|
|
6421
6424
|
async (T) => {
|
|
6422
|
-
const
|
|
6423
|
-
if (T.response?.status === 401 &&
|
|
6424
|
-
|
|
6425
|
+
const R = T.config;
|
|
6426
|
+
if (T.response?.status === 401 && R && R._messengerRetry !== !0) {
|
|
6427
|
+
R._messengerRetry = !0;
|
|
6425
6428
|
const N = await I(!0);
|
|
6426
6429
|
if (N !== null)
|
|
6427
|
-
return
|
|
6430
|
+
return R.baseURL = N.service.apiBaseUrl, Kn(R, N.auth.token), await _(R);
|
|
6428
6431
|
}
|
|
6429
6432
|
return Promise.reject(T);
|
|
6430
6433
|
}
|
|
6431
6434
|
);
|
|
6432
|
-
const L = () => v === "account_suspended" ? null : h,
|
|
6435
|
+
const L = () => v === "account_suspended" ? null : h, he = (T) => (A.add(T), T(C), () => {
|
|
6433
6436
|
A.delete(T);
|
|
6434
6437
|
}), Se = (T) => (w.add(T), T(v), () => {
|
|
6435
6438
|
w.delete(T);
|
|
6436
6439
|
}), B = () => d?.auth.tenantId ?? "global", D = (T) => {
|
|
6437
|
-
const
|
|
6438
|
-
if (
|
|
6440
|
+
const R = Dt(T.ts)?.getTime() ?? Dt(T.last_seen_at)?.getTime() ?? null;
|
|
6441
|
+
if (R === null)
|
|
6439
6442
|
return !0;
|
|
6440
6443
|
const N = `${T.tenant_scope ?? "global"}:${T.user_id}`, U = p.get(N);
|
|
6441
|
-
if (U &&
|
|
6444
|
+
if (U && R < U.timestampMs)
|
|
6442
6445
|
return !1;
|
|
6443
6446
|
const ne = Date.now();
|
|
6444
6447
|
p.set(N, {
|
|
6445
|
-
timestampMs:
|
|
6448
|
+
timestampMs: R,
|
|
6446
6449
|
seenAt: ne
|
|
6447
6450
|
});
|
|
6448
|
-
for (const [
|
|
6449
|
-
ne -
|
|
6451
|
+
for (const [oe, ce] of p.entries())
|
|
6452
|
+
ne - ce.seenAt > c && p.delete(oe);
|
|
6450
6453
|
return !0;
|
|
6451
6454
|
}, q = (T) => {
|
|
6452
|
-
const
|
|
6453
|
-
if (!
|
|
6455
|
+
const R = L();
|
|
6456
|
+
if (!R || typeof R.join != "function")
|
|
6454
6457
|
return;
|
|
6455
|
-
const N =
|
|
6458
|
+
const N = R.join(`online-users.${B()}`), U = [
|
|
6456
6459
|
".PresenceStatusChanged",
|
|
6457
6460
|
"PresenceStatusChanged",
|
|
6458
6461
|
".presence.status.changed",
|
|
@@ -6463,70 +6466,70 @@ function pc(e) {
|
|
|
6463
6466
|
"Modules\\Presence\\Events\\UserPresenceStatusChanged"
|
|
6464
6467
|
];
|
|
6465
6468
|
for (const ne of U)
|
|
6466
|
-
N.listen(ne, (
|
|
6467
|
-
const
|
|
6468
|
-
!
|
|
6469
|
+
N.listen(ne, (oe) => {
|
|
6470
|
+
const ce = Ja(oe, B());
|
|
6471
|
+
!ce || !D(ce) || T(ce);
|
|
6469
6472
|
});
|
|
6470
6473
|
}, _e = () => {
|
|
6471
6474
|
h?.leave(`online-users.${B()}`);
|
|
6472
6475
|
};
|
|
6473
|
-
function M(T,
|
|
6476
|
+
function M(T, R) {
|
|
6474
6477
|
const N = [];
|
|
6475
|
-
function U(ne,
|
|
6476
|
-
if (!
|
|
6478
|
+
function U(ne, oe, ce) {
|
|
6479
|
+
if (!ce)
|
|
6477
6480
|
return;
|
|
6478
6481
|
const Re = (Le) => {
|
|
6479
|
-
|
|
6482
|
+
oe(Le) && ce(Le);
|
|
6480
6483
|
};
|
|
6481
6484
|
T.bind(ne, Re), N.push({ event: ne, handler: Re });
|
|
6482
6485
|
}
|
|
6483
|
-
return U("ConversationMessageSent",
|
|
6486
|
+
return U("ConversationMessageSent", Yn, R.onMessageSent), U("ConversationMessageRead", Zn, R.onMessageRead), U("ConversationMessageEdited", es, R.onMessageEdited), U("ConversationMessageDeleted", ts, R.onMessageDeleted), U("MessageReactionToggled", ns, R.onReactionToggled), U("ConversationRequestAccepted", ss, R.onRequestAccepted), U("ConversationParticipantRemoved", rs, R.onParticipantRemoved), () => {
|
|
6484
6487
|
for (const ne of N)
|
|
6485
6488
|
T.unbind(ne.event, ne.handler);
|
|
6486
6489
|
};
|
|
6487
6490
|
}
|
|
6488
|
-
const F = (T,
|
|
6491
|
+
const F = (T, R) => {
|
|
6489
6492
|
const N = L();
|
|
6490
6493
|
if (!N)
|
|
6491
6494
|
return () => {
|
|
6492
6495
|
};
|
|
6493
6496
|
const U = N.private(`conversation.${T}`), ne = U.subscription;
|
|
6494
6497
|
if (ne)
|
|
6495
|
-
return M(ne,
|
|
6496
|
-
const
|
|
6497
|
-
return
|
|
6498
|
+
return M(ne, R);
|
|
6499
|
+
const oe = [];
|
|
6500
|
+
return R.onMessageSent && oe.push({
|
|
6498
6501
|
event: ".ConversationMessageSent",
|
|
6499
|
-
handler: Fe(U, ".ConversationMessageSent",
|
|
6500
|
-
}),
|
|
6502
|
+
handler: Fe(U, ".ConversationMessageSent", Yn, R.onMessageSent)
|
|
6503
|
+
}), R.onMessageRead && oe.push({
|
|
6501
6504
|
event: ".ConversationMessageRead",
|
|
6502
|
-
handler: Fe(U, ".ConversationMessageRead",
|
|
6503
|
-
}),
|
|
6505
|
+
handler: Fe(U, ".ConversationMessageRead", Zn, R.onMessageRead)
|
|
6506
|
+
}), R.onMessageEdited && oe.push({
|
|
6504
6507
|
event: ".ConversationMessageEdited",
|
|
6505
|
-
handler: Fe(U, ".ConversationMessageEdited",
|
|
6506
|
-
}),
|
|
6508
|
+
handler: Fe(U, ".ConversationMessageEdited", es, R.onMessageEdited)
|
|
6509
|
+
}), R.onMessageDeleted && oe.push({
|
|
6507
6510
|
event: ".ConversationMessageDeleted",
|
|
6508
|
-
handler: Fe(U, ".ConversationMessageDeleted",
|
|
6509
|
-
}),
|
|
6511
|
+
handler: Fe(U, ".ConversationMessageDeleted", ts, R.onMessageDeleted)
|
|
6512
|
+
}), R.onReactionToggled && oe.push({
|
|
6510
6513
|
event: ".MessageReactionToggled",
|
|
6511
|
-
handler: Fe(U, ".MessageReactionToggled",
|
|
6512
|
-
}),
|
|
6514
|
+
handler: Fe(U, ".MessageReactionToggled", ns, R.onReactionToggled)
|
|
6515
|
+
}), R.onRequestAccepted && oe.push({
|
|
6513
6516
|
event: ".ConversationRequestAccepted",
|
|
6514
|
-
handler: Fe(U, ".ConversationRequestAccepted",
|
|
6515
|
-
}),
|
|
6517
|
+
handler: Fe(U, ".ConversationRequestAccepted", ss, R.onRequestAccepted)
|
|
6518
|
+
}), R.onParticipantRemoved && oe.push({
|
|
6516
6519
|
event: ".ConversationParticipantRemoved",
|
|
6517
|
-
handler: Fe(U, ".ConversationParticipantRemoved",
|
|
6520
|
+
handler: Fe(U, ".ConversationParticipantRemoved", rs, R.onParticipantRemoved)
|
|
6518
6521
|
}), () => {
|
|
6519
6522
|
if (typeof U.stopListening == "function")
|
|
6520
|
-
for (const
|
|
6521
|
-
U.stopListening(
|
|
6523
|
+
for (const ce of oe)
|
|
6524
|
+
U.stopListening(ce.event, ce.handler);
|
|
6522
6525
|
};
|
|
6523
6526
|
}, Z = (T) => {
|
|
6524
6527
|
h?.leave(`conversation.${T}`);
|
|
6525
|
-
},
|
|
6526
|
-
const U = T.private(`typing-conversation.${
|
|
6527
|
-
if (
|
|
6528
|
+
}, ie = (T, R, N) => {
|
|
6529
|
+
const U = T.private(`typing-conversation.${R}`), ne = /* @__PURE__ */ new Set(["start", "typing"]), oe = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]), ce = U.subscription;
|
|
6530
|
+
if (ce) {
|
|
6528
6531
|
const we = (pe) => {
|
|
6529
|
-
const ve =
|
|
6532
|
+
const ve = Qn(pe);
|
|
6530
6533
|
if (ve) {
|
|
6531
6534
|
if (ne.has(ve.state)) {
|
|
6532
6535
|
N.onTypingStart?.({
|
|
@@ -6540,19 +6543,19 @@ function pc(e) {
|
|
|
6540
6543
|
});
|
|
6541
6544
|
return;
|
|
6542
6545
|
}
|
|
6543
|
-
|
|
6546
|
+
oe.has(ve.state) && N.onTypingStop?.({
|
|
6544
6547
|
user_id: ve.user_id,
|
|
6545
6548
|
conversation_id: ve.conversation_id,
|
|
6546
6549
|
stopped_at: ve.stopped_at ?? ve.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
6547
6550
|
});
|
|
6548
6551
|
}
|
|
6549
6552
|
};
|
|
6550
|
-
return
|
|
6551
|
-
|
|
6553
|
+
return ce.bind("TypingStateChanged", we), () => {
|
|
6554
|
+
ce.unbind("TypingStateChanged", we);
|
|
6552
6555
|
};
|
|
6553
6556
|
}
|
|
6554
6557
|
const Re = [], Le = (we) => {
|
|
6555
|
-
const pe =
|
|
6558
|
+
const pe = Qn(we);
|
|
6556
6559
|
if (pe) {
|
|
6557
6560
|
if (ne.has(pe.state)) {
|
|
6558
6561
|
N.onTypingStart?.({
|
|
@@ -6566,7 +6569,7 @@ function pc(e) {
|
|
|
6566
6569
|
});
|
|
6567
6570
|
return;
|
|
6568
6571
|
}
|
|
6569
|
-
|
|
6572
|
+
oe.has(pe.state) && N.onTypingStop?.({
|
|
6570
6573
|
user_id: pe.user_id,
|
|
6571
6574
|
conversation_id: pe.conversation_id,
|
|
6572
6575
|
stopped_at: pe.stopped_at ?? pe.ts ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -6578,111 +6581,113 @@ function pc(e) {
|
|
|
6578
6581
|
for (const we of Re)
|
|
6579
6582
|
U.stopListening(we.event, we.handler);
|
|
6580
6583
|
};
|
|
6581
|
-
}
|
|
6582
|
-
const N = L();
|
|
6583
|
-
if (N)
|
|
6584
|
-
return oe(N, T, P);
|
|
6585
|
-
let U = !1, ne = null;
|
|
6586
|
-
return ze().then((re) => {
|
|
6587
|
-
U || !re || (ne = oe(re, T, P));
|
|
6588
|
-
}).catch((re) => {
|
|
6589
|
-
u.warn("Failed to defer typing subscription", re);
|
|
6590
|
-
}), () => {
|
|
6591
|
-
U = !0, ne?.();
|
|
6592
|
-
};
|
|
6593
|
-
}, me = (T) => {
|
|
6594
|
-
h?.leave(`typing-conversation.${T}`);
|
|
6595
|
-
}, ht = async () => {
|
|
6596
|
-
y("available"), z(), await G(!0);
|
|
6597
|
-
}, ze = async () => v === "account_suspended" ? null : await G();
|
|
6584
|
+
};
|
|
6598
6585
|
return {
|
|
6599
6586
|
apiClient: _,
|
|
6600
6587
|
initializedEvent: n,
|
|
6601
6588
|
getEcho: L,
|
|
6602
|
-
waitForEcho:
|
|
6589
|
+
waitForEcho: async () => v === "account_suspended" ? null : await G(),
|
|
6603
6590
|
getConnectionStatus: () => C,
|
|
6604
6591
|
getAccessState: () => v,
|
|
6605
|
-
onConnectionStatusChange:
|
|
6592
|
+
onConnectionStatusChange: he,
|
|
6606
6593
|
onAccessStateChange: Se,
|
|
6607
|
-
reconnect:
|
|
6594
|
+
reconnect: async () => {
|
|
6595
|
+
y("available"), z(), await G(!0);
|
|
6596
|
+
},
|
|
6608
6597
|
subscribeToPresenceStatus: q,
|
|
6609
6598
|
unsubscribeFromPresenceStatus: _e,
|
|
6610
6599
|
subscribeToConversation: F,
|
|
6611
6600
|
unsubscribeFromConversation: Z,
|
|
6612
|
-
subscribeToTyping:
|
|
6613
|
-
|
|
6601
|
+
subscribeToTyping: (T, R) => {
|
|
6602
|
+
const N = ut();
|
|
6603
|
+
if (N)
|
|
6604
|
+
return ie(N, T, R);
|
|
6605
|
+
let U = !1, ne = null;
|
|
6606
|
+
const oe = () => {
|
|
6607
|
+
if (U)
|
|
6608
|
+
return;
|
|
6609
|
+
const ce = ut();
|
|
6610
|
+
ce && (ne = ie(ce, T, R), typeof window < "u" && window.removeEventListener(ct(), oe));
|
|
6611
|
+
};
|
|
6612
|
+
return typeof window < "u" && window.addEventListener(ct(), oe), () => {
|
|
6613
|
+
U = !0, typeof window < "u" && window.removeEventListener(ct(), oe), ne?.();
|
|
6614
|
+
};
|
|
6615
|
+
},
|
|
6616
|
+
unsubscribeFromTyping: (T) => {
|
|
6617
|
+
ut()?.leave(`typing-conversation.${T}`);
|
|
6618
|
+
},
|
|
6614
6619
|
clearRuntime: J
|
|
6615
6620
|
};
|
|
6616
6621
|
}
|
|
6617
6622
|
export {
|
|
6618
|
-
|
|
6623
|
+
go as DEFAULT_PRESENCE_STALE_AFTER_MS,
|
|
6619
6624
|
hc as configureMessengerClient,
|
|
6620
6625
|
pc as createMessengerEcho,
|
|
6621
6626
|
X as getApi,
|
|
6622
6627
|
ke as getAuthStore,
|
|
6623
|
-
|
|
6628
|
+
Rn as getConnectionStatus,
|
|
6624
6629
|
Ae as getEcho,
|
|
6625
|
-
|
|
6630
|
+
vs as getEchoConnectionStatus,
|
|
6626
6631
|
Je as getEchoInitializedEvent,
|
|
6627
6632
|
Y as getErrorMessage,
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6633
|
+
Zt as getLoggerFactory,
|
|
6634
|
+
Vt as getMainApi,
|
|
6635
|
+
ut as getMainEcho,
|
|
6631
6636
|
$o as getMainEchoConnectionStatus,
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6637
|
+
ct as getMainEchoInitializedEvent,
|
|
6638
|
+
uo as getMediaApi,
|
|
6639
|
+
Ot as getMessagingAccessState,
|
|
6635
6640
|
ia as getPresenceRuntimeConfig,
|
|
6636
6641
|
ca as hasConfiguredPresenceAuthTokenResolver,
|
|
6637
6642
|
ic as hasResponse,
|
|
6638
6643
|
vc as isAxiosError,
|
|
6639
6644
|
rc as isError,
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6645
|
+
eo as isValidMessageDeletedEvent,
|
|
6646
|
+
Zi as isValidMessageEditedEvent,
|
|
6647
|
+
Yi as isValidMessageReadEvent,
|
|
6648
|
+
Qi as isValidMessageSentEvent,
|
|
6649
|
+
to as isValidReactionToggledEvent,
|
|
6650
|
+
no as isValidRequestAcceptedEvent,
|
|
6646
6651
|
Pe as messagingApi,
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6652
|
+
vo as normalizePresenceStatus,
|
|
6653
|
+
ws as normalizePresenceTimestamp,
|
|
6654
|
+
ht as onConnectionStatusChange,
|
|
6650
6655
|
Ho as onMainEchoConnectionStatusChange,
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6656
|
+
ji as onMessagingAccessStateChange,
|
|
6657
|
+
Dt as parsePresenceTimestamp,
|
|
6658
|
+
$i as reconnectEcho,
|
|
6654
6659
|
Bo as reconnectMainEcho,
|
|
6655
|
-
|
|
6660
|
+
Ki as resetEchoRuntimeConfig,
|
|
6656
6661
|
Jo as resetLoggerFactory,
|
|
6657
|
-
|
|
6662
|
+
oo as resetMainApiClient,
|
|
6658
6663
|
Xo as resetMainEchoRuntimeConfig,
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6664
|
+
ro as resetMessagingApiClient,
|
|
6665
|
+
co as resetMessagingAuthStoreResolver,
|
|
6666
|
+
ho as resetMessagingMediaApi,
|
|
6662
6667
|
fc as resetMessengerClientConfig,
|
|
6663
6668
|
aa as resetPresenceRuntimeConfig,
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6669
|
+
bo as resolveFreshPresenceStatus,
|
|
6670
|
+
Nt as resolvePresenceSnapshot,
|
|
6671
|
+
Ji as setEchoRuntimeConfig,
|
|
6667
6672
|
Go as setLoggerFactory,
|
|
6668
|
-
|
|
6673
|
+
io as setMainApiClient,
|
|
6669
6674
|
Vo as setMainEchoRuntimeConfig,
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6675
|
+
so as setMessagingApiClient,
|
|
6676
|
+
ao as setMessagingAuthStoreResolver,
|
|
6677
|
+
lo as setMessagingMediaApi,
|
|
6673
6678
|
oa as setPresenceRuntimeConfig,
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6679
|
+
Vi as subscribeToConversation,
|
|
6680
|
+
Hi as subscribeToPresenceStatus,
|
|
6681
|
+
Wi as subscribeToTyping,
|
|
6682
|
+
Xi as unsubscribeFromConversation,
|
|
6683
|
+
Bi as unsubscribeFromPresenceStatus,
|
|
6684
|
+
Gi as unsubscribeFromTyping,
|
|
6680
6685
|
ac as useConnectionStatus,
|
|
6681
6686
|
oc as useConversationChannel,
|
|
6682
6687
|
cc as useGlobalMessaging,
|
|
6683
6688
|
uc as useMessagingAccessState,
|
|
6684
|
-
|
|
6689
|
+
Qt as useMessagingStore,
|
|
6685
6690
|
lc as usePresence,
|
|
6686
6691
|
dc as useTypingChannel,
|
|
6687
|
-
|
|
6692
|
+
ms as waitForEcho
|
|
6688
6693
|
};
|