@codingfactory/messenger-client 0.2.33 → 0.2.35

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.
Files changed (2) hide show
  1. package/dist/index.js +970 -961
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,98 +1,98 @@
1
- import { ref as ye, getCurrentInstance as Nt, computed as re, watch as ot, onUnmounted as qe, toValue as ss, onMounted as qt } from "vue";
1
+ import { ref as ye, getCurrentInstance as jt, computed as ie, watch as ut, onUnmounted as ze, toValue as is, onMounted as $t } from "vue";
2
2
  import { defineStore as Oi, storeToRefs as Fi } from "pinia";
3
- import zt, { isAxiosError as Di, AxiosHeaders as Tn } from "axios";
3
+ import Ht, { isAxiosError as Di, AxiosHeaders as Rn } from "axios";
4
4
  import { isAxiosError as vc } from "axios";
5
5
  import { useRoute as Ni } from "vue-router";
6
- const rs = () => () => {
7
- }, is = () => () => {
8
- }, os = async () => {
9
- }, as = () => {
10
- }, cs = () => {
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
- }, fs = async () => null, $ = {
17
+ }, gs = async () => null, $ = {
18
18
  ECHO_INITIALIZED_EVENT: "messenger-client:echo-initialized",
19
19
  getEcho: () => null,
20
- waitForEcho: fs,
20
+ waitForEcho: gs,
21
21
  getConnectionStatus: () => "disconnected",
22
22
  getAccessState: () => "available",
23
- onConnectionStatusChange: rs,
24
- onAccessStateChange: is,
25
- reconnect: os,
26
- subscribeToPresenceStatus: as,
27
- unsubscribeFromPresenceStatus: cs,
28
- subscribeToConversation: ds,
29
- unsubscribeFromConversation: us,
30
- subscribeToTyping: hs,
31
- unsubscribeFromTyping: ls
32
- }, Je = () => $.ECHO_INITIALIZED_EVENT, Re = () => $.getEcho(), ps = async () => $.waitForEcho(), gs = () => $.getConnectionStatus(), En = () => gs(), It = () => $.getAccessState(), lt = (e) => $.onConnectionStatusChange(e), qi = (e) => $.onAccessStateChange(e), zi = async () => {
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
+ }, Ke = () => $.ECHO_INITIALIZED_EVENT, Pe = () => $.getEcho(), ms = async () => $.waitForEcho(), vs = () => $.getConnectionStatus(), An = () => vs(), Ft = () => $.getAccessState(), ft = (e) => $.onConnectionStatusChange(e), qi = (e) => $.onAccessStateChange(e), zi = async () => {
33
33
  await $.reconnect();
34
34
  }, ji = (e) => $.subscribeToPresenceStatus(e), $i = () => $.unsubscribeFromPresenceStatus(), Hi = (e, n) => $.subscribeToConversation(e, n), Bi = (e) => $.unsubscribeFromConversation(e), Vi = (e, n) => $.subscribeToTyping(e, n), Xi = (e) => $.unsubscribeFromTyping(e);
35
35
  function Wi(e) {
36
36
  e.initializedEvent && ($.ECHO_INITIALIZED_EVENT = e.initializedEvent), e.getEcho && ($.getEcho = e.getEcho), e.waitForEcho && ($.waitForEcho = e.waitForEcho), e.getConnectionStatus && ($.getConnectionStatus = e.getConnectionStatus), e.getAccessState && ($.getAccessState = e.getAccessState), e.onConnectionStatusChange && ($.onConnectionStatusChange = e.onConnectionStatusChange), e.onAccessStateChange && ($.onAccessStateChange = e.onAccessStateChange), e.reconnect && ($.reconnect = e.reconnect), e.subscribeToPresenceStatus && ($.subscribeToPresenceStatus = e.subscribeToPresenceStatus), e.unsubscribeFromPresenceStatus && ($.unsubscribeFromPresenceStatus = e.unsubscribeFromPresenceStatus), e.subscribeToConversation && ($.subscribeToConversation = e.subscribeToConversation), e.unsubscribeFromConversation && ($.unsubscribeFromConversation = e.unsubscribeFromConversation), e.subscribeToTyping && ($.subscribeToTyping = e.subscribeToTyping), e.unsubscribeFromTyping && ($.unsubscribeFromTyping = e.unsubscribeFromTyping);
37
37
  }
38
38
  function Gi() {
39
- $.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", $.getEcho = () => null, $.waitForEcho = fs, $.getConnectionStatus = () => "disconnected", $.getAccessState = () => "available", $.onConnectionStatusChange = rs, $.onAccessStateChange = is, $.reconnect = os, $.subscribeToPresenceStatus = as, $.unsubscribeFromPresenceStatus = cs, $.subscribeToConversation = ds, $.unsubscribeFromConversation = us, $.subscribeToTyping = hs, $.unsubscribeFromTyping = ls;
39
+ $.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", $.getEcho = () => null, $.waitForEcho = gs, $.getConnectionStatus = () => "disconnected", $.getAccessState = () => "available", $.onConnectionStatusChange = os, $.onAccessStateChange = as, $.reconnect = cs, $.subscribeToPresenceStatus = us, $.unsubscribeFromPresenceStatus = ls, $.subscribeToConversation = fs, $.unsubscribeFromConversation = ds, $.subscribeToTyping = ps, $.unsubscribeFromTyping = hs;
40
40
  }
