@livelayer/react 0.9.7 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { jsxs as v, jsx as n, Fragment as ot } from "react/jsx-runtime";
3
- import { Component as In, useState as C, useRef as A, useEffect as T, useCallback as E, useMemo as Ue, useLayoutEffect as Tn, forwardRef as lt, useImperativeHandle as Mn, createElement as Dn } from "react";
4
- import { LiveKitSession as Pn } from "@livelayer/sdk";
5
- import { createLocalAudioTrack as $n, Track as dn, createLocalVideoTrack as zn } from "livekit-client";
6
- import { createPortal as On } from "react-dom";
7
- class Hn extends In {
2
+ import { jsxs as y, jsx as n, Fragment as Ue } from "react/jsx-runtime";
3
+ import { Component as Dn, useState as C, useRef as A, useEffect as T, useCallback as E, useMemo as je, useLayoutEffect as Pn, forwardRef as ot, useImperativeHandle as $n, createElement as zn } from "react";
4
+ import { createPortal as un } from "react-dom";
5
+ import { LiveKitSession as On } from "@livelayer/sdk";
6
+ import { createLocalAudioTrack as Hn, Track as fn, createLocalVideoTrack as Wn } from "livekit-client";
7
+ class Bn extends Dn {
8
8
  constructor() {
9
9
  super(...arguments), this.state = { hasError: !1, error: null }, this.reset = () => {
10
10
  this.setState({ hasError: !1, error: null });
@@ -19,7 +19,7 @@ class Hn extends In {
19
19
  }
20
20
  render() {
21
21
  var t;
22
- return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ v("div", { className: "ll-error-boundary", role: "alert", children: [
22
+ return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ y("div", { className: "ll-error-boundary", role: "alert", children: [
23
23
  /* @__PURE__ */ n("p", { className: "ll-error-boundary__title", children: "Widget crashed" }),
24
24
  /* @__PURE__ */ n("p", { className: "ll-error-boundary__message", children: ((t = this.state.error) == null ? void 0 : t.message) || "Something went wrong." }),
25
25
  /* @__PURE__ */ n(
@@ -34,12 +34,12 @@ class Hn extends In {
34
34
  ] }) : this.props.children;
35
35
  }
36
36
  }
37
- function Wn(e) {
38
- const [t, r] = C("idle"), [i, o] = C("idle"), [l, s] = C([]), [a, d] = C(null), [f, _] = C(null), [u, c] = C(null), [I, L] = C(!1), [b, y] = C(null), m = A(null), S = A(e.onDataMessage);
37
+ function qn(e) {
38
+ const [t, r] = C("idle"), [i, o] = C("idle"), [l, s] = C([]), [a, d] = C(null), [f, _] = C(null), [u, c] = C(null), [I, k] = C(!1), [b, v] = C(null), m = A(null), S = A(e.onDataMessage);
39
39
  S.current = e.onDataMessage, T(() => {
40
40
  const R = {
41
41
  onConnectionStateChange: (q) => {
42
- r(q), q === "connected" && y(null);
42
+ r(q), q === "connected" && v(null);
43
43
  },
44
44
  onAgentStateChange: o,
45
45
  onTranscript: (q) => s([...q]),
@@ -47,13 +47,13 @@ function Wn(e) {
47
47
  onAudioTrack: (q) => c(q),
48
48
  onVideoTrack: (q) => _(q),
49
49
  onVideoTrackRemoved: () => _(null),
50
- onError: (q) => y(q),
50
+ onError: (q) => v(q),
51
51
  onDataMessage: (q) => {
52
52
  var N;
53
53
  (N = S.current) == null || N.call(S, q);
54
54
  },
55
- onResumabilityChange: L
56
- }, B = new Pn(
55
+ onResumabilityChange: k
56
+ }, B = new On(
57
57
  {
58
58
  agentId: e.agentId,
59
59
  baseUrl: e.baseUrl,
@@ -63,7 +63,7 @@ function Wn(e) {
63
63
  },
64
64
  R
65
65
  );
66
- return m.current = B, r("idle"), o("idle"), s([]), d(null), _(null), c(null), L(!1), y(null), () => {
66
+ return m.current = B, r("idle"), o("idle"), s([]), d(null), _(null), c(null), k(!1), v(null), () => {
67
67
  var q;
68
68
  (q = B.destroy) == null || q.call(B), m.current = null;
69
69
  };
@@ -80,7 +80,7 @@ function Wn(e) {
80
80
  try {
81
81
  await R.connect();
82
82
  } catch (B) {
83
- throw y(B instanceof Error ? B.message : String(B)), B;
83
+ throw v(B instanceof Error ? B.message : String(B)), B;
84
84
  }
85
85
  }, []), D = E(() => {
86
86
  const R = m.current;
@@ -104,7 +104,7 @@ function Wn(e) {
104
104
  session: m.current
105
105
  };
106
106
  }
107
- function Bn() {
107
+ function Fn() {
108
108
  const e = A(null), t = A(null), r = A(null), i = A(null), o = A(/* @__PURE__ */ new Set()), l = A(null), s = E(() => {
109
109
  const u = t.current;
110
110
  if (!u) {
@@ -118,12 +118,12 @@ function Bn() {
118
118
  u.getByteFrequencyData(c);
119
119
  let I = 0;
120
120
  for (let b = 0; b < c.length; b++) I += c[b];
121
- const L = I / c.length / 255;
121
+ const k = I / c.length / 255;
122
122
  for (const b of o.current)
123
123
  try {
124
- b(L);
125
- } catch (y) {
126
- console.error("[useAudioLevel] subscriber threw:", y);
124
+ b(k);
125
+ } catch (v) {
126
+ console.error("[useAudioLevel] subscriber threw:", v);
127
127
  }
128
128
  i.current = requestAnimationFrame(s);
129
129
  }, []), a = E(() => {
@@ -180,9 +180,9 @@ function Bn() {
180
180
  o.current.clear(), l.current = null;
181
181
  }, [f]), { attach: d, detach: f, subscribe: _ };
182
182
  }
183
- function qn() {
184
- const [e, t] = C(!1), [r, i] = C(""), [o, l] = C(null), s = A(null), a = A(null), d = E(async (L) => {
185
- var b, y;
183
+ function Un() {
184
+ const [e, t] = C(!1), [r, i] = C(""), [o, l] = C(null), s = A(null), a = A(null), d = E(async (k) => {
185
+ var b, v;
186
186
  if (s.current && a.current) {
187
187
  try {
188
188
  await a.current.localParticipant.unpublishTrack(s.current);
@@ -190,52 +190,52 @@ function qn() {
190
190
  }
191
191
  s.current.stop(), s.current = null;
192
192
  }
193
- a.current = L, l(null);
193
+ a.current = k, l(null);
194
194
  try {
195
- const m = await $n({
195
+ const m = await Hn({
196
196
  echoCancellation: !0,
197
197
  noiseSuppression: !0
198
198
  });
199
- await L.localParticipant.publishTrack(m), s.current = m, t(m.isMuted);
200
- const S = (y = (b = m.mediaStreamTrack) == null ? void 0 : b.getSettings) == null ? void 0 : y.call(b);
199
+ await k.localParticipant.publishTrack(m), s.current = m, t(m.isMuted);
200
+ const S = (v = (b = m.mediaStreamTrack) == null ? void 0 : b.getSettings) == null ? void 0 : v.call(b);
201
201
  S != null && S.deviceId && i(S.deviceId);
202
202
  } catch (m) {
203
203
  const S = m instanceof Error && m.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
204
204
  throw l(S), m;
205
205
  }
206
- }, []), f = E((L) => {
207
- a.current = L;
208
- }, []), _ = E(async (L) => {
206
+ }, []), f = E((k) => {
207
+ a.current = k;
208
+ }, []), _ = E(async (k) => {
209
209
  const b = a.current;
210
210
  if (b)
211
211
  try {
212
- await b.switchActiveDevice("audioinput", L), i(L);
213
- } catch (y) {
214
- console.warn("[useMicrophoneState] switchDevice failed:", y);
212
+ await b.switchActiveDevice("audioinput", k), i(k);
213
+ } catch (v) {
214
+ console.warn("[useMicrophoneState] switchDevice failed:", v);
215
215
  }
216
216
  }, []), u = E(() => {
217
- const L = s.current, b = a.current;
218
- if (L) {
219
- L.isMuted ? (L.unmute(), t(!1)) : (L.mute(), t(!0));
217
+ const k = s.current, b = a.current;
218
+ if (k) {
219
+ k.isMuted ? (k.unmute(), t(!1)) : (k.mute(), t(!0));
220
220
  return;
221
221
  }
222
222
  if (b) {
223
- const y = !e;
224
- t(y);
223
+ const v = !e;
224
+ t(v);
225
225
  try {
226
- b.localParticipant.setMicrophoneEnabled(!y);
226
+ b.localParticipant.setMicrophoneEnabled(!v);
227
227
  } catch (m) {
228
228
  console.warn("[useMicrophoneState] setMicrophoneEnabled failed:", m);
229
229
  }
230
230
  }
231
231
  }, [e]), c = E(() => {
232
- const L = s.current, b = a.current;
233
- if (L && b) {
232
+ const k = s.current, b = a.current;
233
+ if (k && b) {
234
234
  try {
235
- b.localParticipant.unpublishTrack(L);
235
+ b.localParticipant.unpublishTrack(k);
236
236
  } catch {
237
237
  }
238
- L.stop();
238
+ k.stop();
239
239
  }
240
240
  s.current = null, a.current = null, t(!1), i("");
241
241
  }, []), I = E(() => l(null), []);
@@ -251,15 +251,15 @@ function qn() {
251
251
  clearError: I
252
252
  };
253
253
  }
254
- const Fn = { resolution: { width: 640, height: 480, frameRate: 24 } };
255
- function Un() {
254
+ const jn = { resolution: { width: 640, height: 480, frameRate: 24 } };
255
+ function Vn() {
256
256
  const [e, t] = C(!1), [r, i] = C(null), [o, l] = C(null), [s, a] = C(""), d = A(null), f = A(null), _ = E((m) => {
257
257
  d.current = m;
258
258
  }, []), u = E(() => {
259
259
  var $;
260
260
  const m = d.current, S = f.current;
261
261
  if (S && m) {
262
- const D = m.localParticipant.getTrackPublication(dn.Source.Camera), R = (D == null ? void 0 : D.track) ?? S;
262
+ const D = m.localParticipant.getTrackPublication(fn.Source.Camera), R = (D == null ? void 0 : D.track) ?? S;
263
263
  try {
264
264
  m.localParticipant.unpublishTrack(R);
265
265
  } catch {
@@ -275,9 +275,9 @@ function Un() {
275
275
  if (S) {
276
276
  i(null);
277
277
  try {
278
- const $ = { ...Fn };
278
+ const $ = { ...jn };
279
279
  m && ($.deviceId = m);
280
- const D = await zn($);
280
+ const D = await Wn($);
281
281
  await S.localParticipant.publishTrack(D), f.current = D;
282
282
  const x = D.attach();
283
283
  l(x), t(!0), m && a(m);
@@ -295,11 +295,11 @@ function Un() {
295
295
  }
296
296
  }, []), I = E(async () => {
297
297
  e ? u() : await c(s || void 0);
298
- }, [e, s, u, c]), L = E(async (m) => {
298
+ }, [e, s, u, c]), k = E(async (m) => {
299
299
  u(), await c(m);
300
300
  }, [u, c]), b = E(() => {
301
301
  u(), d.current = null, i(null), a("");
302
- }, [u]), y = E(() => i(null), []);
302
+ }, [u]), v = E(() => i(null), []);
303
303
  return T(() => () => {
304
304
  f.current && f.current.stop();
305
305
  }, []), {
@@ -308,13 +308,13 @@ function Un() {
308
308
  previewEl: o,
309
309
  activeDeviceId: s,
310
310
  toggle: I,
311
- switchDevice: L,
311
+ switchDevice: k,
312
312
  attachRoom: _,
313
313
  teardown: b,
314
- clearError: y
314
+ clearError: v
315
315
  };
316
316
  }
317
- function jn() {
317
+ function Yn() {
318
318
  const [e, t] = C(!1), [r, i] = C(null), [o, l] = C(null), s = A(null), a = E((c) => {
319
319
  s.current = c;
320
320
  }, []), d = E(() => l(null), []), f = E(async () => {
@@ -332,11 +332,11 @@ function jn() {
332
332
  try {
333
333
  await c.localParticipant.setScreenShareEnabled(!0);
334
334
  let I = 0;
335
- const L = () => {
336
- const b = c.localParticipant.getTrackPublication(dn.Source.ScreenShare);
335
+ const k = () => {
336
+ const b = c.localParticipant.getTrackPublication(fn.Source.ScreenShare);
337
337
  if (b != null && b.track) {
338
- const y = b.track.attach();
339
- l(y), t(!0);
338
+ const v = b.track.attach();
339
+ l(v), t(!0);
340
340
  try {
341
341
  c.localParticipant.publishData(
342
342
  new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
@@ -346,12 +346,12 @@ function jn() {
346
346
  }
347
347
  return;
348
348
  }
349
- I++ < 10 ? setTimeout(L, 100) : t(!0);
349
+ I++ < 10 ? setTimeout(k, 100) : t(!0);
350
350
  };
351
- L();
351
+ k();
352
352
  } catch (I) {
353
- const L = I instanceof Error ? I.name : "";
354
- L !== "NotAllowedError" && L !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
353
+ const k = I instanceof Error ? I.name : "";
354
+ k !== "NotAllowedError" && k !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
355
355
  }
356
356
  }
357
357
  }, [e, d]), _ = E(() => {
@@ -365,7 +365,7 @@ function jn() {
365
365
  }, [e, d]), u = E(() => i(null), []);
366
366
  return { isEnabled: e, error: r, previewEl: o, toggle: f, attachRoom: a, teardown: _, clearError: u };
367
367
  }
368
- function Vn() {
368
+ function Gn() {
369
369
  const [e, t] = C([]), [r, i] = C([]), o = E(async () => {
370
370
  if (!(typeof navigator > "u" || !navigator.mediaDevices))
371
371
  try {
@@ -380,7 +380,7 @@ function Vn() {
380
380
  return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
381
381
  }, [o]), { mics: e, cameras: r, refresh: o };
382
382
  }
383
- function Yn(e, t, r = !1) {
383
+ function Jn(e, t, r = !1) {
384
384
  const [i, o] = C(null), [l, s] = C(null), [a, d] = C(!r && !!e);
385
385
  return T(() => {
386
386
  if (r || !e) {
@@ -403,7 +403,7 @@ function Yn(e, t, r = !1) {
403
403
  }), () => f.abort();
404
404
  }, [e, t, r]), { info: i, error: l, loading: a };
405
405
  }
406
- function Gn(e) {
406
+ function Kn(e) {
407
407
  if (typeof window > "u") return null;
408
408
  try {
409
409
  return window.localStorage.getItem(e);
@@ -411,14 +411,14 @@ function Gn(e) {
411
411
  return null;
412
412
  }
413
413
  }
414
- function Jn(e, t) {
414
+ function Xn(e, t) {
415
415
  if (!(typeof window > "u"))
416
416
  try {
417
417
  window.localStorage.setItem(e, t);
418
418
  } catch {
419
419
  }
420
420
  }
421
- function Kn({
421
+ function Qn({
422
422
  value: e,
423
423
  defaultValue: t = "expanded",
424
424
  onChange: r
@@ -431,32 +431,32 @@ function Kn({
431
431
  );
432
432
  return [s, a];
433
433
  }
434
- const Xn = ["hidden", "minimized", "expanded"];
435
- function Qn(e) {
436
- return e && Xn.includes(e) ? e : null;
434
+ const Zn = ["hidden", "minimized", "expanded"];
435
+ function er(e) {
436
+ return e && Zn.includes(e) ? e : null;
437
437
  }
438
- function Zn({
438
+ function tr({
439
439
  value: e,
440
440
  defaultValue: t = "expanded",
441
441
  onChange: r,
442
442
  persistKey: i = "ll-widget",
443
443
  disablePersistence: o = !1
444
444
  } = {}) {
445
- const l = `${i}:display-mode`, s = A(!1), [a, d] = Kn({
445
+ const l = `${i}:display-mode`, s = A(!1), [a, d] = Qn({
446
446
  value: e,
447
447
  defaultValue: t,
448
448
  onChange: (f) => {
449
- e === void 0 && !o && Jn(l, f), r == null || r(f);
449
+ e === void 0 && !o && Xn(l, f), r == null || r(f);
450
450
  }
451
451
  });
452
452
  return T(() => {
453
453
  if (s.current || (s.current = !0, o || e !== void 0)) return;
454
- const f = Qn(Gn(l));
454
+ const f = er(Kn(l));
455
455
  f && f !== a && d(f);
456
456
  }, []), [a, d];
457
457
  }
458
- const er = 640;
459
- function tr(e = er) {
458
+ const nr = 640;
459
+ function rr(e = nr) {
460
460
  const [t, r] = C(!1);
461
461
  return T(() => {
462
462
  if (e === !1) {
@@ -471,9 +471,9 @@ function tr(e = er) {
471
471
  });
472
472
  }, [e]), t;
473
473
  }
474
- const jt = "__llHistoryPatched", gt = "ll:pathname";
475
- function nr() {
476
- if (typeof window > "u" || window.history[jt]) return;
474
+ const Vt = "__llHistoryPatched", gt = "ll:pathname";
475
+ function ir() {
476
+ if (typeof window > "u" || window.history[Vt]) return;
477
477
  const e = window.history.pushState, t = window.history.replaceState;
478
478
  window.history.pushState = function(...r) {
479
479
  const i = e.apply(this, r);
@@ -481,65 +481,65 @@ function nr() {
481
481
  }, window.history.replaceState = function(...r) {
482
482
  const i = t.apply(this, r);
483
483
  return window.dispatchEvent(new Event(gt)), i;
484
- }, window.history[jt] = !0;
484
+ }, window.history[Vt] = !0;
485
485
  }
486
- function Vt() {
486
+ function Yt() {
487
487
  return typeof window > "u" ? "/" : window.location.pathname || "/";
488
488
  }
489
- function rr(e) {
489
+ function or(e) {
490
490
  const [t, r] = C(
491
- () => e ?? Vt()
491
+ () => e ?? Yt()
492
492
  );
493
493
  return T(() => {
494
494
  if (e !== void 0) return;
495
- nr();
496
- const i = () => r(Vt());
495
+ ir();
496
+ const i = () => r(Yt());
497
497
  return i(), window.addEventListener("popstate", i), window.addEventListener(gt, i), () => {
498
498
  window.removeEventListener("popstate", i), window.removeEventListener(gt, i);
499
499
  };
500
500
  }, [e]), e ?? t;
501
501
  }
502
- const Yt = /* @__PURE__ */ new Map(), ir = /[\\^$+?.()|{}[\]]/g;
503
- function or(e) {
504
- return e.replace(ir, "\\$&");
502
+ const Gt = /* @__PURE__ */ new Map(), lr = /[\\^$+?.()|{}[\]]/g;
503
+ function ar(e) {
504
+ return e.replace(lr, "\\$&");
505
505
  }
506
- function lr(e) {
507
- const t = Yt.get(e);
506
+ function cr(e) {
507
+ const t = Gt.get(e);
508
508
  if (t) return t;
509
- const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", o = "", l = r.replace(/\*\*/g, i).replace(/\*/g, o), a = or(l).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(o, "g"), "[^/]+"), d = new RegExp(`^${a}\\/?$`);
510
- return Yt.set(e, d), d;
509
+ const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", o = "", l = r.replace(/\*\*/g, i).replace(/\*/g, o), a = ar(l).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(o, "g"), "[^/]+"), d = new RegExp(`^${a}\\/?$`);
510
+ return Gt.set(e, d), d;
511
511
  }
512
- function ar(e, t) {
512
+ function sr(e, t) {
513
513
  const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
514
- return lr(e).test(r);
514
+ return cr(e).test(r);
515
515
  }
516
- function cr(e, t) {
517
- return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : ar(e, t);
516
+ function dr(e, t) {
517
+ return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : sr(e, t);
518
518
  }
519
- function Gt(e, t) {
519
+ function Jt(e, t) {
520
520
  if (!e || e.length === 0) return !1;
521
521
  for (const r of e)
522
- if (cr(r, t)) return !0;
522
+ if (dr(r, t)) return !0;
523
523
  return !1;
524
524
  }
525
- function sr(e, t, r) {
526
- return e === void 0 ? !0 : Gt(r, e) ? !1 : t && t.length > 0 ? Gt(t, e) : !0;
525
+ function ur(e, t, r) {
526
+ return e === void 0 ? !0 : Jt(r, e) ? !1 : t && t.length > 0 ? Jt(t, e) : !0;
527
527
  }
528
- function dr(e, t, r) {
529
- return Ue(
530
- () => sr(e, t, r),
528
+ function fr(e, t, r) {
529
+ return je(
530
+ () => ur(e, t, r),
531
531
  [e, t, r]
532
532
  );
533
533
  }
534
- function ur(e) {
534
+ function pr(e) {
535
535
  return e === !1 ? { navigate: !1, thinking: !1, action: !1 } : e === void 0 || e === !0 ? { navigate: !0, thinking: !0, action: !0 } : {
536
536
  navigate: e.navigate !== !1,
537
537
  thinking: e.thinking !== !1,
538
538
  action: e.action !== !1
539
539
  };
540
540
  }
541
- function fr(e) {
542
- const t = Ue(() => ur(e.config), [e.config]), r = e.baseUrl.replace(/\/+$/, ""), i = A(null), o = E(
541
+ function hr(e) {
542
+ const t = je(() => pr(e.config), [e.config]), r = e.baseUrl.replace(/\/+$/, ""), i = A(null), o = E(
543
543
  (d) => {
544
544
  try {
545
545
  new Audio(`${r}${d}`).play().catch(() => {
@@ -591,12 +591,12 @@ function fr(e) {
591
591
  }
592
592
  i.current = null;
593
593
  }
594
- }, []), Ue(
594
+ }, []), je(
595
595
  () => ({ playPageChange: l, playConfirmation: s, setThinking: a }),
596
596
  [l, s, a]
597
597
  );
598
598
  }
599
- const Jt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ v(
599
+ const Kt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ y(
600
600
  "svg",
601
601
  {
602
602
  className: t,
@@ -642,7 +642,7 @@ const Jt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ v(
642
642
  }
643
643
  )
644
644
  }
645
- ), Kt = ({ className: e }) => /* @__PURE__ */ n(
645
+ ), Xt = ({ className: e }) => /* @__PURE__ */ n(
646
646
  "svg",
647
647
  {
648
648
  className: e,
@@ -660,7 +660,7 @@ const Jt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ v(
660
660
  }
661
661
  )
662
662
  }
663
- ), pr = ({ className: e }) => /* @__PURE__ */ n(
663
+ ), mr = ({ className: e }) => /* @__PURE__ */ n(
664
664
  "svg",
665
665
  {
666
666
  className: e,
@@ -671,12 +671,12 @@ const Jt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ v(
671
671
  "aria-hidden": "true",
672
672
  children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
673
673
  }
674
- ), hr = {
674
+ ), gr = {
675
675
  left: 180,
676
676
  right: 0,
677
677
  up: -90,
678
678
  down: 90
679
- }, Xt = ({ direction: e = "right", className: t }) => /* @__PURE__ */ n(
679
+ }, Qt = ({ direction: e = "right", className: t }) => /* @__PURE__ */ n(
680
680
  "svg",
681
681
  {
682
682
  className: t,
@@ -684,19 +684,19 @@ const Jt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ v(
684
684
  viewBox: "0 0 24 24",
685
685
  stroke: "currentColor",
686
686
  strokeWidth: 2,
687
- style: { transform: `rotate(${hr[e]}deg)` },
687
+ style: { transform: `rotate(${gr[e]}deg)` },
688
688
  "aria-hidden": "true",
689
689
  children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" })
690
690
  }
691
691
  );
692
- function mr(e) {
692
+ function yr(e) {
693
693
  return e === "top-left" || e === "bottom-left" ? "left" : "right";
694
694
  }
695
- const un = "ll-hidden-tab-center-y", gr = 5, Qt = 16;
696
- function yr() {
695
+ const pn = "ll-hidden-tab-center-y", vr = 5, Zt = 16;
696
+ function br() {
697
697
  if (typeof window > "u") return null;
698
698
  try {
699
- const e = window.localStorage.getItem(un);
699
+ const e = window.localStorage.getItem(pn);
700
700
  if (!e) return null;
701
701
  const t = Number.parseFloat(e);
702
702
  return Number.isFinite(t) ? t : null;
@@ -704,14 +704,14 @@ function yr() {
704
704
  return null;
705
705
  }
706
706
  }
707
- function Zt(e) {
707
+ function en(e) {
708
708
  if (!(typeof window > "u"))
709
709
  try {
710
- window.localStorage.setItem(un, String(e));
710
+ window.localStorage.setItem(pn, String(e));
711
711
  } catch {
712
712
  }
713
713
  }
714
- const vr = ({
714
+ const wr = ({
715
715
  position: e,
716
716
  isMobile: t,
717
717
  isSpeaking: r,
@@ -720,16 +720,16 @@ const vr = ({
720
720
  avatarImageUrl: l,
721
721
  agentName: s
722
722
  }) => {
723
- const a = mr(e), d = a === "right" ? "left" : "right", f = t ? 80 : 72, _ = !!l, [u, c] = C(null), [I, L] = C(!1), b = A(null), y = A(!1), m = E(
723
+ const a = yr(e), d = a === "right" ? "left" : "right", f = t ? 80 : 72, _ = !!l, [u, c] = C(null), [I, k] = C(!1), b = A(null), v = A(!1), m = E(
724
724
  (N) => {
725
725
  if (typeof window > "u") return N;
726
- const M = f / 2, F = Qt + M, re = window.innerHeight - Qt - M;
727
- return re < F ? Math.max(F, N) : Math.max(F, Math.min(re, N));
726
+ const M = f / 2, F = Zt + M, ie = window.innerHeight - Zt - M;
727
+ return ie < F ? Math.max(F, N) : Math.max(F, Math.min(ie, N));
728
728
  },
729
729
  [f]
730
730
  );
731
731
  T(() => {
732
- const N = yr();
732
+ const N = br();
733
733
  c(m(N ?? window.innerHeight / 2));
734
734
  const M = () => {
735
735
  c((F) => F === null ? null : m(F));
@@ -756,7 +756,7 @@ const vr = ({
756
756
  const M = b.current;
757
757
  if (!M) return;
758
758
  const F = N.clientY - M.startClientY;
759
- !M.moved && Math.abs(F) > gr && (M.moved = !0, L(!0)), M.moved && c(m(M.startCenterY + F));
759
+ !M.moved && Math.abs(F) > vr && (M.moved = !0, k(!0)), M.moved && c(m(M.startCenterY + F));
760
760
  },
761
761
  [m]
762
762
  ), D = E(
@@ -767,13 +767,13 @@ const vr = ({
767
767
  N.currentTarget.releasePointerCapture(N.pointerId);
768
768
  } catch {
769
769
  }
770
- b.current = null, M.moved && (L(!1), y.current = !0, c((F) => (F !== null && Zt(F), F)));
770
+ b.current = null, M.moved && (k(!1), v.current = !0, c((F) => (F !== null && en(F), F)));
771
771
  }
772
772
  },
773
773
  []
774
774
  ), x = E(() => {
775
- if (y.current) {
776
- y.current = !1;
775
+ if (v.current) {
776
+ v.current = !1;
777
777
  return;
778
778
  }
779
779
  i();
@@ -784,8 +784,8 @@ const vr = ({
784
784
  const M = N.key === "ArrowUp" ? -8 : 8;
785
785
  c((F) => {
786
786
  if (F === null) return F;
787
- const re = m(F + M);
788
- return Zt(re), re;
787
+ const ie = m(F + M);
788
+ return en(ie), ie;
789
789
  });
790
790
  }
791
791
  },
@@ -817,9 +817,9 @@ const vr = ({
817
817
  // as the click affordance), then the circular avatar photo
818
818
  // taking the rest of the tab. Reinforces "this is an
819
819
  // avatar-based experience" even when collapsed.
820
- /* @__PURE__ */ v(ot, { children: [
820
+ /* @__PURE__ */ y(Ue, { children: [
821
821
  /* @__PURE__ */ n(
822
- Xt,
822
+ Qt,
823
823
  {
824
824
  direction: d,
825
825
  className: "ll-hidden__chevron ll-hidden__chevron--mini"
@@ -836,7 +836,7 @@ const vr = ({
836
836
  )
837
837
  ] })
838
838
  ) : /* @__PURE__ */ n(
839
- Xt,
839
+ Qt,
840
840
  {
841
841
  direction: d,
842
842
  className: "ll-hidden__chevron"
@@ -844,7 +844,7 @@ const vr = ({
844
844
  )
845
845
  }
846
846
  );
847
- }, br = ({
847
+ }, _r = ({
848
848
  audioLevel: e,
849
849
  bars: t = 20,
850
850
  maxHeight: r = 20,
@@ -852,7 +852,7 @@ const vr = ({
852
852
  className: o,
853
853
  barClassName: l
854
854
  }) => {
855
- const s = A(null), a = A([]), d = Ue(() => {
855
+ const s = A(null), a = A([]), d = je(() => {
856
856
  const _ = (Math.sqrt(5) - 1) / 2;
857
857
  return Array.from({ length: t }, (u, c) => 0.5 + c * _ % 1 * 0.5);
858
858
  }, [t]);
@@ -860,8 +860,8 @@ const vr = ({
860
860
  for (let c = 0; c < t; c++) {
861
861
  const I = a.current[c];
862
862
  if (!I) continue;
863
- const L = Math.max(i, u * r * d[c]);
864
- I.style.height = `${L}px`;
863
+ const k = Math.max(i, u * r * d[c]);
864
+ I.style.height = `${k}px`;
865
865
  }
866
866
  }), [e, t, r, i, d]);
867
867
  const f = ["ll-waveform", o].filter(Boolean).join(" ");
@@ -876,7 +876,7 @@ const vr = ({
876
876
  },
877
877
  u
878
878
  )) });
879
- }, wr = ({
879
+ }, xr = ({
880
880
  position: e,
881
881
  isMobile: t,
882
882
  agentName: r,
@@ -893,7 +893,7 @@ const vr = ({
893
893
  className: "ll-minimized ll-minimized--mobile",
894
894
  role: "region",
895
895
  "aria-label": `${r} widget`,
896
- children: /* @__PURE__ */ v(
896
+ children: /* @__PURE__ */ y(
897
897
  "button",
898
898
  {
899
899
  type: "button",
@@ -913,7 +913,7 @@ const vr = ({
913
913
  )
914
914
  ) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
915
915
  /* @__PURE__ */ n(
916
- br,
916
+ _r,
917
917
  {
918
918
  audioLevel: s,
919
919
  bars: 16,
@@ -922,7 +922,7 @@ const vr = ({
922
922
  }
923
923
  ),
924
924
  /* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
925
- /* @__PURE__ */ v("div", { className: "ll-minimized__controls", children: [
925
+ /* @__PURE__ */ y("div", { className: "ll-minimized__controls", children: [
926
926
  /* @__PURE__ */ n(
927
927
  "span",
928
928
  {
@@ -936,10 +936,10 @@ const vr = ({
936
936
  (_.key === "Enter" || _.key === " ") && (_.stopPropagation(), _.preventDefault(), d());
937
937
  },
938
938
  "aria-label": l ? "Unmute microphone" : "Mute microphone",
939
- children: /* @__PURE__ */ n(Jt, { muted: l, className: "ll-minimized__icon" })
939
+ children: /* @__PURE__ */ n(Kt, { muted: l, className: "ll-minimized__icon" })
940
940
  }
941
941
  ),
942
- /* @__PURE__ */ n(Kt, { className: "ll-minimized__icon ll-minimized__icon--expand" })
942
+ /* @__PURE__ */ n(Xt, { className: "ll-minimized__icon ll-minimized__icon--expand" })
943
943
  ] })
944
944
  ]
945
945
  }
@@ -952,7 +952,7 @@ const vr = ({
952
952
  "data-position": e,
953
953
  role: "region",
954
954
  "aria-label": `${r} widget`,
955
- children: /* @__PURE__ */ v("div", { className: "ll-minimized__surface", children: [
955
+ children: /* @__PURE__ */ y("div", { className: "ll-minimized__surface", children: [
956
956
  i ? (
957
957
  // eslint-disable-next-line @next/next/no-img-element
958
958
  /* @__PURE__ */ n(
@@ -964,11 +964,11 @@ const vr = ({
964
964
  }
965
965
  )
966
966
  ) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
967
- /* @__PURE__ */ v("div", { className: "ll-minimized__meta", children: [
967
+ /* @__PURE__ */ y("div", { className: "ll-minimized__meta", children: [
968
968
  /* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
969
969
  /* @__PURE__ */ n("span", { className: "ll-minimized__state", children: o === "speaking" ? "Speaking" : o === "thinking" ? "Thinking" : "Listening" })
970
970
  ] }),
971
- /* @__PURE__ */ v("div", { className: "ll-minimized__controls", children: [
971
+ /* @__PURE__ */ y("div", { className: "ll-minimized__controls", children: [
972
972
  /* @__PURE__ */ n(
973
973
  "button",
974
974
  {
@@ -976,7 +976,7 @@ const vr = ({
976
976
  className: "ll-minimized__btn",
977
977
  onClick: d,
978
978
  "aria-label": l ? "Unmute microphone" : "Mute microphone",
979
- children: /* @__PURE__ */ n(Jt, { muted: l, className: "ll-minimized__icon" })
979
+ children: /* @__PURE__ */ n(Kt, { muted: l, className: "ll-minimized__icon" })
980
980
  }
981
981
  ),
982
982
  /* @__PURE__ */ n(
@@ -986,7 +986,7 @@ const vr = ({
986
986
  className: "ll-minimized__btn",
987
987
  onClick: a,
988
988
  "aria-label": `Expand ${r} widget`,
989
- children: /* @__PURE__ */ n(Kt, { className: "ll-minimized__icon" })
989
+ children: /* @__PURE__ */ n(Xt, { className: "ll-minimized__icon" })
990
990
  }
991
991
  ),
992
992
  /* @__PURE__ */ n(
@@ -996,13 +996,13 @@ const vr = ({
996
996
  className: "ll-minimized__btn ll-minimized__btn--close",
997
997
  onClick: f,
998
998
  "aria-label": "Close widget",
999
- children: /* @__PURE__ */ n(pr, { className: "ll-minimized__icon" })
999
+ children: /* @__PURE__ */ n(mr, { className: "ll-minimized__icon" })
1000
1000
  }
1001
1001
  )
1002
1002
  ] })
1003
1003
  ] })
1004
1004
  }
1005
- ), _r = ({
1005
+ ), kr = ({
1006
1006
  src: e,
1007
1007
  alt: t,
1008
1008
  preCannedPlaying: r = !1,
@@ -1040,14 +1040,14 @@ const vr = ({
1040
1040
  }
1041
1041
  )
1042
1042
  );
1043
- }, xr = 8, en = 8, kr = ({
1043
+ }, Lr = 8, tn = 8, Er = ({
1044
1044
  open: e,
1045
1045
  onClose: t,
1046
1046
  anchorRef: r,
1047
1047
  children: i
1048
1048
  }) => {
1049
1049
  const o = A(null), [l, s] = C(null);
1050
- return Tn(() => {
1050
+ return Pn(() => {
1051
1051
  if (!e) {
1052
1052
  s(null);
1053
1053
  return;
@@ -1056,9 +1056,9 @@ const vr = ({
1056
1056
  if (!a) return;
1057
1057
  const d = () => {
1058
1058
  const f = a.getBoundingClientRect(), _ = {
1059
- top: f.top - xr,
1059
+ top: f.top - Lr,
1060
1060
  left: f.left + f.width / 2
1061
- }, u = en + 90, c = window.innerWidth - en - 90;
1061
+ }, u = tn + 90, c = window.innerWidth - tn - 90;
1062
1062
  _.left < u && (_.left = u), _.left > c && (_.left = c), s(_);
1063
1063
  };
1064
1064
  return d(), window.addEventListener("scroll", d, !0), window.addEventListener("resize", d), () => {
@@ -1075,7 +1075,7 @@ const vr = ({
1075
1075
  return document.addEventListener("mousedown", a), document.addEventListener("keydown", d), () => {
1076
1076
  document.removeEventListener("mousedown", a), document.removeEventListener("keydown", d);
1077
1077
  };
1078
- }, [e, t, r]), !e || l === null || typeof document > "u" ? null : On(
1078
+ }, [e, t, r]), !e || l === null || typeof document > "u" ? null : un(
1079
1079
  /* @__PURE__ */ n(
1080
1080
  "div",
1081
1081
  {
@@ -1095,7 +1095,7 @@ const vr = ({
1095
1095
  ),
1096
1096
  document.body
1097
1097
  );
1098
- }, Lr = ({
1098
+ }, Cr = ({
1099
1099
  isMuted: e,
1100
1100
  onToggleMute: t,
1101
1101
  isCameraEnabled: r,
@@ -1111,9 +1111,9 @@ const vr = ({
1111
1111
  onToggleTyping: c,
1112
1112
  onDisconnect: I
1113
1113
  }) => {
1114
- const [L, b] = C(!1), y = A(null);
1115
- return /* @__PURE__ */ v(ot, { children: [
1116
- /* @__PURE__ */ v(
1114
+ const [k, b] = C(!1), v = A(null);
1115
+ return /* @__PURE__ */ y(Ue, { children: [
1116
+ /* @__PURE__ */ y(
1117
1117
  "div",
1118
1118
  {
1119
1119
  className: "ll-toolbar ll-toolbar--compact",
@@ -1127,20 +1127,20 @@ const vr = ({
1127
1127
  className: `ll-tool ${e ? "is-muted" : ""}`,
1128
1128
  onClick: t,
1129
1129
  "aria-label": e ? "Unmute microphone" : "Mute microphone",
1130
- children: /* @__PURE__ */ n(hn, { muted: e })
1130
+ children: /* @__PURE__ */ n(gn, { muted: e })
1131
1131
  }
1132
1132
  ),
1133
1133
  /* @__PURE__ */ n(
1134
1134
  "button",
1135
1135
  {
1136
- ref: y,
1136
+ ref: v,
1137
1137
  type: "button",
1138
- className: `ll-tool ${L ? "is-on" : ""}`,
1138
+ className: `ll-tool ${k ? "is-on" : ""}`,
1139
1139
  onClick: () => b((m) => !m),
1140
1140
  "aria-label": "More controls",
1141
1141
  "aria-haspopup": "menu",
1142
- "aria-expanded": L,
1143
- children: /* @__PURE__ */ n(Er, {})
1142
+ "aria-expanded": k,
1143
+ children: /* @__PURE__ */ n(Sr, {})
1144
1144
  }
1145
1145
  ),
1146
1146
  /* @__PURE__ */ n(
@@ -1150,20 +1150,20 @@ const vr = ({
1150
1150
  className: "ll-tool ll-tool--danger",
1151
1151
  onClick: I,
1152
1152
  "aria-label": "End conversation",
1153
- children: /* @__PURE__ */ n(gn, {})
1153
+ children: /* @__PURE__ */ n(vn, {})
1154
1154
  }
1155
1155
  )
1156
1156
  ]
1157
1157
  }
1158
1158
  ),
1159
- /* @__PURE__ */ v(
1160
- kr,
1159
+ /* @__PURE__ */ y(
1160
+ Er,
1161
1161
  {
1162
- open: L,
1162
+ open: k,
1163
1163
  onClose: () => b(!1),
1164
- anchorRef: y,
1164
+ anchorRef: v,
1165
1165
  children: [
1166
- o && /* @__PURE__ */ v(
1166
+ o && /* @__PURE__ */ y(
1167
1167
  "button",
1168
1168
  {
1169
1169
  type: "button",
@@ -1172,12 +1172,12 @@ const vr = ({
1172
1172
  i(), b(!1);
1173
1173
  },
1174
1174
  children: [
1175
- /* @__PURE__ */ n(pn, {}),
1175
+ /* @__PURE__ */ n(mn, {}),
1176
1176
  /* @__PURE__ */ n("span", { children: r ? "Stop camera" : "Start camera" })
1177
1177
  ]
1178
1178
  }
1179
1179
  ),
1180
- a && /* @__PURE__ */ v(
1180
+ a && /* @__PURE__ */ y(
1181
1181
  "button",
1182
1182
  {
1183
1183
  type: "button",
@@ -1186,12 +1186,12 @@ const vr = ({
1186
1186
  s(), b(!1);
1187
1187
  },
1188
1188
  children: [
1189
- /* @__PURE__ */ n(fn, {}),
1189
+ /* @__PURE__ */ n(hn, {}),
1190
1190
  /* @__PURE__ */ n("span", { children: l ? "Stop sharing" : "Share screen" })
1191
1191
  ]
1192
1192
  }
1193
1193
  ),
1194
- /* @__PURE__ */ v(
1194
+ /* @__PURE__ */ y(
1195
1195
  "button",
1196
1196
  {
1197
1197
  type: "button",
@@ -1200,12 +1200,12 @@ const vr = ({
1200
1200
  f(), b(!1);
1201
1201
  },
1202
1202
  children: [
1203
- /* @__PURE__ */ n(mn, { muted: d }),
1203
+ /* @__PURE__ */ n(yn, { muted: d }),
1204
1204
  /* @__PURE__ */ n("span", { children: d ? "Unmute speaker" : "Mute speaker" })
1205
1205
  ]
1206
1206
  }
1207
1207
  ),
1208
- _ && /* @__PURE__ */ v(
1208
+ _ && /* @__PURE__ */ y(
1209
1209
  "button",
1210
1210
  {
1211
1211
  type: "button",
@@ -1214,12 +1214,12 @@ const vr = ({
1214
1214
  c(), b(!1);
1215
1215
  },
1216
1216
  children: [
1217
- /* @__PURE__ */ n(Cr, {}),
1217
+ /* @__PURE__ */ n(Nr, {}),
1218
1218
  /* @__PURE__ */ n("span", { children: u ? "Hide typing" : "Type a message" })
1219
1219
  ]
1220
1220
  }
1221
1221
  ),
1222
- /* @__PURE__ */ v(
1222
+ /* @__PURE__ */ y(
1223
1223
  "button",
1224
1224
  {
1225
1225
  type: "button",
@@ -1237,8 +1237,8 @@ const vr = ({
1237
1237
  )
1238
1238
  ] });
1239
1239
  };
1240
- function Er() {
1241
- return /* @__PURE__ */ v(
1240
+ function Sr() {
1241
+ return /* @__PURE__ */ y(
1242
1242
  "svg",
1243
1243
  {
1244
1244
  width: "16",
@@ -1254,7 +1254,7 @@ function Er() {
1254
1254
  }
1255
1255
  );
1256
1256
  }
1257
- function Cr() {
1257
+ function Nr() {
1258
1258
  return /* @__PURE__ */ n(
1259
1259
  "svg",
1260
1260
  {
@@ -1271,7 +1271,7 @@ function Cr() {
1271
1271
  }
1272
1272
  );
1273
1273
  }
1274
- const Sr = ({
1274
+ const Ar = ({
1275
1275
  position: e,
1276
1276
  isMobile: t,
1277
1277
  agentName: r,
@@ -1286,9 +1286,9 @@ const Sr = ({
1286
1286
  onToggleTeamSwitcher: u,
1287
1287
  onSelectTeamMember: c,
1288
1288
  languageMenuOpen: I,
1289
- onToggleLanguageMenu: L,
1289
+ onToggleLanguageMenu: k,
1290
1290
  connectionState: b,
1291
- agentState: y,
1291
+ agentState: v,
1292
1292
  transcript: m,
1293
1293
  canResume: S,
1294
1294
  needsUserGesture: $,
@@ -1300,23 +1300,23 @@ const Sr = ({
1300
1300
  isCameraEnabled: N,
1301
1301
  cameraPreviewEl: M,
1302
1302
  cameraDevices: F,
1303
- activeCameraId: re,
1304
- isScreenShareEnabled: ie,
1303
+ activeCameraId: ie,
1304
+ isScreenShareEnabled: oe,
1305
1305
  screenPreviewEl: Z,
1306
- isSpeakerMuted: ae,
1307
- allowCamera: fe,
1308
- allowScreenShare: ve,
1309
- allowTyping: pe,
1310
- showMinimize: be = !0,
1311
- chromeless: he = !1,
1306
+ isSpeakerMuted: ce,
1307
+ allowCamera: he,
1308
+ allowScreenShare: be,
1309
+ allowTyping: me,
1310
+ showMinimize: we = !0,
1311
+ chromeless: ge = !1,
1312
1312
  compactControls: ee = !1,
1313
- transforming: at,
1314
- transformingLabel: je,
1315
- avatarVideoContainerRef: ct,
1316
- agentVideoEl: oe,
1317
- onConnect: Ve,
1318
- onDisconnect: Ye,
1319
- onRetry: Ge,
1313
+ transforming: lt,
1314
+ transformingLabel: Ve,
1315
+ avatarVideoContainerRef: at,
1316
+ agentVideoEl: le,
1317
+ onConnect: Ye,
1318
+ onDisconnect: Ge,
1319
+ onRetry: Je,
1320
1320
  onResumeAudio: De,
1321
1321
  onToggleMute: Ae,
1322
1322
  onSwitchMicDevice: Pe,
@@ -1325,89 +1325,89 @@ const Sr = ({
1325
1325
  onToggleScreenShare: Ie,
1326
1326
  onToggleSpeaker: Te,
1327
1327
  onSendMessage: z,
1328
- onMinimize: st,
1329
- onClose: dt,
1328
+ onMinimize: ct,
1329
+ onClose: st,
1330
1330
  onClearMicError: vt
1331
1331
  }) => {
1332
1332
  var Me;
1333
- const we = ((a == null ? void 0 : a.length) ?? 0) > 1, _e = b === "connecting" || b === "connected", te = b === "connected", bt = b === "idle" || b === "disconnected" || b === "error", [Je, ce] = C(!1);
1333
+ const _e = ((a == null ? void 0 : a.length) ?? 0) > 1, xe = b === "connecting" || b === "connected", te = b === "connected", bt = b === "idle" || b === "disconnected" || b === "error", [Ke, se] = C(!1);
1334
1334
  T(() => {
1335
- if (!oe) {
1336
- ce(!1);
1335
+ if (!le) {
1336
+ se(!1);
1337
1337
  return;
1338
1338
  }
1339
- if (!oe.paused && oe.readyState >= 2) {
1340
- ce(!0);
1339
+ if (!le.paused && le.readyState >= 2) {
1340
+ se(!0);
1341
1341
  return;
1342
1342
  }
1343
- ce(!1);
1344
- const h = () => ce(!0);
1345
- return oe.addEventListener("playing", h), oe.addEventListener("loadeddata", h), () => {
1346
- oe.removeEventListener("playing", h), oe.removeEventListener("loadeddata", h);
1343
+ se(!1);
1344
+ const h = () => se(!0);
1345
+ return le.addEventListener("playing", h), le.addEventListener("loadeddata", h), () => {
1346
+ le.removeEventListener("playing", h), le.removeEventListener("loadeddata", h);
1347
1347
  };
1348
- }, [oe]);
1349
- const [X, Ke] = C(!1);
1348
+ }, [le]);
1349
+ const [X, Xe] = C(!1);
1350
1350
  T(() => {
1351
1351
  if (!te) {
1352
- Ke(!1);
1352
+ Xe(!1);
1353
1353
  return;
1354
1354
  }
1355
- if (Je) return;
1356
- const h = setTimeout(() => Ke(!0), 8e3);
1355
+ if (Ke) return;
1356
+ const h = setTimeout(() => Xe(!0), 8e3);
1357
1357
  return () => clearTimeout(h);
1358
- }, [te, Je]);
1359
- const ze = b === "connecting" || te && !!i && !Je && !X, xe = A(null), se = A(null);
1358
+ }, [te, Ke]);
1359
+ const dt = b === "connecting" || te && !!i && !Ke && !X, ne = A(null), de = A(null);
1360
1360
  T(() => {
1361
- const h = xe.current;
1361
+ const h = ne.current;
1362
1362
  h && (h.innerHTML = "", M && (M.style.width = "100%", M.style.height = "100%", M.style.objectFit = "cover", M.style.transform = "scaleX(-1)", h.appendChild(M)));
1363
1363
  }, [M]), T(() => {
1364
- const h = se.current;
1364
+ const h = de.current;
1365
1365
  h && (h.innerHTML = "", Z && (Z.style.width = "100%", Z.style.height = "100%", Z.style.objectFit = "contain", h.appendChild(Z)));
1366
1366
  }, [Z]);
1367
- const [me, ke] = C(!1), [G, ne] = C(!1);
1367
+ const [ue, ke] = C(!1), [G, re] = C(!1);
1368
1368
  T(() => {
1369
- if (!me && !G && !I && !_) return;
1369
+ if (!ue && !G && !I && !_) return;
1370
1370
  const h = () => {
1371
- ke(!1), ne(!1), I && L(), _ && u();
1371
+ ke(!1), re(!1), I && k(), _ && u();
1372
1372
  };
1373
1373
  return document.addEventListener("click", h), () => document.removeEventListener("click", h);
1374
1374
  }, [
1375
- me,
1375
+ ue,
1376
1376
  G,
1377
1377
  I,
1378
1378
  _,
1379
- L,
1379
+ k,
1380
1380
  u
1381
1381
  ]);
1382
- const [Le, Xe] = C(!1), wt = E(() => Xe((h) => !h), []), [Ee, Oe] = C(""), ut = E(
1382
+ const [Le, Qe] = C(!1), wt = E(() => Qe((h) => !h), []), [Ee, ze] = C(""), ut = E(
1383
1383
  (h) => {
1384
1384
  h.preventDefault();
1385
1385
  const V = Ee.trim();
1386
- V && (z(V), Oe(""));
1386
+ V && (z(V), ze(""));
1387
1387
  },
1388
1388
  [Ee, z]
1389
- ), Qe = s.productName || "Live Layer";
1390
- let de = null, Ce = null;
1389
+ ), Ze = s.productName || "Live Layer";
1390
+ let fe = null, Ce = null;
1391
1391
  for (let h = m.length - 1; h >= 0; h--) {
1392
1392
  const V = m[h];
1393
- if (!de && V.role === "agent" ? de = V : !Ce && V.role === "user" && (Ce = V), de && Ce) break;
1393
+ if (!fe && V.role === "agent" ? fe = V : !Ce && V.role === "user" && (Ce = V), fe && Ce) break;
1394
1394
  }
1395
- const ft = te ? (de == null ? void 0 : de.text) || null : l || null, He = te && (Ce == null ? void 0 : Ce.text) || null, _t = [
1395
+ const ft = te ? (fe == null ? void 0 : fe.text) || null : l || null, Oe = te && (Ce == null ? void 0 : Ce.text) || null, _t = [
1396
1396
  "ll-expanded",
1397
1397
  t ? "ll-expanded--mobile" : "ll-expanded--desktop"
1398
1398
  ].join(" ");
1399
- return /* @__PURE__ */ v(
1399
+ return /* @__PURE__ */ y(
1400
1400
  "div",
1401
1401
  {
1402
1402
  className: _t,
1403
1403
  "data-position": e,
1404
- "data-state": te ? "connected" : _e ? "connecting" : "idle",
1404
+ "data-state": te ? "connected" : xe ? "connecting" : "idle",
1405
1405
  role: "dialog",
1406
1406
  "aria-label": `${r} widget`,
1407
1407
  children: [
1408
- /* @__PURE__ */ v("div", { className: "ll-expanded__bg", children: [
1408
+ /* @__PURE__ */ y("div", { className: "ll-expanded__bg", children: [
1409
1409
  i ? /* @__PURE__ */ n(
1410
- _r,
1410
+ kr,
1411
1411
  {
1412
1412
  src: i,
1413
1413
  alt: r,
@@ -1426,12 +1426,12 @@ const Sr = ({
1426
1426
  }
1427
1427
  )
1428
1428
  ] }),
1429
- /* @__PURE__ */ n("div", { ref: ct, className: "ll-expanded__video" }),
1430
- ze && /* @__PURE__ */ v("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1429
+ /* @__PURE__ */ n("div", { ref: at, className: "ll-expanded__video" }),
1430
+ dt && /* @__PURE__ */ y("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1431
1431
  /* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
1432
1432
  /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: f ? "Switching..." : "Connecting..." })
1433
1433
  ] }),
1434
- $ && te && /* @__PURE__ */ v(
1434
+ $ && te && /* @__PURE__ */ y(
1435
1435
  "button",
1436
1436
  {
1437
1437
  type: "button",
@@ -1443,46 +1443,46 @@ const Sr = ({
1443
1443
  ]
1444
1444
  }
1445
1445
  ),
1446
- at && /* @__PURE__ */ v(
1446
+ lt && /* @__PURE__ */ y(
1447
1447
  "div",
1448
1448
  {
1449
1449
  className: "ll-expanded__overlay ll-expanded__overlay--transforming",
1450
1450
  role: "status",
1451
1451
  "aria-live": "polite",
1452
- "aria-label": je,
1452
+ "aria-label": Ve,
1453
1453
  children: [
1454
1454
  /* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
1455
- /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: je })
1455
+ /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: Ve })
1456
1456
  ]
1457
1457
  }
1458
1458
  ),
1459
- _e ? /* @__PURE__ */ v(ot, { children: [
1460
- !ee && /* @__PURE__ */ v("div", { className: "ll-expanded__topbar", children: [
1461
- !he && /* @__PURE__ */ v("div", { className: "ll-expanded__topbar-left", children: [
1462
- /* @__PURE__ */ v("div", { className: "ll-expanded__pill-wrap", children: [
1463
- /* @__PURE__ */ v(
1459
+ xe ? /* @__PURE__ */ y(Ue, { children: [
1460
+ !ee && /* @__PURE__ */ y("div", { className: "ll-expanded__topbar", children: [
1461
+ !ge && /* @__PURE__ */ y("div", { className: "ll-expanded__topbar-left", children: [
1462
+ /* @__PURE__ */ y("div", { className: "ll-expanded__pill-wrap", children: [
1463
+ /* @__PURE__ */ y(
1464
1464
  "button",
1465
1465
  {
1466
1466
  type: "button",
1467
1467
  className: "ll-hpill",
1468
1468
  onClick: (h) => {
1469
- we && (h.stopPropagation(), u());
1469
+ _e && (h.stopPropagation(), u());
1470
1470
  },
1471
- "aria-haspopup": we ? "listbox" : void 0,
1472
- "aria-expanded": we ? _ : void 0,
1471
+ "aria-haspopup": _e ? "listbox" : void 0,
1472
+ "aria-expanded": _e ? _ : void 0,
1473
1473
  children: [
1474
1474
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
1475
- we && /* @__PURE__ */ n(ht, {})
1475
+ _e && /* @__PURE__ */ n(ht, {})
1476
1476
  ]
1477
1477
  }
1478
1478
  ),
1479
- we && _ && /* @__PURE__ */ n(
1479
+ _e && _ && /* @__PURE__ */ n(
1480
1480
  "div",
1481
1481
  {
1482
1482
  className: "ll-hmenu",
1483
1483
  onClick: (h) => h.stopPropagation(),
1484
1484
  role: "listbox",
1485
- children: a == null ? void 0 : a.map((h) => /* @__PURE__ */ v(
1485
+ children: a == null ? void 0 : a.map((h) => /* @__PURE__ */ y(
1486
1486
  "button",
1487
1487
  {
1488
1488
  type: "button",
@@ -1508,14 +1508,14 @@ const Sr = ({
1508
1508
  }
1509
1509
  )
1510
1510
  ] }),
1511
- /* @__PURE__ */ v("div", { className: "ll-expanded__pill-wrap", children: [
1512
- /* @__PURE__ */ v(
1511
+ /* @__PURE__ */ y("div", { className: "ll-expanded__pill-wrap", children: [
1512
+ /* @__PURE__ */ y(
1513
1513
  "button",
1514
1514
  {
1515
1515
  type: "button",
1516
1516
  className: "ll-hpill ll-hpill--compact",
1517
1517
  onClick: (h) => {
1518
- h.stopPropagation(), L();
1518
+ h.stopPropagation(), k();
1519
1519
  },
1520
1520
  "aria-haspopup": "listbox",
1521
1521
  "aria-expanded": I,
@@ -1549,21 +1549,21 @@ const Sr = ({
1549
1549
  /* @__PURE__ */ n(
1550
1550
  "span",
1551
1551
  {
1552
- className: `ll-expanded__state ll-expanded__state--${y}`,
1553
- children: y
1552
+ className: `ll-expanded__state ll-expanded__state--${v}`,
1553
+ children: v
1554
1554
  }
1555
1555
  )
1556
1556
  ] }),
1557
- /* @__PURE__ */ v("div", { className: "ll-expanded__header-actions", children: [
1558
- be !== !1 && /* @__PURE__ */ n(
1557
+ /* @__PURE__ */ y("div", { className: "ll-expanded__header-actions", children: [
1558
+ we !== !1 && /* @__PURE__ */ n(
1559
1559
  "button",
1560
1560
  {
1561
1561
  type: "button",
1562
1562
  className: "ll-hbtn",
1563
- onClick: st,
1563
+ onClick: ct,
1564
1564
  "aria-label": "Minimize widget",
1565
1565
  title: "Minimize",
1566
- children: /* @__PURE__ */ n(nn, {})
1566
+ children: /* @__PURE__ */ n(rn, {})
1567
1567
  }
1568
1568
  ),
1569
1569
  /* @__PURE__ */ n(
@@ -1571,34 +1571,34 @@ const Sr = ({
1571
1571
  {
1572
1572
  type: "button",
1573
1573
  className: "ll-hbtn ll-hbtn--danger",
1574
- onClick: dt,
1574
+ onClick: st,
1575
1575
  "aria-label": "End call",
1576
1576
  title: "End call",
1577
- children: /* @__PURE__ */ n(tn, {})
1577
+ children: /* @__PURE__ */ n(nn, {})
1578
1578
  }
1579
1579
  )
1580
1580
  ] })
1581
1581
  ] }),
1582
- ee && /* @__PURE__ */ v("div", { className: "ll-compact-status", "data-state": y, children: [
1582
+ ee && /* @__PURE__ */ y("div", { className: "ll-compact-status", "data-state": v, children: [
1583
1583
  /* @__PURE__ */ n("span", { className: "ll-compact-status__dot", "aria-hidden": !0 }),
1584
- /* @__PURE__ */ n("span", { className: "ll-compact-status__label", children: y })
1584
+ /* @__PURE__ */ n("span", { className: "ll-compact-status__label", children: v })
1585
1585
  ] })
1586
1586
  ] }) : (
1587
1587
  // Idle-state header with Live Layer product name + minimize/close.
1588
1588
  // Hidden in compact mode — on a 140×210 docked slot the brand pill
1589
1589
  // and 40px buttons crowded out the central "Start video call"
1590
1590
  // affordance. The user can dismiss by scrolling past the slot.
1591
- !ee && /* @__PURE__ */ v("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
1592
- /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Qe }),
1593
- /* @__PURE__ */ v("div", { className: "ll-expanded__header-actions", children: [
1594
- be !== !1 && /* @__PURE__ */ n(
1591
+ !ee && /* @__PURE__ */ y("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
1592
+ /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Ze }),
1593
+ /* @__PURE__ */ y("div", { className: "ll-expanded__header-actions", children: [
1594
+ we !== !1 && /* @__PURE__ */ n(
1595
1595
  "button",
1596
1596
  {
1597
1597
  type: "button",
1598
1598
  className: "ll-hbtn ll-hbtn--ghost",
1599
- onClick: st,
1599
+ onClick: ct,
1600
1600
  "aria-label": "Minimize widget",
1601
- children: /* @__PURE__ */ n(nn, {})
1601
+ children: /* @__PURE__ */ n(rn, {})
1602
1602
  }
1603
1603
  ),
1604
1604
  /* @__PURE__ */ n(
@@ -1606,9 +1606,9 @@ const Sr = ({
1606
1606
  {
1607
1607
  type: "button",
1608
1608
  className: "ll-hbtn ll-hbtn--danger",
1609
- onClick: dt,
1609
+ onClick: st,
1610
1610
  "aria-label": "Close widget",
1611
- children: /* @__PURE__ */ n(tn, {})
1611
+ children: /* @__PURE__ */ n(nn, {})
1612
1612
  }
1613
1613
  )
1614
1614
  ] })
@@ -1616,13 +1616,13 @@ const Sr = ({
1616
1616
  ),
1617
1617
  bt && /* @__PURE__ */ (() => {
1618
1618
  const h = S ? "Resume session" : b === "disconnected" ? "Reconnect to agent" : "Start video call";
1619
- return /* @__PURE__ */ v(ot, { children: [
1620
- !D && /* @__PURE__ */ v(
1619
+ return /* @__PURE__ */ y(Ue, { children: [
1620
+ !D && /* @__PURE__ */ y(
1621
1621
  "button",
1622
1622
  {
1623
1623
  type: "button",
1624
1624
  className: "ll-expanded__play",
1625
- onClick: Ve,
1625
+ onClick: Ye,
1626
1626
  "aria-label": h,
1627
1627
  children: [
1628
1628
  /* @__PURE__ */ n("div", { className: "ll-expanded__play-circle", children: /* @__PURE__ */ n("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("polygon", { points: "6 3 20 12 6 21 6 3" }) }) }),
@@ -1630,14 +1630,14 @@ const Sr = ({
1630
1630
  ]
1631
1631
  }
1632
1632
  ),
1633
- !ee && /* @__PURE__ */ v("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
1633
+ !ee && /* @__PURE__ */ y("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
1634
1634
  l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
1635
1635
  /* @__PURE__ */ n(
1636
1636
  "button",
1637
1637
  {
1638
1638
  type: "button",
1639
1639
  className: "ll-expanded__cta",
1640
- onClick: Ve,
1640
+ onClick: Ye,
1641
1641
  "aria-label": h,
1642
1642
  children: h
1643
1643
  }
@@ -1645,29 +1645,29 @@ const Sr = ({
1645
1645
  ] })
1646
1646
  ] });
1647
1647
  })(),
1648
- /* @__PURE__ */ v(
1648
+ /* @__PURE__ */ y(
1649
1649
  "div",
1650
1650
  {
1651
- className: `ll-expanded__pip ${_e && (N || ie) ? "is-visible" : ""}`,
1651
+ className: `ll-expanded__pip ${xe && (N || oe) ? "is-visible" : ""}`,
1652
1652
  children: [
1653
1653
  /* @__PURE__ */ n(
1654
1654
  "div",
1655
1655
  {
1656
- ref: se,
1657
- className: ie ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1656
+ ref: de,
1657
+ className: oe ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1658
1658
  }
1659
1659
  ),
1660
1660
  /* @__PURE__ */ n(
1661
1661
  "div",
1662
1662
  {
1663
- ref: xe,
1664
- className: !ie && N ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1663
+ ref: ne,
1664
+ className: !oe && N ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1665
1665
  }
1666
1666
  )
1667
1667
  ]
1668
1668
  }
1669
1669
  ),
1670
- _e ? /* @__PURE__ */ v("div", { className: "ll-expanded__bottom", children: [
1670
+ xe ? /* @__PURE__ */ y("div", { className: "ll-expanded__bottom", children: [
1671
1671
  !ee && ft && /* @__PURE__ */ n(
1672
1672
  "div",
1673
1673
  {
@@ -1676,27 +1676,27 @@ const Sr = ({
1676
1676
  children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: ft })
1677
1677
  }
1678
1678
  ),
1679
- !ee && He && /* @__PURE__ */ n(
1679
+ !ee && Oe && /* @__PURE__ */ n(
1680
1680
  "div",
1681
1681
  {
1682
1682
  className: "ll-expanded__transcript ll-expanded__transcript--user",
1683
1683
  "data-role": "user",
1684
- children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: He })
1684
+ children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Oe })
1685
1685
  }
1686
1686
  ),
1687
- !he && !ee && /* @__PURE__ */ v("div", { className: "ll-toolbar", onClick: (h) => h.stopPropagation(), children: [
1688
- ve && /* @__PURE__ */ n(
1687
+ !ge && !ee && /* @__PURE__ */ y("div", { className: "ll-toolbar", onClick: (h) => h.stopPropagation(), children: [
1688
+ be && /* @__PURE__ */ n(
1689
1689
  "button",
1690
1690
  {
1691
1691
  type: "button",
1692
- className: `ll-tool ${ie ? "is-on" : ""}`,
1692
+ className: `ll-tool ${oe ? "is-on" : ""}`,
1693
1693
  onClick: Ie,
1694
- "aria-label": ie ? "Stop sharing screen" : "Share screen",
1695
- title: ie ? "Stop sharing" : "Share screen",
1696
- children: /* @__PURE__ */ n(fn, {})
1694
+ "aria-label": oe ? "Stop sharing screen" : "Share screen",
1695
+ title: oe ? "Stop sharing" : "Share screen",
1696
+ children: /* @__PURE__ */ n(hn, {})
1697
1697
  }
1698
1698
  ),
1699
- fe && /* @__PURE__ */ v("div", { className: "ll-tool-split", children: [
1699
+ he && /* @__PURE__ */ y("div", { className: "ll-tool-split", children: [
1700
1700
  /* @__PURE__ */ n(
1701
1701
  "button",
1702
1702
  {
@@ -1705,7 +1705,7 @@ const Sr = ({
1705
1705
  onClick: Re,
1706
1706
  "aria-label": N ? "Turn off camera" : "Turn on camera",
1707
1707
  title: N ? "Stop camera" : "Start camera",
1708
- children: /* @__PURE__ */ n(pn, {})
1708
+ children: /* @__PURE__ */ n(mn, {})
1709
1709
  }
1710
1710
  ),
1711
1711
  /* @__PURE__ */ n(
@@ -1714,7 +1714,7 @@ const Sr = ({
1714
1714
  type: "button",
1715
1715
  className: `ll-tool ll-tool--right ${N ? "is-on" : ""}`,
1716
1716
  onClick: (h) => {
1717
- h.stopPropagation(), ne((V) => !V), ke(!1);
1717
+ h.stopPropagation(), re((V) => !V), ke(!1);
1718
1718
  },
1719
1719
  "aria-label": "Camera devices",
1720
1720
  "aria-haspopup": "listbox",
@@ -1723,18 +1723,18 @@ const Sr = ({
1723
1723
  }
1724
1724
  ),
1725
1725
  G && F.length > 0 && /* @__PURE__ */ n(
1726
- rn,
1726
+ on,
1727
1727
  {
1728
1728
  label: "Camera",
1729
1729
  devices: F,
1730
- activeId: re,
1730
+ activeId: ie,
1731
1731
  onPick: (h) => {
1732
- ne(!1), $e(h);
1732
+ re(!1), $e(h);
1733
1733
  }
1734
1734
  }
1735
1735
  )
1736
1736
  ] }),
1737
- /* @__PURE__ */ v("div", { className: "ll-tool-split", children: [
1737
+ /* @__PURE__ */ y("div", { className: "ll-tool-split", children: [
1738
1738
  /* @__PURE__ */ n(
1739
1739
  "button",
1740
1740
  {
@@ -1743,7 +1743,7 @@ const Sr = ({
1743
1743
  onClick: Ae,
1744
1744
  "aria-label": x ? "Unmute microphone" : "Mute microphone",
1745
1745
  title: x ? "Unmute" : "Mute",
1746
- children: /* @__PURE__ */ n(hn, { muted: x })
1746
+ children: /* @__PURE__ */ n(gn, { muted: x })
1747
1747
  }
1748
1748
  ),
1749
1749
  /* @__PURE__ */ n(
@@ -1752,16 +1752,16 @@ const Sr = ({
1752
1752
  type: "button",
1753
1753
  className: `ll-tool ll-tool--right ${x ? "is-muted" : ""}`,
1754
1754
  onClick: (h) => {
1755
- h.stopPropagation(), ke((V) => !V), ne(!1);
1755
+ h.stopPropagation(), ke((V) => !V), re(!1);
1756
1756
  },
1757
1757
  "aria-label": "Microphone devices",
1758
1758
  "aria-haspopup": "listbox",
1759
- "aria-expanded": me,
1759
+ "aria-expanded": ue,
1760
1760
  children: /* @__PURE__ */ n(ht, {})
1761
1761
  }
1762
1762
  ),
1763
- me && B.length > 0 && /* @__PURE__ */ n(
1764
- rn,
1763
+ ue && B.length > 0 && /* @__PURE__ */ n(
1764
+ on,
1765
1765
  {
1766
1766
  label: "Microphone",
1767
1767
  devices: B,
@@ -1776,11 +1776,11 @@ const Sr = ({
1776
1776
  "button",
1777
1777
  {
1778
1778
  type: "button",
1779
- className: `ll-tool ${ae ? "is-muted" : ""}`,
1779
+ className: `ll-tool ${ce ? "is-muted" : ""}`,
1780
1780
  onClick: Te,
1781
- "aria-label": ae ? "Unmute speaker" : "Mute speaker",
1782
- title: ae ? "Unmute speaker" : "Mute speaker",
1783
- children: /* @__PURE__ */ n(mn, { muted: ae })
1781
+ "aria-label": ce ? "Unmute speaker" : "Mute speaker",
1782
+ title: ce ? "Unmute speaker" : "Mute speaker",
1783
+ children: /* @__PURE__ */ n(yn, { muted: ce })
1784
1784
  }
1785
1785
  ),
1786
1786
  /* @__PURE__ */ n(
@@ -1788,33 +1788,33 @@ const Sr = ({
1788
1788
  {
1789
1789
  type: "button",
1790
1790
  className: "ll-tool ll-tool--danger",
1791
- onClick: Ye,
1791
+ onClick: Ge,
1792
1792
  "aria-label": "End conversation",
1793
1793
  title: "End conversation",
1794
- children: /* @__PURE__ */ n(gn, {})
1794
+ children: /* @__PURE__ */ n(vn, {})
1795
1795
  }
1796
1796
  )
1797
1797
  ] }),
1798
- !he && ee && /* @__PURE__ */ n(
1799
- Lr,
1798
+ !ge && ee && /* @__PURE__ */ n(
1799
+ Cr,
1800
1800
  {
1801
1801
  isMuted: x,
1802
1802
  onToggleMute: Ae,
1803
1803
  isCameraEnabled: N,
1804
1804
  onToggleCamera: Re,
1805
- allowCamera: fe,
1806
- isScreenShareEnabled: ie,
1805
+ allowCamera: he,
1806
+ isScreenShareEnabled: oe,
1807
1807
  onToggleScreenShare: Ie,
1808
- allowScreenShare: ve,
1809
- isSpeakerMuted: ae,
1808
+ allowScreenShare: be,
1809
+ isSpeakerMuted: ce,
1810
1810
  onToggleSpeaker: Te,
1811
- allowTyping: pe,
1811
+ allowTyping: me,
1812
1812
  isTypingOpen: Le,
1813
1813
  onToggleTyping: wt,
1814
- onDisconnect: Ye
1814
+ onDisconnect: Ge
1815
1815
  }
1816
1816
  ),
1817
- !he && pe && (ee ? Le : !0) && /* @__PURE__ */ v("form", { className: "ll-message-input", onSubmit: ut, children: [
1817
+ !ge && me && (ee ? Le : !0) && /* @__PURE__ */ y("form", { className: "ll-message-input", onSubmit: ut, children: [
1818
1818
  /* @__PURE__ */ n(
1819
1819
  "input",
1820
1820
  {
@@ -1822,7 +1822,7 @@ const Sr = ({
1822
1822
  className: "ll-message-input__field",
1823
1823
  placeholder: "Message...",
1824
1824
  value: Ee,
1825
- onChange: (h) => Oe(h.target.value),
1825
+ onChange: (h) => ze(h.target.value),
1826
1826
  "aria-label": "Message the agent"
1827
1827
  }
1828
1828
  ),
@@ -1832,14 +1832,14 @@ const Sr = ({
1832
1832
  type: "submit",
1833
1833
  className: "ll-message-input__send",
1834
1834
  "aria-label": "Send message",
1835
- children: /* @__PURE__ */ n(Nr, {})
1835
+ children: /* @__PURE__ */ n(Rr, {})
1836
1836
  }
1837
1837
  )
1838
1838
  ] })
1839
1839
  ] }) : null,
1840
1840
  (() => {
1841
1841
  if (R && b !== "error")
1842
- return /* @__PURE__ */ v("div", { className: "ll-expanded__banner", role: "alert", children: [
1842
+ return /* @__PURE__ */ y("div", { className: "ll-expanded__banner", role: "alert", children: [
1843
1843
  /* @__PURE__ */ n("span", { children: R }),
1844
1844
  /* @__PURE__ */ n(
1845
1845
  "button",
@@ -1854,14 +1854,14 @@ const Sr = ({
1854
1854
  ] });
1855
1855
  if (!D || b !== "error") return null;
1856
1856
  let h = "Failed to connect", V = "Try again";
1857
- return D === "MIC_PERMISSION_DENIED" ? h = "Microphone blocked. Allow access to talk." : D === "MIC_NOT_FOUND" ? h = "No microphone found. Plug one in + retry." : D === "MIC_UNAVAILABLE" ? h = "Mic unavailable. Check other apps using it." : D === "AGENT_TIMEOUT" ? h = "Agent didn't pick up. Try again." : D === "CONNECT_FAILED" ? h = "Connection failed. Check your network." : D.length < 80 && (h = D), /* @__PURE__ */ v("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1857
+ return D === "MIC_PERMISSION_DENIED" ? h = "Microphone blocked. Allow access to talk." : D === "MIC_NOT_FOUND" ? h = "No microphone found. Plug one in + retry." : D === "MIC_UNAVAILABLE" ? h = "Mic unavailable. Check other apps using it." : D === "AGENT_TIMEOUT" ? h = "Agent didn't pick up. Try again." : D === "CONNECT_FAILED" ? h = "Connection failed. Check your network." : D.length < 80 && (h = D), /* @__PURE__ */ y("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1858
1858
  /* @__PURE__ */ n("span", { children: h }),
1859
1859
  /* @__PURE__ */ n(
1860
1860
  "button",
1861
1861
  {
1862
1862
  type: "button",
1863
1863
  className: "ll-expanded__banner-retry",
1864
- onClick: Ge,
1864
+ onClick: Je,
1865
1865
  children: V
1866
1866
  }
1867
1867
  )
@@ -1874,52 +1874,52 @@ const Sr = ({
1874
1874
  function ht() {
1875
1875
  return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ n("polyline", { points: "6 9 12 15 18 9" }) });
1876
1876
  }
1877
- function tn() {
1878
- return /* @__PURE__ */ v("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
1877
+ function nn() {
1878
+ return /* @__PURE__ */ y("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
1879
1879
  /* @__PURE__ */ n("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1880
1880
  /* @__PURE__ */ n("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1881
1881
  ] });
1882
1882
  }
1883
- function nn() {
1883
+ function rn() {
1884
1884
  return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
1885
1885
  }
1886
- function fn() {
1887
- return /* @__PURE__ */ v("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1886
+ function hn() {
1887
+ return /* @__PURE__ */ y("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1888
1888
  /* @__PURE__ */ n("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
1889
1889
  /* @__PURE__ */ n("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
1890
1890
  /* @__PURE__ */ n("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
1891
1891
  ] });
1892
1892
  }
1893
- function pn() {
1894
- return /* @__PURE__ */ v("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1893
+ function mn() {
1894
+ return /* @__PURE__ */ y("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1895
1895
  /* @__PURE__ */ n("path", { d: "M23 7l-7 5 7 5V7z" }),
1896
1896
  /* @__PURE__ */ n("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
1897
1897
  ] });
1898
1898
  }
1899
- function hn({ muted: e }) {
1900
- return /* @__PURE__ */ v("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1899
+ function gn({ muted: e }) {
1900
+ return /* @__PURE__ */ y("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1901
1901
  /* @__PURE__ */ n("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
1902
1902
  /* @__PURE__ */ n("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
1903
1903
  /* @__PURE__ */ n("line", { x1: "12", y1: "19", x2: "12", y2: "23" }),
1904
1904
  e && /* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
1905
1905
  ] });
1906
1906
  }
1907
- function mn({ muted: e }) {
1908
- return /* @__PURE__ */ v("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1907
+ function yn({ muted: e }) {
1908
+ return /* @__PURE__ */ y("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1909
1909
  /* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
1910
- e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ v(ot, { children: [
1910
+ e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ y(Ue, { children: [
1911
1911
  /* @__PURE__ */ n("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
1912
1912
  /* @__PURE__ */ n("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
1913
1913
  ] })
1914
1914
  ] });
1915
1915
  }
1916
- function Nr() {
1917
- return /* @__PURE__ */ v("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1916
+ function Rr() {
1917
+ return /* @__PURE__ */ y("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1918
1918
  /* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
1919
1919
  /* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
1920
1920
  ] });
1921
1921
  }
1922
- function gn() {
1922
+ function vn() {
1923
1923
  return /* @__PURE__ */ n("svg", { width: "16", height: "16", viewBox: "-4 -4 32 32", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: /* @__PURE__ */ n(
1924
1924
  "path",
1925
1925
  {
@@ -1928,7 +1928,7 @@ function gn() {
1928
1928
  }
1929
1929
  ) });
1930
1930
  }
1931
- const rn = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */ v(
1931
+ const on = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */ y(
1932
1932
  "div",
1933
1933
  {
1934
1934
  className: "ll-device-menu",
@@ -1938,7 +1938,7 @@ const rn = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */
1938
1938
  /* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
1939
1939
  t.map((o, l) => {
1940
1940
  const s = r === o.deviceId;
1941
- return /* @__PURE__ */ v(
1941
+ return /* @__PURE__ */ y(
1942
1942
  "button",
1943
1943
  {
1944
1944
  type: "button",
@@ -1956,14 +1956,14 @@ const rn = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */
1956
1956
  })
1957
1957
  ]
1958
1958
  }
1959
- ), Ar = [
1959
+ ), Ir = [
1960
1960
  '[data-ll-private="true"]',
1961
1961
  ".ll-widget"
1962
1962
  ];
1963
1963
  function At(e) {
1964
1964
  let t = e;
1965
1965
  for (; t; ) {
1966
- for (const r of Ar)
1966
+ for (const r of Ir)
1967
1967
  if (t.matches(r)) return !0;
1968
1968
  t = t.parentElement;
1969
1969
  }
@@ -1978,7 +1978,7 @@ function yt(e) {
1978
1978
  }
1979
1979
  return !0;
1980
1980
  }
1981
- const mt = 4096, Rr = 20, Ir = 20, Tr = 10, Mr = 10, Dr = 30, Pr = 20, on = 500, $r = [
1981
+ const mt = 4096, Tr = 20, Mr = 20, Dr = 10, Pr = 10, $r = 30, zr = 20, ln = 500, Or = [
1982
1982
  '[data-ll-private="true"]',
1983
1983
  ".ll-widget",
1984
1984
  "script",
@@ -1990,7 +1990,7 @@ function rt(e) {
1990
1990
  if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
1991
1991
  let t = e;
1992
1992
  for (; t; ) {
1993
- for (const r of $r)
1993
+ for (const r of Or)
1994
1994
  if (t.matches(r)) return !0;
1995
1995
  t = t.parentElement;
1996
1996
  }
@@ -2003,7 +2003,7 @@ function it(e) {
2003
2003
  const r = window.innerHeight || document.documentElement.clientHeight, i = window.innerWidth || document.documentElement.clientWidth;
2004
2004
  return t.bottom > 0 && t.right > 0 && t.top < r && t.left < i;
2005
2005
  }
2006
- function ln(e) {
2006
+ function an(e) {
2007
2007
  const t = e.getAttribute("id");
2008
2008
  if (t) {
2009
2009
  const l = document.querySelector(`label[for="${CSS.escape(t)}"]`);
@@ -2016,13 +2016,13 @@ function ln(e) {
2016
2016
  const o = e.closest("label");
2017
2017
  return o != null && o.textContent ? o.textContent.trim() : "";
2018
2018
  }
2019
- function ye(e, t) {
2019
+ function ve(e, t) {
2020
2020
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
2021
2021
  }
2022
2022
  function Be(e) {
2023
2023
  return e.length;
2024
2024
  }
2025
- function zr(e, t = {}) {
2025
+ function Hr(e, t = {}) {
2026
2026
  const r = t.doc ?? (typeof document < "u" ? document : null);
2027
2027
  if (!r)
2028
2028
  return {
@@ -2040,11 +2040,11 @@ function zr(e, t = {}) {
2040
2040
  r.querySelectorAll("[data-ll-region]")
2041
2041
  ), a = [];
2042
2042
  for (const x of s) {
2043
- if (a.length >= Tr) break;
2043
+ if (a.length >= Dr) break;
2044
2044
  if (rt(x) || !it(x)) continue;
2045
- const R = x.getAttribute("data-ll-region") ?? "", B = x.getAttribute("data-ll-intent") ?? void 0, q = ye(
2045
+ const R = x.getAttribute("data-ll-region") ?? "", B = x.getAttribute("data-ll-intent") ?? void 0, q = ve(
2046
2046
  (x.innerText || x.textContent || "").trim(),
2047
- on * 2
2047
+ ln * 2
2048
2048
  );
2049
2049
  !R || !q || a.push({ id: R, intent: B, text: q });
2050
2050
  }
@@ -2054,38 +2054,38 @@ function zr(e, t = {}) {
2054
2054
  for (const x of _) {
2055
2055
  if (rt(x) || !it(x)) continue;
2056
2056
  const R = (x.textContent || "").trim();
2057
- R && d.push(`${x.tagName}: ${ye(R, 200)}`);
2057
+ R && d.push(`${x.tagName}: ${ve(R, 200)}`);
2058
2058
  }
2059
2059
  const u = Array.from(r.querySelectorAll("p, li"));
2060
2060
  for (const x of u) {
2061
2061
  if (rt(x) || !it(x) || f.includes(x.tagName)) continue;
2062
2062
  const R = (x.textContent || "").trim();
2063
- R.length > 10 && d.push(ye(R, on));
2063
+ R.length > 10 && d.push(ve(R, ln));
2064
2064
  }
2065
2065
  const c = d.join(`
2066
- `), I = [], L = Array.from(r.querySelectorAll("a[href]"));
2067
- for (const x of L) {
2068
- if (I.length >= Rr) break;
2066
+ `), I = [], k = Array.from(r.querySelectorAll("a[href]"));
2067
+ for (const x of k) {
2068
+ if (I.length >= Tr) break;
2069
2069
  if (rt(x) || !it(x)) continue;
2070
2070
  const R = x.getAttribute("href") || "", B = (x.textContent || "").trim();
2071
- !R || !B || I.push({ href: R, text: ye(B, 100) });
2071
+ !R || !B || I.push({ href: R, text: ve(B, 100) });
2072
2072
  }
2073
- const b = [], y = Array.from(
2073
+ const b = [], v = Array.from(
2074
2074
  r.querySelectorAll(
2075
2075
  "input, textarea, select"
2076
2076
  )
2077
2077
  );
2078
- for (const x of y) {
2079
- if (b.length >= Ir) break;
2078
+ for (const x of v) {
2079
+ if (b.length >= Mr) break;
2080
2080
  if (rt(x) || !yt(x) || !it(x)) continue;
2081
- const R = ln(x), B = x instanceof HTMLInputElement ? x.type : x.tagName.toLowerCase();
2082
- R && b.push({ label: ye(R, 100), type: B });
2081
+ const R = an(x), B = x instanceof HTMLInputElement ? x.type : x.tagName.toLowerCase();
2082
+ R && b.push({ label: ve(R, 100), type: B });
2083
2083
  }
2084
2084
  const m = Array.from(
2085
2085
  r.querySelectorAll("[data-ll-form]")
2086
2086
  ), S = [];
2087
2087
  for (const x of m) {
2088
- if (S.length >= Mr) break;
2088
+ if (S.length >= Pr) break;
2089
2089
  if (At(x)) continue;
2090
2090
  const R = x.getAttribute("data-ll-form") || "";
2091
2091
  if (!R) continue;
@@ -2095,27 +2095,27 @@ function zr(e, t = {}) {
2095
2095
  )
2096
2096
  ), N = [];
2097
2097
  for (const M of q) {
2098
- if (N.length >= Dr) break;
2098
+ if (N.length >= $r) break;
2099
2099
  if (!yt(M)) continue;
2100
2100
  const F = M.getAttribute("data-ll-field") || "";
2101
2101
  if (!F) continue;
2102
- const re = ln(M) || F, ie = M instanceof HTMLInputElement ? M.type : M.tagName.toLowerCase(), Z = {
2102
+ const ie = an(M) || F, oe = M instanceof HTMLInputElement ? M.type : M.tagName.toLowerCase(), Z = {
2103
2103
  name: F,
2104
- label: ye(re, 100),
2105
- type: ie
2104
+ label: ve(ie, 100),
2105
+ type: oe
2106
2106
  };
2107
2107
  if (M.required === !0 && (Z.required = !0), M instanceof HTMLSelectElement) {
2108
- const fe = [];
2109
- for (let ve = 0; ve < M.options.length && !(fe.length >= Pr); ve++) {
2110
- const pe = M.options[ve];
2111
- if (!pe || pe.disabled) continue;
2112
- const be = pe.value || "", he = (pe.textContent || "").trim() || be;
2113
- !be && !he || fe.push({ value: be, label: ye(he, 60) });
2108
+ const he = [];
2109
+ for (let be = 0; be < M.options.length && !(he.length >= zr); be++) {
2110
+ const me = M.options[be];
2111
+ if (!me || me.disabled) continue;
2112
+ const we = me.value || "", ge = (me.textContent || "").trim() || we;
2113
+ !we && !ge || he.push({ value: we, label: ve(ge, 60) });
2114
2114
  }
2115
- fe.length > 0 && (Z.options = fe);
2115
+ he.length > 0 && (Z.options = he);
2116
2116
  }
2117
- const ae = typeof M.validationMessage == "string" ? M.validationMessage : "";
2118
- ae && (Z.validationMessage = ye(ae, 200)), N.push(Z);
2117
+ const ce = typeof M.validationMessage == "string" ? M.validationMessage : "";
2118
+ ce && (Z.validationMessage = ve(ce, 200)), N.push(Z);
2119
2119
  }
2120
2120
  S.push({ id: R, intent: B, fields: N });
2121
2121
  }
@@ -2135,21 +2135,21 @@ function zr(e, t = {}) {
2135
2135
  $.visibleFields.pop(), D = Be(JSON.stringify($.visibleFields));
2136
2136
  for (; D > mt && $.visibleLinks.length > 0; )
2137
2137
  $.visibleLinks.pop(), D -= 80;
2138
- return Be($.visibleText) > mt && ($.visibleText = ye($.visibleText, mt - 100)), $;
2138
+ return Be($.visibleText) > mt && ($.visibleText = ve($.visibleText, mt - 100)), $;
2139
2139
  }
2140
2140
  let qe = null;
2141
- function an(e, t = {}) {
2141
+ function cn(e, t = {}) {
2142
2142
  const r = Date.now(), o = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
2143
2143
  if (qe && qe.key === o && r - qe.at < 1e3)
2144
2144
  return qe.ctx;
2145
- const l = zr(e, t);
2145
+ const l = Hr(e, t);
2146
2146
  return qe = { key: o, at: r, ctx: l }, l;
2147
2147
  }
2148
- function Or() {
2148
+ function Wr() {
2149
2149
  qe = null;
2150
2150
  }
2151
- const Hr = 200;
2152
- function Wr(e) {
2151
+ const Br = 200;
2152
+ function qr(e) {
2153
2153
  const t = String(e.href || "");
2154
2154
  return {
2155
2155
  href: t,
@@ -2159,18 +2159,18 @@ function Wr(e) {
2159
2159
  description: e.description
2160
2160
  };
2161
2161
  }
2162
- function Br(e) {
2162
+ function Fr(e) {
2163
2163
  return !(!e || e.startsWith("#") || e.startsWith("javascript:") || e.startsWith("mailto:") || e.startsWith("tel:"));
2164
2164
  }
2165
- function qr(e) {
2165
+ function Ur(e) {
2166
2166
  const t = e ?? (typeof document < "u" ? document : null);
2167
2167
  if (!t) return [];
2168
2168
  const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), o = [], l = Array.from(t.querySelectorAll("a[href]"));
2169
2169
  for (const s of l) {
2170
- if (o.length >= Hr) break;
2170
+ if (o.length >= Br) break;
2171
2171
  if (At(s)) continue;
2172
2172
  const a = s.getAttribute("href") || "";
2173
- if (!Br(a)) continue;
2173
+ if (!Fr(a)) continue;
2174
2174
  let d = a, f = !0;
2175
2175
  try {
2176
2176
  if (typeof window < "u") {
@@ -2188,22 +2188,22 @@ function qr(e) {
2188
2188
  return o;
2189
2189
  }
2190
2190
  let Fe = null;
2191
- const Fr = 5e3;
2191
+ const jr = 5e3;
2192
2192
  function St() {
2193
2193
  const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
2194
- if (Fe && Fe.pathname === t && e - Fe.at < Fr)
2194
+ if (Fe && Fe.pathname === t && e - Fe.at < jr)
2195
2195
  return Fe.routes;
2196
- const r = qr();
2196
+ const r = Ur();
2197
2197
  return Fe = { at: e, pathname: t, routes: r }, r;
2198
2198
  }
2199
- function Ur() {
2199
+ function Vr() {
2200
2200
  Fe = null;
2201
2201
  }
2202
- function jr(e, t) {
2202
+ function Yr(e, t) {
2203
2203
  const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, i = Object.getOwnPropertyDescriptor(r, "value"), o = i == null ? void 0 : i.set;
2204
2204
  o ? o.call(e, t) : e.value = t;
2205
2205
  }
2206
- function Vr(e, t, r = {}) {
2206
+ function Gr(e, t, r = {}) {
2207
2207
  const i = r.triggerInput ?? !0, o = r.triggerChange ?? !0;
2208
2208
  if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
2209
2209
  const l = Object.getOwnPropertyDescriptor(
@@ -2213,9 +2213,9 @@ function Vr(e, t, r = {}) {
2213
2213
  s ? s.call(e, a) : e.checked = a, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2214
2214
  return;
2215
2215
  }
2216
- jr(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2216
+ Yr(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2217
2217
  }
2218
- function Yr() {
2218
+ function Jr() {
2219
2219
  if (typeof window > "u" || typeof document > "u")
2220
2220
  return !1;
2221
2221
  const e = document.scrollingElement || document.documentElement;
@@ -2223,19 +2223,19 @@ function Yr() {
2223
2223
  const t = window.getComputedStyle(e);
2224
2224
  return !(t.overflowY === "hidden" || t.overflowY === "clip");
2225
2225
  }
2226
- function Gr(e) {
2226
+ function Kr(e) {
2227
2227
  if (!(e instanceof HTMLElement)) return !1;
2228
2228
  const r = window.getComputedStyle(e).overflowY;
2229
2229
  return !(r !== "auto" && r !== "scroll" || e.scrollHeight <= e.clientHeight + 2);
2230
2230
  }
2231
- function Jr() {
2231
+ function Xr() {
2232
2232
  if (typeof document > "u") return null;
2233
2233
  const e = Array.from(
2234
2234
  document.querySelectorAll("body, body *")
2235
2235
  );
2236
2236
  let t = null, r = 0;
2237
2237
  for (const i of e) {
2238
- if (!Gr(i)) continue;
2238
+ if (!Kr(i)) continue;
2239
2239
  const o = i.getBoundingClientRect();
2240
2240
  if (o.bottom <= 0 || o.top >= window.innerHeight || o.right <= 0 || o.left >= window.innerWidth || o.width <= 0 || o.height <= 0 || i.closest(".ll-widget")) continue;
2241
2241
  const l = o.width * o.height;
@@ -2243,24 +2243,24 @@ function Jr() {
2243
2243
  }
2244
2244
  return t;
2245
2245
  }
2246
- function Kr() {
2246
+ function Qr() {
2247
2247
  if (typeof window > "u")
2248
2248
  return null;
2249
- if (Yr()) return window;
2250
- const e = Jr();
2249
+ if (Jr()) return window;
2250
+ const e = Xr();
2251
2251
  return e || window;
2252
2252
  }
2253
- function cn(e) {
2253
+ function sn(e) {
2254
2254
  return e instanceof Window ? e.innerHeight || 0 : e.clientHeight || 0;
2255
2255
  }
2256
- function Xr(e) {
2256
+ function Zr(e) {
2257
2257
  var t, r;
2258
2258
  return e instanceof Window ? typeof document > "u" ? 0 : Math.max(
2259
2259
  ((t = document.body) == null ? void 0 : t.scrollHeight) ?? 0,
2260
2260
  ((r = document.documentElement) == null ? void 0 : r.scrollHeight) ?? 0
2261
2261
  ) : e.scrollHeight - e.clientHeight;
2262
2262
  }
2263
- const Qr = /* @__PURE__ */ new Set([
2263
+ const ei = /* @__PURE__ */ new Set([
2264
2264
  "agent_state",
2265
2265
  "avatar_stream_ready",
2266
2266
  "avatar_active",
@@ -2282,9 +2282,9 @@ const Qr = /* @__PURE__ */ new Set([
2282
2282
  "focus_field",
2283
2283
  "submit_form",
2284
2284
  "request_routes"
2285
- ]), yn = lt(
2285
+ ]), bn = ot(
2286
2286
  function(t, r) {
2287
- var Ot, Ht, Wt, Bt, qt, Ft, Ut;
2287
+ var Ht, Wt, Bt, qt, Ft, Ut, jt;
2288
2288
  const {
2289
2289
  agentId: i,
2290
2290
  apiKey: o,
@@ -2297,9 +2297,9 @@ const Qr = /* @__PURE__ */ new Set([
2297
2297
  displayMode: u,
2298
2298
  defaultDisplayMode: c = "expanded",
2299
2299
  onDisplayModeChange: I,
2300
- position: L = "bottom-right",
2300
+ position: k = "bottom-right",
2301
2301
  mobileBreakpoint: b = 640,
2302
- persistKey: y = "ll-widget",
2302
+ persistKey: v = "ll-widget",
2303
2303
  disablePersistence: m = !1,
2304
2304
  teamMembers: S,
2305
2305
  currentTeamMemberId: $,
@@ -2311,23 +2311,23 @@ const Qr = /* @__PURE__ */ new Set([
2311
2311
  branding: N = {},
2312
2312
  allowCamera: M = !0,
2313
2313
  allowScreenShare: F = !0,
2314
- allowTyping: re = !0,
2315
- showMinimize: ie = !0,
2314
+ allowTyping: ie = !0,
2315
+ showMinimize: oe = !0,
2316
2316
  chromeless: Z = !1,
2317
- compactControls: ae = !1,
2318
- transforming: fe = !1,
2319
- transformingLabel: ve = "Transforming…",
2320
- showOn: pe,
2321
- hideOn: be,
2322
- pathname: he,
2317
+ compactControls: ce = !1,
2318
+ transforming: he = !1,
2319
+ transformingLabel: be = "Transforming…",
2320
+ showOn: me,
2321
+ hideOn: we,
2322
+ pathname: ge,
2323
2323
  onNavigate: ee,
2324
- onScrollToSelector: at,
2325
- getPageContext: je,
2326
- pageContextExtras: ct,
2327
- getRoutes: oe,
2328
- onScrollPage: Ve,
2329
- onClick: Ye,
2330
- capabilities: Ge,
2324
+ onScrollToSelector: lt,
2325
+ getPageContext: Ve,
2326
+ pageContextExtras: at,
2327
+ getRoutes: le,
2328
+ onScrollPage: Ye,
2329
+ onClick: Ge,
2330
+ capabilities: Je,
2331
2331
  onConnect: De,
2332
2332
  onDisconnect: Ae,
2333
2333
  onTranscript: Pe,
@@ -2336,29 +2336,29 @@ const Qr = /* @__PURE__ */ new Set([
2336
2336
  onAgentEvent: Ie,
2337
2337
  onAgentCommand: Te,
2338
2338
  controlledSession: z,
2339
- className: st,
2340
- style: dt,
2339
+ className: ct,
2340
+ style: st,
2341
2341
  zIndex: vt = 2147483647
2342
- } = t, we = rr(he), _e = dr(we, pe, be);
2342
+ } = t, _e = or(ge), xe = fr(_e, me, we);
2343
2343
  T(() => {
2344
- Or(), Ur();
2345
- }, [we]);
2346
- const te = $ !== void 0, [bt, Je] = C(() => {
2344
+ Wr(), Vr();
2345
+ }, [_e]);
2346
+ const te = $ !== void 0, [bt, Ke] = C(() => {
2347
2347
  var g;
2348
2348
  return $ ?? ((g = S == null ? void 0 : S[0]) == null ? void 0 : g.id);
2349
- }), ce = te ? $ : bt, X = Ue(
2350
- () => (S == null ? void 0 : S.find((g) => g.id === ce)) ?? null,
2351
- [S, ce]
2352
- ), Ke = (X == null ? void 0 : X.agentId) ?? i, ze = f === "EMBEDDED", [xe, se] = Zn({
2353
- value: ze ? "expanded" : u,
2354
- defaultValue: ze ? "expanded" : c,
2349
+ }), se = te ? $ : bt, X = je(
2350
+ () => (S == null ? void 0 : S.find((g) => g.id === se)) ?? null,
2351
+ [S, se]
2352
+ ), Xe = (X == null ? void 0 : X.agentId) ?? i, dt = f === "EMBEDDED", [ne, de] = tr({
2353
+ value: u,
2354
+ defaultValue: c,
2355
2355
  onChange: I,
2356
- persistKey: y,
2357
- disablePersistence: ze || m
2358
- }), me = tr(b), ke = Bn(), G = qn(), ne = Un(), Le = jn(), Xe = Vn(), [wt, Ee] = C(!1), [Oe, ut] = C(!1), [Qe, de] = C(!1), [Ce, ft] = C(!1), [He, _t] = C(!1), Me = fr({ baseUrl: l, config: d }), h = A(Me);
2356
+ persistKey: v,
2357
+ disablePersistence: dt || m
2358
+ }), ue = rr(b), ke = Fn(), G = Un(), re = Vn(), Le = Yn(), Qe = Gn(), [wt, Ee] = C(!1), [ze, ut] = C(!1), [Ze, fe] = C(!1), [Ce, ft] = C(!1), [Oe, _t] = C(!1), Me = hr({ baseUrl: l, config: d }), h = A(Me);
2359
2359
  h.current = Me;
2360
- const V = A(ee), xt = A(at), kt = A(Ve), Lt = A(Ye), Rt = A(je), It = A(ct), Tt = A(oe), Et = A(Ge), ue = A(null);
2361
- V.current = ee, xt.current = at, kt.current = Ve, Lt.current = Ye, Rt.current = je, It.current = ct, Tt.current = oe, Et.current = Ge;
2360
+ const V = A(ee), xt = A(lt), kt = A(Ye), Lt = A(Ge), Rt = A(Ve), It = A(at), Tt = A(le), Et = A(Je), pe = A(null);
2361
+ V.current = ee, xt.current = lt, kt.current = Ye, Lt.current = Ge, Rt.current = Ve, It.current = at, Tt.current = le, Et.current = Je;
2362
2362
  function Se(g) {
2363
2363
  const p = Et.current;
2364
2364
  return p ? p.includes(g) : !0;
@@ -2368,9 +2368,9 @@ const Qr = /* @__PURE__ */ new Set([
2368
2368
  `[LiveLayer] Agent command "${g}" blocked — capability "${p}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
2369
2369
  );
2370
2370
  }
2371
- const Ze = E(
2371
+ const et = E(
2372
2372
  (g) => {
2373
- var Y, le, ge, nt;
2373
+ var Y, ae, ye, nt;
2374
2374
  const p = g;
2375
2375
  if (!(!p.type || typeof p.type != "string")) {
2376
2376
  if (Ie == null || Ie({ eventName: p.type, data: g }), p.type === "navigate") {
@@ -2378,8 +2378,8 @@ const Qr = /* @__PURE__ */ new Set([
2378
2378
  Ne("navigate", "navigate");
2379
2379
  return;
2380
2380
  }
2381
- const k = typeof p.href == "string" ? p.href : null;
2382
- if (!k) {
2381
+ const L = typeof p.href == "string" ? p.href : null;
2382
+ if (!L) {
2383
2383
  console.warn(
2384
2384
  `[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
2385
2385
  );
@@ -2387,10 +2387,10 @@ const Qr = /* @__PURE__ */ new Set([
2387
2387
  }
2388
2388
  if (h.current.playPageChange(), V.current) {
2389
2389
  try {
2390
- V.current(k);
2390
+ V.current(L);
2391
2391
  } catch (P) {
2392
2392
  console.warn(
2393
- `[LiveLayer] onNavigate threw for "${k}". Falling back. Error:`,
2393
+ `[LiveLayer] onNavigate threw for "${L}". Falling back. Error:`,
2394
2394
  P
2395
2395
  );
2396
2396
  }
@@ -2398,7 +2398,7 @@ const Qr = /* @__PURE__ */ new Set([
2398
2398
  }
2399
2399
  if (typeof document < "u") {
2400
2400
  const P = document.querySelector(
2401
- `a[href="${k.replace(/"/g, '\\"')}"]`
2401
+ `a[href="${L.replace(/"/g, '\\"')}"]`
2402
2402
  );
2403
2403
  if (P) {
2404
2404
  P.click();
@@ -2407,10 +2407,10 @@ const Qr = /* @__PURE__ */ new Set([
2407
2407
  }
2408
2408
  if (typeof window < "u" && typeof history < "u")
2409
2409
  try {
2410
- history.pushState({}, "", k), window.dispatchEvent(new PopStateEvent("popstate"));
2410
+ history.pushState({}, "", L), window.dispatchEvent(new PopStateEvent("popstate"));
2411
2411
  } catch (P) {
2412
2412
  console.warn(
2413
- `[LiveLayer] history.pushState fallback failed for "${k}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
2413
+ `[LiveLayer] history.pushState fallback failed for "${L}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
2414
2414
  P
2415
2415
  );
2416
2416
  }
@@ -2421,13 +2421,13 @@ const Qr = /* @__PURE__ */ new Set([
2421
2421
  Ne("scroll_to", "scroll");
2422
2422
  return;
2423
2423
  }
2424
- const k = typeof p.selector == "string" ? p.selector : null;
2425
- if (!k) return;
2424
+ const L = typeof p.selector == "string" ? p.selector : null;
2425
+ if (!L) return;
2426
2426
  const P = p.behavior === "instant" ? "instant" : "smooth";
2427
2427
  if (xt.current) {
2428
2428
  try {
2429
2429
  xt.current(
2430
- k,
2430
+ L,
2431
2431
  P
2432
2432
  );
2433
2433
  } catch (W) {
@@ -2438,16 +2438,16 @@ const Qr = /* @__PURE__ */ new Set([
2438
2438
  if (typeof document < "u") {
2439
2439
  let W = null;
2440
2440
  try {
2441
- W = document.querySelector(k);
2441
+ W = document.querySelector(L);
2442
2442
  } catch {
2443
2443
  console.warn(
2444
- `[LiveLayer] scroll_to: invalid selector "${k}".`
2444
+ `[LiveLayer] scroll_to: invalid selector "${L}".`
2445
2445
  );
2446
2446
  return;
2447
2447
  }
2448
2448
  if (!W) {
2449
2449
  console.warn(
2450
- `[LiveLayer] scroll_to: no element matched "${k}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
2450
+ `[LiveLayer] scroll_to: no element matched "${L}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
2451
2451
  );
2452
2452
  return;
2453
2453
  }
@@ -2463,11 +2463,11 @@ const Qr = /* @__PURE__ */ new Set([
2463
2463
  Ne("request_page_context", "read_page");
2464
2464
  return;
2465
2465
  }
2466
- const k = typeof p.requestId == "string" ? p.requestId : void 0, P = (Y = ue.current) == null ? void 0 : Y.call(ue), W = (j) => {
2466
+ const L = typeof p.requestId == "string" ? p.requestId : void 0, P = (Y = pe.current) == null ? void 0 : Y.call(pe), W = (j) => {
2467
2467
  const O = P, K = O == null ? void 0 : O.localParticipant;
2468
2468
  if (K != null && K.publishData)
2469
2469
  try {
2470
- const Q = k ? { ...j, requestId: k } : j, We = new TextEncoder().encode(JSON.stringify(Q));
2470
+ const Q = L ? { ...j, requestId: L } : j, We = new TextEncoder().encode(JSON.stringify(Q));
2471
2471
  K.publishData(We, { reliable: !0 });
2472
2472
  } catch (Q) {
2473
2473
  console.warn("[LiveLayer] publishData failed.", Q);
@@ -2483,7 +2483,7 @@ const Qr = /* @__PURE__ */ new Set([
2483
2483
  O
2484
2484
  ), W({
2485
2485
  type: "page_context",
2486
- context: an(H)
2486
+ context: cn(H)
2487
2487
  });
2488
2488
  });
2489
2489
  return;
@@ -2493,7 +2493,7 @@ const Qr = /* @__PURE__ */ new Set([
2493
2493
  }
2494
2494
  W({
2495
2495
  type: "page_context",
2496
- context: an(H)
2496
+ context: cn(H)
2497
2497
  });
2498
2498
  } catch (j) {
2499
2499
  console.warn(
@@ -2511,10 +2511,10 @@ const Qr = /* @__PURE__ */ new Set([
2511
2511
  Ne("scroll_page", "scroll");
2512
2512
  return;
2513
2513
  }
2514
- const k = p.direction;
2515
- if (k !== "up" && k !== "down" && k !== "top" && k !== "bottom") {
2514
+ const L = p.direction;
2515
+ if (L !== "up" && L !== "down" && L !== "top" && L !== "bottom") {
2516
2516
  console.warn(
2517
- `[LiveLayer] scroll_page: invalid direction "${String(k)}". Expected up | down | top | bottom.`
2517
+ `[LiveLayer] scroll_page: invalid direction "${String(L)}". Expected up | down | top | bottom.`
2518
2518
  );
2519
2519
  return;
2520
2520
  }
@@ -2522,7 +2522,7 @@ const Qr = /* @__PURE__ */ new Set([
2522
2522
  if (kt.current) {
2523
2523
  try {
2524
2524
  kt.current(
2525
- k,
2525
+ L,
2526
2526
  P
2527
2527
  );
2528
2528
  } catch (O) {
@@ -2531,12 +2531,12 @@ const Qr = /* @__PURE__ */ new Set([
2531
2531
  return;
2532
2532
  }
2533
2533
  if (typeof window > "u") return;
2534
- const W = { behavior: P }, H = Kr(), U = (O) => {
2534
+ const W = { behavior: P }, H = Qr(), U = (O) => {
2535
2535
  H instanceof Window ? H.scrollBy({ top: O, ...W }) : H.scrollBy({ top: O, ...W });
2536
2536
  }, j = (O) => {
2537
2537
  H instanceof Window ? H.scrollTo({ top: O, ...W }) : H.scrollTo({ top: O, ...W });
2538
2538
  };
2539
- k === "up" ? U(-cn(H)) : k === "down" ? U(cn(H)) : j(k === "top" ? 0 : Xr(H));
2539
+ L === "up" ? U(-sn(H)) : L === "down" ? U(sn(H)) : j(L === "top" ? 0 : Zr(H));
2540
2540
  return;
2541
2541
  }
2542
2542
  if (p.type === "click") {
@@ -2544,14 +2544,14 @@ const Qr = /* @__PURE__ */ new Set([
2544
2544
  Ne("click", "click");
2545
2545
  return;
2546
2546
  }
2547
- const k = typeof p.selector == "string" ? p.selector : null;
2548
- if (!k) {
2547
+ const L = typeof p.selector == "string" ? p.selector : null;
2548
+ if (!L) {
2549
2549
  console.warn("[LiveLayer] click: missing selector.");
2550
2550
  return;
2551
2551
  }
2552
2552
  if (Lt.current) {
2553
2553
  try {
2554
- Lt.current(k);
2554
+ Lt.current(L);
2555
2555
  } catch (W) {
2556
2556
  console.warn("[LiveLayer] onClick threw.", W);
2557
2557
  }
@@ -2560,16 +2560,16 @@ const Qr = /* @__PURE__ */ new Set([
2560
2560
  if (typeof document > "u") return;
2561
2561
  let P = null;
2562
2562
  try {
2563
- P = document.querySelector(k);
2563
+ P = document.querySelector(L);
2564
2564
  } catch {
2565
2565
  console.warn(
2566
- `[LiveLayer] click: invalid selector "${k}".`
2566
+ `[LiveLayer] click: invalid selector "${L}".`
2567
2567
  );
2568
2568
  return;
2569
2569
  }
2570
2570
  if (!P) {
2571
2571
  console.warn(
2572
- `[LiveLayer] click: no element matched "${k}". See https://livelayer.studio/docs/errors/click-no-match`
2572
+ `[LiveLayer] click: no element matched "${L}". See https://livelayer.studio/docs/errors/click-no-match`
2573
2573
  );
2574
2574
  return;
2575
2575
  }
@@ -2579,7 +2579,7 @@ const Qr = /* @__PURE__ */ new Set([
2579
2579
  );
2580
2580
  return;
2581
2581
  }
2582
- (le = P.click) == null || le.call(P);
2582
+ (ae = P.click) == null || ae.call(P);
2583
2583
  return;
2584
2584
  }
2585
2585
  if (p.type === "fill_form" || p.type === "focus_field") {
@@ -2589,17 +2589,17 @@ const Qr = /* @__PURE__ */ new Set([
2589
2589
  }
2590
2590
  if (typeof document > "u") return;
2591
2591
  p.type === "fill_form" && h.current.playConfirmation();
2592
- const k = typeof p.formId == "string" ? p.formId : null;
2593
- if (!k) {
2592
+ const L = typeof p.formId == "string" ? p.formId : null;
2593
+ if (!L) {
2594
2594
  console.warn(`[LiveLayer] ${p.type}: missing formId.`);
2595
2595
  return;
2596
2596
  }
2597
2597
  const P = document.querySelector(
2598
- `[data-ll-form="${k.replace(/"/g, '\\"')}"]`
2598
+ `[data-ll-form="${L.replace(/"/g, '\\"')}"]`
2599
2599
  );
2600
2600
  if (!P) {
2601
2601
  console.warn(
2602
- `[LiveLayer] ${p.type}: no form with data-ll-form="${k}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
2602
+ `[LiveLayer] ${p.type}: no form with data-ll-form="${L}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
2603
2603
  );
2604
2604
  return;
2605
2605
  }
@@ -2618,7 +2618,7 @@ const Qr = /* @__PURE__ */ new Set([
2618
2618
  const U = P.querySelector(`[data-ll-field="${H.replace(/"/g, '\\"')}"]`);
2619
2619
  if (!U) {
2620
2620
  console.warn(
2621
- `[LiveLayer] focus_field: no field "${H}" in form "${k}".`
2621
+ `[LiveLayer] focus_field: no field "${H}" in form "${L}".`
2622
2622
  );
2623
2623
  return;
2624
2624
  }
@@ -2641,7 +2641,7 @@ const Qr = /* @__PURE__ */ new Set([
2641
2641
  const j = P.querySelector(`[data-ll-field="${H.replace(/"/g, '\\"')}"]`);
2642
2642
  if (!j) {
2643
2643
  console.warn(
2644
- `[LiveLayer] fill_form: no field "${H}" in form "${k}". Skipping.`
2644
+ `[LiveLayer] fill_form: no field "${H}" in form "${L}". Skipping.`
2645
2645
  );
2646
2646
  continue;
2647
2647
  }
@@ -2652,7 +2652,7 @@ const Qr = /* @__PURE__ */ new Set([
2652
2652
  continue;
2653
2653
  }
2654
2654
  try {
2655
- Vr(j, U);
2655
+ Gr(j, U);
2656
2656
  } catch (O) {
2657
2657
  console.warn(
2658
2658
  `[LiveLayer] fill_form: failed to set "${H}".`,
@@ -2668,18 +2668,18 @@ const Qr = /* @__PURE__ */ new Set([
2668
2668
  return;
2669
2669
  }
2670
2670
  if (typeof document > "u") return;
2671
- const k = typeof p.formId == "string" ? p.formId : null;
2672
- if (!k) {
2671
+ const L = typeof p.formId == "string" ? p.formId : null;
2672
+ if (!L) {
2673
2673
  console.warn("[LiveLayer] submit_form: missing formId.");
2674
2674
  return;
2675
2675
  }
2676
2676
  h.current.playConfirmation();
2677
2677
  const P = document.querySelector(
2678
- `[data-ll-form="${k.replace(/"/g, '\\"')}"]`
2678
+ `[data-ll-form="${L.replace(/"/g, '\\"')}"]`
2679
2679
  );
2680
2680
  if (!P) {
2681
2681
  console.warn(
2682
- `[LiveLayer] submit_form: no form with data-ll-form="${k}".`
2682
+ `[LiveLayer] submit_form: no form with data-ll-form="${L}".`
2683
2683
  );
2684
2684
  return;
2685
2685
  }
@@ -2689,18 +2689,18 @@ const Qr = /* @__PURE__ */ new Set([
2689
2689
  );
2690
2690
  return;
2691
2691
  }
2692
- const W = typeof p.requestId == "string" ? p.requestId : void 0, H = (ge = ue.current) == null ? void 0 : ge.call(ue), U = (K) => {
2692
+ const W = typeof p.requestId == "string" ? p.requestId : void 0, H = (ye = pe.current) == null ? void 0 : ye.call(pe), U = (K) => {
2693
2693
  const Q = H, We = Q == null ? void 0 : Q.localParticipant;
2694
2694
  if (We != null && We.publishData)
2695
2695
  try {
2696
- const An = W ? { ...K, requestId: W } : K, Rn = new TextEncoder().encode(JSON.stringify(An));
2697
- We.publishData(Rn, { reliable: !0 });
2696
+ const Tn = W ? { ...K, requestId: W } : K, Mn = new TextEncoder().encode(JSON.stringify(Tn));
2697
+ We.publishData(Mn, { reliable: !0 });
2698
2698
  } catch {
2699
2699
  }
2700
2700
  };
2701
2701
  let j = !1;
2702
2702
  const O = () => {
2703
- j = !0, U({ type: "form_submitted", formId: k });
2703
+ j = !0, U({ type: "form_submitted", formId: L });
2704
2704
  };
2705
2705
  P.addEventListener("submit", O, { once: !0 });
2706
2706
  try {
@@ -2708,7 +2708,7 @@ const Qr = /* @__PURE__ */ new Set([
2708
2708
  } catch (K) {
2709
2709
  console.warn("[LiveLayer] submit_form: requestSubmit threw.", K), P.removeEventListener("submit", O), U({
2710
2710
  type: "form_submit_blocked",
2711
- formId: k,
2711
+ formId: L,
2712
2712
  reason: "exception"
2713
2713
  });
2714
2714
  return;
@@ -2716,7 +2716,7 @@ const Qr = /* @__PURE__ */ new Set([
2716
2716
  setTimeout(() => {
2717
2717
  j || (P.removeEventListener("submit", O), U({
2718
2718
  type: "form_submit_blocked",
2719
- formId: k,
2719
+ formId: L,
2720
2720
  reason: "validation"
2721
2721
  }));
2722
2722
  }, 500);
@@ -2727,11 +2727,11 @@ const Qr = /* @__PURE__ */ new Set([
2727
2727
  Ne("request_routes", "read_page");
2728
2728
  return;
2729
2729
  }
2730
- const k = typeof p.requestId == "string" ? p.requestId : void 0, W = (nt = ue.current) == null ? void 0 : nt.call(ue), H = W == null ? void 0 : W.localParticipant;
2730
+ const L = typeof p.requestId == "string" ? p.requestId : void 0, W = (nt = pe.current) == null ? void 0 : nt.call(pe), H = W == null ? void 0 : W.localParticipant;
2731
2731
  if (!(H != null && H.publishData)) return;
2732
2732
  const U = (O) => {
2733
2733
  try {
2734
- const K = k ? { type: "routes", routes: O, requestId: k } : { type: "routes", routes: O }, Q = new TextEncoder().encode(JSON.stringify(K));
2734
+ const K = L ? { type: "routes", routes: O, requestId: L } : { type: "routes", routes: O }, Q = new TextEncoder().encode(JSON.stringify(K));
2735
2735
  H.publishData(Q, { reliable: !0 });
2736
2736
  } catch (K) {
2737
2737
  console.warn("[LiveLayer] request_routes: publishData failed.", K);
@@ -2744,7 +2744,7 @@ const Qr = /* @__PURE__ */ new Set([
2744
2744
  U([]);
2745
2745
  return;
2746
2746
  }
2747
- U(Q.map(Wr).slice(0, 200));
2747
+ U(Q.map(qr).slice(0, 200));
2748
2748
  };
2749
2749
  O instanceof Promise ? O.then(K).catch((Q) => {
2750
2750
  console.warn(
@@ -2767,22 +2767,22 @@ const Qr = /* @__PURE__ */ new Set([
2767
2767
  }
2768
2768
  return;
2769
2769
  }
2770
- Qr.has(p.type) || Te == null || Te(p);
2770
+ ei.has(p.type) || Te == null || Te(p);
2771
2771
  }
2772
2772
  },
2773
2773
  [Te, Ie]
2774
- ), J = Wn({
2775
- agentId: z ? "__controlled__" : Ke,
2774
+ ), J = qn({
2775
+ agentId: z ? "__controlled__" : Xe,
2776
2776
  baseUrl: l,
2777
2777
  apiKey: o,
2778
2778
  sessionEndpoint: s,
2779
2779
  sessionBody: a,
2780
- onDataMessage: z ? void 0 : Ze
2780
+ onDataMessage: z ? void 0 : et
2781
2781
  });
2782
2782
  T(() => {
2783
2783
  if (z != null && z.subscribeToDataMessages)
2784
- return z.subscribeToDataMessages(Ze);
2785
- }, [z, Ze]), ue.current = () => {
2784
+ return z.subscribeToDataMessages(et);
2785
+ }, [z, et]), pe.current = () => {
2786
2786
  var g;
2787
2787
  return (g = J.getRoom) == null ? void 0 : g.call(J);
2788
2788
  }, T(() => {
@@ -2790,17 +2790,17 @@ const Qr = /* @__PURE__ */ new Set([
2790
2790
  if (typeof window > "u") return;
2791
2791
  const g = ((Y = window.location) == null ? void 0 : Y.hostname) || "";
2792
2792
  if (g === "localhost" || g === "127.0.0.1" || g === "0.0.0.0" || g.endsWith(".local") || g.endsWith(".test"))
2793
- return window.__livelayerSimulateCommand = (le) => {
2793
+ return window.__livelayerSimulateCommand = (ae) => {
2794
2794
  try {
2795
- Ze(le);
2796
- } catch (ge) {
2797
- console.warn("[LiveLayer] simulate-command threw:", ge);
2795
+ et(ae);
2796
+ } catch (ye) {
2797
+ console.warn("[LiveLayer] simulate-command threw:", ye);
2798
2798
  }
2799
2799
  }, () => {
2800
2800
  delete window.__livelayerSimulateCommand;
2801
2801
  };
2802
- }, [Ze]);
2803
- const w = Ue(() => z ? {
2802
+ }, [et]);
2803
+ const w = je(() => z ? {
2804
2804
  connectionState: z.connectionState,
2805
2805
  agentState: z.agentState,
2806
2806
  transcript: z.transcript,
@@ -2834,27 +2834,27 @@ const Qr = /* @__PURE__ */ new Set([
2834
2834
  }, [z, J]), Mt = A(w);
2835
2835
  Mt.current = w;
2836
2836
  const Dt = A(z);
2837
- Dt.current = z, Mn(
2837
+ Dt.current = z, $n(
2838
2838
  r,
2839
2839
  () => ({
2840
2840
  sendData: async (g) => {
2841
- var ge, nt;
2841
+ var ye, nt;
2842
2842
  const p = Dt.current;
2843
2843
  if (p != null && p.publishData) {
2844
2844
  try {
2845
2845
  await p.publishData(g);
2846
- } catch (k) {
2847
- console.warn("[AvatarWidget] sendData (controlled) failed:", k);
2846
+ } catch (L) {
2847
+ console.warn("[AvatarWidget] sendData (controlled) failed:", L);
2848
2848
  }
2849
2849
  return;
2850
2850
  }
2851
- const Y = (nt = (ge = Mt.current) == null ? void 0 : ge.getRoom) == null ? void 0 : nt.call(ge), le = Y == null ? void 0 : Y.localParticipant;
2852
- if (le != null && le.publishData)
2851
+ const Y = (nt = (ye = Mt.current) == null ? void 0 : ye.getRoom) == null ? void 0 : nt.call(ye), ae = Y == null ? void 0 : Y.localParticipant;
2852
+ if (ae != null && ae.publishData)
2853
2853
  try {
2854
- const k = new TextEncoder().encode(JSON.stringify(g));
2855
- await le.publishData(k, { reliable: !0 });
2856
- } catch (k) {
2857
- console.warn("[AvatarWidget] sendData failed:", k);
2854
+ const L = new TextEncoder().encode(JSON.stringify(g));
2855
+ await ae.publishData(L, { reliable: !0 });
2856
+ } catch (L) {
2857
+ console.warn("[AvatarWidget] sendData failed:", L);
2858
2858
  }
2859
2859
  }
2860
2860
  }),
@@ -2890,14 +2890,14 @@ const Qr = /* @__PURE__ */ new Set([
2890
2890
  if (w.connectionState !== "connected") return;
2891
2891
  const g = w.isControlled ? (p = z == null ? void 0 : z.getRoom) == null ? void 0 : p.call(z) : w.getRoom();
2892
2892
  if (g)
2893
- return ne.attachRoom(g), Le.attachRoom(g), w.isControlled && G.attachRoom(g), Xe.refresh(), () => {
2894
- ne.teardown(), Le.teardown();
2893
+ return re.attachRoom(g), Le.attachRoom(g), w.isControlled && G.attachRoom(g), Qe.refresh(), () => {
2894
+ re.teardown(), Le.teardown();
2895
2895
  };
2896
2896
  }, [w.isControlled, w.connectionState, z]), T(() => {
2897
2897
  const g = w.audioElement;
2898
- g && (g.muted = He);
2899
- }, [w.audioElement, He]);
2900
- const vn = E((g) => {
2898
+ g && (g.muted = Oe);
2899
+ }, [w.audioElement, Oe]);
2900
+ const wn = E((g) => {
2901
2901
  const p = { type: "user_message", text: g };
2902
2902
  if (z != null && z.publishData) {
2903
2903
  try {
@@ -2909,11 +2909,11 @@ const Qr = /* @__PURE__ */ new Set([
2909
2909
  const Y = w.getRoom();
2910
2910
  if (Y)
2911
2911
  try {
2912
- const le = new TextEncoder().encode(JSON.stringify(p));
2913
- Y.localParticipant.publishData(le, { reliable: !0 });
2912
+ const ae = new TextEncoder().encode(JSON.stringify(p));
2913
+ Y.localParticipant.publishData(ae, { reliable: !0 });
2914
2914
  } catch {
2915
2915
  }
2916
- }, [w, z]), bn = E(() => {
2916
+ }, [w, z]), _n = E(() => {
2917
2917
  _t((g) => !g);
2918
2918
  }, []);
2919
2919
  T(() => {
@@ -2927,164 +2927,182 @@ const Qr = /* @__PURE__ */ new Set([
2927
2927
  }, [w.agentState, Me]);
2928
2928
  const $t = A(!1);
2929
2929
  T(() => {
2930
- w.isControlled || !_ || $t.current || _e && w.connectionState === "idle" && ($t.current = !0, w.connect());
2931
- }, [_, w.connectionState, w, _e]);
2932
- const wn = E(
2930
+ w.isControlled || !_ || $t.current || xe && w.connectionState === "idle" && ($t.current = !0, w.connect());
2931
+ }, [_, w.connectionState, w, xe]);
2932
+ const xn = E(
2933
2933
  (g) => {
2934
2934
  const p = S == null ? void 0 : S.find((Y) => Y.id === g);
2935
- p && (de(!1), g !== ce && (ut(!0), w.disconnect(), te || Je(g), D == null || D(p)));
2935
+ p && (fe(!1), g !== se && (ut(!0), w.disconnect(), te || Ke(g), D == null || D(p)));
2936
2936
  },
2937
2937
  [
2938
2938
  S,
2939
- ce,
2939
+ se,
2940
2940
  w,
2941
2941
  te,
2942
2942
  D
2943
2943
  ]
2944
2944
  );
2945
2945
  T(() => {
2946
- Oe && w.connectionState === "connected" && ut(!1);
2947
- }, [w.connectionState, Oe]), T(() => {
2948
- if (!Qe) return;
2946
+ ze && w.connectionState === "connected" && ut(!1);
2947
+ }, [w.connectionState, ze]), T(() => {
2948
+ if (!Ze) return;
2949
2949
  const g = (p) => {
2950
- p.key === "Escape" && de(!1);
2950
+ p.key === "Escape" && fe(!1);
2951
2951
  };
2952
2952
  return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
2953
- }, [Qe]);
2954
- const _n = !!B || !!(X != null && X.avatarImageUrl) || w.isControlled, et = Yn(Ke, l, _n);
2955
- Ge === void 0 && ((Ot = et.info) != null && Ot.capabilities) && (Et.current = et.info.capabilities);
2956
- const pt = (X == null ? void 0 : X.name) ?? q ?? ((Ht = w.agentConfig) == null ? void 0 : Ht.name) ?? ((Wt = et.info) == null ? void 0 : Wt.name) ?? "Live Layer", Ct = (X == null ? void 0 : X.avatarImageUrl) ?? B ?? ((Bt = w.agentConfig) == null ? void 0 : Bt.avatarImageUrl) ?? ((qt = et.info) == null ? void 0 : qt.avatarImageUrl) ?? null, xn = x ?? ((Ft = w.agentConfig) == null ? void 0 : Ft.idleLoopUrl) ?? ((Ut = et.info) == null ? void 0 : Ut.idleLoopUrl) ?? null, kn = R ?? null, Ln = E(() => se("expanded"), [se]), En = E(
2957
- () => se("minimized"),
2958
- [se]
2953
+ }, [Ze]);
2954
+ const kn = !!B || !!(X != null && X.avatarImageUrl) || w.isControlled, tt = Jn(Xe, l, kn);
2955
+ Je === void 0 && ((Ht = tt.info) != null && Ht.capabilities) && (Et.current = tt.info.capabilities);
2956
+ const pt = (X == null ? void 0 : X.name) ?? q ?? ((Wt = w.agentConfig) == null ? void 0 : Wt.name) ?? ((Bt = tt.info) == null ? void 0 : Bt.name) ?? "Live Layer", Ct = (X == null ? void 0 : X.avatarImageUrl) ?? B ?? ((qt = w.agentConfig) == null ? void 0 : qt.avatarImageUrl) ?? ((Ft = tt.info) == null ? void 0 : Ft.avatarImageUrl) ?? null, Ln = x ?? ((Ut = w.agentConfig) == null ? void 0 : Ut.idleLoopUrl) ?? ((jt = tt.info) == null ? void 0 : jt.idleLoopUrl) ?? null, En = R ?? null, Cn = E(() => de("expanded"), [de]), Sn = E(
2957
+ () => de("minimized"),
2958
+ [de]
2959
2959
  ), zt = E(() => {
2960
- w.disconnect(), se("hidden");
2961
- }, [w, se]), Cn = E(() => {
2960
+ w.disconnect(), de("hidden");
2961
+ }, [w, de]), Nn = E(() => {
2962
2962
  const g = w.audioElement;
2963
2963
  g && g.play().then(() => Ee(!1)).catch(() => {
2964
2964
  });
2965
- }, [w.audioElement]), Sn = E(() => {
2965
+ }, [w.audioElement]), An = E(() => {
2966
2966
  Ee(!1), w.connect();
2967
- }, [w]), tt = {
2968
- ...dt,
2969
- ...ze ? {} : { zIndex: vt }
2967
+ }, [w]), He = {
2968
+ ...st,
2969
+ ...dt ? {} : { zIndex: vt }
2970
2970
  };
2971
- N.primaryColor && (tt["--ll-color-primary"] = N.primaryColor), N.accentColor && (tt["--ll-color-accent"] = N.accentColor), N.backgroundColor && (tt["--ll-color-bg"] = N.backgroundColor), N.textColor && (tt["--ll-color-fg"] = N.textColor);
2972
- const Nn = [
2971
+ N.primaryColor && (He["--ll-color-primary"] = N.primaryColor), N.accentColor && (He["--ll-color-accent"] = N.accentColor), N.backgroundColor && (He["--ll-color-bg"] = N.backgroundColor), N.textColor && (He["--ll-color-fg"] = N.textColor);
2972
+ const Rn = [
2973
2973
  "ll-widget",
2974
- `ll-widget--${xe}`,
2975
- `ll-widget--${me ? "mobile" : "desktop"}`,
2976
- st
2974
+ `ll-widget--${ne}`,
2975
+ `ll-widget--${ue ? "mobile" : "desktop"}`,
2976
+ ct
2977
2977
  ].filter(Boolean).join(" ");
2978
- return _e ? /* @__PURE__ */ v(
2978
+ if (!xe) return null;
2979
+ const In = /* @__PURE__ */ n(
2979
2980
  "div",
2980
2981
  {
2981
- className: Nn,
2982
- style: tt,
2983
- "data-display-mode": xe,
2984
- "data-position": L,
2982
+ className: Rn,
2983
+ style: He,
2984
+ "data-display-mode": ne,
2985
+ "data-position": k,
2985
2986
  "data-experience-mode": f === "EMBEDDED" ? "embedded" : "widget",
2987
+ children: ne === "expanded" && /* @__PURE__ */ n(
2988
+ Ar,
2989
+ {
2990
+ position: k,
2991
+ isMobile: ue,
2992
+ agentName: pt,
2993
+ avatarImageUrl: Ct,
2994
+ idleLoopUrl: Ln,
2995
+ greeting: En,
2996
+ branding: N,
2997
+ teamMembers: S,
2998
+ currentTeamMemberId: se,
2999
+ isSwitchingTeamMember: ze,
3000
+ teamSwitcherOpen: Ze,
3001
+ onToggleTeamSwitcher: () => fe((g) => !g),
3002
+ onSelectTeamMember: xn,
3003
+ connectionState: w.connectionState,
3004
+ agentState: w.agentState,
3005
+ transcript: w.transcript,
3006
+ isMuted: G.isMuted,
3007
+ micDevices: Qe.mics,
3008
+ activeMicId: G.activeDeviceId,
3009
+ isCameraEnabled: re.isEnabled,
3010
+ cameraPreviewEl: re.previewEl,
3011
+ cameraDevices: Qe.cameras,
3012
+ activeCameraId: re.activeDeviceId,
3013
+ isScreenShareEnabled: Le.isEnabled,
3014
+ screenPreviewEl: Le.previewEl,
3015
+ isSpeakerMuted: Oe,
3016
+ allowCamera: M,
3017
+ allowScreenShare: F,
3018
+ allowTyping: ie,
3019
+ showMinimize: oe,
3020
+ chromeless: Z,
3021
+ compactControls: ce,
3022
+ transforming: he,
3023
+ transformingLabel: be,
3024
+ languageMenuOpen: Ce,
3025
+ onToggleLanguageMenu: () => ft((g) => !g),
3026
+ needsUserGesture: wt,
3027
+ canResume: w.canResume,
3028
+ micError: G.micError,
3029
+ error: w.error,
3030
+ avatarVideoContainerRef: Pt,
3031
+ agentVideoEl: w.videoElement,
3032
+ onConnect: () => void w.connect(),
3033
+ onDisconnect: () => w.disconnect(),
3034
+ onRetry: An,
3035
+ onResumeAudio: Nn,
3036
+ onToggleMute: G.toggleMute,
3037
+ onSwitchMicDevice: (g) => void G.switchDevice(g),
3038
+ onToggleCamera: () => void re.toggle(),
3039
+ onSwitchCameraDevice: (g) => void re.switchDevice(g),
3040
+ onToggleScreenShare: () => void Le.toggle(),
3041
+ onToggleSpeaker: _n,
3042
+ onSendMessage: wn,
3043
+ onMinimize: Sn,
3044
+ onClose: zt,
3045
+ onClearMicError: G.clearError
3046
+ }
3047
+ )
3048
+ }
3049
+ ), Ot = ne === "hidden" || ne === "minimized" ? /* @__PURE__ */ y(
3050
+ "div",
3051
+ {
3052
+ className: [
3053
+ "ll-widget",
3054
+ "ll-widget--floating",
3055
+ `ll-widget--${ne}`,
3056
+ `ll-widget--${ue ? "mobile" : "desktop"}`
3057
+ ].join(" "),
3058
+ style: He,
3059
+ "data-display-mode": ne,
3060
+ "data-position": k,
2986
3061
  children: [
2987
- xe === "hidden" && /* @__PURE__ */ n(
2988
- vr,
3062
+ ne === "hidden" && /* @__PURE__ */ n(
3063
+ wr,
2989
3064
  {
2990
- position: L,
2991
- isMobile: me,
3065
+ position: k,
3066
+ isMobile: ue,
2992
3067
  isSpeaking: w.agentState === "speaking",
2993
- onExpand: () => se("expanded"),
3068
+ onExpand: () => de("expanded"),
2994
3069
  label: `Open ${pt} widget`,
2995
3070
  avatarImageUrl: Ct,
2996
3071
  agentName: pt
2997
3072
  }
2998
3073
  ),
2999
- xe === "minimized" && /* @__PURE__ */ n(
3000
- wr,
3074
+ ne === "minimized" && /* @__PURE__ */ n(
3075
+ xr,
3001
3076
  {
3002
- position: L,
3003
- isMobile: me,
3077
+ position: k,
3078
+ isMobile: ue,
3004
3079
  agentName: pt,
3005
3080
  avatarImageUrl: Ct,
3006
3081
  agentState: w.agentState,
3007
3082
  isMuted: G.isMuted,
3008
3083
  audioLevel: ke,
3009
- onExpand: Ln,
3084
+ onExpand: Cn,
3010
3085
  onToggleMute: G.toggleMute,
3011
3086
  onClose: zt
3012
3087
  }
3013
- ),
3014
- xe === "expanded" && /* @__PURE__ */ n(
3015
- Sr,
3016
- {
3017
- position: L,
3018
- isMobile: me,
3019
- agentName: pt,
3020
- avatarImageUrl: Ct,
3021
- idleLoopUrl: xn,
3022
- greeting: kn,
3023
- branding: N,
3024
- teamMembers: S,
3025
- currentTeamMemberId: ce,
3026
- isSwitchingTeamMember: Oe,
3027
- teamSwitcherOpen: Qe,
3028
- onToggleTeamSwitcher: () => de((g) => !g),
3029
- onSelectTeamMember: wn,
3030
- connectionState: w.connectionState,
3031
- agentState: w.agentState,
3032
- transcript: w.transcript,
3033
- isMuted: G.isMuted,
3034
- micDevices: Xe.mics,
3035
- activeMicId: G.activeDeviceId,
3036
- isCameraEnabled: ne.isEnabled,
3037
- cameraPreviewEl: ne.previewEl,
3038
- cameraDevices: Xe.cameras,
3039
- activeCameraId: ne.activeDeviceId,
3040
- isScreenShareEnabled: Le.isEnabled,
3041
- screenPreviewEl: Le.previewEl,
3042
- isSpeakerMuted: He,
3043
- allowCamera: M,
3044
- allowScreenShare: F,
3045
- allowTyping: re,
3046
- showMinimize: ie,
3047
- chromeless: Z,
3048
- compactControls: ae,
3049
- transforming: fe,
3050
- transformingLabel: ve,
3051
- languageMenuOpen: Ce,
3052
- onToggleLanguageMenu: () => ft((g) => !g),
3053
- needsUserGesture: wt,
3054
- canResume: w.canResume,
3055
- micError: G.micError,
3056
- error: w.error,
3057
- avatarVideoContainerRef: Pt,
3058
- agentVideoEl: w.videoElement,
3059
- onConnect: () => void w.connect(),
3060
- onDisconnect: () => w.disconnect(),
3061
- onRetry: Sn,
3062
- onResumeAudio: Cn,
3063
- onToggleMute: G.toggleMute,
3064
- onSwitchMicDevice: (g) => void G.switchDevice(g),
3065
- onToggleCamera: () => void ne.toggle(),
3066
- onSwitchCameraDevice: (g) => void ne.switchDevice(g),
3067
- onToggleScreenShare: () => void Le.toggle(),
3068
- onToggleSpeaker: bn,
3069
- onSendMessage: vn,
3070
- onMinimize: En,
3071
- onClose: zt,
3072
- onClearMicError: G.clearError
3073
- }
3074
3088
  )
3075
3089
  ]
3076
3090
  }
3077
3091
  ) : null;
3092
+ return /* @__PURE__ */ y(Ue, { children: [
3093
+ In,
3094
+ Ot && typeof document < "u" && un(Ot, document.body)
3095
+ ] });
3078
3096
  }
3079
3097
  );
3080
- yn.displayName = "AvatarWidgetInner";
3081
- const Zr = lt(
3098
+ bn.displayName = "AvatarWidgetInner";
3099
+ const ti = ot(
3082
3100
  function(t, r) {
3083
- return /* @__PURE__ */ n(Hn, { children: /* @__PURE__ */ n(yn, { ...t, ref: r }) });
3101
+ return /* @__PURE__ */ n(Bn, { children: /* @__PURE__ */ n(bn, { ...t, ref: r }) });
3084
3102
  }
3085
3103
  );
3086
- Zr.displayName = "AvatarWidget";
3087
- const ci = ({
3104
+ ti.displayName = "AvatarWidget";
3105
+ const ui = ({
3088
3106
  agentId: e,
3089
3107
  baseUrl: t,
3090
3108
  apiKey: r,
@@ -3110,9 +3128,9 @@ const ci = ({
3110
3128
  }, [e]), T(() => {
3111
3129
  d.current && (i ? d.current.setAttribute("mode", i) : d.current.removeAttribute("mode"));
3112
3130
  }, [i]), /* @__PURE__ */ n("div", { ref: a, className: l, style: s });
3113
- }, si = lt(
3131
+ }, fi = ot(
3114
3132
  function({ id: t, intent: r, as: i = "div", className: o, style: l, children: s }, a) {
3115
- return Dn(
3133
+ return zn(
3116
3134
  i,
3117
3135
  {
3118
3136
  ref: a,
@@ -3124,7 +3142,7 @@ const ci = ({
3124
3142
  s
3125
3143
  );
3126
3144
  }
3127
- ), di = lt(
3145
+ ), pi = ot(
3128
3146
  function({ id: t, intent: r, children: i, ...o }, l) {
3129
3147
  return /* @__PURE__ */ n(
3130
3148
  "form",
@@ -3137,7 +3155,7 @@ const ci = ({
3137
3155
  }
3138
3156
  );
3139
3157
  }
3140
- ), ui = lt(
3158
+ ), hi = ot(
3141
3159
  function(t, r) {
3142
3160
  const { name: i, label: o, labelClassName: l } = t, s = { name: i, "data-ll-field": i };
3143
3161
  let a;
@@ -3173,14 +3191,14 @@ const ci = ({
3173
3191
  }
3174
3192
  );
3175
3193
  }
3176
- return o === void 0 ? a : /* @__PURE__ */ v("label", { className: l, children: [
3194
+ return o === void 0 ? a : /* @__PURE__ */ y("label", { className: l, children: [
3177
3195
  o,
3178
3196
  a
3179
3197
  ] });
3180
3198
  }
3181
3199
  );
3182
- let sn = 1;
3183
- function fi({
3200
+ let dn = 1;
3201
+ function mi({
3184
3202
  onMount: e,
3185
3203
  defaultOpen: t = !1,
3186
3204
  storageKey: r = "ll-debug-open"
@@ -3188,8 +3206,8 @@ function fi({
3188
3206
  const [i, o] = C(t), [l, s] = C([]), [a, d] = C(""), [f, _] = C(!1), u = A(/* @__PURE__ */ new Set()), c = A([]), I = A(f);
3189
3207
  I.current = f, T(() => {
3190
3208
  try {
3191
- const y = localStorage.getItem(r);
3192
- y === "1" && o(!0), y === "0" && o(!1);
3209
+ const v = localStorage.getItem(r);
3210
+ v === "1" && o(!0), v === "0" && o(!1);
3193
3211
  } catch {
3194
3212
  }
3195
3213
  }, [r]), T(() => {
@@ -3198,48 +3216,48 @@ function fi({
3198
3216
  } catch {
3199
3217
  }
3200
3218
  }, [i, r]), T(() => {
3201
- const y = (m) => {
3219
+ const v = (m) => {
3202
3220
  (m.metaKey || m.ctrlKey) && m.shiftKey && m.key.toLowerCase() === "l" && (m.preventDefault(), o((S) => !S));
3203
3221
  };
3204
- return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
3222
+ return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
3205
3223
  }, []), T(() => {
3206
- const y = setInterval(() => {
3224
+ const v = setInterval(() => {
3207
3225
  if (c.current.length === 0 || I.current) return;
3208
3226
  const m = c.current.splice(0, c.current.length);
3209
3227
  s(
3210
3228
  (S) => [...m.reverse(), ...S].slice(0, 200)
3211
3229
  );
3212
3230
  }, 100);
3213
- return () => clearInterval(y);
3231
+ return () => clearInterval(v);
3214
3232
  }, []);
3215
- const L = A(!1);
3233
+ const k = A(!1);
3216
3234
  if (T(() => {
3217
- !e || L.current || (L.current = !0, e((y) => {
3235
+ !e || k.current || (k.current = !0, e((v) => {
3218
3236
  c.current.push({
3219
- id: sn++,
3237
+ id: dn++,
3220
3238
  ts: Date.now(),
3221
3239
  kind: "event",
3222
- type: y.eventName,
3223
- data: y.data
3240
+ type: v.eventName,
3241
+ data: v.data
3224
3242
  });
3225
3243
  }));
3226
3244
  }, [e]), T(() => {
3227
- const y = console.warn, m = console.log, S = ($, D) => function(...x) {
3245
+ const v = console.warn, m = console.log, S = ($, D) => function(...x) {
3228
3246
  try {
3229
3247
  const R = typeof x[0] == "string" ? x[0] : "";
3230
3248
  R.startsWith("[LiveLayer]") && c.current.push({
3231
- id: sn++,
3249
+ id: dn++,
3232
3250
  ts: Date.now(),
3233
3251
  kind: $,
3234
3252
  type: R.slice(0, 120),
3235
- data: { args: x.slice(1).map((B) => ti(B)) }
3253
+ data: { args: x.slice(1).map((B) => ri(B)) }
3236
3254
  });
3237
3255
  } catch {
3238
3256
  }
3239
3257
  return D.apply(this, x);
3240
3258
  };
3241
- return console.warn = S("warn", y), console.log = S("log", m), () => {
3242
- console.warn = y, console.log = m;
3259
+ return console.warn = S("warn", v), console.log = S("log", m), () => {
3260
+ console.warn = v, console.log = m;
3243
3261
  };
3244
3262
  }, []), !i)
3245
3263
  return /* @__PURE__ */ n(
@@ -3268,12 +3286,12 @@ function fi({
3268
3286
  children: "🛰 LL debug"
3269
3287
  }
3270
3288
  );
3271
- const b = l.filter((y) => {
3289
+ const b = l.filter((v) => {
3272
3290
  if (!a) return !0;
3273
3291
  const m = a.toLowerCase();
3274
- return y.type.toLowerCase().includes(m) || JSON.stringify(y.data || {}).toLowerCase().includes(m);
3292
+ return v.type.toLowerCase().includes(m) || JSON.stringify(v.data || {}).toLowerCase().includes(m);
3275
3293
  });
3276
- return /* @__PURE__ */ v(
3294
+ return /* @__PURE__ */ y(
3277
3295
  "div",
3278
3296
  {
3279
3297
  style: {
@@ -3295,7 +3313,7 @@ function fi({
3295
3313
  overflow: "hidden"
3296
3314
  },
3297
3315
  children: [
3298
- /* @__PURE__ */ v(
3316
+ /* @__PURE__ */ y(
3299
3317
  "div",
3300
3318
  {
3301
3319
  style: {
@@ -3308,7 +3326,7 @@ function fi({
3308
3326
  },
3309
3327
  children: [
3310
3328
  /* @__PURE__ */ n("span", { style: { fontWeight: 600, fontSize: 12 }, children: "LiveLayer debug" }),
3311
- /* @__PURE__ */ v("span", { style: { fontSize: 10, color: "rgba(255,255,255,0.4)" }, children: [
3329
+ /* @__PURE__ */ y("span", { style: { fontSize: 10, color: "rgba(255,255,255,0.4)" }, children: [
3312
3330
  l.length,
3313
3331
  " event",
3314
3332
  l.length === 1 ? "" : "s"
@@ -3318,7 +3336,7 @@ function fi({
3318
3336
  "button",
3319
3337
  {
3320
3338
  type: "button",
3321
- onClick: () => _((y) => !y),
3339
+ onClick: () => _((v) => !v),
3322
3340
  style: Nt(f ? "#f59e0b" : "transparent"),
3323
3341
  title: "Pause / resume capture",
3324
3342
  children: f ? "▶ resume" : "⏸ pause"
@@ -3355,7 +3373,7 @@ function fi({
3355
3373
  {
3356
3374
  type: "text",
3357
3375
  value: a,
3358
- onChange: (y) => d(y.target.value),
3376
+ onChange: (v) => d(v.target.value),
3359
3377
  placeholder: "filter by type or data…",
3360
3378
  style: {
3361
3379
  margin: 8,
@@ -3377,7 +3395,7 @@ function fi({
3377
3395
  overflowY: "auto",
3378
3396
  padding: "0 8px 8px"
3379
3397
  },
3380
- children: b.length === 0 ? /* @__PURE__ */ v(
3398
+ children: b.length === 0 ? /* @__PURE__ */ y(
3381
3399
  "div",
3382
3400
  {
3383
3401
  style: {
@@ -3407,16 +3425,16 @@ function fi({
3407
3425
  )
3408
3426
  ]
3409
3427
  }
3410
- ) : b.map((y) => /* @__PURE__ */ n(
3411
- ei,
3428
+ ) : b.map((v) => /* @__PURE__ */ n(
3429
+ ni,
3412
3430
  {
3413
- entry: y,
3414
- expanded: u.current.has(y.id),
3431
+ entry: v,
3432
+ expanded: u.current.has(v.id),
3415
3433
  onToggle: () => {
3416
- u.current.has(y.id) ? u.current.delete(y.id) : u.current.add(y.id), s((m) => [...m]);
3434
+ u.current.has(v.id) ? u.current.delete(v.id) : u.current.add(v.id), s((m) => [...m]);
3417
3435
  }
3418
3436
  },
3419
- y.id
3437
+ v.id
3420
3438
  ))
3421
3439
  }
3422
3440
  )
@@ -3424,7 +3442,7 @@ function fi({
3424
3442
  }
3425
3443
  );
3426
3444
  }
3427
- function ei({
3445
+ function ni({
3428
3446
  entry: e,
3429
3447
  expanded: t,
3430
3448
  onToggle: r
@@ -3432,7 +3450,7 @@ function ei({
3432
3450
  const i = e.kind === "warn" ? "#f59e0b" : e.type.startsWith("[LiveLayer]") ? "#94a3b8" : e.type === "navigate" || e.type === "scroll_page" || e.type === "scroll_to" || e.type === "click" ? "#22c55e" : e.type === "fill_form" || e.type === "submit_form" || e.type === "focus_field" ? "#a78bfa" : e.type === "request_page_context" || e.type === "request_routes" ? "#38bdf8" : e.type === "agent_state" ? "#facc15" : "#cbd5e1", o = new Date(e.ts).toLocaleTimeString("en-US", {
3433
3451
  hour12: !1
3434
3452
  });
3435
- return /* @__PURE__ */ v(
3453
+ return /* @__PURE__ */ y(
3436
3454
  "button",
3437
3455
  {
3438
3456
  type: "button",
@@ -3450,7 +3468,7 @@ function ei({
3450
3468
  lineHeight: 1.4
3451
3469
  },
3452
3470
  children: [
3453
- /* @__PURE__ */ v("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
3471
+ /* @__PURE__ */ y("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
3454
3472
  /* @__PURE__ */ n(
3455
3473
  "span",
3456
3474
  {
@@ -3505,14 +3523,14 @@ function Nt(e) {
3505
3523
  cursor: "pointer"
3506
3524
  };
3507
3525
  }
3508
- function ti(e) {
3526
+ function ri(e) {
3509
3527
  try {
3510
3528
  return e instanceof Error ? { message: e.message, stack: e.stack } : (JSON.stringify(e), e);
3511
3529
  } catch {
3512
3530
  return String(e);
3513
3531
  }
3514
3532
  }
3515
- function pi() {
3533
+ function gi() {
3516
3534
  const [e, t] = C([]), r = E((o) => {
3517
3535
  t((l) => {
3518
3536
  const s = l.findIndex((a) => a.id === o.id);
@@ -3531,33 +3549,33 @@ function pi() {
3531
3549
  };
3532
3550
  }
3533
3551
  export {
3534
- Zr as AvatarWidget,
3535
- Hn as ErrorBoundary,
3536
- fi as LiveLayerDebugPanel,
3537
- ui as LiveLayerField,
3538
- di as LiveLayerForm,
3539
- si as LiveLayerRegion,
3540
- ci as LiveLayerWidget,
3541
- Or as clearPageContextCache,
3542
- Ur as clearRoutesCache,
3543
- zr as extractPageContext,
3544
- qr as extractRoutes,
3545
- an as getCachedPageContext,
3552
+ ti as AvatarWidget,
3553
+ Bn as ErrorBoundary,
3554
+ mi as LiveLayerDebugPanel,
3555
+ hi as LiveLayerField,
3556
+ pi as LiveLayerForm,
3557
+ fi as LiveLayerRegion,
3558
+ ui as LiveLayerWidget,
3559
+ Wr as clearPageContextCache,
3560
+ Vr as clearRoutesCache,
3561
+ Hr as extractPageContext,
3562
+ Ur as extractRoutes,
3563
+ cn as getCachedPageContext,
3546
3564
  St as getCachedRoutes,
3547
- cr as matchesPattern,
3548
- Wr as normalizeRouteInput,
3549
- sr as shouldRenderAtPath,
3550
- Yn as useAgentInfo,
3551
- Bn as useAudioLevel,
3552
- Un as useCameraState,
3553
- Kn as useDisplayMode,
3554
- Zn as useDisplayModePersistence,
3555
- tr as useIsMobile,
3556
- Wn as useLiveKitSession,
3557
- Vn as useMediaDevices,
3558
- qn as useMicrophoneState,
3559
- rr as usePathname,
3560
- dr as useRouteMatch,
3561
- jn as useScreenShareState,
3562
- pi as useTranscript
3565
+ dr as matchesPattern,
3566
+ qr as normalizeRouteInput,
3567
+ ur as shouldRenderAtPath,
3568
+ Jn as useAgentInfo,
3569
+ Fn as useAudioLevel,
3570
+ Vn as useCameraState,
3571
+ Qn as useDisplayMode,
3572
+ tr as useDisplayModePersistence,
3573
+ rr as useIsMobile,
3574
+ qn as useLiveKitSession,
3575
+ Gn as useMediaDevices,
3576
+ Un as useMicrophoneState,
3577
+ or as usePathname,
3578
+ fr as useRouteMatch,
3579
+ Yn as useScreenShareState,
3580
+ gi as useTranscript
3563
3581
  };