@linktr.ee/messaging-react 1.12.8-rc-1766044049 โ†’ 1.12.8-rc-1766045447

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 o, Fragment as we } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as i, Fragment as we } from "react/jsx-runtime";
2
2
  import k from "classnames";
3
- import P, { createContext as ye, useContext as Ee, useCallback as _, useState as y, useRef as z, useEffect as G } from "react";
4
- import { StreamChatService as Be } from "@linktr.ee/messaging-core";
5
- import { Chat as $e, ChannelList as Ge, useMessageComposer as He, useStateStore as Ve, MessageInput as We, useMessageInputContext as Ze, useMessageComposerHasSendableData as qe, useChannelStateContext as me, SimpleAttachmentSelector as Ye, QuotedMessagePreview as Je, AttachmentPreviewList as Qe, TextareaComposer as Xe, MessageTimestamp as Ke, Channel as es, Window as ss, MessageList as ts } from "stream-chat-react";
3
+ import U, { createContext as ye, useContext as Ee, useCallback as D, useState as y, useRef as z, useEffect as G } from "react";
4
+ import { StreamChatService as $e } from "@linktr.ee/messaging-core";
5
+ import { Chat as Ge, ChannelList as He, useMessageComposer as Ie, useStateStore as Ve, MessageInput as We, useMessageInputContext as Ze, useMessageComposerHasSendableData as qe, useChannelStateContext as ue, SimpleAttachmentSelector as Ye, QuotedMessagePreview as Je, AttachmentPreviewList as Qe, TextareaComposer as Xe, MessageTimestamp as Ke, Channel as es, Window as ss, MessageList as ts } from "stream-chat-react";
6
6
  import { XIcon as oe, ArrowUpIcon as ns, ArrowLeftIcon as ge, DotsThreeIcon as xe, SpinnerGapIcon as re, SignOutIcon as rs, ProhibitInsetIcon as be, FlagIcon as ls, MagnifyingGlassIcon as as, ChatCircleDotsIcon as Ne } from "@phosphor-icons/react";
