@livelayer/react 0.5.6 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -13,8 +13,8 @@ class mn extends dn {
13
13
  return { hasError: !0, error: t };
14
14
  }
15
15
  componentDidCatch(t, r) {
16
- var i, o;
17
- (o = (i = this.props).onError) == null || o.call(i, t, r);
16
+ var o, i;
17
+ (i = (o = this.props).onError) == null || i.call(o, t, r);
18
18
  }
19
19
  render() {
20
20
  var t;
@@ -34,13 +34,13 @@ class mn extends dn {
34
34
  }
35
35
  }
36
36
  function gn(e) {
37
- const [t, r] = S("idle"), [i, o] = S("idle"), [l, s] = S([]), [d, f] = S(null), [g, m] = S(null), [a, c] = S(null), [R, C] = S(!1), [L, v] = S(null), b = E(null), z = E(e.onDataMessage);
37
+ const [t, r] = S("idle"), [o, i] = S("idle"), [l, s] = S([]), [d, f] = S(null), [g, m] = S(null), [a, c] = S(null), [R, C] = S(!1), [L, v] = S(null), b = E(null), z = E(e.onDataMessage);
38
38
  z.current = e.onDataMessage, T(() => {
39
39
  const N = {
40
40
  onConnectionStateChange: (D) => {
41
41
  r(D), D === "connected" && v(null);
42
42
  },
43
- onAgentStateChange: o,
43
+ onAgentStateChange: i,
44
44
  onTranscript: (D) => s([...D]),
45
45
  onAgentConfig: f,
46
46
  onAudioTrack: (D) => c(D),
@@ -62,7 +62,7 @@ function gn(e) {
62
62
  },
63
63
  N
64
64
  );
65
- return b.current = B, r("idle"), o("idle"), s([]), f(null), m(null), c(null), C(!1), v(null), () => {
65
+ return b.current = B, r("idle"), i("idle"), s([]), f(null), m(null), c(null), C(!1), v(null), () => {
66
66
  var D;
67
67
  (D = B.destroy) == null || D.call(B), b.current = null;
68
68
  };
@@ -90,7 +90,7 @@ function gn(e) {
90
90
  }, []);
91
91
  return {
92
92
  connectionState: t,
93
- agentState: i,
93
+ agentState: o,
94
94
  transcript: l,
95
95
  agentConfig: d,
96
96
  videoElement: g,
@@ -104,10 +104,10 @@ function gn(e) {
104
104
  };
105
105
  }
106
106
  function yn() {
107
- const e = E(null), t = E(null), r = E(null), i = E(null), o = E(/* @__PURE__ */ new Set()), l = E(null), s = k(() => {
107
+ const e = E(null), t = E(null), r = E(null), o = E(null), i = E(/* @__PURE__ */ new Set()), l = E(null), s = k(() => {
108
108
  const a = t.current;
109
109
  if (!a) {
110
- i.current = null;
110
+ o.current = null;
111
111
  return;
112
112
  }
113
113
  (!l.current || l.current.length !== a.frequencyBinCount) && (l.current = new Uint8Array(
@@ -118,13 +118,13 @@ function yn() {
118
118
  let R = 0;
119
119
  for (let L = 0; L < c.length; L++) R += c[L];
120
120
  const C = R / c.length / 255;
121
- for (const L of o.current)
121
+ for (const L of i.current)
122
122
  try {
123
123
  L(C);
124
124
  } catch (v) {
125
125
  console.error("[useAudioLevel] subscriber threw:", v);
126
126
  }
127
- i.current = requestAnimationFrame(s);
127
+ o.current = requestAnimationFrame(s);
128
128
  }, []), d = k(() => {
129
129
  if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
130
130
  const a = new AudioContext(), c = a.createAnalyser();
@@ -146,20 +146,20 @@ function yn() {
146
146
  console.warn("[useAudioLevel] createMediaElementSource failed:", c);
147
147
  return;
148
148
  }
149
- i.current === null && (i.current = requestAnimationFrame(s));
149
+ o.current === null && (o.current = requestAnimationFrame(s));
150
150
  }
151
151
  },
152
152
  [d, s]
153
153
  ), g = k(() => {
154
- if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), r.current) {
154
+ if (o.current !== null && (cancelAnimationFrame(o.current), o.current = null), r.current) {
155
155
  try {
156
156
  r.current.disconnect();
157
157
  } catch {
158
158
  }
159
159
  r.current = null;
160
160
  }
161
- }, []), m = k((a) => (o.current.add(a), () => {
162
- o.current.delete(a);
161
+ }, []), m = k((a) => (i.current.add(a), () => {
162
+ i.current.delete(a);
163
163
  }), []);
164
164
  return T(() => () => {
165
165
  if (g(), t.current) {
@@ -176,34 +176,34 @@ function yn() {
176
176
  }
177
177
  e.current = null;
178
178
  }
179
- o.current.clear(), l.current = null;
179
+ i.current.clear(), l.current = null;
180
180
  }, [g]), { attach: f, detach: g, subscribe: m };
181
181
  }
182
182
  function vn() {
183
- const [e, t] = S(!1), [r, i] = S(null), o = E(null), l = E(null), s = k(async (m) => {
184
- if (o.current && l.current) {
183
+ const [e, t] = S(!1), [r, o] = S(null), i = E(null), l = E(null), s = k(async (m) => {
184
+ if (i.current && l.current) {
185
185
  try {
186
- await l.current.localParticipant.unpublishTrack(o.current);
186
+ await l.current.localParticipant.unpublishTrack(i.current);
187
187
  } catch {
188
188
  }
189
- o.current.stop(), o.current = null;
189
+ i.current.stop(), i.current = null;
190
190
  }
191
- l.current = m, i(null);
191
+ l.current = m, o(null);
192
192
  try {
193
193
  const a = await pn({
194
194
  echoCancellation: !0,
195
195
  noiseSuppression: !0
196
196
  });
197
- await m.localParticipant.publishTrack(a), o.current = a, t(a.isMuted);
197
+ await m.localParticipant.publishTrack(a), i.current = a, t(a.isMuted);
198
198
  } catch (a) {
199
199
  const c = a instanceof Error && a.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
200
- throw i(c), a;
200
+ throw o(c), a;
201
201
  }
202
202
  }, []), d = k(() => {
203
- const m = o.current;
203
+ const m = i.current;
204
204
  m && (m.isMuted ? (m.unmute(), t(!1)) : (m.mute(), t(!0)));
205
205
  }, []), f = k(() => {
206
- const m = o.current, a = l.current;
206
+ const m = i.current, a = l.current;
207
207
  if (m && a) {
208
208
  try {
209
209
  a.localParticipant.unpublishTrack(m);
@@ -211,8 +211,8 @@ function vn() {
211
211
  }
212
212
  m.stop();
213
213
  }
214
- o.current = null, l.current = null, t(!1);
215
- }, []), g = k(() => i(null), []);
214
+ i.current = null, l.current = null, t(!1);
215
+ }, []), g = k(() => o(null), []);
216
216
  return {
217
217
  isMuted: e,
218
218
  micError: r,
@@ -224,7 +224,7 @@ function vn() {
224
224
  }
225
225
  const bn = { resolution: { width: 640, height: 480, frameRate: 24 } };
226
226
  function wn() {
227
- const [e, t] = S(!1), [r, i] = S(null), [o, l] = S(null), [s, d] = S(""), f = E(null), g = E(null), m = k((b) => {
227
+ const [e, t] = S(!1), [r, o] = S(null), [i, l] = S(null), [s, d] = S(""), f = E(null), g = E(null), m = k((b) => {
228
228
  f.current = b;
229
229
  }, []), a = k(() => {
230
230
  const b = f.current, z = g.current;
@@ -243,7 +243,7 @@ function wn() {
243
243
  }, []), c = k(async (b) => {
244
244
  const z = f.current;
245
245
  if (z) {
246
- i(null);
246
+ o(null);
247
247
  try {
248
248
  const I = { ...bn };
249
249
  b && (I.deviceId = b);
@@ -260,7 +260,7 @@ function wn() {
260
260
  }
261
261
  } catch (I) {
262
262
  const H = I instanceof Error && I.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
263
- i(H);
263
+ o(H);
264
264
  }
265
265
  }
266
266
  }, []), R = k(async () => {
@@ -268,14 +268,14 @@ function wn() {
268
268
  }, [e, s, a, c]), C = k(async (b) => {
269
269
  a(), await c(b);
270
270
  }, [a, c]), L = k(() => {
271
- a(), f.current = null, i(null), d("");
272
- }, [a]), v = k(() => i(null), []);
271
+ a(), f.current = null, o(null), d("");
272
+ }, [a]), v = k(() => o(null), []);
273
273
  return T(() => () => {
274
274
  g.current && g.current.stop();
275
275
  }, []), {
276
276
  isEnabled: e,
277
277
  error: r,
278
- previewEl: o,
278
+ previewEl: i,
279
279
  activeDeviceId: s,
280
280
  toggle: R,
281
281
  switchDevice: C,
@@ -285,7 +285,7 @@ function wn() {
285
285
  };
286
286
  }
287
287
  function _n() {
288
- const [e, t] = S(!1), [r, i] = S(null), [o, l] = S(null), s = E(null), d = k((c) => {
288
+ const [e, t] = S(!1), [r, o] = S(null), [i, l] = S(null), s = E(null), d = k((c) => {
289
289
  s.current = c;
290
290
  }, []), f = k(() => l(null), []), g = k(async () => {
291
291
  const c = s.current;
@@ -298,7 +298,7 @@ function _n() {
298
298
  f(), t(!1);
299
299
  return;
300
300
  }
301
- i(null);
301
+ o(null);
302
302
  try {
303
303
  await c.localParticipant.setScreenShareEnabled(!0);
304
304
  let R = 0;
@@ -321,7 +321,7 @@ function _n() {
321
321
  C();
322
322
  } catch (R) {
323
323
  const C = R instanceof Error ? R.name : "";
324
- C !== "NotAllowedError" && C !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
324
+ C !== "NotAllowedError" && C !== "AbortError" && o("Screen share unavailable. Try again."), t(!1);
325
325
  }
326
326
  }
327
327
  }, [e, f]), m = k(() => {
@@ -331,27 +331,27 @@ function _n() {
331
331
  c.localParticipant.setScreenShareEnabled(!1);
332
332
  } catch {
333
333
  }
334
- f(), t(!1), i(null), s.current = null;
335
- }, [e, f]), a = k(() => i(null), []);
336
- return { isEnabled: e, error: r, previewEl: o, toggle: g, attachRoom: d, teardown: m, clearError: a };
334
+ f(), t(!1), o(null), s.current = null;
335
+ }, [e, f]), a = k(() => o(null), []);
336
+ return { isEnabled: e, error: r, previewEl: i, toggle: g, attachRoom: d, teardown: m, clearError: a };
337
337
  }
338
338
  function xn() {
339
- const [e, t] = S([]), [r, i] = S([]), o = k(async () => {
339
+ const [e, t] = S([]), [r, o] = S([]), i = k(async () => {
340
340
  if (!(typeof navigator > "u" || !navigator.mediaDevices))
341
341
  try {
342
342
  const l = await navigator.mediaDevices.enumerateDevices();
343
- t(l.filter((s) => s.kind === "audioinput")), i(l.filter((s) => s.kind === "videoinput"));
343
+ t(l.filter((s) => s.kind === "audioinput")), o(l.filter((s) => s.kind === "videoinput"));
344
344
  } catch {
345
345
  }
346
346
  }, []);
347
347
  return T(() => {
348
- if (o(), typeof navigator > "u" || !navigator.mediaDevices) return;
349
- const l = () => void o();
348
+ if (i(), typeof navigator > "u" || !navigator.mediaDevices) return;
349
+ const l = () => void i();
350
350
  return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
351
- }, [o]), { mics: e, cameras: r, refresh: o };
351
+ }, [i]), { mics: e, cameras: r, refresh: i };
352
352
  }
353
353
  function kn(e, t, r = !1) {
354
- const [i, o] = S(null), [l, s] = S(null), [d, f] = S(!r && !!e);
354
+ const [o, i] = S(null), [l, s] = S(null), [d, f] = S(!r && !!e);
355
355
  return T(() => {
356
356
  if (r || !e) {
357
357
  f(!1);
@@ -367,11 +367,11 @@ function kn(e, t, r = !1) {
367
367
  }
368
368
  return a.json();
369
369
  }).then((a) => {
370
- g.signal.aborted || (o(a), f(!1));
370
+ g.signal.aborted || (i(a), f(!1));
371
371
  }).catch((a) => {
372
372
  g.signal.aborted || (s(a instanceof Error ? a.message : "Agent lookup failed"), f(!1));
373
373
  }), () => g.abort();
374
- }, [e, t, r]), { info: i, error: l, loading: d };
374
+ }, [e, t, r]), { info: o, error: l, loading: d };
375
375
  }
376
376
  function Ln(e) {
377
377
  if (typeof window > "u") return null;
@@ -393,11 +393,11 @@ function Cn({
393
393
  defaultValue: t = "expanded",
394
394
  onChange: r
395
395
  } = {}) {
396
- const i = e !== void 0, [o, l] = S(t), s = i ? e : o, d = k(
396
+ const o = e !== void 0, [i, l] = S(t), s = o ? e : i, d = k(
397
397
  (f) => {
398
- f !== s && (i || l(f), r == null || r(f));
398
+ f !== s && (o || l(f), r == null || r(f));
399
399
  },
400
- [s, i, r]
400
+ [s, o, r]
401
401
  );
402
402
  return [s, d];
403
403
  }
@@ -409,18 +409,18 @@ function An({
409
409
  value: e,
410
410
  defaultValue: t = "expanded",
411
411
  onChange: r,
412
- persistKey: i = "ll-widget",
413
- disablePersistence: o = !1
412
+ persistKey: o = "ll-widget",
413
+ disablePersistence: i = !1
414
414
  } = {}) {
415
- const l = `${i}:display-mode`, s = E(!1), [d, f] = Cn({
415
+ const l = `${o}:display-mode`, s = E(!1), [d, f] = Cn({
416
416
  value: e,
417
417
  defaultValue: t,
418
418
  onChange: (g) => {
419
- e === void 0 && !o && Sn(l, g), r == null || r(g);
419
+ e === void 0 && !i && Sn(l, g), r == null || r(g);
420
420
  }
421
421
  });
422
422
  return T(() => {
423
- if (s.current || (s.current = !0, o || e !== void 0)) return;
423
+ if (s.current || (s.current = !0, i || e !== void 0)) return;
424
424
  const g = Nn(Ln(l));
425
425
  g && g !== d && f(g);
426
426
  }, []), [d, f];
@@ -435,9 +435,9 @@ function In(e = Rn) {
435
435
  }
436
436
  if (typeof window > "u" || typeof window.matchMedia > "u")
437
437
  return;
438
- const i = `(max-width: ${e - 1}px)`, o = window.matchMedia(i), l = () => r(o.matches);
439
- return l(), typeof o.addEventListener == "function" ? (o.addEventListener("change", l), () => o.removeEventListener("change", l)) : (o.addListener(l), () => {
440
- o.removeListener(l);
438
+ const o = `(max-width: ${e - 1}px)`, i = window.matchMedia(o), l = () => r(i.matches);
439
+ return l(), typeof i.addEventListener == "function" ? (i.addEventListener("change", l), () => i.removeEventListener("change", l)) : (i.addListener(l), () => {
440
+ i.removeListener(l);
441
441
  });
442
442
  }, [e]), t;
443
443
  }
@@ -446,11 +446,11 @@ function Mn() {
446
446
  if (typeof window > "u" || window.history[Nt]) return;
447
447
  const e = window.history.pushState, t = window.history.replaceState;
448
448
  window.history.pushState = function(...r) {
449
- const i = e.apply(this, r);
450
- return window.dispatchEvent(new Event(et)), i;
449
+ const o = e.apply(this, r);
450
+ return window.dispatchEvent(new Event(et)), o;
451
451
  }, window.history.replaceState = function(...r) {
452
- const i = t.apply(this, r);
453
- return window.dispatchEvent(new Event(et)), i;
452
+ const o = t.apply(this, r);
453
+ return window.dispatchEvent(new Event(et)), o;
454
454
  }, window.history[Nt] = !0;
455
455
  }
456
456
  function At() {
@@ -463,9 +463,9 @@ function Tn(e) {
463
463
  return T(() => {
464
464
  if (e !== void 0) return;
465
465
  Mn();
466
- const i = () => r(At());
467
- return i(), window.addEventListener("popstate", i), window.addEventListener(et, i), () => {
468
- window.removeEventListener("popstate", i), window.removeEventListener(et, i);
466
+ const o = () => r(At());
467
+ return o(), window.addEventListener("popstate", o), window.addEventListener(et, o), () => {
468
+ window.removeEventListener("popstate", o), window.removeEventListener(et, o);
469
469
  };
470
470
  }, [e]), e ?? t;
471
471
  }
@@ -476,7 +476,7 @@ function Dn(e) {
476
476
  function $n(e) {
477
477
  const t = Rt.get(e);
478
478
  if (t) return t;
479
- const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", o = "", l = r.replace(/\*\*/g, i).replace(/\*/g, o), d = Dn(l).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(o, "g"), "[^/]+"), f = new RegExp(`^${d}\\/?$`);
479
+ const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, o = "", i = "", l = r.replace(/\*\*/g, o).replace(/\*/g, i), d = Dn(l).replace(new RegExp(`\\/${o}`, "g"), "(?:\\/.*)?").replace(new RegExp(o, "g"), ".*").replace(new RegExp(i, "g"), "[^/]+"), f = new RegExp(`^${d}\\/?$`);
480
480
  return Rt.set(e, f), f;
481
481
  }
482
482
  function zn(e, t) {
@@ -620,8 +620,8 @@ const Vn = ({
620
620
  position: e,
621
621
  isMobile: t,
622
622
  isSpeaking: r,
623
- onExpand: i,
624
- label: o = "Open widget",
623
+ onExpand: o,
624
+ label: i = "Open widget",
625
625
  avatarImageUrl: l,
626
626
  agentName: s
627
627
  }) => {
@@ -681,8 +681,8 @@ const Vn = ({
681
681
  v.current = !1;
682
682
  return;
683
683
  }
684
- i();
685
- }, [i]), N = k(
684
+ o();
685
+ }, [o]), N = k(
686
686
  (A) => {
687
687
  if (A.key === "ArrowUp" || A.key === "ArrowDown") {
688
688
  A.preventDefault();
@@ -714,7 +714,7 @@ const Vn = ({
714
714
  onPointerCancel: H,
715
715
  onClick: p,
716
716
  onKeyDown: N,
717
- "aria-label": o,
717
+ "aria-label": i,
718
718
  "data-position": e,
719
719
  style: D,
720
720
  children: m ? (
@@ -753,8 +753,8 @@ const Vn = ({
753
753
  audioLevel: e,
754
754
  bars: t = 20,
755
755
  maxHeight: r = 20,
756
- minHeight: i = 4,
757
- className: o,
756
+ minHeight: o = 4,
757
+ className: i,
758
758
  barClassName: l
759
759
  }) => {
760
760
  const s = E(null), d = E([]), f = Ze(() => {
@@ -765,11 +765,11 @@ const Vn = ({
765
765
  for (let c = 0; c < t; c++) {
766
766
  const R = d.current[c];
767
767
  if (!R) continue;
768
- const C = Math.max(i, a * r * f[c]);
768
+ const C = Math.max(o, a * r * f[c]);
769
769
  R.style.height = `${C}px`;
770
770
  }
771
- }), [e, t, r, i, f]);
772
- const g = ["ll-waveform", o].filter(Boolean).join(" ");
771
+ }), [e, t, r, o, f]);
772
+ const g = ["ll-waveform", i].filter(Boolean).join(" ");
773
773
  return /* @__PURE__ */ n("div", { ref: s, className: g, "aria-hidden": "true", children: Array.from({ length: t }, (m, a) => /* @__PURE__ */ n(
774
774
  "div",
775
775
  {
@@ -777,7 +777,7 @@ const Vn = ({
777
777
  d.current[a] = c;
778
778
  },
779
779
  className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
780
- style: { height: `${i}px` }
780
+ style: { height: `${o}px` }
781
781
  },
782
782
  a
783
783
  )) });
@@ -785,8 +785,8 @@ const Vn = ({
785
785
  position: e,
786
786
  isMobile: t,
787
787
  agentName: r,
788
- avatarImageUrl: i,
789
- agentState: o,
788
+ avatarImageUrl: o,
789
+ agentState: i,
790
790
  isMuted: l,
791
791
  audioLevel: s,
792
792
  onExpand: d,
@@ -806,12 +806,12 @@ const Vn = ({
806
806
  onClick: d,
807
807
  "aria-label": `Expand ${r} widget`,
808
808
  children: [
809
- i ? (
809
+ o ? (
810
810
  // eslint-disable-next-line @next/next/no-img-element
811
811
  /* @__PURE__ */ n(
812
812
  "img",
813
813
  {
814
- src: i,
814
+ src: o,
815
815
  alt: r,
816
816
  className: "ll-minimized__avatar"
817
817
  }
@@ -858,12 +858,12 @@ const Vn = ({
858
858
  role: "region",
859
859
  "aria-label": `${r} widget`,
860
860
  children: /* @__PURE__ */ w("div", { className: "ll-minimized__surface", children: [
861
- i ? (
861
+ o ? (
862
862
  // eslint-disable-next-line @next/next/no-img-element
863
863
  /* @__PURE__ */ n(
864
864
  "img",
865
865
  {
866
- src: i,
866
+ src: o,
867
867
  alt: r,
868
868
  className: "ll-minimized__avatar"
869
869
  }
@@ -871,7 +871,7 @@ const Vn = ({
871
871
  ) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
872
872
  /* @__PURE__ */ w("div", { className: "ll-minimized__meta", children: [
873
873
  /* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
874
- /* @__PURE__ */ n("span", { className: "ll-minimized__state", children: o === "speaking" ? "Speaking" : o === "thinking" ? "Thinking" : "Listening" })
874
+ /* @__PURE__ */ n("span", { className: "ll-minimized__state", children: i === "speaking" ? "Speaking" : i === "thinking" ? "Thinking" : "Listening" })
875
875
  ] }),
876
876
  /* @__PURE__ */ w("div", { className: "ll-minimized__controls", children: [
877
877
  /* @__PURE__ */ n(
@@ -911,8 +911,8 @@ const Vn = ({
911
911
  src: e,
912
912
  alt: t,
913
913
  preCannedPlaying: r = !1,
914
- className: i,
915
- style: o
914
+ className: o,
915
+ style: i
916
916
  }) => {
917
917
  const [l, s] = S(!1), d = E(e);
918
918
  if (T(() => {
@@ -928,7 +928,7 @@ const Vn = ({
928
928
  transition: "opacity 500ms ease, transform 500ms ease",
929
929
  transform: r ? "scale(1.02)" : "scale(1)",
930
930
  opacity: l ? 1 : 0,
931
- ...o
931
+ ...i
932
932
  };
933
933
  return (
934
934
  // eslint-disable-next-line @next/next/no-img-element
@@ -937,7 +937,7 @@ const Vn = ({
937
937
  {
938
938
  src: e,
939
939
  alt: t,
940
- className: i,
940
+ className: o,
941
941
  style: f,
942
942
  loading: "eager",
943
943
  fetchPriority: "high",
@@ -949,8 +949,8 @@ const Vn = ({
949
949
  position: e,
950
950
  isMobile: t,
951
951
  agentName: r,
952
- avatarImageUrl: i,
953
- idleLoopUrl: o,
952
+ avatarImageUrl: o,
953
+ idleLoopUrl: i,
954
954
  greeting: l,
955
955
  branding: s,
956
956
  teamMembers: d,
@@ -989,14 +989,14 @@ const Vn = ({
989
989
  onToggleCamera: _e,
990
990
  onSwitchCameraDevice: xe,
991
991
  onToggleScreenShare: ke,
992
- onToggleSpeaker: j,
992
+ onToggleSpeaker: V,
993
993
  onSendMessage: Ue,
994
994
  onMinimize: je,
995
995
  onClose: Ve,
996
996
  onClearMicError: fe
997
997
  }) => {
998
998
  var Ce;
999
- const ae = b.length > 0 ? b[b.length - 1] : null, oe = ((d == null ? void 0 : d.length) ?? 0) > 1, Le = L === "connecting" || L === "connected", Se = L === "connected", pe = L === "idle" || L === "disconnected" || L === "error", K = E(null), Me = E(null);
999
+ const ae = b.length > 0 ? b[b.length - 1] : null, ie = ((d == null ? void 0 : d.length) ?? 0) > 1, Le = L === "connecting" || L === "connected", Se = L === "connected", pe = L === "idle" || L === "disconnected" || L === "error", K = E(null), Me = E(null);
1000
1000
  T(() => {
1001
1001
  const y = K.current;
1002
1002
  y && (y.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "cover", A.style.transform = "scaleX(-1)", y.appendChild(A)));
@@ -1040,19 +1040,19 @@ const Vn = ({
1040
1040
  "aria-label": `${r} widget`,
1041
1041
  children: [
1042
1042
  /* @__PURE__ */ w("div", { className: "ll-expanded__bg", children: [
1043
- i ? /* @__PURE__ */ n(
1043
+ o ? /* @__PURE__ */ n(
1044
1044
  Gn,
1045
1045
  {
1046
- src: i,
1046
+ src: o,
1047
1047
  alt: r,
1048
1048
  className: "ll-expanded__bg-img"
1049
1049
  }
1050
1050
  ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Ce = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Ce.toUpperCase()) || "A" }) }),
1051
- o && !Se && /* @__PURE__ */ n(
1051
+ i && !Se && /* @__PURE__ */ n(
1052
1052
  "video",
1053
1053
  {
1054
1054
  className: "ll-expanded__bg-idle",
1055
- src: o,
1055
+ src: i,
1056
1056
  autoPlay: !0,
1057
1057
  loop: !0,
1058
1058
  muted: !0,
@@ -1086,17 +1086,17 @@ const Vn = ({
1086
1086
  type: "button",
1087
1087
  className: "ll-hpill",
1088
1088
  onClick: (y) => {
1089
- oe && (y.stopPropagation(), a());
1089
+ ie && (y.stopPropagation(), a());
1090
1090
  },
1091
- "aria-haspopup": oe ? "listbox" : void 0,
1092
- "aria-expanded": oe ? m : void 0,
1091
+ "aria-haspopup": ie ? "listbox" : void 0,
1092
+ "aria-expanded": ie ? m : void 0,
1093
1093
  children: [
1094
1094
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
1095
- oe && /* @__PURE__ */ n(Xe, {})
1095
+ ie && /* @__PURE__ */ n(Xe, {})
1096
1096
  ]
1097
1097
  }
1098
1098
  ),
1099
- oe && m && /* @__PURE__ */ n(
1099
+ ie && m && /* @__PURE__ */ n(
1100
1100
  "div",
1101
1101
  {
1102
1102
  className: "ll-hmenu",
@@ -1373,7 +1373,7 @@ const Vn = ({
1373
1373
  {
1374
1374
  type: "button",
1375
1375
  className: `ll-tool ${ue ? "is-muted" : ""}`,
1376
- onClick: j,
1376
+ onClick: V,
1377
1377
  "aria-label": ue ? "Unmute speaker" : "Mute speaker",
1378
1378
  title: ue ? "Unmute speaker" : "Mute speaker",
1379
1379
  children: /* @__PURE__ */ n(er, { muted: ue })
@@ -1494,30 +1494,30 @@ function tr() {
1494
1494
  /* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
1495
1495
  ] });
1496
1496
  }
1497
- const Ot = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */ w(
1497
+ const Ot = ({ label: e, devices: t, activeId: r, onPick: o }) => /* @__PURE__ */ w(
1498
1498
  "div",
1499
1499
  {
1500
1500
  className: "ll-device-menu",
1501
- onClick: (o) => o.stopPropagation(),
1501
+ onClick: (i) => i.stopPropagation(),
1502
1502
  role: "listbox",
1503
1503
  children: [
1504
1504
  /* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
1505
- t.map((o, l) => {
1506
- const s = r === o.deviceId;
1505
+ t.map((i, l) => {
1506
+ const s = r === i.deviceId;
1507
1507
  return /* @__PURE__ */ w(
1508
1508
  "button",
1509
1509
  {
1510
1510
  type: "button",
1511
1511
  className: `ll-device-menu__item ${s ? "is-active" : ""}`,
1512
- onClick: () => i(o.deviceId),
1512
+ onClick: () => o(i.deviceId),
1513
1513
  role: "option",
1514
1514
  "aria-selected": s,
1515
1515
  children: [
1516
1516
  s && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1517
- /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: o.label || `${e} ${l + 1}` })
1517
+ /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: i.label || `${e} ${l + 1}` })
1518
1518
  ]
1519
1519
  },
1520
- o.deviceId || l
1520
+ i.deviceId || l
1521
1521
  );
1522
1522
  })
1523
1523
  ]
@@ -1544,7 +1544,7 @@ function tt(e) {
1544
1544
  }
1545
1545
  return !0;
1546
1546
  }
1547
- const Qe = 4096, rr = 20, ir = 20, or = 10, lr = 10, ar = 30, qt = 500, cr = [
1547
+ const Qe = 4096, rr = 20, or = 20, ir = 10, lr = 10, ar = 30, qt = 500, cr = [
1548
1548
  '[data-ll-private="true"]',
1549
1549
  ".ll-widget",
1550
1550
  "script",
@@ -1566,8 +1566,8 @@ function Oe(e) {
1566
1566
  if (typeof window > "u") return !0;
1567
1567
  const t = e.getBoundingClientRect();
1568
1568
  if (t.width <= 0 || t.height <= 0) return !1;
1569
- const r = window.innerHeight || document.documentElement.clientHeight, i = window.innerWidth || document.documentElement.clientWidth;
1570
- return t.bottom > 0 && t.right > 0 && t.top < r && t.left < i;
1569
+ const r = window.innerHeight || document.documentElement.clientHeight, o = window.innerWidth || document.documentElement.clientWidth;
1570
+ return t.bottom > 0 && t.right > 0 && t.top < r && t.left < o;
1571
1571
  }
1572
1572
  function Bt(e) {
1573
1573
  const t = e.getAttribute("id");
@@ -1577,10 +1577,10 @@ function Bt(e) {
1577
1577
  }
1578
1578
  const r = e.getAttribute("aria-label");
1579
1579
  if (r) return r.trim();
1580
- const i = e.getAttribute("placeholder");
1581
- if (i) return i.trim();
1582
- const o = e.closest("label");
1583
- return o != null && o.textContent ? o.textContent.trim() : "";
1580
+ const o = e.getAttribute("placeholder");
1581
+ if (o) return o.trim();
1582
+ const i = e.closest("label");
1583
+ return i != null && i.textContent ? i.textContent.trim() : "";
1584
1584
  }
1585
1585
  function me(e, t) {
1586
1586
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
@@ -1602,11 +1602,11 @@ function sr(e, t = {}) {
1602
1602
  forms: [],
1603
1603
  extras: e
1604
1604
  };
1605
- const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "", s = Array.from(
1605
+ const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "", s = Array.from(
1606
1606
  r.querySelectorAll("[data-ll-region]")
1607
1607
  ), d = [];
1608
1608
  for (const p of s) {
1609
- if (d.length >= or) break;
1609
+ if (d.length >= ir) break;
1610
1610
  if (He(p) || !Oe(p)) continue;
1611
1611
  const N = p.getAttribute("data-ll-region") ?? "", B = p.getAttribute("data-ll-intent") ?? void 0, D = me(
1612
1612
  (p.innerText || p.textContent || "").trim(),
@@ -1642,7 +1642,7 @@ function sr(e, t = {}) {
1642
1642
  )
1643
1643
  );
1644
1644
  for (const p of v) {
1645
- if (L.length >= ir) break;
1645
+ if (L.length >= or) break;
1646
1646
  if (He(p) || !tt(p) || !Oe(p)) continue;
1647
1647
  const N = Bt(p), B = p instanceof HTMLInputElement ? p.type : p.tagName.toLowerCase();
1648
1648
  N && L.push({ label: me(N, 100), type: B });
@@ -1671,9 +1671,9 @@ function sr(e, t = {}) {
1671
1671
  z.push({ id: N, intent: B, fields: A });
1672
1672
  }
1673
1673
  const I = {
1674
- url: i,
1674
+ url: o,
1675
1675
  title: l,
1676
- pathname: o,
1676
+ pathname: i,
1677
1677
  regions: d,
1678
1678
  visibleText: c,
1679
1679
  visibleLinks: R,
@@ -1690,11 +1690,11 @@ function sr(e, t = {}) {
1690
1690
  }
1691
1691
  let Re = null;
1692
1692
  function Wt(e, t = {}) {
1693
- const r = Date.now(), o = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
1694
- if (Re && Re.key === o && r - Re.at < 1e3)
1693
+ const r = Date.now(), i = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
1694
+ if (Re && Re.key === i && r - Re.at < 1e3)
1695
1695
  return Re.ctx;
1696
1696
  const l = sr(e, t);
1697
- return Re = { key: o, at: r, ctx: l }, l;
1697
+ return Re = { key: i, at: r, ctx: l }, l;
1698
1698
  }
1699
1699
  function dr() {
1700
1700
  Re = null;
@@ -1716,9 +1716,9 @@ function pr(e) {
1716
1716
  function hr(e) {
1717
1717
  const t = e ?? (typeof document < "u" ? document : null);
1718
1718
  if (!t) return [];
1719
- const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), o = [], l = Array.from(t.querySelectorAll("a[href]"));
1719
+ const r = typeof window < "u" && window.location.origin || "", o = /* @__PURE__ */ new Set(), i = [], l = Array.from(t.querySelectorAll("a[href]"));
1720
1720
  for (const s of l) {
1721
- if (o.length >= ur) break;
1721
+ if (i.length >= ur) break;
1722
1722
  if (pt(s)) continue;
1723
1723
  const d = s.getAttribute("href") || "";
1724
1724
  if (!pr(d)) continue;
@@ -1731,12 +1731,12 @@ function hr(e) {
1731
1731
  } catch {
1732
1732
  continue;
1733
1733
  }
1734
- if (i.has(f)) continue;
1735
- i.add(f);
1734
+ if (o.has(f)) continue;
1735
+ o.add(f);
1736
1736
  const m = (s.textContent || "").trim().slice(0, 120);
1737
- o.push({ href: f, text: m, internal: g });
1737
+ i.push({ href: f, text: m, internal: g });
1738
1738
  }
1739
- return o;
1739
+ return i;
1740
1740
  }
1741
1741
  let Ie = null;
1742
1742
  const mr = 5e3;
@@ -1751,20 +1751,20 @@ function gr() {
1751
1751
  Ie = null;
1752
1752
  }
1753
1753
  function yr(e, t) {
1754
- 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;
1755
- o ? o.call(e, t) : e.value = t;
1754
+ const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, o = Object.getOwnPropertyDescriptor(r, "value"), i = o == null ? void 0 : o.set;
1755
+ i ? i.call(e, t) : e.value = t;
1756
1756
  }
1757
1757
  function vr(e, t, r = {}) {
1758
- const i = r.triggerInput ?? !0, o = r.triggerChange ?? !0;
1758
+ const o = r.triggerInput ?? !0, i = r.triggerChange ?? !0;
1759
1759
  if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
1760
1760
  const l = Object.getOwnPropertyDescriptor(
1761
1761
  HTMLInputElement.prototype,
1762
1762
  "checked"
1763
1763
  ), s = l == null ? void 0 : l.set, d = t === "true" || t === "1" || t === "on";
1764
- s ? s.call(e, d) : e.checked = d, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1764
+ s ? s.call(e, d) : e.checked = d, o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1765
1765
  return;
1766
1766
  }
1767
- yr(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1767
+ yr(e, t), o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1768
1768
  }
1769
1769
  function br() {
1770
1770
  if (typeof window > "u" || typeof document > "u")
@@ -1785,12 +1785,12 @@ function _r() {
1785
1785
  document.querySelectorAll("body, body *")
1786
1786
  );
1787
1787
  let t = null, r = 0;
1788
- for (const i of e) {
1789
- if (!wr(i)) continue;
1790
- const o = i.getBoundingClientRect();
1791
- 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;
1792
- const l = o.width * o.height;
1793
- l > r && (r = l, t = i);
1788
+ for (const o of e) {
1789
+ if (!wr(o)) continue;
1790
+ const i = o.getBoundingClientRect();
1791
+ if (i.bottom <= 0 || i.top >= window.innerHeight || i.right <= 0 || i.left >= window.innerWidth || i.width <= 0 || i.height <= 0 || o.closest(".ll-widget")) continue;
1792
+ const l = i.width * i.height;
1793
+ l > r && (r = l, t = o);
1794
1794
  }
1795
1795
  return t;
1796
1796
  }
@@ -1839,8 +1839,8 @@ function Sr(e) {
1839
1839
  const {
1840
1840
  agentId: t,
1841
1841
  apiKey: r,
1842
- baseUrl: i = "https://app.livelayer.studio",
1843
- sessionEndpoint: o,
1842
+ baseUrl: o = "https://app.livelayer.studio",
1843
+ sessionEndpoint: i,
1844
1844
  sessionBody: l,
1845
1845
  autoConnect: s = !1,
1846
1846
  displayMode: d,
@@ -1879,30 +1879,18 @@ function Sr(e) {
1879
1879
  onConnectionStateChange: _e,
1880
1880
  onAgentEvent: xe,
1881
1881
  onAgentCommand: ke,
1882
- controlledSession: j,
1882
+ controlledSession: V,
1883
1883
  className: Ue,
1884
1884
  style: je,
1885
1885
  zIndex: Ve = 2147483647
1886
1886
  } = e, fe = Tn(W), ae = qn(fe, A, O);
1887
1887
  T(() => {
1888
1888
  dr(), gr();
1889
- }, [fe]), T(() => {
1890
- var J;
1891
- if (!fe) return;
1892
- const h = (J = V.getRoom) == null ? void 0 : J.call(V), u = h == null ? void 0 : h.localParticipant;
1893
- if (u != null && u.publishData)
1894
- try {
1895
- const Ee = new TextEncoder().encode(
1896
- JSON.stringify({ type: "pathname", pathname: fe })
1897
- );
1898
- u.publishData(Ee, { reliable: !0 });
1899
- } catch {
1900
- }
1901
- }, [fe, V]);
1902
- const oe = L !== void 0, [Le, Se] = S(() => {
1889
+ }, [fe]);
1890
+ const ie = L !== void 0, [Le, Se] = S(() => {
1903
1891
  var h;
1904
1892
  return L ?? ((h = C == null ? void 0 : C[0]) == null ? void 0 : h.id);
1905
- }), pe = oe ? L : Le, K = Ze(
1893
+ }), pe = ie ? L : Le, K = Ze(
1906
1894
  () => (C == null ? void 0 : C.find((h) => h.id === pe)) ?? null,
1907
1895
  [C, pe]
1908
1896
  ), Me = (K == null ? void 0 : K.agentId) ?? t, [ne, ee] = An({
@@ -1911,8 +1899,8 @@ function Sr(e) {
1911
1899
  onChange: g,
1912
1900
  persistKey: c,
1913
1901
  disablePersistence: R
1914
- }), le = In(a), ce = yn(), Z = vn(), re = wn(), he = _n(), Te = xn(), [Ye, Pe] = S(!1), [Ce, y] = S(!1), [X, Je] = S(!1), [Yt, Jt] = S(!1), [nt, Gt] = S(!1), rt = E(Y), it = E(te), ot = E(We), lt = E(Fe), ht = E(ue), mt = E(qe), gt = E(Be), at = E(ge), ie = E(null);
1915
- rt.current = Y, it.current = te, ot.current = We, lt.current = Fe, ht.current = ue, mt.current = qe, gt.current = Be, at.current = ge;
1902
+ }), le = In(a), ce = yn(), Z = vn(), re = wn(), he = _n(), Te = xn(), [Ye, Pe] = S(!1), [Ce, y] = S(!1), [X, Je] = S(!1), [Yt, Jt] = S(!1), [nt, Gt] = S(!1), rt = E(Y), ot = E(te), it = E(We), lt = E(Fe), ht = E(ue), mt = E(qe), gt = E(Be), at = E(ge), oe = E(null);
1903
+ rt.current = Y, ot.current = te, it.current = We, lt.current = Fe, ht.current = ue, mt.current = qe, gt.current = Be, at.current = ge;
1916
1904
  function se(h) {
1917
1905
  const u = at.current;
1918
1906
  return u ? u.includes(h) : !0;
@@ -1978,9 +1966,9 @@ function Sr(e) {
1978
1966
  const x = typeof u.selector == "string" ? u.selector : null;
1979
1967
  if (!x) return;
1980
1968
  const M = u.behavior === "instant" ? "instant" : "smooth";
1981
- if (it.current) {
1969
+ if (ot.current) {
1982
1970
  try {
1983
- it.current(
1971
+ ot.current(
1984
1972
  x,
1985
1973
  M
1986
1974
  );
@@ -2017,11 +2005,11 @@ function Sr(e) {
2017
2005
  de("request_page_context", "read_page");
2018
2006
  return;
2019
2007
  }
2020
- const x = typeof u.requestId == "string" ? u.requestId : void 0, M = (J = ie.current) == null ? void 0 : J.call(ie), q = (U) => {
2008
+ const x = typeof u.requestId == "string" ? u.requestId : void 0, M = (J = oe.current) == null ? void 0 : J.call(oe), q = (j) => {
2021
2009
  const P = M, G = P == null ? void 0 : P.localParticipant;
2022
2010
  if (G != null && G.publishData)
2023
2011
  try {
2024
- const Q = x ? { ...U, requestId: x } : U, Ne = new TextEncoder().encode(JSON.stringify(Q));
2012
+ const Q = x ? { ...j, requestId: x } : j, Ne = new TextEncoder().encode(JSON.stringify(Q));
2025
2013
  G.publishData(Ne, { reliable: !0 });
2026
2014
  } catch (Q) {
2027
2015
  console.warn("[LiveLayer] publishData failed.", Q);
@@ -2029,9 +2017,9 @@ function Sr(e) {
2029
2017
  }, $ = mt.current, F = ht.current;
2030
2018
  try {
2031
2019
  if (F) {
2032
- const U = F($);
2033
- if (U instanceof Promise) {
2034
- q({ type: "page_context_pending" }), U.then((P) => q({ type: "page_context", context: P })).catch((P) => {
2020
+ const j = F($);
2021
+ if (j instanceof Promise) {
2022
+ q({ type: "page_context_pending" }), j.then((P) => q({ type: "page_context", context: P })).catch((P) => {
2035
2023
  console.warn(
2036
2024
  "[LiveLayer] getPageContext rejected; falling back to default walker.",
2037
2025
  P
@@ -2042,17 +2030,17 @@ function Sr(e) {
2042
2030
  });
2043
2031
  return;
2044
2032
  }
2045
- q({ type: "page_context", context: U });
2033
+ q({ type: "page_context", context: j });
2046
2034
  return;
2047
2035
  }
2048
2036
  q({
2049
2037
  type: "page_context",
2050
2038
  context: Wt($)
2051
2039
  });
2052
- } catch (U) {
2040
+ } catch (j) {
2053
2041
  console.warn(
2054
2042
  "[LiveLayer] page-context extraction threw. Sending empty context.",
2055
- U
2043
+ j
2056
2044
  ), q({
2057
2045
  type: "page_context",
2058
2046
  context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: $ }
@@ -2073,9 +2061,9 @@ function Sr(e) {
2073
2061
  return;
2074
2062
  }
2075
2063
  const M = u.behavior === "instant" ? "instant" : "smooth";
2076
- if (ot.current) {
2064
+ if (it.current) {
2077
2065
  try {
2078
- ot.current(
2066
+ it.current(
2079
2067
  x,
2080
2068
  M
2081
2069
  );
@@ -2087,10 +2075,10 @@ function Sr(e) {
2087
2075
  if (typeof window > "u") return;
2088
2076
  const q = { behavior: M }, $ = xr(), F = (P) => {
2089
2077
  $ instanceof Window ? $.scrollBy({ top: P, ...q }) : $.scrollBy({ top: P, ...q });
2090
- }, U = (P) => {
2078
+ }, j = (P) => {
2091
2079
  $ instanceof Window ? $.scrollTo({ top: P, ...q }) : $.scrollTo({ top: P, ...q });
2092
2080
  };
2093
- x === "up" ? F(-Ft($)) : x === "down" ? F(Ft($)) : U(x === "top" ? 0 : kr($));
2081
+ x === "up" ? F(-Ft($)) : x === "down" ? F(Ft($)) : j(x === "top" ? 0 : kr($));
2094
2082
  return;
2095
2083
  }
2096
2084
  if (u.type === "click") {
@@ -2191,21 +2179,21 @@ function Sr(e) {
2191
2179
  }
2192
2180
  for (const [$, F] of Object.entries(q)) {
2193
2181
  if (typeof F != "string") continue;
2194
- const U = M.querySelector(`[data-ll-field="${$.replace(/"/g, '\\"')}"]`);
2195
- if (!U) {
2182
+ const j = M.querySelector(`[data-ll-field="${$.replace(/"/g, '\\"')}"]`);
2183
+ if (!j) {
2196
2184
  console.warn(
2197
2185
  `[LiveLayer] fill_form: no field "${$}" in form "${x}". Skipping.`
2198
2186
  );
2199
2187
  continue;
2200
2188
  }
2201
- if (!tt(U)) {
2189
+ if (!tt(j)) {
2202
2190
  console.warn(
2203
2191
  `[LiveLayer] fill_form: field "${$}" is privacy-protected (password / cc-* / private). Skipping.`
2204
2192
  );
2205
2193
  continue;
2206
2194
  }
2207
2195
  try {
2208
- vr(U, F);
2196
+ vr(j, F);
2209
2197
  } catch (P) {
2210
2198
  console.warn(
2211
2199
  `[LiveLayer] fill_form: failed to set "${$}".`,
@@ -2241,7 +2229,7 @@ function Sr(e) {
2241
2229
  );
2242
2230
  return;
2243
2231
  }
2244
- const q = typeof u.requestId == "string" ? u.requestId : void 0, $ = (Ke = ie.current) == null ? void 0 : Ke.call(ie), F = (G) => {
2232
+ const q = typeof u.requestId == "string" ? u.requestId : void 0, $ = (Ke = oe.current) == null ? void 0 : Ke.call(oe), F = (G) => {
2245
2233
  const Q = $, Ne = Q == null ? void 0 : Q.localParticipant;
2246
2234
  if (Ne != null && Ne.publishData)
2247
2235
  try {
@@ -2250,9 +2238,9 @@ function Sr(e) {
2250
2238
  } catch {
2251
2239
  }
2252
2240
  };
2253
- let U = !1;
2241
+ let j = !1;
2254
2242
  const P = () => {
2255
- U = !0, F({ type: "form_submitted", formId: x });
2243
+ j = !0, F({ type: "form_submitted", formId: x });
2256
2244
  };
2257
2245
  M.addEventListener("submit", P, { once: !0 });
2258
2246
  try {
@@ -2266,7 +2254,7 @@ function Sr(e) {
2266
2254
  return;
2267
2255
  }
2268
2256
  setTimeout(() => {
2269
- U || (M.removeEventListener("submit", P), F({
2257
+ j || (M.removeEventListener("submit", P), F({
2270
2258
  type: "form_submit_blocked",
2271
2259
  formId: x,
2272
2260
  reason: "validation"
@@ -2279,7 +2267,7 @@ function Sr(e) {
2279
2267
  de("request_routes", "read_page");
2280
2268
  return;
2281
2269
  }
2282
- const x = typeof u.requestId == "string" ? u.requestId : void 0, q = (Et = ie.current) == null ? void 0 : Et.call(ie), $ = q == null ? void 0 : q.localParticipant;
2270
+ const x = typeof u.requestId == "string" ? u.requestId : void 0, q = (Et = oe.current) == null ? void 0 : Et.call(oe), $ = q == null ? void 0 : q.localParticipant;
2283
2271
  if (!($ != null && $.publishData)) return;
2284
2272
  const F = (P) => {
2285
2273
  try {
@@ -2288,10 +2276,10 @@ function Sr(e) {
2288
2276
  } catch (G) {
2289
2277
  console.warn("[LiveLayer] request_routes: publishData failed.", G);
2290
2278
  }
2291
- }, U = gt.current;
2292
- if (U) {
2279
+ }, j = gt.current;
2280
+ if (j) {
2293
2281
  try {
2294
- const P = U(), G = (Q) => {
2282
+ const P = j(), G = (Q) => {
2295
2283
  if (!Array.isArray(Q)) {
2296
2284
  F([]);
2297
2285
  return;
@@ -2323,21 +2311,33 @@ function Sr(e) {
2323
2311
  }
2324
2312
  },
2325
2313
  [ke, xe]
2326
- ), V = gn({
2327
- agentId: j ? "__controlled__" : Me,
2328
- baseUrl: i,
2314
+ ), U = gn({
2315
+ agentId: V ? "__controlled__" : Me,
2316
+ baseUrl: o,
2329
2317
  apiKey: r,
2330
- sessionEndpoint: o,
2318
+ sessionEndpoint: i,
2331
2319
  sessionBody: l,
2332
- onDataMessage: j ? void 0 : De
2320
+ onDataMessage: V ? void 0 : De
2333
2321
  });
2334
2322
  T(() => {
2335
- if (j != null && j.subscribeToDataMessages)
2336
- return j.subscribeToDataMessages(De);
2337
- }, [j, De]), ie.current = () => {
2323
+ if (V != null && V.subscribeToDataMessages)
2324
+ return V.subscribeToDataMessages(De);
2325
+ }, [V, De]), oe.current = () => {
2338
2326
  var h;
2339
- return (h = V.getRoom) == null ? void 0 : h.call(V);
2327
+ return (h = U.getRoom) == null ? void 0 : h.call(U);
2340
2328
  }, T(() => {
2329
+ var J;
2330
+ if (!fe) return;
2331
+ const h = (J = U.getRoom) == null ? void 0 : J.call(U), u = h == null ? void 0 : h.localParticipant;
2332
+ if (u != null && u.publishData)
2333
+ try {
2334
+ const Ee = new TextEncoder().encode(
2335
+ JSON.stringify({ type: "pathname", pathname: fe })
2336
+ );
2337
+ u.publishData(Ee, { reliable: !0 });
2338
+ } catch {
2339
+ }
2340
+ }, [fe, U, U.connectionState]), T(() => {
2341
2341
  var J;
2342
2342
  if (typeof window > "u") return;
2343
2343
  const h = ((J = window.location) == null ? void 0 : J.hostname) || "";
@@ -2352,38 +2352,38 @@ function Sr(e) {
2352
2352
  delete window.__livelayerSimulateCommand;
2353
2353
  };
2354
2354
  }, [De]);
2355
- const _ = Ze(() => j ? {
2356
- connectionState: j.connectionState,
2357
- agentState: j.agentState,
2358
- transcript: j.transcript,
2359
- videoElement: j.videoElement,
2360
- audioElement: j.audioElement,
2361
- canResume: j.canResume,
2362
- error: j.error,
2355
+ const _ = Ze(() => V ? {
2356
+ connectionState: V.connectionState,
2357
+ agentState: V.agentState,
2358
+ transcript: V.transcript,
2359
+ videoElement: V.videoElement,
2360
+ audioElement: V.audioElement,
2361
+ canResume: V.canResume,
2362
+ error: V.error,
2363
2363
  agentConfig: null,
2364
2364
  connect: async () => {
2365
- await j.onConnect();
2365
+ await V.onConnect();
2366
2366
  },
2367
- disconnect: () => j.onDisconnect(),
2367
+ disconnect: () => V.onDisconnect(),
2368
2368
  // Dummy getRoom for shape compatibility — controlled consumers own the Room.
2369
2369
  // Internal session's getRoom returns null when no real connect has happened,
2370
2370
  // so we reuse its reference for type consistency.
2371
- getRoom: V.getRoom,
2371
+ getRoom: U.getRoom,
2372
2372
  isControlled: !0
2373
2373
  } : {
2374
- connectionState: V.connectionState,
2375
- agentState: V.agentState,
2376
- transcript: V.transcript,
2377
- videoElement: V.videoElement,
2378
- audioElement: V.audioElement,
2379
- canResume: V.canResume,
2380
- error: V.error,
2381
- agentConfig: V.agentConfig,
2382
- connect: V.connect,
2383
- disconnect: V.disconnect,
2384
- getRoom: V.getRoom,
2374
+ connectionState: U.connectionState,
2375
+ agentState: U.agentState,
2376
+ transcript: U.transcript,
2377
+ videoElement: U.videoElement,
2378
+ audioElement: U.audioElement,
2379
+ canResume: U.canResume,
2380
+ error: U.error,
2381
+ agentConfig: U.agentConfig,
2382
+ connect: U.connect,
2383
+ disconnect: U.disconnect,
2384
+ getRoom: U.getRoom,
2385
2385
  isControlled: !1
2386
- }, [j, V]), yt = E(null);
2386
+ }, [V, U]), yt = E(null);
2387
2387
  T(() => {
2388
2388
  const h = _.videoElement, u = yt.current;
2389
2389
  if (!(!h || !u))
@@ -2439,13 +2439,13 @@ function Sr(e) {
2439
2439
  const Qt = k(
2440
2440
  (h) => {
2441
2441
  const u = C == null ? void 0 : C.find((J) => J.id === h);
2442
- u && (Je(!1), h !== pe && (y(!0), _.disconnect(), oe || Se(h), v == null || v(u)));
2442
+ u && (Je(!1), h !== pe && (y(!0), _.disconnect(), ie || Se(h), v == null || v(u)));
2443
2443
  },
2444
2444
  [
2445
2445
  C,
2446
2446
  pe,
2447
2447
  _,
2448
- oe,
2448
+ ie,
2449
2449
  v
2450
2450
  ]
2451
2451
  );
@@ -2458,7 +2458,7 @@ function Sr(e) {
2458
2458
  };
2459
2459
  return window.addEventListener("keydown", h), () => window.removeEventListener("keydown", h);
2460
2460
  }, [X]);
2461
- const Zt = !!I || !!(K != null && K.avatarImageUrl) || _.isControlled, $e = kn(Me, i, Zt);
2461
+ const Zt = !!I || !!(K != null && K.avatarImageUrl) || _.isControlled, $e = kn(Me, o, Zt);
2462
2462
  ge === void 0 && ((wt = $e.info) != null && wt.capabilities) && (at.current = $e.info.capabilities);
2463
2463
  const Ge = (K == null ? void 0 : K.name) ?? H ?? ((_t = _.agentConfig) == null ? void 0 : _t.name) ?? ((xt = $e.info) == null ? void 0 : xt.name) ?? "Live Layer", ct = (K == null ? void 0 : K.avatarImageUrl) ?? I ?? ((kt = _.agentConfig) == null ? void 0 : kt.avatarImageUrl) ?? ((Lt = $e.info) == null ? void 0 : Lt.avatarImageUrl) ?? null, en = b ?? ((St = _.agentConfig) == null ? void 0 : St.idleLoopUrl) ?? ((Ct = $e.info) == null ? void 0 : Ct.idleLoopUrl) ?? null, tn = z ?? null, nn = k(() => ee("expanded"), [ee]), rn = k(
2464
2464
  () => ee("minimized"),
@@ -2581,13 +2581,13 @@ const Pr = ({
2581
2581
  agentId: e,
2582
2582
  baseUrl: t,
2583
2583
  apiKey: r,
2584
- mode: i,
2585
- onAgentEvent: o,
2584
+ mode: o,
2585
+ onAgentEvent: i,
2586
2586
  className: l,
2587
2587
  style: s
2588
2588
  }) => {
2589
- const d = E(null), f = E(null), g = E(o);
2590
- g.current = o;
2589
+ const d = E(null), f = E(null), g = E(i);
2590
+ g.current = i;
2591
2591
  const m = k((a) => {
2592
2592
  var R;
2593
2593
  const c = a.detail;
@@ -2597,42 +2597,42 @@ const Pr = ({
2597
2597
  const a = d.current;
2598
2598
  if (!a) return;
2599
2599
  const c = document.createElement("livelayer-widget");
2600
- return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), i && c.setAttribute("mode", i), c.addEventListener("agent-event", m), a.appendChild(c), f.current = c, () => {
2600
+ return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), o && c.setAttribute("mode", o), c.addEventListener("agent-event", m), a.appendChild(c), f.current = c, () => {
2601
2601
  c.removeEventListener("agent-event", m), a.removeChild(c), f.current = null;
2602
2602
  };
2603
2603
  }, [e]), T(() => {
2604
- f.current && (i ? f.current.setAttribute("mode", i) : f.current.removeAttribute("mode"));
2605
- }, [i]), /* @__PURE__ */ n("div", { ref: d, className: l, style: s });
2604
+ f.current && (o ? f.current.setAttribute("mode", o) : f.current.removeAttribute("mode"));
2605
+ }, [o]), /* @__PURE__ */ n("div", { ref: d, className: l, style: s });
2606
2606
  }, Dr = ft(
2607
- function({ id: t, intent: r, as: i = "div", className: o, style: l, children: s }, d) {
2607
+ function({ id: t, intent: r, as: o = "div", className: i, style: l, children: s }, d) {
2608
2608
  return un(
2609
- i,
2609
+ o,
2610
2610
  {
2611
2611
  ref: d,
2612
2612
  "data-ll-region": t,
2613
2613
  "data-ll-intent": r,
2614
- className: o,
2614
+ className: i,
2615
2615
  style: l
2616
2616
  },
2617
2617
  s
2618
2618
  );
2619
2619
  }
2620
2620
  ), $r = ft(
2621
- function({ id: t, intent: r, children: i, ...o }, l) {
2621
+ function({ id: t, intent: r, children: o, ...i }, l) {
2622
2622
  return /* @__PURE__ */ n(
2623
2623
  "form",
2624
2624
  {
2625
2625
  ref: l,
2626
2626
  "data-ll-form": t,
2627
2627
  "data-ll-intent": r,
2628
- ...o,
2629
- children: i
2628
+ ...i,
2629
+ children: o
2630
2630
  }
2631
2631
  );
2632
2632
  }
2633
2633
  ), zr = ft(
2634
2634
  function(t, r) {
2635
- const { name: i, label: o, labelClassName: l } = t, s = { name: i, "data-ll-field": i };
2635
+ const { name: o, label: i, labelClassName: l } = t, s = { name: o, "data-ll-field": o };
2636
2636
  let d;
2637
2637
  if ("as" in t && t.as === "textarea") {
2638
2638
  const { name: f, label: g, labelClassName: m, as: a, ...c } = t;
@@ -2666,8 +2666,8 @@ const Pr = ({
2666
2666
  }
2667
2667
  );
2668
2668
  }
2669
- return o === void 0 ? d : /* @__PURE__ */ w("label", { className: l, children: [
2670
- o,
2669
+ return i === void 0 ? d : /* @__PURE__ */ w("label", { className: l, children: [
2670
+ i,
2671
2671
  d
2672
2672
  ] });
2673
2673
  }
@@ -2678,21 +2678,21 @@ function Hr({
2678
2678
  defaultOpen: t = !1,
2679
2679
  storageKey: r = "ll-debug-open"
2680
2680
  }) {
2681
- const [i, o] = S(t), [l, s] = S([]), [d, f] = S(""), [g, m] = S(!1), a = E(/* @__PURE__ */ new Set()), c = E([]), R = E(g);
2681
+ const [o, i] = S(t), [l, s] = S([]), [d, f] = S(""), [g, m] = S(!1), a = E(/* @__PURE__ */ new Set()), c = E([]), R = E(g);
2682
2682
  R.current = g, T(() => {
2683
2683
  try {
2684
2684
  const v = localStorage.getItem(r);
2685
- v === "1" && o(!0), v === "0" && o(!1);
2685
+ v === "1" && i(!0), v === "0" && i(!1);
2686
2686
  } catch {
2687
2687
  }
2688
2688
  }, [r]), T(() => {
2689
2689
  try {
2690
- localStorage.setItem(r, i ? "1" : "0");
2690
+ localStorage.setItem(r, o ? "1" : "0");
2691
2691
  } catch {
2692
2692
  }
2693
- }, [i, r]), T(() => {
2693
+ }, [o, r]), T(() => {
2694
2694
  const v = (b) => {
2695
- (b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(), o((z) => !z));
2695
+ (b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(), i((z) => !z));
2696
2696
  };
2697
2697
  return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
2698
2698
  }, []), T(() => {
@@ -2734,12 +2734,12 @@ function Hr({
2734
2734
  return console.warn = z("warn", v), console.log = z("log", b), () => {
2735
2735
  console.warn = v, console.log = b;
2736
2736
  };
2737
- }, []), !i)
2737
+ }, []), !o)
2738
2738
  return /* @__PURE__ */ n(
2739
2739
  "button",
2740
2740
  {
2741
2741
  type: "button",
2742
- onClick: () => o(!0),
2742
+ onClick: () => i(!0),
2743
2743
  title: "Open LiveLayer debug panel (Cmd/Ctrl + Shift + L)",
2744
2744
  "aria-label": "Open LiveLayer debug panel",
2745
2745
  style: {
@@ -2833,7 +2833,7 @@ function Hr({
2833
2833
  "button",
2834
2834
  {
2835
2835
  type: "button",
2836
- onClick: () => o(!1),
2836
+ onClick: () => i(!1),
2837
2837
  style: dt("transparent"),
2838
2838
  "aria-label": "Close",
2839
2839
  title: "Close (Cmd/Ctrl + Shift + L)",
@@ -2922,7 +2922,7 @@ function Cr({
2922
2922
  expanded: t,
2923
2923
  onToggle: r
2924
2924
  }) {
2925
- 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", {
2925
+ const o = 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", i = new Date(e.ts).toLocaleTimeString("en-US", {
2926
2926
  hour12: !1
2927
2927
  });
2928
2928
  return /* @__PURE__ */ w(
@@ -2952,14 +2952,14 @@ function Cr({
2952
2952
  fontVariantNumeric: "tabular-nums",
2953
2953
  fontSize: 10
2954
2954
  },
2955
- children: o
2955
+ children: i
2956
2956
  }
2957
2957
  ),
2958
2958
  /* @__PURE__ */ n(
2959
2959
  "span",
2960
2960
  {
2961
2961
  style: {
2962
- color: i,
2962
+ color: o,
2963
2963
  fontWeight: 600,
2964
2964
  flexShrink: 0
2965
2965
  },
@@ -3006,20 +3006,20 @@ function Er(e) {
3006
3006
  }
3007
3007
  }
3008
3008
  function Or() {
3009
- const [e, t] = S([]), r = k((o) => {
3009
+ const [e, t] = S([]), r = k((i) => {
3010
3010
  t((l) => {
3011
- const s = l.findIndex((d) => d.id === o.id);
3011
+ const s = l.findIndex((d) => d.id === i.id);
3012
3012
  if (s >= 0) {
3013
3013
  const d = l.slice();
3014
- return d[s] = o, d;
3014
+ return d[s] = i, d;
3015
3015
  }
3016
- return [...l, o];
3016
+ return [...l, i];
3017
3017
  });
3018
- }, []), i = k(() => t([]), []);
3018
+ }, []), o = k(() => t([]), []);
3019
3019
  return {
3020
3020
  entries: e,
3021
3021
  pushSegment: r,
3022
- clear: i,
3022
+ clear: o,
3023
3023
  latest: e.length > 0 ? e[e.length - 1] : null
3024
3024
  };
3025
3025
  }