@livelayer/react 0.9.4 → 0.9.6

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