7
- import { LinkPreviewsManager as ve } from "stream-chat";
8
- const Ie = ye({
7
+ import { LinkPreviewsManager as Ce } from "stream-chat";
8
+ const Se = ye({
9
9
  service: null,
10
10
  client: null,
11
11
  isConnected: !1,
@@ -15,19 +15,19 @@ const Ie = ye({
15
15
  refreshConnection: async () => {
16
16
  },
17
17
  debug: !1
18
- }), ie = () => Ee(Ie), Ps = ({
18
+ }), ie = () => Ee(Se), Us = ({
19
19
  children: t,
20
20
  user: s,
21
21
  serviceConfig: n,
22
22
  apiKey: r,
23
23
  capabilities: a = {},
24
- debug: c = !1
24
+ debug: o = !1
25
25
  }) => {
26
- const l = _(
27
- (u, ...x) => {
28
- c && console.log(`๐Ÿ”ฅ [MessagingProvider] ${u}`, ...x);
26
+ const l = D(
27
+ (m, ...x) => {
28
+ o && console.log(`๐Ÿ”ฅ [MessagingProvider] ${m}`, ...x);
29
29
  },
30
- [c]
30
+ [o]
31
31
  );
32
32
  l("๐Ÿ”„ RENDER START", {
33
33
  userId: s == null ? void 0 : s.id,
@@ -35,7 +35,7 @@ const Ie = ye({
35
35
  serviceConfig: !!n,
36
36
  capabilities: Object.keys(a)
37
37
  });
38
- const [h, f] = y(null), [g, C] = y(null), [d, E] = y(!1), [R, I] = y(!1), [w, N] = y(null), m = z(!1), b = z({
38
+ const [h, f] = y(null), [g, N] = y(null), [c, E] = y(!1), [R, I] = y(!1), [w, C] = y(null), u = z(!1), b = z({
39
39
  userId: s == null ? void 0 : s.id,
40
40
  apiKey: r,
41
41
  serviceConfig: n,
@@ -56,9 +56,9 @@ const Ie = ye({
56
56
  serviceConfig: n,
57
57
  capabilities: a
58
58
  }, G(() => {
59
- const u = S.current;
59
+ const m = S.current;
60
60
  if (l("๐Ÿ”ง SERVICE INIT EFFECT TRIGGERED", {
61
- renderCount: u,
61
+ renderCount: m,
62
62
  apiKey: !!r,
63
63
  serviceConfig: !!n,
64
64
  dependencies: {
@@ -69,31 +69,31 @@ const Ie = ye({
69
69
  }
70
70
  }), !r || !n) {
71
71
  l("โš ๏ธ SERVICE INIT SKIPPED", {
72
- renderCount: u,
72
+ renderCount: m,
73
73
  reason: "Missing apiKey or serviceConfig"
74
74
  });
75
75
  return;
76
76
  }
77
77
  l("๐Ÿš€ CREATING NEW SERVICE", {
78
- renderCount: u,
78
+ renderCount: m,
79
79
  apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
80
80
  serviceConfigChanged: b.current.serviceConfig !== n
81
81
  });
82
- const x = new Be({
82
+ const x = new $e({
83
83
  ...n,
84
84
  apiKey: r,
85
- debug: c
85
+ debug: o
86
86
  });
87
87
  return f(x), l("โœ… SERVICE SET", {
88
- renderCount: u,
88
+ renderCount: m,
89
89
  serviceInstance: !!x
90
90
  }), () => {
91
91
  l("๐Ÿงน SERVICE CLEANUP", {
92
- renderCount: u,
92
+ renderCount: m,
93
93
  reason: "Effect cleanup"
94
94
  }), x.disconnectUser().catch(console.error);
95
95
  };
96
- }, [r, n, c, l]);
96
+ }, [r, n, o, l]);
97
97
  const p = z(null);
98
98
  G(() => {
99
99
  var x, B;
@@ -101,14 +101,14 @@ const Ie = ye({
101
101
  hasService: !!h,
102
102
  hasUser: !!s,
103
103
  userId: s == null ? void 0 : s.id,
104
- isConnecting: m.current,
105
- isConnected: d,
104
+ isConnecting: u.current,
105
+ isConnected: c,
106
106
  dependencies: { service: !!h, userId: s == null ? void 0 : s.id }
107
107
  }), !h || !s) {
108
108
  l("โš ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
109
109
  return;
110
110
  }
111
- if (m.current) {
111
+ if (u.current) {
112
112
  l("โš ๏ธ USER CONNECTION SKIPPED", "Already connecting");
113
113
  return;
114
114
  }
@@ -120,40 +120,40 @@ const Ie = ye({
120
120
  return;
121
121
  }
122
122
  (async () => {
123
- l("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), m.current = !0, I(!0), N(null);
123
+ l("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), u.current = !0, I(!0), C(null);
124
124
  try {
125
125
  l("๐Ÿ“ž CALLING SERVICE.CONNECTUSER", { userId: s.id });
126
126
  const A = await h.connectUser(s);
127
- C(A), E(!0), p.current = { serviceId: h, userId: s.id }, l("โœ… USER CONNECTION SUCCESS", {
127
+ N(A), E(!0), p.current = { serviceId: h, userId: s.id }, l("โœ… USER CONNECTION SUCCESS", {
128
128
  userId: s.id,
129
129
  clientId: A.userID
130
130
  });
131
131
  } catch (A) {
132
132
  const H = A instanceof Error ? A.message : "Connection failed";
133
- N(H), l("โŒ USER CONNECTION ERROR", {
133
+ C(H), l("โŒ USER CONNECTION ERROR", {
134
134
  userId: s.id,
135
135
  error: H
136
136
  });
137
137
  } finally {
138
- I(!1), m.current = !1, l("๐Ÿ”„ USER CONNECTION FINISHED", {
138
+ I(!1), u.current = !1, l("๐Ÿ”„ USER CONNECTION FINISHED", {
139
139
  userId: s.id,
140
- isConnected: d
140
+ isConnected: c
141
141
  });
142
142
  }
143
143
  })();
144
- }, [h, s, l, d]), G(() => (l("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
144
+ }, [h, s, l, c]), G(() => (l("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
145
145
  hasService: !!h,
146
- isConnected: d
146
+ isConnected: c
147
147
  }), () => {
148
- h && d ? (l(
148
+ h && c ? (l(
149
149
  "๐Ÿงน CLEANUP EFFECT TRIGGERED",
150
150
  "Cleaning up connection on unmount"
151
151
  ), p.current = null, h.disconnectUser().catch(console.error)) : l("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
152
152
  hasService: !!h,
153
- isConnected: d
153
+ isConnected: c
154
154
  });
155
- }), [h, d, l]);
156
- const T = _(async () => {
155
+ }), [h, c, l]);
156
+ const T = D(async () => {
157
157
  if (l("๐Ÿ”„ REFRESH CONNECTION CALLED", {
158
158
  hasService: !!h,
159
159
  hasUser: !!s
@@ -164,50 +164,50 @@ const Ie = ye({
164
164
  l("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), I(!0);
165
165
  try {
166
166
  l("๐Ÿ”Œ DISCONNECTING FOR REFRESH"), await h.disconnectUser(), l("๐Ÿ“ž RECONNECTING FOR REFRESH");
167
- const u = await h.connectUser(s);
168
- C(u), E(!0), N(null), l("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
169
- } catch (u) {
170
- const x = u instanceof Error ? u.message : "Refresh failed";
171
- N(x), l("โŒ CONNECTION REFRESH ERROR", {
167
+ const m = await h.connectUser(s);
168
+ N(m), E(!0), C(null), l("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
169
+ } catch (m) {
170
+ const x = m instanceof Error ? m.message : "Refresh failed";
171
+ C(x), l("โŒ CONNECTION REFRESH ERROR", {
172
172
  userId: s.id,
173
173
  error: x
174
174
  });
175
175
  } finally {
176
176
  I(!1), l("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
177
177
  }
178
- }, [h, s, l]), i = P.useMemo(() => (l("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
178
+ }, [h, s, l]), d = U.useMemo(() => (l("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
179
179
  hasService: !!h,
180
180
  hasClient: !!g,
181
- isConnected: d,
181
+ isConnected: c,
182
182
  isLoading: R,
183
183
  hasError: !!w,
184
184
  capabilitiesKeys: Object.keys(a)
185
185
  }), {
186
186
  service: h,
187
187
  client: g,
188
- isConnected: d,
188
+ isConnected: c,
189
189
  isLoading: R,
190
190
  error: w,
191
191
  capabilities: a,
192
192
  refreshConnection: T,
193
- debug: c
193
+ debug: o
194
194
  }), [
195
195
  h,
196
196
  g,
197
- d,
197
+ c,
198
198
  R,
199
199
  w,
200
200
  a,
201
201
  T,
202
- c,
202
+ o,
203
203
  l
204
204
  ]);
205
205
  return l("๐Ÿ”„ RENDER END", {
206
206
  renderCount: S.current,
207
- willRenderChat: !!(g && d),
208
- contextValueReady: !!i
209
- }), /* @__PURE__ */ e(Ie.Provider, { value: i, children: g && d ? /* @__PURE__ */ e(
210
- $e,
207
+ willRenderChat: !!(g && c),
208
+ contextValueReady: !!d
209
+ }), /* @__PURE__ */ e(Se.Provider, { value: d, children: g && c ? /* @__PURE__ */ e(
210
+ Ge,
211
211
  {
212
212
  client: g,
213
213
  customClasses: {
@@ -237,7 +237,7 @@ const Ie = ye({
237
237
  day: "numeric",
238
238
  year: "2-digit"
239
239
  });
240
- }, Ce = [
240
+ }, ve = [
241
241
  "๐ŸŽ",
242
242
  // Apple
243
243
  "๐ŸŒ",
@@ -273,9 +273,9 @@ function ds(t) {
273
273
  }
274
274
  return Math.abs(s);
275
275
  }
276
- function us(t) {
277
- const n = ds(t) % Ce.length;
278
- return Ce[n];
276
+ function ms(t) {
277
+ const n = ds(t) % ve.length;
278
+ return ve[n];
279
279
  }
280
280
  const Z = ({
281
281
  id: t,
@@ -284,7 +284,7 @@ const Z = ({
284
284
  className: r,
285
285
  shape: a = "squircle"
286
286
  }) => {
287
- const c = us(t), h = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", f = a === "circle" ? { borderRadius: "50%" } : {
287
+ const o = ms(t), h = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", f = a === "circle" ? { borderRadius: "50%" } : {
288
288
  borderRadius: "33%",
289
289
  "corner-shape": "superellipse(1.3)"
290
290
  };
@@ -312,30 +312,30 @@ const Z = ({
312
312
  "avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
313
313
  h
314
314
  ),
315
- children: c
315
+ children: o
316
316
  }
317
317
  )
318
318
  }
319
319
  );
320
- }, Se = P.memo(
320
+ }, pe = U.memo(
321
321
  ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
322
- var N, m, b, S, p, T;
323
- const c = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), l = () => {
322
+ var C, u, b, S, p, T;
323
+ const o = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), l = () => {
324
324
  t && n(t);
325
- }, f = Object.values(((N = t == null ? void 0 : t.state) == null ? void 0 : N.members) || {}).find(
326
- (i) => {
327
- var u, x;
328
- return ((u = i.user) == null ? void 0 : u.id) && i.user.id !== ((x = t == null ? void 0 : t._client) == null ? void 0 : x.userID);
325
+ }, f = Object.values(((C = t == null ? void 0 : t.state) == null ? void 0 : C.members) || {}).find(
326
+ (d) => {
327
+ var m, x;
328
+ return ((m = d.user) == null ? void 0 : m.id) && d.user.id !== ((x = t == null ? void 0 : t._client) == null ? void 0 : x.userID);
329
329
  }
330
- ), g = ((m = f == null ? void 0 : f.user) == null ? void 0 : m.name) || "Conversation", C = (b = f == null ? void 0 : f.user) == null ? void 0 : b.image, d = (p = (S = t == null ? void 0 : t.state) == null ? void 0 : S.messages) == null ? void 0 : p[t.state.messages.length - 1], R = (() => {
331
- var u;
332
- if (d != null && d.text) return d.text;
333
- const i = (u = d == null ? void 0 : d.attachments) == null ? void 0 : u[0];
334
- return i ? i.og_scrape_url ? i.og_scrape_url : i.type === "image" ? "๐Ÿ“ท Sent an image" : i.type === "video" ? "๐ŸŽฅ Sent a video" : i.type === "audio" ? "๐ŸŽต Sent audio" : i.type === "file" ? "๐Ÿ“Ž Sent a file" : "๐Ÿ“Ž Sent an attachment" : "No messages yet";
335
- })(), I = d != null && d.created_at ? cs(new Date(d.created_at)) : "", w = a ?? 0;
330
+ ), g = ((u = f == null ? void 0 : f.user) == null ? void 0 : u.name) || "Conversation", N = (b = f == null ? void 0 : f.user) == null ? void 0 : b.image, c = (p = (S = t == null ? void 0 : t.state) == null ? void 0 : S.messages) == null ? void 0 : p[t.state.messages.length - 1], R = (() => {
331
+ var m;
332
+ if (c != null && c.text) return c.text;
333
+ const d = (m = c == null ? void 0 : c.attachments) == null ? void 0 : m[0];
334
+ return d ? d.og_scrape_url ? d.og_scrape_url : d.type === "image" ? "๐Ÿ“ท Sent an image" : d.type === "video" ? "๐ŸŽฅ Sent a video" : d.type === "audio" ? "๐ŸŽต Sent audio" : d.type === "file" ? "๐Ÿ“Ž Sent a file" : "๐Ÿ“Ž Sent an attachment" : "No messages yet";
335
+ })(), I = c != null && c.created_at ? cs(new Date(c.created_at)) : "", w = a ?? 0;
336
336
  return r && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
337
337
  channelId: t == null ? void 0 : t.id,
338
- isSelected: c,
338
+ isSelected: o,
339
339
  participantName: g,
340
340
  unreadCount: w,
341
341
  hasTimestamp: !!I
@@ -347,36 +347,36 @@ const Z = ({
347
347
  className: k(
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": c,
351
- "hover:bg-sand": !c
350
+ "bg-primary-alt/10 border-l-4 border-l-primary": o,
351
+ "hover:bg-sand": !o
352
352
  }
353
353
  ),
354
- children: /* @__PURE__ */ o("div", { className: "flex items-start gap-3", children: [
354
+ children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
355
355
  /* @__PURE__ */ e(
356
356
  Z,
357
357
  {
358
358
  id: ((T = f == null ? void 0 : f.user) == null ? void 0 : T.id) || t.id || "unknown",
359
359
  name: g,
360
- image: C,
360
+ image: N,
361
361
  size: 44,
362
362
  className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
363
363
  }
364
364
  ),
365
- /* @__PURE__ */ o("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
366
- /* @__PURE__ */ o("div", { className: "flex items-center justify-between gap-2", children: [
365
+ /* @__PURE__ */ i("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
366
+ /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2", children: [
367
367
  /* @__PURE__ */ e(
368
368
  "h3",
369
369
  {
370
370
  className: k(
371
371
  "text-sm font-medium truncate",
372
- c ? "text-primary" : "text-charcoal"
372
+ o ? "text-primary" : "text-charcoal"
373
373
  ),
374
374
  children: g
375
375
  }
376
376
  ),
377
377
  I && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: I })
378
378
  ] }),
379
- /* @__PURE__ */ o("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
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: R }),
381
381
  w > 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: w > 99 ? "99+" : w })
382
382
  ] })
@@ -386,8 +386,8 @@ const Z = ({
386
386
  );
387
387
  }
388
388
  );
389
- Se.displayName = "CustomChannelPreview";
390
- const pe = P.memo(
389
+ pe.displayName = "CustomChannelPreview";
390
+ const ke = U.memo(
391
391
  ({
392
392
  onChannelSelect: t,
393
393
  selectedChannel: s,
@@ -395,16 +395,16 @@ const pe = P.memo(
395
395
  className: r,
396
396
  customEmptyStateIndicator: a
397
397
  }) => {
398
- const c = P.useRef(0);
399
- c.current++;
398
+ const o = U.useRef(0);
399
+ o.current++;
400
400
  const { debug: l = !1 } = ie();
401
401
  l && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ”„ RENDER START", {
402
- renderCount: c.current,
402
+ renderCount: o.current,
403
403
  selectedChannelId: s == null ? void 0 : s.id,
404
404
  filters: n
405
405
  });
406
- const h = P.useMemo(() => (g) => /* @__PURE__ */ e(
407
- Se,
406
+ const h = U.useMemo(() => (g) => /* @__PURE__ */ e(
407
+ pe,
408
408
  {
409
409
  ...g,
410
410
  selectedChannel: s,
@@ -420,7 +420,7 @@ const pe = P.memo(
420
420
  r
421
421
  ),
422
422
  children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: /* @__PURE__ */ e(
423
- Ge,
423
+ He,
424
424
  {
425
425
  filters: n,
426
426
  sort: { last_message_at: -1 },
@@ -434,7 +434,7 @@ const pe = P.memo(
434
434
  );
435
435
  }
436
436
  );
437
- pe.displayName = "ChannelList";
437
+ ke.displayName = "ChannelList";
438
438
  const ne = ({
439
439
  variant: t = "default",
440
440
  className: s,
@@ -453,8 +453,8 @@ const ne = ({
453
453
  children: n
454
454
  }
455
455
  );
456
- function ke({ label: t, className: s, children: n, ...r }) {
457
- return /* @__PURE__ */ o(
456
+ function Re({ label: t, className: s, children: n, ...r }) {
457
+ return /* @__PURE__ */ i(
458
458
  "button",
459
459
  {
460
460
  type: "button",
@@ -474,19 +474,19 @@ function ke({ label: t, className: s, children: n, ...r }) {
474
474
  }
475
475
  );
476
476
  }
477
- function Re({ onClick: t }) {
478
- return /* @__PURE__ */ e(ke, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(oe, { className: "h-5 w-5 text-stone", weight: "bold" }) });
477
+ function De({ onClick: t }) {
478
+ return /* @__PURE__ */ e(Re, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(oe, { className: "h-5 w-5 text-stone", weight: "bold" }) });
479
479
  }
480
- const ms = (t) => ({
480
+ const us = (t) => ({
481
481
  linkPreviews: Array.from(t.previews.values()).filter(
482
- (s) => ve.previewIsLoaded(s) || ve.previewIsLoading(s)
482
+ (s) => Ce.previewIsLoaded(s) || Ce.previewIsLoading(s)
483
483
  )
484
484
  }), hs = ({
485
485
  link: t,
486
486
  onDismiss: s
487
487
  }) => {
488
488
  const { og_scrape_url: n, title: r, image_url: a } = t;
489
- return /* @__PURE__ */ o(
489
+ return /* @__PURE__ */ i(
490
490
  "a",
491
491
  {
492
492
  href: n,
@@ -514,7 +514,7 @@ const ms = (t) => ({
514
514
  children: /* @__PURE__ */ e(oe, { className: "size-4 text-black/90" })
515
515
  }
516
516
  ),
517
- /* @__PURE__ */ o("div", { className: "p-2", children: [
517
+ /* @__PURE__ */ i("div", { className: "p-2", children: [
518
518
  r && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: r }),
519
519
  /* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55", children: n })
520
520
  ] })
@@ -522,9 +522,9 @@ const ms = (t) => ({
522
522
  }
523
523
  );
524
524
  }, fs = () => {
525
- const { linkPreviewsManager: t } = He(), { linkPreviews: s } = Ve(
525
+ const { linkPreviewsManager: t } = Ie(), { linkPreviews: s } = Ve(
526
526
  t.state,
527
- ms
527
+ us
528
528
  ), n = (a) => {
529
529
  t.dismissPreview(a);
530
530
  };
@@ -538,7 +538,7 @@ const ms = (t) => ({
538
538
  )) }) : null;
539
539
  }, _e = ye(
540
540
  {}
541
- ), gs = ({ attachment: t, onRemove: s }) => /* @__PURE__ */ o("div", { className: "relative w-full block rounded-[24px] bg-[#121110] p-2 mb-4", children: [
541
+ ), gs = ({ attachment: t, onRemove: s }) => /* @__PURE__ */ i("div", { className: "relative w-full block rounded-[24px] bg-[#121110] p-2 mb-4", children: [
542
542
  t.thumb_url && /* @__PURE__ */ e(
543
543
  "img",
544
544
  {
@@ -557,47 +557,73 @@ const ms = (t) => ({
557
557
  children: /* @__PURE__ */ e(oe, { className: "size-4 text-black/90" })
558
558
  }
559
559
  ),
560
- /* @__PURE__ */ o("div", { className: "p-2", children: [
560
+ /* @__PURE__ */ i("div", { className: "p-2", children: [
561
561
  t.title && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: t.title }),
562
562
  t.title_link && /* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55 truncate", children: t.title_link })
563
563
  ] })
564
564
  ] }), xs = () => {
565
- const { handleSubmit: t } = Ze(), s = qe(), { channel: n } = me(), { pendingAttachment: r, onClearPendingAttachment: a } = Ee(
565
+ const { handleSubmit: t } = Ze(), s = qe(), { channel: n } = ue(), r = Ie(), { pendingAttachment: a, onClearPendingAttachment: o } = Ee(
566
566
  _e
567
- ), c = s || !!r, l = _(
568
- async (h) => {
569
- var f;
570
- if (r && n) {
571
- const g = document.querySelector(
572
- ".str-chat__textarea textarea"
573
- ), C = ((f = g == null ? void 0 : g.value) == null ? void 0 : f.trim()) || "";
567
+ ), l = s || !!a, h = D(
568
+ (g) => {
569
+ g.key === "Enter" && !g.shiftKey && a && (g.preventDefault(), g.stopPropagation(), (async () => {
570
+ var N;
571
+ if (a && n)
572
+ try {
573
+ const c = ((N = r.textComposer.text) == null ? void 0 : N.trim()) || "";
574
+ await n.sendMessage({
575
+ text: c,
576
+ attachments: [a]
577
+ }), r.textComposer.setText(""), o == null || o();
578
+ } catch (c) {
579
+ console.error("Failed to send message with attachment:", c);
580
+ }
581
+ })());
582
+ },
583
+ [
584
+ n,
585
+ r.textComposer,
586
+ o,
587
+ a
588
+ ]
589
+ ), f = D(
590
+ async (g) => {
591
+ var N;
592
+ if (a && n)
574
593
  try {
594
+ const c = ((N = r.textComposer.text) == null ? void 0 : N.trim()) || "";
575
595
  await n.sendMessage({
576
- text: C,
577
- attachments: [r]
578
- }), g && (g.value = "", g.dispatchEvent(new Event("input", { bubbles: !0 }))), a == null || a();
579
- } catch (d) {
580
- console.error("Failed to send message with attachment:", d);
596
+ text: c,
597
+ attachments: [a]
598
+ }), r.textComposer.setText(""), o == null || o();
599
+ } catch (c) {
600
+ console.error("Failed to send message with attachment:", c);
581
601
  }
582
- } else
583
- await t(h);
602
+ else
603
+ await t(g);
584
604
  },
585
- [n, t, a, r]
605
+ [
606
+ n,
607
+ t,
608
+ r.textComposer,
609
+ o,
610
+ a
611
+ ]
586
612
  );
587
- return /* @__PURE__ */ o(we, { children: [
613
+ return /* @__PURE__ */ i(we, { children: [
588
614
  /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Ye, {}) }),
589
- /* @__PURE__ */ o("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: [
615
+ /* @__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: [
590
616
  /* @__PURE__ */ e(Je, {}),
591
617
  /* @__PURE__ */ e(fs, {}),
592
618
  /* @__PURE__ */ e(Qe, {}),
593
- r && a && /* @__PURE__ */ e(
619
+ a && o && /* @__PURE__ */ e(
594
620
  gs,
595
621
  {
596
- attachment: r,
597
- onRemove: a
622
+ attachment: a,
623
+ onRemove: o
598
624
  }
599
625
  ),
600
- /* @__PURE__ */ o("div", { className: "flex", children: [
626
+ /* @__PURE__ */ i("div", { className: "flex", onKeyDown: h, children: [
601
627
  /* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
602
628
  Xe,
603
629
  {
@@ -611,8 +637,8 @@ const ms = (t) => ({
611
637
  "aria-label": "Send",
612
638
  className: "str-chat__send-button mt-auto flex justify-center items-center flex-shrink-0 rounded-full size-8 bg-[#121110] disabled:bg-[#F1F0EE] disabled:text-black/20 text-white",
613
639
  "data-testid": "send-button",
614
- disabled: !c,
615
- onClick: l,
640
+ disabled: !l,
641
+ onClick: f,
616
642
  type: "button",
617
643
  children: /* @__PURE__ */ e(ns, { className: "size-4" })
618
644
  }
@@ -628,27 +654,27 @@ const ms = (t) => ({
628
654
  _e.Provider,
629
655
  {
630
656
  value: { pendingAttachment: s, onClearPendingAttachment: n },
631
- children: /* @__PURE__ */ o("div", { className: "message-input flex items-center gap-2 p-4", children: [
657
+ children: /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
632
658
  t && (t == null ? void 0 : t()),
633
659
  /* @__PURE__ */ e(We, { Input: xs })
634
660
  ] })
635
661
  }
636
662
  ), Ns = (t) => {
637
663
  const s = t.message.hide_date === !0;
638
- return /* @__PURE__ */ o("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
639
- /* @__PURE__ */ o("div", { className: "str-chat__message--system__text", children: [
664
+ return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
665
+ /* @__PURE__ */ i("div", { className: "str-chat__message--system__text", children: [
640
666
  /* @__PURE__ */ e("div", { className: "str-chat__message--system__line" }),
641
667
  /* @__PURE__ */ e("p", { children: t.message.text }),
642
668
  /* @__PURE__ */ e("div", { className: "str-chat__message--system__line" })
643
669
  ] }),
644
670
  !s && /* @__PURE__ */ e(Ke, { message: t.message })
645
671
  ] });
646
- }, vs = () => null, Cs = ({ className: t, message: s }) => /* @__PURE__ */ o(
672
+ }, Cs = () => null, vs = ({ className: t, message: s }) => /* @__PURE__ */ i(
647
673
  "div",
648
674
  {
649
675
  className: k("flex items-center justify-center h-full", t),
650
676
  children: [
651
- /* @__PURE__ */ o("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
677
+ /* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
652
678
  /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
653
679
  "animateTransform",
654
680
  {
@@ -686,21 +712,21 @@ const ms = (t) => ({
686
712
  s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
687
713
  ]
688
714
  }
689
- ), ae = P.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ o("div", { className: "flex items-center", children: [
690
- /* @__PURE__ */ e(Cs, { className: "w-6 h-6" }),
715
+ ), 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: [
716
+ /* @__PURE__ */ e(vs, { className: "w-6 h-6" }),
691
717
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
692
718
  ] }) }));
693
719
  ae.displayName = "LoadingState";
694
720
  const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
695
- var f, g, C, d, E;
696
- const { channel: a } = me(), c = P.useMemo(() => Object.values(a.state.members || {}).find(
721
+ var f, g, N, c, E;
722
+ const { channel: a } = ue(), o = U.useMemo(() => Object.values(a.state.members || {}).find(
697
723
  (I) => {
698
724
  var w;
699
725
  return ((w = I.user) == null ? void 0 : w.id) && I.user.id !== a._client.userID;
700
726
  }
701
- ), [a._client.userID, a.state.members]), l = ((f = c == null ? void 0 : c.user) == null ? void 0 : f.name) || ((g = c == null ? void 0 : c.user) == null ? void 0 : g.id) || "Unknown member", h = (C = c == null ? void 0 : c.user) == null ? void 0 : C.image;
702
- return /* @__PURE__ */ o("div", { className: "@container", children: [
703
- /* @__PURE__ */ o("div", { className: "flex justify-between items-center @lg:hidden", children: [
727
+ ), [a._client.userID, a.state.members]), l = ((f = o == null ? void 0 : o.user) == null ? void 0 : f.name) || ((g = o == null ? void 0 : o.user) == null ? void 0 : g.id) || "Unknown member", h = (N = o == null ? void 0 : o.user) == null ? void 0 : N.image;
728
+ return /* @__PURE__ */ i("div", { className: "@container", children: [
729
+ /* @__PURE__ */ i("div", { className: "flex justify-between items-center @lg:hidden", children: [
704
730
  /* @__PURE__ */ e(
705
731
  "button",
706
732
  {
@@ -715,11 +741,11 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
715
741
  children: /* @__PURE__ */ e(ge, { className: "size-5 text-black/90" })
716
742
  }
717
743
  ),
718
- /* @__PURE__ */ o("div", { className: "flex flex-col gap-1 items-center", children: [
744
+ /* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
719
745
  /* @__PURE__ */ e(
720
746
  Z,
721
747
  {
722
- id: ((d = c == null ? void 0 : c.user) == null ? void 0 : d.id) || a.id || "unknown",
748
+ id: ((c = o == null ? void 0 : o.user) == null ? void 0 : c.id) || a.id || "unknown",
723
749
  name: l,
724
750
  image: h,
725
751
  size: 40
@@ -740,8 +766,8 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
740
766
  }
741
767
  )
742
768
  ] }),
743
- /* @__PURE__ */ o("div", { className: "hidden @lg:flex items-center justify-between gap-3 min-h-12", children: [
744
- /* @__PURE__ */ o("div", { className: "flex items-center gap-4 min-w-0", children: [
769
+ /* @__PURE__ */ i("div", { className: "hidden @lg:flex items-center justify-between gap-3 min-h-12", children: [
770
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-4 min-w-0", children: [
745
771
  s && t && /* @__PURE__ */ e(
746
772
  "button",
747
773
  {
@@ -755,7 +781,7 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
755
781
  /* @__PURE__ */ e(
756
782
  Z,
757
783
  {
758
- id: ((E = c == null ? void 0 : c.user) == null ? void 0 : E.id) || a.id || "unknown",
784
+ id: ((E = o == null ? void 0 : o.user) == null ? void 0 : E.id) || a.id || "unknown",
759
785
  name: l,
760
786
  image: h,
761
787
  size: 40
@@ -781,74 +807,74 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
781
807
  participant: n,
782
808
  channel: r,
783
809
  followerStatusLabel: a,
784
- onLeaveConversation: c,
810
+ onLeaveConversation: o,
785
811
  onBlockParticipant: l,
786
812
  showDeleteConversation: h = !0,
787
813
  onDeleteConversationClick: f,
788
814
  onBlockParticipantClick: g,
789
- onReportParticipantClick: C
815
+ onReportParticipantClick: N
790
816
  }) => {
791
817
  var q, Q, X, K, ce, j, V;
792
- const { service: d, debug: E } = ie(), [R, I] = y(!1), [w, N] = y(!1), [m, b] = y(!1), S = _(async () => {
818
+ const { service: c, debug: E } = ie(), [R, I] = y(!1), [w, C] = y(!1), [u, b] = y(!1), S = D(async () => {
793
819
  var F;
794
- if (!(!d || !((F = n == null ? void 0 : n.user) != null && F.id)))
820
+ if (!(!c || !((F = n == null ? void 0 : n.user) != null && F.id)))
795
821
  try {
796
- const U = (await d.getBlockedUsers()).some(
822
+ const P = (await c.getBlockedUsers()).some(
797
823
  ($) => {
798
824
  var Y;
799
825
  return $.blocked_user_id === ((Y = n == null ? void 0 : n.user) == null ? void 0 : Y.id);
800
826
  }
801
827
  );
802
- I(U);
803
- } catch (D) {
828
+ I(P);
829
+ } catch (_) {
804
830
  console.error(
805
831
  "[ChannelInfoDialog] Failed to check blocked status:",
806
- D
832
+ _
807
833
  );
808
834
  }
809
- }, [d, (q = n == null ? void 0 : n.user) == null ? void 0 : q.id]);
835
+ }, [c, (q = n == null ? void 0 : n.user) == null ? void 0 : q.id]);
810
836
  G(() => {
811
837
  S();
812
838
  }, [S]);
813
839
  const p = async () => {
814
840
  var F;
815
841
  if (!w) {
816
- f == null || f(), E && console.log("[ChannelInfoDialog] Leave conversation", r.cid), N(!0);
842
+ f == null || f(), E && console.log("[ChannelInfoDialog] Leave conversation", r.cid), C(!0);
817
843
  try {
818
- const D = ((F = r._client) == null ? void 0 : F.userID) ?? null;
819
- await r.hide(D, !1), c && await c(r), s();
820
- } catch (D) {
821
- console.error("[ChannelInfoDialog] Failed to leave conversation", D);
844
+ const _ = ((F = r._client) == null ? void 0 : F.userID) ?? null;
845
+ await r.hide(_, !1), o && await o(r), s();
846
+ } catch (_) {
847
+ console.error("[ChannelInfoDialog] Failed to leave conversation", _);
822
848
  } finally {
823
- N(!1);
849
+ C(!1);
824
850
  }
825
851
  }
826
852
  }, T = async () => {
827
- var F, D, U;
828
- if (!(m || !d)) {
853
+ var F, _, P;
854
+ if (!(u || !c)) {
829
855
  g == null || g(), E && console.log("[ChannelInfoDialog] Block member", (F = n == null ? void 0 : n.user) == null ? void 0 : F.id), b(!0);
830
856
  try {
831
- await d.blockUser((D = n == null ? void 0 : n.user) == null ? void 0 : D.id), l && await l((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
857
+ await c.blockUser((_ = n == null ? void 0 : n.user) == null ? void 0 : _.id), l && await l((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), s();
832
858
  } catch ($) {
833
859
  console.error("[ChannelInfoDialog] Failed to block member", $);
834
860
  } finally {
835
861
  b(!1);
836
862
  }
837
863
  }
838
- }, i = async () => {
839
- var F, D, U;
840
- if (!(m || !d)) {
864
+ }, d = async () => {
865
+ var F, _, P;
866
+ if (!(u || !c)) {
841
867
  g == null || g(), E && console.log("[ChannelInfoDialog] Unblock member", (F = n == null ? void 0 : n.user) == null ? void 0 : F.id), b(!0);
842
868
  try {
843
- await d.unBlockUser((D = n == null ? void 0 : n.user) == null ? void 0 : D.id), l && await l((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
869
+ await c.unBlockUser((_ = n == null ? void 0 : n.user) == null ? void 0 : _.id), l && await l((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), s();
844
870
  } catch ($) {
845
871
  console.error("[ChannelInfoDialog] Failed to unblock member", $);
846
872
  } finally {
847
873
  b(!1);
848
874
  }
849
875
  }
850
- }, u = () => {
851
- C == null || C(), s(), window.open(
876
+ }, m = () => {
877
+ N == null || N(), s(), window.open(
852
878
  "https://linktr.ee/s/about/trust-center/report",
853
879
  "_blank",
854
880
  "noopener,noreferrer"
@@ -867,18 +893,18 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
867
893
  onClick: (F) => {
868
894
  F.target === t.current && s();
869
895
  },
870
- children: /* @__PURE__ */ o("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: [
871
- /* @__PURE__ */ o("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
896
+ 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: [
897
+ /* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
872
898
  /* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
873
- /* @__PURE__ */ e(Re, { onClick: s })
899
+ /* @__PURE__ */ e(De, { onClick: s })
874
900
  ] }),
875
- /* @__PURE__ */ o("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
901
+ /* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
876
902
  /* @__PURE__ */ e(
877
903
  "div",
878
904
  {
879
905
  className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
880
906
  style: { backgroundColor: "#FBFAF9" },
881
- children: /* @__PURE__ */ o("div", { className: "flex items-center gap-3 w-full", children: [
907
+ children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
882
908
  /* @__PURE__ */ e(
883
909
  Z,
884
910
  {
@@ -889,7 +915,7 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
889
915
  shape: "circle"
890
916
  }
891
917
  ),
892
- /* @__PURE__ */ o("div", { className: "flex flex-col min-w-0 flex-1", children: [
918
+ /* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
893
919
  /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: x }),
894
920
  J && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: J }),
895
921
  a && /* @__PURE__ */ e(
@@ -910,8 +936,8 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
910
936
  ] })
911
937
  }
912
938
  ),
913
- /* @__PURE__ */ o("ul", { className: "flex flex-col gap-2 mt-2", children: [
914
- h && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ o(
939
+ /* @__PURE__ */ i("ul", { className: "flex flex-col gap-2 mt-2", children: [
940
+ h && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
915
941
  ne,
916
942
  {
917
943
  onClick: p,
@@ -923,30 +949,30 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
923
949
  ]
924
950
  }
925
951
  ) }),
926
- /* @__PURE__ */ e("li", { children: R ? /* @__PURE__ */ o(
952
+ /* @__PURE__ */ e("li", { children: R ? /* @__PURE__ */ i(
927
953
  ne,
928
954
  {
929
- onClick: i,
930
- disabled: m,
931
- "aria-busy": m,
955
+ onClick: d,
956
+ disabled: u,
957
+ "aria-busy": u,
932
958
  children: [
933
- m ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(be, { className: "h-5 w-5" }),
959
+ u ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(be, { className: "h-5 w-5" }),
934
960
  /* @__PURE__ */ e("span", { children: "Unblock" })
935
961
  ]
936
962
  }
937
- ) : /* @__PURE__ */ o(
963
+ ) : /* @__PURE__ */ i(
938
964
  ne,
939
965
  {
940
966
  onClick: T,
941
- disabled: m,
942
- "aria-busy": m,
967
+ disabled: u,
968
+ "aria-busy": u,
943
969
  children: [
944
- m ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(be, { className: "h-5 w-5" }),
970
+ u ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(be, { className: "h-5 w-5" }),
945
971
  /* @__PURE__ */ e("span", { children: "Block" })
946
972
  ]
947
973
  }
948
974
  ) }),
949
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ o(ne, { variant: "danger", onClick: u, children: [
975
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ne, { variant: "danger", onClick: m, children: [
950
976
  /* @__PURE__ */ e(ls, { className: "h-5 w-5" }),
951
977
  /* @__PURE__ */ e("span", { children: "Report" })
952
978
  ] }) })
@@ -962,33 +988,33 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
962
988
  renderMessageInputActions: n,
963
989
  onLeaveConversation: r,
964
990
  onBlockParticipant: a,
965
- showDeleteConversation: c = !0,
991
+ showDeleteConversation: o = !0,
966
992
  onDeleteConversationClick: l,
967
993
  onBlockParticipantClick: h,
968
994
  onReportParticipantClick: f,
969
995
  pendingAttachment: g,
970
- onClearPendingAttachment: C
996
+ onClearPendingAttachment: N
971
997
  }) => {
972
- const { channel: d } = me(), E = z(null), R = P.useMemo(() => Object.values(d.state.members || {}).find(
998
+ const { channel: c } = ue(), E = z(null), R = U.useMemo(() => Object.values(c.state.members || {}).find(
973
999
  (b) => {
974
1000
  var S;
975
- return ((S = b.user) == null ? void 0 : S.id) && b.user.id !== d._client.userID;
1001
+ return ((S = b.user) == null ? void 0 : S.id) && b.user.id !== c._client.userID;
976
1002
  }
977
- ), [d._client.userID, d.state.members]), I = P.useMemo(() => {
978
- const m = d.data ?? {};
979
- if (m.followerStatus)
980
- return String(m.followerStatus);
981
- if (m.isFollower !== void 0)
982
- return m.isFollower ? "Subscribed to you" : "Not subscribed";
983
- }, [d.data]), w = _(() => {
984
- var m;
985
- (m = E.current) == null || m.showModal();
986
- }, []), N = _(() => {
987
- var m;
988
- (m = E.current) == null || m.close();
1003
+ ), [c._client.userID, c.state.members]), I = U.useMemo(() => {
1004
+ const u = c.data ?? {};
1005
+ if (u.followerStatus)
1006
+ return String(u.followerStatus);
1007
+ if (u.isFollower !== void 0)
1008
+ return u.isFollower ? "Subscribed to you" : "Not subscribed";
1009
+ }, [c.data]), w = D(() => {
1010
+ var u;
1011
+ (u = E.current) == null || u.showModal();
1012
+ }, []), C = D(() => {
1013
+ var u;
1014
+ (u = E.current) == null || u.close();
989
1015
  }, []);
990
- return /* @__PURE__ */ o(we, { children: [
991
- /* @__PURE__ */ o(ss, { children: [
1016
+ return /* @__PURE__ */ i(we, { children: [
1017
+ /* @__PURE__ */ i(ss, { children: [
992
1018
  /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
993
1019
  ws,
994
1020
  {
@@ -1009,9 +1035,9 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1009
1035
  /* @__PURE__ */ e(
1010
1036
  bs,
1011
1037
  {
1012
- renderActions: () => n == null ? void 0 : n(d),
1038
+ renderActions: () => n == null ? void 0 : n(c),
1013
1039
  pendingAttachment: g,
1014
- onClearPendingAttachment: C
1040
+ onClearPendingAttachment: N
1015
1041
  }
1016
1042
  )
1017
1043
  ] }),
@@ -1019,33 +1045,33 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1019
1045
  ys,
1020
1046
  {
1021
1047
  dialogRef: E,
1022
- onClose: N,
1048
+ onClose: C,
1023
1049
  participant: R,
1024
- channel: d,
1050
+ channel: c,
1025
1051
  followerStatusLabel: I,
1026
1052
  onLeaveConversation: r,
1027
1053
  onBlockParticipant: a,
1028
- showDeleteConversation: c,
1054
+ showDeleteConversation: o,
1029
1055
  onDeleteConversationClick: l,
1030
1056
  onBlockParticipantClick: h,
1031
1057
  onReportParticipantClick: f
1032
1058
  }
1033
1059
  )
1034
1060
  ] });
1035
- }, De = P.memo(
1061
+ }, Me = U.memo(
1036
1062
  ({
1037
1063
  channel: t,
1038
1064
  onBack: s,
1039
1065
  showBackButton: n = !1,
1040
1066
  renderMessageInputActions: r,
1041
1067
  onLeaveConversation: a,
1042
- onBlockParticipant: c,
1068
+ onBlockParticipant: o,
1043
1069
  className: l,
1044
- CustomChannelEmptyState: h = vs,
1070
+ CustomChannelEmptyState: h = Cs,
1045
1071
  showDeleteConversation: f = !0,
1046
1072
  onDeleteConversationClick: g,
1047
- onBlockParticipantClick: C,
1048
- onReportParticipantClick: d,
1073
+ onBlockParticipantClick: N,
1074
+ onReportParticipantClick: c,
1049
1075
  pendingAttachment: E,
1050
1076
  onClearPendingAttachment: R
1051
1077
  }) => /* @__PURE__ */ e(
@@ -1069,12 +1095,12 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1069
1095
  showBackButton: n,
1070
1096
  renderMessageInputActions: r,
1071
1097
  onLeaveConversation: a,
1072
- onBlockParticipant: c,
1098
+ onBlockParticipant: o,
1073
1099
  CustomChannelEmptyState: h,
1074
1100
  showDeleteConversation: f,
1075
1101
  onDeleteConversationClick: g,
1076
- onBlockParticipantClick: C,
1077
- onReportParticipantClick: d,
1102
+ onBlockParticipantClick: N,
1103
+ onReportParticipantClick: c,
1078
1104
  pendingAttachment: E,
1079
1105
  onClearPendingAttachment: R
1080
1106
  }
@@ -1084,14 +1110,14 @@ const ws = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) =>
1084
1110
  }
1085
1111
  )
1086
1112
  );
1087
- De.displayName = "ChannelView";
1113
+ Me.displayName = "ChannelView";
1088
1114
  function Is({
1089
1115
  searchQuery: t,
1090
1116
  setSearchQuery: s,
1091
1117
  placeholder: n
1092
1118
  }) {
1093
1119
  const r = z(null);
1094
- return /* @__PURE__ */ o("div", { className: "relative", children: [
1120
+ return /* @__PURE__ */ i("div", { className: "relative", children: [
1095
1121
  /* @__PURE__ */ e(
1096
1122
  as,
1097
1123
  {
@@ -1111,7 +1137,7 @@ function Is({
1111
1137
  }
1112
1138
  ),
1113
1139
  t && /* @__PURE__ */ e(
1114
- ke,
1140
+ Re,
1115
1141
  {
1116
1142
  label: "Clear search",
1117
1143
  onClick: () => {
@@ -1130,10 +1156,10 @@ const Ss = ({
1130
1156
  onClose: n,
1131
1157
  existingParticipantIds: r = /* @__PURE__ */ new Set(),
1132
1158
  participantLabel: a = "participants",
1133
- searchPlaceholder: c = "Search participants...",
1159
+ searchPlaceholder: o = "Search participants...",
1134
1160
  className: l
1135
1161
  }) => {
1136
- const { debug: h } = ie(), [f, g] = y(""), [C, d] = y([]), [E, R] = y(!1), [I, w] = y(null), [N, m] = y(
1162
+ const { debug: h } = ie(), [f, g] = y(""), [N, c] = y([]), [E, R] = y(!1), [I, w] = y(null), [C, u] = y(
1137
1163
  null
1138
1164
  ), b = z(!1);
1139
1165
  G(() => {
@@ -1147,50 +1173,50 @@ const Ss = ({
1147
1173
  (async () => {
1148
1174
  h && console.log("[ParticipantPicker] Loading initial participants..."), R(!0), w(null);
1149
1175
  try {
1150
- const u = await t.loadParticipants({
1176
+ const m = await t.loadParticipants({
1151
1177
  search: "",
1152
1178
  // Load all participants initially
1153
1179
  limit: 100
1154
1180
  });
1155
- d(u.participants), b.current = !0, h && console.log(
1181
+ c(m.participants), b.current = !0, h && console.log(
1156
1182
  "[ParticipantPicker] Participants loaded successfully:",
1157
- u.participants.length
1183
+ m.participants.length
1158
1184
  );
1159
- } catch (u) {
1160
- const x = u instanceof Error ? u.message : "Failed to load participants";
1161
- w(x), console.error("[ParticipantPicker] Failed to load participants:", u);
1185
+ } catch (m) {
1186
+ const x = m instanceof Error ? m.message : "Failed to load participants";
1187
+ w(x), console.error("[ParticipantPicker] Failed to load participants:", m);
1162
1188
  } finally {
1163
1189
  R(!1);
1164
1190
  }
1165
1191
  })();
1166
1192
  }, [t.loading, h]);
1167
- const S = C.filter((i) => !r.has(i.id)).filter((i) => {
1193
+ const S = N.filter((d) => !r.has(d.id)).filter((d) => {
1168
1194
  var x;
1169
1195
  if (!f) return !0;
1170
- const u = f.toLowerCase();
1171
- return i.name.toLowerCase().includes(u) || ((x = i.email) == null ? void 0 : x.toLowerCase().includes(u)) || !1;
1172
- }), p = _(
1173
- async (i) => {
1174
- if (!N) {
1175
- m(i.id);
1196
+ const m = f.toLowerCase();
1197
+ return d.name.toLowerCase().includes(m) || ((x = d.email) == null ? void 0 : x.toLowerCase().includes(m)) || !1;
1198
+ }), p = D(
1199
+ async (d) => {
1200
+ if (!C) {
1201
+ u(d.id);
1176
1202
  try {
1177
- await s(i);
1178
- } catch (u) {
1179
- console.error("[ParticipantPicker] Failed to start chat:", u), m(null);
1203
+ await s(d);
1204
+ } catch (m) {
1205
+ console.error("[ParticipantPicker] Failed to start chat:", m), u(null);
1180
1206
  }
1181
1207
  }
1182
1208
  },
1183
- [s, N]
1184
- ), T = (i, u) => {
1185
- (i.key === "Enter" || i.key === " ") && (i.preventDefault(), p(u));
1209
+ [s, C]
1210
+ ), T = (d, m) => {
1211
+ (d.key === "Enter" || d.key === " ") && (d.preventDefault(), p(m));
1186
1212
  };
1187
- return /* @__PURE__ */ o("div", { className: k("flex flex-col h-full", l), children: [
1188
- /* @__PURE__ */ o("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
1189
- /* @__PURE__ */ o("div", { className: "flex items-center justify-between mb-3", children: [
1213
+ return /* @__PURE__ */ i("div", { className: k("flex flex-col h-full", l), children: [
1214
+ /* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
1215
+ /* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
1190
1216
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
1191
- /* @__PURE__ */ e(Re, { onClick: n })
1217
+ /* @__PURE__ */ e(De, { onClick: n })
1192
1218
  ] }),
1193
- /* @__PURE__ */ o("p", { className: "text-xs text-stone mb-3", children: [
1219
+ /* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
1194
1220
  "Select a ",
1195
1221
  a.slice(0, -1),
1196
1222
  " to start messaging (",
@@ -1203,65 +1229,65 @@ const Ss = ({
1203
1229
  {
1204
1230
  searchQuery: f,
1205
1231
  setSearchQuery: g,
1206
- placeholder: c
1232
+ placeholder: o
1207
1233
  }
1208
1234
  )
1209
1235
  ] }),
1210
- I && /* @__PURE__ */ o("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1236
+ I && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1211
1237
  "Error loading ",
1212
1238
  a,
1213
1239
  ": ",
1214
1240
  I
1215
1241
  ] }),
1216
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: E && S.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ o("div", { className: "flex items-center space-x-2", children: [
1242
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: E && S.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1217
1243
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1218
- /* @__PURE__ */ o("span", { className: "text-sm text-stone", children: [
1244
+ /* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
1219
1245
  "Loading ",
1220
1246
  a,
1221
1247
  "..."
1222
1248
  ] })
1223
- ] }) }) : S.length === 0 ? /* @__PURE__ */ o("div", { className: "p-6 text-center", children: [
1249
+ ] }) }) : S.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
1224
1250
  /* @__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" }) }),
1225
- /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: f ? `No ${a} found` : C.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
1226
- /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: f ? "Try a different search term" : C.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
1227
- ] }) : /* @__PURE__ */ o("ul", { className: "space-y-0", children: [
1228
- S.map((i) => {
1229
- const u = i.name || i.email || i.id, x = i.email && i.name ? i.email : i.phone;
1251
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: f ? `No ${a} found` : N.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
1252
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: f ? "Try a different search term" : N.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
1253
+ ] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
1254
+ S.map((d) => {
1255
+ const m = d.name || d.email || d.id, x = d.email && d.name ? d.email : d.phone;
1230
1256
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
1231
1257
  "button",
1232
1258
  {
1233
1259
  type: "button",
1234
- onClick: () => p(i),
1235
- onKeyDown: (B) => T(B, i),
1260
+ onClick: () => p(d),
1261
+ onKeyDown: (B) => T(B, d),
1236
1262
  className: "w-full px-4 py-3 hover:bg-sand transition-colors border-b border-sand text-left focus:outline-none focus:ring-2 focus:ring-black",
1237
- children: /* @__PURE__ */ o("div", { className: "flex items-center justify-between", children: [
1238
- /* @__PURE__ */ o("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1263
+ children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
1264
+ /* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1239
1265
  /* @__PURE__ */ e(
1240
1266
  Z,
1241
1267
  {
1242
- id: i.id,
1243
- name: u,
1244
- image: i.image,
1268
+ id: d.id,
1269
+ name: m,
1270
+ image: d.image,
1245
1271
  size: 40
1246
1272
  }
1247
1273
  ),
1248
- /* @__PURE__ */ o("div", { className: "flex-1 min-w-0", children: [
1249
- /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: u }),
1274
+ /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
1275
+ /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: m }),
1250
1276
  x && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: x })
1251
1277
  ] })
1252
1278
  ] }),
1253
- /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N === i.id ? /* @__PURE__ */ e(re, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(Ne, { className: "h-5 w-5 text-stone" }) })
1279
+ /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: C === d.id ? /* @__PURE__ */ e(re, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(Ne, { className: "h-5 w-5 text-stone" }) })
1254
1280
  ] })
1255
1281
  }
1256
- ) }, i.id);
1282
+ ) }, d.id);
1257
1283
  }),
1258
- E && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ o("div", { className: "flex items-center space-x-2", children: [
1284
+ E && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1259
1285
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1260
1286
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
1261
1287
  ] }) })
1262
1288
  ] }) })
1263
1289
  ] });
1264
- }, ps = ({ className: t }) => /* @__PURE__ */ o(
1290
+ }, ps = ({ className: t }) => /* @__PURE__ */ i(
1265
1291
  "svg",
1266
1292
  {
1267
1293
  width: "140",
@@ -1271,7 +1297,7 @@ const Ss = ({
1271
1297
  xmlns: "http://www.w3.org/2000/svg",
1272
1298
  className: t,
1273
1299
  children: [
1274
- /* @__PURE__ */ o("g", { clipPath: "url(#clip0_empty_state)", children: [
1300
+ /* @__PURE__ */ i("g", { clipPath: "url(#clip0_empty_state)", children: [
1275
1301
  /* @__PURE__ */ e(
1276
1302
  "path",
1277
1303
  {
@@ -1300,7 +1326,7 @@ const Ss = ({
1300
1326
  fill: "white"
1301
1327
  }
1302
1328
  ),
1303
- /* @__PURE__ */ o("g", { filter: "url(#filter0_empty_state)", children: [
1329
+ /* @__PURE__ */ i("g", { filter: "url(#filter0_empty_state)", children: [
1304
1330
  /* @__PURE__ */ e(
1305
1331
  "path",
1306
1332
  {
@@ -1340,8 +1366,8 @@ const Ss = ({
1340
1366
  }
1341
1367
  )
1342
1368
  ] }),
1343
- /* @__PURE__ */ o("defs", { children: [
1344
- /* @__PURE__ */ o(
1369
+ /* @__PURE__ */ i("defs", { children: [
1370
+ /* @__PURE__ */ i(
1345
1371
  "filter",
1346
1372
  {
1347
1373
  id: "filter0_empty_state",
@@ -1395,17 +1421,17 @@ const Ss = ({
1395
1421
  ] })
1396
1422
  ]
1397
1423
  }
1398
- ), Me = P.memo(
1399
- ({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ o("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
1424
+ ), Fe = U.memo(
1425
+ ({ 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: [
1400
1426
  /* @__PURE__ */ e(ps, {}),
1401
- s && !t && /* @__PURE__ */ o("div", { className: "mt-8", children: [
1427
+ s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
1402
1428
  /* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
1403
1429
  /* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
1404
1430
  ] })
1405
1431
  ] }) })
1406
1432
  );
1407
- Me.displayName = "EmptyState";
1408
- 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__ */ o("div", { className: "text-center max-w-sm", children: [
1433
+ Fe.displayName = "EmptyState";
1434
+ 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: [
1409
1435
  /* @__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: "โš ๏ธ" }) }),
1410
1436
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
1411
1437
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
@@ -1420,38 +1446,38 @@ const le = P.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
1420
1446
  )
1421
1447
  ] }) }));
1422
1448
  le.displayName = "ErrorState";
1423
- const Us = ({
1449
+ const Ps = ({
1424
1450
  capabilities: t = {},
1425
1451
  className: s,
1426
1452
  renderMessageInputActions: n,
1427
1453
  onChannelSelect: r,
1428
1454
  onParticipantSelect: a,
1429
- initialParticipantFilter: c,
1455
+ initialParticipantFilter: o,
1430
1456
  initialParticipantData: l,
1431
1457
  CustomChannelEmptyState: h,
1432
1458
  showChannelList: f = !0,
1433
1459
  filters: g,
1434
- channelListCustomEmptyStateIndicator: C,
1435
- onDeleteConversationClick: d,
1460
+ channelListCustomEmptyStateIndicator: N,
1461
+ onDeleteConversationClick: c,
1436
1462
  onBlockParticipantClick: E,
1437
1463
  onReportParticipantClick: R,
1438
1464
  pendingAttachment: I,
1439
1465
  onClearPendingAttachment: w
1440
1466
  }) => {
1441
1467
  const {
1442
- service: N,
1443
- client: m,
1468
+ service: C,
1469
+ client: u,
1444
1470
  isConnected: b,
1445
1471
  isLoading: S,
1446
1472
  error: p,
1447
1473
  refreshConnection: T,
1448
- debug: i
1449
- } = os(), [u, x] = y(null), [B, A] = y(!1), [H, J] = y(!1), [he, q] = y(!1), [Q, X] = y(/* @__PURE__ */ new Set()), [K, ce] = y(0), [j, V] = y(!1), [F, D] = y(null), U = z(null), {
1474
+ debug: d
1475
+ } = os(), [m, x] = y(null), [B, A] = y(!1), [H, J] = y(!1), [he, q] = y(!1), [Q, X] = y(/* @__PURE__ */ new Set()), [K, ce] = y(0), [j, V] = y(!1), [F, _] = y(null), P = z(null), {
1450
1476
  participantSource: $,
1451
1477
  participantLabel: Y = "participants",
1452
- showDeleteConversation: Fe = !0
1453
- } = t, Te = P.useMemo(() => {
1454
- const v = m == null ? void 0 : m.userID;
1478
+ showDeleteConversation: Te = !0
1479
+ } = t, Le = U.useMemo(() => {
1480
+ const v = u == null ? void 0 : u.userID;
1455
1481
  return {
1456
1482
  ...{
1457
1483
  type: "messaging",
@@ -1463,13 +1489,13 @@ const Us = ({
1463
1489
  },
1464
1490
  ...g
1465
1491
  };
1466
- }, [g, m == null ? void 0 : m.userID]), ee = z(null), W = _(async () => {
1467
- if (!m || !b) return;
1468
- const v = m.userID;
1492
+ }, [g, u == null ? void 0 : u.userID]), ee = z(null), W = D(async () => {
1493
+ if (!u || !b) return;
1494
+ const v = u.userID;
1469
1495
  if (v)
1470
1496
  try {
1471
- i && console.log("[MessagingShell] Syncing channels for user:", v);
1472
- const O = await m.queryChannels(
1497
+ d && console.log("[MessagingShell] Syncing channels for user:", v);
1498
+ const O = await u.queryChannels(
1473
1499
  {
1474
1500
  type: "messaging",
1475
1501
  members: { $in: [v] }
@@ -1479,59 +1505,59 @@ const Us = ({
1479
1505
  ), M = /* @__PURE__ */ new Set();
1480
1506
  O.forEach((L) => {
1481
1507
  const de = L.state.members;
1482
- Object.values(de).forEach((ze) => {
1508
+ Object.values(de).forEach((Be) => {
1483
1509
  var fe;
1484
- const ue = (fe = ze.user) == null ? void 0 : fe.id;
1485
- ue && ue !== v && M.add(ue);
1510
+ const me = (fe = Be.user) == null ? void 0 : fe.id;
1511
+ me && me !== v && M.add(me);
1486
1512
  });
1487
- }), X((L) => L.size === M.size && [...L].every((de) => M.has(de)) ? L : M), A(O.length > 0), J(!0), ee.current = v, i && console.log("[MessagingShell] Channels synced successfully:", {
1513
+ }), X((L) => L.size === M.size && [...L].every((de) => M.has(de)) ? L : M), A(O.length > 0), J(!0), ee.current = v, d && console.log("[MessagingShell] Channels synced successfully:", {
1488
1514
  channelCount: O.length,
1489
1515
  memberCount: M.size
1490
1516
  });
1491
1517
  } catch (O) {
1492
1518
  console.error("[MessagingShell] Failed to sync channels:", O);
1493
1519
  }
1494
- }, [m, b, i]);
1520
+ }, [u, b, d]);
1495
1521
  G(() => {
1496
- if (!m || !b) return;
1497
- const v = m.userID;
1522
+ if (!u || !b) return;
1523
+ const v = u.userID;
1498
1524
  v && ee.current !== v && W();
1499
- }, [m, b, W]), G(() => {
1500
- if (!c || !m || !b) return;
1525
+ }, [u, b, W]), G(() => {
1526
+ if (!o || !u || !b) return;
1501
1527
  (async () => {
1502
- const O = m.userID;
1528
+ const O = u.userID;
1503
1529
  if (O)
1504
1530
  try {
1505
- i && console.log(
1531
+ d && console.log(
1506
1532
  "[MessagingShell] Loading initial conversation with:",
1507
- c
1533
+ o
1508
1534
  );
1509
- const M = await m.queryChannels(
1535
+ const M = await u.queryChannels(
1510
1536
  {
1511
1537
  type: "messaging",
1512
- members: { $eq: [O, c] }
1538
+ members: { $eq: [O, o] }
1513
1539
  },
1514
1540
  {},
1515
1541
  { limit: 1 }
1516
1542
  );
1517
1543
  if (M.length > 0)
1518
- x(M[0]), V(!0), D(null), r && r(M[0]), i && console.log(
1544
+ x(M[0]), V(!0), _(null), r && r(M[0]), d && console.log(
1519
1545
  "[MessagingShell] Initial conversation loaded:",
1520
1546
  M[0].id
1521
1547
  );
1522
- else if (l && N) {
1523
- i && console.log(
1548
+ else if (l && C) {
1549
+ d && console.log(
1524
1550
  "[MessagingShell] No conversation found, creating one for:",
1525
1551
  l
1526
1552
  );
1527
1553
  try {
1528
- const L = await N.startChannelWithParticipant({
1554
+ const L = await C.startChannelWithParticipant({
1529
1555
  id: l.id,
1530
1556
  name: l.name,
1531
1557
  email: l.email,
1532
1558
  phone: l.phone
1533
1559
  });
1534
- x(L), V(!0), D(null), r && r(L), i && console.log(
1560
+ x(L), V(!0), _(null), r && r(L), d && console.log(
1535
1561
  "[MessagingShell] Channel created and loaded:",
1536
1562
  L.id
1537
1563
  );
@@ -1539,48 +1565,48 @@ const Us = ({
1539
1565
  console.error(
1540
1566
  "[MessagingShell] Failed to create conversation:",
1541
1567
  L
1542
- ), D("Failed to create conversation");
1568
+ ), _("Failed to create conversation");
1543
1569
  }
1544
1570
  } else
1545
- D(
1571
+ _(
1546
1572
  "No conversation found with this account"
1547
- ), i && console.log(
1573
+ ), d && console.log(
1548
1574
  "[MessagingShell] No conversation found for:",
1549
- c
1575
+ o
1550
1576
  );
1551
1577
  } catch (M) {
1552
1578
  console.error(
1553
1579
  "[MessagingShell] Failed to load initial conversation:",
1554
1580
  M
1555
- ), D("Failed to load conversation");
1581
+ ), _("Failed to load conversation");
1556
1582
  }
1557
1583
  })();
1558
1584
  }, [
1559
- c,
1585
+ o,
1560
1586
  l,
1561
- m,
1587
+ u,
1562
1588
  b,
1563
- N,
1564
- i,
1589
+ C,
1590
+ d,
1565
1591
  r
1566
1592
  ]);
1567
- const Le = _(
1593
+ const Ue = D(
1568
1594
  (v) => {
1569
1595
  x(v), r == null || r(v);
1570
1596
  },
1571
1597
  [r]
1572
- ), Pe = _(() => {
1598
+ ), Pe = D(() => {
1573
1599
  j || x(null);
1574
- }, [j]), Ue = _(
1600
+ }, [j]), Oe = D(
1575
1601
  async (v) => {
1576
1602
  var O;
1577
- if (N)
1603
+ if (C)
1578
1604
  try {
1579
- i && console.log(
1605
+ d && console.log(
1580
1606
  "[MessagingShell] Starting conversation with:",
1581
1607
  v.id
1582
1608
  );
1583
- const M = await N.startChannelWithParticipant({
1609
+ const M = await C.startChannelWithParticipant({
1584
1610
  id: v.id,
1585
1611
  name: v.name,
1586
1612
  email: v.email,
@@ -1591,38 +1617,38 @@ const Us = ({
1591
1617
  } catch (L) {
1592
1618
  console.warn("[MessagingShell] Failed to unhide channel:", L);
1593
1619
  }
1594
- x(M), q(!1), (O = U.current) == null || O.close(), a == null || a(v);
1620
+ x(M), q(!1), (O = P.current) == null || O.close(), a == null || a(v);
1595
1621
  } catch (M) {
1596
1622
  console.error("[MessagingShell] Failed to start conversation:", M);
1597
1623
  }
1598
1624
  },
1599
- [N, a, i]
1600
- ), se = _(() => {
1625
+ [C, a, d]
1626
+ ), se = D(() => {
1601
1627
  var v;
1602
- q(!1), (v = U.current) == null || v.close();
1603
- }, []), Oe = _(
1628
+ q(!1), (v = P.current) == null || v.close();
1629
+ }, []), je = D(
1604
1630
  (v) => {
1605
- v.target === U.current && se();
1631
+ v.target === P.current && se();
1606
1632
  },
1607
1633
  [se]
1608
- ), je = _(
1634
+ ), Ae = D(
1609
1635
  async (v) => {
1610
- i && console.log("[MessagingShell] Leaving conversation:", v.id), x(null), V(!1), ee.current = null, await W();
1636
+ d && console.log("[MessagingShell] Leaving conversation:", v.id), x(null), V(!1), ee.current = null, await W();
1611
1637
  },
1612
- [W, i]
1613
- ), Ae = _(
1638
+ [W, d]
1639
+ ), ze = D(
1614
1640
  async (v) => {
1615
- i && console.log("[MessagingShell] Blocking participant:", v), x(null), V(!1), ee.current = null, await W();
1641
+ d && console.log("[MessagingShell] Blocking participant:", v), x(null), V(!1), ee.current = null, await W();
1616
1642
  },
1617
- [W, i]
1618
- ), te = !!u;
1619
- return S ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(ae, {}) }) : p ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(le, { message: p, onBack: T }) }) : !b || !m ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(
1643
+ [W, d]
1644
+ ), te = !!m;
1645
+ return S ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(ae, {}) }) : p ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(le, { message: p, onBack: T }) }) : !b || !u ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(
1620
1646
  le,
1621
1647
  {
1622
1648
  message: "Not connected to messaging service",
1623
1649
  onBack: T
1624
1650
  }
1625
- ) }) : F ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(le, { message: F }) }) : /* @__PURE__ */ o(
1651
+ ) }) : F ? /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(le, { message: F }) }) : /* @__PURE__ */ i(
1626
1652
  "div",
1627
1653
  {
1628
1654
  className: k(
@@ -1630,7 +1656,7 @@ const Us = ({
1630
1656
  s
1631
1657
  ),
1632
1658
  children: [
1633
- /* @__PURE__ */ o("div", { className: "flex h-full min-h-0", children: [
1659
+ /* @__PURE__ */ i("div", { className: "flex h-full min-h-0", children: [
1634
1660
  /* @__PURE__ */ e(
1635
1661
  "div",
1636
1662
  {
@@ -1645,12 +1671,12 @@ const Us = ({
1645
1671
  }
1646
1672
  ),
1647
1673
  children: /* @__PURE__ */ e(
1648
- pe,
1674
+ ke,
1649
1675
  {
1650
- onChannelSelect: Le,
1651
- selectedChannel: u || void 0,
1652
- filters: Te,
1653
- customEmptyStateIndicator: C
1676
+ onChannelSelect: Ue,
1677
+ selectedChannel: m || void 0,
1678
+ filters: Le,
1679
+ customEmptyStateIndicator: N
1654
1680
  }
1655
1681
  )
1656
1682
  }
@@ -1662,34 +1688,34 @@ const Us = ({
1662
1688
  "messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
1663
1689
  {
1664
1690
  // In direct conversation mode (or waiting for it), always show (full width)
1665
- flex: j || te || c,
1691
+ flex: j || te || o,
1666
1692
  // Normal mode: hide on mobile when no channel selected
1667
- "hidden lg:flex": !j && !te && !c
1693
+ "hidden lg:flex": !j && !te && !o
1668
1694
  }
1669
1695
  ),
1670
- children: u ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1671
- De,
1696
+ children: m ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1697
+ Me,
1672
1698
  {
1673
- channel: u,
1699
+ channel: m,
1674
1700
  onBack: Pe,
1675
1701
  showBackButton: !j,
1676
1702
  renderMessageInputActions: n,
1677
- onLeaveConversation: je,
1678
- onBlockParticipant: Ae,
1703
+ onLeaveConversation: Ae,
1704
+ onBlockParticipant: ze,
1679
1705
  CustomChannelEmptyState: h,
1680
- showDeleteConversation: Fe,
1681
- onDeleteConversationClick: d,
1706
+ showDeleteConversation: Te,
1707
+ onDeleteConversationClick: c,
1682
1708
  onBlockParticipantClick: E,
1683
1709
  onReportParticipantClick: R,
1684
1710
  pendingAttachment: I,
1685
1711
  onClearPendingAttachment: w
1686
1712
  },
1687
- u.id
1688
- ) }) : c ? (
1713
+ m.id
1714
+ ) }) : o ? (
1689
1715
  // Show loading while creating/loading direct conversation channel
1690
1716
  /* @__PURE__ */ e(ae, {})
1691
1717
  ) : /* @__PURE__ */ e(
1692
- Me,
1718
+ Fe,
1693
1719
  {
1694
1720
  hasChannels: B,
1695
1721
  channelsLoaded: H
@@ -1702,15 +1728,15 @@ const Us = ({
1702
1728
  /* @__PURE__ */ e(
1703
1729
  "dialog",
1704
1730
  {
1705
- ref: U,
1731
+ ref: P,
1706
1732
  className: "mes-dialog",
1707
- onClick: Oe,
1733
+ onClick: je,
1708
1734
  onClose: se,
1709
1735
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
1710
1736
  Ss,
1711
1737
  {
1712
1738
  participantSource: $,
1713
- onSelectParticipant: Ue,
1739
+ onSelectParticipant: Oe,
1714
1740
  onClose: se,
1715
1741
  existingParticipantIds: Q,
1716
1742
  participantLabel: Y,
@@ -1751,22 +1777,22 @@ const Us = ({
1751
1777
  loadingFaqId: n,
1752
1778
  headerText: r,
1753
1779
  className: a,
1754
- avatarImage: c,
1780
+ avatarImage: o,
1755
1781
  avatarName: l
1756
1782
  }) => {
1757
1783
  const h = t.filter((f) => f.enabled).sort((f, g) => (f.order ?? 0) - (g.order ?? 0));
1758
- return h.length === 0 ? null : /* @__PURE__ */ e("div", { className: a, children: /* @__PURE__ */ o("div", { className: "flex gap-3 items-end", children: [
1759
- (c || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1784
+ return h.length === 0 ? null : /* @__PURE__ */ e("div", { className: a, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
1785
+ (o || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1760
1786
  Z,
1761
1787
  {
1762
1788
  id: l || "account",
1763
1789
  name: l || "Account",
1764
- image: c,
1790
+ image: o,
1765
1791
  size: 24,
1766
1792
  shape: "circle"
1767
1793
  }
1768
1794
  ) }),
1769
- /* @__PURE__ */ o(
1795
+ /* @__PURE__ */ i(
1770
1796
  "div",
1771
1797
  {
1772
1798
  className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
@@ -1787,55 +1813,55 @@ const Us = ({
1787
1813
  )
1788
1814
  ] }) });
1789
1815
  }, js = (t, s = {}) => {
1790
- const { initialSearch: n = "", pageSize: r = 20 } = s, [a, c] = y([]), [l, h] = y(!1), [f, g] = y(null), [C, d] = y(n), [E, R] = y(!0), [I, w] = y(), N = _(async (p = !1, T) => {
1816
+ const { initialSearch: n = "", pageSize: r = 20 } = s, [a, o] = y([]), [l, h] = y(!1), [f, g] = y(null), [N, c] = y(n), [E, R] = y(!0), [I, w] = y(), C = D(async (p = !1, T) => {
1791
1817
  if (l) return;
1792
- const i = T !== void 0 ? T : C;
1818
+ const d = T !== void 0 ? T : N;
1793
1819
  h(!0), g(null);
1794
1820
  try {
1795
- const u = await t.loadParticipants({
1796
- search: i || void 0,
1821
+ const m = await t.loadParticipants({
1822
+ search: d || void 0,
1797
1823
  limit: r,
1798
1824
  cursor: p ? void 0 : I
1799
1825
  });
1800
- c(
1801
- (x) => p ? u.participants : [...x, ...u.participants]
1802
- ), R(u.hasMore), w(u.nextCursor);
1803
- } catch (u) {
1804
- const x = u instanceof Error ? u.message : "Failed to load participants";
1805
- g(x), console.error("[useParticipants] Load error:", u);
1826
+ o(
1827
+ (x) => p ? m.participants : [...x, ...m.participants]
1828
+ ), R(m.hasMore), w(m.nextCursor);
1829
+ } catch (m) {
1830
+ const x = m instanceof Error ? m.message : "Failed to load participants";
1831
+ g(x), console.error("[useParticipants] Load error:", m);
1806
1832
  } finally {
1807
1833
  h(!1);
1808
1834
  }
1809
- }, [t, C, I, r, l]), m = _(() => {
1810
- E && !l && N(!1);
1811
- }, [E, l, N]), b = _((p) => {
1812
- d(p), w(void 0), N(!0, p);
1813
- }, [N]), S = _(() => {
1814
- w(void 0), N(!0);
1815
- }, [N]);
1835
+ }, [t, N, I, r, l]), u = D(() => {
1836
+ E && !l && C(!1);
1837
+ }, [E, l, C]), b = D((p) => {
1838
+ c(p), w(void 0), C(!0, p);
1839
+ }, [C]), S = D(() => {
1840
+ w(void 0), C(!0);
1841
+ }, [C]);
1816
1842
  return G(() => {
1817
- N(!0);
1843
+ C(!0);
1818
1844
  }, [t.loadParticipants]), {
1819
1845
  participants: a,
1820
1846
  loading: l,
1821
1847
  error: f,
1822
- searchQuery: C,
1848
+ searchQuery: N,
1823
1849
  hasMore: E,
1824
1850
  totalCount: t.totalCount,
1825
- loadMore: m,
1851
+ loadMore: u,
1826
1852
  search: b,
1827
1853
  refresh: S
1828
1854
  };
1829
1855
  };
1830
1856
  export {
1831
1857
  Z as Avatar,
1832
- vs as ChannelEmptyState,
1833
- pe as ChannelList,
1834
- De as ChannelView,
1858
+ Cs as ChannelEmptyState,
1859
+ ke as ChannelList,
1860
+ Me as ChannelView,
1835
1861
  Os as FaqList,
1836
1862
  ks as FaqListItem,
1837
- Ps as MessagingProvider,
1838
- Us as MessagingShell,
1863
+ Us as MessagingProvider,
1864
+ Ps as MessagingShell,
1839
1865
  Ss as ParticipantPicker,
1840
1866
  cs as formatRelativeTime,
1841
1867
  os as useMessaging,