@livelayer/react 0.5.1 → 0.5.3

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 Ke, forwardRef as at, 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 Bt } from "react/jsx-runtime";
3
+ import { Component as ln, useState as N, useRef as I, useEffect as P, useCallback as S, useMemo as Je, forwardRef as ct, createElement as an } from "react";
4
+ import { LiveKitSession as cn } from "@livelayer/sdk";
5
+ import { createLocalAudioTrack as sn, Track as Wt, createLocalVideoTrack as dn } from "livekit-client";
6
+ class un extends ln {
7
7
  constructor() {
8
8
  super(...arguments), this.state = { hasError: !1, error: null }, this.reset = () => {
9
9
  this.setState({ hasError: !1, error: null });
@@ -13,12 +13,12 @@ class cn extends nn {
13
13
  return { hasError: !0, error: t };
14
14
  }
15
15
  componentDidCatch(t, r) {
16
- var i, o;
17
- (o = (i = this.props).onError) == null || o.call(i, t, r);
16
+ var o, i;
17
+ (i = (o = this.props).onError) == null || i.call(o, t, r);
18
18
  }
19
19
  render() {
20
20
  var t;
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), [y, p] = C(null), [a, c] = C(null), [S, L] = C(!1), [N, H] = C(null), R = M(null), $ = M(e.onDataMessage);
36
+ function fn(e) {
37
+ const [t, r] = N("idle"), [o, i] = N("idle"), [l, s] = N([]), [d, u] = N(null), [h, m] = N(null), [a, c] = N(null), [A, C] = N(!1), [R, b] = N(null), L = I(null), $ = I(e.onDataMessage);
38
38
  $.current = e.onDataMessage, P(() => {
39
- const v = {
40
- onConnectionStateChange: (w) => {
41
- r(w), w === "connected" && H(null);
39
+ const g = {
40
+ onConnectionStateChange: (x) => {
41
+ r(x), x === "connected" && b(null);
42
42
  },
43
- onAgentStateChange: o,
44
- onTranscript: (w) => s([...w]),
43
+ onAgentStateChange: i,
44
+ onTranscript: (x) => s([...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) => c(x),
47
+ onVideoTrack: (x) => m(x),
48
+ onVideoTrackRemoved: () => m(null),
49
+ onError: (x) => b(x),
50
+ onDataMessage: (x) => {
51
+ var q;
52
+ (q = $.current) == null || q.call($, x);
53
53
  },
54
- onResumabilityChange: L
55
- }, E = new on(
54
+ onResumabilityChange: C
55
+ }, E = new cn(
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
- v
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"), i("idle"), s([]), u(null), m(null), c(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,41 +73,41 @@ function sn(e) {
73
73
  e.sessionEndpoint,
74
74
  JSON.stringify(e.sessionBody ?? {})
75
75
  ]);
76
- const I = x(async () => {
77
- const v = R.current;
78
- if (v)
76
+ const M = S(async () => {
77
+ const g = L.current;
78
+ if (g)
79
79
  try {
80
- await v.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 v = R.current;
86
- v && v.disconnect();
87
- }, []), g = x(() => {
88
- var v;
89
- return ((v = R.current) == null ? void 0 : v.getRoom()) ?? null;
84
+ }, []), H = 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
- agentState: i,
93
+ agentState: o,
94
94
  transcript: l,
95
95
  agentConfig: d,
96
- videoElement: y,
96
+ videoElement: h,
97
97
  audioElement: a,
98
- canResume: S,
99
- error: N,
100
- connect: I,
101
- disconnect: D,
102
- getRoom: g,
103
- session: R.current
98
+ canResume: A,
99
+ error: R,
100
+ connect: M,
101
+ disconnect: H,
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 pn() {
107
+ const e = I(null), t = I(null), r = I(null), o = I(null), i = I(/* @__PURE__ */ new Set()), l = I(null), s = S(() => {
108
108
  const a = t.current;
109
109
  if (!a) {
110
- i.current = null;
110
+ o.current = null;
111
111
  return;
112
112
  }
113
113
  (!l.current || l.current.length !== a.frequencyBinCount) && (l.current = new Uint8Array(
@@ -115,21 +115,21 @@ function dn() {
115
115
  ));
116
116
  const c = l.current;
117
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)
118
+ let A = 0;
119
+ for (let R = 0; R < c.length; R++) A += c[R];
120
+ const C = A / c.length / 255;
121
+ for (const R of i.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
+ o.current = requestAnimationFrame(s);
128
+ }, []), d = S(() => {
129
129
  if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
130
130
  const a = new AudioContext(), c = a.createAnalyser();
131
131
  c.fftSize = 64, c.connect(a.destination), e.current = a, t.current = c;
132
- }, []), u = x(
132
+ }, []), u = S(
133
133
  (a) => {
134
134
  if (d(), !(!e.current || !t.current)) {
135
135
  if (r.current) {
@@ -146,23 +146,23 @@ function dn() {
146
146
  console.warn("[useAudioLevel] createMediaElementSource failed:", c);
147
147
  return;
148
148
  }
149
- i.current === null && (i.current = requestAnimationFrame(s));
149
+ o.current === null && (o.current = requestAnimationFrame(s));
150
150
  }
151
151
  },
152
152
  [d, s]
153
- ), y = x(() => {
154
- if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), r.current) {
153
+ ), h = S(() => {
154
+ if (o.current !== null && (cancelAnimationFrame(o.current), o.current = null), r.current) {
155
155
  try {
156
156
  r.current.disconnect();
157
157
  } catch {
158
158
  }
159
159
  r.current = null;
160
160
  }
161
- }, []), p = x((a) => (o.current.add(a), () => {
162
- o.current.delete(a);
161
+ }, []), m = S((a) => (i.current.add(a), () => {
162
+ i.current.delete(a);
163
163
  }), []);
164
164
  return P(() => () => {
165
- if (y(), t.current) {
165
+ if (h(), t.current) {
166
166
  try {
167
167
  t.current.disconnect();
168
168
  } catch {
@@ -176,81 +176,81 @@ function dn() {
176
176
  }
177
177
  e.current = null;
178
178
  }
179
- o.current.clear(), l.current = null;
180
- }, [y]), { attach: u, detach: y, subscribe: p };
179
+ i.current.clear(), l.current = null;
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) => {
184
- if (o.current && l.current) {
182
+ function hn() {
183
+ const [e, t] = N(!1), [r, o] = N(null), i = I(null), l = I(null), s = S(async (m) => {
184
+ if (i.current && l.current) {
185
185
  try {
186
- await l.current.localParticipant.unpublishTrack(o.current);
186
+ await l.current.localParticipant.unpublishTrack(i.current);
187
187
  } catch {
188
188
  }
189
- o.current.stop(), o.current = null;
189
+ i.current.stop(), i.current = null;
190
190
  }
191
- l.current = p, i(null);
191
+ l.current = m, o(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), i.current = a, t(a.isMuted);
198
198
  } catch (a) {
199
199
  const c = a instanceof Error && a.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
200
- throw i(c), a;
200
+ throw o(c), a;
201
201
  }
202
- }, []), 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 = i.current;
204
+ m && (m.isMuted ? (m.unmute(), t(!1)) : (m.mute(), t(!0)));
205
+ }, []), u = S(() => {
206
+ const m = i.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
- o.current = null, l.current = null, t(!1);
215
- }, []), y = x(() => i(null), []);
214
+ i.current = null, l.current = null, t(!1);
215
+ }, []), h = S(() => o(null), []);
216
216
  return {
217
217
  isMuted: e,
218
218
  micError: r,
219
219
  toggleMute: d,
220
220
  setupMic: s,
221
221
  teardownMic: u,
222
- clearError: y
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), y = M(null), p = x((R) => {
228
- u.current = R;
229
- }, []), a = x(() => {
230
- const R = u.current, $ = y.current;
231
- if ($ && R) {
232
- const I = R.localParticipant.getTrackPublication(Ot.Source.Camera);
233
- if (I != null && I.track) {
225
+ const mn = { resolution: { width: 640, height: 480, frameRate: 24 } };
226
+ function gn() {
227
+ const [e, t] = N(!1), [r, o] = N(null), [i, l] = N(null), [s, d] = N(""), u = I(null), h = I(null), m = S((L) => {
228
+ u.current = L;
229
+ }, []), a = S(() => {
230
+ const L = u.current, $ = h.current;
231
+ if ($ && L) {
232
+ const M = L.localParticipant.getTrackPublication(Wt.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
240
  $.stop();
241
241
  }
242
- y.current = null, l(null), t(!1);
243
- }, []), c = x(async (R) => {
242
+ h.current = null, l(null), t(!1);
243
+ }, []), c = S(async (L) => {
244
244
  const $ = u.current;
245
245
  if ($) {
246
- i(null);
246
+ o(null);
247
247
  try {
248
- const I = { ...fn };
249
- R && (I.deviceId = R);
250
- const D = await an(I);
251
- await $.localParticipant.publishTrack(D), y.current = D;
252
- const g = D.attach();
253
- l(g), t(!0), R && d(R);
248
+ const M = { ...mn };
249
+ L && (M.deviceId = L);
250
+ const H = await dn(M);
251
+ await $.localParticipant.publishTrack(H), h.current = H;
252
+ const p = H.attach();
253
+ l(p), t(!0), L && d(L);
254
254
  try {
255
255
  $.localParticipant.publishData(
256
256
  new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
@@ -258,36 +258,36 @@ function pn() {
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 H = M instanceof Error && M.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
263
+ o(H);
264
264
  }
265
265
  }
266
- }, []), S = x(async () => {
266
+ }, []), A = S(async () => {
267
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(() => {
271
- a(), u.current = null, i(null), d("");
272
- }, [a]), H = x(() => i(null), []);
268
+ }, [e, s, a, c]), C = S(async (L) => {
269
+ a(), await c(L);
270
+ }, [a, c]), R = S(() => {
271
+ a(), u.current = null, o(null), d("");
272
+ }, [a]), b = S(() => o(null), []);
273
273
  return P(() => () => {
274
- y.current && y.current.stop();
274
+ h.current && h.current.stop();
275
275
  }, []), {
276
276
  isEnabled: e,
277
277
  error: r,
278
- previewEl: o,
278
+ previewEl: i,
279
279
  activeDeviceId: s,
280
- toggle: S,
281
- switchDevice: L,
282
- attachRoom: p,
283
- teardown: N,
284
- clearError: H
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) => {
287
+ function yn() {
288
+ const [e, t] = N(!1), [r, o] = N(null), [i, l] = N(null), s = I(null), d = S((c) => {
289
289
  s.current = c;
290
- }, []), u = x(() => l(null), []), y = x(async () => {
290
+ }, []), u = S(() => l(null), []), h = S(async () => {
291
291
  const c = s.current;
292
292
  if (c) {
293
293
  if (e) {
@@ -298,15 +298,15 @@ function hn() {
298
298
  u(), t(!1);
299
299
  return;
300
300
  }
301
- i(null);
301
+ o(null);
302
302
  try {
303
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);
304
+ let A = 0;
305
+ const C = () => {
306
+ const R = c.localParticipant.getTrackPublication(Wt.Source.ScreenShare);
307
+ if (R != null && R.track) {
308
+ const b = R.track.attach();
309
+ l(b), t(!0);
310
310
  try {
311
311
  c.localParticipant.publishData(
312
312
  new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
@@ -316,50 +316,50 @@ 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" && o("Screen share unavailable. Try again."), t(!1);
325
325
  }
326
326
  }
327
- }, [e, u]), p = x(() => {
327
+ }, [e, u]), m = S(() => {
328
328
  const c = s.current;
329
329
  if (c && e)
330
330
  try {
331
331
  c.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: y, attachRoom: d, teardown: p, clearError: a };
334
+ u(), t(!1), o(null), s.current = null;
335
+ }, [e, u]), a = S(() => o(null), []);
336
+ return { isEnabled: e, error: r, previewEl: i, 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 vn() {
339
+ const [e, t] = N([]), [r, o] = N([]), i = 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((s) => s.kind === "audioinput")), o(l.filter((s) => s.kind === "videoinput"));
344
344
  } catch {
345
345
  }
346
346
  }, []);
347
347
  return P(() => {
348
- if (o(), typeof navigator > "u" || !navigator.mediaDevices) return;
349
- const l = () => void o();
348
+ if (i(), typeof navigator > "u" || !navigator.mediaDevices) return;
349
+ const l = () => void i();
350
350
  return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
351
- }, [o]), { mics: e, cameras: r, refresh: o };
351
+ }, [i]), { mics: e, cameras: r, refresh: i };
352
352
  }
353
- function gn(e, t, r = !1) {
354
- const [i, o] = C(null), [l, s] = C(null), [d, u] = C(!r && !!e);
353
+ function bn(e, t, r = !1) {
354
+ const [o, i] = N(null), [l, s] = 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 y = new AbortController(), p = t || "https://app.livelayer.studio";
361
- return u(!0), s(null), fetch(`${p}/api/widget/agent/${encodeURIComponent(e)}`, {
362
- signal: y.signal
360
+ const h = new AbortController(), m = t || "https://app.livelayer.studio";
361
+ return u(!0), s(null), fetch(`${m}/api/widget/agent/${encodeURIComponent(e)}`, {
362
+ signal: h.signal
363
363
  }).then(async (a) => {
364
364
  if (!a.ok) {
365
365
  const c = await a.json().catch(() => ({}));
@@ -367,13 +367,13 @@ function gn(e, t, r = !1) {
367
367
  }
368
368
  return a.json();
369
369
  }).then((a) => {
370
- y.signal.aborted || (o(a), u(!1));
370
+ h.signal.aborted || (i(a), u(!1));
371
371
  }).catch((a) => {
372
- y.signal.aborted || (s(a instanceof Error ? a.message : "Agent lookup failed"), u(!1));
373
- }), () => y.abort();
374
- }, [e, t, r]), { info: i, error: l, loading: d };
372
+ h.signal.aborted || (s(a instanceof Error ? a.message : "Agent lookup failed"), u(!1));
373
+ }), () => h.abort();
374
+ }, [e, t, r]), { info: o, error: l, loading: d };
375
375
  }
376
- function yn(e) {
376
+ function wn(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 _n(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 xn({
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 o = e !== void 0, [i, l] = N(t), s = o ? e : i, d = S(
397
397
  (u) => {
398
- u !== s && (i || l(u), r == null || r(u));
398
+ u !== s && (o || l(u), r == null || r(u));
399
399
  },
400
- [s, i, r]
400
+ [s, o, r]
401
401
  );
402
402
  return [s, d];
403
403
  }
404
- const wn = ["hidden", "minimized", "expanded"];
405
- function _n(e) {
406
- return e && wn.includes(e) ? e : null;
404
+ const kn = ["hidden", "minimized", "expanded"];
405
+ function Ln(e) {
406
+ return e && kn.includes(e) ? e : null;
407
407
  }
408
- function xn({
408
+ function Sn({
409
409
  value: e,
410
410
  defaultValue: t = "expanded",
411
411
  onChange: r,
412
- persistKey: i = "ll-widget",
413
- disablePersistence: o = !1
412
+ persistKey: o = "ll-widget",
413
+ disablePersistence: i = !1
414
414
  } = {}) {
415
- const l = `${i}:display-mode`, s = M(!1), [d, u] = bn({
415
+ const l = `${o}:display-mode`, s = I(!1), [d, u] = xn({
416
416
  value: e,
417
417
  defaultValue: t,
418
- onChange: (y) => {
419
- e === void 0 && !o && vn(l, y), r == null || r(y);
418
+ onChange: (h) => {
419
+ e === void 0 && !i && _n(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 y = _n(yn(l));
425
- y && y !== d && u(y);
423
+ if (s.current || (s.current = !0, i || e !== void 0)) return;
424
+ const h = Ln(wn(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 Cn = 640;
429
+ function En(e = Cn) {
430
+ const [t, r] = N(!1);
431
431
  return P(() => {
432
432
  if (e === !1) {
433
433
  r(!1);
@@ -435,73 +435,73 @@ function Ln(e = kn) {
435
435
  }
436
436
  if (typeof window > "u" || typeof window.matchMedia > "u")
437
437
  return;
438
- const i = `(max-width: ${e - 1}px)`, o = window.matchMedia(i), l = () => r(o.matches);
439
- return l(), typeof o.addEventListener == "function" ? (o.addEventListener("change", l), () => o.removeEventListener("change", l)) : (o.addListener(l), () => {
440
- o.removeListener(l);
438
+ const o = `(max-width: ${e - 1}px)`, i = window.matchMedia(o), l = () => r(i.matches);
439
+ return l(), typeof i.addEventListener == "function" ? (i.addEventListener("change", l), () => i.removeEventListener("change", l)) : (i.addListener(l), () => {
440
+ i.removeListener(l);
441
441
  });
442
442
  }, [e]), t;
443
443
  }
444
- const Lt = "__llHistoryPatched", Xe = "ll:pathname";
445
- function En() {
446
- if (typeof window > "u" || window.history[Lt]) return;
444
+ const St = "__llHistoryPatched", Ke = "ll:pathname";
445
+ function Nn() {
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
- const i = e.apply(this, r);
450
- return window.dispatchEvent(new Event(Xe)), i;
449
+ const o = e.apply(this, r);
450
+ return window.dispatchEvent(new Event(Ke)), o;
451
451
  }, window.history.replaceState = function(...r) {
452
- const i = t.apply(this, r);
453
- return window.dispatchEvent(new Event(Xe)), i;
454
- }, window.history[Lt] = !0;
452
+ const o = t.apply(this, r);
453
+ return window.dispatchEvent(new Event(Ke)), o;
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 An(e) {
460
+ const [t, r] = N(
461
+ () => e ?? Ct()
462
462
  );
463
463
  return P(() => {
464
464
  if (e !== void 0) return;
465
- En();
466
- const i = () => r(Et());
467
- return i(), window.addEventListener("popstate", i), window.addEventListener(Xe, i), () => {
468
- window.removeEventListener("popstate", i), window.removeEventListener(Xe, i);
465
+ Nn();
466
+ const o = () => r(Ct());
467
+ return o(), window.addEventListener("popstate", o), window.addEventListener(Ke, o), () => {
468
+ window.removeEventListener("popstate", o), window.removeEventListener(Ke, o);
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(), Rn = /[\\^$+?.()|{}[\]]/g;
473
+ function In(e) {
474
+ return e.replace(Rn, "\\$&");
475
475
  }
476
- function An(e) {
477
- const t = Ct.get(e);
476
+ function Mn(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, o = "", i = "", l = r.replace(/\*\*/g, o).replace(/\*/g, i), d = In(l).replace(new RegExp(`\\/${o}`, "g"), "(?:\\/.*)?").replace(new RegExp(o, "g"), ".*").replace(new RegExp(i, "g"), "[^/]+"), u = new RegExp(`^${d}\\/?$`);
480
+ return Et.set(e, u), u;
481
481
  }
482
- function In(e, t) {
482
+ function Tn(e, t) {
483
483
  const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
484
- return An(e).test(r);
484
+ return Mn(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 Pn(e, t) {
487
+ return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : Tn(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 (Pn(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 Dn(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 Ke(
500
- () => Rn(e, t, r),
498
+ function $n(e, t, r) {
499
+ return Je(
500
+ () => Dn(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
+ ), zn = ({ 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
+ ), Hn = {
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(${Hn[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 qn(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", Bn = 5, It = 16;
601
+ function Wn() {
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,161 +612,161 @@ 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
- onExpand: i,
624
- label: o = "Open widget"
623
+ onExpand: o,
624
+ label: i = "Open widget"
625
625
  }) => {
626
- const l = zn(e), s = l === "right" ? "left" : "right", d = t ? 80 : 72, [u, y] = C(null), [p, a] = C(!1), c = M(null), S = M(!1), L = x(
627
- (v) => {
628
- if (typeof window > "u") return v;
629
- const E = d / 2, w = It + E, O = window.innerHeight - It - E;
630
- return O < w ? Math.max(w, v) : Math.max(w, Math.min(O, v));
626
+ const l = qn(e), s = l === "right" ? "left" : "right", d = t ? 80 : 72, [u, h] = N(null), [m, a] = N(!1), c = I(null), A = I(!1), C = S(
627
+ (g) => {
628
+ if (typeof window > "u") return g;
629
+ const E = d / 2, x = It + E, q = window.innerHeight - It - E;
630
+ return q < x ? Math.max(x, g) : Math.max(x, Math.min(q, g));
631
631
  },
632
632
  [d]
633
633
  );
634
634
  P(() => {
635
- const v = On();
636
- y(L(v ?? window.innerHeight / 2));
635
+ const g = Wn();
636
+ h(C(g ?? window.innerHeight / 2));
637
637
  const E = () => {
638
- y((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
- (v) => {
644
- if (!(v.pointerType === "mouse" && v.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
- v.currentTarget.setPointerCapture(v.pointerId);
646
+ g.currentTarget.setPointerCapture(g.pointerId);
647
647
  } catch {
648
648
  }
649
649
  c.current = {
650
- startClientY: v.clientY,
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
- (v) => {
657
+ ), b = S(
658
+ (g) => {
659
659
  const E = c.current;
660
660
  if (!E) return;
661
- const w = v.clientY - E.startClientY;
662
- !E.moved && Math.abs(w) > Hn && (E.moved = !0, a(!0)), E.moved && y(L(E.startCenterY + w));
661
+ const x = g.clientY - E.startClientY;
662
+ !E.moved && Math.abs(x) > Bn && (E.moved = !0, a(!0)), E.moved && h(C(E.startCenterY + x));
663
663
  },
664
- [L]
665
- ), R = x(
666
- (v) => {
664
+ [C]
665
+ ), L = S(
666
+ (g) => {
667
667
  const E = c.current;
668
668
  if (E) {
669
669
  try {
670
- v.currentTarget.releasePointerCapture(v.pointerId);
670
+ g.currentTarget.releasePointerCapture(g.pointerId);
671
671
  } catch {
672
672
  }
673
- c.current = null, E.moved && (a(!1), S.current = !0, y((w) => (w !== null && Mt(w), w)));
673
+ c.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
+ ), $ = S(() => {
678
+ if (A.current) {
679
+ A.current = !1;
680
680
  return;
681
681
  }
682
- i();
683
- }, [i]), I = x(
684
- (v) => {
685
- if (v.key === "ArrowUp" || v.key === "ArrowDown") {
686
- v.preventDefault();
687
- const E = v.key === "ArrowUp" ? -8 : 8;
688
- y((w) => {
689
- if (w === null) return w;
690
- const O = L(w + E);
691
- return Mt(O), O;
682
+ o();
683
+ }, [o]), 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 q = C(x + E);
691
+ return Mt(q), q;
692
692
  });
693
693
  }
694
694
  },
695
- [L]
696
- ), D = [
695
+ [C]
696
+ ), H = [
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(" "), g = 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,
707
+ className: H,
708
+ onPointerDown: R,
709
+ onPointerMove: b,
710
+ onPointerUp: L,
711
+ onPointerCancel: L,
712
712
  onClick: $,
713
- onKeyDown: I,
714
- "aria-label": o,
713
+ onKeyDown: M,
714
+ "aria-label": i,
715
715
  "data-position": e,
716
- style: g,
717
- children: /* @__PURE__ */ n($n, { direction: s, className: "ll-hidden__chevron" })
716
+ style: p,
717
+ children: /* @__PURE__ */ n(On, { direction: s, 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,
724
- minHeight: i = 4,
725
- className: o,
724
+ minHeight: o = 4,
725
+ className: i,
726
726
  barClassName: l
727
727
  }) => {
728
- const s = M(null), d = M([]), u = Ke(() => {
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 s = I(null), d = I([]), u = Je(() => {
729
+ const m = (Math.sqrt(5) - 1) / 2;
730
+ return Array.from({ length: t }, (a, c) => 0.5 + c * m % 1 * 0.5);
731
731
  }, [t]);
732
732
  P(() => e.subscribe((a) => {
733
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`;
734
+ const A = d.current[c];
735
+ if (!A) continue;
736
+ const C = Math.max(o, a * r * u[c]);
737
+ A.style.height = `${C}px`;
738
738
  }
739
- }), [e, t, r, i, u]);
740
- const y = ["ll-waveform", o].filter(Boolean).join(" ");
741
- return /* @__PURE__ */ n("div", { ref: s, className: y, "aria-hidden": "true", children: Array.from({ length: t }, (p, a) => /* @__PURE__ */ n(
739
+ }), [e, t, r, o, u]);
740
+ const h = ["ll-waveform", i].filter(Boolean).join(" ");
741
+ return /* @__PURE__ */ n("div", { ref: s, className: h, "aria-hidden": "true", children: Array.from({ length: t }, (m, a) => /* @__PURE__ */ n(
742
742
  "div",
743
743
  {
744
744
  ref: (c) => {
745
745
  d.current[a] = c;
746
746
  },
747
747
  className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
748
- style: { height: `${i}px` }
748
+ style: { height: `${o}px` }
749
749
  },
750
750
  a
751
751
  )) });
752
- }, Un = ({
752
+ }, jn = ({
753
753
  position: e,
754
754
  isMobile: t,
755
755
  agentName: r,
756
- avatarImageUrl: i,
757
- agentState: o,
756
+ avatarImageUrl: o,
757
+ agentState: i,
758
758
  isMuted: l,
759
759
  audioLevel: s,
760
760
  onExpand: d,
761
761
  onToggleMute: u,
762
- onClose: y
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",
@@ -774,19 +774,19 @@ const qn = ({
774
774
  onClick: d,
775
775
  "aria-label": `Expand ${r} widget`,
776
776
  children: [
777
- i ? (
777
+ o ? (
778
778
  // eslint-disable-next-line @next/next/no-img-element
779
779
  /* @__PURE__ */ n(
780
780
  "img",
781
781
  {
782
- src: i,
782
+ src: o,
783
783
  alt: r,
784
784
  className: "ll-minimized__avatar"
785
785
  }
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
791
  audioLevel: s,
792
792
  bars: 16,
@@ -795,24 +795,24 @@ const qn = ({
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,23 +825,23 @@ 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: [
829
- i ? (
828
+ children: /* @__PURE__ */ _("div", { className: "ll-minimized__surface", children: [
829
+ o ? (
830
830
  // eslint-disable-next-line @next/next/no-img-element
831
831
  /* @__PURE__ */ n(
832
832
  "img",
833
833
  {
834
- src: i,
834
+ src: o,
835
835
  alt: r,
836
836
  className: "ll-minimized__avatar"
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
- /* @__PURE__ */ n("span", { className: "ll-minimized__state", children: o === "speaking" ? "Speaking" : o === "thinking" ? "Thinking" : "Listening" })
842
+ /* @__PURE__ */ n("span", { className: "ll-minimized__state", children: i === "speaking" ? "Speaking" : i === "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,22 +867,22 @@ const qn = ({
867
867
  {
868
868
  type: "button",
869
869
  className: "ll-minimized__btn ll-minimized__btn--close",
870
- onClick: y,
870
+ onClick: h,
871
871
  "aria-label": "Close widget",
872
- children: /* @__PURE__ */ n(Pn, { className: "ll-minimized__icon" })
872
+ children: /* @__PURE__ */ n(zn, { className: "ll-minimized__icon" })
873
873
  }
874
874
  )
875
875
  ] })
876
876
  ] })
877
877
  }
878
- ), Fn = ({
878
+ ), Vn = ({
879
879
  src: e,
880
880
  alt: t,
881
881
  preCannedPlaying: r = !1,
882
- className: i,
883
- style: o
882
+ className: o,
883
+ style: i
884
884
  }) => {
885
- const [l, s] = C(!1), d = M(e);
885
+ const [l, s] = N(!1), d = I(e);
886
886
  if (P(() => {
887
887
  d.current !== e && (d.current = e, s(!1));
888
888
  }, [e]), !e) return null;
@@ -896,7 +896,7 @@ const qn = ({
896
896
  transition: "opacity 500ms ease, transform 500ms ease",
897
897
  transform: r ? "scale(1.02)" : "scale(1)",
898
898
  opacity: l ? 1 : 0,
899
- ...o
899
+ ...i
900
900
  };
901
901
  return (
902
902
  // eslint-disable-next-line @next/next/no-img-element
@@ -905,7 +905,7 @@ const qn = ({
905
905
  {
906
906
  src: e,
907
907
  alt: t,
908
- className: i,
908
+ className: o,
909
909
  style: u,
910
910
  loading: "eager",
911
911
  fetchpriority: "high",
@@ -913,41 +913,41 @@ const qn = ({
913
913
  }
914
914
  )
915
915
  );
916
- }, Wn = ({
916
+ }, Yn = ({
917
917
  position: e,
918
918
  isMobile: t,
919
919
  agentName: r,
920
- avatarImageUrl: i,
921
- idleLoopUrl: o,
920
+ avatarImageUrl: o,
921
+ idleLoopUrl: i,
922
922
  greeting: l,
923
923
  branding: s,
924
924
  teamMembers: d,
925
925
  currentTeamMemberId: u,
926
- isSwitchingTeamMember: y,
927
- teamSwitcherOpen: p,
926
+ isSwitchingTeamMember: h,
927
+ teamSwitcherOpen: m,
928
928
  onToggleTeamSwitcher: a,
929
929
  onSelectTeamMember: c,
930
- languageMenuOpen: S,
931
- onToggleLanguageMenu: L,
932
- connectionState: N,
933
- agentState: H,
934
- transcript: R,
930
+ languageMenuOpen: A,
931
+ onToggleLanguageMenu: C,
932
+ connectionState: R,
933
+ agentState: b,
934
+ transcript: L,
935
935
  canResume: $,
936
- needsUserGesture: I,
937
- error: D,
938
- isMuted: g,
939
- micError: v,
936
+ needsUserGesture: M,
937
+ error: H,
938
+ isMuted: p,
939
+ micError: g,
940
940
  micDevices: E,
941
- isCameraEnabled: w,
942
- cameraPreviewEl: O,
943
- cameraDevices: J,
941
+ isCameraEnabled: x,
942
+ cameraPreviewEl: q,
943
+ cameraDevices: X,
944
944
  activeCameraId: de,
945
945
  isScreenShareEnabled: Q,
946
946
  screenPreviewEl: Z,
947
947
  isSpeakerMuted: ue,
948
948
  allowCamera: qe,
949
949
  allowScreenShare: Be,
950
- allowTyping: Ue,
950
+ allowTyping: We,
951
951
  avatarVideoContainerRef: Ne,
952
952
  onConnect: fe,
953
953
  onDisconnect: ge,
@@ -956,49 +956,49 @@ const qn = ({
956
956
  onToggleMute: be,
957
957
  onToggleCamera: we,
958
958
  onSwitchCameraDevice: _e,
959
- onToggleScreenShare: q,
959
+ onToggleScreenShare: W,
960
960
  onToggleSpeaker: Qe,
961
961
  onSendMessage: Fe,
962
- onMinimize: We,
962
+ onMinimize: Ue,
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", ee = N === "connected", V = N === "idle" || N === "disconnected" || N === "error", Me = M(null), oe = M(null);
967
+ const oe = 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), ie = 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 = "", Z && (Z.style.width = "100%", Z.style.height = "100%", Z.style.objectFit = "contain", h.appendChild(Z)));
969
+ const y = Ie.current;
970
+ y && (y.innerHTML = "", q && (q.style.width = "100%", q.style.height = "100%", q.style.objectFit = "cover", q.style.transform = "scaleX(-1)", y.appendChild(q)));
971
+ }, [q]), P(() => {
972
+ const y = ie.current;
973
+ y && (y.innerHTML = "", Z && (Z.style.width = "100%", Z.style.height = "100%", Z.style.objectFit = "contain", y.appendChild(Z)));
974
974
  }, [Z]);
975
- const [K, ne] = C(!1), [le, Y] = C(!1);
975
+ const [J, ne] = N(!1), [le, Y] = N(!1);
976
976
  P(() => {
977
- if (!K && !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
- K,
983
+ J,
984
984
  le,
985
- S,
986
- p,
987
- L,
985
+ A,
986
+ m,
987
+ C,
988
988
  a
989
989
  ]);
990
- const [X, ae] = C(""), Re = x(
991
- (h) => {
992
- h.preventDefault();
993
- const W = X.trim();
994
- W && (Fe(W), ae(""));
990
+ const [K, ae] = N(""), Me = S(
991
+ (y) => {
992
+ y.preventDefault();
993
+ const j = K.trim();
994
+ j && (Fe(j), ae(""));
995
995
  },
996
- [X, Fe]
997
- ), Ze = s.productName || "Live Layer", ke = ee && (ie != null && ie.text) ? ie.text : l || "", Te = [
996
+ [K, Fe]
997
+ ), Ze = s.productName || "Live Layer", ke = ee && (oe != null && oe.text) ? oe.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,
@@ -1007,20 +1007,20 @@ const qn = ({
1007
1007
  role: "dialog",
1008
1008
  "aria-label": `${r} widget`,
1009
1009
  children: [
1010
- /* @__PURE__ */ k("div", { className: "ll-expanded__bg", children: [
1011
- i ? /* @__PURE__ */ n(
1012
- Fn,
1010
+ /* @__PURE__ */ _("div", { className: "ll-expanded__bg", children: [
1011
+ o ? /* @__PURE__ */ n(
1012
+ Vn,
1013
1013
  {
1014
- src: i,
1014
+ src: o,
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 && !ee && /* @__PURE__ */ n(
1019
+ i && !ee && /* @__PURE__ */ n(
1020
1020
  "video",
1021
1021
  {
1022
1022
  className: "ll-expanded__bg-idle",
1023
- src: o,
1023
+ src: i,
1024
1024
  autoPlay: !0,
1025
1025
  loop: !0,
1026
1026
  muted: !0,
@@ -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: y ? "Switching..." : "Connecting..." })
1034
+ /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: h ? "Switching..." : "Connecting..." })
1035
1035
  ] }),
1036
- I && ee && /* @__PURE__ */ k(
1036
+ M && ee && /* @__PURE__ */ _(
1037
1037
  "button",
1038
1038
  {
1039
1039
  type: "button",
@@ -1045,68 +1045,68 @@ 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
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: () => c(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: [
@@ -1115,11 +1115,11 @@ const qn = ({
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: We,
1151
+ onClick: Ue,
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: [
1171
+ /* @__PURE__ */ _("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
1172
1172
  /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Ze }),
1173
- /* @__PURE__ */ k("div", { className: "ll-expanded__header-actions", children: [
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: We,
1179
+ onClick: Ue,
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,99 +1188,99 @@ 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", W = $ ? "Pick up where you left off" : null;
1199
- return /* @__PURE__ */ k(Ht, { children: [
1200
- N === "idle" && !$ && !D && /* @__PURE__ */ k(
1198
+ const y = $ ? "Restart paused session" : R === "disconnected" ? "Reconnect to agent" : "Start video call", j = $ ? "Pick up where you left off" : null;
1199
+ return /* @__PURE__ */ _(Bt, { children: [
1200
+ R === "idle" && !$ && !H && /* @__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
- W && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: W }),
1215
+ j && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: j }),
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 || Q) ? "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
- ref: oe,
1237
+ ref: ie,
1238
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: !Q && 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: [
1253
+ /* @__PURE__ */ _("div", { className: "ll-toolbar", onClick: (y) => y.stopPropagation(), children: [
1254
1254
  Be && /* @__PURE__ */ n(
1255
1255
  "button",
1256
1256
  {
1257
1257
  type: "button",
1258
1258
  className: `ll-tool ${Q ? "is-on" : ""}`,
1259
- onClick: q,
1259
+ onClick: W,
1260
1260
  "aria-label": Q ? "Stop sharing screen" : "Share screen",
1261
1261
  title: Q ? "Stop sharing" : "Share screen",
1262
- children: /* @__PURE__ */ n(jn, {})
1262
+ children: /* @__PURE__ */ n(Gn, {})
1263
1263
  }
1264
1264
  ),
1265
- qe && /* @__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(Jn, {})
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((W) => !W), ne(!1);
1281
+ className: `ll-tool ll-tool--right ${x ? "is-on" : ""}`,
1282
+ onClick: (y) => {
1283
+ y.stopPropagation(), Y((j) => !j), ne(!1);
1284
1284
  },
1285
1285
  "aria-label": "Camera devices",
1286
1286
  "aria-haspopup": "listbox",
@@ -1288,46 +1288,46 @@ const qn = ({
1288
1288
  children: /* @__PURE__ */ n(Ye, {})
1289
1289
  }
1290
1290
  ),
1291
- le && J.length > 0 && /* @__PURE__ */ n(
1292
- Pt,
1291
+ le && X.length > 0 && /* @__PURE__ */ n(
1292
+ Dt,
1293
1293
  {
1294
1294
  label: "Camera",
1295
- devices: J,
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 ${g ? "is-muted" : ""}`,
1308
+ className: `ll-tool ll-tool--left ${p ? "is-muted" : ""}`,
1309
1309
  onClick: be,
1310
- "aria-label": g ? "Unmute microphone" : "Mute microphone",
1311
- title: g ? "Unmute" : "Mute",
1312
- children: /* @__PURE__ */ n(Yn, { muted: g })
1310
+ "aria-label": p ? "Unmute microphone" : "Mute microphone",
1311
+ title: p ? "Unmute" : "Mute",
1312
+ children: /* @__PURE__ */ n(Kn, { 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 ${g ? "is-muted" : ""}`,
1320
- onClick: (h) => {
1321
- h.stopPropagation(), ne((W) => !W), Y(!1);
1319
+ className: `ll-tool ll-tool--right ${p ? "is-muted" : ""}`,
1320
+ onClick: (y) => {
1321
+ y.stopPropagation(), ne((j) => !j), Y(!1);
1322
1322
  },
1323
1323
  "aria-label": "Microphone devices",
1324
1324
  "aria-haspopup": "listbox",
1325
- "aria-expanded": K,
1325
+ "aria-expanded": J,
1326
1326
  children: /* @__PURE__ */ n(Ye, {})
1327
1327
  }
1328
1328
  ),
1329
- K && 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,
@@ -1344,29 +1344,29 @@ const qn = ({
1344
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(Xn, { muted: ue })
1348
1348
  }
1349
1349
  )
1350
1350
  ] }),
1351
- Ue && /* @__PURE__ */ k("form", { className: "ll-message-input", onSubmit: Re, children: [
1351
+ We && /* @__PURE__ */ _("form", { className: "ll-message-input", onSubmit: Me, children: [
1352
1352
  /* @__PURE__ */ n(
1353
1353
  "input",
1354
1354
  {
1355
1355
  type: "text",
1356
1356
  className: "ll-message-input__field",
1357
1357
  placeholder: "Message...",
1358
- value: X,
1359
- onChange: (h) => ae(h.target.value),
1358
+ value: K,
1359
+ onChange: (y) => ae(y.target.value),
1360
1360
  "aria-label": "Message the agent"
1361
1361
  }
1362
1362
  ),
1363
- X.trim() && /* @__PURE__ */ n(
1363
+ K.trim() && /* @__PURE__ */ n(
1364
1364
  "button",
1365
1365
  {
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(Qn, {})
1370
1370
  }
1371
1371
  )
1372
1372
  ] }),
@@ -1381,31 +1381,31 @@ const qn = ({
1381
1381
  )
1382
1382
  ] }) : null,
1383
1383
  (() => {
1384
- if (v && N !== "error")
1385
- return /* @__PURE__ */ k("div", { className: "ll-expanded__banner", role: "alert", children: [
1386
- /* @__PURE__ */ n("span", { children: v }),
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", W = "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 (!H || R !== "error") return null;
1399
+ let y = "Failed to connect", j = "Try again";
1400
+ return H === "MIC_PERMISSION_DENIED" ? y = "Microphone blocked. Allow access to talk." : H === "MIC_NOT_FOUND" ? y = "No microphone found. Plug one in + retry." : H === "MIC_UNAVAILABLE" ? y = "Mic unavailable. Check other apps using it." : H === "AGENT_TIMEOUT" ? y = "Agent didn't pick up. Try again." : H === "CONNECT_FAILED" ? y = "Connection failed. Check your network." : H.length < 80 && (y = H), /* @__PURE__ */ _("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: W
1408
+ children: j
1409
1409
  }
1410
1410
  )
1411
1411
  ] });
@@ -1417,94 +1417,94 @@ const qn = ({
1417
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 jn() {
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 Gn() {
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 Jn() {
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 Kn({ 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 Xn({ 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__ */ _(Bt, { 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 Qn() {
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: o }) => /* @__PURE__ */ _(
1466
1466
  "div",
1467
1467
  {
1468
1468
  className: "ll-device-menu",
1469
- onClick: (o) => o.stopPropagation(),
1469
+ onClick: (i) => i.stopPropagation(),
1470
1470
  role: "listbox",
1471
1471
  children: [
1472
1472
  /* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
1473
- t.map((o, l) => {
1474
- const s = r === o.deviceId;
1475
- return /* @__PURE__ */ k(
1473
+ t.map((i, l) => {
1474
+ const s = r === i.deviceId;
1475
+ return /* @__PURE__ */ _(
1476
1476
  "button",
1477
1477
  {
1478
1478
  type: "button",
1479
1479
  className: `ll-device-menu__item ${s ? "is-active" : ""}`,
1480
- onClick: () => i(o.deviceId),
1480
+ onClick: () => o(i.deviceId),
1481
1481
  role: "option",
1482
1482
  "aria-selected": s,
1483
1483
  children: [
1484
1484
  s && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1485
- /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: o.label || `${e} ${l + 1}` })
1485
+ /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: i.label || `${e} ${l + 1}` })
1486
1486
  ]
1487
1487
  },
1488
- o.deviceId || l
1488
+ i.deviceId || l
1489
1489
  );
1490
1490
  })
1491
1491
  ]
1492
1492
  }
1493
- ), Xn = [
1493
+ ), Zn = [
1494
1494
  '[data-ll-private="true"]',
1495
1495
  ".ll-widget"
1496
1496
  ];
1497
- function ct(e) {
1497
+ function st(e) {
1498
1498
  let t = e;
1499
1499
  for (; t; ) {
1500
- for (const r of Xn)
1500
+ for (const r of Zn)
1501
1501
  if (t.matches(r)) return !0;
1502
1502
  t = t.parentElement;
1503
1503
  }
1504
1504
  return !1;
1505
1505
  }
1506
- function Je(e) {
1507
- if (ct(e)) return !1;
1506
+ function Xe(e) {
1507
+ if (st(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 Je(e) {
1512
1512
  }
1513
1513
  return !0;
1514
1514
  }
1515
- const Ge = 4096, Jn = 20, Qn = 20, Zn = 10, er = 10, tr = 30, Dt = 500, nr = [
1515
+ const Ge = 4096, er = 20, tr = 20, nr = 10, rr = 10, or = 30, $t = 500, ir = [
1516
1516
  '[data-ll-private="true"]',
1517
1517
  ".ll-widget",
1518
1518
  "script",
@@ -1524,7 +1524,7 @@ function He(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
  }
@@ -1534,10 +1534,10 @@ function Oe(e) {
1534
1534
  if (typeof window > "u") return !0;
1535
1535
  const t = e.getBoundingClientRect();
1536
1536
  if (t.width <= 0 || t.height <= 0) return !1;
1537
- const r = window.innerHeight || document.documentElement.clientHeight, i = window.innerWidth || document.documentElement.clientWidth;
1538
- return t.bottom > 0 && t.right > 0 && t.top < r && t.left < i;
1537
+ const r = window.innerHeight || document.documentElement.clientHeight, o = window.innerWidth || document.documentElement.clientWidth;
1538
+ return t.bottom > 0 && t.right > 0 && t.top < r && t.left < o;
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)}"]`);
@@ -1545,18 +1545,18 @@ function $t(e) {
1545
1545
  }
1546
1546
  const r = e.getAttribute("aria-label");
1547
1547
  if (r) return r.trim();
1548
- const i = e.getAttribute("placeholder");
1549
- if (i) return i.trim();
1550
- const o = e.closest("label");
1551
- return o != null && o.textContent ? o.textContent.trim() : "";
1548
+ const o = e.getAttribute("placeholder");
1549
+ if (o) return o.trim();
1550
+ const i = e.closest("label");
1551
+ return i != null && i.textContent ? i.textContent.trim() : "";
1552
1552
  }
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 lr(e, t = {}) {
1560
1560
  const r = t.doc ?? (typeof document < "u" ? document : null);
1561
1561
  if (!r)
1562
1562
  return {
@@ -1570,161 +1570,206 @@ 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 o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "", s = Array.from(
1574
1574
  r.querySelectorAll("[data-ll-region]")
1575
1575
  ), d = [];
1576
- for (const g of s) {
1577
- if (d.length >= Zn) break;
1578
- if (He(g) || !Oe(g)) continue;
1579
- const v = g.getAttribute("data-ll-region") ?? "", E = g.getAttribute("data-ll-intent") ?? void 0, w = me(
1580
- (g.innerText || g.textContent || "").trim(),
1581
- Dt * 2
1576
+ for (const p of s) {
1577
+ if (d.length >= nr) break;
1578
+ if (He(p) || !Oe(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
- !v || !w || d.push({ id: v, intent: E, text: w });
1583
+ !g || !x || d.push({ id: g, intent: E, text: x });
1584
1584
  }
1585
- const u = [], y = ["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 g of p) {
1589
- if (He(g) || !Oe(g)) continue;
1590
- const v = (g.textContent || "").trim();
1591
- v && u.push(`${g.tagName}: ${me(v, 200)}`);
1588
+ for (const p of m) {
1589
+ if (He(p) || !Oe(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 g of a) {
1595
- if (He(g) || !Oe(g) || y.includes(g.tagName)) continue;
1596
- const v = (g.textContent || "").trim();
1597
- v.length > 10 && u.push(me(v, Dt));
1594
+ for (const p of a) {
1595
+ if (He(p) || !Oe(p) || h.includes(p.tagName)) continue;
1596
+ const g = (p.textContent || "").trim();
1597
+ g.length > 10 && u.push(me(g, $t));
1598
1598
  }
1599
1599
  const c = u.join(`
1600
- `), S = [], L = Array.from(r.querySelectorAll("a[href]"));
1601
- for (const g of L) {
1602
- if (S.length >= Jn) break;
1603
- if (He(g) || !Oe(g)) continue;
1604
- const v = g.getAttribute("href") || "", E = (g.textContent || "").trim();
1605
- !v || !E || S.push({ href: v, text: me(E, 100) });
1600
+ `), A = [], C = Array.from(r.querySelectorAll("a[href]"));
1601
+ for (const p of C) {
1602
+ if (A.length >= er) break;
1603
+ if (He(p) || !Oe(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 g of H) {
1613
- if (N.length >= Qn) break;
1614
- if (He(g) || !Je(g) || !Oe(g)) continue;
1615
- const v = $t(g), E = g instanceof HTMLInputElement ? g.type : g.tagName.toLowerCase();
1616
- v && N.push({ label: me(v, 100), type: E });
1612
+ for (const p of b) {
1613
+ if (R.length >= tr) break;
1614
+ if (He(p) || !Xe(p) || !Oe(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
1620
  ), $ = [];
1621
- for (const g of R) {
1622
- if ($.length >= er) break;
1623
- if (ct(g)) continue;
1624
- const v = g.getAttribute("data-ll-form") || "";
1625
- if (!v) continue;
1626
- const E = g.getAttribute("data-ll-intent") || void 0, w = Array.from(
1627
- g.querySelectorAll(
1621
+ for (const p of L) {
1622
+ if ($.length >= rr) break;
1623
+ if (st(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 J of w) {
1632
- if (O.length >= tr) break;
1633
- if (!Je(J)) continue;
1634
- const de = J.getAttribute("data-ll-field") || "";
1630
+ ), q = [];
1631
+ for (const X of x) {
1632
+ if (q.length >= or) break;
1633
+ if (!Xe(X)) continue;
1634
+ const de = X.getAttribute("data-ll-field") || "";
1635
1635
  if (!de) continue;
1636
- const Q = $t(J) || de, Z = J instanceof HTMLInputElement ? J.type : J.tagName.toLowerCase();
1637
- O.push({ name: de, label: me(Q, 100), type: Z });
1636
+ const Q = zt(X) || de, Z = X instanceof HTMLInputElement ? X.type : X.tagName.toLowerCase();
1637
+ q.push({ name: de, label: me(Q, 100), type: Z });
1638
1638
  }
1639
- $.push({ id: v, intent: E, fields: O });
1639
+ $.push({ id: g, intent: E, fields: q });
1640
1640
  }
1641
- const I = {
1642
- url: i,
1641
+ const M = {
1642
+ url: o,
1643
1643
  title: l,
1644
- pathname: o,
1644
+ pathname: i,
1645
1645
  regions: d,
1646
1646
  visibleText: c,
1647
- visibleLinks: S,
1648
- visibleFields: N,
1647
+ visibleLinks: A,
1648
+ visibleFields: R,
1649
1649
  forms: $,
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 > Ge && I.visibleFields.length > 0; )
1654
- I.visibleFields.pop(), D = Ee(JSON.stringify(I.visibleFields));
1655
- for (; D > Ge && I.visibleLinks.length > 0; )
1656
- I.visibleLinks.pop(), D -= 80;
1657
- return Ee(I.visibleText) > Ge && (I.visibleText = me(I.visibleText, Ge - 100)), I;
1652
+ let H = Se(JSON.stringify(M.regions)) + Se(M.visibleText) + Se(JSON.stringify(M.visibleLinks)) + Se(JSON.stringify(M.visibleFields));
1653
+ for (; H > Ge && M.visibleFields.length > 0; )
1654
+ M.visibleFields.pop(), H = Se(JSON.stringify(M.visibleFields));
1655
+ for (; H > Ge && M.visibleLinks.length > 0; )
1656
+ M.visibleLinks.pop(), H -= 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 = {}) {
1661
- const r = Date.now(), o = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
1662
- if (Ce && Ce.key === o && r - Ce.at < 1e3)
1660
+ function Ht(e, t = {}) {
1661
+ const r = Date.now(), i = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
1662
+ if (Ce && Ce.key === i && r - Ce.at < 1e3)
1663
1663
  return Ce.ctx;
1664
- const l = rr(e, t);
1665
- return Ce = { key: o, at: r, ctx: l }, l;
1664
+ const l = lr(e, t);
1665
+ return Ce = { key: i, at: r, ctx: l }, l;
1666
1666
  }
1667
- function ir() {
1667
+ function ar() {
1668
1668
  Ce = null;
1669
1669
  }
1670
- const or = 200;
1671
- function lr(e) {
1670
+ const cr = 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 dr(e) {
1675
1675
  const t = e ?? (typeof document < "u" ? document : null);
1676
1676
  if (!t) return [];
1677
- const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), o = [], l = Array.from(t.querySelectorAll("a[href]"));
1677
+ const r = typeof window < "u" && window.location.origin || "", o = /* @__PURE__ */ new Set(), i = [], l = Array.from(t.querySelectorAll("a[href]"));
1678
1678
  for (const s of l) {
1679
- if (o.length >= or) break;
1680
- if (ct(s)) continue;
1679
+ if (i.length >= cr) break;
1680
+ if (st(s)) continue;
1681
1681
  const d = s.getAttribute("href") || "";
1682
- if (!lr(d)) continue;
1683
- let u = d, y = !0;
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
- y = a.origin === r, y && 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
- if (i.has(u)) continue;
1693
- i.add(u);
1694
- const p = (s.textContent || "").trim().slice(0, 120);
1695
- o.push({ href: u, text: p, internal: y });
1692
+ if (o.has(u)) continue;
1693
+ o.add(u);
1694
+ const m = (s.textContent || "").trim().slice(0, 120);
1695
+ i.push({ href: u, text: m, internal: h });
1696
1696
  }
1697
- return o;
1697
+ return i;
1698
1698
  }
1699
- let Se = null;
1700
- const cr = 5e3;
1701
- function sr() {
1699
+ let Ee = null;
1700
+ const ur = 5e3;
1701
+ function fr() {
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 < ur)
1704
+ return Ee.routes;
1705
+ const r = dr();
1706
+ return Ee = { at: e, pathname: t, routes: r }, r;
1707
1707
  }
1708
- function dr() {
1709
- Se = null;
1708
+ function pr() {
1709
+ Ee = null;
1710
1710
  }
1711
- function ur(e, t) {
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
- o ? o.call(e, t) : e.value = t;
1711
+ function hr(e, t) {
1712
+ const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, o = Object.getOwnPropertyDescriptor(r, "value"), i = o == null ? void 0 : o.set;
1713
+ i ? i.call(e, t) : e.value = t;
1714
1714
  }
1715
- function fr(e, t, r = {}) {
1716
- const i = r.triggerInput ?? !0, o = r.triggerChange ?? !0;
1715
+ function mr(e, t, r = {}) {
1716
+ const o = r.triggerInput ?? !0, i = 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
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 }));
1722
+ s ? s.call(e, d) : e.checked = d, o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && 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
+ hr(e, t), o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1726
1726
  }
1727
- const pr = /* @__PURE__ */ new Set([
1727
+ function gr() {
1728
+ if (typeof window > "u" || typeof document > "u")
1729
+ return !1;
1730
+ const e = document.scrollingElement || document.documentElement;
1731
+ if (!e || e.scrollHeight <= e.clientHeight + 2) return !1;
1732
+ const t = window.getComputedStyle(e);
1733
+ return !(t.overflowY === "hidden" || t.overflowY === "clip");
1734
+ }
1735
+ function yr(e) {
1736
+ if (!(e instanceof HTMLElement)) return !1;
1737
+ const r = window.getComputedStyle(e).overflowY;
1738
+ return !(r !== "auto" && r !== "scroll" || e.scrollHeight <= e.clientHeight + 2);
1739
+ }
1740
+ function vr() {
1741
+ if (typeof document > "u") return null;
1742
+ const e = Array.from(
1743
+ document.querySelectorAll("body, body *")
1744
+ );
1745
+ let t = null, r = 0;
1746
+ for (const o of e) {
1747
+ if (!yr(o)) continue;
1748
+ const i = o.getBoundingClientRect();
1749
+ if (i.bottom <= 0 || i.top >= window.innerHeight || i.right <= 0 || i.left >= window.innerWidth || i.width <= 0 || i.height <= 0 || o.closest(".ll-widget")) continue;
1750
+ const l = i.width * i.height;
1751
+ l > r && (r = l, t = o);
1752
+ }
1753
+ return t;
1754
+ }
1755
+ function br() {
1756
+ if (typeof window > "u")
1757
+ return null;
1758
+ if (gr()) return window;
1759
+ const e = vr();
1760
+ return e || window;
1761
+ }
1762
+ function Ot(e) {
1763
+ return e instanceof Window ? e.innerHeight || 0 : e.clientHeight || 0;
1764
+ }
1765
+ function wr(e) {
1766
+ var t, r;
1767
+ return e instanceof Window ? typeof document > "u" ? 0 : Math.max(
1768
+ ((t = document.body) == null ? void 0 : t.scrollHeight) ?? 0,
1769
+ ((r = document.documentElement) == null ? void 0 : r.scrollHeight) ?? 0
1770
+ ) : e.scrollHeight - e.clientHeight;
1771
+ }
1772
+ const _r = /* @__PURE__ */ new Set([
1728
1773
  "agent_state",
1729
1774
  "avatar_stream_ready",
1730
1775
  "avatar_active",
@@ -1747,42 +1792,42 @@ const pr = /* @__PURE__ */ new Set([
1747
1792
  "submit_form",
1748
1793
  "request_routes"
1749
1794
  ]);
1750
- function hr(e) {
1751
- var gt, yt, vt, bt, wt, _t, xt;
1795
+ function xr(e) {
1796
+ var yt, vt, bt, wt, _t, xt, kt;
1752
1797
  const {
1753
1798
  agentId: t,
1754
1799
  apiKey: r,
1755
- baseUrl: i = "https://app.livelayer.studio",
1756
- sessionEndpoint: o,
1800
+ baseUrl: o = "https://app.livelayer.studio",
1801
+ sessionEndpoint: i,
1757
1802
  sessionBody: l,
1758
1803
  autoConnect: s = !1,
1759
1804
  displayMode: d,
1760
1805
  defaultDisplayMode: u = "expanded",
1761
- onDisplayModeChange: y,
1762
- position: p = "bottom-right",
1806
+ onDisplayModeChange: h,
1807
+ position: m = "bottom-right",
1763
1808
  mobileBreakpoint: a = 640,
1764
1809
  persistKey: c = "ll-widget",
1765
- disablePersistence: S = !1,
1766
- teamMembers: L,
1767
- currentTeamMemberId: N,
1768
- onTeamMemberChange: H,
1769
- idleLoopUrl: R,
1810
+ disablePersistence: A = !1,
1811
+ teamMembers: C,
1812
+ currentTeamMemberId: R,
1813
+ onTeamMemberChange: b,
1814
+ idleLoopUrl: L,
1770
1815
  greeting: $,
1771
- avatarImageUrl: I,
1772
- agentName: D,
1773
- branding: g = {},
1774
- allowCamera: v = !0,
1816
+ avatarImageUrl: M,
1817
+ agentName: H,
1818
+ branding: p = {},
1819
+ allowCamera: g = !0,
1775
1820
  allowScreenShare: E = !0,
1776
- allowTyping: w = !0,
1777
- showOn: O,
1778
- hideOn: J,
1821
+ allowTyping: x = !0,
1822
+ showOn: q,
1823
+ hideOn: X,
1779
1824
  pathname: de,
1780
1825
  onNavigate: Q,
1781
1826
  onScrollToSelector: Z,
1782
1827
  getPageContext: ue,
1783
1828
  pageContextExtras: qe,
1784
1829
  onScrollPage: Be,
1785
- onClick: Ue,
1830
+ onClick: We,
1786
1831
  capabilities: Ne,
1787
1832
  onConnect: fe,
1788
1833
  onDisconnect: ge,
@@ -1791,49 +1836,49 @@ function hr(e) {
1791
1836
  onConnectionStateChange: be,
1792
1837
  onAgentEvent: we,
1793
1838
  onAgentCommand: _e,
1794
- controlledSession: q,
1839
+ controlledSession: W,
1795
1840
  className: Qe,
1796
1841
  style: Fe,
1797
- zIndex: We = 2147483647
1798
- } = e, Ae = Cn(de), Ie = Tn(Ae, O, J);
1842
+ zIndex: Ue = 2147483647
1843
+ } = e, Ae = An(de), Re = $n(Ae, q, X);
1799
1844
  P(() => {
1800
- ir(), dr();
1845
+ ar(), pr();
1801
1846
  }, [Ae]);
1802
- const ie = N !== void 0, [pe, xe] = C(() => {
1803
- var m;
1804
- return N ?? ((m = L == null ? void 0 : L[0]) == null ? void 0 : m.id);
1805
- }), ee = ie ? N : pe, V = Ke(
1806
- () => (L == null ? void 0 : L.find((m) => m.id === ee)) ?? null,
1807
- [L, ee]
1808
- ), Me = (V == null ? void 0 : V.agentId) ?? t, [oe, K] = xn({
1847
+ const oe = R !== void 0, [pe, xe] = N(() => {
1848
+ var v;
1849
+ return R ?? ((v = C == null ? void 0 : C[0]) == null ? void 0 : v.id);
1850
+ }), ee = oe ? R : pe, V = Je(
1851
+ () => (C == null ? void 0 : C.find((v) => v.id === ee)) ?? null,
1852
+ [C, ee]
1853
+ ), Ie = (V == null ? void 0 : V.agentId) ?? t, [ie, J] = Sn({
1809
1854
  value: d,
1810
1855
  defaultValue: u,
1811
- onChange: y,
1856
+ onChange: h,
1812
1857
  persistKey: c,
1813
- disablePersistence: S
1814
- }), ne = Ln(a), le = dn(), Y = un(), X = pn(), ae = hn(), Re = mn(), [Ze, ke] = C(!1), [Te, Pe] = C(!1), [h, W] = C(!1), [st, Bt] = C(!1), [et, Ut] = C(!1), tt = M(Q), nt = M(Z), rt = M(Be), it = M(Ue), dt = M(ue), ut = M(qe), ot = M(Ne), te = M(null);
1815
- tt.current = Q, nt.current = Z, rt.current = Be, it.current = Ue, dt.current = ue, ut.current = qe, ot.current = Ne;
1816
- function ce(m) {
1817
- const f = ot.current;
1818
- return f ? f.includes(m) : !0;
1858
+ disablePersistence: A
1859
+ }), ne = En(a), le = pn(), Y = hn(), K = gn(), ae = yn(), Me = vn(), [Ze, ke] = N(!1), [Te, Pe] = N(!1), [y, j] = N(!1), [dt, Ut] = N(!1), [et, jt] = N(!1), tt = I(Q), nt = I(Z), rt = I(Be), ot = I(We), ut = I(ue), ft = I(qe), it = I(Ne), te = I(null);
1860
+ tt.current = Q, nt.current = Z, rt.current = Be, ot.current = We, ut.current = ue, ft.current = qe, it.current = Ne;
1861
+ function ce(v) {
1862
+ const f = it.current;
1863
+ return f ? f.includes(v) : !0;
1819
1864
  }
1820
- function se(m, f) {
1865
+ function se(v, f) {
1821
1866
  console.warn(
1822
- `[LiveLayer] Agent command "${m}" blocked — capability "${f}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
1867
+ `[LiveLayer] Agent command "${v}" blocked — capability "${f}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
1823
1868
  );
1824
1869
  }
1825
- const De = x(
1826
- (m) => {
1827
- var G, je, Ve, kt;
1828
- const f = m;
1870
+ const De = S(
1871
+ (v) => {
1872
+ var G, je, Ve, Lt;
1873
+ const f = v;
1829
1874
  if (!(!f.type || typeof f.type != "string")) {
1830
- if (we == null || we({ eventName: f.type, data: m }), f.type === "navigate") {
1875
+ if (we == null || we({ eventName: f.type, data: v }), f.type === "navigate") {
1831
1876
  if (!ce("navigate")) {
1832
1877
  se("navigate", "navigate");
1833
1878
  return;
1834
1879
  }
1835
- const _ = typeof f.href == "string" ? f.href : null;
1836
- if (!_) {
1880
+ const k = typeof f.href == "string" ? f.href : null;
1881
+ if (!k) {
1837
1882
  console.warn(
1838
1883
  `[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
1839
1884
  );
@@ -1841,31 +1886,31 @@ function hr(e) {
1841
1886
  }
1842
1887
  if (tt.current) {
1843
1888
  try {
1844
- tt.current(_);
1845
- } catch (A) {
1889
+ tt.current(k);
1890
+ } catch (T) {
1846
1891
  console.warn(
1847
- `[LiveLayer] onNavigate threw for "${_}". Falling back. Error:`,
1848
- A
1892
+ `[LiveLayer] onNavigate threw for "${k}". Falling back. Error:`,
1893
+ T
1849
1894
  );
1850
1895
  }
1851
1896
  return;
1852
1897
  }
1853
1898
  if (typeof document < "u") {
1854
- const A = document.querySelector(
1855
- `a[href="${_.replace(/"/g, '\\"')}"]`
1899
+ const T = document.querySelector(
1900
+ `a[href="${k.replace(/"/g, '\\"')}"]`
1856
1901
  );
1857
- if (A) {
1858
- A.click();
1902
+ if (T) {
1903
+ T.click();
1859
1904
  return;
1860
1905
  }
1861
1906
  }
1862
1907
  if (typeof window < "u" && typeof history < "u")
1863
1908
  try {
1864
- history.pushState({}, "", _), window.dispatchEvent(new PopStateEvent("popstate"));
1865
- } catch (A) {
1909
+ history.pushState({}, "", k), window.dispatchEvent(new PopStateEvent("popstate"));
1910
+ } catch (T) {
1866
1911
  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
1912
+ `[LiveLayer] history.pushState fallback failed for "${k}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
1913
+ T
1869
1914
  );
1870
1915
  }
1871
1916
  return;
@@ -1875,38 +1920,38 @@ function hr(e) {
1875
1920
  se("scroll_to", "scroll");
1876
1921
  return;
1877
1922
  }
1878
- const _ = typeof f.selector == "string" ? f.selector : null;
1879
- if (!_) return;
1880
- const A = f.behavior === "instant" ? "instant" : "smooth";
1923
+ const k = typeof f.selector == "string" ? f.selector : null;
1924
+ if (!k) return;
1925
+ const T = f.behavior === "instant" ? "instant" : "smooth";
1881
1926
  if (nt.current) {
1882
1927
  try {
1883
1928
  nt.current(
1884
- _,
1885
- A
1929
+ k,
1930
+ T
1886
1931
  );
1887
- } catch (T) {
1888
- console.warn("[LiveLayer] onScrollToSelector threw.", T);
1932
+ } catch (z) {
1933
+ console.warn("[LiveLayer] onScrollToSelector threw.", z);
1889
1934
  }
1890
1935
  return;
1891
1936
  }
1892
1937
  if (typeof document < "u") {
1893
- let T = null;
1938
+ let z = null;
1894
1939
  try {
1895
- T = document.querySelector(_);
1940
+ z = document.querySelector(k);
1896
1941
  } catch {
1897
1942
  console.warn(
1898
- `[LiveLayer] scroll_to: invalid selector "${_}".`
1943
+ `[LiveLayer] scroll_to: invalid selector "${k}".`
1899
1944
  );
1900
1945
  return;
1901
1946
  }
1902
- if (!T) {
1947
+ if (!z) {
1903
1948
  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`
1949
+ `[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
1950
  );
1906
1951
  return;
1907
1952
  }
1908
- T.scrollIntoView({
1909
- behavior: A,
1953
+ z.scrollIntoView({
1954
+ behavior: T,
1910
1955
  block: "start"
1911
1956
  });
1912
1957
  }
@@ -1917,45 +1962,45 @@ function hr(e) {
1917
1962
  se("request_page_context", "read_page");
1918
1963
  return;
1919
1964
  }
1920
- const _ = typeof f.requestId == "string" ? f.requestId : void 0, A = (G = te.current) == null ? void 0 : G.call(te), T = (U) => {
1921
- const j = A, re = j == null ? void 0 : j.localParticipant;
1965
+ const k = typeof f.requestId == "string" ? f.requestId : void 0, T = (G = te.current) == null ? void 0 : G.call(te), z = (F) => {
1966
+ const O = T, re = O == null ? void 0 : O.localParticipant;
1922
1967
  if (re != null && re.publishData)
1923
1968
  try {
1924
- const he = _ ? { ...U, requestId: _ } : U, Le = new TextEncoder().encode(JSON.stringify(he));
1969
+ const he = k ? { ...F, requestId: k } : F, Le = new TextEncoder().encode(JSON.stringify(he));
1925
1970
  re.publishData(Le, { reliable: !0 });
1926
1971
  } catch (he) {
1927
1972
  console.warn("[LiveLayer] publishData failed.", he);
1928
1973
  }
1929
- }, z = ut.current, B = dt.current;
1974
+ }, D = ft.current, B = ut.current;
1930
1975
  try {
1931
1976
  if (B) {
1932
- const U = B(z);
1933
- if (U instanceof Promise) {
1934
- T({ type: "page_context_pending" }), U.then((j) => T({ type: "page_context", context: j })).catch((j) => {
1977
+ const F = B(D);
1978
+ if (F instanceof Promise) {
1979
+ z({ type: "page_context_pending" }), F.then((O) => z({ type: "page_context", context: O })).catch((O) => {
1935
1980
  console.warn(
1936
1981
  "[LiveLayer] getPageContext rejected; falling back to default walker.",
1937
- j
1938
- ), T({
1982
+ O
1983
+ ), z({
1939
1984
  type: "page_context",
1940
- context: zt(z)
1985
+ context: Ht(D)
1941
1986
  });
1942
1987
  });
1943
1988
  return;
1944
1989
  }
1945
- T({ type: "page_context", context: U });
1990
+ z({ type: "page_context", context: F });
1946
1991
  return;
1947
1992
  }
1948
- T({
1993
+ z({
1949
1994
  type: "page_context",
1950
- context: zt(z)
1995
+ context: Ht(D)
1951
1996
  });
1952
- } catch (U) {
1997
+ } catch (F) {
1953
1998
  console.warn(
1954
1999
  "[LiveLayer] page-context extraction threw. Sending empty context.",
1955
- U
1956
- ), T({
2000
+ F
2001
+ ), z({
1957
2002
  type: "page_context",
1958
- context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: z }
2003
+ context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: D }
1959
2004
  });
1960
2005
  }
1961
2006
  return;
@@ -1965,28 +2010,32 @@ function hr(e) {
1965
2010
  se("scroll_page", "scroll");
1966
2011
  return;
1967
2012
  }
1968
- const _ = f.direction;
1969
- if (_ !== "up" && _ !== "down" && _ !== "top" && _ !== "bottom") {
2013
+ const k = f.direction;
2014
+ if (k !== "up" && k !== "down" && k !== "top" && k !== "bottom") {
1970
2015
  console.warn(
1971
- `[LiveLayer] scroll_page: invalid direction "${String(_)}". Expected up | down | top | bottom.`
2016
+ `[LiveLayer] scroll_page: invalid direction "${String(k)}". Expected up | down | top | bottom.`
1972
2017
  );
1973
2018
  return;
1974
2019
  }
1975
- const A = f.behavior === "instant" ? "instant" : "smooth";
2020
+ const T = f.behavior === "instant" ? "instant" : "smooth";
1976
2021
  if (rt.current) {
1977
2022
  try {
1978
2023
  rt.current(
1979
- _,
1980
- A
2024
+ k,
2025
+ T
1981
2026
  );
1982
- } catch (z) {
1983
- console.warn("[LiveLayer] onScrollPage threw.", z);
2027
+ } catch (O) {
2028
+ console.warn("[LiveLayer] onScrollPage threw.", O);
1984
2029
  }
1985
2030
  return;
1986
2031
  }
1987
2032
  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 });
2033
+ const z = { behavior: T }, D = br(), B = (O) => {
2034
+ D instanceof Window ? D.scrollBy({ top: O, ...z }) : D.scrollBy({ top: O, ...z });
2035
+ }, F = (O) => {
2036
+ D instanceof Window ? D.scrollTo({ top: O, ...z }) : D.scrollTo({ top: O, ...z });
2037
+ };
2038
+ k === "up" ? B(-Ot(D)) : k === "down" ? B(Ot(D)) : F(k === "top" ? 0 : wr(D));
1990
2039
  return;
1991
2040
  }
1992
2041
  if (f.type === "click") {
@@ -1994,42 +2043,42 @@ function hr(e) {
1994
2043
  se("click", "click");
1995
2044
  return;
1996
2045
  }
1997
- const _ = typeof f.selector == "string" ? f.selector : null;
1998
- if (!_) {
2046
+ const k = typeof f.selector == "string" ? f.selector : null;
2047
+ if (!k) {
1999
2048
  console.warn("[LiveLayer] click: missing selector.");
2000
2049
  return;
2001
2050
  }
2002
- if (it.current) {
2051
+ if (ot.current) {
2003
2052
  try {
2004
- it.current(_);
2005
- } catch (T) {
2006
- console.warn("[LiveLayer] onClick threw.", T);
2053
+ ot.current(k);
2054
+ } catch (z) {
2055
+ console.warn("[LiveLayer] onClick threw.", z);
2007
2056
  }
2008
2057
  return;
2009
2058
  }
2010
2059
  if (typeof document > "u") return;
2011
- let A = null;
2060
+ let T = null;
2012
2061
  try {
2013
- A = document.querySelector(_);
2062
+ T = document.querySelector(k);
2014
2063
  } catch {
2015
2064
  console.warn(
2016
- `[LiveLayer] click: invalid selector "${_}".`
2065
+ `[LiveLayer] click: invalid selector "${k}".`
2017
2066
  );
2018
2067
  return;
2019
2068
  }
2020
- if (!A) {
2069
+ if (!T) {
2021
2070
  console.warn(
2022
- `[LiveLayer] click: no element matched "${_}". See https://livelayer.studio/docs/errors/click-no-match`
2071
+ `[LiveLayer] click: no element matched "${k}". See https://livelayer.studio/docs/errors/click-no-match`
2023
2072
  );
2024
2073
  return;
2025
2074
  }
2026
- if (A.closest('[data-ll-private="true"], .ll-widget')) {
2075
+ if (T.closest('[data-ll-private="true"], .ll-widget')) {
2027
2076
  console.warn(
2028
2077
  "[LiveLayer] click: refusing to click element inside a private subtree."
2029
2078
  );
2030
2079
  return;
2031
2080
  }
2032
- (je = A.click) == null || je.call(A);
2081
+ (je = T.click) == null || je.call(T);
2033
2082
  return;
2034
2083
  }
2035
2084
  if (f.type === "fill_form" || f.type === "focus_field") {
@@ -2038,74 +2087,74 @@ function hr(e) {
2038
2087
  return;
2039
2088
  }
2040
2089
  if (typeof document > "u") return;
2041
- const _ = typeof f.formId == "string" ? f.formId : null;
2042
- if (!_) {
2090
+ const k = typeof f.formId == "string" ? f.formId : null;
2091
+ if (!k) {
2043
2092
  console.warn(`[LiveLayer] ${f.type}: missing formId.`);
2044
2093
  return;
2045
2094
  }
2046
- const A = document.querySelector(
2047
- `[data-ll-form="${_.replace(/"/g, '\\"')}"]`
2095
+ const T = document.querySelector(
2096
+ `[data-ll-form="${k.replace(/"/g, '\\"')}"]`
2048
2097
  );
2049
- if (!A) {
2098
+ if (!T) {
2050
2099
  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`
2100
+ `[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
2101
  );
2053
2102
  return;
2054
2103
  }
2055
- if (A.closest('[data-ll-private="true"], .ll-widget')) {
2104
+ if (T.closest('[data-ll-private="true"], .ll-widget')) {
2056
2105
  console.warn(
2057
2106
  `[LiveLayer] ${f.type}: refusing to touch a form in a private subtree.`
2058
2107
  );
2059
2108
  return;
2060
2109
  }
2061
2110
  if (f.type === "focus_field") {
2062
- const z = typeof f.fieldName == "string" ? f.fieldName : null;
2063
- if (!z) {
2111
+ const D = typeof f.fieldName == "string" ? f.fieldName : null;
2112
+ if (!D) {
2064
2113
  console.warn("[LiveLayer] focus_field: missing fieldName.");
2065
2114
  return;
2066
2115
  }
2067
- const B = A.querySelector(`[data-ll-field="${z.replace(/"/g, '\\"')}"]`);
2116
+ const B = T.querySelector(`[data-ll-field="${D.replace(/"/g, '\\"')}"]`);
2068
2117
  if (!B) {
2069
2118
  console.warn(
2070
- `[LiveLayer] focus_field: no field "${z}" in form "${_}".`
2119
+ `[LiveLayer] focus_field: no field "${D}" in form "${k}".`
2071
2120
  );
2072
2121
  return;
2073
2122
  }
2074
- if (!Je(B)) {
2123
+ if (!Xe(B)) {
2075
2124
  console.warn(
2076
- `[LiveLayer] focus_field: field "${z}" is privacy-protected and not focusable.`
2125
+ `[LiveLayer] focus_field: field "${D}" is privacy-protected and not focusable.`
2077
2126
  );
2078
2127
  return;
2079
2128
  }
2080
2129
  B.focus();
2081
2130
  return;
2082
2131
  }
2083
- const T = f.values && typeof f.values == "object" ? f.values : null;
2084
- if (!T) {
2132
+ const z = f.values && typeof f.values == "object" ? f.values : null;
2133
+ if (!z) {
2085
2134
  console.warn("[LiveLayer] fill_form: missing or invalid values.");
2086
2135
  return;
2087
2136
  }
2088
- for (const [z, B] of Object.entries(T)) {
2137
+ for (const [D, B] of Object.entries(z)) {
2089
2138
  if (typeof B != "string") continue;
2090
- const U = A.querySelector(`[data-ll-field="${z.replace(/"/g, '\\"')}"]`);
2091
- if (!U) {
2139
+ const F = T.querySelector(`[data-ll-field="${D.replace(/"/g, '\\"')}"]`);
2140
+ if (!F) {
2092
2141
  console.warn(
2093
- `[LiveLayer] fill_form: no field "${z}" in form "${_}". Skipping.`
2142
+ `[LiveLayer] fill_form: no field "${D}" in form "${k}". Skipping.`
2094
2143
  );
2095
2144
  continue;
2096
2145
  }
2097
- if (!Je(U)) {
2146
+ if (!Xe(F)) {
2098
2147
  console.warn(
2099
- `[LiveLayer] fill_form: field "${z}" is privacy-protected (password / cc-* / private). Skipping.`
2148
+ `[LiveLayer] fill_form: field "${D}" is privacy-protected (password / cc-* / private). Skipping.`
2100
2149
  );
2101
2150
  continue;
2102
2151
  }
2103
2152
  try {
2104
- fr(U, B);
2105
- } catch (j) {
2153
+ mr(F, B);
2154
+ } catch (O) {
2106
2155
  console.warn(
2107
- `[LiveLayer] fill_form: failed to set "${z}".`,
2108
- j
2156
+ `[LiveLayer] fill_form: failed to set "${D}".`,
2157
+ O
2109
2158
  );
2110
2159
  }
2111
2160
  }
@@ -2117,54 +2166,54 @@ function hr(e) {
2117
2166
  return;
2118
2167
  }
2119
2168
  if (typeof document > "u") return;
2120
- const _ = typeof f.formId == "string" ? f.formId : null;
2121
- if (!_) {
2169
+ const k = typeof f.formId == "string" ? f.formId : null;
2170
+ if (!k) {
2122
2171
  console.warn("[LiveLayer] submit_form: missing formId.");
2123
2172
  return;
2124
2173
  }
2125
- const A = document.querySelector(
2126
- `[data-ll-form="${_.replace(/"/g, '\\"')}"]`
2174
+ const T = document.querySelector(
2175
+ `[data-ll-form="${k.replace(/"/g, '\\"')}"]`
2127
2176
  );
2128
- if (!A) {
2177
+ if (!T) {
2129
2178
  console.warn(
2130
- `[LiveLayer] submit_form: no form with data-ll-form="${_}".`
2179
+ `[LiveLayer] submit_form: no form with data-ll-form="${k}".`
2131
2180
  );
2132
2181
  return;
2133
2182
  }
2134
- if (A.closest('[data-ll-private="true"], .ll-widget')) {
2183
+ if (T.closest('[data-ll-private="true"], .ll-widget')) {
2135
2184
  console.warn(
2136
2185
  "[LiveLayer] submit_form: refusing to submit a form in a private subtree."
2137
2186
  );
2138
2187
  return;
2139
2188
  }
2140
- const T = typeof f.requestId == "string" ? f.requestId : void 0, z = (Ve = te.current) == null ? void 0 : Ve.call(te), B = (re) => {
2141
- const he = z, Le = he == null ? void 0 : he.localParticipant;
2189
+ const z = typeof f.requestId == "string" ? f.requestId : void 0, D = (Ve = te.current) == null ? void 0 : Ve.call(te), B = (re) => {
2190
+ const he = D, Le = he == null ? void 0 : he.localParticipant;
2142
2191
  if (Le != null && Le.publishData)
2143
2192
  try {
2144
- const en = T ? { ...re, requestId: T } : re, tn = new TextEncoder().encode(JSON.stringify(en));
2145
- Le.publishData(tn, { reliable: !0 });
2193
+ const rn = z ? { ...re, requestId: z } : re, on = new TextEncoder().encode(JSON.stringify(rn));
2194
+ Le.publishData(on, { reliable: !0 });
2146
2195
  } catch {
2147
2196
  }
2148
2197
  };
2149
- let U = !1;
2150
- const j = () => {
2151
- U = !0, B({ type: "form_submitted", formId: _ });
2198
+ let F = !1;
2199
+ const O = () => {
2200
+ F = !0, B({ type: "form_submitted", formId: k });
2152
2201
  };
2153
- A.addEventListener("submit", j, { once: !0 });
2202
+ T.addEventListener("submit", O, { once: !0 });
2154
2203
  try {
2155
- typeof A.requestSubmit == "function" ? A.requestSubmit() : A.submit();
2204
+ typeof T.requestSubmit == "function" ? T.requestSubmit() : T.submit();
2156
2205
  } catch (re) {
2157
- console.warn("[LiveLayer] submit_form: requestSubmit threw.", re), A.removeEventListener("submit", j), B({
2206
+ console.warn("[LiveLayer] submit_form: requestSubmit threw.", re), T.removeEventListener("submit", O), B({
2158
2207
  type: "form_submit_blocked",
2159
- formId: _,
2208
+ formId: k,
2160
2209
  reason: "exception"
2161
2210
  });
2162
2211
  return;
2163
2212
  }
2164
2213
  setTimeout(() => {
2165
- U || (A.removeEventListener("submit", j), B({
2214
+ F || (T.removeEventListener("submit", O), B({
2166
2215
  type: "form_submit_blocked",
2167
- formId: _,
2216
+ formId: k,
2168
2217
  reason: "validation"
2169
2218
  }));
2170
2219
  }, 500);
@@ -2175,39 +2224,39 @@ function hr(e) {
2175
2224
  se("request_routes", "read_page");
2176
2225
  return;
2177
2226
  }
2178
- const _ = typeof f.requestId == "string" ? f.requestId : void 0, T = (kt = te.current) == null ? void 0 : kt.call(te), z = T == null ? void 0 : T.localParticipant;
2179
- if (!(z != null && z.publishData)) return;
2227
+ const k = typeof f.requestId == "string" ? f.requestId : void 0, z = (Lt = te.current) == null ? void 0 : Lt.call(te), D = z == null ? void 0 : z.localParticipant;
2228
+ if (!(D != null && D.publishData)) return;
2180
2229
  try {
2181
- const B = sr(), U = _ ? { type: "routes", routes: B, requestId: _ } : { type: "routes", routes: B }, j = new TextEncoder().encode(JSON.stringify(U));
2182
- z.publishData(j, { reliable: !0 });
2230
+ const B = fr(), F = k ? { type: "routes", routes: B, requestId: k } : { type: "routes", routes: B }, O = new TextEncoder().encode(JSON.stringify(F));
2231
+ D.publishData(O, { reliable: !0 });
2183
2232
  } catch (B) {
2184
2233
  console.warn("[LiveLayer] request_routes: extractRoutes threw.", B);
2185
2234
  }
2186
2235
  return;
2187
2236
  }
2188
- pr.has(f.type) || _e == null || _e(f);
2237
+ _r.has(f.type) || _e == null || _e(f);
2189
2238
  }
2190
2239
  },
2191
2240
  [_e, we]
2192
- ), F = sn({
2193
- agentId: q ? "__controlled__" : Me,
2194
- baseUrl: i,
2241
+ ), U = fn({
2242
+ agentId: W ? "__controlled__" : Ie,
2243
+ baseUrl: o,
2195
2244
  apiKey: r,
2196
- sessionEndpoint: o,
2245
+ sessionEndpoint: i,
2197
2246
  sessionBody: l,
2198
- onDataMessage: q ? void 0 : De
2247
+ onDataMessage: W ? void 0 : De
2199
2248
  });
2200
2249
  P(() => {
2201
- if (q != null && q.subscribeToDataMessages)
2202
- return q.subscribeToDataMessages(De);
2203
- }, [q, De]), te.current = () => {
2204
- var m;
2205
- return (m = F.getRoom) == null ? void 0 : m.call(F);
2250
+ if (W != null && W.subscribeToDataMessages)
2251
+ return W.subscribeToDataMessages(De);
2252
+ }, [W, De]), te.current = () => {
2253
+ var v;
2254
+ return (v = U.getRoom) == null ? void 0 : v.call(U);
2206
2255
  }, P(() => {
2207
2256
  var G;
2208
2257
  if (typeof window > "u") return;
2209
- const m = ((G = window.location) == null ? void 0 : G.hostname) || "";
2210
- if (m === "localhost" || m === "127.0.0.1" || m === "0.0.0.0" || m.endsWith(".local") || m.endsWith(".test"))
2258
+ const v = ((G = window.location) == null ? void 0 : G.hostname) || "";
2259
+ if (v === "localhost" || v === "127.0.0.1" || v === "0.0.0.0" || v.endsWith(".local") || v.endsWith(".test"))
2211
2260
  return window.__livelayerSimulateCommand = (je) => {
2212
2261
  try {
2213
2262
  De(je);
@@ -2218,219 +2267,219 @@ function hr(e) {
2218
2267
  delete window.__livelayerSimulateCommand;
2219
2268
  };
2220
2269
  }, [De]);
2221
- const b = Ke(() => q ? {
2222
- connectionState: q.connectionState,
2223
- agentState: q.agentState,
2224
- transcript: q.transcript,
2225
- videoElement: q.videoElement,
2226
- audioElement: q.audioElement,
2227
- canResume: q.canResume,
2228
- error: q.error,
2270
+ const w = Je(() => W ? {
2271
+ connectionState: W.connectionState,
2272
+ agentState: W.agentState,
2273
+ transcript: W.transcript,
2274
+ videoElement: W.videoElement,
2275
+ audioElement: W.audioElement,
2276
+ canResume: W.canResume,
2277
+ error: W.error,
2229
2278
  agentConfig: null,
2230
2279
  connect: async () => {
2231
- await q.onConnect();
2280
+ await W.onConnect();
2232
2281
  },
2233
- disconnect: () => q.onDisconnect(),
2282
+ disconnect: () => W.onDisconnect(),
2234
2283
  // Dummy getRoom for shape compatibility — controlled consumers own the Room.
2235
2284
  // Internal session's getRoom returns null when no real connect has happened,
2236
2285
  // so we reuse its reference for type consistency.
2237
- getRoom: F.getRoom,
2286
+ getRoom: U.getRoom,
2238
2287
  isControlled: !0
2239
2288
  } : {
2240
- connectionState: F.connectionState,
2241
- agentState: F.agentState,
2242
- transcript: F.transcript,
2243
- videoElement: F.videoElement,
2244
- audioElement: F.audioElement,
2245
- canResume: F.canResume,
2246
- error: F.error,
2247
- agentConfig: F.agentConfig,
2248
- connect: F.connect,
2249
- disconnect: F.disconnect,
2250
- getRoom: F.getRoom,
2289
+ connectionState: U.connectionState,
2290
+ agentState: U.agentState,
2291
+ transcript: U.transcript,
2292
+ videoElement: U.videoElement,
2293
+ audioElement: U.audioElement,
2294
+ canResume: U.canResume,
2295
+ error: U.error,
2296
+ agentConfig: U.agentConfig,
2297
+ connect: U.connect,
2298
+ disconnect: U.disconnect,
2299
+ getRoom: U.getRoom,
2251
2300
  isControlled: !1
2252
- }, [q, F]), ft = M(null);
2301
+ }, [W, U]), pt = I(null);
2253
2302
  P(() => {
2254
- const m = b.videoElement, f = ft.current;
2255
- if (!(!m || !f))
2256
- return f.appendChild(m), () => {
2257
- m.parentNode === f && f.removeChild(m);
2303
+ const v = w.videoElement, f = pt.current;
2304
+ if (!(!v || !f))
2305
+ return f.appendChild(v), () => {
2306
+ v.parentNode === f && f.removeChild(v);
2258
2307
  };
2259
- }, [b.videoElement]), P(() => {
2260
- const m = b.audioElement;
2261
- if (!m) return;
2262
- le.attach(m);
2263
- const f = m.play();
2308
+ }, [w.videoElement]), P(() => {
2309
+ const v = w.audioElement;
2310
+ if (!v) return;
2311
+ le.attach(v);
2312
+ const f = v.play();
2264
2313
  return f && typeof f.catch == "function" && f.catch((G) => {
2265
2314
  (G == null ? void 0 : G.name) === "NotAllowedError" && ke(!0);
2266
2315
  }), () => {
2267
2316
  le.detach();
2268
2317
  };
2269
- }, [b.audioElement]), P(() => {
2270
- if (b.isControlled || b.connectionState !== "connected") return;
2271
- const m = b.getRoom();
2272
- if (m)
2273
- return Y.setupMic(m).catch(() => {
2274
- }), X.attachRoom(m), ae.attachRoom(m), Re.refresh(), () => {
2275
- Y.teardownMic(), X.teardown(), ae.teardown();
2318
+ }, [w.audioElement]), P(() => {
2319
+ if (w.isControlled || w.connectionState !== "connected") return;
2320
+ const v = w.getRoom();
2321
+ if (v)
2322
+ return Y.setupMic(v).catch(() => {
2323
+ }), K.attachRoom(v), ae.attachRoom(v), Me.refresh(), () => {
2324
+ Y.teardownMic(), K.teardown(), ae.teardown();
2276
2325
  };
2277
- }, [b.isControlled, b.connectionState]), P(() => {
2278
- const m = b.audioElement;
2279
- m && (m.muted = et);
2280
- }, [b.audioElement, et]);
2281
- const Ft = x((m) => {
2282
- const f = b.getRoom();
2326
+ }, [w.isControlled, w.connectionState]), P(() => {
2327
+ const v = w.audioElement;
2328
+ v && (v.muted = et);
2329
+ }, [w.audioElement, et]);
2330
+ const Vt = S((v) => {
2331
+ const f = w.getRoom();
2283
2332
  if (f)
2284
2333
  try {
2285
2334
  const G = new TextEncoder().encode(
2286
- JSON.stringify({ type: "user_message", text: m })
2335
+ JSON.stringify({ type: "user_message", text: v })
2287
2336
  );
2288
2337
  f.localParticipant.publishData(G, { reliable: !0 });
2289
2338
  } catch {
2290
2339
  }
2291
- }, [b]), Wt = x(() => {
2292
- Ut((m) => !m);
2340
+ }, [w]), Yt = S(() => {
2341
+ jt((v) => !v);
2293
2342
  }, []);
2294
2343
  P(() => {
2295
- be == null || be(b.connectionState), b.connectionState === "connected" ? fe == null || fe() : b.connectionState === "disconnected" && (ge == null || ge());
2296
- }, [b.connectionState, fe, ge, be]), P(() => {
2297
- ye == null || ye(b.transcript);
2298
- }, [b.transcript, ye]), P(() => {
2299
- ve == null || ve(b.agentState);
2300
- }, [b.agentState, ve]);
2301
- const pt = M(!1);
2344
+ be == null || be(w.connectionState), w.connectionState === "connected" ? fe == null || fe() : w.connectionState === "disconnected" && (ge == null || ge());
2345
+ }, [w.connectionState, fe, ge, be]), P(() => {
2346
+ ye == null || ye(w.transcript);
2347
+ }, [w.transcript, ye]), P(() => {
2348
+ ve == null || ve(w.agentState);
2349
+ }, [w.agentState, ve]);
2350
+ const ht = I(!1);
2302
2351
  P(() => {
2303
- b.isControlled || !s || pt.current || Ie && b.connectionState === "idle" && (pt.current = !0, b.connect());
2304
- }, [s, b.connectionState, b, Ie]);
2305
- const jt = x(
2306
- (m) => {
2307
- const f = L == null ? void 0 : L.find((G) => G.id === m);
2308
- f && (W(!1), m !== ee && (Pe(!0), b.disconnect(), ie || xe(m), H == null || H(f)));
2352
+ w.isControlled || !s || ht.current || Re && w.connectionState === "idle" && (ht.current = !0, w.connect());
2353
+ }, [s, w.connectionState, w, Re]);
2354
+ const Gt = S(
2355
+ (v) => {
2356
+ const f = C == null ? void 0 : C.find((G) => G.id === v);
2357
+ f && (j(!1), v !== ee && (Pe(!0), w.disconnect(), oe || xe(v), b == null || b(f)));
2309
2358
  },
2310
2359
  [
2311
- L,
2360
+ C,
2312
2361
  ee,
2313
- b,
2314
- ie,
2315
- H
2362
+ w,
2363
+ oe,
2364
+ b
2316
2365
  ]
2317
2366
  );
2318
2367
  P(() => {
2319
- Te && b.connectionState === "connected" && Pe(!1);
2320
- }, [b.connectionState, Te]), P(() => {
2321
- if (!h) return;
2322
- const m = (f) => {
2323
- f.key === "Escape" && W(!1);
2368
+ Te && w.connectionState === "connected" && Pe(!1);
2369
+ }, [w.connectionState, Te]), P(() => {
2370
+ if (!y) return;
2371
+ const v = (f) => {
2372
+ f.key === "Escape" && j(!1);
2324
2373
  };
2325
- return window.addEventListener("keydown", m), () => window.removeEventListener("keydown", m);
2326
- }, [h]);
2327
- const Vt = !!I || !!(V != null && V.avatarImageUrl) || b.isControlled, $e = gn(Me, i, Vt);
2328
- Ne === void 0 && ((gt = $e.info) != null && gt.capabilities) && (ot.current = $e.info.capabilities);
2329
- const lt = (V == null ? void 0 : V.name) ?? D ?? ((yt = b.agentConfig) == null ? void 0 : yt.name) ?? ((vt = $e.info) == null ? void 0 : vt.name) ?? "Live Layer", ht = (V == null ? void 0 : V.avatarImageUrl) ?? I ?? ((bt = b.agentConfig) == null ? void 0 : bt.avatarImageUrl) ?? ((wt = $e.info) == null ? void 0 : wt.avatarImageUrl) ?? null, Yt = R ?? ((_t = b.agentConfig) == null ? void 0 : _t.idleLoopUrl) ?? ((xt = $e.info) == null ? void 0 : xt.idleLoopUrl) ?? null, Gt = $ ?? null, Kt = x(() => K("expanded"), [K]), Xt = x(
2330
- () => K("minimized"),
2331
- [K]
2332
- ), mt = x(() => {
2333
- b.disconnect(), K("hidden");
2334
- }, [b, K]), Jt = x(() => {
2335
- const m = b.audioElement;
2336
- m && m.play().then(() => ke(!1)).catch(() => {
2374
+ return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
2375
+ }, [y]);
2376
+ const Jt = !!M || !!(V != null && V.avatarImageUrl) || w.isControlled, $e = bn(Ie, o, Jt);
2377
+ Ne === void 0 && ((yt = $e.info) != null && yt.capabilities) && (it.current = $e.info.capabilities);
2378
+ const lt = (V == null ? void 0 : V.name) ?? H ?? ((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, Kt = L ?? ((xt = w.agentConfig) == null ? void 0 : xt.idleLoopUrl) ?? ((kt = $e.info) == null ? void 0 : kt.idleLoopUrl) ?? null, Xt = $ ?? null, Qt = S(() => J("expanded"), [J]), Zt = S(
2379
+ () => J("minimized"),
2380
+ [J]
2381
+ ), gt = S(() => {
2382
+ w.disconnect(), J("hidden");
2383
+ }, [w, J]), en = S(() => {
2384
+ const v = w.audioElement;
2385
+ v && v.play().then(() => ke(!1)).catch(() => {
2337
2386
  });
2338
- }, [b.audioElement]), Qt = x(() => {
2339
- ke(!1), b.connect();
2340
- }, [b]), ze = {
2387
+ }, [w.audioElement]), tn = S(() => {
2388
+ ke(!1), w.connect();
2389
+ }, [w]), ze = {
2341
2390
  ...Fe,
2342
- zIndex: We
2391
+ zIndex: Ue
2343
2392
  };
2344
- g.primaryColor && (ze["--ll-color-primary"] = g.primaryColor), g.accentColor && (ze["--ll-color-accent"] = g.accentColor), g.backgroundColor && (ze["--ll-color-bg"] = g.backgroundColor), g.textColor && (ze["--ll-color-fg"] = g.textColor);
2345
- const Zt = [
2393
+ 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);
2394
+ const nn = [
2346
2395
  "ll-widget",
2347
- `ll-widget--${oe}`,
2396
+ `ll-widget--${ie}`,
2348
2397
  `ll-widget--${ne ? "mobile" : "desktop"}`,
2349
2398
  Qe
2350
2399
  ].filter(Boolean).join(" ");
2351
- return Ie ? /* @__PURE__ */ k(
2400
+ return Re ? /* @__PURE__ */ _(
2352
2401
  "div",
2353
2402
  {
2354
- className: Zt,
2403
+ className: nn,
2355
2404
  style: ze,
2356
- "data-display-mode": oe,
2357
- "data-position": p,
2405
+ "data-display-mode": ie,
2406
+ "data-position": m,
2358
2407
  children: [
2359
- oe === "hidden" && /* @__PURE__ */ n(
2360
- qn,
2408
+ ie === "hidden" && /* @__PURE__ */ n(
2409
+ Fn,
2361
2410
  {
2362
- position: p,
2411
+ position: m,
2363
2412
  isMobile: ne,
2364
- isSpeaking: b.agentState === "speaking",
2365
- onExpand: () => K("expanded"),
2413
+ isSpeaking: w.agentState === "speaking",
2414
+ onExpand: () => J("expanded"),
2366
2415
  label: `Open ${lt} widget`
2367
2416
  }
2368
2417
  ),
2369
- oe === "minimized" && /* @__PURE__ */ n(
2370
- Un,
2418
+ ie === "minimized" && /* @__PURE__ */ n(
2419
+ jn,
2371
2420
  {
2372
- position: p,
2421
+ position: m,
2373
2422
  isMobile: ne,
2374
2423
  agentName: lt,
2375
- avatarImageUrl: ht,
2376
- agentState: b.agentState,
2424
+ avatarImageUrl: mt,
2425
+ agentState: w.agentState,
2377
2426
  isMuted: Y.isMuted,
2378
2427
  audioLevel: le,
2379
- onExpand: Kt,
2428
+ onExpand: Qt,
2380
2429
  onToggleMute: Y.toggleMute,
2381
- onClose: mt
2430
+ onClose: gt
2382
2431
  }
2383
2432
  ),
2384
- oe === "expanded" && /* @__PURE__ */ n(
2385
- Wn,
2433
+ ie === "expanded" && /* @__PURE__ */ n(
2434
+ Yn,
2386
2435
  {
2387
- position: p,
2436
+ position: m,
2388
2437
  isMobile: ne,
2389
2438
  agentName: lt,
2390
- avatarImageUrl: ht,
2391
- idleLoopUrl: Yt,
2392
- greeting: Gt,
2393
- branding: g,
2394
- teamMembers: L,
2439
+ avatarImageUrl: mt,
2440
+ idleLoopUrl: Kt,
2441
+ greeting: Xt,
2442
+ branding: p,
2443
+ teamMembers: C,
2395
2444
  currentTeamMemberId: ee,
2396
2445
  isSwitchingTeamMember: Te,
2397
- teamSwitcherOpen: h,
2398
- onToggleTeamSwitcher: () => W((m) => !m),
2399
- onSelectTeamMember: jt,
2400
- connectionState: b.connectionState,
2401
- agentState: b.agentState,
2402
- transcript: b.transcript,
2446
+ teamSwitcherOpen: y,
2447
+ onToggleTeamSwitcher: () => j((v) => !v),
2448
+ onSelectTeamMember: Gt,
2449
+ connectionState: w.connectionState,
2450
+ agentState: w.agentState,
2451
+ transcript: w.transcript,
2403
2452
  isMuted: Y.isMuted,
2404
- micDevices: Re.mics,
2405
- isCameraEnabled: X.isEnabled,
2406
- cameraPreviewEl: X.previewEl,
2407
- cameraDevices: Re.cameras,
2408
- activeCameraId: X.activeDeviceId,
2453
+ micDevices: Me.mics,
2454
+ isCameraEnabled: K.isEnabled,
2455
+ cameraPreviewEl: K.previewEl,
2456
+ cameraDevices: Me.cameras,
2457
+ activeCameraId: K.activeDeviceId,
2409
2458
  isScreenShareEnabled: ae.isEnabled,
2410
2459
  screenPreviewEl: ae.previewEl,
2411
2460
  isSpeakerMuted: et,
2412
- allowCamera: v,
2461
+ allowCamera: g,
2413
2462
  allowScreenShare: E,
2414
- allowTyping: w,
2415
- languageMenuOpen: st,
2416
- onToggleLanguageMenu: () => Bt((m) => !m),
2463
+ allowTyping: x,
2464
+ languageMenuOpen: dt,
2465
+ onToggleLanguageMenu: () => Ut((v) => !v),
2417
2466
  needsUserGesture: Ze,
2418
- canResume: b.canResume,
2467
+ canResume: w.canResume,
2419
2468
  micError: Y.micError,
2420
- error: b.error,
2421
- avatarVideoContainerRef: ft,
2422
- onConnect: () => void b.connect(),
2423
- onDisconnect: () => b.disconnect(),
2424
- onRetry: Qt,
2425
- onResumeAudio: Jt,
2469
+ error: w.error,
2470
+ avatarVideoContainerRef: pt,
2471
+ onConnect: () => void w.connect(),
2472
+ onDisconnect: () => w.disconnect(),
2473
+ onRetry: tn,
2474
+ onResumeAudio: en,
2426
2475
  onToggleMute: Y.toggleMute,
2427
- onToggleCamera: () => void X.toggle(),
2428
- onSwitchCameraDevice: (m) => void X.switchDevice(m),
2476
+ onToggleCamera: () => void K.toggle(),
2477
+ onSwitchCameraDevice: (v) => void K.switchDevice(v),
2429
2478
  onToggleScreenShare: () => void ae.toggle(),
2430
- onToggleSpeaker: Wt,
2431
- onSendMessage: Ft,
2432
- onMinimize: Xt,
2433
- onClose: mt,
2479
+ onToggleSpeaker: Yt,
2480
+ onSendMessage: Vt,
2481
+ onMinimize: Zt,
2482
+ onClose: gt,
2434
2483
  onClearMicError: Y.clearError
2435
2484
  }
2436
2485
  )
@@ -2438,68 +2487,68 @@ function hr(e) {
2438
2487
  }
2439
2488
  ) : null;
2440
2489
  }
2441
- function wr(e) {
2442
- return /* @__PURE__ */ n(cn, { children: /* @__PURE__ */ n(hr, { ...e }) });
2490
+ function Rr(e) {
2491
+ return /* @__PURE__ */ n(un, { children: /* @__PURE__ */ n(xr, { ...e }) });
2443
2492
  }
2444
- const _r = ({
2493
+ const Ir = ({
2445
2494
  agentId: e,
2446
2495
  baseUrl: t,
2447
2496
  apiKey: r,
2448
- mode: i,
2449
- onAgentEvent: o,
2497
+ mode: o,
2498
+ onAgentEvent: i,
2450
2499
  className: l,
2451
2500
  style: s
2452
2501
  }) => {
2453
- const d = M(null), u = M(null), y = M(o);
2454
- y.current = o;
2455
- const p = x((a) => {
2456
- var S;
2502
+ const d = I(null), u = I(null), h = I(i);
2503
+ h.current = i;
2504
+ const m = S((a) => {
2505
+ var A;
2457
2506
  const c = a.detail;
2458
- (S = y.current) == null || S.call(y, c);
2507
+ (A = h.current) == null || A.call(h, c);
2459
2508
  }, []);
2460
2509
  return P(() => {
2461
2510
  const a = d.current;
2462
2511
  if (!a) return;
2463
2512
  const c = document.createElement("livelayer-widget");
2464
- 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, () => {
2465
- c.removeEventListener("agent-event", p), a.removeChild(c), u.current = null;
2513
+ return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), o && c.setAttribute("mode", o), c.addEventListener("agent-event", m), a.appendChild(c), u.current = c, () => {
2514
+ c.removeEventListener("agent-event", m), a.removeChild(c), u.current = null;
2466
2515
  };
2467
2516
  }, [e]), P(() => {
2468
- u.current && (i ? u.current.setAttribute("mode", i) : u.current.removeAttribute("mode"));
2469
- }, [i]), /* @__PURE__ */ n("div", { ref: d, className: l, style: s });
2470
- }, xr = at(
2471
- function({ id: t, intent: r, as: i = "div", className: o, style: l, children: s }, d) {
2472
- return rn(
2473
- i,
2517
+ u.current && (o ? u.current.setAttribute("mode", o) : u.current.removeAttribute("mode"));
2518
+ }, [o]), /* @__PURE__ */ n("div", { ref: d, className: l, style: s });
2519
+ }, Mr = ct(
2520
+ function({ id: t, intent: r, as: o = "div", className: i, style: l, children: s }, d) {
2521
+ return an(
2522
+ o,
2474
2523
  {
2475
2524
  ref: d,
2476
2525
  "data-ll-region": t,
2477
2526
  "data-ll-intent": r,
2478
- className: o,
2527
+ className: i,
2479
2528
  style: l
2480
2529
  },
2481
2530
  s
2482
2531
  );
2483
2532
  }
2484
- ), kr = at(
2485
- function({ id: t, intent: r, children: i, ...o }, l) {
2533
+ ), Tr = ct(
2534
+ function({ id: t, intent: r, children: o, ...i }, l) {
2486
2535
  return /* @__PURE__ */ n(
2487
2536
  "form",
2488
2537
  {
2489
2538
  ref: l,
2490
2539
  "data-ll-form": t,
2491
2540
  "data-ll-intent": r,
2492
- ...o,
2493
- children: i
2541
+ ...i,
2542
+ children: o
2494
2543
  }
2495
2544
  );
2496
2545
  }
2497
- ), Lr = at(
2546
+ ), Pr = ct(
2498
2547
  function(t, r) {
2499
- const { name: i, label: o, labelClassName: l } = t, s = { name: i, "data-ll-field": i };
2548
+ const { name: o, label: i, labelClassName: l } = t, s = { name: o, "data-ll-field": o };
2500
2549
  let d;
2501
2550
  if ("as" in t && t.as === "textarea") {
2502
- const { name: u, label: y, labelClassName: p, as: a, ...c } = t;
2551
+ const { name: u, label: h, labelClassName: m, as: a, ...c } = t;
2503
2552
  d = /* @__PURE__ */ n(
2504
2553
  "textarea",
2505
2554
  {
@@ -2509,18 +2558,18 @@ const _r = ({
2509
2558
  }
2510
2559
  );
2511
2560
  } else if ("as" in t && t.as === "select") {
2512
- const { name: u, label: y, labelClassName: p, as: a, children: c, ...S } = t;
2561
+ const { name: u, label: h, labelClassName: m, as: a, children: c, ...A } = t;
2513
2562
  d = /* @__PURE__ */ n(
2514
2563
  "select",
2515
2564
  {
2516
2565
  ref: r,
2517
2566
  ...s,
2518
- ...S,
2567
+ ...A,
2519
2568
  children: c
2520
2569
  }
2521
2570
  );
2522
2571
  } else {
2523
- const { name: u, label: y, labelClassName: p, as: a, ...c } = t;
2572
+ const { name: u, label: h, labelClassName: m, as: a, ...c } = t;
2524
2573
  d = /* @__PURE__ */ n(
2525
2574
  "input",
2526
2575
  {
@@ -2530,56 +2579,390 @@ const _r = ({
2530
2579
  }
2531
2580
  );
2532
2581
  }
2533
- return o === void 0 ? d : /* @__PURE__ */ k("label", { className: l, children: [
2534
- o,
2582
+ return i === void 0 ? d : /* @__PURE__ */ _("label", { className: l, children: [
2583
+ i,
2535
2584
  d
2536
2585
  ] });
2537
2586
  }
2538
2587
  );
2539
- function Er() {
2540
- const [e, t] = C([]), r = x((o) => {
2588
+ let qt = 1;
2589
+ function Dr({
2590
+ onMount: e,
2591
+ defaultOpen: t = !1,
2592
+ storageKey: r = "ll-debug-open"
2593
+ }) {
2594
+ const [o, i] = N(t), [l, s] = N([]), [d, u] = N(""), [h, m] = N(!1), a = I(/* @__PURE__ */ new Set()), c = I([]), A = I(h);
2595
+ A.current = h, P(() => {
2596
+ try {
2597
+ const b = localStorage.getItem(r);
2598
+ b === "1" && i(!0), b === "0" && i(!1);
2599
+ } catch {
2600
+ }
2601
+ }, [r]), P(() => {
2602
+ try {
2603
+ localStorage.setItem(r, o ? "1" : "0");
2604
+ } catch {
2605
+ }
2606
+ }, [o, r]), P(() => {
2607
+ const b = (L) => {
2608
+ (L.metaKey || L.ctrlKey) && L.shiftKey && L.key.toLowerCase() === "l" && (L.preventDefault(), i(($) => !$));
2609
+ };
2610
+ return window.addEventListener("keydown", b), () => window.removeEventListener("keydown", b);
2611
+ }, []), P(() => {
2612
+ const b = setInterval(() => {
2613
+ if (c.current.length === 0 || A.current) return;
2614
+ const L = c.current.splice(0, c.current.length);
2615
+ s(
2616
+ ($) => [...L.reverse(), ...$].slice(0, 200)
2617
+ );
2618
+ }, 100);
2619
+ return () => clearInterval(b);
2620
+ }, []);
2621
+ const C = I(!1);
2622
+ if (P(() => {
2623
+ !e || C.current || (C.current = !0, e((b) => {
2624
+ c.current.push({
2625
+ id: qt++,
2626
+ ts: Date.now(),
2627
+ kind: "event",
2628
+ type: b.eventName,
2629
+ data: b.data
2630
+ });
2631
+ }));
2632
+ }, [e]), P(() => {
2633
+ const b = console.warn, L = console.log, $ = (M, H) => function(...p) {
2634
+ try {
2635
+ const g = typeof p[0] == "string" ? p[0] : "";
2636
+ g.startsWith("[LiveLayer]") && c.current.push({
2637
+ id: qt++,
2638
+ ts: Date.now(),
2639
+ kind: M,
2640
+ type: g.slice(0, 120),
2641
+ data: { args: p.slice(1).map((E) => Lr(E)) }
2642
+ });
2643
+ } catch {
2644
+ }
2645
+ return H.apply(this, p);
2646
+ };
2647
+ return console.warn = $("warn", b), console.log = $("log", L), () => {
2648
+ console.warn = b, console.log = L;
2649
+ };
2650
+ }, []), !o)
2651
+ return /* @__PURE__ */ n(
2652
+ "button",
2653
+ {
2654
+ type: "button",
2655
+ onClick: () => i(!0),
2656
+ title: "Open LiveLayer debug panel (Cmd/Ctrl + Shift + L)",
2657
+ "aria-label": "Open LiveLayer debug panel",
2658
+ style: {
2659
+ position: "fixed",
2660
+ left: 16,
2661
+ bottom: 16,
2662
+ zIndex: 2147483640,
2663
+ background: "#0d0d0d",
2664
+ color: "#fff",
2665
+ border: "1px solid rgba(255,255,255,0.18)",
2666
+ borderRadius: 999,
2667
+ padding: "6px 10px",
2668
+ font: "500 11px -apple-system, BlinkMacSystemFont, system-ui, sans-serif",
2669
+ letterSpacing: "-0.1px",
2670
+ cursor: "pointer",
2671
+ boxShadow: "0 4px 12px rgba(0,0,0,0.35)",
2672
+ opacity: 0.85
2673
+ },
2674
+ children: "🛰 LL debug"
2675
+ }
2676
+ );
2677
+ const R = l.filter((b) => {
2678
+ if (!d) return !0;
2679
+ const L = d.toLowerCase();
2680
+ return b.type.toLowerCase().includes(L) || JSON.stringify(b.data || {}).toLowerCase().includes(L);
2681
+ });
2682
+ return /* @__PURE__ */ _(
2683
+ "div",
2684
+ {
2685
+ style: {
2686
+ position: "fixed",
2687
+ left: 16,
2688
+ bottom: 16,
2689
+ zIndex: 2147483640,
2690
+ width: 380,
2691
+ maxHeight: "60vh",
2692
+ background: "#0d0d0d",
2693
+ color: "#fff",
2694
+ border: "1px solid rgba(255,255,255,0.16)",
2695
+ borderRadius: 12,
2696
+ boxShadow: "0 16px 48px rgba(0,0,0,0.5)",
2697
+ font: "500 11px -apple-system, BlinkMacSystemFont, system-ui, sans-serif",
2698
+ letterSpacing: "-0.1px",
2699
+ display: "flex",
2700
+ flexDirection: "column",
2701
+ overflow: "hidden"
2702
+ },
2703
+ children: [
2704
+ /* @__PURE__ */ _(
2705
+ "div",
2706
+ {
2707
+ style: {
2708
+ padding: "8px 10px",
2709
+ background: "rgba(255,255,255,0.04)",
2710
+ borderBottom: "1px solid rgba(255,255,255,0.1)",
2711
+ display: "flex",
2712
+ alignItems: "center",
2713
+ gap: 8
2714
+ },
2715
+ children: [
2716
+ /* @__PURE__ */ n("span", { style: { fontWeight: 600, fontSize: 12 }, children: "LiveLayer debug" }),
2717
+ /* @__PURE__ */ _("span", { style: { fontSize: 10, color: "rgba(255,255,255,0.4)" }, children: [
2718
+ l.length,
2719
+ " event",
2720
+ l.length === 1 ? "" : "s"
2721
+ ] }),
2722
+ /* @__PURE__ */ n("span", { style: { flex: 1 } }),
2723
+ /* @__PURE__ */ n(
2724
+ "button",
2725
+ {
2726
+ type: "button",
2727
+ onClick: () => m((b) => !b),
2728
+ style: at(h ? "#f59e0b" : "transparent"),
2729
+ title: "Pause / resume capture",
2730
+ children: h ? "▶ resume" : "⏸ pause"
2731
+ }
2732
+ ),
2733
+ /* @__PURE__ */ n(
2734
+ "button",
2735
+ {
2736
+ type: "button",
2737
+ onClick: () => {
2738
+ s([]), c.current = [];
2739
+ },
2740
+ style: at("transparent"),
2741
+ title: "Clear buffer",
2742
+ children: "clear"
2743
+ }
2744
+ ),
2745
+ /* @__PURE__ */ n(
2746
+ "button",
2747
+ {
2748
+ type: "button",
2749
+ onClick: () => i(!1),
2750
+ style: at("transparent"),
2751
+ "aria-label": "Close",
2752
+ title: "Close (Cmd/Ctrl + Shift + L)",
2753
+ children: "✕"
2754
+ }
2755
+ )
2756
+ ]
2757
+ }
2758
+ ),
2759
+ /* @__PURE__ */ n(
2760
+ "input",
2761
+ {
2762
+ type: "text",
2763
+ value: d,
2764
+ onChange: (b) => u(b.target.value),
2765
+ placeholder: "filter by type or data…",
2766
+ style: {
2767
+ margin: 8,
2768
+ padding: "6px 8px",
2769
+ background: "rgba(255,255,255,0.06)",
2770
+ border: "1px solid rgba(255,255,255,0.1)",
2771
+ borderRadius: 6,
2772
+ color: "#fff",
2773
+ fontSize: 11,
2774
+ outline: "none"
2775
+ }
2776
+ }
2777
+ ),
2778
+ /* @__PURE__ */ n(
2779
+ "div",
2780
+ {
2781
+ style: {
2782
+ flex: 1,
2783
+ overflowY: "auto",
2784
+ padding: "0 8px 8px"
2785
+ },
2786
+ children: R.length === 0 ? /* @__PURE__ */ _(
2787
+ "div",
2788
+ {
2789
+ style: {
2790
+ padding: 14,
2791
+ fontSize: 11,
2792
+ color: "rgba(255,255,255,0.4)",
2793
+ lineHeight: 1.5
2794
+ },
2795
+ children: [
2796
+ "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:",
2797
+ /* @__PURE__ */ n(
2798
+ "pre",
2799
+ {
2800
+ style: {
2801
+ marginTop: 6,
2802
+ background: "rgba(255,255,255,0.04)",
2803
+ padding: 6,
2804
+ borderRadius: 4,
2805
+ fontSize: 10,
2806
+ whiteSpace: "pre-wrap"
2807
+ },
2808
+ children: `window.__livelayerSimulateCommand({
2809
+ type: "navigate",
2810
+ href: "/about"
2811
+ })`
2812
+ }
2813
+ )
2814
+ ]
2815
+ }
2816
+ ) : R.map((b) => /* @__PURE__ */ n(
2817
+ kr,
2818
+ {
2819
+ entry: b,
2820
+ expanded: a.current.has(b.id),
2821
+ onToggle: () => {
2822
+ a.current.has(b.id) ? a.current.delete(b.id) : a.current.add(b.id), s((L) => [...L]);
2823
+ }
2824
+ },
2825
+ b.id
2826
+ ))
2827
+ }
2828
+ )
2829
+ ]
2830
+ }
2831
+ );
2832
+ }
2833
+ function kr({
2834
+ entry: e,
2835
+ expanded: t,
2836
+ onToggle: r
2837
+ }) {
2838
+ const o = e.kind === "warn" ? "#f59e0b" : e.type.startsWith("[LiveLayer]") ? "#94a3b8" : e.type === "navigate" || e.type === "scroll_page" || e.type === "scroll_to" || e.type === "click" ? "#22c55e" : e.type === "fill_form" || e.type === "submit_form" || e.type === "focus_field" ? "#a78bfa" : e.type === "request_page_context" || e.type === "request_routes" ? "#38bdf8" : e.type === "agent_state" ? "#facc15" : "#cbd5e1", i = new Date(e.ts).toLocaleTimeString("en-US", {
2839
+ hour12: !1
2840
+ });
2841
+ return /* @__PURE__ */ _(
2842
+ "button",
2843
+ {
2844
+ type: "button",
2845
+ onClick: r,
2846
+ style: {
2847
+ textAlign: "left",
2848
+ background: "transparent",
2849
+ border: 0,
2850
+ color: "#fff",
2851
+ width: "100%",
2852
+ padding: "6px 4px",
2853
+ cursor: "pointer",
2854
+ borderBottom: "1px solid rgba(255,255,255,0.04)",
2855
+ fontSize: 11,
2856
+ lineHeight: 1.4
2857
+ },
2858
+ children: [
2859
+ /* @__PURE__ */ _("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
2860
+ /* @__PURE__ */ n(
2861
+ "span",
2862
+ {
2863
+ style: {
2864
+ color: "rgba(255,255,255,0.4)",
2865
+ fontVariantNumeric: "tabular-nums",
2866
+ fontSize: 10
2867
+ },
2868
+ children: i
2869
+ }
2870
+ ),
2871
+ /* @__PURE__ */ n(
2872
+ "span",
2873
+ {
2874
+ style: {
2875
+ color: o,
2876
+ fontWeight: 600,
2877
+ flexShrink: 0
2878
+ },
2879
+ children: e.type.length > 50 ? e.type.slice(0, 50) + "…" : e.type
2880
+ }
2881
+ )
2882
+ ] }),
2883
+ t && e.data && /* @__PURE__ */ n(
2884
+ "pre",
2885
+ {
2886
+ style: {
2887
+ marginTop: 6,
2888
+ padding: 6,
2889
+ background: "rgba(255,255,255,0.04)",
2890
+ borderRadius: 4,
2891
+ fontSize: 10,
2892
+ overflowX: "auto",
2893
+ whiteSpace: "pre-wrap",
2894
+ wordBreak: "break-all"
2895
+ },
2896
+ children: JSON.stringify(e.data, null, 2)
2897
+ }
2898
+ )
2899
+ ]
2900
+ }
2901
+ );
2902
+ }
2903
+ function at(e) {
2904
+ return {
2905
+ background: e,
2906
+ color: "#fff",
2907
+ border: "1px solid rgba(255,255,255,0.16)",
2908
+ borderRadius: 999,
2909
+ padding: "3px 8px",
2910
+ fontSize: 10,
2911
+ cursor: "pointer"
2912
+ };
2913
+ }
2914
+ function Lr(e) {
2915
+ try {
2916
+ return e instanceof Error ? { message: e.message, stack: e.stack } : (JSON.stringify(e), e);
2917
+ } catch {
2918
+ return String(e);
2919
+ }
2920
+ }
2921
+ function $r() {
2922
+ const [e, t] = N([]), r = S((i) => {
2541
2923
  t((l) => {
2542
- const s = l.findIndex((d) => d.id === o.id);
2924
+ const s = l.findIndex((d) => d.id === i.id);
2543
2925
  if (s >= 0) {
2544
2926
  const d = l.slice();
2545
- return d[s] = o, d;
2927
+ return d[s] = i, d;
2546
2928
  }
2547
- return [...l, o];
2929
+ return [...l, i];
2548
2930
  });
2549
- }, []), i = x(() => t([]), []);
2931
+ }, []), o = S(() => t([]), []);
2550
2932
  return {
2551
2933
  entries: e,
2552
2934
  pushSegment: r,
2553
- clear: i,
2935
+ clear: o,
2554
2936
  latest: e.length > 0 ? e[e.length - 1] : null
2555
2937
  };
2556
2938
  }
2557
2939
  export {
2558
- wr as AvatarWidget,
2559
- cn as ErrorBoundary,
2560
- Lr as LiveLayerField,
2561
- kr as LiveLayerForm,
2562
- xr as LiveLayerRegion,
2563
- _r as LiveLayerWidget,
2564
- ir as clearPageContextCache,
2565
- dr as clearRoutesCache,
2566
- rr as extractPageContext,
2567
- ar as extractRoutes,
2568
- zt as getCachedPageContext,
2569
- sr as getCachedRoutes,
2570
- Mn as matchesPattern,
2571
- Rn as shouldRenderAtPath,
2572
- gn as useAgentInfo,
2573
- dn as useAudioLevel,
2574
- pn as useCameraState,
2575
- bn as useDisplayMode,
2576
- xn as useDisplayModePersistence,
2577
- Ln as useIsMobile,
2578
- sn as useLiveKitSession,
2579
- mn as useMediaDevices,
2580
- un as useMicrophoneState,
2581
- Cn as usePathname,
2582
- Tn as useRouteMatch,
2583
- hn as useScreenShareState,
2584
- Er as useTranscript
2940
+ Rr as AvatarWidget,
2941
+ un as ErrorBoundary,
2942
+ Dr as LiveLayerDebugPanel,
2943
+ Pr as LiveLayerField,
2944
+ Tr as LiveLayerForm,
2945
+ Mr as LiveLayerRegion,
2946
+ Ir as LiveLayerWidget,
2947
+ ar as clearPageContextCache,
2948
+ pr as clearRoutesCache,
2949
+ lr as extractPageContext,
2950
+ dr as extractRoutes,
2951
+ Ht as getCachedPageContext,
2952
+ fr as getCachedRoutes,
2953
+ Pn as matchesPattern,
2954
+ Dn as shouldRenderAtPath,
2955
+ bn as useAgentInfo,
2956
+ pn as useAudioLevel,
2957
+ gn as useCameraState,
2958
+ xn as useDisplayMode,
2959
+ Sn as useDisplayModePersistence,
2960
+ En as useIsMobile,
2961
+ fn as useLiveKitSession,
2962
+ vn as useMediaDevices,
2963
+ hn as useMicrophoneState,
2964
+ An as usePathname,
2965
+ $n as useRouteMatch,
2966
+ yn as useScreenShareState,
2967
+ $r as useTranscript
2585
2968
  };