@flowengage/react-chatbot 4.0.6 → 4.0.8

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.
@@ -26588,8 +26588,41 @@ var xD = { startSession(e) {
26588
26588
  /* @__PURE__ */ g("path", { d: "m2 2 20 20" }),
26589
26589
  /* @__PURE__ */ g("path", { d: "M9 9v3a3 3 0 0 0 5.12 2.12" })
26590
26590
  ]
26591
- }), PD = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), FD = (e = "") => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
26592
- function ID(e) {
26591
+ }), PD = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), FD = (e = "") => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), ID = new Set([
26592
+ "p",
26593
+ "br",
26594
+ "ul",
26595
+ "ol",
26596
+ "li",
26597
+ "strong",
26598
+ "em",
26599
+ "b",
26600
+ "i",
26601
+ "a"
26602
+ ]), LD = /^https?:\/\//i;
26603
+ function RD(e) {
26604
+ let t = Array.from(e.childNodes);
26605
+ for (let n of t) if (n.nodeType === Node.ELEMENT_NODE) {
26606
+ let t = n.tagName.toLowerCase();
26607
+ if (!ID.has(t)) {
26608
+ e.replaceChild(document.createTextNode(n.textContent), n);
26609
+ continue;
26610
+ }
26611
+ let r = {};
26612
+ if (t === "a") {
26613
+ let e = n.getAttribute("href") || "";
26614
+ LD.test(e) && (r.href = e), r.target = "_blank", r.rel = "noopener noreferrer";
26615
+ }
26616
+ for (; n.attributes.length > 0;) n.removeAttribute(n.attributes[0].name);
26617
+ for (let [e, t] of Object.entries(r)) n.setAttribute(e, t);
26618
+ RD(n);
26619
+ } else n.nodeType !== Node.TEXT_NODE && e.removeChild(n);
26620
+ }
26621
+ function zD(e) {
26622
+ let t = document.createElement("div");
26623
+ return t.innerHTML = e, RD(t), t.innerHTML;
26624
+ }
26625
+ function BD(e) {
26593
26626
  let t = String(e || "").trim();
26594
26627
  if (!t) return t;
26595
26628
  let n = /^<p>\s*<strong>([\s\S]*?)<\/strong>\s*<\/p>$/i.exec(t);
@@ -26601,33 +26634,33 @@ function ID(e) {
26601
26634
  }
26602
26635
  return e;
26603
26636
  }
