@linktr.ee/messaging-react 1.11.5-rc-1765005296 โ†’ 1.11.5-rc-1765008275

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { jsx as e, jsxs as i, Fragment as fe } from "react/jsx-runtime";
2
- import p from "classnames";
3
- import L, { createContext as De, useContext as Me, useCallback as M, useState as v, useRef as $, useEffect as G } from "react";
1
+ import { jsx as e, jsxs as i, Fragment as he } from "react/jsx-runtime";
2
+ import R from "classnames";
3
+ import L, { createContext as _e, useContext as Me, useCallback as D, useState as v, useRef as $, useEffect as V } from "react";
4
4
  import { StreamChatService as Fe } from "@linktr.ee/messaging-core";
5
- import { Chat as Pe, ChannelList as Te, useMessageComposer as Le, useStateStore as Ue, MessageInput as Oe, useMessageInputContext as je, useMessageComposerHasSendableData as Be, SimpleAttachmentSelector as Ae, QuotedMessagePreview as ze, AttachmentPreviewList as $e, TextareaComposer as Ge, MessageTimestamp as He, Channel as Ve, useChannelStateContext as ge, Window as We, MessageList as Ze } from "stream-chat-react";
6
- import { XIcon as ae, ArrowUpIcon as qe, ArrowLeftIcon as ie, DotsThreeIcon as ce, SpinnerGapIcon as se, SignOutIcon as Ye, ProhibitInsetIcon as de, FlagIcon as Je, MagnifyingGlassIcon as Qe, ChatCircleDotsIcon as ue } from "@phosphor-icons/react";
7
- import { LinkPreviewsManager as me } from "stream-chat";
8
- const xe = De({
5
+ import { Chat as Pe, ChannelList as Te, useMessageComposer as Le, useStateStore as Ue, MessageInput as Oe, useMessageInputContext as je, useMessageComposerHasSendableData as Be, SimpleAttachmentSelector as Ae, QuotedMessagePreview as ze, AttachmentPreviewList as $e, TextareaComposer as Ge, MessageTimestamp as He, Channel as Ve, useChannelStateContext as fe, Window as We, MessageList as Ze } from "stream-chat-react";
6
+ import { XIcon as le, ArrowUpIcon as qe, ArrowLeftIcon as oe, DotsThreeIcon as ie, SpinnerGapIcon as ee, SignOutIcon as Ye, ProhibitInsetIcon as ce, FlagIcon as Je, MagnifyingGlassIcon as Qe, ChatCircleDotsIcon as de } from "@phosphor-icons/react";
7
+ import { LinkPreviewsManager as ue } from "stream-chat";
8
+ const ge = _e({
9
9
  service: null,
10
10
  client: null,
11
11
  isConnected: !1,
@@ -15,7 +15,7 @@ const xe = De({
15
15
  refreshConnection: async () => {
16
16
  },
17
17
  debug: !1
18
- }), ne = () => Me(xe), ks = ({
18
+ }), te = () => Me(ge), ps = ({
19
19
  children: t,
20
20
  user: s,
21
21
  serviceConfig: n,
@@ -23,9 +23,9 @@ const xe = De({
23
23
  capabilities: a = {},
24
24
  debug: o = !1
25
25
  }) => {
26
- const l = M(
27
- (u, ...x) => {
28
- o && console.log(`๐Ÿ”ฅ [MessagingProvider] ${u}`, ...x);
26
+ const l = D(
27
+ (m, ...x) => {
28
+ o && console.log(`๐Ÿ”ฅ [MessagingProvider] ${m}`, ...x);
29
29
  },
30
30
  [o]
31
31
  );
@@ -35,14 +35,14 @@ const xe = De({
35
35
  serviceConfig: !!n,
36
36
  capabilities: Object.keys(a)
37
37
  });
38
- const [c, m] = v(null), [g, y] = v(null), [h, f] = v(!1), [S, b] = v(!1), [w, E] = v(null), N = $(!1), I = $({
38
+ const [c, h] = v(null), [b, k] = v(null), [d, f] = v(!1), [g, w] = v(!1), [y, E] = v(null), N = $(!1), I = $({
39
39
  userId: s == null ? void 0 : s.id,
40
40
  apiKey: r,
41
41
  serviceConfig: n,
42
42
  capabilities: a
43
- }), k = $(0);
44
- k.current++, l("๐Ÿ“Š RENDER INFO", {
45
- renderCount: k.current,
43
+ }), p = $(0);
44
+ p.current++, l("๐Ÿ“Š RENDER INFO", {
45
+ renderCount: p.current,
46
46
  currentProps: { userId: s == null ? void 0 : s.id, apiKey: (r == null ? void 0 : r.substring(0, 8)) + "..." },
47
47
  propChanges: {
48
48
  userChanged: I.current.userId !== (s == null ? void 0 : s.id),
@@ -55,10 +55,10 @@ const xe = De({
55
55
  apiKey: r,
56
56
  serviceConfig: n,
57
57
  capabilities: a
58
- }, G(() => {
59
- const u = k.current;
58
+ }, V(() => {
59
+ const m = p.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,13 +69,13 @@ const xe = De({
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: I.current.serviceConfig !== n
81
81
  });
@@ -84,25 +84,25 @@ const xe = De({
84
84
  apiKey: r,
85
85
  debug: o
86
86
  });
87
- return m(x), l("โœ… SERVICE SET", {
88
- renderCount: u,
87
+ return h(x), l("โœ… SERVICE SET", {
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
96
  }, [r, n, o, l]);
97
- const R = $(null);
98
- G(() => {
99
- var x, A;
97
+ const S = $(null);
98
+ V(() => {
99
+ var x, G;
100
100
  if (l("๐Ÿ”— USER CONNECTION EFFECT TRIGGERED", {
101
101
  hasService: !!c,
102
102
  hasUser: !!s,
103
103
  userId: s == null ? void 0 : s.id,
104
104
  isConnecting: N.current,
105
- isConnected: h,
105
+ isConnected: d,
106
106
  dependencies: { service: !!c, userId: s == null ? void 0 : s.id }
107
107
  }), !c || !s) {
108
108
  l("โš ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
@@ -112,7 +112,7 @@ const xe = De({
112
112
  l("โš ๏ธ USER CONNECTION SKIPPED", "Already connecting");
113
113
  return;
114
114
  }
115
- if (((x = R.current) == null ? void 0 : x.serviceId) === c && ((A = R.current) == null ? void 0 : A.userId) === s.id) {
115
+ if (((x = S.current) == null ? void 0 : x.serviceId) === c && ((G = S.current) == null ? void 0 : G.userId) === s.id) {
116
116
  l(
117
117
  "โš ๏ธ USER CONNECTION SKIPPED",
118
118
  "Already connected this user with this service"
@@ -120,40 +120,40 @@ const xe = De({
120
120
  return;
121
121
  }
122
122
  (async () => {
123
- l("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), N.current = !0, b(!0), E(null);
123
+ l("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), N.current = !0, w(!0), E(null);
124
124
  try {
125
125
  l("๐Ÿ“ž CALLING SERVICE.CONNECTUSER", { userId: s.id });
126
- const z = await c.connectUser(s);
127
- y(z), f(!0), R.current = { serviceId: c, userId: s.id }, l("โœ… USER CONNECTION SUCCESS", {
126
+ const j = await c.connectUser(s);
127
+ k(j), f(!0), S.current = { serviceId: c, userId: s.id }, l("โœ… USER CONNECTION SUCCESS", {
128
128
  userId: s.id,
129
- clientId: z.userID
129
+ clientId: j.userID
130
130
  });
131
- } catch (z) {
132
- const Z = z instanceof Error ? z.message : "Connection failed";
133
- E(Z), l("โŒ USER CONNECTION ERROR", {
131
+ } catch (j) {
132
+ const q = j instanceof Error ? j.message : "Connection failed";
133
+ E(q), l("โŒ USER CONNECTION ERROR", {
134
134
  userId: s.id,
135
- error: Z
135
+ error: q
136
136
  });
137
137
  } finally {
138
- b(!1), N.current = !1, l("๐Ÿ”„ USER CONNECTION FINISHED", {
138
+ w(!1), N.current = !1, l("๐Ÿ”„ USER CONNECTION FINISHED", {
139
139
  userId: s.id,
140
- isConnected: h
140
+ isConnected: d
141
141
  });
142
142
  }
143
143
  })();
144
- }, [c, s, l, h]), G(() => (l("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
144
+ }, [c, s, l, d]), V(() => (l("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
145
145
  hasService: !!c,
146
- isConnected: h
146
+ isConnected: d
147
147
  }), () => {
148
- c && h ? (l(
148
+ c && d ? (l(
149
149
  "๐Ÿงน CLEANUP EFFECT TRIGGERED",
150
150
  "Cleaning up connection on unmount"
151
- ), R.current = null, c.disconnectUser().catch(console.error)) : l("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
151
+ ), S.current = null, c.disconnectUser().catch(console.error)) : l("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
152
152
  hasService: !!c,
153
- isConnected: h
153
+ isConnected: d
154
154
  });
155
- }), [c, h, l]);
156
- const F = M(async () => {
155
+ }), [c, d, l]);
156
+ const P = D(async () => {
157
157
  if (l("๐Ÿ”„ REFRESH CONNECTION CALLED", {
158
158
  hasService: !!c,
159
159
  hasUser: !!s
@@ -161,62 +161,62 @@ const xe = De({
161
161
  l("โš ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
162
162
  return;
163
163
  }
164
- l("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), b(!0);
164
+ l("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), w(!0);
165
165
  try {
166
166
  l("๐Ÿ”Œ DISCONNECTING FOR REFRESH"), await c.disconnectUser(), l("๐Ÿ“ž RECONNECTING FOR REFRESH");
167
- const u = await c.connectUser(s);
168
- y(u), f(!0), E(null), l("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
169
- } catch (u) {
170
- const x = u instanceof Error ? u.message : "Refresh failed";
167
+ const m = await c.connectUser(s);
168
+ k(m), f(!0), E(null), l("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
169
+ } catch (m) {
170
+ const x = m instanceof Error ? m.message : "Refresh failed";
171
171
  E(x), l("โŒ CONNECTION REFRESH ERROR", {
172
172
  userId: s.id,
173
173
  error: x
174
174
  });
175
175
  } finally {
176
- b(!1), l("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
176
+ w(!1), l("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
177
177
  }
178
- }, [c, s, l]), d = L.useMemo(() => (l("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
178
+ }, [c, s, l]), u = L.useMemo(() => (l("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
179
179
  hasService: !!c,
180
- hasClient: !!g,
181
- isConnected: h,
182
- isLoading: S,
183
- hasError: !!w,
180
+ hasClient: !!b,
181
+ isConnected: d,
182
+ isLoading: g,
183
+ hasError: !!y,
184
184
  capabilitiesKeys: Object.keys(a)
185
185
  }), {
186
186
  service: c,
187
- client: g,
188
- isConnected: h,
189
- isLoading: S,
190
- error: w,
187
+ client: b,
188
+ isConnected: d,
189
+ isLoading: g,
190
+ error: y,
191
191
  capabilities: a,
192
- refreshConnection: F,
192
+ refreshConnection: P,
193
193
  debug: o
194
194
  }), [
195
195
  c,
196
+ b,
197
+ d,
196
198
  g,
197
- h,
198
- S,
199
- w,
199
+ y,
200
200
  a,
201
- F,
201
+ P,
202
202
  o,
203
203
  l
204
204
  ]);
205
205
  return l("๐Ÿ”„ RENDER END", {
206
- renderCount: k.current,
207
- willRenderChat: !!(g && h),
208
- contextValueReady: !!d
209
- }), /* @__PURE__ */ e(xe.Provider, { value: d, children: g && h ? /* @__PURE__ */ e(
206
+ renderCount: p.current,
207
+ willRenderChat: !!(b && d),
208
+ contextValueReady: !!u
209
+ }), /* @__PURE__ */ e(ge.Provider, { value: u, children: b && d ? /* @__PURE__ */ e(
210
210
  Pe,
211
211
  {
212
- client: g,
212
+ client: b,
213
213
  customClasses: {
214
214
  channelList: "str-chat__channel-list str-chat__channel-list-react bg-transparent lg:border-r-2 border-r-0 border-[#0000000A]"
215
215
  },
216
216
  children: t
217
217
  }
218
218
  ) : t });
219
- }, Xe = () => ne(), Ke = (t, s) => {
219
+ }, Xe = () => te(), Ke = (t, s) => {
220
220
  const n = new Date(
221
221
  Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
222
222
  ), a = new Date(
@@ -236,7 +236,7 @@ const xe = De({
236
236
  day: "numeric",
237
237
  year: "2-digit"
238
238
  });
239
- }, he = [
239
+ }, me = [
240
240
  "๐ŸŽ",
241
241
  // Apple
242
242
  "๐ŸŒ",
@@ -273,28 +273,28 @@ function ss(t) {
273
273
  return Math.abs(s);
274
274
  }
275
275
  function ts(t) {
276
- const n = ss(t) % he.length;
277
- return he[n];
276
+ const n = ss(t) % me.length;
277
+ return me[n];
278
278
  }
279
- const q = ({
279
+ const Y = ({
280
280
  id: t,
281
281
  image: s,
282
282
  size: n = 40,
283
283
  className: r,
284
284
  shape: a = "squircle"
285
285
  }) => {
286
- const o = ts(t), c = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", m = a === "circle" ? { borderRadius: "50%" } : {
286
+ const o = ts(t), c = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", h = a === "circle" ? { borderRadius: "50%" } : {
287
287
  borderRadius: "33%",
288
288
  "corner-shape": "superellipse(1.3)"
289
289
  };
290
290
  return /* @__PURE__ */ e(
291
291
  "div",
292
292
  {
293
- className: p("flex-shrink-0 overflow-hidden", r),
293
+ className: R("flex-shrink-0 overflow-hidden", r),
294
294
  style: {
295
295
  width: `${n}px`,
296
296
  height: `${n}px`,
297
- ...m
297
+ ...h
298
298
  },
299
299
  children: s ? /* @__PURE__ */ e(
300
300
  "img",
@@ -307,7 +307,7 @@ const q = ({
307
307
  "div",
308
308
  {
309
309
  "aria-hidden": "true",
310
- className: p(
310
+ className: R(
311
311
  "avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
312
312
  c
313
313
  ),
@@ -316,34 +316,34 @@ const q = ({
316
316
  )
317
317
  }
318
318
  );
319
- }, Ce = L.memo(
319
+ }, xe = L.memo(
320
320
  ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
321
- var E, N, I, k, R, F;
321
+ var E, N, I, p, S, P;
322
322
  const o = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), l = () => {
323
323
  t && n(t);
324
- }, m = Object.values(((E = t == null ? void 0 : t.state) == null ? void 0 : E.members) || {}).find(
325
- (d) => {
326
- var u, x;
327
- return ((u = d.user) == null ? void 0 : u.id) && d.user.id !== ((x = t == null ? void 0 : t._client) == null ? void 0 : x.userID);
324
+ }, h = Object.values(((E = t == null ? void 0 : t.state) == null ? void 0 : E.members) || {}).find(
325
+ (u) => {
326
+ var m, x;
327
+ return ((m = u.user) == null ? void 0 : m.id) && u.user.id !== ((x = t == null ? void 0 : t._client) == null ? void 0 : x.userID);
328
328
  }
329
- ), g = ((N = m == null ? void 0 : m.user) == null ? void 0 : N.name) || "Conversation", y = (I = m == null ? void 0 : m.user) == null ? void 0 : I.image, h = (R = (k = t == null ? void 0 : t.state) == null ? void 0 : k.messages) == null ? void 0 : R[t.state.messages.length - 1], S = (() => {
330
- var u;
331
- if (h != null && h.text) return h.text;
332
- const d = (u = h == null ? void 0 : h.attachments) == null ? void 0 : u[0];
333
- return d != null && d.asset_url ? d.asset_url : d != null && d.image_url ? d.image_url : d != null && d.og_scrape_url ? d.og_scrape_url : d != null && d.thumb_url ? d.thumb_url : "No messages yet";
334
- })(), b = h != null && h.created_at ? es(new Date(h.created_at)) : "", w = a ?? 0;
329
+ ), b = ((N = h == null ? void 0 : h.user) == null ? void 0 : N.name) || "Conversation", k = (I = h == null ? void 0 : h.user) == null ? void 0 : I.image, d = (S = (p = t == null ? void 0 : t.state) == null ? void 0 : p.messages) == null ? void 0 : S[t.state.messages.length - 1], g = (() => {
330
+ var m;
331
+ if (d != null && d.text) return d.text;
332
+ const u = (m = d == null ? void 0 : d.attachments) == null ? void 0 : m[0];
333
+ return u != null && u.asset_url ? u.asset_url : u != null && u.image_url ? u.image_url : u != null && u.og_scrape_url ? u.og_scrape_url : u != null && u.thumb_url ? u.thumb_url : "No messages yet";
334
+ })(), w = d != null && d.created_at ? es(new Date(d.created_at)) : "", y = a ?? 0;
335
335
  return r && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
336
336
  channelId: t == null ? void 0 : t.id,
337
337
  isSelected: o,
338
- participantName: g,
339
- unreadCount: w,
340
- hasTimestamp: !!b
338
+ participantName: b,
339
+ unreadCount: y,
340
+ hasTimestamp: !!w
341
341
  }), /* @__PURE__ */ e(
342
342
  "button",
343
343
  {
344
344
  type: "button",
345
345
  onClick: l,
346
- className: p(
346
+ className: R(
347
347
  "group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
348
348
  {
349
349
  "bg-primary-alt/10 border-l-4 border-l-primary": o,
@@ -352,11 +352,11 @@ const q = ({
352
352
  ),
353
353
  children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
354
354
  /* @__PURE__ */ e(
355
- q,
355
+ Y,
356
356
  {
357
- id: ((F = m == null ? void 0 : m.user) == null ? void 0 : F.id) || t.id || "unknown",
358
- name: g,
359
- image: y,
357
+ id: ((P = h == null ? void 0 : h.user) == null ? void 0 : P.id) || t.id || "unknown",
358
+ name: b,
359
+ image: k,
360
360
  size: 44,
361
361
  className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
362
362
  }
@@ -366,18 +366,18 @@ const q = ({
366
366
  /* @__PURE__ */ e(
367
367
  "h3",
368
368
  {
369
- className: p(
369
+ className: R(
370
370
  "text-sm font-medium truncate",
371
371
  o ? "text-primary" : "text-charcoal"
372
372
  ),
373
- children: g
373
+ children: b
374
374
  }
375
375
  ),
376
- b && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: b })
376
+ w && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: w })
377
377
  ] }),
378
378
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
379
- /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: S }),
380
- 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 })
379
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: g }),
380
+ y > 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: y > 99 ? "99+" : y })
381
381
  ] })
382
382
  ] })
383
383
  ] })
@@ -385,8 +385,8 @@ const q = ({
385
385
  );
386
386
  }
387
387
  );
388
- Ce.displayName = "CustomChannelPreview";
389
- const Ne = L.memo(
388
+ xe.displayName = "CustomChannelPreview";
389
+ const Ce = L.memo(
390
390
  ({
391
391
  onChannelSelect: t,
392
392
  selectedChannel: s,
@@ -396,16 +396,16 @@ const Ne = L.memo(
396
396
  }) => {
397
397
  const o = L.useRef(0);
398
398
  o.current++;
399
- const { debug: l = !1 } = ne();
399
+ const { debug: l = !1 } = te();
400
400
  l && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ”„ RENDER START", {
401
401
  renderCount: o.current,
402
402
  selectedChannelId: s == null ? void 0 : s.id,
403
403
  filters: n
404
404
  });
405
- const c = L.useMemo(() => (g) => /* @__PURE__ */ e(
406
- Ce,
405
+ const c = L.useMemo(() => (b) => /* @__PURE__ */ e(
406
+ xe,
407
407
  {
408
- ...g,
408
+ ...b,
409
409
  selectedChannel: s,
410
410
  onChannelSelect: t,
411
411
  debug: l
@@ -414,7 +414,7 @@ const Ne = L.memo(
414
414
  return /* @__PURE__ */ e(
415
415
  "div",
416
416
  {
417
- className: p(
417
+ className: R(
418
418
  "messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
419
419
  r
420
420
  ),
@@ -433,8 +433,8 @@ const Ne = L.memo(
433
433
  );
434
434
  }
435
435
  );
436
- Ne.displayName = "ChannelList";
437
- const ee = ({
436
+ Ce.displayName = "ChannelList";
437
+ const K = ({
438
438
  variant: t = "default",
439
439
  className: s,
440
440
  children: n,
@@ -443,7 +443,7 @@ const ee = ({
443
443
  "button",
444
444
  {
445
445
  type: "button",
446
- className: p(
446
+ className: R(
447
447
  "flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left text-sm transition-colors focus-ring disabled:cursor-not-allowed disabled:opacity-60",
448
448
  t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
449
449
  s
@@ -452,12 +452,12 @@ const ee = ({
452
452
  children: n
453
453
  }
454
454
  );
455
- function be({ label: t, className: s, children: n, ...r }) {
455
+ function Ne({ label: t, className: s, children: n, ...r }) {
456
456
  return /* @__PURE__ */ i(
457
457
  "button",
458
458
  {
459
459
  type: "button",
460
- className: p(
460
+ className: R(
461
461
  "rounded-full p-2 transition-colors focus-ring",
462
462
  {
463
463
  "cursor-not-allowed opacity-50": r.disabled,
@@ -473,12 +473,12 @@ function be({ label: t, className: s, children: n, ...r }) {
473
473
  }
474
474
  );
475
475
  }
476
- function ve({ onClick: t }) {
477
- return /* @__PURE__ */ e(be, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(ae, { className: "h-5 w-5 text-stone", weight: "bold" }) });
476
+ function be({ onClick: t }) {
477
+ return /* @__PURE__ */ e(Ne, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(le, { className: "h-5 w-5 text-stone", weight: "bold" }) });
478
478
  }
479
479
  const ns = (t) => ({
480
480
  linkPreviews: Array.from(t.previews.values()).filter(
481
- (s) => me.previewIsLoaded(s) || me.previewIsLoading(s)
481
+ (s) => ue.previewIsLoaded(s) || ue.previewIsLoading(s)
482
482
  )
483
483
  }), rs = ({
484
484
  link: t,
@@ -510,7 +510,7 @@ const ns = (t) => ({
510
510
  },
511
511
  className: "absolute right-4 top-4 flex size-6 items-center justify-center rounded-full border border-white/40 bg-white/70 backdrop-blur-2xl",
512
512
  "aria-label": "Close link preview",
513
- children: /* @__PURE__ */ e(ae, { className: "size-4 text-black/90" })
513
+ children: /* @__PURE__ */ e(le, { className: "size-4 text-black/90" })
514
514
  }
515
515
  ),
516
516
  /* @__PURE__ */ i("div", { className: "p-2", children: [
@@ -537,7 +537,7 @@ const ns = (t) => ({
537
537
  )) }) : null;
538
538
  }, as = () => {
539
539
  const { handleSubmit: t } = je(), s = Be();
540
- return /* @__PURE__ */ i(fe, { children: [
540
+ return /* @__PURE__ */ i(he, { children: [
541
541
  /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(Ae, {}) }),
542
542
  /* @__PURE__ */ i("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]", children: [
543
543
  /* @__PURE__ */ e(ze, {}),
@@ -582,32 +582,34 @@ const ns = (t) => ({
582
582
  !s && /* @__PURE__ */ e(He, { message: t.message })
583
583
  ] });
584
584
  }, cs = () => null, ds = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
585
- var m, g, y, h, f;
586
- const { channel: a } = ge(), o = L.useMemo(() => Object.values(a.state.members || {}).find(
587
- (b) => {
588
- var w;
589
- return ((w = b.user) == null ? void 0 : w.id) && b.user.id !== a._client.userID;
585
+ var h, b, k, d, f;
586
+ const { channel: a } = fe(), o = L.useMemo(() => Object.values(a.state.members || {}).find(
587
+ (w) => {
588
+ var y;
589
+ return ((y = w.user) == null ? void 0 : y.id) && w.user.id !== a._client.userID;
590
590
  }
591
- ), [a._client.userID, a.state.members]), l = ((m = o == null ? void 0 : o.user) == null ? void 0 : m.name) || ((g = o == null ? void 0 : o.user) == null ? void 0 : g.id) || "Unknown member", c = (y = o == null ? void 0 : o.user) == null ? void 0 : y.image;
591
+ ), [a._client.userID, a.state.members]), l = ((h = o == null ? void 0 : o.user) == null ? void 0 : h.name) || ((b = o == null ? void 0 : o.user) == null ? void 0 : b.id) || "Unknown member", c = (k = o == null ? void 0 : o.user) == null ? void 0 : k.image;
592
592
  return /* @__PURE__ */ i("div", { className: "@container", children: [
593
593
  /* @__PURE__ */ i("div", { className: "flex justify-between items-center @lg:hidden", children: [
594
594
  /* @__PURE__ */ e(
595
595
  "button",
596
596
  {
597
- className: p(
597
+ className: R(
598
598
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
599
599
  !s && "invisible"
600
600
  ),
601
601
  onClick: t || (() => {
602
602
  }),
603
- children: /* @__PURE__ */ e(ie, { className: "size-5 text-black/90" })
603
+ type: "button",
604
+ "aria-label": "Back to conversations",
605
+ children: /* @__PURE__ */ e(oe, { className: "size-5 text-black/90" })
604
606
  }
605
607
  ),
606
608
  /* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
607
609
  /* @__PURE__ */ e(
608
- q,
610
+ Y,
609
611
  {
610
- id: ((h = o == null ? void 0 : o.user) == null ? void 0 : h.id) || a.id || "unknown",
612
+ id: ((d = o == null ? void 0 : o.user) == null ? void 0 : d.id) || a.id || "unknown",
611
613
  name: l,
612
614
  image: c,
613
615
  size: 40
@@ -618,12 +620,13 @@ const ns = (t) => ({
618
620
  /* @__PURE__ */ e(
619
621
  "button",
620
622
  {
621
- className: p(
623
+ className: R(
622
624
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
623
625
  ),
624
- onClick: n || (() => {
625
- }),
626
- children: /* @__PURE__ */ e(ce, { className: "size-5 text-black/90" })
626
+ onClick: n,
627
+ type: "button",
628
+ "aria-label": "Show info",
629
+ children: /* @__PURE__ */ e(ie, { className: "size-5 text-black/90" })
627
630
  }
628
631
  )
629
632
  ] }),
@@ -636,11 +639,11 @@ const ns = (t) => ({
636
639
  onClick: t,
637
640
  className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
638
641
  "aria-label": "Back to conversations",
639
- children: /* @__PURE__ */ e(ie, { className: "size-5 text-black/90" })
642
+ children: /* @__PURE__ */ e(oe, { className: "size-5 text-black/90" })
640
643
  }
641
644
  ),
642
645
  /* @__PURE__ */ e(
643
- q,
646
+ Y,
644
647
  {
645
648
  id: ((f = o == null ? void 0 : o.user) == null ? void 0 : f.id) || a.id || "unknown",
646
649
  name: l,
@@ -653,17 +656,17 @@ const ns = (t) => ({
653
656
  r && n && /* @__PURE__ */ e(
654
657
  "button",
655
658
  {
656
- className: p(
659
+ className: R(
657
660
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
658
661
  ),
659
662
  onClick: n,
660
- children: /* @__PURE__ */ e(ce, { className: "size-5 text-black/90" })
663
+ children: /* @__PURE__ */ e(ie, { className: "size-5 text-black/90" })
661
664
  }
662
665
  )
663
666
  ] })
664
667
  ] });
665
668
  }, us = ({
666
- isOpen: t,
669
+ dialogRef: t,
667
670
  onClose: s,
668
671
  participant: n,
669
672
  channel: r,
@@ -671,71 +674,66 @@ const ns = (t) => ({
671
674
  onLeaveConversation: o,
672
675
  onBlockParticipant: l
673
676
  }) => {
674
- var Z, B, V, Y, H, W, J;
675
- const { service: c, debug: m } = ne(), g = $(null), [y, h] = v(!1), [f, S] = v(!1), [b, w] = v(!1);
676
- G(() => {
677
- const _ = g.current;
678
- _ && (t ? _.showModal() : _.close());
679
- }, [t]);
680
- const E = M(async () => {
681
- var _;
682
- if (!(!c || !((_ = n == null ? void 0 : n.user) != null && _.id)))
677
+ var j, q, O, W, J, H, Z;
678
+ const { service: c, debug: h } = te(), [b, k] = v(!1), [d, f] = v(!1), [g, w] = v(!1), y = D(async () => {
679
+ var M;
680
+ if (!(!c || !((M = n == null ? void 0 : n.user) != null && M.id)))
683
681
  try {
684
- const U = (await c.getBlockedUsers()).some(
685
- (O) => {
686
- var Q;
687
- return O.blocked_user_id === ((Q = n == null ? void 0 : n.user) == null ? void 0 : Q.id);
682
+ const A = (await c.getBlockedUsers()).some(
683
+ (B) => {
684
+ var z;
685
+ return B.blocked_user_id === ((z = n == null ? void 0 : n.user) == null ? void 0 : z.id);
688
686
  }
689
687
  );
690
- h(U);
691
- } catch (P) {
688
+ k(A);
689
+ } catch (F) {
692
690
  console.error(
693
691
  "[ChannelInfoDialog] Failed to check blocked status:",
694
- P
692
+ F
695
693
  );
696
694
  }
697
- }, [c, (Z = n == null ? void 0 : n.user) == null ? void 0 : Z.id]);
698
- G(() => {
699
- t && E();
700
- }, [t, E]);
701
- const N = async () => {
702
- var _;
703
- if (!f) {
704
- m && console.log("[ChannelInfoDialog] Leave conversation", r.cid), S(!0);
695
+ }, [c, (j = n == null ? void 0 : n.user) == null ? void 0 : j.id]);
696
+ V(() => {
697
+ y();
698
+ }, [y]);
699
+ const E = async () => {
700
+ var M;
701
+ if (!d) {
702
+ h && console.log("[ChannelInfoDialog] Leave conversation", r.cid), f(!0);
705
703
  try {
706
- const P = ((_ = r._client) == null ? void 0 : _.userID) ?? null;
707
- await r.hide(P, !1), o && await o(r), s();
708
- } catch (P) {
709
- console.error("[ChannelInfoDialog] Failed to leave conversation", P);
704
+ const F = ((M = r._client) == null ? void 0 : M.userID) ?? null;
705
+ await r.hide(F, !1), o && await o(r), s();
706
+ } catch (F) {
707
+ console.error("[ChannelInfoDialog] Failed to leave conversation", F);
710
708
  } finally {
711
- S(!1);
709
+ f(!1);
712
710
  }
713
711
  }
714
- }, I = async () => {
715
- var _, P, U;
716
- if (!(b || !c)) {
717
- m && console.log("[ChannelInfoDialog] Block member", (_ = n == null ? void 0 : n.user) == null ? void 0 : _.id), w(!0);
712
+ }, N = async () => {
713
+ var M, F, A;
714
+ if (!(g || !c)) {
715
+ h && console.log("[ChannelInfoDialog] Block member", (M = n == null ? void 0 : n.user) == null ? void 0 : M.id), w(!0);
718
716
  try {
719
- await c.blockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), l && await l((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
720
- } catch (O) {
721
- console.error("[ChannelInfoDialog] Failed to block member", O);
717
+ await c.blockUser((F = n == null ? void 0 : n.user) == null ? void 0 : F.id), l && await l((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
718
+ } catch (B) {
719
+ console.error("[ChannelInfoDialog] Failed to block member", B);
722
720
  } finally {
723
721
  w(!1);
724
722
  }
725
723
  }
726
- }, k = async () => {
727
- var _, P, U;
728
- if (!(b || !c)) {
729
- m && console.log("[ChannelInfoDialog] Unblock member", (_ = n == null ? void 0 : n.user) == null ? void 0 : _.id), w(!0);
724
+ }, I = async () => {
725
+ var M, F, A;
726
+ if (!(g || !c)) {
727
+ h && console.log("[ChannelInfoDialog] Unblock member", (M = n == null ? void 0 : n.user) == null ? void 0 : M.id), w(!0);
730
728
  try {
731
- await c.unBlockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), l && await l((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), s();
732
- } catch (O) {
733
- console.error("[ChannelInfoDialog] Failed to unblock member", O);
729
+ await c.unBlockUser((F = n == null ? void 0 : n.user) == null ? void 0 : F.id), l && await l((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
730
+ } catch (B) {
731
+ console.error("[ChannelInfoDialog] Failed to unblock member", B);
734
732
  } finally {
735
733
  w(!1);
736
734
  }
737
735
  }
738
- }, R = () => {
736
+ }, p = () => {
739
737
  s(), window.open(
740
738
  "https://linktr.ee/s/about/trust-center/report",
741
739
  "_blank",
@@ -743,22 +741,22 @@ const ns = (t) => ({
743
741
  );
744
742
  };
745
743
  if (!n) return null;
746
- const F = ((B = n.user) == null ? void 0 : B.name) || ((V = n.user) == null ? void 0 : V.id) || "Unknown member", d = (Y = n.user) == null ? void 0 : Y.image, u = (H = n.user) == null ? void 0 : H.email, x = (W = n.user) == null ? void 0 : W.username, A = u || (x ? `linktr.ee/${x}` : void 0), z = ((J = n.user) == null ? void 0 : J.id) || "unknown";
744
+ const S = ((q = n.user) == null ? void 0 : q.name) || ((O = n.user) == null ? void 0 : O.id) || "Unknown member", P = (W = n.user) == null ? void 0 : W.image, u = (J = n.user) == null ? void 0 : J.email, m = (H = n.user) == null ? void 0 : H.username, x = u || (m ? `linktr.ee/${m}` : void 0), G = ((Z = n.user) == null ? void 0 : Z.id) || "unknown";
747
745
  return (
748
746
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
749
747
  /* @__PURE__ */ e(
750
748
  "dialog",
751
749
  {
752
- ref: g,
750
+ ref: t,
753
751
  className: "mes-dialog group",
754
752
  onClose: s,
755
- onClick: (_) => {
756
- _.target === g.current && s();
753
+ onClick: (M) => {
754
+ M.target === t.current && s();
757
755
  },
758
756
  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: [
759
757
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
760
758
  /* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
761
- /* @__PURE__ */ e(ve, { onClick: s })
759
+ /* @__PURE__ */ e(be, { onClick: s })
762
760
  ] }),
763
761
  /* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
764
762
  /* @__PURE__ */ e(
@@ -768,18 +766,18 @@ const ns = (t) => ({
768
766
  style: { backgroundColor: "#FBFAF9" },
769
767
  children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
770
768
  /* @__PURE__ */ e(
771
- q,
769
+ Y,
772
770
  {
773
- id: z,
774
- name: F,
775
- image: d,
771
+ id: G,
772
+ name: S,
773
+ image: P,
776
774
  size: 88,
777
775
  shape: "circle"
778
776
  }
779
777
  ),
780
778
  /* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
781
- /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: F }),
782
- A && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: A }),
779
+ /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: S }),
780
+ x && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: x }),
783
781
  a && /* @__PURE__ */ e(
784
782
  "span",
785
783
  {
@@ -800,41 +798,41 @@ const ns = (t) => ({
800
798
  ),
801
799
  /* @__PURE__ */ i("ul", { className: "flex flex-col gap-2 mt-2", children: [
802
800
  /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
803
- ee,
801
+ K,
804
802
  {
805
- onClick: N,
806
- disabled: f,
807
- "aria-busy": f,
803
+ onClick: E,
804
+ disabled: d,
805
+ "aria-busy": d,
808
806
  children: [
809
- f ? /* @__PURE__ */ e(se, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ye, { className: "h-5 w-5" }),
807
+ d ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ye, { className: "h-5 w-5" }),
810
808
  /* @__PURE__ */ e("span", { children: "Delete Conversation" })
811
809
  ]
812
810
  }
813
811
  ) }),
814
- /* @__PURE__ */ e("li", { children: y ? /* @__PURE__ */ i(
815
- ee,
812
+ /* @__PURE__ */ e("li", { children: b ? /* @__PURE__ */ i(
813
+ K,
816
814
  {
817
- onClick: k,
818
- disabled: b,
819
- "aria-busy": b,
815
+ onClick: I,
816
+ disabled: g,
817
+ "aria-busy": g,
820
818
  children: [
821
- b ? /* @__PURE__ */ e(se, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(de, { className: "h-5 w-5" }),
819
+ g ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5" }),
822
820
  /* @__PURE__ */ e("span", { children: "Unblock" })
823
821
  ]
824
822
  }
825
823
  ) : /* @__PURE__ */ i(
826
- ee,
824
+ K,
827
825
  {
828
- onClick: I,
829
- disabled: b,
830
- "aria-busy": b,
826
+ onClick: N,
827
+ disabled: g,
828
+ "aria-busy": g,
831
829
  children: [
832
- b ? /* @__PURE__ */ e(se, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(de, { className: "h-5 w-5" }),
830
+ g ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5" }),
833
831
  /* @__PURE__ */ e("span", { children: "Block" })
834
832
  ]
835
833
  }
836
834
  ) }),
837
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ee, { variant: "danger", onClick: R, children: [
835
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(K, { variant: "danger", onClick: p, children: [
838
836
  /* @__PURE__ */ e(Je, { className: "h-5 w-5" }),
839
837
  /* @__PURE__ */ e("span", { children: "Report" })
840
838
  ] }) })
@@ -851,27 +849,33 @@ const ns = (t) => ({
851
849
  onLeaveConversation: r,
852
850
  onBlockParticipant: a
853
851
  }) => {
854
- const { channel: o } = ge(), [l, c] = v(!1), m = L.useMemo(() => Object.values(o.state.members || {}).find(
855
- (h) => {
856
- var f;
857
- return ((f = h.user) == null ? void 0 : f.id) && h.user.id !== o._client.userID;
852
+ const { channel: o } = fe(), l = $(null), c = L.useMemo(() => Object.values(o.state.members || {}).find(
853
+ (f) => {
854
+ var g;
855
+ return ((g = f.user) == null ? void 0 : g.id) && f.user.id !== o._client.userID;
858
856
  }
859
- ), [o._client.userID, o.state.members]), g = L.useMemo(() => {
860
- const y = o.data ?? {};
861
- if (y.followerStatus)
862
- return String(y.followerStatus);
863
- if (y.isFollower !== void 0)
864
- return y.isFollower ? "Subscribed to you" : "Not subscribed";
865
- }, [o.data]);
866
- return /* @__PURE__ */ i(fe, { children: [
857
+ ), [o._client.userID, o.state.members]), h = L.useMemo(() => {
858
+ const d = o.data ?? {};
859
+ if (d.followerStatus)
860
+ return String(d.followerStatus);
861
+ if (d.isFollower !== void 0)
862
+ return d.isFollower ? "Subscribed to you" : "Not subscribed";
863
+ }, [o.data]), b = D(() => {
864
+ var d;
865
+ (d = l.current) == null || d.showModal();
866
+ }, []), k = D(() => {
867
+ var d;
868
+ (d = l.current) == null || d.close();
869
+ }, []);
870
+ return /* @__PURE__ */ i(he, { children: [
867
871
  /* @__PURE__ */ i(We, { children: [
868
872
  /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
869
873
  ds,
870
874
  {
871
875
  onBack: t,
872
876
  showBackButton: s,
873
- onShowInfo: () => c(!0),
874
- canShowInfo: !!m
877
+ onShowInfo: b,
878
+ canShowInfo: !!c
875
879
  }
876
880
  ) }),
877
881
  /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
@@ -892,17 +896,17 @@ const ns = (t) => ({
892
896
  /* @__PURE__ */ e(
893
897
  us,
894
898
  {
895
- isOpen: l,
896
- onClose: () => c(!1),
897
- participant: m,
899
+ dialogRef: l,
900
+ onClose: k,
901
+ participant: c,
898
902
  channel: o,
899
- followerStatusLabel: g,
903
+ followerStatusLabel: h,
900
904
  onLeaveConversation: r,
901
905
  onBlockParticipant: a
902
906
  }
903
907
  )
904
908
  ] });
905
- }, we = L.memo(
909
+ }, ve = L.memo(
906
910
  ({
907
911
  channel: t,
908
912
  onBack: s,
@@ -915,7 +919,7 @@ const ns = (t) => ({
915
919
  }) => /* @__PURE__ */ e(
916
920
  "div",
917
921
  {
918
- className: p(
922
+ className: R(
919
923
  "messaging-channel-view h-full flex flex-col",
920
924
  l
921
925
  ),
@@ -941,7 +945,7 @@ const ns = (t) => ({
941
945
  }
942
946
  )
943
947
  );
944
- we.displayName = "ChannelView";
948
+ ve.displayName = "ChannelView";
945
949
  function hs({
946
950
  searchQuery: t,
947
951
  setSearchQuery: s,
@@ -968,7 +972,7 @@ function hs({
968
972
  }
969
973
  ),
970
974
  t && /* @__PURE__ */ e(
971
- be,
975
+ Ne,
972
976
  {
973
977
  label: "Clear search",
974
978
  onClick: () => {
@@ -976,7 +980,7 @@ function hs({
976
980
  s(""), (a = r.current) == null || a.focus();
977
981
  },
978
982
  className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
979
- children: /* @__PURE__ */ e(ae, { className: "h-4 w-4", weight: "bold" })
983
+ children: /* @__PURE__ */ e(le, { className: "h-4 w-4", weight: "bold" })
980
984
  }
981
985
  )
982
986
  ] });
@@ -990,10 +994,10 @@ const fs = ({
990
994
  searchPlaceholder: o = "Search participants...",
991
995
  className: l
992
996
  }) => {
993
- const { debug: c } = ne(), [m, g] = v(""), [y, h] = v([]), [f, S] = v(!1), [b, w] = v(null), [E, N] = v(
997
+ const { debug: c } = te(), [h, b] = v(""), [k, d] = v([]), [f, g] = v(!1), [w, y] = v(null), [E, N] = v(
994
998
  null
995
999
  ), I = $(!1);
996
- G(() => {
1000
+ V(() => {
997
1001
  if (t.loading) {
998
1002
  c && console.log(
999
1003
  "[ParticipantPicker] Waiting for participant source to finish loading..."
@@ -1002,115 +1006,115 @@ const fs = ({
1002
1006
  }
1003
1007
  if (I.current) return;
1004
1008
  (async () => {
1005
- c && console.log("[ParticipantPicker] Loading initial participants..."), S(!0), w(null);
1009
+ c && console.log("[ParticipantPicker] Loading initial participants..."), g(!0), y(null);
1006
1010
  try {
1007
- const u = await t.loadParticipants({
1011
+ const m = await t.loadParticipants({
1008
1012
  search: "",
1009
1013
  // Load all participants initially
1010
1014
  limit: 100
1011
1015
  });
1012
- h(u.participants), I.current = !0, c && console.log(
1016
+ d(m.participants), I.current = !0, c && console.log(
1013
1017
  "[ParticipantPicker] Participants loaded successfully:",
1014
- u.participants.length
1018
+ m.participants.length
1015
1019
  );
1016
- } catch (u) {
1017
- const x = u instanceof Error ? u.message : "Failed to load participants";
1018
- w(x), console.error("[ParticipantPicker] Failed to load participants:", u);
1020
+ } catch (m) {
1021
+ const x = m instanceof Error ? m.message : "Failed to load participants";
1022
+ y(x), console.error("[ParticipantPicker] Failed to load participants:", m);
1019
1023
  } finally {
1020
- S(!1);
1024
+ g(!1);
1021
1025
  }
1022
1026
  })();
1023
1027
  }, [t.loading, c]);
1024
- const k = y.filter((d) => !r.has(d.id)).filter((d) => {
1028
+ const p = k.filter((u) => !r.has(u.id)).filter((u) => {
1025
1029
  var x;
1026
- if (!m) return !0;
1027
- const u = m.toLowerCase();
1028
- return d.name.toLowerCase().includes(u) || ((x = d.email) == null ? void 0 : x.toLowerCase().includes(u)) || !1;
1029
- }), R = M(
1030
- async (d) => {
1030
+ if (!h) return !0;
1031
+ const m = h.toLowerCase();
1032
+ return u.name.toLowerCase().includes(m) || ((x = u.email) == null ? void 0 : x.toLowerCase().includes(m)) || !1;
1033
+ }), S = D(
1034
+ async (u) => {
1031
1035
  if (!E) {
1032
- N(d.id);
1036
+ N(u.id);
1033
1037
  try {
1034
- await s(d);
1035
- } catch (u) {
1036
- console.error("[ParticipantPicker] Failed to start chat:", u), N(null);
1038
+ await s(u);
1039
+ } catch (m) {
1040
+ console.error("[ParticipantPicker] Failed to start chat:", m), N(null);
1037
1041
  }
1038
1042
  }
1039
1043
  },
1040
1044
  [s, E]
1041
- ), F = (d, u) => {
1042
- (d.key === "Enter" || d.key === " ") && (d.preventDefault(), R(u));
1045
+ ), P = (u, m) => {
1046
+ (u.key === "Enter" || u.key === " ") && (u.preventDefault(), S(m));
1043
1047
  };
1044
- return /* @__PURE__ */ i("div", { className: p("flex flex-col h-full", l), children: [
1048
+ return /* @__PURE__ */ i("div", { className: R("flex flex-col h-full", l), children: [
1045
1049
  /* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
1046
1050
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
1047
1051
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
1048
- /* @__PURE__ */ e(ve, { onClick: n })
1052
+ /* @__PURE__ */ e(be, { onClick: n })
1049
1053
  ] }),
1050
1054
  /* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
1051
1055
  "Select a ",
1052
1056
  a.slice(0, -1),
1053
1057
  " to start messaging (",
1054
- k.length,
1058
+ p.length,
1055
1059
  " available)",
1056
1060
  t.totalCount !== void 0 && ` โ€ข ${t.totalCount} ${a} total`
1057
1061
  ] }),
1058
1062
  /* @__PURE__ */ e(
1059
1063
  hs,
1060
1064
  {
1061
- searchQuery: m,
1062
- setSearchQuery: g,
1065
+ searchQuery: h,
1066
+ setSearchQuery: b,
1063
1067
  placeholder: o
1064
1068
  }
1065
1069
  )
1066
1070
  ] }),
1067
- b && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1071
+ w && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1068
1072
  "Error loading ",
1069
1073
  a,
1070
1074
  ": ",
1071
- b
1075
+ w
1072
1076
  ] }),
1073
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: f && k.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: [
1077
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: f && p.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: [
1074
1078
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1075
1079
  /* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
1076
1080
  "Loading ",
1077
1081
  a,
1078
1082
  "..."
1079
1083
  ] })
1080
- ] }) }) : k.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
1081
- /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(ue, { className: "h-8 w-8 text-charcoal" }) }),
1082
- /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: m ? `No ${a} found` : y.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
1083
- /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: m ? "Try a different search term" : y.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
1084
+ ] }) }) : p.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
1085
+ /* @__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" }) }),
1086
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: h ? `No ${a} found` : k.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
1087
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: h ? "Try a different search term" : k.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
1084
1088
  ] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
1085
- k.map((d) => {
1086
- const u = d.name || d.email || d.id, x = d.email && d.name ? d.email : d.phone;
1089
+ p.map((u) => {
1090
+ const m = u.name || u.email || u.id, x = u.email && u.name ? u.email : u.phone;
1087
1091
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
1088
1092
  "button",
1089
1093
  {
1090
1094
  type: "button",
1091
- onClick: () => R(d),
1092
- onKeyDown: (A) => F(A, d),
1095
+ onClick: () => S(u),
1096
+ onKeyDown: (G) => P(G, u),
1093
1097
  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",
1094
1098
  children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
1095
1099
  /* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1096
1100
  /* @__PURE__ */ e(
1097
- q,
1101
+ Y,
1098
1102
  {
1099
- id: d.id,
1100
- name: u,
1101
- image: d.image,
1103
+ id: u.id,
1104
+ name: m,
1105
+ image: u.image,
1102
1106
  size: 40
1103
1107
  }
1104
1108
  ),
1105
1109
  /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
1106
- /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: u }),
1110
+ /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: m }),
1107
1111
  x && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: x })
1108
1112
  ] })
1109
1113
  ] }),
1110
- /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: E === d.id ? /* @__PURE__ */ e(se, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(ue, { className: "h-5 w-5 text-stone" }) })
1114
+ /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: E === u.id ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(de, { className: "h-5 w-5 text-stone" }) })
1111
1115
  ] })
1112
1116
  }
1113
- ) }, d.id);
1117
+ ) }, u.id);
1114
1118
  }),
1115
1119
  f && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1116
1120
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
@@ -1252,7 +1256,7 @@ const fs = ({
1252
1256
  ] })
1253
1257
  ]
1254
1258
  }
1255
- ), ye = L.memo(
1259
+ ), we = L.memo(
1256
1260
  ({ hasChannels: t }) => /* @__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: [
1257
1261
  /* @__PURE__ */ e(gs, {}),
1258
1262
  !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
@@ -1261,8 +1265,8 @@ const fs = ({
1261
1265
  ] })
1262
1266
  ] }) })
1263
1267
  );
1264
- ye.displayName = "EmptyState";
1265
- const te = L.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: [
1268
+ we.displayName = "EmptyState";
1269
+ const se = L.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: [
1266
1270
  /* @__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: "โš ๏ธ" }) }),
1267
1271
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
1268
1272
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
@@ -1276,11 +1280,11 @@ const te = L.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
1276
1280
  }
1277
1281
  )
1278
1282
  ] }) }));
1279
- te.displayName = "ErrorState";
1283
+ se.displayName = "ErrorState";
1280
1284
  const xs = ({ className: t, message: s }) => /* @__PURE__ */ i(
1281
1285
  "div",
1282
1286
  {
1283
- className: p("flex items-center justify-center h-full", t),
1287
+ className: R("flex items-center justify-center h-full", t),
1284
1288
  children: [
1285
1289
  /* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
1286
1290
  /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
@@ -1320,12 +1324,12 @@ const xs = ({ className: t, message: s }) => /* @__PURE__ */ i(
1320
1324
  s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
1321
1325
  ]
1322
1326
  }
1323
- ), Ee = L.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
1327
+ ), ye = L.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
1324
1328
  /* @__PURE__ */ e(xs, { className: "w-6 h-6" }),
1325
1329
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
1326
1330
  ] }) }));
1327
- Ee.displayName = "LoadingState";
1328
- const Ss = ({
1331
+ ye.displayName = "LoadingState";
1332
+ const ks = ({
1329
1333
  capabilities: t = {},
1330
1334
  className: s,
1331
1335
  renderMessageInputActions: n,
@@ -1334,19 +1338,19 @@ const Ss = ({
1334
1338
  initialParticipantFilter: o,
1335
1339
  initialParticipantData: l,
1336
1340
  CustomChannelEmptyState: c,
1337
- showChannelList: m = !0,
1338
- filters: g,
1339
- channelListCustomEmptyStateIndicator: y
1341
+ showChannelList: h = !0,
1342
+ filters: b,
1343
+ channelListCustomEmptyStateIndicator: k
1340
1344
  }) => {
1341
1345
  const {
1342
- service: h,
1346
+ service: d,
1343
1347
  client: f,
1344
- isConnected: S,
1345
- isLoading: b,
1346
- error: w,
1348
+ isConnected: g,
1349
+ isLoading: w,
1350
+ error: y,
1347
1351
  refreshConnection: E,
1348
1352
  debug: N
1349
- } = Xe(), [I, k] = v(null), [R, F] = v(!1), [d, u] = v(!1), [x, A] = v(/* @__PURE__ */ new Set()), [z, Z] = v(0), [B, V] = v(!1), [Y, H] = v(null), W = $(null), { participantSource: J, participantLabel: _ = "participants" } = t, P = L.useMemo(() => {
1353
+ } = Xe(), [I, p] = v(null), [S, P] = v(!1), [u, m] = v(!1), [x, G] = v(/* @__PURE__ */ new Set()), [j, q] = v(0), [O, W] = v(!1), [J, H] = v(null), Z = $(null), { participantSource: M, participantLabel: F = "participants" } = t, A = L.useMemo(() => {
1350
1354
  const C = f == null ? void 0 : f.userID;
1351
1355
  return {
1352
1356
  ...{
@@ -1357,77 +1361,77 @@ const Ss = ({
1357
1361
  hidden: !1
1358
1362
  }
1359
1363
  },
1360
- ...g
1364
+ ...b
1361
1365
  };
1362
- }, [g, f == null ? void 0 : f.userID]), U = $(null), O = M(async () => {
1363
- if (!f || !S) return;
1366
+ }, [b, f == null ? void 0 : f.userID]), B = $(null), z = D(async () => {
1367
+ if (!f || !g) return;
1364
1368
  const C = f.userID;
1365
1369
  if (C)
1366
1370
  try {
1367
1371
  N && console.log("[MessagingShell] Syncing channels for user:", C);
1368
- const j = await f.queryChannels(
1372
+ const U = await f.queryChannels(
1369
1373
  {
1370
1374
  type: "messaging",
1371
1375
  members: { $in: [C] }
1372
1376
  },
1373
1377
  {},
1374
1378
  { limit: 100 }
1375
- ), D = /* @__PURE__ */ new Set();
1376
- j.forEach((T) => {
1377
- const re = T.state.members;
1378
- Object.values(re).forEach((_e) => {
1379
- var oe;
1380
- const le = (oe = _e.user) == null ? void 0 : oe.id;
1381
- le && le !== C && D.add(le);
1379
+ ), _ = /* @__PURE__ */ new Set();
1380
+ U.forEach((T) => {
1381
+ const ne = T.state.members;
1382
+ Object.values(ne).forEach((De) => {
1383
+ var ae;
1384
+ const re = (ae = De.user) == null ? void 0 : ae.id;
1385
+ re && re !== C && _.add(re);
1382
1386
  });
1383
- }), A((T) => T.size === D.size && [...T].every((re) => D.has(re)) ? T : D), F(j.length > 0), U.current = C, N && console.log("[MessagingShell] Channels synced successfully:", {
1384
- channelCount: j.length,
1385
- memberCount: D.size
1387
+ }), G((T) => T.size === _.size && [...T].every((ne) => _.has(ne)) ? T : _), P(U.length > 0), B.current = C, N && console.log("[MessagingShell] Channels synced successfully:", {
1388
+ channelCount: U.length,
1389
+ memberCount: _.size
1386
1390
  });
1387
- } catch (j) {
1388
- console.error("[MessagingShell] Failed to sync channels:", j);
1391
+ } catch (U) {
1392
+ console.error("[MessagingShell] Failed to sync channels:", U);
1389
1393
  }
1390
- }, [f, S, N]);
1391
- G(() => {
1392
- if (!f || !S) return;
1394
+ }, [f, g, N]);
1395
+ V(() => {
1396
+ if (!f || !g) return;
1393
1397
  const C = f.userID;
1394
- C && U.current !== C && O();
1395
- }, [f, S, O]), G(() => {
1396
- if (!o || !f || !S) return;
1398
+ C && B.current !== C && z();
1399
+ }, [f, g, z]), V(() => {
1400
+ if (!o || !f || !g) return;
1397
1401
  (async () => {
1398
- const j = f.userID;
1399
- if (j)
1402
+ const U = f.userID;
1403
+ if (U)
1400
1404
  try {
1401
1405
  N && console.log(
1402
1406
  "[MessagingShell] Loading initial conversation with:",
1403
1407
  o
1404
1408
  );
1405
- const D = await f.queryChannels(
1409
+ const _ = await f.queryChannels(
1406
1410
  {
1407
1411
  type: "messaging",
1408
- members: { $eq: [j, o] }
1412
+ members: { $eq: [U, o] }
1409
1413
  },
1410
1414
  {},
1411
1415
  { limit: 1 }
1412
1416
  );
1413
- if (D.length > 0)
1414
- k(D[0]), V(!0), H(null), r && r(D[0]), N && console.log(
1417
+ if (_.length > 0)
1418
+ p(_[0]), W(!0), H(null), r && r(_[0]), N && console.log(
1415
1419
  "[MessagingShell] Initial conversation loaded:",
1416
- D[0].id
1420
+ _[0].id
1417
1421
  );
1418
- else if (l && h) {
1422
+ else if (l && d) {
1419
1423
  N && console.log(
1420
1424
  "[MessagingShell] No conversation found, creating one for:",
1421
1425
  l
1422
1426
  );
1423
1427
  try {
1424
- const T = await h.startChannelWithParticipant({
1428
+ const T = await d.startChannelWithParticipant({
1425
1429
  id: l.id,
1426
1430
  name: l.name,
1427
1431
  email: l.email,
1428
1432
  phone: l.phone
1429
1433
  });
1430
- k(T), V(!0), H(null), r && r(T), N && console.log(
1434
+ p(T), W(!0), H(null), r && r(T), N && console.log(
1431
1435
  "[MessagingShell] Channel created and loaded:",
1432
1436
  T.id
1433
1437
  );
@@ -1444,10 +1448,10 @@ const Ss = ({
1444
1448
  "[MessagingShell] No conversation found for:",
1445
1449
  o
1446
1450
  );
1447
- } catch (D) {
1451
+ } catch (_) {
1448
1452
  console.error(
1449
1453
  "[MessagingShell] Failed to load initial conversation:",
1450
- D
1454
+ _
1451
1455
  ), H("Failed to load conversation");
1452
1456
  }
1453
1457
  })();
@@ -1455,73 +1459,73 @@ const Ss = ({
1455
1459
  o,
1456
1460
  l,
1457
1461
  f,
1458
- S,
1459
- h,
1462
+ g,
1463
+ d,
1460
1464
  N,
1461
1465
  r
1462
1466
  ]);
1463
- const Q = M(
1467
+ const Ee = D(
1464
1468
  (C) => {
1465
- k(C), r == null || r(C);
1469
+ p(C), r == null || r(C);
1466
1470
  },
1467
1471
  [r]
1468
- ), Ie = M(() => {
1469
- B || k(null);
1470
- }, [B]), ke = M(
1472
+ ), Ie = D(() => {
1473
+ O || p(null);
1474
+ }, [O]), pe = D(
1471
1475
  async (C) => {
1472
- var j;
1473
- if (h)
1476
+ var U;
1477
+ if (d)
1474
1478
  try {
1475
1479
  N && console.log(
1476
1480
  "[MessagingShell] Starting conversation with:",
1477
1481
  C.id
1478
1482
  );
1479
- const D = await h.startChannelWithParticipant({
1483
+ const _ = await d.startChannelWithParticipant({
1480
1484
  id: C.id,
1481
1485
  name: C.name,
1482
1486
  email: C.email,
1483
1487
  phone: C.phone
1484
1488
  });
1485
1489
  try {
1486
- await D.show();
1490
+ await _.show();
1487
1491
  } catch (T) {
1488
1492
  console.warn("[MessagingShell] Failed to unhide channel:", T);
1489
1493
  }
1490
- k(D), u(!1), (j = W.current) == null || j.close(), a == null || a(C);
1491
- } catch (D) {
1492
- console.error("[MessagingShell] Failed to start conversation:", D);
1494
+ p(_), m(!1), (U = Z.current) == null || U.close(), a == null || a(C);
1495
+ } catch (_) {
1496
+ console.error("[MessagingShell] Failed to start conversation:", _);
1493
1497
  }
1494
1498
  },
1495
- [h, a, N]
1496
- ), X = M(() => {
1499
+ [d, a, N]
1500
+ ), Q = D(() => {
1497
1501
  var C;
1498
- u(!1), (C = W.current) == null || C.close();
1499
- }, []), Se = M(
1502
+ m(!1), (C = Z.current) == null || C.close();
1503
+ }, []), ke = D(
1500
1504
  (C) => {
1501
- C.target === W.current && X();
1505
+ C.target === Z.current && Q();
1502
1506
  },
1503
- [X]
1504
- ), pe = M(
1507
+ [Q]
1508
+ ), Se = D(
1505
1509
  async (C) => {
1506
- N && console.log("[MessagingShell] Leaving conversation:", C.id), k(null), V(!1), U.current = null, await O();
1510
+ N && console.log("[MessagingShell] Leaving conversation:", C.id), p(null), W(!1), B.current = null, await z();
1507
1511
  },
1508
- [O, N]
1509
- ), Re = M(
1512
+ [z, N]
1513
+ ), Re = D(
1510
1514
  async (C) => {
1511
- N && console.log("[MessagingShell] Blocking participant:", C), k(null), V(!1), U.current = null, await O();
1515
+ N && console.log("[MessagingShell] Blocking participant:", C), p(null), W(!1), B.current = null, await z();
1512
1516
  },
1513
- [O, N]
1514
- ), K = !!I;
1515
- return b ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(Ee, {}) }) : w ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(te, { message: w, onBack: E }) }) : !S || !f ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(
1516
- te,
1517
+ [z, N]
1518
+ ), X = !!I;
1519
+ return w ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(ye, {}) }) : y ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(se, { message: y, onBack: E }) }) : !g || !f ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(
1520
+ se,
1517
1521
  {
1518
1522
  message: "Not connected to messaging service",
1519
1523
  onBack: E
1520
1524
  }
1521
- ) }) : Y ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(te, { message: Y }) }) : /* @__PURE__ */ i(
1525
+ ) }) : J ? /* @__PURE__ */ e("div", { className: R("h-full", s), children: /* @__PURE__ */ e(se, { message: J }) }) : /* @__PURE__ */ i(
1522
1526
  "div",
1523
1527
  {
1524
- className: p(
1528
+ className: R(
1525
1529
  "messaging-shell h-full bg-background-secondary overflow-hidden",
1526
1530
  s
1527
1531
  ),
@@ -1530,24 +1534,24 @@ const Ss = ({
1530
1534
  /* @__PURE__ */ e(
1531
1535
  "div",
1532
1536
  {
1533
- className: p(
1537
+ className: R(
1534
1538
  "messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
1535
1539
  {
1536
1540
  // Explicitly hidden via prop or in direct conversation mode
1537
- "!hidden": m === !1 || B,
1541
+ "!hidden": h === !1 || O,
1538
1542
  // Normal mode: hide on mobile when channel selected, show on desktop
1539
- "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": m !== !1 && !B && K,
1543
+ "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !O && X,
1540
1544
  // Normal mode: show when no channel selected
1541
- "flex flex-col w-full lg:flex-1 lg:max-w-2xl": m !== !1 && !B && !K
1545
+ "flex flex-col w-full lg:flex-1 lg:max-w-2xl": h !== !1 && !O && !X
1542
1546
  }
1543
1547
  ),
1544
1548
  children: /* @__PURE__ */ e(
1545
- Ne,
1549
+ Ce,
1546
1550
  {
1547
- onChannelSelect: Q,
1551
+ onChannelSelect: Ee,
1548
1552
  selectedChannel: I || void 0,
1549
- filters: P,
1550
- customEmptyStateIndicator: y
1553
+ filters: A,
1554
+ customEmptyStateIndicator: k
1551
1555
  }
1552
1556
  )
1553
1557
  }
@@ -1555,50 +1559,50 @@ const Ss = ({
1555
1559
  /* @__PURE__ */ e(
1556
1560
  "div",
1557
1561
  {
1558
- className: p(
1562
+ className: R(
1559
1563
  "messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
1560
1564
  {
1561
1565
  // In direct conversation mode, always show (full width)
1562
- flex: B || K,
1566
+ flex: O || X,
1563
1567
  // Normal mode: hide on mobile when no channel selected
1564
- "hidden lg:flex": !B && !K
1568
+ "hidden lg:flex": !O && !X
1565
1569
  }
1566
1570
  ),
1567
1571
  children: I ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1568
- we,
1572
+ ve,
1569
1573
  {
1570
1574
  channel: I,
1571
1575
  onBack: Ie,
1572
- showBackButton: !B,
1576
+ showBackButton: !O,
1573
1577
  renderMessageInputActions: n,
1574
- onLeaveConversation: pe,
1578
+ onLeaveConversation: Se,
1575
1579
  onBlockParticipant: Re,
1576
1580
  CustomChannelEmptyState: c
1577
1581
  },
1578
1582
  I.id
1579
- ) }) : /* @__PURE__ */ e(ye, { hasChannels: R })
1583
+ ) }) : /* @__PURE__ */ e(we, { hasChannels: S })
1580
1584
  }
1581
1585
  )
1582
1586
  ] }),
1583
- J && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
1587
+ M && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
1584
1588
  /* @__PURE__ */ e(
1585
1589
  "dialog",
1586
1590
  {
1587
- ref: W,
1591
+ ref: Z,
1588
1592
  className: "mes-dialog",
1589
- onClick: Se,
1590
- onClose: X,
1593
+ onClick: ke,
1594
+ onClose: Q,
1591
1595
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
1592
1596
  fs,
1593
1597
  {
1594
- participantSource: J,
1595
- onSelectParticipant: ke,
1596
- onClose: X,
1598
+ participantSource: M,
1599
+ onSelectParticipant: pe,
1600
+ onClose: Q,
1597
1601
  existingParticipantIds: x,
1598
- participantLabel: _,
1599
- searchPlaceholder: `Search ${_}...`
1602
+ participantLabel: F,
1603
+ searchPlaceholder: `Search ${F}...`
1600
1604
  },
1601
- z
1605
+ j
1602
1606
  ) })
1603
1607
  }
1604
1608
  )
@@ -1617,7 +1621,7 @@ const Ss = ({
1617
1621
  onClick: s,
1618
1622
  disabled: n,
1619
1623
  style: { backgroundColor: "#E6E5E3" },
1620
- className: p(
1624
+ className: R(
1621
1625
  "w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
1622
1626
  {
1623
1627
  "hover:brightness-95 active:brightness-90": !n,
@@ -1627,7 +1631,7 @@ const Ss = ({
1627
1631
  ),
1628
1632
  children: t
1629
1633
  }
1630
- ), ps = ({
1634
+ ), Ss = ({
1631
1635
  faqs: t,
1632
1636
  onFaqClick: s,
1633
1637
  loadingFaqId: n,
@@ -1636,10 +1640,10 @@ const Ss = ({
1636
1640
  avatarImage: o,
1637
1641
  avatarName: l
1638
1642
  }) => {
1639
- const c = t.filter((m) => m.enabled).sort((m, g) => (m.order ?? 0) - (g.order ?? 0));
1643
+ const c = t.filter((h) => h.enabled).sort((h, b) => (h.order ?? 0) - (b.order ?? 0));
1640
1644
  return c.length === 0 ? null : /* @__PURE__ */ e("div", { className: a, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
1641
1645
  (o || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1642
- q,
1646
+ Y,
1643
1647
  {
1644
1648
  id: l || "account",
1645
1649
  name: l || "Account",
@@ -1655,69 +1659,69 @@ const Ss = ({
1655
1659
  style: { backgroundColor: "#F1F0EE" },
1656
1660
  children: [
1657
1661
  r && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: r }),
1658
- c.map((m) => /* @__PURE__ */ e(
1662
+ c.map((h) => /* @__PURE__ */ e(
1659
1663
  Cs,
1660
1664
  {
1661
- question: m.question,
1662
- onClick: () => s(m.id),
1663
- loading: n === m.id
1665
+ question: h.question,
1666
+ onClick: () => s(h.id),
1667
+ loading: n === h.id
1664
1668
  },
1665
- m.id
1669
+ h.id
1666
1670
  ))
1667
1671
  ]
1668
1672
  }
1669
1673
  )
1670
1674
  ] }) });
1671
1675
  }, Rs = (t, s = {}) => {
1672
- const { initialSearch: n = "", pageSize: r = 20 } = s, [a, o] = v([]), [l, c] = v(!1), [m, g] = v(null), [y, h] = v(n), [f, S] = v(!0), [b, w] = v(), E = M(async (R = !1, F) => {
1676
+ const { initialSearch: n = "", pageSize: r = 20 } = s, [a, o] = v([]), [l, c] = v(!1), [h, b] = v(null), [k, d] = v(n), [f, g] = v(!0), [w, y] = v(), E = D(async (S = !1, P) => {
1673
1677
  if (l) return;
1674
- const d = F !== void 0 ? F : y;
1675
- c(!0), g(null);
1678
+ const u = P !== void 0 ? P : k;
1679
+ c(!0), b(null);
1676
1680
  try {
1677
- const u = await t.loadParticipants({
1678
- search: d || void 0,
1681
+ const m = await t.loadParticipants({
1682
+ search: u || void 0,
1679
1683
  limit: r,
1680
- cursor: R ? void 0 : b
1684
+ cursor: S ? void 0 : w
1681
1685
  });
1682
1686
  o(
1683
- (x) => R ? u.participants : [...x, ...u.participants]
1684
- ), S(u.hasMore), w(u.nextCursor);
1685
- } catch (u) {
1686
- const x = u instanceof Error ? u.message : "Failed to load participants";
1687
- g(x), console.error("[useParticipants] Load error:", u);
1687
+ (x) => S ? m.participants : [...x, ...m.participants]
1688
+ ), g(m.hasMore), y(m.nextCursor);
1689
+ } catch (m) {
1690
+ const x = m instanceof Error ? m.message : "Failed to load participants";
1691
+ b(x), console.error("[useParticipants] Load error:", m);
1688
1692
  } finally {
1689
1693
  c(!1);
1690
1694
  }
1691
- }, [t, y, b, r, l]), N = M(() => {
1695
+ }, [t, k, w, r, l]), N = D(() => {
1692
1696
  f && !l && E(!1);
1693
- }, [f, l, E]), I = M((R) => {
1694
- h(R), w(void 0), E(!0, R);
1695
- }, [E]), k = M(() => {
1696
- w(void 0), E(!0);
1697
+ }, [f, l, E]), I = D((S) => {
1698
+ d(S), y(void 0), E(!0, S);
1699
+ }, [E]), p = D(() => {
1700
+ y(void 0), E(!0);
1697
1701
  }, [E]);
1698
- return G(() => {
1702
+ return V(() => {
1699
1703
  E(!0);
1700
1704
  }, [t.loadParticipants]), {
1701
1705
  participants: a,
1702
1706
  loading: l,
1703
- error: m,
1704
- searchQuery: y,
1707
+ error: h,
1708
+ searchQuery: k,
1705
1709
  hasMore: f,
1706
1710
  totalCount: t.totalCount,
1707
1711
  loadMore: N,
1708
1712
  search: I,
1709
- refresh: k
1713
+ refresh: p
1710
1714
  };
1711
1715
  };
1712
1716
  export {
1713
- q as Avatar,
1717
+ Y as Avatar,
1714
1718
  cs as ChannelEmptyState,
1715
- Ne as ChannelList,
1716
- we as ChannelView,
1717
- ps as FaqList,
1719
+ Ce as ChannelList,
1720
+ ve as ChannelView,
1721
+ Ss as FaqList,
1718
1722
  Cs as FaqListItem,
1719
- ks as MessagingProvider,
1720
- Ss as MessagingShell,
1723
+ ps as MessagingProvider,
1724
+ ks as MessagingShell,
1721
1725
  fs as ParticipantPicker,
1722
1726
  es as formatRelativeTime,
1723
1727
  Xe as useMessaging,