@livelayer/react 0.21.0 → 0.21.2

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
@@ -15,8 +15,8 @@ class mr extends sr {
15
15
  return { hasError: !0, error: t };
16
16
  }
17
17
  componentDidCatch(t, r) {
18
- var i, l;
19
- (l = (i = this.props).onError) == null || l.call(i, t, r);
18
+ var i, a;
19
+ (a = (i = this.props).onError) == null || a.call(i, t, r);
20
20
  }
21
21
  render() {
22
22
  var t;
@@ -36,15 +36,15 @@ class mr extends sr {
36
36
  }
37
37
  }
38
38
  function gr(e) {
39
- const [t, r] = M("idle"), [i, l] = M("idle"), [o, s] = M([]), [a, c] = M(null), [d, b] = M(null), [p, h] = M(null), [P, x] = M(!1), [E, g] = M(null), w = I(null), R = I(e.onDataMessage);
39
+ const [t, r] = M("idle"), [i, a] = M("idle"), [o, c] = M([]), [l, s] = M(null), [u, b] = M(null), [p, h] = M(null), [P, x] = M(!1), [E, g] = M(null), w = I(null), R = I(e.onDataMessage);
40
40
  R.current = e.onDataMessage, T(() => {
41
41
  const m = {
42
42
  onConnectionStateChange: (W) => {
43
43
  r(W), W === "connected" && g(null);
44
44
  },
45
- onAgentStateChange: l,
46
- onTranscript: (W) => s([...W]),
47
- onAgentConfig: c,
45
+ onAgentStateChange: a,
46
+ onTranscript: (W) => c([...W]),
47
+ onAgentConfig: s,
48
48
  onAudioTrack: (W) => h(W),
49
49
  onVideoTrack: (W) => b(W),
50
50
  onVideoTrackRemoved: () => b(null),
@@ -64,7 +64,7 @@ function gr(e) {
64
64
  },
65
65
  m
66
66
  );
67
- return w.current = D, r("idle"), l("idle"), s([]), c(null), b(null), h(null), x(!1), g(null), () => {
67
+ return w.current = D, r("idle"), a("idle"), c([]), s(null), b(null), h(null), x(!1), g(null), () => {
68
68
  var W;
69
69
  (W = D.destroy) == null || W.call(D), w.current = null;
70
70
  };
@@ -94,8 +94,8 @@ function gr(e) {
94
94
  connectionState: t,
95
95
  agentState: i,
96
96
  transcript: o,
97
- agentConfig: a,
98
- videoElement: d,
97
+ agentConfig: l,
98
+ videoElement: u,
99
99
  audioElement: p,
100
100
  canResume: P,
101
101
  error: E,
@@ -106,7 +106,7 @@ function gr(e) {
106
106
  };
107
107
  }
108
108
  function yr() {
109
- const e = I(null), t = I(/* @__PURE__ */ new Map()), r = I(null), i = I(/* @__PURE__ */ new Set()), l = C(() => {
109
+ const e = I(null), t = I(/* @__PURE__ */ new Map()), r = I(null), i = I(/* @__PURE__ */ new Set()), a = C(() => {
110
110
  const x = t.current;
111
111
  if (x.size === 0) {
112
112
  r.current = null;
@@ -126,10 +126,10 @@ function yr() {
126
126
  } catch (w) {
127
127
  console.error("[useAudioLevel] subscriber threw:", w);
128
128
  }
129
- r.current = requestAnimationFrame(l);
130
- }, []), o = C(() => e.current ? e.current : typeof window > "u" || typeof AudioContext > "u" ? null : (e.current = new AudioContext(), e.current), []), s = C(() => {
131
- r.current === null && t.current.size > 0 && (r.current = requestAnimationFrame(l));
132
- }, [l]), a = C((x) => {
129
+ r.current = requestAnimationFrame(a);
130
+ }, []), o = C(() => e.current ? e.current : typeof window > "u" || typeof AudioContext > "u" ? null : (e.current = new AudioContext(), e.current), []), c = C(() => {
131
+ r.current === null && t.current.size > 0 && (r.current = requestAnimationFrame(a));
132
+ }, [a]), l = C((x) => {
133
133
  const E = t.current.get(x);
134
134
  if (E) {
135
135
  try {
@@ -142,11 +142,11 @@ function yr() {
142
142
  }
143
143
  t.current.delete(x);
144
144
  }
145
- }, []), c = C(
145
+ }, []), s = C(
146
146
  (x, E) => {
147
147
  const g = o();
148
148
  if (!g) return;
149
- a(x);
149
+ l(x);
150
150
  const w = E(g);
151
151
  if (!w) return;
152
152
  const R = g.createAnalyser();
@@ -161,12 +161,12 @@ function yr() {
161
161
  analyser: R,
162
162
  node: w,
163
163
  buffer: new Uint8Array(new ArrayBuffer(R.frequencyBinCount))
164
- }), s();
164
+ }), c();
165
165
  },
166
- [a, o, s]
167
- ), d = C(
166
+ [l, o, c]
167
+ ), u = C(
168
168
  (x, E = "agent") => {
169
- c(E, (g) => {
169
+ s(E, (g) => {
170
170
  try {
171
171
  return g.createMediaElementSource(x);
172
172
  } catch (w) {
@@ -178,10 +178,10 @@ function yr() {
178
178
  }
179
179
  });
180
180
  },
181
- [c]
181
+ [s]
182
182
  ), b = C(
183
183
  (x, E = "mic") => {
184
- c(E, (g) => {
184
+ s(E, (g) => {
185
185
  try {
186
186
  return g.createMediaStreamSource(x);
187
187
  } catch (w) {
@@ -193,17 +193,17 @@ function yr() {
193
193
  }
194
194
  });
195
195
  },
196
- [c]
196
+ [s]
197
197
  ), p = C(
198
198
  (x) => {
199
- a(x), t.current.size === 0 && r.current !== null && (cancelAnimationFrame(r.current), r.current = null);
199
+ l(x), t.current.size === 0 && r.current !== null && (cancelAnimationFrame(r.current), r.current = null);
200
200
  },
201
- [a]
201
+ [l]
202
202
  ), h = C(() => {
203
203
  r.current !== null && (cancelAnimationFrame(r.current), r.current = null);
204
204
  for (const x of Array.from(t.current.keys()))
205
- a(x);
206
- }, [a]), P = C((x) => (i.current.add(x), () => {
205
+ l(x);
206
+ }, [l]), P = C((x) => (i.current.add(x), () => {
207
207
  i.current.delete(x);
208
208
  }), []);
209
209
  return T(() => () => {
@@ -215,37 +215,37 @@ function yr() {
215
215
  e.current = null;
216
216
  }
217
217
  i.current.clear();
218
- }, [h]), { attach: d, attachStream: b, detach: h, detachSlot: p, subscribe: P };
218
+ }, [h]), { attach: u, attachStream: b, detach: h, detachSlot: p, subscribe: P };
219
219
  }
220
220
  function vr(e) {
221
221
  const t = e == null ? void 0 : e.mediaStreamTrack;
222
222
  return t ? new MediaStream([t]) : null;
223
223
  }
224
224
  function br(e = {}) {
225
- const t = e.gateUntilAgentReady ?? !1, r = e.agentState ?? null, [i, l] = M(t), [o, s] = M(""), [a, c] = M(null), d = I(null), b = I(null), p = I({
225
+ const t = e.gateUntilAgentReady ?? !1, r = e.agentState ?? null, [i, a] = M(t), [o, c] = M(""), [l, s] = M(null), u = I(null), b = I(null), p = I({
226
226
  active: t,
227
227
  lastAutoIntent: null
228
228
  }), h = C(async (S) => {
229
229
  var y, O;
230
- if (d.current && b.current) {
230
+ if (u.current && b.current) {
231
231
  try {
232
- await b.current.localParticipant.unpublishTrack(d.current);
232
+ await b.current.localParticipant.unpublishTrack(u.current);
233
233
  } catch {
234
234
  }
235
- d.current.stop(), d.current = null;
235
+ u.current.stop(), u.current = null;
236
236
  }
237
- b.current = S, c(null);
237
+ b.current = S, s(null);
238
238
  try {
239
239
  const m = await pr({
240
240
  echoCancellation: !0,
241
241
  noiseSuppression: !0
242
242
  });
243
- await S.localParticipant.publishTrack(m), d.current = m, p.current.active ? (await S.localParticipant.setMicrophoneEnabled(!1), p.current.lastAutoIntent = !1, l(!0)) : l(m.isMuted);
243
+ await S.localParticipant.publishTrack(m), u.current = m, p.current.active ? (await S.localParticipant.setMicrophoneEnabled(!1), p.current.lastAutoIntent = !1, a(!0)) : a(m.isMuted);
244
244
  const D = (O = (y = m.mediaStreamTrack) == null ? void 0 : y.getSettings) == null ? void 0 : O.call(y);
245
- D != null && D.deviceId && s(D.deviceId);
245
+ D != null && D.deviceId && c(D.deviceId);
246
246
  } catch (m) {
247
247
  const D = m instanceof Error && m.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
248
- throw c(D), m;
248
+ throw s(D), m;
249
249
  }
250
250
  }, []), P = C((S) => {
251
251
  b.current = S;
@@ -253,17 +253,17 @@ function br(e = {}) {
253
253
  const y = b.current;
254
254
  if (y)
255
255
  try {
256
- await y.switchActiveDevice("audioinput", S), s(S);
256
+ await y.switchActiveDevice("audioinput", S), c(S);
257
257
  } catch (O) {
258
258
  console.warn("[useMicrophoneState] switchDevice failed:", O);
259
259
  }
260
260
  }, []), E = C(async () => {
261
261
  const S = b.current, y = !i;
262
- if (l(y), p.current.active = !1, !!S)
262
+ if (a(y), p.current.active = !1, !!S)
263
263
  try {
264
264
  await S.localParticipant.setMicrophoneEnabled(!y);
265
265
  } catch (O) {
266
- console.warn("[useMicrophoneState] setMicrophoneEnabled failed:", O), l(!y);
266
+ console.warn("[useMicrophoneState] setMicrophoneEnabled failed:", O), a(!y);
267
267
  }
268
268
  }, [i]);
269
269
  T(() => {
@@ -273,10 +273,10 @@ function br(e = {}) {
273
273
  p.current.active = !1;
274
274
  return;
275
275
  }
276
- y.isMicrophoneEnabled === p.current.lastAutoIntent && (y.setMicrophoneEnabled(!0), p.current.lastAutoIntent = !0, l(!1)), p.current.active = !1;
276
+ y.isMicrophoneEnabled === p.current.lastAutoIntent && (y.setMicrophoneEnabled(!0), p.current.lastAutoIntent = !0, a(!1)), p.current.active = !1;
277
277
  }, [r]);
278
278
  const g = C(() => {
279
- const S = d.current, y = b.current;
279
+ const S = u.current, y = b.current;
280
280
  if (S && y) {
281
281
  try {
282
282
  y.localParticipant.unpublishTrack(S);
@@ -284,12 +284,12 @@ function br(e = {}) {
284
284
  }
285
285
  S.stop();
286
286
  }
287
- d.current = null, b.current = null, p.current = { active: t, lastAutoIntent: null }, l(t), s("");
288
- }, [t]), w = C(() => c(null), []), R = C(() => vr(d.current), []);
287
+ u.current = null, b.current = null, p.current = { active: t, lastAutoIntent: null }, a(t), c("");
288
+ }, [t]), w = C(() => s(null), []), R = C(() => vr(u.current), []);
289
289
  return {
290
290
  isMuted: i,
291
291
  activeDeviceId: o,
292
- micError: a,
292
+ micError: l,
293
293
  toggleMute: E,
294
294
  setupMic: h,
295
295
  attachRoom: P,
@@ -301,11 +301,11 @@ function br(e = {}) {
301
301
  }
302
302
  const wr = { resolution: { width: 640, height: 480, frameRate: 24 } };
303
303
  function _r() {
304
- const [e, t] = M(!1), [r, i] = M(null), [l, o] = M(null), [s, a] = M(""), c = I(null), d = I(null), b = C((w) => {
305
- c.current = w;
304
+ const [e, t] = M(!1), [r, i] = M(null), [a, o] = M(null), [c, l] = M(""), s = I(null), u = I(null), b = C((w) => {
305
+ s.current = w;
306
306
  }, []), p = C(() => {
307
307
  var S;
308
- const w = c.current, R = d.current;
308
+ const w = s.current, R = u.current;
309
309
  if (R && w) {
310
310
  const y = w.localParticipant.getTrackPublication(Pn.Source.Camera), m = (y == null ? void 0 : y.track) ?? R;
311
311
  try {
@@ -317,18 +317,18 @@ function _r() {
317
317
  } catch {
318
318
  }
319
319
  }
320
- d.current = null, o(null), t(!1);
320
+ u.current = null, o(null), t(!1);
321
321
  }, []), h = C(async (w) => {
322
- const R = c.current;
322
+ const R = s.current;
323
323
  if (R) {
324
324
  i(null);
325
325
  try {
326
326
  const S = { ...wr };
327
327
  w && (S.deviceId = w);
328
328
  const y = await hr(S);
329
- await R.localParticipant.publishTrack(y), d.current = y;
329
+ await R.localParticipant.publishTrack(y), u.current = y;
330
330
  const O = y.attach();
331
- o(O), t(!0), w && a(w);
331
+ o(O), t(!0), w && l(w);
332
332
  try {
333
333
  R.localParticipant.publishData(
334
334
  new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
@@ -342,19 +342,19 @@ function _r() {
342
342
  }
343
343
  }
344
344
  }, []), P = C(async () => {
345
- e ? p() : await h(s || void 0);
346
- }, [e, s, p, h]), x = C(async (w) => {
345
+ e ? p() : await h(c || void 0);
346
+ }, [e, c, p, h]), x = C(async (w) => {
347
347
  p(), await h(w);
348
348
  }, [p, h]), E = C(() => {
349
- p(), c.current = null, i(null), a("");
349
+ p(), s.current = null, i(null), l("");
350
350
  }, [p]), g = C(() => i(null), []);
351
351
  return T(() => () => {
352
- d.current && d.current.stop();
352
+ u.current && u.current.stop();
353
353
  }, []), {
354
354
  isEnabled: e,
355
355
  error: r,
356
- previewEl: l,
357
- activeDeviceId: s,
356
+ previewEl: a,
357
+ activeDeviceId: c,
358
358
  toggle: P,
359
359
  switchDevice: x,
360
360
  attachRoom: b,
@@ -363,17 +363,17 @@ function _r() {
363
363
  };
364
364
  }
365
365
  function xr() {
366
- const [e, t] = M(!1), [r, i] = M(null), [l, o] = M(null), s = I(null), a = C((h) => {
367
- s.current = h;
368
- }, []), c = C(() => o(null), []), d = C(async () => {
369
- const h = s.current;
366
+ const [e, t] = M(!1), [r, i] = M(null), [a, o] = M(null), c = I(null), l = C((h) => {
367
+ c.current = h;
368
+ }, []), s = C(() => o(null), []), u = C(async () => {
369
+ const h = c.current;
370
370
  if (h) {
371
371
  if (e) {
372
372
  try {
373
373
  await h.localParticipant.setScreenShareEnabled(!1);
374
374
  } catch {
375
375
  }
376
- c(), t(!1);
376
+ s(), t(!1);
377
377
  return;
378
378
  }
379
379
  i(null);
@@ -402,42 +402,42 @@ function xr() {
402
402
  x !== "NotAllowedError" && x !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
403
403
  }
404
404
  }
405
- }, [e, c]), b = C(() => {
406
- const h = s.current;
405
+ }, [e, s]), b = C(() => {
406
+ const h = c.current;
407
407
  if (h && e)
408
408
  try {
409
409
  h.localParticipant.setScreenShareEnabled(!1);
410
410
  } catch {
411
411
  }
412
- c(), t(!1), i(null), s.current = null;
413
- }, [e, c]), p = C(() => i(null), []);
414
- return { isEnabled: e, error: r, previewEl: l, toggle: d, attachRoom: a, teardown: b, clearError: p };
412
+ s(), t(!1), i(null), c.current = null;
413
+ }, [e, s]), p = C(() => i(null), []);
414
+ return { isEnabled: e, error: r, previewEl: a, toggle: u, attachRoom: l, teardown: b, clearError: p };
415
415
  }
416
416
  function Lr() {
417
- const [e, t] = M([]), [r, i] = M([]), l = C(async () => {
417
+ const [e, t] = M([]), [r, i] = M([]), a = C(async () => {
418
418
  if (!(typeof navigator > "u" || !navigator.mediaDevices))
419
419
  try {
420
420
  const o = await navigator.mediaDevices.enumerateDevices();
421
- t(o.filter((s) => s.kind === "audioinput")), i(o.filter((s) => s.kind === "videoinput"));
421
+ t(o.filter((c) => c.kind === "audioinput")), i(o.filter((c) => c.kind === "videoinput"));
422
422
  } catch {
423
423
  }
424
424
  }, []);
425
425
  return T(() => {
426
- if (l(), typeof navigator > "u" || !navigator.mediaDevices) return;
427
- const o = () => void l();
426
+ if (a(), typeof navigator > "u" || !navigator.mediaDevices) return;
427
+ const o = () => void a();
428
428
  return navigator.mediaDevices.addEventListener("devicechange", o), () => navigator.mediaDevices.removeEventListener("devicechange", o);
429
- }, [l]), { mics: e, cameras: r, refresh: l };
429
+ }, [a]), { mics: e, cameras: r, refresh: a };
430
430
  }
431
431
  function Cr(e, t, r = !1) {
432
- const [i, l] = M(null), [o, s] = M(null), [a, c] = M(!r && !!e);
432
+ const [i, a] = M(null), [o, c] = M(null), [l, s] = M(!r && !!e);
433
433
  return T(() => {
434
434
  if (r || !e) {
435
- c(!1);
435
+ s(!1);
436
436
  return;
437
437
  }
438
- const d = new AbortController(), b = t || "https://app.livelayer.studio";
439
- return c(!0), s(null), fetch(`${b}/api/widget/agent/${encodeURIComponent(e)}`, {
440
- signal: d.signal
438
+ const u = new AbortController(), b = t || "https://app.livelayer.studio";
439
+ return s(!0), c(null), fetch(`${b}/api/widget/agent/${encodeURIComponent(e)}`, {
440
+ signal: u.signal
441
441
  }).then(async (p) => {
442
442
  if (!p.ok) {
443
443
  const h = await p.json().catch(() => ({}));
@@ -445,11 +445,11 @@ function Cr(e, t, r = !1) {
445
445
  }
446
446
  return p.json();
447
447
  }).then((p) => {
448
- d.signal.aborted || (l(p), c(!1));
448
+ u.signal.aborted || (a(p), s(!1));
449
449
  }).catch((p) => {
450
- d.signal.aborted || (s(p instanceof Error ? p.message : "Agent lookup failed"), c(!1));
451
- }), () => d.abort();
452
- }, [e, t, r]), { info: i, error: o, loading: a };
450
+ u.signal.aborted || (c(p instanceof Error ? p.message : "Agent lookup failed"), s(!1));
451
+ }), () => u.abort();
452
+ }, [e, t, r]), { info: i, error: o, loading: l };
453
453
  }
454
454
  function Dn(e) {
455
455
  if (typeof window > "u") return null;
@@ -478,13 +478,13 @@ function Sr({
478
478
  defaultValue: t = "expanded",
479
479
  onChange: r
480
480
  } = {}) {
481
- const i = e !== void 0, [l, o] = M(t), s = i ? e : l, a = C(
482
- (c) => {
483
- c !== s && (i || o(c), r == null || r(c));
481
+ const i = e !== void 0, [a, o] = M(t), c = i ? e : a, l = C(
482
+ (s) => {
483
+ s !== c && (i || o(s), r == null || r(s));
484
484
  },
485
- [s, i, r]
485
+ [c, i, r]
486
486
  );
487
- return [s, a];
487
+ return [c, l];
488
488
  }
489
489
  const Er = ["hidden", "minimized", "expanded"];
490
490
  function Nr(e) {
@@ -495,20 +495,20 @@ function Ar({
495
495
  defaultValue: t = "expanded",
496
496
  onChange: r,
497
497
  persistKey: i = "ll-widget",
498
- disablePersistence: l = !1
498
+ disablePersistence: a = !1
499
499
  } = {}) {
500
- const o = `${i}:display-mode`, s = I(!1), [a, c] = Sr({
500
+ const o = `${i}:display-mode`, c = I(!1), [l, s] = Sr({
501
501
  value: e,
502
502
  defaultValue: t,
503
- onChange: (d) => {
504
- e === void 0 && !l && zn(o, d), r == null || r(d);
503
+ onChange: (u) => {
504
+ e === void 0 && !a && zn(o, u), r == null || r(u);
505
505
  }
506
506
  });
507
507
  return T(() => {
508
- if (s.current || (s.current = !0, l || e !== void 0)) return;
509
- const d = Nr(Dn(o));
510
- d && d !== a && c(d);
511
- }, []), [a, c];
508
+ if (c.current || (c.current = !0, a || e !== void 0)) return;
509
+ const u = Nr(Dn(o));
510
+ u && u !== l && s(u);
511
+ }, []), [l, s];
512
512
  }
513
513
  const Mr = 640;
514
514
  function Ir(e = Mr) {
@@ -520,9 +520,9 @@ function Ir(e = Mr) {
520
520
  }
521
521
  if (typeof window > "u" || typeof window.matchMedia > "u")
522
522
  return;
523
- const i = `(max-width: ${e - 1}px)`, l = window.matchMedia(i), o = () => r(l.matches);
524
- return o(), typeof l.addEventListener == "function" ? (l.addEventListener("change", o), () => l.removeEventListener("change", o)) : (l.addListener(o), () => {
525
- l.removeListener(o);
523
+ const i = `(max-width: ${e - 1}px)`, a = window.matchMedia(i), o = () => r(a.matches);
524
+ return o(), typeof a.addEventListener == "function" ? (a.addEventListener("change", o), () => a.removeEventListener("change", o)) : (a.addListener(o), () => {
525
+ a.removeListener(o);
526
526
  });
527
527
  }, [e]), t;
528
528
  }
@@ -539,24 +539,24 @@ function zr(e) {
539
539
  return null;
540
540
  }
541
541
  if (typeof t != "object" || t === null) return null;
542
- const r = t, { top: i, left: l, width: o, height: s } = r;
543
- return typeof i != "number" || typeof l != "number" || typeof o != "number" || typeof s != "number" || !Number.isFinite(i) || !Number.isFinite(l) || !Number.isFinite(o) || !Number.isFinite(s) ? null : { top: i, left: l, width: o, height: s };
542
+ const r = t, { top: i, left: a, width: o, height: c } = r;
543
+ return typeof i != "number" || typeof a != "number" || typeof o != "number" || typeof c != "number" || !Number.isFinite(i) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(c) ? null : { top: i, left: a, width: o, height: c };
544
544
  }
545
545
  function Ct() {
546
546
  return typeof window > "u" ? { vw: 0, vh: 0 } : { vw: window.innerWidth, vh: window.innerHeight };
547
547
  }
548
548
  function Ft(e, t, r) {
549
- const { minWidth: i, minHeight: l, edgeMargin: o, vw: s, vh: a } = r, c = Math.max(i, s - o * 2), d = Math.max(l, a - o * 2);
549
+ const { minWidth: i, minHeight: a, edgeMargin: o, vw: c, vh: l } = r, s = Math.max(i, c - o * 2), u = Math.max(a, l - o * 2);
550
550
  return {
551
- width: Math.max(i, Math.min(c, e)),
552
- height: Math.max(l, Math.min(d, t))
551
+ width: Math.max(i, Math.min(s, e)),
552
+ height: Math.max(a, Math.min(u, t))
553
553
  };
554
554
  }
555
- function Wt(e, t, r, i, l) {
556
- const { edgeMargin: o, vw: s, vh: a } = l, c = o, d = o, b = Math.max(c, s - r - o), p = Math.max(d, a - i - o);
555
+ function Wt(e, t, r, i, a) {
556
+ const { edgeMargin: o, vw: c, vh: l } = a, s = o, u = o, b = Math.max(s, c - r - o), p = Math.max(u, l - i - o);
557
557
  return {
558
- top: Math.max(d, Math.min(p, e)),
559
- left: Math.max(c, Math.min(b, t))
558
+ top: Math.max(u, Math.min(p, e)),
559
+ left: Math.max(s, Math.min(b, t))
560
560
  };
561
561
  }
562
562
  function $r(e) {
@@ -564,55 +564,55 @@ function $r(e) {
564
564
  draggable: t,
565
565
  resizable: r,
566
566
  persistKey: i,
567
- disablePersistence: l,
567
+ disablePersistence: a,
568
568
  minWidth: o = Rr,
569
- minHeight: s = Tr,
570
- edgeMargin: a = Pr
571
- } = e, [c, d] = M(null), [b, p] = M(!1), [h, P] = M(!1), x = I(null), E = I(null), g = I(!1), w = I(null);
572
- w.current = c;
569
+ minHeight: c = Tr,
570
+ edgeMargin: l = Pr
571
+ } = e, [s, u] = M(null), [b, p] = M(!1), [h, P] = M(!1), x = I(null), E = I(null), g = I(!1), w = I(null);
572
+ w.current = s;
573
573
  const R = C(
574
574
  (f) => {
575
- l || (f === null ? kr(Ot(i)) : zn(Ot(i), JSON.stringify(f)));
575
+ a || (f === null ? kr(Ot(i)) : zn(Ot(i), JSON.stringify(f)));
576
576
  },
577
- [l, i]
577
+ [a, i]
578
578
  );
579
579
  T(() => {
580
- if (g.current || (g.current = !0, l)) return;
580
+ if (g.current || (g.current = !0, a)) return;
581
581
  const f = zr(Dn(Ot(i)));
582
582
  if (!f) return;
583
583
  const { vw: N, vh: z } = Ct(), q = Ft(f.width, f.height, {
584
584
  minWidth: o,
585
- minHeight: s,
586
- edgeMargin: a,
585
+ minHeight: c,
586
+ edgeMargin: l,
587
587
  vw: N,
588
588
  vh: z
589
589
  }), X = Wt(f.top, f.left, q.width, q.height, {
590
- edgeMargin: a,
590
+ edgeMargin: l,
591
591
  vw: N,
592
592
  vh: z
593
593
  });
594
- d({ ...X, ...q });
594
+ u({ ...X, ...q });
595
595
  }, []), T(() => {
596
596
  if (typeof window > "u") return;
597
597
  const f = () => {
598
- d((N) => {
598
+ u((N) => {
599
599
  if (N === null) return null;
600
600
  const { vw: z, vh: q } = Ct(), X = Ft(N.width, N.height, {
601
601
  minWidth: o,
602
- minHeight: s,
603
- edgeMargin: a,
602
+ minHeight: c,
603
+ edgeMargin: l,
604
604
  vw: z,
605
605
  vh: q
606
606
  });
607
607
  return { ...Wt(N.top, N.left, X.width, X.height, {
608
- edgeMargin: a,
608
+ edgeMargin: l,
609
609
  vw: z,
610
610
  vh: q
611
611
  }), ...X };
612
612
  });
613
613
  };
614
614
  return window.addEventListener("resize", f), () => window.removeEventListener("resize", f);
615
- }, [o, s, a]);
615
+ }, [o, c, l]);
616
616
  const S = C(
617
617
  (f) => {
618
618
  if (!t || f.pointerType === "mouse" && f.button !== 0) return;
@@ -654,11 +654,11 @@ function $r(e) {
654
654
  N.startLeft + z,
655
655
  N.width,
656
656
  N.height,
657
- { edgeMargin: a, vw: X, vh: ee }
657
+ { edgeMargin: l, vw: X, vh: ee }
658
658
  );
659
- d({ ...V, width: N.width, height: N.height });
659
+ u({ ...V, width: N.width, height: N.height });
660
660
  },
661
- [a]
661
+ [l]
662
662
  ), O = C(
663
663
  (f) => {
664
664
  const N = x.current;
@@ -667,12 +667,12 @@ function $r(e) {
667
667
  f.currentTarget.releasePointerCapture(f.pointerId);
668
668
  } catch {
669
669
  }
670
- x.current = null, N.moved && (p(!1), d((z) => (z && R(z), z)));
670
+ x.current = null, N.moved && (p(!1), u((z) => (z && R(z), z)));
671
671
  }
672
672
  },
673
673
  [R]
674
674
  ), m = C(() => {
675
- x.current = null, E.current = null, p(!1), P(!1), d(null), R(null);
675
+ x.current = null, E.current = null, p(!1), P(!1), u(null), R(null);
676
676
  }, [R]), D = C(
677
677
  (f) => {
678
678
  if (!r || f.pointerType === "mouse" && f.button !== 0) return;
@@ -704,18 +704,18 @@ function $r(e) {
704
704
  (f) => {
705
705
  const N = E.current;
706
706
  if (!N) return;
707
- const z = f.clientX - N.startClientX, q = f.clientY - N.startClientY, { vw: X, vh: ee } = Ct(), V = X - N.left - a, te = ee - N.top - a, oe = Ft(N.startWidth + z, N.startHeight + q, {
707
+ const z = f.clientX - N.startClientX, q = f.clientY - N.startClientY, { vw: X, vh: ee } = Ct(), V = X - N.left - l, te = ee - N.top - l, oe = Ft(N.startWidth + z, N.startHeight + q, {
708
708
  minWidth: o,
709
- minHeight: s,
710
- edgeMargin: a,
709
+ minHeight: c,
710
+ edgeMargin: l,
711
711
  // Clamp the available viewport to the room from the anchored corner
712
712
  // so the widget can't grow past the bottom/right edge.
713
- vw: Math.min(X, N.left + V + a),
714
- vh: Math.min(ee, N.top + te + a)
713
+ vw: Math.min(X, N.left + V + l),
714
+ vh: Math.min(ee, N.top + te + l)
715
715
  });
716
- d({ top: N.top, left: N.left, ...oe });
716
+ u({ top: N.top, left: N.left, ...oe });
717
717
  },
718
- [a, o, s]
718
+ [l, o, c]
719
719
  ), K = C(
720
720
  (f) => {
721
721
  if (E.current) {
@@ -723,22 +723,22 @@ function $r(e) {
723
723
  f.currentTarget.releasePointerCapture(f.pointerId);
724
724
  } catch {
725
725
  }
726
- E.current = null, P(!1), d((z) => (z && R(z), z));
726
+ E.current = null, P(!1), u((z) => (z && R(z), z));
727
727
  }
728
728
  },
729
729
  [R]
730
730
  );
731
731
  return {
732
- style: c === null ? {} : {
732
+ style: s === null ? {} : {
733
733
  position: "fixed",
734
- top: `${c.top}px`,
735
- left: `${c.left}px`,
734
+ top: `${s.top}px`,
735
+ left: `${s.left}px`,
736
736
  right: "auto",
737
737
  bottom: "auto",
738
- width: `${c.width}px`,
739
- height: `${c.height}px`
738
+ width: `${s.width}px`,
739
+ height: `${s.height}px`
740
740
  },
741
- hasGeometry: c !== null,
741
+ hasGeometry: s !== null,
742
742
  isDragging: b,
743
743
  isResizing: h,
744
744
  dragHandleProps: {
@@ -794,8 +794,8 @@ function Wr(e) {
794
794
  function Br(e) {
795
795
  const t = hn.get(e);
796
796
  if (t) return t;
797
- const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", l = "", o = r.replace(/\*\*/g, i).replace(/\*/g, l), a = Wr(o).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(l, "g"), "[^/]+"), c = new RegExp(`^${a}\\/?$`);
798
- return hn.set(e, c), c;
797
+ const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", a = "", o = r.replace(/\*\*/g, i).replace(/\*/g, a), l = Wr(o).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(a, "g"), "[^/]+"), s = new RegExp(`^${l}\\/?$`);
798
+ return hn.set(e, s), s;
799
799
  }
800
800
  function qr(e, t) {
801
801
  const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
@@ -827,21 +827,21 @@ function Yr(e) {
827
827
  };
828
828
  }
829
829
  function Gr(e) {
830
- const t = et(() => Yr(e.config), [e.config]), r = e.baseUrl.replace(/\/+$/, ""), i = I(null), l = C(
831
- (c) => {
830
+ const t = et(() => Yr(e.config), [e.config]), r = e.baseUrl.replace(/\/+$/, ""), i = I(null), a = C(
831
+ (s) => {
832
832
  try {
833
- new Audio(`${r}${c}`).play().catch(() => {
833
+ new Audio(`${r}${s}`).play().catch(() => {
834
834
  });
835
835
  } catch {
836
836
  }
837
837
  },
838
838
  [r]
839
839
  ), o = C(() => {
840
- t.navigate && l("/audio/page-change-sound.mp3");
841
- }, [t.navigate, l]), s = C(() => {
842
- t.action && l("/audio/confirmation-sound.mp3");
843
- }, [t.action, l]), a = C(
844
- (c) => {
840
+ t.navigate && a("/audio/page-change-sound.mp3");
841
+ }, [t.navigate, a]), c = C(() => {
842
+ t.action && a("/audio/confirmation-sound.mp3");
843
+ }, [t.action, a]), l = C(
844
+ (s) => {
845
845
  if (!t.thinking) {
846
846
  if (i.current) {
847
847
  try {
@@ -852,13 +852,13 @@ function Gr(e) {
852
852
  }
853
853
  return;
854
854
  }
855
- if (c) {
855
+ if (s) {
856
856
  if (i.current) return;
857
857
  try {
858
- const d = new Audio(`${r}/audio/thinking-sound.mp3`);
859
- d.loop = !0, d.volume = 0.3, d.play().catch(() => {
858
+ const u = new Audio(`${r}/audio/thinking-sound.mp3`);
859
+ u.loop = !0, u.volume = 0.3, u.play().catch(() => {
860
860
  i.current = null;
861
- }), i.current = d;
861
+ }), i.current = u;
862
862
  } catch {
863
863
  }
864
864
  } else if (i.current) {
@@ -880,8 +880,8 @@ function Gr(e) {
880
880
  i.current = null;
881
881
  }
882
882
  }, []), et(
883
- () => ({ playPageChange: o, playConfirmation: s, setThinking: a }),
884
- [o, s, a]
883
+ () => ({ playPageChange: o, playConfirmation: c, setThinking: l }),
884
+ [o, c, l]
885
885
  );
886
886
  }
887
887
  const gn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ k(
@@ -1004,12 +1004,12 @@ const ei = ({
1004
1004
  isMobile: t,
1005
1005
  isSpeaking: r,
1006
1006
  onExpand: i,
1007
- label: l = "Open widget",
1007
+ label: a = "Open widget",
1008
1008
  avatarImageUrl: o,
1009
- agentName: s,
1010
- containerEl: a
1009
+ agentName: c,
1010
+ containerEl: l
1011
1011
  }) => {
1012
- const c = Jr(e), d = c === "right" ? "left" : "right", b = t ? 80 : 72, p = !!o, h = !!a, [P, x] = M(null), [E, g] = M(!1), w = I(null), R = I(!1), S = C(
1012
+ const s = Jr(e), u = s === "right" ? "left" : "right", b = t ? 80 : 72, p = !!o, h = !!l, [P, x] = M(null), [E, g] = M(!1), w = I(null), R = I(!1), S = C(
1013
1013
  ($) => {
1014
1014
  if (typeof window > "u") return $;
1015
1015
  const G = b / 2, f = bn + G, N = window.innerHeight - bn - G;
@@ -1085,7 +1085,7 @@ const ei = ({
1085
1085
  [S]
1086
1086
  ), K = [
1087
1087
  "ll-hidden",
1088
- `ll-hidden--${c}`,
1088
+ `ll-hidden--${s}`,
1089
1089
  t ? "ll-hidden--mobile" : "ll-hidden--desktop",
1090
1090
  r ? "ll-hidden--speaking" : null,
1091
1091
  E ? "is-dragging" : null,
@@ -1103,7 +1103,7 @@ const ei = ({
1103
1103
  onPointerCancel: m,
1104
1104
  onClick: D,
1105
1105
  onKeyDown: W,
1106
- "aria-label": l,
1106
+ "aria-label": a,
1107
1107
  "data-position": e,
1108
1108
  style: ae,
1109
1109
  children: p ? (
@@ -1115,7 +1115,7 @@ const ei = ({
1115
1115
  /* @__PURE__ */ n(
1116
1116
  vn,
1117
1117
  {
1118
- direction: d,
1118
+ direction: u,
1119
1119
  className: "ll-hidden__chevron ll-hidden__chevron--mini"
1120
1120
  }
1121
1121
  ),
@@ -1123,7 +1123,7 @@ const ei = ({
1123
1123
  "img",
1124
1124
  {
1125
1125
  src: o,
1126
- alt: s ? `${s} avatar` : "Agent avatar",
1126
+ alt: c ? `${c} avatar` : "Agent avatar",
1127
1127
  className: "ll-hidden__avatar",
1128
1128
  draggable: !1
1129
1129
  }
@@ -1132,7 +1132,7 @@ const ei = ({
1132
1132
  ) : /* @__PURE__ */ n(
1133
1133
  vn,
1134
1134
  {
1135
- direction: d,
1135
+ direction: u,
1136
1136
  className: "ll-hidden__chevron"
1137
1137
  }
1138
1138
  )
@@ -1143,27 +1143,27 @@ const ei = ({
1143
1143
  bars: t = 20,
1144
1144
  maxHeight: r = 20,
1145
1145
  minHeight: i = 4,
1146
- className: l,
1146
+ className: a,
1147
1147
  barClassName: o
1148
1148
  }) => {
1149
- const s = I(null), a = I([]), c = et(() => {
1149
+ const c = I(null), l = I([]), s = et(() => {
1150
1150
  const b = (Math.sqrt(5) - 1) / 2;
1151
1151
  return Array.from({ length: t }, (p, h) => 0.5 + h * b % 1 * 0.5);
1152
1152
  }, [t]);
1153
1153
  T(() => e.subscribe((p) => {
1154
1154
  for (let h = 0; h < t; h++) {
1155
- const P = a.current[h];
1155
+ const P = l.current[h];
1156
1156
  if (!P) continue;
1157
- const x = Math.max(i, p * r * c[h]);
1157
+ const x = Math.max(i, p * r * s[h]);
1158
1158
  P.style.height = `${x}px`;
1159
1159
  }
1160
- }), [e, t, r, i, c]);
1161
- const d = ["ll-waveform", l].filter(Boolean).join(" ");
1162
- return /* @__PURE__ */ n("div", { ref: s, className: d, "aria-hidden": "true", children: Array.from({ length: t }, (b, p) => /* @__PURE__ */ n(
1160
+ }), [e, t, r, i, s]);
1161
+ const u = ["ll-waveform", a].filter(Boolean).join(" ");
1162
+ return /* @__PURE__ */ n("div", { ref: c, className: u, "aria-hidden": "true", children: Array.from({ length: t }, (b, p) => /* @__PURE__ */ n(
1163
1163
  "div",
1164
1164
  {
1165
1165
  ref: (h) => {
1166
- a.current[p] = h;
1166
+ l.current[p] = h;
1167
1167
  },
1168
1168
  className: ["ll-waveform__bar", o].filter(Boolean).join(" "),
1169
1169
  style: { height: `${i}px` }
@@ -1175,12 +1175,12 @@ const ei = ({
1175
1175
  isMobile: t,
1176
1176
  agentName: r,
1177
1177
  avatarImageUrl: i,
1178
- agentState: l,
1178
+ agentState: a,
1179
1179
  isMuted: o,
1180
- audioLevel: s,
1181
- onExpand: a,
1182
- onToggleMute: c,
1183
- onClose: d
1180
+ audioLevel: c,
1181
+ onExpand: l,
1182
+ onToggleMute: s,
1183
+ onClose: u
1184
1184
  }) => t ? /* @__PURE__ */ n(
1185
1185
  "div",
1186
1186
  {
@@ -1192,7 +1192,7 @@ const ei = ({
1192
1192
  {
1193
1193
  type: "button",
1194
1194
  className: "ll-minimized__surface",
1195
- onClick: a,
1195
+ onClick: l,
1196
1196
  "aria-label": `Expand ${r} widget`,
1197
1197
  children: [
1198
1198
  i ? (
@@ -1209,7 +1209,7 @@ const ei = ({
1209
1209
  /* @__PURE__ */ n(
1210
1210
  ti,
1211
1211
  {
1212
- audioLevel: s,
1212
+ audioLevel: c,
1213
1213
  bars: 16,
1214
1214
  maxHeight: 18,
1215
1215
  className: "ll-minimized__waveform"
@@ -1224,10 +1224,10 @@ const ei = ({
1224
1224
  role: "button",
1225
1225
  tabIndex: 0,
1226
1226
  onClick: (b) => {
1227
- b.stopPropagation(), c();
1227
+ b.stopPropagation(), s();
1228
1228
  },
1229
1229
  onKeyDown: (b) => {
1230
- (b.key === "Enter" || b.key === " ") && (b.stopPropagation(), b.preventDefault(), c());
1230
+ (b.key === "Enter" || b.key === " ") && (b.stopPropagation(), b.preventDefault(), s());
1231
1231
  },
1232
1232
  "aria-label": o ? "Unmute microphone" : "Mute microphone",
1233
1233
  children: /* @__PURE__ */ n(gn, { muted: o, className: "ll-minimized__icon" })
@@ -1260,7 +1260,7 @@ const ei = ({
1260
1260
  ) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
1261
1261
  /* @__PURE__ */ k("div", { className: "ll-minimized__meta", children: [
1262
1262
  /* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
1263
- /* @__PURE__ */ n("span", { className: "ll-minimized__state", children: l === "speaking" ? "Speaking" : l === "thinking" ? "Thinking" : "Listening" })
1263
+ /* @__PURE__ */ n("span", { className: "ll-minimized__state", children: a === "speaking" ? "Speaking" : a === "thinking" ? "Thinking" : "Listening" })
1264
1264
  ] }),
1265
1265
  /* @__PURE__ */ k("div", { className: "ll-minimized__controls", children: [
1266
1266
  /* @__PURE__ */ n(
@@ -1268,7 +1268,7 @@ const ei = ({
1268
1268
  {
1269
1269
  type: "button",
1270
1270
  className: "ll-minimized__btn",
1271
- onClick: c,
1271
+ onClick: s,
1272
1272
  "aria-label": o ? "Unmute microphone" : "Mute microphone",
1273
1273
  children: /* @__PURE__ */ n(gn, { muted: o, className: "ll-minimized__icon" })
1274
1274
  }
@@ -1278,7 +1278,7 @@ const ei = ({
1278
1278
  {
1279
1279
  type: "button",
1280
1280
  className: "ll-minimized__btn",
1281
- onClick: a,
1281
+ onClick: l,
1282
1282
  "aria-label": `Expand ${r} widget`,
1283
1283
  children: /* @__PURE__ */ n(yn, { className: "ll-minimized__icon" })
1284
1284
  }
@@ -1288,7 +1288,7 @@ const ei = ({
1288
1288
  {
1289
1289
  type: "button",
1290
1290
  className: "ll-minimized__btn ll-minimized__btn--close",
1291
- onClick: d,
1291
+ onClick: u,
1292
1292
  "aria-label": "Close widget",
1293
1293
  children: /* @__PURE__ */ n(Xr, { className: "ll-minimized__icon" })
1294
1294
  }
@@ -1301,13 +1301,13 @@ const ei = ({
1301
1301
  alt: t,
1302
1302
  preCannedPlaying: r = !1,
1303
1303
  className: i,
1304
- style: l
1304
+ style: a
1305
1305
  }) => {
1306
- const [o, s] = M(!1), a = I(e);
1306
+ const [o, c] = M(!1), l = I(e);
1307
1307
  if (T(() => {
1308
- a.current !== e && (a.current = e, s(!1));
1308
+ l.current !== e && (l.current = e, c(!1));
1309
1309
  }, [e]), !e) return null;
1310
- const c = {
1310
+ const s = {
1311
1311
  position: "absolute",
1312
1312
  inset: 0,
1313
1313
  width: "100%",
@@ -1317,7 +1317,7 @@ const ei = ({
1317
1317
  transition: "opacity 500ms ease, transform 500ms ease",
1318
1318
  transform: r ? "scale(1.02)" : "scale(1)",
1319
1319
  opacity: o ? 1 : 0,
1320
- ...l
1320
+ ...a
1321
1321
  };
1322
1322
  return (
1323
1323
  // eslint-disable-next-line @next/next/no-img-element
@@ -1327,10 +1327,10 @@ const ei = ({
1327
1327
  src: e,
1328
1328
  alt: t,
1329
1329
  className: i,
1330
- style: c,
1330
+ style: s,
1331
1331
  loading: "eager",
1332
1332
  fetchPriority: "high",
1333
- onLoad: () => s(!0)
1333
+ onLoad: () => c(!0)
1334
1334
  }
1335
1335
  )
1336
1336
  );
@@ -1382,40 +1382,40 @@ const li = 8, _n = 8, ai = ({
1382
1382
  anchorRef: r,
1383
1383
  children: i
1384
1384
  }) => {
1385
- const l = I(null), [o, s] = M(null);
1385
+ const a = I(null), [o, c] = M(null);
1386
1386
  return Tn(() => {
1387
1387
  if (!e) {
1388
- s(null);
1388
+ c(null);
1389
1389
  return;
1390
1390
  }
1391
- const a = r.current;
1392
- if (!a) return;
1393
- const c = () => {
1394
- const d = a.getBoundingClientRect(), b = {
1395
- top: d.top - li,
1396
- left: d.left + d.width / 2
1391
+ const l = r.current;
1392
+ if (!l) return;
1393
+ const s = () => {
1394
+ const u = l.getBoundingClientRect(), b = {
1395
+ top: u.top - li,
1396
+ left: u.left + u.width / 2
1397
1397
  }, p = _n + 90, h = window.innerWidth - _n - 90;
1398
- b.left < p && (b.left = p), b.left > h && (b.left = h), s(b);
1398
+ b.left < p && (b.left = p), b.left > h && (b.left = h), c(b);
1399
1399
  };
1400
- return c(), window.addEventListener("scroll", c, !0), window.addEventListener("resize", c), () => {
1401
- window.removeEventListener("scroll", c, !0), window.removeEventListener("resize", c);
1400
+ return s(), window.addEventListener("scroll", s, !0), window.addEventListener("resize", s), () => {
1401
+ window.removeEventListener("scroll", s, !0), window.removeEventListener("resize", s);
1402
1402
  };
1403
1403
  }, [e, r]), T(() => {
1404
1404
  if (!e) return;
1405
- const a = (d) => {
1406
- const b = d.target, p = l.current, h = r.current;
1405
+ const l = (u) => {
1406
+ const b = u.target, p = a.current, h = r.current;
1407
1407
  p && p.contains(b) || h && h.contains(b) || t();
1408
- }, c = (d) => {
1409
- d.key === "Escape" && (d.stopPropagation(), t());
1408
+ }, s = (u) => {
1409
+ u.key === "Escape" && (u.stopPropagation(), t());
1410
1410
  };
1411
- return document.addEventListener("mousedown", a), document.addEventListener("keydown", c), () => {
1412
- document.removeEventListener("mousedown", a), document.removeEventListener("keydown", c);
1411
+ return document.addEventListener("mousedown", l), document.addEventListener("keydown", s), () => {
1412
+ document.removeEventListener("mousedown", l), document.removeEventListener("keydown", s);
1413
1413
  };
1414
1414
  }, [e, t, r]), !e || o === null || typeof document > "u" ? null : Vt(
1415
1415
  /* @__PURE__ */ n(
1416
1416
  "div",
1417
1417
  {
1418
- ref: l,
1418
+ ref: a,
1419
1419
  className: "ll-overflow-popover",
1420
1420
  role: "menu",
1421
1421
  style: {
@@ -1436,12 +1436,12 @@ const li = 8, _n = 8, ai = ({
1436
1436
  onToggleMute: t,
1437
1437
  isCameraEnabled: r,
1438
1438
  onToggleCamera: i,
1439
- allowCamera: l,
1439
+ allowCamera: a,
1440
1440
  isScreenShareEnabled: o,
1441
- onToggleScreenShare: s,
1442
- allowScreenShare: a,
1443
- isSpeakerMuted: c,
1444
- onToggleSpeaker: d,
1441
+ onToggleScreenShare: c,
1442
+ allowScreenShare: l,
1443
+ isSpeakerMuted: s,
1444
+ onToggleSpeaker: u,
1445
1445
  allowTyping: b,
1446
1446
  isTypingOpen: p,
1447
1447
  onToggleTyping: h,
@@ -1499,7 +1499,7 @@ const li = 8, _n = 8, ai = ({
1499
1499
  onClose: () => E(!1),
1500
1500
  anchorRef: g,
1501
1501
  children: [
1502
- l && /* @__PURE__ */ k(
1502
+ a && /* @__PURE__ */ k(
1503
1503
  "button",
1504
1504
  {
1505
1505
  type: "button",
@@ -1513,13 +1513,13 @@ const li = 8, _n = 8, ai = ({
1513
1513
  ]
1514
1514
  }
1515
1515
  ),
1516
- a && /* @__PURE__ */ k(
1516
+ l && /* @__PURE__ */ k(
1517
1517
  "button",
1518
1518
  {
1519
1519
  type: "button",
1520
1520
  className: `ll-overflow-popover__item ${o ? "is-on" : ""}`,
1521
1521
  onClick: () => {
1522
- s(), E(!1);
1522
+ c(), E(!1);
1523
1523
  },
1524
1524
  children: [
1525
1525
  /* @__PURE__ */ n(Hn, {}),
@@ -1531,13 +1531,13 @@ const li = 8, _n = 8, ai = ({
1531
1531
  "button",
1532
1532
  {
1533
1533
  type: "button",
1534
- className: `ll-overflow-popover__item ${c ? "is-on" : ""}`,
1534
+ className: `ll-overflow-popover__item ${s ? "is-on" : ""}`,
1535
1535
  onClick: () => {
1536
- d(), E(!1);
1536
+ u(), E(!1);
1537
1537
  },
1538
1538
  children: [
1539
- /* @__PURE__ */ n(Wn, { muted: c }),
1540
- /* @__PURE__ */ n("span", { children: c ? "Unmute speaker" : "Mute speaker" })
1539
+ /* @__PURE__ */ n(Wn, { muted: s }),
1540
+ /* @__PURE__ */ n("span", { children: s ? "Unmute speaker" : "Mute speaker" })
1541
1541
  ]
1542
1542
  }
1543
1543
  ),
@@ -1612,12 +1612,12 @@ const di = ({
1612
1612
  isMobile: t,
1613
1613
  agentName: r,
1614
1614
  avatarImageUrl: i,
1615
- idleLoopUrl: l,
1615
+ idleLoopUrl: a,
1616
1616
  greeting: o,
1617
- branding: s,
1618
- teamMembers: a,
1619
- currentTeamMemberId: c,
1620
- isSwitchingTeamMember: d,
1617
+ branding: c,
1618
+ teamMembers: l,
1619
+ currentTeamMemberId: s,
1620
+ isSwitchingTeamMember: u,
1621
1621
  teamSwitcherOpen: b,
1622
1622
  onToggleTeamSwitcher: p,
1623
1623
  onSelectTeamMember: h,
@@ -1669,7 +1669,7 @@ const di = ({
1669
1669
  resizeHandleProps: F
1670
1670
  }) => {
1671
1671
  var at;
1672
- const $e = ((a == null ? void 0 : a.length) ?? 0) > 1, Ue = E === "connecting" || E === "connected", we = E === "connected", gt = E === "idle" || E === "disconnected" || E === "error", [He, Ne] = M(!1);
1672
+ const $e = ((l == null ? void 0 : l.length) ?? 0) > 1, Ue = E === "connecting" || E === "connected", we = E === "connected", gt = E === "idle" || E === "disconnected" || E === "error", [He, Ne] = M(!1);
1673
1673
  T(() => {
1674
1674
  if (!ne) {
1675
1675
  Ne(!1);
@@ -1725,7 +1725,7 @@ const di = ({
1725
1725
  re && (Te(re), It(""));
1726
1726
  },
1727
1727
  [ot, Te]
1728
- ), Me = s.productName || "Live Layer", Se = !s.productName;
1728
+ ), Me = c.productName || "Live Layer", Se = !c.productName;
1729
1729
  let ye = null, xe = null;
1730
1730
  for (let _ = w.length - 1; _ >= 0; _--) {
1731
1731
  const re = w[_];
@@ -1753,11 +1753,11 @@ const di = ({
1753
1753
  className: "ll-expanded__bg-img"
1754
1754
  }
1755
1755
  ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((at = r == null ? void 0 : r.charAt(0)) == null ? void 0 : at.toUpperCase()) || "A" }) }),
1756
- l && !we && /* @__PURE__ */ n(
1756
+ a && !we && /* @__PURE__ */ n(
1757
1757
  "video",
1758
1758
  {
1759
1759
  className: "ll-expanded__bg-idle",
1760
- src: l,
1760
+ src: a,
1761
1761
  autoPlay: !0,
1762
1762
  loop: !0,
1763
1763
  muted: !0,
@@ -1768,7 +1768,7 @@ const di = ({
1768
1768
  /* @__PURE__ */ n("div", { ref: be, className: "ll-expanded__video" }),
1769
1769
  Oe && /* @__PURE__ */ k("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1770
1770
  /* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
1771
- /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: d ? "Switching..." : "Connecting..." })
1771
+ /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: u ? "Switching..." : "Connecting..." })
1772
1772
  ] }),
1773
1773
  S && we && /* @__PURE__ */ k(
1774
1774
  "button",
@@ -1821,14 +1821,14 @@ const di = ({
1821
1821
  className: "ll-hmenu",
1822
1822
  onClick: (_) => _.stopPropagation(),
1823
1823
  role: "listbox",
1824
- children: a == null ? void 0 : a.map((_) => /* @__PURE__ */ k(
1824
+ children: l == null ? void 0 : l.map((_) => /* @__PURE__ */ k(
1825
1825
  "button",
1826
1826
  {
1827
1827
  type: "button",
1828
- className: `ll-hmenu__item ${_.id === c ? "is-active" : ""}`,
1828
+ className: `ll-hmenu__item ${_.id === s ? "is-active" : ""}`,
1829
1829
  onClick: () => h(_.id),
1830
1830
  role: "option",
1831
- "aria-selected": _.id === c,
1831
+ "aria-selected": _.id === s,
1832
1832
  children: [
1833
1833
  _.avatarImageUrl && /* @__PURE__ */ n(
1834
1834
  "img",
@@ -2306,28 +2306,28 @@ const Cn = ({
2306
2306
  devices: t,
2307
2307
  activeId: r,
2308
2308
  onPick: i,
2309
- anchorRef: l
2309
+ anchorRef: a
2310
2310
  }) => {
2311
- const [o, s] = M(null);
2311
+ const [o, c] = M(null);
2312
2312
  return Tn(() => {
2313
- const a = () => {
2314
- const c = l.current;
2315
- if (!c) return;
2316
- const d = c.getBoundingClientRect(), b = 126, p = window.innerWidth - 16 - 110, h = d.left + d.width / 2;
2317
- s({
2318
- top: d.top - 8,
2313
+ const l = () => {
2314
+ const s = a.current;
2315
+ if (!s) return;
2316
+ const u = s.getBoundingClientRect(), b = 126, p = window.innerWidth - 16 - 110, h = u.left + u.width / 2;
2317
+ c({
2318
+ top: u.top - 8,
2319
2319
  left: Math.max(b, Math.min(p, h))
2320
2320
  });
2321
2321
  };
2322
- return a(), window.addEventListener("scroll", a, !0), window.addEventListener("resize", a), () => {
2323
- window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", a);
2322
+ return l(), window.addEventListener("scroll", l, !0), window.addEventListener("resize", l), () => {
2323
+ window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", l);
2324
2324
  };
2325
- }, [l]), o === null || typeof document > "u" ? null : Vt(
2325
+ }, [a]), o === null || typeof document > "u" ? null : Vt(
2326
2326
  /* @__PURE__ */ k(
2327
2327
  "div",
2328
2328
  {
2329
2329
  className: "ll-device-menu ll-device-menu--floating",
2330
- onClick: (a) => a.stopPropagation(),
2330
+ onClick: (l) => l.stopPropagation(),
2331
2331
  role: "listbox",
2332
2332
  style: {
2333
2333
  position: "fixed",
@@ -2338,22 +2338,22 @@ const Cn = ({
2338
2338
  },
2339
2339
  children: [
2340
2340
  /* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
2341
- t.map((a, c) => {
2342
- const d = r === a.deviceId;
2341
+ t.map((l, s) => {
2342
+ const u = r === l.deviceId;
2343
2343
  return /* @__PURE__ */ k(
2344
2344
  "button",
2345
2345
  {
2346
2346
  type: "button",
2347
- className: `ll-device-menu__item ${d ? "is-active" : ""}`,
2348
- onClick: () => i(a.deviceId),
2347
+ className: `ll-device-menu__item ${u ? "is-active" : ""}`,
2348
+ onClick: () => i(l.deviceId),
2349
2349
  role: "option",
2350
- "aria-selected": d,
2350
+ "aria-selected": u,
2351
2351
  children: [
2352
- d && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
2353
- /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: a.label || `${e} ${c + 1}` })
2352
+ u && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
2353
+ /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: l.label || `${e} ${s + 1}` })
2354
2354
  ]
2355
2355
  },
2356
- a.deviceId || c
2356
+ l.deviceId || s
2357
2357
  );
2358
2358
  })
2359
2359
  ]
@@ -2415,29 +2415,29 @@ function ft(e) {
2415
2415
  function Sn(e) {
2416
2416
  const t = e.getAttribute("id");
2417
2417
  if (t) {
2418
- const o = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(t) : t.replace(/"/g, '\\"'), s = document.querySelector(`label[for="${o}"]`);
2419
- if (s != null && s.textContent) return s.textContent.trim();
2418
+ const o = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(t) : t.replace(/"/g, '\\"'), c = document.querySelector(`label[for="${o}"]`);
2419
+ if (c != null && c.textContent) return c.textContent.trim();
2420
2420
  }
2421
2421
  const r = e.getAttribute("aria-label");
2422
2422
  if (r) return r.trim();
2423
2423
  const i = e.closest("label");
2424
2424
  if (i) {
2425
2425
  const o = [];
2426
- for (const a of Array.from(i.childNodes))
2427
- if (a.nodeType === Node.TEXT_NODE) {
2428
- const c = (a.textContent || "").trim();
2429
- c && o.push(c);
2430
- } else if (a instanceof HTMLElement) {
2431
- if (a instanceof HTMLInputElement || a instanceof HTMLTextAreaElement || a instanceof HTMLSelectElement || a instanceof HTMLButtonElement)
2426
+ for (const l of Array.from(i.childNodes))
2427
+ if (l.nodeType === Node.TEXT_NODE) {
2428
+ const s = (l.textContent || "").trim();
2429
+ s && o.push(s);
2430
+ } else if (l instanceof HTMLElement) {
2431
+ if (l instanceof HTMLInputElement || l instanceof HTMLTextAreaElement || l instanceof HTMLSelectElement || l instanceof HTMLButtonElement)
2432
2432
  continue;
2433
- const c = (a.textContent || "").trim();
2434
- c && o.push(c);
2433
+ const s = (l.textContent || "").trim();
2434
+ s && o.push(s);
2435
2435
  }
2436
- const s = o.join(" ").trim();
2437
- if (s) return s;
2436
+ const c = o.join(" ").trim();
2437
+ if (c) return c;
2438
2438
  }
2439
- const l = e.getAttribute("placeholder");
2440
- return l ? l.trim() : "";
2439
+ const a = e.getAttribute("placeholder");
2440
+ return a ? a.trim() : "";
2441
2441
  }
2442
2442
  function fe(e, t) {
2443
2443
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
@@ -2461,12 +2461,12 @@ function xi(e) {
2461
2461
  if (o && o.length < 60 && !/^(submit|ok|continue)$/i.test(o))
2462
2462
  return o;
2463
2463
  }
2464
- let l = e.parentElement;
2465
- for (let o = 0; l && o < 4; o++, l = l.parentElement) {
2466
- const s = l.querySelector("h1, h2, h3, h4");
2467
- if (s != null && s.textContent) {
2468
- const a = s.textContent.trim();
2469
- if (a && a.length < 80) return a;
2464
+ let a = e.parentElement;
2465
+ for (let o = 0; a && o < 4; o++, a = a.parentElement) {
2466
+ const c = a.querySelector("h1, h2, h3, h4");
2467
+ if (c != null && c.textContent) {
2468
+ const l = c.textContent.trim();
2469
+ if (l && l.length < 80) return l;
2470
2470
  }
2471
2471
  }
2472
2472
  return null;
@@ -2488,33 +2488,33 @@ function Li(e, t = {}) {
2488
2488
  forms: [],
2489
2489
  extras: e
2490
2490
  };
2491
- const i = typeof window < "u" && window.location.href || "", l = typeof window < "u" && window.location.pathname || "/", o = r.title || "", s = Array.from(
2491
+ const i = typeof window < "u" && window.location.href || "", a = typeof window < "u" && window.location.pathname || "/", o = r.title || "", c = Array.from(
2492
2492
  r.querySelectorAll("[data-ll-region]")
2493
- ), a = [];
2494
- for (const m of s) {
2495
- if (a.length >= gi) break;
2493
+ ), l = [];
2494
+ for (const m of c) {
2495
+ if (l.length >= gi) break;
2496
2496
  if (dt(m) || !ft(m)) continue;
2497
2497
  const D = m.getAttribute("data-ll-region") ?? "", W = m.getAttribute("data-ll-intent") ?? void 0, K = fe(
2498
2498
  (m.innerText || m.textContent || "").trim(),
2499
2499
  kn * 2
2500
2500
  );
2501
- !D || !K || a.push({ id: D, intent: W, text: K });
2501
+ !D || !K || l.push({ id: D, intent: W, text: K });
2502
2502
  }
2503
- const c = [], d = ["H1", "H2", "H3", "H4", "H5", "H6"], b = Array.from(
2503
+ const s = [], u = ["H1", "H2", "H3", "H4", "H5", "H6"], b = Array.from(
2504
2504
  r.querySelectorAll("h1, h2, h3, h4, h5, h6")
2505
2505
  );
2506
2506
  for (const m of b) {
2507
2507
  if (dt(m) || !ft(m)) continue;
2508
2508
  const D = (m.textContent || "").trim();
2509
- D && c.push(`${m.tagName}: ${fe(D, 200)}`);
2509
+ D && s.push(`${m.tagName}: ${fe(D, 200)}`);
2510
2510
  }
2511
2511
  const p = Array.from(r.querySelectorAll("p, li"));
2512
2512
  for (const m of p) {
2513
- if (dt(m) || !ft(m) || d.includes(m.tagName)) continue;
2513
+ if (dt(m) || !ft(m) || u.includes(m.tagName)) continue;
2514
2514
  const D = (m.textContent || "").trim();
2515
- D.length > 10 && c.push(fe(D, kn));
2515
+ D.length > 10 && s.push(fe(D, kn));
2516
2516
  }
2517
- const h = c.join(`
2517
+ const h = s.join(`
2518
2518
  `), P = [], x = Array.from(r.querySelectorAll("a[href]"));
2519
2519
  for (const m of x) {
2520
2520
  if (P.length >= hi) break;
@@ -2604,8 +2604,8 @@ function Li(e, t = {}) {
2604
2604
  const y = {
2605
2605
  url: i,
2606
2606
  title: o,
2607
- pathname: l,
2608
- regions: a,
2607
+ pathname: a,
2608
+ regions: l,
2609
2609
  visibleText: h,
2610
2610
  visibleLinks: P,
2611
2611
  visibleFields: E,
@@ -2621,11 +2621,11 @@ function Li(e, t = {}) {
2621
2621
  }
2622
2622
  let Ze = null;
2623
2623
  function En(e, t = {}) {
2624
- const r = Date.now(), l = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
2625
- if (Ze && Ze.key === l && r - Ze.at < 1e3)
2624
+ const r = Date.now(), a = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
2625
+ if (Ze && Ze.key === a && r - Ze.at < 1e3)
2626
2626
  return Ze.ctx;
2627
2627
  const o = Li(e, t);
2628
- return Ze = { key: l, at: r, ctx: o }, o;
2628
+ return Ze = { key: a, at: r, ctx: o }, o;
2629
2629
  }
2630
2630
  function Ci() {
2631
2631
  Ze = null;
@@ -2647,27 +2647,27 @@ function Ei(e) {
2647
2647
  function Ni(e) {
2648
2648
  const t = e ?? (typeof document < "u" ? document : null);
2649
2649
  if (!t) return [];
2650
- const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), l = [], o = Array.from(t.querySelectorAll("a[href]"));
2651
- for (const s of o) {
2652
- if (l.length >= ki) break;
2653
- if (Yt(s)) continue;
2654
- const a = s.getAttribute("href") || "";
2655
- if (!Ei(a)) continue;
2656
- let c = a, d = !0;
2650
+ const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), a = [], o = Array.from(t.querySelectorAll("a[href]"));
2651
+ for (const c of o) {
2652
+ if (a.length >= ki) break;
2653
+ if (Yt(c)) continue;
2654
+ const l = c.getAttribute("href") || "";
2655
+ if (!Ei(l)) continue;
2656
+ let s = l, u = !0;
2657
2657
  try {
2658
2658
  if (typeof window < "u") {
2659
- const p = new URL(a, r);
2660
- d = p.origin === r, d && a.startsWith("http") && (c = p.pathname + p.search + p.hash);
2659
+ const p = new URL(l, r);
2660
+ u = p.origin === r, u && l.startsWith("http") && (s = p.pathname + p.search + p.hash);
2661
2661
  }
2662
2662
  } catch {
2663
2663
  continue;
2664
2664
  }
2665
- if (i.has(c)) continue;
2666
- i.add(c);
2667
- const b = (s.textContent || "").trim().slice(0, 120);
2668
- l.push({ href: c, text: b, internal: d });
2665
+ if (i.has(s)) continue;
2666
+ i.add(s);
2667
+ const b = (c.textContent || "").trim().slice(0, 120);
2668
+ a.push({ href: s, text: b, internal: u });
2669
2669
  }
2670
- return l;
2670
+ return a;
2671
2671
  }
2672
2672
  let Qe = null;
2673
2673
  const Ai = 5e3;
@@ -2705,13 +2705,13 @@ function Ri(e, t) {
2705
2705
  e.querySelectorAll("input, textarea, select")
2706
2706
  );
2707
2707
  let i = 0;
2708
- const l = /* @__PURE__ */ new Map();
2708
+ const a = /* @__PURE__ */ new Map();
2709
2709
  for (const o of r) {
2710
2710
  if (!Nn(o)) continue;
2711
- const s = Ii(o, i);
2712
- let a = s;
2713
- if (l.has(s) && (a = `${s}__${i}`), a === t) return o;
2714
- l.set(s, o), i++;
2711
+ const c = Ii(o, i);
2712
+ let l = c;
2713
+ if (a.has(c) && (l = `${c}__${i}`), l === t) return o;
2714
+ a.set(c, o), i++;
2715
2715
  }
2716
2716
  return null;
2717
2717
  }
@@ -2720,54 +2720,56 @@ function An(e, t) {
2720
2720
  return r ? Ut(r) ? { el: r } : { el: null, reason: "private" } : { el: null, reason: "not_found" };
2721
2721
  }
2722
2722
  function Ti(e, t) {
2723
- const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, i = Object.getOwnPropertyDescriptor(r, "value"), l = i == null ? void 0 : i.set;
2724
- l ? l.call(e, t) : e.value = t;
2723
+ const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, i = Object.getOwnPropertyDescriptor(r, "value"), a = i == null ? void 0 : i.set;
2724
+ a ? a.call(e, t) : e.value = t;
2725
2725
  }
2726
2726
  function Pi(e, t, r = {}) {
2727
- const i = r.triggerInput ?? !0, l = r.triggerChange ?? !0;
2727
+ const i = r.triggerInput ?? !0, a = r.triggerChange ?? !0;
2728
2728
  if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
2729
2729
  const o = Object.getOwnPropertyDescriptor(
2730
2730
  HTMLInputElement.prototype,
2731
2731
  "checked"
2732
- ), s = o == null ? void 0 : o.set, a = t === "true" || t === "1" || t === "on";
2733
- s ? s.call(e, a) : e.checked = a, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), l && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2732
+ ), c = o == null ? void 0 : o.set, l = t === "true" || t === "1" || t === "on";
2733
+ c ? c.call(e, l) : e.checked = l, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), a && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2734
2734
  return;
2735
2735
  }
2736
- Ti(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), l && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2736
+ Ti(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), a && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2737
2737
  }
2738
2738
  function Mn(e, t) {
2739
2739
  if (!t) return null;
2740
- const r = t.replace(/"/g, '\\"');
2740
+ const r = t.replace(/"/g, '\\"'), i = (l) => l.closest('[data-ll-private="true"], [data-ll-skip], .ll-widget') !== null;
2741
2741
  try {
2742
- const s = e.querySelector(
2742
+ const l = e.querySelector(
2743
2743
  `form#${CSS.escape(t)}`
2744
2744
  );
2745
- if (s) return s;
2745
+ if (l && !i(l)) return l;
2746
2746
  } catch {
2747
2747
  }
2748
- const i = e.querySelector(
2748
+ const a = e.querySelector(
2749
2749
  `form[name="${r}"]`
2750
2750
  );
2751
- if (i) return i;
2752
- const l = e.querySelector(
2751
+ if (a && !i(a)) return a;
2752
+ const o = e.querySelector(
2753
2753
  `form[data-ll-intent="${r}"]`
2754
2754
  );
2755
- if (l) return l;
2756
- const o = Array.from(e.querySelectorAll("form"));
2757
- for (const s of o) {
2758
- const a = s.getAttribute("data-ll-intent");
2759
- if (a && Di(a) === t) return s;
2755
+ if (o && !i(o)) return o;
2756
+ const c = Array.from(
2757
+ e.querySelectorAll("form")
2758
+ ).filter((l) => !i(l));
2759
+ for (const l of c) {
2760
+ const s = l.getAttribute("data-ll-intent");
2761
+ if (s && Di(s) === t) return l;
2760
2762
  }
2761
2763
  if (/^form_\d+$/.test(t)) {
2762
- const s = parseInt(t.slice(5), 10);
2763
- let a = 0;
2764
- for (const c of o)
2765
- if (!(c.id || c.getAttribute("name") || c.getAttribute("data-ll-intent"))) {
2766
- if (a === s) return c;
2767
- a++;
2764
+ const l = parseInt(t.slice(5), 10);
2765
+ let s = 0;
2766
+ for (const u of c)
2767
+ if (!(u.id || u.getAttribute("name") || u.getAttribute("data-ll-intent"))) {
2768
+ if (s === l) return u;
2769
+ s++;
2768
2770
  }
2769
2771
  }
2770
- return null;
2772
+ return c.length === 1 ? c[0] : null;
2771
2773
  }
2772
2774
  function Di(e) {
2773
2775
  return e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || null;
@@ -2793,9 +2795,9 @@ function Hi() {
2793
2795
  let t = null, r = 0;
2794
2796
  for (const i of e) {
2795
2797
  if (!$i(i)) continue;
2796
- const l = i.getBoundingClientRect();
2797
- if (l.bottom <= 0 || l.top >= window.innerHeight || l.right <= 0 || l.left >= window.innerWidth || l.width <= 0 || l.height <= 0 || i.closest(".ll-widget")) continue;
2798
- const o = l.width * l.height;
2798
+ const a = i.getBoundingClientRect();
2799
+ if (a.bottom <= 0 || a.top >= window.innerHeight || a.right <= 0 || a.left >= window.innerWidth || a.width <= 0 || a.height <= 0 || i.closest(".ll-widget")) continue;
2800
+ const o = a.width * a.height;
2799
2801
  o > r && (r = o, t = i);
2800
2802
  }
2801
2803
  return t;
@@ -2852,12 +2854,12 @@ const Wi = /* @__PURE__ */ new Set([
2852
2854
  var on, ln, an, sn, cn, un, dn;
2853
2855
  const {
2854
2856
  agentId: i,
2855
- apiKey: l,
2857
+ apiKey: a,
2856
2858
  baseUrl: o = "https://app.livelayer.studio",
2857
- sessionEndpoint: s,
2858
- sessionBody: a,
2859
- soundEffects: c,
2860
- experienceMode: d = "WIDGET",
2859
+ sessionEndpoint: c,
2860
+ sessionBody: l,
2861
+ soundEffects: s,
2862
+ experienceMode: u = "WIDGET",
2861
2863
  autoConnect: b = !1,
2862
2864
  displayMode: p,
2863
2865
  // Initial display mode. Mobile gets a smaller card layout (not the
@@ -2927,7 +2929,7 @@ const Wi = /* @__PURE__ */ new Set([
2927
2929
  }), Oe = Ne ? O : Nt, ue = et(
2928
2930
  () => (y == null ? void 0 : y.find((v) => v.id === Oe)) ?? null,
2929
2931
  [y, Oe]
2930
- ), it = (ue == null ? void 0 : ue.agentId) ?? i, le = d === "EMBEDDED", pe = Ir(E), [je, Ve] = Ar({
2932
+ ), it = (ue == null ? void 0 : ue.agentId) ?? i, le = u === "EMBEDDED", pe = Ir(E), [je, Ve] = Ar({
2931
2933
  value: p,
2932
2934
  defaultValue: h,
2933
2935
  onChange: P,
@@ -2939,30 +2941,30 @@ const Wi = /* @__PURE__ */ new Set([
2939
2941
  resizable: !le && (w ?? !pe),
2940
2942
  persistKey: R,
2941
2943
  disablePersistence: le || S
2942
- }), Me = yr(), Se = _r(), ye = xr(), xe = Lr(), [bt, Ye] = M(!1), [lt, at] = M(!1), [_, re] = M(!1), [Un, jn] = M(!1), [Rt, Vn] = M(!1), wt = Gr({ baseUrl: o, config: c }), _t = I(wt);
2944
+ }), Me = yr(), Se = _r(), ye = xr(), xe = Lr(), [bt, Ye] = M(!1), [lt, at] = M(!1), [_, re] = M(!1), [Un, jn] = M(!1), [Rt, Vn] = M(!1), wt = Gr({ baseUrl: o, config: s }), _t = I(wt);
2943
2945
  _t.current = wt;
2944
2946
  const Tt = I(ne), Pt = I(tt), Dt = I(rt), zt = I(mt), Gt = I(nt), Xt = I(pt), Kt = I(ht), $t = I(We), Le = I(null);
2945
2947
  Tt.current = ne, Pt.current = tt, Dt.current = rt, zt.current = mt, Gt.current = nt, Xt.current = pt, Kt.current = ht, $t.current = We;
2946
2948
  function Ce(v) {
2947
- const u = $t.current;
2948
- return u ? u.includes(v) : !0;
2949
+ const d = $t.current;
2950
+ return d ? d.includes(v) : !0;
2949
2951
  }
2950
- function ke(v, u) {
2952
+ function ke(v, d) {
2951
2953
  console.warn(
2952
- `[LiveLayer] Agent command "${v}" blocked — capability "${u}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
2954
+ `[LiveLayer] Agent command "${v}" blocked — capability "${d}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
2953
2955
  );
2954
2956
  }
2955
2957
  const st = C(
2956
2958
  (v) => {
2957
2959
  var ie, de, Ee, ut;
2958
- const u = v;
2959
- if (!(!u.type || typeof u.type != "string")) {
2960
- if (De == null || De({ eventName: u.type, data: v }), u.type === "navigate") {
2960
+ const d = v;
2961
+ if (!(!d.type || typeof d.type != "string")) {
2962
+ if (De == null || De({ eventName: d.type, data: v }), d.type === "navigate") {
2961
2963
  if (!Ce("navigate")) {
2962
2964
  ke("navigate", "navigate");
2963
2965
  return;
2964
2966
  }
2965
- const A = typeof u.href == "string" ? u.href : null;
2967
+ const A = typeof d.href == "string" ? d.href : null;
2966
2968
  if (!A) {
2967
2969
  console.warn(
2968
2970
  `[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
@@ -3000,14 +3002,14 @@ const Wi = /* @__PURE__ */ new Set([
3000
3002
  }
3001
3003
  return;
3002
3004
  }
3003
- if (u.type === "scroll_to") {
3005
+ if (d.type === "scroll_to") {
3004
3006
  if (!Ce("scroll")) {
3005
3007
  ke("scroll_to", "scroll");
3006
3008
  return;
3007
3009
  }
3008
- const A = typeof u.selector == "string" ? u.selector : null;
3010
+ const A = typeof d.selector == "string" ? d.selector : null;
3009
3011
  if (!A) return;
3010
- const H = u.behavior === "instant" ? "instant" : "smooth";
3012
+ const H = d.behavior === "instant" ? "instant" : "smooth";
3011
3013
  if (Pt.current) {
3012
3014
  try {
3013
3015
  Pt.current(
@@ -3042,12 +3044,12 @@ const Wi = /* @__PURE__ */ new Set([
3042
3044
  }
3043
3045
  return;
3044
3046
  }
3045
- if (u.type === "request_page_context") {
3047
+ if (d.type === "request_page_context") {
3046
3048
  if (!Ce("read_page")) {
3047
3049
  ke("request_page_context", "read_page");
3048
3050
  return;
3049
3051
  }
3050
- const A = typeof u.requestId == "string" ? u.requestId : void 0, H = (ie = Le.current) == null ? void 0 : ie.call(Le), Y = (Z) => {
3052
+ const A = typeof d.requestId == "string" ? d.requestId : void 0, H = (ie = Le.current) == null ? void 0 : ie.call(Le), Y = (Z) => {
3051
3053
  const B = H, ce = B == null ? void 0 : B.localParticipant;
3052
3054
  if (ce != null && ce.publishData)
3053
3055
  try {
@@ -3090,19 +3092,19 @@ const Wi = /* @__PURE__ */ new Set([
3090
3092
  }
3091
3093
  return;
3092
3094
  }
3093
- if (u.type === "scroll_page") {
3095
+ if (d.type === "scroll_page") {
3094
3096
  if (!Ce("scroll")) {
3095
3097
  ke("scroll_page", "scroll");
3096
3098
  return;
3097
3099
  }
3098
- const A = u.direction;
3100
+ const A = d.direction;
3099
3101
  if (A !== "up" && A !== "down" && A !== "top" && A !== "bottom") {
3100
3102
  console.warn(
3101
3103
  `[LiveLayer] scroll_page: invalid direction "${String(A)}". Expected up | down | top | bottom.`
3102
3104
  );
3103
3105
  return;
3104
3106
  }
3105
- const H = u.behavior === "instant" ? "instant" : "smooth";
3107
+ const H = d.behavior === "instant" ? "instant" : "smooth";
3106
3108
  if (Dt.current) {
3107
3109
  try {
3108
3110
  Dt.current(
@@ -3123,12 +3125,12 @@ const Wi = /* @__PURE__ */ new Set([
3123
3125
  A === "up" ? J(-In(j)) : A === "down" ? J(In(j)) : Z(A === "top" ? 0 : Fi(j));
3124
3126
  return;
3125
3127
  }
3126
- if (u.type === "click") {
3128
+ if (d.type === "click") {
3127
3129
  if (!Ce("click")) {
3128
3130
  ke("click", "click");
3129
3131
  return;
3130
3132
  }
3131
- const A = typeof u.selector == "string" ? u.selector : null;
3133
+ const A = typeof d.selector == "string" ? d.selector : null;
3132
3134
  if (!A) {
3133
3135
  console.warn("[LiveLayer] click: missing selector.");
3134
3136
  return;
@@ -3166,33 +3168,33 @@ const Wi = /* @__PURE__ */ new Set([
3166
3168
  (de = H.click) == null || de.call(H);
3167
3169
  return;
3168
3170
  }
3169
- if (u.type === "fill_form" || u.type === "focus_field") {
3171
+ if (d.type === "fill_form" || d.type === "focus_field") {
3170
3172
  if (!Ce("fill_forms")) {
3171
- ke(u.type, "fill_forms");
3173
+ ke(d.type, "fill_forms");
3172
3174
  return;
3173
3175
  }
3174
3176
  if (typeof document > "u") return;
3175
- u.type === "fill_form" && _t.current.playConfirmation();
3176
- const A = typeof u.formId == "string" ? u.formId : null;
3177
+ d.type === "fill_form" && _t.current.playConfirmation();
3178
+ const A = typeof d.formId == "string" ? d.formId : null;
3177
3179
  if (!A) {
3178
- console.warn(`[LiveLayer] ${u.type}: missing formId.`);
3180
+ console.warn(`[LiveLayer] ${d.type}: missing formId.`);
3179
3181
  return;
3180
3182
  }
3181
3183
  const H = Mn(document, A);
3182
3184
  if (!H) {
3183
3185
  console.warn(
3184
- `[LiveLayer] ${u.type}: no <form> matched id="${A}" (or matching name / data-ll-intent slug). Forms are auto-discovered — make sure the form has an \`id\`, \`name\`, or \`data-ll-intent\` attribute the agent observed in PageContext.forms.`
3186
+ `[LiveLayer] ${d.type}: no <form> matched id="${A}" (or matching name / data-ll-intent slug). Forms are auto-discovered — make sure the form has an \`id\`, \`name\`, or \`data-ll-intent\` attribute the agent observed in PageContext.forms.`
3185
3187
  );
3186
3188
  return;
3187
3189
  }
3188
3190
  if (H.closest('[data-ll-private="true"], [data-ll-skip], .ll-widget')) {
3189
3191
  console.warn(
3190
- `[LiveLayer] ${u.type}: refusing to touch a form in a private / opted-out subtree.`
3192
+ `[LiveLayer] ${d.type}: refusing to touch a form in a private / opted-out subtree.`
3191
3193
  );
3192
3194
  return;
3193
3195
  }
3194
- if (u.type === "focus_field") {
3195
- const j = typeof u.fieldName == "string" ? u.fieldName : null;
3196
+ if (d.type === "focus_field") {
3197
+ const j = typeof d.fieldName == "string" ? d.fieldName : null;
3196
3198
  if (!j) {
3197
3199
  console.warn("[LiveLayer] focus_field: missing fieldName.");
3198
3200
  return;
@@ -3209,7 +3211,7 @@ const Wi = /* @__PURE__ */ new Set([
3209
3211
  J.el.focus();
3210
3212
  return;
3211
3213
  }
3212
- const Y = u.values && typeof u.values == "object" ? u.values : null;
3214
+ const Y = d.values && typeof d.values == "object" ? d.values : null;
3213
3215
  if (!Y) {
3214
3216
  console.warn("[LiveLayer] fill_form: missing or invalid values.");
3215
3217
  return;
@@ -3236,13 +3238,13 @@ const Wi = /* @__PURE__ */ new Set([
3236
3238
  }
3237
3239
  return;
3238
3240
  }
3239
- if (u.type === "submit_form") {
3241
+ if (d.type === "submit_form") {
3240
3242
  if (!Ce("submit_forms")) {
3241
3243
  ke("submit_form", "submit_forms");
3242
3244
  return;
3243
3245
  }
3244
3246
  if (typeof document > "u") return;
3245
- const A = typeof u.formId == "string" ? u.formId : null;
3247
+ const A = typeof d.formId == "string" ? d.formId : null;
3246
3248
  if (!A) {
3247
3249
  console.warn("[LiveLayer] submit_form: missing formId.");
3248
3250
  return;
@@ -3261,7 +3263,7 @@ const Wi = /* @__PURE__ */ new Set([
3261
3263
  );
3262
3264
  return;
3263
3265
  }
3264
- const Y = typeof u.requestId == "string" ? u.requestId : void 0, j = (Ee = Le.current) == null ? void 0 : Ee.call(Le), J = (ce) => {
3266
+ const Y = typeof d.requestId == "string" ? d.requestId : void 0, j = (Ee = Le.current) == null ? void 0 : Ee.call(Le), J = (ce) => {
3265
3267
  const he = j, Ke = he == null ? void 0 : he.localParticipant;
3266
3268
  if (Ke != null && Ke.publishData)
3267
3269
  try {
@@ -3294,12 +3296,12 @@ const Wi = /* @__PURE__ */ new Set([
3294
3296
  }, 500);
3295
3297
  return;
3296
3298
  }
3297
- if (u.type === "request_routes") {
3299
+ if (d.type === "request_routes") {
3298
3300
  if (!Ce("read_page")) {
3299
3301
  ke("request_routes", "read_page");
3300
3302
  return;
3301
3303
  }
3302
- const A = typeof u.requestId == "string" ? u.requestId : void 0, Y = (ut = Le.current) == null ? void 0 : ut.call(Le), j = Y == null ? void 0 : Y.localParticipant;
3304
+ const A = typeof d.requestId == "string" ? d.requestId : void 0, Y = (ut = Le.current) == null ? void 0 : ut.call(Le), j = Y == null ? void 0 : Y.localParticipant;
3303
3305
  if (!(j != null && j.publishData)) return;
3304
3306
  const J = (B) => {
3305
3307
  try {
@@ -3339,20 +3341,20 @@ const Wi = /* @__PURE__ */ new Set([
3339
3341
  }
3340
3342
  return;
3341
3343
  }
3342
- if (u.type === "task_field_updated") {
3344
+ if (d.type === "task_field_updated") {
3343
3345
  if (!Ce("collect_data")) {
3344
3346
  ke("task_field_updated", "collect_data");
3345
3347
  return;
3346
3348
  }
3347
3349
  const A = {
3348
3350
  phase: "field",
3349
- fieldId: typeof u.fieldId == "string" ? u.fieldId : "",
3350
- fieldName: typeof u.fieldName == "string" ? u.fieldName : typeof u.fieldId == "string" ? u.fieldId : "",
3351
- value: typeof u.value == "string" ? u.value : "",
3352
- kind: typeof u.kind == "string" ? u.kind : "text",
3353
- source: u.source === "slide" ? "slide" : u.source === "page" ? "page" : "agent",
3354
- ...typeof u.slideId == "string" ? { slideId: u.slideId } : {},
3355
- ...typeof u.formId == "string" ? { formId: u.formId } : {}
3351
+ fieldId: typeof d.fieldId == "string" ? d.fieldId : "",
3352
+ fieldName: typeof d.fieldName == "string" ? d.fieldName : typeof d.fieldId == "string" ? d.fieldId : "",
3353
+ value: typeof d.value == "string" ? d.value : "",
3354
+ kind: typeof d.kind == "string" ? d.kind : "text",
3355
+ source: d.source === "slide" ? "slide" : d.source === "page" ? "page" : "agent",
3356
+ ...typeof d.slideId == "string" ? { slideId: d.slideId } : {},
3357
+ ...typeof d.formId == "string" ? { formId: d.formId } : {}
3356
3358
  };
3357
3359
  if (typeof document < "u")
3358
3360
  try {
@@ -3363,12 +3365,12 @@ const Wi = /* @__PURE__ */ new Set([
3363
3365
  }
3364
3366
  return;
3365
3367
  }
3366
- if (u.type === "task_completed") {
3368
+ if (d.type === "task_completed") {
3367
3369
  if (!Ce("collect_data")) {
3368
3370
  ke("task_completed", "collect_data");
3369
3371
  return;
3370
3372
  }
3371
- const A = u.result;
3373
+ const A = d.result;
3372
3374
  if (!A || typeof A != "object") {
3373
3375
  console.warn(
3374
3376
  "[LiveLayer] task_completed missing `result` payload."
@@ -3393,16 +3395,16 @@ const Wi = /* @__PURE__ */ new Set([
3393
3395
  }
3394
3396
  return;
3395
3397
  }
3396
- Wi.has(u.type) || qe == null || qe(u);
3398
+ Wi.has(d.type) || qe == null || qe(d);
3397
3399
  }
3398
3400
  },
3399
3401
  [qe, De, ze]
3400
3402
  ), se = gr({
3401
3403
  agentId: F ? "__controlled__" : it,
3402
3404
  baseUrl: o,
3403
- apiKey: l,
3404
- sessionEndpoint: s,
3405
- sessionBody: a,
3405
+ apiKey: a,
3406
+ sessionEndpoint: c,
3407
+ sessionBody: l,
3406
3408
  onDataMessage: F ? void 0 : st
3407
3409
  });
3408
3410
  T(() => {
@@ -3465,10 +3467,10 @@ const Wi = /* @__PURE__ */ new Set([
3465
3467
  () => ({
3466
3468
  sendData: async (v) => {
3467
3469
  var Ee, ut;
3468
- const u = Zt.current;
3469
- if (u != null && u.publishData) {
3470
+ const d = Zt.current;
3471
+ if (d != null && d.publishData) {
3470
3472
  try {
3471
- await u.publishData(v);
3473
+ await d.publishData(v);
3472
3474
  } catch (A) {
3473
3475
  console.warn("[AvatarWidget] sendData (controlled) failed:", A);
3474
3476
  }
@@ -3488,10 +3490,10 @@ const Wi = /* @__PURE__ */ new Set([
3488
3490
  );
3489
3491
  const Qt = I(null);
3490
3492
  T(() => {
3491
- const v = L.videoElement, u = Qt.current;
3492
- if (!(!v || !u))
3493
- return u.appendChild(v), () => {
3494
- v.parentNode === u && u.removeChild(v);
3493
+ const v = L.videoElement, d = Qt.current;
3494
+ if (!(!v || !d))
3495
+ return d.appendChild(v), () => {
3496
+ v.parentNode === d && d.removeChild(v);
3495
3497
  };
3496
3498
  }, [L.videoElement]);
3497
3499
  const [Ge, xt] = M(!1);
@@ -3521,13 +3523,13 @@ const Wi = /* @__PURE__ */ new Set([
3521
3523
  }, [z, L.videoElement, Ge]), T(() => {
3522
3524
  const v = L.audioElement;
3523
3525
  if (!v) return;
3524
- const u = document.createElement("div");
3525
- u.className = "ll-audio-sink", u.setAttribute("aria-hidden", "true"), u.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;clip:rect(0 0 0 0);pointer-events:none;", u.appendChild(v), document.body.appendChild(u), Me.attach(v);
3526
+ const d = document.createElement("div");
3527
+ d.className = "ll-audio-sink", d.setAttribute("aria-hidden", "true"), d.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;clip:rect(0 0 0 0);pointer-events:none;", d.appendChild(v), document.body.appendChild(d), Me.attach(v);
3526
3528
  const ie = v.play();
3527
3529
  return ie && typeof ie.catch == "function" && ie.catch((de) => {
3528
3530
  (de == null ? void 0 : de.name) === "NotAllowedError" && Ye(!0);
3529
3531
  }), () => {
3530
- Me.detach(), v.parentNode === u && u.removeChild(v), u.parentNode === document.body && document.body.removeChild(u);
3532
+ Me.detach(), v.parentNode === d && d.removeChild(v), d.parentNode === document.body && document.body.removeChild(d);
3531
3533
  };
3532
3534
  }, [L.audioElement]);
3533
3535
  const ve = br({
@@ -3539,16 +3541,16 @@ const Wi = /* @__PURE__ */ new Set([
3539
3541
  const v = L.getRoom();
3540
3542
  if (v)
3541
3543
  return ve.setupMic(v).then(() => {
3542
- const u = ve.getMicStream();
3543
- u && Me.attachStream(u, "mic");
3544
+ const d = ve.getMicStream();
3545
+ d && Me.attachStream(d, "mic");
3544
3546
  }).catch(() => {
3545
3547
  }), () => {
3546
3548
  Me.detachSlot("mic"), ve.teardownMic();
3547
3549
  };
3548
3550
  }, [L.isControlled, L.connectionState]), T(() => {
3549
- var u;
3551
+ var d;
3550
3552
  if (L.connectionState !== "connected") return;
3551
- const v = L.isControlled ? (u = F == null ? void 0 : F.getRoom) == null ? void 0 : u.call(F) : L.getRoom();
3553
+ const v = L.isControlled ? (d = F == null ? void 0 : F.getRoom) == null ? void 0 : d.call(F) : L.getRoom();
3552
3554
  if (v)
3553
3555
  return Se.attachRoom(v), ye.attachRoom(v), L.isControlled && ve.attachRoom(v), xe.refresh(), () => {
3554
3556
  Se.teardown(), ye.teardown();
@@ -3558,10 +3560,10 @@ const Wi = /* @__PURE__ */ new Set([
3558
3560
  v && (v.muted = Rt);
3559
3561
  }, [L.audioElement, Rt]);
3560
3562
  const Yn = C((v) => {
3561
- const u = { type: "user_message", text: v };
3563
+ const d = { type: "user_message", text: v };
3562
3564
  if (F != null && F.publishData) {
3563
3565
  try {
3564
- F.publishData(u);
3566
+ F.publishData(d);
3565
3567
  } catch {
3566
3568
  }
3567
3569
  return;
@@ -3569,7 +3571,7 @@ const Wi = /* @__PURE__ */ new Set([
3569
3571
  const ie = L.getRoom();
3570
3572
  if (ie)
3571
3573
  try {
3572
- const de = new TextEncoder().encode(JSON.stringify(u));
3574
+ const de = new TextEncoder().encode(JSON.stringify(d));
3573
3575
  ie.localParticipant.publishData(de, { reliable: !0 });
3574
3576
  } catch {
3575
3577
  }
@@ -3591,8 +3593,8 @@ const Wi = /* @__PURE__ */ new Set([
3591
3593
  }, [b, L.connectionState, L, He]);
3592
3594
  const Xn = C(
3593
3595
  (v) => {
3594
- const u = y == null ? void 0 : y.find((ie) => ie.id === v);
3595
- u && (re(!1), v !== Oe && (at(!0), L.disconnect(), Ne || yt(v), m == null || m(u)));
3596
+ const d = y == null ? void 0 : y.find((ie) => ie.id === v);
3597
+ d && (re(!1), v !== Oe && (at(!0), L.disconnect(), Ne || yt(v), m == null || m(d)));
3596
3598
  },
3597
3599
  [
3598
3600
  y,
@@ -3606,8 +3608,8 @@ const Wi = /* @__PURE__ */ new Set([
3606
3608
  lt && L.connectionState === "connected" && at(!1);
3607
3609
  }, [L.connectionState, lt]), T(() => {
3608
3610
  if (!_) return;
3609
- const v = (u) => {
3610
- u.key === "Escape" && re(!1);
3611
+ const v = (d) => {
3612
+ d.key === "Escape" && re(!1);
3611
3613
  };
3612
3614
  return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
3613
3615
  }, [_]);
@@ -3649,7 +3651,7 @@ const Wi = /* @__PURE__ */ new Set([
3649
3651
  style: rr,
3650
3652
  "data-display-mode": ge,
3651
3653
  "data-position": x,
3652
- "data-experience-mode": d === "EMBEDDED" ? "embedded" : "widget",
3654
+ "data-experience-mode": u === "EMBEDDED" ? "embedded" : "widget",
3653
3655
  children: ge === "expanded" && /* @__PURE__ */ n(
3654
3656
  di,
3655
3657
  {
@@ -3777,49 +3779,49 @@ const Qi = ({
3777
3779
  baseUrl: t,
3778
3780
  apiKey: r,
3779
3781
  mode: i,
3780
- onAgentEvent: l,
3782
+ onAgentEvent: a,
3781
3783
  className: o,
3782
- style: s
3784
+ style: c
3783
3785
  }) => {
3784
- const a = I(null), c = I(null), d = I(l);
3785
- d.current = l;
3786
+ const l = I(null), s = I(null), u = I(a);
3787
+ u.current = a;
3786
3788
  const b = C((p) => {
3787
3789
  var P;
3788
3790
  const h = p.detail;
3789
- (P = d.current) == null || P.call(d, h);
3791
+ (P = u.current) == null || P.call(u, h);
3790
3792
  }, []);
3791
3793
  return T(() => {
3792
- const p = a.current;
3794
+ const p = l.current;
3793
3795
  if (!p) return;
3794
3796
  const h = document.createElement("livelayer-widget");
3795
- return h.setAttribute("agent-id", e), t && h.setAttribute("base-url", t), r && h.setAttribute("api-key", r), i && h.setAttribute("mode", i), h.addEventListener("agent-event", b), p.appendChild(h), c.current = h, () => {
3796
- h.removeEventListener("agent-event", b), p.removeChild(h), c.current = null;
3797
+ return h.setAttribute("agent-id", e), t && h.setAttribute("base-url", t), r && h.setAttribute("api-key", r), i && h.setAttribute("mode", i), h.addEventListener("agent-event", b), p.appendChild(h), s.current = h, () => {
3798
+ h.removeEventListener("agent-event", b), p.removeChild(h), s.current = null;
3797
3799
  };
3798
3800
  }, [e]), T(() => {
3799
- c.current && (i ? c.current.setAttribute("mode", i) : c.current.removeAttribute("mode"));
3800
- }, [i]), /* @__PURE__ */ n("div", { ref: a, className: o, style: s });
3801
+ s.current && (i ? s.current.setAttribute("mode", i) : s.current.removeAttribute("mode"));
3802
+ }, [i]), /* @__PURE__ */ n("div", { ref: l, className: o, style: c });
3801
3803
  }, eo = jt(
3802
- function({ id: t, intent: r, as: i = "div", className: l, style: o, children: s }, a) {
3804
+ function({ id: t, intent: r, as: i = "div", className: a, style: o, children: c }, l) {
3803
3805
  return ur(
3804
3806
  i,
3805
3807
  {
3806
- ref: a,
3808
+ ref: l,
3807
3809
  "data-ll-region": t,
3808
3810
  "data-ll-intent": r,
3809
- className: l,
3811
+ className: a,
3810
3812
  style: o
3811
3813
  },
3812
- s
3814
+ c
3813
3815
  );
3814
3816
  }
3815
3817
  );
3816
3818
  function to(e = {}) {
3817
- const { onFieldUpdate: t, onComplete: r, source: i = "all" } = e, [l, o] = M({}), [s, a] = M(!1), [c, d] = M(null), b = I(t), p = I(r), h = I(i);
3819
+ const { onFieldUpdate: t, onComplete: r, source: i = "all" } = e, [a, o] = M({}), [c, l] = M(!1), [s, u] = M(null), b = I(t), p = I(r), h = I(i);
3818
3820
  T(() => {
3819
3821
  b.current = t, p.current = r, h.current = i;
3820
3822
  }, [t, r, i]);
3821
3823
  const P = C(() => {
3822
- o({}), a(!1);
3824
+ o({}), l(!1);
3823
3825
  }, []);
3824
3826
  return T(() => {
3825
3827
  if (typeof window > "u") return;
@@ -3830,7 +3832,7 @@ function to(e = {}) {
3830
3832
  if (g.phase === "field") {
3831
3833
  if (h.current !== "all" && g.source !== h.current)
3832
3834
  return;
3833
- a(!0), o(
3835
+ l(!0), o(
3834
3836
  (S) => S[g.fieldName] === g.value ? S : { ...S, [g.fieldName]: g.value }
3835
3837
  );
3836
3838
  try {
@@ -3844,7 +3846,7 @@ function to(e = {}) {
3844
3846
  const S = g.result;
3845
3847
  if (h.current !== "all" && S.source !== h.current)
3846
3848
  return;
3847
- d(S), a(!1);
3849
+ u(S), l(!1);
3848
3850
  try {
3849
3851
  (R = p.current) == null || R.call(p, S);
3850
3852
  } catch (y) {
@@ -3854,7 +3856,7 @@ function to(e = {}) {
3854
3856
  }
3855
3857
  };
3856
3858
  return document.addEventListener("ll-collected", x), () => document.removeEventListener("ll-collected", x);
3857
- }, []), { fields: l, isCollecting: s, lastResult: c, reset: P };
3859
+ }, []), { fields: a, isCollecting: c, lastResult: s, reset: P };
3858
3860
  }
3859
3861
  let Rn = 1;
3860
3862
  function no({
@@ -3862,11 +3864,11 @@ function no({
3862
3864
  defaultOpen: t = !1,
3863
3865
  storageKey: r = "ll-debug-open"
3864
3866
  }) {
3865
- const [i, l] = M(t), [o, s] = M([]), [a, c] = M(""), [d, b] = M(!1), p = I(/* @__PURE__ */ new Set()), h = I([]), P = I(d);
3866
- P.current = d, T(() => {
3867
+ const [i, a] = M(t), [o, c] = M([]), [l, s] = M(""), [u, b] = M(!1), p = I(/* @__PURE__ */ new Set()), h = I([]), P = I(u);
3868
+ P.current = u, T(() => {
3867
3869
  try {
3868
3870
  const g = localStorage.getItem(r);
3869
- g === "1" && l(!0), g === "0" && l(!1);
3871
+ g === "1" && a(!0), g === "0" && a(!1);
3870
3872
  } catch {
3871
3873
  }
3872
3874
  }, [r]), T(() => {
@@ -3876,14 +3878,14 @@ function no({
3876
3878
  }
3877
3879
  }, [i, r]), T(() => {
3878
3880
  const g = (w) => {
3879
- (w.metaKey || w.ctrlKey) && w.shiftKey && w.key.toLowerCase() === "l" && (w.preventDefault(), l((R) => !R));
3881
+ (w.metaKey || w.ctrlKey) && w.shiftKey && w.key.toLowerCase() === "l" && (w.preventDefault(), a((R) => !R));
3880
3882
  };
3881
3883
  return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
3882
3884
  }, []), T(() => {
3883
3885
  const g = setInterval(() => {
3884
3886
  if (h.current.length === 0 || P.current) return;
3885
3887
  const w = h.current.splice(0, h.current.length);
3886
- s(
3888
+ c(
3887
3889
  (R) => [...w.reverse(), ...R].slice(0, 200)
3888
3890
  );
3889
3891
  }, 100);
@@ -3923,7 +3925,7 @@ function no({
3923
3925
  "button",
3924
3926
  {
3925
3927
  type: "button",
3926
- onClick: () => l(!0),
3928
+ onClick: () => a(!0),
3927
3929
  title: "Open LiveLayer debug panel (Cmd/Ctrl + Shift + L)",
3928
3930
  "aria-label": "Open LiveLayer debug panel",
3929
3931
  style: {
@@ -3946,8 +3948,8 @@ function no({
3946
3948
  }
3947
3949
  );
3948
3950
  const E = o.filter((g) => {
3949
- if (!a) return !0;
3950
- const w = a.toLowerCase();
3951
+ if (!l) return !0;
3952
+ const w = l.toLowerCase();
3951
3953
  return g.type.toLowerCase().includes(w) || JSON.stringify(g.data || {}).toLowerCase().includes(w);
3952
3954
  });
3953
3955
  return /* @__PURE__ */ k(
@@ -3996,9 +3998,9 @@ function no({
3996
3998
  {
3997
3999
  type: "button",
3998
4000
  onClick: () => b((g) => !g),
3999
- style: qt(d ? "#f59e0b" : "transparent"),
4001
+ style: qt(u ? "#f59e0b" : "transparent"),
4000
4002
  title: "Pause / resume capture",
4001
- children: d ? "▶ resume" : "⏸ pause"
4003
+ children: u ? "▶ resume" : "⏸ pause"
4002
4004
  }
4003
4005
  ),
4004
4006
  /* @__PURE__ */ n(
@@ -4006,7 +4008,7 @@ function no({
4006
4008
  {
4007
4009
  type: "button",
4008
4010
  onClick: () => {
4009
- s([]), h.current = [];
4011
+ c([]), h.current = [];
4010
4012
  },
4011
4013
  style: qt("transparent"),
4012
4014
  title: "Clear buffer",
@@ -4017,7 +4019,7 @@ function no({
4017
4019
  "button",
4018
4020
  {
4019
4021
  type: "button",
4020
- onClick: () => l(!1),
4022
+ onClick: () => a(!1),
4021
4023
  style: qt("transparent"),
4022
4024
  "aria-label": "Close",
4023
4025
  title: "Close (Cmd/Ctrl + Shift + L)",
@@ -4031,8 +4033,8 @@ function no({
4031
4033
  "input",
4032
4034
  {
4033
4035
  type: "text",
4034
- value: a,
4035
- onChange: (g) => c(g.target.value),
4036
+ value: l,
4037
+ onChange: (g) => s(g.target.value),
4036
4038
  placeholder: "filter by type or data…",
4037
4039
  style: {
4038
4040
  margin: 8,
@@ -4090,7 +4092,7 @@ function no({
4090
4092
  entry: g,
4091
4093
  expanded: p.current.has(g.id),
4092
4094
  onToggle: () => {
4093
- p.current.has(g.id) ? p.current.delete(g.id) : p.current.add(g.id), s((w) => [...w]);
4095
+ p.current.has(g.id) ? p.current.delete(g.id) : p.current.add(g.id), c((w) => [...w]);
4094
4096
  }
4095
4097
  },
4096
4098
  g.id
@@ -4106,7 +4108,7 @@ function qi({
4106
4108
  expanded: t,
4107
4109
  onToggle: r
4108
4110
  }) {
4109
- 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", l = new Date(e.ts).toLocaleTimeString("en-US", {
4111
+ 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", a = new Date(e.ts).toLocaleTimeString("en-US", {
4110
4112
  hour12: !1
4111
4113
  });
4112
4114
  return /* @__PURE__ */ k(
@@ -4136,7 +4138,7 @@ function qi({
4136
4138
  fontVariantNumeric: "tabular-nums",
4137
4139
  fontSize: 10
4138
4140
  },
4139
- children: l
4141
+ children: a
4140
4142
  }
4141
4143
  ),
4142
4144
  /* @__PURE__ */ n(
@@ -4197,14 +4199,14 @@ function ro({ fields: e, children: t }) {
4197
4199
  return ji(e), /* @__PURE__ */ n(Fe, { children: t });
4198
4200
  }
4199
4201
  function io() {
4200
- const [e, t] = M([]), r = C((l) => {
4202
+ const [e, t] = M([]), r = C((a) => {
4201
4203
  t((o) => {
4202
- const s = o.findIndex((a) => a.id === l.id);
4203
- if (s >= 0) {
4204
- const a = o.slice();
4205
- return a[s] = l, a;
4204
+ const c = o.findIndex((l) => l.id === a.id);
4205
+ if (c >= 0) {
4206
+ const l = o.slice();
4207
+ return l[c] = a, l;
4206
4208
  }
4207
- return [...o, l];
4209
+ return [...o, a];
4208
4210
  });
4209
4211
  }, []), i = C(() => t([]), []);
4210
4212
  return {