@livelayer/react 0.5.5-pr66c.3 → 0.5.5-pr66c.5

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