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