@sendbird/ai-agent-messenger-react 1.2.7 → 1.3.1

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.
@@ -0,0 +1,4103 @@
1
+ import * as r from "react";
2
+ import { createContext as ve, useContext as Q, useEffect as L, useState as _, useId as bn, useRef as N, useCallback as R, useMemo as ae, forwardRef as ye, useImperativeHandle as Er, useLayoutEffect as le, lazy as T, Suspense as ke, Component as xr, Fragment as Ut, useReducer as Cr, Children as vr } from "react";
3
+ import yr, { SendbirdProduct as _r, DeviceOsPlatform as Ht, SendbirdPlatform as Sr, ConnectionHandler as Je, SendbirdError as Tr, SessionHandler as wr, LogLevel as En, ConnectionState as Ar } from "@sendbird/chat";
4
+ import u, { css as I, ThemeProvider as kr, useTheme as xt, createGlobalStyle as Ir, StyleSheetManager as $r, keyframes as xn } from "styled-components";
5
+ import { format as Cn, isSameMinute as zt, isSameDay as Mr } from "date-fns";
6
+ import { enUS as Or } from "date-fns/locale/en-US";
7
+ import { AIAgentModule as Lr, ConversationStatus as W, ConversationType as Rr } from "@sendbird/chat/aiAgent";
8
+ import { useGroupChannelMessages as Dr, useGroupChannelHandler as Xe, useForceUpdate as Nr } from "@sendbird/uikit-tools";
9
+ import { GroupChannelModule as Pr, GroupChannelListOrder as vn, GroupChannelHandler as Br } from "@sendbird/chat/groupChannel";
10
+ import { renderer as Fr, parser as Ur, MessageProvider as Hr } from "@sendbird/react-uikit-message-template-view";
11
+ import { createMessageTemplate as zr } from "@sendbird/uikit-message-template";
12
+ import yn from "dompurify";
13
+ import { SendingStatus as dt, MessageMetaArray as Vr } from "@sendbird/chat/message";
14
+ import { isSameDay as Wr } from "date-fns/isSameDay";
15
+ import { createPortal as Gr } from "react-dom";
16
+ import jr from "@emotion/is-prop-valid";
17
+ const G = (e, t) => {
18
+ const n = ve(null), o = ({ children: a, value: l }) => /* @__PURE__ */ r.createElement(n.Provider, { value: l }, typeof a == "function" ? a(l) : a), s = ({ children: a }) => /* @__PURE__ */ r.createElement(n.Consumer, null, (l) => l ? typeof a == "function" ? a(l) : a : null), i = () => {
19
+ const a = Q(n);
20
+ if (!a)
21
+ throw new Error(`use${e}Context must be used within a ${e}Provider`);
22
+ return a;
23
+ };
24
+ return n.displayName = `${e}Context`, o.displayName = `${e}Provider`, s.displayName = `${e}Consumer`, i.displayName = `use${e}Context`, { Context: n, Provider: o, Consumer: s, useContext: i };
25
+ };
26
+ function _e(e) {
27
+ const t = ve({
28
+ Template: e.template,
29
+ updateTemplate: () => {
30
+ },
31
+ components: e.components,
32
+ updateComponent: () => {
33
+ }
34
+ });
35
+ function n({ children: i }) {
36
+ const [a, l] = _(() => e.template), [c, d] = _(e.components), h = {
37
+ Template: a,
38
+ updateTemplate: (m) => l(() => m),
39
+ components: c,
40
+ updateComponent: (m, f) => d((x) => ({ ...x, [m]: f }))
41
+ };
42
+ return /* @__PURE__ */ r.createElement(t.Provider, { value: h }, i);
43
+ }
44
+ function o({ template: i, children: a }) {
45
+ const { updateTemplate: l } = Q(t);
46
+ return L(() => {
47
+ i && l(i);
48
+ }, [i]), /* @__PURE__ */ r.createElement(r.Fragment, null, a);
49
+ }
50
+ function s({ children: i }) {
51
+ return /* @__PURE__ */ r.createElement(n, null, i);
52
+ }
53
+ return s.defaults = e, s.useContext = () => Q(t), s.Context = t, s.Template = o, Object.keys(e.components).forEach((i) => {
54
+ s[i] = function({
55
+ component: l
56
+ }) {
57
+ const { updateComponent: c } = Q(t);
58
+ return L(() => {
59
+ l && c(i, l);
60
+ }, [l]), null;
61
+ };
62
+ }), s;
63
+ }
64
+ function Kr(...e) {
65
+ return function({ children: n }) {
66
+ return e.reduce((o, s) => /* @__PURE__ */ r.createElement(s, null, o), n);
67
+ };
68
+ }
69
+ function ut() {
70
+ }
71
+ function Zr() {
72
+ const e = /iPad|iPhone|iPod/.test(navigator.userAgent), t = /Android/.test(navigator.userAgent);
73
+ return e || t;
74
+ }
75
+ function Yr(e) {
76
+ let t = 0;
77
+ for (let n = 0; n < e.length; n++)
78
+ t = (t << 5) - t + e.charCodeAt(n), t |= 0;
79
+ return t.toString(16);
80
+ }
81
+ const Vt = (e) => {
82
+ try {
83
+ return JSON.parse(e === "" ? "{}" : e);
84
+ } catch {
85
+ return {};
86
+ }
87
+ }, Se = {
88
+ isStreaming(e) {
89
+ const t = Vt(e.data);
90
+ return typeof t == "object" && !!t.stream;
91
+ },
92
+ isWelcomeMessage(e, t) {
93
+ var n;
94
+ if (((n = e.extendedMessagePayload) == null ? void 0 : n.bot_message_type) === "welcome")
95
+ return !0;
96
+ if ((e.isUserMessage() || e.isFileMessage()) && e.sender.userId === t) {
97
+ const o = Vt(e.data);
98
+ return !(o != null && o.respond_mesg_id) && !(o != null && o.stream);
99
+ }
100
+ return !1;
101
+ },
102
+ isGeneratedMessage(e) {
103
+ var t;
104
+ return ((t = e.extendedMessagePayload) == null ? void 0 : t.bot_message_type) === "generated";
105
+ },
106
+ checkExtendedFieldPresence(e) {
107
+ const t = e.extendedMessagePayload || {}, n = (a) => a.some((l) => typeof t[l] < "u"), o = n(ot.ui), s = n(ot.trail), i = n(ot.marking);
108
+ return { ui: o, trail: s, marking: i };
109
+ },
110
+ shouldScrollToBottom(e, t, n = !1) {
111
+ if ((e.isUserMessage() || e.isFileMessage() || e.isMultipleFilesMessage()) && e.sender.userId === t) {
112
+ if (this.isGeneratedMessage(e) && this.isStreaming(e))
113
+ return !0;
114
+ const { ui: i, trail: a, marking: l } = this.checkExtendedFieldPresence(e);
115
+ return i ? !(!n && l) : !!(n && (a || l));
116
+ }
117
+ return !0;
118
+ }
119
+ }, ot = {
120
+ ui: ["suggested_replies", "cta_button", "message_template", "csat"],
121
+ trail: ["groundedness", "manual", "function_calls"],
122
+ marking: ["is_hallucination", "is_moderated", "flagged_types"]
123
+ }, qr = "1.3.1", Ee = "sb-agent", Jr = qr, st = `@${Ee}`, Wt = ({ appId: e, aiAgentId: t, storage: n }) => {
124
+ const o = {
125
+ templateBase: `${st}-template`,
126
+ template: (s) => `${o.templateBase}/templates/${s}`,
127
+ templateToken: () => `${o.templateBase}-template/message-template/tokens`,
128
+ messengerSession: (s) => {
129
+ const i = Yr(`${e}/${t}/${s}`);
130
+ return `${st}-udata/${i}`;
131
+ },
132
+ anonUserSession: () => `${st}-session/${e}/${t}`
133
+ };
134
+ return {
135
+ template: {
136
+ set: (s, i) => n.set(o.template(s), i),
137
+ get: (s) => n.get(o.template(s)),
138
+ setCachedToken: (s) => n.set(o.templateToken(), s),
139
+ getCachedToken: () => n.get(o.templateToken()),
140
+ clear: () => {
141
+ n.getKeys(o.templateBase).forEach(n.delete);
142
+ }
143
+ },
144
+ messenger: {
145
+ getSettings: (s) => {
146
+ try {
147
+ const i = n.get(o.messengerSession(s));
148
+ return i ? JSON.parse(i) : null;
149
+ } catch {
150
+ return null;
151
+ }
152
+ },
153
+ setSettings: (s, i) => {
154
+ try {
155
+ const a = JSON.stringify(i);
156
+ n.set(o.messengerSession(s), a);
157
+ } catch {
158
+ return;
159
+ }
160
+ },
161
+ getAnonUser: () => {
162
+ try {
163
+ const s = n.get(o.anonUserSession());
164
+ return s ? JSON.parse(s) : null;
165
+ } catch {
166
+ return null;
167
+ }
168
+ },
169
+ setAnonUser: (s) => {
170
+ try {
171
+ const i = JSON.stringify(s);
172
+ n.set(o.anonUserSession(), i);
173
+ } catch {
174
+ return;
175
+ }
176
+ },
177
+ clear: (s) => {
178
+ try {
179
+ n.delete(o.messengerSession(s)), n.delete(o.anonUserSession());
180
+ } catch {
181
+ return;
182
+ }
183
+ }
184
+ }
185
+ };
186
+ };
187
+ class _n {
188
+ constructor(t) {
189
+ this.logger = t, this.subscribers = {};
190
+ }
191
+ async send(t) {
192
+ const n = Xr(), o = this.subscribers[t.type];
193
+ if (o) {
194
+ this.logger.debug(`messenger.dispatcher: dispatching command: ${t.type}`, t.payload);
195
+ const s = o.map((i) => i(t.payload));
196
+ await Promise.all(s).catch((i) => {
197
+ this.logger.error(`messenger.dispatcher: error in callback for command: ${t.type}`, i);
198
+ });
199
+ }
200
+ return n.resolve(), n.promise;
201
+ }
202
+ subscribe(t, n) {
203
+ this.subscribers[t] || (this.subscribers[t] = []), this.subscribers[t].push(n);
204
+ }
205
+ unsubscribe(t, n) {
206
+ this.subscribers[t] && (this.subscribers[t] = this.subscribers[t].filter((o) => o !== n));
207
+ }
208
+ }
209
+ const Xr = () => {
210
+ let e = ut, t = ut;
211
+ return { promise: new Promise((o, s) => {
212
+ e = o, t = s;
213
+ }), resolve: e, reject: t };
214
+ };
215
+ var Sn = /* @__PURE__ */ ((e) => (e[e.VERBOSE = 0] = "VERBOSE", e[e.DEBUG = 1] = "DEBUG", e[e.INFO = 2] = "INFO", e[e.WARN = 3] = "WARN", e[e.ERROR = 4] = "ERROR", e[e.NONE = 5] = "NONE", e))(Sn || {});
216
+ class Tn {
217
+ constructor(t) {
218
+ this.level = t;
219
+ }
220
+ verbose(...t) {
221
+ this.level <= 0 && console.log(`[${Ee}/verbose]`, ...t);
222
+ }
223
+ debug(...t) {
224
+ this.level <= 1 && console.log(`[${Ee}/debug]`, ...t);
225
+ }
226
+ info(...t) {
227
+ this.level <= 2 && console.log(`[${Ee}/info]`, ...t);
228
+ }
229
+ warn(...t) {
230
+ this.level <= 3 && console.warn(`[${Ee}/warn]`, ...t);
231
+ }
232
+ error(...t) {
233
+ this.level <= 4 && console.error(`[${Ee}/error]`, ...t);
234
+ }
235
+ }
236
+ function Gt(e, t, n) {
237
+ const o = yr.init({
238
+ appId: e,
239
+ modules: [new Pr(), new Lr()],
240
+ localCacheEnabled: !0,
241
+ ...n
242
+ });
243
+ return o.addSendbirdExtensions(
244
+ [{ version: Jr, product: _r.AI_AGENT, platform: t.platform }],
245
+ { platform: t.deviceOSPlatform, version: t.deviceOSVersion },
246
+ t.customData
247
+ ) || console.warn("Invalid Sendbird Extensions", t), o;
248
+ }
249
+ const {
250
+ Provider: Qr,
251
+ useContext: ue
252
+ } = G("AIAgent");
253
+ function eo({
254
+ appId: e,
255
+ aiAgentId: t,
256
+ keyValueStorage: n,
257
+ language: o,
258
+ countryCode: s,
259
+ context: i,
260
+ queryParams: a,
261
+ chatSDK: l,
262
+ chatParams: c,
263
+ children: d,
264
+ logger: h,
265
+ dispatcher: m,
266
+ extensions: f = {
267
+ platform: Sr.JS,
268
+ deviceOSPlatform: Zr() ? Ht.MOBILE_WEB : Ht.WEB
269
+ }
270
+ }) {
271
+ const [x, E] = _(() => {
272
+ const b = h ?? new Tn(Sn.WARN), g = m ?? new _n(b);
273
+ return {
274
+ appId: e,
275
+ aiAgentId: t,
276
+ language: o,
277
+ countryCode: s,
278
+ context: i,
279
+ queryParams: a,
280
+ keyValueStorage: n,
281
+ logger: b,
282
+ dispatcher: g,
283
+ chatSDK: l ?? Gt(e, f, c),
284
+ cache: Wt({ appId: e, aiAgentId: t, storage: n })
285
+ };
286
+ });
287
+ return L(() => {
288
+ E((b) => {
289
+ let g = b.logger, C = b.dispatcher, v = b.chatSDK;
290
+ return h && h !== b.logger && (g = h), m && m !== b.dispatcher && (C = m), l && l !== b.chatSDK ? v = l : !l && b.chatSDK.appId !== e && (v = Gt(e, f, { newInstance: !0, ...c })), {
291
+ ...b,
292
+ appId: e,
293
+ aiAgentId: t,
294
+ keyValueStorage: n,
295
+ language: o,
296
+ countryCode: s,
297
+ context: i,
298
+ queryParams: a,
299
+ logger: g,
300
+ dispatcher: C,
301
+ chatSDK: v,
302
+ cache: Wt({ appId: e, aiAgentId: t, storage: n })
303
+ };
304
+ });
305
+ }, [e, t, o, s, i, h, m, l]), L(() => () => {
306
+ x.chatSDK.disconnectWebSocket();
307
+ }, [x.chatSDK]), /* @__PURE__ */ r.createElement(Qr, { value: x }, d);
308
+ }
309
+ const to = (e, t, n) => Dr(e, t, { ...n, strictStreamingOrder: !0 });
310
+ var mt = /* @__PURE__ */ ((e) => (e.ConversationClose = "conv.close", e))(mt || {});
311
+ class no {
312
+ constructor(t = {}) {
313
+ this.payload = t;
314
+ }
315
+ toJSON() {
316
+ return JSON.stringify({ type: this.type, payload: this.payload });
317
+ }
318
+ }
319
+ const ro = {
320
+ CloseConversation: (e) => new oo(e)
321
+ };
322
+ class oo extends no {
323
+ constructor() {
324
+ super(...arguments), this.type = "conv.close";
325
+ }
326
+ }
327
+ const {
328
+ Provider: so
329
+ } = G("AIAgentConversation");
330
+ function io({
331
+ children: e,
332
+ channelUrl: t,
333
+ onChannelDeleted: n,
334
+ onMessagesReceived: o,
335
+ onMessagesUpdated: s,
336
+ onConversationClosedViaDispatcher: i,
337
+ onBeforeSendMessage: a,
338
+ onAfterSendMessage: l = ut
339
+ }) {
340
+ var g;
341
+ const { chatSDK: c, logger: d, dispatcher: h } = ue(), { channel: m, channelFetchError: f, fetchChannel: x } = ao(t), E = to(c, m, {
342
+ shouldCountNewMessages: () => !1,
343
+ onChannelDeleted: n,
344
+ onMessagesReceived: (C) => o == null ? void 0 : o(C),
345
+ onMessagesUpdated: (C) => s == null ? void 0 : s(C),
346
+ logger: d
347
+ });
348
+ L(() => {
349
+ const C = async (v) => {
350
+ const S = typeof (v == null ? void 0 : v.channelUrl) == "string";
351
+ m && S && v.channelUrl !== m.url || (d.debug("conversation.dispatcher: try to close conversation", m), m != null && m.conversation && m.conversation.status === W.OPEN && (await m.closeConversation(), i == null || i()));
352
+ };
353
+ return h.subscribe(mt.ConversationClose, C), () => {
354
+ h.unsubscribe(mt.ConversationClose, C);
355
+ };
356
+ }, [h, (g = m == null ? void 0 : m.conversation) == null ? void 0 : g.status, i]);
357
+ const b = {
358
+ conversation: (m == null ? void 0 : m.conversation) ?? void 0,
359
+ channelSource: {
360
+ channel: m,
361
+ error: f,
362
+ refetch: () => x()
363
+ },
364
+ messageSource: {
365
+ messages: E.messages,
366
+ initialized: E.initialized,
367
+ loadPrevious: () => E.loadPrevious(),
368
+ loadNext: () => E.loadNext(),
369
+ sendUserMessage: async (C) => {
370
+ var S;
371
+ if (((S = m == null ? void 0 : m.conversation) == null ? void 0 : S.status) === W.CLOSED)
372
+ throw new Error("Conversation is closed");
373
+ a && (C = await a(C));
374
+ const v = await E.sendUserMessage(C, l);
375
+ return l == null || l(v), v;
376
+ },
377
+ sendFileMessage: async (C) => {
378
+ var S;
379
+ if (((S = m == null ? void 0 : m.conversation) == null ? void 0 : S.status) === W.CLOSED)
380
+ throw new Error("Conversation is closed");
381
+ a && (C = await a(C));
382
+ const v = await E.sendFileMessage(C, l);
383
+ return l == null || l(v), v;
384
+ }
385
+ }
386
+ };
387
+ return /* @__PURE__ */ r.createElement(so, { value: b }, e);
388
+ }
389
+ function ao(e) {
390
+ const { chatSDK: t, logger: n } = ue(), [o, s] = _(void 0), [i, a] = _(void 0);
391
+ async function l() {
392
+ if (n.debug("conversation.fetchChannel: start"), s(void 0), a(void 0), e)
393
+ try {
394
+ n.debug("conversation.fetchChannel: get channel", e);
395
+ const c = await t.groupChannel.getChannel(e);
396
+ s(c);
397
+ const d = new Je({ onReconnectSucceeded: () => c.refresh() });
398
+ t.addConnectionHandler(`sba-refresh-${e}`, d), n.debug("conversation.fetchChannel: fetched channel", c);
399
+ } catch (c) {
400
+ c instanceof Tr && a(c), n.error("conversation.fetchChannel: error", c);
401
+ }
402
+ }
403
+ return L(() => {
404
+ l();
405
+ }, [e, t]), {
406
+ channel: o,
407
+ channelFetchError: i,
408
+ fetchChannel: l
409
+ };
410
+ }
411
+ class lo {
412
+ /**
413
+ * Creates a new ConversationListCollection instance.
414
+ * @param sdk - The Sendbird Chat SDK instance
415
+ * @param params - Configuration parameters for the collection
416
+ */
417
+ constructor(t, { filter: n, limit: o = 20 }) {
418
+ var s, i, a, l, c;
419
+ this._isDisposed = !1, this._handlerId = `handler-id-${Date.now()}`, this._order = vn.LATEST_LAST_MESSAGE, this.filter = n, this._sdk = t, this._pinnedChannels = [], this._channels = [], this._limit = o, this._query = this._sdk.aiAgent.createMyGroupChannelListQuery({
420
+ aiAgentChannelFilter: (s = this.filter) == null ? void 0 : s.aiAgentChannelFilter,
421
+ aiAgentConversationStatusFilter: (i = this.filter) == null ? void 0 : i.aiAgentConversationStatusFilter,
422
+ aiAgentIds: (a = this.filter) == null ? void 0 : a.aiAgentIds,
423
+ deskChannelFilter: (l = this.filter) == null ? void 0 : l.deskChannelFilter,
424
+ pinnedChannelUrls: (c = this.filter) == null ? void 0 : c.pinnedChannelUrls,
425
+ limit: this._limit
426
+ }), this._token = "", this._timestamp = Number.MAX_SAFE_INTEGER, this._isSyncing = !1, this._channelHandler = new Br({
427
+ onChannelChanged: (d) => {
428
+ d.isGroupChannel() && (this._query.belongsTo(d) ? this._addChannelsToView([d], !1) : this._removeChannelsFromView([d.url]));
429
+ },
430
+ onChannelDeleted: (d) => {
431
+ this._removeChannelsFromView([d]);
432
+ }
433
+ }), this._connectionHandler = new Je({
434
+ onReconnectSucceeded: () => {
435
+ this._isDefaultChangelogSyncTimestampUpdated && this._syncChannelChangelogs();
436
+ }
437
+ }), this._sdk.addConnectionHandler(this._handlerId, this._connectionHandler), this._sdk.groupChannel.addGroupChannelHandler(this._handlerId, this._channelHandler);
438
+ }
439
+ /**
440
+ * Checks if the default changelog sync timestamp has been updated.
441
+ */
442
+ get _isDefaultChangelogSyncTimestampUpdated() {
443
+ return this._timestamp !== Number.MAX_SAFE_INTEGER;
444
+ }
445
+ /**
446
+ * Sets the default changelog sync timestamp based on the first non-pinned channel.
447
+ * @param channels - Array of channels to analyze
448
+ */
449
+ _setDefaultChangelogsSyncTimestamp(t) {
450
+ var i, a;
451
+ const n = new Set(((i = this.filter) == null ? void 0 : i.pinnedChannelUrls) ?? []), o = t.find((l) => !n.has(l.url));
452
+ let s;
453
+ o ? s = ((a = o.lastMessage) == null ? void 0 : a.createdAt) ?? o.createdAt : s = this._query.lastResponseAt, this._timestamp > s && (this._timestamp = s);
454
+ }
455
+ /**
456
+ * Synchronizes channel changelogs to keep the collection up-to-date.
457
+ * @returns Promise that resolves to an empty array
458
+ */
459
+ async _syncChannelChangelogs() {
460
+ if (this._isDisposed) return [];
461
+ if (this._isSyncing) return [];
462
+ try {
463
+ this._isSyncing = !0;
464
+ let t;
465
+ for (this._token ? t = await this._sdk.aiAgent.getMyGroupChannelChangeLogsByToken(this._token, this.filter) : t = await this._sdk.aiAgent.getMyGroupChannelChangeLogsByTimestamp(this._timestamp, this.filter), this._token = t.token, this._addChannelsToView(t.updatedChannels), this._removeChannelsFromView(t.deletedChannelUrls); t.hasMore && t.token; )
466
+ t = await this._sdk.aiAgent.getMyGroupChannelChangeLogsByToken(this._token, this.filter), this._token = t.token, this._addChannelsToView(t.updatedChannels), this._removeChannelsFromView(t.deletedChannelUrls);
467
+ } catch {
468
+ } finally {
469
+ this._isSyncing = !1;
470
+ }
471
+ return [];
472
+ }
473
+ /**
474
+ * Upserts pinned channels maintaining the order specified in pinnedChannelUrls.
475
+ * @param channels - Pinned channels to upsert
476
+ * @returns Object containing added, updated channels and unmatched URLs
477
+ */
478
+ _upsertPinnedChannelsToArray(t) {
479
+ var l;
480
+ const n = ((l = this.filter) == null ? void 0 : l.pinnedChannelUrls) ?? [], o = new Map(n.map((c, d) => [c, d])), s = [], i = [], a = [];
481
+ for (const c of t) {
482
+ if (!this._query.belongsTo(c)) {
483
+ a.push(c.url);
484
+ continue;
485
+ }
486
+ const d = o.get(c.url);
487
+ if (d === void 0) continue;
488
+ const h = gt(this._pinnedChannels, c);
489
+ h >= 0 ? (this._pinnedChannels.splice(h, 1), i.push(c)) : s.push(c);
490
+ const f = this._pinnedChannels.findIndex((E) => (o.get(E.url) ?? 1 / 0) > d), x = f === -1 ? this._pinnedChannels.length : f;
491
+ this._pinnedChannels.splice(x, 0, c);
492
+ }
493
+ return { addedChannels: s, updatedChannels: i, unmatchedChannelUrls: a };
494
+ }
495
+ /**
496
+ * Upserts regular (non-pinned) channels with time-based sorting.
497
+ * @param channels - Regular channels to upsert
498
+ * @param forceAppend - Whether to force append channels at the end regardless of hasMore status
499
+ * @returns Object containing added, updated channels and unmatched URLs
500
+ */
501
+ _upsertRegularChannelsToArray(t, n = !1) {
502
+ const o = [], s = [], i = [];
503
+ for (const a of t) {
504
+ if (!this._query.belongsTo(a)) {
505
+ o.push(a.url);
506
+ continue;
507
+ }
508
+ const l = gt(this._channels, a), c = l < 0;
509
+ !c && this._channels.splice(l, 1);
510
+ const h = co(this._channels, a, this._order).place, m = h === this._channels.length;
511
+ c ? m ? (n || !this.hasMore) && (this._channels.push(a), s.push(a)) : (this._channels.splice(h, 0, a), s.push(a)) : (this._channels.splice(h, 0, a), i.push(a));
512
+ }
513
+ return { addedChannels: s, updatedChannels: i, unmatchedChannelUrls: o };
514
+ }
515
+ /**
516
+ * Adds or updates channels in the collection, separating pinned and non-pinned channels.
517
+ * @param channels - Channels to add or update
518
+ * @param forceAppend - Whether to force append channels at the end
519
+ */
520
+ _addChannelsToView(t, n = !1) {
521
+ var m, f, x, E, b;
522
+ const o = new Set(((m = this.filter) == null ? void 0 : m.pinnedChannelUrls) ?? []), s = [], i = [];
523
+ for (const g of t)
524
+ o.has(g.url) ? s.push(g) : i.push(g);
525
+ const a = this._upsertPinnedChannelsToArray(s), l = this._upsertRegularChannelsToArray(i, n), c = a.addedChannels.concat(l.addedChannels), d = a.updatedChannels.concat(l.updatedChannels), h = a.unmatchedChannelUrls.concat(l.unmatchedChannelUrls);
526
+ c.length > 0 && ((x = (f = this._collectionEventHandler) == null ? void 0 : f.onChannelsAdded) == null || x.call(f, {}, c)), d.length > 0 && ((b = (E = this._collectionEventHandler) == null ? void 0 : E.onChannelsUpdated) == null || b.call(E, {}, d)), h.length > 0 && this._removeChannelsFromView(h);
527
+ }
528
+ /**
529
+ * Removes channels from the collection by their URLs.
530
+ * @param channelUrls - Array of channel URLs to remove
531
+ */
532
+ _removeChannelsFromView(t) {
533
+ var s, i, a;
534
+ const n = new Set(((s = this.filter) == null ? void 0 : s.pinnedChannelUrls) ?? []), o = [];
535
+ for (const l of t)
536
+ if (n.has(l)) {
537
+ const c = this._pinnedChannels.findIndex((d) => d.url === l);
538
+ c >= 0 && (o.push(l), this._pinnedChannels.splice(c, 1));
539
+ } else {
540
+ const c = this._channels.findIndex((d) => d.url === l);
541
+ c >= 0 && (o.push(l), this._channels.splice(c, 1));
542
+ }
543
+ o.length > 0 && ((a = (i = this._collectionEventHandler) == null ? void 0 : i.onChannelsDeleted) == null || a.call(i, {}, o));
544
+ }
545
+ /**
546
+ * Gets all channels in the collection.
547
+ * Pinned channels are always returned first, followed by non-pinned channels.
548
+ * @returns Array of GroupChannel objects
549
+ */
550
+ get channels() {
551
+ return this._isDisposed ? [] : [...this._pinnedChannels, ...this._channels];
552
+ }
553
+ /**
554
+ * Indicates whether the collection has more channels to load.
555
+ * @returns True if more channels can be loaded, false otherwise
556
+ */
557
+ get hasMore() {
558
+ return this._isDisposed ? !1 : this._query.hasNext;
559
+ }
560
+ /**
561
+ * Loads the next batch of channels from the server.
562
+ * @returns Promise that resolves to an array of newly loaded channels
563
+ */
564
+ async loadMore() {
565
+ if (this._isDisposed) return [];
566
+ if (this.hasMore) {
567
+ const t = await this._query.next();
568
+ return this._setDefaultChangelogsSyncTimestamp(t), this._addChannelsToView(t, !0), t;
569
+ }
570
+ return [];
571
+ }
572
+ /**
573
+ * Sets the event handler for collection updates.
574
+ * @param handler - Event handler for channel collection changes
575
+ */
576
+ setConversationListCollectionHandler(t) {
577
+ this._collectionEventHandler = t;
578
+ }
579
+ /**
580
+ * Disposes the collection and cleans up all resources.
581
+ * Stops all event handlers and clears all channels.
582
+ */
583
+ dispose() {
584
+ this._isDisposed || (this._isDisposed = !0, this._collectionEventHandler = void 0, this._sdk.removeConnectionHandler(this._handlerId), this._sdk.groupChannel.removeGroupChannelHandler(this._handlerId), this._pinnedChannels.length = 0, this._channels.length = 0);
585
+ }
586
+ }
587
+ const gt = (e, t) => e.findIndex((n) => n.isIdentical(t)), co = (e, t, n) => {
588
+ if (e.length > 0) {
589
+ const o = gt(e, t);
590
+ let s = 0, i = e.length - 1, a = Math.floor((s + i) / 2);
591
+ for (; s < i; ) {
592
+ const c = jt(e[a], t, n);
593
+ if (c > 0)
594
+ i = a, a = Math.floor((s + i) / 2);
595
+ else if (c < 0)
596
+ s = a + 1, a = Math.floor((s + i) / 2);
597
+ else
598
+ return { place: a, oldPosition: o };
599
+ }
600
+ return { place: jt(e[a], t, n) >= 0 ? a : a + 1, oldPosition: o };
601
+ }
602
+ return { place: e.length, oldPosition: -1 };
603
+ }, jt = (e, t, n) => {
604
+ switch (n) {
605
+ case vn.LATEST_LAST_MESSAGE:
606
+ if (e.lastMessage && t.lastMessage) {
607
+ const o = t.lastMessage.createdAt - e.lastMessage.createdAt;
608
+ return o === 0 ? t.createdAt - e.createdAt : o;
609
+ } else return e.lastMessage ? -1 : t.lastMessage ? 1 : t.createdAt - e.createdAt;
610
+ default:
611
+ return 0;
612
+ }
613
+ };
614
+ function uo(e, t) {
615
+ var E, b, g, C, v, S, k, F;
616
+ const n = bn(), [o, s] = _(!1), [i, a] = _(null), [l, c] = _([]), [d, h] = _(null), m = N(!1), f = R(async () => {
617
+ if (!m.current && e.currentUser) {
618
+ m.current = !0, s(!1), a(null), c([]);
619
+ try {
620
+ d == null || d.dispose();
621
+ const $ = new lo(e, t);
622
+ $.setConversationListCollectionHandler({
623
+ onChannelsAdded: () => {
624
+ c($.channels);
625
+ },
626
+ onChannelsUpdated: () => {
627
+ c($.channels);
628
+ },
629
+ onChannelsDeleted: () => {
630
+ c($.channels);
631
+ }
632
+ }), await $.loadMore(), h($), a(null);
633
+ } catch ($) {
634
+ h(null), a($);
635
+ } finally {
636
+ s(!0), m.current = !1;
637
+ }
638
+ }
639
+ }, [
640
+ e,
641
+ (E = t.filter) == null ? void 0 : E.aiAgentChannelFilter,
642
+ (g = (b = t.filter) == null ? void 0 : b.aiAgentConversationStatusFilter) == null ? void 0 : g.join(),
643
+ (v = (C = t.filter) == null ? void 0 : C.aiAgentIds) == null ? void 0 : v.join(),
644
+ (S = t.filter) == null ? void 0 : S.deskChannelFilter,
645
+ (F = (k = t.filter) == null ? void 0 : k.pinnedChannelUrls) == null ? void 0 : F.join(),
646
+ t.limit
647
+ ]), x = R(async () => {
648
+ if (d)
649
+ try {
650
+ await d.loadMore();
651
+ } catch ($) {
652
+ a($);
653
+ }
654
+ }, [d]);
655
+ return L(() => (e.addConnectionHandler(n, new Je({ onConnected: () => f() })), () => e.removeConnectionHandler(n)), [e, n, f]), L(() => {
656
+ f();
657
+ }, [f]), L(() => () => {
658
+ m.current = !1, d == null || d.dispose();
659
+ }, [d]), {
660
+ initialized: o,
661
+ error: i,
662
+ channels: l,
663
+ loadMore: x
664
+ };
665
+ }
666
+ const {
667
+ Provider: mo
668
+ } = G("AIAgentConversationList");
669
+ function go({
670
+ conversationListLimit: e,
671
+ conversationListFilter: t,
672
+ children: n
673
+ }) {
674
+ var m, f;
675
+ const { chatSDK: o, aiAgentId: s, queryParams: i } = ue(), a = { aiAgentIds: [s], aiAgentConversationStatusFilter: [W.CLOSED] }, l = e ?? ((m = i == null ? void 0 : i.conversationListParams) == null ? void 0 : m.limit), c = {
676
+ ...a,
677
+ ...(f = i == null ? void 0 : i.conversationListParams) == null ? void 0 : f.filter,
678
+ ...t
679
+ }, d = uo(o, { limit: l, filter: c }), h = {
680
+ listSource: {
681
+ initialized: d.initialized,
682
+ error: d.error ?? void 0,
683
+ channels: d.channels,
684
+ loadMore: () => d.loadMore()
685
+ }
686
+ };
687
+ return /* @__PURE__ */ r.createElement(mo, { value: h }, n);
688
+ }
689
+ const ht = {
690
+ DEFAULT_BOT_MSG_BG: "#eeeeee",
691
+ WHITE: "#ffffff",
692
+ BLACK: "#000000"
693
+ };
694
+ function wn(e) {
695
+ return e.length === 4 ? `#${[...e.slice(1)].map((t) => t + t).join("")}` : e;
696
+ }
697
+ function ho(e) {
698
+ const t = wn(e);
699
+ return [
700
+ parseInt(t.slice(1, 3), 16),
701
+ // r
702
+ parseInt(t.slice(3, 5), 16),
703
+ // g
704
+ parseInt(t.slice(5, 7), 16)
705
+ // b
706
+ ];
707
+ }
708
+ function po(e) {
709
+ return `#${e.map((t) => t.toString(16).padStart(2, "0")).join("")}`;
710
+ }
711
+ function fo(e, t, n) {
712
+ e /= 255, t /= 255, n /= 255;
713
+ const o = Math.max(e, t, n), s = Math.min(e, t, n), i = o - s;
714
+ let a = 0, l = 0;
715
+ const c = (o + s) / 2;
716
+ return o !== s && (l = c > 0.5 ? i / (2 - o - s) : i / (o + s)), o === e ? a = (t - n) / i + (t < n ? 6 : 0) : o === t ? a = (n - e) / i + 2 : o === n && (a = (e - t) / i + 4), a /= 6, [a, l, c];
717
+ }
718
+ function bo(e, t, n) {
719
+ let o, s, i;
720
+ if (t === 0)
721
+ o = s = i = n;
722
+ else {
723
+ const a = function(h, m, f) {
724
+ return f < 0 && (f += 1), f > 1 && (f -= 1), f < 0.16666666666666666 ? h + (m - h) * 6 * f : f < 0.5 ? m : f < 0.6666666666666666 ? h + (m - h) * (0.6666666666666666 - f) * 6 : h;
725
+ }, l = n < 0.5 ? n * (1 + t) : n + t - n * t, c = 2 * n - l;
726
+ o = a(c, l, e + 1 / 3), s = a(c, l, e), i = a(c, l, e - 1 / 3);
727
+ }
728
+ return [Math.round(o * 255), Math.round(s * 255), Math.round(i * 255)];
729
+ }
730
+ function Be(e, t, n) {
731
+ const [o, s, i] = ho(e), [a, l, c] = fo(o, s, i), d = Math.max(0, Math.min(1, c * t)), h = Math.max(0, Math.min(1, l * n)), [m, f, x] = bo(a, h, d);
732
+ return po([Math.round(m), Math.round(f), Math.round(x)]);
733
+ }
734
+ function Eo(e, t = "light") {
735
+ return {
736
+ extraDark: Be(e, 0.6, 1.2),
737
+ dark: Be(e, 0.85, 1.1),
738
+ main: e,
739
+ light: Be(e, t === "dark" ? 1.1 : 1.5, t === "dark" ? 0.95 : 0.9),
740
+ extraLight: Be(e, t === "dark" ? 1.2 : 1.75, t === "dark" ? 0.9 : 0.8)
741
+ };
742
+ }
743
+ function pt(e) {
744
+ const t = wn(e), n = 149, o = +`0x${t[1]}${t[2]}`, s = +`0x${t[3]}${t[4]}`, i = +`0x${t[5]}${t[6]}`;
745
+ return o * 0.299 + s * 0.587 + i * 0.114 > n ? ht.BLACK : ht.WHITE;
746
+ }
747
+ function xo(e, t, n, o, s) {
748
+ return {
749
+ base: {
750
+ primary: t,
751
+ primaryContrastContent: n,
752
+ background: e.background50,
753
+ headerBackground: e.background50,
754
+ modalContentBackground: e.background50
755
+ },
756
+ metadata: {
757
+ errorContent: e.ondark.textHighEmphasis,
758
+ placeholderText: e.onlight.textLowEmphasis
759
+ },
760
+ messageInput: {
761
+ background: e.background100
762
+ },
763
+ messageIncoming: {
764
+ text: s,
765
+ background: o
766
+ },
767
+ messageOutgoing: {
768
+ text: n,
769
+ background: t
770
+ },
771
+ csat: {
772
+ background: e.background100
773
+ }
774
+ };
775
+ }
776
+ const Co = (e, t, n, o, s) => ({
777
+ base: {
778
+ primary: t,
779
+ primaryContrastContent: n,
780
+ background: e.background600,
781
+ headerBackground: e.background500,
782
+ modalContentBackground: e.background500
783
+ },
784
+ metadata: {
785
+ errorContent: e.ondark.textHighEmphasis,
786
+ placeholderText: e.ondark.textLowEmphasis
787
+ },
788
+ messageInput: {
789
+ background: e.background400
790
+ },
791
+ messageIncoming: {
792
+ text: s,
793
+ background: o
794
+ },
795
+ messageOutgoing: {
796
+ text: n,
797
+ background: t
798
+ },
799
+ csat: {
800
+ background: e.background400
801
+ }
802
+ }), Fe = {
803
+ primary: {
804
+ extraDark: "#491389",
805
+ dark: "#6211c8",
806
+ main: "#742ddd",
807
+ light: "#c2a9fa",
808
+ extraLight: "#dbd1ff"
809
+ },
810
+ secondary: {
811
+ extraDark: "#066858",
812
+ dark: "#027d69",
813
+ main: "#259c72",
814
+ light: "#69c085",
815
+ extraLight: "#a8e2ab"
816
+ },
817
+ error: {
818
+ extraDark: "#9d091e",
819
+ dark: "#bf0711",
820
+ main: "#de360b",
821
+ light: "#f66161",
822
+ extraLight: "#fdaaaa"
823
+ },
824
+ information: {
825
+ extraDark: "#241389",
826
+ dark: "#362ca9",
827
+ main: "#4a48cd",
828
+ light: "#a9bbfa",
829
+ extraLight: "#d1dbff"
830
+ },
831
+ background700: "#000000",
832
+ background600: "#161616",
833
+ background500: "#2c2c2c",
834
+ background400: "#393939",
835
+ background300: "#bdbdbd",
836
+ background200: "#e0e0e0",
837
+ background100: "#eeeeee",
838
+ background50: "#ffffff",
839
+ onlight: {
840
+ textHighEmphasis: "rgba(0, 0, 0, 0.88)",
841
+ textMidEmphasis: "rgba(0, 0, 0, 0.5)",
842
+ textLowEmphasis: "rgba(0, 0, 0, 0.38)",
843
+ textDisabled: "rgba(0, 0, 0, 0.12)"
844
+ },
845
+ ondark: {
846
+ textHighEmphasis: "rgba(255, 255, 255, 0.88)",
847
+ textMidEmphasis: "rgba(255, 255, 255, 0.5)",
848
+ textLowEmphasis: "rgba(255, 255, 255, 0.38)",
849
+ textDisabled: "rgba(255, 255, 255, 0.12)"
850
+ },
851
+ overlay: {
852
+ dark: "rgba(0, 0, 0, 0.55)",
853
+ light: "rgba(22, 22, 22, 0.32)"
854
+ }
855
+ }, it = {
856
+ h1: { fontSize: 18, fontWeight: 700 },
857
+ h2: { fontSize: 16, fontWeight: 700 },
858
+ subtitle1: { fontSize: 16, fontWeight: 500 },
859
+ subtitle2: { fontSize: 16, fontWeight: 400 },
860
+ body1: { fontSize: 16, fontWeight: 400 },
861
+ body2: { fontSize: 14, fontWeight: 500 },
862
+ body3: { fontSize: 14, fontWeight: 400 },
863
+ button: { fontSize: 14, fontWeight: 700 },
864
+ caption1: { fontSize: 12, fontWeight: 700 },
865
+ caption2: { fontSize: 12, fontWeight: 400 },
866
+ caption3: { fontSize: 11, fontWeight: 700 },
867
+ caption4: { fontSize: 11, fontWeight: 400 }
868
+ };
869
+ function Kt(e) {
870
+ const t = vo(e), { colors: n, aiAgentColorVariables: o } = yo(e, t), s = So(e);
871
+ return {
872
+ selectedTheme: e.selectedTheme,
873
+ palette: t,
874
+ colors: n,
875
+ aiAgentColorVariables: o,
876
+ typography: s
877
+ };
878
+ }
879
+ function vo({ selectedTheme: e, palette: t, primary: n }) {
880
+ const o = t != null && t.primary ? t.primary : n ? n === Fe.primary.main ? Fe.primary : Eo(n, e) : Fe.primary;
881
+ return {
882
+ ...Fe,
883
+ primary: o,
884
+ ...t
885
+ };
886
+ }
887
+ function yo({ selectedTheme: e, primaryContrast: t, botMessageBackground: n, botMessageBackgroundContrast: o }, s) {
888
+ const i = s.primary.main, a = t ?? pt(i), l = n ?? ht.DEFAULT_BOT_MSG_BG, c = o ?? pt(l);
889
+ return {
890
+ colors: (e === "light" ? xo : Co)(
891
+ s,
892
+ i,
893
+ a,
894
+ l,
895
+ c
896
+ ),
897
+ aiAgentColorVariables: {
898
+ primary_color: i,
899
+ bot_message_bg_color: l,
900
+ primary_contrast_color: a,
901
+ bot_message_bg_contrast_color: c
902
+ }
903
+ };
904
+ }
905
+ function _o(e, t, n) {
906
+ const o = { ...e };
907
+ return n.forEach((s) => {
908
+ const i = t[s];
909
+ i != null && (o[s] = i);
910
+ }), o;
911
+ }
912
+ function So({ typography: e }) {
913
+ if (!e)
914
+ return it;
915
+ const t = { ...it };
916
+ return Object.keys(e).forEach((n) => {
917
+ const o = e[n];
918
+ if (o && typeof o == "object") {
919
+ const s = it[n], i = ["fontSize", "fontWeight", "fontFamily", "lineHeight"];
920
+ t[n] = _o(s, o, i);
921
+ }
922
+ }), t;
923
+ }
924
+ const {
925
+ Provider: To,
926
+ useContext: Ct
927
+ } = G("AIAgentTheme");
928
+ function wo({ logger: e, palette: t, typography: n, appearance: o, children: s }) {
929
+ const [i, a] = _(
930
+ () => Kt({
931
+ selectedTheme: (o == null ? void 0 : o.theme) ?? "light",
932
+ palette: t,
933
+ typography: n,
934
+ primary: o == null ? void 0 : o.primaryColor,
935
+ botMessageBackground: o == null ? void 0 : o.botMessageBackgroundColor
936
+ })
937
+ ), l = R(
938
+ (c, d) => {
939
+ const h = (o == null ? void 0 : o.theme) ?? c, m = d == null ? void 0 : d(h), f = {
940
+ primary: o == null ? void 0 : o.primaryColor,
941
+ primaryContrast: void 0,
942
+ botMessageBackground: o == null ? void 0 : o.botMessageBackgroundColor,
943
+ botMessageBackgroundContrast: void 0
944
+ };
945
+ !f.primary && (m != null && m.primaryColor) && (f.primary = m.primaryColor, f.primaryContrast = m.primaryContrastColor), !f.botMessageBackground && (m != null && m.botMessageBackgroundColor) && (f.botMessageBackground = m.botMessageBackgroundColor, f.botMessageBackgroundContrast = m.botMessageBackgroundContrastColor);
946
+ const x = Kt({ selectedTheme: h, palette: t, typography: n, ...f });
947
+ a(x), e == null || e.info("theme.update:", h);
948
+ },
949
+ [o == null ? void 0 : o.theme, o == null ? void 0 : o.primaryColor, o == null ? void 0 : o.botMessageBackgroundColor, t, n, e]
950
+ );
951
+ return L(() => {
952
+ (o != null && o.theme || o != null && o.primaryColor || o != null && o.botMessageBackgroundColor) && l(i.selectedTheme);
953
+ }, [o == null ? void 0 : o.theme, o == null ? void 0 : o.primaryColor, o == null ? void 0 : o.botMessageBackgroundColor]), /* @__PURE__ */ r.createElement(To, { value: { theme: i, updateTheme: l } }, s);
954
+ }
955
+ function Ao() {
956
+ const { chatSDK: e, logger: t } = ue(), n = R(
957
+ async (s, i, a) => {
958
+ if (t.debug("useChatConnection.connect: start, session", s.userId), i) {
959
+ const l = new wr({
960
+ ...i,
961
+ onSessionTokenRequired: ko(i.onSessionTokenRequired, a)
962
+ });
963
+ e.setSessionHandler(l);
964
+ }
965
+ await e.connect(s.userId, s.authToken), t.debug("useChatConnection.connect: end, currentUser", e.currentUser);
966
+ },
967
+ [e, t]
968
+ ), o = R(async () => {
969
+ t.debug("useChatConnection.disconnect: start"), await e.disconnect(), t.debug("useChatConnection.disconnect: end");
970
+ }, [e, t]);
971
+ return { connect: n, disconnect: o };
972
+ }
973
+ function ko(e, t) {
974
+ if (e)
975
+ return async (n, o) => {
976
+ new Promise((s, i) => e == null ? void 0 : e(s, i)).then((s) => {
977
+ s && (t == null || t(s)), n(s);
978
+ }).catch((s) => {
979
+ o(s);
980
+ });
981
+ };
982
+ }
983
+ class Io {
984
+ constructor({ userId: t, authToken: n, sessionHandler: o }) {
985
+ this.userId = t, this.authToken = n, this.sessionHandler = o;
986
+ }
987
+ }
988
+ class Zt {
989
+ }
990
+ const $o = 24 * 60 * 60 * 1e3, Mo = (e) => {
991
+ const { logger: t, cache: n } = ue(), o = () => {
992
+ const i = n.messenger.getAnonUser();
993
+ return i ? i.expireAt - $o <= Date.now() ? (t.debug("useUserSessionCandidate.getAnonymousSessionInfo: auto session expired, clear cache"), n.messenger.clear(i.userId), null) : (t.debug("useUserSessionCandidate.getAnonymousSessionInfo: auto session info detected"), i) : null;
994
+ }, s = () => {
995
+ if (!e || e instanceof Zt)
996
+ throw new Error("userSessionInfo must be an instance of ManualSessionInfo");
997
+ const i = ["authToken", "sessionHandler"].filter((a) => !(a in e));
998
+ return i.length > 0 && t.error(
999
+ `useUserSessionCandidate.getManualSessionInfo: missing required keys in userSessionInfo: ${i.join(", ")}`
1000
+ ), t.debug("useUserSessionCandidate.getManualSessionInfo: manual session info detected"), e;
1001
+ };
1002
+ return ae(() => e instanceof Io ? s() : e instanceof Zt ? o() : e && typeof e == "object" ? (t.warn("Please use ManualSessionInfo instead of the old userSessionInfo format."), s()) : e === void 0 ? (t.warn("Please use AnonymousSessionInfo instead of undefined userSessionInfo."), o()) : null, [
1003
+ t,
1004
+ e == null ? void 0 : e.userId,
1005
+ e == null ? void 0 : e.authToken,
1006
+ e == null ? void 0 : e.sessionHandler,
1007
+ n.messenger.getAnonUser,
1008
+ n.messenger.clear
1009
+ ]);
1010
+ };
1011
+ function Oo({
1012
+ userSessionInfo: e,
1013
+ onPreAuth: t,
1014
+ onPostAuth: n,
1015
+ onErrorAuth: o,
1016
+ onAuthTokenRefreshed: s,
1017
+ onPostDeauth: i,
1018
+ forceCreateChannel: a
1019
+ }) {
1020
+ const { aiAgentId: l, chatSDK: c, language: d, context: h, countryCode: m, logger: f, cache: x } = ue(), { connect: E, disconnect: b } = Ao(), g = Mo(e), C = R(async () => {
1021
+ var $;
1022
+ f.debug("useAuthentication.authenticate: start");
1023
+ const S = (g == null ? void 0 : g.userId) && (($ = x.messenger.getSettings(g.userId)) == null ? void 0 : $.knownActiveChannelUrl), k = await c.aiAgent.requestMessengerSettings({
1024
+ aiAgentId: l,
1025
+ userId: g == null ? void 0 : g.userId,
1026
+ language: d,
1027
+ country: m,
1028
+ context: h,
1029
+ forceCreateChannel: a,
1030
+ knownActiveChannelUrl: S
1031
+ });
1032
+ f.debug("useAuthentication.authenticate: messenger settings response", k);
1033
+ let F = null;
1034
+ if (k.auto_created_user) {
1035
+ const { user_id: V, session_token: re, expire_at: y } = k.auto_created_user;
1036
+ x.messenger.setAnonUser({ userId: V, authToken: re, expireAt: y }), F = { userId: V, authToken: re };
1037
+ } else
1038
+ F = {
1039
+ userId: (g == null ? void 0 : g.userId) ?? "",
1040
+ authToken: (g == null ? void 0 : g.authToken) ?? ""
1041
+ };
1042
+ x.messenger.setSettings(F.userId, {
1043
+ knownActiveChannelUrl: k.active_channel.channel_url
1044
+ });
1045
+ try {
1046
+ await t(k, F), await E(F, g == null ? void 0 : g.sessionHandler, s), await n(k, F);
1047
+ } catch (V) {
1048
+ V instanceof Error && (o(V), f.error("useAuthentication.authenticate: failed to connect", V));
1049
+ }
1050
+ return k;
1051
+ }, [
1052
+ c,
1053
+ E,
1054
+ g == null ? void 0 : g.userId,
1055
+ g == null ? void 0 : g.sessionHandler,
1056
+ g == null ? void 0 : g.authToken,
1057
+ x.messenger.setAnonUser,
1058
+ x.messenger.getSettings,
1059
+ x.messenger.setSettings,
1060
+ t,
1061
+ n,
1062
+ o,
1063
+ s
1064
+ ]), v = R(async () => {
1065
+ f.debug("useAuthentication.deauthenticate: start"), await b(), i(), f.debug("useAuthentication.deauthenticate: completed");
1066
+ }, [b, f, i]);
1067
+ return {
1068
+ authenticate: C,
1069
+ deauthenticate: v,
1070
+ userSessionCandidate: g
1071
+ };
1072
+ }
1073
+ const An = (e) => {
1074
+ try {
1075
+ const t = JSON.parse(e);
1076
+ return typeof t == "string" ? JSON.stringify(t).slice(1, -1) : e.trim();
1077
+ } catch {
1078
+ return JSON.stringify(e).slice(1, -1);
1079
+ }
1080
+ }, $e = (e) => JSON.parse(e), Qe = (e) => JSON.parse(e);
1081
+ function Lo(e, t) {
1082
+ const [n, o] = t.split(",").map((s) => s.trim());
1083
+ return e === "dark" && o || n;
1084
+ }
1085
+ function Ro(e) {
1086
+ const t = {};
1087
+ function n(o, s = "") {
1088
+ for (const [i, a] of Object.entries(o)) {
1089
+ const l = s ? `${s}.${i}` : i;
1090
+ a && typeof a == "object" && !Array.isArray(a) ? n(a, l) : t[l] = a;
1091
+ }
1092
+ }
1093
+ return n(e), t;
1094
+ }
1095
+ function vt({
1096
+ template: e,
1097
+ variables: t,
1098
+ variableKeyPattern: n,
1099
+ variableValueTransformer: o
1100
+ }) {
1101
+ return Object.entries(t).reduce((s, [i, a]) => {
1102
+ if (!o && !["number", "boolean", "string"].includes(typeof a))
1103
+ throw new Error(`If transformer is not provided, value(${i}:${a}) must be a {string, number, or boolean}`);
1104
+ const l = o ? o(a) : String(a), c = n(i);
1105
+ return s.replace(c, An(l));
1106
+ }, e);
1107
+ }
1108
+ async function Do({
1109
+ template: e,
1110
+ variables: t,
1111
+ variableKeyPattern: n,
1112
+ variableValueTransformer: o
1113
+ }) {
1114
+ return (await Promise.all(
1115
+ Object.entries(t).map(async ([i, a]) => {
1116
+ const l = await o(a);
1117
+ return { regex: n(i), transformedValue: l };
1118
+ })
1119
+ )).reduce((i, { regex: a, transformedValue: l }) => i.replace(a, An(l)), e);
1120
+ }
1121
+ const No = () => {
1122
+ const { chatSDK: e, logger: t, cache: n } = ue(), o = R(() => {
1123
+ var l, c;
1124
+ const i = (c = (l = e.appInfo) == null ? void 0 : l.aiAgentInfo) == null ? void 0 : c.templateListToken;
1125
+ if (!i) return !1;
1126
+ const a = n.template.getCachedToken();
1127
+ return a ? i !== a : !0;
1128
+ }, [e, n.template.getCachedToken]), s = R(async () => {
1129
+ try {
1130
+ const { templates: i, token: a } = await e.aiAgent.getMessageTemplates({ limit: 20 });
1131
+ for (const { template: l } of i) {
1132
+ const { key: c } = $e(l);
1133
+ n.template.set(c, l);
1134
+ }
1135
+ n.template.setCachedToken(a);
1136
+ } catch (i) {
1137
+ t == null || t.error("messageTemplateContext.syncCachedTemplates: error:", i);
1138
+ }
1139
+ }, [e, t, n.template.set, n.template.setCachedToken]);
1140
+ return {
1141
+ shouldSyncCachedTemplate: o,
1142
+ syncCachedTemplates: s
1143
+ };
1144
+ };
1145
+ var je = /* @__PURE__ */ ((e) => (e.OFF = "off", e.ALWAYS = "always", e.HANDED_OFF_ONLY = "handed_off_only", e))(je || {});
1146
+ const Po = {
1147
+ off: "off",
1148
+ always: "always",
1149
+ handed_off_only: "handed_off_only"
1150
+ /* HANDED_OFF_ONLY */
1151
+ }, {
1152
+ Provider: Bo
1153
+ } = G("AIAgentMessengerSession"), Fo = ye(
1154
+ function({ userSessionInfo: e, forceCreateChannel: t, children: n }, o) {
1155
+ const { appId: s, aiAgentId: i, chatSDK: a, language: l, countryCode: c, context: d, cache: h, logger: m } = ue(), { updateTheme: f } = Ct(), [x, E] = _(void 0), [b, g] = _(
1156
+ void 0
1157
+ ), [C, v] = _(null), [S, k] = _(null), [F, $] = _(null), [V, re] = _(
1158
+ "handed_off_only"
1159
+ /* HANDED_OFF_ONLY */
1160
+ ), { shouldSyncCachedTemplate: y, syncCachedTemplates: H } = No(), { authenticate: oe, deauthenticate: Y } = Oo({
1161
+ userSessionInfo: e,
1162
+ forceCreateChannel: t,
1163
+ onPreAuth: R((A, D) => {
1164
+ const K = A.appearance.selected_theme;
1165
+ f(K, (q) => {
1166
+ const be = A.appearance.themes[q];
1167
+ return {
1168
+ primaryColor: be.primary_color,
1169
+ botMessageBackgroundColor: be.bot_message_bg_color,
1170
+ primaryContrastColor: be.primary_contrast_color,
1171
+ botMessageBackgroundContrastColor: be.bot_message_bg_contrast_color
1172
+ };
1173
+ }), E(void 0), v(D), k({
1174
+ userId: A.bot.bot_userid,
1175
+ profileUrl: A.bot.bot_profile_url,
1176
+ nickname: A.bot.bot_nickname,
1177
+ replyToFile: A.bot.reply_to_file,
1178
+ specialNotice: A.bot.special_notice,
1179
+ specialNoticeEnabled: A.bot.is_special_notice_enabled,
1180
+ showHandoffButton: A.bot.show_handoff_button ?? !0
1181
+ }), $({
1182
+ type: A.launcher.image_type || "default_icon",
1183
+ imageUrl: A.launcher.image_url
1184
+ }), re(
1185
+ Po[A.active_channel.attachment_mode] ?? "handed_off_only"
1186
+ /* HANDED_OFF_ONLY */
1187
+ );
1188
+ }, []),
1189
+ onPostAuth: R(
1190
+ async (A) => {
1191
+ y() && await H(), g({ url: A.active_channel.channel_url, status: W.OPEN });
1192
+ },
1193
+ [y, H]
1194
+ ),
1195
+ onErrorAuth: R((A) => {
1196
+ E(A);
1197
+ }, []),
1198
+ onAuthTokenRefreshed: R((A) => {
1199
+ v((D) => D ? { ...D, authToken: A } : null);
1200
+ }, []),
1201
+ onPostDeauth: R(() => {
1202
+ h.template.clear(), C != null && C.userId && h.messenger.clear(C.userId), g(void 0), v(null), k(null), $(null);
1203
+ }, [h.template.clear, C])
1204
+ }), nt = R(async () => {
1205
+ var A;
1206
+ if (C) {
1207
+ m.debug("agentMessengerSession.refreshActiveChannel: try to refresh active channel"), g(void 0);
1208
+ const D = await a.aiAgent.requestMessengerSettings({
1209
+ aiAgentId: i,
1210
+ userId: C.userId,
1211
+ language: l,
1212
+ country: c,
1213
+ context: d,
1214
+ forceCreateChannel: t,
1215
+ knownActiveChannelUrl: (A = h.messenger.getSettings(C.userId)) == null ? void 0 : A.knownActiveChannelUrl
1216
+ });
1217
+ return h.messenger.setSettings(C.userId, {
1218
+ knownActiveChannelUrl: D.active_channel.channel_url
1219
+ }), g({ url: D.active_channel.channel_url, status: W.OPEN }), m.info(
1220
+ "agentMessengerSession.refreshActiveChannel: refreshed active channel",
1221
+ D.active_channel.channel_url
1222
+ ), D.active_channel.channel_url;
1223
+ } else
1224
+ throw m.error("agentMessengerSession.refreshActiveChannel: userSession is not ready"), new Error("userSession is not ready");
1225
+ }, [
1226
+ a,
1227
+ s,
1228
+ i,
1229
+ C == null ? void 0 : C.userId,
1230
+ l,
1231
+ c,
1232
+ d,
1233
+ t,
1234
+ h.messenger.getSettings,
1235
+ h.messenger.setSettings
1236
+ ]), rt = R(
1237
+ async (A) => {
1238
+ if (!(C != null && C.userId))
1239
+ throw new Error("Current user is not authenticated. Please authenticate first.");
1240
+ const K = (await a.aiAgent.requestMessengerSettings({
1241
+ ...A,
1242
+ userId: C.userId,
1243
+ knownActiveChannelUrl: void 0
1244
+ })).active_channel.channel_url;
1245
+ return h.messenger.setSettings(C.userId, { knownActiveChannelUrl: K }), K;
1246
+ },
1247
+ [C == null ? void 0 : C.userId]
1248
+ );
1249
+ return Xe(a, {
1250
+ onChannelChanged: (A) => {
1251
+ var D;
1252
+ A.isGroupChannel() && A.url === (b == null ? void 0 : b.url) && (m.info("agentMessengerSession.channelChanged: channel.conversation", A.conversation), g({ url: A.url, status: ((D = A.conversation) == null ? void 0 : D.status) ?? W.OPEN }));
1253
+ }
1254
+ }), Er(o, () => {
1255
+ const A = async () => {
1256
+ if (!b) throw new Error("No active conversation. Please start a conversation first.");
1257
+ return await a.groupChannel.getChannel(b.url);
1258
+ };
1259
+ return {
1260
+ activeChannel: b,
1261
+ chatSDK: a,
1262
+ authenticate: oe,
1263
+ deauthenticate: Y,
1264
+ updateContext: async (D) => {
1265
+ const q = await (await A()).updateContext(i, D);
1266
+ return { ...q, context: q.context ?? {} };
1267
+ },
1268
+ patchContext: async (D) => {
1269
+ const q = await (await A()).patchContext(i, D);
1270
+ return { ...q, context: q.context ?? {} };
1271
+ },
1272
+ getContextObject: async () => {
1273
+ const K = await (await A()).getContextObject(i);
1274
+ return { ...K, context: K.context ?? {} };
1275
+ }
1276
+ };
1277
+ }, [oe, Y, b, a, i, m]), /* @__PURE__ */ r.createElement(
1278
+ Bo,
1279
+ {
1280
+ value: {
1281
+ userSessionInfo: e,
1282
+ userSession: C,
1283
+ activeChannel: b,
1284
+ setActiveChannel: g,
1285
+ refreshActiveChannel: nt,
1286
+ createConversation: rt,
1287
+ connectionError: x,
1288
+ aiAgentInfo: S,
1289
+ launcherInfo: F,
1290
+ authenticate: oe,
1291
+ deauthenticate: Y,
1292
+ attachmentMode: V
1293
+ }
1294
+ },
1295
+ n
1296
+ );
1297
+ }
1298
+ );
1299
+ function Uo(e) {
1300
+ let t = "pending", n = e.then((o) => {
1301
+ t = "resolved", n = o;
1302
+ }).catch((o) => {
1303
+ t = "rejected", n = o;
1304
+ });
1305
+ return {
1306
+ get value() {
1307
+ if (t === "resolved")
1308
+ return n;
1309
+ throw n;
1310
+ }
1311
+ };
1312
+ }
1313
+ const {
1314
+ Provider: Ho,
1315
+ useContext: kn
1316
+ } = G("MessageTemplateFetching");
1317
+ function zo({ children: e, internalVariables: t }) {
1318
+ const n = N({}), o = N({}), [s, i] = _({}), a = R((d, h) => {
1319
+ i((m) => ({
1320
+ ...m,
1321
+ [d]: { fetching: !1, error: !1, ...m[d], ...h }
1322
+ }));
1323
+ }, []), l = R(
1324
+ async ({
1325
+ onRequestTemplate: d,
1326
+ onGetCachedTemplate: h,
1327
+ templateKey: m,
1328
+ suspense: f = !1
1329
+ }) => {
1330
+ const x = h(m);
1331
+ if (x) return x;
1332
+ const E = o.current[m];
1333
+ if (E) return E;
1334
+ f || a(m, { fetching: !0 });
1335
+ const b = d(m).catch((g) => {
1336
+ throw f || a(m, { error: !0 }), g;
1337
+ }).finally(() => {
1338
+ f || a(m, { fetching: !1 }), delete o.current[m];
1339
+ });
1340
+ return o.current[m] = b, b;
1341
+ },
1342
+ [a]
1343
+ ), c = {
1344
+ internalVariables: t,
1345
+ fetchTemplate: l,
1346
+ suspend: (d, h) => {
1347
+ if (n.current[d])
1348
+ return n.current[d];
1349
+ const m = Uo(h());
1350
+ return n.current[d] = m, m;
1351
+ },
1352
+ getIsFetching: (d) => {
1353
+ var h;
1354
+ return ((h = s[d]) == null ? void 0 : h.fetching) ?? !1;
1355
+ },
1356
+ getHasError: (d) => {
1357
+ var h;
1358
+ return ((h = s[d]) == null ? void 0 : h.error) ?? !1;
1359
+ }
1360
+ };
1361
+ return /* @__PURE__ */ r.createElement(Ho, { value: c }, e);
1362
+ }
1363
+ const et = {
1364
+ VARIABLE: (e) => new RegExp(`\\{${e}\\}`, "g"),
1365
+ VIEW_VARIABLE: (e) => new RegExp(`"{@${e}}"`, "g")
1366
+ };
1367
+ function ce({ uiTemplateString: e, variables: t = {} }) {
1368
+ const n = Ro(t);
1369
+ return vt({
1370
+ template: e,
1371
+ variables: n,
1372
+ variableKeyPattern: (o) => et.VARIABLE(o)
1373
+ });
1374
+ }
1375
+ function de({
1376
+ theme: e,
1377
+ uiTemplateString: t,
1378
+ colorVariables: n = {}
1379
+ }) {
1380
+ return vt({
1381
+ template: t,
1382
+ variables: n,
1383
+ variableKeyPattern: (o) => et.VARIABLE(o),
1384
+ variableValueTransformer: (o) => Lo(e, o)
1385
+ });
1386
+ }
1387
+ function Vo({
1388
+ theme: e,
1389
+ uiTemplateString: t,
1390
+ viewVariables: n = {},
1391
+ aiAgentColorVariables: o,
1392
+ internalVariables: s,
1393
+ onRequestTemplate: i
1394
+ }) {
1395
+ const l = Object.values(n).flat().map((d) => d.key);
1396
+ return [...new Set(l)].some((d) => !i(d)) ? null : vt({
1397
+ template: t,
1398
+ variables: n,
1399
+ variableKeyPattern: (d) => et.VIEW_VARIABLE(d),
1400
+ variableValueTransformer: (d) => {
1401
+ const h = d.map(({ key: m, variables: f }) => {
1402
+ const x = i(m), { ui_template: E, color_variables: b } = $e(x);
1403
+ let g = JSON.stringify(E);
1404
+ return g = ce({
1405
+ uiTemplateString: g,
1406
+ variables: s
1407
+ }), g = de({
1408
+ theme: e,
1409
+ uiTemplateString: g,
1410
+ colorVariables: b
1411
+ }), g = de({
1412
+ theme: e,
1413
+ uiTemplateString: g,
1414
+ colorVariables: o
1415
+ }), g = ce({
1416
+ uiTemplateString: g,
1417
+ variables: f
1418
+ }), Qe(g);
1419
+ });
1420
+ return JSON.stringify(h);
1421
+ }
1422
+ });
1423
+ }
1424
+ async function Wo({
1425
+ theme: e,
1426
+ uiTemplateString: t,
1427
+ viewVariables: n = {},
1428
+ aiAgentColorVariables: o,
1429
+ internalVariables: s,
1430
+ onRequestTemplate: i
1431
+ }) {
1432
+ return Do({
1433
+ template: t,
1434
+ variables: n,
1435
+ variableKeyPattern: (a) => et.VIEW_VARIABLE(a),
1436
+ variableValueTransformer: async (a) => {
1437
+ const l = a.map(async ({ key: d, variables: h }) => {
1438
+ const m = await i(d), { ui_template: f, color_variables: x } = $e(m);
1439
+ let E = JSON.stringify(f);
1440
+ return E = ce({
1441
+ uiTemplateString: E,
1442
+ variables: s
1443
+ }), E = de({
1444
+ theme: e,
1445
+ uiTemplateString: E,
1446
+ colorVariables: x
1447
+ }), E = de({
1448
+ theme: e,
1449
+ uiTemplateString: E,
1450
+ colorVariables: o
1451
+ }), E = ce({
1452
+ uiTemplateString: E,
1453
+ variables: h
1454
+ }), Qe(E);
1455
+ }), c = await Promise.all(l);
1456
+ return JSON.stringify(c);
1457
+ }
1458
+ });
1459
+ }
1460
+ const Go = ({
1461
+ rawTemplate: e,
1462
+ aiAgentColorVariables: t,
1463
+ internalVariables: n,
1464
+ ...o
1465
+ }) => {
1466
+ const { ui_template: s, color_variables: i } = $e(e);
1467
+ let a = JSON.stringify(s);
1468
+ if (Object.keys(o.viewVariables ?? {}).length > 0) {
1469
+ const c = Vo({
1470
+ ...o,
1471
+ uiTemplateString: a,
1472
+ aiAgentColorVariables: t,
1473
+ internalVariables: n
1474
+ });
1475
+ if (c === null) return null;
1476
+ a = c;
1477
+ }
1478
+ return a = ce({ ...o, uiTemplateString: a, variables: n }), a = de({ ...o, uiTemplateString: a, colorVariables: i }), a = de({ ...o, uiTemplateString: a, colorVariables: t }), a = ce({ ...o, uiTemplateString: a }), Qe(a);
1479
+ }, jo = async ({
1480
+ rawTemplate: e,
1481
+ aiAgentColorVariables: t,
1482
+ internalVariables: n,
1483
+ ...o
1484
+ }) => {
1485
+ const { ui_template: s, color_variables: i } = $e(e);
1486
+ let a = JSON.stringify(s);
1487
+ return Object.keys(o.viewVariables ?? {}).length > 0 && (a = await Wo({
1488
+ ...o,
1489
+ uiTemplateString: a,
1490
+ aiAgentColorVariables: t,
1491
+ internalVariables: n
1492
+ })), a = ce({ ...o, uiTemplateString: a, variables: n }), a = de({ ...o, uiTemplateString: a, colorVariables: i }), a = de({ ...o, uiTemplateString: a, colorVariables: t }), a = ce({ ...o, uiTemplateString: a }), Qe(a);
1493
+ }, Ko = (e) => {
1494
+ const { aiAgentColorVariables: t = {} } = e, { internalVariables: n } = kn();
1495
+ return _(() => {
1496
+ const o = e.onGetCachedTemplate(e.templateKey);
1497
+ return o ? Go({
1498
+ ...e,
1499
+ rawTemplate: o,
1500
+ aiAgentColorVariables: t,
1501
+ internalVariables: n,
1502
+ onRequestTemplate: e.onGetCachedTemplate
1503
+ }) : null;
1504
+ });
1505
+ }, Zo = (e) => {
1506
+ const [t] = Ko(e);
1507
+ if (t) return t;
1508
+ const { aiAgentColorVariables: n = {} } = e, { internalVariables: o, fetchTemplate: s, suspend: i } = kn();
1509
+ return i(e.templateKey, async () => {
1510
+ const l = await s({ ...e, suspense: !0 });
1511
+ return await jo({
1512
+ ...e,
1513
+ rawTemplate: l,
1514
+ aiAgentColorVariables: n,
1515
+ internalVariables: o
1516
+ });
1517
+ }).value;
1518
+ }, Yo = '@import"https://fonts.googleapis.com/css?family=Roboto:400,500,600,700&display=swap";.sb-message-template__border{position:relative}.sb-message-template__border:after{content:"";position:absolute;top:0;bottom:0;left:0;right:0;z-index:1;box-shadow:inset 0 0 0 var(--border-width) var(--border-color);border-radius:var(--border-radius);pointer-events:none}.sb-message-template__action{cursor:pointer}.sb-message-template__parent{font-family:Roboto,serif}.sb-message-template__text{font-family:inherit;font-size:14px;font-weight:400;font-stretch:normal;font-style:normal;letter-spacing:normal;text-align:left}.sb-message-template__text-button{font-family:inherit;background-color:#e0e0e0;text-align:center;padding:10px;border-radius:6px;font-size:14px;font-weight:600;font-stretch:normal;font-style:normal;letter-spacing:normal}.sendbird-theme--light .sb-message-template__text-button{color:#742ddd}.sendbird-theme--dark .sb-message-template__text-button{color:#c2a9fa}.sb-message-template__text-button:hover{opacity:1;box-shadow:#0000001a 0 1px 3px,#0000000f 0 1px 2px}.sb-message-template__text-button,.sb-message-template__image-button{cursor:pointer;border-style:none}.sb-message-template__parent{border-radius:unset;background-color:transparent;overflow:hidden}.sb-message-template__parent *{box-sizing:border-box;line-height:1.3}.sb-message-template__carousel{display:flex;width:100%;box-sizing:border-box;touch-action:pan-y}', Me = "en", qo = /* @__PURE__ */ new Set([
1519
+ Me,
1520
+ "ko",
1521
+ "es",
1522
+ "pt",
1523
+ "fr",
1524
+ "hi",
1525
+ "it",
1526
+ "de",
1527
+ "tr",
1528
+ "ja"
1529
+ ]), Jo = (e, t, n) => {
1530
+ const o = e[t];
1531
+ return o ? typeof o == "function" ? o() : Promise.resolve(o) : new Promise((s, i) => {
1532
+ (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
1533
+ i.bind(
1534
+ null,
1535
+ new Error(
1536
+ "Unknown variable dynamic import: " + t + (t.split("/").length !== n ? ". Note that variables only represent file names one level deep." : "")
1537
+ )
1538
+ )
1539
+ );
1540
+ });
1541
+ }, Xo = Or, Qo = {
1542
+ // Channel - Common
1543
+ CHANNEL_FROZEN: "Channel frozen",
1544
+ PLACE_HOLDER__WRONG: "Something went wrong",
1545
+ PLACE_HOLDER__NO_MESSAGES: "No messages",
1546
+ UNKNOWN__UNKNOWN_MESSAGE_TYPE: "(Unknown message type)",
1547
+ // Channel - Header
1548
+ HEADER_BUTTON__AGENT_HANDOFF: "Connect with an agent",
1549
+ // Message Input
1550
+ MESSAGE_INPUT__PLACE_HOLDER: "Ask a question",
1551
+ MESSAGE_INPUT__PLACE_HOLDER__WAIT_AI_AGENT_RESPONSE: "Waiting for the agent’s reply…",
1552
+ MESSAGE_INPUT__PLACE_HOLDER__DISABLED: "Chat is unavailable in this channel",
1553
+ // Common UI
1554
+ BUTTON__CANCEL: "Cancel",
1555
+ BUTTON__SAVE: "Save",
1556
+ BUTTON__OK: "OK",
1557
+ NO_NAME: "(No name)",
1558
+ RETRY: "Retry",
1559
+ // Date format
1560
+ DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR: "MMMM dd, yyyy",
1561
+ DATE_FORMAT__MESSAGE_TIMESTAMP: "p",
1562
+ // File Upload
1563
+ FILE_UPLOAD_NOTIFICATION__COUNT_LIMIT: "You can't upload more than one image",
1564
+ FILE_UPLOAD_NOTIFICATION__SIZE_LIMIT: "The maximum size per file is %d MB.",
1565
+ // File Viewer
1566
+ FILE_VIEWER__UNSUPPORT: "Unsupported message",
1567
+ // CSAT
1568
+ CSAT_TITLE_UNSUBMITTED: "Your feedback matters to us",
1569
+ CSAT_TITLE_SUBMITTED: "Successfully submitted!",
1570
+ CSAT_CRE_TITLE: "Was your issue resolved?",
1571
+ CSAT_CRE_SOLVED: "Yes, thank you! 👍",
1572
+ CSAT_CRE_NOT_SOLVED: "No, that didn’t help.",
1573
+ CSAT_REASON_PLACEHOLDER: "Share your feedback",
1574
+ CSAT_RATING_TITLE: "How would you rate your experience?",
1575
+ CSAT5_RATING_SCORE_1: "Terrible",
1576
+ CSAT5_RATING_SCORE_2: "Bad",
1577
+ CSAT5_RATING_SCORE_3: "Okay",
1578
+ CSAT5_RATING_SCORE_4: "Good",
1579
+ CSAT5_RATING_SCORE_5: "Great",
1580
+ CSAT_SUBMIT_LABEL: "Submit",
1581
+ CSAT_SUBMISSION_EXPIRED: "We’re sorry, the survey period has ended.",
1582
+ POWERED_BY: "Powered by",
1583
+ // Conversation list
1584
+ CONVERSATION_CLOSED_FOOTER_LABEL: "Your conversation has ended",
1585
+ START_NEW_CONVERSATION: "💬 Start a new conversation",
1586
+ RETURN_TO_CONVERSATION: "💬 Return to conversation",
1587
+ CONVERSATION_LIST__HEADER_TITLE: "Conversation history",
1588
+ CONVERSATION_LIST__TOPICS_FALLBACK: "No category",
1589
+ CONVERSATION_LIST__NO_CONVERSATIONS: "No conversations yet",
1590
+ DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE: "MM/dd/yyyy",
1591
+ DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE_CAPTION: "h:mma",
1592
+ // Citation
1593
+ CITATION_SOURCE_TITLE: "Source"
1594
+ }, yt = { language: "en", dateLocale: Xo, stringSet: Qo }, es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1595
+ __proto__: null,
1596
+ default: yt
1597
+ }, Symbol.toStringTag, { value: "Module" })), Ke = /* @__PURE__ */ new Map([[Me, yt]]);
1598
+ async function ts(e) {
1599
+ if (Ke.has(e))
1600
+ return Ke.get(e);
1601
+ const t = qo.has(e) ? e : Me;
1602
+ try {
1603
+ const { default: n } = await Jo(/* @__PURE__ */ Object.assign({ "./languages/de.ts": () => import("./BAebVbLs.js"), "./languages/en.ts": () => Promise.resolve().then(() => es), "./languages/es.ts": () => import("./BKSUGIyL.js"), "./languages/fr.ts": () => import("./B1s75De5.js"), "./languages/hi.ts": () => import("./D0QwWNMF.js"), "./languages/it.ts": () => import("./CA1gVgSD.js"), "./languages/ja.ts": () => import("./DcqbdvlW.js"), "./languages/ko.ts": () => import("./Dxrtj2R8.js"), "./languages/pt.ts": () => import("./EylKxx4d.js"), "./languages/tr.ts": () => import("./DYR8UT_l.js") }), `./languages/${t}.ts`, 3);
1604
+ return Ke.set(e, n), n;
1605
+ } catch {
1606
+ return yt;
1607
+ }
1608
+ }
1609
+ const {
1610
+ Provider: ns,
1611
+ useContext: O
1612
+ } = G("Localization");
1613
+ function rs(e) {
1614
+ var t;
1615
+ return ((t = e.split("-")) == null ? void 0 : t[0]) ?? Me;
1616
+ }
1617
+ function os({
1618
+ language: e = navigator.language,
1619
+ logger: t,
1620
+ stringSet: n,
1621
+ children: o
1622
+ }) {
1623
+ const [s, i] = _(Ke.get(Me));
1624
+ return L(() => {
1625
+ const a = rs(e);
1626
+ s.language !== a && (t == null || t.debug("localization.useEffect: update language", `${s.language} -> ${a}`), ts(a).then(i));
1627
+ }, [e]), /* @__PURE__ */ r.createElement(
1628
+ ns,
1629
+ {
1630
+ value: {
1631
+ language: s.language,
1632
+ stringSet: { ...s.stringSet, ...n },
1633
+ dateLocale: s.dateLocale,
1634
+ format: (a, l, c) => Cn(a, l, { locale: s.dateLocale, ...c })
1635
+ }
1636
+ },
1637
+ o
1638
+ );
1639
+ }
1640
+ const Ze = "data-sb-agent-theme", Yt = (e) => (t, ...n) => {
1641
+ let o = "";
1642
+ return t.forEach((s, i) => {
1643
+ o += s + (n[i] ?? "");
1644
+ }), `[${Ze}='${e}'] & { ${o} }`;
1645
+ }, P = {
1646
+ light: Yt("light"),
1647
+ dark: Yt("dark")
1648
+ }, ss = I(({ theme: e }) => {
1649
+ const { palette: t } = e;
1650
+ return `
1651
+ :root,
1652
+ :host {
1653
+ --sendbird-primary-extra-dark: ${t.primary.extraDark};
1654
+ --sendbird-primary-dark: ${t.primary.dark};
1655
+ --sendbird-primary-main: ${t.primary.main};
1656
+ --sendbird-primary-light: ${t.primary.light};
1657
+ --sendbird-primary-extra-light: ${t.primary.extraLight};
1658
+
1659
+ --sendbird-secondary-extra-dark: ${t.secondary.extraDark};
1660
+ --sendbird-secondary-dark: ${t.secondary.dark};
1661
+ --sendbird-secondary-main: ${t.secondary.main};
1662
+ --sendbird-secondary-light: ${t.secondary.light};
1663
+ --sendbird-secondary-extra-light: ${t.secondary.extraLight};
1664
+
1665
+ --sendbird-information-extra-dark: ${t.information.extraDark};
1666
+ --sendbird-information-dark: ${t.information.dark};
1667
+ --sendbird-information-main: ${t.information.main};
1668
+ --sendbird-information-light: ${t.information.light};
1669
+ --sendbird-information-extra-light: ${t.information.extraLight};
1670
+
1671
+ --sendbird-error-extra-dark: ${t.error.extraDark};
1672
+ --sendbird-error-dark: ${t.error.dark};
1673
+ --sendbird-error-main: ${t.error.main};
1674
+ --sendbird-error-light: ${t.error.light};
1675
+ --sendbird-error-extra-light: ${t.error.extraLight};
1676
+
1677
+ --sendbird-background-700: ${t.background700};
1678
+ --sendbird-background-600: ${t.background600};
1679
+ --sendbird-background-500: ${t.background500};
1680
+ --sendbird-background-400: ${t.background400};
1681
+ --sendbird-background-300: ${t.background300};
1682
+ --sendbird-background-200: ${t.background200};
1683
+ --sendbird-background-100: ${t.background100};
1684
+ --sendbird-background-50: ${t.background50};
1685
+
1686
+ --sendbird-onlight-text-high-emphasis: ${t.onlight.textHighEmphasis};
1687
+ --sendbird-onlight-text-mid-emphasis: ${t.onlight.textMidEmphasis};
1688
+ --sendbird-onlight-text-low-emphasis: ${t.onlight.textLowEmphasis};
1689
+ --sendbird-onlight-text-disabled: ${t.onlight.textDisabled};
1690
+
1691
+ --sendbird-ondark-text-high-emphasis: ${t.ondark.textHighEmphasis};
1692
+ --sendbird-ondark-text-mid-emphasis: ${t.ondark.textMidEmphasis};
1693
+ --sendbird-ondark-text-low-emphasis: ${t.ondark.textLowEmphasis};
1694
+ --sendbird-ondark-text-disabled: ${t.ondark.textDisabled};
1695
+
1696
+ --sendbird-overlay-dark: ${t.overlay.dark};
1697
+ --sendbird-overlay-light: ${t.overlay.light};
1698
+ }
1699
+ `;
1700
+ }), is = I`[${Ze}='light'] &{--sb-text-high-emphasis:var(--sendbird-onlight-text-high-emphasis);--sb-text-mid-emphasis:var(--sendbird-onlight-text-mid-emphasis);--sb-text-low-emphasis:var(--sendbird-onlight-text-low-emphasis);--sb-text-disabled:var(--sendbird-onlight-text-disabled);--sb-text-high-emphasis-inverse:var(--sendbird-ondark-text-high-emphasis);--sb-text-mid-emphasis-inverse:var(--sendbird-ondark-text-mid-emphasis);--sb-text-low-emphasis-inverse:var(--sendbird-ondark-text-low-emphasis);--sb-text-disabled-inverse:var(--sendbird-ondark-text-disabled);--sb-bg-50-600:var(--sendbird-background-50);--sb-bg-100-500:var(--sendbird-background-100);--sb-bg-200-400:var(--sendbird-background-200);--sb-primary:var(--sendbird-primary-main);--sb-secondary:var(--sendbird-secondary-main);--sb-error:var(--sendbird-error-main);--sb-information:var(--sendbird-information-light);}[${Ze}='dark'] &{--sb-text-high-emphasis:var(--sendbird-ondark-text-high-emphasis);--sb-text-mid-emphasis:var(--sendbird-ondark-text-mid-emphasis);--sb-text-low-emphasis:var(--sendbird-ondark-text-low-emphasis);--sb-text-disabled:var(--sendbird-ondark-text-disabled);--sb-text-high-emphasis-inverse:var(--sendbird-onlight-text-high-emphasis);--sb-text-mid-emphasis-inverse:var(--sendbird-onlight-text-mid-emphasis);--sb-text-low-emphasis-inverse:var(--sendbird-onlight-text-low-emphasis);--sb-text-disabled-inverse:var(--sendbird-onlight-text-disabled);--sb-bg-50-600:var(--sendbird-background-600);--sb-bg-100-500:var(--sendbird-background-500);--sb-bg-200-400:var(--sendbird-background-400);--sb-primary:var(--sendbird-primary-light);--sb-secondary:var(--sendbird-secondary-light);--sb-error:var(--sendbird-error-light);--sb-information:var(--sendbird-information-light);}`, p = {
1701
+ color: {
1702
+ primary: {
1703
+ dark: "var(--sendbird-primary-dark)",
1704
+ main: "var(--sendbird-primary-main)"
1705
+ },
1706
+ error: {
1707
+ extraDark: "var(--sendbird-error-extra-dark)",
1708
+ dark: "var(--sendbird-error-dark)"
1709
+ },
1710
+ information: {
1711
+ main: "var(--sendbird-information-main)",
1712
+ light: "var(--sendbird-information-light)"
1713
+ },
1714
+ background700: "var(--sendbird-background-700)",
1715
+ background500: "var(--sendbird-background-500)",
1716
+ background400: "var(--sendbird-background-400)",
1717
+ background200: "var(--sendbird-background-200)",
1718
+ background100: "var(--sendbird-background-100)",
1719
+ background50: "var(--sendbird-background-50)",
1720
+ ondark: {
1721
+ textMidEmphasis: "var(--sendbird-ondark-text-mid-emphasis)",
1722
+ textLowEmphasis: "var(--sendbird-ondark-text-low-emphasis)",
1723
+ textDisabled: "var(--sendbird-ondark-text-disabled)"
1724
+ },
1725
+ overlay: {
1726
+ dark: "var(--sendbird-overlay-dark)"
1727
+ }
1728
+ },
1729
+ themedColor: {
1730
+ textHighEmphasis: "var(--sb-text-high-emphasis)",
1731
+ textMidEmphasis: "var(--sb-text-mid-emphasis)",
1732
+ textLowEmphasis: "var(--sb-text-low-emphasis)",
1733
+ textDisabled: "var(--sb-text-disabled)",
1734
+ textHighEmphasisInverse: "var(--sb-text-high-emphasis-inverse)",
1735
+ bg_50_600: "var(--sb-bg-50-600)",
1736
+ bg_100_500: "var(--sb-bg-100-500)",
1737
+ bg_200_400: "var(--sb-bg-200-400)",
1738
+ error: "var(--sb-error)"
1739
+ }
1740
+ }, {
1741
+ Provider: as,
1742
+ useContext: ls
1743
+ } = G("MessengerTheme");
1744
+ function cs(e) {
1745
+ const { theme: t, appearance: n, logger: o } = e;
1746
+ return /* @__PURE__ */ r.createElement(
1747
+ wo,
1748
+ {
1749
+ appearance: n,
1750
+ palette: t == null ? void 0 : t.palette,
1751
+ typography: t == null ? void 0 : t.typography,
1752
+ logger: o
1753
+ },
1754
+ /* @__PURE__ */ r.createElement(ds, { ...e })
1755
+ );
1756
+ }
1757
+ function ds({ rootElement: e = document.body, children: t }) {
1758
+ const { theme: n, updateTheme: o } = Ct();
1759
+ return le(() => {
1760
+ e.setAttribute(Ze, n.selectedTheme);
1761
+ }, [e, n.selectedTheme]), /* @__PURE__ */ r.createElement(kr, { theme: n }, /* @__PURE__ */ r.createElement(as, { value: { theme: n, updateTheme: o } }, t));
1762
+ }
1763
+ function pe(e, t) {
1764
+ const n = e.getRootNode({ composed: t });
1765
+ return n instanceof ShadowRoot || n instanceof Document ? n : document;
1766
+ }
1767
+ const us = (e, t) => {
1768
+ L(() => {
1769
+ const n = pe(t) instanceof ShadowRoot, o = pe(t, !0);
1770
+ if (!(n ? t : o).querySelector(`link[href*='${e}']`)) {
1771
+ const i = o.createElement("link");
1772
+ i.rel = "stylesheet", i.href = e, (n ? t : o.head).appendChild(i);
1773
+ }
1774
+ }, [e, t]);
1775
+ }, ms = (e, t = document.body) => {
1776
+ L(() => {
1777
+ const n = pe(t), s = n instanceof ShadowRoot ? t : n.head;
1778
+ if (!s) return;
1779
+ const i = `sba-${btoa(e).slice(0, 10)}`;
1780
+ let a = s.querySelector(`style#${i}`);
1781
+ a ? a.textContent !== e && (a.textContent = e) : (a = s.ownerDocument.createElement("style"), a.id = i, a.textContent = e, s.appendChild(a));
1782
+ }, [e, t]);
1783
+ }, _t = /iPad|iPhone|iPod/.test(navigator.userAgent), gs = /Android/.test(navigator.userAgent), Oe = (e) => _t || gs, {
1784
+ Provider: hs,
1785
+ Consumer: In,
1786
+ useContext: B
1787
+ } = G("Messenger");
1788
+ function ps({
1789
+ children: e,
1790
+ state: t,
1791
+ enableCloseConversationButton: n = !1,
1792
+ enableExpandButton: o = !0,
1793
+ enableAutoDisconnectInLauncher: s = !0,
1794
+ ...i
1795
+ }) {
1796
+ const [a, l] = _(!1), [c, d] = _(!1), h = {
1797
+ opened: (t == null ? void 0 : t.opened) ?? a,
1798
+ setOpened: (t == null ? void 0 : t.setOpened) ?? l,
1799
+ expanded: (t == null ? void 0 : t.expanded) ?? c,
1800
+ setExpanded: (t == null ? void 0 : t.setExpanded) ?? d
1801
+ };
1802
+ return /* @__PURE__ */ r.createElement(eo, { ...i }, (m) => /* @__PURE__ */ r.createElement(
1803
+ hs,
1804
+ {
1805
+ value: {
1806
+ ...i,
1807
+ ...m,
1808
+ state: h,
1809
+ enableCloseConversationButton: n,
1810
+ enableExpandButton: o,
1811
+ enableAutoDisconnectInLauncher: s
1812
+ }
1813
+ },
1814
+ e
1815
+ ));
1816
+ }
1817
+ const {
1818
+ Provider: fs,
1819
+ useContext: U
1820
+ } = G("MessengerSession"), bs = ye(function({ children: e, ...t }, n) {
1821
+ return /* @__PURE__ */ r.createElement(Fo, { ref: n, ...t }, (o) => /* @__PURE__ */ r.createElement(Es, { ...o }, e));
1822
+ }), Es = ({ children: e, ...t }) => {
1823
+ const { chatSDK: n, logger: o, appId: s, aiAgentId: i, agentPreviewConfigs: a, state: l } = B(), { userSessionInfo: c, authenticate: d, setActiveChannel: h, userSession: m, aiAgentInfo: f, launcherInfo: x } = t;
1824
+ return Xe(n, {
1825
+ async onUserJoined(E, b) {
1826
+ var C, v;
1827
+ if (E.conversation && E.conversation.type === Rr.PROACTIVE && b.userId === ((C = n.currentUser) == null ? void 0 : C.userId)) {
1828
+ o.info("messengerSession.onUserJoined: proactive channel joined", E.url);
1829
+ const S = ((v = E.conversation) == null ? void 0 : v.status) ?? W.OPEN;
1830
+ h({ url: E.url, status: S }), l.setOpened(!0), xs({ sound: document.hidden || !l.opened });
1831
+ }
1832
+ }
1833
+ }), L(() => {
1834
+ d().then(({ launcher: E }) => {
1835
+ E.auto_open && !Oe() && setTimeout(() => l.setOpened(!0), 500);
1836
+ }).catch((E) => {
1837
+ o.error("messengerSession: failed to initialize", E);
1838
+ });
1839
+ }, [n, s, i, c == null ? void 0 : c.userId, c == null ? void 0 : c.authToken]), !m || !f || !x ? null : /* @__PURE__ */ r.createElement(
1840
+ fs,
1841
+ {
1842
+ value: {
1843
+ ...t,
1844
+ userSession: m,
1845
+ aiAgentInfo: { ...f, ...a == null ? void 0 : a.bot },
1846
+ launcherInfo: { ...x, ...a == null ? void 0 : a.launcher }
1847
+ }
1848
+ },
1849
+ e
1850
+ );
1851
+ };
1852
+ function xs({ sound: e }) {
1853
+ const t = "🔔You have received a new message", n = document.title, o = setInterval(() => {
1854
+ document.title = document.title === t ? n : t;
1855
+ }, 750);
1856
+ setTimeout(() => clearInterval(o), 5e3), e && import("./DP0MwObA.js").then((s) => {
1857
+ new Audio(s.default).play();
1858
+ });
1859
+ }
1860
+ const j = (e) => {
1861
+ const t = e;
1862
+ return typeof t == "number" ? `${t}px` : t;
1863
+ }, w = ({
1864
+ as: e,
1865
+ variant: t = "body1",
1866
+ color: n,
1867
+ className: o,
1868
+ ...s
1869
+ }) => /* @__PURE__ */ r.createElement(vs, { as: e, $variant: t, className: o, $color: n, ...s }), qt = /* @__PURE__ */ new WeakMap(), Cs = (e, t) => {
1870
+ let n = qt.get(t);
1871
+ n || (n = /* @__PURE__ */ new Map(), qt.set(t, n));
1872
+ const o = n.get(e);
1873
+ if (o) return o;
1874
+ const s = t[e] ?? t.body1, i = I`font-size:${j(s.fontSize)};font-weight:${s.fontWeight};${s.fontFamily ? `font-family: ${s.fontFamily};` : ""}
1875
+ ${s.lineHeight ? `line-height: ${s.lineHeight};` : "line-height: 100%;"}
1876
+ `;
1877
+ return n.set(e, i), i;
1878
+ }, vs = u.span`font-stretch:normal;font-style:normal;letter-spacing:normal;${({ $variant: e, theme: t }) => Cs(e, t.typography)}color:${({ $color: e }) => e};`, J = "sb-agent", ee = {
1879
+ ENTRY: `${J}-entry`,
1880
+ MODAL_ROOT: `${J}-modal-root`,
1881
+ WINDOW: `${J}-window`,
1882
+ LAUNCHER: `${J}-launcher`
1883
+ }, Ue = 2147483647, fe = {
1884
+ MODAL: Ue - 1,
1885
+ // FIXME: need to cover the case where the tooltip is on the top of the modal
1886
+ TOOLTIP: Ue - 2,
1887
+ WINDOW: Ue - 3,
1888
+ LAUNCHER: Ue - 4
1889
+ }, $n = {
1890
+ DEFAULT_PRIMARY: "#742ddd",
1891
+ WHITE: "#ffffff"
1892
+ }, Mn = 36, ys = 100, _s = 25 * 1024 * 1024, On = ["application/pdf", "image/jpeg", "image/jpg", "image/png"], St = "noopener noreferrer nofollow", Le = 244, Ln = 640, Ye = 26, Rn = 4, te = 12, Te = 2, Ss = 16, ne = `${J}-incoming-msg`, Ts = `${J}-marked-text`;
1893
+ function Tt(e) {
1894
+ switch (e) {
1895
+ case "top":
1896
+ case "middle":
1897
+ return Te;
1898
+ default:
1899
+ return Ss;
1900
+ }
1901
+ }
1902
+ function wt(e, t) {
1903
+ if (t) {
1904
+ const [, n] = t.split("/");
1905
+ if (n)
1906
+ return n.toUpperCase();
1907
+ }
1908
+ if (e && !e.startsWith(".")) {
1909
+ const n = e.split(".").pop();
1910
+ if (n && n !== e)
1911
+ return n.toUpperCase();
1912
+ }
1913
+ return "FILE";
1914
+ }
1915
+ function Dn(e) {
1916
+ return e.messageType === "file" ? e.message.length > 0 && e.file.name !== e.message : e.message.length > 0;
1917
+ }
1918
+ const ws = /* @__PURE__ */ new Set(["send", "chat", "message", "chevron-right"]), As = {
1919
+ spinner: T(() => import("./BcUGcaq2.js")),
1920
+ chat: T(() => import("./DcFCGVBm.js")),
1921
+ message: T(() => import("./DsGXnanX.js")),
1922
+ error: T(() => import("./B6fvrWGq.js")),
1923
+ info: T(() => import("./CAIYsKDy.js")),
1924
+ refresh: T(() => import("./B6xd54zt.js")),
1925
+ "chevron-down": T(() => import("./BsimU71m.js")),
1926
+ "chevron-right": T(() => import("./NmJl7zv3.js")),
1927
+ done: T(() => import("./D_q6g3Dd.js")),
1928
+ user: T(() => import("./CvqfQEhO.js")),
1929
+ "file-document": T(() => import("./BAr50pfO.js")),
1930
+ download: T(() => import("./B2CtcWp3.js")),
1931
+ attach: T(() => import("./DY2ULcTX.js")),
1932
+ delete: T(() => import("./DMruRpOm.js")),
1933
+ close: T(() => import("./CuaBI7kd.js")),
1934
+ "close-filled": T(() => import("./CxQFWLnW.js")),
1935
+ send: T(() => import("./DZJyDpNp.js")),
1936
+ menu: T(() => import("./BUYabNz7.js")),
1937
+ expand: T(() => import("./wBtIAuNm.js")),
1938
+ collapse: T(() => import("./C0RFfifL.js")),
1939
+ agent: T(() => import("./Cc7XmLN1.js")),
1940
+ question: T(() => import("./dqwvRBog.js")),
1941
+ actionbook: T(() => import("./CrjNuryZ.js")),
1942
+ function: T(() => import("./CvdSjw1c.js")),
1943
+ "radio-on": T(() => import("./nmdo2Fbj.js")),
1944
+ "radio-off": T(() => import("./BnZcRFmS.js")),
1945
+ confluence: T(() => import("./BOnlh2zd.js")),
1946
+ zendesk: T(() => import("./BAJ6LEKc.js")),
1947
+ salesforce: T(() => import("./CT2kv4lr.js")),
1948
+ sprinklr: T(() => import("./m2INcyV2.js")),
1949
+ website: T(() => import("./BgGVGNdg.js")),
1950
+ snippet: T(() => import("./BFcXPuf5.js")),
1951
+ template: T(() => import("./awO7aBCv.js")),
1952
+ source: T(() => import("./_EVMCh6Y.js"))
1953
+ }, M = ({ type: e, size: t = 24, className: n, color: o }) => {
1954
+ const s = As[e];
1955
+ return /* @__PURE__ */ r.createElement(
1956
+ Is,
1957
+ {
1958
+ className: n,
1959
+ $rtlFlip: ws.has(e),
1960
+ $size: t,
1961
+ $color: o ?? p.color.primary.main
1962
+ },
1963
+ /* @__PURE__ */ r.createElement(ke, { fallback: null }, /* @__PURE__ */ r.createElement(s, null))
1964
+ );
1965
+ }, ks = I`[dir='rtl'] &{transform:scaleX(-1);}`, Is = u.div`width:${({ $size: e }) => j(e)};height:${({ $size: e }) => j(e)};display:inline-block;&:focus{outline:none;}svg{display:block;}[class*='fill']{fill:${({ $color: e }) => e};}[class*='stroke']{stroke:${({ $color: e }) => e};stroke-width:2px;stroke-linejoin:round;}${({ $rtlFlip: e }) => e && ks};`;
1966
+ function At({
1967
+ name: e,
1968
+ type: t = "FILE",
1969
+ iconColor: n,
1970
+ iconBackgroundColor: o,
1971
+ onClick: s
1972
+ }) {
1973
+ const { colors: i } = xt();
1974
+ return /* @__PURE__ */ r.createElement($s, { onClick: s, $clickable: !!s }, /* @__PURE__ */ r.createElement(Os, { $bgColor: o ?? i.base.primary }, /* @__PURE__ */ r.createElement(M, { type: "file-document", size: 24, color: n ?? i.base.primaryContrastContent })), /* @__PURE__ */ r.createElement(Ls, null, /* @__PURE__ */ r.createElement(Rs, { variant: "button", color: p.themedColor.textHighEmphasis }, e), /* @__PURE__ */ r.createElement(w, { color: p.themedColor.textMidEmphasis, variant: "caption3" }, t)));
1975
+ }
1976
+ const $s = u.div`border-radius:12px;gap:8px;width:${Le}px;height:64px;display:flex;align-items:center;padding:12px;box-sizing:border-box;border:1px solid ${p.themedColor.textDisabled};background-color:${p.themedColor.bg_50_600};${({ $clickable: e }) => e && Ms}`, Ms = I`cursor:pointer;&:hover{background-color:${p.themedColor.bg_100_500};}`, Os = u.div`border-radius:8px;width:40px;height:40px;display:flex;align-items:center;justify-content:center;background-color:${({ $bgColor: e }) => e};`, Ls = u.div`display:flex;flex:1;flex-direction:column;gap:4px;min-width:0;`, Rs = u(w)`text-overflow:ellipsis;white-space:nowrap;overflow:hidden;`;
1977
+ function Ds({ file: e, children: t, onClickFile: n }) {
1978
+ return /* @__PURE__ */ r.createElement(Ns, null, /* @__PURE__ */ r.createElement(
1979
+ At,
1980
+ {
1981
+ name: e.name,
1982
+ type: wt(e.name, e.type),
1983
+ onClick: n && (() => n == null ? void 0 : n(e))
1984
+ }
1985
+ ), t);
1986
+ }
1987
+ const Ns = u.div`display:flex;flex-direction:column;align-items:flex-start;gap:${Te}px;`;
1988
+ function Ps({ file: e, onClickMedia: t, children: n }) {
1989
+ const o = () => e.type.startsWith("image") ? /* @__PURE__ */ r.createElement(Us, { src: e.url, alt: "image-message" }) : e.type.startsWith("video") ? /* @__PURE__ */ r.createElement(Hs, { controls: !0 }, /* @__PURE__ */ r.createElement("source", { src: e.url }), /* @__PURE__ */ r.createElement("track", { kind: "captions" })) : null;
1990
+ if (o) {
1991
+ const s = {
1992
+ id: `${ne}-media-body`,
1993
+ onClick: () => t == null ? void 0 : t(e)
1994
+ };
1995
+ return /* @__PURE__ */ r.createElement(Bs, null, /* @__PURE__ */ r.createElement(Fs, { ...s }, o()), n);
1996
+ }
1997
+ return null;
1998
+ }
1999
+ const Bs = u.div`display:flex;flex-direction:column;align-items:flex-start;gap:${Te}px;`, Fs = u.div`width:${Le}px;height:160px;border-radius:12px;overflow:hidden;cursor:pointer;${P.light`
2000
+ background-color: ${p.color.background100};
2001
+ `}
2002
+ ${P.dark`
2003
+ background-color: ${p.color.background400};
2004
+ `}
2005
+ `, Us = u.img`width:100%;height:100%;object-fit:cover;`, Hs = u.video`width:100%;height:100%;object-fit:cover;`, zs = "✱";
2006
+ function Nn(e) {
2007
+ const t = new RegExp(`${zs}+`, "g");
2008
+ return e.replace(t, (n) => `<span id=${Ts} aria-label="masked-text">${n}</span>`);
2009
+ }
2010
+ function Vs(e) {
2011
+ return e.replace(/\*\*(.*?)\*\*/g, "<b>$1</b>");
2012
+ }
2013
+ function Ws(e) {
2014
+ const t = /```(\w+)?\n([\s\S]*?)```/g, n = [];
2015
+ let o = 0;
2016
+ return e.replace(t, (s, ...i) => {
2017
+ const [a, l, c] = i;
2018
+ return o < c && n.push({
2019
+ type: "text",
2020
+ value: e.slice(o, c).trim()
2021
+ }), n.push({
2022
+ type: "code",
2023
+ value: l.trim(),
2024
+ language: a ? a.trim() : "plaintext"
2025
+ }), o = c + s.length, s;
2026
+ }), o < e.length && n.push({
2027
+ type: "text",
2028
+ value: e.slice(o).trim()
2029
+ }), n.map((s) => s.type !== "text" ? s : { ...s, value: Nn(s.value) });
2030
+ }
2031
+ const Gs = T(async () => ({ default: (await import("./CwdCJ7xG.js")).MarkdownText })), js = T(async () => ({ default: (await import("./Ch_6OPTz.js")).CodeBlock }));
2032
+ function Jt(e) {
2033
+ var s, i;
2034
+ const t = e.maxBodyWidth ?? Le, n = ae(() => Ws(e.message), [e.message]), o = {
2035
+ id: `${ne}-text-body`,
2036
+ $maxWidth: t,
2037
+ $color: (s = e.customStyle) == null ? void 0 : s.bubbleContentColor,
2038
+ $bgColor: (i = e.customStyle) == null ? void 0 : i.bubbleBackgroundColor
2039
+ };
2040
+ return n.length === 0 ? e.children ? /* @__PURE__ */ r.createElement(Xt, { ...o }, e.children) : null : /* @__PURE__ */ r.createElement(Xt, { ...o }, n.map((a, l) => a.type === "text" ? /* @__PURE__ */ r.createElement(Qt, { key: l, variant: "body3" }, /* @__PURE__ */ r.createElement(ke, { fallback: a.value }, /* @__PURE__ */ r.createElement(Gs, { onClickImage: (c) => {
2041
+ var d;
2042
+ return (d = e.onClickMedia) == null ? void 0 : d.call(e, { url: c, type: "image/*" });
2043
+ } }, a.value))) : a.type === "code" ? /* @__PURE__ */ r.createElement(ke, { key: l, fallback: /* @__PURE__ */ r.createElement(Qt, { variant: "body3" }, a.value) }, /* @__PURE__ */ r.createElement(js, { code: a.value, language: a.language })) : null), e.children);
2044
+ }
2045
+ const Xt = u.div`display:flex;flex-direction:column;border-radius:12px;overflow:hidden;max-width:${({ $maxWidth: e }) => e}px;${({ theme: e, $color: t, $bgColor: n }) => I`
2046
+ color: ${t || e.colors.messageIncoming.text};
2047
+ background-color: ${n || e.colors.messageIncoming.background};
2048
+ `}
2049
+ padding: 12px 0;
2050
+ transition: max-width 0.3s;
2051
+ overflow-wrap: break-word;
2052
+ `, Qt = u(w)`align-items:flex-start;line-height:140%;white-space:pre-wrap;padding:0 12px;`;
2053
+ function Ks(e) {
2054
+ const { stringSet: t } = O(), n = Dn(e) ? /* @__PURE__ */ r.createElement(Jt, { ...e }) : null;
2055
+ if (e.messageType === "user")
2056
+ return n;
2057
+ if (e.messageType === "file") {
2058
+ const o = e.file;
2059
+ return o.type.startsWith("image") || o.type.startsWith("video") ? /* @__PURE__ */ r.createElement(Ps, { ...e }, n) : /* @__PURE__ */ r.createElement(Ds, { ...e }, n);
2060
+ }
2061
+ return /* @__PURE__ */ r.createElement(Jt, { ...e, message: t.UNKNOWN__UNKNOWN_MESSAGE_TYPE });
2062
+ }
2063
+ const kt = (e) => /* @__PURE__ */ r.createElement("svg", { width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ r.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12.0008 0.973633C10.6172 0.973633 9.49558 2.09527 9.49558 3.47888C9.49558 4.50705 10.115 5.39055 11.0009 5.77664V7.47887H13.0009V5.77653C13.8868 5.3904 14.5061 4.50696 14.5061 3.47888C14.5061 2.09527 13.3844 0.973633 12.0008 0.973633ZM0.250977 16.5788L0.250977 10.5789H2.25098L2.25098 16.5788H0.250977ZM21.7511 10.5789V16.5788H23.7511V10.5789H21.7511ZM18.251 7.47888H3.25097V18.9789C3.25097 20.3596 4.37026 21.4789 5.75097 21.4789H18.251C19.6317 21.4789 20.751 20.3596 20.751 18.9789V9.97887C20.751 8.59816 19.6317 7.47888 18.251 7.47888ZM9.78434 11.9539V15.2038C9.78434 15.7561 9.33663 16.2038 8.78434 16.2038C8.23206 16.2038 7.78434 15.7561 7.78434 15.2038V11.9539C7.78434 11.4016 8.23206 10.9539 8.78434 10.9539C9.33663 10.9539 9.78434 11.4016 9.78434 11.9539ZM16.2677 11.9539V15.2038C16.2677 15.7561 15.82 16.2038 15.2677 16.2038C14.7154 16.2038 14.2677 15.7561 14.2677 15.2038V11.9539C14.2677 11.4016 14.7154 10.9539 15.2677 10.9539C15.82 10.9539 16.2677 11.4016 16.2677 11.9539Z", fill: "#0D0D0D" }));
2064
+ function It({ id: e, src: t, size: n = 56, onClick: o, style: s }) {
2065
+ return /* @__PURE__ */ r.createElement(Zs, { id: e, tabIndex: 0, onClick: o, $size: j(n), style: s }, t ? /* @__PURE__ */ r.createElement(Ys, { src: t }) : /* @__PURE__ */ r.createElement(M, { type: "user", size: n }));
2066
+ }
2067
+ const Zs = u.div`border-radius:50%;display:inline-block;overflow:hidden;position:relative;flex-shrink:0;height:${(e) => e.$size};width:${(e) => e.$size};background-color:${p.themedColor.bg_100_500};&:focus{outline:none;}`, Ys = u.img`object-fit:cover;width:100%;height:100%;position:absolute;`;
2068
+ function qs({ sender: e, isBotMessage: t }) {
2069
+ const n = `${ne}-sender-avatar`;
2070
+ return !e.profileUrl && t ? /* @__PURE__ */ r.createElement(Js, { id: n }, /* @__PURE__ */ r.createElement(kt, null)) : /* @__PURE__ */ r.createElement(It, { id: n, size: Ye, src: e.profileUrl });
2071
+ }
2072
+ const Js = u.div`flex-shrink:0;width:${Ye}px;height:${Ye}px;box-sizing:border-box;padding:6px;border-radius:50%;display:flex;justify-content:center;align-items:center;background-color:${({ theme: e }) => e.colors.base.primary};path{fill:${({ theme: e }) => e.colors.base.primaryContrastContent};}}`;
2073
+ function Xs({ sender: e }) {
2074
+ return /* @__PURE__ */ r.createElement(Qs, { id: `${ne}-sender-name`, variant: "caption1", color: p.themedColor.textMidEmphasis }, e.nickname);
2075
+ }
2076
+ const Qs = u(w)`text-align:start;width:100%;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-block:5px;padding-inline:0 7px;`;
2077
+ function ei({ createdAt: e }) {
2078
+ const { stringSet: t, format: n } = O();
2079
+ return e ? /* @__PURE__ */ r.createElement(w, { id: `${ne}-sent-time`, variant: "caption4", color: p.themedColor.textLowEmphasis }, n(e, t.DATE_FORMAT__MESSAGE_TIMESTAMP)) : null;
2080
+ }
2081
+ function ti({ customStyle: e }) {
2082
+ return /* @__PURE__ */ r.createElement(ni, { $bgColor: e == null ? void 0 : e.bubbleBackgroundColor }, [0, 1, 2].map((t) => /* @__PURE__ */ r.createElement(ri, { key: t, $color: e == null ? void 0 : e.bubbleContentColor })));
2083
+ }
2084
+ const ni = u.div`align-items:center;border-radius:12px;display:flex;gap:6px;justify-content:center;padding:16px 12px;background-color:${({ theme: e, $bgColor: t }) => t || e.colors.messageIncoming.background};`, ri = u.span`animation:blink 1.4s infinite;animation-fill-mode:both;border-radius:50%;height:8px;width:8px;background:${({ theme: e, $color: t }) => t || e.colors.messageIncoming.text};@keyframes blink{0%{opacity:0.12;transform:scale(1);}21.43%{opacity:0.38;transform:scale(1.2);}42.86%{opacity:0.12;transform:scale(1);}100%{opacity:0.12;transform:scale(1);}}&:nth-child(1){animation-delay:0.4s;}&:nth-child(2){animation-delay:0.6s;}&:nth-child(3){animation-delay:0.8s;}`;
2085
+ function Ie() {
2086
+ }
2087
+ async function $t(e) {
2088
+ let t = e;
2089
+ t && (!t.startsWith("http://") && !t.startsWith("https://") && (t = "https://" + t), window.open(t, "_blank", "noopener,noreferrer"));
2090
+ }
2091
+ function Pn(e) {
2092
+ return !e || !e.conversation ? !1 : e.conversation.status === W.CLOSED;
2093
+ }
2094
+ function Bn(e) {
2095
+ return !e || !e.conversation ? !1 : e.conversation.status === W.OPEN;
2096
+ }
2097
+ function Fn(e) {
2098
+ var n;
2099
+ const t = (n = e == null ? void 0 : e.conversation) == null ? void 0 : n.handoff;
2100
+ return !!(t != null && t.timestamp);
2101
+ }
2102
+ function oi(e) {
2103
+ return Bn(e) && !Fn(e);
2104
+ }
2105
+ function si({
2106
+ extendedMessagePayload: e,
2107
+ onClickCTA: t = ({ url: n }) => $t(n)
2108
+ }) {
2109
+ const n = e == null ? void 0 : e.cta_button;
2110
+ return n ? /* @__PURE__ */ r.createElement(ii, { id: `${ne}-ext-cta-button`, role: "button", onClick: () => t(n) }, /* @__PURE__ */ r.createElement(ai, { variant: "button" }, n.label)) : null;
2111
+ }
2112
+ const ii = u.div`display:flex;align-items:center;justify-content:center;cursor:pointer;border-radius:6px;padding:8px;color:${p.themedColor.textHighEmphasis};background-color:${p.color.background50};${P.dark`
2113
+ background-color: ${p.color.ondark.textDisabled};
2114
+ `}
2115
+ `, ai = u(w)`overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`;
2116
+ function li({
2117
+ extendedMessagePayload: e,
2118
+ onClickCitation: t = (n) => $t(n.link)
2119
+ }) {
2120
+ const { stringSet: n } = O(), { theme: o } = Ct(), s = e == null ? void 0 : e.citations;
2121
+ return !s || s.length === 0 ? null : /* @__PURE__ */ r.createElement(ci, { id: `${ne}-ext-citation` }, /* @__PURE__ */ r.createElement(di, { variant: "caption1", color: o.colors.messageIncoming.text }, n.CITATION_SOURCE_TITLE), /* @__PURE__ */ r.createElement(ui, null, s.map((i, a) => /* @__PURE__ */ r.createElement(
2122
+ gi,
2123
+ {
2124
+ key: `${i.embedding_id}-${a}`,
2125
+ role: "button",
2126
+ onClick: () => t(i)
2127
+ },
2128
+ /* @__PURE__ */ r.createElement(M, { type: "source", size: 16, color: o.colors.messageIncoming.text }),
2129
+ /* @__PURE__ */ r.createElement(mi, { variant: "body3", color: o.colors.messageIncoming.text }, i.title)
2130
+ ))));
2131
+ }
2132
+ const ci = u.div`display:flex;flex-direction:column;gap:8px;border-radius:8px;padding:8px 12px 6px;`, di = u(w)`opacity:0.5;`, ui = u.div`display:flex;flex-direction:column;gap:8px;`, mi = u(w)`text-decoration:underline;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`, gi = u.div`display:flex;align-items:center;gap:4px;cursor:pointer;&:hover{opacity:0.5;}`;
2133
+ function hi(e) {
2134
+ return /* @__PURE__ */ r.createElement(r.Fragment, null);
2135
+ }
2136
+ class pi extends xr {
2137
+ constructor(t) {
2138
+ super(t), this.state = {
2139
+ hasError: !1
2140
+ };
2141
+ }
2142
+ static getDerivedStateFromError() {
2143
+ return { hasError: !0 };
2144
+ }
2145
+ render() {
2146
+ return this.state.hasError ? this.props.errorFallback : /* @__PURE__ */ r.createElement(ke, { fallback: this.props.loadingFallback }, this.props.children);
2147
+ }
2148
+ }
2149
+ const fi = /* @__PURE__ */ new Set(["default"]), { MessageTemplate: bi } = zr({
2150
+ parser: Ur,
2151
+ renderer: Fr,
2152
+ Container: (e) => /* @__PURE__ */ r.createElement("div", { ...e })
2153
+ });
2154
+ function Ei(e) {
2155
+ return /* @__PURE__ */ r.createElement(
2156
+ pi,
2157
+ {
2158
+ errorFallback: e.messageTemplateErrorFallback,
2159
+ loadingFallback: e.messageTemplateLoadingFallback
2160
+ },
2161
+ /* @__PURE__ */ r.createElement(xi, { ...e })
2162
+ );
2163
+ }
2164
+ const xi = ({
2165
+ extendedMessagePayload: e,
2166
+ onGetCachedMessageTemplate: t = () => null,
2167
+ onRequestMessageTemplate: n,
2168
+ onHandleTemplateInternalAction: o = Ie
2169
+ }) => {
2170
+ const s = e == null ? void 0 : e.message_template;
2171
+ if (!fi.has((s == null ? void 0 : s.type) ?? "default")) throw new Error("Unsupported template type");
2172
+ if (!n) throw new Error("onRequestMessageTemplate is required");
2173
+ const { theme: a } = ls(), l = Zo({
2174
+ onRequestTemplate: n,
2175
+ onGetCachedTemplate: t,
2176
+ theme: a.selectedTheme,
2177
+ templateKey: (s == null ? void 0 : s.key) ?? "invalid",
2178
+ variables: s == null ? void 0 : s.variables,
2179
+ viewVariables: s == null ? void 0 : s.view_variables,
2180
+ aiAgentColorVariables: a.aiAgentColorVariables
2181
+ });
2182
+ return /* @__PURE__ */ r.createElement(Ci, { id: `${ne}-ext-message-template` }, /* @__PURE__ */ r.createElement(
2183
+ Hr,
2184
+ {
2185
+ handleInternalAction: (c, d) => {
2186
+ c.stopPropagation(), o == null || o(d);
2187
+ }
2188
+ },
2189
+ /* @__PURE__ */ r.createElement(bi, { templateItems: l.body.items, templateVersion: l.version })
2190
+ ));
2191
+ }, Ci = u.div`box-sizing:border-box;overflow:hidden;width:100%;`;
2192
+ function vi({
2193
+ extendedMessagePayload: e,
2194
+ onClickSuggestedReply: t,
2195
+ suggestedRepliesDirection: n = "vertical"
2196
+ }) {
2197
+ const [o, s] = _(!1), i = (e == null ? void 0 : e.suggested_replies) ?? [];
2198
+ return i.length === 0 || o ? null : /* @__PURE__ */ r.createElement(yi, { id: `${ne}-ext-suggested-replies`, $type: n }, i.map((a, l) => /* @__PURE__ */ r.createElement(
2199
+ _i,
2200
+ {
2201
+ key: l,
2202
+ $type: n,
2203
+ variant: "body3",
2204
+ onClick: () => {
2205
+ t && (t == null || t({ reply: a }), s(!0));
2206
+ }
2207
+ },
2208
+ a
2209
+ )));
2210
+ }
2211
+ const yi = u.div`margin:16px 0;padding:0 ${te}px;position:relative;display:flex;gap:8px;${({ $type: e }) => e === "vertical" ? Si : Ti};`, _i = u(w)`box-sizing:border-box;padding:8px 12px;display:flex;align-items:center;border-radius:20px / clamp(20px,5%,100px);cursor:pointer;word-break:break-word;color:${p.color.primary.main};border:1px solid ${p.color.primary.main};background-color:${p.themedColor.bg_50_600};&:hover{background-color:${p.themedColor.bg_100_500};}${({ $type: e, theme: t }) => I`
2212
+ ${e === "vertical" ? wi : Ai};
2213
+ &:active {
2214
+ background-color: ${t.colors.base.primary};
2215
+ color: ${t.colors.base.primaryContrastContent};
2216
+ }
2217
+ `}
2218
+ `, Si = I`flex-direction:column;align-items:flex-end;`, Ti = I`flex-direction:row;overflow-x:scroll;-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}`, wi = I`max-width:calc(100% - 70px);white-space:pre-wrap;`, Ai = I`white-space:nowrap;`;
2219
+ function Mt(e) {
2220
+ return e();
2221
+ }
2222
+ const xe = _e({
2223
+ template: ki,
2224
+ components: {
2225
+ SenderName: Xs,
2226
+ SenderAvatar: qs,
2227
+ SentTime: ei,
2228
+ MessageBody: Ks,
2229
+ TypingIndicator: ti,
2230
+ SuggestedReplies: vi,
2231
+ MessageTemplate: Ei,
2232
+ CTAButton: si,
2233
+ Citation: li,
2234
+ MessageLogs: hi
2235
+ }
2236
+ });
2237
+ function ki(e) {
2238
+ return /* @__PURE__ */ r.createElement(Un, { ...e, testerMode: !1 });
2239
+ }
2240
+ function Un(e) {
2241
+ var f, x, E, b, g;
2242
+ const { components: t } = xe.useContext(), n = !!e.isTyping, o = e.testerMode, s = !!((f = e.extendedMessagePayload) != null && f.message_template), i = !!((x = e.extendedMessagePayload) != null && x.cta_button), a = !!((E = e.extendedMessagePayload) != null && E.citations) && e.extendedMessagePayload.citations.length > 0, l = !!e.createdAt, c = Mt(() => e.messageType === "user" ? e.message.length > 0 : !0), d = e.groupType === "top" || e.groupType === "single", h = e.groupType === "bottom" || e.groupType === "single", m = o ? 0 : Ye;
2243
+ return /* @__PURE__ */ r.createElement(Ii, { $marginBottom: n ? 0 : Tt(e.groupType) }, d && /* @__PURE__ */ r.createElement($i, null, !o && /* @__PURE__ */ r.createElement(t.SenderAvatar, { ...e }), /* @__PURE__ */ r.createElement(t.SenderName, { ...e })), /* @__PURE__ */ r.createElement(Ut, null, /* @__PURE__ */ r.createElement(at, { $extraStartPadding: m }, n && /* @__PURE__ */ r.createElement(t.TypingIndicator, { ...e }), /* @__PURE__ */ r.createElement(t.MessageBody, { ...e }, i && /* @__PURE__ */ r.createElement("div", { style: { marginTop: 12, marginInline: 12 } }, /* @__PURE__ */ r.createElement(t.CTAButton, { ...e })), a && /* @__PURE__ */ r.createElement(t.Citation, { ...e }))), s && /* @__PURE__ */ r.createElement(en, { $startPadding: 0, $endPadding: 0, style: { marginTop: c ? Te : 0 } }, /* @__PURE__ */ r.createElement(
2244
+ t.MessageTemplate,
2245
+ {
2246
+ ...e,
2247
+ messageTemplateErrorFallback: e.messageTemplateErrorFallback ?? /* @__PURE__ */ r.createElement(at, { $extraStartPadding: m }, /* @__PURE__ */ r.createElement(
2248
+ t.MessageBody,
2249
+ {
2250
+ ...e,
2251
+ messageType: "user",
2252
+ message: ((g = (b = e.extendedMessagePayload) == null ? void 0 : b.message_template) == null ? void 0 : g.fallback_message) ?? "Cannot read this template."
2253
+ }
2254
+ )),
2255
+ messageTemplateLoadingFallback: e.messageTemplateLoadingFallback ?? /* @__PURE__ */ r.createElement(at, { $extraStartPadding: m }, /* @__PURE__ */ r.createElement(t.TypingIndicator, { ...e }))
2256
+ }
2257
+ ))), h && l && /* @__PURE__ */ r.createElement(Mi, { $extraStartPadding: m + 8 }, /* @__PURE__ */ r.createElement(t.SentTime, { ...e })), /* @__PURE__ */ r.createElement(Ut, null, e.suggestedRepliesVisible && /* @__PURE__ */ r.createElement(en, null, /* @__PURE__ */ r.createElement(t.SuggestedReplies, { ...e })), /* @__PURE__ */ r.createElement(t.MessageLogs, { ...e })));
2258
+ }
2259
+ const Ii = u.div`display:flex;flex-direction:column;align-items:flex-start;margin-bottom:${({ $marginBottom: e }) => `${e}px`};
2260
+ `, tt = u.div`display:flex;align-self:stretch;justify-content:flex-start;${({ $startPadding: e = te, $endPadding: t = te, $extraStartPadding: n = 0 }) => `
2261
+ padding-inline: ${e + n}px ${t}px;
2262
+ `}
2263
+ `, $i = u(tt)`display:flex;flex-direction:row;align-items:center;gap:8px;`, at = u(tt)`display:flex;`, Mi = u(tt)`margin-top:${Rn}px;display:flex;align-items:flex-start;justify-content:flex-start;`, en = u(tt)`display:flex;flex-direction:column;${({ $startPadding: e = te, $endPadding: t = te, $extraStartPadding: n = 0 }) => `
2264
+ padding-inline: ${e + n}px ${t}px;
2265
+ `}
2266
+ `;
2267
+ function Oi({ file: e, children: t, onClickFile: n }) {
2268
+ return /* @__PURE__ */ r.createElement(Li, null, /* @__PURE__ */ r.createElement(
2269
+ At,
2270
+ {
2271
+ name: e.name,
2272
+ type: wt(e.name, e.type),
2273
+ onClick: n && (() => n == null ? void 0 : n(e))
2274
+ }
2275
+ ), t);
2276
+ }
2277
+ const Li = u.div`display:flex;flex-direction:column;align-items:flex-end;gap:${Te}px;`, Hn = ({ className: e, children: t, size: n = 26 }) => /* @__PURE__ */ r.createElement(Ri, { className: e, $size: n }, t ?? /* @__PURE__ */ r.createElement(M, { type: "spinner", size: n })), Ri = u.div`display:flex;align-items:center;justify-content:center;width:${({ $size: e }) => j(e)};height:${({ $size: e }) => j(e)};animation:1s infinite linear;animation-name:rotate;@keyframes rotate{from{transform:rotate(0);}to{transform:rotate(360deg);}}`;
2278
+ function Di({ file: e, metadata: t, onClickMedia: n, children: o }) {
2279
+ const { aspectRatio: s, localFile: i } = t, [a] = _(() => i instanceof File ? URL.createObjectURL(i) : e.url), [l, c] = _(!1), d = {
2280
+ onClick: () => n == null ? void 0 : n(e),
2281
+ $ratio: s
2282
+ };
2283
+ return /* @__PURE__ */ r.createElement(Ni, null, /* @__PURE__ */ r.createElement(Pi, { ...d }, !l && /* @__PURE__ */ r.createElement(Hn, { size: 26 }, /* @__PURE__ */ r.createElement(M, { type: "spinner", color: "textLowEmphasis", size: 26 })), /* @__PURE__ */ r.createElement(Bi, { $loaded: l, src: a, alt: "image-message", onLoad: () => c(!0) })), o);
2284
+ }
2285
+ const Ni = u.div`display:flex;flex-direction:column;align-items:flex-end;gap:${Te}px;`, Pi = u.div`width:${Le}px;border-radius:12px;overflow:hidden;cursor:pointer;height:auto;aspect-ratio:${(e) => e.$ratio};position:relative;display:flex;align-items:center;justify-content:center;${P.light`
2286
+ background-color: ${p.color.background100};
2287
+ `}
2288
+ ${P.dark`
2289
+ background-color: ${p.color.background400};
2290
+ `}
2291
+ `, Bi = u.img`position:absolute;width:100%;height:100%;inset-block-start:0;inset-inline-start:0;object-fit:cover;opacity:${(e) => e.$loaded ? 1 : 0};transition:opacity 0.5s ease;`;
2292
+ function tn(e) {
2293
+ var n, o;
2294
+ const t = ae(() => {
2295
+ const s = Vs(Nn(e.message));
2296
+ return yn.sanitize(s);
2297
+ }, [e.message]);
2298
+ return /* @__PURE__ */ r.createElement(
2299
+ Fi,
2300
+ {
2301
+ $maxWidth: e.maxBodyWidth ?? Le,
2302
+ $color: (n = e.customStyle) == null ? void 0 : n.bubbleContentColor,
2303
+ $bgColor: (o = e.customStyle) == null ? void 0 : o.bubbleBackgroundColor
2304
+ },
2305
+ /* @__PURE__ */ r.createElement(Ui, { variant: "body3", dangerouslySetInnerHTML: { __html: t } })
2306
+ );
2307
+ }
2308
+ const Fi = u.div`display:flex;flex-direction:column;border-radius:12px;overflow:hidden;max-width:${({ $maxWidth: e }) => e}px;${({ theme: e, $color: t, $bgColor: n }) => I`
2309
+ color: ${t || e.colors.messageOutgoing.text};
2310
+ background-color: ${n || e.colors.messageOutgoing.background};
2311
+ `}
2312
+ padding: 12px 0;
2313
+ transition: max-width 0.3s;
2314
+ overflow-wrap: break-word;
2315
+ `, Ui = u(w)`align-items:flex-start;line-height:140%;white-space:pre-wrap;padding:0 12px;`;
2316
+ function Hi(e) {
2317
+ const { stringSet: t } = O(), n = Dn(e) ? /* @__PURE__ */ r.createElement(tn, { ...e }) : null;
2318
+ return e.messageType === "user" ? n : e.messageType === "file" ? e.file.type.startsWith("image") ? /* @__PURE__ */ r.createElement(Di, { ...e }, n) : /* @__PURE__ */ r.createElement(Oi, { ...e }, n) : /* @__PURE__ */ r.createElement(tn, { ...e, message: t.UNKNOWN__UNKNOWN_MESSAGE_TYPE });
2319
+ }
2320
+ function zi({ sendingStatus: e }) {
2321
+ const t = xt();
2322
+ switch (e) {
2323
+ case "pending":
2324
+ return /* @__PURE__ */ r.createElement(Vi, { size: 16 }, /* @__PURE__ */ r.createElement(M, { type: "spinner", color: t.colors.messageOutgoing.background, size: 16 }));
2325
+ case "failed":
2326
+ return /* @__PURE__ */ r.createElement("div", { style: { marginBottom: 2 } }, /* @__PURE__ */ r.createElement(M, { type: "error", color: p.themedColor.error, size: 16 }));
2327
+ case "scheduled":
2328
+ case "canceled":
2329
+ return null;
2330
+ default:
2331
+ return /* @__PURE__ */ r.createElement("div", null, /* @__PURE__ */ r.createElement(M, { type: "chevron-down" }));
2332
+ }
2333
+ }
2334
+ const Vi = u(Hn)`margin-bottom:2px;width:16px;height:16px;`;
2335
+ function Wi({ createdAt: e }) {
2336
+ const { stringSet: t, format: n } = O();
2337
+ return e ? /* @__PURE__ */ r.createElement(w, { variant: "caption4", color: p.themedColor.textLowEmphasis }, n(e, t.DATE_FORMAT__MESSAGE_TIMESTAMP)) : null;
2338
+ }
2339
+ const Ot = _e({
2340
+ template: Gi,
2341
+ components: {
2342
+ SendingStatus: zi,
2343
+ SentTime: Wi,
2344
+ MessageBody: Hi
2345
+ }
2346
+ });
2347
+ function Gi(e) {
2348
+ const { components: t } = Ot.useContext(), n = e.sendingStatus === "succeeded", o = e.groupType === "bottom" || e.groupType === "single";
2349
+ return /* @__PURE__ */ r.createElement(ji, { $marginBottom: Tt(e.groupType) }, /* @__PURE__ */ r.createElement(Ki, null, /* @__PURE__ */ r.createElement(t.MessageBody, { ...e })), o && /* @__PURE__ */ r.createElement(Zi, { $extraEndPadding: 8 }, n ? /* @__PURE__ */ r.createElement(t.SentTime, { ...e }) : /* @__PURE__ */ r.createElement(t.SendingStatus, { ...e })));
2350
+ }
2351
+ const ji = u.div`display:flex;flex:1;flex-direction:column;align-items:flex-end;margin-bottom:${({ $marginBottom: e }) => `${e}px`};
2352
+ `, zn = u.div`display:flex;align-self:stretch;justify-content:flex-end;${({ $startPadding: e = te, $endPadding: t = te, $extraEndPadding: n = 0 }) => `padding-inline: ${e}px ${t + n}px;`};
2353
+ `, Ki = u(zn)``, Zi = u(zn)`margin-top:${Rn}px;`;
2354
+ function Yi(e) {
2355
+ return e.messageType !== "admin" ? null : /* @__PURE__ */ r.createElement(qi, null, /* @__PURE__ */ r.createElement(w, { variant: "caption2", color: p.themedColor.textMidEmphasis }, Ji(yn.sanitize(e.message))));
2356
+ }
2357
+ const qi = u.div`text-align:center;text-wrap:pretty;a{text-decoration:none;color:inherit;}`, Ji = (e) => {
2358
+ const t = /\[([^\]]+)\]\((https?:\/\/[^\s]+)\)/g, n = [];
2359
+ let o = 0;
2360
+ return e.replace(t, (s, i, a, l) => (n.push(e.slice(o, l)), n.push(
2361
+ /* @__PURE__ */ r.createElement("a", { key: a, href: a, target: "_blank", rel: St }, i)
2362
+ ), o = l + s.length, s)), n.push(e.slice(o)), n;
2363
+ }, Xi = ({ submitted: e, defaultValue: t, value: n, onChange: o }) => {
2364
+ const { stringSet: s } = O();
2365
+ return L(() => {
2366
+ typeof n > "u" && typeof t == "boolean" && (o == null || o(t));
2367
+ }, [n, t]), /* @__PURE__ */ r.createElement(Qi, null, /* @__PURE__ */ r.createElement(w, { variant: "caption2", color: p.themedColor.textMidEmphasis }, s.CSAT_CRE_TITLE), /* @__PURE__ */ r.createElement("div", null, /* @__PURE__ */ r.createElement(
2368
+ nn,
2369
+ {
2370
+ checked: n === !0,
2371
+ label: s.CSAT_CRE_SOLVED,
2372
+ disabled: e,
2373
+ onClick: () => o == null ? void 0 : o(!0)
2374
+ }
2375
+ ), /* @__PURE__ */ r.createElement(
2376
+ nn,
2377
+ {
2378
+ checked: n === !1,
2379
+ label: s.CSAT_CRE_NOT_SOLVED,
2380
+ disabled: e,
2381
+ onClick: () => o == null ? void 0 : o(!1)
2382
+ }
2383
+ )));
2384
+ }, nn = ({ onClick: e, checked: t, label: n, disabled: o }) => {
2385
+ const s = t ? p.color.primary.main : o ? p.themedColor.textDisabled : p.themedColor.textLowEmphasis, i = t ? p.themedColor.textHighEmphasis : o ? p.themedColor.textLowEmphasis : p.themedColor.textHighEmphasis;
2386
+ return /* @__PURE__ */ r.createElement(ea, { onClick: e, disabled: o }, /* @__PURE__ */ r.createElement(M, { size: 24, type: t ? "radio-on" : "radio-off", color: s }), /* @__PURE__ */ r.createElement(w, { variant: "caption2", color: i }, n));
2387
+ }, Qi = u.div`display:flex;flex-direction:column;gap:8px;`, ea = u.button`all:unset;display:flex;align-items:center;justify-content:flex-start;gap:2px;span{line-height:initial;}&:enabled{cursor:pointer;}`, ta = (e) => /* @__PURE__ */ r.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", id: "csat1", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M2.08301 20C2.08301 10.1049 10.1046 2.08334 19.9997 2.08334C29.8948 2.08334 37.9163 10.1049 37.9163 20C37.9163 29.8952 29.8948 37.9167 19.9997 37.9167C10.1046 37.9167 2.08301 29.8952 2.08301 20Z", fill: "#E0E0E0" }), /* @__PURE__ */ r.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12.5824 29.3328C13.1344 29.7473 13.918 29.636 14.3326 29.084C15.6269 27.3607 17.6835 26.25 19.9997 26.25C22.316 26.25 24.3727 27.3607 25.6668 29.084C26.0815 29.636 26.865 29.7473 27.4172 29.3328C27.9692 28.9182 28.0805 28.1347 27.6658 27.5825C25.9198 25.2577 23.1357 23.75 19.9997 23.75C16.8638 23.75 14.0797 25.2577 12.3336 27.5825C11.919 28.1347 12.0304 28.9182 12.5824 29.3328Z", fill: "black", fillOpacity: 0.12 }), /* @__PURE__ */ r.createElement("path", { d: "M28.4449 13.7707C29.1324 13.8328 29.64 14.4406 29.578 15.1281C29.516 15.8153 28.909 16.3221 28.2219 16.2608C28.2219 16.2608 28.0282 16.2502 27.9267 16.2487C27.7224 16.2457 27.4382 16.2509 27.1224 16.2833C26.7864 16.3177 26.4644 16.3782 26.1799 16.4662L26.304 16.86C26.7792 18.3675 25.5094 19.5813 24.2057 19.5813C23.504 19.5813 22.8319 19.2617 22.4295 18.6857C22.0025 18.0745 21.9417 17.241 22.4075 16.5344C22.7505 16.0143 23.2444 15.3831 23.8959 14.8657C24.8355 14.1195 26.0435 13.8809 26.867 13.7963C27.3024 13.7517 28.0149 13.7319 28.4449 13.7707Z", fill: "black", fillOpacity: 0.12 }), /* @__PURE__ */ r.createElement("path", { d: "M11.5553 13.7707C10.8677 13.8328 10.3601 14.4406 10.4221 15.1281C10.4842 15.8153 11.0912 16.3221 11.7782 16.2608C11.7782 16.2608 11.972 16.2502 12.0734 16.2487C12.2778 16.2457 12.562 16.2509 12.8778 16.2833C13.2137 16.3177 13.5357 16.3782 13.8203 16.4662L13.6962 16.86C13.2209 18.3675 14.4907 19.5813 15.7944 19.5813C16.4962 19.5813 17.1683 19.2617 17.5707 18.6857C17.9975 18.0745 18.0585 17.241 17.5925 16.5344C17.2497 16.0143 16.7557 15.3831 16.1043 14.8657C15.1646 14.1195 13.9566 13.8809 13.1331 13.7963C12.6978 13.7517 11.9853 13.7319 11.5553 13.7707Z", fill: "black", fillOpacity: 0.12 })), na = (e) => /* @__PURE__ */ r.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M2.08337 19.9999C2.08337 10.1048 10.1049 2.08325 20 2.08325C29.8952 2.08325 37.9167 10.1048 37.9167 19.9999C37.9167 29.8951 29.8952 37.9166 20 37.9166C10.1049 37.9166 2.08337 29.8951 2.08337 19.9999Z", fill: "url(#paint0_linear_159_173206)" }), /* @__PURE__ */ r.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12.5828 29.3328C13.1348 29.7473 13.9184 29.636 14.3329 29.084C15.6272 27.3607 17.6839 26.25 20 26.25C22.3164 26.25 24.373 27.3607 25.6672 29.084C26.0819 29.636 26.8654 29.7473 27.4175 29.3328C27.9695 28.9182 28.0809 28.1347 27.6662 27.5825C25.9202 25.2577 23.136 23.75 20 23.75C16.8642 23.75 14.0801 25.2577 12.334 27.5825C11.9194 28.1347 12.0308 28.9182 12.5828 29.3328Z", fill: "#141B34" }), /* @__PURE__ */ r.createElement("path", { d: "M28.4454 13.7707C29.1329 13.8328 29.6405 14.4406 29.5785 15.1281C29.5165 15.8153 28.9095 16.3221 28.2224 16.2608C28.2224 16.2608 28.0287 16.2502 27.9272 16.2487C27.7229 16.2457 27.4387 16.2509 27.1229 16.2833C26.7869 16.3177 26.4649 16.3782 26.1804 16.4662L26.3045 16.86C26.7797 18.3675 25.5099 19.5813 24.2062 19.5813C23.5045 19.5813 22.8324 19.2617 22.43 18.6857C22.003 18.0745 21.9422 17.241 22.408 16.5344C22.751 16.0143 23.2449 15.3831 23.8964 14.8657C24.836 14.1195 26.044 13.8809 26.8675 13.7963C27.3029 13.7517 28.0154 13.7319 28.4454 13.7707Z", fill: "#141B34" }), /* @__PURE__ */ r.createElement("path", { d: "M11.5549 13.7707C10.8674 13.8328 10.3597 14.4406 10.4218 15.1281C10.4838 15.8153 11.0908 16.3221 11.7779 16.2608C11.7779 16.2608 11.9716 16.2502 12.073 16.2487C12.2774 16.2457 12.5616 16.2509 12.8774 16.2833C13.2134 16.3177 13.5353 16.3782 13.8199 16.4662L13.6958 16.86C13.2205 18.3675 14.4904 19.5813 15.794 19.5813C16.4958 19.5813 17.168 19.2617 17.5703 18.6857C17.9971 18.0745 18.0581 17.241 17.5921 16.5344C17.2493 16.0143 16.7553 15.3831 16.1039 14.8657C15.1643 14.1195 13.9562 13.8809 13.1327 13.7963C12.6974 13.7517 11.9849 13.7319 11.5549 13.7707Z", fill: "#141B34" }), /* @__PURE__ */ r.createElement("defs", null, /* @__PURE__ */ r.createElement("linearGradient", { id: "paint0_linear_159_173206", x1: 20, y1: 2.08325, x2: 20, y2: 37.9166, gradientUnits: "userSpaceOnUse" }, /* @__PURE__ */ r.createElement("stop", { stopColor: "#FF2D1D" }), /* @__PURE__ */ r.createElement("stop", { offset: 1, stopColor: "#FFA540" })))), ra = (e) => /* @__PURE__ */ r.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M19.9997 36.6667C29.2044 36.6667 36.6663 29.2048 36.6663 20C36.6663 10.7953 29.2044 3.33334 19.9997 3.33334C10.7949 3.33334 3.33301 10.7953 3.33301 20C3.33301 29.2048 10.7949 36.6667 19.9997 36.6667Z", fill: "#E0E0E0" }), /* @__PURE__ */ r.createElement("path", { d: "M15 28.333C16.3927 27.2867 18.124 26.6667 20 26.6667C21.876 26.6667 23.6073 27.2867 25 28.333", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ r.createElement("path", { d: "M11.667 13.3511C11.667 13.3511 14.0161 13.139 15.3268 14.18M15.3268 14.18L14.8882 15.5711C14.7153 16.1199 15.1675 16.6667 15.7943 16.6667C16.4531 16.6667 16.8882 16.0723 16.549 15.5579C16.2483 15.102 15.8388 14.5866 15.3268 14.18ZM23.3337 13.3511C23.3337 13.3511 25.6827 13.139 26.9935 14.18M26.9935 14.18L26.555 15.5711C26.382 16.1199 26.8342 16.6667 27.461 16.6667C28.1198 16.6667 28.5548 16.0723 28.2157 15.5579C27.915 15.102 27.5055 14.5866 26.9935 14.18Z", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" })), oa = (e) => /* @__PURE__ */ r.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M2.083 20C2.083 10.105 10.105 2.083 20 2.083c9.895 0 17.917 8.021 17.917 17.917 0 9.895-8.022 17.917-17.917 17.917C10.105 37.917 2.083 29.895 2.083 20Z", fill: "#FFD46E" }), /* @__PURE__ */ r.createElement("path", { d: "M14.249 27.334C15.851 26.13 17.844 25.417 20 25.417c2.156 0 4.149.714 5.751 1.917.553.415.664 1.199.25 1.751-.415.552-1.199.664-1.751.25-1.183-.889-2.652-1.416-4.25-1.416s-3.067.527-4.25 1.416c-.553.414-1.336.302-1.751-.25-.415-.552-.303-1.336.249-1.751Z", fill: "#141B34" }), /* @__PURE__ */ r.createElement("path", { d: "M23.445 14.596c-.687.062-1.294-.445-1.356-1.132-.062-.687.445-1.295 1.132-1.357.082-.005.342-.02.482-.022.277-.004.662.002 1.097.047.823.085 2.031.323 2.97 1.07.652.518 1.146 1.15 1.489 1.67.466.706.405 1.54-.022 2.15-.402.576-1.074.896-1.775.896-1.304 0-2.573-1.214-2.098-2.722l.125-.394c-.285-.088-.607-.148-.942-.182-.316-.033-.6-.038-.804-.035-.101.002-.242.01-.294.013Z", fill: "#141B34" }), /* @__PURE__ */ r.createElement("path", { d: "M11.779 14.596c-.687.062-1.294-.445-1.356-1.132-.062-.687.445-1.295 1.132-1.357.082-.005.342-.02.482-.022.277-.004.662.002 1.097.047.823.085 2.031.323 2.97 1.07.652.518 1.146 1.15 1.489 1.67.466.706.405 1.54-.022 2.15-.402.576-1.074.896-1.775.896-1.304 0-2.573-1.214-2.098-2.722l.124-.394c-.284-.088-.606-.148-.941-.182-.316-.033-.6-.038-.804-.035-.101.002-.243.01-.294.013Z", fill: "#141B34" })), sa = (e) => /* @__PURE__ */ r.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M19.9997 36.6667C29.2044 36.6667 36.6663 29.2048 36.6663 20C36.6663 10.7953 29.2044 3.33334 19.9997 3.33334C10.7949 3.33334 3.33301 10.7953 3.33301 20C3.33301 29.2048 10.7949 36.6667 19.9997 36.6667Z", fill: "#E0E0E0" }), /* @__PURE__ */ r.createElement("path", { d: "M13.348 15H13.333M26.6663 15H26.6513", stroke: "black", strokeOpacity: 0.12, strokeWidth: 3.33333, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ r.createElement("path", { d: "M15 26.6667H25", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" })), ia = (e) => /* @__PURE__ */ r.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M2.083 20C2.083 10.105 10.105 2.083 20 2.083c9.895 0 17.917 8.021 17.917 17.917 0 9.895-8.022 17.917-17.917 17.917C10.105 37.917 2.083 29.895 2.083 20Z", fill: "#FFD46E" }), /* @__PURE__ */ r.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M11.25 15c0-1.151.933-2.083 2.083-2.083h.015c1.151 0 2.084.933 2.084 2.083 0 1.151-.933 2.083-2.084 2.083h-.015c-1.15 0-2.083-.933-2.083-2.083ZM24.568 15c0-1.151.933-2.083 2.084-2.083h.015c1.151 0 2.083.933 2.083 2.083 0 1.151-.932 2.083-2.083 2.083h-.015c-1.151 0-2.084-.933-2.084-2.083Z", fill: "#141B34" }), /* @__PURE__ */ r.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M13.75 26.667c0-.691.56-1.25 1.25-1.25h10c.69 0 1.25.559 1.25 1.25 0 .691-.56 1.25-1.25 1.25h-10c-.69 0-1.25-.559-1.25-1.25Z", fill: "#141B34" })), aa = (e) => /* @__PURE__ */ r.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M19.9997 36.6667C29.2044 36.6667 36.6663 29.2048 36.6663 20C36.6663 10.7953 29.2044 3.33334 19.9997 3.33334C10.7949 3.33334 3.33301 10.7953 3.33301 20C3.33301 29.2048 10.7949 36.6667 19.9997 36.6667Z", fill: "#E0E0E0" }), /* @__PURE__ */ r.createElement("path", { d: "M13.333 25C14.8532 27.024 17.2735 28.3333 19.9997 28.3333C22.7258 28.3333 25.1462 27.024 26.6663 25", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ r.createElement("path", { d: "M13.348 15H13.333M26.6663 15H26.6513", stroke: "black", strokeOpacity: 0.12, strokeWidth: 3.33333, strokeLinecap: "round", strokeLinejoin: "round" })), la = (e) => /* @__PURE__ */ r.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M2.083 20C2.083 10.105 10.105 2.083 20 2.083c9.895 0 17.917 8.021 17.917 17.917 0 9.895-8.022 17.917-17.917 17.917C10.105 37.917 2.083 29.895 2.083 20Z", fill: "#FFD46E" }), /* @__PURE__ */ r.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M12.583 24.001c.552-.414 1.335-.302 1.75.25 1.294 1.723 3.35 2.834 5.667 2.834s4.373-1.11 5.667-2.834c.415-.552 1.199-.664 1.751-.25.552.415.664 1.199.25 1.751C25.92 28.076 23.136 29.584 20 29.584s-5.92-1.508-7.666-3.832c-.415-.552-.303-1.336.249-1.751Z", fill: "#141B34" }), /* @__PURE__ */ r.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M11.25 15c0-1.151.933-2.083 2.083-2.083h.015c1.151 0 2.084.933 2.084 2.083 0 1.151-.933 2.083-2.084 2.083h-.015c-1.15 0-2.083-.933-2.083-2.083ZM24.568 15c0-1.151.933-2.083 2.084-2.083h.015c1.151 0 2.083.933 2.083 2.083 0 1.151-.932 2.083-2.083 2.083h-.015c-1.151 0-2.084-.933-2.084-2.083Z", fill: "#141B34" })), ca = (e) => /* @__PURE__ */ r.createElement("svg", { width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M19.9997 36.6663C29.2044 36.6663 36.6663 29.2044 36.6663 19.9997C36.6663 10.7949 29.2044 3.33301 19.9997 3.33301C10.7949 3.33301 3.33301 10.7949 3.33301 19.9997C3.33301 29.2044 10.7949 36.6663 19.9997 36.6663Z", fill: "#E0E0E0" }), /* @__PURE__ */ r.createElement("path", { d: "M19.9997 30C23.16 30 25.8145 27.867 26.56 24.9832C26.9068 23.6413 26.4033 23.3333 25.0765 23.3333H14.9228C13.5959 23.3333 13.0925 23.6413 13.4393 24.9832C14.1848 27.867 16.8393 30 19.9997 30Z", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ r.createElement("path", { d: "M11.667 15.8333C11.667 14.4526 12.7863 13.3333 14.167 13.3333C15.5477 13.3333 16.667 14.4526 16.667 15.8333M23.3337 15.8333C23.3337 14.4526 24.453 13.3333 25.8337 13.3333C27.2143 13.3333 28.3337 14.4526 28.3337 15.8333", stroke: "black", strokeOpacity: 0.12, strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round" })), da = (e) => /* @__PURE__ */ r.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 40, height: 40, viewBox: "0 0 40 40", fill: "none", ...e }, /* @__PURE__ */ r.createElement("path", { d: "M2.083 20C2.083 10.105 10.105 2.083 20 2.083c9.895 0 17.917 8.021 17.917 17.917 0 9.895-8.022 17.917-17.917 17.917C10.105 37.917 2.083 29.895 2.083 20Z", fill: "#FFD46E" }), /* @__PURE__ */ r.createElement("g", { clipPath: "url(#clip0_159_173224)" }, /* @__PURE__ */ r.createElement("g", { clipPath: "url(#clip1_159_173224)" }, /* @__PURE__ */ r.createElement("path", { d: "M20 30.624c3.752 0 6.904-2.532 7.789-5.956.412-1.593-.185-1.959-1.76-1.959H13.973c-1.575 0-2.173.366-1.761 1.959.885 3.424 4.037 5.956 7.788 5.956Z", fill: "#141B34" })), /* @__PURE__ */ r.createElement("mask", { id: "mask0_159_173224", style: {
2388
+ maskType: "alpha"
2389
+ }, maskUnits: "userSpaceOnUse", x: 12, y: 22, width: 16, height: 9 }, /* @__PURE__ */ r.createElement("path", { d: "M20 30.624c3.752 0 6.904-2.532 7.789-5.956.412-1.593-.185-1.959-1.76-1.959H13.973c-1.575 0-2.173.366-1.761 1.959.885 3.424 4.037 5.956 7.788 5.956Z", fill: "#141B34" })), /* @__PURE__ */ r.createElement("g", { mask: "url(#mask0_159_173224)" }, /* @__PURE__ */ r.createElement("path", { d: "M20 32.998c3.278 0 5.936-1.594 5.936-3.561 0-1.968-2.658-3.562-5.936-3.562-3.278 0-5.936 1.594-5.936 3.562 0 1.967 2.658 3.561 5.936 3.561Z", fill: "#FF493B" }))), /* @__PURE__ */ r.createElement("path", { d: "M11.667 15.833c0-1.381 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5M23.333 15.833c0-1.381 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5", stroke: "#141B34", strokeWidth: 2.5, strokeLinecap: "round", strokeLinejoin: "round" }), /* @__PURE__ */ r.createElement("defs", null, /* @__PURE__ */ r.createElement("clipPath", { id: "clip0_159_173224" }, /* @__PURE__ */ r.createElement("rect", { width: 15.83, height: 7.915, fill: "white", transform: "translate(12.085 22.709)" })), /* @__PURE__ */ r.createElement("clipPath", { id: "clip1_159_173224" }, /* @__PURE__ */ r.createElement("rect", { width: 15.83, height: 7.915, fill: "white", transform: "translate(12.085 22.709)" })))), ua = [
2390
+ {
2391
+ value: 1,
2392
+ Icon: {
2393
+ Active: na,
2394
+ Inactive: ta
2395
+ },
2396
+ isActive: (e) => e <= 1,
2397
+ getTooltip: (e) => e.CSAT5_RATING_SCORE_1
2398
+ },
2399
+ {
2400
+ value: 2,
2401
+ Icon: {
2402
+ Active: oa,
2403
+ Inactive: ra
2404
+ },
2405
+ isActive: (e) => e === 2,
2406
+ getTooltip: (e) => e.CSAT5_RATING_SCORE_2
2407
+ },
2408
+ {
2409
+ value: 3,
2410
+ Icon: {
2411
+ Active: ia,
2412
+ Inactive: sa
2413
+ },
2414
+ isActive: (e) => e === 3,
2415
+ getTooltip: (e) => e.CSAT5_RATING_SCORE_3
2416
+ },
2417
+ {
2418
+ value: 4,
2419
+ Icon: {
2420
+ Active: la,
2421
+ Inactive: aa
2422
+ },
2423
+ isActive: (e) => e === 4,
2424
+ getTooltip: (e) => e.CSAT5_RATING_SCORE_4
2425
+ },
2426
+ {
2427
+ value: 5,
2428
+ Icon: {
2429
+ Active: da,
2430
+ Inactive: ca
2431
+ },
2432
+ isActive: (e) => 5 <= e,
2433
+ getTooltip: (e) => e.CSAT5_RATING_SCORE_5
2434
+ }
2435
+ ], ma = () => ua, Vn = ({ label: e, children: t, position: n = "top", disabled: o }) => o ? t : /* @__PURE__ */ r.createElement(ft, null, t, /* @__PURE__ */ r.createElement(pa, { $position: n }, /* @__PURE__ */ r.createElement(fa, { variant: "caption1" }, e), /* @__PURE__ */ r.createElement(ga, { $position: n }))), ga = ({ $position: e }) => /* @__PURE__ */ r.createElement(
2436
+ "svg",
2437
+ {
2438
+ style: { transform: e === "top" ? "rotate(0)" : "rotate(180deg)" },
2439
+ xmlns: "http://www.w3.org/2000/svg",
2440
+ width: "12",
2441
+ height: "6",
2442
+ viewBox: "0 0 12 6",
2443
+ fill: "none"
2444
+ },
2445
+ /* @__PURE__ */ r.createElement("path", { d: "M6 6L0 0h12L6 6Z", fill: p.themedColor.textHighEmphasis })
2446
+ ), ha = {
2447
+ top: I`flex-direction:column;top:0;transform:translate(-50%,-100%);`,
2448
+ bottom: I`flex-direction:column-reverse;bottom:0;transform:translate(-50%,100%);`
2449
+ }, ft = u.div`position:relative;`, pa = u.div`display:flex;align-items:center;position:absolute;left:50%;z-index:${fe.TOOLTIP};${({ $position: e }) => ha[e]}opacity:0;transition:opacity 0.2s ease-in-out;pointer-events:none;${ft}:hover &,${ft}:focus-within &{opacity:1;}`, fa = u(w)`padding:6px 8px;background:${p.themedColor.textHighEmphasis};color:${p.themedColor.textHighEmphasisInverse};border-radius:4px;font-size:12px;white-space:nowrap;`, ba = ({ submitted: e, value: t, onChange: n }) => {
2450
+ const { stringSet: o } = O(), s = ma(), i = typeof t == "number";
2451
+ return /* @__PURE__ */ r.createElement(Ea, null, /* @__PURE__ */ r.createElement(w, { variant: "caption2", color: p.themedColor.textMidEmphasis }, o.CSAT_RATING_TITLE), /* @__PURE__ */ r.createElement(xa, null, s.map((a) => /* @__PURE__ */ r.createElement(Vn, { disabled: e, key: a.value, label: a.getTooltip(o) }, /* @__PURE__ */ r.createElement(
2452
+ Ca,
2453
+ {
2454
+ disabled: e,
2455
+ onClick: () => n(a.value),
2456
+ $inactive: i && !a.isActive(t)
2457
+ },
2458
+ i ? a.isActive(t) ? /* @__PURE__ */ r.createElement(a.Icon.Active, null) : /* @__PURE__ */ r.createElement(a.Icon.Inactive, null) : /* @__PURE__ */ r.createElement(a.Icon.Active, null)
2459
+ )))));
2460
+ }, Ea = u.div`display:flex;flex-direction:column;gap:8px;`, xa = u.div`display:flex;justify-content:space-between;width:100%;max-width:320px;`, Ca = u.button`background-color:transparent;border:none;border-radius:4px;padding:0;display:flex;align-items:center;justify-content:center;box-sizing:border-box;&:enabled:hover{cursor:pointer;background-color:${p.color.background200};${P.dark`
2461
+ background-color: ${p.color.background500};
2462
+ `}
2463
+ }
2464
+
2465
+ ${({ $inactive: e, theme: t }) => e && t.selectedTheme === "dark" && va};
2466
+ `, va = I`[fill]{fill:white;fill-opacity:0.12;}[stroke]{stroke:white;stroke-opacity:0.12;}`, ya = ({ submitted: e, value: t = "", onChange: n }) => {
2467
+ const { stringSet: o } = O();
2468
+ return e && !t ? null : /* @__PURE__ */ r.createElement(
2469
+ _a,
2470
+ {
2471
+ disabled: e,
2472
+ maxLength: 255,
2473
+ value: t,
2474
+ onChange: (s) => n(s.target.value),
2475
+ placeholder: o.CSAT_REASON_PLACEHOLDER
2476
+ }
2477
+ );
2478
+ }, _a = u.input`box-sizing:border-box;width:100%;border-radius:4px;padding:10px 16px;font-size:14px;font-weight:400;font-style:normal;border:unset;&:focus{outline:none;}color:${p.themedColor.textHighEmphasis};&::placeholder{color:${p.themedColor.textLowEmphasis};}background-color:${p.color.background50};${P.dark`
2479
+ background-color: ${p.themedColor.textDisabled};
2480
+ `}
2481
+
2482
+ &:disabled {
2483
+ cursor: not-allowed;
2484
+ color: ${p.themedColor.textLowEmphasis};
2485
+ background-color: ${p.color.background200};
2486
+ ${P.dark`
2487
+ color: ${p.color.ondark.textDisabled};
2488
+ background-color: ${p.themedColor.textDisabled};
2489
+ `}
2490
+ }
2491
+ `, Sa = ({ submitted: e }) => {
2492
+ const { stringSet: t } = O();
2493
+ return e ? /* @__PURE__ */ r.createElement(w, { variant: "h2", color: p.themedColor.textHighEmphasis }, t.CSAT_TITLE_SUBMITTED) : /* @__PURE__ */ r.createElement(w, { variant: "h2", color: p.themedColor.textHighEmphasis }, t.CSAT_TITLE_UNSUBMITTED);
2494
+ };
2495
+ var X = /* @__PURE__ */ ((e) => (e.AI_AGENT_CSAT_5 = "AI_AGENT_CSAT_5", e.AI_AGENT_CSAT_5_WITH_CRE = "AI_AGENT_CSAT_5_WITH_CRE", e.HELPDESK_CSAT_5 = "HELPDESK_CSAT_5", e))(X || {});
2496
+ const Ta = (e) => Cr((t, n) => ({ ...t, ...n }), e), lt = ({
2497
+ type: e,
2498
+ renderSubmitButton: t,
2499
+ initialCsat: n,
2500
+ initialCsatReason: o,
2501
+ initialIsResolved: s
2502
+ }) => {
2503
+ const [i, a] = Ta({
2504
+ csatType: e,
2505
+ csat: n,
2506
+ csatReason: o,
2507
+ isResolved: s
2508
+ }), l = typeof n == "number" ? "submitted" : (e === X.AI_AGENT_CSAT_5 || e === X.HELPDESK_CSAT_5) && typeof i.csat == "number" || e === X.AI_AGENT_CSAT_5_WITH_CRE && typeof i.csat == "number" && typeof i.isResolved == "boolean" ? "submittable" : "unsubmittable", c = { state: l, submitted: l === "submitted" };
2509
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(wa, null, /* @__PURE__ */ r.createElement(Sa, { ...c }), e === X.AI_AGENT_CSAT_5_WITH_CRE && /* @__PURE__ */ r.createElement(
2510
+ Xi,
2511
+ {
2512
+ ...c,
2513
+ defaultValue: s,
2514
+ value: i.isResolved,
2515
+ onChange: (d) => a({ isResolved: d })
2516
+ }
2517
+ ), /* @__PURE__ */ r.createElement(ba, { ...c, value: i.csat, onChange: (d) => a({ csat: d }) }), i.csat && /* @__PURE__ */ r.createElement(
2518
+ ya,
2519
+ {
2520
+ ...c,
2521
+ value: i.csatReason,
2522
+ onChange: (d) => a({ csatReason: d })
2523
+ }
2524
+ )), l !== "submitted" && t({ state: l, params: i }));
2525
+ }, wa = u.div`display:flex;flex-direction:column;gap:12px;`, Aa = () => {
2526
+ const { stringSet: e } = O();
2527
+ return /* @__PURE__ */ r.createElement(w, { variant: "body2", color: p.themedColor.textMidEmphasis, style: { textAlign: "center" } }, e.CSAT_SUBMISSION_EXPIRED);
2528
+ }, ka = (e) => {
2529
+ if (e.messageType !== "admin.csat")
2530
+ throw new Error("Invalid message type");
2531
+ const t = Nr(), { stringSet: n } = O(), { extendedMessagePayload: o, csat: s, csatReason: i, csatExpireAt: a, isResolvedWhenDeterminedByUser: l, onSubmitCSAT: c } = e, { visibility: d, type: h } = (o == null ? void 0 : o.csat) ?? {};
2532
+ if (!d || !h || !X[h]) return null;
2533
+ const m = h === X.AI_AGENT_CSAT_5 || h === X.AI_AGENT_CSAT_5_WITH_CRE || h === X.HELPDESK_CSAT_5 ? lt : () => null, f = (x) => {
2534
+ x.csat && !rn(a) ? c({
2535
+ csatType: x.csatType,
2536
+ csat: x.csat,
2537
+ csatReason: x.csatReason,
2538
+ isResolved: x.isResolved
2539
+ }) : t();
2540
+ };
2541
+ return /* @__PURE__ */ r.createElement(Ia, null, !s && rn(a) ? /* @__PURE__ */ r.createElement(Aa, null) : /* @__PURE__ */ r.createElement(
2542
+ m,
2543
+ {
2544
+ type: h,
2545
+ initialCsat: s,
2546
+ initialCsatReason: i,
2547
+ initialIsResolved: l,
2548
+ renderSubmitButton: ({ state: x, params: E }) => /* @__PURE__ */ r.createElement($a, { disabled: x !== "submittable", onClick: () => f(E) }, /* @__PURE__ */ r.createElement(w, { variant: "button" }, n.CSAT_SUBMIT_LABEL))
2549
+ }
2550
+ ));
2551
+ }, Ia = u.div`display:flex;flex-direction:column;background-color:${({ theme: e }) => e.colors.csat.background};border-radius:16px;gap:16px;padding:24px;`, $a = u.button`all:unset;background-color:${({ theme: e }) => e.colors.base.primary};color:${({ theme: e }) => e.colors.base.primaryContrastContent};border-radius:6px;padding:10px 20px;display:flex;align-items:center;justify-content:center;cursor:pointer;&:hover{background-color:${p.color.primary.dark};}&:disabled{color:${p.color.ondark.textLowEmphasis};background-color:${p.themedColor.textDisabled};cursor:not-allowed;}`;
2552
+ function rn(e) {
2553
+ return !!e && e < Date.now();
2554
+ }
2555
+ const Lt = _e({
2556
+ template: Ma,
2557
+ components: {
2558
+ AdminMessage: Yi,
2559
+ CSATMessage: ka
2560
+ }
2561
+ });
2562
+ function Ma(e) {
2563
+ const { components: t } = Lt.useContext(), n = Mt(() => e.messageType === "admin" ? /* @__PURE__ */ r.createElement(t.AdminMessage, { ...e }) : e.messageType === "admin.csat" ? /* @__PURE__ */ r.createElement(t.CSATMessage, { ...e }) : null);
2564
+ return /* @__PURE__ */ r.createElement(Oa, { $marginBottom: Tt(e.groupType) }, n);
2565
+ }
2566
+ const Oa = u.div`padding-inline:${te}px;margin-bottom:${({ $marginBottom: e }) => e}px;`, on = {
2567
+ file: "attach",
2568
+ snippet: "snippet",
2569
+ site: "website",
2570
+ sb_sprinklr: "sprinklr",
2571
+ sb_salesforce: "salesforce",
2572
+ sb_confluence: "confluence",
2573
+ sb_zendesk: "zendesk",
2574
+ sb_desk: "snippet"
2575
+ // TODO: request icon
2576
+ }, La = ({
2577
+ actionbook: e,
2578
+ functionCalls: t,
2579
+ groundedness: n,
2580
+ agentMessageTemplates: o,
2581
+ onClickActionbook: s,
2582
+ onClickFunctionCall: i,
2583
+ onClickFunctionCallDetail: a,
2584
+ onClickGroundedness: l,
2585
+ onClickAgentMessageTemplate: c,
2586
+ bottomContent: d,
2587
+ renderCustomGroundednessIcon: h = (f) => f.default,
2588
+ style: m = {}
2589
+ }) => {
2590
+ const {
2591
+ // Note: This component is used with the dashboard, so cssVars should not be used.
2592
+ iconColor: f = "#000000",
2593
+ textColor: x = "#000000",
2594
+ highlightColor: E = $n.DEFAULT_PRIMARY
2595
+ } = m;
2596
+ return /* @__PURE__ */ r.createElement(sn, null, e && /* @__PURE__ */ r.createElement(sn, null, /* @__PURE__ */ r.createElement(qe, null, /* @__PURE__ */ r.createElement(ze, null, /* @__PURE__ */ r.createElement(M, { size: 16, type: "actionbook", color: f })), /* @__PURE__ */ r.createElement(
2597
+ He,
2598
+ {
2599
+ $clickable: !!s,
2600
+ $highlightColor: E,
2601
+ variant: "body2",
2602
+ color: x,
2603
+ onClick: () => s == null ? void 0 : s(e)
2604
+ },
2605
+ e.name
2606
+ ))), t == null ? void 0 : t.map((b) => /* @__PURE__ */ r.createElement(ct, { key: b.key }, /* @__PURE__ */ r.createElement(ze, null, /* @__PURE__ */ r.createElement(M, { size: 16, type: "function", color: f })), /* @__PURE__ */ r.createElement(qe, null, /* @__PURE__ */ r.createElement(
2607
+ He,
2608
+ {
2609
+ $clickable: !!i,
2610
+ $highlightColor: E,
2611
+ variant: "body2",
2612
+ color: x,
2613
+ onClick: () => i == null ? void 0 : i(b)
2614
+ },
2615
+ b.name
2616
+ ), a && /* @__PURE__ */ r.createElement(Da, { role: "button", onClick: () => a == null ? void 0 : a(b) }, /* @__PURE__ */ r.createElement(w, { variant: "body2", color: E }, "View details"), /* @__PURE__ */ r.createElement(M, { type: "chevron-right", size: 16, color: E }))))), n == null ? void 0 : n.map((b) => /* @__PURE__ */ r.createElement(ct, { key: b.id }, /* @__PURE__ */ r.createElement(ze, null, h({
2617
+ default: /* @__PURE__ */ r.createElement(M, { size: 16, type: on[b.source_type] ?? on.snippet, color: f }),
2618
+ sourceType: b.source_type
2619
+ })), /* @__PURE__ */ r.createElement(
2620
+ He,
2621
+ {
2622
+ $clickable: !!l,
2623
+ $highlightColor: E,
2624
+ variant: "body2",
2625
+ color: x,
2626
+ onClick: () => l == null ? void 0 : l(b)
2627
+ },
2628
+ b.preview_title
2629
+ ))), o == null ? void 0 : o.map((b) => /* @__PURE__ */ r.createElement(ct, { key: b.key }, /* @__PURE__ */ r.createElement(ze, null, /* @__PURE__ */ r.createElement(M, { size: 16, type: "template", color: f })), /* @__PURE__ */ r.createElement(
2630
+ He,
2631
+ {
2632
+ $clickable: !!c,
2633
+ $highlightColor: E,
2634
+ variant: "body2",
2635
+ color: x,
2636
+ onClick: () => c == null ? void 0 : c(b)
2637
+ },
2638
+ b.name
2639
+ ))), d);
2640
+ }, Ra = u(w)`font-weight:400;`, He = u(Ra)`${({ $clickable: e, $highlightColor: t }) => e && I`
2641
+ cursor: pointer;
2642
+ text-decoration: underline;
2643
+ &:hover {
2644
+ color: ${t};
2645
+ }
2646
+ `}
2647
+ `, ze = u.div`display:flex;align-items:center;justify-content:center;flex-shrink:0;`, qe = u.div`display:flex;gap:8px;align-items:center;`, Da = u(qe)`cursor:pointer;gap:4px;`, ct = u(qe)`flex-direction:row;align-items:center;`, sn = u.div`display:flex;gap:4px;flex-direction:column;align-items:flex-start;`, Wn = ve(null);
2648
+ function Na({ testerType: e, children: t }) {
2649
+ return /* @__PURE__ */ r.createElement(
2650
+ Wn.Provider,
2651
+ {
2652
+ value: { testerType: e, isActionbookTester: e === "actionbook" }
2653
+ },
2654
+ e && /* @__PURE__ */ r.createElement(Pa, null),
2655
+ t
2656
+ );
2657
+ }
2658
+ const Re = () => {
2659
+ const e = Q(Wn);
2660
+ if (!e) throw new Error("_UNSAFE_INTERNAL_DashboardTesterProvider not found");
2661
+ return e;
2662
+ }, Pa = () => {
2663
+ const { isActionbookTester: e } = Re();
2664
+ return /* @__PURE__ */ r.createElement(xe.Template, { template: e ? Ba : void 0 }, /* @__PURE__ */ r.createElement(xe.MessageLogs, { component: Fa }));
2665
+ }, Ba = (e) => /* @__PURE__ */ r.createElement(Un, { ...e, testerMode: !0, maxBodyWidth: Ln }), Fa = ({ extendedMessagePayload: e = {} }) => {
2666
+ const { handlers: t } = B(), { manual: n, groundedness: o, function_calls: s, agent_message_templates: i, is_thinking: a } = e;
2667
+ return a || !n && !(o != null && o.length) && !(s != null && s.length) && !(i != null && i.length) ? /* @__PURE__ */ r.createElement(r.Fragment, null) : /* @__PURE__ */ r.createElement(Ua, null, /* @__PURE__ */ r.createElement(Ha, { width: 4 }), /* @__PURE__ */ r.createElement(
2668
+ La,
2669
+ {
2670
+ actionbook: n,
2671
+ functionCalls: s,
2672
+ groundedness: o,
2673
+ agentMessageTemplates: i,
2674
+ onClickFunctionCallDetail: t == null ? void 0 : t.onFunctionCallDetailClick,
2675
+ style: {
2676
+ iconColor: p.themedColor.textHighEmphasis,
2677
+ textColor: p.themedColor.textHighEmphasis,
2678
+ barColor: p.themedColor.textDisabled
2679
+ },
2680
+ bottomContent: /* @__PURE__ */ r.createElement(za, { variant: "caption2", color: p.themedColor.textLowEmphasis }, "Only visible in the tester")
2681
+ }
2682
+ ));
2683
+ }, Ua = u.div`display:flex;gap:16px;margin:16px ${te}px 0;align-self:stretch;`, Ha = u.div`width:${({ width: e }) => e}px;background-color:${p.themedColor.textDisabled};border-radius:100px;flex-shrink:0;`, za = u(w)`margin-top:5px;`;
2684
+ function Va(e) {
2685
+ return "sendingStatus" in e ? e.sendingStatus === "succeeded" ? String(e.messageId) : e.reqId : String(e.messageId);
2686
+ }
2687
+ const Wa = (e, t, n, o = !0) => {
2688
+ if (!o || !e.isUserMessage() && !e.isFileMessage())
2689
+ return "single";
2690
+ const s = () => {
2691
+ if (!t || !t.isUserMessage() && !t.isFileMessage()) return !1;
2692
+ const c = t.sender.userId === e.sender.userId, d = zt(t.createdAt, e.createdAt);
2693
+ return c && d;
2694
+ }, i = () => {
2695
+ if (!n || !n.isUserMessage() && !n.isFileMessage()) return !1;
2696
+ const c = n.sender.userId === e.sender.userId, d = zt(n.createdAt, e.createdAt);
2697
+ return c && d;
2698
+ }, a = s(), l = i();
2699
+ return a && l ? "middle" : a ? "bottom" : l ? "top" : "single";
2700
+ };
2701
+ function Ga(e, t) {
2702
+ return e.filter((n) => Se.isWelcomeMessage(n, t));
2703
+ }
2704
+ function Gn(e, t) {
2705
+ return ja(e) === t;
2706
+ }
2707
+ function ja(e) {
2708
+ var t;
2709
+ if (e)
2710
+ return e.isUserMessage() || e.isFileMessage() || e.isMultipleFilesMessage() ? e.sender.userId : ((t = e == null ? void 0 : e.sender) == null ? void 0 : t.userId) ?? void 0;
2711
+ }
2712
+ function Ka(e) {
2713
+ return e.isAdminMessage() ? e.message === "The channel's custom_type was updated." : !1;
2714
+ }
2715
+ const bt = (e) => !!e && "sender" in e, jn = (e) => e.startsWith("image/"), Kn = (e) => e.startsWith("video/"), an = (e) => jn(e) || Kn(e), Ve = {
2716
+ isAdmin: (e) => e.isAdminMessage(),
2717
+ isCSAT: (e) => {
2718
+ var t;
2719
+ return e.isAdminMessage() && !!((t = e.extendedMessagePayload) != null && t.csat);
2720
+ },
2721
+ isIncoming: (e, t) => bt(e) && e.sender.userId !== t,
2722
+ isOutgoing: (e, t) => bt(e) && (e.sender.userId === t || e.sendingStatus === dt.PENDING)
2723
+ }, Za = (e) => {
2724
+ const { chatSDK: t, handlers: n } = B(), { aiAgentInfo: o } = U(), s = N(/* @__PURE__ */ new Set()), i = (a, l) => {
2725
+ var c;
2726
+ a.url === e && bt(l) && l.sender.userId === o.userId && !Se.isStreaming(l) && !s.current.has(l.messageId) && ((c = n == null ? void 0 : n.onCustomEvent) == null || c.call(n, { type: "bot-message-received", data: { message: l } }), s.current.add(l.messageId));
2727
+ };
2728
+ Xe(t, {
2729
+ onMessageUpdated: i,
2730
+ onMessageReceived: i
2731
+ });
2732
+ }, Ya = ({ publishSynchronous: e = !1 }) => {
2733
+ const t = /* @__PURE__ */ new Set();
2734
+ return {
2735
+ publish: (n) => {
2736
+ t.forEach((o) => {
2737
+ e ? o(n) : setTimeout(() => o(n), 0);
2738
+ });
2739
+ },
2740
+ subscribe: (n) => (t.add(n), () => t.delete(n))
2741
+ };
2742
+ };
2743
+ function qa(e, t = []) {
2744
+ const n = N(null), o = N(0), s = N(0), [i] = _(() => Ya({ publishSynchronous: !0 })), [a, l] = _(!0);
2745
+ return le(() => {
2746
+ o.current = 0, s.current = 0, l(!0), n.current && (n.current.scrollTop = n.current.scrollHeight);
2747
+ }, t), le(() => i.subscribe(({ type: c, data: d }) => {
2748
+ const { resolve: h, animated: m } = d ?? {};
2749
+ if (!n.current) return h == null ? void 0 : h();
2750
+ if (c === "scrollToBottom" && (n.current.scroll ? n.current.scroll({
2751
+ top: n.current.scrollHeight,
2752
+ behavior: ln(e, m)
2753
+ }) : n.current.scrollTop = n.current.scrollHeight, s.current = 0, l(!0), h == null || h()), c === "scroll") {
2754
+ const f = d == null ? void 0 : d.top, { scrollTop: x, scrollHeight: E, clientHeight: b } = n.current;
2755
+ n.current.scroll ? n.current.scroll({ top: f, behavior: ln(e, m) }) : typeof f == "number" && (n.current.scrollTop = f), s.current = Math.max(0, E - x - b), l(s.current === 0), h == null || h();
2756
+ }
2757
+ }), [e]), {
2758
+ scrollRef: n,
2759
+ scrollPubSub: i,
2760
+ isScrollBottomReached: a,
2761
+ setIsScrollBottomReached: l,
2762
+ scrollDistanceFromBottomRef: s,
2763
+ scrollPositionRef: o
2764
+ };
2765
+ }
2766
+ function ln(e, t) {
2767
+ return typeof t == "boolean" ? t ? "smooth" : "auto" : e;
2768
+ }
2769
+ function Ja(e) {
2770
+ return new Promise((t) => {
2771
+ const n = new Image();
2772
+ n.onload = function() {
2773
+ const o = String(n.width), s = String(n.height);
2774
+ URL.revokeObjectURL(n.src), t({ width: o, height: s });
2775
+ }, n.src = URL.createObjectURL(e);
2776
+ });
2777
+ }
2778
+ async function Xa(e) {
2779
+ if ("file" in e && e.file instanceof File && e.file.type.startsWith("image/")) {
2780
+ const { width: t, height: n } = await Ja(e.file);
2781
+ return new Vr({
2782
+ key: Zn,
2783
+ value: [t, n]
2784
+ });
2785
+ }
2786
+ }
2787
+ const Zn = "KEY_IMG_ASPECT_RATIO", Qa = ({ onScrollAfterSendMessage: e }) => {
2788
+ const { agentPreviewConfigs: t, handlers: n } = B(), o = N(t == null ? void 0 : t.agentAttributes);
2789
+ return o.current = t == null ? void 0 : t.agentAttributes, {
2790
+ onBeforeSendMessage: async (s) => {
2791
+ const i = await Xa(s), a = {
2792
+ ...s,
2793
+ metaArrays: i ? [i] : void 0
2794
+ }, l = el(o.current);
2795
+ return l ? { ...a, data: JSON.stringify(l) } : a;
2796
+ },
2797
+ onAfterSendMessage: (s) => {
2798
+ var i, a, l;
2799
+ e(), (i = n == null ? void 0 : n.onMessageSend) == null || i.call(n, s.message), s.sendingStatus === dt.SUCCEEDED ? (a = n == null ? void 0 : n.onCustomEvent) == null || a.call(n, { type: "message-sent-succeeded", data: { message: s } }) : s.sendingStatus === dt.PENDING && ((l = n == null ? void 0 : n.onCustomEvent) == null || l.call(n, { type: "message-sent-pending", data: { message: s } }));
2800
+ }
2801
+ };
2802
+ }, el = (e) => {
2803
+ if (!e) return null;
2804
+ const t = {};
2805
+ return e.ai && Object.keys(e.ai).length > 0 && (t.ai_attrs = e.ai), e.safeguard && Object.keys(e.safeguard).length > 0 && (t.safeguard_attrs = e.safeguard), typeof e.use_prompt_cache == "boolean" && (t.use_prompt_cache = e.use_prompt_cache), Object.keys(t).length > 0 ? t : null;
2806
+ }, {
2807
+ Provider: tl,
2808
+ Context: ou,
2809
+ useContext: Z
2810
+ } = G("Conversation"), nl = ({
2811
+ closedChannelUrl: e,
2812
+ onClearClosedChannelUrl: t,
2813
+ onNavigateToConversationList: n,
2814
+ children: o
2815
+ }) => {
2816
+ const { aiAgentInfo: s, activeChannel: i, refreshActiveChannel: a } = U(), { testerType: l } = Re(), c = qa("smooth"), { onBeforeSendMessage: d, onAfterSendMessage: h } = Qa({
2817
+ onScrollAfterSendMessage: () => {
2818
+ c.scrollPubSub.publish({ type: "scrollToBottom", data: { animated: !1 } });
2819
+ }
2820
+ }), m = e || (i == null ? void 0 : i.url);
2821
+ Za(m);
2822
+ const f = (E) => {
2823
+ const b = E[E.length - 1];
2824
+ b && Se.shouldScrollToBottom(b, s.userId, !!l) && setTimeout(() => c.scrollPubSub.publish({ type: "scrollToBottom", data: { animated: !0 } }), 100);
2825
+ }, x = R(async () => {
2826
+ await a(), e && (t == null || t());
2827
+ }, [a, e, t]);
2828
+ return /* @__PURE__ */ r.createElement(
2829
+ io,
2830
+ {
2831
+ channelUrl: m,
2832
+ onBeforeSendMessage: d,
2833
+ onAfterSendMessage: h,
2834
+ onMessagesUpdated: f,
2835
+ onMessagesReceived: f,
2836
+ onChannelDeleted: x,
2837
+ onConversationClosedViaDispatcher: x
2838
+ },
2839
+ (E) => /* @__PURE__ */ r.createElement(
2840
+ tl,
2841
+ {
2842
+ value: { ...E, scrollSource: c, goToActiveConversation: x, onNavigateToConversationList: n }
2843
+ },
2844
+ o
2845
+ )
2846
+ );
2847
+ }, Rt = ve({
2848
+ onDrop: Ie,
2849
+ subscribe: () => Ie
2850
+ }), Et = ({ children: e }) => {
2851
+ const t = N(/* @__PURE__ */ new Set());
2852
+ return /* @__PURE__ */ r.createElement(
2853
+ Rt.Provider,
2854
+ {
2855
+ value: {
2856
+ onDrop: (n) => {
2857
+ var o;
2858
+ if (n.preventDefault(), (o = n.dataTransfer) != null && o.files) {
2859
+ const s = Array.from(n.dataTransfer.files);
2860
+ s.length > 0 && t.current.forEach((i) => i(s));
2861
+ }
2862
+ },
2863
+ subscribe: (n) => (t.current.add(n), () => t.current.delete(n))
2864
+ }
2865
+ },
2866
+ e
2867
+ );
2868
+ }, rl = ({ onDropFiles: e }) => {
2869
+ const { subscribe: t } = Q(Rt);
2870
+ L(() => t(e), [e]);
2871
+ };
2872
+ Et.Consumer = ({ children: e }) => {
2873
+ const { onDrop: t } = Q(Rt);
2874
+ return e({ onDrop: t, onDragOver: (s) => s.preventDefault() });
2875
+ };
2876
+ const su = ({ iconSize: e = 64, icon: t, className: n, label: o, children: s }) => /* @__PURE__ */ r.createElement(sl, { className: n }, /* @__PURE__ */ r.createElement(M, { type: t, size: e, color: p.themedColor.textLowEmphasis }), /* @__PURE__ */ r.createElement(w, { variant: "body1", color: p.themedColor.textMidEmphasis }, o), s), ol = u.div`position:relative;display:flex;justify-content:center;align-items:center;width:100%;height:100%;`, sl = u.div`display:flex;flex-direction:column;min-height:104px;align-items:center;gap:20px;text-align:center;`, il = {
2877
+ loading: T(() => import("./CKTGU2qP.js")),
2878
+ error: T(() => import("./CV59hwzK.js")),
2879
+ noChannels: T(() => import("./DOAkPSN5.js")),
2880
+ noMessages: T(() => import("./BuMtQ0m7.js"))
2881
+ }, Ce = ({ className: e, type: t = "loading", ...n }) => {
2882
+ const o = il[t];
2883
+ return /* @__PURE__ */ r.createElement(ol, { className: e }, /* @__PURE__ */ r.createElement(ke, { fallback: null }, /* @__PURE__ */ r.createElement(o, { ...n })));
2884
+ }, Yn = ({ rootElementId: e, visible: t, onClose: n, children: o }) => {
2885
+ if (!t) return null;
2886
+ const { rootElement: s } = B(), i = pe(s), a = pe(s, !0);
2887
+ return Gr(
2888
+ /* @__PURE__ */ r.createElement(al, { onClick: n }, /* @__PURE__ */ r.createElement(ll, { onClick: (l) => l.stopPropagation() }, o)),
2889
+ i.getElementById(e) ?? i.getElementById(ee.MODAL_ROOT) ?? a.body
2890
+ );
2891
+ }, al = u.div`position:fixed;top:0;left:0;width:100%;height:100%;background:${p.color.overlay.dark};display:flex;justify-content:center;align-items:center;z-index:${fe.MODAL};`, ll = u.div`border-radius:4px;overflow:hidden;box-shadow:0 16px 24px 2px rgba(13,13,13,0.12),0 6px 30px 5px rgba(13,13,13,0.08),0 6px 10px -5px rgba(13,13,13,0.04);z-index:${fe.MODAL};`, cl = u.div`flex-shrink:0;width:${({ $size: e }) => j(e)};height:${({ $size: e }) => j(e)};background-color:${({ theme: e }) => e.colors.base.primary};box-sizing:border-box;padding:6px;border-radius:50%;display:flex;justify-content:center;align-items:center;}`, dl = u(kt)`path{fill:${({ theme: e }) => e.colors.base.primaryContrastContent};}`;
2892
+ function qn({ size: e }) {
2893
+ const { aiAgentInfo: t } = U();
2894
+ return t.profileUrl ? /* @__PURE__ */ r.createElement(It, { size: e, src: t.profileUrl }) : /* @__PURE__ */ r.createElement(cl, { $size: e }, /* @__PURE__ */ r.createElement(dl, null));
2895
+ }
2896
+ const ul = u.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none;`, ml = u.div`height:64px;min-height:64px;box-sizing:border-box;display:flex;justify-content:space-between;border-bottom:1px solid ${p.themedColor.textDisabled};background-color:${p.themedColor.bg_50_600};@media screen and (max-width:768px){position:relative;}`, gl = u.div`box-sizing:border-box;display:flex;flex-direction:row;align-items:center;height:64px;padding:16px 20px;width:calc(100% - 128px);`, hl = u.div`margin-inline-end:8px;`, pl = u.div`max-width:500px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:inline-block;@media screen and (max-width:768px){position:absolute;inset-inline-start:64px;top:10px;display:block;max-width:calc(100vw - 240px);}`, fl = u.div`display:inline-block;margin-inline-start:8px;padding-top:5px;@media screen and (max-width:768px){position:absolute;inset-inline-start:56px;top:24px;}`, bl = u.div`display:flex;width:160px;justify-content:flex-end;`, El = u.div`inset-inline-end:0;display:flex;flex-direction:row;`, Jn = u.div`width:64px;padding:21px;box-sizing:border-box;cursor:${(e) => e.disabled ? "not-allowed" : "pointer"};`, xl = u(Jn)`border-inline-start:1px solid ${p.themedColor.textDisabled};`, Cl = u.div`width:100%;height:100%;display:flex;align-items:center;justify-content:center;`, vl = u.video`max-width:100%;max-height:100%;user-select:none;-webkit-user-drag:none;`, yl = u.img`max-width:calc(90% - 60px);max-height:calc(90% - 60px);user-select:none;-webkit-user-drag:none;`, _l = u.div`max-width:100%;max-height:100%;display:flex;justify-content:center;align-items:center;`, Sl = ({ file: e, sender: t = {}, onClose: n, onDownloadClick: o }) => {
2897
+ const { type: s, url: i, name: a = "" } = e, { profileUrl: l, nickname: c, userId: d } = t, { aiAgentInfo: h } = U();
2898
+ return /* @__PURE__ */ r.createElement(
2899
+ wl,
2900
+ {
2901
+ profileUrl: l ?? "",
2902
+ nickname: c ?? "",
2903
+ type: s,
2904
+ url: i,
2905
+ name: a,
2906
+ onClose: n,
2907
+ isBotMessage: d === h.userId,
2908
+ onDownloadClick: o
2909
+ }
2910
+ );
2911
+ }, Tl = ({ profileUrl: e, isBotMessage: t }) => !e && t ? /* @__PURE__ */ r.createElement(qn, { size: 32 }) : /* @__PURE__ */ r.createElement(It, { size: 32, src: e }), wl = ({
2912
+ profileUrl: e,
2913
+ isBotMessage: t,
2914
+ nickname: n,
2915
+ name: o,
2916
+ type: s,
2917
+ url: i,
2918
+ onClose: a,
2919
+ onDownloadClick: l
2920
+ }) => {
2921
+ const { stringSet: c } = O();
2922
+ return /* @__PURE__ */ r.createElement(Yn, { onClose: a, visible: !0, rootElementId: ee.MODAL_ROOT }, /* @__PURE__ */ r.createElement(ul, null, /* @__PURE__ */ r.createElement(ml, null, /* @__PURE__ */ r.createElement(gl, null, /* @__PURE__ */ r.createElement(hl, null, /* @__PURE__ */ r.createElement(Tl, { profileUrl: e, isBotMessage: t })), /* @__PURE__ */ r.createElement(pl, null, /* @__PURE__ */ r.createElement(w, { variant: "h2", color: p.themedColor.textHighEmphasis }, o)), /* @__PURE__ */ r.createElement(fl, null, /* @__PURE__ */ r.createElement(w, { variant: "body1", color: p.color.ondark.textMidEmphasis }, n))), /* @__PURE__ */ r.createElement(bl, null, an(s) && /* @__PURE__ */ r.createElement(El, null, /* @__PURE__ */ r.createElement(Jn, { as: "a", href: i, target: "_blank", rel: St, onClick: l }, /* @__PURE__ */ r.createElement(M, { type: "download", color: p.themedColor.textHighEmphasis, size: 24 }))), /* @__PURE__ */ r.createElement(xl, { onClick: a }, /* @__PURE__ */ r.createElement(M, { type: "close", color: p.themedColor.textHighEmphasis, size: 24 })))), /* @__PURE__ */ r.createElement(Cl, { onClick: (d) => d.currentTarget === d.target && a() }, Kn(s) && /* @__PURE__ */ r.createElement(vl, { controls: !0 }, /* @__PURE__ */ r.createElement("source", { src: i, type: s })), jn(s) && /* @__PURE__ */ r.createElement(yl, { src: i, alt: o }), !an(s) && /* @__PURE__ */ r.createElement(_l, null, /* @__PURE__ */ r.createElement(w, { variant: "h1", color: p.themedColor.textHighEmphasis }, c.FILE_VIEWER__UNSUPPORT)))));
2923
+ }, Xn = ({
2924
+ className: e,
2925
+ locale: t,
2926
+ date: n = Date.now(),
2927
+ formatString: o = "MMMM dd, yyyy",
2928
+ style: s
2929
+ }) => /* @__PURE__ */ r.createElement(Al, { id: `${J}-date-separator`, style: s, className: e }, /* @__PURE__ */ r.createElement(w, { variant: "caption4", color: p.themedColor.textMidEmphasis }, Cn(n, o, { locale: t }))), Al = u.div`display:flex;justify-content:center;align-items:center;`, kl = ye(function(t, n) {
2930
+ const {
2931
+ messages: o,
2932
+ renderMessage: s,
2933
+ messageTopArea: i,
2934
+ messageBottomArea: a,
2935
+ overlayArea: l,
2936
+ onLoadPrev: c,
2937
+ onLoadNext: d,
2938
+ loadThreshold: h = 0.05,
2939
+ onScrollPosition: m = Ie,
2940
+ depsForResetScrollPositionToBottom: f,
2941
+ scrollPositionRef: x,
2942
+ scrollDistanceFromBottomRef: E,
2943
+ stackDirection: b = "top"
2944
+ } = t, g = n && "current" in n ? n : { current: null }, C = N(!1), v = N(void 0), S = N(0), k = N(0), F = N(0), $ = x ?? k, V = E ?? F;
2945
+ le(() => {
2946
+ g.current && (g.current.scrollTop = g.current.scrollHeight);
2947
+ }, f), le(() => {
2948
+ g.current && (v.current === "top" && (g.current.scrollTop = g.current.scrollHeight - $.current), v.current === "bottom" && (g.current.scrollTop = S.current), v.current = void 0);
2949
+ }, [g.current, o.length]);
2950
+ const re = async () => {
2951
+ if (!g.current) return;
2952
+ const y = g.current;
2953
+ if (m(Il(y)), $.current = y.scrollHeight - y.scrollTop, V.current = $.current - y.clientHeight, S.current = y.scrollTop, C.current) return;
2954
+ const H = y.clientHeight * Math.min(Math.max(0, h), 1);
2955
+ y.scrollTop <= H ? (C.current = !0, v.current = "top", await c(), C.current = !1) : y.scrollHeight - y.scrollTop - y.clientHeight <= H ? (C.current = !0, v.current = "bottom", await d(), C.current = !1) : v.current = void 0;
2956
+ };
2957
+ return /* @__PURE__ */ r.createElement($l, { id: "infinite-list-container" }, /* @__PURE__ */ r.createElement(Ml, { id: "infinite-list-inner", ref: g, onScroll: re }, b === "bottom" && /* @__PURE__ */ r.createElement("div", { style: { flexGrow: 1 } }), i, o.map((y, H) => s({ message: y, index: H })), a), /* @__PURE__ */ r.createElement(Ol, { id: "infinite-list-overlay-container" }, /* @__PURE__ */ r.createElement(Ll, { id: "infinite-list-overlay" }, l)));
2958
+ }), cn = 50;
2959
+ function Il(e) {
2960
+ return e.scrollTop <= cn ? "top" : e.scrollHeight - (e.scrollTop + e.clientHeight) <= cn ? "bottom" : "middle";
2961
+ }
2962
+ const $l = u.div`display:flex;position:relative;flex:1;overflow:hidden;`, Ml = u.div`display:flex;flex:1;flex-direction:column;overflow-y:auto;scrollbar-color:${p.themedColor.textLowEmphasis}transparent;&::-webkit-scrollbar-thumb:hover{background-color:transparent;}`, Ol = u.div`position:absolute;top:0;bottom:0;left:0;right:0;pointer-events:none;`, Ll = u.div`pointer-events:auto;`, Rl = ({ className: e, onClick: t }) => /* @__PURE__ */ r.createElement(Dl, { className: e, onClick: t, tabIndex: 0 }, /* @__PURE__ */ r.createElement(M, { size: 24, type: "chevron-down", color: p.color.primary.main })), Dl = u.button`all:unset;cursor:pointer;display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:24px;box-shadow:0 2px 8px 0 rgba(0,0,0,0.08),0 4px 6px 0 rgba(0,0,0,0.12);${P.light`
2963
+ background-color: ${p.color.background50};
2964
+ &:hover {
2965
+ background-color: ${p.color.background100};
2966
+ }
2967
+ &:active {
2968
+ background-color: ${p.color.background200};
2969
+ }
2970
+ `}
2971
+ ${P.dark`
2972
+ background-color: ${p.color.background400};
2973
+ &:hover {
2974
+ background-color: ${p.color.background500};
2975
+ }
2976
+ &:active {
2977
+ background-color: ${p.color.background700};
2978
+ }
2979
+ `}
2980
+
2981
+ &:focus {
2982
+ outline: none;
2983
+ }
2984
+ `, Qn = () => {
2985
+ const { chatSDK: e } = B(), { channelSource: t } = Z(), [n, o] = _([]);
2986
+ return Xe(e, {
2987
+ onTypingStatusUpdated(s) {
2988
+ var i;
2989
+ if (s.url === ((i = t.channel) == null ? void 0 : i.url)) {
2990
+ const a = s.getTypingUsers();
2991
+ o(a);
2992
+ }
2993
+ }
2994
+ }), n;
2995
+ }, Nl = () => {
2996
+ const { agentPreviewConfigs: e = {}, aiAgentId: t } = B(), { aiAgentInfo: n } = U(), { stringSet: o, dateLocale: s } = O(), { messageSource: i } = Z(), { Template: a } = xe.useContext(), l = e.welcomeMessages ?? [], c = i.messages, d = Ga(c, t), h = c[d.length + 1], m = d[0] ?? h;
2997
+ return {
2998
+ /**
2999
+ * Returns a list of messages filtered according to business requirements.
3000
+ */
3001
+ filteredMessages: c.filter((f) => Ka(f) ? !1 : l.length > 0 ? !Se.isWelcomeMessage(f, t) : !0),
3002
+ /**
3003
+ * Determines whether to display the DateSeparator in the data list by comparing it with the welcome messages from Bot Studio.
3004
+ */
3005
+ shouldShowOriginalDate: (f) => f > 0 || l.length === 0 ? !0 : h && !Mr(h.createdAt, (m == null ? void 0 : m.createdAt) ?? 0),
3006
+ /**
3007
+ * Renders the list of welcome messages from Bot Studio.
3008
+ */
3009
+ renderAgentPreviewWelcomeMessages: () => l.length === 0 ? null : /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
3010
+ Xn,
3011
+ {
3012
+ style: { margin: "16px 0" },
3013
+ date: m == null ? void 0 : m.createdAt,
3014
+ locale: s,
3015
+ formatString: o.DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR
3016
+ }
3017
+ ), l.map((f, x) => {
3018
+ const E = x === l.length - 1, b = d.length !== c.length, g = l.length === 1 ? "single" : x === 0 ? "top" : E || b ? "bottom" : "middle";
3019
+ return /* @__PURE__ */ r.createElement(
3020
+ a,
3021
+ {
3022
+ messageType: "user",
3023
+ message: f.message,
3024
+ sender: n,
3025
+ groupType: g,
3026
+ createdAt: (m == null ? void 0 : m.createdAt) ?? Date.now(),
3027
+ extendedMessagePayload: { suggested_replies: f.suggestedReplies },
3028
+ suggestedRepliesDirection: e.suggestedRepliesDirection,
3029
+ suggestedRepliesVisible: E && !b,
3030
+ isBotMessage: !0,
3031
+ onClickSuggestedReply: async ({ reply: C }) => {
3032
+ i.sendUserMessage({ message: C });
3033
+ }
3034
+ }
3035
+ );
3036
+ }))
3037
+ };
3038
+ }, Pl = (e) => u(e).withConfig({ shouldForwardProp: jr });
3039
+ function Bl(e) {
3040
+ var o;
3041
+ const t = "remove_powered_by", n = (o = e == null ? void 0 : e.appInfo) == null ? void 0 : o.applicationAttributes;
3042
+ return Array.isArray(n) && n.includes(t);
3043
+ }
3044
+ const Fl = ({ style: e }) => {
3045
+ const { stringSet: t } = O(), { chatSDK: n } = B(), { isActionbookTester: o } = Re();
3046
+ return Bl(n) || o ? null : /* @__PURE__ */ r.createElement(Ul, { variant: "caption2", style: e }, t.POWERED_BY + " ", /* @__PURE__ */ r.createElement(
3047
+ Hl,
3048
+ {
3049
+ variant: "caption2",
3050
+ as: "a",
3051
+ href: "https://sendbird.com?utm_medium=product&utm_source=aiagent&utm_campaign=fy26-glbl-ai-agent-poweredby",
3052
+ "aria-label": "Learn more about Sendbird",
3053
+ rel: St,
3054
+ target: "_blank"
3055
+ },
3056
+ "Sendbird"
3057
+ ));
3058
+ }, Ul = u(w)`color:${p.themedColor.textLowEmphasis};text-align:center;`, Hl = Pl(w)`
3059
+ color: ${p.themedColor.textLowEmphasis};
3060
+ cursor: pointer;
3061
+ text-decoration: none;
3062
+ `, zl = () => {
3063
+ var c;
3064
+ const { stringSet: e } = O(), { activeChannel: t } = U(), { channelSource: n, goToActiveConversation: o, scrollSource: s } = Z(), i = Pn(n.channel), l = t && ((c = n.channel) == null ? void 0 : c.url) === (t == null ? void 0 : t.url) && i;
3065
+ return le(() => {
3066
+ l && s.scrollPubSub.publish({ type: "scrollToBottom", data: { animated: !0 } });
3067
+ }, [l]), l ? /* @__PURE__ */ r.createElement(Vl, null, /* @__PURE__ */ r.createElement(
3068
+ Wl,
3069
+ {
3070
+ variant: "button",
3071
+ role: "button",
3072
+ color: p.themedColor.textHighEmphasis,
3073
+ onClick: () => o()
3074
+ },
3075
+ e.START_NEW_CONVERSATION
3076
+ )) : null;
3077
+ }, Vl = u.div`display:flex;justify-content:center;margin:16px 0;`, Wl = u(w)`border-radius:6px;box-sizing:border-box;padding:10px 20px;border:1px solid ${p.themedColor.textDisabled};cursor:pointer;user-select:none;`, Gl = !0, jl = () => {
3078
+ const { Template: e } = Ot.useContext(), { Template: t } = xe.useContext(), { Template: n } = Lt.useContext(), [o, s] = _(null), { userSession: i, aiAgentInfo: a } = U(), { cache: l, agentPreviewConfigs: c, chatSDK: d, state: h } = B(), { stringSet: m, dateLocale: f } = O(), { conversation: x, channelSource: E, messageSource: b, scrollSource: g } = Z(), { isActionbookTester: C } = Re(), { filteredMessages: v, shouldShowOriginalDate: S, renderAgentPreviewWelcomeMessages: k } = Nl(), F = Qn(), $ = Mt(() => {
3079
+ const y = F[0];
3080
+ if (!y) return null;
3081
+ const H = y.userId === a.userId;
3082
+ return { user: H ? a : y, isBot: H };
3083
+ });
3084
+ L(() => {
3085
+ $ && g.scrollPubSub.publish({ type: "scrollToBottom", data: { animated: !0 } });
3086
+ }, [!!$, g.scrollPubSub.publish]);
3087
+ const V = (y, H = !1) => {
3088
+ var oe;
3089
+ return H ? a : ((oe = E.channel) == null ? void 0 : oe.members.find((Y) => Y.userId === y.sender.userId)) ?? y.sender;
3090
+ }, re = () => {
3091
+ if (!b.initialized)
3092
+ return /* @__PURE__ */ r.createElement(Ce, { type: "loading" });
3093
+ if (b.messages.length === 0) {
3094
+ const y = k();
3095
+ return y ? /* @__PURE__ */ r.createElement("div", { style: { width: "100%" } }, y) : /* @__PURE__ */ r.createElement(Ce, { type: "noMessages", label: m.PLACE_HOLDER__NO_MESSAGES });
3096
+ }
3097
+ return /* @__PURE__ */ r.createElement(
3098
+ kl,
3099
+ {
3100
+ ref: g.scrollRef,
3101
+ scrollPositionRef: g.scrollPositionRef,
3102
+ scrollDistanceFromBottomRef: g.scrollDistanceFromBottomRef,
3103
+ onScrollPosition: (y) => g.setIsScrollBottomReached(y === "bottom"),
3104
+ stackDirection: c == null ? void 0 : c.messageStackDirection,
3105
+ messages: v,
3106
+ onLoadPrev: b.loadPrevious,
3107
+ onLoadNext: b.loadNext,
3108
+ depsForResetScrollPositionToBottom: [b.initialized, b.messages.length !== 0],
3109
+ messageTopArea: /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(Fl, { style: { marginTop: 16 } }), k()),
3110
+ messageBottomArea: /* @__PURE__ */ r.createElement(r.Fragment, null, $ && /* @__PURE__ */ r.createElement(
3111
+ t,
3112
+ {
3113
+ isTyping: !0,
3114
+ isBotMessage: $.isBot,
3115
+ sender: $.user,
3116
+ messageType: "user",
3117
+ groupType: "single",
3118
+ message: ""
3119
+ }
3120
+ ), /* @__PURE__ */ r.createElement(zl, null)),
3121
+ overlayArea: /* @__PURE__ */ r.createElement(r.Fragment, null, !g.isScrollBottomReached && /* @__PURE__ */ r.createElement(Zl, { onClick: () => g.scrollPubSub.publish({ type: "scrollToBottom" }) })),
3122
+ renderMessage: ({ message: y, index: H }) => {
3123
+ const oe = Va(y), Y = v[H - 1], nt = v[H + 1], rt = v[v.length - 1], A = y === rt, D = Wa(y, Y, nt, Gl), K = !Wr((Y == null ? void 0 : Y.createdAt) ?? 0, y.createdAt) && S(H) && !C, q = (Pe) => {
3124
+ (y.isFileMessage() || y.isUserMessage()) && s({ file: Pe, sender: V(y, y.sender.userId === a.userId) });
3125
+ }, be = () => {
3126
+ y.isFileMessage() && $t(y.url);
3127
+ }, fr = K ? /* @__PURE__ */ r.createElement(
3128
+ Xn,
3129
+ {
3130
+ style: { margin: "16px 0" },
3131
+ date: y.createdAt,
3132
+ locale: f,
3133
+ formatString: m.DATE_FORMAT__MESSAGE_LIST__DATE_SEPARATOR
3134
+ }
3135
+ ) : null, Ne = {
3136
+ maxBodyWidth: h.expanded ? Ln : void 0,
3137
+ extendedMessagePayload: y.extendedMessagePayload,
3138
+ createdAt: y.createdAt,
3139
+ groupType: D,
3140
+ onClickMedia: q,
3141
+ onClickFile: be
3142
+ }, br = (() => {
3143
+ var Pe, Ft;
3144
+ if (Ve.isAdmin(y))
3145
+ return Ve.isCSAT(y) ? x ? /* @__PURE__ */ r.createElement(
3146
+ n,
3147
+ {
3148
+ ...Ne,
3149
+ ...x,
3150
+ isResolvedWhenDeterminedByUser: Yl(x),
3151
+ messageType: "admin.csat",
3152
+ onSubmitCSAT: ({ csat: se, csatType: me, csatReason: z, isResolved: ie }) => {
3153
+ var ge;
3154
+ se && ((ge = E.channel) == null || ge.submitCSAT({ csat: se, csatType: me, csatReason: z, isResolved: ie }));
3155
+ }
3156
+ }
3157
+ ) : null : /* @__PURE__ */ r.createElement(n, { ...Ne, messageType: "admin", message: y.message });
3158
+ if (Ve.isOutgoing(y, i.userId)) {
3159
+ const se = {
3160
+ ...Ne,
3161
+ message: y.message,
3162
+ sender: V(y),
3163
+ sendingStatus: y.sendingStatus
3164
+ };
3165
+ if (y.isUserMessage())
3166
+ return /* @__PURE__ */ r.createElement(e, { messageType: "user", ...se });
3167
+ if (y.isFileMessage()) {
3168
+ const [me, z] = ((Pe = y.metaArrays.find((ie) => ie.key === Zn)) == null ? void 0 : Pe.value) ?? [];
3169
+ return /* @__PURE__ */ r.createElement(
3170
+ e,
3171
+ {
3172
+ messageType: "file",
3173
+ file: y,
3174
+ metadata: {
3175
+ aspectRatio: me && z ? `${me}/${z}` : "1/1",
3176
+ localFile: (Ft = y.messageParams) == null ? void 0 : Ft.file
3177
+ },
3178
+ ...se
3179
+ }
3180
+ );
3181
+ }
3182
+ }
3183
+ if (Ve.isIncoming(y, i.userId)) {
3184
+ const se = y.sender.userId === a.userId, me = {
3185
+ ...Ne,
3186
+ sender: V(y, se),
3187
+ message: y.message,
3188
+ suggestedRepliesVisible: A,
3189
+ suggestedRepliesDirection: c == null ? void 0 : c.suggestedRepliesDirection,
3190
+ isBotMessage: se,
3191
+ isStreaming: Se.isStreaming(y),
3192
+ onClickSuggestedReply: async ({ reply: z }) => {
3193
+ b.sendUserMessage({ message: z });
3194
+ },
3195
+ onRequestMessageTemplate: async (z) => {
3196
+ const { template: ie } = await d.aiAgent.getMessageTemplate(z);
3197
+ return l.template.set(z, ie), ie;
3198
+ },
3199
+ onGetCachedMessageTemplate: (z) => l.template.get(z),
3200
+ onHandleTemplateInternalAction: (z) => {
3201
+ if (z.type === "internal" && z.internalData) {
3202
+ const { method: ie, payload: ge } = z.internalData;
3203
+ ie === "message.send" && (ge != null && ge.message) && b.sendUserMessage({ message: ge.message });
3204
+ }
3205
+ }
3206
+ };
3207
+ if (y.isUserMessage())
3208
+ return /* @__PURE__ */ r.createElement(t, { messageType: "user", ...me });
3209
+ if (y.isFileMessage())
3210
+ return /* @__PURE__ */ r.createElement(t, { messageType: "file", file: y, ...me });
3211
+ }
3212
+ })();
3213
+ return /* @__PURE__ */ r.createElement("div", { key: oe, id: `${J}-message-item` }, fr, br);
3214
+ }
3215
+ }
3216
+ );
3217
+ };
3218
+ return /* @__PURE__ */ r.createElement(Kl, { id: `${J}-message-list` }, re(), o && /* @__PURE__ */ r.createElement(Sl, { onClose: () => s(null), sender: o.sender, file: o.file }));
3219
+ }, Kl = u.div`overflow-y:hidden;display:flex;flex:1;position:relative;`, Zl = u(Rl)`position:absolute;bottom:20px;inset-inline-end:20px;`;
3220
+ function Yl(e) {
3221
+ var t;
3222
+ if (((t = e == null ? void 0 : e.resolution) == null ? void 0 : t.determinedBy) === "user")
3223
+ return e.resolution.isResolved;
3224
+ }
3225
+ const ql = () => {
3226
+ const { stringSet: e } = O(), { connectionError: t } = U(), { channelSource: n } = Z(), o = t || n.error;
3227
+ if (o) {
3228
+ const s = t ? void 0 : { label: e.RETRY, onClick: () => n.refetch() };
3229
+ return /* @__PURE__ */ r.createElement(Ce, { type: "error", label: o.message, action: s });
3230
+ }
3231
+ return n.channel ? /* @__PURE__ */ r.createElement(jl, null) : /* @__PURE__ */ r.createElement(Ce, { type: "loading" });
3232
+ }, er = () => {
3233
+ const { stringSet: e } = O(), { activeChannel: t } = U(), [n] = _(() => (t == null ? void 0 : t.status) === W.OPEN);
3234
+ return n ? e.RETURN_TO_CONVERSATION : e.START_NEW_CONVERSATION;
3235
+ }, Jl = () => {
3236
+ const { stringSet: e } = O(), { goToActiveConversation: t } = Z(), n = er();
3237
+ return /* @__PURE__ */ r.createElement(Xl, null, /* @__PURE__ */ r.createElement(w, { variant: "body1", color: p.themedColor.textMidEmphasis }, e.CONVERSATION_CLOSED_FOOTER_LABEL), /* @__PURE__ */ r.createElement(Ql, { onClick: t }, /* @__PURE__ */ r.createElement(w, { variant: "button", color: p.themedColor.textHighEmphasis }, n)));
3238
+ }, Xl = u.div`display:flex;flex-direction:column;align-items:center;justify-content:center;padding:32px 0;gap:14px;${P.light`
3239
+ background-color: ${p.color.background100};
3240
+ `}
3241
+ ${P.dark`
3242
+ background-color: ${p.color.background500};
3243
+ `}
3244
+ `, Ql = u.button`all:unset;padding:10px 20px;border-radius:6px;border:1px solid ${p.themedColor.textDisabled};cursor:pointer;${P.light`
3245
+ background-color: ${p.color.background50};
3246
+ `}
3247
+ ${P.dark`
3248
+ background-color: ${p.color.background700};
3249
+ `}
3250
+ `, tr = ve(void 0), ec = ({ children: e }) => {
3251
+ const { stringSet: t } = O(), { attachmentMode: n } = U(), { channelSource: o } = Z(), [s, i] = _([]), [a, l] = _({
3252
+ visible: !1,
3253
+ title: "",
3254
+ buttonText: t.BUTTON__OK
3255
+ }), c = Fn(o.channel), d = ae(() => {
3256
+ switch (n) {
3257
+ case je.OFF:
3258
+ return !1;
3259
+ case je.ALWAYS:
3260
+ return !0;
3261
+ case je.HANDED_OFF_ONLY:
3262
+ return c;
3263
+ default:
3264
+ return c;
3265
+ }
3266
+ }, [n, c]), h = (x) => {
3267
+ if (!d) return;
3268
+ const E = x.filter((b) => On.includes(b.type));
3269
+ if (E.length !== 0) {
3270
+ if (E.some((b) => b.size > _s)) {
3271
+ l((b) => ({
3272
+ ...b,
3273
+ visible: !0,
3274
+ title: t.FILE_UPLOAD_NOTIFICATION__SIZE_LIMIT.replace("%d", "25")
3275
+ }));
3276
+ return;
3277
+ }
3278
+ if (E.length > 1 || E.length > 0 && s.length > 0) {
3279
+ l((b) => ({
3280
+ ...b,
3281
+ visible: !0,
3282
+ title: t.FILE_UPLOAD_NOTIFICATION__COUNT_LIMIT
3283
+ }));
3284
+ return;
3285
+ }
3286
+ i((b) => [
3287
+ ...b,
3288
+ ...E.map((g) => ({
3289
+ file: g,
3290
+ preview: { url: URL.createObjectURL(g), type: g.type, name: g.name }
3291
+ }))
3292
+ ]);
3293
+ }
3294
+ }, m = (x) => {
3295
+ i((E) => {
3296
+ var g;
3297
+ const b = (g = E[x]) == null ? void 0 : g.preview;
3298
+ return b && URL.revokeObjectURL(b.url), E.filter((C, v) => v !== x);
3299
+ });
3300
+ }, f = () => {
3301
+ i((x) => (x.forEach((E) => URL.revokeObjectURL(E.preview.url)), []));
3302
+ };
3303
+ return /* @__PURE__ */ r.createElement(
3304
+ tr.Provider,
3305
+ {
3306
+ value: {
3307
+ files: s,
3308
+ addFiles: h,
3309
+ removeFile: m,
3310
+ clearFiles: f,
3311
+ isFileUploadEnabled: d
3312
+ }
3313
+ },
3314
+ e,
3315
+ /* @__PURE__ */ r.createElement(tc, { ...a, onClose: () => l((x) => ({ ...x, visible: !1, title: "" })) })
3316
+ );
3317
+ }, Dt = () => {
3318
+ const e = Q(tr);
3319
+ if (!e)
3320
+ throw new Error("useFileUpload must be used within FileUploadProvider");
3321
+ return e;
3322
+ }, tc = ({
3323
+ title: e,
3324
+ buttonText: t,
3325
+ visible: n,
3326
+ onClose: o
3327
+ }) => /* @__PURE__ */ r.createElement(Yn, { rootElementId: ee.WINDOW, visible: n, onClose: o }, /* @__PURE__ */ r.createElement(nc, null, /* @__PURE__ */ r.createElement(oc, null, /* @__PURE__ */ r.createElement(w, { variant: "h1", color: p.themedColor.textHighEmphasis }, e)), /* @__PURE__ */ r.createElement(rc, null, /* @__PURE__ */ r.createElement(sc, { onClick: o }, /* @__PURE__ */ r.createElement(w, { variant: "button", color: p.themedColor.textHighEmphasisInverse }, t))))), nc = u.div`width:100%;height:auto;padding-block:18px 24px;padding-inline:24px;margin:0 auto;border-radius:4px;box-sizing:border-box;background-color:${({ theme: e }) => e.colors.base.modalContentBackground};`, rc = u.div`display:flex;flex-direction:row;justify-content:flex-end;`, oc = u.div`margin-bottom:16px;`, sc = u.button`display:flex;justify-content:center;align-items:center;border-radius:4px;cursor:pointer;background-color:${p.themedColor.error};border:1px solid ${p.themedColor.error};padding:10px 16px;&:hover{background-color:${p.color.error.dark};border-color:${p.color.error.dark};}&:active{background-color:${p.color.error.extraDark};}`;
3328
+ function ic({ blurred: e, elementRef: t, document: n = window.document }) {
3329
+ const o = N(!1);
3330
+ e && t.current && n.activeElement === t.current && (o.current = !0), le(() => {
3331
+ var s;
3332
+ !e && o.current && ((s = t.current) == null || s.focus(), o.current = !1);
3333
+ }, [e]);
3334
+ }
3335
+ const ac = (e, t) => {
3336
+ L(() => {
3337
+ t ? e == null || e.startTyping() : e == null || e.endTyping();
3338
+ }, [e, t]);
3339
+ }, lc = u.div`&::-webkit-scrollbar{display:none;}overflow-x:auto;display:flex;flex-direction:row;gap:10px;padding:8px 16px;background-color:transparent;`, cc = u.div`display:flex;flex-shrink:0;position:relative;margin-block-start:8px;border-radius:12px;height:64px;img{border-radius:12px;object-fit:cover;width:64px;-webkit-user-drag:none;}`, dc = u.div`display:flex;align-items:center;justify-content:center;position:absolute;inset-inline-end:-8px;inset-block-start:-8px;cursor:pointer;border-radius:50%;${P.light`
3340
+ background-color: ${p.color.background50};
3341
+ `}
3342
+ ${P.dark`
3343
+ background-color: ${p.color.background500};
3344
+ `}
3345
+ path {
3346
+ fill: ${p.themedColor.textMidEmphasis};
3347
+ }
3348
+
3349
+ &:hover {
3350
+ path {
3351
+ fill: ${p.themedColor.textHighEmphasis};
3352
+ }
3353
+ }
3354
+
3355
+ circle {
3356
+ stroke: ${p.themedColor.bg_50_600};
3357
+ }
3358
+ `, uc = () => {
3359
+ const e = Oe(), [t, n] = _(), { files: o, removeFile: s, isFileUploadEnabled: i } = Dt();
3360
+ return !i || o.length === 0 ? null : /* @__PURE__ */ r.createElement(lc, null, o.map(({ preview: { type: a, name: l, url: c } }, d) => /* @__PURE__ */ r.createElement(cc, { key: c, onMouseOver: () => n(d), onMouseLeave: () => n(void 0) }, (e || t === d) && /* @__PURE__ */ r.createElement(dc, { title: "Remove file", onClick: () => s(d) }, /* @__PURE__ */ r.createElement(M, { type: "close-filled", color: p.themedColor.textMidEmphasis })), a.startsWith("image/") ? /* @__PURE__ */ r.createElement("img", { alt: "file-image", src: c }) : /* @__PURE__ */ r.createElement(At, { name: l, type: wt(l, a) }))));
3361
+ }, mc = ({ channel: e, messages: t }) => {
3362
+ const { stringSet: n } = O(), { aiAgentInfo: o } = U(), s = gc(), i = hc({
3363
+ lastMessage: t[t.length - 1],
3364
+ aiAgentUserId: o.userId
3365
+ });
3366
+ return !e || !s || Pn(e) ? [!0, n.MESSAGE_INPUT__PLACE_HOLDER__DISABLED] : i ? [!0, n.MESSAGE_INPUT__PLACE_HOLDER__WAIT_AI_AGENT_RESPONSE] : [!1, n.MESSAGE_INPUT__PLACE_HOLDER];
3367
+ }, gc = () => {
3368
+ const e = bn(), { chatSDK: t } = B(), [n, o] = _(!0);
3369
+ return L(() => {
3370
+ const s = new Je({
3371
+ onDisconnected: () => o(!1),
3372
+ onConnected: () => o(!0),
3373
+ onReconnectSucceeded: () => o(!0)
3374
+ });
3375
+ return t.addConnectionHandler(e, s), () => {
3376
+ t.removeConnectionHandler(e);
3377
+ };
3378
+ }, [t]), n;
3379
+ }, hc = ({
3380
+ lastMessage: e,
3381
+ aiAgentUserId: t
3382
+ }) => {
3383
+ const [n, o] = _(!1), s = Qn();
3384
+ return L(() => {
3385
+ if (!e) return;
3386
+ const i = s.some((l) => l.userId === t), a = Gn(e, t) && Se.isStreaming(e);
3387
+ o(!!(a || i));
3388
+ }, [s, e, t]), n;
3389
+ }, nr = {
3390
+ textArea: I`min-height:40px;height:40px;font-size:16px;line-height:24px;`,
3391
+ attachIcon: I`margin-bottom:4px;`
3392
+ }, rr = u.button`all:unset;cursor:pointer;display:flex;align-items:center;justify-content:center;width:32px;height:32px;`, pc = u(rr)`flex-shrink:0;margin-inline-end:12px;margin-bottom:2px;&:disabled{cursor:not-allowed;}&:not(:disabled){&:hover{path{fill:${p.themedColor.textHighEmphasis};}}&:active{border-radius:4px;background-color:${p.themedColor.bg_200_400};}}${_t && nr.attachIcon};`, fc = u.input`display:none;`, dn = u.div`width:100%;position:relative;background-color:${p.themedColor.bg_100_500};border-radius:20px;`, un = u.div`display:flex;flex-direction:row;align-items:flex-end;position:relative;`, mn = u.textarea`all:unset;display:block;flex:1;min-width:0;padding-top:8px;padding-bottom:8px;padding-inline-start:16px;padding-inline-end:12px;box-sizing:border-box;font-size:14px;line-height:20px;color:${p.themedColor.textHighEmphasis};resize:none;width:100%;height:${Mn}px;overflow-wrap:break-word;white-space:pre-wrap;overflow-x:hidden;${_t && nr.textArea};&::placeholder{color:${p.themedColor.textLowEmphasis};}&:disabled{cursor:not-allowed;&::placeholder{color:${p.themedColor.textDisabled};}}`, gn = u.div`padding:12px 16px;position:relative;display:flex;align-items:center;`, hn = ({ disabled: e }) => {
3393
+ const t = N(null), { addFiles: n, clearFiles: o, files: s, isFileUploadEnabled: i } = Dt();
3394
+ return !i || s.length > 0 ? null : /* @__PURE__ */ r.createElement(
3395
+ pc,
3396
+ {
3397
+ disabled: e,
3398
+ onClick: () => {
3399
+ var a;
3400
+ o(), (a = t.current) == null || a.click();
3401
+ }
3402
+ },
3403
+ /* @__PURE__ */ r.createElement(
3404
+ M,
3405
+ {
3406
+ type: "attach",
3407
+ color: e ? p.themedColor.textDisabled : p.themedColor.textMidEmphasis,
3408
+ size: 16
3409
+ }
3410
+ ),
3411
+ /* @__PURE__ */ r.createElement(
3412
+ fc,
3413
+ {
3414
+ type: "file",
3415
+ ref: t,
3416
+ onChange: (a) => {
3417
+ const l = a.currentTarget.files;
3418
+ l && n(Array.from(l)), a.target.value = "";
3419
+ },
3420
+ accept: On.join(",")
3421
+ }
3422
+ )
3423
+ );
3424
+ }, bc = () => {
3425
+ const e = N(null), [t, n] = _(""), { rootElement: o } = B(), { channelSource: s, messageSource: i } = Z(), [a, l] = mc({
3426
+ channel: s.channel,
3427
+ messages: i.messages
3428
+ }), { files: c, addFiles: d, clearFiles: h } = Dt();
3429
+ rl({ onDropFiles: d }), ic({ blurred: a, elementRef: e, document: pe(o) }), ac(s.channel, t);
3430
+ const m = t.trim().length > 0, f = c.length > 0, x = !a && (m || f), E = () => {
3431
+ e.current && (e.current.value = "", e.current.style.height = ""), h(), n("");
3432
+ }, b = async () => {
3433
+ const S = t.trim(), k = { message: S };
3434
+ if (!(!S && !c.length)) {
3435
+ if (c.length > 0) {
3436
+ const F = c[0].file, $ = { ...k, file: F };
3437
+ i.sendFileMessage($), E();
3438
+ return;
3439
+ }
3440
+ i.sendUserMessage(k), E();
3441
+ }
3442
+ }, g = (S) => {
3443
+ const k = Array.from(S.clipboardData.files);
3444
+ k.length > 0 && (S.preventDefault(), d(k));
3445
+ }, C = (S) => {
3446
+ S.key !== "Enter" || S.nativeEvent.isComposing || S.shiftKey || (S.preventDefault(), b());
3447
+ }, v = (S) => {
3448
+ if (e.current) {
3449
+ e.current.style.height = "";
3450
+ const k = Math.min(ys, e.current.scrollHeight);
3451
+ Mn < k && (e.current.style.height = `${k}px`);
3452
+ }
3453
+ n(S.target.value);
3454
+ };
3455
+ return a ? /* @__PURE__ */ r.createElement(gn, null, /* @__PURE__ */ r.createElement(dn, null, /* @__PURE__ */ r.createElement(un, null, /* @__PURE__ */ r.createElement(mn, { disabled: !0, placeholder: l }), /* @__PURE__ */ r.createElement(hn, { disabled: !0 })))) : /* @__PURE__ */ r.createElement(gn, null, /* @__PURE__ */ r.createElement(dn, null, /* @__PURE__ */ r.createElement(uc, null), /* @__PURE__ */ r.createElement(un, null, /* @__PURE__ */ r.createElement(
3456
+ mn,
3457
+ {
3458
+ ref: e,
3459
+ role: "textbox",
3460
+ "aria-label": "Text Input",
3461
+ placeholder: l,
3462
+ maxLength: 5e3,
3463
+ onKeyDown: C,
3464
+ onChange: v,
3465
+ onPaste: g
3466
+ }
3467
+ ), /* @__PURE__ */ r.createElement(hn, null))), x && /* @__PURE__ */ r.createElement(rr, { onClick: () => b() }, /* @__PURE__ */ r.createElement(M, { type: "send", color: p.color.primary.main, size: 20 })));
3468
+ }, Ec = u.div`padding:8px 16px;text-align:center;word-break:break-word;white-space:pre-wrap;line-height:1.43;letter-spacing:-0.2px;font-size:14px;font-weight:400;color:${p.themedColor.textLowEmphasis};&& a{font-weight:700;text-decoration:none;${P.light`
3469
+ color: ${p.color.information.light};
3470
+ `};
3471
+ ${P.dark`
3472
+ color: ${p.color.information.main};
3473
+ `};
3474
+ }
3475
+ `, xc = T(() => import("./CwdCJ7xG.js").then((e) => ({ default: e.MarkdownText }))), Cc = () => {
3476
+ const { aiAgentInfo: e } = U(), { messageSource: t } = Z(), { userSession: n } = U();
3477
+ return !e.specialNoticeEnabled || !e.specialNotice || !(t.initialized && !t.messages.some((s) => Gn(s, n.userId))) ? null : /* @__PURE__ */ r.createElement(Ec, null, /* @__PURE__ */ r.createElement(xc, null, e.specialNotice));
3478
+ }, vc = () => /* @__PURE__ */ r.createElement(yc, null, /* @__PURE__ */ r.createElement(Cc, null), /* @__PURE__ */ r.createElement(ec, null, /* @__PURE__ */ r.createElement(bc, null))), yc = u.div`z-index:0;border:none;width:100%;`, _c = () => {
3479
+ var i, a, l;
3480
+ const { activeChannel: e } = U(), { channelSource: t } = Z(), n = ((a = (i = t.channel) == null ? void 0 : i.conversation) == null ? void 0 : a.status) === W.CLOSED;
3481
+ return !(((l = t.channel) == null ? void 0 : l.url) === (e == null ? void 0 : e.url)) && n ? /* @__PURE__ */ r.createElement(Jl, null) : /* @__PURE__ */ r.createElement(vc, null);
3482
+ }, Sc = () => {
3483
+ var v;
3484
+ const { state: e, logger: t, enableCloseConversationButton: n, enableExpandButton: o, dispatcher: s } = B(), { stringSet: i } = O(), { aiAgentInfo: a, activeChannel: l } = U(), { channelSource: c, onNavigateToConversationList: d } = Z(), h = c.channel, f = Oe() ? 24 : 16, x = () => {
3485
+ e.setOpened(!1);
3486
+ }, E = async () => {
3487
+ try {
3488
+ const S = await (h == null ? void 0 : h.markConversationAsHandoff());
3489
+ t.info("conversation.handleAgentHandoff: success", S);
3490
+ } catch (S) {
3491
+ t.error("conversation.handleAgentHandoff: error", S);
3492
+ }
3493
+ }, b = async () => {
3494
+ h && await s.send(ro.CloseConversation({ channelUrl: h.url }));
3495
+ }, g = l && (h == null ? void 0 : h.url) === l.url, C = a.showHandoffButton && !!((v = h == null ? void 0 : h.conversation) != null && v.handoff) && g;
3496
+ return /* @__PURE__ */ r.createElement(Ic, null, /* @__PURE__ */ r.createElement($c, null, d && /* @__PURE__ */ r.createElement(De, { onClick: () => d() }, /* @__PURE__ */ r.createElement(M, { type: "menu", size: 24, color: p.themedColor.textHighEmphasis })), g && /* @__PURE__ */ r.createElement(qn, { size: 34 }), /* @__PURE__ */ r.createElement(Oc, { variant: "h2", color: p.themedColor.textHighEmphasis }, a.nickname || (h == null ? void 0 : h.name))), /* @__PURE__ */ r.createElement(Mc, null, C && /* @__PURE__ */ r.createElement(
3497
+ kc,
3498
+ {
3499
+ tooltipLabel: i.HEADER_BUTTON__AGENT_HANDOFF,
3500
+ disabled: !oi(h),
3501
+ size: f,
3502
+ onClick: E
3503
+ }
3504
+ ), n && /* @__PURE__ */ r.createElement(
3505
+ Ac,
3506
+ {
3507
+ disabled: !Bn(h),
3508
+ size: f,
3509
+ onClick: b
3510
+ }
3511
+ ), o && /* @__PURE__ */ r.createElement(Tc, { size: f }), /* @__PURE__ */ r.createElement(wc, { size: f, onClick: x })));
3512
+ }, Tc = ({ size: e, disabled: t }) => {
3513
+ const { state: n } = B();
3514
+ return /* @__PURE__ */ r.createElement(De, { "aria-label": "expand", onClick: () => n.setExpanded(!n.expanded), disabled: t }, /* @__PURE__ */ r.createElement(M, { type: n.expanded ? "collapse" : "expand", size: e, color: p.themedColor.textHighEmphasis }));
3515
+ }, wc = ({ size: e, disabled: t, onClick: n }) => /* @__PURE__ */ r.createElement(De, { "aria-label": "close messenger", onClick: n, disabled: t }, /* @__PURE__ */ r.createElement(M, { type: "close", size: e, color: p.themedColor.textHighEmphasis })), Ac = ({ size: e, disabled: t, onClick: n }) => /* @__PURE__ */ r.createElement(De, { "aria-label": "close conversation", onClick: n, disabled: t }, /* @__PURE__ */ r.createElement(
3516
+ M,
3517
+ {
3518
+ type: "refresh",
3519
+ size: e,
3520
+ color: t ? p.themedColor.textDisabled : p.themedColor.textHighEmphasis
3521
+ }
3522
+ )), kc = ({ size: e, onClick: t, disabled: n, tooltipLabel: o }) => /* @__PURE__ */ r.createElement(Vn, { label: o, position: "bottom", disabled: n }, /* @__PURE__ */ r.createElement(De, { "aria-label": "agent", onClick: t, disabled: n }, /* @__PURE__ */ r.createElement(
3523
+ M,
3524
+ {
3525
+ type: "agent",
3526
+ size: e,
3527
+ color: n ? p.themedColor.textDisabled : p.themedColor.textHighEmphasis
3528
+ }
3529
+ ))), Ic = u.div`height:56px;box-sizing:border-box;display:flex;align-items:center;padding:11px 12px;border-bottom:1px solid ${p.themedColor.textDisabled};background-color:${({ theme: e }) => e.colors.base.headerBackground};`, $c = u.div`display:flex;flex:1;flex-direction:row;align-items:center;gap:6px;overflow:hidden;`, Mc = u.div`display:flex;gap:10px;align-items:center;justify-content:center;`, Oc = u(w)`text-overflow:ellipsis;overflow:hidden;white-space:nowrap;padding:2px 0;`, De = u.button`all:unset;padding:4px;cursor:pointer;display:flex;align-items:center;justify-content:center;&:disabled{cursor:not-allowed;}`, Lc = () => {
3530
+ const { isActionbookTester: e } = Re();
3531
+ return e ? null : /* @__PURE__ */ r.createElement(Sc, null);
3532
+ }, pn = ({
3533
+ children: e,
3534
+ onNavigateToConversationList: t,
3535
+ closedChannelUrl: n,
3536
+ onClearClosedChannelUrl: o
3537
+ }) => {
3538
+ const { Template: s } = Nt.useContext();
3539
+ return /* @__PURE__ */ r.createElement(
3540
+ nl,
3541
+ {
3542
+ onNavigateToConversationList: t,
3543
+ closedChannelUrl: n,
3544
+ onClearClosedChannelUrl: o
3545
+ },
3546
+ /* @__PURE__ */ r.createElement(Et, null, /* @__PURE__ */ r.createElement(Et.Consumer, null, (i) => /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(Dc, { ...i }, /* @__PURE__ */ r.createElement(s, null)), e)))
3547
+ );
3548
+ }, Nt = _e({
3549
+ template: Rc,
3550
+ components: {
3551
+ Header: Lc,
3552
+ Body: ql,
3553
+ Footer: _c
3554
+ }
3555
+ });
3556
+ function Rc() {
3557
+ const { components: e } = Nt.useContext();
3558
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(e.Header, null), /* @__PURE__ */ r.createElement(e.Body, null), /* @__PURE__ */ r.createElement(e.Footer, null));
3559
+ }
3560
+ const Dc = u.div`height:100%;width:100%;display:flex;flex-direction:column;flex:1;background-color:${({ theme: e }) => e.colors.base.background};`, {
3561
+ Provider: Nc,
3562
+ Context: iu,
3563
+ useContext: or
3564
+ } = G("ConversationList");
3565
+ function Pc({
3566
+ conversationListLimit: e,
3567
+ conversationListFilter: t,
3568
+ onOpenConversationView: n = Ie,
3569
+ children: o
3570
+ }) {
3571
+ return /* @__PURE__ */ r.createElement(
3572
+ go,
3573
+ {
3574
+ conversationListLimit: e,
3575
+ conversationListFilter: t
3576
+ },
3577
+ (s) => /* @__PURE__ */ r.createElement(Nc, { value: { ...s, onOpenConversationView: n } }, o)
3578
+ );
3579
+ }
3580
+ const sr = _e({
3581
+ template: Bc,
3582
+ // Note: 리스트 변경되면 디자인 변경 가능성이 있어서 일단 컴포넌트는 비워둠
3583
+ components: {}
3584
+ });
3585
+ function Bc({
3586
+ title: e = "",
3587
+ lastMessageTimestamp: t = Date.now(),
3588
+ onClick: n
3589
+ }) {
3590
+ const { stringSet: o, format: s } = O();
3591
+ return /* @__PURE__ */ r.createElement(Fc, { role: "button", onClick: () => n == null ? void 0 : n() }, /* @__PURE__ */ r.createElement(Hc, null, /* @__PURE__ */ r.createElement(zc, null, /* @__PURE__ */ r.createElement(w, { variant: "subtitle1", color: p.themedColor.textHighEmphasis }, s(t, o.DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE)), /* @__PURE__ */ r.createElement(w, { variant: "caption2", color: p.themedColor.textLowEmphasis }, s(t, o.DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE_CAPTION))), /* @__PURE__ */ r.createElement(w, { variant: "body3", color: p.themedColor.textMidEmphasis }, e || o.CONVERSATION_LIST__TOPICS_FALLBACK)), /* @__PURE__ */ r.createElement(M, { type: "chevron-right", size: 16, color: p.themedColor.textHighEmphasis }), /* @__PURE__ */ r.createElement(Uc, null));
3592
+ }
3593
+ const Fc = u.div`display:flex;flex-direction:row;align-items:center;position:relative;width:100%;padding:14px 16px;box-sizing:border-box;gap:4px;cursor:pointer;`, Uc = u.div`position:absolute;bottom:0;height:1px;width:calc(100% - 32px);background-color:${p.themedColor.textDisabled};`, Hc = u.div`gap:4px;display:flex;flex-direction:column;flex:1;`, zc = u.div`display:flex;justify-content:flex-start;align-items:center;gap:6px;`, Vc = ({ items: e, renderItem: t, onEndReached: n }) => {
3594
+ const o = (s) => {
3595
+ const i = s.target;
3596
+ i.scrollHeight - i.scrollTop === i.clientHeight && (n == null || n());
3597
+ };
3598
+ return /* @__PURE__ */ r.createElement(Wc, { onScroll: (s) => o(s) }, e.map((s, i) => t(s, i)));
3599
+ }, Wc = u.div`width:100%;height:100%;display:flex;flex-direction:column;flex:1;overflow:auto;`, Gc = () => {
3600
+ const { stringSet: e } = O(), { listSource: t, onOpenConversationView: n } = or(), { Template: o } = sr.useContext();
3601
+ return t.initialized ? t.channels.length === 0 ? /* @__PURE__ */ r.createElement(Ce, { type: "noChannels", label: e.CONVERSATION_LIST__NO_CONVERSATIONS }) : /* @__PURE__ */ r.createElement(
3602
+ Vc,
3603
+ {
3604
+ items: t.channels,
3605
+ renderItem: (s) => {
3606
+ var i, a, l;
3607
+ return /* @__PURE__ */ r.createElement(
3608
+ o,
3609
+ {
3610
+ key: s.url,
3611
+ channelUrl: s.url,
3612
+ title: (a = (i = s.conversation) == null ? void 0 : i.topics) == null ? void 0 : a.join(", "),
3613
+ lastMessageTimestamp: (l = s.lastMessage) == null ? void 0 : l.createdAt,
3614
+ onClick: () => n(s.url, W.CLOSED),
3615
+ channel: s
3616
+ }
3617
+ );
3618
+ },
3619
+ onEndReached: () => {
3620
+ t.loadMore();
3621
+ }
3622
+ }
3623
+ ) : /* @__PURE__ */ r.createElement(Ce, { type: "loading" });
3624
+ }, jc = () => {
3625
+ const { refreshActiveChannel: e } = U(), { onOpenConversationView: t } = or(), n = er();
3626
+ return /* @__PURE__ */ r.createElement(
3627
+ Kc,
3628
+ {
3629
+ role: "button",
3630
+ onClick: async () => {
3631
+ const o = await e();
3632
+ t(o, W.OPEN);
3633
+ }
3634
+ },
3635
+ /* @__PURE__ */ r.createElement(Zc, { variant: "h1" }, n)
3636
+ );
3637
+ }, Kc = u.div`background-color:${({ theme: e }) => e.colors.base.primary};display:flex;align-items:center;justify-content:center;padding:16px;cursor:pointer;`, Zc = u(w)`color:${({ theme: e }) => e.colors.base.primaryContrastContent};overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`, Yc = () => {
3638
+ const { stringSet: e } = O();
3639
+ return /* @__PURE__ */ r.createElement(qc, null, /* @__PURE__ */ r.createElement(Jc, { variant: "h2", color: p.themedColor.textHighEmphasis }, e.CONVERSATION_LIST__HEADER_TITLE), /* @__PURE__ */ r.createElement(Xc, null));
3640
+ }, qc = u.div`display:flex;flex-direction:column;align-items:flex-start;justify-content:center;width:100%;flex-shrink:0;height:56px;position:relative;background-color:${({ theme: e }) => e.colors.base.headerBackground};`, Jc = u(w)`padding:0 12px;width:100%;box-sizing:border-box;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;`, Xc = u.div`position:absolute;bottom:0;width:100%;height:1px;background-color:${p.themedColor.textDisabled};`, Qc = ({
3641
+ conversationListLimit: e,
3642
+ conversationListFilter: t,
3643
+ children: n,
3644
+ onOpenConversationView: o
3645
+ }) => {
3646
+ const { Template: s } = Pt.useContext();
3647
+ return /* @__PURE__ */ r.createElement(
3648
+ Pc,
3649
+ {
3650
+ conversationListLimit: e,
3651
+ conversationListFilter: t,
3652
+ onOpenConversationView: o
3653
+ },
3654
+ /* @__PURE__ */ r.createElement(td, null, /* @__PURE__ */ r.createElement(s, null)),
3655
+ n
3656
+ );
3657
+ }, Pt = _e({
3658
+ template: ed,
3659
+ components: {
3660
+ Header: Yc,
3661
+ Body: Gc,
3662
+ Footer: jc
3663
+ }
3664
+ });
3665
+ function ed() {
3666
+ const { components: e } = Pt.useContext();
3667
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(e.Header, null), /* @__PURE__ */ r.createElement(e.Body, null), /* @__PURE__ */ r.createElement(e.Footer, null));
3668
+ }
3669
+ const td = u.div`height:100%;width:100%;display:flex;flex-direction:column;flex:1;background-color:${({ theme: e }) => e.colors.base.background};`, nd = I`:where(#${ee.ENTRY}) :not(code *){font-family:'Roboto',sans-serif;box-sizing:border-box;}`, rd = [nd, ss, is], od = (e, ...t) => Ir(e, ...rd, ...t), sd = od``, id = Kr(
3670
+ Nt,
3671
+ xe,
3672
+ Ot,
3673
+ Lt,
3674
+ Pt,
3675
+ sr
3676
+ );
3677
+ function ad({
3678
+ appearance: e,
3679
+ rootElement: t,
3680
+ logger: n,
3681
+ language: o,
3682
+ stringSet: s,
3683
+ children: i,
3684
+ messageTemplate: a,
3685
+ theme: l
3686
+ }) {
3687
+ return ms(Yo, t), /* @__PURE__ */ r.createElement($r, { target: t }, /* @__PURE__ */ r.createElement(cs, { rootElement: t, logger: n, appearance: e, theme: l }, /* @__PURE__ */ r.createElement(zo, { internalVariables: a == null ? void 0 : a.__internalVariables }, /* @__PURE__ */ r.createElement(os, { stringSet: s, logger: n, language: o }, /* @__PURE__ */ r.createElement(id, null, i, /* @__PURE__ */ r.createElement(sd, null))))));
3688
+ }
3689
+ const We = {}, Ge = {
3690
+ getItem: (e) => {
3691
+ try {
3692
+ return localStorage.getItem(e);
3693
+ } catch {
3694
+ return We[e] ?? null;
3695
+ }
3696
+ },
3697
+ setItem: (e, t) => {
3698
+ try {
3699
+ localStorage.setItem(e, t);
3700
+ } catch {
3701
+ We[e] = t;
3702
+ }
3703
+ },
3704
+ deleteItem: (e) => {
3705
+ try {
3706
+ localStorage.removeItem(e);
3707
+ } catch {
3708
+ delete We[e];
3709
+ }
3710
+ },
3711
+ getKeys: (e) => {
3712
+ try {
3713
+ const t = [];
3714
+ for (let n = 0; n < localStorage.length; n++) {
3715
+ const o = localStorage.key(n);
3716
+ o && o.startsWith(e) && t.push(o);
3717
+ }
3718
+ return t;
3719
+ } catch {
3720
+ return Object.keys(We).filter((t) => t.startsWith(e));
3721
+ }
3722
+ }
3723
+ }, ir = ye(function({
3724
+ rootElement: t = document.body,
3725
+ logLevel: n = En.WARN,
3726
+ language: o = navigator.language,
3727
+ userSessionInfo: s,
3728
+ children: i,
3729
+ ...a
3730
+ }, l) {
3731
+ var c, d;
3732
+ return we.level !== n && (we.level = n), us("https://fonts.googleapis.com/css2?family=Roboto&display=swap", t), /* @__PURE__ */ r.createElement("div", { id: ee.ENTRY, style: { width: "fit-content", height: "fit-content", ...a.entryStyle } }, /* @__PURE__ */ r.createElement(
3733
+ ad,
3734
+ {
3735
+ logger: we,
3736
+ rootElement: t,
3737
+ appearance: (c = a.agentPreviewConfigs) == null ? void 0 : c.appearance,
3738
+ stringSet: a.stringSet,
3739
+ language: o,
3740
+ messageTemplate: a.messageTemplate,
3741
+ theme: a.theme
3742
+ },
3743
+ /* @__PURE__ */ r.createElement(
3744
+ ps,
3745
+ {
3746
+ rootElement: t,
3747
+ keyValueStorage: {
3748
+ get: Ge.getItem,
3749
+ set: Ge.setItem,
3750
+ delete: Ge.deleteItem,
3751
+ getKeys: Ge.getKeys
3752
+ },
3753
+ language: o,
3754
+ logger: we,
3755
+ dispatcher: ld,
3756
+ chatParams: { customApiHost: a.customApiHost, customWebSocketHost: a.customWebSocketHost },
3757
+ ...a
3758
+ },
3759
+ /* @__PURE__ */ r.createElement(
3760
+ bs,
3761
+ {
3762
+ ref: l,
3763
+ userSessionInfo: s,
3764
+ forceCreateChannel: (d = a.agentPreviewConfigs) == null ? void 0 : d.forceCreateChannel
3765
+ },
3766
+ /* @__PURE__ */ r.createElement(Na, { ...a._UNSAFE_INTERNAL_dashboardTester }, i, /* @__PURE__ */ r.createElement("div", { id: ee.MODAL_ROOT }))
3767
+ )
3768
+ )
3769
+ ));
3770
+ }), we = new Tn(En.WARN), ld = new _n(we), ar = ({ children: e, isOpened: t }) => {
3771
+ const { dir: n, rootElement: o } = B(), s = pe(o, !0);
3772
+ return L(() => {
3773
+ const i = "sb-agent-block-scroll";
3774
+ return t ? s.body.classList.add(i) : s.body.classList.remove(i), () => {
3775
+ s.body.classList.remove(i);
3776
+ };
3777
+ }, [s, t]), /* @__PURE__ */ r.createElement(cd, { dir: n, $visible: t }, e);
3778
+ }, cd = u.div`width:100%;height:100%;position:fixed;top:0;left:0;z-index:${fe.WINDOW};visibility:${({ $visible: e }) => e ? "visible" : "hidden"};`, dd = 48, ud = 2 / 3;
3779
+ function md({
3780
+ className: e,
3781
+ isOpened: t,
3782
+ onClick: n,
3783
+ type: o,
3784
+ imageUrl: s,
3785
+ dir: i,
3786
+ animated: a = !0,
3787
+ backgroundColor: l,
3788
+ size: c = dd
3789
+ }) {
3790
+ const d = pt(l), h = Math.round(c * ud);
3791
+ return /* @__PURE__ */ r.createElement(
3792
+ pd,
3793
+ {
3794
+ dir: i,
3795
+ id: ee.LAUNCHER,
3796
+ className: e,
3797
+ "aria-label": "Sendbird AIAgent Launcher",
3798
+ onClick: n,
3799
+ $animated: a,
3800
+ $backgroundColor: l,
3801
+ $size: c
3802
+ },
3803
+ /* @__PURE__ */ r.createElement(fd, { $isOpened: t, $animated: a, $fillColor: d, $iconSize: h }, /* @__PURE__ */ r.createElement(fn.Open, { url: s, isDefaultIcon: o === "default_icon" })),
3804
+ /* @__PURE__ */ r.createElement(bd, { $isOpened: t, $animated: a, $fillColor: d, $iconSize: h }, /* @__PURE__ */ r.createElement(fn.Close, { size: h }))
3805
+ );
3806
+ }
3807
+ const gd = I`&:hover{transition:transform 250ms cubic-bezier(0.33,0,0,1);transform:scale(1.1);}&:active{transform:scale(0.8);}`, hd = I`img{width:100%;height:100%;object-fit:cover;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-webkit-user-drag:none;&[data-default-icon='true']{width:${({ $iconSize: e }) => e}px;height:${({ $iconSize: e }) => e}px;filter:${({ $fillColor: e }) => e === $n.WHITE ? "grayscale(100%) brightness(2000%)" : "grayscale(100%) invert(100%) saturate(0%) brightness(0%) contrast(1000%)"};}}`, lr = I`svg{width:${({ $iconSize: e }) => e}px;height:${({ $iconSize: e }) => e}px;${({ $fillColor: e }) => I`
3808
+ path {
3809
+ fill: ${e};
3810
+ }
3811
+ [class*='fill'] {
3812
+ fill: ${e};
3813
+ }
3814
+ `}
3815
+ }
3816
+ `, pd = u.button`position:relative;padding:0;width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;background:${({ $backgroundColor: e }) => e};border-radius:50%;transition:all 0.3s cubic-bezier(0.31,-0.105,0.43,1.4);border:none;display:flex;justify-content:center;align-items:center;box-shadow:0 16px 24px 2px rgba(33,33,33,0.12),0 6px 30px 5px rgba(33,33,33,0.08),0 6px 10px -5px rgba(33,33,33,0.04);${({ $animated: e }) => e && gd}`, cr = u.span`position:absolute;width:100%;height:100%;border-radius:50%;overflow:hidden;transition:transform 0.16s linear,opacity 0.08s linear,scale 0.16s linear;user-select:none;display:flex;justify-content:center;align-items:center;`, fd = u(cr)`opacity:${({ $isOpened: e }) => e ? 0 : 1};transform:${({ $animated: e, $isOpened: t }) => e && (t ? "rotate(-90deg) scale(0)" : "rotate(0deg)")};${hd}${lr}`, bd = u(cr)`scale:${({ $isOpened: e }) => e ? 1 : 0};transform:${({ $animated: e, $isOpened: t }) => e && (t ? "rotate(0deg)" : "rotate(-90deg)")};${lr}`, fn = {
3817
+ Open: (e) => e.url ? /* @__PURE__ */ r.createElement("img", { src: e.url, alt: "launcher-img", "data-default-icon": e.isDefaultIcon }) : /* @__PURE__ */ r.createElement(kt, null),
3818
+ Close: ({ size: e }) => /* @__PURE__ */ r.createElement(M, { size: e, type: "chevron-down" })
3819
+ };
3820
+ function dr({ className: e, size: t }) {
3821
+ const { colors: n } = xt(), { dir: o, state: s } = B(), { launcherInfo: i } = U();
3822
+ return xd(), /* @__PURE__ */ r.createElement(
3823
+ md,
3824
+ {
3825
+ dir: o,
3826
+ className: e,
3827
+ isOpened: s.opened,
3828
+ onClick: () => s.setOpened(!s.opened),
3829
+ type: i.type,
3830
+ imageUrl: i.imageUrl,
3831
+ backgroundColor: n.base.primary,
3832
+ size: t
3833
+ }
3834
+ );
3835
+ }
3836
+ const Ed = 1e3 * 60;
3837
+ function xd() {
3838
+ const { chatSDK: e, state: t, logger: n, enableAutoDisconnectInLauncher: o } = B(), s = N(null);
3839
+ L(() => {
3840
+ if (!o) return;
3841
+ function i() {
3842
+ s.current && (clearTimeout(s.current), s.current = null);
3843
+ }
3844
+ function a() {
3845
+ e.connectionState === Ar.CLOSED && (e.reconnect(), n.debug("useSDKInactivityTimeout: reconnected")), i(), n.debug("useSDKInactivityTimeout: clear disconnect schedule");
3846
+ }
3847
+ function l() {
3848
+ i(), s.current = setTimeout(async () => {
3849
+ await e.disconnectWebSocket(), n.debug("useSDKInactivityTimeout: disconnected");
3850
+ }, Ed);
3851
+ }
3852
+ t.opened ? a() : (l(), n.debug("useSDKInactivityTimeout: schedule disconnect"));
3853
+ }, [o, e, t.opened]);
3854
+ }
3855
+ const ur = ve(null);
3856
+ function Cd() {
3857
+ const e = Q(ur);
3858
+ if (!e)
3859
+ throw new Error("useNavigator() must be used within <Navigator />");
3860
+ return e;
3861
+ }
3862
+ function mr({ children: e }) {
3863
+ const t = Cd();
3864
+ return typeof e == "function" ? e(t) : /* @__PURE__ */ r.createElement(r.Fragment, null, e);
3865
+ }
3866
+ const vd = xn`0%{transform:translateY(40px);opacity:0;}100%{transform:translateY(0px);opacity:1;}`, yd = xn`0%{transform:translateY(0px);opacity:1;}100%{transform:translateY(40px);opacity:0;}`, _d = I`animation-name:${vd};animation-duration:0.3s;animation-fill-mode:forwards;`, Sd = I``, Td = I`animation-name:${yd};animation-duration:0.3s;animation-fill-mode:forwards;`, wd = I`visibility:hidden;`, Ad = u.div`position:absolute;top:0;left:0;width:100%;height:100%;${({ $transitionState: e }) => {
3867
+ switch (e) {
3868
+ case "entering":
3869
+ return _d;
3870
+ case "entered":
3871
+ return Sd;
3872
+ case "exiting":
3873
+ return Td;
3874
+ case "exited":
3875
+ return wd;
3876
+ default:
3877
+ return "";
3878
+ }
3879
+ }}${({ $active: e }) => e ? I`
3880
+ z-index: 999;
3881
+ ` : I`z-index:1;pointer-events:none;`}
3882
+ `;
3883
+ function Ae({ initialId: e, children: t }) {
3884
+ const n = R((g, C) => {
3885
+ c((v) => [...v, g]), h((v) => ({ ...v, [g]: !0 })), C != null && C.reset && E((v) => ({
3886
+ ...v,
3887
+ [g]: (v[g] || 0) + 1
3888
+ })), f((v) => ({
3889
+ ...v,
3890
+ [g]: "entering"
3891
+ })), setTimeout(() => {
3892
+ f((v) => ({
3893
+ ...v,
3894
+ [g]: "entered"
3895
+ }));
3896
+ }, 300);
3897
+ }, []), o = R(() => {
3898
+ c((g) => {
3899
+ if (g.length <= 1) return g;
3900
+ const C = g[g.length - 1];
3901
+ return f((v) => ({
3902
+ ...v,
3903
+ [C]: "exiting"
3904
+ })), setTimeout(() => {
3905
+ f((v) => ({
3906
+ ...v,
3907
+ [C]: "exited"
3908
+ })), c((v) => v.slice(0, -1));
3909
+ }, 300), g;
3910
+ });
3911
+ }, []), s = ae(() => ({
3912
+ navigation: {
3913
+ navigate: n,
3914
+ pop: o
3915
+ }
3916
+ }), [n, o]), i = ae(() => vr.toArray(t).filter(
3917
+ (g) => g.type === mr
3918
+ ), [t]), a = ae(() => {
3919
+ const g = {};
3920
+ return i.forEach((C) => {
3921
+ const { id: v, lazy: S, children: k } = C.props;
3922
+ g[v] = { lazy: S, element: typeof k == "function" ? k(s) : k };
3923
+ }), g;
3924
+ }, [i]), [l, c] = _([e]), [d, h] = _(() => {
3925
+ const g = {};
3926
+ return Object.entries(a).forEach(([C, { lazy: v }]) => {
3927
+ v === !1 && (g[C] = !0);
3928
+ }), g[e] = !0, g;
3929
+ }), [m, f] = _(() => {
3930
+ const g = {};
3931
+ return Object.keys(a).forEach((C) => {
3932
+ C === e ? g[C] = "entered" : g[C] = "exited";
3933
+ }), g;
3934
+ }), [x, E] = _({}), b = l[l.length - 1];
3935
+ return /* @__PURE__ */ r.createElement(ur.Provider, { value: s }, /* @__PURE__ */ r.createElement(kd, null, Object.keys(a).map((g) => {
3936
+ var k;
3937
+ if (!d[g]) return null;
3938
+ const C = m[g] || "exited", v = g === b, S = `${g}-${x[g] || 0}`;
3939
+ return /* @__PURE__ */ r.createElement(Ad, { key: S, $transitionState: C, $active: v }, (k = a[g]) == null ? void 0 : k.element);
3940
+ })));
3941
+ }
3942
+ const kd = u.div`position:relative;width:100%;height:100%;`;
3943
+ Ae.Screen = mr;
3944
+ const he = {
3945
+ activeConv: "active-conv",
3946
+ closedConv: "closed-conv",
3947
+ convList: "conv-list"
3948
+ }, gr = ({ setClosedChannelUrl: e, closedChannelUrl: t }) => /* @__PURE__ */ r.createElement(Ae, { initialId: he.activeConv }, /* @__PURE__ */ r.createElement(Ae.Screen, { id: he.activeConv }, ({ navigation: n }) => /* @__PURE__ */ r.createElement(pn, { onNavigateToConversationList: () => n.navigate(he.convList, { reset: !0 }) })), /* @__PURE__ */ r.createElement(Ae.Screen, { id: he.closedConv }, ({ navigation: n }) => /* @__PURE__ */ r.createElement(
3949
+ pn,
3950
+ {
3951
+ onNavigateToConversationList: () => n.pop(),
3952
+ closedChannelUrl: t,
3953
+ onClearClosedChannelUrl: () => e(void 0)
3954
+ }
3955
+ )), /* @__PURE__ */ r.createElement(Ae.Screen, { id: he.convList, lazy: !0 }, ({ navigation: n }) => /* @__PURE__ */ r.createElement(
3956
+ Qc,
3957
+ {
3958
+ onOpenConversationView: (o, s) => {
3959
+ s === "closed" ? (e(o), n.navigate(he.closedConv, { reset: !0 })) : n.navigate(he.activeConv);
3960
+ }
3961
+ }
3962
+ )));
3963
+ function Id({ isExpanded: e, isOpened: t, children: n, launcher: o }) {
3964
+ const { dir: s } = B();
3965
+ return /* @__PURE__ */ r.createElement($d, null, /* @__PURE__ */ r.createElement(Md, { dir: s, id: ee.WINDOW, $isExpanded: e, $isOpened: t }, n), o);
3966
+ }
3967
+ const $d = u.div`display:flex;flex-direction:column;gap:8px;align-items:flex-end;`, Md = u.div`background:${({ theme: e }) => e.colors.base.background};display:flex;overscroll-behavior:none;-webkit-overflow-scrolling:auto;height:640px;min-height:80px;width:400px;max-width:80vw;max-height:80vh;box-shadow:0px 16px 24px 2px rgba(33,33,33,0.12),0px 6px 30px 5px rgba(33,33,33,0.08),0px 6px 10px -5px rgba(33,33,33,0.04);border-radius:16px;overflow:hidden;transition:width 200ms ease 0s,height 200ms ease 0s,max-height 200ms ease 0s,transform 150ms cubic-bezier(0,1.2,1,1) 0s,opacity 83ms ease-out 0s;transform:scale(0.15);opacity:0;transform-origin:right bottom;[dir='rtl'] &:not([dir='ltr']),&[dir='rtl']{transform-origin:left bottom;}${({ $isOpened: e }) => e && Ld};${({ $isExpanded: e }) => e && Od};`, Od = I`width:743px;height:723px;`, Ld = I`z-index:${fe.WINDOW};pointer-events:all;transform:scale(1);opacity:1;transition:width 200ms ease 0s,height 200ms ease 0s,max-height 200ms ease 0s,transform 300ms cubic-bezier(0,1.2,1,1) 0s,opacity 83ms ease-out 0s;`, au = ye(function({ children: e, ...t }, n) {
3968
+ const o = Oe(), [s, i] = _(), a = o ? ar : Id;
3969
+ return /* @__PURE__ */ r.createElement(ir, { enableExpandButton: !o, ref: n, ...t }, /* @__PURE__ */ r.createElement(In, null, ({ state: l }) => /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(a, { isExpanded: l.expanded, isOpened: l.opened, launcher: /* @__PURE__ */ r.createElement(dr, null) }, /* @__PURE__ */ r.createElement(
3970
+ gr,
3971
+ {
3972
+ closedChannelUrl: s,
3973
+ setClosedChannelUrl: i
3974
+ }
3975
+ )), e)));
3976
+ }), {
3977
+ Provider: Rd,
3978
+ useContext: Bt
3979
+ } = G("FixedMessengerStyle");
3980
+ function hr(e, t, n, o = 0) {
3981
+ const { top: s, bottom: i, start: a, end: l } = n;
3982
+ let c = "", d = "";
3983
+ switch (e) {
3984
+ case "start":
3985
+ d = `inset-inline-start: ${j(a)}`;
3986
+ break;
3987
+ case "end":
3988
+ d = `inset-inline-end: ${j(l)}`;
3989
+ break;
3990
+ }
3991
+ switch (t) {
3992
+ case "top":
3993
+ c = `top: calc(${j(s)} + ${o}px)`;
3994
+ break;
3995
+ case "bottom":
3996
+ c = `bottom: calc(${j(i)} + ${o}px)`;
3997
+ break;
3998
+ }
3999
+ return I`${c};${d};`;
4000
+ }
4001
+ function Dd(e) {
4002
+ const { horizontal: t, vertical: n, margin: o, launcherSize: s } = Bt();
4003
+ return /* @__PURE__ */ r.createElement(Nd, { ...e, size: s, $horizontal: t, $vertical: n, $margin: o });
4004
+ }
4005
+ const Nd = u(dr)`position:fixed;z-index:${fe.LAUNCHER};${({ $horizontal: e, $vertical: t, $margin: n }) => hr(e, t, n)};`;
4006
+ function Pd({ isExpanded: e, isOpened: t, children: n }) {
4007
+ const { dir: o } = B(), { horizontal: s, vertical: i, margin: a, launcherSize: l } = Bt();
4008
+ return /* @__PURE__ */ r.createElement(
4009
+ Bd,
4010
+ {
4011
+ dir: o,
4012
+ id: ee.WINDOW,
4013
+ $isExpanded: e,
4014
+ $isOpened: t,
4015
+ $horizontal: s,
4016
+ $vertical: i,
4017
+ $margin: a,
4018
+ $launcherSize: l
4019
+ },
4020
+ n
4021
+ );
4022
+ }
4023
+ const Bd = u.div`background:${({ theme: e }) => e.colors.base.background};display:flex;overscroll-behavior:none;-webkit-overflow-scrolling:auto;position:fixed;${({ $horizontal: e, $vertical: t, $margin: n, $launcherSize: o }) => hr(e, t, n, o + 12)};height:640px;min-height:80px;width:400px;max-width:80vw;max-height:80vh;box-shadow:0px 16px 24px 2px rgba(33,33,33,0.12),0px 6px 30px 5px rgba(33,33,33,0.08),0px 6px 10px -5px rgba(33,33,33,0.04);border-radius:16px;overflow:hidden;transition:width 200ms ease 0s,height 200ms ease 0s,max-height 200ms ease 0s,transform 150ms cubic-bezier(0,1.2,1,1) 0s,opacity 83ms ease-out 0s;transform:scale(0.15);opacity:0;transform-origin:${({ $horizontal: e, $vertical: t }) => `${e === "start" ? "left" : "right"} ${t}`};
4024
+ [dir='rtl'] &:not([dir='ltr']),
4025
+ &[dir='rtl'] {
4026
+ transform-origin: ${({ $horizontal: e, $vertical: t }) => `${e === "start" ? "right" : "left"} ${t}`};
4027
+ }
4028
+
4029
+ ${({ $isOpened: e }) => e && Ud};
4030
+ ${({ $isExpanded: e }) => e && Fd};
4031
+ `, Fd = I`width:743px;height:723px;`, Ud = I`z-index:${fe.WINDOW};pointer-events:all;transform:scale(1);opacity:1;transition:width 200ms ease 0s,height 200ms ease 0s,max-height 200ms ease 0s,transform 300ms cubic-bezier(0,1.2,1,1) 0s,opacity 83ms ease-out 0s;`, pr = { top: 24, bottom: 24, start: 24, end: 24 }, Hd = ye(function({ children: e, ...t }, n) {
4032
+ const [o, s] = _(), [i, a] = _("end-bottom"), [l, c] = _(pr), [d, h] = _(48), m = Oe(), f = m ? ar : Pd, { horizontal: x, vertical: E } = ae(() => {
4033
+ const [b, g] = i.split("-");
4034
+ return { horizontal: b === "start" ? "start" : "end", vertical: g === "top" ? "top" : "bottom" };
4035
+ }, [i]);
4036
+ return /* @__PURE__ */ r.createElement(ir, { enableExpandButton: !m, ref: n, ...t }, /* @__PURE__ */ r.createElement(In, null, ({ state: b }) => /* @__PURE__ */ r.createElement(
4037
+ Rd,
4038
+ {
4039
+ value: { horizontal: x, vertical: E, margin: l, launcherSize: d, setPosition: a, setMargin: c, setLauncherSize: h }
4040
+ },
4041
+ /* @__PURE__ */ r.createElement(f, { isExpanded: b.expanded, isOpened: b.opened }, /* @__PURE__ */ r.createElement(
4042
+ gr,
4043
+ {
4044
+ closedChannelUrl: o,
4045
+ setClosedChannelUrl: s
4046
+ }
4047
+ )),
4048
+ /* @__PURE__ */ r.createElement(Dd, null),
4049
+ e
4050
+ )));
4051
+ }), zd = (e) => {
4052
+ var s, i, a, l;
4053
+ const { setPosition: t, setMargin: n, setLauncherSize: o } = Bt();
4054
+ return le(() => {
4055
+ e.position && t(e.position), e.margin && n({ ...pr, ...e.margin }), e.launcherSize && o(e.launcherSize);
4056
+ }, [
4057
+ e.position,
4058
+ (s = e.margin) == null ? void 0 : s.top,
4059
+ (i = e.margin) == null ? void 0 : i.bottom,
4060
+ (a = e.margin) == null ? void 0 : a.start,
4061
+ (l = e.margin) == null ? void 0 : l.end,
4062
+ e.launcherSize
4063
+ ]), null;
4064
+ }, lu = Object.assign(Hd, {
4065
+ Style: zd
4066
+ });
4067
+ export {
4068
+ St as A,
4069
+ ro as C,
4070
+ au as D,
4071
+ lu as F,
4072
+ M as I,
4073
+ Hn as L,
4074
+ La as M,
4075
+ Ot as O,
4076
+ su as P,
4077
+ Lt as S,
4078
+ w as a,
4079
+ ir as b,
4080
+ p as c,
4081
+ ad as d,
4082
+ U as e,
4083
+ O as f,
4084
+ md as g,
4085
+ xe as h,
4086
+ X as i,
4087
+ sr as j,
4088
+ pn as k,
4089
+ Nt as l,
4090
+ ld as m,
4091
+ ou as n,
4092
+ nl as o,
4093
+ Z as p,
4094
+ Qc as q,
4095
+ Pt as r,
4096
+ iu as s,
4097
+ Pc as t,
4098
+ B as u,
4099
+ or as v,
4100
+ Sn as w,
4101
+ Io as x,
4102
+ Zt as y
4103
+ };