@flowengage/react-chatbot 5.0.55 → 5.0.56

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.
@@ -28832,39 +28832,53 @@ function $(...e) {
28832
28832
  function WO(e) {
28833
28833
  return new Promise((t) => setTimeout(t, e));
28834
28834
  }
28835
- var GO = "#flowengage-root, .flowengage-shell, .flowengage-widget-root";
28836
- function KO(e) {
28835
+ function GO(e = 10) {
28836
+ if (typeof document > "u") return [];
28837
+ try {
28838
+ let t = /* @__PURE__ */ new Set(), n = [], r = document.querySelectorAll("h1, h2, h3");
28839
+ for (let i of r) {
28840
+ if (qO(i)) continue;
28841
+ let r = (i.textContent || "").trim().replace(/\s+/g, " ");
28842
+ if (!(!r || r.length < 3 || r.length > 120) && !t.has(r.toLowerCase()) && (t.add(r.toLowerCase()), n.push(r), n.length >= e)) break;
28843
+ }
28844
+ return n;
28845
+ } catch {
28846
+ return [];
28847
+ }
28848
+ }
28849
+ var KO = "#flowengage-root, .flowengage-shell, .flowengage-widget-root";
28850
+ function qO(e) {
28837
28851
  if (!e || typeof e.closest != "function") return !1;
28838
28852
  try {
28839
- return !!e.closest(GO);
28853
+ return !!e.closest(KO);
28840
28854
  } catch {
28841
28855
  return !1;
28842
28856
  }
28843
28857
  }
28844
- function qO(e) {
28858
+ function JO(e) {
28845
28859
  try {
28846
28860
  let t = e.ownerDocument?.defaultView;
28847
28861
  if (t) return t.getComputedStyle(e);
28848
28862
  } catch {}
28849
28863
  return window.getComputedStyle(e);
28850
28864
  }
28851
- function JO(e) {
28865
+ function YO(e) {
28852
28866
  let t = /* @__PURE__ */ new Set();
28853
28867
  function n(r) {
28854
28868
  if (!r || t.has(r)) return;
28855
28869
  t.add(r), e(r);
28856
28870
  let i = r.querySelectorAll("iframe");
28857
- for (let e of i) if (!KO(e)) try {
28871
+ for (let e of i) if (!qO(e)) try {
28858
28872
  let t = e.contentDocument;
28859
28873
  t && n(t);
28860
28874
  } catch {}
28861
28875
  }
28862
28876
  typeof document < "u" && n(document);
28863
28877
  }
28864
- function YO(e) {
28878
+ function XO(e) {
28865
28879
  return e == null ? null : String(e).replace(/\u00a0/g, " ").replace(/\s*\*+\s*$/u, "").replace(/\s+/g, " ").trim();
28866
28880
  }
28867
- function XO(e) {
28881
+ function ZO(e) {
28868
28882
  let t = e.ownerDocument || document, n = e.getAttribute("aria-labelledby");
28869
28883
  if (n) {
28870
28884
  let e = n.trim().split(/\s+/).filter(Boolean), r = [];
@@ -28872,42 +28886,42 @@ function XO(e) {
28872
28886
  let e = t.getElementById(n);
28873
28887
  e?.textContent && r.push(e.textContent.trim());
28874
28888
  } catch {}
28875
- if (r.length) return YO(r.join(" "));
28889
+ if (r.length) return XO(r.join(" "));
28876
28890
  }
28877
- if (e.labels && e.labels.length) return YO(e.labels[0].textContent);
28891
+ if (e.labels && e.labels.length) return XO(e.labels[0].textContent);
28878
28892
  let r = e.id;
28879
28893
  if (r) try {
28880
28894
  let e = t.querySelector(`label[for="${CSS.escape(r)}"]`);
28881
- if (e) return YO(e.textContent);
28895
+ if (e) return XO(e.textContent);
28882
28896
  } catch {
28883
28897
  let e = t.querySelector(`label[for="${r.replace(/"/g, "\\\"")}"]`);
28884
- if (e) return YO(e.textContent);
28898
+ if (e) return XO(e.textContent);
28885
28899
  }
28886
28900
  let i = e.previousElementSibling;
28887
28901
  for (let e = 0; e < 6 && i; e += 1) {
28888
- if (i.tagName === "LABEL") return YO(i.textContent);
28902
+ if (i.tagName === "LABEL") return XO(i.textContent);
28889
28903
  let e = (i.className || "").toString().toLowerCase();
28890
28904
  if (/chakra-form__label|formlabel|field-label|form-label|mui-form-label/.test(e)) {
28891
- let e = YO(i.textContent);
28905
+ let e = XO(i.textContent);
28892
28906
  if (e) return e;
28893
28907
  }
28894
28908
  i = i.previousElementSibling;
28895
28909
  }
28896
28910
  let a = e.parentElement;
28897
28911
  for (let e = 0; e < 5 && a; e += 1) {
28898
- if (a.tagName === "LABEL") return YO(a.textContent);
28912
+ if (a.tagName === "LABEL") return XO(a.textContent);
28899
28913
  let e = a.querySelector?.(":scope > label, :scope > [class*='FormLabel'], :scope > [class*='form__label']");
28900
- if (e?.textContent) return YO(e.textContent);
28914
+ if (e?.textContent) return XO(e.textContent);
28901
28915
  a = a.parentElement;
28902
28916
  }
28903
28917
  let o = e.getAttribute("aria-label");
28904
- return o ? YO(o) : null;
28918
+ return o ? XO(o) : null;
28905
28919
  }
28906
- function ZO() {
28920
+ function QO() {
28907
28921
  let e = [];
28908
- return JO((t) => {
28922
+ return YO((t) => {
28909
28923
  e.push(...Array.from(t.querySelectorAll("input, select, textarea")).filter((e) => {
28910
- if (KO(e)) return !1;
28924
+ if (qO(e)) return !1;
28911
28925
  let t = (e.type || "").toLowerCase();
28912
28926
  if ([
28913
28927
  "hidden",
@@ -28916,32 +28930,32 @@ function ZO() {
28916
28930
  "image"
28917
28931
  ].includes(t) || e.disabled || e.readOnly) return !1;
28918
28932
  try {
28919
- let t = qO(e);
28933
+ let t = JO(e);
28920
28934
  if (t.display === "none" || t.visibility === "hidden") return !1;
28921
28935
  } catch {}
28922
28936
  return !0;
28923
28937
  }));
28924
28938
  }), e;
28925
28939
  }
28926
- function QO() {
28927
- return ZO().map((e, t) => ({
28940
+ function $O() {
28941
+ return QO().map((e, t) => ({
28928
28942
  formIndex: 0,
28929
28943
  fieldIndex: t,
28930
28944
  tag: e.tagName,
28931
28945
  type: e.type || "text",
28932
28946
  name: e.name || null,
28933
28947
  id: e.id || null,
28934
- label: XO(e),
28948
+ label: ZO(e),
28935
28949
  placeholder: e.placeholder || null
28936
28950
  }));
28937
28951
  }
28938
- function $O() {
28952
+ function ek() {
28939
28953
  let e = [];
28940
- return JO((t) => {
28954
+ return YO((t) => {
28941
28955
  e.push(...Array.from(t.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
28942
- if (KO(e) || e.disabled) return !1;
28956
+ if (qO(e) || e.disabled) return !1;
28943
28957
  try {
28944
- let t = qO(e);
28958
+ let t = JO(e);
28945
28959
  if (t.display === "none" || t.visibility === "hidden") return !1;
28946
28960
  } catch {}
28947
28961
  return !0;
@@ -28953,15 +28967,15 @@ function $O() {
28953
28967
  type: e.type || e.tagName
28954
28968
  }));
28955
28969
  }
28956
- function ek(e) {
28970
+ function tk(e) {
28957
28971
  return String(e || "").toLowerCase().replace(/\u00a0/g, " ").replace(/\*/g, "").replace(/\s+/g, " ").trim();
28958
28972
  }
28959
- function tk(e) {
28960
- let t = ek(e);
28973
+ function nk(e) {
28974
+ let t = tk(e);
28961
28975
  return t = t.replace(/\s+field\s*$/i, "").trim(), t;
28962
28976
  }
28963
- function nk(e, t) {
28964
- let n = tk(t);
28977
+ function rk(e, t) {
28978
+ let n = nk(t);
28965
28979
  if (!n) return 0;
28966
28980
  let r = (e.name || "").toLowerCase(), i = (e.id || "").toLowerCase();
28967
28981
  if (r === "url" && /url|website|domain|site|audit/.test(n) || (i === "url-input" || i.endsWith("-url-input")) && /url|website|domain|site|audit/.test(n)) return 100;
@@ -28969,12 +28983,12 @@ function nk(e, t) {
28969
28983
  e.name,
28970
28984
  e.id,
28971
28985
  e.placeholder,
28972
- XO(e),
28986
+ ZO(e),
28973
28987
  e.getAttribute("aria-label"),
28974
28988
  e.getAttribute("title"),
28975
28989
  e.getAttribute("data-testid"),
28976
28990
  e.getAttribute("autocomplete")
28977
- ].filter(Boolean).map((e) => ek(e)), o = 0;
28991
+ ].filter(Boolean).map((e) => tk(e)), o = 0;
28978
28992
  for (let e of a) {
28979
28993
  if (!e) continue;
28980
28994
  if (e.includes(n) || n.includes(e)) {
@@ -28989,16 +29003,16 @@ function nk(e, t) {
28989
29003
  }
28990
29004
  return o;
28991
29005
  }
28992
- var rk = 28;
28993
- function ik(e, t) {
29006
+ var ik = 28;
29007
+ function ak(e, t) {
28994
29008
  let n = null, r = 0;
28995
29009
  for (let i of e) {
28996
- let e = nk(i, t);
29010
+ let e = rk(i, t);
28997
29011
  e > r && (r = e, n = i);
28998
29012
  }
28999
- return !n || r < rk ? null : n;
29013
+ return !n || r < ik ? null : n;
29000
29014
  }
29001
- function ak(e, t, n) {
29015
+ function ok(e, t, n) {
29002
29016
  let r = String(t || "").toLowerCase().trim(), i = String(n || "").trim();
29003
29017
  if (!(/^https?:\/\//i.test(i) || /\.\w{2,}(\/|\s|$)/.test(i) || r.includes("url") || r.includes("website") || r.includes("domain") || r.includes("site"))) return null;
29004
29018
  let a = null, o = 0;
@@ -29018,7 +29032,7 @@ function ak(e, t, n) {
29018
29032
  t.name,
29019
29033
  t.id,
29020
29034
  t.placeholder,
29021
- XO(t),
29035
+ ZO(t),
29022
29036
  t.getAttribute("aria-label"),
29023
29037
  t.getAttribute("autocomplete")
29024
29038
  ].filter(Boolean).join(" ").toLowerCase();
@@ -29026,15 +29040,15 @@ function ak(e, t, n) {
29026
29040
  }
29027
29041
  return !a || o < 42 ? null : a;
29028
29042
  }
29029
- function ok(e) {
29043
+ function sk(e) {
29030
29044
  let t = String(e ?? "").trim();
29031
29045
  return t ? /^https?:\/\//i.test(t) ? !0 : /\.\w{2,}(\/|\s|$)/.test(t) : !1;
29032
29046
  }
29033
- function sk(e) {
29047
+ function ck(e) {
29034
29048
  let t = String(e ?? "").toLowerCase().trim();
29035
29049
  return t ? !!(t === "url" || t === "website" || t === "website url" || t === "website_url" || t === "enter website url" || t.includes("website") || t.includes("domain") || /(enter\s+website|site\s*url|page\s*url)/.test(t)) : !1;
29036
29050
  }
29037
- function ck(e) {
29051
+ function lk(e) {
29038
29052
  if (!e || e.tagName !== "INPUT" && e.tagName !== "TEXTAREA") return !1;
29039
29053
  let t = (e.type || "").toLowerCase();
29040
29054
  return ![
@@ -29046,22 +29060,22 @@ function ck(e) {
29046
29060
  "file"
29047
29061
  ].includes(t);
29048
29062
  }
29049
- function lk(e) {
29050
- if (!ck(e)) return !1;
29063
+ function uk(e) {
29064
+ if (!lk(e)) return !1;
29051
29065
  let t = (e.name || "").toLowerCase(), n = (e.id || "").toLowerCase(), r = [
29052
29066
  e.name,
29053
29067
  e.id,
29054
29068
  e.placeholder,
29055
- XO(e),
29069
+ ZO(e),
29056
29070
  e.getAttribute("aria-label")
29057
29071
  ].filter(Boolean).join(" ").toLowerCase();
29058
29072
  return t === "url" || n === "url-input" || n.endsWith("-url-input") || /(website\s*url|enter\s+website|site\s*url)/.test(r) || /(website|domain)/.test(r) && /(url|site)/.test(r);
29059
29073
  }
29060
- function uk(e, t, n) {
29061
- let r = String(t ?? ""), i = String(n ?? ""), a = pk(e, r) || ik(e, r) || ak(e, r, i);
29074
+ function dk(e, t, n) {
29075
+ let r = String(t ?? ""), i = String(n ?? ""), a = mk(e, r) || ak(e, r) || ok(e, r, i);
29062
29076
  if (!a) return [];
29063
29077
  let o = new Set([a]);
29064
- if (ok(i) && sk(r)) for (let t of e) t !== a && lk(t) && o.add(t);
29078
+ if (sk(i) && ck(r)) for (let t of e) t !== a && uk(t) && o.add(t);
29065
29079
  let s = Array.from(o);
29066
29080
  return s.sort((e, t) => {
29067
29081
  if (e === t) return 0;
@@ -29069,7 +29083,7 @@ function uk(e, t, n) {
29069
29083
  return n & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : n & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
29070
29084
  }), s;
29071
29085
  }
29072
- function dk(e, t) {
29086
+ function fk(e, t) {
29073
29087
  try {
29074
29088
  if (!e?.getBoundingClientRect || !t?.getBoundingClientRect) return Infinity;
29075
29089
  let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = {
@@ -29084,17 +29098,17 @@ function dk(e, t) {
29084
29098
  return Infinity;
29085
29099
  }
29086
29100
  }
29087
- function fk(e) {
29101
+ function pk(e) {
29088
29102
  if (!e || typeof e != "string") return null;
29089
29103
  let t = null;
29090
- return JO((n) => {
29104
+ return YO((n) => {
29091
29105
  try {
29092
29106
  let r = n.getElementById(e);
29093
- r && !KO(r) && r.matches?.("input, select, textarea") && (t = r);
29107
+ r && !qO(r) && r.matches?.("input, select, textarea") && (t = r);
29094
29108
  } catch {}
29095
29109
  }), t;
29096
29110
  }
29097
- function pk(e, t) {
29111
+ function mk(e, t) {
29098
29112
  let n = String(t ?? "").trim();
29099
29113
  if (!n) return null;
29100
29114
  let r = n.match(/^name:\s*([\w.-]+)$/i);
@@ -29104,12 +29118,12 @@ function pk(e, t) {
29104
29118
  }
29105
29119
  let i = n.match(/^id:\s*([\w.-]+)$/i);
29106
29120
  if (i) {
29107
- let e = fk(i[1]);
29121
+ let e = pk(i[1]);
29108
29122
  if (e) return e;
29109
29123
  }
29110
29124
  let a = n.startsWith("#") ? n.slice(1) : n;
29111
29125
  if (/^[\w-]+$/.test(a)) {
29112
- let e = fk(a);
29126
+ let e = pk(a);
29113
29127
  if (e) return e;
29114
29128
  }
29115
29129
  let o = n.toLowerCase().replace(/\s+/g, " ");
@@ -29119,7 +29133,7 @@ function pk(e, t) {
29119
29133
  }
29120
29134
  return null;
29121
29135
  }
29122
- function mk(e, t) {
29136
+ function hk(e, t) {
29123
29137
  let n = String(t || "").toLowerCase().trim();
29124
29138
  if (!n) return 0;
29125
29139
  let r = [
@@ -29135,13 +29149,13 @@ function mk(e, t) {
29135
29149
  for (let e of i) r.includes(e) && (a += 1);
29136
29150
  return a / i.length * 92;
29137
29151
  }
29138
- function hk(e, t) {
29152
+ function gk(e, t) {
29139
29153
  let n = [];
29140
- JO((e) => {
29154
+ YO((e) => {
29141
29155
  n.push(...Array.from(e.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
29142
- if (KO(e) || e.disabled) return !1;
29156
+ if (qO(e) || e.disabled) return !1;
29143
29157
  try {
29144
- let t = qO(e);
29158
+ let t = JO(e);
29145
29159
  if (t.display === "none" || t.visibility === "hidden") return !1;
29146
29160
  } catch {}
29147
29161
  return !0;
@@ -29149,7 +29163,7 @@ function hk(e, t) {
29149
29163
  });
29150
29164
  let r = 0, i = n.map((t) => ({
29151
29165
  el: t,
29152
- s: mk(t, e)
29166
+ s: hk(t, e)
29153
29167
  }));
29154
29168
  for (let { s: e } of i) e > r && (r = e);
29155
29169
  if (r < 36) return null;
@@ -29159,14 +29173,14 @@ function hk(e, t) {
29159
29173
  if (o.length) {
29160
29174
  let e = a[0], t = Infinity;
29161
29175
  for (let n of a) for (let r of o) {
29162
- let i = dk(n, r);
29176
+ let i = fk(n, r);
29163
29177
  i < t && (t = i, e = n);
29164
29178
  }
29165
29179
  return e;
29166
29180
  }
29167
29181
  return a[0];
29168
29182
  }
29169
- function gk(e) {
29183
+ function _k(e) {
29170
29184
  if (e == null) return {};
29171
29185
  if (typeof e == "string") {
29172
29186
  let t = e.trim();
@@ -29179,8 +29193,8 @@ function gk(e) {
29179
29193
  }
29180
29194
  return e;
29181
29195
  }
29182
- function _k(e) {
29183
- let t = gk(e);
29196
+ function vk(e) {
29197
+ let t = _k(e);
29184
29198
  if (Array.isArray(t) && t.length > 0) {
29185
29199
  let e = t[0];
29186
29200
  if (e?.field_key != null || e?.fieldKey != null) return t.map((e) => ({
@@ -29208,7 +29222,7 @@ function _k(e) {
29208
29222
  value: e?.value ?? e?.Value
29209
29223
  })) : [];
29210
29224
  }
29211
- function vk(e) {
29225
+ function yk(e) {
29212
29226
  if (!e || typeof e != "string") return [];
29213
29227
  let t = e.trim();
29214
29228
  if (!t || /\b[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}\b/i.test(t)) return [];
@@ -29227,7 +29241,7 @@ function vk(e) {
29227
29241
  }
29228
29242
  return [];
29229
29243
  }
29230
- function yk(e) {
29244
+ function bk(e) {
29231
29245
  if (!e || typeof e != "string") return [];
29232
29246
  let t = e.trim();
29233
29247
  if (!t) return [];
@@ -29263,17 +29277,17 @@ function yk(e) {
29263
29277
  }
29264
29278
  return n;
29265
29279
  }
29266
- function bk(e) {
29280
+ function xk(e) {
29267
29281
  if (!e || typeof e != "object") return null;
29268
29282
  let t = e.url ?? e.target_url ?? e.page_url ?? e.pageUrl ?? e.link ?? e.href ?? e.path;
29269
29283
  return t == null ? null : String(t).trim() || null;
29270
29284
  }
29271
- function xk(e) {
29285
+ function Sk(e) {
29272
29286
  if (!e || typeof e != "object") return null;
29273
29287
  let t = e.query ?? e.q ?? e.search ?? e.text ?? e.keywords;
29274
29288
  return t == null ? null : String(t).trim() || null;
29275
29289
  }
29276
- function Sk(e, t, n) {
29290
+ function Ck(e, t, n) {
29277
29291
  if (!n?.skipScroll) try {
29278
29292
  e.scrollIntoView({
29279
29293
  block: "center",
@@ -29328,7 +29342,7 @@ function Sk(e, t, n) {
29328
29342
  } catch {}
29329
29343
  return !0;
29330
29344
  }
29331
- function Ck() {
29345
+ function wk() {
29332
29346
  let e = {};
29333
29347
  document.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((t) => {
29334
29348
  if (t.id) return;
@@ -29343,11 +29357,11 @@ function Ck() {
29343
29357
  e[r] = !0, t.id = r;
29344
29358
  });
29345
29359
  }
29346
- function wk(e) {
29360
+ function Tk(e) {
29347
29361
  let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, ""), r = typeof e.getLastUserVoiceText == "function" ? e.getLastUserVoiceText : null, i = [], a = {
29348
29362
  flowengage_navigate: async (n) => {
29349
29363
  $("flowengage_navigate ▶ raw parameters:", n);
29350
- let i = gk(n), a = bk(i), o = i.section_text ?? i.sectionText ?? i.section, s = Array.isArray(i.expected_landmarks) ? i.expected_landmarks : Array.isArray(i.expectedLandmarks) ? i.expectedLandmarks : [];
29364
+ let i = _k(n), a = xk(i), o = i.section_text ?? i.sectionText ?? i.section, s = Array.isArray(i.expected_landmarks) ? i.expected_landmarks : Array.isArray(i.expectedLandmarks) ? i.expectedLandmarks : [];
29351
29365
  if ($("flowengage_navigate · coerced:", {
29352
29366
  url: a,
29353
29367
  sectionText: o,
@@ -29394,7 +29408,15 @@ function wk(e) {
29394
29408
  let e = new URL(a, window.location.origin).pathname, t = Date.now() + 2e3;
29395
29409
  for (; Date.now() < t && !(typeof window < "u" && window.location.pathname === e);) await new Promise((e) => setTimeout(e, 80));
29396
29410
  let n = typeof window < "u" ? window.location.pathname : e, r = typeof window < "u" ? window.location.href : a, i = n === e, o = (n.split("/").filter(Boolean).pop() || "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) || "Home";
29397
- return $("flowengage_navigate → SPA nav complete. target:", e, "actual:", n), i ? (wr(), `OK_NAVIGATE_SPA. Visitor is now on: ${r} (page: "${o}"). Do NOT say "I have navigated you" or "I've taken you to" — the page is already loaded visually. Start immediately with highlights and content about THIS page.`) : (wr(), `OK_NAVIGATE_SPA. CURRENT PAGE IS: ${r} (page: "${o}"). The visitor manually navigated here. Describe THIS page only — do not mention the page you tried to navigate to.`);
29411
+ if ($("flowengage_navigate → SPA nav complete. target:", e, "actual:", n), i) {
29412
+ wr();
29413
+ let e = GO();
29414
+ return `OK_NAVIGATE_SPA. Visitor is now on: ${r} (page: "${o}").${e.length > 0 ? ` Section headings on this page (use these EXACTLY for flowengage_highlight — do not guess): ${e.map((e) => `"${e}"`).join(", ")}.` : ""} Do NOT say "I have navigated you" or "I've taken you to" — the page is already loaded visually. Speak about this page immediately and highlight the first relevant section.`;
29415
+ } else {
29416
+ wr();
29417
+ let e = GO();
29418
+ return `OK_NAVIGATE_SPA. CURRENT PAGE IS: ${r} (page: "${o}").${e.length > 0 ? ` Section headings on this page: ${e.map((e) => `"${e}"`).join(", ")}.` : ""} The visitor manually navigated here. Describe THIS page only — do not mention the page you tried to navigate to.`;
29419
+ }
29398
29420
  } catch {}
29399
29421
  return "OK_NAVIGATE_RELOADING. Navigating to the page now; the voice session will resume automatically on the new page. When the session resumes, immediately introduce the new page and continue guiding the visitor — do not wait for the user to speak first.";
29400
29422
  } catch (e) {
@@ -29410,14 +29432,14 @@ function wk(e) {
29410
29432
  },
29411
29433
  flowengage_highlight: async (e) => {
29412
29434
  $("flowengage_highlight ▶", e);
29413
- let t = gk(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText;
29414
- Ck();
29435
+ let t = _k(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText;
29436
+ wk();
29415
29437
  let i = hr(n || null, r || null);
29416
- return !i && r && (await new Promise((e) => setTimeout(e, 500)), Ck(), i = hr(null, r)), i ? (CD(i), $("flowengage_highlight ✓", r || n), `OK_HIGHLIGHT: "${r || n}". Continue immediately with your next sentence about this section — do NOT say "I've highlighted", "let me highlight", or anything about the highlight action. Just keep speaking naturally.`) : ($("flowengage_highlight ✖ no element for:", r || n), `HIGHLIGHT_NOT_FOUND: "${r || n}" — the section heading was not found on this page. Do NOT say "I apologize", "I'm sorry", "I couldn't find", or anything about a missing section. Continue speaking your next sentence about the content naturally. Try a shorter phrase next time (e.g. first 2-3 words of the heading).`);
29438
+ return !i && r && (await new Promise((e) => setTimeout(e, 500)), wk(), i = hr(null, r)), i ? (CD(i), $("flowengage_highlight ✓", r || n), `OK_HIGHLIGHT: "${r || n}". Continue immediately with your next sentence about this section — do NOT say "I've highlighted", "let me highlight", or anything about the highlight action. Just keep speaking naturally.`) : ($("flowengage_highlight ✖ no element for:", r || n), `HIGHLIGHT_NOT_FOUND: "${r || n}" — the section heading was not found on this page. Do NOT say "I apologize", "I'm sorry", "I couldn't find", or anything about a missing section. Continue speaking your next sentence about the content naturally. Try a shorter phrase next time (e.g. first 2-3 words of the heading).`);
29417
29439
  },
29418
29440
  flowengage_read_content: async (e) => {
29419
29441
  $("flowengage_read_content ▶", e);
29420
- let t = gk(e), n = t?.section_text || t?.sectionText || "";
29442
+ let t = _k(e), n = t?.section_text || t?.sectionText || "";
29421
29443
  try {
29422
29444
  let e = "";
29423
29445
  if (n) {
@@ -29440,7 +29462,7 @@ function wk(e) {
29440
29462
  },
29441
29463
  flowengage_search: async (e) => {
29442
29464
  $("flowengage_search ▶", e);
29443
- let r = xk(gk(e));
29465
+ let r = Sk(_k(e));
29444
29466
  if ($("flowengage_search · query:", r, "siteId:", t, "apiBase:", n || "(empty)"), !r) return $("flowengage_search ✖ missing query"), "Missing query parameter.";
29445
29467
  if (!t) return $("flowengage_search ✖ no siteId"), "Site is not configured for search.";
29446
29468
  if (!n) return $("flowengage_search ✖ no api base"), "API base URL is missing; cannot search.";
@@ -29472,7 +29494,7 @@ function wk(e) {
29472
29494
  },
29473
29495
  flowengage_page_content: async (e) => {
29474
29496
  $("flowengage_page_content ▶", e);
29475
- let r = gk(e), i = r?.url || r?.page_url || "";
29497
+ let r = _k(e), i = r?.url || r?.page_url || "";
29476
29498
  if ($("flowengage_page_content · url:", i, "siteId:", t, "apiBase:", n || "(empty)"), !i) return $("flowengage_page_content ✖ missing url"), "Missing url parameter.";
29477
29499
  if (!t) return $("flowengage_page_content ✖ no siteId"), "Site is not configured.";
29478
29500
  if (!n) return $("flowengage_page_content ✖ no api base"), "API base URL is missing; cannot fetch page content.";
@@ -29513,7 +29535,7 @@ function wk(e) {
29513
29535
  }), `CURRENT_PAGE. URL: ${e} | Path: ${t} | Title: ${n}. Use THIS as the definitive current page — not any previously navigated URL.`;
29514
29536
  },
29515
29537
  flowengage_list_forms: async () => {
29516
- let e = QO(), t = $O();
29538
+ let e = $O(), t = ek();
29517
29539
  return $("flowengage_list_forms ✓", `${e.length} field(s)`, `${t.length} button(s)`), JSON.stringify({
29518
29540
  fields: e,
29519
29541
  buttons: t,
@@ -29523,10 +29545,10 @@ function wk(e) {
29523
29545
  flowengage_fill_form: async (e) => {
29524
29546
  try {
29525
29547
  $("flowengage_fill_form ▶ raw:", e), MO();
29526
- let t = _k(e);
29548
+ let t = vk(e);
29527
29549
  if (!t.length && r) {
29528
- let e = r(), n = vk(e);
29529
- n.length ? $("flowengage_fill_form · inferred URL from last user utterance (model omitted usable fields):", n) : (n = yk(e), n.length && $("flowengage_fill_form · inferred contact fields from last user utterance (empty tool params):", n)), n.length && (t = n);
29550
+ let e = r(), n = yk(e);
29551
+ n.length ? $("flowengage_fill_form · inferred URL from last user utterance (model omitted usable fields):", n) : (n = bk(e), n.length && $("flowengage_fill_form · inferred contact fields from last user utterance (empty tool params):", n)), n.length && (t = n);
29530
29552
  }
29531
29553
  if ($("flowengage_fill_form · normalized fields:", t), !t.length) return "No fields provided. Call flowengage_list_forms for field_key strings, then flowengage_fill_form with { \"fields\": [ { \"field_key\": \"<label or placeholder from list>\", \"value\": \"<user value>\" } ] }. Never use empty {}. Pass the value the user just said (email, message, name, URL) in fields.";
29532
29554
  let n = [];
@@ -29534,14 +29556,14 @@ function wk(e) {
29534
29556
  let t = e?.field_key ?? e?.fieldKey, r = e?.value;
29535
29557
  if (t == null || r == null) continue;
29536
29558
  TO(`Filling ${String(t)}...`, { spinner: !0 });
29537
- let a = ZO(), o = uk(a, String(t), r);
29559
+ let a = QO(), o = dk(a, String(t), r);
29538
29560
  if (o.length) {
29539
- for (let [e, t] of o.entries()) NO(t), await zO(t), Sk(t, r, { skipScroll: e > 0 }), PO(t), await WO(120);
29561
+ for (let [e, t] of o.entries()) NO(t), await zO(t), Ck(t, r, { skipScroll: e > 0 }), PO(t), await WO(120);
29540
29562
  i = o, n.push(String(t));
29541
29563
  continue;
29542
29564
  }
29543
- let s = pk(a, String(t));
29544
- s ||= ik(a, String(t)), s ||= ak(a, String(t), r), s && (NO(s), await zO(s), Sk(s, r), PO(s), await WO(120), i = [s], n.push(String(t)));
29565
+ let s = mk(a, String(t));
29566
+ s ||= ak(a, String(t)), s ||= ok(a, String(t), r), s && (NO(s), await zO(s), Ck(s, r), PO(s), await WO(120), i = [s], n.push(String(t)));
29545
29567
  }
29546
29568
  if (!n.length) return $("flowengage_fill_form ✖ no matches"), "Could not match any fields. Call flowengage_list_forms and use field_key values that match placeholder, label, name, or id (e.g. Enter Website URL). Ensure the form is on the page, not the chat panel.";
29547
29569
  let a = `OK_FILLED: ${n.join(", ")}`;
@@ -29562,9 +29584,9 @@ function wk(e) {
29562
29584
  }
29563
29585
  },
29564
29586
  flowengage_click_button: async (e) => {
29565
- let t = gk(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim();
29587
+ let t = _k(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim();
29566
29588
  if ($("flowengage_click_button ▶", n), !n) return "Missing button_text: pass the visible label, e.g. Conduct Audit.";
29567
- let r = hk(n, i);
29589
+ let r = gk(n, i);
29568
29590
  if (!r) return $("flowengage_click_button ✖ no match"), `Could not find a button matching "${n}". Call flowengage_list_forms to see button texts.`;
29569
29591
  try {
29570
29592
  TO(`Clicking ${n}...`, { spinner: !0 });
@@ -29608,7 +29630,7 @@ function wk(e) {
29608
29630
  }
29609
29631
  //#endregion
29610
29632
  //#region src/utils/wrapVoiceToolsForLogging.js
29611
- function Tk(e) {
29633
+ function Ek(e) {
29612
29634
  return !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, async (n) => {
29613
29635
  let r = Rn();
29614
29636
  r ? console.log("[FlowEngage:voice-tool] ▶", e, n) : console.info(`[FlowEngage] voice tool » ${e}`);
@@ -29625,7 +29647,7 @@ function Tk(e) {
29625
29647
  }
29626
29648
  //#endregion
29627
29649
  //#region src/components/FlowEngageWidget.jsx
29628
- var Ek = {
29650
+ var Dk = {
29629
29651
  blue: "#135bd8",
29630
29652
  red: "#ef334b",
29631
29653
  yellow: "#ffbd2e",
@@ -29633,7 +29655,7 @@ var Ek = {
29633
29655
  highlight: "rgba(255,255,255,0.9)",
29634
29656
  green: "#10b981"
29635
29657
  };
29636
- function Dk(e) {
29658
+ function Ok(e) {
29637
29659
  if (!Array.isArray(e) || e.length < 2) return "linear-gradient(145deg, #dce8f022 0%, #e8dff522 45%, #f5e0e022 100%), #f7f8fa";
29638
29660
  let [t, n, r] = e;
29639
29661
  return e.length >= 3 && r ? [
@@ -29647,12 +29669,12 @@ function Dk(e) {
29647
29669
  "#f7f8fa"
29648
29670
  ].join(", ");
29649
29671
  }
29650
- function Ok(e) {
29672
+ function kk(e) {
29651
29673
  if (!e || typeof e != "string") return "#1a1a1a";
29652
29674
  let t = e.replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t, r = parseInt(n.slice(0, 2), 16) / 255, i = parseInt(n.slice(2, 4), 16) / 255, a = parseInt(n.slice(4, 6), 16) / 255, o = (e) => e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4;
29653
29675
  return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
29654
29676
  }
29655
- function kk({ logo: t, style: n }) {
29677
+ function Ak({ logo: t, style: n }) {
29656
29678
  if (!t) return null;
29657
29679
  if (typeof t == "string") return /* @__PURE__ */ g("img", {
29658
29680
  src: t,
@@ -29677,7 +29699,7 @@ function kk({ logo: t, style: n }) {
29677
29699
  children: r
29678
29700
  }) : null;
29679
29701
  }
29680
- function Ak({ title: e }) {
29702
+ function jk({ title: e }) {
29681
29703
  return /* @__PURE__ */ g("div", {
29682
29704
  style: {
29683
29705
  width: "100%",
@@ -29695,18 +29717,18 @@ function Ak({ title: e }) {
29695
29717
  children: String(e || "FE").split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0]?.toUpperCase() || "").join("") || "FE"
29696
29718
  });
29697
29719
  }
29698
- function jk(e, t) {
29720
+ function Mk(e, t) {
29699
29721
  let n = (t || "").trim();
29700
29722
  return n ? !!(/\b(let'?s|let us)\s+(end|stop|finish|wrap up|close)\s+(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n) || /\bend\s+(this\s+)?(the\s+)?(voice\s+)?(session|call|chat)\b/i.test(n) || /\b(hang\s+up|disconnect)\b/i.test(n) || /\b(that'?s all|we'?re done)\b/i.test(n) || e === "bot" && (/\b(I'?ll|I will|Let me|I can|I'?m going to)\s+(end|close)\s+(the\s+)?(voice\s+)?(session|call)\b/i.test(n) || /\b(ending|closing)\s+(the\s+)?(voice\s+)?session\b|\bvoice\s+session\s+(is\s+)?(now\s+)?(ended|over|closing)\b/i.test(n) || /\b(session|call)\s+(is\s+)?(now\s+)?(ended|over)\b/i.test(n) || /\bwe\s+can\s+end\s+(the\s+)?(session|call)?\s*(here|now)\b/i.test(n) || /\b(wrapping\s+up|signing\s+off)\b/i.test(n)) || /^(goodbye|bye|that'?s all|we'?re done|hang up|disconnect)\b/i.test(n)) : !1;
29701
29723
  }
29702
- function Mk({ orbColors: e, ...t }) {
29724
+ function Nk({ orbColors: e, ...t }) {
29703
29725
  return /* @__PURE__ */ g(dO, {
29704
29726
  colors: e,
29705
29727
  ...t
29706
29728
  });
29707
29729
  }
29708
- function Nk({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
29709
- let s = n || Ek.green, c = Ok(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
29730
+ function Pk({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
29731
+ let s = n || Dk.green, c = kk(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
29710
29732
  style: {
29711
29733
  display: "flex",
29712
29734
  alignItems: a ? "flex-end" : "center",
@@ -29827,7 +29849,7 @@ function Nk({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
29827
29849
  delay: 0
29828
29850
  },
29829
29851
  style: { flexShrink: 0 },
29830
- children: /* @__PURE__ */ g(Mk, {
29852
+ children: /* @__PURE__ */ g(Nk, {
29831
29853
  size: l,
29832
29854
  orbColors: t
29833
29855
  })
@@ -29859,8 +29881,8 @@ function Nk({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
29859
29881
  children: u
29860
29882
  })] });
29861
29883
  }
29862
- function Pk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
29863
- let c = n || Ek.green, l = Ok(c);
29884
+ function Fk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
29885
+ let c = n || Dk.green, l = kk(c);
29864
29886
  return /* @__PURE__ */ _(Dm.div, {
29865
29887
  initial: {
29866
29888
  scale: 50 / 350,
@@ -29931,7 +29953,7 @@ function Pk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
29931
29953
  children: /* @__PURE__ */ g("polyline", { points: "6 9 12 15 18 9" })
29932
29954
  })
29933
29955
  }),
29934
- /* @__PURE__ */ g(Mk, {
29956
+ /* @__PURE__ */ g(Nk, {
29935
29957
  size: 72,
29936
29958
  orbColors: t
29937
29959
  }),
@@ -30000,7 +30022,7 @@ function Pk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
30000
30022
  ]
30001
30023
  });
30002
30024
  }
30003
- function Fk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i, siteId: a, apiBaseUrl: s, chatId: l, historyRef: u, onMessageSync: d, voiceEndCounter: f }) {
30025
+ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i, siteId: a, apiBaseUrl: s, chatId: l, historyRef: u, onMessageSync: d, voiceEndCounter: f }) {
30004
30026
  let [h, v] = m("idle"), [y, b] = m(!1), [x, S] = m(!1), C = p(null), w = p(""), T = p(async () => {}), ee = p(!1), te = p(!1), ne = p(!1), re = p(!1), E = p("minimized"), ie = p(null), ae = p(null), oe = p(null), D = p(0), se = p(!1), ce = p("idle"), le = p(!1), ue = p(null), de = p(null), fe = p(!1), pe = o((e = "minimized") => {
30005
30027
  E.current = e, re.current = !0, queueMicrotask(() => {
30006
30028
  ee.current || (ee.current = !0, T.current?.());
@@ -30082,7 +30104,7 @@ function Fk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30082
30104
  }
30083
30105
  Ne();
30084
30106
  } });
30085
- let t = Tk(wk({
30107
+ let t = Ek(Tk({
30086
30108
  siteId: a || null,
30087
30109
  apiBaseUrl: s || null,
30088
30110
  getLastUserVoiceText: () => w.current,
@@ -30155,7 +30177,7 @@ function Fk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30155
30177
  let e = bO(u.current);
30156
30178
  e && Ae(a, e);
30157
30179
  } catch {}
30158
- if (jk(n, r)) {
30180
+ if (Mk(n, r)) {
30159
30181
  pe("minimized");
30160
30182
  return;
30161
30183
  }
@@ -30319,7 +30341,7 @@ function Fk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30319
30341
  },
30320
30342
  children: "Muted"
30321
30343
  }),
30322
- /* @__PURE__ */ g(Mk, {
30344
+ /* @__PURE__ */ g(Nk, {
30323
30345
  size: 72,
30324
30346
  voiceState: h,
30325
30347
  isMuted: y,
@@ -30557,7 +30579,7 @@ function Fk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, voiceId: i
30557
30579
  ]
30558
30580
  });
30559
30581
  }
30560
- function Ik({ orbColors: e }) {
30582
+ function Lk({ orbColors: e }) {
30561
30583
  return /* @__PURE__ */ g("div", {
30562
30584
  style: {
30563
30585
  flexShrink: 0,
@@ -30567,13 +30589,13 @@ function Ik({ orbColors: e }) {
30567
30589
  alignItems: "center",
30568
30590
  justifyContent: "center"
30569
30591
  },
30570
- children: /* @__PURE__ */ g(Mk, {
30592
+ children: /* @__PURE__ */ g(Nk, {
30571
30593
  size: 36,
30572
30594
  orbColors: e
30573
30595
  })
30574
30596
  });
30575
30597
  }
30576
- var Lk = () => /* @__PURE__ */ g("div", {
30598
+ var Rk = () => /* @__PURE__ */ g("div", {
30577
30599
  style: {
30578
30600
  display: "flex",
30579
30601
  marginBottom: "12px",
@@ -30603,7 +30625,7 @@ var Lk = () => /* @__PURE__ */ g("div", {
30603
30625
  } }, e))
30604
30626
  })
30605
30627
  });
30606
- function Rk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i, quickChatOptions: a, onQuickChatSelect: o, isMobile: s, chatHistory: l, isAiTyping: u, isAgentTyping: d, activeScreen: f, agentName: v, agentHeadshot: y, fallbackAgentName: b, input: x, setInput: S, onSubmit: C, isConversationEnded: w, isLoading: T, isRateLimited: ee, rateLimitMessage: te, selectedFile: ne, onFileSelect: re, onRemoveSelectedFile: E, attachmentError: ie, isUploadingAttachment: ae, requiresEmail: oe, emailInput: D, setEmailInput: se, emailError: ce, emailCaptureSuccess: le, replyContext: ue, setReplyContext: de, webRTCError: fe, micError: pe, setMicError: me, dismissCallError: he, activeCallId: ge, isCallMuted: _e, toggleCallMute: ve, endWebRTCCall: ye, formatCallDuration: be, callDurationSeconds: xe, isCallMinimized: Se, onExpand: Ce, onCollapse: we, onStartVoice: Te, onNewChat: Ee, onEndConversation: De, showPoweredBy: Oe, getVisitorChatHistory: ke, getVisitorChatThread: Ae, resumeChat: je, isSessionRestoring: Me, isClosing: O }) {
30628
+ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i, quickChatOptions: a, onQuickChatSelect: o, isMobile: s, chatHistory: l, isAiTyping: u, isAgentTyping: d, activeScreen: f, agentName: v, agentHeadshot: y, fallbackAgentName: b, input: x, setInput: S, onSubmit: C, isConversationEnded: w, isLoading: T, isRateLimited: ee, rateLimitMessage: te, selectedFile: ne, onFileSelect: re, onRemoveSelectedFile: E, attachmentError: ie, isUploadingAttachment: ae, requiresEmail: oe, emailInput: D, setEmailInput: se, emailError: ce, emailCaptureSuccess: le, replyContext: ue, setReplyContext: de, webRTCError: fe, micError: pe, setMicError: me, dismissCallError: he, activeCallId: ge, isCallMuted: _e, toggleCallMute: ve, endWebRTCCall: ye, formatCallDuration: be, callDurationSeconds: xe, isCallMinimized: Se, onExpand: Ce, onCollapse: we, onStartVoice: Te, onNewChat: Ee, onEndConversation: De, showPoweredBy: Oe, getVisitorChatHistory: ke, getVisitorChatThread: Ae, resumeChat: je, isSessionRestoring: Me, isClosing: O }) {
30607
30629
  let Ne = l.length > 0, Pe = T || ee || w, Fe = !!ge, [Ie, Le] = m(!1), [Re, ze] = m(!1), [Be, Ve] = m([]), [He, Ue] = m(!1), [We, Ge] = m(null), [Ke, qe] = m([]), Je = p(null), Ye = async () => {
30608
30630
  Le(!1), ze(!0), Ue(!0), Ge(null);
30609
30631
  try {
@@ -30728,7 +30750,7 @@ function Rk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30728
30750
  justifyContent: "center",
30729
30751
  height: "40px"
30730
30752
  },
30731
- children: i ? /* @__PURE__ */ g(kk, {
30753
+ children: i ? /* @__PURE__ */ g(Ak, {
30732
30754
  logo: i,
30733
30755
  style: {
30734
30756
  height: "34px",
@@ -30741,7 +30763,7 @@ function Rk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30741
30763
  height: "40px",
30742
30764
  flexShrink: 0
30743
30765
  },
30744
- children: /* @__PURE__ */ g(Ak, { title: e.chatTitle })
30766
+ children: /* @__PURE__ */ g(jk, { title: e.chatTitle })
30745
30767
  })
30746
30768
  }), /* @__PURE__ */ g("div", {
30747
30769
  style: {
@@ -31229,11 +31251,11 @@ function Rk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
31229
31251
  isLoading: T,
31230
31252
  isAgentTyping: d,
31231
31253
  setReplyContext: de,
31232
- TypingDots: Lk,
31254
+ TypingDots: Rk,
31233
31255
  primaryColor: n,
31234
31256
  agentHeadshot: y,
31235
31257
  agentDisplayName: v || b,
31236
- botAvatarNode: /* @__PURE__ */ g(Ik, { orbColors: t })
31258
+ botAvatarNode: /* @__PURE__ */ g(Lk, { orbColors: t })
31237
31259
  }) : Me ? /* @__PURE__ */ _("div", {
31238
31260
  style: {
31239
31261
  flex: 1,
@@ -31274,7 +31296,7 @@ function Rk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
31274
31296
  padding: "28px 24px"
31275
31297
  },
31276
31298
  children: [
31277
- /* @__PURE__ */ g(Mk, {
31299
+ /* @__PURE__ */ g(Nk, {
31278
31300
  size: 94,
31279
31301
  orbColors: t
31280
31302
  }),
@@ -31415,7 +31437,7 @@ function Rk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
31415
31437
  ]
31416
31438
  });
31417
31439
  }
31418
- function zk() {
31440
+ function Bk() {
31419
31441
  let { status: e, runtimeConfig: t, resolvedConfig: n, chatHistory: r, isOpen: i, activeScreen: a, isHumanHandled: s, agentName: l, agentHeadshot: u, visitorEmail: h, isAgentTyping: v, isAiTyping: y, isLoading: b, isRateLimited: x, rateLimitMessage: S, isConversationEnded: C, incomingCall: w, activeCallId: T, callConnectionState: ee, callConnectedAt: te, isCallMuted: ne, webRTCError: re, language: E, chatId: ie, historyRef: ae, onMessageSync: oe, sendMessage: D, uploadChatFile: se, openWidget: ce, captureVisitorEmail: le, setVoiceMode: ue, endConversation: de, startNewChat: me, acceptCall: he, rejectCall: ge, endWebRTCCall: _e, toggleCallMute: ve, dismissCallError: ye, startTyping: be, stopTyping: xe, updateTypingDraft: Se, getVisitorChatHistory: Ce, getVisitorChatThread: we, resumeChat: Te, isSessionRestoring: Ee, openToChatCounter: De, voiceEndCounter: Oe } = Ln();
31420
31442
  c(() => {
31421
31443
  try {
@@ -31433,7 +31455,7 @@ function zk() {
31433
31455
  }, Fe = {
31434
31456
  ...ke.features || {},
31435
31457
  ...Ae.features || {}
31436
- }, Ie = Fe.voice !== !1, Re = Array.isArray(Ne.orbColors) && Ne.orbColors.length > 0 ? Ne.orbColors : null, ze = Ne.buttonColor || Ne.primaryColor || Re?.[0] || "#3B82F6", Be = Ne.position || "bottom-right", Ve = O.fallbackAgentName || "Agent", He = Dk(Re ?? Ne.chatBgColors), Ue = O.logo || O.logoUrl || null, We = E || "en", Ge = ke.recommendations?.[We] || [], Ke = (Ae.recommendations?.[We] ?? Ge).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
31458
+ }, Ie = Fe.voice !== !1, Re = Array.isArray(Ne.orbColors) && Ne.orbColors.length > 0 ? Ne.orbColors : null, ze = Ne.buttonColor || Ne.primaryColor || Re?.[0] || "#3B82F6", Be = Ne.position || "bottom-right", Ve = O.fallbackAgentName || "Agent", He = Ok(Re ?? Ne.chatBgColors), Ue = O.logo || O.logoUrl || null, We = E || "en", Ge = ke.recommendations?.[We] || [], Ke = (Ae.recommendations?.[We] ?? Ge).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
31437
31459
  id: e.key || `qr-${t}`,
31438
31460
  label: e.label,
31439
31461
  message: e.label,
@@ -31697,7 +31719,7 @@ function zk() {
31697
31719
  onWheel: (e) => e.stopPropagation(),
31698
31720
  onTouchMove: (e) => e.stopPropagation(),
31699
31721
  children: [
31700
- A === "entry_prompt" && /* @__PURE__ */ g(Nk, {
31722
+ A === "entry_prompt" && /* @__PURE__ */ g(Pk, {
31701
31723
  copy: Ze,
31702
31724
  orbColors: Re,
31703
31725
  primaryColor: ze,
@@ -31780,13 +31802,13 @@ function zk() {
31780
31802
  children: ee === "connected" ? `${Ht(_t)} with ${nt}` : `Tap to return to ${nt}`
31781
31803
  })]
31782
31804
  })]
31783
- }), /* @__PURE__ */ g(Mk, {
31805
+ }), /* @__PURE__ */ g(Nk, {
31784
31806
  size: 50,
31785
31807
  orbColors: Re,
31786
31808
  onClick: T && Dt ? Lt : Ie ? Kt : Jt
31787
31809
  })]
31788
31810
  }),
31789
- A === "connection_modal" && /* @__PURE__ */ g(Pk, {
31811
+ A === "connection_modal" && /* @__PURE__ */ g(Fk, {
31790
31812
  copy: Ze,
31791
31813
  orbColors: Re,
31792
31814
  primaryColor: ze,
@@ -31796,7 +31818,7 @@ function zk() {
31796
31818
  isMobile: Nt,
31797
31819
  isClosing: kt
31798
31820
  }),
31799
- A === "voice_mode" && /* @__PURE__ */ g(Fk, {
31821
+ A === "voice_mode" && /* @__PURE__ */ g(Ik, {
31800
31822
  orbColors: Re,
31801
31823
  onEnterChat: Jt,
31802
31824
  onEndChat: Yt,
@@ -31828,7 +31850,7 @@ function zk() {
31828
31850
  orbColors: Re,
31829
31851
  chatHistory: r
31830
31852
  }),
31831
- A === "text_chat" && /* @__PURE__ */ g(Rk, {
31853
+ A === "text_chat" && /* @__PURE__ */ g(zk, {
31832
31854
  isClosing: kt,
31833
31855
  copy: Ze,
31834
31856
  orbColors: Re,
@@ -31893,7 +31915,7 @@ function zk() {
31893
31915
  }
31894
31916
  //#endregion
31895
31917
  //#region src/components/ErrorBoundary.jsx
31896
- var Bk = class extends e.Component {
31918
+ var Vk = class extends e.Component {
31897
31919
  constructor(e) {
31898
31920
  super(e), this.state = { hasError: !1 };
31899
31921
  }
@@ -31908,4 +31930,4 @@ var Bk = class extends e.Component {
31908
31930
  }
31909
31931
  };
31910
31932
  //#endregion
31911
- export { dO as AnimatedOrb, Bk as ErrorBoundary, Rr as FlowEngageProvider, zk as FlowEngageWidget, Ln as useFlowEngage };
31933
+ export { dO as AnimatedOrb, Vk as ErrorBoundary, Rr as FlowEngageProvider, Bk as FlowEngageWidget, Ln as useFlowEngage };