@linktr.ee/messaging-react 1.12.3 → 1.12.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js 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(
@@ -237,7 +237,7 @@ const we = Ue({
237
237
  day: "numeric",
238
238
  year: "2-digit"
239
239
  });
240
- }, be = [
240
+ }, Ce = [
241
241
  "🍎",
242
242
  // Apple
243
243
  "🍌",
@@ -274,8 +274,8 @@ function os(t) {
274
274
  return Math.abs(s);
275
275
  }
276
276
  function is(t) {
277
- const n = os(t) % be.length;
278
- return be[n];
277
+ const n = os(t) % Ce.length;
278
+ return Ce[n];
279
279
  }
280
280
  const q = ({
281
281
  id: t,
@@ -284,7 +284,7 @@ const q = ({
284
284
  className: r,
285
285
  shape: a = "squircle"
286
286
  }) => {
287
- 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%" } : {
288
288
  borderRadius: "33%",
289
289
  "corner-shape": "superellipse(1.3)"
290
290
  };
@@ -312,15 +312,15 @@ const q = ({
312
312
  "avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
313
313
  m
314
314
  ),
315
- children: d
315
+ children: c
316
316
  }
317
317
  )
318
318
  }
319
319
  );
320
- }, ye = P.memo(
320
+ }, Ee = U.memo(
321
321
  ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
322
322
  var N, E, I, k, x, R;
323
- 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 = () => {
324
324
  t && n(t);
325
325
  }, h = Object.values(((N = t == null ? void 0 : t.state) == null ? void 0 : N.members) || {}).find(
326
326
  (o) => {
@@ -332,12 +332,12 @@ const q = ({
332
332
  if (f != null && f.text) return f.text;
333
333
  const o = (u = f == null ? void 0 : f.attachments) == null ? void 0 : u[0];
334
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";
335
- })(), 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;
336
336
  return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
337
337
  channelId: t == null ? void 0 : t.id,
338
- isSelected: d,
338
+ isSelected: c,
339
339
  participantName: g,
340
- unreadCount: c,
340
+ unreadCount: d,
341
341
  hasTimestamp: !!v
342
342
  }), /* @__PURE__ */ e(
343
343
  "button",
@@ -347,8 +347,8 @@ const q = ({
347
347
  className: p(
348
348
  "group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
349
349
  {
350
- "bg-primary-alt/10 border-l-4 border-l-primary": d,
351
- "hover:bg-sand": !d
350
+ "bg-primary-alt/10 border-l-4 border-l-primary": c,
351
+ "hover:bg-sand": !c
352
352
  }
353
353
  ),
354
354
  children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
@@ -369,7 +369,7 @@ const q = ({
369
369
  {
370
370
  className: p(
371
371
  "text-sm font-medium truncate",
372
- d ? "text-primary" : "text-charcoal"
372
+ c ? "text-primary" : "text-charcoal"
373
373
  ),
374
374
  children: g
375
375
  }
@@ -378,7 +378,7 @@ const q = ({
378
378
  ] }),
379
379
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
380
380
  /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: M }),
381
- 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 })
382
382
  ] })
383
383
  ] })
384
384
  ] })
@@ -386,8 +386,8 @@ const q = ({
386
386
  );
387
387
  }
388
388
  );
