@linktr.ee/messaging-react 1.12.2-rc-1765320995 โ†’ 1.12.2-rc-1765340127

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { jsx as e, jsxs as i, Fragment as Ce } from "react/jsx-runtime";
2
- import p from "classnames";
3
- import P, { createContext as Ue, useContext as Oe, useCallback as D, useState as y, useRef as z, useEffect as G } from "react";
1
+ import { jsx as e, jsxs as i, Fragment as we } from "react/jsx-runtime";
2
+ import k from "classnames";
3
+ import O, { createContext as Ue, useContext as Pe, useCallback as _, useState as E, useRef as z, useEffect as $ } from "react";
4
4
  import { StreamChatService as je } from "@linktr.ee/messaging-core";
5
- import { Chat as Ae, ChannelList as ze, useMessageComposer as Be, useStateStore as $e, MessageInput as Ge, useMessageInputContext as He, useMessageComposerHasSendableData as Ve, SimpleAttachmentSelector as We, QuotedMessagePreview as Ze, AttachmentPreviewList as qe, TextareaComposer as Ye, MessageTimestamp as Je, Channel as Qe, useChannelStateContext as ve, Window as Xe, MessageList as Ke } from "stream-chat-react";
6
- import { XIcon as ue, ArrowUpIcon as es, SpinnerGapIcon as Q, ArrowLeftIcon as he, DotsThreeIcon as fe, SignOutIcon as ss, ProhibitInsetIcon as ge, FlagIcon as ts, MagnifyingGlassIcon as ns, ChatCircleDotsIcon as xe } from "@phosphor-icons/react";
7
- import { LinkPreviewsManager as Ne } from "stream-chat";
8
- const we = Ue({
5
+ import { Chat as Ae, ChannelList as ze, useMessageComposer as Be, useStateStore as Ge, MessageInput as $e, useMessageInputContext as He, useMessageComposerHasSendableData as Ve, SimpleAttachmentSelector as We, QuotedMessagePreview as Ze, AttachmentPreviewList as qe, TextareaComposer as Ye, MessageTimestamp as Je, Channel as Qe, useChannelStateContext as ve, Window as Xe, MessageList as Ke } from "stream-chat-react";
6
+ import { XIcon as ue, ArrowUpIcon as es, ArrowLeftIcon as fe, DotsThreeIcon as ge, SpinnerGapIcon as re, SignOutIcon as ss, ProhibitInsetIcon as xe, FlagIcon as ts, MagnifyingGlassIcon as ns, ChatCircleDotsIcon as Ne } from "@phosphor-icons/react";
7
+ import { LinkPreviewsManager as Ce } from "stream-chat";
8
+ const ye = Ue({
9
9
  service: null,
10
10
  client: null,
11
11
  isConnected: !1,
@@ -15,17 +15,17 @@ const we = Ue({
15
15
  refreshConnection: async () => {
16
16
  },
17
17
  debug: !1
18
- }), ae = () => Oe(we), Ms = ({
18
+ }), oe = () => Pe(ye), _s = ({
19
19
  children: t,
20
20
  user: s,
21
21
  serviceConfig: n,
22
22
  apiKey: r,
23
- capabilities: a = {},
23
+ capabilities: o = {},
24
24
  debug: d = !1
25
25
  }) => {
26
- const l = D(
27
- (u, ...b) => {
28
- d && console.log(`๐Ÿ”ฅ [MessagingProvider] ${u}`, ...b);
26
+ const l = _(
27
+ (u, ...C) => {
28
+ d && console.log(`๐Ÿ”ฅ [MessagingProvider] ${u}`, ...C);
29
29
  },
30
30
  [d]
31
31
  );
@@ -33,30 +33,30 @@ const we = Ue({
33
33
  userId: s == null ? void 0 : s.id,
34
34
  apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
35
35
  serviceConfig: !!n,
36
- capabilities: Object.keys(a)
36
+ capabilities: Object.keys(o)
37
37
  });
38
- const [m, h] = y(null), [g, w] = y(null), [f, S] = y(!1), [M, v] = y(!1), [c, N] = y(null), E = z(!1), I = z({
38
+ const [m, h] = E(null), [g, v] = E(null), [f, S] = E(!1), [R, w] = E(!1), [c, x] = E(null), y = z(!1), I = z({
39
39
  userId: s == null ? void 0 : s.id,
40
40
  apiKey: r,
41
41
  serviceConfig: n,
42
- capabilities: a
43
- }), k = z(0);
44
- k.current++, l("๐Ÿ“Š RENDER INFO", {
45
- renderCount: k.current,
42
+ capabilities: o
43
+ }), M = z(0);
44
+ M.current++, l("๐Ÿ“Š RENDER INFO", {
45
+ renderCount: M.current,
46
46
  currentProps: { userId: s == null ? void 0 : s.id, apiKey: (r == null ? void 0 : r.substring(0, 8)) + "..." },
47
47
  propChanges: {
48
48
  userChanged: I.current.userId !== (s == null ? void 0 : s.id),
49
49
  apiKeyChanged: I.current.apiKey !== r,
50
50
  serviceConfigChanged: I.current.serviceConfig !== n,
51
- capabilitiesChanged: I.current.capabilities !== a
51
+ capabilitiesChanged: I.current.capabilities !== o
52
52
  }
53
53
  }), I.current = {
54
54
  userId: s == null ? void 0 : s.id,
55
55
  apiKey: r,
56
56
  serviceConfig: n,
57
- capabilities: a
58
- }, G(() => {
59
- const u = k.current;
57
+ capabilities: o
58
+ }, $(() => {
59
+ const u = M.current;
60
60
  if (l("๐Ÿ”ง SERVICE INIT EFFECT TRIGGERED", {
61
61
  renderCount: u,
62
62
  apiKey: !!r,
@@ -79,40 +79,40 @@ const we = Ue({
79
79
  apiKey: (r == null ? void 0 : r.substring(0, 8)) + "...",
80
80
  serviceConfigChanged: I.current.serviceConfig !== n
81
81
  });
82
- const b = new je({
82
+ const C = new je({
83
83
  ...n,
84
84
  apiKey: r,
85
85
  debug: d
86
86
  });
87
- return h(b), l("โœ… SERVICE SET", {
87
+ return h(C), l("โœ… SERVICE SET", {
88
88
  renderCount: u,
89
- serviceInstance: !!b
89
+ serviceInstance: !!C
90
90
  }), () => {
91
91
  l("๐Ÿงน SERVICE CLEANUP", {
92
92
  renderCount: u,
93
93
  reason: "Effect cleanup"
94
- }), b.disconnectUser().catch(console.error);
94
+ }), C.disconnectUser().catch(console.error);
95
95
  };
96
96
  }, [r, n, d, l]);
97
- const x = z(null);
98
- G(() => {
99
- var b, B;
97
+ const N = z(null);
98
+ $(() => {
99
+ var C, B;
100
100
  if (l("๐Ÿ”— USER CONNECTION EFFECT TRIGGERED", {
101
101
  hasService: !!m,
102
102
  hasUser: !!s,
103
103
  userId: s == null ? void 0 : s.id,
104
- isConnecting: E.current,
104
+ isConnecting: y.current,
105
105
  isConnected: f,
106
106
  dependencies: { service: !!m, userId: s == null ? void 0 : s.id }
107
107
  }), !m || !s) {
108
108
  l("โš ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
109
109
  return;
110
110
  }
111
- if (E.current) {
111
+ if (y.current) {
112
112
  l("โš ๏ธ USER CONNECTION SKIPPED", "Already connecting");
113
113
  return;
114
114
  }
115
- if (((b = x.current) == null ? void 0 : b.serviceId) === m && ((B = x.current) == null ? void 0 : B.userId) === s.id) {
115
+ if (((C = N.current) == null ? void 0 : C.serviceId) === m && ((B = N.current) == null ? void 0 : B.userId) === s.id) {
116
116
  l(
117
117
  "โš ๏ธ USER CONNECTION SKIPPED",
118
118
  "Already connected this user with this service"
@@ -120,40 +120,40 @@ const we = Ue({
120
120
  return;
121
121
  }
122
122
  (async () => {
123
- l("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), E.current = !0, v(!0), N(null);
123
+ l("๐Ÿš€ STARTING USER CONNECTION", { userId: s.id }), y.current = !0, w(!0), x(null);
124
124
  try {
125
125
  l("๐Ÿ“ž CALLING SERVICE.CONNECTUSER", { userId: s.id });
126
126
  const j = await m.connectUser(s);
127
- w(j), S(!0), x.current = { serviceId: m, userId: s.id }, l("โœ… USER CONNECTION SUCCESS", {
127
+ v(j), S(!0), N.current = { serviceId: m, userId: s.id }, l("โœ… USER CONNECTION SUCCESS", {
128
128
  userId: s.id,
129
129
  clientId: j.userID
130
130
  });
131
131
  } catch (j) {
132
- const W = j instanceof Error ? j.message : "Connection failed";
133
- N(W), l("โŒ USER CONNECTION ERROR", {
132
+ const Z = j instanceof Error ? j.message : "Connection failed";
133
+ x(Z), l("โŒ USER CONNECTION ERROR", {
134
134
  userId: s.id,
135
- error: W
135
+ error: Z
136
136
  });
137
137
  } finally {
138
- v(!1), E.current = !1, l("๐Ÿ”„ USER CONNECTION FINISHED", {
138
+ w(!1), y.current = !1, l("๐Ÿ”„ USER CONNECTION FINISHED", {
139
139
  userId: s.id,
140
140
  isConnected: f
141
141
  });
142
142
  }
143
143
  })();
144
- }, [m, s, l, f]), G(() => (l("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
144
+ }, [m, s, l, f]), $(() => (l("๐Ÿ”Œ CLEANUP EFFECT REGISTERED", {
145
145
  hasService: !!m,
146
146
  isConnected: f
147
147
  }), () => {
148
148
  m && f ? (l(
149
149
  "๐Ÿงน CLEANUP EFFECT TRIGGERED",
150
150
  "Cleaning up connection on unmount"
151
- ), x.current = null, m.disconnectUser().catch(console.error)) : l("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
151
+ ), N.current = null, m.disconnectUser().catch(console.error)) : l("๐Ÿ”‡ CLEANUP EFFECT SKIPPED", {
152
152
  hasService: !!m,
153
153
  isConnected: f
154
154
  });
155
155
  }), [m, f, l]);
156
- const R = D(async () => {
156
+ const p = _(async () => {
157
157
  if (l("๐Ÿ”„ REFRESH CONNECTION CALLED", {
158
158
  hasService: !!m,
159
159
  hasUser: !!s
@@ -161,52 +161,52 @@ const we = Ue({
161
161
  l("โš ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
162
162
  return;
163
163
  }
164
- l("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), v(!0);
164
+ l("๐Ÿš€ STARTING CONNECTION REFRESH", { userId: s.id }), w(!0);
165
165
  try {
166
166
  l("๐Ÿ”Œ DISCONNECTING FOR REFRESH"), await m.disconnectUser(), l("๐Ÿ“ž RECONNECTING FOR REFRESH");
167
167
  const u = await m.connectUser(s);
168
- w(u), S(!0), N(null), l("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
168
+ v(u), S(!0), x(null), l("โœ… CONNECTION REFRESH SUCCESS", { userId: s.id });
169
169
  } catch (u) {
170
- const b = u instanceof Error ? u.message : "Refresh failed";
171
- N(b), l("โŒ CONNECTION REFRESH ERROR", {
170
+ const C = u instanceof Error ? u.message : "Refresh failed";
171
+ x(C), l("โŒ CONNECTION REFRESH ERROR", {
172
172
  userId: s.id,
173
- error: b
173
+ error: C
174
174
  });
175
175
  } finally {
176
- v(!1), l("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
176
+ w(!1), l("๐Ÿ”„ CONNECTION REFRESH FINISHED", { userId: s.id });
177
177
  }
178
- }, [m, s, l]), o = P.useMemo(() => (l("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
178
+ }, [m, s, l]), a = O.useMemo(() => (l("๐Ÿ’ซ CONTEXT VALUE MEMOIZATION", {
179
179
  hasService: !!m,
180
180
  hasClient: !!g,
181
181
  isConnected: f,
182
- isLoading: M,
182
+ isLoading: R,
183
183
  hasError: !!c,
184
- capabilitiesKeys: Object.keys(a)
184
+ capabilitiesKeys: Object.keys(o)
185
185
  }), {
186
186
  service: m,
187
187
  client: g,
188
188
  isConnected: f,
189
- isLoading: M,
189
+ isLoading: R,
190
190
  error: c,
191
- capabilities: a,
192
- refreshConnection: R,
191
+ capabilities: o,
192
+ refreshConnection: p,
193
193
  debug: d
194
194
  }), [
195
195
  m,
196
196
  g,
197
197
  f,
198
- M,
199
- c,
200
- a,
201
198
  R,
199
+ c,
200
+ o,
201
+ p,
202
202
  d,
203
203
  l
204
204
  ]);
205
205
  return l("๐Ÿ”„ RENDER END", {
206
- renderCount: k.current,
206
+ renderCount: M.current,
207
207
  willRenderChat: !!(g && f),
208
- contextValueReady: !!o
209
- }), /* @__PURE__ */ e(we.Provider, { value: o, children: g && f ? /* @__PURE__ */ e(
208
+ contextValueReady: !!a
209
+ }), /* @__PURE__ */ e(ye.Provider, { value: a, children: g && f ? /* @__PURE__ */ e(
210
210
  Ae,
211
211
  {
212
212
  client: g,
@@ -216,14 +216,14 @@ const we = Ue({
216
216
  children: t
217
217
  }
218
218
  ) : t });
219
- }, rs = () => ae(), ls = (t, s) => {
219
+ }, rs = () => oe(), ls = (t, s) => {
220
220
  const n = new Date(
221
221
  Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
222
- ), a = new Date(
222
+ ), o = new Date(
223
223
  Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
224
224
  ).getTime() - n.getTime();
225
- return Math.floor(a / (1e3 * 60 * 60 * 24));
226
- }, as = (t) => {
225
+ return Math.floor(o / (1e3 * 60 * 60 * 24));
226
+ }, os = (t) => {
227
227
  const s = /* @__PURE__ */ new Date();
228
228
  if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
229
229
  return "Just now";
@@ -264,7 +264,7 @@ const we = Ue({
264
264
  "๐Ÿˆ"
265
265
  // Melon
266
266
  ];
267
- function os(t) {
267
+ function as(t) {
268
268
  let s = 0;
269
269
  for (let n = 0; n < t.length; n++) {
270
270
  const r = t.charCodeAt(n);
@@ -273,24 +273,24 @@ function os(t) {
273
273
  return Math.abs(s);
274
274
  }
275
275
  function is(t) {
276
- const n = os(t) % be.length;
276
+ const n = as(t) % be.length;
277
277
  return be[n];
278
278
  }
279
- const q = ({
279
+ const Y = ({
280
280
  id: t,
281
281
  image: s,
282
282
  size: n = 40,
283
283
  className: r,
284
- shape: a = "squircle"
284
+ shape: o = "squircle"
285
285
  }) => {
286
- const d = is(t), m = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", h = a === "circle" ? { borderRadius: "50%" } : {
286
+ const d = is(t), m = n < 32 ? "text-xs" : n < 56 ? "text-sm" : "text-lg", h = o === "circle" ? { borderRadius: "50%" } : {
287
287
  borderRadius: "33%",
288
288
  "corner-shape": "superellipse(1.3)"
289
289
  };
290
290
  return /* @__PURE__ */ e(
291
291
  "div",
292
292
  {
293
- className: p("flex-shrink-0 overflow-hidden", r),
293
+ className: k("flex-shrink-0 overflow-hidden", r),
294
294
  style: {
295
295
  width: `${n}px`,
296
296
  height: `${n}px`,
@@ -307,7 +307,7 @@ const q = ({
307
307
  "div",
308
308
  {
309
309
  "aria-hidden": "true",
310
- className: p(
310
+ className: k(
311
311
  "avatar-fallback flex h-full w-full items-center justify-center font-semibold bg-[#E6E5E3] select-none transition-colors",
312
312
  m
313
313
  ),
@@ -316,34 +316,34 @@ const q = ({
316
316
  )
317
317
  }
318
318
  );
319
- }, ye = P.memo(
320
- ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: a }) => {
321
- var N, E, I, k, x, R;
319
+ }, Ee = O.memo(
320
+ ({ channel: t, selectedChannel: s, onChannelSelect: n, debug: r = !1, unread: o }) => {
321
+ var x, y, I, M, N, p;
322
322
  const d = (s == null ? void 0 : s.id) === (t == null ? void 0 : t.id), l = () => {
323
323
  t && n(t);
324
- }, h = Object.values(((N = t == null ? void 0 : t.state) == null ? void 0 : N.members) || {}).find(
325
- (o) => {
326
- var u, b;
327
- return ((u = o.user) == null ? void 0 : u.id) && o.user.id !== ((b = t == null ? void 0 : t._client) == null ? void 0 : b.userID);
324
+ }, h = Object.values(((x = t == null ? void 0 : t.state) == null ? void 0 : x.members) || {}).find(
325
+ (a) => {
326
+ var u, C;
327
+ return ((u = a.user) == null ? void 0 : u.id) && a.user.id !== ((C = t == null ? void 0 : t._client) == null ? void 0 : C.userID);
328
328
  }
329
- ), g = ((E = h == null ? void 0 : h.user) == null ? void 0 : E.name) || "Conversation", w = (I = h == null ? void 0 : h.user) == null ? void 0 : I.image, f = (x = (k = t == null ? void 0 : t.state) == null ? void 0 : k.messages) == null ? void 0 : x[t.state.messages.length - 1], M = (() => {
329
+ ), g = ((y = h == null ? void 0 : h.user) == null ? void 0 : y.name) || "Conversation", v = (I = h == null ? void 0 : h.user) == null ? void 0 : I.image, f = (N = (M = t == null ? void 0 : t.state) == null ? void 0 : M.messages) == null ? void 0 : N[t.state.messages.length - 1], R = (() => {
330
330
  var u;
331
331
  if (f != null && f.text) return f.text;
332
- const o = (u = f == null ? void 0 : f.attachments) == null ? void 0 : u[0];
333
- return o != null && o.asset_url ? o.asset_url : o != null && o.image_url ? o.image_url : o != null && o.og_scrape_url ? o.og_scrape_url : o != null && o.thumb_url ? o.thumb_url : "No messages yet";
334
- })(), v = f != null && f.created_at ? as(new Date(f.created_at)) : "", c = a ?? 0;
332
+ const a = (u = f == null ? void 0 : f.attachments) == null ? void 0 : u[0];
333
+ return a != null && a.asset_url ? a.asset_url : a != null && a.image_url ? a.image_url : a != null && a.og_scrape_url ? a.og_scrape_url : a != null && a.thumb_url ? a.thumb_url : "No messages yet";
334
+ })(), w = f != null && f.created_at ? os(new Date(f.created_at)) : "", c = o ?? 0;
335
335
  return r && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ“‹ CHANNEL PREVIEW RENDER", {
336
336
  channelId: t == null ? void 0 : t.id,
337
337
  isSelected: d,
338
338
  participantName: g,
339
339
  unreadCount: c,
340
- hasTimestamp: !!v
340
+ hasTimestamp: !!w
341
341
  }), /* @__PURE__ */ e(
342
342
  "button",
343
343
  {
344
344
  type: "button",
345
345
  onClick: l,
346
- className: p(
346
+ className: k(
347
347
  "group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
348
348
  {
349
349
  "bg-primary-alt/10 border-l-4 border-l-primary": d,
@@ -352,11 +352,11 @@ const q = ({
352
352
  ),
353
353
  children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
354
354
  /* @__PURE__ */ e(
355
- q,
355
+ Y,
356
356
  {
357
- id: ((R = h == null ? void 0 : h.user) == null ? void 0 : R.id) || t.id || "unknown",
357
+ id: ((p = h == null ? void 0 : h.user) == null ? void 0 : p.id) || t.id || "unknown",
358
358
  name: g,
359
- image: w,
359
+ image: v,
360
360
  size: 44,
361
361
  className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
362
362
  }
@@ -366,17 +366,17 @@ const q = ({
366
366
  /* @__PURE__ */ e(
367
367
  "h3",
368
368
  {
369
- className: p(
369
+ className: k(
370
370
  "text-sm font-medium truncate",
371
371
  d ? "text-primary" : "text-charcoal"
372
372
  ),
373
373
  children: g
374
374
  }
375
375
  ),
376
- v && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: v })
376
+ w && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: w })
377
377
  ] }),
378
378
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
379
- /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: M }),
379
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone mr-2 flex-1 line-clamp-2", children: R }),
380
380
  c > 0 && /* @__PURE__ */ e("span", { className: "bg-[#7f22fe] text-white text-xs px-2 py-0.5 rounded-full min-w-[20px] text-center flex-shrink-0", children: c > 99 ? "99+" : c })
381
381
  ] })
382
382
  ] })
@@ -385,25 +385,25 @@ const q = ({
385
385
  );
386
386
  }
387
387
  );
388
- ye.displayName = "CustomChannelPreview";
389
- const Ee = P.memo(
388
+ Ee.displayName = "CustomChannelPreview";
389
+ const Ie = O.memo(
390
390
  ({
391
391
  onChannelSelect: t,
392
392
  selectedChannel: s,
393
393
  filters: n,
394
394
  className: r,
395
- customEmptyStateIndicator: a
395
+ customEmptyStateIndicator: o
396
396
  }) => {
397
- const d = P.useRef(0);
397
+ const d = O.useRef(0);
398
398
  d.current++;
399
- const { debug: l = !1 } = ae();
399
+ const { debug: l = !1 } = oe();
400
400
  l && console.log("๐Ÿ“บ [ChannelList] ๐Ÿ”„ RENDER START", {
401
401
  renderCount: d.current,
402
402
  selectedChannelId: s == null ? void 0 : s.id,
403
403
  filters: n
404
404
  });
405
- const m = P.useMemo(() => (g) => /* @__PURE__ */ e(
406
- ye,
405
+ const m = O.useMemo(() => (g) => /* @__PURE__ */ e(
406
+ Ee,
407
407
  {
408
408
  ...g,
409
409
  selectedChannel: s,
@@ -414,7 +414,7 @@ const Ee = P.memo(
414
414
  return /* @__PURE__ */ e(
415
415
  "div",
416
416
  {
417
- className: p(
417
+ className: k(
418
418
  "messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
419
419
  r
420
420
  ),
@@ -425,7 +425,7 @@ const Ee = P.memo(
425
425
  sort: { last_message_at: -1 },
426
426
  options: { limit: 30 },
427
427
  Preview: m,
428
- EmptyStateIndicator: a
428
+ EmptyStateIndicator: o
429
429
  },
430
430
  JSON.stringify(n)
431
431
  ) })
@@ -433,8 +433,8 @@ const Ee = P.memo(
433
433
  );
434
434
  }
435
435
  );
436
- Ee.displayName = "ChannelList";
437
- const re = ({
436
+ Ie.displayName = "ChannelList";
437
+ const ne = ({
438
438
  variant: t = "default",
439
439
  className: s,
440
440
  children: n,
@@ -443,7 +443,7 @@ const re = ({
443
443
  "button",
444
444
  {
445
445
  type: "button",
446
- className: p(
446
+ className: k(
447
447
  "flex w-full items-center gap-3 rounded-lg px-4 py-3 text-left text-sm transition-colors focus-ring disabled:cursor-not-allowed disabled:opacity-60",
448
448
  t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
449
449
  s
@@ -452,12 +452,12 @@ const re = ({
452
452
  children: n
453
453
  }
454
454
  );
455
- function Ie({ label: t, className: s, children: n, ...r }) {
455
+ function Se({ label: t, className: s, children: n, ...r }) {
456
456
  return /* @__PURE__ */ i(
457
457
  "button",
458
458
  {
459
459
  type: "button",
460
- className: p(
460
+ className: k(
461
461
  "rounded-full p-2 transition-colors focus-ring",
462
462
  {
463
463
  "cursor-not-allowed opacity-50": r.disabled,
@@ -473,18 +473,18 @@ function Ie({ label: t, className: s, children: n, ...r }) {
473
473
  }
474
474
  );
475
475
  }
476
- function Se({ onClick: t }) {
477
- return /* @__PURE__ */ e(Ie, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(ue, { className: "h-5 w-5 text-stone", weight: "bold" }) });
476
+ function pe({ onClick: t }) {
477
+ return /* @__PURE__ */ e(Se, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(ue, { className: "h-5 w-5 text-stone", weight: "bold" }) });
478
478
  }
479
479
  const cs = (t) => ({
480
480
  linkPreviews: Array.from(t.previews.values()).filter(
481
- (s) => Ne.previewIsLoaded(s) || Ne.previewIsLoading(s)
481
+ (s) => Ce.previewIsLoaded(s) || Ce.previewIsLoading(s)
482
482
  )
483
483
  }), ds = ({
484
484
  link: t,
485
485
  onDismiss: s
486
486
  }) => {
487
- const { og_scrape_url: n, title: r, image_url: a } = t;
487
+ const { og_scrape_url: n, title: r, image_url: o } = t;
488
488
  return /* @__PURE__ */ i(
489
489
  "a",
490
490
  {
@@ -493,10 +493,10 @@ const cs = (t) => ({
493
493
  rel: "noopener noreferrer",
494
494
  className: "relative w-full block rounded-[24px] bg-[#121110] p-2 no-underline transition-opacity hover:opacity-90",
495
495
  children: [
496
- a && /* @__PURE__ */ e(
496
+ o && /* @__PURE__ */ e(
497
497
  "img",
498
498
  {
499
- src: a,
499
+ src: o,
500
500
  alt: r || "",
501
501
  className: "h-[148px] w-full rounded-[20px] object-cover"
502
502
  }
@@ -521,23 +521,23 @@ const cs = (t) => ({
521
521
  }
522
522
  );
523
523
  }, us = () => {
524
- const { linkPreviewsManager: t } = Be(), { linkPreviews: s } = $e(
524
+ const { linkPreviewsManager: t } = Be(), { linkPreviews: s } = Ge(
525
525
  t.state,
526
526
  cs
527
- ), n = (a) => {
528
- t.dismissPreview(a);
527
+ ), n = (o) => {
528
+ t.dismissPreview(o);
529
529
  };
530
- return s.length > 0 ? /* @__PURE__ */ e("div", { className: "str-chat__link-preview-list p-0 gap-2 mb-4", children: s.map((a) => /* @__PURE__ */ e(
530
+ return s.length > 0 ? /* @__PURE__ */ e("div", { className: "str-chat__link-preview-list p-0 gap-2 mb-4", children: s.map((o) => /* @__PURE__ */ e(
531
531
  ds,
532
532
  {
533
- link: a,
533
+ link: o,
534
534
  onDismiss: n
535
535
  },
536
- a.og_scrape_url
536
+ o.og_scrape_url
537
537
  )) }) : null;
538
538
  }, ms = () => {
539
539
  const { handleSubmit: t } = He(), s = Ve();
540
- return /* @__PURE__ */ i(Ce, { children: [
540
+ return /* @__PURE__ */ i(we, { children: [
541
541
  /* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(We, {}) }),
542
542
  /* @__PURE__ */ i("div", { className: "central-container min-w-0 w-full p-2 bg-white rounded-[1.5rem] shadow-[0_4px_16px_0_rgba(0,0,0,0.08),0_1px_2px_0_rgba(0,0,0,0.04),0_0_0_1px_rgba(0,0,0,0.04)]", children: [
543
543
  /* @__PURE__ */ e(Ze, {}),
@@ -570,7 +570,7 @@ const cs = (t) => ({
570
570
  renderActions: t
571
571
  }) => /* @__PURE__ */ i("div", { className: "message-input flex items-center gap-2 p-4", children: [
572
572
  t && (t == null ? void 0 : t()),
573
- /* @__PURE__ */ e(Ge, { Input: ms })
573
+ /* @__PURE__ */ e($e, { Input: ms })
574
574
  ] }), fs = (t) => {
575
575
  const s = t.message.hide_date === !0;
576
576
  return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
@@ -581,20 +581,68 @@ const cs = (t) => ({
581
581
  ] }),
582
582
  !s && /* @__PURE__ */ e(Je, { message: t.message })
583
583
  ] });
584
- }, gs = () => null, xs = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
585
- var h, g, w, f, S;
586
- const { channel: a } = ve(), d = P.useMemo(() => Object.values(a.state.members || {}).find(
587
- (v) => {
584
+ }, gs = () => (console.log("[ChannelEmptyState] render - returning NULL"), null), xs = ({ className: t, message: s }) => /* @__PURE__ */ i(
585
+ "div",
586
+ {
587
+ className: k("flex items-center justify-center h-full", t),
588
+ children: [
589
+ /* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
590
+ /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
591
+ "animateTransform",
592
+ {
593
+ attributeName: "transform",
594
+ dur: "1s",
595
+ type: "translate",
596
+ values: "0 15 ; 0 -15; 0 15",
597
+ repeatCount: "indefinite",
598
+ begin: "0.1"
599
+ }
600
+ ) }),
601
+ /* @__PURE__ */ e("circle", { cx: "30", cy: "50", r: "6", children: /* @__PURE__ */ e(
602
+ "animateTransform",
603
+ {
604
+ attributeName: "transform",
605
+ dur: "1s",
606
+ type: "translate",
607
+ values: "0 10 ; 0 -10; 0 10",
608
+ repeatCount: "indefinite",
609
+ begin: "0.2"
610
+ }
611
+ ) }),
612
+ /* @__PURE__ */ e("circle", { cx: "54", cy: "50", r: "6", children: /* @__PURE__ */ e(
613
+ "animateTransform",
614
+ {
615
+ attributeName: "transform",
616
+ dur: "1s",
617
+ type: "translate",
618
+ values: "0 5 ; 0 -5; 0 5",
619
+ repeatCount: "indefinite",
620
+ begin: "0.3"
621
+ }
622
+ ) })
623
+ ] }),
624
+ s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
625
+ ]
626
+ }
627
+ ), me = O.memo(() => (console.log("[LoadingState] render - showing loading spinner"), /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
628
+ /* @__PURE__ */ e(xs, { className: "w-6 h-6" }),
629
+ /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
630
+ ] }) })));
631
+ me.displayName = "LoadingState";
632
+ const Ns = ({ onBack: t, showBackButton: s, onShowInfo: n, canShowInfo: r }) => {
633
+ var h, g, v, f, S;
634
+ const { channel: o } = ve(), d = O.useMemo(() => Object.values(o.state.members || {}).find(
635
+ (w) => {
588
636
  var c;
589
- return ((c = v.user) == null ? void 0 : c.id) && v.user.id !== a._client.userID;
637
+ return ((c = w.user) == null ? void 0 : c.id) && w.user.id !== o._client.userID;
590
638
  }
591
- ), [a._client.userID, a.state.members]), l = ((h = d == null ? void 0 : d.user) == null ? void 0 : h.name) || ((g = d == null ? void 0 : d.user) == null ? void 0 : g.id) || "Unknown member", m = (w = d == null ? void 0 : d.user) == null ? void 0 : w.image;
639
+ ), [o._client.userID, o.state.members]), l = ((h = d == null ? void 0 : d.user) == null ? void 0 : h.name) || ((g = d == null ? void 0 : d.user) == null ? void 0 : g.id) || "Unknown member", m = (v = d == null ? void 0 : d.user) == null ? void 0 : v.image;
592
640
  return /* @__PURE__ */ i("div", { className: "@container", children: [
593
641
  /* @__PURE__ */ i("div", { className: "flex justify-between items-center @lg:hidden", children: [
594
642
  /* @__PURE__ */ e(
595
643
  "button",
596
644
  {
597
- className: p(
645
+ className: k(
598
646
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
599
647
  !s && "invisible"
600
648
  ),
@@ -602,14 +650,14 @@ const cs = (t) => ({
602
650
  }),
603
651
  type: "button",
604
652
  "aria-label": "Back to conversations",
605
- children: /* @__PURE__ */ e(he, { className: "size-5 text-black/90" })
653
+ children: /* @__PURE__ */ e(fe, { className: "size-5 text-black/90" })
606
654
  }
607
655
  ),
608
656
  /* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
609
657
  /* @__PURE__ */ e(
610
- q,
658
+ Y,
611
659
  {
612
- id: ((f = d == null ? void 0 : d.user) == null ? void 0 : f.id) || a.id || "unknown",
660
+ id: ((f = d == null ? void 0 : d.user) == null ? void 0 : f.id) || o.id || "unknown",
613
661
  name: l,
614
662
  image: m,
615
663
  size: 40
@@ -620,13 +668,13 @@ const cs = (t) => ({
620
668
  /* @__PURE__ */ e(
621
669
  "button",
622
670
  {
623
- className: p(
671
+ className: k(
624
672
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
625
673
  ),
626
674
  onClick: n,
627
675
  type: "button",
628
676
  "aria-label": "Show info",
629
- children: /* @__PURE__ */ e(fe, { className: "size-5 text-black/90" })
677
+ children: /* @__PURE__ */ e(ge, { className: "size-5 text-black/90" })
630
678
  }
631
679
  )
632
680
  ] }),
@@ -639,13 +687,13 @@ const cs = (t) => ({
639
687
  onClick: t,
640
688
  className: "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center",
641
689
  "aria-label": "Back to conversations",
642
- children: /* @__PURE__ */ e(he, { className: "size-5 text-black/90" })
690
+ children: /* @__PURE__ */ e(fe, { className: "size-5 text-black/90" })
643
691
  }
644
692
  ),
645
693
  /* @__PURE__ */ e(
646
- q,
694
+ Y,
647
695
  {
648
- id: ((S = d == null ? void 0 : d.user) == null ? void 0 : S.id) || a.id || "unknown",
696
+ id: ((S = d == null ? void 0 : d.user) == null ? void 0 : S.id) || o.id || "unknown",
649
697
  name: l,
650
698
  image: m,
651
699
  size: 40
@@ -656,96 +704,96 @@ const cs = (t) => ({
656
704
  r && n && /* @__PURE__ */ e(
657
705
  "button",
658
706
  {
659
- className: p(
707
+ className: k(
660
708
  "size-10 rounded-full bg-[#F1F0EE] flex items-center justify-center"
661
709
  ),
662
710
  onClick: n,
663
- children: /* @__PURE__ */ e(fe, { className: "size-5 text-black/90" })
711
+ children: /* @__PURE__ */ e(ge, { className: "size-5 text-black/90" })
664
712
  }
665
713
  )
666
714
  ] })
667
715
  ] });
668
- }, Ns = ({
716
+ }, Cs = ({
669
717
  dialogRef: t,
670
718
  onClose: s,
671
719
  participant: n,
672
720
  channel: r,
673
- followerStatusLabel: a,
721
+ followerStatusLabel: o,
674
722
  onLeaveConversation: d,
675
723
  onBlockParticipant: l,
676
724
  showDeleteConversation: m = !0,
677
725
  onDeleteConversationClick: h,
678
726
  onBlockParticipantClick: g,
679
- onReportParticipantClick: w
727
+ onReportParticipantClick: v
680
728
  }) => {
681
- var X, K, ie, O, H, J, $;
682
- const { service: f, debug: S } = ae(), [M, v] = y(!1), [c, N] = y(!1), [E, I] = y(!1), k = D(async () => {
683
- var _;
684
- if (!(!f || !((_ = n == null ? void 0 : n.user) != null && _.id)))
729
+ var Q, X, ie, U, H, V, G;
730
+ const { service: f, debug: S } = oe(), [R, w] = E(!1), [c, x] = E(!1), [y, I] = E(!1), M = _(async () => {
731
+ var D;
732
+ if (!(!f || !((D = n == null ? void 0 : n.user) != null && D.id)))
685
733
  try {
686
734
  const A = (await f.getBlockedUsers()).some(
687
- (V) => {
688
- var ee;
689
- return V.blocked_user_id === ((ee = n == null ? void 0 : n.user) == null ? void 0 : ee.id);
735
+ (W) => {
736
+ var K;
737
+ return W.blocked_user_id === ((K = n == null ? void 0 : n.user) == null ? void 0 : K.id);
690
738
  }
691
739
  );
692
- v(A);
740
+ w(A);
693
741
  } catch (T) {
694
742
  console.error(
695
743
  "[ChannelInfoDialog] Failed to check blocked status:",
696
744
  T
697
745
  );
698
746
  }
699
- }, [f, (X = n == null ? void 0 : n.user) == null ? void 0 : X.id]);
700
- G(() => {
701
- k();
702
- }, [k]);
703
- const x = async () => {
704
- var _;
747
+ }, [f, (Q = n == null ? void 0 : n.user) == null ? void 0 : Q.id]);
748
+ $(() => {
749
+ M();
750
+ }, [M]);
751
+ const N = async () => {
752
+ var D;
705
753
  if (!c) {
706
- h == null || h(), S && console.log("[ChannelInfoDialog] Leave conversation", r.cid), N(!0);
754
+ h == null || h(), S && console.log("[ChannelInfoDialog] Leave conversation", r.cid), x(!0);
707
755
  try {
708
- const T = ((_ = r._client) == null ? void 0 : _.userID) ?? null;
756
+ const T = ((D = r._client) == null ? void 0 : D.userID) ?? null;
709
757
  await r.hide(T, !1), d && await d(r), s();
710
758
  } catch (T) {
711
759
  console.error("[ChannelInfoDialog] Failed to leave conversation", T);
712
760
  } finally {
713
- N(!1);
761
+ x(!1);
714
762
  }
715
763
  }
716
- }, R = async () => {
717
- var _, T, A;
718
- if (!(E || !f)) {
719
- g == null || g(), S && console.log("[ChannelInfoDialog] Block member", (_ = n == null ? void 0 : n.user) == null ? void 0 : _.id), I(!0);
764
+ }, p = async () => {
765
+ var D, T, A;
766
+ if (!(y || !f)) {
767
+ g == null || g(), S && console.log("[ChannelInfoDialog] Block member", (D = n == null ? void 0 : n.user) == null ? void 0 : D.id), I(!0);
720
768
  try {
721
769
  await f.blockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), l && await l((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
722
- } catch (V) {
723
- console.error("[ChannelInfoDialog] Failed to block member", V);
770
+ } catch (W) {
771
+ console.error("[ChannelInfoDialog] Failed to block member", W);
724
772
  } finally {
725
773
  I(!1);
726
774
  }
727
775
  }
728
- }, o = async () => {
729
- var _, T, A;
730
- if (!(E || !f)) {
731
- g == null || g(), S && console.log("[ChannelInfoDialog] Unblock member", (_ = n == null ? void 0 : n.user) == null ? void 0 : _.id), I(!0);
776
+ }, a = async () => {
777
+ var D, T, A;
778
+ if (!(y || !f)) {
779
+ g == null || g(), S && console.log("[ChannelInfoDialog] Unblock member", (D = n == null ? void 0 : n.user) == null ? void 0 : D.id), I(!0);
732
780
  try {
733
781
  await f.unBlockUser((T = n == null ? void 0 : n.user) == null ? void 0 : T.id), l && await l((A = n == null ? void 0 : n.user) == null ? void 0 : A.id), s();
734
- } catch (V) {
735
- console.error("[ChannelInfoDialog] Failed to unblock member", V);
782
+ } catch (W) {
783
+ console.error("[ChannelInfoDialog] Failed to unblock member", W);
736
784
  } finally {
737
785
  I(!1);
738
786
  }
739
787
  }
740
788
  }, u = () => {
741
- w == null || w(), s(), window.open(
789
+ v == null || v(), s(), window.open(
742
790
  "https://linktr.ee/s/about/trust-center/report",
743
791
  "_blank",
744
792
  "noopener,noreferrer"
745
793
  );
746
794
  };
747
795
  if (!n) return null;
748
- const b = ((K = n.user) == null ? void 0 : K.name) || ((ie = n.user) == null ? void 0 : ie.id) || "Unknown member", B = (O = n.user) == null ? void 0 : O.image, j = (H = n.user) == null ? void 0 : H.email, W = (J = n.user) == null ? void 0 : J.username, Y = j || (W ? `linktr.ee/${W}` : void 0), oe = (($ = n.user) == null ? void 0 : $.id) || "unknown";
796
+ const C = ((X = n.user) == null ? void 0 : X.name) || ((ie = n.user) == null ? void 0 : ie.id) || "Unknown member", B = (U = n.user) == null ? void 0 : U.image, j = (H = n.user) == null ? void 0 : H.email, Z = (V = n.user) == null ? void 0 : V.username, J = j || (Z ? `linktr.ee/${Z}` : void 0), ae = ((G = n.user) == null ? void 0 : G.id) || "unknown";
749
797
  return (
750
798
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
751
799
  /* @__PURE__ */ e(
@@ -754,13 +802,13 @@ const cs = (t) => ({
754
802
  ref: t,
755
803
  className: "mes-dialog group",
756
804
  onClose: s,
757
- onClick: (_) => {
758
- _.target === t.current && s();
805
+ onClick: (D) => {
806
+ D.target === t.current && s();
759
807
  },
760
808
  children: /* @__PURE__ */ i("div", { className: "ml-auto flex h-full w-full flex-col bg-white shadow-none transition-shadow duration-200 group-open:shadow-max-elevation-light", children: [
761
809
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
762
810
  /* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
763
- /* @__PURE__ */ e(Se, { onClick: s })
811
+ /* @__PURE__ */ e(pe, { onClick: s })
764
812
  ] }),
765
813
  /* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
766
814
  /* @__PURE__ */ e(
@@ -770,30 +818,30 @@ const cs = (t) => ({
770
818
  style: { backgroundColor: "#FBFAF9" },
771
819
  children: /* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
772
820
  /* @__PURE__ */ e(
773
- q,
821
+ Y,
774
822
  {
775
- id: oe,
776
- name: b,
823
+ id: ae,
824
+ name: C,
777
825
  image: B,
778
826
  size: 88,
779
827
  shape: "circle"
780
828
  }
781
829
  ),
782
830
  /* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
783
- /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: b }),
784
- Y && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: Y }),
785
- a && /* @__PURE__ */ e(
831
+ /* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: C }),
832
+ J && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: J }),
833
+ o && /* @__PURE__ */ e(
786
834
  "span",
787
835
  {
788
836
  className: "mt-1 rounded-full text-xs font-normal w-fit",
789
837
  style: {
790
838
  padding: "4px 8px",
791
- backgroundColor: a === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
792
- color: a === "Subscribed to you" ? "#008236" : "#78716C",
839
+ backgroundColor: o === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
840
+ color: o === "Subscribed to you" ? "#008236" : "#78716C",
793
841
  lineHeight: "133.333%",
794
842
  letterSpacing: "0.21px"
795
843
  },
796
- children: a
844
+ children: o
797
845
  }
798
846
  )
799
847
  ] })
@@ -802,41 +850,41 @@ const cs = (t) => ({
802
850
  ),
803
851
  /* @__PURE__ */ i("ul", { className: "flex flex-col gap-2 mt-2", children: [
804
852
  m && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
805
- re,
853
+ ne,
806
854
  {
807
- onClick: x,
855
+ onClick: N,
808
856
  disabled: c,
809
857
  "aria-busy": c,
810
858
  children: [
811
- c ? /* @__PURE__ */ e(Q, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ss, { className: "h-5 w-5" }),
859
+ c ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ss, { className: "h-5 w-5" }),
812
860
  /* @__PURE__ */ e("span", { children: "Delete Conversation" })
813
861
  ]
814
862
  }
815
863
  ) }),
816
- /* @__PURE__ */ e("li", { children: M ? /* @__PURE__ */ i(
817
- re,
864
+ /* @__PURE__ */ e("li", { children: R ? /* @__PURE__ */ i(
865
+ ne,
818
866
  {
819
- onClick: o,
820
- disabled: E,
821
- "aria-busy": E,
867
+ onClick: a,
868
+ disabled: y,
869
+ "aria-busy": y,
822
870
  children: [
823
- E ? /* @__PURE__ */ e(Q, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ge, { className: "h-5 w-5" }),
871
+ y ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(xe, { className: "h-5 w-5" }),
824
872
  /* @__PURE__ */ e("span", { children: "Unblock" })
825
873
  ]
826
874
  }
827
875
  ) : /* @__PURE__ */ i(
828
- re,
876
+ ne,
829
877
  {
830
- onClick: R,
831
- disabled: E,
832
- "aria-busy": E,
878
+ onClick: p,
879
+ disabled: y,
880
+ "aria-busy": y,
833
881
  children: [
834
- E ? /* @__PURE__ */ e(Q, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(ge, { className: "h-5 w-5" }),
882
+ y ? /* @__PURE__ */ e(re, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(xe, { className: "h-5 w-5" }),
835
883
  /* @__PURE__ */ e("span", { children: "Block" })
836
884
  ]
837
885
  }
838
886
  ) }),
839
- /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(re, { variant: "danger", onClick: u, children: [
887
+ /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ne, { variant: "danger", onClick: u, children: [
840
888
  /* @__PURE__ */ e(ts, { className: "h-5 w-5" }),
841
889
  /* @__PURE__ */ e("span", { children: "Report" })
842
890
  ] }) })
@@ -851,38 +899,38 @@ const cs = (t) => ({
851
899
  showBackButton: s,
852
900
  renderMessageInputActions: n,
853
901
  onLeaveConversation: r,
854
- onBlockParticipant: a,
902
+ onBlockParticipant: o,
855
903
  showDeleteConversation: d = !0,
856
904
  onDeleteConversationClick: l,
857
905
  onBlockParticipantClick: m,
858
906
  onReportParticipantClick: h
859
907
  }) => {
860
- const { channel: g } = ve(), w = z(null), f = P.useMemo(() => Object.values(g.state.members || {}).find(
861
- (N) => {
862
- var E;
863
- return ((E = N.user) == null ? void 0 : E.id) && N.user.id !== g._client.userID;
908
+ const { channel: g } = ve(), v = z(null), f = O.useMemo(() => Object.values(g.state.members || {}).find(
909
+ (x) => {
910
+ var y;
911
+ return ((y = x.user) == null ? void 0 : y.id) && x.user.id !== g._client.userID;
864
912
  }
865
- ), [g._client.userID, g.state.members]), S = P.useMemo(() => {
913
+ ), [g._client.userID, g.state.members]), S = O.useMemo(() => {
866
914
  const c = g.data ?? {};
867
915
  if (c.followerStatus)
868
916
  return String(c.followerStatus);
869
917
  if (c.isFollower !== void 0)
870
918
  return c.isFollower ? "Subscribed to you" : "Not subscribed";
871
- }, [g.data]), M = D(() => {
919
+ }, [g.data]), R = _(() => {
872
920
  var c;
873
- (c = w.current) == null || c.showModal();
874
- }, []), v = D(() => {
921
+ (c = v.current) == null || c.showModal();
922
+ }, []), w = _(() => {
875
923
  var c;
876
- (c = w.current) == null || c.close();
924
+ (c = v.current) == null || c.close();
877
925
  }, []);
878
- return /* @__PURE__ */ i(Ce, { children: [
926
+ return /* @__PURE__ */ i(we, { children: [
879
927
  /* @__PURE__ */ i(Xe, { children: [
880
928
  /* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
881
- xs,
929
+ Ns,
882
930
  {
883
931
  onBack: t,
884
932
  showBackButton: s,
885
- onShowInfo: M,
933
+ onShowInfo: R,
886
934
  canShowInfo: !!f
887
935
  }
888
936
  ) }),
@@ -902,15 +950,15 @@ const cs = (t) => ({
902
950
  )
903
951
  ] }),
904
952
  /* @__PURE__ */ e(
905
- Ns,
953
+ Cs,
906
954
  {
907
- dialogRef: w,
908
- onClose: v,
955
+ dialogRef: v,
956
+ onClose: w,
909
957
  participant: f,
910
958
  channel: g,
911
959
  followerStatusLabel: S,
912
960
  onLeaveConversation: r,
913
- onBlockParticipant: a,
961
+ onBlockParticipant: o,
914
962
  showDeleteConversation: d,
915
963
  onDeleteConversationClick: l,
916
964
  onBlockParticipantClick: m,
@@ -918,59 +966,63 @@ const cs = (t) => ({
918
966
  }
919
967
  )
920
968
  ] });
921
- }, pe = P.memo(
969
+ }, ke = O.memo(
922
970
  ({
923
971
  channel: t,
924
972
  onBack: s,
925
973
  showBackButton: n = !1,
926
974
  renderMessageInputActions: r,
927
- onLeaveConversation: a,
975
+ onLeaveConversation: o,
928
976
  onBlockParticipant: d,
929
977
  className: l,
930
978
  CustomChannelEmptyState: m = gs,
931
979
  showDeleteConversation: h = !0,
932
980
  onDeleteConversationClick: g,
933
- onBlockParticipantClick: w,
981
+ onBlockParticipantClick: v,
934
982
  onReportParticipantClick: f
935
- }) => /* @__PURE__ */ e(
936
- "div",
937
- {
938
- className: p(
939
- "messaging-channel-view h-full flex flex-col",
940
- l
941
- ),
942
- children: /* @__PURE__ */ e(
943
- Qe,
944
- {
945
- channel: t,
946
- MessageSystem: fs,
947
- EmptyStateIndicator: m,
948
- LoadingIndicator: () => /* @__PURE__ */ e("div", { className: "flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
949
- /* @__PURE__ */ e(Q, { className: "h-5 w-5 animate-spin text-stone" }),
950
- /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages..." })
951
- ] }) }),
952
- children: /* @__PURE__ */ e(
953
- bs,
954
- {
955
- onBack: s,
956
- showBackButton: n,
957
- renderMessageInputActions: r,
958
- onLeaveConversation: a,
959
- onBlockParticipant: d,
960
- CustomChannelEmptyState: m,
961
- showDeleteConversation: h,
962
- onDeleteConversationClick: g,
963
- onBlockParticipantClick: w,
964
- onReportParticipantClick: f
965
- }
966
- )
967
- }
968
- )
969
- }
970
- )
983
+ }) => {
984
+ var S, R;
985
+ return console.log("[ChannelView] render", {
986
+ channelId: t.id,
987
+ channelInitialized: t.initialized,
988
+ messageCount: (R = (S = t.state) == null ? void 0 : S.messages) == null ? void 0 : R.length
989
+ }), /* @__PURE__ */ e(
990
+ "div",
991
+ {
992
+ className: k(
993
+ "messaging-channel-view h-full flex flex-col",
994
+ l
995
+ ),
996
+ children: /* @__PURE__ */ e(
997
+ Qe,
998
+ {
999
+ channel: t,
1000
+ MessageSystem: fs,
1001
+ EmptyStateIndicator: m,
1002
+ LoadingIndicator: me,
1003
+ children: /* @__PURE__ */ e(
1004
+ bs,
1005
+ {
1006
+ onBack: s,
1007
+ showBackButton: n,
1008
+ renderMessageInputActions: r,
1009
+ onLeaveConversation: o,
1010
+ onBlockParticipant: d,
1011
+ CustomChannelEmptyState: m,
1012
+ showDeleteConversation: h,
1013
+ onDeleteConversationClick: g,
1014
+ onBlockParticipantClick: v,
1015
+ onReportParticipantClick: f
1016
+ }
1017
+ )
1018
+ }
1019
+ )
1020
+ }
1021
+ );
1022
+ }
971
1023
  );
972
- pe.displayName = "ChannelView";
973
- function Cs({
1024
+ ke.displayName = "ChannelView";
1025
+ function ws({
974
1026
  searchQuery: t,
975
1027
  setSearchQuery: s,
976
1028
  placeholder: n
@@ -991,17 +1043,17 @@ function Cs({
991
1043
  type: "text",
992
1044
  placeholder: n,
993
1045
  value: t,
994
- onChange: (a) => s(a.target.value),
1046
+ onChange: (o) => s(o.target.value),
995
1047
  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"
996
1048
  }
997
1049
  ),
998
1050
  t && /* @__PURE__ */ e(
999
- Ie,
1051
+ Se,
1000
1052
  {
1001
1053
  label: "Clear search",
1002
1054
  onClick: () => {
1003
- var a;
1004
- s(""), (a = r.current) == null || a.focus();
1055
+ var o;
1056
+ s(""), (o = r.current) == null || o.focus();
1005
1057
  },
1006
1058
  className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
1007
1059
  children: /* @__PURE__ */ e(ue, { className: "h-4 w-4", weight: "bold" })
@@ -1014,14 +1066,14 @@ const vs = ({
1014
1066
  onSelectParticipant: s,
1015
1067
  onClose: n,
1016
1068
  existingParticipantIds: r = /* @__PURE__ */ new Set(),
1017
- participantLabel: a = "participants",
1069
+ participantLabel: o = "participants",
1018
1070
  searchPlaceholder: d = "Search participants...",
1019
1071
  className: l
1020
1072
  }) => {
1021
- const { debug: m } = ae(), [h, g] = y(""), [w, f] = y([]), [S, M] = y(!1), [v, c] = y(null), [N, E] = y(
1073
+ const { debug: m } = oe(), [h, g] = E(""), [v, f] = E([]), [S, R] = E(!1), [w, c] = E(null), [x, y] = E(
1022
1074
  null
1023
1075
  ), I = z(!1);
1024
- G(() => {
1076
+ $(() => {
1025
1077
  if (t.loading) {
1026
1078
  m && console.log(
1027
1079
  "[ParticipantPicker] Waiting for participant source to finish loading..."
@@ -1030,7 +1082,7 @@ const vs = ({
1030
1082
  }
1031
1083
  if (I.current) return;
1032
1084
  (async () => {
1033
- m && console.log("[ParticipantPicker] Loading initial participants..."), M(!0), c(null);
1085
+ m && console.log("[ParticipantPicker] Loading initial participants..."), R(!0), c(null);
1034
1086
  try {
1035
1087
  const u = await t.loadParticipants({
1036
1088
  search: "",
@@ -1042,49 +1094,49 @@ const vs = ({
1042
1094
  u.participants.length
1043
1095
  );
1044
1096
  } catch (u) {
1045
- const b = u instanceof Error ? u.message : "Failed to load participants";
1046
- c(b), console.error("[ParticipantPicker] Failed to load participants:", u);
1097
+ const C = u instanceof Error ? u.message : "Failed to load participants";
1098
+ c(C), console.error("[ParticipantPicker] Failed to load participants:", u);
1047
1099
  } finally {
1048
- M(!1);
1100
+ R(!1);
1049
1101
  }
1050
1102
  })();
1051
1103
  }, [t.loading, m]);
1052
- const k = w.filter((o) => !r.has(o.id)).filter((o) => {
1053
- var b;
1104
+ const M = v.filter((a) => !r.has(a.id)).filter((a) => {
1105
+ var C;
1054
1106
  if (!h) return !0;
1055
1107
  const u = h.toLowerCase();
1056
- return o.name.toLowerCase().includes(u) || ((b = o.email) == null ? void 0 : b.toLowerCase().includes(u)) || !1;
1057
- }), x = D(
1058
- async (o) => {
1059
- if (!N) {
1060
- E(o.id);
1108
+ return a.name.toLowerCase().includes(u) || ((C = a.email) == null ? void 0 : C.toLowerCase().includes(u)) || !1;
1109
+ }), N = _(
1110
+ async (a) => {
1111
+ if (!x) {
1112
+ y(a.id);
1061
1113
  try {
1062
- await s(o);
1114
+ await s(a);
1063
1115
  } catch (u) {
1064
- console.error("[ParticipantPicker] Failed to start chat:", u), E(null);
1116
+ console.error("[ParticipantPicker] Failed to start chat:", u), y(null);
1065
1117
  }
1066
1118
  }
1067
1119
  },
1068
- [s, N]
1069
- ), R = (o, u) => {
1070
- (o.key === "Enter" || o.key === " ") && (o.preventDefault(), x(u));
1120
+ [s, x]
1121
+ ), p = (a, u) => {
1122
+ (a.key === "Enter" || a.key === " ") && (a.preventDefault(), N(u));
1071
1123
  };
1072
- return /* @__PURE__ */ i("div", { className: p("flex flex-col h-full", l), children: [
1124
+ return /* @__PURE__ */ i("div", { className: k("flex flex-col h-full", l), children: [
1073
1125
  /* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
1074
1126
  /* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
1075
1127
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
1076
- /* @__PURE__ */ e(Se, { onClick: n })
1128
+ /* @__PURE__ */ e(pe, { onClick: n })
1077
1129
  ] }),
1078
1130
  /* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
1079
1131
  "Select a ",
1080
- a.slice(0, -1),
1132
+ o.slice(0, -1),
1081
1133
  " to start messaging (",
1082
- k.length,
1134
+ M.length,
1083
1135
  " available)",
1084
- t.totalCount !== void 0 && ` โ€ข ${t.totalCount} ${a} total`
1136
+ t.totalCount !== void 0 && ` โ€ข ${t.totalCount} ${o} total`
1085
1137
  ] }),
1086
1138
  /* @__PURE__ */ e(
1087
- Cs,
1139
+ ws,
1088
1140
  {
1089
1141
  searchQuery: h,
1090
1142
  setSearchQuery: g,
@@ -1092,53 +1144,53 @@ const vs = ({
1092
1144
  }
1093
1145
  )
1094
1146
  ] }),
1095
- v && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1147
+ w && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
1096
1148
  "Error loading ",
1097
- a,
1149
+ o,
1098
1150
  ": ",
1099
- v
1151
+ w
1100
1152
  ] }),
1101
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: S && k.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1153
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: S && M.length === 0 ? /* @__PURE__ */ e("div", { className: "h-32 flex items-center justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1102
1154
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
1103
1155
  /* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
1104
1156
  "Loading ",
1105
- a,
1157
+ o,
1106
1158
  "..."
1107
1159
  ] })
1108
- ] }) }) : k.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
1109
- /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(xe, { className: "h-8 w-8 text-charcoal" }) }),
1110
- /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: h ? `No ${a} found` : w.length > 0 ? `Already chatting with all ${a}` : `No ${a} yet` }),
1111
- /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: h ? "Try a different search term" : w.length > 0 ? `You have existing conversations with all your ${a}` : `${a.charAt(0).toUpperCase() + a.slice(1)} will appear here` })
1160
+ ] }) }) : M.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
1161
+ /* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(Ne, { className: "h-8 w-8 text-charcoal" }) }),
1162
+ /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: h ? `No ${o} found` : v.length > 0 ? `Already chatting with all ${o}` : `No ${o} yet` }),
1163
+ /* @__PURE__ */ e("p", { className: "text-xs text-stone", children: h ? "Try a different search term" : v.length > 0 ? `You have existing conversations with all your ${o}` : `${o.charAt(0).toUpperCase() + o.slice(1)} will appear here` })
1112
1164
  ] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
1113
- k.map((o) => {
1114
- const u = o.name || o.email || o.id, b = o.email && o.name ? o.email : o.phone;
1165
+ M.map((a) => {
1166
+ const u = a.name || a.email || a.id, C = a.email && a.name ? a.email : a.phone;
1115
1167
  return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
1116
1168
  "button",
1117
1169
  {
1118
1170
  type: "button",
1119
- onClick: () => x(o),
1120
- onKeyDown: (B) => R(B, o),
1171
+ onClick: () => N(a),
1172
+ onKeyDown: (B) => p(B, a),
1121
1173
  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",
1122
1174
  children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
1123
1175
  /* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
1124
1176
  /* @__PURE__ */ e(
1125
- q,
1177
+ Y,
1126
1178
  {
1127
- id: o.id,
1179
+ id: a.id,
1128
1180
  name: u,
1129
- image: o.image,
1181
+ image: a.image,
1130
1182
  size: 40
1131
1183
  }
1132
1184
  ),
1133
1185
  /* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
1134
1186
  /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: u }),
1135
- b && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: b })
1187
+ C && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: C })
1136
1188
  ] })
1137
1189
  ] }),
1138
- /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N === o.id ? /* @__PURE__ */ e(Q, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(xe, { className: "h-5 w-5 text-stone" }) })
1190
+ /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: x === a.id ? /* @__PURE__ */ e(re, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(Ne, { className: "h-5 w-5 text-stone" }) })
1139
1191
  ] })
1140
1192
  }
1141
- ) }, o.id);
1193
+ ) }, a.id);
1142
1194
  }),
1143
1195
  S && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
1144
1196
  /* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
@@ -1146,7 +1198,7 @@ const vs = ({
1146
1198
  ] }) })
1147
1199
  ] }) })
1148
1200
  ] });
1149
- }, ws = ({ className: t }) => /* @__PURE__ */ i(
1201
+ }, ys = ({ className: t }) => /* @__PURE__ */ i(
1150
1202
  "svg",
1151
1203
  {
1152
1204
  width: "140",
@@ -1280,17 +1332,17 @@ const vs = ({
1280
1332
  ] })
1281
1333
  ]
1282
1334
  }
1283
- ), ke = P.memo(
1335
+ ), Re = O.memo(
1284
1336
  ({ hasChannels: t, channelsLoaded: s }) => /* @__PURE__ */ e("div", { className: "messaging-empty-state flex items-center justify-center h-full p-8 text-balance", children: /* @__PURE__ */ i("div", { className: "flex flex-col items-center max-w-sm text-center", children: [
1285
- /* @__PURE__ */ e(ws, {}),
1337
+ /* @__PURE__ */ e(ys, {}),
1286
1338
  s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
1287
1339
  /* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
1288
1340
  /* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
1289
1341
  ] })
1290
1342
  ] }) })
1291
1343
  );
1292
- ke.displayName = "EmptyState";
1293
- const le = P.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ i("div", { className: "text-center max-w-sm", children: [
1344
+ Re.displayName = "EmptyState";
1345
+ const le = O.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { className: "messaging-error-state flex items-center justify-center h-full p-8", children: /* @__PURE__ */ i("div", { className: "text-center max-w-sm", children: [
1294
1346
  /* @__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: "โš ๏ธ" }) }),
1295
1347
  /* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
1296
1348
  /* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
@@ -1305,164 +1357,116 @@ const le = P.memo(({ message: t, onBack: s }) => /* @__PURE__ */ e("div", { clas
1305
1357
  )
1306
1358
  ] }) }));
1307
1359
  le.displayName = "ErrorState";
1308
- const ys = ({ className: t, message: s }) => /* @__PURE__ */ i(
1309
- "div",
1310
- {
1311
- className: p("flex items-center justify-center h-full", t),
1312
- children: [
1313
- /* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
1314
- /* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
1315
- "animateTransform",
1316
- {
1317
- attributeName: "transform",
1318
- dur: "1s",
1319
- type: "translate",
1320
- values: "0 15 ; 0 -15; 0 15",
1321
- repeatCount: "indefinite",
1322
- begin: "0.1"
1323
- }
1324
- ) }),
1325
- /* @__PURE__ */ e("circle", { cx: "30", cy: "50", r: "6", children: /* @__PURE__ */ e(
1326
- "animateTransform",
1327
- {
1328
- attributeName: "transform",
1329
- dur: "1s",
1330
- type: "translate",
1331
- values: "0 10 ; 0 -10; 0 10",
1332
- repeatCount: "indefinite",
1333
- begin: "0.2"
1334
- }
1335
- ) }),
1336
- /* @__PURE__ */ e("circle", { cx: "54", cy: "50", r: "6", children: /* @__PURE__ */ e(
1337
- "animateTransform",
1338
- {
1339
- attributeName: "transform",
1340
- dur: "1s",
1341
- type: "translate",
1342
- values: "0 5 ; 0 -5; 0 5",
1343
- repeatCount: "indefinite",
1344
- begin: "0.3"
1345
- }
1346
- ) })
1347
- ] }),
1348
- s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
1349
- ]
1350
- }
1351
- ), Re = P.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
1352
- /* @__PURE__ */ e(ys, { className: "w-6 h-6" }),
1353
- /* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
1354
- ] }) }));
1355
- Re.displayName = "LoadingState";
1356
1360
  const Fs = ({
1357
1361
  capabilities: t = {},
1358
1362
  className: s,
1359
1363
  renderMessageInputActions: n,
1360
1364
  onChannelSelect: r,
1361
- onParticipantSelect: a,
1365
+ onParticipantSelect: o,
1362
1366
  initialParticipantFilter: d,
1363
1367
  initialParticipantData: l,
1364
1368
  CustomChannelEmptyState: m,
1365
1369
  showChannelList: h = !0,
1366
1370
  filters: g,
1367
- channelListCustomEmptyStateIndicator: w,
1371
+ channelListCustomEmptyStateIndicator: v,
1368
1372
  onDeleteConversationClick: f,
1369
1373
  onBlockParticipantClick: S,
1370
- onReportParticipantClick: M
1374
+ onReportParticipantClick: R
1371
1375
  }) => {
1372
1376
  const {
1373
- service: v,
1377
+ service: w,
1374
1378
  client: c,
1375
- isConnected: N,
1376
- isLoading: E,
1379
+ isConnected: x,
1380
+ isLoading: y,
1377
1381
  error: I,
1378
- refreshConnection: k,
1379
- debug: x
1380
- } = rs(), [R, o] = y(null), [u, b] = y(!1), [B, j] = y(!1), [W, Y] = y(!1), [oe, X] = y(/* @__PURE__ */ new Set()), [K, ie] = y(0), [O, H] = y(!1), [J, $] = y(null), _ = z(null), {
1382
+ refreshConnection: M,
1383
+ debug: N
1384
+ } = rs(), [p, a] = E(null), [u, C] = E(!1), [B, j] = E(!1), [Z, J] = E(!1), [ae, Q] = E(/* @__PURE__ */ new Set()), [X, ie] = E(0), [U, H] = E(!1), [V, G] = E(null), D = z(null), {
1381
1385
  participantSource: T,
1382
1386
  participantLabel: A = "participants",
1383
- showDeleteConversation: V = !0
1384
- } = t, ee = P.useMemo(() => {
1385
- const C = c == null ? void 0 : c.userID;
1387
+ showDeleteConversation: W = !0
1388
+ } = t, K = O.useMemo(() => {
1389
+ const b = c == null ? void 0 : c.userID;
1386
1390
  return {
1387
1391
  ...{
1388
1392
  type: "messaging",
1389
1393
  last_message_at: { $exists: !0 },
1390
- ...C && {
1391
- members: { $in: [C] },
1394
+ ...b && {
1395
+ members: { $in: [b] },
1392
1396
  hidden: !1
1393
1397
  }
1394
1398
  },
1395
1399
  ...g
1396
1400
  };
1397
- }, [g, c == null ? void 0 : c.userID]), se = z(null), Z = D(async () => {
1398
- if (!c || !N) return;
1399
- const C = c.userID;
1400
- if (C)
1401
+ }, [g, c == null ? void 0 : c.userID]), ee = z(null), q = _(async () => {
1402
+ if (!c || !x) return;
1403
+ const b = c.userID;
1404
+ if (b)
1401
1405
  try {
1402
- x && console.log("[MessagingShell] Syncing channels for user:", C);
1403
- const U = await c.queryChannels(
1406
+ N && console.log("[MessagingShell] Syncing channels for user:", b);
1407
+ const P = await c.queryChannels(
1404
1408
  {
1405
1409
  type: "messaging",
1406
- members: { $in: [C] }
1410
+ members: { $in: [b] }
1407
1411
  },
1408
1412
  {},
1409
1413
  { limit: 100 }
1410
1414
  ), F = /* @__PURE__ */ new Set();
1411
- U.forEach((L) => {
1415
+ P.forEach((L) => {
1412
1416
  const ce = L.state.members;
1413
- Object.values(ce).forEach((Pe) => {
1414
- var me;
1415
- const de = (me = Pe.user) == null ? void 0 : me.id;
1416
- de && de !== C && F.add(de);
1417
+ Object.values(ce).forEach((Oe) => {
1418
+ var he;
1419
+ const de = (he = Oe.user) == null ? void 0 : he.id;
1420
+ de && de !== b && F.add(de);
1417
1421
  });
1418
- }), X((L) => L.size === F.size && [...L].every((ce) => F.has(ce)) ? L : F), b(U.length > 0), j(!0), se.current = C, x && console.log("[MessagingShell] Channels synced successfully:", {
1419
- channelCount: U.length,
1422
+ }), Q((L) => L.size === F.size && [...L].every((ce) => F.has(ce)) ? L : F), C(P.length > 0), j(!0), ee.current = b, N && console.log("[MessagingShell] Channels synced successfully:", {
1423
+ channelCount: P.length,
1420
1424
  memberCount: F.size
1421
1425
  });
1422
- } catch (U) {
1423
- console.error("[MessagingShell] Failed to sync channels:", U);
1426
+ } catch (P) {
1427
+ console.error("[MessagingShell] Failed to sync channels:", P);
1424
1428
  }
1425
- }, [c, N, x]);
1426
- G(() => {
1427
- if (!c || !N) return;
1428
- const C = c.userID;
1429
- C && se.current !== C && Z();
1430
- }, [c, N, Z]), G(() => {
1431
- if (!d || !c || !N) return;
1429
+ }, [c, x, N]);
1430
+ $(() => {
1431
+ if (!c || !x) return;
1432
+ const b = c.userID;
1433
+ b && ee.current !== b && q();
1434
+ }, [c, x, q]), $(() => {
1435
+ if (!d || !c || !x) return;
1432
1436
  (async () => {
1433
- const U = c.userID;
1434
- if (U)
1437
+ const P = c.userID;
1438
+ if (P)
1435
1439
  try {
1436
- x && console.log(
1440
+ N && console.log(
1437
1441
  "[MessagingShell] Loading initial conversation with:",
1438
1442
  d
1439
1443
  );
1440
1444
  const F = await c.queryChannels(
1441
1445
  {
1442
1446
  type: "messaging",
1443
- members: { $eq: [U, d] }
1447
+ members: { $eq: [P, d] }
1444
1448
  },
1445
1449
  {},
1446
1450
  { limit: 1 }
1447
1451
  );
1448
1452
  if (F.length > 0)
1449
- o(F[0]), H(!0), $(null), r && r(F[0]), x && console.log(
1453
+ a(F[0]), H(!0), G(null), r && r(F[0]), N && console.log(
1450
1454
  "[MessagingShell] Initial conversation loaded:",
1451
1455
  F[0].id
1452
1456
  );
1453
- else if (l && v) {
1454
- x && console.log(
1457
+ else if (l && w) {
1458
+ N && console.log(
1455
1459
  "[MessagingShell] No conversation found, creating one for:",
1456
1460
  l
1457
1461
  );
1458
1462
  try {
1459
- const L = await v.startChannelWithParticipant({
1463
+ const L = await w.startChannelWithParticipant({
1460
1464
  id: l.id,
1461
1465
  name: l.name,
1462
1466
  email: l.email,
1463
1467
  phone: l.phone
1464
1468
  });
1465
- o(L), H(!0), $(null), r && r(L), x && console.log(
1469
+ a(L), H(!0), G(null), r && r(L), N && console.log(
1466
1470
  "[MessagingShell] Channel created and loaded:",
1467
1471
  L.id
1468
1472
  );
@@ -1470,12 +1474,12 @@ const Fs = ({
1470
1474
  console.error(
1471
1475
  "[MessagingShell] Failed to create conversation:",
1472
1476
  L
1473
- ), $("Failed to create conversation");
1477
+ ), G("Failed to create conversation");
1474
1478
  }
1475
1479
  } else
1476
- $(
1480
+ G(
1477
1481
  "No conversation found with this account"
1478
- ), x && console.log(
1482
+ ), N && console.log(
1479
1483
  "[MessagingShell] No conversation found for:",
1480
1484
  d
1481
1485
  );
@@ -1483,80 +1487,88 @@ const Fs = ({
1483
1487
  console.error(
1484
1488
  "[MessagingShell] Failed to load initial conversation:",
1485
1489
  F
1486
- ), $("Failed to load conversation");
1490
+ ), G("Failed to load conversation");
1487
1491
  }
1488
1492
  })();
1489
1493
  }, [
1490
1494
  d,
1491
1495
  l,
1492
1496
  c,
1493
- N,
1494
- v,
1495
1497
  x,
1498
+ w,
1499
+ N,
1496
1500
  r
1497
1501
  ]);
1498
- const _e = D(
1499
- (C) => {
1500
- o(C), r == null || r(C);
1502
+ const Me = _(
1503
+ (b) => {
1504
+ a(b), r == null || r(b);
1501
1505
  },
1502
1506
  [r]
1503
- ), De = D(() => {
1504
- O || o(null);
1505
- }, [O]), Me = D(
1506
- async (C) => {
1507
- var U;
1508
- if (v)
1507
+ ), De = _(() => {
1508
+ U || a(null);
1509
+ }, [U]), _e = _(
1510
+ async (b) => {
1511
+ var P;
1512
+ if (w)
1509
1513
  try {
1510
- x && console.log(
1514
+ N && console.log(
1511
1515
  "[MessagingShell] Starting conversation with:",
1512
- C.id
1516
+ b.id
1513
1517
  );
1514
- const F = await v.startChannelWithParticipant({
1515
- id: C.id,
1516
- name: C.name,
1517
- email: C.email,
1518
- phone: C.phone
1518
+ const F = await w.startChannelWithParticipant({
1519
+ id: b.id,
1520
+ name: b.name,
1521
+ email: b.email,
1522
+ phone: b.phone
1519
1523
  });
1520
1524
  try {
1521
1525
  await F.show();
1522
1526
  } catch (L) {
1523
1527
  console.warn("[MessagingShell] Failed to unhide channel:", L);
1524
1528
  }
1525
- o(F), Y(!1), (U = _.current) == null || U.close(), a == null || a(C);
1529
+ a(F), J(!1), (P = D.current) == null || P.close(), o == null || o(b);
1526
1530
  } catch (F) {
1527
1531
  console.error("[MessagingShell] Failed to start conversation:", F);
1528
1532
  }
1529
1533
  },
1530
- [v, a, x]
1531
- ), te = D(() => {
1532
- var C;
1533
- Y(!1), (C = _.current) == null || C.close();
1534
- }, []), Fe = D(
1535
- (C) => {
1536
- C.target === _.current && te();
1534
+ [w, o, N]
1535
+ ), se = _(() => {
1536
+ var b;
1537
+ J(!1), (b = D.current) == null || b.close();
1538
+ }, []), Fe = _(
1539
+ (b) => {
1540
+ b.target === D.current && se();
1537
1541
  },
1538
- [te]
1539
- ), Te = D(
1540
- async (C) => {
1541
- x && console.log("[MessagingShell] Leaving conversation:", C.id), o(null), H(!1), se.current = null, await Z();
1542
+ [se]
1543
+ ), Te = _(
1544
+ async (b) => {
1545
+ N && console.log("[MessagingShell] Leaving conversation:", b.id), a(null), H(!1), ee.current = null, await q();
1542
1546
  },
1543
- [Z, x]
1544
- ), Le = D(
1545
- async (C) => {
1546
- x && console.log("[MessagingShell] Blocking participant:", C), o(null), H(!1), se.current = null, await Z();
1547
+ [q, N]
1548
+ ), Le = _(
1549
+ async (b) => {
1550
+ N && console.log("[MessagingShell] Blocking participant:", b), a(null), H(!1), ee.current = null, await q();
1547
1551
  },
1548
- [Z, x]
1549
- ), ne = !!R;
1550
- return E ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(Re, {}) }) : I ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(le, { message: I, onBack: k }) }) : !N || !c ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(
1552
+ [q, N]
1553
+ ), te = !!p;
1554
+ return console.log("[MessagingShell] render", {
1555
+ isLoading: y,
1556
+ error: I,
1557
+ isConnected: x,
1558
+ hasClient: !!c,
1559
+ directConversationError: V,
1560
+ selectedChannelId: p == null ? void 0 : p.id,
1561
+ directConversationMode: U
1562
+ }), y ? (console.log("[MessagingShell] showing LOADING state"), /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(me, {}) })) : I ? (console.log("[MessagingShell] showing ERROR state:", I), /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(le, { message: I, onBack: M }) })) : !x || !c ? (console.log("[MessagingShell] showing NOT CONNECTED state"), /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(
1551
1563
  le,
1552
1564
  {
1553
1565
  message: "Not connected to messaging service",
1554
- onBack: k
1566
+ onBack: M
1555
1567
  }
1556
- ) }) : J ? /* @__PURE__ */ e("div", { className: p("h-full", s), children: /* @__PURE__ */ e(le, { message: J }) }) : /* @__PURE__ */ i(
1568
+ ) })) : V ? (console.log("[MessagingShell] showing DIRECT CONVERSATION ERROR:", V), /* @__PURE__ */ e("div", { className: k("h-full", s), children: /* @__PURE__ */ e(le, { message: V }) })) : (console.log("[MessagingShell] rendering main UI with ChannelView"), /* @__PURE__ */ i(
1557
1569
  "div",
1558
1570
  {
1559
- className: p(
1571
+ className: k(
1560
1572
  "messaging-shell h-full bg-background-secondary overflow-hidden",
1561
1573
  s
1562
1574
  ),
@@ -1565,23 +1577,23 @@ const Fs = ({
1565
1577
  /* @__PURE__ */ e(
1566
1578
  "div",
1567
1579
  {
1568
- className: p(
1580
+ className: k(
1569
1581
  "messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
1570
1582
  {
1571
- "!hidden": h === !1 || O,
1583
+ "!hidden": h === !1 || U,
1572
1584
  // Hide on mobile when channel selected, show on desktop with consistent narrow width
1573
- "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !O && ne,
1585
+ "hidden lg:flex lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !U && te,
1574
1586
  // Show on mobile when no channel selected, use same narrow width on desktop
1575
- "flex flex-col w-full lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !O && !ne
1587
+ "flex flex-col w-full lg:w-80 lg:min-w-[280px] lg:max-w-[360px]": h !== !1 && !U && !te
1576
1588
  }
1577
1589
  ),
1578
1590
  children: /* @__PURE__ */ e(
1579
- Ee,
1591
+ Ie,
1580
1592
  {
1581
- onChannelSelect: _e,
1582
- selectedChannel: R || void 0,
1583
- filters: ee,
1584
- customEmptyStateIndicator: w
1593
+ onChannelSelect: Me,
1594
+ selectedChannel: p || void 0,
1595
+ filters: K,
1596
+ customEmptyStateIndicator: v
1585
1597
  }
1586
1598
  )
1587
1599
  }
@@ -1589,33 +1601,33 @@ const Fs = ({
1589
1601
  /* @__PURE__ */ e(
1590
1602
  "div",
1591
1603
  {
1592
- className: p(
1604
+ className: k(
1593
1605
  "messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
1594
1606
  {
1595
1607
  // In direct conversation mode, always show (full width)
1596
- flex: O || ne,
1608
+ flex: U || te,
1597
1609
  // Normal mode: hide on mobile when no channel selected
1598
- "hidden lg:flex": !O && !ne
1610
+ "hidden lg:flex": !U && !te
1599
1611
  }
1600
1612
  ),
1601
- children: R ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1602
- pe,
1613
+ children: p ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
1614
+ ke,
1603
1615
  {
1604
- channel: R,
1616
+ channel: p,
1605
1617
  onBack: De,
1606
- showBackButton: !O,
1618
+ showBackButton: !U,
1607
1619
  renderMessageInputActions: n,
1608
1620
  onLeaveConversation: Te,
1609
1621
  onBlockParticipant: Le,
1610
1622
  CustomChannelEmptyState: m,
1611
- showDeleteConversation: V,
1623
+ showDeleteConversation: W,
1612
1624
  onDeleteConversationClick: f,
1613
1625
  onBlockParticipantClick: S,
1614
- onReportParticipantClick: M
1626
+ onReportParticipantClick: R
1615
1627
  },
1616
- R.id
1628
+ p.id
1617
1629
  ) }) : /* @__PURE__ */ e(
1618
- ke,
1630
+ Re,
1619
1631
  {
1620
1632
  hasChannels: u,
1621
1633
  channelsLoaded: B
@@ -1628,27 +1640,27 @@ const Fs = ({
1628
1640
  /* @__PURE__ */ e(
1629
1641
  "dialog",
1630
1642
  {
1631
- ref: _,
1643
+ ref: D,
1632
1644
  className: "mes-dialog",
1633
1645
  onClick: Fe,
1634
- onClose: te,
1646
+ onClose: se,
1635
1647
  children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
1636
1648
  vs,
1637
1649
  {
1638
1650
  participantSource: T,
1639
- onSelectParticipant: Me,
1640
- onClose: te,
1641
- existingParticipantIds: oe,
1651
+ onSelectParticipant: _e,
1652
+ onClose: se,
1653
+ existingParticipantIds: ae,
1642
1654
  participantLabel: A,
1643
1655
  searchPlaceholder: `Search ${A}...`
1644
1656
  },
1645
- K
1657
+ X
1646
1658
  ) })
1647
1659
  }
1648
1660
  )
1649
1661
  ]
1650
1662
  }
1651
- );
1663
+ ));
1652
1664
  }, Es = ({
1653
1665
  question: t,
1654
1666
  onClick: s,
@@ -1661,7 +1673,7 @@ const Fs = ({
1661
1673
  onClick: s,
1662
1674
  disabled: n,
1663
1675
  style: { backgroundColor: "#E6E5E3" },
1664
- className: p(
1676
+ className: k(
1665
1677
  "w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors",
1666
1678
  {
1667
1679
  "hover:brightness-95 active:brightness-90": !n,
@@ -1676,14 +1688,14 @@ const Fs = ({
1676
1688
  onFaqClick: s,
1677
1689
  loadingFaqId: n,
1678
1690
  headerText: r,
1679
- className: a,
1691
+ className: o,
1680
1692
  avatarImage: d,
1681
1693
  avatarName: l
1682
1694
  }) => {
1683
1695
  const m = t.filter((h) => h.enabled).sort((h, g) => (h.order ?? 0) - (g.order ?? 0));
1684
- return m.length === 0 ? null : /* @__PURE__ */ e("div", { className: a, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
1696
+ return m.length === 0 ? null : /* @__PURE__ */ e("div", { className: o, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
1685
1697
  (d || l) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
1686
- q,
1698
+ Y,
1687
1699
  {
1688
1700
  id: l || "account",
1689
1701
  name: l || "Account",
@@ -1713,57 +1725,57 @@ const Fs = ({
1713
1725
  )
1714
1726
  ] }) });
1715
1727
  }, Ls = (t, s = {}) => {
1716
- const { initialSearch: n = "", pageSize: r = 20 } = s, [a, d] = y([]), [l, m] = y(!1), [h, g] = y(null), [w, f] = y(n), [S, M] = y(!0), [v, c] = y(), N = D(async (x = !1, R) => {
1728
+ const { initialSearch: n = "", pageSize: r = 20 } = s, [o, d] = E([]), [l, m] = E(!1), [h, g] = E(null), [v, f] = E(n), [S, R] = E(!0), [w, c] = E(), x = _(async (N = !1, p) => {
1717
1729
  if (l) return;
1718
- const o = R !== void 0 ? R : w;
1730
+ const a = p !== void 0 ? p : v;
1719
1731
  m(!0), g(null);
1720
1732
  try {
1721
1733
  const u = await t.loadParticipants({
1722
- search: o || void 0,
1734
+ search: a || void 0,
1723
1735
  limit: r,
1724
- cursor: x ? void 0 : v
1736
+ cursor: N ? void 0 : w
1725
1737
  });
1726
1738
  d(
1727
- (b) => x ? u.participants : [...b, ...u.participants]
1728
- ), M(u.hasMore), c(u.nextCursor);
1739
+ (C) => N ? u.participants : [...C, ...u.participants]
1740
+ ), R(u.hasMore), c(u.nextCursor);
1729
1741
  } catch (u) {
1730
- const b = u instanceof Error ? u.message : "Failed to load participants";
1731
- g(b), console.error("[useParticipants] Load error:", u);
1742
+ const C = u instanceof Error ? u.message : "Failed to load participants";
1743
+ g(C), console.error("[useParticipants] Load error:", u);
1732
1744
  } finally {
1733
1745
  m(!1);
1734
1746
  }
1735
- }, [t, w, v, r, l]), E = D(() => {
1736
- S && !l && N(!1);
1737
- }, [S, l, N]), I = D((x) => {
1738
- f(x), c(void 0), N(!0, x);
1739
- }, [N]), k = D(() => {
1740
- c(void 0), N(!0);
1741
- }, [N]);
1742
- return G(() => {
1743
- N(!0);
1747
+ }, [t, v, w, r, l]), y = _(() => {
1748
+ S && !l && x(!1);
1749
+ }, [S, l, x]), I = _((N) => {
1750
+ f(N), c(void 0), x(!0, N);
1751
+ }, [x]), M = _(() => {
1752
+ c(void 0), x(!0);
1753
+ }, [x]);
1754
+ return $(() => {
1755
+ x(!0);
1744
1756
  }, [t.loadParticipants]), {
1745
- participants: a,
1757
+ participants: o,
1746
1758
  loading: l,
1747
1759
  error: h,
1748
- searchQuery: w,
1760
+ searchQuery: v,
1749
1761
  hasMore: S,
1750
1762
  totalCount: t.totalCount,
1751
- loadMore: E,
1763
+ loadMore: y,
1752
1764
  search: I,
1753
- refresh: k
1765
+ refresh: M
1754
1766
  };
1755
1767
  };
1756
1768
  export {
1757
- q as Avatar,
1769
+ Y as Avatar,
1758
1770
  gs as ChannelEmptyState,
1759
- Ee as ChannelList,
1760
- pe as ChannelView,
1771
+ Ie as ChannelList,
1772
+ ke as ChannelView,
1761
1773
  Ts as FaqList,
1762
1774
  Es as FaqListItem,
1763
- Ms as MessagingProvider,
1775
+ _s as MessagingProvider,
1764
1776
  Fs as MessagingShell,
1765
1777
  vs as ParticipantPicker,
1766
- as as formatRelativeTime,
1778
+ os as formatRelativeTime,
1767
1779
  rs as useMessaging,
1768
1780
  Ls as useParticipants
1769
1781
  };