@codingfactory/messenger-client 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ref as he, getCurrentInstance as kt, computed as re, watch as At, onUnmounted as He, toValue as Ln, onMounted as Un } from "vue";
2
2
  import { defineStore as ci, storeToRefs as ui } from "pinia";
3
3
  import It, { isAxiosError as li, AxiosHeaders as pn } from "axios";
4
- import { isAxiosError as Xa } from "axios";
4
+ import { isAxiosError as Wa } from "axios";
5
5
  import { useRoute as di } from "vue-router";
6
6
  const On = () => () => {
7
7
  }, Nn = async () => {
@@ -13,7 +13,7 @@ const On = () => () => {
13
13
  throw new Error("messenger-client subscribeToConversation is not configured");
14
14
  }, $n = () => {
15
15
  throw new Error("messenger-client subscribeToTyping is not configured");
16
- }, J = {
16
+ }, G = {
17
17
  ECHO_INITIALIZED_EVENT: "messenger-client:echo-initialized",
18
18
  getEcho: () => null,
19
19
  getConnectionStatus: () => "disconnected",
@@ -25,14 +25,14 @@ const On = () => () => {
25
25
  unsubscribeFromConversation: qn,
26
26
  subscribeToTyping: $n,
27
27
  unsubscribeFromTyping: zn
28
- }, $e = () => J.ECHO_INITIALIZED_EVENT, ke = () => J.getEcho(), Hn = () => J.getConnectionStatus(), La = () => Hn(), ot = (e) => J.onConnectionStatusChange(e), hi = async () => {
29
- await J.reconnect();
30
- }, fi = (e) => J.subscribeToPresenceStatus(e), pi = () => J.unsubscribeFromPresenceStatus(), gi = (e, n) => J.subscribeToConversation(e, n), mi = (e) => J.unsubscribeFromConversation(e), vi = (e, n) => J.subscribeToTyping(e, n), bi = (e) => J.unsubscribeFromTyping(e);
28
+ }, $e = () => G.ECHO_INITIALIZED_EVENT, ke = () => G.getEcho(), Hn = () => G.getConnectionStatus(), Ua = () => Hn(), ot = (e) => G.onConnectionStatusChange(e), hi = async () => {
29
+ await G.reconnect();
30
+ }, fi = (e) => G.subscribeToPresenceStatus(e), pi = () => G.unsubscribeFromPresenceStatus(), gi = (e, n) => G.subscribeToConversation(e, n), mi = (e) => G.unsubscribeFromConversation(e), vi = (e, n) => G.subscribeToTyping(e, n), bi = (e) => G.unsubscribeFromTyping(e);
31
31
  function yi(e) {
32
- e.initializedEvent && (J.ECHO_INITIALIZED_EVENT = e.initializedEvent), e.getEcho && (J.getEcho = e.getEcho), e.getConnectionStatus && (J.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (J.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (J.reconnect = e.reconnect), e.subscribeToPresenceStatus && (J.subscribeToPresenceStatus = e.subscribeToPresenceStatus), e.unsubscribeFromPresenceStatus && (J.unsubscribeFromPresenceStatus = e.unsubscribeFromPresenceStatus), e.subscribeToConversation && (J.subscribeToConversation = e.subscribeToConversation), e.unsubscribeFromConversation && (J.unsubscribeFromConversation = e.unsubscribeFromConversation), e.subscribeToTyping && (J.subscribeToTyping = e.subscribeToTyping), e.unsubscribeFromTyping && (J.unsubscribeFromTyping = e.unsubscribeFromTyping);
32
+ e.initializedEvent && (G.ECHO_INITIALIZED_EVENT = e.initializedEvent), e.getEcho && (G.getEcho = e.getEcho), e.getConnectionStatus && (G.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (G.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (G.reconnect = e.reconnect), e.subscribeToPresenceStatus && (G.subscribeToPresenceStatus = e.subscribeToPresenceStatus), e.unsubscribeFromPresenceStatus && (G.unsubscribeFromPresenceStatus = e.unsubscribeFromPresenceStatus), e.subscribeToConversation && (G.subscribeToConversation = e.subscribeToConversation), e.unsubscribeFromConversation && (G.unsubscribeFromConversation = e.unsubscribeFromConversation), e.subscribeToTyping && (G.subscribeToTyping = e.subscribeToTyping), e.unsubscribeFromTyping && (G.unsubscribeFromTyping = e.unsubscribeFromTyping);
33
33
  }
34
34
  function _i() {
35
- J.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", J.getEcho = () => null, J.getConnectionStatus = () => "disconnected", J.onConnectionStatusChange = On, J.reconnect = Nn, J.subscribeToPresenceStatus = Dn, J.unsubscribeFromPresenceStatus = Fn, J.subscribeToConversation = jn, J.unsubscribeFromConversation = qn, J.subscribeToTyping = $n, J.unsubscribeFromTyping = zn;
35
+ G.ECHO_INITIALIZED_EVENT = "messenger-client:echo-initialized", G.getEcho = () => null, G.getConnectionStatus = () => "disconnected", G.onConnectionStatusChange = On, G.reconnect = Nn, G.subscribeToPresenceStatus = Dn, G.unsubscribeFromPresenceStatus = Fn, G.subscribeToConversation = jn, G.unsubscribeFromConversation = qn, G.subscribeToTyping = $n, G.unsubscribeFromTyping = zn;
36
36
  }
37
37
  function Te(e) {
38
38
  return typeof e == "object" && e !== null;
@@ -57,7 +57,7 @@ function Ri(e) {
57
57
  }
58
58
  const Bn = It;
59
59
  let Lt = Bn;
60
- function X() {
60
+ function V() {
61
61
  return Lt;
62
62
  }
63
63
  function Ai(e) {
@@ -86,10 +86,10 @@ function Z(e) {
86
86
  }
87
87
  return e instanceof Error ? e.message : typeof e == "string" ? e : typeof e == "object" && e !== null && "message" in e && typeof e.message == "string" ? e.message : "An unexpected error occurred";
88
88
  }
89
- function Ua(e) {
89
+ function Oa(e) {
90
90
  return e instanceof Error;
91
91
  }
92
- function Oa(e) {
92
+ function Na(e) {
93
93
  return typeof e == "object" && e !== null && "response" in e && typeof e.response == "object";
94
94
  }
95
95
  const Xn = {
@@ -168,35 +168,35 @@ function mn(e) {
168
168
  }
169
169
  const we = {
170
170
  async fetchFolders() {
171
- const e = await X().get("/v1/messaging/folders");
171
+ const e = await V().get("/v1/messaging/folders");
172
172
  return Oi(De(e.data));
173
173
  },
174
174
  async createFolder(e) {
175
- const n = await X().post("/v1/messaging/folders", e);
175
+ const n = await V().post("/v1/messaging/folders", e);
176
176
  return Pt(De(n.data));
177
177
  },
178
178
  async updateFolder(e, n) {
179
- const i = await X().patch(`/v1/messaging/folders/${e}`, n);
179
+ const i = await V().patch(`/v1/messaging/folders/${e}`, n);
180
180
  return Pt(De(i.data));
181
181
  },
182
182
  async deleteFolder(e) {
183
- await X().delete(`/v1/messaging/folders/${e}`);
183
+ await V().delete(`/v1/messaging/folders/${e}`);
184
184
  },
185
185
  async reorderFolders(e) {
186
- await X().patch("/v1/messaging/folders/reorder", { order: e });
186
+ await V().patch("/v1/messaging/folders/reorder", { order: e });
187
187
  },
188
188
  async assignFolder(e, n) {
189
- const i = await X().patch(`/v1/messaging/conversations/${e}/folder`, {
189
+ const i = await V().patch(`/v1/messaging/conversations/${e}/folder`, {
190
190
  folder_id: n
191
191
  });
192
192
  return mn(De(i.data));
193
193
  },
194
194
  async acceptRequest(e) {
195
- const n = await X().post(`/v1/messaging/conversations/${e}/accept`);
195
+ const n = await V().post(`/v1/messaging/conversations/${e}/accept`);
196
196
  return mn(De(n.data));
197
197
  },
198
198
  async declineRequest(e) {
199
- await X().post(`/v1/messaging/conversations/${e}/decline`);
199
+ await V().post(`/v1/messaging/conversations/${e}/decline`);
200
200
  }
201
201
  }, vn = 1e3, Nt = 4e3, Ni = 12e4, Di = 300, Fi = 1, qi = 1600, Dt = (e) => {
202
202
  if (typeof e == "number" && Number.isFinite(e))
@@ -229,9 +229,9 @@ const we = {
229
229
  setTimeout(n, e);
230
230
  });
231
231
  }, $i = (e) => {
232
- if (!de(e))
232
+ if (!le(e))
233
233
  return !1;
234
- const i = (de(e.data) ? e.data : e).throttled;
234
+ const i = (le(e.data) ? e.data : e).throttled;
235
235
  if (typeof i == "boolean")
236
236
  return i;
237
237
  if (typeof i == "number")
@@ -249,8 +249,8 @@ function Hi(e, n, i) {
249
249
  const u = typeof n == "string" && n.trim().length > 0 ? n.trim().toLowerCase() : void 0;
250
250
  if (u)
251
251
  return u;
252
- const l = typeof i == "string" && i.trim().length > 0 ? i.trim().toLowerCase() : void 0;
253
- return l ? l === "image" ? "image/*" : l === "video" ? "video/*" : l === "audio" ? "audio/*" : l : "application/octet-stream";
252
+ const d = typeof i == "string" && i.trim().length > 0 ? i.trim().toLowerCase() : void 0;
253
+ return d ? d === "image" ? "image/*" : d === "video" ? "video/*" : d === "audio" ? "audio/*" : d : "application/octet-stream";
254
254
  }
255
255
  function Bi(e) {
256
256
  const n = e.url || "", i = e.thumbnail_url ?? e.thumbnail, o = {
@@ -314,6 +314,29 @@ function tt(e) {
314
314
  };
315
315
  }
316
316
  function Gi(e) {
317
+ if (!e || !le(e))
318
+ return;
319
+ const n = typeof e.id == "string" ? e.id.trim() : "", i = typeof e.title == "string" ? e.title.trim() : "", o = typeof e.url == "string" ? e.url.trim() : "";
320
+ if (n.length === 0 || i.length === 0 || o.length === 0)
321
+ return;
322
+ const u = typeof e.excerpt == "string" && e.excerpt.trim().length > 0 ? e.excerpt.trim() : null, d = typeof e.media_thumbnail == "string" && e.media_thumbnail.trim().length > 0 ? e.media_thumbnail.trim() : null, l = le(e.author) ? e.author : null, g = l && typeof l.id == "string" ? l.id.trim() : "", h = l && typeof l.name == "string" ? l.name.trim() : "", k = l && typeof l.avatar == "string" && l.avatar.trim().length > 0 ? l.avatar.trim() : null, x = l && typeof l.handle == "string" && l.handle.trim().length > 0 ? l.handle.trim() : null;
323
+ return {
324
+ id: n,
325
+ title: i,
326
+ url: o,
327
+ ...u ? { excerpt: u } : {},
328
+ ...d ? { media_thumbnail: d } : {},
329
+ ...g.length > 0 && h.length > 0 ? {
330
+ author: {
331
+ id: g,
332
+ name: h,
333
+ ...k ? { avatar: k } : {},
334
+ ...x ? { handle: x } : {}
335
+ }
336
+ } : {}
337
+ };
338
+ }
339
+ function Ji(e) {
317
340
  return typeof e != "string" || e.length === 0 ? null : e;
318
341
  }
319
342
  function _n(e) {
@@ -323,45 +346,45 @@ function _n(e) {
323
346
  function Mt(e) {
324
347
  return typeof e == "string" && e.length > 0 && !e.startsWith("temp-");
325
348
  }
326
- function Ji(e, n = []) {
349
+ function Ki(e, n = []) {
327
350
  const i = /* @__PURE__ */ new Map();
328
351
  for (const o of n) {
329
352
  const u = _n(o.last_read_message_id);
330
353
  u && i.set(o.user_id, u);
331
354
  }
332
355
  return e.map((o) => {
333
- const u = Object.prototype.hasOwnProperty.call(o, "last_read_message_id"), l = st(o.user?.avatar) ?? st(o.user?.avatar_url), d = o.user ? {
356
+ const u = Object.prototype.hasOwnProperty.call(o, "last_read_message_id"), d = st(o.user?.avatar) ?? st(o.user?.avatar_url), l = o.user ? {
334
357
  id: o.user.id,
335
358
  name: o.user.name,
336
- ...l ? { avatar: l } : {},
359
+ ...d ? { avatar: d } : {},
337
360
  ...o.user.handle ? { handle: o.user.handle } : {}
338
361
  } : void 0, g = _n(o.last_read_message_id);
339
362
  if (g)
340
363
  return {
341
364
  ...o,
342
- ...d ? { user: d } : {},
365
+ ...l ? { user: l } : {},
343
366
  last_read_message_id: g
344
367
  };
345
368
  if (u)
346
369
  return {
347
370
  ...o,
348
- ...d ? { user: d } : {},
371
+ ...l ? { user: l } : {},
349
372
  last_read_message_id: ""
350
373
  };
351
374
  const h = i.get(o.user_id);
352
375
  return h ? {
353
376
  ...o,
354
- ...d ? { user: d } : {},
377
+ ...l ? { user: l } : {},
355
378
  last_read_message_id: h
356
379
  } : {
357
380
  ...o,
358
- ...d ? { user: d } : {},
381
+ ...l ? { user: l } : {},
359
382
  last_read_message_id: ""
360
383
  };
361
384
  });
362
385
  }
363
386
  function Fe(e, n) {
364
- const i = Gi(e.muted_until), o = e.is_muted ?? i !== null, u = e.last_message ? tt(e.last_message) : n?.last_message, l = e.last_message_at ?? n?.last_message_at, d = (() => {
387
+ const i = Ji(e.muted_until), o = e.is_muted ?? i !== null, u = e.last_message ? tt(e.last_message) : n?.last_message, d = e.last_message_at ?? n?.last_message_at, l = (() => {
365
388
  if (!n || n.unread_count !== 0 || e.unread_count <= 0)
366
389
  return !1;
367
390
  const g = n.last_message?.id, h = e.last_message?.id;
@@ -369,19 +392,19 @@ function Fe(e, n) {
369
392
  })();
370
393
  return {
371
394
  ...e,
372
- unread_count: o || d ? 0 : e.unread_count,
373
- participants: Ji(e.participants, n?.participants),
395
+ unread_count: o || l ? 0 : e.unread_count,
396
+ participants: Ki(e.participants, n?.participants),
374
397
  is_muted: o,
375
398
  muted_until: i,
376
399
  ...u ? { last_message: u } : {},
377
- ...l ? { last_message_at: l } : {}
400
+ ...d ? { last_message_at: d } : {}
378
401
  };
379
402
  }
380
- function Ki(e) {
403
+ function Yi(e) {
381
404
  return e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
382
405
  }
383
406
  function Ct(e) {
384
- return Ki(e) ? 0 : e.unread_count || 0;
407
+ return Yi(e) ? 0 : e.unread_count || 0;
385
408
  }
386
409
  function Sn(e, n) {
387
410
  const i = n[e.id];
@@ -393,20 +416,20 @@ function Sn(e, n) {
393
416
  }
394
417
  return Mt(e.last_message?.id) ? e.last_message.id : null;
395
418
  }
396
- function de(e) {
419
+ function le(e) {
397
420
  return typeof e == "object" && e !== null;
398
421
  }
399
- function Yi(e) {
400
- return de(e) ? (de(e.response) ? e.response : null)?.status === 401 : !1;
422
+ function Qi(e) {
423
+ return le(e) ? (le(e.response) ? e.response : null)?.status === 401 : !1;
401
424
  }
402
425
  function Cn(e) {
403
426
  if (!Array.isArray(e))
404
427
  return [];
405
428
  const n = [];
406
429
  for (const i of e) {
407
- if (!de(i) || typeof i.reaction != "string" || typeof i.count != "number" || !Array.isArray(i.users))
430
+ if (!le(i) || typeof i.reaction != "string" || typeof i.count != "number" || !Array.isArray(i.users))
408
431
  continue;
409
- const o = i.users.filter((u) => de(u)).filter(
432
+ const o = i.users.filter((u) => le(u)).filter(
410
433
  (u) => typeof u.id == "string" && typeof u.name == "string"
411
434
  ).map((u) => ({
412
435
  id: u.id,
@@ -420,24 +443,24 @@ function Cn(e) {
420
443
  }
421
444
  return n;
422
445
  }
423
- function Qi(e, n) {
424
- const i = de(n) ? n : null, o = i?.next ?? i?.next_cursor ?? e.next_cursor;
446
+ function Zi(e, n) {
447
+ const i = le(n) ? n : null, o = i?.next ?? i?.next_cursor ?? e.next_cursor;
425
448
  if (!(typeof o != "string" || o.length === 0))
426
449
  return o;
427
450
  }
428
451
  function Qe(e, n) {
429
- const i = de(e) ? e : {}, o = i.data ?? e;
452
+ const i = le(e) ? e : {}, o = i.data ?? e;
430
453
  let u = [];
431
- return Array.isArray(o) ? u = o : de(o) && (Array.isArray(o.items) ? u = o.items : Array.isArray(o[n]) ? u = o[n] : Array.isArray(o.data) && (u = o.data)), {
454
+ return Array.isArray(o) ? u = o : le(o) && (Array.isArray(o.items) ? u = o.items : Array.isArray(o[n]) ? u = o[n] : Array.isArray(o.data) && (u = o.data)), {
432
455
  items: u,
433
- nextCursor: Qi(i, o)
456
+ nextCursor: Zi(i, o)
434
457
  };
435
458
  }
436
459
  function wn(e) {
437
- return de(e) && typeof e.id == "string" && e.id.length > 0;
460
+ return le(e) && typeof e.id == "string" && e.id.length > 0;
438
461
  }
439
462
  function Tn(e) {
440
- return de(e) ? typeof e.id == "string" && (e.type === "dm" || e.type === "group") && Array.isArray(e.participants) : !1;
463
+ return le(e) ? typeof e.id == "string" && (e.type === "dm" || e.type === "group") && Array.isArray(e.participants) : !1;
441
464
  }
442
465
  function nt(e, n) {
443
466
  if (e.is_pinned !== n.is_pinned)
@@ -451,12 +474,12 @@ function Ze(e, n) {
451
474
  function qe(e) {
452
475
  return [...e].sort((n, i) => n.sort_order !== i.sort_order ? n.sort_order - i.sort_order : n.name.localeCompare(i.name));
453
476
  }
454
- function Zi(e, n) {
477
+ function eo(e, n) {
455
478
  return typeof e != "string" || e.length === 0 ? null : n.has(e) ? e : null;
456
479
  }
457
480
  function En(e, n) {
458
481
  return e.map((i) => {
459
- const o = Zi(i.folder_id, n);
482
+ const o = eo(i.folder_id, n);
460
483
  return (i.folder_id ?? null) === o ? i : {
461
484
  ...i,
462
485
  folder_id: o
@@ -556,9 +579,9 @@ const Ft = ci("messaging", {
556
579
  await we.reorderFolders(e);
557
580
  const n = new Map(this.folders.map((u) => [u.id, u])), i = [];
558
581
  for (const u of e) {
559
- const l = n.get(u);
560
- l && (i.push({
561
- ...l,
582
+ const d = n.get(u);
583
+ d && (i.push({
584
+ ...d,
562
585
  sort_order: i.length + 1
563
586
  }), n.delete(u));
564
587
  }
@@ -575,16 +598,16 @@ const Ft = ci("messaging", {
575
598
  },
576
599
  async assignToFolder(e, n) {
577
600
  try {
578
- const i = await we.assignFolder(e, n), o = this.conversations.findIndex((d) => d.id === e);
601
+ const i = await we.assignFolder(e, n), o = this.conversations.findIndex((l) => l.id === e);
579
602
  if (o < 0)
580
603
  return;
581
604
  const u = this.conversations[o];
582
605
  if (!u)
583
606
  return;
584
- const l = typeof i.folder_id == "string" || i.folder_id === null ? i.folder_id : n;
607
+ const d = typeof i.folder_id == "string" || i.folder_id === null ? i.folder_id : n;
585
608
  this.conversations[o] = {
586
609
  ...u,
587
- folder_id: l
610
+ folder_id: d
588
611
  };
589
612
  } catch (i) {
590
613
  throw this.error = Z(i), i;
@@ -593,23 +616,23 @@ const Ft = ci("messaging", {
593
616
  async fetchConversations(e, n, i, o) {
594
617
  this.loading = !0, this.error = null;
595
618
  try {
596
- const u = o?.includePresence ?? !0, l = {};
597
- u && (l.include_presence = 1), e && (l.cursor = e), n && (l.filter = n), typeof i == "string" && i.length > 0 && (l.folder_id = i);
598
- const d = await X().get("/v1/messaging/conversations", { params: l }), { items: g, nextCursor: h } = Qe(
599
- d.data,
619
+ const u = o?.includePresence ?? !0, d = {};
620
+ u && (d.include_presence = 1), e && (d.cursor = e), n && (d.filter = n), typeof i == "string" && i.length > 0 && (d.folder_id = i);
621
+ const l = await V().get("/v1/messaging/conversations", { params: d }), { items: g, nextCursor: h } = Qe(
622
+ l.data,
600
623
  "conversations"
601
- ), M = g.map((m) => {
602
- const w = this.conversations.find(
603
- (P) => P.id === m.id
624
+ ), k = g.map((b) => {
625
+ const _ = this.conversations.find(
626
+ (E) => E.id === b.id
604
627
  );
605
- return Fe(m, w);
628
+ return Fe(b, _);
606
629
  });
607
- e ? this.conversations.push(...M) : this.conversations = M, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
608
- const k = {
609
- data: M,
630
+ e ? this.conversations.push(...k) : this.conversations = k, this.normalizeFolderAssignmentsState(), this.lastFetch = Date.now();
631
+ const x = {
632
+ data: k,
610
633
  has_more: !!h
611
634
  };
612
- return h !== void 0 && (k.next_cursor = h), k;
635
+ return h !== void 0 && (x.next_cursor = h), x;
613
636
  } catch (u) {
614
637
  throw o?.background && bn(u) || (this.error = Z(u)), u;
615
638
  } finally {
@@ -632,12 +655,12 @@ const Ft = ci("messaging", {
632
655
  async fetchConversation(e) {
633
656
  this.loading = !0, this.error = null;
634
657
  try {
635
- const n = await X().get(`/v1/messaging/conversations/${e}`, {
658
+ const n = await V().get(`/v1/messaging/conversations/${e}`, {
636
659
  params: { include_presence: 1 }
637
- }), i = this.conversations.find((d) => d.id === e), o = Fe(n.data.data || n.data, i), u = this.conversations.findIndex((d) => d.id === e);
660
+ }), i = this.conversations.find((l) => l.id === e), o = Fe(n.data.data || n.data, i), u = this.conversations.findIndex((l) => l.id === e);
638
661
  u >= 0 ? this.conversations[u] = o : this.conversations.push(o);
639
- const l = this.requests.findIndex((d) => d.id === e);
640
- return l >= 0 && (this.requests[l] = o), this.normalizeFolderAssignmentsState(), o;
662
+ const d = this.requests.findIndex((l) => l.id === e);
663
+ return d >= 0 && (this.requests[d] = o), this.normalizeFolderAssignmentsState(), o;
641
664
  } catch (n) {
642
665
  throw this.error = Z(n), n;
643
666
  } finally {
@@ -652,19 +675,19 @@ const Ft = ci("messaging", {
652
675
  filter: "requests"
653
676
  };
654
677
  e && (n.cursor = e);
655
- const i = await X().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: u } = Qe(
678
+ const i = await V().get("/v1/messaging/conversations", { params: n }), { items: o, nextCursor: u } = Qe(
656
679
  i.data,
657
680
  "conversations"
658
- ), l = o.map((g) => {
659
- const h = this.requests.find((M) => M.id === g.id);
681
+ ), d = o.map((g) => {
682
+ const h = this.requests.find((k) => k.id === g.id);
660
683
  return Fe(g, h);
661
684
  });
662
- e ? this.requests.push(...l) : this.requests = l, this.normalizeFolderAssignmentsState();
663
- const d = {
664
- data: l,
685
+ e ? this.requests.push(...d) : this.requests = d, this.normalizeFolderAssignmentsState();
686
+ const l = {
687
+ data: d,
665
688
  has_more: !!u
666
689
  };
667
- return u !== void 0 && (d.next_cursor = u), d;
690
+ return u !== void 0 && (l.next_cursor = u), l;
668
691
  } catch (n) {
669
692
  throw this.error = Z(n), n;
670
693
  } finally {
@@ -678,102 +701,104 @@ const Ft = ci("messaging", {
678
701
  let o = 0, u;
679
702
  for (; ; )
680
703
  try {
681
- u = await X().get(`/v1/messaging/conversations/${e}/messages`, { params: i });
704
+ u = await V().get(`/v1/messaging/conversations/${e}/messages`, { params: i });
682
705
  break;
683
- } catch (m) {
684
- if (!(o < Fi && bn(m)))
685
- throw m;
686
- o += 1, await yn(ji(m));
706
+ } catch (b) {
707
+ if (!(o < Fi && bn(b)))
708
+ throw b;
709
+ o += 1, await yn(ji(b));
687
710
  }
688
- const { items: l, nextCursor: d } = Qe(
711
+ const { items: d, nextCursor: l } = Qe(
689
712
  u.data,
690
713
  "messages"
691
- ), g = l.map(tt), h = [...g].reverse();
714
+ ), g = d.map(tt), h = [...g].reverse();
692
715
  if (n ? this.messages[e] = [...h, ...this.messages[e] || []] : this.messages[e] = h, (() => {
693
- const m = this.conversations.find((w) => w.id === e) ?? this.requests.find((w) => w.id === e);
694
- return m ? !m.last_message || !m.last_message_at : !1;
716
+ const b = this.conversations.find((_) => _.id === e) ?? this.requests.find((_) => _.id === e);
717
+ return b ? !b.last_message || !b.last_message_at : !1;
695
718
  })()) {
696
- const m = this.messages[e]?.at(-1);
697
- m && this.updateConversationLastMessage(e, m);
719
+ const b = this.messages[e]?.at(-1);
720
+ b && this.updateConversationLastMessage(e, b);
698
721
  }
699
- d ? (this.conversationCursors[e] = d, this.conversationHasMore[e] = !0) : (delete this.conversationCursors[e], this.conversationHasMore[e] = !1);
700
- const k = {
722
+ l ? (this.conversationCursors[e] = l, this.conversationHasMore[e] = !0) : (delete this.conversationCursors[e], this.conversationHasMore[e] = !1);
723
+ const x = {
701
724
  data: g,
702
- has_more: !!d
725
+ has_more: !!l
703
726
  };
704
- return d !== void 0 && (k.next_cursor = d), k;
727
+ return l !== void 0 && (x.next_cursor = l), x;
705
728
  } catch (i) {
706
729
  throw this.error = Z(i), i;
707
730
  } finally {
708
731
  this.loadingMessages[e] = !1, this.loading = !1;
709
732
  }
710
733
  },
711
- async sendMessage(e, n, i, o, u, l) {
712
- const d = Ie()(), g = `temp-${Date.now()}-${Math.random()}`, h = typeof l == "string" && l.trim().length > 0 ? l.trim() : null, M = d.currentUser, k = {
713
- id: g,
734
+ async sendMessage(e, n, i, o, u, d, l) {
735
+ const g = Ie()(), h = `temp-${Date.now()}-${Math.random()}`, k = typeof d == "string" && d.trim().length > 0 ? d.trim() : null, x = Gi(l), b = g.currentUser, _ = {
736
+ id: h,
714
737
  conversation_id: e,
715
- author_id: M?.id || "",
738
+ author_id: b?.id || "",
716
739
  body: n || "",
717
740
  attachments: [],
718
- meta: h ? { shared_post_id: h } : {},
741
+ meta: k ? { shared_post_id: k } : {},
742
+ ...x ? { shared_post: x } : {},
719
743
  is_deleted: !1,
720
744
  created_at: (/* @__PURE__ */ new Date()).toISOString(),
721
745
  updated_at: (/* @__PURE__ */ new Date()).toISOString()
722
746
  };
723
- M && (k.author = {
724
- id: M.id,
725
- name: M.name,
726
- ...M.avatar ? { avatar: M.avatar } : {},
727
- ...M.handle ? { handle: M.handle } : {}
728
- }), o != null && (k.reply_to_id = o), u != null && (k.reply_to = u), this.messages[e] || (this.messages[e] = []), this.messages[e].push(k), this._pendingSendIds.add(g);
747
+ b && (_.author = {
748
+ id: b.id,
749
+ name: b.name,
750
+ ...b.avatar ? { avatar: b.avatar } : {},
751
+ ...b.handle ? { handle: b.handle } : {}
752
+ }), o != null && (_.reply_to_id = o), u != null && (_.reply_to = u), this.messages[e] || (this.messages[e] = []), this.messages[e].push(_), this._pendingSendIds.add(h);
729
753
  try {
730
- let m;
731
- const w = {
754
+ let E;
755
+ const A = {
732
756
  body: n || "",
733
757
  ...o ? { reply_to_id: o } : {},
734
- ...h ? { shared_post_id: h } : {}
758
+ ...k ? { shared_post_id: k } : {},
759
+ ...x ? { shared_post_preview: x } : {}
735
760
  };
736
761
  if (i && i.length > 0) {
737
- const $ = await Promise.all(
738
- i.map(async (H) => {
739
- const x = await ki().uploadImage(H);
762
+ const P = await Promise.all(
763
+ i.map(async (U) => {
764
+ const j = await ki().uploadImage(U);
740
765
  return {
741
- media_id: x.id,
742
- mime: x.mime_type,
743
- size: x.size
766
+ media_id: j.id,
767
+ mime: j.mime_type,
768
+ size: j.size
744
769
  };
745
770
  })
746
771
  );
747
- m = await X().post(`/v1/messaging/conversations/${e}/messages`, {
748
- ...w,
749
- attachments: $
772
+ E = await V().post(`/v1/messaging/conversations/${e}/messages`, {
773
+ ...A,
774
+ attachments: P
750
775
  });
751
776
  } else
752
- m = await X().post(`/v1/messaging/conversations/${e}/messages`, {
753
- ...w,
777
+ E = await V().post(`/v1/messaging/conversations/${e}/messages`, {
778
+ ...A,
754
779
  type: "text"
755
780
  });
756
- const P = m.data.data || m.data, A = { ...k, ...P, attachments: P.attachments ?? k.attachments }, S = tt(A), f = this.messages[e], v = f.findIndex(($) => $.id === g);
757
- v >= 0 && (f[v] = S), this._pendingSendIds.delete(g);
758
- const b = S.id;
759
- let F = 0;
760
- for (let $ = f.length - 1; $ >= 0; $--) {
761
- const H = f[$];
762
- H && H.id === b && (F++, F > 1 && f.splice($, 1));
781
+ const w = E.data.data || E.data, f = { ..._, ...w, attachments: w.attachments ?? _.attachments }, m = tt(f), v = this.messages[e], F = v.findIndex((P) => P.id === h);
782
+ F >= 0 && (v[F] = m), this._pendingSendIds.delete(h);
783
+ const Y = m.id;
784
+ let B = 0;
785
+ for (let P = v.length - 1; P >= 0; P--) {
786
+ const U = v[P];
787
+ U && U.id === Y && (B++, B > 1 && v.splice(P, 1));
763
788
  }
764
- return this.updateConversationLastMessage(e, S), S;
765
- } catch (m) {
766
- throw this._pendingSendIds.delete(g), this.messages[e] = this.messages[e].filter((w) => w.id !== g), this.error = Z(m), m;
789
+ return this.updateConversationLastMessage(e, m), m;
790
+ } catch (E) {
791
+ throw this._pendingSendIds.delete(h), this.messages[e] = this.messages[e].filter((A) => A.id !== h), this.error = Z(E), E;
767
792
  }
768
793
  },
769
794
  async editMessage(e, n, i) {
770
795
  try {
771
- const o = await X().patch(`/v1/messaging/conversations/${e}/messages/${n}`, {
796
+ const o = await V().patch(`/v1/messaging/conversations/${e}/messages/${n}`, {
772
797
  body: i
773
- }), u = o.data.data || o.data, l = this.messages[e] || [], d = l.findIndex((g) => g.id === n);
774
- if (d >= 0) {
775
- const g = l[d], h = u.id ? { ...g, ...u } : { ...g, body: i, edited_at: (/* @__PURE__ */ new Date()).toISOString() };
776
- return l[d] = h, h;
798
+ }), u = o.data.data || o.data, d = this.messages[e] || [], l = d.findIndex((g) => g.id === n);
799
+ if (l >= 0) {
800
+ const g = d[l], h = u.id ? { ...g, ...u } : { ...g, body: i, edited_at: (/* @__PURE__ */ new Date()).toISOString() };
801
+ return d[l] = h, h;
777
802
  }
778
803
  return u;
779
804
  } catch (o) {
@@ -782,14 +807,14 @@ const Ft = ci("messaging", {
782
807
  },
783
808
  async deleteMessage(e, n) {
784
809
  try {
785
- await X().delete(`/v1/messaging/conversations/${e}/messages/${n}`);
810
+ await V().delete(`/v1/messaging/conversations/${e}/messages/${n}`);
786
811
  const i = this.messages[e] || [], o = i.findIndex((u) => u.id === n);
787
812
  if (o >= 0) {
788
813
  const u = i[o];
789
814
  if (!u)
790
815
  return;
791
- const l = { ...u, is_deleted: !0 };
792
- delete l.body, i[o] = l;
816
+ const d = { ...u, is_deleted: !0 };
817
+ delete d.body, i[o] = d;
793
818
  }
794
819
  } catch (i) {
795
820
  throw this.error = Z(i), i;
@@ -801,16 +826,16 @@ const Ft = ci("messaging", {
801
826
  const u = this.messages[e];
802
827
  if (!Array.isArray(u))
803
828
  return null;
804
- for (let l = u.length - 1; l >= 0; l -= 1) {
805
- const d = u[l]?.id;
806
- if (Mt(d))
807
- return d;
829
+ for (let d = u.length - 1; d >= 0; d -= 1) {
830
+ const l = u[d]?.id;
831
+ if (Mt(l))
832
+ return l;
808
833
  }
809
834
  return null;
810
835
  })(), o = n ? Sn(n, this.messages) : i;
811
836
  if (!o)
812
837
  return;
813
- await X().post(`/v1/messaging/conversations/${e}/read`, {
838
+ await V().post(`/v1/messaging/conversations/${e}/read`, {
814
839
  message_id: o
815
840
  }), this.conversations.forEach((u) => {
816
841
  u.id === e && (u.unread_count = 0);
@@ -826,27 +851,27 @@ const Ft = ci("messaging", {
826
851
  if (e.length === 0)
827
852
  return;
828
853
  const n = e.map((u) => {
829
- const l = Sn(u, this.messages);
830
- return l ? {
854
+ const d = Sn(u, this.messages);
855
+ return d ? {
831
856
  conversationId: u.id,
832
- messageId: l
857
+ messageId: d
833
858
  } : null;
834
859
  }).filter((u) => u !== null);
835
860
  if (n.length === 0)
836
861
  return;
837
862
  const i = await Promise.allSettled(
838
863
  n.map(
839
- (u) => X().post(`/v1/messaging/conversations/${u.conversationId}/read`, {
864
+ (u) => V().post(`/v1/messaging/conversations/${u.conversationId}/read`, {
840
865
  message_id: u.messageId
841
866
  })
842
867
  )
843
868
  );
844
869
  let o = null;
845
- if (i.forEach((u, l) => {
846
- const d = n[l];
847
- if (d) {
870
+ if (i.forEach((u, d) => {
871
+ const l = n[d];
872
+ if (l) {
848
873
  if (u.status === "fulfilled") {
849
- const g = this.conversations.find((h) => h.id === d.conversationId);
874
+ const g = this.conversations.find((h) => h.id === l.conversationId);
850
875
  g && (g.unread_count = 0);
851
876
  return;
852
877
  }
@@ -857,27 +882,27 @@ const Ft = ci("messaging", {
857
882
  },
858
883
  async sendTyping(e, n = "start") {
859
884
  try {
860
- const i = await X().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
885
+ const i = await V().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
861
886
  if (n !== "start" || !$i(i.data))
862
887
  return;
863
- await yn(qi), await X().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
888
+ await yn(qi), await V().post(`/v1/messaging/conversations/${e}/typing`, { state: n });
864
889
  } catch (i) {
865
890
  console.warn("Failed to send typing indicator:", i);
866
891
  }
867
892
  },
868
893
  async muteConversation(e, n) {
869
894
  try {
870
- const i = { minutes: n }, o = await X().patch(`/v1/messaging/conversations/${e}/mute`, i), l = (o.data.data || o.data).muted_until || null, d = this.conversations.find((g) => g.id === e);
871
- d && (d.is_muted = l !== null, d.muted_until = l);
895
+ const i = { minutes: n }, o = await V().patch(`/v1/messaging/conversations/${e}/mute`, i), d = (o.data.data || o.data).muted_until || null, l = this.conversations.find((g) => g.id === e);
896
+ l && (l.is_muted = d !== null, l.muted_until = d);
872
897
  } catch (i) {
873
898
  throw this.error = Z(i), i;
874
899
  }
875
900
  },
876
901
  async unmuteConversation(e) {
877
902
  try {
878
- const n = await X().patch(`/v1/messaging/conversations/${e}/mute`, {
903
+ const n = await V().patch(`/v1/messaging/conversations/${e}/mute`, {
879
904
  minutes: 0
880
- }), o = (n.data.data || n.data).muted_until || null, u = this.conversations.find((l) => l.id === e);
905
+ }), o = (n.data.data || n.data).muted_until || null, u = this.conversations.find((d) => d.id === e);
881
906
  u && (u.is_muted = o !== null, u.muted_until = o);
882
907
  } catch (n) {
883
908
  throw this.error = Z(n), n;
@@ -885,20 +910,20 @@ const Ft = ci("messaging", {
885
910
  },
886
911
  async updateConversationTitle(e, n) {
887
912
  try {
888
- const i = await X().patch(`/v1/messaging/conversations/${e}`, {
913
+ const i = await V().patch(`/v1/messaging/conversations/${e}`, {
889
914
  title: n
890
- }), o = i.data.data || i.data, u = typeof o?.title == "string" ? o.title : n, l = (d) => d.map((g) => g.id !== e ? g : {
915
+ }), o = i.data.data || i.data, u = typeof o?.title == "string" ? o.title : n, d = (l) => l.map((g) => g.id !== e ? g : {
891
916
  ...g,
892
917
  title: u
893
918
  });
894
- this.conversations = l(this.conversations), this.requests = l(this.requests);
919
+ this.conversations = d(this.conversations), this.requests = d(this.requests);
895
920
  } catch (i) {
896
921
  throw this.error = Z(i), i;
897
922
  }
898
923
  },
899
924
  async pinConversation(e, n) {
900
925
  try {
901
- await X().patch(`/v1/messaging/conversations/${e}/pin`, { pinned: n });
926
+ await V().patch(`/v1/messaging/conversations/${e}/pin`, { pinned: n });
902
927
  const i = this.conversations.find((o) => o.id === e);
903
928
  i && (i.is_pinned = n), this.conversations.sort(nt);
904
929
  } catch (i) {
@@ -907,14 +932,14 @@ const Ft = ci("messaging", {
907
932
  },
908
933
  async archiveConversation(e, n) {
909
934
  try {
910
- await X().patch(`/v1/messaging/conversations/${e}/archive`, { archived: n }), this.conversations = this.conversations.filter((i) => i.id !== e);
935
+ await V().patch(`/v1/messaging/conversations/${e}/archive`, { archived: n }), this.conversations = this.conversations.filter((i) => i.id !== e);
911
936
  } catch (i) {
912
937
  throw this.error = Z(i), i;
913
938
  }
914
939
  },
915
940
  async deleteConversation(e) {
916
941
  try {
917
- await X().delete(`/v1/messaging/conversations/${e}`), this.conversations = this.conversations.filter((n) => n.id !== e), delete this.messages[e], delete this.typingUsers[e], delete this.conversationCursors[e], delete this.conversationHasMore[e], delete this.loadingMessages[e];
942
+ await V().delete(`/v1/messaging/conversations/${e}`), this.conversations = this.conversations.filter((n) => n.id !== e), delete this.messages[e], delete this.typingUsers[e], delete this.conversationCursors[e], delete this.conversationHasMore[e], delete this.loadingMessages[e];
918
943
  } catch (n) {
919
944
  throw this.error = Z(n), n;
920
945
  }
@@ -925,18 +950,18 @@ const Ft = ci("messaging", {
925
950
  user_id: e
926
951
  };
927
952
  n && (i.message = n);
928
- const o = await X().post("/v1/messaging/conversations/dm", i), u = o.data.data || o.data;
953
+ const o = await V().post("/v1/messaging/conversations/dm", i), u = o.data.data || o.data;
929
954
  if (!wn(u))
930
955
  throw new Error("Invalid conversation payload from DM create endpoint.");
931
- const l = Tn(u) ? Fe(u) : await this.fetchConversation(u.id);
932
- return l.is_request === !0 ? (this.requests = Ze(this.requests, l), this.conversations = this.conversations.filter((d) => d.id !== l.id), l) : (this.conversations = Ze(this.conversations, l), this.requests = this.requests.filter((d) => d.id !== l.id), l);
956
+ const d = Tn(u) ? Fe(u) : await this.fetchConversation(u.id);
957
+ return d.is_request === !0 ? (this.requests = Ze(this.requests, d), this.conversations = this.conversations.filter((l) => l.id !== d.id), d) : (this.conversations = Ze(this.conversations, d), this.requests = this.requests.filter((l) => l.id !== d.id), d);
933
958
  } catch (i) {
934
959
  throw this.error = Z(i), i;
935
960
  }
936
961
  },
937
962
  async createGroupConversation(e, n) {
938
963
  try {
939
- const i = await X().post("/v1/messaging/conversations/group", {
964
+ const i = await V().post("/v1/messaging/conversations/group", {
940
965
  title: e,
941
966
  participant_ids: n
942
967
  }), o = i.data.data || i.data;
@@ -950,7 +975,7 @@ const Ft = ci("messaging", {
950
975
  },
951
976
  async addParticipants(e, n) {
952
977
  try {
953
- await X().post(`/v1/messaging/conversations/${e}/participants`, {
978
+ await V().post(`/v1/messaging/conversations/${e}/participants`, {
954
979
  user_ids: n
955
980
  // Changed from participant_ids to user_ids to match backend
956
981
  }), await this.fetchConversation(e);
@@ -960,7 +985,7 @@ const Ft = ci("messaging", {
960
985
  },
961
986
  async removeParticipant(e, n) {
962
987
  try {
963
- await X().delete(`/v1/messaging/conversations/${e}/participants/${n}`);
988
+ await V().delete(`/v1/messaging/conversations/${e}/participants/${n}`);
964
989
  const i = Ie()();
965
990
  if (n === i.currentUser?.id) {
966
991
  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];
@@ -976,11 +1001,11 @@ const Ft = ci("messaging", {
976
1001
  if (!n)
977
1002
  return;
978
1003
  let i = !1;
979
- const o = n.participants.map((d) => d.user_id !== e.user_id || d.last_read_message_id === e.message_id ? d : (i = !0, {
980
- ...d,
1004
+ const o = n.participants.map((l) => l.user_id !== e.user_id || l.last_read_message_id === e.message_id ? l : (i = !0, {
1005
+ ...l,
981
1006
  last_read_message_id: e.message_id
982
1007
  }));
983
- i && (n.participants = o), !this.getMessagesByConversationId(e.conversation_id).some((d) => d.id === e.message_id) && this.fetchConversation(e.conversation_id).catch(() => {
1008
+ i && (n.participants = o), !this.getMessagesByConversationId(e.conversation_id).some((l) => l.id === e.message_id) && this.fetchConversation(e.conversation_id).catch(() => {
984
1009
  });
985
1010
  },
986
1011
  // Real-time event handlers
@@ -994,20 +1019,20 @@ const Ft = ci("messaging", {
994
1019
  const i = tt({ ...e, attachments: e.attachments ?? [] }), o = this.messages[n];
995
1020
  if (o.find((h) => h.id === i.id))
996
1021
  return;
997
- const l = Ie()();
998
- if (i.author_id === l.currentUser?.id) {
999
- const h = o.findIndex((M) => M.id.startsWith("temp-"));
1022
+ const d = Ie()();
1023
+ if (i.author_id === d.currentUser?.id) {
1024
+ const h = o.findIndex((k) => k.id.startsWith("temp-"));
1000
1025
  if (h >= 0) {
1001
- const M = o[h]?.id ?? "";
1002
- o[h] = i, this._pendingSendIds.delete(M), this.updateConversationLastMessage(n, i);
1026
+ const k = o[h]?.id ?? "";
1027
+ o[h] = i, this._pendingSendIds.delete(k), this.updateConversationLastMessage(n, i);
1003
1028
  return;
1004
1029
  }
1005
1030
  }
1006
- const d = i.created_at;
1031
+ const l = i.created_at;
1007
1032
  let g = o.length;
1008
1033
  for (let h = o.length - 1; h >= 0; h--) {
1009
- const M = o[h];
1010
- if (M && M.created_at <= d)
1034
+ const k = o[h];
1035
+ if (k && k.created_at <= l)
1011
1036
  break;
1012
1037
  g = h;
1013
1038
  }
@@ -1019,50 +1044,50 @@ const Ft = ci("messaging", {
1019
1044
  },
1020
1045
  removeMessage(e, n) {
1021
1046
  const i = (h) => {
1022
- const M = { ...h, is_deleted: !0 };
1023
- return delete M.body, M;
1047
+ const k = { ...h, is_deleted: !0 };
1048
+ return delete k.body, k;
1024
1049
  };
1025
1050
  let o = null;
1026
1051
  const u = this.conversations.find((h) => h.id === e);
1027
1052
  u?.last_message?.id === n && (o = i(u.last_message), u.last_message = o);
1028
- const l = this.requests.find((h) => h.id === e);
1029
- if (l?.last_message?.id === n) {
1030
- const h = i(l.last_message);
1031
- l.last_message = h, o === null && (o = h);
1053
+ const d = this.requests.find((h) => h.id === e);
1054
+ if (d?.last_message?.id === n) {
1055
+ const h = i(d.last_message);
1056
+ d.last_message = h, o === null && (o = h);
1032
1057
  }
1033
- const d = this.messages[e];
1034
- if (!d) {
1058
+ const l = this.messages[e];
1059
+ if (!l) {
1035
1060
  o && this.addMessage(o);
1036
1061
  return;
1037
1062
  }
1038
- const g = d.findIndex((h) => h.id === n);
1063
+ const g = l.findIndex((h) => h.id === n);
1039
1064
  if (g >= 0) {
1040
- const h = d[g];
1041
- h && (d[g] = i(h));
1065
+ const h = l[g];
1066
+ h && (l[g] = i(h));
1042
1067
  return;
1043
1068
  }
1044
1069
  o && this.addMessage(o);
1045
1070
  },
1046
1071
  async toggleReaction(e, n, i) {
1047
- const o = `/v1/messaging/conversations/${e}/messages/${n}/reactions`, u = { reaction: i }, d = this.messages[e]?.find((g) => g.id === n)?.reactions ?? [];
1072
+ const o = `/v1/messaging/conversations/${e}/messages/${n}/reactions`, u = { reaction: i }, l = this.messages[e]?.find((g) => g.id === n)?.reactions ?? [];
1048
1073
  try {
1049
1074
  let g;
1050
1075
  try {
1051
- g = await X().post(o, u);
1052
- } catch (m) {
1053
- if (!Yi(m))
1054
- throw m;
1055
- g = await X().post(o, u);
1076
+ g = await V().post(o, u);
1077
+ } catch (b) {
1078
+ if (!Qi(b))
1079
+ throw b;
1080
+ g = await V().post(o, u);
1056
1081
  }
1057
- const h = de(g.data) && "data" in g.data ? g.data.data : g.data, M = Cn(
1058
- de(h) ? h.reactions : void 0
1082
+ const h = le(g.data) && "data" in g.data ? g.data.data : g.data, k = Cn(
1083
+ le(h) ? h.reactions : void 0
1059
1084
  );
1060
- (M.length > 0 || d.length === 0) && this.updateMessageReactions(e, n, M);
1085
+ (k.length > 0 || l.length === 0) && this.updateMessageReactions(e, n, k);
1061
1086
  try {
1062
- const m = await X().get(o), w = de(m.data) && "data" in m.data ? m.data.data : m.data, P = Cn(
1063
- de(w) ? w.reactions : void 0
1087
+ const b = await V().get(o), _ = le(b.data) && "data" in b.data ? b.data.data : b.data, E = Cn(
1088
+ le(_) ? _.reactions : void 0
1064
1089
  );
1065
- this.updateMessageReactions(e, n, P);
1090
+ this.updateMessageReactions(e, n, E);
1066
1091
  } catch {
1067
1092
  }
1068
1093
  } catch (g) {
@@ -1074,10 +1099,10 @@ const Ft = ci("messaging", {
1074
1099
  return;
1075
1100
  const o = this.messages[e];
1076
1101
  if (!o) return;
1077
- const u = o.findIndex((l) => l.id === n);
1102
+ const u = o.findIndex((d) => d.id === n);
1078
1103
  if (u >= 0) {
1079
- const l = o[u];
1080
- l && (o[u] = { ...l, reactions: i });
1104
+ const d = o[u];
1105
+ d && (o[u] = { ...d, reactions: i });
1081
1106
  }
1082
1107
  },
1083
1108
  addTypingUser(e, n) {
@@ -1087,9 +1112,9 @@ const Ft = ci("messaging", {
1087
1112
  this.typingUsers[e] && (this.typingUsers[e] = this.typingUsers[e].filter((i) => i.id !== n));
1088
1113
  },
1089
1114
  updateConversationLastMessage(e, n) {
1090
- const i = (l) => {
1091
- const d = l.find((g) => g.id === e);
1092
- return d ? (d.last_message = n, d.last_message_at = n.created_at, !0) : !1;
1115
+ const i = (d) => {
1116
+ const l = d.find((g) => g.id === e);
1117
+ return l ? (l.last_message = n, l.last_message_at = n.created_at, !0) : !1;
1093
1118
  }, o = i(this.conversations), u = i(this.requests);
1094
1119
  o && this.conversations.sort(nt), u && this.requests.sort(nt);
1095
1120
  },
@@ -1125,13 +1150,13 @@ const Ft = ci("messaging", {
1125
1150
  try {
1126
1151
  const o = { search: e, limit: 20 };
1127
1152
  n && (o.filter = n), typeof i == "string" && i.length > 0 && (o.folder_id = i);
1128
- const u = await X().get("/v1/messaging/conversations", {
1153
+ const u = await V().get("/v1/messaging/conversations", {
1129
1154
  params: o
1130
- }), { items: l } = Qe(
1155
+ }), { items: d } = Qe(
1131
1156
  u.data,
1132
1157
  "conversations"
1133
1158
  );
1134
- return l;
1159
+ return d;
1135
1160
  } catch (o) {
1136
1161
  return this.error = Z(o), [];
1137
1162
  } finally {
@@ -1141,7 +1166,7 @@ const Ft = ci("messaging", {
1141
1166
  async searchMessages(e, n) {
1142
1167
  this.searchLoading = !0;
1143
1168
  try {
1144
- const i = await X().get(`/v1/messaging/conversations/${e}/search`, {
1169
+ const i = await V().get(`/v1/messaging/conversations/${e}/search`, {
1145
1170
  params: { q: n }
1146
1171
  }), o = i.data.data || i.data || [];
1147
1172
  return this.searchResults = o, o;
@@ -1186,156 +1211,156 @@ const Ft = ci("messaging", {
1186
1211
  }
1187
1212
  }
1188
1213
  });
1189
- function Na(e) {
1190
- const n = Ft(), i = Ie()(), o = he(!1), u = he(null), l = he(null), d = kt(), g = d !== null, h = 20, M = 250;
1191
- let k = 0, m = null, w = null;
1192
- const P = re(() => i.currentUser?.id), A = () => Ln(e)?.trim() ?? "";
1193
- function S() {
1194
- m && (clearTimeout(m), m = null), k = 0;
1214
+ function Da(e) {
1215
+ const n = Ft(), i = Ie()(), o = he(!1), u = he(null), d = he(null), l = kt(), g = l !== null, h = 20, k = 250;
1216
+ let x = 0, b = null, _ = null;
1217
+ const E = re(() => i.currentUser?.id), A = () => Ln(e)?.trim() ?? "";
1218
+ function w() {
1219
+ b && (clearTimeout(b), b = null), x = 0;
1195
1220
  }
1196
1221
  function f() {
1197
- !g || o.value || m || k >= h || (m = setTimeout(() => {
1198
- m = null, k += 1, N();
1199
- }, M));
1200
- }
1201
- function v(_) {
1202
- if (n.addMessage(_.message), _.message.author_id !== P.value) {
1203
- const W = n.getConversationById(_.conversation_id);
1204
- W && (W.unread_count = 0), n.markAsRead(_.conversation_id).catch(() => {
1222
+ !g || o.value || b || x >= h || (b = setTimeout(() => {
1223
+ b = null, x += 1, N();
1224
+ }, k));
1225
+ }
1226
+ function m(S) {
1227
+ if (n.addMessage(S.message), S.message.author_id !== E.value) {
1228
+ const X = n.getConversationById(S.conversation_id);
1229
+ X && (X.unread_count = 0), n.markAsRead(S.conversation_id).catch(() => {
1205
1230
  });
1206
1231
  }
1207
1232
  }
1208
- function b(_) {
1209
- n.applyParticipantReadState(_);
1210
- }
1211
- function F(_) {
1212
- const W = n.getMessagesByConversationId(_.conversation_id), E = W.findIndex((R) => R.id === _.message.id);
1213
- if (E >= 0) {
1214
- const R = W[E];
1215
- if (!R) return;
1216
- const y = { ...R };
1217
- _.message.body !== void 0 && (y.body = _.message.body), _.message.edited_at !== void 0 && (y.edited_at = _.message.edited_at), _.message.meta !== void 0 && (y.meta = _.message.meta), W[E] = y;
1218
- const O = n.getConversationById(_.conversation_id);
1219
- O && O.last_message?.id === _.message.id && (O.last_message = y);
1233
+ function v(S) {
1234
+ n.applyParticipantReadState(S);
1235
+ }
1236
+ function F(S) {
1237
+ const X = n.getMessagesByConversationId(S.conversation_id), R = X.findIndex((M) => M.id === S.message.id);
1238
+ if (R >= 0) {
1239
+ const M = X[R];
1240
+ if (!M) return;
1241
+ const y = { ...M };
1242
+ S.message.body !== void 0 && (y.body = S.message.body), S.message.edited_at !== void 0 && (y.edited_at = S.message.edited_at), S.message.meta !== void 0 && (y.meta = S.message.meta), X[R] = y;
1243
+ const O = n.getConversationById(S.conversation_id);
1244
+ O && O.last_message?.id === S.message.id && (O.last_message = y);
1220
1245
  }
1221
1246
  }
1222
- function $(_) {
1223
- n.removeMessage(_.conversation_id, _.message_id);
1247
+ function Y(S) {
1248
+ n.removeMessage(S.conversation_id, S.message_id);
1224
1249
  }
1225
- function H(_) {
1250
+ function B(S) {
1226
1251
  n.updateMessageReactions(
1227
- _.conversation_id,
1228
- _.message_id,
1229
- _.reactions
1252
+ S.conversation_id,
1253
+ S.message_id,
1254
+ S.reactions
1230
1255
  );
1231
1256
  }
1232
- function x(_) {
1233
- const W = n.getConversationById(_.conversation_id);
1234
- W && (W.is_request = !1), n.requests = n.requests.filter(
1235
- (E) => E.id !== _.conversation_id
1257
+ function P(S) {
1258
+ const X = n.getConversationById(S.conversation_id);
1259
+ X && (X.is_request = !1), n.requests = n.requests.filter(
1260
+ (R) => R.id !== S.conversation_id
1236
1261
  );
1237
1262
  }
1238
- function U(_) {
1239
- _.removed_user_id === P.value && (j(), n.deleteConversation(_.conversation_id).catch(() => {
1263
+ function U(S) {
1264
+ S.removed_user_id === E.value && ($(), n.deleteConversation(S.conversation_id).catch(() => {
1240
1265
  }));
1241
1266
  }
1242
- function B(_) {
1243
- const W = l.value;
1244
- w && (w(), w = null), W && (_ && !n.hasGlobalConversationSubscription(W) && mi(W), n.unregisterDetailSubscription(W), l.value = null), o.value = !1;
1267
+ function j(S) {
1268
+ const X = d.value;
1269
+ _ && (_(), _ = null), X && (S && !n.hasGlobalConversationSubscription(X) && mi(X), n.unregisterDetailSubscription(X), d.value = null), o.value = !1;
1245
1270
  }
1246
1271
  function N() {
1247
- const _ = A();
1248
- if (!(o.value || !_)) {
1272
+ const S = A();
1273
+ if (!(o.value || !S)) {
1249
1274
  if (!ke()) {
1250
1275
  f();
1251
1276
  return;
1252
1277
  }
1253
1278
  u.value = null;
1254
1279
  try {
1255
- w = gi(_, {
1256
- onMessageSent: v,
1257
- onMessageRead: b,
1280
+ _ = gi(S, {
1281
+ onMessageSent: m,
1282
+ onMessageRead: v,
1258
1283
  onMessageEdited: F,
1259
- onMessageDeleted: $,
1260
- onReactionToggled: H,
1261
- onRequestAccepted: x,
1284
+ onMessageDeleted: Y,
1285
+ onReactionToggled: B,
1286
+ onRequestAccepted: P,
1262
1287
  onParticipantRemoved: U
1263
- }), o.value = !0, l.value = _, n.registerDetailSubscription(_), S();
1264
- } catch (W) {
1265
- u.value = W instanceof Error ? W.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", W);
1288
+ }), o.value = !0, d.value = S, n.registerDetailSubscription(S), w();
1289
+ } catch (X) {
1290
+ u.value = X instanceof Error ? X.message : "Failed to subscribe to conversation", console.error("ConversationChannel: Subscribe error", X);
1266
1291
  }
1267
1292
  }
1268
1293
  }
1269
- function K() {
1294
+ function J() {
1270
1295
  o.value || N();
1271
1296
  }
1272
- typeof window < "u" && window.addEventListener($e(), K);
1273
- const ie = ot((_) => {
1274
- if (_ === "connected") {
1297
+ typeof window < "u" && window.addEventListener($e(), J);
1298
+ const ie = ot((S) => {
1299
+ if (S === "connected") {
1275
1300
  o.value || N();
1276
1301
  return;
1277
1302
  }
1278
- (_ === "disconnected" || _ === "error") && (S(), B(!1));
1303
+ (S === "disconnected" || S === "error") && (w(), j(!1));
1279
1304
  });
1280
- function j() {
1281
- if (S(), !(!o.value || !l.value))
1305
+ function $() {
1306
+ if (w(), !(!o.value || !d.value))
1282
1307
  try {
1283
- B(!0), u.value = null;
1284
- } catch (_) {
1285
- u.value = _ instanceof Error ? _.message : "Failed to unsubscribe from conversation", console.error("ConversationChannel: Unsubscribe error", _);
1308
+ j(!0), u.value = null;
1309
+ } catch (S) {
1310
+ u.value = S instanceof Error ? S.message : "Failed to unsubscribe from conversation", console.error("ConversationChannel: Unsubscribe error", S);
1286
1311
  }
1287
1312
  }
1288
1313
  return At(
1289
1314
  () => A(),
1290
- (_, W) => {
1291
- if (_ !== W) {
1292
- if (S(), o.value && B(!0), !_) {
1315
+ (S, X) => {
1316
+ if (S !== X) {
1317
+ if (w(), o.value && j(!0), !S) {
1293
1318
  u.value = null;
1294
1319
  return;
1295
1320
  }
1296
1321
  N();
1297
1322
  }
1298
1323
  }
1299
- ), d !== null && He(() => {
1300
- S(), ie(), j(), typeof window < "u" && window.removeEventListener($e(), K);
1324
+ ), l !== null && He(() => {
1325
+ w(), ie(), $(), typeof window < "u" && window.removeEventListener($e(), J);
1301
1326
  }), {
1302
1327
  isSubscribed: re(() => o.value),
1303
1328
  error: re(() => u.value),
1304
1329
  subscribe: N,
1305
- unsubscribe: j
1330
+ unsubscribe: $
1306
1331
  };
1307
1332
  }
1308
1333
  const Kn = () => () => {
1309
1334
  }, Yn = async () => {
1310
- }, le = {
1335
+ }, de = {
1311
1336
  initializedEvent: "messenger-client:main-echo-initialized",
1312
1337
  getEcho: () => null,
1313
1338
  getConnectionStatus: () => "disconnected",
1314
1339
  onConnectionStatusChange: Kn,
1315
1340
  reconnect: Yn
1316
1341
  };
1317
- function eo() {
1318
- return le.initializedEvent;
1319
- }
1320
1342
  function to() {
1321
- return le.getEcho();
1343
+ return de.initializedEvent;
1322
1344
  }
1323
1345
  function no() {
1324
- return le.getConnectionStatus();
1346
+ return de.getEcho();
1325
1347
  }
1326
- function so(e) {
1327
- return le.onConnectionStatusChange(e);
1348
+ function so() {
1349
+ return de.getConnectionStatus();
1328
1350
  }
1329
- async function ro() {
1330
- await le.reconnect();
1351
+ function ro(e) {
1352
+ return de.onConnectionStatusChange(e);
1331
1353
  }
1332
- function io(e) {
1333
- e.initializedEvent && (le.initializedEvent = e.initializedEvent), e.getEcho && (le.getEcho = e.getEcho), e.getConnectionStatus && (le.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (le.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (le.reconnect = e.reconnect);
1354
+ async function io() {
1355
+ await de.reconnect();
1334
1356
  }
1335
- function oo() {
1336
- le.initializedEvent = "messenger-client:main-echo-initialized", le.getEcho = () => null, le.getConnectionStatus = () => "disconnected", le.onConnectionStatusChange = Kn, le.reconnect = Yn;
1357
+ function oo(e) {
1358
+ e.initializedEvent && (de.initializedEvent = e.initializedEvent), e.getEcho && (de.getEcho = e.getEcho), e.getConnectionStatus && (de.getConnectionStatus = e.getConnectionStatus), e.onConnectionStatusChange && (de.onConnectionStatusChange = e.onConnectionStatusChange), e.reconnect && (de.reconnect = e.reconnect);
1337
1359
  }
1338
- const ao = {
1360
+ function ao() {
1361
+ de.initializedEvent = "messenger-client:main-echo-initialized", de.getEcho = () => null, de.getConnectionStatus = () => "disconnected", de.onConnectionStatusChange = Kn, de.reconnect = Yn;
1362
+ }
1363
+ const co = {
1339
1364
  debug: () => {
1340
1365
  },
1341
1366
  info: () => {
@@ -1344,18 +1369,18 @@ const ao = {
1344
1369
  },
1345
1370
  error: () => {
1346
1371
  }
1347
- }, Qn = () => ao;
1372
+ }, Qn = () => co;
1348
1373
  let qt = Qn;
1349
1374
  function zt() {
1350
1375
  return qt;
1351
1376
  }
1352
- function co(e) {
1377
+ function uo(e) {
1353
1378
  qt = e;
1354
1379
  }
1355
- function uo() {
1380
+ function lo() {
1356
1381
  qt = Qn;
1357
1382
  }
1358
- const lo = {
1383
+ const ho = {
1359
1384
  connected: "",
1360
1385
  connecting: "",
1361
1386
  disconnected: "",
@@ -1365,7 +1390,7 @@ const lo = {
1365
1390
  function An(e) {
1366
1391
  return e?.connector?.pusher?.connection ?? null;
1367
1392
  }
1368
- function ho(e) {
1393
+ function fo(e) {
1369
1394
  return e === "messenger" ? {
1370
1395
  initializedEvent: $e(),
1371
1396
  getConnectionStatus: Hn,
@@ -1373,24 +1398,24 @@ function ho(e) {
1373
1398
  reconnect: hi,
1374
1399
  getEchoConnection: () => An(ke())
1375
1400
  } : {
1376
- initializedEvent: eo(),
1377
- getConnectionStatus: no,
1378
- onConnectionStatusChange: so,
1379
- reconnect: ro,
1380
- getEchoConnection: () => An(to())
1401
+ initializedEvent: to(),
1402
+ getConnectionStatus: so,
1403
+ onConnectionStatusChange: ro,
1404
+ reconnect: io,
1405
+ getEchoConnection: () => An(no())
1381
1406
  };
1382
1407
  }
1383
1408
  function Pn(e) {
1384
1409
  return e.getEchoConnection()?.state ?? null;
1385
1410
  }
1386
- function Da(e = {}) {
1387
- const o = ho(e.source ?? "app"), u = {
1388
- ...lo,
1411
+ function Fa(e = {}) {
1412
+ const o = fo(e.source ?? "app"), u = {
1413
+ ...ho,
1389
1414
  ...e.icons
1390
- }, l = he(o.getConnectionStatus()), d = he(null), g = he(0), h = he(!1), M = he(!1), k = he(!1), m = he(!1);
1391
- let w = null, P = null, A = null, S = null, f = null, v = null, b = null;
1392
- const F = re(() => l.value === "connected"), $ = re(() => l.value === "connecting"), H = re(() => l.value === "disconnected"), x = re(() => l.value === "error"), U = re(() => H.value || x.value), B = re(() => {
1393
- switch (l.value) {
1415
+ }, d = he(o.getConnectionStatus()), l = he(null), g = he(0), h = he(!1), k = he(!1), x = he(!1), b = he(!1);
1416
+ let _ = null, E = null, A = null, w = null, f = null, m = null, v = null;
1417
+ const F = re(() => d.value === "connected"), Y = re(() => d.value === "connecting"), B = re(() => d.value === "disconnected"), P = re(() => d.value === "error"), U = re(() => B.value || P.value), j = re(() => {
1418
+ switch (d.value) {
1394
1419
  case "connecting":
1395
1420
  return g.value > 0 ? "Reconnecting..." : "Connecting...";
1396
1421
  case "connected":
@@ -1403,7 +1428,7 @@ function Da(e = {}) {
1403
1428
  return "Unknown connection state";
1404
1429
  }
1405
1430
  }), N = re(() => {
1406
- switch (l.value) {
1431
+ switch (d.value) {
1407
1432
  case "connected":
1408
1433
  return "success";
1409
1434
  case "connecting":
@@ -1414,8 +1439,8 @@ function Da(e = {}) {
1414
1439
  default:
1415
1440
  return "medium";
1416
1441
  }
1417
- }), K = re(() => {
1418
- switch (l.value) {
1442
+ }), J = re(() => {
1443
+ switch (d.value) {
1419
1444
  case "connected":
1420
1445
  return u.connected;
1421
1446
  case "connecting":
@@ -1429,12 +1454,12 @@ function Da(e = {}) {
1429
1454
  }
1430
1455
  }), ie = async () => {
1431
1456
  Rn.debug("Manual reconnect triggered"), g.value += 1, await o.reconnect();
1432
- }, j = (y, O = l.value) => {
1433
- if (y !== "connecting" && P && (clearTimeout(P), P = null), y === "disconnected" || y === "error") {
1434
- const ne = !m.value && O === y, ve = !M.value && (ne || O === "connected" || O === "connecting");
1435
- if (k.value = !0, ve) {
1457
+ }, $ = (y, O = d.value) => {
1458
+ if (y !== "connecting" && E && (clearTimeout(E), E = null), y === "disconnected" || y === "error") {
1459
+ const ne = !b.value && O === y, ve = !k.value && (ne || O === "connected" || O === "connecting");
1460
+ if (x.value = !0, ve) {
1436
1461
  h.value = !1, A && clearTimeout(A), A = setTimeout(() => {
1437
- A = null, l.value !== "connected" && (h.value = !0);
1462
+ A = null, d.value !== "connected" && (h.value = !0);
1438
1463
  }, 2e3);
1439
1464
  return;
1440
1465
  }
@@ -1442,108 +1467,108 @@ function Da(e = {}) {
1442
1467
  return;
1443
1468
  }
1444
1469
  if (y === "connected") {
1445
- A && (clearTimeout(A), A = null), h.value = !1, M.value = !1, k.value = !1;
1470
+ A && (clearTimeout(A), A = null), h.value = !1, k.value = !1, x.value = !1;
1446
1471
  return;
1447
1472
  }
1448
1473
  if (y === "connecting") {
1449
- if (M.value) {
1474
+ if (k.value) {
1450
1475
  h.value = !0;
1451
1476
  return;
1452
1477
  }
1453
- if (k.value || (h.value = !1), P)
1478
+ if (x.value || (h.value = !1), E)
1454
1479
  return;
1455
- P = setTimeout(() => {
1456
- if (P = null, l.value === "connecting") {
1480
+ E = setTimeout(() => {
1481
+ if (E = null, d.value === "connecting") {
1457
1482
  if (Pn(o) === "connected") {
1458
- _("connected");
1483
+ S("connected");
1459
1484
  return;
1460
1485
  }
1461
- M.value = !0, Rn.warn("Still connecting after 10s, treating as disconnected"), _("disconnected"), g.value += 1, o.reconnect();
1486
+ k.value = !0, Rn.warn("Still connecting after 10s, treating as disconnected"), S("disconnected"), g.value += 1, o.reconnect();
1462
1487
  }
1463
1488
  }, 1e4);
1464
1489
  }
1465
- }, _ = (y) => {
1466
- const O = l.value;
1467
- if (y === "connecting" && M.value) {
1468
- l.value = "disconnected", j("disconnected", O);
1490
+ }, S = (y) => {
1491
+ const O = d.value;
1492
+ if (y === "connecting" && k.value) {
1493
+ d.value = "disconnected", $("disconnected", O);
1469
1494
  return;
1470
1495
  }
1471
- l.value = y, y === "connecting" && (O === "disconnected" || O === "error") && g.value === 0 && (g.value = 1), y === "connected" && (d.value = /* @__PURE__ */ new Date(), g.value = 0), j(y, O);
1472
- }, W = () => {
1473
- const y = Pn(o), O = l.value;
1496
+ d.value = y, y === "connecting" && (O === "disconnected" || O === "error") && g.value === 0 && (g.value = 1), y === "connected" && (l.value = /* @__PURE__ */ new Date(), g.value = 0), $(y, O);
1497
+ }, X = () => {
1498
+ const y = Pn(o), O = d.value;
1474
1499
  if (y === "connected" && O !== "connected") {
1475
- _("connected");
1500
+ S("connected");
1476
1501
  return;
1477
1502
  }
1478
1503
  if (y === "connecting" && O !== "connecting") {
1479
- _("connecting");
1504
+ S("connecting");
1480
1505
  return;
1481
1506
  }
1482
1507
  if ((y === "unavailable" || y === "failed" || y === "disconnected") && O !== "disconnected") {
1483
- _("disconnected");
1508
+ S("disconnected");
1484
1509
  return;
1485
1510
  }
1486
1511
  const ne = o.getConnectionStatus();
1487
- !y && ne === "connected" && O !== "connected" && _("connected");
1488
- }, E = () => {
1489
- if (f?.unbind && b && (f.unbind("connected", b.connected), f.unbind("connecting", b.connecting), f.unbind("disconnected", b.disconnected), f.unbind("unavailable", b.unavailable), f.unbind("error", b.error), f.unbind("state_change", b.stateChange)), f = o.getEchoConnection(), b = null, !f?.bind)
1512
+ !y && ne === "connected" && O !== "connected" && S("connected");
1513
+ }, R = () => {
1514
+ if (f?.unbind && v && (f.unbind("connected", v.connected), f.unbind("connecting", v.connecting), f.unbind("disconnected", v.disconnected), f.unbind("unavailable", v.unavailable), f.unbind("error", v.error), f.unbind("state_change", v.stateChange)), f = o.getEchoConnection(), v = null, !f?.bind)
1490
1515
  return;
1491
- b = {
1492
- connected: () => _("connected"),
1493
- connecting: () => _("connecting"),
1494
- disconnected: () => _("disconnected"),
1495
- unavailable: () => _("disconnected"),
1496
- error: () => _("error"),
1516
+ v = {
1517
+ connected: () => S("connected"),
1518
+ connecting: () => S("connecting"),
1519
+ disconnected: () => S("disconnected"),
1520
+ unavailable: () => S("disconnected"),
1521
+ error: () => S("error"),
1497
1522
  stateChange: (O) => {
1498
1523
  const ne = O?.current;
1499
1524
  if (ne === "connected") {
1500
- _("connected");
1525
+ S("connected");
1501
1526
  return;
1502
1527
  }
1503
1528
  if (ne === "connecting") {
1504
- _("connecting");
1529
+ S("connecting");
1505
1530
  return;
1506
1531
  }
1507
- (ne === "unavailable" || ne === "failed" || ne === "disconnected") && _("disconnected");
1532
+ (ne === "unavailable" || ne === "failed" || ne === "disconnected") && S("disconnected");
1508
1533
  }
1509
- }, f.bind("connected", b.connected), f.bind("connecting", b.connecting), f.bind("disconnected", b.disconnected), f.bind("unavailable", b.unavailable), f.bind("error", b.error), f.bind("state_change", b.stateChange);
1534
+ }, f.bind("connected", v.connected), f.bind("connecting", v.connecting), f.bind("disconnected", v.disconnected), f.bind("unavailable", v.unavailable), f.bind("error", v.error), f.bind("state_change", v.stateChange);
1510
1535
  const y = f.state ?? null;
1511
1536
  if (y === "connected") {
1512
- _("connected");
1537
+ S("connected");
1513
1538
  return;
1514
1539
  }
1515
1540
  if (y === "connecting") {
1516
- _("connecting");
1541
+ S("connecting");
1517
1542
  return;
1518
1543
  }
1519
- (y === "unavailable" || y === "failed" || y === "disconnected") && _("disconnected");
1520
- }, R = re(() => {
1521
- if (!d.value || !F.value)
1544
+ (y === "unavailable" || y === "failed" || y === "disconnected") && S("disconnected");
1545
+ }, M = re(() => {
1546
+ if (!l.value || !F.value)
1522
1547
  return null;
1523
- const y = Date.now() - d.value.getTime(), O = Math.floor(y / 6e4), ne = Math.floor(y % 6e4 / 1e3);
1548
+ const y = Date.now() - l.value.getTime(), O = Math.floor(y / 6e4), ne = Math.floor(y % 6e4 / 1e3);
1524
1549
  return O > 0 ? `${O}m ${ne}s` : `${ne}s`;
1525
1550
  });
1526
1551
  return Un(() => {
1527
- l.value = o.getConnectionStatus(), w = o.onConnectionStatusChange(_), F.value && (d.value = /* @__PURE__ */ new Date()), j(l.value, l.value), m.value = !0, E(), v = () => {
1528
- E(), W();
1529
- }, window.addEventListener(o.initializedEvent, v), W(), S = setInterval(() => {
1530
- W();
1552
+ d.value = o.getConnectionStatus(), _ = o.onConnectionStatusChange(S), F.value && (l.value = /* @__PURE__ */ new Date()), $(d.value, d.value), b.value = !0, R(), m = () => {
1553
+ R(), X();
1554
+ }, window.addEventListener(o.initializedEvent, m), X(), w = setInterval(() => {
1555
+ X();
1531
1556
  }, 3e3);
1532
1557
  }), He(() => {
1533
- w?.(), P && (clearTimeout(P), P = null), A && (clearTimeout(A), A = null), S && (clearInterval(S), S = null), v && (window.removeEventListener(o.initializedEvent, v), v = null), f?.unbind && b && (f.unbind("connected", b.connected), f.unbind("connecting", b.connecting), f.unbind("disconnected", b.disconnected), f.unbind("unavailable", b.unavailable), f.unbind("error", b.error), f.unbind("state_change", b.stateChange)), f = null, b = null;
1558
+ _?.(), E && (clearTimeout(E), E = null), A && (clearTimeout(A), A = null), w && (clearInterval(w), w = null), m && (window.removeEventListener(o.initializedEvent, m), m = null), f?.unbind && v && (f.unbind("connected", v.connected), f.unbind("connecting", v.connecting), f.unbind("disconnected", v.disconnected), f.unbind("unavailable", v.unavailable), f.unbind("error", v.error), f.unbind("state_change", v.stateChange)), f = null, v = null;
1534
1559
  }), {
1535
- connectionStatus: re(() => l.value),
1560
+ connectionStatus: re(() => d.value),
1536
1561
  isConnected: F,
1537
- isConnecting: $,
1538
- isDisconnected: H,
1539
- isError: x,
1562
+ isConnecting: Y,
1563
+ isDisconnected: B,
1564
+ isError: P,
1540
1565
  hasConnectionIssues: U,
1541
- statusMessage: B,
1566
+ statusMessage: j,
1542
1567
  statusColor: N,
1543
- statusIcon: K,
1568
+ statusIcon: J,
1544
1569
  showConnectionBanner: re(() => h.value),
1545
- lastConnectionTime: re(() => d.value),
1546
- connectionUptime: R,
1570
+ lastConnectionTime: re(() => l.value),
1571
+ connectionUptime: M,
1547
1572
  reconnectAttempts: re(() => g.value),
1548
1573
  reconnect: ie
1549
1574
  };
@@ -1553,21 +1578,21 @@ let jt = Zn;
1553
1578
  function es() {
1554
1579
  return jt;
1555
1580
  }
1556
- function fo(e) {
1581
+ function po(e) {
1557
1582
  jt = e;
1558
1583
  }
1559
- function po() {
1584
+ function go() {
1560
1585
  jt = Zn;
1561
1586
  }
1562
- const go = 6e4;
1563
- function mo(e) {
1587
+ const mo = 6e4;
1588
+ function vo(e) {
1564
1589
  return e === "online" || e === "idle" || e === "dnd" || e === "offline";
1565
1590
  }
1566
- function vo(e) {
1591
+ function bo(e) {
1567
1592
  if (typeof e != "string")
1568
1593
  return null;
1569
1594
  const n = e.trim().toLowerCase();
1570
- return mo(n) ? n : null;
1595
+ return vo(n) ? n : null;
1571
1596
  }
1572
1597
  function ts(e) {
1573
1598
  if (typeof e != "string")
@@ -1582,7 +1607,7 @@ function xt(e) {
1582
1607
  const i = n.includes("T") ? n : n.replace(" ", "T"), o = /(?:Z|[+-]\d{2}:\d{2})$/i.test(i) ? i : `${i}Z`, u = new Date(o);
1583
1608
  return Number.isNaN(u.getTime()) ? null : u;
1584
1609
  }
1585
- function bo(e, n, i = {}) {
1610
+ function yo(e, n, i = {}) {
1586
1611
  if (e === null)
1587
1612
  return null;
1588
1613
  if (e === "offline")
@@ -1590,60 +1615,60 @@ function bo(e, n, i = {}) {
1590
1615
  const o = xt(n);
1591
1616
  if (o === null)
1592
1617
  return e;
1593
- const u = i.now ?? Date.now(), l = i.staleAfterMs ?? go;
1594
- return u - o.getTime() > l ? "offline" : e;
1618
+ const u = i.now ?? Date.now(), d = i.staleAfterMs ?? mo;
1619
+ return u - o.getTime() > d ? "offline" : e;
1595
1620
  }
1596
1621
  function Mn(e, n = {}) {
1597
- const i = ts(e?.last_seen_at), o = vo(e?.status);
1622
+ const i = ts(e?.last_seen_at), o = bo(e?.status);
1598
1623
  return {
1599
- status: bo(o, i, n),
1624
+ status: yo(o, i, n),
1600
1625
  lastSeenAt: i
1601
1626
  };
1602
1627
  }
1603
1628
  const ns = () => {
1604
1629
  };
1605
1630
  let $t = ns;
1606
- function yo() {
1631
+ function _o() {
1607
1632
  return $t;
1608
1633
  }
1609
- function _o(e) {
1634
+ function So(e) {
1610
1635
  $t = e;
1611
1636
  }
1612
- function So() {
1637
+ function Co() {
1613
1638
  $t = ns;
1614
1639
  }
1615
- const Me = zt()("GlobalMessaging"), Co = 3, wo = (e) => e.replace(/\/+$/, ""), To = (e) => wo(window.location.pathname) === `/messages/${e}`, Eo = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
1616
- function Fa() {
1617
- const e = Ft(), n = Ie()(), i = yo(), o = es(), u = di(), l = kt(), { conversations: d } = ui(e), g = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map();
1618
- let M = !1;
1619
- function k(x) {
1620
- const U = h.get(x);
1621
- if (U && (h.delete(x), typeof U.channel.stopListening == "function"))
1622
- for (const B of U.bindings)
1640
+ const Me = zt()("GlobalMessaging"), wo = 3, To = (e) => e.replace(/\/+$/, ""), Eo = (e) => To(window.location.pathname) === `/messages/${e}`, Ro = (e) => e.is_muted ? !0 : typeof e.muted_until == "string" && e.muted_until.length > 0;
1641
+ function qa() {
1642
+ const e = Ft(), n = Ie()(), i = _o(), o = es(), u = di(), d = kt(), { conversations: l } = ui(e), g = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map();
1643
+ let k = !1;
1644
+ function x(P) {
1645
+ const U = h.get(P);
1646
+ if (U && (h.delete(P), typeof U.channel.stopListening == "function"))
1647
+ for (const j of U.bindings)
1623
1648
  try {
1624
- U.channel.stopListening(B.event, B.handler);
1649
+ U.channel.stopListening(j.event, j.handler);
1625
1650
  } catch {
1626
1651
  }
1627
1652
  }
1628
- function m() {
1629
- for (const x of g)
1630
- k(x), e.unregisterGlobalConversationSubscription(x);
1653
+ function b() {
1654
+ for (const P of g)
1655
+ x(P), e.unregisterGlobalConversationSubscription(P);
1631
1656
  g.clear();
1632
1657
  }
1633
- function w(x) {
1658
+ function _(P) {
1634
1659
  const U = ke();
1635
- if (!U || g.has(x)) return;
1636
- const B = `conversation.${x}`;
1637
- k(x);
1638
- const N = U.private(B), K = (R) => {
1639
- if (!Si(R)) {
1640
- Me.warn("Dropping malformed ConversationMessageSent event", R);
1660
+ if (!U || g.has(P)) return;
1661
+ const j = `conversation.${P}`;
1662
+ x(P);
1663
+ const N = U.private(j), J = (M) => {
1664
+ if (!Si(M)) {
1665
+ Me.warn("Dropping malformed ConversationMessageSent event", M);
1641
1666
  return;
1642
1667
  }
1643
- const y = R, O = n.currentUser?.id;
1668
+ const y = M, O = n.currentUser?.id;
1644
1669
  if (!O || y.message.author_id === O) return;
1645
1670
  e.addMessage(y.message);
1646
- const ne = e.hasDetailSubscription(y.conversation_id), ve = To(y.conversation_id);
1671
+ const ne = e.hasDetailSubscription(y.conversation_id), ve = Eo(y.conversation_id);
1647
1672
  if (ne || ve) {
1648
1673
  const T = e.getConversationById(y.conversation_id);
1649
1674
  T && (T.unread_count = 0), e.markAsRead(y.conversation_id).catch(() => {
@@ -1652,28 +1677,28 @@ function Fa() {
1652
1677
  }
1653
1678
  const fe = e.getConversationById(y.conversation_id);
1654
1679
  if (fe) {
1655
- const T = Eo(fe);
1680
+ const T = Ro(fe);
1656
1681
  T || fe.unread_count++, i(T);
1657
1682
  }
1658
- }, ie = (R) => {
1659
- if (!Ci(R)) {
1660
- Me.warn("Dropping malformed ConversationMessageRead event", R);
1683
+ }, ie = (M) => {
1684
+ if (!Ci(M)) {
1685
+ Me.warn("Dropping malformed ConversationMessageRead event", M);
1661
1686
  return;
1662
1687
  }
1663
- e.applyParticipantReadState(R);
1664
- }, j = (R) => {
1665
- if (!Ei(R)) {
1666
- Me.warn("Dropping malformed MessageReactionToggled event", R);
1688
+ e.applyParticipantReadState(M);
1689
+ }, $ = (M) => {
1690
+ if (!Ei(M)) {
1691
+ Me.warn("Dropping malformed MessageReactionToggled event", M);
1667
1692
  return;
1668
1693
  }
1669
- const y = R;
1694
+ const y = M;
1670
1695
  e.updateMessageReactions(y.conversation_id, y.message_id, y.reactions);
1671
- }, _ = (R) => {
1672
- if (!wi(R)) {
1673
- Me.warn("Dropping malformed ConversationMessageEdited event", R);
1696
+ }, S = (M) => {
1697
+ if (!wi(M)) {
1698
+ Me.warn("Dropping malformed ConversationMessageEdited event", M);
1674
1699
  return;
1675
1700
  }
1676
- const y = R, O = e.getMessagesByConversationId(y.conversation_id), ne = O.findIndex((fe) => fe.id === y.message.id);
1701
+ const y = M, O = e.getMessagesByConversationId(y.conversation_id), ne = O.findIndex((fe) => fe.id === y.message.id);
1677
1702
  if (ne >= 0) {
1678
1703
  const fe = O[ne];
1679
1704
  if (fe) {
@@ -1686,45 +1711,45 @@ function Fa() {
1686
1711
  ...ve.last_message,
1687
1712
  body: y.message.body
1688
1713
  });
1689
- }, W = (R) => {
1690
- if (!Ti(R)) {
1691
- Me.warn("Dropping malformed ConversationMessageDeleted event", R);
1714
+ }, X = (M) => {
1715
+ if (!Ti(M)) {
1716
+ Me.warn("Dropping malformed ConversationMessageDeleted event", M);
1692
1717
  return;
1693
1718
  }
1694
- const y = R;
1719
+ const y = M;
1695
1720
  e.removeMessage(y.conversation_id, y.message_id);
1696
- }, E = (R) => {
1697
- if (!Ri(R)) {
1698
- Me.warn("Dropping malformed ConversationRequestAccepted event", R);
1721
+ }, R = (M) => {
1722
+ if (!Ri(M)) {
1723
+ Me.warn("Dropping malformed ConversationRequestAccepted event", M);
1699
1724
  return;
1700
1725
  }
1701
- const y = R, O = e.getConversationById(y.conversation_id);
1726
+ const y = M, O = e.getConversationById(y.conversation_id);
1702
1727
  O && (O.is_request = !1), e.requests = e.requests.filter(
1703
1728
  (ne) => ne.id !== y.conversation_id
1704
1729
  );
1705
1730
  };
1706
- N.listen(".ConversationMessageSent", K), N.listen(".ConversationMessageRead", ie), N.listen(".ConversationMessageEdited", _), N.listen(".ConversationMessageDeleted", W), N.listen(".MessageReactionToggled", j), N.listen(".ConversationRequestAccepted", E), h.set(x, {
1731
+ N.listen(".ConversationMessageSent", J), N.listen(".ConversationMessageRead", ie), N.listen(".ConversationMessageEdited", S), N.listen(".ConversationMessageDeleted", X), N.listen(".MessageReactionToggled", $), N.listen(".ConversationRequestAccepted", R), h.set(P, {
1707
1732
  channel: N,
1708
1733
  bindings: [
1709
- { event: ".ConversationMessageSent", handler: K },
1734
+ { event: ".ConversationMessageSent", handler: J },
1710
1735
  { event: ".ConversationMessageRead", handler: ie },
1711
- { event: ".ConversationMessageEdited", handler: _ },
1712
- { event: ".ConversationMessageDeleted", handler: W },
1713
- { event: ".MessageReactionToggled", handler: j },
1714
- { event: ".ConversationRequestAccepted", handler: E }
1736
+ { event: ".ConversationMessageEdited", handler: S },
1737
+ { event: ".ConversationMessageDeleted", handler: X },
1738
+ { event: ".MessageReactionToggled", handler: $ },
1739
+ { event: ".ConversationRequestAccepted", handler: R }
1715
1740
  ]
1716
- }), g.add(x), e.registerGlobalConversationSubscription(x);
1741
+ }), g.add(P), e.registerGlobalConversationSubscription(P);
1717
1742
  }
1718
- function P() {
1719
- const x = ke();
1720
- if (!x) {
1721
- m();
1743
+ function E() {
1744
+ const P = ke();
1745
+ if (!P) {
1746
+ b();
1722
1747
  return;
1723
1748
  }
1724
1749
  for (const U of g) {
1725
- k(U);
1750
+ x(U);
1726
1751
  try {
1727
- x.leave(`conversation.${U}`);
1752
+ P.leave(`conversation.${U}`);
1728
1753
  } catch {
1729
1754
  }
1730
1755
  e.unregisterGlobalConversationSubscription(U);
@@ -1732,70 +1757,70 @@ function Fa() {
1732
1757
  g.clear();
1733
1758
  }
1734
1759
  function A() {
1735
- const x = ke();
1736
- if (!x) return;
1737
- const U = e.conversations.slice(0, Co), B = new Set(U.map((N) => N.id));
1760
+ const P = ke();
1761
+ if (!P) return;
1762
+ const U = e.conversations.slice(0, wo), j = new Set(U.map((N) => N.id));
1738
1763
  for (const N of g)
1739
- if (!B.has(N) && !e.hasDetailSubscription(N)) {
1764
+ if (!j.has(N) && !e.hasDetailSubscription(N)) {
1740
1765
  try {
1741
- k(N), x.leave(`conversation.${N}`);
1766
+ x(N), P.leave(`conversation.${N}`);
1742
1767
  } catch {
1743
1768
  }
1744
1769
  g.delete(N), e.unregisterGlobalConversationSubscription(N);
1745
1770
  }
1746
1771
  for (const N of U)
1747
- w(N.id);
1772
+ _(N.id);
1748
1773
  }
1749
- function S(x) {
1774
+ function w(P) {
1750
1775
  const U = Mn({
1751
- status: x.status,
1752
- last_seen_at: x.last_seen_at ?? null
1776
+ status: P.status,
1777
+ last_seen_at: P.last_seen_at ?? null
1753
1778
  });
1754
1779
  U.status !== null && e.updatePresenceForUser(
1755
- x.user_id,
1780
+ P.user_id,
1756
1781
  U.status,
1757
1782
  U.lastSeenAt
1758
1783
  );
1759
1784
  }
1760
1785
  async function f() {
1761
- const x = [...new Set(
1786
+ const P = [...new Set(
1762
1787
  e.conversations.filter((U) => U.type === "dm" && typeof U.other_user_id == "string" && U.other_user_id.length > 0).map((U) => U.other_user_id)
1763
1788
  )];
1764
- if (x.length !== 0)
1789
+ if (P.length !== 0)
1765
1790
  try {
1766
1791
  const U = await o.get("/v1/presence/users", {
1767
- params: { ids: x }
1768
- }), B = U.data?.data?.items ?? U.data?.items ?? [];
1769
- for (const N of B) {
1770
- const K = Mn(N);
1771
- K.status !== null && e.updatePresenceForUser(N.id, K.status, K.lastSeenAt);
1792
+ params: { ids: P }
1793
+ }), j = U.data?.data?.items ?? U.data?.items ?? [];
1794
+ for (const N of j) {
1795
+ const J = Mn(N);
1796
+ J.status !== null && e.updatePresenceForUser(N.id, J.status, J.lastSeenAt);
1772
1797
  }
1773
1798
  } catch (U) {
1774
1799
  Me.warn("Failed to refresh messaging presence snapshot", U);
1775
1800
  }
1776
1801
  }
1777
- function v() {
1778
- !ke() || M || (fi(S), M = !0);
1802
+ function m() {
1803
+ !ke() || k || (fi(w), k = !0);
1779
1804
  }
1780
- function b() {
1781
- M && (pi(), M = !1);
1805
+ function v() {
1806
+ k && (pi(), k = !1);
1782
1807
  }
1783
1808
  const F = At(
1784
- d,
1809
+ l,
1785
1810
  () => {
1786
1811
  A();
1787
1812
  },
1788
1813
  { deep: !1, immediate: !0 }
1789
- ), $ = At(
1814
+ ), Y = At(
1790
1815
  () => u.fullPath,
1791
1816
  () => {
1792
1817
  A();
1793
1818
  }
1794
- ), H = ot((x) => {
1795
- x === "connected" ? (m(), A(), b(), v(), f()) : (x === "disconnected" || x === "error") && (m(), b());
1819
+ ), B = ot((P) => {
1820
+ P === "connected" ? (b(), A(), v(), m(), f()) : (P === "disconnected" || P === "error") && (b(), v());
1796
1821
  });
1797
- A(), v(), f(), l !== null && He(() => {
1798
- F(), $(), H(), P(), b();
1822
+ A(), m(), f(), d !== null && He(() => {
1823
+ F(), Y(), B(), E(), v();
1799
1824
  });
1800
1825
  }
1801
1826
  const ss = {
@@ -1812,23 +1837,23 @@ const ss = {
1812
1837
  authTokenResolver: () => null
1813
1838
  };
1814
1839
  let rt = { ...ss };
1815
- function Ro() {
1840
+ function Ao() {
1816
1841
  return rt;
1817
1842
  }
1818
- function Ao(e) {
1843
+ function Po(e) {
1819
1844
  rt = {
1820
1845
  ...rt,
1821
1846
  ...e
1822
1847
  };
1823
1848
  }
1824
- function Po() {
1849
+ function Mo() {
1825
1850
  rt = { ...ss };
1826
1851
  }
1827
- const Mo = 429, xo = 423, ko = "ACCOUNT_LIMITED", Io = "ACCOUNT_WRITE_TIMEOUT", Lo = 2, Uo = 5 * 6e4;
1852
+ const xo = 429, ko = 423, Io = "ACCOUNT_LIMITED", Lo = "ACCOUNT_WRITE_TIMEOUT", Uo = 2, Oo = 5 * 6e4;
1828
1853
  function je(e) {
1829
1854
  return typeof e == "object" && e !== null;
1830
1855
  }
1831
- function Oo(e) {
1856
+ function No(e) {
1832
1857
  if (!je(e))
1833
1858
  return null;
1834
1859
  const n = e.response;
@@ -1843,7 +1868,7 @@ function Oo(e) {
1843
1868
  }
1844
1869
  return null;
1845
1870
  }
1846
- function No(e) {
1871
+ function Do(e) {
1847
1872
  if (!je(e))
1848
1873
  return null;
1849
1874
  const n = e.response;
@@ -1853,20 +1878,20 @@ function No(e) {
1853
1878
  return je(i) && typeof i.code == "string" ? i.code : null;
1854
1879
  }
1855
1880
  function Tt(e) {
1856
- const n = Oo(e), i = No(e);
1857
- return n === Mo && i === ko || n === xo && i === Io;
1881
+ const n = No(e), i = Do(e);
1882
+ return n === xo && i === Io || n === ko && i === Lo;
1858
1883
  }
1859
1884
  function Be() {
1860
1885
  return typeof sessionStorage > "u" ? null : sessionStorage;
1861
1886
  }
1862
- function Do(e) {
1887
+ function Fo(e) {
1863
1888
  const n = Be(), i = n?.getItem(e);
1864
1889
  if (i)
1865
1890
  return i;
1866
1891
  const o = `web-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
1867
1892
  return n?.setItem(e, o), o;
1868
1893
  }
1869
- function Fo(e) {
1894
+ function qo(e) {
1870
1895
  const n = Be(), i = n?.getItem(e);
1871
1896
  if (!i)
1872
1897
  return null;
@@ -1874,19 +1899,19 @@ function Fo(e) {
1874
1899
  return Number.isFinite(o) ? o : (n?.removeItem(e), null);
1875
1900
  }
1876
1901
  function Et(e, n = Date.now()) {
1877
- const i = Be(), o = Fo(e);
1902
+ const i = Be(), o = qo(e);
1878
1903
  return o === null ? !1 : o <= n ? (i?.removeItem(e), !1) : !0;
1879
1904
  }
1880
- function qo(e, n = Date.now()) {
1881
- Be()?.setItem(e, String(n + Uo));
1905
+ function zo(e, n = Date.now()) {
1906
+ Be()?.setItem(e, String(n + Oo));
1882
1907
  }
1883
- function zo(e) {
1908
+ function jo(e) {
1884
1909
  Be()?.removeItem(e);
1885
1910
  }
1886
- function jo(e) {
1911
+ function $o(e) {
1887
1912
  return e.startsWith("/v1/") ? `/api${e}` : e;
1888
1913
  }
1889
- function $o(e, n, i) {
1914
+ function Ho(e, n, i) {
1890
1915
  if (typeof fetch > "u")
1891
1916
  return null;
1892
1917
  const o = {
@@ -1895,7 +1920,7 @@ function $o(e, n, i) {
1895
1920
  };
1896
1921
  i && (o.Authorization = `Bearer ${i}`);
1897
1922
  try {
1898
- return fetch(jo(e), {
1923
+ return fetch($o(e), {
1899
1924
  method: "POST",
1900
1925
  headers: o,
1901
1926
  body: JSON.stringify({ client_id: n }),
@@ -1907,75 +1932,75 @@ function $o(e, n, i) {
1907
1932
  return null;
1908
1933
  }
1909
1934
  }
1910
- function qa() {
1911
- const e = Ie()(), n = Ro(), i = es(), o = Do(n.clientIdStorageKey);
1912
- let u = null, l = null, d = !1, g = Et(n.accountLimitedUntilStorageKey), h = !1, M = null, k = 0;
1913
- const m = () => {
1935
+ function za() {
1936
+ const e = Ie()(), n = Ao(), i = es(), o = Fo(n.clientIdStorageKey);
1937
+ let u = null, d = null, l = !1, g = Et(n.accountLimitedUntilStorageKey), h = !1, k = null, x = 0;
1938
+ const b = () => {
1914
1939
  u && (clearInterval(u), u = null);
1915
- }, w = () => {
1916
- l && (clearTimeout(l), l = null);
1917
- }, P = () => {
1918
- m(), u = setInterval(() => {
1940
+ }, _ = () => {
1941
+ d && (clearTimeout(d), d = null);
1942
+ }, E = () => {
1943
+ b(), u = setInterval(() => {
1919
1944
  U();
1920
1945
  }, n.heartbeatIntervalMs);
1921
- }, A = (j) => {
1922
- g || console.warn(j), qo(n.accountLimitedUntilStorageKey), g = !0, d = !1, M = null, m(), w();
1923
- }, S = async (j) => {
1924
- if (!(!d || h || g) && M !== j)
1946
+ }, A = ($) => {
1947
+ g || console.warn($), zo(n.accountLimitedUntilStorageKey), g = !0, l = !1, k = null, b(), _();
1948
+ }, w = async ($) => {
1949
+ if (!(!l || h || g) && k !== $)
1925
1950
  try {
1926
- await i.patch(n.statusUrl, { status: j }), M = j;
1927
- } catch (_) {
1928
- Tt(_) && A("[Presence] Presence updates paused: account is temporarily limited");
1951
+ await i.patch(n.statusUrl, { status: $ }), k = $;
1952
+ } catch (S) {
1953
+ Tt(S) && A("[Presence] Presence updates paused: account is temporarily limited");
1929
1954
  }
1930
1955
  }, f = () => {
1931
- w(), !(!d || h || g || document.visibilityState !== "visible") && (l = setTimeout(() => {
1932
- l = null, S("idle");
1956
+ _(), !(!l || h || g || document.visibilityState !== "visible") && (d = setTimeout(() => {
1957
+ d = null, w("idle");
1933
1958
  }, n.idleAfterMs));
1934
- }, v = () => {
1935
- if (h || !d || g || document.visibilityState !== "visible")
1959
+ }, m = () => {
1960
+ if (h || !l || g || document.visibilityState !== "visible")
1936
1961
  return;
1937
- const j = Date.now();
1938
- j - k < n.activityDebounceMs || (k = j, S("online"), f());
1939
- }, b = () => {
1940
- v();
1962
+ const $ = Date.now();
1963
+ $ - x < n.activityDebounceMs || (x = $, w("online"), f());
1964
+ }, v = () => {
1965
+ m();
1941
1966
  }, F = () => {
1942
- typeof document > "u" || typeof window > "u" || (document.addEventListener("pointerdown", b, { passive: !0 }), document.addEventListener("keydown", b), document.addEventListener("touchstart", b, { passive: !0 }), window.addEventListener("focus", b));
1943
- }, $ = () => {
1944
- typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", b), document.removeEventListener("keydown", b), document.removeEventListener("touchstart", b), window.removeEventListener("focus", b));
1945
- }, H = async () => {
1967
+ typeof document > "u" || typeof window > "u" || (document.addEventListener("pointerdown", v, { passive: !0 }), document.addEventListener("keydown", v), document.addEventListener("touchstart", v, { passive: !0 }), window.addEventListener("focus", v));
1968
+ }, Y = () => {
1969
+ typeof document > "u" || typeof window > "u" || (document.removeEventListener("pointerdown", v), document.removeEventListener("keydown", v), document.removeEventListener("touchstart", v), window.removeEventListener("focus", v));
1970
+ }, B = async () => {
1946
1971
  if (Et(n.accountLimitedUntilStorageKey))
1947
1972
  return g = !0, "account_limited";
1948
1973
  try {
1949
1974
  return await i.post(n.sessionOpenUrl, {
1950
1975
  client_id: o,
1951
1976
  user_agent: n.userAgentResolver()
1952
- }), zo(n.accountLimitedUntilStorageKey), g = !1, d = !0, M = null, "opened";
1953
- } catch (j) {
1954
- return Tt(j) ? (A("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : "failed";
1977
+ }), jo(n.accountLimitedUntilStorageKey), g = !1, l = !0, k = null, "opened";
1978
+ } catch ($) {
1979
+ return Tt($) ? (A("[Presence] Session open skipped: account is temporarily limited"), "account_limited") : "failed";
1955
1980
  }
1956
- }, x = async () => {
1957
- for (let j = 0; j < Lo; j += 1)
1958
- if (await H() !== "failed")
1981
+ }, P = async () => {
1982
+ for (let $ = 0; $ < Uo; $ += 1)
1983
+ if (await B() !== "failed")
1959
1984
  return;
1960
1985
  console.warn("[Presence] Failed to open session");
1961
1986
  }, U = async () => {
1962
- if (d)
1987
+ if (l)
1963
1988
  try {
1964
1989
  await i.post(n.sessionHeartbeatUrl, { client_id: o });
1965
- } catch (j) {
1966
- Tt(j) && A("[Presence] Heartbeat paused: account is temporarily limited");
1990
+ } catch ($) {
1991
+ Tt($) && A("[Presence] Heartbeat paused: account is temporarily limited");
1967
1992
  }
1968
- }, B = () => {
1969
- if (!d)
1993
+ }, j = () => {
1994
+ if (!l)
1970
1995
  return;
1971
- d = !1, M = null, w();
1972
- const j = $o(
1996
+ l = !1, k = null, _();
1997
+ const $ = Ho(
1973
1998
  n.sessionCloseUrl,
1974
1999
  o,
1975
2000
  n.authTokenResolver()
1976
2001
  );
1977
- if (j) {
1978
- j.catch(() => {
2002
+ if ($) {
2003
+ $.catch(() => {
1979
2004
  });
1980
2005
  return;
1981
2006
  }
@@ -1983,179 +2008,179 @@ function qa() {
1983
2008
  });
1984
2009
  }, N = async () => {
1985
2010
  if (!h) {
1986
- if (await x(), h) {
1987
- B();
2011
+ if (await P(), h) {
2012
+ j();
1988
2013
  return;
1989
2014
  }
1990
- d && (P(), S("online"), f());
2015
+ l && (E(), w("online"), f());
1991
2016
  }
1992
- }, K = () => {
2017
+ }, J = () => {
1993
2018
  if (!h) {
1994
2019
  if (document.visibilityState === "hidden") {
1995
- B(), m(), w();
2020
+ j(), b(), _();
1996
2021
  return;
1997
2022
  }
1998
- if (document.visibilityState === "visible" && !d) {
2023
+ if (document.visibilityState === "visible" && !l) {
1999
2024
  g = Et(n.accountLimitedUntilStorageKey), g || N();
2000
2025
  return;
2001
2026
  }
2002
- document.visibilityState === "visible" && d && !g && v();
2027
+ document.visibilityState === "visible" && l && !g && m();
2003
2028
  }
2004
2029
  }, ie = () => {
2005
- h || (B(), m(), w());
2030
+ h || (j(), b(), _());
2006
2031
  };
2007
2032
  Un(async () => {
2008
2033
  if (e.isAuthenticated ?? e.currentUser !== null) {
2009
- if (await x(), h) {
2010
- B();
2034
+ if (await P(), h) {
2035
+ j();
2011
2036
  return;
2012
2037
  }
2013
- d && (P(), S("online"), f()), F(), document.addEventListener("visibilitychange", K), window.addEventListener("pagehide", ie), window.addEventListener("beforeunload", ie);
2038
+ l && (E(), w("online"), f()), F(), document.addEventListener("visibilitychange", J), window.addEventListener("pagehide", ie), window.addEventListener("beforeunload", ie);
2014
2039
  }
2015
2040
  }), He(() => {
2016
- h = !0, $(), w(), m(), B(), document.removeEventListener("visibilitychange", K), window.removeEventListener("pagehide", ie), window.removeEventListener("beforeunload", ie);
2041
+ h = !0, Y(), _(), b(), j(), document.removeEventListener("visibilitychange", J), window.removeEventListener("pagehide", ie), window.removeEventListener("beforeunload", ie);
2017
2042
  });
2018
2043
  }
2019
- const Ho = 12e3, Bo = 250, Vo = 20;
2020
- function za(e) {
2021
- const n = Ft(), i = Ie()(), o = he(!1), u = he(null), l = he(null), d = he([]), g = /* @__PURE__ */ new Map(), h = kt(), M = h !== null;
2022
- let k = 0, m = null, w = null;
2023
- const P = re(() => i.currentUser?.id), A = () => Ln(e)?.trim() ?? "", S = () => {
2024
- const E = l.value?.trim() ?? "";
2025
- if (E.length > 0)
2026
- return E;
2027
- const R = A();
2028
- return R.length > 0 && (l.value = R), R;
2029
- }, f = (E) => n.getTypingUsers(E), v = (E) => {
2030
- const R = f(E);
2031
- for (const y of R)
2032
- n.removeTypingUser(E, y.id);
2033
- d.value = [];
2034
- }, b = (E) => {
2035
- const R = g.get(E);
2036
- R && (clearTimeout(R), g.delete(E));
2044
+ const Bo = 12e3, Vo = 250, Xo = 20;
2045
+ function ja(e) {
2046
+ const n = Ft(), i = Ie()(), o = he(!1), u = he(null), d = he(null), l = he([]), g = /* @__PURE__ */ new Map(), h = kt(), k = h !== null;
2047
+ let x = 0, b = null, _ = null;
2048
+ const E = re(() => i.currentUser?.id), A = () => Ln(e)?.trim() ?? "", w = () => {
2049
+ const R = d.value?.trim() ?? "";
2050
+ if (R.length > 0)
2051
+ return R;
2052
+ const M = A();
2053
+ return M.length > 0 && (d.value = M), M;
2054
+ }, f = (R) => n.getTypingUsers(R), m = (R) => {
2055
+ const M = f(R);
2056
+ for (const y of M)
2057
+ n.removeTypingUser(R, y.id);
2058
+ l.value = [];
2059
+ }, v = (R) => {
2060
+ const M = g.get(R);
2061
+ M && (clearTimeout(M), g.delete(R));
2037
2062
  }, F = () => {
2038
- for (const E of g.values())
2039
- clearTimeout(E);
2063
+ for (const R of g.values())
2064
+ clearTimeout(R);
2040
2065
  g.clear();
2041
- }, $ = (E, R) => {
2042
- b(E);
2066
+ }, Y = (R, M) => {
2067
+ v(R);
2043
2068
  const y = setTimeout(() => {
2044
- g.delete(E), n.removeTypingUser(R, E), d.value = d.value.filter((O) => O.id !== E);
2045
- }, Ho);
2046
- g.set(E, y);
2047
- }, H = () => {
2048
- m && (clearTimeout(m), m = null), k = 0;
2049
- }, x = () => {
2050
- const E = A();
2051
- if (!(o.value || !E)) {
2069
+ g.delete(R), n.removeTypingUser(M, R), l.value = l.value.filter((O) => O.id !== R);
2070
+ }, Bo);
2071
+ g.set(R, y);
2072
+ }, B = () => {
2073
+ b && (clearTimeout(b), b = null), x = 0;
2074
+ }, P = () => {
2075
+ const R = A();
2076
+ if (!(o.value || !R)) {
2052
2077
  if (u.value = null, !ke()) {
2053
- M && !m && k < Vo && (m = setTimeout(() => {
2054
- m = null, k += 1, x();
2055
- }, Bo));
2078
+ k && !b && x < Xo && (b = setTimeout(() => {
2079
+ b = null, x += 1, P();
2080
+ }, Vo));
2056
2081
  return;
2057
2082
  }
2058
2083
  try {
2059
- w && (w(), w = null), w = vi(E, {
2060
- onTypingStart: B,
2084
+ _ && (_(), _ = null), _ = vi(R, {
2085
+ onTypingStart: j,
2061
2086
  onTypingStop: N
2062
- }), o.value = !0, l.value = E, H();
2063
- } catch (R) {
2064
- u.value = R instanceof Error ? R.message : "Failed to subscribe to typing channel";
2087
+ }), o.value = !0, d.value = R, B();
2088
+ } catch (M) {
2089
+ u.value = M instanceof Error ? M.message : "Failed to subscribe to typing channel";
2065
2090
  }
2066
2091
  }
2067
2092
  }, U = () => {
2068
- const E = l.value;
2069
- if (H(), !(!o.value || !E))
2093
+ const R = d.value;
2094
+ if (B(), !(!o.value || !R))
2070
2095
  try {
2071
- w && (w(), w = null), bi(E), F(), v(E), o.value = !1, l.value = null, u.value = null;
2072
- } catch (R) {
2073
- u.value = R instanceof Error ? R.message : "Failed to unsubscribe from typing channel";
2096
+ _ && (_(), _ = null), bi(R), F(), m(R), o.value = !1, d.value = null, u.value = null;
2097
+ } catch (M) {
2098
+ u.value = M instanceof Error ? M.message : "Failed to unsubscribe from typing channel";
2074
2099
  }
2075
2100
  };
2076
- function B(E) {
2077
- if (E.user_id === P.value)
2101
+ function j(R) {
2102
+ if (R.user_id === E.value)
2078
2103
  return;
2079
- const R = S();
2080
- if (!R)
2104
+ const M = w();
2105
+ if (!M)
2081
2106
  return;
2082
2107
  const y = {
2083
- id: E.user.id,
2084
- name: E.user.name,
2085
- ...E.user.avatar !== void 0 ? { avatar: E.user.avatar } : {}
2108
+ id: R.user.id,
2109
+ name: R.user.name,
2110
+ ...R.user.avatar !== void 0 ? { avatar: R.user.avatar } : {}
2086
2111
  };
2087
- d.value.some((O) => O.id === y.id) || (d.value = [...d.value, y]), n.addTypingUser(R, y), $(E.user_id, R);
2112
+ l.value.some((O) => O.id === y.id) || (l.value = [...l.value, y]), n.addTypingUser(M, y), Y(R.user_id, M);
2088
2113
  }
2089
- function N(E) {
2090
- if (E.user_id === P.value)
2114
+ function N(R) {
2115
+ if (R.user_id === E.value)
2091
2116
  return;
2092
- b(E.user_id);
2093
- const R = S();
2094
- R && (d.value = d.value.filter((y) => y.id !== E.user_id), n.removeTypingUser(R, E.user_id));
2095
- }
2096
- const K = re(() => {
2097
- const E = S();
2098
- if (!E)
2099
- return d.value;
2100
- const R = f(E);
2101
- if (d.value.length === 0)
2102
- return R;
2103
- if (R.length === 0)
2104
- return d.value;
2117
+ v(R.user_id);
2118
+ const M = w();
2119
+ M && (l.value = l.value.filter((y) => y.id !== R.user_id), n.removeTypingUser(M, R.user_id));
2120
+ }
2121
+ const J = re(() => {
2122
+ const R = w();
2123
+ if (!R)
2124
+ return l.value;
2125
+ const M = f(R);
2126
+ if (l.value.length === 0)
2127
+ return M;
2128
+ if (M.length === 0)
2129
+ return l.value;
2105
2130
  const y = /* @__PURE__ */ new Map();
2106
- for (const O of R)
2131
+ for (const O of M)
2107
2132
  y.set(O.id, O);
2108
- for (const O of d.value)
2133
+ for (const O of l.value)
2109
2134
  y.set(O.id, O);
2110
2135
  return [...y.values()];
2111
2136
  }), ie = re(() => {
2112
- const E = K.value;
2113
- if (E.length === 0)
2137
+ const R = J.value;
2138
+ if (R.length === 0)
2114
2139
  return "";
2115
- const R = E[0];
2116
- if (!R)
2140
+ const M = R[0];
2141
+ if (!M)
2117
2142
  return "";
2118
- if (E.length === 1)
2119
- return `${R.name} is typing...`;
2120
- const y = E[1];
2143
+ if (R.length === 1)
2144
+ return `${M.name} is typing...`;
2145
+ const y = R[1];
2121
2146
  if (!y)
2122
- return `${E.length} people are typing...`;
2123
- if (E.length === 2)
2124
- return `${R.name} and ${y.name} are typing...`;
2125
- const O = E[2];
2126
- return O ? E.length === 3 ? `${R.name}, ${y.name} and ${O.name} are typing...` : `${E.length} people are typing...` : `${E.length} people are typing...`;
2127
- }), j = re(() => K.value.length > 0), _ = () => {
2128
- o.value || x();
2147
+ return `${R.length} people are typing...`;
2148
+ if (R.length === 2)
2149
+ return `${M.name} and ${y.name} are typing...`;
2150
+ const O = R[2];
2151
+ return O ? R.length === 3 ? `${M.name}, ${y.name} and ${O.name} are typing...` : `${R.length} people are typing...` : `${R.length} people are typing...`;
2152
+ }), $ = re(() => J.value.length > 0), S = () => {
2153
+ o.value || P();
2129
2154
  };
2130
- typeof window < "u" && window.addEventListener($e(), _);
2131
- const W = ot((E) => {
2132
- if (E === "connected") {
2133
- o.value || x();
2155
+ typeof window < "u" && window.addEventListener($e(), S);
2156
+ const X = ot((R) => {
2157
+ if (R === "connected") {
2158
+ o.value || P();
2134
2159
  return;
2135
2160
  }
2136
- if (E === "disconnected" || E === "error") {
2137
- H(), w && (w(), w = null);
2138
- const R = S();
2139
- R && v(R), o.value = !1, l.value = null, F();
2161
+ if (R === "disconnected" || R === "error") {
2162
+ B(), _ && (_(), _ = null);
2163
+ const M = w();
2164
+ M && m(M), o.value = !1, d.value = null, F();
2140
2165
  }
2141
2166
  });
2142
2167
  return h !== null && He(() => {
2143
- H(), W(), F(), U(), typeof window < "u" && window.removeEventListener($e(), _);
2168
+ B(), X(), F(), U(), typeof window < "u" && window.removeEventListener($e(), S);
2144
2169
  }), {
2145
2170
  isSubscribed: re(() => o.value),
2146
2171
  error: re(() => u.value),
2147
- typingUsers: K,
2172
+ typingUsers: J,
2148
2173
  formatTypingIndicator: ie,
2149
- hasTypingUsers: j,
2150
- subscribe: x,
2174
+ hasTypingUsers: $,
2175
+ subscribe: P,
2151
2176
  unsubscribe: U
2152
2177
  };
2153
2178
  }
2154
- function ja(e) {
2155
- e.apiClient && Ai(e.apiClient), e.mainApiClient && fo(e.mainApiClient), e.authStore && Mi(e.authStore), e.mediaApi && Ii(e.mediaApi), e.createLogger && co(e.createLogger), e.playMessageNotification && _o(e.playMessageNotification), e.echo && yi(e.echo), e.mainEcho && io(e.mainEcho), e.presence && Ao(e.presence);
2179
+ function $a(e) {
2180
+ e.apiClient && Ai(e.apiClient), e.mainApiClient && po(e.mainApiClient), e.authStore && Mi(e.authStore), e.mediaApi && Ii(e.mediaApi), e.createLogger && uo(e.createLogger), e.playMessageNotification && So(e.playMessageNotification), e.echo && yi(e.echo), e.mainEcho && oo(e.mainEcho), e.presence && Po(e.presence);
2156
2181
  }
2157
- function $a() {
2158
- Pi(), po(), xi(), Li(), uo(), So(), _i(), oo(), Po();
2182
+ function Ha() {
2183
+ Pi(), go(), xi(), Li(), lo(), Co(), _i(), ao(), Mo();
2159
2184
  }
2160
2185
  class Ht {
2161
2186
  constructor() {
@@ -2206,7 +2231,7 @@ class rs {
2206
2231
  this.namespace = n;
2207
2232
  }
2208
2233
  }
2209
- function Xo(e) {
2234
+ function Wo(e) {
2210
2235
  try {
2211
2236
  new e();
2212
2237
  } catch (n) {
@@ -2250,8 +2275,8 @@ class Bt extends Ht {
2250
2275
  let u = String(this.options.namespace ?? "").replace(
2251
2276
  /\./g,
2252
2277
  "\\"
2253
- ), l = i.startsWith(u) ? i.substring(u.length + 1) : "." + i;
2254
- n(l, o);
2278
+ ), d = i.startsWith(u) ? i.substring(u.length + 1) : "." + i;
2279
+ n(d, o);
2255
2280
  }), this;
2256
2281
  }
2257
2282
  /**
@@ -2303,7 +2328,7 @@ class is extends Bt {
2303
2328
  ), this;
2304
2329
  }
2305
2330
  }
2306
- class Wo extends Bt {
2331
+ class Go extends Bt {
2307
2332
  /**
2308
2333
  * Send a whisper event to other clients in the channel.
2309
2334
  */
@@ -2314,7 +2339,7 @@ class Wo extends Bt {
2314
2339
  ), this;
2315
2340
  }
2316
2341
  }
2317
- class Go extends is {
2342
+ class Jo extends is {
2318
2343
  /**
2319
2344
  * Register a callback to be called anytime the member list changes.
2320
2345
  */
@@ -2405,7 +2430,7 @@ class os extends Ht {
2405
2430
  */
2406
2431
  on(n, i) {
2407
2432
  return this.listeners[n] = this.listeners[n] || [], this.events[n] || (this.events[n] = (o, u) => {
2408
- this.name === o && this.listeners[n] && this.listeners[n].forEach((l) => l(u));
2433
+ this.name === o && this.listeners[n] && this.listeners[n].forEach((d) => d(u));
2409
2434
  }, this.socket.on(n, this.events[n])), this.listeners[n].push(i), this;
2410
2435
  }
2411
2436
  /**
@@ -2437,7 +2462,7 @@ class as extends os {
2437
2462
  }), this;
2438
2463
  }
2439
2464
  }
2440
- class Jo extends as {
2465
+ class Ko extends as {
2441
2466
  /**
2442
2467
  * Register a callback to be called anytime the member list changes.
2443
2468
  */
@@ -2531,7 +2556,7 @@ class cs extends it {
2531
2556
  return this;
2532
2557
  }
2533
2558
  }
2534
- class Ko extends it {
2559
+ class Yo extends it {
2535
2560
  /**
2536
2561
  * Send a whisper event to other clients in the channel.
2537
2562
  */
@@ -2539,7 +2564,7 @@ class Ko extends it {
2539
2564
  return this;
2540
2565
  }
2541
2566
  }
2542
- class Yo extends cs {
2567
+ class Qo extends cs {
2543
2568
  /**
2544
2569
  * Register a callback to be called anytime the member list changes.
2545
2570
  */
@@ -2666,7 +2691,7 @@ class et extends Vt {
2666
2691
  * Get a private encrypted channel instance by name.
2667
2692
  */
2668
2693
  encryptedPrivateChannel(n) {
2669
- return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new Wo(
2694
+ return this.channels["private-encrypted-" + n] || (this.channels["private-encrypted-" + n] = new Go(
2670
2695
  this.pusher,
2671
2696
  "private-encrypted-" + n,
2672
2697
  this.options
@@ -2676,7 +2701,7 @@ class et extends Vt {
2676
2701
  * Get a presence channel instance by name.
2677
2702
  */
2678
2703
  presenceChannel(n) {
2679
- return this.channels["presence-" + n] || (this.channels["presence-" + n] = new Go(
2704
+ return this.channels["presence-" + n] || (this.channels["presence-" + n] = new Jo(
2680
2705
  this.pusher,
2681
2706
  "presence-" + n,
2682
2707
  this.options
@@ -2745,7 +2770,7 @@ class et extends Vt {
2745
2770
  this.pusher.disconnect();
2746
2771
  }
2747
2772
  }
2748
- class Qo extends Vt {
2773
+ class Zo extends Vt {
2749
2774
  constructor() {
2750
2775
  super(...arguments), this.channels = {};
2751
2776
  }
@@ -2805,7 +2830,7 @@ class Qo extends Vt {
2805
2830
  * Get a presence channel instance by name.
2806
2831
  */
2807
2832
  presenceChannel(n) {
2808
- return this.channels["presence-" + n] || (this.channels["presence-" + n] = new Jo(
2833
+ return this.channels["presence-" + n] || (this.channels["presence-" + n] = new Ko(
2809
2834
  this.socket,
2810
2835
  "presence-" + n,
2811
2836
  this.options
@@ -2898,13 +2923,13 @@ class xn extends Vt {
2898
2923
  * Get a private encrypted channel instance by name.
2899
2924
  */
2900
2925
  encryptedPrivateChannel(n) {
2901
- return new Ko();
2926
+ return new Yo();
2902
2927
  }
2903
2928
  /**
2904
2929
  * Get a presence channel instance by name.
2905
2930
  */
2906
2931
  presenceChannel(n) {
2907
- return new Yo();
2932
+ return new Qo();
2908
2933
  }
2909
2934
  /**
2910
2935
  * Leave the given channel, as well as its private and presence variants.
@@ -2941,7 +2966,7 @@ class xn extends Vt {
2941
2966
  disconnect() {
2942
2967
  }
2943
2968
  }
2944
- class Zo {
2969
+ class ea {
2945
2970
  /**
2946
2971
  * Create a new class instance.
2947
2972
  */
@@ -2972,10 +2997,10 @@ class Zo {
2972
2997
  broadcaster: "pusher"
2973
2998
  });
2974
2999
  else if (this.options.broadcaster === "socket.io")
2975
- this.connector = new Qo(this.options);
3000
+ this.connector = new Zo(this.options);
2976
3001
  else if (this.options.broadcaster === "null")
2977
3002
  this.connector = new xn(this.options);
2978
- else if (typeof this.options.broadcaster == "function" && Xo(this.options.broadcaster))
3003
+ else if (typeof this.options.broadcaster == "function" && Wo(this.options.broadcaster))
2979
3004
  this.connector = new this.options.broadcaster(this.options);
2980
3005
  else
2981
3006
  throw new Error(
@@ -3099,12 +3124,12 @@ class Zo {
3099
3124
  );
3100
3125
  }
3101
3126
  }
3102
- function ea(e) {
3127
+ function ta(e) {
3103
3128
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
3104
3129
  }
3105
3130
  var Rt = { exports: {} };
3106
3131
  var kn;
3107
- function ta() {
3132
+ function na() {
3108
3133
  return kn || (kn = 1, (function(e, n) {
3109
3134
  (function(o, u) {
3110
3135
  e.exports = u();
@@ -3113,233 +3138,233 @@ function ta() {
3113
3138
  /******/
3114
3139
  (function(i) {
3115
3140
  var o = {};
3116
- function u(l) {
3117
- if (o[l])
3118
- return o[l].exports;
3119
- var d = o[l] = {
3141
+ function u(d) {
3142
+ if (o[d])
3143
+ return o[d].exports;
3144
+ var l = o[d] = {
3120
3145
  /******/
3121
- i: l,
3146
+ i: d,
3122
3147
  /******/
3123
3148
  l: !1,
3124
3149
  /******/
3125
3150
  exports: {}
3126
3151
  /******/
3127
3152
  };
3128
- return i[l].call(d.exports, d, d.exports, u), d.l = !0, d.exports;
3153
+ return i[d].call(l.exports, l, l.exports, u), l.l = !0, l.exports;
3129
3154
  }
3130
- return u.m = i, u.c = o, u.d = function(l, d, g) {
3131
- u.o(l, d) || Object.defineProperty(l, d, { enumerable: !0, get: g });
3132
- }, u.r = function(l) {
3133
- typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(l, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(l, "__esModule", { value: !0 });
3134
- }, u.t = function(l, d) {
3135
- if (d & 1 && (l = u(l)), d & 8 || d & 4 && typeof l == "object" && l && l.__esModule) return l;
3155
+ return u.m = i, u.c = o, u.d = function(d, l, g) {
3156
+ u.o(d, l) || Object.defineProperty(d, l, { enumerable: !0, get: g });
3157
+ }, u.r = function(d) {
3158
+ typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(d, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(d, "__esModule", { value: !0 });
3159
+ }, u.t = function(d, l) {
3160
+ if (l & 1 && (d = u(d)), l & 8 || l & 4 && typeof d == "object" && d && d.__esModule) return d;
3136
3161
  var g = /* @__PURE__ */ Object.create(null);
3137
- if (u.r(g), Object.defineProperty(g, "default", { enumerable: !0, value: l }), d & 2 && typeof l != "string") for (var h in l) u.d(g, h, (function(M) {
3138
- return l[M];
3162
+ if (u.r(g), Object.defineProperty(g, "default", { enumerable: !0, value: d }), l & 2 && typeof d != "string") for (var h in d) u.d(g, h, (function(k) {
3163
+ return d[k];
3139
3164
  }).bind(null, h));
3140
3165
  return g;
3141
- }, u.n = function(l) {
3142
- var d = l && l.__esModule ? (
3166
+ }, u.n = function(d) {
3167
+ var l = d && d.__esModule ? (
3143
3168
  /******/
3144
3169
  function() {
3145
- return l.default;
3170
+ return d.default;
3146
3171
  }
3147
3172
  ) : (
3148
3173
  /******/
3149
3174
  function() {
3150
- return l;
3175
+ return d;
3151
3176
  }
3152
3177
  );
3153
- return u.d(d, "a", d), d;
3154
- }, u.o = function(l, d) {
3155
- return Object.prototype.hasOwnProperty.call(l, d);
3178
+ return u.d(l, "a", l), l;
3179
+ }, u.o = function(d, l) {
3180
+ return Object.prototype.hasOwnProperty.call(d, l);
3156
3181
  }, u.p = "", u(u.s = 2);
3157
3182
  })([
3158
3183
  /* 0 */
3159
3184
  /***/
3160
3185
  (function(i, o, u) {
3161
- var l = this && this.__extends || /* @__PURE__ */ (function() {
3162
- var S = function(f, v) {
3163
- return S = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(b, F) {
3164
- b.__proto__ = F;
3165
- } || function(b, F) {
3166
- for (var $ in F) F.hasOwnProperty($) && (b[$] = F[$]);
3167
- }, S(f, v);
3186
+ var d = this && this.__extends || /* @__PURE__ */ (function() {
3187
+ var w = function(f, m) {
3188
+ return w = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(v, F) {
3189
+ v.__proto__ = F;
3190
+ } || function(v, F) {
3191
+ for (var Y in F) F.hasOwnProperty(Y) && (v[Y] = F[Y]);
3192
+ }, w(f, m);
3168
3193
  };
3169
- return function(f, v) {
3170
- S(f, v);
3171
- function b() {
3194
+ return function(f, m) {
3195
+ w(f, m);
3196
+ function v() {
3172
3197
  this.constructor = f;
3173
3198
  }
3174
- f.prototype = v === null ? Object.create(v) : (b.prototype = v.prototype, new b());
3199
+ f.prototype = m === null ? Object.create(m) : (v.prototype = m.prototype, new v());
3175
3200
  };
3176
3201
  })();
3177
3202
  Object.defineProperty(o, "__esModule", { value: !0 });
3178
- var d = 256, g = (
3203
+ var l = 256, g = (
3179
3204
  /** @class */
3180
3205
  (function() {
3181
- function S(f) {
3206
+ function w(f) {
3182
3207
  f === void 0 && (f = "="), this._paddingCharacter = f;
3183
3208
  }
3184
- return S.prototype.encodedLength = function(f) {
3209
+ return w.prototype.encodedLength = function(f) {
3185
3210
  return this._paddingCharacter ? (f + 2) / 3 * 4 | 0 : (f * 8 + 5) / 6 | 0;
3186
- }, S.prototype.encode = function(f) {
3187
- for (var v = "", b = 0; b < f.length - 2; b += 3) {
3188
- var F = f[b] << 16 | f[b + 1] << 8 | f[b + 2];
3189
- v += this._encodeByte(F >>> 18 & 63), v += this._encodeByte(F >>> 12 & 63), v += this._encodeByte(F >>> 6 & 63), v += this._encodeByte(F >>> 0 & 63);
3211
+ }, w.prototype.encode = function(f) {
3212
+ for (var m = "", v = 0; v < f.length - 2; v += 3) {
3213
+ var F = f[v] << 16 | f[v + 1] << 8 | f[v + 2];
3214
+ m += this._encodeByte(F >>> 18 & 63), m += this._encodeByte(F >>> 12 & 63), m += this._encodeByte(F >>> 6 & 63), m += this._encodeByte(F >>> 0 & 63);
3190
3215
  }
3191
- var $ = f.length - b;
3192
- if ($ > 0) {
3193
- var F = f[b] << 16 | ($ === 2 ? f[b + 1] << 8 : 0);
3194
- v += this._encodeByte(F >>> 18 & 63), v += this._encodeByte(F >>> 12 & 63), $ === 2 ? v += this._encodeByte(F >>> 6 & 63) : v += this._paddingCharacter || "", v += this._paddingCharacter || "";
3216
+ var Y = f.length - v;
3217
+ if (Y > 0) {
3218
+ var F = f[v] << 16 | (Y === 2 ? f[v + 1] << 8 : 0);
3219
+ m += this._encodeByte(F >>> 18 & 63), m += this._encodeByte(F >>> 12 & 63), Y === 2 ? m += this._encodeByte(F >>> 6 & 63) : m += this._paddingCharacter || "", m += this._paddingCharacter || "";
3195
3220
  }
3196
- return v;
3197
- }, S.prototype.maxDecodedLength = function(f) {
3221
+ return m;
3222
+ }, w.prototype.maxDecodedLength = function(f) {
3198
3223
  return this._paddingCharacter ? f / 4 * 3 | 0 : (f * 6 + 7) / 8 | 0;
3199
- }, S.prototype.decodedLength = function(f) {
3224
+ }, w.prototype.decodedLength = function(f) {
3200
3225
  return this.maxDecodedLength(f.length - this._getPaddingLength(f));
3201
- }, S.prototype.decode = function(f) {
3226
+ }, w.prototype.decode = function(f) {
3202
3227
  if (f.length === 0)
3203
3228
  return new Uint8Array(0);
3204
- for (var v = this._getPaddingLength(f), b = f.length - v, F = new Uint8Array(this.maxDecodedLength(b)), $ = 0, H = 0, x = 0, U = 0, B = 0, N = 0, K = 0; H < b - 4; H += 4)
3205
- U = this._decodeChar(f.charCodeAt(H + 0)), B = this._decodeChar(f.charCodeAt(H + 1)), N = this._decodeChar(f.charCodeAt(H + 2)), K = this._decodeChar(f.charCodeAt(H + 3)), F[$++] = U << 2 | B >>> 4, F[$++] = B << 4 | N >>> 2, F[$++] = N << 6 | K, x |= U & d, x |= B & d, x |= N & d, x |= K & d;
3206
- if (H < b - 1 && (U = this._decodeChar(f.charCodeAt(H)), B = this._decodeChar(f.charCodeAt(H + 1)), F[$++] = U << 2 | B >>> 4, x |= U & d, x |= B & d), H < b - 2 && (N = this._decodeChar(f.charCodeAt(H + 2)), F[$++] = B << 4 | N >>> 2, x |= N & d), H < b - 3 && (K = this._decodeChar(f.charCodeAt(H + 3)), F[$++] = N << 6 | K, x |= K & d), x !== 0)
3229
+ for (var m = this._getPaddingLength(f), v = f.length - m, F = new Uint8Array(this.maxDecodedLength(v)), Y = 0, B = 0, P = 0, U = 0, j = 0, N = 0, J = 0; B < v - 4; B += 4)
3230
+ U = this._decodeChar(f.charCodeAt(B + 0)), j = this._decodeChar(f.charCodeAt(B + 1)), N = this._decodeChar(f.charCodeAt(B + 2)), J = this._decodeChar(f.charCodeAt(B + 3)), F[Y++] = U << 2 | j >>> 4, F[Y++] = j << 4 | N >>> 2, F[Y++] = N << 6 | J, P |= U & l, P |= j & l, P |= N & l, P |= J & l;
3231
+ if (B < v - 1 && (U = this._decodeChar(f.charCodeAt(B)), j = this._decodeChar(f.charCodeAt(B + 1)), F[Y++] = U << 2 | j >>> 4, P |= U & l, P |= j & l), B < v - 2 && (N = this._decodeChar(f.charCodeAt(B + 2)), F[Y++] = j << 4 | N >>> 2, P |= N & l), B < v - 3 && (J = this._decodeChar(f.charCodeAt(B + 3)), F[Y++] = N << 6 | J, P |= J & l), P !== 0)
3207
3232
  throw new Error("Base64Coder: incorrect characters for decoding");
3208
3233
  return F;
3209
- }, S.prototype._encodeByte = function(f) {
3210
- var v = f;
3211
- return v += 65, v += 25 - f >>> 8 & 6, v += 51 - f >>> 8 & -75, v += 61 - f >>> 8 & -15, v += 62 - f >>> 8 & 3, String.fromCharCode(v);
3212
- }, S.prototype._decodeChar = function(f) {
3213
- var v = d;
3214
- return v += (42 - f & f - 44) >>> 8 & -d + f - 43 + 62, v += (46 - f & f - 48) >>> 8 & -d + f - 47 + 63, v += (47 - f & f - 58) >>> 8 & -d + f - 48 + 52, v += (64 - f & f - 91) >>> 8 & -d + f - 65 + 0, v += (96 - f & f - 123) >>> 8 & -d + f - 97 + 26, v;
3215
- }, S.prototype._getPaddingLength = function(f) {
3216
- var v = 0;
3234
+ }, w.prototype._encodeByte = function(f) {
3235
+ var m = f;
3236
+ return m += 65, m += 25 - f >>> 8 & 6, m += 51 - f >>> 8 & -75, m += 61 - f >>> 8 & -15, m += 62 - f >>> 8 & 3, String.fromCharCode(m);
3237
+ }, w.prototype._decodeChar = function(f) {
3238
+ var m = l;
3239
+ return m += (42 - f & f - 44) >>> 8 & -l + f - 43 + 62, m += (46 - f & f - 48) >>> 8 & -l + f - 47 + 63, m += (47 - f & f - 58) >>> 8 & -l + f - 48 + 52, m += (64 - f & f - 91) >>> 8 & -l + f - 65 + 0, m += (96 - f & f - 123) >>> 8 & -l + f - 97 + 26, m;
3240
+ }, w.prototype._getPaddingLength = function(f) {
3241
+ var m = 0;
3217
3242
  if (this._paddingCharacter) {
3218
- for (var b = f.length - 1; b >= 0 && f[b] === this._paddingCharacter; b--)
3219
- v++;
3220
- if (f.length < 4 || v > 2)
3243
+ for (var v = f.length - 1; v >= 0 && f[v] === this._paddingCharacter; v--)
3244
+ m++;
3245
+ if (f.length < 4 || m > 2)
3221
3246
  throw new Error("Base64Coder: incorrect padding");
3222
3247
  }
3223
- return v;
3224
- }, S;
3248
+ return m;
3249
+ }, w;
3225
3250
  })()
3226
3251
  );
3227
3252
  o.Coder = g;
3228
3253
  var h = new g();
3229
- function M(S) {
3230
- return h.encode(S);
3254
+ function k(w) {
3255
+ return h.encode(w);
3231
3256
  }
3232
- o.encode = M;
3233
- function k(S) {
3234
- return h.decode(S);
3257
+ o.encode = k;
3258
+ function x(w) {
3259
+ return h.decode(w);
3235
3260
  }
3236
- o.decode = k;
3237
- var m = (
3261
+ o.decode = x;
3262
+ var b = (
3238
3263
  /** @class */
3239
- (function(S) {
3240
- l(f, S);
3264
+ (function(w) {
3265
+ d(f, w);
3241
3266
  function f() {
3242
- return S !== null && S.apply(this, arguments) || this;
3267
+ return w !== null && w.apply(this, arguments) || this;
3243
3268
  }
3244
- return f.prototype._encodeByte = function(v) {
3245
- var b = v;
3246
- return b += 65, b += 25 - v >>> 8 & 6, b += 51 - v >>> 8 & -75, b += 61 - v >>> 8 & -13, b += 62 - v >>> 8 & 49, String.fromCharCode(b);
3247
- }, f.prototype._decodeChar = function(v) {
3248
- var b = d;
3249
- return b += (44 - v & v - 46) >>> 8 & -d + v - 45 + 62, b += (94 - v & v - 96) >>> 8 & -d + v - 95 + 63, b += (47 - v & v - 58) >>> 8 & -d + v - 48 + 52, b += (64 - v & v - 91) >>> 8 & -d + v - 65 + 0, b += (96 - v & v - 123) >>> 8 & -d + v - 97 + 26, b;
3269
+ return f.prototype._encodeByte = function(m) {
3270
+ var v = m;
3271
+ return v += 65, v += 25 - m >>> 8 & 6, v += 51 - m >>> 8 & -75, v += 61 - m >>> 8 & -13, v += 62 - m >>> 8 & 49, String.fromCharCode(v);
3272
+ }, f.prototype._decodeChar = function(m) {
3273
+ var v = l;
3274
+ return v += (44 - m & m - 46) >>> 8 & -l + m - 45 + 62, v += (94 - m & m - 96) >>> 8 & -l + m - 95 + 63, v += (47 - m & m - 58) >>> 8 & -l + m - 48 + 52, v += (64 - m & m - 91) >>> 8 & -l + m - 65 + 0, v += (96 - m & m - 123) >>> 8 & -l + m - 97 + 26, v;
3250
3275
  }, f;
3251
3276
  })(g)
3252
3277
  );
3253
- o.URLSafeCoder = m;
3254
- var w = new m();
3255
- function P(S) {
3256
- return w.encode(S);
3278
+ o.URLSafeCoder = b;
3279
+ var _ = new b();
3280
+ function E(w) {
3281
+ return _.encode(w);
3257
3282
  }
3258
- o.encodeURLSafe = P;
3259
- function A(S) {
3260
- return w.decode(S);
3283
+ o.encodeURLSafe = E;
3284
+ function A(w) {
3285
+ return _.decode(w);
3261
3286
  }
3262
- o.decodeURLSafe = A, o.encodedLength = function(S) {
3263
- return h.encodedLength(S);
3264
- }, o.maxDecodedLength = function(S) {
3265
- return h.maxDecodedLength(S);
3266
- }, o.decodedLength = function(S) {
3267
- return h.decodedLength(S);
3287
+ o.decodeURLSafe = A, o.encodedLength = function(w) {
3288
+ return h.encodedLength(w);
3289
+ }, o.maxDecodedLength = function(w) {
3290
+ return h.maxDecodedLength(w);
3291
+ }, o.decodedLength = function(w) {
3292
+ return h.decodedLength(w);
3268
3293
  };
3269
3294
  }),
3270
3295
  /* 1 */
3271
3296
  /***/
3272
3297
  (function(i, o, u) {
3273
3298
  Object.defineProperty(o, "__esModule", { value: !0 });
3274
- var l = "utf8: invalid string", d = "utf8: invalid source encoding";
3275
- function g(k) {
3276
- for (var m = new Uint8Array(h(k)), w = 0, P = 0; P < k.length; P++) {
3277
- var A = k.charCodeAt(P);
3278
- A < 128 ? m[w++] = A : A < 2048 ? (m[w++] = 192 | A >> 6, m[w++] = 128 | A & 63) : A < 55296 ? (m[w++] = 224 | A >> 12, m[w++] = 128 | A >> 6 & 63, m[w++] = 128 | A & 63) : (P++, A = (A & 1023) << 10, A |= k.charCodeAt(P) & 1023, A += 65536, m[w++] = 240 | A >> 18, m[w++] = 128 | A >> 12 & 63, m[w++] = 128 | A >> 6 & 63, m[w++] = 128 | A & 63);
3299
+ var d = "utf8: invalid string", l = "utf8: invalid source encoding";
3300
+ function g(x) {
3301
+ for (var b = new Uint8Array(h(x)), _ = 0, E = 0; E < x.length; E++) {
3302
+ var A = x.charCodeAt(E);
3303
+ A < 128 ? b[_++] = A : A < 2048 ? (b[_++] = 192 | A >> 6, b[_++] = 128 | A & 63) : A < 55296 ? (b[_++] = 224 | A >> 12, b[_++] = 128 | A >> 6 & 63, b[_++] = 128 | A & 63) : (E++, A = (A & 1023) << 10, A |= x.charCodeAt(E) & 1023, A += 65536, b[_++] = 240 | A >> 18, b[_++] = 128 | A >> 12 & 63, b[_++] = 128 | A >> 6 & 63, b[_++] = 128 | A & 63);
3279
3304
  }
3280
- return m;
3305
+ return b;
3281
3306
  }
3282
3307
  o.encode = g;
3283
- function h(k) {
3284
- for (var m = 0, w = 0; w < k.length; w++) {
3285
- var P = k.charCodeAt(w);
3286
- if (P < 128)
3287
- m += 1;
3288
- else if (P < 2048)
3289
- m += 2;
3290
- else if (P < 55296)
3291
- m += 3;
3292
- else if (P <= 57343) {
3293
- if (w >= k.length - 1)
3294
- throw new Error(l);
3295
- w++, m += 4;
3308
+ function h(x) {
3309
+ for (var b = 0, _ = 0; _ < x.length; _++) {
3310
+ var E = x.charCodeAt(_);
3311
+ if (E < 128)
3312
+ b += 1;
3313
+ else if (E < 2048)
3314
+ b += 2;
3315
+ else if (E < 55296)
3316
+ b += 3;
3317
+ else if (E <= 57343) {
3318
+ if (_ >= x.length - 1)
3319
+ throw new Error(d);
3320
+ _++, b += 4;
3296
3321
  } else
3297
- throw new Error(l);
3322
+ throw new Error(d);
3298
3323
  }
3299
- return m;
3324
+ return b;
3300
3325
  }
3301
3326
  o.encodedLength = h;
3302
- function M(k) {
3303
- for (var m = [], w = 0; w < k.length; w++) {
3304
- var P = k[w];
3305
- if (P & 128) {
3327
+ function k(x) {
3328
+ for (var b = [], _ = 0; _ < x.length; _++) {
3329
+ var E = x[_];
3330
+ if (E & 128) {
3306
3331
  var A = void 0;
3307
- if (P < 224) {
3308
- if (w >= k.length)
3309
- throw new Error(d);
3310
- var S = k[++w];
3311
- if ((S & 192) !== 128)
3312
- throw new Error(d);
3313
- P = (P & 31) << 6 | S & 63, A = 128;
3314
- } else if (P < 240) {
3315
- if (w >= k.length - 1)
3316
- throw new Error(d);
3317
- var S = k[++w], f = k[++w];
3318
- if ((S & 192) !== 128 || (f & 192) !== 128)
3319
- throw new Error(d);
3320
- P = (P & 15) << 12 | (S & 63) << 6 | f & 63, A = 2048;
3321
- } else if (P < 248) {
3322
- if (w >= k.length - 2)
3323
- throw new Error(d);
3324
- var S = k[++w], f = k[++w], v = k[++w];
3325
- if ((S & 192) !== 128 || (f & 192) !== 128 || (v & 192) !== 128)
3326
- throw new Error(d);
3327
- P = (P & 15) << 18 | (S & 63) << 12 | (f & 63) << 6 | v & 63, A = 65536;
3332
+ if (E < 224) {
3333
+ if (_ >= x.length)
3334
+ throw new Error(l);
3335
+ var w = x[++_];
3336
+ if ((w & 192) !== 128)
3337
+ throw new Error(l);
3338
+ E = (E & 31) << 6 | w & 63, A = 128;
3339
+ } else if (E < 240) {
3340
+ if (_ >= x.length - 1)
3341
+ throw new Error(l);
3342
+ var w = x[++_], f = x[++_];
3343
+ if ((w & 192) !== 128 || (f & 192) !== 128)
3344
+ throw new Error(l);
3345
+ E = (E & 15) << 12 | (w & 63) << 6 | f & 63, A = 2048;
3346
+ } else if (E < 248) {
3347
+ if (_ >= x.length - 2)
3348
+ throw new Error(l);
3349
+ var w = x[++_], f = x[++_], m = x[++_];
3350
+ if ((w & 192) !== 128 || (f & 192) !== 128 || (m & 192) !== 128)
3351
+ throw new Error(l);
3352
+ E = (E & 15) << 18 | (w & 63) << 12 | (f & 63) << 6 | m & 63, A = 65536;
3328
3353
  } else
3329
- throw new Error(d);
3330
- if (P < A || P >= 55296 && P <= 57343)
3331
- throw new Error(d);
3332
- if (P >= 65536) {
3333
- if (P > 1114111)
3334
- throw new Error(d);
3335
- P -= 65536, m.push(String.fromCharCode(55296 | P >> 10)), P = 56320 | P & 1023;
3354
+ throw new Error(l);
3355
+ if (E < A || E >= 55296 && E <= 57343)
3356
+ throw new Error(l);
3357
+ if (E >= 65536) {
3358
+ if (E > 1114111)
3359
+ throw new Error(l);
3360
+ E -= 65536, b.push(String.fromCharCode(55296 | E >> 10)), E = 56320 | E & 1023;
3336
3361
  }
3337
3362
  }
3338
- m.push(String.fromCharCode(P));
3363
+ b.push(String.fromCharCode(E));
3339
3364
  }
3340
- return m.join("");
3365
+ return b.join("");
3341
3366
  }
3342
- o.decode = M;
3367
+ o.decode = k;
3343
3368
  }),
3344
3369
  /* 2 */
3345
3370
  /***/
@@ -3350,7 +3375,7 @@ function ta() {
3350
3375
  /***/
3351
3376
  (function(i, o, u) {
3352
3377
  u.r(o);
3353
- class l {
3378
+ class d {
3354
3379
  constructor(t, s) {
3355
3380
  this.lastId = 0, this.prefix = t, this.name = s;
3356
3381
  }
@@ -3365,7 +3390,7 @@ function ta() {
3365
3390
  delete this[t.number];
3366
3391
  }
3367
3392
  }
3368
- var d = new l("_pusher_script_", "Pusher.ScriptReceivers"), g = {
3393
+ var l = new d("_pusher_script_", "Pusher.ScriptReceivers"), g = {
3369
3394
  VERSION: "8.4.0",
3370
3395
  PROTOCOL: 7,
3371
3396
  wsPort: 80,
@@ -3393,9 +3418,9 @@ function ta() {
3393
3418
  cdn_https: "https://js.pusher.com",
3394
3419
  dependency_suffix: ""
3395
3420
  }, h = g;
3396
- class M {
3421
+ class k {
3397
3422
  constructor(t) {
3398
- this.options = t, this.receivers = t.receivers || d, this.loading = {};
3423
+ this.options = t, this.receivers = t.receivers || l, this.loading = {};
3399
3424
  }
3400
3425
  load(t, s, a) {
3401
3426
  var c = this;
@@ -3407,10 +3432,10 @@ function ta() {
3407
3432
  if (c.receivers.remove(C), c.loading[t]) {
3408
3433
  var q = c.loading[t];
3409
3434
  delete c.loading[t];
3410
- for (var Y = function(oe) {
3435
+ for (var K = function(oe) {
3411
3436
  oe || p.cleanup();
3412
3437
  }, ee = 0; ee < q.length; ee++)
3413
- q[ee](L, Y);
3438
+ q[ee](L, K);
3414
3439
  }
3415
3440
  });
3416
3441
  p.send(C);
@@ -3424,14 +3449,14 @@ function ta() {
3424
3449
  return this.getRoot(s) + "/" + t + this.options.suffix + ".js";
3425
3450
  }
3426
3451
  }
3427
- var k = new l("_pusher_dependencies", "Pusher.DependenciesReceivers"), m = new M({
3452
+ var x = new d("_pusher_dependencies", "Pusher.DependenciesReceivers"), b = new k({
3428
3453
  cdn_http: h.cdn_http,
3429
3454
  cdn_https: h.cdn_https,
3430
3455
  version: h.VERSION,
3431
3456
  suffix: h.dependency_suffix,
3432
- receivers: k
3457
+ receivers: x
3433
3458
  });
3434
- const w = {
3459
+ const _ = {
3435
3460
  baseUrl: "https://pusher.com",
3436
3461
  urls: {
3437
3462
  authenticationEndpoint: {
@@ -3452,26 +3477,26 @@ function ta() {
3452
3477
  }
3453
3478
  };
3454
3479
  var A = { buildLogSuffix: function(r) {
3455
- const t = "See:", s = w.urls[r];
3480
+ const t = "See:", s = _.urls[r];
3456
3481
  if (!s)
3457
3482
  return "";
3458
3483
  let a;
3459
- return s.fullUrl ? a = s.fullUrl : s.path && (a = w.baseUrl + s.path), a ? `${t} ${a}` : "";
3460
- } }, S;
3484
+ return s.fullUrl ? a = s.fullUrl : s.path && (a = _.baseUrl + s.path), a ? `${t} ${a}` : "";
3485
+ } }, w;
3461
3486
  (function(r) {
3462
3487
  r.UserAuthentication = "user-authentication", r.ChannelAuthorization = "channel-authorization";
3463
- })(S || (S = {}));
3488
+ })(w || (w = {}));
3464
3489
  class f extends Error {
3465
3490
  constructor(t) {
3466
3491
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3467
3492
  }
3468
3493
  }
3469
- class v extends Error {
3494
+ class m extends Error {
3470
3495
  constructor(t) {
3471
3496
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3472
3497
  }
3473
3498
  }
3474
- class b extends Error {
3499
+ class v extends Error {
3475
3500
  constructor(t) {
3476
3501
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3477
3502
  }
@@ -3481,17 +3506,17 @@ function ta() {
3481
3506
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3482
3507
  }
3483
3508
  }
3484
- class $ extends Error {
3509
+ class Y extends Error {
3485
3510
  constructor(t) {
3486
3511
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3487
3512
  }
3488
3513
  }
3489
- class H extends Error {
3514
+ class B extends Error {
3490
3515
  constructor(t) {
3491
3516
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3492
3517
  }
3493
3518
  }
3494
- class x extends Error {
3519
+ class P extends Error {
3495
3520
  constructor(t) {
3496
3521
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3497
3522
  }
@@ -3501,12 +3526,12 @@ function ta() {
3501
3526
  super(t), Object.setPrototypeOf(this, new.target.prototype);
3502
3527
  }
3503
3528
  }
3504
- class B extends Error {
3529
+ class j extends Error {
3505
3530
  constructor(t, s) {
3506
3531
  super(s), this.status = t, Object.setPrototypeOf(this, new.target.prototype);
3507
3532
  }
3508
3533
  }
3509
- var K = function(r, t, s, a, c) {
3534
+ var J = function(r, t, s, a, c) {
3510
3535
  const p = z.createXHR();
3511
3536
  p.open("POST", s.endpoint, !0), p.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
3512
3537
  for (var C in s.headers)
@@ -3523,41 +3548,41 @@ function ta() {
3523
3548
  try {
3524
3549
  L = JSON.parse(p.responseText), q = !0;
3525
3550
  } catch {
3526
- c(new B(200, `JSON returned from ${a.toString()} endpoint was invalid, yet status code was 200. Data was: ${p.responseText}`), null);
3551
+ c(new j(200, `JSON returned from ${a.toString()} endpoint was invalid, yet status code was 200. Data was: ${p.responseText}`), null);
3527
3552
  }
3528
3553
  q && c(null, L);
3529
3554
  } else {
3530
3555
  let L = "";
3531
3556
  switch (a) {
3532
- case S.UserAuthentication:
3557
+ case w.UserAuthentication:
3533
3558
  L = A.buildLogSuffix("authenticationEndpoint");
3534
3559
  break;
3535
- case S.ChannelAuthorization:
3560
+ case w.ChannelAuthorization:
3536
3561
  L = `Clients must be authorized to join private or presence channels. ${A.buildLogSuffix("authorizationEndpoint")}`;
3537
3562
  break;
3538
3563
  }
3539
- c(new B(p.status, `Unable to retrieve auth string from ${a.toString()} endpoint - received status: ${p.status} from ${s.endpoint}. ${L}`), null);
3564
+ c(new j(p.status, `Unable to retrieve auth string from ${a.toString()} endpoint - received status: ${p.status} from ${s.endpoint}. ${L}`), null);
3540
3565
  }
3541
3566
  }, p.send(t), p;
3542
3567
  };
3543
3568
  function ie(r) {
3544
- return y(E(r));
3569
+ return y(R(r));
3545
3570
  }
3546
- var j = String.fromCharCode, _ = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", W = function(r) {
3571
+ var $ = String.fromCharCode, S = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", X = function(r) {
3547
3572
  var t = r.charCodeAt(0);
3548
- return t < 128 ? r : t < 2048 ? j(192 | t >>> 6) + j(128 | t & 63) : j(224 | t >>> 12 & 15) + j(128 | t >>> 6 & 63) + j(128 | t & 63);
3549
- }, E = function(r) {
3550
- return r.replace(/[^\x00-\x7F]/g, W);
3573
+ return t < 128 ? r : t < 2048 ? $(192 | t >>> 6) + $(128 | t & 63) : $(224 | t >>> 12 & 15) + $(128 | t >>> 6 & 63) + $(128 | t & 63);
3551
3574
  }, R = function(r) {
3575
+ return r.replace(/[^\x00-\x7F]/g, X);
3576
+ }, M = function(r) {
3552
3577
  var t = [0, 2, 1][r.length % 3], s = r.charCodeAt(0) << 16 | (r.length > 1 ? r.charCodeAt(1) : 0) << 8 | (r.length > 2 ? r.charCodeAt(2) : 0), a = [
3553
- _.charAt(s >>> 18),
3554
- _.charAt(s >>> 12 & 63),
3555
- t >= 2 ? "=" : _.charAt(s >>> 6 & 63),
3556
- t >= 1 ? "=" : _.charAt(s & 63)
3578
+ S.charAt(s >>> 18),
3579
+ S.charAt(s >>> 12 & 63),
3580
+ t >= 2 ? "=" : S.charAt(s >>> 6 & 63),
3581
+ t >= 1 ? "=" : S.charAt(s & 63)
3557
3582
  ];
3558
3583
  return a.join("");
3559
3584
  }, y = window.btoa || function(r) {
3560
- return r.replace(/[\s\S]{1,3}/g, R);
3585
+ return r.replace(/[\s\S]{1,3}/g, M);
3561
3586
  };
3562
3587
  class O {
3563
3588
  constructor(t, s, a, c) {
@@ -3607,11 +3632,11 @@ function ta() {
3607
3632
  };
3608
3633
  }
3609
3634
  }, D = Q;
3610
- function V(r, ...t) {
3635
+ function H(r, ...t) {
3611
3636
  for (var s = 0; s < t.length; s++) {
3612
3637
  var a = t[s];
3613
3638
  for (var c in a)
3614
- a[c] && a[c].constructor && a[c].constructor === Object ? r[c] = V(r[c] || {}, a[c]) : r[c] = a[c];
3639
+ a[c] && a[c].constructor && a[c].constructor === Object ? r[c] = H(r[c] || {}, a[c]) : r[c] = a[c];
3615
3640
  }
3616
3641
  return r;
3617
3642
  }
@@ -3662,7 +3687,7 @@ function ta() {
3662
3687
  s[c] = t(a);
3663
3688
  }), s;
3664
3689
  }
3665
- function G(r, t) {
3690
+ function W(r, t) {
3666
3691
  t = t || function(c) {
3667
3692
  return !!c;
3668
3693
  };
@@ -3775,8 +3800,8 @@ function ta() {
3775
3800
  };
3776
3801
  var q = "Pusher.auth_callbacks['" + p + "']";
3777
3802
  L.src = s.endpoint + "?callback=" + encodeURIComponent(q) + "&" + t;
3778
- var Y = C.getElementsByTagName("head")[0] || C.documentElement;
3779
- Y.insertBefore(L, Y.firstChild);
3803
+ var K = C.getElementsByTagName("head")[0] || C.documentElement;
3804
+ K.insertBefore(L, K.firstChild);
3780
3805
  }, bs = vs;
3781
3806
  class ys {
3782
3807
  constructor(t) {
@@ -3814,8 +3839,8 @@ function ta() {
3814
3839
  }
3815
3840
  var Ss = function(r, t) {
3816
3841
  return function(s, a) {
3817
- var c = "http" + (t ? "s" : "") + "://", p = c + (r.host || r.options.host) + r.options.path, C = z.createJSONPRequest(p, s), L = z.ScriptReceivers.create(function(q, Y) {
3818
- d.remove(L), C.cleanup(), Y && Y.host && (r.host = Y.host), a && a(q, Y);
3842
+ var c = "http" + (t ? "s" : "") + "://", p = c + (r.host || r.options.host) + r.options.path, C = z.createJSONPRequest(p, s), L = z.ScriptReceivers.create(function(q, K) {
3843
+ l.remove(L), C.cleanup(), K && K.host && (r.host = K.host), a && a(q, K);
3819
3844
  });
3820
3845
  C.send(L);
3821
3846
  };
@@ -3873,7 +3898,7 @@ function ta() {
3873
3898
  }
3874
3899
  removeCallback(t, s, a) {
3875
3900
  ce(t, function(c) {
3876
- this._callbacks[c] = G(this._callbacks[c] || [], function(p) {
3901
+ this._callbacks[c] = W(this._callbacks[c] || [], function(p) {
3877
3902
  return s && s !== p.fn || a && a !== p.context;
3878
3903
  }), this._callbacks[c].length === 0 && delete this._callbacks[c];
3879
3904
  }, this);
@@ -3901,7 +3926,7 @@ function ta() {
3901
3926
  return this.callbacks.remove(t, s, a), this;
3902
3927
  }
3903
3928
  unbind_global(t) {
3904
- return t ? (this.global_callbacks = G(this.global_callbacks || [], (s) => s !== t), this) : (this.global_callbacks = [], this);
3929
+ return t ? (this.global_callbacks = W(this.global_callbacks || [], (s) => s !== t), this) : (this.global_callbacks = [], this);
3905
3930
  }
3906
3931
  unbind_all() {
3907
3932
  return this.unbind(), this.unbind_global(), this;
@@ -3993,7 +4018,7 @@ function ta() {
3993
4018
  })), this.emit(t, s);
3994
4019
  }
3995
4020
  buildTimelineMessage(t) {
3996
- return V({ cid: this.id }, t);
4021
+ return H({ cid: this.id }, t);
3997
4022
  }
3998
4023
  }
3999
4024
  class Ue {
@@ -4027,11 +4052,11 @@ function ta() {
4027
4052
  isInitialized: function() {
4028
4053
  return !0;
4029
4054
  }
4030
- }, Gt = V({
4055
+ }, Gt = H({
4031
4056
  getSocket: function(r) {
4032
4057
  return z.HTTPFactory.createStreamingSocket(r);
4033
4058
  }
4034
- }, Wt), Jt = V({
4059
+ }, Wt), Jt = H({
4035
4060
  getSocket: function(r) {
4036
4061
  return z.HTTPFactory.createPollingSocket(r);
4037
4062
  }
@@ -4039,7 +4064,7 @@ function ta() {
4039
4064
  isSupported: function() {
4040
4065
  return z.isXHRSupported();
4041
4066
  }
4042
- }, xs = new Ue(V({}, Gt, Kt)), ks = new Ue(V({}, Jt, Kt)), Is = {
4067
+ }, xs = new Ue(H({}, Gt, Kt)), ks = new Ue(H({}, Jt, Kt)), Is = {
4043
4068
  ws: Ms,
4044
4069
  xhr_streaming: xs,
4045
4070
  xhr_polling: ks
@@ -4056,7 +4081,7 @@ function ta() {
4056
4081
  },
4057
4082
  getSocket: function(r, t) {
4058
4083
  return new window.SockJS(r, null, {
4059
- js_path: m.getPath("sockjs", {
4084
+ js_path: b.getPath("sockjs", {
4060
4085
  useTLS: t.useTLS
4061
4086
  }),
4062
4087
  ignore_null_origin: t.ignoreNullOrigin
@@ -4072,7 +4097,7 @@ function ta() {
4072
4097
  var t = z.isXDRSupported(r.useTLS);
4073
4098
  return t;
4074
4099
  }
4075
- }, Us = new Ue(V({}, Gt, Yt)), Os = new Ue(V({}, Jt, Yt));
4100
+ }, Us = new Ue(H({}, Gt, Yt)), Os = new Ue(H({}, Jt, Yt));
4076
4101
  We.xdr_streaming = Us, We.xdr_polling = Os, We.sockjs = Ls;
4077
4102
  var Ns = We;
4078
4103
  class Ds extends _e {
@@ -4095,15 +4120,15 @@ function ta() {
4095
4120
  this.manager = t, this.transport = s, this.minPingDelay = a.minPingDelay, this.maxPingDelay = a.maxPingDelay, this.pingDelay = void 0;
4096
4121
  }
4097
4122
  createConnection(t, s, a, c) {
4098
- c = V({}, c, {
4123
+ c = H({}, c, {
4099
4124
  activityTimeout: this.pingDelay
4100
4125
  });
4101
4126
  var p = this.transport.createConnection(t, s, a, c), C = null, L = function() {
4102
4127
  p.unbind("open", L), p.bind("closed", q), C = D.now();
4103
- }, q = (Y) => {
4104
- if (p.unbind("closed", q), Y.code === 1002 || Y.code === 1003)
4128
+ }, q = (K) => {
4129
+ if (p.unbind("closed", q), K.code === 1002 || K.code === 1003)
4105
4130
  this.manager.reportDeath();
4106
- else if (!Y.wasClean && C) {
4131
+ else if (!K.wasClean && C) {
4107
4132
  var ee = D.now() - C;
4108
4133
  ee < 2 * this.maxPingDelay && (this.manager.reportDeath(), this.pingDelay = Math.max(ee / 2, this.minPingDelay));
4109
4134
  }
@@ -4274,7 +4299,7 @@ function ta() {
4274
4299
  this.transport.unbind("message", this.onMessage), this.transport.unbind("closed", this.onClosed);
4275
4300
  }
4276
4301
  finish(t, s) {
4277
- this.callback(V({ transport: this.transport, action: t }, s));
4302
+ this.callback(H({ transport: this.transport, action: t }, s));
4278
4303
  }
4279
4304
  }
4280
4305
  class $s {
@@ -4328,7 +4353,7 @@ function ta() {
4328
4353
  t ? (this.subscriptionPending = !1, se.error(t.toString()), this.emit("pusher:subscription_error", Object.assign({}, {
4329
4354
  type: "AuthError",
4330
4355
  error: t.message
4331
- }, t instanceof B ? { status: t.status } : {}))) : this.pusher.send_event("pusher:subscribe", {
4356
+ }, t instanceof j ? { status: t.status } : {}))) : this.pusher.send_event("pusher:subscribe", {
4332
4357
  auth: s.auth,
4333
4358
  channel_data: s.channel_data,
4334
4359
  channel: this.name
@@ -4396,22 +4421,22 @@ function ta() {
4396
4421
  return new (s || (s = Promise))(function(p, C) {
4397
4422
  function L(ee) {
4398
4423
  try {
4399
- Y(a.next(ee));
4424
+ K(a.next(ee));
4400
4425
  } catch (oe) {
4401
4426
  C(oe);
4402
4427
  }
4403
4428
  }
4404
4429
  function q(ee) {
4405
4430
  try {
4406
- Y(a.throw(ee));
4431
+ K(a.throw(ee));
4407
4432
  } catch (oe) {
4408
4433
  C(oe);
4409
4434
  }
4410
4435
  }
4411
- function Y(ee) {
4436
+ function K(ee) {
4412
4437
  ee.done ? p(ee.value) : c(ee.value).then(L, q);
4413
4438
  }
4414
- Y((a = a.apply(r, t || [])).next());
4439
+ K((a = a.apply(r, t || [])).next());
4415
4440
  });
4416
4441
  };
4417
4442
  class Vs extends ht {
@@ -4489,7 +4514,7 @@ function ta() {
4489
4514
  });
4490
4515
  }
4491
4516
  trigger(t, s) {
4492
- throw new H("Client events are not currently supported for encrypted channels");
4517
+ throw new B("Client events are not currently supported for encrypted channels");
4493
4518
  }
4494
4519
  handleEvent(t) {
4495
4520
  var s = t.event, a = t.data;
@@ -4630,7 +4655,7 @@ function ta() {
4630
4655
  this.activityTimer && this.activityTimer.ensureAborted();
4631
4656
  }
4632
4657
  buildConnectionCallbacks(t) {
4633
- return V({}, t, {
4658
+ return H({}, t, {
4634
4659
  message: (s) => {
4635
4660
  this.resetActivityCheck(), this.emit("message", s);
4636
4661
  },
@@ -4649,7 +4674,7 @@ function ta() {
4649
4674
  });
4650
4675
  }
4651
4676
  buildHandshakeCallbacks(t) {
4652
- return V({}, t, {
4677
+ return H({}, t, {
4653
4678
  connected: (s) => {
4654
4679
  this.activityTimeout = Math.min(this.options.activityTimeout, s.activityTimeout, s.connection.activityTimeout || 1 / 0), this.clearUnavailableTimer(), this.setConnection(s.connection), this.socket_id = this.connection.id, this.updateState("connected", { socket_id: this.socket_id });
4655
4680
  }
@@ -4728,14 +4753,14 @@ function ta() {
4728
4753
  if (t.config.nacl)
4729
4754
  return Se.createEncryptedChannel(r, t, t.config.nacl);
4730
4755
  let s = "Tried to subscribe to a private-encrypted- channel but no nacl implementation available", a = A.buildLogSuffix("encryptedChannelSupport");
4731
- throw new H(`${s}. ${a}`);
4756
+ throw new B(`${s}. ${a}`);
4732
4757
  } else {
4733
4758
  if (r.indexOf("private-") === 0)
4734
4759
  return Se.createPrivateChannel(r, t);
4735
4760
  if (r.indexOf("presence-") === 0)
4736
4761
  return Se.createPresenceChannel(r, t);
4737
4762
  if (r.indexOf("#") === 0)
4738
- throw new v('Cannot create a channel with name "' + r + '".');
4763
+ throw new m('Cannot create a channel with name "' + r + '".');
4739
4764
  return Se.createChannel(r, t);
4740
4765
  }
4741
4766
  }
@@ -4793,8 +4818,8 @@ function ta() {
4793
4818
  return Xt(this.strategies, D.method("isSupported"));
4794
4819
  }
4795
4820
  connect(t, s) {
4796
- var a = this.strategies, c = 0, p = this.timeout, C = null, L = (q, Y) => {
4797
- Y ? s(null, Y) : (c = c + 1, this.loop && (c = c % a.length), c < a.length ? (p && (p = p * 2, this.timeoutLimit && (p = Math.min(p, this.timeoutLimit))), C = this.tryStrategy(a[c], t, { timeout: p, failFast: this.failFast }, L)) : s(!0));
4821
+ var a = this.strategies, c = 0, p = this.timeout, C = null, L = (q, K) => {
4822
+ K ? s(null, K) : (c = c + 1, this.loop && (c = c % a.length), c < a.length ? (p && (p = p * 2, this.timeoutLimit && (p = Math.min(p, this.timeoutLimit))), C = this.tryStrategy(a[c], t, { timeout: p, failFast: this.failFast }, L)) : s(!0));
4798
4823
  };
4799
4824
  return C = this.tryStrategy(a[c], t, { timeout: p, failFast: this.failFast }, L), {
4800
4825
  abort: function() {
@@ -4885,15 +4910,15 @@ function ta() {
4885
4910
  failFast: !0
4886
4911
  }))) : p++);
4887
4912
  }
4888
- var q = D.now(), Y = C.pop().connect(t, function ee(oe, Ke) {
4889
- oe ? (en(a), C.length > 0 ? (q = D.now(), Y = C.pop().connect(t, ee)) : s(oe)) : (sr(a, Ke.transport.name, D.now() - q, p), s(null, Ke));
4913
+ var q = D.now(), K = C.pop().connect(t, function ee(oe, Ke) {
4914
+ oe ? (en(a), C.length > 0 ? (q = D.now(), K = C.pop().connect(t, ee)) : s(oe)) : (sr(a, Ke.transport.name, D.now() - q, p), s(null, Ke));
4890
4915
  });
4891
4916
  return {
4892
4917
  abort: function() {
4893
- Y.abort();
4918
+ K.abort();
4894
4919
  },
4895
4920
  forceMinPriority: function(ee) {
4896
- t = ee, Y && Y.forceMinPriority(ee);
4921
+ t = ee, K && K.forceMinPriority(ee);
4897
4922
  }
4898
4923
  };
4899
4924
  }
@@ -5007,14 +5032,14 @@ function ta() {
5007
5032
  loop: !0,
5008
5033
  timeout: 15e3,
5009
5034
  timeoutLimit: 6e4
5010
- }, Y = new Zt({
5035
+ }, K = new Zt({
5011
5036
  minPingDelay: 1e4,
5012
5037
  maxPingDelay: r.activityTimeout
5013
5038
  }), ee = new Zt({
5014
5039
  lives: 2,
5015
5040
  minPingDelay: 1e4,
5016
5041
  maxPingDelay: r.activityTimeout
5017
- }), oe = c("ws", "ws", 3, p, Y), Ke = c("wss", "ws", 3, C, Y), Zr = c("sockjs", "sockjs", 1, L), on = c("xhr_streaming", "xhr_streaming", 1, L, ee), ei = c("xdr_streaming", "xdr_streaming", 1, L, ee), an = c("xhr_polling", "xhr_polling", 1, L), ti = c("xdr_polling", "xdr_polling", 1, L), cn = new Ae([oe], q), ni = new Ae([Ke], q), si = new Ae([Zr], q), un = new Ae([
5042
+ }), oe = c("ws", "ws", 3, p, K), Ke = c("wss", "ws", 3, C, K), Zr = c("sockjs", "sockjs", 1, L), on = c("xhr_streaming", "xhr_streaming", 1, L, ee), ei = c("xdr_streaming", "xdr_streaming", 1, L, ee), an = c("xhr_polling", "xhr_polling", 1, L), ti = c("xdr_polling", "xdr_polling", 1, L), cn = new Ae([oe], q), ni = new Ae([Ke], q), si = new Ae([Zr], q), un = new Ae([
5018
5043
  new Oe(Ne(on), on, ei)
5019
5044
  ], q), ln = new Ae([
5020
5045
  new Oe(Ne(an), an, ti)
@@ -5040,14 +5065,14 @@ function ta() {
5040
5065
  var r = this;
5041
5066
  r.timeline.info(r.buildTimelineMessage({
5042
5067
  transport: r.name + (r.options.useTLS ? "s" : "")
5043
- })), r.hooks.isInitialized() ? r.changeState("initialized") : r.hooks.file ? (r.changeState("initializing"), m.load(r.hooks.file, { useTLS: r.options.useTLS }, function(t, s) {
5068
+ })), r.hooks.isInitialized() ? r.changeState("initialized") : r.hooks.file ? (r.changeState("initializing"), b.load(r.hooks.file, { useTLS: r.options.useTLS }, function(t, s) {
5044
5069
  r.hooks.isInitialized() ? (r.changeState("initialized"), s(!0)) : (t && r.onError(t), r.onClose(), s(!1));
5045
5070
  })) : r.onClose();
5046
5071
  }), cr = {
5047
5072
  getRequest: function(r) {
5048
5073
  var t = new window.XDomainRequest();
5049
5074
  return t.ontimeout = function() {
5050
- r.emit("error", new b()), r.close();
5075
+ r.emit("error", new v()), r.close();
5051
5076
  }, t.onerror = function(s) {
5052
5077
  r.emit("error", s), r.close();
5053
5078
  }, t.onprogress = function() {
@@ -5278,8 +5303,8 @@ function ta() {
5278
5303
  var Rr = sn, Ar = {
5279
5304
  nextAuthCallbackID: 1,
5280
5305
  auth_callbacks: {},
5281
- ScriptReceivers: d,
5282
- DependenciesReceivers: k,
5306
+ ScriptReceivers: l,
5307
+ DependenciesReceivers: x,
5283
5308
  getDefaultStrategy: or,
5284
5309
  Transports: Ns,
5285
5310
  transportConnectionInitializer: ar,
@@ -5296,7 +5321,7 @@ function ta() {
5296
5321
  var t = () => {
5297
5322
  this.onDocumentBody(r.ready);
5298
5323
  };
5299
- window.JSON ? t() : m.load("json2", {}, t);
5324
+ window.JSON ? t() : b.load("json2", {}, t);
5300
5325
  },
5301
5326
  getDocument() {
5302
5327
  return document;
@@ -5305,7 +5330,7 @@ function ta() {
5305
5330
  return this.getDocument().location.protocol;
5306
5331
  },
5307
5332
  getAuthorizers() {
5308
- return { ajax: K, jsonp: bs };
5333
+ return { ajax: J, jsonp: bs };
5309
5334
  },
5310
5335
  onDocumentBody(r) {
5311
5336
  document.body ? r() : setTimeout(() => {
@@ -5378,7 +5403,7 @@ function ta() {
5378
5403
  this.key = t, this.session = s, this.events = [], this.options = a || {}, this.sent = 0, this.uniqueID = 0;
5379
5404
  }
5380
5405
  log(t, s) {
5381
- t <= this.options.level && (this.events.push(V({}, s, { timestamp: D.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
5406
+ t <= this.options.level && (this.events.push(H({}, s, { timestamp: D.now() })), this.options.limit && this.events.length > this.options.limit && this.events.shift());
5382
5407
  }
5383
5408
  error(t) {
5384
5409
  this.log(Je.ERROR, t);
@@ -5393,7 +5418,7 @@ function ta() {
5393
5418
  return this.events.length === 0;
5394
5419
  }
5395
5420
  send(t, s) {
5396
- var a = V({
5421
+ var a = H({
5397
5422
  session: this.session,
5398
5423
  bundle: this.sent + 1,
5399
5424
  key: this.key,
@@ -5433,14 +5458,14 @@ function ta() {
5433
5458
  });
5434
5459
  }, q = function(oe) {
5435
5460
  ee(), s(oe);
5436
- }, Y = function() {
5461
+ }, K = function() {
5437
5462
  ee();
5438
5463
  var oe;
5439
- oe = Xe(c), s(new $(oe));
5464
+ oe = Xe(c), s(new Y(oe));
5440
5465
  }, ee = function() {
5441
- c.unbind("initialized", C), c.unbind("open", L), c.unbind("error", q), c.unbind("closed", Y);
5466
+ c.unbind("initialized", C), c.unbind("open", L), c.unbind("error", q), c.unbind("closed", K);
5442
5467
  };
5443
- return c.bind("initialized", C), c.bind("open", L), c.bind("error", q), c.bind("closed", Y), c.initialize(), {
5468
+ return c.bind("initialized", C), c.bind("open", L), c.bind("error", q), c.bind("closed", K), c.initialize(), {
5444
5469
  abort: () => {
5445
5470
  a || (ee(), p ? p.close() : c.close());
5446
5471
  },
@@ -5464,7 +5489,7 @@ function ta() {
5464
5489
  var kr = function(r, t, s, a, c, p) {
5465
5490
  var C = xr[s];
5466
5491
  if (!C)
5467
- throw new x(s);
5492
+ throw new P(s);
5468
5493
  var L = (!r.enabledTransports || ye(r.enabledTransports, t) !== -1) && (!r.disabledTransports || ye(r.disabledTransports, t) === -1), q;
5469
5494
  return L ? (c = Object.assign({ ignoreNullOrigin: r.ignoreNullOrigin }, c), q = new Mr(t, a, p ? p.getAssistant(C) : C, c)) : q = Ir, q;
5470
5495
  }, Ir = {
@@ -5507,7 +5532,7 @@ function ta() {
5507
5532
  throw `'${r.transport}' is not a recognized auth transport`;
5508
5533
  return (t, s) => {
5509
5534
  const a = Ur(t, r);
5510
- z.getAuthorizers()[r.transport](z, a, r, S.UserAuthentication, s);
5535
+ z.getAuthorizers()[r.transport](z, a, r, w.UserAuthentication, s);
5511
5536
  };
5512
5537
  };
5513
5538
  const Nr = (r, t) => {
@@ -5527,7 +5552,7 @@ function ta() {
5527
5552
  throw `'${r.transport}' is not a recognized auth transport`;
5528
5553
  return (t, s) => {
5529
5554
  const a = Nr(t, r);
5530
- z.getAuthorizers()[r.transport](z, a, r, S.ChannelAuthorization, s);
5555
+ z.getAuthorizers()[r.transport](z, a, r, w.ChannelAuthorization, s);
5531
5556
  };
5532
5557
  };
5533
5558
  const Fr = (r, t, s) => {
@@ -5801,8 +5826,8 @@ function ta() {
5801
5826
  });
5802
5827
  })(Rt)), Rt.exports;
5803
5828
  }
5804
- var na = ta();
5805
- const sa = /* @__PURE__ */ ea(na), ra = "/v1/messenger/bootstrap", ia = 3e4, oa = 3e4, aa = 5 * 6e4;
5829
+ var sa = na();
5830
+ const ra = /* @__PURE__ */ ta(sa), ia = "/v1/messenger/bootstrap", oa = 3e4, aa = 3e4, ca = 5 * 6e4;
5806
5831
  function te(e) {
5807
5832
  return typeof e == "object" && e !== null;
5808
5833
  }
@@ -5824,7 +5849,7 @@ function ze(e, n) {
5824
5849
  const o = i.trim();
5825
5850
  return o === "" ? null : o;
5826
5851
  }
5827
- function ca(e, n) {
5852
+ function ua(e, n) {
5828
5853
  const i = e[n];
5829
5854
  if (typeof i == "number" && Number.isFinite(i))
5830
5855
  return i;
@@ -5835,24 +5860,24 @@ function ca(e, n) {
5835
5860
  }
5836
5861
  throw new Error(`Invalid messenger bootstrap payload: missing integer ${n}`);
5837
5862
  }
5838
- function ua(e) {
5863
+ function la(e) {
5839
5864
  return e.toLowerCase() === "http" ? "http" : "https";
5840
5865
  }
5841
- function la(e) {
5866
+ function da(e) {
5842
5867
  if (e !== null)
5843
5868
  return e.startsWith("/") ? e : `/${e}`;
5844
5869
  }
5845
- function da(e) {
5870
+ function ha(e) {
5846
5871
  const n = te(e) && te(e.data) ? e.data : e;
5847
5872
  if (!te(n))
5848
5873
  throw new Error("Invalid messenger bootstrap payload: expected object");
5849
5874
  const i = n.auth, o = n.service;
5850
5875
  if (!te(i) || !te(o))
5851
5876
  throw new Error("Invalid messenger bootstrap payload: missing auth or service data");
5852
- const u = i.user, l = o.reverb;
5853
- if (!te(u) || !te(l))
5877
+ const u = i.user, d = o.reverb;
5878
+ if (!te(u) || !te(d))
5854
5879
  throw new Error("Invalid messenger bootstrap payload: missing user or reverb data");
5855
- const d = la(ze(l, "path"));
5880
+ const l = da(ze(d, "path"));
5856
5881
  return {
5857
5882
  auth: {
5858
5883
  token: me(i, "token"),
@@ -5872,16 +5897,16 @@ function da(e) {
5872
5897
  apiBaseUrl: me(o, "api_base_url"),
5873
5898
  broadcastingAuthUrl: me(o, "broadcasting_auth_url"),
5874
5899
  reverb: {
5875
- appKey: me(l, "app_key"),
5876
- host: me(l, "host"),
5877
- port: ca(l, "port"),
5878
- scheme: ua(me(l, "scheme")),
5879
- ...d ? { path: d } : {}
5900
+ appKey: me(d, "app_key"),
5901
+ host: me(d, "host"),
5902
+ port: ua(d, "port"),
5903
+ scheme: la(me(d, "scheme")),
5904
+ ...l ? { path: l } : {}
5880
5905
  }
5881
5906
  }
5882
5907
  };
5883
5908
  }
5884
- function ha(e) {
5909
+ function fa(e) {
5885
5910
  return e.replace(/^https?:\/\//, "").replace(/\/.*$/, "").replace(/:\d+$/, "");
5886
5911
  }
5887
5912
  function In(e, n) {
@@ -5904,16 +5929,16 @@ function Ce(e, n, i) {
5904
5929
  const u = e[i];
5905
5930
  return typeof u == "string" && u.trim() !== "" ? u : null;
5906
5931
  }
5907
- function fa(e) {
5932
+ function pa(e) {
5908
5933
  if (typeof e != "string")
5909
5934
  return null;
5910
5935
  const n = e.trim().toLowerCase();
5911
5936
  return n === "online" || n === "idle" || n === "dnd" || n === "offline" ? n : null;
5912
5937
  }
5913
- function pa(e, n) {
5938
+ function ga(e, n) {
5914
5939
  if (!te(e))
5915
5940
  return null;
5916
- const i = Ce(e, "user_id", "userId"), o = fa(e.status);
5941
+ const i = Ce(e, "user_id", "userId"), o = pa(e.status);
5917
5942
  if (!i || !o)
5918
5943
  return null;
5919
5944
  const u = {
@@ -5921,12 +5946,12 @@ function pa(e, n) {
5921
5946
  tenant_scope: Ce(e, "tenant_scope", "tenantScope") ?? n,
5922
5947
  status: o,
5923
5948
  ts: Ce(e, "ts", "timestamp") ?? (/* @__PURE__ */ new Date()).toISOString()
5924
- }, l = e.tenant_id ?? e.tenantId;
5925
- typeof l == "string" ? u.tenant_id = l : l === null && (u.tenant_id = null);
5926
- const d = e.last_seen_at ?? e.lastSeenAt;
5927
- return typeof d == "string" ? u.last_seen_at = d : d === null && (u.last_seen_at = null), u;
5949
+ }, d = e.tenant_id ?? e.tenantId;
5950
+ typeof d == "string" ? u.tenant_id = d : d === null && (u.tenant_id = null);
5951
+ const l = e.last_seen_at ?? e.lastSeenAt;
5952
+ return typeof l == "string" ? u.last_seen_at = l : l === null && (u.last_seen_at = null), u;
5928
5953
  }
5929
- function ga(e) {
5954
+ function ma(e) {
5930
5955
  if (!te(e))
5931
5956
  return null;
5932
5957
  const n = Ce(e, "user_id", "userId"), i = Ce(e, "conversation_id", "conversationId");
@@ -5936,18 +5961,18 @@ function ga(e) {
5936
5961
  id: typeof o.id == "string" && o.id !== "" ? o.id : n,
5937
5962
  name: typeof o.name == "string" ? o.name : "",
5938
5963
  ...typeof o.avatar == "string" && o.avatar !== "" ? { avatar: o.avatar } : {}
5939
- } : void 0, l = e.state, d = l === "start" || l === "stop" || l === "typing" || l === "idle" || l === "viewing" ? l : e.type === "typing" ? "typing" : void 0;
5964
+ } : void 0, d = e.state, l = d === "start" || d === "stop" || d === "typing" || d === "idle" || d === "viewing" ? d : e.type === "typing" ? "typing" : void 0;
5940
5965
  return {
5941
5966
  user_id: n,
5942
5967
  conversation_id: i,
5943
- ...d ? { state: d } : {},
5968
+ ...l ? { state: l } : {},
5944
5969
  ...u ? { user: u } : {},
5945
5970
  ...typeof e.ts == "string" ? { ts: e.ts } : {},
5946
5971
  ...typeof e.started_at == "string" ? { started_at: e.started_at } : {},
5947
5972
  ...typeof e.stopped_at == "string" ? { stopped_at: e.stopped_at } : {}
5948
5973
  };
5949
5974
  }
5950
- function ma(e) {
5975
+ function va(e) {
5951
5976
  if (!te(e))
5952
5977
  return null;
5953
5978
  const n = Ce(e, "user_id", "userId"), i = Ce(e, "conversation_id", "conversationId");
@@ -5966,7 +5991,7 @@ function ma(e) {
5966
5991
  ...typeof e.ts == "string" ? { ts: e.ts } : {}
5967
5992
  };
5968
5993
  }
5969
- function va(e) {
5994
+ function ba(e) {
5970
5995
  if (!te(e))
5971
5996
  return null;
5972
5997
  const n = Ce(e, "user_id", "userId"), i = Ce(e, "conversation_id", "conversationId");
@@ -5977,118 +6002,118 @@ function va(e) {
5977
6002
  ...typeof e.ts == "string" ? { ts: e.ts } : {}
5978
6003
  };
5979
6004
  }
5980
- function ba(e) {
5981
- return te(e) && ae(e, "id") && ae(e, "name");
5982
- }
5983
6005
  function ya(e) {
5984
- return !te(e) || !ae(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => ba(n));
6006
+ return te(e) && ae(e, "id") && ae(e, "name");
5985
6007
  }
5986
6008
  function _a(e) {
5987
- return te(e) && te(e.message) && ae(e.message, "id") && ae(e.message, "conversation_id") && ae(e.message, "author_id");
6009
+ return !te(e) || !ae(e, "reaction") || typeof e.count != "number" ? !1 : Array.isArray(e.users) && e.users.every((n) => ya(n));
5988
6010
  }
5989
6011
  function Sa(e) {
5990
- return te(e) && ae(e, "conversation_id") && ae(e, "user_id") && ae(e, "message_id");
6012
+ return te(e) && te(e.message) && ae(e.message, "id") && ae(e.message, "conversation_id") && ae(e.message, "author_id");
5991
6013
  }
5992
6014
  function Ca(e) {
5993
- return te(e) && ae(e, "conversation_id") && te(e.message) && ae(e.message, "id");
6015
+ return te(e) && ae(e, "conversation_id") && ae(e, "user_id") && ae(e, "message_id");
5994
6016
  }
5995
6017
  function wa(e) {
5996
- return te(e) && ae(e, "conversation_id") && ae(e, "message_id");
6018
+ return te(e) && ae(e, "conversation_id") && te(e.message) && ae(e.message, "id");
5997
6019
  }
5998
6020
  function Ta(e) {
5999
- return te(e) && ae(e, "conversation_id") && ae(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => ya(n));
6021
+ return te(e) && ae(e, "conversation_id") && ae(e, "message_id");
6000
6022
  }
6001
6023
  function Ea(e) {
6002
- return te(e) && ae(e, "conversation_id");
6024
+ return te(e) && ae(e, "conversation_id") && ae(e, "message_id") && Array.isArray(e.reactions) && e.reactions.every((n) => _a(n));
6003
6025
  }
6004
6026
  function Ra(e) {
6027
+ return te(e) && ae(e, "conversation_id");
6028
+ }
6029
+ function Aa(e) {
6005
6030
  return te(e) && ae(e, "conversation_id") && ae(e, "removed_user_id");
6006
6031
  }
6007
6032
  function xe(e, n, i, o) {
6008
- const u = (l) => {
6009
- i(l) && o(l);
6033
+ const u = (d) => {
6034
+ i(d) && o(d);
6010
6035
  };
6011
6036
  return e.listen(n, u), u;
6012
6037
  }
6013
- function Ha(e) {
6014
- const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ?? ra, o = e.bootstrapRefreshSkewMs ?? ia, u = e.presenceFreshnessTtlMs ?? aa, l = (e.createLogger ?? zt())("MessengerEcho");
6015
- typeof window < "u" && (window.Pusher = sa);
6016
- let d = null, g = null, h = null, M = null, k = "disconnected", m = null, w = null;
6017
- const P = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Map(), S = (T) => {
6018
- k = T;
6019
- for (const I of P)
6038
+ function Ba(e) {
6039
+ const n = e.initializedEvent ?? "messenger-client:echo-initialized", i = e.bootstrapEndpoint ?? ia, o = e.bootstrapRefreshSkewMs ?? oa, u = e.presenceFreshnessTtlMs ?? ca, d = (e.createLogger ?? zt())("MessengerEcho");
6040
+ typeof window < "u" && (window.Pusher = ra);
6041
+ let l = null, g = null, h = null, k = null, x = "disconnected", b = null, _ = null;
6042
+ const E = /* @__PURE__ */ new Set(), A = /* @__PURE__ */ new Map(), w = (T) => {
6043
+ x = T;
6044
+ for (const I of E)
6020
6045
  I(T);
6021
6046
  }, f = () => {
6022
- w !== null && (clearTimeout(w), w = null);
6023
- }, v = (T = !0) => {
6024
- h !== null && (h.disconnect(), h = null), M = null, T && S("disconnected");
6025
- }, b = () => {
6026
- f(), d = null, g = null, m = null, v(), A.clear();
6047
+ _ !== null && (clearTimeout(_), _ = null);
6048
+ }, m = (T = !0) => {
6049
+ h !== null && (h.disconnect(), h = null), k = null, T && w("disconnected");
6050
+ }, v = () => {
6051
+ f(), l = null, g = null, b = null, m(), A.clear();
6027
6052
  }, F = () => {
6028
6053
  if (!e.getSourceToken)
6029
6054
  return null;
6030
6055
  const T = e.getSourceToken();
6031
- return T === null ? (b(), null) : (m !== null && m !== T && (f(), d = null, g = null, v()), m = T, T);
6032
- }, $ = (T) => {
6056
+ return T === null ? (v(), null) : (b !== null && b !== T && (f(), l = null, g = null, m()), b = T, T);
6057
+ }, Y = (T) => {
6033
6058
  if (T === null)
6034
6059
  return !1;
6035
6060
  if (T.auth.expiresAt === null)
6036
6061
  return T.auth.token !== "";
6037
6062
  const I = Date.parse(T.auth.expiresAt);
6038
6063
  return Number.isNaN(I) ? !1 : I - Date.now() > o;
6039
- }, H = (T) => {
6064
+ }, B = (T) => {
6040
6065
  if (f(), T.auth.expiresAt === null)
6041
6066
  return;
6042
6067
  const I = Date.parse(T.auth.expiresAt);
6043
6068
  if (Number.isNaN(I))
6044
6069
  return;
6045
6070
  const Q = Math.max(0, I - Date.now() - o);
6046
- w = setTimeout(() => {
6071
+ _ = setTimeout(() => {
6047
6072
  U();
6048
6073
  }, Q);
6049
- }, x = async (T = !1) => e.getSourceToken && F() === null ? null : !T && $(d) ? d : !T && g !== null ? await g : (g = (async () => {
6074
+ }, P = async (T = !1) => e.getSourceToken && F() === null ? null : !T && Y(l) ? l : !T && g !== null ? await g : (g = (async () => {
6050
6075
  const Q = await e.bootstrapClient.get(
6051
6076
  i,
6052
6077
  T ? { params: { refresh: 1 } } : void 0
6053
- ), D = da(Q.data);
6054
- return d = D, H(D), D;
6078
+ ), D = ha(Q.data);
6079
+ return l = D, B(D), D;
6055
6080
  })().finally(() => {
6056
6081
  g = null;
6057
6082
  }), await g), U = async () => {
6058
6083
  const T = h !== null;
6059
6084
  try {
6060
- if (await x(!0), !T)
6085
+ if (await P(!0), !T)
6061
6086
  return;
6062
- v(!1), await N(!0);
6087
+ m(!1), await N(!0);
6063
6088
  } catch (I) {
6064
- l.warn("Failed to refresh messenger bootstrap", I);
6089
+ d.warn("Failed to refresh messenger bootstrap", I);
6065
6090
  }
6066
- }, B = (T) => {
6091
+ }, j = (T) => {
6067
6092
  const I = T.connector?.pusher?.connection;
6068
6093
  if (!I) {
6069
- l.warn("Messenger echo connector does not expose a Pusher connection");
6094
+ d.warn("Messenger echo connector does not expose a Pusher connection");
6070
6095
  return;
6071
6096
  }
6072
6097
  I.bind("connecting", () => {
6073
- S("connecting");
6098
+ w("connecting");
6074
6099
  }), I.bind("connected", () => {
6075
- S("connected");
6100
+ w("connected");
6076
6101
  }), I.bind("disconnected", () => {
6077
- S("disconnected");
6102
+ w("disconnected");
6078
6103
  }), I.bind("unavailable", () => {
6079
- S("disconnected");
6104
+ w("disconnected");
6080
6105
  }), I.bind("error", () => {
6081
- S("error");
6082
- }), I.state === "connected" && S("connected");
6083
- }, N = async (T = !1) => !T && h !== null && $(d) ? h : !T && M !== null ? await M : (M = (async () => {
6084
- const Q = await x(T);
6106
+ w("error");
6107
+ }), I.state === "connected" && w("connected");
6108
+ }, N = async (T = !1) => !T && h !== null && Y(l) ? h : !T && k !== null ? await k : (k = (async () => {
6109
+ const Q = await P(T);
6085
6110
  if (Q === null)
6086
6111
  return null;
6087
- h !== null && v(!1);
6088
- const D = Q.service.reverb.scheme === "https", V = {
6112
+ h !== null && m(!1);
6113
+ const D = Q.service.reverb.scheme === "https", H = {
6089
6114
  broadcaster: "reverb",
6090
6115
  key: Q.service.reverb.appKey,
6091
- wsHost: ha(Q.service.reverb.host),
6116
+ wsHost: fa(Q.service.reverb.host),
6092
6117
  wsPort: Q.service.reverb.port,
6093
6118
  wssPort: Q.service.reverb.port,
6094
6119
  forceTLS: D,
@@ -6103,69 +6128,69 @@ function Ha(e) {
6103
6128
  }
6104
6129
  }
6105
6130
  };
6106
- return Q.service.reverb.path && (V.wsPath = Q.service.reverb.path), h = new Zo(V), B(h), S("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
6131
+ return Q.service.reverb.path && (H.wsPath = Q.service.reverb.path), h = new ea(H), j(h), w("connecting"), typeof window < "u" && window.dispatchEvent(new CustomEvent(n)), h;
6107
6132
  })().finally(() => {
6108
- M = null;
6109
- }), await M), K = It.create({
6110
- timeout: e.requestTimeoutMs ?? oa,
6133
+ k = null;
6134
+ }), await k), J = It.create({
6135
+ timeout: e.requestTimeoutMs ?? aa,
6111
6136
  withCredentials: !1,
6112
6137
  headers: {
6113
6138
  Accept: "application/json",
6114
6139
  "X-Requested-With": "XMLHttpRequest"
6115
6140
  }
6116
6141
  });
6117
- K.interceptors.request.use(async (T) => {
6118
- const I = await x();
6142
+ J.interceptors.request.use(async (T) => {
6143
+ const I = await P();
6119
6144
  if (I === null)
6120
6145
  throw new Error("Messenger bootstrap is unavailable.");
6121
6146
  return T.baseURL = I.service.apiBaseUrl, In(T, I.auth.token), T;
6122
- }), K.interceptors.response.use(
6147
+ }), J.interceptors.response.use(
6123
6148
  (T) => T,
6124
6149
  async (T) => {
6125
6150
  const I = T.config;
6126
6151
  if (T.response?.status === 401 && I && I._messengerRetry !== !0) {
6127
6152
  I._messengerRetry = !0;
6128
- const Q = await x(!0);
6153
+ const Q = await P(!0);
6129
6154
  if (Q !== null)
6130
- return I.baseURL = Q.service.apiBaseUrl, In(I, Q.auth.token), await K(I);
6155
+ return I.baseURL = Q.service.apiBaseUrl, In(I, Q.auth.token), await J(I);
6131
6156
  }
6132
6157
  return Promise.reject(T);
6133
6158
  }
6134
6159
  );
6135
6160
  const ie = () => (N().catch((T) => {
6136
- l.warn("Failed to initialize messenger echo", T);
6137
- }), h), j = (T) => (P.add(T), T(k), () => {
6138
- P.delete(T);
6139
- }), _ = () => d?.auth.tenantId ?? "global", W = (T) => {
6161
+ d.warn("Failed to initialize messenger echo", T);
6162
+ }), h), $ = (T) => (E.add(T), T(x), () => {
6163
+ E.delete(T);
6164
+ }), S = () => l?.auth.tenantId ?? "global", X = (T) => {
6140
6165
  const I = xt(T.ts)?.getTime() ?? xt(T.last_seen_at)?.getTime() ?? null;
6141
6166
  if (I === null)
6142
6167
  return !0;
6143
6168
  const Q = `${T.tenant_scope ?? "global"}:${T.user_id}`, D = A.get(Q);
6144
6169
  if (D && I < D.timestampMs)
6145
6170
  return !1;
6146
- const V = Date.now();
6171
+ const H = Date.now();
6147
6172
  A.set(Q, {
6148
6173
  timestampMs: I,
6149
- seenAt: V
6174
+ seenAt: H
6150
6175
  });
6151
6176
  for (const [be, ye] of A.entries())
6152
- V - ye.seenAt > u && A.delete(be);
6177
+ H - ye.seenAt > u && A.delete(be);
6153
6178
  return !0;
6154
6179
  };
6155
6180
  return {
6156
- apiClient: K,
6181
+ apiClient: J,
6157
6182
  initializedEvent: n,
6158
6183
  getEcho: ie,
6159
- getConnectionStatus: () => k,
6160
- onConnectionStatusChange: j,
6184
+ getConnectionStatus: () => x,
6185
+ onConnectionStatusChange: $,
6161
6186
  reconnect: async () => {
6162
- v(), await N(!0);
6187
+ m(), await N(!0);
6163
6188
  },
6164
6189
  subscribeToPresenceStatus: (T) => {
6165
6190
  const I = ie();
6166
6191
  if (!I || typeof I.join != "function")
6167
6192
  return;
6168
- const Q = I.join(`online-users.${_()}`), D = [
6193
+ const Q = I.join(`online-users.${S()}`), D = [
6169
6194
  ".PresenceStatusChanged",
6170
6195
  "PresenceStatusChanged",
6171
6196
  ".presence.status.changed",
@@ -6175,45 +6200,45 @@ function Ha(e) {
6175
6200
  ".Modules\\Presence\\Events\\UserPresenceStatusChanged",
6176
6201
  "Modules\\Presence\\Events\\UserPresenceStatusChanged"
6177
6202
  ];
6178
- for (const V of D)
6179
- Q.listen(V, (be) => {
6180
- const ye = pa(be, _());
6181
- !ye || !W(ye) || T(ye);
6203
+ for (const H of D)
6204
+ Q.listen(H, (be) => {
6205
+ const ye = ga(be, S());
6206
+ !ye || !X(ye) || T(ye);
6182
6207
  });
6183
6208
  },
6184
6209
  unsubscribeFromPresenceStatus: () => {
6185
- h?.leave(`online-users.${_()}`);
6210
+ h?.leave(`online-users.${S()}`);
6186
6211
  },
6187
6212
  subscribeToConversation: (T, I) => {
6188
6213
  const Q = ie();
6189
6214
  if (!Q)
6190
6215
  return () => {
6191
6216
  };
6192
- const D = Q.private(`conversation.${T}`), V = [];
6193
- return I.onMessageSent && V.push({
6217
+ const D = Q.private(`conversation.${T}`), H = [];
6218
+ return I.onMessageSent && H.push({
6194
6219
  event: ".ConversationMessageSent",
6195
- handler: xe(D, ".ConversationMessageSent", _a, I.onMessageSent)
6196
- }), I.onMessageRead && V.push({
6220
+ handler: xe(D, ".ConversationMessageSent", Sa, I.onMessageSent)
6221
+ }), I.onMessageRead && H.push({
6197
6222
  event: ".ConversationMessageRead",
6198
- handler: xe(D, ".ConversationMessageRead", Sa, I.onMessageRead)
6199
- }), I.onMessageEdited && V.push({
6223
+ handler: xe(D, ".ConversationMessageRead", Ca, I.onMessageRead)
6224
+ }), I.onMessageEdited && H.push({
6200
6225
  event: ".ConversationMessageEdited",
6201
- handler: xe(D, ".ConversationMessageEdited", Ca, I.onMessageEdited)
6202
- }), I.onMessageDeleted && V.push({
6226
+ handler: xe(D, ".ConversationMessageEdited", wa, I.onMessageEdited)
6227
+ }), I.onMessageDeleted && H.push({
6203
6228
  event: ".ConversationMessageDeleted",
6204
- handler: xe(D, ".ConversationMessageDeleted", wa, I.onMessageDeleted)
6205
- }), I.onReactionToggled && V.push({
6229
+ handler: xe(D, ".ConversationMessageDeleted", Ta, I.onMessageDeleted)
6230
+ }), I.onReactionToggled && H.push({
6206
6231
  event: ".MessageReactionToggled",
6207
- handler: xe(D, ".MessageReactionToggled", Ta, I.onReactionToggled)
6208
- }), I.onRequestAccepted && V.push({
6232
+ handler: xe(D, ".MessageReactionToggled", Ea, I.onReactionToggled)
6233
+ }), I.onRequestAccepted && H.push({
6209
6234
  event: ".ConversationRequestAccepted",
6210
- handler: xe(D, ".ConversationRequestAccepted", Ea, I.onRequestAccepted)
6211
- }), I.onParticipantRemoved && V.push({
6235
+ handler: xe(D, ".ConversationRequestAccepted", Ra, I.onRequestAccepted)
6236
+ }), I.onParticipantRemoved && H.push({
6212
6237
  event: ".ConversationParticipantRemoved",
6213
- handler: xe(D, ".ConversationParticipantRemoved", Ra, I.onParticipantRemoved)
6238
+ handler: xe(D, ".ConversationParticipantRemoved", Aa, I.onParticipantRemoved)
6214
6239
  }), () => {
6215
6240
  if (typeof D.stopListening == "function")
6216
- for (const be of V)
6241
+ for (const be of H)
6217
6242
  D.stopListening(be.event, be.handler);
6218
6243
  };
6219
6244
  },
@@ -6225,7 +6250,7 @@ function Ha(e) {
6225
6250
  if (!Q)
6226
6251
  return () => {
6227
6252
  };
6228
- const D = Q.private(`typing-conversation.${T}`), V = [], be = [
6253
+ const D = Q.private(`typing-conversation.${T}`), H = [], be = [
6229
6254
  ".TypingStateChanged",
6230
6255
  "TypingStateChanged",
6231
6256
  ".typing.changed",
@@ -6237,95 +6262,95 @@ function Ha(e) {
6237
6262
  ], ye = [".typing.start", "typing.start", ".TypingStarted", "TypingStarted", ".TypingStart", "TypingStart"], pe = [".typing.stop", "typing.stop", ".TypingStopped", "TypingStopped", ".TypingStop", "TypingStop"], Ve = /* @__PURE__ */ new Set(["start", "typing"]), at = /* @__PURE__ */ new Set(["stop", "idle", "viewing"]);
6238
6263
  for (const ce of be) {
6239
6264
  const ge = (Ee) => {
6240
- const G = ga(Ee);
6241
- if (G) {
6242
- if (Ve.has(G.state)) {
6265
+ const W = ma(Ee);
6266
+ if (W) {
6267
+ if (Ve.has(W.state)) {
6243
6268
  I.onTypingStart?.({
6244
- user_id: G.user_id,
6245
- user: G.user ?? {
6246
- id: G.user_id,
6269
+ user_id: W.user_id,
6270
+ user: W.user ?? {
6271
+ id: W.user_id,
6247
6272
  name: ""
6248
6273
  },
6249
- conversation_id: G.conversation_id,
6250
- started_at: G.started_at ?? G.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6274
+ conversation_id: W.conversation_id,
6275
+ started_at: W.started_at ?? W.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6251
6276
  });
6252
6277
  return;
6253
6278
  }
6254
- at.has(G.state) && I.onTypingStop?.({
6255
- user_id: G.user_id,
6256
- conversation_id: G.conversation_id,
6257
- stopped_at: G.stopped_at ?? G.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6279
+ at.has(W.state) && I.onTypingStop?.({
6280
+ user_id: W.user_id,
6281
+ conversation_id: W.conversation_id,
6282
+ stopped_at: W.stopped_at ?? W.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6258
6283
  });
6259
6284
  }
6260
6285
  };
6261
- D.listen(ce, ge), V.push({ event: ce, handler: ge });
6286
+ D.listen(ce, ge), H.push({ event: ce, handler: ge });
6262
6287
  }
6263
6288
  for (const ce of ye) {
6264
6289
  const ge = (Ee) => {
6265
- const G = ma(Ee);
6266
- if (!G)
6290
+ const W = va(Ee);
6291
+ if (!W)
6267
6292
  return;
6268
6293
  const Le = {
6269
- user_id: G.user_id,
6294
+ user_id: W.user_id,
6270
6295
  user: {
6271
- id: G.user?.id ?? G.user_id,
6272
- name: G.user?.name ?? "",
6273
- ...G.user?.avatar ? { avatar: G.user.avatar } : {}
6296
+ id: W.user?.id ?? W.user_id,
6297
+ name: W.user?.name ?? "",
6298
+ ...W.user?.avatar ? { avatar: W.user.avatar } : {}
6274
6299
  },
6275
- conversation_id: G.conversation_id,
6276
- started_at: G.started_at ?? G.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6300
+ conversation_id: W.conversation_id,
6301
+ started_at: W.started_at ?? W.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6277
6302
  };
6278
6303
  I.onTypingStart?.(Le);
6279
6304
  };
6280
- D.listen(ce, ge), V.push({ event: ce, handler: ge });
6305
+ D.listen(ce, ge), H.push({ event: ce, handler: ge });
6281
6306
  }
6282
6307
  for (const ce of pe) {
6283
6308
  const ge = (Ee) => {
6284
- const G = va(Ee);
6285
- if (!G)
6309
+ const W = ba(Ee);
6310
+ if (!W)
6286
6311
  return;
6287
6312
  const Le = {
6288
- user_id: G.user_id,
6289
- conversation_id: G.conversation_id,
6290
- stopped_at: G.stopped_at ?? G.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6313
+ user_id: W.user_id,
6314
+ conversation_id: W.conversation_id,
6315
+ stopped_at: W.stopped_at ?? W.ts ?? (/* @__PURE__ */ new Date()).toISOString()
6291
6316
  };
6292
6317
  I.onTypingStop?.(Le);
6293
6318
  };
6294
- D.listen(ce, ge), V.push({ event: ce, handler: ge });
6319
+ D.listen(ce, ge), H.push({ event: ce, handler: ge });
6295
6320
  }
6296
6321
  return () => {
6297
6322
  if (typeof D.stopListening == "function")
6298
- for (const ce of V)
6323
+ for (const ce of H)
6299
6324
  D.stopListening(ce.event, ce.handler);
6300
6325
  };
6301
6326
  },
6302
6327
  unsubscribeFromTyping: (T) => {
6303
6328
  h?.leave(`typing-conversation.${T}`);
6304
6329
  },
6305
- clearRuntime: b
6330
+ clearRuntime: v
6306
6331
  };
6307
6332
  }
6308
6333
  export {
6309
- go as DEFAULT_PRESENCE_STALE_AFTER_MS,
6310
- ja as configureMessengerClient,
6311
- Ha as createMessengerEcho,
6312
- X as getApi,
6334
+ mo as DEFAULT_PRESENCE_STALE_AFTER_MS,
6335
+ $a as configureMessengerClient,
6336
+ Ba as createMessengerEcho,
6337
+ V as getApi,
6313
6338
  Ie as getAuthStore,
6314
- La as getConnectionStatus,
6339
+ Ua as getConnectionStatus,
6315
6340
  ke as getEcho,
6316
6341
  Hn as getEchoConnectionStatus,
6317
6342
  $e as getEchoInitializedEvent,
6318
6343
  Z as getErrorMessage,
6319
6344
  zt as getLoggerFactory,
6320
6345
  es as getMainApi,
6321
- to as getMainEcho,
6322
- no as getMainEchoConnectionStatus,
6323
- eo as getMainEchoInitializedEvent,
6346
+ no as getMainEcho,
6347
+ so as getMainEchoConnectionStatus,
6348
+ to as getMainEchoInitializedEvent,
6324
6349
  ki as getMediaApi,
6325
- Ro as getPresenceRuntimeConfig,
6326
- Oa as hasResponse,
6327
- Xa as isAxiosError,
6328
- Ua as isError,
6350
+ Ao as getPresenceRuntimeConfig,
6351
+ Na as hasResponse,
6352
+ Wa as isAxiosError,
6353
+ Oa as isError,
6329
6354
  Ti as isValidMessageDeletedEvent,
6330
6355
  wi as isValidMessageEditedEvent,
6331
6356
  Ci as isValidMessageReadEvent,
@@ -6333,42 +6358,42 @@ export {
6333
6358
  Ei as isValidReactionToggledEvent,
6334
6359
  Ri as isValidRequestAcceptedEvent,
6335
6360
  we as messagingApi,
6336
- vo as normalizePresenceStatus,
6361
+ bo as normalizePresenceStatus,
6337
6362
  ts as normalizePresenceTimestamp,
6338
6363
  ot as onConnectionStatusChange,
6339
- so as onMainEchoConnectionStatusChange,
6364
+ ro as onMainEchoConnectionStatusChange,
6340
6365
  xt as parsePresenceTimestamp,
6341
6366
  hi as reconnectEcho,
6342
- ro as reconnectMainEcho,
6367
+ io as reconnectMainEcho,
6343
6368
  _i as resetEchoRuntimeConfig,
6344
- uo as resetLoggerFactory,
6345
- po as resetMainApiClient,
6346
- oo as resetMainEchoRuntimeConfig,
6369
+ lo as resetLoggerFactory,
6370
+ go as resetMainApiClient,
6371
+ ao as resetMainEchoRuntimeConfig,
6347
6372
  Pi as resetMessagingApiClient,
6348
6373
  xi as resetMessagingAuthStoreResolver,
6349
6374
  Li as resetMessagingMediaApi,
6350
- $a as resetMessengerClientConfig,
6351
- Po as resetPresenceRuntimeConfig,
6352
- bo as resolveFreshPresenceStatus,
6375
+ Ha as resetMessengerClientConfig,
6376
+ Mo as resetPresenceRuntimeConfig,
6377
+ yo as resolveFreshPresenceStatus,
6353
6378
  Mn as resolvePresenceSnapshot,
6354
6379
  yi as setEchoRuntimeConfig,
6355
- co as setLoggerFactory,
6356
- fo as setMainApiClient,
6357
- io as setMainEchoRuntimeConfig,
6380
+ uo as setLoggerFactory,
6381
+ po as setMainApiClient,
6382
+ oo as setMainEchoRuntimeConfig,
6358
6383
  Ai as setMessagingApiClient,
6359
6384
  Mi as setMessagingAuthStoreResolver,
6360
6385
  Ii as setMessagingMediaApi,
6361
- Ao as setPresenceRuntimeConfig,
6386
+ Po as setPresenceRuntimeConfig,
6362
6387
  gi as subscribeToConversation,
6363
6388
  fi as subscribeToPresenceStatus,
6364
6389
  vi as subscribeToTyping,
6365
6390
  mi as unsubscribeFromConversation,
6366
6391
  pi as unsubscribeFromPresenceStatus,
6367
6392
  bi as unsubscribeFromTyping,
6368
- Da as useConnectionStatus,
6369
- Na as useConversationChannel,
6370
- Fa as useGlobalMessaging,
6393
+ Fa as useConnectionStatus,
6394
+ Da as useConversationChannel,
6395
+ qa as useGlobalMessaging,
6371
6396
  Ft as useMessagingStore,
6372
- qa as usePresence,
6373
- za as useTypingChannel
6397
+ za as usePresence,
6398
+ ja as useTypingChannel
6374
6399
  };