@livelayer/react 0.5.5-pr66c.2 → 0.5.5-pr66c.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsxs as w, jsx as n, Fragment as ut } from "react/jsx-runtime";
3
- import { Component as dn, useState as S, useRef as E, useEffect as T, useCallback as k, useMemo as Ze, forwardRef as ft, createElement as un } from "react";
3
+ import { Component as dn, useState as S, useRef as E, useEffect as P, useCallback as k, useMemo as Ze, forwardRef as ft, createElement as un } from "react";
4
4
  import { LiveKitSession as fn } from "@livelayer/sdk";
5
5
  import { createLocalAudioTrack as pn, Track as jt, createLocalVideoTrack as hn } from "livekit-client";
6
6
  class mn extends dn {
@@ -13,8 +13,8 @@ class mn extends dn {
13
13
  return { hasError: !0, error: t };
14
14
  }
15
15
  componentDidCatch(t, r) {
16
- var o, i;
17
- (i = (o = this.props).onError) == null || i.call(o, t, r);
16
+ var i, o;
17
+ (o = (i = this.props).onError) == null || o.call(i, t, r);
18
18
  }
19
19
  render() {
20
20
  var t;
@@ -34,22 +34,22 @@ class mn extends dn {
34
34
  }
35
35
  }
36
36
  function gn(e) {
37
- const [t, r] = S("idle"), [o, i] = S("idle"), [l, s] = S([]), [d, u] = S(null), [m, h] = S(null), [a, c] = S(null), [R, C] = S(!1), [L, v] = S(null), b = E(null), z = E(e.onDataMessage);
38
- z.current = e.onDataMessage, T(() => {
37
+ const [t, r] = S("idle"), [i, o] = S("idle"), [l, c] = S([]), [d, u] = S(null), [m, h] = S(null), [a, s] = S(null), [R, C] = S(!1), [L, v] = S(null), b = E(null), H = E(e.onDataMessage);
38
+ H.current = e.onDataMessage, P(() => {
39
39
  const N = {
40
- onConnectionStateChange: (D) => {
41
- r(D), D === "connected" && v(null);
40
+ onConnectionStateChange: ($) => {
41
+ r($), $ === "connected" && v(null);
42
42
  },
43
- onAgentStateChange: i,
44
- onTranscript: (D) => s([...D]),
43
+ onAgentStateChange: o,
44
+ onTranscript: ($) => c([...$]),
45
45
  onAgentConfig: u,
46
- onAudioTrack: (D) => c(D),
47
- onVideoTrack: (D) => h(D),
46
+ onAudioTrack: ($) => s($),
47
+ onVideoTrack: ($) => h($),
48
48
  onVideoTrackRemoved: () => h(null),
49
- onError: (D) => v(D),
50
- onDataMessage: (D) => {
49
+ onError: ($) => v($),
50
+ onDataMessage: ($) => {
51
51
  var A;
52
- (A = z.current) == null || A.call(z, D);
52
+ (A = H.current) == null || A.call(H, $);
53
53
  },
54
54
  onResumabilityChange: C
55
55
  }, B = new fn(
@@ -62,9 +62,9 @@ function gn(e) {
62
62
  },
63
63
  N
64
64
  );
65
- return b.current = B, r("idle"), i("idle"), s([]), u(null), h(null), c(null), C(!1), v(null), () => {
66
- var D;
67
- (D = B.destroy) == null || D.call(B), b.current = null;
65
+ return b.current = B, r("idle"), o("idle"), c([]), u(null), h(null), s(null), C(!1), v(null), () => {
66
+ var $;
67
+ ($ = B.destroy) == null || $.call(B), b.current = null;
68
68
  };
69
69
  }, [
70
70
  e.agentId,
@@ -81,7 +81,7 @@ function gn(e) {
81
81
  } catch (B) {
82
82
  throw v(B instanceof Error ? B.message : String(B)), B;
83
83
  }
84
- }, []), H = k(() => {
84
+ }, []), O = k(() => {
85
85
  const N = b.current;
86
86
  N && N.disconnect();
87
87
  }, []), p = k(() => {
@@ -90,7 +90,7 @@ function gn(e) {
90
90
  }, []);
91
91
  return {
92
92
  connectionState: t,
93
- agentState: o,
93
+ agentState: i,
94
94
  transcript: l,
95
95
  agentConfig: d,
96
96
  videoElement: m,
@@ -98,37 +98,37 @@ function gn(e) {
98
98
  canResume: R,
99
99
  error: L,
100
100
  connect: I,
101
- disconnect: H,
101
+ disconnect: O,
102
102
  getRoom: p,
103
103
  session: b.current
104
104
  };
105
105
  }
106
106
  function yn() {
107
- const e = E(null), t = E(null), r = E(null), o = E(null), i = E(/* @__PURE__ */ new Set()), l = E(null), s = k(() => {
107
+ const e = E(null), t = E(null), r = E(null), i = E(null), o = E(/* @__PURE__ */ new Set()), l = E(null), c = k(() => {
108
108
  const a = t.current;
109
109
  if (!a) {
110
- o.current = null;
110
+ i.current = null;
111
111
  return;
112
112
  }
113
113
  (!l.current || l.current.length !== a.frequencyBinCount) && (l.current = new Uint8Array(
114
114
  new ArrayBuffer(a.frequencyBinCount)
115
115
  ));
116
- const c = l.current;
117
- a.getByteFrequencyData(c);
116
+ const s = l.current;
117
+ a.getByteFrequencyData(s);
118
118
  let R = 0;
119
- for (let L = 0; L < c.length; L++) R += c[L];
120
- const C = R / c.length / 255;
121
- for (const L of i.current)
119
+ for (let L = 0; L < s.length; L++) R += s[L];
120
+ const C = R / s.length / 255;
121
+ for (const L of o.current)
122
122
  try {
123
123
  L(C);
124
124
  } catch (v) {
125
125
  console.error("[useAudioLevel] subscriber threw:", v);
126
126
  }
127
- o.current = requestAnimationFrame(s);
127
+ i.current = requestAnimationFrame(c);
128
128
  }, []), d = k(() => {
129
129
  if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
130
- const a = new AudioContext(), c = a.createAnalyser();
131
- c.fftSize = 64, c.connect(a.destination), e.current = a, t.current = c;
130
+ const a = new AudioContext(), s = a.createAnalyser();
131
+ s.fftSize = 64, s.connect(a.destination), e.current = a, t.current = s;
132
132
  }, []), u = k(
133
133
  (a) => {
134
134
  if (d(), !(!e.current || !t.current)) {
@@ -140,28 +140,28 @@ function yn() {
140
140
  r.current = null;
141
141
  }
142
142
  try {
143
- const c = e.current.createMediaElementSource(a);
144
- c.connect(t.current), r.current = c;
145
- } catch (c) {
146
- console.warn("[useAudioLevel] createMediaElementSource failed:", c);
143
+ const s = e.current.createMediaElementSource(a);
144
+ s.connect(t.current), r.current = s;
145
+ } catch (s) {
146
+ console.warn("[useAudioLevel] createMediaElementSource failed:", s);
147
147
  return;
148
148
  }
149
- o.current === null && (o.current = requestAnimationFrame(s));
149
+ i.current === null && (i.current = requestAnimationFrame(c));
150
150
  }
151
151
  },
152
- [d, s]
152
+ [d, c]
153
153
  ), m = k(() => {
154
- if (o.current !== null && (cancelAnimationFrame(o.current), o.current = null), r.current) {
154
+ if (i.current !== null && (cancelAnimationFrame(i.current), i.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
- }, []), h = k((a) => (i.current.add(a), () => {
162
- i.current.delete(a);
161
+ }, []), h = k((a) => (o.current.add(a), () => {
162
+ o.current.delete(a);
163
163
  }), []);
164
- return T(() => () => {
164
+ return P(() => () => {
165
165
  if (m(), t.current) {
166
166
  try {
167
167
  t.current.disconnect();
@@ -176,34 +176,34 @@ function yn() {
176
176
  }
177
177
  e.current = null;
178
178
  }
179
- i.current.clear(), l.current = null;
179
+ o.current.clear(), l.current = null;
180
180
  }, [m]), { attach: u, detach: m, subscribe: h };
181
181
  }
182
182
  function vn() {
183
- const [e, t] = S(!1), [r, o] = S(null), i = E(null), l = E(null), s = k(async (h) => {
184
- if (i.current && l.current) {
183
+ const [e, t] = S(!1), [r, i] = S(null), o = E(null), l = E(null), c = k(async (h) => {
184
+ if (o.current && l.current) {
185
185
  try {
186
- await l.current.localParticipant.unpublishTrack(i.current);
186
+ await l.current.localParticipant.unpublishTrack(o.current);
187
187
  } catch {
188
188
  }
189
- i.current.stop(), i.current = null;
189
+ o.current.stop(), o.current = null;
190
190
  }
191
- l.current = h, o(null);
191
+ l.current = h, i(null);
192
192
  try {
193
193
  const a = await pn({
194
194
  echoCancellation: !0,
195
195
  noiseSuppression: !0
196
196
  });
197
- await h.localParticipant.publishTrack(a), i.current = a, t(a.isMuted);
197
+ await h.localParticipant.publishTrack(a), o.current = a, t(a.isMuted);
198
198
  } catch (a) {
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 o(c), a;
199
+ const s = 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(s), a;
201
201
  }
202
202
  }, []), d = k(() => {
203
- const h = i.current;
203
+ const h = o.current;
204
204
  h && (h.isMuted ? (h.unmute(), t(!1)) : (h.mute(), t(!0)));
205
205
  }, []), u = k(() => {
206
- const h = i.current, a = l.current;
206
+ const h = o.current, a = l.current;
207
207
  if (h && a) {
208
208
  try {
209
209
  a.localParticipant.unpublishTrack(h);
@@ -211,24 +211,24 @@ function vn() {
211
211
  }
212
212
  h.stop();
213
213
  }
214
- i.current = null, l.current = null, t(!1);
215
- }, []), m = k(() => o(null), []);
214
+ o.current = null, l.current = null, t(!1);
215
+ }, []), m = k(() => i(null), []);
216
216
  return {
217
217
  isMuted: e,
218
218
  micError: r,
219
219
  toggleMute: d,
220
- setupMic: s,
220
+ setupMic: c,
221
221
  teardownMic: u,
222
222
  clearError: m
223
223
  };
224
224
  }
225
225
  const bn = { resolution: { width: 640, height: 480, frameRate: 24 } };
226
226
  function wn() {
227
- const [e, t] = S(!1), [r, o] = S(null), [i, l] = S(null), [s, d] = S(""), u = E(null), m = E(null), h = k((b) => {
227
+ const [e, t] = S(!1), [r, i] = S(null), [o, l] = S(null), [c, d] = S(""), u = E(null), m = E(null), h = k((b) => {
228
228
  u.current = b;
229
229
  }, []), a = k(() => {
230
- const b = u.current, z = m.current;
231
- if (z && b) {
230
+ const b = u.current, H = m.current;
231
+ if (H && b) {
232
232
  const I = b.localParticipant.getTrackPublication(jt.Source.Camera);
233
233
  if (I != null && I.track) {
234
234
  try {
@@ -237,46 +237,46 @@ function wn() {
237
237
  }
238
238
  I.track.stop();
239
239
  } else
240
- z.stop();
240
+ H.stop();
241
241
  }
242
242
  m.current = null, l(null), t(!1);
243
- }, []), c = k(async (b) => {
244
- const z = u.current;
245
- if (z) {
246
- o(null);
243
+ }, []), s = k(async (b) => {
244
+ const H = u.current;
245
+ if (H) {
246
+ i(null);
247
247
  try {
248
248
  const I = { ...bn };
249
249
  b && (I.deviceId = b);
250
- const H = await hn(I);
251
- await z.localParticipant.publishTrack(H), m.current = H;
252
- const p = H.attach();
250
+ const O = await hn(I);
251
+ await H.localParticipant.publishTrack(O), m.current = O;
252
+ const p = O.attach();
253
253
  l(p), t(!0), b && d(b);
254
254
  try {
255
- z.localParticipant.publishData(
255
+ H.localParticipant.publishData(
256
256
  new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
257
257
  { reliable: !0 }
258
258
  );
259
259
  } catch {
260
260
  }
261
261
  } catch (I) {
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
- o(H);
262
+ const O = I instanceof Error && I.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
263
+ i(O);
264
264
  }
265
265
  }
266
266
  }, []), R = k(async () => {
267
- e ? a() : await c(s || void 0);
268
- }, [e, s, a, c]), C = k(async (b) => {
269
- a(), await c(b);
270
- }, [a, c]), L = k(() => {
271
- a(), u.current = null, o(null), d("");
272
- }, [a]), v = k(() => o(null), []);
273
- return T(() => () => {
267
+ e ? a() : await s(c || void 0);
268
+ }, [e, c, a, s]), C = k(async (b) => {
269
+ a(), await s(b);
270
+ }, [a, s]), L = k(() => {
271
+ a(), u.current = null, i(null), d("");
272
+ }, [a]), v = k(() => i(null), []);
273
+ return P(() => () => {
274
274
  m.current && m.current.stop();
275
275
  }, []), {
276
276
  isEnabled: e,
277
277
  error: r,
278
- previewEl: i,
279
- activeDeviceId: s,
278
+ previewEl: o,
279
+ activeDeviceId: c,
280
280
  toggle: R,
281
281
  switchDevice: C,
282
282
  attachRoom: h,
@@ -285,30 +285,30 @@ function wn() {
285
285
  };
286
286
  }
287
287
  function _n() {
288
- const [e, t] = S(!1), [r, o] = S(null), [i, l] = S(null), s = E(null), d = k((c) => {
289
- s.current = c;
288
+ const [e, t] = S(!1), [r, i] = S(null), [o, l] = S(null), c = E(null), d = k((s) => {
289
+ c.current = s;
290
290
  }, []), u = k(() => l(null), []), m = k(async () => {
291
- const c = s.current;
292
- if (c) {
291
+ const s = c.current;
292
+ if (s) {
293
293
  if (e) {
294
294
  try {
295
- await c.localParticipant.setScreenShareEnabled(!1);
295
+ await s.localParticipant.setScreenShareEnabled(!1);
296
296
  } catch {
297
297
  }
298
298
  u(), t(!1);
299
299
  return;
300
300
  }
301
- o(null);
301
+ i(null);
302
302
  try {
303
- await c.localParticipant.setScreenShareEnabled(!0);
303
+ await s.localParticipant.setScreenShareEnabled(!0);
304
304
  let R = 0;
305
305
  const C = () => {
306
- const L = c.localParticipant.getTrackPublication(jt.Source.ScreenShare);
306
+ const L = s.localParticipant.getTrackPublication(jt.Source.ScreenShare);
307
307
  if (L != null && L.track) {
308
308
  const v = L.track.attach();
309
309
  l(v), t(!0);
310
310
  try {
311
- c.localParticipant.publishData(
311
+ s.localParticipant.publishData(
312
312
  new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
313
313
  { reliable: !0 }
314
314
  );
@@ -321,57 +321,57 @@ function _n() {
321
321
  C();
322
322
  } catch (R) {
323
323
  const C = R instanceof Error ? R.name : "";
324
- C !== "NotAllowedError" && C !== "AbortError" && o("Screen share unavailable. Try again."), t(!1);
324
+ C !== "NotAllowedError" && C !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
325
325
  }
326
326
  }
327
327
  }, [e, u]), h = k(() => {
328
- const c = s.current;
329
- if (c && e)
328
+ const s = c.current;
329
+ if (s && e)
330
330
  try {
331
- c.localParticipant.setScreenShareEnabled(!1);
331
+ s.localParticipant.setScreenShareEnabled(!1);
332
332
  } catch {
333
333
  }
334
- u(), t(!1), o(null), s.current = null;
335
- }, [e, u]), a = k(() => o(null), []);
336
- return { isEnabled: e, error: r, previewEl: i, toggle: m, attachRoom: d, teardown: h, clearError: a };
334
+ u(), t(!1), i(null), c.current = null;
335
+ }, [e, u]), a = k(() => i(null), []);
336
+ return { isEnabled: e, error: r, previewEl: o, toggle: m, attachRoom: d, teardown: h, clearError: a };
337
337
  }
338
338
  function xn() {
339
- const [e, t] = S([]), [r, o] = S([]), i = k(async () => {
339
+ const [e, t] = S([]), [r, i] = S([]), o = 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")), o(l.filter((s) => s.kind === "videoinput"));
343
+ t(l.filter((c) => c.kind === "audioinput")), i(l.filter((c) => c.kind === "videoinput"));
344
344
  } catch {
345
345
  }
346
346
  }, []);
347
- return T(() => {
348
- if (i(), typeof navigator > "u" || !navigator.mediaDevices) return;
349
- const l = () => void i();
347
+ return P(() => {
348
+ if (o(), typeof navigator > "u" || !navigator.mediaDevices) return;
349
+ const l = () => void o();
350
350
  return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
351
- }, [i]), { mics: e, cameras: r, refresh: i };
351
+ }, [o]), { mics: e, cameras: r, refresh: o };
352
352
  }
353
353
  function kn(e, t, r = !1) {
354
- const [o, i] = S(null), [l, s] = S(null), [d, u] = S(!r && !!e);
355
- return T(() => {
354
+ const [i, o] = S(null), [l, c] = S(null), [d, u] = S(!r && !!e);
355
+ return P(() => {
356
356
  if (r || !e) {
357
357
  u(!1);
358
358
  return;
359
359
  }
360
360
  const m = new AbortController(), h = t || "https://app.livelayer.studio";
361
- return u(!0), s(null), fetch(`${h}/api/widget/agent/${encodeURIComponent(e)}`, {
361
+ return u(!0), c(null), fetch(`${h}/api/widget/agent/${encodeURIComponent(e)}`, {
362
362
  signal: m.signal
363
363
  }).then(async (a) => {
364
364
  if (!a.ok) {
365
- const c = await a.json().catch(() => ({}));
366
- throw new Error(c.error || `HTTP ${a.status}`);
365
+ const s = await a.json().catch(() => ({}));
366
+ throw new Error(s.error || `HTTP ${a.status}`);
367
367
  }
368
368
  return a.json();
369
369
  }).then((a) => {
370
- m.signal.aborted || (i(a), u(!1));
370
+ m.signal.aborted || (o(a), u(!1));
371
371
  }).catch((a) => {
372
- m.signal.aborted || (s(a instanceof Error ? a.message : "Agent lookup failed"), u(!1));
372
+ m.signal.aborted || (c(a instanceof Error ? a.message : "Agent lookup failed"), u(!1));
373
373
  }), () => m.abort();
374
- }, [e, t, r]), { info: o, error: l, loading: d };
374
+ }, [e, t, r]), { info: i, error: l, loading: d };
375
375
  }
376
376
  function Ln(e) {
377
377
  if (typeof window > "u") return null;
@@ -393,13 +393,13 @@ function Cn({
393
393
  defaultValue: t = "expanded",
394
394
  onChange: r
395
395
  } = {}) {
396
- const o = e !== void 0, [i, l] = S(t), s = o ? e : i, d = k(
396
+ const i = e !== void 0, [o, l] = S(t), c = i ? e : o, d = k(
397
397
  (u) => {
398
- u !== s && (o || l(u), r == null || r(u));
398
+ u !== c && (i || l(u), r == null || r(u));
399
399
  },
400
- [s, o, r]
400
+ [c, i, r]
401
401
  );
402
- return [s, d];
402
+ return [c, d];
403
403
  }
404
404
  const En = ["hidden", "minimized", "expanded"];
405
405
  function Nn(e) {
@@ -409,18 +409,18 @@ function An({
409
409
  value: e,
410
410
  defaultValue: t = "expanded",
411
411
  onChange: r,
412
- persistKey: o = "ll-widget",
413
- disablePersistence: i = !1
412
+ persistKey: i = "ll-widget",
413
+ disablePersistence: o = !1
414
414
  } = {}) {
415
- const l = `${o}:display-mode`, s = E(!1), [d, u] = Cn({
415
+ const l = `${i}:display-mode`, c = E(!1), [d, u] = Cn({
416
416
  value: e,
417
417
  defaultValue: t,
418
418
  onChange: (m) => {
419
- e === void 0 && !i && Sn(l, m), r == null || r(m);
419
+ e === void 0 && !o && Sn(l, m), r == null || r(m);
420
420
  }
421
421
  });
422
- return T(() => {
423
- if (s.current || (s.current = !0, i || e !== void 0)) return;
422
+ return P(() => {
423
+ if (c.current || (c.current = !0, o || e !== void 0)) return;
424
424
  const m = Nn(Ln(l));
425
425
  m && m !== d && u(m);
426
426
  }, []), [d, u];
@@ -428,16 +428,16 @@ function An({
428
428
  const Rn = 640;
429
429
  function In(e = Rn) {
430
430
  const [t, r] = S(!1);
431
- return T(() => {
431
+ return P(() => {
432
432
  if (e === !1) {
433
433
  r(!1);
434
434
  return;
435
435
  }
436
436
  if (typeof window > "u" || typeof window.matchMedia > "u")
437
437
  return;
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);
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);
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 o = e.apply(this, r);
450
- return window.dispatchEvent(new Event(et)), o;
449
+ const i = e.apply(this, r);
450
+ return window.dispatchEvent(new Event(et)), i;
451
451
  }, window.history.replaceState = function(...r) {
452
- const o = t.apply(this, r);
453
- return window.dispatchEvent(new Event(et)), o;
452
+ const i = t.apply(this, r);
453
+ return window.dispatchEvent(new Event(et)), i;
454
454
  }, window.history[Nt] = !0;
455
455
  }
456
456
  function At() {
@@ -460,12 +460,12 @@ function Tn(e) {
460
460
  const [t, r] = S(
461
461
  () => e ?? At()
462
462
  );
463
- return T(() => {
463
+ return P(() => {
464
464
  if (e !== void 0) return;
465
465
  Mn();
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);
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);
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, 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"), "[^/]+"), u = new RegExp(`^${d}\\/?$`);
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"), "[^/]+"), u = new RegExp(`^${d}\\/?$`);
480
480
  return Rt.set(e, u), u;
481
481
  }
482
482
  function zn(e, t) {
@@ -620,28 +620,28 @@ const Vn = ({
620
620
  position: e,
621
621
  isMobile: t,
622
622
  isSpeaking: r,
623
- onExpand: o,
624
- label: i = "Open widget",
623
+ onExpand: i,
624
+ label: o = "Open widget",
625
625
  avatarImageUrl: l,
626
- agentName: s
626
+ agentName: c
627
627
  }) => {
628
- const d = Fn(e), u = d === "right" ? "left" : "right", m = t ? 80 : 72, h = !!l, [a, c] = S(null), [R, C] = S(!1), L = E(null), v = E(!1), b = k(
628
+ const d = Fn(e), u = d === "right" ? "left" : "right", m = t ? 80 : 72, h = !!l, [a, s] = S(null), [R, C] = S(!1), L = E(null), v = E(!1), b = k(
629
629
  (A) => {
630
630
  if (typeof window > "u") return A;
631
- const O = m / 2, W = Dt + O, V = window.innerHeight - Dt - O;
631
+ const T = m / 2, W = Dt + T, V = window.innerHeight - Dt - T;
632
632
  return V < W ? Math.max(W, A) : Math.max(W, Math.min(V, A));
633
633
  },
634
634
  [m]
635
635
  );
636
- T(() => {
636
+ P(() => {
637
637
  const A = jn();
638
- c(b(A ?? window.innerHeight / 2));
639
- const O = () => {
640
- c((W) => W === null ? null : b(W));
638
+ s(b(A ?? window.innerHeight / 2));
639
+ const T = () => {
640
+ s((W) => W === null ? null : b(W));
641
641
  };
642
- return window.addEventListener("resize", O), () => window.removeEventListener("resize", O);
642
+ return window.addEventListener("resize", T), () => window.removeEventListener("resize", T);
643
643
  }, [b]);
644
- const z = k(
644
+ const H = k(
645
645
  (A) => {
646
646
  if (!(A.pointerType === "mouse" && A.button !== 0) && a !== null) {
647
647
  try {
@@ -658,21 +658,21 @@ const Vn = ({
658
658
  [a]
659
659
  ), I = k(
660
660
  (A) => {
661
- const O = L.current;
662
- if (!O) return;
663
- const W = A.clientY - O.startClientY;
664
- !O.moved && Math.abs(W) > Un && (O.moved = !0, C(!0)), O.moved && c(b(O.startCenterY + W));
661
+ const T = L.current;
662
+ if (!T) return;
663
+ const W = A.clientY - T.startClientY;
664
+ !T.moved && Math.abs(W) > Un && (T.moved = !0, C(!0)), T.moved && s(b(T.startCenterY + W));
665
665
  },
666
666
  [b]
667
- ), H = k(
667
+ ), O = k(
668
668
  (A) => {
669
- const O = L.current;
670
- if (O) {
669
+ const T = L.current;
670
+ if (T) {
671
671
  try {
672
672
  A.currentTarget.releasePointerCapture(A.pointerId);
673
673
  } catch {
674
674
  }
675
- L.current = null, O.moved && (C(!1), v.current = !0, c((W) => (W !== null && $t(W), W)));
675
+ L.current = null, T.moved && (C(!1), v.current = !0, s((W) => (W !== null && $t(W), W)));
676
676
  }
677
677
  },
678
678
  []
@@ -681,15 +681,15 @@ const Vn = ({
681
681
  v.current = !1;
682
682
  return;
683
683
  }
684
- o();
685
- }, [o]), N = k(
684
+ i();
685
+ }, [i]), N = k(
686
686
  (A) => {
687
687
  if (A.key === "ArrowUp" || A.key === "ArrowDown") {
688
688
  A.preventDefault();
689
- const O = A.key === "ArrowUp" ? -8 : 8;
690
- c((W) => {
689
+ const T = A.key === "ArrowUp" ? -8 : 8;
690
+ s((W) => {
691
691
  if (W === null) return W;
692
- const V = b(W + O);
692
+ const V = b(W + T);
693
693
  return $t(V), V;
694
694
  });
695
695
  }
@@ -702,21 +702,21 @@ const Vn = ({
702
702
  r ? "ll-hidden--speaking" : null,
703
703
  R ? "is-dragging" : null,
704
704
  h ? "ll-hidden--with-avatar" : null
705
- ].filter(Boolean).join(" "), D = a === null ? void 0 : { top: `${a - m / 2}px`, transform: "none" };
705
+ ].filter(Boolean).join(" "), $ = a === null ? void 0 : { top: `${a - m / 2}px`, transform: "none" };
706
706
  return /* @__PURE__ */ n(
707
707
  "button",
708
708
  {
709
709
  type: "button",
710
710
  className: B,
711
- onPointerDown: z,
711
+ onPointerDown: H,
712
712
  onPointerMove: I,
713
- onPointerUp: H,
714
- onPointerCancel: H,
713
+ onPointerUp: O,
714
+ onPointerCancel: O,
715
715
  onClick: p,
716
716
  onKeyDown: N,
717
- "aria-label": i,
717
+ "aria-label": o,
718
718
  "data-position": e,
719
- style: D,
719
+ style: $,
720
720
  children: h ? (
721
721
  // Layout: tiny chevron flush against the inward edge (peeks out
722
722
  // as the click affordance), then the circular avatar photo
@@ -734,7 +734,7 @@ const Vn = ({
734
734
  "img",
735
735
  {
736
736
  src: l,
737
- alt: s ? `${s} avatar` : "Agent avatar",
737
+ alt: c ? `${c} avatar` : "Agent avatar",
738
738
  className: "ll-hidden__avatar",
739
739
  draggable: !1
740
740
  }
@@ -753,42 +753,42 @@ const Vn = ({
753
753
  audioLevel: e,
754
754
  bars: t = 20,
755
755
  maxHeight: r = 20,
756
- minHeight: o = 4,
757
- className: i,
756
+ minHeight: i = 4,
757
+ className: o,
758
758
  barClassName: l
759
759
  }) => {
760
- const s = E(null), d = E([]), u = Ze(() => {
760
+ const c = E(null), d = E([]), u = Ze(() => {
761
761
  const h = (Math.sqrt(5) - 1) / 2;
762
- return Array.from({ length: t }, (a, c) => 0.5 + c * h % 1 * 0.5);
762
+ return Array.from({ length: t }, (a, s) => 0.5 + s * h % 1 * 0.5);
763
763
  }, [t]);
764
- T(() => e.subscribe((a) => {
765
- for (let c = 0; c < t; c++) {
766
- const R = d.current[c];
764
+ P(() => e.subscribe((a) => {
765
+ for (let s = 0; s < t; s++) {
766
+ const R = d.current[s];
767
767
  if (!R) continue;
768
- const C = Math.max(o, a * r * u[c]);
768
+ const C = Math.max(i, a * r * u[s]);
769
769
  R.style.height = `${C}px`;
770
770
  }
771
- }), [e, t, r, o, u]);
772
- const m = ["ll-waveform", i].filter(Boolean).join(" ");
773
- return /* @__PURE__ */ n("div", { ref: s, className: m, "aria-hidden": "true", children: Array.from({ length: t }, (h, a) => /* @__PURE__ */ n(
771
+ }), [e, t, r, i, u]);
772
+ const m = ["ll-waveform", o].filter(Boolean).join(" ");
773
+ return /* @__PURE__ */ n("div", { ref: c, className: m, "aria-hidden": "true", children: Array.from({ length: t }, (h, a) => /* @__PURE__ */ n(
774
774
  "div",
775
775
  {
776
- ref: (c) => {
777
- d.current[a] = c;
776
+ ref: (s) => {
777
+ d.current[a] = s;
778
778
  },
779
779
  className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
780
- style: { height: `${o}px` }
780
+ style: { height: `${i}px` }
781
781
  },
782
782
  a
783
783
  )) });
784
- }, Gn = ({
784
+ }, Xn = ({
785
785
  position: e,
786
786
  isMobile: t,
787
787
  agentName: r,
788
- avatarImageUrl: o,
789
- agentState: i,
788
+ avatarImageUrl: i,
789
+ agentState: o,
790
790
  isMuted: l,
791
- audioLevel: s,
791
+ audioLevel: c,
792
792
  onExpand: d,
793
793
  onToggleMute: u,
794
794
  onClose: m
@@ -806,12 +806,12 @@ const Vn = ({
806
806
  onClick: d,
807
807
  "aria-label": `Expand ${r} widget`,
808
808
  children: [
809
- o ? (
809
+ i ? (
810
810
  // eslint-disable-next-line @next/next/no-img-element
811
811
  /* @__PURE__ */ n(
812
812
  "img",
813
813
  {
814
- src: o,
814
+ src: i,
815
815
  alt: r,
816
816
  className: "ll-minimized__avatar"
817
817
  }
@@ -820,7 +820,7 @@ const Vn = ({
820
820
  /* @__PURE__ */ n(
821
821
  Yn,
822
822
  {
823
- audioLevel: s,
823
+ audioLevel: c,
824
824
  bars: 16,
825
825
  maxHeight: 18,
826
826
  className: "ll-minimized__waveform"
@@ -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
- o ? (
861
+ i ? (
862
862
  // eslint-disable-next-line @next/next/no-img-element
863
863
  /* @__PURE__ */ n(
864
864
  "img",
865
865
  {
866
- src: o,
866
+ src: i,
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: i === "speaking" ? "Speaking" : i === "thinking" ? "Thinking" : "Listening" })
874
+ /* @__PURE__ */ n("span", { className: "ll-minimized__state", children: o === "speaking" ? "Speaking" : o === "thinking" ? "Thinking" : "Listening" })
875
875
  ] }),
876
876
  /* @__PURE__ */ w("div", { className: "ll-minimized__controls", children: [
877
877
  /* @__PURE__ */ n(
@@ -907,16 +907,16 @@ const Vn = ({
907
907
  ] })
908
908
  ] })
909
909
  }
910
- ), Jn = ({
910
+ ), Gn = ({
911
911
  src: e,
912
912
  alt: t,
913
913
  preCannedPlaying: r = !1,
914
- className: o,
915
- style: i
914
+ className: i,
915
+ style: o
916
916
  }) => {
917
- const [l, s] = S(!1), d = E(e);
918
- if (T(() => {
919
- d.current !== e && (d.current = e, s(!1));
917
+ const [l, c] = S(!1), d = E(e);
918
+ if (P(() => {
919
+ d.current !== e && (d.current = e, c(!1));
920
920
  }, [e]), !e) return null;
921
921
  const u = {
922
922
  position: "absolute",
@@ -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
- ...i
931
+ ...o
932
932
  };
933
933
  return (
934
934
  // eslint-disable-next-line @next/next/no-img-element
@@ -937,122 +937,122 @@ const Vn = ({
937
937
  {
938
938
  src: e,
939
939
  alt: t,
940
- className: o,
940
+ className: i,
941
941
  style: u,
942
942
  loading: "eager",
943
943
  fetchPriority: "high",
944
- onLoad: () => s(!0)
944
+ onLoad: () => c(!0)
945
945
  }
946
946
  )
947
947
  );
948
- }, Kn = ({
948
+ }, Jn = ({
949
949
  position: e,
950
950
  isMobile: t,
951
951
  agentName: r,
952
- avatarImageUrl: o,
953
- idleLoopUrl: i,
952
+ avatarImageUrl: i,
953
+ idleLoopUrl: o,
954
954
  greeting: l,
955
- branding: s,
955
+ branding: c,
956
956
  teamMembers: d,
957
957
  currentTeamMemberId: u,
958
958
  isSwitchingTeamMember: m,
959
959
  teamSwitcherOpen: h,
960
960
  onToggleTeamSwitcher: a,
961
- onSelectTeamMember: c,
961
+ onSelectTeamMember: s,
962
962
  languageMenuOpen: R,
963
963
  onToggleLanguageMenu: C,
964
964
  connectionState: L,
965
965
  agentState: v,
966
966
  transcript: b,
967
- canResume: z,
967
+ canResume: H,
968
968
  needsUserGesture: I,
969
- error: H,
969
+ error: O,
970
970
  isMuted: p,
971
971
  micError: N,
972
972
  micDevices: B,
973
- isCameraEnabled: D,
973
+ isCameraEnabled: $,
974
974
  cameraPreviewEl: A,
975
- cameraDevices: O,
975
+ cameraDevices: T,
976
976
  activeCameraId: W,
977
977
  isScreenShareEnabled: V,
978
- screenPreviewEl: te,
979
- isSpeakerMuted: ue,
980
- allowCamera: He,
981
- allowScreenShare: Oe,
982
- allowTyping: qe,
983
- avatarVideoContainerRef: Be,
984
- onConnect: me,
985
- onDisconnect: ge,
986
- onRetry: ye,
987
- onResumeAudio: ve,
988
- onToggleMute: be,
989
- onToggleCamera: we,
990
- onSwitchCameraDevice: _e,
991
- onToggleScreenShare: xe,
978
+ screenPreviewEl: ne,
979
+ isSpeakerMuted: ee,
980
+ allowCamera: ve,
981
+ allowScreenShare: ae,
982
+ allowTyping: pe,
983
+ avatarVideoContainerRef: se,
984
+ onConnect: re,
985
+ onDisconnect: ce,
986
+ onRetry: _e,
987
+ onResumeAudio: xe,
988
+ onToggleMute: ke,
989
+ onToggleCamera: Le,
990
+ onSwitchCameraDevice: Se,
991
+ onToggleScreenShare: Ce,
992
992
  onToggleSpeaker: j,
993
993
  onSendMessage: We,
994
994
  onMinimize: Fe,
995
995
  onClose: Ue,
996
996
  onClearMicError: je
997
997
  }) => {
998
- var Se;
999
- const ae = b.length > 0 ? b[b.length - 1] : null, ie = ((d == null ? void 0 : d.length) ?? 0) > 1, ke = L === "connecting" || L === "connected", Le = L === "connected", fe = L === "idle" || L === "disconnected" || L === "error", J = E(null), Re = E(null);
1000
- T(() => {
1001
- const y = J.current;
998
+ var Ae;
999
+ const he = b.length > 0 ? b[b.length - 1] : null, de = ((d == null ? void 0 : d.length) ?? 0) > 1, Ee = L === "connecting" || L === "connected", Ne = L === "connected", be = L === "idle" || L === "disconnected" || L === "error", G = E(null), Pe = E(null);
1000
+ P(() => {
1001
+ const y = G.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)));
1003
- }, [A]), T(() => {
1004
- const y = Re.current;
1005
- y && (y.innerHTML = "", te && (te.style.width = "100%", te.style.height = "100%", te.style.objectFit = "contain", y.appendChild(te)));
1006
- }, [te]);
1007
- const [ne, ee] = S(!1), [le, ce] = S(!1);
1008
- T(() => {
1009
- if (!ne && !le && !R && !h) return;
1003
+ }, [A]), P(() => {
1004
+ const y = Pe.current;
1005
+ y && (y.innerHTML = "", ne && (ne.style.width = "100%", ne.style.height = "100%", ne.style.objectFit = "contain", y.appendChild(ne)));
1006
+ }, [ne]);
1007
+ const [ie, te] = S(!1), [ue, me] = S(!1);
1008
+ P(() => {
1009
+ if (!ie && !ue && !R && !h) return;
1010
1010
  const y = () => {
1011
- ee(!1), ce(!1), R && C(), h && a();
1011
+ te(!1), me(!1), R && C(), h && a();
1012
1012
  };
1013
1013
  return document.addEventListener("click", y), () => document.removeEventListener("click", y);
1014
1014
  }, [
1015
- ne,
1016
- le,
1015
+ ie,
1016
+ ue,
1017
1017
  R,
1018
1018
  h,
1019
1019
  C,
1020
1020
  a
1021
1021
  ]);
1022
- const [Q, re] = S(""), pe = k(
1022
+ const [Q, oe] = S(""), we = k(
1023
1023
  (y) => {
1024
1024
  y.preventDefault();
1025
- const K = Q.trim();
1026
- K && (We(K), re(""));
1025
+ const J = Q.trim();
1026
+ J && (We(J), oe(""));
1027
1027
  },
1028
1028
  [Q, We]
1029
- ), Ie = s.productName || "Live Layer", Ve = Le && (ae != null && ae.text) ? ae.text : l || "", Me = [
1029
+ ), De = c.productName || "Live Layer", Ve = Ne && (he != null && he.text) ? he.text : l || "", $e = [
1030
1030
  "ll-expanded",
1031
1031
  t ? "ll-expanded--mobile" : "ll-expanded--desktop"
1032
1032
  ].join(" ");
1033
1033
  return /* @__PURE__ */ w(
1034
1034
  "div",
1035
1035
  {
1036
- className: Me,
1036
+ className: $e,
1037
1037
  "data-position": e,
1038
- "data-state": Le ? "connected" : ke ? "connecting" : "idle",
1038
+ "data-state": Ne ? "connected" : Ee ? "connecting" : "idle",
1039
1039
  role: "dialog",
1040
1040
  "aria-label": `${r} widget`,
1041
1041
  children: [
1042
1042
  /* @__PURE__ */ w("div", { className: "ll-expanded__bg", children: [
1043
- o ? /* @__PURE__ */ n(
1044
- Jn,
1043
+ i ? /* @__PURE__ */ n(
1044
+ Gn,
1045
1045
  {
1046
- src: o,
1046
+ src: i,
1047
1047
  alt: r,
1048
1048
  className: "ll-expanded__bg-img"
1049
1049
  }
1050
- ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Se = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Se.toUpperCase()) || "A" }) }),
1051
- i && !Le && /* @__PURE__ */ n(
1050
+ ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Ae = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Ae.toUpperCase()) || "A" }) }),
1051
+ o && !Ne && /* @__PURE__ */ n(
1052
1052
  "video",
1053
1053
  {
1054
1054
  className: "ll-expanded__bg-idle",
1055
- src: i,
1055
+ src: o,
1056
1056
  autoPlay: !0,
1057
1057
  loop: !0,
1058
1058
  muted: !0,
@@ -1060,24 +1060,24 @@ const Vn = ({
1060
1060
  }
1061
1061
  )
1062
1062
  ] }),
1063
- /* @__PURE__ */ n("div", { ref: Be, className: "ll-expanded__video" }),
1063
+ /* @__PURE__ */ n("div", { ref: se, className: "ll-expanded__video" }),
1064
1064
  L === "connecting" && /* @__PURE__ */ w("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1065
1065
  /* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
1066
1066
  /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: m ? "Switching..." : "Connecting..." })
1067
1067
  ] }),
1068
- I && Le && /* @__PURE__ */ w(
1068
+ I && Ne && /* @__PURE__ */ w(
1069
1069
  "button",
1070
1070
  {
1071
1071
  type: "button",
1072
1072
  className: "ll-expanded__overlay ll-expanded__overlay--gesture",
1073
- onClick: ve,
1073
+ onClick: xe,
1074
1074
  children: [
1075
1075
  /* @__PURE__ */ n("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("path", { d: "M3 9v6h4l5 5V4L7 9H3zm13.54.12a5 5 0 0 1 0 5.76l-1.41-1.41a3 3 0 0 0 0-2.94L16.54 9.12z" }) }),
1076
1076
  /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
1077
1077
  ]
1078
1078
  }
1079
1079
  ),
1080
- ke ? /* @__PURE__ */ w("div", { className: "ll-expanded__topbar", children: [
1080
+ Ee ? /* @__PURE__ */ w("div", { className: "ll-expanded__topbar", children: [
1081
1081
  /* @__PURE__ */ w("div", { className: "ll-expanded__topbar-left", children: [
1082
1082
  /* @__PURE__ */ w("div", { className: "ll-expanded__pill-wrap", children: [
1083
1083
  /* @__PURE__ */ w(
@@ -1086,17 +1086,17 @@ const Vn = ({
1086
1086
  type: "button",
1087
1087
  className: "ll-hpill",
1088
1088
  onClick: (y) => {
1089
- ie && (y.stopPropagation(), a());
1089
+ de && (y.stopPropagation(), a());
1090
1090
  },
1091
- "aria-haspopup": ie ? "listbox" : void 0,
1092
- "aria-expanded": ie ? h : void 0,
1091
+ "aria-haspopup": de ? "listbox" : void 0,
1092
+ "aria-expanded": de ? h : void 0,
1093
1093
  children: [
1094
1094
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
1095
- ie && /* @__PURE__ */ n(Xe, {})
1095
+ de && /* @__PURE__ */ n(Ke, {})
1096
1096
  ]
1097
1097
  }
1098
1098
  ),
1099
- ie && h && /* @__PURE__ */ n(
1099
+ de && h && /* @__PURE__ */ n(
1100
1100
  "div",
1101
1101
  {
1102
1102
  className: "ll-hmenu",
@@ -1107,7 +1107,7 @@ const Vn = ({
1107
1107
  {
1108
1108
  type: "button",
1109
1109
  className: `ll-hmenu__item ${y.id === u ? "is-active" : ""}`,
1110
- onClick: () => c(y.id),
1110
+ onClick: () => s(y.id),
1111
1111
  role: "option",
1112
1112
  "aria-selected": y.id === u,
1113
1113
  children: [
@@ -1143,7 +1143,7 @@ const Vn = ({
1143
1143
  title: "Language: English",
1144
1144
  children: [
1145
1145
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: "EN" }),
1146
- /* @__PURE__ */ n(Xe, {})
1146
+ /* @__PURE__ */ n(Ke, {})
1147
1147
  ]
1148
1148
  }
1149
1149
  ),
@@ -1201,7 +1201,7 @@ const Vn = ({
1201
1201
  ] }) : (
1202
1202
  // Idle-state header with Live Layer product name + minimize/close
1203
1203
  /* @__PURE__ */ w("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
1204
- /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Ie }),
1204
+ /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: De }),
1205
1205
  /* @__PURE__ */ w("div", { className: "ll-expanded__header-actions", children: [
1206
1206
  /* @__PURE__ */ n(
1207
1207
  "button",
@@ -1226,15 +1226,15 @@ const Vn = ({
1226
1226
  ] })
1227
1227
  ] })
1228
1228
  ),
1229
- fe && /* @__PURE__ */ (() => {
1230
- const y = z ? "Restart paused session" : L === "disconnected" ? "Reconnect to agent" : "Start video call", K = z ? "Pick up where you left off" : null;
1229
+ be && /* @__PURE__ */ (() => {
1230
+ const y = H ? "Restart paused session" : L === "disconnected" ? "Reconnect to agent" : "Start video call", J = H ? "Pick up where you left off" : null;
1231
1231
  return /* @__PURE__ */ w(ut, { children: [
1232
- L === "idle" && !z && !H && /* @__PURE__ */ w(
1232
+ L === "idle" && !H && !O && /* @__PURE__ */ w(
1233
1233
  "button",
1234
1234
  {
1235
1235
  type: "button",
1236
1236
  className: "ll-expanded__play",
1237
- onClick: me,
1237
+ onClick: re,
1238
1238
  "aria-label": y,
1239
1239
  children: [
1240
1240
  /* @__PURE__ */ n("div", { className: "ll-expanded__play-circle", children: /* @__PURE__ */ n("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("polygon", { points: "6 3 20 12 6 21 6 3" }) }) }),
@@ -1244,13 +1244,13 @@ const Vn = ({
1244
1244
  ),
1245
1245
  /* @__PURE__ */ w("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
1246
1246
  l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
1247
- K && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: K }),
1247
+ J && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: J }),
1248
1248
  /* @__PURE__ */ n(
1249
1249
  "button",
1250
1250
  {
1251
1251
  type: "button",
1252
1252
  className: "ll-expanded__cta",
1253
- onClick: me,
1253
+ onClick: re,
1254
1254
  "aria-label": y,
1255
1255
  children: y
1256
1256
  }
@@ -1261,48 +1261,48 @@ const Vn = ({
1261
1261
  /* @__PURE__ */ w(
1262
1262
  "div",
1263
1263
  {
1264
- className: `ll-expanded__pip ${ke && (D || V) ? "is-visible" : ""}`,
1264
+ className: `ll-expanded__pip ${Ee && ($ || V) ? "is-visible" : ""}`,
1265
1265
  children: [
1266
1266
  /* @__PURE__ */ n(
1267
1267
  "div",
1268
1268
  {
1269
- ref: Re,
1269
+ ref: Pe,
1270
1270
  className: V ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1271
1271
  }
1272
1272
  ),
1273
1273
  /* @__PURE__ */ n(
1274
1274
  "div",
1275
1275
  {
1276
- ref: J,
1277
- className: !V && D ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1276
+ ref: G,
1277
+ className: !V && $ ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1278
1278
  }
1279
1279
  )
1280
1280
  ]
1281
1281
  }
1282
1282
  ),
1283
- ke ? /* @__PURE__ */ w("div", { className: "ll-expanded__bottom", children: [
1283
+ Ee ? /* @__PURE__ */ w("div", { className: "ll-expanded__bottom", children: [
1284
1284
  Ve && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Ve }) }),
1285
1285
  /* @__PURE__ */ w("div", { className: "ll-toolbar", onClick: (y) => y.stopPropagation(), children: [
1286
- Oe && /* @__PURE__ */ n(
1286
+ ae && /* @__PURE__ */ n(
1287
1287
  "button",
1288
1288
  {
1289
1289
  type: "button",
1290
1290
  className: `ll-tool ${V ? "is-on" : ""}`,
1291
- onClick: xe,
1291
+ onClick: Ce,
1292
1292
  "aria-label": V ? "Stop sharing screen" : "Share screen",
1293
1293
  title: V ? "Stop sharing" : "Share screen",
1294
- children: /* @__PURE__ */ n(Xn, {})
1294
+ children: /* @__PURE__ */ n(Kn, {})
1295
1295
  }
1296
1296
  ),
1297
- He && /* @__PURE__ */ w("div", { className: "ll-tool-split", children: [
1297
+ ve && /* @__PURE__ */ w("div", { className: "ll-tool-split", children: [
1298
1298
  /* @__PURE__ */ n(
1299
1299
  "button",
1300
1300
  {
1301
1301
  type: "button",
1302
- className: `ll-tool ll-tool--left ${D ? "is-on" : ""}`,
1303
- onClick: we,
1304
- "aria-label": D ? "Turn off camera" : "Turn on camera",
1305
- title: D ? "Stop camera" : "Start camera",
1302
+ className: `ll-tool ll-tool--left ${$ ? "is-on" : ""}`,
1303
+ onClick: Le,
1304
+ "aria-label": $ ? "Turn off camera" : "Turn on camera",
1305
+ title: $ ? "Stop camera" : "Start camera",
1306
1306
  children: /* @__PURE__ */ n(Qn, {})
1307
1307
  }
1308
1308
  ),
@@ -1310,24 +1310,24 @@ const Vn = ({
1310
1310
  "button",
1311
1311
  {
1312
1312
  type: "button",
1313
- className: `ll-tool ll-tool--right ${D ? "is-on" : ""}`,
1313
+ className: `ll-tool ll-tool--right ${$ ? "is-on" : ""}`,
1314
1314
  onClick: (y) => {
1315
- y.stopPropagation(), ce((K) => !K), ee(!1);
1315
+ y.stopPropagation(), me((J) => !J), te(!1);
1316
1316
  },
1317
1317
  "aria-label": "Camera devices",
1318
1318
  "aria-haspopup": "listbox",
1319
- "aria-expanded": le,
1320
- children: /* @__PURE__ */ n(Xe, {})
1319
+ "aria-expanded": ue,
1320
+ children: /* @__PURE__ */ n(Ke, {})
1321
1321
  }
1322
1322
  ),
1323
- le && O.length > 0 && /* @__PURE__ */ n(
1323
+ ue && T.length > 0 && /* @__PURE__ */ n(
1324
1324
  Ot,
1325
1325
  {
1326
1326
  label: "Camera",
1327
- devices: O,
1327
+ devices: T,
1328
1328
  activeId: W,
1329
1329
  onPick: (y) => {
1330
- ce(!1), _e(y);
1330
+ me(!1), Se(y);
1331
1331
  }
1332
1332
  }
1333
1333
  )
@@ -1338,7 +1338,7 @@ const Vn = ({
1338
1338
  {
1339
1339
  type: "button",
1340
1340
  className: `ll-tool ll-tool--left ${p ? "is-muted" : ""}`,
1341
- onClick: be,
1341
+ onClick: ke,
1342
1342
  "aria-label": p ? "Unmute microphone" : "Mute microphone",
1343
1343
  title: p ? "Unmute" : "Mute",
1344
1344
  children: /* @__PURE__ */ n(Zn, { muted: p })
@@ -1350,21 +1350,21 @@ const Vn = ({
1350
1350
  type: "button",
1351
1351
  className: `ll-tool ll-tool--right ${p ? "is-muted" : ""}`,
1352
1352
  onClick: (y) => {
1353
- y.stopPropagation(), ee((K) => !K), ce(!1);
1353
+ y.stopPropagation(), te((J) => !J), me(!1);
1354
1354
  },
1355
1355
  "aria-label": "Microphone devices",
1356
1356
  "aria-haspopup": "listbox",
1357
- "aria-expanded": ne,
1358
- children: /* @__PURE__ */ n(Xe, {})
1357
+ "aria-expanded": ie,
1358
+ children: /* @__PURE__ */ n(Ke, {})
1359
1359
  }
1360
1360
  ),
1361
- ne && B.length > 0 && /* @__PURE__ */ n(
1361
+ ie && B.length > 0 && /* @__PURE__ */ n(
1362
1362
  Ot,
1363
1363
  {
1364
1364
  label: "Microphone",
1365
1365
  devices: B,
1366
1366
  activeId: "",
1367
- onPick: () => ee(!1)
1367
+ onPick: () => te(!1)
1368
1368
  }
1369
1369
  )
1370
1370
  ] }),
@@ -1372,15 +1372,15 @@ const Vn = ({
1372
1372
  "button",
1373
1373
  {
1374
1374
  type: "button",
1375
- className: `ll-tool ${ue ? "is-muted" : ""}`,
1375
+ className: `ll-tool ${ee ? "is-muted" : ""}`,
1376
1376
  onClick: j,
1377
- "aria-label": ue ? "Unmute speaker" : "Mute speaker",
1378
- title: ue ? "Unmute speaker" : "Mute speaker",
1379
- children: /* @__PURE__ */ n(er, { muted: ue })
1377
+ "aria-label": ee ? "Unmute speaker" : "Mute speaker",
1378
+ title: ee ? "Unmute speaker" : "Mute speaker",
1379
+ children: /* @__PURE__ */ n(er, { muted: ee })
1380
1380
  }
1381
1381
  )
1382
1382
  ] }),
1383
- qe && /* @__PURE__ */ w("form", { className: "ll-message-input", onSubmit: pe, children: [
1383
+ pe && /* @__PURE__ */ w("form", { className: "ll-message-input", onSubmit: we, children: [
1384
1384
  /* @__PURE__ */ n(
1385
1385
  "input",
1386
1386
  {
@@ -1388,7 +1388,7 @@ const Vn = ({
1388
1388
  className: "ll-message-input__field",
1389
1389
  placeholder: "Message...",
1390
1390
  value: Q,
1391
- onChange: (y) => re(y.target.value),
1391
+ onChange: (y) => oe(y.target.value),
1392
1392
  "aria-label": "Message the agent"
1393
1393
  }
1394
1394
  ),
@@ -1407,7 +1407,7 @@ const Vn = ({
1407
1407
  {
1408
1408
  type: "button",
1409
1409
  className: "ll-expanded__end",
1410
- onClick: ge,
1410
+ onClick: ce,
1411
1411
  children: "End conversation"
1412
1412
  }
1413
1413
  )
@@ -1427,17 +1427,17 @@ const Vn = ({
1427
1427
  }
1428
1428
  )
1429
1429
  ] });
1430
- if (!H || L !== "error") return null;
1431
- let y = "Failed to connect", K = "Try again";
1432
- return H === "MIC_PERMISSION_DENIED" ? y = "Microphone blocked. Allow access to talk." : H === "MIC_NOT_FOUND" ? y = "No microphone found. Plug one in + retry." : H === "MIC_UNAVAILABLE" ? y = "Mic unavailable. Check other apps using it." : H === "AGENT_TIMEOUT" ? y = "Agent didn't pick up. Try again." : H === "CONNECT_FAILED" ? y = "Connection failed. Check your network." : H.length < 80 && (y = H), /* @__PURE__ */ w("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1430
+ if (!O || L !== "error") return null;
1431
+ let y = "Failed to connect", J = "Try again";
1432
+ return O === "MIC_PERMISSION_DENIED" ? y = "Microphone blocked. Allow access to talk." : O === "MIC_NOT_FOUND" ? y = "No microphone found. Plug one in + retry." : O === "MIC_UNAVAILABLE" ? y = "Mic unavailable. Check other apps using it." : O === "AGENT_TIMEOUT" ? y = "Agent didn't pick up. Try again." : O === "CONNECT_FAILED" ? y = "Connection failed. Check your network." : O.length < 80 && (y = O), /* @__PURE__ */ w("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1433
1433
  /* @__PURE__ */ n("span", { children: y }),
1434
1434
  /* @__PURE__ */ n(
1435
1435
  "button",
1436
1436
  {
1437
1437
  type: "button",
1438
1438
  className: "ll-expanded__banner-retry",
1439
- onClick: ye,
1440
- children: K
1439
+ onClick: _e,
1440
+ children: J
1441
1441
  }
1442
1442
  )
1443
1443
  ] });
@@ -1446,7 +1446,7 @@ const Vn = ({
1446
1446
  }
1447
1447
  );
1448
1448
  };
1449
- function Xe() {
1449
+ function Ke() {
1450
1450
  return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ n("polyline", { points: "6 9 12 15 18 9" }) });
1451
1451
  }
1452
1452
  function zt() {
@@ -1458,7 +1458,7 @@ function zt() {
1458
1458
  function Ht() {
1459
1459
  return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
1460
1460
  }
1461
- function Xn() {
1461
+ function Kn() {
1462
1462
  return /* @__PURE__ */ w("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1463
1463
  /* @__PURE__ */ n("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
1464
1464
  /* @__PURE__ */ n("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
@@ -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: o }) => /* @__PURE__ */ w(
1497
+ const Ot = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */ w(
1498
1498
  "div",
1499
1499
  {
1500
1500
  className: "ll-device-menu",
1501
- onClick: (i) => i.stopPropagation(),
1501
+ onClick: (o) => o.stopPropagation(),
1502
1502
  role: "listbox",
1503
1503
  children: [
1504
1504
  /* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
1505
- t.map((i, l) => {
1506
- const s = r === i.deviceId;
1505
+ t.map((o, l) => {
1506
+ const c = r === o.deviceId;
1507
1507
  return /* @__PURE__ */ w(
1508
1508
  "button",
1509
1509
  {
1510
1510
  type: "button",
1511
- className: `ll-device-menu__item ${s ? "is-active" : ""}`,
1512
- onClick: () => o(i.deviceId),
1511
+ className: `ll-device-menu__item ${c ? "is-active" : ""}`,
1512
+ onClick: () => i(o.deviceId),
1513
1513
  role: "option",
1514
- "aria-selected": s,
1514
+ "aria-selected": c,
1515
1515
  children: [
1516
- s && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1517
- /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: i.label || `${e} ${l + 1}` })
1516
+ c && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1517
+ /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: o.label || `${e} ${l + 1}` })
1518
1518
  ]
1519
1519
  },
1520
- i.deviceId || l
1520
+ o.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, or = 20, ir = 10, lr = 10, ar = 30, qt = 500, cr = [
1547
+ const Qe = 4096, rr = 20, ir = 20, or = 10, lr = 10, ar = 30, sr = 20, qt = 500, cr = [
1548
1548
  '[data-ll-private="true"]',
1549
1549
  ".ll-widget",
1550
1550
  "script",
@@ -1552,7 +1552,7 @@ const Qe = 4096, rr = 20, or = 20, ir = 10, lr = 10, ar = 30, qt = 500, cr = [
1552
1552
  "noscript",
1553
1553
  "iframe"
1554
1554
  ];
1555
- function $e(e) {
1555
+ function qe(e) {
1556
1556
  if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
1557
1557
  let t = e;
1558
1558
  for (; t; ) {
@@ -1562,12 +1562,12 @@ function $e(e) {
1562
1562
  }
1563
1563
  return !1;
1564
1564
  }
1565
- function ze(e) {
1565
+ function Be(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, o = window.innerWidth || document.documentElement.clientWidth;
1570
- return t.bottom > 0 && t.right > 0 && t.top < r && t.left < o;
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;
1571
1571
  }
1572
1572
  function Bt(e) {
1573
1573
  const t = e.getAttribute("id");
@@ -1577,18 +1577,18 @@ function Bt(e) {
1577
1577
  }
1578
1578
  const r = e.getAttribute("aria-label");
1579
1579
  if (r) return r.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() : "";
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() : "";
1584
1584
  }
1585
- function he(e, t) {
1585
+ function fe(e, t) {
1586
1586
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
1587
1587
  }
1588
- function Ee(e) {
1588
+ function Ie(e) {
1589
1589
  return e.length;
1590
1590
  }
1591
- function sr(e, t = {}) {
1591
+ function dr(e, t = {}) {
1592
1592
  const r = t.doc ?? (typeof document < "u" ? document : null);
1593
1593
  if (!r)
1594
1594
  return {
@@ -1602,39 +1602,39 @@ function sr(e, t = {}) {
1602
1602
  forms: [],
1603
1603
  extras: e
1604
1604
  };
1605
- const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "", s = Array.from(
1605
+ const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "", c = Array.from(
1606
1606
  r.querySelectorAll("[data-ll-region]")
1607
1607
  ), d = [];
1608
- for (const p of s) {
1609
- if (d.length >= ir) break;
1610
- if ($e(p) || !ze(p)) continue;
1611
- const N = p.getAttribute("data-ll-region") ?? "", B = p.getAttribute("data-ll-intent") ?? void 0, D = he(
1608
+ for (const p of c) {
1609
+ if (d.length >= or) break;
1610
+ if (qe(p) || !Be(p)) continue;
1611
+ const N = p.getAttribute("data-ll-region") ?? "", B = p.getAttribute("data-ll-intent") ?? void 0, $ = fe(
1612
1612
  (p.innerText || p.textContent || "").trim(),
1613
1613
  qt * 2
1614
1614
  );
1615
- !N || !D || d.push({ id: N, intent: B, text: D });
1615
+ !N || !$ || d.push({ id: N, intent: B, text: $ });
1616
1616
  }
1617
1617
  const u = [], m = ["H1", "H2", "H3", "H4", "H5", "H6"], h = Array.from(
1618
1618
  r.querySelectorAll("h1, h2, h3, h4, h5, h6")
1619
1619
  );
1620
1620
  for (const p of h) {
1621
- if ($e(p) || !ze(p)) continue;
1621
+ if (qe(p) || !Be(p)) continue;
1622
1622
  const N = (p.textContent || "").trim();
1623
- N && u.push(`${p.tagName}: ${he(N, 200)}`);
1623
+ N && u.push(`${p.tagName}: ${fe(N, 200)}`);
1624
1624
  }
1625
1625
  const a = Array.from(r.querySelectorAll("p, li"));
1626
1626
  for (const p of a) {
1627
- if ($e(p) || !ze(p) || m.includes(p.tagName)) continue;
1627
+ if (qe(p) || !Be(p) || m.includes(p.tagName)) continue;
1628
1628
  const N = (p.textContent || "").trim();
1629
- N.length > 10 && u.push(he(N, qt));
1629
+ N.length > 10 && u.push(fe(N, qt));
1630
1630
  }
1631
- const c = u.join(`
1631
+ const s = u.join(`
1632
1632
  `), R = [], C = Array.from(r.querySelectorAll("a[href]"));
1633
1633
  for (const p of C) {
1634
1634
  if (R.length >= rr) break;
1635
- if ($e(p) || !ze(p)) continue;
1635
+ if (qe(p) || !Be(p)) continue;
1636
1636
  const N = p.getAttribute("href") || "", B = (p.textContent || "").trim();
1637
- !N || !B || R.push({ href: N, text: he(B, 100) });
1637
+ !N || !B || R.push({ href: N, text: fe(B, 100) });
1638
1638
  }
1639
1639
  const L = [], v = Array.from(
1640
1640
  r.querySelectorAll(
@@ -1642,65 +1642,80 @@ function sr(e, t = {}) {
1642
1642
  )
1643
1643
  );
1644
1644
  for (const p of v) {
1645
- if (L.length >= or) break;
1646
- if ($e(p) || !tt(p) || !ze(p)) continue;
1645
+ if (L.length >= ir) break;
1646
+ if (qe(p) || !tt(p) || !Be(p)) continue;
1647
1647
  const N = Bt(p), B = p instanceof HTMLInputElement ? p.type : p.tagName.toLowerCase();
1648
- N && L.push({ label: he(N, 100), type: B });
1648
+ N && L.push({ label: fe(N, 100), type: B });
1649
1649
  }
1650
1650
  const b = Array.from(
1651
1651
  r.querySelectorAll("[data-ll-form]")
1652
- ), z = [];
1652
+ ), H = [];
1653
1653
  for (const p of b) {
1654
- if (z.length >= lr) break;
1654
+ if (H.length >= lr) break;
1655
1655
  if (pt(p)) continue;
1656
1656
  const N = p.getAttribute("data-ll-form") || "";
1657
1657
  if (!N) continue;
1658
- const B = p.getAttribute("data-ll-intent") || void 0, D = Array.from(
1658
+ const B = p.getAttribute("data-ll-intent") || void 0, $ = Array.from(
1659
1659
  p.querySelectorAll(
1660
1660
  "[data-ll-field]"
1661
1661
  )
1662
1662
  ), A = [];
1663
- for (const O of D) {
1663
+ for (const T of $) {
1664
1664
  if (A.length >= ar) break;
1665
- if (!tt(O)) continue;
1666
- const W = O.getAttribute("data-ll-field") || "";
1665
+ if (!tt(T)) continue;
1666
+ const W = T.getAttribute("data-ll-field") || "";
1667
1667
  if (!W) continue;
1668
- const V = Bt(O) || W, te = O instanceof HTMLInputElement ? O.type : O.tagName.toLowerCase();
1669
- A.push({ name: W, label: he(V, 100), type: te });
1668
+ const V = Bt(T) || W, ne = T instanceof HTMLInputElement ? T.type : T.tagName.toLowerCase(), ee = {
1669
+ name: W,
1670
+ label: fe(V, 100),
1671
+ type: ne
1672
+ };
1673
+ if (T.required === !0 && (ee.required = !0), T instanceof HTMLSelectElement) {
1674
+ const ae = [];
1675
+ for (let pe = 0; pe < T.options.length && !(ae.length >= sr); pe++) {
1676
+ const se = T.options[pe];
1677
+ if (!se || se.disabled) continue;
1678
+ const re = se.value || "", ce = (se.textContent || "").trim() || re;
1679
+ !re && !ce || ae.push({ value: re, label: fe(ce, 60) });
1680
+ }
1681
+ ae.length > 0 && (ee.options = ae);
1682
+ }
1683
+ const ve = typeof T.validationMessage == "string" ? T.validationMessage : "";
1684
+ ve && (ee.validationMessage = fe(ve, 200)), A.push(ee);
1670
1685
  }
1671
- z.push({ id: N, intent: B, fields: A });
1686
+ H.push({ id: N, intent: B, fields: A });
1672
1687
  }
1673
1688
  const I = {
1674
- url: o,
1689
+ url: i,
1675
1690
  title: l,
1676
- pathname: i,
1691
+ pathname: o,
1677
1692
  regions: d,
1678
- visibleText: c,
1693
+ visibleText: s,
1679
1694
  visibleLinks: R,
1680
1695
  visibleFields: L,
1681
- forms: z,
1696
+ forms: H,
1682
1697
  extras: e
1683
1698
  };
1684
- let H = Ee(JSON.stringify(I.regions)) + Ee(I.visibleText) + Ee(JSON.stringify(I.visibleLinks)) + Ee(JSON.stringify(I.visibleFields));
1685
- for (; H > Qe && I.visibleFields.length > 0; )
1686
- I.visibleFields.pop(), H = Ee(JSON.stringify(I.visibleFields));
1687
- for (; H > Qe && I.visibleLinks.length > 0; )
1688
- I.visibleLinks.pop(), H -= 80;
1689
- return Ee(I.visibleText) > Qe && (I.visibleText = he(I.visibleText, Qe - 100)), I;
1690
- }
1691
- let Ne = null;
1699
+ let O = Ie(JSON.stringify(I.regions)) + Ie(I.visibleText) + Ie(JSON.stringify(I.visibleLinks)) + Ie(JSON.stringify(I.visibleFields));
1700
+ for (; O > Qe && I.visibleFields.length > 0; )
1701
+ I.visibleFields.pop(), O = Ie(JSON.stringify(I.visibleFields));
1702
+ for (; O > Qe && I.visibleLinks.length > 0; )
1703
+ I.visibleLinks.pop(), O -= 80;
1704
+ return Ie(I.visibleText) > Qe && (I.visibleText = fe(I.visibleText, Qe - 100)), I;
1705
+ }
1706
+ let Me = null;
1692
1707
  function Wt(e, t = {}) {
1693
- const r = Date.now(), i = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
1694
- if (Ne && Ne.key === i && r - Ne.at < 1e3)
1695
- return Ne.ctx;
1696
- const l = sr(e, t);
1697
- return Ne = { key: i, at: r, ctx: l }, l;
1708
+ const r = Date.now(), o = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
1709
+ if (Me && Me.key === o && r - Me.at < 1e3)
1710
+ return Me.ctx;
1711
+ const l = dr(e, t);
1712
+ return Me = { key: o, at: r, ctx: l }, l;
1698
1713
  }
1699
- function dr() {
1700
- Ne = null;
1714
+ function ur() {
1715
+ Me = null;
1701
1716
  }
1702
- const ur = 200;
1703
- function fr(e) {
1717
+ const fr = 200;
1718
+ function pr(e) {
1704
1719
  const t = String(e.href || "");
1705
1720
  return {
1706
1721
  href: t,
@@ -1710,18 +1725,18 @@ function fr(e) {
1710
1725
  description: e.description
1711
1726
  };
1712
1727
  }
1713
- function pr(e) {
1728
+ function hr(e) {
1714
1729
  return !(!e || e.startsWith("#") || e.startsWith("javascript:") || e.startsWith("mailto:") || e.startsWith("tel:"));
1715
1730
  }
1716
- function hr(e) {
1731
+ function mr(e) {
1717
1732
  const t = e ?? (typeof document < "u" ? document : null);
1718
1733
  if (!t) return [];
1719
- const r = typeof window < "u" && window.location.origin || "", o = /* @__PURE__ */ new Set(), i = [], l = Array.from(t.querySelectorAll("a[href]"));
1720
- for (const s of l) {
1721
- if (i.length >= ur) break;
1722
- if (pt(s)) continue;
1723
- const d = s.getAttribute("href") || "";
1724
- if (!pr(d)) continue;
1734
+ const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), o = [], l = Array.from(t.querySelectorAll("a[href]"));
1735
+ for (const c of l) {
1736
+ if (o.length >= fr) break;
1737
+ if (pt(c)) continue;
1738
+ const d = c.getAttribute("href") || "";
1739
+ if (!hr(d)) continue;
1725
1740
  let u = d, m = !0;
1726
1741
  try {
1727
1742
  if (typeof window < "u") {
@@ -1731,42 +1746,42 @@ function hr(e) {
1731
1746
  } catch {
1732
1747
  continue;
1733
1748
  }
1734
- if (o.has(u)) continue;
1735
- o.add(u);
1736
- const h = (s.textContent || "").trim().slice(0, 120);
1737
- i.push({ href: u, text: h, internal: m });
1749
+ if (i.has(u)) continue;
1750
+ i.add(u);
1751
+ const h = (c.textContent || "").trim().slice(0, 120);
1752
+ o.push({ href: u, text: h, internal: m });
1738
1753
  }
1739
- return i;
1754
+ return o;
1740
1755
  }
1741
- let Ae = null;
1742
- const mr = 5e3;
1743
- function st() {
1756
+ let Te = null;
1757
+ const gr = 5e3;
1758
+ function ct() {
1744
1759
  const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
1745
- if (Ae && Ae.pathname === t && e - Ae.at < mr)
1746
- return Ae.routes;
1747
- const r = hr();
1748
- return Ae = { at: e, pathname: t, routes: r }, r;
1760
+ if (Te && Te.pathname === t && e - Te.at < gr)
1761
+ return Te.routes;
1762
+ const r = mr();
1763
+ return Te = { at: e, pathname: t, routes: r }, r;
1749
1764
  }
1750
- function gr() {
1751
- Ae = null;
1765
+ function yr() {
1766
+ Te = null;
1752
1767
  }
1753
- function yr(e, 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;
1768
+ function vr(e, t) {
1769
+ 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;
1770
+ o ? o.call(e, t) : e.value = t;
1756
1771
  }
1757
- function vr(e, t, r = {}) {
1758
- const o = r.triggerInput ?? !0, i = r.triggerChange ?? !0;
1772
+ function br(e, t, r = {}) {
1773
+ const i = r.triggerInput ?? !0, o = r.triggerChange ?? !0;
1759
1774
  if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
1760
1775
  const l = Object.getOwnPropertyDescriptor(
1761
1776
  HTMLInputElement.prototype,
1762
1777
  "checked"
1763
- ), s = l == null ? void 0 : l.set, d = t === "true" || t === "1" || t === "on";
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 }));
1778
+ ), c = l == null ? void 0 : l.set, d = t === "true" || t === "1" || t === "on";
1779
+ c ? c.call(e, d) : e.checked = d, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1765
1780
  return;
1766
1781
  }
1767
- yr(e, t), o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1782
+ vr(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1768
1783
  }
1769
- function br() {
1784
+ function wr() {
1770
1785
  if (typeof window > "u" || typeof document > "u")
1771
1786
  return !1;
1772
1787
  const e = document.scrollingElement || document.documentElement;
@@ -1774,44 +1789,44 @@ function br() {
1774
1789
  const t = window.getComputedStyle(e);
1775
1790
  return !(t.overflowY === "hidden" || t.overflowY === "clip");
1776
1791
  }
1777
- function wr(e) {
1792
+ function _r(e) {
1778
1793
  if (!(e instanceof HTMLElement)) return !1;
1779
1794
  const r = window.getComputedStyle(e).overflowY;
1780
1795
  return !(r !== "auto" && r !== "scroll" || e.scrollHeight <= e.clientHeight + 2);
1781
1796
  }
1782
- function _r() {
1797
+ function xr() {
1783
1798
  if (typeof document > "u") return null;
1784
1799
  const e = Array.from(
1785
1800
  document.querySelectorAll("body, body *")
1786
1801
  );
1787
1802
  let t = null, r = 0;
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);
1803
+ for (const i of e) {
1804
+ if (!_r(i)) continue;
1805
+ const o = i.getBoundingClientRect();
1806
+ 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;
1807
+ const l = o.width * o.height;
1808
+ l > r && (r = l, t = i);
1794
1809
  }
1795
1810
  return t;
1796
1811
  }
1797
- function xr() {
1812
+ function kr() {
1798
1813
  if (typeof window > "u")
1799
1814
  return null;
1800
- if (br()) return window;
1801
- const e = _r();
1815
+ if (wr()) return window;
1816
+ const e = xr();
1802
1817
  return e || window;
1803
1818
  }
1804
1819
  function Ft(e) {
1805
1820
  return e instanceof Window ? e.innerHeight || 0 : e.clientHeight || 0;
1806
1821
  }
1807
- function kr(e) {
1822
+ function Lr(e) {
1808
1823
  var t, r;
1809
1824
  return e instanceof Window ? typeof document > "u" ? 0 : Math.max(
1810
1825
  ((t = document.body) == null ? void 0 : t.scrollHeight) ?? 0,
1811
1826
  ((r = document.documentElement) == null ? void 0 : r.scrollHeight) ?? 0
1812
1827
  ) : e.scrollHeight - e.clientHeight;
1813
1828
  }
1814
- const Lr = /* @__PURE__ */ new Set([
1829
+ const Sr = /* @__PURE__ */ new Set([
1815
1830
  "agent_state",
1816
1831
  "avatar_stream_ready",
1817
1832
  "avatar_active",
@@ -1834,90 +1849,90 @@ const Lr = /* @__PURE__ */ new Set([
1834
1849
  "submit_form",
1835
1850
  "request_routes"
1836
1851
  ]);
1837
- function Sr(e) {
1852
+ function Cr(e) {
1838
1853
  var wt, _t, xt, kt, Lt, St, Ct;
1839
1854
  const {
1840
1855
  agentId: t,
1841
1856
  apiKey: r,
1842
- baseUrl: o = "https://app.livelayer.studio",
1843
- sessionEndpoint: i,
1857
+ baseUrl: i = "https://app.livelayer.studio",
1858
+ sessionEndpoint: o,
1844
1859
  sessionBody: l,
1845
- autoConnect: s = !1,
1860
+ autoConnect: c = !1,
1846
1861
  displayMode: d,
1847
1862
  defaultDisplayMode: u = "expanded",
1848
1863
  onDisplayModeChange: m,
1849
1864
  position: h = "bottom-right",
1850
1865
  mobileBreakpoint: a = 640,
1851
- persistKey: c = "ll-widget",
1866
+ persistKey: s = "ll-widget",
1852
1867
  disablePersistence: R = !1,
1853
1868
  teamMembers: C,
1854
1869
  currentTeamMemberId: L,
1855
1870
  onTeamMemberChange: v,
1856
1871
  idleLoopUrl: b,
1857
- greeting: z,
1872
+ greeting: H,
1858
1873
  avatarImageUrl: I,
1859
- agentName: H,
1874
+ agentName: O,
1860
1875
  branding: p = {},
1861
1876
  allowCamera: N = !0,
1862
1877
  allowScreenShare: B = !0,
1863
- allowTyping: D = !0,
1878
+ allowTyping: $ = !0,
1864
1879
  showOn: A,
1865
- hideOn: O,
1880
+ hideOn: T,
1866
1881
  pathname: W,
1867
1882
  onNavigate: V,
1868
- onScrollToSelector: te,
1869
- getPageContext: ue,
1870
- pageContextExtras: He,
1871
- getRoutes: Oe,
1872
- onScrollPage: qe,
1873
- onClick: Be,
1874
- capabilities: me,
1875
- onConnect: ge,
1876
- onDisconnect: ye,
1877
- onTranscript: ve,
1878
- onAgentState: be,
1879
- onConnectionStateChange: we,
1880
- onAgentEvent: _e,
1881
- onAgentCommand: xe,
1883
+ onScrollToSelector: ne,
1884
+ getPageContext: ee,
1885
+ pageContextExtras: ve,
1886
+ getRoutes: ae,
1887
+ onScrollPage: pe,
1888
+ onClick: se,
1889
+ capabilities: re,
1890
+ onConnect: ce,
1891
+ onDisconnect: _e,
1892
+ onTranscript: xe,
1893
+ onAgentState: ke,
1894
+ onConnectionStateChange: Le,
1895
+ onAgentEvent: Se,
1896
+ onAgentCommand: Ce,
1882
1897
  controlledSession: j,
1883
1898
  className: We,
1884
1899
  style: Fe,
1885
1900
  zIndex: Ue = 2147483647
1886
- } = e, je = Tn(W), ae = qn(je, A, O);
1887
- T(() => {
1888
- dr(), gr();
1901
+ } = e, je = Tn(W), he = qn(je, A, T);
1902
+ P(() => {
1903
+ ur(), yr();
1889
1904
  }, [je]);
1890
- const ie = L !== void 0, [ke, Le] = S(() => {
1905
+ const de = L !== void 0, [Ee, Ne] = S(() => {
1891
1906
  var g;
1892
1907
  return L ?? ((g = C == null ? void 0 : C[0]) == null ? void 0 : g.id);
1893
- }), fe = ie ? L : ke, J = Ze(
1894
- () => (C == null ? void 0 : C.find((g) => g.id === fe)) ?? null,
1895
- [C, fe]
1896
- ), Re = (J == null ? void 0 : J.agentId) ?? t, [ne, ee] = An({
1908
+ }), be = de ? L : Ee, G = Ze(
1909
+ () => (C == null ? void 0 : C.find((g) => g.id === be)) ?? null,
1910
+ [C, be]
1911
+ ), Pe = (G == null ? void 0 : G.agentId) ?? t, [ie, te] = An({
1897
1912
  value: d,
1898
1913
  defaultValue: u,
1899
1914
  onChange: m,
1900
- persistKey: c,
1915
+ persistKey: s,
1901
1916
  disablePersistence: R
1902
- }), le = In(a), ce = yn(), Q = vn(), re = wn(), pe = _n(), Ie = xn(), [Ve, Me] = S(!1), [Se, y] = S(!1), [K, Ye] = S(!1), [Yt, Gt] = S(!1), [nt, Jt] = S(!1), rt = E(V), ot = E(te), it = E(qe), lt = E(Be), ht = E(ue), mt = E(He), gt = E(Oe), at = E(me), oe = E(null);
1903
- rt.current = V, ot.current = te, it.current = qe, lt.current = Be, ht.current = ue, mt.current = He, gt.current = Oe, at.current = me;
1904
- function se(g) {
1917
+ }), ue = In(a), me = yn(), Q = vn(), oe = wn(), we = _n(), De = xn(), [Ve, $e] = S(!1), [Ae, y] = S(!1), [J, Ye] = S(!1), [Yt, Xt] = S(!1), [nt, Gt] = S(!1), rt = E(V), it = E(ne), ot = E(pe), lt = E(se), ht = E(ee), mt = E(ve), gt = E(ae), at = E(re), le = E(null);
1918
+ rt.current = V, it.current = ne, ot.current = pe, lt.current = se, ht.current = ee, mt.current = ve, gt.current = ae, at.current = re;
1919
+ function ge(g) {
1905
1920
  const f = at.current;
1906
1921
  return f ? f.includes(g) : !0;
1907
1922
  }
1908
- function de(g, f) {
1923
+ function ye(g, f) {
1909
1924
  console.warn(
1910
1925
  `[LiveLayer] Agent command "${g}" blocked — capability "${f}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
1911
1926
  );
1912
1927
  }
1913
- const Te = k(
1928
+ const ze = k(
1914
1929
  (g) => {
1915
- var Z, Je, Ke, Et;
1930
+ var Z, Ge, Je, Et;
1916
1931
  const f = g;
1917
1932
  if (!(!f.type || typeof f.type != "string")) {
1918
- if (_e == null || _e({ eventName: f.type, data: g }), f.type === "navigate") {
1919
- if (!se("navigate")) {
1920
- de("navigate", "navigate");
1933
+ if (Se == null || Se({ eventName: f.type, data: g }), f.type === "navigate") {
1934
+ if (!ge("navigate")) {
1935
+ ye("navigate", "navigate");
1921
1936
  return;
1922
1937
  }
1923
1938
  const x = typeof f.href == "string" ? f.href : null;
@@ -1959,16 +1974,16 @@ function Sr(e) {
1959
1974
  return;
1960
1975
  }
1961
1976
  if (f.type === "scroll_to") {
1962
- if (!se("scroll")) {
1963
- de("scroll_to", "scroll");
1977
+ if (!ge("scroll")) {
1978
+ ye("scroll_to", "scroll");
1964
1979
  return;
1965
1980
  }
1966
1981
  const x = typeof f.selector == "string" ? f.selector : null;
1967
1982
  if (!x) return;
1968
1983
  const M = f.behavior === "instant" ? "instant" : "smooth";
1969
- if (ot.current) {
1984
+ if (it.current) {
1970
1985
  try {
1971
- ot.current(
1986
+ it.current(
1972
1987
  x,
1973
1988
  M
1974
1989
  );
@@ -2001,31 +2016,31 @@ function Sr(e) {
2001
2016
  return;
2002
2017
  }
2003
2018
  if (f.type === "request_page_context") {
2004
- if (!se("read_page")) {
2005
- de("request_page_context", "read_page");
2019
+ if (!ge("read_page")) {
2020
+ ye("request_page_context", "read_page");
2006
2021
  return;
2007
2022
  }
2008
- const x = typeof f.requestId == "string" ? f.requestId : void 0, M = (Z = oe.current) == null ? void 0 : Z.call(oe), q = (U) => {
2009
- const P = M, G = P == null ? void 0 : P.localParticipant;
2010
- if (G != null && G.publishData)
2023
+ const x = typeof f.requestId == "string" ? f.requestId : void 0, M = (Z = le.current) == null ? void 0 : Z.call(le), q = (U) => {
2024
+ const D = M, X = D == null ? void 0 : D.localParticipant;
2025
+ if (X != null && X.publishData)
2011
2026
  try {
2012
- const X = x ? { ...U, requestId: x } : U, Ce = new TextEncoder().encode(JSON.stringify(X));
2013
- G.publishData(Ce, { reliable: !0 });
2014
- } catch (X) {
2015
- console.warn("[LiveLayer] publishData failed.", X);
2027
+ const K = x ? { ...U, requestId: x } : U, Re = new TextEncoder().encode(JSON.stringify(K));
2028
+ X.publishData(Re, { reliable: !0 });
2029
+ } catch (K) {
2030
+ console.warn("[LiveLayer] publishData failed.", K);
2016
2031
  }
2017
- }, $ = mt.current, F = ht.current;
2032
+ }, z = mt.current, F = ht.current;
2018
2033
  try {
2019
2034
  if (F) {
2020
- const U = F($);
2035
+ const U = F(z);
2021
2036
  if (U instanceof Promise) {
2022
- q({ type: "page_context_pending" }), U.then((P) => q({ type: "page_context", context: P })).catch((P) => {
2037
+ q({ type: "page_context_pending" }), U.then((D) => q({ type: "page_context", context: D })).catch((D) => {
2023
2038
  console.warn(
2024
2039
  "[LiveLayer] getPageContext rejected; falling back to default walker.",
2025
- P
2040
+ D
2026
2041
  ), q({
2027
2042
  type: "page_context",
2028
- context: Wt($)
2043
+ context: Wt(z)
2029
2044
  });
2030
2045
  });
2031
2046
  return;
@@ -2035,7 +2050,7 @@ function Sr(e) {
2035
2050
  }
2036
2051
  q({
2037
2052
  type: "page_context",
2038
- context: Wt($)
2053
+ context: Wt(z)
2039
2054
  });
2040
2055
  } catch (U) {
2041
2056
  console.warn(
@@ -2043,14 +2058,14 @@ function Sr(e) {
2043
2058
  U
2044
2059
  ), q({
2045
2060
  type: "page_context",
2046
- context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: $ }
2061
+ context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: z }
2047
2062
  });
2048
2063
  }
2049
2064
  return;
2050
2065
  }
2051
2066
  if (f.type === "scroll_page") {
2052
- if (!se("scroll")) {
2053
- de("scroll_page", "scroll");
2067
+ if (!ge("scroll")) {
2068
+ ye("scroll_page", "scroll");
2054
2069
  return;
2055
2070
  }
2056
2071
  const x = f.direction;
@@ -2061,29 +2076,29 @@ function Sr(e) {
2061
2076
  return;
2062
2077
  }
2063
2078
  const M = f.behavior === "instant" ? "instant" : "smooth";
2064
- if (it.current) {
2079
+ if (ot.current) {
2065
2080
  try {
2066
- it.current(
2081
+ ot.current(
2067
2082
  x,
2068
2083
  M
2069
2084
  );
2070
- } catch (P) {
2071
- console.warn("[LiveLayer] onScrollPage threw.", P);
2085
+ } catch (D) {
2086
+ console.warn("[LiveLayer] onScrollPage threw.", D);
2072
2087
  }
2073
2088
  return;
2074
2089
  }
2075
2090
  if (typeof window > "u") return;
2076
- const q = { behavior: M }, $ = xr(), F = (P) => {
2077
- $ instanceof Window ? $.scrollBy({ top: P, ...q }) : $.scrollBy({ top: P, ...q });
2078
- }, U = (P) => {
2079
- $ instanceof Window ? $.scrollTo({ top: P, ...q }) : $.scrollTo({ top: P, ...q });
2091
+ const q = { behavior: M }, z = kr(), F = (D) => {
2092
+ z instanceof Window ? z.scrollBy({ top: D, ...q }) : z.scrollBy({ top: D, ...q });
2093
+ }, U = (D) => {
2094
+ z instanceof Window ? z.scrollTo({ top: D, ...q }) : z.scrollTo({ top: D, ...q });
2080
2095
  };
2081
- x === "up" ? F(-Ft($)) : x === "down" ? F(Ft($)) : U(x === "top" ? 0 : kr($));
2096
+ x === "up" ? F(-Ft(z)) : x === "down" ? F(Ft(z)) : U(x === "top" ? 0 : Lr(z));
2082
2097
  return;
2083
2098
  }
2084
2099
  if (f.type === "click") {
2085
- if (!se("click")) {
2086
- de("click", "click");
2100
+ if (!ge("click")) {
2101
+ ye("click", "click");
2087
2102
  return;
2088
2103
  }
2089
2104
  const x = typeof f.selector == "string" ? f.selector : null;
@@ -2121,12 +2136,12 @@ function Sr(e) {
2121
2136
  );
2122
2137
  return;
2123
2138
  }
2124
- (Je = M.click) == null || Je.call(M);
2139
+ (Ge = M.click) == null || Ge.call(M);
2125
2140
  return;
2126
2141
  }
2127
2142
  if (f.type === "fill_form" || f.type === "focus_field") {
2128
- if (!se("fill_forms")) {
2129
- de(f.type, "fill_forms");
2143
+ if (!ge("fill_forms")) {
2144
+ ye(f.type, "fill_forms");
2130
2145
  return;
2131
2146
  }
2132
2147
  if (typeof document > "u") return;
@@ -2151,21 +2166,21 @@ function Sr(e) {
2151
2166
  return;
2152
2167
  }
2153
2168
  if (f.type === "focus_field") {
2154
- const $ = typeof f.fieldName == "string" ? f.fieldName : null;
2155
- if (!$) {
2169
+ const z = typeof f.fieldName == "string" ? f.fieldName : null;
2170
+ if (!z) {
2156
2171
  console.warn("[LiveLayer] focus_field: missing fieldName.");
2157
2172
  return;
2158
2173
  }
2159
- const F = M.querySelector(`[data-ll-field="${$.replace(/"/g, '\\"')}"]`);
2174
+ const F = M.querySelector(`[data-ll-field="${z.replace(/"/g, '\\"')}"]`);
2160
2175
  if (!F) {
2161
2176
  console.warn(
2162
- `[LiveLayer] focus_field: no field "${$}" in form "${x}".`
2177
+ `[LiveLayer] focus_field: no field "${z}" in form "${x}".`
2163
2178
  );
2164
2179
  return;
2165
2180
  }
2166
2181
  if (!tt(F)) {
2167
2182
  console.warn(
2168
- `[LiveLayer] focus_field: field "${$}" is privacy-protected and not focusable.`
2183
+ `[LiveLayer] focus_field: field "${z}" is privacy-protected and not focusable.`
2169
2184
  );
2170
2185
  return;
2171
2186
  }
@@ -2177,35 +2192,35 @@ function Sr(e) {
2177
2192
  console.warn("[LiveLayer] fill_form: missing or invalid values.");
2178
2193
  return;
2179
2194
  }
2180
- for (const [$, F] of Object.entries(q)) {
2195
+ for (const [z, F] of Object.entries(q)) {
2181
2196
  if (typeof F != "string") continue;
2182
- const U = M.querySelector(`[data-ll-field="${$.replace(/"/g, '\\"')}"]`);
2197
+ const U = M.querySelector(`[data-ll-field="${z.replace(/"/g, '\\"')}"]`);
2183
2198
  if (!U) {
2184
2199
  console.warn(
2185
- `[LiveLayer] fill_form: no field "${$}" in form "${x}". Skipping.`
2200
+ `[LiveLayer] fill_form: no field "${z}" in form "${x}". Skipping.`
2186
2201
  );
2187
2202
  continue;
2188
2203
  }
2189
2204
  if (!tt(U)) {
2190
2205
  console.warn(
2191
- `[LiveLayer] fill_form: field "${$}" is privacy-protected (password / cc-* / private). Skipping.`
2206
+ `[LiveLayer] fill_form: field "${z}" is privacy-protected (password / cc-* / private). Skipping.`
2192
2207
  );
2193
2208
  continue;
2194
2209
  }
2195
2210
  try {
2196
- vr(U, F);
2197
- } catch (P) {
2211
+ br(U, F);
2212
+ } catch (D) {
2198
2213
  console.warn(
2199
- `[LiveLayer] fill_form: failed to set "${$}".`,
2200
- P
2214
+ `[LiveLayer] fill_form: failed to set "${z}".`,
2215
+ D
2201
2216
  );
2202
2217
  }
2203
2218
  }
2204
2219
  return;
2205
2220
  }
2206
2221
  if (f.type === "submit_form") {
2207
- if (!se("submit_forms")) {
2208
- de("submit_form", "submit_forms");
2222
+ if (!ge("submit_forms")) {
2223
+ ye("submit_form", "submit_forms");
2209
2224
  return;
2210
2225
  }
2211
2226
  if (typeof document > "u") return;
@@ -2229,24 +2244,24 @@ function Sr(e) {
2229
2244
  );
2230
2245
  return;
2231
2246
  }
2232
- const q = typeof f.requestId == "string" ? f.requestId : void 0, $ = (Ke = oe.current) == null ? void 0 : Ke.call(oe), F = (G) => {
2233
- const X = $, Ce = X == null ? void 0 : X.localParticipant;
2234
- if (Ce != null && Ce.publishData)
2247
+ const q = typeof f.requestId == "string" ? f.requestId : void 0, z = (Je = le.current) == null ? void 0 : Je.call(le), F = (X) => {
2248
+ const K = z, Re = K == null ? void 0 : K.localParticipant;
2249
+ if (Re != null && Re.publishData)
2235
2250
  try {
2236
- const cn = q ? { ...G, requestId: q } : G, sn = new TextEncoder().encode(JSON.stringify(cn));
2237
- Ce.publishData(sn, { reliable: !0 });
2251
+ const sn = q ? { ...X, requestId: q } : X, cn = new TextEncoder().encode(JSON.stringify(sn));
2252
+ Re.publishData(cn, { reliable: !0 });
2238
2253
  } catch {
2239
2254
  }
2240
2255
  };
2241
2256
  let U = !1;
2242
- const P = () => {
2257
+ const D = () => {
2243
2258
  U = !0, F({ type: "form_submitted", formId: x });
2244
2259
  };
2245
- M.addEventListener("submit", P, { once: !0 });
2260
+ M.addEventListener("submit", D, { once: !0 });
2246
2261
  try {
2247
2262
  typeof M.requestSubmit == "function" ? M.requestSubmit() : M.submit();
2248
- } catch (G) {
2249
- console.warn("[LiveLayer] submit_form: requestSubmit threw.", G), M.removeEventListener("submit", P), F({
2263
+ } catch (X) {
2264
+ console.warn("[LiveLayer] submit_form: requestSubmit threw.", X), M.removeEventListener("submit", D), F({
2250
2265
  type: "form_submit_blocked",
2251
2266
  formId: x,
2252
2267
  reason: "exception"
@@ -2254,7 +2269,7 @@ function Sr(e) {
2254
2269
  return;
2255
2270
  }
2256
2271
  setTimeout(() => {
2257
- U || (M.removeEventListener("submit", P), F({
2272
+ U || (M.removeEventListener("submit", D), F({
2258
2273
  type: "form_submit_blocked",
2259
2274
  formId: x,
2260
2275
  reason: "validation"
@@ -2263,83 +2278,83 @@ function Sr(e) {
2263
2278
  return;
2264
2279
  }
2265
2280
  if (f.type === "request_routes") {
2266
- if (!se("read_page")) {
2267
- de("request_routes", "read_page");
2281
+ if (!ge("read_page")) {
2282
+ ye("request_routes", "read_page");
2268
2283
  return;
2269
2284
  }
2270
- const x = typeof f.requestId == "string" ? f.requestId : void 0, q = (Et = oe.current) == null ? void 0 : Et.call(oe), $ = q == null ? void 0 : q.localParticipant;
2271
- if (!($ != null && $.publishData)) return;
2272
- const F = (P) => {
2285
+ const x = typeof f.requestId == "string" ? f.requestId : void 0, q = (Et = le.current) == null ? void 0 : Et.call(le), z = q == null ? void 0 : q.localParticipant;
2286
+ if (!(z != null && z.publishData)) return;
2287
+ const F = (D) => {
2273
2288
  try {
2274
- const G = x ? { type: "routes", routes: P, requestId: x } : { type: "routes", routes: P }, X = new TextEncoder().encode(JSON.stringify(G));
2275
- $.publishData(X, { reliable: !0 });
2276
- } catch (G) {
2277
- console.warn("[LiveLayer] request_routes: publishData failed.", G);
2289
+ const X = x ? { type: "routes", routes: D, requestId: x } : { type: "routes", routes: D }, K = new TextEncoder().encode(JSON.stringify(X));
2290
+ z.publishData(K, { reliable: !0 });
2291
+ } catch (X) {
2292
+ console.warn("[LiveLayer] request_routes: publishData failed.", X);
2278
2293
  }
2279
2294
  }, U = gt.current;
2280
2295
  if (U) {
2281
2296
  try {
2282
- const P = U(), G = (X) => {
2283
- if (!Array.isArray(X)) {
2297
+ const D = U(), X = (K) => {
2298
+ if (!Array.isArray(K)) {
2284
2299
  F([]);
2285
2300
  return;
2286
2301
  }
2287
- F(X.map(fr).slice(0, 200));
2302
+ F(K.map(pr).slice(0, 200));
2288
2303
  };
2289
- P instanceof Promise ? P.then(G).catch((X) => {
2304
+ D instanceof Promise ? D.then(X).catch((K) => {
2290
2305
  console.warn(
2291
2306
  "[LiveLayer] getRoutes rejected; falling back to DOM walker.",
2292
- X
2293
- ), F(st());
2294
- }) : G(P);
2295
- } catch (P) {
2307
+ K
2308
+ ), F(ct());
2309
+ }) : X(D);
2310
+ } catch (D) {
2296
2311
  console.warn(
2297
2312
  "[LiveLayer] getRoutes threw; falling back to DOM walker.",
2298
- P
2299
- ), F(st());
2313
+ D
2314
+ ), F(ct());
2300
2315
  }
2301
2316
  return;
2302
2317
  }
2303
2318
  try {
2304
- F(st());
2305
- } catch (P) {
2306
- console.warn("[LiveLayer] request_routes: extractRoutes threw.", P);
2319
+ F(ct());
2320
+ } catch (D) {
2321
+ console.warn("[LiveLayer] request_routes: extractRoutes threw.", D);
2307
2322
  }
2308
2323
  return;
2309
2324
  }
2310
- Lr.has(f.type) || xe == null || xe(f);
2325
+ Sr.has(f.type) || Ce == null || Ce(f);
2311
2326
  }
2312
2327
  },
2313
- [xe, _e]
2328
+ [Ce, Se]
2314
2329
  ), Y = gn({
2315
- agentId: j ? "__controlled__" : Re,
2316
- baseUrl: o,
2330
+ agentId: j ? "__controlled__" : Pe,
2331
+ baseUrl: i,
2317
2332
  apiKey: r,
2318
- sessionEndpoint: i,
2333
+ sessionEndpoint: o,
2319
2334
  sessionBody: l,
2320
- onDataMessage: j ? void 0 : Te
2335
+ onDataMessage: j ? void 0 : ze
2321
2336
  });
2322
- T(() => {
2337
+ P(() => {
2323
2338
  if (j != null && j.subscribeToDataMessages)
2324
- return j.subscribeToDataMessages(Te);
2325
- }, [j, Te]), oe.current = () => {
2339
+ return j.subscribeToDataMessages(ze);
2340
+ }, [j, ze]), le.current = () => {
2326
2341
  var g;
2327
2342
  return (g = Y.getRoom) == null ? void 0 : g.call(Y);
2328
- }, T(() => {
2343
+ }, P(() => {
2329
2344
  var Z;
2330
2345
  if (typeof window > "u") return;
2331
2346
  const g = ((Z = window.location) == null ? void 0 : Z.hostname) || "";
2332
2347
  if (g === "localhost" || g === "127.0.0.1" || g === "0.0.0.0" || g.endsWith(".local") || g.endsWith(".test"))
2333
- return window.__livelayerSimulateCommand = (Je) => {
2348
+ return window.__livelayerSimulateCommand = (Ge) => {
2334
2349
  try {
2335
- Te(Je);
2336
- } catch (Ke) {
2337
- console.warn("[LiveLayer] simulate-command threw:", Ke);
2350
+ ze(Ge);
2351
+ } catch (Je) {
2352
+ console.warn("[LiveLayer] simulate-command threw:", Je);
2338
2353
  }
2339
2354
  }, () => {
2340
2355
  delete window.__livelayerSimulateCommand;
2341
2356
  };
2342
- }, [Te]);
2357
+ }, [ze]);
2343
2358
  const _ = Ze(() => j ? {
2344
2359
  connectionState: j.connectionState,
2345
2360
  agentState: j.agentState,
@@ -2372,35 +2387,35 @@ function Sr(e) {
2372
2387
  getRoom: Y.getRoom,
2373
2388
  isControlled: !1
2374
2389
  }, [j, Y]), yt = E(null);
2375
- T(() => {
2390
+ P(() => {
2376
2391
  const g = _.videoElement, f = yt.current;
2377
2392
  if (!(!g || !f))
2378
2393
  return f.appendChild(g), () => {
2379
2394
  g.parentNode === f && f.removeChild(g);
2380
2395
  };
2381
- }, [_.videoElement]), T(() => {
2396
+ }, [_.videoElement]), P(() => {
2382
2397
  const g = _.audioElement;
2383
2398
  if (!g) return;
2384
- ce.attach(g);
2399
+ me.attach(g);
2385
2400
  const f = g.play();
2386
2401
  return f && typeof f.catch == "function" && f.catch((Z) => {
2387
- (Z == null ? void 0 : Z.name) === "NotAllowedError" && Me(!0);
2402
+ (Z == null ? void 0 : Z.name) === "NotAllowedError" && $e(!0);
2388
2403
  }), () => {
2389
- ce.detach();
2404
+ me.detach();
2390
2405
  };
2391
- }, [_.audioElement]), T(() => {
2406
+ }, [_.audioElement]), P(() => {
2392
2407
  if (_.isControlled || _.connectionState !== "connected") return;
2393
2408
  const g = _.getRoom();
2394
2409
  if (g)
2395
2410
  return Q.setupMic(g).catch(() => {
2396
- }), re.attachRoom(g), pe.attachRoom(g), Ie.refresh(), () => {
2397
- Q.teardownMic(), re.teardown(), pe.teardown();
2411
+ }), oe.attachRoom(g), we.attachRoom(g), De.refresh(), () => {
2412
+ Q.teardownMic(), oe.teardown(), we.teardown();
2398
2413
  };
2399
- }, [_.isControlled, _.connectionState]), T(() => {
2414
+ }, [_.isControlled, _.connectionState]), P(() => {
2400
2415
  const g = _.audioElement;
2401
2416
  g && (g.muted = nt);
2402
2417
  }, [_.audioElement, nt]);
2403
- const Kt = k((g) => {
2418
+ const Jt = k((g) => {
2404
2419
  const f = _.getRoom();
2405
2420
  if (f)
2406
2421
  try {
@@ -2410,134 +2425,134 @@ function Sr(e) {
2410
2425
  f.localParticipant.publishData(Z, { reliable: !0 });
2411
2426
  } catch {
2412
2427
  }
2413
- }, [_]), Xt = k(() => {
2414
- Jt((g) => !g);
2428
+ }, [_]), Kt = k(() => {
2429
+ Gt((g) => !g);
2415
2430
  }, []);
2416
- T(() => {
2417
- we == null || we(_.connectionState), _.connectionState === "connected" ? ge == null || ge() : _.connectionState === "disconnected" && (ye == null || ye());
2418
- }, [_.connectionState, ge, ye, we]), T(() => {
2419
- ve == null || ve(_.transcript);
2420
- }, [_.transcript, ve]), T(() => {
2421
- be == null || be(_.agentState);
2422
- }, [_.agentState, be]);
2431
+ P(() => {
2432
+ Le == null || Le(_.connectionState), _.connectionState === "connected" ? ce == null || ce() : _.connectionState === "disconnected" && (_e == null || _e());
2433
+ }, [_.connectionState, ce, _e, Le]), P(() => {
2434
+ xe == null || xe(_.transcript);
2435
+ }, [_.transcript, xe]), P(() => {
2436
+ ke == null || ke(_.agentState);
2437
+ }, [_.agentState, ke]);
2423
2438
  const vt = E(!1);
2424
- T(() => {
2425
- _.isControlled || !s || vt.current || ae && _.connectionState === "idle" && (vt.current = !0, _.connect());
2426
- }, [s, _.connectionState, _, ae]);
2439
+ P(() => {
2440
+ _.isControlled || !c || vt.current || he && _.connectionState === "idle" && (vt.current = !0, _.connect());
2441
+ }, [c, _.connectionState, _, he]);
2427
2442
  const Qt = k(
2428
2443
  (g) => {
2429
2444
  const f = C == null ? void 0 : C.find((Z) => Z.id === g);
2430
- f && (Ye(!1), g !== fe && (y(!0), _.disconnect(), ie || Le(g), v == null || v(f)));
2445
+ f && (Ye(!1), g !== be && (y(!0), _.disconnect(), de || Ne(g), v == null || v(f)));
2431
2446
  },
2432
2447
  [
2433
2448
  C,
2434
- fe,
2449
+ be,
2435
2450
  _,
2436
- ie,
2451
+ de,
2437
2452
  v
2438
2453
  ]
2439
2454
  );
2440
- T(() => {
2441
- Se && _.connectionState === "connected" && y(!1);
2442
- }, [_.connectionState, Se]), T(() => {
2443
- if (!K) return;
2455
+ P(() => {
2456
+ Ae && _.connectionState === "connected" && y(!1);
2457
+ }, [_.connectionState, Ae]), P(() => {
2458
+ if (!J) return;
2444
2459
  const g = (f) => {
2445
2460
  f.key === "Escape" && Ye(!1);
2446
2461
  };
2447
2462
  return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
2448
- }, [K]);
2449
- const Zt = !!I || !!(J != null && J.avatarImageUrl) || _.isControlled, Pe = kn(Re, o, Zt);
2450
- me === void 0 && ((wt = Pe.info) != null && wt.capabilities) && (at.current = Pe.info.capabilities);
2451
- const Ge = (J == null ? void 0 : J.name) ?? H ?? ((_t = _.agentConfig) == null ? void 0 : _t.name) ?? ((xt = Pe.info) == null ? void 0 : xt.name) ?? "Live Layer", ct = (J == null ? void 0 : J.avatarImageUrl) ?? I ?? ((kt = _.agentConfig) == null ? void 0 : kt.avatarImageUrl) ?? ((Lt = Pe.info) == null ? void 0 : Lt.avatarImageUrl) ?? null, en = b ?? ((St = _.agentConfig) == null ? void 0 : St.idleLoopUrl) ?? ((Ct = Pe.info) == null ? void 0 : Ct.idleLoopUrl) ?? null, tn = z ?? null, nn = k(() => ee("expanded"), [ee]), rn = k(
2452
- () => ee("minimized"),
2453
- [ee]
2463
+ }, [J]);
2464
+ const Zt = !!I || !!(G != null && G.avatarImageUrl) || _.isControlled, He = kn(Pe, i, Zt);
2465
+ re === void 0 && ((wt = He.info) != null && wt.capabilities) && (at.current = He.info.capabilities);
2466
+ const Xe = (G == null ? void 0 : G.name) ?? O ?? ((_t = _.agentConfig) == null ? void 0 : _t.name) ?? ((xt = He.info) == null ? void 0 : xt.name) ?? "Live Layer", st = (G == null ? void 0 : G.avatarImageUrl) ?? I ?? ((kt = _.agentConfig) == null ? void 0 : kt.avatarImageUrl) ?? ((Lt = He.info) == null ? void 0 : Lt.avatarImageUrl) ?? null, en = b ?? ((St = _.agentConfig) == null ? void 0 : St.idleLoopUrl) ?? ((Ct = He.info) == null ? void 0 : Ct.idleLoopUrl) ?? null, tn = H ?? null, nn = k(() => te("expanded"), [te]), rn = k(
2467
+ () => te("minimized"),
2468
+ [te]
2454
2469
  ), bt = k(() => {
2455
- _.disconnect(), ee("hidden");
2456
- }, [_, ee]), on = k(() => {
2470
+ _.disconnect(), te("hidden");
2471
+ }, [_, te]), on = k(() => {
2457
2472
  const g = _.audioElement;
2458
- g && g.play().then(() => Me(!1)).catch(() => {
2473
+ g && g.play().then(() => $e(!1)).catch(() => {
2459
2474
  });
2460
2475
  }, [_.audioElement]), ln = k(() => {
2461
- Me(!1), _.connect();
2462
- }, [_]), De = {
2476
+ $e(!1), _.connect();
2477
+ }, [_]), Oe = {
2463
2478
  ...Fe,
2464
2479
  zIndex: Ue
2465
2480
  };
2466
- p.primaryColor && (De["--ll-color-primary"] = p.primaryColor), p.accentColor && (De["--ll-color-accent"] = p.accentColor), p.backgroundColor && (De["--ll-color-bg"] = p.backgroundColor), p.textColor && (De["--ll-color-fg"] = p.textColor);
2481
+ p.primaryColor && (Oe["--ll-color-primary"] = p.primaryColor), p.accentColor && (Oe["--ll-color-accent"] = p.accentColor), p.backgroundColor && (Oe["--ll-color-bg"] = p.backgroundColor), p.textColor && (Oe["--ll-color-fg"] = p.textColor);
2467
2482
  const an = [
2468
2483
  "ll-widget",
2469
- `ll-widget--${ne}`,
2470
- `ll-widget--${le ? "mobile" : "desktop"}`,
2484
+ `ll-widget--${ie}`,
2485
+ `ll-widget--${ue ? "mobile" : "desktop"}`,
2471
2486
  We
2472
2487
  ].filter(Boolean).join(" ");
2473
- return ae ? /* @__PURE__ */ w(
2488
+ return he ? /* @__PURE__ */ w(
2474
2489
  "div",
2475
2490
  {
2476
2491
  className: an,
2477
- style: De,
2478
- "data-display-mode": ne,
2492
+ style: Oe,
2493
+ "data-display-mode": ie,
2479
2494
  "data-position": h,
2480
2495
  children: [
2481
- ne === "hidden" && /* @__PURE__ */ n(
2496
+ ie === "hidden" && /* @__PURE__ */ n(
2482
2497
  Vn,
2483
2498
  {
2484
2499
  position: h,
2485
- isMobile: le,
2500
+ isMobile: ue,
2486
2501
  isSpeaking: _.agentState === "speaking",
2487
- onExpand: () => ee("expanded"),
2488
- label: `Open ${Ge} widget`,
2489
- avatarImageUrl: ct,
2490
- agentName: Ge
2502
+ onExpand: () => te("expanded"),
2503
+ label: `Open ${Xe} widget`,
2504
+ avatarImageUrl: st,
2505
+ agentName: Xe
2491
2506
  }
2492
2507
  ),
2493
- ne === "minimized" && /* @__PURE__ */ n(
2494
- Gn,
2508
+ ie === "minimized" && /* @__PURE__ */ n(
2509
+ Xn,
2495
2510
  {
2496
2511
  position: h,
2497
- isMobile: le,
2498
- agentName: Ge,
2499
- avatarImageUrl: ct,
2512
+ isMobile: ue,
2513
+ agentName: Xe,
2514
+ avatarImageUrl: st,
2500
2515
  agentState: _.agentState,
2501
2516
  isMuted: Q.isMuted,
2502
- audioLevel: ce,
2517
+ audioLevel: me,
2503
2518
  onExpand: nn,
2504
2519
  onToggleMute: Q.toggleMute,
2505
2520
  onClose: bt
2506
2521
  }
2507
2522
  ),
2508
- ne === "expanded" && /* @__PURE__ */ n(
2509
- Kn,
2523
+ ie === "expanded" && /* @__PURE__ */ n(
2524
+ Jn,
2510
2525
  {
2511
2526
  position: h,
2512
- isMobile: le,
2513
- agentName: Ge,
2514
- avatarImageUrl: ct,
2527
+ isMobile: ue,
2528
+ agentName: Xe,
2529
+ avatarImageUrl: st,
2515
2530
  idleLoopUrl: en,
2516
2531
  greeting: tn,
2517
2532
  branding: p,
2518
2533
  teamMembers: C,
2519
- currentTeamMemberId: fe,
2520
- isSwitchingTeamMember: Se,
2521
- teamSwitcherOpen: K,
2534
+ currentTeamMemberId: be,
2535
+ isSwitchingTeamMember: Ae,
2536
+ teamSwitcherOpen: J,
2522
2537
  onToggleTeamSwitcher: () => Ye((g) => !g),
2523
2538
  onSelectTeamMember: Qt,
2524
2539
  connectionState: _.connectionState,
2525
2540
  agentState: _.agentState,
2526
2541
  transcript: _.transcript,
2527
2542
  isMuted: Q.isMuted,
2528
- micDevices: Ie.mics,
2529
- isCameraEnabled: re.isEnabled,
2530
- cameraPreviewEl: re.previewEl,
2531
- cameraDevices: Ie.cameras,
2532
- activeCameraId: re.activeDeviceId,
2533
- isScreenShareEnabled: pe.isEnabled,
2534
- screenPreviewEl: pe.previewEl,
2543
+ micDevices: De.mics,
2544
+ isCameraEnabled: oe.isEnabled,
2545
+ cameraPreviewEl: oe.previewEl,
2546
+ cameraDevices: De.cameras,
2547
+ activeCameraId: oe.activeDeviceId,
2548
+ isScreenShareEnabled: we.isEnabled,
2549
+ screenPreviewEl: we.previewEl,
2535
2550
  isSpeakerMuted: nt,
2536
2551
  allowCamera: N,
2537
2552
  allowScreenShare: B,
2538
- allowTyping: D,
2553
+ allowTyping: $,
2539
2554
  languageMenuOpen: Yt,
2540
- onToggleLanguageMenu: () => Gt((g) => !g),
2555
+ onToggleLanguageMenu: () => Xt((g) => !g),
2541
2556
  needsUserGesture: Ve,
2542
2557
  canResume: _.canResume,
2543
2558
  micError: Q.micError,
@@ -2548,11 +2563,11 @@ function Sr(e) {
2548
2563
  onRetry: ln,
2549
2564
  onResumeAudio: on,
2550
2565
  onToggleMute: Q.toggleMute,
2551
- onToggleCamera: () => void re.toggle(),
2552
- onSwitchCameraDevice: (g) => void re.switchDevice(g),
2553
- onToggleScreenShare: () => void pe.toggle(),
2554
- onToggleSpeaker: Xt,
2555
- onSendMessage: Kt,
2566
+ onToggleCamera: () => void oe.toggle(),
2567
+ onSwitchCameraDevice: (g) => void oe.switchDevice(g),
2568
+ onToggleScreenShare: () => void we.toggle(),
2569
+ onToggleSpeaker: Kt,
2570
+ onSendMessage: Jt,
2556
2571
  onMinimize: rn,
2557
2572
  onClose: bt,
2558
2573
  onClearMicError: Q.clearError
@@ -2562,141 +2577,141 @@ function Sr(e) {
2562
2577
  }
2563
2578
  ) : null;
2564
2579
  }
2565
- function Tr(e) {
2566
- return /* @__PURE__ */ n(mn, { children: /* @__PURE__ */ n(Sr, { ...e }) });
2580
+ function Pr(e) {
2581
+ return /* @__PURE__ */ n(mn, { children: /* @__PURE__ */ n(Cr, { ...e }) });
2567
2582
  }
2568
- const Pr = ({
2583
+ const Dr = ({
2569
2584
  agentId: e,
2570
2585
  baseUrl: t,
2571
2586
  apiKey: r,
2572
- mode: o,
2573
- onAgentEvent: i,
2587
+ mode: i,
2588
+ onAgentEvent: o,
2574
2589
  className: l,
2575
- style: s
2590
+ style: c
2576
2591
  }) => {
2577
- const d = E(null), u = E(null), m = E(i);
2578
- m.current = i;
2592
+ const d = E(null), u = E(null), m = E(o);
2593
+ m.current = o;
2579
2594
  const h = k((a) => {
2580
2595
  var R;
2581
- const c = a.detail;
2582
- (R = m.current) == null || R.call(m, c);
2596
+ const s = a.detail;
2597
+ (R = m.current) == null || R.call(m, s);
2583
2598
  }, []);
2584
- return T(() => {
2599
+ return P(() => {
2585
2600
  const a = d.current;
2586
2601
  if (!a) return;
2587
- const c = document.createElement("livelayer-widget");
2588
- 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", h), a.appendChild(c), u.current = c, () => {
2589
- c.removeEventListener("agent-event", h), a.removeChild(c), u.current = null;
2602
+ const s = document.createElement("livelayer-widget");
2603
+ return s.setAttribute("agent-id", e), t && s.setAttribute("base-url", t), r && s.setAttribute("api-key", r), i && s.setAttribute("mode", i), s.addEventListener("agent-event", h), a.appendChild(s), u.current = s, () => {
2604
+ s.removeEventListener("agent-event", h), a.removeChild(s), u.current = null;
2590
2605
  };
2591
- }, [e]), T(() => {
2592
- u.current && (o ? u.current.setAttribute("mode", o) : u.current.removeAttribute("mode"));
2593
- }, [o]), /* @__PURE__ */ n("div", { ref: d, className: l, style: s });
2594
- }, Dr = ft(
2595
- function({ id: t, intent: r, as: o = "div", className: i, style: l, children: s }, d) {
2606
+ }, [e]), P(() => {
2607
+ u.current && (i ? u.current.setAttribute("mode", i) : u.current.removeAttribute("mode"));
2608
+ }, [i]), /* @__PURE__ */ n("div", { ref: d, className: l, style: c });
2609
+ }, $r = ft(
2610
+ function({ id: t, intent: r, as: i = "div", className: o, style: l, children: c }, d) {
2596
2611
  return un(
2597
- o,
2612
+ i,
2598
2613
  {
2599
2614
  ref: d,
2600
2615
  "data-ll-region": t,
2601
2616
  "data-ll-intent": r,
2602
- className: i,
2617
+ className: o,
2603
2618
  style: l
2604
2619
  },
2605
- s
2620
+ c
2606
2621
  );
2607
2622
  }
2608
- ), $r = ft(
2609
- function({ id: t, intent: r, children: o, ...i }, l) {
2623
+ ), zr = ft(
2624
+ function({ id: t, intent: r, children: i, ...o }, l) {
2610
2625
  return /* @__PURE__ */ n(
2611
2626
  "form",
2612
2627
  {
2613
2628
  ref: l,
2614
2629
  "data-ll-form": t,
2615
2630
  "data-ll-intent": r,
2616
- ...i,
2617
- children: o
2631
+ ...o,
2632
+ children: i
2618
2633
  }
2619
2634
  );
2620
2635
  }
2621
- ), zr = ft(
2636
+ ), Hr = ft(
2622
2637
  function(t, r) {
2623
- const { name: o, label: i, labelClassName: l } = t, s = { name: o, "data-ll-field": o };
2638
+ const { name: i, label: o, labelClassName: l } = t, c = { name: i, "data-ll-field": i };
2624
2639
  let d;
2625
2640
  if ("as" in t && t.as === "textarea") {
2626
- const { name: u, label: m, labelClassName: h, as: a, ...c } = t;
2641
+ const { name: u, label: m, labelClassName: h, as: a, ...s } = t;
2627
2642
  d = /* @__PURE__ */ n(
2628
2643
  "textarea",
2629
2644
  {
2630
2645
  ref: r,
2631
- ...s,
2632
- ...c
2646
+ ...c,
2647
+ ...s
2633
2648
  }
2634
2649
  );
2635
2650
  } else if ("as" in t && t.as === "select") {
2636
- const { name: u, label: m, labelClassName: h, as: a, children: c, ...R } = t;
2651
+ const { name: u, label: m, labelClassName: h, as: a, children: s, ...R } = t;
2637
2652
  d = /* @__PURE__ */ n(
2638
2653
  "select",
2639
2654
  {
2640
2655
  ref: r,
2641
- ...s,
2656
+ ...c,
2642
2657
  ...R,
2643
- children: c
2658
+ children: s
2644
2659
  }
2645
2660
  );
2646
2661
  } else {
2647
- const { name: u, label: m, labelClassName: h, as: a, ...c } = t;
2662
+ const { name: u, label: m, labelClassName: h, as: a, ...s } = t;
2648
2663
  d = /* @__PURE__ */ n(
2649
2664
  "input",
2650
2665
  {
2651
2666
  ref: r,
2652
- ...s,
2653
- ...c
2667
+ ...c,
2668
+ ...s
2654
2669
  }
2655
2670
  );
2656
2671
  }
2657
- return i === void 0 ? d : /* @__PURE__ */ w("label", { className: l, children: [
2658
- i,
2672
+ return o === void 0 ? d : /* @__PURE__ */ w("label", { className: l, children: [
2673
+ o,
2659
2674
  d
2660
2675
  ] });
2661
2676
  }
2662
2677
  );
2663
2678
  let Ut = 1;
2664
- function Hr({
2679
+ function Or({
2665
2680
  onMount: e,
2666
2681
  defaultOpen: t = !1,
2667
2682
  storageKey: r = "ll-debug-open"
2668
2683
  }) {
2669
- const [o, i] = S(t), [l, s] = S([]), [d, u] = S(""), [m, h] = S(!1), a = E(/* @__PURE__ */ new Set()), c = E([]), R = E(m);
2670
- R.current = m, T(() => {
2684
+ const [i, o] = S(t), [l, c] = S([]), [d, u] = S(""), [m, h] = S(!1), a = E(/* @__PURE__ */ new Set()), s = E([]), R = E(m);
2685
+ R.current = m, P(() => {
2671
2686
  try {
2672
2687
  const v = localStorage.getItem(r);
2673
- v === "1" && i(!0), v === "0" && i(!1);
2688
+ v === "1" && o(!0), v === "0" && o(!1);
2674
2689
  } catch {
2675
2690
  }
2676
- }, [r]), T(() => {
2691
+ }, [r]), P(() => {
2677
2692
  try {
2678
- localStorage.setItem(r, o ? "1" : "0");
2693
+ localStorage.setItem(r, i ? "1" : "0");
2679
2694
  } catch {
2680
2695
  }
2681
- }, [o, r]), T(() => {
2696
+ }, [i, r]), P(() => {
2682
2697
  const v = (b) => {
2683
- (b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(), i((z) => !z));
2698
+ (b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(), o((H) => !H));
2684
2699
  };
2685
2700
  return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
2686
- }, []), T(() => {
2701
+ }, []), P(() => {
2687
2702
  const v = setInterval(() => {
2688
- if (c.current.length === 0 || R.current) return;
2689
- const b = c.current.splice(0, c.current.length);
2690
- s(
2691
- (z) => [...b.reverse(), ...z].slice(0, 200)
2703
+ if (s.current.length === 0 || R.current) return;
2704
+ const b = s.current.splice(0, s.current.length);
2705
+ c(
2706
+ (H) => [...b.reverse(), ...H].slice(0, 200)
2692
2707
  );
2693
2708
  }, 100);
2694
2709
  return () => clearInterval(v);
2695
2710
  }, []);
2696
2711
  const C = E(!1);
2697
- if (T(() => {
2712
+ if (P(() => {
2698
2713
  !e || C.current || (C.current = !0, e((v) => {
2699
- c.current.push({
2714
+ s.current.push({
2700
2715
  id: Ut++,
2701
2716
  ts: Date.now(),
2702
2717
  kind: "event",
@@ -2704,30 +2719,30 @@ function Hr({
2704
2719
  data: v.data
2705
2720
  });
2706
2721
  }));
2707
- }, [e]), T(() => {
2708
- const v = console.warn, b = console.log, z = (I, H) => function(...p) {
2722
+ }, [e]), P(() => {
2723
+ const v = console.warn, b = console.log, H = (I, O) => function(...p) {
2709
2724
  try {
2710
2725
  const N = typeof p[0] == "string" ? p[0] : "";
2711
- N.startsWith("[LiveLayer]") && c.current.push({
2726
+ N.startsWith("[LiveLayer]") && s.current.push({
2712
2727
  id: Ut++,
2713
2728
  ts: Date.now(),
2714
2729
  kind: I,
2715
2730
  type: N.slice(0, 120),
2716
- data: { args: p.slice(1).map((B) => Er(B)) }
2731
+ data: { args: p.slice(1).map((B) => Nr(B)) }
2717
2732
  });
2718
2733
  } catch {
2719
2734
  }
2720
- return H.apply(this, p);
2735
+ return O.apply(this, p);
2721
2736
  };
2722
- return console.warn = z("warn", v), console.log = z("log", b), () => {
2737
+ return console.warn = H("warn", v), console.log = H("log", b), () => {
2723
2738
  console.warn = v, console.log = b;
2724
2739
  };
2725
- }, []), !o)
2740
+ }, []), !i)
2726
2741
  return /* @__PURE__ */ n(
2727
2742
  "button",
2728
2743
  {
2729
2744
  type: "button",
2730
- onClick: () => i(!0),
2745
+ onClick: () => o(!0),
2731
2746
  title: "Open LiveLayer debug panel (Cmd/Ctrl + Shift + L)",
2732
2747
  "aria-label": "Open LiveLayer debug panel",
2733
2748
  style: {
@@ -2810,7 +2825,7 @@ function Hr({
2810
2825
  {
2811
2826
  type: "button",
2812
2827
  onClick: () => {
2813
- s([]), c.current = [];
2828
+ c([]), s.current = [];
2814
2829
  },
2815
2830
  style: dt("transparent"),
2816
2831
  title: "Clear buffer",
@@ -2821,7 +2836,7 @@ function Hr({
2821
2836
  "button",
2822
2837
  {
2823
2838
  type: "button",
2824
- onClick: () => i(!1),
2839
+ onClick: () => o(!1),
2825
2840
  style: dt("transparent"),
2826
2841
  "aria-label": "Close",
2827
2842
  title: "Close (Cmd/Ctrl + Shift + L)",
@@ -2889,12 +2904,12 @@ function Hr({
2889
2904
  ]
2890
2905
  }
2891
2906
  ) : L.map((v) => /* @__PURE__ */ n(
2892
- Cr,
2907
+ Er,
2893
2908
  {
2894
2909
  entry: v,
2895
2910
  expanded: a.current.has(v.id),
2896
2911
  onToggle: () => {
2897
- a.current.has(v.id) ? a.current.delete(v.id) : a.current.add(v.id), s((b) => [...b]);
2912
+ a.current.has(v.id) ? a.current.delete(v.id) : a.current.add(v.id), c((b) => [...b]);
2898
2913
  }
2899
2914
  },
2900
2915
  v.id
@@ -2905,12 +2920,12 @@ function Hr({
2905
2920
  }
2906
2921
  );
2907
2922
  }
2908
- function Cr({
2923
+ function Er({
2909
2924
  entry: e,
2910
2925
  expanded: t,
2911
2926
  onToggle: r
2912
2927
  }) {
2913
- 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", {
2928
+ 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", {
2914
2929
  hour12: !1
2915
2930
  });
2916
2931
  return /* @__PURE__ */ w(
@@ -2940,14 +2955,14 @@ function Cr({
2940
2955
  fontVariantNumeric: "tabular-nums",
2941
2956
  fontSize: 10
2942
2957
  },
2943
- children: i
2958
+ children: o
2944
2959
  }
2945
2960
  ),
2946
2961
  /* @__PURE__ */ n(
2947
2962
  "span",
2948
2963
  {
2949
2964
  style: {
2950
- color: o,
2965
+ color: i,
2951
2966
  fontWeight: 600,
2952
2967
  flexShrink: 0
2953
2968
  },
@@ -2986,47 +3001,47 @@ function dt(e) {
2986
3001
  cursor: "pointer"
2987
3002
  };
2988
3003
  }
2989
- function Er(e) {
3004
+ function Nr(e) {
2990
3005
  try {
2991
3006
  return e instanceof Error ? { message: e.message, stack: e.stack } : (JSON.stringify(e), e);
2992
3007
  } catch {
2993
3008
  return String(e);
2994
3009
  }
2995
3010
  }
2996
- function Or() {
2997
- const [e, t] = S([]), r = k((i) => {
3011
+ function qr() {
3012
+ const [e, t] = S([]), r = k((o) => {
2998
3013
  t((l) => {
2999
- const s = l.findIndex((d) => d.id === i.id);
3000
- if (s >= 0) {
3014
+ const c = l.findIndex((d) => d.id === o.id);
3015
+ if (c >= 0) {
3001
3016
  const d = l.slice();
3002
- return d[s] = i, d;
3017
+ return d[c] = o, d;
3003
3018
  }
3004
- return [...l, i];
3019
+ return [...l, o];
3005
3020
  });
3006
- }, []), o = k(() => t([]), []);
3021
+ }, []), i = k(() => t([]), []);
3007
3022
  return {
3008
3023
  entries: e,
3009
3024
  pushSegment: r,
3010
- clear: o,
3025
+ clear: i,
3011
3026
  latest: e.length > 0 ? e[e.length - 1] : null
3012
3027
  };
3013
3028
  }
3014
3029
  export {
3015
- Tr as AvatarWidget,
3030
+ Pr as AvatarWidget,
3016
3031
  mn as ErrorBoundary,
3017
- Hr as LiveLayerDebugPanel,
3018
- zr as LiveLayerField,
3019
- $r as LiveLayerForm,
3020
- Dr as LiveLayerRegion,
3021
- Pr as LiveLayerWidget,
3022
- dr as clearPageContextCache,
3023
- gr as clearRoutesCache,
3024
- sr as extractPageContext,
3025
- hr as extractRoutes,
3032
+ Or as LiveLayerDebugPanel,
3033
+ Hr as LiveLayerField,
3034
+ zr as LiveLayerForm,
3035
+ $r as LiveLayerRegion,
3036
+ Dr as LiveLayerWidget,
3037
+ ur as clearPageContextCache,
3038
+ yr as clearRoutesCache,
3039
+ dr as extractPageContext,
3040
+ mr as extractRoutes,
3026
3041
  Wt as getCachedPageContext,
3027
- st as getCachedRoutes,
3042
+ ct as getCachedRoutes,
3028
3043
  Hn as matchesPattern,
3029
- fr as normalizeRouteInput,
3044
+ pr as normalizeRouteInput,
3030
3045
  On as shouldRenderAtPath,
3031
3046
  kn as useAgentInfo,
3032
3047
  yn as useAudioLevel,
@@ -3040,5 +3055,5 @@ export {
3040
3055
  Tn as usePathname,
3041
3056
  qn as useRouteMatch,
3042
3057
  _n as useScreenShareState,
3043
- Or as useTranscript
3058
+ qr as useTranscript
3044
3059
  };