@livelayer/react 0.9.5 → 0.9.7

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