@sendbird/ai-agent-messenger-react 1.14.0 → 1.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@ var lo = Object.defineProperty;
2
2
  var co = (e, t, n) => t in e ? lo(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var z = (e, t, n) => co(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import * as o from "react";
5
- import { createContext as We, useContext as xe, useLayoutEffect as se, useState as C, useEffect as P, useRef as B, useCallback as L, useMemo as ae, forwardRef as Ge, useImperativeHandle as uo, useId as Gt, useReducer as mo, PureComponent as go, Suspense as ho, lazy as R, Fragment as rr, Children as po } from "react";
5
+ import { createContext as We, useContext as xe, useLayoutEffect as se, useState as S, useEffect as P, useRef as B, useCallback as L, useMemo as ae, forwardRef as Ge, useImperativeHandle as uo, useId as Gt, useReducer as mo, PureComponent as go, Suspense as ho, lazy as R, Fragment as rr, Children as po } from "react";
6
6
  import fo, { SendbirdChatOptions as bo, SendbirdProduct as Eo, DeviceOsPlatform as xn, SendbirdPlatform as xo, SessionHandler as vo, ConnectionHandler as xt, SendbirdError as _o, LogLevel as or, ConnectionState as yo } from "@sendbird/chat";
7
7
  import h, { css as I, ThemeProvider as Co, useTheme as Je, createGlobalStyle as So, StyleSheetManager as To, keyframes as sr } from "styled-components";
8
8
  import { differenceInMinutes as Ao, isToday as wo, differenceInHours as Io, isSameMinute as vn, format as ir, isSameDay as ko } from "date-fns";
@@ -36,7 +36,7 @@ function ye(e) {
36
36
  }
37
37
  });
