@flowengage/react-chatbot 4.0.5 → 4.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/flowengage-embed.js +11 -11
- package/dist/flowengage-react-chatbot.cjs +11 -11
- package/dist/flowengage-react-chatbot.mjs +343 -284
- package/package.json +1 -1
|
@@ -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, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'")
|
|
26592
|
-
|
|
26591
|
+
}), PD = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), FD = (e = "") => String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'"), 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
|
|
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
|
|
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
|
|
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
|
-
},
|
|
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
|
-
]),
|
|
26622
|
-
function
|
|
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" ||
|
|
26658
|
+
return r === "image/png" || r === "image/jpeg" || HD.has(r) || UD.has(n);
|
|
26626
26659
|
}
|
|
26627
|
-
function
|
|
26628
|
-
return e ?
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
26700
|
+
children: YD(t)
|
|
26668
26701
|
});
|
|
26669
26702
|
}
|
|
26670
26703
|
//#endregion
|
|
26671
26704
|
//#region src/components/MessageList.jsx
|
|
26672
|
-
function
|
|
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(
|
|
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 =
|
|
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:
|
|
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(
|
|
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
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
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
|
|
27641
|
+
var eO = [
|
|
27609
27642
|
"#135bd8",
|
|
27610
27643
|
"#ef334b",
|
|
27611
27644
|
"#ffbd2e"
|
|
27612
27645
|
];
|
|
27613
|
-
function
|
|
27614
|
-
return !Array.isArray(e) || e.length === 0 ?
|
|
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
|
|
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
|
|
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
|
|
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
|
|
27655
|
-
function
|
|
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
|
|
27665
|
-
let [s, l, u] =
|
|
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 =
|
|
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 =
|
|
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,
|
|
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, ${
|
|
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
|
|
27824
|
-
function
|
|
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
|
|
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
|
|
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
|
|
27851
|
-
let i = (t || "A")[0].toUpperCase(), a =
|
|
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
|
|
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
|
|
27936
|
-
let y = a || s || "Agent", b = e ? "incoming" : n === "connecting" ? "connecting" : "ongoing", x =
|
|
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:
|
|
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:
|
|
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(${
|
|
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(
|
|
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:
|
|
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(
|
|
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:
|
|
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(
|
|
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(
|
|
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
|
|
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:
|
|
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(
|
|
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
|
|
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
|
|
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
|
|
28567
|
-
|
|
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
|
|
28572
|
-
function
|
|
28604
|
+
var bO = 80;
|
|
28605
|
+
function xO(e) {
|
|
28573
28606
|
requestAnimationFrame(() => {
|
|
28574
|
-
let t = e.getBoundingClientRect(), n = t.top + t.height / 2, r =
|
|
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
|
|
28614
|
+
function SO(e) {
|
|
28582
28615
|
if (!e || e.hasAttribute("data-fe-highlighted")) return;
|
|
28583
|
-
|
|
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
|
|
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
|
|
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
|
|
28740
|
-
function
|
|
28741
|
-
return (!
|
|
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
|
|
28776
|
+
function OO(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
|
|
28744
28777
|
if (typeof document > "u") return;
|
|
28745
|
-
|
|
28746
|
-
let i =
|
|
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 && (
|
|
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
|
|
28758
|
-
|
|
28759
|
-
|
|
28760
|
-
}, e) :
|
|
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
|
|
28763
|
-
function
|
|
28764
|
-
return (!
|
|
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
|
|
28799
|
+
function NO() {
|
|
28767
28800
|
if (typeof document > "u") return;
|
|
28768
|
-
|
|
28769
|
-
let e =
|
|
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
|
-
|
|
28775
|
-
|
|
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
|
|
28780
|
-
|
|
28781
|
-
|
|
28782
|
-
|
|
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
|
|
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
|
|
28790
|
-
!e || typeof document > "u" || (
|
|
28822
|
+
function IO(e) {
|
|
28823
|
+
!e || typeof document > "u" || (wO(), FO(), e.classList.add(`${Q}-field-active`));
|
|
28791
28824
|
}
|
|
28792
|
-
function
|
|
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
|
|
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>`,
|
|
28805
|
-
function
|
|
28806
|
-
return (!
|
|
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
|
|
28841
|
+
async function HO(e) {
|
|
28809
28842
|
if (typeof document > "u" || !e) return;
|
|
28810
|
-
|
|
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 =
|
|
28818
|
-
|
|
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
|
|
28821
|
-
|
|
28822
|
-
|
|
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
|
|
28826
|
-
|
|
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
|
|
28861
|
+
function GO(e) {
|
|
28829
28862
|
if (!e || typeof document > "u") return;
|
|
28830
|
-
|
|
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
|
|
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
|
|
28897
|
+
function qO(e) {
|
|
28865
28898
|
return new Promise((t) => setTimeout(t, e));
|
|
28866
28899
|
}
|
|
28867
|
-
function
|
|
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
|
|
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
|
|
28940
|
-
function
|
|
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(
|
|
28976
|
+
return !!e.closest(XO);
|
|
28944
28977
|
} catch {
|
|
28945
28978
|
return !1;
|
|
28946
28979
|
}
|
|
28947
28980
|
}
|
|
28948
|
-
function
|
|
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
|
|
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 (!
|
|
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
|
|
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
|
|
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
|
|
29012
|
+
if (r.length) return ek(r.join(" "));
|
|
28980
29013
|
}
|
|
28981
|
-
if (e.labels && e.labels.length) return
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
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
|
|
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
|
|
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 ?
|
|
29041
|
+
return o ? ek(o) : null;
|
|
29009
29042
|
}
|
|
29010
|
-
function
|
|
29043
|
+
function nk() {
|
|
29011
29044
|
let e = [];
|
|
29012
|
-
return
|
|
29045
|
+
return $O((t) => {
|
|
29013
29046
|
e.push(...Array.from(t.querySelectorAll("input, select, textarea")).filter((e) => {
|
|
29014
|
-
if (
|
|
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 =
|
|
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
|
|
29031
|
-
return
|
|
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:
|
|
29071
|
+
label: tk(e),
|
|
29039
29072
|
placeholder: e.placeholder || null
|
|
29040
29073
|
}));
|
|
29041
29074
|
}
|
|
29042
|
-
function
|
|
29075
|
+
function ik() {
|
|
29043
29076
|
let e = [];
|
|
29044
|
-
return
|
|
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 (
|
|
29079
|
+
if (ZO(e) || e.disabled) return !1;
|
|
29047
29080
|
try {
|
|
29048
|
-
let t =
|
|
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
|
|
29093
|
+
function ak(e) {
|
|
29061
29094
|
return String(e || "").toLowerCase().replace(/\u00a0/g, " ").replace(/\*/g, "").replace(/\s+/g, " ").trim();
|
|
29062
29095
|
}
|
|
29063
|
-
function
|
|
29064
|
-
let t =
|
|
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
|
|
29068
|
-
let n =
|
|
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
|
-
|
|
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) =>
|
|
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
|
|
29097
|
-
function
|
|
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 =
|
|
29133
|
+
let e = sk(i, t);
|
|
29101
29134
|
e > r && (r = e, n = i);
|
|
29102
29135
|
}
|
|
29103
|
-
return !n || r <
|
|
29136
|
+
return !n || r < ck ? null : n;
|
|
29104
29137
|
}
|
|
29105
|
-
function
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
29154
|
-
if (!
|
|
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
|
-
|
|
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
|
|
29165
|
-
let r = String(t ?? ""), i = String(n ?? ""), a =
|
|
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 (
|
|
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
|
|
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
|
|
29224
|
+
function _k(e) {
|
|
29192
29225
|
if (!e || typeof e != "string") return null;
|
|
29193
29226
|
let t = null;
|
|
29194
|
-
return
|
|
29227
|
+
return $O((n) => {
|
|
29195
29228
|
try {
|
|
29196
29229
|
let r = n.getElementById(e);
|
|
29197
|
-
r && !
|
|
29230
|
+
r && !ZO(r) && r.matches?.("input, select, textarea") && (t = r);
|
|
29198
29231
|
} catch {}
|
|
29199
29232
|
}), t;
|
|
29200
29233
|
}
|
|
29201
|
-
function
|
|
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 =
|
|
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 =
|
|
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
|
|
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
|
|
29275
|
+
function bk(e, t) {
|
|
29243
29276
|
let n = [];
|
|
29244
|
-
|
|
29277
|
+
$O((e) => {
|
|
29245
29278
|
n.push(...Array.from(e.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
|
|
29246
|
-
if (
|
|
29279
|
+
if (ZO(e) || e.disabled) return !1;
|
|
29247
29280
|
try {
|
|
29248
|
-
let t =
|
|
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:
|
|
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 =
|
|
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
|
|
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
|
|
29287
|
-
let t =
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
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 (
|
|
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"),
|
|
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
|
|
29484
|
-
let e = await
|
|
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 =
|
|
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(),
|
|
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 (
|
|
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
|
|
29512
|
-
e &&
|
|
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),
|
|
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),
|
|
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
|
-
|
|
29565
|
+
PO(), kO(900);
|
|
29533
29566
|
}
|
|
29534
29567
|
},
|
|
29535
29568
|
flowengage_highlight: async (e) => {
|
|
29536
29569
|
$("flowengage_highlight ▶", e);
|
|
29537
|
-
let t =
|
|
29538
|
-
|
|
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)),
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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),
|
|
29638
|
-
let t =
|
|
29670
|
+
$("flowengage_fill_form ▶ raw:", e), FO();
|
|
29671
|
+
let t = Sk(e);
|
|
29639
29672
|
if (!t.length && r) {
|
|
29640
|
-
let e = r(), n =
|
|
29641
|
-
n.length ? $("flowengage_fill_form · inferred URL from last user utterance (model omitted usable fields):", n) : (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
|
-
|
|
29649
|
-
let a =
|
|
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())
|
|
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 =
|
|
29656
|
-
s ||=
|
|
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),
|
|
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),
|
|
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
|
-
|
|
29706
|
+
UO(), FO(), kO(700);
|
|
29674
29707
|
}
|
|
29675
29708
|
},
|
|
29676
29709
|
flowengage_click_button: async (e) => {
|
|
29677
|
-
let t =
|
|
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 =
|
|
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
|
-
|
|
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
|
|
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),
|
|
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),
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
29815
|
-
return /* @__PURE__ */ g(
|
|
29847
|
+
function Lk({ orbColors: e, ...t }) {
|
|
29848
|
+
return /* @__PURE__ */ g(cO, {
|
|
29816
29849
|
colors: e,
|
|
29817
29850
|
...t
|
|
29818
29851
|
});
|
|
29819
29852
|
}
|
|
29820
|
-
function
|
|
29821
|
-
let s = n ||
|
|
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(
|
|
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
|
|
29975
|
-
let c = n ||
|
|
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(
|
|
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
|
|
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,21 +30176,31 @@ 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 =
|
|
30179
|
+
let t = Ak(kk({
|
|
30147
30180
|
siteId: i || null,
|
|
30148
30181
|
apiBaseUrl: a || null,
|
|
30149
30182
|
getLastUserVoiceText: () => x.current,
|
|
30150
30183
|
requestEndSession: () => {
|
|
30151
30184
|
re();
|
|
30152
30185
|
}
|
|
30153
|
-
})), o = i ? ke(i) : null, c = !!o?.transcript, l =
|
|
30154
|
-
|
|
30186
|
+
})), o = i ? ke(i) : null, c = !!o?.transcript, l = null;
|
|
30187
|
+
try {
|
|
30188
|
+
let e = await fetch(`${a}/api/voice/signed-url?siteId=${encodeURIComponent(i || "")}`, {
|
|
30189
|
+
method: "GET",
|
|
30190
|
+
headers: { "Content-Type": "application/json" }
|
|
30191
|
+
});
|
|
30192
|
+
e.ok ? (l = (await e.json()).signedUrl || null, l && console.log("[FlowEngage] ✅ Using signed ElevenLabs URL")) : console.warn("[FlowEngage] ⚠️ Signed URL fetch failed, falling back to agentId");
|
|
30193
|
+
} catch (e) {
|
|
30194
|
+
console.warn("[FlowEngage] ⚠️ Signed URL fetch error:", e.message);
|
|
30195
|
+
}
|
|
30196
|
+
let u = typeof window < "u" ? window.location.pathname : "/", f = typeof document < "u" ? document.title : "", p = u === "/" || u === "", m = {
|
|
30155
30197
|
clientTools: t,
|
|
30156
|
-
connectionType: "websocket"
|
|
30198
|
+
connectionType: "websocket",
|
|
30199
|
+
...l ? { signedUrl: l } : { agentId: r }
|
|
30157
30200
|
};
|
|
30158
|
-
|
|
30159
|
-
let
|
|
30160
|
-
...
|
|
30201
|
+
l && (c ? m.overrides = { agent: { firstMessage: "" } } : 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}`)));
|
|
30202
|
+
let g = await xD.startSession({
|
|
30203
|
+
...m,
|
|
30161
30204
|
onUnhandledClientToolCall: (e) => console.error("[FlowEngage] Unhandled tool:", e?.tool_name),
|
|
30162
30205
|
onModeChange: ({ mode: t }) => {
|
|
30163
30206
|
e || d(t === "speaking" ? "speaking" : "listening");
|
|
@@ -30171,10 +30214,10 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30171
30214
|
message: r,
|
|
30172
30215
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
30173
30216
|
}], i) try {
|
|
30174
|
-
let e =
|
|
30217
|
+
let e = _O(s.current);
|
|
30175
30218
|
e && Oe(i, e);
|
|
30176
30219
|
} catch {}
|
|
30177
|
-
|
|
30220
|
+
Ik(n, r) && re("minimized");
|
|
30178
30221
|
}
|
|
30179
30222
|
},
|
|
30180
30223
|
onError: (t) => {
|
|
@@ -30205,17 +30248,17 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30205
30248
|
}
|
|
30206
30249
|
});
|
|
30207
30250
|
if (e) {
|
|
30208
|
-
|
|
30251
|
+
g.endSession().catch(() => {});
|
|
30209
30252
|
return;
|
|
30210
30253
|
}
|
|
30211
|
-
n =
|
|
30254
|
+
n = g, b.current = g, d("listening");
|
|
30212
30255
|
try {
|
|
30213
30256
|
let e = typeof window < "u" ? window.location.href : "", n = "[]";
|
|
30214
30257
|
try {
|
|
30215
30258
|
n = await t.list_page_forms();
|
|
30216
30259
|
} catch {}
|
|
30217
30260
|
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` : "";
|
|
30218
|
-
|
|
30261
|
+
g.sendContextualUpdate(`${r}Page: ${e}. SiteId: ${i || "unknown"}. Forms: ${n}. Voice: call end_voice_session or say you are ending the session to stop.`);
|
|
30219
30262
|
} catch {}
|
|
30220
30263
|
} catch (n) {
|
|
30221
30264
|
e || (console.error("[FlowEngage] startSession failed", n), d("error"), te.current = "chat", window.setTimeout(() => {
|
|
@@ -30265,7 +30308,7 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30265
30308
|
whiteSpace: "nowrap"
|
|
30266
30309
|
},
|
|
30267
30310
|
children: "Listening..."
|
|
30268
|
-
}), /* @__PURE__ */ g(
|
|
30311
|
+
}), /* @__PURE__ */ g(Lk, {
|
|
30269
30312
|
size: 72,
|
|
30270
30313
|
voiceState: u,
|
|
30271
30314
|
isMuted: f,
|
|
@@ -30492,7 +30535,7 @@ function Ik({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
|
|
|
30492
30535
|
]
|
|
30493
30536
|
});
|
|
30494
30537
|
}
|
|
30495
|
-
function
|
|
30538
|
+
function Vk({ orbColors: e }) {
|
|
30496
30539
|
return /* @__PURE__ */ g("div", {
|
|
30497
30540
|
style: {
|
|
30498
30541
|
flexShrink: 0,
|
|
@@ -30502,13 +30545,13 @@ function Lk({ orbColors: e }) {
|
|
|
30502
30545
|
alignItems: "center",
|
|
30503
30546
|
justifyContent: "center"
|
|
30504
30547
|
},
|
|
30505
|
-
children: /* @__PURE__ */ g(
|
|
30548
|
+
children: /* @__PURE__ */ g(Lk, {
|
|
30506
30549
|
size: 36,
|
|
30507
30550
|
orbColors: e
|
|
30508
30551
|
})
|
|
30509
30552
|
});
|
|
30510
30553
|
}
|
|
30511
|
-
var
|
|
30554
|
+
var Hk = () => /* @__PURE__ */ g("div", {
|
|
30512
30555
|
style: {
|
|
30513
30556
|
display: "flex",
|
|
30514
30557
|
marginBottom: "12px",
|
|
@@ -30538,7 +30581,7 @@ var Rk = () => /* @__PURE__ */ g("div", {
|
|
|
30538
30581
|
} }, e))
|
|
30539
30582
|
})
|
|
30540
30583
|
});
|
|
30541
|
-
function
|
|
30584
|
+
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 }) {
|
|
30542
30585
|
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 () => {
|
|
30543
30586
|
Le(!1), ze(!0), Ue(!0), Ge(null);
|
|
30544
30587
|
try {
|
|
@@ -30661,7 +30704,7 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
30661
30704
|
justifyContent: "center",
|
|
30662
30705
|
height: "40px"
|
|
30663
30706
|
},
|
|
30664
|
-
children: i ? /* @__PURE__ */ g(
|
|
30707
|
+
children: i ? /* @__PURE__ */ g(Pk, {
|
|
30665
30708
|
logo: i,
|
|
30666
30709
|
style: {
|
|
30667
30710
|
height: "34px",
|
|
@@ -30674,7 +30717,7 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
30674
30717
|
height: "40px",
|
|
30675
30718
|
flexShrink: 0
|
|
30676
30719
|
},
|
|
30677
|
-
children: /* @__PURE__ */ g(
|
|
30720
|
+
children: /* @__PURE__ */ g(Fk, { title: e.chatTitle })
|
|
30678
30721
|
})
|
|
30679
30722
|
}), /* @__PURE__ */ g("div", {
|
|
30680
30723
|
style: {
|
|
@@ -30956,7 +30999,7 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
30956
30999
|
})
|
|
30957
31000
|
]
|
|
30958
31001
|
}),
|
|
30959
|
-
/* @__PURE__ */ g(
|
|
31002
|
+
/* @__PURE__ */ g($D, {
|
|
30960
31003
|
webRTCError: de,
|
|
30961
31004
|
micError: fe,
|
|
30962
31005
|
setMicError: pe,
|
|
@@ -30964,7 +31007,7 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
30964
31007
|
isRateLimited: ee,
|
|
30965
31008
|
rateLimitMessage: te
|
|
30966
31009
|
}),
|
|
30967
|
-
xe && /* @__PURE__ */ g(
|
|
31010
|
+
xe && /* @__PURE__ */ g(gO, {
|
|
30968
31011
|
agentName: v,
|
|
30969
31012
|
agentHeadshot: y,
|
|
30970
31013
|
fallbackAgentName: b,
|
|
@@ -31156,17 +31199,17 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
31156
31199
|
children: "No previous chats found."
|
|
31157
31200
|
})
|
|
31158
31201
|
})]
|
|
31159
|
-
}) : null, Ne ? /* @__PURE__ */ g(
|
|
31202
|
+
}) : null, Ne ? /* @__PURE__ */ g(ZD, {
|
|
31160
31203
|
chatHistory: l,
|
|
31161
31204
|
isAiTyping: u,
|
|
31162
31205
|
isLoading: T,
|
|
31163
31206
|
isAgentTyping: d,
|
|
31164
31207
|
setReplyContext: ue,
|
|
31165
|
-
TypingDots:
|
|
31208
|
+
TypingDots: Hk,
|
|
31166
31209
|
primaryColor: n,
|
|
31167
31210
|
agentHeadshot: y,
|
|
31168
31211
|
agentDisplayName: v || b,
|
|
31169
|
-
botAvatarNode: /* @__PURE__ */ g(
|
|
31212
|
+
botAvatarNode: /* @__PURE__ */ g(Vk, { orbColors: t })
|
|
31170
31213
|
}) : je ? /* @__PURE__ */ _("div", {
|
|
31171
31214
|
style: {
|
|
31172
31215
|
flex: 1,
|
|
@@ -31207,7 +31250,7 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
31207
31250
|
padding: "28px 24px"
|
|
31208
31251
|
},
|
|
31209
31252
|
children: [
|
|
31210
|
-
/* @__PURE__ */ g(
|
|
31253
|
+
/* @__PURE__ */ g(Lk, {
|
|
31211
31254
|
size: 94,
|
|
31212
31255
|
orbColors: t
|
|
31213
31256
|
}),
|
|
@@ -31265,7 +31308,7 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
31265
31308
|
zIndex: 1,
|
|
31266
31309
|
padding: oe ? "6px 0 0" : "12px 0 0"
|
|
31267
31310
|
},
|
|
31268
|
-
children: /* @__PURE__ */ g(
|
|
31311
|
+
children: /* @__PURE__ */ g(QD, {
|
|
31269
31312
|
input: x,
|
|
31270
31313
|
setInput: S,
|
|
31271
31314
|
onSubmit: C,
|
|
@@ -31315,7 +31358,7 @@ function zk({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
|
|
|
31315
31358
|
]
|
|
31316
31359
|
});
|
|
31317
31360
|
}
|
|
31318
|
-
function
|
|
31361
|
+
function Wk() {
|
|
31319
31362
|
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();
|
|
31320
31363
|
c(() => {
|
|
31321
31364
|
try {
|
|
@@ -31331,7 +31374,7 @@ function Bk() {
|
|
|
31331
31374
|
}, Ae = {
|
|
31332
31375
|
...Ee.features || {},
|
|
31333
31376
|
...De.features || {}
|
|
31334
|
-
}, 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 =
|
|
31377
|
+
}, 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) => ({
|
|
31335
31378
|
id: e.key || `qr-${t}`,
|
|
31336
31379
|
label: e.label,
|
|
31337
31380
|
message: e.label,
|
|
@@ -31381,7 +31424,7 @@ function Bk() {
|
|
|
31381
31424
|
let Ot = o(() => {
|
|
31382
31425
|
ht(null), _t("");
|
|
31383
31426
|
}, []), kt = o((e) => {
|
|
31384
|
-
let t =
|
|
31427
|
+
let t = KD(e);
|
|
31385
31428
|
if (t) {
|
|
31386
31429
|
ht(null), _t(t);
|
|
31387
31430
|
return;
|
|
@@ -31487,7 +31530,7 @@ function Bk() {
|
|
|
31487
31530
|
if (mt) {
|
|
31488
31531
|
try {
|
|
31489
31532
|
yt(!0), _t("");
|
|
31490
|
-
let e = await D(mt), n = e?.data || e, r = rt.trim() || `Shared file: ${
|
|
31533
|
+
let e = await D(mt), n = e?.data || e, r = rt.trim() || `Shared file: ${JD(mt)}`;
|
|
31491
31534
|
it(""), ot(null), Ot(), await oe(r, "", t, {
|
|
31492
31535
|
type: "file",
|
|
31493
31536
|
metadata: {
|
|
@@ -31571,7 +31614,7 @@ function Bk() {
|
|
|
31571
31614
|
onWheel: (e) => e.stopPropagation(),
|
|
31572
31615
|
onTouchMove: (e) => e.stopPropagation(),
|
|
31573
31616
|
children: [
|
|
31574
|
-
O === "entry_prompt" && /* @__PURE__ */ g(
|
|
31617
|
+
O === "entry_prompt" && /* @__PURE__ */ g(Rk, {
|
|
31575
31618
|
copy: Ke,
|
|
31576
31619
|
orbColors: Me,
|
|
31577
31620
|
primaryColor: Pe,
|
|
@@ -31654,13 +31697,13 @@ function Bk() {
|
|
|
31654
31697
|
children: ee === "connected" ? `${Pt(ut)} with ${Xe}` : `Tap to return to ${Xe}`
|
|
31655
31698
|
})]
|
|
31656
31699
|
})]
|
|
31657
|
-
}), /* @__PURE__ */ g(
|
|
31700
|
+
}), /* @__PURE__ */ g(Lk, {
|
|
31658
31701
|
size: 50,
|
|
31659
31702
|
orbColors: Me,
|
|
31660
31703
|
onClick: T && bt ? At : je ? Rt : Bt
|
|
31661
31704
|
})]
|
|
31662
31705
|
}),
|
|
31663
|
-
O === "connection_modal" && /* @__PURE__ */ g(
|
|
31706
|
+
O === "connection_modal" && /* @__PURE__ */ g(zk, {
|
|
31664
31707
|
copy: Ke,
|
|
31665
31708
|
orbColors: Me,
|
|
31666
31709
|
primaryColor: Pe,
|
|
@@ -31670,7 +31713,7 @@ function Bk() {
|
|
|
31670
31713
|
isMobile: Et,
|
|
31671
31714
|
isClosing: St
|
|
31672
31715
|
}),
|
|
31673
|
-
O === "voice_mode" && /* @__PURE__ */ g(
|
|
31716
|
+
O === "voice_mode" && /* @__PURE__ */ g(Bk, {
|
|
31674
31717
|
orbColors: Me,
|
|
31675
31718
|
onEnterChat: Bt,
|
|
31676
31719
|
onEndChat: Vt,
|
|
@@ -31680,7 +31723,7 @@ function Bk() {
|
|
|
31680
31723
|
historyRef: ie,
|
|
31681
31724
|
onMessageSync: ae
|
|
31682
31725
|
}, "voice"),
|
|
31683
|
-
O === "call_screen" && /* @__PURE__ */ g(
|
|
31726
|
+
O === "call_screen" && /* @__PURE__ */ g(hO, {
|
|
31684
31727
|
incomingCall: w,
|
|
31685
31728
|
activeCallId: T,
|
|
31686
31729
|
callConnectionState: ee,
|
|
@@ -31699,7 +31742,7 @@ function Bk() {
|
|
|
31699
31742
|
orbColors: Me,
|
|
31700
31743
|
chatHistory: r
|
|
31701
31744
|
}),
|
|
31702
|
-
O === "text_chat" && /* @__PURE__ */ g(
|
|
31745
|
+
O === "text_chat" && /* @__PURE__ */ g(Uk, {
|
|
31703
31746
|
isClosing: St,
|
|
31704
31747
|
copy: Ke,
|
|
31705
31748
|
orbColors: Me,
|
|
@@ -31762,4 +31805,20 @@ function Bk() {
|
|
|
31762
31805
|
});
|
|
31763
31806
|
}
|
|
31764
31807
|
//#endregion
|
|
31765
|
-
|
|
31808
|
+
//#region src/components/ErrorBoundary.jsx
|
|
31809
|
+
var Gk = class extends e.Component {
|
|
31810
|
+
constructor(e) {
|
|
31811
|
+
super(e), this.state = { hasError: !1 };
|
|
31812
|
+
}
|
|
31813
|
+
static getDerivedStateFromError() {
|
|
31814
|
+
return { hasError: !0 };
|
|
31815
|
+
}
|
|
31816
|
+
componentDidCatch(e, t) {
|
|
31817
|
+
console.error("[FlowEngage] Widget crashed:", e, t.componentStack);
|
|
31818
|
+
}
|
|
31819
|
+
render() {
|
|
31820
|
+
return this.state.hasError ? this.props.fallback ?? null : this.props.children;
|
|
31821
|
+
}
|
|
31822
|
+
};
|
|
31823
|
+
//#endregion
|
|
31824
|
+
export { cO as AnimatedOrb, Gk as ErrorBoundary, Cr as FlowEngageProvider, Wk as FlowEngageWidget, An as useFlowEngage };
|