@linktr.ee/messaging-react 1.12.2 → 1.12.4

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,11 +1,11 @@
1
- import { jsx as e, jsxs as i, Fragment as Ce } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as i, Fragment as ve } from "react/jsx-runtime";
2
2
  import p from "classnames";
3
- import P, { createContext as Ue, useContext as Oe, useCallback as D, useState as y, useRef as z, useEffect as G } from "react";
3
+ import U, { createContext as Pe, useContext as Oe, useCallback as D, useState as y, useRef as z, useEffect as G } from "react";
4
4
  import { StreamChatService as je } from "@linktr.ee/messaging-core";
5
- import { Chat as Ae, ChannelList as ze, useMessageComposer as Be, useStateStore as $e, MessageInput as Ge, useMessageInputContext as He, useMessageComposerHasSendableData as Ve, SimpleAttachmentSelector as We, QuotedMessagePreview as Ze, AttachmentPreviewList as qe, TextareaComposer as Ye, MessageTimestamp as Je, Channel as Qe, useChannelStateContext as ve, Window as Xe, MessageList as Ke } from "stream-chat-react";
6
- import { XIcon as ue, ArrowUpIcon as es, ArrowLeftIcon as he, DotsThreeIcon as fe, SpinnerGapIcon as re, SignOutIcon as ss, ProhibitInsetIcon as ge, FlagIcon as ts, MagnifyingGlassIcon as ns, ChatCircleDotsIcon as xe } from "@phosphor-icons/react";
7
- import { LinkPreviewsManager as Ne } from "stream-chat";
8
- const we = Ue({
5
+ import { Chat as Ae, ChannelList as ze, useMessageComposer as Be, useStateStore as $e, MessageInput as Ge, useMessageInputContext as He, useMessageComposerHasSendableData as Ve, SimpleAttachmentSelector as We, QuotedMessagePreview as Ze, AttachmentPreviewList as qe, TextareaComposer as Ye, MessageTimestamp as Je, Channel as Qe, useChannelStateContext as we, Window as Xe, MessageList as Ke } from "stream-chat-react";
6
+ import { XIcon as me, ArrowUpIcon as es, ArrowLeftIcon as fe, DotsThreeIcon as ge, SpinnerGapIcon as re, SignOutIcon as ss, ProhibitInsetIcon as xe, FlagIcon as ts, MagnifyingGlassIcon as ns, ChatCircleDotsIcon as Ne } from "@phosphor-icons/react";
7
+ import { LinkPreviewsManager as be } from "stream-chat";
8
+ const ye = Pe({
9
9
  service: null,
10
10
  client: null,
11
11
  isConnected: !1,
@@ -15,19 +15,19 @@ const we = Ue({
15
15
  refreshConnection: async () => {
16
16
  },
17
17
  debug: !1
18
- }), ae = () => Oe(we), Ms = ({
18
+ }), oe = () => Oe(ye), Ms = ({
19
19
  children: t,
20
20
  user: s,
21
21
  serviceConfig: n,
22
22
  apiKey: r,
23
23
  capabilities: a = {},
24
- debug: d = !1
24
+ debug: c = !1
25
25
  }) => {
26
26
  const l = D(
27
27
  (u, ...b) => {
28
- d && console.log(`🔥 [MessagingProvider] ${u}`, ...b);
28
+ c && console.log(`🔥 [MessagingProvider] ${u}`, ...b);
29
29
  },
30
- [d]
30
+ [c]
31
31
  );
32
32
  l("🔄 RENDER START", {
33
33
  userId: s == null ? void 0 : s.id,
@@ -35,7 +35,7 @@ const we = Ue({
35
35
  serviceConfig: !!n,
36
36
  capabilities: Object.keys(a)
37
37
  });
38
- const [m, h] = y(null), [g, w] = y(null), [f, S] = y(!1), [M, v] = y(!1), [c, N] = y(null), E = z(!1), I = z({
38
+ const [m, h] = y(null), [g, w] = y(null), [f, S] = y(!1), [M, v] = y(!1), [d, N] = y(null), E = z(!1), I = z({
39
39
  userId: s == null ? void 0 : s.id,
40
40
  apiKey: r,
41
41
  serviceConfig: n,
@@ -82,7 +82,7 @@ const we = Ue({
82
82
  const b = new je({
83
83
  ...n,
84
84
  apiKey: r,
85
- debug: d
85
+ debug: c
86
86
  });
87
87
  return h(b), l("✅ SERVICE SET", {
88
88
  renderCount: u,
@@ -93,7 +93,7 @@ const we = Ue({
93
93
  reason: "Effect cleanup"
94
94
  }), b.disconnectUser().catch(console.error);
95
95
  };
96
- }, [r, n, d, l]);
96
+ }, [r, n, c, l]);
97
97
  const x = z(null);
98
98
  G(() => {
99
99
  var b, B;
@@ -175,38 +175,38 @@ const we = Ue({
175
175
  } finally {
176
176
  v(!1), l("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
177
177
  }
178
- }, [m, s, l]), o = P.useMemo(() => (l("💫 CONTEXT VALUE MEMOIZATION", {
178
+ }, [m, s, l]), o = U.useMemo(() => (l("💫 CONTEXT VALUE MEMOIZATION", {
179
179
  hasService: !!m,
180
180
  hasClient: !!g,
181
181
  isConnected: f,
182
182
  isLoading: M,
183
- hasError: !!c,
183
+ hasError: !!d,
184
184
  capabilitiesKeys: Object.keys(a)
185
185
  }), {
186
186
  service: m,
187
187
  client: g,
188
188
  isConnected: f,
189
189
  isLoading: M,
190
- error: c,
190
+ error: d,
191
191
  capabilities: a,
192
192
  refreshConnection: R,
193
- debug: d
193
+ debug: c
194
194
  }), [
195
195
  m,
196
196
  g,
197
197
  f,
198
198
  M,
199
- c,
199
+ d,
200
200
  a,
201
201
  R,
202
- d,
202
+ c,
203
203
  l
204
204
  ]);
205
205
  return l("🔄 RENDER END", {
206
206
  renderCount: k.current,
207
207
  willRenderChat: !!(g && f),
208
208
  contextValueReady: !!o
209
- }), /* @__PURE__ */ e(we.Provider, { value: o, children: g && f ? /* @__PURE__ */ e(
209
+ }), /* @__PURE__ */ e(ye.Provider, { value: o, children: g && f ? /* @__PURE__ */ e(
210
210
  Ae,
211
211
  {
212
212
  client: g,
@@ -216,7 +216,7 @@ const we = Ue({
216
216
  children: t
217
217
  }
218
218
  ) : t });
219
- }, rs = () => ae(), ls = (t, s) => {
219
+ }, rs = () => oe(), ls = (t, s) => {
220
220
  const n = new Date(
221
221
  Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
222
222
  ), a = new Date(
@@ -230,13 +230,14 @@ const we = Ue({
230
230
  const r = ls(t, s);
231
231
  return r === 0 ? t.toLocaleTimeString([], {
232
232
  hour: "numeric",
233
- minute: "2-digit"
233
+ minute: "2-digit",
234
+ hour12: !0
234
235
  }) : r === 1 ? "Yesterday" : r < 7 ? `${r}d` : r < 28 ? `${Math.floor(r / 7)}w` : t.toLocaleDateString("en-US", {
235
236
  month: "numeric",
236
237
  day: "numeric",
237
238
  year: "2-digit"
238
239
  });
239
- }, be = [
240
+ }, Ce = [
240
241
  "🍎",
241
242
  // Apple
242
243
  "🍌",
@@ -273,8 +274,8 @@ function os(t) {
273
274
  return Math.abs(s);
274
275
  }
275
276
  function is(t) {
276
- const n = os(t) % be.length;
277
- return be[n];
277
+ const n = os(t) % Ce.length;
278
+ return Ce[n];
278
279
  }
279
280
  const q = ({
280
281
  id: t,
@@ -283,7 +284,7 @@ const q = ({
283
284
  className: r,
284
285
  shape: a = "squircle"
285
286
  }) => {
286
- const d = is(t), m = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", h = a === "circle" ? { borderRadius: "50%" } : {
287
+ const c = is(t), m = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", h = a === "circle" ? { borderRadius: "50%" } : {
287
288
  borderRadius: "33%",
288
289
  "corner-shape": "superellipse(1.3)"
289
290
  };
@@ -311,15 +312,15 @@ const q = ({
311
312
  "avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
312
313
  m
313
314
  ),
314
- children: d
315
+ children: c
315
316
  }
316
317
  )
317
318
  }
318
319
  );
319
- }, ye = P.memo(
320
+ }, Ee = U.memo(
320
321
  ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
321
322
  var N, E, I, k, x, R;
322
- const d = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), l = () => {
323
+ const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), l = () => {
323
324
  t && n(t);
324
325
  }, h = Object.values(((N = t == null ? void 0 : t.state) == null ? void 0 : N.members) || {}).find(
325
326
  (o) => {
@@ -331,12 +332,12 @@ const q = ({
331
332
  if (f != null && f.text) return f.text;
332
333
  const o = (u = f == null ? void 0 : f.attachments) == null ? void 0 : u[0];
333
334
  return o != null && o.asset_url ? o.asset_url : o != null && o.image_url ? o.image_url : o != null && o.og_scrape_url ? o.og_scrape_url : o != null && o.thumb_url ? o.thumb_url : "No messages yet";
334
- })(), v = f != null && f.created_at ? as(new Date(f.created_at)) : "", c = a ?? 0;
335
+ })(), v = f != null && f.created_at ? as(new Date(f.created_at)) : "", d = a ?? 0;
335
336
  return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
336
337
  channelId: t == null ? void 0 : t.id,
337
- isSelected: d,
338
+ isSelected: c,
338
339
  participantName: g,
339
- unreadCount: c,
340
+ unreadCount: d,
340
341
  hasTimestamp: !!v
341
342
  }), /* @__PURE__ */ e(
342
343
  "button",
@@ -346,8 +347,8 @@ const q = ({
346
347
  className: p(
347
348
  "group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
348
349
  {
349
- "bg-primary-alt/10 border-l-4 border-l-primary": d,
350
- "hover:bg-sand": !d
350
+ "bg-primary-alt/10 border-l-4 border-l-primary": c,
351
+ "hover:bg-sand": !c
351
352
  }
352
353
  ),
353
354
  children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
@@ -368,7 +369,7 @@ const q = ({
368
369
  {
369
370
  className: p(
370
371
  "text-sm font-medium truncate",
371
- d ? "text-primary" : "text-charcoal"
372
+ c ? "text-primary" : "text-charcoal"
372
373
  ),
373
374
  children: g
374
375
  }
@@ -377,7 +378,7 @@ const q = ({
377
378
  ] }),
378
379
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
379
380
  /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: M }),
380
- c > 0 && /* @__PURE__ */ e("span", { className: "bg-[#7f22fe] text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: c > 99 ? "99+" : c })
381
+ d > 0 && /* @__PURE__ */ e("span", { className: "bg-[#7f22fe] text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: d > 99 ? "99+" : d })
381
382
  ] })
382
383
  ] })
383
384
  ] })
@@ -385,8 +386,8 @@ const q = ({
385
386
  );
386
387
  }
387
388
  );
388
- ye.displayName = "CustomChannelPreview";
389
- const Ee = P.memo(
389
+ Ee.displayName = "CustomChannelPreview";
390
+ const Ie = U.memo(
390
391
  ({
391
392
  onChannelSelect: t,
392
393
  selectedChannel: s,
@@ -394,16 +395,16 @@ const Ee = P.memo(
394
395
  className: r,
395
396
  customEmptyStateIndicator: a
396
397
  }) => {
397
- const d = P.useRef(0);
398
- d.current++;
399
- const { debug: l = !1 } = ae();
398
+ const c = U.useRef(0);
399
+ c.current++;
400
+ const { debug: l = !1 } = oe();
400
401
  l && console.log("📺 [ChannelList] 🔄 RENDER START", {
401
- renderCount: d.current,
402
+ renderCount: c.current,
402
403
  selectedChannelId: s == null ? void 0 : s.id,
403
404
  filters: n
404
405
  });
405
- const m = P.useMemo(() => (g) => /* @__PURE__ */ e(
406
- ye,
406
+ const m = U.useMemo(() => (g) => /* @__PURE__ */ e(
407
+ Ee,
407
408
  {
408
409
  ...g,
409
410
  selectedChannel: s,
@@ -433,7 +434,7 @@ const Ee = P.memo(
433
434
  );
434
435
  }
435
436
  );
436
- Ee.displayName = "ChannelList";
437
+ Ie.displayName = "ChannelList";
437
438
  const ne = ({
438
439
  variant: t = "default",
439
440
  className: s,
@@ -452,7 +453,7 @@ const ne = ({
452
453
  children: n
453
454
  }
454
455
  );
455
- function Ie({ label: t, className: s, children: n, ...r }) {
456
+ function Se({ label: t, className: s, children: n, ...r }) {
456
457
  return /* @__PURE__ */ i(
457
458
  "button",
458
459
  {
@@ -473,12 +474,12 @@ function Ie({ label: t, className: s, children: n, ...r }) {
473
474
  }
474
475
  );
475
476
  }
476
- function Se({ onClick: t }) {
477
- return /* @__PURE__ */ e(Ie, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(ue, { className: "h-5 w-5 text-stone", weight: "bold" }) });
477
+ function pe({ onClick: t }) {
478
+ return /* @__PURE__ */ e(Se, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(me, { className: "h-5 w-5 text-stone", weight: "bold" }) });
478
479
  }
479
480
  const cs = (t) => ({
480
481
  linkPreviews: Array.from(t.previews.values()).filter(
481
- (s) => Ne.previewIsLoaded(s) || Ne.previewIsLoading(s)
482
+ (s) => be.previewIsLoaded(s) || be.previewIsLoading(s)
482
483
  )
483
484
  }), ds = ({
484
485
  link: t,
@@ -510,7 +511,7 @@ const cs = (t) => ({
510
511
  },
511
512
  className: "absolute right-4 top-4 flex size-6 items-center justify-center rounded-full border border-white/40 bg-white/70 backdrop-blur-2xl",
512
513
  "aria-label": "Close link preview",
513
- children: /* @__PURE__ */ e(ue, { className: "size-4 text-black/90" })
514
+ children: /* @__PURE__ */ e(me, { className: "size-4 text-black/90" })
514
515
  }
515
516
  ),
516
517
  /* @__PURE__ */ i("div", { className: "p-2", children: [
@@ -537,7 +538,7 @@ const cs = (t) => ({
537
538
  )) }) : null;
538
539
  }, ms = () => {
539
540
  const { handleSubmit: t } = He(), s = Ve();
540
- return /* @__PURE__ */ i(Ce, { children: [
541
+ return /* @__PURE__ */ i(ve, { children: [
541
542
  /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(We, {}) }),
542
543
  /* @__PURE__ */ i("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]", children: [
543
544
  /* @__PURE__ */ e(Ze, {}),
@@ -581,14 +582,62 @@ const cs = (t) => ({
581
582
  ] }),
582
583
  !s && /* @__PURE__ */ e(Je, { message: t.message })
583
584
  ] });
584
- }, gs = () => null, xs = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
585
+ }, gs = () => null, xs = ({ className: t, message: s }) => /* @__PURE__ */ i(
586
+ "div",
587
+ {
588
+ className: p("flex items-center justify-center h-full", t),
589
+ children: [
590
+ /* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
591
+ /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
592
+ "animateTransform",
593
+ {
594
+ attributeName: "transform",
595
+ dur: "1s",
596
+ type: "translate",
597
+ values: "0 15 ; 0 -15; 0 15",
598
+ repeatCount: "indefinite",
599
+ begin: "0.1"
600
+ }
601
+ ) }),
602
+ /* @__PURE__ */ e("circle", { cx: "30", cy: "50", r: "6", children: /* @__PURE__ */ e(
603
+ "animateTransform",
604
+ {
605
+ attributeName: "transform",
606
+ dur: "1s",
607
+ type: "translate",
608
+ values: "0 10 ; 0 -10; 0 10",
609
+ repeatCount: "indefinite",
610
+ begin: "0.2"
611
+ }
612
+ ) }),
613
+ /* @__PURE__ */ e("circle", { cx: "54", cy: "50", r: "6", children: /* @__PURE__ */ e(
614
+ "animateTransform",
615
+ {
616
+ attributeName: "transform",
617
+ dur: "1s",
618
+ type: "translate",
619
+ values: "0 5 ; 0 -5; 0 5",
620
+ repeatCount: "indefinite",
621
+ begin: "0.3"
622
+ }
623
+ ) })
624
+ ] }),
625
+ s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
626
+ ]
627
+ }
628
+ ), ae = U.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
629
+ /* @__PURE__ */ e(xs, { className: "w-6 h-6" }),
630
+ /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
631
+ ] }) }));
632
+ ae.displayName = "LoadingState";
633
+ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
585
634
  var h, g, w, f, S;
586
- const { channel: a } = ve(), d = P.useMemo(() => Object.values(a.state.members || {}).find(
635
+ const { channel: a } = we(), c = U.useMemo(() => Object.values(a.state.members || {}).find(
587
636
  (v) => {
588
- var c;
589
- return ((c = v.user) == null ? void 0 : c.id) && v.user.id !== a._client.userID;
637
+ var d;
638
+ return ((d = v.user) == null ? void 0 : d.id) && v.user.id !== a._client.userID;
590
639
  }
591
- ), [a._client.userID, a.state.members]), l = ((h = d == null ? void 0 : d.user) == null ? void 0 : h.name) || ((g = d == null ? void 0 : d.user) == null ? void 0 : g.id) || "Unknown member", m = (w = d == null ? void 0 : d.user) == null ? void 0 : w.image;
640
+ ), [a._client.userID, a.state.members]), l = ((h = c == null ? void 0 : c.user) == null ? void 0 : h.name) || ((g = c == null ? void 0 : c.user) == null ? void 0 : g.id) || "Unknown member", m = (w = c == null ? void 0 : c.user) == null ? void 0 : w.image;
592
641
  return /* @__PURE__ */ i("div", { className: "@container", children: [
593
642
  /* @__PURE__ */ i("div", { className: "flex justify-between items-center @lg:hidden", children: [
594
643
  /* @__PURE__ */ e(
@@ -602,14 +651,14 @@ const cs = (t) => ({
602
651
  }),
603
652
  type: "button",
604
653
  "aria-label": "Back to conversations",
605
- children: /* @__PURE__ */ e(he, { className: "size-5 text-black/90" })
654
+ children: /* @__PURE__ */ e(fe, { className: "size-5 text-black/90" })
606
655
  }
607
656
  ),
608
657
  /* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
609
658
  /* @__PURE__ */ e(
610
659
  q,
611
660
  {
612
- id: ((f = d == null ? void 0 : d.user) == null ? void 0 : f.id) || a.id || "unknown",
661
+ id: ((f = c == null ? void 0 : c.user) == null ? void 0 : f.id) || a.id || "unknown",
613
662
  name: l,
614
663
  image: m,
615
664
  size: 40
@@ -626,7 +675,7 @@ const cs = (t) => ({
626
675
  onClick: n,
627
676
  type: "button",
628
677
  "aria-label": "Show info",
629
- children: /* @__PURE__ */ e(fe, { className: "size-5 text-black/90" })
678
+ children: /* @__PURE__ */ e(ge, { className: "size-5 text-black/90" })
630
679
  }
631
680
  )
632
681
  ] }),
@@ -639,13 +688,13 @@ const cs = (t) => ({
639
688
  onClick: t,
640
689
  className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
641
690
  "aria-label": "Back to conversations",
642
- children: /* @__PURE__ */ e(he, { className: "size-5 text-black/90" })
691
+ children: /* @__PURE__ */ e(fe, { className: "size-5 text-black/90" })
643
692
  }
644
693
  ),
645
694
  /* @__PURE__ */ e(
646
695
  q,
647
696
  {
648
- id: ((S = d == null ? void 0 : d.user) == null ? void 0 : S.id) || a.id || "unknown",
697
+ id: ((S = c == null ? void 0 : c.user) == null ? void 0 : S.id) || a.id || "unknown",
649
698
  name: l,
650
699
  image: m,
651
700
  size: 40
@@ -660,26 +709,26 @@ const cs = (t) => ({
660
709
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
661
710
  ),
662
711
  onClick: n,
663
- children: /* @__PURE__ */ e(fe, { className: "size-5 text-black/90" })
712
+ children: /* @__PURE__ */ e(ge, { className: "size-5 text-black/90" })
664
713
  }
665
714
  )
666
715
  ] })
667
716
  ] });
668
- }, Ns = ({
717
+ }, bs = ({
669
718
  dialogRef: t,
670
719
  onClose: s,
671
720
  participant: n,
672
721
  channel: r,
673
722
  followerStatusLabel: a,
674
- onLeaveConversation: d,
723
+ onLeaveConversation: c,
675
724
  onBlockParticipant: l,
676
725
  showDeleteConversation: m = !0,
677
726
  onDeleteConversationClick: h,
678
727
  onBlockParticipantClick: g,
679
728
  onReportParticipantClick: w
680
729
  }) => {
681
- var Q, X, ie, O, H, J, $;
682
- const { service: f, debug: S } = ae(), [M, v] = y(!1), [c, N] = y(!1), [E, I] = y(!1), k = D(async () => {
730
+ var Q, X, ce, O, H, J, $;
731
+ const { service: f, debug: S } = oe(), [M, v] = y(!1), [d, N] = y(!1), [E, I] = y(!1), k = D(async () => {
683
732
  var _;
684
733
  if (!(!f || !((_ = n == null ? void 0 : n.user) != null && _.id)))
685
734
  try {
@@ -702,11 +751,11 @@ const cs = (t) => ({
702
751
  }, [k]);
703
752
  const x = async () => {
704
753
  var _;
705
- if (!c) {
754
+ if (!d) {
706
755
  h == null || h(), S && console.log("[ChannelInfoDialog] Leave conversation", r.cid), N(!0);
707
756
  try {
708
757
  const T = ((_ = r._client) == null ? void 0 : _.userID) ?? null;
709
- await r.hide(T, !1), d && await d(r), s();
758
+ await r.hide(T, !1), c && await c(r), s();
710
759
  } catch (T) {
711
760
  console.error("[ChannelInfoDialog] Failed to leave conversation", T);
712
761
  } finally {
@@ -745,7 +794,7 @@ const cs = (t) => ({
745
794
  );
746
795
  };
747
796
  if (!n) return null;
748
- const b = ((X = n.user) == null ? void 0 : X.name) || ((ie = n.user) == null ? void 0 : ie.id) || "Unknown member", B = (O = n.user) == null ? void 0 : O.image, j = (H = n.user) == null ? void 0 : H.email, W = (J = n.user) == null ? void 0 : J.username, Y = j || (W ? `linktr.ee/${W}` : void 0), oe = (($ = n.user) == null ? void 0 : $.id) || "unknown";
797
+ const b = ((X = n.user) == null ? void 0 : X.name) || ((ce = n.user) == null ? void 0 : ce.id) || "Unknown member", B = (O = n.user) == null ? void 0 : O.image, j = (H = n.user) == null ? void 0 : H.email, W = (J = n.user) == null ? void 0 : J.username, Y = j || (W ? `linktr.ee/${W}` : void 0), ie = (($ = n.user) == null ? void 0 : $.id) || "unknown";
749
798
  return (
750
799
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
751
800
  /* @__PURE__ */ e(
@@ -760,7 +809,7 @@ const cs = (t) => ({
760
809
  children: /* @__PURE__ */ i("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-none transition-shadow duration-200 group-open:shadow-max-elevation-light", children: [
761
810
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
762
811
  /* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
763
- /* @__PURE__ */ e(Se, { onClick: s })
812
+ /* @__PURE__ */ e(pe, { onClick: s })
764
813
  ] }),
765
814
  /* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
766
815
  /* @__PURE__ */ e(
@@ -772,7 +821,7 @@ const cs = (t) => ({
772
821
  /* @__PURE__ */ e(
773
822
  q,
774
823
  {
775
- id: oe,
824
+ id: ie,
776
825
  name: b,
777
826
  image: B,
778
827
  size: 88,
@@ -805,10 +854,10 @@ const cs = (t) => ({
805
854
  ne,
806
855
  {
807
856
  onClick: x,
808
- disabled: c,
809
- "aria-busy": c,
857
+ disabled: d,
858
+ "aria-busy": d,
810
859
  children: [
811
- c ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ss, { className: "h-5 w-5" }),
860
+ d ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ss, { className: "h-5 w-5" }),
812
861
  /* @__PURE__ */ e("span", { children: "Delete Conversation" })
813
862
  ]
814
863
  }
@@ -820,7 +869,7 @@ const cs = (t) => ({
820
869
  disabled: E,
821
870
  "aria-busy": E,
822
871
  children: [
823
- E ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ge, { className: "h-5 w-5" }),
872
+ E ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(xe, { className: "h-5 w-5" }),
824
873
  /* @__PURE__ */ e("span", { children: "Unblock" })
825
874
  ]
826
875
  }
@@ -831,7 +880,7 @@ const cs = (t) => ({
831
880
  disabled: E,
832
881
  "aria-busy": E,
833
882
  children: [
834
- E ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ge, { className: "h-5 w-5" }),
883
+ E ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(xe, { className: "h-5 w-5" }),
835
884
  /* @__PURE__ */ e("span", { children: "Block" })
836
885
  ]
837
886
  }
@@ -846,39 +895,39 @@ const cs = (t) => ({
846
895
  }
847
896
  )
848
897
  );
849
- }, bs = ({
898
+ }, Cs = ({
850
899
  onBack: t,
851
900
  showBackButton: s,
852
901
  renderMessageInputActions: n,
853
902
  onLeaveConversation: r,
854
903
  onBlockParticipant: a,
855
- showDeleteConversation: d = !0,
904
+ showDeleteConversation: c = !0,
856
905
  onDeleteConversationClick: l,
857
906
  onBlockParticipantClick: m,
858
907
  onReportParticipantClick: h
859
908
  }) => {
860
- const { channel: g } = ve(), w = z(null), f = P.useMemo(() => Object.values(g.state.members || {}).find(
909
+ const { channel: g } = we(), w = z(null), f = U.useMemo(() => Object.values(g.state.members || {}).find(
861
910
  (N) => {
862
911
  var E;
863
912
  return ((E = N.user) == null ? void 0 : E.id) && N.user.id !== g._client.userID;
864
913
  }
865
- ), [g._client.userID, g.state.members]), S = P.useMemo(() => {
866
- const c = g.data ?? {};
867
- if (c.followerStatus)
868
- return String(c.followerStatus);
869
- if (c.isFollower !== void 0)
870
- return c.isFollower ? "Subscribed to you" : "Not subscribed";
914
+ ), [g._client.userID, g.state.members]), S = U.useMemo(() => {
915
+ const d = g.data ?? {};
916
+ if (d.followerStatus)
917
+ return String(d.followerStatus);
918
+ if (d.isFollower !== void 0)
919
+ return d.isFollower ? "Subscribed to you" : "Not subscribed";
871
920
  }, [g.data]), M = D(() => {
872
- var c;
873
- (c = w.current) == null || c.showModal();
921
+ var d;
922
+ (d = w.current) == null || d.showModal();
874
923
  }, []), v = D(() => {
875
- var c;
876
- (c = w.current) == null || c.close();
924
+ var d;
925
+ (d = w.current) == null || d.close();
877
926
  }, []);
878
- return /* @__PURE__ */ i(Ce, { children: [
927
+ return /* @__PURE__ */ i(ve, { children: [
879
928
  /* @__PURE__ */ i(Xe, { children: [
880
929
  /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
881
- xs,
930
+ Ns,
882
931
  {
883
932
  onBack: t,
884
933
  showBackButton: s,
@@ -902,7 +951,7 @@ const cs = (t) => ({
902
951
  )
903
952
  ] }),
904
953
  /* @__PURE__ */ e(
905
- Ns,
954
+ bs,
906
955
  {
907
956
  dialogRef: w,
908
957
  onClose: v,
@@ -911,21 +960,21 @@ const cs = (t) => ({
911
960
  followerStatusLabel: S,
912
961
  onLeaveConversation: r,
913
962
  onBlockParticipant: a,
914
- showDeleteConversation: d,
963
+ showDeleteConversation: c,
915
964
  onDeleteConversationClick: l,
916
965
  onBlockParticipantClick: m,
917
966
  onReportParticipantClick: h
918
967
  }
919
968
  )
920
969
  ] });
921
- }, pe = P.memo(
970
+ }, ke = U.memo(
922
971
  ({
923
972
  channel: t,
924
973
  onBack: s,
925
974
  showBackButton: n = !1,
926
975
  renderMessageInputActions: r,
927
976
  onLeaveConversation: a,
928
- onBlockParticipant: d,
977
+ onBlockParticipant: c,
929
978
  className: l,
930
979
  CustomChannelEmptyState: m = gs,
931
980
  showDeleteConversation: h = !0,
@@ -945,14 +994,15 @@ const cs = (t) => ({
945
994
  channel: t,
946
995
  MessageSystem: fs,
947
996
  EmptyStateIndicator: m,
997
+ LoadingIndicator: ae,
948
998
  children: /* @__PURE__ */ e(
949
- bs,
999
+ Cs,
950
1000
  {
951
1001
  onBack: s,
952
1002
  showBackButton: n,
953
1003
  renderMessageInputActions: r,
954
1004
  onLeaveConversation: a,
955
- onBlockParticipant: d,
1005
+ onBlockParticipant: c,
956
1006
  CustomChannelEmptyState: m,
957
1007
  showDeleteConversation: h,
958
1008
  onDeleteConversationClick: g,
@@ -965,8 +1015,8 @@ const cs = (t) => ({
965
1015
  }
966
1016
  )
967
1017
  );
968
- pe.displayName = "ChannelView";
969
- function Cs({
1018
+ ke.displayName = "ChannelView";
1019
+ function vs({
970
1020
  searchQuery: t,
971
1021
  setSearchQuery: s,
972
1022
  placeholder: n
@@ -992,7 +1042,7 @@ function Cs({
992
1042
  }
993
1043
  ),
994
1044
  t && /* @__PURE__ */ e(
995
- Ie,
1045
+ Se,
996
1046
  {
997
1047
  label: "Clear search",
998
1048
  onClick: () => {
@@ -1000,21 +1050,21 @@ function Cs({
1000
1050
  s(""), (a = r.current) == null || a.focus();
1001
1051
  },
1002
1052
  className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
1003
- children: /* @__PURE__ */ e(ue, { className: "h-4 w-4", weight: "bold" })
1053
+ children: /* @__PURE__ */ e(me, { className: "h-4 w-4", weight: "bold" })
1004
1054
  }
1005
1055
  )
1006
1056
  ] });
1007
1057
  }
1008
- const vs = ({
1058
+ const ws = ({
1009
1059
  participantSource: t,
1010
1060
  onSelectParticipant: s,
1011
1061
  onClose: n,
1012
1062
  existingParticipantIds: r = /* @__PURE__ */ new Set(),
1013
1063
  participantLabel: a = "participants",
1014
- searchPlaceholder: d = "Search participants...",
1064
+ searchPlaceholder: c = "Search participants...",
1015
1065
  className: l
1016
1066
  }) => {
1017
- const { debug: m } = ae(), [h, g] = y(""), [w, f] = y([]), [S, M] = y(!1), [v, c] = y(null), [N, E] = y(
1067
+ const { debug: m } = oe(), [h, g] = y(""), [w, f] = y([]), [S, M] = y(!1), [v, d] = y(null), [N, E] = y(
1018
1068
  null
1019
1069
  ), I = z(!1);
1020
1070
  G(() => {
@@ -1026,7 +1076,7 @@ const vs = ({
1026
1076
  }
1027
1077
  if (I.current) return;
1028
1078
  (async () => {
1029
- m && console.log("[ParticipantPicker] Loading initial participants..."), M(!0), c(null);
1079
+ m && console.log("[ParticipantPicker] Loading initial participants..."), M(!0), d(null);
1030
1080
  try {
1031
1081
  const u = await t.loadParticipants({
1032
1082
  search: "",
@@ -1039,7 +1089,7 @@ const vs = ({
1039
1089
  );
1040
1090
  } catch (u) {
1041
1091
  const b = u instanceof Error ? u.message : "Failed to load participants";
1042
- c(b), console.error("[ParticipantPicker] Failed to load participants:", u);
1092
+ d(b), console.error("[ParticipantPicker] Failed to load participants:", u);
1043
1093
  } finally {
1044
1094
  M(!1);
1045
1095
  }
@@ -1069,7 +1119,7 @@ const vs = ({
1069
1119
  /* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
1070
1120
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
1071
1121
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
1072
- /* @__PURE__ */ e(Se, { onClick: n })
1122
+ /* @__PURE__ */ e(pe, { onClick: n })
1073
1123
  ] }),
1074
1124
  /* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
1075
1125
  "Select a ",
@@ -1080,11 +1130,11 @@ const vs = ({
1080
1130
  t.totalCount !== void 0 && ` • ${t.totalCount} ${a} total`
1081
1131
  ] }),
1082
1132
  /* @__PURE__ */ e(
1083
- Cs,
1133
+ vs,
1084
1134
  {
1085
1135
  searchQuery: h,
1086
1136
  setSearchQuery: g,
1087
- placeholder: d
1137
+ placeholder: c
1088
1138
  }
1089
1139
  )
1090
1140
  ] }),
@@ -1102,7 +1152,7 @@ const vs = ({
1102
1152
  "..."
1103
1153
  ] })
1104
1154
  ] }) }) : k.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
1105
- /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(xe, { className: "h-8 w-8 text-charcoal" }) }),
1155
+ /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(Ne, { className: "h-8 w-8 text-charcoal" }) }),
1106
1156
  /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: h ? `No ${a} found` : w.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
1107
1157
  /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: h ? "Try a different search term" : w.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
1108
1158
  ] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
@@ -1131,7 +1181,7 @@ const vs = ({
1131
1181
  b && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: b })
1132
1182
  ] })
1133
1183
  ] }),
1134
- /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N === o.id ? /* @__PURE__ */ e(re, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(xe, { className: "h-5 w-5 text-stone" }) })
1184
+ /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N === o.id ? /* @__PURE__ */ e(re, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(Ne, { className: "h-5 w-5 text-stone" }) })
1135
1185
  ] })
1136
1186
  }
1137
1187
  ) }, o.id);
@@ -1142,7 +1192,7 @@ const vs = ({
1142
1192
  ] }) })
1143
1193
  ] }) })
1144
1194
  ] });
1145
- }, ws = ({ className: t }) => /* @__PURE__ */ i(
1195
+ }, ys = ({ className: t }) => /* @__PURE__ */ i(
1146
1196
  "svg",
1147
1197
  {
1148
1198
  width: "140",
@@ -1276,17 +1326,17 @@ const vs = ({
1276
1326
  ] })
1277
1327
  ]
1278
1328
  }
1279
- ), ke = P.memo(
1329
+ ), Re = U.memo(
1280
1330
  ({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ i("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
1281
- /* @__PURE__ */ e(ws, {}),
1331
+ /* @__PURE__ */ e(ys, {}),
1282
1332
  s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
1283
1333
  /* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
1284
1334
  /* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
1285
1335
  ] })
1286
1336
  ] }) })
1287
1337
  );
1288
- ke.displayName = "EmptyState";
1289
- const le = P.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ i("div", { className: "text-center max-w-sm", children: [
1338
+ Re.displayName = "EmptyState";
1339
+ const le = U.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ i("div", { className: "text-center max-w-sm", children: [
1290
1340
  /* @__PURE__ */ e("div", { className: "w-24 h-24 bg-danger-alt/20 rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ e("span", { className: "text-4xl", children: "⚠️" }) }),
1291
1341
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
1292
1342
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
@@ -1301,61 +1351,13 @@ const le = P.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
1301
1351
  )
1302
1352
  ] }) }));
1303
1353
  le.displayName = "ErrorState";
1304
- const ys = ({ className: t, message: s }) => /* @__PURE__ */ i(
1305
- "div",
1306
- {
1307
- className: p("flex items-center justify-center h-full", t),
1308
- children: [
1309
- /* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
1310
- /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
1311
- "animateTransform",
1312
- {
1313
- attributeName: "transform",
1314
- dur: "1s",
1315
- type: "translate",
1316
- values: "0 15 ; 0 -15; 0 15",
1317
- repeatCount: "indefinite",
1318
- begin: "0.1"
1319
- }
1320
- ) }),
1321
- /* @__PURE__ */ e("circle", { cx: "30", cy: "50", r: "6", children: /* @__PURE__ */ e(
1322
- "animateTransform",
1323
- {
1324
- attributeName: "transform",
1325
- dur: "1s",
1326
- type: "translate",
1327
- values: "0 10 ; 0 -10; 0 10",
1328
- repeatCount: "indefinite",
1329
- begin: "0.2"
1330
- }
1331
- ) }),
1332
- /* @__PURE__ */ e("circle", { cx: "54", cy: "50", r: "6", children: /* @__PURE__ */ e(
1333
- "animateTransform",
1334
- {
1335
- attributeName: "transform",
1336
- dur: "1s",
1337
- type: "translate",
1338
- values: "0 5 ; 0 -5; 0 5",
1339
- repeatCount: "indefinite",
1340
- begin: "0.3"
1341
- }
1342
- ) })
1343
- ] }),
1344
- s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
1345
- ]
1346
- }
1347
- ), Re = P.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
1348
- /* @__PURE__ */ e(ys, { className: "w-6 h-6" }),
1349
- /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
1350
- ] }) }));
1351
- Re.displayName = "LoadingState";
1352
1354
  const Fs = ({
1353
1355
  capabilities: t = {},
1354
1356
  className: s,
1355
1357
  renderMessageInputActions: n,
1356
1358
  onChannelSelect: r,
1357
1359
  onParticipantSelect: a,
1358
- initialParticipantFilter: d,
1360
+ initialParticipantFilter: c,
1359
1361
  initialParticipantData: l,
1360
1362
  CustomChannelEmptyState: m,
1361
1363
  showChannelList: h = !0,
@@ -1367,18 +1369,18 @@ const Fs = ({
1367
1369
  }) => {
1368
1370
  const {
1369
1371
  service: v,
1370
- client: c,
1372
+ client: d,
1371
1373
  isConnected: N,
1372
1374
  isLoading: E,
1373
1375
  error: I,
1374
1376
  refreshConnection: k,
1375
1377
  debug: x
1376
- } = rs(), [R, o] = y(null), [u, b] = y(!1), [B, j] = y(!1), [W, Y] = y(!1), [oe, Q] = y(/* @__PURE__ */ new Set()), [X, ie] = y(0), [O, H] = y(!1), [J, $] = y(null), _ = z(null), {
1378
+ } = rs(), [R, o] = y(null), [u, b] = y(!1), [B, j] = y(!1), [W, Y] = y(!1), [ie, Q] = y(/* @__PURE__ */ new Set()), [X, ce] = y(0), [O, H] = y(!1), [J, $] = y(null), _ = z(null), {
1377
1379
  participantSource: T,
1378
1380
  participantLabel: A = "participants",
1379
1381
  showDeleteConversation: V = !0
1380
- } = t, K = P.useMemo(() => {
1381
- const C = c == null ? void 0 : c.userID;
1382
+ } = t, K = U.useMemo(() => {
1383
+ const C = d == null ? void 0 : d.userID;
1382
1384
  return {
1383
1385
  ...{
1384
1386
  type: "messaging",
@@ -1390,13 +1392,13 @@ const Fs = ({
1390
1392
  },
1391
1393
  ...g
1392
1394
  };
1393
- }, [g, c == null ? void 0 : c.userID]), ee = z(null), Z = D(async () => {
1394
- if (!c || !N) return;
1395
- const C = c.userID;
1395
+ }, [g, d == null ? void 0 : d.userID]), ee = z(null), Z = D(async () => {
1396
+ if (!d || !N) return;
1397
+ const C = d.userID;
1396
1398
  if (C)
1397
1399
  try {
1398
1400
  x && console.log("[MessagingShell] Syncing channels for user:", C);
1399
- const U = await c.queryChannels(
1401
+ const P = await d.queryChannels(
1400
1402
  {
1401
1403
  type: "messaging",
1402
1404
  members: { $in: [C] }
@@ -1404,39 +1406,39 @@ const Fs = ({
1404
1406
  {},
1405
1407
  { limit: 100 }
1406
1408
  ), F = /* @__PURE__ */ new Set();
1407
- U.forEach((L) => {
1408
- const ce = L.state.members;
1409
- Object.values(ce).forEach((Pe) => {
1410
- var me;
1411
- const de = (me = Pe.user) == null ? void 0 : me.id;
1412
- de && de !== C && F.add(de);
1409
+ P.forEach((L) => {
1410
+ const de = L.state.members;
1411
+ Object.values(de).forEach((Ue) => {
1412
+ var he;
1413
+ const ue = (he = Ue.user) == null ? void 0 : he.id;
1414
+ ue && ue !== C && F.add(ue);
1413
1415
  });
1414
- }), Q((L) => L.size === F.size && [...L].every((ce) => F.has(ce)) ? L : F), b(U.length > 0), j(!0), ee.current = C, x && console.log("[MessagingShell] Channels synced successfully:", {
1415
- channelCount: U.length,
1416
+ }), Q((L) => L.size === F.size && [...L].every((de) => F.has(de)) ? L : F), b(P.length > 0), j(!0), ee.current = C, x && console.log("[MessagingShell] Channels synced successfully:", {
1417
+ channelCount: P.length,
1416
1418
  memberCount: F.size
1417
1419
  });
1418
- } catch (U) {
1419
- console.error("[MessagingShell] Failed to sync channels:", U);
1420
+ } catch (P) {
1421
+ console.error("[MessagingShell] Failed to sync channels:", P);
1420
1422
  }
1421
- }, [c, N, x]);
1423
+ }, [d, N, x]);
1422
1424
  G(() => {
1423
- if (!c || !N) return;
1424
- const C = c.userID;
1425
+ if (!d || !N) return;
1426
+ const C = d.userID;
1425
1427
  C && ee.current !== C && Z();
1426
- }, [c, N, Z]), G(() => {
1427
- if (!d || !c || !N) return;
1428
+ }, [d, N, Z]), G(() => {
1429
+ if (!c || !d || !N) return;
1428
1430
  (async () => {
1429
- const U = c.userID;
1430
- if (U)
1431
+ const P = d.userID;
1432
+ if (P)
1431
1433
  try {
1432
1434
  x && console.log(
1433
1435
  "[MessagingShell] Loading initial conversation with:",
1434
- d
1436
+ c
1435
1437
  );
1436
- const F = await c.queryChannels(
1438
+ const F = await d.queryChannels(
1437
1439
  {
1438
1440
  type: "messaging",
1439
- members: { $eq: [U, d] }
1441
+ members: { $eq: [P, c] }
1440
1442
  },
1441
1443
  {},
1442
1444
  { limit: 1 }
@@ -1473,7 +1475,7 @@ const Fs = ({
1473
1475
  "No conversation found with this account"
1474
1476
  ), x && console.log(
1475
1477
  "[MessagingShell] No conversation found for:",
1476
- d
1478
+ c
1477
1479
  );
1478
1480
  } catch (F) {
1479
1481
  console.error(
@@ -1483,9 +1485,9 @@ const Fs = ({
1483
1485
  }
1484
1486
  })();
1485
1487
  }, [
1486
- d,
1487
- l,
1488
1488
  c,
1489
+ l,
1490
+ d,
1489
1491
  N,
1490
1492
  v,
1491
1493
  x,
@@ -1500,7 +1502,7 @@ const Fs = ({
1500
1502
  O || o(null);
1501
1503
  }, [O]), Me = D(
1502
1504
  async (C) => {
1503
- var U;
1505
+ var P;
1504
1506
  if (v)
1505
1507
  try {
1506
1508
  x && console.log(
@@ -1518,7 +1520,7 @@ const Fs = ({
1518
1520
  } catch (L) {
1519
1521
  console.warn("[MessagingShell] Failed to unhide channel:", L);
1520
1522
  }
1521
- o(F), Y(!1), (U = _.current) == null || U.close(), a == null || a(C);
1523
+ o(F), Y(!1), (P = _.current) == null || P.close(), a == null || a(C);
1522
1524
  } catch (F) {
1523
1525
  console.error("[MessagingShell] Failed to start conversation:", F);
1524
1526
  }
@@ -1543,7 +1545,7 @@ const Fs = ({
1543
1545
  },
1544
1546
  [Z, x]
1545
1547
  ), te = !!R;
1546
- return E ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(Re, {}) }) : I ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(le, { message: I, onBack: k }) }) : !N || !c ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(
1548
+ return E ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(ae, {}) }) : I ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(le, { message: I, onBack: k }) }) : !N || !d ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(
1547
1549
  le,
1548
1550
  {
1549
1551
  message: "Not connected to messaging service",
@@ -1572,7 +1574,7 @@ const Fs = ({
1572
1574
  }
1573
1575
  ),
1574
1576
  children: /* @__PURE__ */ e(
1575
- Ee,
1577
+ Ie,
1576
1578
  {
1577
1579
  onChannelSelect: _e,
1578
1580
  selectedChannel: R || void 0,
@@ -1588,14 +1590,14 @@ const Fs = ({
1588
1590
  className: p(
1589
1591
  "messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
1590
1592
  {
1591
- // In direct conversation mode, always show (full width)
1592
- flex: O || te,
1593
+ // In direct conversation mode (or waiting for it), always show (full width)
1594
+ flex: O || te || c,
1593
1595
  // Normal mode: hide on mobile when no channel selected
1594
- "hidden lg:flex": !O && !te
1596
+ "hidden lg:flex": !O && !te && !c
1595
1597
  }
1596
1598
  ),
1597
1599
  children: R ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1598
- pe,
1600
+ ke,
1599
1601
  {
1600
1602
  channel: R,
1601
1603
  onBack: De,
@@ -1610,8 +1612,11 @@ const Fs = ({
1610
1612
  onReportParticipantClick: M
1611
1613
  },
1612
1614
  R.id
1613
- ) }) : /* @__PURE__ */ e(
1614
- ke,
1615
+ ) }) : c ? (
1616
+ // Show loading while creating/loading direct conversation channel
1617
+ /* @__PURE__ */ e(ae, {})
1618
+ ) : /* @__PURE__ */ e(
1619
+ Re,
1615
1620
  {
1616
1621
  hasChannels: u,
1617
1622
  channelsLoaded: B
@@ -1629,12 +1634,12 @@ const Fs = ({
1629
1634
  onClick: Fe,
1630
1635
  onClose: se,
1631
1636
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
1632
- vs,
1637
+ ws,
1633
1638
  {
1634
1639
  participantSource: T,
1635
1640
  onSelectParticipant: Me,
1636
1641
  onClose: se,
1637
- existingParticipantIds: oe,
1642
+ existingParticipantIds: ie,
1638
1643
  participantLabel: A,
1639
1644
  searchPlaceholder: `Search ${A}...`
1640
1645
  },
@@ -1673,17 +1678,17 @@ const Fs = ({
1673
1678
  loadingFaqId: n,
1674
1679
  headerText: r,
1675
1680
  className: a,
1676
- avatarImage: d,
1681
+ avatarImage: c,
1677
1682
  avatarName: l
1678
1683
  }) => {
1679
1684
  const m = t.filter((h) => h.enabled).sort((h, g) => (h.order ?? 0) - (g.order ?? 0));
1680
1685
  return m.length === 0 ? null : /* @__PURE__ */ e("div", { className: a, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
1681
- (d || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1686
+ (c || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1682
1687
  q,
1683
1688
  {
1684
1689
  id: l || "account",
1685
1690
  name: l || "Account",
1686
- image: d,
1691
+ image: c,
1687
1692
  size: 24,
1688
1693
  shape: "circle"
1689
1694
  }
@@ -1709,7 +1714,7 @@ const Fs = ({
1709
1714
  )
1710
1715
  ] }) });
1711
1716
  }, Ls = (t, s = {}) => {
1712
- const { initialSearch: n = "", pageSize: r = 20 } = s, [a, d] = y([]), [l, m] = y(!1), [h, g] = y(null), [w, f] = y(n), [S, M] = y(!0), [v, c] = y(), N = D(async (x = !1, R) => {
1717
+ const { initialSearch: n = "", pageSize: r = 20 } = s, [a, c] = y([]), [l, m] = y(!1), [h, g] = y(null), [w, f] = y(n), [S, M] = y(!0), [v, d] = y(), N = D(async (x = !1, R) => {
1713
1718
  if (l) return;
1714
1719
  const o = R !== void 0 ? R : w;
1715
1720
  m(!0), g(null);
@@ -1719,9 +1724,9 @@ const Fs = ({
1719
1724
  limit: r,
1720
1725
  cursor: x ? void 0 : v
1721
1726
  });
1722
- d(
1727
+ c(
1723
1728
  (b) => x ? u.participants : [...b, ...u.participants]
1724
- ), M(u.hasMore), c(u.nextCursor);
1729
+ ), M(u.hasMore), d(u.nextCursor);
1725
1730
  } catch (u) {
1726
1731
  const b = u instanceof Error ? u.message : "Failed to load participants";
1727
1732
  g(b), console.error("[useParticipants] Load error:", u);
@@ -1731,9 +1736,9 @@ const Fs = ({
1731
1736
  }, [t, w, v, r, l]), E = D(() => {
1732
1737
  S && !l && N(!1);
1733
1738
  }, [S, l, N]), I = D((x) => {
1734
- f(x), c(void 0), N(!0, x);
1739
+ f(x), d(void 0), N(!0, x);
1735
1740
  }, [N]), k = D(() => {
1736
- c(void 0), N(!0);
1741
+ d(void 0), N(!0);
1737
1742
  }, [N]);
1738
1743
  return G(() => {
1739
1744
  N(!0);
@@ -1752,13 +1757,13 @@ const Fs = ({
1752
1757
  export {
1753
1758
  q as Avatar,
1754
1759
  gs as ChannelEmptyState,
1755
- Ee as ChannelList,
1756
- pe as ChannelView,
1760
+ Ie as ChannelList,
1761
+ ke as ChannelView,
1757
1762
  Ts as FaqList,
1758
1763
  Es as FaqListItem,
1759
1764
  Ms as MessagingProvider,
1760
1765
  Fs as MessagingShell,
1761
- vs as ParticipantPicker,
1766
+ ws as ParticipantPicker,
1762
1767
  as as formatRelativeTime,
1763
1768
  rs as useMessaging,
1764
1769
  Ls as useParticipants