@flowengage/react-chatbot 8.0.54 → 8.0.67

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.
@@ -38,42 +38,42 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
38
38
  if (!j) return null;
39
39
  let e = window.localStorage.getItem(A.chatId);
40
40
  return e && String(e).trim() ? String(e).trim() : null;
41
- }, ae = () => {
41
+ }, M = () => {
42
42
  if (j) try {
43
43
  window.localStorage.removeItem(A.chatId);
44
44
  } catch {}
45
- }, oe = () => j ? typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(16).slice(2)}` : "server-chat-id", se = (e) => e ? `flowengage.entrySeen.${e}` : null, ce = (e) => {
45
+ }, ae = () => j ? typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(16).slice(2)}` : "server-chat-id", oe = (e) => e ? `flowengage.entrySeen.${e}` : null, se = (e) => {
46
46
  if (!j || !e) return !1;
47
47
  try {
48
- let t = se(e);
48
+ let t = oe(e);
49
49
  return t ? window.localStorage.getItem(t) === "1" : !1;
50
50
  } catch {
51
51
  return !1;
52
52
  }
53
- }, le = (e) => {
53
+ }, ce = (e) => {
54
54
  if (!(!j || !e)) try {
55
- let t = se(e);
55
+ let t = oe(e);
56
56
  t && window.localStorage.setItem(t, "1");
57
57
  } catch {}
58
- }, ue = (e) => e ? `flowengage.persistedChatId.${e}` : null, de = (e) => {
58
+ }, le = (e) => e ? `flowengage.persistedChatId.${e}` : null, ue = (e) => {
59
59
  if (!j || !e) return null;
60
60
  try {
61
- let t = ue(e), n = t ? window.localStorage.getItem(t) : null;
61
+ let t = le(e), n = t ? window.localStorage.getItem(t) : null;
62
62
  return n && String(n).trim() ? String(n).trim() : null;
63
63
  } catch {
64
64
  return null;
65
65
  }
66
- }, fe = (e) => {
66
+ }, de = (e) => {
67
67
  if (!(!j || !e)) try {
68
- let t = ue(e);
68
+ let t = le(e);
69
69
  t && window.localStorage.removeItem(t);
70
70
  } catch {}
71
- }, pe = (e, t) => {
71
+ }, fe = (e, t) => {
72
72
  if (!(!j || !e || !t)) try {
73
- let n = ue(e);
73
+ let n = le(e);
74
74
  n && window.localStorage.setItem(n, String(t).trim());
75
75
  } catch {}
76
- }, me = () => j ? {
76
+ }, pe = () => j ? {
77
77
  isOpen: !1,
78
78
  activeScreen: window.sessionStorage.getItem(A.activeScreen) || "ai",
79
79
  isHumanHandled: window.sessionStorage.getItem(A.isHumanHandled) === "true",
@@ -87,7 +87,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
87
87
  agentName: null,
88
88
  agentHeadshot: null,
89
89
  visitorEmail: ""
90
- }, he = (e) => {
90
+ }, me = (e) => {
91
91
  j && Object.entries(e).forEach(([e, t]) => {
92
92
  let n = A[e];
93
93
  if (n) {
@@ -98,7 +98,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
98
98
  window.sessionStorage.setItem(n, String(t));
99
99
  }
100
100
  });
101
- }, M = (e) => {
101
+ }, he = (e) => {
102
102
  if (!j || !e) return "";
103
103
  let t = re(e), n = window.localStorage.getItem(t);
104
104
  if (!n) {
@@ -106,7 +106,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
106
106
  e && (window.localStorage.setItem(t, e), window.sessionStorage.removeItem(A.visitorEmail), n = e);
107
107
  }
108
108
  return n || "";
109
- }, ge = (e, t) => {
109
+ }, N = (e, t) => {
110
110
  if (!j) return;
111
111
  let n = re(t);
112
112
  if (!n) return;
@@ -116,33 +116,33 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
116
116
  return;
117
117
  }
118
118
  window.localStorage.setItem(n, r), window.sessionStorage.removeItem(A.visitorEmail);
119
- }, _e = (e) => e ? `flowengage.visitorId.${e}` : null, ve = () => `v_${Date.now().toString(36)}_${typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID().replace(/-/g, "").slice(0, 16) : Math.random().toString(36).slice(2, 18)}`, ye = (e) => {
119
+ }, ge = (e) => e ? `flowengage.visitorId.${e}` : null, _e = () => `v_${Date.now().toString(36)}_${typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID().replace(/-/g, "").slice(0, 16) : Math.random().toString(36).slice(2, 18)}`, ve = (e) => {
120
120
  if (!j || !e) return null;
121
121
  try {
122
- let t = _e(e), n = t ? window.localStorage.getItem(t) : null;
122
+ let t = ge(e), n = t ? window.localStorage.getItem(t) : null;
123
123
  return n && String(n).trim() ? String(n).trim() : null;
124
124
  } catch {
125
125
  return null;
126
126
  }
127
- }, be = (e) => {
127
+ }, ye = (e) => {
128
128
  if (!j || !e) return null;
129
129
  try {
130
- let t = ye(e);
130
+ let t = ve(e);
131
131
  if (t) return t;
132
- let n = ve(), r = _e(e);
132
+ let n = _e(), r = ge(e);
133
133
  return r && window.localStorage.setItem(r, n), n;
134
134
  } catch {
135
- return ve();
135
+ return _e();
136
136
  }
137
- }, xe = "flowengage.tabId", Se = () => {
137
+ }, be = "flowengage.tabId", xe = () => {
138
138
  if (!j) return "default";
139
139
  try {
140
- let e = window.sessionStorage.getItem(xe);
141
- return e || (e = typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID().replace(/-/g, "").slice(0, 12) : Math.random().toString(36).slice(2, 14), window.sessionStorage.setItem(xe, e)), e;
140
+ let e = window.sessionStorage.getItem(be);
141
+ return e || (e = typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID().replace(/-/g, "").slice(0, 12) : Math.random().toString(36).slice(2, 14), window.sessionStorage.setItem(be, e)), e;
142
142
  } catch {
143
143
  return "default";
144
144
  }
145
- }, N = (e) => e ? `flowengage.voice.transcript.${e}.${Se()}` : null, Ce = 600 * 1e3, P = (e, t, n = {}) => {
145
+ }, Se = (e) => e ? `flowengage.voice.transcript.${e}.${xe()}` : null, Ce = 600 * 1e3, P = (e, t, n = {}) => {
146
146
  if (!j || !e) return;
147
147
  let r = typeof t == "string" ? t.trim() : "";
148
148
  if (!r) return;
@@ -151,13 +151,13 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
151
151
  expiresAt: Date.now() + i
152
152
  };
153
153
  try {
154
- let t = N(e);
154
+ let t = Se(e);
155
155
  t && window.localStorage.setItem(t, JSON.stringify(a));
156
156
  } catch {}
157
157
  }, we = (e) => {
158
158
  if (!j || !e) return null;
159
159
  try {
160
- let t = N(e), n = t ? window.localStorage.getItem(t) : null;
160
+ let t = Se(e), n = t ? window.localStorage.getItem(t) : null;
161
161
  if (!n) return null;
162
162
  let r = JSON.parse(n);
163
163
  return !r || typeof r.transcript != "string" ? null : Number.isFinite(r.expiresAt) && Date.now() > r.expiresAt ? (window.localStorage.removeItem(t), null) : r;
@@ -166,7 +166,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
166
166
  }
167
167
  }, Te = (e) => {
168
168
  if (!(!j || !e)) try {
169
- let t = N(e);
169
+ let t = Se(e);
170
170
  t && window.localStorage.removeItem(t);
171
171
  } catch {}
172
172
  }, F = "flowengage.voice.pendingResume", Ee = () => {
@@ -198,7 +198,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
198
198
  } catch {
199
199
  return !1;
200
200
  }
