@livelayer/react 0.9.7 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { jsxs as v, jsx as n, Fragment as ot } from "react/jsx-runtime";
3
- import { Component as In, useState as C, useRef as A, useEffect as T, useCallback as E, useMemo as Ue, useLayoutEffect as Tn, forwardRef as lt, useImperativeHandle as Mn, createElement as Dn } from "react";
4
- import { LiveKitSession as Pn } from "@livelayer/sdk";
5
- import { createLocalAudioTrack as $n, Track as dn, createLocalVideoTrack as zn } from "livekit-client";
6
- import { createPortal as On } from "react-dom";
7
- class Hn extends In {
2
+ import { jsxs as y, jsx as n, Fragment as Ve } from "react/jsx-runtime";
3
+ import { Component as zn, useState as C, useRef as S, useEffect as M, useCallback as E, useMemo as Ye, useLayoutEffect as hn, forwardRef as dt, useImperativeHandle as On, createElement as Hn } from "react";
4
+ import { createPortal as Rt } from "react-dom";
5
+ import { LiveKitSession as Wn } from "@livelayer/sdk";
6
+ import { createLocalAudioTrack as Bn, Track as mn, createLocalVideoTrack as qn } from "livekit-client";
7
+ class Fn extends zn {
8
8
  constructor() {
9
9
  super(...arguments), this.state = { hasError: !1, error: null }, this.reset = () => {
10
10
  this.setState({ hasError: !1, error: null });
@@ -14,12 +14,12 @@ class Hn extends In {
14
14
  return { hasError: !0, error: t };
15
15
  }
16
16
  componentDidCatch(t, r) {
17
- var i, o;
18
- (o = (i = this.props).onError) == null || o.call(i, t, r);
17
+ var o, i;
18
+ (i = (o = this.props).onError) == null || i.call(o, t, r);
19
19
  }
20
20
  render() {
21
21
  var t;
22
- return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ v("div", { className: "ll-error-boundary", role: "alert", children: [
22
+ return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ y("div", { className: "ll-error-boundary", role: "alert", children: [
23
23
  /* @__PURE__ */ n("p", { className: "ll-error-boundary__title", children: "Widget crashed" }),
24
24
  /* @__PURE__ */ n("p", { className: "ll-error-boundary__message", children: ((t = this.state.error) == null ? void 0 : t.message) || "Something went wrong." }),
25
25
  /* @__PURE__ */ n(
@@ -34,26 +34,26 @@ class Hn extends In {
34
34
  ] }) : this.props.children;
35
35
  }
36
36
  }
37
- function Wn(e) {
38
- const [t, r] = C("idle"), [i, o] = C("idle"), [l, s] = C([]), [a, d] = C(null), [f, _] = C(null), [u, c] = C(null), [I, L] = C(!1), [b, y] = C(null), m = A(null), S = A(e.onDataMessage);
39
- S.current = e.onDataMessage, T(() => {
37
+ function Un(e) {
38
+ const [t, r] = C("idle"), [o, i] = C("idle"), [l, d] = C([]), [a, s] = C(null), [f, b] = C(null), [u, c] = C(null), [I, k] = C(!1), [w, v] = C(null), m = S(null), N = S(e.onDataMessage);
39
+ N.current = e.onDataMessage, M(() => {
40
40
  const R = {
41
41
  onConnectionStateChange: (q) => {
42
- r(q), q === "connected" && y(null);
42
+ r(q), q === "connected" && v(null);
43
43
  },
44
- onAgentStateChange: o,
45
- onTranscript: (q) => s([...q]),
46
- onAgentConfig: d,
44
+ onAgentStateChange: i,
45
+ onTranscript: (q) => d([...q]),
46
+ onAgentConfig: s,
47
47
  onAudioTrack: (q) => c(q),
48
- onVideoTrack: (q) => _(q),
49
- onVideoTrackRemoved: () => _(null),
50
- onError: (q) => y(q),
48
+ onVideoTrack: (q) => b(q),
49
+ onVideoTrackRemoved: () => b(null),
50
+ onError: (q) => v(q),
51
51
  onDataMessage: (q) => {
52
- var N;
53
- (N = S.current) == null || N.call(S, q);
52
+ var A;
53
+ (A = N.current) == null || A.call(N, q);
54
54
  },
55
- onResumabilityChange: L
56
- }, B = new Pn(
55
+ onResumabilityChange: k
56
+ }, B = new Wn(
57
57
  {
58
58
  agentId: e.agentId,
59
59
  baseUrl: e.baseUrl,
@@ -63,7 +63,7 @@ function Wn(e) {
63
63
  },
64
64
  R
65
65
  );
66
- return m.current = B, r("idle"), o("idle"), s([]), d(null), _(null), c(null), L(!1), y(null), () => {
66
+ return m.current = B, r("idle"), i("idle"), d([]), s(null), b(null), c(null), k(!1), v(null), () => {
67
67
  var q;
68
68
  (q = B.destroy) == null || q.call(B), m.current = null;
69
69
  };
@@ -80,7 +80,7 @@ function Wn(e) {
80
80
  try {
81
81
  await R.connect();
82
82
  } catch (B) {
83
- throw y(B instanceof Error ? B.message : String(B)), B;
83
+ throw v(B instanceof Error ? B.message : String(B)), B;
84
84
  }
85
85
  }, []), D = E(() => {
86
86
  const R = m.current;
@@ -91,24 +91,24 @@ function Wn(e) {
91
91
  }, []);
92
92
  return {
93
93
  connectionState: t,
94
- agentState: i,
94
+ agentState: o,
95
95
  transcript: l,
96
96
  agentConfig: a,
97
97
  videoElement: f,
98
98
  audioElement: u,
99
99
  canResume: I,
100
- error: b,
100
+ error: w,
101
101
  connect: $,
102
102
  disconnect: D,
103
103
  getRoom: x,
104
104
  session: m.current
105
105
  };
106
106
  }
107
- function Bn() {
108
- const e = A(null), t = A(null), r = A(null), i = A(null), o = A(/* @__PURE__ */ new Set()), l = A(null), s = E(() => {
107
+ function jn() {
108
+ const e = S(null), t = S(null), r = S(null), o = S(null), i = S(/* @__PURE__ */ new Set()), l = S(null), d = E(() => {
109
109
  const u = t.current;
110
110
  if (!u) {
111
- i.current = null;
111
+ o.current = null;
112
112
  return;
113
113
  }
114
114
  (!l.current || l.current.length !== u.frequencyBinCount) && (l.current = new Uint8Array(
@@ -117,20 +117,20 @@ function Bn() {
117
117
  const c = l.current;
118
118
  u.getByteFrequencyData(c);
119
119
  let I = 0;
120
- for (let b = 0; b < c.length; b++) I += c[b];
121
- const L = I / c.length / 255;
122
- for (const b of o.current)
120
+ for (let w = 0; w < c.length; w++) I += c[w];
121
+ const k = I / c.length / 255;
122
+ for (const w of i.current)
123
123
  try {
124
- b(L);
125
- } catch (y) {
126
- console.error("[useAudioLevel] subscriber threw:", y);
124
+ w(k);
125
+ } catch (v) {
126
+ console.error("[useAudioLevel] subscriber threw:", v);
127
127
  }
128
- i.current = requestAnimationFrame(s);
128
+ o.current = requestAnimationFrame(d);
129
129
  }, []), a = E(() => {
130
130
  if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
131
131
  const u = new AudioContext(), c = u.createAnalyser();
132
132
  c.fftSize = 64, c.connect(u.destination), e.current = u, t.current = c;
133
- }, []), d = E(
133
+ }, []), s = E(
134
134
  (u) => {
135
135
  if (a(), !(!e.current || !t.current)) {
136
136
  if (r.current) {
@@ -147,22 +147,22 @@ function Bn() {
147
147
  console.warn("[useAudioLevel] createMediaElementSource failed:", c);
148
148
  return;
149
149
  }
150
- i.current === null && (i.current = requestAnimationFrame(s));
150
+ o.current === null && (o.current = requestAnimationFrame(d));
151
151
  }
152
152
  },
153
- [a, s]
153
+ [a, d]
154
154
  ), f = E(() => {
155
- if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), r.current) {
155
+ if (o.current !== null && (cancelAnimationFrame(o.current), o.current = null), r.current) {
156
156
  try {
157
157
  r.current.disconnect();
158
158
  } catch {
159
159
  }
160
160
  r.current = null;
161
161
  }
162
- }, []), _ = E((u) => (o.current.add(u), () => {
163
- o.current.delete(u);
162
+ }, []), b = E((u) => (i.current.add(u), () => {
163
+ i.current.delete(u);
164
164
  }), []);
165
- return T(() => () => {
165
+ return M(() => () => {
166
166
  if (f(), t.current) {
167
167
  try {
168
168
  t.current.disconnect();
@@ -177,89 +177,89 @@ function Bn() {
177
177
  }
178
178
  e.current = null;
179
179
  }
180
- o.current.clear(), l.current = null;
181
- }, [f]), { attach: d, detach: f, subscribe: _ };
180
+ i.current.clear(), l.current = null;
181
+ }, [f]), { attach: s, detach: f, subscribe: b };
182
182
  }
183
- function qn() {
184
- const [e, t] = C(!1), [r, i] = C(""), [o, l] = C(null), s = A(null), a = A(null), d = E(async (L) => {
185
- var b, y;
186
- if (s.current && a.current) {
183
+ function Vn() {
184
+ const [e, t] = C(!1), [r, o] = C(""), [i, l] = C(null), d = S(null), a = S(null), s = E(async (k) => {
185
+ var w, v;
186
+ if (d.current && a.current) {
187
187
  try {
188
- await a.current.localParticipant.unpublishTrack(s.current);
188
+ await a.current.localParticipant.unpublishTrack(d.current);
189
189
  } catch {
190
190
  }
191
- s.current.stop(), s.current = null;
191
+ d.current.stop(), d.current = null;
192
192
  }
193
- a.current = L, l(null);
193
+ a.current = k, l(null);
194
194
  try {
195
- const m = await $n({
195
+ const m = await Bn({
196
196
  echoCancellation: !0,
197
197
  noiseSuppression: !0
198
198
  });
199
- await L.localParticipant.publishTrack(m), s.current = m, t(m.isMuted);
200
- const S = (y = (b = m.mediaStreamTrack) == null ? void 0 : b.getSettings) == null ? void 0 : y.call(b);
201
- S != null && S.deviceId && i(S.deviceId);
199
+ await k.localParticipant.publishTrack(m), d.current = m, t(m.isMuted);
200
+ const N = (v = (w = m.mediaStreamTrack) == null ? void 0 : w.getSettings) == null ? void 0 : v.call(w);
201
+ N != null && N.deviceId && o(N.deviceId);
202
202
  } catch (m) {
203
- const S = m instanceof Error && m.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
204
- throw l(S), m;
203
+ const N = m instanceof Error && m.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
204
+ throw l(N), m;
205
205
  }
206
- }, []), f = E((L) => {
207
- a.current = L;
208
- }, []), _ = E(async (L) => {
209
- const b = a.current;
210
- if (b)
206
+ }, []), f = E((k) => {
207
+ a.current = k;
208
+ }, []), b = E(async (k) => {
209
+ const w = a.current;
210
+ if (w)
211
211
  try {
212
- await b.switchActiveDevice("audioinput", L), i(L);
213
- } catch (y) {
214
- console.warn("[useMicrophoneState] switchDevice failed:", y);
212
+ await w.switchActiveDevice("audioinput", k), o(k);
213
+ } catch (v) {
214
+ console.warn("[useMicrophoneState] switchDevice failed:", v);
215
215
  }
216
216
  }, []), u = E(() => {
217
- const L = s.current, b = a.current;
218
- if (L) {
219
- L.isMuted ? (L.unmute(), t(!1)) : (L.mute(), t(!0));
217
+ const k = d.current, w = a.current;
218
+ if (k) {
219
+ k.isMuted ? (k.unmute(), t(!1)) : (k.mute(), t(!0));
220
220
  return;
221
221
  }
222
- if (b) {
223
- const y = !e;
224
- t(y);
222
+ if (w) {
223
+ const v = !e;
224
+ t(v);
225
225
  try {
226
- b.localParticipant.setMicrophoneEnabled(!y);
226
+ w.localParticipant.setMicrophoneEnabled(!v);
227
227
  } catch (m) {
228
228
  console.warn("[useMicrophoneState] setMicrophoneEnabled failed:", m);
229
229
  }
230
230
  }
231
231
  }, [e]), c = E(() => {
232
- const L = s.current, b = a.current;
233
- if (L && b) {
232
+ const k = d.current, w = a.current;
233
+ if (k && w) {
234
234
  try {
235
- b.localParticipant.unpublishTrack(L);
235
+ w.localParticipant.unpublishTrack(k);
236
236
  } catch {
237
237
  }
238
- L.stop();
238
+ k.stop();
239
239
  }
240
- s.current = null, a.current = null, t(!1), i("");
240
+ d.current = null, a.current = null, t(!1), o("");
241
241
  }, []), I = E(() => l(null), []);
242
242
  return {
243
243
  isMuted: e,
244
244
  activeDeviceId: r,
245
- micError: o,
245
+ micError: i,
246
246
  toggleMute: u,
247
- setupMic: d,
247
+ setupMic: s,
248
248
  attachRoom: f,
249
- switchDevice: _,
249
+ switchDevice: b,
250
250
  teardownMic: c,
251
251
  clearError: I
252
252
  };
253
253
  }
254
- const Fn = { resolution: { width: 640, height: 480, frameRate: 24 } };
255
- function Un() {
256
- const [e, t] = C(!1), [r, i] = C(null), [o, l] = C(null), [s, a] = C(""), d = A(null), f = A(null), _ = E((m) => {
257
- d.current = m;
254
+ const Yn = { resolution: { width: 640, height: 480, frameRate: 24 } };
255
+ function Gn() {
256
+ const [e, t] = C(!1), [r, o] = C(null), [i, l] = C(null), [d, a] = C(""), s = S(null), f = S(null), b = E((m) => {
257
+ s.current = m;
258
258
  }, []), u = E(() => {
259
259
  var $;
260
- const m = d.current, S = f.current;
261
- if (S && m) {
262
- const D = m.localParticipant.getTrackPublication(dn.Source.Camera), R = (D == null ? void 0 : D.track) ?? S;
260
+ const m = s.current, N = f.current;
261
+ if (N && m) {
262
+ const D = m.localParticipant.getTrackPublication(mn.Source.Camera), R = (D == null ? void 0 : D.track) ?? N;
263
263
  try {
264
264
  m.localParticipant.unpublishTrack(R);
265
265
  } catch {
@@ -271,18 +271,18 @@ function Un() {
271
271
  }
272
272
  f.current = null, l(null), t(!1);
273
273
  }, []), c = E(async (m) => {
274
- const S = d.current;
275
- if (S) {
276
- i(null);
274
+ const N = s.current;
275
+ if (N) {
276
+ o(null);
277
277
  try {
278
- const $ = { ...Fn };
278
+ const $ = { ...Yn };
279
279
  m && ($.deviceId = m);
280
- const D = await zn($);
281
- await S.localParticipant.publishTrack(D), f.current = D;
280
+ const D = await qn($);
281
+ await N.localParticipant.publishTrack(D), f.current = D;
282
282
  const x = D.attach();
283
283
  l(x), t(!0), m && a(m);
284
284
  try {
285
- S.localParticipant.publishData(
285
+ N.localParticipant.publishData(
286
286
  new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
287
287
  { reliable: !0 }
288
288
  );
@@ -290,53 +290,53 @@ function Un() {
290
290
  }
291
291
  } catch ($) {
292
292
  const D = $ instanceof Error && $.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
293
- i(D);
293
+ o(D);
294
294
  }
295
295
  }
296
296
  }, []), I = E(async () => {
297
- e ? u() : await c(s || void 0);
298
- }, [e, s, u, c]), L = E(async (m) => {
297
+ e ? u() : await c(d || void 0);
298
+ }, [e, d, u, c]), k = E(async (m) => {
299
299
  u(), await c(m);
300
- }, [u, c]), b = E(() => {
301
- u(), d.current = null, i(null), a("");
302
- }, [u]), y = E(() => i(null), []);
303
- return T(() => () => {
300
+ }, [u, c]), w = E(() => {
301
+ u(), s.current = null, o(null), a("");
302
+ }, [u]), v = E(() => o(null), []);
303
+ return M(() => () => {
304
304
  f.current && f.current.stop();
305
305
  }, []), {
306
306
  isEnabled: e,
307
307
  error: r,
308
- previewEl: o,
309
- activeDeviceId: s,
308
+ previewEl: i,
309
+ activeDeviceId: d,
310
310
  toggle: I,
311
- switchDevice: L,
312
- attachRoom: _,
313
- teardown: b,
314
- clearError: y
311
+ switchDevice: k,
312
+ attachRoom: b,
313
+ teardown: w,
314
+ clearError: v
315
315
  };
316
316
  }
317
- function jn() {
318
- const [e, t] = C(!1), [r, i] = C(null), [o, l] = C(null), s = A(null), a = E((c) => {
319
- s.current = c;
320
- }, []), d = E(() => l(null), []), f = E(async () => {
321
- const c = s.current;
317
+ function Jn() {
318
+ const [e, t] = C(!1), [r, o] = C(null), [i, l] = C(null), d = S(null), a = E((c) => {
319
+ d.current = c;
320
+ }, []), s = E(() => l(null), []), f = E(async () => {
321
+ const c = d.current;
322
322
  if (c) {
323
323
  if (e) {
324
324
  try {
325
325
  await c.localParticipant.setScreenShareEnabled(!1);
326
326
  } catch {
327
327
  }
328
- d(), t(!1);
328
+ s(), t(!1);
329
329
  return;
330
330
  }
331
- i(null);
331
+ o(null);
332
332
  try {
333
333
  await c.localParticipant.setScreenShareEnabled(!0);
334
334
  let I = 0;
335
- const L = () => {
336
- const b = c.localParticipant.getTrackPublication(dn.Source.ScreenShare);
337
- if (b != null && b.track) {
338
- const y = b.track.attach();
339
- l(y), t(!0);
335
+ const k = () => {
336
+ const w = c.localParticipant.getTrackPublication(mn.Source.ScreenShare);
337
+ if (w != null && w.track) {
338
+ const v = w.track.attach();
339
+ l(v), t(!0);
340
340
  try {
341
341
  c.localParticipant.publishData(
342
342
  new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
@@ -346,49 +346,49 @@ function jn() {
346
346
  }
347
347
  return;
348
348
  }
349
- I++ < 10 ? setTimeout(L, 100) : t(!0);
349
+ I++ < 10 ? setTimeout(k, 100) : t(!0);
350
350
  };
351
- L();
351
+ k();
352
352
  } catch (I) {
353
- const L = I instanceof Error ? I.name : "";
354
- L !== "NotAllowedError" && L !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
353
+ const k = I instanceof Error ? I.name : "";
354
+ k !== "NotAllowedError" && k !== "AbortError" && o("Screen share unavailable. Try again."), t(!1);
355
355
  }
356
356
  }
357
- }, [e, d]), _ = E(() => {
358
- const c = s.current;
357
+ }, [e, s]), b = E(() => {
358
+ const c = d.current;
359
359
  if (c && e)
360
360
  try {
361
361
  c.localParticipant.setScreenShareEnabled(!1);
362
362
  } catch {
363
363
  }
364
- d(), t(!1), i(null), s.current = null;
365
- }, [e, d]), u = E(() => i(null), []);
366
- return { isEnabled: e, error: r, previewEl: o, toggle: f, attachRoom: a, teardown: _, clearError: u };
364
+ s(), t(!1), o(null), d.current = null;
365
+ }, [e, s]), u = E(() => o(null), []);
366
+ return { isEnabled: e, error: r, previewEl: i, toggle: f, attachRoom: a, teardown: b, clearError: u };
367
367
  }
368
- function Vn() {
369
- const [e, t] = C([]), [r, i] = C([]), o = E(async () => {
368
+ function Kn() {
369
+ const [e, t] = C([]), [r, o] = C([]), i = E(async () => {
370
370
  if (!(typeof navigator > "u" || !navigator.mediaDevices))
371
371
  try {
372
372
  const l = await navigator.mediaDevices.enumerateDevices();
373
- t(l.filter((s) => s.kind === "audioinput")), i(l.filter((s) => s.kind === "videoinput"));
373
+ t(l.filter((d) => d.kind === "audioinput")), o(l.filter((d) => d.kind === "videoinput"));
374
374
  } catch {
375
375
  }
376
376
  }, []);
377
- return T(() => {
378
- if (o(), typeof navigator > "u" || !navigator.mediaDevices) return;
379
- const l = () => void o();
377
+ return M(() => {
378
+ if (i(), typeof navigator > "u" || !navigator.mediaDevices) return;
379
+ const l = () => void i();
380
380
  return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
381
- }, [o]), { mics: e, cameras: r, refresh: o };
381
+ }, [i]), { mics: e, cameras: r, refresh: i };
382
382
  }
383
- function Yn(e, t, r = !1) {
384
- const [i, o] = C(null), [l, s] = C(null), [a, d] = C(!r && !!e);
385
- return T(() => {
383
+ function Xn(e, t, r = !1) {
384
+ const [o, i] = C(null), [l, d] = C(null), [a, s] = C(!r && !!e);
385
+ return M(() => {
386
386
  if (r || !e) {
387
- d(!1);
387
+ s(!1);
388
388
  return;
389
389
  }
390
- const f = new AbortController(), _ = t || "https://app.livelayer.studio";
391
- return d(!0), s(null), fetch(`${_}/api/widget/agent/${encodeURIComponent(e)}`, {
390
+ const f = new AbortController(), b = t || "https://app.livelayer.studio";
391
+ return s(!0), d(null), fetch(`${b}/api/widget/agent/${encodeURIComponent(e)}`, {
392
392
  signal: f.signal
393
393
  }).then(async (u) => {
394
394
  if (!u.ok) {
@@ -397,13 +397,13 @@ function Yn(e, t, r = !1) {
397
397
  }
398
398
  return u.json();
399
399
  }).then((u) => {
400
- f.signal.aborted || (o(u), d(!1));
400
+ f.signal.aborted || (i(u), s(!1));
401
401
  }).catch((u) => {
402
- f.signal.aborted || (s(u instanceof Error ? u.message : "Agent lookup failed"), d(!1));
402
+ f.signal.aborted || (d(u instanceof Error ? u.message : "Agent lookup failed"), s(!1));
403
403
  }), () => f.abort();
404
- }, [e, t, r]), { info: i, error: l, loading: a };
404
+ }, [e, t, r]), { info: o, error: l, loading: a };
405
405
  }
406
- function Gn(e) {
406
+ function Qn(e) {
407
407
  if (typeof window > "u") return null;
408
408
  try {
409
409
  return window.localStorage.getItem(e);
@@ -411,192 +411,192 @@ function Gn(e) {
411
411
  return null;
412
412
  }
413
413
  }
414
- function Jn(e, t) {
414
+ function Zn(e, t) {
415
415
  if (!(typeof window > "u"))
416
416
  try {
417
417
  window.localStorage.setItem(e, t);
418
418
  } catch {
419
419
  }
420
420
  }
421
- function Kn({
421
+ function er({
422
422
  value: e,
423
423
  defaultValue: t = "expanded",
424
424
  onChange: r
425
425
  } = {}) {
426
- const i = e !== void 0, [o, l] = C(t), s = i ? e : o, a = E(
427
- (d) => {
428
- d !== s && (i || l(d), r == null || r(d));
426
+ const o = e !== void 0, [i, l] = C(t), d = o ? e : i, a = E(
427
+ (s) => {
428
+ s !== d && (o || l(s), r == null || r(s));
429
429
  },
430
- [s, i, r]
430
+ [d, o, r]
431
431
  );
432
- return [s, a];
432
+ return [d, a];
433
433
  }
434
- const Xn = ["hidden", "minimized", "expanded"];
435
- function Qn(e) {
436
- return e && Xn.includes(e) ? e : null;
434
+ const tr = ["hidden", "minimized", "expanded"];
435
+ function nr(e) {
436
+ return e && tr.includes(e) ? e : null;
437
437
  }
438
- function Zn({
438
+ function rr({
439
439
  value: e,
440
440
  defaultValue: t = "expanded",
441
441
  onChange: r,
442
- persistKey: i = "ll-widget",
443
- disablePersistence: o = !1
442
+ persistKey: o = "ll-widget",
443
+ disablePersistence: i = !1
444
444
  } = {}) {
445
- const l = `${i}:display-mode`, s = A(!1), [a, d] = Kn({
445
+ const l = `${o}:display-mode`, d = S(!1), [a, s] = er({
446
446
  value: e,
447
447
  defaultValue: t,
448
448
  onChange: (f) => {
449
- e === void 0 && !o && Jn(l, f), r == null || r(f);
449
+ e === void 0 && !i && Zn(l, f), r == null || r(f);
450
450
  }
451
451
  });
452
- return T(() => {
453
- if (s.current || (s.current = !0, o || e !== void 0)) return;
454
- const f = Qn(Gn(l));
455
- f && f !== a && d(f);
456
- }, []), [a, d];
457
- }
458
- const er = 640;
459
- function tr(e = er) {
452
+ return M(() => {
453
+ if (d.current || (d.current = !0, i || e !== void 0)) return;
454
+ const f = nr(Qn(l));
455
+ f && f !== a && s(f);
456
+ }, []), [a, s];
457
+ }
458
+ const or = 640;
459
+ function ir(e = or) {
460
460
  const [t, r] = C(!1);
461
- return T(() => {
461
+ return M(() => {
462
462
  if (e === !1) {
463
463
  r(!1);
464
464
  return;
465
465
  }
466
466
  if (typeof window > "u" || typeof window.matchMedia > "u")
467
467
  return;
468
- const i = `(max-width: ${e - 1}px)`, o = window.matchMedia(i), l = () => r(o.matches);
469
- return l(), typeof o.addEventListener == "function" ? (o.addEventListener("change", l), () => o.removeEventListener("change", l)) : (o.addListener(l), () => {
470
- o.removeListener(l);
468
+ const o = `(max-width: ${e - 1}px)`, i = window.matchMedia(o), l = () => r(i.matches);
469
+ return l(), typeof i.addEventListener == "function" ? (i.addEventListener("change", l), () => i.removeEventListener("change", l)) : (i.addListener(l), () => {
470
+ i.removeListener(l);
471
471
  });
472
472
  }, [e]), t;
473
473
  }
474
- const jt = "__llHistoryPatched", gt = "ll:pathname";
475
- function nr() {
476
- if (typeof window > "u" || window.history[jt]) return;
474
+ const Jt = "__llHistoryPatched", wt = "ll:pathname";
475
+ function lr() {
476
+ if (typeof window > "u" || window.history[Jt]) return;
477
477
  const e = window.history.pushState, t = window.history.replaceState;
478
478
  window.history.pushState = function(...r) {
479
- const i = e.apply(this, r);
480
- return window.dispatchEvent(new Event(gt)), i;
479
+ const o = e.apply(this, r);
480
+ return window.dispatchEvent(new Event(wt)), o;
481
481
  }, window.history.replaceState = function(...r) {
482
- const i = t.apply(this, r);
483
- return window.dispatchEvent(new Event(gt)), i;
484
- }, window.history[jt] = !0;
482
+ const o = t.apply(this, r);
483
+ return window.dispatchEvent(new Event(wt)), o;
484
+ }, window.history[Jt] = !0;
485
485
  }
486
- function Vt() {
486
+ function Kt() {
487
487
  return typeof window > "u" ? "/" : window.location.pathname || "/";
488
488
  }
489
- function rr(e) {
489
+ function ar(e) {
490
490
  const [t, r] = C(
491
- () => e ?? Vt()
491
+ () => e ?? Kt()
492
492
  );
493
- return T(() => {
493
+ return M(() => {
494
494
  if (e !== void 0) return;
495
- nr();
496
- const i = () => r(Vt());
497
- return i(), window.addEventListener("popstate", i), window.addEventListener(gt, i), () => {
498
- window.removeEventListener("popstate", i), window.removeEventListener(gt, i);
495
+ lr();
496
+ const o = () => r(Kt());
497
+ return o(), window.addEventListener("popstate", o), window.addEventListener(wt, o), () => {
498
+ window.removeEventListener("popstate", o), window.removeEventListener(wt, o);
499
499
  };
500
500
  }, [e]), e ?? t;
501
501
  }
502
- const Yt = /* @__PURE__ */ new Map(), ir = /[\\^$+?.()|{}[\]]/g;
503
- function or(e) {
504
- return e.replace(ir, "\\$&");
502
+ const Xt = /* @__PURE__ */ new Map(), cr = /[\\^$+?.()|{}[\]]/g;
503
+ function sr(e) {
504
+ return e.replace(cr, "\\$&");
505
505
  }
506
- function lr(e) {
507
- const t = Yt.get(e);
506
+ function dr(e) {
507
+ const t = Xt.get(e);
508
508
  if (t) return t;
509
- const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", o = "", l = r.replace(/\*\*/g, i).replace(/\*/g, o), a = or(l).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(o, "g"), "[^/]+"), d = new RegExp(`^${a}\\/?$`);
510
- return Yt.set(e, d), d;
509
+ const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, o = "", i = "", l = r.replace(/\*\*/g, o).replace(/\*/g, i), a = sr(l).replace(new RegExp(`\\/${o}`, "g"), "(?:\\/.*)?").replace(new RegExp(o, "g"), ".*").replace(new RegExp(i, "g"), "[^/]+"), s = new RegExp(`^${a}\\/?$`);
510
+ return Xt.set(e, s), s;
511
511
  }
512
- function ar(e, t) {
512
+ function ur(e, t) {
513
513
  const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
514
- return lr(e).test(r);
514
+ return dr(e).test(r);
515
515
  }
516
- function cr(e, t) {
517
- return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : ar(e, t);
516
+ function fr(e, t) {
517
+ return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : ur(e, t);
518
518
  }
519
- function Gt(e, t) {
519
+ function Qt(e, t) {
520
520
  if (!e || e.length === 0) return !1;
521
521
  for (const r of e)
522
- if (cr(r, t)) return !0;
522
+ if (fr(r, t)) return !0;
523
523
  return !1;
524
524
  }
525
- function sr(e, t, r) {
526
- return e === void 0 ? !0 : Gt(r, e) ? !1 : t && t.length > 0 ? Gt(t, e) : !0;
525
+ function pr(e, t, r) {
526
+ return e === void 0 ? !0 : Qt(r, e) ? !1 : t && t.length > 0 ? Qt(t, e) : !0;
527
527
  }
528
- function dr(e, t, r) {
529
- return Ue(
530
- () => sr(e, t, r),
528
+ function hr(e, t, r) {
529
+ return Ye(
530
+ () => pr(e, t, r),
531
531
  [e, t, r]
532
532
  );
533
533
  }
534
- function ur(e) {
534
+ function mr(e) {
535
535
  return e === !1 ? { navigate: !1, thinking: !1, action: !1 } : e === void 0 || e === !0 ? { navigate: !0, thinking: !0, action: !0 } : {
536
536
  navigate: e.navigate !== !1,
537
537
  thinking: e.thinking !== !1,
538
538
  action: e.action !== !1
539
539
  };
540
540
  }
541
- function fr(e) {
542
- const t = Ue(() => ur(e.config), [e.config]), r = e.baseUrl.replace(/\/+$/, ""), i = A(null), o = E(
543
- (d) => {
541
+ function gr(e) {
542
+ const t = Ye(() => mr(e.config), [e.config]), r = e.baseUrl.replace(/\/+$/, ""), o = S(null), i = E(
543
+ (s) => {
544
544
  try {
545
- new Audio(`${r}${d}`).play().catch(() => {
545
+ new Audio(`${r}${s}`).play().catch(() => {
546
546
  });
547
547
  } catch {
548
548
  }
549
549
  },
550
550
  [r]
551
551
  ), l = E(() => {
552
- t.navigate && o("/audio/page-change-sound.mp3");
553
- }, [t.navigate, o]), s = E(() => {
554
- t.action && o("/audio/confirmation-sound.mp3");
555
- }, [t.action, o]), a = E(
556
- (d) => {
552
+ t.navigate && i("/audio/page-change-sound.mp3");
553
+ }, [t.navigate, i]), d = E(() => {
554
+ t.action && i("/audio/confirmation-sound.mp3");
555
+ }, [t.action, i]), a = E(
556
+ (s) => {
557
557
  if (!t.thinking) {
558
- if (i.current) {
558
+ if (o.current) {
559
559
  try {
560
- i.current.pause();
560
+ o.current.pause();
561
561
  } catch {
562
562
  }
563
- i.current = null;
563
+ o.current = null;
564
564
  }
565
565
  return;
566
566
  }
567
- if (d) {
568
- if (i.current) return;
567
+ if (s) {
568
+ if (o.current) return;
569
569
  try {
570
570
  const f = new Audio(`${r}/audio/thinking-sound.mp3`);
571
571
  f.loop = !0, f.volume = 0.3, f.play().catch(() => {
572
- i.current = null;
573
- }), i.current = f;
572
+ o.current = null;
573
+ }), o.current = f;
574
574
  } catch {
575
575
  }
576
- } else if (i.current) {
576
+ } else if (o.current) {
577
577
  try {
578
- i.current.pause();
578
+ o.current.pause();
579
579
  } catch {
580
580
  }
581
- i.current = null;
581
+ o.current = null;
582
582
  }
583
583
  },
584
584
  [r, t.thinking]
585
585
  );
586
- return T(() => () => {
587
- if (i.current) {
586
+ return M(() => () => {
587
+ if (o.current) {
588
588
  try {
589
- i.current.pause();
589
+ o.current.pause();
590
590
  } catch {
591
591
  }
592
- i.current = null;
592
+ o.current = null;
593
593
  }
594
- }, []), Ue(
595
- () => ({ playPageChange: l, playConfirmation: s, setThinking: a }),
596
- [l, s, a]
594
+ }, []), Ye(
595
+ () => ({ playPageChange: l, playConfirmation: d, setThinking: a }),
596
+ [l, d, a]
597
597
  );
598
598
  }
599
- const Jt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ v(
599
+ const Zt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ y(
600
600
  "svg",
601
601
  {
602
602
  className: t,
@@ -642,7 +642,7 @@ const Jt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ v(
642
642
  }
643
643
  )
644
644
  }
645
- ), Kt = ({ className: e }) => /* @__PURE__ */ n(
645
+ ), en = ({ className: e }) => /* @__PURE__ */ n(
646
646
  "svg",
647
647
  {
648
648
  className: e,
@@ -660,7 +660,7 @@ const Jt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ v(
660
660
  }
661
661
  )
662
662
  }
663
- ), pr = ({ className: e }) => /* @__PURE__ */ n(
663
+ ), yr = ({ className: e }) => /* @__PURE__ */ n(
664
664
  "svg",
665
665
  {
666
666
  className: e,
@@ -671,12 +671,12 @@ const Jt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ v(
671
671
  "aria-hidden": "true",
672
672
  children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
673
673
  }
674
- ), hr = {
674
+ ), vr = {
675
675
  left: 180,
676
676
  right: 0,
677
677
  up: -90,
678
678
  down: 90
679
- }, Xt = ({ direction: e = "right", className: t }) => /* @__PURE__ */ n(
679
+ }, tn = ({ direction: e = "right", className: t }) => /* @__PURE__ */ n(
680
680
  "svg",
681
681
  {
682
682
  className: t,
@@ -684,19 +684,19 @@ const Jt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ v(
684
684
  viewBox: "0 0 24 24",
685
685
  stroke: "currentColor",
686
686
  strokeWidth: 2,
687
- style: { transform: `rotate(${hr[e]}deg)` },
687
+ style: { transform: `rotate(${vr[e]}deg)` },
688
688
  "aria-hidden": "true",
689
689
  children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" })
690
690
  }
691
691
  );
692
- function mr(e) {
692
+ function br(e) {
693
693
  return e === "top-left" || e === "bottom-left" ? "left" : "right";
694
694
  }
695
- const un = "ll-hidden-tab-center-y", gr = 5, Qt = 16;
696
- function yr() {
695
+ const gn = "ll-hidden-tab-center-y", wr = 5, nn = 16;
696
+ function _r() {
697
697
  if (typeof window > "u") return null;
698
698
  try {
699
- const e = window.localStorage.getItem(un);
699
+ const e = window.localStorage.getItem(gn);
700
700
  if (!e) return null;
701
701
  const t = Number.parseFloat(e);
702
702
  return Number.isFinite(t) ? t : null;
@@ -704,47 +704,47 @@ function yr() {
704
704
  return null;
705
705
  }
706
706
  }
707
- function Zt(e) {
707
+ function rn(e) {
708
708
  if (!(typeof window > "u"))
709
709
  try {
710
- window.localStorage.setItem(un, String(e));
710
+ window.localStorage.setItem(gn, String(e));
711
711
  } catch {
712
712
  }
713
713
  }
714
- const vr = ({
714
+ const xr = ({
715
715
  position: e,
716
716
  isMobile: t,
717
717
  isSpeaking: r,
718
- onExpand: i,
719
- label: o = "Open widget",
718
+ onExpand: o,
719
+ label: i = "Open widget",
720
720
  avatarImageUrl: l,
721
- agentName: s
721
+ agentName: d
722
722
  }) => {
723
- const a = mr(e), d = a === "right" ? "left" : "right", f = t ? 80 : 72, _ = !!l, [u, c] = C(null), [I, L] = C(!1), b = A(null), y = A(!1), m = E(
724
- (N) => {
725
- if (typeof window > "u") return N;
726
- const M = f / 2, F = Qt + M, re = window.innerHeight - Qt - M;
727
- return re < F ? Math.max(F, N) : Math.max(F, Math.min(re, N));
723
+ const a = br(e), s = a === "right" ? "left" : "right", f = t ? 80 : 72, b = !!l, [u, c] = C(null), [I, k] = C(!1), w = S(null), v = S(!1), m = E(
724
+ (A) => {
725
+ if (typeof window > "u") return A;
726
+ const T = f / 2, F = nn + T, oe = window.innerHeight - nn - T;
727
+ return oe < F ? Math.max(F, A) : Math.max(F, Math.min(oe, A));
728
728
  },
729
729
  [f]
730
730
  );
731
- T(() => {
732
- const N = yr();
733
- c(m(N ?? window.innerHeight / 2));
734
- const M = () => {
731
+ M(() => {
732
+ const A = _r();
733
+ c(m(A ?? window.innerHeight / 2));
734
+ const T = () => {
735
735
  c((F) => F === null ? null : m(F));
736
736
  };
737
- return window.addEventListener("resize", M), () => window.removeEventListener("resize", M);
737
+ return window.addEventListener("resize", T), () => window.removeEventListener("resize", T);
738
738
  }, [m]);
739
- const S = E(
740
- (N) => {
741
- if (!(N.pointerType === "mouse" && N.button !== 0) && u !== null) {
739
+ const N = E(
740
+ (A) => {
741
+ if (!(A.pointerType === "mouse" && A.button !== 0) && u !== null) {
742
742
  try {
743
- N.currentTarget.setPointerCapture(N.pointerId);
743
+ A.currentTarget.setPointerCapture(A.pointerId);
744
744
  } catch {
745
745
  }
746
- b.current = {
747
- startClientY: N.clientY,
746
+ w.current = {
747
+ startClientY: A.clientY,
748
748
  startCenterY: u,
749
749
  moved: !1
750
750
  };
@@ -752,40 +752,40 @@ const vr = ({
752
752
  },
753
753
  [u]
754
754
  ), $ = E(
755
- (N) => {
756
- const M = b.current;
757
- if (!M) return;
758
- const F = N.clientY - M.startClientY;
759
- !M.moved && Math.abs(F) > gr && (M.moved = !0, L(!0)), M.moved && c(m(M.startCenterY + F));
755
+ (A) => {
756
+ const T = w.current;
757
+ if (!T) return;
758
+ const F = A.clientY - T.startClientY;
759
+ !T.moved && Math.abs(F) > wr && (T.moved = !0, k(!0)), T.moved && c(m(T.startCenterY + F));
760
760
  },
761
761
  [m]
762
762
  ), D = E(
763
- (N) => {
764
- const M = b.current;
765
- if (M) {
763
+ (A) => {
764
+ const T = w.current;
765
+ if (T) {
766
766
  try {
767
- N.currentTarget.releasePointerCapture(N.pointerId);
767
+ A.currentTarget.releasePointerCapture(A.pointerId);
768
768
  } catch {
769
769
  }
770
- b.current = null, M.moved && (L(!1), y.current = !0, c((F) => (F !== null && Zt(F), F)));
770
+ w.current = null, T.moved && (k(!1), v.current = !0, c((F) => (F !== null && rn(F), F)));
771
771
  }
772
772
  },
773
773
  []
774
774
  ), x = E(() => {
775
- if (y.current) {
776
- y.current = !1;
775
+ if (v.current) {
776
+ v.current = !1;
777
777
  return;
778
778
  }
779
- i();
780
- }, [i]), R = E(
781
- (N) => {
782
- if (N.key === "ArrowUp" || N.key === "ArrowDown") {
783
- N.preventDefault();
784
- const M = N.key === "ArrowUp" ? -8 : 8;
779
+ o();
780
+ }, [o]), R = E(
781
+ (A) => {
782
+ if (A.key === "ArrowUp" || A.key === "ArrowDown") {
783
+ A.preventDefault();
784
+ const T = A.key === "ArrowUp" ? -8 : 8;
785
785
  c((F) => {
786
786
  if (F === null) return F;
787
- const re = m(F + M);
788
- return Zt(re), re;
787
+ const oe = m(F + T);
788
+ return rn(oe), oe;
789
789
  });
790
790
  }
791
791
  },
@@ -796,32 +796,32 @@ const vr = ({
796
796
  t ? "ll-hidden--mobile" : "ll-hidden--desktop",
797
797
  r ? "ll-hidden--speaking" : null,
798
798
  I ? "is-dragging" : null,
799
- _ ? "ll-hidden--with-avatar" : null
799
+ b ? "ll-hidden--with-avatar" : null
800
800
  ].filter(Boolean).join(" "), q = u === null ? void 0 : { top: `${u - f / 2}px`, transform: "none" };
801
801
  return /* @__PURE__ */ n(
802
802
  "button",
803
803
  {
804
804
  type: "button",
805
805
  className: B,
806
- onPointerDown: S,
806
+ onPointerDown: N,
807
807
  onPointerMove: $,
808
808
  onPointerUp: D,
809
809
  onPointerCancel: D,
810
810
  onClick: x,
811
811
  onKeyDown: R,
812
- "aria-label": o,
812
+ "aria-label": i,
813
813
  "data-position": e,
814
814
  style: q,
815
- children: _ ? (
815
+ children: b ? (
816
816
  // Layout: tiny chevron flush against the inward edge (peeks out
817
817
  // as the click affordance), then the circular avatar photo
818
818
  // taking the rest of the tab. Reinforces "this is an
819
819
  // avatar-based experience" even when collapsed.
820
- /* @__PURE__ */ v(ot, { children: [
820
+ /* @__PURE__ */ y(Ve, { children: [
821
821
  /* @__PURE__ */ n(
822
- Xt,
822
+ tn,
823
823
  {
824
- direction: d,
824
+ direction: s,
825
825
  className: "ll-hidden__chevron ll-hidden__chevron--mini"
826
826
  }
827
827
  ),
@@ -829,63 +829,63 @@ const vr = ({
829
829
  "img",
830
830
  {
831
831
  src: l,
832
- alt: s ? `${s} avatar` : "Agent avatar",
832
+ alt: d ? `${d} avatar` : "Agent avatar",
833
833
  className: "ll-hidden__avatar",
834
834
  draggable: !1
835
835
  }
836
836
  )
837
837
  ] })
838
838
  ) : /* @__PURE__ */ n(
839
- Xt,
839
+ tn,
840
840
  {
841
- direction: d,
841
+ direction: s,
842
842
  className: "ll-hidden__chevron"
843
843
  }
844
844
  )
845
845
  }
846
846
  );
847
- }, br = ({
847
+ }, kr = ({
848
848
  audioLevel: e,
849
849
  bars: t = 20,
850
850
  maxHeight: r = 20,
851
- minHeight: i = 4,
852
- className: o,
851
+ minHeight: o = 4,
852
+ className: i,
853
853
  barClassName: l
854
854
  }) => {
855
- const s = A(null), a = A([]), d = Ue(() => {
856
- const _ = (Math.sqrt(5) - 1) / 2;
857
- return Array.from({ length: t }, (u, c) => 0.5 + c * _ % 1 * 0.5);
855
+ const d = S(null), a = S([]), s = Ye(() => {
856
+ const b = (Math.sqrt(5) - 1) / 2;
857
+ return Array.from({ length: t }, (u, c) => 0.5 + c * b % 1 * 0.5);
858
858
  }, [t]);
859
- T(() => e.subscribe((u) => {
859
+ M(() => e.subscribe((u) => {
860
860
  for (let c = 0; c < t; c++) {
861
861
  const I = a.current[c];
862
862
  if (!I) continue;
863
- const L = Math.max(i, u * r * d[c]);
864
- I.style.height = `${L}px`;
863
+ const k = Math.max(o, u * r * s[c]);
864
+ I.style.height = `${k}px`;
865
865
  }
866
- }), [e, t, r, i, d]);
867
- const f = ["ll-waveform", o].filter(Boolean).join(" ");
868
- return /* @__PURE__ */ n("div", { ref: s, className: f, "aria-hidden": "true", children: Array.from({ length: t }, (_, u) => /* @__PURE__ */ n(
866
+ }), [e, t, r, o, s]);
867
+ const f = ["ll-waveform", i].filter(Boolean).join(" ");
868
+ return /* @__PURE__ */ n("div", { ref: d, className: f, "aria-hidden": "true", children: Array.from({ length: t }, (b, u) => /* @__PURE__ */ n(
869
869
  "div",
870
870
  {
871
871
  ref: (c) => {
872
872
  a.current[u] = c;
873
873
  },
874
874
  className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
875
- style: { height: `${i}px` }
875
+ style: { height: `${o}px` }
876
876
  },
877
877
  u
878
878
  )) });
879
- }, wr = ({
879
+ }, Lr = ({
880
880
  position: e,
881
881
  isMobile: t,
882
882
  agentName: r,
883
- avatarImageUrl: i,
884
- agentState: o,
883
+ avatarImageUrl: o,
884
+ agentState: i,
885
885
  isMuted: l,
886
- audioLevel: s,
886
+ audioLevel: d,
887
887
  onExpand: a,
888
- onToggleMute: d,
888
+ onToggleMute: s,
889
889
  onClose: f
890
890
  }) => t ? /* @__PURE__ */ n(
891
891
  "div",
@@ -893,7 +893,7 @@ const vr = ({
893
893
  className: "ll-minimized ll-minimized--mobile",
894
894
  role: "region",
895
895
  "aria-label": `${r} widget`,
896
- children: /* @__PURE__ */ v(
896
+ children: /* @__PURE__ */ y(
897
897
  "button",
898
898
  {
899
899
  type: "button",
@@ -901,45 +901,45 @@ const vr = ({
901
901
  onClick: a,
902
902
  "aria-label": `Expand ${r} widget`,
903
903
  children: [
904
- i ? (
904
+ o ? (
905
905
  // eslint-disable-next-line @next/next/no-img-element
906
906
  /* @__PURE__ */ n(
907
907
  "img",
908
908
  {
909
- src: i,
909
+ src: o,
910
910
  alt: r,
911
911
  className: "ll-minimized__avatar"
912
912
  }
913
913
  )
914
914
  ) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
915
915
  /* @__PURE__ */ n(
916
- br,
916
+ kr,
917
917
  {
918
- audioLevel: s,
918
+ audioLevel: d,
919
919
  bars: 16,
920
920
  maxHeight: 18,
921
921
  className: "ll-minimized__waveform"
922
922
  }
923
923
  ),
924
924
  /* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
925
- /* @__PURE__ */ v("div", { className: "ll-minimized__controls", children: [
925
+ /* @__PURE__ */ y("div", { className: "ll-minimized__controls", children: [
926
926
  /* @__PURE__ */ n(
927
927
  "span",
928
928
  {
929
929
  className: "ll-minimized__btn",
930
930
  role: "button",
931
931
  tabIndex: 0,
932
- onClick: (_) => {
933
- _.stopPropagation(), d();
932
+ onClick: (b) => {
933
+ b.stopPropagation(), s();
934
934
  },
935
- onKeyDown: (_) => {
936
- (_.key === "Enter" || _.key === " ") && (_.stopPropagation(), _.preventDefault(), d());
935
+ onKeyDown: (b) => {
936
+ (b.key === "Enter" || b.key === " ") && (b.stopPropagation(), b.preventDefault(), s());
937
937
  },
938
938
  "aria-label": l ? "Unmute microphone" : "Mute microphone",
939
- children: /* @__PURE__ */ n(Jt, { muted: l, className: "ll-minimized__icon" })
939
+ children: /* @__PURE__ */ n(Zt, { muted: l, className: "ll-minimized__icon" })
940
940
  }
941
941
  ),
942
- /* @__PURE__ */ n(Kt, { className: "ll-minimized__icon ll-minimized__icon--expand" })
942
+ /* @__PURE__ */ n(en, { className: "ll-minimized__icon ll-minimized__icon--expand" })
943
943
  ] })
944
944
  ]
945
945
  }
@@ -952,31 +952,31 @@ const vr = ({
952
952
  "data-position": e,
953
953
  role: "region",
954
954
  "aria-label": `${r} widget`,
955
- children: /* @__PURE__ */ v("div", { className: "ll-minimized__surface", children: [
956
- i ? (
955
+ children: /* @__PURE__ */ y("div", { className: "ll-minimized__surface", children: [
956
+ o ? (
957
957
  // eslint-disable-next-line @next/next/no-img-element
958
958
  /* @__PURE__ */ n(
959
959
  "img",
960
960
  {
961
- src: i,
961
+ src: o,
962
962
  alt: r,
963
963
  className: "ll-minimized__avatar"
964
964
  }
965
965
  )
966
966
  ) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
967
- /* @__PURE__ */ v("div", { className: "ll-minimized__meta", children: [
967
+ /* @__PURE__ */ y("div", { className: "ll-minimized__meta", children: [
968
968
  /* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
969
- /* @__PURE__ */ n("span", { className: "ll-minimized__state", children: o === "speaking" ? "Speaking" : o === "thinking" ? "Thinking" : "Listening" })
969
+ /* @__PURE__ */ n("span", { className: "ll-minimized__state", children: i === "speaking" ? "Speaking" : i === "thinking" ? "Thinking" : "Listening" })
970
970
  ] }),
971
- /* @__PURE__ */ v("div", { className: "ll-minimized__controls", children: [
971
+ /* @__PURE__ */ y("div", { className: "ll-minimized__controls", children: [
972
972
  /* @__PURE__ */ n(
973
973
  "button",
974
974
  {
975
975
  type: "button",
976
976
  className: "ll-minimized__btn",
977
- onClick: d,
977
+ onClick: s,
978
978
  "aria-label": l ? "Unmute microphone" : "Mute microphone",
979
- children: /* @__PURE__ */ n(Jt, { muted: l, className: "ll-minimized__icon" })
979
+ children: /* @__PURE__ */ n(Zt, { muted: l, className: "ll-minimized__icon" })
980
980
  }
981
981
  ),
982
982
  /* @__PURE__ */ n(
@@ -986,7 +986,7 @@ const vr = ({
986
986
  className: "ll-minimized__btn",
987
987
  onClick: a,
988
988
  "aria-label": `Expand ${r} widget`,
989
- children: /* @__PURE__ */ n(Kt, { className: "ll-minimized__icon" })
989
+ children: /* @__PURE__ */ n(en, { className: "ll-minimized__icon" })
990
990
  }
991
991
  ),
992
992
  /* @__PURE__ */ n(
@@ -996,24 +996,24 @@ const vr = ({
996
996
  className: "ll-minimized__btn ll-minimized__btn--close",
997
997
  onClick: f,
998
998
  "aria-label": "Close widget",
999
- children: /* @__PURE__ */ n(pr, { className: "ll-minimized__icon" })
999
+ children: /* @__PURE__ */ n(yr, { className: "ll-minimized__icon" })
1000
1000
  }
1001
1001
  )
1002
1002
  ] })
1003
1003
  ] })
1004
1004
  }
1005
- ), _r = ({
1005
+ ), Er = ({
1006
1006
  src: e,
1007
1007
  alt: t,
1008
1008
  preCannedPlaying: r = !1,
1009
- className: i,
1010
- style: o
1009
+ className: o,
1010
+ style: i
1011
1011
  }) => {
1012
- const [l, s] = C(!1), a = A(e);
1013
- if (T(() => {
1014
- a.current !== e && (a.current = e, s(!1));
1012
+ const [l, d] = C(!1), a = S(e);
1013
+ if (M(() => {
1014
+ a.current !== e && (a.current = e, d(!1));
1015
1015
  }, [e]), !e) return null;
1016
- const d = {
1016
+ const s = {
1017
1017
  position: "absolute",
1018
1018
  inset: 0,
1019
1019
  width: "100%",
@@ -1023,7 +1023,7 @@ const vr = ({
1023
1023
  transition: "opacity 500ms ease, transform 500ms ease",
1024
1024
  transform: r ? "scale(1.02)" : "scale(1)",
1025
1025
  opacity: l ? 1 : 0,
1026
- ...o
1026
+ ...i
1027
1027
  };
1028
1028
  return (
1029
1029
  // eslint-disable-next-line @next/next/no-img-element
@@ -1032,54 +1032,54 @@ const vr = ({
1032
1032
  {
1033
1033
  src: e,
1034
1034
  alt: t,
1035
- className: i,
1036
- style: d,
1035
+ className: o,
1036
+ style: s,
1037
1037
  loading: "eager",
1038
1038
  fetchPriority: "high",
1039
- onLoad: () => s(!0)
1039
+ onLoad: () => d(!0)
1040
1040
  }
1041
1041
  )
1042
1042
  );
1043
- }, xr = 8, en = 8, kr = ({
1043
+ }, Cr = 8, on = 8, Sr = ({
1044
1044
  open: e,
1045
1045
  onClose: t,
1046
1046
  anchorRef: r,
1047
- children: i
1047
+ children: o
1048
1048
  }) => {
1049
- const o = A(null), [l, s] = C(null);
1050
- return Tn(() => {
1049
+ const i = S(null), [l, d] = C(null);
1050
+ return hn(() => {
1051
1051
  if (!e) {
1052
- s(null);
1052
+ d(null);
1053
1053
  return;
1054
1054
  }
1055
1055
  const a = r.current;
1056
1056
  if (!a) return;
1057
- const d = () => {
1058
- const f = a.getBoundingClientRect(), _ = {
1059
- top: f.top - xr,
1057
+ const s = () => {
1058
+ const f = a.getBoundingClientRect(), b = {
1059
+ top: f.top - Cr,
1060
1060
  left: f.left + f.width / 2
1061
- }, u = en + 90, c = window.innerWidth - en - 90;
1062
- _.left < u && (_.left = u), _.left > c && (_.left = c), s(_);
1061
+ }, u = on + 90, c = window.innerWidth - on - 90;
1062
+ b.left < u && (b.left = u), b.left > c && (b.left = c), d(b);
1063
1063
  };
1064
- return d(), window.addEventListener("scroll", d, !0), window.addEventListener("resize", d), () => {
1065
- window.removeEventListener("scroll", d, !0), window.removeEventListener("resize", d);
1064
+ return s(), window.addEventListener("scroll", s, !0), window.addEventListener("resize", s), () => {
1065
+ window.removeEventListener("scroll", s, !0), window.removeEventListener("resize", s);
1066
1066
  };
1067
- }, [e, r]), T(() => {
1067
+ }, [e, r]), M(() => {
1068
1068
  if (!e) return;
1069
1069
  const a = (f) => {
1070
- const _ = f.target, u = o.current, c = r.current;
1071
- u && u.contains(_) || c && c.contains(_) || t();
1072
- }, d = (f) => {
1070
+ const b = f.target, u = i.current, c = r.current;
1071
+ u && u.contains(b) || c && c.contains(b) || t();
1072
+ }, s = (f) => {
1073
1073
  f.key === "Escape" && (f.stopPropagation(), t());
1074
1074
  };
1075
- return document.addEventListener("mousedown", a), document.addEventListener("keydown", d), () => {
1076
- document.removeEventListener("mousedown", a), document.removeEventListener("keydown", d);
1075
+ return document.addEventListener("mousedown", a), document.addEventListener("keydown", s), () => {
1076
+ document.removeEventListener("mousedown", a), document.removeEventListener("keydown", s);
1077
1077
  };
1078
- }, [e, t, r]), !e || l === null || typeof document > "u" ? null : On(
1078
+ }, [e, t, r]), !e || l === null || typeof document > "u" ? null : Rt(
1079
1079
  /* @__PURE__ */ n(
1080
1080
  "div",
1081
1081
  {
1082
- ref: o,
1082
+ ref: i,
1083
1083
  className: "ll-overflow-popover",
1084
1084
  role: "menu",
1085
1085
  style: {
@@ -1090,30 +1090,30 @@ const vr = ({
1090
1090
  left: l.left,
1091
1091
  transform: "translate(-50%, -100%)"
1092
1092
  },
1093
- children: i
1093
+ children: o
1094
1094
  }
1095
1095
  ),
1096
1096
  document.body
1097
1097
  );
1098
- }, Lr = ({
1098
+ }, Nr = ({
1099
1099
  isMuted: e,
1100
1100
  onToggleMute: t,
1101
1101
  isCameraEnabled: r,
1102
- onToggleCamera: i,
1103
- allowCamera: o,
1102
+ onToggleCamera: o,
1103
+ allowCamera: i,
1104
1104
  isScreenShareEnabled: l,
1105
- onToggleScreenShare: s,
1105
+ onToggleScreenShare: d,
1106
1106
  allowScreenShare: a,
1107
- isSpeakerMuted: d,
1107
+ isSpeakerMuted: s,
1108
1108
  onToggleSpeaker: f,
1109
- allowTyping: _,
1109
+ allowTyping: b,
1110
1110
  isTypingOpen: u,
1111
1111
  onToggleTyping: c,
1112
1112
  onDisconnect: I
1113
1113
  }) => {
1114
- const [L, b] = C(!1), y = A(null);
1115
- return /* @__PURE__ */ v(ot, { children: [
1116
- /* @__PURE__ */ v(
1114
+ const [k, w] = C(!1), v = S(null);
1115
+ return /* @__PURE__ */ y(Ve, { children: [
1116
+ /* @__PURE__ */ y(
1117
1117
  "div",
1118
1118
  {
1119
1119
  className: "ll-toolbar ll-toolbar--compact",
@@ -1127,20 +1127,20 @@ const vr = ({
1127
1127
  className: `ll-tool ${e ? "is-muted" : ""}`,
1128
1128
  onClick: t,
1129
1129
  "aria-label": e ? "Unmute microphone" : "Mute microphone",
1130
- children: /* @__PURE__ */ n(hn, { muted: e })
1130
+ children: /* @__PURE__ */ n(bn, { muted: e })
1131
1131
  }
1132
1132
  ),
1133
1133
  /* @__PURE__ */ n(
1134
1134
  "button",
1135
1135
  {
1136
- ref: y,
1136
+ ref: v,
1137
1137
  type: "button",
1138
- className: `ll-tool ${L ? "is-on" : ""}`,
1139
- onClick: () => b((m) => !m),
1138
+ className: `ll-tool ${k ? "is-on" : ""}`,
1139
+ onClick: () => w((m) => !m),
1140
1140
  "aria-label": "More controls",
1141
1141
  "aria-haspopup": "menu",
1142
- "aria-expanded": L,
1143
- children: /* @__PURE__ */ n(Er, {})
1142
+ "aria-expanded": k,
1143
+ children: /* @__PURE__ */ n(Ar, {})
1144
1144
  }
1145
1145
  ),
1146
1146
  /* @__PURE__ */ n(
@@ -1150,76 +1150,76 @@ const vr = ({
1150
1150
  className: "ll-tool ll-tool--danger",
1151
1151
  onClick: I,
1152
1152
  "aria-label": "End conversation",
1153
- children: /* @__PURE__ */ n(gn, {})
1153
+ children: /* @__PURE__ */ n(_n, {})
1154
1154
  }
1155
1155
  )
1156
1156
  ]
1157
1157
  }
1158
1158
  ),
1159
- /* @__PURE__ */ v(
1160
- kr,
1159
+ /* @__PURE__ */ y(
1160
+ Sr,
1161
1161
  {
1162
- open: L,
1163
- onClose: () => b(!1),
1164
- anchorRef: y,
1162
+ open: k,
1163
+ onClose: () => w(!1),
1164
+ anchorRef: v,
1165
1165
  children: [
1166
- o && /* @__PURE__ */ v(
1166
+ i && /* @__PURE__ */ y(
1167
1167
  "button",
1168
1168
  {
1169
1169
  type: "button",
1170
1170
  className: `ll-overflow-popover__item ${r ? "is-on" : ""}`,
1171
1171
  onClick: () => {
1172
- i(), b(!1);
1172
+ o(), w(!1);
1173
1173
  },
1174
1174
  children: [
1175
- /* @__PURE__ */ n(pn, {}),
1175
+ /* @__PURE__ */ n(vn, {}),
1176
1176
  /* @__PURE__ */ n("span", { children: r ? "Stop camera" : "Start camera" })
1177
1177
  ]
1178
1178
  }
1179
1179
  ),
1180
- a && /* @__PURE__ */ v(
1180
+ a && /* @__PURE__ */ y(
1181
1181
  "button",
1182
1182
  {
1183
1183
  type: "button",
1184
1184
  className: `ll-overflow-popover__item ${l ? "is-on" : ""}`,
1185
1185
  onClick: () => {
1186
- s(), b(!1);
1186
+ d(), w(!1);
1187
1187
  },
1188
1188
  children: [
1189
- /* @__PURE__ */ n(fn, {}),
1189
+ /* @__PURE__ */ n(yn, {}),
1190
1190
  /* @__PURE__ */ n("span", { children: l ? "Stop sharing" : "Share screen" })
1191
1191
  ]
1192
1192
  }
1193
1193
  ),
1194
- /* @__PURE__ */ v(
1194
+ /* @__PURE__ */ y(
1195
1195
  "button",
1196
1196
  {
1197
1197
  type: "button",
1198
- className: `ll-overflow-popover__item ${d ? "is-on" : ""}`,
1198
+ className: `ll-overflow-popover__item ${s ? "is-on" : ""}`,
1199
1199
  onClick: () => {
1200
- f(), b(!1);
1200
+ f(), w(!1);
1201
1201
  },
1202
1202
  children: [
1203
- /* @__PURE__ */ n(mn, { muted: d }),
1204
- /* @__PURE__ */ n("span", { children: d ? "Unmute speaker" : "Mute speaker" })
1203
+ /* @__PURE__ */ n(wn, { muted: s }),
1204
+ /* @__PURE__ */ n("span", { children: s ? "Unmute speaker" : "Mute speaker" })
1205
1205
  ]
1206
1206
  }
1207
1207
  ),
1208
- _ && /* @__PURE__ */ v(
1208
+ b && /* @__PURE__ */ y(
1209
1209
  "button",
1210
1210
  {
1211
1211
  type: "button",
1212
1212
  className: `ll-overflow-popover__item ${u ? "is-on" : ""}`,
1213
1213
  onClick: () => {
1214
- c(), b(!1);
1214
+ c(), w(!1);
1215
1215
  },
1216
1216
  children: [
1217
- /* @__PURE__ */ n(Cr, {}),
1217
+ /* @__PURE__ */ n(Rr, {}),
1218
1218
  /* @__PURE__ */ n("span", { children: u ? "Hide typing" : "Type a message" })
1219
1219
  ]
1220
1220
  }
1221
1221
  ),
1222
- /* @__PURE__ */ v(
1222
+ /* @__PURE__ */ y(
1223
1223
  "button",
1224
1224
  {
1225
1225
  type: "button",
@@ -1237,8 +1237,8 @@ const vr = ({
1237
1237
  )
1238
1238
  ] });
1239
1239
  };
1240
- function Er() {
1241
- return /* @__PURE__ */ v(
1240
+ function Ar() {
1241
+ return /* @__PURE__ */ y(
1242
1242
  "svg",
1243
1243
  {
1244
1244
  width: "16",
@@ -1254,7 +1254,7 @@ function Er() {
1254
1254
  }
1255
1255
  );
1256
1256
  }
1257
- function Cr() {
1257
+ function Rr() {
1258
1258
  return /* @__PURE__ */ n(
1259
1259
  "svg",
1260
1260
  {
@@ -1271,154 +1271,154 @@ function Cr() {
1271
1271
  }
1272
1272
  );
1273
1273
  }
1274
- const Sr = ({
1274
+ const Ir = ({
1275
1275
  position: e,
1276
1276
  isMobile: t,
1277
1277
  agentName: r,
1278
- avatarImageUrl: i,
1279
- idleLoopUrl: o,
1278
+ avatarImageUrl: o,
1279
+ idleLoopUrl: i,
1280
1280
  greeting: l,
1281
- branding: s,
1281
+ branding: d,
1282
1282
  teamMembers: a,
1283
- currentTeamMemberId: d,
1283
+ currentTeamMemberId: s,
1284
1284
  isSwitchingTeamMember: f,
1285
- teamSwitcherOpen: _,
1285
+ teamSwitcherOpen: b,
1286
1286
  onToggleTeamSwitcher: u,
1287
1287
  onSelectTeamMember: c,
1288
1288
  languageMenuOpen: I,
1289
- onToggleLanguageMenu: L,
1290
- connectionState: b,
1291
- agentState: y,
1289
+ onToggleLanguageMenu: k,
1290
+ connectionState: w,
1291
+ agentState: v,
1292
1292
  transcript: m,
1293
- canResume: S,
1293
+ canResume: N,
1294
1294
  needsUserGesture: $,
1295
1295
  error: D,
1296
1296
  isMuted: x,
1297
1297
  micError: R,
1298
1298
  micDevices: B,
1299
1299
  activeMicId: q,
1300
- isCameraEnabled: N,
1301
- cameraPreviewEl: M,
1300
+ isCameraEnabled: A,
1301
+ cameraPreviewEl: T,
1302
1302
  cameraDevices: F,
1303
- activeCameraId: re,
1303
+ activeCameraId: oe,
1304
1304
  isScreenShareEnabled: ie,
1305
1305
  screenPreviewEl: Z,
1306
- isSpeakerMuted: ae,
1306
+ isSpeakerMuted: ce,
1307
1307
  allowCamera: fe,
1308
- allowScreenShare: ve,
1308
+ allowScreenShare: ye,
1309
1309
  allowTyping: pe,
1310
- showMinimize: be = !0,
1310
+ showMinimize: ve = !0,
1311
1311
  chromeless: he = !1,
1312
1312
  compactControls: ee = !1,
1313
- transforming: at,
1314
- transformingLabel: je,
1315
- avatarVideoContainerRef: ct,
1316
- agentVideoEl: oe,
1317
- onConnect: Ve,
1318
- onDisconnect: Ye,
1319
- onRetry: Ge,
1320
- onResumeAudio: De,
1321
- onToggleMute: Ae,
1313
+ transforming: ut,
1314
+ transformingLabel: Ge,
1315
+ avatarVideoContainerRef: ft,
1316
+ agentVideoEl: le,
1317
+ onConnect: Je,
1318
+ onDisconnect: Ke,
1319
+ onRetry: pt,
1320
+ onResumeAudio: Xe,
1321
+ onToggleMute: Ce,
1322
1322
  onSwitchMicDevice: Pe,
1323
- onToggleCamera: Re,
1323
+ onToggleCamera: Se,
1324
1324
  onSwitchCameraDevice: $e,
1325
- onToggleScreenShare: Ie,
1326
- onToggleSpeaker: Te,
1327
- onSendMessage: z,
1328
- onMinimize: st,
1329
- onClose: dt,
1330
- onClearMicError: vt
1325
+ onToggleScreenShare: Ne,
1326
+ onToggleSpeaker: Ae,
1327
+ onSendMessage: Re,
1328
+ onMinimize: z,
1329
+ onClose: ht,
1330
+ onClearMicError: xt
1331
1331
  }) => {
1332
- var Me;
1333
- const we = ((a == null ? void 0 : a.length) ?? 0) > 1, _e = b === "connecting" || b === "connected", te = b === "connected", bt = b === "idle" || b === "disconnected" || b === "error", [Je, ce] = C(!1);
1334
- T(() => {
1335
- if (!oe) {
1336
- ce(!1);
1332
+ var De;
1333
+ const Ie = ((a == null ? void 0 : a.length) ?? 0) > 1, Me = w === "connecting" || w === "connected", te = w === "connected", Qe = w === "idle" || w === "disconnected" || w === "error", [Ze, ze] = C(!1);
1334
+ M(() => {
1335
+ if (!le) {
1336
+ ze(!1);
1337
1337
  return;
1338
1338
  }
1339
- if (!oe.paused && oe.readyState >= 2) {
1340
- ce(!0);
1339
+ if (!le.paused && le.readyState >= 2) {
1340
+ ze(!0);
1341
1341
  return;
1342
1342
  }
1343
- ce(!1);
1344
- const h = () => ce(!0);
1345
- return oe.addEventListener("playing", h), oe.addEventListener("loadeddata", h), () => {
1346
- oe.removeEventListener("playing", h), oe.removeEventListener("loadeddata", h);
1343
+ ze(!1);
1344
+ const h = () => ze(!0);
1345
+ return le.addEventListener("playing", h), le.addEventListener("loadeddata", h), () => {
1346
+ le.removeEventListener("playing", h), le.removeEventListener("loadeddata", h);
1347
1347
  };
1348
- }, [oe]);
1349
- const [X, Ke] = C(!1);
1350
- T(() => {
1348
+ }, [le]);
1349
+ const [Te, X] = C(!1);
1350
+ M(() => {
1351
1351
  if (!te) {
1352
- Ke(!1);
1352
+ X(!1);
1353
1353
  return;
1354
1354
  }
1355
- if (Je) return;
1356
- const h = setTimeout(() => Ke(!0), 8e3);
1355
+ if (Ze) return;
1356
+ const h = setTimeout(() => X(!0), 8e3);
1357
1357
  return () => clearTimeout(h);
1358
- }, [te, Je]);
1359
- const ze = b === "connecting" || te && !!i && !Je && !X, xe = A(null), se = A(null);
1360
- T(() => {
1361
- const h = xe.current;
1362
- h && (h.innerHTML = "", M && (M.style.width = "100%", M.style.height = "100%", M.style.objectFit = "cover", M.style.transform = "scaleX(-1)", h.appendChild(M)));
1363
- }, [M]), T(() => {
1364
- const h = se.current;
1358
+ }, [te, Ze]);
1359
+ const mt = w === "connecting" || te && !!o && !Ze && !Te, et = S(null), ne = S(null);
1360
+ M(() => {
1361
+ const h = et.current;
1362
+ h && (h.innerHTML = "", T && (T.style.width = "100%", T.style.height = "100%", T.style.objectFit = "cover", T.style.transform = "scaleX(-1)", h.appendChild(T)));
1363
+ }, [T]), M(() => {
1364
+ const h = ne.current;
1365
1365
  h && (h.innerHTML = "", Z && (Z.style.width = "100%", Z.style.height = "100%", Z.style.objectFit = "contain", h.appendChild(Z)));
1366
1366
  }, [Z]);
1367
- const [me, ke] = C(!1), [G, ne] = C(!1);
1368
- T(() => {
1369
- if (!me && !G && !I && !_) return;
1367
+ const [re, se] = C(!1), [be, G] = C(!1), de = S(null), we = S(null);
1368
+ M(() => {
1369
+ if (!re && !be && !I && !b) return;
1370
1370
  const h = () => {
1371
- ke(!1), ne(!1), I && L(), _ && u();
1371
+ se(!1), G(!1), I && k(), b && u();
1372
1372
  };
1373
1373
  return document.addEventListener("click", h), () => document.removeEventListener("click", h);
1374
1374
  }, [
1375
- me,
1376
- G,
1375
+ re,
1376
+ be,
1377
1377
  I,
1378
- _,
1379
- L,
1378
+ b,
1379
+ k,
1380
1380
  u
1381
1381
  ]);
1382
- const [Le, Xe] = C(!1), wt = E(() => Xe((h) => !h), []), [Ee, Oe] = C(""), ut = E(
1382
+ const [Oe, kt] = C(!1), tt = E(() => kt((h) => !h), []), [_e, nt] = C(""), rt = E(
1383
1383
  (h) => {
1384
1384
  h.preventDefault();
1385
- const V = Ee.trim();
1386
- V && (z(V), Oe(""));
1385
+ const V = _e.trim();
1386
+ V && (Re(V), nt(""));
1387
1387
  },
1388
- [Ee, z]
1389
- ), Qe = s.productName || "Live Layer";
1390
- let de = null, Ce = null;
1388
+ [_e, Re]
1389
+ ), ot = d.productName || "Live Layer";
1390
+ let xe = null, ke = null;
1391
1391
  for (let h = m.length - 1; h >= 0; h--) {
1392
1392
  const V = m[h];
1393
- if (!de && V.role === "agent" ? de = V : !Ce && V.role === "user" && (Ce = V), de && Ce) break;
1393
+ if (!xe && V.role === "agent" ? xe = V : !ke && V.role === "user" && (ke = V), xe && ke) break;
1394
1394
  }
1395
- const ft = te ? (de == null ? void 0 : de.text) || null : l || null, He = te && (Ce == null ? void 0 : Ce.text) || null, _t = [
1395
+ const He = te ? (xe == null ? void 0 : xe.text) || null : l || null, gt = te && (ke == null ? void 0 : ke.text) || null, We = [
1396
1396
  "ll-expanded",
1397
1397
  t ? "ll-expanded--mobile" : "ll-expanded--desktop"
1398
1398
  ].join(" ");
1399
- return /* @__PURE__ */ v(
1399
+ return /* @__PURE__ */ y(
1400
1400
  "div",
1401
1401
  {
1402
- className: _t,
1402
+ className: We,
1403
1403
  "data-position": e,
1404
- "data-state": te ? "connected" : _e ? "connecting" : "idle",
1404
+ "data-state": te ? "connected" : Me ? "connecting" : "idle",
1405
1405
  role: "dialog",
1406
1406
  "aria-label": `${r} widget`,
1407
1407
  children: [
1408
- /* @__PURE__ */ v("div", { className: "ll-expanded__bg", children: [
1409
- i ? /* @__PURE__ */ n(
1410
- _r,
1408
+ /* @__PURE__ */ y("div", { className: "ll-expanded__bg", children: [
1409
+ o ? /* @__PURE__ */ n(
1410
+ Er,
1411
1411
  {
1412
- src: i,
1412
+ src: o,
1413
1413
  alt: r,
1414
1414
  className: "ll-expanded__bg-img"
1415
1415
  }
1416
- ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Me = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Me.toUpperCase()) || "A" }) }),
1417
- o && !te && /* @__PURE__ */ n(
1416
+ ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((De = r == null ? void 0 : r.charAt(0)) == null ? void 0 : De.toUpperCase()) || "A" }) }),
1417
+ i && !te && /* @__PURE__ */ n(
1418
1418
  "video",
1419
1419
  {
1420
1420
  className: "ll-expanded__bg-idle",
1421
- src: o,
1421
+ src: i,
1422
1422
  autoPlay: !0,
1423
1423
  loop: !0,
1424
1424
  muted: !0,
@@ -1426,70 +1426,70 @@ const Sr = ({
1426
1426
  }
1427
1427
  )
1428
1428
  ] }),
1429
- /* @__PURE__ */ n("div", { ref: ct, className: "ll-expanded__video" }),
1430
- ze && /* @__PURE__ */ v("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1429
+ /* @__PURE__ */ n("div", { ref: ft, className: "ll-expanded__video" }),
1430
+ mt && /* @__PURE__ */ y("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1431
1431
  /* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
1432
1432
  /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: f ? "Switching..." : "Connecting..." })
1433
1433
  ] }),
1434
- $ && te && /* @__PURE__ */ v(
1434
+ $ && te && /* @__PURE__ */ y(
1435
1435
  "button",
1436
1436
  {
1437
1437
  type: "button",
1438
1438
  className: "ll-expanded__overlay ll-expanded__overlay--gesture",
1439
- onClick: De,
1439
+ onClick: Xe,
1440
1440
  children: [
1441
1441
  /* @__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" }) }),
1442
1442
  /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
1443
1443
  ]
1444
1444
  }
1445
1445
  ),
1446
- at && /* @__PURE__ */ v(
1446
+ ut && /* @__PURE__ */ y(
1447
1447
  "div",
1448
1448
  {
1449
1449
  className: "ll-expanded__overlay ll-expanded__overlay--transforming",
1450
1450
  role: "status",
1451
1451
  "aria-live": "polite",
1452
- "aria-label": je,
1452
+ "aria-label": Ge,
1453
1453
  children: [
1454
1454
  /* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
1455
- /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: je })
1455
+ /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: Ge })
1456
1456
  ]
1457
1457
  }
1458
1458
  ),
1459
- _e ? /* @__PURE__ */ v(ot, { children: [
1460
- !ee && /* @__PURE__ */ v("div", { className: "ll-expanded__topbar", children: [
1461
- !he && /* @__PURE__ */ v("div", { className: "ll-expanded__topbar-left", children: [
1462
- /* @__PURE__ */ v("div", { className: "ll-expanded__pill-wrap", children: [
1463
- /* @__PURE__ */ v(
1459
+ Me ? /* @__PURE__ */ y(Ve, { children: [
1460
+ !ee && /* @__PURE__ */ y("div", { className: "ll-expanded__topbar", children: [
1461
+ !he && /* @__PURE__ */ y("div", { className: "ll-expanded__topbar-left", children: [
1462
+ /* @__PURE__ */ y("div", { className: "ll-expanded__pill-wrap", children: [
1463
+ /* @__PURE__ */ y(
1464
1464
  "button",
1465
1465
  {
1466
1466
  type: "button",
1467
1467
  className: "ll-hpill",
1468
1468
  onClick: (h) => {
1469
- we && (h.stopPropagation(), u());
1469
+ Ie && (h.stopPropagation(), u());
1470
1470
  },
1471
- "aria-haspopup": we ? "listbox" : void 0,
1472
- "aria-expanded": we ? _ : void 0,
1471
+ "aria-haspopup": Ie ? "listbox" : void 0,
1472
+ "aria-expanded": Ie ? b : void 0,
1473
1473
  children: [
1474
1474
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
1475
- we && /* @__PURE__ */ n(ht, {})
1475
+ Ie && /* @__PURE__ */ n(vt, {})
1476
1476
  ]
1477
1477
  }
1478
1478
  ),
1479
- we && _ && /* @__PURE__ */ n(
1479
+ Ie && b && /* @__PURE__ */ n(
1480
1480
  "div",
1481
1481
  {
1482
1482
  className: "ll-hmenu",
1483
1483
  onClick: (h) => h.stopPropagation(),
1484
1484
  role: "listbox",
1485
- children: a == null ? void 0 : a.map((h) => /* @__PURE__ */ v(
1485
+ children: a == null ? void 0 : a.map((h) => /* @__PURE__ */ y(
1486
1486
  "button",
1487
1487
  {
1488
1488
  type: "button",
1489
- className: `ll-hmenu__item ${h.id === d ? "is-active" : ""}`,
1489
+ className: `ll-hmenu__item ${h.id === s ? "is-active" : ""}`,
1490
1490
  onClick: () => c(h.id),
1491
1491
  role: "option",
1492
- "aria-selected": h.id === d,
1492
+ "aria-selected": h.id === s,
1493
1493
  children: [
1494
1494
  h.avatarImageUrl && /* @__PURE__ */ n(
1495
1495
  "img",
@@ -1508,14 +1508,14 @@ const Sr = ({
1508
1508
  }
1509
1509
  )
1510
1510
  ] }),
1511
- /* @__PURE__ */ v("div", { className: "ll-expanded__pill-wrap", children: [
1512
- /* @__PURE__ */ v(
1511
+ /* @__PURE__ */ y("div", { className: "ll-expanded__pill-wrap", children: [
1512
+ /* @__PURE__ */ y(
1513
1513
  "button",
1514
1514
  {
1515
1515
  type: "button",
1516
1516
  className: "ll-hpill ll-hpill--compact",
1517
1517
  onClick: (h) => {
1518
- h.stopPropagation(), L();
1518
+ h.stopPropagation(), k();
1519
1519
  },
1520
1520
  "aria-haspopup": "listbox",
1521
1521
  "aria-expanded": I,
@@ -1523,7 +1523,7 @@ const Sr = ({
1523
1523
  title: "Language: English",
1524
1524
  children: [
1525
1525
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: "EN" }),
1526
- /* @__PURE__ */ n(ht, {})
1526
+ /* @__PURE__ */ n(vt, {})
1527
1527
  ]
1528
1528
  }
1529
1529
  ),
@@ -1549,21 +1549,21 @@ const Sr = ({
1549
1549
  /* @__PURE__ */ n(
1550
1550
  "span",
1551
1551
  {
1552
- className: `ll-expanded__state ll-expanded__state--${y}`,
1553
- children: y
1552
+ className: `ll-expanded__state ll-expanded__state--${v}`,
1553
+ children: v
1554
1554
  }
1555
1555
  )
1556
1556
  ] }),
1557
- /* @__PURE__ */ v("div", { className: "ll-expanded__header-actions", children: [
1558
- be !== !1 && /* @__PURE__ */ n(
1557
+ /* @__PURE__ */ y("div", { className: "ll-expanded__header-actions", children: [
1558
+ ve !== !1 && /* @__PURE__ */ n(
1559
1559
  "button",
1560
1560
  {
1561
1561
  type: "button",
1562
1562
  className: "ll-hbtn",
1563
- onClick: st,
1563
+ onClick: z,
1564
1564
  "aria-label": "Minimize widget",
1565
1565
  title: "Minimize",
1566
- children: /* @__PURE__ */ n(nn, {})
1566
+ children: /* @__PURE__ */ n(an, {})
1567
1567
  }
1568
1568
  ),
1569
1569
  /* @__PURE__ */ n(
@@ -1571,34 +1571,34 @@ const Sr = ({
1571
1571
  {
1572
1572
  type: "button",
1573
1573
  className: "ll-hbtn ll-hbtn--danger",
1574
- onClick: dt,
1574
+ onClick: ht,
1575
1575
  "aria-label": "End call",
1576
1576
  title: "End call",
1577
- children: /* @__PURE__ */ n(tn, {})
1577
+ children: /* @__PURE__ */ n(ln, {})
1578
1578
  }
1579
1579
  )
1580
1580
  ] })
1581
1581
  ] }),
1582
- ee && /* @__PURE__ */ v("div", { className: "ll-compact-status", "data-state": y, children: [
1582
+ ee && /* @__PURE__ */ y("div", { className: "ll-compact-status", "data-state": v, children: [
1583
1583
  /* @__PURE__ */ n("span", { className: "ll-compact-status__dot", "aria-hidden": !0 }),
1584
- /* @__PURE__ */ n("span", { className: "ll-compact-status__label", children: y })
1584
+ /* @__PURE__ */ n("span", { className: "ll-compact-status__label", children: v })
1585
1585
  ] })
1586
1586
  ] }) : (
1587
1587
  // Idle-state header with Live Layer product name + minimize/close.
1588
1588
  // Hidden in compact mode — on a 140×210 docked slot the brand pill
1589
1589
  // and 40px buttons crowded out the central "Start video call"
1590
1590
  // affordance. The user can dismiss by scrolling past the slot.
1591
- !ee && /* @__PURE__ */ v("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
1592
- /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Qe }),
1593
- /* @__PURE__ */ v("div", { className: "ll-expanded__header-actions", children: [
1594
- be !== !1 && /* @__PURE__ */ n(
1591
+ !ee && /* @__PURE__ */ y("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
1592
+ /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: ot }),
1593
+ /* @__PURE__ */ y("div", { className: "ll-expanded__header-actions", children: [
1594
+ ve !== !1 && /* @__PURE__ */ n(
1595
1595
  "button",
1596
1596
  {
1597
1597
  type: "button",
1598
1598
  className: "ll-hbtn ll-hbtn--ghost",
1599
- onClick: st,
1599
+ onClick: z,
1600
1600
  "aria-label": "Minimize widget",
1601
- children: /* @__PURE__ */ n(nn, {})
1601
+ children: /* @__PURE__ */ n(an, {})
1602
1602
  }
1603
1603
  ),
1604
1604
  /* @__PURE__ */ n(
@@ -1606,23 +1606,23 @@ const Sr = ({
1606
1606
  {
1607
1607
  type: "button",
1608
1608
  className: "ll-hbtn ll-hbtn--danger",
1609
- onClick: dt,
1609
+ onClick: ht,
1610
1610
  "aria-label": "Close widget",
1611
- children: /* @__PURE__ */ n(tn, {})
1611
+ children: /* @__PURE__ */ n(ln, {})
1612
1612
  }
1613
1613
  )
1614
1614
  ] })
1615
1615
  ] })
1616
1616
  ),
1617
- bt && /* @__PURE__ */ (() => {
1618
- const h = S ? "Resume session" : b === "disconnected" ? "Reconnect to agent" : "Start video call";
1619
- return /* @__PURE__ */ v(ot, { children: [
1620
- !D && /* @__PURE__ */ v(
1617
+ Qe && /* @__PURE__ */ (() => {
1618
+ const h = N ? "Resume session" : w === "disconnected" ? "Reconnect to agent" : "Start video call";
1619
+ return /* @__PURE__ */ y(Ve, { children: [
1620
+ !D && /* @__PURE__ */ y(
1621
1621
  "button",
1622
1622
  {
1623
1623
  type: "button",
1624
1624
  className: "ll-expanded__play",
1625
- onClick: Ve,
1625
+ onClick: Je,
1626
1626
  "aria-label": h,
1627
1627
  children: [
1628
1628
  /* @__PURE__ */ n("div", { className: "ll-expanded__play-circle", children: /* @__PURE__ */ n("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("polygon", { points: "6 3 20 12 6 21 6 3" }) }) }),
@@ -1630,14 +1630,14 @@ const Sr = ({
1630
1630
  ]
1631
1631
  }
1632
1632
  ),
1633
- !ee && /* @__PURE__ */ v("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
1633
+ !ee && /* @__PURE__ */ y("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
1634
1634
  l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
1635
1635
  /* @__PURE__ */ n(
1636
1636
  "button",
1637
1637
  {
1638
1638
  type: "button",
1639
1639
  className: "ll-expanded__cta",
1640
- onClick: Ve,
1640
+ onClick: Je,
1641
1641
  "aria-label": h,
1642
1642
  children: h
1643
1643
  }
@@ -1645,129 +1645,133 @@ const Sr = ({
1645
1645
  ] })
1646
1646
  ] });
1647
1647
  })(),
1648
- /* @__PURE__ */ v(
1648
+ /* @__PURE__ */ y(
1649
1649
  "div",
1650
1650
  {
1651
- className: `ll-expanded__pip ${_e && (N || ie) ? "is-visible" : ""}`,
1651
+ className: `ll-expanded__pip ${Me && (A || ie) ? "is-visible" : ""}`,
1652
1652
  children: [
1653
1653
  /* @__PURE__ */ n(
1654
1654
  "div",
1655
1655
  {
1656
- ref: se,
1656
+ ref: ne,
1657
1657
  className: ie ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1658
1658
  }
1659
1659
  ),
1660
1660
  /* @__PURE__ */ n(
1661
1661
  "div",
1662
1662
  {
1663
- ref: xe,
1664
- className: !ie && N ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1663
+ ref: et,
1664
+ className: !ie && A ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1665
1665
  }
1666
1666
  )
1667
1667
  ]
1668
1668
  }
1669
1669
  ),
1670
- _e ? /* @__PURE__ */ v("div", { className: "ll-expanded__bottom", children: [
1671
- !ee && ft && /* @__PURE__ */ n(
1670
+ Me ? /* @__PURE__ */ y("div", { className: "ll-expanded__bottom", children: [
1671
+ !ee && He && /* @__PURE__ */ n(
1672
1672
  "div",
1673
1673
  {
1674
1674
  className: "ll-expanded__transcript ll-expanded__transcript--agent",
1675
1675
  "data-role": "agent",
1676
- children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: ft })
1676
+ children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: He })
1677
1677
  }
1678
1678
  ),
1679
- !ee && He && /* @__PURE__ */ n(
1679
+ !ee && gt && /* @__PURE__ */ n(
1680
1680
  "div",
1681
1681
  {
1682
1682
  className: "ll-expanded__transcript ll-expanded__transcript--user",
1683
1683
  "data-role": "user",
1684
- children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: He })
1684
+ children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: gt })
1685
1685
  }
1686
1686
  ),
1687
- !he && !ee && /* @__PURE__ */ v("div", { className: "ll-toolbar", onClick: (h) => h.stopPropagation(), children: [
1688
- ve && /* @__PURE__ */ n(
1687
+ !he && !ee && /* @__PURE__ */ y("div", { className: "ll-toolbar", onClick: (h) => h.stopPropagation(), children: [
1688
+ ye && /* @__PURE__ */ n(
1689
1689
  "button",
1690
1690
  {
1691
1691
  type: "button",
1692
1692
  className: `ll-tool ${ie ? "is-on" : ""}`,
1693
- onClick: Ie,
1693
+ onClick: Ne,
1694
1694
  "aria-label": ie ? "Stop sharing screen" : "Share screen",
1695
1695
  title: ie ? "Stop sharing" : "Share screen",
1696
- children: /* @__PURE__ */ n(fn, {})
1696
+ children: /* @__PURE__ */ n(yn, {})
1697
1697
  }
1698
1698
  ),
1699
- fe && /* @__PURE__ */ v("div", { className: "ll-tool-split", children: [
1699
+ fe && /* @__PURE__ */ y("div", { className: "ll-tool-split", children: [
1700
1700
  /* @__PURE__ */ n(
1701
1701
  "button",
1702
1702
  {
1703
1703
  type: "button",
1704
- className: `ll-tool ll-tool--left ${N ? "is-on" : ""}`,
1705
- onClick: Re,
1706
- "aria-label": N ? "Turn off camera" : "Turn on camera",
1707
- title: N ? "Stop camera" : "Start camera",
1708
- children: /* @__PURE__ */ n(pn, {})
1704
+ className: `ll-tool ll-tool--left ${A ? "is-on" : ""}`,
1705
+ onClick: Se,
1706
+ "aria-label": A ? "Turn off camera" : "Turn on camera",
1707
+ title: A ? "Stop camera" : "Start camera",
1708
+ children: /* @__PURE__ */ n(vn, {})
1709
1709
  }
1710
1710
  ),
1711
1711
  /* @__PURE__ */ n(
1712
1712
  "button",
1713
1713
  {
1714
+ ref: we,
1714
1715
  type: "button",
1715
- className: `ll-tool ll-tool--right ${N ? "is-on" : ""}`,
1716
+ className: `ll-tool ll-tool--right ${A ? "is-on" : ""}`,
1716
1717
  onClick: (h) => {
1717
- h.stopPropagation(), ne((V) => !V), ke(!1);
1718
+ h.stopPropagation(), G((V) => !V), se(!1);
1718
1719
  },
1719
1720
  "aria-label": "Camera devices",
1720
1721
  "aria-haspopup": "listbox",
1721
- "aria-expanded": G,
1722
- children: /* @__PURE__ */ n(ht, {})
1722
+ "aria-expanded": be,
1723
+ children: /* @__PURE__ */ n(vt, {})
1723
1724
  }
1724
1725
  ),
1725
- G && F.length > 0 && /* @__PURE__ */ n(
1726
- rn,
1726
+ be && F.length > 0 && /* @__PURE__ */ n(
1727
+ cn,
1727
1728
  {
1728
1729
  label: "Camera",
1729
1730
  devices: F,
1730
- activeId: re,
1731
+ activeId: oe,
1732
+ anchorRef: we,
1731
1733
  onPick: (h) => {
1732
- ne(!1), $e(h);
1734
+ G(!1), $e(h);
1733
1735
  }
1734
1736
  }
1735
1737
  )
1736
1738
  ] }),
1737
- /* @__PURE__ */ v("div", { className: "ll-tool-split", children: [
1739
+ /* @__PURE__ */ y("div", { className: "ll-tool-split", children: [
1738
1740
  /* @__PURE__ */ n(
1739
1741
  "button",
1740
1742
  {
1741
1743
  type: "button",
1742
1744
  className: `ll-tool ll-tool--left ${x ? "is-muted" : ""}`,
1743
- onClick: Ae,
1745
+ onClick: Ce,
1744
1746
  "aria-label": x ? "Unmute microphone" : "Mute microphone",
1745
1747
  title: x ? "Unmute" : "Mute",
1746
- children: /* @__PURE__ */ n(hn, { muted: x })
1748
+ children: /* @__PURE__ */ n(bn, { muted: x })
1747
1749
  }
1748
1750
  ),
1749
1751
  /* @__PURE__ */ n(
1750
1752
  "button",
1751
1753
  {
1754
+ ref: de,
1752
1755
  type: "button",
1753
1756
  className: `ll-tool ll-tool--right ${x ? "is-muted" : ""}`,
1754
1757
  onClick: (h) => {
1755
- h.stopPropagation(), ke((V) => !V), ne(!1);
1758
+ h.stopPropagation(), se((V) => !V), G(!1);
1756
1759
  },
1757
1760
  "aria-label": "Microphone devices",
1758
1761
  "aria-haspopup": "listbox",
1759
- "aria-expanded": me,
1760
- children: /* @__PURE__ */ n(ht, {})
1762
+ "aria-expanded": re,
1763
+ children: /* @__PURE__ */ n(vt, {})
1761
1764
  }
1762
1765
  ),
1763
- me && B.length > 0 && /* @__PURE__ */ n(
1764
- rn,
1766
+ re && B.length > 0 && /* @__PURE__ */ n(
1767
+ cn,
1765
1768
  {
1766
1769
  label: "Microphone",
1767
1770
  devices: B,
1768
1771
  activeId: q,
1772
+ anchorRef: de,
1769
1773
  onPick: (h) => {
1770
- ke(!1), Pe(h);
1774
+ se(!1), Pe(h);
1771
1775
  }
1772
1776
  }
1773
1777
  )
@@ -1776,11 +1780,11 @@ const Sr = ({
1776
1780
  "button",
1777
1781
  {
1778
1782
  type: "button",
1779
- className: `ll-tool ${ae ? "is-muted" : ""}`,
1780
- onClick: Te,
1781
- "aria-label": ae ? "Unmute speaker" : "Mute speaker",
1782
- title: ae ? "Unmute speaker" : "Mute speaker",
1783
- children: /* @__PURE__ */ n(mn, { muted: ae })
1783
+ className: `ll-tool ${ce ? "is-muted" : ""}`,
1784
+ onClick: Ae,
1785
+ "aria-label": ce ? "Unmute speaker" : "Mute speaker",
1786
+ title: ce ? "Unmute speaker" : "Mute speaker",
1787
+ children: /* @__PURE__ */ n(wn, { muted: ce })
1784
1788
  }
1785
1789
  ),
1786
1790
  /* @__PURE__ */ n(
@@ -1788,80 +1792,80 @@ const Sr = ({
1788
1792
  {
1789
1793
  type: "button",
1790
1794
  className: "ll-tool ll-tool--danger",
1791
- onClick: Ye,
1795
+ onClick: Ke,
1792
1796
  "aria-label": "End conversation",
1793
1797
  title: "End conversation",
1794
- children: /* @__PURE__ */ n(gn, {})
1798
+ children: /* @__PURE__ */ n(_n, {})
1795
1799
  }
1796
1800
  )
1797
1801
  ] }),
1798
1802
  !he && ee && /* @__PURE__ */ n(
1799
- Lr,
1803
+ Nr,
1800
1804
  {
1801
1805
  isMuted: x,
1802
- onToggleMute: Ae,
1803
- isCameraEnabled: N,
1804
- onToggleCamera: Re,
1806
+ onToggleMute: Ce,
1807
+ isCameraEnabled: A,
1808
+ onToggleCamera: Se,
1805
1809
  allowCamera: fe,
1806
1810
  isScreenShareEnabled: ie,
1807
- onToggleScreenShare: Ie,
1808
- allowScreenShare: ve,
1809
- isSpeakerMuted: ae,
1810
- onToggleSpeaker: Te,
1811
+ onToggleScreenShare: Ne,
1812
+ allowScreenShare: ye,
1813
+ isSpeakerMuted: ce,
1814
+ onToggleSpeaker: Ae,
1811
1815
  allowTyping: pe,
1812
- isTypingOpen: Le,
1813
- onToggleTyping: wt,
1814
- onDisconnect: Ye
1816
+ isTypingOpen: Oe,
1817
+ onToggleTyping: tt,
1818
+ onDisconnect: Ke
1815
1819
  }
1816
1820
  ),
1817
- !he && pe && (ee ? Le : !0) && /* @__PURE__ */ v("form", { className: "ll-message-input", onSubmit: ut, children: [
1821
+ !he && pe && (ee ? Oe : !0) && /* @__PURE__ */ y("form", { className: "ll-message-input", onSubmit: rt, children: [
1818
1822
  /* @__PURE__ */ n(
1819
1823
  "input",
1820
1824
  {
1821
1825
  type: "text",
1822
1826
  className: "ll-message-input__field",
1823
1827
  placeholder: "Message...",
1824
- value: Ee,
1825
- onChange: (h) => Oe(h.target.value),
1828
+ value: _e,
1829
+ onChange: (h) => nt(h.target.value),
1826
1830
  "aria-label": "Message the agent"
1827
1831
  }
1828
1832
  ),
1829
- Ee.trim() && /* @__PURE__ */ n(
1833
+ _e.trim() && /* @__PURE__ */ n(
1830
1834
  "button",
1831
1835
  {
1832
1836
  type: "submit",
1833
1837
  className: "ll-message-input__send",
1834
1838
  "aria-label": "Send message",
1835
- children: /* @__PURE__ */ n(Nr, {})
1839
+ children: /* @__PURE__ */ n(Mr, {})
1836
1840
  }
1837
1841
  )
1838
1842
  ] })
1839
1843
  ] }) : null,
1840
1844
  (() => {
1841
- if (R && b !== "error")
1842
- return /* @__PURE__ */ v("div", { className: "ll-expanded__banner", role: "alert", children: [
1845
+ if (R && w !== "error")
1846
+ return /* @__PURE__ */ y("div", { className: "ll-expanded__banner", role: "alert", children: [
1843
1847
  /* @__PURE__ */ n("span", { children: R }),
1844
1848
  /* @__PURE__ */ n(
1845
1849
  "button",
1846
1850
  {
1847
1851
  type: "button",
1848
1852
  className: "ll-expanded__banner-x",
1849
- onClick: vt,
1853
+ onClick: xt,
1850
1854
  "aria-label": "Dismiss",
1851
1855
  children: "×"
1852
1856
  }
1853
1857
  )
1854
1858
  ] });
1855
- if (!D || b !== "error") return null;
1859
+ if (!D || w !== "error") return null;
1856
1860
  let h = "Failed to connect", V = "Try again";
1857
- return D === "MIC_PERMISSION_DENIED" ? h = "Microphone blocked. Allow access to talk." : D === "MIC_NOT_FOUND" ? h = "No microphone found. Plug one in + retry." : D === "MIC_UNAVAILABLE" ? h = "Mic unavailable. Check other apps using it." : D === "AGENT_TIMEOUT" ? h = "Agent didn't pick up. Try again." : D === "CONNECT_FAILED" ? h = "Connection failed. Check your network." : D.length < 80 && (h = D), /* @__PURE__ */ v("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1861
+ return D === "MIC_PERMISSION_DENIED" ? h = "Microphone blocked. Allow access to talk." : D === "MIC_NOT_FOUND" ? h = "No microphone found. Plug one in + retry." : D === "MIC_UNAVAILABLE" ? h = "Mic unavailable. Check other apps using it." : D === "AGENT_TIMEOUT" ? h = "Agent didn't pick up. Try again." : D === "CONNECT_FAILED" ? h = "Connection failed. Check your network." : D.length < 80 && (h = D), /* @__PURE__ */ y("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1858
1862
  /* @__PURE__ */ n("span", { children: h }),
1859
1863
  /* @__PURE__ */ n(
1860
1864
  "button",
1861
1865
  {
1862
1866
  type: "button",
1863
1867
  className: "ll-expanded__banner-retry",
1864
- onClick: Ge,
1868
+ onClick: pt,
1865
1869
  children: V
1866
1870
  }
1867
1871
  )
@@ -1871,55 +1875,55 @@ const Sr = ({
1871
1875
  }
1872
1876
  );
1873
1877
  };
1874
- function ht() {
1878
+ function vt() {
1875
1879
  return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ n("polyline", { points: "6 9 12 15 18 9" }) });
1876
1880
  }
1877
- function tn() {
1878
- return /* @__PURE__ */ v("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
1881
+ function ln() {
1882
+ return /* @__PURE__ */ y("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
1879
1883
  /* @__PURE__ */ n("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1880
1884
  /* @__PURE__ */ n("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1881
1885
  ] });
1882
1886
  }
1883
- function nn() {
1887
+ function an() {
1884
1888
  return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
1885
1889
  }
1886
- function fn() {
1887
- return /* @__PURE__ */ v("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1890
+ function yn() {
1891
+ return /* @__PURE__ */ y("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1888
1892
  /* @__PURE__ */ n("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
1889
1893
  /* @__PURE__ */ n("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
1890
1894
  /* @__PURE__ */ n("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
1891
1895
  ] });
1892
1896
  }
1893
- function pn() {
1894
- return /* @__PURE__ */ v("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1897
+ function vn() {
1898
+ return /* @__PURE__ */ y("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1895
1899
  /* @__PURE__ */ n("path", { d: "M23 7l-7 5 7 5V7z" }),
1896
1900
  /* @__PURE__ */ n("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
1897
1901
  ] });
1898
1902
  }
1899
- function hn({ muted: e }) {
1900
- return /* @__PURE__ */ v("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1903
+ function bn({ muted: e }) {
1904
+ return /* @__PURE__ */ y("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1901
1905
  /* @__PURE__ */ n("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
1902
1906
  /* @__PURE__ */ n("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
1903
1907
  /* @__PURE__ */ n("line", { x1: "12", y1: "19", x2: "12", y2: "23" }),
1904
1908
  e && /* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
1905
1909
  ] });
1906
1910
  }
1907
- function mn({ muted: e }) {
1908
- return /* @__PURE__ */ v("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1911
+ function wn({ muted: e }) {
1912
+ return /* @__PURE__ */ y("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1909
1913
  /* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
1910
- e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ v(ot, { children: [
1914
+ e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ y(Ve, { children: [
1911
1915
  /* @__PURE__ */ n("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
1912
1916
  /* @__PURE__ */ n("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
1913
1917
  ] })
1914
1918
  ] });
1915
1919
  }
1916
- function Nr() {
1917
- return /* @__PURE__ */ v("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1920
+ function Mr() {
1921
+ return /* @__PURE__ */ y("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1918
1922
  /* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
1919
1923
  /* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
1920
1924
  ] });
1921
1925
  }
1922
- function gn() {
1926
+ function _n() {
1923
1927
  return /* @__PURE__ */ n("svg", { width: "16", height: "16", viewBox: "-4 -4 32 32", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: /* @__PURE__ */ n(
1924
1928
  "path",
1925
1929
  {
@@ -1928,49 +1932,81 @@ function gn() {
1928
1932
  }
1929
1933
  ) });
1930
1934
  }
1931
- const rn = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */ v(
1932
- "div",
1933
- {
1934
- className: "ll-device-menu",
1935
- onClick: (o) => o.stopPropagation(),
1936
- role: "listbox",
1937
- children: [
1938
- /* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
1939
- t.map((o, l) => {
1940
- const s = r === o.deviceId;
1941
- return /* @__PURE__ */ v(
1942
- "button",
1943
- {
1944
- type: "button",
1945
- className: `ll-device-menu__item ${s ? "is-active" : ""}`,
1946
- onClick: () => i(o.deviceId),
1947
- role: "option",
1948
- "aria-selected": s,
1949
- children: [
1950
- s && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1951
- /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: o.label || `${e} ${l + 1}` })
1952
- ]
1953
- },
1954
- o.deviceId || l
1955
- );
1956
- })
1957
- ]
1958
- }
1959
- ), Ar = [
1935
+ const cn = ({
1936
+ label: e,
1937
+ devices: t,
1938
+ activeId: r,
1939
+ onPick: o,
1940
+ anchorRef: i
1941
+ }) => {
1942
+ const [l, d] = C(null);
1943
+ return hn(() => {
1944
+ const a = () => {
1945
+ const s = i.current;
1946
+ if (!s) return;
1947
+ const f = s.getBoundingClientRect(), b = 126, u = window.innerWidth - 16 - 110, c = f.left + f.width / 2;
1948
+ d({
1949
+ top: f.top - 8,
1950
+ left: Math.max(b, Math.min(u, c))
1951
+ });
1952
+ };
1953
+ return a(), window.addEventListener("scroll", a, !0), window.addEventListener("resize", a), () => {
1954
+ window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", a);
1955
+ };
1956
+ }, [i]), l === null || typeof document > "u" ? null : Rt(
1957
+ /* @__PURE__ */ y(
1958
+ "div",
1959
+ {
1960
+ className: "ll-device-menu ll-device-menu--floating",
1961
+ onClick: (a) => a.stopPropagation(),
1962
+ role: "listbox",
1963
+ style: {
1964
+ position: "fixed",
1965
+ top: l.top,
1966
+ left: l.left,
1967
+ // translate up by 100% so its BOTTOM edge sits at pos.top.
1968
+ transform: "translate(-50%, -100%)"
1969
+ },
1970
+ children: [
1971
+ /* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
1972
+ t.map((a, s) => {
1973
+ const f = r === a.deviceId;
1974
+ return /* @__PURE__ */ y(
1975
+ "button",
1976
+ {
1977
+ type: "button",
1978
+ className: `ll-device-menu__item ${f ? "is-active" : ""}`,
1979
+ onClick: () => o(a.deviceId),
1980
+ role: "option",
1981
+ "aria-selected": f,
1982
+ children: [
1983
+ f && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1984
+ /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: a.label || `${e} ${s + 1}` })
1985
+ ]
1986
+ },
1987
+ a.deviceId || s
1988
+ );
1989
+ })
1990
+ ]
1991
+ }
1992
+ ),
1993
+ document.body
1994
+ );
1995
+ }, Tr = [
1960
1996
  '[data-ll-private="true"]',
1961
1997
  ".ll-widget"
1962
1998
  ];
1963
- function At(e) {
1999
+ function It(e) {
1964
2000
  let t = e;
1965
2001
  for (; t; ) {
1966
- for (const r of Ar)
2002
+ for (const r of Tr)
1967
2003
  if (t.matches(r)) return !0;
1968
2004
  t = t.parentElement;
1969
2005
  }
1970
2006
  return !1;
1971
2007
  }
1972
- function yt(e) {
1973
- if (At(e)) return !1;
2008
+ function _t(e) {
2009
+ if (It(e)) return !1;
1974
2010
  if (e instanceof HTMLInputElement) {
1975
2011
  if (e.type === "password") return !1;
1976
2012
  const t = (e.getAttribute("autocomplete") || "").toLowerCase();
@@ -1978,7 +2014,7 @@ function yt(e) {
1978
2014
  }
1979
2015
  return !0;
1980
2016
  }
1981
- const mt = 4096, Rr = 20, Ir = 20, Tr = 10, Mr = 10, Dr = 30, Pr = 20, on = 500, $r = [
2017
+ const bt = 4096, Dr = 20, Pr = 20, $r = 10, zr = 10, Or = 30, Hr = 20, sn = 500, Wr = [
1982
2018
  '[data-ll-private="true"]',
1983
2019
  ".ll-widget",
1984
2020
  "script",
@@ -1986,24 +2022,24 @@ const mt = 4096, Rr = 20, Ir = 20, Tr = 10, Mr = 10, Dr = 30, Pr = 20, on = 500,
1986
2022
  "noscript",
1987
2023
  "iframe"
1988
2024
  ];
1989
- function rt(e) {
2025
+ function ct(e) {
1990
2026
  if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
1991
2027
  let t = e;
1992
2028
  for (; t; ) {
1993
- for (const r of $r)
2029
+ for (const r of Wr)
1994
2030
  if (t.matches(r)) return !0;
1995
2031
  t = t.parentElement;
1996
2032
  }
1997
2033
  return !1;
1998
2034
  }
1999
- function it(e) {
2035
+ function st(e) {
2000
2036
  if (typeof window > "u") return !0;
2001
2037
  const t = e.getBoundingClientRect();
2002
2038
  if (t.width <= 0 || t.height <= 0) return !1;
2003
- const r = window.innerHeight || document.documentElement.clientHeight, i = window.innerWidth || document.documentElement.clientWidth;
2004
- return t.bottom > 0 && t.right > 0 && t.top < r && t.left < i;
2039
+ const r = window.innerHeight || document.documentElement.clientHeight, o = window.innerWidth || document.documentElement.clientWidth;
2040
+ return t.bottom > 0 && t.right > 0 && t.top < r && t.left < o;
2005
2041
  }
2006
- function ln(e) {
2042
+ function dn(e) {
2007
2043
  const t = e.getAttribute("id");
2008
2044
  if (t) {
2009
2045
  const l = document.querySelector(`label[for="${CSS.escape(t)}"]`);
@@ -2011,18 +2047,18 @@ function ln(e) {
2011
2047
  }
2012
2048
  const r = e.getAttribute("aria-label");
2013
2049
  if (r) return r.trim();
2014
- const i = e.getAttribute("placeholder");
2015
- if (i) return i.trim();
2016
- const o = e.closest("label");
2017
- return o != null && o.textContent ? o.textContent.trim() : "";
2050
+ const o = e.getAttribute("placeholder");
2051
+ if (o) return o.trim();
2052
+ const i = e.closest("label");
2053
+ return i != null && i.textContent ? i.textContent.trim() : "";
2018
2054
  }
2019
- function ye(e, t) {
2055
+ function ge(e, t) {
2020
2056
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
2021
2057
  }
2022
- function Be(e) {
2058
+ function Fe(e) {
2023
2059
  return e.length;
2024
2060
  }
2025
- function zr(e, t = {}) {
2061
+ function Br(e, t = {}) {
2026
2062
  const r = t.doc ?? (typeof document < "u" ? document : null);
2027
2063
  if (!r)
2028
2064
  return {
@@ -2036,120 +2072,120 @@ function zr(e, t = {}) {
2036
2072
  forms: [],
2037
2073
  extras: e
2038
2074
  };
2039
- const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "", s = Array.from(
2075
+ const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "", d = Array.from(
2040
2076
  r.querySelectorAll("[data-ll-region]")
2041
2077
  ), a = [];
2042
- for (const x of s) {
2043
- if (a.length >= Tr) break;
2044
- if (rt(x) || !it(x)) continue;
2045
- const R = x.getAttribute("data-ll-region") ?? "", B = x.getAttribute("data-ll-intent") ?? void 0, q = ye(
2078
+ for (const x of d) {
2079
+ if (a.length >= $r) break;
2080
+ if (ct(x) || !st(x)) continue;
2081
+ const R = x.getAttribute("data-ll-region") ?? "", B = x.getAttribute("data-ll-intent") ?? void 0, q = ge(
2046
2082
  (x.innerText || x.textContent || "").trim(),
2047
- on * 2
2083
+ sn * 2
2048
2084
  );
2049
2085
  !R || !q || a.push({ id: R, intent: B, text: q });
2050
2086
  }
2051
- const d = [], f = ["H1", "H2", "H3", "H4", "H5", "H6"], _ = Array.from(
2087
+ const s = [], f = ["H1", "H2", "H3", "H4", "H5", "H6"], b = Array.from(
2052
2088
  r.querySelectorAll("h1, h2, h3, h4, h5, h6")
2053
2089
  );
2054
- for (const x of _) {
2055
- if (rt(x) || !it(x)) continue;
2090
+ for (const x of b) {
2091
+ if (ct(x) || !st(x)) continue;
2056
2092
  const R = (x.textContent || "").trim();
2057
- R && d.push(`${x.tagName}: ${ye(R, 200)}`);
2093
+ R && s.push(`${x.tagName}: ${ge(R, 200)}`);
2058
2094
  }
2059
2095
  const u = Array.from(r.querySelectorAll("p, li"));
2060
2096
  for (const x of u) {
2061
- if (rt(x) || !it(x) || f.includes(x.tagName)) continue;
2097
+ if (ct(x) || !st(x) || f.includes(x.tagName)) continue;
2062
2098
  const R = (x.textContent || "").trim();
2063
- R.length > 10 && d.push(ye(R, on));
2099
+ R.length > 10 && s.push(ge(R, sn));
2064
2100
  }
2065
- const c = d.join(`
2066
- `), I = [], L = Array.from(r.querySelectorAll("a[href]"));
2067
- for (const x of L) {
2068
- if (I.length >= Rr) break;
2069
- if (rt(x) || !it(x)) continue;
2101
+ const c = s.join(`
2102
+ `), I = [], k = Array.from(r.querySelectorAll("a[href]"));
2103
+ for (const x of k) {
2104
+ if (I.length >= Dr) break;
2105
+ if (ct(x) || !st(x)) continue;
2070
2106
  const R = x.getAttribute("href") || "", B = (x.textContent || "").trim();
2071
- !R || !B || I.push({ href: R, text: ye(B, 100) });
2107
+ !R || !B || I.push({ href: R, text: ge(B, 100) });
2072
2108
  }
2073
- const b = [], y = Array.from(
2109
+ const w = [], v = Array.from(
2074
2110
  r.querySelectorAll(
2075
2111
  "input, textarea, select"
2076
2112
  )
2077
2113
  );
2078
- for (const x of y) {
2079
- if (b.length >= Ir) break;
2080
- if (rt(x) || !yt(x) || !it(x)) continue;
2081
- const R = ln(x), B = x instanceof HTMLInputElement ? x.type : x.tagName.toLowerCase();
2082
- R && b.push({ label: ye(R, 100), type: B });
2114
+ for (const x of v) {
2115
+ if (w.length >= Pr) break;
2116
+ if (ct(x) || !_t(x) || !st(x)) continue;
2117
+ const R = dn(x), B = x instanceof HTMLInputElement ? x.type : x.tagName.toLowerCase();
2118
+ R && w.push({ label: ge(R, 100), type: B });
2083
2119
  }
2084
2120
  const m = Array.from(
2085
2121
  r.querySelectorAll("[data-ll-form]")
2086
- ), S = [];
2122
+ ), N = [];
2087
2123
  for (const x of m) {
2088
- if (S.length >= Mr) break;
2089
- if (At(x)) continue;
2124
+ if (N.length >= zr) break;
2125
+ if (It(x)) continue;
2090
2126
  const R = x.getAttribute("data-ll-form") || "";
2091
2127
  if (!R) continue;
2092
2128
  const B = x.getAttribute("data-ll-intent") || void 0, q = Array.from(
2093
2129
  x.querySelectorAll(
2094
2130
  "[data-ll-field]"
2095
2131
  )
2096
- ), N = [];
2097
- for (const M of q) {
2098
- if (N.length >= Dr) break;
2099
- if (!yt(M)) continue;
2100
- const F = M.getAttribute("data-ll-field") || "";
2132
+ ), A = [];
2133
+ for (const T of q) {
2134
+ if (A.length >= Or) break;
2135
+ if (!_t(T)) continue;
2136
+ const F = T.getAttribute("data-ll-field") || "";
2101
2137
  if (!F) continue;
2102
- const re = ln(M) || F, ie = M instanceof HTMLInputElement ? M.type : M.tagName.toLowerCase(), Z = {
2138
+ const oe = dn(T) || F, ie = T instanceof HTMLInputElement ? T.type : T.tagName.toLowerCase(), Z = {
2103
2139
  name: F,
2104
- label: ye(re, 100),
2140
+ label: ge(oe, 100),
2105
2141
  type: ie
2106
2142
  };
2107
- if (M.required === !0 && (Z.required = !0), M instanceof HTMLSelectElement) {
2143
+ if (T.required === !0 && (Z.required = !0), T instanceof HTMLSelectElement) {
2108
2144
  const fe = [];
2109
- for (let ve = 0; ve < M.options.length && !(fe.length >= Pr); ve++) {
2110
- const pe = M.options[ve];
2145
+ for (let ye = 0; ye < T.options.length && !(fe.length >= Hr); ye++) {
2146
+ const pe = T.options[ye];
2111
2147
  if (!pe || pe.disabled) continue;
2112
- const be = pe.value || "", he = (pe.textContent || "").trim() || be;
2113
- !be && !he || fe.push({ value: be, label: ye(he, 60) });
2148
+ const ve = pe.value || "", he = (pe.textContent || "").trim() || ve;
2149
+ !ve && !he || fe.push({ value: ve, label: ge(he, 60) });
2114
2150
  }
2115
2151
  fe.length > 0 && (Z.options = fe);
2116
2152
  }
2117
- const ae = typeof M.validationMessage == "string" ? M.validationMessage : "";
2118
- ae && (Z.validationMessage = ye(ae, 200)), N.push(Z);
2153
+ const ce = typeof T.validationMessage == "string" ? T.validationMessage : "";
2154
+ ce && (Z.validationMessage = ge(ce, 200)), A.push(Z);
2119
2155
  }
2120
- S.push({ id: R, intent: B, fields: N });
2156
+ N.push({ id: R, intent: B, fields: A });
2121
2157
  }
2122
2158
  const $ = {
2123
- url: i,
2159
+ url: o,
2124
2160
  title: l,
2125
- pathname: o,
2161
+ pathname: i,
2126
2162
  regions: a,
2127
2163
  visibleText: c,
2128
2164
  visibleLinks: I,
2129
- visibleFields: b,
2130
- forms: S,
2165
+ visibleFields: w,
2166
+ forms: N,
2131
2167
  extras: e
2132
2168
  };
2133
- let D = Be(JSON.stringify($.regions)) + Be($.visibleText) + Be(JSON.stringify($.visibleLinks)) + Be(JSON.stringify($.visibleFields));
2134
- for (; D > mt && $.visibleFields.length > 0; )
2135
- $.visibleFields.pop(), D = Be(JSON.stringify($.visibleFields));
2136
- for (; D > mt && $.visibleLinks.length > 0; )
2169
+ let D = Fe(JSON.stringify($.regions)) + Fe($.visibleText) + Fe(JSON.stringify($.visibleLinks)) + Fe(JSON.stringify($.visibleFields));
2170
+ for (; D > bt && $.visibleFields.length > 0; )
2171
+ $.visibleFields.pop(), D = Fe(JSON.stringify($.visibleFields));
2172
+ for (; D > bt && $.visibleLinks.length > 0; )
2137
2173
  $.visibleLinks.pop(), D -= 80;
2138
- return Be($.visibleText) > mt && ($.visibleText = ye($.visibleText, mt - 100)), $;
2174
+ return Fe($.visibleText) > bt && ($.visibleText = ge($.visibleText, bt - 100)), $;
2139
2175
  }
2140
- let qe = null;
2141
- function an(e, t = {}) {
2142
- const r = Date.now(), o = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
2143
- if (qe && qe.key === o && r - qe.at < 1e3)
2144
- return qe.ctx;
2145
- const l = zr(e, t);
2146
- return qe = { key: o, at: r, ctx: l }, l;
2176
+ let Ue = null;
2177
+ function un(e, t = {}) {
2178
+ const r = Date.now(), i = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
2179
+ if (Ue && Ue.key === i && r - Ue.at < 1e3)
2180
+ return Ue.ctx;
2181
+ const l = Br(e, t);
2182
+ return Ue = { key: i, at: r, ctx: l }, l;
2147
2183
  }
2148
- function Or() {
2149
- qe = null;
2184
+ function qr() {
2185
+ Ue = null;
2150
2186
  }
2151
- const Hr = 200;
2152
- function Wr(e) {
2187
+ const Fr = 200;
2188
+ function Ur(e) {
2153
2189
  const t = String(e.href || "");
2154
2190
  return {
2155
2191
  href: t,
@@ -2159,63 +2195,63 @@ function Wr(e) {
2159
2195
  description: e.description
2160
2196
  };
2161
2197
  }
2162
- function Br(e) {
2198
+ function jr(e) {
2163
2199
  return !(!e || e.startsWith("#") || e.startsWith("javascript:") || e.startsWith("mailto:") || e.startsWith("tel:"));
2164
2200
  }
2165
- function qr(e) {
2201
+ function Vr(e) {
2166
2202
  const t = e ?? (typeof document < "u" ? document : null);
2167
2203
  if (!t) return [];
2168
- const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), o = [], l = Array.from(t.querySelectorAll("a[href]"));
2169
- for (const s of l) {
2170
- if (o.length >= Hr) break;
2171
- if (At(s)) continue;
2172
- const a = s.getAttribute("href") || "";
2173
- if (!Br(a)) continue;
2174
- let d = a, f = !0;
2204
+ const r = typeof window < "u" && window.location.origin || "", o = /* @__PURE__ */ new Set(), i = [], l = Array.from(t.querySelectorAll("a[href]"));
2205
+ for (const d of l) {
2206
+ if (i.length >= Fr) break;
2207
+ if (It(d)) continue;
2208
+ const a = d.getAttribute("href") || "";
2209
+ if (!jr(a)) continue;
2210
+ let s = a, f = !0;
2175
2211
  try {
2176
2212
  if (typeof window < "u") {
2177
2213
  const u = new URL(a, r);
2178
- f = u.origin === r, f && a.startsWith("http") && (d = u.pathname + u.search + u.hash);
2214
+ f = u.origin === r, f && a.startsWith("http") && (s = u.pathname + u.search + u.hash);
2179
2215
  }
2180
2216
  } catch {
2181
2217
  continue;
2182
2218
  }
2183
- if (i.has(d)) continue;
2184
- i.add(d);
2185
- const _ = (s.textContent || "").trim().slice(0, 120);
2186
- o.push({ href: d, text: _, internal: f });
2219
+ if (o.has(s)) continue;
2220
+ o.add(s);
2221
+ const b = (d.textContent || "").trim().slice(0, 120);
2222
+ i.push({ href: s, text: b, internal: f });
2187
2223
  }
2188
- return o;
2224
+ return i;
2189
2225
  }
2190
- let Fe = null;
2191
- const Fr = 5e3;
2192
- function St() {
2226
+ let je = null;
2227
+ const Yr = 5e3;
2228
+ function Nt() {
2193
2229
  const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
2194
- if (Fe && Fe.pathname === t && e - Fe.at < Fr)
2195
- return Fe.routes;
2196
- const r = qr();
2197
- return Fe = { at: e, pathname: t, routes: r }, r;
2230
+ if (je && je.pathname === t && e - je.at < Yr)
2231
+ return je.routes;
2232
+ const r = Vr();
2233
+ return je = { at: e, pathname: t, routes: r }, r;
2198
2234
  }
2199
- function Ur() {
2200
- Fe = null;
2235
+ function Gr() {
2236
+ je = null;
2201
2237
  }
2202
- function jr(e, t) {
2203
- const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, i = Object.getOwnPropertyDescriptor(r, "value"), o = i == null ? void 0 : i.set;
2204
- o ? o.call(e, t) : e.value = t;
2238
+ function Jr(e, t) {
2239
+ 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;
2240
+ i ? i.call(e, t) : e.value = t;
2205
2241
  }
2206
- function Vr(e, t, r = {}) {
2207
- const i = r.triggerInput ?? !0, o = r.triggerChange ?? !0;
2242
+ function Kr(e, t, r = {}) {
2243
+ const o = r.triggerInput ?? !0, i = r.triggerChange ?? !0;
2208
2244
  if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
2209
2245
  const l = Object.getOwnPropertyDescriptor(
2210
2246
  HTMLInputElement.prototype,
2211
2247
  "checked"
2212
- ), s = l == null ? void 0 : l.set, a = t === "true" || t === "1" || t === "on";
2213
- s ? s.call(e, a) : e.checked = a, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2248
+ ), d = l == null ? void 0 : l.set, a = t === "true" || t === "1" || t === "on";
2249
+ d ? d.call(e, a) : e.checked = a, o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2214
2250
  return;
2215
2251
  }
2216
- jr(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2252
+ Jr(e, t), o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2217
2253
  }
2218
- function Yr() {
2254
+ function Xr() {
2219
2255
  if (typeof window > "u" || typeof document > "u")
2220
2256
  return !1;
2221
2257
  const e = document.scrollingElement || document.documentElement;
@@ -2223,44 +2259,44 @@ function Yr() {
2223
2259
  const t = window.getComputedStyle(e);
2224
2260
  return !(t.overflowY === "hidden" || t.overflowY === "clip");
2225
2261
  }
2226
- function Gr(e) {
2262
+ function Qr(e) {
2227
2263
  if (!(e instanceof HTMLElement)) return !1;
2228
2264
  const r = window.getComputedStyle(e).overflowY;
2229
2265
  return !(r !== "auto" && r !== "scroll" || e.scrollHeight <= e.clientHeight + 2);
2230
2266
  }
2231
- function Jr() {
2267
+ function Zr() {
2232
2268
  if (typeof document > "u") return null;
2233
2269
  const e = Array.from(
2234
2270
  document.querySelectorAll("body, body *")
2235
2271
  );
2236
2272
  let t = null, r = 0;
2237
- for (const i of e) {
2238
- if (!Gr(i)) continue;
2239
- const o = i.getBoundingClientRect();
2240
- if (o.bottom <= 0 || o.top >= window.innerHeight || o.right <= 0 || o.left >= window.innerWidth || o.width <= 0 || o.height <= 0 || i.closest(".ll-widget")) continue;
2241
- const l = o.width * o.height;
2242
- l > r && (r = l, t = i);
2273
+ for (const o of e) {
2274
+ if (!Qr(o)) continue;
2275
+ const i = o.getBoundingClientRect();
2276
+ 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;
2277
+ const l = i.width * i.height;
2278
+ l > r && (r = l, t = o);
2243
2279
  }
2244
2280
  return t;
2245
2281
  }
2246
- function Kr() {
2282
+ function eo() {
2247
2283
  if (typeof window > "u")
2248
2284
  return null;
2249
- if (Yr()) return window;
2250
- const e = Jr();
2285
+ if (Xr()) return window;
2286
+ const e = Zr();
2251
2287
  return e || window;
2252
2288
  }
2253
- function cn(e) {
2289
+ function fn(e) {
2254
2290
  return e instanceof Window ? e.innerHeight || 0 : e.clientHeight || 0;
2255
2291
  }
2256
- function Xr(e) {
2292
+ function to(e) {
2257
2293
  var t, r;
2258
2294
  return e instanceof Window ? typeof document > "u" ? 0 : Math.max(
2259
2295
  ((t = document.body) == null ? void 0 : t.scrollHeight) ?? 0,
2260
2296
  ((r = document.documentElement) == null ? void 0 : r.scrollHeight) ?? 0
2261
2297
  ) : e.scrollHeight - e.clientHeight;
2262
2298
  }
2263
- const Qr = /* @__PURE__ */ new Set([
2299
+ const no = /* @__PURE__ */ new Set([
2264
2300
  "agent_state",
2265
2301
  "avatar_stream_ready",
2266
2302
  "avatar_active",
@@ -2282,115 +2318,116 @@ const Qr = /* @__PURE__ */ new Set([
2282
2318
  "focus_field",
2283
2319
  "submit_form",
2284
2320
  "request_routes"
2285
- ]), yn = lt(
2321
+ ]), xn = dt(
2286
2322
  function(t, r) {
2287
- var Ot, Ht, Wt, Bt, qt, Ft, Ut;
2323
+ var qt, Ft, Ut, jt, Vt, Yt, Gt;
2288
2324
  const {
2289
- agentId: i,
2290
- apiKey: o,
2325
+ agentId: o,
2326
+ apiKey: i,
2291
2327
  baseUrl: l = "https://app.livelayer.studio",
2292
- sessionEndpoint: s,
2328
+ sessionEndpoint: d,
2293
2329
  sessionBody: a,
2294
- soundEffects: d,
2330
+ soundEffects: s,
2295
2331
  experienceMode: f = "WIDGET",
2296
- autoConnect: _ = !1,
2332
+ autoConnect: b = !1,
2297
2333
  displayMode: u,
2298
2334
  defaultDisplayMode: c = "expanded",
2299
2335
  onDisplayModeChange: I,
2300
- position: L = "bottom-right",
2301
- mobileBreakpoint: b = 640,
2302
- persistKey: y = "ll-widget",
2336
+ position: k = "bottom-right",
2337
+ mobileBreakpoint: w = 640,
2338
+ persistKey: v = "ll-widget",
2303
2339
  disablePersistence: m = !1,
2304
- teamMembers: S,
2340
+ teamMembers: N,
2305
2341
  currentTeamMemberId: $,
2306
2342
  onTeamMemberChange: D,
2307
2343
  idleLoopUrl: x,
2308
2344
  greeting: R,
2309
2345
  avatarImageUrl: B,
2310
2346
  agentName: q,
2311
- branding: N = {},
2312
- allowCamera: M = !0,
2347
+ branding: A = {},
2348
+ allowCamera: T = !0,
2313
2349
  allowScreenShare: F = !0,
2314
- allowTyping: re = !0,
2350
+ allowTyping: oe = !0,
2315
2351
  showMinimize: ie = !0,
2316
2352
  chromeless: Z = !1,
2317
- compactControls: ae = !1,
2318
- transforming: fe = !1,
2319
- transformingLabel: ve = "Transforming…",
2320
- showOn: pe,
2321
- hideOn: be,
2322
- pathname: he,
2323
- onNavigate: ee,
2324
- onScrollToSelector: at,
2325
- getPageContext: je,
2326
- pageContextExtras: ct,
2327
- getRoutes: oe,
2328
- onScrollPage: Ve,
2329
- onClick: Ye,
2330
- capabilities: Ge,
2331
- onConnect: De,
2332
- onDisconnect: Ae,
2333
- onTranscript: Pe,
2334
- onAgentState: Re,
2335
- onConnectionStateChange: $e,
2336
- onAgentEvent: Ie,
2337
- onAgentCommand: Te,
2353
+ floatingChromeContainer: ce = null,
2354
+ compactControls: fe = !1,
2355
+ transforming: ye = !1,
2356
+ transformingLabel: pe = "Transforming…",
2357
+ showOn: ve,
2358
+ hideOn: he,
2359
+ pathname: ee,
2360
+ onNavigate: ut,
2361
+ onScrollToSelector: Ge,
2362
+ getPageContext: ft,
2363
+ pageContextExtras: le,
2364
+ getRoutes: Je,
2365
+ onScrollPage: Ke,
2366
+ onClick: pt,
2367
+ capabilities: Xe,
2368
+ onConnect: Ce,
2369
+ onDisconnect: Pe,
2370
+ onTranscript: Se,
2371
+ onAgentState: $e,
2372
+ onConnectionStateChange: Ne,
2373
+ onAgentEvent: Ae,
2374
+ onAgentCommand: Re,
2338
2375
  controlledSession: z,
2339
- className: st,
2340
- style: dt,
2341
- zIndex: vt = 2147483647
2342
- } = t, we = rr(he), _e = dr(we, pe, be);
2343
- T(() => {
2344
- Or(), Ur();
2345
- }, [we]);
2346
- const te = $ !== void 0, [bt, Je] = C(() => {
2376
+ className: ht,
2377
+ style: xt,
2378
+ zIndex: Ie = 2147483647
2379
+ } = t, Me = ar(ee), te = hr(Me, ve, he);
2380
+ M(() => {
2381
+ qr(), Gr();
2382
+ }, [Me]);
2383
+ const Qe = $ !== void 0, [Ze, ze] = C(() => {
2347
2384
  var g;
2348
- return $ ?? ((g = S == null ? void 0 : S[0]) == null ? void 0 : g.id);
2349
- }), ce = te ? $ : bt, X = Ue(
2350
- () => (S == null ? void 0 : S.find((g) => g.id === ce)) ?? null,
2351
- [S, ce]
2352
- ), Ke = (X == null ? void 0 : X.agentId) ?? i, ze = f === "EMBEDDED", [xe, se] = Zn({
2353
- value: ze ? "expanded" : u,
2354
- defaultValue: ze ? "expanded" : c,
2385
+ return $ ?? ((g = N == null ? void 0 : N[0]) == null ? void 0 : g.id);
2386
+ }), Te = Qe ? $ : Ze, X = Ye(
2387
+ () => (N == null ? void 0 : N.find((g) => g.id === Te)) ?? null,
2388
+ [N, Te]
2389
+ ), mt = (X == null ? void 0 : X.agentId) ?? o, et = f === "EMBEDDED", [ne, re] = rr({
2390
+ value: u,
2391
+ defaultValue: c,
2355
2392
  onChange: I,
2356
- persistKey: y,
2357
- disablePersistence: ze || m
2358
- }), me = tr(b), ke = Bn(), G = qn(), ne = Un(), Le = jn(), Xe = Vn(), [wt, Ee] = C(!1), [Oe, ut] = C(!1), [Qe, de] = C(!1), [Ce, ft] = C(!1), [He, _t] = C(!1), Me = fr({ baseUrl: l, config: d }), h = A(Me);
2359
- h.current = Me;
2360
- const V = A(ee), xt = A(at), kt = A(Ve), Lt = A(Ye), Rt = A(je), It = A(ct), Tt = A(oe), Et = A(Ge), ue = A(null);
2361
- V.current = ee, xt.current = at, kt.current = Ve, Lt.current = Ye, Rt.current = je, It.current = ct, Tt.current = oe, Et.current = Ge;
2362
- function Se(g) {
2363
- const p = Et.current;
2393
+ persistKey: v,
2394
+ disablePersistence: et || m
2395
+ }), se = ir(w), be = jn(), G = Vn(), de = Gn(), we = Jn(), Oe = Kn(), [kt, tt] = C(!1), [_e, nt] = C(!1), [rt, ot] = C(!1), [xe, ke] = C(!1), [He, gt] = C(!1), We = gr({ baseUrl: l, config: s }), De = S(We);
2396
+ De.current = We;
2397
+ const h = S(ut), V = S(Ge), Lt = S(Ke), Et = S(pt), Mt = S(ft), Tt = S(le), Dt = S(Je), Ct = S(Xe), ue = S(null);
2398
+ h.current = ut, V.current = Ge, Lt.current = Ke, Et.current = pt, Mt.current = ft, Tt.current = le, Dt.current = Je, Ct.current = Xe;
2399
+ function Le(g) {
2400
+ const p = Ct.current;
2364
2401
  return p ? p.includes(g) : !0;
2365
2402
  }
2366
- function Ne(g, p) {
2403
+ function Ee(g, p) {
2367
2404
  console.warn(
2368
2405
  `[LiveLayer] Agent command "${g}" blocked — capability "${p}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
2369
2406
  );
2370
2407
  }
2371
- const Ze = E(
2408
+ const it = E(
2372
2409
  (g) => {
2373
- var Y, le, ge, nt;
2410
+ var Y, ae, me, at;
2374
2411
  const p = g;
2375
2412
  if (!(!p.type || typeof p.type != "string")) {
2376
- if (Ie == null || Ie({ eventName: p.type, data: g }), p.type === "navigate") {
2377
- if (!Se("navigate")) {
2378
- Ne("navigate", "navigate");
2413
+ if (Ae == null || Ae({ eventName: p.type, data: g }), p.type === "navigate") {
2414
+ if (!Le("navigate")) {
2415
+ Ee("navigate", "navigate");
2379
2416
  return;
2380
2417
  }
2381
- const k = typeof p.href == "string" ? p.href : null;
2382
- if (!k) {
2418
+ const L = typeof p.href == "string" ? p.href : null;
2419
+ if (!L) {
2383
2420
  console.warn(
2384
2421
  `[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
2385
2422
  );
2386
2423
  return;
2387
2424
  }
2388
- if (h.current.playPageChange(), V.current) {
2425
+ if (De.current.playPageChange(), h.current) {
2389
2426
  try {
2390
- V.current(k);
2427
+ h.current(L);
2391
2428
  } catch (P) {
2392
2429
  console.warn(
2393
- `[LiveLayer] onNavigate threw for "${k}". Falling back. Error:`,
2430
+ `[LiveLayer] onNavigate threw for "${L}". Falling back. Error:`,
2394
2431
  P
2395
2432
  );
2396
2433
  }
@@ -2398,7 +2435,7 @@ const Qr = /* @__PURE__ */ new Set([
2398
2435
  }
2399
2436
  if (typeof document < "u") {
2400
2437
  const P = document.querySelector(
2401
- `a[href="${k.replace(/"/g, '\\"')}"]`
2438
+ `a[href="${L.replace(/"/g, '\\"')}"]`
2402
2439
  );
2403
2440
  if (P) {
2404
2441
  P.click();
@@ -2407,27 +2444,27 @@ const Qr = /* @__PURE__ */ new Set([
2407
2444
  }
2408
2445
  if (typeof window < "u" && typeof history < "u")
2409
2446
  try {
2410
- history.pushState({}, "", k), window.dispatchEvent(new PopStateEvent("popstate"));
2447
+ history.pushState({}, "", L), window.dispatchEvent(new PopStateEvent("popstate"));
2411
2448
  } catch (P) {
2412
2449
  console.warn(
2413
- `[LiveLayer] history.pushState fallback failed for "${k}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
2450
+ `[LiveLayer] history.pushState fallback failed for "${L}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
2414
2451
  P
2415
2452
  );
2416
2453
  }
2417
2454
  return;
2418
2455
  }
2419
2456
  if (p.type === "scroll_to") {
2420
- if (!Se("scroll")) {
2421
- Ne("scroll_to", "scroll");
2457
+ if (!Le("scroll")) {
2458
+ Ee("scroll_to", "scroll");
2422
2459
  return;
2423
2460
  }
2424
- const k = typeof p.selector == "string" ? p.selector : null;
2425
- if (!k) return;
2461
+ const L = typeof p.selector == "string" ? p.selector : null;
2462
+ if (!L) return;
2426
2463
  const P = p.behavior === "instant" ? "instant" : "smooth";
2427
- if (xt.current) {
2464
+ if (V.current) {
2428
2465
  try {
2429
- xt.current(
2430
- k,
2466
+ V.current(
2467
+ L,
2431
2468
  P
2432
2469
  );
2433
2470
  } catch (W) {
@@ -2438,16 +2475,16 @@ const Qr = /* @__PURE__ */ new Set([
2438
2475
  if (typeof document < "u") {
2439
2476
  let W = null;
2440
2477
  try {
2441
- W = document.querySelector(k);
2478
+ W = document.querySelector(L);
2442
2479
  } catch {
2443
2480
  console.warn(
2444
- `[LiveLayer] scroll_to: invalid selector "${k}".`
2481
+ `[LiveLayer] scroll_to: invalid selector "${L}".`
2445
2482
  );
2446
2483
  return;
2447
2484
  }
2448
2485
  if (!W) {
2449
2486
  console.warn(
2450
- `[LiveLayer] scroll_to: no element matched "${k}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
2487
+ `[LiveLayer] scroll_to: no element matched "${L}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
2451
2488
  );
2452
2489
  return;
2453
2490
  }
@@ -2459,20 +2496,20 @@ const Qr = /* @__PURE__ */ new Set([
2459
2496
  return;
2460
2497
  }
2461
2498
  if (p.type === "request_page_context") {
2462
- if (!Se("read_page")) {
2463
- Ne("request_page_context", "read_page");
2499
+ if (!Le("read_page")) {
2500
+ Ee("request_page_context", "read_page");
2464
2501
  return;
2465
2502
  }
2466
- const k = typeof p.requestId == "string" ? p.requestId : void 0, P = (Y = ue.current) == null ? void 0 : Y.call(ue), W = (j) => {
2503
+ const L = typeof p.requestId == "string" ? p.requestId : void 0, P = (Y = ue.current) == null ? void 0 : Y.call(ue), W = (j) => {
2467
2504
  const O = P, K = O == null ? void 0 : O.localParticipant;
2468
2505
  if (K != null && K.publishData)
2469
2506
  try {
2470
- const Q = k ? { ...j, requestId: k } : j, We = new TextEncoder().encode(JSON.stringify(Q));
2471
- K.publishData(We, { reliable: !0 });
2507
+ const Q = L ? { ...j, requestId: L } : j, qe = new TextEncoder().encode(JSON.stringify(Q));
2508
+ K.publishData(qe, { reliable: !0 });
2472
2509
  } catch (Q) {
2473
2510
  console.warn("[LiveLayer] publishData failed.", Q);
2474
2511
  }
2475
- }, H = It.current, U = Rt.current;
2512
+ }, H = Tt.current, U = Mt.current;
2476
2513
  try {
2477
2514
  if (U) {
2478
2515
  const j = U(H);
@@ -2483,7 +2520,7 @@ const Qr = /* @__PURE__ */ new Set([
2483
2520
  O
2484
2521
  ), W({
2485
2522
  type: "page_context",
2486
- context: an(H)
2523
+ context: un(H)
2487
2524
  });
2488
2525
  });
2489
2526
  return;
@@ -2493,7 +2530,7 @@ const Qr = /* @__PURE__ */ new Set([
2493
2530
  }
2494
2531
  W({
2495
2532
  type: "page_context",
2496
- context: an(H)
2533
+ context: un(H)
2497
2534
  });
2498
2535
  } catch (j) {
2499
2536
  console.warn(
@@ -2507,22 +2544,22 @@ const Qr = /* @__PURE__ */ new Set([
2507
2544
  return;
2508
2545
  }
2509
2546
  if (p.type === "scroll_page") {
2510
- if (!Se("scroll")) {
2511
- Ne("scroll_page", "scroll");
2547
+ if (!Le("scroll")) {
2548
+ Ee("scroll_page", "scroll");
2512
2549
  return;
2513
2550
  }
2514
- const k = p.direction;
2515
- if (k !== "up" && k !== "down" && k !== "top" && k !== "bottom") {
2551
+ const L = p.direction;
2552
+ if (L !== "up" && L !== "down" && L !== "top" && L !== "bottom") {
2516
2553
  console.warn(
2517
- `[LiveLayer] scroll_page: invalid direction "${String(k)}". Expected up | down | top | bottom.`
2554
+ `[LiveLayer] scroll_page: invalid direction "${String(L)}". Expected up | down | top | bottom.`
2518
2555
  );
2519
2556
  return;
2520
2557
  }
2521
2558
  const P = p.behavior === "instant" ? "instant" : "smooth";
2522
- if (kt.current) {
2559
+ if (Lt.current) {
2523
2560
  try {
2524
- kt.current(
2525
- k,
2561
+ Lt.current(
2562
+ L,
2526
2563
  P
2527
2564
  );
2528
2565
  } catch (O) {
@@ -2531,27 +2568,27 @@ const Qr = /* @__PURE__ */ new Set([
2531
2568
  return;
2532
2569
  }
2533
2570
  if (typeof window > "u") return;
2534
- const W = { behavior: P }, H = Kr(), U = (O) => {
2571
+ const W = { behavior: P }, H = eo(), U = (O) => {
2535
2572
  H instanceof Window ? H.scrollBy({ top: O, ...W }) : H.scrollBy({ top: O, ...W });
2536
2573
  }, j = (O) => {
2537
2574
  H instanceof Window ? H.scrollTo({ top: O, ...W }) : H.scrollTo({ top: O, ...W });
2538
2575
  };
2539
- k === "up" ? U(-cn(H)) : k === "down" ? U(cn(H)) : j(k === "top" ? 0 : Xr(H));
2576
+ L === "up" ? U(-fn(H)) : L === "down" ? U(fn(H)) : j(L === "top" ? 0 : to(H));
2540
2577
  return;
2541
2578
  }
2542
2579
  if (p.type === "click") {
2543
- if (!Se("click")) {
2544
- Ne("click", "click");
2580
+ if (!Le("click")) {
2581
+ Ee("click", "click");
2545
2582
  return;
2546
2583
  }
2547
- const k = typeof p.selector == "string" ? p.selector : null;
2548
- if (!k) {
2584
+ const L = typeof p.selector == "string" ? p.selector : null;
2585
+ if (!L) {
2549
2586
  console.warn("[LiveLayer] click: missing selector.");
2550
2587
  return;
2551
2588
  }
2552
- if (Lt.current) {
2589
+ if (Et.current) {
2553
2590
  try {
2554
- Lt.current(k);
2591
+ Et.current(L);
2555
2592
  } catch (W) {
2556
2593
  console.warn("[LiveLayer] onClick threw.", W);
2557
2594
  }
@@ -2560,16 +2597,16 @@ const Qr = /* @__PURE__ */ new Set([
2560
2597
  if (typeof document > "u") return;
2561
2598
  let P = null;
2562
2599
  try {
2563
- P = document.querySelector(k);
2600
+ P = document.querySelector(L);
2564
2601
  } catch {
2565
2602
  console.warn(
2566
- `[LiveLayer] click: invalid selector "${k}".`
2603
+ `[LiveLayer] click: invalid selector "${L}".`
2567
2604
  );
2568
2605
  return;
2569
2606
  }
2570
2607
  if (!P) {
2571
2608
  console.warn(
2572
- `[LiveLayer] click: no element matched "${k}". See https://livelayer.studio/docs/errors/click-no-match`
2609
+ `[LiveLayer] click: no element matched "${L}". See https://livelayer.studio/docs/errors/click-no-match`
2573
2610
  );
2574
2611
  return;
2575
2612
  }
@@ -2579,27 +2616,27 @@ const Qr = /* @__PURE__ */ new Set([
2579
2616
  );
2580
2617
  return;
2581
2618
  }
2582
- (le = P.click) == null || le.call(P);
2619
+ (ae = P.click) == null || ae.call(P);
2583
2620
  return;
2584
2621
  }
2585
2622
  if (p.type === "fill_form" || p.type === "focus_field") {
2586
- if (!Se("fill_forms")) {
2587
- Ne(p.type, "fill_forms");
2623
+ if (!Le("fill_forms")) {
2624
+ Ee(p.type, "fill_forms");
2588
2625
  return;
2589
2626
  }
2590
2627
  if (typeof document > "u") return;
2591
- p.type === "fill_form" && h.current.playConfirmation();
2592
- const k = typeof p.formId == "string" ? p.formId : null;
2593
- if (!k) {
2628
+ p.type === "fill_form" && De.current.playConfirmation();
2629
+ const L = typeof p.formId == "string" ? p.formId : null;
2630
+ if (!L) {
2594
2631
  console.warn(`[LiveLayer] ${p.type}: missing formId.`);
2595
2632
  return;
2596
2633
  }
2597
2634
  const P = document.querySelector(
2598
- `[data-ll-form="${k.replace(/"/g, '\\"')}"]`
2635
+ `[data-ll-form="${L.replace(/"/g, '\\"')}"]`
2599
2636
  );
2600
2637
  if (!P) {
2601
2638
  console.warn(
2602
- `[LiveLayer] ${p.type}: no form with data-ll-form="${k}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
2639
+ `[LiveLayer] ${p.type}: no form with data-ll-form="${L}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
2603
2640
  );
2604
2641
  return;
2605
2642
  }
@@ -2618,11 +2655,11 @@ const Qr = /* @__PURE__ */ new Set([
2618
2655
  const U = P.querySelector(`[data-ll-field="${H.replace(/"/g, '\\"')}"]`);
2619
2656
  if (!U) {
2620
2657
  console.warn(
2621
- `[LiveLayer] focus_field: no field "${H}" in form "${k}".`
2658
+ `[LiveLayer] focus_field: no field "${H}" in form "${L}".`
2622
2659
  );
2623
2660
  return;
2624
2661
  }
2625
- if (!yt(U)) {
2662
+ if (!_t(U)) {
2626
2663
  console.warn(
2627
2664
  `[LiveLayer] focus_field: field "${H}" is privacy-protected and not focusable.`
2628
2665
  );
@@ -2641,18 +2678,18 @@ const Qr = /* @__PURE__ */ new Set([
2641
2678
  const j = P.querySelector(`[data-ll-field="${H.replace(/"/g, '\\"')}"]`);
2642
2679
  if (!j) {
2643
2680
  console.warn(
2644
- `[LiveLayer] fill_form: no field "${H}" in form "${k}". Skipping.`
2681
+ `[LiveLayer] fill_form: no field "${H}" in form "${L}". Skipping.`
2645
2682
  );
2646
2683
  continue;
2647
2684
  }
2648
- if (!yt(j)) {
2685
+ if (!_t(j)) {
2649
2686
  console.warn(
2650
2687
  `[LiveLayer] fill_form: field "${H}" is privacy-protected (password / cc-* / private). Skipping.`
2651
2688
  );
2652
2689
  continue;
2653
2690
  }
2654
2691
  try {
2655
- Vr(j, U);
2692
+ Kr(j, U);
2656
2693
  } catch (O) {
2657
2694
  console.warn(
2658
2695
  `[LiveLayer] fill_form: failed to set "${H}".`,
@@ -2663,23 +2700,23 @@ const Qr = /* @__PURE__ */ new Set([
2663
2700
  return;
2664
2701
  }
2665
2702
  if (p.type === "submit_form") {
2666
- if (!Se("submit_forms")) {
2667
- Ne("submit_form", "submit_forms");
2703
+ if (!Le("submit_forms")) {
2704
+ Ee("submit_form", "submit_forms");
2668
2705
  return;
2669
2706
  }
2670
2707
  if (typeof document > "u") return;
2671
- const k = typeof p.formId == "string" ? p.formId : null;
2672
- if (!k) {
2708
+ const L = typeof p.formId == "string" ? p.formId : null;
2709
+ if (!L) {
2673
2710
  console.warn("[LiveLayer] submit_form: missing formId.");
2674
2711
  return;
2675
2712
  }
2676
- h.current.playConfirmation();
2713
+ De.current.playConfirmation();
2677
2714
  const P = document.querySelector(
2678
- `[data-ll-form="${k.replace(/"/g, '\\"')}"]`
2715
+ `[data-ll-form="${L.replace(/"/g, '\\"')}"]`
2679
2716
  );
2680
2717
  if (!P) {
2681
2718
  console.warn(
2682
- `[LiveLayer] submit_form: no form with data-ll-form="${k}".`
2719
+ `[LiveLayer] submit_form: no form with data-ll-form="${L}".`
2683
2720
  );
2684
2721
  return;
2685
2722
  }
@@ -2689,18 +2726,18 @@ const Qr = /* @__PURE__ */ new Set([
2689
2726
  );
2690
2727
  return;
2691
2728
  }
2692
- const W = typeof p.requestId == "string" ? p.requestId : void 0, H = (ge = ue.current) == null ? void 0 : ge.call(ue), U = (K) => {
2693
- const Q = H, We = Q == null ? void 0 : Q.localParticipant;
2694
- if (We != null && We.publishData)
2729
+ const W = typeof p.requestId == "string" ? p.requestId : void 0, H = (me = ue.current) == null ? void 0 : me.call(ue), U = (K) => {
2730
+ const Q = H, qe = Q == null ? void 0 : Q.localParticipant;
2731
+ if (qe != null && qe.publishData)
2695
2732
  try {
2696
- const An = W ? { ...K, requestId: W } : K, Rn = new TextEncoder().encode(JSON.stringify(An));
2697
- We.publishData(Rn, { reliable: !0 });
2733
+ const Pn = W ? { ...K, requestId: W } : K, $n = new TextEncoder().encode(JSON.stringify(Pn));
2734
+ qe.publishData($n, { reliable: !0 });
2698
2735
  } catch {
2699
2736
  }
2700
2737
  };
2701
2738
  let j = !1;
2702
2739
  const O = () => {
2703
- j = !0, U({ type: "form_submitted", formId: k });
2740
+ j = !0, U({ type: "form_submitted", formId: L });
2704
2741
  };
2705
2742
  P.addEventListener("submit", O, { once: !0 });
2706
2743
  try {
@@ -2708,7 +2745,7 @@ const Qr = /* @__PURE__ */ new Set([
2708
2745
  } catch (K) {
2709
2746
  console.warn("[LiveLayer] submit_form: requestSubmit threw.", K), P.removeEventListener("submit", O), U({
2710
2747
  type: "form_submit_blocked",
2711
- formId: k,
2748
+ formId: L,
2712
2749
  reason: "exception"
2713
2750
  });
2714
2751
  return;
@@ -2716,27 +2753,27 @@ const Qr = /* @__PURE__ */ new Set([
2716
2753
  setTimeout(() => {
2717
2754
  j || (P.removeEventListener("submit", O), U({
2718
2755
  type: "form_submit_blocked",
2719
- formId: k,
2756
+ formId: L,
2720
2757
  reason: "validation"
2721
2758
  }));
2722
2759
  }, 500);
2723
2760
  return;
2724
2761
  }
2725
2762
  if (p.type === "request_routes") {
2726
- if (!Se("read_page")) {
2727
- Ne("request_routes", "read_page");
2763
+ if (!Le("read_page")) {
2764
+ Ee("request_routes", "read_page");
2728
2765
  return;
2729
2766
  }
2730
- const k = typeof p.requestId == "string" ? p.requestId : void 0, W = (nt = ue.current) == null ? void 0 : nt.call(ue), H = W == null ? void 0 : W.localParticipant;
2767
+ const L = typeof p.requestId == "string" ? p.requestId : void 0, W = (at = ue.current) == null ? void 0 : at.call(ue), H = W == null ? void 0 : W.localParticipant;
2731
2768
  if (!(H != null && H.publishData)) return;
2732
2769
  const U = (O) => {
2733
2770
  try {
2734
- const K = k ? { type: "routes", routes: O, requestId: k } : { type: "routes", routes: O }, Q = new TextEncoder().encode(JSON.stringify(K));
2771
+ const K = L ? { type: "routes", routes: O, requestId: L } : { type: "routes", routes: O }, Q = new TextEncoder().encode(JSON.stringify(K));
2735
2772
  H.publishData(Q, { reliable: !0 });
2736
2773
  } catch (K) {
2737
2774
  console.warn("[LiveLayer] request_routes: publishData failed.", K);
2738
2775
  }
2739
- }, j = Tt.current;
2776
+ }, j = Dt.current;
2740
2777
  if (j) {
2741
2778
  try {
2742
2779
  const O = j(), K = (Q) => {
@@ -2744,63 +2781,63 @@ const Qr = /* @__PURE__ */ new Set([
2744
2781
  U([]);
2745
2782
  return;
2746
2783
  }
2747
- U(Q.map(Wr).slice(0, 200));
2784
+ U(Q.map(Ur).slice(0, 200));
2748
2785
  };
2749
2786
  O instanceof Promise ? O.then(K).catch((Q) => {
2750
2787
  console.warn(
2751
2788
  "[LiveLayer] getRoutes rejected; falling back to DOM walker.",
2752
2789
  Q
2753
- ), U(St());
2790
+ ), U(Nt());
2754
2791
  }) : K(O);
2755
2792
  } catch (O) {
2756
2793
  console.warn(
2757
2794
  "[LiveLayer] getRoutes threw; falling back to DOM walker.",
2758
2795
  O
2759
- ), U(St());
2796
+ ), U(Nt());
2760
2797
  }
2761
2798
  return;
2762
2799
  }
2763
2800
  try {
2764
- U(St());
2801
+ U(Nt());
2765
2802
  } catch (O) {
2766
2803
  console.warn("[LiveLayer] request_routes: extractRoutes threw.", O);
2767
2804
  }
2768
2805
  return;
2769
2806
  }
2770
- Qr.has(p.type) || Te == null || Te(p);
2807
+ no.has(p.type) || Re == null || Re(p);
2771
2808
  }
2772
2809
  },
2773
- [Te, Ie]
2774
- ), J = Wn({
2775
- agentId: z ? "__controlled__" : Ke,
2810
+ [Re, Ae]
2811
+ ), J = Un({
2812
+ agentId: z ? "__controlled__" : mt,
2776
2813
  baseUrl: l,
2777
- apiKey: o,
2778
- sessionEndpoint: s,
2814
+ apiKey: i,
2815
+ sessionEndpoint: d,
2779
2816
  sessionBody: a,
2780
- onDataMessage: z ? void 0 : Ze
2817
+ onDataMessage: z ? void 0 : it
2781
2818
  });
2782
- T(() => {
2819
+ M(() => {
2783
2820
  if (z != null && z.subscribeToDataMessages)
2784
- return z.subscribeToDataMessages(Ze);
2785
- }, [z, Ze]), ue.current = () => {
2821
+ return z.subscribeToDataMessages(it);
2822
+ }, [z, it]), ue.current = () => {
2786
2823
  var g;
2787
2824
  return (g = J.getRoom) == null ? void 0 : g.call(J);
2788
- }, T(() => {
2825
+ }, M(() => {
2789
2826
  var Y;
2790
2827
  if (typeof window > "u") return;
2791
2828
  const g = ((Y = window.location) == null ? void 0 : Y.hostname) || "";
2792
2829
  if (g === "localhost" || g === "127.0.0.1" || g === "0.0.0.0" || g.endsWith(".local") || g.endsWith(".test"))
2793
- return window.__livelayerSimulateCommand = (le) => {
2830
+ return window.__livelayerSimulateCommand = (ae) => {
2794
2831
  try {
2795
- Ze(le);
2796
- } catch (ge) {
2797
- console.warn("[LiveLayer] simulate-command threw:", ge);
2832
+ it(ae);
2833
+ } catch (me) {
2834
+ console.warn("[LiveLayer] simulate-command threw:", me);
2798
2835
  }
2799
2836
  }, () => {
2800
2837
  delete window.__livelayerSimulateCommand;
2801
2838
  };
2802
- }, [Ze]);
2803
- const w = Ue(() => z ? {
2839
+ }, [it]);
2840
+ const _ = Ye(() => z ? {
2804
2841
  connectionState: z.connectionState,
2805
2842
  agentState: z.agentState,
2806
2843
  transcript: z.transcript,
@@ -2831,73 +2868,73 @@ const Qr = /* @__PURE__ */ new Set([
2831
2868
  disconnect: J.disconnect,
2832
2869
  getRoom: J.getRoom,
2833
2870
  isControlled: !1
2834
- }, [z, J]), Mt = A(w);
2835
- Mt.current = w;
2836
- const Dt = A(z);
2837
- Dt.current = z, Mn(
2871
+ }, [z, J]), Pt = S(_);
2872
+ Pt.current = _;
2873
+ const $t = S(z);
2874
+ $t.current = z, On(
2838
2875
  r,
2839
2876
  () => ({
2840
2877
  sendData: async (g) => {
2841
- var ge, nt;
2842
- const p = Dt.current;
2878
+ var me, at;
2879
+ const p = $t.current;
2843
2880
  if (p != null && p.publishData) {
2844
2881
  try {
2845
2882
  await p.publishData(g);
2846
- } catch (k) {
2847
- console.warn("[AvatarWidget] sendData (controlled) failed:", k);
2883
+ } catch (L) {
2884
+ console.warn("[AvatarWidget] sendData (controlled) failed:", L);
2848
2885
  }
2849
2886
  return;
2850
2887
  }
2851
- const Y = (nt = (ge = Mt.current) == null ? void 0 : ge.getRoom) == null ? void 0 : nt.call(ge), le = Y == null ? void 0 : Y.localParticipant;
2852
- if (le != null && le.publishData)
2888
+ const Y = (at = (me = Pt.current) == null ? void 0 : me.getRoom) == null ? void 0 : at.call(me), ae = Y == null ? void 0 : Y.localParticipant;
2889
+ if (ae != null && ae.publishData)
2853
2890
  try {
2854
- const k = new TextEncoder().encode(JSON.stringify(g));
2855
- await le.publishData(k, { reliable: !0 });
2856
- } catch (k) {
2857
- console.warn("[AvatarWidget] sendData failed:", k);
2891
+ const L = new TextEncoder().encode(JSON.stringify(g));
2892
+ await ae.publishData(L, { reliable: !0 });
2893
+ } catch (L) {
2894
+ console.warn("[AvatarWidget] sendData failed:", L);
2858
2895
  }
2859
2896
  }
2860
2897
  }),
2861
2898
  []
2862
2899
  );
2863
- const Pt = A(null);
2864
- T(() => {
2865
- const g = w.videoElement, p = Pt.current;
2900
+ const zt = S(null);
2901
+ M(() => {
2902
+ const g = _.videoElement, p = zt.current;
2866
2903
  if (!(!g || !p))
2867
2904
  return p.appendChild(g), () => {
2868
2905
  g.parentNode === p && p.removeChild(g);
2869
2906
  };
2870
- }, [w.videoElement]), T(() => {
2871
- const g = w.audioElement;
2907
+ }, [_.videoElement]), M(() => {
2908
+ const g = _.audioElement;
2872
2909
  if (!g) return;
2873
- ke.attach(g);
2910
+ be.attach(g);
2874
2911
  const p = g.play();
2875
2912
  return p && typeof p.catch == "function" && p.catch((Y) => {
2876
- (Y == null ? void 0 : Y.name) === "NotAllowedError" && Ee(!0);
2913
+ (Y == null ? void 0 : Y.name) === "NotAllowedError" && tt(!0);
2877
2914
  }), () => {
2878
- ke.detach();
2915
+ be.detach();
2879
2916
  };
2880
- }, [w.audioElement]), T(() => {
2881
- if (w.isControlled || w.connectionState !== "connected") return;
2882
- const g = w.getRoom();
2917
+ }, [_.audioElement]), M(() => {
2918
+ if (_.isControlled || _.connectionState !== "connected") return;
2919
+ const g = _.getRoom();
2883
2920
  if (g)
2884
2921
  return G.setupMic(g).catch(() => {
2885
2922
  }), () => {
2886
2923
  G.teardownMic();
2887
2924
  };
2888
- }, [w.isControlled, w.connectionState]), T(() => {
2925
+ }, [_.isControlled, _.connectionState]), M(() => {
2889
2926
  var p;
2890
- if (w.connectionState !== "connected") return;
2891
- const g = w.isControlled ? (p = z == null ? void 0 : z.getRoom) == null ? void 0 : p.call(z) : w.getRoom();
2927
+ if (_.connectionState !== "connected") return;
2928
+ const g = _.isControlled ? (p = z == null ? void 0 : z.getRoom) == null ? void 0 : p.call(z) : _.getRoom();
2892
2929
  if (g)
2893
- return ne.attachRoom(g), Le.attachRoom(g), w.isControlled && G.attachRoom(g), Xe.refresh(), () => {
2894
- ne.teardown(), Le.teardown();
2930
+ return de.attachRoom(g), we.attachRoom(g), _.isControlled && G.attachRoom(g), Oe.refresh(), () => {
2931
+ de.teardown(), we.teardown();
2895
2932
  };
2896
- }, [w.isControlled, w.connectionState, z]), T(() => {
2897
- const g = w.audioElement;
2933
+ }, [_.isControlled, _.connectionState, z]), M(() => {
2934
+ const g = _.audioElement;
2898
2935
  g && (g.muted = He);
2899
- }, [w.audioElement, He]);
2900
- const vn = E((g) => {
2936
+ }, [_.audioElement, He]);
2937
+ const kn = E((g) => {
2901
2938
  const p = { type: "user_message", text: g };
2902
2939
  if (z != null && z.publishData) {
2903
2940
  try {
@@ -2906,347 +2943,365 @@ const Qr = /* @__PURE__ */ new Set([
2906
2943
  }
2907
2944
  return;
2908
2945
  }
2909
- const Y = w.getRoom();
2946
+ const Y = _.getRoom();
2910
2947
  if (Y)
2911
2948
  try {
2912
- const le = new TextEncoder().encode(JSON.stringify(p));
2913
- Y.localParticipant.publishData(le, { reliable: !0 });
2949
+ const ae = new TextEncoder().encode(JSON.stringify(p));
2950
+ Y.localParticipant.publishData(ae, { reliable: !0 });
2914
2951
  } catch {
2915
2952
  }
2916
- }, [w, z]), bn = E(() => {
2917
- _t((g) => !g);
2953
+ }, [_, z]), Ln = E(() => {
2954
+ gt((g) => !g);
2918
2955
  }, []);
2919
- T(() => {
2920
- $e == null || $e(w.connectionState), w.connectionState === "connected" ? De == null || De() : w.connectionState === "disconnected" && (Ae == null || Ae());
2921
- }, [w.connectionState, De, Ae, $e]), T(() => {
2922
- Pe == null || Pe(w.transcript);
2923
- }, [w.transcript, Pe]), T(() => {
2924
- Re == null || Re(w.agentState);
2925
- }, [w.agentState, Re]), T(() => {
2926
- Me.setThinking(w.agentState === "thinking");
2927
- }, [w.agentState, Me]);
2928
- const $t = A(!1);
2929
- T(() => {
2930
- w.isControlled || !_ || $t.current || _e && w.connectionState === "idle" && ($t.current = !0, w.connect());
2931
- }, [_, w.connectionState, w, _e]);
2932
- const wn = E(
2956
+ M(() => {
2957
+ Ne == null || Ne(_.connectionState), _.connectionState === "connected" ? Ce == null || Ce() : _.connectionState === "disconnected" && (Pe == null || Pe());
2958
+ }, [_.connectionState, Ce, Pe, Ne]), M(() => {
2959
+ Se == null || Se(_.transcript);
2960
+ }, [_.transcript, Se]), M(() => {
2961
+ $e == null || $e(_.agentState);
2962
+ }, [_.agentState, $e]), M(() => {
2963
+ We.setThinking(_.agentState === "thinking");
2964
+ }, [_.agentState, We]);
2965
+ const Ot = S(!1);
2966
+ M(() => {
2967
+ _.isControlled || !b || Ot.current || te && _.connectionState === "idle" && (Ot.current = !0, _.connect());
2968
+ }, [b, _.connectionState, _, te]);
2969
+ const En = E(
2933
2970
  (g) => {
2934
- const p = S == null ? void 0 : S.find((Y) => Y.id === g);
2935
- p && (de(!1), g !== ce && (ut(!0), w.disconnect(), te || Je(g), D == null || D(p)));
2971
+ const p = N == null ? void 0 : N.find((Y) => Y.id === g);
2972
+ p && (ot(!1), g !== Te && (nt(!0), _.disconnect(), Qe || ze(g), D == null || D(p)));
2936
2973
  },
2937
2974
  [
2938
- S,
2939
- ce,
2940
- w,
2941
- te,
2975
+ N,
2976
+ Te,
2977
+ _,
2978
+ Qe,
2942
2979
  D
2943
2980
  ]
2944
2981
  );
2945
- T(() => {
2946
- Oe && w.connectionState === "connected" && ut(!1);
2947
- }, [w.connectionState, Oe]), T(() => {
2948
- if (!Qe) return;
2982
+ M(() => {
2983
+ _e && _.connectionState === "connected" && nt(!1);
2984
+ }, [_.connectionState, _e]), M(() => {
2985
+ if (!rt) return;
2949
2986
  const g = (p) => {
2950
- p.key === "Escape" && de(!1);
2987
+ p.key === "Escape" && ot(!1);
2951
2988
  };
2952
2989
  return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
2953
- }, [Qe]);
2954
- const _n = !!B || !!(X != null && X.avatarImageUrl) || w.isControlled, et = Yn(Ke, l, _n);
2955
- Ge === void 0 && ((Ot = et.info) != null && Ot.capabilities) && (Et.current = et.info.capabilities);
2956
- const pt = (X == null ? void 0 : X.name) ?? q ?? ((Ht = w.agentConfig) == null ? void 0 : Ht.name) ?? ((Wt = et.info) == null ? void 0 : Wt.name) ?? "Live Layer", Ct = (X == null ? void 0 : X.avatarImageUrl) ?? B ?? ((Bt = w.agentConfig) == null ? void 0 : Bt.avatarImageUrl) ?? ((qt = et.info) == null ? void 0 : qt.avatarImageUrl) ?? null, xn = x ?? ((Ft = w.agentConfig) == null ? void 0 : Ft.idleLoopUrl) ?? ((Ut = et.info) == null ? void 0 : Ut.idleLoopUrl) ?? null, kn = R ?? null, Ln = E(() => se("expanded"), [se]), En = E(
2957
- () => se("minimized"),
2958
- [se]
2959
- ), zt = E(() => {
2960
- w.disconnect(), se("hidden");
2961
- }, [w, se]), Cn = E(() => {
2962
- const g = w.audioElement;
2963
- g && g.play().then(() => Ee(!1)).catch(() => {
2990
+ }, [rt]);
2991
+ const Cn = !!B || !!(X != null && X.avatarImageUrl) || _.isControlled, lt = Xn(mt, l, Cn);
2992
+ Xe === void 0 && ((qt = lt.info) != null && qt.capabilities) && (Ct.current = lt.info.capabilities);
2993
+ const yt = (X == null ? void 0 : X.name) ?? q ?? ((Ft = _.agentConfig) == null ? void 0 : Ft.name) ?? ((Ut = lt.info) == null ? void 0 : Ut.name) ?? "Live Layer", St = (X == null ? void 0 : X.avatarImageUrl) ?? B ?? ((jt = _.agentConfig) == null ? void 0 : jt.avatarImageUrl) ?? ((Vt = lt.info) == null ? void 0 : Vt.avatarImageUrl) ?? null, Sn = x ?? ((Yt = _.agentConfig) == null ? void 0 : Yt.idleLoopUrl) ?? ((Gt = lt.info) == null ? void 0 : Gt.idleLoopUrl) ?? null, Nn = R ?? null, An = E(() => re("expanded"), [re]), Rn = E(
2994
+ () => re("minimized"),
2995
+ [re]
2996
+ ), Ht = E(() => {
2997
+ _.disconnect(), re("hidden");
2998
+ }, [_, re]), In = E(() => {
2999
+ const g = _.audioElement;
3000
+ g && g.play().then(() => tt(!1)).catch(() => {
2964
3001
  });
2965
- }, [w.audioElement]), Sn = E(() => {
2966
- Ee(!1), w.connect();
2967
- }, [w]), tt = {
2968
- ...dt,
2969
- ...ze ? {} : { zIndex: vt }
3002
+ }, [_.audioElement]), Mn = E(() => {
3003
+ tt(!1), _.connect();
3004
+ }, [_]), Be = {
3005
+ ...xt,
3006
+ ...et ? {} : { zIndex: Ie }
2970
3007
  };
2971
- N.primaryColor && (tt["--ll-color-primary"] = N.primaryColor), N.accentColor && (tt["--ll-color-accent"] = N.accentColor), N.backgroundColor && (tt["--ll-color-bg"] = N.backgroundColor), N.textColor && (tt["--ll-color-fg"] = N.textColor);
2972
- const Nn = [
3008
+ A.primaryColor && (Be["--ll-color-primary"] = A.primaryColor), A.accentColor && (Be["--ll-color-accent"] = A.accentColor), A.backgroundColor && (Be["--ll-color-bg"] = A.backgroundColor), A.textColor && (Be["--ll-color-fg"] = A.textColor);
3009
+ const Tn = [
2973
3010
  "ll-widget",
2974
- `ll-widget--${xe}`,
2975
- `ll-widget--${me ? "mobile" : "desktop"}`,
2976
- st
3011
+ `ll-widget--${ne}`,
3012
+ `ll-widget--${se ? "mobile" : "desktop"}`,
3013
+ ht
2977
3014
  ].filter(Boolean).join(" ");
2978
- return _e ? /* @__PURE__ */ v(
3015
+ if (!te) return null;
3016
+ const Dn = /* @__PURE__ */ n(
2979
3017
  "div",
2980
3018
  {
2981
- className: Nn,
2982
- style: tt,
2983
- "data-display-mode": xe,
2984
- "data-position": L,
3019
+ className: Tn,
3020
+ style: Be,
3021
+ "data-display-mode": ne,
3022
+ "data-position": k,
2985
3023
  "data-experience-mode": f === "EMBEDDED" ? "embedded" : "widget",
3024
+ children: ne === "expanded" && /* @__PURE__ */ n(
3025
+ Ir,
3026
+ {
3027
+ position: k,
3028
+ isMobile: se,
3029
+ agentName: yt,
3030
+ avatarImageUrl: St,
3031
+ idleLoopUrl: Sn,
3032
+ greeting: Nn,
3033
+ branding: A,
3034
+ teamMembers: N,
3035
+ currentTeamMemberId: Te,
3036
+ isSwitchingTeamMember: _e,
3037
+ teamSwitcherOpen: rt,
3038
+ onToggleTeamSwitcher: () => ot((g) => !g),
3039
+ onSelectTeamMember: En,
3040
+ connectionState: _.connectionState,
3041
+ agentState: _.agentState,
3042
+ transcript: _.transcript,
3043
+ isMuted: G.isMuted,
3044
+ micDevices: Oe.mics,
3045
+ activeMicId: G.activeDeviceId,
3046
+ isCameraEnabled: de.isEnabled,
3047
+ cameraPreviewEl: de.previewEl,
3048
+ cameraDevices: Oe.cameras,
3049
+ activeCameraId: de.activeDeviceId,
3050
+ isScreenShareEnabled: we.isEnabled,
3051
+ screenPreviewEl: we.previewEl,
3052
+ isSpeakerMuted: He,
3053
+ allowCamera: T,
3054
+ allowScreenShare: F,
3055
+ allowTyping: oe,
3056
+ showMinimize: ie,
3057
+ chromeless: Z,
3058
+ compactControls: fe,
3059
+ transforming: ye,
3060
+ transformingLabel: pe,
3061
+ languageMenuOpen: xe,
3062
+ onToggleLanguageMenu: () => ke((g) => !g),
3063
+ needsUserGesture: kt,
3064
+ canResume: _.canResume,
3065
+ micError: G.micError,
3066
+ error: _.error,
3067
+ avatarVideoContainerRef: zt,
3068
+ agentVideoEl: _.videoElement,
3069
+ onConnect: () => void _.connect(),
3070
+ onDisconnect: () => _.disconnect(),
3071
+ onRetry: Mn,
3072
+ onResumeAudio: In,
3073
+ onToggleMute: G.toggleMute,
3074
+ onSwitchMicDevice: (g) => void G.switchDevice(g),
3075
+ onToggleCamera: () => void de.toggle(),
3076
+ onSwitchCameraDevice: (g) => void de.switchDevice(g),
3077
+ onToggleScreenShare: () => void we.toggle(),
3078
+ onToggleSpeaker: Ln,
3079
+ onSendMessage: kn,
3080
+ onMinimize: Rn,
3081
+ onClose: Ht,
3082
+ onClearMicError: G.clearError
3083
+ }
3084
+ )
3085
+ }
3086
+ ), Wt = ne === "hidden" || ne === "minimized" ? /* @__PURE__ */ y(
3087
+ "div",
3088
+ {
3089
+ className: [
3090
+ "ll-widget",
3091
+ "ll-widget--floating",
3092
+ `ll-widget--${ne}`,
3093
+ `ll-widget--${se ? "mobile" : "desktop"}`
3094
+ ].join(" "),
3095
+ style: Be,
3096
+ "data-display-mode": ne,
3097
+ "data-position": k,
2986
3098
  children: [
2987
- xe === "hidden" && /* @__PURE__ */ n(
2988
- vr,
3099
+ ne === "hidden" && /* @__PURE__ */ n(
3100
+ xr,
2989
3101
  {
2990
- position: L,
2991
- isMobile: me,
2992
- isSpeaking: w.agentState === "speaking",
2993
- onExpand: () => se("expanded"),
2994
- label: `Open ${pt} widget`,
2995
- avatarImageUrl: Ct,
2996
- agentName: pt
2997
- }
2998
- ),
2999
- xe === "minimized" && /* @__PURE__ */ n(
3000
- wr,
3001
- {
3002
- position: L,
3003
- isMobile: me,
3004
- agentName: pt,
3005
- avatarImageUrl: Ct,
3006
- agentState: w.agentState,
3007
- isMuted: G.isMuted,
3008
- audioLevel: ke,
3009
- onExpand: Ln,
3010
- onToggleMute: G.toggleMute,
3011
- onClose: zt
3102
+ position: k,
3103
+ isMobile: se,
3104
+ isSpeaking: _.agentState === "speaking",
3105
+ onExpand: () => re("expanded"),
3106
+ label: `Open ${yt} widget`,
3107
+ avatarImageUrl: St,
3108
+ agentName: yt
3012
3109
  }
3013
3110
  ),
3014
- xe === "expanded" && /* @__PURE__ */ n(
3015
- Sr,
3111
+ ne === "minimized" && /* @__PURE__ */ n(
3112
+ Lr,
3016
3113
  {
3017
- position: L,
3018
- isMobile: me,
3019
- agentName: pt,
3020
- avatarImageUrl: Ct,
3021
- idleLoopUrl: xn,
3022
- greeting: kn,
3023
- branding: N,
3024
- teamMembers: S,
3025
- currentTeamMemberId: ce,
3026
- isSwitchingTeamMember: Oe,
3027
- teamSwitcherOpen: Qe,
3028
- onToggleTeamSwitcher: () => de((g) => !g),
3029
- onSelectTeamMember: wn,
3030
- connectionState: w.connectionState,
3031
- agentState: w.agentState,
3032
- transcript: w.transcript,
3114
+ position: k,
3115
+ isMobile: se,
3116
+ agentName: yt,
3117
+ avatarImageUrl: St,
3118
+ agentState: _.agentState,
3033
3119
  isMuted: G.isMuted,
3034
- micDevices: Xe.mics,
3035
- activeMicId: G.activeDeviceId,
3036
- isCameraEnabled: ne.isEnabled,
3037
- cameraPreviewEl: ne.previewEl,
3038
- cameraDevices: Xe.cameras,
3039
- activeCameraId: ne.activeDeviceId,
3040
- isScreenShareEnabled: Le.isEnabled,
3041
- screenPreviewEl: Le.previewEl,
3042
- isSpeakerMuted: He,
3043
- allowCamera: M,
3044
- allowScreenShare: F,
3045
- allowTyping: re,
3046
- showMinimize: ie,
3047
- chromeless: Z,
3048
- compactControls: ae,
3049
- transforming: fe,
3050
- transformingLabel: ve,
3051
- languageMenuOpen: Ce,
3052
- onToggleLanguageMenu: () => ft((g) => !g),
3053
- needsUserGesture: wt,
3054
- canResume: w.canResume,
3055
- micError: G.micError,
3056
- error: w.error,
3057
- avatarVideoContainerRef: Pt,
3058
- agentVideoEl: w.videoElement,
3059
- onConnect: () => void w.connect(),
3060
- onDisconnect: () => w.disconnect(),
3061
- onRetry: Sn,
3062
- onResumeAudio: Cn,
3120
+ audioLevel: be,
3121
+ onExpand: An,
3063
3122
  onToggleMute: G.toggleMute,
3064
- onSwitchMicDevice: (g) => void G.switchDevice(g),
3065
- onToggleCamera: () => void ne.toggle(),
3066
- onSwitchCameraDevice: (g) => void ne.switchDevice(g),
3067
- onToggleScreenShare: () => void Le.toggle(),
3068
- onToggleSpeaker: bn,
3069
- onSendMessage: vn,
3070
- onMinimize: En,
3071
- onClose: zt,
3072
- onClearMicError: G.clearError
3123
+ onClose: Ht
3073
3124
  }
3074
3125
  )
3075
3126
  ]
3076
3127
  }
3077
- ) : null;
3128
+ ) : null, Bt = ce ?? (typeof document < "u" ? document.body : null);
3129
+ return /* @__PURE__ */ y(Ve, { children: [
3130
+ Dn,
3131
+ Wt && Bt && Rt(Wt, Bt)
3132
+ ] });
3078
3133
  }
3079
3134
  );
3080
- yn.displayName = "AvatarWidgetInner";
3081
- const Zr = lt(
3135
+ xn.displayName = "AvatarWidgetInner";
3136
+ const ro = dt(
3082
3137
  function(t, r) {
3083
- return /* @__PURE__ */ n(Hn, { children: /* @__PURE__ */ n(yn, { ...t, ref: r }) });
3138
+ return /* @__PURE__ */ n(Fn, { children: /* @__PURE__ */ n(xn, { ...t, ref: r }) });
3084
3139
  }
3085
3140
  );
3086
- Zr.displayName = "AvatarWidget";
3087
- const ci = ({
3141
+ ro.displayName = "AvatarWidget";
3142
+ const ho = ({
3088
3143
  agentId: e,
3089
3144
  baseUrl: t,
3090
3145
  apiKey: r,
3091
- mode: i,
3092
- onAgentEvent: o,
3146
+ mode: o,
3147
+ onAgentEvent: i,
3093
3148
  className: l,
3094
- style: s
3149
+ style: d
3095
3150
  }) => {
3096
- const a = A(null), d = A(null), f = A(o);
3097
- f.current = o;
3098
- const _ = E((u) => {
3151
+ const a = S(null), s = S(null), f = S(i);
3152
+ f.current = i;
3153
+ const b = E((u) => {
3099
3154
  var I;
3100
3155
  const c = u.detail;
3101
3156
  (I = f.current) == null || I.call(f, c);
3102
3157
  }, []);
3103
- return T(() => {
3158
+ return M(() => {
3104
3159
  const u = a.current;
3105
3160
  if (!u) return;
3106
3161
  const c = document.createElement("livelayer-widget");
3107
- return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), i && c.setAttribute("mode", i), c.addEventListener("agent-event", _), u.appendChild(c), d.current = c, () => {
3108
- c.removeEventListener("agent-event", _), u.removeChild(c), d.current = null;
3162
+ 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", b), u.appendChild(c), s.current = c, () => {
3163
+ c.removeEventListener("agent-event", b), u.removeChild(c), s.current = null;
3109
3164
  };
3110
- }, [e]), T(() => {
3111
- d.current && (i ? d.current.setAttribute("mode", i) : d.current.removeAttribute("mode"));
3112
- }, [i]), /* @__PURE__ */ n("div", { ref: a, className: l, style: s });
3113
- }, si = lt(
3114
- function({ id: t, intent: r, as: i = "div", className: o, style: l, children: s }, a) {
3115
- return Dn(
3116
- i,
3165
+ }, [e]), M(() => {
3166
+ s.current && (o ? s.current.setAttribute("mode", o) : s.current.removeAttribute("mode"));
3167
+ }, [o]), /* @__PURE__ */ n("div", { ref: a, className: l, style: d });
3168
+ }, mo = dt(
3169
+ function({ id: t, intent: r, as: o = "div", className: i, style: l, children: d }, a) {
3170
+ return Hn(
3171
+ o,
3117
3172
  {
3118
3173
  ref: a,
3119
3174
  "data-ll-region": t,
3120
3175
  "data-ll-intent": r,
3121
- className: o,
3176
+ className: i,
3122
3177
  style: l
3123
3178
  },
3124
- s
3179
+ d
3125
3180
  );
3126
3181
  }
3127
- ), di = lt(
3128
- function({ id: t, intent: r, children: i, ...o }, l) {
3182
+ ), go = dt(
3183
+ function({ id: t, intent: r, children: o, ...i }, l) {
3129
3184
  return /* @__PURE__ */ n(
3130
3185
  "form",
3131
3186
  {
3132
3187
  ref: l,
3133
3188
  "data-ll-form": t,
3134
3189
  "data-ll-intent": r,
3135
- ...o,
3136
- children: i
3190
+ ...i,
3191
+ children: o
3137
3192
  }
3138
3193
  );
3139
3194
  }
3140
- ), ui = lt(
3195
+ ), yo = dt(
3141
3196
  function(t, r) {
3142
- const { name: i, label: o, labelClassName: l } = t, s = { name: i, "data-ll-field": i };
3197
+ const { name: o, label: i, labelClassName: l } = t, d = { name: o, "data-ll-field": o };
3143
3198
  let a;
3144
3199
  if ("as" in t && t.as === "textarea") {
3145
- const { name: d, label: f, labelClassName: _, as: u, ...c } = t;
3200
+ const { name: s, label: f, labelClassName: b, as: u, ...c } = t;
3146
3201
  a = /* @__PURE__ */ n(
3147
3202
  "textarea",
3148
3203
  {
3149
3204
  ref: r,
3150
- ...s,
3205
+ ...d,
3151
3206
  ...c
3152
3207
  }
3153
3208
  );
3154
3209
  } else if ("as" in t && t.as === "select") {
3155
- const { name: d, label: f, labelClassName: _, as: u, children: c, ...I } = t;
3210
+ const { name: s, label: f, labelClassName: b, as: u, children: c, ...I } = t;
3156
3211
  a = /* @__PURE__ */ n(
3157
3212
  "select",
3158
3213
  {
3159
3214
  ref: r,
3160
- ...s,
3215
+ ...d,
3161
3216
  ...I,
3162
3217
  children: c
3163
3218
  }
3164
3219
  );
3165
3220
  } else {
3166
- const { name: d, label: f, labelClassName: _, as: u, ...c } = t;
3221
+ const { name: s, label: f, labelClassName: b, as: u, ...c } = t;
3167
3222
  a = /* @__PURE__ */ n(
3168
3223
  "input",
3169
3224
  {
3170
3225
  ref: r,
3171
- ...s,
3226
+ ...d,
3172
3227
  ...c
3173
3228
  }
3174
3229
  );
3175
3230
  }
3176
- return o === void 0 ? a : /* @__PURE__ */ v("label", { className: l, children: [
3177
- o,
3231
+ return i === void 0 ? a : /* @__PURE__ */ y("label", { className: l, children: [
3232
+ i,
3178
3233
  a
3179
3234
  ] });
3180
3235
  }
3181
3236
  );
3182
- let sn = 1;
3183
- function fi({
3237
+ let pn = 1;
3238
+ function vo({
3184
3239
  onMount: e,
3185
3240
  defaultOpen: t = !1,
3186
3241
  storageKey: r = "ll-debug-open"
3187
3242
  }) {
3188
- const [i, o] = C(t), [l, s] = C([]), [a, d] = C(""), [f, _] = C(!1), u = A(/* @__PURE__ */ new Set()), c = A([]), I = A(f);
3189
- I.current = f, T(() => {
3243
+ const [o, i] = C(t), [l, d] = C([]), [a, s] = C(""), [f, b] = C(!1), u = S(/* @__PURE__ */ new Set()), c = S([]), I = S(f);
3244
+ I.current = f, M(() => {
3190
3245
  try {
3191
- const y = localStorage.getItem(r);
3192
- y === "1" && o(!0), y === "0" && o(!1);
3246
+ const v = localStorage.getItem(r);
3247
+ v === "1" && i(!0), v === "0" && i(!1);
3193
3248
  } catch {
3194
3249
  }
3195
- }, [r]), T(() => {
3250
+ }, [r]), M(() => {
3196
3251
  try {
3197
- localStorage.setItem(r, i ? "1" : "0");
3252
+ localStorage.setItem(r, o ? "1" : "0");
3198
3253
  } catch {
3199
3254
  }
3200
- }, [i, r]), T(() => {
3201
- const y = (m) => {
3202
- (m.metaKey || m.ctrlKey) && m.shiftKey && m.key.toLowerCase() === "l" && (m.preventDefault(), o((S) => !S));
3255
+ }, [o, r]), M(() => {
3256
+ const v = (m) => {
3257
+ (m.metaKey || m.ctrlKey) && m.shiftKey && m.key.toLowerCase() === "l" && (m.preventDefault(), i((N) => !N));
3203
3258
  };
3204
- return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
3205
- }, []), T(() => {
3206
- const y = setInterval(() => {
3259
+ return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
3260
+ }, []), M(() => {
3261
+ const v = setInterval(() => {
3207
3262
  if (c.current.length === 0 || I.current) return;
3208
3263
  const m = c.current.splice(0, c.current.length);
3209
- s(
3210
- (S) => [...m.reverse(), ...S].slice(0, 200)
3264
+ d(
3265
+ (N) => [...m.reverse(), ...N].slice(0, 200)
3211
3266
  );
3212
3267
  }, 100);
3213
- return () => clearInterval(y);
3268
+ return () => clearInterval(v);
3214
3269
  }, []);
3215
- const L = A(!1);
3216
- if (T(() => {
3217
- !e || L.current || (L.current = !0, e((y) => {
3270
+ const k = S(!1);
3271
+ if (M(() => {
3272
+ !e || k.current || (k.current = !0, e((v) => {
3218
3273
  c.current.push({
3219
- id: sn++,
3274
+ id: pn++,
3220
3275
  ts: Date.now(),
3221
3276
  kind: "event",
3222
- type: y.eventName,
3223
- data: y.data
3277
+ type: v.eventName,
3278
+ data: v.data
3224
3279
  });
3225
3280
  }));
3226
- }, [e]), T(() => {
3227
- const y = console.warn, m = console.log, S = ($, D) => function(...x) {
3281
+ }, [e]), M(() => {
3282
+ const v = console.warn, m = console.log, N = ($, D) => function(...x) {
3228
3283
  try {
3229
3284
  const R = typeof x[0] == "string" ? x[0] : "";
3230
3285
  R.startsWith("[LiveLayer]") && c.current.push({
3231
- id: sn++,
3286
+ id: pn++,
3232
3287
  ts: Date.now(),
3233
3288
  kind: $,
3234
3289
  type: R.slice(0, 120),
3235
- data: { args: x.slice(1).map((B) => ti(B)) }
3290
+ data: { args: x.slice(1).map((B) => io(B)) }
3236
3291
  });
3237
3292
  } catch {
3238
3293
  }
3239
3294
  return D.apply(this, x);
3240
3295
  };
3241
- return console.warn = S("warn", y), console.log = S("log", m), () => {
3242
- console.warn = y, console.log = m;
3296
+ return console.warn = N("warn", v), console.log = N("log", m), () => {
3297
+ console.warn = v, console.log = m;
3243
3298
  };
3244
- }, []), !i)
3299
+ }, []), !o)
3245
3300
  return /* @__PURE__ */ n(
3246
3301
  "button",
3247
3302
  {
3248
3303
  type: "button",
3249
- onClick: () => o(!0),
3304
+ onClick: () => i(!0),
3250
3305
  title: "Open LiveLayer debug panel (Cmd/Ctrl + Shift + L)",
3251
3306
  "aria-label": "Open LiveLayer debug panel",
3252
3307
  style: {
@@ -3268,12 +3323,12 @@ function fi({
3268
3323
  children: "🛰 LL debug"
3269
3324
  }
3270
3325
  );
3271
- const b = l.filter((y) => {
3326
+ const w = l.filter((v) => {
3272
3327
  if (!a) return !0;
3273
3328
  const m = a.toLowerCase();
3274
- return y.type.toLowerCase().includes(m) || JSON.stringify(y.data || {}).toLowerCase().includes(m);
3329
+ return v.type.toLowerCase().includes(m) || JSON.stringify(v.data || {}).toLowerCase().includes(m);
3275
3330
  });
3276
- return /* @__PURE__ */ v(
3331
+ return /* @__PURE__ */ y(
3277
3332
  "div",
3278
3333
  {
3279
3334
  style: {
@@ -3295,7 +3350,7 @@ function fi({
3295
3350
  overflow: "hidden"
3296
3351
  },
3297
3352
  children: [
3298
- /* @__PURE__ */ v(
3353
+ /* @__PURE__ */ y(
3299
3354
  "div",
3300
3355
  {
3301
3356
  style: {
@@ -3308,7 +3363,7 @@ function fi({
3308
3363
  },
3309
3364
  children: [
3310
3365
  /* @__PURE__ */ n("span", { style: { fontWeight: 600, fontSize: 12 }, children: "LiveLayer debug" }),
3311
- /* @__PURE__ */ v("span", { style: { fontSize: 10, color: "rgba(255,255,255,0.4)" }, children: [
3366
+ /* @__PURE__ */ y("span", { style: { fontSize: 10, color: "rgba(255,255,255,0.4)" }, children: [
3312
3367
  l.length,
3313
3368
  " event",
3314
3369
  l.length === 1 ? "" : "s"
@@ -3318,8 +3373,8 @@ function fi({
3318
3373
  "button",
3319
3374
  {
3320
3375
  type: "button",
3321
- onClick: () => _((y) => !y),
3322
- style: Nt(f ? "#f59e0b" : "transparent"),
3376
+ onClick: () => b((v) => !v),
3377
+ style: At(f ? "#f59e0b" : "transparent"),
3323
3378
  title: "Pause / resume capture",
3324
3379
  children: f ? "▶ resume" : "⏸ pause"
3325
3380
  }
@@ -3329,9 +3384,9 @@ function fi({
3329
3384
  {
3330
3385
  type: "button",
3331
3386
  onClick: () => {
3332
- s([]), c.current = [];
3387
+ d([]), c.current = [];
3333
3388
  },
3334
- style: Nt("transparent"),
3389
+ style: At("transparent"),
3335
3390
  title: "Clear buffer",
3336
3391
  children: "clear"
3337
3392
  }
@@ -3340,8 +3395,8 @@ function fi({
3340
3395
  "button",
3341
3396
  {
3342
3397
  type: "button",
3343
- onClick: () => o(!1),
3344
- style: Nt("transparent"),
3398
+ onClick: () => i(!1),
3399
+ style: At("transparent"),
3345
3400
  "aria-label": "Close",
3346
3401
  title: "Close (Cmd/Ctrl + Shift + L)",
3347
3402
  children: "✕"
@@ -3355,7 +3410,7 @@ function fi({
3355
3410
  {
3356
3411
  type: "text",
3357
3412
  value: a,
3358
- onChange: (y) => d(y.target.value),
3413
+ onChange: (v) => s(v.target.value),
3359
3414
  placeholder: "filter by type or data…",
3360
3415
  style: {
3361
3416
  margin: 8,
@@ -3377,7 +3432,7 @@ function fi({
3377
3432
  overflowY: "auto",
3378
3433
  padding: "0 8px 8px"
3379
3434
  },
3380
- children: b.length === 0 ? /* @__PURE__ */ v(
3435
+ children: w.length === 0 ? /* @__PURE__ */ y(
3381
3436
  "div",
3382
3437
  {
3383
3438
  style: {
@@ -3407,16 +3462,16 @@ function fi({
3407
3462
  )
3408
3463
  ]
3409
3464
  }
3410
- ) : b.map((y) => /* @__PURE__ */ n(
3411
- ei,
3465
+ ) : w.map((v) => /* @__PURE__ */ n(
3466
+ oo,
3412
3467
  {
3413
- entry: y,
3414
- expanded: u.current.has(y.id),
3468
+ entry: v,
3469
+ expanded: u.current.has(v.id),
3415
3470
  onToggle: () => {
3416
- u.current.has(y.id) ? u.current.delete(y.id) : u.current.add(y.id), s((m) => [...m]);
3471
+ u.current.has(v.id) ? u.current.delete(v.id) : u.current.add(v.id), d((m) => [...m]);
3417
3472
  }
3418
3473
  },
3419
- y.id
3474
+ v.id
3420
3475
  ))
3421
3476
  }
3422
3477
  )
@@ -3424,15 +3479,15 @@ function fi({
3424
3479
  }
3425
3480
  );
3426
3481
  }
3427
- function ei({
3482
+ function oo({
3428
3483
  entry: e,
3429
3484
  expanded: t,
3430
3485
  onToggle: r
3431
3486
  }) {
3432
- 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", {
3487
+ 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", {
3433
3488
  hour12: !1
3434
3489
  });
3435
- return /* @__PURE__ */ v(
3490
+ return /* @__PURE__ */ y(
3436
3491
  "button",
3437
3492
  {
3438
3493
  type: "button",
@@ -3450,7 +3505,7 @@ function ei({
3450
3505
  lineHeight: 1.4
3451
3506
  },
3452
3507
  children: [
3453
- /* @__PURE__ */ v("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
3508
+ /* @__PURE__ */ y("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
3454
3509
  /* @__PURE__ */ n(
3455
3510
  "span",
3456
3511
  {
@@ -3459,14 +3514,14 @@ function ei({
3459
3514
  fontVariantNumeric: "tabular-nums",
3460
3515
  fontSize: 10
3461
3516
  },
3462
- children: o
3517
+ children: i
3463
3518
  }
3464
3519
  ),
3465
3520
  /* @__PURE__ */ n(
3466
3521
  "span",
3467
3522
  {
3468
3523
  style: {
3469
- color: i,
3524
+ color: o,
3470
3525
  fontWeight: 600,
3471
3526
  flexShrink: 0
3472
3527
  },
@@ -3494,7 +3549,7 @@ function ei({
3494
3549
  }
3495
3550
  );
3496
3551
  }
3497
- function Nt(e) {
3552
+ function At(e) {
3498
3553
  return {
3499
3554
  background: e,
3500
3555
  color: "#fff",
@@ -3505,59 +3560,59 @@ function Nt(e) {
3505
3560
  cursor: "pointer"
3506
3561
  };
3507
3562
  }
3508
- function ti(e) {
3563
+ function io(e) {
3509
3564
  try {
3510
3565
  return e instanceof Error ? { message: e.message, stack: e.stack } : (JSON.stringify(e), e);
3511
3566
  } catch {
3512
3567
  return String(e);
3513
3568
  }
3514
3569
  }
3515
- function pi() {
3516
- const [e, t] = C([]), r = E((o) => {
3570
+ function bo() {
3571
+ const [e, t] = C([]), r = E((i) => {
3517
3572
  t((l) => {
3518
- const s = l.findIndex((a) => a.id === o.id);
3519
- if (s >= 0) {
3573
+ const d = l.findIndex((a) => a.id === i.id);
3574
+ if (d >= 0) {
3520
3575
  const a = l.slice();
3521
- return a[s] = o, a;
3576
+ return a[d] = i, a;
3522
3577
  }
3523
- return [...l, o];
3578
+ return [...l, i];
3524
3579
  });
3525
- }, []), i = E(() => t([]), []);
3580
+ }, []), o = E(() => t([]), []);
3526
3581
  return {
3527
3582
  entries: e,
3528
3583
  pushSegment: r,
3529
- clear: i,
3584
+ clear: o,
3530
3585
  latest: e.length > 0 ? e[e.length - 1] : null
3531
3586
  };
3532
3587
  }
3533
3588
  export {
3534
- Zr as AvatarWidget,
3535
- Hn as ErrorBoundary,
3536
- fi as LiveLayerDebugPanel,
3537
- ui as LiveLayerField,
3538
- di as LiveLayerForm,
3539
- si as LiveLayerRegion,
3540
- ci as LiveLayerWidget,
3541
- Or as clearPageContextCache,
3542
- Ur as clearRoutesCache,
3543
- zr as extractPageContext,
3544
- qr as extractRoutes,
3545
- an as getCachedPageContext,
3546
- St as getCachedRoutes,
3547
- cr as matchesPattern,
3548
- Wr as normalizeRouteInput,
3549
- sr as shouldRenderAtPath,
3550
- Yn as useAgentInfo,
3551
- Bn as useAudioLevel,
3552
- Un as useCameraState,
3553
- Kn as useDisplayMode,
3554
- Zn as useDisplayModePersistence,
3555
- tr as useIsMobile,
3556
- Wn as useLiveKitSession,
3557
- Vn as useMediaDevices,
3558
- qn as useMicrophoneState,
3559
- rr as usePathname,
3560
- dr as useRouteMatch,
3561
- jn as useScreenShareState,
3562
- pi as useTranscript
3589
+ ro as AvatarWidget,
3590
+ Fn as ErrorBoundary,
3591
+ vo as LiveLayerDebugPanel,
3592
+ yo as LiveLayerField,
3593
+ go as LiveLayerForm,
3594
+ mo as LiveLayerRegion,
3595
+ ho as LiveLayerWidget,
3596
+ qr as clearPageContextCache,
3597
+ Gr as clearRoutesCache,
3598
+ Br as extractPageContext,
3599
+ Vr as extractRoutes,
3600
+ un as getCachedPageContext,
3601
+ Nt as getCachedRoutes,
3602
+ fr as matchesPattern,
3603
+ Ur as normalizeRouteInput,
3604
+ pr as shouldRenderAtPath,
3605
+ Xn as useAgentInfo,
3606
+ jn as useAudioLevel,
3607
+ Gn as useCameraState,
3608
+ er as useDisplayMode,
3609
+ rr as useDisplayModePersistence,
3610
+ ir as useIsMobile,
3611
+ Un as useLiveKitSession,
3612
+ Kn as useMediaDevices,
3613
+ Vn as useMicrophoneState,
3614
+ ar as usePathname,
3615
+ hr as useRouteMatch,
3616
+ Jn as useScreenShareState,
3617
+ bo as useTranscript
3563
3618
  };