@livelayer/react 0.10.6 → 0.12.6

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