201
- }, je = (e) => e ? `flowengage.voice.navState.${e}.${Se()}` : null, Me = (e, t, n, r) => {
201
+ }, je = (e) => e ? `flowengage.voice.navState.${e}.${xe()}` : null, Me = (e, t, n, r) => {
202
202
  if (!(!j || !e || !t)) try {
203
203
  let i = je(e);
204
204
  i && window.sessionStorage.setItem(i, JSON.stringify({
@@ -224,14 +224,14 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
224
224
  } catch {
225
225
  return null;
226
226
  }
227
- }, L = async (e) => {
227
+ }, Pe = async (e) => {
228
228
  let t = await e.json().catch(() => ({}));
229
229
  if (!e.ok) {
230
230
  let n = Error(t.message || t.error || `Request failed with status ${e.status}`);
231
231
  throw n.status = e.status, n;
232
232
  }
233
233
  return t;
234
- }, Pe = async (e, t = {}) => {
234
+ }, L = async (e, t = {}) => {
235
235
  try {
236
236
  return await fetch(e, {
237
237
  mode: "cors",
@@ -243,7 +243,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
243
243
  }
244
244
  }, Fe = async ({ apiBaseUrl: e, userId: t, siteId: n, priorChatId: r = null, forceNew: i = !1, resumeChatId: a = null, visitorId: o = null }) => {
245
245
  let s = `${e}/api/visitors/resolve-session`, c = { siteId: n };
246
- return r && String(r).trim() && (c.priorChatId = String(r).trim()), i && (c.forceNew = !0), a && (c.resumeChatId = a), o && (c.visitorId = o), L(await Pe(s, {
246
+ return r && String(r).trim() && (c.priorChatId = String(r).trim()), i && (c.forceNew = !0), a && (c.resumeChatId = a), o && (c.visitorId = o), Pe(await L(s, {
247
247
  method: "POST",
248
248
  mode: "cors",
249
249
  headers: {
@@ -256,7 +256,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
256
256
  }));
257
257
  }, Ie = async ({ apiBaseUrl: e, siteId: t }) => {
258
258
  let n = typeof window < "u" ? window.location.origin : "http://localhost";
259
- return (await L(await Pe(`${e}/api/widget/chatbot-loader?${new URLSearchParams({
259
+ return (await Pe(await L(`${e}/api/widget/chatbot-loader?${new URLSearchParams({
260
260
  siteId: t,
261
261
  origin: n
262
262
  }).toString()}`, { method: "GET" }))).data;
@@ -274,7 +274,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
274
274
  headers: { "Content-Type": "application/json" },
275
275
  body: i
276
276
  }).catch(() => {}), !0) : !1;
277
- }, a = async (i, a = {}) => L(await Pe(`${e}${i}`, {
277
+ }, a = async (i, a = {}) => Pe(await L(`${e}${i}`, {
278
278
  ...a,
279
279
  headers: {
280
280
  "Content-Type": "application/json",
@@ -289,7 +289,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
289
289
  ...n ? { "x-site-id": n } : {},
290
290
  ...a.headers || {}
291
291
  };
292
- return L(await Pe(`${e}${r}`, {
292
+ return Pe(await L(`${e}${r}`, {
293
293
  ...a,
294
294
  body: i,
295
295
  headers: o
@@ -415,7 +415,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
415
415
  });
416
416
  },
417
417
  async getIceServersConfig() {
418
- return L(await Pe(`${e}/api/calls/ice-config`, {
418
+ return Pe(await L(`${e}/api/calls/ice-config`, {
419
419
  method: "GET",
420
420
  headers: {
421
421
  "x-user-id": t,
@@ -2919,7 +2919,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
2919
2919
  message: "Looks like you're already on this page!",
2920
2920
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
2921
2921
  }]);
2922
- }, []), [T, D] = m(me().isOpen), [O, k] = m(me().activeScreen), [A, j] = m(me().isHumanHandled), [re, se] = m(me().agentName), [ce, le] = m(me().agentHeadshot), [ue, _e] = m(() => M(i?.siteId)), [ve, ye] = m(!1), [xe, Se] = m(!1), [N, Ce] = m("idle"), [P, we] = m(!1), [Te, F] = m(!1), [De, Oe] = m(""), [I, ke] = m(!1), [Ae, je] = m(0), [Me, Ne] = m(0), [L, Pe] = m(!1), [R, Re] = m(null), [ze, Be] = m(null), [Ve, He] = m("idle"), [Ue, We] = m(null), [Ge, Ke] = m(!1), [qe, Je] = m(""), [Ye, Xe] = m(!1), z = p(null), B = p(null), Ze = p(""), Qe = p(!1), $e = p(null), et = p(null), tt = p(null), V = p(null), H = p(null), nt = p(null), rt = p(null), it = p(!1), U = p({
2922
+ }, []), [T, D] = m(pe().isOpen), [O, k] = m(pe().activeScreen), [A, j] = m(pe().isHumanHandled), [re, oe] = m(pe().agentName), [se, ce] = m(pe().agentHeadshot), [le, ge] = m(() => he(i?.siteId)), [_e, ve] = m(!1), [be, xe] = m(!1), [Se, Ce] = m("idle"), [P, we] = m(!1), [Te, F] = m(!1), [De, Oe] = m(""), [I, ke] = m(!1), [Ae, je] = m(0), [Me, Ne] = m(0), [Pe, L] = m(!1), [R, Re] = m(null), [ze, Be] = m(null), [Ve, He] = m("idle"), [Ue, We] = m(null), [Ge, Ke] = m(!1), [qe, Je] = m(""), [Ye, Xe] = m(!1), z = p(null), B = p(null), Ze = p(""), Qe = p(!1), $e = p(null), et = p(null), tt = p(null), V = p(null), H = p(null), nt = p(null), rt = p(null), it = p(!1), U = p({
2923
2923
  url: null,
2924
2924
  at: 0
2925
2925
  }), at = o((e, t) => {
@@ -2940,7 +2940,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
2940
2940
  cleanup: () => {}
2941
2941
  }), St = o((e = {}) => {
2942
2942
  let t = !!e.is_human_handled;
2943
- return j(t), t ? (k("agent"), e.agent_info?.name && se(e.agent_info.name), e.agent_info?.headshot && le(e.agent_info.headshot), t) : (k("ai"), t);
2943
+ return j(t), t ? (k("agent"), e.agent_info?.name && oe(e.agent_info.name), e.agent_info?.headshot && ce(e.agent_info.headshot), t) : (k("ai"), t);
2944
2944
  }, []), Ct = f(() => {
2945
2945
  let e = _?.widgetSettings?.call?.maxDurationSeconds ?? i?.widgetSettings?.call?.maxDurationSeconds ?? i?.callMaxDurationSeconds, t = Number(e);
2946
2946
  return Number.isFinite(t) && t > 0 ? t : te;
@@ -2960,17 +2960,17 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
2960
2960
  ct.current &&= (window.clearTimeout(ct.current), null);
2961
2961
  }, []), Et = (e) => {
2962
2962
  let t = typeof e == "string" ? e.trim().toLowerCase() : "";
2963
- return _e(t), ge(t, i?.siteId), t;
2963
+ return ge(t), N(t, i?.siteId), t;
2964
2964
  };
2965
2965
  c(() => {
2966
2966
  let e = i?.siteId;
2967
2967
  if (!e) return;
2968
- let t = M(e);
2968
+ let t = he(e);
2969
2969
  if (t) {
2970
- _e(t);
2970
+ ge(t);
2971
2971
  return;
2972
2972
  }
2973
- _e((t) => (t && ge(t, e), t));
2973
+ ge((t) => (t && N(t, e), t));
2974
2974
  }, [i?.siteId]);
2975
2975
  let G = (e = "unspecified") => {
2976
2976
  let t = W.current || nt.current?.callId, n = ht.current, r = ft.current;
@@ -3100,19 +3100,19 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3100
3100
  });
3101
3101
  };
3102
3102
  c(() => {
3103
- he({
3103
+ me({
3104
3104
  isOpen: T,
3105
3105
  activeScreen: O,
3106
3106
  isHumanHandled: A,
3107
3107
  agentName: re,
3108
- agentHeadshot: ce
3108
+ agentHeadshot: se
3109
3109
  });
3110
3110
  }, [
3111
3111
  T,
3112
3112
  O,
3113
3113
  A,
3114
3114
  re,
3115
- ce
3115
+ se
3116
3116
  ]), c(() => {
3117
3117
  let e = !0;
3118
3118
  return (async () => {
@@ -3120,7 +3120,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3120
3120
  try {
3121
3121
  let t = E(i), n = await Ie(t);
3122
3122
  if (!e) return;
3123
- let a = t.siteId, o = de(a), s = be(a), c = "";
3123
+ let a = t.siteId, o = ue(a), s = ye(a), c = "";
3124
3124
  try {
3125
3125
  let e = Qe.current, r = $e.current;
3126
3126
  if (Qe.current = !1, $e.current = null, c = (await Fe({
@@ -3132,9 +3132,9 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3132
3132
  resumeChatId: r,
3133
3133
  visitorId: s
3134
3134
  }))?.data?.chatId, !c) throw Error("resolve-session returned no chatId");
3135
- ae(), pe(a, c);
3135
+ M(), fe(a, c);
3136
3136
  } catch (e) {
3137
- console.warn("[FlowEngageProvider] resolve-session failed, reusing persisted or ephemeral chat id", e?.message || e), c = o || oe(), pe(a, c);
3137
+ console.warn("[FlowEngageProvider] resolve-session failed, reusing persisted or ephemeral chat id", e?.message || e), c = o || ae(), fe(a, c);
3138
3138
  }
3139
3139
  Ze.current = c;
3140
3140
  let l = Le({
@@ -3162,15 +3162,15 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3162
3162
  }), f.on("disconnect", () => {
3163
3163
  Ce("disconnected");
3164
3164
  }), f.on("aiTyping", () => {
3165
- Se(!0);
3165
+ xe(!0);
3166
3166
  }), f.on("ai:typing", () => {
3167
- Se(!0);
3167
+ xe(!0);
3168
3168
  }), f.on("messageReceived", (e) => {
3169
3169
  let t = e.message || e, n = {
3170
3170
  ...t,
3171
3171
  message: Tr(t.message)
3172
3172
  };
3173
- Se(!1), ye(!1), !(n.type === "call_recording" || typeof n.message == "string" && n.message.includes("AI chat recording")) && S((e) => [...e.filter((e) => !e.isPending), {
3173
+ xe(!1), ve(!1), !(n.type === "call_recording" || typeof n.message == "string" && n.message.includes("AI chat recording")) && S((e) => [...e.filter((e) => !e.isPending), {
3174
3174
  ...n,
3175
3175
  isPending: !1,
3176
3176
  id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
@@ -3188,7 +3188,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3188
3188
  ...t,
3189
3189
  message: Tr(t.message)
3190
3190
  };
3191
- Se(!1), !(n.type === "call_recording" || typeof n.message == "string" && n.message.includes("AI chat recording")) && ((n.sender === "agent" || n.agent_name || n.sender === "ai" || n.sender === "bot") && ye(!1), S((e) => n.sender === "bot" || n.sender === "ai" ? [...e, {
3191
+ xe(!1), !(n.type === "call_recording" || typeof n.message == "string" && n.message.includes("AI chat recording")) && ((n.sender === "agent" || n.agent_name || n.sender === "ai" || n.sender === "bot") && ve(!1), S((e) => n.sender === "bot" || n.sender === "ai" ? [...e, {
3192
3192
  ...n,
3193
3193
  isPending: !1,
3194
3194
  id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
@@ -3200,11 +3200,11 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3200
3200
  ...n,
3201
3201
  isPending: !1,
3202
3202
  id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
3203
- }]), (n.sender === "agent" || n.agent_name) && (j(!0), k("agent"), se(Ar([
3203
+ }]), (n.sender === "agent" || n.agent_name) && (j(!0), k("agent"), oe(Ar([
3204
3204
  n.agent_name,
3205
3205
  n.agentName,
3206
3206
  n.metadata?.agentName
3207
- ], d)), n.sender_headshot && le(n.sender_headshot), D(!0), je((e) => e + 1)));
3207
+ ], d)), n.sender_headshot && ce(n.sender_headshot), D(!0), je((e) => e + 1)));
3208
3208
  });
3209
3209
  let p = (e = {}) => {
3210
3210
  let t = Ar([
@@ -3213,7 +3213,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3213
3213
  e.agent_name,
3214
3214
  gt.current
3215
3215
  ], d);
3216
- j(!0), k("agent"), se(t), le(e.agent?.headshot || null), D(!0), je((e) => e + 1), S((e) => jr(e, {
3216
+ j(!0), k("agent"), oe(t), ce(e.agent?.headshot || null), D(!0), je((e) => e + 1), S((e) => jr(e, {
3217
3217
  id: `agent-joined-${Date.now()}`,
3218
3218
  sender: "system",
3219
3219
  message: `${t} has joined the chat.`,
@@ -3236,7 +3236,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3236
3236
  }));
3237
3237
  };
3238
3238
  f.on("agent:joined", p), f.on("agentJoined", p), f.on("agent:left", m), f.on("agentLeft", m), f.on("conversationEnded", (e) => {
3239
- Pe(!0);
3239
+ L(!0);
3240
3240
  let t = e?.message || "This conversation has ended. Thank you for reaching out!";
3241
3241
  S((e) => [...e, {
3242
3242
  id: `conversation-ended-${Date.now()}`,
@@ -3247,15 +3247,15 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3247
3247
  }]);
3248
3248
  }), f.on("chat:history_update", (e) => {
3249
3249
  let t = Er(e.chat_history || []);
3250
- S(t), t.length === 0 && (Pe(!1), j(!1), k("ai"), Se(!1), ye(!1));
3250
+ S(t), t.length === 0 && (L(!1), j(!1), k("ai"), xe(!1), ve(!1));
3251
3251
  }), f.on("conversation:reset", () => {
3252
- S([]), Pe(!1), j(!1), k("ai"), Se(!1), ye(!1);
3252
+ S([]), L(!1), j(!1), k("ai"), xe(!1), ve(!1);
3253
3253
  }), f.on("voice:end_session", (e = {}) => {
3254
3254
  console.log("[FlowEngageProvider] voice:end_session received — ending voice session"), Ne((e) => e + 1), D(!0), je((e) => e + 1);
3255
3255
  }), f.on("typing:start", (e) => {
3256
- e.sender === "agent" && ye(!0);
3256
+ e.sender === "agent" && ve(!0);
3257
3257
  }), f.on("typing:stop", (e) => {
3258
- e.sender === "agent" && ye(!1);
3258
+ e.sender === "agent" && ve(!1);
3259
3259
  }), f.on("call:incoming", (e = {}) => {
3260
3260
  let t = Ar([
3261
3261
  e.agentName,
@@ -3268,7 +3268,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3268
3268
  from: e.from || "owner",
3269
3269
  agentId: e.agentId || null,
3270
3270
  agentName: t
3271
- }), se((e) => Ar([t, e], "Agent")), He("incoming"), We(null), D(!0);
3271
+ }), oe((e) => Ar([t, e], "Agent")), He("incoming"), We(null), D(!0);
3272
3272
  }), f.on("call:offer", async (e = {}) => {
3273
3273
  nt.current = e;
3274
3274
  try {
@@ -3584,7 +3584,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3584
3584
  }
3585
3585
  let Ut = async (e, t = "", n = null, i = {}) => {
3586
3586
  let a = typeof e == "string" ? e.trim() : "";
3587
- if (!a || !B.current || !y || l !== "ready" || L) return;
3587
+ if (!a || !B.current || !y || l !== "ready" || Pe) return;
3588
3588
  Bt(), it.current = !1;
3589
3589
  let o = /^\s*(yes|yeah|sure|ok|okay|go ahead|take me(?: there)?(?!\s+\w)|navigate(?!\s+(?:me\s+)?to\s+\w)|yep|absolutely|please do|do it|let'?s go|go there|show me(?!\s+(?:the|a|an)\s+\w)|go to it|bring me there|navigate me there)\b/i, s = /^\s*(?:yes|yeah|sure|ok|okay|yep|absolutely)\s+(?!(?:please|do\s+it|let'?s|that|this|there|it|thanks|go|cool|great|perfect|sounds|alright|proceed)\b)\w/i, c = /\b(take me|navigate|go to|show me|bring me|open|go there|navigate to|take me to|let'?s go to)\b/i;
3590
3590
  if (rt.current && o.test(a) && !s.test(a)) {
@@ -3620,7 +3620,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3620
3620
  chatId: y,
3621
3621
  content: e,
3622
3622
  sender: "user",
3623
- email: ue || void 0,
3623
+ email: le || void 0,
3624
3624
  type: i?.type || "text",
3625
3625
  metadata: i?.metadata || {},
3626
3626
  ...n || {}
@@ -3631,7 +3631,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3631
3631
  try {
3632
3632
  let o = await B.current.sendAiMessage(y, e, r, t, {
3633
3633
  ...n || {},
3634
- ...ue ? { email: ue } : {}
3634
+ ...le ? { email: le } : {}
3635
3635
  }, {
3636
3636
  ...i,
3637
3637
  currentPageUrl: typeof window < "u" ? window.location.href : void 0,
@@ -3700,9 +3700,9 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3700
3700
  });
3701
3701
  }
3702
3702
  }
3703
- S(Er(s)), j(!!o.is_human_handled), k(o.is_human_handled ? "agent" : "ai"), Se(!1), we(!1), await B.current.updateChatStatus(y, "messageSent");
3703
+ S(Er(s)), j(!!o.is_human_handled), k(o.is_human_handled ? "agent" : "ai"), xe(!1), we(!1), await B.current.updateChatStatus(y, "messageSent");
3704
3704
  } catch (e) {
3705
- S((e) => e.filter((e) => e.id !== u)), Se(!1), we(!1), e.status === 429 ? (F(!0), Oe(e.message), window.setTimeout(() => {
3705
+ S((e) => e.filter((e) => e.id !== u)), xe(!1), we(!1), e.status === 429 ? (F(!0), Oe(e.message), window.setTimeout(() => {
3706
3706
  F(!1), Oe("");
3707
3707
  }, ee)) : h(e);
3708
3708
  }
@@ -3756,7 +3756,7 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3756
3756
  await B.current.updateChatStatus(y, "ended");
3757
3757
  } catch {}
3758
3758
  }
3759
- Pe(!0), S((e) => [...e, {
3759
+ L(!0), S((e) => [...e, {
3760
3760
  id: `conversation-ended-${Date.now()}`,
3761
3761
  sender: "system",
3762
3762
  message: "This conversation has ended. Thank you for reaching out!",
@@ -3795,9 +3795,9 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3795
3795
  }, []);
3796
3796
  let Jt = o(() => {
3797
3797
  let e = i?.siteId;
3798
- fe(e), Qe.current = !0, $e.current = null, z.current?.disconnect(), S([]), b(""), Ze.current = "", Pe(!1), j(!1), se(null), le(null), Xe(!0), s((e) => e + 1);
3798
+ de(e), Qe.current = !0, $e.current = null, z.current?.disconnect(), S([]), b(""), Ze.current = "", L(!1), j(!1), oe(null), ce(null), Xe(!0), s((e) => e + 1);
3799
3799
  }, [i?.siteId]), Yt = o((e) => {
3800
- i?.siteId, Qe.current = !1, $e.current = e, z.current?.disconnect(), S([]), b(""), Ze.current = "", Pe(!1), j(!1), se(null), le(null), Xe(!0), s((e) => e + 1);
3800
+ i?.siteId, Qe.current = !1, $e.current = e, z.current?.disconnect(), S([]), b(""), Ze.current = "", L(!1), j(!1), oe(null), ce(null), Xe(!0), s((e) => e + 1);
3801
3801
  }, [i?.siteId]), Xt = f(() => ({
3802
3802
  status: l,
3803
3803
  error: d,
@@ -3809,16 +3809,16 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3809
3809
  activeScreen: O,
3810
3810
  isHumanHandled: A,
3811
3811
  agentName: re,
3812
- agentHeadshot: ce,
3813
- visitorEmail: ue,
3814
- isAgentTyping: ve,
3815
- isAiTyping: xe,
3816
- connectionStatus: N,
3812
+ agentHeadshot: se,
3813
+ visitorEmail: le,
3814
+ isAgentTyping: _e,
3815
+ isAiTyping: be,
3816
+ connectionStatus: Se,
3817
3817
  isLoading: P,
3818
3818
  isVoiceMode: I,
3819
3819
  isRateLimited: Te,
3820
3820
  rateLimitMessage: De,
3821
- isConversationEnded: L,
3821
+ isConversationEnded: Pe,
3822
3822
  isSessionRestoring: Ye,
3823
3823
  openToChatCounter: Ae,
3824
3824
  voiceEndCounter: Me,
@@ -3870,16 +3870,16 @@ function Mr({ siteId: e, config: t, children: n, language: r = "en" }) {
3870
3870
  O,
3871
3871
  A,
3872
3872
  re,
3873
- ce,
3874
- ue,
3875
- ve,
3876
- xe,
3877
- N,
3873
+ se,
3874
+ le,
3875
+ _e,
3876
+ be,
3877
+ Se,
3878
3878
  P,
3879
3879
  I,
3880
3880
  Te,
3881
3881
  De,
3882
- L,
3882
+ Pe,
3883
3883
  Ye,
3884
3884
  Ae,
3885
3885
  Me,
@@ -8826,8 +8826,13 @@ var _m = {
8826
8826
  ..._m,
8827
8827
  ...nm,
8828
8828
  ...vm
8829
- }, hp), bm = 24e3, xm = 2048, Sm = 1200;
8830
- function Cm(e) {
8829
+ }, hp), bm = 24e3, xm = 2048, Sm = 1200, Cm = .05, wm = 4;
8830
+ function Tm(e) {
8831
+ let t = 0;
8832
+ for (let n = 0; n < e.length; n++) t += e[n] * e[n];
8833
+ return Math.sqrt(t / e.length);
8834
+ }
8835
+ function Em(e) {
8831
8836
  let t = new Int16Array(e.length);
8832
8837
  for (let n = 0; n < e.length; n++) {
8833
8838
  let r = Math.max(-1, Math.min(1, e[n]));
@@ -8835,35 +8840,37 @@ function Cm(e) {
8835
8840
  }
8836
8841
  return t;
8837
8842
  }
8838
- function wm(e) {
8843
+ function Dm(e) {
8839
8844
  let t = new Float32Array(e.length);
8840
8845
  for (let n = 0; n < e.length; n++) t[n] = e[n] / 32768;
8841
8846
  return t;
8842
8847
  }
8843
- function Tm(e, t) {
8844
- let n = 0, r = [];
8848
+ var Om = .18;
8849
+ function km(e, t) {
8850
+ let n = 0, r = 0, i = [], a = () => {
8851
+ i.forEach((e) => {
8852
+ try {
8853
+ e.stop();
8854
+ } catch {}
8855
+ }), i = [], n = 0;
8856
+ }, o = () => n > e.currentTime;
8845
8857
  return {
8846
- enqueue: (i) => {
8847
- let a = wm(i), o = e.createBuffer(1, a.length, bm);
8848
- o.copyToChannel(a, 0);
8849
- let s = e.createBufferSource();
8850
- s.buffer = o, s.connect(e.destination);
8851
- let c = Math.max(e.currentTime, n);
8852
- s.start(c), n = c + o.duration, r.push(s), s.onended = () => {
8853
- r = r.filter((e) => e !== s), r.length || t?.();
8858
+ enqueue: (a) => {
8859
+ let s = Dm(a), c = e.createBuffer(1, s.length, bm);
8860
+ c.copyToChannel(s, 0);
8861
+ let l = e.createBufferSource();
8862
+ l.buffer = c, l.connect(e.destination);
8863
+ let u = !o(), d = u ? e.currentTime + Om : n;
8864
+ u && (r = d), l.start(d), n = d + c.duration, i.push(l), l.onended = () => {
8865
+ i = i.filter((e) => e !== l), !i.length && !o() && t?.();
8854
8866
  };
8855
8867
  },
8856
- stop: () => {
8857
- r.forEach((e) => {
8858
- try {
8859
- e.stop();
8860
- } catch {}
8861
- }), r = [], n = 0;
8862
- },
8863
- isPlaying: () => r.length > 0
8868
+ stop: a,
8869
+ isPlaying: o,
8870
+ playedMs: () => Math.max(0, (e.currentTime - r) * 1e3)
8864
8871
  };
8865
8872
  }
8866
- async function Em(e, t, n) {
8873
+ async function Am(e, t, n) {
8867
8874
  let r = new URLSearchParams({ siteId: t || "" });
8868
8875
  n && r.set("chatId", n);
8869
8876
  let i = await fetch(`${e}/api/voice/session?${r.toString()}`, {
@@ -8879,75 +8886,95 @@ async function Em(e, t, n) {
8879
8886
  if (!a?.success || !a.wsUrl) throw Error(a?.error || "Voice session was refused.");
8880
8887
  return a;
8881
8888
  }
8882
- async function Dm(e) {
8883
- let { apiBaseUrl: t, siteId: n, chatId: r, clientTools: i = {}, onConnect: a, onDisconnect: o, onMessage: s, onModeChange: c, onError: l, onUnhandledClientToolCall: u, onAgentTurnEnd: d, onSessionInfo: f } = e, p = await Em(t, n, r);
8884
- f?.({ emailOnFile: !!p.emailOnFile });
8885
- let m = { type: "Start" };
8886
- e.greeting !== void 0 && (m.greeting = e.greeting || null);
8887
- let h = await navigator.mediaDevices.getUserMedia({ audio: {
8889
+ async function jm(e) {
8890
+ let { apiBaseUrl: t, siteId: n, chatId: r, clientTools: i = {}, onConnect: a, onDisconnect: o, onMessage: s, onModeChange: c, onError: l, onUnhandledClientToolCall: u, onAgentTurnEnd: d, onSessionInfo: f, onSessionEnding: p } = e, m = await Am(t, n, r);
8891
+ f?.({ emailOnFile: !!m.emailOnFile });
8892
+ let h = { type: "Start" };
8893
+ e.greeting !== void 0 && (h.greeting = e.greeting || null);
8894
+ let g = await navigator.mediaDevices.getUserMedia({ audio: {
8888
8895
  channelCount: 1,
8889
8896
  echoCancellation: !0,
8890
8897
  noiseSuppression: !0,
8891
8898
  autoGainControl: !0
8892
- } }), g = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: bm });
8893
- g.state === "suspended" && await g.resume();
8894
- let _ = new WebSocket(p.wsUrl);
8895
- _.binaryType = "arraybuffer";
8896
- let v = /* @__PURE__ */ new Set(), y = {
8899
+ } }), _ = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: bm });
8900
+ _.state === "suspended" && await _.resume();
8901
+ let v = new WebSocket(m.wsUrl);
8902
+ v.binaryType = "arraybuffer";
8903
+ let y = /* @__PURE__ */ new Set(), b = {
8897
8904
  role: null,
8898
8905
  text: "",
8899
8906
  timer: null
8900
- }, b = "", x = () => {
8901
- y.timer &&= (clearTimeout(y.timer), null);
8902
- let e = y.text.trim(), t = y.role;
8903
- if (y.text = "", y.role = null, !(!e || !t)) {
8907
+ }, x = "", S = () => {
8908
+ b.timer &&= (clearTimeout(b.timer), null);
8909
+ let e = b.text.trim(), t = b.role;
8910
+ if (b.text = "", b.role = null, !(!e || !t)) {
8904
8911
  if (t === "agent") {
8905
- if (e === b) {
8912
+ if (e === x) {
8906
8913
  console.debug("[FlowEngage] duplicate agent turn suppressed");
8907
8914
  return;
8908
8915
  }
8909
- b = e;
8916
+ x = e;
8910
8917
  }
8911
8918
  s?.({
8912
8919
  role: t,
8913
8920
  message: e
8914
8921
  });
8915
8922
  }
8916
- }, S = (e, t) => {
8917
- t && (y.role && y.role !== e && x(), y.role = e, y.text = y.text ? `${y.text} ${t}`.replace(/\s+/g, " ") : t, y.timer && clearTimeout(y.timer), y.timer = setTimeout(x, Sm));
8918
- }, C = !1, w = !1, T = !1, E = !1, D = !0, O = null, k = () => {
8919
- O && clearTimeout(O);
8923
+ }, C = (e, t) => {
8924
+ t && (b.role && b.role !== e && S(), b.role = e, b.text = b.text ? `${b.text} ${t}`.replace(/\s+/g, " ") : t, b.timer && clearTimeout(b.timer), b.timer = setTimeout(S, Sm));
8925
+ }, w = !1, T = !1, E = !1, D = !1, O = !0, k = 0, A = !1, ee = !1, te = Cm, ne = wm, j = null, re = !1, ie = () => {
8926
+ j && clearTimeout(j);
8920
8927
  let e = () => {
8921
- if (!C) {
8922
- if (A.isPlaying()) {
8923
- O = setTimeout(e, 150);
8928
+ if (!w) {
8929
+ if (M.isPlaying()) {
8930
+ j = setTimeout(e, 150);
8924
8931
  return;
8925
8932
  }
8926
- O = null, d?.();
8933
+ if (j = null, re) {
8934
+ p?.();
8935
+ return;
8936
+ }
8937
+ !w && v.readyState === WebSocket.OPEN && v.send(JSON.stringify({ type: "PlaybackDrained" })), d?.();
8927
8938
  }
8928
8939
  };
8929
- O = setTimeout(e, 150);
8930
- }, A = Tm(g, () => {
8931
- E && (E = !1, c?.({ mode: "listening" }));
8932
- }), ee = g.createMediaStreamSource(h), te = g.createScriptProcessor(xm, 1, 1);
8933
- te.onaudioprocess = (e) => {
8934
- if (C || _.readyState !== WebSocket.OPEN) return;
8935
- let t = e.inputBuffer.getChannelData(0);
8936
- if (w) {
8937
- T || (T = !0, console.debug("[FlowEngage] mic held — streaming silence to keep socket alive")), _.send(new Int16Array(t.length).buffer);
8940
+ j = setTimeout(e, 150);
8941
+ }, M = km(_, () => {
8942
+ D && (D = !1, c?.({ mode: "listening" }));
8943
+ }), ae = _.createMediaStreamSource(g), oe = _.createScriptProcessor(xm, 1, 1);
8944
+ oe.onaudioprocess = (e) => {
8945
+ if (w || v.readyState !== WebSocket.OPEN) return;
8946
+ let t = e.inputBuffer.getChannelData(0), n = () => v.send(new Int16Array(t.length).buffer);
8947
+ if (T) {
8948
+ E || (E = !0, console.debug("[FlowEngage] mic held — streaming silence to keep socket alive")), n();
8938
8949
  return;
8939
8950
  }
8940
- _.send(Cm(t).buffer);
8941
- }, ee.connect(te), te.connect(g.destination);
8942
- let ne = () => {
8943
- if (!C) {
8944
- C = !0, O &&= (clearTimeout(O), null), x(), A.stop();
8951
+ if ((M.isPlaying() || ee) && !A) {
8952
+ if (Tm(t) < te) {
8953
+ k = 0, n();
8954
+ return;
8955
+ }
8956
+ if (k += 1, k < ne) {
8957
+ n();
8958
+ return;
8959
+ }
8960
+ A = !0, k = 0;
8961
+ let e = M.playedMs();
8962
+ M.stop(), O = !1, ee = !1, v.send(JSON.stringify({
8963
+ type: "VisitorInterrupted",
8964
+ played_ms: Math.round(e)
8965
+ })), console.debug("[FlowEngage] barge-in — visitor spoke over the agent");
8966
+ }
8967
+ v.send(Em(t).buffer);
8968
+ }, ae.connect(oe), oe.connect(_.destination);
8969
+ let se = () => {
8970
+ if (!w) {
8971
+ w = !0, j &&= (clearTimeout(j), null), S(), M.stop();
8945
8972
  try {
8946
- te.disconnect(), ee.disconnect();
8973
+ oe.disconnect(), ae.disconnect();
8947
8974
  } catch {}
8948
- h.getTracks().forEach((e) => e.stop()), g.close().catch(() => {}), (_.readyState === WebSocket.OPEN || _.readyState === WebSocket.CONNECTING) && _.close();
8975
+ g.getTracks().forEach((e) => e.stop()), _.close().catch(() => {}), (v.readyState === WebSocket.OPEN || v.readyState === WebSocket.CONNECTING) && v.close();
8949
8976
  }
8950
- }, j = async (e) => {
8977
+ }, ce = async (e) => {
8951
8978
  let t = i[e.name];
8952
8979
  if (!t) return u?.({ tool_name: e.name }), { error: `Unknown tool ${e.name}` };
8953
8980
  let n = {};
@@ -8959,29 +8986,29 @@ async function Dm(e) {
8959
8986
  } catch (e) {
8960
8987
  return { error: e?.message || "Tool execution failed" };
8961
8988
  }
8962
- }, re = async (e) => {
8989
+ }, le = async (e) => {
8963
8990
  for (let t of e.functions || []) {
8964
8991
  if (!t.client_side) continue;
8965
- let e = await j(t);
8966
- if (C || _.readyState !== WebSocket.OPEN) return;
8967
- _.send(JSON.stringify({
8992
+ let e = await ce(t);
8993
+ if (w || v.readyState !== WebSocket.OPEN) return;
8994
+ v.send(JSON.stringify({
8968
8995
  type: "FunctionCallResponse",
8969
8996
  id: t.id,
8970
8997
  name: t.name,
8971
8998
  content: typeof e == "string" ? e : JSON.stringify(e ?? {})
8972
8999
  }));
8973
9000
  }
8974
- }, ie = (e) => {
9001
+ }, ue = (e) => {
8975
9002
  switch (e.type) {
8976
9003
  case "Welcome":
8977
- a?.({ conversationId: e.session_id || r || n });
9004
+ Number.isFinite(e.barge_in_rms) && e.barge_in_rms > 0 && (te = e.barge_in_rms), Number.isFinite(e.barge_in_frames) && e.barge_in_frames > 0 && (ne = e.barge_in_frames), a?.({ conversationId: e.session_id || r || n });
8978
9005
  break;
8979
9006
  case "ConversationText": {
8980
9007
  let t = String(e.content || "");
8981
9008
  if (e.role === "user") {
8982
9009
  let e = t.trim();
8983
- if (v.has(e)) {
8984
- v.delete(e);
9010
+ if (y.has(e)) {
9011
+ y.delete(e);
8985
9012
  break;
8986
9013
  }
8987
9014
  if (/^\[SYSTEM:/i.test(e) || /^Continue (now )?to the next section/i.test(e) || /^That was the last section/i.test(e)) {
@@ -8989,20 +9016,26 @@ async function Dm(e) {
8989
9016
  break;
8990
9017
  }
8991
9018
  }
8992
- S(e.role === "user" ? "user" : "agent", t);
9019
+ C(e.role === "user" ? "user" : "agent", t);
8993
9020
  break;
8994
9021
  }
8995
9022
  case "UserStartedSpeaking":
8996
- x(), A.stop(), D = !1, E = !1, c?.({ mode: "listening" });
9023
+ S(), M.stop(), ee = !1, O = !1, D = !1, c?.({ mode: "listening" });
8997
9024
  break;
8998
9025
  case "AgentStartedSpeaking":
8999
- D = !0, E = !0, c?.({ mode: "speaking" });
9026
+ O = !0, D = !0, A = !1, k = 0, c?.({ mode: "speaking" });
9000
9027
  break;
9001
9028
  case "AgentAudioDone":
9002
- x(), k(), A.isPlaying() || (E = !1, c?.({ mode: "listening" }));
9029
+ ee = !1, S(), ie(), M.isPlaying() || (D = !1, c?.({ mode: "listening" }));
9003
9030
  break;
9004
9031
  case "FunctionCallRequest":
9005
- re(e);
9032
+ le(e);
9033
+ break;
9034
+ case "AgentPreparing":
9035
+ ee = !0;
9036
+ break;
9037
+ case "SessionEnding":
9038
+ console.debug("[FlowEngage] server is ending the session:", e.reason || "unspecified"), re = !0;
9006
9039
  break;
9007
9040
  case "PromptUpdated":
9008
9041
  case "AgentThinking": break;
@@ -9015,46 +9048,56 @@ async function Dm(e) {
9015
9048
  default: break;
9016
9049
  }
9017
9050
  };
9018
- return _.onopen = () => _.send(JSON.stringify(m)), _.onmessage = (e) => {
9051
+ return v.onopen = () => v.send(JSON.stringify(h)), v.onmessage = (e) => {
9019
9052
  if (e.data instanceof ArrayBuffer) {
9020
- D && A.enqueue(new Int16Array(e.data));
9053
+ O && M.enqueue(new Int16Array(e.data));
9021
9054
  return;
9022
9055
  }
9023
9056
  try {
9024
- ie(JSON.parse(e.data));
9057
+ ue(JSON.parse(e.data));
9025
9058
  } catch {}
9026
- }, _.onerror = () => l?.(/* @__PURE__ */ Error("Voice connection failed")), _.onclose = () => {
9027
- ne(), o?.();
9059
+ }, v.onerror = () => l?.(/* @__PURE__ */ Error("Voice connection failed")), v.onclose = () => {
9060
+ se(), o?.();
9028
9061
  }, {
9029
- endSession: async () => ne(),
9062
+ endSession: async () => se(),
9030
9063
  sendContextualUpdate: (e) => {
9031
- C || _.readyState !== WebSocket.OPEN || !e || _.send(JSON.stringify({
9064
+ w || v.readyState !== WebSocket.OPEN || !e || v.send(JSON.stringify({
9032
9065
  type: "UpdatePrompt",
9033
9066
  prompt: e
9034
9067
  }));
9035
9068
  },
9036
- sendUserMessage: (e, { silent: t = !0 } = {}) => {
9037
- C || _.readyState !== WebSocket.OPEN || !e || (t && v.add(e.trim()), _.send(JSON.stringify({
9069
+ sendUserMessage: (e, { silent: t = !0, suppressQuestion: n = !1 } = {}) => {
9070
+ w || v.readyState !== WebSocket.OPEN || !e || (t && y.add(e.trim()), v.send(JSON.stringify({
9038
9071
  type: "InjectUserMessage",
9039
- content: e
9072
+ content: e,
9073
+ suppress_question: n
9040
9074
  })));
9041
9075
  },
9042
9076
  injectAgentSpeech: (e, t = "interrupt") => {
9043
- C || _.readyState !== WebSocket.OPEN || !e || _.send(JSON.stringify({
9077
+ w || v.readyState !== WebSocket.OPEN || !e || v.send(JSON.stringify({
9044
9078
  type: "InjectAgentMessage",
9045
9079
  message: e,
9046
9080
  behavior: t
9047
9081
  }));
9048
9082
  },
9083
+ setWalkthroughActive: (e) => {
9084
+ w || v.readyState !== WebSocket.OPEN || v.send(JSON.stringify({
9085
+ type: "WalkthroughActive",
9086
+ active: !!e
9087
+ }));
9088
+ },
9049
9089
  setMicMuted: (e) => {
9050
- w = !!e;
9090
+ T = !!e, !w && v.readyState === WebSocket.OPEN && v.send(JSON.stringify({
9091
+ type: "MicHeld",
9092
+ held: T
9093
+ }));
9051
9094
  },
9052
9095
  get status() {
9053
- return C ? "disconnected" : "connected";
9096
+ return w ? "disconnected" : "connected";
9054
9097
  }
9055
9098
  };
9056
9099
  }
9057
- var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9100
+ var Mm = { startSession: jm }, Nm = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9058
9101
  width: e,
9059
9102
  height: e,
9060
9103
  viewBox: "0 0 24 24",
@@ -9070,7 +9113,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9070
9113
  strokeLinecap: "round",
9071
9114
  strokeLinejoin: "round"
9072
9115
  })]
9073
- }), Am = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
9116
+ }), Pm = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
9074
9117
  width: e,
9075
9118
  height: e,
9076
9119
  viewBox: "0 0 24 24",
@@ -9085,7 +9128,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9085
9128
  x2: "1",
9086
9129
  y2: "23"
9087
9130
  })]
9088
- }), jm = ({ size: e = 18 }) => /* @__PURE__ */ _("svg", {
9131
+ }), Fm = ({ size: e = 18 }) => /* @__PURE__ */ _("svg", {
9089
9132
  width: e,
9090
9133
  height: e,
9091
9134
  viewBox: "0 0 24 24",
@@ -9100,7 +9143,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9100
9143
  x2: "12",
9101
9144
  y2: "5"
9102
9145
  }), /* @__PURE__ */ g("polyline", { points: "5 12 12 5 19 12" })]
9103
- }), Mm = () => /* @__PURE__ */ _("svg", {
9146
+ }), Im = () => /* @__PURE__ */ _("svg", {
9104
9147
  width: "14",
9105
9148
  height: "14",
9106
9149
  viewBox: "0 0 24 24",
@@ -9110,7 +9153,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9110
9153
  strokeLinecap: "round",
9111
9154
  strokeLinejoin: "round",
9112
9155
  children: [/* @__PURE__ */ g("polyline", { points: "9 17 4 12 9 7" }), /* @__PURE__ */ g("path", { d: "M20 18v-2a4 4 0 00-4-4H4" })]
9113
- }), Nm = () => /* @__PURE__ */ g("svg", {
9156
+ }), Lm = () => /* @__PURE__ */ g("svg", {
9114
9157
  width: "18",
9115
9158
  height: "18",
9116
9159
  viewBox: "0 0 24 24",
@@ -9120,7 +9163,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9120
9163
  strokeLinecap: "round",
9121
9164
  strokeLinejoin: "round",
9122
9165
  children: /* @__PURE__ */ g("path", { d: "M22 16.92v3a2 2 0 01-2.18 2 19.79 19.79 0 01-8.63-3.07 19.42 19.42 0 01-6.12-6.11A19.79 19.79 0 012 4.11 2 2 0 014.11 2h3a2 2 0 012 1.72c.13.96.37 1.91.71 2.81a2 2 0 01-.45 2.11L8.09 9.91a16 16 0 006 6l1.27-1.27a2 2 0 012.11-.45c.9.34 1.85.58 2.81.71A2 2 0 0122 16.92z" })
9123
- }), Pm = ({ className: e = "" }) => /* @__PURE__ */ _("svg", {
9166
+ }), Rm = ({ className: e = "" }) => /* @__PURE__ */ _("svg", {
9124
9167
  className: e,
9125
9168
  width: "14",
9126
9169
  height: "14",
@@ -9149,7 +9192,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9149
9192
  y2: "16"
9150
9193
  })
9151
9194
  ]
9152
- }), Fm = ({ size: e = 14 }) => /* @__PURE__ */ _("svg", {
9195
+ }), zm = ({ size: e = 14 }) => /* @__PURE__ */ _("svg", {
9153
9196
  width: e,
9154
9197
  height: e,
9155
9198
  viewBox: "0 0 24 24",
@@ -9172,7 +9215,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9172
9215
  /* @__PURE__ */ g("path", { d: "M15 13v2" }),
9173
9216
  /* @__PURE__ */ g("path", { d: "M9 13v2" })
9174
9217
  ]
9175
- }), Im = ({ size: e = 20, strokeWidth: t = 2, color: n = "currentColor" }) => /* @__PURE__ */ _("svg", {
9218
+ }), Bm = ({ size: e = 20, strokeWidth: t = 2, color: n = "currentColor" }) => /* @__PURE__ */ _("svg", {
9176
9219
  width: e,
9177
9220
  height: e,
9178
9221
  viewBox: "0 0 24 24",
@@ -9192,7 +9235,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9192
9235
  x2: "19",
9193
9236
  y2: "12"
9194
9237
  })]
9195
- }), Lm = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9238
+ }), Vm = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9196
9239
  width: e,
9197
9240
  height: e,
9198
9241
  viewBox: "0 0 24 24",
@@ -9218,7 +9261,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9218
9261
  fill: t
9219
9262
  })
9220
9263
  ]
9221
- }), Rm = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9264
+ }), Hm = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9222
9265
  width: "24",
9223
9266
  height: "24",
9224
9267
  viewBox: "0 0 24 24",
@@ -9236,7 +9279,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9236
9279
  "stroke-linecap": "round",
9237
9280
  "stroke-linejoin": "round"
9238
9281
  })]
9239
- }), zm = () => /* @__PURE__ */ g("svg", {
9282
+ }), Um = () => /* @__PURE__ */ g("svg", {
9240
9283
  width: "24",
9241
9284
  height: "24",
9242
9285
  viewBox: "0 0 24 24",
@@ -9248,7 +9291,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9248
9291
  "stroke-width": "1.5",
9249
9292
  "stroke-linejoin": "round"
9250
9293
  })
9251
- }), Bm = ({ size: e = 24 }) => /* @__PURE__ */ _("svg", {
9294
+ }), Wm = ({ size: e = 24 }) => /* @__PURE__ */ _("svg", {
9252
9295
  xmlns: "http://www.w3.org/2000/svg",
9253
9296
  width: e,
9254
9297
  height: e,
@@ -9266,7 +9309,7 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9266
9309
  /* @__PURE__ */ g("path", { d: "m2 2 20 20" }),
9267
9310
  /* @__PURE__ */ g("path", { d: "M9 9v3a3 3 0 0 0 5.12 2.12" })
9268
9311
  ]
9269
- }), Vm = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), Hm = (e = "") => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), Um = new Set([
9312
+ }), Gm = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), Km = (e = "") => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), qm = new Set([
9270
9313
  "p",
9271
9314
  "br",
9272
9315
  "ul",
@@ -9277,30 +9320,30 @@ var Om = { startSession: Dm }, km = ({ size: e = 18, color: t = "currentColor" }
9277
9320
  "b",
9278
9321
  "i",
9279
9322
  "a"
9280
- ]), Wm = /^https?:\/\//i;
9281
- function Gm(e) {
9323
+ ]), Jm = /^https?:\/\//i;
9324
+ function Ym(e) {
9282
9325
  let t = Array.from(e.childNodes);
9283
9326
  for (let n of t) if (n.nodeType === Node.ELEMENT_NODE) {
9284
9327
  let t = n.tagName.toLowerCase();
9285
- if (!Um.has(t)) {
9328
+ if (!qm.has(t)) {
9286
9329
  e.replaceChild(document.createTextNode(n.textContent), n);
9287
9330
  continue;
9288
9331
  }
9289
9332
  let r = {};
9290
9333
  if (t === "a") {
9291
9334
  let e = n.getAttribute("href") || "";
9292
- Wm.test(e) && (r.href = e), r.target = "_blank", r.rel = "noopener noreferrer";
9335
+ Jm.test(e) && (r.href = e), r.target = "_blank", r.rel = "noopener noreferrer";
9293
9336
  }
9294
9337
  for (; n.attributes.length > 0;) n.removeAttribute(n.attributes[0].name);
9295
9338
  for (let [e, t] of Object.entries(r)) n.setAttribute(e, t);
9296
- Gm(n);
9339
+ Ym(n);
9297
9340
  } else n.nodeType !== Node.TEXT_NODE && e.removeChild(n);
9298
9341
  }
9299
- function Km(e) {
9342
+ function Xm(e) {
9300
9343
  let t = document.createElement("div");
9301
- return t.innerHTML = e, Gm(t), t.innerHTML;
9344
+ return t.innerHTML = e, Ym(t), t.innerHTML;
9302
9345
  }
9303
- function qm(e) {
9346
+ function Zm(e) {
9304
9347
  let t = String(e || "").trim();
9305
9348
  if (!t) return t;
9306
9349
  let n = /^<p>\s*<strong>([\s\S]*?)<\/strong>\s*<\/p>$/i.exec(t);
@@ -9312,33 +9355,33 @@ function qm(e) {
9312
9355
  }
9313
9356
  return e;
9314
9357
  }
9315
- var Jm = (e = "") => {
9358
+ var Qm = (e = "") => {
9316
9359
  let t = String(e || "").trim();
9317
9360
  if (!t) return "";
9318
- if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return qm(Km(t));
9319
- 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) => Hm(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>");
9320
- return qm(n.map((e) => {
9361
+ if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return Zm(Xm(t));
9362
+ 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) => Km(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>");
9363
+ return Zm(n.map((e) => {
9321
9364
  let t = e.split("\n").map((e) => e.trim()).filter(Boolean), n = t.filter((e) => /^[-*]\s+/.test(e));
9322
9365
  if (n.length >= 2 && n.length === t.length) return `<ul>${n.map((e) => `<li>${r(e.replace(/^[-*]\s+/, ""))}</li>`).join("")}</ul>`;
9323
9366
  let i = e.split(/\s+(?=[-*]\s+\*\*?)/).map((e) => e.trim()).filter(Boolean);
9324
9367
  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>`;
9325
9368
  }).join(""));
9326
- }, Ym = new Set(["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]), Xm = new Set([
9369
+ }, $m = new Set(["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]), eh = new Set([
9327
9370
  ".pdf",
9328
9371
  ".docx",
9329
9372
  ".png",
9330
9373
  ".jpg",
9331
9374
  ".jpeg"
9332
- ]), Zm = "image/png,image/jpeg,.pdf,.docx";
9333
- function Qm(e) {
9375
+ ]), th = "image/png,image/jpeg,.pdf,.docx";
9376
+ function nh(e) {
9334
9377
  if (!e) return !1;
9335
9378
  let t = typeof e.name == "string" ? e.name.toLowerCase() : "", n = t.includes(".") ? `.${t.split(".").pop()}` : "", r = typeof e.type == "string" ? e.type.toLowerCase() : "";
9336
- return r === "image/png" || r === "image/jpeg" || Ym.has(r) || Xm.has(n);
9379
+ return r === "image/png" || r === "image/jpeg" || $m.has(r) || eh.has(n);
9337
9380
  }
9338
- function $m(e) {
9339
- return e ? Qm(e) ? e.size > 2097152 ? "File must be 2 MB or smaller." : "" : "Only PNG, JPEG, PDF, and DOCX files are allowed." : "No file selected.";
9381
+ function rh(e) {
9382
+ return e ? nh(e) ? e.size > 2097152 ? "File must be 2 MB or smaller." : "" : "Only PNG, JPEG, PDF, and DOCX files are allowed." : "No file selected.";
9340
9383
  }
9341
- function eh(e = 0) {
9384
+ function ih(e = 0) {
9342
9385
  if (!Number.isFinite(e) || e <= 0) return "";
9343
9386
  let t = [
9344
9387
  "B",
@@ -9350,12 +9393,12 @@ function eh(e = 0) {
9350
9393
  let i = n >= 10 || r === 0 ? 0 : 1;
9351
9394
  return `${n.toFixed(i)} ${t[r]}`;
9352
9395
  }
9353
- function th(e) {
9396
+ function ah(e) {
9354
9397
  return e ? e.name || "Attachment" : "";
9355
9398
  }
9356
9399
  //#endregion
9357
9400
  //#region src/utils/avatarHelpers.js
9358
- function nh(e) {
9401
+ function oh(e) {
9359
9402
  if (!e || typeof e != "string") return "?";
9360
9403
  let t = e.trim();
9361
9404
  if (!t) return "?";
@@ -9364,7 +9407,7 @@ function nh(e) {
9364
9407
  }
9365
9408
  //#endregion
9366
9409
  //#region src/components/AvatarImageOrInitials.jsx
9367
- function rh({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
9410
+ function sh({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
9368
9411
  let [i, a] = m(null), o = typeof e == "string" ? e.trim() : "";
9369
9412
  return c(() => {
9370
9413
  if (!o) {
@@ -9387,12 +9430,12 @@ function rh({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
9387
9430
  onError: () => a(null)
9388
9431
  }) : /* @__PURE__ */ g("span", {
9389
9432
  style: r,
9390
- children: nh(t)
9433
+ children: oh(t)
9391
9434
  });
9392
9435
  }
9393
9436
  //#endregion
9394
9437
  //#region src/components/MessageList.jsx
9395
- function ih({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, setReplyContext: i, primaryColor: a = "#3B82F6", agentHeadshot: s = null, agentDisplayName: l = "Agent", botAvatarNode: u = null }) {
9438
+ function ch({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, setReplyContext: i, primaryColor: a = "#3B82F6", agentHeadshot: s = null, agentDisplayName: l = "Agent", botAvatarNode: u = null }) {
9396
9439
  let { resolvedConfig: d } = Cn(), f = p(null), [v, y] = m(null), [b, x] = m(null), S = p(e.length), C = p(!0), w = p(null), T = o((e) => {
9397
9440
  let t = e.target.closest("a[href]");
9398
9441
  if (!t) return;
@@ -9447,7 +9490,7 @@ function ih({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9447
9490
  children: [
9448
9491
  e.map((e) => {
9449
9492
  if (e.type === "call_recording" || typeof e.message == "string" && e.message.includes("AI chat recording")) return null;
9450
- let t = e.sender === "system", n = e.sender === "user", r = e.sender === "ai" || e.sender === "bot", o = e.sender === "agent", c = e.isPending, d = e.type === "file" && e.metadata?.fileUrl, f = e.agent_name || e.agentName || e.metadata?.agentName || l, p = typeof e.sender_headshot == "string" && e.sender_headshot.trim() || typeof s == "string" && s.trim() || null, m = Vm(e.replyToContent || e.replyContext?.message || ""), v = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
9493
+ let t = e.sender === "system", n = e.sender === "user", r = e.sender === "ai" || e.sender === "bot", o = e.sender === "agent", c = e.isPending, d = e.type === "file" && e.metadata?.fileUrl, f = e.agent_name || e.agentName || e.metadata?.agentName || l, p = typeof e.sender_headshot == "string" && e.sender_headshot.trim() || typeof s == "string" && s.trim() || null, m = Gm(e.replyToContent || e.replyContext?.message || ""), v = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
9451
9494
  return t ? /* @__PURE__ */ g("div", {
9452
9495
  style: {
9453
9496
  display: "flex",
@@ -9492,7 +9535,7 @@ function ih({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9492
9535
  fontWeight: 800,
9493
9536
  marginTop: !c && (r || o) ? "22px" : "0px"
9494
9537
  },
9495
- children: r ? u || /* @__PURE__ */ g(Fm, { size: 16 }) : /* @__PURE__ */ g(rh, {
9538
+ children: r ? u || /* @__PURE__ */ g(zm, { size: 16 }) : /* @__PURE__ */ g(sh, {
9496
9539
  src: p || "",
9497
9540
  name: f,
9498
9541
  imgStyle: {
@@ -9534,7 +9577,7 @@ function ih({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9534
9577
  onMouseLeave: (e) => {
9535
9578
  e.currentTarget.style.color = "#9ca3af";
9536
9579
  },
9537
- children: [/* @__PURE__ */ g(Mm, {}), "Reply"]
9580
+ children: [/* @__PURE__ */ g(Im, {}), "Reply"]
9538
9581
  }),
9539
9582
  /* @__PURE__ */ _("div", {
9540
9583
  style: {
@@ -9578,7 +9621,7 @@ function ih({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9578
9621
  children: m
9579
9622
  })]
9580
9623
  }), d ? (() => {
9581
- let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = eh(e.metadata.fileSize), a = t.startsWith("image/"), o = `shared file: ${r}`.toLowerCase(), s = (e.message || "").trim(), c = s && s.toLowerCase() !== o && !s.toLowerCase().startsWith("shared file:"), l = t === "application/pdf" ? {
9624
+ let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = ih(e.metadata.fileSize), a = t.startsWith("image/"), o = `shared file: ${r}`.toLowerCase(), s = (e.message || "").trim(), c = s && s.toLowerCase() !== o && !s.toLowerCase().startsWith("shared file:"), l = t === "application/pdf" ? {
9582
9625
  color: "#ef4444",
9583
9626
  label: "PDF"
9584
9627
  } : t.includes("word") || t.includes("docx") ? {
@@ -9759,7 +9802,7 @@ function ih({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9759
9802
  });
9760
9803
  })() : r ? /* @__PURE__ */ g("div", {
9761
9804
  className: "flowengage-message-content fe-bot-message",
9762
- dangerouslySetInnerHTML: { __html: Jm(e.message) },
9805
+ dangerouslySetInnerHTML: { __html: Qm(e.message) },
9763
9806
  onClick: T
9764
9807
  }) : /* @__PURE__ */ g("div", {
9765
9808
  style: { whiteSpace: "pre-wrap" },
@@ -9824,7 +9867,7 @@ function ih({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9824
9867
  boxShadow: u ? "none" : "0 8px 20px rgba(59,130,246,0.24)",
9825
9868
  overflow: "hidden"
9826
9869
  },
9827
- children: u || /* @__PURE__ */ g(Fm, { size: 16 })
9870
+ children: u || /* @__PURE__ */ g(zm, { size: 16 })
9828
9871
  }), /* @__PURE__ */ _("div", {
9829
9872
  style: {
9830
9873
  display: "flex",
@@ -9866,7 +9909,7 @@ function ih({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9866
9909
  borderRadius: "50%",
9867
9910
  overflow: "hidden"
9868
9911
  },
9869
- children: /* @__PURE__ */ g(rh, {
9912
+ children: /* @__PURE__ */ g(sh, {
9870
9913
  src: s || "",
9871
9914
  name: l,
9872
9915
  imgStyle: {
@@ -9960,8 +10003,8 @@ function ih({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9960
10003
  }
9961
10004
  //#endregion
9962
10005
  //#region src/components/ChatInput.jsx
9963
- var ah = typeof window < "u" && (window.matchMedia?.("(pointer: coarse)").matches || navigator.maxTouchPoints > 0);
9964
- function oh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUiActive: i, handleToggleVoice: a, activeScreen: o, inputDisabled: s, replyContext: l, clearReplyContext: u, requiresEmail: d, emailInput: f, setEmailInput: m, emailError: v, showVoiceToggle: y = !1, voiceEnabled: b = !0, onFileSelect: x, selectedFile: S = null, onRemoveSelectedFile: C, attachmentError: w = "", isUploadingAttachment: T = !1, inputPlaceholder: E = "Type your message" }) {
10006
+ var lh = typeof window < "u" && (window.matchMedia?.("(pointer: coarse)").matches || navigator.maxTouchPoints > 0);
10007
+ function uh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUiActive: i, handleToggleVoice: a, activeScreen: o, inputDisabled: s, replyContext: l, clearReplyContext: u, requiresEmail: d, emailInput: f, setEmailInput: m, emailError: v, showVoiceToggle: y = !1, voiceEnabled: b = !0, onFileSelect: x, selectedFile: S = null, onRemoveSelectedFile: C, attachmentError: w = "", isUploadingAttachment: T = !1, inputPlaceholder: E = "Type your message" }) {
9965
10008
  let D = p(null), O = p(null), k = (e) => {
9966
10009
  e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, 120)}px`);
9967
10010
  };
@@ -9969,7 +10012,7 @@ function oh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
9969
10012
  d || k(O.current);
9970
10013
  }, [e, d]);
9971
10014
  let A = (e) => {
9972
- e.key === "Enter" && (ah || e.shiftKey || e.altKey || e.ctrlKey || e.metaKey || (e.preventDefault(), e.currentTarget.form?.requestSubmit()));
10015
+ e.key === "Enter" && (lh || e.shiftKey || e.altKey || e.ctrlKey || e.metaKey || (e.preventDefault(), e.currentTarget.form?.requestSubmit()));
9973
10016
  }, ee = l?.sender === "user" ? "You" : l?.sender === "agent" ? "Agent" : "AI Assistant", te = d ? !!f?.trim() : !!e?.trim() || !!S, ne = s || T || !te, j = !d && b && y;
9974
10017
  return /* @__PURE__ */ _("div", {
9975
10018
  style: {
@@ -10064,7 +10107,7 @@ function oh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10064
10107
  background: "rgba(59,130,246,0.08)",
10065
10108
  color: "var(--flowengage-primary)"
10066
10109
  },
10067
- children: /* @__PURE__ */ g(Fm, { size: 13 })
10110
+ children: /* @__PURE__ */ g(zm, { size: 13 })
10068
10111
  }), /* @__PURE__ */ g("span", { children: "Please provide your email address so we can help you." })]
10069
10112
  })
10070
10113
  }),
@@ -10104,7 +10147,7 @@ function oh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10104
10147
  overflow: "hidden",
10105
10148
  textOverflow: "ellipsis"
10106
10149
  },
10107
- children: th(S)
10150
+ children: ah(S)
10108
10151
  }),
10109
10152
  /* @__PURE__ */ g("div", {
10110
10153
  style: {
@@ -10112,7 +10155,7 @@ function oh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10112
10155
  color: "#6b7280",
10113
10156
  marginTop: "2px"
10114
10157
  },
10115
- children: eh(S.size)
10158
+ children: ih(S.size)
10116
10159
  })
10117
10160
  ]
10118
10161
  }), /* @__PURE__ */ g("button", {
@@ -10157,7 +10200,7 @@ function oh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10157
10200
  j ? /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("input", {
10158
10201
  ref: D,
10159
10202
  type: "file",
10160
- accept: Zm,
10203
+ accept: th,
10161
10204
  style: { display: "none" },
10162
10205
  onChange: (e) => {
10163
10206
  let t = e.target.files?.[0];
@@ -10189,7 +10232,7 @@ function oh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10189
10232
  onMouseLeave: (e) => {
10190
10233
  e.currentTarget.style.opacity = "1";
10191
10234
  },
10192
- children: /* @__PURE__ */ g(Im, {
10235
+ children: /* @__PURE__ */ g(Bm, {
10193
10236
  size: 16,
10194
10237
  color: "currentColor"
10195
10238
  })
@@ -10270,7 +10313,7 @@ function oh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10270
10313
  onMouseLeave: (e) => {
10271
10314
  e.currentTarget.style.opacity = "1";
10272
10315
  },
10273
- children: /* @__PURE__ */ g(jm, { size: 16 })
10316
+ children: /* @__PURE__ */ g(Fm, { size: 16 })
10274
10317
  })
10275
10318
  ]
10276
10319
  }),
@@ -10333,7 +10376,7 @@ function oh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10333
10376
  }
10334
10377
  //#endregion
10335
10378
  //#region src/components/StatusBanners.jsx
10336
- function sh({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r, isRateLimited: i, rateLimitMessage: a }) {
10379
+ function dh({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r, isRateLimited: i, rateLimitMessage: a }) {
10337
10380
  return /* @__PURE__ */ _(h, { children: [(e || t) && /* @__PURE__ */ _("div", {
10338
10381
  style: {
10339
10382
  margin: "0 20px 10px",
@@ -10346,7 +10389,7 @@ function sh({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
10346
10389
  gap: "10px"
10347
10390
  },
10348
10391
  children: [
10349
- /* @__PURE__ */ g(Pm, { className: "" }),
10392
+ /* @__PURE__ */ g(Rm, { className: "" }),
10350
10393
  /* @__PURE__ */ g("span", {
10351
10394
  style: {
10352
10395
  fontSize: "12px",
@@ -10392,13 +10435,13 @@ function sh({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
10392
10435
  }
10393
10436
  //#endregion
10394
10437
  //#region src/components/AnimatedOrb.jsx
10395
- var ch = [
10438
+ var fh = [
10396
10439
  "#135bd8",
10397
10440
  "#ef334b",
10398
10441
  "#ffbd2e"
10399
10442
  ];
10400
- function lh(e) {
10401
- return !Array.isArray(e) || e.length === 0 ? ch : e.length === 1 ? [
10443
+ function ph(e) {
10444
+ return !Array.isArray(e) || e.length === 0 ? fh : e.length === 1 ? [
10402
10445
  e[0],
10403
10446
  e[0],
10404
10447
  e[0]
@@ -10412,7 +10455,7 @@ function lh(e) {
10412
10455
  e[2]
10413
10456
  ];
10414
10457
  }
10415
- var uh = {
10458
+ var mh = {
10416
10459
  idle: 3,
10417
10460
  listening: .75,
10418
10461
  thinking: 1,
@@ -10420,7 +10463,7 @@ var uh = {
10420
10463
  muted: .75,
10421
10464
  error: .08
10422
10465
  };
10423
- function dh(e) {
10466
+ function hh(e) {
10424
10467
  if (!e || typeof e != "string") return [
10425
10468
  0,
10426
10469
  0,
@@ -10433,14 +10476,14 @@ function dh(e) {
10433
10476
  parseInt(n.slice(4, 6), 16) / 255
10434
10477
  ];
10435
10478
  }
10436
- function fh(e, t) {
10479
+ function gh(e, t) {
10437
10480
  if (!e || typeof e != "string") return `rgba(0,0,0,${t})`;
10438
10481
  if (e.startsWith("rgb")) return e.replace(/[\d.]+\)$/, `${t})`);
10439
10482
  let n = e.replace("#", ""), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n;
10440
10483
  return `rgba(${parseInt(r.slice(0, 2), 16)},${parseInt(r.slice(2, 4), 16)},${parseInt(r.slice(4, 6), 16)},${t})`;
10441
10484
  }
10442
- var ph = "\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", mh = "\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";
10443
- function hh(e, t, n) {
10485
+ var _h = "\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", vh = "\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";
10486
+ function yh(e, t, n) {
10444
10487
  let r = (t, n) => {
10445
10488
  let r = e.createShader(t);
10446
10489
  return e.shaderSource(r, n), e.compileShader(r), e.getShaderParameter(r, e.COMPILE_STATUS) ? r : (console.error("[AnimatedOrb shader]", e.getShaderInfoLog(r)), null);
@@ -10449,10 +10492,10 @@ function hh(e, t, n) {
10449
10492
  let o = e.createProgram();
10450
10493
  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);
10451
10494
  }
10452
- function gh({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r, onClick: i, style: a, className: o }) {
10453
- let [s, l, u] = lh(r), d = t === "speaking", f = e <= 50, m = p(null), h = p(uh[t] ?? .35);
10495
+ function bh({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r, onClick: i, style: a, className: o }) {
10496
+ let [s, l, u] = ph(r), d = t === "speaking", f = e <= 50, m = p(null), h = p(mh[t] ?? .35);
10454
10497
  c(() => {
10455
- h.current = uh[t] ?? .35;
10498
+ h.current = mh[t] ?? .35;
10456
10499
  }, [t]), c(() => {
10457
10500
  let t = m.current;
10458
10501
  if (!t) return;
@@ -10469,7 +10512,7 @@ function gh({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
10469
10512
  console.warn("[AnimatedOrb] WebGL unavailable.");
10470
10513
  return;
10471
10514
  }
10472
- let i = hh(r, ph, mh);
10515
+ let i = yh(r, _h, vh);
10473
10516
  if (!i) {
10474
10517
  console.error("[AnimatedOrb] WebGL program failed to compile/link");
10475
10518
  return;
@@ -10499,7 +10542,7 @@ function gh({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
10499
10542
  c2: r.getUniformLocation(i, "u_c2"),
10500
10543
  c3: r.getUniformLocation(i, "u_c3")
10501
10544
  };
10502
- r.uniform3fv(c.c1, dh(s)), r.uniform3fv(c.c2, dh(l)), r.uniform3fv(c.c3, dh(u)), r.viewport(0, 0, t.width, t.height);
10545
+ r.uniform3fv(c.c1, hh(s)), r.uniform3fv(c.c2, hh(l)), r.uniform3fv(c.c3, hh(u)), r.viewport(0, 0, t.width, t.height);
10503
10546
  let d = performance.now(), f, p = (e) => {
10504
10547
  r.uniform1f(c.time, (e - d) / 1e3), r.uniform1f(c.speed, h.current), r.drawArrays(r.TRIANGLES, 0, 6), f = requestAnimationFrame(p);
10505
10548
  };
@@ -10530,7 +10573,7 @@ function gh({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
10530
10573
  position: "absolute",
10531
10574
  inset: -10,
10532
10575
  borderRadius: "50%",
10533
- background: `radial-gradient(circle, ${fh(s, .18)} 0%, transparent 70%)`,
10576
+ background: `radial-gradient(circle, ${gh(s, .18)} 0%, transparent 70%)`,
10534
10577
  pointerEvents: "none"
10535
10578
  },
10536
10579
  animate: { opacity: [.3, .75] },
@@ -10608,17 +10651,17 @@ function gh({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
10608
10651
  }
10609
10652
  //#endregion
10610
10653
  //#region src/components/CallScreen.jsx
10611
- var _h = "\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";
10612
- function vh(e) {
10654
+ var xh = "\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";
10655
+ function Sh(e) {
10613
10656
  let t = (e || "").replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t;
10614
10657
  return `${parseInt(n.slice(0, 2), 16)},${parseInt(n.slice(2, 4), 16)},${parseInt(n.slice(4, 6), 16)}`;
10615
10658
  }
10616
- function yh(e) {
10659
+ function Ch(e) {
10617
10660
  if (!e || typeof e != "string") return "#1a1a1a";
10618
10661
  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;
10619
10662
  return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
10620
10663
  }
10621
- function bh(e, t) {
10664
+ function wh(e, t) {
10622
10665
  let n = Array.isArray(e) && e.length > 0 ? e : [t || "#3B82F6"], [r, i, a] = n;
10623
10666
  return n.length === 1 ? [
10624
10667
  `radial-gradient(ellipse 110% 65% at 50% -5%, ${r}28 0%, transparent 68%)`,
@@ -10635,8 +10678,8 @@ function bh(e, t) {
10635
10678
  "#f7f8fa"
10636
10679
  ].join(", ");
10637
10680
  }
10638
- function xh({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" }) {
10639
- let i = (t || "A")[0].toUpperCase(), a = yh(r), o = n > 48 ? {
10681
+ function Th({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" }) {
10682
+ let i = (t || "A")[0].toUpperCase(), a = Ch(r), o = n > 48 ? {
10640
10683
  boxShadow: `0 0 0 3px ${r}44`,
10641
10684
  border: "3px solid rgba(255,255,255,0.15)"
10642
10685
  } : { border: `1.5px solid ${r}55` };
@@ -10673,7 +10716,7 @@ function xh({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" })
10673
10716
  children: i
10674
10717
  });
10675
10718
  }
10676
- function Sh(e) {
10719
+ function Eh(e) {
10677
10720
  let t = p(null), n = o(() => {
10678
10721
  if (!t.current) return;
10679
10722
  let { audioContext: e, oscillator: n, interval: r, toneTimeout: i } = t.current;
@@ -10720,8 +10763,8 @@ function Sh(e) {
10720
10763
  n
10721
10764
  ]), c(() => () => n(), [n]), n;
10722
10765
  }
10723
- function Ch({ 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 = [] }) {
10724
- let y = a || s || "Agent", b = e ? "incoming" : n === "connecting" ? "connecting" : "ongoing", x = Sh(!!e), S = async () => {
10766
+ function Dh({ 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 = [] }) {
10767
+ let y = a || s || "Agent", b = e ? "incoming" : n === "connecting" ? "connecting" : "ongoing", x = Eh(!!e), S = async () => {
10725
10768
  x(), await c();
10726
10769
  }, C = async () => {
10727
10770
  x(), await l();
@@ -10733,14 +10776,14 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
10733
10776
  flexDirection: "column",
10734
10777
  borderRadius: "inherit",
10735
10778
  overflow: "hidden",
10736
- background: bh(h, m),
10779
+ background: wh(h, m),
10737
10780
  animation: T ? "fe-call-slide-up 0.36s cubic-bezier(0.16,1,0.3,1)" : "fe-call-fade-in 0.32s ease"
10738
10781
  };
10739
10782
  if (b === "incoming") {
10740
10783
  let e = Array.isArray(h) && h.length > 0 ? h : [m];
10741
10784
  return /* @__PURE__ */ _("div", {
10742
10785
  style: E,
10743
- children: [/* @__PURE__ */ g("style", { children: _h }), /* @__PURE__ */ _("div", {
10786
+ children: [/* @__PURE__ */ g("style", { children: xh }), /* @__PURE__ */ _("div", {
10744
10787
  style: {
10745
10788
  flex: 1,
10746
10789
  display: "flex",
@@ -10771,7 +10814,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
10771
10814
  width: "96px",
10772
10815
  height: "96px",
10773
10816
  borderRadius: "50%",
10774
- background: `radial-gradient(circle, rgba(${vh(e[0])},0.2) 0%, transparent 70%)`,
10817
+ background: `radial-gradient(circle, rgba(${Sh(e[0])},0.2) 0%, transparent 70%)`,
10775
10818
  filter: "blur(10px)",
10776
10819
  zIndex: 0
10777
10820
  } }),
@@ -10788,7 +10831,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
10788
10831
  animation: `fe-call-ring-pulse 2.6s cubic-bezier(0.215,0.61,0.355,1) ${t}s infinite`,
10789
10832
  zIndex: 1
10790
10833
  } }, n)),
10791
- /* @__PURE__ */ g(xh, {
10834
+ /* @__PURE__ */ g(Th, {
10792
10835
  headshot: o,
10793
10836
  name: y,
10794
10837
  size: 82,
@@ -10868,7 +10911,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
10868
10911
  e.currentTarget.style.transform = "scale(1)", e.currentTarget.style.boxShadow = "0 6px 24px rgba(239,68,68,0.5)";
10869
10912
  },
10870
10913
  "aria-label": "Decline call",
10871
- children: /* @__PURE__ */ g(Am, { size: 26 })
10914
+ children: /* @__PURE__ */ g(Pm, { size: 26 })
10872
10915
  }), /* @__PURE__ */ g("span", {
10873
10916
  style: {
10874
10917
  fontSize: "12px",
@@ -10909,7 +10952,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
10909
10952
  e.currentTarget.style.transform = "scale(1)", e.currentTarget.style.boxShadow = "0 6px 24px rgba(34,197,94,0.5)";
10910
10953
  },
10911
10954
  "aria-label": "Accept call",
10912
- children: /* @__PURE__ */ g(Nm, {})
10955
+ children: /* @__PURE__ */ g(Lm, {})
10913
10956
  }), /* @__PURE__ */ g("span", {
10914
10957
  style: {
10915
10958
  fontSize: "12px",
@@ -10926,7 +10969,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
10926
10969
  }
10927
10970
  return b === "connecting" ? /* @__PURE__ */ _("div", {
10928
10971
  style: E,
10929
- children: [/* @__PURE__ */ g("style", { children: _h }), /* @__PURE__ */ _("div", {
10972
+ children: [/* @__PURE__ */ g("style", { children: xh }), /* @__PURE__ */ _("div", {
10930
10973
  style: {
10931
10974
  flex: 1,
10932
10975
  display: "flex",
@@ -10936,7 +10979,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
10936
10979
  gap: "24px"
10937
10980
  },
10938
10981
  children: [
10939
- /* @__PURE__ */ g(xh, {
10982
+ /* @__PURE__ */ g(Th, {
10940
10983
  headshot: o,
10941
10984
  name: y,
10942
10985
  size: 64,
@@ -10963,7 +11006,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
10963
11006
  }) : /* @__PURE__ */ _("div", {
10964
11007
  style: E,
10965
11008
  children: [
10966
- /* @__PURE__ */ g("style", { children: _h }),
11009
+ /* @__PURE__ */ g("style", { children: xh }),
10967
11010
  /* @__PURE__ */ _("div", {
10968
11011
  style: {
10969
11012
  display: "flex",
@@ -11009,7 +11052,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11009
11052
  children: /* @__PURE__ */ g("polyline", { points: "15 18 9 12 15 6" })
11010
11053
  })
11011
11054
  }),
11012
- /* @__PURE__ */ g(gh, {
11055
+ /* @__PURE__ */ g(bh, {
11013
11056
  colors: h,
11014
11057
  size: 36,
11015
11058
  voiceState: w
@@ -11060,7 +11103,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11060
11103
  gap: "16px",
11061
11104
  padding: "0 24px 16px"
11062
11105
  },
11063
- children: [/* @__PURE__ */ g(xh, {
11106
+ children: [/* @__PURE__ */ g(Th, {
11064
11107
  headshot: o,
11065
11108
  name: y,
11066
11109
  size: 116,
@@ -11115,7 +11158,7 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11115
11158
  transition: "all 0.2s ease"
11116
11159
  },
11117
11160
  "aria-label": i ? "Unmute" : "Mute",
11118
- children: [g(i ? Bm : km, { size: 18 }), i ? "Unmute" : "Mute"]
11161
+ children: [g(i ? Wm : Nm, { size: 18 }), i ? "Unmute" : "Mute"]
11119
11162
  }), /* @__PURE__ */ _("button", {
11120
11163
  type: "button",
11121
11164
  onClick: u,
@@ -11143,15 +11186,15 @@ function Ch({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11143
11186
  e.currentTarget.style.background = "rgba(239,68,68,0.9)", e.currentTarget.style.transform = "scale(1)";
11144
11187
  },
11145
11188
  "aria-label": "End call",
11146
- children: [/* @__PURE__ */ g(Am, { size: 18 }), "End Call"]
11189
+ children: [/* @__PURE__ */ g(Pm, { size: 18 }), "End Call"]
11147
11190
  })]
11148
11191
  })
11149
11192
  ]
11150
11193
  });
11151
11194
  }
11152
- function wh({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDurationSeconds: r, isCallMuted: i, formatCallDuration: a, toggleCallMute: o, endWebRTCCall: s, onExpand: c, primaryColor: l = "#3B82F6" }) {
11195
+ function Oh({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDurationSeconds: r, isCallMuted: i, formatCallDuration: a, toggleCallMute: o, endWebRTCCall: s, onExpand: c, primaryColor: l = "#3B82F6" }) {
11153
11196
  let u = e || n || "Agent";
11154
- return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("style", { children: _h }), /* @__PURE__ */ _("div", {
11197
+ return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("style", { children: xh }), /* @__PURE__ */ _("div", {
11155
11198
  role: "button",
11156
11199
  tabIndex: 0,
11157
11200
  onClick: c,
@@ -11208,7 +11251,7 @@ function wh({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
11208
11251
  borderRadius: "50%",
11209
11252
  border: `1.5px solid ${l}55`
11210
11253
  } }),
11211
- /* @__PURE__ */ g(xh, {
11254
+ /* @__PURE__ */ g(Th, {
11212
11255
  headshot: t,
11213
11256
  name: u,
11214
11257
  size: 38,
@@ -11292,7 +11335,7 @@ function wh({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
11292
11335
  boxShadow: i ? `0 0 0 3px ${l}12` : "none"
11293
11336
  },
11294
11337
  "aria-label": i ? "Unmute" : "Mute",
11295
- children: g(i ? Bm : km, { size: 15 })
11338
+ children: g(i ? Wm : Nm, { size: 15 })
11296
11339
  }), /* @__PURE__ */ g("button", {
11297
11340
  type: "button",
11298
11341
  onClick: (e) => {
@@ -11320,7 +11363,7 @@ function wh({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
11320
11363
  transition: "all 0.18s ease"
11321
11364
  },
11322
11365
  "aria-label": "End call",
11323
- children: /* @__PURE__ */ g(Am, { size: 16 })
11366
+ children: /* @__PURE__ */ g(Pm, { size: 16 })
11324
11367
  })]
11325
11368
  })
11326
11369
  ]
@@ -11328,7 +11371,7 @@ function wh({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
11328
11371
  }
11329
11372
  //#endregion
11330
11373
  //#region src/utils/voicePriorContext.js
11331
- function Th(e, t = {}) {
11374
+ function kh(e, t = {}) {
11332
11375
  let n = t.maxChars ?? 4500;
11333
11376
  if (!Array.isArray(e) || e.length === 0) return "";
11334
11377
  let r = [];
@@ -11346,7 +11389,7 @@ function Th(e, t = {}) {
11346
11389
  //#endregion
11347
11390
  //#region src/utils/voiceActionVisuals.js
11348
11391
  var Q = "fe-vv";
11349
- function Eh() {
11392
+ function Ah() {
11350
11393
  if (typeof document > "u" || document.getElementById(`${Q}-styles`)) return;
11351
11394
  let e = `
11352
11395
  /* ── Action toast ───────────────────────────────────────────────────────────── */
@@ -11491,14 +11534,14 @@ function Eh() {
11491
11534
  `, t = document.createElement("style");
11492
11535
  t.id = `${Q}-styles`, t.textContent = e, (document.head || document.documentElement).appendChild(t);
11493
11536
  }
11494
- var Dh = null, Oh = null;
11495
- function kh() {
11496
- return (!Dh || !Dh.isConnected) && (Dh = document.createElement("div"), Dh.id = `${Q}-toast`, document.body.appendChild(Dh)), Dh;
11537
+ var jh = null, Mh = null;
11538
+ function Nh() {
11539
+ return (!jh || !jh.isConnected) && (jh = document.createElement("div"), jh.id = `${Q}-toast`, document.body.appendChild(jh)), jh;
11497
11540
  }
11498
- function Ah(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
11541
+ function Ph(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
11499
11542
  if (typeof document > "u") return;
11500
- Eh(), Oh &&= (clearTimeout(Oh), null);
11501
- let i = kh();
11543
+ Ah(), Mh &&= (clearTimeout(Mh), null);
11544
+ let i = Nh();
11502
11545
  if (i.innerHTML = "", n) {
11503
11546
  let e = document.createElement("span");
11504
11547
  e.className = `${Q}-icon`, e.textContent = n, i.appendChild(e);
@@ -11507,71 +11550,71 @@ function Ah(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
11507
11550
  e.className = `${Q}-spin`, i.appendChild(e);
11508
11551
  }
11509
11552
  let a = document.createElement("span");
11510
- a.textContent = e, i.appendChild(a), i.classList.remove(`${Q}-show`), i.offsetHeight, i.classList.add(`${Q}-show`), r > 0 && (Oh = setTimeout(() => jh(), r));
11553
+ a.textContent = e, i.appendChild(a), i.classList.remove(`${Q}-show`), i.offsetHeight, i.classList.add(`${Q}-show`), r > 0 && (Mh = setTimeout(() => Fh(), r));
11511
11554
  }
11512
- function jh(e = 0) {
11513
- Dh && (e > 0 ? Oh = setTimeout(() => {
11514
- Dh && Dh.classList.remove(`${Q}-show`);
11515
- }, e) : Dh && Dh.classList.remove(`${Q}-show`));
11555
+ function Fh(e = 0) {
11556
+ jh && (e > 0 ? Mh = setTimeout(() => {
11557
+ jh && jh.classList.remove(`${Q}-show`);
11558
+ }, e) : jh && jh.classList.remove(`${Q}-show`));
11516
11559
  }
11517
- var Mh = null, Nh = [];
11518
- function Ph() {
11519
- return (!Mh || !Mh.isConnected) && (Mh = document.createElement("div"), Mh.id = `${Q}-bar`, document.body.appendChild(Mh)), Mh;
11560
+ var Ih = null, Lh = [];
11561
+ function Rh() {
11562
+ return (!Ih || !Ih.isConnected) && (Ih = document.createElement("div"), Ih.id = `${Q}-bar`, document.body.appendChild(Ih)), Ih;
11520
11563
  }
11521
- function Fh() {
11564
+ function zh() {
11522
11565
  if (typeof document > "u") return;
11523
- Eh(), Nh.forEach(clearTimeout), Nh = [];
11524
- let e = Ph();
11566
+ Ah(), Lh.forEach(clearTimeout), Lh = [];
11567
+ let e = Rh();
11525
11568
  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";
11526
11569
  let t = [[80, "width 0.6s ease"], [92, "width 1.2s ease"]], n = 50;
11527
11570
  for (let [e, r] of t) {
11528
11571
  let t = n, i = e, a = r;
11529
- Nh.push(setTimeout(() => {
11530
- Mh && (Mh.style.transition = a, Mh.style.width = `${i}%`);
11572
+ Lh.push(setTimeout(() => {
11573
+ Ih && (Ih.style.transition = a, Ih.style.width = `${i}%`);
11531
11574
  }, t)), n += 800;
11532
11575
  }
11533
11576
  }
11534
- function Ih() {
11535
- Mh && (Nh.forEach(clearTimeout), Nh = [], Mh.style.transition = "width 0.2s ease", Mh.style.width = "100%", Nh.push(setTimeout(() => {
11536
- Mh && (Mh.style.transition = "opacity 0.35s ease", Mh.style.opacity = "0", Nh.push(setTimeout(() => {
11537
- Mh && (Mh.style.width = "0%", Mh.classList.remove(`${Q}-bar-active`));
11577
+ function Bh() {
11578
+ Ih && (Lh.forEach(clearTimeout), Lh = [], Ih.style.transition = "width 0.2s ease", Ih.style.width = "100%", Lh.push(setTimeout(() => {
11579
+ Ih && (Ih.style.transition = "opacity 0.35s ease", Ih.style.opacity = "0", Lh.push(setTimeout(() => {
11580
+ Ih && (Ih.style.width = "0%", Ih.classList.remove(`${Q}-bar-active`));
11538
11581
  }, 380)));
11539
11582
  }, 220)));
11540
11583
  }
11541
- var Lh = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
11584
+ var Vh = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
11542
11585
  <filter id="${Q}-csh">
11543
11586
  <feDropShadow dx="1" dy="2" stdDeviation="1.5" flood-color="#00000060"/>
11544
11587
  </filter>
11545
11588
  <path d="M4 2L19 10.5L11 12.8L8 20L4 2Z"
11546
11589
  fill="white" stroke="#1e1b4b" stroke-width="1.6" stroke-linejoin="round"
11547
11590
  filter="url(#${Q}-csh)"/>
11548
- </svg>`, Rh = null, zh = !1;
11549
- function Bh() {
11550
- return (!Rh || !Rh.isConnected) && (Rh = document.createElement("div"), Rh.id = `${Q}-cursor`, Rh.innerHTML = Lh, document.body.appendChild(Rh), zh = !1), Rh;
11591
+ </svg>`, Hh = null, Uh = !1;
11592
+ function Wh() {
11593
+ return (!Hh || !Hh.isConnected) && (Hh = document.createElement("div"), Hh.id = `${Q}-cursor`, Hh.innerHTML = Vh, document.body.appendChild(Hh), Uh = !1), Hh;
11551
11594
  }
11552
- async function Vh(e) {
11595
+ async function Gh(e) {
11553
11596
  if (typeof document > "u" || !e) return;
11554
- Eh();
11597
+ Ah();
11555
11598
  let t;
11556
11599
  try {
11557
11600
  t = e.getBoundingClientRect();
11558
11601
  } catch {
11559
11602
  return;
11560
11603
  }
11561
- let n = t.left + Math.min(16, t.width * .2), r = t.top + Math.min(12, t.height * .25), i = Bh();
11562
- zh ||= (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 Gh(360);
11604
+ let n = t.left + Math.min(16, t.width * .2), r = t.top + Math.min(12, t.height * .25), i = Wh();
11605
+ Uh ||= (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 Yh(360);
11563
11606
  }
11564
- function Hh(e = !1) {
11565
- Rh && (e ? (Rh.classList.remove(`${Q}-cursor-visible`), zh = !1) : (Rh.classList.remove(`${Q}-cursor-visible`), setTimeout(() => {
11566
- zh = !1;
11607
+ function Kh(e = !1) {
11608
+ Hh && (e ? (Hh.classList.remove(`${Q}-cursor-visible`), Uh = !1) : (Hh.classList.remove(`${Q}-cursor-visible`), setTimeout(() => {
11609
+ Uh = !1;
11567
11610
  }, 250)));
11568
11611
  }
11569
- async function Uh(e) {
11570
- Rh && (Rh.classList.add(`${Q}-cursor-click`), await Gh(280), Rh.classList.remove(`${Q}-cursor-click`));
11612
+ async function qh(e) {
11613
+ Hh && (Hh.classList.add(`${Q}-cursor-click`), await Yh(280), Hh.classList.remove(`${Q}-cursor-click`));
11571
11614
  }
11572
- function Wh(e) {
11615
+ function Jh(e) {
11573
11616
  if (!e || typeof document > "u") return;
11574
- Eh();
11617
+ Ah();
11575
11618
  let t;
11576
11619
  try {
11577
11620
  t = e.getBoundingClientRect();
@@ -11597,29 +11640,29 @@ function Wh(e) {
11597
11640
  a.remove(), e.style.position = n, e.style.overflow = r;
11598
11641
  }, 650);
11599
11642
  }
11600
- function Gh(e) {
11643
+ function Yh(e) {
11601
11644
  return new Promise((t) => setTimeout(t, e));
11602
11645
  }
11603
11646
  //#endregion
11604
11647
  //#region src/utils/voiceClientTools.js
11605
- var Kh = /^\/[a-z]{2}(?:-[a-z]{2})?(?=\/|$)/i;
11606
- function qh(e) {
11607
- return String(e || "").replace(Kh, "").replace(/\/+$/, "").toLowerCase() || "/";
11648
+ var Xh = /^\/[a-z]{2}(?:-[a-z]{2})?(?=\/|$)/i;
11649
+ function Zh(e) {
11650
+ return String(e || "").replace(Xh, "").replace(/\/+$/, "").toLowerCase() || "/";
11608
11651
  }
11609
- function Jh(e, t) {
11610
- return qh(e) === qh(t);
11652
+ function Qh(e, t) {
11653
+ return Zh(e) === Zh(t);
11611
11654
  }
11612
11655
  function $(...e) {
11613
11656
  wn() && console.log("[FlowEngage:voice-tools]", ...e);
11614
11657
  }
11615
- function Yh(e) {
11658
+ function $h(e) {
11616
11659
  try {
11617
11660
  let t = e.ownerDocument?.defaultView;
11618
11661
  if (t) return t.getComputedStyle(e);
11619
11662
  } catch {}
11620
11663
  return window.getComputedStyle(e);
11621
11664
  }
11622
- function Xh(e) {
11665
+ function eg(e) {
11623
11666
  let t = /* @__PURE__ */ new Set();
11624
11667
  function n(r) {
11625
11668
  if (!r || t.has(r)) return;
@@ -11632,10 +11675,10 @@ function Xh(e) {
11632
11675
  }
11633
11676
  typeof document < "u" && n(document);
11634
11677
  }
11635
- function Zh(e) {
11678
+ function tg(e) {
11636
11679
  return e == null ? null : String(e).replace(/\u00a0/g, " ").replace(/\s*\*+\s*$/u, "").replace(/\s+/g, " ").trim();
11637
11680
  }
11638
- function Qh(e) {
11681
+ function ng(e) {
11639
11682
  let t = e.ownerDocument || document, n = e.getAttribute("aria-labelledby");
11640
11683
  if (n) {
11641
11684
  let e = n.trim().split(/\s+/).filter(Boolean), r = [];
@@ -11643,40 +11686,40 @@ function Qh(e) {
11643
11686
  let e = t.getElementById(n);
11644
11687
  e?.textContent && r.push(e.textContent.trim());
11645
11688
  } catch {}
11646
- if (r.length) return Zh(r.join(" "));
11689
+ if (r.length) return tg(r.join(" "));
11647
11690
  }
11648
- if (e.labels && e.labels.length) return Zh(e.labels[0].textContent);
11691
+ if (e.labels && e.labels.length) return tg(e.labels[0].textContent);
11649
11692
  let r = e.id;
11650
11693
  if (r) try {
11651
11694
  let e = t.querySelector(`label[for="${CSS.escape(r)}"]`);
11652
- if (e) return Zh(e.textContent);
11695
+ if (e) return tg(e.textContent);
11653
11696
  } catch {
11654
11697
  let e = t.querySelector(`label[for="${r.replace(/"/g, "\\\"")}"]`);
11655
- if (e) return Zh(e.textContent);
11698
+ if (e) return tg(e.textContent);
11656
11699
  }
11657
11700
  let i = e.previousElementSibling;
11658
11701
  for (let e = 0; e < 6 && i; e += 1) {
11659
- if (i.tagName === "LABEL") return Zh(i.textContent);
11702
+ if (i.tagName === "LABEL") return tg(i.textContent);
11660
11703
  let e = (i.className || "").toString().toLowerCase();
11661
11704
  if (/chakra-form__label|formlabel|field-label|form-label|mui-form-label/.test(e)) {
11662
- let e = Zh(i.textContent);
11705
+ let e = tg(i.textContent);
11663
11706
  if (e) return e;
11664
11707
  }
11665
11708
  i = i.previousElementSibling;
11666
11709
  }
11667
11710
  let a = e.parentElement;
11668
11711
  for (let e = 0; e < 5 && a; e += 1) {
11669
- if (a.tagName === "LABEL") return Zh(a.textContent);
11712
+ if (a.tagName === "LABEL") return tg(a.textContent);
11670
11713
  let e = a.querySelector?.(":scope > label, :scope > [class*='FormLabel'], :scope > [class*='form__label']");
11671
- if (e?.textContent) return Zh(e.textContent);
11714
+ if (e?.textContent) return tg(e.textContent);
11672
11715
  a = a.parentElement;
11673
11716
  }
11674
11717
  let o = e.getAttribute("aria-label");
11675
- return o ? Zh(o) : null;
11718
+ return o ? tg(o) : null;
11676
11719
  }
11677
- function $h() {
11720
+ function rg() {
11678
11721
  let e = [];
11679
- return Xh((t) => {
11722
+ return eg((t) => {
11680
11723
  e.push(...Array.from(t.querySelectorAll("input, select, textarea")).filter((e) => {
11681
11724
  if (An(e)) return !1;
11682
11725
  let t = (e.type || "").toLowerCase();
@@ -11687,15 +11730,15 @@ function $h() {
11687
11730
  "image"
11688
11731
  ].includes(t) || e.disabled || e.readOnly) return !1;
11689
11732
  try {
11690
- let t = Yh(e);
11733
+ let t = $h(e);
11691
11734
  if (t.display === "none" || t.visibility === "hidden") return !1;
11692
11735
  } catch {}
11693
11736
  return !0;
11694
11737
  }));
11695
11738
  }), e;
11696
11739
  }
11697
- function eg() {
11698
- return $h().map((e, t) => {
11740
+ function ig() {
11741
+ return rg().map((e, t) => {
11699
11742
  let n = {
11700
11743
  formIndex: 0,
11701
11744
  fieldIndex: t,
@@ -11703,7 +11746,7 @@ function eg() {
11703
11746
  type: e.type || "text",
11704
11747
  name: e.name || null,
11705
11748
  id: e.id || null,
11706
- label: Qh(e),
11749
+ label: ng(e),
11707
11750
  placeholder: e.placeholder || null
11708
11751
  };
11709
11752
  return e.tagName === "SELECT" && (n.options = Array.from(e.options).filter((e) => e.value !== "" && !e.disabled).map((e) => ({
@@ -11712,13 +11755,13 @@ function eg() {
11712
11755
  })), n.currentValue = e.value || null), n;
11713
11756
  });
11714
11757
  }
11715
- function tg() {
11758
+ function ag() {
11716
11759
  let e = [];
11717
- return Xh((t) => {
11760
+ return eg((t) => {
11718
11761
  e.push(...Array.from(t.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
11719
11762
  if (An(e) || e.disabled) return !1;
11720
11763
  try {
11721
- let t = Yh(e);
11764
+ let t = $h(e);
11722
11765
  if (t.display === "none" || t.visibility === "hidden") return !1;
11723
11766
  } catch {}
11724
11767
  return !0;
@@ -11730,7 +11773,7 @@ function tg() {
11730
11773
  type: e.type || e.tagName
11731
11774
  }));
11732
11775
  }
11733
- function ng(e, t) {
11776
+ function og(e, t) {
11734
11777
  try {
11735
11778
  if (!e?.getBoundingClientRect || !t?.getBoundingClientRect) return Infinity;
11736
11779
  let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = {
@@ -11745,7 +11788,7 @@ function ng(e, t) {
11745
11788
  return Infinity;
11746
11789
  }
11747
11790
  }
11748
- function rg(e, t) {
11791
+ function sg(e, t) {
11749
11792
  let n = String(t || "").toLowerCase().trim();
11750
11793
  if (!n) return 0;
11751
11794
  let r = (e.innerText || e.textContent || "").replace(/\s+/g, " ").trim(), i = [
@@ -11763,21 +11806,21 @@ function rg(e, t) {
11763
11806
  for (let e of a) i.includes(e) && (o += 1);
11764
11807
  return o / a.length * 92;
11765
11808
  }
11766
- function ig(e, t, n = 6) {
11809
+ function cg(e, t, n = 6) {
11767
11810
  let r = String(t || "").toLowerCase().trim();
11768
11811
  if (!r) return !1;
11769
11812
  let i = e;
11770
11813
  for (let e = 0; e < n && i && (i = i.parentElement, i); e++) if ((i.innerText || i.textContent || "").toLowerCase().includes(r)) return !0;
11771
11814
  return !1;
11772
11815
  }
11773
- function ag(e, t, n) {
11816
+ function lg(e, t, n) {
11774
11817
  let r = [];
11775
- Xh((e) => {
11818
+ eg((e) => {
11776
11819
  let t = Array.from(e.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"], a[href]"));
11777
11820
  r.push(...t.filter((e) => {
11778
11821
  if (An(e) || e.disabled) return !1;
11779
11822
  try {
11780
- let t = Yh(e);
11823
+ let t = $h(e);
11781
11824
  if (t.display === "none" || t.visibility === "hidden" || t.opacity === "0") return !1;
11782
11825
  } catch {}
11783
11826
  return !0;
@@ -11785,14 +11828,14 @@ function ag(e, t, n) {
11785
11828
  });
11786
11829
  let i = 0, a = r.map((t) => ({
11787
11830
  el: t,
11788
- s: rg(t, e)
11831
+ s: sg(t, e)
11789
11832
  }));
11790
11833
  for (let { s: e } of a) e > i && (i = e);
11791
11834
  if (i < 28) return null;
11792
11835
  let o = a.filter(({ s: e }) => e === i).map(({ el: e }) => e);
11793
11836
  if (o.length === 1) return o[0];
11794
11837
  if (n) {
11795
- let e = o.filter((e) => ig(e, n));
11838
+ let e = o.filter((e) => cg(e, n));
11796
11839
  if (e.length === 1) return e[0];
11797
11840
  e.length > 1 && (o = e);
11798
11841
  }
@@ -11800,14 +11843,14 @@ function ag(e, t, n) {
11800
11843
  if (s.length) {
11801
11844
  let e = o[0], t = Infinity;
11802
11845
  for (let n of o) for (let r of s) {
11803
- let i = ng(n, r);
11846
+ let i = og(n, r);
11804
11847
  i < t && (t = i, e = n);
11805
11848
  }
11806
11849
  return e;
11807
11850
  }
11808
11851
  return o[0];
11809
11852
  }
11810
- function og(e) {
11853
+ function ug(e) {
11811
11854
  if (e == null) return {};
11812
11855
  if (typeof e == "string") {
11813
11856
  let t = e.trim();
@@ -11820,12 +11863,12 @@ function og(e) {
11820
11863
  }
11821
11864
  return e;
11822
11865
  }
11823
- function sg(e) {
11866
+ function dg(e) {
11824
11867
  if (!e || typeof e != "object") return null;
11825
11868
  let t = e.url ?? e.target_url ?? e.page_url ?? e.pageUrl ?? e.link ?? e.href ?? e.path;
11826
11869
  return t == null ? null : String(t).trim() || null;
11827
11870
  }
11828
- function cg() {
11871
+ function fg() {
11829
11872
  let e = {};
11830
11873
  document.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((t) => {
11831
11874
  if (t.id) return;
@@ -11840,7 +11883,7 @@ function cg() {
11840
11883
  e[r] = !0, t.id = r;
11841
11884
  });
11842
11885
  }
11843
- function lg() {
11886
+ function pg() {
11844
11887
  let e = (e) => {
11845
11888
  let t = Array.from(e).filter((e) => !e.closest("#flowengage-root, .flowengage-shell, .flowengage-widget-root") && !e.closest("nav, footer, header, aside, .nav, .footer, .header, .sidebar")), n = [], r = 0;
11846
11889
  for (; r < t.length;) {
@@ -11883,7 +11926,7 @@ function lg() {
11883
11926
  introText: o
11884
11927
  };
11885
11928
  }
11886
- function ug(e) {
11929
+ function mg(e) {
11887
11930
  if (!e || typeof document > "u") return "";
11888
11931
  let t = new Set([
11889
11932
  "script",
@@ -11969,11 +12012,11 @@ function ug(e) {
11969
12012
  return d.has(t) ? !1 : (d.add(t), !0);
11970
12013
  }).join("\n").replace(/\n{3,}/g, "\n\n").trim();
11971
12014
  }
11972
- function dg(e) {
12015
+ function hg(e) {
11973
12016
  let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, ""), r = typeof e.getLastUserVoiceText == "function" ? e.getLastUserVoiceText : null, i = [], a = {
11974
12017
  "fwh-navigate-mvp": async (n) => {
11975
12018
  $("fwh-navigate-mvp ▶ raw parameters:", n);
11976
- let i = og(n), a = sg(i), o = i.section_text ?? i.sectionText ?? i.section, s = Array.isArray(i.expected_landmarks) ? i.expected_landmarks : Array.isArray(i.expectedLandmarks) ? i.expectedLandmarks : [];
12019
+ let i = ug(n), a = dg(i), o = i.section_text ?? i.sectionText ?? i.section, s = Array.isArray(i.expected_landmarks) ? i.expected_landmarks : Array.isArray(i.expectedLandmarks) ? i.expectedLandmarks : [];
11977
12020
  if ($("fwh-navigate-mvp · coerced:", {
11978
12021
  url: a,
11979
12022
  sectionText: o,
@@ -12012,11 +12055,11 @@ function dg(e) {
12012
12055
  correctedUrl: l
12013
12056
  }), a = l);
12014
12057
  try {
12015
- Ah(`Navigating to ${a}...`, { spinner: !0 }), Fh(), On();
12058
+ Ph(`Navigating to ${a}...`, { spinner: !0 }), zh(), On();
12016
12059
  try {
12017
12060
  let e = r ? r() : "";
12018
12061
  if (e && t) {
12019
- let n = Th([{
12062
+ let n = kh([{
12020
12063
  sender: "user",
12021
12064
  message: e
12022
12065
  }]);
@@ -12044,8 +12087,8 @@ function dg(e) {
12044
12087
  typeof window < "u" && window.scrollTo(0, 0);
12045
12088
  } catch {}
12046
12089
  let o = [], s = null, c = "", l = Date.now() + 12e3;
12047
- for (; Date.now() < l && (await new Promise((e) => setTimeout(e, 300)), {headings: o, pageTitleHeading: s, introText: c} = lg(), !(o.length >= 1)););
12048
- cg(), $("fwh-navigate-mvp → page headings collected:", o, "titleHeading:", s);
12090
+ for (; Date.now() < l && (await new Promise((e) => setTimeout(e, 300)), {headings: o, pageTitleHeading: s, introText: c} = pg(), !(o.length >= 1)););
12091
+ fg(), $("fwh-navigate-mvp → page headings collected:", o, "titleHeading:", s);
12049
12092
  let u = o.length ? o.join(" | ") : "none", d = o.length ? "Use ONLY these exact heading strings for fwh-highlight-mvp — never invent or abbreviate." : "No headings collected yet — call fwh-get-current-page-mvp immediately (no speech) to get the live headings before speaking or highlighting.", f = s ? ` "${s}" is the PAGE TITLE, not a content section — do not fwh-highlight-mvp it separately; if doing a walkthrough, just fold this intro into your opening line: "${c || "(no intro text found)"}"` : c ? ` No separate page-title heading detected, but this intro text precedes the first section — mention it briefly before covering sections: "${c}"` : "", p = "";
12050
12093
  try {
12051
12094
  if (o.length > 0) {
@@ -12053,7 +12096,7 @@ function dg(e) {
12053
12096
  for (let n of e) {
12054
12097
  let e = cr(null, n);
12055
12098
  if (e) {
12056
- let r = ug(e).substring(0, 800);
12099
+ let r = mg(e).substring(0, 800);
12057
12100
  r && t.push(`[Section: ${n}] ${r}`);
12058
12101
  }
12059
12102
  }
@@ -12062,13 +12105,13 @@ function dg(e) {
12062
12105
  } catch {}
12063
12106
  if (yr()) return _r(), $("fwh-navigate-mvp ✖ landed on a not-found/404 page:", i), `NAVIGATION_PAGE_NOT_FOUND. The page at ${i} does not exist — it shows a "not found"/404 error, not real content. Do NOT offer a page overview, do NOT describe or highlight any sections, do NOT claim the navigation succeeded. Tell the visitor EXACTLY: "It looks like that page doesn't exist — I couldn't find it. Would you like me to take you somewhere else?" Then STOP and wait for their reply.`;
12064
12107
  let m = Date.now() + 4e3, h = typeof window < "u" ? window.location.pathname : r;
12065
- for (; Date.now() < m && !Jh(h, e) && Jh(h, t);) await new Promise((e) => setTimeout(e, 120)), h = window.location.pathname;
12108
+ for (; Date.now() < m && !Qh(h, e) && Qh(h, t);) await new Promise((e) => setTimeout(e, 120)), h = window.location.pathname;
12066
12109
  $("fwh-navigate-mvp route settle:", {
12067
12110
  startPath: t,
12068
12111
  targetPath: e,
12069
12112
  settledPath: h
12070
12113
  });
12071
- let g = typeof window < "u" ? window.location.href : i, _ = (h.split("/").filter(Boolean).pop() || "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) || "Home", v = Jh(h, e), y = !Jh(h, t), b = v || y;
12114
+ let g = typeof window < "u" ? window.location.href : i, _ = (h.split("/").filter(Boolean).pop() || "").replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) || "Home", v = Qh(h, e), y = !Qh(h, t), b = v || y;
12072
12115
  return $("fwh-navigate-mvp settled:", h, "target:", e, "match:", b), b ? (_r(), `OK_NAVIGATE_SPA. Visitor is now on: ${g} (page: "${_}") | Section headings: ${u}.${f} ${d}${p} Now confirm the arrival in ONE short sentence phrased for what the visitor actually asked for — mention the page by name and what it lets them do (e.g. for a contact request: "I've taken you to the Contact Us page — filling in this form sends your query straight to our team."). Do NOT use a fixed template. Then, in the same breath, offer either a specific section or a full overview. Then STOP — wait for their reply.`) : (_r(), `NAVIGATION_DID_NOT_HAPPEN. The visitor is STILL on ${g} (page: "${_}") — the navigation did not go through. Do NOT say "I have navigated you". Do NOT claim success. Tell the visitor EXACTLY: "Sorry, I couldn't open that page just now. Would you like me to try again, or is there something else I can help with?" Then STOP and wait for their reply.`);
12073
12116
  } catch {}
12074
12117
  let o = "this";
@@ -12079,45 +12122,45 @@ function dg(e) {
12079
12122
  return `OK_NAVIGATE_RELOADING. Navigating to the page now; the voice session will resume automatically on the new page. When the session resumes, say EXACTLY: "I have navigated you on ${o} page. Do you want to know about any specific section or want a complete overview?" Then STOP — wait for the visitor's reply.`;
12080
12123
  } catch (e) {
12081
12124
  let t = `Navigation error: ${e?.message || String(e)}`;
12082
- return $("fwh-navigate-mvp ✖", t), Ah("Navigation failed", {
12125
+ return $("fwh-navigate-mvp ✖", t), Ph("Navigation failed", {
12083
12126
  spinner: !1,
12084
12127
  icon: "⚠️",
12085
12128
  duration: 1800
12086
12129
  }), t;
12087
12130
  } finally {
12088
- Ih(), jh(900);
12131
+ Bh(), Fh(900);
12089
12132
  }
12090
12133
  },
12091
12134
  "fwh-highlight-mvp": async (e) => {
12092
12135
  $("fwh-highlight-mvp ▶", e);
12093
- let t = og(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText;
12136
+ let t = ug(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText;
12094
12137
  if (typeof window < "u" && window.__fe_user_nav_during_speech) {
12095
12138
  let e = window.__fe_user_nav_during_speech, t = window.location.pathname;
12096
12139
  if (Date.now() - e.ts >= 3e4) window.__fe_user_nav_during_speech = null;
12097
12140
  else return $("flowengage_highlight ✖ blocked — user navigated during speech", e), `NAV_CHANGED: The visitor navigated from "${e.fromPageName}" to "${e.toPageName}" (current path: ${t}) while you were speaking. STOP the current walkthrough immediately. DO NOT call flowengage_highlight again. Say out loud: "I see you've navigated to the ${e.toPageName} page — do you want me to continue what I was explaining, or shall I guide you through this page?" Wait for the visitor's answer before doing anything else.`;
12098
12141
  }
12099
- cg();
12142
+ fg();
12100
12143
  let i = ((e) => e && e.replace(/^\d+\.\s*/, "").replace(/^["']|["']$/g, "").trim())(r), a = cr(n || null, i || null);
12101
12144
  if (!a && i) {
12102
12145
  let e = Date.now() + 600;
12103
- for (; !a && Date.now() < e;) await new Promise((e) => setTimeout(e, 50)), cg(), a = cr(null, i);
12146
+ for (; !a && Date.now() < e;) await new Promise((e) => setTimeout(e, 50)), fg(), a = cr(null, i);
12104
12147
  }
12105
12148
  if (!a) {
12106
12149
  $("fwh-highlight-mvp ✖ no element for:", i || n);
12107
- let { headings: e } = lg(), t = e.length ? `Page headings: ${e.map((e) => `"${e}"`).join(" | ")}. Use one of these EXACT strings for section_text — no numbers, no quotes around them.` : "No headings found — skip highlight and continue speaking.";
12150
+ let { headings: e } = pg(), t = e.length ? `Page headings: ${e.map((e) => `"${e}"`).join(" | ")}. Use one of these EXACT strings for section_text — no numbers, no quotes around them.` : "No headings found — skip highlight and continue speaking.";
12108
12151
  return `HIGHLIGHT_NOT_FOUND: "${i || n}" on the current page. ${t}`;
12109
12152
  }
12110
- return Dn(a), $("fwh-highlight-mvp ✓", i || n), `OK_HIGHLIGHT: "${i || n}". Your NEXT response must be speech only (no tool call) describing THIS section — "${i || n}" — using its own content, then end with the continue question.`;
12153
+ return Dn(a), $("fwh-highlight-mvp ✓", i || n), `OK_HIGHLIGHT: "${i || n}". Your NEXT response must be speech only (no tool call) describing THIS section — "${i || n}" — using its own content. Do not ask whether to continue.`;
12111
12154
  },
12112
12155
  "fwh-read-content-mvp": async (e) => {
12113
12156
  $("fwh-read-content-mvp ▶", e);
12114
- let t = og(e), n = t?.section_text || t?.sectionText || "";
12157
+ let t = ug(e), n = t?.section_text || t?.sectionText || "";
12115
12158
  try {
12116
12159
  let e = "";
12117
12160
  if (n) {
12118
12161
  let t = cr(null, n);
12119
12162
  if (!t) return `Could not find section "${n}" on the page.`;
12120
- e = ug(t);
12163
+ e = mg(t);
12121
12164
  } else {
12122
12165
  let t = (document.querySelector("main") || document.querySelector("article") || document.querySelector("[role=\"main\"]") || document.querySelector("#content") || document.querySelector(".content") || document.body).cloneNode(!0);
12123
12166
  t.querySelectorAll("nav, footer, header, aside, script, style, noscript, .nav, .footer, .header, .sidebar, #flowengage-root, .flowengage-shell, .flowengage-widget-root").forEach((e) => e.remove()), e = t.textContent.replace(/\s+/g, " ").trim();
@@ -12129,7 +12172,7 @@ function dg(e) {
12129
12172
  },
12130
12173
  "fwh-page-content-mvp": async (e) => {
12131
12174
  $("fwh-page-content-mvp ▶", e);
12132
- let r = og(e), i = r?.url || r?.page_url || "";
12175
+ let r = ug(e), i = r?.url || r?.page_url || "";
12133
12176
  if ($("fwh-page-content-mvp · url:", i, "siteId:", t, "apiBase:", n || "(empty)"), !i) return $("fwh-page-content-mvp ✖ missing url"), "Missing url parameter.";
12134
12177
  if (!t) return $("fwh-page-content-mvp ✖ no siteId"), "Site is not configured.";
12135
12178
  if (!n) return $("fwh-page-content-mvp ✖ no api base"), "API base URL is missing; cannot fetch page content.";
@@ -12161,7 +12204,7 @@ function dg(e) {
12161
12204
  },
12162
12205
  "fwh-search-mvp": async (e) => {
12163
12206
  $("fwh-search-mvp ▶", e);
12164
- let r = og(e).query;
12207
+ let r = ug(e).query;
12165
12208
  if (!r) return $("fwh-search-mvp ✖ missing query"), "Missing query parameter.";
12166
12209
  if (!t) return $("fwh-search-mvp ✖ no siteId"), "Search unavailable (no siteId configured).";
12167
12210
  if (!n) return $("fwh-search-mvp ✖ no api base"), "Search unavailable (no API base URL).";
@@ -12199,7 +12242,7 @@ function dg(e) {
12199
12242
  "[class*='menu'] a",
12200
12243
  "[class*='header'] a"
12201
12244
  ];
12202
- if (Xh((t) => {
12245
+ if (eg((t) => {
12203
12246
  for (let r of n) try {
12204
12247
  t.querySelectorAll(r).forEach((t) => {
12205
12248
  if (An(t)) return;
@@ -12207,7 +12250,7 @@ function dg(e) {
12207
12250
  if (!r || !n || n === "#" || n.startsWith("javascript:")) return;
12208
12251
  try {
12209
12252
  let e = t.parentElement;
12210
- if (e && Yh(e).display === "none" && !e.closest("nav, [role='navigation'], header, [class*='nav'], [class*='menu']")) return;
12253
+ if (e && $h(e).display === "none" && !e.closest("nav, [role='navigation'], header, [class*='nav'], [class*='menu']")) return;
12211
12254
  } catch {}
12212
12255
  let i = r.toLowerCase() + "|" + n;
12213
12256
  e.has(i) || e.set(i, {
@@ -12218,7 +12261,7 @@ function dg(e) {
12218
12261
  } catch {}
12219
12262
  t.querySelectorAll("select").forEach((t) => {
12220
12263
  if (An(t)) return;
12221
- let n = Qh(t);
12264
+ let n = ng(t);
12222
12265
  /nav|menu|page|section|go to/i.test(n || t.name || t.id || "") && Array.from(t.options).forEach((r) => {
12223
12266
  if (!r.value || r.disabled) return;
12224
12267
  let i = r.text.trim();
@@ -12240,7 +12283,7 @@ function dg(e) {
12240
12283
  "fwh-request-email-mvp": async () => ($("fwh-request-email-mvp ▶"), typeof e.requestEmailCollection == "function" && e.requestEmailCollection(), "EMAIL_BOX_SHOWN. An email input text box is now visible to the visitor. Say EXACTLY: \"Please enter your email in the text box to continue.\" Then stop and wait silently — do NOT ask them to say it aloud, do NOT repeat, and do NOT answer any other question until you receive the EMAIL_SAVED message."),
12241
12284
  "fwh-get-current-page-mvp": async () => {
12242
12285
  if ($("fwh-get-current-page-mvp ▶"), typeof window > "u") return "Cannot determine current page (no browser context).";
12243
- let e = window.location.href, t = window.location.pathname, n = document.title || "", { headings: r, pageTitleHeading: i, introText: a } = lg();
12286
+ let e = window.location.href, t = window.location.pathname, n = document.title || "", { headings: r, pageTitleHeading: i, introText: a } = pg();
12244
12287
  $("fwh-get-current-page-mvp ✓", {
12245
12288
  url: e,
12246
12289
  path: t,
@@ -12252,7 +12295,7 @@ function dg(e) {
12252
12295
  return `CURRENT_PAGE. URL: ${e} | Title: ${n} | Page sections (${r.length} total): ${s}.${o} *** WALKTHROUGH: do NOT drive it yourself. Do not call fwh-highlight-mvp and do not decide the order — highlighting and section order are handled for you. You will be told which section to describe, one at a time. When told, describe ONLY that section in 3-4 sentences and then stop; never announce another section, never ask whether to continue. ***`;
12253
12296
  },
12254
12297
  "fwh-list-forms-mvp": async () => {
12255
- let e = eg(), t = tg();
12298
+ let e = ig(), t = ag();
12256
12299
  $("fwh-list-forms-mvp ✓", `${e.length} field(s)`, `${t.length} button(s)`);
12257
12300
  let n = e.map((e) => ({
12258
12301
  ...e,
@@ -12266,12 +12309,12 @@ function dg(e) {
12266
12309
  },
12267
12310
  "fwh-fill-form-mvp": async () => "FORM_FILLING_DISABLED: Form filling is not available at this time. Tell the visitor what fields are present (use fwh-list-forms-mvp) and ask them to fill the form themselves.",
12268
12311
  "fwh-click-button-mvp": async (e) => {
12269
- let t = og(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim(), r = (t.card_context ?? t.cardContext ?? "").trim();
12312
+ let t = ug(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim(), r = (t.card_context ?? t.cardContext ?? "").trim();
12270
12313
  if ($("fwh-click-button-mvp ▶", n, r ? `(card_context: ${r})` : ""), !n) return "Missing button_text: pass the visible label, e.g. Conduct Audit.";
12271
- let a = ag(n, i, r);
12314
+ let a = lg(n, i, r);
12272
12315
  if (!a) return $("fwh-click-button-mvp ✖ no match"), `Could not find a button matching "${n}". Call fwh-list-forms-mvp to see button texts.`;
12273
12316
  try {
12274
- Ah(`Clicking ${n}...`, { spinner: !0 });
12317
+ Ph(`Clicking ${n}...`, { spinner: !0 });
12275
12318
  try {
12276
12319
  a.scrollIntoView({
12277
12320
  block: "center",
@@ -12280,22 +12323,22 @@ function dg(e) {
12280
12323
  } catch {
12281
12324
  a.scrollIntoView(!0);
12282
12325
  }
12283
- await Vh(a), a.focus?.(), await Uh(a), Wh(a), a.click();
12326
+ await Gh(a), a.focus?.(), await qh(a), Jh(a), a.click();
12284
12327
  let e = (a.textContent || a.value || a.getAttribute("aria-label") || "").trim().slice(0, 80) || "button", t = `OK_CLICK ${e}`;
12285
- return $("fwh-click-button-mvp ✓", t), Ah(`Clicked ${e}`, {
12328
+ return $("fwh-click-button-mvp ✓", t), Ph(`Clicked ${e}`, {
12286
12329
  spinner: !1,
12287
12330
  icon: "✅",
12288
12331
  duration: 1200
12289
12332
  }), t;
12290
12333
  } catch (e) {
12291
12334
  let t = `Click failed: ${e?.message || String(e)}`;
12292
- return $("fwh-click-button-mvp ✖", t), Ah("Click failed", {
12335
+ return $("fwh-click-button-mvp ✖", t), Ph("Click failed", {
12293
12336
  spinner: !1,
12294
12337
  icon: "⚠️",
12295
12338
  duration: 1800
12296
12339
  }), t;
12297
12340
  } finally {
12298
- Hh(), jh(700);
12341
+ Kh(), Fh(700);
12299
12342
  }
12300
12343
  }
12301
12344
  };
@@ -12309,18 +12352,18 @@ function dg(e) {
12309
12352
  clickPageButton: a["fwh-click-button-mvp"]
12310
12353
  };
12311
12354
  }
12312
- var fg = /^(get in touch|contact us|let'?s (talk|connect)|subscribe|newsletter|follow us|quick links|company|solutions|what we do|resources|legal|sitemap|share this)/i;
12313
- function pg() {
12355
+ var gg = /^(get in touch|contact us|let'?s (talk|connect)|subscribe|newsletter|follow us|quick links|company|solutions|what we do|resources|legal|sitemap|share this)/i;
12356
+ function _g() {
12314
12357
  try {
12315
- let { headings: e } = lg();
12316
- return (e || []).map((e) => typeof e == "string" ? e : e?.text || "").filter(Boolean).filter((e) => !fg.test(e.trim()));
12358
+ let { headings: e } = pg();
12359
+ return (e || []).map((e) => typeof e == "string" ? e : e?.text || "").filter(Boolean).filter((e) => !gg.test(e.trim()));
12317
12360
  } catch {
12318
12361
  return [];
12319
12362
  }
12320
12363
  }
12321
12364
  //#endregion
12322
12365
  //#region src/utils/wrapVoiceToolsForLogging.js
12323
- function mg(e) {
12366
+ function vg(e) {
12324
12367
  return !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, async (n) => {
12325
12368
  let r = wn();
12326
12369
  r ? console.log("[FlowEngage:voice-tool] ▶", e, n) : console.info(`[FlowEngage] voice tool » ${e}`);
@@ -12337,7 +12380,7 @@ function mg(e) {
12337
12380
  }
12338
12381
  //#endregion
12339
12382
  //#region src/components/FlowEngageWidget.jsx
12340
- var hg = {
12383
+ var yg = {
12341
12384
  blue: "#135bd8",
12342
12385
  red: "#ef334b",
12343
12386
  yellow: "#ffbd2e",
@@ -12345,7 +12388,7 @@ var hg = {
12345
12388
  highlight: "rgba(255,255,255,0.9)",
12346
12389
  green: "#10b981"
12347
12390
  };
12348
- function gg(e) {
12391
+ function bg(e) {
12349
12392
  if (!Array.isArray(e) || e.length < 2) return "linear-gradient(145deg, #dce8f022 0%, #e8dff522 45%, #f5e0e022 100%), #f7f8fa";
12350
12393
  let [t, n, r] = e;
12351
12394
  return e.length >= 3 && r ? [
@@ -12359,12 +12402,12 @@ function gg(e) {
12359
12402
  "#f7f8fa"
12360
12403
  ].join(", ");
12361
12404
  }
12362
- function _g(e) {
12405
+ function xg(e) {
12363
12406
  if (!e || typeof e != "string") return "#1a1a1a";
12364
12407
  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;
12365
12408
  return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
12366
12409
  }
12367
- function vg(t) {
12410
+ function Sg(t) {
12368
12411
  let [n, r] = e.useState(null), i = typeof t == "string" ? t.trim() : "";
12369
12412
  return e.useEffect(() => {
12370
12413
  if (!i) {
@@ -12382,8 +12425,8 @@ function vg(t) {
12382
12425
  };
12383
12426
  }, [i]), n;
12384
12427
  }
12385
- function yg({ logo: t, style: n }) {
12386
- let r = vg(typeof t == "string" ? t : null);
12428
+ function Cg({ logo: t, style: n }) {
12429
+ let r = Sg(typeof t == "string" ? t : null);
12387
12430
  if (!t) return null;
12388
12431
  if (typeof t == "string") return r ? /* @__PURE__ */ g("img", {
12389
12432
  src: r,
@@ -12408,7 +12451,7 @@ function yg({ logo: t, style: n }) {
12408
12451
  children: i
12409
12452
  }) : null;
12410
12453
  }
12411
- function bg({ title: e }) {
12454
+ function wg({ title: e }) {
12412
12455
  return /* @__PURE__ */ g("div", {
12413
12456
  style: {
12414
12457
  width: "100%",
@@ -12426,18 +12469,18 @@ function bg({ title: e }) {
12426
12469
  children: String(e || "FE").split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0]?.toUpperCase() || "").join("") || "FE"
12427
12470
  });
12428
12471
  }
12429
- function xg(e, t) {
12472
+ function Tg(e, t) {
12430
12473
  let n = (t || "").trim();
12431
12474
  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) || e === "bot" && (/\b(that'?s all|we'?re done)\b/i.test(n) || /\b(goodbye|bye)\b/i.test(n) || /\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))) : !1;
12432
12475
  }
12433
- function Sg({ orbColors: e, ...t }) {
12434
- return /* @__PURE__ */ g(gh, {
12476
+ function Eg({ orbColors: e, ...t }) {
12477
+ return /* @__PURE__ */ g(bh, {
12435
12478
  colors: e,
12436
12479
  ...t
12437
12480
  });
12438
12481
  }
12439
- function Cg({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
12440
- let s = n || hg.green, c = _g(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
12482
+ function Dg({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
12483
+ let s = n || yg.green, c = xg(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
12441
12484
  style: {
12442
12485
  display: "flex",
12443
12486
  alignItems: a ? "flex-end" : "center",
@@ -12563,7 +12606,7 @@ function Cg({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
12563
12606
  delay: 0
12564
12607
  },
12565
12608
  style: { flexShrink: 0 },
12566
- children: /* @__PURE__ */ g(Sg, {
12609
+ children: /* @__PURE__ */ g(Eg, {
12567
12610
  size: l,
12568
12611
  orbColors: t
12569
12612
  })
@@ -12595,8 +12638,8 @@ function Cg({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
12595
12638
  children: u
12596
12639
  })] });
12597
12640
  }
12598
- function wg({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
12599
- let c = n || hg.green, l = _g(c);
12641
+ function Og({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
12642
+ let c = n || yg.green, l = xg(c);
12600
12643
  return /* @__PURE__ */ _(ym.div, {
12601
12644
  initial: {
12602
12645
  scale: 50 / 350,
@@ -12667,7 +12710,7 @@ function wg({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
12667
12710
  children: /* @__PURE__ */ g("polyline", { points: "6 9 12 15 18 9" })
12668
12711
  })
12669
12712
  }),
12670
- /* @__PURE__ */ g(Sg, {
12713
+ /* @__PURE__ */ g(Eg, {
12671
12714
  size: 72,
12672
12715
  orbColors: t
12673
12716
  }),
@@ -12747,60 +12790,62 @@ function wg({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
12747
12790
  ]
12748
12791
  });
12749
12792
  }
12750
- function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i, apiBaseUrl: a, chatId: s, historyRef: l, onMessageSync: u, voiceEndCounter: d, websiteName: f, voiceFirstMessage: h, captureVisitorEmail: v, emailRequired: y, emailCaptureEnabled: b = !0, listeningLabel: x = "Listening...", enterChatModeLabel: S = "Enter Chat Mode", endConversationLabel: C = "End Conversation" }) {
12793
+ function kg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i, apiBaseUrl: a, chatId: s, historyRef: l, onMessageSync: u, voiceEndCounter: d, websiteName: f, voiceFirstMessage: h, captureVisitorEmail: v, emailRequired: y, emailCaptureEnabled: b = !0, listeningLabel: x = "Listening...", enterChatModeLabel: S = "Enter Chat Mode", endConversationLabel: C = "End Conversation" }) {
12751
12794
  c(() => (console.log("[FlowEngage:VoiceDebug] 🔵 VoiceMode MOUNTED"), () => console.log("[FlowEngage:VoiceDebug] 🔴 VoiceMode UNMOUNTED")), []);
12752
- let [w, T] = m("idle"), [E, D] = m(!1), [O, k] = m(!1), [A, ee] = m(!1), [te, ne] = m(""), [j, re] = m(""), ie = p(!1), ae = p(!1), oe = p(null), se = p(0), ce = p(""), le = p(!1), ue = p(0), de = p(!1), fe = p(!1), pe = p([]), me = p(null);
12753
- me.current = async () => {
12754
- let e = pe.current;
12795
+ let [w, T] = m("idle"), [E, D] = m(!1), [O, k] = m(!1), [A, ee] = m(!1), [te, ne] = m(""), [j, re] = m(""), ie = p(!1), M = p(!1), ae = p(null), oe = p(0), se = p(""), ce = p(!1), le = p(0), ue = p(!1), de = p(!1), fe = p([]), pe = p(null), me = (e) => {
12796
+ ue.current = e, N.current?.setWalkthroughActive?.(e);
12797
+ };
12798
+ pe.current = async () => {
12799
+ let e = fe.current;
12755
12800
  he.current += 1;
12756
12801
  let t = he.current, n = e[t];
12757
12802
  if (!n) {
12758
- de.current = !1, e.length && M.current?.sendUserMessage?.("That was the last section. Say so in one short sentence and ask if they want to explore any section further.");
12803
+ me(!1), e.length && N.current?.sendUserMessage?.("That was the last section. Say so in one short sentence and ask if they want to explore any section further.");
12759
12804
  return;
12760
12805
  }
12761
12806
  try {
12762
12807
  await toolsRef.current?.highlightOnPage?.({ section_text: n });
12763
12808
  } catch {}
12764
- console.debug(`[FlowEngage] walkthrough step ${t + 1}/${e.length}: ${n}`), M.current?.sendUserMessage?.(`Describe the section titled "${n}" in 3-4 sentences, starting with ${t === 0 ? "Starting with" : "Next —"} ${n}. Describe ONLY this section. Do not mention any other section, do not ask whether to continue, then stop.`);
12809
+ console.debug(`[FlowEngage] walkthrough step ${t + 1}/${e.length}: ${n}`), N.current?.sendUserMessage?.(`Describe the section titled "${n}" in 3-4 sentences, starting with ${t === 0 ? "Starting with" : "Next —"} ${n}. Describe ONLY this section. Do not mention any other section, do not ask whether to continue, then stop.`, { suppressQuestion: !0 });
12765
12810
  };
12766
- let he = p(0), M = p(null), ge = p(""), _e = p(async () => {}), ve = p(!1), ye = p(!1), be = p(!1), xe = p(!1), Se = p("minimized"), N = p(null), Ce = p(null), F = p(null), De = p(0), Oe = p(!1), I = p("idle"), ke = p(!1), je = p(!1), Me = p(null), L = p(null), Pe = p(!1), Fe = o((e = "minimized") => {
12811
+ let he = p(0), N = p(null), ge = p(""), _e = p(async () => {}), ve = p(!1), ye = p(!1), be = p(!1), xe = p(!1), Se = p("minimized"), Ce = p(null), F = p(null), De = p(null), Oe = p(0), I = p(!1), ke = p("idle"), je = p(null), Me = p(!1), Pe = o((e = "minimized") => {
12767
12812
  console.warn("[FlowEngage:VoiceDebug] 🛑 requestSessionShutdown called", {
12768
12813
  destination: e,
12769
12814
  stack: (/* @__PURE__ */ Error()).stack?.split("\n").slice(1, 4).join(" | ")
12770
12815
  }), Se.current = e, xe.current = !0, queueMicrotask(() => {
12771
12816
  ve.current || (ve.current = !0, _e.current?.());
12772
12817
  });
12773
- }, [l]), Ie = o(() => {
12774
- oe.current &&= (clearTimeout(oe.current), null);
12818
+ }, [l]), L = o(() => {
12819
+ ae.current &&= (clearTimeout(ae.current), null);
12775
12820
  }, []);
12776
12821
  c(() => {
12777
12822
  if (y) {
12778
12823
  ie.current = !1;
12779
12824
  return;
12780
12825
  }
12781
- if (ie.current = !0, ae.current = !1, ee(!1), Ie(), le.current) {
12782
- le.current = !1, M.current?.setMicMuted?.(!1);
12783
- let e = ce.current;
12784
- ce.current = "", M.current?.injectAgentSpeech?.("Thanks — I already have your email on file.", "interrupt"), e && M.current?.sendUserMessage?.(`The visitor's email is already on file — do not ask for it. Answer their question now: "${e}"`);
12785
- }
12786
- M.current?.sendContextualUpdate?.("EMAIL REQUIREMENT SATISFIED — the visitor's email is already on file. All earlier instructions about requiring or asking for an email are VOID. Never ask for it again.");
12787
- }, [y, Ie]);
12788
- let Le = /(walk me through|complete overview|full overview|tell me about (each|all)|go through (it|them|each)|overview of|one by one|tell me everything)/i, R = /(that covers everything|that was all|covered everything|anything else)/i, Re = o(() => {
12789
- Ie(), oe.current = setTimeout(() => {
12790
- if (!(!ae.current || ie.current)) if (se.current < 3) {
12791
- se.current += 1;
12826
+ if (ie.current = !0, M.current = !1, ee(!1), L(), ce.current) {
12827
+ ce.current = !1, N.current?.setMicMuted?.(!1);
12828
+ let e = se.current;
12829
+ se.current = "", N.current?.injectAgentSpeech?.("Thanks — I already have your email on file.", "interrupt"), e && N.current?.sendUserMessage?.(`The visitor's email is already on file — do not ask for it. Answer their question now: "${e}"`);
12830
+ }
12831
+ N.current?.sendContextualUpdate?.("EMAIL REQUIREMENT SATISFIED — the visitor's email is already on file. All earlier instructions about requiring or asking for an email are VOID. Never ask for it again.");
12832
+ }, [y, L]);
12833
+ let Fe = /(walk\s*(me\s*)?through|walkthrough|take me through|complete overview|full overview|give me (a|an|the) (overview|tour|walk)|tell me about (each|all)|go through (it|them|each|all)|overview of|one by one|tell me everything|show me (each|all|around))/i, Ie = /(that covers everything|that was all|covered everything|anything else)/i, Le = o(() => {
12834
+ L(), ae.current = setTimeout(() => {
12835
+ if (!(!M.current || ie.current)) if (oe.current < 3) {
12836
+ oe.current += 1;
12792
12837
  try {
12793
- M.current?.injectAgentSpeech?.("I still need your email in the box below to continue — could you enter it, please?", "queue");
12838
+ N.current?.injectAgentSpeech?.("I still need your email in the box below to continue — could you enter it, please?", "queue");
12794
12839
  } catch {}
12795
- Re();
12840
+ Le();
12796
12841
  } else {
12797
12842
  try {
12798
- M.current?.injectAgentSpeech?.("Since I haven't received your email, I'll close this session for now. Feel free to come back anytime — take care!", "queue");
12843
+ N.current?.injectAgentSpeech?.("Since I haven't received your email, I'll close this session for now. Feel free to come back anytime — take care!", "queue");
12799
12844
  } catch {}
12800
- ae.current = !1, ee(!1), Ie(), Oe.current = !0;
12845
+ M.current = !1, ee(!1), L(), I.current = !0;
12801
12846
  }
12802
12847
  }, 1e4);
12803
- }, [Ie]), ze = o(async (e) => {
12848
+ }, [L]), R = o(async (e) => {
12804
12849
  xe.current = !0;
12805
12850
  try {
12806
12851
  On();
@@ -12809,9 +12854,9 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
12809
12854
  Ne(i);
12810
12855
  } catch {}
12811
12856
  try {
12812
- await M.current?.endSession?.();
12857
+ await N.current?.endSession?.();
12813
12858
  } catch {}
12814
- let t = N.current, n = Ce.current;
12859
+ let t = Ce.current, n = F.current;
12815
12860
  if (t && s && a) {
12816
12861
  let e = n ? Math.round((Date.now() - n) / 1e3) : 0;
12817
12862
  fetch(`${a}/api/voice/save-chat-recording`, {
@@ -12825,7 +12870,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
12825
12870
  })
12826
12871
  }).catch((e) => console.warn("[FlowEngage] save-chat-recording failed:", e.message));
12827
12872
  }
12828
- if (N.current = null, Ce.current = null, M.current = null, T("idle"), D(!1), ve.current = !1, wr(), i) try {
12873
+ if (Ce.current = null, F.current = null, N.current = null, T("idle"), D(!1), ve.current = !1, wr(), i) try {
12829
12874
  Te(i);
12830
12875
  } catch {}
12831
12876
  typeof u == "function" && await u(l.current), e?.();
@@ -12836,10 +12881,10 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
12836
12881
  s,
12837
12882
  a
12838
12883
  ]);
12839
- _e.current = () => ze(Se.current === "chat" ? t : n), c(() => {
12884
+ _e.current = () => R(Se.current === "chat" ? t : n), c(() => {
12840
12885
  ye.current = E;
12841
12886
  }, [E]), c(() => {
12842
- d && Fe("chat");
12887
+ d && Pe("chat");
12843
12888
  }, [d]), c(() => {
12844
12889
  let e = !1, o = null, c = null, d = null;
12845
12890
  return (async () => {
@@ -12851,11 +12896,11 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
12851
12896
  if ((await navigator.mediaDevices.getUserMedia({ audio: !0 })).getTracks().forEach((e) => e.stop()), e) return;
12852
12897
  l.current = [], ge.current = "", ve.current = !1, be.current = !1, xe.current = !1, Se.current = "minimized", Cr({ onBeforeNavigate: () => {
12853
12898
  if (i && l.current.length > 0) try {
12854
- let e = Th(l.current);
12899
+ let e = kh(l.current);
12855
12900
  e && P(i, e);
12856
12901
  } catch {}
12857
12902
  if (!qn()) {
12858
- let e = N.current, t = Ce.current;
12903
+ let e = Ce.current, t = F.current;
12859
12904
  if (e && s && a) try {
12860
12905
  let n = t ? Math.round((Date.now() - t) / 1e3) : 0, r = JSON.stringify({
12861
12906
  chatId: s,
@@ -12868,21 +12913,21 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
12868
12913
  headers: { "Content-Type": "application/json" },
12869
12914
  body: r,
12870
12915
  keepalive: !0
12871
- }).catch(() => {}), N.current = null, Ce.current = null;
12916
+ }).catch(() => {}), Ce.current = null, F.current = null;
12872
12917
  } catch {}
12873
12918
  }
12874
12919
  Ee();
12875
12920
  } });
12876
- let t = mg(dg({
12921
+ let t = vg(hg({
12877
12922
  siteId: i || null,
12878
12923
  apiBaseUrl: a || null,
12879
12924
  chatId: s || null,
12880
12925
  getLastUserVoiceText: () => ge.current,
12881
12926
  requestEndSession: () => {
12882
- Oe.current = !0;
12927
+ I.current = !0;
12883
12928
  },
12884
12929
  requestEmailCollection: () => {
12885
- b && (ie.current || ae.current || (ae.current = !0, se.current = 0, ee(!0), Re()));
12930
+ b && (ie.current || M.current || (M.current = !0, oe.current = 0, ee(!0), Le()));
12886
12931
  }
12887
12932
  })), n = i ? we(i) : null, r = !!n?.transcript, u = i ? Ne(i) : null, p = !!u, m = typeof window < "u" ? window.location.pathname : "/", g = typeof document < "u" ? document.title : "", _ = m.replace(/^\/[a-z]{2}(?:-[a-z]{2})?(?=\/|$)/i, "") || "/", v = _ === "/" || _ === "", x = {
12888
12933
  apiBaseUrl: a,
@@ -12908,89 +12953,88 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
12908
12953
  let e = f || "";
12909
12954
  x.greeting = h || (v ? e ? `Hi, welcome to ${e}! How may I help you?` : "Hi, welcome! How may I help you?" : `Welcome to the ${w} page!`), v || console.log(`[FlowEngage] 🏠 Page-context greeting: "${w}" for ${m}`);
12910
12955
  }
12911
- let O = !1, k = p ? `NAVIGATION COMPLETE — The exact phrase "I have navigated you on [page] page. Do you want to know about any specific section or want a complete overview?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript ? `Prior transcript:\n${n.transcript}\n` : "(no prior transcript)"}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until the visitor responds. When they reply: if they name a specific section → call fwh-get-current-page-mvp then answer immediately; if they say "overview" or anything non-specific → call fwh-get-current-page-mvp (zero speech) then do a full highlighted walkthrough.` : null, A = !1, te = !p && !r ? "Your greeting has been spoken. Wait for the visitor to ask a question or tell you what they need. Do NOT auto-start a walkthrough or highlight any sections — let the visitor lead." : null, ne = r && !p, j = !1, re = ne ? `The question "Would you like me to continue what I was explaining before, or would you like to know about this page instead?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript ? `Prior transcript:\n${n.transcript}\n` : "(no prior transcript, or the visitor navigated before saying much)"}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until they respond. When they reply: if they want you to CONTINUE the previous topic → resume verbally from the prior transcript above, do NOT call fwh-get-current-page-mvp or describe the new page unless they ask. If they want to know about THIS page → call fwh-get-current-page-mvp (zero speech) then proceed as a normal fresh-page walkthrough/description. If their reply is ambiguous, ask them to clarify which they'd prefer rather than guessing.` : null, oe = !1, _e = !1, Te = b && !!y && !fe.current, F = await Om.startSession({
12956
+ let O = !1, k = p ? `NAVIGATION COMPLETE — The exact phrase "I have navigated you on [page] page. Do you want to know about any specific section or want a complete overview?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript ? `Prior transcript:\n${n.transcript}\n` : "(no prior transcript)"}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until the visitor responds. When they reply: if they name a specific section → call fwh-get-current-page-mvp then answer immediately; if they say "overview" or anything non-specific → call fwh-get-current-page-mvp (zero speech) then do a full highlighted walkthrough.` : null, A = !1, te = !p && !r ? "Your greeting has been spoken. Wait for the visitor to ask a question or tell you what they need. Do NOT auto-start a walkthrough or highlight any sections — let the visitor lead." : null, ne = r && !p, j = !1, re = ne ? `The question "Would you like me to continue what I was explaining before, or would you like to know about this page instead?" has already been spoken as your firstMessage. DO NOT repeat it. PRIOR CONVERSATION CONTEXT:\n${n?.transcript ? `Prior transcript:\n${n.transcript}\n` : "(no prior transcript, or the visitor navigated before saying much)"}\nNow STOP — wait silently for the visitor's reply. Do NOT speak, do NOT call any tool until they respond. When they reply: if they want you to CONTINUE the previous topic → resume verbally from the prior transcript above, do NOT call fwh-get-current-page-mvp or describe the new page unless they ask. If they want to know about THIS page → call fwh-get-current-page-mvp (zero speech) then proceed as a normal fresh-page walkthrough/description. If their reply is ambiguous, ask them to clarify which they'd prefer rather than guessing.` : null, ae = !1, _e = !1, Te = b && !!y && !de.current, De = await Mm.startSession({
12912
12957
  ...x,
12913
12958
  onConnect: ({ conversationId: e }) => {
12914
- N.current = e, Ce.current = Date.now(), console.log("[FlowEngage] 🎙️ AI chat session connected:", e);
12959
+ Ce.current = e, F.current = Date.now(), console.log("[FlowEngage] 🎙️ AI chat session connected:", e);
12915
12960
  },
12916
12961
  onUnhandledClientToolCall: (e) => console.error("[FlowEngage] Unhandled tool:", e?.tool_name),
12917
12962
  onSessionInfo: ({ emailOnFile: e }) => {
12918
- fe.current = !!e, e && (ie.current = !0, ae.current = !1, ee(!1), Ie(), console.log("[FlowEngage] email already on file per server — gate disabled"));
12963
+ de.current = !!e, e && (ie.current = !0, M.current = !1, ee(!1), L(), console.log("[FlowEngage] email already on file per server — gate disabled"));
12919
12964
  },
12920
12965
  onAgentTurnEnd: () => {
12921
- e || de.current && (le.current || setTimeout(() => me.current?.(), 250));
12966
+ e || ue.current && (ce.current || setTimeout(() => pe.current?.(), 250));
12967
+ },
12968
+ onSessionEnding: () => {
12969
+ e || Pe("minimized");
12922
12970
  },
12923
12971
  onModeChange: ({ mode: t }) => {
12924
12972
  if (!e) {
12925
12973
  if (t === "speaking") {
12926
- L.current &&= (clearTimeout(L.current), null), T("speaking"), I.current = "speaking", ke.current = !0, Pe.current = !1, Me.current &&= (clearTimeout(Me.current), null);
12974
+ je.current &&= (clearTimeout(je.current), null), T("speaking"), ke.current = "speaking", Me.current = !1;
12927
12975
  return;
12928
12976
  }
12929
- if (I.current = "listening", Oe.current) {
12930
- Oe.current = !1, Fe();
12977
+ if (ke.current = "listening", I.current) {
12978
+ I.current = !1, Pe();
12931
12979
  return;
12932
12980
  }
12933
- if (Te && !_e && !ie.current && !fe.current) {
12981
+ if (Te && !_e && !ie.current && !de.current) {
12934
12982
  _e = !0, O = !0, A = !0;
12935
12983
  try {
12936
- M.current?.sendContextualUpdate?.("CRITICAL — EMAIL REQUIRED BEFORE ANYTHING ELSE. The visitor has not provided their email. Do NOT speak right now. Wait silently for the visitor to speak first. The MOMENT the visitor says ANYTHING — a question, a request, or just a greeting — your ENTIRE next response must be EXACTLY this one sentence: \"Before I answer that, could you please enter your email in the text box below?\" Do NOT answer their question. Do NOT say anything about the topic. Do NOT begin an answer and then switch — your first word must be \"Before\". After you say that sentence, stay completely silent until you receive an EMAIL_SAVED message, then thank them briefly and answer their question in full.");
12984
+ N.current?.sendContextualUpdate?.("CRITICAL — EMAIL REQUIRED BEFORE ANYTHING ELSE. The visitor has not provided their email. Do NOT speak right now. Wait silently for the visitor to speak first. The MOMENT the visitor says ANYTHING — a question, a request, or just a greeting — your ENTIRE next response must be EXACTLY this one sentence: \"Before I answer that, could you please enter your email in the text box below?\" Do NOT answer their question. Do NOT say anything about the topic. Do NOT begin an answer and then switch — your first word must be \"Before\". After you say that sentence, stay completely silent until you receive an EMAIL_SAVED message, then thank them briefly and answer their question in full.");
12937
12985
  } catch {}
12938
12986
  }
12939
12987
  if (k && !O) {
12940
12988
  O = !0;
12941
12989
  try {
12942
- M.current?.sendContextualUpdate?.(k);
12990
+ N.current?.sendContextualUpdate?.(k);
12943
12991
  } catch {}
12944
12992
  }
12945
12993
  if (re && !j) {
12946
12994
  j = !0;
12947
12995
  try {
12948
- M.current?.sendContextualUpdate?.(re);
12996
+ N.current?.sendContextualUpdate?.(re);
12949
12997
  } catch {}
12950
12998
  }
12951
12999
  if (te && !A) {
12952
13000
  A = !0;
12953
13001
  try {
12954
- M.current?.sendContextualUpdate?.(te);
13002
+ N.current?.sendContextualUpdate?.(te);
12955
13003
  } catch {}
12956
13004
  }
12957
- L.current && clearTimeout(L.current), L.current = setTimeout(() => {
12958
- e || I.current !== "speaking" && (Pe.current || (L.current = null, I.current = "listening", T("listening"), ke.current && je.current && !ye.current && !ae.current && (Me.current && clearTimeout(Me.current), Me.current = setTimeout(() => {
12959
- if (!e && I.current === "listening" && !ye.current && !ae.current) try {
12960
- M.current?.sendContextualUpdate?.("The visitor has been silent for a while. Ask one short, natural question to re-engage — for example: 'Is there anything specific you'd like to know more about?' or 'What else can I help you with today?' Keep it to one sentence.");
12961
- } catch {}
12962
- }, 15e3))));
13005
+ je.current && clearTimeout(je.current), je.current = setTimeout(() => {
13006
+ e || ke.current !== "speaking" && (Me.current || (je.current = null, ke.current = "listening", T("listening")));
12963
13007
  }, 1200);
12964
13008
  }
12965
13009
  },
12966
13010
  onMessage: (t) => {
12967
- if (e || le.current && t.role !== "user" && !/email/i.test(String(t.message || ""))) return;
12968
- t.role === "user" && Le.test(String(t.message || "")) && (de.current = !0, ue.current = 0, he.current = -1, pe.current = pg(), setTimeout(() => me.current?.(), 400), console.log(`[FlowEngage] walkthrough armed — ${pe.current.length} sections on this page`)), t.role !== "user" && R.test(String(t.message || "")) && (de.current = !1);
13011
+ if (e || ce.current && t.role !== "user" && !/email/i.test(String(t.message || ""))) return;
13012
+ t.role === "user" && Fe.test(String(t.message || "")) && (typeof window < "u" && (window.__fe_user_nav_during_speech = null), me(!0), le.current = 0, he.current = -1, fe.current = _g(), setTimeout(() => pe.current?.(), 400), console.log(`[FlowEngage] walkthrough armed — ${fe.current.length} sections on this page`)), t.role !== "user" && Ie.test(String(t.message || "")) && me(!1);
12969
13013
  let n = t.role === "user" ? "user" : "bot", r = t.message || t.text || t.content || "";
12970
13014
  if (r) {
12971
13015
  if (n === "user") {
12972
- ge.current = r, Pe.current = !0, je.current = !0, L.current &&= (clearTimeout(L.current), null), Me.current &&= (clearTimeout(Me.current), null);
13016
+ ge.current = r, typeof window < "u" && (window.__fe_user_nav_during_speech = null), Me.current = !0, je.current &&= (clearTimeout(je.current), null);
12973
13017
  try {
12974
13018
  On();
12975
13019
  } catch {}
12976
- Te && !oe && !ie.current && !fe.current && (oe = !0, ce.current = r, le.current = !0, M.current?.injectAgentSpeech?.("Before I answer that, could you please enter your email in the text box below?", "interrupt"), M.current?.setMicMuted?.(!0), ae.current || (ae.current = !0, se.current = 0, ee(!0), Re()));
13020
+ Te && !ae && !ie.current && !de.current && (ae = !0, se.current = r, ce.current = !0, N.current?.injectAgentSpeech?.("Before I answer that, could you please enter your email in the text box below?", "interrupt"), N.current?.setMicMuted?.(!0), M.current || (M.current = !0, oe.current = 0, ee(!0), Le()));
12977
13021
  }
12978
13022
  if (l.current = [...l.current, {
12979
13023
  sender: n,
12980
13024
  message: r,
12981
13025
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
12982
13026
  }], i) try {
12983
- let e = Th(l.current);
13027
+ let e = kh(l.current);
12984
13028
  e && P(i, e);
12985
13029
  } catch {}
12986
- if (xg(n, r)) {
12987
- Oe.current = !0;
13030
+ if (Tg(n, r)) {
13031
+ I.current = !0;
12988
13032
  return;
12989
13033
  }
12990
- if (ye.current && n === "bot" && /are you still there|still there\??|hello\?|anyone there|checking in|you there|are you available|is anyone|did you step away/i.test(r)) if (De.current += 1, De.current === 2) try {
12991
- M.current?.sendContextualUpdate?.("IMPORTANT: The visitor is muted and has not responded to your last 2 checks. Make exactly ONE more check. If there is still no response, say: 'I feel like you are not active, so I'm ending this session. You can connect with me anytime.' then immediately call the fwh-end-session-mvp tool to end the voice session. Do NOT ask again after that.");
13034
+ if (ye.current && n === "bot" && /are you still there|still there\??|hello\?|anyone there|checking in|you there|are you available|is anyone|did you step away/i.test(r)) if (Oe.current += 1, Oe.current === 2) try {
13035
+ N.current?.sendContextualUpdate?.("IMPORTANT: The visitor is muted and has not responded to your last 2 checks. Make exactly ONE more check. If there is still no response, say: 'I feel like you are not active, so I'm ending this session. You can connect with me anytime.' then immediately call the fwh-end-session-mvp tool to end the voice session. Do NOT ask again after that.");
12992
13036
  } catch {}
12993
- else De.current >= 5 && Fe("minimized");
13037
+ else Oe.current >= 5 && Pe("minimized");
12994
13038
  }
12995
13039
  },
12996
13040
  onError: (t) => {
@@ -13001,9 +13045,9 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13001
13045
  raw: t
13002
13046
  });
13003
13047
  try {
13004
- M.current?.setMicMuted?.(!0);
13048
+ N.current?.setMicMuted?.(!0);
13005
13049
  } catch {}
13006
- D(!0), T("error"), Fe("chat");
13050
+ D(!0), T("error"), Pe("chat");
13007
13051
  }
13008
13052
  },
13009
13053
  onDisconnect: (t) => {
@@ -13018,16 +13062,16 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13018
13062
  wasMuted: ye.current
13019
13063
  }), be.current = !0;
13020
13064
  try {
13021
- M.current?.setMicMuted?.(!0);
13065
+ N.current?.setMicMuted?.(!0);
13022
13066
  } catch {}
13023
- D(!0), Fe("chat");
13067
+ D(!0), Pe("chat");
13024
13068
  }
13025
13069
  });
13026
13070
  if (e) {
13027
- console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"), F.endSession().catch(() => {});
13071
+ console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"), De.endSession().catch(() => {});
13028
13072
  return;
13029
13073
  }
13030
- o = F, M.current = F, T("listening");
13074
+ o = De, N.current = De, T("listening");
13031
13075
  try {
13032
13076
  let e = typeof window < "u" ? window.location.href : "", a = "[]";
13033
13077
  try {
@@ -13039,7 +13083,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13039
13083
  n.length || (n = Array.from(document.body.querySelectorAll("h1, h2, h3")).filter((t) => !t.closest(e)).map((e) => e.textContent.replace(/\s+/g, " ").trim()).filter((e) => e.length > 2 && e.length < 200)), n.length && (o = [...new Set(n)].slice(0, 15).join(" | "));
13040
13084
  } catch {}
13041
13085
  let s = r && !p ? `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${n?.transcript || ""}\n\n` : "";
13042
- F.sendContextualUpdate(`${s}SESSION_CONTEXT (NOT a tool result — do NOT treat as CURRENT_PAGE): Visitor is on: ${e} | Approx headings for awareness only: ${o}. SiteId: ${i || "unknown"}. Forms: ${a}. ${y ? "" : "Visitor's email is already on file from a prior session — do NOT ask for it again. "}The visitor is ALREADY on this page — do NOT offer to navigate there. WALKTHROUGH RULE: When the visitor asks for a walkthrough or overview of this page, you MUST IMMEDIATELY call fwh-get-current-page-mvp (zero speech — call it silently with NO words before it) to get the exact highlightable headings. The approximate headings above are for routing awareness ONLY — they are NOT precise enough for fwh-highlight-mvp. Do NOT skip fwh-get-current-page-mvp. Voice: call end_voice_session or say you are ending the session to stop.`);
13086
+ De.sendContextualUpdate(`${s}SESSION_CONTEXT (NOT a tool result — do NOT treat as CURRENT_PAGE): Visitor is on: ${e} | Approx headings for awareness only: ${o}. SiteId: ${i || "unknown"}. Forms: ${a}. ${y ? "" : "Visitor's email is already on file from a prior session — do NOT ask for it again. "}The visitor is ALREADY on this page — do NOT offer to navigate there. WALKTHROUGH RULE: When the visitor asks for a walkthrough or overview of this page, you MUST IMMEDIATELY call fwh-get-current-page-mvp (zero speech — call it silently with NO words before it) to get the exact highlightable headings. The approximate headings above are for routing awareness ONLY — they are NOT precise enough for fwh-highlight-mvp. Do NOT skip fwh-get-current-page-mvp. Voice: call end_voice_session or say you are ending the session to stop.`);
13043
13087
  } catch {}
13044
13088
  if (typeof window < "u") {
13045
13089
  let t = window.location.pathname, n = () => {
@@ -13068,7 +13112,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13068
13112
  ts: Date.now()
13069
13113
  });
13070
13114
  try {
13071
- M.current?.sendUserMessage?.(`[SYSTEM: I navigated away mid-walkthrough — I am now on the "${l}" page (${i}). Page title: "${a}". Sections: ${JSON.stringify(o)}. STOP everything. Do NOT describe the new page. Say EXACTLY: "I see you've navigated to the ${l} page — would you like me to continue what I was explaining, or shall I walk you through this page?" Then wait for my answer. IF I say continue/yes/carry on: resume speaking verbally from where you left off — do NOT call flowengage_navigate, do NOT call flowengage_highlight, the visitor will navigate themselves if needed. IF I want to hear about this page: call flowengage_highlight for sections of "${l}" only.]`);
13115
+ N.current?.sendUserMessage?.(`[SYSTEM: I navigated away mid-walkthrough — I am now on the "${l}" page (${i}). Page title: "${a}". Sections: ${JSON.stringify(o)}. STOP everything. Do NOT describe the new page. Say EXACTLY: "I see you've navigated to the ${l} page — would you like me to continue what I was explaining, or shall I walk you through this page?" Then wait for my answer. IF I say continue/yes/carry on: resume speaking verbally from where you left off — do NOT call flowengage_navigate, do NOT call flowengage_highlight, the visitor will navigate themselves if needed. IF I want to hear about this page: call flowengage_highlight for sections of "${l}" only.]`);
13072
13116
  } catch {}
13073
13117
  };
13074
13118
  c = window.history.pushState.bind(window.history), window.history.pushState = (...e) => {
@@ -13092,8 +13136,8 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13092
13136
  if (i) try {
13093
13137
  Ne(i);
13094
13138
  } catch {}
13095
- typeof window < "u" && (window.__fe_user_nav_during_speech = null), wr(), Me.current &&= (clearTimeout(Me.current), null), L.current &&= (clearTimeout(L.current), null), oe.current &&= (clearTimeout(oe.current), null), ke.current = !1, Pe.current = !1, I.current = "idle", c && typeof window < "u" && (window.history.pushState = c), d && typeof window < "u" && window.removeEventListener("popstate", d);
13096
- let t = o || M.current, n = N.current, f = Ce.current;
13139
+ typeof window < "u" && (window.__fe_user_nav_during_speech = null), wr(), je.current &&= (clearTimeout(je.current), null), ae.current &&= (clearTimeout(ae.current), null), Me.current = !1, ke.current = "idle", c && typeof window < "u" && (window.history.pushState = c), d && typeof window < "u" && window.removeEventListener("popstate", d);
13140
+ let t = o || N.current, n = Ce.current, f = F.current;
13097
13141
  if (t?.endSession?.().catch(() => {}), n && s && a) {
13098
13142
  let e = f ? Math.round((Date.now() - f) / 1e3) : 0, t = JSON.stringify({
13099
13143
  chatId: s,
@@ -13106,7 +13150,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13106
13150
  headers: { "Content-Type": "application/json" },
13107
13151
  body: t,
13108
13152
  keepalive: !0
13109
- }).catch(() => {}), N.current = null, Ce.current = null;
13153
+ }).catch(() => {}), Ce.current = null, F.current = null;
13110
13154
  }
13111
13155
  typeof u == "function" && l.current.length > 0 && u(l.current).catch?.(() => {});
13112
13156
  };
@@ -13114,30 +13158,30 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13114
13158
  r,
13115
13159
  i,
13116
13160
  a,
13117
- Fe
13161
+ Pe
13118
13162
  ]), c(() => {
13119
13163
  if (!O) return;
13120
13164
  let e = (e) => {
13121
13165
  let t = e.composedPath?.()?.[0] || e.target;
13122
- F.current && !F.current.contains(t) && k(!1);
13166
+ De.current && !De.current.contains(t) && k(!1);
13123
13167
  };
13124
13168
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
13125
13169
  }, [O]);
13126
- let Be = async () => {
13127
- if (M.current) try {
13170
+ let Re = async () => {
13171
+ if (N.current) try {
13128
13172
  if (E) {
13129
- De.current = 0, await M.current.setMicMuted?.(!1), D(!1);
13173
+ Oe.current = 0, await N.current.setMicMuted?.(!1), D(!1);
13130
13174
  try {
13131
- M.current.sendContextualUpdate?.("The visitor has unmuted. Resume normal interaction and wait for them to speak.");
13175
+ N.current.sendContextualUpdate?.("The visitor has unmuted. Resume normal interaction and wait for them to speak.");
13132
13176
  } catch {}
13133
13177
  } else {
13134
- De.current = 0, await M.current.setMicMuted?.(!0), D(!0);
13178
+ Oe.current = 0, await N.current.setMicMuted?.(!0), D(!0);
13135
13179
  try {
13136
- M.current.sendContextualUpdate?.("The visitor has muted their microphone. Do NOT speak, ask if they are there, or prompt them in any way. Stay completely silent until they unmute.");
13180
+ N.current.sendContextualUpdate?.("The visitor has muted their microphone. Do NOT speak, ask if they are there, or prompt them in any way. Stay completely silent until they unmute.");
13137
13181
  } catch {}
13138
13182
  }
13139
13183
  } catch {}
13140
- }, Ve = o(async (e) => {
13184
+ }, ze = o(async (e) => {
13141
13185
  e?.preventDefault?.();
13142
13186
  let t = te.trim().toLowerCase();
13143
13187
  if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)) {
@@ -13148,19 +13192,19 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13148
13192
  try {
13149
13193
  typeof v == "function" && await v(t);
13150
13194
  } catch {}
13151
- ie.current = !0, ae.current = !1, Ie(), ee(!1), ne(""), le.current = !1, M.current?.setMicMuted?.(!1);
13152
- let n = ce.current;
13153
- ce.current = "";
13195
+ ie.current = !0, M.current = !1, L(), ee(!1), ne(""), ce.current = !1, N.current?.setMicMuted?.(!1);
13196
+ let n = se.current;
13197
+ se.current = "";
13154
13198
  try {
13155
- M.current?.sendUserMessage?.("[SYSTEM: EMAIL_SAVED the visitor typed and submitted their email address. Say a brief 'Thank you!' and then " + (n ? `immediately answer their original question fully: "${n}".` : "continue helping them.") + " Do NOT ask for their email again.]");
13199
+ N.current?.injectAgentSpeech?.("Thank you for submitting your email."), N.current?.sendUserMessage?.(n || "The visitor's email is on file. Carry on helping them and never ask for it again.");
13156
13200
  } catch {}
13157
13201
  }, [
13158
13202
  te,
13159
13203
  v,
13160
- Ie
13161
- ]), He = Array.isArray(e) && e[0] || "#3B82F6";
13204
+ L
13205
+ ]), Be = Array.isArray(e) && e[0] || "#3B82F6";
13162
13206
  return /* @__PURE__ */ _("div", {
13163
- ref: F,
13207
+ ref: De,
13164
13208
  style: {
13165
13209
  position: "relative",
13166
13210
  display: "flex",
@@ -13171,7 +13215,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13171
13215
  },
13172
13216
  children: [
13173
13217
  A && /* @__PURE__ */ _("form", {
13174
- onSubmit: Ve,
13218
+ onSubmit: ze,
13175
13219
  style: {
13176
13220
  width: "270px",
13177
13221
  maxWidth: "calc(100vw - 40px)",
@@ -13234,7 +13278,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13234
13278
  padding: "10px 12px",
13235
13279
  borderRadius: "10px",
13236
13280
  border: "none",
13237
- background: te.trim() ? He : "#374151",
13281
+ background: te.trim() ? Be : "#374151",
13238
13282
  color: "white",
13239
13283
  fontSize: "14px",
13240
13284
  fontWeight: 600,
@@ -13280,7 +13324,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13280
13324
  },
13281
13325
  children: "Muted"
13282
13326
  }),
13283
- /* @__PURE__ */ g(Sg, {
13327
+ /* @__PURE__ */ g(Eg, {
13284
13328
  size: 72,
13285
13329
  voiceState: w,
13286
13330
  isMuted: E,
@@ -13303,7 +13347,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13303
13347
  alignItems: "center"
13304
13348
  },
13305
13349
  children: [/* @__PURE__ */ g("button", {
13306
- onClick: Be,
13350
+ onClick: Re,
13307
13351
  title: E ? "Unmute" : "Mute",
13308
13352
  style: {
13309
13353
  width: "24px",
@@ -13352,7 +13396,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13352
13396
  y2: "23"
13353
13397
  })
13354
13398
  ]
13355
- }) : /* @__PURE__ */ g(km, {
13399
+ }) : /* @__PURE__ */ g(Nm, {
13356
13400
  size: 16,
13357
13401
  color: "currentColor"
13358
13402
  })
@@ -13374,7 +13418,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13374
13418
  padding: 0,
13375
13419
  flexShrink: 0
13376
13420
  },
13377
- children: /* @__PURE__ */ g(Lm, {
13421
+ children: /* @__PURE__ */ g(Vm, {
13378
13422
  size: 16,
13379
13423
  color: "currentColor"
13380
13424
  })
@@ -13398,7 +13442,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13398
13442
  children: [
13399
13443
  /* @__PURE__ */ _("button", {
13400
13444
  onClick: () => {
13401
- k(!1), Se.current = "chat", ze(t);
13445
+ k(!1), Se.current = "chat", R(t);
13402
13446
  },
13403
13447
  style: {
13404
13448
  display: "flex",
@@ -13423,11 +13467,11 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13423
13467
  onMouseLeave: (e) => {
13424
13468
  e.currentTarget.style.background = "none";
13425
13469
  },
13426
- children: [/* @__PURE__ */ g(Rm, {}), S]
13470
+ children: [/* @__PURE__ */ g(Hm, {}), S]
13427
13471
  }),
13428
13472
  /* @__PURE__ */ _("button", {
13429
13473
  onClick: () => {
13430
- k(!1), Se.current = "minimized", ze(n);
13474
+ k(!1), Se.current = "minimized", R(n);
13431
13475
  },
13432
13476
  style: {
13433
13477
  display: "flex",
@@ -13452,7 +13496,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13452
13496
  onMouseLeave: (e) => {
13453
13497
  e.currentTarget.style.background = "none";
13454
13498
  },
13455
- children: [/* @__PURE__ */ g(zm, {}), C]
13499
+ children: [/* @__PURE__ */ g(Um, {}), C]
13456
13500
  }),
13457
13501
  /* @__PURE__ */ g("button", {
13458
13502
  onClick: () => k(!1),
@@ -13504,7 +13548,7 @@ function Tg({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13504
13548
  ]
13505
13549
  });
13506
13550
  }
13507
- function Eg({ orbColors: e }) {
13551
+ function Ag({ orbColors: e }) {
13508
13552
  let t = Array.isArray(e) && e.length > 0 ? e : [
13509
13553
  "#135bd8",
13510
13554
  "#ef334b",
@@ -13523,7 +13567,7 @@ function Eg({ orbColors: e }) {
13523
13567
  `.replace(/\s+/g, " ").trim()
13524
13568
  } });
13525
13569
  }
13526
- var Dg = () => /* @__PURE__ */ g("div", {
13570
+ var jg = () => /* @__PURE__ */ g("div", {
13527
13571
  style: {
13528
13572
  display: "flex",
13529
13573
  marginBottom: "12px",
@@ -13553,8 +13597,8 @@ var Dg = () => /* @__PURE__ */ g("div", {
13553
13597
  } }, e))
13554
13598
  })
13555
13599
  });
13556
- function Og({ 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: E, rateLimitMessage: D, selectedFile: O, onFileSelect: k, onRemoveSelectedFile: A, attachmentError: ee, isUploadingAttachment: te, requiresEmail: ne, emailInput: j, setEmailInput: re, emailError: ie, emailCaptureSuccess: ae, replyContext: oe, setReplyContext: se, webRTCError: ce, micError: le, setMicError: ue, dismissCallError: de, activeCallId: fe, isCallMuted: pe, toggleCallMute: me, endWebRTCCall: he, formatCallDuration: M, callDurationSeconds: ge, isCallMinimized: _e, onExpand: ve, onCollapse: ye, onStartVoice: be, voiceEnabled: xe, headerBgColor: Se, onNewChat: N, showPoweredBy: Ce, privacyPolicyUrl: P, getVisitorChatHistory: we, resumeChat: Te, isSessionRestoring: F, isClosing: Ee }) {
13557
- let De = l.length > 0, Oe = T || E || w, I = !!fe, [ke, Ae] = m(!1), [je, Me] = m(!1), [Ne, L] = m([]), [Pe, Fe] = m(!1), Ie = p(null), [Le, R] = m(() => typeof window < "u" ? window.visualViewport?.height ?? window.innerHeight : 600), [Re, ze] = m(0);
13600
+ function Mg({ 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: E, rateLimitMessage: D, selectedFile: O, onFileSelect: k, onRemoveSelectedFile: A, attachmentError: ee, isUploadingAttachment: te, requiresEmail: ne, emailInput: j, setEmailInput: re, emailError: ie, emailCaptureSuccess: M, replyContext: ae, setReplyContext: oe, webRTCError: se, micError: ce, setMicError: le, dismissCallError: ue, activeCallId: de, isCallMuted: fe, toggleCallMute: pe, endWebRTCCall: me, formatCallDuration: he, callDurationSeconds: N, isCallMinimized: ge, onExpand: _e, onCollapse: ve, onStartVoice: ye, voiceEnabled: be, headerBgColor: xe, onNewChat: Se, showPoweredBy: Ce, privacyPolicyUrl: P, getVisitorChatHistory: we, resumeChat: Te, isSessionRestoring: F, isClosing: Ee }) {
13601
+ let De = l.length > 0, Oe = T || E || w, I = !!de, [ke, Ae] = m(!1), [je, Me] = m(!1), [Ne, Pe] = m([]), [L, Fe] = m(!1), Ie = p(null), [Le, R] = m(() => typeof window < "u" ? window.visualViewport?.height ?? window.innerHeight : 600), [Re, ze] = m(0);
13558
13602
  c(() => {
13559
13603
  if (!s) return;
13560
13604
  let e = window.visualViewport;
@@ -13570,7 +13614,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
13570
13614
  Ae(!1), Me(!0), Fe(!0);
13571
13615
  try {
13572
13616
  let e = await we();
13573
- e?.data && L(e.data);
13617
+ e?.data && Pe(e.data);
13574
13618
  } catch (e) {
13575
13619
  console.error(e);
13576
13620
  } finally {
@@ -13623,7 +13667,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
13623
13667
  alignItems: "center",
13624
13668
  columnGap: "14px",
13625
13669
  padding: "16px 10px 14px",
13626
- background: Se || "transparent",
13670
+ background: xe || "transparent",
13627
13671
  flexShrink: 0,
13628
13672
  position: "relative",
13629
13673
  zIndex: 30
@@ -13636,7 +13680,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
13636
13680
  alignItems: "center"
13637
13681
  },
13638
13682
  children: /* @__PURE__ */ g("button", {
13639
- onClick: ye,
13683
+ onClick: ve,
13640
13684
  style: {
13641
13685
  width: "40px",
13642
13686
  height: "40px",
@@ -13693,7 +13737,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
13693
13737
  justifyContent: "center",
13694
13738
  height: "40px"
13695
13739
  },
13696
- children: i ? /* @__PURE__ */ g(yg, {
13740
+ children: i ? /* @__PURE__ */ g(Cg, {
13697
13741
  logo: i,
13698
13742
  style: {
13699
13743
  height: "34px",
@@ -13706,7 +13750,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
13706
13750
  height: "40px",
13707
13751
  flexShrink: 0
13708
13752
  },
13709
- children: /* @__PURE__ */ g(bg, { title: e.chatTitle })
13753
+ children: /* @__PURE__ */ g(wg, { title: e.chatTitle })
13710
13754
  })
13711
13755
  }), o && /* @__PURE__ */ g("div", {
13712
13756
  style: {
@@ -13803,10 +13847,10 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
13803
13847
  animation: "fe-orb-fade-in 0.18s ease"
13804
13848
  },
13805
13849
  children: [
13806
- xe && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _("button", {
13850
+ be && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _("button", {
13807
13851
  type: "button",
13808
13852
  onClick: () => {
13809
- Ae(!1), be?.();
13853
+ Ae(!1), ye?.();
13810
13854
  },
13811
13855
  style: {
13812
13856
  display: "flex",
@@ -13848,7 +13892,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
13848
13892
  /* @__PURE__ */ _("button", {
13849
13893
  type: "button",
13850
13894
  onClick: () => {
13851
- Ae(!1), N?.();
13895
+ Ae(!1), Se?.();
13852
13896
  },
13853
13897
  style: {
13854
13898
  display: "flex",
@@ -13931,7 +13975,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
13931
13975
  /* @__PURE__ */ _("button", {
13932
13976
  type: "button",
13933
13977
  onClick: () => {
13934
- Ae(!1), ye?.();
13978
+ Ae(!1), ve?.();
13935
13979
  },
13936
13980
  style: {
13937
13981
  display: "flex",
@@ -13989,24 +14033,24 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
13989
14033
  })
13990
14034
  ]
13991
14035
  }),
13992
- /* @__PURE__ */ g(sh, {
13993
- webRTCError: ce,
13994
- micError: le,
13995
- setMicError: ue,
13996
- dismissCallError: de,
14036
+ /* @__PURE__ */ g(dh, {
14037
+ webRTCError: se,
14038
+ micError: ce,
14039
+ setMicError: le,
14040
+ dismissCallError: ue,
13997
14041
  isRateLimited: E,
13998
14042
  rateLimitMessage: D
13999
14043
  }),
14000
- _e && /* @__PURE__ */ g(wh, {
14044
+ ge && /* @__PURE__ */ g(Oh, {
14001
14045
  agentName: v,
14002
14046
  agentHeadshot: y,
14003
14047
  fallbackAgentName: b,
14004
- callDurationSeconds: ge,
14005
- isCallMuted: pe,
14006
- formatCallDuration: M,
14007
- toggleCallMute: me,
14008
- endWebRTCCall: he,
14009
- onExpand: ve,
14048
+ callDurationSeconds: N,
14049
+ isCallMuted: fe,
14050
+ formatCallDuration: he,
14051
+ toggleCallMute: pe,
14052
+ endWebRTCCall: me,
14053
+ onExpand: _e,
14010
14054
  primaryColor: n
14011
14055
  }),
14012
14056
  /* @__PURE__ */ _("div", {
@@ -14071,7 +14115,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14071
14115
  overflowY: "auto",
14072
14116
  position: "relative"
14073
14117
  },
14074
- children: Pe ? /* @__PURE__ */ g("div", {
14118
+ children: L ? /* @__PURE__ */ g("div", {
14075
14119
  style: {
14076
14120
  padding: "40px 20px",
14077
14121
  textAlign: "center",
@@ -14131,17 +14175,17 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14131
14175
  children: "No previous chats found."
14132
14176
  })
14133
14177
  })]
14134
- }) : null, De ? /* @__PURE__ */ g(ih, {
14178
+ }) : null, De ? /* @__PURE__ */ g(ch, {
14135
14179
  chatHistory: l,
14136
14180
  isAiTyping: u,
14137
14181
  isLoading: T,
14138
14182
  isAgentTyping: d,
14139
- setReplyContext: se,
14140
- TypingDots: Dg,
14183
+ setReplyContext: oe,
14184
+ TypingDots: jg,
14141
14185
  primaryColor: n,
14142
14186
  agentHeadshot: y,
14143
14187
  agentDisplayName: v || b,
14144
- botAvatarNode: /* @__PURE__ */ g(Eg, { orbColors: t })
14188
+ botAvatarNode: /* @__PURE__ */ g(Ag, { orbColors: t })
14145
14189
  }) : F ? /* @__PURE__ */ _("div", {
14146
14190
  style: {
14147
14191
  flex: 1,
@@ -14182,7 +14226,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14182
14226
  padding: "28px 24px"
14183
14227
  },
14184
14228
  children: [
14185
- /* @__PURE__ */ g(Sg, {
14229
+ /* @__PURE__ */ g(Eg, {
14186
14230
  size: 94,
14187
14231
  orbColors: t
14188
14232
  }),
@@ -14232,7 +14276,7 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14232
14276
  ]
14233
14277
  })]
14234
14278
  }),
14235
- ae && /* @__PURE__ */ _("div", {
14279
+ M && /* @__PURE__ */ _("div", {
14236
14280
  style: {
14237
14281
  margin: "0 16px 8px",
14238
14282
  padding: "9px 14px",
@@ -14273,18 +14317,18 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14273
14317
  zIndex: 1,
14274
14318
  padding: ne ? "6px 0 0" : "12px 0 0"
14275
14319
  },
14276
- children: /* @__PURE__ */ g(oh, {
14320
+ children: /* @__PURE__ */ g(uh, {
14277
14321
  input: x,
14278
14322
  setInput: S,
14279
14323
  onSubmit: C,
14280
14324
  isConversationEnded: w,
14281
14325
  callUiActive: I,
14282
- handleToggleVoice: be,
14326
+ handleToggleVoice: ye,
14283
14327
  showVoiceToggle: f === "agent",
14284
14328
  activeScreen: f,
14285
14329
  inputDisabled: Oe,
14286
- replyContext: oe,
14287
- clearReplyContext: () => se(null),
14330
+ replyContext: ae,
14331
+ clearReplyContext: () => oe(null),
14288
14332
  onFileSelect: k,
14289
14333
  selectedFile: O,
14290
14334
  onRemoveSelectedFile: A,
@@ -14347,29 +14391,29 @@ function Og({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14347
14391
  ]
14348
14392
  });
14349
14393
  }
14350
- function kg() {
14351
- 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: E, callConnectedAt: D, isCallMuted: O, webRTCError: k, language: A, chatId: ee, historyRef: te, onMessageSync: ne, sendMessage: j, uploadChatFile: re, openWidget: ie, captureVisitorEmail: ae, setVoiceMode: oe, endConversation: se, startNewChat: ue, acceptCall: de, rejectCall: fe, endWebRTCCall: pe, toggleCallMute: me, dismissCallError: he, startTyping: M, stopTyping: ge, updateTypingDraft: _e, getVisitorChatHistory: ve, resumeChat: ye, isSessionRestoring: be, openToChatCounter: xe, voiceEndCounter: Se } = Cn();
14394
+ function Ng() {
14395
+ 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: E, callConnectedAt: D, isCallMuted: O, webRTCError: k, language: A, chatId: ee, historyRef: te, onMessageSync: ne, sendMessage: j, uploadChatFile: re, openWidget: ie, captureVisitorEmail: M, setVoiceMode: ae, endConversation: oe, startNewChat: le, acceptCall: ue, rejectCall: de, endWebRTCCall: fe, toggleCallMute: pe, dismissCallError: me, startTyping: he, stopTyping: N, updateTypingDraft: ge, getVisitorChatHistory: _e, resumeChat: ve, isSessionRestoring: ye, openToChatCounter: be, voiceEndCounter: xe } = Cn();
14352
14396
  c(() => {
14353
14397
  try {
14354
14398
  or();
14355
14399
  } catch {}
14356
14400
  }, []), c(() => {
14357
- xe && V !== "voice_mode" && V !== "text_chat" && V !== "call_screen" && (oe?.(!1), H("text_chat"));
14358
- }, [xe]);
14359
- let N = t?.widgetSettings || {}, Ce = n?.widgetSettings || {}, P = {
14360
- ...N.branding || {},
14401
+ be && V !== "voice_mode" && V !== "text_chat" && V !== "call_screen" && (ae?.(!1), H("text_chat"));
14402
+ }, [be]);
14403
+ let Se = t?.widgetSettings || {}, Ce = n?.widgetSettings || {}, P = {
14404
+ ...Se.branding || {},
14361
14405
  ...Ce.branding || {}
14362
14406
  }, F = {
14363
- ...N.theme || {},
14407
+ ...Se.theme || {},
14364
14408
  ...Ce.theme || {}
14365
14409
  }, Ee = {
14366
- ...N.features || {},
14410
+ ...Se.features || {},
14367
14411
  ...Ce.features || {}
14368
14412
  }, Oe = Ee.voice !== !1, I = Array.isArray(F.orbColors) && F.orbColors.length > 0 ? F.orbColors : null, Ae = F.buttonColor || F.primaryColor || I?.[0] || "#3B82F6", je = {
14369
14413
  small: 50,
14370
14414
  medium: 64,
14371
14415
  large: 80
14372
- }, Me = je[F.orbSize] || je.small, Ne = F.position || "bottom-right", L = P.fallbackAgentName || "Agent", Pe = gg(I ?? F.chatBgColors), Fe = P.logo || P.logoUrl || null, Ie = A || "en", Le = N.recommendations?.[Ie] || [], R = (Ce.recommendations?.[Ie] ?? Le).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
14416
+ }, Me = je[F.orbSize] || je.small, Ne = F.position || "bottom-right", Pe = P.fallbackAgentName || "Agent", L = bg(I ?? F.chatBgColors), Fe = P.logo || P.logoUrl || null, Ie = A || "en", Le = Se.recommendations?.[Ie] || [], R = (Ce.recommendations?.[Ie] ?? Le).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
14373
14417
  id: e.key || `qr-${t}`,
14374
14418
  label: e.label,
14375
14419
  message: e.label,
@@ -14386,11 +14430,11 @@ function kg() {
14386
14430
  }, []);
14387
14431
  let Ke = (() => {
14388
14432
  let e = {
14389
- ...N.pageVisibility || {},
14433
+ ...Se.pageVisibility || {},
14390
14434
  ...Ce.pageVisibility || {}
14391
14435
  };
14392
14436
  return Array.isArray(e.allowedPaths) ? e.allowedPaths.filter(Boolean) : [];
14393
- })(), qe = Ke.length === 0 || Ke.some((e) => e === "*" || e === "/*" ? !0 : e.endsWith("/*") ? We.startsWith(e.slice(0, -1)) : We.replace(/\/$/, "") === e.replace(/\/$/, "")), Je = N.greetings?.[A] || Ce.greetings?.[A] || P.introGreeting || "Hello, I'm here to help you know more about OpenSense Labs.", Ye = {
14437
+ })(), qe = Ke.length === 0 || Ke.some((e) => e === "*" || e === "/*" ? !0 : e.endsWith("/*") ? We.startsWith(e.slice(0, -1)) : We.replace(/\/$/, "") === e.replace(/\/$/, "")), Je = Se.greetings?.[A] || Ce.greetings?.[A] || P.introGreeting || "Hello, I'm here to help you know more about OpenSense Labs.", Ye = {
14394
14438
  entryPrompt: P.entryPrompt || "Do you want to explore in a new way?",
14395
14439
  yesLabel: P.yesLabel || "Yes",
14396
14440
  laterLabel: P.laterLabel || "Later",
@@ -14414,7 +14458,7 @@ function kg() {
14414
14458
  ]), Qe = u && String(u).trim() || t?.ownerProfileImageUrl && String(t.ownerProfileImageUrl).trim() || null, $e = r.some((e) => e.sender === "user"), et = f(() => {
14415
14459
  let e = r.findIndex((e) => e.sender === "user");
14416
14460
  return e === -1 ? !1 : r.slice(e + 1).some((e) => e.sender === "bot" || e.sender === "ai" || e.sender === "agent");
14417
- }, [r]), tt = !!(Ce._dashboardLivePreview || N._dashboardLivePreview), [V, H] = m(() => tt ? "text_chat" : "entry_prompt"), [nt, rt] = m(""), [it, U] = m(null), [at, ot] = m(h || ""), [W, st] = m(""), [ct, lt] = m(!1), [ut, dt] = m(0), [ft, pt] = m(null), [mt, ht] = m(null), [gt, _t] = m(""), [vt, yt] = m(!1), [bt, xt] = m(!1), [St, Ct] = m(!1), wt = p(null), Tt = p(!1), Et = !h && $e && et && V !== "voice_mode";
14461
+ }, [r]), tt = !!(Ce._dashboardLivePreview || Se._dashboardLivePreview), [V, H] = m(() => tt ? "text_chat" : "entry_prompt"), [nt, rt] = m(""), [it, U] = m(null), [at, ot] = m(h || ""), [W, st] = m(""), [ct, lt] = m(!1), [ut, dt] = m(0), [ft, pt] = m(null), [mt, ht] = m(null), [gt, _t] = m(""), [vt, yt] = m(!1), [bt, xt] = m(!1), [St, Ct] = m(!1), wt = p(null), Tt = p(!1), Et = !h && $e && et && V !== "voice_mode";
14418
14462
  d(() => {
14419
14463
  if (e !== "ready" || Tt.current) return;
14420
14464
  if (Tt.current = !0, !Oe) {
@@ -14427,7 +14471,7 @@ function kg() {
14427
14471
  } catch {}
14428
14472
  let n = De(), r = z ? we(z) : null, i = n || !!r?.transcript;
14429
14473
  if (t) {
14430
- ie?.({ notifyChatInitiated: !0 }), oe?.(!0), H("voice_mode");
14474
+ ie?.({ notifyChatInitiated: !0 }), ae?.(!0), H("voice_mode");
14431
14475
  return;
14432
14476
  }
14433
14477
  if (ke()) {
@@ -14439,13 +14483,13 @@ function kg() {
14439
14483
  H("minimized_orb");
14440
14484
  return;
14441
14485
  }
14442
- ie?.({ notifyChatInitiated: !0 }), oe?.(!0), H("voice_mode");
14486
+ ie?.({ notifyChatInitiated: !0 }), ae?.(!0), H("voice_mode");
14443
14487
  return;
14444
14488
  }
14445
14489
  if (z) try {
14446
14490
  Te(z);
14447
14491
  } catch {}
14448
- if (ce(z)) {
14492
+ if (se(z)) {
14449
14493
  H("minimized_orb");
14450
14494
  return;
14451
14495
  }
@@ -14460,7 +14504,7 @@ function kg() {
14460
14504
  let Ot = o(() => {
14461
14505
  ht(null), _t("");
14462
14506
  }, []), kt = o((e) => {
14463
- let t = $m(e);
14507
+ let t = rh(e);
14464
14508
  if (t) {
14465
14509
  ht(null), _t(t);
14466
14510
  return;
@@ -14503,7 +14547,7 @@ function kg() {
14503
14547
  hasIncomingCall: !!w?.callId,
14504
14548
  activeCallId: T,
14505
14549
  callConnectionState: E
14506
- }), wt.current = e, V === "voice_mode" && oe?.(!1), ie?.(), At());
14550
+ }), wt.current = e, V === "voice_mode" && ae?.(!1), ie?.(), At());
14507
14551
  }
14508
14552
  }, [
14509
14553
  T,
@@ -14512,7 +14556,7 @@ function kg() {
14512
14556
  w?.callId,
14513
14557
  i,
14514
14558
  ie,
14515
- oe,
14559
+ ae,
14516
14560
  V
14517
14561
  ]), c(() => {
14518
14562
  !w && !T && V === "call_screen" && H("text_chat");
@@ -14524,16 +14568,16 @@ function kg() {
14524
14568
  !T && bt && xt(!1);
14525
14569
  }, [T, bt]), c(() => {
14526
14570
  if (!s || C) {
14527
- _e?.(""), ge?.();
14571
+ ge?.(""), N?.();
14528
14572
  return;
14529
14573
  }
14530
14574
  if (!nt.trim() || mt) {
14531
- _e?.("");
14532
- let e = window.setTimeout(() => ge?.(), 100);
14575
+ ge?.("");
14576
+ let e = window.setTimeout(() => N?.(), 100);
14533
14577
  return () => window.clearTimeout(e);
14534
14578
  }
14535
- M?.();
14536
- let e = window.setTimeout(() => _e?.(nt), 120), t = window.setTimeout(() => ge?.(), 1200);
14579
+ he?.();
14580
+ let e = window.setTimeout(() => ge?.(nt), 120), t = window.setTimeout(() => N?.(), 1200);
14537
14581
  return () => {
14538
14582
  window.clearTimeout(e), window.clearTimeout(t);
14539
14583
  };
@@ -14542,9 +14586,9 @@ function kg() {
14542
14586
  mt,
14543
14587
  s,
14544
14588
  C,
14545
- M,
14546
- ge,
14547
- _e
14589
+ he,
14590
+ N,
14591
+ ge
14548
14592
  ]);
14549
14593
  let Mt = (e) => e ? {
14550
14594
  replyTo: e.messageId || e.id || null,
@@ -14558,7 +14602,7 @@ function kg() {
14558
14602
  st("Please enter a valid email so we can continue helping you.");
14559
14603
  return;
14560
14604
  }
14561
- await ae(e), st(""), lt(!0), setTimeout(() => lt(!1), 3e3);
14605
+ await M(e), st(""), lt(!0), setTimeout(() => lt(!1), 3e3);
14562
14606
  return;
14563
14607
  }
14564
14608
  let t = Mt(it);
@@ -14566,7 +14610,7 @@ function kg() {
14566
14610
  if (mt) {
14567
14611
  try {
14568
14612
  yt(!0), _t("");
14569
- let e = await re(mt), n = e?.data || e, r = nt.trim() || `Shared file: ${th(mt)}`;
14613
+ let e = await re(mt), n = e?.data || e, r = nt.trim() || `Shared file: ${ah(mt)}`;
14570
14614
  rt(""), U(null), Ot(), await j(r, "", t, {
14571
14615
  type: "file",
14572
14616
  metadata: {
@@ -14586,8 +14630,8 @@ function kg() {
14586
14630
  let n = nt.trim();
14587
14631
  rt(""), U(null), await j(n, "", t);
14588
14632
  }, Pt = o(() => {
14589
- r.length !== 0 && ue?.();
14590
- }, [r.length, ue]), Ft = (e) => {
14633
+ r.length !== 0 && le?.();
14634
+ }, [r.length, le]), Ft = (e) => {
14591
14635
  let t = Math.floor(e / 60);
14592
14636
  return `${String(t).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`;
14593
14637
  }, It = o(async (e) => {
@@ -14643,11 +14687,11 @@ function kg() {
14643
14687
  t.resume().catch(() => {}), setTimeout(() => t.close().catch(() => {}), 3e3);
14644
14688
  }
14645
14689
  } catch {}
14646
- ie({ notifyChatInitiated: !0 }), oe?.(!0), H("voice_mode");
14690
+ ie({ notifyChatInitiated: !0 }), ae?.(!0), H("voice_mode");
14647
14691
  }, Vt = () => {
14648
- ie({ notifyChatInitiated: !0 }), oe?.(!1), H("text_chat");
14692
+ ie({ notifyChatInitiated: !0 }), ae?.(!1), H("text_chat");
14649
14693
  }, Ht = () => {
14650
- oe?.(!1), Rt();
14694
+ ae?.(!1), Rt();
14651
14695
  };
14652
14696
  return e !== "ready" || !Ue || Ee.chat === !1 || !qe ? null : /* @__PURE__ */ _("div", {
14653
14697
  className: "flowengage-widget-root",
@@ -14659,15 +14703,15 @@ function kg() {
14659
14703
  onWheel: (e) => e.stopPropagation(),
14660
14704
  onTouchMove: (e) => e.stopPropagation(),
14661
14705
  children: [
14662
- V === "entry_prompt" && /* @__PURE__ */ g(Cg, {
14706
+ V === "entry_prompt" && /* @__PURE__ */ g(Dg, {
14663
14707
  copy: Ye,
14664
14708
  orbColors: I,
14665
14709
  primaryColor: Ae,
14666
14710
  onYes: () => {
14667
- le(z), Bt();
14711
+ ce(z), Bt();
14668
14712
  },
14669
14713
  onLater: () => {
14670
- le(z), Rt();
14714
+ ce(z), Rt();
14671
14715
  },
14672
14716
  isMobile: G,
14673
14717
  isClosing: St
@@ -14742,13 +14786,13 @@ function kg() {
14742
14786
  children: E === "connected" ? `${Ft(ut)} with ${Ze}` : `Tap to return to ${Ze}`
14743
14787
  })]
14744
14788
  })]
14745
- }), /* @__PURE__ */ g(Sg, {
14789
+ }), /* @__PURE__ */ g(Eg, {
14746
14790
  size: Me,
14747
14791
  orbColors: I,
14748
14792
  onClick: T ? At : Oe ? zt : Vt
14749
14793
  })]
14750
14794
  }),
14751
- V === "connection_modal" && /* @__PURE__ */ g(wg, {
14795
+ V === "connection_modal" && /* @__PURE__ */ g(Og, {
14752
14796
  copy: Ye,
14753
14797
  orbColors: I,
14754
14798
  primaryColor: Ae,
@@ -14758,7 +14802,7 @@ function kg() {
14758
14802
  isMobile: G,
14759
14803
  isClosing: St
14760
14804
  }),
14761
- V === "voice_mode" && /* @__PURE__ */ g(Tg, {
14805
+ V === "voice_mode" && /* @__PURE__ */ g(kg, {
14762
14806
  orbColors: I,
14763
14807
  onEnterChat: Vt,
14764
14808
  onEndChat: Ht,
@@ -14768,17 +14812,17 @@ function kg() {
14768
14812
  chatId: ee,
14769
14813
  historyRef: te,
14770
14814
  onMessageSync: ne,
14771
- voiceEndCounter: Se,
14815
+ voiceEndCounter: xe,
14772
14816
  websiteName: t?.websiteName,
14773
- voiceFirstMessage: N.voiceFirstMessage || null,
14774
- captureVisitorEmail: ae,
14817
+ voiceFirstMessage: Se.voiceFirstMessage || null,
14818
+ captureVisitorEmail: M,
14775
14819
  emailRequired: !h,
14776
14820
  emailCaptureEnabled: P.disableEmailCapture !== !0,
14777
14821
  listeningLabel: P.voiceListeningLabel || "Listening...",
14778
14822
  enterChatModeLabel: P.voiceEnterChatLabel || "Enter Chat Mode",
14779
14823
  endConversationLabel: P.voiceEndConversationLabel || "End Conversation"
14780
14824
  }, "voice"),
14781
- V === "call_screen" && /* @__PURE__ */ g(Ch, {
14825
+ V === "call_screen" && /* @__PURE__ */ g(Dh, {
14782
14826
  incomingCall: w,
14783
14827
  activeCallId: T,
14784
14828
  callConnectionState: E,
@@ -14786,23 +14830,23 @@ function kg() {
14786
14830
  isCallMuted: O,
14787
14831
  agentName: Ze,
14788
14832
  agentHeadshot: Qe,
14789
- fallbackAgentName: L,
14790
- acceptCall: de,
14791
- rejectCall: fe,
14792
- endWebRTCCall: pe,
14793
- toggleCallMute: me,
14833
+ fallbackAgentName: Pe,
14834
+ acceptCall: ue,
14835
+ rejectCall: de,
14836
+ endWebRTCCall: fe,
14837
+ toggleCallMute: pe,
14794
14838
  formatCallDuration: Ft,
14795
14839
  onMinimize: jt,
14796
14840
  primaryColor: Ae,
14797
14841
  orbColors: I,
14798
14842
  chatHistory: r
14799
14843
  }),
14800
- V === "text_chat" && /* @__PURE__ */ g(Og, {
14844
+ V === "text_chat" && /* @__PURE__ */ g(Mg, {
14801
14845
  isClosing: St,
14802
14846
  copy: Ye,
14803
14847
  orbColors: I,
14804
14848
  primaryColor: Ae,
14805
- chatBgGradient: Pe,
14849
+ chatBgGradient: L,
14806
14850
  logo: Fe,
14807
14851
  quickChatOptions: Re,
14808
14852
  onQuickChatSelect: It,
@@ -14813,7 +14857,7 @@ function kg() {
14813
14857
  activeScreen: a,
14814
14858
  agentName: Ze,
14815
14859
  agentHeadshot: Qe,
14816
- fallbackAgentName: L,
14860
+ fallbackAgentName: Pe,
14817
14861
  input: nt,
14818
14862
  setInput: rt,
14819
14863
  onSubmit: Nt,
@@ -14836,11 +14880,11 @@ function kg() {
14836
14880
  webRTCError: k,
14837
14881
  micError: ft,
14838
14882
  setMicError: pt,
14839
- dismissCallError: he,
14883
+ dismissCallError: me,
14840
14884
  activeCallId: T,
14841
14885
  isCallMuted: O,
14842
- toggleCallMute: me,
14843
- endWebRTCCall: pe,
14886
+ toggleCallMute: pe,
14887
+ endWebRTCCall: fe,
14844
14888
  formatCallDuration: Ft,
14845
14889
  callDurationSeconds: ut,
14846
14890
  onCollapse: Rt,
@@ -14853,9 +14897,9 @@ function kg() {
14853
14897
  showPoweredBy: ze,
14854
14898
  privacyPolicyUrl: He,
14855
14899
  headerBgColor: Be,
14856
- getVisitorChatHistory: ve,
14857
- resumeChat: ye,
14858
- isSessionRestoring: be
14900
+ getVisitorChatHistory: _e,
14901
+ resumeChat: ve,
14902
+ isSessionRestoring: ye
14859
14903
  }),
14860
14904
  /* @__PURE__ */ g("style", { children: "\n /* Force any SVG (or img) inside LogoSlot to fill the container height\n regardless of whether the component forwards its style prop. */\n .fe-logo-slot svg,\n .fe-logo-slot img { height: 100%; width: auto; display: block; }\n\n @keyframes fe-orb-breathe { 0%,100%{transform:scale(1)} 50%{transform:scale(1.04)} }\n @keyframes fe-orb-breathe-subtle { 0%,100%{transform:scale(1)} 50%{transform:scale(1.025)} }\n @keyframes fe-orb-pulse { 0%{transform:scale(1);opacity:.65} 50%{transform:scale(1.28);opacity:.1} 100%{transform:scale(1);opacity:.65} }\n @keyframes fe-orb-glow { from{opacity:.35} to{opacity:.75} }\n @keyframes fe-orb-fade-in { from{opacity:0} to{opacity:1} }\n @keyframes fe-orb-slide-up { from{opacity:0;transform:translateY(18px)} to{opacity:1;transform:translateY(0)} }\n @keyframes fe-orb-slide-down { from{opacity:1;transform:translateY(0)} to{opacity:0;transform:translateY(24px)} }\n @keyframes fe-orb-bar-0 { from{height:6px} to{height:18px} }\n @keyframes fe-orb-bar-1 { from{height:10px} to{height:22px} }\n @keyframes fe-orb-bar-2 { from{height:14px} to{height:26px} }\n @keyframes fe-orb-bar-3 { from{height:8px} to{height:20px} }\n @keyframes fe-orb-bar-4 { from{height:6px} to{height:16px} }\n @keyframes fe-dot-bounce { 0%,80%,100%{transform:translateY(0);opacity:.5} 40%{transform:translateY(-5px);opacity:1} }\n " })
14861
14905
  ]
@@ -14863,7 +14907,7 @@ function kg() {
14863
14907
  }
14864
14908
  //#endregion
14865
14909
  //#region src/components/ErrorBoundary.jsx
14866
- var Ag = class extends e.Component {
14910
+ var Pg = class extends e.Component {
14867
14911
  constructor(e) {
14868
14912
  super(e), this.state = { hasError: !1 };
14869
14913
  }
@@ -14878,4 +14922,4 @@ var Ag = class extends e.Component {
14878
14922
  }
14879
14923
  };
14880
14924
  //#endregion
14881
- export { gh as AnimatedOrb, Ag as ErrorBoundary, Mr as FlowEngageProvider, kg as FlowEngageWidget, Cn as useFlowEngage };
14925
+ export { bh as AnimatedOrb, Pg as ErrorBoundary, Mr as FlowEngageProvider, Ng as FlowEngageWidget, Cn as useFlowEngage };