@eloquentai/chat-sdk 0.35.0-dev.6 → 0.35.1-dev.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.
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use client";
2
- import { L as Ct, c as Xe, u as St, g as rt, X as It, i as zt, A as Et, d as W, e as je, f as Rt, h as Pt, r as Tt, t as Mt, j as Ot, N as Ye, k as Oe, l as At, H as Ut, w as nt, m as jt, s as Dt, n as $t, o as Bt, E as Nt, p as Lt, S as Zt, C as Kt, T as Ht } from "./skeleton-Bjh-b-YT.js";
2
+ import { L as Ct, c as Xe, u as St, g as rt, X as It, i as zt, A as Et, d as W, e as je, f as Rt, h as Pt, r as Tt, t as Mt, j as Ot, N as Ye, k as Oe, l as At, H as Ut, w as nt, m as jt, s as Dt, n as $t, o as Bt, E as Nt, p as Lt, S as Zt, C as Kt, T as Ht } from "./skeleton-CaZqIWNc.js";
3
3
  import { jsx as q, jsxs as ze, Fragment as at } from "react/jsx-runtime";
4
- import { useState as C, useEffect as K, useMemo as Fe, useCallback as v, useRef as Z } from "react";
4
+ import { useState as _, useEffect as K, useMemo as Fe, useCallback as v, useRef as Z } from "react";
5
5
  import { createPortal as Je } from "react-dom";
6
6
  import Vt from "react-dom/client";
7
7
  try {
8
8
  let t = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}, e = new t.Error().stack;
9
- e && (t._sentryDebugIds = t._sentryDebugIds || {}, t._sentryDebugIds[e] = "cac8a06c-1fa8-454e-89a9-c247b981a306", t._sentryDebugIdIdentifier = "sentry-dbid-cac8a06c-1fa8-454e-89a9-c247b981a306");
9
+ e && (t._sentryDebugIds = t._sentryDebugIds || {}, t._sentryDebugIds[e] = "388c4d1d-fab2-4ce6-b5b0-89b7d5c4008b", t._sentryDebugIdIdentifier = "sentry-dbid-388c4d1d-fab2-4ce6-b5b0-89b7d5c4008b");
10
10
  } catch {
11
11
  }
12
12
  if (typeof window < "u") {
@@ -53,7 +53,7 @@ function Ft({
53
53
  ) });
54
54
  }
