@linktr.ee/messaging-react 1.8.4 โ†’ 1.8.6-rc-1764053798

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