@livelayer/react 0.6.2 → 0.8.0

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