@livelayer/react 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { jsxs as k, jsx as n, Fragment as Ht } from "react/jsx-runtime";
3
- import { Component as nn, useState as C, useRef as M, useEffect as P, useCallback as x, useMemo as Ve, forwardRef as ot, createElement as rn } from "react";
4
- import { LiveKitSession as on } from "@livelayer/sdk";
5
- import { createLocalAudioTrack as ln, Track as Ot, createLocalVideoTrack as an } from "livekit-client";
6
- class cn extends nn {
2
+ import { jsxs as _, jsx as n, Fragment as qt } from "react/jsx-runtime";
3
+ import { Component as on, useState as N, useRef as I, useEffect as P, useCallback as S, useMemo as Je, forwardRef as st, createElement as ln } from "react";
4
+ import { LiveKitSession as an } from "@livelayer/sdk";
5
+ import { createLocalAudioTrack as sn, Track as Bt, createLocalVideoTrack as cn } from "livekit-client";
6
+ class dn extends on {
7
7
  constructor() {
8
8
  super(...arguments), this.state = { hasError: !1, error: null }, this.reset = () => {
9
9
  this.setState({ hasError: !1, error: null });
@@ -18,7 +18,7 @@ class cn extends nn {
18
18
  }
19
19
  render() {
20
20
  var t;
21
- return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ k("div", { className: "ll-error-boundary", role: "alert", children: [
21
+ return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ _("div", { className: "ll-error-boundary", role: "alert", children: [
22
22
  /* @__PURE__ */ n("p", { className: "ll-error-boundary__title", children: "Widget crashed" }),
23
23
  /* @__PURE__ */ n("p", { className: "ll-error-boundary__message", children: ((t = this.state.error) == null ? void 0 : t.message) || "Something went wrong." }),
24
24
  /* @__PURE__ */ n(
@@ -33,26 +33,26 @@ class cn extends nn {
33
33
  ] }) : this.props.children;
34
34
  }
35
35
  }
36
- function sn(e) {
37
- const [t, r] = C("idle"), [i, o] = C("idle"), [l, s] = C([]), [d, u] = C(null), [g, p] = C(null), [a, c] = C(null), [S, L] = C(!1), [N, H] = C(null), R = M(null), $ = M(e.onDataMessage);
38
- $.current = e.onDataMessage, P(() => {
39
- const y = {
40
- onConnectionStateChange: (w) => {
41
- r(w), w === "connected" && H(null);
36
+ function un(e) {
37
+ const [t, r] = N("idle"), [i, o] = N("idle"), [l, c] = N([]), [d, u] = N(null), [h, m] = N(null), [a, s] = N(null), [A, C] = N(!1), [R, b] = N(null), L = I(null), D = I(e.onDataMessage);
38
+ D.current = e.onDataMessage, P(() => {
39
+ const g = {
40
+ onConnectionStateChange: (x) => {
41
+ r(x), x === "connected" && b(null);
42
42
  },
43
43
  onAgentStateChange: o,
44
- onTranscript: (w) => s([...w]),
44
+ onTranscript: (x) => c([...x]),
45
45
  onAgentConfig: u,
46
- onAudioTrack: (w) => c(w),
47
- onVideoTrack: (w) => p(w),
48
- onVideoTrackRemoved: () => p(null),
49
- onError: (w) => H(w),
50
- onDataMessage: (w) => {
51
- var O;
52
- (O = $.current) == null || O.call($, w);
46
+ onAudioTrack: (x) => s(x),
47
+ onVideoTrack: (x) => m(x),
48
+ onVideoTrackRemoved: () => m(null),
49
+ onError: (x) => b(x),
50
+ onDataMessage: (x) => {
51
+ var H;
52
+ (H = D.current) == null || H.call(D, x);
53
53
  },
54
- onResumabilityChange: L
55
- }, E = new on(
54
+ onResumabilityChange: C
55
+ }, E = new an(
56
56
  {
57
57
  agentId: e.agentId,
58
58
  baseUrl: e.baseUrl,
@@ -60,11 +60,11 @@ function sn(e) {
60
60
  sessionEndpoint: e.sessionEndpoint,
61
61
  sessionBody: e.sessionBody
62
62
  },
63
- y
63
+ g
64
64
  );
65
- return R.current = E, r("idle"), o("idle"), s([]), u(null), p(null), c(null), L(!1), H(null), () => {
66
- var w;
67
- (w = E.destroy) == null || w.call(E), R.current = null;
65
+ return L.current = E, r("idle"), o("idle"), c([]), u(null), m(null), s(null), C(!1), b(null), () => {
66
+ var x;
67
+ (x = E.destroy) == null || x.call(E), L.current = null;
68
68
  };
69
69
  }, [
70
70
  e.agentId,
@@ -73,38 +73,38 @@ function sn(e) {
73
73
  e.sessionEndpoint,
74
74
  JSON.stringify(e.sessionBody ?? {})
75
75
  ]);
76
- const I = x(async () => {
77
- const y = R.current;
78
- if (y)
76
+ const M = S(async () => {
77
+ const g = L.current;
78
+ if (g)
79
79
  try {
80
- await y.connect();
80
+ await g.connect();
81
81
  } catch (E) {
82
- throw H(E instanceof Error ? E.message : String(E)), E;
82
+ throw b(E instanceof Error ? E.message : String(E)), E;
83
83
  }
84
- }, []), D = x(() => {
85
- const y = R.current;
86
- y && y.disconnect();
87
- }, []), m = x(() => {
88
- var y;
89
- return ((y = R.current) == null ? void 0 : y.getRoom()) ?? null;
84
+ }, []), z = S(() => {
85
+ const g = L.current;
86
+ g && g.disconnect();
87
+ }, []), p = S(() => {
88
+ var g;
89
+ return ((g = L.current) == null ? void 0 : g.getRoom()) ?? null;
90
90
  }, []);
91
91
  return {
92
92
  connectionState: t,
93
93
  agentState: i,
94
94
  transcript: l,
95
95
  agentConfig: d,
96
- videoElement: g,
96
+ videoElement: h,
97
97
  audioElement: a,
98
- canResume: S,
99
- error: N,
100
- connect: I,
101
- disconnect: D,
102
- getRoom: m,
103
- session: R.current
98
+ canResume: A,
99
+ error: R,
100
+ connect: M,
101
+ disconnect: z,
102
+ getRoom: p,
103
+ session: L.current
104
104
  };
105
105
  }
106
- function dn() {
107
- const e = M(null), t = M(null), r = M(null), i = M(null), o = M(/* @__PURE__ */ new Set()), l = M(null), s = x(() => {
106
+ function fn() {
107
+ const e = I(null), t = I(null), r = I(null), i = I(null), o = I(/* @__PURE__ */ new Set()), l = I(null), c = S(() => {
108
108
  const a = t.current;
109
109
  if (!a) {
110
110
  i.current = null;
@@ -113,23 +113,23 @@ function dn() {
113
113
  (!l.current || l.current.length !== a.frequencyBinCount) && (l.current = new Uint8Array(
114
114
  new ArrayBuffer(a.frequencyBinCount)
115
115
  ));
116
- const c = l.current;
117
- a.getByteFrequencyData(c);
118
- let S = 0;
119
- for (let N = 0; N < c.length; N++) S += c[N];
120
- const L = S / c.length / 255;
121
- for (const N of o.current)
116
+ const s = l.current;
117
+ a.getByteFrequencyData(s);
118
+ let A = 0;
119
+ for (let R = 0; R < s.length; R++) A += s[R];
120
+ const C = A / s.length / 255;
121
+ for (const R of o.current)
122
122
  try {
123
- N(L);
124
- } catch (H) {
125
- console.error("[useAudioLevel] subscriber threw:", H);
123
+ R(C);
124
+ } catch (b) {
125
+ console.error("[useAudioLevel] subscriber threw:", b);
126
126
  }
127
- i.current = requestAnimationFrame(s);
128
- }, []), d = x(() => {
127
+ i.current = requestAnimationFrame(c);
128
+ }, []), d = S(() => {
129
129
  if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
130
- const a = new AudioContext(), c = a.createAnalyser();
131
- c.fftSize = 64, c.connect(a.destination), e.current = a, t.current = c;
132
- }, []), u = x(
130
+ const a = new AudioContext(), s = a.createAnalyser();
131
+ s.fftSize = 64, s.connect(a.destination), e.current = a, t.current = s;
132
+ }, []), u = S(
133
133
  (a) => {
134
134
  if (d(), !(!e.current || !t.current)) {
135
135
  if (r.current) {
@@ -140,17 +140,17 @@ function dn() {
140
140
  r.current = null;
141
141
  }
142
142
  try {
143
- const c = e.current.createMediaElementSource(a);
144
- c.connect(t.current), r.current = c;
145
- } catch (c) {
146
- console.warn("[useAudioLevel] createMediaElementSource failed:", c);
143
+ const s = e.current.createMediaElementSource(a);
144
+ s.connect(t.current), r.current = s;
145
+ } catch (s) {
146
+ console.warn("[useAudioLevel] createMediaElementSource failed:", s);
147
147
  return;
148
148
  }
149
- i.current === null && (i.current = requestAnimationFrame(s));
149
+ i.current === null && (i.current = requestAnimationFrame(c));
150
150
  }
151
151
  },
152
- [d, s]
153
- ), g = x(() => {
152
+ [d, c]
153
+ ), h = S(() => {
154
154
  if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), r.current) {
155
155
  try {
156
156
  r.current.disconnect();
@@ -158,11 +158,11 @@ function dn() {
158
158
  }
159
159
  r.current = null;
160
160
  }
161
- }, []), p = x((a) => (o.current.add(a), () => {
161
+ }, []), m = S((a) => (o.current.add(a), () => {
162
162
  o.current.delete(a);
163
163
  }), []);
164
164
  return P(() => () => {
165
- if (g(), t.current) {
165
+ if (h(), t.current) {
166
166
  try {
167
167
  t.current.disconnect();
168
168
  } catch {
@@ -177,10 +177,10 @@ function dn() {
177
177
  e.current = null;
178
178
  }
179
179
  o.current.clear(), l.current = null;
180
- }, [g]), { attach: u, detach: g, subscribe: p };
180
+ }, [h]), { attach: u, detach: h, subscribe: m };
181
181
  }
182
- function un() {
183
- const [e, t] = C(!1), [r, i] = C(null), o = M(null), l = M(null), s = x(async (p) => {
182
+ function pn() {
183
+ const [e, t] = N(!1), [r, i] = N(null), o = I(null), l = I(null), c = S(async (m) => {
184
184
  if (o.current && l.current) {
185
185
  try {
186
186
  await l.current.localParticipant.unpublishTrack(o.current);
@@ -188,111 +188,111 @@ function un() {
188
188
  }
189
189
  o.current.stop(), o.current = null;
190
190
  }
191
- l.current = p, i(null);
191
+ l.current = m, i(null);
192
192
  try {
193
- const a = await ln({
193
+ const a = await sn({
194
194
  echoCancellation: !0,
195
195
  noiseSuppression: !0
196
196
  });
197
- await p.localParticipant.publishTrack(a), o.current = a, t(a.isMuted);
197
+ await m.localParticipant.publishTrack(a), o.current = a, t(a.isMuted);
198
198
  } catch (a) {
199
- const c = a instanceof Error && a.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
200
- throw i(c), a;
199
+ const s = a instanceof Error && a.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
200
+ throw i(s), a;
201
201
  }
202
- }, []), d = x(() => {
203
- const p = o.current;
204
- p && (p.isMuted ? (p.unmute(), t(!1)) : (p.mute(), t(!0)));
205
- }, []), u = x(() => {
206
- const p = o.current, a = l.current;
207
- if (p && a) {
202
+ }, []), d = S(() => {
203
+ const m = o.current;
204
+ m && (m.isMuted ? (m.unmute(), t(!1)) : (m.mute(), t(!0)));
205
+ }, []), u = S(() => {
206
+ const m = o.current, a = l.current;
207
+ if (m && a) {
208
208
  try {
209
- a.localParticipant.unpublishTrack(p);
209
+ a.localParticipant.unpublishTrack(m);
210
210
  } catch {
211
211
  }
212
- p.stop();
212
+ m.stop();
213
213
  }
214
214
  o.current = null, l.current = null, t(!1);
215
- }, []), g = x(() => i(null), []);
215
+ }, []), h = S(() => i(null), []);
216
216
  return {
217
217
  isMuted: e,
218
218
  micError: r,
219
219
  toggleMute: d,
220
- setupMic: s,
220
+ setupMic: c,
221
221
  teardownMic: u,
222
- clearError: g
222
+ clearError: h
223
223
  };
224
224
  }
225
- const fn = { resolution: { width: 640, height: 480, frameRate: 24 } };
226
- function pn() {
227
- const [e, t] = C(!1), [r, i] = C(null), [o, l] = C(null), [s, d] = C(""), u = M(null), g = M(null), p = x((R) => {
228
- u.current = R;
229
- }, []), a = x(() => {
230
- const R = u.current, $ = g.current;
231
- if ($ && R) {
232
- const I = R.localParticipant.getTrackPublication(Ot.Source.Camera);
233
- if (I != null && I.track) {
225
+ const hn = { resolution: { width: 640, height: 480, frameRate: 24 } };
226
+ function mn() {
227
+ const [e, t] = N(!1), [r, i] = N(null), [o, l] = N(null), [c, d] = N(""), u = I(null), h = I(null), m = S((L) => {
228
+ u.current = L;
229
+ }, []), a = S(() => {
230
+ const L = u.current, D = h.current;
231
+ if (D && L) {
232
+ const M = L.localParticipant.getTrackPublication(Bt.Source.Camera);
233
+ if (M != null && M.track) {
234
234
  try {
235
- R.localParticipant.unpublishTrack(I.track);
235
+ L.localParticipant.unpublishTrack(M.track);
236
236
  } catch {
237
237
  }
238
- I.track.stop();
238
+ M.track.stop();
239
239
  } else
240
- $.stop();
240
+ D.stop();
241
241
  }
242
- g.current = null, l(null), t(!1);
243
- }, []), c = x(async (R) => {
244
- const $ = u.current;
245
- if ($) {
242
+ h.current = null, l(null), t(!1);
243
+ }, []), s = S(async (L) => {
244
+ const D = u.current;
245
+ if (D) {
246
246
  i(null);
247
247
  try {
248
- const I = { ...fn };
249
- R && (I.deviceId = R);
250
- const D = await an(I);
251
- await $.localParticipant.publishTrack(D), g.current = D;
252
- const m = D.attach();
253
- l(m), t(!0), R && d(R);
248
+ const M = { ...hn };
249
+ L && (M.deviceId = L);
250
+ const z = await cn(M);
251
+ await D.localParticipant.publishTrack(z), h.current = z;
252
+ const p = z.attach();
253
+ l(p), t(!0), L && d(L);
254
254
  try {
255
- $.localParticipant.publishData(
255
+ D.localParticipant.publishData(
256
256
  new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
257
257
  { reliable: !0 }
258
258
  );
259
259
  } catch {
260
260
  }
261
- } catch (I) {
262
- const D = I instanceof Error && I.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
263
- i(D);
261
+ } catch (M) {
262
+ const z = M instanceof Error && M.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
263
+ i(z);
264
264
  }
265
265
  }
266
- }, []), S = x(async () => {
267
- e ? a() : await c(s || void 0);
268
- }, [e, s, a, c]), L = x(async (R) => {
269
- a(), await c(R);
270
- }, [a, c]), N = x(() => {
266
+ }, []), A = S(async () => {
267
+ e ? a() : await s(c || void 0);
268
+ }, [e, c, a, s]), C = S(async (L) => {
269
+ a(), await s(L);
270
+ }, [a, s]), R = S(() => {
271
271
  a(), u.current = null, i(null), d("");
272
- }, [a]), H = x(() => i(null), []);
272
+ }, [a]), b = S(() => i(null), []);
273
273
  return P(() => () => {
274
- g.current && g.current.stop();
274
+ h.current && h.current.stop();
275
275
  }, []), {
276
276
  isEnabled: e,
277
277
  error: r,
278
278
  previewEl: o,
279
- activeDeviceId: s,
280
- toggle: S,
281
- switchDevice: L,
282
- attachRoom: p,
283
- teardown: N,
284
- clearError: H
279
+ activeDeviceId: c,
280
+ toggle: A,
281
+ switchDevice: C,
282
+ attachRoom: m,
283
+ teardown: R,
284
+ clearError: b
285
285
  };
286
286
  }
287
- function hn() {
288
- const [e, t] = C(!1), [r, i] = C(null), [o, l] = C(null), s = M(null), d = x((c) => {
289
- s.current = c;
290
- }, []), u = x(() => l(null), []), g = x(async () => {
291
- const c = s.current;
292
- if (c) {
287
+ function gn() {
288
+ const [e, t] = N(!1), [r, i] = N(null), [o, l] = N(null), c = I(null), d = S((s) => {
289
+ c.current = s;
290
+ }, []), u = S(() => l(null), []), h = S(async () => {
291
+ const s = c.current;
292
+ if (s) {
293
293
  if (e) {
294
294
  try {
295
- await c.localParticipant.setScreenShareEnabled(!1);
295
+ await s.localParticipant.setScreenShareEnabled(!1);
296
296
  } catch {
297
297
  }
298
298
  u(), t(!1);
@@ -300,15 +300,15 @@ function hn() {
300
300
  }
301
301
  i(null);
302
302
  try {
303
- await c.localParticipant.setScreenShareEnabled(!0);
304
- let S = 0;
305
- const L = () => {
306
- const N = c.localParticipant.getTrackPublication(Ot.Source.ScreenShare);
307
- if (N != null && N.track) {
308
- const H = N.track.attach();
309
- l(H), t(!0);
303
+ await s.localParticipant.setScreenShareEnabled(!0);
304
+ let A = 0;
305
+ const C = () => {
306
+ const R = s.localParticipant.getTrackPublication(Bt.Source.ScreenShare);
307
+ if (R != null && R.track) {
308
+ const b = R.track.attach();
309
+ l(b), t(!0);
310
310
  try {
311
- c.localParticipant.publishData(
311
+ s.localParticipant.publishData(
312
312
  new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
313
313
  { reliable: !0 }
314
314
  );
@@ -316,31 +316,31 @@ function hn() {
316
316
  }
317
317
  return;
318
318
  }
319
- S++ < 10 ? setTimeout(L, 100) : t(!0);
319
+ A++ < 10 ? setTimeout(C, 100) : t(!0);
320
320
  };
321
- L();
322
- } catch (S) {
323
- const L = S instanceof Error ? S.name : "";
324
- L !== "NotAllowedError" && L !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
321
+ C();
322
+ } catch (A) {
323
+ const C = A instanceof Error ? A.name : "";
324
+ C !== "NotAllowedError" && C !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
325
325
  }
326
326
  }
327
- }, [e, u]), p = x(() => {
328
- const c = s.current;
329
- if (c && e)
327
+ }, [e, u]), m = S(() => {
328
+ const s = c.current;
329
+ if (s && e)
330
330
  try {
331
- c.localParticipant.setScreenShareEnabled(!1);
331
+ s.localParticipant.setScreenShareEnabled(!1);
332
332
  } catch {
333
333
  }
334
- u(), t(!1), i(null), s.current = null;
335
- }, [e, u]), a = x(() => i(null), []);
336
- return { isEnabled: e, error: r, previewEl: o, toggle: g, attachRoom: d, teardown: p, clearError: a };
334
+ u(), t(!1), i(null), c.current = null;
335
+ }, [e, u]), a = S(() => i(null), []);
336
+ return { isEnabled: e, error: r, previewEl: o, toggle: h, attachRoom: d, teardown: m, clearError: a };
337
337
  }
338
- function mn() {
339
- const [e, t] = C([]), [r, i] = C([]), o = x(async () => {
338
+ function yn() {
339
+ const [e, t] = N([]), [r, i] = N([]), o = S(async () => {
340
340
  if (!(typeof navigator > "u" || !navigator.mediaDevices))
341
341
  try {
342
342
  const l = await navigator.mediaDevices.enumerateDevices();
343
- t(l.filter((s) => s.kind === "audioinput")), i(l.filter((s) => s.kind === "videoinput"));
343
+ t(l.filter((c) => c.kind === "audioinput")), i(l.filter((c) => c.kind === "videoinput"));
344
344
  } catch {
345
345
  }
346
346
  }, []);
@@ -350,30 +350,30 @@ function mn() {
350
350
  return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
351
351
  }, [o]), { mics: e, cameras: r, refresh: o };
352
352
  }
353
- function gn(e, t, r = !1) {
354
- const [i, o] = C(null), [l, s] = C(null), [d, u] = C(!r && !!e);
353
+ function vn(e, t, r = !1) {
354
+ const [i, o] = N(null), [l, c] = N(null), [d, u] = N(!r && !!e);
355
355
  return P(() => {
356
356
  if (r || !e) {
357
357
  u(!1);
358
358
  return;
359
359
  }
360
- const g = new AbortController(), p = t || "https://app.livelayer.studio";
361
- return u(!0), s(null), fetch(`${p}/api/widget/agent/${encodeURIComponent(e)}`, {
362
- signal: g.signal
360
+ const h = new AbortController(), m = t || "https://app.livelayer.studio";
361
+ return u(!0), c(null), fetch(`${m}/api/widget/agent/${encodeURIComponent(e)}`, {
362
+ signal: h.signal
363
363
  }).then(async (a) => {
364
364
  if (!a.ok) {
365
- const c = await a.json().catch(() => ({}));
366
- throw new Error(c.error || `HTTP ${a.status}`);
365
+ const s = await a.json().catch(() => ({}));
366
+ throw new Error(s.error || `HTTP ${a.status}`);
367
367
  }
368
368
  return a.json();
369
369
  }).then((a) => {
370
- g.signal.aborted || (o(a), u(!1));
370
+ h.signal.aborted || (o(a), u(!1));
371
371
  }).catch((a) => {
372
- g.signal.aborted || (s(a instanceof Error ? a.message : "Agent lookup failed"), u(!1));
373
- }), () => g.abort();
372
+ h.signal.aborted || (c(a instanceof Error ? a.message : "Agent lookup failed"), u(!1));
373
+ }), () => h.abort();
374
374
  }, [e, t, r]), { info: i, error: l, loading: d };
375
375
  }
376
- function yn(e) {
376
+ function bn(e) {
377
377
  if (typeof window > "u") return null;
378
378
  try {
379
379
  return window.localStorage.getItem(e);
@@ -381,53 +381,53 @@ function yn(e) {
381
381
  return null;
382
382
  }
383
383
  }
384
- function vn(e, t) {
384
+ function wn(e, t) {
385
385
  if (!(typeof window > "u"))
386
386
  try {
387
387
  window.localStorage.setItem(e, t);
388
388
  } catch {
389
389
  }
390
390
  }
391
- function bn({
391
+ function _n({
392
392
  value: e,
393
393
  defaultValue: t = "expanded",
394
394
  onChange: r
395
395
  } = {}) {
396
- const i = e !== void 0, [o, l] = C(t), s = i ? e : o, d = x(
396
+ const i = e !== void 0, [o, l] = N(t), c = i ? e : o, d = S(
397
397
  (u) => {
398
- u !== s && (i || l(u), r == null || r(u));
398
+ u !== c && (i || l(u), r == null || r(u));
399
399
  },
400
- [s, i, r]
400
+ [c, i, r]
401
401
  );
402
- return [s, d];
402
+ return [c, d];
403
403
  }
404
- const wn = ["hidden", "minimized", "expanded"];
405
- function _n(e) {
406
- return e && wn.includes(e) ? e : null;
404
+ const xn = ["hidden", "minimized", "expanded"];
405
+ function kn(e) {
406
+ return e && xn.includes(e) ? e : null;
407
407
  }
408
- function xn({
408
+ function Ln({
409
409
  value: e,
410
410
  defaultValue: t = "expanded",
411
411
  onChange: r,
412
412
  persistKey: i = "ll-widget",
413
413
  disablePersistence: o = !1
414
414
  } = {}) {
415
- const l = `${i}:display-mode`, s = M(!1), [d, u] = bn({
415
+ const l = `${i}:display-mode`, c = I(!1), [d, u] = _n({
416
416
  value: e,
417
417
  defaultValue: t,
418
- onChange: (g) => {
419
- e === void 0 && !o && vn(l, g), r == null || r(g);
418
+ onChange: (h) => {
419
+ e === void 0 && !o && wn(l, h), r == null || r(h);
420
420
  }
421
421
  });
422
422
  return P(() => {
423
- if (s.current || (s.current = !0, o || e !== void 0)) return;
424
- const g = _n(yn(l));
425
- g && g !== d && u(g);
423
+ if (c.current || (c.current = !0, o || e !== void 0)) return;
424
+ const h = kn(bn(l));
425
+ h && h !== d && u(h);
426
426
  }, []), [d, u];
427
427
  }
428
- const kn = 640;
429
- function Ln(e = kn) {
430
- const [t, r] = C(!1);
428
+ const Sn = 640;
429
+ function Cn(e = Sn) {
430
+ const [t, r] = N(!1);
431
431
  return P(() => {
432
432
  if (e === !1) {
433
433
  r(!1);
@@ -441,67 +441,67 @@ function Ln(e = kn) {
441
441
  });
442
442
  }, [e]), t;
443
443
  }
444
- const Lt = "__llHistoryPatched", Ye = "ll:pathname";
444
+ const St = "__llHistoryPatched", Ke = "ll:pathname";
445
445
  function En() {
446
- if (typeof window > "u" || window.history[Lt]) return;
446
+ if (typeof window > "u" || window.history[St]) return;
447
447
  const e = window.history.pushState, t = window.history.replaceState;
448
448
  window.history.pushState = function(...r) {
449
449
  const i = e.apply(this, r);
450
- return window.dispatchEvent(new Event(Ye)), i;
450
+ return window.dispatchEvent(new Event(Ke)), i;
451
451
  }, window.history.replaceState = function(...r) {
452
452
  const i = t.apply(this, r);
453
- return window.dispatchEvent(new Event(Ye)), i;
454
- }, window.history[Lt] = !0;
453
+ return window.dispatchEvent(new Event(Ke)), i;
454
+ }, window.history[St] = !0;
455
455
  }
456
- function Et() {
456
+ function Ct() {
457
457
  return typeof window > "u" ? "/" : window.location.pathname || "/";
458
458
  }
459
- function Cn(e) {
460
- const [t, r] = C(
461
- () => e ?? Et()
459
+ function Nn(e) {
460
+ const [t, r] = N(
461
+ () => e ?? Ct()
462
462
  );
463
463
  return P(() => {
464
464
  if (e !== void 0) return;
465
465
  En();
466
- const i = () => r(Et());
467
- return i(), window.addEventListener("popstate", i), window.addEventListener(Ye, i), () => {
468
- window.removeEventListener("popstate", i), window.removeEventListener(Ye, i);
466
+ const i = () => r(Ct());
467
+ return i(), window.addEventListener("popstate", i), window.addEventListener(Ke, i), () => {
468
+ window.removeEventListener("popstate", i), window.removeEventListener(Ke, i);
469
469
  };
470
470
  }, [e]), e ?? t;
471
471
  }
472
- const Ct = /* @__PURE__ */ new Map(), Sn = /[\\^$+?.()|{}[\]]/g;
473
- function Nn(e) {
474
- return e.replace(Sn, "\\$&");
472
+ const Et = /* @__PURE__ */ new Map(), An = /[\\^$+?.()|{}[\]]/g;
473
+ function Rn(e) {
474
+ return e.replace(An, "\\$&");
475
475
  }
476
- function An(e) {
477
- const t = Ct.get(e);
476
+ function In(e) {
477
+ const t = Et.get(e);
478
478
  if (t) return t;
479
- const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", o = "", l = r.replace(/\*\*/g, i).replace(/\*/g, o), d = Nn(l).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(o, "g"), "[^/]+"), u = new RegExp(`^${d}\\/?$`);
480
- return Ct.set(e, u), u;
479
+ const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", o = "", l = r.replace(/\*\*/g, i).replace(/\*/g, o), d = Rn(l).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(o, "g"), "[^/]+"), u = new RegExp(`^${d}\\/?$`);
480
+ return Et.set(e, u), u;
481
481
  }
482
- function In(e, t) {
482
+ function Mn(e, t) {
483
483
  const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
484
- return An(e).test(r);
484
+ return In(e).test(r);
485
485
  }
486
- function Mn(e, t) {
487
- return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : In(e, t);
486
+ function Tn(e, t) {
487
+ return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : Mn(e, t);
488
488
  }
489
- function St(e, t) {
489
+ function Nt(e, t) {
490
490
  if (!e || e.length === 0) return !1;
491
491
  for (const r of e)
492
- if (Mn(r, t)) return !0;
492
+ if (Tn(r, t)) return !0;
493
493
  return !1;
494
494
  }
495
- function Rn(e, t, r) {
496
- return e === void 0 ? !0 : St(r, e) ? !1 : t && t.length > 0 ? St(t, e) : !0;
495
+ function Pn(e, t, r) {
496
+ return e === void 0 ? !0 : Nt(r, e) ? !1 : t && t.length > 0 ? Nt(t, e) : !0;
497
497
  }
498
- function Tn(e, t, r) {
499
- return Ve(
500
- () => Rn(e, t, r),
498
+ function Dn(e, t, r) {
499
+ return Je(
500
+ () => Pn(e, t, r),
501
501
  [e, t, r]
502
502
  );
503
503
  }
504
- const Nt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ k(
504
+ const At = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
505
505
  "svg",
506
506
  {
507
507
  className: t,
@@ -547,7 +547,7 @@ const Nt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ k(
547
547
  }
548
548
  )
549
549
  }
550
- ), At = ({ className: e }) => /* @__PURE__ */ n(
550
+ ), Rt = ({ className: e }) => /* @__PURE__ */ n(
551
551
  "svg",
552
552
  {
553
553
  className: e,
@@ -565,7 +565,7 @@ const Nt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ k(
565
565
  }
566
566
  )
567
567
  }
568
- ), Pn = ({ className: e }) => /* @__PURE__ */ n(
568
+ ), $n = ({ className: e }) => /* @__PURE__ */ n(
569
569
  "svg",
570
570
  {
571
571
  className: e,
@@ -576,12 +576,12 @@ const Nt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ k(
576
576
  "aria-hidden": "true",
577
577
  children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
578
578
  }
579
- ), Dn = {
579
+ ), zn = {
580
580
  left: 180,
581
581
  right: 0,
582
582
  up: -90,
583
583
  down: 90
584
- }, $n = ({ direction: e = "right", className: t }) => /* @__PURE__ */ n(
584
+ }, On = ({ direction: e = "right", className: t }) => /* @__PURE__ */ n(
585
585
  "svg",
586
586
  {
587
587
  className: t,
@@ -589,19 +589,19 @@ const Nt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ k(
589
589
  viewBox: "0 0 24 24",
590
590
  stroke: "currentColor",
591
591
  strokeWidth: 2,
592
- style: { transform: `rotate(${Dn[e]}deg)` },
592
+ style: { transform: `rotate(${zn[e]}deg)` },
593
593
  "aria-hidden": "true",
594
594
  children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" })
595
595
  }
596
596
  );
597
- function zn(e) {
597
+ function Hn(e) {
598
598
  return e === "top-left" || e === "bottom-left" ? "left" : "right";
599
599
  }
600
- const qt = "ll-hidden-tab-center-y", Hn = 5, It = 16;
601
- function On() {
600
+ const Ft = "ll-hidden-tab-center-y", qn = 5, It = 16;
601
+ function Bn() {
602
602
  if (typeof window > "u") return null;
603
603
  try {
604
- const e = window.localStorage.getItem(qt);
604
+ const e = window.localStorage.getItem(Ft);
605
605
  if (!e) return null;
606
606
  const t = Number.parseFloat(e);
607
607
  return Number.isFinite(t) ? t : null;
@@ -612,112 +612,112 @@ function On() {
612
612
  function Mt(e) {
613
613
  if (!(typeof window > "u"))
614
614
  try {
615
- window.localStorage.setItem(qt, String(e));
615
+ window.localStorage.setItem(Ft, String(e));
616
616
  } catch {
617
617
  }
618
618
  }
619
- const qn = ({
619
+ const Fn = ({
620
620
  position: e,
621
621
  isMobile: t,
622
622
  isSpeaking: r,
623
623
  onExpand: i,
624
624
  label: o = "Open widget"
625
625
  }) => {
626
- const l = zn(e), s = l === "right" ? "left" : "right", d = t ? 80 : 72, [u, g] = C(null), [p, a] = C(!1), c = M(null), S = M(!1), L = x(
627
- (y) => {
628
- if (typeof window > "u") return y;
629
- const E = d / 2, w = It + E, O = window.innerHeight - It - E;
630
- return O < w ? Math.max(w, y) : Math.max(w, Math.min(O, y));
626
+ const l = Hn(e), c = l === "right" ? "left" : "right", d = t ? 80 : 72, [u, h] = N(null), [m, a] = N(!1), s = I(null), A = I(!1), C = S(
627
+ (g) => {
628
+ if (typeof window > "u") return g;
629
+ const E = d / 2, x = It + E, H = window.innerHeight - It - E;
630
+ return H < x ? Math.max(x, g) : Math.max(x, Math.min(H, g));
631
631
  },
632
632
  [d]
633
633
  );
634
634
  P(() => {
635
- const y = On();
636
- g(L(y ?? window.innerHeight / 2));
635
+ const g = Bn();
636
+ h(C(g ?? window.innerHeight / 2));
637
637
  const E = () => {
638
- g((w) => w === null ? null : L(w));
638
+ h((x) => x === null ? null : C(x));
639
639
  };
640
640
  return window.addEventListener("resize", E), () => window.removeEventListener("resize", E);
641
- }, [L]);
642
- const N = x(
643
- (y) => {
644
- if (!(y.pointerType === "mouse" && y.button !== 0) && u !== null) {
641
+ }, [C]);
642
+ const R = S(
643
+ (g) => {
644
+ if (!(g.pointerType === "mouse" && g.button !== 0) && u !== null) {
645
645
  try {
646
- y.currentTarget.setPointerCapture(y.pointerId);
646
+ g.currentTarget.setPointerCapture(g.pointerId);
647
647
  } catch {
648
648
  }
649
- c.current = {
650
- startClientY: y.clientY,
649
+ s.current = {
650
+ startClientY: g.clientY,
651
651
  startCenterY: u,
652
652
  moved: !1
653
653
  };
654
654
  }
655
655
  },
656
656
  [u]
657
- ), H = x(
658
- (y) => {
659
- const E = c.current;
657
+ ), b = S(
658
+ (g) => {
659
+ const E = s.current;
660
660
  if (!E) return;
661
- const w = y.clientY - E.startClientY;
662
- !E.moved && Math.abs(w) > Hn && (E.moved = !0, a(!0)), E.moved && g(L(E.startCenterY + w));
661
+ const x = g.clientY - E.startClientY;
662
+ !E.moved && Math.abs(x) > qn && (E.moved = !0, a(!0)), E.moved && h(C(E.startCenterY + x));
663
663
  },
664
- [L]
665
- ), R = x(
666
- (y) => {
667
- const E = c.current;
664
+ [C]
665
+ ), L = S(
666
+ (g) => {
667
+ const E = s.current;
668
668
  if (E) {
669
669
  try {
670
- y.currentTarget.releasePointerCapture(y.pointerId);
670
+ g.currentTarget.releasePointerCapture(g.pointerId);
671
671
  } catch {
672
672
  }
673
- c.current = null, E.moved && (a(!1), S.current = !0, g((w) => (w !== null && Mt(w), w)));
673
+ s.current = null, E.moved && (a(!1), A.current = !0, h((x) => (x !== null && Mt(x), x)));
674
674
  }
675
675
  },
676
676
  []
677
- ), $ = x(() => {
678
- if (S.current) {
679
- S.current = !1;
677
+ ), D = S(() => {
678
+ if (A.current) {
679
+ A.current = !1;
680
680
  return;
681
681
  }
682
682
  i();
683
- }, [i]), I = x(
684
- (y) => {
685
- if (y.key === "ArrowUp" || y.key === "ArrowDown") {
686
- y.preventDefault();
687
- const E = y.key === "ArrowUp" ? -8 : 8;
688
- g((w) => {
689
- if (w === null) return w;
690
- const O = L(w + E);
691
- return Mt(O), O;
683
+ }, [i]), M = S(
684
+ (g) => {
685
+ if (g.key === "ArrowUp" || g.key === "ArrowDown") {
686
+ g.preventDefault();
687
+ const E = g.key === "ArrowUp" ? -8 : 8;
688
+ h((x) => {
689
+ if (x === null) return x;
690
+ const H = C(x + E);
691
+ return Mt(H), H;
692
692
  });
693
693
  }
694
694
  },
695
- [L]
696
- ), D = [
695
+ [C]
696
+ ), z = [
697
697
  "ll-hidden",
698
698
  `ll-hidden--${l}`,
699
699
  t ? "ll-hidden--mobile" : "ll-hidden--desktop",
700
700
  r ? "ll-hidden--speaking" : null,
701
- p ? "is-dragging" : null
702
- ].filter(Boolean).join(" "), m = u === null ? void 0 : { top: `${u - d / 2}px`, transform: "none" };
701
+ m ? "is-dragging" : null
702
+ ].filter(Boolean).join(" "), p = u === null ? void 0 : { top: `${u - d / 2}px`, transform: "none" };
703
703
  return /* @__PURE__ */ n(
704
704
  "button",
705
705
  {
706
706
  type: "button",
707
- className: D,
708
- onPointerDown: N,
709
- onPointerMove: H,
710
- onPointerUp: R,
711
- onPointerCancel: R,
712
- onClick: $,
713
- onKeyDown: I,
707
+ className: z,
708
+ onPointerDown: R,
709
+ onPointerMove: b,
710
+ onPointerUp: L,
711
+ onPointerCancel: L,
712
+ onClick: D,
713
+ onKeyDown: M,
714
714
  "aria-label": o,
715
715
  "data-position": e,
716
- style: m,
717
- children: /* @__PURE__ */ n($n, { direction: s, className: "ll-hidden__chevron" })
716
+ style: p,
717
+ children: /* @__PURE__ */ n(On, { direction: c, className: "ll-hidden__chevron" })
718
718
  }
719
719
  );
720
- }, Bn = ({
720
+ }, Un = ({
721
721
  audioLevel: e,
722
722
  bars: t = 20,
723
723
  maxHeight: r = 20,
@@ -725,48 +725,48 @@ const qn = ({
725
725
  className: o,
726
726
  barClassName: l
727
727
  }) => {
728
- const s = M(null), d = M([]), u = Ve(() => {
729
- const p = (Math.sqrt(5) - 1) / 2;
730
- return Array.from({ length: t }, (a, c) => 0.5 + c * p % 1 * 0.5);
728
+ const c = I(null), d = I([]), u = Je(() => {
729
+ const m = (Math.sqrt(5) - 1) / 2;
730
+ return Array.from({ length: t }, (a, s) => 0.5 + s * m % 1 * 0.5);
731
731
  }, [t]);
732
732
  P(() => e.subscribe((a) => {
733
- for (let c = 0; c < t; c++) {
734
- const S = d.current[c];
735
- if (!S) continue;
736
- const L = Math.max(i, a * r * u[c]);
737
- S.style.height = `${L}px`;
733
+ for (let s = 0; s < t; s++) {
734
+ const A = d.current[s];
735
+ if (!A) continue;
736
+ const C = Math.max(i, a * r * u[s]);
737
+ A.style.height = `${C}px`;
738
738
  }
739
739
  }), [e, t, r, i, u]);
740
- const g = ["ll-waveform", o].filter(Boolean).join(" ");
741
- return /* @__PURE__ */ n("div", { ref: s, className: g, "aria-hidden": "true", children: Array.from({ length: t }, (p, a) => /* @__PURE__ */ n(
740
+ const h = ["ll-waveform", o].filter(Boolean).join(" ");
741
+ return /* @__PURE__ */ n("div", { ref: c, className: h, "aria-hidden": "true", children: Array.from({ length: t }, (m, a) => /* @__PURE__ */ n(
742
742
  "div",
743
743
  {
744
- ref: (c) => {
745
- d.current[a] = c;
744
+ ref: (s) => {
745
+ d.current[a] = s;
746
746
  },
747
747
  className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
748
748
  style: { height: `${i}px` }
749
749
  },
750
750
  a
751
751
  )) });
752
- }, Un = ({
752
+ }, Wn = ({
753
753
  position: e,
754
754
  isMobile: t,
755
755
  agentName: r,
756
756
  avatarImageUrl: i,
757
757
  agentState: o,
758
758
  isMuted: l,
759
- audioLevel: s,
759
+ audioLevel: c,
760
760
  onExpand: d,
761
761
  onToggleMute: u,
762
- onClose: g
762
+ onClose: h
763
763
  }) => t ? /* @__PURE__ */ n(
764
764
  "div",
765
765
  {
766
766
  className: "ll-minimized ll-minimized--mobile",
767
767
  role: "region",
768
768
  "aria-label": `${r} widget`,
769
- children: /* @__PURE__ */ k(
769
+ children: /* @__PURE__ */ _(
770
770
  "button",
771
771
  {
772
772
  type: "button",
@@ -786,33 +786,33 @@ const qn = ({
786
786
  )
787
787
  ) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
788
788
  /* @__PURE__ */ n(
789
- Bn,
789
+ Un,
790
790
  {
791
- audioLevel: s,
791
+ audioLevel: c,
792
792
  bars: 16,
793
793
  maxHeight: 18,
794
794
  className: "ll-minimized__waveform"
795
795
  }
796
796
  ),
797
797
  /* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
798
- /* @__PURE__ */ k("div", { className: "ll-minimized__controls", children: [
798
+ /* @__PURE__ */ _("div", { className: "ll-minimized__controls", children: [
799
799
  /* @__PURE__ */ n(
800
800
  "span",
801
801
  {
802
802
  className: "ll-minimized__btn",
803
803
  role: "button",
804
804
  tabIndex: 0,
805
- onClick: (p) => {
806
- p.stopPropagation(), u();
805
+ onClick: (m) => {
806
+ m.stopPropagation(), u();
807
807
  },
808
- onKeyDown: (p) => {
809
- (p.key === "Enter" || p.key === " ") && (p.stopPropagation(), p.preventDefault(), u());
808
+ onKeyDown: (m) => {
809
+ (m.key === "Enter" || m.key === " ") && (m.stopPropagation(), m.preventDefault(), u());
810
810
  },
811
811
  "aria-label": l ? "Unmute microphone" : "Mute microphone",
812
- children: /* @__PURE__ */ n(Nt, { muted: l, className: "ll-minimized__icon" })
812
+ children: /* @__PURE__ */ n(At, { muted: l, className: "ll-minimized__icon" })
813
813
  }
814
814
  ),
815
- /* @__PURE__ */ n(At, { className: "ll-minimized__icon ll-minimized__icon--expand" })
815
+ /* @__PURE__ */ n(Rt, { className: "ll-minimized__icon ll-minimized__icon--expand" })
816
816
  ] })
817
817
  ]
818
818
  }
@@ -825,7 +825,7 @@ const qn = ({
825
825
  "data-position": e,
826
826
  role: "region",
827
827
  "aria-label": `${r} widget`,
828
- children: /* @__PURE__ */ k("div", { className: "ll-minimized__surface", children: [
828
+ children: /* @__PURE__ */ _("div", { className: "ll-minimized__surface", children: [
829
829
  i ? (
830
830
  // eslint-disable-next-line @next/next/no-img-element
831
831
  /* @__PURE__ */ n(
@@ -837,11 +837,11 @@ const qn = ({
837
837
  }
838
838
  )
839
839
  ) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
840
- /* @__PURE__ */ k("div", { className: "ll-minimized__meta", children: [
840
+ /* @__PURE__ */ _("div", { className: "ll-minimized__meta", children: [
841
841
  /* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
842
842
  /* @__PURE__ */ n("span", { className: "ll-minimized__state", children: o === "speaking" ? "Speaking" : o === "thinking" ? "Thinking" : "Listening" })
843
843
  ] }),
844
- /* @__PURE__ */ k("div", { className: "ll-minimized__controls", children: [
844
+ /* @__PURE__ */ _("div", { className: "ll-minimized__controls", children: [
845
845
  /* @__PURE__ */ n(
846
846
  "button",
847
847
  {
@@ -849,7 +849,7 @@ const qn = ({
849
849
  className: "ll-minimized__btn",
850
850
  onClick: u,
851
851
  "aria-label": l ? "Unmute microphone" : "Mute microphone",
852
- children: /* @__PURE__ */ n(Nt, { muted: l, className: "ll-minimized__icon" })
852
+ children: /* @__PURE__ */ n(At, { muted: l, className: "ll-minimized__icon" })
853
853
  }
854
854
  ),
855
855
  /* @__PURE__ */ n(
@@ -859,7 +859,7 @@ const qn = ({
859
859
  className: "ll-minimized__btn",
860
860
  onClick: d,
861
861
  "aria-label": `Expand ${r} widget`,
862
- children: /* @__PURE__ */ n(At, { className: "ll-minimized__icon" })
862
+ children: /* @__PURE__ */ n(Rt, { className: "ll-minimized__icon" })
863
863
  }
864
864
  ),
865
865
  /* @__PURE__ */ n(
@@ -867,24 +867,24 @@ const qn = ({
867
867
  {
868
868
  type: "button",
869
869
  className: "ll-minimized__btn ll-minimized__btn--close",
870
- onClick: g,
870
+ onClick: h,
871
871
  "aria-label": "Close widget",
872
- children: /* @__PURE__ */ n(Pn, { className: "ll-minimized__icon" })
872
+ children: /* @__PURE__ */ n($n, { className: "ll-minimized__icon" })
873
873
  }
874
874
  )
875
875
  ] })
876
876
  ] })
877
877
  }
878
- ), Fn = ({
878
+ ), jn = ({
879
879
  src: e,
880
880
  alt: t,
881
881
  preCannedPlaying: r = !1,
882
882
  className: i,
883
883
  style: o
884
884
  }) => {
885
- const [l, s] = C(!1), d = M(e);
885
+ const [l, c] = N(!1), d = I(e);
886
886
  if (P(() => {
887
- d.current !== e && (d.current = e, s(!1));
887
+ d.current !== e && (d.current = e, c(!1));
888
888
  }, [e]), !e) return null;
889
889
  const u = {
890
890
  position: "absolute",
@@ -909,45 +909,45 @@ const qn = ({
909
909
  style: u,
910
910
  loading: "eager",
911
911
  fetchpriority: "high",
912
- onLoad: () => s(!0)
912
+ onLoad: () => c(!0)
913
913
  }
914
914
  )
915
915
  );
916
- }, jn = ({
916
+ }, Vn = ({
917
917
  position: e,
918
918
  isMobile: t,
919
919
  agentName: r,
920
920
  avatarImageUrl: i,
921
921
  idleLoopUrl: o,
922
922
  greeting: l,
923
- branding: s,
923
+ branding: c,
924
924
  teamMembers: d,
925
925
  currentTeamMemberId: u,
926
- isSwitchingTeamMember: g,
927
- teamSwitcherOpen: p,
926
+ isSwitchingTeamMember: h,
927
+ teamSwitcherOpen: m,
928
928
  onToggleTeamSwitcher: a,
929
- onSelectTeamMember: c,
930
- languageMenuOpen: S,
931
- onToggleLanguageMenu: L,
932
- connectionState: N,
933
- agentState: H,
934
- transcript: R,
935
- canResume: $,
936
- needsUserGesture: I,
937
- error: D,
938
- isMuted: m,
939
- micError: y,
929
+ onSelectTeamMember: s,
930
+ languageMenuOpen: A,
931
+ onToggleLanguageMenu: C,
932
+ connectionState: R,
933
+ agentState: b,
934
+ transcript: L,
935
+ canResume: D,
936
+ needsUserGesture: M,
937
+ error: z,
938
+ isMuted: p,
939
+ micError: g,
940
940
  micDevices: E,
941
- isCameraEnabled: w,
942
- cameraPreviewEl: O,
941
+ isCameraEnabled: x,
942
+ cameraPreviewEl: H,
943
943
  cameraDevices: X,
944
944
  activeCameraId: de,
945
- isScreenShareEnabled: J,
946
- screenPreviewEl: Q,
945
+ isScreenShareEnabled: Q,
946
+ screenPreviewEl: Z,
947
947
  isSpeakerMuted: ue,
948
- allowCamera: Oe,
949
- allowScreenShare: qe,
950
- allowTyping: Be,
948
+ allowCamera: qe,
949
+ allowScreenShare: Be,
950
+ allowTyping: Fe,
951
951
  avatarVideoContainerRef: Ne,
952
952
  onConnect: fe,
953
953
  onDisconnect: ge,
@@ -957,66 +957,66 @@ const qn = ({
957
957
  onToggleCamera: we,
958
958
  onSwitchCameraDevice: _e,
959
959
  onToggleScreenShare: q,
960
- onToggleSpeaker: Ke,
960
+ onToggleSpeaker: Qe,
961
961
  onSendMessage: Ue,
962
- onMinimize: Fe,
962
+ onMinimize: We,
963
963
  onClose: Ae,
964
- onClearMicError: Ie
964
+ onClearMicError: Re
965
965
  }) => {
966
966
  var Pe;
967
- const ie = R.length > 0 ? R[R.length - 1] : null, pe = ((d == null ? void 0 : d.length) ?? 0) > 1, xe = N === "connecting" || N === "connected", Z = N === "connected", V = N === "idle" || N === "disconnected" || N === "error", Me = M(null), oe = M(null);
967
+ const ie = L.length > 0 ? L[L.length - 1] : null, pe = ((d == null ? void 0 : d.length) ?? 0) > 1, xe = R === "connecting" || R === "connected", ee = R === "connected", V = R === "idle" || R === "disconnected" || R === "error", Ie = I(null), oe = I(null);
968
968
  P(() => {
969
- const h = Me.current;
970
- h && (h.innerHTML = "", O && (O.style.width = "100%", O.style.height = "100%", O.style.objectFit = "cover", O.style.transform = "scaleX(-1)", h.appendChild(O)));
971
- }, [O]), P(() => {
972
- const h = oe.current;
973
- h && (h.innerHTML = "", Q && (Q.style.width = "100%", Q.style.height = "100%", Q.style.objectFit = "contain", h.appendChild(Q)));
974
- }, [Q]);
975
- const [G, ne] = C(!1), [le, Y] = C(!1);
969
+ const y = Ie.current;
970
+ y && (y.innerHTML = "", H && (H.style.width = "100%", H.style.height = "100%", H.style.objectFit = "cover", H.style.transform = "scaleX(-1)", y.appendChild(H)));
971
+ }, [H]), P(() => {
972
+ const y = oe.current;
973
+ y && (y.innerHTML = "", Z && (Z.style.width = "100%", Z.style.height = "100%", Z.style.objectFit = "contain", y.appendChild(Z)));
974
+ }, [Z]);
975
+ const [J, ne] = N(!1), [le, Y] = N(!1);
976
976
  P(() => {
977
- if (!G && !le && !S && !p) return;
978
- const h = () => {
979
- ne(!1), Y(!1), S && L(), p && a();
977
+ if (!J && !le && !A && !m) return;
978
+ const y = () => {
979
+ ne(!1), Y(!1), A && C(), m && a();
980
980
  };
981
- return document.addEventListener("click", h), () => document.removeEventListener("click", h);
981
+ return document.addEventListener("click", y), () => document.removeEventListener("click", y);
982
982
  }, [
983
- G,
983
+ J,
984
984
  le,
985
- S,
986
- p,
987
- L,
985
+ A,
986
+ m,
987
+ C,
988
988
  a
989
989
  ]);
990
- const [K, ae] = C(""), Re = x(
991
- (h) => {
992
- h.preventDefault();
993
- const j = K.trim();
994
- j && (Ue(j), ae(""));
990
+ const [K, ae] = N(""), Me = S(
991
+ (y) => {
992
+ y.preventDefault();
993
+ const W = K.trim();
994
+ W && (Ue(W), ae(""));
995
995
  },
996
996
  [K, Ue]
997
- ), Xe = s.productName || "Live Layer", ke = Z && (ie != null && ie.text) ? ie.text : l || "", Te = [
997
+ ), Ze = c.productName || "Live Layer", ke = ee && (ie != null && ie.text) ? ie.text : l || "", Te = [
998
998
  "ll-expanded",
999
999
  t ? "ll-expanded--mobile" : "ll-expanded--desktop"
1000
1000
  ].join(" ");
1001
- return /* @__PURE__ */ k(
1001
+ return /* @__PURE__ */ _(
1002
1002
  "div",
1003
1003
  {
1004
1004
  className: Te,
1005
1005
  "data-position": e,
1006
- "data-state": Z ? "connected" : xe ? "connecting" : "idle",
1006
+ "data-state": ee ? "connected" : xe ? "connecting" : "idle",
1007
1007
  role: "dialog",
1008
1008
  "aria-label": `${r} widget`,
1009
1009
  children: [
1010
- /* @__PURE__ */ k("div", { className: "ll-expanded__bg", children: [
1010
+ /* @__PURE__ */ _("div", { className: "ll-expanded__bg", children: [
1011
1011
  i ? /* @__PURE__ */ n(
1012
- Fn,
1012
+ jn,
1013
1013
  {
1014
1014
  src: i,
1015
1015
  alt: r,
1016
1016
  className: "ll-expanded__bg-img"
1017
1017
  }
1018
1018
  ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Pe = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Pe.toUpperCase()) || "A" }) }),
1019
- o && !Z && /* @__PURE__ */ n(
1019
+ o && !ee && /* @__PURE__ */ n(
1020
1020
  "video",
1021
1021
  {
1022
1022
  className: "ll-expanded__bg-idle",
@@ -1029,11 +1029,11 @@ const qn = ({
1029
1029
  )
1030
1030
  ] }),
1031
1031
  /* @__PURE__ */ n("div", { ref: Ne, className: "ll-expanded__video" }),
1032
- N === "connecting" && /* @__PURE__ */ k("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1032
+ R === "connecting" && /* @__PURE__ */ _("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1033
1033
  /* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
1034
- /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: g ? "Switching..." : "Connecting..." })
1034
+ /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: h ? "Switching..." : "Connecting..." })
1035
1035
  ] }),
1036
- I && Z && /* @__PURE__ */ k(
1036
+ M && ee && /* @__PURE__ */ _(
1037
1037
  "button",
1038
1038
  {
1039
1039
  type: "button",
@@ -1045,81 +1045,81 @@ const qn = ({
1045
1045
  ]
1046
1046
  }
1047
1047
  ),
1048
- xe ? /* @__PURE__ */ k("div", { className: "ll-expanded__topbar", children: [
1049
- /* @__PURE__ */ k("div", { className: "ll-expanded__topbar-left", children: [
1050
- /* @__PURE__ */ k("div", { className: "ll-expanded__pill-wrap", children: [
1051
- /* @__PURE__ */ k(
1048
+ xe ? /* @__PURE__ */ _("div", { className: "ll-expanded__topbar", children: [
1049
+ /* @__PURE__ */ _("div", { className: "ll-expanded__topbar-left", children: [
1050
+ /* @__PURE__ */ _("div", { className: "ll-expanded__pill-wrap", children: [
1051
+ /* @__PURE__ */ _(
1052
1052
  "button",
1053
1053
  {
1054
1054
  type: "button",
1055
1055
  className: "ll-hpill",
1056
- onClick: (h) => {
1057
- pe && (h.stopPropagation(), a());
1056
+ onClick: (y) => {
1057
+ pe && (y.stopPropagation(), a());
1058
1058
  },
1059
1059
  "aria-haspopup": pe ? "listbox" : void 0,
1060
- "aria-expanded": pe ? p : void 0,
1060
+ "aria-expanded": pe ? m : void 0,
1061
1061
  children: [
1062
1062
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
1063
- pe && /* @__PURE__ */ n(je, {})
1063
+ pe && /* @__PURE__ */ n(Ye, {})
1064
1064
  ]
1065
1065
  }
1066
1066
  ),
1067
- pe && p && /* @__PURE__ */ n(
1067
+ pe && m && /* @__PURE__ */ n(
1068
1068
  "div",
1069
1069
  {
1070
1070
  className: "ll-hmenu",
1071
- onClick: (h) => h.stopPropagation(),
1071
+ onClick: (y) => y.stopPropagation(),
1072
1072
  role: "listbox",
1073
- children: d == null ? void 0 : d.map((h) => /* @__PURE__ */ k(
1073
+ children: d == null ? void 0 : d.map((y) => /* @__PURE__ */ _(
1074
1074
  "button",
1075
1075
  {
1076
1076
  type: "button",
1077
- className: `ll-hmenu__item ${h.id === u ? "is-active" : ""}`,
1078
- onClick: () => c(h.id),
1077
+ className: `ll-hmenu__item ${y.id === u ? "is-active" : ""}`,
1078
+ onClick: () => s(y.id),
1079
1079
  role: "option",
1080
- "aria-selected": h.id === u,
1080
+ "aria-selected": y.id === u,
1081
1081
  children: [
1082
- h.avatarImageUrl && /* @__PURE__ */ n(
1082
+ y.avatarImageUrl && /* @__PURE__ */ n(
1083
1083
  "img",
1084
1084
  {
1085
- src: h.avatarImageUrl,
1085
+ src: y.avatarImageUrl,
1086
1086
  alt: "",
1087
1087
  className: "ll-hmenu__avatar"
1088
1088
  }
1089
1089
  ),
1090
- /* @__PURE__ */ n("span", { className: "ll-hmenu__name", children: h.name }),
1091
- h.role && /* @__PURE__ */ n("span", { className: "ll-hmenu__role", children: h.role })
1090
+ /* @__PURE__ */ n("span", { className: "ll-hmenu__name", children: y.name }),
1091
+ y.role && /* @__PURE__ */ n("span", { className: "ll-hmenu__role", children: y.role })
1092
1092
  ]
1093
1093
  },
1094
- h.id
1094
+ y.id
1095
1095
  ))
1096
1096
  }
1097
1097
  )
1098
1098
  ] }),
1099
- /* @__PURE__ */ k("div", { className: "ll-expanded__pill-wrap", children: [
1100
- /* @__PURE__ */ k(
1099
+ /* @__PURE__ */ _("div", { className: "ll-expanded__pill-wrap", children: [
1100
+ /* @__PURE__ */ _(
1101
1101
  "button",
1102
1102
  {
1103
1103
  type: "button",
1104
1104
  className: "ll-hpill ll-hpill--compact",
1105
- onClick: (h) => {
1106
- h.stopPropagation(), L();
1105
+ onClick: (y) => {
1106
+ y.stopPropagation(), C();
1107
1107
  },
1108
1108
  "aria-haspopup": "listbox",
1109
- "aria-expanded": S,
1109
+ "aria-expanded": A,
1110
1110
  "aria-label": "Language: English",
1111
1111
  title: "Language: English",
1112
1112
  children: [
1113
1113
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: "EN" }),
1114
- /* @__PURE__ */ n(je, {})
1114
+ /* @__PURE__ */ n(Ye, {})
1115
1115
  ]
1116
1116
  }
1117
1117
  ),
1118
- S && /* @__PURE__ */ n(
1118
+ A && /* @__PURE__ */ n(
1119
1119
  "div",
1120
1120
  {
1121
1121
  className: "ll-hmenu",
1122
- onClick: (h) => h.stopPropagation(),
1122
+ onClick: (y) => y.stopPropagation(),
1123
1123
  role: "listbox",
1124
1124
  children: /* @__PURE__ */ n(
1125
1125
  "button",
@@ -1137,21 +1137,21 @@ const qn = ({
1137
1137
  /* @__PURE__ */ n(
1138
1138
  "span",
1139
1139
  {
1140
- className: `ll-expanded__state ll-expanded__state--${H}`,
1141
- children: H
1140
+ className: `ll-expanded__state ll-expanded__state--${b}`,
1141
+ children: b
1142
1142
  }
1143
1143
  )
1144
1144
  ] }),
1145
- /* @__PURE__ */ k("div", { className: "ll-expanded__header-actions", children: [
1145
+ /* @__PURE__ */ _("div", { className: "ll-expanded__header-actions", children: [
1146
1146
  /* @__PURE__ */ n(
1147
1147
  "button",
1148
1148
  {
1149
1149
  type: "button",
1150
1150
  className: "ll-hbtn",
1151
- onClick: Fe,
1151
+ onClick: We,
1152
1152
  "aria-label": "Minimize widget",
1153
1153
  title: "Minimize",
1154
- children: /* @__PURE__ */ n(Tt, {})
1154
+ children: /* @__PURE__ */ n(Pt, {})
1155
1155
  }
1156
1156
  ),
1157
1157
  /* @__PURE__ */ n(
@@ -1162,23 +1162,23 @@ const qn = ({
1162
1162
  onClick: Ae,
1163
1163
  "aria-label": "End call",
1164
1164
  title: "End call",
1165
- children: /* @__PURE__ */ n(Rt, {})
1165
+ children: /* @__PURE__ */ n(Tt, {})
1166
1166
  }
1167
1167
  )
1168
1168
  ] })
1169
1169
  ] }) : (
1170
1170
  // Idle-state header with Live Layer product name + minimize/close
1171
- /* @__PURE__ */ k("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
1172
- /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Xe }),
1173
- /* @__PURE__ */ k("div", { className: "ll-expanded__header-actions", children: [
1171
+ /* @__PURE__ */ _("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
1172
+ /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Ze }),
1173
+ /* @__PURE__ */ _("div", { className: "ll-expanded__header-actions", children: [
1174
1174
  /* @__PURE__ */ n(
1175
1175
  "button",
1176
1176
  {
1177
1177
  type: "button",
1178
1178
  className: "ll-hbtn ll-hbtn--ghost",
1179
- onClick: Fe,
1179
+ onClick: We,
1180
1180
  "aria-label": "Minimize widget",
1181
- children: /* @__PURE__ */ n(Tt, {})
1181
+ children: /* @__PURE__ */ n(Pt, {})
1182
1182
  }
1183
1183
  ),
1184
1184
  /* @__PURE__ */ n(
@@ -1188,146 +1188,146 @@ const qn = ({
1188
1188
  className: "ll-hbtn ll-hbtn--danger",
1189
1189
  onClick: Ae,
1190
1190
  "aria-label": "Close widget",
1191
- children: /* @__PURE__ */ n(Rt, {})
1191
+ children: /* @__PURE__ */ n(Tt, {})
1192
1192
  }
1193
1193
  )
1194
1194
  ] })
1195
1195
  ] })
1196
1196
  ),
1197
1197
  V && /* @__PURE__ */ (() => {
1198
- const h = $ ? "Restart paused session" : N === "disconnected" ? "Reconnect to agent" : "Start video call", j = $ ? "Pick up where you left off" : null;
1199
- return /* @__PURE__ */ k(Ht, { children: [
1200
- N === "idle" && !$ && !D && /* @__PURE__ */ k(
1198
+ const y = D ? "Restart paused session" : R === "disconnected" ? "Reconnect to agent" : "Start video call", W = D ? "Pick up where you left off" : null;
1199
+ return /* @__PURE__ */ _(qt, { children: [
1200
+ R === "idle" && !D && !z && /* @__PURE__ */ _(
1201
1201
  "button",
1202
1202
  {
1203
1203
  type: "button",
1204
1204
  className: "ll-expanded__play",
1205
1205
  onClick: fe,
1206
- "aria-label": h,
1206
+ "aria-label": y,
1207
1207
  children: [
1208
1208
  /* @__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" }) }) }),
1209
- /* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: h })
1209
+ /* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: y })
1210
1210
  ]
1211
1211
  }
1212
1212
  ),
1213
- /* @__PURE__ */ k("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
1213
+ /* @__PURE__ */ _("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
1214
1214
  l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
1215
- j && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: j }),
1215
+ W && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: W }),
1216
1216
  /* @__PURE__ */ n(
1217
1217
  "button",
1218
1218
  {
1219
1219
  type: "button",
1220
1220
  className: "ll-expanded__cta",
1221
1221
  onClick: fe,
1222
- "aria-label": h,
1223
- children: h
1222
+ "aria-label": y,
1223
+ children: y
1224
1224
  }
1225
1225
  )
1226
1226
  ] })
1227
1227
  ] });
1228
1228
  })(),
1229
- /* @__PURE__ */ k(
1229
+ /* @__PURE__ */ _(
1230
1230
  "div",
1231
1231
  {
1232
- className: `ll-expanded__pip ${xe && (w || J) ? "is-visible" : ""}`,
1232
+ className: `ll-expanded__pip ${xe && (x || Q) ? "is-visible" : ""}`,
1233
1233
  children: [
1234
1234
  /* @__PURE__ */ n(
1235
1235
  "div",
1236
1236
  {
1237
1237
  ref: oe,
1238
- className: J ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1238
+ className: Q ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1239
1239
  }
1240
1240
  ),
1241
1241
  /* @__PURE__ */ n(
1242
1242
  "div",
1243
1243
  {
1244
- ref: Me,
1245
- className: !J && w ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1244
+ ref: Ie,
1245
+ className: !Q && x ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1246
1246
  }
1247
1247
  )
1248
1248
  ]
1249
1249
  }
1250
1250
  ),
1251
- xe ? /* @__PURE__ */ k("div", { className: "ll-expanded__bottom", children: [
1251
+ xe ? /* @__PURE__ */ _("div", { className: "ll-expanded__bottom", children: [
1252
1252
  ke && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: ke }) }),
1253
- /* @__PURE__ */ k("div", { className: "ll-toolbar", onClick: (h) => h.stopPropagation(), children: [
1254
- qe && /* @__PURE__ */ n(
1253
+ /* @__PURE__ */ _("div", { className: "ll-toolbar", onClick: (y) => y.stopPropagation(), children: [
1254
+ Be && /* @__PURE__ */ n(
1255
1255
  "button",
1256
1256
  {
1257
1257
  type: "button",
1258
- className: `ll-tool ${J ? "is-on" : ""}`,
1258
+ className: `ll-tool ${Q ? "is-on" : ""}`,
1259
1259
  onClick: q,
1260
- "aria-label": J ? "Stop sharing screen" : "Share screen",
1261
- title: J ? "Stop sharing" : "Share screen",
1262
- children: /* @__PURE__ */ n(Wn, {})
1260
+ "aria-label": Q ? "Stop sharing screen" : "Share screen",
1261
+ title: Q ? "Stop sharing" : "Share screen",
1262
+ children: /* @__PURE__ */ n(Yn, {})
1263
1263
  }
1264
1264
  ),
1265
- Oe && /* @__PURE__ */ k("div", { className: "ll-tool-split", children: [
1265
+ qe && /* @__PURE__ */ _("div", { className: "ll-tool-split", children: [
1266
1266
  /* @__PURE__ */ n(
1267
1267
  "button",
1268
1268
  {
1269
1269
  type: "button",
1270
- className: `ll-tool ll-tool--left ${w ? "is-on" : ""}`,
1270
+ className: `ll-tool ll-tool--left ${x ? "is-on" : ""}`,
1271
1271
  onClick: we,
1272
- "aria-label": w ? "Turn off camera" : "Turn on camera",
1273
- title: w ? "Stop camera" : "Start camera",
1274
- children: /* @__PURE__ */ n(Vn, {})
1272
+ "aria-label": x ? "Turn off camera" : "Turn on camera",
1273
+ title: x ? "Stop camera" : "Start camera",
1274
+ children: /* @__PURE__ */ n(Gn, {})
1275
1275
  }
1276
1276
  ),
1277
1277
  /* @__PURE__ */ n(
1278
1278
  "button",
1279
1279
  {
1280
1280
  type: "button",
1281
- className: `ll-tool ll-tool--right ${w ? "is-on" : ""}`,
1282
- onClick: (h) => {
1283
- h.stopPropagation(), Y((j) => !j), ne(!1);
1281
+ className: `ll-tool ll-tool--right ${x ? "is-on" : ""}`,
1282
+ onClick: (y) => {
1283
+ y.stopPropagation(), Y((W) => !W), ne(!1);
1284
1284
  },
1285
1285
  "aria-label": "Camera devices",
1286
1286
  "aria-haspopup": "listbox",
1287
1287
  "aria-expanded": le,
1288
- children: /* @__PURE__ */ n(je, {})
1288
+ children: /* @__PURE__ */ n(Ye, {})
1289
1289
  }
1290
1290
  ),
1291
1291
  le && X.length > 0 && /* @__PURE__ */ n(
1292
- Pt,
1292
+ Dt,
1293
1293
  {
1294
1294
  label: "Camera",
1295
1295
  devices: X,
1296
1296
  activeId: de,
1297
- onPick: (h) => {
1298
- Y(!1), _e(h);
1297
+ onPick: (y) => {
1298
+ Y(!1), _e(y);
1299
1299
  }
1300
1300
  }
1301
1301
  )
1302
1302
  ] }),
1303
- /* @__PURE__ */ k("div", { className: "ll-tool-split", children: [
1303
+ /* @__PURE__ */ _("div", { className: "ll-tool-split", children: [
1304
1304
  /* @__PURE__ */ n(
1305
1305
  "button",
1306
1306
  {
1307
1307
  type: "button",
1308
- className: `ll-tool ll-tool--left ${m ? "is-muted" : ""}`,
1308
+ className: `ll-tool ll-tool--left ${p ? "is-muted" : ""}`,
1309
1309
  onClick: be,
1310
- "aria-label": m ? "Unmute microphone" : "Mute microphone",
1311
- title: m ? "Unmute" : "Mute",
1312
- children: /* @__PURE__ */ n(Yn, { muted: m })
1310
+ "aria-label": p ? "Unmute microphone" : "Mute microphone",
1311
+ title: p ? "Unmute" : "Mute",
1312
+ children: /* @__PURE__ */ n(Jn, { muted: p })
1313
1313
  }
1314
1314
  ),
1315
1315
  /* @__PURE__ */ n(
1316
1316
  "button",
1317
1317
  {
1318
1318
  type: "button",
1319
- className: `ll-tool ll-tool--right ${m ? "is-muted" : ""}`,
1320
- onClick: (h) => {
1321
- h.stopPropagation(), ne((j) => !j), Y(!1);
1319
+ className: `ll-tool ll-tool--right ${p ? "is-muted" : ""}`,
1320
+ onClick: (y) => {
1321
+ y.stopPropagation(), ne((W) => !W), Y(!1);
1322
1322
  },
1323
1323
  "aria-label": "Microphone devices",
1324
1324
  "aria-haspopup": "listbox",
1325
- "aria-expanded": G,
1326
- children: /* @__PURE__ */ n(je, {})
1325
+ "aria-expanded": J,
1326
+ children: /* @__PURE__ */ n(Ye, {})
1327
1327
  }
1328
1328
  ),
1329
- G && E.length > 0 && /* @__PURE__ */ n(
1330
- Pt,
1329
+ J && E.length > 0 && /* @__PURE__ */ n(
1330
+ Dt,
1331
1331
  {
1332
1332
  label: "Microphone",
1333
1333
  devices: E,
@@ -1341,14 +1341,14 @@ const qn = ({
1341
1341
  {
1342
1342
  type: "button",
1343
1343
  className: `ll-tool ${ue ? "is-muted" : ""}`,
1344
- onClick: Ke,
1344
+ onClick: Qe,
1345
1345
  "aria-label": ue ? "Unmute speaker" : "Mute speaker",
1346
1346
  title: ue ? "Unmute speaker" : "Mute speaker",
1347
- children: /* @__PURE__ */ n(Gn, { muted: ue })
1347
+ children: /* @__PURE__ */ n(Kn, { muted: ue })
1348
1348
  }
1349
1349
  )
1350
1350
  ] }),
1351
- Be && /* @__PURE__ */ k("form", { className: "ll-message-input", onSubmit: Re, children: [
1351
+ Fe && /* @__PURE__ */ _("form", { className: "ll-message-input", onSubmit: Me, children: [
1352
1352
  /* @__PURE__ */ n(
1353
1353
  "input",
1354
1354
  {
@@ -1356,7 +1356,7 @@ const qn = ({
1356
1356
  className: "ll-message-input__field",
1357
1357
  placeholder: "Message...",
1358
1358
  value: K,
1359
- onChange: (h) => ae(h.target.value),
1359
+ onChange: (y) => ae(y.target.value),
1360
1360
  "aria-label": "Message the agent"
1361
1361
  }
1362
1362
  ),
@@ -1366,7 +1366,7 @@ const qn = ({
1366
1366
  type: "submit",
1367
1367
  className: "ll-message-input__send",
1368
1368
  "aria-label": "Send message",
1369
- children: /* @__PURE__ */ n(Kn, {})
1369
+ children: /* @__PURE__ */ n(Xn, {})
1370
1370
  }
1371
1371
  )
1372
1372
  ] }),
@@ -1381,31 +1381,31 @@ const qn = ({
1381
1381
  )
1382
1382
  ] }) : null,
1383
1383
  (() => {
1384
- if (y && N !== "error")
1385
- return /* @__PURE__ */ k("div", { className: "ll-expanded__banner", role: "alert", children: [
1386
- /* @__PURE__ */ n("span", { children: y }),
1384
+ if (g && R !== "error")
1385
+ return /* @__PURE__ */ _("div", { className: "ll-expanded__banner", role: "alert", children: [
1386
+ /* @__PURE__ */ n("span", { children: g }),
1387
1387
  /* @__PURE__ */ n(
1388
1388
  "button",
1389
1389
  {
1390
1390
  type: "button",
1391
1391
  className: "ll-expanded__banner-x",
1392
- onClick: Ie,
1392
+ onClick: Re,
1393
1393
  "aria-label": "Dismiss",
1394
1394
  children: "×"
1395
1395
  }
1396
1396
  )
1397
1397
  ] });
1398
- if (!D || N !== "error") return null;
1399
- let h = "Failed to connect", j = "Try again";
1400
- 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__ */ k("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1401
- /* @__PURE__ */ n("span", { children: h }),
1398
+ if (!z || R !== "error") return null;
1399
+ let y = "Failed to connect", W = "Try again";
1400
+ return z === "MIC_PERMISSION_DENIED" ? y = "Microphone blocked. Allow access to talk." : z === "MIC_NOT_FOUND" ? y = "No microphone found. Plug one in + retry." : z === "MIC_UNAVAILABLE" ? y = "Mic unavailable. Check other apps using it." : z === "AGENT_TIMEOUT" ? y = "Agent didn't pick up. Try again." : z === "CONNECT_FAILED" ? y = "Connection failed. Check your network." : z.length < 80 && (y = z), /* @__PURE__ */ _("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1401
+ /* @__PURE__ */ n("span", { children: y }),
1402
1402
  /* @__PURE__ */ n(
1403
1403
  "button",
1404
1404
  {
1405
1405
  type: "button",
1406
1406
  className: "ll-expanded__banner-retry",
1407
1407
  onClick: ye,
1408
- children: j
1408
+ children: W
1409
1409
  }
1410
1410
  )
1411
1411
  ] });
@@ -1414,55 +1414,55 @@ const qn = ({
1414
1414
  }
1415
1415
  );
1416
1416
  };
1417
- function je() {
1417
+ function Ye() {
1418
1418
  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" }) });
1419
1419
  }
1420
- function Rt() {
1421
- return /* @__PURE__ */ k("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
1420
+ function Tt() {
1421
+ return /* @__PURE__ */ _("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
1422
1422
  /* @__PURE__ */ n("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1423
1423
  /* @__PURE__ */ n("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1424
1424
  ] });
1425
1425
  }
1426
- function Tt() {
1426
+ function Pt() {
1427
1427
  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" }) });
1428
1428
  }
1429
- function Wn() {
1430
- return /* @__PURE__ */ k("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: [
1429
+ function Yn() {
1430
+ return /* @__PURE__ */ _("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: [
1431
1431
  /* @__PURE__ */ n("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
1432
1432
  /* @__PURE__ */ n("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
1433
1433
  /* @__PURE__ */ n("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
1434
1434
  ] });
1435
1435
  }
1436
- function Vn() {
1437
- return /* @__PURE__ */ k("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: [
1436
+ function Gn() {
1437
+ return /* @__PURE__ */ _("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: [
1438
1438
  /* @__PURE__ */ n("path", { d: "M23 7l-7 5 7 5V7z" }),
1439
1439
  /* @__PURE__ */ n("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
1440
1440
  ] });
1441
1441
  }
1442
- function Yn({ muted: e }) {
1443
- return /* @__PURE__ */ k("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: [
1442
+ function Jn({ muted: e }) {
1443
+ return /* @__PURE__ */ _("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: [
1444
1444
  /* @__PURE__ */ n("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
1445
1445
  /* @__PURE__ */ n("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
1446
1446
  /* @__PURE__ */ n("line", { x1: "12", y1: "19", x2: "12", y2: "23" }),
1447
1447
  e && /* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
1448
1448
  ] });
1449
1449
  }
1450
- function Gn({ muted: e }) {
1451
- return /* @__PURE__ */ k("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: [
1450
+ function Kn({ muted: e }) {
1451
+ return /* @__PURE__ */ _("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: [
1452
1452
  /* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
1453
- e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ k(Ht, { children: [
1453
+ e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ _(qt, { children: [
1454
1454
  /* @__PURE__ */ n("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
1455
1455
  /* @__PURE__ */ n("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
1456
1456
  ] })
1457
1457
  ] });
1458
1458
  }
1459
- function Kn() {
1460
- return /* @__PURE__ */ k("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1459
+ function Xn() {
1460
+ return /* @__PURE__ */ _("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1461
1461
  /* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
1462
1462
  /* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
1463
1463
  ] });
1464
1464
  }
1465
- const Pt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */ k(
1465
+ const Dt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */ _(
1466
1466
  "div",
1467
1467
  {
1468
1468
  className: "ll-device-menu",
@@ -1471,17 +1471,17 @@ const Pt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */
1471
1471
  children: [
1472
1472
  /* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
1473
1473
  t.map((o, l) => {
1474
- const s = r === o.deviceId;
1475
- return /* @__PURE__ */ k(
1474
+ const c = r === o.deviceId;
1475
+ return /* @__PURE__ */ _(
1476
1476
  "button",
1477
1477
  {
1478
1478
  type: "button",
1479
- className: `ll-device-menu__item ${s ? "is-active" : ""}`,
1479
+ className: `ll-device-menu__item ${c ? "is-active" : ""}`,
1480
1480
  onClick: () => i(o.deviceId),
1481
1481
  role: "option",
1482
- "aria-selected": s,
1482
+ "aria-selected": c,
1483
1483
  children: [
1484
- s && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1484
+ c && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1485
1485
  /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: o.label || `${e} ${l + 1}` })
1486
1486
  ]
1487
1487
  },
@@ -1490,21 +1490,21 @@ const Pt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */
1490
1490
  })
1491
1491
  ]
1492
1492
  }
1493
- ), Xn = [
1493
+ ), Qn = [
1494
1494
  '[data-ll-private="true"]',
1495
1495
  ".ll-widget"
1496
1496
  ];
1497
- function lt(e) {
1497
+ function ct(e) {
1498
1498
  let t = e;
1499
1499
  for (; t; ) {
1500
- for (const r of Xn)
1500
+ for (const r of Qn)
1501
1501
  if (t.matches(r)) return !0;
1502
1502
  t = t.parentElement;
1503
1503
  }
1504
1504
  return !1;
1505
1505
  }
1506
- function Ge(e) {
1507
- if (lt(e)) return !1;
1506
+ function Xe(e) {
1507
+ if (ct(e)) return !1;
1508
1508
  if (e instanceof HTMLInputElement) {
1509
1509
  if (e.type === "password") return !1;
1510
1510
  const t = (e.getAttribute("autocomplete") || "").toLowerCase();
@@ -1512,7 +1512,7 @@ function Ge(e) {
1512
1512
  }
1513
1513
  return !0;
1514
1514
  }
1515
- const We = 4096, Jn = 20, Qn = 20, Zn = 10, er = 10, tr = 30, Dt = 500, nr = [
1515
+ const Ge = 4096, Zn = 20, er = 20, tr = 10, nr = 10, rr = 30, $t = 500, ir = [
1516
1516
  '[data-ll-private="true"]',
1517
1517
  ".ll-widget",
1518
1518
  "script",
@@ -1520,11 +1520,11 @@ const We = 4096, Jn = 20, Qn = 20, Zn = 10, er = 10, tr = 30, Dt = 500, nr = [
1520
1520
  "noscript",
1521
1521
  "iframe"
1522
1522
  ];
1523
- function ze(e) {
1523
+ function Oe(e) {
1524
1524
  if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
1525
1525
  let t = e;
1526
1526
  for (; t; ) {
1527
- for (const r of nr)
1527
+ for (const r of ir)
1528
1528
  if (t.matches(r)) return !0;
1529
1529
  t = t.parentElement;
1530
1530
  }
@@ -1537,7 +1537,7 @@ function He(e) {
1537
1537
  const r = window.innerHeight || document.documentElement.clientHeight, i = window.innerWidth || document.documentElement.clientWidth;
1538
1538
  return t.bottom > 0 && t.right > 0 && t.top < r && t.left < i;
1539
1539
  }
1540
- function $t(e) {
1540
+ function zt(e) {
1541
1541
  const t = e.getAttribute("id");
1542
1542
  if (t) {
1543
1543
  const l = document.querySelector(`label[for="${CSS.escape(t)}"]`);
@@ -1553,10 +1553,10 @@ function $t(e) {
1553
1553
  function me(e, t) {
1554
1554
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
1555
1555
  }
1556
- function Ee(e) {
1556
+ function Se(e) {
1557
1557
  return e.length;
1558
1558
  }
1559
- function rr(e, t = {}) {
1559
+ function or(e, t = {}) {
1560
1560
  const r = t.doc ?? (typeof document < "u" ? document : null);
1561
1561
  if (!r)
1562
1562
  return {
@@ -1570,161 +1570,161 @@ function rr(e, t = {}) {
1570
1570
  forms: [],
1571
1571
  extras: e
1572
1572
  };
1573
- const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "", s = Array.from(
1573
+ const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "", c = Array.from(
1574
1574
  r.querySelectorAll("[data-ll-region]")
1575
1575
  ), d = [];
1576
- for (const m of s) {
1577
- if (d.length >= Zn) break;
1578
- if (ze(m) || !He(m)) continue;
1579
- const y = m.getAttribute("data-ll-region") ?? "", E = m.getAttribute("data-ll-intent") ?? void 0, w = me(
1580
- (m.innerText || m.textContent || "").trim(),
1581
- Dt * 2
1576
+ for (const p of c) {
1577
+ if (d.length >= tr) break;
1578
+ if (Oe(p) || !He(p)) continue;
1579
+ const g = p.getAttribute("data-ll-region") ?? "", E = p.getAttribute("data-ll-intent") ?? void 0, x = me(
1580
+ (p.innerText || p.textContent || "").trim(),
1581
+ $t * 2
1582
1582
  );
1583
- !y || !w || d.push({ id: y, intent: E, text: w });
1583
+ !g || !x || d.push({ id: g, intent: E, text: x });
1584
1584
  }
1585
- const u = [], g = ["H1", "H2", "H3", "H4", "H5", "H6"], p = Array.from(
1585
+ const u = [], h = ["H1", "H2", "H3", "H4", "H5", "H6"], m = Array.from(
1586
1586
  r.querySelectorAll("h1, h2, h3, h4, h5, h6")
1587
1587
  );
1588
- for (const m of p) {
1589
- if (ze(m) || !He(m)) continue;
1590
- const y = (m.textContent || "").trim();
1591
- y && u.push(`${m.tagName}: ${me(y, 200)}`);
1588
+ for (const p of m) {
1589
+ if (Oe(p) || !He(p)) continue;
1590
+ const g = (p.textContent || "").trim();
1591
+ g && u.push(`${p.tagName}: ${me(g, 200)}`);
1592
1592
  }
1593
1593
  const a = Array.from(r.querySelectorAll("p, li"));
1594
- for (const m of a) {
1595
- if (ze(m) || !He(m) || g.includes(m.tagName)) continue;
1596
- const y = (m.textContent || "").trim();
1597
- y.length > 10 && u.push(me(y, Dt));
1594
+ for (const p of a) {
1595
+ if (Oe(p) || !He(p) || h.includes(p.tagName)) continue;
1596
+ const g = (p.textContent || "").trim();
1597
+ g.length > 10 && u.push(me(g, $t));
1598
1598
  }
1599
- const c = u.join(`
1600
- `), S = [], L = Array.from(r.querySelectorAll("a[href]"));
1601
- for (const m of L) {
1602
- if (S.length >= Jn) break;
1603
- if (ze(m) || !He(m)) continue;
1604
- const y = m.getAttribute("href") || "", E = (m.textContent || "").trim();
1605
- !y || !E || S.push({ href: y, text: me(E, 100) });
1599
+ const s = u.join(`
1600
+ `), A = [], C = Array.from(r.querySelectorAll("a[href]"));
1601
+ for (const p of C) {
1602
+ if (A.length >= Zn) break;
1603
+ if (Oe(p) || !He(p)) continue;
1604
+ const g = p.getAttribute("href") || "", E = (p.textContent || "").trim();
1605
+ !g || !E || A.push({ href: g, text: me(E, 100) });
1606
1606
  }
1607
- const N = [], H = Array.from(
1607
+ const R = [], b = Array.from(
1608
1608
  r.querySelectorAll(
1609
1609
  "input, textarea, select"
1610
1610
  )
1611
1611
  );
1612
- for (const m of H) {
1613
- if (N.length >= Qn) break;
1614
- if (ze(m) || !Ge(m) || !He(m)) continue;
1615
- const y = $t(m), E = m instanceof HTMLInputElement ? m.type : m.tagName.toLowerCase();
1616
- y && N.push({ label: me(y, 100), type: E });
1612
+ for (const p of b) {
1613
+ if (R.length >= er) break;
1614
+ if (Oe(p) || !Xe(p) || !He(p)) continue;
1615
+ const g = zt(p), E = p instanceof HTMLInputElement ? p.type : p.tagName.toLowerCase();
1616
+ g && R.push({ label: me(g, 100), type: E });
1617
1617
  }
1618
- const R = Array.from(
1618
+ const L = Array.from(
1619
1619
  r.querySelectorAll("[data-ll-form]")
1620
- ), $ = [];
1621
- for (const m of R) {
1622
- if ($.length >= er) break;
1623
- if (lt(m)) continue;
1624
- const y = m.getAttribute("data-ll-form") || "";
1625
- if (!y) continue;
1626
- const E = m.getAttribute("data-ll-intent") || void 0, w = Array.from(
1627
- m.querySelectorAll(
1620
+ ), D = [];
1621
+ for (const p of L) {
1622
+ if (D.length >= nr) break;
1623
+ if (ct(p)) continue;
1624
+ const g = p.getAttribute("data-ll-form") || "";
1625
+ if (!g) continue;
1626
+ const E = p.getAttribute("data-ll-intent") || void 0, x = Array.from(
1627
+ p.querySelectorAll(
1628
1628
  "[data-ll-field]"
1629
1629
  )
1630
- ), O = [];
1631
- for (const X of w) {
1632
- if (O.length >= tr) break;
1633
- if (!Ge(X)) continue;
1630
+ ), H = [];
1631
+ for (const X of x) {
1632
+ if (H.length >= rr) break;
1633
+ if (!Xe(X)) continue;
1634
1634
  const de = X.getAttribute("data-ll-field") || "";
1635
1635
  if (!de) continue;
1636
- const J = $t(X) || de, Q = X instanceof HTMLInputElement ? X.type : X.tagName.toLowerCase();
1637
- O.push({ name: de, label: me(J, 100), type: Q });
1636
+ const Q = zt(X) || de, Z = X instanceof HTMLInputElement ? X.type : X.tagName.toLowerCase();
1637
+ H.push({ name: de, label: me(Q, 100), type: Z });
1638
1638
  }
1639
- $.push({ id: y, intent: E, fields: O });
1639
+ D.push({ id: g, intent: E, fields: H });
1640
1640
  }
1641
- const I = {
1641
+ const M = {
1642
1642
  url: i,
1643
1643
  title: l,
1644
1644
  pathname: o,
1645
1645
  regions: d,
1646
- visibleText: c,
1647
- visibleLinks: S,
1648
- visibleFields: N,
1649
- forms: $,
1646
+ visibleText: s,
1647
+ visibleLinks: A,
1648
+ visibleFields: R,
1649
+ forms: D,
1650
1650
  extras: e
1651
1651
  };
1652
- let D = Ee(JSON.stringify(I.regions)) + Ee(I.visibleText) + Ee(JSON.stringify(I.visibleLinks)) + Ee(JSON.stringify(I.visibleFields));
1653
- for (; D > We && I.visibleFields.length > 0; )
1654
- I.visibleFields.pop(), D = Ee(JSON.stringify(I.visibleFields));
1655
- for (; D > We && I.visibleLinks.length > 0; )
1656
- I.visibleLinks.pop(), D -= 80;
1657
- return Ee(I.visibleText) > We && (I.visibleText = me(I.visibleText, We - 100)), I;
1652
+ let z = Se(JSON.stringify(M.regions)) + Se(M.visibleText) + Se(JSON.stringify(M.visibleLinks)) + Se(JSON.stringify(M.visibleFields));
1653
+ for (; z > Ge && M.visibleFields.length > 0; )
1654
+ M.visibleFields.pop(), z = Se(JSON.stringify(M.visibleFields));
1655
+ for (; z > Ge && M.visibleLinks.length > 0; )
1656
+ M.visibleLinks.pop(), z -= 80;
1657
+ return Se(M.visibleText) > Ge && (M.visibleText = me(M.visibleText, Ge - 100)), M;
1658
1658
  }
1659
1659
  let Ce = null;
1660
- function zt(e, t = {}) {
1660
+ function Ot(e, t = {}) {
1661
1661
  const r = Date.now(), o = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
1662
1662
  if (Ce && Ce.key === o && r - Ce.at < 1e3)
1663
1663
  return Ce.ctx;
1664
- const l = rr(e, t);
1664
+ const l = or(e, t);
1665
1665
  return Ce = { key: o, at: r, ctx: l }, l;
1666
1666
  }
1667
- function ir() {
1667
+ function lr() {
1668
1668
  Ce = null;
1669
1669
  }
1670
- const or = 200;
1671
- function lr(e) {
1670
+ const ar = 200;
1671
+ function sr(e) {
1672
1672
  return !(!e || e.startsWith("#") || e.startsWith("javascript:") || e.startsWith("mailto:") || e.startsWith("tel:"));
1673
1673
  }
1674
- function ar(e) {
1674
+ function cr(e) {
1675
1675
  const t = e ?? (typeof document < "u" ? document : null);
1676
1676
  if (!t) return [];
1677
1677
  const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), o = [], l = Array.from(t.querySelectorAll("a[href]"));
1678
- for (const s of l) {
1679
- if (o.length >= or) break;
1680
- if (lt(s)) continue;
1681
- const d = s.getAttribute("href") || "";
1682
- if (!lr(d)) continue;
1683
- let u = d, g = !0;
1678
+ for (const c of l) {
1679
+ if (o.length >= ar) break;
1680
+ if (ct(c)) continue;
1681
+ const d = c.getAttribute("href") || "";
1682
+ if (!sr(d)) continue;
1683
+ let u = d, h = !0;
1684
1684
  try {
1685
1685
  if (typeof window < "u") {
1686
1686
  const a = new URL(d, r);
1687
- g = a.origin === r, g && d.startsWith("http") && (u = a.pathname + a.search + a.hash);
1687
+ h = a.origin === r, h && d.startsWith("http") && (u = a.pathname + a.search + a.hash);
1688
1688
  }
1689
1689
  } catch {
1690
1690
  continue;
1691
1691
  }
1692
1692
  if (i.has(u)) continue;
1693
1693
  i.add(u);
1694
- const p = (s.textContent || "").trim().slice(0, 120);
1695
- o.push({ href: u, text: p, internal: g });
1694
+ const m = (c.textContent || "").trim().slice(0, 120);
1695
+ o.push({ href: u, text: m, internal: h });
1696
1696
  }
1697
1697
  return o;
1698
1698
  }
1699
- let Se = null;
1700
- const cr = 5e3;
1701
- function sr() {
1699
+ let Ee = null;
1700
+ const dr = 5e3;
1701
+ function ur() {
1702
1702
  const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
1703
- if (Se && Se.pathname === t && e - Se.at < cr)
1704
- return Se.routes;
1705
- const r = ar();
1706
- return Se = { at: e, pathname: t, routes: r }, r;
1703
+ if (Ee && Ee.pathname === t && e - Ee.at < dr)
1704
+ return Ee.routes;
1705
+ const r = cr();
1706
+ return Ee = { at: e, pathname: t, routes: r }, r;
1707
1707
  }
1708
- function dr() {
1709
- Se = null;
1708
+ function fr() {
1709
+ Ee = null;
1710
1710
  }
1711
- function ur(e, t) {
1711
+ function pr(e, t) {
1712
1712
  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;
1713
1713
  o ? o.call(e, t) : e.value = t;
1714
1714
  }
1715
- function fr(e, t, r = {}) {
1715
+ function hr(e, t, r = {}) {
1716
1716
  const i = r.triggerInput ?? !0, o = r.triggerChange ?? !0;
1717
1717
  if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
1718
1718
  const l = Object.getOwnPropertyDescriptor(
1719
1719
  HTMLInputElement.prototype,
1720
1720
  "checked"
1721
- ), s = l == null ? void 0 : l.set, d = t === "true" || t === "1" || t === "on";
1722
- s ? s.call(e, d) : e.checked = d, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1721
+ ), c = l == null ? void 0 : l.set, d = t === "true" || t === "1" || t === "on";
1722
+ c ? c.call(e, d) : e.checked = d, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1723
1723
  return;
1724
1724
  }
1725
- ur(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1725
+ pr(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1726
1726
  }
1727
- const pr = /* @__PURE__ */ new Set([
1727
+ const mr = /* @__PURE__ */ new Set([
1728
1728
  "agent_state",
1729
1729
  "avatar_stream_ready",
1730
1730
  "avatar_active",
@@ -1747,42 +1747,42 @@ const pr = /* @__PURE__ */ new Set([
1747
1747
  "submit_form",
1748
1748
  "request_routes"
1749
1749
  ]);
1750
- function hr(e) {
1751
- var ht, mt, gt, yt, vt, bt, wt;
1750
+ function gr(e) {
1751
+ var yt, vt, bt, wt, _t, xt, kt;
1752
1752
  const {
1753
1753
  agentId: t,
1754
1754
  apiKey: r,
1755
1755
  baseUrl: i = "https://app.livelayer.studio",
1756
1756
  sessionEndpoint: o,
1757
1757
  sessionBody: l,
1758
- autoConnect: s = !1,
1758
+ autoConnect: c = !1,
1759
1759
  displayMode: d,
1760
1760
  defaultDisplayMode: u = "expanded",
1761
- onDisplayModeChange: g,
1762
- position: p = "bottom-right",
1761
+ onDisplayModeChange: h,
1762
+ position: m = "bottom-right",
1763
1763
  mobileBreakpoint: a = 640,
1764
- persistKey: c = "ll-widget",
1765
- disablePersistence: S = !1,
1766
- teamMembers: L,
1767
- currentTeamMemberId: N,
1768
- onTeamMemberChange: H,
1769
- idleLoopUrl: R,
1770
- greeting: $,
1771
- avatarImageUrl: I,
1772
- agentName: D,
1773
- branding: m = {},
1774
- allowCamera: y = !0,
1764
+ persistKey: s = "ll-widget",
1765
+ disablePersistence: A = !1,
1766
+ teamMembers: C,
1767
+ currentTeamMemberId: R,
1768
+ onTeamMemberChange: b,
1769
+ idleLoopUrl: L,
1770
+ greeting: D,
1771
+ avatarImageUrl: M,
1772
+ agentName: z,
1773
+ branding: p = {},
1774
+ allowCamera: g = !0,
1775
1775
  allowScreenShare: E = !0,
1776
- allowTyping: w = !0,
1777
- showOn: O,
1776
+ allowTyping: x = !0,
1777
+ showOn: H,
1778
1778
  hideOn: X,
1779
1779
  pathname: de,
1780
- onNavigate: J,
1781
- onScrollToSelector: Q,
1780
+ onNavigate: Q,
1781
+ onScrollToSelector: Z,
1782
1782
  getPageContext: ue,
1783
- pageContextExtras: Oe,
1784
- onScrollPage: qe,
1785
- onClick: Be,
1783
+ pageContextExtras: qe,
1784
+ onScrollPage: Be,
1785
+ onClick: Fe,
1786
1786
  capabilities: Ne,
1787
1787
  onConnect: fe,
1788
1788
  onDisconnect: ge,
@@ -1792,419 +1792,433 @@ function hr(e) {
1792
1792
  onAgentEvent: we,
1793
1793
  onAgentCommand: _e,
1794
1794
  controlledSession: q,
1795
- className: Ke,
1795
+ className: Qe,
1796
1796
  style: Ue,
1797
- zIndex: Fe = 2147483647
1798
- } = e, Ae = Cn(de), Ie = Tn(Ae, O, X);
1797
+ zIndex: We = 2147483647
1798
+ } = e, Ae = Nn(de), Re = Dn(Ae, H, X);
1799
1799
  P(() => {
1800
- ir(), dr();
1800
+ lr(), fr();
1801
1801
  }, [Ae]);
1802
- const ie = N !== void 0, [pe, xe] = C(() => {
1802
+ const ie = R !== void 0, [pe, xe] = N(() => {
1803
1803
  var v;
1804
- return N ?? ((v = L == null ? void 0 : L[0]) == null ? void 0 : v.id);
1805
- }), Z = ie ? N : pe, V = Ve(
1806
- () => (L == null ? void 0 : L.find((v) => v.id === Z)) ?? null,
1807
- [L, Z]
1808
- ), Me = (V == null ? void 0 : V.agentId) ?? t, [oe, G] = xn({
1804
+ return R ?? ((v = C == null ? void 0 : C[0]) == null ? void 0 : v.id);
1805
+ }), ee = ie ? R : pe, V = Je(
1806
+ () => (C == null ? void 0 : C.find((v) => v.id === ee)) ?? null,
1807
+ [C, ee]
1808
+ ), Ie = (V == null ? void 0 : V.agentId) ?? t, [oe, J] = Ln({
1809
1809
  value: d,
1810
1810
  defaultValue: u,
1811
- onChange: g,
1812
- persistKey: c,
1813
- disablePersistence: S
1814
- }), ne = Ln(a), le = dn(), Y = un(), K = pn(), ae = hn(), Re = mn(), [Xe, ke] = C(!1), [Te, Pe] = C(!1), [h, j] = C(!1), [at, Bt] = C(!1), [Je, Ut] = C(!1), Qe = M(J), Ze = M(Q), et = M(qe), tt = M(Be), ct = M(ue), st = M(Oe), nt = M(Ne), ee = M(null);
1815
- Qe.current = J, Ze.current = Q, et.current = qe, tt.current = Be, ct.current = ue, st.current = Oe, nt.current = Ne;
1816
- function ce(v) {
1817
- const f = nt.current;
1811
+ onChange: h,
1812
+ persistKey: s,
1813
+ disablePersistence: A
1814
+ }), ne = Cn(a), le = fn(), Y = pn(), K = mn(), ae = gn(), Me = yn(), [Ze, ke] = N(!1), [Te, Pe] = N(!1), [y, W] = N(!1), [dt, Ut] = N(!1), [et, Wt] = N(!1), tt = I(Q), nt = I(Z), rt = I(Be), it = I(Fe), ut = I(ue), ft = I(qe), ot = I(Ne), te = I(null);
1815
+ tt.current = Q, nt.current = Z, rt.current = Be, it.current = Fe, ut.current = ue, ft.current = qe, ot.current = Ne;
1816
+ function se(v) {
1817
+ const f = ot.current;
1818
1818
  return f ? f.includes(v) : !0;
1819
1819
  }
1820
- function se(v, f) {
1820
+ function ce(v, f) {
1821
1821
  console.warn(
1822
1822
  `[LiveLayer] Agent command "${v}" blocked — capability "${f}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
1823
1823
  );
1824
1824
  }
1825
- const rt = x(
1825
+ const De = S(
1826
1826
  (v) => {
1827
- var te, _t, xt, kt;
1827
+ var G, je, Ve, Lt;
1828
1828
  const f = v;
1829
1829
  if (!(!f.type || typeof f.type != "string")) {
1830
1830
  if (we == null || we({ eventName: f.type, data: v }), f.type === "navigate") {
1831
- if (!ce("navigate")) {
1832
- se("navigate", "navigate");
1831
+ if (!se("navigate")) {
1832
+ ce("navigate", "navigate");
1833
1833
  return;
1834
1834
  }
1835
- const _ = typeof f.href == "string" ? f.href : null;
1836
- if (!_) {
1835
+ const k = typeof f.href == "string" ? f.href : null;
1836
+ if (!k) {
1837
1837
  console.warn(
1838
1838
  `[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
1839
1839
  );
1840
1840
  return;
1841
1841
  }
1842
- if (Qe.current) {
1842
+ if (tt.current) {
1843
1843
  try {
1844
- Qe.current(_);
1845
- } catch (A) {
1844
+ tt.current(k);
1845
+ } catch (T) {
1846
1846
  console.warn(
1847
- `[LiveLayer] onNavigate threw for "${_}". Falling back. Error:`,
1848
- A
1847
+ `[LiveLayer] onNavigate threw for "${k}". Falling back. Error:`,
1848
+ T
1849
1849
  );
1850
1850
  }
1851
1851
  return;
1852
1852
  }
1853
1853
  if (typeof document < "u") {
1854
- const A = document.querySelector(
1855
- `a[href="${_.replace(/"/g, '\\"')}"]`
1854
+ const T = document.querySelector(
1855
+ `a[href="${k.replace(/"/g, '\\"')}"]`
1856
1856
  );
1857
- if (A) {
1858
- A.click();
1857
+ if (T) {
1858
+ T.click();
1859
1859
  return;
1860
1860
  }
1861
1861
  }
1862
1862
  if (typeof window < "u" && typeof history < "u")
1863
1863
  try {
1864
- history.pushState({}, "", _), window.dispatchEvent(new PopStateEvent("popstate"));
1865
- } catch (A) {
1864
+ history.pushState({}, "", k), window.dispatchEvent(new PopStateEvent("popstate"));
1865
+ } catch (T) {
1866
1866
  console.warn(
1867
- `[LiveLayer] history.pushState fallback failed for "${_}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
1868
- A
1867
+ `[LiveLayer] history.pushState fallback failed for "${k}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
1868
+ T
1869
1869
  );
1870
1870
  }
1871
1871
  return;
1872
1872
  }
1873
1873
  if (f.type === "scroll_to") {
1874
- if (!ce("scroll")) {
1875
- se("scroll_to", "scroll");
1874
+ if (!se("scroll")) {
1875
+ ce("scroll_to", "scroll");
1876
1876
  return;
1877
1877
  }
1878
- const _ = typeof f.selector == "string" ? f.selector : null;
1879
- if (!_) return;
1880
- const A = f.behavior === "instant" ? "instant" : "smooth";
1881
- if (Ze.current) {
1878
+ const k = typeof f.selector == "string" ? f.selector : null;
1879
+ if (!k) return;
1880
+ const T = f.behavior === "instant" ? "instant" : "smooth";
1881
+ if (nt.current) {
1882
1882
  try {
1883
- Ze.current(
1884
- _,
1885
- A
1883
+ nt.current(
1884
+ k,
1885
+ T
1886
1886
  );
1887
- } catch (T) {
1888
- console.warn("[LiveLayer] onScrollToSelector threw.", T);
1887
+ } catch ($) {
1888
+ console.warn("[LiveLayer] onScrollToSelector threw.", $);
1889
1889
  }
1890
1890
  return;
1891
1891
  }
1892
1892
  if (typeof document < "u") {
1893
- let T = null;
1893
+ let $ = null;
1894
1894
  try {
1895
- T = document.querySelector(_);
1895
+ $ = document.querySelector(k);
1896
1896
  } catch {
1897
1897
  console.warn(
1898
- `[LiveLayer] scroll_to: invalid selector "${_}".`
1898
+ `[LiveLayer] scroll_to: invalid selector "${k}".`
1899
1899
  );
1900
1900
  return;
1901
1901
  }
1902
- if (!T) {
1902
+ if (!$) {
1903
1903
  console.warn(
1904
- `[LiveLayer] scroll_to: no element matched "${_}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
1904
+ `[LiveLayer] scroll_to: no element matched "${k}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
1905
1905
  );
1906
1906
  return;
1907
1907
  }
1908
- T.scrollIntoView({
1909
- behavior: A,
1908
+ $.scrollIntoView({
1909
+ behavior: T,
1910
1910
  block: "start"
1911
1911
  });
1912
1912
  }
1913
1913
  return;
1914
1914
  }
1915
1915
  if (f.type === "request_page_context") {
1916
- if (!ce("read_page")) {
1917
- se("request_page_context", "read_page");
1916
+ if (!se("read_page")) {
1917
+ ce("request_page_context", "read_page");
1918
1918
  return;
1919
1919
  }
1920
- const _ = typeof f.requestId == "string" ? f.requestId : void 0, A = (te = ee.current) == null ? void 0 : te.call(ee), T = (U) => {
1921
- const W = A, re = W == null ? void 0 : W.localParticipant;
1920
+ const k = typeof f.requestId == "string" ? f.requestId : void 0, T = (G = te.current) == null ? void 0 : G.call(te), $ = (F) => {
1921
+ const j = T, re = j == null ? void 0 : j.localParticipant;
1922
1922
  if (re != null && re.publishData)
1923
1923
  try {
1924
- const he = _ ? { ...U, requestId: _ } : U, Le = new TextEncoder().encode(JSON.stringify(he));
1924
+ const he = k ? { ...F, requestId: k } : F, Le = new TextEncoder().encode(JSON.stringify(he));
1925
1925
  re.publishData(Le, { reliable: !0 });
1926
1926
  } catch (he) {
1927
1927
  console.warn("[LiveLayer] publishData failed.", he);
1928
1928
  }
1929
- }, z = st.current, B = ct.current;
1929
+ }, O = ft.current, B = ut.current;
1930
1930
  try {
1931
1931
  if (B) {
1932
- const U = B(z);
1933
- if (U instanceof Promise) {
1934
- T({ type: "page_context_pending" }), U.then((W) => T({ type: "page_context", context: W })).catch((W) => {
1932
+ const F = B(O);
1933
+ if (F instanceof Promise) {
1934
+ $({ type: "page_context_pending" }), F.then((j) => $({ type: "page_context", context: j })).catch((j) => {
1935
1935
  console.warn(
1936
1936
  "[LiveLayer] getPageContext rejected; falling back to default walker.",
1937
- W
1938
- ), T({
1937
+ j
1938
+ ), $({
1939
1939
  type: "page_context",
1940
- context: zt(z)
1940
+ context: Ot(O)
1941
1941
  });
1942
1942
  });
1943
1943
  return;
1944
1944
  }
1945
- T({ type: "page_context", context: U });
1945
+ $({ type: "page_context", context: F });
1946
1946
  return;
1947
1947
  }
1948
- T({
1948
+ $({
1949
1949
  type: "page_context",
1950
- context: zt(z)
1950
+ context: Ot(O)
1951
1951
  });
1952
- } catch (U) {
1952
+ } catch (F) {
1953
1953
  console.warn(
1954
1954
  "[LiveLayer] page-context extraction threw. Sending empty context.",
1955
- U
1956
- ), T({
1955
+ F
1956
+ ), $({
1957
1957
  type: "page_context",
1958
- context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: z }
1958
+ context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: O }
1959
1959
  });
1960
1960
  }
1961
1961
  return;
1962
1962
  }
1963
1963
  if (f.type === "scroll_page") {
1964
- if (!ce("scroll")) {
1965
- se("scroll_page", "scroll");
1964
+ if (!se("scroll")) {
1965
+ ce("scroll_page", "scroll");
1966
1966
  return;
1967
1967
  }
1968
- const _ = f.direction;
1969
- if (_ !== "up" && _ !== "down" && _ !== "top" && _ !== "bottom") {
1968
+ const k = f.direction;
1969
+ if (k !== "up" && k !== "down" && k !== "top" && k !== "bottom") {
1970
1970
  console.warn(
1971
- `[LiveLayer] scroll_page: invalid direction "${String(_)}". Expected up | down | top | bottom.`
1971
+ `[LiveLayer] scroll_page: invalid direction "${String(k)}". Expected up | down | top | bottom.`
1972
1972
  );
1973
1973
  return;
1974
1974
  }
1975
- const A = f.behavior === "instant" ? "instant" : "smooth";
1976
- if (et.current) {
1975
+ const T = f.behavior === "instant" ? "instant" : "smooth";
1976
+ if (rt.current) {
1977
1977
  try {
1978
- et.current(
1979
- _,
1980
- A
1978
+ rt.current(
1979
+ k,
1980
+ T
1981
1981
  );
1982
- } catch (z) {
1983
- console.warn("[LiveLayer] onScrollPage threw.", z);
1982
+ } catch (O) {
1983
+ console.warn("[LiveLayer] onScrollPage threw.", O);
1984
1984
  }
1985
1985
  return;
1986
1986
  }
1987
1987
  if (typeof window > "u") return;
1988
- const T = { behavior: A };
1989
- _ === "up" ? window.scrollBy({ top: -window.innerHeight, ...T }) : _ === "down" ? window.scrollBy({ top: window.innerHeight, ...T }) : _ === "top" ? window.scrollTo({ top: 0, ...T }) : window.scrollTo({ top: document.body.scrollHeight, ...T });
1988
+ const $ = { behavior: T };
1989
+ k === "up" ? window.scrollBy({ top: -window.innerHeight, ...$ }) : k === "down" ? window.scrollBy({ top: window.innerHeight, ...$ }) : k === "top" ? window.scrollTo({ top: 0, ...$ }) : window.scrollTo({ top: document.body.scrollHeight, ...$ });
1990
1990
  return;
1991
1991
  }
1992
1992
  if (f.type === "click") {
1993
- if (!ce("click")) {
1994
- se("click", "click");
1993
+ if (!se("click")) {
1994
+ ce("click", "click");
1995
1995
  return;
1996
1996
  }
1997
- const _ = typeof f.selector == "string" ? f.selector : null;
1998
- if (!_) {
1997
+ const k = typeof f.selector == "string" ? f.selector : null;
1998
+ if (!k) {
1999
1999
  console.warn("[LiveLayer] click: missing selector.");
2000
2000
  return;
2001
2001
  }
2002
- if (tt.current) {
2002
+ if (it.current) {
2003
2003
  try {
2004
- tt.current(_);
2005
- } catch (T) {
2006
- console.warn("[LiveLayer] onClick threw.", T);
2004
+ it.current(k);
2005
+ } catch ($) {
2006
+ console.warn("[LiveLayer] onClick threw.", $);
2007
2007
  }
2008
2008
  return;
2009
2009
  }
2010
2010
  if (typeof document > "u") return;
2011
- let A = null;
2011
+ let T = null;
2012
2012
  try {
2013
- A = document.querySelector(_);
2013
+ T = document.querySelector(k);
2014
2014
  } catch {
2015
2015
  console.warn(
2016
- `[LiveLayer] click: invalid selector "${_}".`
2016
+ `[LiveLayer] click: invalid selector "${k}".`
2017
2017
  );
2018
2018
  return;
2019
2019
  }
2020
- if (!A) {
2020
+ if (!T) {
2021
2021
  console.warn(
2022
- `[LiveLayer] click: no element matched "${_}". See https://livelayer.studio/docs/errors/click-no-match`
2022
+ `[LiveLayer] click: no element matched "${k}". See https://livelayer.studio/docs/errors/click-no-match`
2023
2023
  );
2024
2024
  return;
2025
2025
  }
2026
- if (A.closest('[data-ll-private="true"], .ll-widget')) {
2026
+ if (T.closest('[data-ll-private="true"], .ll-widget')) {
2027
2027
  console.warn(
2028
2028
  "[LiveLayer] click: refusing to click element inside a private subtree."
2029
2029
  );
2030
2030
  return;
2031
2031
  }
2032
- (_t = A.click) == null || _t.call(A);
2032
+ (je = T.click) == null || je.call(T);
2033
2033
  return;
2034
2034
  }
2035
2035
  if (f.type === "fill_form" || f.type === "focus_field") {
2036
- if (!ce("fill_forms")) {
2037
- se(f.type, "fill_forms");
2036
+ if (!se("fill_forms")) {
2037
+ ce(f.type, "fill_forms");
2038
2038
  return;
2039
2039
  }
2040
2040
  if (typeof document > "u") return;
2041
- const _ = typeof f.formId == "string" ? f.formId : null;
2042
- if (!_) {
2041
+ const k = typeof f.formId == "string" ? f.formId : null;
2042
+ if (!k) {
2043
2043
  console.warn(`[LiveLayer] ${f.type}: missing formId.`);
2044
2044
  return;
2045
2045
  }
2046
- const A = document.querySelector(
2047
- `[data-ll-form="${_.replace(/"/g, '\\"')}"]`
2046
+ const T = document.querySelector(
2047
+ `[data-ll-form="${k.replace(/"/g, '\\"')}"]`
2048
2048
  );
2049
- if (!A) {
2049
+ if (!T) {
2050
2050
  console.warn(
2051
- `[LiveLayer] ${f.type}: no form with data-ll-form="${_}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
2051
+ `[LiveLayer] ${f.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`
2052
2052
  );
2053
2053
  return;
2054
2054
  }
2055
- if (A.closest('[data-ll-private="true"], .ll-widget')) {
2055
+ if (T.closest('[data-ll-private="true"], .ll-widget')) {
2056
2056
  console.warn(
2057
2057
  `[LiveLayer] ${f.type}: refusing to touch a form in a private subtree.`
2058
2058
  );
2059
2059
  return;
2060
2060
  }
2061
2061
  if (f.type === "focus_field") {
2062
- const z = typeof f.fieldName == "string" ? f.fieldName : null;
2063
- if (!z) {
2062
+ const O = typeof f.fieldName == "string" ? f.fieldName : null;
2063
+ if (!O) {
2064
2064
  console.warn("[LiveLayer] focus_field: missing fieldName.");
2065
2065
  return;
2066
2066
  }
2067
- const B = A.querySelector(`[data-ll-field="${z.replace(/"/g, '\\"')}"]`);
2067
+ const B = T.querySelector(`[data-ll-field="${O.replace(/"/g, '\\"')}"]`);
2068
2068
  if (!B) {
2069
2069
  console.warn(
2070
- `[LiveLayer] focus_field: no field "${z}" in form "${_}".`
2070
+ `[LiveLayer] focus_field: no field "${O}" in form "${k}".`
2071
2071
  );
2072
2072
  return;
2073
2073
  }
2074
- if (!Ge(B)) {
2074
+ if (!Xe(B)) {
2075
2075
  console.warn(
2076
- `[LiveLayer] focus_field: field "${z}" is privacy-protected and not focusable.`
2076
+ `[LiveLayer] focus_field: field "${O}" is privacy-protected and not focusable.`
2077
2077
  );
2078
2078
  return;
2079
2079
  }
2080
2080
  B.focus();
2081
2081
  return;
2082
2082
  }
2083
- const T = f.values && typeof f.values == "object" ? f.values : null;
2084
- if (!T) {
2083
+ const $ = f.values && typeof f.values == "object" ? f.values : null;
2084
+ if (!$) {
2085
2085
  console.warn("[LiveLayer] fill_form: missing or invalid values.");
2086
2086
  return;
2087
2087
  }
2088
- for (const [z, B] of Object.entries(T)) {
2088
+ for (const [O, B] of Object.entries($)) {
2089
2089
  if (typeof B != "string") continue;
2090
- const U = A.querySelector(`[data-ll-field="${z.replace(/"/g, '\\"')}"]`);
2091
- if (!U) {
2090
+ const F = T.querySelector(`[data-ll-field="${O.replace(/"/g, '\\"')}"]`);
2091
+ if (!F) {
2092
2092
  console.warn(
2093
- `[LiveLayer] fill_form: no field "${z}" in form "${_}". Skipping.`
2093
+ `[LiveLayer] fill_form: no field "${O}" in form "${k}". Skipping.`
2094
2094
  );
2095
2095
  continue;
2096
2096
  }
2097
- if (!Ge(U)) {
2097
+ if (!Xe(F)) {
2098
2098
  console.warn(
2099
- `[LiveLayer] fill_form: field "${z}" is privacy-protected (password / cc-* / private). Skipping.`
2099
+ `[LiveLayer] fill_form: field "${O}" is privacy-protected (password / cc-* / private). Skipping.`
2100
2100
  );
2101
2101
  continue;
2102
2102
  }
2103
2103
  try {
2104
- fr(U, B);
2105
- } catch (W) {
2104
+ hr(F, B);
2105
+ } catch (j) {
2106
2106
  console.warn(
2107
- `[LiveLayer] fill_form: failed to set "${z}".`,
2108
- W
2107
+ `[LiveLayer] fill_form: failed to set "${O}".`,
2108
+ j
2109
2109
  );
2110
2110
  }
2111
2111
  }
2112
2112
  return;
2113
2113
  }
2114
2114
  if (f.type === "submit_form") {
2115
- if (!ce("submit_forms")) {
2116
- se("submit_form", "submit_forms");
2115
+ if (!se("submit_forms")) {
2116
+ ce("submit_form", "submit_forms");
2117
2117
  return;
2118
2118
  }
2119
2119
  if (typeof document > "u") return;
2120
- const _ = typeof f.formId == "string" ? f.formId : null;
2121
- if (!_) {
2120
+ const k = typeof f.formId == "string" ? f.formId : null;
2121
+ if (!k) {
2122
2122
  console.warn("[LiveLayer] submit_form: missing formId.");
2123
2123
  return;
2124
2124
  }
2125
- const A = document.querySelector(
2126
- `[data-ll-form="${_.replace(/"/g, '\\"')}"]`
2125
+ const T = document.querySelector(
2126
+ `[data-ll-form="${k.replace(/"/g, '\\"')}"]`
2127
2127
  );
2128
- if (!A) {
2128
+ if (!T) {
2129
2129
  console.warn(
2130
- `[LiveLayer] submit_form: no form with data-ll-form="${_}".`
2130
+ `[LiveLayer] submit_form: no form with data-ll-form="${k}".`
2131
2131
  );
2132
2132
  return;
2133
2133
  }
2134
- if (A.closest('[data-ll-private="true"], .ll-widget')) {
2134
+ if (T.closest('[data-ll-private="true"], .ll-widget')) {
2135
2135
  console.warn(
2136
2136
  "[LiveLayer] submit_form: refusing to submit a form in a private subtree."
2137
2137
  );
2138
2138
  return;
2139
2139
  }
2140
- const T = typeof f.requestId == "string" ? f.requestId : void 0, z = (xt = ee.current) == null ? void 0 : xt.call(ee), B = (re) => {
2141
- const he = z, Le = he == null ? void 0 : he.localParticipant;
2140
+ const $ = typeof f.requestId == "string" ? f.requestId : void 0, O = (Ve = te.current) == null ? void 0 : Ve.call(te), B = (re) => {
2141
+ const he = O, Le = he == null ? void 0 : he.localParticipant;
2142
2142
  if (Le != null && Le.publishData)
2143
2143
  try {
2144
- const en = T ? { ...re, requestId: T } : re, tn = new TextEncoder().encode(JSON.stringify(en));
2145
- Le.publishData(tn, { reliable: !0 });
2144
+ const nn = $ ? { ...re, requestId: $ } : re, rn = new TextEncoder().encode(JSON.stringify(nn));
2145
+ Le.publishData(rn, { reliable: !0 });
2146
2146
  } catch {
2147
2147
  }
2148
2148
  };
2149
- let U = !1;
2150
- const W = () => {
2151
- U = !0, B({ type: "form_submitted", formId: _ });
2149
+ let F = !1;
2150
+ const j = () => {
2151
+ F = !0, B({ type: "form_submitted", formId: k });
2152
2152
  };
2153
- A.addEventListener("submit", W, { once: !0 });
2153
+ T.addEventListener("submit", j, { once: !0 });
2154
2154
  try {
2155
- typeof A.requestSubmit == "function" ? A.requestSubmit() : A.submit();
2155
+ typeof T.requestSubmit == "function" ? T.requestSubmit() : T.submit();
2156
2156
  } catch (re) {
2157
- console.warn("[LiveLayer] submit_form: requestSubmit threw.", re), A.removeEventListener("submit", W), B({
2157
+ console.warn("[LiveLayer] submit_form: requestSubmit threw.", re), T.removeEventListener("submit", j), B({
2158
2158
  type: "form_submit_blocked",
2159
- formId: _,
2159
+ formId: k,
2160
2160
  reason: "exception"
2161
2161
  });
2162
2162
  return;
2163
2163
  }
2164
2164
  setTimeout(() => {
2165
- U || (A.removeEventListener("submit", W), B({
2165
+ F || (T.removeEventListener("submit", j), B({
2166
2166
  type: "form_submit_blocked",
2167
- formId: _,
2167
+ formId: k,
2168
2168
  reason: "validation"
2169
2169
  }));
2170
2170
  }, 500);
2171
2171
  return;
2172
2172
  }
2173
2173
  if (f.type === "request_routes") {
2174
- if (!ce("read_page")) {
2175
- se("request_routes", "read_page");
2174
+ if (!se("read_page")) {
2175
+ ce("request_routes", "read_page");
2176
2176
  return;
2177
2177
  }
2178
- const _ = typeof f.requestId == "string" ? f.requestId : void 0, T = (kt = ee.current) == null ? void 0 : kt.call(ee), z = T == null ? void 0 : T.localParticipant;
2179
- if (!(z != null && z.publishData)) return;
2178
+ const k = typeof f.requestId == "string" ? f.requestId : void 0, $ = (Lt = te.current) == null ? void 0 : Lt.call(te), O = $ == null ? void 0 : $.localParticipant;
2179
+ if (!(O != null && O.publishData)) return;
2180
2180
  try {
2181
- const B = sr(), U = _ ? { type: "routes", routes: B, requestId: _ } : { type: "routes", routes: B }, W = new TextEncoder().encode(JSON.stringify(U));
2182
- z.publishData(W, { reliable: !0 });
2181
+ const B = ur(), F = k ? { type: "routes", routes: B, requestId: k } : { type: "routes", routes: B }, j = new TextEncoder().encode(JSON.stringify(F));
2182
+ O.publishData(j, { reliable: !0 });
2183
2183
  } catch (B) {
2184
2184
  console.warn("[LiveLayer] request_routes: extractRoutes threw.", B);
2185
2185
  }
2186
2186
  return;
2187
2187
  }
2188
- pr.has(f.type) || _e == null || _e(f);
2188
+ mr.has(f.type) || _e == null || _e(f);
2189
2189
  }
2190
2190
  },
2191
2191
  [_e, we]
2192
- ), F = sn({
2193
- agentId: q ? "__controlled__" : Me,
2192
+ ), U = un({
2193
+ agentId: q ? "__controlled__" : Ie,
2194
2194
  baseUrl: i,
2195
2195
  apiKey: r,
2196
2196
  sessionEndpoint: o,
2197
2197
  sessionBody: l,
2198
- onDataMessage: q ? void 0 : rt
2198
+ onDataMessage: q ? void 0 : De
2199
2199
  });
2200
2200
  P(() => {
2201
2201
  if (q != null && q.subscribeToDataMessages)
2202
- return q.subscribeToDataMessages(rt);
2203
- }, [q, rt]), ee.current = () => {
2202
+ return q.subscribeToDataMessages(De);
2203
+ }, [q, De]), te.current = () => {
2204
2204
  var v;
2205
- return (v = F.getRoom) == null ? void 0 : v.call(F);
2206
- };
2207
- const b = Ve(() => q ? {
2205
+ return (v = U.getRoom) == null ? void 0 : v.call(U);
2206
+ }, P(() => {
2207
+ var G;
2208
+ if (typeof window > "u") return;
2209
+ const v = ((G = window.location) == null ? void 0 : G.hostname) || "";
2210
+ if (v === "localhost" || v === "127.0.0.1" || v === "0.0.0.0" || v.endsWith(".local") || v.endsWith(".test"))
2211
+ return window.__livelayerSimulateCommand = (je) => {
2212
+ try {
2213
+ De(je);
2214
+ } catch (Ve) {
2215
+ console.warn("[LiveLayer] simulate-command threw:", Ve);
2216
+ }
2217
+ }, () => {
2218
+ delete window.__livelayerSimulateCommand;
2219
+ };
2220
+ }, [De]);
2221
+ const w = Je(() => q ? {
2208
2222
  connectionState: q.connectionState,
2209
2223
  agentState: q.agentState,
2210
2224
  transcript: q.transcript,
@@ -2220,203 +2234,203 @@ function hr(e) {
2220
2234
  // Dummy getRoom for shape compatibility — controlled consumers own the Room.
2221
2235
  // Internal session's getRoom returns null when no real connect has happened,
2222
2236
  // so we reuse its reference for type consistency.
2223
- getRoom: F.getRoom,
2237
+ getRoom: U.getRoom,
2224
2238
  isControlled: !0
2225
2239
  } : {
2226
- connectionState: F.connectionState,
2227
- agentState: F.agentState,
2228
- transcript: F.transcript,
2229
- videoElement: F.videoElement,
2230
- audioElement: F.audioElement,
2231
- canResume: F.canResume,
2232
- error: F.error,
2233
- agentConfig: F.agentConfig,
2234
- connect: F.connect,
2235
- disconnect: F.disconnect,
2236
- getRoom: F.getRoom,
2240
+ connectionState: U.connectionState,
2241
+ agentState: U.agentState,
2242
+ transcript: U.transcript,
2243
+ videoElement: U.videoElement,
2244
+ audioElement: U.audioElement,
2245
+ canResume: U.canResume,
2246
+ error: U.error,
2247
+ agentConfig: U.agentConfig,
2248
+ connect: U.connect,
2249
+ disconnect: U.disconnect,
2250
+ getRoom: U.getRoom,
2237
2251
  isControlled: !1
2238
- }, [q, F]), dt = M(null);
2252
+ }, [q, U]), pt = I(null);
2239
2253
  P(() => {
2240
- const v = b.videoElement, f = dt.current;
2254
+ const v = w.videoElement, f = pt.current;
2241
2255
  if (!(!v || !f))
2242
2256
  return f.appendChild(v), () => {
2243
2257
  v.parentNode === f && f.removeChild(v);
2244
2258
  };
2245
- }, [b.videoElement]), P(() => {
2246
- const v = b.audioElement;
2259
+ }, [w.videoElement]), P(() => {
2260
+ const v = w.audioElement;
2247
2261
  if (!v) return;
2248
2262
  le.attach(v);
2249
2263
  const f = v.play();
2250
- return f && typeof f.catch == "function" && f.catch((te) => {
2251
- (te == null ? void 0 : te.name) === "NotAllowedError" && ke(!0);
2264
+ return f && typeof f.catch == "function" && f.catch((G) => {
2265
+ (G == null ? void 0 : G.name) === "NotAllowedError" && ke(!0);
2252
2266
  }), () => {
2253
2267
  le.detach();
2254
2268
  };
2255
- }, [b.audioElement]), P(() => {
2256
- if (b.isControlled || b.connectionState !== "connected") return;
2257
- const v = b.getRoom();
2269
+ }, [w.audioElement]), P(() => {
2270
+ if (w.isControlled || w.connectionState !== "connected") return;
2271
+ const v = w.getRoom();
2258
2272
  if (v)
2259
2273
  return Y.setupMic(v).catch(() => {
2260
- }), K.attachRoom(v), ae.attachRoom(v), Re.refresh(), () => {
2274
+ }), K.attachRoom(v), ae.attachRoom(v), Me.refresh(), () => {
2261
2275
  Y.teardownMic(), K.teardown(), ae.teardown();
2262
2276
  };
2263
- }, [b.isControlled, b.connectionState]), P(() => {
2264
- const v = b.audioElement;
2265
- v && (v.muted = Je);
2266
- }, [b.audioElement, Je]);
2267
- const Ft = x((v) => {
2268
- const f = b.getRoom();
2277
+ }, [w.isControlled, w.connectionState]), P(() => {
2278
+ const v = w.audioElement;
2279
+ v && (v.muted = et);
2280
+ }, [w.audioElement, et]);
2281
+ const jt = S((v) => {
2282
+ const f = w.getRoom();
2269
2283
  if (f)
2270
2284
  try {
2271
- const te = new TextEncoder().encode(
2285
+ const G = new TextEncoder().encode(
2272
2286
  JSON.stringify({ type: "user_message", text: v })
2273
2287
  );
2274
- f.localParticipant.publishData(te, { reliable: !0 });
2288
+ f.localParticipant.publishData(G, { reliable: !0 });
2275
2289
  } catch {
2276
2290
  }
2277
- }, [b]), jt = x(() => {
2278
- Ut((v) => !v);
2291
+ }, [w]), Vt = S(() => {
2292
+ Wt((v) => !v);
2279
2293
  }, []);
2280
2294
  P(() => {
2281
- be == null || be(b.connectionState), b.connectionState === "connected" ? fe == null || fe() : b.connectionState === "disconnected" && (ge == null || ge());
2282
- }, [b.connectionState, fe, ge, be]), P(() => {
2283
- ye == null || ye(b.transcript);
2284
- }, [b.transcript, ye]), P(() => {
2285
- ve == null || ve(b.agentState);
2286
- }, [b.agentState, ve]);
2287
- const ut = M(!1);
2295
+ be == null || be(w.connectionState), w.connectionState === "connected" ? fe == null || fe() : w.connectionState === "disconnected" && (ge == null || ge());
2296
+ }, [w.connectionState, fe, ge, be]), P(() => {
2297
+ ye == null || ye(w.transcript);
2298
+ }, [w.transcript, ye]), P(() => {
2299
+ ve == null || ve(w.agentState);
2300
+ }, [w.agentState, ve]);
2301
+ const ht = I(!1);
2288
2302
  P(() => {
2289
- b.isControlled || !s || ut.current || Ie && b.connectionState === "idle" && (ut.current = !0, b.connect());
2290
- }, [s, b.connectionState, b, Ie]);
2291
- const Wt = x(
2303
+ w.isControlled || !c || ht.current || Re && w.connectionState === "idle" && (ht.current = !0, w.connect());
2304
+ }, [c, w.connectionState, w, Re]);
2305
+ const Yt = S(
2292
2306
  (v) => {
2293
- const f = L == null ? void 0 : L.find((te) => te.id === v);
2294
- f && (j(!1), v !== Z && (Pe(!0), b.disconnect(), ie || xe(v), H == null || H(f)));
2307
+ const f = C == null ? void 0 : C.find((G) => G.id === v);
2308
+ f && (W(!1), v !== ee && (Pe(!0), w.disconnect(), ie || xe(v), b == null || b(f)));
2295
2309
  },
2296
2310
  [
2297
- L,
2298
- Z,
2299
- b,
2311
+ C,
2312
+ ee,
2313
+ w,
2300
2314
  ie,
2301
- H
2315
+ b
2302
2316
  ]
2303
2317
  );
2304
2318
  P(() => {
2305
- Te && b.connectionState === "connected" && Pe(!1);
2306
- }, [b.connectionState, Te]), P(() => {
2307
- if (!h) return;
2319
+ Te && w.connectionState === "connected" && Pe(!1);
2320
+ }, [w.connectionState, Te]), P(() => {
2321
+ if (!y) return;
2308
2322
  const v = (f) => {
2309
- f.key === "Escape" && j(!1);
2323
+ f.key === "Escape" && W(!1);
2310
2324
  };
2311
2325
  return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
2312
- }, [h]);
2313
- const Vt = !!I || !!(V != null && V.avatarImageUrl) || b.isControlled, De = gn(Me, i, Vt);
2314
- Ne === void 0 && ((ht = De.info) != null && ht.capabilities) && (nt.current = De.info.capabilities);
2315
- const it = (V == null ? void 0 : V.name) ?? D ?? ((mt = b.agentConfig) == null ? void 0 : mt.name) ?? ((gt = De.info) == null ? void 0 : gt.name) ?? "Live Layer", ft = (V == null ? void 0 : V.avatarImageUrl) ?? I ?? ((yt = b.agentConfig) == null ? void 0 : yt.avatarImageUrl) ?? ((vt = De.info) == null ? void 0 : vt.avatarImageUrl) ?? null, Yt = R ?? ((bt = b.agentConfig) == null ? void 0 : bt.idleLoopUrl) ?? ((wt = De.info) == null ? void 0 : wt.idleLoopUrl) ?? null, Gt = $ ?? null, Kt = x(() => G("expanded"), [G]), Xt = x(
2316
- () => G("minimized"),
2317
- [G]
2318
- ), pt = x(() => {
2319
- b.disconnect(), G("hidden");
2320
- }, [b, G]), Jt = x(() => {
2321
- const v = b.audioElement;
2326
+ }, [y]);
2327
+ const Gt = !!M || !!(V != null && V.avatarImageUrl) || w.isControlled, $e = vn(Ie, i, Gt);
2328
+ Ne === void 0 && ((yt = $e.info) != null && yt.capabilities) && (ot.current = $e.info.capabilities);
2329
+ const lt = (V == null ? void 0 : V.name) ?? z ?? ((vt = w.agentConfig) == null ? void 0 : vt.name) ?? ((bt = $e.info) == null ? void 0 : bt.name) ?? "Live Layer", mt = (V == null ? void 0 : V.avatarImageUrl) ?? M ?? ((wt = w.agentConfig) == null ? void 0 : wt.avatarImageUrl) ?? ((_t = $e.info) == null ? void 0 : _t.avatarImageUrl) ?? null, Jt = L ?? ((xt = w.agentConfig) == null ? void 0 : xt.idleLoopUrl) ?? ((kt = $e.info) == null ? void 0 : kt.idleLoopUrl) ?? null, Kt = D ?? null, Xt = S(() => J("expanded"), [J]), Qt = S(
2330
+ () => J("minimized"),
2331
+ [J]
2332
+ ), gt = S(() => {
2333
+ w.disconnect(), J("hidden");
2334
+ }, [w, J]), Zt = S(() => {
2335
+ const v = w.audioElement;
2322
2336
  v && v.play().then(() => ke(!1)).catch(() => {
2323
2337
  });
2324
- }, [b.audioElement]), Qt = x(() => {
2325
- ke(!1), b.connect();
2326
- }, [b]), $e = {
2338
+ }, [w.audioElement]), en = S(() => {
2339
+ ke(!1), w.connect();
2340
+ }, [w]), ze = {
2327
2341
  ...Ue,
2328
- zIndex: Fe
2342
+ zIndex: We
2329
2343
  };
2330
- m.primaryColor && ($e["--ll-color-primary"] = m.primaryColor), m.accentColor && ($e["--ll-color-accent"] = m.accentColor), m.backgroundColor && ($e["--ll-color-bg"] = m.backgroundColor), m.textColor && ($e["--ll-color-fg"] = m.textColor);
2331
- const Zt = [
2344
+ p.primaryColor && (ze["--ll-color-primary"] = p.primaryColor), p.accentColor && (ze["--ll-color-accent"] = p.accentColor), p.backgroundColor && (ze["--ll-color-bg"] = p.backgroundColor), p.textColor && (ze["--ll-color-fg"] = p.textColor);
2345
+ const tn = [
2332
2346
  "ll-widget",
2333
2347
  `ll-widget--${oe}`,
2334
2348
  `ll-widget--${ne ? "mobile" : "desktop"}`,
2335
- Ke
2349
+ Qe
2336
2350
  ].filter(Boolean).join(" ");
2337
- return Ie ? /* @__PURE__ */ k(
2351
+ return Re ? /* @__PURE__ */ _(
2338
2352
  "div",
2339
2353
  {
2340
- className: Zt,
2341
- style: $e,
2354
+ className: tn,
2355
+ style: ze,
2342
2356
  "data-display-mode": oe,
2343
- "data-position": p,
2357
+ "data-position": m,
2344
2358
  children: [
2345
2359
  oe === "hidden" && /* @__PURE__ */ n(
2346
- qn,
2360
+ Fn,
2347
2361
  {
2348
- position: p,
2362
+ position: m,
2349
2363
  isMobile: ne,
2350
- isSpeaking: b.agentState === "speaking",
2351
- onExpand: () => G("expanded"),
2352
- label: `Open ${it} widget`
2364
+ isSpeaking: w.agentState === "speaking",
2365
+ onExpand: () => J("expanded"),
2366
+ label: `Open ${lt} widget`
2353
2367
  }
2354
2368
  ),
2355
2369
  oe === "minimized" && /* @__PURE__ */ n(
2356
- Un,
2370
+ Wn,
2357
2371
  {
2358
- position: p,
2372
+ position: m,
2359
2373
  isMobile: ne,
2360
- agentName: it,
2361
- avatarImageUrl: ft,
2362
- agentState: b.agentState,
2374
+ agentName: lt,
2375
+ avatarImageUrl: mt,
2376
+ agentState: w.agentState,
2363
2377
  isMuted: Y.isMuted,
2364
2378
  audioLevel: le,
2365
- onExpand: Kt,
2379
+ onExpand: Xt,
2366
2380
  onToggleMute: Y.toggleMute,
2367
- onClose: pt
2381
+ onClose: gt
2368
2382
  }
2369
2383
  ),
2370
2384
  oe === "expanded" && /* @__PURE__ */ n(
2371
- jn,
2385
+ Vn,
2372
2386
  {
2373
- position: p,
2387
+ position: m,
2374
2388
  isMobile: ne,
2375
- agentName: it,
2376
- avatarImageUrl: ft,
2377
- idleLoopUrl: Yt,
2378
- greeting: Gt,
2379
- branding: m,
2380
- teamMembers: L,
2381
- currentTeamMemberId: Z,
2389
+ agentName: lt,
2390
+ avatarImageUrl: mt,
2391
+ idleLoopUrl: Jt,
2392
+ greeting: Kt,
2393
+ branding: p,
2394
+ teamMembers: C,
2395
+ currentTeamMemberId: ee,
2382
2396
  isSwitchingTeamMember: Te,
2383
- teamSwitcherOpen: h,
2384
- onToggleTeamSwitcher: () => j((v) => !v),
2385
- onSelectTeamMember: Wt,
2386
- connectionState: b.connectionState,
2387
- agentState: b.agentState,
2388
- transcript: b.transcript,
2397
+ teamSwitcherOpen: y,
2398
+ onToggleTeamSwitcher: () => W((v) => !v),
2399
+ onSelectTeamMember: Yt,
2400
+ connectionState: w.connectionState,
2401
+ agentState: w.agentState,
2402
+ transcript: w.transcript,
2389
2403
  isMuted: Y.isMuted,
2390
- micDevices: Re.mics,
2404
+ micDevices: Me.mics,
2391
2405
  isCameraEnabled: K.isEnabled,
2392
2406
  cameraPreviewEl: K.previewEl,
2393
- cameraDevices: Re.cameras,
2407
+ cameraDevices: Me.cameras,
2394
2408
  activeCameraId: K.activeDeviceId,
2395
2409
  isScreenShareEnabled: ae.isEnabled,
2396
2410
  screenPreviewEl: ae.previewEl,
2397
- isSpeakerMuted: Je,
2398
- allowCamera: y,
2411
+ isSpeakerMuted: et,
2412
+ allowCamera: g,
2399
2413
  allowScreenShare: E,
2400
- allowTyping: w,
2401
- languageMenuOpen: at,
2402
- onToggleLanguageMenu: () => Bt((v) => !v),
2403
- needsUserGesture: Xe,
2404
- canResume: b.canResume,
2414
+ allowTyping: x,
2415
+ languageMenuOpen: dt,
2416
+ onToggleLanguageMenu: () => Ut((v) => !v),
2417
+ needsUserGesture: Ze,
2418
+ canResume: w.canResume,
2405
2419
  micError: Y.micError,
2406
- error: b.error,
2407
- avatarVideoContainerRef: dt,
2408
- onConnect: () => void b.connect(),
2409
- onDisconnect: () => b.disconnect(),
2410
- onRetry: Qt,
2411
- onResumeAudio: Jt,
2420
+ error: w.error,
2421
+ avatarVideoContainerRef: pt,
2422
+ onConnect: () => void w.connect(),
2423
+ onDisconnect: () => w.disconnect(),
2424
+ onRetry: en,
2425
+ onResumeAudio: Zt,
2412
2426
  onToggleMute: Y.toggleMute,
2413
2427
  onToggleCamera: () => void K.toggle(),
2414
2428
  onSwitchCameraDevice: (v) => void K.switchDevice(v),
2415
2429
  onToggleScreenShare: () => void ae.toggle(),
2416
- onToggleSpeaker: jt,
2417
- onSendMessage: Ft,
2418
- onMinimize: Xt,
2419
- onClose: pt,
2430
+ onToggleSpeaker: Vt,
2431
+ onSendMessage: jt,
2432
+ onMinimize: Qt,
2433
+ onClose: gt,
2420
2434
  onClearMicError: Y.clearError
2421
2435
  }
2422
2436
  )
@@ -2424,38 +2438,38 @@ function hr(e) {
2424
2438
  }
2425
2439
  ) : null;
2426
2440
  }
2427
- function wr(e) {
2428
- return /* @__PURE__ */ n(cn, { children: /* @__PURE__ */ n(hr, { ...e }) });
2441
+ function Lr(e) {
2442
+ return /* @__PURE__ */ n(dn, { children: /* @__PURE__ */ n(gr, { ...e }) });
2429
2443
  }
2430
- const _r = ({
2444
+ const Sr = ({
2431
2445
  agentId: e,
2432
2446
  baseUrl: t,
2433
2447
  apiKey: r,
2434
2448
  mode: i,
2435
2449
  onAgentEvent: o,
2436
2450
  className: l,
2437
- style: s
2451
+ style: c
2438
2452
  }) => {
2439
- const d = M(null), u = M(null), g = M(o);
2440
- g.current = o;
2441
- const p = x((a) => {
2442
- var S;
2443
- const c = a.detail;
2444
- (S = g.current) == null || S.call(g, c);
2453
+ const d = I(null), u = I(null), h = I(o);
2454
+ h.current = o;
2455
+ const m = S((a) => {
2456
+ var A;
2457
+ const s = a.detail;
2458
+ (A = h.current) == null || A.call(h, s);
2445
2459
  }, []);
2446
2460
  return P(() => {
2447
2461
  const a = d.current;
2448
2462
  if (!a) return;
2449
- const c = document.createElement("livelayer-widget");
2450
- 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", p), a.appendChild(c), u.current = c, () => {
2451
- c.removeEventListener("agent-event", p), a.removeChild(c), u.current = null;
2463
+ const s = document.createElement("livelayer-widget");
2464
+ return s.setAttribute("agent-id", e), t && s.setAttribute("base-url", t), r && s.setAttribute("api-key", r), i && s.setAttribute("mode", i), s.addEventListener("agent-event", m), a.appendChild(s), u.current = s, () => {
2465
+ s.removeEventListener("agent-event", m), a.removeChild(s), u.current = null;
2452
2466
  };
2453
2467
  }, [e]), P(() => {
2454
2468
  u.current && (i ? u.current.setAttribute("mode", i) : u.current.removeAttribute("mode"));
2455
- }, [i]), /* @__PURE__ */ n("div", { ref: d, className: l, style: s });
2456
- }, xr = ot(
2457
- function({ id: t, intent: r, as: i = "div", className: o, style: l, children: s }, d) {
2458
- return rn(
2469
+ }, [i]), /* @__PURE__ */ n("div", { ref: d, className: l, style: c });
2470
+ }, Cr = st(
2471
+ function({ id: t, intent: r, as: i = "div", className: o, style: l, children: c }, d) {
2472
+ return ln(
2459
2473
  i,
2460
2474
  {
2461
2475
  ref: d,
@@ -2464,10 +2478,10 @@ const _r = ({
2464
2478
  className: o,
2465
2479
  style: l
2466
2480
  },
2467
- s
2481
+ c
2468
2482
  );
2469
2483
  }
2470
- ), kr = ot(
2484
+ ), Er = st(
2471
2485
  function({ id: t, intent: r, children: i, ...o }, l) {
2472
2486
  return /* @__PURE__ */ n(
2473
2487
  "form",
@@ -2480,59 +2494,392 @@ const _r = ({
2480
2494
  }
2481
2495
  );
2482
2496
  }
2483
- ), Lr = ot(
2497
+ ), Nr = st(
2484
2498
  function(t, r) {
2485
- const { name: i, label: o, labelClassName: l } = t, s = { name: i, "data-ll-field": i };
2499
+ const { name: i, label: o, labelClassName: l } = t, c = { name: i, "data-ll-field": i };
2486
2500
  let d;
2487
2501
  if ("as" in t && t.as === "textarea") {
2488
- const { name: u, label: g, labelClassName: p, as: a, ...c } = t;
2502
+ const { name: u, label: h, labelClassName: m, as: a, ...s } = t;
2489
2503
  d = /* @__PURE__ */ n(
2490
2504
  "textarea",
2491
2505
  {
2492
2506
  ref: r,
2493
- ...s,
2494
- ...c
2507
+ ...c,
2508
+ ...s
2495
2509
  }
2496
2510
  );
2497
2511
  } else if ("as" in t && t.as === "select") {
2498
- const { name: u, label: g, labelClassName: p, as: a, children: c, ...S } = t;
2512
+ const { name: u, label: h, labelClassName: m, as: a, children: s, ...A } = t;
2499
2513
  d = /* @__PURE__ */ n(
2500
2514
  "select",
2501
2515
  {
2502
2516
  ref: r,
2503
- ...s,
2504
- ...S,
2505
- children: c
2517
+ ...c,
2518
+ ...A,
2519
+ children: s
2506
2520
  }
2507
2521
  );
2508
2522
  } else {
2509
- const { name: u, label: g, labelClassName: p, as: a, ...c } = t;
2523
+ const { name: u, label: h, labelClassName: m, as: a, ...s } = t;
2510
2524
  d = /* @__PURE__ */ n(
2511
2525
  "input",
2512
2526
  {
2513
2527
  ref: r,
2514
- ...s,
2515
- ...c
2528
+ ...c,
2529
+ ...s
2516
2530
  }
2517
2531
  );
2518
2532
  }
2519
- return o === void 0 ? d : /* @__PURE__ */ k("label", { className: l, children: [
2533
+ return o === void 0 ? d : /* @__PURE__ */ _("label", { className: l, children: [
2520
2534
  o,
2521
2535
  d
2522
2536
  ] });
2523
2537
  }
2524
2538
  );
2525
- function Er() {
2526
- const [e, t] = C([]), r = x((o) => {
2539
+ let Ht = 1;
2540
+ function Ar({
2541
+ onMount: e,
2542
+ defaultOpen: t = !1,
2543
+ storageKey: r = "ll-debug-open"
2544
+ }) {
2545
+ const [i, o] = N(t), [l, c] = N([]), [d, u] = N(""), [h, m] = N(!1), a = I(/* @__PURE__ */ new Set()), s = I([]), A = I(h);
2546
+ A.current = h, P(() => {
2547
+ try {
2548
+ const b = localStorage.getItem(r);
2549
+ b === "1" && o(!0), b === "0" && o(!1);
2550
+ } catch {
2551
+ }
2552
+ }, [r]), P(() => {
2553
+ try {
2554
+ localStorage.setItem(r, i ? "1" : "0");
2555
+ } catch {
2556
+ }
2557
+ }, [i, r]), P(() => {
2558
+ const b = (L) => {
2559
+ (L.metaKey || L.ctrlKey) && L.shiftKey && L.key.toLowerCase() === "l" && (L.preventDefault(), o((D) => !D));
2560
+ };
2561
+ return window.addEventListener("keydown", b), () => window.removeEventListener("keydown", b);
2562
+ }, []), P(() => {
2563
+ const b = setInterval(() => {
2564
+ if (s.current.length === 0 || A.current) return;
2565
+ const L = s.current.splice(0, s.current.length);
2566
+ c(
2567
+ (D) => [...L.reverse(), ...D].slice(0, 200)
2568
+ );
2569
+ }, 100);
2570
+ return () => clearInterval(b);
2571
+ }, []);
2572
+ const C = I(!1);
2573
+ if (P(() => {
2574
+ !e || C.current || (C.current = !0, e((b) => {
2575
+ s.current.push({
2576
+ id: Ht++,
2577
+ ts: Date.now(),
2578
+ kind: "event",
2579
+ type: b.eventName,
2580
+ data: b.data
2581
+ });
2582
+ }));
2583
+ }, [e]), P(() => {
2584
+ const b = console.warn, L = console.log, D = (M, z) => function(...p) {
2585
+ try {
2586
+ const g = typeof p[0] == "string" ? p[0] : "";
2587
+ g.startsWith("[LiveLayer]") && s.current.push({
2588
+ id: Ht++,
2589
+ ts: Date.now(),
2590
+ kind: M,
2591
+ type: g.slice(0, 120),
2592
+ data: { args: p.slice(1).map((E) => vr(E)) }
2593
+ });
2594
+ } catch {
2595
+ }
2596
+ return z.apply(this, p);
2597
+ };
2598
+ return console.warn = D("warn", b), console.log = D("log", L), () => {
2599
+ console.warn = b, console.log = L;
2600
+ };
2601
+ }, []), !i)
2602
+ return /* @__PURE__ */ n(
2603
+ "button",
2604
+ {
2605
+ type: "button",
2606
+ onClick: () => o(!0),
2607
+ title: "Open LiveLayer debug panel (Cmd/Ctrl + Shift + L)",
2608
+ "aria-label": "Open LiveLayer debug panel",
2609
+ style: {
2610
+ position: "fixed",
2611
+ left: 16,
2612
+ bottom: 16,
2613
+ zIndex: 2147483640,
2614
+ background: "#0d0d0d",
2615
+ color: "#fff",
2616
+ border: "1px solid rgba(255,255,255,0.18)",
2617
+ borderRadius: 999,
2618
+ padding: "6px 10px",
2619
+ font: "500 11px -apple-system, BlinkMacSystemFont, system-ui, sans-serif",
2620
+ letterSpacing: "-0.1px",
2621
+ cursor: "pointer",
2622
+ boxShadow: "0 4px 12px rgba(0,0,0,0.35)",
2623
+ opacity: 0.85
2624
+ },
2625
+ children: "🛰 LL debug"
2626
+ }
2627
+ );
2628
+ const R = l.filter((b) => {
2629
+ if (!d) return !0;
2630
+ const L = d.toLowerCase();
2631
+ return b.type.toLowerCase().includes(L) || JSON.stringify(b.data || {}).toLowerCase().includes(L);
2632
+ });
2633
+ return /* @__PURE__ */ _(
2634
+ "div",
2635
+ {
2636
+ style: {
2637
+ position: "fixed",
2638
+ left: 16,
2639
+ bottom: 16,
2640
+ zIndex: 2147483640,
2641
+ width: 380,
2642
+ maxHeight: "60vh",
2643
+ background: "#0d0d0d",
2644
+ color: "#fff",
2645
+ border: "1px solid rgba(255,255,255,0.16)",
2646
+ borderRadius: 12,
2647
+ boxShadow: "0 16px 48px rgba(0,0,0,0.5)",
2648
+ font: "500 11px -apple-system, BlinkMacSystemFont, system-ui, sans-serif",
2649
+ letterSpacing: "-0.1px",
2650
+ display: "flex",
2651
+ flexDirection: "column",
2652
+ overflow: "hidden"
2653
+ },
2654
+ children: [
2655
+ /* @__PURE__ */ _(
2656
+ "div",
2657
+ {
2658
+ style: {
2659
+ padding: "8px 10px",
2660
+ background: "rgba(255,255,255,0.04)",
2661
+ borderBottom: "1px solid rgba(255,255,255,0.1)",
2662
+ display: "flex",
2663
+ alignItems: "center",
2664
+ gap: 8
2665
+ },
2666
+ children: [
2667
+ /* @__PURE__ */ n("span", { style: { fontWeight: 600, fontSize: 12 }, children: "LiveLayer debug" }),
2668
+ /* @__PURE__ */ _("span", { style: { fontSize: 10, color: "rgba(255,255,255,0.4)" }, children: [
2669
+ l.length,
2670
+ " event",
2671
+ l.length === 1 ? "" : "s"
2672
+ ] }),
2673
+ /* @__PURE__ */ n("span", { style: { flex: 1 } }),
2674
+ /* @__PURE__ */ n(
2675
+ "button",
2676
+ {
2677
+ type: "button",
2678
+ onClick: () => m((b) => !b),
2679
+ style: at(h ? "#f59e0b" : "transparent"),
2680
+ title: "Pause / resume capture",
2681
+ children: h ? "▶ resume" : "⏸ pause"
2682
+ }
2683
+ ),
2684
+ /* @__PURE__ */ n(
2685
+ "button",
2686
+ {
2687
+ type: "button",
2688
+ onClick: () => {
2689
+ c([]), s.current = [];
2690
+ },
2691
+ style: at("transparent"),
2692
+ title: "Clear buffer",
2693
+ children: "clear"
2694
+ }
2695
+ ),
2696
+ /* @__PURE__ */ n(
2697
+ "button",
2698
+ {
2699
+ type: "button",
2700
+ onClick: () => o(!1),
2701
+ style: at("transparent"),
2702
+ "aria-label": "Close",
2703
+ title: "Close (Cmd/Ctrl + Shift + L)",
2704
+ children: "✕"
2705
+ }
2706
+ )
2707
+ ]
2708
+ }
2709
+ ),
2710
+ /* @__PURE__ */ n(
2711
+ "input",
2712
+ {
2713
+ type: "text",
2714
+ value: d,
2715
+ onChange: (b) => u(b.target.value),
2716
+ placeholder: "filter by type or data…",
2717
+ style: {
2718
+ margin: 8,
2719
+ padding: "6px 8px",
2720
+ background: "rgba(255,255,255,0.06)",
2721
+ border: "1px solid rgba(255,255,255,0.1)",
2722
+ borderRadius: 6,
2723
+ color: "#fff",
2724
+ fontSize: 11,
2725
+ outline: "none"
2726
+ }
2727
+ }
2728
+ ),
2729
+ /* @__PURE__ */ n(
2730
+ "div",
2731
+ {
2732
+ style: {
2733
+ flex: 1,
2734
+ overflowY: "auto",
2735
+ padding: "0 8px 8px"
2736
+ },
2737
+ children: R.length === 0 ? /* @__PURE__ */ _(
2738
+ "div",
2739
+ {
2740
+ style: {
2741
+ padding: 14,
2742
+ fontSize: 11,
2743
+ color: "rgba(255,255,255,0.4)",
2744
+ lineHeight: 1.5
2745
+ },
2746
+ children: [
2747
+ "No events yet. Connect to the agent and trigger a tool call — the events will stream in here. You can also dispatch commands manually in DevTools:",
2748
+ /* @__PURE__ */ n(
2749
+ "pre",
2750
+ {
2751
+ style: {
2752
+ marginTop: 6,
2753
+ background: "rgba(255,255,255,0.04)",
2754
+ padding: 6,
2755
+ borderRadius: 4,
2756
+ fontSize: 10,
2757
+ whiteSpace: "pre-wrap"
2758
+ },
2759
+ children: `window.__livelayerSimulateCommand({
2760
+ type: "navigate",
2761
+ href: "/about"
2762
+ })`
2763
+ }
2764
+ )
2765
+ ]
2766
+ }
2767
+ ) : R.map((b) => /* @__PURE__ */ n(
2768
+ yr,
2769
+ {
2770
+ entry: b,
2771
+ expanded: a.current.has(b.id),
2772
+ onToggle: () => {
2773
+ a.current.has(b.id) ? a.current.delete(b.id) : a.current.add(b.id), c((L) => [...L]);
2774
+ }
2775
+ },
2776
+ b.id
2777
+ ))
2778
+ }
2779
+ )
2780
+ ]
2781
+ }
2782
+ );
2783
+ }
2784
+ function yr({
2785
+ entry: e,
2786
+ expanded: t,
2787
+ onToggle: r
2788
+ }) {
2789
+ 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", {
2790
+ hour12: !1
2791
+ });
2792
+ return /* @__PURE__ */ _(
2793
+ "button",
2794
+ {
2795
+ type: "button",
2796
+ onClick: r,
2797
+ style: {
2798
+ textAlign: "left",
2799
+ background: "transparent",
2800
+ border: 0,
2801
+ color: "#fff",
2802
+ width: "100%",
2803
+ padding: "6px 4px",
2804
+ cursor: "pointer",
2805
+ borderBottom: "1px solid rgba(255,255,255,0.04)",
2806
+ fontSize: 11,
2807
+ lineHeight: 1.4
2808
+ },
2809
+ children: [
2810
+ /* @__PURE__ */ _("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
2811
+ /* @__PURE__ */ n(
2812
+ "span",
2813
+ {
2814
+ style: {
2815
+ color: "rgba(255,255,255,0.4)",
2816
+ fontVariantNumeric: "tabular-nums",
2817
+ fontSize: 10
2818
+ },
2819
+ children: o
2820
+ }
2821
+ ),
2822
+ /* @__PURE__ */ n(
2823
+ "span",
2824
+ {
2825
+ style: {
2826
+ color: i,
2827
+ fontWeight: 600,
2828
+ flexShrink: 0
2829
+ },
2830
+ children: e.type.length > 50 ? e.type.slice(0, 50) + "…" : e.type
2831
+ }
2832
+ )
2833
+ ] }),
2834
+ t && e.data && /* @__PURE__ */ n(
2835
+ "pre",
2836
+ {
2837
+ style: {
2838
+ marginTop: 6,
2839
+ padding: 6,
2840
+ background: "rgba(255,255,255,0.04)",
2841
+ borderRadius: 4,
2842
+ fontSize: 10,
2843
+ overflowX: "auto",
2844
+ whiteSpace: "pre-wrap",
2845
+ wordBreak: "break-all"
2846
+ },
2847
+ children: JSON.stringify(e.data, null, 2)
2848
+ }
2849
+ )
2850
+ ]
2851
+ }
2852
+ );
2853
+ }
2854
+ function at(e) {
2855
+ return {
2856
+ background: e,
2857
+ color: "#fff",
2858
+ border: "1px solid rgba(255,255,255,0.16)",
2859
+ borderRadius: 999,
2860
+ padding: "3px 8px",
2861
+ fontSize: 10,
2862
+ cursor: "pointer"
2863
+ };
2864
+ }
2865
+ function vr(e) {
2866
+ try {
2867
+ return e instanceof Error ? { message: e.message, stack: e.stack } : (JSON.stringify(e), e);
2868
+ } catch {
2869
+ return String(e);
2870
+ }
2871
+ }
2872
+ function Rr() {
2873
+ const [e, t] = N([]), r = S((o) => {
2527
2874
  t((l) => {
2528
- const s = l.findIndex((d) => d.id === o.id);
2529
- if (s >= 0) {
2875
+ const c = l.findIndex((d) => d.id === o.id);
2876
+ if (c >= 0) {
2530
2877
  const d = l.slice();
2531
- return d[s] = o, d;
2878
+ return d[c] = o, d;
2532
2879
  }
2533
2880
  return [...l, o];
2534
2881
  });
2535
- }, []), i = x(() => t([]), []);
2882
+ }, []), i = S(() => t([]), []);
2536
2883
  return {
2537
2884
  entries: e,
2538
2885
  pushSegment: r,
@@ -2541,31 +2888,32 @@ function Er() {
2541
2888
  };
2542
2889
  }
2543
2890
  export {
2544
- wr as AvatarWidget,
2545
- cn as ErrorBoundary,
2546
- Lr as LiveLayerField,
2547
- kr as LiveLayerForm,
2548
- xr as LiveLayerRegion,
2549
- _r as LiveLayerWidget,
2550
- ir as clearPageContextCache,
2551
- dr as clearRoutesCache,
2552
- rr as extractPageContext,
2553
- ar as extractRoutes,
2554
- zt as getCachedPageContext,
2555
- sr as getCachedRoutes,
2556
- Mn as matchesPattern,
2557
- Rn as shouldRenderAtPath,
2558
- gn as useAgentInfo,
2559
- dn as useAudioLevel,
2560
- pn as useCameraState,
2561
- bn as useDisplayMode,
2562
- xn as useDisplayModePersistence,
2563
- Ln as useIsMobile,
2564
- sn as useLiveKitSession,
2565
- mn as useMediaDevices,
2566
- un as useMicrophoneState,
2567
- Cn as usePathname,
2568
- Tn as useRouteMatch,
2569
- hn as useScreenShareState,
2570
- Er as useTranscript
2891
+ Lr as AvatarWidget,
2892
+ dn as ErrorBoundary,
2893
+ Ar as LiveLayerDebugPanel,
2894
+ Nr as LiveLayerField,
2895
+ Er as LiveLayerForm,
2896
+ Cr as LiveLayerRegion,
2897
+ Sr as LiveLayerWidget,
2898
+ lr as clearPageContextCache,
2899
+ fr as clearRoutesCache,
2900
+ or as extractPageContext,
2901
+ cr as extractRoutes,
2902
+ Ot as getCachedPageContext,
2903
+ ur as getCachedRoutes,
2904
+ Tn as matchesPattern,
2905
+ Pn as shouldRenderAtPath,
2906
+ vn as useAgentInfo,
2907
+ fn as useAudioLevel,
2908
+ mn as useCameraState,
2909
+ _n as useDisplayMode,
2910
+ Ln as useDisplayModePersistence,
2911
+ Cn as useIsMobile,
2912
+ un as useLiveKitSession,
2913
+ yn as useMediaDevices,
2914
+ pn as useMicrophoneState,
2915
+ Nn as usePathname,
2916
+ Dn as useRouteMatch,
2917
+ gn as useScreenShareState,
2918
+ Rr as useTranscript
2571
2919
  };