@flowengage/react-chatbot 8.0.108 → 8.0.110

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.
@@ -55,25 +55,25 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
55
55
  let t = N(e);
56
56
  t && window.localStorage.setItem(t, "1");
57
57
  } catch {}
58
- }, ce = (e) => e ? `flowengage.persistedChatId.${e}` : null, le = (e) => {
58
+ }, P = (e) => e ? `flowengage.persistedChatId.${e}` : null, ce = (e) => {
59
59
  if (!j || !e) return null;
60
60
  try {
61
- let t = ce(e), n = t ? window.localStorage.getItem(t) : null;
61
+ let t = P(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
- }, ue = (e) => {
66
+ }, le = (e) => {
67
67
  if (!(!j || !e)) try {
68
- let t = ce(e);
68
+ let t = P(e);
69
69
  t && window.localStorage.removeItem(t);
70
70
  } catch {}
71
- }, de = (e, t) => {
71
+ }, ue = (e, t) => {
72
72
  if (!(!j || !e || !t)) try {
73
- let n = ce(e);
73
+ let n = P(e);
74
74
  n && window.localStorage.setItem(n, String(t).trim());
75
75
  } catch {}
76
- }, fe = () => j ? {
76
+ }, de = () => 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
- }, pe = (e) => {
90
+ }, fe = (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
- }, me = (e) => {
101
+ }, pe = (e) => {
102
102
  if (!j || !e) return "";
103
103
  let t = M(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
- }, he = (e, t) => {
109
+ }, me = (e, t) => {
110
110
  if (!j) return;
111
111
  let n = M(t);
112
112
  if (!n) return;
@@ -116,91 +116,91 @@ 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
- }, ge = (e) => e ? `flowengage.visitorId.${e}` : null, P = () => `v_${Date.now().toString(36)}_${typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID().replace(/-/g, "").slice(0, 16) : Math.random().toString(36).slice(2, 18)}`, _e = (e) => {
119
+ }, he = (e) => e ? `flowengage.visitorId.${e}` : null, ge = () => `v_${Date.now().toString(36)}_${typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID().replace(/-/g, "").slice(0, 16) : Math.random().toString(36).slice(2, 18)}`, F = (e) => {
120
120
  if (!j || !e) return null;
121
121
  try {
122
- let t = ge(e), n = t ? window.localStorage.getItem(t) : null;
122
+ let t = he(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
- }, ve = (e) => {
127
+ }, _e = (e) => {
128
128
  if (!j || !e) return null;
129
129
  try {
130
- let t = _e(e);
130
+ let t = F(e);
131
131
  if (t) return t;
132
- let n = P(), r = ge(e);
132
+ let n = ge(), r = he(e);
133
133
  return r && window.localStorage.setItem(r, n), n;
134
134
  } catch {
135
- return P();
135
+ return ge();
136
136
  }
137
- }, ye = "flowengage.tabId", be = () => {
137
+ }, ve = "flowengage.tabId", ye = () => {
138
138
  if (!j) return "default";
139
139
  try {
140
- let e = window.sessionStorage.getItem(ye);
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(ye, e)), e;
140
+ let e = window.sessionStorage.getItem(ve);
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(ve, e)), e;
142
142
  } catch {
143
143
  return "default";
144
144
  }
145
- }, F = (e) => e ? `flowengage.voice.transcript.${e}.${be()}` : null, xe = 600 * 1e3, I = (e, t, n = {}) => {
145
+ }, I = (e) => e ? `flowengage.voice.transcript.${e}.${ye()}` : null, be = 600 * 1e3, L = (e, t, n = {}) => {
146
146
  if (!j || !e) return;
147
147
  let r = typeof t == "string" ? t.trim() : "";
148
148
  if (!r) return;
149
- let i = Number.isFinite(n.ttlMs) ? n.ttlMs : xe, a = {
149
+ let i = Number.isFinite(n.ttlMs) ? n.ttlMs : be, a = {
150
150
  transcript: r,
151
151
  expiresAt: Date.now() + i
152
152
  };
153
153
  try {
154
- let t = F(e);
154
+ let t = I(e);
155
155
  t && window.localStorage.setItem(t, JSON.stringify(a));
156
156
  } catch {}
157
- }, Se = (e) => {
157
+ }, xe = (e) => {
158
158
  if (!j || !e) return null;
159
159
  try {
160
- let t = F(e), n = t ? window.localStorage.getItem(t) : null;
160
+ let t = I(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;
164
164
  } catch {
165
165
  return null;
166
166
  }
167
- }, Ce = (e) => {
167
+ }, Se = (e) => {
168
168
  if (!(!j || !e)) try {
169
- let t = F(e);
169
+ let t = I(e);
170
170
  t && window.localStorage.removeItem(t);
171
171
  } catch {}
172
- }, L = "flowengage.voice.pendingResume", we = () => {
172
+ }, R = "flowengage.voice.pendingResume", Ce = () => {
173
173
  if (j) try {
174
- window.sessionStorage.setItem(L, "1");
174
+ window.sessionStorage.setItem(R, "1");
175
175
  } catch {}
176
- }, Te = () => {
176
+ }, we = () => {
177
177
  if (!j) return !1;
178
178
  try {
179
- return window.sessionStorage.getItem(L) === "1" ? (window.sessionStorage.removeItem(L), !0) : !1;
179
+ return window.sessionStorage.getItem(R) === "1" ? (window.sessionStorage.removeItem(R), !0) : !1;
180
180
  } catch {
181
181
  return !1;
182
182
  }
183
- }, Ee = "flowengage.chat.pendingReopen", De = () => {
183
+ }, Te = "flowengage.chat.pendingReopen", Ee = () => {
184
184
  if (j) try {
185
- window.sessionStorage.setItem(Ee, "1");
185
+ window.sessionStorage.setItem(Te, "1");
186
186
  } catch {}
187
- }, Oe = () => {
187
+ }, De = () => {
188
188
  if (!j) return !1;
189
189
  try {
190
- return window.sessionStorage.getItem(Ee) === "1" ? (window.sessionStorage.removeItem(Ee), !0) : !1;
190
+ return window.sessionStorage.getItem(Te) === "1" ? (window.sessionStorage.removeItem(Te), !0) : !1;
191
191
  } catch {
192
192
  return !1;
193
193
  }
194
- }, ke = () => {
194
+ }, Oe = () => {
195
195
  if (!j) return !1;
196
196
  try {
197
- return window.sessionStorage.getItem(L) === "1";
197
+ return window.sessionStorage.getItem(R) === "1";
198
198
  } catch {
199
199
  return !1;
200
200
  }
201
- }, Ae = (e) => e ? `flowengage.voice.navState.${e}.${be()}` : null, je = (e, t, n, r) => {
201
+ }, ke = (e) => e ? `flowengage.voice.navState.${e}.${ye()}` : null, Ae = (e, t, n, r) => {
202
202
  if (!(!j || !e || !t)) try {
203
- let i = Ae(e);
203
+ let i = ke(e);
204
204
  i && window.sessionStorage.setItem(i, JSON.stringify({
205
205
  previousPage: String(t),
206
206
  targetPath: n ? new URL(String(n), window.location.href).pathname : null,
@@ -208,10 +208,10 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
208
208
  ts: Date.now()
209
209
  }));
210
210
  } catch {}
211
- }, Me = (e) => {
211
+ }, je = (e) => {
212
212
  if (!j || !e) return null;
213
213
  try {
214
- let t = Ae(e);
214
+ let t = ke(e);
215
215
  if (!t) return null;
216
216
  let n = window.sessionStorage.getItem(t);
217
217
  if (!n) return null;
@@ -224,7 +224,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
224
224
  } catch {
225
225
  return null;
226
226
  }
227
- }, R = async (e) => {
227
+ }, Me = 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}`);
@@ -243,7 +243,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
243
243
  }
244
244
  }, Ne = 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), R(await z(s, {
246
+ return r && String(r).trim() && (c.priorChatId = String(r).trim()), i && (c.forceNew = !0), a && (c.resumeChatId = a), o && (c.visitorId = o), Me(await z(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
  }, Pe = async ({ apiBaseUrl: e, siteId: t }) => {
258
258
  let n = typeof window < "u" ? window.location.origin : "http://localhost";
259
- return (await R(await z(`${e}/api/widget/chatbot-loader?${new URLSearchParams({
259
+ return (await Me(await z(`${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 = {}) => R(await z(`${e}${i}`, {
277
+ }, a = async (i, a = {}) => Me(await z(`${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 R(await z(`${e}${r}`, {
292
+ return Me(await z(`${e}${r}`, {
293
293
  ...a,
294
294
  body: i,
295
295
  headers: o
@@ -333,7 +333,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
333
333
  stream: !0
334
334
  })
335
335
  });
336
- if (!(p.headers.get("content-type") || "").includes("text/event-stream")) return R(p);
336
+ if (!(p.headers.get("content-type") || "").includes("text/event-stream")) return Me(p);
337
337
  let m = p.body.getReader(), h = new TextDecoder(), g = "", _ = null, v = (e) => {
338
338
  let t = e.split("\n").find((e) => e.startsWith("data: "));
339
339
  if (t) try {
@@ -449,7 +449,7 @@ var v = Object.defineProperty, y = Object.getOwnPropertyDescriptor, b = Object.g
449
449
  });
450
450
  },
451
451
  async getIceServersConfig() {
452
- return R(await z(`${e}/api/calls/ice-config`, {
452
+ return Me(await z(`${e}/api/calls/ice-config`, {
453
453
  method: "GET",
454
454
  headers: {
455
455
  "x-user-id": t,
@@ -2855,7 +2855,7 @@ async function wr(e, t = {}) {
2855
2855
  reason: "already-on-page"
2856
2856
  };
2857
2857
  let a = i.pathname + i.search + i.hash;
2858
- if (window.Shopify) return n && mr(n), r || De(), r ? Cr().then(() => window.location.assign(i.href)) : window.location.assign(i.href), { navigated: !0 };
2858
+ if (window.Shopify) return n && mr(n), r || Ee(), r ? Cr().then(() => window.location.assign(i.href)) : window.location.assign(i.href), { navigated: !0 };
2859
2859
  let o = window.next?.router;
2860
2860
  if (o?.push) return new Promise((e) => {
2861
2861
  let t = () => {
@@ -2874,11 +2874,11 @@ async function wr(e, t = {}) {
2874
2874
  try {
2875
2875
  window.history.pushState({}, "", e), window.dispatchEvent(new PopStateEvent("popstate", { state: {} }));
2876
2876
  } catch {}
2877
- return n && mr(n), r || De(), window.location.assign(i.href), { navigated: !0 };
2877
+ return n && mr(n), r || Ee(), window.location.assign(i.href), { navigated: !0 };
2878
2878
  }
2879
2879
  return { navigated: !0 };
2880
2880
  }
2881
- return n && mr(n), r || De(), window.location.assign(i.href), { navigated: !0 };
2881
+ return n && mr(n), r || Ee(), window.location.assign(i.href), { navigated: !0 };
2882
2882
  } catch (t) {
2883
2883
  console.warn("[FlowEngage] shadowNavigate error:", t), n && mr(n);
2884
2884
  try {
@@ -3296,7 +3296,7 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
3296
3296
  message: "Looks like you're already on this page!",
3297
3297
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
3298
3298
  }]);
3299
- }, []), [D, O] = m(fe().isOpen), [k, A] = m(fe().activeScreen), [j, M] = m(fe().isHumanHandled), [N, oe] = m(fe().agentName), [se, ce] = m(fe().agentHeadshot), [ge, P] = m(() => me(i?.siteId)), [_e, ye] = m(!1), [be, F] = m(!1), [xe, I] = m("idle"), [Se, Ce] = m(!1), [L, Te] = m(!1), [Ee, De] = m(""), [Oe, ke] = m(!1), [Ae, je] = m(0), [Me, R] = m(0), [z, B] = m(!1), [V, Ie] = m(null), [Le, Re] = m(null), [ze, Be] = m("idle"), [Ve, He] = m(null), [Ue, We] = m(!1), [Ge, Ke] = m(""), [qe, Je] = m(!1), H = p(null), U = p(null), Ye = p(""), Xe = p(!1), Ze = p(null), Qe = p(null), W = p(null), $e = p(null), et = p(null), tt = p(null), nt = p(null), G = p(!1), rt = p({
3299
+ }, []), [D, O] = m(de().isOpen), [k, A] = m(de().activeScreen), [j, M] = m(de().isHumanHandled), [N, oe] = m(de().agentName), [se, P] = m(de().agentHeadshot), [he, ge] = m(() => pe(i?.siteId)), [F, ve] = m(!1), [ye, I] = m(!1), [be, L] = m("idle"), [xe, Se] = m(!1), [R, we] = m(!1), [Te, Ee] = m(""), [De, Oe] = m(!1), [ke, Ae] = m(0), [je, Me] = m(0), [z, B] = m(!1), [V, Ie] = m(null), [Le, Re] = m(null), [ze, Be] = m("idle"), [Ve, He] = m(null), [Ue, We] = m(!1), [Ge, Ke] = m(""), [qe, Je] = m(!1), H = p(null), U = p(null), Ye = p(""), Xe = p(!1), Ze = p(null), Qe = p(null), W = p(null), $e = p(null), et = p(null), tt = p(null), nt = p(null), G = p(!1), rt = p({
3300
3300
  url: null,
3301
3301
  at: 0
3302
3302
  }), it = o((e, t) => {
@@ -3318,7 +3318,7 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
3318
3318
  cleanup: () => {}
3319
3319
  }), St = o((e = {}) => {
3320
3320
  let t = !!e.is_human_handled;
3321
- return M(t), t ? (A("agent"), e.agent_info?.name && oe(e.agent_info.name), e.agent_info?.headshot && ce(e.agent_info.headshot), t) : (A("ai"), t);
3321
+ return M(t), t ? (A("agent"), e.agent_info?.name && oe(e.agent_info.name), e.agent_info?.headshot && P(e.agent_info.headshot), t) : (A("ai"), t);
3322
3322
  }, []), Ct = f(() => {
3323
3323
  let e = _?.widgetSettings?.call?.maxDurationSeconds ?? i?.widgetSettings?.call?.maxDurationSeconds ?? i?.callMaxDurationSeconds, t = Number(e);
3324
3324
  return Number.isFinite(t) && t > 0 ? t : te;
@@ -3328,8 +3328,8 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
3328
3328
  }, [V]), c(() => {
3329
3329
  gt.current = N;
3330
3330
  }, [N]), c(() => {
3331
- yt.current = Oe;
3332
- }, [Oe]), c(() => {
3331
+ yt.current = De;
3332
+ }, [De]), c(() => {
3333
3333
  bt.current = i;
3334
3334
  }, [i]);
3335
3335
  let wt = () => {
@@ -3338,17 +3338,17 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
3338
3338
  ct.current &&= (window.clearTimeout(ct.current), null);
3339
3339
  }, []), Et = (e) => {
3340
3340
  let t = typeof e == "string" ? e.trim().toLowerCase() : "";
3341
- return P(t), he(t, i?.siteId), t;
3341
+ return ge(t), me(t, i?.siteId), t;
3342
3342
  };
3343
3343
  c(() => {
3344
3344
  let e = i?.siteId;
3345
3345
  if (!e) return;
3346
- let t = me(e);
3346
+ let t = pe(e);
3347
3347
  if (t) {
3348
- P(t);
3348
+ ge(t);
3349
3349
  return;
3350
3350
  }
3351
- P((t) => (t && he(t, e), t));
3351
+ ge((t) => (t && me(t, e), t));
3352
3352
  }, [i?.siteId]);
3353
3353
  let Dt = (e = "unspecified") => {
3354
3354
  let t = ot.current || tt.current?.callId, n = ht.current, r = ft.current;
@@ -3478,7 +3478,7 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
3478
3478
  });
3479
3479
  };
3480
3480
  c(() => {
3481
- pe({
3481
+ fe({
3482
3482
  isOpen: D,
3483
3483
  activeScreen: k,
3484
3484
  isHumanHandled: j,
@@ -3498,7 +3498,7 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
3498
3498
  try {
3499
3499
  let t = E(i), n = await Pe(t);
3500
3500
  if (!e) return;
3501
- let a = t.siteId, o = le(a), s = ve(a), c = "";
3501
+ let a = t.siteId, o = ce(a), s = _e(a), c = "";
3502
3502
  try {
3503
3503
  let e = Xe.current, r = Ze.current;
3504
3504
  if (Xe.current = !1, Ze.current = null, c = (await Ne({
@@ -3510,9 +3510,9 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
3510
3510
  resumeChatId: r,
3511
3511
  visitorId: s
3512
3512
  }))?.data?.chatId, !c) throw Error("resolve-session returned no chatId");
3513
- ie(), de(a, c);
3513
+ ie(), ue(a, c);
3514
3514
  } catch (e) {
3515
- console.warn("[FlowEngageProvider] resolve-session failed, reusing persisted or ephemeral chat id", e?.message || e), c = o || ae(), de(a, c);
3515
+ console.warn("[FlowEngageProvider] resolve-session failed, reusing persisted or ephemeral chat id", e?.message || e), c = o || ae(), ue(a, c);
3516
3516
  }
3517
3517
  Ye.current = c;
3518
3518
  let l = Fe({
@@ -3532,23 +3532,23 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
3532
3532
  siteId: t.siteId
3533
3533
  });
3534
3534
  H.current = f, f.on("connect", async () => {
3535
- I("connected");
3535
+ L("connected");
3536
3536
  let e = Ye.current;
3537
3537
  if (e && U.current) try {
3538
3538
  St(await U.current.checkHumanHandled(e));
3539
3539
  } catch {}
3540
3540
  }), f.on("disconnect", () => {
3541
- I("disconnected");
3541
+ L("disconnected");
3542
3542
  }), f.on("aiTyping", () => {
3543
- F(!0);
3543
+ I(!0);
3544
3544
  }), f.on("ai:typing", () => {
3545
- F(!0);
3545
+ I(!0);
3546
3546
  }), f.on("messageReceived", (e) => {
3547
3547
  let t = e.message || e, n = {
3548
3548
  ...t,
3549
3549
  message: oi(t.message)
3550
3550
  };
3551
- F(!1), ye(!1), !(n.type === "call_recording" || typeof n.message == "string" && n.message.includes("AI chat recording")) && S((e) => [...e.filter((e) => !e.isPending), {
3551
+ I(!1), ve(!1), !(n.type === "call_recording" || typeof n.message == "string" && n.message.includes("AI chat recording")) && S((e) => [...e.filter((e) => !e.isPending), {
3552
3552
  ...n,
3553
3553
  isPending: !1,
3554
3554
  id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
@@ -3566,7 +3566,7 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
3566
3566
  ...t,
3567
3567
  message: oi(t.message)
3568
3568
  };
3569
- F(!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, {
3569
+ I(!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, {
3570
3570
  ...n,
3571
3571
  isPending: !1,
3572
3572
  id: n.messageId || `${n.sender}-${Date.now()}-${Math.random()}`
@@ -3582,7 +3582,7 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
3582
3582
  n.agent_name,
3583
3583
  n.agentName,
3584
3584
  n.metadata?.agentName
3585
- ], d)), n.sender_headshot && ce(n.sender_headshot), O(!0), je((e) => e + 1)));
3585
+ ], d)), n.sender_headshot && P(n.sender_headshot), O(!0), Ae((e) => e + 1)));
3586
3586
  });
3587
3587
  let p = (e = {}) => {
3588
3588
  let t = di([
@@ -3591,7 +3591,7 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
3591
3591
  e.agent_name,
3592
3592
  gt.current
3593
3593
  ], d);
3594
- M(!0), A("agent"), oe(t), ce(e.agent?.headshot || null), O(!0), je((e) => e + 1), S((e) => fi(e, {
3594
+ M(!0), A("agent"), oe(t), P(e.agent?.headshot || null), O(!0), Ae((e) => e + 1), S((e) => fi(e, {
3595
3595
  id: `agent-joined-${Date.now()}`,
3596
3596
  sender: "system",
3597
3597
  message: `${t} has joined the chat.`,
@@ -3625,15 +3625,15 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
3625
3625
  }]);
3626
3626
  }), f.on("chat:history_update", (e) => {
3627
3627
  let t = si(e.chat_history || []);
3628
- S(t), t.length === 0 && (B(!1), M(!1), A("ai"), F(!1), ye(!1));
3628
+ S(t), t.length === 0 && (B(!1), M(!1), A("ai"), I(!1), ve(!1));
3629
3629
  }), f.on("conversation:reset", () => {
3630
- S([]), B(!1), M(!1), A("ai"), F(!1), ye(!1);
3630
+ S([]), B(!1), M(!1), A("ai"), I(!1), ve(!1);
3631
3631
  }), f.on("voice:end_session", (e = {}) => {
3632
- console.log("[FlowEngageProvider] voice:end_session received — ending voice session"), R((e) => e + 1), O(!0), je((e) => e + 1);
3632
+ console.log("[FlowEngageProvider] voice:end_session received — ending voice session"), Me((e) => e + 1), O(!0), Ae((e) => e + 1);
3633
3633
  }), f.on("typing:start", (e) => {
3634
- e.sender === "agent" && ye(!0);
3634
+ e.sender === "agent" && ve(!0);
3635
3635
  }), f.on("typing:stop", (e) => {
3636
- e.sender === "agent" && ye(!1);
3636
+ e.sender === "agent" && ve(!1);
3637
3637
  }), f.on("call:incoming", (e = {}) => {
3638
3638
  let t = di([
3639
3639
  e.agentName,
@@ -3739,11 +3739,11 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
3739
3739
  r,
3740
3740
  a
3741
3741
  ]), c(() => () => {
3742
- if (Oe && !vt.current && _t.current.length > 0) {
3742
+ if (De && !vt.current && _t.current.length > 0) {
3743
3743
  let e = Ye.current, t = _t.current, n = U.current;
3744
3744
  n && e && t.length > 0 && (console.log("[FlowEngageProvider] safety-net: syncing voice transcript on unmount"), n.beaconSyncVoice(e, t) || n.syncVoice(e, t).catch(() => {}), vt.current = !0);
3745
3745
  }
3746
- }, [Oe, _]);
3746
+ }, [De, _]);
3747
3747
  let Mt = p(null);
3748
3748
  c(() => {
3749
3749
  let e = U.current;
@@ -3998,17 +3998,17 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
3998
3998
  chatId: y,
3999
3999
  content: e,
4000
4000
  sender: "user",
4001
- email: ge || void 0,
4001
+ email: he || void 0,
4002
4002
  type: i?.type || "text",
4003
4003
  metadata: i?.metadata || {},
4004
4004
  ...n || {}
4005
4005
  });
4006
4006
  return;
4007
4007
  }
4008
- Ce(!0);
4008
+ Se(!0);
4009
4009
  try {
4010
4010
  let o = await Lr(), s = Fr(), l = `stream-preview-${Date.now().toString(36)}`, u = (e) => {
4011
- F(!1), S((t) => {
4011
+ I(!1), S((t) => {
4012
4012
  let n = t.findIndex((e) => e.id === l);
4013
4013
  if (n === -1) return [...t, {
4014
4014
  id: l,
@@ -4025,7 +4025,7 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
4025
4025
  });
4026
4026
  }, d = await U.current.sendAiMessage(y, e, r, t, {
4027
4027
  ...n || {},
4028
- ...ge ? { email: ge } : {}
4028
+ ...he ? { email: he } : {}
4029
4029
  }, {
4030
4030
  ...i,
4031
4031
  currentPageUrl: typeof window < "u" ? window.location.href : void 0,
@@ -4102,10 +4102,10 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
4102
4102
  });
4103
4103
  }
4104
4104
  }
4105
- S(si(f)), Array.isArray(d.cart_actions) && d.cart_actions.length && w(d.cart_actions), M(!!d.is_human_handled), A(d.is_human_handled ? "agent" : "ai"), F(!1), Ce(!1), await U.current.updateChatStatus(y, "messageSent");
4105
+ S(si(f)), Array.isArray(d.cart_actions) && d.cart_actions.length && w(d.cart_actions), M(!!d.is_human_handled), A(d.is_human_handled ? "agent" : "ai"), I(!1), Se(!1), await U.current.updateChatStatus(y, "messageSent");
4106
4106
  } catch (e) {
4107
- S((e) => e.filter((e) => e.id !== u && !e.isStreaming)), F(!1), Ce(!1), e.status === 429 ? (Te(!0), De(e.message), window.setTimeout(() => {
4108
- Te(!1), De("");
4107
+ S((e) => e.filter((e) => e.id !== u && !e.isStreaming)), I(!1), Se(!1), e.status === 429 ? (we(!0), Ee(e.message), window.setTimeout(() => {
4108
+ we(!1), Ee("");
4109
4109
  }, ee)) : h(e);
4110
4110
  }
4111
4111
  }, Gt = async (e) => {
@@ -4117,12 +4117,12 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
4117
4117
  let t = e ? "voice" : "text";
4118
4118
  await U.current.setChatMode(y, t);
4119
4119
  } catch {}
4120
- ke(e), e && (vt.current = !1);
4120
+ Oe(e), e && (vt.current = !1);
4121
4121
  }
4122
4122
  }, qt = async (e) => {
4123
4123
  if (vt.current) return;
4124
4124
  if (vt.current = !0, !U.current || !y || !e?.length) {
4125
- ke(!1);
4125
+ Oe(!1);
4126
4126
  return;
4127
4127
  }
4128
4128
  let t = () => {
@@ -4146,11 +4146,11 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
4146
4146
  } catch {
4147
4147
  t();
4148
4148
  } finally {
4149
- ke(!1);
4149
+ Oe(!1);
4150
4150
  }
4151
4151
  }, Jt = async () => {
4152
4152
  if (!(!U.current || !y)) {
4153
- Oe && !vt.current && _t.current.length > 0 && await qt(_t.current);
4153
+ De && !vt.current && _t.current.length > 0 && await qt(_t.current);
4154
4154
  try {
4155
4155
  await U.current.endConversation(y);
4156
4156
  } catch {
@@ -4184,7 +4184,7 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
4184
4184
  let e = () => {
4185
4185
  let e = Ye.current, t = U.current;
4186
4186
  if (!t || !e) return;
4187
- if (yt.current && _t.current.length > 0 && we(), !vt.current && _t.current.length > 0 && (t.beaconSyncVoice(e, _t.current) || t.syncVoice(e, _t.current).catch(() => {}), vt.current = !0), ot.current) {
4187
+ if (yt.current && _t.current.length > 0 && Ce(), !vt.current && _t.current.length > 0 && (t.beaconSyncVoice(e, _t.current) || t.syncVoice(e, _t.current).catch(() => {}), vt.current = !0), ot.current) {
4188
4188
  t.beaconEndWebRTCCall(ot.current, e);
4189
4189
  return;
4190
4190
  }
@@ -4197,9 +4197,9 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
4197
4197
  }, []);
4198
4198
  let Yt = o(() => {
4199
4199
  let e = i?.siteId;
4200
- ue(e), Xe.current = !0, Ze.current = null, H.current?.disconnect(), S([]), b(""), Ye.current = "", B(!1), M(!1), oe(null), ce(null), Je(!0), s((e) => e + 1);
4200
+ le(e), Xe.current = !0, Ze.current = null, H.current?.disconnect(), S([]), b(""), Ye.current = "", B(!1), M(!1), oe(null), P(null), Je(!0), s((e) => e + 1);
4201
4201
  }, [i?.siteId]), Xt = o((e) => {
4202
- i?.siteId, Xe.current = !1, Ze.current = e, H.current?.disconnect(), S([]), b(""), Ye.current = "", B(!1), M(!1), oe(null), ce(null), Je(!0), s((e) => e + 1);
4202
+ i?.siteId, Xe.current = !1, Ze.current = e, H.current?.disconnect(), S([]), b(""), Ye.current = "", B(!1), M(!1), oe(null), P(null), Je(!0), s((e) => e + 1);
4203
4203
  }, [i?.siteId]), Zt = f(() => ({
4204
4204
  status: l,
4205
4205
  error: d,
@@ -4212,18 +4212,18 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
4212
4212
  isHumanHandled: j,
4213
4213
  agentName: N,
4214
4214
  agentHeadshot: se,
4215
- visitorEmail: ge,
4216
- isAgentTyping: _e,
4217
- isAiTyping: be,
4218
- connectionStatus: xe,
4219
- isLoading: Se,
4220
- isVoiceMode: Oe,
4221
- isRateLimited: L,
4222
- rateLimitMessage: Ee,
4215
+ visitorEmail: he,
4216
+ isAgentTyping: F,
4217
+ isAiTyping: ye,
4218
+ connectionStatus: be,
4219
+ isLoading: xe,
4220
+ isVoiceMode: De,
4221
+ isRateLimited: R,
4222
+ rateLimitMessage: Te,
4223
4223
  isConversationEnded: z,
4224
4224
  isSessionRestoring: qe,
4225
- openToChatCounter: Ae,
4226
- voiceEndCounter: Me,
4225
+ openToChatCounter: ke,
4226
+ voiceEndCounter: je,
4227
4227
  incomingCall: V,
4228
4228
  activeCallId: Le,
4229
4229
  callConnectionState: ze,
@@ -4273,18 +4273,18 @@ function pi({ siteId: e, config: t, children: n, language: r = "en" }) {
4273
4273
  j,
4274
4274
  N,
4275
4275
  se,
4276
- ge,
4277
- _e,
4276
+ he,
4277
+ F,
4278
+ ye,
4278
4279
  be,
4279
4280
  xe,
4280
- Se,
4281
- Oe,
4282
- L,
4283
- Ee,
4281
+ De,
4282
+ R,
4283
+ Te,
4284
4284
  z,
4285
4285
  qe,
4286
- Ae,
4287
- Me,
4286
+ ke,
4287
+ je,
4288
4288
  V,
4289
4289
  Le,
4290
4290
  ze,
@@ -9228,13 +9228,13 @@ var Qm = {
9228
9228
  ...Qm,
9229
9229
  ...Lm,
9230
9230
  ...$m
9231
- }, Xp), th = 24e3, nh = 2048, rh = 1200, ih = .05, ah = 4, oh = .03, sh = 2, ch = 11;
9232
- function lh(e) {
9231
+ }, Xp), th = 24e3, nh = 2048, rh = 1200, ih = .03, ah = 2, oh = 11;
9232
+ function sh(e) {
9233
9233
  let t = 0;
9234
9234
  for (let n = 0; n < e.length; n++) t += e[n] * e[n];
9235
9235
  return Math.sqrt(t / e.length);
9236
9236
  }
9237
- function uh(e) {
9237
+ function ch(e) {
9238
9238
  let t = new Int16Array(e.length);
9239
9239
  for (let n = 0; n < e.length; n++) {
9240
9240
  let r = Math.max(-1, Math.min(1, e[n]));
@@ -9242,16 +9242,16 @@ function uh(e) {
9242
9242
  }
9243
9243
  return t;
9244
9244
  }
9245
- function dh(e) {
9245
+ function lh(e) {
9246
9246
  let t = new Float32Array(e.length);
9247
9247
  for (let n = 0; n < e.length; n++) t[n] = e[n] / 32768;
9248
9248
  return t;
9249
9249
  }
9250
- var fh = .13, ph = ["audio/webm", "audio/mp4"];
9251
- function mh() {
9252
- return typeof window > "u" || window.MediaRecorder === void 0 ? null : ph.find((e) => window.MediaRecorder.isTypeSupported(e)) || null;
9250
+ var uh = .13, dh = ["audio/webm", "audio/mp4"];
9251
+ function fh() {
9252
+ return typeof window > "u" || window.MediaRecorder === void 0 ? null : dh.find((e) => window.MediaRecorder.isTypeSupported(e)) || null;
9253
9253
  }
9254
- function hh(e, t, n, r, i) {
9254
+ function ph(e, t, n, r, i) {
9255
9255
  if (!r.length || !n || !e) return;
9256
9256
  let a = new Blob(r, { type: i }), o = new FormData();
9257
9257
  o.append("audio", a, `aichat-${n}.webm`), o.append("voiceSessionId", n), o.append("siteId", t || ""), fetch(`${e}/api/voice/upload-chat-recording`, {
@@ -9261,32 +9261,32 @@ function hh(e, t, n, r, i) {
9261
9261
  if (!e.ok) throw Error(`HTTP ${e.status}`);
9262
9262
  }).catch((e) => console.warn("[FlowEngage] voice recording upload failed:", e.message));
9263
9263
  }
9264
- var gh = .02;
9265
- function _h(e, t, n) {
9264
+ var mh = .02;
9265
+ function hh(e, t, n) {
9266
9266
  let r = 0, i = 0, a = [], o = () => {
9267
9267
  let t = e.currentTime;
9268
9268
  a.forEach(({ source: e, gain: n }) => {
9269
9269
  try {
9270
- n.gain.cancelScheduledValues(t), n.gain.setValueAtTime(n.gain.value, t), n.gain.linearRampToValueAtTime(0, t + gh), e.stop(t + gh);
9270
+ n.gain.cancelScheduledValues(t), n.gain.setValueAtTime(n.gain.value, t), n.gain.linearRampToValueAtTime(0, t + mh), e.stop(t + mh);
9271
9271
  } catch {}
9272
- }), a = [], r = 0;
9272
+ }), a = [], r = 0, i = 0;
9273
9273
  }, s = () => r > e.currentTime;
9274
9274
  return {
9275
9275
  enqueue: (o) => {
9276
- let c = dh(o), l = e.createBuffer(1, c.length, th);
9276
+ let c = lh(o), l = e.createBuffer(1, c.length, th);
9277
9277
  l.copyToChannel(c, 0);
9278
9278
  let u = e.createBufferSource();
9279
9279
  u.buffer = l;
9280
9280
  let d = e.createGain();
9281
9281
  u.connect(d), d.connect(e.destination), n && d.connect(n);
9282
- let f = !s(), p = f ? e.currentTime + fh : r;
9283
- f && (i = p), u.start(p), r = p + l.duration;
9284
- let m = {
9282
+ let f = s() ? r : e.currentTime + uh;
9283
+ i ||= f, u.start(f), r = f + l.duration;
9284
+ let p = {
9285
9285
  source: u,
9286
9286
  gain: d
9287
9287
  };
9288
- a.push(m), u.onended = () => {
9289
- a = a.filter((e) => e !== m), !a.length && !s() && t?.();
9288
+ a.push(p), u.onended = () => {
9289
+ a = a.filter((e) => e !== p), !a.length && !s() && t?.();
9290
9290
  };
9291
9291
  },
9292
9292
  stop: o,
@@ -9294,7 +9294,7 @@ function _h(e, t, n) {
9294
9294
  playedMs: () => Math.max(0, (e.currentTime - i) * 1e3)
9295
9295
  };
9296
9296
  }
9297
- async function vh(e, t, n) {
9297
+ async function gh(e, t, n) {
9298
9298
  let r = new URLSearchParams({ siteId: t || "" });
9299
9299
  n && r.set("chatId", n);
9300
9300
  let i = Fr();
@@ -9312,8 +9312,8 @@ async function vh(e, t, n) {
9312
9312
  if (!o?.success || !o.wsUrl) throw Error(o?.error || "Voice session was refused.");
9313
9313
  return o;
9314
9314
  }
9315
- async function yh(e) {
9316
- 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 vh(t, n, r);
9315
+ async function _h(e) {
9316
+ 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 gh(t, n, r);
9317
9317
  f?.({ emailOnFile: !!m.emailOnFile });
9318
9318
  let h = { type: "Start" };
9319
9319
  e.greeting !== void 0 && (h.greeting = e.greeting || null);
@@ -9324,7 +9324,7 @@ async function yh(e) {
9324
9324
  autoGainControl: !0
9325
9325
  } }), _ = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: th });
9326
9326
  _.state === "suspended" && await _.resume();
9327
- let v = _.createMediaStreamDestination(), y = mh(), b = [], x = null, S = r || n || null;
9327
+ let v = _.createMediaStreamDestination(), y = fh(), b = [], x = null, S = r || n || null;
9328
9328
  y && (x = new window.MediaRecorder(v.stream, { mimeType: y }), x.ondataavailable = (e) => {
9329
9329
  e.data && e.data.size > 0 && b.push(e.data);
9330
9330
  }, x.start());
@@ -9354,70 +9354,59 @@ async function yh(e) {
9354
9354
  }
9355
9355
  }, O = (e, t, n) => {
9356
9356
  t && (T.role && T.role !== e && D(), T.role = e, T.text = T.text ? `${T.text} ${t}`.replace(/\s+/g, " ") : t, n && (T.debug = n), T.timer && clearTimeout(T.timer), T.timer = setTimeout(D, rh));
9357
- }, k = !1, A = !1, ee = !1, te = !1, ne = !0, j = 0, M = !1, re = !1, ie = ih, ae = ah, N = null, oe = !1, se = !1, ce = () => {
9358
- N && clearTimeout(N);
9357
+ }, k = !1, A = !1, ee = !1, te = !1, ne = !0, j = !1, M = null, re = !1, ie = !1, ae = () => {
9358
+ M && clearTimeout(M);
9359
9359
  let e = () => {
9360
9360
  if (!k) {
9361
- if (le.isPlaying()) {
9362
- N = setTimeout(e, 150);
9361
+ if (N.isPlaying()) {
9362
+ M = setTimeout(e, 150);
9363
9363
  return;
9364
9364
  }
9365
- if (N = null, oe) {
9365
+ if (M = null, re) {
9366
9366
  p?.();
9367
9367
  return;
9368
9368
  }
9369
- !k && C.readyState === WebSocket.OPEN && C.send(JSON.stringify({ type: "PlaybackDrained" })), se && (se = !1, d?.());
9369
+ !k && C.readyState === WebSocket.OPEN && C.send(JSON.stringify({ type: "PlaybackDrained" })), ie && (ie = !1, d?.());
9370
9370
  }
9371
9371
  };
9372
- N = setTimeout(e, 150);
9373
- }, le = _h(_, () => {
9372
+ M = setTimeout(e, 150);
9373
+ }, N = hh(_, () => {
9374
9374
  te && (te = !1, c?.({ mode: "listening" }));
9375
9375
  }, v);
9376
- typeof window < "u" && (window.__fe_agentAudioPlaying = () => le.isPlaying());
9377
- let ue = _.createMediaStreamSource(g);
9378
- ue.connect(v);
9379
- let de = _.createScriptProcessor(nh, 1, 1), fe = !1, pe = 0, me = 0;
9380
- de.onaudioprocess = (e) => {
9376
+ typeof window < "u" && (window.__fe_agentAudioPlaying = () => N.isPlaying());
9377
+ let oe = _.createMediaStreamSource(g);
9378
+ oe.connect(v);
9379
+ let se = _.createScriptProcessor(nh, 1, 1), P = !1, ce = 0, le = 0;
9380
+ se.onaudioprocess = (e) => {
9381
9381
  if (k || C.readyState !== WebSocket.OPEN) return;
9382
9382
  let t = e.inputBuffer.getChannelData(0), n = () => C.send(new Int16Array(t.length).buffer);
9383
9383
  if (A) {
9384
- ee || (ee = !0, console.debug("[FlowEngage] mic held — streaming silence to keep socket alive")), fe = !1, pe = 0, me = 0, n();
9384
+ ee || (ee = !0, console.debug("[FlowEngage] mic held — streaming silence to keep socket alive")), P = !1, ce = 0, le = 0, n();
9385
9385
  return;
9386
9386
  }
9387
- let r = lh(t);
9388
- if (le.isPlaying() || re ? (fe = !1, pe = 0, me = 0) : r >= oh ? (me = 0, pe += 1, !fe && pe >= sh && (fe = !0, c?.({ mode: "user-speaking" }))) : (pe = 0, fe && ++me >= ch && (fe = !1, me = 0, c?.({
9387
+ let r = sh(t);
9388
+ N.isPlaying() || j ? (P = !1, ce = 0, le = 0) : r >= ih ? (le = 0, ce += 1, !P && ce >= ah && (P = !0, c?.({ mode: "user-speaking" }))) : (ce = 0, P && ++le >= oh && (P = !1, le = 0, c?.({
9389
9389
  mode: "thinking",
9390
9390
  tentative: !0
9391
- }))), (le.isPlaying() || re) && !M) {
9392
- if (r < ie) j = 0;
9393
- else if (++j >= ae) {
9394
- M = !0, j = 0;
9395
- let e = le.playedMs();
9396
- le.stop(), ne = !1, re = !1, N && !oe && (clearTimeout(N), N = null), se = !1, C.send(JSON.stringify({
9397
- type: "VisitorInterrupted",
9398
- played_ms: Math.round(e)
9399
- })), console.debug("[FlowEngage] barge-in — visitor spoke over the agent");
9400
- }
9401
- }
9402
- C.send(uh(t).buffer);
9403
- }, ue.connect(de), de.connect(_.destination);
9404
- let he = () => {
9391
+ }))), C.send(ch(t).buffer);
9392
+ }, oe.connect(se), se.connect(_.destination);
9393
+ let ue = () => {
9405
9394
  if (!k) {
9406
- k = !0, N &&= (clearTimeout(N), null), D(), le.stop(), typeof window < "u" && delete window.__fe_agentAudioPlaying;
9395
+ k = !0, M &&= (clearTimeout(M), null), D(), N.stop(), typeof window < "u" && delete window.__fe_agentAudioPlaying;
9407
9396
  try {
9408
- de.disconnect(), ue.disconnect();
9397
+ se.disconnect(), oe.disconnect();
9409
9398
  } catch {}
9410
9399
  if (g.getTracks().forEach((e) => e.stop()), x && x.state !== "inactive") {
9411
- x.onstop = () => hh(t, n, S, b, y);
9400
+ x.onstop = () => ph(t, n, S, b, y);
9412
9401
  try {
9413
9402
  x.stop();
9414
9403
  } catch {
9415
9404
  x.onstop = null;
9416
9405
  }
9417
- } else b.length && hh(t, n, S, b, y);
9406
+ } else b.length && ph(t, n, S, b, y);
9418
9407
  _.close().catch(() => {}), (C.readyState === WebSocket.OPEN || C.readyState === WebSocket.CONNECTING) && C.close();
9419
9408
  }
9420
- }, ge = async (e) => {
9409
+ }, de = async (e) => {
9421
9410
  let t = i[e.name];
9422
9411
  if (!t) return u?.({ tool_name: e.name }), { error: `Unknown tool ${e.name}` };
9423
9412
  let n = {};
@@ -9429,10 +9418,10 @@ async function yh(e) {
9429
9418
  } catch (e) {
9430
9419
  return { error: e?.message || "Tool execution failed" };
9431
9420
  }
9432
- }, P = async (e) => {
9421
+ }, fe = async (e) => {
9433
9422
  for (let t of e.functions || []) {
9434
9423
  if (!t.client_side) continue;
9435
- let e = await ge(t);
9424
+ let e = await de(t);
9436
9425
  if (k || C.readyState !== WebSocket.OPEN) return;
9437
9426
  C.send(JSON.stringify({
9438
9427
  type: "FunctionCallResponse",
@@ -9441,10 +9430,10 @@ async function yh(e) {
9441
9430
  content: typeof e == "string" ? e : JSON.stringify(e ?? {})
9442
9431
  }));
9443
9432
  }
9444
- }, _e = (e) => {
9433
+ }, pe = (e) => {
9445
9434
  switch (e.type) {
9446
9435
  case "Welcome":
9447
- Number.isFinite(e.barge_in_rms) && e.barge_in_rms > 0 && (ie = e.barge_in_rms), Number.isFinite(e.barge_in_frames) && e.barge_in_frames > 0 && (ae = e.barge_in_frames), S = e.session_id || r || n || null, a?.({ conversationId: S });
9436
+ Number.isFinite(e.barge_in_rms) && e.barge_in_rms > 0 && e.barge_in_rms, Number.isFinite(e.barge_in_frames) && e.barge_in_frames > 0 && e.barge_in_frames, S = e.session_id || r || n || null, a?.({ conversationId: S });
9448
9437
  break;
9449
9438
  case "ConversationText": {
9450
9439
  let t = String(e.content || "");
@@ -9463,25 +9452,25 @@ async function yh(e) {
9463
9452
  break;
9464
9453
  }
9465
9454
  case "UserStartedSpeaking":
9466
- D(), le.stop(), re = !1, ne = !1, te = !1, N && !oe && (clearTimeout(N), N = null), se = !1, c?.({ mode: "listening" });
9455
+ D(), N.stop(), j = !1, ne = !1, te = !1, M && !re && (clearTimeout(M), M = null), ie = !1, c?.({ mode: "listening" });
9467
9456
  break;
9468
9457
  case "AgentStartedSpeaking":
9469
- ne = !0, te = !0, M = !1, j = 0, c?.({ mode: "speaking" });
9458
+ ne = !0, te = !0, c?.({ mode: "speaking" });
9470
9459
  break;
9471
9460
  case "AgentAudioDone":
9472
- re = !1, D(), ce(), le.isPlaying() || (te = !1, c?.({ mode: "listening" }));
9461
+ j = !1, D(), ae(), N.isPlaying() || (te = !1, c?.({ mode: "listening" }));
9473
9462
  break;
9474
9463
  case "FunctionCallRequest":
9475
- P(e);
9464
+ fe(e);
9476
9465
  break;
9477
9466
  case "AgentPreparing":
9478
- re = !0;
9467
+ j = !0;
9479
9468
  break;
9480
9469
  case "AgentTurnComplete":
9481
- se = !0, ce();
9470
+ ie = !0, ae();
9482
9471
  break;
9483
9472
  case "SessionEnding":
9484
- console.debug("[FlowEngage] server is ending the session:", e.reason || "unspecified"), oe = !0;
9473
+ console.debug("[FlowEngage] server is ending the session:", e.reason || "unspecified"), re = !0;
9485
9474
  break;
9486
9475
  case "AgentThinking":
9487
9476
  c?.({ mode: "thinking" });
@@ -9498,16 +9487,16 @@ async function yh(e) {
9498
9487
  };
9499
9488
  return C.onopen = () => C.send(JSON.stringify(h)), C.onmessage = (e) => {
9500
9489
  if (e.data instanceof ArrayBuffer) {
9501
- ne && le.enqueue(new Int16Array(e.data));
9490
+ ne && N.enqueue(new Int16Array(e.data));
9502
9491
  return;
9503
9492
  }
9504
9493
  try {
9505
- _e(JSON.parse(e.data));
9494
+ pe(JSON.parse(e.data));
9506
9495
  } catch {}
9507
9496
  }, C.onerror = () => l?.(/* @__PURE__ */ Error("Voice connection failed")), C.onclose = () => {
9508
- he(), o?.();
9497
+ ue(), o?.();
9509
9498
  }, {
9510
- endSession: async () => he(),
9499
+ endSession: async () => ue(),
9511
9500
  sendContextualUpdate: (e) => {
9512
9501
  k || C.readyState !== WebSocket.OPEN || !e || C.send(JSON.stringify({
9513
9502
  type: "UpdatePrompt",
@@ -9545,7 +9534,7 @@ async function yh(e) {
9545
9534
  }
9546
9535
  };
9547
9536
  }
9548
- var bh = { startSession: yh }, xh = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9537
+ var vh = { startSession: _h }, yh = ({ size: e = 18, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9549
9538
  width: e,
9550
9539
  height: e,
9551
9540
  viewBox: "0 0 24 24",
@@ -9561,7 +9550,7 @@ var bh = { startSession: yh }, xh = ({ size: e = 18, color: t = "currentColor" }
9561
9550
  strokeLinecap: "round",
9562
9551
  strokeLinejoin: "round"
9563
9552
  })]
9564
- }), Sh = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
9553
+ }), bh = ({ size: e = 20 }) => /* @__PURE__ */ _("svg", {
9565
9554
  width: e,
9566
9555
  height: e,
9567
9556
  viewBox: "0 0 24 24",
@@ -9576,7 +9565,7 @@ var bh = { startSession: yh }, xh = ({ size: e = 18, color: t = "currentColor" }
9576
9565
  x2: "1",
9577
9566
  y2: "23"
9578
9567
  })]
9579
- }), Ch = ({ size: e = 18 }) => /* @__PURE__ */ _("svg", {
9568
+ }), xh = ({ size: e = 18 }) => /* @__PURE__ */ _("svg", {
9580
9569
  width: e,
9581
9570
  height: e,
9582
9571
  viewBox: "0 0 24 24",
@@ -9591,7 +9580,7 @@ var bh = { startSession: yh }, xh = ({ size: e = 18, color: t = "currentColor" }
9591
9580
  x2: "12",
9592
9581
  y2: "5"
9593
9582
  }), /* @__PURE__ */ g("polyline", { points: "5 12 12 5 19 12" })]
9594
- }), wh = () => /* @__PURE__ */ _("svg", {
9583
+ }), Sh = () => /* @__PURE__ */ _("svg", {
9595
9584
  width: "14",
9596
9585
  height: "14",
9597
9586
  viewBox: "0 0 24 24",
@@ -9601,7 +9590,7 @@ var bh = { startSession: yh }, xh = ({ size: e = 18, color: t = "currentColor" }
9601
9590
  strokeLinecap: "round",
9602
9591
  strokeLinejoin: "round",
9603
9592
  children: [/* @__PURE__ */ g("polyline", { points: "9 17 4 12 9 7" }), /* @__PURE__ */ g("path", { d: "M20 18v-2a4 4 0 00-4-4H4" })]
9604
- }), Th = () => /* @__PURE__ */ g("svg", {
9593
+ }), Ch = () => /* @__PURE__ */ g("svg", {
9605
9594
  width: "18",
9606
9595
  height: "18",
9607
9596
  viewBox: "0 0 24 24",
@@ -9611,7 +9600,7 @@ var bh = { startSession: yh }, xh = ({ size: e = 18, color: t = "currentColor" }
9611
9600
  strokeLinecap: "round",
9612
9601
  strokeLinejoin: "round",
9613
9602
  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" })
9614
- }), Eh = ({ className: e = "" }) => /* @__PURE__ */ _("svg", {
9603
+ }), wh = ({ className: e = "" }) => /* @__PURE__ */ _("svg", {
9615
9604
  className: e,
9616
9605
  width: "14",
9617
9606
  height: "14",
@@ -9640,7 +9629,7 @@ var bh = { startSession: yh }, xh = ({ size: e = 18, color: t = "currentColor" }
9640
9629
  y2: "16"
9641
9630
  })
9642
9631
  ]
9643
- }), Dh = ({ size: e = 14 }) => /* @__PURE__ */ _("svg", {
9632
+ }), Th = ({ size: e = 14 }) => /* @__PURE__ */ _("svg", {
9644
9633
  width: e,
9645
9634
  height: e,
9646
9635
  viewBox: "0 0 24 24",
@@ -9663,7 +9652,7 @@ var bh = { startSession: yh }, xh = ({ size: e = 18, color: t = "currentColor" }
9663
9652
  /* @__PURE__ */ g("path", { d: "M15 13v2" }),
9664
9653
  /* @__PURE__ */ g("path", { d: "M9 13v2" })
9665
9654
  ]
9666
- }), Oh = ({ size: e = 20, strokeWidth: t = 2, color: n = "currentColor" }) => /* @__PURE__ */ _("svg", {
9655
+ }), Eh = ({ size: e = 20, strokeWidth: t = 2, color: n = "currentColor" }) => /* @__PURE__ */ _("svg", {
9667
9656
  width: e,
9668
9657
  height: e,
9669
9658
  viewBox: "0 0 24 24",
@@ -9683,7 +9672,7 @@ var bh = { startSession: yh }, xh = ({ size: e = 18, color: t = "currentColor" }
9683
9672
  x2: "19",
9684
9673
  y2: "12"
9685
9674
  })]
9686
- }), kh = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9675
+ }), Dh = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9687
9676
  width: e,
9688
9677
  height: e,
9689
9678
  viewBox: "0 0 24 24",
@@ -9709,7 +9698,7 @@ var bh = { startSession: yh }, xh = ({ size: e = 18, color: t = "currentColor" }
9709
9698
  fill: t
9710
9699
  })
9711
9700
  ]
9712
- }), Ah = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9701
+ }), Oh = ({ size: e = 20, color: t = "currentColor" }) => /* @__PURE__ */ _("svg", {
9713
9702
  width: "24",
9714
9703
  height: "24",
9715
9704
  viewBox: "0 0 24 24",
@@ -9727,7 +9716,7 @@ var bh = { startSession: yh }, xh = ({ size: e = 18, color: t = "currentColor" }
9727
9716
  "stroke-linecap": "round",
9728
9717
  "stroke-linejoin": "round"
9729
9718
  })]
9730
- }), jh = () => /* @__PURE__ */ g("svg", {
9719
+ }), kh = () => /* @__PURE__ */ g("svg", {
9731
9720
  width: "24",
9732
9721
  height: "24",
9733
9722
  viewBox: "0 0 24 24",
@@ -9739,7 +9728,7 @@ var bh = { startSession: yh }, xh = ({ size: e = 18, color: t = "currentColor" }
9739
9728
  "stroke-width": "1.5",
9740
9729
  "stroke-linejoin": "round"
9741
9730
  })
9742
- }), Mh = ({ size: e = 24 }) => /* @__PURE__ */ _("svg", {
9731
+ }), Ah = ({ size: e = 24 }) => /* @__PURE__ */ _("svg", {
9743
9732
  xmlns: "http://www.w3.org/2000/svg",
9744
9733
  width: e,
9745
9734
  height: e,
@@ -9757,7 +9746,7 @@ var bh = { startSession: yh }, xh = ({ size: e = 18, color: t = "currentColor" }
9757
9746
  /* @__PURE__ */ g("path", { d: "m2 2 20 20" }),
9758
9747
  /* @__PURE__ */ g("path", { d: "M9 9v3a3 3 0 0 0 5.12 2.12" })
9759
9748
  ]
9760
- }), Nh = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), Ph = (e = "") => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), Fh = new Set([
9749
+ }), jh = (e = "") => String(e).replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim(), Mh = (e = "") => String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), Nh = new Set([
9761
9750
  "p",
9762
9751
  "br",
9763
9752
  "ul",
@@ -9768,30 +9757,30 @@ var bh = { startSession: yh }, xh = ({ size: e = 18, color: t = "currentColor" }
9768
9757
  "b",
9769
9758
  "i",
9770
9759
  "a"
9771
- ]), Ih = /^https?:\/\//i;
9772
- function Lh(e) {
9760
+ ]), Ph = /^https?:\/\//i;
9761
+ function Fh(e) {
9773
9762
  let t = Array.from(e.childNodes);
9774
9763
  for (let n of t) if (n.nodeType === Node.ELEMENT_NODE) {
9775
9764
  let t = n.tagName.toLowerCase();
9776
- if (!Fh.has(t)) {
9765
+ if (!Nh.has(t)) {
9777
9766
  e.replaceChild(document.createTextNode(n.textContent), n);
9778
9767
  continue;
9779
9768
  }
9780
9769
  let r = {};
9781
9770
  if (t === "a") {
9782
9771
  let e = n.getAttribute("href") || "";
9783
- Ih.test(e) && (r.href = e), r.target = "_blank", r.rel = "noopener noreferrer";
9772
+ Ph.test(e) && (r.href = e), r.target = "_blank", r.rel = "noopener noreferrer";
9784
9773
  }
9785
9774
  for (; n.attributes.length > 0;) n.removeAttribute(n.attributes[0].name);
9786
9775
  for (let [e, t] of Object.entries(r)) n.setAttribute(e, t);
9787
- Lh(n);
9776
+ Fh(n);
9788
9777
  } else n.nodeType !== Node.TEXT_NODE && e.removeChild(n);
9789
9778
  }
9790
- function Rh(e) {
9779
+ function Ih(e) {
9791
9780
  let t = document.createElement("div");
9792
- return t.innerHTML = e, Lh(t), t.innerHTML;
9781
+ return t.innerHTML = e, Fh(t), t.innerHTML;
9793
9782
  }
9794
- function zh(e) {
9783
+ function Lh(e) {
9795
9784
  let t = String(e || "").trim();
9796
9785
  if (!t) return t;
9797
9786
  let n = /^<p>\s*<strong>([\s\S]*?)<\/strong>\s*<\/p>$/i.exec(t);
@@ -9803,33 +9792,33 @@ function zh(e) {
9803
9792
  }
9804
9793
  return e;
9805
9794
  }
9806
- var Bh = (e = "") => {
9795
+ var Rh = (e = "") => {
9807
9796
  let t = String(e || "").trim();
9808
9797
  if (!t) return "";
9809
- if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return zh(Rh(t));
9810
- 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) => Ph(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>");
9811
- return zh(n.map((e) => {
9798
+ if (/<(p|br|ul|ol|li|strong|em|a)\b/i.test(t)) return Lh(Ih(t));
9799
+ 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) => Mh(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>");
9800
+ return Lh(n.map((e) => {
9812
9801
  let t = e.split("\n").map((e) => e.trim()).filter(Boolean), n = t.filter((e) => /^[-*]\s+/.test(e));
9813
9802
  if (n.length >= 2 && n.length === t.length) return `<ul>${n.map((e) => `<li>${r(e.replace(/^[-*]\s+/, ""))}</li>`).join("")}</ul>`;
9814
9803
  let i = e.split(/\s+(?=[-*]\s+\*\*?)/).map((e) => e.trim()).filter(Boolean);
9815
9804
  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>`;
9816
9805
  }).join(""));
9817
- }, Vh = new Set(["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]), Hh = new Set([
9806
+ }, zh = new Set(["application/pdf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"]), Bh = new Set([
9818
9807
  ".pdf",
9819
9808
  ".docx",
9820
9809
  ".png",
9821
9810
  ".jpg",
9822
9811
  ".jpeg"
9823
- ]), Uh = "image/png,image/jpeg,.pdf,.docx";
9824
- function Wh(e) {
9812
+ ]), Vh = "image/png,image/jpeg,.pdf,.docx";
9813
+ function Hh(e) {
9825
9814
  if (!e) return !1;
9826
9815
  let t = typeof e.name == "string" ? e.name.toLowerCase() : "", n = t.includes(".") ? `.${t.split(".").pop()}` : "", r = typeof e.type == "string" ? e.type.toLowerCase() : "";
9827
- return r === "image/png" || r === "image/jpeg" || Vh.has(r) || Hh.has(n);
9816
+ return r === "image/png" || r === "image/jpeg" || zh.has(r) || Bh.has(n);
9828
9817
  }
9829
- function Gh(e) {
9830
- return e ? Wh(e) ? e.size > 2097152 ? "File must be 2 MB or smaller." : "" : "Only PNG, JPEG, PDF, and DOCX files are allowed." : "No file selected.";
9818
+ function Uh(e) {
9819
+ return e ? Hh(e) ? e.size > 2097152 ? "File must be 2 MB or smaller." : "" : "Only PNG, JPEG, PDF, and DOCX files are allowed." : "No file selected.";
9831
9820
  }
9832
- function Kh(e = 0) {
9821
+ function Wh(e = 0) {
9833
9822
  if (!Number.isFinite(e) || e <= 0) return "";
9834
9823
  let t = [
9835
9824
  "B",
@@ -9841,12 +9830,12 @@ function Kh(e = 0) {
9841
9830
  let i = n >= 10 || r === 0 ? 0 : 1;
9842
9831
  return `${n.toFixed(i)} ${t[r]}`;
9843
9832
  }
9844
- function qh(e) {
9833
+ function Gh(e) {
9845
9834
  return e ? e.name || "Attachment" : "";
9846
9835
  }
9847
9836
  //#endregion
9848
9837
  //#region src/utils/avatarHelpers.js
9849
- function Jh(e) {
9838
+ function Kh(e) {
9850
9839
  if (!e || typeof e != "string") return "?";
9851
9840
  let t = e.trim();
9852
9841
  if (!t) return "?";
@@ -9855,7 +9844,7 @@ function Jh(e) {
9855
9844
  }
9856
9845
  //#endregion
9857
9846
  //#region src/components/AvatarImageOrInitials.jsx
9858
- function Yh({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
9847
+ function qh({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
9859
9848
  let [i, a] = m(null), o = typeof e == "string" ? e.trim() : "";
9860
9849
  return c(() => {
9861
9850
  if (!o) {
@@ -9878,12 +9867,12 @@ function Yh({ src: e, name: t, imgStyle: n, initialsSpanStyle: r }) {
9878
9867
  onError: () => a(null)
9879
9868
  }) : /* @__PURE__ */ g("span", {
9880
9869
  style: r,
9881
- children: Jh(t)
9870
+ children: Kh(t)
9882
9871
  });
9883
9872
  }
9884
9873
  //#endregion
9885
9874
  //#region src/components/MessageList.jsx
9886
- function Xh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, setReplyContext: i, primaryColor: a = "#3B82F6", agentHeadshot: s = null, agentDisplayName: l = "Agent", botAvatarNode: u = null }) {
9875
+ function Jh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, setReplyContext: i, primaryColor: a = "#3B82F6", agentHeadshot: s = null, agentDisplayName: l = "Agent", botAvatarNode: u = null }) {
9887
9876
  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) => {
9888
9877
  let t = e.target.closest("a[href]");
9889
9878
  if (!t) return;
@@ -9938,7 +9927,7 @@ function Xh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9938
9927
  children: [
9939
9928
  e.map((e) => {
9940
9929
  if (e.type === "call_recording" || typeof e.message == "string" && e.message.includes("AI chat recording")) return null;
9941
- 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 = Nh(e.replyToContent || e.replyContext?.message || ""), v = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
9930
+ 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 = jh(e.replyToContent || e.replyContext?.message || ""), v = e.replyToSender === "user" ? "You" : e.replyToSender === "agent" ? "Agent" : e.replyToSender === "ai" || e.replyToSender === "bot" ? "AI Assistant" : "Message";
9942
9931
  return t ? /* @__PURE__ */ g("div", {
9943
9932
  style: {
9944
9933
  display: "flex",
@@ -9983,7 +9972,7 @@ function Xh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
9983
9972
  fontWeight: 800,
9984
9973
  marginTop: !c && (r || o) ? "22px" : "0px"
9985
9974
  },
9986
- children: r ? u || /* @__PURE__ */ g(Dh, { size: 16 }) : /* @__PURE__ */ g(Yh, {
9975
+ children: r ? u || /* @__PURE__ */ g(Th, { size: 16 }) : /* @__PURE__ */ g(qh, {
9987
9976
  src: p || "",
9988
9977
  name: f,
9989
9978
  imgStyle: {
@@ -10025,7 +10014,7 @@ function Xh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10025
10014
  onMouseLeave: (e) => {
10026
10015
  e.currentTarget.style.color = "#9ca3af";
10027
10016
  },
10028
- children: [/* @__PURE__ */ g(wh, {}), "Reply"]
10017
+ children: [/* @__PURE__ */ g(Sh, {}), "Reply"]
10029
10018
  }),
10030
10019
  /* @__PURE__ */ _("div", {
10031
10020
  style: {
@@ -10069,7 +10058,7 @@ function Xh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10069
10058
  children: m
10070
10059
  })]
10071
10060
  }), d ? (() => {
10072
- let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = Kh(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" ? {
10061
+ let t = e.metadata.fileType || "", r = e.metadata.fileName || e.message || "File", i = Wh(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" ? {
10073
10062
  color: "#ef4444",
10074
10063
  label: "PDF"
10075
10064
  } : t.includes("word") || t.includes("docx") ? {
@@ -10250,7 +10239,7 @@ function Xh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10250
10239
  });
10251
10240
  })() : r ? /* @__PURE__ */ g("div", {
10252
10241
  className: "flowengage-message-content fe-bot-message",
10253
- dangerouslySetInnerHTML: { __html: Bh(e.message) },
10242
+ dangerouslySetInnerHTML: { __html: Rh(e.message) },
10254
10243
  onClick: T
10255
10244
  }) : /* @__PURE__ */ g("div", {
10256
10245
  style: { whiteSpace: "pre-wrap" },
@@ -10315,7 +10304,7 @@ function Xh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10315
10304
  boxShadow: u ? "none" : "0 8px 20px rgba(59,130,246,0.24)",
10316
10305
  overflow: "hidden"
10317
10306
  },
10318
- children: u || /* @__PURE__ */ g(Dh, { size: 16 })
10307
+ children: u || /* @__PURE__ */ g(Th, { size: 16 })
10319
10308
  }), /* @__PURE__ */ _("div", {
10320
10309
  style: {
10321
10310
  display: "flex",
@@ -10357,7 +10346,7 @@ function Xh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10357
10346
  borderRadius: "50%",
10358
10347
  overflow: "hidden"
10359
10348
  },
10360
- children: /* @__PURE__ */ g(Yh, {
10349
+ children: /* @__PURE__ */ g(qh, {
10361
10350
  src: s || "",
10362
10351
  name: l,
10363
10352
  imgStyle: {
@@ -10451,22 +10440,22 @@ function Xh({ chatHistory: e, isAiTyping: t, isLoading: n, isAgentTyping: r, set
10451
10440
  }
10452
10441
  //#endregion
10453
10442
  //#region src/components/ChatInput.jsx
10454
- var Zh = typeof window < "u" && (window.matchMedia?.("(pointer: coarse)").matches || navigator.maxTouchPoints > 0);
10455
- function Qh({ 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" }) {
10443
+ var Yh = typeof window < "u" && (window.matchMedia?.("(pointer: coarse)").matches || navigator.maxTouchPoints > 0);
10444
+ function Xh({ 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" }) {
10456
10445
  let D = p(null), O = p(null), k = (e) => {
10457
10446
  e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, 120)}px`);
10458
10447
  };
10459
10448
  c(() => {
10460
10449
  d || k(O.current);
10461
10450
  }, [e, d]), c(() => {
10462
- d || Zh || e || s || O.current?.focus();
10451
+ d || Yh || e || s || O.current?.focus();
10463
10452
  }, [
10464
10453
  e,
10465
10454
  d,
10466
10455
  s
10467
10456
  ]);
10468
10457
  let A = (e) => {
10469
- e.key === "Enter" && (Zh || e.shiftKey || e.altKey || e.ctrlKey || e.metaKey || (e.preventDefault(), e.currentTarget.form?.requestSubmit()));
10458
+ e.key === "Enter" && (Yh || e.shiftKey || e.altKey || e.ctrlKey || e.metaKey || (e.preventDefault(), e.currentTarget.form?.requestSubmit()));
10470
10459
  }, 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;
10471
10460
  return /* @__PURE__ */ _("div", {
10472
10461
  style: {
@@ -10561,7 +10550,7 @@ function Qh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10561
10550
  background: "rgba(59,130,246,0.08)",
10562
10551
  color: "var(--flowengage-primary)"
10563
10552
  },
10564
- children: /* @__PURE__ */ g(Dh, { size: 13 })
10553
+ children: /* @__PURE__ */ g(Th, { size: 13 })
10565
10554
  }), /* @__PURE__ */ g("span", { children: "Please provide your email address so we can help you." })]
10566
10555
  })
10567
10556
  }),
@@ -10601,7 +10590,7 @@ function Qh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10601
10590
  overflow: "hidden",
10602
10591
  textOverflow: "ellipsis"
10603
10592
  },
10604
- children: qh(S)
10593
+ children: Gh(S)
10605
10594
  }),
10606
10595
  /* @__PURE__ */ g("div", {
10607
10596
  style: {
@@ -10609,7 +10598,7 @@ function Qh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10609
10598
  color: "#6b7280",
10610
10599
  marginTop: "2px"
10611
10600
  },
10612
- children: Kh(S.size)
10601
+ children: Wh(S.size)
10613
10602
  })
10614
10603
  ]
10615
10604
  }), /* @__PURE__ */ g("button", {
@@ -10654,7 +10643,7 @@ function Qh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10654
10643
  j ? /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("input", {
10655
10644
  ref: D,
10656
10645
  type: "file",
10657
- accept: Uh,
10646
+ accept: Vh,
10658
10647
  style: { display: "none" },
10659
10648
  onChange: (e) => {
10660
10649
  let t = e.target.files?.[0];
@@ -10686,7 +10675,7 @@ function Qh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10686
10675
  onMouseLeave: (e) => {
10687
10676
  e.currentTarget.style.opacity = "1";
10688
10677
  },
10689
- children: /* @__PURE__ */ g(Oh, {
10678
+ children: /* @__PURE__ */ g(Eh, {
10690
10679
  size: 16,
10691
10680
  color: "currentColor"
10692
10681
  })
@@ -10767,7 +10756,7 @@ function Qh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10767
10756
  onMouseLeave: (e) => {
10768
10757
  e.currentTarget.style.opacity = "1";
10769
10758
  },
10770
- children: /* @__PURE__ */ g(Ch, { size: 16 })
10759
+ children: /* @__PURE__ */ g(xh, { size: 16 })
10771
10760
  })
10772
10761
  ]
10773
10762
  }),
@@ -10830,7 +10819,7 @@ function Qh({ input: e, setInput: t, onSubmit: n, isConversationEnded: r, callUi
10830
10819
  }
10831
10820
  //#endregion
10832
10821
  //#region src/components/StatusBanners.jsx
10833
- function $h({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r, isRateLimited: i, rateLimitMessage: a }) {
10822
+ function Zh({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r, isRateLimited: i, rateLimitMessage: a }) {
10834
10823
  return /* @__PURE__ */ _(h, { children: [(e || t) && /* @__PURE__ */ _("div", {
10835
10824
  style: {
10836
10825
  margin: "0 20px 10px",
@@ -10843,7 +10832,7 @@ function $h({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
10843
10832
  gap: "10px"
10844
10833
  },
10845
10834
  children: [
10846
- /* @__PURE__ */ g(Eh, { className: "" }),
10835
+ /* @__PURE__ */ g(wh, { className: "" }),
10847
10836
  /* @__PURE__ */ g("span", {
10848
10837
  style: {
10849
10838
  fontSize: "12px",
@@ -10889,13 +10878,13 @@ function $h({ webRTCError: e, micError: t, setMicError: n, dismissCallError: r,
10889
10878
  }
10890
10879
  //#endregion
10891
10880
  //#region src/components/AnimatedOrb.jsx
10892
- var eg = [
10881
+ var Qh = [
10893
10882
  "#135bd8",
10894
10883
  "#ef334b",
10895
10884
  "#ffbd2e"
10896
10885
  ];
10897
- function tg(e) {
10898
- return !Array.isArray(e) || e.length === 0 ? eg : e.length === 1 ? [
10886
+ function $h(e) {
10887
+ return !Array.isArray(e) || e.length === 0 ? Qh : e.length === 1 ? [
10899
10888
  e[0],
10900
10889
  e[0],
10901
10890
  e[0]
@@ -10909,7 +10898,7 @@ function tg(e) {
10909
10898
  e[2]
10910
10899
  ];
10911
10900
  }
10912
- var ng = {
10901
+ var eg = {
10913
10902
  idle: 3,
10914
10903
  listening: .75,
10915
10904
  thinking: 1,
@@ -10917,7 +10906,7 @@ var ng = {
10917
10906
  muted: .75,
10918
10907
  error: .08
10919
10908
  };
10920
- function rg(e) {
10909
+ function tg(e) {
10921
10910
  if (!e || typeof e != "string") return [
10922
10911
  0,
10923
10912
  0,
@@ -10930,14 +10919,14 @@ function rg(e) {
10930
10919
  parseInt(n.slice(4, 6), 16) / 255
10931
10920
  ];
10932
10921
  }
10933
- function ig(e, t) {
10922
+ function ng(e, t) {
10934
10923
  if (!e || typeof e != "string") return `rgba(0,0,0,${t})`;
10935
10924
  if (e.startsWith("rgb")) return e.replace(/[\d.]+\)$/, `${t})`);
10936
10925
  let n = e.replace("#", ""), r = n.length === 3 ? n.split("").map((e) => e + e).join("") : n;
10937
10926
  return `rgba(${parseInt(r.slice(0, 2), 16)},${parseInt(r.slice(2, 4), 16)},${parseInt(r.slice(4, 6), 16)},${t})`;
10938
10927
  }
10939
- var ag = "\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", og = "\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";
10940
- function sg(e, t, n) {
10928
+ var rg = "\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", ig = "\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";
10929
+ function ag(e, t, n) {
10941
10930
  let r = (t, n) => {
10942
10931
  let r = e.createShader(t);
10943
10932
  return e.shaderSource(r, n), e.compileShader(r), e.getShaderParameter(r, e.COMPILE_STATUS) ? r : (console.error("[AnimatedOrb shader]", e.getShaderInfoLog(r)), null);
@@ -10946,10 +10935,10 @@ function sg(e, t, n) {
10946
10935
  let o = e.createProgram();
10947
10936
  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);
10948
10937
  }
10949
- function cg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r, onClick: i, style: a, className: o }) {
10950
- let [s, l, u] = tg(r), d = t === "speaking", f = e <= 50, m = p(null), h = p(ng[t] ?? .35);
10938
+ function og({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r, onClick: i, style: a, className: o }) {
10939
+ let [s, l, u] = $h(r), d = t === "speaking", f = e <= 50, m = p(null), h = p(eg[t] ?? .35);
10951
10940
  c(() => {
10952
- h.current = ng[t] ?? .35;
10941
+ h.current = eg[t] ?? .35;
10953
10942
  }, [t]), c(() => {
10954
10943
  let t = m.current;
10955
10944
  if (!t) return;
@@ -10966,7 +10955,7 @@ function cg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
10966
10955
  console.warn("[AnimatedOrb] WebGL unavailable.");
10967
10956
  return;
10968
10957
  }
10969
- let i = sg(r, ag, og);
10958
+ let i = ag(r, rg, ig);
10970
10959
  if (!i) {
10971
10960
  console.error("[AnimatedOrb] WebGL program failed to compile/link");
10972
10961
  return;
@@ -10996,7 +10985,7 @@ function cg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
10996
10985
  c2: r.getUniformLocation(i, "u_c2"),
10997
10986
  c3: r.getUniformLocation(i, "u_c3")
10998
10987
  };
10999
- r.uniform3fv(c.c1, rg(s)), r.uniform3fv(c.c2, rg(l)), r.uniform3fv(c.c3, rg(u)), r.viewport(0, 0, t.width, t.height);
10988
+ r.uniform3fv(c.c1, tg(s)), r.uniform3fv(c.c2, tg(l)), r.uniform3fv(c.c3, tg(u)), r.viewport(0, 0, t.width, t.height);
11000
10989
  let d = performance.now(), f, p = (e) => {
11001
10990
  r.uniform1f(c.time, (e - d) / 1e3), r.uniform1f(c.speed, h.current), r.drawArrays(r.TRIANGLES, 0, 6), f = requestAnimationFrame(p);
11002
10991
  };
@@ -11027,7 +11016,7 @@ function cg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
11027
11016
  position: "absolute",
11028
11017
  inset: -10,
11029
11018
  borderRadius: "50%",
11030
- background: `radial-gradient(circle, ${ig(s, .18)} 0%, transparent 70%)`,
11019
+ background: `radial-gradient(circle, ${ng(s, .18)} 0%, transparent 70%)`,
11031
11020
  pointerEvents: "none"
11032
11021
  },
11033
11022
  animate: { opacity: [.3, .75] },
@@ -11105,17 +11094,17 @@ function cg({ size: e = 94, voiceState: t = "idle", isMuted: n = !1, colors: r,
11105
11094
  }
11106
11095
  //#endregion
11107
11096
  //#region src/components/CallScreen.jsx
11108
- var lg = "\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";
11109
- function ug(e) {
11097
+ var sg = "\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";
11098
+ function cg(e) {
11110
11099
  let t = (e || "").replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t;
11111
11100
  return `${parseInt(n.slice(0, 2), 16)},${parseInt(n.slice(2, 4), 16)},${parseInt(n.slice(4, 6), 16)}`;
11112
11101
  }
11113
- function dg(e) {
11102
+ function lg(e) {
11114
11103
  if (!e || typeof e != "string") return "#1a1a1a";
11115
11104
  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;
11116
11105
  return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
11117
11106
  }
11118
- function fg(e, t) {
11107
+ function ug(e, t) {
11119
11108
  let n = Array.isArray(e) && e.length > 0 ? e : [t || "#3B82F6"], [r, i, a] = n;
11120
11109
  return n.length === 1 ? [
11121
11110
  `radial-gradient(ellipse 110% 65% at 50% -5%, ${r}28 0%, transparent 68%)`,
@@ -11132,8 +11121,8 @@ function fg(e, t) {
11132
11121
  "#f7f8fa"
11133
11122
  ].join(", ");
11134
11123
  }
11135
- function pg({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" }) {
11136
- let i = (t || "A")[0].toUpperCase(), a = dg(r), o = n > 48 ? {
11124
+ function dg({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" }) {
11125
+ let i = (t || "A")[0].toUpperCase(), a = lg(r), o = n > 48 ? {
11137
11126
  boxShadow: `0 0 0 3px ${r}44`,
11138
11127
  border: "3px solid rgba(255,255,255,0.15)"
11139
11128
  } : { border: `1.5px solid ${r}55` };
@@ -11170,7 +11159,7 @@ function pg({ headshot: e, name: t, size: n = 80, primaryColor: r = "#3B82F6" })
11170
11159
  children: i
11171
11160
  });
11172
11161
  }
11173
- function mg(e) {
11162
+ function fg(e) {
11174
11163
  let t = p(null), n = o(() => {
11175
11164
  if (!t.current) return;
11176
11165
  let { audioContext: e, oscillator: n, interval: r, toneTimeout: i } = t.current;
@@ -11217,8 +11206,8 @@ function mg(e) {
11217
11206
  n
11218
11207
  ]), c(() => () => n(), [n]), n;
11219
11208
  }
11220
- function hg({ 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 = [] }) {
11221
- let y = a || s || "Agent", b = e ? "incoming" : n === "connecting" ? "connecting" : "ongoing", x = mg(!!e), S = async () => {
11209
+ function pg({ 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 = [] }) {
11210
+ let y = a || s || "Agent", b = e ? "incoming" : n === "connecting" ? "connecting" : "ongoing", x = fg(!!e), S = async () => {
11222
11211
  x(), await c();
11223
11212
  }, C = async () => {
11224
11213
  x(), await l();
@@ -11230,14 +11219,14 @@ function hg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11230
11219
  flexDirection: "column",
11231
11220
  borderRadius: "inherit",
11232
11221
  overflow: "hidden",
11233
- background: fg(h, m),
11222
+ background: ug(h, m),
11234
11223
  animation: T ? "fe-call-slide-up 0.36s cubic-bezier(0.16,1,0.3,1)" : "fe-call-fade-in 0.32s ease"
11235
11224
  };
11236
11225
  if (b === "incoming") {
11237
11226
  let e = Array.isArray(h) && h.length > 0 ? h : [m];
11238
11227
  return /* @__PURE__ */ _("div", {
11239
11228
  style: E,
11240
- children: [/* @__PURE__ */ g("style", { children: lg }), /* @__PURE__ */ _("div", {
11229
+ children: [/* @__PURE__ */ g("style", { children: sg }), /* @__PURE__ */ _("div", {
11241
11230
  style: {
11242
11231
  flex: 1,
11243
11232
  display: "flex",
@@ -11268,7 +11257,7 @@ function hg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11268
11257
  width: "96px",
11269
11258
  height: "96px",
11270
11259
  borderRadius: "50%",
11271
- background: `radial-gradient(circle, rgba(${ug(e[0])},0.2) 0%, transparent 70%)`,
11260
+ background: `radial-gradient(circle, rgba(${cg(e[0])},0.2) 0%, transparent 70%)`,
11272
11261
  filter: "blur(10px)",
11273
11262
  zIndex: 0
11274
11263
  } }),
@@ -11285,7 +11274,7 @@ function hg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11285
11274
  animation: `fe-call-ring-pulse 2.6s cubic-bezier(0.215,0.61,0.355,1) ${t}s infinite`,
11286
11275
  zIndex: 1
11287
11276
  } }, n)),
11288
- /* @__PURE__ */ g(pg, {
11277
+ /* @__PURE__ */ g(dg, {
11289
11278
  headshot: o,
11290
11279
  name: y,
11291
11280
  size: 82,
@@ -11365,7 +11354,7 @@ function hg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11365
11354
  e.currentTarget.style.transform = "scale(1)", e.currentTarget.style.boxShadow = "0 6px 24px rgba(239,68,68,0.5)";
11366
11355
  },
11367
11356
  "aria-label": "Decline call",
11368
- children: /* @__PURE__ */ g(Sh, { size: 26 })
11357
+ children: /* @__PURE__ */ g(bh, { size: 26 })
11369
11358
  }), /* @__PURE__ */ g("span", {
11370
11359
  style: {
11371
11360
  fontSize: "12px",
@@ -11406,7 +11395,7 @@ function hg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11406
11395
  e.currentTarget.style.transform = "scale(1)", e.currentTarget.style.boxShadow = "0 6px 24px rgba(34,197,94,0.5)";
11407
11396
  },
11408
11397
  "aria-label": "Accept call",
11409
- children: /* @__PURE__ */ g(Th, {})
11398
+ children: /* @__PURE__ */ g(Ch, {})
11410
11399
  }), /* @__PURE__ */ g("span", {
11411
11400
  style: {
11412
11401
  fontSize: "12px",
@@ -11423,7 +11412,7 @@ function hg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11423
11412
  }
11424
11413
  return b === "connecting" ? /* @__PURE__ */ _("div", {
11425
11414
  style: E,
11426
- children: [/* @__PURE__ */ g("style", { children: lg }), /* @__PURE__ */ _("div", {
11415
+ children: [/* @__PURE__ */ g("style", { children: sg }), /* @__PURE__ */ _("div", {
11427
11416
  style: {
11428
11417
  flex: 1,
11429
11418
  display: "flex",
@@ -11433,7 +11422,7 @@ function hg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11433
11422
  gap: "24px"
11434
11423
  },
11435
11424
  children: [
11436
- /* @__PURE__ */ g(pg, {
11425
+ /* @__PURE__ */ g(dg, {
11437
11426
  headshot: o,
11438
11427
  name: y,
11439
11428
  size: 64,
@@ -11460,7 +11449,7 @@ function hg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11460
11449
  }) : /* @__PURE__ */ _("div", {
11461
11450
  style: E,
11462
11451
  children: [
11463
- /* @__PURE__ */ g("style", { children: lg }),
11452
+ /* @__PURE__ */ g("style", { children: sg }),
11464
11453
  /* @__PURE__ */ _("div", {
11465
11454
  style: {
11466
11455
  display: "flex",
@@ -11506,7 +11495,7 @@ function hg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11506
11495
  children: /* @__PURE__ */ g("polyline", { points: "15 18 9 12 15 6" })
11507
11496
  })
11508
11497
  }),
11509
- /* @__PURE__ */ g(cg, {
11498
+ /* @__PURE__ */ g(og, {
11510
11499
  colors: h,
11511
11500
  size: 36,
11512
11501
  voiceState: w
@@ -11557,7 +11546,7 @@ function hg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11557
11546
  gap: "16px",
11558
11547
  padding: "0 24px 16px"
11559
11548
  },
11560
- children: [/* @__PURE__ */ g(pg, {
11549
+ children: [/* @__PURE__ */ g(dg, {
11561
11550
  headshot: o,
11562
11551
  name: y,
11563
11552
  size: 116,
@@ -11612,7 +11601,7 @@ function hg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11612
11601
  transition: "all 0.2s ease"
11613
11602
  },
11614
11603
  "aria-label": i ? "Unmute" : "Mute",
11615
- children: [g(i ? Mh : xh, { size: 18 }), i ? "Unmute" : "Mute"]
11604
+ children: [g(i ? Ah : yh, { size: 18 }), i ? "Unmute" : "Mute"]
11616
11605
  }), /* @__PURE__ */ _("button", {
11617
11606
  type: "button",
11618
11607
  onClick: u,
@@ -11640,15 +11629,15 @@ function hg({ incomingCall: e, activeCallId: t, callConnectionState: n, callDura
11640
11629
  e.currentTarget.style.background = "rgba(239,68,68,0.9)", e.currentTarget.style.transform = "scale(1)";
11641
11630
  },
11642
11631
  "aria-label": "End call",
11643
- children: [/* @__PURE__ */ g(Sh, { size: 18 }), "End Call"]
11632
+ children: [/* @__PURE__ */ g(bh, { size: 18 }), "End Call"]
11644
11633
  })]
11645
11634
  })
11646
11635
  ]
11647
11636
  });
11648
11637
  }
11649
- function gg({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDurationSeconds: r, isCallMuted: i, formatCallDuration: a, toggleCallMute: o, endWebRTCCall: s, onExpand: c, primaryColor: l = "#3B82F6" }) {
11638
+ function mg({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDurationSeconds: r, isCallMuted: i, formatCallDuration: a, toggleCallMute: o, endWebRTCCall: s, onExpand: c, primaryColor: l = "#3B82F6" }) {
11650
11639
  let u = e || n || "Agent";
11651
- return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("style", { children: lg }), /* @__PURE__ */ _("div", {
11640
+ return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("style", { children: sg }), /* @__PURE__ */ _("div", {
11652
11641
  role: "button",
11653
11642
  tabIndex: 0,
11654
11643
  onClick: c,
@@ -11705,7 +11694,7 @@ function gg({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
11705
11694
  borderRadius: "50%",
11706
11695
  border: `1.5px solid ${l}55`
11707
11696
  } }),
11708
- /* @__PURE__ */ g(pg, {
11697
+ /* @__PURE__ */ g(dg, {
11709
11698
  headshot: t,
11710
11699
  name: u,
11711
11700
  size: 38,
@@ -11789,7 +11778,7 @@ function gg({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
11789
11778
  boxShadow: i ? `0 0 0 3px ${l}12` : "none"
11790
11779
  },
11791
11780
  "aria-label": i ? "Unmute" : "Mute",
11792
- children: g(i ? Mh : xh, { size: 15 })
11781
+ children: g(i ? Ah : yh, { size: 15 })
11793
11782
  }), /* @__PURE__ */ g("button", {
11794
11783
  type: "button",
11795
11784
  onClick: (e) => {
@@ -11817,7 +11806,7 @@ function gg({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
11817
11806
  transition: "all 0.18s ease"
11818
11807
  },
11819
11808
  "aria-label": "End call",
11820
- children: /* @__PURE__ */ g(Sh, { size: 16 })
11809
+ children: /* @__PURE__ */ g(bh, { size: 16 })
11821
11810
  })]
11822
11811
  })
11823
11812
  ]
@@ -11825,7 +11814,7 @@ function gg({ agentName: e, agentHeadshot: t, fallbackAgentName: n, callDuration
11825
11814
  }
11826
11815
  //#endregion
11827
11816
  //#region src/utils/voicePriorContext.js
11828
- function _g(e, t = {}) {
11817
+ function hg(e, t = {}) {
11829
11818
  let n = t.maxChars ?? 4500;
11830
11819
  if (!Array.isArray(e) || e.length === 0) return "";
11831
11820
  let r = [];
@@ -11843,7 +11832,7 @@ function _g(e, t = {}) {
11843
11832
  //#endregion
11844
11833
  //#region src/utils/voiceActionVisuals.js
11845
11834
  var Q = "fe-vv";
11846
- function vg() {
11835
+ function gg() {
11847
11836
  if (typeof document > "u" || document.getElementById(`${Q}-styles`)) return;
11848
11837
  let e = `
11849
11838
  /* ── Action toast ───────────────────────────────────────────────────────────── */
@@ -11988,14 +11977,14 @@ function vg() {
11988
11977
  `, t = document.createElement("style");
11989
11978
  t.id = `${Q}-styles`, t.textContent = e, (document.head || document.documentElement).appendChild(t);
11990
11979
  }
11991
- var yg = null, bg = null;
11992
- function xg() {
11993
- return (!yg || !yg.isConnected) && (yg = document.createElement("div"), yg.id = `${Q}-toast`, document.body.appendChild(yg)), yg;
11980
+ var _g = null, vg = null;
11981
+ function yg() {
11982
+ return (!_g || !_g.isConnected) && (_g = document.createElement("div"), _g.id = `${Q}-toast`, document.body.appendChild(_g)), _g;
11994
11983
  }
11995
- function Sg(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
11984
+ function bg(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
11996
11985
  if (typeof document > "u") return;
11997
- vg(), bg &&= (clearTimeout(bg), null);
11998
- let i = xg();
11986
+ gg(), vg &&= (clearTimeout(vg), null);
11987
+ let i = yg();
11999
11988
  if (i.innerHTML = "", n) {
12000
11989
  let e = document.createElement("span");
12001
11990
  e.className = `${Q}-icon`, e.textContent = n, i.appendChild(e);
@@ -12004,71 +11993,71 @@ function Sg(e, { spinner: t = !0, icon: n = null, duration: r = 0 } = {}) {
12004
11993
  e.className = `${Q}-spin`, i.appendChild(e);
12005
11994
  }
12006
11995
  let a = document.createElement("span");
12007
- a.textContent = e, i.appendChild(a), i.classList.remove(`${Q}-show`), i.offsetHeight, i.classList.add(`${Q}-show`), r > 0 && (bg = setTimeout(() => Cg(), r));
11996
+ a.textContent = e, i.appendChild(a), i.classList.remove(`${Q}-show`), i.offsetHeight, i.classList.add(`${Q}-show`), r > 0 && (vg = setTimeout(() => xg(), r));
12008
11997
  }
12009
- function Cg(e = 0) {
12010
- yg && (e > 0 ? bg = setTimeout(() => {
12011
- yg && yg.classList.remove(`${Q}-show`);
12012
- }, e) : yg && yg.classList.remove(`${Q}-show`));
11998
+ function xg(e = 0) {
11999
+ _g && (e > 0 ? vg = setTimeout(() => {
12000
+ _g && _g.classList.remove(`${Q}-show`);
12001
+ }, e) : _g && _g.classList.remove(`${Q}-show`));
12013
12002
  }
12014
- var wg = null, Tg = [];
12015
- function Eg() {
12016
- return (!wg || !wg.isConnected) && (wg = document.createElement("div"), wg.id = `${Q}-bar`, document.body.appendChild(wg)), wg;
12003
+ var Sg = null, Cg = [];
12004
+ function wg() {
12005
+ return (!Sg || !Sg.isConnected) && (Sg = document.createElement("div"), Sg.id = `${Q}-bar`, document.body.appendChild(Sg)), Sg;
12017
12006
  }
12018
- function Dg() {
12007
+ function Tg() {
12019
12008
  if (typeof document > "u") return;
12020
- vg(), Tg.forEach(clearTimeout), Tg = [];
12021
- let e = Eg();
12009
+ gg(), Cg.forEach(clearTimeout), Cg = [];
12010
+ let e = wg();
12022
12011
  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";
12023
12012
  let t = [[80, "width 0.6s ease"], [92, "width 1.2s ease"]], n = 50;
12024
12013
  for (let [e, r] of t) {
12025
12014
  let t = n, i = e, a = r;
12026
- Tg.push(setTimeout(() => {
12027
- wg && (wg.style.transition = a, wg.style.width = `${i}%`);
12015
+ Cg.push(setTimeout(() => {
12016
+ Sg && (Sg.style.transition = a, Sg.style.width = `${i}%`);
12028
12017
  }, t)), n += 800;
12029
12018
  }
12030
12019
  }
12031
- function Og() {
12032
- wg && (Tg.forEach(clearTimeout), Tg = [], wg.style.transition = "width 0.2s ease", wg.style.width = "100%", Tg.push(setTimeout(() => {
12033
- wg && (wg.style.transition = "opacity 0.35s ease", wg.style.opacity = "0", Tg.push(setTimeout(() => {
12034
- wg && (wg.style.width = "0%", wg.classList.remove(`${Q}-bar-active`));
12020
+ function Eg() {
12021
+ Sg && (Cg.forEach(clearTimeout), Cg = [], Sg.style.transition = "width 0.2s ease", Sg.style.width = "100%", Cg.push(setTimeout(() => {
12022
+ Sg && (Sg.style.transition = "opacity 0.35s ease", Sg.style.opacity = "0", Cg.push(setTimeout(() => {
12023
+ Sg && (Sg.style.width = "0%", Sg.classList.remove(`${Q}-bar-active`));
12035
12024
  }, 380)));
12036
12025
  }, 220)));
12037
12026
  }
12038
- var kg = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
12027
+ var Dg = `<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 22 22" fill="none">
12039
12028
  <filter id="${Q}-csh">
12040
12029
  <feDropShadow dx="1" dy="2" stdDeviation="1.5" flood-color="#00000060"/>
12041
12030
  </filter>
12042
12031
  <path d="M4 2L19 10.5L11 12.8L8 20L4 2Z"
12043
12032
  fill="white" stroke="#1e1b4b" stroke-width="1.6" stroke-linejoin="round"
12044
12033
  filter="url(#${Q}-csh)"/>
12045
- </svg>`, Ag = null, jg = !1;
12046
- function Mg() {
12047
- return (!Ag || !Ag.isConnected) && (Ag = document.createElement("div"), Ag.id = `${Q}-cursor`, Ag.innerHTML = kg, document.body.appendChild(Ag), jg = !1), Ag;
12034
+ </svg>`, Og = null, kg = !1;
12035
+ function Ag() {
12036
+ return (!Og || !Og.isConnected) && (Og = document.createElement("div"), Og.id = `${Q}-cursor`, Og.innerHTML = Dg, document.body.appendChild(Og), kg = !1), Og;
12048
12037
  }
12049
- async function Ng(e) {
12038
+ async function jg(e) {
12050
12039
  if (typeof document > "u" || !e) return;
12051
- vg();
12040
+ gg();
12052
12041
  let t;
12053
12042
  try {
12054
12043
  t = e.getBoundingClientRect();
12055
12044
  } catch {
12056
12045
  return;
12057
12046
  }
12058
- let n = t.left + Math.min(16, t.width * .2), r = t.top + Math.min(12, t.height * .25), i = Mg();
12059
- jg ||= (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 Lg(360);
12047
+ let n = t.left + Math.min(16, t.width * .2), r = t.top + Math.min(12, t.height * .25), i = Ag();
12048
+ kg ||= (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 Fg(360);
12060
12049
  }
12061
- function Pg(e = !1) {
12062
- Ag && (e ? (Ag.classList.remove(`${Q}-cursor-visible`), jg = !1) : (Ag.classList.remove(`${Q}-cursor-visible`), setTimeout(() => {
12063
- jg = !1;
12050
+ function Mg(e = !1) {
12051
+ Og && (e ? (Og.classList.remove(`${Q}-cursor-visible`), kg = !1) : (Og.classList.remove(`${Q}-cursor-visible`), setTimeout(() => {
12052
+ kg = !1;
12064
12053
  }, 250)));
12065
12054
  }
12066
- async function Fg(e) {
12067
- Ag && (Ag.classList.add(`${Q}-cursor-click`), await Lg(280), Ag.classList.remove(`${Q}-cursor-click`));
12055
+ async function Ng(e) {
12056
+ Og && (Og.classList.add(`${Q}-cursor-click`), await Fg(280), Og.classList.remove(`${Q}-cursor-click`));
12068
12057
  }
12069
- function Ig(e) {
12058
+ function Pg(e) {
12070
12059
  if (!e || typeof document > "u") return;
12071
- vg();
12060
+ gg();
12072
12061
  let t;
12073
12062
  try {
12074
12063
  t = e.getBoundingClientRect();
@@ -12094,29 +12083,29 @@ function Ig(e) {
12094
12083
  a.remove(), e.style.position = n, e.style.overflow = r;
12095
12084
  }, 650);
12096
12085
  }
12097
- function Lg(e) {
12086
+ function Fg(e) {
12098
12087
  return new Promise((t) => setTimeout(t, e));
12099
12088
  }
12100
12089
  //#endregion
12101
12090
  //#region src/utils/voiceClientTools.js
12102
- var Rg = /^\/[a-z]{2}(?:-[a-z]{2})?(?=\/|$)/i;
12103
- function zg(e) {
12104
- return String(e || "").replace(Rg, "").replace(/\/+$/, "").toLowerCase() || "/";
12091
+ var Ig = /^\/[a-z]{2}(?:-[a-z]{2})?(?=\/|$)/i;
12092
+ function Lg(e) {
12093
+ return String(e || "").replace(Ig, "").replace(/\/+$/, "").toLowerCase() || "/";
12105
12094
  }
12106
- function Bg(e, t) {
12107
- return zg(e) === zg(t);
12095
+ function Rg(e, t) {
12096
+ return Lg(e) === Lg(t);
12108
12097
  }
12109
12098
  function $(...e) {
12110
12099
  wn() && console.log("[FlowEngage:voice-tools]", ...e);
12111
12100
  }
12112
- function Vg(e) {
12101
+ function zg(e) {
12113
12102
  try {
12114
12103
  let t = e.ownerDocument?.defaultView;
12115
12104
  if (t) return t.getComputedStyle(e);
12116
12105
  } catch {}
12117
12106
  return window.getComputedStyle(e);
12118
12107
  }
12119
- function Hg(e) {
12108
+ function Bg(e) {
12120
12109
  let t = /* @__PURE__ */ new Set();
12121
12110
  function n(r) {
12122
12111
  if (!r || t.has(r)) return;
@@ -12129,10 +12118,10 @@ function Hg(e) {
12129
12118
  }
12130
12119
  typeof document < "u" && n(document);
12131
12120
  }
12132
- function Ug(e) {
12121
+ function Vg(e) {
12133
12122
  return e == null ? null : String(e).replace(/\u00a0/g, " ").replace(/\s*\*+\s*$/u, "").replace(/\s+/g, " ").trim();
12134
12123
  }
12135
- function Wg(e) {
12124
+ function Hg(e) {
12136
12125
  let t = e.ownerDocument || document, n = e.getAttribute("aria-labelledby");
12137
12126
  if (n) {
12138
12127
  let e = n.trim().split(/\s+/).filter(Boolean), r = [];
@@ -12140,40 +12129,40 @@ function Wg(e) {
12140
12129
  let e = t.getElementById(n);
12141
12130
  e?.textContent && r.push(e.textContent.trim());
12142
12131
  } catch {}
12143
- if (r.length) return Ug(r.join(" "));
12132
+ if (r.length) return Vg(r.join(" "));
12144
12133
  }
12145
- if (e.labels && e.labels.length) return Ug(e.labels[0].textContent);
12134
+ if (e.labels && e.labels.length) return Vg(e.labels[0].textContent);
12146
12135
  let r = e.id;
12147
12136
  if (r) try {
12148
12137
  let e = t.querySelector(`label[for="${CSS.escape(r)}"]`);
12149
- if (e) return Ug(e.textContent);
12138
+ if (e) return Vg(e.textContent);
12150
12139
  } catch {
12151
12140
  let e = t.querySelector(`label[for="${r.replace(/"/g, "\\\"")}"]`);
12152
- if (e) return Ug(e.textContent);
12141
+ if (e) return Vg(e.textContent);
12153
12142
  }
12154
12143
  let i = e.previousElementSibling;
12155
12144
  for (let e = 0; e < 6 && i; e += 1) {
12156
- if (i.tagName === "LABEL") return Ug(i.textContent);
12145
+ if (i.tagName === "LABEL") return Vg(i.textContent);
12157
12146
  let e = (i.className || "").toString().toLowerCase();
12158
12147
  if (/chakra-form__label|formlabel|field-label|form-label|mui-form-label/.test(e)) {
12159
- let e = Ug(i.textContent);
12148
+ let e = Vg(i.textContent);
12160
12149
  if (e) return e;
12161
12150
  }
12162
12151
  i = i.previousElementSibling;
12163
12152
  }
12164
12153
  let a = e.parentElement;
12165
12154
  for (let e = 0; e < 5 && a; e += 1) {
12166
- if (a.tagName === "LABEL") return Ug(a.textContent);
12155
+ if (a.tagName === "LABEL") return Vg(a.textContent);
12167
12156
  let e = a.querySelector?.(":scope > label, :scope > [class*='FormLabel'], :scope > [class*='form__label']");
12168
- if (e?.textContent) return Ug(e.textContent);
12157
+ if (e?.textContent) return Vg(e.textContent);
12169
12158
  a = a.parentElement;
12170
12159
  }
12171
12160
  let o = e.getAttribute("aria-label");
12172
- return o ? Ug(o) : null;
12161
+ return o ? Vg(o) : null;
12173
12162
  }
12174
- function Gg() {
12163
+ function Ug() {
12175
12164
  let e = [];
12176
- return Hg((t) => {
12165
+ return Bg((t) => {
12177
12166
  e.push(...Array.from(t.querySelectorAll("input, select, textarea")).filter((e) => {
12178
12167
  if (An(e)) return !1;
12179
12168
  let t = (e.type || "").toLowerCase();
@@ -12184,15 +12173,15 @@ function Gg() {
12184
12173
  "image"
12185
12174
  ].includes(t) || e.disabled || e.readOnly) return !1;
12186
12175
  try {
12187
- let t = Vg(e);
12176
+ let t = zg(e);
12188
12177
  if (t.display === "none" || t.visibility === "hidden") return !1;
12189
12178
  } catch {}
12190
12179
  return !0;
12191
12180
  }));
12192
12181
  }), e;
12193
12182
  }
12194
- function Kg() {
12195
- return Gg().map((e, t) => {
12183
+ function Wg() {
12184
+ return Ug().map((e, t) => {
12196
12185
  let n = {
12197
12186
  formIndex: 0,
12198
12187
  fieldIndex: t,
@@ -12200,7 +12189,7 @@ function Kg() {
12200
12189
  type: e.type || "text",
12201
12190
  name: e.name || null,
12202
12191
  id: e.id || null,
12203
- label: Wg(e),
12192
+ label: Hg(e),
12204
12193
  placeholder: e.placeholder || null
12205
12194
  };
12206
12195
  return e.tagName === "SELECT" && (n.options = Array.from(e.options).filter((e) => e.value !== "" && !e.disabled).map((e) => ({
@@ -12209,13 +12198,13 @@ function Kg() {
12209
12198
  })), n.currentValue = e.value || null), n;
12210
12199
  });
12211
12200
  }
12212
- function qg() {
12201
+ function Gg() {
12213
12202
  let e = [];
12214
- return Hg((t) => {
12203
+ return Bg((t) => {
12215
12204
  e.push(...Array.from(t.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"]")).filter((e) => {
12216
12205
  if (An(e) || e.disabled) return !1;
12217
12206
  try {
12218
- let t = Vg(e);
12207
+ let t = zg(e);
12219
12208
  if (t.display === "none" || t.visibility === "hidden") return !1;
12220
12209
  } catch {}
12221
12210
  return !0;
@@ -12227,7 +12216,7 @@ function qg() {
12227
12216
  type: e.type || e.tagName
12228
12217
  }));
12229
12218
  }
12230
- function Jg(e, t) {
12219
+ function Kg(e, t) {
12231
12220
  try {
12232
12221
  if (!e?.getBoundingClientRect || !t?.getBoundingClientRect) return Infinity;
12233
12222
  let n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), i = {
@@ -12242,7 +12231,7 @@ function Jg(e, t) {
12242
12231
  return Infinity;
12243
12232
  }
12244
12233
  }
12245
- function Yg(e, t) {
12234
+ function qg(e, t) {
12246
12235
  let n = String(t || "").toLowerCase().trim();
12247
12236
  if (!n) return 0;
12248
12237
  let r = (e.innerText || e.textContent || "").replace(/\s+/g, " ").trim(), i = [
@@ -12260,21 +12249,21 @@ function Yg(e, t) {
12260
12249
  for (let e of a) i.includes(e) && (o += 1);
12261
12250
  return o / a.length * 92;
12262
12251
  }
12263
- function Xg(e, t, n = 6) {
12252
+ function Jg(e, t, n = 6) {
12264
12253
  let r = String(t || "").toLowerCase().trim();
12265
12254
  if (!r) return !1;
12266
12255
  let i = e;
12267
12256
  for (let e = 0; e < n && i && (i = i.parentElement, i); e++) if ((i.innerText || i.textContent || "").toLowerCase().includes(r)) return !0;
12268
12257
  return !1;
12269
12258
  }
12270
- function Zg(e, t, n) {
12259
+ function Yg(e, t, n) {
12271
12260
  let r = [];
12272
- Hg((e) => {
12261
+ Bg((e) => {
12273
12262
  let t = Array.from(e.querySelectorAll("button, [role=\"button\"], input[type=\"submit\"], input[type=\"button\"], a[href]"));
12274
12263
  r.push(...t.filter((e) => {
12275
12264
  if (An(e) || e.disabled) return !1;
12276
12265
  try {
12277
- let t = Vg(e);
12266
+ let t = zg(e);
12278
12267
  if (t.display === "none" || t.visibility === "hidden" || t.opacity === "0") return !1;
12279
12268
  } catch {}
12280
12269
  return !0;
@@ -12282,14 +12271,14 @@ function Zg(e, t, n) {
12282
12271
  });
12283
12272
  let i = 0, a = r.map((t) => ({
12284
12273
  el: t,
12285
- s: Yg(t, e)
12274
+ s: qg(t, e)
12286
12275
  }));
12287
12276
  for (let { s: e } of a) e > i && (i = e);
12288
12277
  if (i < 28) return null;
12289
12278
  let o = a.filter(({ s: e }) => e === i).map(({ el: e }) => e);
12290
12279
  if (o.length === 1) return o[0];
12291
12280
  if (n) {
12292
- let e = o.filter((e) => Xg(e, n));
12281
+ let e = o.filter((e) => Jg(e, n));
12293
12282
  if (e.length === 1) return e[0];
12294
12283
  e.length > 1 && (o = e);
12295
12284
  }
@@ -12297,14 +12286,14 @@ function Zg(e, t, n) {
12297
12286
  if (s.length) {
12298
12287
  let e = o[0], t = Infinity;
12299
12288
  for (let n of o) for (let r of s) {
12300
- let i = Jg(n, r);
12289
+ let i = Kg(n, r);
12301
12290
  i < t && (t = i, e = n);
12302
12291
  }
12303
12292
  return e;
12304
12293
  }
12305
12294
  return o[0];
12306
12295
  }
12307
- function Qg(e) {
12296
+ function Xg(e) {
12308
12297
  if (e == null) return {};
12309
12298
  if (typeof e == "string") {
12310
12299
  let t = e.trim();
@@ -12317,12 +12306,12 @@ function Qg(e) {
12317
12306
  }
12318
12307
  return e;
12319
12308
  }
12320
- function $g(e) {
12309
+ function Zg(e) {
12321
12310
  if (!e || typeof e != "object") return null;
12322
12311
  let t = e.url ?? e.target_url ?? e.page_url ?? e.pageUrl ?? e.link ?? e.href ?? e.path;
12323
12312
  return t == null ? null : String(t).trim() || null;
12324
12313
  }
12325
- function e_() {
12314
+ function Qg() {
12326
12315
  let e = {};
12327
12316
  document.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach((t) => {
12328
12317
  if (t.id) return;
@@ -12337,7 +12326,7 @@ function e_() {
12337
12326
  e[r] = !0, t.id = r;
12338
12327
  });
12339
12328
  }
12340
- function t_() {
12329
+ function $g() {
12341
12330
  let e = (e) => {
12342
12331
  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;
12343
12332
  for (; r < t.length;) {
@@ -12392,7 +12381,7 @@ function t_() {
12392
12381
  containerHeadings: o
12393
12382
  };
12394
12383
  }
12395
- function n_(e) {
12384
+ function e_(e) {
12396
12385
  if (!e || typeof document > "u") return "";
12397
12386
  let t = new Set([
12398
12387
  "script",
@@ -12478,11 +12467,11 @@ function n_(e) {
12478
12467
  return d.has(t) ? !1 : (d.add(t), !0);
12479
12468
  }).join("\n").replace(/\n{3,}/g, "\n\n").trim();
12480
12469
  }
12481
- function r_(e) {
12470
+ function t_(e) {
12482
12471
  let t = e.siteId || null, n = (e.apiBaseUrl || "").replace(/\/$/, ""), r = typeof e.getLastUserVoiceText == "function" ? e.getLastUserVoiceText : null, i = [], a = {
12483
12472
  "fwh-navigate-mvp": async (n) => {
12484
12473
  if ($("fwh-navigate-mvp ▶ raw parameters:", n), e?.isWalkthroughActive?.()) return $("fwh-navigate-mvp ✖ blocked — walkthrough in progress"), "NAVIGATION_BLOCKED_DURING_WALKTHROUGH. A walkthrough of the current page is in progress, so navigation is not allowed. Do NOT tell the visitor you navigated or offer to. Describe the requested section using the CURRENT page's own content (fwh-read-content-mvp), then stop.";
12485
- let i = Qg(n), a = $g(i), o = i.section_text ?? i.sectionText ?? i.section, s = Array.isArray(i.expected_landmarks) ? i.expected_landmarks : Array.isArray(i.expectedLandmarks) ? i.expectedLandmarks : [];
12474
+ let i = Xg(n), a = Zg(i), o = i.section_text ?? i.sectionText ?? i.section, s = Array.isArray(i.expected_landmarks) ? i.expected_landmarks : Array.isArray(i.expectedLandmarks) ? i.expectedLandmarks : [];
12486
12475
  if ($("fwh-navigate-mvp · coerced:", {
12487
12476
  url: a,
12488
12477
  sectionText: o,
@@ -12522,18 +12511,18 @@ function r_(e) {
12522
12511
  correctedUrl: l
12523
12512
  }), a = l);
12524
12513
  try {
12525
- Sg(`Navigating to ${a}...`, { spinner: !0 }), Dg(), On();
12514
+ bg(`Navigating to ${a}...`, { spinner: !0 }), Tg(), On();
12526
12515
  try {
12527
12516
  let e = r ? r() : "";
12528
12517
  if (e && t) {
12529
- let n = _g([{
12518
+ let n = hg([{
12530
12519
  sender: "user",
12531
12520
  message: e
12532
12521
  }]);
12533
- n && I(t, n);
12522
+ n && L(t, n);
12534
12523
  }
12535
12524
  } catch {}
12536
- we();
12525
+ Ce();
12537
12526
  let e = a;
12538
12527
  try {
12539
12528
  e = new URL(a, typeof window < "u" ? window.location.href : "").href;
@@ -12543,7 +12532,7 @@ function r_(e) {
12543
12532
  let e = new URL(a, window.location.href).pathname.split("/").filter(Boolean).pop() || "";
12544
12533
  n = e ? e.replace(/[-_]/g, " ").replace(/\b\w/g, (e) => e.toUpperCase()) : "Home";
12545
12534
  } catch {}
12546
- t && typeof window < "u" && je(t, window.location.href, e, n), gr(e);
12535
+ t && typeof window < "u" && Ae(t, window.location.href, e, n), gr(e);
12547
12536
  try {
12548
12537
  window.__fe_agent_nav = {
12549
12538
  path: new URL(e, window.location.href).pathname,
@@ -12561,8 +12550,8 @@ function r_(e) {
12561
12550
  typeof window < "u" && window.scrollTo(0, 0);
12562
12551
  } catch {}
12563
12552
  let o = [], s = null, c = "", l = Date.now() + 12e3;
12564
- for (; Date.now() < l && (await new Promise((e) => setTimeout(e, 300)), {headings: o, pageTitleHeading: s, introText: c} = t_(), !(o.length >= 1)););
12565
- e_(), $("fwh-navigate-mvp → page headings collected:", o, "titleHeading:", s);
12553
+ for (; Date.now() < l && (await new Promise((e) => setTimeout(e, 300)), {headings: o, pageTitleHeading: s, introText: c} = $g(), !(o.length >= 1)););
12554
+ Qg(), $("fwh-navigate-mvp → page headings collected:", o, "titleHeading:", s);
12566
12555
  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 = "";
12567
12556
  try {
12568
12557
  if (o.length > 0) {
@@ -12570,7 +12559,7 @@ function r_(e) {
12570
12559
  for (let n of e) {
12571
12560
  let e = cr(null, n);
12572
12561
  if (e) {
12573
- let r = n_(e).substring(0, 800);
12562
+ let r = e_(e).substring(0, 800);
12574
12563
  r && t.push(`[Section: ${n}] ${r}`);
12575
12564
  }
12576
12565
  }
@@ -12579,57 +12568,57 @@ function r_(e) {
12579
12568
  } catch {}
12580
12569
  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.`;
12581
12570
  let m = Date.now() + 4e3, h = typeof window < "u" ? window.location.pathname : r;
12582
- for (; Date.now() < m && !Bg(h, e) && Bg(h, t);) await new Promise((e) => setTimeout(e, 120)), h = window.location.pathname;
12571
+ for (; Date.now() < m && !Rg(h, e) && Rg(h, t);) await new Promise((e) => setTimeout(e, 120)), h = window.location.pathname;
12583
12572
  $("fwh-navigate-mvp route settle:", {
12584
12573
  startPath: t,
12585
12574
  targetPath: e,
12586
12575
  settledPath: h
12587
12576
  });
12588
- 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 = Bg(h, e), y = !Bg(h, t), b = v || y;
12577
+ 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 = Rg(h, e), y = !Rg(h, t), b = v || y;
12589
12578
  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.`);
12590
12579
  } catch {}
12591
12580
  return "OK_NAVIGATE_RELOADING. The page is reloading now and this session is ending. Say NOTHING further — do not confirm the navigation, do not describe the page. The arrival greeting is spoken automatically on the new page; you resume from the visitor's next reply.";
12592
12581
  } catch (e) {
12593
12582
  let t = `Navigation error: ${e?.message || String(e)}`;
12594
- return $("fwh-navigate-mvp ✖", t), Sg("Navigation failed", {
12583
+ return $("fwh-navigate-mvp ✖", t), bg("Navigation failed", {
12595
12584
  spinner: !1,
12596
12585
  icon: "⚠️",
12597
12586
  duration: 1800
12598
12587
  }), t;
12599
12588
  } finally {
12600
- Og(), Cg(900);
12589
+ Eg(), xg(900);
12601
12590
  }
12602
12591
  },
12603
12592
  "fwh-highlight-mvp": async (e) => {
12604
12593
  $("fwh-highlight-mvp ▶", e);
12605
- let t = Qg(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText;
12594
+ let t = Xg(e), n = t?.section_id || t?.sectionId, r = t?.section_text || t?.sectionText;
12606
12595
  if (Rn(3e3), typeof window < "u" && window.__fe_user_nav_during_speech) {
12607
12596
  let e = window.__fe_user_nav_during_speech, t = window.location.pathname;
12608
12597
  if (Date.now() - e.ts >= 3e4) window.__fe_user_nav_during_speech = null;
12609
12598
  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 fwh-highlight-mvp 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.`;
12610
12599
  }
12611
- e_();
12600
+ Qg();
12612
12601
  let i = ((e) => e && e.replace(/^\d+\.\s*/, "").replace(/^["']|["']$/g, "").trim())(r), a = cr(n || null, i || null);
12613
12602
  if (!a && i) {
12614
12603
  let e = Date.now() + 600;
12615
- for (; !a && Date.now() < e;) await new Promise((e) => setTimeout(e, 50)), e_(), a = cr(null, i);
12604
+ for (; !a && Date.now() < e;) await new Promise((e) => setTimeout(e, 50)), Qg(), a = cr(null, i);
12616
12605
  }
12617
12606
  if (!a) {
12618
12607
  $("fwh-highlight-mvp ✖ no element for:", i || n);
12619
- let { headings: e } = t_(), 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.";
12608
+ let { headings: e } = $g(), 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.";
12620
12609
  return `HIGHLIGHT_NOT_FOUND: "${i || n}" on the current page. ${t}`;
12621
12610
  }
12622
12611
  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.`;
12623
12612
  },
12624
12613
  "fwh-read-content-mvp": async (e) => {
12625
12614
  $("fwh-read-content-mvp ▶", e);
12626
- let t = Qg(e), n = t?.section_text || t?.sectionText || "";
12615
+ let t = Xg(e), n = t?.section_text || t?.sectionText || "";
12627
12616
  try {
12628
12617
  let e = "";
12629
12618
  if (n) {
12630
12619
  let t = cr(null, n);
12631
12620
  if (!t) return `Could not find section "${n}" on the page.`;
12632
- e = n_(t);
12621
+ e = e_(t);
12633
12622
  } else {
12634
12623
  let t = (document.querySelector("main") || document.querySelector("article") || document.querySelector("[role=\"main\"]") || document.querySelector("#content") || document.querySelector(".content") || document.body).cloneNode(!0);
12635
12624
  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();
@@ -12641,7 +12630,7 @@ function r_(e) {
12641
12630
  },
12642
12631
  "fwh-page-content-mvp": async (e) => {
12643
12632
  $("fwh-page-content-mvp ▶", e);
12644
- let r = Qg(e), i = r?.url || r?.page_url || "";
12633
+ let r = Xg(e), i = r?.url || r?.page_url || "";
12645
12634
  if ($("fwh-page-content-mvp · url:", i, "siteId:", t, "apiBase:", n || "(empty)"), !i) return $("fwh-page-content-mvp ✖ missing url"), "Missing url parameter.";
12646
12635
  if (!t) return $("fwh-page-content-mvp ✖ no siteId"), "Site is not configured.";
12647
12636
  if (!n) return $("fwh-page-content-mvp ✖ no api base"), "API base URL is missing; cannot fetch page content.";
@@ -12673,7 +12662,7 @@ function r_(e) {
12673
12662
  },
12674
12663
  "fwh-search-mvp": async (e) => {
12675
12664
  $("fwh-search-mvp ▶", e);
12676
- let r = Qg(e).query;
12665
+ let r = Xg(e).query;
12677
12666
  if (!r) return $("fwh-search-mvp ✖ missing query"), "Missing query parameter.";
12678
12667
  if (!t) return $("fwh-search-mvp ✖ no siteId"), "Search unavailable (no siteId configured).";
12679
12668
  if (!n) return $("fwh-search-mvp ✖ no api base"), "Search unavailable (no API base URL).";
@@ -12711,7 +12700,7 @@ function r_(e) {
12711
12700
  "[class*='menu'] a",
12712
12701
  "[class*='header'] a"
12713
12702
  ];
12714
- if (Hg((t) => {
12703
+ if (Bg((t) => {
12715
12704
  for (let r of n) try {
12716
12705
  t.querySelectorAll(r).forEach((t) => {
12717
12706
  if (An(t)) return;
@@ -12719,7 +12708,7 @@ function r_(e) {
12719
12708
  if (!r || !n || n === "#" || n.startsWith("javascript:")) return;
12720
12709
  try {
12721
12710
  let e = t.parentElement;
12722
- if (e && Vg(e).display === "none" && !e.closest("nav, [role='navigation'], header, [class*='nav'], [class*='menu']")) return;
12711
+ if (e && zg(e).display === "none" && !e.closest("nav, [role='navigation'], header, [class*='nav'], [class*='menu']")) return;
12723
12712
  } catch {}
12724
12713
  let i = r.toLowerCase() + "|" + n;
12725
12714
  e.has(i) || e.set(i, {
@@ -12730,7 +12719,7 @@ function r_(e) {
12730
12719
  } catch {}
12731
12720
  t.querySelectorAll("select").forEach((t) => {
12732
12721
  if (An(t)) return;
12733
- let n = Wg(t);
12722
+ let n = Hg(t);
12734
12723
  /nav|menu|page|section|go to/i.test(n || t.name || t.id || "") && Array.from(t.options).forEach((r) => {
12735
12724
  if (!r.value || r.disabled) return;
12736
12725
  let i = r.text.trim();
@@ -12754,7 +12743,7 @@ function r_(e) {
12754
12743
  if ($("fwh-get-current-page-mvp ▶"), typeof window > "u") return "Cannot determine current page (no browser context).";
12755
12744
  let e = window.location.href, t = window.location.pathname, n = document.title || "";
12756
12745
  if (yr()) return $("fwh-get-current-page-mvp ✓ 404 detected", { url: e }), `CURRENT_PAGE_NOT_FOUND. The visitor is currently on a 404 / page-not-found error page (${e}). There is no real content here. Do NOT describe this page, do NOT list sections, do NOT offer a walkthrough, and do NOT describe it from your own knowledge. Tell the visitor plainly that the page they are on doesn't exist, and offer to take them somewhere that does.`;
12757
- let { headings: r, pageTitleHeading: i, introText: a } = t_();
12746
+ let { headings: r, pageTitleHeading: i, introText: a } = $g();
12758
12747
  $("fwh-get-current-page-mvp ✓", {
12759
12748
  url: e,
12760
12749
  path: t,
@@ -12766,7 +12755,7 @@ function r_(e) {
12766
12755
  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. ***`;
12767
12756
  },
12768
12757
  "fwh-list-forms-mvp": async () => {
12769
- let e = Kg(), t = qg();
12758
+ let e = Wg(), t = Gg();
12770
12759
  $("fwh-list-forms-mvp ✓", `${e.length} field(s)`, `${t.length} button(s)`);
12771
12760
  let n = e.map((e) => ({
12772
12761
  ...e,
@@ -12780,12 +12769,12 @@ function r_(e) {
12780
12769
  },
12781
12770
  "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.",
12782
12771
  "fwh-click-button-mvp": async (e) => {
12783
- let t = Qg(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim(), r = (t.card_context ?? t.cardContext ?? "").trim();
12772
+ let t = Xg(e), n = (t.button_text ?? t.buttonText ?? t.text ?? "").trim(), r = (t.card_context ?? t.cardContext ?? "").trim();
12784
12773
  if ($("fwh-click-button-mvp ▶", n, r ? `(card_context: ${r})` : ""), !n) return "Missing button_text: pass the visible label, e.g. Conduct Audit.";
12785
- let a = Zg(n, i, r);
12774
+ let a = Yg(n, i, r);
12786
12775
  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.`;
12787
12776
  try {
12788
- Sg(`Clicking ${n}...`, { spinner: !0 });
12777
+ bg(`Clicking ${n}...`, { spinner: !0 });
12789
12778
  try {
12790
12779
  a.scrollIntoView({
12791
12780
  block: "center",
@@ -12794,22 +12783,22 @@ function r_(e) {
12794
12783
  } catch {
12795
12784
  a.scrollIntoView(!0);
12796
12785
  }
12797
- await Ng(a), a.focus?.(), await Fg(a), Ig(a), a.click();
12786
+ await jg(a), a.focus?.(), await Ng(a), Pg(a), a.click();
12798
12787
  let e = (a.textContent || a.value || a.getAttribute("aria-label") || "").trim().slice(0, 80) || "button", t = `OK_CLICK ${e}`;
12799
- return $("fwh-click-button-mvp ✓", t), Sg(`Clicked ${e}`, {
12788
+ return $("fwh-click-button-mvp ✓", t), bg(`Clicked ${e}`, {
12800
12789
  spinner: !1,
12801
12790
  icon: "✅",
12802
12791
  duration: 1200
12803
12792
  }), t;
12804
12793
  } catch (e) {
12805
12794
  let t = `Click failed: ${e?.message || String(e)}`;
12806
- return $("fwh-click-button-mvp ✖", t), Sg("Click failed", {
12795
+ return $("fwh-click-button-mvp ✖", t), bg("Click failed", {
12807
12796
  spinner: !1,
12808
12797
  icon: "⚠️",
12809
12798
  duration: 1800
12810
12799
  }), t;
12811
12800
  } finally {
12812
- Pg(), Cg(700);
12801
+ Mg(), xg(700);
12813
12802
  }
12814
12803
  },
12815
12804
  "fwh-cart-get-mvp": async () => {
@@ -12908,7 +12897,7 @@ function r_(e) {
12908
12897
  try {
12909
12898
  r = new URL(e, window.location.href).href;
12910
12899
  } catch {}
12911
- return t && je(t, window.location.href, r, n), gr(r), Cr().then(() => {
12900
+ return t && Ae(t, window.location.href, r, n), gr(r), Cr().then(() => {
12912
12901
  window.location.assign(r);
12913
12902
  }), `OK_NAVIGATING to ${n}. The page is loading — say one short phrase like "Here you go." and nothing more.`;
12914
12903
  }
@@ -12922,10 +12911,10 @@ function r_(e) {
12922
12911
  clickPageButton: a["fwh-click-button-mvp"]
12923
12912
  };
12924
12913
  }
12925
- var i_ = /^(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;
12926
- function a_() {
12914
+ var n_ = /^(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;
12915
+ function r_() {
12927
12916
  try {
12928
- let { headings: e, pageTitleHeading: t, containerHeadings: n } = t_(), r = new Set((n || []).map((e) => e.trim())), i = (e || []).map((e) => typeof e == "string" ? e : e?.text || "").filter(Boolean).filter((e) => !t || e.trim() !== t.trim()).filter((e) => !i_.test(e.trim())), a = i.filter((e) => !r.has(e.trim()));
12917
+ let { headings: e, pageTitleHeading: t, containerHeadings: n } = $g(), r = new Set((n || []).map((e) => e.trim())), i = (e || []).map((e) => typeof e == "string" ? e : e?.text || "").filter(Boolean).filter((e) => !t || e.trim() !== t.trim()).filter((e) => !n_.test(e.trim())), a = i.filter((e) => !r.has(e.trim()));
12929
12918
  return a.length ? a : i;
12930
12919
  } catch {
12931
12920
  return [];
@@ -12933,7 +12922,7 @@ function a_() {
12933
12922
  }
12934
12923
  //#endregion
12935
12924
  //#region src/utils/wrapVoiceToolsForLogging.js
12936
- function o_(e) {
12925
+ function i_(e) {
12937
12926
  return !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, async (n) => {
12938
12927
  let r = wn();
12939
12928
  r ? console.log("[FlowEngage:voice-tool] ▶", e, n) : console.info(`[FlowEngage] voice tool » ${e}`);
@@ -12950,11 +12939,11 @@ function o_(e) {
12950
12939
  }
12951
12940
  //#endregion
12952
12941
  //#region src/components/FlowEngageWidget.jsx
12953
- var s_ = "[PAGE_CONTEXT]";
12954
- function c_(e, t, n) {
12955
- return `${s_} SESSION_CONTEXT (NOT a tool result — do NOT treat as CURRENT_PAGE): Visitor is on: ${e} | Approx headings for awareness only: ${t || ""}. ${n ? `Forms: ${n}. ` : ""}The visitor is ALREADY on this page — do NOT offer to navigate there.`;
12942
+ var a_ = "[PAGE_CONTEXT]";
12943
+ function o_(e, t, n) {
12944
+ return `${a_} SESSION_CONTEXT (NOT a tool result — do NOT treat as CURRENT_PAGE): Visitor is on: ${e} | Approx headings for awareness only: ${t || ""}. ${n ? `Forms: ${n}. ` : ""}The visitor is ALREADY on this page — do NOT offer to navigate there.`;
12956
12945
  }
12957
- var l_ = {
12946
+ var s_ = {
12958
12947
  blue: "#135bd8",
12959
12948
  red: "#ef334b",
12960
12949
  yellow: "#ffbd2e",
@@ -12962,7 +12951,7 @@ var l_ = {
12962
12951
  highlight: "rgba(255,255,255,0.9)",
12963
12952
  green: "#10b981"
12964
12953
  };
12965
- function u_(e) {
12954
+ function c_(e) {
12966
12955
  if (!Array.isArray(e) || e.length < 2) return "linear-gradient(145deg, #dce8f022 0%, #e8dff522 45%, #f5e0e022 100%), #f7f8fa";
12967
12956
  let [t, n, r] = e;
12968
12957
  return e.length >= 3 && r ? [
@@ -12976,12 +12965,12 @@ function u_(e) {
12976
12965
  "#f7f8fa"
12977
12966
  ].join(", ");
12978
12967
  }
12979
- function d_(e) {
12968
+ function l_(e) {
12980
12969
  if (!e || typeof e != "string") return "#1a1a1a";
12981
12970
  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;
12982
12971
  return .2126 * o(r) + .7152 * o(i) + .0722 * o(a) > .179 ? "#1a1a1a" : "#ffffff";
12983
12972
  }
12984
- function f_(t) {
12973
+ function u_(t) {
12985
12974
  let [n, r] = e.useState(null), i = typeof t == "string" ? t.trim() : "";
12986
12975
  return e.useEffect(() => {
12987
12976
  if (!i) {
@@ -12999,8 +12988,8 @@ function f_(t) {
12999
12988
  };
13000
12989
  }, [i]), n;
13001
12990
  }
13002
- function p_({ logo: t, style: n }) {
13003
- let r = f_(typeof t == "string" ? t : null);
12991
+ function d_({ logo: t, style: n }) {
12992
+ let r = u_(typeof t == "string" ? t : null);
13004
12993
  if (!t) return null;
13005
12994
  if (typeof t == "string") return r ? /* @__PURE__ */ g("img", {
13006
12995
  src: r,
@@ -13025,7 +13014,7 @@ function p_({ logo: t, style: n }) {
13025
13014
  children: i
13026
13015
  }) : null;
13027
13016
  }
13028
- function m_({ title: e }) {
13017
+ function f_({ title: e }) {
13029
13018
  return /* @__PURE__ */ g("div", {
13030
13019
  style: {
13031
13020
  width: "100%",
@@ -13043,18 +13032,18 @@ function m_({ title: e }) {
13043
13032
  children: String(e || "FE").split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0]?.toUpperCase() || "").join("") || "FE"
13044
13033
  });
13045
13034
  }
13046
- function h_(e, t) {
13035
+ function p_(e, t) {
13047
13036
  let n = (t || "").trim();
13048
13037
  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;
13049
13038
  }
13050
- function g_({ orbColors: e, ...t }) {
13051
- return /* @__PURE__ */ g(cg, {
13039
+ function m_({ orbColors: e, ...t }) {
13040
+ return /* @__PURE__ */ g(og, {
13052
13041
  colors: e,
13053
13042
  ...t
13054
13043
  });
13055
13044
  }
13056
- function __({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
13057
- let s = n || l_.green, c = d_(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
13045
+ function h_({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMobile: a, isClosing: o }) {
13046
+ let s = n || s_.green, c = l_(s), l = a ? 72 : 94, u = /* @__PURE__ */ _("div", {
13058
13047
  style: {
13059
13048
  display: "flex",
13060
13049
  alignItems: a ? "flex-end" : "center",
@@ -13180,7 +13169,7 @@ function __({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
13180
13169
  delay: 0
13181
13170
  },
13182
13171
  style: { flexShrink: 0 },
13183
- children: /* @__PURE__ */ g(g_, {
13172
+ children: /* @__PURE__ */ g(m_, {
13184
13173
  size: l,
13185
13174
  orbColors: t
13186
13175
  })
@@ -13212,8 +13201,8 @@ function __({ copy: e, orbColors: t, primaryColor: n, onYes: r, onLater: i, isMo
13212
13201
  children: u
13213
13202
  })] });
13214
13203
  }
13215
- function v_({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
13216
- let c = n || l_.green, l = d_(c);
13204
+ function g_({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onClose: a, isMobile: o, isClosing: s }) {
13205
+ let c = n || s_.green, l = l_(c);
13217
13206
  return /* @__PURE__ */ _(eh.div, {
13218
13207
  initial: {
13219
13208
  scale: 50 / 350,
@@ -13284,7 +13273,7 @@ function v_({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
13284
13273
  children: /* @__PURE__ */ g("polyline", { points: "6 9 12 15 18 9" })
13285
13274
  })
13286
13275
  }),
13287
- /* @__PURE__ */ g(g_, {
13276
+ /* @__PURE__ */ g(m_, {
13288
13277
  size: 72,
13289
13278
  orbColors: t
13290
13279
  }),
@@ -13364,50 +13353,55 @@ function v_({ copy: e, orbColors: t, primaryColor: n, onVoice: r, onText: i, onC
13364
13353
  ]
13365
13354
  });
13366
13355
  }
13367
- function y_({ 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...", thinkingLabel: S = "Thinking...", enterChatModeLabel: C = "Enter Chat Mode", endConversationLabel: w = "End Conversation" }) {
13356
+ function __({ 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...", thinkingLabel: S = "Thinking...", enterChatModeLabel: C = "Enter Chat Mode", endConversationLabel: w = "End Conversation" }) {
13368
13357
  c(() => (console.log("[FlowEngage:VoiceDebug] 🔵 VoiceMode MOUNTED"), () => console.log("[FlowEngage:VoiceDebug] 🔴 VoiceMode UNMOUNTED")), []);
13369
- let [T, E] = m("idle"), [D, O] = m(!1), [k, A] = m(!1), [ee, te] = m(!1), [ne, j] = m(""), [M, re] = m(""), ie = p(!1), ae = p(!1), N = p(null), oe = p(0), se = p(""), ce = p(!1), le = p(0), ue = p(!1), de = p(!1), fe = p(!1), pe = p([]), me = p(null), he = (e) => {
13370
- ue.current = e, e || (de.current = !1), P.current?.setWalkthroughActive?.(e);
13358
+ let [T, E] = m("idle"), [D, O] = m(!1), [k, A] = m(!1), [ee, te] = m(!1), [ne, j] = m(""), [M, re] = m(""), ie = p(!1), ae = p(!1), N = p(null), oe = p(0), se = p(""), P = p(!1), ce = p(0), le = p(!1), ue = p(!1), de = p(!1), fe = p([]), pe = p(null), me = p(null), he = (e) => {
13359
+ le.current = e, e || (ue.current = !1), F.current?.setWalkthroughActive?.(e);
13371
13360
  };
13372
13361
  me.current = async () => {
13373
- if (de.current) return;
13374
- let e = pe.current;
13362
+ if (ue.current) return;
13363
+ let e = typeof window < "u" ? window.location.pathname : null;
13364
+ if (e && pe.current && e !== pe.current) {
13365
+ console.log("[FlowEngage] walkthrough ended — visitor left " + pe.current), pe.current = null, fe.current = [], he(!1);
13366
+ return;
13367
+ }
13368
+ let t = fe.current;
13375
13369
  ge.current += 1;
13376
- let t = ge.current, n = e[t];
13377
- if (!n) {
13378
- if (he(!1), e.length) P.current?.sendUserMessage?.("That was the last section. Say so in one short sentence and ask if they want to explore any section further.");
13379
- else if (t === 0) {
13370
+ let n = ge.current, r = t[n];
13371
+ if (!r) {
13372
+ if (he(!1), t.length) F.current?.sendUserMessage?.("That was the last section. Say so in one short sentence and ask if they want to explore any section further.");
13373
+ else if (n === 0) {
13380
13374
  let e = "";
13381
13375
  try {
13382
13376
  let t = await _e.current?.["fwh-read-content-mvp"]?.({});
13383
13377
  typeof t == "string" && t && !/^Could not/i.test(t) && (e = t.slice(0, 2800));
13384
13378
  } catch {}
13385
- P.current?.sendUserMessage?.(e ? `Give the visitor a complete spoken overview of this page in 4-6 sentences, based ONLY on this page content:\n"""${e}"""\nThen ask which part they'd like to hear more about. Do not call any tool.` : "Give the visitor a complete spoken overview of this page in 4-6 sentences based on what you know about it, then ask which part they'd like to hear more about. Do not call any tool.", { suppressQuestion: !0 });
13379
+ F.current?.sendUserMessage?.(e ? `Give the visitor a complete spoken overview of this page in 4-6 sentences, based ONLY on this page content:\n"""${e}"""\nThen ask which part they'd like to hear more about. Do not call any tool.` : "Give the visitor a complete spoken overview of this page in 4-6 sentences based on what you know about it, then ask which part they'd like to hear more about. Do not call any tool.", { suppressQuestion: !0 });
13386
13380
  }
13387
13381
  return;
13388
13382
  }
13389
13383
  try {
13390
- await _e.current?.highlightOnPage?.({ section_text: n });
13384
+ await _e.current?.highlightOnPage?.({ section_text: r });
13391
13385
  } catch (e) {
13392
13386
  console.warn("[FlowEngage] walkthrough highlight failed:", e?.message || e);
13393
13387
  }
13394
- console.debug(`[FlowEngage] walkthrough step ${t + 1}/${e.length}: ${n}`);
13395
- let r = "";
13388
+ console.debug(`[FlowEngage] walkthrough step ${n + 1}/${t.length}: ${r}`);
13389
+ let i = "";
13396
13390
  try {
13397
- let e = await _e.current?.["fwh-read-content-mvp"]?.({ section_text: n });
13398
- typeof e == "string" && e && !/^Could not/i.test(e) && (r = e.slice(0, 2500));
13391
+ let e = await _e.current?.["fwh-read-content-mvp"]?.({ section_text: r });
13392
+ typeof e == "string" && e && !/^Could not/i.test(e) && (i = e.slice(0, 2500));
13399
13393
  } catch {}
13400
- let i = r ? `Here is this section's full content — describe it from THIS text only, and do not call any tool:\n"""${r}"""\n` : "read the section's content silently first (fwh-read-content-mvp) if you don't already have it. ";
13401
- P.current?.sendUserMessage?.(`Describe the section titled "${n}" in 3-4 sentences, starting with ${t === 0 ? "Starting with" : "Next —"} ${n}. Describe ONLY this section. If this section contains named sub-items (steps, checklist entries, cards, plans, FAQs, team members), name EVERY one of them in order with a short phrase each — never skip or collapse them into a summary; ` + i + "This section is ON THE PAGE THE VISITOR IS ALREADY ON — do NOT call fwh-navigate-mvp, do not go to a product/detail page, and do not offer to, even if this section's name also matches a page name. Do not mention any other section, do not ask whether to continue, then stop.", { suppressQuestion: !0 });
13394
+ let a = i ? `Here is this section's full content — describe it from THIS text only, and do not call any tool:\n"""${i}"""\n` : "read the section's content silently first (fwh-read-content-mvp) if you don't already have it. ";
13395
+ F.current?.sendUserMessage?.(`Describe the section titled "${r}" in 3-4 sentences, starting with ${n === 0 ? "Starting with" : "Next —"} ${r}. Describe ONLY this section. If this section contains named sub-items (steps, checklist entries, cards, plans, FAQs, team members), name EVERY one of them in order with a short phrase each — never skip or collapse them into a summary; ` + a + "This section is ON THE PAGE THE VISITOR IS ALREADY ON — do NOT call fwh-navigate-mvp, do not go to a product/detail page, and do not offer to, even if this section's name also matches a page name. Do not mention any other section, do not ask whether to continue, then stop.", { suppressQuestion: !0 });
13402
13396
  };
13403
- let ge = p(0), P = p(null), _e = p(null), ve = p(""), ye = p(async () => {}), be = p(!1), F = p(!1), xe = p(!1), L = p(!1), Te = p("minimized"), Ee = p(null), De = p(null), Oe = p(null), Ae = p(0), je = p(!1), R = p("idle"), z = p(null), Ne = p(!1), Pe = p(null), Fe = o((e = "minimized") => {
13397
+ let ge = p(0), F = p(null), _e = p(null), ve = p(""), ye = p(async () => {}), I = p(!1), be = p(!1), R = p(!1), we = p(!1), Te = p("minimized"), Ee = p(null), De = p(null), ke = p(null), Ae = p(0), Me = p(!1), z = p("idle"), Ne = p(null), Pe = p(!1), Fe = p(null), B = o((e = "minimized") => {
13404
13398
  console.warn("[FlowEngage:VoiceDebug] 🛑 requestSessionShutdown called", {
13405
13399
  destination: e,
13406
13400
  stack: (/* @__PURE__ */ Error()).stack?.split("\n").slice(1, 4).join(" | ")
13407
- }), Te.current = e, L.current = !0, queueMicrotask(() => {
13408
- be.current || (be.current = !0, ye.current?.());
13401
+ }), Te.current = e, we.current = !0, queueMicrotask(() => {
13402
+ I.current || (I.current = !0, ye.current?.());
13409
13403
  });
13410
- }, [l]), B = o(() => {
13404
+ }, [l]), V = o(() => {
13411
13405
  N.current &&= (clearTimeout(N.current), null);
13412
13406
  }, []);
13413
13407
  c(() => {
@@ -13415,38 +13409,38 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13415
13409
  ie.current = !1;
13416
13410
  return;
13417
13411
  }
13418
- if (ie.current = !0, ae.current = !1, te(!1), B(), ce.current) {
13419
- ce.current = !1, P.current?.setMicMuted?.(!1);
13412
+ if (ie.current = !0, ae.current = !1, te(!1), V(), P.current) {
13413
+ P.current = !1, F.current?.setMicMuted?.(!1);
13420
13414
  let e = se.current;
13421
- se.current = "", P.current?.injectAgentSpeech?.("Thanks — I already have your email on file.", "interrupt"), e && P.current?.sendUserMessage?.(`The visitor's email is already on file — do not ask for it. Answer their question now: "${e}"`);
13415
+ se.current = "", F.current?.injectAgentSpeech?.("Thanks — I already have your email on file.", "interrupt"), e && F.current?.sendUserMessage?.(`The visitor's email is already on file — do not ask for it. Answer their question now: "${e}"`);
13422
13416
  }
13423
- P.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.");
13424
- }, [y, B]);
13425
- let V = /(walk\s*(me\s*)?through|walkthrough|take me through|(complete|full|detailed) (overview|understanding|walkthrough|picture|breakdown|explanation)|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|explain (me )?(this|the) (whole |entire |full )?page|everything (about|on) this page|show me (each|all|around))/i, Ie = /(that covers everything|that was all|covered everything|that(?:'|’)?s everything)/i, Le = /^((uh+|um+|so|well|okay|ok|yeah)[,.\s]+)*(yes|yeah|yep|yup|sure|ok(ay)?|please|continue|go on|next|keep going|carry on|go ahead|resume|back to the tour)[\s.!,]*$/i, Re = o(() => {
13426
- B(), N.current = setTimeout(() => {
13417
+ F.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.");
13418
+ }, [y, V]);
13419
+ let Ie = /(walk\s*(me\s*)?through|walkthrough|take me through|(complete|full|detailed) (overview|understanding|walkthrough|picture|breakdown|explanation)|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|explain (me )?(this|the) (whole |entire |full )?page|everything (about|on) this page|show me (each|all|around))/i, Le = /(that covers everything|that was all|covered everything|that(?:'|’)?s everything)/i, Re = /^((uh+|um+|so|well|okay|ok|yeah)[,.\s]+)*(yes|yeah|yep|yup|sure|ok(ay)?|please|continue|go on|next|keep going|carry on|go ahead|resume|back to the tour)[\s.!,]*$/i, ze = /^((uh+|um+|oh|ah|so|well)[,.\s]+)*(cool|nice|great|awesome|wow|lovely|perfect|got it|gotcha|i see|understood|makes sense|interesting|right|alright|sounds good|mm+-?hmm+|hmm+|k)[\s.!,]*$/i, Be = (e) => String(e || "").replace(/[\s.,!?]*((uh+|um+|er+|hmm+|mm+)[\s.,!?]*)+$/i, "").trim(), Ve = o(() => {
13420
+ V(), N.current = setTimeout(() => {
13427
13421
  if (!(!ae.current || ie.current)) if (oe.current < 3) {
13428
13422
  oe.current += 1;
13429
13423
  try {
13430
- P.current?.injectAgentSpeech?.("I still need your email in the box below to continue — could you enter it, please?", "queue");
13424
+ F.current?.injectAgentSpeech?.("I still need your email in the box below to continue — could you enter it, please?", "queue");
13431
13425
  } catch {}
13432
- Re();
13426
+ Ve();
13433
13427
  } else {
13434
13428
  try {
13435
- P.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");
13429
+ F.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");
13436
13430
  } catch {}
13437
- ae.current = !1, te(!1), B(), je.current = !0;
13431
+ ae.current = !1, te(!1), V(), Me.current = !0;
13438
13432
  }
13439
13433
  }, 1e4);
13440
- }, [B]), ze = o(async (e) => {
13441
- L.current = !0;
13434
+ }, [V]), He = o(async (e) => {
13435
+ we.current = !0;
13442
13436
  try {
13443
13437
  On();
13444
13438
  } catch {}
13445
13439
  if (i) try {
13446
- Me(i);
13440
+ je(i);
13447
13441
  } catch {}
13448
13442
  try {
13449
- await P.current?.endSession?.();
13443
+ await F.current?.endSession?.();
13450
13444
  } catch {}
13451
13445
  let t = Ee.current, n = De.current;
13452
13446
  if (t && s && a) {
@@ -13462,8 +13456,8 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13462
13456
  })
13463
13457
  }).catch((e) => console.warn("[FlowEngage] save-chat-recording failed:", e.message));
13464
13458
  }
13465
- if (Ee.current = null, De.current = null, P.current = null, E("idle"), O(!1), be.current = !1, Or(), i) try {
13466
- Ce(i);
13459
+ if (Ee.current = null, De.current = null, F.current = null, E("idle"), O(!1), I.current = !1, Or(), i) try {
13460
+ Se(i);
13467
13461
  } catch {}
13468
13462
  typeof u == "function" && await u(l.current), e?.();
13469
13463
  }, [
@@ -13473,10 +13467,10 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13473
13467
  s,
13474
13468
  a
13475
13469
  ]);
13476
- ye.current = () => ze(Te.current === "chat" ? t : n), c(() => {
13477
- F.current = D;
13470
+ ye.current = () => He(Te.current === "chat" ? t : n), c(() => {
13471
+ be.current = D;
13478
13472
  }, [D]), c(() => {
13479
- d && Fe("chat");
13473
+ d && B("chat");
13480
13474
  }, [d]), c(() => {
13481
13475
  let e = !1, o = null, c = null, d = null;
13482
13476
  return (async () => {
@@ -13486,10 +13480,10 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13486
13480
  }
13487
13481
  try {
13488
13482
  if ((await navigator.mediaDevices.getUserMedia({ audio: !0 })).getTracks().forEach((e) => e.stop()), e) return;
13489
- l.current = [], ve.current = "", be.current = !1, xe.current = !1, L.current = !1, Te.current = "minimized", Dr({ onBeforeNavigate: () => {
13483
+ l.current = [], ve.current = "", I.current = !1, R.current = !1, we.current = !1, Te.current = "minimized", Dr({ onBeforeNavigate: () => {
13490
13484
  if (i && l.current.length > 0) try {
13491
- let e = _g(l.current);
13492
- e && I(i, e);
13485
+ let e = hg(l.current);
13486
+ e && L(i, e);
13493
13487
  } catch {}
13494
13488
  if (!qn()) {
13495
13489
  let e = Ee.current, t = De.current;
@@ -13508,21 +13502,21 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13508
13502
  }).catch(() => {}), Ee.current = null, De.current = null;
13509
13503
  } catch {}
13510
13504
  }
13511
- we();
13505
+ Ce();
13512
13506
  } });
13513
- let t = o_(r_({
13507
+ let t = i_(t_({
13514
13508
  siteId: i || null,
13515
13509
  apiBaseUrl: a || null,
13516
13510
  chatId: s || null,
13517
13511
  getLastUserVoiceText: () => ve.current,
13518
- isWalkthroughActive: () => ue.current && !de.current,
13512
+ isWalkthroughActive: () => le.current && !ue.current,
13519
13513
  requestEndSession: () => {
13520
- je.current = !0;
13514
+ Me.current = !0;
13521
13515
  },
13522
13516
  requestEmailCollection: () => {
13523
- b && (ie.current || ae.current || (ae.current = !0, oe.current = 0, te(!0), Re()));
13517
+ b && (ie.current || ae.current || (ae.current = !0, oe.current = 0, te(!0), Ve()));
13524
13518
  }
13525
- })), n = i ? Se(i) : null, r = !!n?.transcript, u = i ? Me(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 = {
13519
+ })), n = i ? xe(i) : null, r = !!n?.transcript, u = i ? je(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 = {
13526
13520
  apiBaseUrl: a,
13527
13521
  siteId: i,
13528
13522
  chatId: s,
@@ -13555,123 +13549,123 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13555
13549
  let e = f || "";
13556
13550
  x.greeting = h || (v ? e ? `Hi, welcome to ${e}! How may I help you?` : "Hi, welcome! How may I help you?" : `Welcome to ${T}! How may I help you?`), v || console.log(`[FlowEngage] 🏠 Page-context greeting: "${w}" for ${m}`);
13557
13551
  }
13558
- let A = !1, ee = p ? `NAVIGATION COMPLETE — The exact phrase "I have navigated you to the [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, ne = !1, j = !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, M = r && !p, re = !1, N = M ? `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, ye = !1, Ce = !1, Oe = b && !!y && !fe.current, ze = await bh.startSession({
13552
+ let A = !1, ee = p ? `NAVIGATION COMPLETE — The exact phrase "I have navigated you to the [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, ne = !1, j = !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, M = r && !p, re = !1, N = M ? `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, ye = !1, Se = !1, ke = b && !!y && !de.current, He = await vh.startSession({
13559
13553
  ...x,
13560
13554
  onConnect: ({ conversationId: e }) => {
13561
13555
  Ee.current = e, De.current = Date.now(), console.log("[FlowEngage] 🎙️ AI chat session connected:", e);
13562
13556
  },
13563
13557
  onUnhandledClientToolCall: (e) => console.error("[FlowEngage] Unhandled tool:", e?.tool_name),
13564
13558
  onSessionInfo: ({ emailOnFile: e }) => {
13565
- fe.current = !!e, e && (ie.current = !0, ae.current = !1, te(!1), B(), console.log("[FlowEngage] email already on file per server — gate disabled"));
13559
+ de.current = !!e, e && (ie.current = !0, ae.current = !1, te(!1), V(), console.log("[FlowEngage] email already on file per server — gate disabled"));
13566
13560
  },
13567
13561
  onAgentTurnEnd: () => {
13568
- e || ue.current && (de.current || ce.current || setTimeout(() => me.current?.(), 250));
13562
+ e || le.current && (ue.current || P.current || setTimeout(() => me.current?.(), 250));
13569
13563
  },
13570
13564
  onSessionEnding: () => {
13571
- e || Fe("minimized");
13565
+ e || B("minimized");
13572
13566
  },
13573
13567
  onModeChange: ({ mode: t, tentative: n }) => {
13574
13568
  if (!e) {
13575
13569
  if (t === "speaking") {
13576
- z.current &&= (clearTimeout(z.current), null), Pe.current &&= (clearTimeout(Pe.current), null), E("speaking"), R.current = "speaking", Ne.current = !1;
13570
+ Ne.current &&= (clearTimeout(Ne.current), null), Fe.current &&= (clearTimeout(Fe.current), null), E("speaking"), z.current = "speaking", Pe.current = !1;
13577
13571
  return;
13578
13572
  }
13579
13573
  if (t === "user-speaking") {
13580
- if (ae.current && !ie.current && Re(), Pe.current &&= (clearTimeout(Pe.current), null), R.current === "speaking") return;
13574
+ if (ae.current && !ie.current && Ve(), Fe.current &&= (clearTimeout(Fe.current), null), z.current === "speaking") return;
13581
13575
  try {
13582
13576
  On();
13583
13577
  } catch {}
13584
- z.current &&= (clearTimeout(z.current), null), R.current !== "listening" && (E("listening"), R.current = "listening");
13578
+ Ne.current &&= (clearTimeout(Ne.current), null), z.current !== "listening" && (E("listening"), z.current = "listening");
13585
13579
  return;
13586
13580
  }
13587
13581
  if (t === "thinking") {
13588
- if (z.current &&= (clearTimeout(z.current), null), Pe.current &&= (clearTimeout(Pe.current), null), R.current === "speaking") return;
13589
- E("thinking"), R.current = "thinking", n && (Pe.current = setTimeout(() => {
13590
- Pe.current = null, !(e || R.current !== "thinking") && (R.current = "listening", E("listening"));
13582
+ if (Ne.current &&= (clearTimeout(Ne.current), null), Fe.current &&= (clearTimeout(Fe.current), null), z.current === "speaking") return;
13583
+ E("thinking"), z.current = "thinking", n && (Fe.current = setTimeout(() => {
13584
+ Fe.current = null, !(e || z.current !== "thinking") && (z.current = "listening", E("listening"));
13591
13585
  }, 4e3));
13592
13586
  return;
13593
13587
  }
13594
- if (R.current = "listening", je.current) {
13595
- je.current = !1, Fe();
13588
+ if (z.current = "listening", Me.current) {
13589
+ Me.current = !1, B();
13596
13590
  return;
13597
13591
  }
13598
- if (Oe && !Ce && !ie.current && !fe.current) {
13599
- Ce = !0, A = !0, ne = !0;
13592
+ if (ke && !Se && !ie.current && !de.current) {
13593
+ Se = !0, A = !0, ne = !0;
13600
13594
  try {
13601
- P.current?.sendContextualUpdate?.("CRITICAL — EMAIL REQUIRED BEFORE ANYTHING ELSE. The visitor has not provided their email. The app itself speaks the email request out loud — you must NOT say it, and you must NOT answer. Stay completely silent from now until you receive an EMAIL_SAVED message: produce no speech and call no tools, no matter what the visitor says. Remember their question. On EMAIL_SAVED, thank them briefly and answer that remembered question in full.");
13595
+ F.current?.sendContextualUpdate?.("CRITICAL — EMAIL REQUIRED BEFORE ANYTHING ELSE. The visitor has not provided their email. The app itself speaks the email request out loud — you must NOT say it, and you must NOT answer. Stay completely silent from now until you receive an EMAIL_SAVED message: produce no speech and call no tools, no matter what the visitor says. Remember their question. On EMAIL_SAVED, thank them briefly and answer that remembered question in full.");
13602
13596
  } catch {}
13603
13597
  }
13604
13598
  if (ee && !A) {
13605
13599
  A = !0;
13606
13600
  try {
13607
- P.current?.sendContextualUpdate?.(ee);
13601
+ F.current?.sendContextualUpdate?.(ee);
13608
13602
  } catch {}
13609
13603
  }
13610
13604
  if (N && !re) {
13611
13605
  re = !0;
13612
13606
  try {
13613
- P.current?.sendContextualUpdate?.(N);
13607
+ F.current?.sendContextualUpdate?.(N);
13614
13608
  } catch {}
13615
13609
  }
13616
13610
  if (j && !ne) {
13617
13611
  ne = !0;
13618
13612
  try {
13619
- P.current?.sendContextualUpdate?.(j);
13613
+ F.current?.sendContextualUpdate?.(j);
13620
13614
  } catch {}
13621
13615
  }
13622
- z.current && clearTimeout(z.current), z.current = setTimeout(() => {
13623
- e || R.current !== "speaking" && (Ne.current || (z.current = null, R.current = "listening", E("listening")));
13616
+ Ne.current && clearTimeout(Ne.current), Ne.current = setTimeout(() => {
13617
+ e || z.current !== "speaking" && (Pe.current || (Ne.current = null, z.current = "listening", E("listening")));
13624
13618
  }, 1200);
13625
13619
  }
13626
13620
  },
13627
13621
  onMessage: (t) => {
13628
- if (e || ce.current && t.role !== "user" && !/email/i.test(String(t.message || ""))) return;
13622
+ if (e || P.current && t.role !== "user" && !/email/i.test(String(t.message || ""))) return;
13629
13623
  let n = t.role === "user" && /^(Describe the section titled "|\[SYSTEM:|Give the visitor a complete spoken overview|That was the last section)/.test(String(t.message || "").trim()), r = /\b(?:this|that|the)\s+(?:case\s*stud(?:y|ies)|product|article|blog|post|item|service)\b/i.test(String(t.message || ""));
13630
- if (!n && !r && t.role === "user" && V.test(String(t.message || ""))) typeof window < "u" && (window.__fe_user_nav_during_speech = null), he(!0), de.current = !1, le.current = 0, ge.current = -1, pe.current = a_(), setTimeout(() => me.current?.(), 400), console.log(`[FlowEngage] walkthrough armed — ${pe.current.length} sections on this page`);
13631
- else if (!n && t.role === "user" && ue.current) {
13632
- let e = String(t.message || "").trim();
13633
- Le.test(e) ? de.current && (de.current = !1, console.debug("[FlowEngage] walkthrough resumed by visitor"), setTimeout(() => me.current?.(), 300)) : (de.current = !0, console.debug("[FlowEngage] walkthrough paused — visitor interjected"));
13624
+ if (!n && !r && t.role === "user" && Ie.test(String(t.message || ""))) typeof window < "u" && (window.__fe_user_nav_during_speech = null), he(!0), ue.current = !1, ce.current = 0, ge.current = -1, fe.current = r_(), pe.current = typeof window < "u" ? window.location.pathname : null, setTimeout(() => me.current?.(), 400), console.log(`[FlowEngage] walkthrough armed — ${fe.current.length} sections on this page`);
13625
+ else if (!n && t.role === "user" && le.current) {
13626
+ let e = String(t.message || "").trim(), n = Be(e), r = (e) => !!e && (Re.test(e) || ze.test(e));
13627
+ !n || r(e) || r(n) ? ue.current && (ue.current = !1, console.debug("[FlowEngage] walkthrough resumed by visitor"), setTimeout(() => me.current?.(), 300)) : (console.log("[FlowEngage] walkthrough ended — visitor moved to a new topic"), pe.current = null, fe.current = [], he(!1));
13634
13628
  }
13635
- if (t.role !== "user" && Ie.test(String(t.message || ""))) {
13636
- let e = pe.current.length;
13629
+ if (t.role !== "user" && Le.test(String(t.message || ""))) {
13630
+ let e = fe.current.length;
13637
13631
  !e || ge.current >= e - 1 ? he(!1) : console.debug(`[FlowEngage] agent claimed completion at step ${ge.current + 1}/${e} — ignoring, tour continues`);
13638
13632
  }
13639
13633
  let a = t.role === "user" ? "user" : "bot", o = t.message || t.text || t.content || "";
13640
13634
  if (o) {
13641
- if (a === "user" && (ve.current = o, typeof window < "u" && (window.__fe_user_nav_during_speech = null), Ne.current = !0, z.current &&= (clearTimeout(z.current), null), R.current !== "speaking" && (E("thinking"), R.current = "thinking"), Oe && !ye && !ie.current && !fe.current && (ye = !0, se.current = o, ce.current = !0, P.current?.injectAgentSpeech?.("Before I answer that, could you please enter your email in the text box below?", "interrupt"), P.current?.setMicMuted?.(!0), ae.current || (ae.current = !0, oe.current = 0, te(!0), Re()))), l.current = [...l.current, {
13635
+ if (a === "user" && (ve.current = o, typeof window < "u" && (window.__fe_user_nav_during_speech = null), Pe.current = !0, Ne.current &&= (clearTimeout(Ne.current), null), z.current !== "speaking" && (E("thinking"), z.current = "thinking"), ke && !ye && !ie.current && !de.current && (ye = !0, se.current = o, P.current = !0, F.current?.injectAgentSpeech?.("Before I answer that, could you please enter your email in the text box below?", "interrupt"), F.current?.setMicMuted?.(!0), ae.current || (ae.current = !0, oe.current = 0, te(!0), Ve()))), l.current = [...l.current, {
13642
13636
  sender: a,
13643
13637
  message: o,
13644
13638
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
13645
13639
  debug: t.debug
13646
13640
  }], i) try {
13647
- let e = _g(l.current);
13648
- e && I(i, e);
13641
+ let e = hg(l.current);
13642
+ e && L(i, e);
13649
13643
  } catch {}
13650
- if (h_(a, o)) {
13651
- je.current = !0;
13644
+ if (p_(a, o)) {
13645
+ Me.current = !0;
13652
13646
  return;
13653
13647
  }
13654
- if (F.current && a === "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(o)) if (Ae.current += 1, Ae.current === 2) try {
13655
- P.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.");
13648
+ if (be.current && a === "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(o)) if (Ae.current += 1, Ae.current === 2) try {
13649
+ F.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.");
13656
13650
  } catch {}
13657
- else Ae.current >= 5 && Fe("minimized");
13651
+ else Ae.current >= 5 && B("minimized");
13658
13652
  }
13659
13653
  },
13660
13654
  onError: (t) => {
13661
- if (!e && !L.current && !xe.current && !ke()) {
13662
- xe.current = !0, console.error("[FlowEngageVoiceCall] session:error", {
13655
+ if (!e && !we.current && !R.current && !Oe()) {
13656
+ R.current = !0, console.error("[FlowEngageVoiceCall] session:error", {
13663
13657
  message: t?.message,
13664
13658
  name: t?.name,
13665
13659
  raw: t
13666
13660
  });
13667
13661
  try {
13668
- P.current?.setMicMuted?.(!0);
13662
+ F.current?.setMicMuted?.(!0);
13669
13663
  } catch {}
13670
- O(!0), E("error"), Fe("chat");
13664
+ O(!0), E("error"), B("chat");
13671
13665
  }
13672
13666
  },
13673
13667
  onDisconnect: (t) => {
13674
- if (e || L.current || xe.current || ke()) return;
13668
+ if (e || we.current || R.current || Oe()) return;
13675
13669
  let n = l.current?.length || 0;
13676
13670
  console.warn("[FlowEngageVoiceCall] session:disconnected", {
13677
13671
  historyCount: n,
@@ -13679,21 +13673,21 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13679
13673
  closeCode: t?.context?.code,
13680
13674
  closeReason: t?.context?.reason || t?.message,
13681
13675
  lastUserText: ve.current || "",
13682
- wasMuted: F.current
13683
- }), xe.current = !0;
13676
+ wasMuted: be.current
13677
+ }), R.current = !0;
13684
13678
  try {
13685
- P.current?.setMicMuted?.(!0);
13679
+ F.current?.setMicMuted?.(!0);
13686
13680
  } catch {}
13687
- O(!0), Fe("chat");
13681
+ O(!0), B("chat");
13688
13682
  }
13689
13683
  });
13690
13684
  if (e) {
13691
- console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"), ze.endSession().catch(() => {});
13685
+ console.warn("[FlowEngage:VoiceDebug] ❌ cancelled=true after startSession resolved — killing session immediately"), He.endSession().catch(() => {});
13692
13686
  return;
13693
13687
  }
13694
- o = ze, P.current = ze, E("listening");
13688
+ o = He, F.current = He, E("listening");
13695
13689
  try {
13696
- sessionStorage.setItem(`el_conv_${i}`, ze.getId());
13690
+ sessionStorage.setItem(`el_conv_${i}`, He.getId());
13697
13691
  } catch {}
13698
13692
  parent.postMessage({ type: "AGENT_EXPAND" }, "*");
13699
13693
  try {
@@ -13707,7 +13701,7 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13707
13701
  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(" | "));
13708
13702
  } catch {}
13709
13703
  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` : "";
13710
- ze.sendContextualUpdate(`${s}SiteId: ${i || "unknown"}. ${y ? "" : "Visitor's email is already on file from a prior session — do NOT ask for it again. "}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. Do NOT skip fwh-get-current-page-mvp. Voice: call end_voice_session or say you are ending the session to stop.`), ze.sendContextualUpdate(c_(e, o, a));
13704
+ He.sendContextualUpdate(`${s}SiteId: ${i || "unknown"}. ${y ? "" : "Visitor's email is already on file from a prior session — do NOT ask for it again. "}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. Do NOT skip fwh-get-current-page-mvp. Voice: call end_voice_session or say you are ending the session to stop.`), He.sendContextualUpdate(o_(e, o, a));
13711
13705
  } catch {}
13712
13706
  if (typeof window < "u") {
13713
13707
  let t = window.location.pathname, n = Date.now(), r = (e) => {
@@ -13740,10 +13734,10 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13740
13734
  if (o) {
13741
13735
  typeof window < "u" && (window.__fe_agent_nav = null), console.log(`[FlowEngage] agent-driven navigation settled: "${s}" → "${i}"`);
13742
13736
  try {
13743
- P.current?.sendUserMessage?.(`[SYSTEM: YOU just navigated the visitor to the "${m}" page (${c}) at their request — this was YOUR action, not theirs. Page title: "${l}". Sections: ${JSON.stringify(u)}. Say: "Here we are on the ${m} page." Then introduce this page in 2-3 sentences, and finish by asking: "Would you like me to walk you through it section by section?" NEVER say "I see you've navigated" — the visitor did not navigate, you did. Do NOT call fwh-navigate-mvp again. Wait for their answer before describing sections.]`, { suppressQuestion: !0 });
13737
+ F.current?.sendUserMessage?.(`[SYSTEM: YOU just navigated the visitor to the "${m}" page (${c}) at their request — this was YOUR action, not theirs. Page title: "${l}". Sections: ${JSON.stringify(u)}. Say: "Here we are on the ${m} page." Then introduce this page in 2-3 sentences, and finish by asking: "Would you like me to walk you through it section by section?" NEVER say "I see you've navigated" — the visitor did not navigate, you did. Do NOT call fwh-navigate-mvp again. Wait for their answer before describing sections.]`, { suppressQuestion: !0 });
13744
13738
  } catch {}
13745
13739
  try {
13746
- P.current?.sendContextualUpdate?.(c_(c, d));
13740
+ F.current?.sendContextualUpdate?.(o_(c, d));
13747
13741
  } catch {}
13748
13742
  return;
13749
13743
  }
@@ -13755,10 +13749,10 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13755
13749
  ts: Date.now()
13756
13750
  }), console.log(`[FlowEngage] visitor navigation detected: "${s}" → "${i}" (agent target: ${k || "none"})`);
13757
13751
  try {
13758
- P.current?.sendUserMessage?.(`[SYSTEM: I navigated away mid-walkthrough — I am now on the "${m}" page (${c}). Page title: "${l}". Sections: ${JSON.stringify(u)}. STOP everything. Do NOT describe the new page. Say EXACTLY: "I see you've navigated to the ${m} 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 fwh-navigate-mvp, do NOT call fwh-highlight-mvp, the visitor will navigate themselves if needed. IF I want to hear about this page: call fwh-highlight-mvp for sections of "${m}" only.]`);
13752
+ F.current?.sendUserMessage?.(`[SYSTEM: I navigated away mid-walkthrough — I am now on the "${m}" page (${c}). Page title: "${l}". Sections: ${JSON.stringify(u)}. STOP everything. Do NOT describe the new page. Say EXACTLY: "I see you've navigated to the ${m} 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 fwh-navigate-mvp, do NOT call fwh-highlight-mvp, the visitor will navigate themselves if needed. IF I want to hear about this page: call fwh-highlight-mvp for sections of "${m}" only.]`);
13759
13753
  } catch {}
13760
13754
  try {
13761
- P.current?.sendContextualUpdate?.(c_(c, d));
13755
+ F.current?.sendContextualUpdate?.(o_(c, d));
13762
13756
  } catch {}
13763
13757
  };
13764
13758
  c = window.history.pushState.bind(window.history), window.history.pushState = (...e) => {
@@ -13775,15 +13769,15 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13775
13769
  agentId: r,
13776
13770
  siteId: i,
13777
13771
  apiBaseUrl: a
13778
- }), e = !0, L.current = !0;
13772
+ }), e = !0, we.current = !0;
13779
13773
  try {
13780
13774
  On();
13781
13775
  } catch {}
13782
13776
  if (i) try {
13783
- Me(i);
13777
+ je(i);
13784
13778
  } catch {}
13785
- typeof window < "u" && (window.__fe_user_nav_during_speech = null), Or(), z.current &&= (clearTimeout(z.current), null), Pe.current &&= (clearTimeout(Pe.current), null), N.current &&= (clearTimeout(N.current), null), Ne.current = !1, R.current = "idle", c && typeof window < "u" && (window.history.pushState = c), d && typeof window < "u" && window.removeEventListener("popstate", d);
13786
- let t = o || P.current, n = Ee.current, f = De.current;
13779
+ typeof window < "u" && (window.__fe_user_nav_during_speech = null), Or(), Ne.current &&= (clearTimeout(Ne.current), null), Fe.current &&= (clearTimeout(Fe.current), null), N.current &&= (clearTimeout(N.current), null), Pe.current = !1, z.current = "idle", c && typeof window < "u" && (window.history.pushState = c), d && typeof window < "u" && window.removeEventListener("popstate", d);
13780
+ let t = o || F.current, n = Ee.current, f = De.current;
13787
13781
  if (t?.endSession?.().catch(() => {}), n && s && a) {
13788
13782
  let e = f ? Math.round((Date.now() - f) / 1e3) : 0, t = JSON.stringify({
13789
13783
  chatId: s,
@@ -13804,53 +13798,53 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13804
13798
  r,
13805
13799
  i,
13806
13800
  a,
13807
- Fe
13801
+ B
13808
13802
  ]), c(() => {
13809
13803
  if (!k) return;
13810
13804
  let e = (e) => {
13811
13805
  let t = e.composedPath?.()?.[0] || e.target;
13812
- Oe.current && !Oe.current.contains(t) && A(!1);
13806
+ ke.current && !ke.current.contains(t) && A(!1);
13813
13807
  };
13814
13808
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
13815
13809
  }, [k]);
13816
- let Be = async () => {
13817
- if (P.current) try {
13810
+ let Ue = async () => {
13811
+ if (F.current) try {
13818
13812
  if (D) {
13819
- Ae.current = 0, await P.current.setMicMuted?.(!1), O(!1);
13813
+ Ae.current = 0, await F.current.setMicMuted?.(!1), O(!1);
13820
13814
  try {
13821
- P.current.sendContextualUpdate?.("The visitor has unmuted. Resume normal interaction and wait for them to speak.");
13815
+ F.current.sendContextualUpdate?.("The visitor has unmuted. Resume normal interaction and wait for them to speak.");
13822
13816
  } catch {}
13823
13817
  } else {
13824
- Ae.current = 0, await P.current.setMicMuted?.(!0), O(!0);
13818
+ Ae.current = 0, await F.current.setMicMuted?.(!0), O(!0);
13825
13819
  try {
13826
- P.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.");
13820
+ F.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.");
13827
13821
  } catch {}
13828
13822
  }
13829
13823
  } catch {}
13830
- }, Ve = o(async (e) => {
13824
+ }, We = o(async (e) => {
13831
13825
  e?.preventDefault?.();
13832
13826
  let t = ne.trim().toLowerCase();
13833
13827
  if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)) {
13834
13828
  re("Please enter a valid email address.");
13835
13829
  return;
13836
13830
  }
13837
- re(""), ie.current = !0, ae.current = !1, B(), te(!1), j(""), ce.current = !1;
13831
+ re(""), ie.current = !0, ae.current = !1, V(), te(!1), j(""), P.current = !1;
13838
13832
  try {
13839
13833
  typeof v == "function" && await v(t);
13840
13834
  } catch {}
13841
- P.current?.setMicMuted?.(!1);
13835
+ F.current?.setMicMuted?.(!1);
13842
13836
  let n = se.current;
13843
13837
  se.current = "";
13844
13838
  try {
13845
- P.current?.injectAgentSpeech?.("Thank you for submitting your email."), P.current?.sendUserMessage?.(n || "The visitor's email is on file. Carry on helping them and never ask for it again.");
13839
+ F.current?.injectAgentSpeech?.("Thank you for submitting your email."), F.current?.sendUserMessage?.(n || "The visitor's email is on file. Carry on helping them and never ask for it again.");
13846
13840
  } catch {}
13847
13841
  }, [
13848
13842
  ne,
13849
13843
  v,
13850
- B
13851
- ]), He = Array.isArray(e) && e[0] || "#3B82F6";
13844
+ V
13845
+ ]), Ge = Array.isArray(e) && e[0] || "#3B82F6";
13852
13846
  return /* @__PURE__ */ _("div", {
13853
- ref: Oe,
13847
+ ref: ke,
13854
13848
  style: {
13855
13849
  position: "relative",
13856
13850
  display: "flex",
@@ -13861,7 +13855,7 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13861
13855
  },
13862
13856
  children: [
13863
13857
  ee && /* @__PURE__ */ _("form", {
13864
- onSubmit: Ve,
13858
+ onSubmit: We,
13865
13859
  style: {
13866
13860
  width: "270px",
13867
13861
  maxWidth: "calc(100vw - 40px)",
@@ -13924,7 +13918,7 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13924
13918
  padding: "10px 12px",
13925
13919
  borderRadius: "10px",
13926
13920
  border: "none",
13927
- background: ne.trim() ? He : "#374151",
13921
+ background: ne.trim() ? Ge : "#374151",
13928
13922
  color: "white",
13929
13923
  fontSize: "14px",
13930
13924
  fontWeight: 600,
@@ -13970,7 +13964,7 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13970
13964
  },
13971
13965
  children: "Muted"
13972
13966
  }),
13973
- /* @__PURE__ */ g(g_, {
13967
+ /* @__PURE__ */ g(m_, {
13974
13968
  size: 72,
13975
13969
  voiceState: T,
13976
13970
  isMuted: D,
@@ -13993,7 +13987,7 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
13993
13987
  alignItems: "center"
13994
13988
  },
13995
13989
  children: [/* @__PURE__ */ g("button", {
13996
- onClick: Be,
13990
+ onClick: Ue,
13997
13991
  title: D ? "Unmute" : "Mute",
13998
13992
  style: {
13999
13993
  width: "24px",
@@ -14042,7 +14036,7 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14042
14036
  y2: "23"
14043
14037
  })
14044
14038
  ]
14045
- }) : /* @__PURE__ */ g(xh, {
14039
+ }) : /* @__PURE__ */ g(yh, {
14046
14040
  size: 16,
14047
14041
  color: "currentColor"
14048
14042
  })
@@ -14064,7 +14058,7 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14064
14058
  padding: 0,
14065
14059
  flexShrink: 0
14066
14060
  },
14067
- children: /* @__PURE__ */ g(kh, {
14061
+ children: /* @__PURE__ */ g(Dh, {
14068
14062
  size: 16,
14069
14063
  color: "currentColor"
14070
14064
  })
@@ -14088,7 +14082,7 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14088
14082
  children: [
14089
14083
  /* @__PURE__ */ _("button", {
14090
14084
  onClick: () => {
14091
- A(!1), Te.current = "chat", ze(t);
14085
+ A(!1), Te.current = "chat", He(t);
14092
14086
  },
14093
14087
  style: {
14094
14088
  display: "flex",
@@ -14113,11 +14107,11 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14113
14107
  onMouseLeave: (e) => {
14114
14108
  e.currentTarget.style.background = "none";
14115
14109
  },
14116
- children: [/* @__PURE__ */ g(Ah, {}), C]
14110
+ children: [/* @__PURE__ */ g(Oh, {}), C]
14117
14111
  }),
14118
14112
  /* @__PURE__ */ _("button", {
14119
14113
  onClick: () => {
14120
- A(!1), Te.current = "minimized", ze(n);
14114
+ A(!1), Te.current = "minimized", He(n);
14121
14115
  },
14122
14116
  style: {
14123
14117
  display: "flex",
@@ -14142,7 +14136,7 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14142
14136
  onMouseLeave: (e) => {
14143
14137
  e.currentTarget.style.background = "none";
14144
14138
  },
14145
- children: [/* @__PURE__ */ g(jh, {}), w]
14139
+ children: [/* @__PURE__ */ g(kh, {}), w]
14146
14140
  }),
14147
14141
  /* @__PURE__ */ g("button", {
14148
14142
  onClick: () => A(!1),
@@ -14194,7 +14188,7 @@ function y_({ orbColors: e, onEnterChat: t, onEndChat: n, agentId: r, siteId: i,
14194
14188
  ]
14195
14189
  });
14196
14190
  }
14197
- function b_({ orbColors: e }) {
14191
+ function v_({ orbColors: e }) {
14198
14192
  let t = Array.isArray(e) && e.length > 0 ? e : [
14199
14193
  "#135bd8",
14200
14194
  "#ef334b",
@@ -14213,7 +14207,7 @@ function b_({ orbColors: e }) {
14213
14207
  `.replace(/\s+/g, " ").trim()
14214
14208
  } });
14215
14209
  }
14216
- var x_ = () => /* @__PURE__ */ g("div", {
14210
+ var y_ = () => /* @__PURE__ */ g("div", {
14217
14211
  style: {
14218
14212
  display: "flex",
14219
14213
  marginBottom: "12px",
@@ -14243,8 +14237,8 @@ var x_ = () => /* @__PURE__ */ g("div", {
14243
14237
  } }, e))
14244
14238
  })
14245
14239
  });
14246
- function S_({ 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: M, emailError: re, emailCaptureSuccess: ie, replyContext: ae, setReplyContext: N, webRTCError: oe, micError: se, setMicError: ce, dismissCallError: le, activeCallId: ue, isCallMuted: de, toggleCallMute: fe, endWebRTCCall: pe, formatCallDuration: me, callDurationSeconds: he, isCallMinimized: ge, onExpand: P, onCollapse: _e, onStartVoice: ve, voiceEnabled: ye, headerBgColor: be, onNewChat: F, showPoweredBy: xe, privacyPolicyUrl: I, getVisitorChatHistory: Se, resumeChat: Ce, isSessionRestoring: L, isClosing: we }) {
14247
- let Te = l.length > 0, Ee = T || E || w, De = !!ue, [Oe, ke] = m(!1), [Ae, je] = m(!1), [Me, R] = m([]), [z, Ne] = m(!1), Pe = p(null), [Fe, B] = m(() => typeof window < "u" ? window.visualViewport?.height ?? window.innerHeight : 600), [V, Ie] = m(0);
14240
+ function b_({ 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: M, emailError: re, emailCaptureSuccess: ie, replyContext: ae, setReplyContext: N, webRTCError: oe, micError: se, setMicError: P, dismissCallError: ce, activeCallId: le, isCallMuted: ue, toggleCallMute: de, endWebRTCCall: fe, formatCallDuration: pe, callDurationSeconds: me, isCallMinimized: he, onExpand: ge, onCollapse: F, onStartVoice: _e, voiceEnabled: ve, headerBgColor: ye, onNewChat: I, showPoweredBy: be, privacyPolicyUrl: L, getVisitorChatHistory: xe, resumeChat: Se, isSessionRestoring: R, isClosing: Ce }) {
14241
+ let we = l.length > 0, Te = T || E || w, Ee = !!le, [De, Oe] = m(!1), [ke, Ae] = m(!1), [je, Me] = m([]), [z, Ne] = m(!1), Pe = p(null), [Fe, B] = m(() => typeof window < "u" ? window.visualViewport?.height ?? window.innerHeight : 600), [V, Ie] = m(0);
14248
14242
  c(() => {
14249
14243
  if (!s) return;
14250
14244
  let e = window.visualViewport;
@@ -14257,26 +14251,26 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14257
14251
  };
14258
14252
  }, [s]);
14259
14253
  let Le = s && window.innerHeight - Fe > 150, Re = async () => {
14260
- ke(!1), je(!0), Ne(!0);
14254
+ Oe(!1), Ae(!0), Ne(!0);
14261
14255
  try {
14262
- let e = await Se();
14263
- e?.data && R(e.data);
14256
+ let e = await xe();
14257
+ e?.data && Me(e.data);
14264
14258
  } catch (e) {
14265
14259
  console.error(e);
14266
14260
  } finally {
14267
14261
  Ne(!1);
14268
14262
  }
14269
14263
  }, ze = async (e) => {
14270
- je(!1), Ce?.(e.chatId);
14264
+ Ae(!1), Se?.(e.chatId);
14271
14265
  };
14272
14266
  return c(() => {
14273
- if (!Oe) return;
14267
+ if (!De) return;
14274
14268
  let e = (e) => {
14275
14269
  let t = e.composedPath?.()?.[0] || e.target;
14276
- Pe.current && !Pe.current.contains(t) && ke(!1);
14270
+ Pe.current && !Pe.current.contains(t) && Oe(!1);
14277
14271
  };
14278
14272
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
14279
- }, [Oe]), /* @__PURE__ */ _("div", {
14273
+ }, [De]), /* @__PURE__ */ _("div", {
14280
14274
  style: s ? {
14281
14275
  "--flowengage-primary": n,
14282
14276
  "--flowengage-accent": n,
@@ -14290,7 +14284,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14290
14284
  display: "flex",
14291
14285
  flexDirection: "column",
14292
14286
  overflow: "hidden",
14293
- animation: we ? "fe-orb-slide-down 0.28s cubic-bezier(0.16,1,0.3,1) forwards" : "fe-orb-slide-up 0.28s cubic-bezier(0.16,1,0.3,1)"
14287
+ animation: Ce ? "fe-orb-slide-down 0.28s cubic-bezier(0.16,1,0.3,1) forwards" : "fe-orb-slide-up 0.28s cubic-bezier(0.16,1,0.3,1)"
14294
14288
  } : {
14295
14289
  "--flowengage-primary": n,
14296
14290
  "--flowengage-accent": n,
@@ -14303,7 +14297,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14303
14297
  flexDirection: "column",
14304
14298
  overflow: "hidden",
14305
14299
  position: "relative",
14306
- animation: we ? "fe-orb-slide-down 0.28s cubic-bezier(0.16,1,0.3,1) forwards" : "fe-orb-slide-up 0.36s cubic-bezier(0.16,1,0.3,1)"
14300
+ animation: Ce ? "fe-orb-slide-down 0.28s cubic-bezier(0.16,1,0.3,1) forwards" : "fe-orb-slide-up 0.36s cubic-bezier(0.16,1,0.3,1)"
14307
14301
  },
14308
14302
  children: [
14309
14303
  /* @__PURE__ */ _("div", {
@@ -14313,7 +14307,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14313
14307
  alignItems: "center",
14314
14308
  columnGap: "14px",
14315
14309
  padding: "16px 10px 14px",
14316
- background: be || "transparent",
14310
+ background: ye || "transparent",
14317
14311
  flexShrink: 0,
14318
14312
  position: "relative",
14319
14313
  zIndex: 30
@@ -14326,7 +14320,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14326
14320
  alignItems: "center"
14327
14321
  },
14328
14322
  children: /* @__PURE__ */ g("button", {
14329
- onClick: _e,
14323
+ onClick: F,
14330
14324
  style: {
14331
14325
  width: "40px",
14332
14326
  height: "40px",
@@ -14383,7 +14377,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14383
14377
  justifyContent: "center",
14384
14378
  height: "40px"
14385
14379
  },
14386
- children: i ? /* @__PURE__ */ g(p_, {
14380
+ children: i ? /* @__PURE__ */ g(d_, {
14387
14381
  logo: i,
14388
14382
  style: {
14389
14383
  height: "34px",
@@ -14396,7 +14390,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14396
14390
  height: "40px",
14397
14391
  flexShrink: 0
14398
14392
  },
14399
- children: /* @__PURE__ */ g(m_, { title: e.chatTitle })
14393
+ children: /* @__PURE__ */ g(f_, { title: e.chatTitle })
14400
14394
  })
14401
14395
  }), o && /* @__PURE__ */ g("div", {
14402
14396
  style: {
@@ -14431,7 +14425,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14431
14425
  ref: Pe,
14432
14426
  children: [/* @__PURE__ */ g("button", {
14433
14427
  type: "button",
14434
- onClick: () => ke((e) => !e),
14428
+ onClick: () => Oe((e) => !e),
14435
14429
  style: {
14436
14430
  width: "40px",
14437
14431
  height: "40px",
@@ -14477,7 +14471,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14477
14471
  })
14478
14472
  ]
14479
14473
  })
14480
- }), Oe && /* @__PURE__ */ _("div", {
14474
+ }), De && /* @__PURE__ */ _("div", {
14481
14475
  style: {
14482
14476
  position: "absolute",
14483
14477
  top: "34px",
@@ -14493,10 +14487,10 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14493
14487
  animation: "fe-orb-fade-in 0.18s ease"
14494
14488
  },
14495
14489
  children: [
14496
- ye && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _("button", {
14490
+ ve && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _("button", {
14497
14491
  type: "button",
14498
14492
  onClick: () => {
14499
- ke(!1), ve?.();
14493
+ Oe(!1), _e?.();
14500
14494
  },
14501
14495
  style: {
14502
14496
  display: "flex",
@@ -14538,7 +14532,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14538
14532
  /* @__PURE__ */ _("button", {
14539
14533
  type: "button",
14540
14534
  onClick: () => {
14541
- ke(!1), F?.();
14535
+ Oe(!1), I?.();
14542
14536
  },
14543
14537
  style: {
14544
14538
  display: "flex",
@@ -14573,7 +14567,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14573
14567
  children: [/* @__PURE__ */ g("path", { d: "M12 5H5a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-7" }), /* @__PURE__ */ g("path", { d: "M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z" })]
14574
14568
  }), "Start new chat"]
14575
14569
  }),
14576
- Se && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("div", { style: {
14570
+ xe && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("div", { style: {
14577
14571
  height: "1px",
14578
14572
  background: "rgba(255,255,255,0.07)",
14579
14573
  margin: "0 14px"
@@ -14621,7 +14615,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14621
14615
  /* @__PURE__ */ _("button", {
14622
14616
  type: "button",
14623
14617
  onClick: () => {
14624
- ke(!1), _e?.();
14618
+ Oe(!1), F?.();
14625
14619
  },
14626
14620
  style: {
14627
14621
  display: "flex",
@@ -14679,24 +14673,24 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14679
14673
  })
14680
14674
  ]
14681
14675
  }),
14682
- /* @__PURE__ */ g($h, {
14676
+ /* @__PURE__ */ g(Zh, {
14683
14677
  webRTCError: oe,
14684
14678
  micError: se,
14685
- setMicError: ce,
14686
- dismissCallError: le,
14679
+ setMicError: P,
14680
+ dismissCallError: ce,
14687
14681
  isRateLimited: E,
14688
14682
  rateLimitMessage: D
14689
14683
  }),
14690
- ge && /* @__PURE__ */ g(gg, {
14684
+ he && /* @__PURE__ */ g(mg, {
14691
14685
  agentName: v,
14692
14686
  agentHeadshot: y,
14693
14687
  fallbackAgentName: b,
14694
- callDurationSeconds: he,
14695
- isCallMuted: de,
14696
- formatCallDuration: me,
14697
- toggleCallMute: fe,
14698
- endWebRTCCall: pe,
14699
- onExpand: P,
14688
+ callDurationSeconds: me,
14689
+ isCallMuted: ue,
14690
+ formatCallDuration: pe,
14691
+ toggleCallMute: de,
14692
+ endWebRTCCall: fe,
14693
+ onExpand: ge,
14700
14694
  primaryColor: n
14701
14695
  }),
14702
14696
  /* @__PURE__ */ _("div", {
@@ -14708,7 +14702,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14708
14702
  background: "transparent",
14709
14703
  position: "relative"
14710
14704
  },
14711
- children: [Ae ? /* @__PURE__ */ _("div", {
14705
+ children: [ke ? /* @__PURE__ */ _("div", {
14712
14706
  style: {
14713
14707
  position: "absolute",
14714
14708
  inset: 0,
@@ -14727,7 +14721,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14727
14721
  flexShrink: 0
14728
14722
  },
14729
14723
  children: /* @__PURE__ */ _("button", {
14730
- onClick: () => je(!1),
14724
+ onClick: () => Ae(!1),
14731
14725
  style: {
14732
14726
  background: "none",
14733
14727
  border: "none",
@@ -14769,7 +14763,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14769
14763
  fontSize: "14px"
14770
14764
  },
14771
14765
  children: "Loading past conversations..."
14772
- }) : Me.length > 0 ? /* @__PURE__ */ g("div", { children: Me.map((e) => /* @__PURE__ */ _("div", {
14766
+ }) : je.length > 0 ? /* @__PURE__ */ g("div", { children: je.map((e) => /* @__PURE__ */ _("div", {
14773
14767
  onClick: () => ze(e),
14774
14768
  style: {
14775
14769
  padding: "16px 20px",
@@ -14821,18 +14815,18 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14821
14815
  children: "No previous chats found."
14822
14816
  })
14823
14817
  })]
14824
- }) : null, Te ? /* @__PURE__ */ g(Xh, {
14818
+ }) : null, we ? /* @__PURE__ */ g(Jh, {
14825
14819
  chatHistory: l,
14826
14820
  isAiTyping: u,
14827
14821
  isLoading: T,
14828
14822
  isAgentTyping: d,
14829
14823
  setReplyContext: N,
14830
- TypingDots: x_,
14824
+ TypingDots: y_,
14831
14825
  primaryColor: n,
14832
14826
  agentHeadshot: y,
14833
14827
  agentDisplayName: v || b,
14834
- botAvatarNode: /* @__PURE__ */ g(b_, { orbColors: t })
14835
- }) : L ? /* @__PURE__ */ _("div", {
14828
+ botAvatarNode: /* @__PURE__ */ g(v_, { orbColors: t })
14829
+ }) : R ? /* @__PURE__ */ _("div", {
14836
14830
  style: {
14837
14831
  flex: 1,
14838
14832
  display: "flex",
@@ -14872,7 +14866,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14872
14866
  padding: "28px 24px"
14873
14867
  },
14874
14868
  children: [
14875
- /* @__PURE__ */ g(g_, {
14869
+ /* @__PURE__ */ g(m_, {
14876
14870
  size: 94,
14877
14871
  orbColors: t
14878
14872
  }),
@@ -14963,16 +14957,16 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14963
14957
  zIndex: 1,
14964
14958
  padding: ne ? "6px 0 0" : "12px 0 0"
14965
14959
  },
14966
- children: /* @__PURE__ */ g(Qh, {
14960
+ children: /* @__PURE__ */ g(Xh, {
14967
14961
  input: x,
14968
14962
  setInput: S,
14969
14963
  onSubmit: C,
14970
14964
  isConversationEnded: w,
14971
- callUiActive: De,
14972
- handleToggleVoice: ve,
14965
+ callUiActive: Ee,
14966
+ handleToggleVoice: _e,
14973
14967
  showVoiceToggle: f === "agent",
14974
14968
  activeScreen: f,
14975
- inputDisabled: Ee,
14969
+ inputDisabled: Te,
14976
14970
  replyContext: ae,
14977
14971
  clearReplyContext: () => N(null),
14978
14972
  onFileSelect: k,
@@ -14995,7 +14989,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
14995
14989
  paddingBottom: "max(12px, env(safe-area-inset-bottom, 12px))",
14996
14990
  pointerEvents: "none"
14997
14991
  },
14998
- children: [I && /* @__PURE__ */ _("p", {
14992
+ children: [L && /* @__PURE__ */ _("p", {
14999
14993
  style: {
15000
14994
  margin: "0 0 4px",
15001
14995
  fontSize: "10px",
@@ -15008,7 +15002,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
15008
15002
  "This conversation is recorded for quality assurance purposes.",
15009
15003
  " ",
15010
15004
  /* @__PURE__ */ g("a", {
15011
- href: I,
15005
+ href: L,
15012
15006
  target: "_blank",
15013
15007
  rel: "noopener noreferrer",
15014
15008
  style: {
@@ -15018,7 +15012,7 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
15018
15012
  children: "See our privacy policy"
15019
15013
  })
15020
15014
  ]
15021
- }), xe && /* @__PURE__ */ _("span", {
15015
+ }), be && /* @__PURE__ */ _("span", {
15022
15016
  style: {
15023
15017
  fontSize: "11px",
15024
15018
  color: "#9ca3af",
@@ -15037,34 +15031,34 @@ function S_({ copy: e, orbColors: t, primaryColor: n, chatBgGradient: r, logo: i
15037
15031
  ]
15038
15032
  });
15039
15033
  }
15040
- function C_() {
15041
- 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: M, openWidget: re, captureVisitorEmail: ie, setVoiceMode: ae, endConversation: N, startNewChat: ce, acceptCall: le, rejectCall: ue, endWebRTCCall: de, toggleCallMute: fe, dismissCallError: pe, startTyping: me, stopTyping: he, updateTypingDraft: ge, getVisitorChatHistory: P, resumeChat: _e, isSessionRestoring: ve, openToChatCounter: ye, voiceEndCounter: be } = Cn();
15034
+ function x_() {
15035
+ 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: M, openWidget: re, captureVisitorEmail: ie, setVoiceMode: ae, endConversation: N, startNewChat: P, acceptCall: ce, rejectCall: le, endWebRTCCall: ue, toggleCallMute: de, dismissCallError: fe, startTyping: pe, stopTyping: me, updateTypingDraft: he, getVisitorChatHistory: ge, resumeChat: F, isSessionRestoring: _e, openToChatCounter: ve, voiceEndCounter: ye } = Cn();
15042
15036
  c(() => {
15043
15037
  try {
15044
15038
  or();
15045
15039
  } catch {}
15046
15040
  }, []), c(() => {
15047
- ye && W !== "voice_mode" && W !== "text_chat" && W !== "call_screen" && (ae?.(!1), $e("text_chat"));
15048
- }, [ye]);
15049
- let F = t?.widgetSettings || {}, xe = n?.widgetSettings || {}, I = {
15050
- ...F.branding || {},
15051
- ...xe.branding || {}
15052
- }, L = {
15053
- ...F.theme || {},
15054
- ...xe.theme || {}
15055
- }, we = {
15056
- ...F.features || {},
15057
- ...xe.features || {}
15058
- }, Ee = we.voice !== !1, De = Array.isArray(L.orbColors) && L.orbColors.length > 0 ? L.orbColors : null, ke = L.buttonColor || L.primaryColor || De?.[0] || "#3B82F6", Ae = {
15041
+ ve && W !== "voice_mode" && W !== "text_chat" && W !== "call_screen" && (ae?.(!1), $e("text_chat"));
15042
+ }, [ve]);
15043
+ let I = t?.widgetSettings || {}, be = n?.widgetSettings || {}, L = {
15044
+ ...I.branding || {},
15045
+ ...be.branding || {}
15046
+ }, R = {
15047
+ ...I.theme || {},
15048
+ ...be.theme || {}
15049
+ }, Ce = {
15050
+ ...I.features || {},
15051
+ ...be.features || {}
15052
+ }, Te = Ce.voice !== !1, Ee = Array.isArray(R.orbColors) && R.orbColors.length > 0 ? R.orbColors : null, Oe = R.buttonColor || R.primaryColor || Ee?.[0] || "#3B82F6", ke = {
15059
15053
  small: 50,
15060
15054
  medium: 64,
15061
15055
  large: 80
15062
- }, je = Ae[L.orbSize] || Ae.small, Me = L.position || "bottom-right", R = I.fallbackAgentName || "Agent", z = u_(De ?? L.chatBgColors), Ne = I.logo || I.logoUrl || null, Pe = A || "en", Fe = F.recommendations?.[Pe] || [], B = (xe.recommendations?.[Pe] ?? Fe).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
15056
+ }, Ae = ke[R.orbSize] || ke.small, je = R.position || "bottom-right", Me = L.fallbackAgentName || "Agent", z = c_(Ee ?? R.chatBgColors), Ne = L.logo || L.logoUrl || null, Pe = A || "en", Fe = I.recommendations?.[Pe] || [], B = (be.recommendations?.[Pe] ?? Fe).filter((e) => String(e?.label ?? "").trim()).map((e, t) => ({
15063
15057
  id: e.key || `qr-${t}`,
15064
15058
  label: e.label,
15065
15059
  message: e.label,
15066
15060
  text: e.label
15067
- })), V = Array.isArray(I.quickChatOptions) && I.quickChatOptions.length > 0 ? I.quickChatOptions : B, Ie = I.hideWatermark === !0 ? !1 : I.showPoweredBy !== !1, Le = I.headerBgColor || null, Re = L.bottomPosition == null ? "1.5rem" : `${L.bottomPosition}px`, ze = I.privacyPolicyUrl || null, Be = I.chatbotEnabled !== !1 && L.chatbotEnabled !== !1, [Ve, He] = m(() => typeof window < "u" ? window.location.pathname : "/");
15061
+ })), V = Array.isArray(L.quickChatOptions) && L.quickChatOptions.length > 0 ? L.quickChatOptions : B, Ie = L.hideWatermark === !0 ? !1 : L.showPoweredBy !== !1, Le = L.headerBgColor || null, Re = R.bottomPosition == null ? "1.5rem" : `${R.bottomPosition}px`, ze = L.privacyPolicyUrl || null, Be = L.chatbotEnabled !== !1 && R.chatbotEnabled !== !1, [Ve, He] = m(() => typeof window < "u" ? window.location.pathname : "/");
15068
15062
  c(() => {
15069
15063
  if (typeof window > "u") return;
15070
15064
  let e = () => He(window.location.pathname), t = window.history.pushState.bind(window.history);
@@ -15076,24 +15070,24 @@ function C_() {
15076
15070
  }, []);
15077
15071
  let Ue = (() => {
15078
15072
  let e = {
15079
- ...F.pageVisibility || {},
15080
- ...xe.pageVisibility || {}
15073
+ ...I.pageVisibility || {},
15074
+ ...be.pageVisibility || {}
15081
15075
  };
15082
15076
  return Array.isArray(e.allowedPaths) ? e.allowedPaths.filter(Boolean) : [];
15083
- })(), We = Ue.length === 0 || Ue.some((e) => e === "*" || e === "/*" ? !0 : e.endsWith("/*") ? Ve.startsWith(e.slice(0, -1)) : Ve.replace(/\/$/, "") === e.replace(/\/$/, "")), Ge = F.greetings?.[A] || xe.greetings?.[A] || I.introGreeting || "Hello, I'm here to help you know more about OpenSense Labs.", Ke = {
15084
- entryPrompt: I.entryPrompt || "Do you want to explore in a new way?",
15085
- yesLabel: I.yesLabel || "Yes",
15086
- laterLabel: I.laterLabel || "Later",
15087
- connectionTitle: I.connectionTitle || "How would you like to connect?",
15088
- connectionSubtitle: I.connectionSubtitle || "",
15089
- voiceLabel: I.voiceLabel || "Voice",
15090
- textLabel: I.textLabel || "Text",
15091
- chatTitle: I.headerName || "Chat with FlowEngage",
15092
- hasCustomTitle: !!(I.headerName && String(I.headerName).trim()),
15077
+ })(), We = Ue.length === 0 || Ue.some((e) => e === "*" || e === "/*" ? !0 : e.endsWith("/*") ? Ve.startsWith(e.slice(0, -1)) : Ve.replace(/\/$/, "") === e.replace(/\/$/, "")), Ge = I.greetings?.[A] || be.greetings?.[A] || L.introGreeting || "Hello, I'm here to help you know more about OpenSense Labs.", Ke = {
15078
+ entryPrompt: L.entryPrompt || "Do you want to explore in a new way?",
15079
+ yesLabel: L.yesLabel || "Yes",
15080
+ laterLabel: L.laterLabel || "Later",
15081
+ connectionTitle: L.connectionTitle || "How would you like to connect?",
15082
+ connectionSubtitle: L.connectionSubtitle || "",
15083
+ voiceLabel: L.voiceLabel || "Voice",
15084
+ textLabel: L.textLabel || "Text",
15085
+ chatTitle: L.headerName || "Chat with FlowEngage",
15086
+ hasCustomTitle: !!(L.headerName && String(L.headerName).trim()),
15093
15087
  introGreeting: Ge,
15094
- inputPlaceholder: I.inputPlaceholder || "Type your message",
15095
- analysingLabel: I.analysingLabel || "analysing..."
15096
- }, qe = xe.elevenLabsAgentId || t?.elevenLabsAgentId || null, Je = t?.siteId || n?.siteId || null, H = t?.apiBaseUrl || "";
15088
+ inputPlaceholder: L.inputPlaceholder || "Type your message",
15089
+ analysingLabel: L.analysingLabel || "analysing..."
15090
+ }, qe = be.elevenLabsAgentId || t?.elevenLabsAgentId || null, Je = t?.siteId || n?.siteId || null, H = t?.apiBaseUrl || "";
15097
15091
  c(() => {
15098
15092
  Kn(t?.siteType || null);
15099
15093
  }, [t?.siteType]);
@@ -15104,10 +15098,10 @@ function C_() {
15104
15098
  ]), Ye = u && String(u).trim() || t?.ownerProfileImageUrl && String(t.ownerProfileImageUrl).trim() || null, Xe = r.some((e) => e.sender === "user"), Ze = f(() => {
15105
15099
  let e = r.findIndex((e) => e.sender === "user");
15106
15100
  return e === -1 ? !1 : r.slice(e + 1).some((e) => e.sender === "bot" || e.sender === "ai" || e.sender === "agent");
15107
- }, [r]), Qe = !!(xe._dashboardLivePreview || F._dashboardLivePreview), [W, $e] = m(() => Qe ? "text_chat" : "entry_prompt"), [et, tt] = m(""), [nt, G] = m(null), [rt, it] = m(h || ""), [at, ot] = m(""), [st, ct] = m(!1), [lt, ut] = m(0), [dt, ft] = m(null), [pt, mt] = m(null), [ht, gt] = m(""), [_t, vt] = m(!1), [yt, bt] = m(!1), [xt, St] = m(!1), Ct = p(null), wt = p(!1), Tt = !h && Xe && Ze && W !== "voice_mode";
15101
+ }, [r]), Qe = !!(be._dashboardLivePreview || I._dashboardLivePreview), [W, $e] = m(() => Qe ? "text_chat" : "entry_prompt"), [et, tt] = m(""), [nt, G] = m(null), [rt, it] = m(h || ""), [at, ot] = m(""), [st, ct] = m(!1), [lt, ut] = m(0), [dt, ft] = m(null), [pt, mt] = m(null), [ht, gt] = m(""), [_t, vt] = m(!1), [yt, bt] = m(!1), [xt, St] = m(!1), Ct = p(null), wt = p(!1), Tt = !h && Xe && Ze && W !== "voice_mode";
15108
15102
  d(() => {
15109
15103
  if (e !== "ready" || wt.current) return;
15110
- if (wt.current = !0, !Ee) {
15104
+ if (wt.current = !0, !Te) {
15111
15105
  $e("minimized_orb");
15112
15106
  return;
15113
15107
  }
@@ -15115,12 +15109,12 @@ function C_() {
15115
15109
  try {
15116
15110
  t = vr().shouldResumeVoice;
15117
15111
  } catch {}
15118
- let n = Te(), r = Je ? Se(Je) : null, i = n || !!r?.transcript;
15112
+ let n = we(), r = Je ? xe(Je) : null, i = n || !!r?.transcript;
15119
15113
  if (t) {
15120
15114
  re?.({ notifyChatInitiated: !0 }), ae?.(!0), $e("voice_mode");
15121
15115
  return;
15122
15116
  }
15123
- if (Oe()) {
15117
+ if (De()) {
15124
15118
  re?.({ notifyChatInitiated: !1 }), $e("text_chat");
15125
15119
  return;
15126
15120
  }
@@ -15133,7 +15127,7 @@ function C_() {
15133
15127
  return;
15134
15128
  }
15135
15129
  if (Je) try {
15136
- Ce(Je);
15130
+ Se(Je);
15137
15131
  } catch {}
15138
15132
  if (oe(Je)) {
15139
15133
  $e("minimized_orb");
@@ -15150,7 +15144,7 @@ function C_() {
15150
15144
  let Ot = o(() => {
15151
15145
  mt(null), gt("");
15152
15146
  }, []), kt = o((e) => {
15153
- let t = Gh(e);
15147
+ let t = Uh(e);
15154
15148
  if (t) {
15155
15149
  mt(null), gt(t);
15156
15150
  return;
@@ -15214,16 +15208,16 @@ function C_() {
15214
15208
  !T && yt && bt(!1);
15215
15209
  }, [T, yt]), c(() => {
15216
15210
  if (!s || C) {
15217
- ge?.(""), he?.();
15211
+ he?.(""), me?.();
15218
15212
  return;
15219
15213
  }
15220
15214
  if (!et.trim() || pt) {
15221
- ge?.("");
15222
- let e = window.setTimeout(() => he?.(), 100);
15215
+ he?.("");
15216
+ let e = window.setTimeout(() => me?.(), 100);
15223
15217
  return () => window.clearTimeout(e);
15224
15218
  }
15225
- me?.();
15226
- let e = window.setTimeout(() => ge?.(et), 120), t = window.setTimeout(() => he?.(), 1200);
15219
+ pe?.();
15220
+ let e = window.setTimeout(() => he?.(et), 120), t = window.setTimeout(() => me?.(), 1200);
15227
15221
  return () => {
15228
15222
  window.clearTimeout(e), window.clearTimeout(t);
15229
15223
  };
@@ -15232,9 +15226,9 @@ function C_() {
15232
15226
  pt,
15233
15227
  s,
15234
15228
  C,
15229
+ pe,
15235
15230
  me,
15236
- he,
15237
- ge
15231
+ he
15238
15232
  ]);
15239
15233
  let Mt = (e) => e ? {
15240
15234
  replyTo: e.messageId || e.id || null,
@@ -15256,7 +15250,7 @@ function C_() {
15256
15250
  if (pt) {
15257
15251
  try {
15258
15252
  vt(!0), gt("");
15259
- let e = await M(pt), n = e?.data || e, r = et.trim() || `Shared file: ${qh(pt)}`;
15253
+ let e = await M(pt), n = e?.data || e, r = et.trim() || `Shared file: ${Gh(pt)}`;
15260
15254
  tt(""), G(null), Ot(), await j(r, "", t, {
15261
15255
  type: "file",
15262
15256
  metadata: {
@@ -15276,8 +15270,8 @@ function C_() {
15276
15270
  let n = et.trim();
15277
15271
  tt(""), G(null), await j(n, "", t);
15278
15272
  }, Pt = o(() => {
15279
- r.length !== 0 && ce?.();
15280
- }, [r.length, ce]), Ft = (e) => {
15273
+ r.length !== 0 && P?.();
15274
+ }, [r.length, P]), Ft = (e) => {
15281
15275
  let t = Math.floor(e / 60);
15282
15276
  return `${String(t).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`;
15283
15277
  }, It = o(async (e) => {
@@ -15308,14 +15302,14 @@ function C_() {
15308
15302
  height: "min(640px, calc(100vh - 120px))",
15309
15303
  borderRadius: "22px",
15310
15304
  overflow: "hidden",
15311
- ...Me === "bottom-left" ? {
15305
+ ...je === "bottom-left" ? {
15312
15306
  left: "1.5rem",
15313
15307
  bottom: Re
15314
15308
  } : {
15315
15309
  right: "1.5rem",
15316
15310
  bottom: Re
15317
15311
  }
15318
- } : Me === "bottom-left" ? {
15312
+ } : je === "bottom-left" ? {
15319
15313
  left: "1.5rem",
15320
15314
  bottom: Re
15321
15315
  } : {
@@ -15339,7 +15333,7 @@ function C_() {
15339
15333
  }, Ht = () => {
15340
15334
  ae?.(!1), Rt();
15341
15335
  };
15342
- return e !== "ready" || !Be || we.chat === !1 || !We ? null : /* @__PURE__ */ _("div", {
15336
+ return e !== "ready" || !Be || Ce.chat === !1 || !We ? null : /* @__PURE__ */ _("div", {
15343
15337
  className: "flowengage-widget-root",
15344
15338
  style: {
15345
15339
  position: "fixed",
@@ -15349,10 +15343,10 @@ function C_() {
15349
15343
  onWheel: (e) => e.stopPropagation(),
15350
15344
  onTouchMove: (e) => e.stopPropagation(),
15351
15345
  children: [
15352
- W === "entry_prompt" && /* @__PURE__ */ g(__, {
15346
+ W === "entry_prompt" && /* @__PURE__ */ g(h_, {
15353
15347
  copy: Ke,
15354
- orbColors: De,
15355
- primaryColor: ke,
15348
+ orbColors: Ee,
15349
+ primaryColor: Oe,
15356
15350
  onYes: () => {
15357
15351
  se(Je), Bt();
15358
15352
  },
@@ -15381,7 +15375,7 @@ function C_() {
15381
15375
  transformOrigin: "bottom right",
15382
15376
  display: "inline-flex",
15383
15377
  flexDirection: "column",
15384
- alignItems: Me === "bottom-left" ? "flex-start" : "flex-end",
15378
+ alignItems: je === "bottom-left" ? "flex-start" : "flex-end",
15385
15379
  gap: "10px"
15386
15380
  },
15387
15381
  children: [T && /* @__PURE__ */ _("button", {
@@ -15432,24 +15426,24 @@ function C_() {
15432
15426
  children: E === "connected" ? `${Ft(lt)} with ${U}` : `Tap to return to ${U}`
15433
15427
  })]
15434
15428
  })]
15435
- }), /* @__PURE__ */ g(g_, {
15436
- size: je,
15437
- orbColors: De,
15438
- onClick: T ? At : Ee ? zt : Vt
15429
+ }), /* @__PURE__ */ g(m_, {
15430
+ size: Ae,
15431
+ orbColors: Ee,
15432
+ onClick: T ? At : Te ? zt : Vt
15439
15433
  })]
15440
15434
  }),
15441
- W === "connection_modal" && /* @__PURE__ */ g(v_, {
15435
+ W === "connection_modal" && /* @__PURE__ */ g(g_, {
15442
15436
  copy: Ke,
15443
- orbColors: De,
15444
- primaryColor: ke,
15437
+ orbColors: Ee,
15438
+ primaryColor: Oe,
15445
15439
  onVoice: Bt,
15446
15440
  onText: Vt,
15447
15441
  onClose: Rt,
15448
15442
  isMobile: Et,
15449
15443
  isClosing: xt
15450
15444
  }),
15451
- W === "voice_mode" && /* @__PURE__ */ g(y_, {
15452
- orbColors: De,
15445
+ W === "voice_mode" && /* @__PURE__ */ g(__, {
15446
+ orbColors: Ee,
15453
15447
  onEnterChat: Vt,
15454
15448
  onEndChat: Ht,
15455
15449
  agentId: qe,
@@ -15458,18 +15452,18 @@ function C_() {
15458
15452
  chatId: ee,
15459
15453
  historyRef: te,
15460
15454
  onMessageSync: ne,
15461
- voiceEndCounter: be,
15455
+ voiceEndCounter: ye,
15462
15456
  websiteName: t?.websiteName,
15463
- voiceFirstMessage: F.voiceFirstMessage || null,
15457
+ voiceFirstMessage: I.voiceFirstMessage || null,
15464
15458
  captureVisitorEmail: ie,
15465
15459
  emailRequired: !h,
15466
- emailCaptureEnabled: we.emailCapture !== !1 && I.disableEmailCapture !== !0,
15467
- listeningLabel: I.voiceListeningLabel || "Listening...",
15468
- thinkingLabel: I.voiceThinkingLabel || "Thinking...",
15469
- enterChatModeLabel: I.voiceEnterChatLabel || "Enter Chat Mode",
15470
- endConversationLabel: I.voiceEndConversationLabel || "End Conversation"
15460
+ emailCaptureEnabled: Ce.emailCapture !== !1 && L.disableEmailCapture !== !0,
15461
+ listeningLabel: L.voiceListeningLabel || "Listening...",
15462
+ thinkingLabel: L.voiceThinkingLabel || "Thinking...",
15463
+ enterChatModeLabel: L.voiceEnterChatLabel || "Enter Chat Mode",
15464
+ endConversationLabel: L.voiceEndConversationLabel || "End Conversation"
15471
15465
  }, "voice"),
15472
- W === "call_screen" && /* @__PURE__ */ g(hg, {
15466
+ W === "call_screen" && /* @__PURE__ */ g(pg, {
15473
15467
  incomingCall: w,
15474
15468
  activeCallId: T,
15475
15469
  callConnectionState: E,
@@ -15477,22 +15471,22 @@ function C_() {
15477
15471
  isCallMuted: O,
15478
15472
  agentName: U,
15479
15473
  agentHeadshot: Ye,
15480
- fallbackAgentName: R,
15481
- acceptCall: le,
15482
- rejectCall: ue,
15483
- endWebRTCCall: de,
15484
- toggleCallMute: fe,
15474
+ fallbackAgentName: Me,
15475
+ acceptCall: ce,
15476
+ rejectCall: le,
15477
+ endWebRTCCall: ue,
15478
+ toggleCallMute: de,
15485
15479
  formatCallDuration: Ft,
15486
15480
  onMinimize: jt,
15487
- primaryColor: ke,
15488
- orbColors: De,
15481
+ primaryColor: Oe,
15482
+ orbColors: Ee,
15489
15483
  chatHistory: r
15490
15484
  }),
15491
- W === "text_chat" && /* @__PURE__ */ g(S_, {
15485
+ W === "text_chat" && /* @__PURE__ */ g(b_, {
15492
15486
  isClosing: xt,
15493
15487
  copy: Ke,
15494
- orbColors: De,
15495
- primaryColor: ke,
15488
+ orbColors: Ee,
15489
+ primaryColor: Oe,
15496
15490
  chatBgGradient: z,
15497
15491
  logo: Ne,
15498
15492
  quickChatOptions: V,
@@ -15504,7 +15498,7 @@ function C_() {
15504
15498
  activeScreen: a,
15505
15499
  agentName: U,
15506
15500
  agentHeadshot: Ye,
15507
- fallbackAgentName: R,
15501
+ fallbackAgentName: Me,
15508
15502
  input: et,
15509
15503
  setInput: tt,
15510
15504
  onSubmit: Nt,
@@ -15527,16 +15521,16 @@ function C_() {
15527
15521
  webRTCError: k,
15528
15522
  micError: dt,
15529
15523
  setMicError: ft,
15530
- dismissCallError: pe,
15524
+ dismissCallError: fe,
15531
15525
  activeCallId: T,
15532
15526
  isCallMuted: O,
15533
- toggleCallMute: fe,
15534
- endWebRTCCall: de,
15527
+ toggleCallMute: de,
15528
+ endWebRTCCall: ue,
15535
15529
  formatCallDuration: Ft,
15536
15530
  callDurationSeconds: lt,
15537
15531
  onCollapse: Rt,
15538
15532
  onStartVoice: Bt,
15539
- voiceEnabled: Ee,
15533
+ voiceEnabled: Te,
15540
15534
  onNewChat: Pt,
15541
15535
  onMinimize: jt,
15542
15536
  onExpand: At,
@@ -15544,9 +15538,9 @@ function C_() {
15544
15538
  showPoweredBy: Ie,
15545
15539
  privacyPolicyUrl: ze,
15546
15540
  headerBgColor: Le,
15547
- getVisitorChatHistory: P,
15548
- resumeChat: _e,
15549
- isSessionRestoring: ve
15541
+ getVisitorChatHistory: ge,
15542
+ resumeChat: F,
15543
+ isSessionRestoring: _e
15550
15544
  }),
15551
15545
  /* @__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 " })
15552
15546
  ]
@@ -15554,7 +15548,7 @@ function C_() {
15554
15548
  }
15555
15549
  //#endregion
15556
15550
  //#region src/components/ErrorBoundary.jsx
15557
- var w_ = class extends e.Component {
15551
+ var S_ = class extends e.Component {
15558
15552
  constructor(e) {
15559
15553
  super(e), this.state = { hasError: !1 };
15560
15554
  }
@@ -15569,4 +15563,4 @@ var w_ = class extends e.Component {
15569
15563
  }
15570
15564
  };
15571
15565
  //#endregion
15572
- export { cg as AnimatedOrb, w_ as ErrorBoundary, pi as FlowEngageProvider, C_ as FlowEngageWidget, Cn as useFlowEngage };
15566
+ export { og as AnimatedOrb, S_ as ErrorBoundary, pi as FlowEngageProvider, x_ as FlowEngageWidget, Cn as useFlowEngage };