389
- ye.displayName = "CustomChannelPreview";
390
- const Ee = P.memo(
389
+ Ee.displayName = "CustomChannelPreview";
390
+ const Ie = U.memo(
391
391
  ({
392
392
  onChannelSelect: t,
393
393
  selectedChannel: s,
@@ -395,16 +395,16 @@ const Ee = P.memo(
395
395
  className: r,
396
396
  customEmptyStateIndicator: a
397
397
  }) => {
398
- const d = P.useRef(0);
399
- d.current++;
400
- const { debug: l = !1 } = ae();
398
+ const c = U.useRef(0);
399
+ c.current++;
400
+ const { debug: l = !1 } = oe();
401
401
  l && console.log("📺 [ChannelList] 🔄 RENDER START", {
402
- renderCount: d.current,
402
+ renderCount: c.current,
403
403
  selectedChannelId: s == null ? void 0 : s.id,
404
404
  filters: n
405
405
  });
406
- const m = P.useMemo(() => (g) => /* @__PURE__ */ e(
407
- ye,
406
+ const m = U.useMemo(() => (g) => /* @__PURE__ */ e(
407
+ Ee,
408
408
  {
409
409
  ...g,
410
410
  selectedChannel: s,
@@ -434,7 +434,7 @@ const Ee = P.memo(
434
434
  );
435
435
  }
436
436
  );
437
- Ee.displayName = "ChannelList";
437
+ Ie.displayName = "ChannelList";
438
438
  const ne = ({
439
439
  variant: t = "default",
440
440
  className: s,
@@ -453,7 +453,7 @@ const ne = ({
453
453
  children: n
454
454
  }
455
455
  );
456
- function Ie({ label: t, className: s, children: n, ...r }) {
456
+ function Se({ label: t, className: s, children: n, ...r }) {
457
457
  return /* @__PURE__ */ i(
458
458
  "button",
459
459
  {
@@ -474,12 +474,12 @@ function Ie({ label: t, className: s, children: n, ...r }) {
474
474
  }
475
475
  );
476
476
  }
477
- function Se({ onClick: t }) {
478
- 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" }) });
479
479
  }
480
480
  const cs = (t) => ({
481
481
  linkPreviews: Array.from(t.previews.values()).filter(
482
- (s) => Ne.previewIsLoaded(s) || Ne.previewIsLoading(s)
482
+ (s) => be.previewIsLoaded(s) || be.previewIsLoading(s)
483
483
  )
484
484
  }), ds = ({
485
485
  link: t,
@@ -511,7 +511,7 @@ const cs = (t) => ({
511
511
  },
512
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",
513
513
  "aria-label": "Close link preview",
514
- children: /* @__PURE__ */ e(ue, { className: "size-4 text-black/90" })
514
+ children: /* @__PURE__ */ e(me, { className: "size-4 text-black/90" })
515
515
  }
516
516
  ),
517
517
  /* @__PURE__ */ i("div", { className: "p-2", children: [
@@ -538,7 +538,7 @@ const cs = (t) => ({
538
538
  )) }) : null;
539
539
  }, ms = () => {
540
540
  const { handleSubmit: t } = He(), s = Ve();
541
- return /* @__PURE__ */ i(Ce, { children: [
541
+ return /* @__PURE__ */ i(ve, { children: [
542
542
  /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(We, {}) }),
543
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: [
544
544
  /* @__PURE__ */ e(Ze, {}),
@@ -582,14 +582,62 @@ const cs = (t) => ({
582
582
  ] }),
583
583
  !s && /* @__PURE__ */ e(Je, { message: t.message })
584
584
  ] });
585
- }, 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 }) => {
586
634
  var h, g, w, f, S;
587
- 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(
588
636
  (v) => {
589
- var c;
590
- 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;
591
639
  }
592
- ), [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;
593
641
  return /* @__PURE__ */ i("div", { className: "@container", children: [
594
642
  /* @__PURE__ */ i("div", { className: "flex justify-between items-center @lg:hidden", children: [
595
643
  /* @__PURE__ */ e(
@@ -603,14 +651,14 @@ const cs = (t) => ({
603
651
  }),
604
652
  type: "button",
605
653
  "aria-label": "Back to conversations",
606
- children: /* @__PURE__ */ e(he, { className: "size-5 text-black/90" })
654
+ children: /* @__PURE__ */ e(fe, { className: "size-5 text-black/90" })
607
655
  }
608
656
  ),
609
657
  /* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
610
658
  /* @__PURE__ */ e(
611
659
  q,
612
660
  {
613
- 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",
614
662
  name: l,
615
663
  image: m,
616
664
  size: 40
@@ -627,7 +675,7 @@ const cs = (t) => ({
627
675
  onClick: n,
628
676
  type: "button",
629
677
  "aria-label": "Show info",
630
- children: /* @__PURE__ */ e(fe, { className: "size-5 text-black/90" })
678
+ children: /* @__PURE__ */ e(ge, { className: "size-5 text-black/90" })
631
679
  }
632
680
  )
633
681
  ] }),
@@ -640,13 +688,13 @@ const cs = (t) => ({
640
688
  onClick: t,
641
689
  className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
642
690
  "aria-label": "Back to conversations",
643
- children: /* @__PURE__ */ e(he, { className: "size-5 text-black/90" })
691
+ children: /* @__PURE__ */ e(fe, { className: "size-5 text-black/90" })
644
692
  }
645
693
  ),
646
694
  /* @__PURE__ */ e(
647
695
  q,
648
696
  {
649
- 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",
650
698
  name: l,
651
699
  image: m,
652
700
  size: 40
@@ -661,26 +709,26 @@ const cs = (t) => ({
661
709
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
662
710
  ),
663
711
  onClick: n,
664
- children: /* @__PURE__ */ e(fe, { className: "size-5 text-black/90" })
712
+ children: /* @__PURE__ */ e(ge, { className: "size-5 text-black/90" })
665
713
  }
666
714
  )
667
715
  ] })
668
716
  ] });
669
- }, Ns = ({
717
+ }, bs = ({
670
718
  dialogRef: t,
671
719
  onClose: s,
672
720
  participant: n,
673
721
  channel: r,
674
722
  followerStatusLabel: a,
675
- onLeaveConversation: d,
723
+ onLeaveConversation: c,
676
724
  onBlockParticipant: l,
677
725
  showDeleteConversation: m = !0,
678
726
  onDeleteConversationClick: h,
679
727
  onBlockParticipantClick: g,
680
728
  onReportParticipantClick: w
681
729
  }) => {
682
- var Q, X, ie, O, H, J, $;
683
- 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 () => {
684
732
  var _;
685
733
  if (!(!f || !((_ = n == null ? void 0 : n.user) != null && _.id)))
686
734
  try {
@@ -703,11 +751,11 @@ const cs = (t) => ({
703
751
  }, [k]);
704
752
  const x = async () => {
705
753
  var _;
706
- if (!c) {
754
+ if (!d) {
707
755
  h == null || h(), S && console.log("[ChannelInfoDialog] Leave conversation", r.cid), N(!0);
708
756
  try {
709
757
  const T = ((_ = r._client) == null ? void 0 : _.userID) ?? null;
710
- await r.hide(T, !1), d && await d(r), s();
758
+ await r.hide(T, !1), c && await c(r), s();
711
759
  } catch (T) {
712
760
  console.error("[ChannelInfoDialog] Failed to leave conversation", T);
713
761
  } finally {
@@ -746,7 +794,7 @@ const cs = (t) => ({
746
794
  );
747
795
  };
748
796
  if (!n) return null;
749
- 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";
750
798
  return (
751
799
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
752
800
  /* @__PURE__ */ e(
@@ -761,7 +809,7 @@ const cs = (t) => ({
761
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: [
762
810
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
763
811
  /* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
764
- /* @__PURE__ */ e(Se, { onClick: s })
812
+ /* @__PURE__ */ e(pe, { onClick: s })
765
813
  ] }),
766
814
  /* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
767
815
  /* @__PURE__ */ e(
@@ -773,7 +821,7 @@ const cs = (t) => ({
773
821
  /* @__PURE__ */ e(
774
822
  q,
775
823
  {
776
- id: oe,
824
+ id: ie,
777
825
  name: b,
778
826
  image: B,
779
827
  size: 88,
@@ -806,10 +854,10 @@ const cs = (t) => ({
806
854
  ne,
807
855
  {
808
856
  onClick: x,
809
- disabled: c,
810
- "aria-busy": c,
857
+ disabled: d,
858
+ "aria-busy": d,
811
859
  children: [
812
- 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" }),
813
861
  /* @__PURE__ */ e("span", { children: "Delete Conversation" })
814
862
  ]
815
863
  }
@@ -821,7 +869,7 @@ const cs = (t) => ({
821
869
  disabled: E,
822
870
  "aria-busy": E,
823
871
  children: [
824
- 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" }),
825
873
  /* @__PURE__ */ e("span", { children: "Unblock" })
826
874
  ]
827
875
  }
@@ -832,7 +880,7 @@ const cs = (t) => ({
832
880
  disabled: E,
833
881
  "aria-busy": E,
834
882
  children: [
835
- 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" }),
836
884
  /* @__PURE__ */ e("span", { children: "Block" })
837
885
  ]
838
886
  }
@@ -847,39 +895,39 @@ const cs = (t) => ({
847
895
  }
848
896
  )
849
897
  );
850
- }, bs = ({
898
+ }, Cs = ({
851
899
  onBack: t,
852
900
  showBackButton: s,
853
901
  renderMessageInputActions: n,
854
902
  onLeaveConversation: r,
855
903
  onBlockParticipant: a,
856
- showDeleteConversation: d = !0,
904
+ showDeleteConversation: c = !0,
857
905
  onDeleteConversationClick: l,
858
906
  onBlockParticipantClick: m,
859
907
  onReportParticipantClick: h
860
908
  }) => {
861
- 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(
862
910
  (N) => {
863
911
  var E;
864
912
  return ((E = N.user) == null ? void 0 : E.id) && N.user.id !== g._client.userID;
865
913
  }
866
- ), [g._client.userID, g.state.members]), S = P.useMemo(() => {
867
- const c = g.data ?? {};
868
- if (c.followerStatus)
869
- return String(c.followerStatus);
870
- if (c.isFollower !== void 0)
871
- 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";
872
920
  }, [g.data]), M = D(() => {
873
- var c;
874
- (c = w.current) == null || c.showModal();
921
+ var d;
922
+ (d = w.current) == null || d.showModal();
875
923
  }, []), v = D(() => {
876
- var c;
877
- (c = w.current) == null || c.close();
924
+ var d;
925
+ (d = w.current) == null || d.close();
878
926
  }, []);
879
- return /* @__PURE__ */ i(Ce, { children: [
927
+ return /* @__PURE__ */ i(ve, { children: [
880
928
  /* @__PURE__ */ i(Xe, { children: [
881
929
  /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
882
- xs,
930
+ Ns,
883
931
  {
884
932
  onBack: t,
885
933
  showBackButton: s,
@@ -903,7 +951,7 @@ const cs = (t) => ({
903
951
  )
904
952
  ] }),
905
953
  /* @__PURE__ */ e(
906
- Ns,
954
+ bs,
907
955
  {
908
956
  dialogRef: w,
909
957
  onClose: v,
@@ -912,21 +960,21 @@ const cs = (t) => ({
912
960
  followerStatusLabel: S,
913
961
  onLeaveConversation: r,
914
962
  onBlockParticipant: a,
915
- showDeleteConversation: d,
963
+ showDeleteConversation: c,
916
964
  onDeleteConversationClick: l,
917
965
  onBlockParticipantClick: m,
918
966
  onReportParticipantClick: h
919
967
  }
920
968
  )
921
969
  ] });
922
- }, pe = P.memo(
970
+ }, ke = U.memo(
923
971
  ({
924
972
  channel: t,
925
973
  onBack: s,
926
974
  showBackButton: n = !1,
927
975
  renderMessageInputActions: r,
928
976
  onLeaveConversation: a,
929
- onBlockParticipant: d,
977
+ onBlockParticipant: c,
930
978
  className: l,
931
979
  CustomChannelEmptyState: m = gs,
932
980
  showDeleteConversation: h = !0,
@@ -946,14 +994,15 @@ const cs = (t) => ({
946
994
  channel: t,
947
995
  MessageSystem: fs,
948
996
  EmptyStateIndicator: m,
997
+ LoadingIndicator: ae,
949
998
  children: /* @__PURE__ */ e(
950
- bs,
999
+ Cs,
951
1000
  {
952
1001
  onBack: s,
953
1002
  showBackButton: n,
954
1003
  renderMessageInputActions: r,
955
1004
  onLeaveConversation: a,
956
- onBlockParticipant: d,
1005
+ onBlockParticipant: c,
957
1006
  CustomChannelEmptyState: m,
958
1007
  showDeleteConversation: h,
959
1008
  onDeleteConversationClick: g,
@@ -966,8 +1015,8 @@ const cs = (t) => ({
966
1015
  }
967
1016
  )
968
1017
  );
969
- pe.displayName = "ChannelView";
970
- function Cs({
1018
+ ke.displayName = "ChannelView";
1019
+ function vs({
971
1020
  searchQuery: t,
972
1021
  setSearchQuery: s,
973
1022
  placeholder: n
@@ -993,7 +1042,7 @@ function Cs({
993
1042
  }
994
1043
  ),
995
1044
  t && /* @__PURE__ */ e(
996
- Ie,
1045
+ Se,
997
1046
  {
998
1047
  label: "Clear search",
999
1048
  onClick: () => {
@@ -1001,21 +1050,21 @@ function Cs({
1001
1050
  s(""), (a = r.current) == null || a.focus();
1002
1051
  },
1003
1052
  className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
1004
- children: /* @__PURE__ */ e(ue, { className: "h-4 w-4", weight: "bold" })
1053
+ children: /* @__PURE__ */ e(me, { className: "h-4 w-4", weight: "bold" })
1005
1054
  }
1006
1055
  )
1007
1056
  ] });
1008
1057
  }
1009
- const vs = ({
1058
+ const ws = ({
1010
1059
  participantSource: t,
1011
1060
  onSelectParticipant: s,
1012
1061
  onClose: n,
1013
1062
  existingParticipantIds: r = /* @__PURE__ */ new Set(),
1014
1063
  participantLabel: a = "participants",
1015
- searchPlaceholder: d = "Search participants...",
1064
+ searchPlaceholder: c = "Search participants...",
1016
1065
  className: l
1017
1066
  }) => {
1018
- 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(
1019
1068
  null
1020
1069
  ), I = z(!1);
1021
1070
  G(() => {
@@ -1027,7 +1076,7 @@ const vs = ({
1027
1076
  }
1028
1077
  if (I.current) return;
1029
1078
  (async () => {
1030
- m && console.log("[ParticipantPicker] Loading initial participants..."), M(!0), c(null);
1079
+ m && console.log("[ParticipantPicker] Loading initial participants..."), M(!0), d(null);
1031
1080
  try {
1032
1081
  const u = await t.loadParticipants({
1033
1082
  search: "",
@@ -1040,7 +1089,7 @@ const vs = ({
1040
1089
  );
1041
1090
  } catch (u) {
1042
1091
  const b = u instanceof Error ? u.message : "Failed to load participants";
1043
- c(b), console.error("[ParticipantPicker] Failed to load participants:", u);
1092
+ d(b), console.error("[ParticipantPicker] Failed to load participants:", u);
1044
1093
  } finally {
1045
1094
  M(!1);
1046
1095
  }
@@ -1070,7 +1119,7 @@ const vs = ({
1070
1119
  /* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
1071
1120
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
1072
1121
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
1073
- /* @__PURE__ */ e(Se, { onClick: n })
1122
+ /* @__PURE__ */ e(pe, { onClick: n })
1074
1123
  ] }),
1075
1124
  /* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
1076
1125
  "Select a ",
@@ -1081,11 +1130,11 @@ const vs = ({
1081
1130
  t.totalCount !== void 0 && ` • ${t.totalCount} ${a} total`
1082
1131
  ] }),
1083
1132
  /* @__PURE__ */ e(
1084
- Cs,
1133
+ vs,
1085
1134
  {
1086
1135
  searchQuery: h,
1087
1136
  setSearchQuery: g,
1088
- placeholder: d
1137
+ placeholder: c
1089
1138
  }
1090
1139
  )
1091
1140
  ] }),
@@ -1103,7 +1152,7 @@ const vs = ({
1103
1152
  "..."
1104
1153
  ] })
1105
1154
  ] }) }) : k.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
1106
- /* @__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" }) }),
1107
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` }),
1108
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` })
1109
1158
  ] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
@@ -1132,7 +1181,7 @@ const vs = ({
1132
1181
  b && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: b })
1133
1182
  ] })
1134
1183
  ] }),
1135
- /* @__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" }) })
1136
1185
  ] })
1137
1186
  }
1138
1187
  ) }, o.id);
@@ -1143,7 +1192,7 @@ const vs = ({
1143
1192
  ] }) })
1144
1193
  ] }) })
1145
1194
  ] });
1146
- }, ws = ({ className: t }) => /* @__PURE__ */ i(
1195
+ }, ys = ({ className: t }) => /* @__PURE__ */ i(
1147
1196
  "svg",
1148
1197
  {
1149
1198
  width: "140",
@@ -1277,17 +1326,17 @@ const vs = ({
1277
1326
  ] })
1278
1327
  ]
1279
1328
  }
1280
- ), ke = P.memo(
1329
+ ), Re = U.memo(
1281
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: [
1282
- /* @__PURE__ */ e(ws, {}),
1331
+ /* @__PURE__ */ e(ys, {}),
1283
1332
  s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
1284
1333
  /* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
1285
1334
  /* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
1286
1335
  ] })
1287
1336
  ] }) })
1288
1337
  );
1289
- ke.displayName = "EmptyState";
1290
- 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: [
1291
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: "⚠️" }) }),
1292
1341
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
1293
1342
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
@@ -1302,61 +1351,13 @@ const le = P.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
1302
1351
  )
1303
1352
  ] }) }));
1304
1353
  le.displayName = "ErrorState";
1305
- const ys = ({ className: t, message: s }) => /* @__PURE__ */ i(
1306
- "div",
1307
- {
1308
- className: p("flex items-center justify-center h-full", t),
1309
- children: [
1310
- /* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
1311
- /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
1312
- "animateTransform",
1313
- {
1314
- attributeName: "transform",
1315
- dur: "1s",
1316
- type: "translate",
1317
- values: "0 15 ; 0 -15; 0 15",
1318
- repeatCount: "indefinite",
1319
- begin: "0.1"
1320
- }
1321
- ) }),
1322
- /* @__PURE__ */ e("circle", { cx: "30", cy: "50", r: "6", children: /* @__PURE__ */ e(
1323
- "animateTransform",
1324
- {
1325
- attributeName: "transform",
1326
- dur: "1s",
1327
- type: "translate",
1328
- values: "0 10 ; 0 -10; 0 10",
1329
- repeatCount: "indefinite",
1330
- begin: "0.2"
1331
- }
1332
- ) }),
1333
- /* @__PURE__ */ e("circle", { cx: "54", cy: "50", r: "6", children: /* @__PURE__ */ e(
1334
- "animateTransform",
1335
- {
1336
- attributeName: "transform",
1337
- dur: "1s",
1338
- type: "translate",
1339
- values: "0 5 ; 0 -5; 0 5",
1340
- repeatCount: "indefinite",
1341
- begin: "0.3"
1342
- }
1343
- ) })
1344
- ] }),
1345
- s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
1346
- ]
1347
- }
1348
- ), 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: [
1349
- /* @__PURE__ */ e(ys, { className: "w-6 h-6" }),
1350
- /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
1351
- ] }) }));
1352
- Re.displayName = "LoadingState";
1353
1354
  const Fs = ({
1354
1355
  capabilities: t = {},
1355
1356
  className: s,
1356
1357
  renderMessageInputActions: n,
1357
1358
  onChannelSelect: r,
1358
1359
  onParticipantSelect: a,
1359
- initialParticipantFilter: d,
1360
+ initialParticipantFilter: c,
1360
1361
  initialParticipantData: l,
1361
1362
  CustomChannelEmptyState: m,
1362
1363
  showChannelList: h = !0,
@@ -1368,18 +1369,18 @@ const Fs = ({
1368
1369
  }) => {
1369
1370
  const {
1370
1371
  service: v,
1371
- client: c,
1372
+ client: d,
1372
1373
  isConnected: N,
1373
1374
  isLoading: E,
1374
1375
  error: I,
1375
1376
  refreshConnection: k,
1376
1377
  debug: x
1377
- } = 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), {
1378
1379
  participantSource: T,
1379
1380
  participantLabel: A = "participants",
1380
1381
  showDeleteConversation: V = !0
1381
- } = t, K = P.useMemo(() => {
1382
- const C = c == null ? void 0 : c.userID;
1382
+ } = t, K = U.useMemo(() => {
1383
+ const C = d == null ? void 0 : d.userID;
1383
1384
  return {
1384
1385
  ...{
1385
1386
  type: "messaging",
@@ -1391,13 +1392,13 @@ const Fs = ({
1391
1392
  },
1392
1393
  ...g
1393
1394
  };
1394
- }, [g, c == null ? void 0 : c.userID]), ee = z(null), Z = D(async () => {
1395
- if (!c || !N) return;
1396
- 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;
1397
1398
  if (C)
1398
1399
  try {
1399
1400
  x && console.log("[MessagingShell] Syncing channels for user:", C);
1400
- const U = await c.queryChannels(
1401
+ const P = await d.queryChannels(
1401
1402
  {
1402
1403
  type: "messaging",
1403
1404
  members: { $in: [C] }
@@ -1405,39 +1406,39 @@ const Fs = ({
1405
1406
  {},
1406
1407
  { limit: 100 }
1407
1408
  ), F = /* @__PURE__ */ new Set();
1408
- U.forEach((L) => {
1409
- const ce = L.state.members;
1410
- Object.values(ce).forEach((Pe) => {
1411
- var me;
1412
- const de = (me = Pe.user) == null ? void 0 : me.id;
1413
- 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);
1414
1415
  });
1415
- }), 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:", {
1416
- 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,
1417
1418
  memberCount: F.size
1418
1419
  });
1419
- } catch (U) {
1420
- console.error("[MessagingShell] Failed to sync channels:", U);
1420
+ } catch (P) {
1421
+ console.error("[MessagingShell] Failed to sync channels:", P);
1421
1422
  }
1422
- }, [c, N, x]);
1423
+ }, [d, N, x]);
1423
1424
  G(() => {
1424
- if (!c || !N) return;
1425
- const C = c.userID;
1425
+ if (!d || !N) return;
1426
+ const C = d.userID;
1426
1427
  C && ee.current !== C && Z();
1427
- }, [c, N, Z]), G(() => {
1428
- if (!d || !c || !N) return;
1428
+ }, [d, N, Z]), G(() => {
1429
+ if (!c || !d || !N) return;
1429
1430
  (async () => {
1430
- const U = c.userID;
1431
- if (U)
1431
+ const P = d.userID;
1432
+ if (P)
1432
1433
  try {
1433
1434
  x && console.log(
1434
1435
  "[MessagingShell] Loading initial conversation with:",
1435
- d
1436
+ c
1436
1437
  );
1437
- const F = await c.queryChannels(
1438
+ const F = await d.queryChannels(
1438
1439
  {
1439
1440
  type: "messaging",
1440
- members: { $eq: [U, d] }
1441
+ members: { $eq: [P, c] }
1441
1442
  },
1442
1443
  {},
1443
1444
  { limit: 1 }
@@ -1474,7 +1475,7 @@ const Fs = ({
1474
1475
  "No conversation found with this account"
1475
1476
  ), x && console.log(
1476
1477
  "[MessagingShell] No conversation found for:",
1477
- d
1478
+ c
1478
1479
  );
1479
1480
  } catch (F) {
1480
1481
  console.error(
@@ -1484,9 +1485,9 @@ const Fs = ({
1484
1485
  }
1485
1486
  })();
1486
1487
  }, [
1487
- d,
1488
- l,
1489
1488
  c,
1489
+ l,
1490
+ d,
1490
1491
  N,
1491
1492
  v,
1492
1493
  x,
@@ -1501,7 +1502,7 @@ const Fs = ({
1501
1502
  O || o(null);
1502
1503
  }, [O]), Me = D(
1503
1504
  async (C) => {
1504
- var U;
1505
+ var P;
1505
1506
  if (v)
1506
1507
  try {
1507
1508
  x && console.log(
@@ -1519,7 +1520,7 @@ const Fs = ({
1519
1520
  } catch (L) {
1520
1521
  console.warn("[MessagingShell] Failed to unhide channel:", L);
1521
1522
  }
1522
- 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);
1523
1524
  } catch (F) {
1524
1525
  console.error("[MessagingShell] Failed to start conversation:", F);
1525
1526
  }
@@ -1544,7 +1545,7 @@ const Fs = ({
1544
1545
  },
1545
1546
  [Z, x]
1546
1547
  ), te = !!R;
1547
- 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(
1548
1549
  le,
1549
1550
  {
1550
1551
  message: "Not connected to messaging service",
@@ -1566,14 +1567,14 @@ const Fs = ({
1566
1567
  "messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
1567
1568
  {
1568
1569
  "!hidden": h === !1 || O,
1569
- // Hide on mobile when channel selected, show on desktop with consistent narrow width
1570
- "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !O && te,
1571
- // Show on mobile when no channel selected, use same narrow width on desktop
1572
- "flex flex-col w-full lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !O && !te
1570
+ // Hide on mobile when channel selected, show on desktop with consistent wide width
1571
+ "hidden lg:flex lg:flex-1 lg:max-w-2xl": h !== !1 && !O && te,
1572
+ // Show on mobile when no channel selected, use same wide width on desktop
1573
+ "flex flex-col w-full lg:flex-1 lg:max-w-2xl": h !== !1 && !O && !te
1573
1574
  }
1574
1575
  ),
1575
1576
  children: /* @__PURE__ */ e(
1576
- Ee,
1577
+ Ie,
1577
1578
  {
1578
1579
  onChannelSelect: _e,
1579
1580
  selectedChannel: R || void 0,
@@ -1589,14 +1590,14 @@ const Fs = ({
1589
1590
  className: p(
1590
1591
  "messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
1591
1592
  {
1592
- // In direct conversation mode, always show (full width)
1593
- flex: O || te,
1593
+ // In direct conversation mode (or waiting for it), always show (full width)
1594
+ flex: O || te || c,
1594
1595
  // Normal mode: hide on mobile when no channel selected
1595
- "hidden lg:flex": !O && !te
1596
+ "hidden lg:flex": !O && !te && !c
1596
1597
  }
1597
1598
  ),
1598
1599
  children: R ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1599
- pe,
1600
+ ke,
1600
1601
  {
1601
1602
  channel: R,
1602
1603
  onBack: De,
@@ -1611,8 +1612,11 @@ const Fs = ({
1611
1612
  onReportParticipantClick: M
1612
1613
  },
1613
1614
  R.id
1614
- ) }) : /* @__PURE__ */ e(
1615
- ke,
1615
+ ) }) : c ? (
1616
+ // Show loading while creating/loading direct conversation channel
1617
+ /* @__PURE__ */ e(ae, {})
1618
+ ) : /* @__PURE__ */ e(
1619
+ Re,
1616
1620
  {
1617
1621
  hasChannels: u,
1618
1622
  channelsLoaded: B
@@ -1630,12 +1634,12 @@ const Fs = ({
1630
1634
  onClick: Fe,
1631
1635
  onClose: se,
1632
1636
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
1633
- vs,
1637
+ ws,
1634
1638
  {
1635
1639
  participantSource: T,
1636
1640
  onSelectParticipant: Me,
1637
1641
  onClose: se,
1638
- existingParticipantIds: oe,
1642
+ existingParticipantIds: ie,
1639
1643
  participantLabel: A,
1640
1644
  searchPlaceholder: `Search ${A}...`
1641
1645
  },
@@ -1674,17 +1678,17 @@ const Fs = ({
1674
1678
  loadingFaqId: n,
1675
1679
  headerText: r,
1676
1680
  className: a,
1677
- avatarImage: d,
1681
+ avatarImage: c,
1678
1682
  avatarName: l
1679
1683
  }) => {
1680
1684
  const m = t.filter((h) => h.enabled).sort((h, g) => (h.order ?? 0) - (g.order ?? 0));
1681
1685
  return m.length === 0 ? null : /* @__PURE__ */ e("div", { className: a, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
1682
- (d || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1686
+ (c || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1683
1687
  q,
1684
1688
  {
1685
1689
  id: l || "account",
1686
1690
  name: l || "Account",
1687
- image: d,
1691
+ image: c,
1688
1692
  size: 24,
1689
1693
  shape: "circle"
1690
1694
  }
@@ -1710,7 +1714,7 @@ const Fs = ({
1710
1714
  )
1711
1715
  ] }) });
1712
1716
  }, Ls = (t, s = {}) => {
1713
- 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) => {
1714
1718
  if (l) return;
1715
1719
  const o = R !== void 0 ? R : w;
1716
1720
  m(!0), g(null);
@@ -1720,9 +1724,9 @@ const Fs = ({
1720
1724
  limit: r,
1721
1725
  cursor: x ? void 0 : v
1722
1726
  });
1723
- d(
1727
+ c(
1724
1728
  (b) => x ? u.participants : [...b, ...u.participants]
1725
- ), M(u.hasMore), c(u.nextCursor);
1729
+ ), M(u.hasMore), d(u.nextCursor);
1726
1730
  } catch (u) {
1727
1731
  const b = u instanceof Error ? u.message : "Failed to load participants";
1728
1732
  g(b), console.error("[useParticipants] Load error:", u);
@@ -1732,9 +1736,9 @@ const Fs = ({
1732
1736
  }, [t, w, v, r, l]), E = D(() => {
1733
1737
  S && !l && N(!1);
1734
1738
  }, [S, l, N]), I = D((x) => {
1735
- f(x), c(void 0), N(!0, x);
1739
+ f(x), d(void 0), N(!0, x);
1736
1740
  }, [N]), k = D(() => {
1737
- c(void 0), N(!0);
1741
+ d(void 0), N(!0);
1738
1742
  }, [N]);
1739
1743
  return G(() => {
1740
1744
  N(!0);
@@ -1753,13 +1757,13 @@ const Fs = ({
1753
1757
  export {
1754
1758
  q as Avatar,
1755
1759
  gs as ChannelEmptyState,
1756
- Ee as ChannelList,
1757
- pe as ChannelView,
1760
+ Ie as ChannelList,
1761
+ ke as ChannelView,
1758
1762
  Ts as FaqList,
1759
1763
  Es as FaqListItem,
1760
1764
  Ms as MessagingProvider,
1761
1765
  Fs as MessagingShell,
1762
- vs as ParticipantPicker,
1766
+ ws as ParticipantPicker,
1763
1767
  as as formatRelativeTime,
1764
1768
  rs as useMessaging,
1765
1769
  Ls as useParticipants