@linktr.ee/messaging-react 1.33.2 โ 1.33.3
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/Card-BfA8wq8O.js +181 -0
- package/dist/Card-BfA8wq8O.js.map +1 -0
- package/dist/{Card-Ddi8bg90.js โ Card-Bpud_enW.js} +55 -55
- package/dist/Card-Bpud_enW.js.map +1 -0
- package/dist/assets/index.css +1 -1
- package/dist/index-Ydi1pTAi.js +3130 -0
- package/dist/index-Ydi1pTAi.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/ChannelInfoDialog/index.tsx +3 -1
- package/src/components/ChannelView.tsx +24 -6
- package/src/components/LockedAttachment/components/Creator/Card.tsx +33 -24
- package/src/components/LockedAttachment/components/MediaPlayer.tsx +10 -1
- package/src/components/LockedAttachment/components/Visitor/Card.tsx +9 -9
- package/src/components/LockedAttachment/components/Visitor/CardActions.tsx +2 -2
- package/src/components/MediaMessage/MediaMessage.stories.tsx +82 -19
- package/src/components/MediaMessage/MediaMessage.test.tsx +277 -18
- package/src/components/MediaMessage/index.tsx +388 -77
- package/src/styles.css +49 -0
- package/dist/Card-DEe10CiS.js +0 -171
- package/dist/Card-DEe10CiS.js.map +0 -1
- package/dist/Card-Ddi8bg90.js.map +0 -1
- package/dist/index-BePLvyvi.js +0 -2868
- package/dist/index-BePLvyvi.js.map +0 -1
|
@@ -0,0 +1,3130 @@
|
|
|
1
|
+
import { jsx as e, jsxs as i, Fragment as se } from "react/jsx-runtime";
|
|
2
|
+
import O from "classnames";
|
|
3
|
+
import z, { createContext as ot, useContext as lt, useCallback as A, useState as I, useRef as X, useEffect as q, useMemo as ze, Suspense as it } from "react";
|
|
4
|
+
import { StreamChatService as Mt } from "@linktr.ee/messaging-core";
|
|
5
|
+
import { Chat as Dt, ChannelList as Rt, DateSeparator as Lt, useChannelStateContext as fe, useChatContext as ct, areMessageUIPropsEqual as Pt, useMessageReminder as Ft, useComponentContext as dt, Attachment as At, EditMessageModal as Ut, MessageBlocked as Ot, MessageBouncePrompt as $t, MessageDeleted as zt, MessageIsThreadReplyInChannelButtonIndicator as Bt, MessageRepliesCountButton as jt, ReminderNotification as Gt, StreamedMessageText as Vt, messageHasAttachments as Ht, messageHasReactions as Yt, isDateSeparatorMessage as Wt, isMessageBlocked as qt, isMessageBounced as Zt, MessageBounceModal as Xt, MessageText as Ze, Poll as Kt, MessageErrorIcon as Jt, useMessageContext as ut, useMessageComposer as Qt, useStateStore as es, MessageInput as ts, useMessageInputContext as ss, useMessageComposerHasSendableData as ns, SimpleAttachmentSelector as as, QuotedMessagePreview as rs, AttachmentPreviewList as os, TextareaComposer as ls, MessageTimestamp as Ue, Channel as is, WithComponents as cs, Window as ds, MessageList as us } from "stream-chat-react";
|
|
6
|
+
import { StarIcon as Be, GiftIcon as ms, XIcon as Re, SpinnerGapIcon as Ie, SignOutIcon as hs, ProhibitInsetIcon as Xe, FlagIcon as fs, ArrowUpIcon as gs, SparkleIcon as bs, ProhibitIcon as ps, ArrowLeftIcon as Ke, CaretRightIcon as Je, DotsThreeIcon as Qe, MagnifyingGlassIcon as xs, ChatCircleDotsIcon as et, FileIcon as mt, ImageIcon as vs, SpeakerHighIcon as ws, VideoCameraIcon as Ns, FileMdIcon as ys, FileTextIcon as Cs, FileZipIcon as _s, FilePptIcon as Es, FileCsvIcon as Ss, FileXlsIcon as ks, FileDocIcon as Is, FilePdfIcon as Ts, CircleNotchIcon as ht, PlayIcon as tt, PauseIcon as Ms, LinkIcon as Ds, DownloadSimpleIcon as Rs } from "@phosphor-icons/react";
|
|
7
|
+
import { LinkPreviewsManager as st } from "stream-chat";
|
|
8
|
+
const ft = ot({
|
|
9
|
+
service: null,
|
|
10
|
+
client: null,
|
|
11
|
+
isConnected: !1,
|
|
12
|
+
isLoading: !1,
|
|
13
|
+
error: null,
|
|
14
|
+
capabilities: {},
|
|
15
|
+
refreshConnection: async () => {
|
|
16
|
+
},
|
|
17
|
+
debug: !1
|
|
18
|
+
}), Le = () => lt(ft), sa = ({
|
|
19
|
+
children: t,
|
|
20
|
+
user: s,
|
|
21
|
+
serviceConfig: n,
|
|
22
|
+
apiKey: o,
|
|
23
|
+
capabilities: l = {},
|
|
24
|
+
debug: d = !1
|
|
25
|
+
}) => {
|
|
26
|
+
const r = A(
|
|
27
|
+
(m, ...f) => {
|
|
28
|
+
d && console.log(`๐ฅ [MessagingProvider] ${m}`, ...f);
|
|
29
|
+
},
|
|
30
|
+
[d]
|
|
31
|
+
);
|
|
32
|
+
r("๐ RENDER START", {
|
|
33
|
+
userId: s == null ? void 0 : s.id,
|
|
34
|
+
apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
|
|
35
|
+
serviceConfig: !!n,
|
|
36
|
+
capabilities: Object.keys(l)
|
|
37
|
+
});
|
|
38
|
+
const [c, x] = I(null), [u, g] = I(null), [h, N] = I(!1), [a, _] = I(!1), [w, p] = I(null), E = X(!1), S = X({
|
|
39
|
+
userId: s == null ? void 0 : s.id,
|
|
40
|
+
apiKey: o,
|
|
41
|
+
serviceConfig: n,
|
|
42
|
+
capabilities: l
|
|
43
|
+
}), C = X(0);
|
|
44
|
+
C.current++, r("๐ RENDER INFO", {
|
|
45
|
+
renderCount: C.current,
|
|
46
|
+
currentProps: { userId: s == null ? void 0 : s.id, apiKey: (o == null ? void 0 : o.substring(0, 8)) + "..." },
|
|
47
|
+
propChanges: {
|
|
48
|
+
userChanged: S.current.userId !== (s == null ? void 0 : s.id),
|
|
49
|
+
apiKeyChanged: S.current.apiKey !== o,
|
|
50
|
+
serviceConfigChanged: S.current.serviceConfig !== n,
|
|
51
|
+
capabilitiesChanged: S.current.capabilities !== l
|
|
52
|
+
}
|
|
53
|
+
}), S.current = {
|
|
54
|
+
userId: s == null ? void 0 : s.id,
|
|
55
|
+
apiKey: o,
|
|
56
|
+
serviceConfig: n,
|
|
57
|
+
capabilities: l
|
|
58
|
+
}, q(() => {
|
|
59
|
+
const m = C.current;
|
|
60
|
+
if (r("๐ง SERVICE INIT EFFECT TRIGGERED", {
|
|
61
|
+
renderCount: m,
|
|
62
|
+
apiKey: !!o,
|
|
63
|
+
serviceConfig: !!n,
|
|
64
|
+
dependencies: {
|
|
65
|
+
apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
|
|
66
|
+
serviceConfigRef: n,
|
|
67
|
+
serviceConfigStable: S.current.serviceConfig === n,
|
|
68
|
+
apiKeyStable: S.current.apiKey === o
|
|
69
|
+
}
|
|
70
|
+
}), !o || !n) {
|
|
71
|
+
r("โ ๏ธ SERVICE INIT SKIPPED", {
|
|
72
|
+
renderCount: m,
|
|
73
|
+
reason: "Missing apiKey or serviceConfig"
|
|
74
|
+
});
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
r("๐ CREATING NEW SERVICE", {
|
|
78
|
+
renderCount: m,
|
|
79
|
+
apiKey: (o == null ? void 0 : o.substring(0, 8)) + "...",
|
|
80
|
+
serviceConfigChanged: S.current.serviceConfig !== n
|
|
81
|
+
});
|
|
82
|
+
const f = new Mt({
|
|
83
|
+
...n,
|
|
84
|
+
apiKey: o,
|
|
85
|
+
debug: d
|
|
86
|
+
});
|
|
87
|
+
return x(f), r("โ
SERVICE SET", {
|
|
88
|
+
renderCount: m,
|
|
89
|
+
serviceInstance: !!f
|
|
90
|
+
}), () => {
|
|
91
|
+
r("๐งน SERVICE CLEANUP", {
|
|
92
|
+
renderCount: m,
|
|
93
|
+
reason: "Effect cleanup"
|
|
94
|
+
}), f.disconnectUser().catch(console.error);
|
|
95
|
+
};
|
|
96
|
+
}, [o, n, d, r]);
|
|
97
|
+
const k = X(null);
|
|
98
|
+
q(() => {
|
|
99
|
+
var f, T;
|
|
100
|
+
if (r("๐ USER CONNECTION EFFECT TRIGGERED", {
|
|
101
|
+
hasService: !!c,
|
|
102
|
+
hasUser: !!s,
|
|
103
|
+
userId: s == null ? void 0 : s.id,
|
|
104
|
+
isConnecting: E.current,
|
|
105
|
+
isConnected: h,
|
|
106
|
+
dependencies: { service: !!c, userId: s == null ? void 0 : s.id }
|
|
107
|
+
}), !c || !s) {
|
|
108
|
+
r("โ ๏ธ USER CONNECTION SKIPPED", "Missing service or user");
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (E.current) {
|
|
112
|
+
r("โ ๏ธ USER CONNECTION SKIPPED", "Already connecting");
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (((f = k.current) == null ? void 0 : f.serviceId) === c && ((T = k.current) == null ? void 0 : T.userId) === s.id) {
|
|
116
|
+
r(
|
|
117
|
+
"โ ๏ธ USER CONNECTION SKIPPED",
|
|
118
|
+
"Already connected this user with this service"
|
|
119
|
+
);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
(async () => {
|
|
123
|
+
r("๐ STARTING USER CONNECTION", { userId: s.id }), E.current = !0, _(!0), p(null);
|
|
124
|
+
try {
|
|
125
|
+
r("๐ CALLING SERVICE.CONNECTUSER", { userId: s.id });
|
|
126
|
+
const M = await c.connectUser(s);
|
|
127
|
+
g(M), N(!0), k.current = { serviceId: c, userId: s.id }, r("โ
USER CONNECTION SUCCESS", {
|
|
128
|
+
userId: s.id,
|
|
129
|
+
clientId: M.userID
|
|
130
|
+
});
|
|
131
|
+
} catch (M) {
|
|
132
|
+
const L = M instanceof Error ? M.message : "Connection failed";
|
|
133
|
+
p(L), r("โ USER CONNECTION ERROR", {
|
|
134
|
+
userId: s.id,
|
|
135
|
+
error: L
|
|
136
|
+
});
|
|
137
|
+
} finally {
|
|
138
|
+
_(!1), E.current = !1, r("๐ USER CONNECTION FINISHED", {
|
|
139
|
+
userId: s.id,
|
|
140
|
+
isConnected: h
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
})();
|
|
144
|
+
}, [c, s, r, h]), q(() => (r("๐ CLEANUP EFFECT REGISTERED", {
|
|
145
|
+
hasService: !!c,
|
|
146
|
+
isConnected: h
|
|
147
|
+
}), () => {
|
|
148
|
+
c && h ? (r(
|
|
149
|
+
"๐งน CLEANUP EFFECT TRIGGERED",
|
|
150
|
+
"Cleaning up connection on unmount"
|
|
151
|
+
), k.current = null, c.disconnectUser().catch(console.error)) : r("๐ CLEANUP EFFECT SKIPPED", {
|
|
152
|
+
hasService: !!c,
|
|
153
|
+
isConnected: h
|
|
154
|
+
});
|
|
155
|
+
}), [c, h, r]);
|
|
156
|
+
const P = A(async () => {
|
|
157
|
+
if (r("๐ REFRESH CONNECTION CALLED", {
|
|
158
|
+
hasService: !!c,
|
|
159
|
+
hasUser: !!s
|
|
160
|
+
}), !c || !s) {
|
|
161
|
+
r("โ ๏ธ REFRESH CONNECTION SKIPPED", "Missing service or user");
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
r("๐ STARTING CONNECTION REFRESH", { userId: s.id }), _(!0);
|
|
165
|
+
try {
|
|
166
|
+
r("๐ DISCONNECTING FOR REFRESH"), await c.disconnectUser(), r("๐ RECONNECTING FOR REFRESH");
|
|
167
|
+
const m = await c.connectUser(s);
|
|
168
|
+
g(m), N(!0), p(null), r("โ
CONNECTION REFRESH SUCCESS", { userId: s.id });
|
|
169
|
+
} catch (m) {
|
|
170
|
+
const f = m instanceof Error ? m.message : "Refresh failed";
|
|
171
|
+
p(f), r("โ CONNECTION REFRESH ERROR", {
|
|
172
|
+
userId: s.id,
|
|
173
|
+
error: f
|
|
174
|
+
});
|
|
175
|
+
} finally {
|
|
176
|
+
_(!1), r("๐ CONNECTION REFRESH FINISHED", { userId: s.id });
|
|
177
|
+
}
|
|
178
|
+
}, [c, s, r]), v = z.useMemo(() => (r("๐ซ CONTEXT VALUE MEMOIZATION", {
|
|
179
|
+
hasService: !!c,
|
|
180
|
+
hasClient: !!u,
|
|
181
|
+
isConnected: h,
|
|
182
|
+
isLoading: a,
|
|
183
|
+
hasError: !!w,
|
|
184
|
+
capabilitiesKeys: Object.keys(l)
|
|
185
|
+
}), {
|
|
186
|
+
service: c,
|
|
187
|
+
client: u,
|
|
188
|
+
isConnected: h,
|
|
189
|
+
isLoading: a,
|
|
190
|
+
error: w,
|
|
191
|
+
capabilities: l,
|
|
192
|
+
refreshConnection: P,
|
|
193
|
+
debug: d
|
|
194
|
+
}), [
|
|
195
|
+
c,
|
|
196
|
+
u,
|
|
197
|
+
h,
|
|
198
|
+
a,
|
|
199
|
+
w,
|
|
200
|
+
l,
|
|
201
|
+
P,
|
|
202
|
+
d,
|
|
203
|
+
r
|
|
204
|
+
]);
|
|
205
|
+
return r("๐ RENDER END", {
|
|
206
|
+
renderCount: C.current,
|
|
207
|
+
willRenderChat: !!(u && h),
|
|
208
|
+
contextValueReady: !!v
|
|
209
|
+
}), /* @__PURE__ */ e(ft.Provider, { value: v, children: u && h ? /* @__PURE__ */ e(
|
|
210
|
+
Dt,
|
|
211
|
+
{
|
|
212
|
+
client: u,
|
|
213
|
+
customClasses: {
|
|
214
|
+
channelList: "str-chat__channel-list str-chat__channel-list-react bg-transparent lg:border-r-2 border-r-0 border-[#0000000A]"
|
|
215
|
+
},
|
|
216
|
+
children: t
|
|
217
|
+
}
|
|
218
|
+
) : t });
|
|
219
|
+
}, Ls = () => Le();
|
|
220
|
+
function Ps(t) {
|
|
221
|
+
const s = t.state.pending_messages;
|
|
222
|
+
if (s != null && s.length)
|
|
223
|
+
for (const n of s)
|
|
224
|
+
t.state.addMessageSorted(n.message);
|
|
225
|
+
}
|
|
226
|
+
const gt = z.createContext({
|
|
227
|
+
selectedChannel: void 0,
|
|
228
|
+
onChannelSelect: () => {
|
|
229
|
+
},
|
|
230
|
+
debug: !1,
|
|
231
|
+
renderMessagePreview: void 0
|
|
232
|
+
}), Fs = gt.Provider, As = () => z.useContext(gt), bt = (t) => {
|
|
233
|
+
var o, l;
|
|
234
|
+
const [s, n] = I(
|
|
235
|
+
!!((l = (o = t == null ? void 0 : t.state) == null ? void 0 : o.membership) != null && l.pinned_at)
|
|
236
|
+
);
|
|
237
|
+
return q(() => {
|
|
238
|
+
var r;
|
|
239
|
+
if (!t) {
|
|
240
|
+
n(!1);
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
n(!!((r = t.state.membership) != null && r.pinned_at));
|
|
244
|
+
const d = (c) => {
|
|
245
|
+
var x;
|
|
246
|
+
n(
|
|
247
|
+
c != null && c.member ? !!c.member.pinned_at : !!((x = t.state.membership) != null && x.pinned_at)
|
|
248
|
+
);
|
|
249
|
+
};
|
|
250
|
+
return t.on("member.updated", d), () => {
|
|
251
|
+
t.off("member.updated", d);
|
|
252
|
+
};
|
|
253
|
+
}, [t]), s;
|
|
254
|
+
}, Us = (t, s) => {
|
|
255
|
+
const n = new Date(
|
|
256
|
+
Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate())
|
|
257
|
+
), l = new Date(
|
|
258
|
+
Date.UTC(s.getUTCFullYear(), s.getUTCMonth(), s.getUTCDate())
|
|
259
|
+
).getTime() - n.getTime();
|
|
260
|
+
return Math.floor(l / (1e3 * 60 * 60 * 24));
|
|
261
|
+
}, Os = (t) => {
|
|
262
|
+
const s = /* @__PURE__ */ new Date();
|
|
263
|
+
if (Math.floor((s.getTime() - t.getTime()) / 1e3) < 60)
|
|
264
|
+
return "Just now";
|
|
265
|
+
const o = Us(t, s);
|
|
266
|
+
return o === 0 ? t.toLocaleTimeString([], {
|
|
267
|
+
hour: "numeric",
|
|
268
|
+
minute: "2-digit",
|
|
269
|
+
hour12: !0
|
|
270
|
+
}) : o === 1 ? "Yesterday" : o < 7 ? `${o}d` : o < 28 ? `${Math.floor(o / 7)}w` : t.toLocaleDateString("en-US", {
|
|
271
|
+
month: "numeric",
|
|
272
|
+
day: "numeric",
|
|
273
|
+
year: "2-digit"
|
|
274
|
+
});
|
|
275
|
+
}, nt = [
|
|
276
|
+
"๐",
|
|
277
|
+
// Apple
|
|
278
|
+
"๐",
|
|
279
|
+
// Banana
|
|
280
|
+
"๐",
|
|
281
|
+
// Grape
|
|
282
|
+
"๐",
|
|
283
|
+
// Orange
|
|
284
|
+
"๐",
|
|
285
|
+
// Strawberry
|
|
286
|
+
"๐ฅฅ",
|
|
287
|
+
// Coconut
|
|
288
|
+
"๐",
|
|
289
|
+
// Cherry
|
|
290
|
+
"๐ฅญ",
|
|
291
|
+
// Mango
|
|
292
|
+
"๐",
|
|
293
|
+
// Watermelon
|
|
294
|
+
"๐",
|
|
295
|
+
// Lemon
|
|
296
|
+
"๐ฅ",
|
|
297
|
+
// Kiwi
|
|
298
|
+
"๐ซ",
|
|
299
|
+
// Olive
|
|
300
|
+
"๐"
|
|
301
|
+
// Melon
|
|
302
|
+
];
|
|
303
|
+
function $s(t) {
|
|
304
|
+
let s = 0;
|
|
305
|
+
for (let n = 0; n < t.length; n++) {
|
|
306
|
+
const o = t.charCodeAt(n);
|
|
307
|
+
s = (s << 5) - s + o, s = s & s;
|
|
308
|
+
}
|
|
309
|
+
return Math.abs(s);
|
|
310
|
+
}
|
|
311
|
+
function zs(t) {
|
|
312
|
+
const n = $s(t) % nt.length;
|
|
313
|
+
return nt[n];
|
|
314
|
+
}
|
|
315
|
+
const oe = ({
|
|
316
|
+
id: t,
|
|
317
|
+
image: s,
|
|
318
|
+
size: n = 40,
|
|
319
|
+
className: o,
|
|
320
|
+
starred: l = !1,
|
|
321
|
+
shape: d = "squircle"
|
|
322
|
+
}) => {
|
|
323
|
+
const r = zs(t), x = n < 32 ? "text-xs" : n < 56 ? "text-sm" : n < 120 ? "text-lg" : "text-4xl", u = d === "circle" ? { borderRadius: "50%" } : {
|
|
324
|
+
borderRadius: "33%",
|
|
325
|
+
"corner-shape": "superellipse(1.3)"
|
|
326
|
+
};
|
|
327
|
+
return /* @__PURE__ */ i(
|
|
328
|
+
"div",
|
|
329
|
+
{
|
|
330
|
+
className: O("relative flex-shrink-0", o),
|
|
331
|
+
style: {
|
|
332
|
+
width: `${n}px`,
|
|
333
|
+
height: `${n}px`
|
|
334
|
+
},
|
|
335
|
+
children: [
|
|
336
|
+
l && /* @__PURE__ */ e(
|
|
337
|
+
"div",
|
|
338
|
+
{
|
|
339
|
+
"aria-hidden": "true",
|
|
340
|
+
className: "absolute -left-1.5 -top-1.5 z-10 flex size-5 items-center justify-center rounded-full bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_4px_8px_rgba(0,0,0,0.06)]",
|
|
341
|
+
children: /* @__PURE__ */ e(Be, { className: "size-3 text-yellow-600", weight: "duotone" })
|
|
342
|
+
}
|
|
343
|
+
),
|
|
344
|
+
/* @__PURE__ */ e("div", { className: "h-full w-full overflow-hidden", style: u, children: s ? /* @__PURE__ */ e(
|
|
345
|
+
"img",
|
|
346
|
+
{
|
|
347
|
+
src: s,
|
|
348
|
+
alt: "",
|
|
349
|
+
className: "aspect-square h-full w-full object-cover"
|
|
350
|
+
}
|
|
351
|
+
) : /* @__PURE__ */ e(
|
|
352
|
+
"div",
|
|
353
|
+
{
|
|
354
|
+
"aria-hidden": "true",
|
|
355
|
+
className: O(
|
|
356
|
+
"avatar-fallback flex h-full w-full items-center justify-center bg-[#E6E5E3] font-semibold select-none transition-colors",
|
|
357
|
+
x
|
|
358
|
+
),
|
|
359
|
+
children: r
|
|
360
|
+
}
|
|
361
|
+
) })
|
|
362
|
+
]
|
|
363
|
+
}
|
|
364
|
+
);
|
|
365
|
+
}, Bs = ({ size: t = 15 }) => /* @__PURE__ */ e(
|
|
366
|
+
"svg",
|
|
367
|
+
{
|
|
368
|
+
width: t,
|
|
369
|
+
height: t,
|
|
370
|
+
viewBox: "0 0 15 15",
|
|
371
|
+
fill: "none",
|
|
372
|
+
"aria-hidden": "true",
|
|
373
|
+
children: /* @__PURE__ */ e(
|
|
374
|
+
"path",
|
|
375
|
+
{
|
|
376
|
+
d: "M12.003 9a.985.985 0 0 1-.652.934l-3.223 1.191-1.188 3.226a.995.995 0 0 1-1.867 0l-1.195-3.226L.65 9.937a.995.995 0 0 1 0-1.867l3.227-1.195 1.187-3.226a.995.995 0 0 1 1.868 0l1.195 3.226 3.226 1.187a.99.99 0 0 1 .649.938m3-5.83a.52.52 0 0 1-.344.492l-1.702.63-.627 1.703a.525.525 0 0 1-.986 0l-.63-1.704-1.704-.627a.525.525 0 0 1 0-.986l1.703-.63.627-1.704a.526.526 0 0 1 .986 0l.631 1.703 1.704.627a.52.52 0 0 1 .342.495",
|
|
377
|
+
fill: "currentColor",
|
|
378
|
+
fillOpacity: 0.55
|
|
379
|
+
}
|
|
380
|
+
)
|
|
381
|
+
}
|
|
382
|
+
), js = (t) => {
|
|
383
|
+
var s;
|
|
384
|
+
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_TIP";
|
|
385
|
+
}, Gs = (t) => {
|
|
386
|
+
var s;
|
|
387
|
+
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_PAID";
|
|
388
|
+
}, He = (t) => {
|
|
389
|
+
var s;
|
|
390
|
+
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_CHATBOT";
|
|
391
|
+
}, Vs = (t) => {
|
|
392
|
+
var s;
|
|
393
|
+
return ((s = t.metadata) == null ? void 0 : s.custom_type) === "MESSAGE_ATTACHMENT";
|
|
394
|
+
}, pt = (t) => js(t) || Gs(t), Hs = (t) => {
|
|
395
|
+
var s;
|
|
396
|
+
return pt(t) && !((s = t.text) != null && s.trim());
|
|
397
|
+
}, Oe = ({
|
|
398
|
+
message: t,
|
|
399
|
+
standalone: s = !1,
|
|
400
|
+
isMyMessage: n = !1,
|
|
401
|
+
hasAttachment: o = !1
|
|
402
|
+
}) => {
|
|
403
|
+
var h;
|
|
404
|
+
const l = pt(t), d = He(t);
|
|
405
|
+
if (!l && !d)
|
|
406
|
+
return null;
|
|
407
|
+
if (l) {
|
|
408
|
+
const N = (h = t.metadata) == null ? void 0 : h.amount_text;
|
|
409
|
+
if (!N) return null;
|
|
410
|
+
const a = s ? "message-tip-standalone" : "message-tag message-tag--tip", _ = s ? `${N} tip` : `Delivered with ${N} tip`;
|
|
411
|
+
return /* @__PURE__ */ i("div", { className: a, children: [
|
|
412
|
+
/* @__PURE__ */ e(ms, { size: s ? 14 : 12 }),
|
|
413
|
+
/* @__PURE__ */ e("span", { children: _ })
|
|
414
|
+
] });
|
|
415
|
+
}
|
|
416
|
+
const r = n && o, c = r ? "Sent with AI" : "Sent with DM Agent", x = [
|
|
417
|
+
"message-chatbot-indicator",
|
|
418
|
+
n ? "message-chatbot-indicator--sender" : "message-chatbot-indicator--receiver",
|
|
419
|
+
r ? "message-chatbot-indicator--attachment" : "message-chatbot-indicator--text"
|
|
420
|
+
].join(" "), u = /* @__PURE__ */ e("span", { className: "message-chatbot-indicator__label", children: c }), g = /* @__PURE__ */ e("span", { className: "message-chatbot-indicator__icon", children: /* @__PURE__ */ e(Bs, { size: r ? 12 : 15 }) });
|
|
421
|
+
return /* @__PURE__ */ e("div", { className: x, "data-testid": "message-chatbot-indicator", children: n && !r ? /* @__PURE__ */ i(se, { children: [
|
|
422
|
+
u,
|
|
423
|
+
g
|
|
424
|
+
] }) : /* @__PURE__ */ i(se, { children: [
|
|
425
|
+
g,
|
|
426
|
+
u
|
|
427
|
+
] }) });
|
|
428
|
+
}, xt = z.memo(
|
|
429
|
+
({ channel: t, unread: s }) => {
|
|
430
|
+
var P, v, m, f;
|
|
431
|
+
const { selectedChannel: n, onChannelSelect: o, debug: l, renderMessagePreview: d } = As(), r = (n == null ? void 0 : n.id) === (t == null ? void 0 : t.id), c = () => {
|
|
432
|
+
t && o(t);
|
|
433
|
+
}, x = (T) => {
|
|
434
|
+
const M = T.key === "Enter" || T.key === " ", L = T.repeat;
|
|
435
|
+
!M || L || (T.preventDefault(), c());
|
|
436
|
+
}, g = Object.values(((P = t == null ? void 0 : t.state) == null ? void 0 : P.members) || {}).find(
|
|
437
|
+
(T) => {
|
|
438
|
+
var M, L;
|
|
439
|
+
return ((M = T.user) == null ? void 0 : M.id) && T.user.id !== ((L = t == null ? void 0 : t._client) == null ? void 0 : L.userID);
|
|
440
|
+
}
|
|
441
|
+
), h = ((v = g == null ? void 0 : g.user) == null ? void 0 : v.name) || "Conversation", N = (m = g == null ? void 0 : g.user) == null ? void 0 : m.image, a = (() => {
|
|
442
|
+
var M;
|
|
443
|
+
const T = (M = t == null ? void 0 : t.state) == null ? void 0 : M.messages;
|
|
444
|
+
if (T != null && T.length) {
|
|
445
|
+
for (let L = T.length - 1; L >= 0; L--)
|
|
446
|
+
if (T[L].type !== "system") return T[L];
|
|
447
|
+
}
|
|
448
|
+
})(), w = (() => {
|
|
449
|
+
var L, R;
|
|
450
|
+
if (a != null && a.text) return a.text;
|
|
451
|
+
if (((L = a == null ? void 0 : a.metadata) == null ? void 0 : L.custom_type) === "MESSAGE_TIP") return "๐ต Sent a tip";
|
|
452
|
+
const M = (R = a == null ? void 0 : a.attachments) == null ? void 0 : R[0];
|
|
453
|
+
return M ? M.og_scrape_url ? M.og_scrape_url : M.type === "image" ? "๐ท Sent an image" : M.type === "video" ? "๐ฅ Sent a video" : M.type === "audio" ? "๐ต Sent audio" : M.type === "file" ? "๐ Sent a file" : "๐ Sent an attachment" : "No messages yet";
|
|
454
|
+
})(), p = a != null && a.created_at ? Os(new Date(a.created_at)) : "", E = a ? He(a) : !1, S = d ? d(a, w) : `${E ? "โจ " : ""}${w}`, C = bt(t), k = s ?? 0;
|
|
455
|
+
return l && console.log("๐บ [ChannelList] ๐ CHANNEL PREVIEW RENDER", {
|
|
456
|
+
channelId: t == null ? void 0 : t.id,
|
|
457
|
+
isSelected: r,
|
|
458
|
+
participantName: h,
|
|
459
|
+
unreadCount: k,
|
|
460
|
+
hasTimestamp: !!p
|
|
461
|
+
}), /* @__PURE__ */ e(
|
|
462
|
+
"div",
|
|
463
|
+
{
|
|
464
|
+
role: "button",
|
|
465
|
+
tabIndex: 0,
|
|
466
|
+
onClick: c,
|
|
467
|
+
onKeyDown: x,
|
|
468
|
+
className: O(
|
|
469
|
+
"group w-full px-4 py-3 transition-colors text-left max-w-full overflow-hidden focus-ring",
|
|
470
|
+
{
|
|
471
|
+
"bg-primary-alt/10 border-l-4 border-l-primary": r,
|
|
472
|
+
"hover:bg-sand": !r
|
|
473
|
+
}
|
|
474
|
+
),
|
|
475
|
+
children: /* @__PURE__ */ i("div", { className: "flex items-start gap-3", children: [
|
|
476
|
+
/* @__PURE__ */ e(
|
|
477
|
+
oe,
|
|
478
|
+
{
|
|
479
|
+
id: ((f = g == null ? void 0 : g.user) == null ? void 0 : f.id) || t.id || "unknown",
|
|
480
|
+
name: h,
|
|
481
|
+
image: N,
|
|
482
|
+
size: 44,
|
|
483
|
+
starred: C,
|
|
484
|
+
className: "[&_.avatar-fallback]:group-hover:bg-[#eeeeee]"
|
|
485
|
+
}
|
|
486
|
+
),
|
|
487
|
+
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0 flex flex-col gap-1", children: [
|
|
488
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2", children: [
|
|
489
|
+
/* @__PURE__ */ i(
|
|
490
|
+
"h3",
|
|
491
|
+
{
|
|
492
|
+
className: O(
|
|
493
|
+
"text-sm font-medium truncate",
|
|
494
|
+
r ? "text-primary" : "text-charcoal"
|
|
495
|
+
),
|
|
496
|
+
children: [
|
|
497
|
+
C && /* @__PURE__ */ e("span", { className: "sr-only", children: "Starred conversation. " }),
|
|
498
|
+
h
|
|
499
|
+
]
|
|
500
|
+
}
|
|
501
|
+
),
|
|
502
|
+
p && /* @__PURE__ */ e("span", { className: "text-xs text-stone flex-shrink-0", children: p })
|
|
503
|
+
] }),
|
|
504
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between gap-2 min-w-0", children: [
|
|
505
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone flex-1 line-clamp-1", children: S }),
|
|
506
|
+
k > 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: k > 99 ? "99+" : k })
|
|
507
|
+
] })
|
|
508
|
+
] })
|
|
509
|
+
] })
|
|
510
|
+
}
|
|
511
|
+
);
|
|
512
|
+
}
|
|
513
|
+
);
|
|
514
|
+
xt.displayName = "CustomChannelPreview";
|
|
515
|
+
const Ys = { last_message_at: -1 }, vt = z.memo(
|
|
516
|
+
({
|
|
517
|
+
onChannelSelect: t,
|
|
518
|
+
selectedChannel: s,
|
|
519
|
+
filters: n,
|
|
520
|
+
allowNewMessagesFromUnfilteredChannels: o = !1,
|
|
521
|
+
onMessageNew: l,
|
|
522
|
+
onAddedToChannel: d,
|
|
523
|
+
channelRenderFilterFn: r,
|
|
524
|
+
sort: c = Ys,
|
|
525
|
+
className: x,
|
|
526
|
+
customEmptyStateIndicator: u,
|
|
527
|
+
renderMessagePreview: g
|
|
528
|
+
}) => {
|
|
529
|
+
const h = z.useRef(0);
|
|
530
|
+
h.current++;
|
|
531
|
+
const { debug: N = !1 } = Le(), a = z.useCallback(
|
|
532
|
+
(w) => {
|
|
533
|
+
for (const p of w)
|
|
534
|
+
Ps(p);
|
|
535
|
+
return r ? r(w) : w;
|
|
536
|
+
},
|
|
537
|
+
[r]
|
|
538
|
+
);
|
|
539
|
+
N && console.log("๐บ [ChannelList] ๐ RENDER START", {
|
|
540
|
+
renderCount: h.current,
|
|
541
|
+
selectedChannelId: s == null ? void 0 : s.id,
|
|
542
|
+
filters: n
|
|
543
|
+
});
|
|
544
|
+
const _ = z.useMemo(
|
|
545
|
+
() => ({
|
|
546
|
+
selectedChannel: s,
|
|
547
|
+
onChannelSelect: t,
|
|
548
|
+
debug: N,
|
|
549
|
+
renderMessagePreview: g
|
|
550
|
+
}),
|
|
551
|
+
[s, t, N, g]
|
|
552
|
+
);
|
|
553
|
+
return /* @__PURE__ */ e(
|
|
554
|
+
"div",
|
|
555
|
+
{
|
|
556
|
+
className: O(
|
|
557
|
+
"messaging-channel-list h-full flex flex-col min-w-0 overflow-hidden",
|
|
558
|
+
x
|
|
559
|
+
),
|
|
560
|
+
children: /* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden min-w-0", children: /* @__PURE__ */ e(Fs, { value: _, children: /* @__PURE__ */ e(
|
|
561
|
+
Rt,
|
|
562
|
+
{
|
|
563
|
+
filters: n,
|
|
564
|
+
sort: c,
|
|
565
|
+
options: { limit: 30 },
|
|
566
|
+
allowNewMessagesFromUnfilteredChannels: o,
|
|
567
|
+
onMessageNew: l,
|
|
568
|
+
onAddedToChannel: d,
|
|
569
|
+
channelRenderFilterFn: a,
|
|
570
|
+
Preview: xt,
|
|
571
|
+
EmptyStateIndicator: u
|
|
572
|
+
},
|
|
573
|
+
`${JSON.stringify(n)}:${JSON.stringify(c)}`
|
|
574
|
+
) }) })
|
|
575
|
+
}
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
);
|
|
579
|
+
vt.displayName = "ChannelList";
|
|
580
|
+
const ke = ({
|
|
581
|
+
variant: t = "default",
|
|
582
|
+
className: s,
|
|
583
|
+
children: n,
|
|
584
|
+
...o
|
|
585
|
+
}) => /* @__PURE__ */ e(
|
|
586
|
+
"button",
|
|
587
|
+
{
|
|
588
|
+
type: "button",
|
|
589
|
+
className: O(
|
|
590
|
+
"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",
|
|
591
|
+
t === "danger" ? "text-danger hover:bg-danger/50" : "text-charcoal hover:bg-sand",
|
|
592
|
+
s
|
|
593
|
+
),
|
|
594
|
+
...o,
|
|
595
|
+
children: n
|
|
596
|
+
}
|
|
597
|
+
);
|
|
598
|
+
function wt({ label: t, className: s, children: n, ...o }) {
|
|
599
|
+
return /* @__PURE__ */ i(
|
|
600
|
+
"button",
|
|
601
|
+
{
|
|
602
|
+
type: "button",
|
|
603
|
+
className: O(
|
|
604
|
+
"inline-flex items-center justify-center rounded-full transition-colors focus-ring p-2",
|
|
605
|
+
{
|
|
606
|
+
"cursor-not-allowed opacity-50": o.disabled,
|
|
607
|
+
"hover:bg-sand": !o.disabled
|
|
608
|
+
},
|
|
609
|
+
s
|
|
610
|
+
),
|
|
611
|
+
...o,
|
|
612
|
+
children: [
|
|
613
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: t }),
|
|
614
|
+
n
|
|
615
|
+
]
|
|
616
|
+
}
|
|
617
|
+
);
|
|
618
|
+
}
|
|
619
|
+
function Nt({ onClick: t }) {
|
|
620
|
+
return /* @__PURE__ */ e(wt, { label: "Close", onClick: t, className: "p-1", children: /* @__PURE__ */ e(Re, { className: "h-5 w-5 text-stone", weight: "bold" }) });
|
|
621
|
+
}
|
|
622
|
+
const Ws = ({
|
|
623
|
+
dialogRef: t,
|
|
624
|
+
onClose: s,
|
|
625
|
+
participant: n,
|
|
626
|
+
channel: o,
|
|
627
|
+
followerStatusLabel: l,
|
|
628
|
+
onLeaveConversation: d,
|
|
629
|
+
onBlockParticipant: r,
|
|
630
|
+
showDeleteConversation: c = !0,
|
|
631
|
+
onDeleteConversationClick: x,
|
|
632
|
+
onBlockParticipantClick: u,
|
|
633
|
+
onReportParticipantClick: g,
|
|
634
|
+
customProfileContent: h,
|
|
635
|
+
customChannelActions: N
|
|
636
|
+
}) => {
|
|
637
|
+
var V, F, H, Z, ae, K, b;
|
|
638
|
+
const { service: a, debug: _ } = Le(), [w, p] = I(!1), [E, S] = I(!1), [C, k] = I(!1), P = A(async () => {
|
|
639
|
+
var y;
|
|
640
|
+
if (!(!a || !((y = n == null ? void 0 : n.user) != null && y.id)))
|
|
641
|
+
try {
|
|
642
|
+
const j = (await a.getBlockedUsers()).some(
|
|
643
|
+
(te) => {
|
|
644
|
+
var le;
|
|
645
|
+
return te.blocked_user_id === ((le = n == null ? void 0 : n.user) == null ? void 0 : le.id);
|
|
646
|
+
}
|
|
647
|
+
);
|
|
648
|
+
p(j);
|
|
649
|
+
} catch (U) {
|
|
650
|
+
console.error(
|
|
651
|
+
"[ChannelInfoDialog] Failed to check blocked status:",
|
|
652
|
+
U
|
|
653
|
+
);
|
|
654
|
+
}
|
|
655
|
+
}, [a, (V = n == null ? void 0 : n.user) == null ? void 0 : V.id]);
|
|
656
|
+
q(() => {
|
|
657
|
+
P();
|
|
658
|
+
}, [P]);
|
|
659
|
+
const v = async () => {
|
|
660
|
+
var y;
|
|
661
|
+
if (!E) {
|
|
662
|
+
x == null || x(), _ && console.log("[ChannelInfoDialog] Leave conversation", o.cid), S(!0);
|
|
663
|
+
try {
|
|
664
|
+
const U = ((y = o._client) == null ? void 0 : y.userID) ?? null;
|
|
665
|
+
await o.hide(U, !1), d && await d(o), s();
|
|
666
|
+
} catch (U) {
|
|
667
|
+
console.error("[ChannelInfoDialog] Failed to leave conversation", U);
|
|
668
|
+
} finally {
|
|
669
|
+
S(!1);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}, m = async () => {
|
|
673
|
+
var y, U, j;
|
|
674
|
+
if (!(C || !a)) {
|
|
675
|
+
u == null || u(), _ && console.log("[ChannelInfoDialog] Block member", (y = n == null ? void 0 : n.user) == null ? void 0 : y.id), k(!0);
|
|
676
|
+
try {
|
|
677
|
+
await a.blockUser((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), r && await r((j = n == null ? void 0 : n.user) == null ? void 0 : j.id), s();
|
|
678
|
+
} catch (te) {
|
|
679
|
+
console.error("[ChannelInfoDialog] Failed to block member", te);
|
|
680
|
+
} finally {
|
|
681
|
+
k(!1);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
}, f = async () => {
|
|
685
|
+
var y, U, j;
|
|
686
|
+
if (!(C || !a)) {
|
|
687
|
+
u == null || u(), _ && console.log("[ChannelInfoDialog] Unblock member", (y = n == null ? void 0 : n.user) == null ? void 0 : y.id), k(!0);
|
|
688
|
+
try {
|
|
689
|
+
await a.unBlockUser((U = n == null ? void 0 : n.user) == null ? void 0 : U.id), r && await r((j = n == null ? void 0 : n.user) == null ? void 0 : j.id), s();
|
|
690
|
+
} catch (te) {
|
|
691
|
+
console.error("[ChannelInfoDialog] Failed to unblock member", te);
|
|
692
|
+
} finally {
|
|
693
|
+
k(!1);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}, T = () => {
|
|
697
|
+
g == null || g(), s(), window.open(
|
|
698
|
+
"https://linktr.ee/s/about/trust-center/report",
|
|
699
|
+
"_blank",
|
|
700
|
+
"noopener,noreferrer"
|
|
701
|
+
);
|
|
702
|
+
};
|
|
703
|
+
if (!n) return null;
|
|
704
|
+
const M = ((F = n.user) == null ? void 0 : F.name) || ((H = n.user) == null ? void 0 : H.id) || "Unknown member", L = (Z = n.user) == null ? void 0 : Z.image, R = (ae = n.user) == null ? void 0 : ae.email, B = (K = n.user) == null ? void 0 : K.username, ee = R || (B ? `linktr.ee/${B}` : void 0), J = ((b = n.user) == null ? void 0 : b.id) || "unknown";
|
|
705
|
+
return (
|
|
706
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
707
|
+
/* @__PURE__ */ e(
|
|
708
|
+
"dialog",
|
|
709
|
+
{
|
|
710
|
+
ref: t,
|
|
711
|
+
className: "mes-dialog group",
|
|
712
|
+
onClose: s,
|
|
713
|
+
onClick: (y) => {
|
|
714
|
+
y.target === t.current && s();
|
|
715
|
+
},
|
|
716
|
+
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: [
|
|
717
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between border-b border-sand px-4 py-3", children: [
|
|
718
|
+
/* @__PURE__ */ e("h2", { className: "text-base font-semibold text-charcoal", children: "Chat info" }),
|
|
719
|
+
/* @__PURE__ */ e(Nt, { onClick: s })
|
|
720
|
+
] }),
|
|
721
|
+
/* @__PURE__ */ i("div", { className: "flex-1 px-2 overflow-y-auto w-full", children: [
|
|
722
|
+
/* @__PURE__ */ i(
|
|
723
|
+
"div",
|
|
724
|
+
{
|
|
725
|
+
className: "flex flex-col items-center gap-3 self-stretch px-4 py-2 mt-6 rounded-lg border border-black/[0.04]",
|
|
726
|
+
style: { backgroundColor: "#FBFAF9" },
|
|
727
|
+
children: [
|
|
728
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-3 w-full", children: [
|
|
729
|
+
/* @__PURE__ */ e(
|
|
730
|
+
oe,
|
|
731
|
+
{
|
|
732
|
+
id: J,
|
|
733
|
+
name: M,
|
|
734
|
+
image: L,
|
|
735
|
+
size: 88,
|
|
736
|
+
shape: "circle"
|
|
737
|
+
}
|
|
738
|
+
),
|
|
739
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col min-w-0 flex-1", children: [
|
|
740
|
+
/* @__PURE__ */ e("p", { className: "truncate text-base font-semibold text-charcoal", children: M }),
|
|
741
|
+
ee && /* @__PURE__ */ e("p", { className: "truncate text-sm text-[#00000055]", children: ee }),
|
|
742
|
+
l && !h && /* @__PURE__ */ e(
|
|
743
|
+
"span",
|
|
744
|
+
{
|
|
745
|
+
className: "mt-1 rounded-full text-xs font-normal w-fit",
|
|
746
|
+
style: {
|
|
747
|
+
padding: "4px 8px",
|
|
748
|
+
backgroundColor: l === "Subscribed to you" ? "#DCFCE7" : "#F5F5F4",
|
|
749
|
+
color: l === "Subscribed to you" ? "#008236" : "#78716C",
|
|
750
|
+
lineHeight: "133.333%",
|
|
751
|
+
letterSpacing: "0.21px"
|
|
752
|
+
},
|
|
753
|
+
children: l
|
|
754
|
+
}
|
|
755
|
+
)
|
|
756
|
+
] })
|
|
757
|
+
] }),
|
|
758
|
+
h && /* @__PURE__ */ e("div", { className: "w-full", children: h })
|
|
759
|
+
]
|
|
760
|
+
}
|
|
761
|
+
),
|
|
762
|
+
/* @__PURE__ */ i("ul", { className: "flex flex-col gap-2 mt-2", children: [
|
|
763
|
+
c && /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
|
|
764
|
+
ke,
|
|
765
|
+
{
|
|
766
|
+
onClick: v,
|
|
767
|
+
disabled: E,
|
|
768
|
+
"aria-busy": E,
|
|
769
|
+
children: [
|
|
770
|
+
E ? /* @__PURE__ */ e(Ie, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(hs, { className: "h-5 w-5" }),
|
|
771
|
+
/* @__PURE__ */ e("span", { children: "Delete Conversation" })
|
|
772
|
+
]
|
|
773
|
+
}
|
|
774
|
+
) }),
|
|
775
|
+
/* @__PURE__ */ e("li", { children: w ? /* @__PURE__ */ i(
|
|
776
|
+
ke,
|
|
777
|
+
{
|
|
778
|
+
onClick: f,
|
|
779
|
+
disabled: C,
|
|
780
|
+
"aria-busy": C,
|
|
781
|
+
children: [
|
|
782
|
+
C ? /* @__PURE__ */ e(Ie, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Xe, { className: "h-5 w-5" }),
|
|
783
|
+
/* @__PURE__ */ e("span", { children: "Unblock" })
|
|
784
|
+
]
|
|
785
|
+
}
|
|
786
|
+
) : /* @__PURE__ */ i(
|
|
787
|
+
ke,
|
|
788
|
+
{
|
|
789
|
+
onClick: m,
|
|
790
|
+
disabled: C,
|
|
791
|
+
"aria-busy": C,
|
|
792
|
+
children: [
|
|
793
|
+
C ? /* @__PURE__ */ e(Ie, { className: "h-5 w-5 animate-spin" }) : /* @__PURE__ */ e(Xe, { className: "h-5 w-5" }),
|
|
794
|
+
/* @__PURE__ */ e("span", { children: "Block" })
|
|
795
|
+
]
|
|
796
|
+
}
|
|
797
|
+
) }),
|
|
798
|
+
/* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(ke, { variant: "danger", onClick: T, children: [
|
|
799
|
+
/* @__PURE__ */ e(fs, { className: "h-5 w-5" }),
|
|
800
|
+
/* @__PURE__ */ e("span", { children: "Report" })
|
|
801
|
+
] }) }),
|
|
802
|
+
N
|
|
803
|
+
] })
|
|
804
|
+
] })
|
|
805
|
+
] })
|
|
806
|
+
}
|
|
807
|
+
)
|
|
808
|
+
);
|
|
809
|
+
}, qs = (t) => /* @__PURE__ */ e(Lt, { ...t, position: "center" }), je = "vote_up", Ge = "vote_down";
|
|
810
|
+
function Zs(t) {
|
|
811
|
+
return t != null && t.length ? t.some((s) => s.type === Ge) ? "down" : t.some((s) => s.type === je) ? "up" : null : null;
|
|
812
|
+
}
|
|
813
|
+
function Xs(t) {
|
|
814
|
+
const { channel: s } = fe(), { client: n } = ct("useMessageVote"), o = ze(
|
|
815
|
+
() => Zs(t.own_reactions),
|
|
816
|
+
[t.own_reactions]
|
|
817
|
+
), l = A(async () => {
|
|
818
|
+
if (n != null && n.userID)
|
|
819
|
+
try {
|
|
820
|
+
o === "up" ? await s.deleteReaction(t.id, je) : await s.sendReaction(
|
|
821
|
+
t.id,
|
|
822
|
+
{ type: je },
|
|
823
|
+
{ enforce_unique: !0, skip_push: !0 }
|
|
824
|
+
);
|
|
825
|
+
} catch {
|
|
826
|
+
}
|
|
827
|
+
}, [s, n == null ? void 0 : n.userID, t.id, o]), d = A(async () => {
|
|
828
|
+
if (n != null && n.userID)
|
|
829
|
+
try {
|
|
830
|
+
o === "down" ? await s.deleteReaction(t.id, Ge) : await s.sendReaction(
|
|
831
|
+
t.id,
|
|
832
|
+
{ type: Ge },
|
|
833
|
+
{ enforce_unique: !0, skip_push: !0 }
|
|
834
|
+
);
|
|
835
|
+
} catch {
|
|
836
|
+
}
|
|
837
|
+
}, [s, n == null ? void 0 : n.userID, t.id, o]);
|
|
838
|
+
return { selected: o, voteUp: l, voteDown: d };
|
|
839
|
+
}
|
|
840
|
+
const Ks = z.lazy(() => import("./Card-BfA8wq8O.js")), Js = z.lazy(() => import("./Card-Bpud_enW.js")), yt = () => /* @__PURE__ */ e(
|
|
841
|
+
"div",
|
|
842
|
+
{
|
|
843
|
+
className: "w-[280px] min-h-[200px] animate-pulse rounded-[24px] bg-black/[0.06] shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_4px_8px_rgba(0,0,0,0.06)]",
|
|
844
|
+
"aria-hidden": !0
|
|
845
|
+
}
|
|
846
|
+
), Qs = (t) => /* @__PURE__ */ e(it, { fallback: /* @__PURE__ */ e(yt, {}), children: /* @__PURE__ */ e(Ks, { ...t }) }), en = (t) => /* @__PURE__ */ e(it, { fallback: /* @__PURE__ */ e(yt, {}), children: /* @__PURE__ */ e(Js, { ...t }) }), at = { Creator: Qs, Visitor: en }, tn = {
|
|
847
|
+
isUnlocking: () => !1
|
|
848
|
+
}, sn = {
|
|
849
|
+
LockedAttachment: tn
|
|
850
|
+
}, Ct = ot({}), na = Ct.Provider;
|
|
851
|
+
function nn(t) {
|
|
852
|
+
return lt(Ct)[t] ?? sn[t];
|
|
853
|
+
}
|
|
854
|
+
const an = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ e(
|
|
855
|
+
"path",
|
|
856
|
+
{
|
|
857
|
+
d: "M4.667 7.333l2.666-6A1.333 1.333 0 018.667 2v2.667a.667.667 0 00.666.666h3.764a1.334 1.334 0 011.192 1.93l-2.333 4.666a1.333 1.333 0 01-1.193.738H4.667m0-5.334v5.334m0-5.334H2.667a1.333 1.333 0 00-1.334 1.334v2.666a1.333 1.333 0 001.334 1.334h2",
|
|
858
|
+
stroke: "currentColor",
|
|
859
|
+
strokeWidth: "1.33",
|
|
860
|
+
strokeLinecap: "round",
|
|
861
|
+
strokeLinejoin: "round",
|
|
862
|
+
fill: t ? "currentColor" : "none"
|
|
863
|
+
}
|
|
864
|
+
) }), rn = ({ filled: t }) => /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ e(
|
|
865
|
+
"path",
|
|
866
|
+
{
|
|
867
|
+
d: "M11.333 8.667l-2.666 6A1.333 1.333 0 017.333 14v-2.667a.667.667 0 00-.666-.666H2.903a1.334 1.334 0 01-1.192-1.93l2.333-4.666a1.333 1.333 0 011.193-.738h6.096m0 5.334V3.333m0 5.334h2a1.333 1.333 0 001.334-1.334V4.667a1.333 1.333 0 00-1.334-1.334h-2",
|
|
868
|
+
stroke: "currentColor",
|
|
869
|
+
strokeWidth: "1.33",
|
|
870
|
+
strokeLinecap: "round",
|
|
871
|
+
strokeLinejoin: "round",
|
|
872
|
+
fill: t ? "currentColor" : "none"
|
|
873
|
+
}
|
|
874
|
+
) }), on = ({
|
|
875
|
+
selected: t,
|
|
876
|
+
onVoteUp: s,
|
|
877
|
+
onVoteDown: n
|
|
878
|
+
}) => /* @__PURE__ */ i("div", { className: "message-vote-buttons", children: [
|
|
879
|
+
/* @__PURE__ */ e(
|
|
880
|
+
"button",
|
|
881
|
+
{
|
|
882
|
+
type: "button",
|
|
883
|
+
className: `message-vote-button${t === "up" ? " message-vote-button--selected" : ""} focus-ring`,
|
|
884
|
+
onClick: s,
|
|
885
|
+
"aria-label": "Helpful",
|
|
886
|
+
"aria-pressed": t === "up",
|
|
887
|
+
children: /* @__PURE__ */ e(an, { filled: t === "up" })
|
|
888
|
+
}
|
|
889
|
+
),
|
|
890
|
+
/* @__PURE__ */ e(
|
|
891
|
+
"button",
|
|
892
|
+
{
|
|
893
|
+
type: "button",
|
|
894
|
+
className: `message-vote-button${t === "down" ? " message-vote-button--selected" : ""} focus-ring`,
|
|
895
|
+
onClick: n,
|
|
896
|
+
"aria-label": "Not helpful",
|
|
897
|
+
"aria-pressed": t === "down",
|
|
898
|
+
children: /* @__PURE__ */ e(rn, { filled: t === "down" })
|
|
899
|
+
}
|
|
900
|
+
)
|
|
901
|
+
] }), ln = (t) => {
|
|
902
|
+
var ce, ne, Ne, ye, Ce, de, _e, Ee, Se, ue, D, W, $, G;
|
|
903
|
+
const {
|
|
904
|
+
additionalMessageInputProps: s,
|
|
905
|
+
chatbotVotingEnabled: n,
|
|
906
|
+
editing: o,
|
|
907
|
+
endOfGroup: l,
|
|
908
|
+
firstOfGroup: d,
|
|
909
|
+
groupedByUser: r,
|
|
910
|
+
handleAction: c,
|
|
911
|
+
handleOpenThread: x,
|
|
912
|
+
handleRetry: u,
|
|
913
|
+
highlighted: g,
|
|
914
|
+
isMessageAIGenerated: h,
|
|
915
|
+
isMyMessage: N,
|
|
916
|
+
message: a,
|
|
917
|
+
renderText: _,
|
|
918
|
+
threadList: w
|
|
919
|
+
} = t, { client: p } = ct("CustomMessage"), { channel: E } = fe("CustomMessage"), { isUnlocking: S, onUnlockClick: C, onFetchSource: k, onDownloadClick: P } = nn("LockedAttachment"), [v, m] = I(!1), f = Ft(a.id), { selected: T, voteUp: M, voteDown: L } = Xs(a), {
|
|
920
|
+
Attachment: R = At,
|
|
921
|
+
EditMessageModal: B = Ut,
|
|
922
|
+
MessageBlocked: ee = Ot,
|
|
923
|
+
MessageBouncePrompt: J = $t,
|
|
924
|
+
MessageDeleted: V = zt,
|
|
925
|
+
MessageIsThreadReplyInChannelButtonIndicator: F = Bt,
|
|
926
|
+
MessageRepliesCountButton: H = jt,
|
|
927
|
+
ReminderNotification: Z = Gt,
|
|
928
|
+
StreamedMessageText: ae = Vt,
|
|
929
|
+
PinIndicator: K
|
|
930
|
+
} = dt("CustomMessage"), b = Ht(a), y = Yt(a), U = ze(
|
|
931
|
+
() => h == null ? void 0 : h(a),
|
|
932
|
+
[h, a]
|
|
933
|
+
), j = ze(
|
|
934
|
+
() => !a.shared_location && !a.attachments ? [] : a.shared_location ? [a.shared_location, ...a.attachments ?? []] : a.attachments,
|
|
935
|
+
[a]
|
|
936
|
+
);
|
|
937
|
+
if (Wt(a))
|
|
938
|
+
return null;
|
|
939
|
+
if (a.deleted_at || a.type === "deleted")
|
|
940
|
+
return /* @__PURE__ */ e(V, { message: a });
|
|
941
|
+
if (qt(a))
|
|
942
|
+
return /* @__PURE__ */ e(ee, {});
|
|
943
|
+
const te = !w && !!a.reply_count, le = !w && a.show_in_channel && a.parent_id, pe = a.status === "failed" && ((ce = a.error) == null ? void 0 : ce.status) !== 403, Pe = Zt(a);
|
|
944
|
+
let Y;
|
|
945
|
+
pe ? Y = () => u(a) : Pe && (Y = () => m(!0));
|
|
946
|
+
const Q = N(), xe = O(
|
|
947
|
+
"str-chat__message str-chat__message-simple",
|
|
948
|
+
`str-chat__message--${a.type}`,
|
|
949
|
+
`str-chat__message--${a.status}`,
|
|
950
|
+
Q ? "str-chat__message--me str-chat__message-simple--me" : "str-chat__message--other",
|
|
951
|
+
a.text ? "str-chat__message--has-text" : "has-no-text",
|
|
952
|
+
{
|
|
953
|
+
"str-chat__message--has-attachment": b,
|
|
954
|
+
"str-chat__message--highlighted": g,
|
|
955
|
+
"str-chat__message--pinned pinned-message": a.pinned,
|
|
956
|
+
"str-chat__message--with-reactions": y,
|
|
957
|
+
"str-chat__message-send-can-be-retried": (a == null ? void 0 : a.status) === "failed" && ((ne = a == null ? void 0 : a.error) == null ? void 0 : ne.status) !== 403,
|
|
958
|
+
"str-chat__message-with-thread-link": te || le,
|
|
959
|
+
"str-chat__virtual-message__wrapper--end": l,
|
|
960
|
+
"str-chat__virtual-message__wrapper--first": d,
|
|
961
|
+
"str-chat__virtual-message__wrapper--group": r
|
|
962
|
+
}
|
|
963
|
+
), re = a.poll_id && p.polls.fromState(a.poll_id), me = Hs(a), ie = He(a), ve = Vs(a), ge = !!(j != null && j.length && !a.quoted_message), we = ie && Q && ge;
|
|
964
|
+
return /* @__PURE__ */ i(se, { children: [
|
|
965
|
+
o && /* @__PURE__ */ e(
|
|
966
|
+
B,
|
|
967
|
+
{
|
|
968
|
+
additionalMessageInputProps: s
|
|
969
|
+
}
|
|
970
|
+
),
|
|
971
|
+
v && /* @__PURE__ */ e(
|
|
972
|
+
Xt,
|
|
973
|
+
{
|
|
974
|
+
MessageBouncePrompt: J,
|
|
975
|
+
onClose: () => m(!1),
|
|
976
|
+
open: v
|
|
977
|
+
}
|
|
978
|
+
),
|
|
979
|
+
/* @__PURE__ */ i("div", { className: xe, children: [
|
|
980
|
+
K && /* @__PURE__ */ e(K, {}),
|
|
981
|
+
!!f && /* @__PURE__ */ e(Z, { reminder: f }),
|
|
982
|
+
a.user && /* @__PURE__ */ e(
|
|
983
|
+
oe,
|
|
984
|
+
{
|
|
985
|
+
className: "str-chat__avatar str-chat__message-sender-avatar",
|
|
986
|
+
id: a.user.id,
|
|
987
|
+
image: a.user.image,
|
|
988
|
+
name: a.user.name || a.user.id
|
|
989
|
+
}
|
|
990
|
+
),
|
|
991
|
+
/* @__PURE__ */ e(
|
|
992
|
+
"div",
|
|
993
|
+
{
|
|
994
|
+
className: O("str-chat__message-inner", {
|
|
995
|
+
"str-chat__simple-message--error-failed": pe || Pe
|
|
996
|
+
}),
|
|
997
|
+
"data-testid": "message-inner",
|
|
998
|
+
onClick: Y,
|
|
999
|
+
onKeyDown: Y,
|
|
1000
|
+
role: Y ? "button" : void 0,
|
|
1001
|
+
tabIndex: Y ? 0 : void 0,
|
|
1002
|
+
style: {
|
|
1003
|
+
// Force margins to 0 to prevent hover layout shift
|
|
1004
|
+
// Stream Chat CSS sets margin-inline-end/start to 78px, then 0 on hover
|
|
1005
|
+
marginInlineEnd: 0,
|
|
1006
|
+
marginInlineStart: 0
|
|
1007
|
+
},
|
|
1008
|
+
children: ve ? /* @__PURE__ */ i("div", { className: `flex flex-col gap-1 ${Q ? "items-end" : "items-start"}`, children: [
|
|
1009
|
+
Q ? /* @__PURE__ */ e(
|
|
1010
|
+
at.Creator,
|
|
1011
|
+
{
|
|
1012
|
+
title: (Ne = a.metadata) == null ? void 0 : Ne.attachment_title,
|
|
1013
|
+
mimeType: (ye = a.metadata) == null ? void 0 : ye.attachment_mime_type,
|
|
1014
|
+
thumbnailUrl: (Ce = a.metadata) == null ? void 0 : Ce.attachment_thumbnail,
|
|
1015
|
+
amountText: (de = a.metadata) == null ? void 0 : de.amount_text,
|
|
1016
|
+
detail: (_e = a.metadata) == null ? void 0 : _e.attachment_detail,
|
|
1017
|
+
paymentStatus: (Ee = a.metadata) == null ? void 0 : Ee.payment_status
|
|
1018
|
+
}
|
|
1019
|
+
) : /* @__PURE__ */ e(
|
|
1020
|
+
at.Visitor,
|
|
1021
|
+
{
|
|
1022
|
+
title: (Se = a.metadata) == null ? void 0 : Se.attachment_title,
|
|
1023
|
+
mimeType: (ue = a.metadata) == null ? void 0 : ue.attachment_mime_type,
|
|
1024
|
+
thumbnailUrl: (D = a.metadata) == null ? void 0 : D.attachment_thumbnail,
|
|
1025
|
+
amountText: (W = a.metadata) == null ? void 0 : W.amount_text,
|
|
1026
|
+
detail: ($ = a.metadata) == null ? void 0 : $.attachment_detail,
|
|
1027
|
+
paymentStatus: (G = a.metadata) == null ? void 0 : G.payment_status,
|
|
1028
|
+
isUnlocking: S(a.id),
|
|
1029
|
+
onUnlockClick: () => C == null ? void 0 : C(a, E),
|
|
1030
|
+
onFetchSource: async () => await (k == null ? void 0 : k(a, E)),
|
|
1031
|
+
onDownloadClick: () => P == null ? void 0 : P(a, E)
|
|
1032
|
+
}
|
|
1033
|
+
),
|
|
1034
|
+
a.text && /* @__PURE__ */ e("div", { className: "str-chat__message-bubble-wrapper", children: /* @__PURE__ */ e("div", { className: "str-chat__message-bubble", children: /* @__PURE__ */ e(Ze, { message: a, renderText: _ }) }) })
|
|
1035
|
+
] }) : me ? (
|
|
1036
|
+
/* Tip-only messages render as a standalone bubble */
|
|
1037
|
+
/* @__PURE__ */ e(Oe, { message: a, standalone: !0 })
|
|
1038
|
+
) : /* @__PURE__ */ i("div", { className: "str-chat__message-bubble-wrapper", children: [
|
|
1039
|
+
/* @__PURE__ */ i("div", { className: "str-chat__message-bubble", children: [
|
|
1040
|
+
ie && !we && /* @__PURE__ */ e(
|
|
1041
|
+
Oe,
|
|
1042
|
+
{
|
|
1043
|
+
message: a,
|
|
1044
|
+
hasAttachment: ge,
|
|
1045
|
+
isMyMessage: Q
|
|
1046
|
+
}
|
|
1047
|
+
),
|
|
1048
|
+
re && /* @__PURE__ */ e(Kt, { poll: re }),
|
|
1049
|
+
j != null && j.length && !a.quoted_message ? /* @__PURE__ */ e(
|
|
1050
|
+
R,
|
|
1051
|
+
{
|
|
1052
|
+
actionHandler: c,
|
|
1053
|
+
attachments: j
|
|
1054
|
+
}
|
|
1055
|
+
) : null,
|
|
1056
|
+
U ? /* @__PURE__ */ e(
|
|
1057
|
+
ae,
|
|
1058
|
+
{
|
|
1059
|
+
message: a,
|
|
1060
|
+
renderText: _
|
|
1061
|
+
}
|
|
1062
|
+
) : /* @__PURE__ */ e(Ze, { message: a, renderText: _ }),
|
|
1063
|
+
/* @__PURE__ */ e(Jt, {})
|
|
1064
|
+
] }),
|
|
1065
|
+
(!ie || we) && /* @__PURE__ */ e(
|
|
1066
|
+
Oe,
|
|
1067
|
+
{
|
|
1068
|
+
message: a,
|
|
1069
|
+
hasAttachment: ge,
|
|
1070
|
+
isMyMessage: Q
|
|
1071
|
+
}
|
|
1072
|
+
),
|
|
1073
|
+
n && ie && /* @__PURE__ */ e(
|
|
1074
|
+
on,
|
|
1075
|
+
{
|
|
1076
|
+
selected: T,
|
|
1077
|
+
onVoteUp: M,
|
|
1078
|
+
onVoteDown: L
|
|
1079
|
+
}
|
|
1080
|
+
)
|
|
1081
|
+
] })
|
|
1082
|
+
}
|
|
1083
|
+
),
|
|
1084
|
+
te && /* @__PURE__ */ e(
|
|
1085
|
+
H,
|
|
1086
|
+
{
|
|
1087
|
+
onClick: x,
|
|
1088
|
+
reply_count: a.reply_count
|
|
1089
|
+
}
|
|
1090
|
+
),
|
|
1091
|
+
le && /* @__PURE__ */ e(F, {})
|
|
1092
|
+
] }, a.id)
|
|
1093
|
+
] });
|
|
1094
|
+
}, cn = z.memo(
|
|
1095
|
+
ln,
|
|
1096
|
+
(t, s) => t.chatbotVotingEnabled !== s.chatbotVotingEnabled ? !1 : Pt(t, s)
|
|
1097
|
+
), dn = (t) => {
|
|
1098
|
+
const s = ut("CustomMessage");
|
|
1099
|
+
return /* @__PURE__ */ e(cn, { ...s, ...t });
|
|
1100
|
+
}, un = (t) => ({
|
|
1101
|
+
linkPreviews: Array.from(t.previews.values()).filter(
|
|
1102
|
+
(s) => st.previewIsLoaded(s) || st.previewIsLoading(s)
|
|
1103
|
+
)
|
|
1104
|
+
}), mn = ({
|
|
1105
|
+
link: t,
|
|
1106
|
+
onDismiss: s
|
|
1107
|
+
}) => {
|
|
1108
|
+
const { og_scrape_url: n, title: o, image_url: l } = t;
|
|
1109
|
+
return /* @__PURE__ */ i(
|
|
1110
|
+
"a",
|
|
1111
|
+
{
|
|
1112
|
+
href: n,
|
|
1113
|
+
target: "_blank",
|
|
1114
|
+
rel: "noopener noreferrer",
|
|
1115
|
+
className: "relative w-full block rounded-[24px] bg-[#121110] p-2 no-underline transition-opacity hover:opacity-90",
|
|
1116
|
+
children: [
|
|
1117
|
+
l && /* @__PURE__ */ e(
|
|
1118
|
+
"img",
|
|
1119
|
+
{
|
|
1120
|
+
src: l,
|
|
1121
|
+
alt: o || "",
|
|
1122
|
+
className: "h-[148px] w-full rounded-[20px] object-cover"
|
|
1123
|
+
}
|
|
1124
|
+
),
|
|
1125
|
+
/* @__PURE__ */ e(
|
|
1126
|
+
"button",
|
|
1127
|
+
{
|
|
1128
|
+
type: "button",
|
|
1129
|
+
onClick: (r) => {
|
|
1130
|
+
r.preventDefault(), s(n);
|
|
1131
|
+
},
|
|
1132
|
+
className: "absolute right-4 top-4 flex size-6 items-center justify-center rounded-full border border-white/40 bg-white/70 backdrop-blur-2xl focus-ring",
|
|
1133
|
+
"aria-label": "Close link preview",
|
|
1134
|
+
children: /* @__PURE__ */ e(Re, { className: "size-4 text-black/90" })
|
|
1135
|
+
}
|
|
1136
|
+
),
|
|
1137
|
+
/* @__PURE__ */ i("div", { className: "p-2", children: [
|
|
1138
|
+
o && /* @__PURE__ */ e("div", { className: "text-[14px] font-medium leading-5 text-white", children: o }),
|
|
1139
|
+
/* @__PURE__ */ e("div", { className: "text-[12px] leading-4 text-white/55", children: n })
|
|
1140
|
+
] })
|
|
1141
|
+
]
|
|
1142
|
+
}
|
|
1143
|
+
);
|
|
1144
|
+
}, hn = () => {
|
|
1145
|
+
const { linkPreviewsManager: t } = Qt(), { linkPreviews: s } = es(
|
|
1146
|
+
t.state,
|
|
1147
|
+
un
|
|
1148
|
+
), n = (l) => {
|
|
1149
|
+
t.dismissPreview(l);
|
|
1150
|
+
};
|
|
1151
|
+
return s.length > 0 ? /* @__PURE__ */ e("div", { className: "flex flex-col items-center w-full gap-2 mb-4", children: s.map((l) => /* @__PURE__ */ e(
|
|
1152
|
+
mn,
|
|
1153
|
+
{
|
|
1154
|
+
link: l,
|
|
1155
|
+
onDismiss: n
|
|
1156
|
+
},
|
|
1157
|
+
l.og_scrape_url
|
|
1158
|
+
)) }) : null;
|
|
1159
|
+
}, fn = ({ sendMessage: t, disabled: s, ...n }) => /* @__PURE__ */ e(
|
|
1160
|
+
"button",
|
|
1161
|
+
{
|
|
1162
|
+
...n,
|
|
1163
|
+
type: "button",
|
|
1164
|
+
"aria-label": "Send",
|
|
1165
|
+
disabled: s,
|
|
1166
|
+
onClick: t,
|
|
1167
|
+
children: /* @__PURE__ */ e(gs, { weight: "bold", className: "size-4" })
|
|
1168
|
+
}
|
|
1169
|
+
), gn = () => {
|
|
1170
|
+
var c;
|
|
1171
|
+
const { channel: t } = fe(), s = ((c = t == null ? void 0 : t.data) == null ? void 0 : c.frozen) === !0, { handleSubmit: n } = ss(), { SendButton: o } = dt(
|
|
1172
|
+
"CustomMessageInput"
|
|
1173
|
+
), l = o ?? fn, d = ns();
|
|
1174
|
+
return /* @__PURE__ */ i(se, { children: [
|
|
1175
|
+
/* @__PURE__ */ e("div", { className: "left-container", children: /* @__PURE__ */ e(as, {}) }),
|
|
1176
|
+
/* @__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: [
|
|
1177
|
+
/* @__PURE__ */ e(rs, {}),
|
|
1178
|
+
/* @__PURE__ */ e(hn, {}),
|
|
1179
|
+
/* @__PURE__ */ e(os, {}),
|
|
1180
|
+
/* @__PURE__ */ i("div", { className: "flex", children: [
|
|
1181
|
+
/* @__PURE__ */ e("div", { className: "w-full ml-2 mr-4 self-center leading-[0]", children: /* @__PURE__ */ e(
|
|
1182
|
+
ls,
|
|
1183
|
+
{
|
|
1184
|
+
"aria-disabled": s || void 0,
|
|
1185
|
+
className: "w-full resize-none outline-none leading-6",
|
|
1186
|
+
autoFocus: !s,
|
|
1187
|
+
maxRows: 4,
|
|
1188
|
+
readOnly: s,
|
|
1189
|
+
tabIndex: s ? -1 : void 0
|
|
1190
|
+
}
|
|
1191
|
+
) }),
|
|
1192
|
+
/* @__PURE__ */ e(
|
|
1193
|
+
l,
|
|
1194
|
+
{
|
|
1195
|
+
sendMessage: n,
|
|
1196
|
+
"aria-label": "Send",
|
|
1197
|
+
className: "str-chat__send-button mt-auto flex justify-center items-center flex-shrink-0 rounded-full size-8 bg-[#121110] disabled:bg-[#F1F0EE] disabled:text-black/20 text-white focus-ring",
|
|
1198
|
+
"data-testid": "send-button",
|
|
1199
|
+
disabled: s || !d,
|
|
1200
|
+
type: "button"
|
|
1201
|
+
}
|
|
1202
|
+
)
|
|
1203
|
+
] })
|
|
1204
|
+
] })
|
|
1205
|
+
] });
|
|
1206
|
+
}, bn = ({
|
|
1207
|
+
renderActions: t
|
|
1208
|
+
}) => {
|
|
1209
|
+
var o;
|
|
1210
|
+
const { channel: s } = fe(), n = ((o = s == null ? void 0 : s.data) == null ? void 0 : o.frozen) === !0;
|
|
1211
|
+
return /* @__PURE__ */ i(
|
|
1212
|
+
"div",
|
|
1213
|
+
{
|
|
1214
|
+
inert: n ? "" : void 0,
|
|
1215
|
+
"aria-disabled": n || void 0,
|
|
1216
|
+
className: "message-input flex items-center gap-2 p-4 aria-disabled:opacity-40",
|
|
1217
|
+
children: [
|
|
1218
|
+
t == null ? void 0 : t(),
|
|
1219
|
+
/* @__PURE__ */ e(ts, { Input: gn })
|
|
1220
|
+
]
|
|
1221
|
+
}
|
|
1222
|
+
);
|
|
1223
|
+
}, pn = [
|
|
1224
|
+
"SYSTEM_DM_AGENT_PAUSED",
|
|
1225
|
+
"SYSTEM_DM_AGENT_RESUMED"
|
|
1226
|
+
], xn = {
|
|
1227
|
+
SYSTEM_DM_AGENT_PAUSED: "DM Agent has left the conversation",
|
|
1228
|
+
SYSTEM_DM_AGENT_RESUMED: "DM Agent has rejoined the conversation"
|
|
1229
|
+
}, vn = [
|
|
1230
|
+
"SYSTEM_AGE_SAFETY_BLOCKED"
|
|
1231
|
+
], wn = {
|
|
1232
|
+
SYSTEM_AGE_SAFETY_BLOCKED: "This user isnโt able to reply because they donโt meet our age safety guidelines."
|
|
1233
|
+
}, $e = "age safety guidelines.", Nn = "https://linktr.ee/s/about/contact", rt = (t) => pn.includes(t), yn = (t) => vn.includes(t), Cn = (t) => {
|
|
1234
|
+
var o;
|
|
1235
|
+
const s = (o = t.metadata) == null ? void 0 : o.custom_type;
|
|
1236
|
+
if (rt(s))
|
|
1237
|
+
return {
|
|
1238
|
+
kind: "dm-agent",
|
|
1239
|
+
type: s
|
|
1240
|
+
};
|
|
1241
|
+
if (yn(s))
|
|
1242
|
+
return {
|
|
1243
|
+
kind: "age-safety",
|
|
1244
|
+
type: s
|
|
1245
|
+
};
|
|
1246
|
+
const n = t.dm_agent_system_type;
|
|
1247
|
+
if (rt(n))
|
|
1248
|
+
return {
|
|
1249
|
+
kind: "dm-agent",
|
|
1250
|
+
type: n
|
|
1251
|
+
};
|
|
1252
|
+
}, _n = (t) => {
|
|
1253
|
+
const s = t.indexOf($e);
|
|
1254
|
+
if (s === -1)
|
|
1255
|
+
return t;
|
|
1256
|
+
const n = s + $e.length;
|
|
1257
|
+
return /* @__PURE__ */ i(se, { children: [
|
|
1258
|
+
t.slice(0, s),
|
|
1259
|
+
/* @__PURE__ */ e(
|
|
1260
|
+
"a",
|
|
1261
|
+
{
|
|
1262
|
+
href: Nn,
|
|
1263
|
+
target: "_blank",
|
|
1264
|
+
rel: "noopener noreferrer",
|
|
1265
|
+
className: "mes-age-safety-system-message__emphasis font-medium text-inherit underline",
|
|
1266
|
+
children: $e
|
|
1267
|
+
}
|
|
1268
|
+
),
|
|
1269
|
+
t.slice(n)
|
|
1270
|
+
] });
|
|
1271
|
+
}, En = (t) => {
|
|
1272
|
+
var o, l;
|
|
1273
|
+
const s = t.message.hide_date === !0, n = Cn(
|
|
1274
|
+
t.message
|
|
1275
|
+
);
|
|
1276
|
+
if ((n == null ? void 0 : n.kind) === "dm-agent") {
|
|
1277
|
+
const d = ((o = t.message.text) == null ? void 0 : o.trim()) || xn[n.type];
|
|
1278
|
+
return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
1279
|
+
/* @__PURE__ */ i(
|
|
1280
|
+
"div",
|
|
1281
|
+
{
|
|
1282
|
+
className: "mes-dm-agent-system-message mx-auto mb-2 inline-flex w-fit max-w-[min(100%,480px)] items-center justify-center gap-[10px] rounded-[12px] border border-[rgba(0,0,0,0.08)] p-3 text-[rgba(0,0,0,0.55)]",
|
|
1283
|
+
"data-testid": "dm-agent-system-message",
|
|
1284
|
+
"data-dm-agent-system-type": n.type,
|
|
1285
|
+
children: [
|
|
1286
|
+
/* @__PURE__ */ e(
|
|
1287
|
+
bs,
|
|
1288
|
+
{
|
|
1289
|
+
size: 16,
|
|
1290
|
+
weight: "regular",
|
|
1291
|
+
"aria-hidden": !0,
|
|
1292
|
+
className: "mes-dm-agent-system-message__sparkle shrink-0"
|
|
1293
|
+
}
|
|
1294
|
+
),
|
|
1295
|
+
/* @__PURE__ */ e("p", { className: "mes-dm-agent-system-message__text m-0 text-center text-[14px] font-normal leading-5 tracking-[0.21px]", children: d })
|
|
1296
|
+
]
|
|
1297
|
+
}
|
|
1298
|
+
),
|
|
1299
|
+
!s && /* @__PURE__ */ e(Ue, { message: t.message })
|
|
1300
|
+
] });
|
|
1301
|
+
}
|
|
1302
|
+
if ((n == null ? void 0 : n.kind) === "age-safety") {
|
|
1303
|
+
const d = ((l = t.message.text) == null ? void 0 : l.trim()) || wn[n.type];
|
|
1304
|
+
return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
1305
|
+
/* @__PURE__ */ i(
|
|
1306
|
+
"div",
|
|
1307
|
+
{
|
|
1308
|
+
className: "mes-age-safety-system-message box-border mx-auto mb-2 flex w-full max-w-[329px] items-start justify-center gap-3 rounded-[12px] border border-[var(--border-secondary,rgba(0,0,0,0.08))] bg-[var(--bg-warning-subtle,#fef3c6)] px-2 py-4 pl-5 text-[color:var(--text-warning-on-warning,#894b00)]",
|
|
1309
|
+
"data-testid": "age-safety-system-message",
|
|
1310
|
+
"data-age-safety-system-type": n.type,
|
|
1311
|
+
children: [
|
|
1312
|
+
/* @__PURE__ */ e(
|
|
1313
|
+
ps,
|
|
1314
|
+
{
|
|
1315
|
+
size: 24,
|
|
1316
|
+
weight: "duotone",
|
|
1317
|
+
"aria-hidden": !0,
|
|
1318
|
+
className: "mes-age-safety-system-message__icon shrink-0 text-[color:var(--text-warning-on-warning,#894b00)]",
|
|
1319
|
+
"data-testid": "age-safety-system-message-icon"
|
|
1320
|
+
}
|
|
1321
|
+
),
|
|
1322
|
+
/* @__PURE__ */ e("div", { className: "mes-age-safety-system-message__content min-w-0 flex-[1_0_0]", children: /* @__PURE__ */ e("p", { className: "m-0 text-balance text-left text-[12px] font-normal leading-4 tracking-[0.21px] text-[color:var(--text-warning-on-warning,#894b00)]", children: _n(d) }) })
|
|
1323
|
+
]
|
|
1324
|
+
}
|
|
1325
|
+
),
|
|
1326
|
+
!s && /* @__PURE__ */ e(Ue, { message: t.message })
|
|
1327
|
+
] });
|
|
1328
|
+
}
|
|
1329
|
+
return /* @__PURE__ */ i("div", { className: "str-chat__message--system", "data-testid": "message-system", children: [
|
|
1330
|
+
/* @__PURE__ */ i("div", { className: "str-chat__message--system__text", children: [
|
|
1331
|
+
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" }),
|
|
1332
|
+
/* @__PURE__ */ e("p", { children: t.message.text }),
|
|
1333
|
+
/* @__PURE__ */ e("div", { className: "str-chat__message--system__line" })
|
|
1334
|
+
] }),
|
|
1335
|
+
!s && /* @__PURE__ */ e(Ue, { message: t.message })
|
|
1336
|
+
] });
|
|
1337
|
+
}, Sn = () => null, kn = ({ className: t, message: s }) => /* @__PURE__ */ i(
|
|
1338
|
+
"div",
|
|
1339
|
+
{
|
|
1340
|
+
className: O("flex items-center justify-center h-full", t),
|
|
1341
|
+
children: [
|
|
1342
|
+
/* @__PURE__ */ i("svg", { viewBox: "0 0 100 100", className: "size-8 fill-pebble", stroke: "none", children: [
|
|
1343
|
+
/* @__PURE__ */ e("circle", { cx: "6", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
1344
|
+
"animateTransform",
|
|
1345
|
+
{
|
|
1346
|
+
attributeName: "transform",
|
|
1347
|
+
dur: "1s",
|
|
1348
|
+
type: "translate",
|
|
1349
|
+
values: "0 15 ; 0 -15; 0 15",
|
|
1350
|
+
repeatCount: "indefinite",
|
|
1351
|
+
begin: "0.1"
|
|
1352
|
+
}
|
|
1353
|
+
) }),
|
|
1354
|
+
/* @__PURE__ */ e("circle", { cx: "30", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
1355
|
+
"animateTransform",
|
|
1356
|
+
{
|
|
1357
|
+
attributeName: "transform",
|
|
1358
|
+
dur: "1s",
|
|
1359
|
+
type: "translate",
|
|
1360
|
+
values: "0 10 ; 0 -10; 0 10",
|
|
1361
|
+
repeatCount: "indefinite",
|
|
1362
|
+
begin: "0.2"
|
|
1363
|
+
}
|
|
1364
|
+
) }),
|
|
1365
|
+
/* @__PURE__ */ e("circle", { cx: "54", cy: "50", r: "6", children: /* @__PURE__ */ e(
|
|
1366
|
+
"animateTransform",
|
|
1367
|
+
{
|
|
1368
|
+
attributeName: "transform",
|
|
1369
|
+
dur: "1s",
|
|
1370
|
+
type: "translate",
|
|
1371
|
+
values: "0 5 ; 0 -5; 0 5",
|
|
1372
|
+
repeatCount: "indefinite",
|
|
1373
|
+
begin: "0.3"
|
|
1374
|
+
}
|
|
1375
|
+
) })
|
|
1376
|
+
] }),
|
|
1377
|
+
s && /* @__PURE__ */ e("span", { className: "text-stone", children: s })
|
|
1378
|
+
]
|
|
1379
|
+
}
|
|
1380
|
+
), De = z.memo(() => /* @__PURE__ */ e("div", { className: "messaging-loading-state flex items-center justify-center h-full", children: /* @__PURE__ */ i("div", { className: "flex items-center", children: [
|
|
1381
|
+
/* @__PURE__ */ e(kn, { className: "w-6 h-6" }),
|
|
1382
|
+
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading messages" })
|
|
1383
|
+
] }) }));
|
|
1384
|
+
De.displayName = "LoadingState";
|
|
1385
|
+
const he = "size-10 rounded-full bg-[#F1F0EE] hover:bg-[#E5E4E1] flex items-center justify-center transition-colors duration-150 focus-ring", In = ({
|
|
1386
|
+
onBack: t,
|
|
1387
|
+
showBackButton: s,
|
|
1388
|
+
onShowInfo: n,
|
|
1389
|
+
canShowInfo: o,
|
|
1390
|
+
showStarButton: l = !1
|
|
1391
|
+
}) => {
|
|
1392
|
+
var h, N, a, _, w;
|
|
1393
|
+
const { channel: d } = fe(), r = z.useMemo(() => Object.values(d.state.members || {}).find(
|
|
1394
|
+
(E) => {
|
|
1395
|
+
var S;
|
|
1396
|
+
return ((S = E.user) == null ? void 0 : S.id) && E.user.id !== d._client.userID;
|
|
1397
|
+
}
|
|
1398
|
+
), [d._client.userID, d.state.members]), c = ((h = r == null ? void 0 : r.user) == null ? void 0 : h.name) || ((N = r == null ? void 0 : r.user) == null ? void 0 : N.id) || "Unknown member", x = (a = r == null ? void 0 : r.user) == null ? void 0 : a.image, u = bt(d), g = async () => {
|
|
1399
|
+
try {
|
|
1400
|
+
u ? await d.unpin() : await d.pin();
|
|
1401
|
+
} catch (p) {
|
|
1402
|
+
console.error(
|
|
1403
|
+
"[CustomChannelHeader] Failed to update pinned status:",
|
|
1404
|
+
p
|
|
1405
|
+
);
|
|
1406
|
+
}
|
|
1407
|
+
};
|
|
1408
|
+
return /* @__PURE__ */ i("div", { className: "@container", children: [
|
|
1409
|
+
/* @__PURE__ */ i("div", { className: "grid grid-cols-[1fr_auto_1fr] w-full items-center @lg:hidden", children: [
|
|
1410
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: s && /* @__PURE__ */ e(
|
|
1411
|
+
"button",
|
|
1412
|
+
{
|
|
1413
|
+
className: he,
|
|
1414
|
+
onClick: t || (() => {
|
|
1415
|
+
}),
|
|
1416
|
+
type: "button",
|
|
1417
|
+
"aria-label": "Back to conversations",
|
|
1418
|
+
children: /* @__PURE__ */ e(Ke, { className: "size-5 text-black/90" })
|
|
1419
|
+
}
|
|
1420
|
+
) }),
|
|
1421
|
+
/* @__PURE__ */ i("div", { className: "flex flex-col gap-1 items-center", children: [
|
|
1422
|
+
/* @__PURE__ */ e(
|
|
1423
|
+
oe,
|
|
1424
|
+
{
|
|
1425
|
+
id: ((_ = r == null ? void 0 : r.user) == null ? void 0 : _.id) || d.id || "unknown",
|
|
1426
|
+
name: c,
|
|
1427
|
+
image: x,
|
|
1428
|
+
starred: l && u,
|
|
1429
|
+
size: 40
|
|
1430
|
+
}
|
|
1431
|
+
),
|
|
1432
|
+
/* @__PURE__ */ i(
|
|
1433
|
+
"button",
|
|
1434
|
+
{
|
|
1435
|
+
type: "button",
|
|
1436
|
+
onClick: n,
|
|
1437
|
+
className: "flex items-center gap-0.5 rounded-full bg-black/[0.05] px-3 py-1 text-xs font-medium text-black/90 hover:bg-black/[0.08] transition-colors",
|
|
1438
|
+
"aria-label": `View info for ${c}`,
|
|
1439
|
+
children: [
|
|
1440
|
+
c,
|
|
1441
|
+
/* @__PURE__ */ e(Je, { className: "size-3 shrink-0" })
|
|
1442
|
+
]
|
|
1443
|
+
}
|
|
1444
|
+
)
|
|
1445
|
+
] }),
|
|
1446
|
+
/* @__PURE__ */ i("div", { className: "flex justify-end items-center gap-2", children: [
|
|
1447
|
+
l && /* @__PURE__ */ e(
|
|
1448
|
+
"button",
|
|
1449
|
+
{
|
|
1450
|
+
className: he,
|
|
1451
|
+
onClick: g,
|
|
1452
|
+
type: "button",
|
|
1453
|
+
"aria-label": u ? "Unstar conversation" : "Star conversation",
|
|
1454
|
+
children: /* @__PURE__ */ e(
|
|
1455
|
+
Be,
|
|
1456
|
+
{
|
|
1457
|
+
className: O("size-5", {
|
|
1458
|
+
"text-yellow-600": u,
|
|
1459
|
+
"text-black/90": !u
|
|
1460
|
+
}),
|
|
1461
|
+
weight: u ? "duotone" : "regular"
|
|
1462
|
+
}
|
|
1463
|
+
)
|
|
1464
|
+
}
|
|
1465
|
+
),
|
|
1466
|
+
/* @__PURE__ */ e(
|
|
1467
|
+
"button",
|
|
1468
|
+
{
|
|
1469
|
+
className: he,
|
|
1470
|
+
onClick: n,
|
|
1471
|
+
type: "button",
|
|
1472
|
+
"aria-label": "Show info",
|
|
1473
|
+
children: /* @__PURE__ */ e(Qe, { className: "size-5 text-black/90" })
|
|
1474
|
+
}
|
|
1475
|
+
)
|
|
1476
|
+
] })
|
|
1477
|
+
] }),
|
|
1478
|
+
/* @__PURE__ */ i("div", { className: "hidden @lg:flex items-center justify-between gap-3 min-h-12", children: [
|
|
1479
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-4 min-w-0", children: [
|
|
1480
|
+
s && t && /* @__PURE__ */ e(
|
|
1481
|
+
"button",
|
|
1482
|
+
{
|
|
1483
|
+
type: "button",
|
|
1484
|
+
onClick: t,
|
|
1485
|
+
className: he,
|
|
1486
|
+
"aria-label": "Back to conversations",
|
|
1487
|
+
children: /* @__PURE__ */ e(Ke, { className: "size-5 text-black/90" })
|
|
1488
|
+
}
|
|
1489
|
+
),
|
|
1490
|
+
/* @__PURE__ */ e(
|
|
1491
|
+
oe,
|
|
1492
|
+
{
|
|
1493
|
+
id: ((w = r == null ? void 0 : r.user) == null ? void 0 : w.id) || d.id || "unknown",
|
|
1494
|
+
name: c,
|
|
1495
|
+
image: x,
|
|
1496
|
+
starred: l && u,
|
|
1497
|
+
size: 40
|
|
1498
|
+
}
|
|
1499
|
+
),
|
|
1500
|
+
/* @__PURE__ */ e("div", { className: "min-w-0", children: o ? /* @__PURE__ */ i(
|
|
1501
|
+
"button",
|
|
1502
|
+
{
|
|
1503
|
+
type: "button",
|
|
1504
|
+
onClick: n,
|
|
1505
|
+
className: "flex items-center gap-1 font-medium text-black/90 truncate hover:text-black/70 transition-colors",
|
|
1506
|
+
"aria-label": `View info for ${c}`,
|
|
1507
|
+
children: [
|
|
1508
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: c }),
|
|
1509
|
+
/* @__PURE__ */ e(Je, { className: "size-4 shrink-0" })
|
|
1510
|
+
]
|
|
1511
|
+
}
|
|
1512
|
+
) : /* @__PURE__ */ e("h1", { className: "font-medium text-black/90 truncate", children: c }) })
|
|
1513
|
+
] }),
|
|
1514
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-2", children: [
|
|
1515
|
+
l && /* @__PURE__ */ e(
|
|
1516
|
+
"button",
|
|
1517
|
+
{
|
|
1518
|
+
className: he,
|
|
1519
|
+
onClick: g,
|
|
1520
|
+
type: "button",
|
|
1521
|
+
"aria-label": u ? "Unstar conversation" : "Star conversation",
|
|
1522
|
+
children: /* @__PURE__ */ e(
|
|
1523
|
+
Be,
|
|
1524
|
+
{
|
|
1525
|
+
className: O("size-5", {
|
|
1526
|
+
"text-yellow-600": u,
|
|
1527
|
+
"text-black/90": !u
|
|
1528
|
+
}),
|
|
1529
|
+
weight: u ? "duotone" : "regular"
|
|
1530
|
+
}
|
|
1531
|
+
)
|
|
1532
|
+
}
|
|
1533
|
+
),
|
|
1534
|
+
o && n && /* @__PURE__ */ e(
|
|
1535
|
+
"button",
|
|
1536
|
+
{
|
|
1537
|
+
className: he,
|
|
1538
|
+
onClick: n,
|
|
1539
|
+
type: "button",
|
|
1540
|
+
"aria-label": "Show info",
|
|
1541
|
+
children: /* @__PURE__ */ e(Qe, { className: "size-5 text-black/90" })
|
|
1542
|
+
}
|
|
1543
|
+
)
|
|
1544
|
+
] })
|
|
1545
|
+
] })
|
|
1546
|
+
] });
|
|
1547
|
+
}, Tn = ({
|
|
1548
|
+
onBack: t,
|
|
1549
|
+
showBackButton: s,
|
|
1550
|
+
renderMessageInputActions: n,
|
|
1551
|
+
renderConversationFooter: o,
|
|
1552
|
+
onLeaveConversation: l,
|
|
1553
|
+
onBlockParticipant: d,
|
|
1554
|
+
showDeleteConversation: r = !0,
|
|
1555
|
+
onDeleteConversationClick: c,
|
|
1556
|
+
onBlockParticipantClick: x,
|
|
1557
|
+
onReportParticipantClick: u,
|
|
1558
|
+
showStarButton: g = !1,
|
|
1559
|
+
chatbotVotingEnabled: h = !1,
|
|
1560
|
+
renderChannelBanner: N,
|
|
1561
|
+
customProfileContent: a,
|
|
1562
|
+
customChannelActions: _,
|
|
1563
|
+
renderMessage: w
|
|
1564
|
+
}) => {
|
|
1565
|
+
const { channel: p } = fe(), E = X(null), S = z.useMemo(() => Object.values(p.state.members || {}).find(
|
|
1566
|
+
(f) => {
|
|
1567
|
+
var T;
|
|
1568
|
+
return ((T = f.user) == null ? void 0 : T.id) && f.user.id !== p._client.userID;
|
|
1569
|
+
}
|
|
1570
|
+
), [p._client.userID, p.state.members]), C = z.useMemo(() => {
|
|
1571
|
+
const m = p.data ?? {};
|
|
1572
|
+
if (m.followerStatus)
|
|
1573
|
+
return String(m.followerStatus);
|
|
1574
|
+
if (m.isFollower !== void 0)
|
|
1575
|
+
return m.isFollower ? "Subscribed to you" : "Not subscribed";
|
|
1576
|
+
}, [p.data]), k = A(() => {
|
|
1577
|
+
var m;
|
|
1578
|
+
(m = E.current) == null || m.showModal();
|
|
1579
|
+
}, []), P = A(() => {
|
|
1580
|
+
var m;
|
|
1581
|
+
(m = E.current) == null || m.close();
|
|
1582
|
+
}, []), v = A(
|
|
1583
|
+
(m) => {
|
|
1584
|
+
const { message: f } = ut("ChannelView"), T = /* @__PURE__ */ e(
|
|
1585
|
+
dn,
|
|
1586
|
+
{
|
|
1587
|
+
...m,
|
|
1588
|
+
chatbotVotingEnabled: h
|
|
1589
|
+
}
|
|
1590
|
+
);
|
|
1591
|
+
return !w || !f ? T : w(T, f);
|
|
1592
|
+
},
|
|
1593
|
+
[h, w]
|
|
1594
|
+
);
|
|
1595
|
+
return /* @__PURE__ */ i(se, { children: [
|
|
1596
|
+
/* @__PURE__ */ e(cs, { overrides: { Message: v }, children: /* @__PURE__ */ i(ds, { children: [
|
|
1597
|
+
/* @__PURE__ */ e("div", { className: "p-4", children: /* @__PURE__ */ e(
|
|
1598
|
+
In,
|
|
1599
|
+
{
|
|
1600
|
+
onBack: t,
|
|
1601
|
+
showBackButton: s,
|
|
1602
|
+
onShowInfo: k,
|
|
1603
|
+
canShowInfo: !!S,
|
|
1604
|
+
showStarButton: g
|
|
1605
|
+
}
|
|
1606
|
+
) }),
|
|
1607
|
+
N == null ? void 0 : N(),
|
|
1608
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e(
|
|
1609
|
+
us,
|
|
1610
|
+
{
|
|
1611
|
+
hideDeletedMessages: !0,
|
|
1612
|
+
hideNewMessageSeparator: !1,
|
|
1613
|
+
messageActions: void 0
|
|
1614
|
+
}
|
|
1615
|
+
) }),
|
|
1616
|
+
o == null ? void 0 : o(p),
|
|
1617
|
+
/* @__PURE__ */ e(
|
|
1618
|
+
bn,
|
|
1619
|
+
{
|
|
1620
|
+
renderActions: () => n == null ? void 0 : n(p)
|
|
1621
|
+
}
|
|
1622
|
+
)
|
|
1623
|
+
] }) }),
|
|
1624
|
+
/* @__PURE__ */ e(
|
|
1625
|
+
Ws,
|
|
1626
|
+
{
|
|
1627
|
+
dialogRef: E,
|
|
1628
|
+
onClose: P,
|
|
1629
|
+
participant: S,
|
|
1630
|
+
channel: p,
|
|
1631
|
+
followerStatusLabel: C,
|
|
1632
|
+
onLeaveConversation: l,
|
|
1633
|
+
onBlockParticipant: d,
|
|
1634
|
+
showDeleteConversation: r,
|
|
1635
|
+
onDeleteConversationClick: c,
|
|
1636
|
+
onBlockParticipantClick: x,
|
|
1637
|
+
onReportParticipantClick: u,
|
|
1638
|
+
customProfileContent: a,
|
|
1639
|
+
customChannelActions: _
|
|
1640
|
+
}
|
|
1641
|
+
)
|
|
1642
|
+
] });
|
|
1643
|
+
}, _t = z.memo(
|
|
1644
|
+
({
|
|
1645
|
+
channel: t,
|
|
1646
|
+
onBack: s,
|
|
1647
|
+
showBackButton: n = !1,
|
|
1648
|
+
renderMessageInputActions: o,
|
|
1649
|
+
renderConversationFooter: l,
|
|
1650
|
+
onLeaveConversation: d,
|
|
1651
|
+
onBlockParticipant: r,
|
|
1652
|
+
className: c,
|
|
1653
|
+
CustomChannelEmptyState: x = Sn,
|
|
1654
|
+
showDeleteConversation: u = !0,
|
|
1655
|
+
onDeleteConversationClick: g,
|
|
1656
|
+
onBlockParticipantClick: h,
|
|
1657
|
+
onReportParticipantClick: N,
|
|
1658
|
+
dmAgentEnabled: a,
|
|
1659
|
+
messageMetadata: _,
|
|
1660
|
+
onMessageSent: w,
|
|
1661
|
+
showStarButton: p = !1,
|
|
1662
|
+
chatbotVotingEnabled: E = !1,
|
|
1663
|
+
renderChannelBanner: S,
|
|
1664
|
+
customProfileContent: C,
|
|
1665
|
+
customChannelActions: k,
|
|
1666
|
+
renderMessage: P,
|
|
1667
|
+
sendButton: v
|
|
1668
|
+
}) => {
|
|
1669
|
+
const m = A(
|
|
1670
|
+
async (f, T, M) => {
|
|
1671
|
+
var V;
|
|
1672
|
+
const L = ((V = t.data) == null ? void 0 : V.chatbot_paused) === !0, R = a && !L, B = {
|
|
1673
|
+
...T,
|
|
1674
|
+
...R && { silent: !0 },
|
|
1675
|
+
..._ && {
|
|
1676
|
+
metadata: {
|
|
1677
|
+
...T.metadata ?? {},
|
|
1678
|
+
..._
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
}, ee = {
|
|
1682
|
+
...M,
|
|
1683
|
+
...R && { skip_push: !0 }
|
|
1684
|
+
}, J = await t.sendMessage(B, ee);
|
|
1685
|
+
return w == null || w(J), J;
|
|
1686
|
+
},
|
|
1687
|
+
[t, a, _, w]
|
|
1688
|
+
);
|
|
1689
|
+
return /* @__PURE__ */ e(
|
|
1690
|
+
"div",
|
|
1691
|
+
{
|
|
1692
|
+
className: O(
|
|
1693
|
+
"messaging-channel-view h-full flex flex-col",
|
|
1694
|
+
c
|
|
1695
|
+
),
|
|
1696
|
+
children: /* @__PURE__ */ e(
|
|
1697
|
+
is,
|
|
1698
|
+
{
|
|
1699
|
+
channel: t,
|
|
1700
|
+
MessageSystem: En,
|
|
1701
|
+
EmptyStateIndicator: x,
|
|
1702
|
+
LoadingIndicator: De,
|
|
1703
|
+
DateSeparator: qs,
|
|
1704
|
+
doSendMessageRequest: m,
|
|
1705
|
+
...v ? { SendButton: v } : {},
|
|
1706
|
+
children: /* @__PURE__ */ e(
|
|
1707
|
+
Tn,
|
|
1708
|
+
{
|
|
1709
|
+
onBack: s,
|
|
1710
|
+
showBackButton: n,
|
|
1711
|
+
renderMessageInputActions: o,
|
|
1712
|
+
renderConversationFooter: l,
|
|
1713
|
+
onLeaveConversation: d,
|
|
1714
|
+
onBlockParticipant: r,
|
|
1715
|
+
CustomChannelEmptyState: x,
|
|
1716
|
+
showDeleteConversation: u,
|
|
1717
|
+
onDeleteConversationClick: g,
|
|
1718
|
+
onBlockParticipantClick: h,
|
|
1719
|
+
onReportParticipantClick: N,
|
|
1720
|
+
showStarButton: p,
|
|
1721
|
+
chatbotVotingEnabled: E,
|
|
1722
|
+
renderChannelBanner: S,
|
|
1723
|
+
customProfileContent: C,
|
|
1724
|
+
customChannelActions: k,
|
|
1725
|
+
renderMessage: P
|
|
1726
|
+
}
|
|
1727
|
+
)
|
|
1728
|
+
}
|
|
1729
|
+
)
|
|
1730
|
+
}
|
|
1731
|
+
);
|
|
1732
|
+
}
|
|
1733
|
+
);
|
|
1734
|
+
_t.displayName = "ChannelView";
|
|
1735
|
+
function Mn({
|
|
1736
|
+
searchQuery: t,
|
|
1737
|
+
setSearchQuery: s,
|
|
1738
|
+
placeholder: n
|
|
1739
|
+
}) {
|
|
1740
|
+
const o = X(null);
|
|
1741
|
+
return /* @__PURE__ */ i("div", { className: "relative", children: [
|
|
1742
|
+
/* @__PURE__ */ e(
|
|
1743
|
+
xs,
|
|
1744
|
+
{
|
|
1745
|
+
className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-stone",
|
|
1746
|
+
weight: "bold"
|
|
1747
|
+
}
|
|
1748
|
+
),
|
|
1749
|
+
/* @__PURE__ */ e(
|
|
1750
|
+
"input",
|
|
1751
|
+
{
|
|
1752
|
+
ref: o,
|
|
1753
|
+
type: "text",
|
|
1754
|
+
placeholder: n,
|
|
1755
|
+
value: t,
|
|
1756
|
+
onChange: (l) => s(l.target.value),
|
|
1757
|
+
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"
|
|
1758
|
+
}
|
|
1759
|
+
),
|
|
1760
|
+
t && /* @__PURE__ */ e(
|
|
1761
|
+
wt,
|
|
1762
|
+
{
|
|
1763
|
+
label: "Clear search",
|
|
1764
|
+
onClick: () => {
|
|
1765
|
+
var l;
|
|
1766
|
+
s(""), (l = o.current) == null || l.focus();
|
|
1767
|
+
},
|
|
1768
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 text-stone hover:text-charcoal",
|
|
1769
|
+
children: /* @__PURE__ */ e(Re, { className: "h-4 w-4", weight: "bold" })
|
|
1770
|
+
}
|
|
1771
|
+
)
|
|
1772
|
+
] });
|
|
1773
|
+
}
|
|
1774
|
+
const Dn = ({
|
|
1775
|
+
participantSource: t,
|
|
1776
|
+
onSelectParticipant: s,
|
|
1777
|
+
onClose: n,
|
|
1778
|
+
existingParticipantIds: o = /* @__PURE__ */ new Set(),
|
|
1779
|
+
participantLabel: l = "participants",
|
|
1780
|
+
searchPlaceholder: d = "Search participants...",
|
|
1781
|
+
className: r
|
|
1782
|
+
}) => {
|
|
1783
|
+
const { debug: c } = Le(), [x, u] = I(""), [g, h] = I([]), [N, a] = I(!1), [_, w] = I(null), [p, E] = I(
|
|
1784
|
+
null
|
|
1785
|
+
), S = X(!1);
|
|
1786
|
+
q(() => {
|
|
1787
|
+
S.current = !1;
|
|
1788
|
+
}, [t]), q(() => {
|
|
1789
|
+
if (t.loading) {
|
|
1790
|
+
c && console.log(
|
|
1791
|
+
"[ParticipantPicker] Waiting for participant source to finish loading..."
|
|
1792
|
+
);
|
|
1793
|
+
return;
|
|
1794
|
+
}
|
|
1795
|
+
if (S.current) return;
|
|
1796
|
+
(async () => {
|
|
1797
|
+
c && console.log("[ParticipantPicker] Loading initial participants..."), a(!0), w(null);
|
|
1798
|
+
try {
|
|
1799
|
+
const m = await t.loadParticipants({
|
|
1800
|
+
search: "",
|
|
1801
|
+
// Load all participants initially
|
|
1802
|
+
limit: 100
|
|
1803
|
+
});
|
|
1804
|
+
h(m.participants), S.current = !0, c && console.log(
|
|
1805
|
+
"[ParticipantPicker] Participants loaded successfully:",
|
|
1806
|
+
m.participants.length
|
|
1807
|
+
);
|
|
1808
|
+
} catch (m) {
|
|
1809
|
+
const f = m instanceof Error ? m.message : "Failed to load participants";
|
|
1810
|
+
w(f), console.error("[ParticipantPicker] Failed to load participants:", m);
|
|
1811
|
+
} finally {
|
|
1812
|
+
a(!1);
|
|
1813
|
+
}
|
|
1814
|
+
})();
|
|
1815
|
+
}, [t, c]);
|
|
1816
|
+
const C = g.filter((v) => !o.has(v.id)).filter((v) => {
|
|
1817
|
+
var f;
|
|
1818
|
+
if (!x) return !0;
|
|
1819
|
+
const m = x.toLowerCase();
|
|
1820
|
+
return v.name.toLowerCase().includes(m) || ((f = v.email) == null ? void 0 : f.toLowerCase().includes(m)) || !1;
|
|
1821
|
+
}), k = A(
|
|
1822
|
+
async (v) => {
|
|
1823
|
+
if (!p) {
|
|
1824
|
+
E(v.id);
|
|
1825
|
+
try {
|
|
1826
|
+
await s(v);
|
|
1827
|
+
} catch (m) {
|
|
1828
|
+
console.error("[ParticipantPicker] Failed to start chat:", m), E(null);
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
},
|
|
1832
|
+
[s, p]
|
|
1833
|
+
), P = (v, m) => {
|
|
1834
|
+
(v.key === "Enter" || v.key === " ") && (v.preventDefault(), k(m));
|
|
1835
|
+
};
|
|
1836
|
+
return /* @__PURE__ */ i("div", { className: O("flex flex-col h-full", r), children: [
|
|
1837
|
+
/* @__PURE__ */ i("div", { className: "px-4 py-4 border-b border-sand bg-chalk", children: [
|
|
1838
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-3", children: [
|
|
1839
|
+
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-charcoal", children: "Start a new Conversation" }),
|
|
1840
|
+
/* @__PURE__ */ e(Nt, { onClick: n })
|
|
1841
|
+
] }),
|
|
1842
|
+
/* @__PURE__ */ i("p", { className: "text-xs text-stone mb-3", children: [
|
|
1843
|
+
"Select a ",
|
|
1844
|
+
l.slice(0, -1),
|
|
1845
|
+
" to start messaging (",
|
|
1846
|
+
C.length,
|
|
1847
|
+
" available)",
|
|
1848
|
+
t.totalCount !== void 0 && ` โข ${t.totalCount} ${l} total`
|
|
1849
|
+
] }),
|
|
1850
|
+
/* @__PURE__ */ e(
|
|
1851
|
+
Mn,
|
|
1852
|
+
{
|
|
1853
|
+
searchQuery: x,
|
|
1854
|
+
setSearchQuery: u,
|
|
1855
|
+
placeholder: d
|
|
1856
|
+
}
|
|
1857
|
+
)
|
|
1858
|
+
] }),
|
|
1859
|
+
_ && /* @__PURE__ */ i("div", { className: "p-4 text-sm text-danger bg-danger-alt", children: [
|
|
1860
|
+
"Error loading ",
|
|
1861
|
+
l,
|
|
1862
|
+
": ",
|
|
1863
|
+
_
|
|
1864
|
+
] }),
|
|
1865
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: N && C.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: [
|
|
1866
|
+
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1867
|
+
/* @__PURE__ */ i("span", { className: "text-sm text-stone", children: [
|
|
1868
|
+
"Loading ",
|
|
1869
|
+
l,
|
|
1870
|
+
"..."
|
|
1871
|
+
] })
|
|
1872
|
+
] }) }) : C.length === 0 ? /* @__PURE__ */ i("div", { className: "p-6 text-center", children: [
|
|
1873
|
+
/* @__PURE__ */ e("div", { className: "mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-sand", children: /* @__PURE__ */ e(et, { className: "h-8 w-8 text-charcoal" }) }),
|
|
1874
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-charcoal mb-2", children: x ? `No ${l} found` : g.length > 0 ? `Already chatting with all ${l}` : `No ${l} yet` }),
|
|
1875
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-stone", children: x ? "Try a different search term" : g.length > 0 ? `You have existing conversations with all your ${l}` : `${l.charAt(0).toUpperCase() + l.slice(1)} will appear here` })
|
|
1876
|
+
] }) : /* @__PURE__ */ i("ul", { className: "space-y-0", children: [
|
|
1877
|
+
C.map((v) => {
|
|
1878
|
+
const m = v.name || v.email || v.id, f = v.email && v.name ? v.email : v.phone;
|
|
1879
|
+
return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
1880
|
+
"button",
|
|
1881
|
+
{
|
|
1882
|
+
type: "button",
|
|
1883
|
+
onClick: () => k(v),
|
|
1884
|
+
onKeyDown: (T) => P(T, v),
|
|
1885
|
+
className: "w-full px-4 py-3 hover:bg-sand transition-colors border-b border-sand text-left focus-ring",
|
|
1886
|
+
children: /* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
1887
|
+
/* @__PURE__ */ i("div", { className: "flex items-center space-x-3 flex-1 min-w-0", children: [
|
|
1888
|
+
/* @__PURE__ */ e(
|
|
1889
|
+
oe,
|
|
1890
|
+
{
|
|
1891
|
+
id: v.id,
|
|
1892
|
+
name: m,
|
|
1893
|
+
image: v.image,
|
|
1894
|
+
size: 40
|
|
1895
|
+
}
|
|
1896
|
+
),
|
|
1897
|
+
/* @__PURE__ */ i("div", { className: "flex-1 min-w-0", children: [
|
|
1898
|
+
/* @__PURE__ */ e("h4", { className: "text-sm font-medium text-charcoal truncate", children: m }),
|
|
1899
|
+
f && /* @__PURE__ */ e("p", { className: "text-xs text-stone truncate", children: f })
|
|
1900
|
+
] })
|
|
1901
|
+
] }),
|
|
1902
|
+
/* @__PURE__ */ e("div", { className: "flex-shrink-0", children: p === v.id ? /* @__PURE__ */ e(Ie, { className: "h-5 w-5 text-primary animate-spin" }) : /* @__PURE__ */ e(et, { className: "h-5 w-5 text-stone" }) })
|
|
1903
|
+
] })
|
|
1904
|
+
}
|
|
1905
|
+
) }, v.id);
|
|
1906
|
+
}),
|
|
1907
|
+
N && /* @__PURE__ */ e("li", { className: "p-4 flex justify-center", children: /* @__PURE__ */ i("div", { className: "flex items-center space-x-2", children: [
|
|
1908
|
+
/* @__PURE__ */ e("div", { className: "w-4 h-4 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1909
|
+
/* @__PURE__ */ e("span", { className: "text-sm text-stone", children: "Loading more..." })
|
|
1910
|
+
] }) })
|
|
1911
|
+
] }) })
|
|
1912
|
+
] });
|
|
1913
|
+
}, Rn = ({ className: t }) => /* @__PURE__ */ i(
|
|
1914
|
+
"svg",
|
|
1915
|
+
{
|
|
1916
|
+
width: "140",
|
|
1917
|
+
height: "120",
|
|
1918
|
+
viewBox: "44 -2 144 126",
|
|
1919
|
+
fill: "none",
|
|
1920
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1921
|
+
className: t,
|
|
1922
|
+
children: [
|
|
1923
|
+
/* @__PURE__ */ i("g", { clipPath: "url(#clip0_empty_state)", children: [
|
|
1924
|
+
/* @__PURE__ */ e(
|
|
1925
|
+
"path",
|
|
1926
|
+
{
|
|
1927
|
+
d: "M123.68 82.1932C123.383 103.675 105.839 121 84.2417 121C77.4724 121 71.0986 119.297 65.5327 116.299L52.5873 119.687L53.8036 106.673C48.1776 99.8701 44.7994 91.1453 44.7994 81.6356C44.7994 59.8965 62.4554 42.2754 84.2374 42.2754C89.1328 42.2754 93.8175 43.1633 98.1413 44.789",
|
|
1928
|
+
fill: "#D7D4CE"
|
|
1929
|
+
}
|
|
1930
|
+
),
|
|
1931
|
+
/* @__PURE__ */ e(
|
|
1932
|
+
"path",
|
|
1933
|
+
{
|
|
1934
|
+
d: "M84.2458 86.0364C82.2851 86.0364 80.6957 84.4501 80.6957 82.4933C80.6957 80.5365 82.2851 78.9502 84.2458 78.9502C86.2065 78.9502 87.7959 80.5365 87.7959 82.4933C87.7959 84.4501 86.2065 86.0364 84.2458 86.0364Z",
|
|
1935
|
+
fill: "white"
|
|
1936
|
+
}
|
|
1937
|
+
),
|
|
1938
|
+
/* @__PURE__ */ e(
|
|
1939
|
+
"path",
|
|
1940
|
+
{
|
|
1941
|
+
d: "M68.3044 86.0364C66.3437 86.0364 64.7543 84.4501 64.7543 82.4933C64.7543 80.5365 66.3437 78.9502 68.3044 78.9502C70.2651 78.9502 71.8545 80.5365 71.8545 82.4933C71.8545 84.4501 70.2651 86.0364 68.3044 86.0364Z",
|
|
1942
|
+
fill: "white"
|
|
1943
|
+
}
|
|
1944
|
+
),
|
|
1945
|
+
/* @__PURE__ */ e(
|
|
1946
|
+
"path",
|
|
1947
|
+
{
|
|
1948
|
+
d: "M100.183 86.0364C98.2226 86.0364 96.6332 84.4501 96.6332 82.4933C96.6332 80.5365 98.2226 78.9502 100.183 78.9502C102.144 78.9502 103.733 80.5365 103.733 82.4933C103.733 84.4501 102.144 86.0364 100.183 86.0364Z",
|
|
1949
|
+
fill: "white"
|
|
1950
|
+
}
|
|
1951
|
+
),
|
|
1952
|
+
/* @__PURE__ */ i("g", { filter: "url(#filter0_empty_state)", children: [
|
|
1953
|
+
/* @__PURE__ */ e(
|
|
1954
|
+
"path",
|
|
1955
|
+
{
|
|
1956
|
+
d: "M171.522 68.7154C177.443 61.4539 181 52.1488 181 42C181 18.8027 162.421 0 139.5 0C116.579 0 98 18.8027 98 42C98 65.1973 116.579 84 139.5 84C146.622 84 153.328 82.1857 159.184 78.9829L172.801 82.5993L171.522 68.7154Z",
|
|
1957
|
+
fill: "white"
|
|
1958
|
+
}
|
|
1959
|
+
),
|
|
1960
|
+
/* @__PURE__ */ e(
|
|
1961
|
+
"path",
|
|
1962
|
+
{
|
|
1963
|
+
d: "M171.522 68.7154C177.443 61.4539 181 52.1488 181 42C181 18.8027 162.421 0 139.5 0C116.579 0 98 18.8027 98 42C98 65.1973 116.579 84 139.5 84C146.622 84 153.328 82.1857 159.184 78.9829L172.801 82.5993L171.522 68.7154Z",
|
|
1964
|
+
stroke: "#D7D4CE",
|
|
1965
|
+
strokeWidth: "2",
|
|
1966
|
+
strokeMiterlimit: "10"
|
|
1967
|
+
}
|
|
1968
|
+
)
|
|
1969
|
+
] }),
|
|
1970
|
+
/* @__PURE__ */ e(
|
|
1971
|
+
"path",
|
|
1972
|
+
{
|
|
1973
|
+
d: "M139.502 45.5431C137.541 45.5431 135.952 43.9568 135.952 42C135.952 40.0432 137.541 38.4569 139.502 38.4569C141.462 38.4569 143.052 40.0432 143.052 42C143.052 43.9568 141.462 45.5431 139.502 45.5431Z",
|
|
1974
|
+
fill: "#D7D4CE"
|
|
1975
|
+
}
|
|
1976
|
+
),
|
|
1977
|
+
/* @__PURE__ */ e(
|
|
1978
|
+
"path",
|
|
1979
|
+
{
|
|
1980
|
+
d: "M123.561 45.5431C121.601 45.5431 120.011 43.9568 120.011 42C120.011 40.0432 121.601 38.4569 123.561 38.4569C125.522 38.4569 127.111 40.0432 127.111 42C127.111 43.9568 125.522 45.5431 123.561 45.5431Z",
|
|
1981
|
+
fill: "#D7D4CE"
|
|
1982
|
+
}
|
|
1983
|
+
),
|
|
1984
|
+
/* @__PURE__ */ e(
|
|
1985
|
+
"path",
|
|
1986
|
+
{
|
|
1987
|
+
d: "M155.439 45.5431C153.478 45.5431 151.889 43.9568 151.889 42C151.889 40.0432 153.478 38.4569 155.439 38.4569C157.4 38.4569 158.989 40.0432 158.989 42C158.989 43.9568 157.4 45.5431 155.439 45.5431Z",
|
|
1988
|
+
fill: "#D7D4CE"
|
|
1989
|
+
}
|
|
1990
|
+
)
|
|
1991
|
+
] }),
|
|
1992
|
+
/* @__PURE__ */ i("defs", { children: [
|
|
1993
|
+
/* @__PURE__ */ i(
|
|
1994
|
+
"filter",
|
|
1995
|
+
{
|
|
1996
|
+
id: "filter0_empty_state",
|
|
1997
|
+
x: "97",
|
|
1998
|
+
y: "-1",
|
|
1999
|
+
width: "89",
|
|
2000
|
+
height: "90",
|
|
2001
|
+
filterUnits: "userSpaceOnUse",
|
|
2002
|
+
colorInterpolationFilters: "sRGB",
|
|
2003
|
+
children: [
|
|
2004
|
+
/* @__PURE__ */ e("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
|
|
2005
|
+
/* @__PURE__ */ e(
|
|
2006
|
+
"feColorMatrix",
|
|
2007
|
+
{
|
|
2008
|
+
in: "SourceAlpha",
|
|
2009
|
+
type: "matrix",
|
|
2010
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
|
|
2011
|
+
result: "hardAlpha"
|
|
2012
|
+
}
|
|
2013
|
+
),
|
|
2014
|
+
/* @__PURE__ */ e("feOffset", { dx: "4", dy: "4" }),
|
|
2015
|
+
/* @__PURE__ */ e("feComposite", { in2: "hardAlpha", operator: "out" }),
|
|
2016
|
+
/* @__PURE__ */ e(
|
|
2017
|
+
"feColorMatrix",
|
|
2018
|
+
{
|
|
2019
|
+
type: "matrix",
|
|
2020
|
+
values: "0 0 0 0 0.8428 0 0 0 0 0.830064 0 0 0 0 0.8095 0 0 0 1 0"
|
|
2021
|
+
}
|
|
2022
|
+
),
|
|
2023
|
+
/* @__PURE__ */ e(
|
|
2024
|
+
"feBlend",
|
|
2025
|
+
{
|
|
2026
|
+
mode: "normal",
|
|
2027
|
+
in2: "BackgroundImageFix",
|
|
2028
|
+
result: "effect1_dropShadow"
|
|
2029
|
+
}
|
|
2030
|
+
),
|
|
2031
|
+
/* @__PURE__ */ e(
|
|
2032
|
+
"feBlend",
|
|
2033
|
+
{
|
|
2034
|
+
mode: "normal",
|
|
2035
|
+
in: "SourceGraphic",
|
|
2036
|
+
in2: "effect1_dropShadow",
|
|
2037
|
+
result: "shape"
|
|
2038
|
+
}
|
|
2039
|
+
)
|
|
2040
|
+
]
|
|
2041
|
+
}
|
|
2042
|
+
),
|
|
2043
|
+
/* @__PURE__ */ e("clipPath", { id: "clip0_empty_state", children: /* @__PURE__ */ e("rect", { width: "233", height: "233", fill: "white" }) })
|
|
2044
|
+
] })
|
|
2045
|
+
]
|
|
2046
|
+
}
|
|
2047
|
+
), Et = z.memo(
|
|
2048
|
+
({ 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: [
|
|
2049
|
+
/* @__PURE__ */ e(Rn, {}),
|
|
2050
|
+
s && !t && /* @__PURE__ */ i("div", { className: "mt-8", children: [
|
|
2051
|
+
/* @__PURE__ */ e("h2", { className: "font-medium text-black text-[18px] mb-2", children: "Your inbox is empty" }),
|
|
2052
|
+
/* @__PURE__ */ e("p", { className: "text-[#676B5F] text-sm mb-6", children: "Share with your followers to start receiving messages" })
|
|
2053
|
+
] })
|
|
2054
|
+
] }) })
|
|
2055
|
+
);
|
|
2056
|
+
Et.displayName = "EmptyState";
|
|
2057
|
+
const Te = z.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: [
|
|
2058
|
+
/* @__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: "โ ๏ธ" }) }),
|
|
2059
|
+
/* @__PURE__ */ e("h2", { className: "font-semibold text-charcoal mb-2", children: "Oops!" }),
|
|
2060
|
+
/* @__PURE__ */ e("p", { className: "text-stone text-sm mb-6", children: t }),
|
|
2061
|
+
s && /* @__PURE__ */ e(
|
|
2062
|
+
"button",
|
|
2063
|
+
{
|
|
2064
|
+
type: "button",
|
|
2065
|
+
onClick: s,
|
|
2066
|
+
className: "inline-flex items-center gap-2 px-4 py-2 text-sm font-medium text-white bg-[#7f22fe] hover:bg-primary-alt rounded-lg transition-colors focus-ring",
|
|
2067
|
+
children: "Go Back"
|
|
2068
|
+
}
|
|
2069
|
+
)
|
|
2070
|
+
] }) }));
|
|
2071
|
+
Te.displayName = "ErrorState";
|
|
2072
|
+
const aa = ({
|
|
2073
|
+
capabilities: t = {},
|
|
2074
|
+
className: s,
|
|
2075
|
+
renderMessageInputActions: n,
|
|
2076
|
+
renderConversationFooter: o,
|
|
2077
|
+
onChannelSelect: l,
|
|
2078
|
+
onParticipantSelect: d,
|
|
2079
|
+
initialParticipantFilter: r,
|
|
2080
|
+
initialParticipantData: c,
|
|
2081
|
+
CustomChannelEmptyState: x,
|
|
2082
|
+
showChannelList: u = !0,
|
|
2083
|
+
filters: g,
|
|
2084
|
+
channelRenderFilterFn: h,
|
|
2085
|
+
channelListCustomEmptyStateIndicator: N,
|
|
2086
|
+
onDeleteConversationClick: a,
|
|
2087
|
+
onBlockParticipantClick: _,
|
|
2088
|
+
onReportParticipantClick: w,
|
|
2089
|
+
dmAgentEnabled: p,
|
|
2090
|
+
messageMetadata: E,
|
|
2091
|
+
onMessageSent: S,
|
|
2092
|
+
showStarButton: C = !1,
|
|
2093
|
+
chatbotVotingEnabled: k = !1,
|
|
2094
|
+
renderMessagePreview: P,
|
|
2095
|
+
renderChannelBanner: v,
|
|
2096
|
+
customProfileContent: m,
|
|
2097
|
+
customChannelActions: f,
|
|
2098
|
+
renderMessage: T,
|
|
2099
|
+
sendButton: M
|
|
2100
|
+
}) => {
|
|
2101
|
+
const {
|
|
2102
|
+
service: L,
|
|
2103
|
+
client: R,
|
|
2104
|
+
isConnected: B,
|
|
2105
|
+
isLoading: ee,
|
|
2106
|
+
error: J,
|
|
2107
|
+
refreshConnection: V,
|
|
2108
|
+
debug: F
|
|
2109
|
+
} = Ls(), [H, Z] = I(null), [ae, K] = I(!1), [b, y] = I(!1), [U, j] = I(!1), [te, le] = I(/* @__PURE__ */ new Set()), [pe, Pe] = I(0), [Y, Q] = I(!1), [xe, re] = I(null), me = X(null), {
|
|
2110
|
+
participantSource: ie,
|
|
2111
|
+
participantLabel: ve = "participants",
|
|
2112
|
+
showDeleteConversation: ge = !0
|
|
2113
|
+
} = t, we = z.useMemo(() => {
|
|
2114
|
+
const D = R == null ? void 0 : R.userID;
|
|
2115
|
+
return {
|
|
2116
|
+
...{
|
|
2117
|
+
type: "messaging",
|
|
2118
|
+
last_message_at: { $exists: !0 },
|
|
2119
|
+
...D && {
|
|
2120
|
+
members: { $in: [D] },
|
|
2121
|
+
hidden: !1
|
|
2122
|
+
}
|
|
2123
|
+
},
|
|
2124
|
+
...g
|
|
2125
|
+
};
|
|
2126
|
+
}, [g, R == null ? void 0 : R.userID]), ce = X(null), ne = A(async () => {
|
|
2127
|
+
if (!R || !B) return;
|
|
2128
|
+
const D = R.userID;
|
|
2129
|
+
if (D)
|
|
2130
|
+
try {
|
|
2131
|
+
F && console.log("[MessagingShell] Syncing channels for user:", D);
|
|
2132
|
+
const W = await R.queryChannels(
|
|
2133
|
+
{
|
|
2134
|
+
type: "messaging",
|
|
2135
|
+
members: { $in: [D] }
|
|
2136
|
+
},
|
|
2137
|
+
{},
|
|
2138
|
+
{ limit: 100 }
|
|
2139
|
+
), $ = /* @__PURE__ */ new Set();
|
|
2140
|
+
W.forEach((G) => {
|
|
2141
|
+
const Fe = G.state.members;
|
|
2142
|
+
Object.values(Fe).forEach((Tt) => {
|
|
2143
|
+
var qe;
|
|
2144
|
+
const Ae = (qe = Tt.user) == null ? void 0 : qe.id;
|
|
2145
|
+
Ae && Ae !== D && $.add(Ae);
|
|
2146
|
+
});
|
|
2147
|
+
}), le((G) => G.size === $.size && [...G].every((Fe) => $.has(Fe)) ? G : $), K(W.length > 0), y(!0), ce.current = D, F && console.log("[MessagingShell] Channels synced successfully:", {
|
|
2148
|
+
channelCount: W.length,
|
|
2149
|
+
memberCount: $.size
|
|
2150
|
+
});
|
|
2151
|
+
} catch (W) {
|
|
2152
|
+
console.error("[MessagingShell] Failed to sync channels:", W);
|
|
2153
|
+
}
|
|
2154
|
+
}, [R, B, F]);
|
|
2155
|
+
q(() => {
|
|
2156
|
+
if (!R || !B) return;
|
|
2157
|
+
const D = R.userID;
|
|
2158
|
+
D && ce.current !== D && ne();
|
|
2159
|
+
}, [R, B, ne]), q(() => {
|
|
2160
|
+
if (!r || !R || !B) return;
|
|
2161
|
+
(async () => {
|
|
2162
|
+
const W = R.userID;
|
|
2163
|
+
if (W)
|
|
2164
|
+
try {
|
|
2165
|
+
F && console.log(
|
|
2166
|
+
"[MessagingShell] Loading initial conversation with:",
|
|
2167
|
+
r
|
|
2168
|
+
);
|
|
2169
|
+
const $ = await R.queryChannels(
|
|
2170
|
+
{
|
|
2171
|
+
type: "messaging",
|
|
2172
|
+
members: { $eq: [W, r] }
|
|
2173
|
+
},
|
|
2174
|
+
{},
|
|
2175
|
+
{ limit: 1 }
|
|
2176
|
+
);
|
|
2177
|
+
if ($.length > 0)
|
|
2178
|
+
Z($[0]), Q(!0), re(null), l && l($[0]), F && console.log(
|
|
2179
|
+
"[MessagingShell] Initial conversation loaded:",
|
|
2180
|
+
$[0].id
|
|
2181
|
+
);
|
|
2182
|
+
else if (c && L) {
|
|
2183
|
+
F && console.log(
|
|
2184
|
+
"[MessagingShell] No conversation found, creating one for:",
|
|
2185
|
+
c
|
|
2186
|
+
);
|
|
2187
|
+
try {
|
|
2188
|
+
const G = await L.startChannelWithParticipant({
|
|
2189
|
+
id: c.id,
|
|
2190
|
+
name: c.name,
|
|
2191
|
+
email: c.email,
|
|
2192
|
+
phone: c.phone
|
|
2193
|
+
});
|
|
2194
|
+
Z(G), Q(!0), re(null), l && l(G), F && console.log(
|
|
2195
|
+
"[MessagingShell] Channel created and loaded:",
|
|
2196
|
+
G.id
|
|
2197
|
+
);
|
|
2198
|
+
} catch (G) {
|
|
2199
|
+
console.error(
|
|
2200
|
+
"[MessagingShell] Failed to create conversation:",
|
|
2201
|
+
G
|
|
2202
|
+
), re("Failed to create conversation");
|
|
2203
|
+
}
|
|
2204
|
+
} else
|
|
2205
|
+
re(
|
|
2206
|
+
"No conversation found with this account"
|
|
2207
|
+
), F && console.log(
|
|
2208
|
+
"[MessagingShell] No conversation found for:",
|
|
2209
|
+
r
|
|
2210
|
+
);
|
|
2211
|
+
} catch ($) {
|
|
2212
|
+
console.error(
|
|
2213
|
+
"[MessagingShell] Failed to load initial conversation:",
|
|
2214
|
+
$
|
|
2215
|
+
), re("Failed to load conversation");
|
|
2216
|
+
}
|
|
2217
|
+
})();
|
|
2218
|
+
}, [
|
|
2219
|
+
r,
|
|
2220
|
+
c,
|
|
2221
|
+
R,
|
|
2222
|
+
B,
|
|
2223
|
+
L,
|
|
2224
|
+
F,
|
|
2225
|
+
l
|
|
2226
|
+
]);
|
|
2227
|
+
const Ne = A(
|
|
2228
|
+
(D) => {
|
|
2229
|
+
Z(D), l == null || l(D);
|
|
2230
|
+
},
|
|
2231
|
+
[l]
|
|
2232
|
+
), ye = A(() => {
|
|
2233
|
+
Y || Z(null);
|
|
2234
|
+
}, [Y]), Ce = A(
|
|
2235
|
+
async (D) => {
|
|
2236
|
+
var W;
|
|
2237
|
+
if (L)
|
|
2238
|
+
try {
|
|
2239
|
+
F && console.log(
|
|
2240
|
+
"[MessagingShell] Starting conversation with:",
|
|
2241
|
+
D.id
|
|
2242
|
+
);
|
|
2243
|
+
const $ = await L.startChannelWithParticipant({
|
|
2244
|
+
id: D.id,
|
|
2245
|
+
name: D.name,
|
|
2246
|
+
email: D.email,
|
|
2247
|
+
phone: D.phone
|
|
2248
|
+
});
|
|
2249
|
+
try {
|
|
2250
|
+
await $.show();
|
|
2251
|
+
} catch (G) {
|
|
2252
|
+
console.warn("[MessagingShell] Failed to unhide channel:", G);
|
|
2253
|
+
}
|
|
2254
|
+
Z($), j(!1), (W = me.current) == null || W.close(), d == null || d(D);
|
|
2255
|
+
} catch ($) {
|
|
2256
|
+
console.error("[MessagingShell] Failed to start conversation:", $);
|
|
2257
|
+
}
|
|
2258
|
+
},
|
|
2259
|
+
[L, d, F]
|
|
2260
|
+
), de = A(() => {
|
|
2261
|
+
var D;
|
|
2262
|
+
j(!1), (D = me.current) == null || D.close();
|
|
2263
|
+
}, []), _e = A(
|
|
2264
|
+
(D) => {
|
|
2265
|
+
D.target === me.current && de();
|
|
2266
|
+
},
|
|
2267
|
+
[de]
|
|
2268
|
+
), Ee = A(
|
|
2269
|
+
async (D) => {
|
|
2270
|
+
F && console.log("[MessagingShell] Leaving conversation:", D.id), Z(null), Q(!1), ce.current = null, await ne();
|
|
2271
|
+
},
|
|
2272
|
+
[ne, F]
|
|
2273
|
+
), Se = A(
|
|
2274
|
+
async (D) => {
|
|
2275
|
+
F && console.log("[MessagingShell] Blocking participant:", D), Z(null), Q(!1), ce.current = null, await ne();
|
|
2276
|
+
},
|
|
2277
|
+
[ne, F]
|
|
2278
|
+
), ue = !!H;
|
|
2279
|
+
return ee ? /* @__PURE__ */ e("div", { className: O("h-full", s), children: /* @__PURE__ */ e(De, {}) }) : J ? /* @__PURE__ */ e("div", { className: O("h-full", s), children: /* @__PURE__ */ e(Te, { message: J, onBack: V }) }) : !B || !R ? /* @__PURE__ */ e("div", { className: O("h-full", s), children: /* @__PURE__ */ e(
|
|
2280
|
+
Te,
|
|
2281
|
+
{
|
|
2282
|
+
message: "Not connected to messaging service",
|
|
2283
|
+
onBack: V
|
|
2284
|
+
}
|
|
2285
|
+
) }) : xe ? /* @__PURE__ */ e("div", { className: O("h-full", s), children: /* @__PURE__ */ e(Te, { message: xe }) }) : /* @__PURE__ */ i(
|
|
2286
|
+
"div",
|
|
2287
|
+
{
|
|
2288
|
+
className: O(
|
|
2289
|
+
"messaging-shell h-full bg-background-primary overflow-hidden",
|
|
2290
|
+
s
|
|
2291
|
+
),
|
|
2292
|
+
children: [
|
|
2293
|
+
/* @__PURE__ */ i("div", { className: "flex h-full min-h-0", children: [
|
|
2294
|
+
/* @__PURE__ */ e(
|
|
2295
|
+
"div",
|
|
2296
|
+
{
|
|
2297
|
+
className: O(
|
|
2298
|
+
"messaging-channel-list-sidebar min-h-0 min-w-0 lg:flex lg:flex-col",
|
|
2299
|
+
{
|
|
2300
|
+
"!hidden": u === !1 || Y,
|
|
2301
|
+
// Hide on mobile when channel selected, show on desktop with consistent wide width
|
|
2302
|
+
"hidden lg:flex lg:flex-1 lg:max-w-2xl": u !== !1 && !Y && ue,
|
|
2303
|
+
// Show on mobile when no channel selected, use same wide width on desktop
|
|
2304
|
+
"flex flex-col w-full lg:flex-1 lg:max-w-2xl": u !== !1 && !Y && !ue
|
|
2305
|
+
}
|
|
2306
|
+
),
|
|
2307
|
+
children: /* @__PURE__ */ e(
|
|
2308
|
+
vt,
|
|
2309
|
+
{
|
|
2310
|
+
onChannelSelect: Ne,
|
|
2311
|
+
selectedChannel: H || void 0,
|
|
2312
|
+
filters: we,
|
|
2313
|
+
channelRenderFilterFn: h,
|
|
2314
|
+
customEmptyStateIndicator: N,
|
|
2315
|
+
renderMessagePreview: P
|
|
2316
|
+
}
|
|
2317
|
+
)
|
|
2318
|
+
}
|
|
2319
|
+
),
|
|
2320
|
+
/* @__PURE__ */ e(
|
|
2321
|
+
"div",
|
|
2322
|
+
{
|
|
2323
|
+
className: O(
|
|
2324
|
+
"messaging-conversation-view flex-1 flex-col min-w-0 min-h-0",
|
|
2325
|
+
{
|
|
2326
|
+
// In direct conversation mode (or waiting for it), always show (full width)
|
|
2327
|
+
flex: Y || ue || r,
|
|
2328
|
+
// Normal mode: hide on mobile when no channel selected
|
|
2329
|
+
"hidden lg:flex": !Y && !ue && !r
|
|
2330
|
+
}
|
|
2331
|
+
),
|
|
2332
|
+
children: H ? /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 flex flex-col", children: /* @__PURE__ */ e(
|
|
2333
|
+
_t,
|
|
2334
|
+
{
|
|
2335
|
+
channel: H,
|
|
2336
|
+
onBack: ye,
|
|
2337
|
+
showBackButton: !Y,
|
|
2338
|
+
renderMessageInputActions: n,
|
|
2339
|
+
renderConversationFooter: o,
|
|
2340
|
+
renderChannelBanner: v,
|
|
2341
|
+
onLeaveConversation: Ee,
|
|
2342
|
+
onBlockParticipant: Se,
|
|
2343
|
+
CustomChannelEmptyState: x,
|
|
2344
|
+
showDeleteConversation: ge,
|
|
2345
|
+
onDeleteConversationClick: a,
|
|
2346
|
+
onBlockParticipantClick: _,
|
|
2347
|
+
onReportParticipantClick: w,
|
|
2348
|
+
dmAgentEnabled: p,
|
|
2349
|
+
messageMetadata: E,
|
|
2350
|
+
onMessageSent: S,
|
|
2351
|
+
showStarButton: C,
|
|
2352
|
+
chatbotVotingEnabled: k,
|
|
2353
|
+
customProfileContent: m,
|
|
2354
|
+
customChannelActions: f,
|
|
2355
|
+
renderMessage: T,
|
|
2356
|
+
sendButton: M
|
|
2357
|
+
},
|
|
2358
|
+
H.id
|
|
2359
|
+
) }) : r ? (
|
|
2360
|
+
// Show loading while creating/loading direct conversation channel
|
|
2361
|
+
/* @__PURE__ */ e(De, {})
|
|
2362
|
+
) : /* @__PURE__ */ e(
|
|
2363
|
+
Et,
|
|
2364
|
+
{
|
|
2365
|
+
hasChannels: ae,
|
|
2366
|
+
channelsLoaded: b
|
|
2367
|
+
}
|
|
2368
|
+
)
|
|
2369
|
+
}
|
|
2370
|
+
)
|
|
2371
|
+
] }),
|
|
2372
|
+
ie && // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
2373
|
+
/* @__PURE__ */ e(
|
|
2374
|
+
"dialog",
|
|
2375
|
+
{
|
|
2376
|
+
ref: me,
|
|
2377
|
+
className: "mes-dialog",
|
|
2378
|
+
onClick: _e,
|
|
2379
|
+
onClose: de,
|
|
2380
|
+
children: /* @__PURE__ */ e("div", { className: "h-full w-full bg-white shadow-max-elevation-light", children: /* @__PURE__ */ e(
|
|
2381
|
+
Dn,
|
|
2382
|
+
{
|
|
2383
|
+
participantSource: ie,
|
|
2384
|
+
onSelectParticipant: Ce,
|
|
2385
|
+
onClose: de,
|
|
2386
|
+
existingParticipantIds: te,
|
|
2387
|
+
participantLabel: ve,
|
|
2388
|
+
searchPlaceholder: `Search ${ve}...`
|
|
2389
|
+
},
|
|
2390
|
+
pe
|
|
2391
|
+
) })
|
|
2392
|
+
}
|
|
2393
|
+
)
|
|
2394
|
+
]
|
|
2395
|
+
}
|
|
2396
|
+
);
|
|
2397
|
+
}, Ln = ({
|
|
2398
|
+
question: t,
|
|
2399
|
+
onClick: s,
|
|
2400
|
+
loading: n = !1,
|
|
2401
|
+
className: o
|
|
2402
|
+
}) => /* @__PURE__ */ e(
|
|
2403
|
+
"button",
|
|
2404
|
+
{
|
|
2405
|
+
type: "button",
|
|
2406
|
+
onClick: s,
|
|
2407
|
+
disabled: n,
|
|
2408
|
+
style: { backgroundColor: "#E6E5E3" },
|
|
2409
|
+
className: O(
|
|
2410
|
+
"w-full text-center p-4 rounded-xl text-charcoal font-medium transition-colors focus-ring",
|
|
2411
|
+
{
|
|
2412
|
+
"hover:brightness-95 active:brightness-90": !n,
|
|
2413
|
+
"opacity-50 cursor-not-allowed": n
|
|
2414
|
+
},
|
|
2415
|
+
o
|
|
2416
|
+
),
|
|
2417
|
+
children: t
|
|
2418
|
+
}
|
|
2419
|
+
), ra = ({
|
|
2420
|
+
faqs: t,
|
|
2421
|
+
onFaqClick: s,
|
|
2422
|
+
loadingFaqId: n,
|
|
2423
|
+
headerText: o,
|
|
2424
|
+
className: l,
|
|
2425
|
+
avatarImage: d,
|
|
2426
|
+
avatarName: r
|
|
2427
|
+
}) => {
|
|
2428
|
+
const c = t.filter((x) => x.enabled).sort((x, u) => (x.order ?? 0) - (u.order ?? 0));
|
|
2429
|
+
return c.length === 0 ? null : /* @__PURE__ */ e("div", { className: l, children: /* @__PURE__ */ i("div", { className: "flex gap-3 items-end", children: [
|
|
2430
|
+
(d || r) && /* @__PURE__ */ e("div", { className: "flex-none", children: /* @__PURE__ */ e(
|
|
2431
|
+
oe,
|
|
2432
|
+
{
|
|
2433
|
+
id: r || "account",
|
|
2434
|
+
name: r || "Account",
|
|
2435
|
+
image: d,
|
|
2436
|
+
size: 24,
|
|
2437
|
+
shape: "circle"
|
|
2438
|
+
}
|
|
2439
|
+
) }),
|
|
2440
|
+
/* @__PURE__ */ i(
|
|
2441
|
+
"div",
|
|
2442
|
+
{
|
|
2443
|
+
className: "flex-1 flex flex-col gap-3 rounded-lg p-4",
|
|
2444
|
+
style: { backgroundColor: "#F1F0EE" },
|
|
2445
|
+
children: [
|
|
2446
|
+
o && /* @__PURE__ */ e("p", { className: "text-md text-charcoal mb-4", children: o }),
|
|
2447
|
+
c.map((x) => /* @__PURE__ */ e(
|
|
2448
|
+
Ln,
|
|
2449
|
+
{
|
|
2450
|
+
question: x.question,
|
|
2451
|
+
onClick: () => s(x.id),
|
|
2452
|
+
loading: n === x.id
|
|
2453
|
+
},
|
|
2454
|
+
x.id
|
|
2455
|
+
))
|
|
2456
|
+
]
|
|
2457
|
+
}
|
|
2458
|
+
)
|
|
2459
|
+
] }) });
|
|
2460
|
+
}, Pn = [
|
|
2461
|
+
[/pdf/, "pdf"],
|
|
2462
|
+
[/wordprocessingml|msword|\.doc/, "doc"],
|
|
2463
|
+
[/spreadsheetml|ms-excel|\.xls/, "xls"],
|
|
2464
|
+
[/csv/, "csv"],
|
|
2465
|
+
[/presentationml|ms-powerpoint|\.ppt/, "ppt"],
|
|
2466
|
+
[/zip|x-rar|x-7z|x-tar|x-gzip/, "zip"],
|
|
2467
|
+
[/plain|rtf/, "text"],
|
|
2468
|
+
[/markdown/, "markdown"]
|
|
2469
|
+
];
|
|
2470
|
+
function Ye(t) {
|
|
2471
|
+
return t.startsWith("video/") ? "video" : t.startsWith("audio/") ? "audio" : t.startsWith("image/") ? "image" : "document";
|
|
2472
|
+
}
|
|
2473
|
+
function Fn(t) {
|
|
2474
|
+
const s = Pn.find(
|
|
2475
|
+
([n]) => n.test(t)
|
|
2476
|
+
);
|
|
2477
|
+
return s ? s[1] : "generic";
|
|
2478
|
+
}
|
|
2479
|
+
const An = {
|
|
2480
|
+
video: Ns,
|
|
2481
|
+
audio: ws,
|
|
2482
|
+
image: vs,
|
|
2483
|
+
document: mt
|
|
2484
|
+
}, Un = {
|
|
2485
|
+
pdf: Ts,
|
|
2486
|
+
doc: Is,
|
|
2487
|
+
xls: ks,
|
|
2488
|
+
csv: Ss,
|
|
2489
|
+
ppt: Es,
|
|
2490
|
+
zip: _s,
|
|
2491
|
+
text: Cs,
|
|
2492
|
+
markdown: ys,
|
|
2493
|
+
generic: mt
|
|
2494
|
+
};
|
|
2495
|
+
function On(t) {
|
|
2496
|
+
const s = Ye(t);
|
|
2497
|
+
return s !== "document" ? An[s] : Un[Fn(t)];
|
|
2498
|
+
}
|
|
2499
|
+
function We(t, s) {
|
|
2500
|
+
return z.createElement(On(t), s);
|
|
2501
|
+
}
|
|
2502
|
+
const $n = (t) => {
|
|
2503
|
+
var s, n;
|
|
2504
|
+
return "touches" in t ? ((s = t.touches[0]) == null ? void 0 : s.clientX) ?? ((n = t.changedTouches[0]) == null ? void 0 : n.clientX) ?? 0 : t.clientX;
|
|
2505
|
+
}, Ve = ({
|
|
2506
|
+
source: t,
|
|
2507
|
+
mimeType: s,
|
|
2508
|
+
poster: n,
|
|
2509
|
+
autoPlay: o = !1,
|
|
2510
|
+
playing: l,
|
|
2511
|
+
loop: d = !1,
|
|
2512
|
+
controls: r = !0,
|
|
2513
|
+
showProgress: c = !1,
|
|
2514
|
+
muted: x = !1,
|
|
2515
|
+
onContainerClick: u
|
|
2516
|
+
}) => {
|
|
2517
|
+
const g = Ye(s), h = X(null), N = X(null), a = X(null), _ = X(l), [w, p] = I(o), [E, S] = I(0), [C, k] = I(!1), [P, v] = I(!1), [m, f] = I(!1), [T, M] = I(!1), [L, R] = I(!0), [B, ee] = I(null), J = A(() => {
|
|
2518
|
+
f(!1), p(!0);
|
|
2519
|
+
}, []), V = A((b) => {
|
|
2520
|
+
const y = N.current;
|
|
2521
|
+
if (!y) return 0;
|
|
2522
|
+
const U = y.getBoundingClientRect();
|
|
2523
|
+
return Math.max(
|
|
2524
|
+
0,
|
|
2525
|
+
Math.min(1, ($n(b) - U.left) / U.width)
|
|
2526
|
+
);
|
|
2527
|
+
}, []), F = A((b) => {
|
|
2528
|
+
const y = h.current;
|
|
2529
|
+
y && y.duration && (y.currentTime = b * y.duration);
|
|
2530
|
+
}, []), H = (b) => {
|
|
2531
|
+
b.stopPropagation(), k(!0);
|
|
2532
|
+
const y = V(b);
|
|
2533
|
+
S(y), F(y);
|
|
2534
|
+
};
|
|
2535
|
+
q(() => {
|
|
2536
|
+
l !== void 0 && l !== _.current && (_.current = l, p(l));
|
|
2537
|
+
}, [l]), q(() => {
|
|
2538
|
+
if (!w) {
|
|
2539
|
+
a.current !== null && (cancelAnimationFrame(a.current), a.current = null);
|
|
2540
|
+
return;
|
|
2541
|
+
}
|
|
2542
|
+
const b = () => {
|
|
2543
|
+
const y = h.current;
|
|
2544
|
+
y && y.duration && !C && S(y.currentTime / y.duration), a.current = requestAnimationFrame(b);
|
|
2545
|
+
};
|
|
2546
|
+
return a.current = requestAnimationFrame(b), () => {
|
|
2547
|
+
a.current !== null && cancelAnimationFrame(a.current);
|
|
2548
|
+
};
|
|
2549
|
+
}, [w, C]), q(() => {
|
|
2550
|
+
const b = h.current;
|
|
2551
|
+
b && (w ? b.play().catch((y) => {
|
|
2552
|
+
p(!1), f(!0);
|
|
2553
|
+
}) : b.pause());
|
|
2554
|
+
}, [w]), q(() => {
|
|
2555
|
+
if (!C) return;
|
|
2556
|
+
const b = (U) => S(V(U)), y = (U) => {
|
|
2557
|
+
k(!1), F(V(U));
|
|
2558
|
+
};
|
|
2559
|
+
return window.addEventListener("mousemove", b), window.addEventListener("mouseup", y), window.addEventListener("touchmove", b, { passive: !0 }), window.addEventListener("touchend", y), () => {
|
|
2560
|
+
window.removeEventListener("mousemove", b), window.removeEventListener("mouseup", y), window.removeEventListener("touchmove", b), window.removeEventListener("touchend", y);
|
|
2561
|
+
};
|
|
2562
|
+
}, [C, V, F]);
|
|
2563
|
+
const Z = B ? { aspectRatio: String(B) } : void 0, ae = B ? "" : " aspect-video", K = Math.round(E * 100);
|
|
2564
|
+
return /* @__PURE__ */ i(
|
|
2565
|
+
"div",
|
|
2566
|
+
{
|
|
2567
|
+
role: "button",
|
|
2568
|
+
tabIndex: 0,
|
|
2569
|
+
className: `relative cursor-pointer overflow-hidden bg-black ${ae}`,
|
|
2570
|
+
style: Z,
|
|
2571
|
+
onClick: (b) => {
|
|
2572
|
+
if (u) {
|
|
2573
|
+
u(b);
|
|
2574
|
+
return;
|
|
2575
|
+
}
|
|
2576
|
+
m || r && p((y) => !y);
|
|
2577
|
+
},
|
|
2578
|
+
onKeyDown: (b) => {
|
|
2579
|
+
if (!(b.key !== "Enter" && b.key !== " ")) {
|
|
2580
|
+
if (b.preventDefault(), u) {
|
|
2581
|
+
u(b);
|
|
2582
|
+
return;
|
|
2583
|
+
}
|
|
2584
|
+
m || r && p((y) => !y);
|
|
2585
|
+
}
|
|
2586
|
+
},
|
|
2587
|
+
children: [
|
|
2588
|
+
n && (g === "audio" || L) && /* @__PURE__ */ e(
|
|
2589
|
+
"img",
|
|
2590
|
+
{
|
|
2591
|
+
src: n,
|
|
2592
|
+
alt: "",
|
|
2593
|
+
className: "absolute inset-0 h-full w-full object-cover"
|
|
2594
|
+
}
|
|
2595
|
+
),
|
|
2596
|
+
!n && (g === "audio" || L) && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center", children: We(s, {
|
|
2597
|
+
className: "size-12 text-black/20",
|
|
2598
|
+
weight: "regular"
|
|
2599
|
+
}) }),
|
|
2600
|
+
/* @__PURE__ */ e("div", { className: "absolute inset-0", children: g === "audio" ? /* @__PURE__ */ e(
|
|
2601
|
+
"audio",
|
|
2602
|
+
{
|
|
2603
|
+
ref: h,
|
|
2604
|
+
src: t,
|
|
2605
|
+
loop: d,
|
|
2606
|
+
muted: x,
|
|
2607
|
+
style: { width: "100%", height: "100%" },
|
|
2608
|
+
onLoadStart: () => M(!0),
|
|
2609
|
+
onCanPlay: () => {
|
|
2610
|
+
M(!1), R(!1);
|
|
2611
|
+
},
|
|
2612
|
+
onWaiting: () => M(!0),
|
|
2613
|
+
onPlay: () => f(!1),
|
|
2614
|
+
onEnded: () => {
|
|
2615
|
+
d || (p(!1), S(0));
|
|
2616
|
+
},
|
|
2617
|
+
children: /* @__PURE__ */ e("track", { kind: "captions" })
|
|
2618
|
+
}
|
|
2619
|
+
) : /* @__PURE__ */ e(
|
|
2620
|
+
"video",
|
|
2621
|
+
{
|
|
2622
|
+
ref: h,
|
|
2623
|
+
src: t,
|
|
2624
|
+
loop: d,
|
|
2625
|
+
muted: x,
|
|
2626
|
+
playsInline: !0,
|
|
2627
|
+
style: { width: "100%", height: "100%" },
|
|
2628
|
+
onLoadStart: () => M(!0),
|
|
2629
|
+
onCanPlay: () => {
|
|
2630
|
+
M(!1), R(!1);
|
|
2631
|
+
},
|
|
2632
|
+
onWaiting: () => M(!0),
|
|
2633
|
+
onPlay: () => f(!1),
|
|
2634
|
+
onLoadedMetadata: () => {
|
|
2635
|
+
const b = h.current;
|
|
2636
|
+
b instanceof HTMLVideoElement && b.videoWidth && b.videoHeight && ee(b.videoWidth / b.videoHeight);
|
|
2637
|
+
},
|
|
2638
|
+
onEnded: () => {
|
|
2639
|
+
d || (p(!1), S(0));
|
|
2640
|
+
},
|
|
2641
|
+
children: /* @__PURE__ */ e("track", { kind: "captions" })
|
|
2642
|
+
}
|
|
2643
|
+
) }),
|
|
2644
|
+
T && !m && /* @__PURE__ */ e("div", { className: "absolute inset-0 z-10 flex items-center justify-center", children: /* @__PURE__ */ e(
|
|
2645
|
+
ht,
|
|
2646
|
+
{
|
|
2647
|
+
className: "size-8 animate-spin text-white/80",
|
|
2648
|
+
weight: "bold"
|
|
2649
|
+
}
|
|
2650
|
+
) }),
|
|
2651
|
+
m && !r && /* @__PURE__ */ e(
|
|
2652
|
+
"div",
|
|
2653
|
+
{
|
|
2654
|
+
className: "absolute inset-0 z-30 flex cursor-pointer items-center justify-center bg-black/35",
|
|
2655
|
+
role: "button",
|
|
2656
|
+
tabIndex: 0,
|
|
2657
|
+
"aria-label": "Play preview",
|
|
2658
|
+
onClick: (b) => {
|
|
2659
|
+
b.stopPropagation(), J();
|
|
2660
|
+
},
|
|
2661
|
+
onKeyDown: (b) => {
|
|
2662
|
+
b.key !== "Enter" && b.key !== " " || (b.preventDefault(), b.stopPropagation(), J());
|
|
2663
|
+
},
|
|
2664
|
+
children: /* @__PURE__ */ e("span", { className: "flex size-16 items-center justify-center rounded-full bg-white/20 text-white backdrop-blur-sm", children: /* @__PURE__ */ e(tt, { className: "size-9 translate-x-0.5", weight: "fill" }) })
|
|
2665
|
+
}
|
|
2666
|
+
),
|
|
2667
|
+
c && !r && /* @__PURE__ */ e("div", { className: "absolute inset-x-0 bottom-0 px-3 pb-2.5 pt-6 bg-gradient-to-t from-black/40 to-transparent", children: /* @__PURE__ */ e(
|
|
2668
|
+
"div",
|
|
2669
|
+
{
|
|
2670
|
+
role: "slider",
|
|
2671
|
+
"aria-label": "Playback position",
|
|
2672
|
+
"aria-valuenow": K,
|
|
2673
|
+
"aria-valuemin": 0,
|
|
2674
|
+
"aria-valuemax": 100,
|
|
2675
|
+
tabIndex: 0,
|
|
2676
|
+
ref: N,
|
|
2677
|
+
className: "relative flex h-4 w-full cursor-pointer items-center",
|
|
2678
|
+
onMouseDown: H,
|
|
2679
|
+
onTouchStart: H,
|
|
2680
|
+
onClick: (b) => b.stopPropagation(),
|
|
2681
|
+
onKeyDown: (b) => {
|
|
2682
|
+
b.key === "ArrowRight" && F(Math.min(1, E + 0.05)), b.key === "ArrowLeft" && F(Math.max(0, E - 0.05));
|
|
2683
|
+
},
|
|
2684
|
+
children: /* @__PURE__ */ e("div", { className: "w-full overflow-hidden rounded-full bg-white/30 h-1", children: /* @__PURE__ */ e(
|
|
2685
|
+
"div",
|
|
2686
|
+
{
|
|
2687
|
+
className: "h-full rounded-full bg-white",
|
|
2688
|
+
style: { width: `${K}%` }
|
|
2689
|
+
}
|
|
2690
|
+
) })
|
|
2691
|
+
}
|
|
2692
|
+
) }),
|
|
2693
|
+
r && /* @__PURE__ */ i("div", { className: "absolute inset-x-0 bottom-0 flex items-center gap-2 bg-gradient-to-t from-black/60 to-transparent px-3 pb-2.5 pt-6 transition-all duration-200", children: [
|
|
2694
|
+
/* @__PURE__ */ e(
|
|
2695
|
+
"button",
|
|
2696
|
+
{
|
|
2697
|
+
type: "button",
|
|
2698
|
+
onClick: (b) => {
|
|
2699
|
+
b.stopPropagation(), p((y) => !y);
|
|
2700
|
+
},
|
|
2701
|
+
className: "shrink-0 text-white",
|
|
2702
|
+
"aria-label": w ? "Pause" : "Play",
|
|
2703
|
+
children: w ? /* @__PURE__ */ e(Ms, { className: "size-5", weight: "fill" }) : /* @__PURE__ */ e(tt, { className: "size-5 translate-x-px", weight: "fill" })
|
|
2704
|
+
}
|
|
2705
|
+
),
|
|
2706
|
+
/* @__PURE__ */ i(
|
|
2707
|
+
"div",
|
|
2708
|
+
{
|
|
2709
|
+
role: "slider",
|
|
2710
|
+
"aria-label": "Playback position",
|
|
2711
|
+
"aria-valuenow": K,
|
|
2712
|
+
"aria-valuemin": 0,
|
|
2713
|
+
"aria-valuemax": 100,
|
|
2714
|
+
tabIndex: 0,
|
|
2715
|
+
ref: N,
|
|
2716
|
+
className: "relative flex h-4 w-full cursor-pointer items-center",
|
|
2717
|
+
onMouseDown: H,
|
|
2718
|
+
onTouchStart: H,
|
|
2719
|
+
onClick: (b) => b.stopPropagation(),
|
|
2720
|
+
onMouseEnter: () => v(!0),
|
|
2721
|
+
onMouseLeave: () => v(!1),
|
|
2722
|
+
onKeyDown: (b) => {
|
|
2723
|
+
b.key === "ArrowRight" && F(Math.min(1, E + 0.05)), b.key === "ArrowLeft" && F(Math.max(0, E - 0.05));
|
|
2724
|
+
},
|
|
2725
|
+
children: [
|
|
2726
|
+
/* @__PURE__ */ e(
|
|
2727
|
+
"div",
|
|
2728
|
+
{
|
|
2729
|
+
className: `w-full overflow-hidden rounded-full bg-white/30 transition-all duration-200 ${P || C ? "h-1.5" : "h-1"}`,
|
|
2730
|
+
children: /* @__PURE__ */ e(
|
|
2731
|
+
"div",
|
|
2732
|
+
{
|
|
2733
|
+
className: "h-full rounded-full bg-white",
|
|
2734
|
+
style: { width: `${K}%` }
|
|
2735
|
+
}
|
|
2736
|
+
)
|
|
2737
|
+
}
|
|
2738
|
+
),
|
|
2739
|
+
/* @__PURE__ */ e(
|
|
2740
|
+
"div",
|
|
2741
|
+
{
|
|
2742
|
+
className: `absolute size-3 -translate-x-1/2 rounded-full bg-white shadow transition-[opacity,transform] duration-200 ${P || C ? "scale-100 opacity-100" : "scale-0 opacity-0"}`,
|
|
2743
|
+
style: { left: `${K}%` }
|
|
2744
|
+
}
|
|
2745
|
+
)
|
|
2746
|
+
]
|
|
2747
|
+
}
|
|
2748
|
+
)
|
|
2749
|
+
] })
|
|
2750
|
+
]
|
|
2751
|
+
}
|
|
2752
|
+
);
|
|
2753
|
+
};
|
|
2754
|
+
function zn(t) {
|
|
2755
|
+
return t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(1)} KB` : `${(t / (1024 * 1024)).toFixed(1)} MB`;
|
|
2756
|
+
}
|
|
2757
|
+
function Bn(t) {
|
|
2758
|
+
return `w-[280px] select-none overflow-hidden rounded-[24px] ${t ? "bg-[#121110]" : "bg-[#F3F3F1]"} shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_4px_8px_rgba(0,0,0,0.06)]`;
|
|
2759
|
+
}
|
|
2760
|
+
function St(t) {
|
|
2761
|
+
return t ? "text-white" : "text-black";
|
|
2762
|
+
}
|
|
2763
|
+
function be(t) {
|
|
2764
|
+
return t ? "text-white/55" : "text-black/55";
|
|
2765
|
+
}
|
|
2766
|
+
function jn(t) {
|
|
2767
|
+
return t ? "text-white/40" : "text-black/40";
|
|
2768
|
+
}
|
|
2769
|
+
function kt(t) {
|
|
2770
|
+
return t ? "bg-white/10" : "bg-black/5";
|
|
2771
|
+
}
|
|
2772
|
+
function It(t) {
|
|
2773
|
+
return t ? "text-white/20" : "text-black/20";
|
|
2774
|
+
}
|
|
2775
|
+
function Gn(t) {
|
|
2776
|
+
return t ? "bg-white/10 hover:bg-white/15" : "bg-black/[0.06] hover:bg-black/10";
|
|
2777
|
+
}
|
|
2778
|
+
async function Vn(t, s) {
|
|
2779
|
+
let n;
|
|
2780
|
+
try {
|
|
2781
|
+
n = s ?? new URL(t).pathname.split("/").pop() ?? "download";
|
|
2782
|
+
} catch {
|
|
2783
|
+
n = s ?? "download";
|
|
2784
|
+
}
|
|
2785
|
+
const o = await fetch(t, { mode: "cors" });
|
|
2786
|
+
if (!o.ok) throw new Error(`HTTP ${o.status}`);
|
|
2787
|
+
const l = await o.blob(), d = URL.createObjectURL(l), r = document.createElement("a");
|
|
2788
|
+
r.href = d, r.download = n, r.style.display = "none", document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(d);
|
|
2789
|
+
}
|
|
2790
|
+
const Hn = ({
|
|
2791
|
+
url: t,
|
|
2792
|
+
filename: s,
|
|
2793
|
+
isMyMessage: n
|
|
2794
|
+
}) => {
|
|
2795
|
+
const [o, l] = I(!1);
|
|
2796
|
+
return /* @__PURE__ */ e(
|
|
2797
|
+
"button",
|
|
2798
|
+
{
|
|
2799
|
+
type: "button",
|
|
2800
|
+
onClick: (r) => {
|
|
2801
|
+
r.stopPropagation();
|
|
2802
|
+
const c = window.open("", "_blank", "noopener,noreferrer");
|
|
2803
|
+
l(!0), Vn(t, s).then(() => {
|
|
2804
|
+
c == null || c.close();
|
|
2805
|
+
}).catch(() => {
|
|
2806
|
+
c && (c.location.href = t);
|
|
2807
|
+
}).finally(() => l(!1));
|
|
2808
|
+
},
|
|
2809
|
+
disabled: o,
|
|
2810
|
+
className: `flex size-8 items-center justify-center rounded-full ${Gn(n)} disabled:opacity-50`,
|
|
2811
|
+
"aria-label": "Download",
|
|
2812
|
+
children: o ? /* @__PURE__ */ e(ht, { className: `size-4 animate-spin ${be(n)}`, weight: "bold" }) : /* @__PURE__ */ e(Rs, { className: `size-4 ${be(n)}`, weight: "bold" })
|
|
2813
|
+
}
|
|
2814
|
+
);
|
|
2815
|
+
}, Me = ({ mimeType: t, title: s, fileSize: n, url: o, isMyMessage: l }) => /* @__PURE__ */ i("div", { className: "flex items-start gap-2 px-4 pb-3 pt-3", children: [
|
|
2816
|
+
/* @__PURE__ */ i("div", { className: "min-w-0 flex-1", children: [
|
|
2817
|
+
s && /* @__PURE__ */ e("p", { className: `mb-1.5 truncate text-base font-medium ${St(l)}`, children: s }),
|
|
2818
|
+
n !== void 0 && /* @__PURE__ */ i("div", { className: "flex items-center gap-1", children: [
|
|
2819
|
+
We(t, {
|
|
2820
|
+
className: `size-5 shrink-0 ${be(l)}`,
|
|
2821
|
+
weight: "regular"
|
|
2822
|
+
}),
|
|
2823
|
+
/* @__PURE__ */ e("span", { className: `text-xs font-medium ${be(l)}`, children: zn(n) })
|
|
2824
|
+
] })
|
|
2825
|
+
] }),
|
|
2826
|
+
/* @__PURE__ */ e("div", { className: "flex shrink-0 items-center gap-1 pt-0.5", children: /* @__PURE__ */ e(Hn, { url: o, filename: s, isMyMessage: l }) })
|
|
2827
|
+
] }), Yn = ({ url: t, mimeType: s, title: n, fileSize: o, isMyMessage: l, onExpand: d }) => {
|
|
2828
|
+
const r = /* @__PURE__ */ e(
|
|
2829
|
+
"div",
|
|
2830
|
+
{
|
|
2831
|
+
className: `aspect-video w-full ${kt(l)} flex items-center justify-center`,
|
|
2832
|
+
children: We(s, {
|
|
2833
|
+
className: `size-12 ${It(l)}`,
|
|
2834
|
+
weight: "regular"
|
|
2835
|
+
})
|
|
2836
|
+
}
|
|
2837
|
+
);
|
|
2838
|
+
return /* @__PURE__ */ i("div", { children: [
|
|
2839
|
+
d ? /* @__PURE__ */ e(
|
|
2840
|
+
"button",
|
|
2841
|
+
{
|
|
2842
|
+
type: "button",
|
|
2843
|
+
onClick: d,
|
|
2844
|
+
className: "block w-full",
|
|
2845
|
+
"aria-label": "Open PDF viewer",
|
|
2846
|
+
children: r
|
|
2847
|
+
}
|
|
2848
|
+
) : /* @__PURE__ */ e("a", { href: t, target: "_blank", rel: "noopener noreferrer", className: "block no-underline", children: r }),
|
|
2849
|
+
/* @__PURE__ */ e(
|
|
2850
|
+
Me,
|
|
2851
|
+
{
|
|
2852
|
+
mimeType: s,
|
|
2853
|
+
title: n,
|
|
2854
|
+
fileSize: o,
|
|
2855
|
+
url: t,
|
|
2856
|
+
isMyMessage: l
|
|
2857
|
+
}
|
|
2858
|
+
)
|
|
2859
|
+
] });
|
|
2860
|
+
}, Wn = ({ attachment: t, isMyMessage: s }) => {
|
|
2861
|
+
const { title: n, text: o, image_url: l, og_scrape_url: d, title_link: r } = t, c = d ?? r;
|
|
2862
|
+
return /* @__PURE__ */ i("a", { href: c, target: "_blank", rel: "noopener noreferrer", className: "block no-underline", children: [
|
|
2863
|
+
/* @__PURE__ */ e("div", { className: "p-2", children: l ? /* @__PURE__ */ e(
|
|
2864
|
+
"img",
|
|
2865
|
+
{
|
|
2866
|
+
src: l,
|
|
2867
|
+
alt: n ?? "",
|
|
2868
|
+
className: "aspect-video w-full rounded-[20px] object-cover"
|
|
2869
|
+
}
|
|
2870
|
+
) : /* @__PURE__ */ e(
|
|
2871
|
+
"div",
|
|
2872
|
+
{
|
|
2873
|
+
className: `aspect-video w-full rounded-[20px] ${kt(s)} flex items-center justify-center`,
|
|
2874
|
+
children: /* @__PURE__ */ e(Ds, { className: `size-12 ${It(s)}` })
|
|
2875
|
+
}
|
|
2876
|
+
) }),
|
|
2877
|
+
/* @__PURE__ */ i("div", { className: "px-3 pb-3", children: [
|
|
2878
|
+
n && /* @__PURE__ */ e("p", { className: `truncate text-[14px] font-medium leading-5 ${St(s)}`, children: n }),
|
|
2879
|
+
o && /* @__PURE__ */ e("p", { className: `truncate text-[12px] leading-4 ${be(s)}`, children: o }),
|
|
2880
|
+
c && /* @__PURE__ */ e("p", { className: `mt-1 truncate text-[12px] leading-4 ${jn(s)}`, children: c })
|
|
2881
|
+
] })
|
|
2882
|
+
] });
|
|
2883
|
+
}, qn = ({ sourceType: t, url: s, mimeType: n, title: o, poster: l, onClose: d }) => {
|
|
2884
|
+
const r = X(null);
|
|
2885
|
+
return q(() => {
|
|
2886
|
+
const u = r.current;
|
|
2887
|
+
return u == null || u.showModal(), () => {
|
|
2888
|
+
u != null && u.open && u.close();
|
|
2889
|
+
};
|
|
2890
|
+
}, []), // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
|
|
2891
|
+
/* @__PURE__ */ e(
|
|
2892
|
+
"dialog",
|
|
2893
|
+
{
|
|
2894
|
+
ref: r,
|
|
2895
|
+
className: "mes-media-viewer",
|
|
2896
|
+
onClose: d,
|
|
2897
|
+
onClick: (u) => {
|
|
2898
|
+
u.target === r.current && d();
|
|
2899
|
+
},
|
|
2900
|
+
children: /* @__PURE__ */ i("div", { className: "relative flex h-full w-full items-center justify-center p-6", children: [
|
|
2901
|
+
/* @__PURE__ */ e(
|
|
2902
|
+
"button",
|
|
2903
|
+
{
|
|
2904
|
+
type: "button",
|
|
2905
|
+
onClick: d,
|
|
2906
|
+
className: "absolute right-4 top-4 z-10 flex size-10 items-center justify-center rounded-full bg-white/10 text-white hover:bg-white/20",
|
|
2907
|
+
"aria-label": "Close",
|
|
2908
|
+
children: /* @__PURE__ */ e(Re, { className: "size-5", weight: "bold" })
|
|
2909
|
+
}
|
|
2910
|
+
),
|
|
2911
|
+
t === "image" ? /* @__PURE__ */ e(
|
|
2912
|
+
"img",
|
|
2913
|
+
{
|
|
2914
|
+
src: s,
|
|
2915
|
+
alt: o ?? "",
|
|
2916
|
+
className: "max-h-[90vh] max-w-[90vw] rounded-2xl object-contain"
|
|
2917
|
+
}
|
|
2918
|
+
) : n === "application/pdf" ? /* @__PURE__ */ i("div", { className: "flex h-full w-full max-w-4xl flex-col pt-14", children: [
|
|
2919
|
+
o && /* @__PURE__ */ e("p", { className: "mb-2 shrink-0 truncate text-sm font-medium text-white/70", children: o }),
|
|
2920
|
+
/* @__PURE__ */ e(
|
|
2921
|
+
"iframe",
|
|
2922
|
+
{
|
|
2923
|
+
src: s,
|
|
2924
|
+
title: o ?? "Document",
|
|
2925
|
+
className: "w-full flex-1 rounded-xl"
|
|
2926
|
+
}
|
|
2927
|
+
)
|
|
2928
|
+
] }) : /* @__PURE__ */ i("div", { className: "w-full max-w-2xl", children: [
|
|
2929
|
+
o && /* @__PURE__ */ e("p", { className: "mb-4 text-center text-sm font-medium text-white/70", children: o }),
|
|
2930
|
+
/* @__PURE__ */ e(Ve, { source: s, mimeType: n, poster: l, controls: !0 })
|
|
2931
|
+
] })
|
|
2932
|
+
] })
|
|
2933
|
+
}
|
|
2934
|
+
);
|
|
2935
|
+
}, oa = ({
|
|
2936
|
+
message: t,
|
|
2937
|
+
isMyMessage: s = !1
|
|
2938
|
+
}) => {
|
|
2939
|
+
var C, k, P, v, m;
|
|
2940
|
+
const [n, o] = I(!1), l = (C = t.attachments) == null ? void 0 : C.find(
|
|
2941
|
+
(f) => f.type === "link" || f.og_scrape_url && !f.asset_url
|
|
2942
|
+
), d = (k = t.attachments) == null ? void 0 : k.find(
|
|
2943
|
+
(f) => f.type === "video" && f.asset_url
|
|
2944
|
+
), r = (P = t.attachments) == null ? void 0 : P.find(
|
|
2945
|
+
(f) => f.type === "image" && f.image_url
|
|
2946
|
+
), c = (v = t.attachments) == null ? void 0 : v.find(
|
|
2947
|
+
(f) => f.type === "audio" && f.asset_url
|
|
2948
|
+
), x = (m = t.attachments) == null ? void 0 : m.find(
|
|
2949
|
+
(f) => f.type === "file" && f.asset_url
|
|
2950
|
+
), u = d ?? r ?? c ?? x, g = (d == null ? void 0 : d.asset_url) ?? (r == null ? void 0 : r.image_url) ?? (c == null ? void 0 : c.asset_url) ?? (x == null ? void 0 : x.asset_url), h = (u == null ? void 0 : u.mime_type) ?? ((u == null ? void 0 : u.type) === "image" ? "image/jpeg" : (u == null ? void 0 : u.type) === "video" ? "video/mp4" : (u == null ? void 0 : u.type) === "audio" ? "audio/mpeg" : "application/octet-stream");
|
|
2951
|
+
if (!l && !g) return null;
|
|
2952
|
+
const N = g ? Ye(h) : null, a = u == null ? void 0 : u.title, _ = u == null ? void 0 : u.file_size, w = d == null ? void 0 : d.thumb_url, p = h === "application/pdf", E = s ? "str-chat__message str-chat__message-simple str-chat__message--me str-chat__message-simple--me" : "str-chat__message str-chat__message-simple str-chat__message--other", S = N === "image" || N === "video" || p;
|
|
2953
|
+
return /* @__PURE__ */ i(se, { children: [
|
|
2954
|
+
/* @__PURE__ */ i("div", { className: E, children: [
|
|
2955
|
+
!s && t.user && /* @__PURE__ */ e(
|
|
2956
|
+
oe,
|
|
2957
|
+
{
|
|
2958
|
+
className: "str-chat__avatar str-chat__message-sender-avatar",
|
|
2959
|
+
id: t.user.id,
|
|
2960
|
+
image: t.user.image,
|
|
2961
|
+
name: t.user.name ?? t.user.id
|
|
2962
|
+
}
|
|
2963
|
+
),
|
|
2964
|
+
/* @__PURE__ */ e(
|
|
2965
|
+
"div",
|
|
2966
|
+
{
|
|
2967
|
+
className: "str-chat__message-inner",
|
|
2968
|
+
style: { marginInlineEnd: 0, marginInlineStart: 0 },
|
|
2969
|
+
children: /* @__PURE__ */ e("div", { className: "str-chat__message-bubble-wrapper", children: /* @__PURE__ */ e(
|
|
2970
|
+
"div",
|
|
2971
|
+
{
|
|
2972
|
+
className: "str-chat__message-bubble",
|
|
2973
|
+
style: { padding: 0, borderRadius: 0, overflow: "visible", background: "transparent" },
|
|
2974
|
+
children: /* @__PURE__ */ e("div", { className: Bn(s), children: l ? /* @__PURE__ */ e(Wn, { attachment: l, isMyMessage: s }) : N === "image" ? /* @__PURE__ */ i(se, { children: [
|
|
2975
|
+
/* @__PURE__ */ e(
|
|
2976
|
+
"button",
|
|
2977
|
+
{
|
|
2978
|
+
type: "button",
|
|
2979
|
+
onClick: () => o(!0),
|
|
2980
|
+
className: "block w-full cursor-zoom-in",
|
|
2981
|
+
children: /* @__PURE__ */ e("img", { src: g, alt: a ?? "", className: "block w-full" })
|
|
2982
|
+
}
|
|
2983
|
+
),
|
|
2984
|
+
/* @__PURE__ */ e(
|
|
2985
|
+
Me,
|
|
2986
|
+
{
|
|
2987
|
+
mimeType: h,
|
|
2988
|
+
title: a,
|
|
2989
|
+
fileSize: _,
|
|
2990
|
+
url: g,
|
|
2991
|
+
isMyMessage: s
|
|
2992
|
+
}
|
|
2993
|
+
)
|
|
2994
|
+
] }) : N === "video" ? /* @__PURE__ */ i(se, { children: [
|
|
2995
|
+
/* @__PURE__ */ e(
|
|
2996
|
+
Ve,
|
|
2997
|
+
{
|
|
2998
|
+
source: g,
|
|
2999
|
+
mimeType: h,
|
|
3000
|
+
poster: w,
|
|
3001
|
+
controls: !0,
|
|
3002
|
+
onContainerClick: () => o(!0)
|
|
3003
|
+
}
|
|
3004
|
+
),
|
|
3005
|
+
/* @__PURE__ */ e(
|
|
3006
|
+
Me,
|
|
3007
|
+
{
|
|
3008
|
+
mimeType: h,
|
|
3009
|
+
title: a,
|
|
3010
|
+
fileSize: _,
|
|
3011
|
+
url: g,
|
|
3012
|
+
isMyMessage: s
|
|
3013
|
+
}
|
|
3014
|
+
)
|
|
3015
|
+
] }) : N === "audio" ? /* @__PURE__ */ i(se, { children: [
|
|
3016
|
+
/* @__PURE__ */ e(
|
|
3017
|
+
Ve,
|
|
3018
|
+
{
|
|
3019
|
+
source: g,
|
|
3020
|
+
mimeType: h,
|
|
3021
|
+
controls: !0
|
|
3022
|
+
}
|
|
3023
|
+
),
|
|
3024
|
+
/* @__PURE__ */ e(
|
|
3025
|
+
Me,
|
|
3026
|
+
{
|
|
3027
|
+
mimeType: h,
|
|
3028
|
+
title: a,
|
|
3029
|
+
fileSize: _,
|
|
3030
|
+
url: g,
|
|
3031
|
+
isMyMessage: s
|
|
3032
|
+
}
|
|
3033
|
+
)
|
|
3034
|
+
] }) : (
|
|
3035
|
+
// document: PDF gets viewer, unknown gets link-only thumbnail
|
|
3036
|
+
/* @__PURE__ */ e(
|
|
3037
|
+
Yn,
|
|
3038
|
+
{
|
|
3039
|
+
url: g,
|
|
3040
|
+
mimeType: h,
|
|
3041
|
+
title: a,
|
|
3042
|
+
fileSize: _,
|
|
3043
|
+
isMyMessage: s,
|
|
3044
|
+
onExpand: p ? () => o(!0) : void 0
|
|
3045
|
+
}
|
|
3046
|
+
)
|
|
3047
|
+
) })
|
|
3048
|
+
}
|
|
3049
|
+
) })
|
|
3050
|
+
}
|
|
3051
|
+
)
|
|
3052
|
+
] }),
|
|
3053
|
+
n && S && g && /* @__PURE__ */ e(
|
|
3054
|
+
qn,
|
|
3055
|
+
{
|
|
3056
|
+
sourceType: N,
|
|
3057
|
+
url: g,
|
|
3058
|
+
mimeType: h,
|
|
3059
|
+
title: a,
|
|
3060
|
+
poster: w,
|
|
3061
|
+
onClose: () => o(!1)
|
|
3062
|
+
}
|
|
3063
|
+
)
|
|
3064
|
+
] });
|
|
3065
|
+
}, la = (t, s = {}) => {
|
|
3066
|
+
const { initialSearch: n = "", pageSize: o = 20 } = s, [l, d] = I([]), [r, c] = I(!1), [x, u] = I(null), [g, h] = I(n), [N, a] = I(!0), [_, w] = I(), p = A(async (k = !1, P) => {
|
|
3067
|
+
if (r) return;
|
|
3068
|
+
const v = P !== void 0 ? P : g;
|
|
3069
|
+
c(!0), u(null);
|
|
3070
|
+
try {
|
|
3071
|
+
const m = await t.loadParticipants({
|
|
3072
|
+
search: v || void 0,
|
|
3073
|
+
limit: o,
|
|
3074
|
+
cursor: k ? void 0 : _
|
|
3075
|
+
});
|
|
3076
|
+
d(
|
|
3077
|
+
(f) => k ? m.participants : [...f, ...m.participants]
|
|
3078
|
+
), a(m.hasMore), w(m.nextCursor);
|
|
3079
|
+
} catch (m) {
|
|
3080
|
+
const f = m instanceof Error ? m.message : "Failed to load participants";
|
|
3081
|
+
u(f), console.error("[useParticipants] Load error:", m);
|
|
3082
|
+
} finally {
|
|
3083
|
+
c(!1);
|
|
3084
|
+
}
|
|
3085
|
+
}, [t, g, _, o, r]), E = A(() => {
|
|
3086
|
+
N && !r && p(!1);
|
|
3087
|
+
}, [N, r, p]), S = A((k) => {
|
|
3088
|
+
h(k), w(void 0), p(!0, k);
|
|
3089
|
+
}, [p]), C = A(() => {
|
|
3090
|
+
w(void 0), p(!0);
|
|
3091
|
+
}, [p]);
|
|
3092
|
+
return q(() => {
|
|
3093
|
+
p(!0);
|
|
3094
|
+
}, [t.loadParticipants]), {
|
|
3095
|
+
participants: l,
|
|
3096
|
+
loading: r,
|
|
3097
|
+
error: x,
|
|
3098
|
+
searchQuery: g,
|
|
3099
|
+
hasMore: N,
|
|
3100
|
+
totalCount: t.totalCount,
|
|
3101
|
+
loadMore: E,
|
|
3102
|
+
search: S,
|
|
3103
|
+
refresh: C
|
|
3104
|
+
};
|
|
3105
|
+
};
|
|
3106
|
+
export {
|
|
3107
|
+
ke as A,
|
|
3108
|
+
Sn as C,
|
|
3109
|
+
ra as F,
|
|
3110
|
+
at as L,
|
|
3111
|
+
Ve as M,
|
|
3112
|
+
Dn as P,
|
|
3113
|
+
oe as a,
|
|
3114
|
+
vt as b,
|
|
3115
|
+
_t as c,
|
|
3116
|
+
na as d,
|
|
3117
|
+
Ln as e,
|
|
3118
|
+
oa as f,
|
|
3119
|
+
Ye as g,
|
|
3120
|
+
on as h,
|
|
3121
|
+
sa as i,
|
|
3122
|
+
aa as j,
|
|
3123
|
+
Os as k,
|
|
3124
|
+
Xs as l,
|
|
3125
|
+
Ls as m,
|
|
3126
|
+
la as n,
|
|
3127
|
+
We as r,
|
|
3128
|
+
nn as u
|
|
3129
|
+
};
|
|
3130
|
+
//# sourceMappingURL=index-Ydi1pTAi.js.map
|