@linktr.ee/messaging-react 1.5.1-rc-1761642868 โ†’ 1.5.2-rc-1761646054

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,4 +1,4 @@
1
- import { jsx as e, jsxs as c, Fragment as oe } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as d, Fragment as oe } from "react/jsx-runtime";
2
2
  import T from "classnames";
3
3
  import X, { createContext as Ce, useContext as ve, useCallback as O, useState as I, useRef as G, useEffect as $ } from "react";
4
4
  import { StreamChatService as we } from "@linktr.ee/messaging-core";
@@ -21,12 +21,12 @@ const he = Ce({
21
21
  serviceConfig: n,
22
22
  apiKey: l,
23
23
  capabilities: i = {},
24
- customization: d = {},
24
+ customization: c = {},
25
25
  debug: a = !1
26
26
  }) => {
27
27
  const r = O(
28
- (C, ...y) => {
29
- a && console.log(`๐Ÿ”ฅ [MessagingProvider] ${C}`, ...y);
28
+ (b, ...y) => {
29
+ a && console.log(`๐Ÿ”ฅ [MessagingProvider] ${b}`, ...y);
30
30
  },
31
31
  [a]
32
32
  );
@@ -35,14 +35,14 @@ const he = Ce({
35
35
  apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
36
36
  serviceConfig: !!n,
37
37
  capabilities: Object.keys(i),
38
- customization: Object.keys(d)
38
+ customization: Object.keys(c)
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, x] = I(null), [h, E] = I(null), [m, C] = I(!1), [u, w] = I(!1), [v, D] = I(null), M = G(!1), R = G({
41
41
  userId: s == null ? void 0 : s.id,
42
42
  apiKey: l,
43
43
  serviceConfig: n,
44
44
  capabilities: i,
45
- customization: d
45
+ customization: c
46
46
  }), k = G(0);
47
47
  k.current++, r("๐Ÿ“Š RENDER INFO", {
48
48
  renderCount: k.current,
@@ -52,18 +52,18 @@ const he = Ce({
52
52
  apiKeyChanged: R.current.apiKey !== l,
53
53
  serviceConfigChanged: R.current.serviceConfig !== n,
54
54
  capabilitiesChanged: R.current.capabilities !== i,
55
- customizationChanged: R.current.customization !== d
55
+ customizationChanged: R.current.customization !== c
56
56
  }
57
57
  }), R.current = {
58
58
  userId: s == null ? void 0 : s.id,
59
59
  apiKey: l,
60
60
  serviceConfig: n,
61
61
  capabilities: i,
62
- customization: d
62
+ customization: c
63
63
  }, $(() => {
64
- const C = k.current;
64
+ const b = k.current;
65
65
  if (r("๐Ÿ”ง SERVICE INIT EFFECT TRIGGERED", {
66
- renderCount: C,
66
+ renderCount: b,
67
67
  apiKey: !!l,
68
68
  serviceConfig: !!n,
69
69
  dependencies: {
@@ -74,13 +74,13 @@ const he = Ce({
74
74
  }
75
75
  }), !l || !n) {
76
76
  r("โš ๏ธ SERVICE INIT SKIPPED", {
77
- renderCount: C,
77
+ renderCount: b,
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: b,
84
84
  apiKey: (l == null ? void 0 : l.substring(0, 8)) + "...",
85
85
  serviceConfigChanged: R.current.serviceConfig !== n
86
86
  });
@@ -90,11 +90,11 @@ const he = Ce({
90
90
  debug: a
91
91
  });
92
92
  return x(y), r("โœ… SERVICE SET", {
93
- renderCount: C,
93
+ renderCount: b,
94
94
  serviceInstance: !!y
95
95
  }), () => {
96
96
  r("๐Ÿงน SERVICE CLEANUP", {
97
- renderCount: C,
97
+ renderCount: b,
98
98
  reason: "Effect cleanup"
99
99
  }), y.disconnectUser().catch(console.error);
100
100
  };
@@ -107,7 +107,7 @@ const he = Ce({
107
107
  hasUser: !!s,
108
108
  userId: s == null ? void 0 : s.id,
109
109
  isConnecting: M.current,
110
- isConnected: h,
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");
@@ -125,39 +125,39 @@ 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 }), M.current = !0, w(!0), D(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 F = await o.connectUser(s);
132
+ E(F), C(!0), P.current = { serviceId: o, userId: s.id }, r("โœ… USER CONNECTION SUCCESS", {
133
133
  userId: s.id,
134
- clientId: p.userID
134
+ clientId: F.userID
135
135
  });
136
- } catch (p) {
137
- const j = p instanceof Error ? p.message : "Connection failed";
136
+ } catch (F) {
137
+ const j = F instanceof Error ? F.message : "Connection failed";
138
138
  D(j), r("โŒ USER CONNECTION ERROR", {
139
139
  userId: s.id,
140
140
  error: j
141
141
  });
142
142
  } finally {
143
- v(!1), M.current = !1, r("๐Ÿ”„ USER CONNECTION FINISHED", {
143
+ w(!1), M.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]), $(() => (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
156
  ), P.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]);
160
+ }), [o, m, r]);
161
161
  const f = O(async () => {
162
162
  if (r("๐Ÿ”„ REFRESH CONNECTION CALLED", {
163
163
  hasService: !!o,
@@ -166,58 +166,58 @@ 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 }), w(!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";
172
+ const b = await o.connectUser(s);
173
+ E(b), C(!0), D(null), r("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
174
+ } catch (b) {
175
+ const y = b instanceof Error ? b.message : "Refresh failed";
176
176
  D(y), r("โŒ CONNECTION REFRESH ERROR", {
177
177
  userId: s.id,
178
178
  error: y
179
179
  });
180
180
  } finally {
181
- v(!1), r("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
181
+ w(!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,
185
+ hasClient: !!h,
186
+ isConnected: m,
187
187
  isLoading: u,
188
- hasError: !!N,
188
+ hasError: !!v,
189
189
  capabilitiesKeys: Object.keys(i),
190
- customizationKeys: Object.keys(d)
190
+ customizationKeys: Object.keys(c)
191
191
  }), {
192
192
  service: o,
193
- client: m,
194
- isConnected: h,
193
+ client: h,
194
+ isConnected: m,
195
195
  isLoading: u,
196
- error: N,
196
+ error: v,
197
197
  capabilities: i,
198
- customization: d,
198
+ customization: c,
199
199
  refreshConnection: f,
200
200
  debug: a
201
201
  }), [
202
202
  o,
203
- m,
204
203
  h,
204
+ m,
205
205
  u,
206
- N,
206
+ v,
207
207
  i,
208
- d,
208
+ c,
209
209
  f,
210
210
  a,
211
211
  r
212
212
  ]);
213
213
  return r("๐Ÿ”„ RENDER END", {
214
214
  renderCount: k.current,
215
- willRenderChat: !!(m && h),
215
+ willRenderChat: !!(h && 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();
217
+ }), /* @__PURE__ */ e(he.Provider, { value: g, children: h && m ? /* @__PURE__ */ e(Ie, { client: h, children: t }) : t });
218
+ }, pe = () => ee();
219
219
  function se({ label: t, className: s, children: n, ...l }) {
220
- return /* @__PURE__ */ c(
220
+ return /* @__PURE__ */ d(
221
221
  "button",
222
222
  {
223
223
  type: "button",
@@ -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 Fe(t) {
241
241
  const s = [
242
242
  { color: "#8129D9" },
243
243
  // purple
@@ -277,7 +277,7 @@ const ne = ({
277
277
  size: l = 40,
278
278
  className: i
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: c } = Fe(t), a = 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
  {
@@ -302,8 +302,8 @@ const ne = ({
302
302
  o
303
303
  ),
304
304
  style: {
305
- color: d,
306
- backgroundColor: `color-mix(in srgb, ${d} 20%, transparent)`
305
+ color: c,
306
+ backgroundColor: `color-mix(in srgb, ${c} 20%, transparent)`
307
307
  },
308
308
  children: a
309
309
  }
@@ -311,29 +311,29 @@ const ne = ({
311
311
  }
312
312
  );
313
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 = () => {
314
+ var u, w, v, D, M, R, k;
315
+ const i = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), c = () => {
316
316
  t && n(t);
317
317
  }, r = Object.values(((u = t == null ? void 0 : t.state) == null ? void 0 : u.members) || {}).find(
318
318
  (P) => {
319
319
  var f, g;
320
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);
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 = ((w = r == null ? void 0 : r.user) == null ? void 0 : w.name) || "Conversation", x = (v = r == null ? void 0 : r.user) == null ? void 0 : v.image, h = (M = (D = t == null ? void 0 : t.state) == null ? void 0 : D.messages) == null ? void 0 : M[t.state.messages.length - 1], E = (h == null ? void 0 : h.text) || "No messages yet", m = h != null && h.created_at ? new Date(h.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
+ }) : "", C = ((R = t == null ? void 0 : t.state) == null ? void 0 : R.unreadCount) || 0;
326
326
  return l && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
327
327
  channelId: t == null ? void 0 : t.id,
328
328
  isSelected: i,
329
329
  participantName: o,
330
- unread: w,
331
- hasTimestamp: !!h
330
+ unread: C,
331
+ hasTimestamp: !!m
332
332
  }), /* @__PURE__ */ e(
333
333
  "button",
334
334
  {
335
335
  type: "button",
336
- onClick: d,
336
+ onClick: c,
337
337
  className: T(
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
  {
@@ -341,7 +341,7 @@ const ne = ({
341
341
  "hover:bg-sand": !i
342
342
  }
343
343
  ),
344
- children: /* @__PURE__ */ c("div", { className: "flex items-start gap-3", children: [
344
+ children: /* @__PURE__ */ d("div", { className: "flex items-start gap-3", children: [
345
345
  /* @__PURE__ */ e(
346
346
  ne,
347
347
  {
@@ -351,8 +351,8 @@ const ne = ({
351
351
  size: 44
352
352
  }
353
353
  ),
354
- /* @__PURE__ */ c("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
355
- /* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-2", children: [
354
+ /* @__PURE__ */ d("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
355
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2", children: [
356
356
  /* @__PURE__ */ e(
357
357
  "h3",
358
358
  {
@@ -363,11 +363,11 @@ const ne = ({
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
- /* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
368
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
369
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 })
370
+ 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 })
371
371
  ] })
372
372
  ] })
373
373
  ] })
@@ -379,9 +379,9 @@ const ne = ({
379
379
  showStartConversation: n = !1,
380
380
  onStartConversation: l,
381
381
  participantLabel: i = "participants",
382
- className: d
382
+ className: c
383
383
  }) => {
384
- var m;
384
+ var h;
385
385
  const a = X.useRef(0);
386
386
  a.current++;
387
387
  const { debug: r = !1 } = ee();
@@ -396,25 +396,25 @@ const ne = ({
396
396
  renderCount: a.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: (h = o == null ? void 0 : o.wsConnection) == null ? void 0 : h.isHealthy
400
400
  });
401
401
  const x = X.useMemo(() => {
402
- const E = o.userID, h = E ? { type: "messaging", members: { $in: [E] }, hidden: !1 } : { type: "messaging" };
402
+ const E = o.userID, m = E ? { type: "messaging", members: { $in: [E] }, hidden: !1 } : { type: "messaging" };
403
403
  return r && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ” FILTERS MEMOIZED", {
404
404
  renderCount: a.current,
405
405
  userId: E,
406
- filters: h
407
- }), h;
406
+ filters: m
407
+ }), m;
408
408
  }, [o.userID, r]);
409
- return /* @__PURE__ */ c(
409
+ return /* @__PURE__ */ d(
410
410
  "div",
411
411
  {
412
412
  className: T(
413
413
  "messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
414
- d
414
+ c
415
415
  ),
416
416
  children: [
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: [
417
+ /* @__PURE__ */ e("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: /* @__PURE__ */ d("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
420
  se,
@@ -438,11 +438,11 @@ const ne = ({
438
438
  sort: { last_message_at: -1 },
439
439
  options: { limit: 30 },
440
440
  Preview: (E) => {
441
- var h, w;
441
+ var m, C;
442
442
  return r && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
443
- channelId: (h = E.channel) == null ? void 0 : h.id,
443
+ channelId: (m = E.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) === ((C = E.channel) == null ? void 0 : C.id)
446
446
  }), /* @__PURE__ */ e(
447
447
  je,
448
448
  {
@@ -479,19 +479,19 @@ const ne = ({
479
479
  function fe({ onClick: t }) {
480
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" }) });
481
481
  }
482
- const Ae = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "message-input flex items-center gap-2 p-4", children: [
482
+ const Ae = ({ renderActions: t }) => /* @__PURE__ */ d("div", { className: "message-input flex items-center gap-2 p-4", children: [
483
483
  t && t(),
484
484
  /* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ e(Te, { focus: !0, maxRows: 4 }) })
485
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) => {
486
+ var o, x, h, E;
487
+ const { channel: i } = ue(), c = X.useMemo(() => Object.values(i.state.members || {}).find(
488
+ (C) => {
489
489
  var u;
490
- return ((u = w.user) == null ? void 0 : u.id) && w.user.id !== i._client.userID;
490
+ return ((u = C.user) == null ? void 0 : u.id) && C.user.id !== i._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;
493
- return /* @__PURE__ */ c("div", { className: "flex items-center justify-between gap-3 min-h-12", children: [
494
- /* @__PURE__ */ c("div", { className: "flex items-center gap-3 min-w-0", children: [
492
+ ), [i._client.userID, i.state.members]), a = ((o = c == null ? void 0 : c.user) == null ? void 0 : o.name) || ((x = c == null ? void 0 : c.user) == null ? void 0 : x.id) || "Unknown member", r = (h = c == null ? void 0 : c.user) == null ? void 0 : h.image;
493
+ return /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-3 min-h-12", children: [
494
+ /* @__PURE__ */ d("div", { className: "flex items-center gap-3 min-w-0", children: [
495
495
  s && t && /* @__PURE__ */ e(
496
496
  "button",
497
497
  {
@@ -505,7 +505,7 @@ const Ae = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
505
505
  /* @__PURE__ */ e(
506
506
  ne,
507
507
  {
508
- id: ((E = d == null ? void 0 : d.user) == null ? void 0 : E.id) || i.id || "unknown",
508
+ id: ((E = c == null ? void 0 : c.user) == null ? void 0 : E.id) || i.id || "unknown",
509
509
  name: a,
510
510
  image: r,
511
511
  size: 40
@@ -521,16 +521,16 @@ const Ae = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
521
521
  participant: n,
522
522
  channel: l,
523
523
  followerStatusLabel: i,
524
- onLeaveConversation: d,
524
+ onLeaveConversation: c,
525
525
  onBlockParticipant: a
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);
527
+ var F, j, _, Q, V, z, q;
528
+ const { service: r, debug: o } = ee(), x = G(null), [h, E] = I(!1), [m, C] = I(!1), [u, w] = I(!1);
529
529
  $(() => {
530
530
  const S = x.current;
531
531
  S && (t ? S.showModal() : S.close());
532
532
  }, [t]);
533
- const N = O(async () => {
533
+ const v = O(async () => {
534
534
  var S;
535
535
  if (!(!r || !((S = n == null ? void 0 : n.user) != null && S.id)))
536
536
  try {
@@ -547,45 +547,45 @@ const Ae = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
547
547
  L
548
548
  );
549
549
  }
550
- }, [r, (p = n == null ? void 0 : n.user) == null ? void 0 : p.id]);
550
+ }, [r, (F = n == null ? void 0 : n.user) == null ? void 0 : F.id]);
551
551
  $(() => {
552
- t && N();
553
- }, [t, N]);
552
+ t && v();
553
+ }, [t, v]);
554
554
  const D = async () => {
555
555
  var S;
556
- if (!h) {
557
- o && console.log("[ChannelInfoDialog] Leave conversation", l.cid), w(!0);
556
+ if (!m) {
557
+ o && console.log("[ChannelInfoDialog] Leave conversation", l.cid), C(!0);
558
558
  try {
559
559
  const L = ((S = l._client) == null ? void 0 : S.userID) ?? null;
560
- await l.hide(L, !1), d && await d(l), s();
560
+ await l.hide(L, !1), c && await c(l), s();
561
561
  } catch (L) {
562
562
  console.error("[ChannelInfoDialog] Failed to leave conversation", L);
563
563
  } finally {
564
- w(!1);
564
+ C(!1);
565
565
  }
566
566
  }
567
567
  }, M = async () => {
568
568
  var S, L, A;
569
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);
570
+ o && console.log("[ChannelInfoDialog] Block member", (S = n == null ? void 0 : n.user) == null ? void 0 : S.id), w(!0);
571
571
  try {
572
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
573
  } catch (W) {
574
574
  console.error("[ChannelInfoDialog] Failed to block member", W);
575
575
  } finally {
576
- v(!1);
576
+ w(!1);
577
577
  }
578
578
  }
579
579
  }, R = async () => {
580
580
  var S, L, A;
581
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);
582
+ o && console.log("[ChannelInfoDialog] Unblock member", (S = n == null ? void 0 : n.user) == null ? void 0 : S.id), w(!0);
583
583
  try {
584
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
585
  } catch (W) {
586
586
  console.error("[ChannelInfoDialog] Failed to unblock member", W);
587
587
  } finally {
588
- v(!1);
588
+ w(!1);
589
589
  }
590
590
  }
591
591
  }, k = () => {
@@ -596,7 +596,7 @@ 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 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, b = (z = n.user) == null ? void 0 : z.username, y = g || (b ? `linktr.ee/${b}` : void 0), B = ((q = n.user) == null ? void 0 : q.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(
@@ -608,13 +608,13 @@ const Ae = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
608
608
  onClick: (S) => {
609
609
  S.target === x.current && s();
610
610
  },
611
- children: /* @__PURE__ */ c("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
612
- /* @__PURE__ */ c("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
611
+ children: /* @__PURE__ */ d("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-max-elevation-light", children: [
612
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
613
613
  /* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
614
614
  /* @__PURE__ */ e(fe, { onClick: s })
615
615
  ] }),
616
- /* @__PURE__ */ c("div", { className: "flex-1 overflow-y-auto px-6 py-6", children: [
617
- /* @__PURE__ */ e("div", { className: "rounded-2xl bg-chalk p-4", children: /* @__PURE__ */ c("div", { className: "flex items-center gap-4", children: [
616
+ /* @__PURE__ */ d("div", { className: "flex-1 overflow-y-auto px-6 py-6", children: [
617
+ /* @__PURE__ */ e("div", { className: "rounded-2xl bg-chalk p-4", children: /* @__PURE__ */ d("div", { className: "flex items-center gap-4", children: [
618
618
  /* @__PURE__ */ e(
619
619
  ne,
620
620
  {
@@ -624,26 +624,26 @@ const Ae = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
624
624
  size: 64
625
625
  }
626
626
  ),
627
- /* @__PURE__ */ c("div", { className: "min-w-0 flex-1", children: [
627
+ /* @__PURE__ */ d("div", { className: "min-w-0 flex-1", children: [
628
628
  /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: P }),
629
629
  y && /* @__PURE__ */ e("p", { className: "truncate text-sm text-stone", children: y }),
630
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 })
631
631
  ] })
632
632
  ] }) }),
633
- /* @__PURE__ */ c("ul", { className: "flex flex-col gap-2 mt-2", children: [
634
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ c(
633
+ /* @__PURE__ */ d("ul", { className: "flex flex-col gap-2 mt-2", children: [
634
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(
635
635
  J,
636
636
  {
637
637
  onClick: D,
638
- disabled: h,
639
- "aria-busy": h,
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(K, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Oe, { 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(
646
+ /* @__PURE__ */ e("li", { children: h ? /* @__PURE__ */ d(
647
647
  J,
648
648
  {
649
649
  onClick: R,
@@ -654,7 +654,7 @@ const Ae = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
654
654
  /* @__PURE__ */ e("span", { children: "Unblock" })
655
655
  ]
656
656
  }
657
- ) : /* @__PURE__ */ c(
657
+ ) : /* @__PURE__ */ d(
658
658
  J,
659
659
  {
660
660
  onClick: M,
@@ -666,7 +666,7 @@ const Ae = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
666
666
  ]
667
667
  }
668
668
  ) }),
669
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ c(J, { variant: "danger", onClick: k, children: [
669
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ d(J, { variant: "danger", onClick: k, children: [
670
670
  /* @__PURE__ */ e(Ue, { className: "h-5 w-5" }),
671
671
  /* @__PURE__ */ e("span", { children: "Report" })
672
672
  ] }) })
@@ -682,33 +682,39 @@ const Ae = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
682
682
  renderMessageInputActions: n,
683
683
  onLeaveConversation: l,
684
684
  onBlockParticipant: i,
685
- CustomChannelEmptyState: d
685
+ CustomChannelEmptyState: c
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 E, m;
688
+ const { channel: a } = ue(), [r, o] = I(!1);
689
+ (((m = (E = a == null ? void 0 : a.state) == null ? void 0 : E.messages) == null ? void 0 : m.length) ?? 0) > 0;
690
+ const x = X.useMemo(() => Object.values(a.state.members || {}).find(
691
+ (u) => {
692
+ var w;
693
+ return ((w = u.user) == null ? void 0 : w.id) && u.user.id !== a._client.userID;
692
694
  }
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;
695
+ ), [a._client.userID, a.state.members]), h = X.useMemo(() => {
696
+ const C = a.data ?? {};
697
+ return C.followerStatus ? String(C.followerStatus) : C.isFollower ? "Subscribed to you" : void 0;
696
698
  }, [a.data]);
697
- return /* @__PURE__ */ c(oe, { children: [
698
- /* @__PURE__ */ c(Re, { children: [
699
+ return /* @__PURE__ */ d(oe, { children: [
700
+ /* @__PURE__ */ d(Re, { children: [
699
701
  /* @__PURE__ */ e("div", { className: "border-b border-sand bg-white px-4 py-3", children: /* @__PURE__ */ e(
700
702
  He,
701
703
  {
702
704
  onBack: t,
703
705
  showBackButton: s,
704
706
  onShowInfo: () => o(!0),
705
- canShowInfo: !!m
707
+ canShowInfo: !!x
708
+ }
709
+ ) }),
710
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ e(
711
+ ke,
712
+ {
713
+ hideDeletedMessages: !0,
714
+ hideNewMessageSeparator: !1,
715
+ EmptyStateIndicator: c ? () => /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(c, {}) }) : void 0
706
716
  }
707
717
  ) }),
708
- /* @__PURE__ */ c("div", { className: "flex-1 overflow-hidden", children: [
709
- /* @__PURE__ */ e(ke, { hideDeletedMessages: !0, hideNewMessageSeparator: !1 }),
710
- x === !1 && d && /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(d, {}) })
711
- ] }),
712
718
  /* @__PURE__ */ e(
713
719
  Ae,
714
720
  {
@@ -721,9 +727,9 @@ const Ae = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
721
727
  {
722
728
  isOpen: r,
723
729
  onClose: () => o(!1),
724
- participant: m,
730
+ participant: x,
725
731
  channel: a,
726
- followerStatusLabel: E,
732
+ followerStatusLabel: h,
727
733
  onLeaveConversation: l,
728
734
  onBlockParticipant: i
729
735
  }
@@ -735,7 +741,7 @@ const Ae = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
735
741
  showBackButton: n = !1,
736
742
  renderMessageInputActions: l,
737
743
  onLeaveConversation: i,
738
- onBlockParticipant: d,
744
+ onBlockParticipant: c,
739
745
  className: a,
740
746
  CustomChannelEmptyState: r
741
747
  }) => /* @__PURE__ */ e(
@@ -752,7 +758,7 @@ const Ae = ({ renderActions: t }) => /* @__PURE__ */ c("div", { className: "mess
752
758
  showBackButton: n,
753
759
  renderMessageInputActions: l,
754
760
  onLeaveConversation: i,
755
- onBlockParticipant: d,
761
+ onBlockParticipant: c,
756
762
  CustomChannelEmptyState: r
757
763
  }
758
764
  ) })
@@ -764,7 +770,7 @@ function Ve({
764
770
  placeholder: n
765
771
  }) {
766
772
  const l = G(null);
767
- return /* @__PURE__ */ c("div", { className: "relative", children: [
773
+ return /* @__PURE__ */ d("div", { className: "relative", children: [
768
774
  /* @__PURE__ */ e(
769
775
  Le,
770
776
  {
@@ -803,10 +809,10 @@ const We = ({
803
809
  onClose: n,
804
810
  existingParticipantIds: l = /* @__PURE__ */ new Set(),
805
811
  participantLabel: i = "participants",
806
- searchPlaceholder: d = "Search participants...",
812
+ searchPlaceholder: c = "Search participants...",
807
813
  className: a
808
814
  }) => {
809
- const { debug: r } = ee(), [o, x] = I(""), [m, E] = I([]), [h, w] = I(!1), [u, v] = I(null), [N, D] = I(
815
+ const { debug: r } = ee(), [o, x] = I(""), [h, E] = I([]), [m, C] = I(!1), [u, w] = I(null), [v, D] = I(
810
816
  null
811
817
  ), M = G(!1);
812
818
  $(() => {
@@ -818,7 +824,7 @@ const We = ({
818
824
  }
819
825
  if (M.current) return;
820
826
  (async () => {
821
- r && console.log("[ParticipantPicker] Loading initial participants..."), w(!0), v(null);
827
+ r && console.log("[ParticipantPicker] Loading initial participants..."), C(!0), w(null);
822
828
  try {
823
829
  const g = await t.loadParticipants({
824
830
  search: "",
@@ -830,21 +836,21 @@ const We = ({
830
836
  g.participants.length
831
837
  );
832
838
  } 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);
839
+ const b = g instanceof Error ? g.message : "Failed to load participants";
840
+ w(b), console.error("[ParticipantPicker] Failed to load participants:", g);
835
841
  } finally {
836
- w(!1);
842
+ C(!1);
837
843
  }
838
844
  })();
839
845
  }, [t.loading, r]);
840
- const R = m.filter((f) => !l.has(f.id)).filter((f) => {
841
- var C;
846
+ const R = h.filter((f) => !l.has(f.id)).filter((f) => {
847
+ var b;
842
848
  if (!o) return !0;
843
849
  const g = o.toLowerCase();
844
- return f.name.toLowerCase().includes(g) || ((C = f.email) == null ? void 0 : C.toLowerCase().includes(g)) || !1;
850
+ return f.name.toLowerCase().includes(g) || ((b = f.email) == null ? void 0 : b.toLowerCase().includes(g)) || !1;
845
851
  }), k = O(
846
852
  async (f) => {
847
- if (!N) {
853
+ if (!v) {
848
854
  D(f.id);
849
855
  try {
850
856
  await s(f);
@@ -853,17 +859,17 @@ const We = ({
853
859
  }
854
860
  }
855
861
  },
856
- [s, N]
862
+ [s, v]
857
863
  ), P = (f, g) => {
858
864
  (f.key === "Enter" || f.key === " ") && (f.preventDefault(), k(g));
859
865
  };
860
- return /* @__PURE__ */ c("div", { className: T("flex flex-col h-full", a), children: [
861
- /* @__PURE__ */ c("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
862
- /* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-3", children: [
866
+ return /* @__PURE__ */ d("div", { className: T("flex flex-col h-full", a), children: [
867
+ /* @__PURE__ */ d("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
868
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between mb-3", children: [
863
869
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
864
870
  /* @__PURE__ */ e(fe, { onClick: n })
865
871
  ] }),
866
- /* @__PURE__ */ c("p", { className: "text-xs text-stone mb-3", children: [
872
+ /* @__PURE__ */ d("p", { className: "text-xs text-stone mb-3", children: [
867
873
  "Select a ",
868
874
  i.slice(0, -1),
869
875
  " to start messaging (",
@@ -876,30 +882,30 @@ const We = ({
876
882
  {
877
883
  searchQuery: o,
878
884
  setSearchQuery: x,
879
- placeholder: d
885
+ placeholder: c
880
886
  }
881
887
  )
882
888
  ] }),
883
- u && /* @__PURE__ */ c("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
889
+ u && /* @__PURE__ */ d("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
884
890
  "Error loading ",
885
891
  i,
886
892
  ": ",
887
893
  u
888
894
  ] }),
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: [
895
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: m && R.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: [
890
896
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
891
- /* @__PURE__ */ c("span", { className: "text-sm text-stone", children: [
897
+ /* @__PURE__ */ d("span", { className: "text-sm text-stone", children: [
892
898
  "Loading ",
893
899
  i,
894
900
  "..."
895
901
  ] })
896
- ] }) }) : R.length === 0 ? /* @__PURE__ */ c("div", { className: "p-6 text-center", children: [
902
+ ] }) }) : R.length === 0 ? /* @__PURE__ */ d("div", { className: "p-6 text-center", children: [
897
903
  /* @__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` })
900
- ] }) : /* @__PURE__ */ c("ul", { className: "space-y-0", children: [
904
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: o ? `No ${i} found` : h.length > 0 ? `Already chatting with all ${i}` : `No ${i} yet` }),
905
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: o ? "Try a different search term" : h.length > 0 ? `You have existing conversations with all your ${i}` : `${i.charAt(0).toUpperCase() + i.slice(1)} will appear here` })
906
+ ] }) : /* @__PURE__ */ d("ul", { className: "space-y-0", children: [
901
907
  R.map((f) => {
902
- const g = f.name || f.email || f.id, C = f.email && f.name ? f.email : f.phone;
908
+ const g = f.name || f.email || f.id, b = f.email && f.name ? f.email : f.phone;
903
909
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
904
910
  "button",
905
911
  {
@@ -907,8 +913,8 @@ const We = ({
907
913
  onClick: () => k(f),
908
914
  onKeyDown: (y) => P(y, f),
909
915
  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
- children: /* @__PURE__ */ c("div", { className: "flex items-center justify-between", children: [
911
- /* @__PURE__ */ c("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
916
+ children: /* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
917
+ /* @__PURE__ */ d("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
912
918
  /* @__PURE__ */ e(
913
919
  ne,
914
920
  {
@@ -918,35 +924,35 @@ const We = ({
918
924
  size: 40
919
925
  }
920
926
  ),
921
- /* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
927
+ /* @__PURE__ */ d("div", { className: "flex-1 min-w-0", children: [
922
928
  /* @__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 })
929
+ b && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: b })
924
930
  ] })
925
931
  ] }),
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" }) })
932
+ /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: v === f.id ? /* @__PURE__ */ e(K, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(ce, { className: "h-5 w-5 text-stone" }) })
927
933
  ] })
928
934
  }
929
935
  ) }, f.id);
930
936
  }),
931
- h && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
937
+ m && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ d("div", { className: "flex items-center space-x-2", children: [
932
938
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
933
939
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
934
940
  ] }) })
935
941
  ] }) })
936
942
  ] });
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: [
943
+ }, 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: [
938
944
  /* @__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
945
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal", children: "Welcome to Messages" }),
940
- /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */ c(oe, { children: [
946
+ /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t ? /* @__PURE__ */ d(oe, { children: [
941
947
  "Choose a conversation from the list or",
942
948
  " ",
943
- s && /* @__PURE__ */ c(de, { onClick: s, children: [
949
+ s && /* @__PURE__ */ d(de, { onClick: s, children: [
944
950
  "start a new conversation with a ",
945
951
  n.slice(0, -1),
946
952
  "."
947
953
  ] })
948
- ] }) : s && /* @__PURE__ */ c(oe, { children: [
949
- /* @__PURE__ */ c(de, { onClick: s, children: [
954
+ ] }) : s && /* @__PURE__ */ d(oe, { children: [
955
+ /* @__PURE__ */ d(de, { onClick: s, children: [
950
956
  "Start a new conversation with one of your ",
951
957
  n
952
958
  ] }),
@@ -964,7 +970,7 @@ const We = ({
964
970
  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",
965
971
  children: s
966
972
  }
967
- ), le = ({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ c("div", { className: "text-center max-w-sm", children: [
973
+ ), le = ({ 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: [
968
974
  /* @__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: "โš ๏ธ" }) }),
969
975
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
970
976
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
@@ -977,12 +983,12 @@ const We = ({
977
983
  children: "Go Back"
978
984
  }
979
985
  )
980
- ] }) }), qe = ({ className: t, message: s }) => /* @__PURE__ */ c(
986
+ ] }) }), qe = ({ className: t, message: s }) => /* @__PURE__ */ d(
981
987
  "div",
982
988
  {
983
989
  className: T("flex items-center justify-center h-full", t),
984
990
  children: [
985
- /* @__PURE__ */ c("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
991
+ /* @__PURE__ */ d("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
986
992
  /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
987
993
  "animateTransform",
988
994
  {
@@ -1020,7 +1026,7 @@ const We = ({
1020
1026
  s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
1021
1027
  ]
1022
1028
  }
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: [
1029
+ ), Xe = () => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ d("div", { className: "flex items-center", children: [
1024
1030
  /* @__PURE__ */ e(qe, { className: "w-6 h-6" }),
1025
1031
  /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
1026
1032
  ] }) }), ts = ({
@@ -1029,75 +1035,75 @@ const We = ({
1029
1035
  renderMessageInputActions: n,
1030
1036
  onChannelSelect: l,
1031
1037
  onParticipantSelect: i,
1032
- initialParticipantFilter: d,
1038
+ initialParticipantFilter: c,
1033
1039
  initialParticipantData: a,
1034
1040
  CustomChannelEmptyState: r
1035
1041
  }) => {
1036
1042
  const {
1037
1043
  service: o,
1038
1044
  client: x,
1039
- isConnected: m,
1045
+ isConnected: h,
1040
1046
  isLoading: E,
1041
- error: h,
1042
- refreshConnection: w,
1047
+ error: m,
1048
+ refreshConnection: C,
1043
1049
  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), {
1050
+ } = pe(), [w, v] = I(null), [D, M] = I(!1), [R, k] = I(!1), [P, f] = I(/* @__PURE__ */ new Set()), [g, b] = I(0), [y, B] = I(!1), [F, j] = I(null), _ = G(null), {
1045
1051
  showStartConversation: Q = !1,
1046
1052
  participantSource: V,
1047
1053
  participantLabel: z = "participants"
1048
1054
  } = t, q = G(null), S = O(async () => {
1049
- if (!x || !m) return;
1050
- const b = x.userID;
1051
- if (b)
1055
+ if (!x || !h) return;
1056
+ const N = x.userID;
1057
+ if (N)
1052
1058
  try {
1053
- u && console.log("[MessagingShell] Syncing channels for user:", b);
1054
- const F = await x.queryChannels(
1059
+ u && console.log("[MessagingShell] Syncing channels for user:", N);
1060
+ const p = await x.queryChannels(
1055
1061
  {
1056
1062
  type: "messaging",
1057
- members: { $in: [b] }
1063
+ members: { $in: [N] }
1058
1064
  },
1059
1065
  {},
1060
1066
  { limit: 100 }
1061
1067
  ), U = /* @__PURE__ */ new Set();
1062
- F.forEach((H) => {
1068
+ p.forEach((H) => {
1063
1069
  const Ne = H.state.members;
1064
1070
  Object.values(Ne).forEach((be) => {
1065
1071
  var ae;
1066
1072
  const re = (ae = be.user) == null ? void 0 : ae.id;
1067
- re && re !== b && U.add(re);
1073
+ re && re !== N && U.add(re);
1068
1074
  });
1069
- }), f(U), M(F.length > 0), q.current = b, u && console.log("[MessagingShell] Channels synced successfully:", {
1070
- channelCount: F.length,
1075
+ }), f(U), M(p.length > 0), q.current = N, u && console.log("[MessagingShell] Channels synced successfully:", {
1076
+ channelCount: p.length,
1071
1077
  memberCount: U.size
1072
1078
  });
1073
- } catch (F) {
1074
- console.error("[MessagingShell] Failed to sync channels:", F);
1079
+ } catch (p) {
1080
+ console.error("[MessagingShell] Failed to sync channels:", p);
1075
1081
  }
1076
- }, [x, m, u]);
1082
+ }, [x, h, u]);
1077
1083
  $(() => {
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;
1084
+ if (!x || !h) return;
1085
+ const N = x.userID;
1086
+ N && q.current !== N && S();
1087
+ }, [x, h, S]), $(() => {
1088
+ if (!c || !x || !h) return;
1083
1089
  (async () => {
1084
- const F = x.userID;
1085
- if (F)
1090
+ const p = x.userID;
1091
+ if (p)
1086
1092
  try {
1087
1093
  u && console.log(
1088
1094
  "[MessagingShell] Loading initial conversation with:",
1089
- d
1095
+ c
1090
1096
  );
1091
1097
  const U = await x.queryChannels(
1092
1098
  {
1093
1099
  type: "messaging",
1094
- members: { $eq: [F, d] }
1100
+ members: { $eq: [p, c] }
1095
1101
  },
1096
1102
  {},
1097
1103
  { limit: 1 }
1098
1104
  );
1099
1105
  if (U.length > 0)
1100
- N(U[0]), B(!0), j(null), l && l(U[0]), u && console.log(
1106
+ v(U[0]), B(!0), j(null), l && l(U[0]), u && console.log(
1101
1107
  "[MessagingShell] Initial conversation loaded:",
1102
1108
  U[0].id
1103
1109
  );
@@ -1113,7 +1119,7 @@ const We = ({
1113
1119
  email: a.email,
1114
1120
  phone: a.phone
1115
1121
  });
1116
- N(H), B(!0), j(null), l && l(H), u && console.log(
1122
+ v(H), B(!0), j(null), l && l(H), u && console.log(
1117
1123
  "[MessagingShell] Channel created and loaded:",
1118
1124
  H.id
1119
1125
  );
@@ -1128,7 +1134,7 @@ const We = ({
1128
1134
  "No conversation found with this account"
1129
1135
  ), u && console.log(
1130
1136
  "[MessagingShell] No conversation found for:",
1131
- d
1137
+ c
1132
1138
  );
1133
1139
  } catch (U) {
1134
1140
  console.error(
@@ -1138,71 +1144,71 @@ const We = ({
1138
1144
  }
1139
1145
  })();
1140
1146
  }, [
1141
- d,
1147
+ c,
1142
1148
  a,
1143
1149
  x,
1144
- m,
1150
+ h,
1145
1151
  o,
1146
1152
  u,
1147
1153
  l
1148
1154
  ]);
1149
1155
  const L = O(
1150
- (b) => {
1151
- N(b), l == null || l(b);
1156
+ (N) => {
1157
+ v(N), l == null || l(N);
1152
1158
  },
1153
1159
  [l]
1154
1160
  ), A = O(() => {
1155
- y || N(null);
1161
+ y || v(null);
1156
1162
  }, [y]), W = O(() => {
1157
- var b;
1158
- V && (C((F) => F + 1), k(!0), (b = _.current) == null || b.showModal());
1163
+ var N;
1164
+ V && (b((p) => p + 1), k(!0), (N = _.current) == null || N.showModal());
1159
1165
  }, [V]), Z = O(
1160
- async (b) => {
1161
- var F;
1166
+ async (N) => {
1167
+ var p;
1162
1168
  if (o)
1163
1169
  try {
1164
1170
  u && console.log(
1165
1171
  "[MessagingShell] Starting conversation with:",
1166
- b.id
1172
+ N.id
1167
1173
  );
1168
1174
  const U = await o.startChannelWithParticipant({
1169
- id: b.id,
1170
- name: b.name,
1171
- email: b.email,
1172
- phone: b.phone
1175
+ id: N.id,
1176
+ name: N.name,
1177
+ email: N.email,
1178
+ phone: N.phone
1173
1179
  });
1174
1180
  try {
1175
1181
  await U.show();
1176
1182
  } catch (H) {
1177
1183
  console.warn("[MessagingShell] Failed to unhide channel:", H);
1178
1184
  }
1179
- N(U), k(!1), (F = _.current) == null || F.close(), i == null || i(b);
1185
+ v(U), k(!1), (p = _.current) == null || p.close(), i == null || i(N);
1180
1186
  } catch (U) {
1181
1187
  console.error("[MessagingShell] Failed to start conversation:", U);
1182
1188
  }
1183
1189
  },
1184
1190
  [o, i, u]
1185
1191
  ), te = O(() => {
1186
- var b;
1187
- k(!1), (b = _.current) == null || b.close();
1192
+ var N;
1193
+ k(!1), (N = _.current) == null || N.close();
1188
1194
  }, []), ge = O(
1189
- async (b) => {
1190
- u && console.log("[MessagingShell] Leaving conversation:", b.id), N(null), B(!1), q.current = null, await S();
1195
+ async (N) => {
1196
+ u && console.log("[MessagingShell] Leaving conversation:", N.id), v(null), B(!1), q.current = null, await S();
1191
1197
  },
1192
1198
  [S, u]
1193
1199
  ), xe = O(
1194
- async (b) => {
1195
- u && console.log("[MessagingShell] Blocking participant:", b), N(null), B(!1), q.current = null, await S();
1200
+ async (N) => {
1201
+ u && console.log("[MessagingShell] Blocking participant:", N), v(null), B(!1), q.current = null, await S();
1196
1202
  },
1197
1203
  [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(
1204
+ ), Y = !!w;
1205
+ return E ? /* @__PURE__ */ e("div", { className: T("h-full", s), children: /* @__PURE__ */ e(Xe, {}) }) : m ? /* @__PURE__ */ e("div", { className: T("h-full", s), children: /* @__PURE__ */ e(le, { message: m, onBack: C }) }) : !h || !x ? /* @__PURE__ */ e("div", { className: T("h-full", s), children: /* @__PURE__ */ e(
1200
1206
  le,
1201
1207
  {
1202
1208
  message: "Not connected to messaging service",
1203
- onBack: w
1209
+ onBack: C
1204
1210
  }
1205
- ) }) : p ? /* @__PURE__ */ e("div", { className: T("h-full", s), children: /* @__PURE__ */ e(le, { message: p }) }) : /* @__PURE__ */ c(
1211
+ ) }) : F ? /* @__PURE__ */ e("div", { className: T("h-full", s), children: /* @__PURE__ */ e(le, { message: F }) }) : /* @__PURE__ */ d(
1206
1212
  "div",
1207
1213
  {
1208
1214
  className: T(
@@ -1210,7 +1216,7 @@ const We = ({
1210
1216
  s
1211
1217
  ),
1212
1218
  children: [
1213
- /* @__PURE__ */ c("div", { className: "flex h-full min-h-0", children: [
1219
+ /* @__PURE__ */ d("div", { className: "flex h-full min-h-0", children: [
1214
1220
  /* @__PURE__ */ e(
1215
1221
  "div",
1216
1222
  {
@@ -1229,7 +1235,7 @@ const We = ({
1229
1235
  Be,
1230
1236
  {
1231
1237
  onChannelSelect: L,
1232
- selectedChannel: v || void 0,
1238
+ selectedChannel: w || void 0,
1233
1239
  showStartConversation: Q && !!V,
1234
1240
  onStartConversation: W,
1235
1241
  participantLabel: z
@@ -1249,10 +1255,10 @@ const We = ({
1249
1255
  "hidden lg:flex": !y && !Y
1250
1256
  }
1251
1257
  ),
1252
- children: v ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1258
+ children: w ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1253
1259
  _e,
1254
1260
  {
1255
- channel: v,
1261
+ channel: w,
1256
1262
  onBack: A,
1257
1263
  showBackButton: !y,
1258
1264
  renderMessageInputActions: n,
@@ -1260,7 +1266,7 @@ const We = ({
1260
1266
  onBlockParticipant: xe,
1261
1267
  CustomChannelEmptyState: r
1262
1268
  },
1263
- v.id
1269
+ w.id
1264
1270
  ) }) : /* @__PURE__ */ e(
1265
1271
  ze,
1266
1272
  {
@@ -1278,8 +1284,8 @@ const We = ({
1278
1284
  {
1279
1285
  ref: _,
1280
1286
  className: "mes-dialog",
1281
- onClick: (b) => {
1282
- b.target === _.current && te();
1287
+ onClick: (N) => {
1288
+ N.target === _.current && te();
1283
1289
  },
1284
1290
  onClose: te,
1285
1291
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
@@ -1327,10 +1333,10 @@ const We = ({
1327
1333
  headerText: l,
1328
1334
  className: i
1329
1335
  }) => {
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: [
1336
+ const c = t.filter((a) => a.enabled).sort((a, r) => (a.order ?? 0) - (r.order ?? 0));
1337
+ return c.length === 0 ? null : /* @__PURE__ */ d("div", { className: T("px-4 py-6 space-y-3", i), children: [
1332
1338
  l && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: l }),
1333
- d.map((a) => /* @__PURE__ */ e(
1339
+ c.map((a) => /* @__PURE__ */ e(
1334
1340
  Qe,
1335
1341
  {
1336
1342
  question: a.question,
@@ -1341,9 +1347,9 @@ const We = ({
1341
1347
  ))
1342
1348
  ] });
1343
1349
  }, 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) => {
1350
+ const { initialSearch: n = "", pageSize: l = 20 } = s, [i, c] = I([]), [a, r] = I(!1), [o, x] = I(null), [h, E] = I(n), [m, C] = I(!0), [u, w] = I(), v = O(async (k = !1, P) => {
1345
1351
  if (a) return;
1346
- const f = P !== void 0 ? P : m;
1352
+ const f = P !== void 0 ? P : h;
1347
1353
  r(!0), x(null);
1348
1354
  try {
1349
1355
  const g = await t.loadParticipants({
@@ -1351,30 +1357,30 @@ const We = ({
1351
1357
  limit: l,
1352
1358
  cursor: k ? void 0 : u
1353
1359
  });
1354
- d(
1355
- (C) => k ? g.participants : [...C, ...g.participants]
1356
- ), w(g.hasMore), v(g.nextCursor);
1360
+ c(
1361
+ (b) => k ? g.participants : [...b, ...g.participants]
1362
+ ), C(g.hasMore), w(g.nextCursor);
1357
1363
  } catch (g) {
1358
- const C = g instanceof Error ? g.message : "Failed to load participants";
1359
- x(C), console.error("[useParticipants] Load error:", g);
1364
+ const b = g instanceof Error ? g.message : "Failed to load participants";
1365
+ x(b), console.error("[useParticipants] Load error:", g);
1360
1366
  } finally {
1361
1367
  r(!1);
1362
1368
  }
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]);
1369
+ }, [t, h, u, l, a]), D = O(() => {
1370
+ m && !a && v(!1);
1371
+ }, [m, a, v]), M = O((k) => {
1372
+ E(k), w(void 0), v(!0, k);
1373
+ }, [v]), R = O(() => {
1374
+ w(void 0), v(!0);
1375
+ }, [v]);
1370
1376
  return $(() => {
1371
- N(!0);
1377
+ v(!0);
1372
1378
  }, [t.loadParticipants]), {
1373
1379
  participants: i,
1374
1380
  loading: a,
1375
1381
  error: o,
1376
- searchQuery: m,
1377
- hasMore: h,
1382
+ searchQuery: h,
1383
+ hasMore: m,
1378
1384
  totalCount: t.totalCount,
1379
1385
  loadMore: D,
1380
1386
  search: M,
@@ -1390,7 +1396,7 @@ export {
1390
1396
  ns as MessagingProvider,
1391
1397
  ts as MessagingShell,
1392
1398
  We as ParticipantPicker,
1393
- Fe as useMessaging,
1399
+ pe as useMessaging,
1394
1400
  ls as useParticipants
1395
1401
  };
1396
1402
  //# sourceMappingURL=index.js.map