@linktr.ee/messaging-react 1.5.3 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { jsx as e, jsxs as c, Fragment as oe } from "react/jsx-runtime";
2
- import T from "classnames";
3
- import X, { createContext as Ce, useContext as ve, useCallback as O, useState as I, useRef as G, useEffect as $ } from "react";
4
- import { StreamChatService as we } from "@linktr.ee/messaging-core";
5
- import { Chat as Ie, useChatContext as Ee, ChannelList as ye, Channel as Se, useChannelStateContext as ue, Window as Re, MessageList as ke, MessageInput as Te } from "stream-chat-react";
6
- import { NotePencilIcon as Pe, XIcon as me, ArrowLeftIcon as De, DotsThreeIcon as Me, SpinnerGapIcon as K, SignOutIcon as Oe, ProhibitInsetIcon as ie, FlagIcon as Ue, MagnifyingGlassIcon as Le, ChatCircleDotsIcon as ce } from "@phosphor-icons/react";
7
- const he = Ce({
2
+ import D from "classnames";
3
+ import X, { createContext as ve, useContext as we, useCallback as U, useState as I, useRef as H, useEffect as G } from "react";
4
+ import { StreamChatService as Ee } from "@linktr.ee/messaging-core";
5
+ import { Chat as Ie, useChatContext as ye, ChannelList as Se, Channel as Re, useChannelStateContext as ue, Window as ke, MessageList as Te, MessageInput as Pe } from "stream-chat-react";
6
+ import { NotePencilIcon as De, XIcon as me, ArrowLeftIcon as Me, DotsThreeIcon as Oe, SpinnerGapIcon as ee, SignOutIcon as Ue, ProhibitInsetIcon as ie, FlagIcon as Fe, MagnifyingGlassIcon as pe, ChatCircleDotsIcon as ce } from "@phosphor-icons/react";
7
+ const he = ve({
8
8
  service: null,
9
9
  client: null,
10
10
  isConnected: !1,
@@ -15,109 +15,109 @@ const he = Ce({
15
15
  refreshConnection: async () => {
16
16
  },
17
17
  debug: !1
18
- }), ee = () => ve(he), ns = ({
18
+ }), se = () => we(he), ts = ({
19
19
  children: t,
20
20
  user: s,
21
21
  serviceConfig: n,
22
22
  apiKey: l,
23
- capabilities: i = {},
23
+ capabilities: a = {},
24
24
  customization: d = {},
25
- debug: a = !1
25
+ debug: i = !1
26
26
  }) => {
27
- const r = O(
28
- (C, ...y) => {
29
- a && console.log(`🔥 [MessagingProvider] ${C}`, ...y);
27
+ const r = U(
28
+ (v, ...M) => {
29
+ i && console.log(`🔥 [MessagingProvider] ${v}`, ...M);
30
30
  },
31
- [a]
31
+ [i]
32
32
  );
33
33
  r("🔄 RENDER START", {
34
34
  userId: s == null ? void 0 : s.id,
35
35
  apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
36
36
  serviceConfig: !!n,
37
- capabilities: Object.keys(i),
37
+ capabilities: Object.keys(a),
38
38
  customization: Object.keys(d)
39
39
  });
40
- const [o, x] = I(null), [m, E] = I(null), [h, w] = I(!1), [u, v] = I(!1), [N, D] = I(null), M = G(!1), R = G({
40
+ const [o, w] = I(null), [u, N] = I(null), [m, E] = I(!1), [x, h] = I(!1), [C, S] = I(null), O = H(!1), y = H({
41
41
  userId: s == null ? void 0 : s.id,
42
42
  apiKey: l,
43
43
  serviceConfig: n,
44
- capabilities: i,
44
+ capabilities: a,
45
45
  customization: d
46
- }), k = G(0);
46
+ }), k = H(0);
47
47
  k.current++, r("📊 RENDER INFO", {
48
48
  renderCount: k.current,
49
49
  currentProps: { userId: s == null ? void 0 : s.id, apiKey: (l == null ? void 0 : l.substring(0, 8)) + "..." },
50
50
  propChanges: {
51
- userChanged: R.current.userId !== (s == null ? void 0 : s.id),
52
- apiKeyChanged: R.current.apiKey !== l,
53
- serviceConfigChanged: R.current.serviceConfig !== n,
54
- capabilitiesChanged: R.current.capabilities !== i,
55
- customizationChanged: R.current.customization !== d
51
+ userChanged: y.current.userId !== (s == null ? void 0 : s.id),
52
+ apiKeyChanged: y.current.apiKey !== l,
53
+ serviceConfigChanged: y.current.serviceConfig !== n,
54
+ capabilitiesChanged: y.current.capabilities !== a,
55
+ customizationChanged: y.current.customization !== d
56
56
  }
57
- }), R.current = {
57
+ }), y.current = {
58
58
  userId: s == null ? void 0 : s.id,
59
59
  apiKey: l,
60
60
  serviceConfig: n,
61
- capabilities: i,
61
+ capabilities: a,
62
62
  customization: d
63
- }, $(() => {
64
- const C = k.current;
63
+ }, G(() => {
64
+ const v = k.current;
65
65
  if (r("🔧 SERVICE INIT EFFECT TRIGGERED", {
66
- renderCount: C,
66
+ renderCount: v,
67
67
  apiKey: !!l,
68
68
  serviceConfig: !!n,
69
69
  dependencies: {
70
70
  apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
71
71
  serviceConfigRef: n,
72
- serviceConfigStable: R.current.serviceConfig === n,
73
- apiKeyStable: R.current.apiKey === l
72
+ serviceConfigStable: y.current.serviceConfig === n,
73
+ apiKeyStable: y.current.apiKey === l
74
74
  }
75
75
  }), !l || !n) {
76
76
  r("⚠️ SERVICE INIT SKIPPED", {
77
- renderCount: C,
77
+ renderCount: v,
78
78
  reason: "Missing apiKey or serviceConfig"
79
79
  });
80
80
  return;
81
81
  }
82
82
  r("🚀 CREATING NEW SERVICE", {
83
- renderCount: C,
83
+ renderCount: v,
84
84
  apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
85
- serviceConfigChanged: R.current.serviceConfig !== n
85
+ serviceConfigChanged: y.current.serviceConfig !== n
86
86
  });
87
- const y = new we({
87
+ const M = new Ee({
88
88
  ...n,
89
89
  apiKey: l,
90
- debug: a
90
+ debug: i
91
91
  });
92
- return x(y), r("✅ SERVICE SET", {
93
- renderCount: C,
94
- serviceInstance: !!y
92
+ return w(M), r("✅ SERVICE SET", {
93
+ renderCount: v,
94
+ serviceInstance: !!M
95
95
  }), () => {
96
96
  r("🧹 SERVICE CLEANUP", {
97
- renderCount: C,
97
+ renderCount: v,
98
98
  reason: "Effect cleanup"
99
- }), y.disconnectUser().catch(console.error);
99
+ }), M.disconnectUser().catch(console.error);
100
100
  };
101
- }, [l, n, a, r]);
102
- const P = G(null);
103
- $(() => {
104
- var y, B;
101
+ }, [l, n, i, r]);
102
+ const T = H(null);
103
+ G(() => {
104
+ var M, p;
105
105
  if (r("🔗 USER CONNECTION EFFECT TRIGGERED", {
106
106
  hasService: !!o,
107
107
  hasUser: !!s,
108
108
  userId: s == null ? void 0 : s.id,
109
- isConnecting: M.current,
110
- isConnected: h,
109
+ isConnecting: O.current,
110
+ isConnected: m,
111
111
  dependencies: { service: !!o, userId: s == null ? void 0 : s.id }
112
112
  }), !o || !s) {
113
113
  r("⚠️ USER CONNECTION SKIPPED", "Missing service or user");
114
114
  return;
115
115
  }
116
- if (M.current) {
116
+ if (O.current) {
117
117
  r("⚠️ USER CONNECTION SKIPPED", "Already connecting");
118
118
  return;
119
119
  }
120
- if (((y = P.current) == null ? void 0 : y.serviceId) === o && ((B = P.current) == null ? void 0 : B.userId) === s.id) {
120
+ if (((M = T.current) == null ? void 0 : M.serviceId) === o && ((p = T.current) == null ? void 0 : p.userId) === s.id) {
121
121
  r(
122
122
  "⚠️ USER CONNECTION SKIPPED",
123
123
  "Already connected this user with this service"
@@ -125,40 +125,40 @@ const he = Ce({
125
125
  return;
126
126
  }
127
127
  (async () => {
128
- r("🚀 STARTING USER CONNECTION", { userId: s.id }), M.current = !0, v(!0), D(null);
128
+ r("🚀 STARTING USER CONNECTION", { userId: s.id }), O.current = !0, h(!0), S(null);
129
129
  try {
130
130
  r("📞 CALLING SERVICE.CONNECTUSER", { userId: s.id });
131
- const p = await o.connectUser(s);
132
- E(p), w(!0), P.current = { serviceId: o, userId: s.id }, r("✅ USER CONNECTION SUCCESS", {
131
+ const L = await o.connectUser(s);
132
+ N(L), E(!0), T.current = { serviceId: o, userId: s.id }, r("✅ USER CONNECTION SUCCESS", {
133
133
  userId: s.id,
134
- clientId: p.userID
134
+ clientId: L.userID
135
135
  });
136
- } catch (p) {
137
- const j = p instanceof Error ? p.message : "Connection failed";
138
- D(j), r("❌ USER CONNECTION ERROR", {
136
+ } catch (L) {
137
+ const $ = L instanceof Error ? L.message : "Connection failed";
138
+ S($), r("❌ USER CONNECTION ERROR", {
139
139
  userId: s.id,
140
- error: j
140
+ error: $
141
141
  });
142
142
  } finally {
143
- v(!1), M.current = !1, r("🔄 USER CONNECTION FINISHED", {
143
+ h(!1), O.current = !1, r("🔄 USER CONNECTION FINISHED", {
144
144
  userId: s.id,
145
- isConnected: h
145
+ isConnected: m
146
146
  });
147
147
  }
148
148
  })();
149
- }, [o, s, r, h]), $(() => (r("🔌 CLEANUP EFFECT REGISTERED", {
149
+ }, [o, s, r, m]), G(() => (r("🔌 CLEANUP EFFECT REGISTERED", {
150
150
  hasService: !!o,
151
- isConnected: h
151
+ isConnected: m
152
152
  }), () => {
153
- o && h ? (r(
153
+ o && m ? (r(
154
154
  "🧹 CLEANUP EFFECT TRIGGERED",
155
155
  "Cleaning up connection on unmount"
156
- ), P.current = null, o.disconnectUser().catch(console.error)) : r("🔇 CLEANUP EFFECT SKIPPED", {
156
+ ), T.current = null, o.disconnectUser().catch(console.error)) : r("🔇 CLEANUP EFFECT SKIPPED", {
157
157
  hasService: !!o,
158
- isConnected: h
158
+ isConnected: m
159
159
  });
160
- }), [o, h, r]);
161
- const f = O(async () => {
160
+ }), [o, m, r]);
161
+ const f = U(async () => {
162
162
  if (r("🔄 REFRESH CONNECTION CALLED", {
163
163
  hasService: !!o,
164
164
  hasUser: !!s
@@ -166,62 +166,62 @@ const he = Ce({
166
166
  r("⚠️ REFRESH CONNECTION SKIPPED", "Missing service or user");
167
167
  return;
168
168
  }
169
- r("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), v(!0);
169
+ r("🚀 STARTING CONNECTION REFRESH", { userId: s.id }), h(!0);
170
170
  try {
171
171
  r("🔌 DISCONNECTING FOR REFRESH"), await o.disconnectUser(), r("📞 RECONNECTING FOR REFRESH");
172
- const C = await o.connectUser(s);
173
- E(C), w(!0), D(null), r("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
174
- } catch (C) {
175
- const y = C instanceof Error ? C.message : "Refresh failed";
176
- D(y), r("❌ CONNECTION REFRESH ERROR", {
172
+ const v = await o.connectUser(s);
173
+ N(v), E(!0), S(null), r("✅ CONNECTION REFRESH SUCCESS", { userId: s.id });
174
+ } catch (v) {
175
+ const M = v instanceof Error ? v.message : "Refresh failed";
176
+ S(M), r("❌ CONNECTION REFRESH ERROR", {
177
177
  userId: s.id,
178
- error: y
178
+ error: M
179
179
  });
180
180
  } finally {
181
- v(!1), r("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
181
+ h(!1), r("🔄 CONNECTION REFRESH FINISHED", { userId: s.id });
182
182
  }
183
183
  }, [o, s, r]), g = X.useMemo(() => (r("💫 CONTEXT VALUE MEMOIZATION", {
184
184
  hasService: !!o,
185
- hasClient: !!m,
186
- isConnected: h,
187
- isLoading: u,
188
- hasError: !!N,
189
- capabilitiesKeys: Object.keys(i),
185
+ hasClient: !!u,
186
+ isConnected: m,
187
+ isLoading: x,
188
+ hasError: !!C,
189
+ capabilitiesKeys: Object.keys(a),
190
190
  customizationKeys: Object.keys(d)
191
191
  }), {
192
192
  service: o,
193
- client: m,
194
- isConnected: h,
195
- isLoading: u,
196
- error: N,
197
- capabilities: i,
193
+ client: u,
194
+ isConnected: m,
195
+ isLoading: x,
196
+ error: C,
197
+ capabilities: a,
198
198
  customization: d,
199
199
  refreshConnection: f,
200
- debug: a
200
+ debug: i
201
201
  }), [
202
202
  o,
203
- m,
204
- h,
205
203
  u,
206
- N,
207
- i,
204
+ m,
205
+ x,
206
+ C,
207
+ a,
208
208
  d,
209
209
  f,
210
- a,
210
+ i,
211
211
  r
212
212
  ]);
213
213
  return r("🔄 RENDER END", {
214
214
  renderCount: k.current,
215
- willRenderChat: !!(m && h),
215
+ willRenderChat: !!(u && m),
216
216
  contextValueReady: !!g
217
- }), /* @__PURE__ */ e(he.Provider, { value: g, children: m && h ? /* @__PURE__ */ e(Ie, { client: m, children: t }) : t });
218
- }, Fe = () => ee();
219
- function se({ label: t, className: s, children: n, ...l }) {
217
+ }), /* @__PURE__ */ e(he.Provider, { value: g, children: u && m ? /* @__PURE__ */ e(Ie, { client: u, children: t }) : t });
218
+ }, Le = () => se();
219
+ function ne({ label: t, className: s, children: n, ...l }) {
220
220
  return /* @__PURE__ */ c(
221
221
  "button",
222
222
  {
223
223
  type: "button",
224
- className: T(
224
+ className: D(
225
225
  "rounded-full p-2 transition-colors focus-ring",
226
226
  {
227
227
  "cursor-not-allowed opacity-50": l.disabled,
@@ -237,7 +237,7 @@ function se({ label: t, className: s, children: n, ...l }) {
237
237
  }
238
238
  );
239
239
  }
240
- function pe(t) {
240
+ function je(t) {
241
241
  const s = [
242
242
  { color: "#8129D9" },
243
243
  // purple
@@ -265,25 +265,25 @@ function pe(t) {
265
265
  // olive green
266
266
  ];
267
267
  let n = 0;
268
- for (let i = 0; i < t.length; i++)
269
- n = (n << 5) - n + t.charCodeAt(i), n = n & n;
268
+ for (let a = 0; a < t.length; a++)
269
+ n = (n << 5) - n + t.charCodeAt(a), n = n & n;
270
270
  const l = Math.abs(n) % s.length;
271
271
  return s[l];
272
272
  }
273
- const ne = ({
273
+ const Y = ({
274
274
  id: t,
275
275
  name: s,
276
276
  image: n,
277
277
  size: l = 40,
278
- className: i
278
+ className: a
279
279
  }) => {
280
- const { color: d } = pe(t), a = s.charAt(0).toUpperCase(), o = l < 32 ? "text-xs" : l < 56 ? "text-sm" : "text-lg";
280
+ const { color: d } = je(t), i = s.charAt(0).toUpperCase(), o = l < 32 ? "text-xs" : l < 56 ? "text-sm" : "text-lg";
281
281
  return /* @__PURE__ */ e(
282
282
  "div",
283
283
  {
284
- className: T(
284
+ className: D(
285
285
  "flex-shrink-0 overflow-hidden rounded-full",
286
- i
286
+ a
287
287
  ),
288
288
  style: { width: `${l}px`, height: `${l}px` },
289
289
  children: n ? /* @__PURE__ */ e(
@@ -297,7 +297,7 @@ const ne = ({
297
297
  "div",
298
298
  {
299
299
  "aria-hidden": "true",
300
- className: T(
300
+ className: D(
301
301
  "flex h-full w-full items-center justify-center font-semibold",
302
302
  o
303
303
  ),
@@ -305,49 +305,49 @@ const ne = ({
305
305
  color: d,
306
306
  backgroundColor: `color-mix(in srgb, ${d} 20%, transparent)`
307
307
  },
308
- children: a
308
+ children: i
309
309
  }
310
310
  )
311
311
  }
312
312
  );
313
- }, je = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: l = !1 }) => {
314
- var u, v, N, D, M, R, k;
315
- const i = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), d = () => {
313
+ }, Ae = ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: l = !1 }) => {
314
+ var x, h, C, S, O, y, k;
315
+ const a = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), d = () => {
316
316
  t && n(t);
317
- }, r = Object.values(((u = t == null ? void 0 : t.state) == null ? void 0 : u.members) || {}).find(
318
- (P) => {
317
+ }, r = Object.values(((x = t == null ? void 0 : t.state) == null ? void 0 : x.members) || {}).find(
318
+ (T) => {
319
319
  var f, g;
320
- return ((f = P.user) == null ? void 0 : f.id) && P.user.id !== ((g = t == null ? void 0 : t._client) == null ? void 0 : g.userID);
320
+ return ((f = T.user) == null ? void 0 : f.id) && T.user.id !== ((g = t == null ? void 0 : t._client) == null ? void 0 : g.userID);
321
321
  }
322
- ), o = ((v = r == null ? void 0 : r.user) == null ? void 0 : v.name) || "Conversation", x = (N = r == null ? void 0 : r.user) == null ? void 0 : N.image, m = (M = (D = t == null ? void 0 : t.state) == null ? void 0 : D.messages) == null ? void 0 : M[t.state.messages.length - 1], E = (m == null ? void 0 : m.text) || "No messages yet", h = m != null && m.created_at ? new Date(m.created_at).toLocaleTimeString([], {
322
+ ), o = ((h = r == null ? void 0 : r.user) == null ? void 0 : h.name) || "Conversation", w = (C = r == null ? void 0 : r.user) == null ? void 0 : C.image, u = (O = (S = t == null ? void 0 : t.state) == null ? void 0 : S.messages) == null ? void 0 : O[t.state.messages.length - 1], N = (u == null ? void 0 : u.text) || "No messages yet", m = u != null && u.created_at ? new Date(u.created_at).toLocaleTimeString([], {
323
323
  hour: "2-digit",
324
324
  minute: "2-digit"
325
- }) : "", w = ((R = t == null ? void 0 : t.state) == null ? void 0 : R.unreadCount) || 0;
325
+ }) : "", E = ((y = t == null ? void 0 : t.state) == null ? void 0 : y.unreadCount) || 0;
326
326
  return l && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
327
327
  channelId: t == null ? void 0 : t.id,
328
- isSelected: i,
328
+ isSelected: a,
329
329
  participantName: o,
330
- unread: w,
331
- hasTimestamp: !!h
330
+ unread: E,
331
+ hasTimestamp: !!m
332
332
  }), /* @__PURE__ */ e(
333
333
  "button",
334
334
  {
335
335
  type: "button",
336
336
  onClick: d,
337
- className: T(
337
+ className: D(
338
338
  "w-full px-4 py-3 transition-colors border-b border-sand text-left max-w-full overflow-hidden focus-ring",
339
339
  {
340
- "bg-primary-alt/10 border-l-4 border-l-primary": i,
341
- "hover:bg-sand": !i
340
+ "bg-primary-alt/10 border-l-4 border-l-primary": a,
341
+ "hover:bg-sand": !a
342
342
  }
343
343
  ),
344
344
  children: /* @__PURE__ */ c("div", { className: "flex items-start gap-3", children: [
345
345
  /* @__PURE__ */ e(
346
- ne,
346
+ Y,
347
347
  {
348
348
  id: ((k = r == null ? void 0 : r.user) == null ? void 0 : k.id) || t.id || "unknown",
349
349
  name: o,
350
- image: x,
350
+ image: w,
351
351
  size: 44
352
352
  }
353
353
  ),
@@ -356,18 +356,18 @@ const ne = ({
356
356
  /* @__PURE__ */ e(
357
357
  "h3",
358
358
  {
359
- className: T(
359
+ className: D(
360
360
  "text-sm font-medium truncate",
361
- i ? "text-primary" : "text-charcoal"
361
+ a ? "text-primary" : "text-charcoal"
362
362
  ),
363
363
  children: o
364
364
  }
365
365
  ),
366
- h && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: h })
366
+ m && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: m })
367
367
  ] }),
368
368
  /* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
369
- /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: E }),
370
- w > 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: w > 99 ? "99+" : w })
369
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: N }),
370
+ E > 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: E > 99 ? "99+" : E })
371
371
  ] })
372
372
  ] })
373
373
  ] })
@@ -378,38 +378,38 @@ const ne = ({
378
378
  selectedChannel: s,
379
379
  showStartConversation: n = !1,
380
380
  onStartConversation: l,
381
- participantLabel: i = "participants",
381
+ participantLabel: a = "participants",
382
382
  className: d
383
383
  }) => {
384
- var m;
385
- const a = X.useRef(0);
386
- a.current++;
387
- const { debug: r = !1 } = ee();
384
+ var u;
385
+ const i = X.useRef(0);
386
+ i.current++;
387
+ const { debug: r = !1 } = se();
388
388
  r && console.log("📺 [ChannelList] 🔄 RENDER START", {
389
- renderCount: a.current,
389
+ renderCount: i.current,
390
390
  selectedChannelId: s == null ? void 0 : s.id,
391
391
  showStartConversation: n,
392
- participantLabel: i
392
+ participantLabel: a
393
393
  });
394
- const { client: o } = Ee();
394
+ const { client: o } = ye();
395
395
  r && console.log("📺 [ChannelList] 📡 CHAT CONTEXT", {
396
- renderCount: a.current,
396
+ renderCount: i.current,
397
397
  hasClient: !!o,
398
398
  clientUserId: o == null ? void 0 : o.userID,
399
- clientConnected: (m = o == null ? void 0 : o.wsConnection) == null ? void 0 : m.isHealthy
399
+ clientConnected: (u = o == null ? void 0 : o.wsConnection) == null ? void 0 : u.isHealthy
400
400
  });
401
- const x = X.useMemo(() => {
402
- const E = o.userID, h = E ? { type: "messaging", members: { $in: [E] }, hidden: !1 } : { type: "messaging" };
401
+ const w = X.useMemo(() => {
402
+ const N = o.userID, m = N ? { type: "messaging", members: { $in: [N] }, hidden: !1 } : { type: "messaging" };
403
403
  return r && console.log("📺 [ChannelList] 🔍 FILTERS MEMOIZED", {
404
- renderCount: a.current,
405
- userId: E,
406
- filters: h
407
- }), h;
404
+ renderCount: i.current,
405
+ userId: N,
406
+ filters: m
407
+ }), m;
408
408
  }, [o.userID, r]);
409
409
  return /* @__PURE__ */ c(
410
410
  "div",
411
411
  {
412
- className: T(
412
+ className: D(
413
413
  "messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
414
414
  d
415
415
  ),
@@ -417,36 +417,36 @@ const ne = ({
417
417
  /* @__PURE__ */ e("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: /* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-3 min-h-10 min-w-0", children: [
418
418
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Conversations" }),
419
419
  /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: n && l && /* @__PURE__ */ e(
420
- se,
420
+ ne,
421
421
  {
422
422
  label: "Start a new conversation",
423
423
  onClick: l,
424
424
  className: "inline-flex size-10 items-center justify-center",
425
- children: /* @__PURE__ */ e(Pe, { className: "h-5 w-5" })
425
+ children: /* @__PURE__ */ e(De, { className: "h-5 w-5" })
426
426
  }
427
427
  ) })
428
428
  ] }) }),
429
429
  /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: (r && console.log("📺 [ChannelList] 🎬 RENDERING STREAM CHANNEL LIST", {
430
- renderCount: a.current,
431
- filters: x,
430
+ renderCount: i.current,
431
+ filters: w,
432
432
  hasClient: !!o,
433
433
  clientUserId: o == null ? void 0 : o.userID
434
434
  }), /* @__PURE__ */ e(
435
- ye,
435
+ Se,
436
436
  {
437
- filters: x,
437
+ filters: w,
438
438
  sort: { last_message_at: -1 },
439
439
  options: { limit: 30 },
440
- Preview: (E) => {
441
- var h, w;
440
+ Preview: (N) => {
441
+ var m, E;
442
442
  return r && console.log("📺 [ChannelList] 📋 CHANNEL PREVIEW RENDER", {
443
- channelId: (h = E.channel) == null ? void 0 : h.id,
443
+ channelId: (m = N.channel) == null ? void 0 : m.id,
444
444
  selectedChannelId: s == null ? void 0 : s.id,
445
- isSelected: (s == null ? void 0 : s.id) === ((w = E.channel) == null ? void 0 : w.id)
445
+ isSelected: (s == null ? void 0 : s.id) === ((E = N.channel) == null ? void 0 : E.id)
446
446
  }), /* @__PURE__ */ e(
447
- je,
447
+ Ae,
448
448
  {
449
- ...E,
449
+ ...N,
450
450
  selectedChannel: s,
451
451
  onChannelSelect: t,
452
452
  debug: r
@@ -458,7 +458,7 @@ const ne = ({
458
458
  ]
459
459
  }
460
460
  );
461
- }, J = ({
461
+ }, K = ({
462
462
  variant: t = "default",
463
463
  className: s,
464
464
  children: n,
@@ -467,7 +467,7 @@ const ne = ({
467
467
  "button",
468
468
  {
469
469
  type: "button",
470
- className: T(
470
+ className: D(
471
471
  "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",
472
472
  t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
473
473
  s
@@ -477,19 +477,19 @@ const ne = ({
477
477
  }
478
478
  );
479
479
  function fe({ onClick: t }) {
480
- return /* @__PURE__ */ e(se, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(me, { className: "h-5 w-5 text-stone", weight: "bold" }) });
480
+ return /* @__PURE__ */ e(ne, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(me, { className: "h-5 w-5 text-stone", weight: "bold" }) });
481
481
  }
482
- const Ae = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "message-input flex items-center gap-2 p-4", children: [
482
+ const He = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "message-input flex items-center gap-2 p-4", children: [
483
483
  t && t(),
484
- /* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(Te, { focus: !0, maxRows: 4 }) })
485
- ] }), He = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: l }) => {
486
- var o, x, m, E;
487
- const { channel: i } = ue(), d = X.useMemo(() => Object.values(i.state.members || {}).find(
488
- (w) => {
489
- var u;
490
- return ((u = w.user) == null ? void 0 : u.id) && w.user.id !== i._client.userID;
484
+ /* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(Pe, { focus: !0, maxRows: 4 }) })
485
+ ] }), Ge = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: l }) => {
486
+ var o, w, u, N;
487
+ const { channel: a } = ue(), d = X.useMemo(() => Object.values(a.state.members || {}).find(
488
+ (E) => {
489
+ var x;
490
+ return ((x = E.user) == null ? void 0 : x.id) && E.user.id !== a._client.userID;
491
491
  }
492
- ), [i._client.userID, i.state.members]), a = ((o = d == null ? void 0 : d.user) == null ? void 0 : o.name) || ((x = d == null ? void 0 : d.user) == null ? void 0 : x.id) || "Unknown member", r = (m = d == null ? void 0 : d.user) == null ? void 0 : m.image;
492
+ ), [a._client.userID, a.state.members]), i = ((o = d == null ? void 0 : d.user) == null ? void 0 : o.name) || ((w = d == null ? void 0 : d.user) == null ? void 0 : w.id) || "Unknown member", r = (u = d == null ? void 0 : d.user) == null ? void 0 : u.image;
493
493
  return /* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-3 min-h-12", children: [
494
494
  /* @__PURE__ */ c("div", { className: "flex items-center gap-3 min-w-0", children: [
495
495
  s && t && /* @__PURE__ */ e(
@@ -499,93 +499,93 @@ const Ae = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
499
499
  onClick: t,
500
500
  className: "inline-flex items-center justify-center w-8 h-8 rounded-lg hover:bg-sand focus:outline-none focus:ring-2 focus:ring-primary transition-colors lg:hidden",
501
501
  "aria-label": "Back to conversations",
502
- children: /* @__PURE__ */ e(De, { className: "h-5 w-5 text-stone", weight: "bold" })
502
+ children: /* @__PURE__ */ e(Me, { className: "h-5 w-5 text-stone", weight: "bold" })
503
503
  }
504
504
  ),
505
505
  /* @__PURE__ */ e(
506
- ne,
506
+ Y,
507
507
  {
508
- id: ((E = d == null ? void 0 : d.user) == null ? void 0 : E.id) || i.id || "unknown",
509
- name: a,
508
+ id: ((N = d == null ? void 0 : d.user) == null ? void 0 : N.id) || a.id || "unknown",
509
+ name: i,
510
510
  image: r,
511
511
  size: 40
512
512
  }
513
513
  ),
514
- /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-charcoal truncate", children: a }) })
514
+ /* @__PURE__ */ e("div", { className: "min-w-0", children: /* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-charcoal truncate", children: i }) })
515
515
  ] }),
516
- l && n && /* @__PURE__ */ e(se, { label: "Chat info", onClick: n, children: /* @__PURE__ */ e(Me, { className: "h-6 w-6 text-charcoal", weight: "bold" }) })
516
+ l && n && /* @__PURE__ */ e(ne, { label: "Chat info", onClick: n, children: /* @__PURE__ */ e(Oe, { className: "h-6 w-6 text-charcoal", weight: "bold" }) })
517
517
  ] });
518
- }, Ge = ({
518
+ }, $e = ({
519
519
  isOpen: t,
520
520
  onClose: s,
521
521
  participant: n,
522
522
  channel: l,
523
- followerStatusLabel: i,
523
+ followerStatusLabel: a,
524
524
  onLeaveConversation: d,
525
- onBlockParticipant: a
525
+ onBlockParticipant: i
526
526
  }) => {
527
- var p, j, _, Q, V, z, q;
528
- const { service: r, debug: o } = ee(), x = G(null), [m, E] = I(!1), [h, w] = I(!1), [u, v] = I(!1);
529
- $(() => {
530
- const S = x.current;
531
- S && (t ? S.showModal() : S.close());
527
+ var L, $, _, V, Q, W, z;
528
+ const { service: r, debug: o } = se(), w = H(null), [u, N] = I(!1), [m, E] = I(!1), [x, h] = I(!1);
529
+ G(() => {
530
+ const R = w.current;
531
+ R && (t ? R.showModal() : R.close());
532
532
  }, [t]);
533
- const N = O(async () => {
534
- var S;
535
- if (!(!r || !((S = n == null ? void 0 : n.user) != null && S.id)))
533
+ const C = U(async () => {
534
+ var R;
535
+ if (!(!r || !((R = n == null ? void 0 : n.user) != null && R.id)))
536
536
  try {
537
537
  const A = (await r.getBlockedUsers()).some(
538
- (W) => {
538
+ (q) => {
539
539
  var Z;
540
- return W.blocked_user_id === ((Z = n == null ? void 0 : n.user) == null ? void 0 : Z.id);
540
+ return q.blocked_user_id === ((Z = n == null ? void 0 : n.user) == null ? void 0 : Z.id);
541
541
  }
542
542
  );
543
- E(A);
544
- } catch (L) {
543
+ N(A);
544
+ } catch (P) {
545
545
  console.error(
546
546
  "[ChannelInfoDialog] Failed to check blocked status:",
547
- L
547
+ P
548
548
  );
549
549
  }
550
- }, [r, (p = n == null ? void 0 : n.user) == null ? void 0 : p.id]);
551
- $(() => {
552
- t && N();
553
- }, [t, N]);
554
- const D = async () => {
555
- var S;
556
- if (!h) {
557
- o && console.log("[ChannelInfoDialog] Leave conversation", l.cid), w(!0);
550
+ }, [r, (L = n == null ? void 0 : n.user) == null ? void 0 : L.id]);
551
+ G(() => {
552
+ t && C();
553
+ }, [t, C]);
554
+ const S = async () => {
555
+ var R;
556
+ if (!m) {
557
+ o && console.log("[ChannelInfoDialog] Leave conversation", l.cid), E(!0);
558
558
  try {
559
- const L = ((S = l._client) == null ? void 0 : S.userID) ?? null;
560
- await l.hide(L, !1), d && await d(l), s();
561
- } catch (L) {
562
- console.error("[ChannelInfoDialog] Failed to leave conversation", L);
559
+ const P = ((R = l._client) == null ? void 0 : R.userID) ?? null;
560
+ await l.hide(P, !1), d && await d(l), s();
561
+ } catch (P) {
562
+ console.error("[ChannelInfoDialog] Failed to leave conversation", P);
563
563
  } finally {
564
- w(!1);
564
+ E(!1);
565
565
  }
566
566
  }
567
- }, M = async () => {
568
- var S, L, A;
569
- if (!(u || !r)) {
570
- o && console.log("[ChannelInfoDialog] Block member", (S = n == null ? void 0 : n.user) == null ? void 0 : S.id), v(!0);
567
+ }, O = async () => {
568
+ var R, P, A;
569
+ if (!(x || !r)) {
570
+ o && console.log("[ChannelInfoDialog] Block member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), h(!0);
571
571
  try {
572
- await r.blockUser((L = n == null ? void 0 : n.user) == null ? void 0 : L.id), a && await a((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
573
- } catch (W) {
574
- console.error("[ChannelInfoDialog] Failed to block member", W);
572
+ await r.blockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), i && await i((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
573
+ } catch (q) {
574
+ console.error("[ChannelInfoDialog] Failed to block member", q);
575
575
  } finally {
576
- v(!1);
576
+ h(!1);
577
577
  }
578
578
  }
579
- }, R = async () => {
580
- var S, L, A;
581
- if (!(u || !r)) {
582
- o && console.log("[ChannelInfoDialog] Unblock member", (S = n == null ? void 0 : n.user) == null ? void 0 : S.id), v(!0);
579
+ }, y = async () => {
580
+ var R, P, A;
581
+ if (!(x || !r)) {
582
+ o && console.log("[ChannelInfoDialog] Unblock member", (R = n == null ? void 0 : n.user) == null ? void 0 : R.id), h(!0);
583
583
  try {
584
- await r.unBlockUser((L = n == null ? void 0 : n.user) == null ? void 0 : L.id), a && await a((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
585
- } catch (W) {
586
- console.error("[ChannelInfoDialog] Failed to unblock member", W);
584
+ await r.unBlockUser((P = n == null ? void 0 : n.user) == null ? void 0 : P.id), i && await i((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
585
+ } catch (q) {
586
+ console.error("[ChannelInfoDialog] Failed to unblock member", q);
587
587
  } finally {
588
- v(!1);
588
+ h(!1);
589
589
  }
590
590
  }
591
591
  }, k = () => {
@@ -596,17 +596,17 @@ const Ae = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
596
596
  );
597
597
  };
598
598
  if (!n) return null;
599
- const P = ((j = n.user) == null ? void 0 : j.name) || ((_ = n.user) == null ? void 0 : _.id) || "Unknown member", f = (Q = n.user) == null ? void 0 : Q.image, g = (V = n.user) == null ? void 0 : V.email, C = (z = n.user) == null ? void 0 : z.username, y = g || (C ? `linktr.ee/${C}` : void 0), B = ((q = n.user) == null ? void 0 : q.id) || "unknown";
599
+ const T = (($ = n.user) == null ? void 0 : $.name) || ((_ = n.user) == null ? void 0 : _.id) || "Unknown member", f = (V = n.user) == null ? void 0 : V.image, g = (Q = n.user) == null ? void 0 : Q.email, v = (W = n.user) == null ? void 0 : W.username, M = g || (v ? `linktr.ee/${v}` : void 0), p = ((z = n.user) == null ? void 0 : z.id) || "unknown";
600
600
  return (
601
601
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
602
602
  /* @__PURE__ */ e(
603
603
  "dialog",
604
604
  {
605
- ref: x,
605
+ ref: w,
606
606
  className: "mes-dialog",
607
607
  onClose: s,
608
- onClick: (S) => {
609
- S.target === x.current && s();
608
+ onClick: (R) => {
609
+ R.target === w.current && s();
610
610
  },
611
611
  children: /* @__PURE__ */ c("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
612
612
  /* @__PURE__ */ c("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
@@ -616,58 +616,58 @@ const Ae = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
616
616
  /* @__PURE__ */ c("div", { className: "flex-1 overflow-y-auto px-6 py-6", children: [
617
617
  /* @__PURE__ */ e("div", { className: "rounded-2xl bg-chalk p-4", children: /* @__PURE__ */ c("div", { className: "flex items-center gap-4", children: [
618
618
  /* @__PURE__ */ e(
619
- ne,
619
+ Y,
620
620
  {
621
- id: B,
622
- name: P,
621
+ id: p,
622
+ name: T,
623
623
  image: f,
624
624
  size: 64
625
625
  }
626
626
  ),
627
627
  /* @__PURE__ */ c("div", { className: "min-w-0 flex-1", children: [
628
- /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: P }),
629
- y && /* @__PURE__ */ e("p", { className: "truncate text-sm text-stone", children: y }),
630
- i && /* @__PURE__ */ e("span", { className: "mt-2 inline-flex items-center rounded-full bg-green-100 px-2 py-0.5 text-xs font-medium text-green-700", children: i })
628
+ /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: T }),
629
+ M && /* @__PURE__ */ e("p", { className: "truncate text-sm text-stone", children: M }),
630
+ a && /* @__PURE__ */ e("span", { className: "mt-2 inline-flex items-center rounded-full bg-green-100 px-2 py-0.5 text-xs font-medium text-green-700", children: a })
631
631
  ] })
632
632
  ] }) }),
633
633
  /* @__PURE__ */ c("ul", { className: "flex flex-col gap-2 mt-2", children: [
634
634
  /* @__PURE__ */ e("li", { children: /* @__PURE__ */ c(
635
- J,
635
+ K,
636
636
  {
637
- onClick: D,
638
- disabled: h,
639
- "aria-busy": h,
637
+ onClick: S,
638
+ disabled: m,
639
+ "aria-busy": m,
640
640
  children: [
641
- h ? /* @__PURE__ */ e(K, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Oe, { className: "h-5 w-5" }),
641
+ m ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Ue, { className: "h-5 w-5" }),
642
642
  /* @__PURE__ */ e("span", { children: "Leave Conversation" })
643
643
  ]
644
644
  }
645
645
  ) }),
646
- /* @__PURE__ */ e("li", { children: m ? /* @__PURE__ */ c(
647
- J,
646
+ /* @__PURE__ */ e("li", { children: u ? /* @__PURE__ */ c(
647
+ K,
648
648
  {
649
- onClick: R,
650
- disabled: u,
651
- "aria-busy": u,
649
+ onClick: y,
650
+ disabled: x,
651
+ "aria-busy": x,
652
652
  children: [
653
- u ? /* @__PURE__ */ e(K, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ie, { className: "h-5 w-5" }),
653
+ x ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ie, { className: "h-5 w-5" }),
654
654
  /* @__PURE__ */ e("span", { children: "Unblock" })
655
655
  ]
656
656
  }
657
657
  ) : /* @__PURE__ */ c(
658
- J,
658
+ K,
659
659
  {
660
- onClick: M,
661
- disabled: u,
662
- "aria-busy": u,
660
+ onClick: O,
661
+ disabled: x,
662
+ "aria-busy": x,
663
663
  children: [
664
- u ? /* @__PURE__ */ e(K, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ie, { className: "h-5 w-5" }),
664
+ x ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ie, { className: "h-5 w-5" }),
665
665
  /* @__PURE__ */ e("span", { children: "Block" })
666
666
  ]
667
667
  }
668
668
  ) }),
669
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ c(J, { variant: "danger", onClick: k, children: [
670
- /* @__PURE__ */ e(Ue, { className: "h-5 w-5" }),
669
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ c(K, { variant: "danger", onClick: k, children: [
670
+ /* @__PURE__ */ e(Fe, { className: "h-5 w-5" }),
671
671
  /* @__PURE__ */ e("span", { children: "Report" })
672
672
  ] }) })
673
673
  ] })
@@ -676,97 +676,97 @@ const Ae = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
676
676
  }
677
677
  )
678
678
  );
679
- }, $e = ({
679
+ }, _e = ({
680
680
  onBack: t,
681
681
  showBackButton: s,
682
682
  renderMessageInputActions: n,
683
683
  onLeaveConversation: l,
684
- onBlockParticipant: i,
684
+ onBlockParticipant: a,
685
685
  CustomChannelEmptyState: d
686
686
  }) => {
687
- var h, w;
688
- const { channel: a } = ue(), [r, o] = I(!1), x = (((w = (h = a == null ? void 0 : a.state) == null ? void 0 : h.messages) == null ? void 0 : w.length) ?? 0) > 0, m = X.useMemo(() => Object.values(a.state.members || {}).find(
689
- (v) => {
690
- var N;
691
- return ((N = v.user) == null ? void 0 : N.id) && v.user.id !== a._client.userID;
687
+ var m, E;
688
+ const { channel: i } = ue(), [r, o] = I(!1), w = (((E = (m = i == null ? void 0 : i.state) == null ? void 0 : m.messages) == null ? void 0 : E.length) ?? 0) > 0, u = X.useMemo(() => Object.values(i.state.members || {}).find(
689
+ (h) => {
690
+ var C;
691
+ return ((C = h.user) == null ? void 0 : C.id) && h.user.id !== i._client.userID;
692
692
  }
693
- ), [a._client.userID, a.state.members]), E = X.useMemo(() => {
694
- const u = a.data ?? {};
695
- return u.followerStatus ? String(u.followerStatus) : u.isFollower ? "Subscribed to you" : void 0;
696
- }, [a.data]);
693
+ ), [i._client.userID, i.state.members]), N = X.useMemo(() => {
694
+ const x = i.data ?? {};
695
+ return x.followerStatus ? String(x.followerStatus) : x.isFollower ? "Subscribed to you" : void 0;
696
+ }, [i.data]);
697
697
  return /* @__PURE__ */ c(oe, { children: [
698
- /* @__PURE__ */ c(Re, { children: [
698
+ /* @__PURE__ */ c(ke, { children: [
699
699
  /* @__PURE__ */ e("div", { className: "border-b border-sand bg-white px-4 py-3", children: /* @__PURE__ */ e(
700
- He,
700
+ Ge,
701
701
  {
702
702
  onBack: t,
703
703
  showBackButton: s,
704
704
  onShowInfo: () => o(!0),
705
- canShowInfo: !!m
705
+ canShowInfo: !!u
706
706
  }
707
707
  ) }),
708
708
  /* @__PURE__ */ c("div", { className: "flex-1 overflow-hidden relative", children: [
709
- /* @__PURE__ */ e(ke, { hideDeletedMessages: !0, hideNewMessageSeparator: !1 }),
710
- !x && d && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-start justify-center pt-8 bg-white", children: /* @__PURE__ */ e(d, {}) })
709
+ /* @__PURE__ */ e(Te, { hideDeletedMessages: !0, hideNewMessageSeparator: !1 }),
710
+ !w && d && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex bg-white", children: /* @__PURE__ */ e(d, {}) })
711
711
  ] }),
712
712
  /* @__PURE__ */ e(
713
- Ae,
713
+ He,
714
714
  {
715
- renderActions: () => n == null ? void 0 : n(a)
715
+ renderActions: () => n == null ? void 0 : n(i)
716
716
  }
717
717
  )
718
718
  ] }),
719
719
  /* @__PURE__ */ e(
720
- Ge,
720
+ $e,
721
721
  {
722
722
  isOpen: r,
723
723
  onClose: () => o(!1),
724
- participant: m,
725
- channel: a,
726
- followerStatusLabel: E,
724
+ participant: u,
725
+ channel: i,
726
+ followerStatusLabel: N,
727
727
  onLeaveConversation: l,
728
- onBlockParticipant: i
728
+ onBlockParticipant: a
729
729
  }
730
730
  )
731
731
  ] });
732
- }, _e = ({
732
+ }, Ve = ({
733
733
  channel: t,
734
734
  onBack: s,
735
735
  showBackButton: n = !1,
736
736
  renderMessageInputActions: l,
737
- onLeaveConversation: i,
737
+ onLeaveConversation: a,
738
738
  onBlockParticipant: d,
739
- className: a,
739
+ className: i,
740
740
  CustomChannelEmptyState: r
741
741
  }) => /* @__PURE__ */ e(
742
742
  "div",
743
743
  {
744
- className: T(
744
+ className: D(
745
745
  "messaging-channel-view h-full flex flex-col",
746
- a
746
+ i
747
747
  ),
748
- children: /* @__PURE__ */ e(Se, { channel: t, children: /* @__PURE__ */ e(
749
- $e,
748
+ children: /* @__PURE__ */ e(Re, { channel: t, children: /* @__PURE__ */ e(
749
+ _e,
750
750
  {
751
751
  onBack: s,
752
752
  showBackButton: n,
753
753
  renderMessageInputActions: l,
754
- onLeaveConversation: i,
754
+ onLeaveConversation: a,
755
755
  onBlockParticipant: d,
756
756
  CustomChannelEmptyState: r
757
757
  }
758
758
  ) })
759
759
  }
760
760
  );
761
- function Ve({
761
+ function We({
762
762
  searchQuery: t,
763
763
  setSearchQuery: s,
764
764
  placeholder: n
765
765
  }) {
766
- const l = G(null);
766
+ const l = H(null);
767
767
  return /* @__PURE__ */ c("div", { className: "relative", children: [
768
768
  /* @__PURE__ */ e(
769
- Le,
769
+ pe,
770
770
  {
771
771
  className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
772
772
  weight: "bold"
@@ -779,17 +779,17 @@ function Ve({
779
779
  type: "text",
780
780
  placeholder: n,
781
781
  value: t,
782
- onChange: (i) => s(i.target.value),
782
+ onChange: (a) => s(a.target.value),
783
783
  className: "w-full pl-10 pr-10 py-3 text-sm border border-sand rounded-xl focus:outline-none focus:ring-2 focus:ring-black focus:border-transparent"
784
784
  }
785
785
  ),
786
786
  t && /* @__PURE__ */ e(
787
- se,
787
+ ne,
788
788
  {
789
789
  label: "Clear search",
790
790
  onClick: () => {
791
- var i;
792
- s(""), (i = l.current) == null || i.focus();
791
+ var a;
792
+ s(""), (a = l.current) == null || a.focus();
793
793
  },
794
794
  className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
795
795
  children: /* @__PURE__ */ e(me, { className: "h-4 w-4", weight: "bold" })
@@ -797,67 +797,67 @@ function Ve({
797
797
  )
798
798
  ] });
799
799
  }
800
- const We = ({
800
+ const ze = ({
801
801
  participantSource: t,
802
802
  onSelectParticipant: s,
803
803
  onClose: n,
804
804
  existingParticipantIds: l = /* @__PURE__ */ new Set(),
805
- participantLabel: i = "participants",
805
+ participantLabel: a = "participants",
806
806
  searchPlaceholder: d = "Search participants...",
807
- className: a
807
+ className: i
808
808
  }) => {
809
- const { debug: r } = ee(), [o, x] = I(""), [m, E] = I([]), [h, w] = I(!1), [u, v] = I(null), [N, D] = I(
809
+ const { debug: r } = se(), [o, w] = I(""), [u, N] = I([]), [m, E] = I(!1), [x, h] = I(null), [C, S] = I(
810
810
  null
811
- ), M = G(!1);
812
- $(() => {
811
+ ), O = H(!1);
812
+ G(() => {
813
813
  if (t.loading) {
814
814
  r && console.log(
815
815
  "[ParticipantPicker] Waiting for participant source to finish loading..."
816
816
  );
817
817
  return;
818
818
  }
819
- if (M.current) return;
819
+ if (O.current) return;
820
820
  (async () => {
821
- r && console.log("[ParticipantPicker] Loading initial participants..."), w(!0), v(null);
821
+ r && console.log("[ParticipantPicker] Loading initial participants..."), E(!0), h(null);
822
822
  try {
823
823
  const g = await t.loadParticipants({
824
824
  search: "",
825
825
  // Load all participants initially
826
826
  limit: 100
827
827
  });
828
- E(g.participants), M.current = !0, r && console.log(
828
+ N(g.participants), O.current = !0, r && console.log(
829
829
  "[ParticipantPicker] Participants loaded successfully:",
830
830
  g.participants.length
831
831
  );
832
832
  } catch (g) {
833
- const C = g instanceof Error ? g.message : "Failed to load participants";
834
- v(C), console.error("[ParticipantPicker] Failed to load participants:", g);
833
+ const v = g instanceof Error ? g.message : "Failed to load participants";
834
+ h(v), console.error("[ParticipantPicker] Failed to load participants:", g);
835
835
  } finally {
836
- w(!1);
836
+ E(!1);
837
837
  }
838
838
  })();
839
839
  }, [t.loading, r]);
840
- const R = m.filter((f) => !l.has(f.id)).filter((f) => {
841
- var C;
840
+ const y = u.filter((f) => !l.has(f.id)).filter((f) => {
841
+ var v;
842
842
  if (!o) return !0;
843
843
  const g = o.toLowerCase();
844
- return f.name.toLowerCase().includes(g) || ((C = f.email) == null ? void 0 : C.toLowerCase().includes(g)) || !1;
845
- }), k = O(
844
+ return f.name.toLowerCase().includes(g) || ((v = f.email) == null ? void 0 : v.toLowerCase().includes(g)) || !1;
845
+ }), k = U(
846
846
  async (f) => {
847
- if (!N) {
848
- D(f.id);
847
+ if (!C) {
848
+ S(f.id);
849
849
  try {
850
850
  await s(f);
851
851
  } catch (g) {
852
- console.error("[ParticipantPicker] Failed to start chat:", g), D(null);
852
+ console.error("[ParticipantPicker] Failed to start chat:", g), S(null);
853
853
  }
854
854
  }
855
855
  },
856
- [s, N]
857
- ), P = (f, g) => {
856
+ [s, C]
857
+ ), T = (f, g) => {
858
858
  (f.key === "Enter" || f.key === " ") && (f.preventDefault(), k(g));
859
859
  };
860
- return /* @__PURE__ */ c("div", { className: T("flex flex-col h-full", a), children: [
860
+ return /* @__PURE__ */ c("div", { className: D("flex flex-col h-full", i), children: [
861
861
  /* @__PURE__ */ c("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
862
862
  /* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-3", children: [
863
863
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
@@ -865,52 +865,52 @@ const We = ({
865
865
  ] }),
866
866
  /* @__PURE__ */ c("p", { className: "text-xs text-stone mb-3", children: [
867
867
  "Select a ",
868
- i.slice(0, -1),
868
+ a.slice(0, -1),
869
869
  " to start messaging (",
870
- R.length,
870
+ y.length,
871
871
  " available)",
872
- t.totalCount !== void 0 && ` • ${t.totalCount} ${i} total`
872
+ t.totalCount !== void 0 && ` • ${t.totalCount} ${a} total`
873
873
  ] }),
874
874
  /* @__PURE__ */ e(
875
- Ve,
875
+ We,
876
876
  {
877
877
  searchQuery: o,
878
- setSearchQuery: x,
878
+ setSearchQuery: w,
879
879
  placeholder: d
880
880
  }
881
881
  )
882
882
  ] }),
883
- u && /* @__PURE__ */ c("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
883
+ x && /* @__PURE__ */ c("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
884
884
  "Error loading ",
885
- i,
885
+ a,
886
886
  ": ",
887
- u
887
+ x
888
888
  ] }),
889
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: h && R.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
889
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: m && y.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
890
890
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
891
891
  /* @__PURE__ */ c("span", { className: "text-sm text-stone", children: [
892
892
  "Loading ",
893
- i,
893
+ a,
894
894
  "..."
895
895
  ] })
896
- ] }) }) : R.length === 0 ? /* @__PURE__ */ c("div", { className: "p-6 text-center", children: [
896
+ ] }) }) : y.length === 0 ? /* @__PURE__ */ c("div", { className: "p-6 text-center", children: [
897
897
  /* @__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" }) }),
898
- /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: o ? `No ${i} found` : m.length > 0 ? `Already chatting with all ${i}` : `No ${i} yet` }),
899
- /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: o ? "Try a different search term" : m.length > 0 ? `You have existing conversations with all your ${i}` : `${i.charAt(0).toUpperCase() + i.slice(1)} will appear here` })
898
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: o ? `No ${a} found` : u.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
899
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: o ? "Try a different search term" : u.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
900
900
  ] }) : /* @__PURE__ */ c("ul", { className: "space-y-0", children: [
901
- R.map((f) => {
902
- const g = f.name || f.email || f.id, C = f.email && f.name ? f.email : f.phone;
901
+ y.map((f) => {
902
+ const g = f.name || f.email || f.id, v = f.email && f.name ? f.email : f.phone;
903
903
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
904
904
  "button",
905
905
  {
906
906
  type: "button",
907
907
  onClick: () => k(f),
908
- onKeyDown: (y) => P(y, f),
908
+ onKeyDown: (M) => T(M, f),
909
909
  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",
910
910
  children: /* @__PURE__ */ c("div", { className: "flex items-center justify-between", children: [
911
911
  /* @__PURE__ */ c("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
912
912
  /* @__PURE__ */ e(
913
- ne,
913
+ Y,
914
914
  {
915
915
  id: f.id,
916
916
  name: g,
@@ -920,21 +920,21 @@ const We = ({
920
920
  ),
921
921
  /* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
922
922
  /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: g }),
923
- C && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: C })
923
+ v && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: v })
924
924
  ] })
925
925
  ] }),
926
- /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N === f.id ? /* @__PURE__ */ e(K, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5 text-stone" }) })
926
+ /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: C === f.id ? /* @__PURE__ */ e(ee, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5 text-stone" }) })
927
927
  ] })
928
928
  }
929
929
  ) }, f.id);
930
930
  }),
931
- h && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
931
+ m && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
932
932
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
933
933
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
934
934
  ] }) })
935
935
  ] }) })
936
936
  ] });
937
- }, 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__ */ c("div", { className: "text-center max-w-sm", children: [
937
+ }, qe = ({ 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__ */ c("div", { className: "text-center max-w-sm", children: [
938
938
  /* @__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: "💬" }) }),
939
939
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal", children: "Welcome to Messages" }),
940
940
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */ c(oe, { children: [
@@ -977,10 +977,10 @@ const We = ({
977
977
  children: "Go Back"
978
978
  }
979
979
  )
980
- ] }) }), qe = ({ className: t, message: s }) => /* @__PURE__ */ c(
980
+ ] }) }), Xe = ({ className: t, message: s }) => /* @__PURE__ */ c(
981
981
  "div",
982
982
  {
983
- className: T("flex items-center justify-center h-full", t),
983
+ className: D("flex items-center justify-center h-full", t),
984
984
  children: [
985
985
  /* @__PURE__ */ c("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
986
986
  /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
@@ -1020,192 +1020,193 @@ const We = ({
1020
1020
  s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
1021
1021
  ]
1022
1022
  }
1023
- ), Xe = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ c("div", { className: "flex items-center", children: [
1024
- /* @__PURE__ */ e(qe, { className: "w-6 h-6" }),
1023
+ ), Qe = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ c("div", { className: "flex items-center", children: [
1024
+ /* @__PURE__ */ e(Xe, { className: "w-6 h-6" }),
1025
1025
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
1026
- ] }) }), ts = ({
1026
+ ] }) }), rs = ({
1027
1027
  capabilities: t = {},
1028
1028
  className: s,
1029
1029
  renderMessageInputActions: n,
1030
1030
  onChannelSelect: l,
1031
- onParticipantSelect: i,
1031
+ onParticipantSelect: a,
1032
1032
  initialParticipantFilter: d,
1033
- initialParticipantData: a,
1034
- CustomChannelEmptyState: r
1033
+ initialParticipantData: i,
1034
+ CustomChannelEmptyState: r,
1035
+ showChannelList: o = !0
1035
1036
  }) => {
1036
1037
  const {
1037
- service: o,
1038
- client: x,
1039
- isConnected: m,
1040
- isLoading: E,
1041
- error: h,
1042
- refreshConnection: w,
1043
- debug: u
1044
- } = Fe(), [v, N] = I(null), [D, M] = I(!1), [R, k] = I(!1), [P, f] = I(/* @__PURE__ */ new Set()), [g, C] = I(0), [y, B] = I(!1), [p, j] = I(null), _ = G(null), {
1038
+ service: w,
1039
+ client: u,
1040
+ isConnected: N,
1041
+ isLoading: m,
1042
+ error: E,
1043
+ refreshConnection: x,
1044
+ debug: h
1045
+ } = Le(), [C, S] = I(null), [O, y] = I(!1), [k, T] = I(!1), [f, g] = I(/* @__PURE__ */ new Set()), [v, M] = I(0), [p, L] = I(!1), [$, _] = I(null), V = H(null), {
1045
1046
  showStartConversation: Q = !1,
1046
- participantSource: V,
1047
+ participantSource: W,
1047
1048
  participantLabel: z = "participants"
1048
- } = t, q = G(null), S = O(async () => {
1049
- if (!x || !m) return;
1050
- const b = x.userID;
1049
+ } = t, R = H(null), P = U(async () => {
1050
+ if (!u || !N) return;
1051
+ const b = u.userID;
1051
1052
  if (b)
1052
1053
  try {
1053
- u && console.log("[MessagingShell] Syncing channels for user:", b);
1054
- const F = await x.queryChannels(
1054
+ h && console.log("[MessagingShell] Syncing channels for user:", b);
1055
+ const j = await u.queryChannels(
1055
1056
  {
1056
1057
  type: "messaging",
1057
1058
  members: { $in: [b] }
1058
1059
  },
1059
1060
  {},
1060
1061
  { limit: 100 }
1061
- ), U = /* @__PURE__ */ new Set();
1062
- F.forEach((H) => {
1063
- const Ne = H.state.members;
1064
- Object.values(Ne).forEach((be) => {
1062
+ ), F = /* @__PURE__ */ new Set();
1063
+ j.forEach((B) => {
1064
+ const be = B.state.members;
1065
+ Object.values(be).forEach((Ce) => {
1065
1066
  var ae;
1066
- const re = (ae = be.user) == null ? void 0 : ae.id;
1067
- re && re !== b && U.add(re);
1067
+ const re = (ae = Ce.user) == null ? void 0 : ae.id;
1068
+ re && re !== b && F.add(re);
1068
1069
  });
1069
- }), f(U), M(F.length > 0), q.current = b, u && console.log("[MessagingShell] Channels synced successfully:", {
1070
- channelCount: F.length,
1071
- memberCount: U.size
1070
+ }), g(F), y(j.length > 0), R.current = b, h && console.log("[MessagingShell] Channels synced successfully:", {
1071
+ channelCount: j.length,
1072
+ memberCount: F.size
1072
1073
  });
1073
- } catch (F) {
1074
- console.error("[MessagingShell] Failed to sync channels:", F);
1074
+ } catch (j) {
1075
+ console.error("[MessagingShell] Failed to sync channels:", j);
1075
1076
  }
1076
- }, [x, m, u]);
1077
- $(() => {
1078
- if (!x || !m) return;
1079
- const b = x.userID;
1080
- b && q.current !== b && S();
1081
- }, [x, m, S]), $(() => {
1082
- if (!d || !x || !m) return;
1077
+ }, [u, N, h]);
1078
+ G(() => {
1079
+ if (!u || !N) return;
1080
+ const b = u.userID;
1081
+ b && R.current !== b && P();
1082
+ }, [u, N, P]), G(() => {
1083
+ if (!d || !u || !N) return;
1083
1084
  (async () => {
1084
- const F = x.userID;
1085
- if (F)
1085
+ const j = u.userID;
1086
+ if (j)
1086
1087
  try {
1087
- u && console.log(
1088
+ h && console.log(
1088
1089
  "[MessagingShell] Loading initial conversation with:",
1089
1090
  d
1090
1091
  );
1091
- const U = await x.queryChannels(
1092
+ const F = await u.queryChannels(
1092
1093
  {
1093
1094
  type: "messaging",
1094
- members: { $eq: [F, d] }
1095
+ members: { $eq: [j, d] }
1095
1096
  },
1096
1097
  {},
1097
1098
  { limit: 1 }
1098
1099
  );
1099
- if (U.length > 0)
1100
- N(U[0]), B(!0), j(null), l && l(U[0]), u && console.log(
1100
+ if (F.length > 0)
1101
+ S(F[0]), L(!0), _(null), l && l(F[0]), h && console.log(
1101
1102
  "[MessagingShell] Initial conversation loaded:",
1102
- U[0].id
1103
+ F[0].id
1103
1104
  );
1104
- else if (a && o) {
1105
- u && console.log(
1105
+ else if (i && w) {
1106
+ h && console.log(
1106
1107
  "[MessagingShell] No conversation found, creating one for:",
1107
- a
1108
+ i
1108
1109
  );
1109
1110
  try {
1110
- const H = await o.startChannelWithParticipant({
1111
- id: a.id,
1112
- name: a.name,
1113
- email: a.email,
1114
- phone: a.phone
1111
+ const B = await w.startChannelWithParticipant({
1112
+ id: i.id,
1113
+ name: i.name,
1114
+ email: i.email,
1115
+ phone: i.phone
1115
1116
  });
1116
- N(H), B(!0), j(null), l && l(H), u && console.log(
1117
+ S(B), L(!0), _(null), l && l(B), h && console.log(
1117
1118
  "[MessagingShell] Channel created and loaded:",
1118
- H.id
1119
+ B.id
1119
1120
  );
1120
- } catch (H) {
1121
+ } catch (B) {
1121
1122
  console.error(
1122
1123
  "[MessagingShell] Failed to create conversation:",
1123
- H
1124
- ), j("Failed to create conversation");
1124
+ B
1125
+ ), _("Failed to create conversation");
1125
1126
  }
1126
1127
  } else
1127
- j(
1128
+ _(
1128
1129
  "No conversation found with this account"
1129
- ), u && console.log(
1130
+ ), h && console.log(
1130
1131
  "[MessagingShell] No conversation found for:",
1131
1132
  d
1132
1133
  );
1133
- } catch (U) {
1134
+ } catch (F) {
1134
1135
  console.error(
1135
1136
  "[MessagingShell] Failed to load initial conversation:",
1136
- U
1137
- ), j("Failed to load conversation");
1137
+ F
1138
+ ), _("Failed to load conversation");
1138
1139
  }
1139
1140
  })();
1140
1141
  }, [
1141
1142
  d,
1142
- a,
1143
- x,
1144
- m,
1145
- o,
1143
+ i,
1146
1144
  u,
1145
+ N,
1146
+ w,
1147
+ h,
1147
1148
  l
1148
1149
  ]);
1149
- const L = O(
1150
+ const A = U(
1150
1151
  (b) => {
1151
- N(b), l == null || l(b);
1152
+ S(b), l == null || l(b);
1152
1153
  },
1153
1154
  [l]
1154
- ), A = O(() => {
1155
- y || N(null);
1156
- }, [y]), W = O(() => {
1155
+ ), q = U(() => {
1156
+ p || S(null);
1157
+ }, [p]), Z = U(() => {
1157
1158
  var b;
1158
- V && (C((F) => F + 1), k(!0), (b = _.current) == null || b.showModal());
1159
- }, [V]), Z = O(
1159
+ W && (M((j) => j + 1), T(!0), (b = V.current) == null || b.showModal());
1160
+ }, [W]), ge = U(
1160
1161
  async (b) => {
1161
- var F;
1162
- if (o)
1162
+ var j;
1163
+ if (w)
1163
1164
  try {
1164
- u && console.log(
1165
+ h && console.log(
1165
1166
  "[MessagingShell] Starting conversation with:",
1166
1167
  b.id
1167
1168
  );
1168
- const U = await o.startChannelWithParticipant({
1169
+ const F = await w.startChannelWithParticipant({
1169
1170
  id: b.id,
1170
1171
  name: b.name,
1171
1172
  email: b.email,
1172
1173
  phone: b.phone
1173
1174
  });
1174
1175
  try {
1175
- await U.show();
1176
- } catch (H) {
1177
- console.warn("[MessagingShell] Failed to unhide channel:", H);
1176
+ await F.show();
1177
+ } catch (B) {
1178
+ console.warn("[MessagingShell] Failed to unhide channel:", B);
1178
1179
  }
1179
- N(U), k(!1), (F = _.current) == null || F.close(), i == null || i(b);
1180
- } catch (U) {
1181
- console.error("[MessagingShell] Failed to start conversation:", U);
1180
+ S(F), T(!1), (j = V.current) == null || j.close(), a == null || a(b);
1181
+ } catch (F) {
1182
+ console.error("[MessagingShell] Failed to start conversation:", F);
1182
1183
  }
1183
1184
  },
1184
- [o, i, u]
1185
- ), te = O(() => {
1185
+ [w, a, h]
1186
+ ), te = U(() => {
1186
1187
  var b;
1187
- k(!1), (b = _.current) == null || b.close();
1188
- }, []), ge = O(
1188
+ T(!1), (b = V.current) == null || b.close();
1189
+ }, []), xe = U(
1189
1190
  async (b) => {
1190
- u && console.log("[MessagingShell] Leaving conversation:", b.id), N(null), B(!1), q.current = null, await S();
1191
+ h && console.log("[MessagingShell] Leaving conversation:", b.id), S(null), L(!1), R.current = null, await P();
1191
1192
  },
1192
- [S, u]
1193
- ), xe = O(
1193
+ [P, h]
1194
+ ), Ne = U(
1194
1195
  async (b) => {
1195
- u && console.log("[MessagingShell] Blocking participant:", b), N(null), B(!1), q.current = null, await S();
1196
+ h && console.log("[MessagingShell] Blocking participant:", b), S(null), L(!1), R.current = null, await P();
1196
1197
  },
1197
- [S, u]
1198
- ), Y = !!v;
1199
- return E ? /* @__PURE__ */ e("div", { className: T("h-full", s), children: /* @__PURE__ */ e(Xe, {}) }) : h ? /* @__PURE__ */ e("div", { className: T("h-full", s), children: /* @__PURE__ */ e(le, { message: h, onBack: w }) }) : !m || !x ? /* @__PURE__ */ e("div", { className: T("h-full", s), children: /* @__PURE__ */ e(
1198
+ [P, h]
1199
+ ), J = !!C;
1200
+ return m ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(Qe, {}) }) : E ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(le, { message: E, onBack: x }) }) : !N || !u ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(
1200
1201
  le,
1201
1202
  {
1202
1203
  message: "Not connected to messaging service",
1203
- onBack: w
1204
+ onBack: x
1204
1205
  }
1205
- ) }) : p ? /* @__PURE__ */ e("div", { className: T("h-full", s), children: /* @__PURE__ */ e(le, { message: p }) }) : /* @__PURE__ */ c(
1206
+ ) }) : $ ? /* @__PURE__ */ e("div", { className: D("h-full", s), children: /* @__PURE__ */ e(le, { message: $ }) }) : /* @__PURE__ */ c(
1206
1207
  "div",
1207
1208
  {
1208
- className: T(
1209
+ className: D(
1209
1210
  "messaging-shell h-full bg-white overflow-hidden",
1210
1211
  s
1211
1212
  ),
@@ -1214,24 +1215,24 @@ const We = ({
1214
1215
  /* @__PURE__ */ e(
1215
1216
  "div",
1216
1217
  {
1217
- className: T(
1218
+ className: D(
1218
1219
  "messaging-channel-list-sidebar min-h-0 min-w-0 bg-white lg:bg-chalk lg:flex lg:flex-col lg:border-r lg:border-sand",
1219
1220
  {
1220
- // In direct conversation mode, always hide the channel list
1221
- "!hidden": y,
1221
+ // Explicitly hidden via prop or in direct conversation mode
1222
+ "!hidden": o === !1 || p,
1222
1223
  // Normal mode: hide on mobile when channel selected, show on desktop
1223
- "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": !y && Y,
1224
+ "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": o !== !1 && !p && J,
1224
1225
  // Normal mode: show when no channel selected
1225
- "flex flex-col w-full lg:flex-1 lg:max-w-2xl": !y && !Y
1226
+ "flex flex-col w-full lg:flex-1 lg:max-w-2xl": o !== !1 && !p && !J
1226
1227
  }
1227
1228
  ),
1228
1229
  children: /* @__PURE__ */ e(
1229
1230
  Be,
1230
1231
  {
1231
- onChannelSelect: L,
1232
- selectedChannel: v || void 0,
1233
- showStartConversation: Q && !!V,
1234
- onStartConversation: W,
1232
+ onChannelSelect: A,
1233
+ selectedChannel: C || void 0,
1234
+ showStartConversation: Q && !!W,
1235
+ onStartConversation: Z,
1235
1236
  participantLabel: z
1236
1237
  }
1237
1238
  )
@@ -1240,66 +1241,66 @@ const We = ({
1240
1241
  /* @__PURE__ */ e(
1241
1242
  "div",
1242
1243
  {
1243
- className: T(
1244
+ className: D(
1244
1245
  "messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
1245
1246
  {
1246
1247
  // In direct conversation mode, always show (full width)
1247
- flex: y || Y,
1248
+ flex: p || J,
1248
1249
  // Normal mode: hide on mobile when no channel selected
1249
- "hidden lg:flex": !y && !Y
1250
+ "hidden lg:flex": !p && !J
1250
1251
  }
1251
1252
  ),
1252
- children: v ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1253
- _e,
1253
+ children: C ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1254
+ Ve,
1254
1255
  {
1255
- channel: v,
1256
- onBack: A,
1257
- showBackButton: !y,
1256
+ channel: C,
1257
+ onBack: q,
1258
+ showBackButton: !p,
1258
1259
  renderMessageInputActions: n,
1259
- onLeaveConversation: ge,
1260
- onBlockParticipant: xe,
1260
+ onLeaveConversation: xe,
1261
+ onBlockParticipant: Ne,
1261
1262
  CustomChannelEmptyState: r
1262
1263
  },
1263
- v.id
1264
+ C.id
1264
1265
  ) }) : /* @__PURE__ */ e(
1265
- ze,
1266
+ qe,
1266
1267
  {
1267
- hasChannels: D,
1268
- onStartConversation: Q ? W : void 0,
1268
+ hasChannels: O,
1269
+ onStartConversation: Q ? Z : void 0,
1269
1270
  participantLabel: z
1270
1271
  }
1271
1272
  )
1272
1273
  }
1273
1274
  )
1274
1275
  ] }),
1275
- V && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
1276
+ W && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
1276
1277
  /* @__PURE__ */ e(
1277
1278
  "dialog",
1278
1279
  {
1279
- ref: _,
1280
+ ref: V,
1280
1281
  className: "mes-dialog",
1281
1282
  onClick: (b) => {
1282
- b.target === _.current && te();
1283
+ b.target === V.current && te();
1283
1284
  },
1284
1285
  onClose: te,
1285
1286
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
1286
- We,
1287
+ ze,
1287
1288
  {
1288
- participantSource: V,
1289
- onSelectParticipant: Z,
1289
+ participantSource: W,
1290
+ onSelectParticipant: ge,
1290
1291
  onClose: te,
1291
- existingParticipantIds: P,
1292
+ existingParticipantIds: f,
1292
1293
  participantLabel: z,
1293
1294
  searchPlaceholder: `Search ${z}...`
1294
1295
  },
1295
- g
1296
+ v
1296
1297
  ) })
1297
1298
  }
1298
1299
  )
1299
1300
  ]
1300
1301
  }
1301
1302
  );
1302
- }, Qe = ({
1303
+ }, Ze = ({
1303
1304
  question: t,
1304
1305
  onClick: s,
1305
1306
  loading: n = !1,
@@ -1310,87 +1311,108 @@ const We = ({
1310
1311
  type: "button",
1311
1312
  onClick: s,
1312
1313
  disabled: n,
1313
- className: T(
1314
- "w-full text-center p-4 rounded-xl bg-chalk text-charcoal font-medium transition-colors",
1314
+ style: { backgroundColor: "#E6E5E3" },
1315
+ className: D(
1316
+ "w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
1315
1317
  {
1316
- "hover:bg-sand active:bg-sand": !n,
1318
+ "hover:brightness-95 active:brightness-90": !n,
1317
1319
  "opacity-50 cursor-not-allowed": n
1318
1320
  },
1319
1321
  l
1320
1322
  ),
1321
1323
  children: t
1322
1324
  }
1323
- ), rs = ({
1325
+ ), ls = ({
1324
1326
  faqs: t,
1325
1327
  onFaqClick: s,
1326
1328
  loadingFaqId: n,
1327
1329
  headerText: l,
1328
- className: i
1330
+ className: a,
1331
+ avatarImage: d,
1332
+ avatarName: i
1329
1333
  }) => {
1330
- const d = t.filter((a) => a.enabled).sort((a, r) => (a.order ?? 0) - (r.order ?? 0));
1331
- return d.length === 0 ? null : /* @__PURE__ */ c("div", { className: T("px-4 py-6 space-y-3", i), children: [
1332
- l && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: l }),
1333
- d.map((a) => /* @__PURE__ */ e(
1334
- Qe,
1334
+ const r = t.filter((o) => o.enabled).sort((o, w) => (o.order ?? 0) - (w.order ?? 0));
1335
+ return r.length === 0 ? null : /* @__PURE__ */ e("div", { className: D("px-4 py-6", a), children: /* @__PURE__ */ c("div", { className: "flex gap-3 items-end", children: [
1336
+ (d || i) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1337
+ Y,
1335
1338
  {
1336
- question: a.question,
1337
- onClick: () => s(a.id),
1338
- loading: n === a.id
1339
- },
1340
- a.id
1341
- ))
1342
- ] });
1343
- }, ls = (t, s = {}) => {
1344
- const { initialSearch: n = "", pageSize: l = 20 } = s, [i, d] = I([]), [a, r] = I(!1), [o, x] = I(null), [m, E] = I(n), [h, w] = I(!0), [u, v] = I(), N = O(async (k = !1, P) => {
1345
- if (a) return;
1346
- const f = P !== void 0 ? P : m;
1347
- r(!0), x(null);
1339
+ id: i || "account",
1340
+ name: i || "Account",
1341
+ image: d,
1342
+ size: 24
1343
+ }
1344
+ ) }),
1345
+ /* @__PURE__ */ c(
1346
+ "div",
1347
+ {
1348
+ className: "flex-1 rounded-lg p-4 space-y-3",
1349
+ style: { backgroundColor: "#F1F0EE" },
1350
+ children: [
1351
+ l && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: l }),
1352
+ r.map((o) => /* @__PURE__ */ e(
1353
+ Ze,
1354
+ {
1355
+ question: o.question,
1356
+ onClick: () => s(o.id),
1357
+ loading: n === o.id
1358
+ },
1359
+ o.id
1360
+ ))
1361
+ ]
1362
+ }
1363
+ )
1364
+ ] }) });
1365
+ }, os = (t, s = {}) => {
1366
+ const { initialSearch: n = "", pageSize: l = 20 } = s, [a, d] = I([]), [i, r] = I(!1), [o, w] = I(null), [u, N] = I(n), [m, E] = I(!0), [x, h] = I(), C = U(async (k = !1, T) => {
1367
+ if (i) return;
1368
+ const f = T !== void 0 ? T : u;
1369
+ r(!0), w(null);
1348
1370
  try {
1349
1371
  const g = await t.loadParticipants({
1350
1372
  search: f || void 0,
1351
1373
  limit: l,
1352
- cursor: k ? void 0 : u
1374
+ cursor: k ? void 0 : x
1353
1375
  });
1354
1376
  d(
1355
- (C) => k ? g.participants : [...C, ...g.participants]
1356
- ), w(g.hasMore), v(g.nextCursor);
1377
+ (v) => k ? g.participants : [...v, ...g.participants]
1378
+ ), E(g.hasMore), h(g.nextCursor);
1357
1379
  } catch (g) {
1358
- const C = g instanceof Error ? g.message : "Failed to load participants";
1359
- x(C), console.error("[useParticipants] Load error:", g);
1380
+ const v = g instanceof Error ? g.message : "Failed to load participants";
1381
+ w(v), console.error("[useParticipants] Load error:", g);
1360
1382
  } finally {
1361
1383
  r(!1);
1362
1384
  }
1363
- }, [t, m, u, l, a]), D = O(() => {
1364
- h && !a && N(!1);
1365
- }, [h, a, N]), M = O((k) => {
1366
- E(k), v(void 0), N(!0, k);
1367
- }, [N]), R = O(() => {
1368
- v(void 0), N(!0);
1369
- }, [N]);
1370
- return $(() => {
1371
- N(!0);
1385
+ }, [t, u, x, l, i]), S = U(() => {
1386
+ m && !i && C(!1);
1387
+ }, [m, i, C]), O = U((k) => {
1388
+ N(k), h(void 0), C(!0, k);
1389
+ }, [C]), y = U(() => {
1390
+ h(void 0), C(!0);
1391
+ }, [C]);
1392
+ return G(() => {
1393
+ C(!0);
1372
1394
  }, [t.loadParticipants]), {
1373
- participants: i,
1374
- loading: a,
1395
+ participants: a,
1396
+ loading: i,
1375
1397
  error: o,
1376
- searchQuery: m,
1377
- hasMore: h,
1398
+ searchQuery: u,
1399
+ hasMore: m,
1378
1400
  totalCount: t.totalCount,
1379
- loadMore: D,
1380
- search: M,
1381
- refresh: R
1401
+ loadMore: S,
1402
+ search: O,
1403
+ refresh: y
1382
1404
  };
1383
1405
  };
1384
1406
  export {
1385
- ne as Avatar,
1407
+ Y as Avatar,
1386
1408
  Be as ChannelList,
1387
- _e as ChannelView,
1388
- rs as FaqList,
1389
- Qe as FaqListItem,
1390
- ns as MessagingProvider,
1391
- ts as MessagingShell,
1392
- We as ParticipantPicker,
1393
- Fe as useMessaging,
1394
- ls as useParticipants
1409
+ Ve as ChannelView,
1410
+ ls as FaqList,
1411
+ Ze as FaqListItem,
1412
+ ts as MessagingProvider,
1413
+ rs as MessagingShell,
1414
+ ze as ParticipantPicker,
1415
+ Le as useMessaging,
1416
+ os as useParticipants
1395
1417
  };
1396
1418
  //# sourceMappingURL=index.js.map