38
38
  function n({ children: i }) {
39
- const [a, l] = C(() => e.template), [c, d] = C(e.components), g = {
39
+ const [a, l] = S(() => e.template), [c, d] = S(e.components), g = {
40
40
  Template: a,
41
41
  updateTemplate: (f) => l(() => f),
42
42
  components: c,
@@ -477,7 +477,7 @@ function ms({
477
477
  deviceOSPlatform: is() ? xn.MOBILE_WEB : xn.WEB
478
478
  }
479
479
  }) {
480
- const [u, p] = C(() => {
480
+ const [u, p] = S(() => {
481
481
  const x = b ?? new pr(hr.WARN), y = v ?? new gr(x);
482
482
  return {
483
483
  logger: x,
@@ -790,7 +790,7 @@ const {
790
790
  useContext: Yt
791
791
  } = ee("AIAgentTheme");
792
792
  function ks({ logger: e, palette: t, typography: n, appearance: r, children: s }) {
793
- const i = B(null), [a, l] = C(
793
+ const i = B(null), [a, l] = S(
794
794
  () => An({
795
795
  selectedTheme: (r == null ? void 0 : r.theme) ?? "light",
796
796
  palette: t,
@@ -823,7 +823,7 @@ const wn = 25 * 1024 * 1024, $s = {
823
823
  handed_off_only: "handed_off_only"
824
824
  /* HANDED_OFF_ONLY */
825
825
  }, Ms = () => {
826
- const [e, t] = C(() => ({
826
+ const [e, t] = S(() => ({
827
827
  maxAttachmentCount: 1,
828
828
  attachmentMode: "handed_off_only",
829
829
  defaultUploadSizeLimit: wn,
@@ -1129,14 +1129,14 @@ const zs = () => {
1129
1129
  useContext: yt
1130
1130
  } = ee("AIAgentMessengerSession"), Gs = Ge(
1131
1131
  function({ userSessionInfo: e, forceCreateChannel: t, children: n }, r) {
1132
- const { appId: s, aiAgentId: i, chatSDK: a, language: l, countryCode: c, context: d, cache: g, logger: f } = X(), { updateTheme: b } = Yt(), [v, _] = C(void 0), [E, u] = C(
1132
+ const { appId: s, aiAgentId: i, chatSDK: a, language: l, countryCode: c, context: d, cache: g, logger: f } = X(), { updateTheme: b } = Yt(), [v, _] = S(void 0), [E, u] = S(
1133
1133
  void 0
1134
- ), [p, x] = C(null), [y, k] = C(null), [T, D] = C(null), [M, O] = C(null), { updateBaseAttachmentRules: N, createAttachmentRules: j } = Ms(), { shouldSyncCachedTemplate: q, syncCachedTemplates: Se } = zs(), Te = Er(), { authenticate: Le, deauthenticate: Z } = Ps({
1134
+ ), [p, x] = S(null), [y, k] = S(null), [T, D] = S(null), [M, O] = S(null), { updateBaseAttachmentRules: N, createAttachmentRules: j } = Ms(), { shouldSyncCachedTemplate: q, syncCachedTemplates: Se } = zs(), Te = Er(), { authenticate: Le, deauthenticate: Z } = Ps({
1135
1135
  userSessionInfo: e,
1136
1136
  forceCreateChannel: t,
1137
1137
  onUpdateMessengerSettings: L(
1138
- (S) => {
1139
- const { appearance: $, bot: U, launcher: K } = S;
1138
+ (C) => {
1139
+ const { appearance: $, bot: U, launcher: K } = C;
1140
1140
  b($.selected_theme, $), D({
1141
1141
  userId: U.bot_userid,
1142
1142
  profileUrl: U.bot_profile_url,
@@ -1146,35 +1146,35 @@ const zs = () => {
1146
1146
  specialNoticeEnabled: U.is_special_notice_enabled,
1147
1147
  showHandoffButton: U.show_handoff_button ?? !0,
1148
1148
  isMultipleActiveConversationsEnabled: U.is_multiple_active_conversations_enabled ?? !0,
1149
- isUserFeedbackEnabled: S.bot.is_user_feedback_enabled ?? !1,
1150
- isUserFeedbackCommentOptionEnabled: S.bot.is_user_feedback_comment_option_enabled ?? !1
1149
+ isUserFeedbackEnabled: C.bot.is_user_feedback_enabled ?? !1,
1150
+ isUserFeedbackCommentOptionEnabled: C.bot.is_user_feedback_comment_option_enabled ?? !1
1151
1151
  }), O({
1152
1152
  type: K.image_type || "default_icon",
1153
1153
  imageUrl: K.image_url
1154
- }), N(S);
1154
+ }), N(C);
1155
1155
  },
1156
1156
  [b]
1157
1157
  ),
1158
- onPreAuth: L((S, $) => {
1158
+ onPreAuth: L((C, $) => {
1159
1159
  _(void 0), k($);
1160
1160
  }, []),
1161
1161
  onPostAuth: L(
1162
- async (S) => {
1163
- x(a.currentUser), q() && await Se(), u({ url: S.active_channel.channel_url, status: Q.OPEN });
1162
+ async (C) => {
1163
+ x(a.currentUser), q() && await Se(), u({ url: C.active_channel.channel_url, status: Q.OPEN });
1164
1164
  },
1165
1165
  [a, q, Se]
1166
1166
  ),
1167
- onErrorAuth: L((S) => {
1168
- _(S);
1167
+ onErrorAuth: L((C) => {
1168
+ _(C);
1169
1169
  }, []),
1170
- onAuthTokenRefreshed: L((S) => {
1171
- k(($) => $ ? { ...$, authToken: S } : null);
1170
+ onAuthTokenRefreshed: L((C) => {
1171
+ k(($) => $ ? { ...$, authToken: C } : null);
1172
1172
  }, []),
1173
1173
  onPostDeauth: L(() => {
1174
1174
  g.template.clear(), g.messenger.clear(y == null ? void 0 : y.userId), x(null), u(void 0), k(null), D(null), O(null);
1175
1175
  }, [g.template.clear, g.messenger.clear, y])
1176
1176
  }), le = L(async () => {
1177
- var S;
1177
+ var C;
1178
1178
  if (y) {
1179
1179
  f.debug("agentMessengerSession.refreshActiveChannel: try to refresh active channel"), u(void 0);
1180
1180
  const $ = await Te({
@@ -1184,7 +1184,7 @@ const zs = () => {
1184
1184
  country: c,
1185
1185
  context: d,
1186
1186
  forceCreateChannel: t,
1187
- knownActiveChannelUrl: (S = g.messenger.getSettings(y.userId)) == null ? void 0 : S.active_channel.channel_url
1187
+ knownActiveChannelUrl: (C = g.messenger.getSettings(y.userId)) == null ? void 0 : C.active_channel.channel_url
1188
1188
  });
1189
1189
  return g.messenger.setSettings(y.userId, $), u({ url: $.active_channel.channel_url, status: Q.OPEN }), f.info(
1190
1190
  "agentMessengerSession.refreshActiveChannel: refreshed active channel",
@@ -1204,11 +1204,11 @@ const zs = () => {
1204
1204
  g.messenger.getSettings,
1205
1205
  g.messenger.setSettings
1206
1206
  ]), Ae = L(
1207
- async (S) => {
1207
+ async (C) => {
1208
1208
  if (!(y != null && y.userId))
1209
1209
  throw new Error("Current user is not authenticated. Please authenticate first.");
1210
1210
  const $ = await Te({
1211
- ...S,
1211
+ ...C,
1212
1212
  userId: y.userId,
1213
1213
  knownActiveChannelUrl: void 0
1214
1214
  }), U = $.active_channel.channel_url;
@@ -1216,42 +1216,42 @@ const zs = () => {
1216
1216
  },
1217
1217
  [y == null ? void 0 : y.userId, Te]
1218
1218
  ), A = L(
1219
- async (S) => {
1219
+ async (C) => {
1220
1220
  if (!a.currentUser)
1221
1221
  throw new Error("Current user is not authenticated. Please authenticate first.");
1222
- if (Object.entries(S.context).length === 0)
1222
+ if (Object.entries(C.context).length === 0)
1223
1223
  return [];
1224
1224
  const $ = a.aiAgent.createConversationListQuery({
1225
- aiAgentId: i,
1225
+ aiAgentId: C.aiAgentId,
1226
1226
  status: Q.OPEN,
1227
1227
  limit: 100
1228
1228
  }), U = [];
1229
1229
  for (; $.hasNext; ) {
1230
1230
  const K = await $.next();
1231
1231
  for (const te of K)
1232
- js(te.context ?? {}, S.context) && U.push(te.channelInfo.url);
1232
+ js(te.context ?? {}, C.context) && U.push(te.channelInfo.url);
1233
1233
  }
1234
1234
  return U;
1235
1235
  },
1236
- [a, i]
1237
- ), [he] = C(
1236
+ [a]
1237
+ ), [he] = S(
1238
1238
  () => fr(
1239
- (S) => {
1239
+ (C) => {
1240
1240
  var $;
1241
- f.info("agentMessengerSession.channelChanged: channel.conversation", S.conversation), u({ url: S.url, status: (($ = S.conversation) == null ? void 0 : $.status) ?? Q.OPEN });
1241
+ f.info("agentMessengerSession.channelChanged: channel.conversation", C.conversation), u({ url: C.url, status: (($ = C.conversation) == null ? void 0 : $.status) ?? Q.OPEN });
1242
1242
  },
1243
1243
  250,
1244
1244
  { trailing: !1, leading: !0 }
1245
1245
  )
1246
1246
  );
1247
1247
  return vt(a, {
1248
- onChannelChanged: (S) => {
1249
- S.isGroupChannel() && S.url === (E == null ? void 0 : E.url) && he(S);
1248
+ onChannelChanged: (C) => {
1249
+ C.isGroupChannel() && C.url === (E == null ? void 0 : E.url) && he(C);
1250
1250
  }
1251
1251
  }), P(() => () => {
1252
1252
  he.cancel();
1253
1253
  }, [he]), uo(r, () => {
1254
- const S = async () => {
1254
+ const C = async () => {
1255
1255
  if (!E) throw new Error("No active conversation. Please start a conversation first.");
1256
1256
  return await a.groupChannel.getChannel(E.url);
1257
1257
  };
@@ -1261,15 +1261,15 @@ const zs = () => {
1261
1261
  authenticate: Le,
1262
1262
  deauthenticate: Z,
1263
1263
  updateContext: async ($) => {
1264
- const K = await (await S()).updateContext(i, $);
1264
+ const K = await (await C()).updateContext(i, $);
1265
1265
  return { ...K, context: K.context ?? {} };
1266
1266
  },
1267
1267
  patchContext: async ($) => {
1268
- const K = await (await S()).patchContext(i, $);
1268
+ const K = await (await C()).patchContext(i, $);
1269
1269
  return { ...K, context: K.context ?? {} };
1270
1270
  },
1271
1271
  getContextObject: async () => {
1272
- const U = await (await S()).getContextObject(i);
1272
+ const U = await (await C()).getContextObject(i);
1273
1273
  return { ...U, context: U.context ?? {} };
1274
1274
  }
1275
1275
  };
@@ -1297,7 +1297,7 @@ const zs = () => {
1297
1297
  );
1298
1298
  }
1299
1299
  ), js = (e, t) => Object.entries(t).every(([n, r]) => e[n] === r), qs = () => {
1300
- const e = Gt(), { chatSDK: t, networkStateAdapter: n } = X(), [r, s] = C(() => n ? n.isOnline() ? "connected" : "reconnecting" : "connected");
1300
+ const e = Gt(), { chatSDK: t, networkStateAdapter: n } = X(), [r, s] = S(() => n ? n.isOnline() ? "connected" : "reconnecting" : "connected");
1301
1301
  return P(() => {
1302
1302
  const i = new xt({
1303
1303
  onDisconnected: () => s("disconnected"),
@@ -1317,7 +1317,7 @@ const zs = () => {
1317
1317
  });
1318
1318
  }, [n]), r;
1319
1319
  }, vr = (e) => {
1320
- const { chatSDK: t } = X(), [n, r] = C([]);
1320
+ const { chatSDK: t } = X(), [n, r] = S([]);
1321
1321
  return vt(t, {
1322
1322
  onTypingStatusUpdated(s) {
1323
1323
  if (s.url === (e == null ? void 0 : e.url)) {
@@ -1354,7 +1354,7 @@ const zs = () => {
1354
1354
  aiAgentUserId: n,
1355
1355
  isStreamAnimating: r
1356
1356
  }) => {
1357
- const [s, i] = C(!1), a = vr(e);
1357
+ const [s, i] = S(!1), a = vr(e);
1358
1358
  return P(() => {
1359
1359
  if (!t) return;
1360
1360
  const l = a.some((d) => d.userId === n), c = Qe(t, n) && (Ie.isStreaming(t) || r);
@@ -1375,7 +1375,7 @@ const zs = () => {
1375
1375
  isDisabledWhileAIResponding: n,
1376
1376
  currentUserId: r
1377
1377
  }) => {
1378
- const [s, i] = C(!1), a = B(null), l = t && Qe(t, r) ? t.createdAt : 0;
1378
+ const [s, i] = S(!1), a = B(null), l = t && Qe(t, r) ? t.createdAt : 0;
1379
1379
  return P(() => {
1380
1380
  const c = () => {
1381
1381
  a.current && (clearTimeout(a.current), a.current = null), i(!1);
@@ -1389,7 +1389,7 @@ const zs = () => {
1389
1389
  };
1390
1390
  }, [n, l]), s && e;
1391
1391
  }, ei = () => {
1392
- const [e, t] = C(/* @__PURE__ */ new Set()), n = L((s) => {
1392
+ const [e, t] = S(/* @__PURE__ */ new Set()), n = L((s) => {
1393
1393
  t((i) => {
1394
1394
  if (i.has(s)) return i;
1395
1395
  const a = new Set(i);
@@ -1498,7 +1498,7 @@ function ni({
1498
1498
  return /* @__PURE__ */ o.createElement(ti, { value: M }, e);
1499
1499
  }
1500
1500
  function ri(e) {
1501
- const { chatSDK: t, logger: n } = X(), { sdkUser: r } = yt(), [s, i] = C(void 0), [a, l] = C(void 0);
1501
+ const { chatSDK: t, logger: n } = X(), { sdkUser: r } = yt(), [s, i] = S(void 0), [a, l] = S(void 0);
1502
1502
  async function c() {
1503
1503
  if (!r) {
1504
1504
  n.debug("conversation.fetchChannel: no sdk user, skip fetching channel");
@@ -1768,7 +1768,7 @@ const Bt = (e, t) => e.findIndex((n) => n.isIdentical(t)), ii = (e, t, n) => {
1768
1768
  };
1769
1769
  function ai(e, t) {
1770
1770
  var _, E, u, p, x, y, k, T, D, M;
1771
- const n = Gt(), [r, s] = C(!1), [i, a] = C(null), [l, c] = C([]), [d, g] = C(null), f = B(!1), b = L(async () => {
1771
+ const n = Gt(), [r, s] = S(!1), [i, a] = S(null), [l, c] = S([]), [d, g] = S(null), f = B(!1), b = L(async () => {
1772
1772
  if (!f.current && e.currentUser) {
1773
1773
  f.current = !0, s(!1), a(null), c([]);
1774
1774
  try {
@@ -1866,7 +1866,7 @@ const {
1866
1866
  useContext: _r
1867
1867
  } = ee("MessageTemplateFetching");
1868
1868
  function mi({ children: e, internalVariables: t }) {
1869
- const n = B({}), r = B({}), [s, i] = C({}), a = L((d, g) => {
1869
+ const n = B({}), r = B({}), [s, i] = S({}), a = L((d, g) => {
1870
1870
  i((f) => ({
1871
1871
  ...f,
1872
1872
  [d]: { fetching: !1, error: !1, ...f[d], ...g }
@@ -2043,7 +2043,7 @@ const pi = ({
2043
2043
  })), a = $e({ ...r, uiTemplateString: a, variables: n }), a = Me({ ...r, uiTemplateString: a, colorVariables: i }), a = Me({ ...r, uiTemplateString: a, colorVariables: t }), a = $e({ ...r, uiTemplateString: a }), _t(a);
2044
2044
  }, bi = (e) => {
2045
2045
  const { aiAgentColorVariables: t = {} } = e, { internalVariables: n } = _r();
2046
- return C(() => {
2046
+ return S(() => {
2047
2047
  const r = e.onGetCachedTemplate(e.templateKey);
2048
2048
  return r ? pi({
2049
2049
  ...e,
@@ -2210,7 +2210,7 @@ function wi(e, t, n = {}) {
2210
2210
  return yr(e).validate(e, t, r);
2211
2211
  }
2212
2212
  const Ii = (e, t = {}) => {
2213
- const { labels: n = {}, onSubmit: r, onCancel: s } = t, [i, a] = C({}), [l, c] = C(() => {
2213
+ const { labels: n = {}, onSubmit: r, onCancel: s } = t, [i, a] = S({}), [l, c] = S(() => {
2214
2214
  const E = {};
2215
2215
  return e.fields.forEach((u) => {
2216
2216
  E[u.key] = $n(u);
@@ -2347,7 +2347,7 @@ const ki = /* @__PURE__ */ new Set(["free_text", "single_choice"]), $i = ({ csat
2347
2347
  }
2348
2348
  };
2349
2349
  }, kt = 5, Mi = 250, Oi = 50, On = (e) => Math.max(0, e - Oi), Li = (e) => e < 1e3 ? { speed: kt * 0.5, chunkSize: 2 } : e < 2e3 ? { speed: kt * 0.8, chunkSize: 2 } : { speed: kt * 0.6, chunkSize: 3 }, Di = (e) => {
2350
- const { text: t, enabled: n = !1, onAnimationStart: r, onAnimationProgress: s, onAnimationComplete: i } = e, [a, l] = C(() => On(t.length)), c = B(null), d = B({
2350
+ const { text: t, enabled: n = !1, onAnimationStart: r, onAnimationProgress: s, onAnimationComplete: i } = e, [a, l] = S(() => On(t.length)), c = B(null), d = B({
2351
2351
  startTime: 0,
2352
2352
  lastUpdate: 0,
2353
2353
  lastProgressCall: 0
@@ -2604,7 +2604,7 @@ async function zi(e) {
2604
2604
  if (t) return t;
2605
2605
  try {
2606
2606
  if (Pi.has(e)) {
2607
- const { default: n } = await Ui(/* @__PURE__ */ Object.assign({ "./languages/de.ts": () => import("./BW6o50qt.js"), "./languages/en.ts": () => Promise.resolve().then(() => Vi), "./languages/es.ts": () => import("./Bw9xvmqB.js"), "./languages/fr.ts": () => import("./C66w0Vo6.js"), "./languages/hi.ts": () => import("./DvF4h9BU.js"), "./languages/it.ts": () => import("./FYaa05gN.js"), "./languages/ja.ts": () => import("./BJNTmQ2V.js"), "./languages/ko.ts": () => import("./t-xO5mFL.js"), "./languages/pt.ts": () => import("./b3j3zOSP.js"), "./languages/tr.ts": () => import("./Ge_YPjjg.js") }), `./languages/${e}.ts`, 3);
2607
+ const { default: n } = await Ui(/* @__PURE__ */ Object.assign({ "./languages/de.ts": () => import("./nIR8A6uh.js"), "./languages/en.ts": () => Promise.resolve().then(() => Vi), "./languages/es.ts": () => import("./DXtIweo8.js"), "./languages/fr.ts": () => import("./B4TlCYJO.js"), "./languages/hi.ts": () => import("./BxW8q0wm.js"), "./languages/it.ts": () => import("./ADLf9toc.js"), "./languages/ja.ts": () => import("./CEPeqRc8.js"), "./languages/ko.ts": () => import("./CG5GCOKU.js"), "./languages/pt.ts": () => import("./D4RFTanN.js"), "./languages/tr.ts": () => import("./CNbp1OCM.js") }), `./languages/${e}.ts`, 3);
2608
2608
  return Pt.set(e, n), n;
2609
2609
  }
2610
2610
  return pt;
@@ -2621,7 +2621,7 @@ const {
2621
2621
  stringSet: n,
2622
2622
  children: r
2623
2623
  }) => {
2624
- const [s, i] = C(Pt.get(St));
2624
+ const [s, i] = S(Pt.get(St));
2625
2625
  return P(() => {
2626
2626
  const a = Fi(e);
2627
2627
  s.language !== a && (t == null || t.debug("localization.useEffect: update language", { from: s.language, to: a }), zi(a).then(i));
@@ -2796,7 +2796,7 @@ function ea({
2796
2796
  enableAutoDisconnectInLauncher: s = !0,
2797
2797
  ...i
2798
2798
  }) {
2799
- const [a, l] = C(!1), [c, d] = C(!1), g = {
2799
+ const [a, l] = S(!1), [c, d] = S(!1), g = {
2800
2800
  opened: (t == null ? void 0 : t.opened) ?? a,
2801
2801
  setOpened: (t == null ? void 0 : t.setOpened) ?? l,
2802
2802
  expanded: (t == null ? void 0 : t.expanded) ?? c,
@@ -2949,7 +2949,7 @@ function xa({ file: e, children: t, onClickFile: n }) {
2949
2949
  }
2950
2950
  ), t);
2951
2951
  }
2952
- const va = h.div`display:flex;flex-direction:column;align-items:flex-start;gap:${V.GAP_GROUPED}px;`, _a = "1.14.0", ce = "sb-agent", de = {
2952
+ const va = h.div`display:flex;flex-direction:column;align-items:flex-start;gap:${V.GAP_GROUPED}px;`, _a = "1.14.1", ce = "sb-agent", de = {
2953
2953
  ENTRY: `${ce}-entry`,
2954
2954
  MODAL_ROOT: `${ce}-modal-root`,
2955
2955
  WINDOW: `${ce}-window`,
@@ -2981,7 +2981,7 @@ const Aa = h.div`display:flex;flex-direction:column;align-items:flex-start;gap:$
2981
2981
  `, Ia = h.img`width:100%;height:100%;object-fit:cover;`, ka = h.video`width:100%;height:100%;object-fit:cover;`, $a = "✱", Ir = (e) => {
2982
2982
  const t = new RegExp(`(\`+)([^\`]+?)\\1|(${$a}+)`, "g");
2983
2983
  return e.replace(t, (n, r, s, i) => r ? n : i ? `<span id=${Sa} aria-label="masked-text">${i}</span>` : n);
2984
- }, Ma = (e) => e.replace(/\*\*(.*?)\*\*/g, "<b>$1</b>"), Oa = R(async () => ({ default: (await import("./TXpETEfV.js")).MarkdownText })), La = R(async () => ({ default: (await import("./Ch_6OPTz.js")).CodeBlock }));
2984
+ }, Ma = (e) => e.replace(/\*\*(.*?)\*\*/g, "<b>$1</b>"), Oa = R(async () => ({ default: (await import("./DfmanMje.js")).MarkdownText })), La = R(async () => ({ default: (await import("./Ch_6OPTz.js")).CodeBlock }));
2985
2985
  function Nn(e) {
2986
2986
  var s, i;
2987
2987
  const t = e.maxBodyWidth ?? V.BODY_MAX_WIDTH, n = ae(() => ts(e.message, Ir), [e.message]), r = {
@@ -3097,7 +3097,7 @@ const Tt = ({ style: e, rootElementId: t, visible: n, onClose: r, children: s })
3097
3097
  onSubmit: i,
3098
3098
  isCommentEnabled: a = !1
3099
3099
  }) => {
3100
- const { stringSet: l } = W(), [c, d] = C(r), [g, f] = C(s);
3100
+ const { stringSet: l } = W(), [c, d] = S(r), [g, f] = S(s);
3101
3101
  se(() => {
3102
3102
  e ? (d(r), f(s)) : (d(void 0), f(""));
3103
3103
  }, [e, r, s]);
@@ -3166,7 +3166,7 @@ function vl({
3166
3166
  extendedMessagePayload: i,
3167
3167
  onFeedbackUpdate: a
3168
3168
  }) {
3169
- const { stringSet: l } = W(), [c, d] = C(!1), [g, f] = C(!1), [b, v] = C(void 0), [_, E] = C(""), u = i == null ? void 0 : i.feedback, p = (u == null ? void 0 : u.rating) ?? "none";
3169
+ const { stringSet: l } = W(), [c, d] = S(!1), [g, f] = S(!1), [b, v] = S(void 0), [_, E] = S(""), u = i == null ? void 0 : i.feedback, p = (u == null ? void 0 : u.rating) ?? "none";
3170
3170
  if (p !== "none" ? !1 : !!(n || !e || !r || (i == null ? void 0 : i.bot_message_type) !== "generated" || t)) return null;
3171
3171
  const y = (M) => {
3172
3172
  p === "none" ? (v(M), E(""), d(!0)) : f(!0);
@@ -3479,7 +3479,7 @@ const Hn = h.div`display:flex;flex-direction:${({ $horizontal: e }) => e ? "row"
3479
3479
  var u;
3480
3480
  const t = (u = e.extendedMessagePayload) == null ? void 0 : u.form;
3481
3481
  if (!t) throw new Error("Form is not provided");
3482
- const { stringSet: n } = W(), [r, s] = C({ submitting: !1, canceling: !1 }), [i, a] = C({
3482
+ const { stringSet: n } = W(), [r, s] = S({ submitting: !1, canceling: !1 }), [i, a] = S({
3483
3483
  visible: !1
3484
3484
  }), { state: l, fields: c, submit: d, cancel: g, updateFieldValue: f } = Ii(t, {
3485
3485
  labels: {
@@ -3646,7 +3646,7 @@ function Ec({
3646
3646
  onClickSuggestedReply: t,
3647
3647
  suggestedRepliesDirection: n = "vertical"
3648
3648
  }) {
3649
- const [r, s] = C(!1), i = (e == null ? void 0 : e.suggested_replies) ?? [];
3649
+ const [r, s] = S(!1), i = (e == null ? void 0 : e.suggested_replies) ?? [];
3650
3650
  return i.length === 0 || r ? null : /* @__PURE__ */ o.createElement(xc, { id: `${Ce}-ext-suggested-replies`, $type: n }, i.map((a, l) => /* @__PURE__ */ o.createElement(
3651
3651
  vc,
3652
3652
  {
@@ -3740,7 +3740,7 @@ function Lc({
3740
3740
  onClickMedia: r,
3741
3741
  children: s
3742
3742
  }) {
3743
- const { aspectRatio: i, localFile: a } = n, [l] = C(() => a instanceof Blob ? URL.createObjectURL(a) : t.url), [c, d] = C(!1), g = (() => {
3743
+ const { aspectRatio: i, localFile: a } = n, [l] = S(() => a instanceof Blob ? URL.createObjectURL(a) : t.url), [c, d] = S(!1), g = (() => {
3744
3744
  if (!(!r || e === "failed"))
3745
3745
  return () => r == null ? void 0 : r({ ...t, url: l });
3746
3746
  })(), f = {
@@ -4087,7 +4087,7 @@ const Kc = h.div`text-align:center;text-wrap:pretty;word-break:break-word;paddin
4087
4087
  label: n,
4088
4088
  selected: r
4089
4089
  }) => {
4090
- const [s, i] = C(!1), a = s ? /* @__PURE__ */ o.createElement(sd, { value: e, selected: r, label: n }) : /* @__PURE__ */ o.createElement(hd, { $selected: r, "aria-label": n, src: t, onError: () => i(!0) });
4090
+ const [s, i] = S(!1), a = s ? /* @__PURE__ */ o.createElement(sd, { value: e, selected: r, label: n }) : /* @__PURE__ */ o.createElement(hd, { $selected: r, "aria-label": n, src: t, onError: () => i(!0) });
4091
4091
  return /* @__PURE__ */ o.createElement(gd, null, a);
4092
4092
  }, dd = h.div`display:flex;flex-direction:column;gap:8px;`, ud = h.div`display:flex;justify-content:space-between;align-self:center;width:100%;max-width:400px;gap:16px;`, md = 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:${m.themedColor.textHighEmphasis};}`, gd = h.div`button:hover:not(:disabled) &{border-radius:4px;cursor:pointer;background-color:${m.color.background200};${F.dark`
4093
4093
  background-color: ${m.color.background500};
@@ -4313,7 +4313,7 @@ const je = () => {
4313
4313
  }
4314
4314
  ));
4315
4315
  }, Md = h.div`display:flex;gap:16px;margin:16px ${V.HORIZONTAL_PADDING}px 0;align-self:stretch;`, Od = h.div`width:${({ width: e }) => e}px;background-color:${m.themedColor.textDisabled};border-radius:100px;flex-shrink:0;`, Ld = h(w)`margin-top:5px;`, an = ({ start: e, title: t, titleAlign: n = "start", end: r }) => {
4316
- const s = B(null), i = B(null), [a, l] = C(0), [c, d] = C(0);
4316
+ const s = B(null), i = B(null), [a, l] = S(0), [c, d] = S(0);
4317
4317
  return se(() => {
4318
4318
  s.current && l(s.current.offsetWidth), i.current && d(i.current.offsetWidth);
4319
4319
  }, [e, r]), /* @__PURE__ */ o.createElement(Dd, null, /* @__PURE__ */ o.createElement(Rd, null, n === "center" && t && /* @__PURE__ */ o.createElement(Nd, { $sideWidth: Math.max(a, c) }, /* @__PURE__ */ o.createElement(Bd, null, t)), /* @__PURE__ */ o.createElement(Fd, null, /* @__PURE__ */ o.createElement(Pd, { ref: s }, e), (n === "start" || n === "end") && t && /* @__PURE__ */ o.createElement(Hd, { $align: n, $hasStart: !!e, $hasEnd: !!r }, t), /* @__PURE__ */ o.createElement(Ud, { ref: i }, r))));
@@ -4449,19 +4449,19 @@ const Jd = ({ onScrollAfterSendMessage: e }) => {
4449
4449
  shouldUpdate: !1
4450
4450
  };
4451
4451
  function nu({ scrollMode: e, children: t }) {
4452
- const n = B(null), r = B(null), s = B(Yn), i = B(!1), a = B(null), l = B(0), c = B(0), d = B(!1), [g, f] = C(0), [b, v] = C(0), [_, E] = C(!1), [u, p] = C(!1), x = ae(
4452
+ const n = B(null), r = B(null), s = B(Yn), i = B(!1), a = B(null), l = B(0), c = B(0), d = B(!1), [g, f] = S(0), [b, v] = S(0), [_, E] = S(!1), [u, p] = S(!1), x = ae(
4453
4453
  () => _ ? "auto" : e,
4454
4454
  [_, e]
4455
4455
  ), y = () => {
4456
4456
  s.current.contentSnapshotHeight = s.current.contentHeight, s.current.shouldUpdate = !0, s.current.shouldRecalc = !0;
4457
4457
  }, k = () => {
4458
- const S = n.current;
4459
- !S || !s.current.shouldUpdate || f(($) => {
4458
+ const C = n.current;
4459
+ !C || !s.current.shouldUpdate || f(($) => {
4460
4460
  s.current.shouldUpdate = !1;
4461
- const { contentHeight: U, contentSnapshotHeight: K, shouldRecalc: te } = s.current, ne = S.clientHeight;
4461
+ const { contentHeight: U, contentSnapshotHeight: K, shouldRecalc: te } = s.current, ne = C.clientHeight;
4462
4462
  if (K > U)
4463
4463
  return $;
4464
- const pe = T(S, { messageType: "outgoing" });
4464
+ const pe = T(C, { messageType: "outgoing" });
4465
4465
  let ue = 0;
4466
4466
  if (pe) {
4467
4467
  const me = pe.message.offsetTop - Lt + ne;
@@ -4473,13 +4473,13 @@ function nu({ scrollMode: e, children: t }) {
4473
4473
  return $ === 0 || ue !== $ || te ? (s.current.shouldRecalc = !1, ue) : $;
4474
4474
  });
4475
4475
  }, T = L(
4476
- (S, $) => {
4477
- const { messageType: U = "all" } = $ ?? {}, K = Array.from(S.querySelectorAll(`#${ce}-message-item`));
4476
+ (C, $) => {
4477
+ const { messageType: U = "all" } = $ ?? {}, K = Array.from(C.querySelectorAll(`#${ce}-message-item`));
4478
4478
  let te = K;
4479
4479
  U === "outgoing" && (te = K.filter((At) => At.getAttribute("data-layout-id") === "outgoingmessage"));
4480
4480
  const ne = te[te.length - 1];
4481
4481
  if (!ne) return null;
4482
- const pe = S.getBoundingClientRect(), ue = ne.getBoundingClientRect(), me = S.scrollTop + (ue.top - pe.top), Ye = me + ne.offsetHeight;
4482
+ const pe = C.getBoundingClientRect(), ue = ne.getBoundingClientRect(), me = C.scrollTop + (ue.top - pe.top), Ye = me + ne.offsetHeight;
4483
4483
  return {
4484
4484
  message: ne,
4485
4485
  scrollTop: me,
@@ -4488,59 +4488,59 @@ function nu({ scrollMode: e, children: t }) {
4488
4488
  },
4489
4489
  []
4490
4490
  ), D = L(() => {
4491
- const S = n.current;
4492
- if (!S || x !== "fixed") return;
4493
- const $ = T(S);
4494
- s.current.contentHeight = ($ == null ? void 0 : $.lastMessageBottom) ?? S.scrollHeight, !i.current && s.current.contentSnapshotHeight > 0 && y();
4495
- const U = Math.max(0, S.scrollHeight - S.scrollTop - S.clientHeight);
4491
+ const C = n.current;
4492
+ if (!C || x !== "fixed") return;
4493
+ const $ = T(C);
4494
+ s.current.contentHeight = ($ == null ? void 0 : $.lastMessageBottom) ?? C.scrollHeight, !i.current && s.current.contentSnapshotHeight > 0 && y();
4495
+ const U = Math.max(0, C.scrollHeight - C.scrollTop - C.clientHeight);
4496
4496
  v(U), k();
4497
4497
  }, [x, T]), M = L(() => {
4498
4498
  r.current && (r.current.disconnect(), r.current = null), s.current = Yn, f(0), v(0);
4499
- }, []), O = L((S = !0) => {
4499
+ }, []), O = L((C = !0) => {
4500
4500
  d.current = !1, Ga(() => {
4501
4501
  const $ = n.current;
4502
4502
  $ && $.scrollTo({
4503
4503
  top: $.scrollHeight,
4504
- behavior: S ? "smooth" : "auto"
4504
+ behavior: C ? "smooth" : "auto"
4505
4505
  });
4506
4506
  });
4507
4507
  }, []), N = L(
4508
- (S) => {
4509
- S && (n.current = S, x === "fixed" && (M(), s.current.viewport = S.clientHeight, r.current = new MutationObserver(() => {
4508
+ (C) => {
4509
+ C && (n.current = C, x === "fixed" && (M(), s.current.viewport = C.clientHeight, r.current = new MutationObserver(() => {
4510
4510
  D();
4511
- }), r.current.observe(S, {
4511
+ }), r.current.observe(C, {
4512
4512
  childList: !0,
4513
4513
  subtree: !0
4514
4514
  })));
4515
4515
  },
4516
4516
  [x, D, M]
4517
4517
  ), j = L(() => {
4518
- const S = n.current;
4519
- if (!S) return;
4520
- const $ = T(S, { messageType: "outgoing" });
4521
- $ && (S.scrollTo({
4518
+ const C = n.current;
4519
+ if (!C) return;
4520
+ const $ = T(C, { messageType: "outgoing" });
4521
+ $ && (C.scrollTo({
4522
4522
  top: $.message.offsetTop - Lt,
4523
4523
  behavior: "smooth"
4524
4524
  }), a.current && clearTimeout(a.current), a.current = setTimeout(() => {
4525
4525
  p(!1);
4526
4526
  }, 500));
4527
- }, [T]), q = (S) => {
4528
- const { scrollHeight: $, scrollTop: U, clientHeight: K } = S.currentTarget, te = Math.max(0, $ - U - K), ne = c.current, pe = te <= gt, ue = U < ne, me = U > ne;
4527
+ }, [T]), q = (C) => {
4528
+ const { scrollHeight: $, scrollTop: U, clientHeight: K } = C.currentTarget, te = Math.max(0, $ - U - K), ne = c.current, pe = te <= gt, ue = U < ne, me = U > ne;
4529
4529
  ue && !pe && (d.current = !0), me && pe && (d.current = !1), c.current = U, l.current = te, v(te);
4530
4530
  }, Se = L(() => {
4531
4531
  x === "fixed" && (p(!0), y());
4532
4532
  }, [x]), Te = L(() => {
4533
4533
  x === "fixed" ? setTimeout(() => j(), 300) : O();
4534
4534
  }, [x, j]), Le = L(
4535
- (S) => {
4536
- i.current = S, x === "fixed" ? y() : d.current || O();
4535
+ (C) => {
4536
+ i.current = C, x === "fixed" ? y() : d.current || O();
4537
4537
  },
4538
4538
  [x, O]
4539
- ), Z = L((S) => {
4540
- E(S), S && (f(0), r.current && (r.current.disconnect(), r.current = null));
4539
+ ), Z = L((C) => {
4540
+ E(C), C && (f(0), r.current && (r.current.disconnect(), r.current = null));
4541
4541
  }, []), le = L(
4542
- (S) => {
4543
- x === "auto" && S && !d.current && O();
4542
+ (C) => {
4543
+ x === "auto" && C && !d.current && O();
4544
4544
  },
4545
4545
  [x, O]
4546
4546
  ), A = !(b <= gt) && !u, he = L(() => l.current > gt, []);
@@ -4982,7 +4982,7 @@ const Fu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
4982
4982
  e.TALK_TO_AGENT
4983
4983
  ));
4984
4984
  }, dm = h.div`display:flex;justify-content:center;margin-bottom:16px;`, um = h(w)`border-radius:6px;box-sizing:border-box;padding:10px 20px;border:1px solid ${m.themedColor.textDisabled};cursor:pointer;user-select:none;`, mm = () => {
4985
- const { Template: e } = on.useContext(), { Template: t } = Ve.useContext(), { Template: n } = sn.useContext(), [r, s] = C(null), [i, a] = C(null), { userSession: l, aiAgentInfo: c } = re(), { cache: d, agentPreviewConfigs: g, chatSDK: f, state: b } = Y(), { config: v } = X(), { stringSet: _, dateLocale: E } = W(), {
4985
+ const { Template: e } = on.useContext(), { Template: t } = Ve.useContext(), { Template: n } = sn.useContext(), [r, s] = S(null), [i, a] = S(null), { userSession: l, aiAgentInfo: c } = re(), { cache: d, agentPreviewConfigs: g, chatSDK: f, state: b } = Y(), { config: v } = X(), { stringSet: _, dateLocale: E } = W(), {
4986
4986
  conversation: u,
4987
4987
  channelSource: p,
4988
4988
  messageSource: x,
@@ -5053,7 +5053,7 @@ const Fu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
5053
5053
  }
5054
5054
  )),
5055
5055
  renderMessage: ({ message: A, index: he }) => {
5056
- const S = Qo(A), $ = M[he - 1], U = M[he + 1], K = M[M.length - 1], te = A === K, ne = Qe(A, c.userId), pe = !(c.isUserFeedbackEnabled && ne && !Ie.isWelcomeMessage(A)), ue = es(A, $, U, pe), me = !Wo(($ == null ? void 0 : $.createdAt) ?? 0, A.createdAt) && O(he) && !D, Ye = (st) => {
5056
+ const C = Qo(A), $ = M[he - 1], U = M[he + 1], K = M[M.length - 1], te = A === K, ne = Qe(A, c.userId), pe = !(c.isUserFeedbackEnabled && ne && !Ie.isWelcomeMessage(A)), ue = es(A, $, U, pe), me = !Wo(($ == null ? void 0 : $.createdAt) ?? 0, A.createdAt) && O(he) && !D, Ye = (st) => {
5057
5057
  (A.isFileMessage() || A.isUserMessage()) && s({ file: st, sender: Se(A, A.sender.userId === c.userId) });
5058
5058
  }, At = () => {
5059
5059
  A.isFileMessage() && en(A.url);
@@ -5185,7 +5185,7 @@ const Fu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
5185
5185
  return /* @__PURE__ */ o.createElement(t, { messageType: "file", file: A, ...De });
5186
5186
  }
5187
5187
  })();
5188
- return /* @__PURE__ */ o.createElement("div", { key: S, id: `${ce}-message-item`, role: "listitem", "data-layout-id": io() }, so, ao);
5188
+ return /* @__PURE__ */ o.createElement("div", { key: C, id: `${ce}-message-item`, role: "listitem", "data-layout-id": io() }, so, ao);
5189
5189
  }
5190
5190
  }
5191
5191
  );
@@ -5234,7 +5234,7 @@ const Fu = h.div`width:${({ $size: e }) => e}px;height:${({ $size: e }) => e}px;
5234
5234
  )) : null;
5235
5235
  }, zt = h.div`display:flex;justify-content:center;align-items:center;`, Em = h(zt)`flex-direction:column;padding-block:16px;background-color:${m.themedColor.bg_100_500};gap:8px;`, Vr = We(void 0), xm = ({ children: e }) => {
5236
5236
  var E;
5237
- const { chatSDK: t } = Y(), { createAttachmentRules: n } = re(), { stringSet: r } = W(), { channelSource: s } = oe(), [i, a] = C([]), [l, c] = C({
5237
+ const { chatSDK: t } = Y(), { createAttachmentRules: n } = re(), { stringSet: r } = W(), { channelSource: s } = oe(), [i, a] = S([]), [l, c] = S({
5238
5238
  visible: !1,
5239
5239
  title: ""
5240
5240
  }), d = n({
@@ -5331,13 +5331,13 @@ const _m = (e, t) => {
5331
5331
  stroke: ${m.themedColor.bg_50_600};
5332
5332
  }
5333
5333
  `, Tm = () => {
5334
- const e = nt(), [t, n] = C(), { files: r, removeFile: s, isFileUploadEnabled: i } = mn();
5334
+ const e = nt(), [t, n] = S(), { files: r, removeFile: s, isFileUploadEnabled: i } = mn();
5335
5335
  return !i || r.length === 0 ? null : /* @__PURE__ */ o.createElement(ym, null, r.map(({ preview: { type: a, name: l, url: c } }, d) => /* @__PURE__ */ o.createElement(Cm, { key: c, onMouseOver: () => n(d), onMouseLeave: () => n(void 0) }, (e || t === d) && /* @__PURE__ */ o.createElement(Sm, { title: "Remove file", onClick: () => s(d) }, /* @__PURE__ */ o.createElement(H, { type: "close-filled", color: m.themedColor.textMidEmphasis })), a.startsWith("image/") ? /* @__PURE__ */ o.createElement("img", { alt: "file-image", src: c }) : /* @__PURE__ */ o.createElement(Jt, { name: l, type: qt(l, a) }))));
5336
5336
  }, zr = {
5337
5337
  textArea: I`min-height:40px;height:40px;font-size:16px;line-height:24px;`,
5338
5338
  attachIcon: I`margin-bottom:4px;`
5339
5339
  }, Wr = h.button`all:unset;cursor:pointer;display:flex;align-items:center;justify-content:center;width:32px;height:32px;`, Am = h(Wr)`flex-shrink:0;margin-inline-end:12px;margin-bottom:2px;&:disabled{cursor:not-allowed;}&:not(:disabled){&:hover{path{fill:${m.themedColor.textHighEmphasis};}}&:active{border-radius:4px;background-color:${m.themedColor.bg_200_400};}}${ln && zr.attachIcon};`, wm = h.input`display:none;`, Xn = h.div`width:100%;position:relative;background-color:${({ theme: e }) => e.colors.messageInput.background};border-radius:20px;`, Jn = h.div`display:flex;flex-direction:row;align-items:flex-end;position:relative;`, Qn = 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:${({ theme: e }) => e.colors.messageInput.text};resize:none;width:100%;height:${Ar}px;overflow-wrap:break-word;white-space:pre-wrap;overflow-x:hidden;${ln && zr.textArea};&::placeholder{color:${({ theme: e }) => e.colors.messageInput.placeholderText};}&:disabled{cursor:not-allowed;&::placeholder{color:${m.themedColor.textDisabled};}}`, er = h.div`padding:12px 16px;position:relative;display:flex;align-items:center;`, tr = ({ disabled: e }) => {
5340
- const { stringSet: t } = W(), n = B(null), [r, s] = C(!1), { addFiles: i, clearFiles: a, files: l, isFileUploadEnabled: c, acceptableMimeTypes: d } = mn();
5340
+ const { stringSet: t } = W(), n = B(null), [r, s] = S(!1), { addFiles: i, clearFiles: a, files: l, isFileUploadEnabled: c, acceptableMimeTypes: d } = mn();
5341
5341
  return !c || l.length > 0 ? null : /* @__PURE__ */ o.createElement(
5342
5342
  Am,
5343
5343
  {
@@ -5379,7 +5379,7 @@ const _m = (e, t) => {
5379
5379
  )
5380
5380
  );
5381
5381
  }, Im = () => {
5382
- const e = B(null), [t, n] = C(""), { stringSet: r } = W(), { rootElement: s } = Y(), { channelSource: i, messageSource: a, state: l } = oe(), { files: c, addFiles: d, clearFiles: g } = mn(), f = l.input.disabled, b = (() => {
5382
+ const e = B(null), [t, n] = S(""), { stringSet: r } = W(), { rootElement: s } = Y(), { channelSource: i, messageSource: a, state: l } = oe(), { files: c, addFiles: d, clearFiles: g } = mn(), f = l.input.disabled, b = (() => {
5383
5383
  if (!f) return r.MESSAGE_INPUT__PLACE_HOLDER;
5384
5384
  switch (l.input.disabledBy) {
5385
5385
  case "form_active":
@@ -5442,8 +5442,8 @@ const _m = (e, t) => {
5442
5442
  color: ${m.color.information.main};
5443
5443
  `};
5444
5444
  }
5445
- `, $m = R(() => import("./TXpETEfV.js").then((e) => ({ default: e.MarkdownText }))), Mm = () => {
5446
- const { aiAgentInfo: e, userSession: t } = re(), { messageSource: n, channelSource: r } = oe(), [s, i] = C(null), a = Xt("special-notice", r.channel), l = L(() => r.channel ? a ? n.messages.some((c) => Qe(c, (t == null ? void 0 : t.userId) ?? "")) : !0 : null, [r.channel, a, n.messages, t == null ? void 0 : t.userId]);
5445
+ `, $m = R(() => import("./DfmanMje.js").then((e) => ({ default: e.MarkdownText }))), Mm = () => {
5446
+ const { aiAgentInfo: e, userSession: t } = re(), { messageSource: n, channelSource: r } = oe(), [s, i] = S(null), a = Xt("special-notice", r.channel), l = L(() => r.channel ? a ? n.messages.some((c) => Qe(c, (t == null ? void 0 : t.userId) ?? "")) : !0 : null, [r.channel, a, n.messages, t == null ? void 0 : t.userId]);
5447
5447
  return P(() => {
5448
5448
  s || i(l());
5449
5449
  }, [l, s]), s || !e.specialNotice ? null : /* @__PURE__ */ o.createElement(km, null, /* @__PURE__ */ o.createElement($m, null, e.specialNotice));
@@ -5768,7 +5768,7 @@ const Eg = {
5768
5768
  Provider: vg,
5769
5769
  useContext: pn
5770
5770
  } = ee("PageChildren"), Kr = ({ children: e }) => {
5771
- const [t, n] = C(null), [r, s] = C(null);
5771
+ const [t, n] = S(null), [r, s] = S(null);
5772
5772
  return /* @__PURE__ */ o.createElement(
5773
5773
  vg,
5774
5774
  {
@@ -5896,7 +5896,7 @@ const Og = sr`0%{transform:translateY(40px);opacity:0;}100%{transform:translateY
5896
5896
  ` : I`z-index:1;pointer-events:none;`}
5897
5897
  `;
5898
5898
  function ht({ initialId: e, children: t }) {
5899
- const [n, r] = C([e]), s = n[n.length - 1], i = L((u, p) => {
5899
+ const [n, r] = S([e]), s = n[n.length - 1], i = L((u, p) => {
5900
5900
  r((x) => [...x, u]), f((x) => ({ ...x, [u]: !0 })), p != null && p.reset && E((x) => ({
5901
5901
  ...x,
5902
5902
  [u]: (x[u] || 0) + 1
@@ -5937,17 +5937,17 @@ function ht({ initialId: e, children: t }) {
5937
5937
  const { id: x, lazy: y, children: k } = p.props;
5938
5938
  u[x] = { lazy: y, element: typeof k == "function" ? k(l) : k };
5939
5939
  }), u;
5940
- }, [c, l]), [g, f] = C(() => {
5940
+ }, [c, l]), [g, f] = S(() => {
5941
5941
  const u = {};
5942
5942
  return Object.entries(d).forEach(([p, { lazy: x }]) => {
5943
5943
  x === !1 && (u[p] = !0);
5944
5944
  }), u[e] = !0, u;
5945
- }), [b, v] = C(() => {
5945
+ }), [b, v] = S(() => {
5946
5946
  const u = {};
5947
5947
  return Object.keys(d).forEach((p) => {
5948
5948
  p === e ? u[p] = "entered" : u[p] = "exited";
5949
5949
  }), u;
5950
- }), [_, E] = C({});
5950
+ }), [_, E] = S({});
5951
5951
  return /* @__PURE__ */ o.createElement(Qr.Provider, { value: l }, /* @__PURE__ */ o.createElement(Pg, null, Object.keys(d).map((u) => {
5952
5952
  var k;
5953
5953
  if (!g[u]) return null;
@@ -6003,7 +6003,7 @@ function Hg({ isExpanded: e, isOpened: t, children: n, launcher: r }) {
6003
6003
  return /* @__PURE__ */ o.createElement(Vg, null, /* @__PURE__ */ o.createElement(zg, { dir: s, id: de.WINDOW, $isExpanded: e, $isOpened: t }, n), r);
6004
6004
  }
6005
6005
  const Vg = h.div`display:flex;flex-direction:column;gap:8px;align-items:flex-end;`, zg = 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 && Gg};${({ $isExpanded: e }) => e && Wg};`, Wg = I`width:743px;height:723px;`, Gg = I`z-index:${Ne.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;`, yh = Ge(function({ children: e, initialChannelUrl: t, ...n }, r) {
6006
- const s = nt(), [i, a] = C(t), l = s ? Yr : Hg;
6006
+ const s = nt(), [i, a] = S(t), l = s ? Yr : Hg;
6007
6007
  return /* @__PURE__ */ o.createElement(qr, { enableExpandButton: !s, ref: r, ...n }, /* @__PURE__ */ o.createElement(Tr, null, ({ state: c }) => /* @__PURE__ */ o.createElement(Kr, null, /* @__PURE__ */ o.createElement(l, { isExpanded: c.expanded, isOpened: c.opened, launcher: /* @__PURE__ */ o.createElement(Jr, null) }, /* @__PURE__ */ o.createElement(
6008
6008
  no,
6009
6009
  {
@@ -6069,7 +6069,7 @@ const Zg = h.div`background:${({ theme: e }) => e.colors.base.background};displa
6069
6069
  ${({ $isOpened: e }) => e && Jg};
6070
6070
  ${({ $isExpanded: e }) => e && Xg};
6071
6071
  `, Xg = I`width:743px;height:723px;`, Jg = I`z-index:${Ne.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;`, oo = { top: 24, bottom: 24, start: 24, end: 24 }, Qg = Ge(function({ children: e, initialChannelUrl: t, ...n }, r) {
6072
- const [s, i] = C(t), [a, l] = C("end-bottom"), [c, d] = C(oo), [g, f] = C(48), b = nt(), v = b ? Yr : Yg, { horizontal: _, vertical: E } = ae(() => {
6072
+ const [s, i] = S(t), [a, l] = S("end-bottom"), [c, d] = S(oo), [g, f] = S(48), b = nt(), v = b ? Yr : Yg, { horizontal: _, vertical: E } = ae(() => {
6073
6073
  const [u, p] = a.split("-");
6074
6074
  return { horizontal: u === "start" ? "start" : "end", vertical: p === "top" ? "top" : "bottom" };
6075
6075
  }, [a]);
@@ -6112,7 +6112,7 @@ const Zg = h.div`background:${({ theme: e }) => e.colors.base.background};displa
6112
6112
  ConversationChildren: th,
6113
6113
  ConversationListChildren: nh
6114
6114
  }), Sh = (e) => {
6115
- const { refreshActiveChannel: t } = re(), [n, r] = C(!1), s = B(null), i = B(null);
6115
+ const { refreshActiveChannel: t } = re(), [n, r] = S(!1), s = B(null), i = B(null);
6116
6116
  return P(() => {
6117
6117
  n && t().then(() => {
6118
6118
  var a;