@sendbird/ai-agent-messenger-react 1.8.1 → 1.8.2

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.
@@ -2,13 +2,13 @@ var to = Object.defineProperty;
2
2
  var no = (e, t, n) => t in e ? to(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var H = (e, t, n) => no(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as r from "react";
5
- import { createContext as Ge, useContext as pe, useLayoutEffect as Ce, useState as T, useEffect as U, useRef as z, useCallback as O, useMemo as oe, forwardRef as We, useImperativeHandle as ro, useId as Ut, useReducer as oo, PureComponent as so, Suspense as io, lazy as L, Fragment as Yn, Children as ao } from "react";
6
- import lo, { SendbirdChatOptions as co, SendbirdProduct as uo, DeviceOsPlatform as mn, SendbirdPlatform as mo, SessionHandler as go, ConnectionHandler as gt, SendbirdError as ho, LogLevel as Xn, ConnectionState as po } from "@sendbird/chat";
7
- import h, { css as k, ThemeProvider as fo, useTheme as ht, createGlobalStyle as bo, StyleSheetManager as Eo, keyframes as Jn } from "styled-components";
5
+ import { createContext as Ge, useContext as pe, useLayoutEffect as Ce, useState as T, useEffect as U, useRef as z, useCallback as O, useMemo as ne, forwardRef as We, useImperativeHandle as ro, useId as Ut, useReducer as oo, PureComponent as so, Suspense as io, lazy as L, Fragment as Yn, Children as ao } from "react";
6
+ import lo, { SendbirdChatOptions as co, SendbirdProduct as uo, DeviceOsPlatform as mn, SendbirdPlatform as mo, SessionHandler as go, ConnectionHandler as mt, SendbirdError as ho, LogLevel as Xn, ConnectionState as po } from "@sendbird/chat";
7
+ import h, { css as k, ThemeProvider as fo, useTheme as gt, createGlobalStyle as bo, StyleSheetManager as Eo, keyframes as Jn } from "styled-components";
8
8
  import { differenceInMinutes as xo, isToday as vo, differenceInHours as yo, isSameMinute as gn, format as Qn, isSameDay as _o } from "date-fns";
9
9
  import { enUS as Co } from "date-fns/locale/en-US";
10
10
  import { ConversationStatus as X, AIAgentModule as So, ConversationType as To, AIAgentMessageFeedbackRating as hn } from "@sendbird/chat/aiAgent";
11
- import { useGroupChannelMessages as wo, useGroupChannelHandler as pt, useForceUpdate as Ao } from "@sendbird/uikit-tools";
11
+ import { useGroupChannelMessages as wo, useGroupChannelHandler as ht, useForceUpdate as Ao } from "@sendbird/uikit-tools";
12
12
  import { SendingStatus as Fe, MessageMetaArray as Io } from "@sendbird/chat/message";
13
13
  import { GroupChannelModule as ko, GroupChannelListOrder as er, GroupChannelHandler as $o } from "@sendbird/chat/groupChannel";
14
14
  import { createPortal as Mo } from "react-dom";
@@ -146,7 +146,7 @@ function zo(e, t, n) {
146
146
  const o = /* @__PURE__ */ new Date(), s = new Date(((a = e.lastMessage) == null ? void 0 : a.createdAt) || e.createdAt), i = xo(o, s);
147
147
  return i < 1 ? n.justNow : i < 60 ? n.minutesAgo(i) : vo(s) ? n.hoursAgo(yo(o, s)) : t(s, n.dateShortFormat);
148
148
  }
149
- const Go = "1.8.1", Be = "sb-agent", Wo = Go, nr = "KEY_IMG_ASPECT_RATIO", jo = "*/*", F = {
149
+ const Go = "1.8.2", Be = "sb-agent", Wo = Go, nr = "KEY_IMG_ASPECT_RATIO", jo = "*/*", F = {
150
150
  BODY_MAX_WIDTH: 244,
151
151
  WIDE_BODY_MAX_WIDTH: 640,
152
152
  AVATAR_SIZE: 26,
@@ -154,7 +154,7 @@ const Go = "1.8.1", Be = "sb-agent", Wo = Go, nr = "KEY_IMG_ASPECT_RATIO", jo =
154
154
  HORIZONTAL_PADDING: 12,
155
155
  GAP_GROUPED: 2,
156
156
  GAP_UNGROUPED: 16
157
- }, fe = (e) => !!e && "sender" in e, qo = (e) => fe(e) ? e.sendingStatus === "succeeded" ? String(e.messageId) : e.reqId : String(e.messageId), Ko = (e, t, n, o = !0) => {
157
+ }, fe = (e) => !!e && "sender" in e, Ko = (e) => fe(e) ? e.sendingStatus === "succeeded" ? String(e.messageId) : e.reqId : String(e.messageId), qo = (e, t, n, o = !0) => {
158
158
  if (!o || !fe(e))
159
159
  return "single";
160
160
  const s = () => {
@@ -264,7 +264,7 @@ const It = (e) => {
264
264
  return !!((t = e.extendedMessagePayload) != null && t.feedback);
265
265
  },
266
266
  checkExtendedFieldPresence(e) {
267
- const t = e.extendedMessagePayload || {}, n = (a) => a.some((l) => typeof t[l] < "u"), o = n(yt.ui), s = n(yt.trail), i = n(yt.marking);
267
+ const t = e.extendedMessagePayload || {}, n = (a) => a.some((l) => typeof t[l] < "u"), o = n(vt.ui), s = n(vt.trail), i = n(vt.marking);
268
268
  return { ui: o, trail: s, marking: i };
269
269
  },
270
270
  shouldScrollToBottom(e, t, n = !1) {
@@ -276,20 +276,20 @@ const It = (e) => {
276
276
  }
277
277
  return !0;
278
278
  }
279
- }, yt = {
279
+ }, vt = {
280
280
  ui: ["suggested_replies", "cta_button", "message_template", "csat"],
281
281
  trail: ["groundedness", "manual", "function_calls"],
282
282
  marking: ["is_hallucination", "is_moderated", "flagged_types"]
283
- }, _t = `@${Be}`, bn = ({ appId: e, aiAgentId: t, storage: n }) => {
283
+ }, yt = `@${Be}`, bn = ({ appId: e, aiAgentId: t, storage: n }) => {
284
284
  const o = {
285
- templateBase: `${_t}-template`,
285
+ templateBase: `${yt}-template`,
286
286
  template: (s) => `${o.templateBase}/templates/${s}`,
287
287
  templateToken: () => `${o.templateBase}-template/message-template/tokens`,
288
288
  messengerSession: (s) => {
289
289
  const i = ts(`${e}/${t}/${s}`);
290
- return `${_t}-udata/${i}`;
290
+ return `${yt}-udata/${i}`;
291
291
  },
292
- anonUserSession: () => `${_t}-session/${e}/${t}`
292
+ anonUserSession: () => `${yt}-session/${e}/${t}`
293
293
  };
294
294
  return {
295
295
  template: {
@@ -453,7 +453,7 @@ const Ne = {
453
453
  } : Ne;
454
454
  }, {
455
455
  Provider: os,
456
- useContext: q
456
+ useContext: K
457
457
  } = J("AIAgent");
458
458
  function ss({
459
459
  appId: e,
@@ -702,7 +702,7 @@ const fs = (e, t, n, o, s) => ({
702
702
  dark: "rgba(0, 0, 0, 0.55)",
703
703
  light: "rgba(22, 22, 22, 0.32)"
704
704
  }
705
- }, Ct = {
705
+ }, _t = {
706
706
  h1: { fontSize: 18, fontWeight: 700 },
707
707
  h2: { fontSize: 16, fontWeight: 700 },
708
708
  subtitle1: { fontSize: 16, fontWeight: 500 },
@@ -761,12 +761,12 @@ function xs(e, t, n) {
761
761
  }
762
762
  function vs({ typography: e }) {
763
763
  if (!e)
764
- return Ct;
765
- const t = { ...Ct };
764
+ return _t;
765
+ const t = { ..._t };
766
766
  return Object.keys(e).forEach((n) => {
767
767
  const o = e[n];
768
768
  if (o && typeof o == "object") {
769
- const s = Ct[n], i = ["fontSize", "fontWeight", "fontFamily", "lineHeight"];
769
+ const s = _t[n], i = ["fontSize", "fontWeight", "fontFamily", "lineHeight"];
770
770
  t[n] = xs(s, o, i);
771
771
  }
772
772
  }), t;
@@ -872,7 +872,7 @@ const yn = 25 * 1024 * 1024, Cs = {
872
872
  };
873
873
  };
874
874
  function dr() {
875
- const { chatSDK: e, logger: t } = q();
875
+ const { chatSDK: e, logger: t } = K();
876
876
  return O(
877
877
  async (n) => {
878
878
  if (n.userId === "") {
@@ -885,7 +885,7 @@ function dr() {
885
885
  );
886
886
  }
887
887
  function Ts() {
888
- const { chatSDK: e, logger: t } = q(), n = O(
888
+ const { chatSDK: e, logger: t } = K(), n = O(
889
889
  async (s, i, a) => {
890
890
  if (t.debug("useChatConnection.connect: start, session", s.userId), i) {
891
891
  const l = new go({
@@ -943,7 +943,7 @@ class _n {
943
943
  }
944
944
  }
945
945
  const $s = 24 * 60 * 60 * 1e3, Ms = (e) => {
946
- const { logger: t, cache: n } = q(), o = () => {
946
+ const { logger: t, cache: n } = K(), o = () => {
947
947
  const i = n.messenger.getAnonUser();
948
948
  return i ? i.expireAt - $s <= 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;
949
949
  }, s = () => {
@@ -956,7 +956,7 @@ const $s = 24 * 60 * 60 * 1e3, Ms = (e) => {
956
956
  `useUserSessionCandidate.getManualSessionInfo: missing required keys in userSessionInfo: ${i.join(", ")}`
957
957
  ), t.debug("useUserSessionCandidate.getManualSessionInfo: manual session info detected"), e;
958
958
  };
959
- return oe(() => e instanceof ks ? { type: "manual", userSessionCandidate: s() } : e instanceof _n ? { type: "anonymous", userSessionCandidate: o() } : e && typeof e == "object" ? (t.warn("Please use ManualSessionInfo instead of the old userSessionInfo format."), { type: "manual", userSessionCandidate: s() }) : e === void 0 ? (t.warn("Please use AnonymousSessionInfo instead of undefined userSessionInfo."), { type: "anonymous", userSessionCandidate: o() }) : { type: "anonymous", userSessionCandidate: null }, [
959
+ return ne(() => e instanceof ks ? { type: "manual", userSessionCandidate: s() } : e instanceof _n ? { type: "anonymous", userSessionCandidate: o() } : e && typeof e == "object" ? (t.warn("Please use ManualSessionInfo instead of the old userSessionInfo format."), { type: "manual", userSessionCandidate: s() }) : e === void 0 ? (t.warn("Please use AnonymousSessionInfo instead of undefined userSessionInfo."), { type: "anonymous", userSessionCandidate: o() }) : { type: "anonymous", userSessionCandidate: null }, [
960
960
  t,
961
961
  e == null ? void 0 : e.userId,
962
962
  e == null ? void 0 : e.authToken,
@@ -975,7 +975,7 @@ function Os({
975
975
  onPostDeauth: a,
976
976
  forceCreateChannel: l
977
977
  }) {
978
- const { aiAgentId: c, language: d, context: g, countryCode: p, logger: E, cache: y } = q(), { connect: x, disconnect: b } = Ts(), { type: f, userSessionCandidate: m } = Ms(e), v = dr(), _ = O(async () => {
978
+ const { aiAgentId: c, language: d, context: g, countryCode: p, logger: E, cache: y } = K(), { connect: x, disconnect: b } = Ts(), { type: f, userSessionCandidate: m } = Ms(e), v = dr(), _ = O(async () => {
979
979
  var B;
980
980
  E.debug("useAuthentication.authenticate: start");
981
981
  const C = m != null && m.userId ? y.messenger.getSettings(m.userId) : null;
@@ -995,8 +995,8 @@ function Os({
995
995
  if (f === "manual")
996
996
  E.warn("Received auto created user info but current session is manual. Ignoring auto created user info."), $ = { userId: m.userId, authToken: m.authToken };
997
997
  else {
998
- const { user_id: Q, session_token: ee, expire_at: de } = w.auto_created_user;
999
- y.messenger.setAnonUser({ userId: Q, authToken: ee, expireAt: de }), $ = { userId: Q, authToken: ee };
998
+ const { user_id: Q, session_token: ee, expire_at: le } = w.auto_created_user;
999
+ y.messenger.setAnonUser({ userId: Q, authToken: ee, expireAt: le }), $ = { userId: Q, authToken: ee };
1000
1000
  }
1001
1001
  else
1002
1002
  $ = {
@@ -1041,7 +1041,7 @@ const ur = (e) => {
1041
1041
  } catch {
1042
1042
  return JSON.stringify(e).slice(1, -1);
1043
1043
  }
1044
- }, Ze = (e) => JSON.parse(e), ft = (e) => JSON.parse(e);
1044
+ }, Ze = (e) => JSON.parse(e), pt = (e) => JSON.parse(e);
1045
1045
  function Ls(e, t) {
1046
1046
  const [n, o] = t.split(",").map((s) => s.trim());
1047
1047
  return e === "dark" && o || n;
@@ -1083,7 +1083,7 @@ async function Rs({
1083
1083
  )).reduce((i, { regex: a, transformedValue: l }) => i.replace(a, ur(l)), e);
1084
1084
  }
1085
1085
  const Ns = () => {
1086
- const { chatSDK: e, logger: t, cache: n } = q(), o = O(() => {
1086
+ const { chatSDK: e, logger: t, cache: n } = K(), o = O(() => {
1087
1087
  var l, c;
1088
1088
  const i = (c = (l = e.appInfo) == null ? void 0 : l.aiAgentInfo) == null ? void 0 : c.templateListToken;
1089
1089
  if (!i) return !1;
@@ -1110,9 +1110,9 @@ const Ns = () => {
1110
1110
  useContext: Wt
1111
1111
  } = J("AIAgentMessengerSession"), Fs = We(
1112
1112
  function({ userSessionInfo: e, forceCreateChannel: t, children: n }, o) {
1113
- const { appId: s, aiAgentId: i, chatSDK: a, language: l, countryCode: c, context: d, cache: g, logger: p } = q(), { updateTheme: E } = zt(), [y, x] = T(void 0), [b, f] = T(
1113
+ const { appId: s, aiAgentId: i, chatSDK: a, language: l, countryCode: c, context: d, cache: g, logger: p } = K(), { updateTheme: E } = zt(), [y, x] = T(void 0), [b, f] = T(
1114
1114
  void 0
1115
- ), [m, v] = T(null), [_, M] = T(null), [C, w] = T(null), [$, B] = T(null), { updateBaseAttachmentRules: Q, createAttachmentRules: ee } = Ss(), { shouldSyncCachedTemplate: de, syncCachedTemplates: Ee } = Ns(), xe = dr(), { authenticate: ke, deauthenticate: j } = Os({
1115
+ ), [m, v] = T(null), [_, M] = T(null), [C, w] = T(null), [$, B] = T(null), { updateBaseAttachmentRules: Q, createAttachmentRules: ee } = Ss(), { shouldSyncCachedTemplate: le, syncCachedTemplates: Ee } = Ns(), xe = dr(), { authenticate: ke, deauthenticate: j } = Os({
1116
1116
  userSessionInfo: e,
1117
1117
  forceCreateChannel: t,
1118
1118
  onUpdateMessengerSettings: O(
@@ -1141,9 +1141,9 @@ const Ns = () => {
1141
1141
  }, []),
1142
1142
  onPostAuth: O(
1143
1143
  async (P) => {
1144
- v(a.currentUser), de() && await Ee(), f({ url: P.active_channel.channel_url, status: X.OPEN });
1144
+ v(a.currentUser), le() && await Ee(), f({ url: P.active_channel.channel_url, status: X.OPEN });
1145
1145
  },
1146
- [a, de, Ee]
1146
+ [a, le, Ee]
1147
1147
  ),
1148
1148
  onErrorAuth: O((P) => {
1149
1149
  x(P);
@@ -1184,7 +1184,7 @@ const Ns = () => {
1184
1184
  t,
1185
1185
  g.messenger.getSettings,
1186
1186
  g.messenger.setSettings
1187
- ]), ue = O(
1187
+ ]), ce = O(
1188
1188
  async (P) => {
1189
1189
  if (!(_ != null && _.userId))
1190
1190
  throw new Error("Current user is not authenticated. Please authenticate first.");
@@ -1197,7 +1197,7 @@ const Ns = () => {
1197
1197
  },
1198
1198
  [_ == null ? void 0 : _.userId, xe]
1199
1199
  );
1200
- return pt(a, {
1200
+ return ht(a, {
1201
1201
  onChannelChanged: (P) => {
1202
1202
  var S;
1203
1203
  P.isGroupChannel() && P.url === (b == null ? void 0 : b.url) && (p.info("agentMessengerSession.channelChanged: channel.conversation", P.conversation), f({ url: P.url, status: ((S = P.conversation) == null ? void 0 : S.status) ?? X.OPEN }));
@@ -1235,7 +1235,7 @@ const Ns = () => {
1235
1235
  activeChannel: b,
1236
1236
  setActiveChannel: f,
1237
1237
  refreshActiveChannel: A,
1238
- createConversation: ue,
1238
+ createConversation: ce,
1239
1239
  connectionError: y,
1240
1240
  aiAgentInfo: C,
1241
1241
  launcherInfo: $,
@@ -1248,8 +1248,8 @@ const Ns = () => {
1248
1248
  );
1249
1249
  }
1250
1250
  ), mr = (e) => {
1251
- const { chatSDK: t } = q(), [n, o] = T([]);
1252
- return pt(t, {
1251
+ const { chatSDK: t } = K(), [n, o] = T([]);
1252
+ return ht(t, {
1253
1253
  onTypingStatusUpdated(s) {
1254
1254
  if (s.url === (e == null ? void 0 : e.url)) {
1255
1255
  const i = s.getTypingUsers();
@@ -1277,9 +1277,9 @@ const Ns = () => {
1277
1277
  const l = zs(e);
1278
1278
  return l ? { disabled: !0, disabledBy: l } : i || a ? { disabled: !0, disabledBy: "ai_responding" } : { disabled: !1, disabledBy: "" };
1279
1279
  }, Us = () => {
1280
- const e = Ut(), { chatSDK: t } = q(), [n, o] = T(!0);
1280
+ const e = Ut(), { chatSDK: t } = K(), [n, o] = T(!0);
1281
1281
  return U(() => {
1282
- const s = new gt({
1282
+ const s = new mt({
1283
1283
  onDisconnected: () => o(!1),
1284
1284
  onConnected: () => o(!0),
1285
1285
  onReconnectSucceeded: () => o(!0)
@@ -1330,7 +1330,7 @@ const Ns = () => {
1330
1330
  }, {
1331
1331
  Provider: js
1332
1332
  } = J("AIAgentConversation");
1333
- function qs({
1333
+ function Ks({
1334
1334
  children: e,
1335
1335
  channelUrl: t,
1336
1336
  onChannelDeleted: n,
@@ -1343,7 +1343,7 @@ function qs({
1343
1343
  sortComparator: d
1344
1344
  }) {
1345
1345
  var M;
1346
- const g = () => c && (x == null ? void 0 : x.markAsRead()), { chatSDK: p, logger: E, dispatcher: y } = q(), { channel: x, channelFetchError: b, fetchChannel: f } = Ks(t), m = is(p, x, {
1346
+ const g = () => c && (x == null ? void 0 : x.markAsRead()), { chatSDK: p, logger: E, dispatcher: y } = K(), { channel: x, channelFetchError: b, fetchChannel: f } = qs(t), m = is(p, x, {
1347
1347
  shouldCountNewMessages: () => !1,
1348
1348
  onChannelDeleted: n,
1349
1349
  onMessagesReceived: (C) => o == null ? void 0 : o(C),
@@ -1403,8 +1403,8 @@ function qs({
1403
1403
  };
1404
1404
  return /* @__PURE__ */ r.createElement(js, { value: _ }, e);
1405
1405
  }
1406
- function Ks(e) {
1407
- const { chatSDK: t, logger: n } = q(), [o, s] = T(void 0), [i, a] = T(void 0);
1406
+ function qs(e) {
1407
+ const { chatSDK: t, logger: n } = K(), [o, s] = T(void 0), [i, a] = T(void 0);
1408
1408
  async function l() {
1409
1409
  if (n.debug("conversation.fetchChannel: start"), s(void 0), a(void 0), e)
1410
1410
  try {
@@ -1424,10 +1424,10 @@ function Ks(e) {
1424
1424
  };
1425
1425
  }
1426
1426
  function Zs(e) {
1427
- const { chatSDK: t } = q(), { activeChannel: n, setActiveChannel: o } = Wt(), s = Ut();
1427
+ const { chatSDK: t } = K(), { activeChannel: n, setActiveChannel: o } = Wt(), s = Ut();
1428
1428
  U(() => {
1429
1429
  if (!e || !n) return;
1430
- const i = new gt({
1430
+ const i = new mt({
1431
1431
  onReconnectSucceeded: async () => {
1432
1432
  var l;
1433
1433
  const a = await e.refresh();
@@ -1482,7 +1482,7 @@ class Ys {
1482
1482
  onChannelDeleted: (p) => {
1483
1483
  this._removeChannelsFromView([p]);
1484
1484
  }
1485
- }), this._connectionHandler = new gt({
1485
+ }), this._connectionHandler = new mt({
1486
1486
  onReconnectSucceeded: () => {
1487
1487
  this._isDefaultChangelogSyncTimestampUpdated && this._syncChannelChangelogs();
1488
1488
  }
@@ -1707,7 +1707,7 @@ function Js(e, t) {
1707
1707
  a(B);
1708
1708
  }
1709
1709
  }, [d]);
1710
- return U(() => (e.addConnectionHandler(n, new gt({ onConnected: () => E() })), () => e.removeConnectionHandler(n)), [e, n, E]), U(() => {
1710
+ return U(() => (e.addConnectionHandler(n, new mt({ onConnected: () => E() })), () => e.removeConnectionHandler(n)), [e, n, E]), U(() => {
1711
1711
  E();
1712
1712
  }, [E]), U(() => () => {
1713
1713
  p.current = !1, d == null || d.dispose();
@@ -1727,7 +1727,7 @@ function ei({
1727
1727
  children: n
1728
1728
  }) {
1729
1729
  var p, E;
1730
- const { chatSDK: o, aiAgentId: s, queryParams: i } = q(), a = {
1730
+ const { chatSDK: o, aiAgentId: s, queryParams: i } = K(), a = {
1731
1731
  aiAgentIds: [s],
1732
1732
  aiAgentConversationStatusFilter: [X.CLOSED, X.OPEN]
1733
1733
  }, l = e ?? ((p = i == null ? void 0 : i.conversationListParams) == null ? void 0 : p.limit), c = {
@@ -1808,7 +1808,7 @@ function ri({ children: e, internalVariables: t }) {
1808
1808
  };
1809
1809
  return /* @__PURE__ */ r.createElement(ni, { value: c }, e);
1810
1810
  }
1811
- const bt = {
1811
+ const ft = {
1812
1812
  VARIABLE: (e) => new RegExp(`\\{${e}\\}`, "g"),
1813
1813
  VIEW_VARIABLE: (e) => new RegExp(`"{@${e}}"`, "g")
1814
1814
  };
@@ -1817,7 +1817,7 @@ function Ae({ uiTemplateString: e, variables: t = {} }) {
1817
1817
  return Gt({
1818
1818
  template: e,
1819
1819
  variables: n,
1820
- variableKeyPattern: (o) => bt.VARIABLE(o)
1820
+ variableKeyPattern: (o) => ft.VARIABLE(o)
1821
1821
  });
1822
1822
  }
1823
1823
  function Ie({
@@ -1828,7 +1828,7 @@ function Ie({
1828
1828
  return Gt({
1829
1829
  template: t,
1830
1830
  variables: n,
1831
- variableKeyPattern: (o) => bt.VARIABLE(o),
1831
+ variableKeyPattern: (o) => ft.VARIABLE(o),
1832
1832
  variableValueTransformer: (o) => Ls(e, o)
1833
1833
  });
1834
1834
  }
@@ -1844,7 +1844,7 @@ function oi({
1844
1844
  return [...new Set(l)].some((d) => !i(d)) ? null : Gt({
1845
1845
  template: t,
1846
1846
  variables: n,
1847
- variableKeyPattern: (d) => bt.VIEW_VARIABLE(d),
1847
+ variableKeyPattern: (d) => ft.VIEW_VARIABLE(d),
1848
1848
  variableValueTransformer: (d) => {
1849
1849
  const g = d.map(({ key: p, variables: E }) => {
1850
1850
  const y = i(p), { ui_template: x, color_variables: b } = Ze(y);
@@ -1863,7 +1863,7 @@ function oi({
1863
1863
  }), f = Ae({
1864
1864
  uiTemplateString: f,
1865
1865
  variables: E
1866
- }), ft(f);
1866
+ }), pt(f);
1867
1867
  });
1868
1868
  return JSON.stringify(g);
1869
1869
  }
@@ -1880,7 +1880,7 @@ async function si({
1880
1880
  return Rs({
1881
1881
  template: t,
1882
1882
  variables: n,
1883
- variableKeyPattern: (a) => bt.VIEW_VARIABLE(a),
1883
+ variableKeyPattern: (a) => ft.VIEW_VARIABLE(a),
1884
1884
  variableValueTransformer: async (a) => {
1885
1885
  const l = a.map(async ({ key: d, variables: g }) => {
1886
1886
  const p = await i(d), { ui_template: E, color_variables: y } = Ze(p);
@@ -1899,7 +1899,7 @@ async function si({
1899
1899
  }), x = Ae({
1900
1900
  uiTemplateString: x,
1901
1901
  variables: g
1902
- }), ft(x);
1902
+ }), pt(x);
1903
1903
  }), c = await Promise.all(l);
1904
1904
  return JSON.stringify(c);
1905
1905
  }
@@ -1923,7 +1923,7 @@ const ii = ({
1923
1923
  if (c === null) return null;
1924
1924
  a = c;
1925
1925
  }
1926
- return a = Ae({ ...o, uiTemplateString: a, variables: n }), a = Ie({ ...o, uiTemplateString: a, colorVariables: i }), a = Ie({ ...o, uiTemplateString: a, colorVariables: t }), a = Ae({ ...o, uiTemplateString: a }), ft(a);
1926
+ return a = Ae({ ...o, uiTemplateString: a, variables: n }), a = Ie({ ...o, uiTemplateString: a, colorVariables: i }), a = Ie({ ...o, uiTemplateString: a, colorVariables: t }), a = Ae({ ...o, uiTemplateString: a }), pt(a);
1927
1927
  }, ai = async ({
1928
1928
  rawTemplate: e,
1929
1929
  aiAgentColorVariables: t,
@@ -1937,7 +1937,7 @@ const ii = ({
1937
1937
  uiTemplateString: a,
1938
1938
  aiAgentColorVariables: t,
1939
1939
  internalVariables: n
1940
- })), a = Ae({ ...o, uiTemplateString: a, variables: n }), a = Ie({ ...o, uiTemplateString: a, colorVariables: i }), a = Ie({ ...o, uiTemplateString: a, colorVariables: t }), a = Ae({ ...o, uiTemplateString: a }), ft(a);
1940
+ })), a = Ae({ ...o, uiTemplateString: a, variables: n }), a = Ie({ ...o, uiTemplateString: a, colorVariables: i }), a = Ie({ ...o, uiTemplateString: a, colorVariables: t }), a = Ae({ ...o, uiTemplateString: a }), pt(a);
1941
1941
  }, li = (e) => {
1942
1942
  const { aiAgentColorVariables: t = {} } = e, { internalVariables: n } = gr();
1943
1943
  return T(() => {
@@ -1965,7 +1965,7 @@ const ii = ({
1965
1965
  }).value;
1966
1966
  }, di = "remove_powered_by", jt = (e, t) => {
1967
1967
  var s, i;
1968
- const { chatSDK: n } = q(), { aiAgentInfo: o } = Wt();
1968
+ const { chatSDK: n } = K(), { aiAgentInfo: o } = Wt();
1969
1969
  if (e === "handoff-button") {
1970
1970
  const a = !!((s = t == null ? void 0 : t.conversation) != null && s.handoff);
1971
1971
  return !!(t != null && t.isAIAgent) && !!(o != null && o.showHandoffButton) && a && At(t);
@@ -1974,7 +1974,7 @@ const ii = ({
1974
1974
  return !!(t != null && t.isAIAgent) && !!(o != null && o.specialNoticeEnabled) && !!(o != null && o.specialNotice);
1975
1975
  if (e === "powered-by") {
1976
1976
  const a = (i = n == null ? void 0 : n.appInfo) == null ? void 0 : i.applicationAttributes;
1977
- return oe(() => !(Array.isArray(a) && a.includes(di)), [a]);
1977
+ return ne(() => !(Array.isArray(a) && a.includes(di)), [a]);
1978
1978
  }
1979
1979
  throw new Error("Unsupported feature");
1980
1980
  }, ui = {
@@ -2112,7 +2112,7 @@ const xi = (e, t = {}) => {
2112
2112
  return e.fields.forEach((f) => {
2113
2113
  b[f.key] = Sn(f);
2114
2114
  }), b;
2115
- }), d = oe(() => e.submitted_at ? "submitted" : e.canceled_at ? "canceled" : "draft", [e.submitted_at, e.canceled_at]);
2115
+ }), d = ne(() => e.submitted_at ? "submitted" : e.canceled_at ? "canceled" : "draft", [e.submitted_at, e.canceled_at]);
2116
2116
  U(() => {
2117
2117
  if (d === "submitted" || d === "canceled") {
2118
2118
  const b = {};
@@ -2214,7 +2214,7 @@ const vi = /* @__PURE__ */ new Set(["free_text", "single_choice"]), yi = ({ csat
2214
2214
  csat: n,
2215
2215
  csatReason: o,
2216
2216
  isResolved: s
2217
- }), [l, c] = Tn({ followUpItem: !1 }), d = oe(() => {
2217
+ }), [l, c] = Tn({ followUpItem: !1 }), d = ne(() => {
2218
2218
  var b;
2219
2219
  const y = i.csat;
2220
2220
  if (typeof y != "number") return;
@@ -2348,8 +2348,8 @@ const vi = /* @__PURE__ */ new Set(["free_text", "single_choice"]), yi = ({ csat
2348
2348
  FILE_UPLOAD_NO_SUPPORTED_FILES: e.conversation.file_upload_no_supported_files
2349
2349
  }), Ti = (e) => {
2350
2350
  var t;
2351
- return ((t = e.split("-")) == null ? void 0 : t[0]) ?? Et;
2352
- }, Et = "en", wi = /* @__PURE__ */ new Set([Et, "ko", "es", "pt", "fr", "hi", "it", "de", "tr", "ja"]), Ai = (e, t, n) => {
2351
+ return ((t = e.split("-")) == null ? void 0 : t[0]) ?? bt;
2352
+ }, bt = "en", wi = /* @__PURE__ */ new Set([bt, "ko", "es", "pt", "fr", "hi", "it", "de", "tr", "ja"]), Ai = (e, t, n) => {
2353
2353
  const o = e[t];
2354
2354
  return o ? typeof o == "function" ? o() : Promise.resolve(o) : new Promise((s, i) => {
2355
2355
  (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
@@ -2418,25 +2418,25 @@ const vi = /* @__PURE__ */ new Set(["free_text", "single_choice"]), yi = ({ csat
2418
2418
  DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE: wn.DATE_FORMAT__DATE_SHORT,
2419
2419
  /** @deprecated Unused string **/
2420
2420
  DATE_FORMAT__CONVERSATION_LIST__LIST_ITEM_TITLE_CAPTION: "h:mma"
2421
- }, ct = {
2421
+ }, lt = {
2422
2422
  language: Lt.language,
2423
2423
  dateLocale: Lt.dateLocale,
2424
2424
  stringSet: Ii
2425
2425
  }, ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2426
2426
  __proto__: null,
2427
- default: ct
2428
- }, Symbol.toStringTag, { value: "Module" })), Dt = /* @__PURE__ */ new Map([[Et, ct]]);
2427
+ default: lt
2428
+ }, Symbol.toStringTag, { value: "Module" })), Dt = /* @__PURE__ */ new Map([[bt, lt]]);
2429
2429
  async function $i(e) {
2430
2430
  const t = Dt.get(e);
2431
2431
  if (t) return t;
2432
2432
  try {
2433
2433
  if (wi.has(e)) {
2434
- const { default: n } = await Ai(/* @__PURE__ */ Object.assign({ "./languages/de.ts": () => import("./D4G3q1WL.js"), "./languages/en.ts": () => Promise.resolve().then(() => ki), "./languages/es.ts": () => import("./CjiYaXB3.js"), "./languages/fr.ts": () => import("./DlPxWJIs.js"), "./languages/hi.ts": () => import("./BoikxJUJ.js"), "./languages/it.ts": () => import("./By_mXjKX.js"), "./languages/ja.ts": () => import("./CwLgdNGh.js"), "./languages/ko.ts": () => import("./DbEkY11E.js"), "./languages/pt.ts": () => import("./BDRrsdhG.js"), "./languages/tr.ts": () => import("./D9rtgPyE.js") }), `./languages/${e}.ts`, 3);
2434
+ const { default: n } = await Ai(/* @__PURE__ */ Object.assign({ "./languages/de.ts": () => import("./COQAzIHI.js"), "./languages/en.ts": () => Promise.resolve().then(() => ki), "./languages/es.ts": () => import("./C6vOGiIu.js"), "./languages/fr.ts": () => import("./CZ5XB3_M.js"), "./languages/hi.ts": () => import("./Cuc2OM1P.js"), "./languages/it.ts": () => import("./y25h84Bm.js"), "./languages/ja.ts": () => import("./BJqjKYMT.js"), "./languages/ko.ts": () => import("./D2fhWy8O.js"), "./languages/pt.ts": () => import("./blAWi6rU.js"), "./languages/tr.ts": () => import("./JFVl5qNU.js") }), `./languages/${e}.ts`, 3);
2435
2435
  return Dt.set(e, n), n;
2436
2436
  }
2437
- return ct;
2437
+ return lt;
2438
2438
  } catch {
2439
- return ct;
2439
+ return lt;
2440
2440
  }
2441
2441
  }
2442
2442
  const {
@@ -2448,7 +2448,7 @@ const {
2448
2448
  stringSet: n,
2449
2449
  children: o
2450
2450
  }) => {
2451
- const [s, i] = T(Dt.get(Et));
2451
+ const [s, i] = T(Dt.get(bt));
2452
2452
  return U(() => {
2453
2453
  const a = Ti(e);
2454
2454
  s.language !== a && (t == null || t.debug("localization.useEffect: update language", { from: s.language, to: a }), $i(a).then(i));
@@ -2464,11 +2464,11 @@ const {
2464
2464
  },
2465
2465
  o
2466
2466
  );
2467
- }, dt = "data-sb-agent-theme", An = (e) => (t, ...n) => {
2467
+ }, ct = "data-sb-agent-theme", An = (e) => (t, ...n) => {
2468
2468
  let o = "";
2469
2469
  return t.forEach((s, i) => {
2470
2470
  o += s + (n[i] ?? "");
2471
- }), `[${dt}='${e}'] & { ${o} }`;
2471
+ }), `[${ct}='${e}'] & { ${o} }`;
2472
2472
  }, N = {
2473
2473
  light: An("light"),
2474
2474
  dark: An("dark")
@@ -2524,7 +2524,7 @@ const {
2524
2524
  --sendbird-overlay-light: ${t.overlay.light};
2525
2525
  }
2526
2526
  `;
2527
- }), Di = k`[${dt}='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);}[${dt}='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);}`, u = {
2527
+ }), Di = k`[${ct}='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);}[${ct}='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);}`, u = {
2528
2528
  color: {
2529
2529
  primary: {
2530
2530
  dark: "var(--sendbird-primary-dark)",
@@ -2587,7 +2587,7 @@ function Ni(e) {
2587
2587
  function Bi({ rootElement: e = document.body, children: t }) {
2588
2588
  const { theme: n, updateTheme: o } = zt();
2589
2589
  return Ce(() => {
2590
- e.setAttribute(dt, n.selectedTheme);
2590
+ e.setAttribute(ct, n.selectedTheme);
2591
2591
  }, [e, n.selectedTheme]), /* @__PURE__ */ r.createElement(fo, { theme: n }, /* @__PURE__ */ r.createElement(Ri, { value: { theme: n, updateTheme: o, rootElement: e } }, t));
2592
2592
  }
2593
2593
  function $e(e, t) {
@@ -2610,10 +2610,10 @@ const Fi = (e, t) => {
2610
2610
  let a = s.querySelector(`style#${i}`);
2611
2611
  a ? a.textContent !== e && (a.textContent = e) : (a = s.ownerDocument.createElement("style"), a.id = i, a.textContent = e, s.appendChild(a));
2612
2612
  }, [e, t]);
2613
- }, qt = /iPad|iPhone|iPod/.test(navigator.userAgent), Ui = /Android/.test(navigator.userAgent), je = (e) => qt || Ui, {
2613
+ }, Kt = /iPad|iPhone|iPod/.test(navigator.userAgent), Ui = /Android/.test(navigator.userAgent), je = (e) => Kt || Ui, {
2614
2614
  Provider: Hi,
2615
2615
  Consumer: br,
2616
- useContext: K
2616
+ useContext: q
2617
2617
  } = J("Messenger");
2618
2618
  function Vi({
2619
2619
  children: e,
@@ -2646,12 +2646,12 @@ function Vi({
2646
2646
  }
2647
2647
  const {
2648
2648
  Provider: zi,
2649
- useContext: ne
2649
+ useContext: te
2650
2650
  } = J("MessengerSession"), Gi = We(function({ children: e, ...t }, n) {
2651
2651
  return /* @__PURE__ */ r.createElement(Fs, { ref: n, ...t }, (o) => /* @__PURE__ */ r.createElement(Wi, { ...o }, e));
2652
2652
  }), Wi = ({ children: e, ...t }) => {
2653
- const { chatSDK: n, logger: o, appId: s, aiAgentId: i, agentPreviewConfigs: a, state: l, handlers: c } = K(), { userSessionInfo: d, authenticate: g, setActiveChannel: p, userSession: E, aiAgentInfo: y, launcherInfo: x } = t, b = z(null);
2654
- return pt(n, {
2653
+ const { chatSDK: n, logger: o, appId: s, aiAgentId: i, agentPreviewConfigs: a, state: l, handlers: c } = q(), { userSessionInfo: d, authenticate: g, setActiveChannel: p, userSession: E, aiAgentInfo: y, launcherInfo: x } = t, b = z(null);
2654
+ return ht(n, {
2655
2655
  async onUserJoined(f, m) {
2656
2656
  var _, M, C;
2657
2657
  if (f.conversation && f.conversation.type === To.PROACTIVE && m.userId === ((_ = n.currentUser) == null ? void 0 : _.userId)) {
@@ -2689,7 +2689,7 @@ function ji({ sound: e }) {
2689
2689
  new Audio(s.default).play();
2690
2690
  });
2691
2691
  }
2692
- const ce = (e) => {
2692
+ const ae = (e) => {
2693
2693
  const t = e;
2694
2694
  return typeof t == "number" ? `${t}px` : t;
2695
2695
  }, I = ({
@@ -2709,17 +2709,17 @@ const ce = (e) => {
2709
2709
  $maxTextLines: o,
2710
2710
  ...i
2711
2711
  }
2712
- ), In = /* @__PURE__ */ new WeakMap(), qi = (e, t) => {
2712
+ ), In = /* @__PURE__ */ new WeakMap(), Ki = (e, t) => {
2713
2713
  let n = In.get(t);
2714
2714
  n || (n = /* @__PURE__ */ new Map(), In.set(t, n));
2715
2715
  const o = n.get(e);
2716
2716
  if (o) return o;
2717
- const s = t[e] ?? t.body1, i = k`font-size:${ce(s.fontSize)};font-weight:${s.fontWeight};${s.fontFamily ? `font-family: ${s.fontFamily};` : ""}
2717
+ const s = t[e] ?? t.body1, i = k`font-size:${ae(s.fontSize)};font-weight:${s.fontWeight};${s.fontFamily ? `font-family: ${s.fontFamily};` : ""}
2718
2718
  ${s.lineHeight ? `line-height: ${s.lineHeight};` : "line-height: 100%;"}
2719
2719
  `;
2720
2720
  return n.set(e, i), i;
2721
- }, Ki = (e) => e ? k`display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:${e};overflow:hidden;` : "", Zi = h.span`font-stretch:normal;letter-spacing:normal;${({ $variant: e, theme: t }) => qi(e, t.typography)}color:${({ $color: e }) => e};${({ $maxTextLines: e }) => Ki(e)}`;
2722
- class ut extends so {
2721
+ }, qi = (e) => e ? k`display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:${e};overflow:hidden;` : "", Zi = h.span`font-stretch:normal;letter-spacing:normal;${({ $variant: e, theme: t }) => Ki(e, t.typography)}color:${({ $color: e }) => e};${({ $maxTextLines: e }) => qi(e)}`;
2722
+ class dt extends so {
2723
2723
  constructor(t) {
2724
2724
  super(t), this.state = {
2725
2725
  hasError: !1
@@ -2796,23 +2796,23 @@ const Yi = (e) => /* @__PURE__ */ r.createElement("svg", { xmlns: "http://www.w3
2796
2796
  $size: t,
2797
2797
  $color: o ?? u.color.primary.main
2798
2798
  },
2799
- /* @__PURE__ */ r.createElement(ut, { errorFallback: /* @__PURE__ */ r.createElement(sa, null) }, /* @__PURE__ */ r.createElement(s, null))
2799
+ /* @__PURE__ */ r.createElement(dt, { errorFallback: /* @__PURE__ */ r.createElement(sa, null) }, /* @__PURE__ */ r.createElement(s, null))
2800
2800
  );
2801
- }, ra = k`[dir='rtl'] &{transform:scaleX(-1);}`, oa = h.div`width:${({ $size: e }) => ce(e)};height:${({ $size: e }) => ce(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 && ra};`, sa = () => /* @__PURE__ */ r.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 64 64" }, /* @__PURE__ */ r.createElement("rect", { x: "8", y: "8", width: "48", height: "48", fill: "none", className: "stroke", rx: "4" }), /* @__PURE__ */ r.createElement("line", { x1: "20", y1: "20", x2: "44", y2: "44", className: "stroke" }), /* @__PURE__ */ r.createElement("line", { x1: "44", y1: "20", x2: "20", y2: "44", className: "stroke" }));
2802
- function Kt({
2801
+ }, ra = k`[dir='rtl'] &{transform:scaleX(-1);}`, oa = h.div`width:${({ $size: e }) => ae(e)};height:${({ $size: e }) => ae(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 && ra};`, sa = () => /* @__PURE__ */ r.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 64 64" }, /* @__PURE__ */ r.createElement("rect", { x: "8", y: "8", width: "48", height: "48", fill: "none", className: "stroke", rx: "4" }), /* @__PURE__ */ r.createElement("line", { x1: "20", y1: "20", x2: "44", y2: "44", className: "stroke" }), /* @__PURE__ */ r.createElement("line", { x1: "44", y1: "20", x2: "20", y2: "44", className: "stroke" }));
2802
+ function qt({
2803
2803
  name: e,
2804
2804
  type: t = "FILE",
2805
2805
  iconColor: n,
2806
2806
  iconBackgroundColor: o,
2807
2807
  onClick: s
2808
2808
  }) {
2809
- const { colors: i } = ht();
2809
+ const { colors: i } = gt();
2810
2810
  return /* @__PURE__ */ r.createElement(ia, { onClick: s, $clickable: !!s }, /* @__PURE__ */ r.createElement(la, { $bgColor: o ?? i.base.primary }, /* @__PURE__ */ r.createElement(D, { type: "file-document", size: 24, color: n ?? i.base.primaryContrastContent })), /* @__PURE__ */ r.createElement(ca, null, /* @__PURE__ */ r.createElement(da, { variant: "button", color: u.themedColor.textHighEmphasis }, e), /* @__PURE__ */ r.createElement(I, { color: u.themedColor.textMidEmphasis, variant: "caption3" }, t)));
2811
2811
  }
2812
2812
  const ia = h.div`border-radius:12px;gap:8px;width:${F.BODY_MAX_WIDTH}px;height:64px;display:flex;align-items:center;padding:12px;box-sizing:border-box;border:1px solid ${u.themedColor.textDisabled};background-color:${u.themedColor.bg_50_600};${({ $clickable: e }) => e && aa}`, aa = k`cursor:pointer;&:hover{background-color:${u.themedColor.bg_100_500};}`, la = h.div`border-radius:8px;width:40px;height:40px;display:flex;align-items:center;justify-content:center;background-color:${({ $bgColor: e }) => e};`, ca = h.div`display:flex;flex:1;flex-direction:column;gap:4px;min-width:0;`, da = h(I)`text-overflow:ellipsis;white-space:nowrap;overflow:hidden;`;
2813
2813
  function ua({ file: e, children: t, onClickFile: n }) {
2814
2814
  return /* @__PURE__ */ r.createElement(ma, null, /* @__PURE__ */ r.createElement(
2815
- Kt,
2815
+ qt,
2816
2816
  {
2817
2817
  name: e.name,
2818
2818
  type: Ht(e.name, e.type),
@@ -2820,11 +2820,11 @@ function ua({ file: e, children: t, onClickFile: n }) {
2820
2820
  }
2821
2821
  ), t);
2822
2822
  }
2823
- const ma = h.div`display:flex;flex-direction:column;align-items:flex-start;gap:${F.GAP_GROUPED}px;`, ie = "sb-agent", ae = {
2824
- ENTRY: `${ie}-entry`,
2825
- MODAL_ROOT: `${ie}-modal-root`,
2826
- WINDOW: `${ie}-window`,
2827
- LAUNCHER: `${ie}-launcher`
2823
+ const ma = h.div`display:flex;flex-direction:column;align-items:flex-start;gap:${F.GAP_GROUPED}px;`, oe = "sb-agent", se = {
2824
+ ENTRY: `${oe}-entry`,
2825
+ MODAL_ROOT: `${oe}-modal-root`,
2826
+ WINDOW: `${oe}-window`,
2827
+ LAUNCHER: `${oe}-launcher`
2828
2828
  }, nt = 2147483647, Oe = {
2829
2829
  MODAL: nt - 1,
2830
2830
  // FIXME: need to cover the case where the tooltip is on the top of the modal
@@ -2834,7 +2834,7 @@ const ma = h.div`display:flex;flex-direction:column;align-items:flex-start;gap:$
2834
2834
  }, Er = {
2835
2835
  DEFAULT_PRIMARY: "#742ddd",
2836
2836
  WHITE: "#ffffff"
2837
- }, xr = 36, ga = 100, Zt = "noopener noreferrer nofollow", be = `${ie}-incoming-msg`, ha = `${ie}-marked-text`;
2837
+ }, xr = 36, ga = 100, Zt = "noopener noreferrer nofollow", be = `${oe}-incoming-msg`, ha = `${oe}-marked-text`;
2838
2838
  function pa({ file: e, onClickMedia: t, children: n }) {
2839
2839
  const o = () => e.type.startsWith("image") ? /* @__PURE__ */ r.createElement(Ea, { src: e.url, alt: "image-message" }) : e.type.startsWith("video") ? /* @__PURE__ */ r.createElement(xa, { controls: !0 }, /* @__PURE__ */ r.createElement("source", { src: e.url }), /* @__PURE__ */ r.createElement("track", { kind: "captions" })) : null;
2840
2840
  if (o) {
@@ -2855,19 +2855,19 @@ const fa = h.div`display:flex;flex-direction:column;align-items:flex-start;gap:$
2855
2855
  `, Ea = h.img`width:100%;height:100%;object-fit:cover;`, xa = h.video`width:100%;height:100%;object-fit:cover;`, va = "✱", vr = (e) => {
2856
2856
  const t = new RegExp(`(\`+)([^\`]+?)\\1|(${va}+)`, "g");
2857
2857
  return e.replace(t, (n, o, s, i) => o ? n : i ? `<span id=${ha} aria-label="masked-text">${i}</span>` : n);
2858
- }, ya = (e) => e.replace(/\*\*(.*?)\*\*/g, "<b>$1</b>"), _a = L(async () => ({ default: (await import("./DSLWWi3o.js")).MarkdownText })), Ca = L(async () => ({ default: (await import("./Ch_6OPTz.js")).CodeBlock }));
2858
+ }, ya = (e) => e.replace(/\*\*(.*?)\*\*/g, "<b>$1</b>"), _a = L(async () => ({ default: (await import("./22f1cDnj.js")).MarkdownText })), Ca = L(async () => ({ default: (await import("./Ch_6OPTz.js")).CodeBlock }));
2859
2859
  function kn(e) {
2860
2860
  var s, i;
2861
- const t = e.maxBodyWidth ?? F.BODY_MAX_WIDTH, n = oe(() => Zo(e.message, vr), [e.message]), o = {
2861
+ const t = e.maxBodyWidth ?? F.BODY_MAX_WIDTH, n = ne(() => Zo(e.message, vr), [e.message]), o = {
2862
2862
  id: `${be}-text-body`,
2863
2863
  $maxWidth: t,
2864
2864
  $color: (s = e.customStyle) == null ? void 0 : s.bubbleContentColor,
2865
2865
  $bgColor: (i = e.customStyle) == null ? void 0 : i.bubbleBackgroundColor
2866
2866
  };
2867
- return n.length === 0 ? e.children ? /* @__PURE__ */ r.createElement($n, { ...o }, e.children) : null : /* @__PURE__ */ r.createElement($n, { ...o }, n.map((a, l) => a.type === "text" ? /* @__PURE__ */ r.createElement(Mn, { key: l, variant: "body3" }, /* @__PURE__ */ r.createElement(ut, { fallback: a.value }, /* @__PURE__ */ r.createElement(_a, { onClickImage: (c) => {
2867
+ return n.length === 0 ? e.children ? /* @__PURE__ */ r.createElement($n, { ...o }, e.children) : null : /* @__PURE__ */ r.createElement($n, { ...o }, n.map((a, l) => a.type === "text" ? /* @__PURE__ */ r.createElement(Mn, { key: l, variant: "body3" }, /* @__PURE__ */ r.createElement(dt, { fallback: a.value }, /* @__PURE__ */ r.createElement(_a, { onClickImage: (c) => {
2868
2868
  var d;
2869
2869
  return (d = e.onClickMedia) == null ? void 0 : d.call(e, { url: c, type: "image/*" });
2870
- } }, a.value))) : a.type === "code" ? /* @__PURE__ */ r.createElement(ut, { key: l, fallback: /* @__PURE__ */ r.createElement(Mn, { variant: "body3" }, a.value) }, /* @__PURE__ */ r.createElement(Ca, { code: a.value, language: a.language })) : null), e.children);
2870
+ } }, a.value))) : a.type === "code" ? /* @__PURE__ */ r.createElement(dt, { key: l, fallback: /* @__PURE__ */ r.createElement(Mn, { variant: "body3" }, a.value) }, /* @__PURE__ */ r.createElement(Ca, { code: a.value, language: a.language })) : null), e.children);
2871
2871
  }
2872
2872
  const $n = h.div`display:flex;flex-direction:column;border-radius:12px;overflow:hidden;max-width:${({ $maxWidth: e }) => e}px;${({ theme: e, $color: t, $bgColor: n }) => k`
2873
2873
  color: ${t || e.colors.messageIncoming.text};
@@ -2888,7 +2888,7 @@ function Sa(e) {
2888
2888
  return /* @__PURE__ */ r.createElement(kn, { ...e, message: t.UNKNOWN__UNKNOWN_MESSAGE_TYPE });
2889
2889
  }
2890
2890
  function Yt({ id: e, src: t, size: n = 56, onClick: o, style: s }) {
2891
- return /* @__PURE__ */ r.createElement(Ta, { id: e, tabIndex: 0, onClick: o, $size: ce(n), style: s }, t ? /* @__PURE__ */ r.createElement(wa, { src: t }) : /* @__PURE__ */ r.createElement(D, { type: "user", size: n }));
2891
+ return /* @__PURE__ */ r.createElement(Ta, { id: e, tabIndex: 0, onClick: o, $size: ae(n), style: s }, t ? /* @__PURE__ */ r.createElement(wa, { src: t }) : /* @__PURE__ */ r.createElement(D, { type: "user", size: n }));
2892
2892
  }
2893
2893
  const Ta = h.div`border-radius:50%;display:inline-block;overflow:hidden;position:relative;flex-shrink:0;height:${(e) => e.$size};width:${(e) => e.$size};background-color:${u.themedColor.bg_100_500};&:focus{outline:none;}`, wa = h.img`object-fit:cover;width:100%;height:100%;position:absolute;`;
2894
2894
  function Aa({ sender: e, isBotMessage: t }) {
@@ -2939,16 +2939,16 @@ function Fa({
2939
2939
  /* @__PURE__ */ r.createElement(Va, { variant: "body3", color: o.colors.messageIncoming.text }, i.title)
2940
2940
  ))));
2941
2941
  }
2942
- const Pa = h.div`display:flex;flex-direction:column;gap:8px;border-radius:8px;padding:8px 12px 6px;`, Ua = h(I)`opacity:0.5;`, Ha = h.div`display:flex;flex-direction:column;gap:8px;`, Va = h(I)`text-decoration:underline;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`, za = h.div`display:flex;align-items:center;gap:4px;cursor:pointer;&:hover{opacity:0.5;}`, xt = ({ style: e, rootElementId: t, visible: n, onClose: o, children: s }) => {
2942
+ const Pa = h.div`display:flex;flex-direction:column;gap:8px;border-radius:8px;padding:8px 12px 6px;`, Ua = h(I)`opacity:0.5;`, Ha = h.div`display:flex;flex-direction:column;gap:8px;`, Va = h(I)`text-decoration:underline;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`, za = h.div`display:flex;align-items:center;gap:4px;cursor:pointer;&:hover{opacity:0.5;}`, Et = ({ style: e, rootElementId: t, visible: n, onClose: o, children: s }) => {
2943
2943
  if (!n) return null;
2944
2944
  const { rootElement: i } = fr(), a = $e(i), l = $e(i, !0);
2945
2945
  return Mo(
2946
2946
  /* @__PURE__ */ r.createElement(Ga, { onClick: o, style: e }, /* @__PURE__ */ r.createElement(Wa, { onClick: (c) => c.stopPropagation() }, s)),
2947
- a.getElementById(t) ?? a.getElementById(ae.MODAL_ROOT) ?? l.body
2947
+ a.getElementById(t) ?? a.getElementById(se.MODAL_ROOT) ?? l.body
2948
2948
  );
2949
- }, Ga = h.div`position:fixed;top:0;left:0;width:100%;height:100%;background:${u.color.overlay.dark};display:flex;justify-content:center;align-items:center;z-index:${Oe.MODAL};`, Wa = h.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:${Oe.MODAL};`, ja = ({ visible: e, onClose: t, children: n }) => /* @__PURE__ */ r.createElement(xt, { rootElementId: ae.WINDOW, visible: e, onClose: t }, /* @__PURE__ */ r.createElement(Za, null, n)), qa = ({ onClick: e, destructive: t, children: n }) => /* @__PURE__ */ r.createElement(Ka, { onClick: e, $destructive: t }, n), Pe = Object.assign(ja, {
2950
- ActionItem: qa
2951
- }), Ka = h.button`all:unset;width:100%;padding:14px 24px;text-align:start;cursor:pointer;color:${({ $destructive: e }) => e ? u.themedColor.error : u.themedColor.textHighEmphasis};`, Za = h.div`position:absolute;left:0;right:0;bottom:0;border-radius:12px 12px 0 0;flex-direction:column;align-items:flex-end;margin:0 auto;box-sizing:border-box;background-color:${({ theme: e }) => e.colors.base.modalContentBackground};`, Rt = (e) => `${e}-filled`, Ya = (e) => e === "good" ? hn.GOOD : hn.BAD, yr = k`&:hover{opacity:0.8;}&:active{opacity:0.6;}`, On = {
2949
+ }, Ga = h.div`position:fixed;top:0;left:0;width:100%;height:100%;background:${u.color.overlay.dark};display:flex;justify-content:center;align-items:center;z-index:${Oe.MODAL};`, Wa = h.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:${Oe.MODAL};`, ja = ({ visible: e, onClose: t, children: n }) => /* @__PURE__ */ r.createElement(Et, { rootElementId: se.WINDOW, visible: e, onClose: t }, /* @__PURE__ */ r.createElement(Za, null, n)), Ka = ({ onClick: e, destructive: t, children: n }) => /* @__PURE__ */ r.createElement(qa, { onClick: e, $destructive: t }, n), Pe = Object.assign(ja, {
2950
+ ActionItem: Ka
2951
+ }), qa = h.button`all:unset;width:100%;padding:14px 24px;text-align:start;cursor:pointer;color:${({ $destructive: e }) => e ? u.themedColor.error : u.themedColor.textHighEmphasis};`, Za = h.div`position:absolute;left:0;right:0;bottom:0;border-radius:12px 12px 0 0;flex-direction:column;align-items:flex-end;margin:0 auto;box-sizing:border-box;background-color:${({ theme: e }) => e.colors.base.modalContentBackground};`, Rt = (e) => `${e}-filled`, Ya = (e) => e === "good" ? hn.GOOD : hn.BAD, yr = k`&:hover{opacity:0.8;}&:active{opacity:0.6;}`, On = {
2952
2952
  good: u.themedColor.secondary,
2953
2953
  bad: u.themedColor.error
2954
2954
  }, Xa = ({
@@ -2969,7 +2969,7 @@ const Pa = h.div`display:flex;flex-direction:column;gap:8px;border-radius:8px;pa
2969
2969
  }, y = () => {
2970
2970
  t();
2971
2971
  };
2972
- return e ? /* @__PURE__ */ r.createElement(xt, { rootElementId: ae.WINDOW, visible: e, onClose: y }, /* @__PURE__ */ r.createElement(Ja, null, /* @__PURE__ */ r.createElement(Qa, null, /* @__PURE__ */ r.createElement(I, { variant: "h2", color: u.themedColor.textHighEmphasis }, l.FEEDBACK_TITLE)), /* @__PURE__ */ r.createElement(el, null, /* @__PURE__ */ r.createElement(tl, null, ["good", "bad"].map((x) => {
2972
+ return e ? /* @__PURE__ */ r.createElement(Et, { rootElementId: se.WINDOW, visible: e, onClose: y }, /* @__PURE__ */ r.createElement(Ja, null, /* @__PURE__ */ r.createElement(Qa, null, /* @__PURE__ */ r.createElement(I, { variant: "h2", color: u.themedColor.textHighEmphasis }, l.FEEDBACK_TITLE)), /* @__PURE__ */ r.createElement(el, null, /* @__PURE__ */ r.createElement(tl, null, ["good", "bad"].map((x) => {
2973
2973
  const b = c === x, f = x === "good" ? l.FEEDBACK_GOOD : l.FEEDBACK_BAD;
2974
2974
  return /* @__PURE__ */ r.createElement(
2975
2975
  nl,
@@ -3085,7 +3085,7 @@ const Dn = h.div`display:flex;flex-direction:${({ $horizontal: e }) => e ? "row"
3085
3085
  const a = () => {
3086
3086
  s == null || s(), i();
3087
3087
  };
3088
- return /* @__PURE__ */ r.createElement(xt, { rootElementId: ae.WINDOW, visible: e, onClose: i }, /* @__PURE__ */ r.createElement(ml, null, /* @__PURE__ */ r.createElement(gl, null, t && /* @__PURE__ */ r.createElement(I, { variant: "h1", color: u.themedColor.textHighEmphasis }, t), n && /* @__PURE__ */ r.createElement(hl, null, /* @__PURE__ */ r.createElement(I, { variant: "subtitle2", color: u.themedColor.textHighEmphasis }, n))), /* @__PURE__ */ r.createElement(pl, null, /* @__PURE__ */ r.createElement(fl, { onClick: a }, /* @__PURE__ */ r.createElement(I, { variant: "button", color: u.themedColor.primary }, o)))));
3088
+ return /* @__PURE__ */ r.createElement(Et, { rootElementId: se.WINDOW, visible: e, onClose: i }, /* @__PURE__ */ r.createElement(ml, null, /* @__PURE__ */ r.createElement(gl, null, t && /* @__PURE__ */ r.createElement(I, { variant: "h1", color: u.themedColor.textHighEmphasis }, t), n && /* @__PURE__ */ r.createElement(hl, null, /* @__PURE__ */ r.createElement(I, { variant: "subtitle2", color: u.themedColor.textHighEmphasis }, n))), /* @__PURE__ */ r.createElement(pl, null, /* @__PURE__ */ r.createElement(fl, { onClick: a }, /* @__PURE__ */ r.createElement(I, { variant: "button", color: u.themedColor.primary }, o)))));
3089
3089
  }, ml = h.div`width:100%;height:auto;padding-block:24px 12px;padding-inline:24px;margin:0 auto;border-radius:4px;box-sizing:border-box;background-color:${({ theme: e }) => e.colors.base.modalContentBackground};`, gl = h.div`margin-bottom:16px;`, hl = h.div`margin-top:8px;`, pl = h.div`display:flex;flex-direction:row;justify-content:flex-end;`, fl = h.button`all:unset;display:flex;justify-content:center;align-items:center;border-radius:4px;cursor:pointer;background-color:transparent;padding:10px 16px;`, Qt = k`width:100%;height:36px;border-radius:6px;cursor:pointer;transition:all 0.2s ease;padding:0 12px;border:none;outline:none;display:flex;align-items:center;justify-content:center;&:disabled{cursor:not-allowed;}`, Nn = h.button`${Qt};background-color:${u.themedColor.primary};color:${u.themedColor.textHighEmphasis};&:hover:not(:disabled){opacity:0.9;}`, bl = h.button`${Qt};color:${u.themedColor.primary};${N.light`
3090
3090
  background-color: ${u.color.background50};
3091
3091
  `};
@@ -3328,8 +3328,8 @@ const Dn = h.div`display:flex;flex-direction:${({ $horizontal: e }) => e ? "row"
3328
3328
  &:focus {
3329
3329
  border-color: ${u.themedColor.primary};
3330
3330
  }
3331
- `, Wl = h.input`${Sr};height:36px;${({ $error: e, $submitted: t }) => t ? Tr : e ? wr : Ar}`, jl = h.textarea`${Sr};height:96px;resize:none;font-family:inherit;${({ $error: e, $submitted: t }) => t ? Tr : e ? wr : Ar}`, ql = ({ children: e, className: t, style: n }) => /* @__PURE__ */ r.createElement(I, { variant: "button", color: u.themedColor.textHighEmphasis, className: t, style: n }, e), Z = {
3332
- Title: ql,
3331
+ `, Wl = h.input`${Sr};height:36px;${({ $error: e, $submitted: t }) => t ? Tr : e ? wr : Ar}`, jl = h.textarea`${Sr};height:96px;resize:none;font-family:inherit;${({ $error: e, $submitted: t }) => t ? Tr : e ? wr : Ar}`, Kl = ({ children: e, className: t, style: n }) => /* @__PURE__ */ r.createElement(I, { variant: "button", color: u.themedColor.textHighEmphasis, className: t, style: n }, e), Z = {
3332
+ Title: Kl,
3333
3333
  Label: Cl,
3334
3334
  ErrorLabel: _l,
3335
3335
  Separator: zl,
@@ -3338,7 +3338,7 @@ const Dn = h.div`display:flex;flex-direction:${({ $horizontal: e }) => e ? "row"
3338
3338
  NumberInput: Sl,
3339
3339
  SingleSelect: Ul,
3340
3340
  MultiSelect: Hl
3341
- }, Kl = 1, Zl = /* @__PURE__ */ new Set(["text", "number", "single-select", "multi-select"]), Yl = (e) => {
3341
+ }, ql = 1, Zl = /* @__PURE__ */ new Set(["text", "number", "single-select", "multi-select"]), Yl = (e) => {
3342
3342
  var f;
3343
3343
  const t = (f = e.extendedMessagePayload) == null ? void 0 : f.form;
3344
3344
  if (!t) throw new Error("Form is not provided");
@@ -3387,8 +3387,8 @@ const Dn = h.div`display:flex;flex-direction:${({ $horizontal: e }) => e ? "row"
3387
3387
  } finally {
3388
3388
  s((m) => ({ ...m, canceling: !1 }));
3389
3389
  }
3390
- }, b = oe(() => {
3391
- const m = () => t.version > Kl, v = () => t.fields.some((_) => !Zl.has(_.type));
3390
+ }, b = ne(() => {
3391
+ const m = () => t.version > ql, v = () => t.fields.some((_) => !Zl.has(_.type));
3392
3392
  return m() || v() ? { visible: !1, cancelable: !0, reason: n.FORM_NOT_SUPPORTED } : l === "draft" && (e.isHandedOff || e.isConversationClosed) ? { visible: !1, cancelable: !1, reason: n.FORM_UNAVAILABLE } : { visible: !0, cancelable: !0, reason: "" };
3393
3393
  }, [t.version, t.fields, l, e.isHandedOff, e.isConversationClosed]);
3394
3394
  return l === "canceled" ? null : b.visible ? /* @__PURE__ */ r.createElement(Yn, null, /* @__PURE__ */ r.createElement(Bn, { $maxWidth: e.maxBodyWidth ?? F.BODY_MAX_WIDTH }, /* @__PURE__ */ r.createElement(Z.Title, null, t.title), /* @__PURE__ */ r.createElement(Xl, null, c.map((m) => /* @__PURE__ */ r.createElement(Jl, { key: m.key }, /* @__PURE__ */ r.createElement(Z.Label, { style: { marginBottom: "6px" }, required: m.required }, m.label), m.type === "text" && /* @__PURE__ */ r.createElement(
@@ -3468,7 +3468,7 @@ const tc = /* @__PURE__ */ new Set(["default"]), { MessageTemplate: nc } = Ro({
3468
3468
  });
3469
3469
  function rc(e) {
3470
3470
  return /* @__PURE__ */ r.createElement(
3471
- ut,
3471
+ dt,
3472
3472
  {
3473
3473
  errorFallback: e.messageTemplateErrorFallback,
3474
3474
  loadingFallback: e.messageTemplateLoadingFallback
@@ -3553,11 +3553,11 @@ function gc(e) {
3553
3553
  function Ir(e) {
3554
3554
  var E, y, x, b, f, m, v;
3555
3555
  const { components: t } = Ve.useContext(), n = !!e.isTyping, o = e.testerMode, s = !!((E = e.extendedMessagePayload) != null && E.form) && !((y = e.extendedMessagePayload) != null && y.form.canceled_at), i = !!((x = e.extendedMessagePayload) != null && x.message_template), a = !!((b = e.extendedMessagePayload) != null && b.cta_button), l = !!((f = e.extendedMessagePayload) != null && f.citations) && e.extendedMessagePayload.citations.length > 0, c = !!e.createdAt, d = e.groupType === "top" || e.groupType === "single", g = e.groupType === "bottom" || e.groupType === "single", p = o ? 0 : F.AVATAR_SIZE;
3556
- return /* @__PURE__ */ r.createElement(hc, { $marginBottom: n ? 0 : Vt(e.groupType) }, d && /* @__PURE__ */ r.createElement(pc, null, !o && /* @__PURE__ */ r.createElement(t.SenderAvatar, { ...e }), /* @__PURE__ */ r.createElement(t.SenderName, { ...e })), /* @__PURE__ */ r.createElement(bc, null, /* @__PURE__ */ r.createElement(St, { $extraStartPadding: p }, n ? /* @__PURE__ */ r.createElement(t.TypingIndicator, { ...e }) : /* @__PURE__ */ r.createElement(t.MessageBody, { ...e }, a && /* @__PURE__ */ r.createElement("div", { style: { marginTop: 12, marginInline: 12 } }, /* @__PURE__ */ r.createElement(t.CTAButton, { ...e })), l && /* @__PURE__ */ r.createElement(t.Citation, { ...e }))), i && /* @__PURE__ */ r.createElement(Fn, { $startPadding: 0, $endPadding: 0 }, /* @__PURE__ */ r.createElement(
3556
+ return /* @__PURE__ */ r.createElement(hc, { $marginBottom: n ? 0 : Vt(e.groupType) }, d && /* @__PURE__ */ r.createElement(pc, null, !o && /* @__PURE__ */ r.createElement(t.SenderAvatar, { ...e }), /* @__PURE__ */ r.createElement(t.SenderName, { ...e })), /* @__PURE__ */ r.createElement(bc, null, /* @__PURE__ */ r.createElement(Ct, { $extraStartPadding: p }, n ? /* @__PURE__ */ r.createElement(t.TypingIndicator, { ...e }) : /* @__PURE__ */ r.createElement(t.MessageBody, { ...e }, a && /* @__PURE__ */ r.createElement("div", { style: { marginTop: 12, marginInline: 12 } }, /* @__PURE__ */ r.createElement(t.CTAButton, { ...e })), l && /* @__PURE__ */ r.createElement(t.Citation, { ...e }))), i && /* @__PURE__ */ r.createElement(Fn, { $startPadding: 0, $endPadding: 0 }, /* @__PURE__ */ r.createElement(
3557
3557
  t.MessageTemplate,
3558
3558
  {
3559
3559
  ...e,
3560
- messageTemplateErrorFallback: e.messageTemplateErrorFallback ?? /* @__PURE__ */ r.createElement(St, { $extraStartPadding: p }, /* @__PURE__ */ r.createElement(
3560
+ messageTemplateErrorFallback: e.messageTemplateErrorFallback ?? /* @__PURE__ */ r.createElement(Ct, { $extraStartPadding: p }, /* @__PURE__ */ r.createElement(
3561
3561
  t.MessageBody,
3562
3562
  {
3563
3563
  ...e,
@@ -3565,7 +3565,7 @@ function Ir(e) {
3565
3565
  message: ((v = (m = e.extendedMessagePayload) == null ? void 0 : m.message_template) == null ? void 0 : v.fallback_message) ?? "Cannot read this template."
3566
3566
  }
3567
3567
  )),
3568
- messageTemplateLoadingFallback: e.messageTemplateLoadingFallback ?? /* @__PURE__ */ r.createElement(St, { $extraStartPadding: p }, /* @__PURE__ */ r.createElement(t.TypingIndicator, { ...e }))
3568
+ messageTemplateLoadingFallback: e.messageTemplateLoadingFallback ?? /* @__PURE__ */ r.createElement(Ct, { $extraStartPadding: p }, /* @__PURE__ */ r.createElement(t.TypingIndicator, { ...e }))
3569
3569
  }
3570
3570
  )), s && /* @__PURE__ */ r.createElement(Fn, { $extraStartPadding: p }, /* @__PURE__ */ r.createElement(t.Form, { ...e }))), g && c && /* @__PURE__ */ r.createElement(fc, { $extraStartPadding: p + 8 }, /* @__PURE__ */ r.createElement(t.SentTime, { ...e })), /* @__PURE__ */ r.createElement(Yn, null, !n && /* @__PURE__ */ r.createElement(Ye, { $extraStartPadding: p + 8 }, /* @__PURE__ */ r.createElement(t.Feedback, { ...e })), e.suggestedRepliesVisible && /* @__PURE__ */ r.createElement(t.SuggestedReplies, { ...e }), /* @__PURE__ */ r.createElement(t.MessageLogs, { ...e })));
3571
3571
  }
@@ -3573,7 +3573,7 @@ const hc = h.div`display:flex;flex-direction:column;align-items:flex-start;margi
3573
3573
  `, Ye = h.div`display:flex;align-self:stretch;justify-content:flex-start;${({ $startPadding: e = F.HORIZONTAL_PADDING, $endPadding: t = F.HORIZONTAL_PADDING, $extraStartPadding: n = 0 }) => `
3574
3574
  padding-inline: ${e + n}px ${t}px;
3575
3575
  `}
3576
- `, pc = h(Ye)`display:flex;flex-direction:row;align-items:center;gap:8px;`, St = h(Ye)`display:flex;`, fc = h(Ye)`margin-top:${F.BODY_TIME_GAP}px;display:flex;align-items:flex-start;justify-content:flex-start;`, Fn = h(Ye)`display:flex;${({ $startPadding: e = F.HORIZONTAL_PADDING, $endPadding: t = F.HORIZONTAL_PADDING, $extraStartPadding: n = 0 }) => `
3576
+ `, pc = h(Ye)`display:flex;flex-direction:row;align-items:center;gap:8px;`, Ct = h(Ye)`display:flex;`, fc = h(Ye)`margin-top:${F.BODY_TIME_GAP}px;display:flex;align-items:flex-start;justify-content:flex-start;`, Fn = h(Ye)`display:flex;${({ $startPadding: e = F.HORIZONTAL_PADDING, $endPadding: t = F.HORIZONTAL_PADDING, $extraStartPadding: n = 0 }) => `
3577
3577
  padding-inline: ${e + n}px ${t}px;
3578
3578
  `}
3579
3579
  `, bc = h.div`display:flex;flex-direction:column;gap:${F.GAP_GROUPED}px;`;
@@ -3582,9 +3582,9 @@ function Ec({ file: e, children: t, onClickFile: n, sendingStatus: o }) {
3582
3582
  if (!(!n || o === "failed"))
3583
3583
  return () => n == null ? void 0 : n(e);
3584
3584
  })();
3585
- return /* @__PURE__ */ r.createElement(xc, null, /* @__PURE__ */ r.createElement(Kt, { name: e.name, type: Ht(e.name, e.type), onClick: s }), t);
3585
+ return /* @__PURE__ */ r.createElement(xc, null, /* @__PURE__ */ r.createElement(qt, { name: e.name, type: Ht(e.name, e.type), onClick: s }), t);
3586
3586
  }
3587
- const xc = h.div`display:flex;flex-direction:column;align-items:flex-end;gap:${F.GAP_GROUPED}px;`, en = ({ className: e, children: t, size: n = 26 }) => /* @__PURE__ */ r.createElement(vc, { className: e, $size: n }, t ?? /* @__PURE__ */ r.createElement(D, { type: "spinner", size: n })), vc = h.div`display:flex;align-items:center;justify-content:center;width:${({ $size: e }) => ce(e)};height:${({ $size: e }) => ce(e)};animation:1s infinite linear;animation-name:rotate;@keyframes rotate{from{transform:rotate(0);}to{transform:rotate(360deg);}}`;
3587
+ const xc = h.div`display:flex;flex-direction:column;align-items:flex-end;gap:${F.GAP_GROUPED}px;`, en = ({ className: e, children: t, size: n = 26 }) => /* @__PURE__ */ r.createElement(vc, { className: e, $size: n }, t ?? /* @__PURE__ */ r.createElement(D, { type: "spinner", size: n })), vc = h.div`display:flex;align-items:center;justify-content:center;width:${({ $size: e }) => ae(e)};height:${({ $size: e }) => ae(e)};animation:1s infinite linear;animation-name:rotate;@keyframes rotate{from{transform:rotate(0);}to{transform:rotate(360deg);}}`;
3588
3588
  function yc({
3589
3589
  sendingStatus: e,
3590
3590
  file: t,
@@ -3611,7 +3611,7 @@ const _c = h.div`display:flex;flex-direction:column;align-items:flex-end;gap:${F
3611
3611
  `, Sc = h.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;`;
3612
3612
  function Pn(e) {
3613
3613
  var n, o;
3614
- const t = oe(() => {
3614
+ const t = ne(() => {
3615
3615
  const s = ya(vr(e.message));
3616
3616
  return tr.sanitize(s);
3617
3617
  }, [e.message]);
@@ -3648,7 +3648,7 @@ function Ac(e) {
3648
3648
  );
3649
3649
  }
3650
3650
  function Ic({ sendingStatus: e }) {
3651
- const t = ht();
3651
+ const t = gt();
3652
3652
  switch (e) {
3653
3653
  case "pending":
3654
3654
  return /* @__PURE__ */ r.createElement(kc, { size: 16 }, /* @__PURE__ */ r.createElement(D, { type: "spinner", color: t.colors.messageOutgoing.background, size: 16 }));
@@ -3755,7 +3755,7 @@ const Nc = h.div`text-align:center;text-wrap:pretty;word-break:break-word;paddin
3755
3755
  labelVariant: "body3"
3756
3756
  }
3757
3757
  ))), s && /* @__PURE__ */ r.createElement(Z.ErrorLabel, null, i.FORM_VALIDATION_REQUIRED));
3758
- }, Wc = h.div`display:flex;flex-direction:column;gap:8px;`, jc = h.div`display:flex;flex-direction:column;gap:8px;`, qc = ({ value: e, selected: t, label: n }) => /* @__PURE__ */ r.createElement(Kc, { $selected: t, "aria-label": n }, Zc[e - 1]), Kc = h.div`user-select:none;-webkit-user-drag:none;width:40px;height:40px;aspect-ratio:1;opacity:${({ $selected: e }) => e ? 1 : 0.38};`, Zc = [
3758
+ }, Wc = h.div`display:flex;flex-direction:column;gap:8px;`, jc = h.div`display:flex;flex-direction:column;gap:8px;`, Kc = ({ value: e, selected: t, label: n }) => /* @__PURE__ */ r.createElement(qc, { $selected: t, "aria-label": n }, Zc[e - 1]), qc = h.div`user-select:none;-webkit-user-drag:none;width:40px;height:40px;aspect-ratio:1;opacity:${({ $selected: e }) => e ? 1 : 0.38};`, Zc = [
3759
3759
  /* @__PURE__ */ r.createElement("svg", { width: "40", height: "40", viewBox: "0 0 40 40", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ r.createElement(
3760
3760
  "path",
3761
3761
  {
@@ -3931,13 +3931,13 @@ const Nc = h.div`text-align:center;text-wrap:pretty;word-break:break-word;paddin
3931
3931
  label: n,
3932
3932
  selected: o
3933
3933
  }) => {
3934
- const [s, i] = T(!1), a = s ? /* @__PURE__ */ r.createElement(qc, { value: e, selected: o, label: n }) : /* @__PURE__ */ r.createElement(nd, { $selected: o, "aria-label": n, src: t, onError: () => i(!0) });
3934
+ const [s, i] = T(!1), a = s ? /* @__PURE__ */ r.createElement(Kc, { value: e, selected: o, label: n }) : /* @__PURE__ */ r.createElement(nd, { $selected: o, "aria-label": n, src: t, onError: () => i(!0) });
3935
3935
  return /* @__PURE__ */ r.createElement(td, null, a);
3936
3936
  }, Jc = h.div`display:flex;flex-direction:column;gap:8px;`, Qc = h.div`display:flex;justify-content:space-between;align-self:center;width:100%;max-width:400px;gap:16px;`, ed = h.button`background-color:transparent;border:none;gap:4px;display:flex;flex-direction:column;align-items:center;justify-content:start;box-sizing:border-box;min-width:48px;max-width:68px;&:hover:not(:disabled) span{color:${u.themedColor.textHighEmphasis};}`, td = h.div`button:hover:not(:disabled) &{border-radius:4px;cursor:pointer;background-color:${u.color.background200};${N.dark`
3937
3937
  background-color: ${u.color.background500};
3938
3938
  `}
3939
3939
  }
3940
- `, nd = h.img`user-select:none;-webkit-user-drag:none;width:40px;height:40px;aspect-ratio:1;opacity:${({ $selected: e }) => e ? 1 : 0.38};`, rd = ({ csatPayload: e }) => /* @__PURE__ */ r.createElement(I, { variant: "button", color: u.themedColor.textHighEmphasis }, e.title), Tt = ({
3940
+ `, nd = h.img`user-select:none;-webkit-user-drag:none;width:40px;height:40px;aspect-ratio:1;opacity:${({ $selected: e }) => e ? 1 : 0.38};`, rd = ({ csatPayload: e }) => /* @__PURE__ */ r.createElement(I, { variant: "button", color: u.themedColor.textHighEmphasis }, e.title), St = ({
3941
3941
  csatPayload: e,
3942
3942
  type: t,
3943
3943
  renderSubmitButton: n,
@@ -3996,7 +3996,7 @@ const Nc = h.div`text-align:center;text-wrap:pretty;word-break:break-word;paddin
3996
3996
  throw new Error("Invalid message type");
3997
3997
  const { extendedMessagePayload: t, onSubmitCSAT: n } = e, { csat: o, csatReason: s, csatExpireAt: i, isResolvedWhenDeterminedByUser: a } = e, l = Ao(), c = sd(t == null ? void 0 : t.csat);
3998
3998
  if (!c || !c.visibility || !he[c.type]) return null;
3999
- const d = c.type === he.AI_AGENT_CSAT_5 || c.type === he.AI_AGENT_CSAT_5_WITH_CRE || c.type === he.HELPDESK_CSAT_5 ? Tt : () => null;
3999
+ const d = c.type === he.AI_AGENT_CSAT_5 || c.type === he.AI_AGENT_CSAT_5_WITH_CRE || c.type === he.HELPDESK_CSAT_5 ? St : () => null;
4000
4000
  return /* @__PURE__ */ r.createElement(ld, null, !o && pn(i) ? /* @__PURE__ */ r.createElement(id, null) : /* @__PURE__ */ r.createElement(
4001
4001
  d,
4002
4002
  {
@@ -4066,7 +4066,7 @@ const ud = h.div`padding-inline:${F.HORIZONTAL_PADDING}px;margin-bottom:${({ $ma
4066
4066
  textColor: y = "#000000",
4067
4067
  highlightColor: x = Er.DEFAULT_PRIMARY
4068
4068
  } = p;
4069
- return /* @__PURE__ */ r.createElement(Hn, null, e && /* @__PURE__ */ r.createElement(Hn, null, /* @__PURE__ */ r.createElement(mt, null, /* @__PURE__ */ r.createElement(ot, null, /* @__PURE__ */ r.createElement(D, { size: 16, type: "actionbook", color: E })), /* @__PURE__ */ r.createElement(
4069
+ return /* @__PURE__ */ r.createElement(Hn, null, e && /* @__PURE__ */ r.createElement(Hn, null, /* @__PURE__ */ r.createElement(ut, null, /* @__PURE__ */ r.createElement(ot, null, /* @__PURE__ */ r.createElement(D, { size: 16, type: "actionbook", color: E })), /* @__PURE__ */ r.createElement(
4070
4070
  rt,
4071
4071
  {
4072
4072
  $clickable: !!s,
@@ -4077,7 +4077,7 @@ const ud = h.div`padding-inline:${F.HORIZONTAL_PADDING}px;margin-bottom:${({ $ma
4077
4077
  maxTextLines: 1
4078
4078
  },
4079
4079
  e.name
4080
- ))), t == null ? void 0 : t.map((b) => /* @__PURE__ */ r.createElement(wt, { key: b.key }, /* @__PURE__ */ r.createElement(ot, null, /* @__PURE__ */ r.createElement(D, { size: 16, type: "function", color: E })), /* @__PURE__ */ r.createElement(mt, null, /* @__PURE__ */ r.createElement(
4080
+ ))), t == null ? void 0 : t.map((b) => /* @__PURE__ */ r.createElement(Tt, { key: b.key }, /* @__PURE__ */ r.createElement(ot, null, /* @__PURE__ */ r.createElement(D, { size: 16, type: "function", color: E })), /* @__PURE__ */ r.createElement(ut, null, /* @__PURE__ */ r.createElement(
4081
4081
  rt,
4082
4082
  {
4083
4083
  $clickable: !!i,
@@ -4088,7 +4088,7 @@ const ud = h.div`padding-inline:${F.HORIZONTAL_PADDING}px;margin-bottom:${({ $ma
4088
4088
  maxTextLines: 1
4089
4089
  },
4090
4090
  b.name
4091
- ), a && /* @__PURE__ */ r.createElement(hd, { role: "button", onClick: () => a == null ? void 0 : a(b) }, /* @__PURE__ */ r.createElement(I, { variant: "body2", color: x }, "View details"), /* @__PURE__ */ r.createElement(D, { type: "chevron-right", size: 16, color: x }))))), n == null ? void 0 : n.map((b) => /* @__PURE__ */ r.createElement(wt, { key: b.id }, /* @__PURE__ */ r.createElement(ot, null, g({
4091
+ ), a && /* @__PURE__ */ r.createElement(hd, { role: "button", onClick: () => a == null ? void 0 : a(b) }, /* @__PURE__ */ r.createElement(I, { variant: "body2", color: x }, "View details"), /* @__PURE__ */ r.createElement(D, { type: "chevron-right", size: 16, color: x }))))), n == null ? void 0 : n.map((b) => /* @__PURE__ */ r.createElement(Tt, { key: b.id }, /* @__PURE__ */ r.createElement(ot, null, g({
4092
4092
  default: /* @__PURE__ */ r.createElement(D, { size: 16, type: Un[b.source_type] ?? Un.snippet, color: E }),
4093
4093
  sourceType: b.source_type
4094
4094
  })), /* @__PURE__ */ r.createElement(
@@ -4102,7 +4102,7 @@ const ud = h.div`padding-inline:${F.HORIZONTAL_PADDING}px;margin-bottom:${({ $ma
4102
4102
  maxTextLines: 1
4103
4103
  },
4104
4104
  b.preview_title
4105
- ))), o == null ? void 0 : o.map((b) => /* @__PURE__ */ r.createElement(wt, { key: b.key }, /* @__PURE__ */ r.createElement(ot, null, /* @__PURE__ */ r.createElement(D, { size: 16, type: "template", color: E })), /* @__PURE__ */ r.createElement(
4105
+ ))), o == null ? void 0 : o.map((b) => /* @__PURE__ */ r.createElement(Tt, { key: b.key }, /* @__PURE__ */ r.createElement(ot, null, /* @__PURE__ */ r.createElement(D, { size: 16, type: "template", color: E })), /* @__PURE__ */ r.createElement(
4106
4106
  rt,
4107
4107
  {
4108
4108
  $clickable: !!c,
@@ -4121,7 +4121,7 @@ const ud = h.div`padding-inline:${F.HORIZONTAL_PADDING}px;margin-bottom:${({ $ma
4121
4121
  color: ${t};
4122
4122
  }
4123
4123
  `}
4124
- `, ot = h.div`display:flex;align-items:center;justify-content:center;flex-shrink:0;`, mt = h.div`display:flex;gap:8px;align-items:center;word-break:break-word;`, hd = h(mt)`cursor:pointer;gap:4px;`, wt = h(mt)`flex-direction:row;align-items:center;`, Hn = h.div`display:flex;gap:4px;flex-direction:column;align-items:flex-start;`, Mr = Ge(null);
4124
+ `, ot = h.div`display:flex;align-items:center;justify-content:center;flex-shrink:0;`, ut = h.div`display:flex;gap:8px;align-items:center;word-break:break-word;`, hd = h(ut)`cursor:pointer;gap:4px;`, Tt = h(ut)`flex-direction:row;align-items:center;`, Hn = h.div`display:flex;gap:4px;flex-direction:column;align-items:flex-start;`, Mr = Ge(null);
4125
4125
  function pd({
4126
4126
  testerType: e,
4127
4127
  origin: t,
@@ -4144,7 +4144,7 @@ const Le = () => {
4144
4144
  const { isActionbookTester: e } = Le();
4145
4145
  return /* @__PURE__ */ r.createElement(Ve.Template, { template: e ? bd : void 0 }, /* @__PURE__ */ r.createElement(Ve.MessageLogs, { component: Ed }));
4146
4146
  }, bd = (e) => /* @__PURE__ */ r.createElement(Ir, { ...e, testerMode: !0, maxBodyWidth: F.WIDE_BODY_MAX_WIDTH }), Ed = ({ extendedMessagePayload: e = {} }) => {
4147
- const { handlers: t } = K(), { manual: n, groundedness: o, function_calls: s, agent_message_templates: i, is_thinking: a } = e;
4147
+ const { handlers: t } = q(), { manual: n, groundedness: o, function_calls: s, agent_message_templates: i, is_thinking: a } = e;
4148
4148
  return a || !n && !(o != null && o.length) && !(s != null && s.length) && !(i != null && i.length) ? /* @__PURE__ */ r.createElement(r.Fragment, null) : /* @__PURE__ */ r.createElement(xd, null, /* @__PURE__ */ r.createElement(vd, { width: 4 }), /* @__PURE__ */ r.createElement(
4149
4149
  md,
4150
4150
  {
@@ -4162,7 +4162,7 @@ const Le = () => {
4162
4162
  }
4163
4163
  ));
4164
4164
  }, xd = h.div`display:flex;gap:16px;margin:16px ${F.HORIZONTAL_PADDING}px 0;align-self:stretch;`, vd = h.div`width:${({ width: e }) => e}px;background-color:${u.themedColor.textDisabled};border-radius:100px;flex-shrink:0;`, yd = h(I)`margin-top:5px;`, _d = (e) => {
4165
- const { chatSDK: t, handlers: n, logger: o } = K(), { aiAgentInfo: s } = ne(), i = z(/* @__PURE__ */ new Set()), a = (g) => {
4165
+ const { chatSDK: t, handlers: n, logger: o } = q(), { aiAgentInfo: s } = te(), i = z(/* @__PURE__ */ new Set()), a = (g) => {
4166
4166
  if (!(n != null && n.onCustomEvent)) return;
4167
4167
  fe(g) && g.sender.userId === s.userId && !we.isStreaming(g) && !i.current.has(g.messageId) && (o.debug("useCustomEventForMessageReceive: bot-message-received", g), n.onCustomEvent({ type: "bot-message-received", data: { message: g } }), i.current.add(g.messageId));
4168
4168
  }, l = (g) => {
@@ -4178,7 +4178,7 @@ const Le = () => {
4178
4178
  }, d = (g) => {
4179
4179
  l(g);
4180
4180
  };
4181
- return pt(t, {
4181
+ return ht(t, {
4182
4182
  onMessageUpdated: c,
4183
4183
  onMessageReceived: c
4184
4184
  }), {
@@ -4204,7 +4204,7 @@ async function Sd(e) {
4204
4204
  }
4205
4205
  }
4206
4206
  const Td = ({ onScrollAfterSendMessage: e }) => {
4207
- const { agentPreviewConfigs: t, handlers: n } = K(), o = z(t == null ? void 0 : t.agentAttributes);
4207
+ const { agentPreviewConfigs: t, handlers: n } = q(), o = z(t == null ? void 0 : t.agentAttributes);
4208
4208
  return o.current = t == null ? void 0 : t.agentAttributes, {
4209
4209
  onBeforeSendMessage: async (s) => {
4210
4210
  const i = await Sd(s), a = {
@@ -4222,7 +4222,7 @@ const Td = ({ onScrollAfterSendMessage: e }) => {
4222
4222
  if (!e) return null;
4223
4223
  const t = {};
4224
4224
  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;
4225
- }, Or = 50, st = Or - 20, {
4225
+ }, Or = 50, wt = Or - 20, {
4226
4226
  Provider: Ad,
4227
4227
  useContext: Id
4228
4228
  } = J("ConversationScroll"), Vn = {
@@ -4233,7 +4233,7 @@ const Td = ({ onScrollAfterSendMessage: e }) => {
4233
4233
  shouldUpdate: !1
4234
4234
  };
4235
4235
  function kd({ scrollMode: e, children: t }) {
4236
- const n = z(null), o = z(null), s = z(Vn), i = z(!1), a = z(null), [l, c] = T(0), [d, g] = T(0), [p, E] = T(!1), [y, x] = T(!1), [b, f] = T(!1), m = oe(
4236
+ const n = z(null), o = z(null), s = z(Vn), i = z(!1), a = z(null), [l, c] = T(0), [d, g] = T(0), [p, E] = T(!1), [y, x] = T(!1), [b, f] = T(!1), m = ne(
4237
4237
  () => p ? "auto" : e,
4238
4238
  [p, e]
4239
4239
  ), v = O((S) => {
@@ -4246,50 +4246,42 @@ function kd({ scrollMode: e, children: t }) {
4246
4246
  const S = n.current;
4247
4247
  !S || !s.current.shouldUpdate || c((R) => {
4248
4248
  s.current.shouldUpdate = !1;
4249
- const { contentHeight: W, contentSnapshotHeight: se, shouldRecalc: re } = s.current, te = S.clientHeight;
4250
- if (se > W)
4249
+ const { contentHeight: W, contentSnapshotHeight: de, shouldRecalc: ue } = s.current, re = S.clientHeight;
4250
+ if (de > W)
4251
4251
  return R;
4252
4252
  const De = C(S, { messageType: "outgoing" });
4253
4253
  let ve = 0;
4254
4254
  if (De) {
4255
- const ye = De.message.offsetTop - st + te;
4255
+ const ye = De.message.offsetTop - wt + re;
4256
4256
  ve = Math.max(0, ye - W);
4257
4257
  } else {
4258
- const ye = W - se, qe = te - st;
4259
- ve = Math.max(0, ye - qe);
4258
+ const ye = W - de, Ke = re - wt;
4259
+ ve = Math.max(0, ye - Ke);
4260
4260
  }
4261
- return R === 0 || ve !== R || re ? (s.current.shouldRecalc = !1, ve) : R;
4261
+ return R === 0 || ve !== R || ue ? (s.current.shouldRecalc = !1, ve) : R;
4262
4262
  });
4263
4263
  }, C = O(
4264
4264
  (S, R) => {
4265
- const { messageType: W = "all" } = R ?? {}, se = Array.from(S.querySelectorAll(`#${ie}-message-item`));
4266
- let re = se;
4267
- W === "outgoing" && (re = se.filter((vt) => vt.getAttribute("data-layout-id") === "outgoingmessage"));
4268
- const te = re[re.length - 1];
4269
- if (!te) return null;
4270
- const De = S.getBoundingClientRect(), ve = te.getBoundingClientRect(), ye = S.scrollTop + (ve.top - De.top), qe = ye + te.offsetHeight;
4265
+ const { messageType: W = "all" } = R ?? {}, de = Array.from(S.querySelectorAll(`#${oe}-message-item`));
4266
+ let ue = de;
4267
+ W === "outgoing" && (ue = de.filter((xt) => xt.getAttribute("data-layout-id") === "outgoingmessage"));
4268
+ const re = ue[ue.length - 1];
4269
+ if (!re) return null;
4270
+ const De = S.getBoundingClientRect(), ve = re.getBoundingClientRect(), ye = S.scrollTop + (ve.top - De.top), Ke = ye + re.offsetHeight;
4271
4271
  return {
4272
- message: te,
4272
+ message: re,
4273
4273
  scrollTop: ye,
4274
- lastMessageBottom: qe
4274
+ lastMessageBottom: Ke
4275
4275
  };
4276
4276
  },
4277
4277
  []
4278
4278
  ), w = O(() => {
4279
4279
  const S = n.current;
4280
4280
  if (!S || m !== "fixed") return;
4281
- const R = s.current.contentHeight, W = C(S);
4282
- if (s.current.contentHeight = (W == null ? void 0 : W.lastMessageBottom) ?? S.scrollHeight, !i.current && s.current.contentSnapshotHeight > 0 && _(), s.current.contentHeight > R) {
4283
- const re = C(S, { messageType: "outgoing" });
4284
- if (re && R > 0) {
4285
- const te = re.message.offsetTop - st;
4286
- requestAnimationFrame(() => {
4287
- n.current && (n.current.scrollTop = te);
4288
- });
4289
- }
4290
- }
4291
- const se = Math.max(0, S.scrollHeight - S.scrollTop - S.clientHeight);
4292
- g(se), M();
4281
+ const R = C(S);
4282
+ s.current.contentHeight = (R == null ? void 0 : R.lastMessageBottom) ?? S.scrollHeight, !i.current && s.current.contentSnapshotHeight > 0 && _();
4283
+ const W = Math.max(0, S.scrollHeight - S.scrollTop - S.clientHeight);
4284
+ g(W), M();
4293
4285
  }, [m, C]), $ = O(() => {
4294
4286
  o.current && (o.current.disconnect(), o.current = null), s.current = Vn, c(0), g(0);
4295
4287
  }, []), B = O((S = !0) => {
@@ -4313,12 +4305,12 @@ function kd({ scrollMode: e, children: t }) {
4313
4305
  if (!S) return;
4314
4306
  const R = C(S, { messageType: "outgoing" });
4315
4307
  R && (S.scrollTo({
4316
- top: R.message.offsetTop - st,
4308
+ top: R.message.offsetTop - wt,
4317
4309
  behavior: "smooth"
4318
4310
  }), v(500));
4319
- }, [C, v]), de = (S) => {
4320
- const { scrollHeight: R, scrollTop: W, clientHeight: se } = S.currentTarget, re = Math.max(0, R - W - se);
4321
- g(re);
4311
+ }, [C, v]), le = (S) => {
4312
+ const { scrollHeight: R, scrollTop: W, clientHeight: de } = S.currentTarget, ue = Math.max(0, R - W - de);
4313
+ g(ue);
4322
4314
  }, Ee = O(() => {
4323
4315
  m === "fixed" && (x(!0), _());
4324
4316
  }, [m]), xe = O(() => {
@@ -4346,7 +4338,7 @@ function kd({ scrollMode: e, children: t }) {
4346
4338
  shouldShowScrollButton: P
4347
4339
  },
4348
4340
  props: {
4349
- onScroll: de
4341
+ onScroll: le
4350
4342
  },
4351
4343
  actions: {
4352
4344
  scrollToBottom: B,
@@ -4364,10 +4356,10 @@ function kd({ scrollMode: e, children: t }) {
4364
4356
  const {
4365
4357
  Provider: $d,
4366
4358
  Context: Vg,
4367
- useContext: le
4359
+ useContext: ie
4368
4360
  } = J("Conversation"), Md = ({ children: e }) => {
4369
4361
  var s;
4370
- const { channelSource: t } = le(), n = (s = t.channel) == null ? void 0 : s.url, { checkForUserActionRequired: o } = _d(n);
4362
+ const { channelSource: t } = ie(), n = (s = t.channel) == null ? void 0 : s.url, { checkForUserActionRequired: o } = _d(n);
4371
4363
  return U(() => {
4372
4364
  var a;
4373
4365
  const i = (a = t.channel) == null ? void 0 : a.lastMessage;
@@ -4381,7 +4373,7 @@ const {
4381
4373
  children: s
4382
4374
  }) => {
4383
4375
  var v;
4384
- const { config: i } = q(), { activeChannel: a, refreshActiveChannel: l, aiAgentInfo: c } = ne(), { testerType: d } = Le(), g = Id(), p = ((v = i == null ? void 0 : i.conversation) == null ? void 0 : v.scrollMode) ?? "auto", { onBeforeSendMessage: E, onAfterSendMessage: y } = Td({
4376
+ const { config: i } = K(), { activeChannel: a, refreshActiveChannel: l, aiAgentInfo: c } = te(), { testerType: d } = Le(), g = Id(), p = ((v = i == null ? void 0 : i.conversation) == null ? void 0 : v.scrollMode) ?? "auto", { onBeforeSendMessage: E, onAfterSendMessage: y } = Td({
4385
4377
  onScrollAfterSendMessage: () => {
4386
4378
  g.actions.onAfterMessageSend();
4387
4379
  }
@@ -4401,7 +4393,7 @@ const {
4401
4393
  await l(), e && (t == null || t());
4402
4394
  }, [l, e, t]);
4403
4395
  return /* @__PURE__ */ r.createElement(
4404
- qs,
4396
+ Ks,
4405
4397
  {
4406
4398
  channelUrl: x,
4407
4399
  onBeforeSendMessage: b,
@@ -4478,8 +4470,8 @@ function zd(e) {
4478
4470
  function Gd(e, t) {
4479
4471
  return e.filter((n) => we.isWelcomeMessage(n, t));
4480
4472
  }
4481
- const Wd = h.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none;`, jd = h.div`height:64px;min-height:64px;box-sizing:border-box;display:flex;justify-content:space-between;border-bottom:1px solid ${u.themedColor.textDisabled};background-color:${u.themedColor.bg_50_600};@media screen and (max-width:768px){position:relative;}`, qd = h.div`box-sizing:border-box;display:flex;flex-direction:row;align-items:center;height:64px;padding:16px 20px;width:calc(100% - 128px);`, Kd = h.div`margin-inline-end:8px;`, Zd = h.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);}`, Yd = h.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;}`, Xd = h.div`display:flex;width:160px;justify-content:flex-end;`, Jd = h.div`inset-inline-end:0;display:flex;flex-direction:row;`, Lr = h.div`width:64px;padding:21px;box-sizing:border-box;cursor:${(e) => e.disabled ? "not-allowed" : "pointer"};`, Qd = h(Lr)`border-inline-start:1px solid ${u.themedColor.textDisabled};`, eu = h.div`width:100%;height:100%;display:flex;align-items:center;justify-content:center;`, tu = h.video`max-width:100%;max-height:100%;user-select:none;-webkit-user-drag:none;`, nu = h.img`max-width:calc(90% - 60px);max-height:calc(90% - 60px);user-select:none;-webkit-user-drag:none;`, ru = h.div`max-width:100%;max-height:100%;display:flex;justify-content:center;align-items:center;`, ou = ({ file: e, sender: t = {}, onClose: n, onDownloadClick: o }) => {
4482
- const { type: s, url: i, name: a = "" } = e, { profileUrl: l, nickname: c, userId: d } = t, { aiAgentInfo: g } = ne();
4473
+ const Wd = h.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none;`, jd = h.div`height:64px;min-height:64px;box-sizing:border-box;display:flex;justify-content:space-between;border-bottom:1px solid ${u.themedColor.textDisabled};background-color:${u.themedColor.bg_50_600};@media screen and (max-width:768px){position:relative;}`, Kd = h.div`box-sizing:border-box;display:flex;flex-direction:row;align-items:center;height:64px;padding:16px 20px;width:calc(100% - 128px);`, qd = h.div`margin-inline-end:8px;`, Zd = h.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);}`, Yd = h.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;}`, Xd = h.div`display:flex;width:160px;justify-content:flex-end;`, Jd = h.div`inset-inline-end:0;display:flex;flex-direction:row;`, Lr = h.div`width:64px;padding:21px;box-sizing:border-box;cursor:${(e) => e.disabled ? "not-allowed" : "pointer"};`, Qd = h(Lr)`border-inline-start:1px solid ${u.themedColor.textDisabled};`, eu = h.div`width:100%;height:100%;display:flex;align-items:center;justify-content:center;`, tu = h.video`max-width:100%;max-height:100%;user-select:none;-webkit-user-drag:none;`, nu = h.img`max-width:calc(90% - 60px);max-height:calc(90% - 60px);user-select:none;-webkit-user-drag:none;`, ru = h.div`max-width:100%;max-height:100%;display:flex;justify-content:center;align-items:center;`, ou = ({ file: e, sender: t = {}, onClose: n, onDownloadClick: o }) => {
4474
+ const { type: s, url: i, name: a = "" } = e, { profileUrl: l, nickname: c, userId: d } = t, { aiAgentInfo: g } = te();
4483
4475
  return /* @__PURE__ */ r.createElement(
4484
4476
  iu,
4485
4477
  {
@@ -4504,14 +4496,14 @@ const Wd = h.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none
4504
4496
  onDownloadClick: l
4505
4497
  }) => {
4506
4498
  const { stringSet: c } = V();
4507
- return /* @__PURE__ */ r.createElement(xt, { onClose: a, visible: !0, rootElementId: ae.MODAL_ROOT }, /* @__PURE__ */ r.createElement(Wd, null, /* @__PURE__ */ r.createElement(jd, null, /* @__PURE__ */ r.createElement(qd, null, /* @__PURE__ */ r.createElement(Kd, null, /* @__PURE__ */ r.createElement(su, { profileUrl: e, isBotMessage: t })), /* @__PURE__ */ r.createElement(Zd, null, /* @__PURE__ */ r.createElement(I, { variant: "h2", color: u.themedColor.textHighEmphasis }, o)), /* @__PURE__ */ r.createElement(Yd, null, /* @__PURE__ */ r.createElement(I, { variant: "body1", color: u.color.ondark.textMidEmphasis }, n))), /* @__PURE__ */ r.createElement(Xd, null, zn(s) && /* @__PURE__ */ r.createElement(Jd, null, /* @__PURE__ */ r.createElement(Lr, { as: "a", href: i, target: "_blank", rel: Zt, onClick: l }, /* @__PURE__ */ r.createElement(D, { type: "download", color: u.themedColor.textHighEmphasis, size: 24 }))), /* @__PURE__ */ r.createElement(Qd, { onClick: a }, /* @__PURE__ */ r.createElement(D, { type: "close", color: u.themedColor.textHighEmphasis, size: 24 })))), /* @__PURE__ */ r.createElement(eu, { onClick: (d) => d.currentTarget === d.target && a() }, or(s) && /* @__PURE__ */ r.createElement(tu, { controls: !0 }, /* @__PURE__ */ r.createElement("source", { src: i, type: s })), rr(s) && /* @__PURE__ */ r.createElement(nu, { src: i, alt: o }), !zn(s) && /* @__PURE__ */ r.createElement(ru, null, /* @__PURE__ */ r.createElement(I, { variant: "h1", color: u.themedColor.textHighEmphasis }, c.FILE_VIEWER__UNSUPPORT)))));
4499
+ return /* @__PURE__ */ r.createElement(Et, { onClose: a, visible: !0, rootElementId: se.MODAL_ROOT }, /* @__PURE__ */ r.createElement(Wd, null, /* @__PURE__ */ r.createElement(jd, null, /* @__PURE__ */ r.createElement(Kd, null, /* @__PURE__ */ r.createElement(qd, null, /* @__PURE__ */ r.createElement(su, { profileUrl: e, isBotMessage: t })), /* @__PURE__ */ r.createElement(Zd, null, /* @__PURE__ */ r.createElement(I, { variant: "h2", color: u.themedColor.textHighEmphasis }, o)), /* @__PURE__ */ r.createElement(Yd, null, /* @__PURE__ */ r.createElement(I, { variant: "body1", color: u.color.ondark.textMidEmphasis }, n))), /* @__PURE__ */ r.createElement(Xd, null, zn(s) && /* @__PURE__ */ r.createElement(Jd, null, /* @__PURE__ */ r.createElement(Lr, { as: "a", href: i, target: "_blank", rel: Zt, onClick: l }, /* @__PURE__ */ r.createElement(D, { type: "download", color: u.themedColor.textHighEmphasis, size: 24 }))), /* @__PURE__ */ r.createElement(Qd, { onClick: a }, /* @__PURE__ */ r.createElement(D, { type: "close", color: u.themedColor.textHighEmphasis, size: 24 })))), /* @__PURE__ */ r.createElement(eu, { onClick: (d) => d.currentTarget === d.target && a() }, or(s) && /* @__PURE__ */ r.createElement(tu, { controls: !0 }, /* @__PURE__ */ r.createElement("source", { src: i, type: s })), rr(s) && /* @__PURE__ */ r.createElement(nu, { src: i, alt: o }), !zn(s) && /* @__PURE__ */ r.createElement(ru, null, /* @__PURE__ */ r.createElement(I, { variant: "h1", color: u.themedColor.textHighEmphasis }, c.FILE_VIEWER__UNSUPPORT)))));
4508
4500
  }, au = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0;background-color:${({ theme: e }) => e.colors.base.primary}!important;path{fill:${({ theme: e }) => e.colors.base.primaryContrastContent}!important;}`, Dr = ({
4509
4501
  className: e,
4510
4502
  locale: t,
4511
4503
  date: n = Date.now(),
4512
4504
  formatString: o = "MMMM dd, yyyy",
4513
4505
  style: s
4514
- }) => /* @__PURE__ */ r.createElement(lu, { id: `${ie}-date-separator`, style: s, className: e }, /* @__PURE__ */ r.createElement(I, { variant: "caption4", color: u.themedColor.textMidEmphasis }, Qn(n, o, { locale: t }))), lu = h.div`display:flex;justify-content:center;align-items:center;text-align:center;word-break:break-word;`, cu = We(function(t, n) {
4506
+ }) => /* @__PURE__ */ r.createElement(lu, { id: `${oe}-date-separator`, style: s, className: e }, /* @__PURE__ */ r.createElement(I, { variant: "caption4", color: u.themedColor.textMidEmphasis }, Qn(n, o, { locale: t }))), lu = h.div`display:flex;justify-content:center;align-items:center;text-align:center;word-break:break-word;`, cu = We(function(t, n) {
4515
4507
  const {
4516
4508
  messages: o,
4517
4509
  renderMessage: s,
@@ -4567,7 +4559,7 @@ const Wd = h.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none
4567
4559
  outline: none;
4568
4560
  }
4569
4561
  `, fu = () => {
4570
- const { agentPreviewConfigs: e = {}, aiAgentId: t } = K(), { aiAgentInfo: n } = ne(), { stringSet: o, dateLocale: s } = V(), { messageSource: i } = le(), { Template: a } = Ve.useContext(), l = e.welcomeMessages ?? [], c = i.messages, d = Gd(c, t), g = c[d.length + 1], p = d[0] ?? g;
4562
+ const { agentPreviewConfigs: e = {}, aiAgentId: t } = q(), { aiAgentInfo: n } = te(), { stringSet: o, dateLocale: s } = V(), { messageSource: i } = ie(), { Template: a } = Ve.useContext(), l = e.welcomeMessages ?? [], c = i.messages, d = Gd(c, t), g = c[d.length + 1], p = d[0] ?? g;
4571
4563
  return {
4572
4564
  /**
4573
4565
  * Returns a list of messages filtered according to business requirements.
@@ -4629,7 +4621,7 @@ const Wd = h.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none
4629
4621
  text-decoration: none;
4630
4622
  `, yu = () => {
4631
4623
  var a;
4632
- const { stringSet: e } = V(), { channelSource: t, goToActiveConversation: n, scrollSource: o } = le(), s = Se(t.channel), i = z(s);
4624
+ const { stringSet: e } = V(), { channelSource: t, goToActiveConversation: n, scrollSource: o } = ie(), s = Se(t.channel), i = z(s);
4633
4625
  return U(() => {
4634
4626
  if (!i.current && s) {
4635
4627
  const d = setTimeout(() => {
@@ -4649,13 +4641,13 @@ const Wd = h.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none
4649
4641
  e.TALK_TO_AGENT
4650
4642
  ));
4651
4643
  }, _u = h.div`display:flex;justify-content:center;margin-bottom:16px;`, Cu = h(I)`border-radius:6px;box-sizing:border-box;padding:10px 20px;border:1px solid ${u.themedColor.textDisabled};cursor:pointer;user-select:none;`, Su = () => {
4652
- const { Template: e } = tn.useContext(), { Template: t } = Ve.useContext(), { Template: n } = nn.useContext(), [o, s] = T(null), [i, a] = T(null), { userSession: l, aiAgentInfo: c } = ne(), { cache: d, agentPreviewConfigs: g, chatSDK: p, state: E } = K(), { config: y } = q(), { stringSet: x, dateLocale: b } = V(), {
4644
+ const { Template: e } = tn.useContext(), { Template: t } = Ve.useContext(), { Template: n } = nn.useContext(), [o, s] = T(null), [i, a] = T(null), { userSession: l, aiAgentInfo: c } = te(), { cache: d, agentPreviewConfigs: g, chatSDK: p, state: E } = q(), { config: y } = K(), { stringSet: x, dateLocale: b } = V(), {
4653
4645
  conversation: f,
4654
4646
  channelSource: m,
4655
4647
  messageSource: v,
4656
4648
  scrollSource: _,
4657
4649
  state: { input: M }
4658
- } = le(), { isActionbookTester: C } = Le(), { filteredMessages: w, shouldShowOriginalDate: $, renderAgentPreviewWelcomeMessages: B } = fu(), Q = mr(m.channel), ee = (() => {
4650
+ } = ie(), { isActionbookTester: C } = Le(), { filteredMessages: w, shouldShowOriginalDate: $, renderAgentPreviewWelcomeMessages: B } = fu(), Q = mr(m.channel), ee = (() => {
4659
4651
  const j = Q[0];
4660
4652
  if (!j) return null;
4661
4653
  const A = j.userId === c.userId;
@@ -4664,13 +4656,13 @@ const Wd = h.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none
4664
4656
  U(() => {
4665
4657
  _.actions.onTypingIndicatorUpdate(!!ee);
4666
4658
  }, [!!ee, _.actions.onTypingIndicatorUpdate]);
4667
- const de = Se(m.channel);
4659
+ const le = Se(m.channel);
4668
4660
  U(() => {
4669
- _.actions.onConversationClosed(de);
4670
- }, [de, _.actions.onConversationClosed]);
4661
+ _.actions.onConversationClosed(le);
4662
+ }, [le, _.actions.onConversationClosed]);
4671
4663
  const Ee = (j, A = !1) => {
4672
- var ue;
4673
- return A ? c : ((ue = m.channel) == null ? void 0 : ue.members.find((P) => P.userId === j.sender.userId)) ?? j.sender;
4664
+ var ce;
4665
+ return A ? c : ((ce = m.channel) == null ? void 0 : ce.members.find((P) => P.userId === j.sender.userId)) ?? j.sender;
4674
4666
  }, xe = (j) => {
4675
4667
  if (j.sendingStatus === "failed" && !M.disabled)
4676
4668
  return () => a(j);
@@ -4694,7 +4686,7 @@ const Wd = h.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none
4694
4686
  depsForResetScrollPositionToBottom: [v.initialized, v.messages.length !== 0],
4695
4687
  bottomSpacerHeight: _.state.bottomSpace,
4696
4688
  messageTopArea: /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(Eu, { style: { marginTop: 16 } }), B()),
4697
- messageBottomArea: /* @__PURE__ */ r.createElement(r.Fragment, null, ee && /* @__PURE__ */ r.createElement("div", { id: `${ie}-message-item` }, /* @__PURE__ */ r.createElement(
4689
+ messageBottomArea: /* @__PURE__ */ r.createElement(r.Fragment, null, ee && /* @__PURE__ */ r.createElement("div", { id: `${oe}-message-item` }, /* @__PURE__ */ r.createElement(
4698
4690
  t,
4699
4691
  {
4700
4692
  isTyping: !0,
@@ -4706,10 +4698,10 @@ const Wd = h.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none
4706
4698
  }
4707
4699
  )), ((j = y == null ? void 0 : y.conversation) == null ? void 0 : j.isTalkToAgentViewEnabled) && /* @__PURE__ */ r.createElement(yu, null)),
4708
4700
  overlayArea: /* @__PURE__ */ r.createElement(r.Fragment, null, _.state.shouldShowScrollButton && /* @__PURE__ */ r.createElement(wu, { onClick: () => _.actions.scrollToBottom(!0) })),
4709
- renderMessage: ({ message: A, index: ue }) => {
4710
- const P = qo(A), S = w[ue - 1], R = w[ue + 1], W = w[w.length - 1], se = A === W, re = Se(m.channel), te = He(A, c.userId), De = !(c.isUserFeedbackEnabled && te), ve = Ko(A, S, R, De), ye = !No((S == null ? void 0 : S.createdAt) ?? 0, A.createdAt) && $(ue) && !C, qe = (Qe) => {
4701
+ renderMessage: ({ message: A, index: ce }) => {
4702
+ const P = Ko(A), S = w[ce - 1], R = w[ce + 1], W = w[w.length - 1], de = A === W, ue = Se(m.channel), re = He(A, c.userId), De = !(c.isUserFeedbackEnabled && re), ve = qo(A, S, R, De), ye = !No((S == null ? void 0 : S.createdAt) ?? 0, A.createdAt) && $(ce) && !C, Ke = (Qe) => {
4711
4703
  (A.isFileMessage() || A.isUserMessage()) && s({ file: Qe, sender: Ee(A, A.sender.userId === c.userId) });
4712
- }, vt = () => {
4704
+ }, xt = () => {
4713
4705
  A.isFileMessage() && Xt(A.url);
4714
4706
  }, Jr = ye ? /* @__PURE__ */ r.createElement(
4715
4707
  Dr,
@@ -4724,8 +4716,8 @@ const Wd = h.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none
4724
4716
  extendedMessagePayload: A.extendedMessagePayload,
4725
4717
  createdAt: A.createdAt,
4726
4718
  groupType: ve,
4727
- onClickMedia: qe,
4728
- onClickFile: vt
4719
+ onClickMedia: Ke,
4720
+ onClickFile: xt
4729
4721
  }, Qr = () => {
4730
4722
  if (Re.isOutgoing(A, l.userId))
4731
4723
  return "outgoingmessage";
@@ -4776,14 +4768,14 @@ const Wd = h.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none
4776
4768
  if (Re.isIncoming(A, l.userId)) {
4777
4769
  const _e = {
4778
4770
  ...Je,
4779
- sender: Ee(A, te),
4771
+ sender: Ee(A, re),
4780
4772
  message: A.message,
4781
- suggestedRepliesVisible: se,
4773
+ suggestedRepliesVisible: de,
4782
4774
  suggestedRepliesDirection: g == null ? void 0 : g.suggestedRepliesDirection,
4783
- isBotMessage: te,
4775
+ isBotMessage: re,
4784
4776
  isStreaming: we.isStreaming(A),
4785
4777
  isHandedOff: Ue(m.channel),
4786
- isConversationClosed: re,
4778
+ isConversationClosed: ue,
4787
4779
  isFeedbackEnabled: c.isUserFeedbackEnabled,
4788
4780
  isFeedbackCommentEnabled: c.isUserFeedbackCommentOptionEnabled,
4789
4781
  onClickSuggestedReply: async ({ reply: G }) => {
@@ -4828,12 +4820,12 @@ const Wd = h.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none
4828
4820
  return /* @__PURE__ */ r.createElement(t, { messageType: "file", file: A, ..._e });
4829
4821
  }
4830
4822
  })();
4831
- return /* @__PURE__ */ r.createElement("div", { key: P, id: `${ie}-message-item`, "data-layout-id": Qr() }, Jr, eo);
4823
+ return /* @__PURE__ */ r.createElement("div", { key: P, id: `${oe}-message-item`, "data-layout-id": Qr() }, Jr, eo);
4832
4824
  }
4833
4825
  }
4834
4826
  );
4835
4827
  };
4836
- return /* @__PURE__ */ r.createElement(Tu, { id: `${ie}-message-list` }, ke(), o && /* @__PURE__ */ r.createElement(ou, { onClose: () => s(null), sender: o.sender, file: o.file }), i && /* @__PURE__ */ r.createElement(Pe, { visible: !0, onClose: () => a(null) }, /* @__PURE__ */ r.createElement(
4828
+ return /* @__PURE__ */ r.createElement(Tu, { id: `${oe}-message-list` }, ke(), o && /* @__PURE__ */ r.createElement(ou, { onClose: () => s(null), sender: o.sender, file: o.file }), i && /* @__PURE__ */ r.createElement(Pe, { visible: !0, onClose: () => a(null) }, /* @__PURE__ */ r.createElement(
4837
4829
  Pe.ActionItem,
4838
4830
  {
4839
4831
  onClick: () => {
@@ -4852,7 +4844,7 @@ const Wd = h.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none
4852
4844
  x.FAILED_MESSAGE_REMOVE
4853
4845
  )));
4854
4846
  }, Tu = h.div`overflow-y:hidden;display:flex;flex:1;position:relative;`, wu = h(hu)`position:absolute;bottom:20px;inset-inline-end:20px;`, Au = () => {
4855
- const { stringSet: e } = V(), { connectionError: t } = ne(), { channelSource: n } = le(), o = t || n.error;
4847
+ const { stringSet: e } = V(), { connectionError: t } = te(), { channelSource: n } = ie(), o = t || n.error;
4856
4848
  if (o) {
4857
4849
  const s = t ? void 0 : { label: e.RETRY, onClick: () => n.refetch() };
4858
4850
  return /* @__PURE__ */ r.createElement(ze, { type: "error", label: o.message, action: s });
@@ -4860,7 +4852,7 @@ const Wd = h.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none
4860
4852
  return n.channel ? /* @__PURE__ */ r.createElement(Su, null) : /* @__PURE__ */ r.createElement(ze, { type: "loading" });
4861
4853
  }, Iu = () => {
4862
4854
  var s;
4863
- const { origin: e } = Le(), { appId: t, aiAgentId: n } = q(), { channelSource: o } = le();
4855
+ const { origin: e } = Le(), { appId: t, aiAgentId: n } = K(), { channelSource: o } = ie();
4864
4856
  return (s = o.channel) != null && s.conversation ? /* @__PURE__ */ r.createElement(ku, null, /* @__PURE__ */ r.createElement(Bt, { style: { gap: 4 } }, /* @__PURE__ */ r.createElement(D, { color: u.themedColor.textLowEmphasis, size: 12, type: "show" }), /* @__PURE__ */ r.createElement(I, { as: "i", color: u.themedColor.textLowEmphasis, variant: "caption2" }, "Only visible in the tester")), /* @__PURE__ */ r.createElement(
4865
4857
  Bt,
4866
4858
  {
@@ -4877,7 +4869,7 @@ const Wd = h.div`width:100%;height:100%;position:fixed;top:0;left:0;outline:none
4877
4869
  )) : null;
4878
4870
  }, Bt = h.div`display:flex;justify-content:center;align-items:center;`, ku = h(Bt)`flex-direction:column;padding-block:16px;background-color:${u.themedColor.bg_100_500};gap:8px;`, Rr = Ge(void 0), $u = ({ children: e }) => {
4879
4871
  var b;
4880
- const { chatSDK: t } = K(), { createAttachmentRules: n } = ne(), { stringSet: o } = V(), { channelSource: s } = le(), [i, a] = T([]), [l, c] = T({
4872
+ const { chatSDK: t } = q(), { createAttachmentRules: n } = te(), { stringSet: o } = V(), { channelSource: s } = ie(), [i, a] = T([]), [l, c] = T({
4881
4873
  visible: !1,
4882
4874
  title: ""
4883
4875
  }), d = n({
@@ -4975,11 +4967,11 @@ const Ou = (e, t) => {
4975
4967
  }
4976
4968
  `, Nu = () => {
4977
4969
  const e = je(), [t, n] = T(), { files: o, removeFile: s, isFileUploadEnabled: i } = an();
4978
- return !i || o.length === 0 ? null : /* @__PURE__ */ r.createElement(Lu, null, o.map(({ preview: { type: a, name: l, url: c } }, d) => /* @__PURE__ */ r.createElement(Du, { key: c, onMouseOver: () => n(d), onMouseLeave: () => n(void 0) }, (e || t === d) && /* @__PURE__ */ r.createElement(Ru, { title: "Remove file", onClick: () => s(d) }, /* @__PURE__ */ r.createElement(D, { type: "close-filled", color: u.themedColor.textMidEmphasis })), a.startsWith("image/") ? /* @__PURE__ */ r.createElement("img", { alt: "file-image", src: c }) : /* @__PURE__ */ r.createElement(Kt, { name: l, type: Ht(l, a) }))));
4970
+ return !i || o.length === 0 ? null : /* @__PURE__ */ r.createElement(Lu, null, o.map(({ preview: { type: a, name: l, url: c } }, d) => /* @__PURE__ */ r.createElement(Du, { key: c, onMouseOver: () => n(d), onMouseLeave: () => n(void 0) }, (e || t === d) && /* @__PURE__ */ r.createElement(Ru, { title: "Remove file", onClick: () => s(d) }, /* @__PURE__ */ r.createElement(D, { type: "close-filled", color: u.themedColor.textMidEmphasis })), a.startsWith("image/") ? /* @__PURE__ */ r.createElement("img", { alt: "file-image", src: c }) : /* @__PURE__ */ r.createElement(qt, { name: l, type: Ht(l, a) }))));
4979
4971
  }, Nr = {
4980
4972
  textArea: k`min-height:40px;height:40px;font-size:16px;line-height:24px;`,
4981
4973
  attachIcon: k`margin-bottom:4px;`
4982
- }, Br = h.button`all:unset;cursor:pointer;display:flex;align-items:center;justify-content:center;width:32px;height:32px;`, Bu = h(Br)`flex-shrink:0;margin-inline-end:12px;margin-bottom:2px;&:disabled{cursor:not-allowed;}&:not(:disabled){&:hover{path{fill:${u.themedColor.textHighEmphasis};}}&:active{border-radius:4px;background-color:${u.themedColor.bg_200_400};}}${qt && Nr.attachIcon};`, Fu = h.input`display:none;`, Gn = h.div`width:100%;position:relative;background-color:${u.themedColor.bg_100_500};border-radius:20px;`, Wn = h.div`display:flex;flex-direction:row;align-items:flex-end;position:relative;`, jn = h.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:${u.themedColor.textHighEmphasis};resize:none;width:100%;height:${xr}px;overflow-wrap:break-word;white-space:pre-wrap;overflow-x:hidden;${qt && Nr.textArea};&::placeholder{color:${u.themedColor.textLowEmphasis};}&:disabled{cursor:not-allowed;&::placeholder{color:${u.themedColor.textDisabled};}}`, qn = h.div`padding:12px 16px;position:relative;display:flex;align-items:center;`, Kn = ({ disabled: e }) => {
4974
+ }, Br = h.button`all:unset;cursor:pointer;display:flex;align-items:center;justify-content:center;width:32px;height:32px;`, Bu = h(Br)`flex-shrink:0;margin-inline-end:12px;margin-bottom:2px;&:disabled{cursor:not-allowed;}&:not(:disabled){&:hover{path{fill:${u.themedColor.textHighEmphasis};}}&:active{border-radius:4px;background-color:${u.themedColor.bg_200_400};}}${Kt && Nr.attachIcon};`, Fu = h.input`display:none;`, Gn = h.div`width:100%;position:relative;background-color:${u.themedColor.bg_100_500};border-radius:20px;`, Wn = h.div`display:flex;flex-direction:row;align-items:flex-end;position:relative;`, jn = h.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:${u.themedColor.textHighEmphasis};resize:none;width:100%;height:${xr}px;overflow-wrap:break-word;white-space:pre-wrap;overflow-x:hidden;${Kt && Nr.textArea};&::placeholder{color:${u.themedColor.textLowEmphasis};}&:disabled{cursor:not-allowed;&::placeholder{color:${u.themedColor.textDisabled};}}`, Kn = h.div`padding:12px 16px;position:relative;display:flex;align-items:center;`, qn = ({ disabled: e }) => {
4983
4975
  const { stringSet: t } = V(), n = z(null), [o, s] = T(!1), { addFiles: i, clearFiles: a, files: l, isFileUploadEnabled: c, acceptableMimeTypes: d } = an();
4984
4976
  return !c || l.length > 0 ? null : /* @__PURE__ */ r.createElement(
4985
4977
  Bu,
@@ -5022,7 +5014,7 @@ const Ou = (e, t) => {
5022
5014
  )
5023
5015
  );
5024
5016
  }, Pu = () => {
5025
- const e = z(null), [t, n] = T(""), { stringSet: o } = V(), { rootElement: s } = K(), { channelSource: i, messageSource: a, state: l } = le(), { files: c, addFiles: d, clearFiles: g } = an(), p = l.input.disabled, E = (() => {
5017
+ const e = z(null), [t, n] = T(""), { stringSet: o } = V(), { rootElement: s } = q(), { channelSource: i, messageSource: a, state: l } = ie(), { files: c, addFiles: d, clearFiles: g } = an(), p = l.input.disabled, E = (() => {
5026
5018
  if (!p) return o.MESSAGE_INPUT__PLACE_HOLDER;
5027
5019
  switch (l.input.disabledBy) {
5028
5020
  case "form_active":
@@ -5063,7 +5055,7 @@ const Ou = (e, t) => {
5063
5055
  }
5064
5056
  n(C.target.value);
5065
5057
  };
5066
- return p ? /* @__PURE__ */ r.createElement(qn, null, /* @__PURE__ */ r.createElement(Gn, null, /* @__PURE__ */ r.createElement(Wn, null, /* @__PURE__ */ r.createElement(jn, { disabled: !0, placeholder: E }), /* @__PURE__ */ r.createElement(Kn, { disabled: !0 })))) : /* @__PURE__ */ r.createElement(qn, null, /* @__PURE__ */ r.createElement(Gn, null, /* @__PURE__ */ r.createElement(Nu, null), /* @__PURE__ */ r.createElement(Wn, null, /* @__PURE__ */ r.createElement(
5058
+ return p ? /* @__PURE__ */ r.createElement(Kn, null, /* @__PURE__ */ r.createElement(Gn, null, /* @__PURE__ */ r.createElement(Wn, null, /* @__PURE__ */ r.createElement(jn, { disabled: !0, placeholder: E }), /* @__PURE__ */ r.createElement(qn, { disabled: !0 })))) : /* @__PURE__ */ r.createElement(Kn, null, /* @__PURE__ */ r.createElement(Gn, null, /* @__PURE__ */ r.createElement(Nu, null), /* @__PURE__ */ r.createElement(Wn, null, /* @__PURE__ */ r.createElement(
5067
5059
  jn,
5068
5060
  {
5069
5061
  ref: e,
@@ -5075,7 +5067,7 @@ const Ou = (e, t) => {
5075
5067
  onChange: M,
5076
5068
  onPaste: v
5077
5069
  }
5078
- ), /* @__PURE__ */ r.createElement(Kn, null))), b && /* @__PURE__ */ r.createElement(Br, { onClick: () => m() }, /* @__PURE__ */ r.createElement(D, { type: "send", color: u.color.primary.main, size: 20 })));
5070
+ ), /* @__PURE__ */ r.createElement(qn, null))), b && /* @__PURE__ */ r.createElement(Br, { onClick: () => m() }, /* @__PURE__ */ r.createElement(D, { type: "send", color: u.color.primary.main, size: 20 })));
5079
5071
  }, Uu = h.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:${u.themedColor.textLowEmphasis};&& a{font-weight:700;text-decoration:none;${N.light`
5080
5072
  color: ${u.color.information.light};
5081
5073
  `};
@@ -5083,19 +5075,19 @@ const Ou = (e, t) => {
5083
5075
  color: ${u.color.information.main};
5084
5076
  `};
5085
5077
  }
5086
- `, Hu = L(() => import("./DSLWWi3o.js").then((e) => ({ default: e.MarkdownText }))), Vu = () => {
5087
- const { aiAgentInfo: e, userSession: t } = ne(), { messageSource: n, channelSource: o } = le(), [s, i] = T(null), a = jt("special-notice", o.channel), l = O(() => o.channel ? a ? n.messages.some((c) => He(c, (t == null ? void 0 : t.userId) ?? "")) : !0 : null, [o.channel, a, n.messages, t == null ? void 0 : t.userId]);
5078
+ `, Hu = L(() => import("./22f1cDnj.js").then((e) => ({ default: e.MarkdownText }))), Vu = () => {
5079
+ const { aiAgentInfo: e, userSession: t } = te(), { messageSource: n, channelSource: o } = ie(), [s, i] = T(null), a = jt("special-notice", o.channel), l = O(() => o.channel ? a ? n.messages.some((c) => He(c, (t == null ? void 0 : t.userId) ?? "")) : !0 : null, [o.channel, a, n.messages, t == null ? void 0 : t.userId]);
5088
5080
  return U(() => {
5089
5081
  s || i(l());
5090
5082
  }, [l, s]), s ? null : /* @__PURE__ */ r.createElement(Uu, null, /* @__PURE__ */ r.createElement(Hu, null, e.specialNotice));
5091
5083
  }, zu = () => /* @__PURE__ */ r.createElement(Gu, null, /* @__PURE__ */ r.createElement(Vu, null), /* @__PURE__ */ r.createElement($u, null, /* @__PURE__ */ r.createElement(Pu, null))), Gu = h.div`z-index:0;border:none;width:100%;`, Wu = () => {
5092
5084
  var s;
5093
- const { testerType: e } = Le(), { channelSource: t } = le(), n = Se(t.channel), o = !!e && ((s = t.channel) == null ? void 0 : s.isAIAgent);
5085
+ const { testerType: e } = Le(), { channelSource: t } = ie(), n = Se(t.channel), o = !!e && ((s = t.channel) == null ? void 0 : s.isAIAgent);
5094
5086
  return n && o ? /* @__PURE__ */ r.createElement(Iu, null) : /* @__PURE__ */ r.createElement(zu, null);
5095
5087
  }, Fr = ({ channel: e, size: t = 40 }) => {
5096
- const { userSession: n, aiAgentInfo: o } = ne(), { fallbackIcon: s, url: i } = pr({ channel: e, aiAgentInfo: o, userSession: n }), a = ht();
5088
+ const { userSession: n, aiAgentInfo: o } = te(), { fallbackIcon: s, url: i } = pr({ channel: e, aiAgentInfo: o, userSession: n }), a = gt();
5097
5089
  return i ? /* @__PURE__ */ r.createElement(Yt, { src: i, size: t }) : /* @__PURE__ */ r.createElement(ju, { $size: t, $bgColor: a.colors.base.primary }, /* @__PURE__ */ r.createElement(D, { type: s, size: t * 0.55, color: a.colors.base.primaryContrastContent }));
5098
- }, ju = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;border-radius:50%;background-color:${({ $bgColor: e }) => e};display:flex;align-items:center;justify-content:center;flex-shrink:0;`, qu = ({ label: e, children: t, position: n = "top", disabled: o }) => o ? t : /* @__PURE__ */ r.createElement(Ft, null, t, /* @__PURE__ */ r.createElement(Yu, { $position: n }, /* @__PURE__ */ r.createElement(Xu, { variant: "caption1" }, e), /* @__PURE__ */ r.createElement(Ku, { $position: n }))), Ku = ({ $position: e }) => /* @__PURE__ */ r.createElement(
5090
+ }, ju = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;border-radius:50%;background-color:${({ $bgColor: e }) => e};display:flex;align-items:center;justify-content:center;flex-shrink:0;`, Ku = ({ label: e, children: t, position: n = "top", disabled: o }) => o ? t : /* @__PURE__ */ r.createElement(Ft, null, t, /* @__PURE__ */ r.createElement(Yu, { $position: n }, /* @__PURE__ */ r.createElement(Xu, { variant: "caption1" }, e), /* @__PURE__ */ r.createElement(qu, { $position: n }))), qu = ({ $position: e }) => /* @__PURE__ */ r.createElement(
5099
5091
  "svg",
5100
5092
  {
5101
5093
  style: { transform: e === "top" ? "rotate(0)" : "rotate(180deg)" },
@@ -5110,7 +5102,7 @@ const Ou = (e, t) => {
5110
5102
  top: k`flex-direction:column;top:0;transform:translate(-50%,-100%);`,
5111
5103
  bottom: k`flex-direction:column-reverse;bottom:0;transform:translate(-50%,100%);`
5112
5104
  }, Ft = h.div`position:relative;`, Yu = h.div`display:flex;align-items:center;position:absolute;left:50%;z-index:${Oe.TOOLTIP};${({ $position: e }) => Zu[e]}opacity:0;transition:opacity 0.2s ease-in-out;pointer-events:none;${Ft}:hover &,${Ft}:focus-within &{opacity:1;}`, Xu = h(I)`padding:6px 8px;background:${u.themedColor.textHighEmphasis};color:${u.themedColor.textHighEmphasisInverse};border-radius:4px;font-size:12px;white-space:nowrap;`, Ju = () => {
5113
- const { state: e, logger: t, enableCloseConversationButton: n, enableExpandButton: o, dispatcher: s } = K(), { stringSet: i } = V(), { channelSource: a, onNavigateToConversationList: l } = le(), { aiAgentInfo: c, userSession: d } = ne(), g = a.channel, E = je() ? 24 : 16, y = pr({ channel: g, userSession: d, aiAgentInfo: c }), x = () => {
5105
+ const { state: e, logger: t, enableCloseConversationButton: n, enableExpandButton: o, dispatcher: s } = q(), { stringSet: i } = V(), { channelSource: a, onNavigateToConversationList: l } = ie(), { aiAgentInfo: c, userSession: d } = te(), g = a.channel, E = je() ? 24 : 16, y = pr({ channel: g, userSession: d, aiAgentInfo: c }), x = () => {
5114
5106
  e.setOpened(!1);
5115
5107
  }, b = async () => {
5116
5108
  try {
@@ -5139,7 +5131,7 @@ const Ou = (e, t) => {
5139
5131
  }
5140
5132
  ), o && /* @__PURE__ */ r.createElement(Qu, { size: E }), /* @__PURE__ */ r.createElement(em, { size: E, onClick: x })));
5141
5133
  }, Qu = ({ size: e, disabled: t }) => {
5142
- const { state: n } = K();
5134
+ const { state: n } = q();
5143
5135
  return /* @__PURE__ */ r.createElement(Xe, { "aria-label": "expand", onClick: () => n.setExpanded(!n.expanded), disabled: t }, /* @__PURE__ */ r.createElement(D, { type: n.expanded ? "collapse" : "expand", size: e, color: u.themedColor.textHighEmphasis }));
5144
5136
  }, em = ({ size: e, disabled: t, onClick: n }) => /* @__PURE__ */ r.createElement(Xe, { "aria-label": "close messenger", onClick: n, disabled: t }, /* @__PURE__ */ r.createElement(D, { type: "close", size: e, color: u.themedColor.textHighEmphasis })), tm = ({ size: e, disabled: t, onClick: n }) => /* @__PURE__ */ r.createElement(Xe, { "aria-label": "close conversation", onClick: n, disabled: t }, /* @__PURE__ */ r.createElement(
5145
5137
  D,
@@ -5148,7 +5140,7 @@ const Ou = (e, t) => {
5148
5140
  size: e,
5149
5141
  color: t ? u.themedColor.textDisabled : u.themedColor.textHighEmphasis
5150
5142
  }
5151
- )), nm = ({ size: e, onClick: t, disabled: n, tooltipLabel: o }) => /* @__PURE__ */ r.createElement(qu, { label: o, position: "bottom", disabled: n }, /* @__PURE__ */ r.createElement(Xe, { "aria-label": "agent", onClick: t, disabled: n }, /* @__PURE__ */ r.createElement(
5143
+ )), nm = ({ size: e, onClick: t, disabled: n, tooltipLabel: o }) => /* @__PURE__ */ r.createElement(Ku, { label: o, position: "bottom", disabled: n }, /* @__PURE__ */ r.createElement(Xe, { "aria-label": "agent", onClick: t, disabled: n }, /* @__PURE__ */ r.createElement(
5152
5144
  D,
5153
5145
  {
5154
5146
  type: "agent",
@@ -5168,7 +5160,7 @@ const Ou = (e, t) => {
5168
5160
  onClearClosedChannelUrl: a
5169
5161
  }) => {
5170
5162
  var g;
5171
- const { config: l } = q(), c = ((g = l == null ? void 0 : l.conversation) == null ? void 0 : g.scrollMode) ?? "auto", { Template: d } = ln.useContext();
5163
+ const { config: l } = K(), c = ((g = l == null ? void 0 : l.conversation) == null ? void 0 : g.scrollMode) ?? "auto", { Template: d } = ln.useContext();
5172
5164
  return /* @__PURE__ */ r.createElement(kd, { scrollMode: c }, /* @__PURE__ */ r.createElement(
5173
5165
  Od,
5174
5166
  {
@@ -5260,7 +5252,7 @@ const pm = h.div`display:flex;flex-shrink:0;flex-direction:row;align-items:cente
5260
5252
  }
5261
5253
  ) : /* @__PURE__ */ r.createElement(ze, { type: "loading" });
5262
5254
  }, Tm = () => {
5263
- const { stringSet: e } = V(), { language: t, countryCode: n, context: o } = K(), { aiAgentInfo: s, refreshActiveChannel: i, createConversation: a, setActiveChannel: l } = ne(), { onOpenConversationView: c } = Pr();
5255
+ const { stringSet: e } = V(), { language: t, countryCode: n, context: o } = q(), { aiAgentInfo: s, refreshActiveChannel: i, createConversation: a, setActiveChannel: l } = te(), { onOpenConversationView: c } = Pr();
5264
5256
  return /* @__PURE__ */ r.createElement(
5265
5257
  wm,
5266
5258
  {
@@ -5283,7 +5275,7 @@ const pm = h.div`display:flex;flex-shrink:0;flex-direction:row;align-items:cente
5283
5275
  /* @__PURE__ */ r.createElement(Am, { variant: "h1" }, e.TALK_TO_AGENT)
5284
5276
  );
5285
5277
  }, wm = h.div`background-color:${({ theme: e }) => e.colors.base.primary};display:flex;align-items:center;justify-content:center;padding:16px;cursor:pointer;`, Am = h(I)`color:${({ theme: e }) => e.colors.base.primaryContrastContent};overflow:hidden;text-overflow:ellipsis;white-space:nowrap;`, Im = () => {
5286
- const { state: e } = K(), { stringSet: t } = V(), o = je() ? 24 : 16, s = () => {
5278
+ const { state: e } = q(), { stringSet: t } = V(), o = je() ? 24 : 16, s = () => {
5287
5279
  e.setOpened(!1);
5288
5280
  };
5289
5281
  return /* @__PURE__ */ r.createElement($m, null, /* @__PURE__ */ r.createElement(Mm, { variant: "h2", color: u.themedColor.textHighEmphasis }, t.CONVERSATION_LIST__HEADER_TITLE), /* @__PURE__ */ r.createElement(Om, null, /* @__PURE__ */ r.createElement(km, { size: o, onClick: s })), /* @__PURE__ */ r.createElement(Lm, null));
@@ -5316,7 +5308,7 @@ function Nm() {
5316
5308
  const { components: e } = cn.useContext();
5317
5309
  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));
5318
5310
  }
5319
- const Bm = h.div`height:100%;width:100%;display:flex;flex-direction:column;flex:1;background-color:${({ theme: e }) => e.colors.base.background};`, Fm = k`:where(#${ae.ENTRY}) :not(code *){font-family:'Roboto',sans-serif;box-sizing:border-box;}`, Pm = [Fm, Li, Di], Um = (e, ...t) => bo(e, ...Pm, ...t), Hm = Um``, Vm = Fo(
5311
+ const Bm = h.div`height:100%;width:100%;display:flex;flex-direction:column;flex:1;background-color:${({ theme: e }) => e.colors.base.background};`, Fm = k`:where(#${se.ENTRY}) :not(code *){font-family:'Roboto',sans-serif;box-sizing:border-box;}`, Pm = [Fm, Li, Di], Um = (e, ...t) => bo(e, ...Pm, ...t), Hm = Um``, Vm = Fo(
5320
5312
  ln,
5321
5313
  Ve,
5322
5314
  tn,
@@ -5337,26 +5329,26 @@ function zm({
5337
5329
  }) {
5338
5330
  return Pi(_i, t), /* @__PURE__ */ r.createElement(Eo, { target: t }, /* @__PURE__ */ r.createElement(Ni, { rootElement: t, logger: n, appearance: e, theme: l }, /* @__PURE__ */ r.createElement(ri, { internalVariables: a == null ? void 0 : a.__internalVariables }, /* @__PURE__ */ r.createElement(Oi, { stringSet: s, logger: n, language: o }, /* @__PURE__ */ r.createElement(Vm, null, i, /* @__PURE__ */ r.createElement(Hm, null))))));
5339
5331
  }
5340
- const it = {}, at = {
5332
+ const st = {}, it = {
5341
5333
  getItem: (e) => {
5342
5334
  try {
5343
5335
  return localStorage.getItem(e);
5344
5336
  } catch {
5345
- return it[e] ?? null;
5337
+ return st[e] ?? null;
5346
5338
  }
5347
5339
  },
5348
5340
  setItem: (e, t) => {
5349
5341
  try {
5350
5342
  localStorage.setItem(e, t);
5351
5343
  } catch {
5352
- it[e] = t;
5344
+ st[e] = t;
5353
5345
  }
5354
5346
  },
5355
5347
  deleteItem: (e) => {
5356
5348
  try {
5357
5349
  localStorage.removeItem(e);
5358
5350
  } catch {
5359
- delete it[e];
5351
+ delete st[e];
5360
5352
  }
5361
5353
  },
5362
5354
  getKeys: (e) => {
@@ -5368,7 +5360,7 @@ const it = {}, at = {
5368
5360
  }
5369
5361
  return t;
5370
5362
  } catch {
5371
- return Object.keys(it).filter((t) => t.startsWith(e));
5363
+ return Object.keys(st).filter((t) => t.startsWith(e));
5372
5364
  }
5373
5365
  }
5374
5366
  }, Hr = We(function({
@@ -5380,10 +5372,10 @@ const it = {}, at = {
5380
5372
  ...a
5381
5373
  }, l) {
5382
5374
  var c, d;
5383
- return Ke.level !== n && (Ke.level = n), Fi("https://fonts.googleapis.com/css2?family=Roboto&display=swap", t), /* @__PURE__ */ r.createElement("div", { id: ae.ENTRY, style: { width: "fit-content", height: "fit-content", ...a.entryStyle } }, /* @__PURE__ */ r.createElement(
5375
+ return qe.level !== n && (qe.level = n), Fi("https://fonts.googleapis.com/css2?family=Roboto&display=swap", t), /* @__PURE__ */ r.createElement("div", { id: se.ENTRY, style: { width: "fit-content", height: "fit-content", ...a.entryStyle } }, /* @__PURE__ */ r.createElement(
5384
5376
  zm,
5385
5377
  {
5386
- logger: Ke,
5378
+ logger: qe,
5387
5379
  rootElement: t,
5388
5380
  appearance: (c = a.agentPreviewConfigs) == null ? void 0 : c.appearance,
5389
5381
  stringSet: a.stringSet,
@@ -5396,13 +5388,13 @@ const it = {}, at = {
5396
5388
  {
5397
5389
  rootElement: t,
5398
5390
  keyValueStorage: {
5399
- get: at.getItem,
5400
- set: at.setItem,
5401
- delete: at.deleteItem,
5402
- getKeys: at.getKeys
5391
+ get: it.getItem,
5392
+ set: it.setItem,
5393
+ delete: it.deleteItem,
5394
+ getKeys: it.getKeys
5403
5395
  },
5404
5396
  language: o,
5405
- logger: Ke,
5397
+ logger: qe,
5406
5398
  dispatcher: Gm,
5407
5399
  chatParams: {
5408
5400
  ...a.chatParams,
@@ -5419,20 +5411,20 @@ const it = {}, at = {
5419
5411
  userSessionInfo: s,
5420
5412
  forceCreateChannel: (d = a.agentPreviewConfigs) == null ? void 0 : d.forceCreateChannel
5421
5413
  },
5422
- /* @__PURE__ */ r.createElement(pd, { ...a._UNSAFE_INTERNAL_dashboardTester }, i, /* @__PURE__ */ r.createElement("div", { id: ae.MODAL_ROOT }))
5414
+ /* @__PURE__ */ r.createElement(pd, { ...a._UNSAFE_INTERNAL_dashboardTester }, i, /* @__PURE__ */ r.createElement("div", { id: se.MODAL_ROOT }))
5423
5415
  )
5424
5416
  )
5425
5417
  ));
5426
- }), Ke = new lr(Xn.WARN), Gm = new ir(Ke), Vr = ({ children: e, isOpened: t }) => {
5427
- const { dir: n, rootElement: o } = K(), s = $e(o, !0);
5418
+ }), qe = new lr(Xn.WARN), Gm = new ir(qe), Vr = ({ children: e, isOpened: t }) => {
5419
+ const { dir: n, rootElement: o } = q(), s = $e(o, !0);
5428
5420
  return U(() => {
5429
5421
  const i = "sb-agent-block-scroll";
5430
5422
  return t ? s.body.classList.add(i) : s.body.classList.remove(i), () => {
5431
5423
  s.body.classList.remove(i);
5432
5424
  };
5433
5425
  }, [s, t]), /* @__PURE__ */ r.createElement(Wm, { dir: n, $visible: t }, e);
5434
- }, Wm = h.div`width:100%;height:100%;position:fixed;top:0;left:0;z-index:${Oe.WINDOW};visibility:${({ $visible: e }) => e ? "visible" : "hidden"};`, jm = 48, qm = 2 / 3;
5435
- function Km({
5426
+ }, Wm = h.div`width:100%;height:100%;position:fixed;top:0;left:0;z-index:${Oe.WINDOW};visibility:${({ $visible: e }) => e ? "visible" : "hidden"};`, jm = 48, Km = 2 / 3;
5427
+ function qm({
5436
5428
  className: e,
5437
5429
  isOpened: t,
5438
5430
  onClick: n,
@@ -5443,12 +5435,12 @@ function Km({
5443
5435
  backgroundColor: l,
5444
5436
  size: c = jm
5445
5437
  }) {
5446
- const d = Mt(l), g = Math.round(c * qm);
5438
+ const d = Mt(l), g = Math.round(c * Km);
5447
5439
  return /* @__PURE__ */ r.createElement(
5448
5440
  Xm,
5449
5441
  {
5450
5442
  dir: i,
5451
- id: ae.LAUNCHER,
5443
+ id: se.LAUNCHER,
5452
5444
  className: e,
5453
5445
  "aria-label": "Sendbird AIAgent Launcher",
5454
5446
  onClick: n,
@@ -5474,9 +5466,9 @@ const Zm = k`&:hover{transition:transform 250ms cubic-bezier(0.33,0,0,1);transfo
5474
5466
  Close: ({ size: e }) => /* @__PURE__ */ r.createElement(D, { size: e, type: "chevron-down" })
5475
5467
  };
5476
5468
  function Wr({ className: e, size: t }) {
5477
- const { colors: n } = ht(), { dir: o, state: s } = K(), { launcherInfo: i } = ne();
5469
+ const { colors: n } = gt(), { dir: o, state: s } = q(), { launcherInfo: i } = te();
5478
5470
  return tg(), /* @__PURE__ */ r.createElement(
5479
- Km,
5471
+ qm,
5480
5472
  {
5481
5473
  dir: o,
5482
5474
  className: e,
@@ -5491,7 +5483,7 @@ function Wr({ className: e, size: t }) {
5491
5483
  }
5492
5484
  const eg = 1e3 * 60;
5493
5485
  function tg() {
5494
- const { chatSDK: e, state: t, logger: n, enableAutoDisconnectInLauncher: o } = K(), s = z(null);
5486
+ const { chatSDK: e, state: t, logger: n, enableAutoDisconnectInLauncher: o } = q(), s = z(null);
5495
5487
  U(() => {
5496
5488
  if (!o) return;
5497
5489
  function i() {
@@ -5509,14 +5501,14 @@ function tg() {
5509
5501
  }, [o, e, t.opened]);
5510
5502
  }
5511
5503
  const jr = Ge(null);
5512
- function qr() {
5504
+ function Kr() {
5513
5505
  const e = pe(jr);
5514
5506
  if (!e)
5515
5507
  throw new Error("useNavigator() must be used within <Navigator />");
5516
5508
  return e;
5517
5509
  }
5518
- function Kr({ children: e }) {
5519
- const t = qr();
5510
+ function qr({ children: e }) {
5511
+ const t = Kr();
5520
5512
  return typeof e == "function" ? e(t) : /* @__PURE__ */ r.createElement(r.Fragment, null, e);
5521
5513
  }
5522
5514
  const ng = Jn`0%{transform:translateY(40px);opacity:0;}100%{transform:translateY(0px);opacity:1;}`, rg = Jn`0%{transform:translateY(0px);opacity:1;}100%{transform:translateY(40px);opacity:0;}`, og = k`animation-name:${ng};animation-duration:0.3s;animation-fill-mode:forwards;`, sg = k``, ig = k`animation-name:${rg};animation-duration:0.3s;animation-fill-mode:forwards;`, ag = k`visibility:hidden;`, lg = h.div`position:absolute;top:0;left:0;width:100%;height:100%;${({ $transitionState: e }) => {
@@ -5536,7 +5528,7 @@ const ng = Jn`0%{transform:translateY(40px);opacity:0;}100%{transform:translateY
5536
5528
  z-index: 999;
5537
5529
  ` : k`z-index:1;pointer-events:none;`}
5538
5530
  `;
5539
- function lt({ initialId: e, children: t }) {
5531
+ function at({ initialId: e, children: t }) {
5540
5532
  const [n, o] = T([e]), s = n[n.length - 1], i = O((f, m) => {
5541
5533
  o((v) => [...v, f]), p((v) => ({ ...v, [f]: !0 })), m != null && m.reset && b((v) => ({
5542
5534
  ...v,
@@ -5564,15 +5556,15 @@ function lt({ initialId: e, children: t }) {
5564
5556
  })), o((v) => v.slice(0, -1));
5565
5557
  }, 300), f;
5566
5558
  });
5567
- }, []), l = oe(() => ({
5559
+ }, []), l = ne(() => ({
5568
5560
  navigation: {
5569
5561
  navigate: i,
5570
5562
  pop: a
5571
5563
  },
5572
5564
  activeScreenId: s
5573
- }), [i, a, s]), c = oe(() => ao.toArray(t).filter(
5574
- (f) => f.type === Kr
5575
- ), [t]), d = oe(() => {
5565
+ }), [i, a, s]), c = ne(() => ao.toArray(t).filter(
5566
+ (f) => f.type === qr
5567
+ ), [t]), d = ne(() => {
5576
5568
  const f = {};
5577
5569
  return c.forEach((m) => {
5578
5570
  const { id: v, lazy: _, children: M } = m.props;
@@ -5597,7 +5589,7 @@ function lt({ initialId: e, children: t }) {
5597
5589
  })));
5598
5590
  }
5599
5591
  const cg = h.div`position:relative;width:100%;height:100%;`;
5600
- lt.Screen = Kr;
5592
+ at.Screen = qr;
5601
5593
  const ge = {
5602
5594
  conv: "conv",
5603
5595
  convList: "conv-list"
@@ -5612,7 +5604,7 @@ const ge = {
5612
5604
  return ge.conv;
5613
5605
  }
5614
5606
  })(), s = /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(dg, { onOpenConversationView: n }));
5615
- return /* @__PURE__ */ r.createElement(lt, { initialId: o }, /* @__PURE__ */ r.createElement(lt.Screen, { id: ge.conv }, ({ navigation: i, activeScreenId: a }) => /* @__PURE__ */ r.createElement(
5607
+ return /* @__PURE__ */ r.createElement(at, { initialId: o }, /* @__PURE__ */ r.createElement(at.Screen, { id: ge.conv }, ({ navigation: i, activeScreenId: a }) => /* @__PURE__ */ r.createElement(
5616
5608
  lm,
5617
5609
  {
5618
5610
  key: t,
@@ -5622,7 +5614,7 @@ const ge = {
5622
5614
  shouldMarkAsRead: a === ge.conv
5623
5615
  },
5624
5616
  s
5625
- )), /* @__PURE__ */ r.createElement(lt.Screen, { id: ge.convList, lazy: !0 }, ({ navigation: i }) => /* @__PURE__ */ r.createElement(
5617
+ )), /* @__PURE__ */ r.createElement(at.Screen, { id: ge.convList, lazy: !0 }, ({ navigation: i }) => /* @__PURE__ */ r.createElement(
5626
5618
  Rm,
5627
5619
  {
5628
5620
  onOpenConversationView: (a) => {
@@ -5632,14 +5624,14 @@ const ge = {
5632
5624
  s
5633
5625
  )));
5634
5626
  }, dg = ({ onOpenConversationView: e }) => {
5635
- const { registerOnJoinedProactiveConversation: t } = ne(), { navigation: n } = qr();
5627
+ const { registerOnJoinedProactiveConversation: t } = te(), { navigation: n } = Kr();
5636
5628
  return t(({ channel: o }) => {
5637
5629
  e(o.url), n.navigate(ge.conv);
5638
5630
  }), null;
5639
5631
  };
5640
5632
  function ug({ isExpanded: e, isOpened: t, children: n, launcher: o }) {
5641
- const { dir: s } = K();
5642
- return /* @__PURE__ */ r.createElement(mg, null, /* @__PURE__ */ r.createElement(gg, { dir: s, id: ae.WINDOW, $isExpanded: e, $isOpened: t }, n), o);
5633
+ const { dir: s } = q();
5634
+ return /* @__PURE__ */ r.createElement(mg, null, /* @__PURE__ */ r.createElement(gg, { dir: s, id: se.WINDOW, $isExpanded: e, $isOpened: t }, n), o);
5643
5635
  }
5644
5636
  const mg = h.div`display:flex;flex-direction:column;gap:8px;align-items:flex-end;`, gg = h.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 && pg};${({ $isExpanded: e }) => e && hg};`, hg = k`width:743px;height:723px;`, pg = k`z-index:${Oe.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;`, Gg = We(function({ children: e, ...t }, n) {
5645
5637
  const o = je(), [s, i] = T(), a = o ? Vr : ug;
@@ -5660,18 +5652,18 @@ function Yr(e, t, n, o = 0) {
5660
5652
  let c = "", d = "";
5661
5653
  switch (e) {
5662
5654
  case "start":
5663
- d = `inset-inline-start: ${ce(a)}`;
5655
+ d = `inset-inline-start: ${ae(a)}`;
5664
5656
  break;
5665
5657
  case "end":
5666
- d = `inset-inline-end: ${ce(l)}`;
5658
+ d = `inset-inline-end: ${ae(l)}`;
5667
5659
  break;
5668
5660
  }
5669
5661
  switch (t) {
5670
5662
  case "top":
5671
- c = `top: calc(${ce(s)} + ${o}px)`;
5663
+ c = `top: calc(${ae(s)} + ${o}px)`;
5672
5664
  break;
5673
5665
  case "bottom":
5674
- c = `bottom: calc(${ce(i)} + ${o}px)`;
5666
+ c = `bottom: calc(${ae(i)} + ${o}px)`;
5675
5667
  break;
5676
5668
  }
5677
5669
  return k`${c};${d};`;
@@ -5682,12 +5674,12 @@ function bg(e) {
5682
5674
  }
5683
5675
  const Eg = h(Wr)`position:fixed;z-index:${Oe.LAUNCHER};${({ $horizontal: e, $vertical: t, $margin: n }) => Yr(e, t, n)};`;
5684
5676
  function xg({ isExpanded: e, isOpened: t, children: n }) {
5685
- const { dir: o } = K(), { horizontal: s, vertical: i, margin: a, launcherSize: l } = dn();
5677
+ const { dir: o } = q(), { horizontal: s, vertical: i, margin: a, launcherSize: l } = dn();
5686
5678
  return /* @__PURE__ */ r.createElement(
5687
5679
  vg,
5688
5680
  {
5689
5681
  dir: o,
5690
- id: ae.WINDOW,
5682
+ id: se.WINDOW,
5691
5683
  $isExpanded: e,
5692
5684
  $isOpened: t,
5693
5685
  $horizontal: s,
@@ -5707,7 +5699,7 @@ const vg = h.div`background:${({ theme: e }) => e.colors.base.background};displa
5707
5699
  ${({ $isOpened: e }) => e && _g};
5708
5700
  ${({ $isExpanded: e }) => e && yg};
5709
5701
  `, yg = k`width:743px;height:723px;`, _g = k`z-index:${Oe.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;`, Xr = { top: 24, bottom: 24, start: 24, end: 24 }, Cg = We(function({ children: e, ...t }, n) {
5710
- const [o, s] = T(), [i, a] = T("end-bottom"), [l, c] = T(Xr), [d, g] = T(48), p = je(), E = p ? Vr : xg, { horizontal: y, vertical: x } = oe(() => {
5702
+ const [o, s] = T(), [i, a] = T("end-bottom"), [l, c] = T(Xr), [d, g] = T(48), p = je(), E = p ? Vr : xg, { horizontal: y, vertical: x } = ne(() => {
5711
5703
  const [b, f] = i.split("-");
5712
5704
  return { horizontal: b === "start" ? "start" : "end", vertical: f === "top" ? "top" : "bottom" };
5713
5705
  }, [i]);
@@ -5749,7 +5741,7 @@ export {
5749
5741
  ls as D,
5750
5742
  Wg as F,
5751
5743
  Ve as I,
5752
- Km as L,
5744
+ qm as L,
5753
5745
  md as M,
5754
5746
  tn as O,
5755
5747
  sn as P,
@@ -5757,7 +5749,7 @@ export {
5757
5749
  Hr as a,
5758
5750
  zm as b,
5759
5751
  u as c,
5760
- ne as d,
5752
+ te as d,
5761
5753
  Hg as e,
5762
5754
  V as f,
5763
5755
  Gm as g,
@@ -5767,14 +5759,14 @@ export {
5767
5759
  Vg as k,
5768
5760
  Od as l,
5769
5761
  Si as m,
5770
- le as n,
5762
+ ie as n,
5771
5763
  Rm as o,
5772
5764
  cn as p,
5773
5765
  zg as q,
5774
5766
  mm as r,
5775
5767
  Pr as s,
5776
5768
  he as t,
5777
- K as u,
5769
+ q as u,
5778
5770
  ar as v,
5779
5771
  ks as w,
5780
5772
  _n as x