@linktr.ee/messaging-react 1.9.2 โ†’ 1.9.3

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,10 +1,11 @@
1
- import { jsx as e, jsxs as u, Fragment as ue } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as d, Fragment as fe } from "react/jsx-runtime";
2
2
  import R from "classnames";
3
- import q, { createContext as ye, useContext as Se, useCallback as M, useState as E, useRef as z, useEffect as $ } from "react";
4
- import { StreamChatService as ke } from "@linktr.ee/messaging-core";
5
- import { Chat as Re, ChannelList as Fe, MessageInput as Te, useMessageInputContext as De, useMessageComposerHasSendableData as pe, SimpleAttachmentSelector as Me, QuotedMessagePreview as Pe, LinkPreviewList as Ue, AttachmentPreviewList as Oe, TextareaComposer as Le, Channel as _e, useChannelStateContext as me, Window as je, MessageList as Ae } from "stream-chat-react";
6
- import { XIcon as fe, ArrowUpIcon as Be, ArrowLeftIcon as oe, DotsThreeIcon as ae, SpinnerGapIcon as ee, SignOutIcon as ze, ProhibitInsetIcon as ie, FlagIcon as $e, MagnifyingGlassIcon as He, ChatCircleDotsIcon as ce } from "@phosphor-icons/react";
7
- const he = ye({
3
+ import q, { createContext as Se, useContext as ke, useCallback as P, useState as E, useRef as B, useEffect as $ } from "react";
4
+ import { StreamChatService as Re } from "@linktr.ee/messaging-core";
5
+ import { Chat as pe, ChannelList as Fe, useMessageComposer as Te, useStateStore as De, MessageInput as Pe, useMessageInputContext as Me, useMessageComposerHasSendableData as Le, SimpleAttachmentSelector as Ue, QuotedMessagePreview as _e, AttachmentPreviewList as Oe, TextareaComposer as je, Channel as Ae, useChannelStateContext as he, Window as ze, MessageList as Be } from "stream-chat-react";
6
+ import { XIcon as le, ArrowUpIcon as $e, ArrowLeftIcon as ae, DotsThreeIcon as ie, SpinnerGapIcon as ee, SignOutIcon as He, ProhibitInsetIcon as ce, FlagIcon as Ge, MagnifyingGlassIcon as Ve, ChatCircleDotsIcon as de } from "@phosphor-icons/react";
7
+ import { LinkPreviewsManager as ue } from "stream-chat";
8
+ const ge = Se({
8
9
  service: null,
9
10
  client: null,
10
11
  isConnected: !1,
@@ -14,19 +15,19 @@ const he = ye({
14
15
  refreshConnection: async () => {
15
16
  },
16
17
  debug: !1
17
- }), se = () => Se(he), gs = ({
18
+ }), se = () => ke(ge), ws = ({
18
19
  children: t,
19
20
  user: s,
20
21
  serviceConfig: n,
21
22
  apiKey: l,
22
23
  capabilities: o = {},
23
- debug: i = !1
24
+ debug: a = !1
24
25
  }) => {
25
- const r = M(
26
- (d, ...N) => {
27
- i && console.log(`๐Ÿ”ฅ [MessagingProvider] ${d}`, ...N);
26
+ const r = P(
27
+ (u, ...N) => {
28
+ a && console.log(`๐Ÿ”ฅ [MessagingProvider] ${u}`, ...N);
28
29
  },
29
- [i]
30
+ [a]
30
31
  );
31
32
  r("๐Ÿ”„ RENDER START", {
32
33
  userId: s == null ? void 0 : s.id,
@@ -34,12 +35,12 @@ const he = ye({
34
35
  serviceConfig: !!n,
35
36
  capabilities: Object.keys(o)
36
37
  });
37
- const [a, m] = E(null), [x, k] = E(null), [f, h] = E(!1), [I, g] = E(!1), [C, w] = E(null), v = z(!1), y = z({
38
+ const [i, m] = E(null), [x, k] = E(null), [f, h] = E(!1), [I, g] = E(!1), [C, w] = E(null), v = B(!1), y = B({
38
39
  userId: s == null ? void 0 : s.id,
39
40
  apiKey: l,
40
41
  serviceConfig: n,
41
42
  capabilities: o
42
- }), S = z(0);
43
+ }), S = B(0);
43
44
  S.current++, r("๐Ÿ“Š RENDER INFO", {
44
45
  renderCount: S.current,
45
46
  currentProps: { userId: s == null ? void 0 : s.id, apiKey: (l == null ? void 0 : l.substring(0, 8)) + "..." },
@@ -55,9 +56,9 @@ const he = ye({
55
56
  serviceConfig: n,
56
57
  capabilities: o
57
58
  }, $(() => {
58
- const d = S.current;
59
+ const u = S.current;
59
60
  if (r("๐Ÿ”ง SERVICE INIT EFFECT TRIGGERED", {
60
- renderCount: d,
61
+ renderCount: u,
61
62
  apiKey: !!l,
62
63
  serviceConfig: !!n,
63
64
  dependencies: {
@@ -68,42 +69,42 @@ const he = ye({
68
69
  }
69
70
  }), !l || !n) {
70
71
  r("โš ๏ธ SERVICE INIT SKIPPED", {
71
- renderCount: d,
72
+ renderCount: u,
72
73
  reason: "Missing apiKey or serviceConfig"
73
74
  });
74
75
  return;
75
76
  }
76
77
  r("๐Ÿš€ CREATING NEW SERVICE", {
77
- renderCount: d,
78
+ renderCount: u,
78
79
  apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
79
80
  serviceConfigChanged: y.current.serviceConfig !== n
80
81
  });
81
- const N = new ke({
82
+ const N = new Re({
82
83
  ...n,
83
84
  apiKey: l,
84
- debug: i
85
+ debug: a
85
86
  });
86
87
  return m(N), r("โœ… SERVICE SET", {
87
- renderCount: d,
88
+ renderCount: u,
88
89
  serviceInstance: !!N
89
90
  }), () => {
90
91
  r("๐Ÿงน SERVICE CLEANUP", {
91
- renderCount: d,
92
+ renderCount: u,
92
93
  reason: "Effect cleanup"
93
94
  }), N.disconnectUser().catch(console.error);
94
95
  };
95
- }, [l, n, i, r]);
96
- const F = z(null);
96
+ }, [l, n, a, r]);
97
+ const p = B(null);
97
98
  $(() => {
98
99
  var N, j;
99
100
  if (r("๐Ÿ”— USER CONNECTION EFFECT TRIGGERED", {
100
- hasService: !!a,
101
+ hasService: !!i,
101
102
  hasUser: !!s,
102
103
  userId: s == null ? void 0 : s.id,
103
104
  isConnecting: v.current,
104
105
  isConnected: f,
105
- dependencies: { service: !!a, userId: s == null ? void 0 : s.id }
106
- }), !a || !s) {
106
+ dependencies: { service: !!i, userId: s == null ? void 0 : s.id }
107
+ }), !i || !s) {
107
108
  r("โš ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
108
109
  return;
109
110
  }
@@ -111,7 +112,7 @@ const he = ye({
111
112
  r("โš ๏ธ USER CONNECTION SKIPPED", "Already connecting");
112
113
  return;
113
114
  }
114
- if (((N = F.current) == null ? void 0 : N.serviceId) === a && ((j = F.current) == null ? void 0 : j.userId) === s.id) {
115
+ if (((N = p.current) == null ? void 0 : N.serviceId) === i && ((j = p.current) == null ? void 0 : j.userId) === s.id) {
115
116
  r(
116
117
  "โš ๏ธ USER CONNECTION SKIPPED",
117
118
  "Already connected this user with this service"
@@ -122,8 +123,8 @@ const he = ye({
122
123
  r("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), v.current = !0, g(!0), w(null);
123
124
  try {
124
125
  r("๐Ÿ“ž CALLING SERVICE.CONNECTUSER", { userId: s.id });
125
- const A = await a.connectUser(s);
126
- k(A), h(!0), F.current = { serviceId: a, userId: s.id }, r("โœ… USER CONNECTION SUCCESS", {
126
+ const A = await i.connectUser(s);
127
+ k(A), h(!0), p.current = { serviceId: i, userId: s.id }, r("โœ… USER CONNECTION SUCCESS", {
127
128
  userId: s.id,
128
129
  clientId: A.userID
129
130
  });
@@ -140,33 +141,33 @@ const he = ye({
140
141
  });
141
142
  }
142
143
  })();
143
- }, [a, s, r, f]), $(() => (r("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
144
- hasService: !!a,
144
+ }, [i, s, r, f]), $(() => (r("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
145
+ hasService: !!i,
145
146
  isConnected: f
146
147
  }), () => {
147
- a && f ? (r(
148
+ i && f ? (r(
148
149
  "๐Ÿงน CLEANUP EFFECT TRIGGERED",
149
150
  "Cleaning up connection on unmount"
150
- ), F.current = null, a.disconnectUser().catch(console.error)) : r("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
151
- hasService: !!a,
151
+ ), p.current = null, i.disconnectUser().catch(console.error)) : r("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
152
+ hasService: !!i,
152
153
  isConnected: f
153
154
  });
154
- }), [a, f, r]);
155
- const D = M(async () => {
155
+ }), [i, f, r]);
156
+ const T = P(async () => {
156
157
  if (r("๐Ÿ”„ REFRESH CONNECTION CALLED", {
157
- hasService: !!a,
158
+ hasService: !!i,
158
159
  hasUser: !!s
159
- }), !a || !s) {
160
+ }), !i || !s) {
160
161
  r("โš ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
161
162
  return;
162
163
  }
163
164
  r("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), g(!0);
164
165
  try {
165
- r("๐Ÿ”Œ DISCONNECTING FOR REFRESH"), await a.disconnectUser(), r("๐Ÿ“ž RECONNECTING FOR REFRESH");
166
- const d = await a.connectUser(s);
167
- k(d), h(!0), w(null), r("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
168
- } catch (d) {
169
- const N = d instanceof Error ? d.message : "Refresh failed";
166
+ r("๐Ÿ”Œ DISCONNECTING FOR REFRESH"), await i.disconnectUser(), r("๐Ÿ“ž RECONNECTING FOR REFRESH");
167
+ const u = await i.connectUser(s);
168
+ k(u), h(!0), w(null), r("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
169
+ } catch (u) {
170
+ const N = u instanceof Error ? u.message : "Refresh failed";
170
171
  w(N), r("โŒ CONNECTION REFRESH ERROR", {
171
172
  userId: s.id,
172
173
  error: N
@@ -174,50 +175,50 @@ const he = ye({
174
175
  } finally {
175
176
  g(!1), r("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
176
177
  }
177
- }, [a, s, r]), c = q.useMemo(() => (r("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
178
- hasService: !!a,
178
+ }, [i, s, r]), c = q.useMemo(() => (r("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
179
+ hasService: !!i,
179
180
  hasClient: !!x,
180
181
  isConnected: f,
181
182
  isLoading: I,
182
183
  hasError: !!C,
183
184
  capabilitiesKeys: Object.keys(o)
184
185
  }), {
185
- service: a,
186
+ service: i,
186
187
  client: x,
187
188
  isConnected: f,
188
189
  isLoading: I,
189
190
  error: C,
190
191
  capabilities: o,
191
- refreshConnection: D,
192
- debug: i
192
+ refreshConnection: T,
193
+ debug: a
193
194
  }), [
194
- a,
195
+ i,
195
196
  x,
196
197
  f,
197
198
  I,
198
199
  C,
199
200
  o,
200
- D,
201
- i,
201
+ T,
202
+ a,
202
203
  r
203
204
  ]);
204
205
  return r("๐Ÿ”„ RENDER END", {
205
206
  renderCount: S.current,
206
207
  willRenderChat: !!(x && f),
207
208
  contextValueReady: !!c
208
- }), /* @__PURE__ */ e(he.Provider, { value: c, children: x && f ? /* @__PURE__ */ e(Re, { client: x, children: t }) : t });
209
- }, Ge = () => se(), Ve = (t, s) => {
209
+ }), /* @__PURE__ */ e(ge.Provider, { value: c, children: x && f ? /* @__PURE__ */ e(pe, { client: x, children: t }) : t });
210
+ }, We = () => se(), qe = (t, s) => {
210
211
  const n = new Date(
211
212
  Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
212
213
  ), o = new Date(
213
214
  Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
214
215
  ).getTime() - n.getTime();
215
216
  return Math.floor(o / (1e3 * 60 * 60 * 24));
216
- }, We = (t) => {
217
+ }, Ye = (t) => {
217
218
  const s = /* @__PURE__ */ new Date();
218
219
  if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
219
220
  return "Just now";
220
- const l = Ve(t, s);
221
+ const l = qe(t, s);
221
222
  return l === 0 ? t.toLocaleTimeString([], {
222
223
  hour: "numeric",
223
224
  minute: "2-digit"
@@ -226,7 +227,7 @@ const he = ye({
226
227
  day: "numeric",
227
228
  year: "2-digit"
228
229
  });
229
- }, de = [
230
+ }, me = [
230
231
  "๐ŸŽ",
231
232
  // Apple
232
233
  "๐ŸŒ",
@@ -254,7 +255,7 @@ const he = ye({
254
255
  "๐Ÿˆ"
255
256
  // Melon
256
257
  ];
257
- function qe(t) {
258
+ function Je(t) {
258
259
  let s = 0;
259
260
  for (let n = 0; n < t.length; n++) {
260
261
  const l = t.charCodeAt(n);
@@ -262,9 +263,9 @@ function qe(t) {
262
263
  }
263
264
  return Math.abs(s);
264
265
  }
265
- function Ye(t) {
266
- const n = qe(t) % de.length;
267
- return de[n];
266
+ function Qe(t) {
267
+ const n = Je(t) % me.length;
268
+ return me[n];
268
269
  }
269
270
  const Y = ({
270
271
  id: t,
@@ -273,7 +274,7 @@ const Y = ({
273
274
  className: l,
274
275
  shape: o = "squircle"
275
276
  }) => {
276
- const i = Ye(t), a = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", m = o === "circle" ? { borderRadius: "50%" } : {
277
+ const a = Qe(t), i = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", m = o === "circle" ? { borderRadius: "50%" } : {
277
278
  borderRadius: "33%",
278
279
  "corner-shape": "superellipse(1.3)"
279
280
  };
@@ -299,31 +300,31 @@ const Y = ({
299
300
  "aria-hidden": "true",
300
301
  className: R(
301
302
  "avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
302
- a
303
+ i
303
304
  ),
304
- children: i
305
+ children: a
305
306
  }
306
307
  )
307
308
  }
308
309
  );
309
- }, Je = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: l = !1, unread: o }) => {
310
- var w, v, y, S, F, D;
311
- const i = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), r = () => {
310
+ }, Xe = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: l = !1, unread: o }) => {
311
+ var w, v, y, S, p, T;
312
+ const a = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), r = () => {
312
313
  t && n(t);
313
314
  }, m = Object.values(((w = t == null ? void 0 : t.state) == null ? void 0 : w.members) || {}).find(
314
315
  (c) => {
315
- var d, N;
316
- return ((d = c.user) == null ? void 0 : d.id) && c.user.id !== ((N = t == null ? void 0 : t._client) == null ? void 0 : N.userID);
316
+ var u, N;
317
+ return ((u = c.user) == null ? void 0 : u.id) && c.user.id !== ((N = t == null ? void 0 : t._client) == null ? void 0 : N.userID);
317
318
  }
318
- ), x = ((v = m == null ? void 0 : m.user) == null ? void 0 : v.name) || "Conversation", k = (y = m == null ? void 0 : m.user) == null ? void 0 : y.image, f = (F = (S = t == null ? void 0 : t.state) == null ? void 0 : S.messages) == null ? void 0 : F[t.state.messages.length - 1], I = (() => {
319
- var d;
319
+ ), x = ((v = m == null ? void 0 : m.user) == null ? void 0 : v.name) || "Conversation", k = (y = m == null ? void 0 : m.user) == null ? void 0 : y.image, f = (p = (S = t == null ? void 0 : t.state) == null ? void 0 : S.messages) == null ? void 0 : p[t.state.messages.length - 1], I = (() => {
320
+ var u;
320
321
  if (f != null && f.text) return f.text;
321
- const c = (d = f == null ? void 0 : f.attachments) == null ? void 0 : d[0];
322
+ const c = (u = f == null ? void 0 : f.attachments) == null ? void 0 : u[0];
322
323
  return c != null && c.asset_url ? c.asset_url : c != null && c.image_url ? c.image_url : c != null && c.og_scrape_url ? c.og_scrape_url : c != null && c.thumb_url ? c.thumb_url : "No messages yet";
323
- })(), g = f != null && f.created_at ? We(new Date(f.created_at)) : "", C = o ?? 0;
324
+ })(), g = f != null && f.created_at ? Ye(new Date(f.created_at)) : "", C = o ?? 0;
324
325
  return l && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
325
326
  channelId: t == null ? void 0 : t.id,
326
- isSelected: i,
327
+ isSelected: a,
327
328
  participantName: x,
328
329
  unreadCount: C,
329
330
  hasTimestamp: !!g
@@ -335,36 +336,36 @@ const Y = ({
335
336
  className: R(
336
337
  "group w-full px-4 py-3 transition-colors border-b border-sand text-left max-w-full overflow-hidden focus-ring",
337
338
  {
338
- "bg-primary-alt/10 border-l-4 border-l-primary": i,
339
- "hover:bg-sand": !i
339
+ "bg-primary-alt/10 border-l-4 border-l-primary": a,
340
+ "hover:bg-sand": !a
340
341
  }
341
342
  ),
342
- children: /* @__PURE__ */ u("div", { className: "flex items-start gap-3", children: [
343
+ children: /* @__PURE__ */ d("div", { className: "flex items-start gap-3", children: [
343
344
  /* @__PURE__ */ e(
344
345
  Y,
345
346
  {
346
- id: ((D = m == null ? void 0 : m.user) == null ? void 0 : D.id) || t.id || "unknown",
347
+ id: ((T = m == null ? void 0 : m.user) == null ? void 0 : T.id) || t.id || "unknown",
347
348
  name: x,
348
349
  image: k,
349
350
  size: 44,
350
351
  className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
351
352
  }
352
353
  ),
353
- /* @__PURE__ */ u("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
354
- /* @__PURE__ */ u("div", { className: "flex items-center justify-between gap-2", children: [
354
+ /* @__PURE__ */ d("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
355
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2", children: [
355
356
  /* @__PURE__ */ e(
356
357
  "h3",
357
358
  {
358
359
  className: R(
359
360
  "text-sm font-medium truncate",
360
- i ? "text-primary" : "text-charcoal"
361
+ a ? "text-primary" : "text-charcoal"
361
362
  ),
362
363
  children: x
363
364
  }
364
365
  ),
365
366
  g && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: g })
366
367
  ] }),
367
- /* @__PURE__ */ u("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
368
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
368
369
  /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: I }),
369
370
  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 })
370
371
  ] })
@@ -372,18 +373,18 @@ const Y = ({
372
373
  ] })
373
374
  }
374
375
  );
375
- }, Qe = ({
376
+ }, Ze = ({
376
377
  onChannelSelect: t,
377
378
  selectedChannel: s,
378
379
  filters: n,
379
380
  className: l,
380
381
  customEmptyStateIndicator: o
381
382
  }) => {
382
- const i = q.useRef(0);
383
- i.current++;
383
+ const a = q.useRef(0);
384
+ a.current++;
384
385
  const { debug: r = !1 } = se();
385
386
  return r && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ”„ RENDER START", {
386
- renderCount: i.current,
387
+ renderCount: a.current,
387
388
  selectedChannelId: s == null ? void 0 : s.id,
388
389
  filters: n
389
390
  }), /* @__PURE__ */ e(
@@ -394,7 +395,7 @@ const Y = ({
394
395
  l
395
396
  ),
396
397
  children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (r && console.log("๐Ÿ“บ [ChannelList] ๐ŸŽฌ RENDERING STREAM CHANNEL LIST", {
397
- renderCount: i.current,
398
+ renderCount: a.current,
398
399
  filters: n
399
400
  }), /* @__PURE__ */ e(
400
401
  Fe,
@@ -402,16 +403,16 @@ const Y = ({
402
403
  filters: n,
403
404
  sort: { last_message_at: -1 },
404
405
  options: { limit: 30 },
405
- Preview: (a) => {
406
+ Preview: (i) => {
406
407
  var m, x;
407
408
  return r && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
408
- channelId: (m = a.channel) == null ? void 0 : m.id,
409
+ channelId: (m = i.channel) == null ? void 0 : m.id,
409
410
  selectedChannelId: s == null ? void 0 : s.id,
410
- isSelected: (s == null ? void 0 : s.id) === ((x = a.channel) == null ? void 0 : x.id)
411
+ isSelected: (s == null ? void 0 : s.id) === ((x = i.channel) == null ? void 0 : x.id)
411
412
  }), /* @__PURE__ */ e(
412
- Je,
413
+ Xe,
413
414
  {
414
- ...a,
415
+ ...i,
415
416
  selectedChannel: s,
416
417
  onChannelSelect: t,
417
418
  debug: r
@@ -442,8 +443,8 @@ const Y = ({
442
443
  children: n
443
444
  }
444
445
  );
445
- function ge({ label: t, className: s, children: n, ...l }) {
446
- return /* @__PURE__ */ u(
446
+ function xe({ label: t, className: s, children: n, ...l }) {
447
+ return /* @__PURE__ */ d(
447
448
  "button",
448
449
  {
449
450
  type: "button",
@@ -463,20 +464,79 @@ function ge({ label: t, className: s, children: n, ...l }) {
463
464
  }
464
465
  );
465
466
  }
466
- function xe({ onClick: t }) {
467
- return /* @__PURE__ */ e(ge, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(fe, { className: "h-5 w-5 text-stone", weight: "bold" }) });
467
+ function Ne({ onClick: t }) {
468
+ return /* @__PURE__ */ e(xe, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(le, { className: "h-5 w-5 text-stone", weight: "bold" }) });
468
469
  }
469
- const Xe = () => {
470
- const { handleSubmit: t } = De(), s = pe();
471
- return /* @__PURE__ */ u(ue, { children: [
472
- /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Me, {}) }),
473
- /* @__PURE__ */ u("div", { className: "central-container w-full p-2 bg-white rounded-lg 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: [
474
- /* @__PURE__ */ e(Pe, {}),
475
- /* @__PURE__ */ e(Ue, {}),
470
+ const Ke = (t) => ({
471
+ linkPreviews: Array.from(t.previews.values()).filter(
472
+ (s) => ue.previewIsLoaded(s) || ue.previewIsLoading(s)
473
+ )
474
+ }), es = ({
475
+ link: t,
476
+ onDismiss: s
477
+ }) => {
478
+ const { og_scrape_url: n, title: l, image_url: o } = t;
479
+ return /* @__PURE__ */ d(
480
+ "a",
481
+ {
482
+ href: n,
483
+ target: "_blank",
484
+ rel: "noopener noreferrer",
485
+ className: "relative w-full block rounded-[24px] bg-[#121110] p-2 no-underline transition-opacity hover:opacity-90",
486
+ children: [
487
+ o && /* @__PURE__ */ e(
488
+ "img",
489
+ {
490
+ src: o,
491
+ alt: l || "",
492
+ className: "h-[148px] w-full rounded-[20px] object-cover"
493
+ }
494
+ ),
495
+ /* @__PURE__ */ e(
496
+ "button",
497
+ {
498
+ type: "button",
499
+ onClick: (r) => {
500
+ r.preventDefault(), s(n);
501
+ },
502
+ 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",
503
+ "aria-label": "Close link preview",
504
+ children: /* @__PURE__ */ e(le, { className: "size-4 text-black/90" })
505
+ }
506
+ ),
507
+ /* @__PURE__ */ d("div", { className: "p-2", children: [
508
+ l && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: l }),
509
+ /* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55", children: n })
510
+ ] })
511
+ ]
512
+ }
513
+ );
514
+ }, ss = () => {
515
+ const { linkPreviewsManager: t } = Te(), { linkPreviews: s } = De(
516
+ t.state,
517
+ Ke
518
+ ), n = (o) => {
519
+ t.dismissPreview(o);
520
+ };
521
+ return s.length > 0 ? /* @__PURE__ */ e("div", { className: "str-chat__link-preview-list p-0 gap-2 mb-4", children: s.map((o) => /* @__PURE__ */ e(
522
+ es,
523
+ {
524
+ link: o,
525
+ onDismiss: n
526
+ },
527
+ o.og_scrape_url
528
+ )) }) : null;
529
+ }, ns = () => {
530
+ const { handleSubmit: t } = Me(), s = Le();
531
+ return /* @__PURE__ */ d(fe, { children: [
532
+ /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Ue, {}) }),
533
+ /* @__PURE__ */ d("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-lg 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: [
534
+ /* @__PURE__ */ e(_e, {}),
535
+ /* @__PURE__ */ e(ss, {}),
476
536
  /* @__PURE__ */ e(Oe, {}),
477
- /* @__PURE__ */ u("div", { className: "flex", children: [
537
+ /* @__PURE__ */ d("div", { className: "flex", children: [
478
538
  /* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4", children: /* @__PURE__ */ e(
479
- Le,
539
+ je,
480
540
  {
481
541
  className: "align-middle w-full resize-none outline-none",
482
542
  maxRows: 4
@@ -491,30 +551,30 @@ const Xe = () => {
491
551
  disabled: !s,
492
552
  onClick: t,
493
553
  type: "button",
494
- children: /* @__PURE__ */ e(Be, { className: "size-4" })
554
+ children: /* @__PURE__ */ e($e, { className: "size-4" })
495
555
  }
496
556
  )
497
557
  ] })
498
558
  ] })
499
559
  ] });
500
- }, Ze = ({
560
+ }, ts = ({
501
561
  renderActions: t
502
- }) => /* @__PURE__ */ u("div", { className: "message-input flex items-center gap-2 p-4", children: [
562
+ }) => /* @__PURE__ */ d("div", { className: "message-input flex items-center gap-2 p-4", children: [
503
563
  t && (t == null ? void 0 : t()),
504
- /* @__PURE__ */ e(Te, { Input: Xe })
505
- ] }), Ne = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ u("div", { className: "text-center max-w-sm", children: [
564
+ /* @__PURE__ */ e(Pe, { Input: ns })
565
+ ] }), be = () => /* @__PURE__ */ e("div", { className: "messaging-channel-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
506
566
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "No messages yet ๐Ÿ‘€" }),
507
567
  /* @__PURE__ */ e("p", { className: "text-stone text-xs", children: "Share to social media to generate more conversations" })
508
- ] }) }), Ke = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: l }) => {
568
+ ] }) }), rs = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: l }) => {
509
569
  var m, x, k, f, h;
510
- const { channel: o } = me(), i = q.useMemo(() => Object.values(o.state.members || {}).find(
570
+ const { channel: o } = he(), a = q.useMemo(() => Object.values(o.state.members || {}).find(
511
571
  (g) => {
512
572
  var C;
513
573
  return ((C = g.user) == null ? void 0 : C.id) && g.user.id !== o._client.userID;
514
574
  }
515
- ), [o._client.userID, o.state.members]), r = ((m = i == null ? void 0 : i.user) == null ? void 0 : m.name) || ((x = i == null ? void 0 : i.user) == null ? void 0 : x.id) || "Unknown member", a = (k = i == null ? void 0 : i.user) == null ? void 0 : k.image;
516
- return /* @__PURE__ */ u("div", { className: "@container", children: [
517
- /* @__PURE__ */ u("div", { className: "flex justify-between items-center @md:hidden", children: [
575
+ ), [o._client.userID, o.state.members]), r = ((m = a == null ? void 0 : a.user) == null ? void 0 : m.name) || ((x = a == null ? void 0 : a.user) == null ? void 0 : x.id) || "Unknown member", i = (k = a == null ? void 0 : a.user) == null ? void 0 : k.image;
576
+ return /* @__PURE__ */ d("div", { className: "@container", children: [
577
+ /* @__PURE__ */ d("div", { className: "flex justify-between items-center @md:hidden", children: [
518
578
  /* @__PURE__ */ e(
519
579
  "button",
520
580
  {
@@ -524,16 +584,16 @@ const Xe = () => {
524
584
  ),
525
585
  onClick: t || (() => {
526
586
  }),
527
- children: /* @__PURE__ */ e(oe, { className: "size-5 text-black/90" })
587
+ children: /* @__PURE__ */ e(ae, { className: "size-5 text-black/90" })
528
588
  }
529
589
  ),
530
- /* @__PURE__ */ u("div", { className: "flex flex-col gap-1 items-center", children: [
590
+ /* @__PURE__ */ d("div", { className: "flex flex-col gap-1 items-center", children: [
531
591
  /* @__PURE__ */ e(
532
592
  Y,
533
593
  {
534
- id: ((f = i == null ? void 0 : i.user) == null ? void 0 : f.id) || o.id || "unknown",
594
+ id: ((f = a == null ? void 0 : a.user) == null ? void 0 : f.id) || o.id || "unknown",
535
595
  name: r,
536
- image: a,
596
+ image: i,
537
597
  size: 40
538
598
  }
539
599
  ),
@@ -547,12 +607,12 @@ const Xe = () => {
547
607
  ),
548
608
  onClick: n || (() => {
549
609
  }),
550
- children: /* @__PURE__ */ e(ae, { className: "size-5 text-black/90" })
610
+ children: /* @__PURE__ */ e(ie, { className: "size-5 text-black/90" })
551
611
  }
552
612
  )
553
613
  ] }),
554
- /* @__PURE__ */ u("div", { className: "hidden @md:flex items-center justify-between gap-3 min-h-12", children: [
555
- /* @__PURE__ */ u("div", { className: "flex items-center gap-4 min-w-0", children: [
614
+ /* @__PURE__ */ d("div", { className: "hidden @md:flex items-center justify-between gap-3 min-h-12", children: [
615
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-4 min-w-0", children: [
556
616
  s && t && /* @__PURE__ */ e(
557
617
  "button",
558
618
  {
@@ -560,15 +620,15 @@ const Xe = () => {
560
620
  onClick: t,
561
621
  className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
562
622
  "aria-label": "Back to conversations",
563
- children: /* @__PURE__ */ e(oe, { className: "size-5 text-black/90" })
623
+ children: /* @__PURE__ */ e(ae, { className: "size-5 text-black/90" })
564
624
  }
565
625
  ),
566
626
  /* @__PURE__ */ e(
567
627
  Y,
568
628
  {
569
- id: ((h = i == null ? void 0 : i.user) == null ? void 0 : h.id) || o.id || "unknown",
629
+ id: ((h = a == null ? void 0 : a.user) == null ? void 0 : h.id) || o.id || "unknown",
570
630
  name: r,
571
- image: a,
631
+ image: i,
572
632
  size: 40
573
633
  }
574
634
  ),
@@ -581,85 +641,85 @@ const Xe = () => {
581
641
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
582
642
  ),
583
643
  onClick: n,
584
- children: /* @__PURE__ */ e(ae, { className: "size-5 text-black/90" })
644
+ children: /* @__PURE__ */ e(ie, { className: "size-5 text-black/90" })
585
645
  }
586
646
  )
587
647
  ] })
588
648
  ] });
589
- }, es = ({
649
+ }, ls = ({
590
650
  isOpen: t,
591
651
  onClose: s,
592
652
  participant: n,
593
653
  channel: l,
594
654
  followerStatusLabel: o,
595
- onLeaveConversation: i,
655
+ onLeaveConversation: a,
596
656
  onBlockParticipant: r
597
657
  }) => {
598
- var W, _, G, J, H, V, Q;
599
- const { service: a, debug: m } = se(), x = z(null), [k, f] = E(!1), [h, I] = E(!1), [g, C] = E(!1);
658
+ var W, O, G, J, H, V, Q;
659
+ const { service: i, debug: m } = se(), x = B(null), [k, f] = E(!1), [h, I] = E(!1), [g, C] = E(!1);
600
660
  $(() => {
601
- const T = x.current;
602
- T && (t ? T.showModal() : T.close());
661
+ const F = x.current;
662
+ F && (t ? F.showModal() : F.close());
603
663
  }, [t]);
604
- const w = M(async () => {
605
- var T;
606
- if (!(!a || !((T = n == null ? void 0 : n.user) != null && T.id)))
664
+ const w = P(async () => {
665
+ var F;
666
+ if (!(!i || !((F = n == null ? void 0 : n.user) != null && F.id)))
607
667
  try {
608
- const U = (await a.getBlockedUsers()).some(
609
- (O) => {
668
+ const L = (await i.getBlockedUsers()).some(
669
+ (U) => {
610
670
  var X;
611
- return O.blocked_user_id === ((X = n == null ? void 0 : n.user) == null ? void 0 : X.id);
671
+ return U.blocked_user_id === ((X = n == null ? void 0 : n.user) == null ? void 0 : X.id);
612
672
  }
613
673
  );
614
- f(U);
615
- } catch (P) {
674
+ f(L);
675
+ } catch (M) {
616
676
  console.error(
617
677
  "[ChannelInfoDialog] Failed to check blocked status:",
618
- P
678
+ M
619
679
  );
620
680
  }
621
- }, [a, (W = n == null ? void 0 : n.user) == null ? void 0 : W.id]);
681
+ }, [i, (W = n == null ? void 0 : n.user) == null ? void 0 : W.id]);
622
682
  $(() => {
623
683
  t && w();
624
684
  }, [t, w]);
625
685
  const v = async () => {
626
- var T;
686
+ var F;
627
687
  if (!h) {
628
688
  m && console.log("[ChannelInfoDialog] Leave conversation", l.cid), I(!0);
629
689
  try {
630
- const P = ((T = l._client) == null ? void 0 : T.userID) ?? null;
631
- await l.hide(P, !1), i && await i(l), s();
632
- } catch (P) {
633
- console.error("[ChannelInfoDialog] Failed to leave conversation", P);
690
+ const M = ((F = l._client) == null ? void 0 : F.userID) ?? null;
691
+ await l.hide(M, !1), a && await a(l), s();
692
+ } catch (M) {
693
+ console.error("[ChannelInfoDialog] Failed to leave conversation", M);
634
694
  } finally {
635
695
  I(!1);
636
696
  }
637
697
  }
638
698
  }, y = async () => {
639
- var T, P, U;
640
- if (!(g || !a)) {
641
- m && console.log("[ChannelInfoDialog] Block member", (T = n == null ? void 0 : n.user) == null ? void 0 : T.id), C(!0);
699
+ var F, M, L;
700
+ if (!(g || !i)) {
701
+ m && console.log("[ChannelInfoDialog] Block member", (F = n == null ? void 0 : n.user) == null ? void 0 : F.id), C(!0);
642
702
  try {
643
- await a.blockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), r && await r((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
644
- } catch (O) {
645
- console.error("[ChannelInfoDialog] Failed to block member", O);
703
+ await i.blockUser((M = n == null ? void 0 : n.user) == null ? void 0 : M.id), r && await r((L = n == null ? void 0 : n.user) == null ? void 0 : L.id), s();
704
+ } catch (U) {
705
+ console.error("[ChannelInfoDialog] Failed to block member", U);
646
706
  } finally {
647
707
  C(!1);
648
708
  }
649
709
  }
650
710
  }, S = async () => {
651
- var T, P, U;
652
- if (!(g || !a)) {
653
- m && console.log("[ChannelInfoDialog] Unblock member", (T = n == null ? void 0 : n.user) == null ? void 0 : T.id), C(!0);
711
+ var F, M, L;
712
+ if (!(g || !i)) {
713
+ m && console.log("[ChannelInfoDialog] Unblock member", (F = n == null ? void 0 : n.user) == null ? void 0 : F.id), C(!0);
654
714
  try {
655
- await a.unBlockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), r && await r((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
656
- } catch (O) {
657
- console.error("[ChannelInfoDialog] Failed to unblock member", O);
715
+ await i.unBlockUser((M = n == null ? void 0 : n.user) == null ? void 0 : M.id), r && await r((L = n == null ? void 0 : n.user) == null ? void 0 : L.id), s();
716
+ } catch (U) {
717
+ console.error("[ChannelInfoDialog] Failed to unblock member", U);
658
718
  } finally {
659
719
  C(!1);
660
720
  }
661
721
  }
662
- }, F = () => {
722
+ }, p = () => {
663
723
  s(), window.open(
664
724
  "https://linktr.ee/s/about/trust-center/report",
665
725
  "_blank",
@@ -667,7 +727,7 @@ const Xe = () => {
667
727
  );
668
728
  };
669
729
  if (!n) return null;
670
- const D = ((_ = n.user) == null ? void 0 : _.name) || ((G = n.user) == null ? void 0 : G.id) || "Unknown member", c = (J = n.user) == null ? void 0 : J.image, d = (H = n.user) == null ? void 0 : H.email, N = (V = n.user) == null ? void 0 : V.username, j = d || (N ? `linktr.ee/${N}` : void 0), A = ((Q = n.user) == null ? void 0 : Q.id) || "unknown";
730
+ const T = ((O = n.user) == null ? void 0 : O.name) || ((G = n.user) == null ? void 0 : G.id) || "Unknown member", c = (J = n.user) == null ? void 0 : J.image, u = (H = n.user) == null ? void 0 : H.email, N = (V = n.user) == null ? void 0 : V.username, j = u || (N ? `linktr.ee/${N}` : void 0), A = ((Q = n.user) == null ? void 0 : Q.id) || "unknown";
671
731
  return (
672
732
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
673
733
  /* @__PURE__ */ e(
@@ -676,33 +736,33 @@ const Xe = () => {
676
736
  ref: x,
677
737
  className: "mes-dialog",
678
738
  onClose: s,
679
- onClick: (T) => {
680
- T.target === x.current && s();
739
+ onClick: (F) => {
740
+ F.target === x.current && s();
681
741
  },
682
- children: /* @__PURE__ */ u("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
683
- /* @__PURE__ */ u("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
742
+ children: /* @__PURE__ */ d("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
743
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
684
744
  /* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
685
- /* @__PURE__ */ e(xe, { onClick: s })
745
+ /* @__PURE__ */ e(Ne, { onClick: s })
686
746
  ] }),
687
- /* @__PURE__ */ u("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
747
+ /* @__PURE__ */ d("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
688
748
  /* @__PURE__ */ e(
689
749
  "div",
690
750
  {
691
751
  className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
692
752
  style: { backgroundColor: "#FBFAF9" },
693
- children: /* @__PURE__ */ u("div", { className: "flex items-center gap-3 w-full", children: [
753
+ children: /* @__PURE__ */ d("div", { className: "flex items-center gap-3 w-full", children: [
694
754
  /* @__PURE__ */ e(
695
755
  Y,
696
756
  {
697
757
  id: A,
698
- name: D,
758
+ name: T,
699
759
  image: c,
700
760
  size: 88,
701
761
  shape: "circle"
702
762
  }
703
763
  ),
704
- /* @__PURE__ */ u("div", { className: "flex flex-col min-w-0 flex-1", children: [
705
- /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: D }),
764
+ /* @__PURE__ */ d("div", { className: "flex flex-col min-w-0 flex-1", children: [
765
+ /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: T }),
706
766
  j && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: j }),
707
767
  o && /* @__PURE__ */ e(
708
768
  "span",
@@ -722,44 +782,44 @@ const Xe = () => {
722
782
  ] })
723
783
  }
724
784
  ),
725
- /* @__PURE__ */ u("ul", { className: "flex flex-col gap-2 mt-2", children: [
726
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ u(
785
+ /* @__PURE__ */ d("ul", { className: "flex flex-col gap-2 mt-2", children: [
786
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(
727
787
  K,
728
788
  {
729
789
  onClick: v,
730
790
  disabled: h,
731
791
  "aria-busy": h,
732
792
  children: [
733
- h ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ze, { className: "h-5 w-5" }),
793
+ h ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(He, { className: "h-5 w-5" }),
734
794
  /* @__PURE__ */ e("span", { children: "Delete Conversation" })
735
795
  ]
736
796
  }
737
797
  ) }),
738
- /* @__PURE__ */ e("li", { children: k ? /* @__PURE__ */ u(
798
+ /* @__PURE__ */ e("li", { children: k ? /* @__PURE__ */ d(
739
799
  K,
740
800
  {
741
801
  onClick: S,
742
802
  disabled: g,
743
803
  "aria-busy": g,
744
804
  children: [
745
- g ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ie, { className: "h-5 w-5" }),
805
+ g ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5" }),
746
806
  /* @__PURE__ */ e("span", { children: "Unblock" })
747
807
  ]
748
808
  }
749
- ) : /* @__PURE__ */ u(
809
+ ) : /* @__PURE__ */ d(
750
810
  K,
751
811
  {
752
812
  onClick: y,
753
813
  disabled: g,
754
814
  "aria-busy": g,
755
815
  children: [
756
- g ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ie, { className: "h-5 w-5" }),
816
+ g ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5" }),
757
817
  /* @__PURE__ */ e("span", { children: "Block" })
758
818
  ]
759
819
  }
760
820
  ) }),
761
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ u(K, { variant: "danger", onClick: F, children: [
762
- /* @__PURE__ */ e($e, { className: "h-5 w-5" }),
821
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(K, { variant: "danger", onClick: p, children: [
822
+ /* @__PURE__ */ e(Ge, { className: "h-5 w-5" }),
763
823
  /* @__PURE__ */ e("span", { children: "Report" })
764
824
  ] }) })
765
825
  ] })
@@ -768,16 +828,16 @@ const Xe = () => {
768
828
  }
769
829
  )
770
830
  );
771
- }, ss = ({
831
+ }, os = ({
772
832
  onBack: t,
773
833
  showBackButton: s,
774
834
  renderMessageInputActions: n,
775
835
  onLeaveConversation: l,
776
836
  onBlockParticipant: o,
777
- CustomChannelEmptyState: i = Ne
837
+ CustomChannelEmptyState: a = be
778
838
  }) => {
779
839
  var h, I;
780
- const { channel: r } = me(), [a, m] = E(!1), x = (((I = (h = r == null ? void 0 : r.state) == null ? void 0 : h.messages) == null ? void 0 : I.length) ?? 0) > 0, k = q.useMemo(() => Object.values(r.state.members || {}).find(
840
+ const { channel: r } = he(), [i, m] = E(!1), x = (((I = (h = r == null ? void 0 : r.state) == null ? void 0 : h.messages) == null ? void 0 : I.length) ?? 0) > 0, k = q.useMemo(() => Object.values(r.state.members || {}).find(
781
841
  (C) => {
782
842
  var w;
783
843
  return ((w = C.user) == null ? void 0 : w.id) && C.user.id !== r._client.userID;
@@ -789,10 +849,10 @@ const Xe = () => {
789
849
  if (g.isFollower !== void 0)
790
850
  return g.isFollower ? "Subscribed to you" : "Not subscribed";
791
851
  }, [r.data]);
792
- return /* @__PURE__ */ u(ue, { children: [
793
- /* @__PURE__ */ u(je, { children: [
852
+ return /* @__PURE__ */ d(fe, { children: [
853
+ /* @__PURE__ */ d(ze, { children: [
794
854
  /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
795
- Ke,
855
+ rs,
796
856
  {
797
857
  onBack: t,
798
858
  showBackButton: s,
@@ -800,28 +860,28 @@ const Xe = () => {
800
860
  canShowInfo: !!k
801
861
  }
802
862
  ) }),
803
- /* @__PURE__ */ u("div", { className: "flex-1 overflow-hidden relative", children: [
863
+ /* @__PURE__ */ d("div", { className: "flex-1 overflow-hidden relative", children: [
804
864
  /* @__PURE__ */ e(
805
- Ae,
865
+ Be,
806
866
  {
807
867
  hideDeletedMessages: !0,
808
868
  hideNewMessageSeparator: !1,
809
869
  messageActions: []
810
870
  }
811
871
  ),
812
- !x && i && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ e(i, {}) })
872
+ !x && a && /* @__PURE__ */ e("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ e(a, {}) })
813
873
  ] }),
814
874
  /* @__PURE__ */ e(
815
- Ze,
875
+ ts,
816
876
  {
817
877
  renderActions: () => n == null ? void 0 : n(r)
818
878
  }
819
879
  )
820
880
  ] }),
821
881
  /* @__PURE__ */ e(
822
- es,
882
+ ls,
823
883
  {
824
- isOpen: a,
884
+ isOpen: i,
825
885
  onClose: () => m(!1),
826
886
  participant: k,
827
887
  channel: r,
@@ -831,15 +891,15 @@ const Xe = () => {
831
891
  }
832
892
  )
833
893
  ] });
834
- }, ns = ({
894
+ }, as = ({
835
895
  channel: t,
836
896
  onBack: s,
837
897
  showBackButton: n = !1,
838
898
  renderMessageInputActions: l,
839
899
  onLeaveConversation: o,
840
- onBlockParticipant: i,
900
+ onBlockParticipant: a,
841
901
  className: r,
842
- CustomChannelEmptyState: a = Ne
902
+ CustomChannelEmptyState: i = be
843
903
  }) => /* @__PURE__ */ e(
844
904
  "div",
845
905
  {
@@ -847,28 +907,28 @@ const Xe = () => {
847
907
  "messaging-channel-view h-full flex flex-col bg-[#FBFAF9]",
848
908
  r
849
909
  ),
850
- children: /* @__PURE__ */ e(_e, { channel: t, children: /* @__PURE__ */ e(
851
- ss,
910
+ children: /* @__PURE__ */ e(Ae, { channel: t, children: /* @__PURE__ */ e(
911
+ os,
852
912
  {
853
913
  onBack: s,
854
914
  showBackButton: n,
855
915
  renderMessageInputActions: l,
856
916
  onLeaveConversation: o,
857
- onBlockParticipant: i,
858
- CustomChannelEmptyState: a
917
+ onBlockParticipant: a,
918
+ CustomChannelEmptyState: i
859
919
  }
860
920
  ) })
861
921
  }
862
922
  );
863
- function ts({
923
+ function is({
864
924
  searchQuery: t,
865
925
  setSearchQuery: s,
866
926
  placeholder: n
867
927
  }) {
868
- const l = z(null);
869
- return /* @__PURE__ */ u("div", { className: "relative", children: [
928
+ const l = B(null);
929
+ return /* @__PURE__ */ d("div", { className: "relative", children: [
870
930
  /* @__PURE__ */ e(
871
- He,
931
+ Ve,
872
932
  {
873
933
  className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
874
934
  weight: "bold"
@@ -886,7 +946,7 @@ function ts({
886
946
  }
887
947
  ),
888
948
  t && /* @__PURE__ */ e(
889
- ge,
949
+ xe,
890
950
  {
891
951
  label: "Clear search",
892
952
  onClick: () => {
@@ -894,78 +954,78 @@ function ts({
894
954
  s(""), (o = l.current) == null || o.focus();
895
955
  },
896
956
  className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
897
- children: /* @__PURE__ */ e(fe, { className: "h-4 w-4", weight: "bold" })
957
+ children: /* @__PURE__ */ e(le, { className: "h-4 w-4", weight: "bold" })
898
958
  }
899
959
  )
900
960
  ] });
901
961
  }
902
- const rs = ({
962
+ const cs = ({
903
963
  participantSource: t,
904
964
  onSelectParticipant: s,
905
965
  onClose: n,
906
966
  existingParticipantIds: l = /* @__PURE__ */ new Set(),
907
967
  participantLabel: o = "participants",
908
- searchPlaceholder: i = "Search participants...",
968
+ searchPlaceholder: a = "Search participants...",
909
969
  className: r
910
970
  }) => {
911
- const { debug: a } = se(), [m, x] = E(""), [k, f] = E([]), [h, I] = E(!1), [g, C] = E(null), [w, v] = E(
971
+ const { debug: i } = se(), [m, x] = E(""), [k, f] = E([]), [h, I] = E(!1), [g, C] = E(null), [w, v] = E(
912
972
  null
913
- ), y = z(!1);
973
+ ), y = B(!1);
914
974
  $(() => {
915
975
  if (t.loading) {
916
- a && console.log(
976
+ i && console.log(
917
977
  "[ParticipantPicker] Waiting for participant source to finish loading..."
918
978
  );
919
979
  return;
920
980
  }
921
981
  if (y.current) return;
922
982
  (async () => {
923
- a && console.log("[ParticipantPicker] Loading initial participants..."), I(!0), C(null);
983
+ i && console.log("[ParticipantPicker] Loading initial participants..."), I(!0), C(null);
924
984
  try {
925
- const d = await t.loadParticipants({
985
+ const u = await t.loadParticipants({
926
986
  search: "",
927
987
  // Load all participants initially
928
988
  limit: 100
929
989
  });
930
- f(d.participants), y.current = !0, a && console.log(
990
+ f(u.participants), y.current = !0, i && console.log(
931
991
  "[ParticipantPicker] Participants loaded successfully:",
932
- d.participants.length
992
+ u.participants.length
933
993
  );
934
- } catch (d) {
935
- const N = d instanceof Error ? d.message : "Failed to load participants";
936
- C(N), console.error("[ParticipantPicker] Failed to load participants:", d);
994
+ } catch (u) {
995
+ const N = u instanceof Error ? u.message : "Failed to load participants";
996
+ C(N), console.error("[ParticipantPicker] Failed to load participants:", u);
937
997
  } finally {
938
998
  I(!1);
939
999
  }
940
1000
  })();
941
- }, [t.loading, a]);
1001
+ }, [t.loading, i]);
942
1002
  const S = k.filter((c) => !l.has(c.id)).filter((c) => {
943
1003
  var N;
944
1004
  if (!m) return !0;
945
- const d = m.toLowerCase();
946
- return c.name.toLowerCase().includes(d) || ((N = c.email) == null ? void 0 : N.toLowerCase().includes(d)) || !1;
947
- }), F = M(
1005
+ const u = m.toLowerCase();
1006
+ return c.name.toLowerCase().includes(u) || ((N = c.email) == null ? void 0 : N.toLowerCase().includes(u)) || !1;
1007
+ }), p = P(
948
1008
  async (c) => {
949
1009
  if (!w) {
950
1010
  v(c.id);
951
1011
  try {
952
1012
  await s(c);
953
- } catch (d) {
954
- console.error("[ParticipantPicker] Failed to start chat:", d), v(null);
1013
+ } catch (u) {
1014
+ console.error("[ParticipantPicker] Failed to start chat:", u), v(null);
955
1015
  }
956
1016
  }
957
1017
  },
958
1018
  [s, w]
959
- ), D = (c, d) => {
960
- (c.key === "Enter" || c.key === " ") && (c.preventDefault(), F(d));
1019
+ ), T = (c, u) => {
1020
+ (c.key === "Enter" || c.key === " ") && (c.preventDefault(), p(u));
961
1021
  };
962
- return /* @__PURE__ */ u("div", { className: R("flex flex-col h-full", r), children: [
963
- /* @__PURE__ */ u("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
964
- /* @__PURE__ */ u("div", { className: "flex items-center justify-between mb-3", children: [
1022
+ return /* @__PURE__ */ d("div", { className: R("flex flex-col h-full", r), children: [
1023
+ /* @__PURE__ */ d("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
1024
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between mb-3", children: [
965
1025
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
966
- /* @__PURE__ */ e(xe, { onClick: n })
1026
+ /* @__PURE__ */ e(Ne, { onClick: n })
967
1027
  ] }),
968
- /* @__PURE__ */ u("p", { className: "text-xs text-stone mb-3", children: [
1028
+ /* @__PURE__ */ d("p", { className: "text-xs text-stone mb-3", children: [
969
1029
  "Select a ",
970
1030
  o.slice(0, -1),
971
1031
  " to start messaging (",
@@ -974,73 +1034,73 @@ const rs = ({
974
1034
  t.totalCount !== void 0 && ` โ€ข ${t.totalCount} ${o} total`
975
1035
  ] }),
976
1036
  /* @__PURE__ */ e(
977
- ts,
1037
+ is,
978
1038
  {
979
1039
  searchQuery: m,
980
1040
  setSearchQuery: x,
981
- placeholder: i
1041
+ placeholder: a
982
1042
  }
983
1043
  )
984
1044
  ] }),
985
- g && /* @__PURE__ */ u("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1045
+ g && /* @__PURE__ */ d("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
986
1046
  "Error loading ",
987
1047
  o,
988
1048
  ": ",
989
1049
  g
990
1050
  ] }),
991
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: h && S.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ u("div", { className: "flex items-center space-x-2", children: [
1051
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: h && S.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
992
1052
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
993
- /* @__PURE__ */ u("span", { className: "text-sm text-stone", children: [
1053
+ /* @__PURE__ */ d("span", { className: "text-sm text-stone", children: [
994
1054
  "Loading ",
995
1055
  o,
996
1056
  "..."
997
1057
  ] })
998
- ] }) }) : S.length === 0 ? /* @__PURE__ */ u("div", { className: "p-6 text-center", children: [
999
- /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(ce, { className: "h-8 w-8 text-charcoal" }) }),
1058
+ ] }) }) : S.length === 0 ? /* @__PURE__ */ d("div", { className: "p-6 text-center", children: [
1059
+ /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(de, { className: "h-8 w-8 text-charcoal" }) }),
1000
1060
  /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: m ? `No ${o} found` : k.length > 0 ? `Already chatting with all ${o}` : `No ${o} yet` }),
1001
1061
  /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: m ? "Try a different search term" : k.length > 0 ? `You have existing conversations with all your ${o}` : `${o.charAt(0).toUpperCase() + o.slice(1)} will appear here` })
1002
- ] }) : /* @__PURE__ */ u("ul", { className: "space-y-0", children: [
1062
+ ] }) : /* @__PURE__ */ d("ul", { className: "space-y-0", children: [
1003
1063
  S.map((c) => {
1004
- const d = c.name || c.email || c.id, N = c.email && c.name ? c.email : c.phone;
1064
+ const u = c.name || c.email || c.id, N = c.email && c.name ? c.email : c.phone;
1005
1065
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
1006
1066
  "button",
1007
1067
  {
1008
1068
  type: "button",
1009
- onClick: () => F(c),
1010
- onKeyDown: (j) => D(j, c),
1069
+ onClick: () => p(c),
1070
+ onKeyDown: (j) => T(j, c),
1011
1071
  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",
1012
- children: /* @__PURE__ */ u("div", { className: "flex items-center justify-between", children: [
1013
- /* @__PURE__ */ u("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1072
+ children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
1073
+ /* @__PURE__ */ d("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1014
1074
  /* @__PURE__ */ e(
1015
1075
  Y,
1016
1076
  {
1017
1077
  id: c.id,
1018
- name: d,
1078
+ name: u,
1019
1079
  image: c.image,
1020
1080
  size: 40
1021
1081
  }
1022
1082
  ),
1023
- /* @__PURE__ */ u("div", { className: "flex-1 min-w-0", children: [
1024
- /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: d }),
1083
+ /* @__PURE__ */ d("div", { className: "flex-1 min-w-0", children: [
1084
+ /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: u }),
1025
1085
  N && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: N })
1026
1086
  ] })
1027
1087
  ] }),
1028
- /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: w === c.id ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5 text-stone" }) })
1088
+ /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: w === c.id ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(de, { className: "h-5 w-5 text-stone" }) })
1029
1089
  ] })
1030
1090
  }
1031
1091
  ) }, c.id);
1032
1092
  }),
1033
- h && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ u("div", { className: "flex items-center space-x-2", children: [
1093
+ h && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
1034
1094
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1035
1095
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
1036
1096
  ] }) })
1037
1097
  ] }) })
1038
1098
  ] });
1039
- }, ls = ({ hasChannels: t }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ u("div", { className: "text-center max-w-sm", children: [
1099
+ }, ds = ({ hasChannels: t }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
1040
1100
  /* @__PURE__ */ e("div", { className: "w-24 h-24 bg-primary-alt/10 rounded-full flex items-center justify-center mx-auto mb-6", children: /* @__PURE__ */ e("span", { className: "text-4xl", children: "๐Ÿ’ฌ" }) }),
1041
1101
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal", children: "Welcome to Messages" }),
1042
1102
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? "Choose a conversation from the list." : "No conversations yet." })
1043
- ] }) }), re = ({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ u("div", { className: "text-center max-w-sm", children: [
1103
+ ] }) }), re = ({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ d("div", { className: "text-center max-w-sm", children: [
1044
1104
  /* @__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: "โš ๏ธ" }) }),
1045
1105
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
1046
1106
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
@@ -1053,12 +1113,12 @@ const rs = ({
1053
1113
  children: "Go Back"
1054
1114
  }
1055
1115
  )
1056
- ] }) }), os = ({ className: t, message: s }) => /* @__PURE__ */ u(
1116
+ ] }) }), us = ({ className: t, message: s }) => /* @__PURE__ */ d(
1057
1117
  "div",
1058
1118
  {
1059
1119
  className: R("flex items-center justify-center h-full", t),
1060
1120
  children: [
1061
- /* @__PURE__ */ u("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
1121
+ /* @__PURE__ */ d("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
1062
1122
  /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
1063
1123
  "animateTransform",
1064
1124
  {
@@ -1096,18 +1156,18 @@ const rs = ({
1096
1156
  s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
1097
1157
  ]
1098
1158
  }
1099
- ), as = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ u("div", { className: "flex items-center", children: [
1100
- /* @__PURE__ */ e(os, { className: "w-6 h-6" }),
1159
+ ), ms = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ d("div", { className: "flex items-center", children: [
1160
+ /* @__PURE__ */ e(us, { className: "w-6 h-6" }),
1101
1161
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
1102
- ] }) }), xs = ({
1162
+ ] }) }), Es = ({
1103
1163
  capabilities: t = {},
1104
1164
  className: s,
1105
1165
  renderMessageInputActions: n,
1106
1166
  onChannelSelect: l,
1107
1167
  onParticipantSelect: o,
1108
- initialParticipantFilter: i,
1168
+ initialParticipantFilter: a,
1109
1169
  initialParticipantData: r,
1110
- CustomChannelEmptyState: a,
1170
+ CustomChannelEmptyState: i,
1111
1171
  showChannelList: m = !0,
1112
1172
  filters: x,
1113
1173
  channelListCustomEmptyStateIndicator: k
@@ -1120,7 +1180,7 @@ const rs = ({
1120
1180
  error: C,
1121
1181
  refreshConnection: w,
1122
1182
  debug: v
1123
- } = Ge(), [y, S] = E(null), [F, D] = E(!1), [c, d] = E(!1), [N, j] = E(/* @__PURE__ */ new Set()), [A, W] = E(0), [_, G] = E(!1), [J, H] = E(null), V = z(null), { participantSource: Q, participantLabel: T = "participants" } = t, P = q.useMemo(() => {
1183
+ } = We(), [y, S] = E(null), [p, T] = E(!1), [c, u] = E(!1), [N, j] = E(/* @__PURE__ */ new Set()), [A, W] = E(0), [O, G] = E(!1), [J, H] = E(null), V = B(null), { participantSource: Q, participantLabel: F = "participants" } = t, M = q.useMemo(() => {
1124
1184
  const b = h == null ? void 0 : h.userID;
1125
1185
  return {
1126
1186
  ...{
@@ -1133,61 +1193,61 @@ const rs = ({
1133
1193
  },
1134
1194
  ...x
1135
1195
  };
1136
- }, [x, h == null ? void 0 : h.userID]), U = z(null), O = M(async () => {
1196
+ }, [x, h == null ? void 0 : h.userID]), L = B(null), U = P(async () => {
1137
1197
  if (!h || !I) return;
1138
1198
  const b = h.userID;
1139
1199
  if (b)
1140
1200
  try {
1141
1201
  v && console.log("[MessagingShell] Syncing channels for user:", b);
1142
- const L = await h.queryChannels(
1202
+ const _ = await h.queryChannels(
1143
1203
  {
1144
1204
  type: "messaging",
1145
1205
  members: { $in: [b] }
1146
1206
  },
1147
1207
  {},
1148
1208
  { limit: 100 }
1149
- ), p = /* @__PURE__ */ new Set();
1150
- L.forEach((B) => {
1151
- const Ee = B.state.members;
1152
- Object.values(Ee).forEach((Ie) => {
1153
- var le;
1154
- const te = (le = Ie.user) == null ? void 0 : le.id;
1155
- te && te !== b && p.add(te);
1209
+ ), D = /* @__PURE__ */ new Set();
1210
+ _.forEach((z) => {
1211
+ const Ie = z.state.members;
1212
+ Object.values(Ie).forEach((ye) => {
1213
+ var oe;
1214
+ const te = (oe = ye.user) == null ? void 0 : oe.id;
1215
+ te && te !== b && D.add(te);
1156
1216
  });
1157
- }), j(p), D(L.length > 0), U.current = b, v && console.log("[MessagingShell] Channels synced successfully:", {
1158
- channelCount: L.length,
1159
- memberCount: p.size
1217
+ }), j(D), T(_.length > 0), L.current = b, v && console.log("[MessagingShell] Channels synced successfully:", {
1218
+ channelCount: _.length,
1219
+ memberCount: D.size
1160
1220
  });
1161
- } catch (L) {
1162
- console.error("[MessagingShell] Failed to sync channels:", L);
1221
+ } catch (_) {
1222
+ console.error("[MessagingShell] Failed to sync channels:", _);
1163
1223
  }
1164
1224
  }, [h, I, v]);
1165
1225
  $(() => {
1166
1226
  if (!h || !I) return;
1167
1227
  const b = h.userID;
1168
- b && U.current !== b && O();
1169
- }, [h, I, O]), $(() => {
1170
- if (!i || !h || !I) return;
1228
+ b && L.current !== b && U();
1229
+ }, [h, I, U]), $(() => {
1230
+ if (!a || !h || !I) return;
1171
1231
  (async () => {
1172
- const L = h.userID;
1173
- if (L)
1232
+ const _ = h.userID;
1233
+ if (_)
1174
1234
  try {
1175
1235
  v && console.log(
1176
1236
  "[MessagingShell] Loading initial conversation with:",
1177
- i
1237
+ a
1178
1238
  );
1179
- const p = await h.queryChannels(
1239
+ const D = await h.queryChannels(
1180
1240
  {
1181
1241
  type: "messaging",
1182
- members: { $eq: [L, i] }
1242
+ members: { $eq: [_, a] }
1183
1243
  },
1184
1244
  {},
1185
1245
  { limit: 1 }
1186
1246
  );
1187
- if (p.length > 0)
1188
- S(p[0]), G(!0), H(null), l && l(p[0]), v && console.log(
1247
+ if (D.length > 0)
1248
+ S(D[0]), G(!0), H(null), l && l(D[0]), v && console.log(
1189
1249
  "[MessagingShell] Initial conversation loaded:",
1190
- p[0].id
1250
+ D[0].id
1191
1251
  );
1192
1252
  else if (r && f) {
1193
1253
  v && console.log(
@@ -1195,20 +1255,20 @@ const rs = ({
1195
1255
  r
1196
1256
  );
1197
1257
  try {
1198
- const B = await f.startChannelWithParticipant({
1258
+ const z = await f.startChannelWithParticipant({
1199
1259
  id: r.id,
1200
1260
  name: r.name,
1201
1261
  email: r.email,
1202
1262
  phone: r.phone
1203
1263
  });
1204
- S(B), G(!0), H(null), l && l(B), v && console.log(
1264
+ S(z), G(!0), H(null), l && l(z), v && console.log(
1205
1265
  "[MessagingShell] Channel created and loaded:",
1206
- B.id
1266
+ z.id
1207
1267
  );
1208
- } catch (B) {
1268
+ } catch (z) {
1209
1269
  console.error(
1210
1270
  "[MessagingShell] Failed to create conversation:",
1211
- B
1271
+ z
1212
1272
  ), H("Failed to create conversation");
1213
1273
  }
1214
1274
  } else
@@ -1216,17 +1276,17 @@ const rs = ({
1216
1276
  "No conversation found with this account"
1217
1277
  ), v && console.log(
1218
1278
  "[MessagingShell] No conversation found for:",
1219
- i
1279
+ a
1220
1280
  );
1221
- } catch (p) {
1281
+ } catch (D) {
1222
1282
  console.error(
1223
1283
  "[MessagingShell] Failed to load initial conversation:",
1224
- p
1284
+ D
1225
1285
  ), H("Failed to load conversation");
1226
1286
  }
1227
1287
  })();
1228
1288
  }, [
1229
- i,
1289
+ a,
1230
1290
  r,
1231
1291
  h,
1232
1292
  I,
@@ -1234,60 +1294,60 @@ const rs = ({
1234
1294
  v,
1235
1295
  l
1236
1296
  ]);
1237
- const X = M(
1297
+ const X = P(
1238
1298
  (b) => {
1239
1299
  S(b), l == null || l(b);
1240
1300
  },
1241
1301
  [l]
1242
- ), be = M(() => {
1243
- _ || S(null);
1244
- }, [_]), ve = M(
1302
+ ), ve = P(() => {
1303
+ O || S(null);
1304
+ }, [O]), Ce = P(
1245
1305
  async (b) => {
1246
- var L;
1306
+ var _;
1247
1307
  if (f)
1248
1308
  try {
1249
1309
  v && console.log(
1250
1310
  "[MessagingShell] Starting conversation with:",
1251
1311
  b.id
1252
1312
  );
1253
- const p = await f.startChannelWithParticipant({
1313
+ const D = await f.startChannelWithParticipant({
1254
1314
  id: b.id,
1255
1315
  name: b.name,
1256
1316
  email: b.email,
1257
1317
  phone: b.phone
1258
1318
  });
1259
1319
  try {
1260
- await p.show();
1261
- } catch (B) {
1262
- console.warn("[MessagingShell] Failed to unhide channel:", B);
1320
+ await D.show();
1321
+ } catch (z) {
1322
+ console.warn("[MessagingShell] Failed to unhide channel:", z);
1263
1323
  }
1264
- S(p), d(!1), (L = V.current) == null || L.close(), o == null || o(b);
1265
- } catch (p) {
1266
- console.error("[MessagingShell] Failed to start conversation:", p);
1324
+ S(D), u(!1), (_ = V.current) == null || _.close(), o == null || o(b);
1325
+ } catch (D) {
1326
+ console.error("[MessagingShell] Failed to start conversation:", D);
1267
1327
  }
1268
1328
  },
1269
1329
  [f, o, v]
1270
- ), ne = M(() => {
1330
+ ), ne = P(() => {
1271
1331
  var b;
1272
- d(!1), (b = V.current) == null || b.close();
1273
- }, []), Ce = M(
1332
+ u(!1), (b = V.current) == null || b.close();
1333
+ }, []), we = P(
1274
1334
  async (b) => {
1275
- v && console.log("[MessagingShell] Leaving conversation:", b.id), S(null), G(!1), U.current = null, await O();
1335
+ v && console.log("[MessagingShell] Leaving conversation:", b.id), S(null), G(!1), L.current = null, await U();
1276
1336
  },
1277
- [O, v]
1278
- ), we = M(
1337
+ [U, v]
1338
+ ), Ee = P(
1279
1339
  async (b) => {
1280
- v && console.log("[MessagingShell] Blocking participant:", b), S(null), G(!1), U.current = null, await O();
1340
+ v && console.log("[MessagingShell] Blocking participant:", b), S(null), G(!1), L.current = null, await U();
1281
1341
  },
1282
- [O, v]
1342
+ [U, v]
1283
1343
  ), Z = !!y;
1284
- return g ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(as, {}) }) : C ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(re, { message: C, onBack: w }) }) : !I || !h ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(
1344
+ return g ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(ms, {}) }) : C ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(re, { message: C, onBack: w }) }) : !I || !h ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(
1285
1345
  re,
1286
1346
  {
1287
1347
  message: "Not connected to messaging service",
1288
1348
  onBack: w
1289
1349
  }
1290
- ) }) : J ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(re, { message: J }) }) : /* @__PURE__ */ u(
1350
+ ) }) : J ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(re, { message: J }) }) : /* @__PURE__ */ d(
1291
1351
  "div",
1292
1352
  {
1293
1353
  className: R(
@@ -1295,7 +1355,7 @@ const rs = ({
1295
1355
  s
1296
1356
  ),
1297
1357
  children: [
1298
- /* @__PURE__ */ u("div", { className: "flex h-full min-h-0", children: [
1358
+ /* @__PURE__ */ d("div", { className: "flex h-full min-h-0", children: [
1299
1359
  /* @__PURE__ */ e(
1300
1360
  "div",
1301
1361
  {
@@ -1303,19 +1363,19 @@ const rs = ({
1303
1363
  "messaging-channel-list-sidebar min-h-0 min-w-0 bg-white lg:bg-chalk lg:flex lg:flex-col lg:border-r lg:border-sand",
1304
1364
  {
1305
1365
  // Explicitly hidden via prop or in direct conversation mode
1306
- "!hidden": m === !1 || _,
1366
+ "!hidden": m === !1 || O,
1307
1367
  // Normal mode: hide on mobile when channel selected, show on desktop
1308
- "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": m !== !1 && !_ && Z,
1368
+ "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": m !== !1 && !O && Z,
1309
1369
  // Normal mode: show when no channel selected
1310
- "flex flex-col w-full lg:flex-1 lg:max-w-2xl": m !== !1 && !_ && !Z
1370
+ "flex flex-col w-full lg:flex-1 lg:max-w-2xl": m !== !1 && !O && !Z
1311
1371
  }
1312
1372
  ),
1313
1373
  children: /* @__PURE__ */ e(
1314
- Qe,
1374
+ Ze,
1315
1375
  {
1316
1376
  onChannelSelect: X,
1317
1377
  selectedChannel: y || void 0,
1318
- filters: P,
1378
+ filters: M,
1319
1379
  customEmptyStateIndicator: k
1320
1380
  }
1321
1381
  )
@@ -1328,24 +1388,24 @@ const rs = ({
1328
1388
  "messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
1329
1389
  {
1330
1390
  // In direct conversation mode, always show (full width)
1331
- flex: _ || Z,
1391
+ flex: O || Z,
1332
1392
  // Normal mode: hide on mobile when no channel selected
1333
- "hidden lg:flex": !_ && !Z
1393
+ "hidden lg:flex": !O && !Z
1334
1394
  }
1335
1395
  ),
1336
1396
  children: y ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1337
- ns,
1397
+ as,
1338
1398
  {
1339
1399
  channel: y,
1340
- onBack: be,
1341
- showBackButton: !_,
1400
+ onBack: ve,
1401
+ showBackButton: !O,
1342
1402
  renderMessageInputActions: n,
1343
- onLeaveConversation: Ce,
1344
- onBlockParticipant: we,
1345
- CustomChannelEmptyState: a
1403
+ onLeaveConversation: we,
1404
+ onBlockParticipant: Ee,
1405
+ CustomChannelEmptyState: i
1346
1406
  },
1347
1407
  y.id
1348
- ) }) : /* @__PURE__ */ e(ls, { hasChannels: F })
1408
+ ) }) : /* @__PURE__ */ e(ds, { hasChannels: p })
1349
1409
  }
1350
1410
  )
1351
1411
  ] }),
@@ -1360,14 +1420,14 @@ const rs = ({
1360
1420
  },
1361
1421
  onClose: ne,
1362
1422
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
1363
- rs,
1423
+ cs,
1364
1424
  {
1365
1425
  participantSource: Q,
1366
- onSelectParticipant: ve,
1426
+ onSelectParticipant: Ce,
1367
1427
  onClose: ne,
1368
1428
  existingParticipantIds: N,
1369
- participantLabel: T,
1370
- searchPlaceholder: `Search ${T}...`
1429
+ participantLabel: F,
1430
+ searchPlaceholder: `Search ${F}...`
1371
1431
  },
1372
1432
  A
1373
1433
  ) })
@@ -1376,7 +1436,7 @@ const rs = ({
1376
1436
  ]
1377
1437
  }
1378
1438
  );
1379
- }, is = ({
1439
+ }, fs = ({
1380
1440
  question: t,
1381
1441
  onClick: s,
1382
1442
  loading: n = !1,
@@ -1398,36 +1458,36 @@ const rs = ({
1398
1458
  ),
1399
1459
  children: t
1400
1460
  }
1401
- ), Ns = ({
1461
+ ), Is = ({
1402
1462
  faqs: t,
1403
1463
  onFaqClick: s,
1404
1464
  loadingFaqId: n,
1405
1465
  headerText: l,
1406
1466
  className: o,
1407
- avatarImage: i,
1467
+ avatarImage: a,
1408
1468
  avatarName: r
1409
1469
  }) => {
1410
- const a = t.filter((m) => m.enabled).sort((m, x) => (m.order ?? 0) - (x.order ?? 0));
1411
- return a.length === 0 ? null : /* @__PURE__ */ e("div", { className: R("px-4 py-6", o), children: /* @__PURE__ */ u("div", { className: "flex gap-3 items-end", children: [
1412
- (i || r) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1470
+ const i = t.filter((m) => m.enabled).sort((m, x) => (m.order ?? 0) - (x.order ?? 0));
1471
+ return i.length === 0 ? null : /* @__PURE__ */ e("div", { className: R("px-4 py-6", o), children: /* @__PURE__ */ d("div", { className: "flex gap-3 items-end", children: [
1472
+ (a || r) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1413
1473
  Y,
1414
1474
  {
1415
1475
  id: r || "account",
1416
1476
  name: r || "Account",
1417
- image: i,
1477
+ image: a,
1418
1478
  size: 24,
1419
1479
  shape: "circle"
1420
1480
  }
1421
1481
  ) }),
1422
- /* @__PURE__ */ u(
1482
+ /* @__PURE__ */ d(
1423
1483
  "div",
1424
1484
  {
1425
1485
  className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
1426
1486
  style: { backgroundColor: "#F1F0EE" },
1427
1487
  children: [
1428
1488
  l && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: l }),
1429
- a.map((m) => /* @__PURE__ */ e(
1430
- is,
1489
+ i.map((m) => /* @__PURE__ */ e(
1490
+ fs,
1431
1491
  {
1432
1492
  question: m.question,
1433
1493
  onClick: () => s(m.id),
@@ -1439,31 +1499,31 @@ const rs = ({
1439
1499
  }
1440
1500
  )
1441
1501
  ] }) });
1442
- }, bs = (t, s = {}) => {
1443
- const { initialSearch: n = "", pageSize: l = 20 } = s, [o, i] = E([]), [r, a] = E(!1), [m, x] = E(null), [k, f] = E(n), [h, I] = E(!0), [g, C] = E(), w = M(async (F = !1, D) => {
1502
+ }, ys = (t, s = {}) => {
1503
+ const { initialSearch: n = "", pageSize: l = 20 } = s, [o, a] = E([]), [r, i] = E(!1), [m, x] = E(null), [k, f] = E(n), [h, I] = E(!0), [g, C] = E(), w = P(async (p = !1, T) => {
1444
1504
  if (r) return;
1445
- const c = D !== void 0 ? D : k;
1446
- a(!0), x(null);
1505
+ const c = T !== void 0 ? T : k;
1506
+ i(!0), x(null);
1447
1507
  try {
1448
- const d = await t.loadParticipants({
1508
+ const u = await t.loadParticipants({
1449
1509
  search: c || void 0,
1450
1510
  limit: l,
1451
- cursor: F ? void 0 : g
1511
+ cursor: p ? void 0 : g
1452
1512
  });
1453
- i(
1454
- (N) => F ? d.participants : [...N, ...d.participants]
1455
- ), I(d.hasMore), C(d.nextCursor);
1456
- } catch (d) {
1457
- const N = d instanceof Error ? d.message : "Failed to load participants";
1458
- x(N), console.error("[useParticipants] Load error:", d);
1513
+ a(
1514
+ (N) => p ? u.participants : [...N, ...u.participants]
1515
+ ), I(u.hasMore), C(u.nextCursor);
1516
+ } catch (u) {
1517
+ const N = u instanceof Error ? u.message : "Failed to load participants";
1518
+ x(N), console.error("[useParticipants] Load error:", u);
1459
1519
  } finally {
1460
- a(!1);
1520
+ i(!1);
1461
1521
  }
1462
- }, [t, k, g, l, r]), v = M(() => {
1522
+ }, [t, k, g, l, r]), v = P(() => {
1463
1523
  h && !r && w(!1);
1464
- }, [h, r, w]), y = M((F) => {
1465
- f(F), C(void 0), w(!0, F);
1466
- }, [w]), S = M(() => {
1524
+ }, [h, r, w]), y = P((p) => {
1525
+ f(p), C(void 0), w(!0, p);
1526
+ }, [w]), S = P(() => {
1467
1527
  C(void 0), w(!0);
1468
1528
  }, [w]);
1469
1529
  return $(() => {
@@ -1482,16 +1542,16 @@ const rs = ({
1482
1542
  };
1483
1543
  export {
1484
1544
  Y as Avatar,
1485
- Ne as ChannelEmptyState,
1486
- Qe as ChannelList,
1487
- ns as ChannelView,
1488
- Ns as FaqList,
1489
- is as FaqListItem,
1490
- gs as MessagingProvider,
1491
- xs as MessagingShell,
1492
- rs as ParticipantPicker,
1493
- We as formatRelativeTime,
1494
- Ge as useMessaging,
1495
- bs as useParticipants
1545
+ be as ChannelEmptyState,
1546
+ Ze as ChannelList,
1547
+ as as ChannelView,
1548
+ Is as FaqList,
1549
+ fs as FaqListItem,
1550
+ ws as MessagingProvider,
1551
+ Es as MessagingShell,
1552
+ cs as ParticipantPicker,
1553
+ Ye as formatRelativeTime,
1554
+ We as useMessaging,
1555
+ ys as useParticipants
1496
1556
  };
1497
1557
  //# sourceMappingURL=index.js.map