26604
- var LD = (e = "") => {
26637
+ var VD = (e = "") => {
26605
26638
  let t = String(e || "").trim();
26606
26639
  if (!t) return "";
26607
- if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return ID(t);
26640
+ if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return BD(zD(t));
26608
26641
  let n = t.replace(/\r\n/g, "\n").replace(/\n{3,}/g, "\n\n").split(/\n\s*\n/).map((e) => e.trim()).filter(Boolean), r = (e) => FD(e).replace(/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g, "<a href=\"$2\" target=\"_blank\" rel=\"noopener noreferrer\">$1</a>").replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>").replace(/\*([^*\n]+)\*/g, "<em>$1</em>");
26609
- return ID(n.map((e) => {
26642
+ return BD(n.map((e) => {
26610
26643
  let t = e.split("\n").map((e) => e.trim()).filter(Boolean), n = t.filter((e) => /^[-*]\s+/.test(e));
26611
26644
  if (n.length >= 2 && n.length === t.length) return `<ul>${n.map((e) => `<li>${r(e.replace(/^[-*]\s+/, ""))}</li>`).join("")}</ul>`;
26612
26645
  let i = e.split(/\s+(?=[-*]\s+\*\*?)/).map((e) => e.trim()).filter(Boolean);
26613
26646
  return i.length >= 2 && i.every((e) => /^[-*]\s+/.test(e)) ? `<ul>${i.map((e) => `<li>${r(e.replace(/^[-*]\s+/, ""))}</li>`).join("")}</ul>` : `<p>${r(e).replace(/\n/g, "<br />")}</p>`;
26614
26647
  }).join(""));
26615
- }, RD = new Set(["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]), zD = new Set([
26648
+ }, HD = new Set(["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]), UD = new Set([
26616
26649
  ".pdf",
26617
26650
  ".docx",
26618
26651
  ".png",
26619
26652
  ".jpg",
26620
26653
  ".jpeg"
26621
- ]), BD = "image/png,image/jpeg,.pdf,.docx";
26622
- function VD(e) {
26654
+ ]), WD = "image/png,image/jpeg,.pdf,.docx";
26655
+ function GD(e) {
26623
26656
  if (!e) return !1;
26624
26657
  let t = typeof e.name == "string" ? e.name.toLowerCase() : "", n = t.includes(".") ? `.${t.split(".").pop()}` : "", r = typeof e.type == "string" ? e.type.toLowerCase() : "";
26625
- return r === "image/png" || r === "image/jpeg" || RD.has(r) || zD.has(n);
26658
+ return r === "image/png" || r === "image/jpeg" || HD.has(r) || UD.has(n);
26626
26659
  }
26627
- function HD(e) {
26628
- return e ? VD(e) ? e.size > 2097152 ? "File must be 2 MB or smaller." : "" : "Only PNG, JPEG, PDF, and DOCX files are allowed." : "No file selected.";
26660
+ function KD(e) {
26661
+ return e ? GD(e) ? e.size > 2097152 ? "File must be 2 MB or smaller." : "" : "Only PNG, JPEG, PDF, and DOCX files are allowed." : "No file selected.";
26629
26662
  }
26630
- function UD(e = 0) {
26663
+ function qD(e = 0) {
26631
26664
  if (!Number.isFinite(e) || e <= 0) return "";
26632
26665
  let t = [
26633
26666
  "B",
@@ -26639,12 +26672,12 @@ function UD(e = 0) {
26639
26672
  let i = n >= 10 || r === 0 ? 0 : 1;
26640
26673
  return `${n.toFixed(i)} ${t[r]}`;
26641
26674
  }
26642
- function WD(e) {
26675
+ function JD(e) {
26643
26676
  return e ? e.name || "Attachment" : "";
26644
26677
  }
26645
26678
  //#endregion
26646
26679
  //#region src/utils/avatarHelpers.js
26647
- function GD(e) {
26680
+ function YD(e) {
26648
26681
  if (!e || typeof e != "string") return "?";
26649
26682
  let t = e.trim();
26650
26683
  if (!t) return "?";
@@ -26653,7 +26686,7 @@ function GD(e) {
26653
26686
  }
26654
26687
  //#endregion
26655
26688
  //#region src/components/AvatarImageOrInitials.jsx
26656
- function KD({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
26689
+ function XD({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
26657
26690
  let [i, a] = m(!1), o = typeof e == "string" ? e.trim() : "";
26658
26691
  return c(() => {
26659
26692
  a(!1);
@@ -26664,12 +26697,12 @@ function KD({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
26664
26697
  style: n
26665
26698
  }) : /* @__PURE__ */ g("span", {
26666
26699
  style: r,
26667
- children: GD(t)
26700
+ children: YD(t)
26668
26701
  });
26669
26702
  }
26670
26703
  //#endregion
26671
26704
  //#region src/components/MessageList.jsx
26672
- function qD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, setReplyContext: i, primaryColor: a = "#3B82F6", agentHeadshot: o = null, agentDisplayName: s = "Agent", botAvatarNode: l = null }) {
26705
+ function ZD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, setReplyContext: i, primaryColor: a = "#3B82F6", agentHeadshot: o = null, agentDisplayName: s = "Agent", botAvatarNode: l = null }) {
26673
26706
  let u = p(null), [d, f] = m(null), [h, v] = m(null), y = (e) => {
26674
26707
  if (!e) return "just now";
26675
26708
  let t = /* @__PURE__ */ new Date(), n = new Date(e), r = Math.max(0, Math.floor((t - n) / 1e3));
@@ -26746,7 +26779,7 @@ function qD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26746
26779
  fontWeight: 800,
26747
26780
  marginTop: !u && (r || c) ? "22px" : "0px"
26748
26781
  },
26749
- children: r ? l || /* @__PURE__ */ g(OD, { size: 16 }) : /* @__PURE__ */ g(KD, {
26782
+ children: r ? l || /* @__PURE__ */ g(OD, { size: 16 }) : /* @__PURE__ */ g(XD, {
26750
26783
  src: m || "",
26751
26784
  name: p,
26752
26785
  imgStyle: {
@@ -26834,7 +26867,7 @@ function qD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
26834
26867
  })]
26835
26868
  }),
26836
26869
  d ? (() => {
26837
- let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = UD(e.metadata.fileSize), a = t.startsWith("image/"), o = t === "application/pdf" ? {
26870
+ let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = qD(e.metadata.fileSize), a = t.startsWith("image/"), o = t === "application/pdf" ? {
26838
26871
  color: "#ef4444",
26839
26872
  label: "PDF"
26840
26873
  } : t.includes("word") || t.includes("docx") ? {
@@ -27006,7 +27039,7 @@ function qD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
27006
27039
  });
27007
27040
  })() : r ? /* @__PURE__ */ g("div", {
27008
27041
  className: "flowengage-message-content fe-bot-message",
27009
- dangerouslySetInnerHTML: { __html: LD(e.message) }
27042
+ dangerouslySetInnerHTML: { __html: VD(e.message) }
27010
27043
  }) : /* @__PURE__ */ g("div", {
27011
27044
  style: { whiteSpace: n || c ? "normal" : "pre-wrap" },
27012
27045
  children: e.message
@@ -27113,7 +27146,7 @@ function qD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
27113
27146
  borderRadius: "50%",
27114
27147
  overflow: "hidden"
27115
27148
  },
27116
- children: /* @__PURE__ */ g(KD, {
27149
+ children: /* @__PURE__ */ g(XD, {
27117
27150
  src: o || "",
27118
27151
  name: s,
27119
27152
  imgStyle: {
@@ -27207,7 +27240,7 @@ function qD({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
27207
27240
  }
27208
27241
  //#endregion
27209
27242
  //#region src/components/ChatInput.jsx
27210
- function JD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUiActive: i, handleToggleVoice: a, activeScreen: o, inputDisabled: s, replyContext: c, clearReplyContext: l, requiresEmail: u, emailInput: d, setEmailInput: f, emailError: m, showVoiceToggle: v = !1, voiceEnabled: y = !0, onFileSelect: b, selectedFile: x = null, onRemoveSelectedFile: S, attachmentError: C = "", isUploadingAttachment: w = !1, inputPlaceholder: T = "Type your message" }) {
27243
+ function QD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUiActive: i, handleToggleVoice: a, activeScreen: o, inputDisabled: s, replyContext: c, clearReplyContext: l, requiresEmail: u, emailInput: d, setEmailInput: f, emailError: m, showVoiceToggle: v = !1, voiceEnabled: y = !0, onFileSelect: b, selectedFile: x = null, onRemoveSelectedFile: S, attachmentError: C = "", isUploadingAttachment: w = !1, inputPlaceholder: T = "Type your message" }) {
27211
27244
  let ee = p(null), te = c?.sender === "user" ? "You" : c?.sender === "agent" ? "Agent" : "AI Assistant", ne = u ? !!d?.trim() : !!e?.trim() || !!x, re = s || w || !ne, E = !u && y && v;
27212
27245
  return /* @__PURE__ */ _("div", {
27213
27246
  style: {
@@ -27342,7 +27375,7 @@ function JD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
27342
27375
  overflow: "hidden",
27343
27376
  textOverflow: "ellipsis"
27344
27377
  },
27345
- children: WD(x)
27378
+ children: JD(x)
27346
27379
  }),
27347
27380
  /* @__PURE__ */ g("div", {
27348
27381
  style: {
@@ -27350,7 +27383,7 @@ function JD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
27350
27383
  color: "#6b7280",
27351
27384
  marginTop: "2px"
27352
27385
  },
27353
- children: UD(x.size)
27386
+ children: qD(x.size)
27354
27387
  })
27355
27388
  ]
27356
27389
  }), /* @__PURE__ */ g("button", {
@@ -27395,7 +27428,7 @@ function JD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
27395
27428
  E ? /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("input", {
27396
27429
  ref: ee,
27397
27430
  type: "file",
27398
- accept: BD,
27431
+ accept: WD,
27399
27432
  style: { display: "none" },
27400
27433
  onChange: (e) => {
27401
27434
  let t = e.target.files?.[0];
@@ -27546,7 +27579,7 @@ function JD({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
27546
27579
  }
27547
27580
  //#endregion
27548
27581
  //#region src/components/StatusBanners.jsx
27549
- function YD({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r, isRateLimited: i, rateLimitMessage: a }) {
27582
+ function $D({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r, isRateLimited: i, rateLimitMessage: a }) {
27550
27583
  return /* @__PURE__ */ _(h, { children: [(e || t) && /* @__PURE__ */ _("div", {
27551
27584
  style: {
27552
27585
  margin: "0 20px 10px",
@@ -27605,13 +27638,13 @@ function YD({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
27605
27638
  }
27606
27639
  //#endregion
27607
27640
  //#region src/components/AnimatedOrb.jsx
27608
- var XD = [
27641
+ var eO = [
27609
27642
  "#135bd8",
27610
27643
  "#ef334b",
27611
27644
  "#ffbd2e"
27612
27645
  ];
27613
- function ZD(e) {
27614
- return !Array.isArray(e) || e.length === 0 ? XD : e.length === 1 ? [
27646
+ function tO(e) {
27647
+ return !Array.isArray(e) || e.length === 0 ? eO : e.length === 1 ? [
27615
27648
  e[0],
27616
27649
  e[0],
27617
27650
  e[0]
@@ -27625,14 +27658,14 @@ function ZD(e) {
27625
27658
  e[2]
27626
27659
  ];
27627
27660
  }
27628
- var QD = {
27661
+ var nO = {
27629
27662
  idle: 3,
27630
27663
  listening: .75,
27631
27664
  speaking: 1.4,
27632
27665
  muted: .75,
27633
27666
  error: .08
27634
27667
  };
27635
- function $D(e) {
27668
+ function rO(e) {
27636
27669
  if (!e || typeof e != "string") return [
27637
27670
  0,
27638
27671
  0,
@@ -27645,14 +27678,14 @@ function $D(e) {
27645
27678
  parseInt(n.slice(4, 6), 16) / 255
27646
27679
  ];
27647
27680
  }
27648
- function eO(e, t) {
27681
+ function iO(e, t) {
27649
27682
  if (!e || typeof e != "string") return `rgba(0,0,0,${t})`;
27650
27683
  if (e.startsWith("rgb")) return e.replace(/[\d.]+\)$/, `${t})`);
27651
27684
  let n = e.replace("#", ""), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n;
27652
27685
  return `rgba(${parseInt(r.slice(0, 2), 16)},${parseInt(r.slice(2, 4), 16)},${parseInt(r.slice(4, 6), 16)},${t})`;
27653
27686
  }
27654
- var tO = "\n attribute vec2 a_pos;\n varying vec2 v_uv;\n void main() {\n v_uv = a_pos * 0.5 + 0.5;\n gl_Position = vec4(a_pos, 0.0, 1.0);\n }\n", nO = "\n precision highp float;\n\n varying vec2 v_uv;\n uniform float u_time;\n uniform float u_speed;\n uniform vec3 u_c1;\n uniform vec3 u_c2;\n uniform vec3 u_c3;\n\n // ── Gradient noise ─────────────────────────────────────────────────────────\n vec2 hash2(vec2 p) {\n p = vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)));\n return -1.0 + 2.0 * fract(sin(p) * 43758.5453123);\n }\n float gnoise(vec2 p) {\n vec2 i = floor(p), f = fract(p);\n vec2 u = f*f*f*(f*(f*6.0-15.0)+10.0);\n return mix(\n mix(dot(hash2(i), f),\n dot(hash2(i+vec2(1,0)), f-vec2(1,0)), u.x),\n mix(dot(hash2(i+vec2(0,1)), f-vec2(0,1)),\n dot(hash2(i+vec2(1,1)), f-vec2(1,1)), u.x),\n u.y\n ) * 0.5 + 0.5;\n }\n\n // ── 3-octave FBM normalised to [0,1] — fewer octaves → larger, softer blobs\n float fbm(vec2 p) {\n float v = 0.0, a = 0.5;\n for (int i = 0; i < 3; i++) {\n v += a * gnoise(p);\n p = p * 2.1 + vec2(100.0);\n a *= 0.5;\n }\n return v / 0.875;\n }\n\n // ── Scalar hash for grain ──────────────────────────────────────────────────\n float hash1(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);\n }\n\n void main() {\n vec2 uv = v_uv;\n float t = u_time * u_speed + 47.3;\n\n // ── ① Two-level domain warp — deep organic folding and swirling ───────────\n // First pass: large-scale sweep\n vec2 q = vec2(\n fbm(uv * 1.8 + vec2( t * 0.13, t * 0.11)) * 2.0 - 1.0,\n fbm(uv * 1.8 + vec2( t * 0.11 + 3.7, -t * 0.14 + 1.1)) * 2.0 - 1.0\n );\n // Second pass: warp the warp — creates curling, folding sub-currents\n vec2 r = vec2(\n fbm(uv * 1.8 + q * 0.55 + vec2( t * 0.09, t * 0.07)) * 2.0 - 1.0,\n fbm(uv * 1.8 + q * 0.55 + vec2(-t * 0.07 + 5.1, t * 0.10 + 2.3)) * 2.0 - 1.0\n );\n vec2 wp = uv + r * 0.38;\n\n // ── ② Three independent fields — each drifts inward from its source edge ──\n // Asymmetric velocities: dominant axis matches the inflow direction so the\n // noise texture visually streams inward (left→right, right→left, bottom→top).\n float f1 = fbm(wp * 0.85 + vec2(-t * 0.18, t * 0.04)); // LEFT → right\n float f2 = fbm(wp * 0.85 + vec2( t * 0.18 + 5.3, t * 0.04 + 1.7)); // RIGHT → left\n float f3 = fbm(wp * 0.85 + vec2( t * 0.04 - 3.2, -t * 0.18 + 6.4)); // BOTTOM → up\n\n // ── ③ Breathing blobs — sin pulse makes each field expand and contract ────\n float p1 = 0.88 + 0.12 * sin(t * 0.61);\n float p2 = 0.88 + 0.12 * sin(t * 0.47 + 2.09);\n float p3 = 0.88 + 0.12 * sin(t * 0.53 + 4.19);\n\n // Wide smoothstep (0.26 → 0.70) → soft, diffused blob edges that dissolve\n // gradually into each other, like dye spreading through water.\n float b1 = smoothstep(0.26, 0.70, f1 * p1);\n float b2 = smoothstep(0.26, 0.70, f2 * p2);\n float b3 = smoothstep(0.26, 0.70, f3 * p3);\n\n // ── ④ Directional origin gradients.\n // Each color owns its home edge (value = 1.0) and smoothly fades to zero\n // before reaching the opposite side. The transition windows are offset so\n // they overlap only in the center third — that overlap zone is where the\n // three colors meet and blend, while the edges stay uncontaminated.\n float d1 = 1.0 - smoothstep(0.20, 0.74, uv.x); // c1: LEFT → full at x<0.20, zero by x=0.74\n float d2 = 1.0 - smoothstep(0.20, 0.74, 1.0 - uv.x); // c2: RIGHT → full at x>0.80, zero by x=0.26\n float d3 = 1.0 - smoothstep(0.18, 0.68, uv.y); // c3: BOTTOM → full at y<0.18, zero by y=0.68\n\n float w1 = b1 * d1;\n float w2 = b2 * d2;\n float w3 = b3 * d3;\n\n // ── ⑤ Dye-mixing colour blend ──────────────────────────────────────────────\n // dyeColor is the weighted average of all active colours — exactly how dyes\n // mix in water: overlapping streams blend smoothly, no hard edges.\n float total = w1 + w2 + w3;\n vec3 dyeColor = (u_c1 * w1 + u_c2 * w2 + u_c3 * w3) / max(total, 0.001);\n\n // Boost brightness of the dye to make colors pop and seem less dull\n dyeColor *= 1.65;\n\n // Exponential coverage: cores are rich and opaque; edges dissolve into the\n // near-white base. White only shows through where dye concentration is thin.\n float coverage = 1.0 - exp(-total * 5.0);\n vec3 col = mix(vec3(1.0, 1.0, 1.0), dyeColor, coverage);\n col = clamp(col, 0.0, 1.0);\n\n // ── ⑥ Sphere shading — subtle edge vignette only, no specular ─────────────\n vec2 uvc = v_uv * 2.0 - 1.0;\n\n // ── ⑦ Subtle grain — breaks gradient banding, adds filmic texture ──────────\n float grain = hash1(v_uv * 437.3 + fract(t)) * 2.0 - 1.0;\n col += grain * 0.018;\n\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n";
27655
- function rO(e, t, n) {
27687
+ var aO = "\n attribute vec2 a_pos;\n varying vec2 v_uv;\n void main() {\n v_uv = a_pos * 0.5 + 0.5;\n gl_Position = vec4(a_pos, 0.0, 1.0);\n }\n", oO = "\n precision highp float;\n\n varying vec2 v_uv;\n uniform float u_time;\n uniform float u_speed;\n uniform vec3 u_c1;\n uniform vec3 u_c2;\n uniform vec3 u_c3;\n\n // ── Gradient noise ─────────────────────────────────────────────────────────\n vec2 hash2(vec2 p) {\n p = vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)));\n return -1.0 + 2.0 * fract(sin(p) * 43758.5453123);\n }\n float gnoise(vec2 p) {\n vec2 i = floor(p), f = fract(p);\n vec2 u = f*f*f*(f*(f*6.0-15.0)+10.0);\n return mix(\n mix(dot(hash2(i), f),\n dot(hash2(i+vec2(1,0)), f-vec2(1,0)), u.x),\n mix(dot(hash2(i+vec2(0,1)), f-vec2(0,1)),\n dot(hash2(i+vec2(1,1)), f-vec2(1,1)), u.x),\n u.y\n ) * 0.5 + 0.5;\n }\n\n // ── 3-octave FBM normalised to [0,1] — fewer octaves → larger, softer blobs\n float fbm(vec2 p) {\n float v = 0.0, a = 0.5;\n for (int i = 0; i < 3; i++) {\n v += a * gnoise(p);\n p = p * 2.1 + vec2(100.0);\n a *= 0.5;\n }\n return v / 0.875;\n }\n\n // ── Scalar hash for grain ──────────────────────────────────────────────────\n float hash1(vec2 p) {\n return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);\n }\n\n void main() {\n vec2 uv = v_uv;\n float t = u_time * u_speed + 47.3;\n\n // ── ① Two-level domain warp — deep organic folding and swirling ───────────\n // First pass: large-scale sweep\n vec2 q = vec2(\n fbm(uv * 1.8 + vec2( t * 0.13, t * 0.11)) * 2.0 - 1.0,\n fbm(uv * 1.8 + vec2( t * 0.11 + 3.7, -t * 0.14 + 1.1)) * 2.0 - 1.0\n );\n // Second pass: warp the warp — creates curling, folding sub-currents\n vec2 r = vec2(\n fbm(uv * 1.8 + q * 0.55 + vec2( t * 0.09, t * 0.07)) * 2.0 - 1.0,\n fbm(uv * 1.8 + q * 0.55 + vec2(-t * 0.07 + 5.1, t * 0.10 + 2.3)) * 2.0 - 1.0\n );\n vec2 wp = uv + r * 0.38;\n\n // ── ② Three independent fields — each drifts inward from its source edge ──\n // Asymmetric velocities: dominant axis matches the inflow direction so the\n // noise texture visually streams inward (left→right, right→left, bottom→top).\n float f1 = fbm(wp * 0.85 + vec2(-t * 0.18, t * 0.04)); // LEFT → right\n float f2 = fbm(wp * 0.85 + vec2( t * 0.18 + 5.3, t * 0.04 + 1.7)); // RIGHT → left\n float f3 = fbm(wp * 0.85 + vec2( t * 0.04 - 3.2, -t * 0.18 + 6.4)); // BOTTOM → up\n\n // ── ③ Breathing blobs — sin pulse makes each field expand and contract ────\n float p1 = 0.88 + 0.12 * sin(t * 0.61);\n float p2 = 0.88 + 0.12 * sin(t * 0.47 + 2.09);\n float p3 = 0.88 + 0.12 * sin(t * 0.53 + 4.19);\n\n // Wide smoothstep (0.26 → 0.70) → soft, diffused blob edges that dissolve\n // gradually into each other, like dye spreading through water.\n float b1 = smoothstep(0.26, 0.70, f1 * p1);\n float b2 = smoothstep(0.26, 0.70, f2 * p2);\n float b3 = smoothstep(0.26, 0.70, f3 * p3);\n\n // ── ④ Directional origin gradients.\n // Each color owns its home edge (value = 1.0) and smoothly fades to zero\n // before reaching the opposite side. The transition windows are offset so\n // they overlap only in the center third — that overlap zone is where the\n // three colors meet and blend, while the edges stay uncontaminated.\n float d1 = 1.0 - smoothstep(0.20, 0.74, uv.x); // c1: LEFT → full at x<0.20, zero by x=0.74\n float d2 = 1.0 - smoothstep(0.20, 0.74, 1.0 - uv.x); // c2: RIGHT → full at x>0.80, zero by x=0.26\n float d3 = 1.0 - smoothstep(0.18, 0.68, uv.y); // c3: BOTTOM → full at y<0.18, zero by y=0.68\n\n float w1 = b1 * d1;\n float w2 = b2 * d2;\n float w3 = b3 * d3;\n\n // ── ⑤ Dye-mixing colour blend ──────────────────────────────────────────────\n // dyeColor is the weighted average of all active colours — exactly how dyes\n // mix in water: overlapping streams blend smoothly, no hard edges.\n float total = w1 + w2 + w3;\n vec3 dyeColor = (u_c1 * w1 + u_c2 * w2 + u_c3 * w3) / max(total, 0.001);\n\n // Boost brightness of the dye to make colors pop and seem less dull\n dyeColor *= 1.65;\n\n // Exponential coverage: cores are rich and opaque; edges dissolve into the\n // near-white base. White only shows through where dye concentration is thin.\n float coverage = 1.0 - exp(-total * 5.0);\n vec3 col = mix(vec3(1.0, 1.0, 1.0), dyeColor, coverage);\n col = clamp(col, 0.0, 1.0);\n\n // ── ⑥ Sphere shading — subtle edge vignette only, no specular ─────────────\n vec2 uvc = v_uv * 2.0 - 1.0;\n\n // ── ⑦ Subtle grain — breaks gradient banding, adds filmic texture ──────────\n float grain = hash1(v_uv * 437.3 + fract(t)) * 2.0 - 1.0;\n col += grain * 0.018;\n\n gl_FragColor = vec4(clamp(col, 0.0, 1.0), 1.0);\n }\n";
27688
+ function sO(e, t, n) {
27656
27689
  let r = (t, n) => {
27657
27690
  let r = e.createShader(t);
27658
27691
  return e.shaderSource(r, n), e.compileShader(r), e.getShaderParameter(r, e.COMPILE_STATUS) ? r : (console.error("[AnimatedOrb shader]", e.getShaderInfoLog(r)), null);
@@ -27661,10 +27694,10 @@ function rO(e, t, n) {
27661
27694
  let o = e.createProgram();
27662
27695
  return e.attachShader(o, i), e.attachShader(o, a), e.linkProgram(o), e.getProgramParameter(o, e.LINK_STATUS) ? o : (console.error("[AnimatedOrb link]", e.getProgramInfoLog(o)), null);
27663
27696
  }
27664
- function iO({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r, onClick: i, style: a, className: o }) {
27665
- let [s, l, u] = ZD(r), d = t === "speaking", f = e <= 50, m = p(null), h = p(QD[t] ?? .35);
27697
+ function cO({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r, onClick: i, style: a, className: o }) {
27698
+ let [s, l, u] = tO(r), d = t === "speaking", f = e <= 50, m = p(null), h = p(nO[t] ?? .35);
27666
27699
  c(() => {
27667
- h.current = QD[t] ?? .35;
27700
+ h.current = nO[t] ?? .35;
27668
27701
  }, [t]), c(() => {
27669
27702
  let t = m.current;
27670
27703
  if (!t) return;
@@ -27681,7 +27714,7 @@ function iO({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
27681
27714
  console.warn("[AnimatedOrb] WebGL unavailable.");
27682
27715
  return;
27683
27716
  }
27684
- let i = rO(r, tO, nO);
27717
+ let i = sO(r, aO, oO);
27685
27718
  if (!i) {
27686
27719
  console.error("[AnimatedOrb] WebGL program failed to compile/link");
27687
27720
  return;
@@ -27711,7 +27744,7 @@ function iO({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
27711
27744
  c2: r.getUniformLocation(i, "u_c2"),
27712
27745
  c3: r.getUniformLocation(i, "u_c3")
27713
27746
  };
27714
- r.uniform3fv(c.c1, $D(s)), r.uniform3fv(c.c2, $D(l)), r.uniform3fv(c.c3, $D(u)), r.viewport(0, 0, t.width, t.height);
27747
+ r.uniform3fv(c.c1, rO(s)), r.uniform3fv(c.c2, rO(l)), r.uniform3fv(c.c3, rO(u)), r.viewport(0, 0, t.width, t.height);
27715
27748
  let d = performance.now(), f, p = (e) => {
27716
27749
  r.uniform1f(c.time, (e - d) / 1e3), r.uniform1f(c.speed, h.current), r.drawArrays(r.TRIANGLES, 0, 6), f = requestAnimationFrame(p);
27717
27750
  };
@@ -27742,7 +27775,7 @@ function iO({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
27742
27775
  position: "absolute",
27743
27776
  inset: -10,
27744
27777
  borderRadius: "50%",
27745
- background: `radial-gradient(circle, ${eO(s, .18)} 0%, transparent 70%)`,
27778
+ background: `radial-gradient(circle, ${iO(s, .18)} 0%, transparent 70%)`,
27746
27779
  pointerEvents: "none"
27747
27780
  },
27748
27781
  animate: { opacity: [.3, .75] },
@@ -27820,17 +27853,17 @@ function iO({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
27820
27853
  }
27821
27854
  //#endregion
27822
27855
  //#region src/components/CallScreen.jsx
27823
- var aO = "\n @keyframes fe-call-ring-pulse {\n 0% { transform: scale(1); opacity: 0.55; }\n 70% { transform: scale(1.85); opacity: 0; }\n 100% { transform: scale(1.85); opacity: 0; }\n }\n @keyframes fe-call-spin {\n to { transform: rotate(360deg); }\n }\n @keyframes fe-call-slide-up {\n from { opacity: 0; transform: translateY(24px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes fe-call-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes fe-call-bar-slide-in {\n from { opacity: 0; transform: translateY(10px) scale(0.97); }\n to { opacity: 1; transform: translateY(0) scale(1); }\n }\n @keyframes fe-call-dot-blink {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.35; }\n }\n @keyframes fe-call-avatar-breathe {\n 0%, 100% { opacity: 0.5; transform: scale(1); }\n 50% { opacity: 0.9; transform: scale(1.12); }\n }\n";
27824
- function oO(e) {
27856
+ var lO = "\n @keyframes fe-call-ring-pulse {\n 0% { transform: scale(1); opacity: 0.55; }\n 70% { transform: scale(1.85); opacity: 0; }\n 100% { transform: scale(1.85); opacity: 0; }\n }\n @keyframes fe-call-spin {\n to { transform: rotate(360deg); }\n }\n @keyframes fe-call-slide-up {\n from { opacity: 0; transform: translateY(24px); }\n to { opacity: 1; transform: translateY(0); }\n }\n @keyframes fe-call-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n @keyframes fe-call-bar-slide-in {\n from { opacity: 0; transform: translateY(10px) scale(0.97); }\n to { opacity: 1; transform: translateY(0) scale(1); }\n }\n @keyframes fe-call-dot-blink {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.35; }\n }\n @keyframes fe-call-avatar-breathe {\n 0%, 100% { opacity: 0.5; transform: scale(1); }\n 50% { opacity: 0.9; transform: scale(1.12); }\n }\n";
27857
+ function uO(e) {
27825
27858
  let t = (e || "").replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t;
27826
27859
  return `${parseInt(n.slice(0, 2), 16)},${parseInt(n.slice(2, 4), 16)},${parseInt(n.slice(4, 6), 16)}`;
27827
27860
  }
27828
- function sO(e) {
27861
+ function dO(e) {
27829
27862
  if (!e || typeof e != "string") return "#1a1a1a";
27830
27863
  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;
27831
27864
  return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
27832
27865
  }
27833
- function cO(e, t) {
27866
+ function fO(e, t) {
27834
27867
  let n = Array.isArray(e) && e.length > 0 ? e : [t || "#3B82F6"], [r, i, a] = n;
27835
27868
  return n.length === 1 ? [
27836
27869
  `radial-gradient(ellipse 110% 65% at 50% -5%, ${r}28 0%, transparent 68%)`,
@@ -27847,8 +27880,8 @@ function cO(e, t) {
27847
27880
  "#f7f8fa"
27848
27881
  ].join(", ");
27849
27882
  }
27850
- function lO({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" }) {
27851
- let i = (t || "A")[0].toUpperCase(), a = sO(r), o = n > 48 ? {
27883
+ function pO({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" }) {
27884
+ let i = (t || "A")[0].toUpperCase(), a = dO(r), o = n > 48 ? {
27852
27885
  boxShadow: `0 0 0 3px ${r}44`,
27853
27886
  border: "3px solid rgba(255,255,255,0.15)"
27854
27887
  } : { border: `1.5px solid ${r}55` };
@@ -27885,7 +27918,7 @@ function lO({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" })
27885
27918
  children: i
27886
27919
  });
27887
27920
  }
27888
- function uO(e) {
27921
+ function mO(e) {
27889
27922
  let t = p(null), n = o(() => {
27890
27923
  if (!t.current) return;
27891
27924
  let { audioContext: e, oscillator: n, interval: r, toneTimeout: i } = t.current;
@@ -27932,8 +27965,8 @@ function uO(e) {
27932
27965
  n
27933
27966
  ]), c(() => () => n(), [n]), n;
27934
27967
  }
27935
- function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDurationSeconds: r, isCallMuted: i, agentName: a, agentHeadshot: o, fallbackAgentName: s, acceptCall: c, rejectCall: l, endWebRTCCall: u, toggleCallMute: d, formatCallDuration: f, onMinimize: p, primaryColor: m = "#3B82F6", orbColors: h, chatHistory: v = [] }) {
27936
- let y = a || s || "Agent", b = e ? "incoming" : n === "connecting" ? "connecting" : "ongoing", x = uO(!!e), S = async () => {
27968
+ function hO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDurationSeconds: r, isCallMuted: i, agentName: a, agentHeadshot: o, fallbackAgentName: s, acceptCall: c, rejectCall: l, endWebRTCCall: u, toggleCallMute: d, formatCallDuration: f, onMinimize: p, primaryColor: m = "#3B82F6", orbColors: h, chatHistory: v = [] }) {
27969
+ let y = a || s || "Agent", b = e ? "incoming" : n === "connecting" ? "connecting" : "ongoing", x = mO(!!e), S = async () => {
27937
27970
  x(), await c();
27938
27971
  }, C = async () => {
27939
27972
  x(), await l();
@@ -27945,14 +27978,14 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
27945
27978
  flexDirection: "column",
27946
27979
  borderRadius: "inherit",
27947
27980
  overflow: "hidden",
27948
- background: cO(h, m),
27981
+ background: fO(h, m),
27949
27982
  animation: T ? "fe-call-slide-up 0.36s cubic-bezier(0.16,1,0.3,1)" : "fe-call-fade-in 0.32s ease"
27950
27983
  };
27951
27984
  if (b === "incoming") {
27952
27985
  let e = Array.isArray(h) && h.length > 0 ? h : [m];
27953
27986
  return /* @__PURE__ */ _("div", {
27954
27987
  style: ee,
27955
- children: [/* @__PURE__ */ g("style", { children: aO }), /* @__PURE__ */ _("div", {
27988
+ children: [/* @__PURE__ */ g("style", { children: lO }), /* @__PURE__ */ _("div", {
27956
27989
  style: {
27957
27990
  flex: 1,
27958
27991
  display: "flex",
@@ -27983,7 +28016,7 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
27983
28016
  width: "96px",
27984
28017
  height: "96px",
27985
28018
  borderRadius: "50%",
27986
- background: `radial-gradient(circle, rgba(${oO(e[0])},0.2) 0%, transparent 70%)`,
28019
+ background: `radial-gradient(circle, rgba(${uO(e[0])},0.2) 0%, transparent 70%)`,
27987
28020
  filter: "blur(10px)",
27988
28021
  zIndex: 0
27989
28022
  } }),
@@ -28000,7 +28033,7 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
28000
28033
  animation: `fe-call-ring-pulse 2.6s cubic-bezier(0.215,0.61,0.355,1) ${t}s infinite`,
28001
28034
  zIndex: 1
28002
28035
  } }, n)),
28003
- /* @__PURE__ */ g(lO, {
28036
+ /* @__PURE__ */ g(pO, {
28004
28037
  headshot: o,
28005
28038
  name: y,
28006
28039
  size: 82,
@@ -28138,7 +28171,7 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
28138
28171
  }
28139
28172
  return b === "connecting" ? /* @__PURE__ */ _("div", {
28140
28173
  style: ee,
28141
- children: [/* @__PURE__ */ g("style", { children: aO }), /* @__PURE__ */ _("div", {
28174
+ children: [/* @__PURE__ */ g("style", { children: lO }), /* @__PURE__ */ _("div", {
28142
28175
  style: {
28143
28176
  flex: 1,
28144
28177
  display: "flex",
@@ -28148,7 +28181,7 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
28148
28181
  gap: "24px"
28149
28182
  },
28150
28183
  children: [
28151
- /* @__PURE__ */ g(lO, {
28184
+ /* @__PURE__ */ g(pO, {
28152
28185
  headshot: o,
28153
28186
  name: y,
28154
28187
  size: 64,
@@ -28175,7 +28208,7 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
28175
28208
  }) : /* @__PURE__ */ _("div", {
28176
28209
  style: ee,
28177
28210
  children: [
28178
- /* @__PURE__ */ g("style", { children: aO }),
28211
+ /* @__PURE__ */ g("style", { children: lO }),
28179
28212
  /* @__PURE__ */ _("div", {
28180
28213
  style: {
28181
28214
  display: "flex",
@@ -28221,7 +28254,7 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
28221
28254
  children: /* @__PURE__ */ g("polyline", { points: "15 18 9 12 15 6" })
28222
28255
  })
28223
28256
  }),
28224
- /* @__PURE__ */ g(iO, {
28257
+ /* @__PURE__ */ g(cO, {
28225
28258
  colors: h,
28226
28259
  size: 36,
28227
28260
  voiceState: w
@@ -28269,7 +28302,7 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
28269
28302
  gap: "16px",
28270
28303
  padding: "0 24px 16px"
28271
28304
  },
28272
- children: [/* @__PURE__ */ g(lO, {
28305
+ children: [/* @__PURE__ */ g(pO, {
28273
28306
  headshot: o,
28274
28307
  name: y,
28275
28308
  size: 116,
@@ -28358,9 +28391,9 @@ function dO({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
28358
28391
  ]
28359
28392
  });
28360
28393
  }
28361
- function fO({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDurationSeconds: r, isCallMuted: i, formatCallDuration: a, toggleCallMute: o, endWebRTCCall: s, onExpand: c, primaryColor: l = "#3B82F6" }) {
28394
+ function gO({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDurationSeconds: r, isCallMuted: i, formatCallDuration: a, toggleCallMute: o, endWebRTCCall: s, onExpand: c, primaryColor: l = "#3B82F6" }) {
28362
28395
  let u = e || n || "Agent";
28363
- return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("style", { children: aO }), /* @__PURE__ */ _("div", {
28396
+ return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("style", { children: lO }), /* @__PURE__ */ _("div", {
28364
28397
  role: "button",
28365
28398
  tabIndex: 0,
28366
28399
  onClick: c,
@@ -28417,7 +28450,7 @@ function fO({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
28417
28450
  borderRadius: "50%",
28418
28451
  border: `1.5px solid ${l}55`
28419
28452
  } }),
28420
- /* @__PURE__ */ g(lO, {
28453
+ /* @__PURE__ */ g(pO, {
28421
28454
  headshot: t,
28422
28455
  name: u,
28423
28456
  size: 38,
@@ -28537,7 +28570,7 @@ function fO({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
28537
28570
  }
28538
28571
  //#endregion
28539
28572
  //#region src/utils/voicePriorContext.js
28540
- function pO(e, t = {}) {
28573
+ function _O(e, t = {}) {
28541
28574
  let n = t.maxChars ?? 4500;
28542
28575
  if (!Array.isArray(e) || e.length === 0) return "";
28543
28576
  let r = [];
@@ -28554,7 +28587,7 @@ function pO(e, t = {}) {
28554
28587
  }
28555
28588
  //#endregion
28556
28589
  //#region src/utils/actionQueue.js
28557
- var mO = {
28590
+ var vO = {
28558
28591
  wordsSoFar: 0,
28559
28592
  speechStartTime: 0,
28560
28593
  isSpeaking: !1,
@@ -28563,35 +28596,35 @@ var mO = {
28563
28596
  lastHighlightId: null,
28564
28597
  isVoiceMode: !1
28565
28598
  };
28566
- function hO() {
28567
- mO.timers.forEach(clearTimeout), mO.wordsSoFar = 0, mO.speechStartTime = 0, mO.isSpeaking = !1, mO.items = [], mO.timers = [], mO.lastHighlightId = null;
28599
+ function yO() {
28600
+ vO.timers.forEach(clearTimeout), vO.wordsSoFar = 0, vO.speechStartTime = 0, vO.isSpeaking = !1, vO.items = [], vO.timers = [], vO.lastHighlightId = null;
28568
28601
  }
28569
28602
  //#endregion
28570
28603
  //#region src/utils/highlightEngine.js
28571
- var gO = 80;
28572
- function _O(e) {
28604
+ var bO = 80;
28605
+ function xO(e) {
28573
28606
  requestAnimationFrame(() => {
28574
- let t = e.getBoundingClientRect(), n = t.top + t.height / 2, r = gO, i = r + (window.innerHeight - r) / 2, a = window.pageYOffset + n - i;
28607
+ let t = e.getBoundingClientRect(), n = t.top + t.height / 2, r = bO, i = r + (window.innerHeight - r) / 2, a = window.pageYOffset + n - i;
28575
28608
  window.scrollTo({
28576
28609
  top: Math.max(0, a),
28577
28610
  behavior: "smooth"
28578
28611
  });
28579
28612
  });
28580
28613
  }
28581
- function vO(e) {
28614
+ function SO(e) {
28582
28615
  if (!e || e.hasAttribute("data-fe-highlighted")) return;
28583
- yO(), e.classList?.remove("fe-highlight-section", "fe-highlight-speaking", "fe-highlight-exiting"), _O(e);
28616
+ CO(), e.classList?.remove("fe-highlight-section", "fe-highlight-speaking", "fe-highlight-exiting"), xO(e);
28584
28617
  let t = e.style.cssText;
28585
28618
  e.setAttribute("data-fe-highlighted", "true"), e.setAttribute("data-fe-orig-style", t), e.style.outline = "3px solid #2563eb", e.style.outlineOffset = "8px", e.style.background = "rgba(37, 99, 235, 0.08)", e.style.borderRadius = "8px", e.style.padding = "12px 16px", e.style.transition = "all 0.4s ease";
28586
28619
  }
28587
- function yO() {
28620
+ function CO() {
28588
28621
  let e = document.querySelector("[data-fe-highlighted]");
28589
28622
  e && (e.style.cssText = e.getAttribute("data-fe-orig-style") || "", e.removeAttribute("data-fe-highlighted"), e.removeAttribute("data-fe-orig-style"));
28590
28623
  }
28591
28624
  //#endregion
28592
28625
  //#region src/utils/voiceActionVisuals.js
28593
28626
  var Q = "fe-vv";
28594
- function bO() {
28627
+ function wO() {
28595
28628
  if (typeof document > "u" || document.getElementById(`${Q}-styles`)) return;
28596
28629
  let e = `
28597
28630
  /* ── Action toast ───────────────────────────────────────────────────────────── */
@@ -28736,14 +28769,14 @@ function bO() {
28736
28769
  `, t = document.createElement("style");
28737
28770
  t.id = `${Q}-styles`, t.textContent = e, (document.head || document.documentElement).appendChild(t);
28738
28771
  }
28739
- var xO = null, SO = null;
28740
- function CO() {
28741
- return (!xO || !xO.isConnected) && (xO = document.createElement("div"), xO.id = `${Q}-toast`, document.body.appendChild(xO)), xO;
28772
+ var TO = null, EO = null;
28773
+ function DO() {
28774
+ return (!TO || !TO.isConnected) && (TO = document.createElement("div"), TO.id = `${Q}-toast`, document.body.appendChild(TO)), TO;
28742
28775
  }
28743
- function wO(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
28776
+ function OO(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
28744
28777
  if (typeof document > "u") return;
28745
- bO(), SO &&= (clearTimeout(SO), null);
28746
- let i = CO();
28778
+ wO(), EO &&= (clearTimeout(EO), null);
28779
+ let i = DO();
28747
28780
  if (i.innerHTML = "", n) {
28748
28781
  let e = document.createElement("span");
28749
28782
  e.className = `${Q}-icon`, e.textContent = n, i.appendChild(e);
@@ -28752,82 +28785,82 @@ function wO(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
28752
28785
  e.className = `${Q}-spin`, i.appendChild(e);
28753
28786
  }
28754
28787
  let a = document.createElement("span");
28755
- a.textContent = e, i.appendChild(a), i.classList.remove(`${Q}-show`), i.offsetHeight, i.classList.add(`${Q}-show`), r > 0 && (SO = setTimeout(() => TO(), r));
28788
+ a.textContent = e, i.appendChild(a), i.classList.remove(`${Q}-show`), i.offsetHeight, i.classList.add(`${Q}-show`), r > 0 && (EO = setTimeout(() => kO(), r));
28756
28789
  }
28757
- function TO(e = 0) {
28758
- xO && (e > 0 ? SO = setTimeout(() => {
28759
- xO && xO.classList.remove(`${Q}-show`);
28760
- }, e) : xO && xO.classList.remove(`${Q}-show`));
28790
+ function kO(e = 0) {
28791
+ TO && (e > 0 ? EO = setTimeout(() => {
28792
+ TO && TO.classList.remove(`${Q}-show`);
28793
+ }, e) : TO && TO.classList.remove(`${Q}-show`));
28761
28794
  }
28762
- var EO = null, DO = [];
28763
- function OO() {
28764
- return (!EO || !EO.isConnected) && (EO = document.createElement("div"), EO.id = `${Q}-bar`, document.body.appendChild(EO)), EO;
28795
+ var AO = null, jO = [];
28796
+ function MO() {
28797
+ return (!AO || !AO.isConnected) && (AO = document.createElement("div"), AO.id = `${Q}-bar`, document.body.appendChild(AO)), AO;
28765
28798
  }
28766
- function kO() {
28799
+ function NO() {
28767
28800
  if (typeof document > "u") return;
28768
- bO(), DO.forEach(clearTimeout), DO = [];
28769
- let e = OO();
28801
+ wO(), jO.forEach(clearTimeout), jO = [];
28802
+ let e = MO();
28770
28803
  e.style.transition = "none", e.style.width = "0%", e.classList.add(`${Q}-bar-active`), e.offsetHeight, e.style.transition = "width 0.35s ease, opacity 0.25s ease";
28771
28804
  let t = [[80, "width 0.6s ease"], [92, "width 1.2s ease"]], n = 50;
28772
28805
  for (let [e, r] of t) {
28773
28806
  let t = n, i = e, a = r;
28774
- DO.push(setTimeout(() => {
28775
- EO && (EO.style.transition = a, EO.style.width = `${i}%`);
28807
+ jO.push(setTimeout(() => {
28808
+ AO && (AO.style.transition = a, AO.style.width = `${i}%`);
28776
28809
  }, t)), n += 800;
28777
28810
  }
28778
28811
  }
28779
- function AO() {
28780
- EO && (DO.forEach(clearTimeout), DO = [], EO.style.transition = "width 0.2s ease", EO.style.width = "100%", DO.push(setTimeout(() => {
28781
- EO && (EO.style.transition = "opacity 0.35s ease", EO.style.opacity = "0", DO.push(setTimeout(() => {
28782
- EO && (EO.style.width = "0%", EO.classList.remove(`${Q}-bar-active`));
28812
+ function PO() {
28813
+ AO && (jO.forEach(clearTimeout), jO = [], AO.style.transition = "width 0.2s ease", AO.style.width = "100%", jO.push(setTimeout(() => {
28814
+ AO && (AO.style.transition = "opacity 0.35s ease", AO.style.opacity = "0", jO.push(setTimeout(() => {
28815
+ AO && (AO.style.width = "0%", AO.classList.remove(`${Q}-bar-active`));
28783
28816
  }, 380)));
28784
28817
  }, 220)));
28785
28818
  }
28786
- function jO() {
28819
+ function FO() {
28787
28820
  typeof document > "u" || document.querySelectorAll(`.${Q}-field-active, .${Q}-field-filled`).forEach((e) => e.classList.remove(`${Q}-field-active`, `${Q}-field-filled`));
28788
28821
  }
28789
- function MO(e) {
28790
- !e || typeof document > "u" || (bO(), jO(), e.classList.add(`${Q}-field-active`));
28822
+ function IO(e) {
28823
+ !e || typeof document > "u" || (wO(), FO(), e.classList.add(`${Q}-field-active`));
28791
28824
  }
28792
- function NO(e) {
28825
+ function LO(e) {
28793
28826
  e && (e.classList.remove(`${Q}-field-active`), e.classList.add(`${Q}-field-filled`), setTimeout(() => {
28794
28827
  e.isConnected && e.classList.remove(`${Q}-field-filled`);
28795
28828
  }, 1400));
28796
28829
  }
28797
- var PO = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
28830
+ var RO = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
28798
28831
  <filter id="${Q}-csh">
28799
28832
  <feDropShadow dx="1" dy="2" stdDeviation="1.5" flood-color="#00000060"/>
28800
28833
  </filter>
28801
28834
  <path d="M4 2L19 10.5L11 12.8L8 20L4 2Z"
28802
28835
  fill="white" stroke="#1e1b4b" stroke-width="1.6" stroke-linejoin="round"
28803
28836
  filter="url(#${Q}-csh)"/>
28804
- </svg>`, FO = null, IO = !1;
28805
- function LO() {
28806
- return (!FO || !FO.isConnected) && (FO = document.createElement("div"), FO.id = `${Q}-cursor`, FO.innerHTML = PO, document.body.appendChild(FO), IO = !1), FO;
28837
+ </svg>`, zO = null, BO = !1;
28838
+ function VO() {
28839
+ return (!zO || !zO.isConnected) && (zO = document.createElement("div"), zO.id = `${Q}-cursor`, zO.innerHTML = RO, document.body.appendChild(zO), BO = !1), zO;
28807
28840
  }
28808
- async function RO(e) {
28841
+ async function HO(e) {
28809
28842
  if (typeof document > "u" || !e) return;
28810
- bO();
28843
+ wO();
28811
28844
  let t;
28812
28845
  try {
28813
28846
  t = e.getBoundingClientRect();
28814
28847
  } catch {
28815
28848
  return;
28816
28849
  }
28817
- let n = t.left + Math.min(16, t.width * .2), r = t.top + Math.min(12, t.height * .25), i = LO();
28818
- IO ||= (i.style.transition = "none", i.style.left = `${window.innerWidth / 2}px`, i.style.top = `${window.innerHeight * .4}px`, i.classList.add(`${Q}-cursor-visible`), i.offsetHeight, i.style.transition = "left 0.32s cubic-bezier(0.25,0.46,0.45,0.94), top 0.32s cubic-bezier(0.25,0.46,0.45,0.94), opacity 0.2s ease", !0), i.style.left = `${n}px`, i.style.top = `${r}px`, await HO(360);
28850
+ let n = t.left + Math.min(16, t.width * .2), r = t.top + Math.min(12, t.height * .25), i = VO();
28851
+ BO ||= (i.style.transition = "none", i.style.left = `${window.innerWidth / 2}px`, i.style.top = `${window.innerHeight * .4}px`, i.classList.add(`${Q}-cursor-visible`), i.offsetHeight, i.style.transition = "left 0.32s cubic-bezier(0.25,0.46,0.45,0.94), top 0.32s cubic-bezier(0.25,0.46,0.45,0.94), opacity 0.2s ease", !0), i.style.left = `${n}px`, i.style.top = `${r}px`, await KO(360);
28819
28852
  }
28820
- function zO(e = !1) {
28821
- FO && (e ? (FO.classList.remove(`${Q}-cursor-visible`), IO = !1) : (FO.classList.remove(`${Q}-cursor-visible`), setTimeout(() => {
28822
- IO = !1;
28853
+ function UO(e = !1) {
28854
+ zO && (e ? (zO.classList.remove(`${Q}-cursor-visible`), BO = !1) : (zO.classList.remove(`${Q}-cursor-visible`), setTimeout(() => {
28855
+ BO = !1;
28823
28856
  }, 250)));
28824
28857
  }
28825
- async function BO(e) {
28826
- FO && (FO.classList.add(`${Q}-cursor-click`), await HO(280), FO.classList.remove(`${Q}-cursor-click`));
28858
+ async function WO(e) {
28859
+ zO && (zO.classList.add(`${Q}-cursor-click`), await KO(280), zO.classList.remove(`${Q}-cursor-click`));
28827
28860
  }
28828
- function VO(e) {
28861
+ function GO(e) {
28829
28862
  if (!e || typeof document > "u") return;
28830
- bO();
28863
+ wO();
28831
28864
  let t;
28832
28865
  try {
28833
28866
  t = e.getBoundingClientRect();
@@ -28853,7 +28886,7 @@ function VO(e) {
28853
28886
  a.remove(), e.style.position = n, e.style.overflow = r;
28854
28887
  }, 650);
28855
28888
  }
28856
- function HO(e) {
28889
+ function KO(e) {
28857
28890
  return new Promise((t) => setTimeout(t, e));
28858
28891
  }
28859
28892
  //#endregion
@@ -28861,10 +28894,10 @@ function HO(e) {
28861
28894
  function $(...e) {
28862
28895
  jn() && console.log("[FlowEngage:voice-tools]", ...e);
28863
28896
  }
28864
- function UO(e) {
28897
+ function qO(e) {
28865
28898
  return new Promise((t) => setTimeout(t, e));
28866
28899
  }
28867
- function WO(e = 3e3) {
28900
+ function JO(e = 3e3) {
28868
28901
  return new Promise((t) => {
28869
28902
  if (typeof document > "u") {
28870
28903
  t();
@@ -28886,7 +28919,7 @@ function WO(e = 3e3) {
28886
28919
  }, e);
28887
28920
  });
28888
28921
  }
28889
- function GO({ expectedSelectors: e = [], minContentNodes: t = 20, maxWait: n = 4e3, pollInterval: r = 300 } = {}) {
28922
+ function YO({ expectedSelectors: e = [], minContentNodes: t = 20, maxWait: n = 4e3, pollInterval: r = 300 } = {}) {
28890
28923
  return new Promise((i) => {
28891
28924
  if (typeof document > "u") {
28892
28925
  i({
@@ -28936,39 +28969,39 @@ function GO({ expectedSelectors: e = [], minContentNodes: t = 20, maxWait: n = 4
28936
28969
  }
28937
28970
  });
28938
28971
  }
28939
- var KO = "#flowengage-root, .flowengage-shell, .flowengage-widget-root";
28940
- function qO(e) {
28972
+ var XO = "#flowengage-root, .flowengage-shell, .flowengage-widget-root";
28973
+ function ZO(e) {
28941
28974
  if (!e || typeof e.closest != "function") return !1;
28942
28975
  try {
28943
- return !!e.closest(KO);
28976
+ return !!e.closest(XO);
28944
28977
  } catch {
28945
28978
  return !1;
28946
28979
  }
28947
28980
  }
28948
- function JO(e) {
28981
+ function QO(e) {
28949
28982
  try {
28950
28983
  let t = e.ownerDocument?.defaultView;
28951
28984
  if (t) return t.getComputedStyle(e);
28952
28985
  } catch {}
28953
28986
  return window.getComputedStyle(e);
28954
28987
  }
28955
- function YO(e) {
28988
+ function $O(e) {
28956
28989
  let t = /* @__PURE__ */ new Set();
28957
28990
  function n(r) {
28958
28991
  if (!r || t.has(r)) return;
28959
28992
  t.add(r), e(r);
28960
28993
  let i = r.querySelectorAll("iframe");
28961
- for (let e of i) if (!qO(e)) try {
28994
+ for (let e of i) if (!ZO(e)) try {
28962
28995
  let t = e.contentDocument;
28963
28996
  t && n(t);
28964
28997
  } catch {}
28965
28998
  }
28966
28999
  typeof document < "u" && n(document);
28967
29000
  }
28968
- function XO(e) {
29001
+ function ek(e) {
28969
29002
  return e == null ? null : String(e).replace(/\u00a0/g, " ").replace(/\s*\*+\s*$/u, "").replace(/\s+/g, " ").trim();
28970
29003
  }
28971
- function ZO(e) {
29004
+ function tk(e) {
28972
29005
  let t = e.ownerDocument || document, n = e.getAttribute("aria-labelledby");
28973
29006
  if (n) {
28974
29007
  let e = n.trim().split(/\s+/).filter(Boolean), r = [];
@@ -28976,42 +29009,42 @@ function ZO(e) {
28976
29009
  let e = t.getElementById(n);
28977
29010
  e?.textContent && r.push(e.textContent.trim());
28978
29011
  } catch {}
28979
- if (r.length) return XO(r.join(" "));
29012
+ if (r.length) return ek(r.join(" "));
28980
29013
  }
28981
- if (e.labels && e.labels.length) return XO(e.labels[0].textContent);
29014
+ if (e.labels && e.labels.length) return ek(e.labels[0].textContent);
28982
29015
  let r = e.id;
28983
29016
  if (r) try {
28984
29017
  let e = t.querySelector(`label[for="${CSS.escape(r)}"]`);
28985
- if (e) return XO(e.textContent);
29018
+ if (e) return ek(e.textContent);
28986
29019
  } catch {
28987
29020
  let e = t.querySelector(`label[for="${r.replace(/"/g, "\\\"")}"]`);
28988
- if (e) return XO(e.textContent);
29021
+ if (e) return ek(e.textContent);
28989
29022
  }
28990
29023
  let i = e.previousElementSibling;
28991
29024
  for (let e = 0; e < 6 && i; e += 1) {
28992
- if (i.tagName === "LABEL") return XO(i.textContent);
29025
+ if (i.tagName === "LABEL") return ek(i.textContent);
28993
29026
  let e = (i.className || "").toString().toLowerCase();
28994
29027
  if (/chakra-form__label|formlabel|field-label|form-label|mui-form-label/.test(e)) {
28995
- let e = XO(i.textContent);
29028
+ let e = ek(i.textContent);
28996
29029
  if (e) return e;
28997
29030
  }
28998
29031
  i = i.previousElementSibling;
28999
29032
  }
29000
29033
  let a = e.parentElement;
29001
29034
  for (let e = 0; e < 5 && a; e += 1) {
29002
- if (a.tagName === "LABEL") return XO(a.textContent);
29035
+ if (a.tagName === "LABEL") return ek(a.textContent);
29003
29036
  let e = a.querySelector?.(":scope > label, :scope > [class*='FormLabel'], :scope > [class*='form__label']");
29004
- if (e?.textContent) return XO(e.textContent);
29037
+ if (e?.textContent) return ek(e.textContent);
29005
29038
  a = a.parentElement;
29006
29039
  }
29007
29040
  let o = e.getAttribute("aria-label");
29008
- return o ? XO(o) : null;
29041
+ return o ? ek(o) : null;
29009
29042
  }
29010
- function QO() {
29043
+ function nk() {
29011
29044
  let e = [];
29012
- return YO((t) => {
29045
+ return $O((t) => {
29013
29046
  e.push(...Array.from(t.querySelectorAll("input, select, textarea")).filter((e) => {
29014
- if (qO(e)) return !1;
29047
+ if (ZO(e)) return !1;
29015
29048
  let t = (e.type || "").toLowerCase();
29016
29049
  if ([
29017
29050
  "hidden",
@@ -29020,32 +29053,32 @@ function QO() {
29020
29053
  "image"
29021
29054
  ].includes(t) || e.disabled || e.readOnly) return !1;
29022
29055
  try {
29023
- let t = JO(e);
29056
+ let t = QO(e);
29024
29057
  if (t.display === "none" || t.visibility === "hidden") return !1;
29025
29058
  } catch {}
29026
29059
  return !0;
29027
29060
  }));
29028
29061
  }), e;
29029
29062
  }
29030
- function $O() {
29031
- return QO().map((e, t) => ({
29063
+ function rk() {
29064
+ return nk().map((e, t) => ({
29032
29065
  formIndex: 0,
29033
29066
  fieldIndex: t,
29034
29067
  tag: e.tagName,
29035
29068
  type: e.type || "text",
29036
29069
  name: e.name || null,
29037
29070
  id: e.id || null,
29038
- label: ZO(e),
29071
+ label: tk(e),
29039
29072
  placeholder: e.placeholder || null
29040
29073
  }));
29041
29074
  }
29042
- function ek() {
29075
+ function ik() {
29043
29076
  let e = [];
29044
- return YO((t) => {
29077
+ return $O((t) => {
29045
29078
  e.push(...Array.from(t.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
29046
- if (qO(e) || e.disabled) return !1;
29079
+ if (ZO(e) || e.disabled) return !1;
29047
29080
  try {
29048
- let t = JO(e);
29081
+ let t = QO(e);
29049
29082
  if (t.display === "none" || t.visibility === "hidden") return !1;
29050
29083
  } catch {}
29051
29084
  return !0;
@@ -29057,15 +29090,15 @@ function ek() {
29057
29090
  type: e.type || e.tagName
29058
29091
  }));
29059
29092
  }
29060
- function tk(e) {
29093
+ function ak(e) {
29061
29094
  return String(e || "").toLowerCase().replace(/\u00a0/g, " ").replace(/\*/g, "").replace(/\s+/g, " ").trim();
29062
29095
  }
29063
- function nk(e) {
29064
- let t = tk(e);
29096
+ function ok(e) {
29097
+ let t = ak(e);
29065
29098
  return t = t.replace(/\s+field\s*$/i, "").trim(), t;
29066
29099
  }
29067
- function rk(e, t) {
29068
- let n = nk(t);
29100
+ function sk(e, t) {
29101
+ let n = ok(t);
29069
29102
  if (!n) return 0;
29070
29103
  let r = (e.name || "").toLowerCase(), i = (e.id || "").toLowerCase();
29071
29104
  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;
@@ -29073,12 +29106,12 @@ function rk(e, t) {
29073
29106
  e.name,
29074
29107
  e.id,
29075
29108
  e.placeholder,
29076
- ZO(e),
29109
+ tk(e),
29077
29110
  e.getAttribute("aria-label"),
29078
29111
  e.getAttribute("title"),
29079
29112
  e.getAttribute("data-testid"),
29080
29113
  e.getAttribute("autocomplete")
29081
- ].filter(Boolean).map((e) => tk(e)), o = 0;
29114
+ ].filter(Boolean).map((e) => ak(e)), o = 0;
29082
29115
  for (let e of a) {
29083
29116
  if (!e) continue;
29084
29117
  if (e.includes(n) || n.includes(e)) {
@@ -29093,16 +29126,16 @@ function rk(e, t) {
29093
29126
  }
29094
29127
  return o;
29095
29128
  }
29096
- var ik = 28;
29097
- function ak(e, t) {
29129
+ var ck = 28;
29130
+ function lk(e, t) {
29098
29131
  let n = null, r = 0;
29099
29132
  for (let i of e) {
29100
- let e = rk(i, t);
29133
+ let e = sk(i, t);
29101
29134
  e > r && (r = e, n = i);
29102
29135
  }
29103
- return !n || r < ik ? null : n;
29136
+ return !n || r < ck ? null : n;
29104
29137
  }
29105
- function ok(e, t, n) {
29138
+ function uk(e, t, n) {
29106
29139
  let r = String(t || "").toLowerCase().trim(), i = String(n || "").trim();
29107
29140
  if (!(/^https?:\/\//i.test(i) || /\.\w{2,}(\/|\s|$)/.test(i) || r.includes("url") || r.includes("website") || r.includes("domain") || r.includes("site"))) return null;
29108
29141
  let a = null, o = 0;
@@ -29122,7 +29155,7 @@ function ok(e, t, n) {
29122
29155
  t.name,
29123
29156
  t.id,
29124
29157
  t.placeholder,
29125
- ZO(t),
29158
+ tk(t),
29126
29159
  t.getAttribute("aria-label"),
29127
29160
  t.getAttribute("autocomplete")
29128
29161
  ].filter(Boolean).join(" ").toLowerCase();
@@ -29130,15 +29163,15 @@ function ok(e, t, n) {
29130
29163
  }
29131
29164
  return !a || o < 42 ? null : a;
29132
29165
  }
29133
- function sk(e) {
29166
+ function dk(e) {
29134
29167
  let t = String(e ?? "").trim();
29135
29168
  return t ? /^https?:\/\//i.test(t) ? !0 : /\.\w{2,}(\/|\s|$)/.test(t) : !1;
29136
29169
  }
29137
- function ck(e) {
29170
+ function fk(e) {
29138
29171
  let t = String(e ?? "").toLowerCase().trim();
29139
29172
  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;
29140
29173
  }
29141
- function lk(e) {
29174
+ function pk(e) {
29142
29175
  if (!e || e.tagName !== "INPUT" && e.tagName !== "TEXTAREA") return !1;
29143
29176
  let t = (e.type || "").toLowerCase();
29144
29177
  return ![
@@ -29150,22 +29183,22 @@ function lk(e) {
29150
29183
  "file"
29151
29184
  ].includes(t);
29152
29185
  }
29153
- function uk(e) {
29154
- if (!lk(e)) return !1;
29186
+ function mk(e) {
29187
+ if (!pk(e)) return !1;
29155
29188
  let t = (e.name || "").toLowerCase(), n = (e.id || "").toLowerCase(), r = [
29156
29189
  e.name,
29157
29190
  e.id,
29158
29191
  e.placeholder,
29159
- ZO(e),
29192
+ tk(e),
29160
29193
  e.getAttribute("aria-label")
29161
29194
  ].filter(Boolean).join(" ").toLowerCase();
29162
29195
  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);
29163
29196
  }
29164
- function dk(e, t, n) {
29165
- let r = String(t ?? ""), i = String(n ?? ""), a = mk(e, r) || ak(e, r) || ok(e, r, i);
29197
+ function hk(e, t, n) {
29198
+ let r = String(t ?? ""), i = String(n ?? ""), a = vk(e, r) || lk(e, r) || uk(e, r, i);
29166
29199
  if (!a) return [];
29167
29200
  let o = new Set([a]);
29168
- if (sk(i) && ck(r)) for (let t of e) t !== a && uk(t) && o.add(t);
29201
+ if (dk(i) && fk(r)) for (let t of e) t !== a && mk(t) && o.add(t);
29169
29202
  let s = Array.from(o);
29170
29203
  return s.sort((e, t) => {
29171
29204
  if (e === t) return 0;
@@ -29173,7 +29206,7 @@ function dk(e, t, n) {
29173
29206
  return n & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : n & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
29174
29207
  }), s;
29175
29208
  }
29176
- function fk(e, t) {
29209
+ function gk(e, t) {
29177
29210
  try {
29178
29211
  if (!e?.getBoundingClientRect || !t?.getBoundingClientRect) return Infinity;
29179
29212
  let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = {
@@ -29188,17 +29221,17 @@ function fk(e, t) {
29188
29221
  return Infinity;
29189
29222
  }
29190
29223
  }
29191
- function pk(e) {
29224
+ function _k(e) {
29192
29225
  if (!e || typeof e != "string") return null;
29193
29226
  let t = null;
29194
- return YO((n) => {
29227
+ return $O((n) => {
29195
29228
  try {
29196
29229
  let r = n.getElementById(e);
29197
- r && !qO(r) && r.matches?.("input, select, textarea") && (t = r);
29230
+ r && !ZO(r) && r.matches?.("input, select, textarea") && (t = r);
29198
29231
  } catch {}
29199
29232
  }), t;
29200
29233
  }
29201
- function mk(e, t) {
29234
+ function vk(e, t) {
29202
29235
  let n = String(t ?? "").trim();
29203
29236
  if (!n) return null;
29204
29237
  let r = n.match(/^name:\s*([\w.-]+)$/i);
@@ -29208,12 +29241,12 @@ function mk(e, t) {
29208
29241
  }
29209
29242
  let i = n.match(/^id:\s*([\w.-]+)$/i);
29210
29243
  if (i) {
29211
- let e = pk(i[1]);
29244
+ let e = _k(i[1]);
29212
29245
  if (e) return e;
29213
29246
  }
29214
29247
  let a = n.startsWith("#") ? n.slice(1) : n;
29215
29248
  if (/^[\w-]+$/.test(a)) {
29216
- let e = pk(a);
29249
+ let e = _k(a);
29217
29250
  if (e) return e;
29218
29251
  }
29219
29252
  let o = n.toLowerCase().replace(/\s+/g, " ");
@@ -29223,7 +29256,7 @@ function mk(e, t) {
29223
29256
  }
29224
29257
  return null;
29225
29258
  }
29226
- function hk(e, t) {
29259
+ function yk(e, t) {
29227
29260
  let n = String(t || "").toLowerCase().trim();
29228
29261
  if (!n) return 0;
29229
29262
  let r = [
@@ -29239,13 +29272,13 @@ function hk(e, t) {
29239
29272
  for (let e of i) r.includes(e) && (a += 1);
29240
29273
  return a / i.length * 92;
29241
29274
  }
29242
- function gk(e, t) {
29275
+ function bk(e, t) {
29243
29276
  let n = [];
29244
- YO((e) => {
29277
+ $O((e) => {
29245
29278
  n.push(...Array.from(e.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
29246
- if (qO(e) || e.disabled) return !1;
29279
+ if (ZO(e) || e.disabled) return !1;
29247
29280
  try {
29248
- let t = JO(e);
29281
+ let t = QO(e);
29249
29282
  if (t.display === "none" || t.visibility === "hidden") return !1;
29250
29283
  } catch {}
29251
29284
  return !0;
@@ -29253,7 +29286,7 @@ function gk(e, t) {
29253
29286
  });
29254
29287
  let r = 0, i = n.map((t) => ({
29255
29288
  el: t,
29256
- s: hk(t, e)
29289
+ s: yk(t, e)
29257
29290
  }));
29258
29291
  for (let { s: e } of i) e > r && (r = e);
29259
29292
  if (r < 36) return null;
@@ -29263,14 +29296,14 @@ function gk(e, t) {
29263
29296
  if (o.length) {
29264
29297
  let e = a[0], t = Infinity;
29265
29298
  for (let n of a) for (let r of o) {
29266
- let i = fk(n, r);
29299
+ let i = gk(n, r);
29267
29300
  i < t && (t = i, e = n);
29268
29301
  }
29269
29302
  return e;
29270
29303
  }
29271
29304
  return a[0];
29272
29305
  }
29273
- function _k(e) {
29306
+ function xk(e) {
29274
29307
  if (e == null) return {};
29275
29308
  if (typeof e == "string") {
29276
29309
  let t = e.trim();
@@ -29283,8 +29316,8 @@ function _k(e) {
29283
29316
  }
29284
29317
  return e;
29285
29318
  }
29286
- function vk(e) {
29287
- let t = _k(e);
29319
+ function Sk(e) {
29320
+ let t = xk(e);
29288
29321
  if (Array.isArray(t) && t.length > 0) {
29289
29322
  let e = t[0];
29290
29323
  if (e?.field_key != null || e?.fieldKey != null) return t.map((e) => ({
@@ -29312,7 +29345,7 @@ function vk(e) {
29312
29345
  value: e?.value ?? e?.Value
29313
29346
  })) : [];
29314
29347
  }
29315
- function yk(e) {
29348
+ function Ck(e) {
29316
29349
  if (!e || typeof e != "string") return [];
29317
29350
  let t = e.trim();
29318
29351
  if (!t || /\b[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}\b/i.test(t)) return [];
@@ -29331,7 +29364,7 @@ function yk(e) {
29331
29364
  }
29332
29365
  return [];
29333
29366
  }
29334
- function bk(e) {
29367
+ function wk(e) {
29335
29368
  if (!e || typeof e != "string") return [];
29336
29369
  let t = e.trim();
29337
29370
  if (!t) return [];
@@ -29367,17 +29400,17 @@ function bk(e) {
29367
29400
  }
29368
29401
  return n;
29369
29402
  }
29370
- function xk(e) {
29403
+ function Tk(e) {
29371
29404
  if (!e || typeof e != "object") return null;
29372
29405
  let t = e.url ?? e.target_url ?? e.page_url ?? e.pageUrl ?? e.link ?? e.href ?? e.path;
29373
29406
  return t == null ? null : String(t).trim() || null;
29374
29407
  }
29375
- function Sk(e) {
29408
+ function Ek(e) {
29376
29409
  if (!e || typeof e != "object") return null;
29377
29410
  let t = e.query ?? e.q ?? e.search ?? e.text ?? e.keywords;
29378
29411
  return t == null ? null : String(t).trim() || null;
29379
29412
  }
29380
- function Ck(e, t, n) {
29413
+ function Dk(e, t, n) {
29381
29414
  if (!n?.skipScroll) try {
29382
29415
  e.scrollIntoView({
29383
29416
  block: "center",
@@ -29432,7 +29465,7 @@ function Ck(e, t, n) {
29432
29465
  } catch {}
29433
29466
  return !0;
29434
29467
  }
29435
- function wk() {
29468
+ function Ok() {
29436
29469
  let e = {};
29437
29470
  document.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((t) => {
29438
29471
  if (t.id) return;
@@ -29447,11 +29480,11 @@ function wk() {
29447
29480
  e[r] = !0, t.id = r;
29448
29481
  });
29449
29482
  }
29450
- function Tk(e) {
29483
+ function kk(e) {
29451
29484
  let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, ""), r = typeof e.getLastUserVoiceText == "function" ? e.getLastUserVoiceText : null, i = [], a = {
29452
29485
  flowengage_navigate: async (n) => {
29453
29486
  $("flowengage_navigate ▶ raw parameters:", n);
29454
- 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 : [];
29487
+ let i = xk(n), a = Tk(i), o = i.section_text ?? i.sectionText ?? i.section, s = Array.isArray(i.expected_landmarks) ? i.expected_landmarks : Array.isArray(i.expectedLandmarks) ? i.expectedLandmarks : [];
29455
29488
  if ($("flowengage_navigate · coerced:", {
29456
29489
  url: a,
29457
29490
  sectionText: o,
@@ -29472,16 +29505,16 @@ function Tk(e) {
29472
29505
  return $("flowengage_navigate ✖ blocked", e), e;
29473
29506
  }
29474
29507
  try {
29475
- if (wO(`Navigating to ${a}...`, { spinner: !0 }), kO(), hO(), yO(), $("flowengage_navigate → shadowNavigate", a), !await hr(a, {
29508
+ if (OO(`Navigating to ${a}...`, { spinner: !0 }), NO(), yO(), CO(), $("flowengage_navigate → shadowNavigate", a), !await hr(a, {
29476
29509
  sectionText: typeof o == "string" ? o : void 0,
29477
29510
  voiceActive: !0
29478
- })) return $("flowengage_navigate ✖ SPA body-swap failed — staying on current page"), wO("Page swap failed", {
29511
+ })) return $("flowengage_navigate ✖ SPA body-swap failed — staying on current page"), OO("Page swap failed", {
29479
29512
  spinner: !1,
29480
29513
  icon: "⚠️",
29481
29514
  duration: 1500
29482
29515
  }), `Could not navigate to ${a} without breaking the voice session. Use flowengage_search to find information about this topic, then answer from the search results. Do NOT tell the user navigation failed — just answer their question.`;
29483
- await WO();
29484
- let e = await GO({
29516
+ await JO();
29517
+ let e = await YO({
29485
29518
  expectedSelectors: s,
29486
29519
  minContentNodes: 20,
29487
29520
  maxWait: 4e3
@@ -29490,14 +29523,14 @@ function Tk(e) {
29490
29523
  try {
29491
29524
  let e = r ? r() : "";
29492
29525
  if (e && t) {
29493
- let n = pO([{
29526
+ let n = _O([{
29494
29527
  sender: "user",
29495
29528
  message: e
29496
29529
  }]);
29497
29530
  n && Oe(t, n);
29498
29531
  }
29499
29532
  } catch {}
29500
- return Me(), wO("Reloading page…", {
29533
+ return Me(), OO("Reloading page…", {
29501
29534
  spinner: !0,
29502
29535
  duration: 1500
29503
29536
  }), $("flowengage_navigate → hydration failed, forcing reload to", a), setTimeout(() => {
@@ -29506,42 +29539,42 @@ function Tk(e) {
29506
29539
  } catch {}
29507
29540
  }, 150), "OK_NAVIGATE_RELOADING. Page needs a full reload to finish loading; the session will resume automatically. Do not speak until the user speaks first.";
29508
29541
  }
29509
- if (wk(), o && typeof o == "string") {
29542
+ if (Ok(), o && typeof o == "string") {
29510
29543
  let e = null;
29511
- for (let t = 0; t < 5 && !e; t++) e = ar(null, o), e || await UO(300);
29512
- e && vO(e), $("flowengage_navigate · highlight", {
29544
+ for (let t = 0; t < 5 && !e; t++) e = ar(null, o), e || await qO(300);
29545
+ e && SO(e), $("flowengage_navigate · highlight", {
29513
29546
  sectionText: o,
29514
29547
  found: !!e,
29515
29548
  attempts: e ? "ok" : 5
29516
29549
  });
29517
29550
  }
29518
29551
  let n = Array.from(document.querySelectorAll("h1, h2, h3, h4")).filter((e) => !e.closest("#flowengage-root, .flowengage-shell, nav, footer, header")).map((e) => e.textContent.trim()).filter((e) => e.length > 0 && e.length < 150).slice(0, 20), i = `OK_NAVIGATION ${a}. Page sections: ${JSON.stringify(n)}. For each section: call flowengage_highlight, speak 2-3 sentences about ONLY that section, then highlight the next. One section per speech turn.`;
29519
- return $("flowengage_navigate ✓", i), wO("Navigation complete", {
29552
+ return $("flowengage_navigate ✓", i), OO("Navigation complete", {
29520
29553
  spinner: !1,
29521
29554
  icon: "✅",
29522
29555
  duration: 1200
29523
29556
  }), i;
29524
29557
  } catch (e) {
29525
29558
  let t = `Navigation error: ${e?.message || String(e)}`;
29526
- return $("flowengage_navigate ✖", t), wO("Navigation failed", {
29559
+ return $("flowengage_navigate ✖", t), OO("Navigation failed", {
29527
29560
  spinner: !1,
29528
29561
  icon: "⚠️",
29529
29562
  duration: 1800
29530
29563
  }), t;
29531
29564
  } finally {
29532
- AO(), TO(900);
29565
+ PO(), kO(900);
29533
29566
  }
29534
29567
  },
29535
29568
  flowengage_highlight: async (e) => {
29536
29569
  $("flowengage_highlight ▶", e);
29537
- let t = _k(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText;
29538
- wk();
29570
+ let t = xk(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText;
29571
+ Ok();
29539
29572
  let i = ar(n || null, r || null);
29540
- return !i && r && (await new Promise((e) => setTimeout(e, 500)), wk(), i = ar(null, r)), i ? (vO(i), $("flowengage_highlight ✓", r || n), `OK_HIGHLIGHT: "${r || n}"`) : ($("flowengage_highlight ✖ no element for:", r || n), `Could not find "${r || n}" on the current page. Try a shorter phrase matching a visible heading.`);
29573
+ return !i && r && (await new Promise((e) => setTimeout(e, 500)), Ok(), i = ar(null, r)), i ? (SO(i), $("flowengage_highlight ✓", r || n), `OK_HIGHLIGHT: "${r || n}"`) : ($("flowengage_highlight ✖ no element for:", r || n), `Could not find "${r || n}" on the current page. Try a shorter phrase matching a visible heading.`);
29541
29574
  },
29542
29575
  flowengage_read_content: async (e) => {
29543
29576
  $("flowengage_read_content ▶", e);
29544
- let t = _k(e), n = t?.section_text || t?.sectionText || "";
29577
+ let t = xk(e), n = t?.section_text || t?.sectionText || "";
29545
29578
  try {
29546
29579
  let e = "";
29547
29580
  if (n) {
@@ -29564,7 +29597,7 @@ function Tk(e) {
29564
29597
  },
29565
29598
  flowengage_search: async (e) => {
29566
29599
  $("flowengage_search ▶", e);
29567
- let r = Sk(_k(e));
29600
+ let r = Ek(xk(e));
29568
29601
  if ($("flowengage_search · query:", r, "siteId:", t, "apiBase:", n || "(empty)"), !r) return $("flowengage_search ✖ missing query"), "Missing query parameter.";
29569
29602
  if (!t) return $("flowengage_search ✖ no siteId"), "Site is not configured for search.";
29570
29603
  if (!n) return $("flowengage_search ✖ no api base"), "API base URL is missing; cannot search.";
@@ -29593,7 +29626,7 @@ function Tk(e) {
29593
29626
  },
29594
29627
  flowengage_page_content: async (e) => {
29595
29628
  $("flowengage_page_content ▶", e);
29596
- let r = _k(e), i = r?.url || r?.page_url || "";
29629
+ let r = xk(e), i = r?.url || r?.page_url || "";
29597
29630
  if ($("flowengage_page_content · url:", i, "siteId:", t, "apiBase:", n || "(empty)"), !i) return $("flowengage_page_content ✖ missing url"), "Missing url parameter.";
29598
29631
  if (!t) return $("flowengage_page_content ✖ no siteId"), "Site is not configured.";
29599
29632
  if (!n) return $("flowengage_page_content ✖ no api base"), "API base URL is missing; cannot fetch page content.";
@@ -29625,7 +29658,7 @@ function Tk(e) {
29625
29658
  },
29626
29659
  flowengage_end_session: async () => ($("flowengage_end_session ▶"), typeof e.requestEndSession == "function" && e.requestEndSession(), "Voice session is ending."),
29627
29660
  flowengage_list_forms: async () => {
29628
- let e = $O(), t = ek();
29661
+ let e = rk(), t = ik();
29629
29662
  return $("flowengage_list_forms ✓", `${e.length} field(s)`, `${t.length} button(s)`), JSON.stringify({
29630
29663
  fields: e,
29631
29664
  buttons: t,
@@ -29634,52 +29667,52 @@ function Tk(e) {
29634
29667
  },
29635
29668
  flowengage_fill_form: async (e) => {
29636
29669
  try {
29637
- $("flowengage_fill_form ▶ raw:", e), jO();
29638
- let t = vk(e);
29670
+ $("flowengage_fill_form ▶ raw:", e), FO();
29671
+ let t = Sk(e);
29639
29672
  if (!t.length && r) {
29640
- let e = r(), n = yk(e);
29641
- 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);
29673
+ let e = r(), n = Ck(e);
29674
+ n.length ? $("flowengage_fill_form · inferred URL from last user utterance (model omitted usable fields):", n) : (n = wk(e), n.length && $("flowengage_fill_form · inferred contact fields from last user utterance (empty tool params):", n)), n.length && (t = n);
29642
29675
  }
29643
29676
  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.";
29644
29677
  let n = [];
29645
29678
  for (let e of t) {
29646
29679
  let t = e?.field_key ?? e?.fieldKey, r = e?.value;
29647
29680
  if (t == null || r == null) continue;
29648
- wO(`Filling ${String(t)}...`, { spinner: !0 });
29649
- let a = QO(), o = dk(a, String(t), r);
29681
+ OO(`Filling ${String(t)}...`, { spinner: !0 });
29682
+ let a = nk(), o = hk(a, String(t), r);
29650
29683
  if (o.length) {
29651
- for (let [e, t] of o.entries()) MO(t), await RO(t), Ck(t, r, { skipScroll: e > 0 }), NO(t), await UO(120);
29684
+ for (let [e, t] of o.entries()) IO(t), await HO(t), Dk(t, r, { skipScroll: e > 0 }), LO(t), await qO(120);
29652
29685
  i = o, n.push(String(t));
29653
29686
  continue;
29654
29687
  }
29655
- let s = mk(a, String(t));
29656
- s ||= ak(a, String(t)), s ||= ok(a, String(t), r), s && (MO(s), await RO(s), Ck(s, r), NO(s), await UO(120), i = [s], n.push(String(t)));
29688
+ let s = vk(a, String(t));
29689
+ s ||= lk(a, String(t)), s ||= uk(a, String(t), r), s && (IO(s), await HO(s), Dk(s, r), LO(s), await qO(120), i = [s], n.push(String(t)));
29657
29690
  }
29658
29691
  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.";
29659
29692
  let a = `OK_FILLED: ${n.join(", ")}`;
29660
- return $("flowengage_fill_form ✓", a), wO("Form filled", {
29693
+ return $("flowengage_fill_form ✓", a), OO("Form filled", {
29661
29694
  spinner: !1,
29662
29695
  icon: "✅",
29663
29696
  duration: 1100
29664
29697
  }), a;
29665
29698
  } catch (e) {
29666
29699
  let t = `flowengage_fill_form error: ${e?.message || String(e)}`;
29667
- return $("flowengage_fill_form ✖", t), wO("Failed to fill form", {
29700
+ return $("flowengage_fill_form ✖", t), OO("Failed to fill form", {
29668
29701
  spinner: !1,
29669
29702
  icon: "⚠️",
29670
29703
  duration: 1800
29671
29704
  }), t;
29672
29705
  } finally {
29673
- zO(), jO(), TO(700);
29706
+ UO(), FO(), kO(700);
29674
29707
  }
29675
29708
  },
29676
29709
  flowengage_click_button: async (e) => {
29677
- let t = _k(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim();
29710
+ let t = xk(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim();
29678
29711
  if ($("flowengage_click_button ▶", n), !n) return "Missing button_text: pass the visible label, e.g. Conduct Audit.";
29679
- let r = gk(n, i);
29712
+ let r = bk(n, i);
29680
29713
  if (!r) return $("flowengage_click_button ✖ no match"), `Could not find a button matching "${n}". Call flowengage_list_forms to see button texts.`;
29681
29714
  try {
29682
- wO(`Clicking ${n}...`, { spinner: !0 });
29715
+ OO(`Clicking ${n}...`, { spinner: !0 });
29683
29716
  try {
29684
29717
  r.scrollIntoView({
29685
29718
  block: "center",
@@ -29688,22 +29721,22 @@ function Tk(e) {
29688
29721
  } catch {
29689
29722
  r.scrollIntoView(!0);
29690
29723
  }
29691
- await RO(r), r.focus?.(), await BO(r), VO(r), r.click();
29724
+ await HO(r), r.focus?.(), await WO(r), GO(r), r.click();
29692
29725
  let e = (r.textContent || r.value || r.getAttribute("aria-label") || "").trim().slice(0, 80) || "button", t = `OK_CLICK ${e}`;
29693
- return $("flowengage_click_button ✓", t), wO(`Clicked ${e}`, {
29726
+ return $("flowengage_click_button ✓", t), OO(`Clicked ${e}`, {
29694
29727
  spinner: !1,
29695
29728
  icon: "✅",
29696
29729
  duration: 1200
29697
29730
  }), t;
29698
29731
  } catch (e) {
29699
29732
  let t = `Click failed: ${e?.message || String(e)}`;
29700
- return $("flowengage_click_button ✖", t), wO("Click failed", {
29733
+ return $("flowengage_click_button ✖", t), OO("Click failed", {
29701
29734
  spinner: !1,
29702
29735
  icon: "⚠️",
29703
29736
  duration: 1800
29704
29737
  }), t;
29705
29738
  } finally {
29706
- zO(), TO(700);
29739
+ UO(), kO(700);
29707
29740
  }
29708
29741
  }
29709
29742
  };
@@ -29720,7 +29753,7 @@ function Tk(e) {
29720
29753
  }
29721
29754
  //#endregion
29722
29755
  //#region src/utils/wrapVoiceToolsForLogging.js
29723
- function Ek(e) {
29756
+ function Ak(e) {
29724
29757
  return !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, async (n) => {
29725
29758
  let r = jn();
29726
29759
  r ? console.log("[FlowEngage:voice-tool] ▶", e, n) : console.info(`[FlowEngage] voice tool » ${e}`);
@@ -29737,7 +29770,7 @@ function Ek(e) {
29737
29770
  }
29738
29771
  //#endregion
29739
29772
  //#region src/components/FlowEngageWidget.jsx
29740
- var Dk = {
29773
+ var jk = {
29741
29774
  blue: "#135bd8",
29742
29775
  red: "#ef334b",
29743
29776
  yellow: "#ffbd2e",
@@ -29745,7 +29778,7 @@ var Dk = {
29745
29778
  highlight: "rgba(255,255,255,0.9)",
29746
29779
  green: "#10b981"
29747
29780
  };
29748
- function Ok(e) {
29781
+ function Mk(e) {
29749
29782
  if (!Array.isArray(e) || e.length < 2) return "linear-gradient(145deg, #dce8f022 0%, #e8dff522 45%, #f5e0e022 100%), #f7f8fa";
29750
29783
  let [t, n, r] = e;
29751
29784
  return e.length >= 3 && r ? [
@@ -29759,12 +29792,12 @@ function Ok(e) {
29759
29792
  "#f7f8fa"
29760
29793
  ].join(", ");
29761
29794
  }
29762
- function kk(e) {
29795
+ function Nk(e) {
29763
29796
  if (!e || typeof e != "string") return "#1a1a1a";
29764
29797
  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;
29765
29798
  return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
29766
29799
  }
29767
- function Ak({ logo: t, style: n }) {
29800
+ function Pk({ logo: t, style: n }) {
29768
29801
  if (!t) return null;
29769
29802
  if (typeof t == "string") return /* @__PURE__ */ g("img", {
29770
29803
  src: t,
@@ -29789,7 +29822,7 @@ function Ak({ logo: t, style: n }) {
29789
29822
  children: r
29790
29823
  }) : null;
29791
29824
  }
29792
- function jk({ title: e }) {
29825
+ function Fk({ title: e }) {
29793
29826
  return /* @__PURE__ */ g("div", {
29794
29827
  style: {
29795
29828
  width: "100%",
@@ -29807,18 +29840,18 @@ function jk({ title: e }) {
29807
29840
  children: String(e || "FE").split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0]?.toUpperCase() || "").join("") || "FE"
29808
29841
  });
29809
29842
  }
29810
- function Mk(e, t) {
29843
+ function Ik(e, t) {
29811
29844
  let n = (t || "").trim();
29812
29845
  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;
29813
29846
  }
29814
- function Nk({ orbColors: e, ...t }) {
29815
- return /* @__PURE__ */ g(iO, {
29847
+ function Lk({ orbColors: e, ...t }) {
29848
+ return /* @__PURE__ */ g(cO, {
29816
29849
  colors: e,
29817
29850
  ...t
29818
29851
  });
29819
29852
  }
29820
- function Pk({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
29821
- let s = n || Dk.green, c = kk(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
29853
+ function Rk({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
29854
+ let s = n || jk.green, c = Nk(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
29822
29855
  style: {
29823
29856
  display: "flex",
29824
29857
  alignItems: a ? "flex-end" : "center",
@@ -29939,7 +29972,7 @@ function Pk({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
29939
29972
  delay: 0
29940
29973
  },
29941
29974
  style: { flexShrink: 0 },
29942
- children: /* @__PURE__ */ g(Nk, {
29975
+ children: /* @__PURE__ */ g(Lk, {
29943
29976
  size: l,
29944
29977
  orbColors: t
29945
29978
  })
@@ -29971,8 +30004,8 @@ function Pk({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
29971
30004
  children: u
29972
30005
  })] });
29973
30006
  }
29974
- function Fk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
29975
- let c = n || Dk.green, l = kk(c);
30007
+ function zk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
30008
+ let c = n || jk.green, l = Nk(c);
29976
30009
  return /* @__PURE__ */ _(fm.div, {
29977
30010
  initial: {
29978
30011
  scale: 50 / 350,
@@ -30043,7 +30076,7 @@ function Fk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
30043
30076
  children: /* @__PURE__ */ g("polyline", { points: "6 9 12 15 18 9" })
30044
30077
  })
30045
30078
  }),
30046
- /* @__PURE__ */ g(Nk, {
30079
+ /* @__PURE__ */ g(Lk, {
30047
30080
  size: 72,
30048
30081
  orbColors: t
30049
30082
  }),
@@ -30112,7 +30145,7 @@ function Fk({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
30112
30145
  ]
30113
30146
  });
30114
30147
  }
30115
- function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i, apiBaseUrl: a, historyRef: s, onMessageSync: l }) {
30148
+ function Bk({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i, apiBaseUrl: a, historyRef: s, onMessageSync: l }) {
30116
30149
  let [u, d] = m("idle"), [f, h] = m(!1), [v, y] = m(!1), b = p(null), x = p(""), S = p(async () => {}), C = p(!1), w = p(!1), T = p(!1), ee = p(!1), te = p("minimized"), ne = p(null), re = o((e = "minimized") => {
30117
30150
  te.current = e, ee.current = !0, queueMicrotask(() => {
30118
30151
  C.current || (C.current = !0, S.current?.());
@@ -30143,7 +30176,7 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
30143
30176
  try {
30144
30177
  if ((await navigator.mediaDevices.getUserMedia({ audio: !0 })).getTracks().forEach((e) => e.stop()), e) return;
30145
30178
  s.current = [], x.current = "", C.current = !1, T.current = !1, ee.current = !1, te.current = "minimized";
30146
- let t = Ek(Tk({
30179
+ let t = Ak(kk({
30147
30180
  siteId: i || null,
30148
30181
  apiBaseUrl: a || null,
30149
30182
  getLastUserVoiceText: () => x.current,
@@ -30164,9 +30197,7 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
30164
30197
  clientTools: t,
30165
30198
  connectionType: "websocket",
30166
30199
  ...l ? { signedUrl: l } : { agentId: r }
30167
- };
30168
- !c && !p && (m.overrides = { agent: { firstMessage: `Hi! I see you've landed on the ${f ? f.replace(/\s*[\|\-–]\s*.+$/, "").trim() : u.replace(/^\//, "").replace(/[-_]/g, " ").replace(/\//g, " › ") || "this page"} page. Are you looking for something specific here?` } }, console.log(`[FlowEngage] 🏠 Page-context voice greeting injected for path: ${u}`)), c && (m.overrides = { agent: { firstMessage: "" } });
30169
- let g = await xD.startSession({
30200
+ }, g = await xD.startSession({
30170
30201
  ...m,
30171
30202
  onUnhandledClientToolCall: (e) => console.error("[FlowEngage] Unhandled tool:", e?.tool_name),
30172
30203
  onModeChange: ({ mode: t }) => {
@@ -30181,10 +30212,10 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
30181
30212
  message: r,
30182
30213
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
30183
30214
  }], i) try {
30184
- let e = pO(s.current);
30215
+ let e = _O(s.current);
30185
30216
  e && Oe(i, e);
30186
30217
  } catch {}
30187
- Mk(n, r) && re("minimized");
30218
+ Ik(n, r) && re("minimized");
30188
30219
  }
30189
30220
  },
30190
30221
  onError: (t) => {
@@ -30224,7 +30255,13 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
30224
30255
  try {
30225
30256
  n = await t.list_page_forms();
30226
30257
  } catch {}
30227
- let r = c ? `RESUMING PRIOR SESSION — DO NOT GREET. The visitor is continuing the same conversation after a page reload. Do not introduce yourself or re-state your capabilities. Wait silently until the visitor speaks; if you must speak first, briefly acknowledge where you left off in one short sentence.\nPrior transcript:\n${o.transcript}\n\n` : "";
30258
+ let r = "";
30259
+ if (c) r = `RESUMING PRIOR SESSION — DO NOT GREET. The visitor is continuing the same conversation after a page reload. Do not introduce yourself or re-state your capabilities. Wait silently until the visitor speaks; if you must speak first, briefly acknowledge where you left off in one short sentence.
30260
+ Prior transcript:\n${o.transcript}\n\n`;
30261
+ else if (!p) {
30262
+ let t = f ? f.replace(/\s*[\|\-–]\s*.+$/, "").trim() : u.replace(/^\//, "").replace(/[-_]/g, " ").replace(/\//g, " › ") || "this page";
30263
+ r = `IMPORTANT — PAGE CONTEXT: The visitor has opened this chat on the "${t}" page (URL: ${e}). Your FIRST spoken message MUST be a page-specific greeting, for example: "Hi! I see you've landed on the ${t} page — are you looking for something specific here?" Then naturally continue the conversation based on what they say.\n\n`, console.log(`[FlowEngage] 🏠 Page-context greeting instruction sent for: ${u}`);
30264
+ }
30228
30265
  g.sendContextualUpdate(`${r}Page: ${e}. SiteId: ${i || "unknown"}. Forms: ${n}. Voice: call end_voice_session or say you are ending the session to stop.`);
30229
30266
  } catch {}
30230
30267
  } catch (n) {
@@ -30275,7 +30312,7 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
30275
30312
  whiteSpace: "nowrap"
30276
30313
  },
30277
30314
  children: "Listening..."
30278
- }), /* @__PURE__ */ g(Nk, {
30315
+ }), /* @__PURE__ */ g(Lk, {
30279
30316
  size: 72,
30280
30317
  voiceState: u,
30281
30318
  isMuted: f,
@@ -30502,7 +30539,7 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
30502
30539
  ]
30503
30540
  });
30504
30541
  }
30505
- function Lk({ orbColors: e }) {
30542
+ function Vk({ orbColors: e }) {
30506
30543
  return /* @__PURE__ */ g("div", {
30507
30544
  style: {
30508
30545
  flexShrink: 0,
@@ -30512,13 +30549,13 @@ function Lk({ orbColors: e }) {
30512
30549
  alignItems: "center",
30513
30550
  justifyContent: "center"
30514
30551
  },
30515
- children: /* @__PURE__ */ g(Nk, {
30552
+ children: /* @__PURE__ */ g(Lk, {
30516
30553
  size: 36,
30517
30554
  orbColors: e
30518
30555
  })
30519
30556
  });
30520
30557
  }
30521
- var Rk = () => /* @__PURE__ */ g("div", {
30558
+ var Hk = () => /* @__PURE__ */ g("div", {
30522
30559
  style: {
30523
30560
  display: "flex",
30524
30561
  marginBottom: "12px",
@@ -30548,7 +30585,7 @@ var Rk = () => /* @__PURE__ */ g("div", {
30548
30585
  } }, e))
30549
30586
  })
30550
30587
  });
30551
- 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, replyContext: le, setReplyContext: ue, webRTCError: de, micError: fe, setMicError: pe, dismissCallError: me, activeCallId: he, isCallMuted: ge, toggleCallMute: _e, endWebRTCCall: ve, formatCallDuration: ye, callDurationSeconds: be, isCallMinimized: xe, onExpand: Se, onCollapse: Ce, onStartVoice: we, onNewChat: Te, onEndConversation: Ee, showPoweredBy: De, getVisitorChatHistory: Oe, getVisitorChatThread: ke, resumeChat: Ae, isSessionRestoring: je, isClosing: Me }) {
30588
+ function Uk({ 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, replyContext: le, setReplyContext: ue, webRTCError: de, micError: fe, setMicError: pe, dismissCallError: me, activeCallId: he, isCallMuted: ge, toggleCallMute: _e, endWebRTCCall: ve, formatCallDuration: ye, callDurationSeconds: be, isCallMinimized: xe, onExpand: Se, onCollapse: Ce, onStartVoice: we, onNewChat: Te, onEndConversation: Ee, showPoweredBy: De, getVisitorChatHistory: Oe, getVisitorChatThread: ke, resumeChat: Ae, isSessionRestoring: je, isClosing: Me }) {
30552
30589
  let Ne = l.length > 0, Pe = T || ee || w, Fe = !!he, [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 () => {
30553
30590
  Le(!1), ze(!0), Ue(!0), Ge(null);
30554
30591
  try {
@@ -30671,7 +30708,7 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30671
30708
  justifyContent: "center",
30672
30709
  height: "40px"
30673
30710
  },
30674
- children: i ? /* @__PURE__ */ g(Ak, {
30711
+ children: i ? /* @__PURE__ */ g(Pk, {
30675
30712
  logo: i,
30676
30713
  style: {
30677
30714
  height: "34px",
@@ -30684,7 +30721,7 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30684
30721
  height: "40px",
30685
30722
  flexShrink: 0
30686
30723
  },
30687
- children: /* @__PURE__ */ g(jk, { title: e.chatTitle })
30724
+ children: /* @__PURE__ */ g(Fk, { title: e.chatTitle })
30688
30725
  })
30689
30726
  }), /* @__PURE__ */ g("div", {
30690
30727
  style: {
@@ -30966,7 +31003,7 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30966
31003
  })
30967
31004
  ]
30968
31005
  }),
30969
- /* @__PURE__ */ g(YD, {
31006
+ /* @__PURE__ */ g($D, {
30970
31007
  webRTCError: de,
30971
31008
  micError: fe,
30972
31009
  setMicError: pe,
@@ -30974,7 +31011,7 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
30974
31011
  isRateLimited: ee,
30975
31012
  rateLimitMessage: te
30976
31013
  }),
30977
- xe && /* @__PURE__ */ g(fO, {
31014
+ xe && /* @__PURE__ */ g(gO, {
30978
31015
  agentName: v,
30979
31016
  agentHeadshot: y,
30980
31017
  fallbackAgentName: b,
@@ -31166,17 +31203,17 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
31166
31203
  children: "No previous chats found."
31167
31204
  })
31168
31205
  })]
31169
- }) : null, Ne ? /* @__PURE__ */ g(qD, {
31206
+ }) : null, Ne ? /* @__PURE__ */ g(ZD, {
31170
31207
  chatHistory: l,
31171
31208
  isAiTyping: u,
31172
31209
  isLoading: T,
31173
31210
  isAgentTyping: d,
31174
31211
  setReplyContext: ue,
31175
- TypingDots: Rk,
31212
+ TypingDots: Hk,
31176
31213
  primaryColor: n,
31177
31214
  agentHeadshot: y,
31178
31215
  agentDisplayName: v || b,
31179
- botAvatarNode: /* @__PURE__ */ g(Lk, { orbColors: t })
31216
+ botAvatarNode: /* @__PURE__ */ g(Vk, { orbColors: t })
31180
31217
  }) : je ? /* @__PURE__ */ _("div", {
31181
31218
  style: {
31182
31219
  flex: 1,
@@ -31217,7 +31254,7 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
31217
31254
  padding: "28px 24px"
31218
31255
  },
31219
31256
  children: [
31220
- /* @__PURE__ */ g(Nk, {
31257
+ /* @__PURE__ */ g(Lk, {
31221
31258
  size: 94,
31222
31259
  orbColors: t
31223
31260
  }),
@@ -31275,7 +31312,7 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
31275
31312
  zIndex: 1,
31276
31313
  padding: oe ? "6px 0 0" : "12px 0 0"
31277
31314
  },
31278
- children: /* @__PURE__ */ g(JD, {
31315
+ children: /* @__PURE__ */ g(QD, {
31279
31316
  input: x,
31280
31317
  setInput: S,
31281
31318
  onSubmit: C,
@@ -31325,7 +31362,7 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
31325
31362
  ]
31326
31363
  });
31327
31364
  }
31328
- function Bk() {
31365
+ function Wk() {
31329
31366
  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, historyRef: ie, onMessageSync: ae, sendMessage: oe, uploadChatFile: D, openWidget: se, captureVisitorEmail: ce, setVoiceMode: le, endConversation: ue, startNewChat: de, acceptCall: me, rejectCall: he, endWebRTCCall: ge, toggleCallMute: _e, dismissCallError: ve, startTyping: ye, stopTyping: be, updateTypingDraft: xe, getVisitorChatHistory: Se, getVisitorChatThread: Ce, resumeChat: we, isSessionRestoring: Te } = An();
31330
31367
  c(() => {
31331
31368
  try {
@@ -31341,7 +31378,7 @@ function Bk() {
31341
31378
  }, Ae = {
31342
31379
  ...Ee.features || {},
31343
31380
  ...De.features || {}
31344
- }, je = Ae.voice !== !1, Me = Array.isArray(ke.orbColors) && ke.orbColors.length > 0 ? ke.orbColors : null, Pe = ke.buttonColor || ke.primaryColor || Me?.[0] || "#3B82F6", Fe = ke.position || "bottom-right", Ie = Oe.fallbackAgentName || "Agent", Le = Ok(Me ?? ke.chatBgColors), Re = Oe.logo || Oe.logoUrl || null, ze = E || "en", Be = Ee.recommendations?.[ze] || [], Ve = (De.recommendations?.[ze] ?? Be).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
31381
+ }, je = Ae.voice !== !1, Me = Array.isArray(ke.orbColors) && ke.orbColors.length > 0 ? ke.orbColors : null, Pe = ke.buttonColor || ke.primaryColor || Me?.[0] || "#3B82F6", Fe = ke.position || "bottom-right", Ie = Oe.fallbackAgentName || "Agent", Le = Mk(Me ?? ke.chatBgColors), Re = Oe.logo || Oe.logoUrl || null, ze = E || "en", Be = Ee.recommendations?.[ze] || [], Ve = (De.recommendations?.[ze] ?? Be).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
31345
31382
  id: e.key || `qr-${t}`,
31346
31383
  label: e.label,
31347
31384
  message: e.label,
@@ -31391,7 +31428,7 @@ function Bk() {
31391
31428
  let Ot = o(() => {
31392
31429
  ht(null), _t("");
31393
31430
  }, []), kt = o((e) => {
31394
- let t = HD(e);
31431
+ let t = KD(e);
31395
31432
  if (t) {
31396
31433
  ht(null), _t(t);
31397
31434
  return;
@@ -31497,7 +31534,7 @@ function Bk() {
31497
31534
  if (mt) {
31498
31535
  try {
31499
31536
  yt(!0), _t("");
31500
- let e = await D(mt), n = e?.data || e, r = rt.trim() || `Shared file: ${WD(mt)}`;
31537
+ let e = await D(mt), n = e?.data || e, r = rt.trim() || `Shared file: ${JD(mt)}`;
31501
31538
  it(""), ot(null), Ot(), await oe(r, "", t, {
31502
31539
  type: "file",
31503
31540
  metadata: {
@@ -31581,7 +31618,7 @@ function Bk() {
31581
31618
  onWheel: (e) => e.stopPropagation(),
31582
31619
  onTouchMove: (e) => e.stopPropagation(),
31583
31620
  children: [
31584
- O === "entry_prompt" && /* @__PURE__ */ g(Pk, {
31621
+ O === "entry_prompt" && /* @__PURE__ */ g(Rk, {
31585
31622
  copy: Ke,
31586
31623
  orbColors: Me,
31587
31624
  primaryColor: Pe,
@@ -31664,13 +31701,13 @@ function Bk() {
31664
31701
  children: ee === "connected" ? `${Pt(ut)} with ${Xe}` : `Tap to return to ${Xe}`
31665
31702
  })]
31666
31703
  })]
31667
- }), /* @__PURE__ */ g(Nk, {
31704
+ }), /* @__PURE__ */ g(Lk, {
31668
31705
  size: 50,
31669
31706
  orbColors: Me,
31670
31707
  onClick: T && bt ? At : je ? Rt : Bt
31671
31708
  })]
31672
31709
  }),
31673
- O === "connection_modal" && /* @__PURE__ */ g(Fk, {
31710
+ O === "connection_modal" && /* @__PURE__ */ g(zk, {
31674
31711
  copy: Ke,
31675
31712
  orbColors: Me,
31676
31713
  primaryColor: Pe,
@@ -31680,7 +31717,7 @@ function Bk() {
31680
31717
  isMobile: Et,
31681
31718
  isClosing: St
31682
31719
  }),
31683
- O === "voice_mode" && /* @__PURE__ */ g(Ik, {
31720
+ O === "voice_mode" && /* @__PURE__ */ g(Bk, {
31684
31721
  orbColors: Me,
31685
31722
  onEnterChat: Bt,
31686
31723
  onEndChat: Vt,
@@ -31690,7 +31727,7 @@ function Bk() {
31690
31727
  historyRef: ie,
31691
31728
  onMessageSync: ae
31692
31729
  }, "voice"),
31693
- O === "call_screen" && /* @__PURE__ */ g(dO, {
31730
+ O === "call_screen" && /* @__PURE__ */ g(hO, {
31694
31731
  incomingCall: w,
31695
31732
  activeCallId: T,
31696
31733
  callConnectionState: ee,
@@ -31709,7 +31746,7 @@ function Bk() {
31709
31746
  orbColors: Me,
31710
31747
  chatHistory: r
31711
31748
  }),
31712
- O === "text_chat" && /* @__PURE__ */ g(zk, {
31749
+ O === "text_chat" && /* @__PURE__ */ g(Uk, {
31713
31750
  isClosing: St,
31714
31751
  copy: Ke,
31715
31752
  orbColors: Me,
@@ -31772,4 +31809,20 @@ function Bk() {
31772
31809
  });
31773
31810
  }
31774
31811
  //#endregion
31775
- export { iO as AnimatedOrb, Cr as FlowEngageProvider, Bk as FlowEngageWidget, An as useFlowEngage };
31812
+ //#region src/components/ErrorBoundary.jsx
31813
+ var Gk = class extends e.Component {
31814
+ constructor(e) {
31815
+ super(e), this.state = { hasError: !1 };
31816
+ }
31817
+ static getDerivedStateFromError() {
31818
+ return { hasError: !0 };
31819
+ }
31820
+ componentDidCatch(e, t) {
31821
+ console.error("[FlowEngage] Widget crashed:", e, t.componentStack);
31822
+ }
31823
+ render() {
31824
+ return this.state.hasError ? this.props.fallback ?? null : this.props.children;
31825
+ }
31826
+ };
31827
+ //#endregion
31828
+ export { cO as AnimatedOrb, Gk as ErrorBoundary, Cr as FlowEngageProvider, Wk as FlowEngageWidget, An as useFlowEngage };