55
55
  function Ze({ children: t, head: e, ...o }) {
56
- const [r, n] = C(null), i = r?.contentWindow?.document?.head, d = r?.contentWindow?.document?.body;
56
+ const [r, n] = _(null), i = r?.contentWindow?.document?.head, d = r?.contentWindow?.document?.body;
57
57
  return /* @__PURE__ */ ze("iframe", { ...o, ref: n, children: [
58
58
  i && Je(e, i),
59
59
  d && Je(t, d)
@@ -69,21 +69,21 @@ function Gt({
69
69
  onMessageClick: r,
70
70
  autoHideDelay: n
71
71
  }) {
72
- const [i, d] = C(!1), [s, c] = C("entering"), a = St();
72
+ const [i, d] = _(!1), [s, c] = _("entering"), a = St();
73
73
  return K(() => {
74
74
  if (e) {
75
75
  d(!0), c("entering");
76
76
  const l = setTimeout(() => {
77
77
  c("visible");
78
78
  }, 50);
79
- let f;
79
+ let h;
80
80
  const u = setTimeout(() => {
81
- c("exiting"), f = setTimeout(() => {
81
+ c("exiting"), h = setTimeout(() => {
82
82
  o();
83
83
  }, 300);
84
84
  }, n);
85
85
  return () => {
86
- clearTimeout(l), clearTimeout(u), clearTimeout(f);
86
+ clearTimeout(l), clearTimeout(u), clearTimeout(h);
87
87
  };
88
88
  } else {
89
89
  c("exiting");
@@ -256,20 +256,20 @@ function Qe({ appId: t }) {
256
256
  return console.error("Error checking conversation expiration:", a), !0;
257
257
  }
258
258
  }, [r]), i = v(
259
- (a, l, f, u, h) => {
259
+ (a, l, h, u, p) => {
260
260
  try {
261
261
  if (!_e) return;
262
- const p = {
262
+ const f = {
263
263
  conversationId: a,
264
264
  userId: l,
265
265
  deviceId: u,
266
- messages: ro(f),
266
+ messages: ro(h),
267
267
  lastActivity: Date.now(),
268
- chatToken: h
268
+ chatToken: p
269
269
  };
270
- localStorage.setItem(e, JSON.stringify(p));
271
- } catch (p) {
272
- console.error("Error saving conversation data to localStorage:", p);
270
+ localStorage.setItem(e, JSON.stringify(f));
271
+ } catch (f) {
272
+ console.error("Error saving conversation data to localStorage:", f);
273
273
  }
274
274
  },
275
275
  [e]
@@ -358,9 +358,9 @@ function po(t) {
358
358
  channel: r,
359
359
  onEvent: n,
360
360
  onDisconnect: i,
361
- createWebSocket: d = (l, f) => new WebSocket(l, f)
361
+ createWebSocket: d = (l, h) => new WebSocket(l, h)
362
362
  } = t, s = uo(e, o), c = co(e), a = crypto.randomUUID();
363
- return new Promise((l, f) => {
363
+ return new Promise((l, h) => {
364
364
  let u;
365
365
  try {
366
366
  u = d(c, [
@@ -368,32 +368,32 @@ function po(t) {
368
368
  ho(s)
369
369
  ]);
370
370
  } catch (w) {
371
- f(w instanceof Error ? w : new Error(String(w)));
371
+ h(w instanceof Error ? w : new Error(String(w)));
372
372
  return;
373
373
  }
374
- let h = "connecting", p = !1, g = io, k = Date.now(), b = null, I = null;
374
+ let p = "connecting", f = !1, g = io, k = Date.now(), b = null, I = null;
375
375
  const j = () => {
376
376
  b && (clearTimeout(b), b = null), I && (clearInterval(I), I = null);
377
- }, _ = (w) => {
378
- if (h === "closed") return;
379
- const y = h === "established";
380
- h = "closed", j();
377
+ }, C = (w) => {
378
+ if (p === "closed") return;
379
+ const y = p === "established";
380
+ p = "closed", j();
381
381
  try {
382
382
  u.close();
383
383
  } catch {
384
384
  }
385
- p || (y ? i(w) : f(new Error(w)));
385
+ f || (y ? i(w) : h(new Error(w)));
386
386
  }, z = (w) => {
387
387
  u.readyState === lo && u.send(JSON.stringify(w));
388
388
  }, E = (w) => {
389
389
  b && clearTimeout(b), b = setTimeout(() => {
390
- _(`Timed out waiting for ${w}`);
390
+ C(`Timed out waiting for ${w}`);
391
391
  }, ao);
392
392
  };
393
393
  u.addEventListener("open", () => {
394
- h !== "closed" && (z({ type: "connection_init" }), E("connection_ack"));
394
+ p !== "closed" && (z({ type: "connection_init" }), E("connection_ack"));
395
395
  }), u.addEventListener("message", (w) => {
396
- if (h === "closed") return;
396
+ if (p === "closed") return;
397
397
  let y;
398
398
  try {
399
399
  y = JSON.parse(String(w.data));
@@ -403,8 +403,8 @@ function po(t) {
403
403
  }
404
404
  switch (y.type) {
405
405
  case "connection_ack": {
406
- if (h !== "connecting") return;
407
- h = "subscribing", typeof y.connectionTimeoutMs == "number" && (g = y.connectionTimeoutMs), z({
406
+ if (p !== "connecting") return;
407
+ p = "subscribing", typeof y.connectionTimeoutMs == "number" && (g = y.connectionTimeoutMs), z({
408
408
  type: "subscribe",
409
409
  id: a,
410
410
  channel: r,
@@ -413,23 +413,23 @@ function po(t) {
413
413
  return;
414
414
  }
415
415
  case "connection_error": {
416
- _(`Connection error: ${Ke(y.errors)}`);
416
+ C(`Connection error: ${Ke(y.errors)}`);
417
417
  return;
418
418
  }
419
419
  case "subscribe_success": {
420
- if (h !== "subscribing" || y.id !== a) return;
421
- h = "established", b && (clearTimeout(b), b = null), k = Date.now(), I = setInterval(() => {
422
- Date.now() - k > g && _("Keep-alive timeout");
420
+ if (p !== "subscribing" || y.id !== a) return;
421
+ p = "established", b && (clearTimeout(b), b = null), k = Date.now(), I = setInterval(() => {
422
+ Date.now() - k > g && C("Keep-alive timeout");
423
423
  }, so), l({
424
424
  close: () => {
425
- p = !0, z({ type: "unsubscribe", id: a }), _("Closed by client");
425
+ f = !0, z({ type: "unsubscribe", id: a }), C("Closed by client");
426
426
  }
427
427
  });
428
428
  return;
429
429
  }
430
430
  case "subscribe_error": {
431
431
  if (y.id !== a) return;
432
- _(`Subscribe error: ${Ke(y.errors)}`);
432
+ C(`Subscribe error: ${Ke(y.errors)}`);
433
433
  return;
434
434
  }
435
435
  case "ka": {
@@ -463,9 +463,9 @@ function po(t) {
463
463
  return;
464
464
  }
465
465
  }), u.addEventListener("close", () => {
466
- _("WebSocket closed");
466
+ C("WebSocket closed");
467
467
  }), u.addEventListener("error", () => {
468
- _("WebSocket error");
468
+ C("WebSocket error");
469
469
  });
470
470
  });
471
471
  }
@@ -668,23 +668,23 @@ function zo(t) {
668
668
  function H(t, e, o, r) {
669
669
  const n = {};
670
670
  function i(u) {
671
- this.def = u, this.constr = f, this.traits = /* @__PURE__ */ new Set();
671
+ this.def = u, this.constr = h, this.traits = /* @__PURE__ */ new Set();
672
672
  }
673
673
  i.prototype = n;
674
674
  const d = o, s = d && /* @__PURE__ */ new WeakSet();
675
- function c(u, h) {
675
+ function c(u, p) {
676
676
  if (u._zod) {
677
677
  if (u._zod.traits.has(t))
678
678
  return;
679
679
  } else {
680
- Ve.value = new i(h);
680
+ Ve.value = new i(p);
681
681
  try {
682
682
  Object.defineProperty(u, "_zod", Ve);
683
683
  } finally {
684
684
  Ve.value = void 0;
685
685
  }
686
686
  }
687
- if (u._zod.traits.add(t), e(u, h), s) {
687
+ if (u._zod.traits.add(t), e(u, p), s) {
688
688
  const g = Object.getPrototypeOf(u), k = u._zod.constr.prototype;
689
689
  let b = g;
690
690
  for (; b && b !== k; )
@@ -692,29 +692,29 @@ function H(t, e, o, r) {
692
692
  const I = b ?? g;
693
693
  s.has(I) || (s.add(I), xo(I, d));
694
694
  }
695
- const p = f.prototype;
696
- for (const g in p)
697
- Object.prototype.hasOwnProperty.call(p, g) && (g in u || (u[g] = p[g].bind(u)));
695
+ const f = h.prototype;
696
+ for (const g in f)
697
+ Object.prototype.hasOwnProperty.call(f, g) && (g in u || (u[g] = f[g].bind(u)));
698
698
  }
699
699
  const a = r?.Parent ?? Object;
700
700
  class l extends a {
701
701
  }
702
702
  Object.defineProperty(l, "name", { value: t });
703
- function f(u) {
704
- const h = r?.Parent ? zo(l) : this;
705
- c(h, u);
706
- const p = h._zod.deferred;
707
- if (p) {
708
- for (const k of p)
703
+ function h(u) {
704
+ const p = r?.Parent ? zo(l) : this;
705
+ c(p, u);
706
+ const f = p._zod.deferred;
707
+ if (f) {
708
+ for (const k of f)
709
709
  k();
710
- h._zod.deferred = void 0;
710
+ p._zod.deferred = void 0;
711
711
  }
712
712
  const g = globalThis.__zod_globalConfig?.postProcessor;
713
- return g && g(h), h;
713
+ return g && g(p), p;
714
714
  }
715
- return Object.defineProperty(f, "init", { value: c }), Object.defineProperty(f, Symbol.hasInstance, {
715
+ return Object.defineProperty(h, "init", { value: c }), Object.defineProperty(h, Symbol.hasInstance, {
716
716
  value: (u) => r?.Parent && u instanceof r.Parent ? !0 : u?._zod?.traits?.has(t)
717
- }), Object.defineProperty(f, "name", { value: t }), f;
717
+ }), Object.defineProperty(h, "name", { value: t }), h;
718
718
  }
719
719
  class Ie extends Error {
720
720
  constructor() {
@@ -818,27 +818,27 @@ const $o = (t) => async (e, o, r) => {
818
818
  const i = (s, c, a) => {
819
819
  if (s.memo)
820
820
  return s;
821
- let l = be(s), f;
821
+ let l = be(s), h;
822
822
  for (const u of c) {
823
823
  if (u._zod.def.when) {
824
824
  if (yo(s) || !u._zod.def.when(s))
825
825
  continue;
826
826
  } else if (l)
827
827
  continue;
828
- const h = s.issues.length, p = u._zod.check(s);
829
- if (p instanceof Promise && a?.async === !1)
828
+ const p = s.issues.length, f = u._zod.check(s);
829
+ if (f instanceof Promise && a?.async === !1)
830
830
  throw new Ie();
831
- if (f || p instanceof Promise)
832
- f = (f ?? Promise.resolve()).then(async () => {
833
- await p, s.issues.length !== h && (lt(s.issues, h, t), l || (l = be(s, h)));
831
+ if (h || f instanceof Promise)
832
+ h = (h ?? Promise.resolve()).then(async () => {
833
+ await f, s.issues.length !== p && (lt(s.issues, p, t), l || (l = be(s, p)));
834
834
  });
835
835
  else {
836
- if (s.issues.length === h)
836
+ if (s.issues.length === p)
837
837
  continue;
838
- lt(s.issues, h, t), l || (l = be(s, h));
838
+ lt(s.issues, p, t), l || (l = be(s, p));
839
839
  }
840
840
  }
841
- return f ? f.then(() => s) : s;
841
+ return h ? h.then(() => s) : s;
842
842
  }, d = (s, c, a) => {
843
843
  if (be(s))
844
844
  return s.aborted = !0, s;
@@ -846,7 +846,7 @@ const $o = (t) => async (e, o, r) => {
846
846
  if (l instanceof Promise) {
847
847
  if (a.async === !1)
848
848
  throw new Ie();
849
- return l.then((f) => t._zod.parse(f, a));
849
+ return l.then((h) => t._zod.parse(h, a));
850
850
  }
851
851
  return t._zod.parse(l, a);
852
852
  };
@@ -855,7 +855,7 @@ const $o = (t) => async (e, o, r) => {
855
855
  return t._zod.parse(s, c);
856
856
  if (c.direction === "backward") {
857
857
  const l = t._zod.parse({ value: s.value, issues: [] }, { ...c, skipChecks: !0 });
858
- return l instanceof Promise ? l.then((f) => d(f, s, c)) : d(l, s, c);
858
+ return l instanceof Promise ? l.then((h) => d(h, s, c)) : d(l, s, c);
859
859
  }
860
860
  const a = t._zod.parse(s, c);
861
861
  if (a instanceof Promise) {
@@ -958,26 +958,26 @@ function Go(t) {
958
958
  };
959
959
  }
960
960
  function Xo(t, e, o, r, n, i, d) {
961
- const s = [], c = n.keySet, a = n.catchall._zod, l = a.def.type, f = a.optin, u = a.optout;
962
- let h = 0;
963
- for (const p in e) {
964
- if (d && o.issues.length !== h) {
965
- if (be(o, h))
961
+ const s = [], c = n.keySet, a = n.catchall._zod, l = a.def.type, h = a.optin, u = a.optout;
962
+ let p = 0;
963
+ for (const f in e) {
964
+ if (d && o.issues.length !== p) {
965
+ if (be(o, p))
966
966
  break;
967
- h = o.issues.length;
967
+ p = o.issues.length;
968
968
  }
969
- if (c.has(p))
969
+ if (c.has(f))
970
970
  continue;
971
- if (p === "__proto__") {
972
- l === "never" && s.push(p);
971
+ if (f === "__proto__") {
972
+ l === "never" && s.push(f);
973
973
  continue;
974
974
  }
975
975
  if (l === "never") {
976
- s.push(p);
976
+ s.push(f);
977
977
  continue;
978
978
  }
979
- const g = a.run({ value: e[p], issues: [] }, r);
980
- g instanceof Promise ? t.push(g.then((k) => Ue(k, o, p, e, f, u))) : Ue(g, o, p, e, f, u);
979
+ const g = a.run({ value: e[f], issues: [] }, r);
980
+ g instanceof Promise ? t.push(g.then((k) => Ue(k, o, f, e, h, u))) : Ue(g, o, f, e, h, u);
981
981
  }
982
982
  return s.length && o.issues.push({
983
983
  code: "unrecognized_keys",
@@ -1000,46 +1000,46 @@ const Yo = /* @__PURE__ */ H("$ZodObject", (t, e) => {
1000
1000
  }
1001
1001
  const n = mo(() => Go(e));
1002
1002
  he(t, "propValues", (a) => {
1003
- const l = a.def.shape, f = {};
1003
+ const l = a.def.shape, h = {};
1004
1004
  for (const u in l) {
1005
- const h = l[u]._zod;
1006
- if (h.values) {
1007
- Object.prototype.hasOwnProperty.call(f, u) || bo(f, u, /* @__PURE__ */ new Set());
1008
- for (const p of h.values)
1009
- f[u].add(p);
1010
- h.optin !== void 0 && f[u].add(void 0);
1005
+ const p = l[u]._zod;
1006
+ if (p.values) {
1007
+ Object.prototype.hasOwnProperty.call(h, u) || bo(h, u, /* @__PURE__ */ new Set());
1008
+ for (const f of p.values)
1009
+ h[u].add(f);
1010
+ p.optin !== void 0 && h[u].add(void 0);
1011
1011
  }
1012
1012
  }
1013
- return f;
1013
+ return h;
1014
1014
  });
1015
1015
  const i = Ge, d = e.catchall;
1016
1016
  let s;
1017
1017
  const c = Ae.memoizer;
1018
1018
  c?.attach(t), t._zod.parse = (a, l) => {
1019
1019
  s ?? (s = n.value);
1020
- const f = a.value;
1021
- if (!i(f))
1020
+ const h = a.value;
1021
+ if (!i(h))
1022
1022
  return a.issues.push({
1023
1023
  expected: "object",
1024
1024
  code: "invalid_type",
1025
- input: f,
1025
+ input: h,
1026
1026
  inst: t
1027
1027
  }), a;
1028
1028
  a.value = c ? c.alloc(t, a, {}, l) : {};
1029
- const u = [], h = s.shape, p = l?.abortEarly;
1029
+ const u = [], p = s.shape, f = l?.abortEarly;
1030
1030
  let g = a.issues.length;
1031
1031
  for (const k of s.allKeys) {
1032
- if (p && a.issues.length !== g) {
1032
+ if (f && a.issues.length !== g) {
1033
1033
  if (be(a, g))
1034
1034
  break;
1035
1035
  g = a.issues.length;
1036
1036
  }
1037
1037
  if (k === "__proto__")
1038
1038
  continue;
1039
- const b = h[k], I = b._zod.optin, j = b._zod.optout, _ = b._zod.run({ value: f[k], issues: [] }, l);
1040
- _ instanceof Promise ? u.push(_.then((z) => Ue(z, a, k, f, I, j))) : Ue(_, a, k, f, I, j);
1039
+ const b = p[k], I = b._zod.optin, j = b._zod.optout, C = b._zod.run({ value: h[k], issues: [] }, l);
1040
+ C instanceof Promise ? u.push(C.then((z) => Ue(z, a, k, h, I, j))) : Ue(C, a, k, h, I, j);
1041
1041
  }
1042
- return d ? Xo(u, f, a, l, n.value, t, p === !0) : u.length ? Promise.all(u).then(() => a) : a;
1042
+ return d ? Xo(u, h, a, l, n.value, t, f === !0) : u.length ? Promise.all(u).then(() => a) : a;
1043
1043
  };
1044
1044
  });
1045
1045
  function ht(t, e, o, r) {
@@ -1105,27 +1105,27 @@ const Qo = /* @__PURE__ */ H("$ZodUnion", (t, e) => {
1105
1105
  if (typeof l == "string" || typeof l == "number" || typeof l == "symbol") {
1106
1106
  if (c.add(typeof l == "number" ? l.toString() : l), l === "__proto__")
1107
1107
  continue;
1108
- const f = e.keyType._zod.run({ value: l, issues: [] }, n);
1109
- if (f instanceof Promise)
1108
+ const h = e.keyType._zod.run({ value: l, issues: [] }, n);
1109
+ if (h instanceof Promise)
1110
1110
  throw new Error("Async schemas not supported in object keys currently");
1111
- if (f.issues.length) {
1111
+ if (h.issues.length) {
1112
1112
  r.issues.push({
1113
1113
  code: "invalid_key",
1114
1114
  origin: "record",
1115
- issues: f.issues.map((p) => we(p, n, fe())),
1115
+ issues: h.issues.map((f) => we(f, n, fe())),
1116
1116
  input: l,
1117
1117
  path: [l],
1118
1118
  inst: t
1119
1119
  });
1120
1120
  continue;
1121
1121
  }
1122
- const u = f.value;
1122
+ const u = h.value;
1123
1123
  if (u === "__proto__")
1124
1124
  continue;
1125
- const h = e.valueType._zod.run({ value: i[l], issues: [] }, n);
1126
- h instanceof Promise ? d.push(h.then((p) => {
1127
- p.issues.length && r.issues.push(...Se(l, p.issues)), r.value[u] = p.value;
1128
- })) : (h.issues.length && r.issues.push(...Se(l, h.issues)), r.value[u] = h.value);
1125
+ const p = e.valueType._zod.run({ value: i[l], issues: [] }, n);
1126
+ p instanceof Promise ? d.push(p.then((f) => {
1127
+ f.issues.length && r.issues.push(...Se(l, f.issues)), r.value[u] = f.value;
1128
+ })) : (p.issues.length && r.issues.push(...Se(l, p.issues)), r.value[u] = p.value);
1129
1129
  }
1130
1130
  let a;
1131
1131
  for (const l in i)
@@ -1153,16 +1153,16 @@ const Qo = /* @__PURE__ */ H("$ZodUnion", (t, e) => {
1153
1153
  if (l instanceof Promise)
1154
1154
  throw new Error("Async schemas not supported in object keys currently");
1155
1155
  if (typeof a == "string" && Lo.test(a) && l.issues.length) {
1156
- const p = e.keyType._zod.run({ value: Number(a), issues: [] }, n);
1157
- if (p instanceof Promise)
1156
+ const f = e.keyType._zod.run({ value: Number(a), issues: [] }, n);
1157
+ if (f instanceof Promise)
1158
1158
  throw new Error("Async schemas not supported in object keys currently");
1159
- p.issues.length === 0 && (l = p);
1159
+ f.issues.length === 0 && (l = f);
1160
1160
  }
1161
1161
  if (l.issues.length) {
1162
1162
  e.mode === "loose" ? r.value[a] = i[a] : s ? (c = c ?? [], c.push(a)) : r.issues.push({
1163
1163
  code: "invalid_key",
1164
1164
  origin: "record",
1165
- issues: l.issues.map((p) => we(p, n, fe())),
1165
+ issues: l.issues.map((f) => we(f, n, fe())),
1166
1166
  input: a,
1167
1167
  path: [a],
1168
1168
  inst: t
@@ -1172,10 +1172,10 @@ const Qo = /* @__PURE__ */ H("$ZodUnion", (t, e) => {
1172
1172
  const u = l.value;
1173
1173
  if (u === "__proto__")
1174
1174
  continue;
1175
- const h = e.valueType._zod.run({ value: i[a], issues: [] }, n);
1176
- h instanceof Promise ? d.push(h.then((p) => {
1177
- p.issues.length && r.issues.push(...Se(a, p.issues)), r.value[u] = p.value;
1178
- })) : (h.issues.length && r.issues.push(...Se(a, h.issues)), r.value[u] = h.value);
1175
+ const p = e.valueType._zod.run({ value: i[a], issues: [] }, n);
1176
+ p instanceof Promise ? d.push(p.then((f) => {
1177
+ f.issues.length && r.issues.push(...Se(a, f.issues)), r.value[u] = f.value;
1178
+ })) : (p.issues.length && r.issues.push(...Se(a, p.issues)), r.value[u] = p.value);
1179
1179
  }
1180
1180
  c && c.length > 0 && r.issues.push({
1181
1181
  code: "unrecognized_keys",
@@ -1440,10 +1440,10 @@ function Lr({
1440
1440
  onAgentCapturedUrl: c,
1441
1441
  onAgentTopic: a,
1442
1442
  onAgentSummary: l,
1443
- onRatingRequest: f,
1443
+ onRatingRequest: h,
1444
1444
  onBreadcrumb: u,
1445
- fetchHistory: h,
1446
- getChatToken: p,
1445
+ fetchHistory: p,
1446
+ getChatToken: f,
1447
1447
  backupPollingInterval: g = Nr
1448
1448
  }) {
1449
1449
  const k = Z(/* @__PURE__ */ new Set());
@@ -1451,12 +1451,12 @@ function Lr({
1451
1451
  for (const N of o)
1452
1452
  N.id && k.current.add(N.id);
1453
1453
  }, [o]);
1454
- const b = Z(null), I = Z(null), j = Z(0), _ = Z(null), z = Z(null), E = Z(!1), w = Z(!1), y = W(r), M = W(n), oe = W(i), F = W(d), Y = W(s), Q = W(c), O = W(a), L = W(l), D = W(f), P = W(u), ee = W(h), re = W(p), { publishError: J } = je(), ae = t?.app_sync_url, G = t?.app_sync_api_key, m = !!(ae && G), x = W(ae), S = W(G), A = v(() => {
1454
+ const b = Z(null), I = Z(null), j = Z(0), C = Z(null), z = Z(null), E = Z(!1), w = Z(!1), y = W(r), M = W(n), oe = W(i), F = W(d), Y = W(s), Q = W(c), O = W(a), L = W(l), D = W(h), P = W(u), ee = W(p), re = W(f), { publishError: J } = je(), ae = t?.app_sync_url, G = t?.app_sync_api_key, m = !!(ae && G), x = W(ae), S = W(G), A = v(() => {
1455
1455
  b.current && (b.current.close(), b.current = null);
1456
1456
  }, []), $ = v(() => {
1457
1457
  z.current && (clearInterval(z.current), z.current = null);
1458
1458
  }, []), T = v(() => {
1459
- _.current && (clearTimeout(_.current), _.current = null);
1459
+ C.current && (clearTimeout(C.current), C.current = null);
1460
1460
  }, []), B = Z(() => {
1461
1461
  }), V = v(
1462
1462
  async (N) => {
@@ -1590,7 +1590,7 @@ function Lr({
1590
1590
  [$, ie, g]
1591
1591
  ), ce = v(
1592
1592
  function N() {
1593
- if (!E.current || w.current || _.current)
1593
+ if (!E.current || w.current || C.current)
1594
1594
  return;
1595
1595
  const ne = I.current;
1596
1596
  if (!ne) return;
@@ -1598,8 +1598,8 @@ function Lr({
1598
1598
  $r * Math.pow(2, j.current),
1599
1599
  Br
1600
1600
  );
1601
- j.current += 1, _.current = setTimeout(async () => {
1602
- _.current = null, w.current = !0;
1601
+ j.current += 1, C.current = setTimeout(async () => {
1602
+ C.current = null, w.current = !0;
1603
1603
  try {
1604
1604
  await V(ne), j.current = 0, w.current = !1, await ie(ne);
1605
1605
  } catch {
@@ -1713,13 +1713,13 @@ function Xr({
1713
1713
  messages: c,
1714
1714
  setMessages: a,
1715
1715
  currentChat: l,
1716
- setCurrentChat: f,
1716
+ setCurrentChat: h,
1717
1717
  onChatClosed: u,
1718
- isChatClosed: h
1718
+ isChatClosed: p
1719
1719
  }) {
1720
- const { saveChatData: p, clearChatData: g, updateLastActivity: k, markChatClosed: b } = Qe({
1720
+ const { saveChatData: f, clearChatData: g, updateLastActivity: k, markChatClosed: b } = Qe({
1721
1721
  appId: t
1722
- }), { publishApiError: I, publishNetworkError: j } = je(), { showCognition: _, hideCognition: z } = Pt(), E = W(d), w = v(
1722
+ }), { publishApiError: I, publishNetworkError: j } = je(), { showCognition: C, hideCognition: z } = Pt(), E = W(d), w = v(
1723
1723
  (m, x) => {
1724
1724
  m.response.content && a((S) => {
1725
1725
  if (S.some((T) => T.isRatingRequest) || s?.welcome_message && m.response.content === s.welcome_message)
@@ -1728,7 +1728,7 @@ function Xr({
1728
1728
  ...S.filter((T) => !T.isThinking),
1729
1729
  Zr(m)
1730
1730
  ];
1731
- return p(
1731
+ return f(
1732
1732
  x,
1733
1733
  e,
1734
1734
  $,
@@ -1737,7 +1737,7 @@ function Xr({
1737
1737
  ), $;
1738
1738
  });
1739
1739
  },
1740
- [s, i, p, a, e, E]
1740
+ [s, i, f, a, e, E]
1741
1741
  ), y = v(() => {
1742
1742
  z(), a((m) => m.filter((x) => !x.isThinking));
1743
1743
  }, [a, z]), M = v(() => {
@@ -1755,7 +1755,7 @@ function Xr({
1755
1755
  chatId: l?.id ?? null,
1756
1756
  messages: c,
1757
1757
  onMessage: w,
1758
- onCognition: _,
1758
+ onCognition: C,
1759
1759
  onCognitionComplete: z,
1760
1760
  onError: y,
1761
1761
  onChatClosed: Y,
@@ -1766,7 +1766,7 @@ function Xr({
1766
1766
  }), D = v(() => {
1767
1767
  z(), O(), L(), Tt(c), a(
1768
1768
  (m) => m.filter((x) => Array.isArray(x) ? !1 : x.isWelcomeMessage)
1769
- ), g(), f(null);
1769
+ ), g(), h(null);
1770
1770
  }, [
1771
1771
  z,
1772
1772
  O,
@@ -1774,7 +1774,7 @@ function Xr({
1774
1774
  c,
1775
1775
  g,
1776
1776
  a,
1777
- f
1777
+ h
1778
1778
  ]), P = v(
1779
1779
  (m, x) => a((S) => Fr(S, m, x)),
1780
1780
  [a]
@@ -1789,7 +1789,7 @@ function Xr({
1789
1789
  searchParams: eo()
1790
1790
  }
1791
1791
  });
1792
- f({ id: x.chat_id });
1792
+ h({ id: x.chat_id });
1793
1793
  try {
1794
1794
  await Q(x.chat_id);
1795
1795
  } catch (S) {
@@ -1800,7 +1800,7 @@ function Xr({
1800
1800
  }
1801
1801
  return x.chat_id;
1802
1802
  },
1803
- [n, e, i, o, r, f, Q]
1803
+ [n, e, i, o, r, h, Q]
1804
1804
  ), re = v(
1805
1805
  (m, x, S, A) => Promise.all(
1806
1806
  S.map(
@@ -1831,7 +1831,7 @@ function Xr({
1831
1831
  }
1832
1832
  I(m), m instanceof Oe && // A 401 means an expired or closed chat token: drop the session so
1833
1833
  // the next send starts a fresh one, as for a client-side expiry.
1834
- (m.status >= 500 || m.status === 401) ? (f(null), g(), a((T) => T.filter((B) => B.id !== S)), x.reset()) : $();
1834
+ (m.status >= 500 || m.status === 401) ? (h(null), g(), a((T) => T.filter((B) => B.id !== S)), x.reset()) : $();
1835
1835
  },
1836
1836
  [
1837
1837
  z,
@@ -1839,18 +1839,18 @@ function Xr({
1839
1839
  P,
1840
1840
  j,
1841
1841
  I,
1842
- f,
1842
+ h,
1843
1843
  g
1844
1844
  ]
1845
1845
  ), ae = v(
1846
1846
  async (m, x = []) => {
1847
1847
  if (!d || c.some((A) => A.isRatingRequest)) return;
1848
- if (h) {
1848
+ if (p) {
1849
1849
  a((A) => [...A, Vr()]);
1850
1850
  return;
1851
1851
  }
1852
1852
  const S = Wr(m, x);
1853
- _(), a([...c, S]), k();
1853
+ a([...c, S]), k();
1854
1854
  try {
1855
1855
  const A = l?.id || await ee(d), $ = await re(
1856
1856
  d,
@@ -1888,9 +1888,8 @@ function Xr({
1888
1888
  [
1889
1889
  d,
1890
1890
  c,
1891
- h,
1891
+ p,
1892
1892
  a,
1893
- _,
1894
1893
  k,
1895
1894
  l?.id,
1896
1895
  ee,
@@ -2059,32 +2058,32 @@ async function ft(t, e = {}) {
2059
2058
  }
2060
2059
  const Te = /* @__PURE__ */ new Map(), Me = /* @__PURE__ */ new Map();
2061
2060
  function ln(t, e, o) {
2062
- const r = o?.dedupe !== !1, [n, i] = C(
2061
+ const r = o?.dedupe !== !1, [n, i] = _(
2063
2062
  () => Te.get(t)
2064
- ), { publishApiError: d, publishNetworkError: s } = je(), [c, a] = C(void 0), [l, f] = C(!1), u = Z(!0);
2063
+ ), { publishApiError: d, publishNetworkError: s } = je(), [c, a] = _(void 0), [l, h] = _(!1), u = Z(!0);
2065
2064
  Z(() => (u.current = !0, () => {
2066
2065
  u.current = !1;
2067
2066
  }));
2068
- const h = v(async () => {
2067
+ const p = v(async () => {
2069
2068
  if (Te.has(t)) {
2070
- const p = Te.get(t);
2071
- return i(p), p;
2069
+ const f = Te.get(t);
2070
+ return i(f), f;
2072
2071
  }
2073
- f(!0), a(void 0);
2072
+ h(!0), a(void 0);
2074
2073
  try {
2075
2074
  if (r && Me.has(t))
2076
2075
  return await Me.get(t);
2077
- const p = e();
2078
- r && Me.set(t, p);
2079
- const g = await p;
2076
+ const f = e();
2077
+ r && Me.set(t, f);
2078
+ const g = await f;
2080
2079
  return Te.set(t, g), u.current && i(g), g;
2081
- } catch (p) {
2082
- throw p instanceof Ye || p instanceof Oe && p.status === 403 ? s() : d(p), u.current && a(p), p;
2080
+ } catch (f) {
2081
+ throw f instanceof Ye || f instanceof Oe && f.status === 403 ? s() : d(f), u.current && a(f), f;
2083
2082
  } finally {
2084
- Me.delete(t), u.current && f(!1);
2083
+ Me.delete(t), u.current && h(!1);
2085
2084
  }
2086
2085
  }, [t, r, e, d, s]);
2087
- return { data: n, error: c, isLoading: l, fetch: h };
2086
+ return { data: n, error: c, isLoading: l, fetch: p };
2088
2087
  }
2089
2088
  function gt(t, e) {
2090
2089
  const o = t?.deviceId || crypto.randomUUID();
@@ -2095,9 +2094,9 @@ function gt(t, e) {
2095
2094
  } : e ? { userId: e, externalId: e, deviceId: o } : { userId: crypto.randomUUID(), externalId: null, deviceId: o };
2096
2095
  }
2097
2096
  function cn(t) {
2098
- const { appId: e, initialUserId: o } = t, { getSavedChatData: r } = Qe({ appId: e }), [n, i] = C(
2097
+ const { appId: e, initialUserId: o } = t, { getSavedChatData: r } = Qe({ appId: e }), [n, i] = _(
2099
2098
  () => gt(r(), o)
2100
- ), [d, s] = C(o);
2099
+ ), [d, s] = _(o);
2101
2100
  return d !== o && (s(o), i(gt(r(), o))), {
2102
2101
  // Identity is available synchronously; kept in the contract because
2103
2102
  // consumers (SDK boot) still key off it.
@@ -2119,14 +2118,14 @@ function dn({
2119
2118
  externalId: d,
2120
2119
  deviceId: s,
2121
2120
  isReady: c
2122
- } = cn({ appId: e, initialUserId: o }), { isChatExpired: a, clearChatData: l, getSavedChatData: f } = Qe({
2121
+ } = cn({ appId: e, initialUserId: o }), { isChatExpired: a, clearChatData: l, getSavedChatData: h } = Qe({
2123
2122
  appId: e
2124
- }), { current: u } = Z(t || tn()), [h] = C(
2123
+ }), { current: u } = Z(t || tn()), [p] = _(
2125
2124
  new rn({
2126
2125
  baseURL: u,
2127
2126
  appId: e
2128
2127
  })
2129
- ), [p, g] = C(null), [k, b] = C(null), [I, j] = C([]), [_, z] = C(!1), [E, w] = C(!1), [y, M] = C(!0), F = ln(`sdk-boot-${e}`, () => h.boot()).fetch;
2128
+ ), [f, g] = _(null), [k, b] = _(null), [I, j] = _([]), [C, z] = _(!1), [E, w] = _(!1), [y, M] = _(!0), F = ln(`sdk-boot-${e}`, () => p.boot()).fetch;
2130
2129
  K(() => {
2131
2130
  if (a())
2132
2131
  l();
@@ -2137,24 +2136,24 @@ function dn({
2137
2136
  messages: L,
2138
2137
  isChatClosed: D,
2139
2138
  chatToken: P
2140
- } = f();
2139
+ } = h();
2141
2140
  Q && O && (b({
2142
2141
  id: Q
2143
- }), h.setChatToken(P ?? null), L && L.length > 0 && j(L), D && w(!0));
2142
+ }), p.setChatToken(P ?? null), L && L.length > 0 && j(L), D && w(!0));
2144
2143
  }
2145
- }, [f, a, l, h]);
2144
+ }, [h, a, l, p]);
2146
2145
  const Y = Z(!1);
2147
2146
  return K(() => {
2148
2147
  if (Y.current) return;
2149
2148
  Y.current = !0, (async () => {
2150
2149
  const [O, L] = await nt(
2151
- ft(() => h.getOrganizationByAppId(e))
2150
+ ft(() => p.getOrganizationByAppId(e))
2152
2151
  );
2153
2152
  if (L) {
2154
2153
  console.error("Failed to fetch organization data:", L), M(!1), z(!0);
2155
2154
  return;
2156
2155
  }
2157
- h.setRegion(O.region);
2156
+ p.setRegion(O.region);
2158
2157
  const [D, P] = await nt(ft(F));
2159
2158
  if (P) {
2160
2159
  M(!1), z(!0);
@@ -2164,24 +2163,24 @@ function dn({
2164
2163
  conversationId: ee,
2165
2164
  userId: re,
2166
2165
  messages: J
2167
- } = f();
2166
+ } = h();
2168
2167
  ee && re && J.some(jt) && j(
2169
- await Dt(h, ee, J)
2168
+ await Dt(p, ee, J)
2170
2169
  );
2171
2170
  const ae = D.chat_settings.welcome_message;
2172
2171
  g(D.chat_settings), M(D.chat_settings.is_active ?? !0), ae && j((G) => G.length > 0 || G.some((m) => m.isWelcomeMessage) ? G : [Kr(ae)]), z(!0);
2173
2172
  })();
2174
- }, [c, h, e, F, f]), {
2173
+ }, [c, p, e, F, h]), {
2175
2174
  userId: i,
2176
2175
  userName: r,
2177
2176
  userData: n,
2178
2177
  externalId: d,
2179
2178
  deviceId: s,
2180
- apiClient: h,
2181
- chatSettings: p,
2179
+ apiClient: p,
2180
+ chatSettings: f,
2182
2181
  currentChat: k,
2183
2182
  messages: I,
2184
- isReady: _,
2183
+ isReady: C,
2185
2184
  isChatClosed: E,
2186
2185
  isChatActive: y
2187
2186
  };
@@ -2191,7 +2190,7 @@ function un() {
2191
2190
  return typeof window > "u" ? !1 : window.matchMedia(yt).matches;
2192
2191
  }
2193
2192
  function hn(t) {
2194
- const [e, o] = C(un), [r, n] = C(
2193
+ const [e, o] = _(un), [r, n] = _(
2195
2194
  null
2196
2195
  ), i = t ?? e, d = typeof window > "u";
2197
2196
  return K(() => {
@@ -2226,16 +2225,16 @@ function gn({
2226
2225
  hasCloseButton: a,
2227
2226
  hasCleanChatButton: l,
2228
2227
  // Deprecated aliases, kept until hosts migrate to the is/has names above.
2229
- initialOpen: f,
2228
+ initialOpen: h,
2230
2229
  closeButton: u,
2231
- cleanChatButton: h,
2232
- proactiveMessageHideDelay: p = 5e3,
2230
+ cleanChatButton: p,
2231
+ proactiveMessageHideDelay: f = 5e3,
2233
2232
  isAlwaysOpen: g = !1,
2234
2233
  hasCleanChatButtonOverride: k
2235
2234
  }) {
2236
2235
  const { isMobile: b, portalContainer: I } = hn(s), {
2237
2236
  userId: j,
2238
- externalId: _,
2237
+ externalId: C,
2239
2238
  deviceId: z,
2240
2239
  apiClient: E,
2241
2240
  chatSettings: w,
@@ -2250,7 +2249,7 @@ function gn({
2250
2249
  initialUserId: r,
2251
2250
  userName: n,
2252
2251
  userData: i
2253
- }), Q = Qt({ chatProps: d, chatSettings: w }), O = c ?? f ?? !1, L = a ?? u ?? !0, D = l ?? h ?? !0, P = fn(o), [ee, re] = C(() => g ? !0 : it(P) === "true" || b ? !1 : O ?? b), [J, ae] = C(!1);
2252
+ }), Q = Qt({ chatProps: d, chatSettings: w }), O = c ?? h ?? !1, L = a ?? u ?? !0, D = l ?? p ?? !0, P = fn(o), [ee, re] = _(() => g ? !0 : it(P) === "true" || b ? !1 : O ?? b), [J, ae] = _(!1);
2254
2253
  K(() => {
2255
2254
  if (!oe || J || (ae(!0), g)) return;
2256
2255
  const ue = w?.initial_open;
@@ -2263,7 +2262,7 @@ function gn({
2263
2262
  P,
2264
2263
  g
2265
2264
  ]);
2266
- const G = w?.initial_open ?? O, m = w?.close_button ?? L, x = k ?? w?.clean_chat_button ?? D, S = w?.proactive_message_hide_delay ?? p, A = v(
2265
+ const G = w?.initial_open ?? O, m = w?.close_button ?? L, x = k ?? w?.clean_chat_button ?? D, S = w?.proactive_message_hide_delay ?? f, A = v(
2267
2266
  (ue) => {
2268
2267
  g || re((Pe) => {
2269
2268
  const ot = typeof ue == "function" ? ue(Pe) : ue;
@@ -2271,17 +2270,17 @@ function gn({
2271
2270
  });
2272
2271
  },
2273
2272
  [P, g]
2274
- ), $ = $t(ee, 400), [T, B] = C(
2273
+ ), $ = $t(ee, 400), [T, B] = _(
2275
2274
  d?.messages ?? []
2276
- ), [V, ie] = C(y), [ye, ce] = C(!1), [me, ke] = C(M);
2275
+ ), [V, ie] = _(y), [ye, ce] = _(!1), [me, ke] = _(M);
2277
2276
  me !== M && (ke(M), M.length > 0 && B(M));
2278
- const [$e, N] = C(y);
2277
+ const [$e, N] = _(y);
2279
2278
  $e !== y && (N(y), y && ie(y));
2280
- const [ne, te] = C(F);
2279
+ const [ne, te] = _(F);
2281
2280
  ne !== F && (te(F), F && ce(!0));
2282
2281
  const Re = v(() => {
2283
2282
  ce(!0);
2284
- }, []), [Be, Ne] = C(!1), xe = oe && w?.auto_display_welcome_message && w?.welcome_message ? w.welcome_message : "", de = {
2283
+ }, []), [Be, Ne] = _(!1), xe = oe && w?.auto_display_welcome_message && w?.welcome_message ? w.welcome_message : "", de = {
2285
2284
  text: xe,
2286
2285
  isVisible: xe !== "" && !Be,
2287
2286
  autoHideDelay: S
@@ -2290,7 +2289,7 @@ function gn({
2290
2289
  userId: j,
2291
2290
  userName: n,
2292
2291
  userData: i,
2293
- externalId: _,
2292
+ externalId: C,
2294
2293
  deviceId: z,
2295
2294
  apiClient: E,
2296
2295
  chatSettings: w,
@@ -2308,18 +2307,18 @@ function gn({
2308
2307
  }, [y]);
2309
2308
  const tt = Z(null);
2310
2309
  K(() => {
2311
- if (!V || !_ || !E) return;
2310
+ if (!V || !C || !E) return;
2312
2311
  const ue = {
2313
2312
  userId: j,
2314
2313
  userName: n,
2315
2314
  userData: i,
2316
- externalId: _,
2315
+ externalId: C,
2317
2316
  deviceId: z,
2318
2317
  conversationId: V.id
2319
2318
  }, Pe = JSON.stringify(ue);
2320
2319
  tt.current !== Pe && (tt.current = Pe, E.identifyUser(ue));
2321
2320
  }, [
2322
- _,
2321
+ C,
2323
2322
  j,
2324
2323
  n,
2325
2324
  i,
@@ -2356,7 +2355,7 @@ function gn({
2356
2355
  };
2357
2356
  }
2358
2357
  function mn(t) {
2359
- const [e, o] = C(0);
2358
+ const [e, o] = _(0);
2360
2359
  return K(() => {
2361
2360
  const r = window.visualViewport;
2362
2361
  if (!t || !r) {
@@ -2388,13 +2387,15 @@ function bn(t) {
2388
2387
  }, [t]);
2389
2388
  }
2390
2389
  function vn() {
2391
- const [t, e] = C(!1), [o, r] = C(null), n = Z(null), i = Z(null), d = v((c = "...") => {
2392
- const a = () => {
2393
- r(c), e(!0), i.current = null, n.current && clearTimeout(n.current), n.current = setTimeout(() => {
2394
- n.current = null, i.current && a();
2390
+ const [t, e] = _(!1), [o, r] = _(null), n = Z(null), i = Z(null), d = v((c) => {
2391
+ const a = (l) => {
2392
+ r(l), e(!0), i.current = null, n.current && clearTimeout(n.current), n.current = setTimeout(() => {
2393
+ n.current = null;
2394
+ const h = i.current;
2395
+ h && a(h);
2395
2396
  }, 1e3);
2396
2397
  };
2397
- n.current ? i.current = c : a();
2398
+ n.current ? i.current = c : a(c);
2398
2399
  }, []), s = v(() => {
2399
2400
  n.current && (clearTimeout(n.current), n.current = null), i.current = null, e(!1), r(null);
2400
2401
  }, []);
@@ -2412,7 +2413,7 @@ function wn({
2412
2413
  return /* @__PURE__ */ q(Bt.Provider, { value: e, children: t });
2413
2414
  }
2414
2415
  const qn = ({ children: t }) => {
2415
- const [e, o] = C(null), [r, n] = C(!1), i = Lt(o), a = {
2416
+ const [e, o] = _(null), [r, n] = _(!1), i = Lt(o), a = {
2416
2417
  error: e,
2417
2418
  hideSdk: r,
2418
2419
  publishApiError: i,
@@ -2435,16 +2436,16 @@ function xn({
2435
2436
  isInitiallyOpen: a,
2436
2437
  // Deprecated aliases, resolved in useChat (new name wins).
2437
2438
  closeButton: l,
2438
- cleanChatButton: f,
2439
+ cleanChatButton: h,
2439
2440
  initialOpen: u,
2440
- INTERNAL_ONLY_CHAT_INTERFACE_ONLY: h = !1,
2441
- INTERNAL_ONLY_SHOW_CLEAN_CHAT_BUTTON: p = void 0,
2441
+ INTERNAL_ONLY_CHAT_INTERFACE_ONLY: p = !1,
2442
+ INTERNAL_ONLY_SHOW_CLEAN_CHAT_BUTTON: f = void 0,
2442
2443
  INTERNAL_ONLY_BLOCK_STYLE: g = !1,
2443
2444
  INTERNAL_ONLY_FEATURE_MESSAGE_CLICK: k = void 0,
2444
2445
  INTERNAL_ONLY_FEATURE_CLEAR_CHAT_CLICK: b = void 0,
2445
2446
  INTERNAL_ONLY_ON_CHAT_ID: I = void 0,
2446
2447
  INTERNAL_ONLY_HIGHLIGHTED_MESSAGE_ID: j = null,
2447
- INTERNAL_ONLY_ON_MESSAGE_SENT: _ = void 0,
2448
+ INTERNAL_ONLY_ON_MESSAGE_SENT: C = void 0,
2448
2449
  INTERNAL_ONLY_SHOW_COPY_BUTTON: z = !1,
2449
2450
  INTERNAL_ONLY_ENVIRONMENT: E = "live",
2450
2451
  INTERNAL_ONLY_API_URL: w
@@ -2483,12 +2484,12 @@ function xn({
2483
2484
  hasCleanChatButton: c,
2484
2485
  initialOpen: u,
2485
2486
  closeButton: l,
2486
- cleanChatButton: f,
2487
+ cleanChatButton: h,
2487
2488
  proactiveMessageHideDelay: i,
2488
2489
  // Embedded: the interface is the page content with no launcher to reopen
2489
2490
  // it, so nothing (boot initial_open, closed-cookie, props) may close it.
2490
- isAlwaysOpen: h,
2491
- hasCleanChatButtonOverride: p
2491
+ isAlwaysOpen: p,
2492
+ hasCleanChatButtonOverride: f
2492
2493
  }), T = Z(void 0);
2493
2494
  K(() => {
2494
2495
  !I || T.current === L || (T.current = L, I(L));
@@ -2496,7 +2497,7 @@ function xn({
2496
2497
  const B = mn(O && D);
2497
2498
  bn(O && D);
2498
2499
  const V = !M;
2499
- if (y || V && !h || !V && !oe) return null;
2500
+ if (y || V && !p || !V && !oe) return null;
2500
2501
  const ie = () => /* @__PURE__ */ ze(
2501
2502
  "div",
2502
2503
  {
@@ -2566,12 +2567,12 @@ function xn({
2566
2567
  Kt,
2567
2568
  {
2568
2569
  ...P,
2569
- hasIntroAnimation: !h,
2570
+ hasIntroAnimation: !p,
2570
2571
  isTestMode: E === "test",
2571
2572
  isOpen: D,
2572
2573
  keyboardInset: B,
2573
2574
  messages: re,
2574
- onSendMessage: (ce, me) => (_?.(ce), ae(ce, me)),
2575
+ onSendMessage: (ce, me) => (C?.(ce), ae(ce, me)),
2575
2576
  onMessageClick: k,
2576
2577
  highlightedMessageId: j,
2577
2578
  isMobile: O,
@@ -2589,7 +2590,7 @@ function xn({
2589
2590
  )
2590
2591
  }
2591
2592
  ),
2592
- !h && /* @__PURE__ */ q(
2593
+ !p && /* @__PURE__ */ q(
2593
2594
  Ze,
2594
2595
  {
2595
2596
  className: "eloquentai-chat-launcher",