41
- function xe(e) {
41
+ function Ie(e) {
42
42
  return typeof e == "object" && e !== null;
43
43
  }
44
44
  function Ji(e) {
45
- return xe(e) && typeof e.conversation_id == "string" && xe(e.message) && typeof e.message.id == "string" && typeof e.message.conversation_id == "string" && typeof e.message.author_id == "string";
45
+ return Ie(e) && typeof e.conversation_id == "string" && Ie(e.message) && typeof e.message.id == "string" && typeof e.message.conversation_id == "string" && typeof e.message.author_id == "string";
46
46
  }
47
47
  function Ki(e) {
48
- return xe(e) && typeof e.conversation_id == "string" && typeof e.user_id == "string" && typeof e.message_id == "string";
48
+ return Ie(e) && typeof e.conversation_id == "string" && typeof e.user_id == "string" && typeof e.message_id == "string";
49
49
  }
50
50
  function Qi(e) {
51
- return xe(e) && typeof e.conversation_id == "string" && xe(e.message) && typeof e.message.id == "string";
51
+ return Ie(e) && typeof e.conversation_id == "string" && Ie(e.message) && typeof e.message.id == "string";
52
52
  }
53
53
  function Yi(e) {
54
- return xe(e) && typeof e.conversation_id == "string" && typeof e.message_id == "string";
54
+ return Ie(e) && typeof e.conversation_id == "string" && typeof e.message_id == "string";
55
55
  }
56
56
  function Zi(e) {
57
- return xe(e) && typeof e.conversation_id == "string" && typeof e.message_id == "string" && Array.isArray(e.reactions);
57
+ return Ie(e) && typeof e.conversation_id == "string" && typeof e.message_id == "string" && Array.isArray(e.reactions);
58
58
  }
59
59
  function eo(e) {
60
- return xe(e) && typeof e.conversation_id == "string";
60
+ return Ie(e) && typeof e.conversation_id == "string";
61
61
  }
62
- const ms = zt;
63
- let jt = ms;
62
+ const bs = Ht;
63
+ let Bt = bs;
64
64
  function W() {
65
- return jt;
65
+ return Bt;
66
66
  }
67
67
  function to(e) {
68
- jt = e;
68
+ Bt = e;
69
69
  }
70
70
  function no() {
71
- jt = ms;
71
+ Bt = bs;
72
72
  }
73
- const vs = zt;
74
- let $t = vs;
75
- function Ht() {
76
- return $t;
73
+ const ys = Ht;
74
+ let Vt = ys;
75
+ function Xt() {
76
+ return Vt;
77
77
  }
78
78
  function so(e) {
79
- $t = e;
79
+ Vt = e;
80
80
  }
81
81
  function ro() {
82
- $t = vs;
82
+ Vt = ys;
83
83
  }
84
- const bs = {
84
+ const _s = {
85
85
  currentUser: null
86
86
  };
87
- let Bt = () => bs;
88
- function ke() {
89
- return Bt;
87
+ let Wt = () => _s;
88
+ function Le() {
89
+ return Wt;
90
90
  }
91
91
  function io(e) {
92
- Bt = e;
92
+ Wt = e;
93
93
  }
94
94
  function oo() {
95
- Bt = () => bs;
95
+ Wt = () => _s;
96
96
  }
97
97
  function Z(e) {
98
98
  if (Di(e)) {
@@ -107,37 +107,37 @@ 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 ys = {
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 Vt = ys;
115
+ let Gt = Ss;
116
116
  function ao() {
117
- return Vt;
117
+ return Gt;
118
118
  }
119
119
  function co(e) {
120
- Vt = e;
120
+ Gt = e;
121
121
  }
122
122
  function uo() {
123
- Vt = ys;
123
+ Gt = Ss;
124
124
  }
125
125
  function lo(e) {
126
126
  return e !== null && typeof e == "object" && "id" in e && "type" in e && "participants" in e;
127
127
  }
128
- function _s(e) {
128
+ function Cs(e) {
129
129
  return typeof e == "object" && e !== null;
130
130
  }
131
- function $e(e) {
132
- return !_s(e) || !("data" in e) ? e : e.data;
131
+ function He(e) {
132
+ return !Cs(e) || !("data" in e) ? e : e.data;
133
133
  }
134
- function nt(e, n) {
134
+ function it(e, n) {
135
135
  const r = e[n];
136
136
  if (typeof r != "string")
137
137
  throw new Error(`Invalid messaging folder payload: missing string ${n}`);
138
138
  return r;
139
139
  }
140
- function Rn(e, n) {
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 Rn(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 Et(e, n) {
148
+ function Pt(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 Et(e, n) {
156
156
  }
157
157
  throw new Error(`Invalid messaging folder payload: missing numeric ${n}`);
158
158
  }
159
- function Ut(e) {
160
- if (!_s(e))
159
+ function Dt(e) {
160
+ if (!Cs(e))
161
161
  throw new Error("Invalid messaging folder payload: expected object");
162
162
  return {
163
- id: nt(e, "id"),
164
- name: nt(e, "name"),
165
- color: Rn(e, "color"),
166
- icon: Rn(e, "icon"),
167
- sort_order: Et(e, "sort_order"),
168
- conversation_count: Et(e, "conversation_count"),
169
- unread_count: Et(e, "unread_count"),
170
- created_at: nt(e, "created_at"),
171
- updated_at: nt(e, "updated_at")
163
+ id: it(e, "id"),
164
+ name: it(e, "name"),
165
+ color: Pn(e, "color"),
166
+ icon: Pn(e, "icon"),
167
+ sort_order: Pt(e, "sort_order"),
168
+ conversation_count: Pt(e, "conversation_count"),
169
+ unread_count: Pt(e, "unread_count"),
170
+ created_at: it(e, "created_at"),
171
+ updated_at: it(e, "updated_at")
172
172
  };
173
173
  }
174
174
  function ho(e) {
175
175
  if (!Array.isArray(e))
176
176
  throw new Error("Invalid messaging folder payload: expected array");
177
- return e.map((n) => Ut(n));
177
+ return e.map((n) => Dt(n));
178
178
  }
179
- function An(e) {
179
+ function Mn(e) {
180
180
  if (!lo(e))
181
181
  throw new Error("Invalid conversation payload from folder assignment endpoint");
182
182
  return e;
183
183
  }
184
- const Pe = {
184
+ const ke = {
185
185
  async fetchFolders() {
186
186
  const e = await W().get("/v1/messaging/folders");
187
- return ho($e(e.data));
187
+ return ho(He(e.data));
188
188
  },
189
189
  async createFolder(e) {
190
190
  const n = await W().post("/v1/messaging/folders", e);
191
- return Ut($e(n.data));
191
+ return Dt(He(n.data));
192
192
  },
193
193
  async updateFolder(e, n) {
194
194
  const r = await W().patch(`/v1/messaging/folders/${e}`, n);
195
- return Ut($e(r.data));
195
+ return Dt(He(r.data));
196
196
  },
197
197
  async deleteFolder(e) {
198
198
  await W().delete(`/v1/messaging/folders/${e}`);
@@ -204,11 +204,11 @@ const Pe = {
204
204
  const r = await W().patch(`/v1/messaging/conversations/${e}/folder`, {
205
205
  folder_id: n
206
206
  });
207
- return An($e(r.data));
207
+ return Mn(He(r.data));
208
208
  },
209
209
  async acceptRequest(e) {
210
210
  const n = await W().post(`/v1/messaging/conversations/${e}/accept`);
211
- return An($e(n.data));
211
+ return Mn(He(n.data));
212
212
  },
213
213
  async declineRequest(e) {
214
214
  await W().post(`/v1/messaging/conversations/${e}/decline`);
@@ -223,14 +223,14 @@ function go(e) {
223
223
  const n = e.trim().toLowerCase();
224
224
  return po(n) ? n : null;
225
225
  }
226
- function Ss(e) {
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 Ot(e) {
233
- const n = Ss(e);
232
+ function Nt(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);
@@ -241,20 +241,20 @@ function mo(e, n, r = {}) {
241
241
  return null;
242
242
  if (e === "offline")
243
243
  return "offline";
244
- const o = Ot(n);
244
+ const o = Nt(n);
245
245
  if (o === null)
246
246
  return e;
247
247
  const c = r.now ?? Date.now(), u = r.staleAfterMs ?? fo;
248
248
  return c - o.getTime() > u ? "offline" : e;
249
249
  }
250
- function Ft(e, n = {}) {
251
- const r = Ss(e?.last_seen_at), o = go(e?.status);
250
+ function qt(e, n = {}) {
251
+ const r = ws(e?.last_seen_at), o = go(e?.status);
252
252
  return {
253
253
  status: mo(o, r, n),
254
254
  lastSeenAt: r
255
255
  };
256
256
  }
257
- const Pn = 1e3, Xt = 4e3, vo = 12e4, bo = 300, yo = 1, _o = 1600, Wt = (e) => {
257
+ const kn = 1e3, Jt = 4e3, vo = 12e4, bo = 300, yo = 1, _o = 1600, Kt = (e) => {
258
258
  if (typeof e == "number" && Number.isFinite(e))
259
259
  return e;
260
260
  if (typeof e == "string") {
@@ -262,32 +262,32 @@ const Pn = 1e3, Xt = 4e3, vo = 12e4, bo = 300, yo = 1, _o = 1600, Wt = (e) => {
262
262
  if (Number.isFinite(n))
263
263
  return n;
264
264
  }
265
- }, Cs = (e) => typeof e == "number" && e >= 500 && e < 600, Mn = (e) => {
266
- const r = Wt(e.response?.status);
267
- return r === void 0 ? !0 : r === 429 || Cs(r);
268
- }, ws = (e) => {
265
+ }, Ts = (e) => typeof e == "number" && e >= 500 && e < 600, xn = (e) => {
266
+ const r = Kt(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(Pn, e * 1e3);
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(Pn, n * 1e3);
274
+ return Math.max(kn, n * 1e3);
275
275
  }
276
- return Xt;
276
+ return Jt;
277
277
  }, So = (e) => {
278
- const n = Math.max(0, e), r = 2 ** Math.min(n, 6), o = Xt * r;
278
+ const n = Math.max(0, e), r = 2 ** Math.min(n, 6), o = Jt * r;
279
279
  return Math.min(vo, o);
280
280
  }, Co = (e) => {
281
281
  const n = e;
282
- return Wt(n.response?.status) === 429 ? ws(n.response?.headers?.["retry-after"]) : bo;
283
- }, kn = async (e) => {
282
+ return Kt(n.response?.status) === 429 ? Es(n.response?.headers?.["retry-after"]) : bo;
283
+ }, Ln = async (e) => {
284
284
  await new Promise((n) => {
285
285
  setTimeout(n, e);
286
286
  });
287
- }, xn = () => ({
287
+ }, In = () => ({
288
288
  data: [],
289
289
  has_more: !1
290
- }), Ln = () => It() === "account_suspended", wo = (e) => {
290
+ }), Un = () => Ft() === "account_suspended", wo = (e) => {
291
291
  if (!he(e))
292
292
  return !1;
293
293
  const r = (he(e.data) ? e.data : e).throttled;
@@ -333,7 +333,7 @@ function Ro(e) {
333
333
  function Ao(e) {
334
334
  return !Array.isArray(e) || e.length === 0 ? [] : e.map(Eo);
335
335
  }
336
- function Ne(e) {
336
+ function qe(e) {
337
337
  if (typeof e != "string")
338
338
  return;
339
339
  const n = e.trim();
@@ -343,7 +343,7 @@ function Ne(e) {
343
343
  function Po(e) {
344
344
  if (!e)
345
345
  return;
346
- const n = Ne(e.avatar) ?? Ne(e.avatar_url), r = typeof e.handle == "string" && e.handle.length > 0 ? e.handle : void 0;
346
+ const n = qe(e.avatar) ?? qe(e.avatar_url), r = typeof e.handle == "string" && e.handle.length > 0 ? e.handle : void 0;
347
347
  return {
348
348
  id: e.id ?? "",
349
349
  name: e.name ?? "",
@@ -351,7 +351,7 @@ function Po(e) {
351
351
  ...r ? { handle: r } : {}
352
352
  };
353
353
  }
354
- function at(e) {
354
+ function lt(e) {
355
355
  const n = e.shared_post, r = e.author, o = n && typeof n == "object" ? {
356
356
  id: n.id ?? "",
357
357
  title: n.title ?? "",
@@ -378,7 +378,7 @@ function Mo(e) {
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 = he(e.author) ? e.author : null, f = d && typeof d.id == "string" ? d.id.trim() : "", h = d && typeof d.name == "string" ? d.name.trim() : "", A = 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;
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 = he(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,35 +389,35 @@ function Mo(e) {
389
389
  author: {
390
390
  id: f,
391
391
  name: h,
392
- ...A ? { avatar: A } : {},
392
+ ...P ? { avatar: P } : {},
393
393
  ...C ? { handle: C } : {}
394
394
  }
395
395
  } : {}
396
396
  };
397
397
  }
398
- function Rt(e) {
398
+ function Mt(e) {
399
399
  return typeof e != "string" || e.length === 0 ? null : e;
400
400
  }
401
- function In(e) {
401
+ function On(e) {
402
402
  if (!(typeof e != "string" || e.length === 0))
403
403
  return e;
404
404
  }
405
- function Dt(e) {
405
+ function zt(e) {
406
406
  return typeof e == "string" && e.length > 0 && !e.startsWith("temp-");
407
407
  }
408
408
  function ko(e, n = []) {
409
409
  const r = /* @__PURE__ */ new Map();
410
410
  for (const o of n) {
411
- const c = In(o.last_read_message_id);
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) => {
415
- const c = Object.prototype.hasOwnProperty.call(o, "last_read_message_id"), u = Ne(o.user?.avatar) ?? Ne(o.user?.avatar_url), d = o.user ? {
415
+ const c = Object.prototype.hasOwnProperty.call(o, "last_read_message_id"), u = qe(o.user?.avatar) ?? qe(o.user?.avatar_url), d = o.user ? {
416
416
  id: o.user.id,
417
417
  name: o.user.name,
418
418
  ...u ? { avatar: u } : {},
419
419
  ...o.user.handle ? { handle: o.user.handle } : {}
420
- } : void 0, f = In(o.last_read_message_id);
420
+ } : void 0, f = On(o.last_read_message_id);
421
421
  if (f)
422
422
  return {
423
423
  ...o,
@@ -443,17 +443,17 @@ function ko(e, n = []) {
443
443
  });
444
444
  }
445
445
  function xo(e, n) {
446
- return Object.prototype.hasOwnProperty.call(e, "muted_until") ? Rt(e.muted_until) : e.me?.muted_until === null ? null : typeof e.me?.muted_until == "string" ? Rt(e.me.muted_until) : Rt(n?.muted_until);
446
+ return Object.prototype.hasOwnProperty.call(e, "muted_until") ? Mt(e.muted_until) : e.me?.muted_until === null ? null : typeof e.me?.muted_until == "string" ? Mt(e.me.muted_until) : Mt(n?.muted_until);
447
447
  }
448
448
  function Lo(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 He(e, n) {
452
- const r = xo(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, A = Lo(e, n), C = typeof e.created_at == "string" ? e.created_at : n?.created_at ?? "", v = (() => {
451
+ function Be(e, n) {
452
+ const r = xo(e, n), o = typeof e.is_muted == "boolean" ? e.is_muted : r !== null || n?.is_muted === !0, c = e.last_message ? lt(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 = Lo(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
- const E = n.last_message?.id, b = e.last_message?.id;
456
- return !E || !b ? !1 : E === b;
455
+ const T = n.last_message?.id, b = e.last_message?.id;
456
+ return !T || !b ? !1 : T === b;
457
457
  })();
458
458
  return {
459
459
  ...e,
@@ -463,7 +463,7 @@ function He(e, n) {
463
463
  muted_until: r,
464
464
  is_pinned: f,
465
465
  is_archived: h,
466
- folder_id: A,
466
+ folder_id: P,
467
467
  created_at: C,
468
468
  ...c ? { last_message: c } : {},
469
469
  ...u ? { last_message_at: u } : {}
@@ -472,18 +472,18 @@ function He(e, n) {
472
472
  function Io(e) {
473
473
  return e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
474
474
  }
475
- function At(e) {
475
+ function kt(e) {
476
476
  return Io(e) ? 0 : e.unread_count || 0;
477
477
  }
478
- function Un(e, n) {
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 (Dt(c))
483
+ if (zt(c))
484
484
  return c;
485
485
  }
486
- return Dt(e.last_message?.id) ? e.last_message.id : null;
486
+ return zt(e.last_message?.id) ? e.last_message.id : null;
487
487
  }
488
488
  function he(e) {
489
489
  return typeof e == "object" && e !== null;
@@ -491,7 +491,7 @@ function he(e) {
491
491
  function Uo(e) {
492
492
  return he(e) ? (he(e.response) ? e.response : null)?.status === 401 : !1;
493
493
  }
494
- function On(e) {
494
+ function Dn(e) {
495
495
  if (!Array.isArray(e))
496
496
  return [];
497
497
  const n = [];
@@ -517,7 +517,7 @@ function Oo(e, n) {
517
517
  if (!(typeof o != "string" || o.length === 0))
518
518
  return o;
519
519
  }
520
- function st(e, n) {
520
+ function ot(e, n) {
521
521
  const r = he(e) ? e : {}, o = r.data ?? e;
522
522
  let c = [];
523
523
  return Array.isArray(o) ? c = o : he(o) && (Array.isArray(o.items) ? c = o.items : Array.isArray(o[n]) ? c = o[n] : Array.isArray(o.data) && (c = o.data)), {
@@ -525,13 +525,13 @@ function st(e, n) {
525
525
  nextCursor: Oo(r, o)
526
526
  };
527
527
  }
528
- function Fn(e) {
528
+ function Nn(e) {
529
529
  return he(e) && typeof e.id == "string" && e.id.length > 0;
530
530
  }
531
- function Dn(e) {
531
+ function qn(e) {
532
532
  return he(e) ? typeof e.id == "string" && (e.type === "dm" || e.type === "group") && Array.isArray(e.participants) : !1;
533
533
  }
534
- function Gt(e, n) {
534
+ function Qt(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,7 +540,7 @@ function Gt(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 Nn(e) {
543
+ function zn(e) {
544
544
  if (!he(e) || typeof e.id != "string" || typeof e.name != "string")
545
545
  return null;
546
546
  const n = {
@@ -548,17 +548,17 @@ function Nn(e) {
548
548
  name: e.name
549
549
  };
550
550
  typeof e.handle == "string" && e.handle.length > 0 && (n.handle = e.handle);
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);
551
+ const r = typeof e.avatar == "string" ? e.avatar : null, o = typeof e.avatar_url == "string" ? e.avatar_url : null, c = qe(r) ?? qe(o);
552
552
  return c && (n.avatar = c, n.avatar_url = c), n;
553
553
  }
554
554
  function Fo(e) {
555
555
  const r = (he(e) ? e : {}).data ?? e;
556
- return Array.isArray(r) ? r.map((o) => Nn(o)).filter((o) => o !== null) : he(r) ? Object.values(r).map((o) => Nn(o)).filter((o) => o !== null) : [];
556
+ return Array.isArray(r) ? r.map((o) => zn(o)).filter((o) => o !== null) : he(r) ? Object.values(r).map((o) => zn(o)).filter((o) => o !== null) : [];
557
557
  }
558
- function Ts(e) {
558
+ function Rs(e) {
559
559
  if (e.type !== "dm")
560
560
  return null;
561
- const n = ke()().currentUser?.id;
561
+ const n = Le()().currentUser?.id;
562
562
  if (typeof n == "string" && n.length > 0) {
563
563
  const o = e.participants.find((c) => c.user_id !== n);
564
564
  if (o)
@@ -567,14 +567,14 @@ function Ts(e) {
567
567
  return e.participants.find((o) => o.user ? o.user.name.trim().toLowerCase() === "pending user" : !0)?.user_id ?? null;
568
568
  }
569
569
  async function Do(e) {
570
- return (await Es([e])).get(e) ?? null;
570
+ return (await As([e])).get(e) ?? null;
571
571
  }
572
- async function Es(e) {
572
+ async function As(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 Ht().get("/v1/identity/users/by-ids", {
577
+ const r = await Xt().get("/v1/identity/users/by-ids", {
578
578
  params: {
579
579
  ids: n.join(",")
580
580
  }
@@ -591,8 +591,8 @@ async function Es(e) {
591
591
  return /* @__PURE__ */ new Map();
592
592
  }
593
593
  }
594
- async function qn(e, n) {
595
- if (e.type !== "dm" || Gt(e, n))
594
+ async function jn(e, n) {
595
+ if (e.type !== "dm" || Qt(e, n))
596
596
  return e;
597
597
  const r = await Do(n);
598
598
  if (!r)
@@ -606,15 +606,15 @@ async function qn(e, n) {
606
606
  participants: o
607
607
  };
608
608
  }
609
- async function zn(e) {
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 = Ts(c);
613
- !u || Gt(c, u) || (n.set(c.id, u), r.add(u));
612
+ const u = Rs(c);
613
+ !u || Qt(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 Es(Array.from(r));
617
+ const o = await As(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,22 +629,22 @@ async function zn(e) {
629
629
  } : c;
630
630
  });
631
631
  }
632
- function Xe(e, n) {
632
+ function We(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);
636
636
  return c !== 0 ? c : e.id.localeCompare(n.id);
637
637
  }
638
- function rt(e, n) {
638
+ function at(e, n) {
639
639
  return [n, ...e.filter((r) => r.id !== n.id)];
640
640
  }
641
- function Be(e) {
641
+ function Ve(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
644
  function No(e, n) {
645
645
  return typeof e != "string" || e.length === 0 ? null : n.has(e) ? e : null;
646
646
  }
647
- function jn(e, n) {
647
+ function Hn(e, n) {
648
648
  return e.map((r) => {
649
649
  const o = No(r.folder_id, n);
650
650
  return (r.folder_id ?? null) === o ? r : {
@@ -653,7 +653,7 @@ function jn(e, n) {
653
653
  };
654
654
  });
655
655
  }
656
- function $n(e, n, r) {
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,
@@ -674,15 +674,15 @@ function qo(e, n, r) {
674
674
  });
675
675
  return o ? c : e;
676
676
  }
677
- function Pt(e) {
677
+ function xt(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(Xe);
683
+ return Array.from(n.values()).sort(We);
684
684
  }
685
- const Jt = Oi("messaging", {
685
+ const Yt = Oi("messaging", {
686
686
  state: () => ({
687
687
  conversations: [],
688
688
  requests: [],
@@ -713,46 +713,46 @@ const Jt = Oi("messaging", {
713
713
  },
714
714
  getMessagesByConversationId: (e) => (n) => e.messages[n] || [],
715
715
  getTypingUsers: (e) => (n) => e.typingUsers[n] || [],
716
- unreadConversationsCount: (e) => e.conversations.filter((n) => At(n) > 0).length,
717
- unreadCount: (e) => e.conversations.reduce((n, r) => n + At(r), 0),
718
- totalUnreadCount: (e) => e.conversations.reduce((n, r) => n + At(r), 0),
719
- sortedFolders: (e) => Be(e.folders),
716
+ unreadConversationsCount: (e) => e.conversations.filter((n) => kt(n) > 0).length,
717
+ unreadCount: (e) => e.conversations.reduce((n, r) => n + kt(r), 0),
718
+ totalUnreadCount: (e) => e.conversations.reduce((n, r) => n + kt(r), 0),
719
+ sortedFolders: (e) => Ve(e.folders),
720
720
  folderById: (e) => (n) => e.folders.find((r) => r.id === n),
721
721
  conversationsInFolder: (e) => (n) => e.conversations.filter((r) => r.folder_id === n),
722
722
  hasMoreMessages: (e) => (n) => e.conversationHasMore[n] ?? !1,
723
723
  isLoadingMessages: (e) => (n) => e.loadingMessages[n] ?? !1,
724
724
  // Message request getters
725
- requestConversations: (e) => Pt(e),
726
- requestCount: (e) => Pt(e).length,
727
- unreadRequestCount: (e) => Pt(e).filter((n) => n.unread_count > 0).length
725
+ requestConversations: (e) => xt(e),
726
+ requestCount: (e) => xt(e).length,
727
+ unreadRequestCount: (e) => xt(e).filter((n) => n.unread_count > 0).length
728
728
  },
729
729
  actions: {
730
730
  normalizeFolderAssignmentsState() {
731
731
  if (!this.foldersLoaded)
732
732
  return;
733
733
  const e = new Set(this.folders.map((n) => n.id));
734
- this.conversations = jn(this.conversations, e), this.requests = jn(this.requests, e), this.activeFolderId !== null && !e.has(this.activeFolderId) && (this.activeFolderId = null);
734
+ this.conversations = Hn(this.conversations, e), this.requests = Hn(this.requests, e), this.activeFolderId !== null && !e.has(this.activeFolderId) && (this.activeFolderId = null);
735
735
  },
736
736
  async fetchFolders() {
737
737
  try {
738
- const e = await Pe.fetchFolders();
739
- return this.folders = Be(e), this.foldersLoaded = !0, this.normalizeFolderAssignmentsState(), this.folders;
738
+ const e = await ke.fetchFolders();
739
+ return this.folders = Ve(e), this.foldersLoaded = !0, this.normalizeFolderAssignmentsState(), this.folders;
740
740
  } catch (e) {
741
741
  throw this.error = Z(e), e;
742
742
  }
743
743
  },
744
744
  async createFolder(e) {
745
745
  try {
746
- const n = await Pe.createFolder(e);
747
- return this.folders = Be([...this.folders, n]), n;
746
+ const n = await ke.createFolder(e);
747
+ return this.folders = Ve([...this.folders, n]), n;
748
748
  } catch (n) {
749
749
  throw this.error = Z(n), n;
750
750
  }
751
751
  },
752
752
  async updateFolder(e, n) {
753
753
  try {
754
- const r = await Pe.updateFolder(e, n);
755
- return this.folders = Be(
754
+ const r = await ke.updateFolder(e, n);
755
+ return this.folders = Ve(
756
756
  this.folders.map((o) => o.id === e ? r : o)
757
757
  ), r;
758
758
  } catch (r) {
@@ -761,14 +761,14 @@ const Jt = Oi("messaging", {
761
761
  },
762
762
  async deleteFolder(e) {
763
763
  try {
764
- await Pe.deleteFolder(e), this.folders = this.folders.filter((n) => n.id !== e), this.foldersLoaded = !0, this.activeFolderId === e && (this.activeFolderId = null), this.normalizeFolderAssignmentsState();
764
+ await ke.deleteFolder(e), this.folders = this.folders.filter((n) => n.id !== e), this.foldersLoaded = !0, this.activeFolderId === e && (this.activeFolderId = null), this.normalizeFolderAssignmentsState();
765
765
  } catch (n) {
766
766
  throw this.error = Z(n), n;
767
767
  }
768
768
  },
769
769
  async reorderFolders(e) {
770
770
  try {
771
- await Pe.reorderFolders(e);
771
+ await ke.reorderFolders(e);
772
772
  const n = new Map(this.folders.map((c) => [c.id, c])), r = [];
773
773
  for (const c of e) {
774
774
  const u = n.get(c);
@@ -777,7 +777,7 @@ const Jt = Oi("messaging", {
777
777
  sort_order: r.length + 1
778
778
  }), n.delete(c));
779
779
  }
780
- const o = Be(Array.from(n.values()));
780
+ const o = Ve(Array.from(n.values()));
781
781
  for (const c of o)
782
782
  r.push({
783
783
  ...c,
@@ -790,7 +790,7 @@ const Jt = Oi("messaging", {
790
790
  },
791
791
  async assignToFolder(e, n) {
792
792
  try {
793
- const r = await Pe.assignFolder(e, n), o = this.conversations.find(
793
+ const r = await ke.assignFolder(e, n), o = this.conversations.find(
794
794
  (d) => d.id === e
795
795
  ) ?? this.requests.find(
796
796
  (d) => d.id === e
@@ -798,11 +798,11 @@ const Jt = Oi("messaging", {
798
798
  if (!o)
799
799
  return;
800
800
  const c = o.folder_id ?? null, u = typeof r.folder_id == "string" || r.folder_id === null ? r.folder_id : n;
801
- this.conversations = $n(
801
+ this.conversations = Bn(
802
802
  this.conversations,
803
803
  e,
804
804
  u
805
- ), this.requests = $n(
805
+ ), this.requests = Bn(
806
806
  this.requests,
807
807
  e,
808
808
  u
@@ -818,19 +818,19 @@ const Jt = Oi("messaging", {
818
818
  async fetchConversations(e, n, r, o) {
819
819
  this.loading = !0, this.error = null;
820
820
  try {
821
- if (Ln())
822
- return e || (this.conversations = [], this.normalizeFolderAssignmentsState()), xn();
821
+ if (Un())
822
+ return e || (this.conversations = [], this.normalizeFolderAssignmentsState()), In();
823
823
  const c = o?.includePresence ?? !0, u = {};
824
824
  c && (u.include_presence = 1), e && (u.cursor = e), n && (u.filter = n), typeof r == "string" && r.length > 0 && (u.folder_id = r);
825
- const d = await W().get("/v1/messaging/conversations", { params: u }), { items: f, nextCursor: h } = st(
825
+ const d = await W().get("/v1/messaging/conversations", { params: u }), { items: f, nextCursor: h } = ot(
826
826
  d.data,
827
827
  "conversations"
828
- ), A = f.map((E) => {
828
+ ), P = f.map((T) => {
829
829
  const b = this.conversations.find(
830
- (R) => R.id === E.id
830
+ (R) => R.id === T.id
831
831
  );
832
- return He(E, b);
833
- }), C = await zn(A);
832
+ return Be(T, b);
833
+ }), C = await $n(P);
834
834
  e ? this.conversations.push(...C) : this.conversations = C, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
835
835
  const v = {
836
836
  data: C,
@@ -838,7 +838,7 @@ const Jt = Oi("messaging", {
838
838
  };
839
839
  return h !== void 0 && (v.next_cursor = h), v;
840
840
  } catch (c) {
841
- throw o?.background && Mn(c) || (this.error = Z(c)), c;
841
+ throw o?.background && xn(c) || (this.error = Z(c)), c;
842
842
  } finally {
843
843
  this.loading = !1;
844
844
  }
@@ -852,8 +852,8 @@ const Jt = Oi("messaging", {
852
852
  includePresence: !1
853
853
  }), this.backgroundPollRetryAfterUntil = 0, this.backgroundPollTransientFailureCount = 0, !0;
854
854
  } catch (e) {
855
- const n = e, r = Wt(n.response?.status);
856
- return r === 429 ? (this.backgroundPollRetryAfterUntil = Date.now() + ws(n.response?.headers?.["retry-after"]), !1) : (this.backgroundPollTransientFailureCount += 1, r === void 0 || Cs(r) ? (this.backgroundPollRetryAfterUntil = Date.now() + So(this.backgroundPollTransientFailureCount), !1) : (this.backgroundPollRetryAfterUntil = Date.now() + Xt, !1));
855
+ const n = e, r = Kt(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() + So(this.backgroundPollTransientFailureCount), !1) : (this.backgroundPollRetryAfterUntil = Date.now() + Jt, !1));
857
857
  }
858
858
  },
859
859
  async fetchConversation(e) {
@@ -862,9 +862,9 @@ const Jt = Oi("messaging", {
862
862
  const n = await W().get(`/v1/messaging/conversations/${e}`, {
863
863
  params: { include_presence: 1 }
864
864
  }), r = this.conversations.find((f) => f.id === e);
865
- let o = He(n.data.data || n.data, r);
866
- const c = Ts(o);
867
- c && (o = await qn(o, c));
865
+ let o = Be(n.data.data || n.data, r);
866
+ const c = Rs(o);
867
+ c && (o = await jn(o, c));
868
868
  const u = this.conversations.findIndex((f) => f.id === e);
869
869
  u >= 0 ? this.conversations[u] = o : this.conversations.push(o);
870
870
  const d = this.requests.findIndex((f) => f.id === e);
@@ -878,20 +878,20 @@ const Jt = Oi("messaging", {
878
878
  async fetchRequests(e) {
879
879
  this.loading = !0, this.error = null;
880
880
  try {
881
- if (Ln())
882
- return e || (this.requests = [], this.normalizeFolderAssignmentsState()), xn();
881
+ if (Un())
882
+ return e || (this.requests = [], this.normalizeFolderAssignmentsState()), In();
883
883
  const n = {
884
884
  include_presence: 1,
885
885
  filter: "requests"
886
886
  };
887
887
  e && (n.cursor = e);
888
- const r = await W().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: c } = st(
888
+ const r = await W().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: c } = ot(
889
889
  r.data,
890
890
  "conversations"
891
891
  ), u = o.map((h) => {
892
- const A = this.requests.find((C) => C.id === h.id);
893
- return He(h, A);
894
- }), d = await zn(u);
892
+ const P = this.requests.find((C) => C.id === h.id);
893
+ return Be(h, P);
894
+ }), d = await $n(u);
895
895
  e ? this.requests.push(...d) : this.requests = d, this.normalizeFolderAssignmentsState();
896
896
  const f = {
897
897
  data: d,
@@ -914,16 +914,16 @@ const Jt = Oi("messaging", {
914
914
  c = await W().get(`/v1/messaging/conversations/${e}/messages`, { params: r });
915
915
  break;
916
916
  } catch (v) {
917
- if (!(o < yo && Mn(v)))
917
+ if (!(o < yo && xn(v)))
918
918
  throw v;
919
- o += 1, await kn(Co(v));
919
+ o += 1, await Ln(Co(v));
920
920
  }
921
- const { items: u, nextCursor: d } = st(
921
+ const { items: u, nextCursor: d } = ot(
922
922
  c.data,
923
923
  "messages"
924
- ), f = u.map(at), h = [...f].reverse();
924
+ ), f = u.map(lt), h = [...f].reverse();
925
925
  if (n ? this.messages[e] = [...h, ...this.messages[e] || []] : this.messages[e] = h, (() => {
926
- const v = this.conversations.find((E) => E.id === e) ?? this.requests.find((E) => E.id === e);
926
+ const v = this.conversations.find((T) => T.id === e) ?? this.requests.find((T) => T.id === e);
927
927
  return v ? !v.last_message || !v.last_message_at : !1;
928
928
  })()) {
929
929
  const v = this.messages[e]?.at(-1);
@@ -942,30 +942,30 @@ const Jt = Oi("messaging", {
942
942
  }
943
943
  },
944
944
  async sendMessage(e, n, r, o, c, u, d) {
945
- const f = ke()(), h = `temp-${Date.now()}-${Math.random()}`, A = typeof u == "string" && u.trim().length > 0 ? u.trim() : null, C = Mo(d), v = f.currentUser, E = {
945
+ const f = Le()(), h = `temp-${Date.now()}-${Math.random()}`, P = typeof u == "string" && u.trim().length > 0 ? u.trim() : null, C = Mo(d), v = f.currentUser, T = {
946
946
  id: h,
947
947
  conversation_id: e,
948
948
  author_id: v?.id || "",
949
949
  body: n || "",
950
950
  attachments: [],
951
- meta: A ? { shared_post_id: A } : {},
951
+ meta: P ? { shared_post_id: P } : {},
952
952
  ...C ? { shared_post: C } : {},
953
953
  is_deleted: !1,
954
954
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
955
955
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
956
956
  };
957
- v && (E.author = {
957
+ v && (T.author = {
958
958
  id: v.id,
959
959
  name: v.name,
960
960
  ...v.avatar ? { avatar: v.avatar } : {},
961
961
  ...v.handle ? { handle: v.handle } : {}
962
- }), o != null && (E.reply_to_id = o), c != null && (E.reply_to = c), this.messages[e] || (this.messages[e] = []), this.messages[e].push(E), this._pendingSendIds.add(h);
962
+ }), o != null && (T.reply_to_id = o), c != null && (T.reply_to = c), this.messages[e] || (this.messages[e] = []), this.messages[e].push(T), this._pendingSendIds.add(h);
963
963
  try {
964
964
  let b;
965
965
  const R = {
966
966
  body: n || "",
967
967
  ...o ? { reply_to_id: o } : {},
968
- ...A ? { shared_post_id: A } : {},
968
+ ...P ? { shared_post_id: P } : {},
969
969
  ...C ? { shared_post_preview: C } : {}
970
970
  };
971
971
  if (r && r.length > 0) {
@@ -988,7 +988,7 @@ const Jt = Oi("messaging", {
988
988
  ...R,
989
989
  type: "text"
990
990
  });
991
- const w = b.data.data || b.data, p = { ...E, ...w, attachments: w.attachments ?? E.attachments }, m = at(p), y = this.messages[e], F = y.findIndex((G) => G.id === h);
991
+ const w = b.data.data || b.data, p = { ...T, ...w, attachments: w.attachments ?? T.attachments }, m = lt(p), y = this.messages[e], F = y.findIndex((G) => G.id === h);
992
992
  F >= 0 && (y[F] = m), this._pendingSendIds.delete(h);
993
993
  const q = m.id;
994
994
  let J = 0;
@@ -1045,11 +1045,11 @@ const Jt = Oi("messaging", {
1045
1045
  return null;
1046
1046
  for (let u = c.length - 1; u >= 0; u -= 1) {
1047
1047
  const d = c[u]?.id;
1048
- if (Dt(d))
1048
+ if (zt(d))
1049
1049
  return d;
1050
1050
  }
1051
1051
  return null;
1052
- })(), o = n ? Un(n, this.messages) : r;
1052
+ })(), o = n ? Fn(n, this.messages) : r;
1053
1053
  if (!o)
1054
1054
  return;
1055
1055
  await W().post(`/v1/messaging/conversations/${e}/read`, {
@@ -1068,7 +1068,7 @@ const Jt = Oi("messaging", {
1068
1068
  if (e.length === 0)
1069
1069
  return;
1070
1070
  const n = e.map((c) => {
1071
- const u = Un(c, this.messages);
1071
+ const u = Fn(c, this.messages);
1072
1072
  return u ? {
1073
1073
  conversationId: c.id,
1074
1074
  messageId: u
@@ -1102,7 +1102,7 @@ const Jt = Oi("messaging", {
1102
1102
  const r = await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
1103
1103
  if (n !== "start" || !wo(r.data))
1104
1104
  return;
1105
- await kn(_o), await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
1105
+ await Ln(_o), await W().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
1106
1106
  } catch (r) {
1107
1107
  console.warn("Failed to send typing indicator:", r);
1108
1108
  }
@@ -1140,11 +1140,11 @@ const Jt = Oi("messaging", {
1140
1140
  },
1141
1141
  async pinConversation(e, n) {
1142
1142
  const r = this.conversations.find((c) => c.id === e), o = r?.is_pinned;
1143
- r && (r.is_pinned = n), this.conversations.sort(Xe);
1143
+ r && (r.is_pinned = n), this.conversations.sort(We);
1144
1144
  try {
1145
1145
  await W().patch(`/v1/messaging/conversations/${e}/pin`, { pinned: n });
1146
1146
  } catch (c) {
1147
- throw r && o !== void 0 && (r.is_pinned = o, this.conversations.sort(Xe)), this.error = Z(c), c;
1147
+ throw r && o !== void 0 && (r.is_pinned = o, this.conversations.sort(We)), this.error = Z(c), c;
1148
1148
  }
1149
1149
  },
1150
1150
  async archiveConversation(e, n) {
@@ -1170,10 +1170,10 @@ const Jt = Oi("messaging", {
1170
1170
  };
1171
1171
  n && (r.message = n);
1172
1172
  const o = await W().post("/v1/messaging/conversations/dm", r), c = o.data.data || o.data;
1173
- if (!Fn(c))
1173
+ if (!Nn(c))
1174
1174
  throw new Error("Invalid conversation payload from DM create endpoint.");
1175
- let u = Dn(c) && Gt(c, e) ? He(c) : await this.fetchConversation(c.id);
1176
- return u = await qn(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);
1175
+ let u = qn(c) && Qt(c, e) ? Be(c) : await this.fetchConversation(c.id);
1176
+ return u = await jn(u, e), u.is_request === !0 ? (this.requests = at(this.requests, u), this.conversations = this.conversations.filter((d) => d.id !== u.id), u) : (this.conversations = at(this.conversations, u), this.requests = this.requests.filter((d) => d.id !== u.id), u);
1177
1177
  } catch (r) {
1178
1178
  throw this.error = Z(r), r;
1179
1179
  }
@@ -1184,10 +1184,10 @@ const Jt = Oi("messaging", {
1184
1184
  title: e,
1185
1185
  participant_ids: n
1186
1186
  }), o = r.data.data || r.data;
1187
- if (!Fn(o))
1187
+ if (!Nn(o))
1188
1188
  throw new Error("Invalid conversation payload from group create endpoint.");
1189
- const c = Dn(o) ? o : await this.fetchConversation(o.id);
1190
- return this.conversations = rt(this.conversations, c), c;
1189
+ const c = qn(o) ? o : await this.fetchConversation(o.id);
1190
+ return this.conversations = at(this.conversations, c), c;
1191
1191
  } catch (r) {
1192
1192
  throw this.error = Z(r), r;
1193
1193
  }
@@ -1205,7 +1205,7 @@ const Jt = Oi("messaging", {
1205
1205
  async removeParticipant(e, n) {
1206
1206
  try {
1207
1207
  await W().delete(`/v1/messaging/conversations/${e}/participants/${n}`);
1208
- const r = ke()();
1208
+ const r = Le()();
1209
1209
  if (n === r.currentUser?.id) {
1210
1210
  this.conversations = this.conversations.filter((o) => o.id !== e), this.requests = this.requests.filter((o) => o.id !== e), delete this.messages[e], delete this.typingUsers[e], delete this.conversationCursors[e], delete this.conversationHasMore[e], delete this.loadingMessages[e];
1211
1211
  return;
@@ -1235,29 +1235,29 @@ const Jt = Oi("messaging", {
1235
1235
  if (!n)
1236
1236
  return;
1237
1237
  this.messages[n] || (this.messages[n] = []);
1238
- const r = at({ ...e, attachments: e.attachments ?? [] }), o = this.messages[n];
1239
- if (o.find((A) => A.id === r.id))
1238
+ const r = lt({ ...e, attachments: e.attachments ?? [] }), o = this.messages[n];
1239
+ if (o.find((P) => P.id === r.id))
1240
1240
  return;
1241
- const u = ke()();
1241
+ const u = Le()();
1242
1242
  if (r.author_id === u.currentUser?.id) {
1243
- const A = o.findIndex((C) => C.id.startsWith("temp-"));
1244
- if (A >= 0) {
1245
- const C = o[A]?.id ?? "";
1243
+ const P = o.findIndex((C) => C.id.startsWith("temp-"));
1244
+ if (P >= 0) {
1245
+ const C = o[P]?.id ?? "";
1246
1246
  this.messages[n] = [
1247
- ...o.slice(0, A),
1247
+ ...o.slice(0, P),
1248
1248
  r,
1249
- ...o.slice(A + 1)
1249
+ ...o.slice(P + 1)
1250
1250
  ], this._pendingSendIds.delete(C), this.updateConversationLastMessage(n, r);
1251
1251
  return;
1252
1252
  }
1253
1253
  }
1254
1254
  const d = r.created_at;
1255
1255
  let f = o.length;
1256
- for (let A = o.length - 1; A >= 0; A--) {
1257
- const C = o[A];
1256
+ for (let P = o.length - 1; P >= 0; P--) {
1257
+ const C = o[P];
1258
1258
  if (C && C.created_at <= d)
1259
1259
  break;
1260
- f = A;
1260
+ f = P;
1261
1261
  }
1262
1262
  const h = f === o.length;
1263
1263
  this.messages[n] = [
@@ -1272,8 +1272,8 @@ const Jt = Oi("messaging", {
1272
1272
  },
1273
1273
  removeMessage(e, n) {
1274
1274
  const r = (h) => {
1275
- const A = { ...h, is_deleted: !0 };
1276
- return delete A.body, A;
1275
+ const P = { ...h, is_deleted: !0 };
1276
+ return delete P.body, P;
1277
1277
  };
1278
1278
  let o = null;
1279
1279
  const c = this.conversations.find((h) => h.id === e);
@@ -1311,13 +1311,13 @@ const Jt = Oi("messaging", {
1311
1311
  throw v;
1312
1312
  f = await W().post(o, c);
1313
1313
  }
1314
- const h = he(f.data) && "data" in f.data ? f.data.data : f.data, A = On(
1314
+ const h = he(f.data) && "data" in f.data ? f.data.data : f.data, P = Dn(
1315
1315
  he(h) ? h.reactions : void 0
1316
1316
  );
1317
- (A.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, A);
1317
+ (P.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, P);
1318
1318
  try {
1319
- const v = await W().get(o), E = he(v.data) && "data" in v.data ? v.data.data : v.data, b = On(
1320
- he(E) ? E.reactions : void 0
1319
+ const v = await W().get(o), T = he(v.data) && "data" in v.data ? v.data.data : v.data, b = Dn(
1320
+ he(T) ? T.reactions : void 0
1321
1321
  );
1322
1322
  this.updateMessageReactions(e, n, b);
1323
1323
  } catch {
@@ -1350,8 +1350,8 @@ const Jt = Oi("messaging", {
1350
1350
  h,
1351
1351
  ...u.slice(d + 1)
1352
1352
  ];
1353
- const A = this.conversations.find((v) => v.id === e);
1354
- A?.last_message?.id === n && (A.last_message = h);
1353
+ const P = this.conversations.find((v) => v.id === e);
1354
+ P?.last_message?.id === n && (P.last_message = h);
1355
1355
  const C = this.requests.find((v) => v.id === e);
1356
1356
  C?.last_message?.id === n && (C.last_message = h);
1357
1357
  },
@@ -1367,7 +1367,7 @@ const Jt = Oi("messaging", {
1367
1367
  const d = u.find((f) => f.id === e);
1368
1368
  return d ? (d.last_message = n, d.last_message_at = n.created_at, !0) : !1;
1369
1369
  }, o = r(this.conversations), c = r(this.requests);
1370
- o && this.conversations.sort(Xe), c && this.requests.sort(Xe);
1370
+ o && this.conversations.sort(We), c && this.requests.sort(We);
1371
1371
  },
1372
1372
  updatePresenceForUser(e, n, r) {
1373
1373
  const o = n === "online" || n === "idle" || n === "dnd", c = (u) => {
@@ -1386,28 +1386,28 @@ const Jt = Oi("messaging", {
1386
1386
  params: { ids: n }
1387
1387
  }), o = r.data?.data?.items ?? r.data?.items ?? [];
1388
1388
  for (const c of o) {
1389
- const u = Ft(c);
1389
+ const u = qt(c);
1390
1390
  u.status !== null && this.updatePresenceForUser(c.id, u.status, u.lastSeenAt);
1391
1391
  }
1392
1392
  },
1393
1393
  async acceptRequest(e) {
1394
1394
  try {
1395
- const n = await Pe.acceptRequest(e);
1395
+ const n = await ke.acceptRequest(e);
1396
1396
  this.requests = this.requests.filter((o) => o.id !== e);
1397
- const r = He({
1397
+ const r = Be({
1398
1398
  ...n,
1399
1399
  is_pinned: n.is_pinned ?? !1,
1400
1400
  is_archived: n.is_archived ?? !1,
1401
1401
  is_muted: n.is_muted ?? !1
1402
1402
  });
1403
- this.conversations = rt(this.conversations, r);
1403
+ this.conversations = at(this.conversations, r);
1404
1404
  } catch (n) {
1405
1405
  throw this.error = Z(n), n;
1406
1406
  }
1407
1407
  },
1408
1408
  async declineRequest(e) {
1409
1409
  try {
1410
- await Pe.declineRequest(e), this.requests = this.requests.filter((n) => n.id !== e);
1410
+ await ke.declineRequest(e), this.requests = this.requests.filter((n) => n.id !== e);
1411
1411
  } catch (n) {
1412
1412
  throw this.error = Z(n), n;
1413
1413
  }
@@ -1419,7 +1419,7 @@ const Jt = Oi("messaging", {
1419
1419
  n && (o.filter = n), typeof r == "string" && r.length > 0 && (o.folder_id = r);
1420
1420
  const c = await W().get("/v1/messaging/conversations", {
1421
1421
  params: o
1422
- }), { items: u } = st(
1422
+ }), { items: u } = ot(
1423
1423
  c.data,
1424
1424
  "conversations"
1425
1425
  );
@@ -1479,16 +1479,16 @@ const Jt = Oi("messaging", {
1479
1479
  }
1480
1480
  });
1481
1481
  function oc(e) {
1482
- const n = Jt(), r = ke()(), o = ye(!1), c = ye(null), u = ye(null), d = Nt(), f = d !== null, h = 20, A = 250;
1483
- let C = 0, v = null, E = null;
1484
- const b = re(() => r.currentUser?.id), R = () => ss(e)?.trim() ?? "";
1482
+ const n = Yt(), r = Le()(), o = ye(!1), c = ye(null), u = ye(null), d = jt(), f = d !== null, h = 20, P = 250;
1483
+ let C = 0, v = null, T = null;
1484
+ const b = ie(() => r.currentUser?.id), R = () => is(e)?.trim() ?? "";
1485
1485
  function w() {
1486
1486
  v && (clearTimeout(v), v = null), C = 0;
1487
1487
  }
1488
1488
  function p() {
1489
1489
  !f || o.value || v || C >= h || (v = setTimeout(() => {
1490
1490
  v = null, C += 1, I();
1491
- }, A));
1491
+ }, P));
1492
1492
  }
1493
1493
  function m(_) {
1494
1494
  if (n.addMessage(_.message), _.message.author_id !== b.value) {
@@ -1531,18 +1531,18 @@ function oc(e) {
1531
1531
  }
1532
1532
  function k(_) {
1533
1533
  const x = u.value;
1534
- E && (E(), E = null), x && (_ && !n.hasGlobalConversationSubscription(x) && Bi(x), n.unregisterDetailSubscription(x), u.value = null), o.value = !1;
1534
+ T && (T(), T = null), x && (_ && !n.hasGlobalConversationSubscription(x) && Bi(x), n.unregisterDetailSubscription(x), u.value = null), o.value = !1;
1535
1535
  }
1536
1536
  function I() {
1537
1537
  const _ = R();
1538
1538
  if (!(o.value || !_)) {
1539
- if (!Re()) {
1539
+ if (!Pe()) {
1540
1540
  p();
1541
1541
  return;
1542
1542
  }
1543
1543
  c.value = null;
1544
1544
  try {
1545
- E = Hi(_, {
1545
+ T = Hi(_, {
1546
1546
  onMessageSent: m,
1547
1547
  onMessageRead: y,
1548
1548
  onMessageEdited: F,
@@ -1559,8 +1559,8 @@ function oc(e) {
1559
1559
  function V() {
1560
1560
  o.value || I();
1561
1561
  }
1562
- typeof window < "u" && window.addEventListener(Je(), V);
1563
- const H = lt((_) => {
1562
+ typeof window < "u" && window.addEventListener(Ke(), V);
1563
+ const H = ft((_) => {
1564
1564
  if (_ === "connected") {
1565
1565
  o.value || I();
1566
1566
  return;
@@ -1575,7 +1575,7 @@ function oc(e) {
1575
1575
  c.value = _ instanceof Error ? _.message : "Failed to unsubscribe from conversation", console.error("ConversationChannel: Unsubscribe error", _);
1576
1576
  }
1577
1577
  }
1578
- return ot(
1578
+ return ut(
1579
1579
  () => R(),
1580
1580
  (_, x) => {
1581
1581
  if (_ !== x) {
@@ -1586,23 +1586,23 @@ function oc(e) {
1586
1586
  I();
1587
1587
  }
1588
1588
  }
1589
- ), d !== null && qe(() => {
1590
- w(), H(), X(), typeof window < "u" && window.removeEventListener(Je(), V);
1589
+ ), d !== null && ze(() => {
1590
+ w(), H(), X(), typeof window < "u" && window.removeEventListener(Ke(), V);
1591
1591
  }), {
1592
- isSubscribed: re(() => o.value),
1593
- error: re(() => c.value),
1592
+ isSubscribed: ie(() => o.value),
1593
+ error: ie(() => c.value),
1594
1594
  subscribe: I,
1595
1595
  unsubscribe: X
1596
1596
  };
1597
1597
  }
1598
- const Rs = () => () => {
1599
- }, As = async () => {
1598
+ const Ps = () => () => {
1599
+ }, Ms = async () => {
1600
1600
  }, _e = {
1601
1601
  initializedEvent: "messenger-client:main-echo-initialized",
1602
1602
  getEcho: () => null,
1603
1603
  getConnectionStatus: () => "disconnected",
1604
- onConnectionStatusChange: Rs,
1605
- reconnect: As
1604
+ onConnectionStatusChange: Ps,
1605
+ reconnect: Ms
1606
1606
  };
1607
1607
  function zo() {
1608
1608
  return _e.initializedEvent;
@@ -1623,7 +1623,7 @@ function Vo(e) {
1623
1623
  e.initializedEvent && (_e.initializedEvent = e.initializedEvent), e.getEcho && (_e.getEcho = e.getEcho), e.getConnectionStatus && (_e.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (_e.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (_e.reconnect = e.reconnect);
1624
1624
  }
1625
1625
  function Xo() {
1626
- _e.initializedEvent = "messenger-client:main-echo-initialized", _e.getEcho = () => null, _e.getConnectionStatus = () => "disconnected", _e.onConnectionStatusChange = Rs, _e.reconnect = As;
1626
+ _e.initializedEvent = "messenger-client:main-echo-initialized", _e.getEcho = () => null, _e.getConnectionStatus = () => "disconnected", _e.onConnectionStatusChange = Ps, _e.reconnect = Ms;
1627
1627
  }
1628
1628
  const Wo = {
1629
1629
  debug: () => {
@@ -1634,16 +1634,16 @@ const Wo = {
1634
1634
  },
1635
1635
  error: () => {
1636
1636
  }
1637
- }, Ps = () => Wo;
1638
- let Kt = Ps;
1639
- function Qt() {
1640
- return Kt;
1637
+ }, ks = () => Wo;
1638
+ let Zt = ks;
1639
+ function en() {
1640
+ return Zt;
1641
1641
  }
1642
1642
  function Go(e) {
1643
- Kt = e;
1643
+ Zt = e;
1644
1644
  }
1645
1645
  function Jo() {
1646
- Kt = Ps;
1646
+ Zt = ks;
1647
1647
  }
1648
1648
  const Ko = {
1649
1649
  connected: "",
@@ -1651,35 +1651,35 @@ const Ko = {
1651
1651
  disconnected: "",
1652
1652
  error: "",
1653
1653
  unknown: ""
1654
- }, Hn = Qt()("ConnectionStatus");
1655
- function Bn(e) {
1654
+ }, Vn = en()("ConnectionStatus");
1655
+ function Xn(e) {
1656
1656
  return e?.connector?.pusher?.connection ?? null;
1657
1657
  }
1658
1658
  function Qo(e) {
1659
1659
  return e === "messenger" ? {
1660
- initializedEvent: Je(),
1661
- getConnectionStatus: gs,
1662
- onConnectionStatusChange: lt,
1660
+ initializedEvent: Ke(),
1661
+ getConnectionStatus: vs,
1662
+ onConnectionStatusChange: ft,
1663
1663
  reconnect: zi,
1664
- getEchoConnection: () => Bn(Re())
1664
+ getEchoConnection: () => Xn(Pe())
1665
1665
  } : {
1666
1666
  initializedEvent: zo(),
1667
1667
  getConnectionStatus: $o,
1668
1668
  onConnectionStatusChange: Ho,
1669
1669
  reconnect: Bo,
1670
- getEchoConnection: () => Bn(jo())
1670
+ getEchoConnection: () => Xn(jo())
1671
1671
  };
1672
1672
  }
1673
- function Vn(e) {
1673
+ function Wn(e) {
1674
1674
  return e.getEchoConnection()?.state ?? null;
1675
1675
  }
1676
1676
  function ac(e = {}) {
1677
1677
  const o = Qo(e.source ?? "app"), c = {
1678
1678
  ...Ko,
1679
1679
  ...e.icons
1680
- }, u = ye(o.getConnectionStatus()), d = ye(null), f = ye(0), h = ye(!1), A = ye(!1), C = ye(!1), v = ye(!1);
1681
- let E = null, b = null, R = null, w = null, p = null, m = null, y = null;
1682
- const F = re(() => u.value === "connected"), q = re(() => u.value === "connecting"), J = re(() => u.value === "disconnected"), G = re(() => u.value === "error"), te = re(() => J.value || G.value), k = re(() => {
1680
+ }, u = ye(o.getConnectionStatus()), d = ye(null), f = ye(0), h = ye(!1), P = ye(!1), C = ye(!1), v = ye(!1);
1681
+ let T = null, b = null, R = null, w = null, p = null, m = null, y = null;
1682
+ const F = ie(() => u.value === "connected"), q = ie(() => u.value === "connecting"), J = ie(() => u.value === "disconnected"), G = ie(() => u.value === "error"), te = ie(() => J.value || G.value), k = ie(() => {
1683
1683
  switch (u.value) {
1684
1684
  case "connecting":
1685
1685
  return f.value > 0 ? "Reconnecting..." : "Connecting...";
@@ -1692,7 +1692,7 @@ function ac(e = {}) {
1692
1692
  default:
1693
1693
  return "Unknown connection state";
1694
1694
  }
1695
- }), I = re(() => {
1695
+ }), I = ie(() => {
1696
1696
  switch (u.value) {
1697
1697
  case "connected":
1698
1698
  return "success";
@@ -1704,7 +1704,7 @@ function ac(e = {}) {
1704
1704
  default:
1705
1705
  return "medium";
1706
1706
  }
1707
- }), V = re(() => {
1707
+ }), V = ie(() => {
1708
1708
  switch (u.value) {
1709
1709
  case "connected":
1710
1710
  return c.connected;
@@ -1718,10 +1718,10 @@ function ac(e = {}) {
1718
1718
  return c.unknown;
1719
1719
  }
1720
1720
  }), H = async () => {
1721
- Hn.debug("Manual reconnect triggered"), f.value += 1, await o.reconnect();
1721
+ Vn.debug("Manual reconnect triggered"), f.value += 1, await o.reconnect();
1722
1722
  }, X = (B, K = u.value) => {
1723
1723
  if (B !== "connecting" && b && (clearTimeout(b), b = null), B === "disconnected" || B === "error") {
1724
- const N = !v.value && K === B, Y = !A.value && (N || K === "connected" || K === "connecting");
1724
+ const N = !v.value && K === B, Y = !P.value && (N || K === "connected" || K === "connecting");
1725
1725
  if (C.value = !0, Y) {
1726
1726
  h.value = !1, R && clearTimeout(R), R = setTimeout(() => {
1727
1727
  R = null, u.value !== "connected" && (h.value = !0);
@@ -1732,11 +1732,11 @@ function ac(e = {}) {
1732
1732
  return;
1733
1733
  }
1734
1734
  if (B === "connected") {
1735
- R && (clearTimeout(R), R = null), h.value = !1, A.value = !1, C.value = !1;
1735
+ R && (clearTimeout(R), R = null), h.value = !1, P.value = !1, C.value = !1;
1736
1736
  return;
1737
1737
  }
1738
1738
  if (B === "connecting") {
1739
- if (R && (clearTimeout(R), R = null), A.value) {
1739
+ if (R && (clearTimeout(R), R = null), P.value) {
1740
1740
  h.value = !0;
1741
1741
  return;
1742
1742
  }
@@ -1744,23 +1744,23 @@ function ac(e = {}) {
1744
1744
  return;
1745
1745
  b = setTimeout(() => {
1746
1746
  if (b = null, u.value === "connecting") {
1747
- if (Vn(o) === "connected") {
1747
+ if (Wn(o) === "connected") {
1748
1748
  _("connected");
1749
1749
  return;
1750
1750
  }
1751
- A.value = !0, Hn.warn("Still connecting after 10s, treating as disconnected"), _("disconnected"), f.value += 1, o.reconnect();
1751
+ P.value = !0, Vn.warn("Still connecting after 10s, treating as disconnected"), _("disconnected"), f.value += 1, o.reconnect();
1752
1752
  }
1753
1753
  }, 1e4);
1754
1754
  }
1755
1755
  }, _ = (B) => {
1756
1756
  const K = u.value;
1757
- if (B === "connecting" && A.value) {
1757
+ if (B === "connecting" && P.value) {
1758
1758
  u.value = "disconnected", X("disconnected", K);
1759
1759
  return;
1760
1760
  }
1761
1761
  u.value = B, B === "connecting" && (K === "disconnected" || K === "error") && f.value === 0 && (f.value = 1), B === "connected" && (d.value = /* @__PURE__ */ new Date(), f.value = 0), X(B, K);
1762
1762
  }, x = () => {
1763
- const B = Vn(o), K = u.value;
1763
+ const B = Wn(o), K = u.value;
1764
1764
  if (B === "connected" && K !== "connected") {
1765
1765
  _("connected");
1766
1766
  return;
@@ -1807,22 +1807,22 @@ function ac(e = {}) {
1807
1807
  return;
1808
1808
  }
1809
1809
  (B === "unavailable" || B === "failed" || B === "disconnected") && _("disconnected");
1810
- }, Se = re(() => {
1810
+ }, Se = ie(() => {
1811
1811
  if (!d.value || !F.value)
1812
1812
  return null;
1813
1813
  const B = Date.now() - d.value.getTime(), K = Math.floor(B / 6e4), N = Math.floor(B % 6e4 / 1e3);
1814
1814
  return K > 0 ? `${K}m ${N}s` : `${N}s`;
1815
1815
  });
1816
- return qt(() => {
1817
- u.value = o.getConnectionStatus(), E = o.onConnectionStatusChange(_), F.value && (d.value = /* @__PURE__ */ new Date()), X(u.value, u.value), v.value = !0, fe(), m = () => {
1816
+ return $t(() => {
1817
+ u.value = o.getConnectionStatus(), T = o.onConnectionStatusChange(_), F.value && (d.value = /* @__PURE__ */ new Date()), X(u.value, u.value), v.value = !0, fe(), m = () => {
1818
1818
  fe(), x();
1819
1819
  }, window.addEventListener(o.initializedEvent, m), x(), w = setInterval(() => {
1820
1820
  x();
1821
1821
  }, 3e3);
1822
- }), qe(() => {
1823
- E?.(), b && (clearTimeout(b), b = null), R && (clearTimeout(R), R = null), w && (clearInterval(w), w = null), m && (window.removeEventListener(o.initializedEvent, m), m = null), 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 = null, y = null;
1822
+ }), ze(() => {
1823
+ T?.(), b && (clearTimeout(b), b = null), R && (clearTimeout(R), R = null), w && (clearInterval(w), w = null), m && (window.removeEventListener(o.initializedEvent, m), m = null), 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 = null, y = null;
1824
1824
  }), {
1825
- connectionStatus: re(() => u.value),
1825
+ connectionStatus: ie(() => u.value),
1826
1826
  isConnected: F,
1827
1827
  isConnecting: q,
1828
1828
  isDisconnected: J,
@@ -1831,33 +1831,33 @@ function ac(e = {}) {
1831
1831
  statusMessage: k,
1832
1832
  statusColor: I,
1833
1833
  statusIcon: V,
1834
- showConnectionBanner: re(() => h.value),
1835
- lastConnectionTime: re(() => d.value),
1834
+ showConnectionBanner: ie(() => h.value),
1835
+ lastConnectionTime: ie(() => d.value),
1836
1836
  connectionUptime: Se,
1837
- reconnectAttempts: re(() => f.value),
1837
+ reconnectAttempts: ie(() => f.value),
1838
1838
  reconnect: H
1839
1839
  };
1840
1840
  }
1841
- const Ms = () => {
1841
+ const xs = () => {
1842
1842
  };
1843
- let Yt = Ms;
1843
+ let tn = xs;
1844
1844
  function Yo() {
1845
- return Yt;
1845
+ return tn;
1846
1846
  }
1847
1847
  function Zo(e) {
1848
- Yt = e;
1848
+ tn = e;
1849
1849
  }
1850
1850
  function ea() {
1851
- Yt = Ms;
1851
+ tn = xs;
1852
1852
  }
1853
- const Me = Qt()("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;
1853
+ const xe = en()("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;
1854
1854
  function cc() {
1855
- const e = Jt(), n = ke()(), r = Yo(), o = Ht(), c = Ni(), u = Nt(), { conversations: d, requestConversations: f } = Fi(e), h = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Map();
1855
+ const e = Yt(), n = Le()(), r = Yo(), o = Xt(), c = Ni(), u = jt(), { conversations: d, requestConversations: f } = Fi(e), h = /* @__PURE__ */ new Set(), P = /* @__PURE__ */ new Map();
1856
1856
  let C = !1;
1857
1857
  function v(k) {
1858
- const I = A.get(k);
1858
+ const I = P.get(k);
1859
1859
  if (I) {
1860
- if (A.delete(k), I.directBound) {
1860
+ if (P.delete(k), I.directBound) {
1861
1861
  const V = I.channel.subscription;
1862
1862
  if (V)
1863
1863
  for (const H of I.bindings)
@@ -1875,52 +1875,52 @@ function cc() {
1875
1875
  }
1876
1876
  }
1877
1877
  }
1878
- function E() {
1878
+ function T() {
1879
1879
  for (const k of h)
1880
1880
  v(k), e.unregisterGlobalConversationSubscription(k);
1881
1881
  h.clear();
1882
1882
  }
1883
1883
  function b(k) {
1884
- const I = Re();
1884
+ const I = Pe();
1885
1885
  if (!I || h.has(k)) return;
1886
1886
  const V = `conversation.${k}`;
1887
1887
  v(k);
1888
1888
  const H = I.private(V), X = (N) => {
1889
1889
  if (!Ji(N)) {
1890
- Me.warn("Dropping malformed ConversationMessageSent event", N);
1890
+ xe.warn("Dropping malformed ConversationMessageSent event", N);
1891
1891
  return;
1892
1892
  }
1893
1893
  const Y = N, M = n.currentUser?.id;
1894
1894
  if (!M || Y.message.author_id === M) return;
1895
1895
  e.addMessage(Y.message);
1896
- const U = e.hasDetailSubscription(Y.conversation_id), ne = sa(Y.conversation_id);
1897
- if (U || ne) {
1898
- const oe = e.getConversationById(Y.conversation_id);
1899
- oe && (oe.unread_count = 0), e.markAsRead(Y.conversation_id).catch(() => {
1896
+ const O = e.hasDetailSubscription(Y.conversation_id), se = sa(Y.conversation_id);
1897
+ if (O || se) {
1898
+ const re = e.getConversationById(Y.conversation_id);
1899
+ re && (re.unread_count = 0), e.markAsRead(Y.conversation_id).catch(() => {
1900
1900
  });
1901
1901
  return;
1902
1902
  }
1903
- const ue = e.getConversationById(Y.conversation_id);
1904
- if (ue) {
1905
- const oe = ra(ue);
1906
- oe || ue.unread_count++, r(oe);
1903
+ const le = e.getConversationById(Y.conversation_id);
1904
+ if (le) {
1905
+ const re = ra(le);
1906
+ re || le.unread_count++, r(re);
1907
1907
  }
1908
1908
  }, _ = (N) => {
1909
1909
  if (!Ki(N)) {
1910
- Me.warn("Dropping malformed ConversationMessageRead event", N);
1910
+ xe.warn("Dropping malformed ConversationMessageRead event", N);
1911
1911
  return;
1912
1912
  }
1913
1913
  e.applyParticipantReadState(N);
1914
1914
  }, x = (N) => {
1915
1915
  if (!Zi(N)) {
1916
- Me.warn("Dropping malformed MessageReactionToggled event", N);
1916
+ xe.warn("Dropping malformed MessageReactionToggled event", N);
1917
1917
  return;
1918
1918
  }
1919
1919
  const Y = N;
1920
1920
  e.updateMessageReactions(Y.conversation_id, Y.message_id, Y.reactions);
1921
1921
  }, fe = (N) => {
1922
1922
  if (!Qi(N)) {
1923
- Me.warn("Dropping malformed ConversationMessageEdited event", N);
1923
+ xe.warn("Dropping malformed ConversationMessageEdited event", N);
1924
1924
  return;
1925
1925
  }
1926
1926
  const Y = N;
@@ -1933,22 +1933,22 @@ function cc() {
1933
1933
  );
1934
1934
  }, Se = (N) => {
1935
1935
  if (!Yi(N)) {
1936
- Me.warn("Dropping malformed ConversationMessageDeleted event", N);
1936
+ xe.warn("Dropping malformed ConversationMessageDeleted event", N);
1937
1937
  return;
1938
1938
  }
1939
1939
  const Y = N;
1940
1940
  e.removeMessage(Y.conversation_id, Y.message_id);
1941
1941
  }, B = (N) => {
1942
1942
  if (!eo(N)) {
1943
- Me.warn("Dropping malformed ConversationRequestAccepted event", N);
1943
+ xe.warn("Dropping malformed ConversationRequestAccepted event", N);
1944
1944
  return;
1945
1945
  }
1946
1946
  const Y = N, M = e.getConversationById(Y.conversation_id);
1947
1947
  M && (M.is_request = !1), e.requests = e.requests.filter(
1948
- (U) => U.id !== Y.conversation_id
1948
+ (O) => O.id !== Y.conversation_id
1949
1949
  );
1950
1950
  }, K = H.subscription;
1951
- K ? (K.bind("ConversationMessageSent", X), K.bind("ConversationMessageRead", _), K.bind("ConversationMessageEdited", fe), K.bind("ConversationMessageDeleted", Se), K.bind("MessageReactionToggled", x), K.bind("ConversationRequestAccepted", B), A.set(k, {
1951
+ K ? (K.bind("ConversationMessageSent", X), K.bind("ConversationMessageRead", _), K.bind("ConversationMessageEdited", fe), K.bind("ConversationMessageDeleted", Se), K.bind("MessageReactionToggled", x), K.bind("ConversationRequestAccepted", B), P.set(k, {
1952
1952
  channel: H,
1953
1953
  directBound: !0,
1954
1954
  bindings: [
@@ -1959,7 +1959,7 @@ function cc() {
1959
1959
  { event: "MessageReactionToggled", handler: x },
1960
1960
  { event: "ConversationRequestAccepted", handler: B }
1961
1961
  ]
1962
- })) : (H.listen(".ConversationMessageSent", X), H.listen(".ConversationMessageRead", _), H.listen(".ConversationMessageEdited", fe), H.listen(".ConversationMessageDeleted", Se), H.listen(".MessageReactionToggled", x), H.listen(".ConversationRequestAccepted", B), A.set(k, {
1962
+ })) : (H.listen(".ConversationMessageSent", X), H.listen(".ConversationMessageRead", _), H.listen(".ConversationMessageEdited", fe), H.listen(".ConversationMessageDeleted", Se), H.listen(".MessageReactionToggled", x), H.listen(".ConversationRequestAccepted", B), P.set(k, {
1963
1963
  channel: H,
1964
1964
  directBound: !1,
1965
1965
  bindings: [
@@ -1973,9 +1973,9 @@ function cc() {
1973
1973
  })), h.add(k), e.registerGlobalConversationSubscription(k);
1974
1974
  }
1975
1975
  function R() {
1976
- const k = Re();
1976
+ const k = Pe();
1977
1977
  if (!k) {
1978
- E();
1978
+ T();
1979
1979
  return;
1980
1980
  }
1981
1981
  for (const I of h) {
@@ -1989,7 +1989,7 @@ function cc() {
1989
1989
  h.clear();
1990
1990
  }
1991
1991
  function w() {
1992
- const k = Re();
1992
+ const k = Pe();
1993
1993
  if (!k) return;
1994
1994
  const I = (() => {
1995
1995
  const H = [...e.conversations, ...e.requestConversations], X = /* @__PURE__ */ new Set(), _ = [];
@@ -2010,7 +2010,7 @@ function cc() {
2010
2010
  b(H.id);
2011
2011
  }
2012
2012
  function p(k) {
2013
- const I = Ft({
2013
+ const I = qt({
2014
2014
  status: k.status,
2015
2015
  last_seen_at: k.last_seen_at ?? null
2016
2016
  });
@@ -2030,63 +2030,63 @@ function cc() {
2030
2030
  params: { ids: k }
2031
2031
  }), V = I.data?.data?.items ?? I.data?.items ?? [];
2032
2032
  for (const H of V) {
2033
- const X = Ft(H);
2033
+ const X = qt(H);
2034
2034
  X.status !== null && e.updatePresenceForUser(H.id, X.status, X.lastSeenAt);
2035
2035
  }
2036
2036
  } catch (I) {
2037
- Me.warn("Failed to refresh messaging presence snapshot", I);
2037
+ xe.warn("Failed to refresh messaging presence snapshot", I);
2038
2038
  }
2039
2039
  }
2040
2040
  function y() {
2041
- !Re() || C || (ji(p), C = !0);
2041
+ !Pe() || C || (ji(p), C = !0);
2042
2042
  }
2043
2043
  function F() {
2044
2044
  C && ($i(), C = !1);
2045
2045
  }
2046
- const q = ot(
2046
+ const q = ut(
2047
2047
  d,
2048
2048
  () => {
2049
2049
  w();
2050
2050
  },
2051
2051
  { deep: !1, immediate: !0 }
2052
- ), J = ot(
2052
+ ), J = ut(
2053
2053
  f,
2054
2054
  () => {
2055
2055
  w();
2056
2056
  },
2057
2057
  { deep: !1, immediate: !0 }
2058
- ), G = ot(
2058
+ ), G = ut(
2059
2059
  () => c.fullPath,
2060
2060
  () => {
2061
2061
  w();
2062
2062
  }
2063
- ), te = lt((k) => {
2064
- k === "connected" ? (E(), w(), F(), y(), m()) : (k === "disconnected" || k === "error") && (E(), F());
2063
+ ), te = ft((k) => {
2064
+ k === "connected" ? (T(), w(), F(), y(), m()) : (k === "disconnected" || k === "error") && (T(), F());
2065
2065
  });
2066
- w(), y(), m(), Re() || ps().then((k) => {
2067
- k && (E(), w(), F(), y(), m());
2066
+ w(), y(), m(), Pe() || ms().then((k) => {
2067
+ k && (T(), w(), F(), y(), m());
2068
2068
  }).catch((k) => {
2069
- Me.warn("Failed to eagerly initialize messenger echo", k);
2070
- }), u !== null && qe(() => {
2069
+ xe.warn("Failed to eagerly initialize messenger echo", k);
2070
+ }), u !== null && ze(() => {
2071
2071
  q(), J(), G(), te(), R(), F();
2072
2072
  });
2073
2073
  }
2074
2074
  function uc() {
2075
- const e = ye(It());
2075
+ const e = ye(Ft());
2076
2076
  let n = null;
2077
- return qt(() => {
2078
- e.value = It(), n = qi((r) => {
2077
+ return $t(() => {
2078
+ e.value = Ft(), n = qi((r) => {
2079
2079
  e.value = r;
2080
2080
  });
2081
- }), qe(() => {
2081
+ }), ze(() => {
2082
2082
  n?.(), n = null;
2083
2083
  }), {
2084
- accessState: re(() => e.value),
2085
- isBlocked: re(() => e.value !== "available"),
2086
- isSuspended: re(() => e.value === "account_suspended")
2084
+ accessState: ie(() => e.value),
2085
+ isBlocked: ie(() => e.value !== "available"),
2086
+ isSuspended: ie(() => e.value === "account_suspended")
2087
2087
  };
2088
2088
  }
2089
- const ks = () => null, xs = {
2089
+ const Ls = () => null, Is = {
2090
2090
  sessionOpenUrl: "/v1/presence/session/open",
2091
2091
  sessionHeartbeatUrl: "/v1/presence/heartbeat",
2092
2092
  sessionCloseUrl: "/v1/presence/session/close",
@@ -2097,33 +2097,33 @@ const ks = () => null, xs = {
2097
2097
  activityDebounceMs: 5e3,
2098
2098
  heartbeatIntervalMs: 3e4,
2099
2099
  userAgentResolver: () => navigator.userAgent.slice(0, 256),
2100
- authTokenResolver: ks
2100
+ authTokenResolver: Ls
2101
2101
  };
2102
- let ct = { ...xs };
2102
+ let dt = { ...Is };
2103
2103
  function ia() {
2104
- return ct;
2104
+ return dt;
2105
2105
  }
2106
2106
  function oa(e) {
2107
- ct = {
2108
- ...ct,
2107
+ dt = {
2108
+ ...dt,
2109
2109
  ...e
2110
2110
  };
2111
2111
  }
2112
2112
  function aa() {
2113
- ct = { ...xs };
2113
+ dt = { ...Is };
2114
2114
  }
2115
2115
  function ca(e) {
2116
- return e.authTokenResolver !== ks;
2116
+ return e.authTokenResolver !== Ls;
2117
2117
  }
2118
2118
  const ua = 429, la = 403, da = 423, ha = "ACCOUNT_LIMITED", fa = "ACCOUNT_SUSPENDED", pa = "ACCOUNT_WRITE_TIMEOUT", ga = 2, ma = 5 * 6e4;
2119
- function We(e) {
2119
+ function Ge(e) {
2120
2120
  return typeof e == "object" && e !== null;
2121
2121
  }
2122
- function Ls(e) {
2123
- if (!We(e))
2122
+ function Us(e) {
2123
+ if (!Ge(e))
2124
2124
  return null;
2125
2125
  const n = e.response;
2126
- if (!We(n))
2126
+ if (!Ge(n))
2127
2127
  return null;
2128
2128
  const r = n.status;
2129
2129
  if (typeof r == "number")
@@ -2134,49 +2134,49 @@ function Ls(e) {
2134
2134
  }
2135
2135
  return null;
2136
2136
  }
2137
- function Is(e) {
2138
- if (!We(e))
2137
+ function Os(e) {
2138
+ if (!Ge(e))
2139
2139
  return null;
2140
2140
  const n = e.response;
2141
- if (!We(n))
2141
+ if (!Ge(n))
2142
2142
  return null;
2143
2143
  const r = n.data;
2144
- return We(r) && typeof r.code == "string" ? r.code : null;
2144
+ return Ge(r) && typeof r.code == "string" ? r.code : null;
2145
2145
  }
2146
- function Mt(e) {
2147
- const n = Ls(e), r = Is(e);
2146
+ function Lt(e) {
2147
+ const n = Us(e), r = Os(e);
2148
2148
  return n === ua && r === ha || n === da && r === pa;
2149
2149
  }
2150
- function kt(e) {
2151
- const n = Ls(e), r = Is(e);
2150
+ function It(e) {
2151
+ const n = Us(e), r = Os(e);
2152
2152
  return n === la && r === fa ? !0 : e instanceof Error ? e.message.toLowerCase().includes("suspended") : !1;
2153
2153
  }
2154
- function Ke() {
2154
+ function Qe() {
2155
2155
  return typeof sessionStorage > "u" ? null : sessionStorage;
2156
2156
  }
2157
2157
  function va(e) {
2158
- const n = Ke(), r = n?.getItem(e);
2158
+ const n = Qe(), r = n?.getItem(e);
2159
2159
  if (r)
2160
2160
  return r;
2161
2161
  const o = `web-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
2162
2162
  return n?.setItem(e, o), o;
2163
2163
  }
2164
2164
  function ba(e) {
2165
- const n = Ke(), r = n?.getItem(e);
2165
+ const n = Qe(), r = n?.getItem(e);
2166
2166
  if (!r)
2167
2167
  return null;
2168
2168
  const o = Number.parseInt(r, 10);
2169
2169
  return Number.isFinite(o) ? o : (n?.removeItem(e), null);
2170
2170
  }
2171
- function xt(e, n = Date.now()) {
2172
- const r = Ke(), o = ba(e);
2171
+ function Ut(e, n = Date.now()) {
2172
+ const r = Qe(), o = ba(e);
2173
2173
  return o === null ? !1 : o <= n ? (r?.removeItem(e), !1) : !0;
2174
2174
  }
2175
2175
  function ya(e, n = Date.now()) {
2176
- Ke()?.setItem(e, String(n + ma));
2176
+ Qe()?.setItem(e, String(n + ma));
2177
2177
  }
2178
2178
  function _a(e) {
2179
- Ke()?.removeItem(e);
2179
+ Qe()?.removeItem(e);
2180
2180
  }
2181
2181
  function Sa(e) {
2182
2182
  return e.startsWith("/v1/") ? `/api${e}` : e;
@@ -2224,9 +2224,9 @@ function Ta(e, n, r) {
2224
2224
  }
2225
2225
  }
2226
2226
  function lc() {
2227
- const e = ke()(), n = ia(), r = Ht(), o = va(n.clientIdStorageKey);
2228
- let c = null, u = null, d = !1, f = xt(n.accountLimitedUntilStorageKey), h = !1, A = !1, C = null, v = 0;
2229
- const E = () => ca(n) ? n.authTokenResolver() !== null : !0, b = () => {
2227
+ const e = Le()(), n = ia(), r = Xt(), o = va(n.clientIdStorageKey);
2228
+ let c = null, u = null, d = !1, f = Ut(n.accountLimitedUntilStorageKey), h = !1, P = !1, C = null, v = 0;
2229
+ const T = () => ca(n) ? n.authTokenResolver() !== null : !0, b = () => {
2230
2230
  c && (clearInterval(c), c = null);
2231
2231
  }, R = () => {
2232
2232
  u && (clearTimeout(u), u = null);
@@ -2237,22 +2237,22 @@ function lc() {
2237
2237
  }, p = (x) => {
2238
2238
  f || console.warn(x), ya(n.accountLimitedUntilStorageKey), f = !0, d = !1, C = null, b(), R();
2239
2239
  }, m = async (x) => {
2240
- if (!(!d || A || f || h) && E() && C !== x)
2240
+ if (!(!d || P || f || h) && T() && C !== x)
2241
2241
  try {
2242
2242
  await r.patch(n.statusUrl, { status: x }), C = x;
2243
2243
  } catch (fe) {
2244
- if (Mt(fe)) {
2244
+ if (Lt(fe)) {
2245
2245
  p("[Presence] Presence updates paused: account is temporarily limited");
2246
2246
  return;
2247
2247
  }
2248
- kt(fe) && (h = !0, d = !1, C = null, b(), R());
2248
+ It(fe) && (h = !0, d = !1, C = null, b(), R());
2249
2249
  }
2250
2250
  }, y = () => {
2251
- R(), !(!d || A || f || h || document.visibilityState !== "visible") && (u = setTimeout(() => {
2251
+ R(), !(!d || P || f || h || document.visibilityState !== "visible") && (u = setTimeout(() => {
2252
2252
  u = null, m("idle");
2253
2253
  }, n.idleAfterMs));
2254
2254
  }, F = () => {
2255
- if (A || !d || f || h || document.visibilityState !== "visible")
2255
+ if (P || !d || f || h || document.visibilityState !== "visible")
2256
2256
  return;
2257
2257
  const x = Date.now();
2258
2258
  x - v < n.activityDebounceMs || (v = x, m("online"), y());
@@ -2263,7 +2263,7 @@ function lc() {
2263
2263
  }, G = () => {
2264
2264
  typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", q), document.removeEventListener("keydown", q), document.removeEventListener("touchstart", q), window.removeEventListener("focus", q));
2265
2265
  }, te = async () => {
2266
- if (xt(n.accountLimitedUntilStorageKey))
2266
+ if (Ut(n.accountLimitedUntilStorageKey))
2267
2267
  return f = !0, "account_limited";
2268
2268
  try {
2269
2269
  return await r.post(n.sessionOpenUrl, {
@@ -2271,7 +2271,7 @@ function lc() {
2271
2271
  user_agent: n.userAgentResolver()
2272
2272
  }), _a(n.accountLimitedUntilStorageKey), f = !1, h = !1, d = !0, C = null, "opened";
2273
2273
  } catch (x) {
2274
- return Mt(x) ? (p("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : kt(x) ? (h = !0, d = !1, C = null, b(), R(), "account_suspended") : "failed";
2274
+ return Lt(x) ? (p("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : It(x) ? (h = !0, d = !1, C = null, b(), R(), "account_suspended") : "failed";
2275
2275
  }
2276
2276
  }, k = async () => {
2277
2277
  for (let x = 0; x < ga; x += 1)
@@ -2279,15 +2279,15 @@ function lc() {
2279
2279
  return;
2280
2280
  console.warn("[Presence] Failed to open session");
2281
2281
  }, I = async () => {
2282
- if (d && E())
2282
+ if (d && T())
2283
2283
  try {
2284
2284
  await r.post(n.sessionHeartbeatUrl, { client_id: o });
2285
2285
  } catch (x) {
2286
- if (Mt(x)) {
2286
+ if (Lt(x)) {
2287
2287
  p("[Presence] Heartbeat paused: account is temporarily limited");
2288
2288
  return;
2289
2289
  }
2290
- kt(x) && (h = !0, d = !1, C = null, b(), R());
2290
+ It(x) && (h = !0, d = !1, C = null, b(), R());
2291
2291
  }
2292
2292
  }, V = () => {
2293
2293
  if (!d)
@@ -2306,58 +2306,58 @@ function lc() {
2306
2306
  r.post(n.sessionCloseUrl, { client_id: o }).catch(() => {
2307
2307
  });
2308
2308
  }, H = async () => {
2309
- if (!A) {
2310
- if (await k(), A) {
2309
+ if (!P) {
2310
+ if (await k(), P) {
2311
2311
  V();
2312
2312
  return;
2313
2313
  }
2314
2314
  d && (w(), m("online"), y());
2315
2315
  }
2316
2316
  }, X = () => {
2317
- if (!A) {
2317
+ if (!P) {
2318
2318
  if (document.visibilityState === "hidden") {
2319
2319
  V(), b(), R();
2320
2320
  return;
2321
2321
  }
2322
2322
  if (document.visibilityState === "visible" && !d) {
2323
- f = xt(n.accountLimitedUntilStorageKey), !f && !h && H();
2323
+ f = Ut(n.accountLimitedUntilStorageKey), !f && !h && H();
2324
2324
  return;
2325
2325
  }
2326
2326
  document.visibilityState === "visible" && d && !f && !h && F();
2327
2327
  }
2328
2328
  }, _ = () => {
2329
- A || (V(), b(), R());
2329
+ P || (V(), b(), R());
2330
2330
  };
2331
- qt(async () => {
2331
+ $t(async () => {
2332
2332
  if (e.isAuthenticated ?? e.currentUser !== null) {
2333
- if (await k(), A) {
2333
+ if (await k(), P) {
2334
2334
  V();
2335
2335
  return;
2336
2336
  }
2337
2337
  d && (w(), m("online"), y()), J(), document.addEventListener("visibilitychange", X), window.addEventListener("pagehide", _), window.addEventListener("beforeunload", _);
2338
2338
  }
2339
- }), qe(() => {
2340
- A = !0, G(), R(), b(), V(), document.removeEventListener("visibilitychange", X), window.removeEventListener("pagehide", _), window.removeEventListener("beforeunload", _);
2339
+ }), ze(() => {
2340
+ P = !0, G(), R(), b(), V(), document.removeEventListener("visibilitychange", X), window.removeEventListener("pagehide", _), window.removeEventListener("beforeunload", _);
2341
2341
  });
2342
2342
  }
2343
2343
  const Ea = 12e3;
2344
2344
  function dc(e) {
2345
- const n = Jt(), r = ke()(), o = ye(!1), c = ye(null), u = ye(null), d = ye([]), f = /* @__PURE__ */ new Map(), h = Nt(), A = h !== null, C = 20, v = 250;
2346
- let E = !1, b = null, R = 0, w = null;
2347
- const p = re(() => r.currentUser?.id), m = () => ss(e)?.trim() ?? "", y = () => {
2345
+ const n = Yt(), r = Le()(), o = ye(!1), c = ye(null), u = ye(null), d = ye([]), f = /* @__PURE__ */ new Map(), h = jt(), P = h !== null, C = 20, v = 250;
2346
+ let T = !1, b = null, R = 0, w = null;
2347
+ const p = ie(() => r.currentUser?.id), m = () => is(e)?.trim() ?? "", y = () => {
2348
2348
  const M = u.value?.trim() ?? "";
2349
2349
  if (M.length > 0)
2350
2350
  return M;
2351
- const U = m();
2352
- return U.length > 0 && (u.value = U), U;
2351
+ const O = m();
2352
+ return O.length > 0 && (u.value = O), O;
2353
2353
  }, F = (M) => n.getTypingUsers(M), q = (M) => {
2354
- const U = F(M);
2355
- for (const ne of U)
2356
- n.removeTypingUser(M, ne.id);
2354
+ const O = F(M);
2355
+ for (const se of O)
2356
+ n.removeTypingUser(M, se.id);
2357
2357
  d.value = [];
2358
2358
  }, J = (M) => {
2359
- const U = f.get(M);
2360
- U && (clearTimeout(U), f.delete(M));
2359
+ const O = f.get(M);
2360
+ O && (clearTimeout(O), f.delete(M));
2361
2361
  }, G = () => {
2362
2362
  for (const M of f.values())
2363
2363
  clearTimeout(M);
@@ -2365,39 +2365,39 @@ function dc(e) {
2365
2365
  }, te = () => {
2366
2366
  w && (clearTimeout(w), w = null), R = 0;
2367
2367
  }, k = () => {
2368
- !A || o.value || w || R >= C || (w = setTimeout(() => {
2368
+ !P || o.value || w || R >= C || (w = setTimeout(() => {
2369
2369
  w = null, R += 1, X();
2370
2370
  }, v));
2371
- }, I = (M, U) => {
2371
+ }, I = (M, O) => {
2372
2372
  J(M);
2373
- const ne = setTimeout(() => {
2374
- f.delete(M), n.removeTypingUser(U, M), d.value = d.value.filter((ue) => ue.id !== M);
2373
+ const se = setTimeout(() => {
2374
+ f.delete(M), n.removeTypingUser(O, M), d.value = d.value.filter((le) => le.id !== M);
2375
2375
  }, Ea);
2376
- f.set(M, ne);
2376
+ f.set(M, se);
2377
2377
  }, V = () => {
2378
- E = !0, te();
2378
+ T = !0, te();
2379
2379
  }, H = (M) => {
2380
2380
  try {
2381
2381
  b && (b(), b = null), b = Vi(M, {
2382
2382
  onTypingStart: x,
2383
2383
  onTypingStop: fe
2384
2384
  }), te(), o.value = !0, u.value = M;
2385
- } catch (U) {
2386
- c.value = U instanceof Error ? U.message : "Failed to subscribe to typing channel";
2385
+ } catch (O) {
2386
+ c.value = O instanceof Error ? O.message : "Failed to subscribe to typing channel";
2387
2387
  }
2388
2388
  }, X = () => {
2389
2389
  const M = m();
2390
2390
  if (!(o.value || !M)) {
2391
- if (c.value = null, Re() && En() === "connected") {
2391
+ if (c.value = null, Pe() && An() === "connected") {
2392
2392
  H(M);
2393
2393
  return;
2394
2394
  }
2395
- E = !1, ps().then((U) => {
2396
- if (E || o.value || !U)
2395
+ T = !1, ms().then((O) => {
2396
+ if (T || o.value || !O)
2397
2397
  return;
2398
- const ne = m();
2399
- if (ne && ne === M && Re() && En() === "connected") {
2400
- H(ne);
2398
+ const se = m();
2399
+ if (se && se === M && Pe() && An() === "connected") {
2400
+ H(se);
2401
2401
  return;
2402
2402
  }
2403
2403
  k();
@@ -2408,81 +2408,81 @@ function dc(e) {
2408
2408
  if (V(), !(!o.value || !M))
2409
2409
  try {
2410
2410
  b && (b(), b = null), Xi(M), G(), q(M), o.value = !1, u.value = null, c.value = null;
2411
- } catch (U) {
2412
- c.value = U instanceof Error ? U.message : "Failed to unsubscribe from typing channel";
2411
+ } catch (O) {
2412
+ c.value = O instanceof Error ? O.message : "Failed to unsubscribe from typing channel";
2413
2413
  }
2414
2414
  };
2415
2415
  function x(M) {
2416
2416
  if (M.user_id === p.value)
2417
2417
  return;
2418
- const U = y();
2419
- if (!U)
2418
+ const O = M.conversation_id.trim() || y();
2419
+ if (!O)
2420
2420
  return;
2421
- const ne = {
2421
+ const se = {
2422
2422
  id: M.user.id,
2423
2423
  name: M.user.name,
2424
2424
  ...M.user.avatar !== void 0 ? { avatar: M.user.avatar } : {}
2425
2425
  };
2426
- d.value.some((ue) => ue.id === ne.id) || (d.value = [...d.value, ne]), n.addTypingUser(U, ne), I(M.user_id, U);
2426
+ d.value.some((le) => le.id === se.id) || (d.value = [...d.value, se]), n.addTypingUser(O, se), I(M.user_id, O);
2427
2427
  }
2428
2428
  function fe(M) {
2429
2429
  if (M.user_id === p.value)
2430
2430
  return;
2431
2431
  J(M.user_id);
2432
- const U = y();
2433
- U && (d.value = d.value.filter((ne) => ne.id !== M.user_id), n.removeTypingUser(U, M.user_id));
2432
+ const O = M.conversation_id.trim() || y();
2433
+ O && (d.value = d.value.filter((se) => se.id !== M.user_id), n.removeTypingUser(O, M.user_id));
2434
2434
  }
2435
- const Se = re(() => {
2435
+ const Se = ie(() => {
2436
2436
  const M = y();
2437
2437
  if (!M)
2438
2438
  return d.value;
2439
- const U = F(M);
2439
+ const O = F(M);
2440
2440
  if (d.value.length === 0)
2441
- return U;
2442
- if (U.length === 0)
2441
+ return O;
2442
+ if (O.length === 0)
2443
2443
  return d.value;
2444
- const ne = /* @__PURE__ */ new Map();
2445
- for (const ue of U)
2446
- ne.set(ue.id, ue);
2447
- for (const ue of d.value)
2448
- ne.set(ue.id, ue);
2449
- return [...ne.values()];
2450
- }), B = re(() => {
2444
+ const se = /* @__PURE__ */ new Map();
2445
+ for (const le of O)
2446
+ se.set(le.id, le);
2447
+ for (const le of d.value)
2448
+ se.set(le.id, le);
2449
+ return [...se.values()];
2450
+ }), B = ie(() => {
2451
2451
  const M = Se.value;
2452
2452
  if (M.length === 0)
2453
2453
  return "";
2454
- const U = M[0];
2455
- if (!U)
2454
+ const O = M[0];
2455
+ if (!O)
2456
2456
  return "";
2457
2457
  if (M.length === 1)
2458
- return `${U.name} is typing...`;
2459
- const ne = M[1];
2460
- if (!ne)
2458
+ return `${O.name} is typing...`;
2459
+ const se = M[1];
2460
+ if (!se)
2461
2461
  return `${M.length} people are typing...`;
2462
2462
  if (M.length === 2)
2463
- return `${U.name} and ${ne.name} are typing...`;
2464
- const ue = M[2];
2465
- return ue ? M.length === 3 ? `${U.name}, ${ne.name} and ${ue.name} are typing...` : `${M.length} people are typing...` : `${M.length} people are typing...`;
2466
- }), K = re(() => Se.value.length > 0), N = () => {
2463
+ return `${O.name} and ${se.name} are typing...`;
2464
+ const le = M[2];
2465
+ return le ? M.length === 3 ? `${O.name}, ${se.name} and ${le.name} are typing...` : `${M.length} people are typing...` : `${M.length} people are typing...`;
2466
+ }), K = ie(() => Se.value.length > 0), N = () => {
2467
2467
  m() && (b && (b(), b = null), o.value = !1, u.value = null, X());
2468
2468
  };
2469
- typeof window < "u" && window.addEventListener(Je(), N);
2470
- const Y = lt((M) => {
2469
+ typeof window < "u" && window.addEventListener(Ke(), N);
2470
+ const Y = ft((M) => {
2471
2471
  if (M === "connected") {
2472
2472
  o.value || X();
2473
2473
  return;
2474
2474
  }
2475
2475
  if (M === "disconnected" || M === "error") {
2476
2476
  V(), b && (b(), b = null);
2477
- const U = y();
2478
- U && q(U), o.value = !1, u.value = null, G();
2477
+ const O = y();
2478
+ O && q(O), o.value = !1, u.value = null, G();
2479
2479
  }
2480
2480
  });
2481
- return h !== null && qe(() => {
2482
- V(), Y(), G(), _(), typeof window < "u" && window.removeEventListener(Je(), N);
2481
+ return h !== null && ze(() => {
2482
+ V(), Y(), G(), _(), typeof window < "u" && window.removeEventListener(Ke(), N);
2483
2483
  }), {
2484
- isSubscribed: re(() => o.value),
2485
- error: re(() => c.value),
2484
+ isSubscribed: ie(() => o.value),
2485
+ error: ie(() => c.value),
2486
2486
  typingUsers: Se,
2487
2487
  formatTypingIndicator: B,
2488
2488
  hasTypingUsers: K,
@@ -2496,7 +2496,7 @@ function hc(e) {
2496
2496
  function fc() {
2497
2497
  no(), ro(), oo(), uo(), Jo(), ea(), Gi(), Xo(), aa();
2498
2498
  }
2499
- class Zt {
2499
+ class nn {
2500
2500
  constructor() {
2501
2501
  this.notificationCreatedEvent = ".Illuminate\\Notifications\\Events\\BroadcastNotificationCreated";
2502
2502
  }
@@ -2525,7 +2525,7 @@ class Zt {
2525
2525
  return this.stopListening(".client-" + n, r);
2526
2526
  }
2527
2527
  }
2528
- class Us {
2528
+ class Fs {
2529
2529
  /**
2530
2530
  * Create a new class instance.
2531
2531
  */
@@ -2554,12 +2554,12 @@ function Ra(e) {
2554
2554
  }
2555
2555
  return !0;
2556
2556
  }
2557
- class en extends Zt {
2557
+ class sn extends nn {
2558
2558
  /**
2559
2559
  * Create a new class instance.
2560
2560
  */
2561
2561
  constructor(n, r, o) {
2562
- super(), this.name = r, this.pusher = n, this.options = o, this.eventFormatter = new Us(this.options.namespace), this.subscribe();
2562
+ super(), this.name = r, this.pusher = n, this.options = o, this.eventFormatter = new Fs(this.options.namespace), this.subscribe();
2563
2563
  }
2564
2564
  /**
2565
2565
  * Subscribe to a Pusher channel.
@@ -2631,7 +2631,7 @@ class en extends Zt {
2631
2631
  return this.subscription.bind(n, r), this;
2632
2632
  }
2633
2633
  }
2634
- class Os extends en {
2634
+ class Ds extends sn {
2635
2635
  /**
2636
2636
  * Send a whisper event to other clients in the channel.
2637
2637
  */
@@ -2642,7 +2642,7 @@ class Os extends en {
2642
2642
  ), this;
2643
2643
  }
2644
2644
  }
2645
- class Aa extends en {
2645
+ class Aa extends sn {
2646
2646
  /**
2647
2647
  * Send a whisper event to other clients in the channel.
2648
2648
  */
@@ -2653,7 +2653,7 @@ class Aa extends en {
2653
2653
  ), this;
2654
2654
  }
2655
2655
  }
2656
- class Pa extends Os {
2656
+ class Pa extends Ds {
2657
2657
  /**
2658
2658
  * Register a callback to be called anytime the member list changes.
2659
2659
  */
@@ -2688,12 +2688,12 @@ class Pa extends Os {
2688
2688
  }), this;
2689
2689
  }
2690
2690
  }
2691
- class Fs extends Zt {
2691
+ class Ns extends nn {
2692
2692
  /**
2693
2693
  * Create a new class instance.
2694
2694
  */
2695
2695
  constructor(n, r, o) {
2696
- super(), this.events = {}, this.listeners = {}, this.name = r, this.socket = n, this.options = o, this.eventFormatter = new Us(this.options.namespace), this.subscribe();
2696
+ super(), this.events = {}, this.listeners = {}, this.name = r, this.socket = n, this.options = o, this.eventFormatter = new Fs(this.options.namespace), this.subscribe();
2697
2697
  }
2698
2698
  /**
2699
2699
  * Subscribe to a Socket.io channel.
@@ -2764,7 +2764,7 @@ class Fs extends Zt {
2764
2764
  )), (!r || this.listeners[n].length === 0) && (this.events[n] && (this.socket.removeListener(n, this.events[n]), delete this.events[n]), delete this.listeners[n]);
2765
2765
  }
2766
2766
  }
2767
- class Ds extends Fs {
2767
+ class qs extends Ns {
2768
2768
  /**
2769
2769
  * Send a whisper event to other clients in the channel.
2770
2770
  */
@@ -2776,7 +2776,7 @@ class Ds extends Fs {
2776
2776
  }), this;
2777
2777
  }
2778
2778
  }
2779
- class Ma extends Ds {
2779
+ class Ma extends qs {
2780
2780
  /**
2781
2781
  * Register a callback to be called anytime the member list changes.
2782
2782
  */
@@ -2814,7 +2814,7 @@ class Ma extends Ds {
2814
2814
  ), this;
2815
2815
  }
2816
2816
  }
2817
- class ut extends Zt {
2817
+ class ht extends nn {
2818
2818
  /**
2819
2819
  * Subscribe to a channel.
2820
2820
  */
@@ -2862,7 +2862,7 @@ class ut extends Zt {
2862
2862
  return this;
2863
2863
  }
2864
2864
  }
2865
- class Ns extends ut {
2865
+ class zs extends ht {
2866
2866
  /**
2867
2867
  * Send a whisper event to other clients in the channel.
2868
2868
  */
@@ -2870,7 +2870,7 @@ class Ns extends ut {
2870
2870
  return this;
2871
2871
  }
2872
2872
  }
2873
- class ka extends ut {
2873
+ class ka extends ht {
2874
2874
  /**
2875
2875
  * Send a whisper event to other clients in the channel.
2876
2876
  */
@@ -2878,7 +2878,7 @@ class ka extends ut {
2878
2878
  return this;
2879
2879
  }
2880
2880
  }
2881
- class xa extends Ns {
2881
+ class xa extends zs {
2882
2882
  /**
2883
2883
  * Register a callback to be called anytime the member list changes.
2884
2884
  */
@@ -2904,7 +2904,7 @@ class xa extends Ns {
2904
2904
  return this;
2905
2905
  }
2906
2906
  }
2907
- const qs = class zs {
2907
+ const js = class $s {
2908
2908
  /**
2909
2909
  * Create a new class instance.
2910
2910
  */
@@ -2916,7 +2916,7 @@ const qs = class zs {
2916
2916
  */
2917
2917
  setOptions(n) {
2918
2918
  this.options = {
2919
- ...zs._defaultOptions,
2919
+ ...$s._defaultOptions,
2920
2920
  ...n,
2921
2921
  broadcaster: n.broadcaster
2922
2922
  };
@@ -2931,7 +2931,7 @@ const qs = class zs {
2931
2931
  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;
2932
2932
  }
2933
2933
  };
2934
- qs._defaultOptions = {
2934
+ js._defaultOptions = {
2935
2935
  auth: {
2936
2936
  headers: {}
2937
2937
  },
@@ -2946,8 +2946,8 @@ qs._defaultOptions = {
2946
2946
  key: null,
2947
2947
  namespace: "App.Events"
2948
2948
  };
2949
- let tn = qs;
2950
- class it extends tn {
2949
+ let rn = js;
2950
+ class ct extends rn {
2951
2951
  constructor() {
2952
2952
  super(...arguments), this.channels = {};
2953
2953
  }
@@ -2985,7 +2985,7 @@ class it extends tn {
2985
2985
  * Get a channel instance by name.
2986
2986
  */
2987
2987
  channel(n) {
2988
- return this.channels[n] || (this.channels[n] = new en(
2988
+ return this.channels[n] || (this.channels[n] = new sn(
2989
2989
  this.pusher,
2990
2990
  n,
2991
2991
  this.options
@@ -2995,7 +2995,7 @@ class it extends tn {
2995
2995
  * Get a private channel instance by name.
2996
2996
  */
2997
2997
  privateChannel(n) {
2998
- return this.channels["private-" + n] || (this.channels["private-" + n] = new Os(
2998
+ return this.channels["private-" + n] || (this.channels["private-" + n] = new Ds(
2999
2999
  this.pusher,
3000
3000
  "private-" + n,
3001
3001
  this.options
@@ -3084,7 +3084,7 @@ class it extends tn {
3084
3084
  this.pusher.disconnect();
3085
3085
  }
3086
3086
  }
3087
- class La extends tn {
3087
+ class La extends rn {
3088
3088
  constructor() {
3089
3089
  super(...arguments), this.channels = {};
3090
3090
  }
@@ -3124,7 +3124,7 @@ class La extends tn {
3124
3124
  * Get a channel instance by name.
3125
3125
  */
3126
3126
  channel(n) {
3127
- return this.channels[n] || (this.channels[n] = new Fs(
3127
+ return this.channels[n] || (this.channels[n] = new Ns(
3128
3128
  this.socket,
3129
3129
  n,
3130
3130
  this.options
@@ -3134,7 +3134,7 @@ class La extends tn {
3134
3134
  * Get a private channel instance by name.
3135
3135
  */
3136
3136
  privateChannel(n) {
3137
- return this.channels["private-" + n] || (this.channels["private-" + n] = new Ds(
3137
+ return this.channels["private-" + n] || (this.channels["private-" + n] = new qs(
3138
3138
  this.socket,
3139
3139
  "private-" + n,
3140
3140
  this.options
@@ -3206,7 +3206,7 @@ class La extends tn {
3206
3206
  this.socket.disconnect();
3207
3207
  }
3208
3208
  }
3209
- class Xn extends tn {
3209
+ class Gn extends rn {
3210
3210
  constructor() {
3211
3211
  super(...arguments), this.channels = {};
3212
3212
  }
@@ -3219,19 +3219,19 @@ class Xn extends tn {
3219
3219
  * Listen for an event on a channel instance.
3220
3220
  */
3221
3221
  listen(n, r, o) {
3222
- return new ut();
3222
+ return new ht();
3223
3223
  }
3224
3224
  /**
3225
3225
  * Get a channel instance by name.
3226
3226
  */
3227
3227
  channel(n) {
3228
- return new ut();
3228
+ return new ht();
3229
3229
  }
3230
3230
  /**
3231
3231
  * Get a private channel instance by name.
3232
3232
  */
3233
3233
  privateChannel(n) {
3234
- return new Ns();
3234
+ return new zs();
3235
3235
  }
3236
3236
  /**
3237
3237
  * Get a private encrypted channel instance by name.
@@ -3298,14 +3298,14 @@ class Ia {
3298
3298
  */
3299
3299
  connect() {
3300
3300
  if (this.options.broadcaster === "reverb")
3301
- this.connector = new it({
3301
+ this.connector = new ct({
3302
3302
  ...this.options,
3303
3303
  cluster: ""
3304
3304
  });
3305
3305
  else if (this.options.broadcaster === "pusher")
3306
- this.connector = new it(this.options);
3306
+ this.connector = new ct(this.options);
3307
3307
  else if (this.options.broadcaster === "ably")
3308
- this.connector = new it({
3308
+ this.connector = new ct({
3309
3309
  ...this.options,
3310
3310
  cluster: "",
3311
3311
  broadcaster: "pusher"
@@ -3313,7 +3313,7 @@ class Ia {
3313
3313
  else if (this.options.broadcaster === "socket.io")
3314
3314
  this.connector = new La(this.options);
3315
3315
  else if (this.options.broadcaster === "null")
3316
- this.connector = new Xn(this.options);
3316
+ this.connector = new Gn(this.options);
3317
3317
  else if (typeof this.options.broadcaster == "function" && Ra(this.options.broadcaster))
3318
3318
  this.connector = new this.options.broadcaster(this.options);
3319
3319
  else
@@ -3377,7 +3377,7 @@ class Ia {
3377
3377
  );
3378
3378
  }
3379
3379
  connectorSupportsEncryptedPrivateChannels(n) {
3380
- return n instanceof it || n instanceof Xn;
3380
+ return n instanceof ct || n instanceof Gn;
3381
3381
  }
3382
3382
  /**
3383
3383
  * Get the Socket ID for the connection.
@@ -3441,10 +3441,10 @@ class Ia {
3441
3441
  function Ua(e) {
3442
3442
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
3443
3443
  }
3444
- var Lt = { exports: {} };
3445
- var Wn;
3444
+ var Ot = { exports: {} };
3445
+ var Jn;
3446
3446
  function Oa() {
3447
- return Wn || (Wn = 1, (function(e, n) {
3447
+ return Jn || (Jn = 1, (function(e, n) {
3448
3448
  (function(o, c) {
3449
3449
  e.exports = c();
3450
3450
  })(window, function() {
@@ -3473,8 +3473,8 @@ function Oa() {
3473
3473
  }, c.t = function(u, d) {
3474
3474
  if (d & 1 && (u = c(u)), d & 8 || d & 4 && typeof u == "object" && u && u.__esModule) return u;
3475
3475
  var f = /* @__PURE__ */ Object.create(null);
3476
- 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(A) {
3477
- return u[A];
3476
+ 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) {
3477
+ return u[P];
3478
3478
  }).bind(null, h));
3479
3479
  return f;
3480
3480
  }, c.n = function(u) {
@@ -3565,10 +3565,10 @@ function Oa() {
3565
3565
  );
3566
3566
  o.Coder = f;
3567
3567
  var h = new f();
3568
- function A(w) {
3568
+ function P(w) {
3569
3569
  return h.encode(w);
3570
3570
  }
3571
- o.encode = A;
3571
+ o.encode = P;
3572
3572
  function C(w) {
3573
3573
  return h.decode(w);
3574
3574
  }
@@ -3590,13 +3590,13 @@ function Oa() {
3590
3590
  })(f)
3591
3591
  );
3592
3592
  o.URLSafeCoder = v;
3593
- var E = new v();
3593
+ var T = new v();
3594
3594
  function b(w) {
3595
- return E.encode(w);
3595
+ return T.encode(w);
3596
3596
  }
3597
3597
  o.encodeURLSafe = b;
3598
3598
  function R(w) {
3599
- return E.decode(w);
3599
+ return T.decode(w);
3600
3600
  }
3601
3601
  o.decodeURLSafe = R, o.encodedLength = function(w) {
3602
3602
  return h.encodedLength(w);
@@ -3612,16 +3612,16 @@ function Oa() {
3612
3612
  Object.defineProperty(o, "__esModule", { value: !0 });
3613
3613
  var u = "utf8: invalid string", d = "utf8: invalid source encoding";
3614
3614
  function f(C) {
3615
- for (var v = new Uint8Array(h(C)), E = 0, b = 0; b < C.length; b++) {
3615
+ for (var v = new Uint8Array(h(C)), T = 0, b = 0; b < C.length; b++) {
3616
3616
  var R = C.charCodeAt(b);
3617
- R < 128 ? v[E++] = R : R < 2048 ? (v[E++] = 192 | R >> 6, v[E++] = 128 | R & 63) : R < 55296 ? (v[E++] = 224 | R >> 12, v[E++] = 128 | R >> 6 & 63, v[E++] = 128 | R & 63) : (b++, R = (R & 1023) << 10, R |= C.charCodeAt(b) & 1023, R += 65536, v[E++] = 240 | R >> 18, v[E++] = 128 | R >> 12 & 63, v[E++] = 128 | R >> 6 & 63, v[E++] = 128 | R & 63);
3617
+ R < 128 ? v[T++] = R : R < 2048 ? (v[T++] = 192 | R >> 6, v[T++] = 128 | R & 63) : R < 55296 ? (v[T++] = 224 | R >> 12, v[T++] = 128 | R >> 6 & 63, v[T++] = 128 | R & 63) : (b++, R = (R & 1023) << 10, R |= C.charCodeAt(b) & 1023, R += 65536, v[T++] = 240 | R >> 18, v[T++] = 128 | R >> 12 & 63, v[T++] = 128 | R >> 6 & 63, v[T++] = 128 | R & 63);
3618
3618
  }
3619
3619
  return v;
3620
3620
  }
3621
3621
  o.encode = f;
3622
3622
  function h(C) {
3623
- for (var v = 0, E = 0; E < C.length; E++) {
3624
- var b = C.charCodeAt(E);
3623
+ for (var v = 0, T = 0; T < C.length; T++) {
3624
+ var b = C.charCodeAt(T);
3625
3625
  if (b < 128)
3626
3626
  v += 1;
3627
3627
  else if (b < 2048)
@@ -3629,38 +3629,38 @@ function Oa() {
3629
3629
  else if (b < 55296)
3630
3630
  v += 3;
3631
3631
  else if (b <= 57343) {
3632
- if (E >= C.length - 1)
3632
+ if (T >= C.length - 1)
3633
3633
  throw new Error(u);
3634
- E++, v += 4;
3634
+ T++, v += 4;
3635
3635
  } else
3636
3636
  throw new Error(u);
3637
3637
  }
3638
3638
  return v;
3639
3639
  }
3640
3640
  o.encodedLength = h;
3641
- function A(C) {
3642
- for (var v = [], E = 0; E < C.length; E++) {
3643
- var b = C[E];
3641
+ function P(C) {
3642
+ for (var v = [], T = 0; T < C.length; T++) {
3643
+ var b = C[T];
3644
3644
  if (b & 128) {
3645
3645
  var R = void 0;
3646
3646
  if (b < 224) {
3647
- if (E >= C.length)
3647
+ if (T >= C.length)
3648
3648
  throw new Error(d);
3649
- var w = C[++E];
3649
+ var w = C[++T];
3650
3650
  if ((w & 192) !== 128)
3651
3651
  throw new Error(d);
3652
3652
  b = (b & 31) << 6 | w & 63, R = 128;
3653
3653
  } else if (b < 240) {
3654
- if (E >= C.length - 1)
3654
+ if (T >= C.length - 1)
3655
3655
  throw new Error(d);
3656
- var w = C[++E], p = C[++E];
3656
+ var w = C[++T], p = C[++T];
3657
3657
  if ((w & 192) !== 128 || (p & 192) !== 128)
3658
3658
  throw new Error(d);
3659
3659
  b = (b & 15) << 12 | (w & 63) << 6 | p & 63, R = 2048;
3660
3660
  } else if (b < 248) {
3661
- if (E >= C.length - 2)
3661
+ if (T >= C.length - 2)
3662
3662
  throw new Error(d);
3663
- var w = C[++E], p = C[++E], m = C[++E];
3663
+ var w = C[++T], p = C[++T], m = C[++T];
3664
3664
  if ((w & 192) !== 128 || (p & 192) !== 128 || (m & 192) !== 128)
3665
3665
  throw new Error(d);
3666
3666
  b = (b & 15) << 18 | (w & 63) << 12 | (p & 63) << 6 | m & 63, R = 65536;
@@ -3678,7 +3678,7 @@ function Oa() {
3678
3678
  }
3679
3679
  return v.join("");
3680
3680
  }
3681
- o.decode = A;
3681
+ o.decode = P;
3682
3682
  }),
3683
3683
  /* 2 */
3684
3684
  /***/
@@ -3732,7 +3732,7 @@ function Oa() {
3732
3732
  cdn_https: "https://js.pusher.com",
3733
3733
  dependency_suffix: ""
3734
3734
  }, h = f;
3735
- class A {
3735
+ class P {
3736
3736
  constructor(t) {
3737
3737
  this.options = t, this.receivers = t.receivers || d, this.loading = {};
3738
3738
  }
@@ -3763,14 +3763,14 @@ function Oa() {
3763
3763
  return this.getRoot(s) + "/" + t + this.options.suffix + ".js";
3764
3764
  }
3765
3765
  }
3766
- var C = new u("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new A({
3766
+ var C = new u("_pusher_dependencies", "Pusher.DependenciesReceivers"), v = new P({
3767
3767
  cdn_http: h.cdn_http,
3768
3768
  cdn_https: h.cdn_https,
3769
3769
  version: h.VERSION,
3770
3770
  suffix: h.dependency_suffix,
3771
3771
  receivers: C
3772
3772
  });
3773
- const E = {
3773
+ const T = {
3774
3774
  baseUrl: "https://pusher.com",
3775
3775
  urls: {
3776
3776
  authenticationEndpoint: {
@@ -3791,11 +3791,11 @@ function Oa() {
3791
3791
  }
3792
3792
  };
3793
3793
  var R = { buildLogSuffix: function(i) {
3794
- const t = "See:", s = E.urls[i];
3794
+ const t = "See:", s = T.urls[i];
3795
3795
  if (!s)
3796
3796
  return "";
3797
3797
  let a;
3798
- return s.fullUrl ? a = s.fullUrl : s.path && (a = E.baseUrl + s.path), a ? `${t} ${a}` : "";
3798
+ return s.fullUrl ? a = s.fullUrl : s.path && (a = T.baseUrl + s.path), a ? `${t} ${a}` : "";
3799
3799
  } }, w;
3800
3800
  (function(i) {
3801
3801
  i.UserAuthentication = "user-authentication", i.ChannelAuthorization = "channel-authorization";
@@ -3918,26 +3918,26 @@ function Oa() {
3918
3918
  function M(i) {
3919
3919
  window.clearInterval(i);
3920
3920
  }
3921
- class U extends N {
3921
+ class O extends N {
3922
3922
  constructor(t, s) {
3923
3923
  super(setTimeout, Y, t, function(a) {
3924
3924
  return s(), null;
3925
3925
  });
3926
3926
  }
3927
3927
  }
3928
- class ne extends N {
3928
+ class se extends N {
3929
3929
  constructor(t, s) {
3930
3930
  super(setInterval, M, t, function(a) {
3931
3931
  return s(), a;
3932
3932
  });
3933
3933
  }
3934
3934
  }
3935
- var ue = {
3935
+ var le = {
3936
3936
  now() {
3937
3937
  return Date.now ? Date.now() : (/* @__PURE__ */ new Date()).valueOf();
3938
3938
  },
3939
3939
  defer(i) {
3940
- return new U(0, i);
3940
+ return new O(0, i);
3941
3941
  },
3942
3942
  method(i, ...t) {
3943
3943
  var s = Array.prototype.slice.call(arguments, 1);
@@ -3945,7 +3945,7 @@ function Oa() {
3945
3945
  return a[i].apply(a, s.concat(arguments));
3946
3946
  };
3947
3947
  }
3948
- }, oe = ue;
3948
+ }, re = le;
3949
3949
  function ve(i, ...t) {
3950
3950
  for (var s = 0; s < t.length; s++) {
3951
3951
  var a = t[s];
@@ -3954,12 +3954,12 @@ function Oa() {
3954
3954
  }
3955
3955
  return i;
3956
3956
  }
3957
- function nn() {
3957
+ function pt() {
3958
3958
  for (var i = ["Pusher"], t = 0; t < arguments.length; t++)
3959
- typeof arguments[t] == "string" ? i.push(arguments[t]) : i.push(Qe(arguments[t]));
3959
+ typeof arguments[t] == "string" ? i.push(arguments[t]) : i.push(et(arguments[t]));
3960
3960
  return i.join(" : ");
3961
3961
  }
3962
- function dt(i, t) {
3962
+ function Ye(i, t) {
3963
3963
  var s = Array.prototype.indexOf;
3964
3964
  if (i === null)
3965
3965
  return -1;
@@ -3970,38 +3970,38 @@ function Oa() {
3970
3970
  return a;
3971
3971
  return -1;
3972
3972
  }
3973
- function T(i, t) {
3973
+ function we(i, t) {
3974
3974
  for (var s in i)
3975
3975
  Object.prototype.hasOwnProperty.call(i, s) && t(i[s], s, i);
3976
3976
  }
3977
- function P(i) {
3977
+ function E(i) {
3978
3978
  var t = [];
3979
- return T(i, function(s, a) {
3979
+ return we(i, function(s, a) {
3980
3980
  t.push(a);
3981
3981
  }), t;
3982
3982
  }
3983
- function D(i) {
3983
+ function A(i) {
3984
3984
  var t = [];
3985
- return T(i, function(s) {
3985
+ return we(i, function(s) {
3986
3986
  t.push(s);
3987
3987
  }), t;
3988
3988
  }
3989
- function O(i, t, s) {
3989
+ function U(i, t, s) {
3990
3990
  for (var a = 0; a < i.length; a++)
3991
3991
  t.call(s || window, i[a], a, i);
3992
3992
  }
3993
- function se(i, t) {
3993
+ function D(i, t) {
3994
3994
  for (var s = [], a = 0; a < i.length; a++)
3995
3995
  s.push(t(i[a], a, i, s));
3996
3996
  return s;
3997
3997
  }
3998
- function ae(i, t) {
3998
+ function ne(i, t) {
3999
3999
  var s = {};
4000
- return T(i, function(a, l) {
4000
+ return we(i, function(a, l) {
4001
4001
  s[l] = t(a);
4002
4002
  }), s;
4003
4003
  }
4004
- function le(i, t) {
4004
+ function ae(i, t) {
4005
4005
  t = t || function(l) {
4006
4006
  return !!l;
4007
4007
  };
@@ -4009,42 +4009,42 @@ function Oa() {
4009
4009
  t(i[a], a, i, s) && s.push(i[a]);
4010
4010
  return s;
4011
4011
  }
4012
- function Ae(i, t) {
4012
+ function ue(i, t) {
4013
4013
  var s = {};
4014
- return T(i, function(a, l) {
4014
+ return we(i, function(a, l) {
4015
4015
  (t && t(a, l, i, s) || a) && (s[l] = a);
4016
4016
  }), s;
4017
4017
  }
4018
- function Le(i) {
4018
+ function Ce(i) {
4019
4019
  var t = [];
4020
- return T(i, function(s, a) {
4020
+ return we(i, function(s, a) {
4021
4021
  t.push([a, s]);
4022
4022
  }), t;
4023
4023
  }
4024
- function we(i, t) {
4024
+ function Me(i, t) {
4025
4025
  for (var s = 0; s < i.length; s++)
4026
4026
  if (t(i[s], s, i))
4027
4027
  return !0;
4028
4028
  return !1;
4029
4029
  }
4030
- function ge(i, t) {
4030
+ function Ze(i, t) {
4031
4031
  for (var s = 0; s < i.length; s++)
4032
4032
  if (!t(i[s], s, i))
4033
4033
  return !1;
4034
4034
  return !0;
4035
4035
  }
4036
- function be(i) {
4037
- return ae(i, function(t) {
4038
- return typeof t == "object" && (t = Qe(t)), encodeURIComponent(H(t.toString()));
4036
+ function Ee(i) {
4037
+ return ne(i, function(t) {
4038
+ return typeof t == "object" && (t = et(t)), encodeURIComponent(H(t.toString()));
4039
4039
  });
4040
4040
  }
4041
- function js(i) {
4042
- var t = Ae(i, function(a) {
4041
+ function ge(i) {
4042
+ var t = ue(i, function(a) {
4043
4043
  return a !== void 0;
4044
- }), s = se(Le(be(t)), oe.method("join", "=")).join("&");
4044
+ }), s = D(Ce(Ee(t)), re.method("join", "=")).join("&");
4045
4045
  return s;
4046
4046
  }
4047
- function $s(i) {
4047
+ function be(i) {
4048
4048
  var t = [], s = [];
4049
4049
  return (function a(l, g) {
4050
4050
  var S, L, z;
@@ -4071,11 +4071,11 @@ function Oa() {
4071
4071
  }
4072
4072
  })(i, "$");
4073
4073
  }
4074
- function Qe(i) {
4074
+ function et(i) {
4075
4075
  try {
4076
4076
  return JSON.stringify(i);
4077
4077
  } catch {
4078
- return JSON.stringify($s(i));
4078
+ return JSON.stringify(be(i));
4079
4079
  }
4080
4080
  }
4081
4081
  class Hs {
@@ -4100,8 +4100,8 @@ function Oa() {
4100
4100
  window.console && window.console.error ? window.console.error(t) : this.globalLogWarn(t);
4101
4101
  }
4102
4102
  log(t, ...s) {
4103
- var a = nn.apply(this, arguments);
4104
- Ct.log ? Ct.log(a) : Ct.logToConsole && t.bind(this)(a);
4103
+ var a = pt.apply(this, arguments);
4104
+ Et.log ? Et.log(a) : Et.logToConsole && t.bind(this)(a);
4105
4105
  }
4106
4106
  }
4107
4107
  var ce = new Hs(), Bs = function(i, t, s, a, l) {
@@ -4143,7 +4143,7 @@ function Oa() {
4143
4143
  }
4144
4144
  send(t) {
4145
4145
  if (!this.request) {
4146
- var s = js(this.data), a = this.url + "/" + t.number + "?" + s;
4146
+ var s = ge(this.data), a = this.url + "/" + t.number + "?" + s;
4147
4147
  this.request = j.createScriptRequest(a), this.request.send(t);
4148
4148
  }
4149
4149
  }
@@ -4162,30 +4162,30 @@ function Oa() {
4162
4162
  name: "jsonp",
4163
4163
  getAgent: Gs
4164
4164
  }, Ks = Js;
4165
- function ht(i, t, s) {
4165
+ function gt(i, t, s) {
4166
4166
  var a = i + (t.useTLS ? "s" : ""), l = t.useTLS ? t.hostTLS : t.hostNonTLS;
4167
4167
  return a + "://" + l + s;
4168
4168
  }
4169
- function ft(i, t) {
4169
+ function mt(i, t) {
4170
4170
  var s = "/app/" + i, a = "?protocol=" + h.PROTOCOL + "&client=js&version=" + h.VERSION + (t ? "&" + t : "");
4171
4171
  return s + a;
4172
4172
  }
4173
4173
  var Qs = {
4174
4174
  getInitial: function(i, t) {
4175
- var s = (t.httpPath || "") + ft(i, "flash=false");
4176
- return ht("ws", t, s);
4175
+ var s = (t.httpPath || "") + mt(i, "flash=false");
4176
+ return gt("ws", t, s);
4177
4177
  }
4178
4178
  }, Ys = {
4179
4179
  getInitial: function(i, t) {
4180
- var s = (t.httpPath || "/pusher") + ft(i);
4181
- return ht("http", t, s);
4180
+ var s = (t.httpPath || "/pusher") + mt(i);
4181
+ return gt("http", t, s);
4182
4182
  }
4183
4183
  }, Zs = {
4184
4184
  getInitial: function(i, t) {
4185
- return ht("http", t, t.httpPath || "/pusher");
4185
+ return gt("http", t, t.httpPath || "/pusher");
4186
4186
  },
4187
4187
  getPath: function(i, t) {
4188
- return ft(i);
4188
+ return mt(i);
4189
4189
  }
4190
4190
  };
4191
4191
  class er {
@@ -4193,10 +4193,10 @@ function Oa() {
4193
4193
  this._callbacks = {};
4194
4194
  }
4195
4195
  get(t) {
4196
- return this._callbacks[pt(t)];
4196
+ return this._callbacks[vt(t)];
4197
4197
  }
4198
4198
  add(t, s, a) {
4199
- var l = pt(t);
4199
+ var l = vt(t);
4200
4200
  this._callbacks[l] = this._callbacks[l] || [], this._callbacks[l].push({
4201
4201
  fn: s,
4202
4202
  context: a
@@ -4207,26 +4207,26 @@ function Oa() {
4207
4207
  this._callbacks = {};
4208
4208
  return;
4209
4209
  }
4210
- var l = t ? [pt(t)] : P(this._callbacks);
4210
+ var l = t ? [vt(t)] : E(this._callbacks);
4211
4211
  s || a ? this.removeCallback(l, s, a) : this.removeAllCallbacks(l);
4212
4212
  }
4213
4213
  removeCallback(t, s, a) {
4214
- O(t, function(l) {
4215
- this._callbacks[l] = le(this._callbacks[l] || [], function(g) {
4214
+ U(t, function(l) {
4215
+ this._callbacks[l] = ae(this._callbacks[l] || [], function(g) {
4216
4216
  return s && s !== g.fn || a && a !== g.context;
4217
4217
  }), this._callbacks[l].length === 0 && delete this._callbacks[l];
4218
4218
  }, this);
4219
4219
  }
4220
4220
  removeAllCallbacks(t) {
4221
- O(t, function(s) {
4221
+ U(t, function(s) {
4222
4222
  delete this._callbacks[s];
4223
4223
  }, this);
4224
4224
  }
4225
4225
  }
4226
- function pt(i) {
4226
+ function vt(i) {
4227
4227
  return "_" + i;
4228
4228
  }
4229
- class Te {
4229
+ class Re {
4230
4230
  constructor(t) {
4231
4231
  this.callbacks = new er(), this.global_callbacks = [], this.failThrough = t;
4232
4232
  }
@@ -4240,7 +4240,7 @@ function Oa() {
4240
4240
  return this.callbacks.remove(t, s, a), this;
4241
4241
  }
4242
4242
  unbind_global(t) {
4243
- return t ? (this.global_callbacks = le(this.global_callbacks || [], (s) => s !== t), this) : (this.global_callbacks = [], this);
4243
+ return t ? (this.global_callbacks = ae(this.global_callbacks || [], (s) => s !== t), this) : (this.global_callbacks = [], this);
4244
4244
  }
4245
4245
  unbind_all() {
4246
4246
  return this.unbind(), this.unbind_global(), this;
@@ -4256,7 +4256,7 @@ function Oa() {
4256
4256
  return this;
4257
4257
  }
4258
4258
  }
4259
- class tr extends Te {
4259
+ class tr extends Re {
4260
4260
  constructor(t, s, a, l, g) {
4261
4261
  super(), this.initialize = j.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();
4262
4262
  }
@@ -4273,7 +4273,7 @@ function Oa() {
4273
4273
  try {
4274
4274
  this.socket = this.hooks.getSocket(t, this.options);
4275
4275
  } catch (s) {
4276
- return oe.defer(() => {
4276
+ return re.defer(() => {
4277
4277
  this.onError(s), this.changeState("closed");
4278
4278
  }), !1;
4279
4279
  }
@@ -4283,7 +4283,7 @@ function Oa() {
4283
4283
  return this.socket ? (this.socket.close(), !0) : !1;
4284
4284
  }
4285
4285
  send(t) {
4286
- return this.state === "open" ? (oe.defer(() => {
4286
+ return this.state === "open" ? (re.defer(() => {
4287
4287
  this.socket && this.socket.send(t);
4288
4288
  }), !0) : !1;
4289
4289
  }
@@ -4335,7 +4335,7 @@ function Oa() {
4335
4335
  return ve({ cid: this.id }, t);
4336
4336
  }
4337
4337
  }
4338
- class De {
4338
+ class Ne {
4339
4339
  constructor(t) {
4340
4340
  this.hooks = t;
4341
4341
  }
@@ -4346,7 +4346,7 @@ function Oa() {
4346
4346
  return new tr(this.hooks, t, s, a, l);
4347
4347
  }
4348
4348
  }
4349
- var nr = new De({
4349
+ var nr = new Ne({
4350
4350
  urls: Qs,
4351
4351
  handlesActivityChecks: !1,
4352
4352
  supportsPing: !1,
@@ -4359,30 +4359,30 @@ function Oa() {
4359
4359
  getSocket: function(i) {
4360
4360
  return j.createWebSocket(i);
4361
4361
  }
4362
- }), sn = {
4362
+ }), on = {
4363
4363
  urls: Ys,
4364
4364
  handlesActivityChecks: !1,
4365
4365
  supportsPing: !0,
4366
4366
  isInitialized: function() {
4367
4367
  return !0;
4368
4368
  }
4369
- }, rn = ve({
4369
+ }, an = ve({
4370
4370
  getSocket: function(i) {
4371
4371
  return j.HTTPFactory.createStreamingSocket(i);
4372
4372
  }
4373
- }, sn), on = ve({
4373
+ }, on), cn = ve({
4374
4374
  getSocket: function(i) {
4375
4375
  return j.HTTPFactory.createPollingSocket(i);
4376
4376
  }
4377
- }, sn), an = {
4377
+ }, on), un = {
4378
4378
  isSupported: function() {
4379
4379
  return j.isXHRSupported();
4380
4380
  }
4381
- }, sr = new De(ve({}, rn, an)), rr = new De(ve({}, on, an)), ir = {
4381
+ }, sr = new Ne(ve({}, an, un)), rr = new Ne(ve({}, cn, un)), ir = {
4382
4382
  ws: nr,
4383
4383
  xhr_streaming: sr,
4384
4384
  xhr_polling: rr
4385
- }, Ye = ir, or = new De({
4385
+ }, tt = ir, or = new Ne({
4386
4386
  file: "sockjs",
4387
4387
  urls: Zs,
4388
4388
  handlesActivityChecks: !0,
@@ -4406,15 +4406,15 @@ function Oa() {
4406
4406
  path: t
4407
4407
  }));
4408
4408
  }
4409
- }), cn = {
4409
+ }), ln = {
4410
4410
  isSupported: function(i) {
4411
4411
  var t = j.isXDRSupported(i.useTLS);
4412
4412
  return t;
4413
4413
  }
4414
- }, ar = new De(ve({}, rn, cn)), cr = new De(ve({}, on, cn));
4415
- Ye.xdr_streaming = ar, Ye.xdr_polling = cr, Ye.sockjs = or;
4416
- var ur = Ye;
4417
- class lr extends Te {
4414
+ }, ar = new Ne(ve({}, an, ln)), cr = new Ne(ve({}, cn, ln));
4415
+ tt.xdr_streaming = ar, tt.xdr_polling = cr, tt.sockjs = or;
4416
+ var ur = tt;
4417
+ class lr extends Re {
4418
4418
  constructor() {
4419
4419
  super();
4420
4420
  var t = this;
@@ -4438,12 +4438,12 @@ function Oa() {
4438
4438
  activityTimeout: this.pingDelay
4439
4439
  });
4440
4440
  var g = this.transport.createConnection(t, s, a, l), S = null, L = function() {
4441
- g.unbind("open", L), g.bind("closed", z), S = oe.now();
4441
+ g.unbind("open", L), g.bind("closed", z), S = re.now();
4442
4442
  }, z = (Q) => {
4443
4443
  if (g.unbind("closed", z), Q.code === 1002 || Q.code === 1003)
4444
4444
  this.manager.reportDeath();
4445
4445
  else if (!Q.wasClean && S) {
4446
- var ee = oe.now() - S;
4446
+ var ee = re.now() - S;
4447
4447
  ee < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(ee / 2, this.minPingDelay));
4448
4448
  }
4449
4449
  };
@@ -4453,7 +4453,7 @@ function Oa() {
4453
4453
  return this.manager.isAlive() && this.transport.isSupported(t);
4454
4454
  }
4455
4455
  }
4456
- const un = {
4456
+ const dn = {
4457
4457
  decodeMessage: function(i) {
4458
4458
  try {
4459
4459
  var t = JSON.parse(i.data), s = t.data;
@@ -4476,7 +4476,7 @@ function Oa() {
4476
4476
  return JSON.stringify(i);
4477
4477
  },
4478
4478
  processHandshake: function(i) {
4479
- var t = un.decodeMessage(i);
4479
+ var t = dn.decodeMessage(i);
4480
4480
  if (t.event === "pusher:connection_established") {
4481
4481
  if (!t.data.activity_timeout)
4482
4482
  throw "No activity timeout specified in handshake";
@@ -4507,8 +4507,8 @@ function Oa() {
4507
4507
  } : null;
4508
4508
  }
4509
4509
  };
4510
- var Ie = un;
4511
- class fr extends Te {
4510
+ var Ue = dn;
4511
+ class fr extends Re {
4512
4512
  constructor(t, s) {
4513
4513
  super(), this.id = t, this.transport = s, this.activityTimeout = s.activityTimeout, this.bindListeners();
4514
4514
  }
@@ -4520,7 +4520,7 @@ function Oa() {
4520
4520
  }
4521
4521
  send_event(t, s, a) {
4522
4522
  var l = { event: t, data: s };
4523
- return a && (l.channel = a), ce.debug("Event sent", l), this.send(Ie.encodeMessage(l));
4523
+ return a && (l.channel = a), ce.debug("Event sent", l), this.send(Ue.encodeMessage(l));
4524
4524
  }
4525
4525
  ping() {
4526
4526
  this.transport.supportsPing() ? this.transport.ping() : this.send_event("pusher:ping", {});
@@ -4533,7 +4533,7 @@ function Oa() {
4533
4533
  message: (a) => {
4534
4534
  var l;
4535
4535
  try {
4536
- l = Ie.decodeMessage(a);
4536
+ l = Ue.decodeMessage(a);
4537
4537
  } catch (g) {
4538
4538
  this.emit("error", {
4539
4539
  type: "MessageParseError",
@@ -4569,16 +4569,16 @@ function Oa() {
4569
4569
  s(), a && a.code && this.handleCloseEvent(a), this.transport = null, this.emit("closed");
4570
4570
  }
4571
4571
  }, s = () => {
4572
- T(t, (a, l) => {
4572
+ we(t, (a, l) => {
4573
4573
  this.transport.unbind(l, a);
4574
4574
  });
4575
4575
  };
4576
- T(t, (a, l) => {
4576
+ we(t, (a, l) => {
4577
4577
  this.transport.bind(l, a);
4578
4578
  });
4579
4579
  }
4580
4580
  handleCloseEvent(t) {
4581
- var s = Ie.getCloseAction(t), a = Ie.getCloseError(t);
4581
+ var s = Ue.getCloseAction(t), a = Ue.getCloseError(t);
4582
4582
  a && this.emit("error", a), s && this.emit(s, { action: s, error: a });
4583
4583
  }
4584
4584
  }
@@ -4594,7 +4594,7 @@ function Oa() {
4594
4594
  this.unbindListeners();
4595
4595
  var s;
4596
4596
  try {
4597
- s = Ie.processHandshake(t);
4597
+ s = Ue.processHandshake(t);
4598
4598
  } catch (a) {
4599
4599
  this.finish("error", { error: a }), this.transport.close();
4600
4600
  return;
@@ -4605,7 +4605,7 @@ function Oa() {
4605
4605
  }) : (this.finish(s.action, { error: s.error }), this.transport.close());
4606
4606
  }, this.onClosed = (t) => {
4607
4607
  this.unbindListeners();
4608
- var s = Ie.getCloseAction(t) || "backoff", a = Ie.getCloseError(t);
4608
+ var s = Ue.getCloseAction(t) || "backoff", a = Ue.getCloseError(t);
4609
4609
  this.finish(s, { error: a });
4610
4610
  }, this.transport.bind("message", this.onMessage), this.transport.bind("closed", this.onClosed);
4611
4611
  }
@@ -4624,7 +4624,7 @@ function Oa() {
4624
4624
  this.timeline.isEmpty() || this.timeline.send(j.TimelineTransport.getAgent(this, t), s);
4625
4625
  }
4626
4626
  }
4627
- class gt extends Te {
4627
+ class bt extends Re {
4628
4628
  constructor(t, s) {
4629
4629
  super(function(a, l) {
4630
4630
  ce.debug("No callbacks on " + t + " for " + a);
@@ -4686,7 +4686,7 @@ function Oa() {
4686
4686
  this.subscriptionCancelled = !1;
4687
4687
  }
4688
4688
  }
4689
- class mt extends gt {
4689
+ class yt extends bt {
4690
4690
  authorize(t, s) {
4691
4691
  return this.pusher.config.channelAuthorizer({
4692
4692
  channelName: this.name,
@@ -4705,7 +4705,7 @@ function Oa() {
4705
4705
  } : null;
4706
4706
  }
4707
4707
  each(t) {
4708
- T(this.members, (s, a) => {
4708
+ we(this.members, (s, a) => {
4709
4709
  t(this.get(a));
4710
4710
  });
4711
4711
  }
@@ -4753,7 +4753,7 @@ function Oa() {
4753
4753
  Q((a = a.apply(i, t || [])).next());
4754
4754
  });
4755
4755
  };
4756
- class br extends mt {
4756
+ class br extends yt {
4757
4757
  constructor(t, s) {
4758
4758
  super(t, s), this.members = new mr();
4759
4759
  }
@@ -4808,8 +4808,8 @@ function Oa() {
4808
4808
  this.members.reset(), super.disconnect();
4809
4809
  }
4810
4810
  }
4811
- var yr = c(1), vt = c(0);
4812
- class _r extends mt {
4811
+ var yr = c(1), _t = c(0);
4812
+ class _r extends yt {
4813
4813
  constructor(t, s, a) {
4814
4814
  super(t, s), this.key = null, this.nacl = a;
4815
4815
  }
@@ -4824,7 +4824,7 @@ function Oa() {
4824
4824
  s(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`), null);
4825
4825
  return;
4826
4826
  }
4827
- this.key = Object(vt.decode)(g), delete l.shared_secret, s(null, l);
4827
+ this.key = Object(_t.decode)(g), delete l.shared_secret, s(null, l);
4828
4828
  });
4829
4829
  }
4830
4830
  trigger(t, s) {
@@ -4847,12 +4847,12 @@ function Oa() {
4847
4847
  ce.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: " + s);
4848
4848
  return;
4849
4849
  }
4850
- let a = Object(vt.decode)(s.ciphertext);
4850
+ let a = Object(_t.decode)(s.ciphertext);
4851
4851
  if (a.length < this.nacl.secretbox.overheadLength) {
4852
4852
  ce.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${a.length}`);
4853
4853
  return;
4854
4854
  }
4855
- let l = Object(vt.decode)(s.nonce);
4855
+ let l = Object(_t.decode)(s.nonce);
4856
4856
  if (l.length < this.nacl.secretbox.nonceLength) {
4857
4857
  ce.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${l.length}`);
4858
4858
  return;
@@ -4883,7 +4883,7 @@ function Oa() {
4883
4883
  }
4884
4884
  }
4885
4885
  }
4886
- class Sr extends Te {
4886
+ class Sr extends Re {
4887
4887
  constructor(t, s) {
4888
4888
  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);
4889
4889
  var a = j.getNetwork();
@@ -4940,7 +4940,7 @@ function Oa() {
4940
4940
  });
4941
4941
  }
4942
4942
  retryIn(t) {
4943
- this.timeline.info({ action: "retry", delay: t }), t > 0 && this.emit("connecting_in", Math.round(t / 1e3)), this.retryTimer = new U(t || 0, () => {
4943
+ this.timeline.info({ action: "retry", delay: t }), t > 0 && this.emit("connecting_in", Math.round(t / 1e3)), this.retryTimer = new O(t || 0, () => {
4944
4944
  this.disconnectInternally(), this.connect();
4945
4945
  });
4946
4946
  }
@@ -4948,7 +4948,7 @@ function Oa() {
4948
4948
  this.retryTimer && (this.retryTimer.ensureAborted(), this.retryTimer = null);
4949
4949
  }
4950
4950
  setUnavailableTimer() {
4951
- this.unavailableTimer = new U(this.options.unavailableTimeout, () => {
4951
+ this.unavailableTimer = new O(this.options.unavailableTimeout, () => {
4952
4952
  this.updateState("unavailable");
4953
4953
  });
4954
4954
  }
@@ -4956,12 +4956,12 @@ function Oa() {
4956
4956
  this.unavailableTimer && this.unavailableTimer.ensureAborted();
4957
4957
  }
4958
4958
  sendActivityCheck() {
4959
- this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new U(this.options.pongTimeout, () => {
4959
+ this.stopActivityCheck(), this.connection.ping(), this.activityTimer = new O(this.options.pongTimeout, () => {
4960
4960
  this.timeline.error({ pong_timed_out: this.options.pongTimeout }), this.retryIn(0);
4961
4961
  });
4962
4962
  }
4963
4963
  resetActivityCheck() {
4964
- this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new U(this.activityTimeout, () => {
4964
+ this.stopActivityCheck(), this.connection && !this.connection.handlesActivityChecks() && (this.activityTimer = new O(this.activityTimeout, () => {
4965
4965
  this.sendActivityCheck();
4966
4966
  }));
4967
4967
  }
@@ -5047,7 +5047,7 @@ function Oa() {
5047
5047
  return this.channels[t] || (this.channels[t] = wr(t, s)), this.channels[t];
5048
5048
  }
5049
5049
  all() {
5050
- return D(this.channels);
5050
+ return A(this.channels);
5051
5051
  }
5052
5052
  find(t) {
5053
5053
  return this.channels[t];
@@ -5057,7 +5057,7 @@ function Oa() {
5057
5057
  return delete this.channels[t], s;
5058
5058
  }
5059
5059
  disconnect() {
5060
- T(this.channels, function(t) {
5060
+ we(this.channels, function(t) {
5061
5061
  t.disconnect();
5062
5062
  });
5063
5063
  }
@@ -5065,17 +5065,17 @@ function Oa() {
5065
5065
  function wr(i, t) {
5066
5066
  if (i.indexOf("private-encrypted-") === 0) {
5067
5067
  if (t.config.nacl)
5068
- return Ee.createEncryptedChannel(i, t, t.config.nacl);
5068
+ return Ae.createEncryptedChannel(i, t, t.config.nacl);
5069
5069
  let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a = R.buildLogSuffix("encryptedChannelSupport");
5070
5070
  throw new J(`${s}. ${a}`);
5071
5071
  } else {
5072
5072
  if (i.indexOf("private-") === 0)
5073
- return Ee.createPrivateChannel(i, t);
5073
+ return Ae.createPrivateChannel(i, t);
5074
5074
  if (i.indexOf("presence-") === 0)
5075
- return Ee.createPresenceChannel(i, t);
5075
+ return Ae.createPresenceChannel(i, t);
5076
5076
  if (i.indexOf("#") === 0)
5077
5077
  throw new m('Cannot create a channel with name "' + i + '".');
5078
- return Ee.createChannel(i, t);
5078
+ return Ae.createChannel(i, t);
5079
5079
  }
5080
5080
  }
5081
5081
  var Tr = {
@@ -5086,10 +5086,10 @@ function Oa() {
5086
5086
  return new Sr(i, t);
5087
5087
  },
5088
5088
  createChannel(i, t) {
5089
- return new gt(i, t);
5089
+ return new bt(i, t);
5090
5090
  },
5091
5091
  createPrivateChannel(i, t) {
5092
- return new mt(i, t);
5092
+ return new yt(i, t);
5093
5093
  },
5094
5094
  createPresenceChannel(i, t) {
5095
5095
  return new br(i, t);
@@ -5106,13 +5106,13 @@ function Oa() {
5106
5106
  createAssistantToTheTransportManager(i, t, s) {
5107
5107
  return new hr(i, t, s);
5108
5108
  }
5109
- }, Ee = Tr;
5110
- class ln {
5109
+ }, Ae = Tr;
5110
+ class hn {
5111
5111
  constructor(t) {
5112
5112
  this.options = t || {}, this.livesLeft = this.options.lives || 1 / 0;
5113
5113
  }
5114
5114
  getAssistant(t) {
5115
- return Ee.createAssistantToTheTransportManager(this, t, {
5115
+ return Ae.createAssistantToTheTransportManager(this, t, {
5116
5116
  minPingDelay: this.options.minPingDelay,
5117
5117
  maxPingDelay: this.options.maxPingDelay
5118
5118
  });
@@ -5124,12 +5124,12 @@ function Oa() {
5124
5124
  this.livesLeft -= 1;
5125
5125
  }
5126
5126
  }
5127
- class Ue {
5127
+ class Oe {
5128
5128
  constructor(t, s) {
5129
5129
  this.strategies = t, this.loop = !!s.loop, this.failFast = !!s.failFast, this.timeout = s.timeout, this.timeoutLimit = s.timeoutLimit;
5130
5130
  }
5131
5131
  isSupported() {
5132
- return we(this.strategies, oe.method("isSupported"));
5132
+ return Me(this.strategies, re.method("isSupported"));
5133
5133
  }
5134
5134
  connect(t, s) {
5135
5135
  var a = this.strategies, l = 0, g = this.timeout, S = null, L = (z, Q) => {
@@ -5146,7 +5146,7 @@ function Oa() {
5146
5146
  }
5147
5147
  tryStrategy(t, s, a, l) {
5148
5148
  var g = null, S = null;
5149
- return a.timeout > 0 && (g = new U(a.timeout, function() {
5149
+ return a.timeout > 0 && (g = new O(a.timeout, function() {
5150
5150
  S.abort(), l(!0);
5151
5151
  })), S = t.connect(s, function(L, z) {
5152
5152
  L && g && g.isRunning() && !a.failFast || (g && g.ensureAborted(), l(L, z));
@@ -5160,12 +5160,12 @@ function Oa() {
5160
5160
  };
5161
5161
  }
5162
5162
  }
5163
- class bt {
5163
+ class St {
5164
5164
  constructor(t) {
5165
5165
  this.strategies = t;
5166
5166
  }
5167
5167
  isSupported() {
5168
- return we(this.strategies, oe.method("isSupported"));
5168
+ return Me(this.strategies, re.method("isSupported"));
5169
5169
  }
5170
5170
  connect(t, s) {
5171
5171
  return Er(this.strategies, t, function(a, l) {
@@ -5174,7 +5174,7 @@ function Oa() {
5174
5174
  Rr(l) && s(!0);
5175
5175
  return;
5176
5176
  }
5177
- O(l, function(L) {
5177
+ U(l, function(L) {
5178
5178
  L.forceMinPriority(S.transport.priority);
5179
5179
  }), s(null, S);
5180
5180
  };
@@ -5182,22 +5182,22 @@ function Oa() {
5182
5182
  }
5183
5183
  }
5184
5184
  function Er(i, t, s) {
5185
- var a = se(i, function(l, g, S, L) {
5185
+ var a = D(i, function(l, g, S, L) {
5186
5186
  return l.connect(t, s(g, L));
5187
5187
  });
5188
5188
  return {
5189
5189
  abort: function() {
5190
- O(a, Ar);
5190
+ U(a, Ar);
5191
5191
  },
5192
5192
  forceMinPriority: function(l) {
5193
- O(a, function(g) {
5193
+ U(a, function(g) {
5194
5194
  g.forceMinPriority(l);
5195
5195
  });
5196
5196
  }
5197
5197
  };
5198
5198
  }
5199
5199
  function Rr(i) {
5200
- return ge(i, function(t) {
5200
+ return Ze(i, function(t) {
5201
5201
  return !!t.error;
5202
5202
  });
5203
5203
  }
@@ -5213,19 +5213,19 @@ function Oa() {
5213
5213
  }
5214
5214
  connect(t, s) {
5215
5215
  var a = this.usingTLS, l = Mr(a), g = l && l.cacheSkipCount ? l.cacheSkipCount : 0, S = [this.strategy];
5216
- if (l && l.timestamp + this.ttl >= oe.now()) {
5216
+ if (l && l.timestamp + this.ttl >= re.now()) {
5217
5217
  var L = this.transports[l.transport];
5218
5218
  L && (["ws", "wss"].includes(l.transport) || g > 3 ? (this.timeline.info({
5219
5219
  cached: !0,
5220
5220
  transport: l.transport,
5221
5221
  latency: l.latency
5222
- }), S.push(new Ue([L], {
5222
+ }), S.push(new Oe([L], {
5223
5223
  timeout: l.latency * 2 + 1e3,
5224
5224
  failFast: !0
5225
5225
  }))) : g++);
5226
5226
  }
5227
- var z = oe.now(), Q = S.pop().connect(t, function ee(de, tt) {
5228
- de ? (dn(a), S.length > 0 ? (z = oe.now(), Q = S.pop().connect(t, ee)) : s(de)) : (kr(a, tt.transport.name, oe.now() - z, g), s(null, tt));
5227
+ var z = re.now(), Q = S.pop().connect(t, function ee(de, rt) {
5228
+ de ? (fn(a), S.length > 0 ? (z = re.now(), Q = S.pop().connect(t, ee)) : s(de)) : (kr(a, rt.transport.name, re.now() - z, g), s(null, rt));
5229
5229
  });
5230
5230
  return {
5231
5231
  abort: function() {
@@ -5237,18 +5237,18 @@ function Oa() {
5237
5237
  };
5238
5238
  }
5239
5239
  }
5240
- function yt(i) {
5240
+ function Ct(i) {
5241
5241
  return "pusherTransport" + (i ? "TLS" : "NonTLS");
5242
5242
  }
5243
5243
  function Mr(i) {
5244
5244
  var t = j.getLocalStorage();
5245
5245
  if (t)
5246
5246
  try {
5247
- var s = t[yt(i)];
5247
+ var s = t[Ct(i)];
5248
5248
  if (s)
5249
5249
  return JSON.parse(s);
5250
5250
  } catch {
5251
- dn(i);
5251
+ fn(i);
5252
5252
  }
5253
5253
  return null;
5254
5254
  }
@@ -5256,8 +5256,8 @@ function Oa() {
5256
5256
  var l = j.getLocalStorage();
5257
5257
  if (l)
5258
5258
  try {
5259
- l[yt(i)] = Qe({
5260
- timestamp: oe.now(),
5259
+ l[Ct(i)] = et({
5260
+ timestamp: re.now(),
5261
5261
  transport: t,
5262
5262
  latency: s,
5263
5263
  cacheSkipCount: a
@@ -5265,15 +5265,15 @@ function Oa() {
5265
5265
  } catch {
5266
5266
  }
5267
5267
  }
5268
- function dn(i) {
5268
+ function fn(i) {
5269
5269
  var t = j.getLocalStorage();
5270
5270
  if (t)
5271
5271
  try {
5272
- delete t[yt(i)];
5272
+ delete t[Ct(i)];
5273
5273
  } catch {
5274
5274
  }
5275
5275
  }
5276
- class Ze {
5276
+ class nt {
5277
5277
  constructor(t, { delay: s }) {
5278
5278
  this.strategy = t, this.options = { delay: s };
5279
5279
  }
@@ -5281,7 +5281,7 @@ function Oa() {
5281
5281
  return this.strategy.isSupported();
5282
5282
  }
5283
5283
  connect(t, s) {
5284
- var a = this.strategy, l, g = new U(this.options.delay, function() {
5284
+ var a = this.strategy, l, g = new O(this.options.delay, function() {
5285
5285
  l = a.connect(t, s);
5286
5286
  });
5287
5287
  return {
@@ -5294,7 +5294,7 @@ function Oa() {
5294
5294
  };
5295
5295
  }
5296
5296
  }
5297
- class ze {
5297
+ class je {
5298
5298
  constructor(t, s, a) {
5299
5299
  this.test = t, this.trueBranch = s, this.falseBranch = a;
5300
5300
  }
@@ -5321,16 +5321,16 @@ function Oa() {
5321
5321
  return a;
5322
5322
  }
5323
5323
  }
5324
- function je(i) {
5324
+ function $e(i) {
5325
5325
  return function() {
5326
5326
  return i.isSupported();
5327
5327
  };
5328
5328
  }
5329
5329
  var Lr = function(i, t, s) {
5330
5330
  var a = {};
5331
- function l(Cn, xi, Li, Ii, Ui) {
5332
- var wn = s(i, Cn, xi, Li, Ii, Ui);
5333
- return a[Cn] = wn, wn;
5331
+ function l(Tn, xi, Li, Ii, Ui) {
5332
+ var En = s(i, Tn, xi, Li, Ii, Ui);
5333
+ return a[Tn] = En, En;
5334
5334
  }
5335
5335
  var g = Object.assign({}, t, {
5336
5336
  hostNonTLS: i.wsHost + ":" + i.wsPort,
@@ -5346,31 +5346,31 @@ function Oa() {
5346
5346
  loop: !0,
5347
5347
  timeout: 15e3,
5348
5348
  timeoutLimit: 6e4
5349
- }, Q = new ln({
5349
+ }, Q = new hn({
5350
5350
  minPingDelay: 1e4,
5351
5351
  maxPingDelay: i.activityTimeout
5352
- }), ee = new ln({
5352
+ }), ee = new hn({
5353
5353
  lives: 2,
5354
5354
  minPingDelay: 1e4,
5355
5355
  maxPingDelay: i.activityTimeout
5356
- }), de = l("ws", "ws", 3, g, Q), tt = l("wss", "ws", 3, S, Q), Ri = l("sockjs", "sockjs", 1, L), mn = l("xhr_streaming", "xhr_streaming", 1, L, ee), Ai = l("xdr_streaming", "xdr_streaming", 1, L, ee), vn = l("xhr_polling", "xhr_polling", 1, L), Pi = l("xdr_polling", "xdr_polling", 1, L), bn = new Ue([de], z), Mi = new Ue([tt], z), ki = new Ue([Ri], z), yn = new Ue([
5357
- new ze(je(mn), mn, Ai)
5358
- ], z), _n = new Ue([
5359
- new ze(je(vn), vn, Pi)
5360
- ], z), Sn = new Ue([
5361
- new ze(je(yn), new bt([
5362
- yn,
5363
- new Ze(_n, { delay: 4e3 })
5364
- ]), _n)
5365
- ], z), wt = new ze(je(Sn), Sn, ki), Tt;
5366
- return t.useTLS ? Tt = new bt([
5367
- bn,
5368
- new Ze(wt, { delay: 2e3 })
5369
- ]) : Tt = new bt([
5370
- bn,
5371
- new Ze(Mi, { delay: 2e3 }),
5372
- new Ze(wt, { delay: 5e3 })
5373
- ]), new Pr(new xr(new ze(je(de), Tt, wt)), a, {
5356
+ }), de = l("ws", "ws", 3, g, Q), rt = l("wss", "ws", 3, S, Q), Ri = l("sockjs", "sockjs", 1, L), bn = l("xhr_streaming", "xhr_streaming", 1, L, ee), Ai = l("xdr_streaming", "xdr_streaming", 1, L, ee), yn = l("xhr_polling", "xhr_polling", 1, L), Pi = l("xdr_polling", "xdr_polling", 1, L), _n = new Oe([de], z), Mi = new Oe([rt], z), ki = new Oe([Ri], z), Sn = new Oe([
5357
+ new je($e(bn), bn, Ai)
5358
+ ], z), Cn = new Oe([
5359
+ new je($e(yn), yn, Pi)
5360
+ ], z), wn = new Oe([
5361
+ new je($e(Sn), new St([
5362
+ Sn,
5363
+ new nt(Cn, { delay: 4e3 })
5364
+ ]), Cn)
5365
+ ], z), Rt = new je($e(wn), wn, ki), At;
5366
+ return t.useTLS ? At = new St([
5367
+ _n,
5368
+ new nt(Rt, { delay: 2e3 })
5369
+ ]) : At = new St([
5370
+ _n,
5371
+ new nt(Mi, { delay: 2e3 }),
5372
+ new nt(Rt, { delay: 5e3 })
5373
+ ]), new Pr(new xr(new je($e(de), At, Rt)), a, {
5374
5374
  ttl: 18e5,
5375
5375
  timeline: t.timeline,
5376
5376
  useTLS: t.useTLS
@@ -5400,7 +5400,7 @@ function Oa() {
5400
5400
  }
5401
5401
  }, Fr = Or;
5402
5402
  const Dr = 256 * 1024;
5403
- class Nr extends Te {
5403
+ class Nr extends Re {
5404
5404
  constructor(t, s, a) {
5405
5405
  super(), this.hooks = t, this.method = s, this.url = a;
5406
5406
  }
@@ -5431,14 +5431,14 @@ function Oa() {
5431
5431
  return this.position === t.length && t.length > Dr;
5432
5432
  }
5433
5433
  }
5434
- var _t;
5434
+ var wt;
5435
5435
  (function(i) {
5436
5436
  i[i.CONNECTING = 0] = "CONNECTING", i[i.OPEN = 1] = "OPEN", i[i.CLOSED = 3] = "CLOSED";
5437
- })(_t || (_t = {}));
5438
- var Oe = _t, qr = 1;
5437
+ })(wt || (wt = {}));
5438
+ var Fe = wt, qr = 1;
5439
5439
  class zr {
5440
5440
  constructor(t, s) {
5441
- this.hooks = t, this.session = fn(1e3) + "/" + Br(8), this.location = jr(s), this.readyState = Oe.CONNECTING, this.openStream();
5441
+ this.hooks = t, this.session = gn(1e3) + "/" + Br(8), this.location = jr(s), this.readyState = Fe.CONNECTING, this.openStream();
5442
5442
  }
5443
5443
  send(t) {
5444
5444
  return this.sendRaw(JSON.stringify([t]));
@@ -5450,9 +5450,9 @@ function Oa() {
5450
5450
  this.onClose(t, s, !0);
5451
5451
  }
5452
5452
  sendRaw(t) {
5453
- if (this.readyState === Oe.OPEN)
5453
+ if (this.readyState === Fe.OPEN)
5454
5454
  try {
5455
- return j.createSocketRequest("POST", hn($r(this.location, this.session))).start(t), !0;
5455
+ return j.createSocketRequest("POST", pn($r(this.location, this.session))).start(t), !0;
5456
5456
  } catch {
5457
5457
  return !1;
5458
5458
  }
@@ -5463,7 +5463,7 @@ function Oa() {
5463
5463
  this.closeStream(), this.openStream();
5464
5464
  }
5465
5465
  onClose(t, s, a) {
5466
- this.closeStream(), this.readyState = Oe.CLOSED, this.onclose && this.onclose({
5466
+ this.closeStream(), this.readyState = Fe.CLOSED, this.onclose && this.onclose({
5467
5467
  code: t,
5468
5468
  reason: s,
5469
5469
  wasClean: a
@@ -5471,7 +5471,7 @@ function Oa() {
5471
5471
  }
5472
5472
  onChunk(t) {
5473
5473
  if (t.status === 200) {
5474
- this.readyState === Oe.OPEN && this.onActivity();
5474
+ this.readyState === Fe.OPEN && this.onActivity();
5475
5475
  var s, a = t.data.slice(0, 1);
5476
5476
  switch (a) {
5477
5477
  case "o":
@@ -5495,10 +5495,10 @@ function Oa() {
5495
5495
  }
5496
5496
  }
5497
5497
  onOpen(t) {
5498
- this.readyState === Oe.CONNECTING ? (t && t.hostname && (this.location.base = Hr(this.location.base, t.hostname)), this.readyState = Oe.OPEN, this.onopen && this.onopen()) : this.onClose(1006, "Server lost session", !0);
5498
+ this.readyState === Fe.CONNECTING ? (t && t.hostname && (this.location.base = Hr(this.location.base, t.hostname)), this.readyState = Fe.OPEN, this.onopen && this.onopen()) : this.onClose(1006, "Server lost session", !0);
5499
5499
  }
5500
5500
  onEvent(t) {
5501
- this.readyState === Oe.OPEN && this.onmessage && this.onmessage({ data: t });
5501
+ this.readyState === Fe.OPEN && this.onmessage && this.onmessage({ data: t });
5502
5502
  }
5503
5503
  onActivity() {
5504
5504
  this.onactivity && this.onactivity();
@@ -5507,7 +5507,7 @@ function Oa() {
5507
5507
  this.onerror && this.onerror(t);
5508
5508
  }
5509
5509
  openStream() {
5510
- this.stream = j.createSocketRequest("POST", hn(this.hooks.getReceiveURL(this.location, this.session))), this.stream.bind("chunk", (t) => {
5510
+ this.stream = j.createSocketRequest("POST", pn(this.hooks.getReceiveURL(this.location, this.session))), this.stream.bind("chunk", (t) => {
5511
5511
  this.onChunk(t);
5512
5512
  }), this.stream.bind("finished", (t) => {
5513
5513
  this.hooks.onFinished(this, t);
@@ -5517,7 +5517,7 @@ function Oa() {
5517
5517
  try {
5518
5518
  this.stream.start();
5519
5519
  } catch (t) {
5520
- oe.defer(() => {
5520
+ re.defer(() => {
5521
5521
  this.onError(t), this.onClose(1006, "Could not start streaming", !1);
5522
5522
  });
5523
5523
  }
@@ -5536,7 +5536,7 @@ function Oa() {
5536
5536
  function $r(i, t) {
5537
5537
  return i.base + "/" + t + "/xhr_send";
5538
5538
  }
5539
- function hn(i) {
5539
+ function pn(i) {
5540
5540
  var t = i.indexOf("?") === -1 ? "?" : "&";
5541
5541
  return i + t + "t=" + +/* @__PURE__ */ new Date() + "&n=" + qr++;
5542
5542
  }
@@ -5544,12 +5544,12 @@ function Oa() {
5544
5544
  var s = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(i);
5545
5545
  return s[1] + t + s[3];
5546
5546
  }
5547
- function fn(i) {
5547
+ function gn(i) {
5548
5548
  return j.randomInt(i);
5549
5549
  }
5550
5550
  function Br(i) {
5551
5551
  for (var t = [], s = 0; s < i; s++)
5552
- t.push(fn(32).toString(32));
5552
+ t.push(gn(32).toString(32));
5553
5553
  return t.join("");
5554
5554
  }
5555
5555
  var Vr = zr, Xr = {
@@ -5610,11 +5610,11 @@ function Oa() {
5610
5610
  createRequest(i, t, s) {
5611
5611
  return new Nr(i, t, s);
5612
5612
  }
5613
- }, pn = Yr;
5614
- pn.createXDR = function(i, t) {
5613
+ }, mn = Yr;
5614
+ mn.createXDR = function(i, t) {
5615
5615
  return this.createRequest(Fr, i, t);
5616
5616
  };
5617
- var Zr = pn, ei = {
5617
+ var Zr = mn, ei = {
5618
5618
  nextAuthCallbackID: 1,
5619
5619
  auth_callbacks: {},
5620
5620
  ScriptReceivers: d,
@@ -5707,26 +5707,26 @@ function Oa() {
5707
5707
  return (window.crypto || window.msCrypto).getRandomValues(new Uint32Array(1))[0] / Math.pow(2, 32);
5708
5708
  }() * i);
5709
5709
  }
5710
- }, j = ei, St;
5710
+ }, j = ei, Tt;
5711
5711
  (function(i) {
5712
5712
  i[i.ERROR = 3] = "ERROR", i[i.INFO = 6] = "INFO", i[i.DEBUG = 7] = "DEBUG";
5713
- })(St || (St = {}));
5714
- var et = St;
5713
+ })(Tt || (Tt = {}));
5714
+ var st = Tt;
5715
5715
  class ti {
5716
5716
  constructor(t, s, a) {
5717
5717
  this.key = t, this.session = s, this.events = [], this.options = a || {}, this.sent = 0, this.uniqueID = 0;
5718
5718
  }
5719
5719
  log(t, s) {
5720
- t <= this.options.level && (this.events.push(ve({}, s, { timestamp: oe.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
5720
+ t <= this.options.level && (this.events.push(ve({}, s, { timestamp: re.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
5721
5721
  }
5722
5722
  error(t) {
5723
- this.log(et.ERROR, t);
5723
+ this.log(st.ERROR, t);
5724
5724
  }
5725
5725
  info(t) {
5726
- this.log(et.INFO, t);
5726
+ this.log(st.INFO, t);
5727
5727
  }
5728
5728
  debug(t) {
5729
- this.log(et.DEBUG, t);
5729
+ this.log(st.DEBUG, t);
5730
5730
  }
5731
5731
  isEmpty() {
5732
5732
  return this.events.length === 0;
@@ -5762,12 +5762,12 @@ function Oa() {
5762
5762
  connect(t, s) {
5763
5763
  if (this.isSupported()) {
5764
5764
  if (this.priority < t)
5765
- return gn(new F(), s);
5766
- } else return gn(new te(), s);
5765
+ return vn(new F(), s);
5766
+ } else return vn(new te(), s);
5767
5767
  var a = !1, l = this.transport.createConnection(this.name, this.priority, this.options.key, this.options), g = null, S = function() {
5768
5768
  l.unbind("initialized", S), l.connect();
5769
5769
  }, L = function() {
5770
- g = Ee.createHandshake(l, function(de) {
5770
+ g = Ae.createHandshake(l, function(de) {
5771
5771
  a = !0, ee(), s(null, de);
5772
5772
  });
5773
5773
  }, z = function(de) {
@@ -5775,7 +5775,7 @@ function Oa() {
5775
5775
  }, Q = function() {
5776
5776
  ee();
5777
5777
  var de;
5778
- de = Qe(l), s(new q(de));
5778
+ de = et(l), s(new q(de));
5779
5779
  }, ee = function() {
5780
5780
  l.unbind("initialized", S), l.unbind("open", L), l.unbind("error", z), l.unbind("closed", Q);
5781
5781
  };
@@ -5789,8 +5789,8 @@ function Oa() {
5789
5789
  };
5790
5790
  }
5791
5791
  }
5792
- function gn(i, t) {
5793
- return oe.defer(function() {
5792
+ function vn(i, t) {
5793
+ return re.defer(function() {
5794
5794
  t(i);
5795
5795
  }), {
5796
5796
  abort: function() {
@@ -5804,14 +5804,14 @@ function Oa() {
5804
5804
  var S = si[s];
5805
5805
  if (!S)
5806
5806
  throw new G(s);
5807
- var L = (!i.enabledTransports || dt(i.enabledTransports, t) !== -1) && (!i.disabledTransports || dt(i.disabledTransports, t) === -1), z;
5807
+ var L = (!i.enabledTransports || Ye(i.enabledTransports, t) !== -1) && (!i.disabledTransports || Ye(i.disabledTransports, t) === -1), z;
5808
5808
  return L ? (l = Object.assign({ ignoreNullOrigin: i.ignoreNullOrigin }, l), z = new ni(t, a, g ? g.getAssistant(S) : S, l)) : z = ii, z;
5809
5809
  }, ii = {
5810
5810
  isSupported: function() {
5811
5811
  return !1;
5812
5812
  },
5813
5813
  connect: function(i, t) {
5814
- var s = oe.defer(function() {
5814
+ var s = re.defer(function() {
5815
5815
  t(new te());
5816
5816
  });
5817
5817
  return {
@@ -5935,7 +5935,7 @@ function Oa() {
5935
5935
  const s = yi(i, t);
5936
5936
  return "customHandler" in s && s.customHandler != null ? s.customHandler : li(s);
5937
5937
  }
5938
- class Si extends Te {
5938
+ class Si extends Re {
5939
5939
  constructor(t) {
5940
5940
  super(function(s, a) {
5941
5941
  ce.debug(`No callbacks on watchlist events for ${s}`);
@@ -5960,7 +5960,7 @@ function Oa() {
5960
5960
  }), resolve: i, reject: t };
5961
5961
  }
5962
5962
  var wi = Ci;
5963
- class Ti extends Te {
5963
+ class Ti extends Re {
5964
5964
  constructor(t) {
5965
5965
  super(function(s, a) {
5966
5966
  ce.debug("No callbacks on user for " + s);
@@ -6005,7 +6005,7 @@ function Oa() {
6005
6005
  const t = (s) => {
6006
6006
  s.subscriptionPending && s.subscriptionCancelled ? s.reinstateSubscription() : !s.subscriptionPending && this.pusher.connection.state === "connected" && s.subscribe();
6007
6007
  };
6008
- this.serverToUserChannel = new gt(`#server-to-user-${this.user_data.id}`, this.pusher), this.serverToUserChannel.bind_global((s, a) => {
6008
+ this.serverToUserChannel = new bt(`#server-to-user-${this.user_data.id}`, this.pusher), this.serverToUserChannel.bind_global((s, a) => {
6009
6009
  s.indexOf("pusher_internal:") === 0 || s.indexOf("pusher:") === 0 || this.emit(s, a);
6010
6010
  }), t(this.serverToUserChannel);
6011
6011
  }
@@ -6030,24 +6030,24 @@ function Oa() {
6030
6030
  me.instances[t].connect();
6031
6031
  }
6032
6032
  static getClientFeatures() {
6033
- return P(Ae({ ws: j.Transports.ws }, function(t) {
6033
+ return E(ue({ ws: j.Transports.ws }, function(t) {
6034
6034
  return t.isSupported({});
6035
6035
  }));
6036
6036
  }
6037
6037
  constructor(t, s) {
6038
- Ei(t), oi(s), this.key = t, this.config = hi(s, this), this.channels = Ee.createChannels(), this.global_emitter = new Te(), this.sessionID = j.randomInt(1e9), this.timeline = new ti(this.key, this.sessionID, {
6038
+ Ei(t), oi(s), this.key = t, this.config = hi(s, this), this.channels = Ae.createChannels(), this.global_emitter = new Re(), this.sessionID = j.randomInt(1e9), this.timeline = new ti(this.key, this.sessionID, {
6039
6039
  cluster: this.config.cluster,
6040
6040
  features: me.getClientFeatures(),
6041
6041
  params: this.config.timelineParams || {},
6042
6042
  limit: 50,
6043
- level: et.INFO,
6043
+ level: st.INFO,
6044
6044
  version: h.VERSION
6045
- }), this.config.enableStats && (this.timelineSender = Ee.createTimelineSender(this.timeline, {
6045
+ }), this.config.enableStats && (this.timelineSender = Ae.createTimelineSender(this.timeline, {
6046
6046
  host: this.config.statsHost,
6047
6047
  path: "/timeline/v2/" + j.TimelineTransport.name
6048
6048
  }));
6049
6049
  var a = (l) => j.getDefaultStrategy(this.config, l, ri);
6050
- this.connection = Ee.createConnectionManager(this.key, {
6050
+ this.connection = Ae.createConnectionManager(this.key, {
6051
6051
  getStrategy: a,
6052
6052
  timeline: this.timeline,
6053
6053
  activityTimeout: this.config.activityTimeout,
@@ -6080,7 +6080,7 @@ function Oa() {
6080
6080
  connect() {
6081
6081
  if (this.connection.connect(), this.timelineSender && !this.timelineSenderTimer) {
6082
6082
  var t = this.connection.isUsingTLS(), s = this.timelineSender;
6083
- this.timelineSenderTimer = new ne(6e4, function() {
6083
+ this.timelineSenderTimer = new se(6e4, function() {
6084
6084
  s.send(t);
6085
6085
  });
6086
6086
  }
@@ -6127,7 +6127,7 @@ function Oa() {
6127
6127
  }
6128
6128
  }
6129
6129
  me.instances = [], me.isReady = !1, me.logToConsole = !1, me.Runtime = j, me.ScriptReceivers = j.ScriptReceivers, me.DependenciesReceivers = j.DependenciesReceivers, me.auth_callbacks = j.auth_callbacks;
6130
- var Ct = o.default = me;
6130
+ var Et = o.default = me;
6131
6131
  function Ei(i) {
6132
6132
  if (i == null)
6133
6133
  throw "You must pass your app key when you instantiate Pusher.";
@@ -6138,23 +6138,23 @@ function Oa() {
6138
6138
  ])
6139
6139
  );
6140
6140
  });
6141
- })(Lt)), Lt.exports;
6141
+ })(Ot)), Ot.exports;
6142
6142
  }
6143
6143
  var Fa = Oa();
6144
6144
  const Da = /* @__PURE__ */ Ua(Fa), Na = "/v1/messenger/bootstrap", qa = 3e4, za = 3e4, ja = 5 * 6e4;
6145
- function ie(e) {
6145
+ function oe(e) {
6146
6146
  return typeof e == "object" && e !== null;
6147
6147
  }
6148
6148
  function pe(e, n) {
6149
6149
  return typeof e[n] == "string";
6150
6150
  }
6151
- function Ce(e, n) {
6151
+ function Te(e, n) {
6152
6152
  const r = e[n];
6153
6153
  if (typeof r != "string" || r.trim() === "")
6154
6154
  throw new Error(`Invalid messenger bootstrap payload: missing string ${n}`);
6155
6155
  return r.trim();
6156
6156
  }
6157
- function Ve(e, n) {
6157
+ function Xe(e, n) {
6158
6158
  const r = e[n];
6159
6159
  if (r == null)
6160
6160
  return null;
@@ -6182,39 +6182,39 @@ function Ba(e) {
6182
6182
  return e.startsWith("/") ? e : `/${e}`;
6183
6183
  }
6184
6184
  function Va(e) {
6185
- const n = ie(e) && ie(e.data) ? e.data : e;
6186
- if (!ie(n))
6185
+ const n = oe(e) && oe(e.data) ? e.data : e;
6186
+ if (!oe(n))
6187
6187
  throw new Error("Invalid messenger bootstrap payload: expected object");
6188
6188
  const r = n.auth, o = n.service;
6189
- if (!ie(r) || !ie(o))
6189
+ if (!oe(r) || !oe(o))
6190
6190
  throw new Error("Invalid messenger bootstrap payload: missing auth or service data");
6191
6191
  const c = r.user, u = o.reverb;
6192
- if (!ie(c) || !ie(u))
6192
+ if (!oe(c) || !oe(u))
6193
6193
  throw new Error("Invalid messenger bootstrap payload: missing user or reverb data");
6194
- const d = Ba(Ve(u, "path"));
6194
+ const d = Ba(Xe(u, "path"));
6195
6195
  return {
6196
6196
  auth: {
6197
- token: Ce(r, "token"),
6198
- tokenType: Ce(r, "token_type"),
6199
- expiresAt: Ve(r, "expires_at"),
6200
- tenantId: Ve(r, "tenant_id"),
6197
+ token: Te(r, "token"),
6198
+ tokenType: Te(r, "token_type"),
6199
+ expiresAt: Xe(r, "expires_at"),
6200
+ tenantId: Xe(r, "tenant_id"),
6201
6201
  user: {
6202
- id: Ce(c, "id"),
6203
- handle: Ce(c, "handle"),
6204
- name: Ce(c, "name"),
6205
- avatarUrl: Ve(c, "avatar_url"),
6206
- email: Ve(c, "email")
6202
+ id: Te(c, "id"),
6203
+ handle: Te(c, "handle"),
6204
+ name: Te(c, "name"),
6205
+ avatarUrl: Xe(c, "avatar_url"),
6206
+ email: Xe(c, "email")
6207
6207
  }
6208
6208
  },
6209
6209
  service: {
6210
- baseUrl: Ce(o, "base_url"),
6211
- apiBaseUrl: Ce(o, "api_base_url"),
6212
- broadcastingAuthUrl: Ce(o, "broadcasting_auth_url"),
6210
+ baseUrl: Te(o, "base_url"),
6211
+ apiBaseUrl: Te(o, "api_base_url"),
6212
+ broadcastingAuthUrl: Te(o, "broadcasting_auth_url"),
6213
6213
  reverb: {
6214
- appKey: Ce(u, "app_key"),
6215
- host: Ce(u, "host"),
6214
+ appKey: Te(u, "app_key"),
6215
+ host: Te(u, "host"),
6216
6216
  port: $a(u, "port"),
6217
- scheme: Ha(Ce(u, "scheme")),
6217
+ scheme: Ha(Te(u, "scheme")),
6218
6218
  ...d ? { path: d } : {}
6219
6219
  }
6220
6220
  }
@@ -6224,28 +6224,28 @@ function Xa(e) {
6224
6224
  return e.replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/:\d+$/, "");
6225
6225
  }
6226
6226
  function Wa(e) {
6227
- if (!ie(e))
6227
+ if (!oe(e))
6228
6228
  return !1;
6229
- const n = ie(e.response) ? e.response : null;
6229
+ const n = oe(e.response) ? e.response : null;
6230
6230
  if (n?.status !== 403)
6231
6231
  return !1;
6232
6232
  const r = n.data;
6233
6233
  return r?.code === "ACCOUNT_SUSPENDED" || r?.errors?.reason === "account_suspended" ? !0 : typeof r?.message == "string" && r.message.toLowerCase().includes("suspended");
6234
6234
  }
6235
- function Gn(e, n) {
6236
- if (e.headers instanceof Tn) {
6235
+ function Kn(e, n) {
6236
+ if (e.headers instanceof Rn) {
6237
6237
  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"));
6238
6238
  return;
6239
6239
  }
6240
- const r = ie(e.headers) ? e.headers : {};
6241
- e.headers = new Tn({
6240
+ const r = oe(e.headers) ? e.headers : {};
6241
+ e.headers = new Rn({
6242
6242
  ...r,
6243
6243
  Authorization: `Bearer ${n}`,
6244
6244
  Accept: "application/json",
6245
6245
  "X-Requested-With": "XMLHttpRequest"
6246
6246
  }), typeof FormData < "u" && e.data instanceof FormData && (e.headers.delete("Content-Type"), e.headers.delete("content-type"));
6247
6247
  }
6248
- function Ge(e, n, r) {
6248
+ function Je(e, n, r) {
6249
6249
  const o = e[n];
6250
6250
  if (typeof o == "string" && o.trim() !== "")
6251
6251
  return o;
@@ -6259,28 +6259,28 @@ function Ga(e) {
6259
6259
  return n === "online" || n === "idle" || n === "dnd" || n === "offline" ? n : null;
6260
6260
  }
6261
6261
  function Ja(e, n) {
6262
- if (!ie(e))
6262
+ if (!oe(e))
6263
6263
  return null;
6264
- const r = Ge(e, "user_id", "userId"), o = Ga(e.status);
6264
+ const r = Je(e, "user_id", "userId"), o = Ga(e.status);
6265
6265
  if (!r || !o)
6266
6266
  return null;
6267
6267
  const c = {
6268
6268
  user_id: r,
6269
- tenant_scope: Ge(e, "tenant_scope", "tenantScope") ?? n,
6269
+ tenant_scope: Je(e, "tenant_scope", "tenantScope") ?? n,
6270
6270
  status: o,
6271
- ts: Ge(e, "ts", "timestamp") ?? (/* @__PURE__ */ new Date()).toISOString()
6271
+ ts: Je(e, "ts", "timestamp") ?? (/* @__PURE__ */ new Date()).toISOString()
6272
6272
  }, u = e.tenant_id ?? e.tenantId;
6273
6273
  typeof u == "string" ? c.tenant_id = u : u === null && (c.tenant_id = null);
6274
6274
  const d = e.last_seen_at ?? e.lastSeenAt;
6275
6275
  return typeof d == "string" ? c.last_seen_at = d : d === null && (c.last_seen_at = null), c;
6276
6276
  }
6277
- function Jn(e) {
6278
- if (!ie(e))
6277
+ function Qn(e) {
6278
+ if (!oe(e))
6279
6279
  return null;
6280
- const n = Ge(e, "user_id", "userId"), r = Ge(e, "conversation_id", "conversationId");
6280
+ const n = Je(e, "user_id", "userId"), r = Je(e, "conversation_id", "conversationId");
6281
6281
  if (!n || !r)
6282
6282
  return null;
6283
- const o = e.user, c = ie(o) ? {
6283
+ const o = e.user, c = oe(o) ? {
6284
6284
  id: typeof o.id == "string" && o.id !== "" ? o.id : n,
6285
6285
  name: typeof o.name == "string" ? o.name : "",
6286
6286
  ...typeof o.avatar == "string" && o.avatar !== "" ? { avatar: o.avatar } : {}
@@ -6296,156 +6296,156 @@ function Jn(e) {
6296
6296
  };
6297
6297
  }
6298
6298
  function Ka(e) {
6299
- return ie(e) && pe(e, "id") && pe(e, "name");
6299
+ return oe(e) && pe(e, "id") && pe(e, "name");
6300
6300
  }
6301
6301
  function Qa(e) {
6302
- return !ie(e) || !pe(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => Ka(n));
6303
- }
6304
- function Kn(e) {
6305
- return ie(e) && ie(e.message) && pe(e.message, "id") && pe(e.message, "conversation_id") && pe(e.message, "author_id");
6306
- }
6307
- function Qn(e) {
6308
- return ie(e) && pe(e, "conversation_id") && pe(e, "user_id") && pe(e, "message_id");
6302
+ return !oe(e) || !pe(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => Ka(n));
6309
6303
  }
6310
6304
  function Yn(e) {
6311
- return ie(e) && pe(e, "conversation_id") && ie(e.message) && pe(e.message, "id");
6305
+ return oe(e) && oe(e.message) && pe(e.message, "id") && pe(e.message, "conversation_id") && pe(e.message, "author_id");
6312
6306
  }
6313
6307
  function Zn(e) {
6314
- return ie(e) && pe(e, "conversation_id") && pe(e, "message_id");
6308
+ return oe(e) && pe(e, "conversation_id") && pe(e, "user_id") && pe(e, "message_id");
6315
6309
  }
6316
6310
  function es(e) {
6317
- return ie(e) && pe(e, "conversation_id") && pe(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => Qa(n));
6311
+ return oe(e) && pe(e, "conversation_id") && oe(e.message) && pe(e.message, "id");
6318
6312
  }
6319
6313
  function ts(e) {
6320
- return ie(e) && pe(e, "conversation_id");
6314
+ return oe(e) && pe(e, "conversation_id") && pe(e, "message_id");
6321
6315
  }
6322
6316
  function ns(e) {
6323
- return ie(e) && pe(e, "conversation_id") && pe(e, "removed_user_id");
6317
+ return oe(e) && pe(e, "conversation_id") && pe(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => Qa(n));
6318
+ }
6319
+ function ss(e) {
6320
+ return oe(e) && pe(e, "conversation_id");
6324
6321
  }
6325
- function Fe(e, n, r, o) {
6322
+ function rs(e) {
6323
+ return oe(e) && pe(e, "conversation_id") && pe(e, "removed_user_id");
6324
+ }
6325
+ function De(e, n, r, o) {
6326
6326
  const c = (u) => {
6327
6327
  r(u) && o(u);
6328
6328
  };
6329
6329
  return e.listen(n, c), c;
6330
6330
  }
6331
6331
  function pc(e) {
6332
- const n = e.initializedEvent ?? "messenger-client:echo-initialized", r = e.bootstrapEndpoint ?? Na, o = e.bootstrapRefreshSkewMs ?? qa, c = e.presenceFreshnessTtlMs ?? ja, u = (e.createLogger ?? Qt())("MessengerEcho");
6332
+ const n = e.initializedEvent ?? "messenger-client:echo-initialized", r = e.bootstrapEndpoint ?? Na, o = e.bootstrapRefreshSkewMs ?? qa, c = e.presenceFreshnessTtlMs ?? ja, u = (e.createLogger ?? en())("MessengerEcho");
6333
6333
  typeof window < "u" && (window.Pusher = Da);
6334
- let d = null, f = null, h = null, A = null, C = "disconnected", v = "available", E = null, b = null;
6335
- const R = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Map(), m = (T) => {
6336
- C = T;
6337
- for (const P of R)
6338
- P(T);
6339
- }, y = (T) => {
6340
- v = T;
6341
- for (const P of w)
6342
- P(T);
6334
+ let d = null, f = null, h = null, P = null, C = "disconnected", v = "available", T = null, b = null;
6335
+ const R = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Map(), m = (E) => {
6336
+ C = E;
6337
+ for (const A of R)
6338
+ A(E);
6339
+ }, y = (E) => {
6340
+ v = E;
6341
+ for (const A of w)
6342
+ A(E);
6343
6343
  }, F = () => {
6344
6344
  b !== null && (clearTimeout(b), b = null);
6345
- }, q = (T = !0) => {
6346
- h !== null && (h.disconnect(), h = null), A = null, T && m("disconnected");
6345
+ }, q = (E = !0) => {
6346
+ h !== null && (h.disconnect(), h = null), P = null, E && m("disconnected");
6347
6347
  }, J = () => {
6348
- F(), d = null, f = null, E = null, y("available"), q(), p.clear();
6348
+ F(), d = null, f = null, T = null, y("available"), q(), p.clear();
6349
6349
  }, G = () => {
6350
6350
  if (!e.getSourceToken)
6351
6351
  return null;
6352
- const T = e.getSourceToken();
6353
- return T === null ? (J(), null) : (E !== null && E !== T && (F(), d = null, f = null, y("available"), q()), E = T, T);
6354
- }, te = (T) => {
6355
- if (T === null)
6352
+ const E = e.getSourceToken();
6353
+ return E === null ? (J(), null) : (T !== null && T !== E && (F(), d = null, f = null, y("available"), q()), T = E, E);
6354
+ }, te = (E) => {
6355
+ if (E === null)
6356
6356
  return !1;
6357
- if (T.auth.expiresAt === null)
6358
- return T.auth.token !== "";
6359
- const P = Date.parse(T.auth.expiresAt);
6360
- return Number.isNaN(P) ? !1 : P - Date.now() > o;
6361
- }, k = (T) => {
6362
- if (F(), T.auth.expiresAt === null)
6357
+ if (E.auth.expiresAt === null)
6358
+ return E.auth.token !== "";
6359
+ const A = Date.parse(E.auth.expiresAt);
6360
+ return Number.isNaN(A) ? !1 : A - Date.now() > o;
6361
+ }, k = (E) => {
6362
+ if (F(), E.auth.expiresAt === null)
6363
6363
  return;
6364
- const P = Date.parse(T.auth.expiresAt);
6365
- if (Number.isNaN(P))
6364
+ const A = Date.parse(E.auth.expiresAt);
6365
+ if (Number.isNaN(A))
6366
6366
  return;
6367
- const D = Math.max(0, P - Date.now() - o);
6367
+ const U = Math.max(0, A - Date.now() - o);
6368
6368
  b = setTimeout(() => {
6369
6369
  V();
6370
- }, D);
6371
- }, I = async (T = !1) => e.getSourceToken && G() === null || !T && v === "account_suspended" ? null : !T && te(d) ? d : !T && f !== null ? await f : (f = (async () => {
6370
+ }, U);
6371
+ }, I = async (E = !1) => e.getSourceToken && G() === null || !E && v === "account_suspended" ? null : !E && te(d) ? d : !E && f !== null ? await f : (f = (async () => {
6372
6372
  try {
6373
- const D = await e.bootstrapClient.get(
6373
+ const U = await e.bootstrapClient.get(
6374
6374
  r,
6375
- T ? { params: { refresh: 1 } } : void 0
6376
- ), O = Va(D.data);
6377
- return d = O, y("available"), k(O), O;
6378
- } catch (D) {
6379
- if (Wa(D))
6375
+ E ? { params: { refresh: 1 } } : void 0
6376
+ ), D = Va(U.data);
6377
+ return d = D, y("available"), k(D), D;
6378
+ } catch (U) {
6379
+ if (Wa(U))
6380
6380
  return d = null, F(), y("account_suspended"), q(), m("disconnected"), null;
6381
- throw D;
6381
+ throw U;
6382
6382
  }
6383
6383
  })().finally(() => {
6384
6384
  f = null;
6385
6385
  }), await f), V = async () => {
6386
- const T = h !== null;
6386
+ const E = h !== null;
6387
6387
  try {
6388
- if (await I(!0), !T)
6388
+ if (await I(!0), !E)
6389
6389
  return;
6390
6390
  q(!1), await X(!0);
6391
- } catch (P) {
6392
- u.warn("Failed to refresh messenger bootstrap", P);
6391
+ } catch (A) {
6392
+ u.warn("Failed to refresh messenger bootstrap", A);
6393
6393
  }
6394
- }, H = (T) => {
6395
- const P = T.connector?.pusher?.connection;
6396
- if (!P) {
6394
+ }, H = (E) => {
6395
+ const A = E.connector?.pusher?.connection;
6396
+ if (!A) {
6397
6397
  u.warn("Messenger echo connector does not expose a Pusher connection");
6398
6398
  return;
6399
6399
  }
6400
- P.bind("connecting", () => {
6400
+ A.bind("connecting", () => {
6401
6401
  m("connecting");
6402
- }), P.bind("connected", () => {
6402
+ }), A.bind("connected", () => {
6403
6403
  m("connected");
6404
- }), P.bind("disconnected", () => {
6404
+ }), A.bind("disconnected", () => {
6405
6405
  m("disconnected");
6406
- }), P.bind("unavailable", () => {
6406
+ }), A.bind("unavailable", () => {
6407
6407
  m("disconnected");
6408
- }), P.bind("error", () => {
6408
+ }), A.bind("error", () => {
6409
6409
  m("error");
6410
- }), P.bind("state_change", (D) => {
6411
- const O = typeof D == "object" && D !== null && "current" in D && typeof D.current == "string" ? D.current : P.state;
6412
- if (O === "connected") {
6410
+ }), A.bind("state_change", (U) => {
6411
+ const D = typeof U == "object" && U !== null && "current" in U && typeof U.current == "string" ? U.current : A.state;
6412
+ if (D === "connected") {
6413
6413
  m("connected");
6414
6414
  return;
6415
6415
  }
6416
- if (O === "connecting") {
6416
+ if (D === "connecting") {
6417
6417
  m("connecting");
6418
6418
  return;
6419
6419
  }
6420
- (O === "unavailable" || O === "failed" || O === "disconnected") && m("disconnected");
6421
- }), P.state === "connected" && m("connected");
6422
- }, X = async (T = !1) => !T && h !== null && te(d) ? h : !T && A !== null ? await A : (A = (async () => {
6423
- const D = await I(T);
6424
- if (D === null)
6420
+ (D === "unavailable" || D === "failed" || D === "disconnected") && m("disconnected");
6421
+ }), A.state === "connected" && m("connected");
6422
+ }, X = async (E = !1) => !E && h !== null && te(d) ? h : !E && P !== null ? await P : (P = (async () => {
6423
+ const U = await I(E);
6424
+ if (U === null)
6425
6425
  return null;
6426
6426
  h !== null && q(!1);
6427
- const O = D.service.reverb.scheme === "https", se = {
6427
+ const D = U.service.reverb.scheme === "https", ne = {
6428
6428
  broadcaster: "reverb",
6429
- key: D.service.reverb.appKey,
6430
- wsHost: Xa(D.service.reverb.host),
6431
- wsPort: D.service.reverb.port,
6432
- wssPort: D.service.reverb.port,
6433
- forceTLS: O,
6434
- encrypted: O,
6429
+ key: U.service.reverb.appKey,
6430
+ wsHost: Xa(U.service.reverb.host),
6431
+ wsPort: U.service.reverb.port,
6432
+ wssPort: U.service.reverb.port,
6433
+ forceTLS: D,
6434
+ encrypted: D,
6435
6435
  disableStats: !0,
6436
6436
  enabledTransports: ["ws", "wss"],
6437
- authEndpoint: D.service.broadcastingAuthUrl,
6437
+ authEndpoint: U.service.broadcastingAuthUrl,
6438
6438
  auth: {
6439
6439
  headers: {
6440
- Authorization: `Bearer ${D.auth.token}`,
6440
+ Authorization: `Bearer ${U.auth.token}`,
6441
6441
  Accept: "application/json"
6442
6442
  }
6443
6443
  }
6444
6444
  };
6445
- return D.service.reverb.path && (se.wsPath = D.service.reverb.path), h = new Ia(se), H(h), m("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
6445
+ return U.service.reverb.path && (ne.wsPath = U.service.reverb.path), h = new Ia(ne), H(h), m("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
6446
6446
  })().finally(() => {
6447
- A = null;
6448
- }), await A), _ = zt.create({
6447
+ P = null;
6448
+ }), await P), _ = Ht.create({
6449
6449
  timeout: e.requestTimeoutMs ?? za,
6450
6450
  withCredentials: !1,
6451
6451
  headers: {
@@ -6453,48 +6453,48 @@ function pc(e) {
6453
6453
  "X-Requested-With": "XMLHttpRequest"
6454
6454
  }
6455
6455
  });
6456
- _.interceptors.request.use(async (T) => {
6457
- const P = await I();
6458
- if (P === null)
6456
+ _.interceptors.request.use(async (E) => {
6457
+ const A = await I();
6458
+ if (A === null)
6459
6459
  throw new Error("Messenger bootstrap is unavailable.");
6460
- return T.baseURL = P.service.apiBaseUrl, Gn(T, P.auth.token), T;
6460
+ return E.baseURL = A.service.apiBaseUrl, Kn(E, A.auth.token), E;
6461
6461
  }), _.interceptors.response.use(
6462
- (T) => T,
6463
- async (T) => {
6464
- const P = T.config;
6465
- if (T.response?.status === 401 && P && P._messengerRetry !== !0) {
6466
- P._messengerRetry = !0;
6467
- const D = await I(!0);
6468
- if (D !== null)
6469
- return P.baseURL = D.service.apiBaseUrl, Gn(P, D.auth.token), await _(P);
6462
+ (E) => E,
6463
+ async (E) => {
6464
+ const A = E.config;
6465
+ if (E.response?.status === 401 && A && A._messengerRetry !== !0) {
6466
+ A._messengerRetry = !0;
6467
+ const U = await I(!0);
6468
+ if (U !== null)
6469
+ return A.baseURL = U.service.apiBaseUrl, Kn(A, U.auth.token), await _(A);
6470
6470
  }
6471
- return Promise.reject(T);
6471
+ return Promise.reject(E);
6472
6472
  }
6473
6473
  );
6474
- const x = () => v === "account_suspended" ? null : h, fe = (T) => (R.add(T), T(C), () => {
6475
- R.delete(T);
6476
- }), Se = (T) => (w.add(T), T(v), () => {
6477
- w.delete(T);
6478
- }), B = () => d?.auth.tenantId ?? "global", K = (T) => {
6479
- const P = Ot(T.ts)?.getTime() ?? Ot(T.last_seen_at)?.getTime() ?? null;
6480
- if (P === null)
6474
+ const x = () => v === "account_suspended" ? null : h, fe = (E) => (R.add(E), E(C), () => {
6475
+ R.delete(E);
6476
+ }), Se = (E) => (w.add(E), E(v), () => {
6477
+ w.delete(E);
6478
+ }), B = () => d?.auth.tenantId ?? "global", K = (E) => {
6479
+ const A = Nt(E.ts)?.getTime() ?? Nt(E.last_seen_at)?.getTime() ?? null;
6480
+ if (A === null)
6481
6481
  return !0;
6482
- const D = `${T.tenant_scope ?? "global"}:${T.user_id}`, O = p.get(D);
6483
- if (O && P < O.timestampMs)
6482
+ const U = `${E.tenant_scope ?? "global"}:${E.user_id}`, D = p.get(U);
6483
+ if (D && A < D.timestampMs)
6484
6484
  return !1;
6485
- const se = Date.now();
6486
- p.set(D, {
6487
- timestampMs: P,
6488
- seenAt: se
6485
+ const ne = Date.now();
6486
+ p.set(U, {
6487
+ timestampMs: A,
6488
+ seenAt: ne
6489
6489
  });
6490
- for (const [ae, le] of p.entries())
6491
- se - le.seenAt > c && p.delete(ae);
6490
+ for (const [ae, ue] of p.entries())
6491
+ ne - ue.seenAt > c && p.delete(ae);
6492
6492
  return !0;
6493
- }, N = (T) => {
6494
- const P = x();
6495
- if (!P || typeof P.join != "function")
6493
+ }, N = (E) => {
6494
+ const A = x();
6495
+ if (!A || typeof A.join != "function")
6496
6496
  return;
6497
- const D = P.join(`online-users.${B()}`), O = [
6497
+ const U = A.join(`online-users.${B()}`), D = [
6498
6498
  ".PresenceStatusChanged",
6499
6499
  "PresenceStatusChanged",
6500
6500
  ".presence.status.changed",
@@ -6504,74 +6504,82 @@ function pc(e) {
6504
6504
  ".Modules\\Presence\\Events\\UserPresenceStatusChanged",
6505
6505
  "Modules\\Presence\\Events\\UserPresenceStatusChanged"
6506
6506
  ];
6507
- for (const se of O)
6508
- D.listen(se, (ae) => {
6509
- const le = Ja(ae, B());
6510
- !le || !K(le) || T(le);
6507
+ for (const ne of D)
6508
+ U.listen(ne, (ae) => {
6509
+ const ue = Ja(ae, B());
6510
+ !ue || !K(ue) || E(ue);
6511
6511
  });
6512
6512
  }, Y = () => {
6513
6513
  h?.leave(`online-users.${B()}`);
6514
6514
  };
6515
- function M(T, P) {
6516
- const D = [];
6517
- function O(se, ae, le) {
6518
- if (!le)
6515
+ function M(E, A) {
6516
+ const U = [];
6517
+ function D(ne, ae, ue) {
6518
+ if (!ue)
6519
6519
  return;
6520
- const Ae = (Le) => {
6521
- ae(Le) && le(Le);
6520
+ const Ce = (Me) => {
6521
+ ae(Me) && ue(Me);
6522
6522
  };
6523
- T.bind(se, Ae), D.push({ event: se, handler: Ae });
6523
+ E.bind(ne, Ce), U.push({ event: ne, handler: Ce });
6524
6524
  }
6525
- return O("ConversationMessageSent", Kn, P.onMessageSent), O("ConversationMessageRead", Qn, P.onMessageRead), O("ConversationMessageEdited", Yn, P.onMessageEdited), O("ConversationMessageDeleted", Zn, P.onMessageDeleted), O("MessageReactionToggled", es, P.onReactionToggled), O("ConversationRequestAccepted", ts, P.onRequestAccepted), O("ConversationParticipantRemoved", ns, P.onParticipantRemoved), () => {
6526
- for (const se of D)
6527
- T.unbind(se.event, se.handler);
6525
+ return D("ConversationMessageSent", Yn, A.onMessageSent), D("ConversationMessageRead", Zn, A.onMessageRead), D("ConversationMessageEdited", es, A.onMessageEdited), D("ConversationMessageDeleted", ts, A.onMessageDeleted), D("MessageReactionToggled", ns, A.onReactionToggled), D("ConversationRequestAccepted", ss, A.onRequestAccepted), D("ConversationParticipantRemoved", rs, A.onParticipantRemoved), () => {
6526
+ for (const ne of U)
6527
+ E.unbind(ne.event, ne.handler);
6528
6528
  };
6529
6529
  }
6530
- const U = (T, P) => {
6531
- const D = x();
6532
- if (!D)
6530
+ const O = (E, A) => {
6531
+ const U = x();
6532
+ if (!U)
6533
6533
  return () => {
6534
6534
  };
6535
- const O = D.private(`conversation.${T}`), se = O.subscription;
6536
- if (se)
6537
- return M(se, P);
6535
+ const D = U.private(`conversation.${E}`), ne = D.subscription;
6536
+ if (ne)
6537
+ return M(ne, A);
6538
6538
  const ae = [];
6539
- return P.onMessageSent && ae.push({
6539
+ return A.onMessageSent && ae.push({
6540
6540
  event: ".ConversationMessageSent",
6541
- handler: Fe(O, ".ConversationMessageSent", Kn, P.onMessageSent)
6542
- }), P.onMessageRead && ae.push({
6541
+ handler: De(D, ".ConversationMessageSent", Yn, A.onMessageSent)
6542
+ }), A.onMessageRead && ae.push({
6543
6543
  event: ".ConversationMessageRead",
6544
- handler: Fe(O, ".ConversationMessageRead", Qn, P.onMessageRead)
6545
- }), P.onMessageEdited && ae.push({
6544
+ handler: De(D, ".ConversationMessageRead", Zn, A.onMessageRead)
6545
+ }), A.onMessageEdited && ae.push({
6546
6546
  event: ".ConversationMessageEdited",
6547
- handler: Fe(O, ".ConversationMessageEdited", Yn, P.onMessageEdited)
6548
- }), P.onMessageDeleted && ae.push({
6547
+ handler: De(D, ".ConversationMessageEdited", es, A.onMessageEdited)
6548
+ }), A.onMessageDeleted && ae.push({
6549
6549
  event: ".ConversationMessageDeleted",
6550
- handler: Fe(O, ".ConversationMessageDeleted", Zn, P.onMessageDeleted)
6551
- }), P.onReactionToggled && ae.push({
6550
+ handler: De(D, ".ConversationMessageDeleted", ts, A.onMessageDeleted)
6551
+ }), A.onReactionToggled && ae.push({
6552
6552
  event: ".MessageReactionToggled",
6553
- handler: Fe(O, ".MessageReactionToggled", es, P.onReactionToggled)
6554
- }), P.onRequestAccepted && ae.push({
6553
+ handler: De(D, ".MessageReactionToggled", ns, A.onReactionToggled)
6554
+ }), A.onRequestAccepted && ae.push({
6555
6555
  event: ".ConversationRequestAccepted",
6556
- handler: Fe(O, ".ConversationRequestAccepted", ts, P.onRequestAccepted)
6557
- }), P.onParticipantRemoved && ae.push({
6556
+ handler: De(D, ".ConversationRequestAccepted", ss, A.onRequestAccepted)
6557
+ }), A.onParticipantRemoved && ae.push({
6558
6558
  event: ".ConversationParticipantRemoved",
6559
- handler: Fe(O, ".ConversationParticipantRemoved", ns, P.onParticipantRemoved)
6559
+ handler: De(D, ".ConversationParticipantRemoved", rs, A.onParticipantRemoved)
6560
6560
  }), () => {
6561
- if (typeof O.stopListening == "function")
6562
- for (const le of ae)
6563
- O.stopListening(le.event, le.handler);
6561
+ if (typeof D.stopListening == "function")
6562
+ for (const ue of ae)
6563
+ D.stopListening(ue.event, ue.handler);
6564
6564
  };
6565
- }, ne = (T) => {
6566
- h?.leave(`conversation.${T}`);
6567
- }, ue = (T, P, D) => {
6568
- const O = T.private(`typing-conversation.${P}`), se = /* @__PURE__ */ new Set(["start", "typing"]), ae = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]), le = O.subscription;
6569
- if (le) {
6570
- const we = (ge) => {
6571
- const be = Jn(ge);
6565
+ }, se = (E) => {
6566
+ h?.leave(`conversation.${E}`);
6567
+ }, le = (E, A, U) => {
6568
+ if (A.subscription)
6569
+ return A.subscription;
6570
+ const D = E.connector?.pusher;
6571
+ if (!D || typeof D.channel != "function")
6572
+ return null;
6573
+ const ne = U.startsWith("private-") ? U : `private-${U}`;
6574
+ return D.channel(ne) ?? null;
6575
+ }, re = (E, A, U) => {
6576
+ const D = `typing-conversation.${A}`, ne = E.private(D), ae = /* @__PURE__ */ new Set(["start", "typing"]), ue = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]), Ce = le(E, ne, D);
6577
+ if (Ce) {
6578
+ const Ee = (ge) => {
6579
+ const be = Qn(ge);
6572
6580
  if (be) {
6573
- if (se.has(be.state)) {
6574
- D.onTypingStart?.({
6581
+ if (ae.has(be.state)) {
6582
+ U.onTypingStart?.({
6575
6583
  user_id: be.user_id,
6576
6584
  user: be.user ?? {
6577
6585
  id: be.user_id,
@@ -6582,22 +6590,22 @@ function pc(e) {
6582
6590
  });
6583
6591
  return;
6584
6592
  }
6585
- ae.has(be.state) && D.onTypingStop?.({
6593
+ ue.has(be.state) && U.onTypingStop?.({
6586
6594
  user_id: be.user_id,
6587
6595
  conversation_id: be.conversation_id,
6588
6596
  stopped_at: be.stopped_at ?? be.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6589
6597
  });
6590
6598
  }
6591
6599
  };
6592
- return le.bind("TypingStateChanged", we), () => {
6593
- le.unbind("TypingStateChanged", we);
6600
+ return Ce.bind("TypingStateChanged", Ee), () => {
6601
+ Ce.unbind("TypingStateChanged", Ee);
6594
6602
  };
6595
6603
  }
6596
- const Ae = [], Le = (we) => {
6597
- const ge = Jn(we);
6604
+ const Me = [], Ze = (Ee) => {
6605
+ const ge = Qn(Ee);
6598
6606
  if (ge) {
6599
- if (se.has(ge.state)) {
6600
- D.onTypingStart?.({
6607
+ if (ae.has(ge.state)) {
6608
+ U.onTypingStart?.({
6601
6609
  user_id: ge.user_id,
6602
6610
  user: ge.user ?? {
6603
6611
  id: ge.user_id,
@@ -6608,53 +6616,54 @@ function pc(e) {
6608
6616
  });
6609
6617
  return;
6610
6618
  }
6611
- ae.has(ge.state) && D.onTypingStop?.({
6619
+ ue.has(ge.state) && U.onTypingStop?.({
6612
6620
  user_id: ge.user_id,
6613
6621
  conversation_id: ge.conversation_id,
6614
6622
  stopped_at: ge.stopped_at ?? ge.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6615
6623
  });
6616
6624
  }
6617
6625
  };
6618
- return O.listen(".TypingStateChanged", Le), Ae.push({ event: ".TypingStateChanged", handler: Le }), () => {
6619
- if (typeof O.stopListening == "function")
6620
- for (const we of Ae)
6621
- O.stopListening(we.event, we.handler);
6626
+ return ne.listen(".TypingStateChanged", Ze), Me.push({ event: ".TypingStateChanged", handler: Ze }), () => {
6627
+ if (typeof ne.stopListening == "function")
6628
+ for (const Ee of Me)
6629
+ ne.stopListening(Ee.event, Ee.handler);
6622
6630
  };
6623
- };
6631
+ }, ve = (E, A) => {
6632
+ const U = x();
6633
+ if (U)
6634
+ return re(U, E, A);
6635
+ let D = !1, ne = null;
6636
+ const ae = (Ce) => {
6637
+ D || Ce && (ne = re(Ce, E, A), typeof window < "u" && window.removeEventListener(n, ue));
6638
+ }, ue = () => {
6639
+ ae(x());
6640
+ };
6641
+ return typeof window < "u" && window.addEventListener(n, ue), we().then((Ce) => {
6642
+ ae(Ce);
6643
+ }), () => {
6644
+ D = !0, typeof window < "u" && window.removeEventListener(n, ue), ne?.();
6645
+ };
6646
+ }, pt = (E) => {
6647
+ h?.leave(`typing-conversation.${E}`);
6648
+ }, Ye = async () => {
6649
+ y("available"), q(), await X(!0);
6650
+ }, we = async () => v === "account_suspended" ? null : await X();
6624
6651
  return {
6625
6652
  apiClient: _,
6626
6653
  initializedEvent: n,
6627
6654
  getEcho: x,
6628
- waitForEcho: async () => v === "account_suspended" ? null : await X(),
6655
+ waitForEcho: we,
6629
6656
  getConnectionStatus: () => C,
6630
6657
  getAccessState: () => v,
6631
6658
  onConnectionStatusChange: fe,
6632
6659
  onAccessStateChange: Se,
6633
- reconnect: async () => {
6634
- y("available"), q(), await X(!0);
6635
- },
6660
+ reconnect: Ye,
6636
6661
  subscribeToPresenceStatus: N,
6637
6662
  unsubscribeFromPresenceStatus: Y,
6638
- subscribeToConversation: U,
6639
- unsubscribeFromConversation: ne,
6640
- subscribeToTyping: (T, P) => {
6641
- const D = x();
6642
- if (D)
6643
- return ue(D, T, P);
6644
- let O = !1, se = null;
6645
- const ae = () => {
6646
- if (O)
6647
- return;
6648
- const le = x();
6649
- le && (se = ue(le, T, P), typeof window < "u" && window.removeEventListener(n, ae));
6650
- };
6651
- return typeof window < "u" && window.addEventListener(n, ae), () => {
6652
- O = !0, typeof window < "u" && window.removeEventListener(n, ae), se?.();
6653
- };
6654
- },
6655
- unsubscribeFromTyping: (T) => {
6656
- h?.leave(`typing-conversation.${T}`);
6657
- },
6663
+ subscribeToConversation: O,
6664
+ unsubscribeFromConversation: se,
6665
+ subscribeToTyping: ve,
6666
+ unsubscribeFromTyping: pt,
6658
6667
  clearRuntime: J
6659
6668
  };
6660
6669
  }
@@ -6663,19 +6672,19 @@ export {
6663
6672
  hc as configureMessengerClient,
6664
6673
  pc as createMessengerEcho,
6665
6674
  W as getApi,
6666
- ke as getAuthStore,
6667
- En as getConnectionStatus,
6668
- Re as getEcho,
6669
- gs as getEchoConnectionStatus,
6670
- Je as getEchoInitializedEvent,
6675
+ Le as getAuthStore,
6676
+ An as getConnectionStatus,
6677
+ Pe as getEcho,
6678
+ vs as getEchoConnectionStatus,
6679
+ Ke as getEchoInitializedEvent,
6671
6680
  Z as getErrorMessage,
6672
- Qt as getLoggerFactory,
6673
- Ht as getMainApi,
6681
+ en as getLoggerFactory,
6682
+ Xt as getMainApi,
6674
6683
  jo as getMainEcho,
6675
6684
  $o as getMainEchoConnectionStatus,
6676
6685
  zo as getMainEchoInitializedEvent,
6677
6686
  ao as getMediaApi,
6678
- It as getMessagingAccessState,
6687
+ Ft as getMessagingAccessState,
6679
6688
  ia as getPresenceRuntimeConfig,
6680
6689
  ca as hasConfiguredPresenceAuthTokenResolver,
6681
6690
  ic as hasResponse,
@@ -6687,13 +6696,13 @@ export {
6687
6696
  Ji as isValidMessageSentEvent,
6688
6697
  Zi as isValidReactionToggledEvent,
6689
6698
  eo as isValidRequestAcceptedEvent,
6690
- Pe as messagingApi,
6699
+ ke as messagingApi,
6691
6700
  go as normalizePresenceStatus,
6692
- Ss as normalizePresenceTimestamp,
6693
- lt as onConnectionStatusChange,
6701
+ ws as normalizePresenceTimestamp,
6702
+ ft as onConnectionStatusChange,
6694
6703
  Ho as onMainEchoConnectionStatusChange,
6695
6704
  qi as onMessagingAccessStateChange,
6696
- Ot as parsePresenceTimestamp,
6705
+ Nt as parsePresenceTimestamp,
6697
6706
  zi as reconnectEcho,
6698
6707
  Bo as reconnectMainEcho,
6699
6708
  Gi as resetEchoRuntimeConfig,
@@ -6706,7 +6715,7 @@ export {
6706
6715
  fc as resetMessengerClientConfig,
6707
6716
  aa as resetPresenceRuntimeConfig,
6708
6717
  mo as resolveFreshPresenceStatus,
6709
- Ft as resolvePresenceSnapshot,
6718
+ qt as resolvePresenceSnapshot,
6710
6719
  Wi as setEchoRuntimeConfig,
6711
6720
  Go as setLoggerFactory,
6712
6721
  so as setMainApiClient,
@@ -6725,8 +6734,8 @@ export {
6725
6734
  oc as useConversationChannel,
6726
6735
  cc as useGlobalMessaging,
6727
6736
  uc as useMessagingAccessState,
6728
- Jt as useMessagingStore,
6737
+ Yt as useMessagingStore,
6729
6738
  lc as usePresence,
6730
6739
  dc as useTypingChannel,
6731
- ps as waitForEcho
6740
+ ms as waitForEcho
6732
6741
  };