@livelayer/react 0.23.1 → 0.23.3

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,11 +1,11 @@
1
1
  "use client";
2
2
  import { jsxs as S, jsx as r, Fragment as Ve } from "react/jsx-runtime";
3
- import { Component as Sr, useState as M, useRef as T, useEffect as I, useCallback as k, useMemo as at, useLayoutEffect as Qn, forwardRef as on, useImperativeHandle as Er, createElement as Ar } from "react";
3
+ import { Component as Er, useState as M, useRef as R, useEffect as I, useCallback as L, useMemo as at, useLayoutEffect as er, forwardRef as on, useImperativeHandle as Ar, createElement as Nr } from "react";
4
4
  import { createPortal as ln } from "react-dom";
5
- import { LiveKitSession as Nr, registerFields as Mr } from "@livelayer/sdk";
6
- import { clearFieldRegistry as Bo, getRegisteredFields as Wo, registerFields as qo, setFieldValue as Uo } from "@livelayer/sdk";
7
- import { createLocalAudioTrack as Ir, Track as er, createLocalVideoTrack as Tr } from "livekit-client";
8
- class Rr extends Sr {
5
+ import { LiveKitSession as Mr, registerFields as Ir } from "@livelayer/sdk";
6
+ import { clearFieldRegistry as Wo, getRegisteredFields as qo, registerFields as Uo, setFieldValue as jo } from "@livelayer/sdk";
7
+ import { createLocalAudioTrack as Rr, Track as tr, createLocalVideoTrack as Tr } from "livekit-client";
8
+ class Pr extends Er {
9
9
  constructor() {
10
10
  super(...arguments), this.state = { hasError: !1, error: null }, this.reset = () => {
11
11
  this.setState({ hasError: !1, error: null });
@@ -36,25 +36,25 @@ class Rr extends Sr {
36
36
  }
37
37
  }
38
38
  function Dr(e) {
39
- const [t, n] = M("idle"), [i, l] = M("idle"), [o, s] = M([]), [a, c] = M(null), [u, m] = M(null), [p, h] = M(null), [P, _] = M(!1), [C, g] = M(null), w = T(null), D = T(e.onDataMessage);
40
- D.current = e.onDataMessage, I(() => {
41
- const y = {
39
+ const [t, n] = M("idle"), [i, l] = M("idle"), [o, s] = M([]), [a, c] = M(null), [d, g] = M(null), [p, m] = M(null), [D, x] = M(!1), [C, y] = M(null), w = R(null), P = R(e.onDataMessage);
40
+ P.current = e.onDataMessage, I(() => {
41
+ const v = {
42
42
  onConnectionStateChange: (B) => {
43
- n(B), B === "connected" && g(null);
43
+ n(B), B === "connected" && y(null);
44
44
  },
45
45
  onAgentStateChange: l,
46
46
  onTranscript: (B) => s([...B]),
47
47
  onAgentConfig: c,
48
- onAudioTrack: (B) => h(B),
49
- onVideoTrack: (B) => m(B),
50
- onVideoTrackRemoved: () => m(null),
51
- onError: (B) => g(B),
48
+ onAudioTrack: (B) => m(B),
49
+ onVideoTrack: (B) => g(B),
50
+ onVideoTrackRemoved: () => g(null),
51
+ onError: (B) => y(B),
52
52
  onDataMessage: (B) => {
53
53
  var J;
54
- (J = D.current) == null || J.call(D, B);
54
+ (J = P.current) == null || J.call(P, B);
55
55
  },
56
- onResumabilityChange: _
57
- }, z = new Nr(
56
+ onResumabilityChange: x
57
+ }, z = new Mr(
58
58
  {
59
59
  agentId: e.agentId,
60
60
  baseUrl: e.baseUrl,
@@ -62,9 +62,9 @@ function Dr(e) {
62
62
  sessionEndpoint: e.sessionEndpoint,
63
63
  sessionBody: e.sessionBody
64
64
  },
65
- y
65
+ v
66
66
  );
67
- return w.current = z, n("idle"), l("idle"), s([]), c(null), m(null), h(null), _(!1), g(null), () => {
67
+ return w.current = z, n("idle"), l("idle"), s([]), c(null), g(null), m(null), x(!1), y(null), () => {
68
68
  var B;
69
69
  (B = z.destroy) == null || B.call(z), w.current = null;
70
70
  };
@@ -75,62 +75,62 @@ function Dr(e) {
75
75
  e.sessionEndpoint,
76
76
  JSON.stringify(e.sessionBody ?? {})
77
77
  ]);
78
- const E = k(async () => {
79
- const y = w.current;
80
- if (y)
78
+ const E = L(async () => {
79
+ const v = w.current;
80
+ if (v)
81
81
  try {
82
- await y.connect();
82
+ await v.connect();
83
83
  } catch (z) {
84
- throw g(z instanceof Error ? z.message : String(z)), z;
84
+ throw y(z instanceof Error ? z.message : String(z)), z;
85
85
  }
86
- }, []), v = k(() => {
87
- const y = w.current;
88
- y && y.disconnect();
89
- }, []), O = k(() => {
90
- var y;
91
- return ((y = w.current) == null ? void 0 : y.getRoom()) ?? null;
86
+ }, []), b = L(() => {
87
+ const v = w.current;
88
+ v && v.disconnect();
89
+ }, []), O = L(() => {
90
+ var v;
91
+ return ((v = w.current) == null ? void 0 : v.getRoom()) ?? null;
92
92
  }, []);
93
93
  return {
94
94
  connectionState: t,
95
95
  agentState: i,
96
96
  transcript: o,
97
97
  agentConfig: a,
98
- videoElement: u,
98
+ videoElement: d,
99
99
  audioElement: p,
100
- canResume: P,
100
+ canResume: D,
101
101
  error: C,
102
102
  connect: E,
103
- disconnect: v,
103
+ disconnect: b,
104
104
  getRoom: O,
105
105
  session: w.current
106
106
  };
107
107
  }
108
- function Pr() {
109
- const e = T(null), t = T(/* @__PURE__ */ new Map()), n = T(null), i = T(/* @__PURE__ */ new Set()), l = k(() => {
110
- const _ = t.current;
111
- if (_.size === 0) {
108
+ function zr() {
109
+ const e = R(null), t = R(/* @__PURE__ */ new Map()), n = R(null), i = R(/* @__PURE__ */ new Set()), l = L(() => {
110
+ const x = t.current;
111
+ if (x.size === 0) {
112
112
  n.current = null;
113
113
  return;
114
114
  }
115
115
  let C = 0;
116
- for (const { analyser: g, buffer: w } of _.values()) {
117
- g.getByteFrequencyData(w);
118
- let D = 0;
119
- for (let v = 0; v < w.length; v++) D += w[v];
120
- const E = D / w.length / 255;
116
+ for (const { analyser: y, buffer: w } of x.values()) {
117
+ y.getByteFrequencyData(w);
118
+ let P = 0;
119
+ for (let b = 0; b < w.length; b++) P += w[b];
120
+ const E = P / w.length / 255;
121
121
  E > C && (C = E);
122
122
  }
123
- for (const g of i.current)
123
+ for (const y of i.current)
124
124
  try {
125
- g(C);
125
+ y(C);
126
126
  } catch (w) {
127
127
  console.error("[useAudioLevel] subscriber threw:", w);
128
128
  }
129
129
  n.current = requestAnimationFrame(l);
130
- }, []), o = k(() => e.current ? e.current : typeof window > "u" || typeof AudioContext > "u" ? null : (e.current = new AudioContext(), e.current), []), s = k(() => {
130
+ }, []), o = L(() => e.current ? e.current : typeof window > "u" || typeof AudioContext > "u" ? null : (e.current = new AudioContext(), e.current), []), s = L(() => {
131
131
  n.current === null && t.current.size > 0 && (n.current = requestAnimationFrame(l));
132
- }, [l]), a = k((_) => {
133
- const C = t.current.get(_);
132
+ }, [l]), a = L((x) => {
133
+ const C = t.current.get(x);
134
134
  if (C) {
135
135
  try {
136
136
  C.node.disconnect();
@@ -140,35 +140,35 @@ function Pr() {
140
140
  C.analyser.disconnect();
141
141
  } catch {
142
142
  }
143
- t.current.delete(_);
143
+ t.current.delete(x);
144
144
  }
145
- }, []), c = k(
146
- (_, C) => {
147
- const g = o();
148
- if (!g) return;
149
- a(_);
150
- const w = C(g);
145
+ }, []), c = L(
146
+ (x, C) => {
147
+ const y = o();
148
+ if (!y) return;
149
+ a(x);
150
+ const w = C(y);
151
151
  if (!w) return;
152
- const D = g.createAnalyser();
153
- D.fftSize = 64;
152
+ const P = y.createAnalyser();
153
+ P.fftSize = 64;
154
154
  try {
155
- w.connect(D);
155
+ w.connect(P);
156
156
  } catch (E) {
157
- console.warn("[useAudioLevel] connect failed for slot", _, E);
157
+ console.warn("[useAudioLevel] connect failed for slot", x, E);
158
158
  return;
159
159
  }
160
- t.current.set(_, {
161
- analyser: D,
160
+ t.current.set(x, {
161
+ analyser: P,
162
162
  node: w,
163
- buffer: new Uint8Array(new ArrayBuffer(D.frequencyBinCount))
163
+ buffer: new Uint8Array(new ArrayBuffer(P.frequencyBinCount))
164
164
  }), s();
165
165
  },
166
166
  [a, o, s]
167
- ), u = k(
168
- (_, C = "agent") => {
169
- c(C, (g) => {
167
+ ), d = L(
168
+ (x, C = "agent") => {
169
+ c(C, (y) => {
170
170
  try {
171
- return g.createMediaElementSource(_);
171
+ return y.createMediaElementSource(x);
172
172
  } catch (w) {
173
173
  return console.warn(
174
174
  "[useAudioLevel] createMediaElementSource failed for slot",
@@ -179,11 +179,11 @@ function Pr() {
179
179
  });
180
180
  },
181
181
  [c]
182
- ), m = k(
183
- (_, C = "mic") => {
184
- c(C, (g) => {
182
+ ), g = L(
183
+ (x, C = "mic") => {
184
+ c(C, (y) => {
185
185
  try {
186
- return g.createMediaStreamSource(_);
186
+ return y.createMediaStreamSource(x);
187
187
  } catch (w) {
188
188
  return console.warn(
189
189
  "[useAudioLevel] createMediaStreamSource failed for slot",
@@ -194,20 +194,20 @@ function Pr() {
194
194
  });
195
195
  },
196
196
  [c]
197
- ), p = k(
198
- (_) => {
199
- a(_), t.current.size === 0 && n.current !== null && (cancelAnimationFrame(n.current), n.current = null);
197
+ ), p = L(
198
+ (x) => {
199
+ a(x), t.current.size === 0 && n.current !== null && (cancelAnimationFrame(n.current), n.current = null);
200
200
  },
201
201
  [a]
202
- ), h = k(() => {
202
+ ), m = L(() => {
203
203
  n.current !== null && (cancelAnimationFrame(n.current), n.current = null);
204
- for (const _ of Array.from(t.current.keys()))
205
- a(_);
206
- }, [a]), P = k((_) => (i.current.add(_), () => {
207
- i.current.delete(_);
204
+ for (const x of Array.from(t.current.keys()))
205
+ a(x);
206
+ }, [a]), D = L((x) => (i.current.add(x), () => {
207
+ i.current.delete(x);
208
208
  }), []);
209
209
  return I(() => () => {
210
- if (h(), e.current) {
210
+ if (m(), e.current) {
211
211
  try {
212
212
  e.current.close();
213
213
  } catch {
@@ -215,162 +215,162 @@ function Pr() {
215
215
  e.current = null;
216
216
  }
217
217
  i.current.clear();
218
- }, [h]), { attach: u, attachStream: m, detach: h, detachSlot: p, subscribe: P };
218
+ }, [m]), { attach: d, attachStream: g, detach: m, detachSlot: p, subscribe: D };
219
219
  }
220
- function zr(e) {
220
+ function $r(e) {
221
221
  const t = e == null ? void 0 : e.mediaStreamTrack;
222
222
  return t ? new MediaStream([t]) : null;
223
223
  }
224
- function $r(e = {}) {
225
- const t = e.gateUntilAgentReady ?? !1, n = e.agentState ?? null, [i, l] = M(t), [o, s] = M(""), [a, c] = M(null), u = T(null), m = T(null), p = T({
224
+ function Hr(e = {}) {
225
+ const t = e.gateUntilAgentReady ?? !1, n = e.agentState ?? null, [i, l] = M(t), [o, s] = M(""), [a, c] = M(null), d = R(null), g = R(null), p = R({
226
226
  active: t,
227
227
  lastAutoIntent: null
228
- }), h = k(async (E) => {
229
- var v, O;
230
- if (u.current && m.current) {
228
+ }), m = L(async (E) => {
229
+ var b, O;
230
+ if (d.current && g.current) {
231
231
  try {
232
- await m.current.localParticipant.unpublishTrack(u.current);
232
+ await g.current.localParticipant.unpublishTrack(d.current);
233
233
  } catch {
234
234
  }
235
- u.current.stop(), u.current = null;
235
+ d.current.stop(), d.current = null;
236
236
  }
237
- m.current = E, c(null);
237
+ g.current = E, c(null);
238
238
  try {
239
- const y = await Ir({
239
+ const v = await Rr({
240
240
  echoCancellation: !0,
241
241
  noiseSuppression: !0
242
242
  });
243
- await E.localParticipant.publishTrack(y), u.current = y, p.current.active ? (await E.localParticipant.setMicrophoneEnabled(!1), p.current.lastAutoIntent = !1, l(!0)) : l(y.isMuted);
244
- const z = (O = (v = y.mediaStreamTrack) == null ? void 0 : v.getSettings) == null ? void 0 : O.call(v);
243
+ await E.localParticipant.publishTrack(v), d.current = v, p.current.active ? (await E.localParticipant.setMicrophoneEnabled(!1), p.current.lastAutoIntent = !1, l(!0)) : l(v.isMuted);
244
+ const z = (O = (b = v.mediaStreamTrack) == null ? void 0 : b.getSettings) == null ? void 0 : O.call(b);
245
245
  z != null && z.deviceId && s(z.deviceId);
246
- } catch (y) {
247
- const z = y instanceof Error && y.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
248
- throw c(z), y;
246
+ } catch (v) {
247
+ const z = v instanceof Error && v.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
248
+ throw c(z), v;
249
249
  }
250
- }, []), P = k((E) => {
251
- m.current = E;
252
- }, []), _ = k(async (E) => {
253
- const v = m.current;
254
- if (v)
250
+ }, []), D = L((E) => {
251
+ g.current = E;
252
+ }, []), x = L(async (E) => {
253
+ const b = g.current;
254
+ if (b)
255
255
  try {
256
- await v.switchActiveDevice("audioinput", E), s(E);
256
+ await b.switchActiveDevice("audioinput", E), s(E);
257
257
  } catch (O) {
258
258
  console.warn("[useMicrophoneState] switchDevice failed:", O);
259
259
  }
260
- }, []), C = k(async () => {
261
- const E = m.current, v = !i;
262
- if (l(v), p.current.active = !1, !!E)
260
+ }, []), C = L(async () => {
261
+ const E = g.current, b = !i;
262
+ if (l(b), p.current.active = !1, !!E)
263
263
  try {
264
- await E.localParticipant.setMicrophoneEnabled(!v);
264
+ await E.localParticipant.setMicrophoneEnabled(!b);
265
265
  } catch (O) {
266
- console.warn("[useMicrophoneState] setMicrophoneEnabled failed:", O), l(!v);
266
+ console.warn("[useMicrophoneState] setMicrophoneEnabled failed:", O), l(!b);
267
267
  }
268
268
  }, [i]);
269
269
  I(() => {
270
270
  if (!p.current.active || n !== "listening") return;
271
- const E = m.current, v = E == null ? void 0 : E.localParticipant;
272
- if (!v) {
271
+ const E = g.current, b = E == null ? void 0 : E.localParticipant;
272
+ if (!b) {
273
273
  p.current.active = !1;
274
274
  return;
275
275
  }
276
- v.isMicrophoneEnabled === p.current.lastAutoIntent && (v.setMicrophoneEnabled(!0), p.current.lastAutoIntent = !0, l(!1)), p.current.active = !1;
276
+ b.isMicrophoneEnabled === p.current.lastAutoIntent && (b.setMicrophoneEnabled(!0), p.current.lastAutoIntent = !0, l(!1)), p.current.active = !1;
277
277
  }, [n]);
278
- const g = k(() => {
279
- const E = u.current, v = m.current;
280
- if (E && v) {
278
+ const y = L(() => {
279
+ const E = d.current, b = g.current;
280
+ if (E && b) {
281
281
  try {
282
- v.localParticipant.unpublishTrack(E);
282
+ b.localParticipant.unpublishTrack(E);
283
283
  } catch {
284
284
  }
285
285
  E.stop();
286
286
  }
287
- u.current = null, m.current = null, p.current = { active: t, lastAutoIntent: null }, l(t), s("");
288
- }, [t]), w = k(() => c(null), []), D = k(() => zr(u.current), []);
287
+ d.current = null, g.current = null, p.current = { active: t, lastAutoIntent: null }, l(t), s("");
288
+ }, [t]), w = L(() => c(null), []), P = L(() => $r(d.current), []);
289
289
  return {
290
290
  isMuted: i,
291
291
  activeDeviceId: o,
292
292
  micError: a,
293
293
  toggleMute: C,
294
- setupMic: h,
295
- attachRoom: P,
296
- switchDevice: _,
297
- teardownMic: g,
294
+ setupMic: m,
295
+ attachRoom: D,
296
+ switchDevice: x,
297
+ teardownMic: y,
298
298
  clearError: w,
299
- getMicStream: D
299
+ getMicStream: P
300
300
  };
301
301
  }
302
- const Hr = { resolution: { width: 640, height: 480, frameRate: 24 } };
303
- function Or() {
304
- const [e, t] = M(!1), [n, i] = M(null), [l, o] = M(null), [s, a] = M(""), c = T(null), u = T(null), m = k((w) => {
302
+ const Or = { resolution: { width: 640, height: 480, frameRate: 24 } };
303
+ function Fr() {
304
+ const [e, t] = M(!1), [n, i] = M(null), [l, o] = M(null), [s, a] = M(""), c = R(null), d = R(null), g = L((w) => {
305
305
  c.current = w;
306
- }, []), p = k(() => {
306
+ }, []), p = L(() => {
307
307
  var E;
308
- const w = c.current, D = u.current;
309
- if (D && w) {
310
- const v = w.localParticipant.getTrackPublication(er.Source.Camera), y = (v == null ? void 0 : v.track) ?? D;
308
+ const w = c.current, P = d.current;
309
+ if (P && w) {
310
+ const b = w.localParticipant.getTrackPublication(tr.Source.Camera), v = (b == null ? void 0 : b.track) ?? P;
311
311
  try {
312
- w.localParticipant.unpublishTrack(y);
312
+ w.localParticipant.unpublishTrack(v);
313
313
  } catch {
314
314
  }
315
315
  try {
316
- (E = y.stop) == null || E.call(y);
316
+ (E = v.stop) == null || E.call(v);
317
317
  } catch {
318
318
  }
319
319
  }
320
- u.current = null, o(null), t(!1);
321
- }, []), h = k(async (w) => {
322
- const D = c.current;
323
- if (D) {
320
+ d.current = null, o(null), t(!1);
321
+ }, []), m = L(async (w) => {
322
+ const P = c.current;
323
+ if (P) {
324
324
  i(null);
325
325
  try {
326
- const E = { ...Hr };
326
+ const E = { ...Or };
327
327
  w && (E.deviceId = w);
328
- const v = await Tr(E);
329
- await D.localParticipant.publishTrack(v), u.current = v;
330
- const O = v.attach();
328
+ const b = await Tr(E);
329
+ await P.localParticipant.publishTrack(b), d.current = b;
330
+ const O = b.attach();
331
331
  o(O), t(!0), w && a(w);
332
332
  try {
333
- D.localParticipant.publishData(
333
+ P.localParticipant.publishData(
334
334
  new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
335
335
  { reliable: !0 }
336
336
  );
337
337
  } catch {
338
338
  }
339
339
  } catch (E) {
340
- const v = E instanceof Error && E.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
341
- i(v);
340
+ const b = E instanceof Error && E.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
341
+ i(b);
342
342
  }
343
343
  }
344
- }, []), P = k(async () => {
345
- e ? p() : await h(s || void 0);
346
- }, [e, s, p, h]), _ = k(async (w) => {
347
- p(), await h(w);
348
- }, [p, h]), C = k(() => {
344
+ }, []), D = L(async () => {
345
+ e ? p() : await m(s || void 0);
346
+ }, [e, s, p, m]), x = L(async (w) => {
347
+ p(), await m(w);
348
+ }, [p, m]), C = L(() => {
349
349
  p(), c.current = null, i(null), a("");
350
- }, [p]), g = k(() => i(null), []);
350
+ }, [p]), y = L(() => i(null), []);
351
351
  return I(() => () => {
352
- u.current && u.current.stop();
352
+ d.current && d.current.stop();
353
353
  }, []), {
354
354
  isEnabled: e,
355
355
  error: n,
356
356
  previewEl: l,
357
357
  activeDeviceId: s,
358
- toggle: P,
359
- switchDevice: _,
360
- attachRoom: m,
358
+ toggle: D,
359
+ switchDevice: x,
360
+ attachRoom: g,
361
361
  teardown: C,
362
- clearError: g
362
+ clearError: y
363
363
  };
364
364
  }
365
- function Fr() {
366
- const [e, t] = M(!1), [n, i] = M(null), [l, o] = M(null), s = T(null), a = k((h) => {
367
- s.current = h;
368
- }, []), c = k(() => o(null), []), u = k(async () => {
369
- const h = s.current;
370
- if (h) {
365
+ function Br() {
366
+ const [e, t] = M(!1), [n, i] = M(null), [l, o] = M(null), s = R(null), a = L((m) => {
367
+ s.current = m;
368
+ }, []), c = L(() => o(null), []), d = L(async () => {
369
+ const m = s.current;
370
+ if (m) {
371
371
  if (e) {
372
372
  try {
373
- await h.localParticipant.setScreenShareEnabled(!1);
373
+ await m.localParticipant.setScreenShareEnabled(!1);
374
374
  } catch {
375
375
  }
376
376
  c(), t(!1);
@@ -378,15 +378,15 @@ function Fr() {
378
378
  }
379
379
  i(null);
380
380
  try {
381
- await h.localParticipant.setScreenShareEnabled(!0);
382
- let P = 0;
383
- const _ = () => {
384
- const C = h.localParticipant.getTrackPublication(er.Source.ScreenShare);
381
+ await m.localParticipant.setScreenShareEnabled(!0);
382
+ let D = 0;
383
+ const x = () => {
384
+ const C = m.localParticipant.getTrackPublication(tr.Source.ScreenShare);
385
385
  if (C != null && C.track) {
386
- const g = C.track.attach();
387
- o(g), t(!0);
386
+ const y = C.track.attach();
387
+ o(y), t(!0);
388
388
  try {
389
- h.localParticipant.publishData(
389
+ m.localParticipant.publishData(
390
390
  new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
391
391
  { reliable: !0 }
392
392
  );
@@ -394,27 +394,27 @@ function Fr() {
394
394
  }
395
395
  return;
396
396
  }
397
- P++ < 10 ? setTimeout(_, 100) : t(!0);
397
+ D++ < 10 ? setTimeout(x, 100) : t(!0);
398
398
  };
399
- _();
400
- } catch (P) {
401
- const _ = P instanceof Error ? P.name : "";
402
- _ !== "NotAllowedError" && _ !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
399
+ x();
400
+ } catch (D) {
401
+ const x = D instanceof Error ? D.name : "";
402
+ x !== "NotAllowedError" && x !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
403
403
  }
404
404
  }
405
- }, [e, c]), m = k(() => {
406
- const h = s.current;
407
- if (h && e)
405
+ }, [e, c]), g = L(() => {
406
+ const m = s.current;
407
+ if (m && e)
408
408
  try {
409
- h.localParticipant.setScreenShareEnabled(!1);
409
+ m.localParticipant.setScreenShareEnabled(!1);
410
410
  } catch {
411
411
  }
412
412
  c(), t(!1), i(null), s.current = null;
413
- }, [e, c]), p = k(() => i(null), []);
414
- return { isEnabled: e, error: n, previewEl: l, toggle: u, attachRoom: a, teardown: m, clearError: p };
413
+ }, [e, c]), p = L(() => i(null), []);
414
+ return { isEnabled: e, error: n, previewEl: l, toggle: d, attachRoom: a, teardown: g, clearError: p };
415
415
  }
416
- function Br() {
417
- const [e, t] = M([]), [n, i] = M([]), l = k(async () => {
416
+ function Wr() {
417
+ const [e, t] = M([]), [n, i] = M([]), l = L(async () => {
418
418
  if (!(typeof navigator > "u" || !navigator.mediaDevices))
419
419
  try {
420
420
  const o = await navigator.mediaDevices.enumerateDevices();
@@ -428,30 +428,30 @@ function Br() {
428
428
  return navigator.mediaDevices.addEventListener("devicechange", o), () => navigator.mediaDevices.removeEventListener("devicechange", o);
429
429
  }, [l]), { mics: e, cameras: n, refresh: l };
430
430
  }
431
- function Wr(e, t, n = !1) {
431
+ function qr(e, t, n = !1) {
432
432
  const [i, l] = M(null), [o, s] = M(null), [a, c] = M(!n && !!e);
433
433
  return I(() => {
434
434
  if (n || !e) {
435
435
  c(!1);
436
436
  return;
437
437
  }
438
- const u = new AbortController(), m = t || "https://app.livelayer.studio";
439
- return c(!0), s(null), fetch(`${m}/api/widget/agent/${encodeURIComponent(e)}`, {
440
- signal: u.signal
438
+ const d = new AbortController(), g = t || "https://app.livelayer.studio";
439
+ return c(!0), s(null), fetch(`${g}/api/widget/agent/${encodeURIComponent(e)}`, {
440
+ signal: d.signal
441
441
  }).then(async (p) => {
442
442
  if (!p.ok) {
443
- const h = await p.json().catch(() => ({}));
444
- throw new Error(h.error || `HTTP ${p.status}`);
443
+ const m = await p.json().catch(() => ({}));
444
+ throw new Error(m.error || `HTTP ${p.status}`);
445
445
  }
446
446
  return p.json();
447
447
  }).then((p) => {
448
- u.signal.aborted || (l(p), c(!1));
448
+ d.signal.aborted || (l(p), c(!1));
449
449
  }).catch((p) => {
450
- u.signal.aborted || (s(p instanceof Error ? p.message : "Agent lookup failed"), c(!1));
451
- }), () => u.abort();
450
+ d.signal.aborted || (s(p instanceof Error ? p.message : "Agent lookup failed"), c(!1));
451
+ }), () => d.abort();
452
452
  }, [e, t, n]), { info: i, error: o, loading: a };
453
453
  }
454
- function tr(e) {
454
+ function nr(e) {
455
455
  if (typeof window > "u") return null;
456
456
  try {
457
457
  return window.localStorage.getItem(e);
@@ -459,26 +459,26 @@ function tr(e) {
459
459
  return null;
460
460
  }
461
461
  }
462
- function nr(e, t) {
462
+ function rr(e, t) {
463
463
  if (!(typeof window > "u"))
464
464
  try {
465
465
  window.localStorage.setItem(e, t);
466
466
  } catch {
467
467
  }
468
468
  }
469
- function qr(e) {
469
+ function Ur(e) {
470
470
  if (!(typeof window > "u"))
471
471
  try {
472
472
  window.localStorage.removeItem(e);
473
473
  } catch {
474
474
  }
475
475
  }
476
- function Ur({
476
+ function jr({
477
477
  value: e,
478
478
  defaultValue: t = "expanded",
479
479
  onChange: n
480
480
  } = {}) {
481
- const i = e !== void 0, [l, o] = M(t), s = i ? e : l, a = k(
481
+ const i = e !== void 0, [l, o] = M(t), s = i ? e : l, a = L(
482
482
  (c) => {
483
483
  c !== s && (i || o(c), n == null || n(c));
484
484
  },
@@ -486,32 +486,32 @@ function Ur({
486
486
  );
487
487
  return [s, a];
488
488
  }
489
- const jr = ["hidden", "minimized", "expanded"];
490
- function Vr(e) {
491
- return e && jr.includes(e) ? e : null;
489
+ const Vr = ["hidden", "minimized", "expanded"];
490
+ function Yr(e) {
491
+ return e && Vr.includes(e) ? e : null;
492
492
  }
493
- function Yr({
493
+ function Gr({
494
494
  value: e,
495
495
  defaultValue: t = "expanded",
496
496
  onChange: n,
497
497
  persistKey: i = "ll-widget",
498
498
  disablePersistence: l = !1
499
499
  } = {}) {
500
- const o = `${i}:display-mode`, s = T(!1), [a, c] = Ur({
500
+ const o = `${i}:display-mode`, s = R(!1), [a, c] = jr({
501
501
  value: e,
502
502
  defaultValue: t,
503
- onChange: (u) => {
504
- e === void 0 && !l && nr(o, u), n == null || n(u);
503
+ onChange: (d) => {
504
+ e === void 0 && !l && rr(o, d), n == null || n(d);
505
505
  }
506
506
  });
507
507
  return I(() => {
508
508
  if (s.current || (s.current = !0, l || e !== void 0)) return;
509
- const u = Vr(tr(o));
510
- u && u !== a && c(u);
509
+ const d = Yr(nr(o));
510
+ d && d !== a && c(d);
511
511
  }, []), [a, c];
512
512
  }
513
- const Gr = 640;
514
- function Xr(e = Gr) {
513
+ const Xr = 640;
514
+ function Kr(e = Xr) {
515
515
  const [t, n] = M(!1);
516
516
  return I(() => {
517
517
  if (e === !1) {
@@ -526,11 +526,11 @@ function Xr(e = Gr) {
526
526
  });
527
527
  }, [e]), t;
528
528
  }
529
- const Kr = 280, Jr = 380, Zr = 8, Qr = 4;
529
+ const Jr = 280, Zr = 380, Qr = 8, ei = 4;
530
530
  function Kt(e) {
531
531
  return `${e}:geometry`;
532
532
  }
533
- function ei(e) {
533
+ function ti(e) {
534
534
  if (!e) return null;
535
535
  let t;
536
536
  try {
@@ -542,45 +542,45 @@ function ei(e) {
542
542
  const n = t, { top: i, left: l, width: o, height: s } = n;
543
543
  return typeof i != "number" || typeof l != "number" || typeof o != "number" || typeof s != "number" || !Number.isFinite(i) || !Number.isFinite(l) || !Number.isFinite(o) || !Number.isFinite(s) ? null : { top: i, left: l, width: o, height: s };
544
544
  }
545
- function zt() {
545
+ function Ht() {
546
546
  return typeof window > "u" ? { vw: 0, vh: 0 } : { vw: window.innerWidth, vh: window.innerHeight };
547
547
  }
548
548
  function Jt(e, t, n) {
549
- const { minWidth: i, minHeight: l, edgeMargin: o, vw: s, vh: a } = n, c = Math.max(i, s - o * 2), u = Math.max(l, a - o * 2);
549
+ const { minWidth: i, minHeight: l, edgeMargin: o, vw: s, vh: a } = n, c = Math.max(i, s - o * 2), d = Math.max(l, a - o * 2);
550
550
  return {
551
551
  width: Math.max(i, Math.min(c, e)),
552
- height: Math.max(l, Math.min(u, t))
552
+ height: Math.max(l, Math.min(d, t))
553
553
  };
554
554
  }
555
555
  function Zt(e, t, n, i, l) {
556
- const { edgeMargin: o, vw: s, vh: a } = l, c = o, u = o, m = Math.max(c, s - n - o), p = Math.max(u, a - i - o);
556
+ const { edgeMargin: o, vw: s, vh: a } = l, c = o, d = o, g = Math.max(c, s - n - o), p = Math.max(d, a - i - o);
557
557
  return {
558
- top: Math.max(u, Math.min(p, e)),
559
- left: Math.max(c, Math.min(m, t))
558
+ top: Math.max(d, Math.min(p, e)),
559
+ left: Math.max(c, Math.min(g, t))
560
560
  };
561
561
  }
562
- function ti(e) {
562
+ function ni(e) {
563
563
  const {
564
564
  draggable: t,
565
565
  resizable: n,
566
566
  persistKey: i,
567
567
  disablePersistence: l,
568
- minWidth: o = Kr,
569
- minHeight: s = Jr,
570
- edgeMargin: a = Zr
571
- } = e, [c, u] = M(null), [m, p] = M(!1), [h, P] = M(!1), _ = T(null), C = T(null), g = T(!1), w = T(null);
568
+ minWidth: o = Jr,
569
+ minHeight: s = Zr,
570
+ edgeMargin: a = Qr
571
+ } = e, [c, d] = M(null), [g, p] = M(!1), [m, D] = M(!1), x = R(null), C = R(null), y = R(!1), w = R(null);
572
572
  w.current = c;
573
- const D = k(
573
+ const P = L(
574
574
  (f) => {
575
- l || (f === null ? qr(Kt(i)) : nr(Kt(i), JSON.stringify(f)));
575
+ l || (f === null ? Ur(Kt(i)) : rr(Kt(i), JSON.stringify(f)));
576
576
  },
577
577
  [l, i]
578
578
  );
579
579
  I(() => {
580
- if (g.current || (g.current = !0, l)) return;
581
- const f = ei(tr(Kt(i)));
580
+ if (y.current || (y.current = !0, l)) return;
581
+ const f = ti(nr(Kt(i)));
582
582
  if (!f) return;
583
- const { vw: A, vh: $ } = zt(), q = Jt(f.width, f.height, {
583
+ const { vw: A, vh: $ } = Ht(), q = Jt(f.width, f.height, {
584
584
  minWidth: o,
585
585
  minHeight: s,
586
586
  edgeMargin: a,
@@ -591,13 +591,13 @@ function ti(e) {
591
591
  vw: A,
592
592
  vh: $
593
593
  });
594
- u({ ...X, ...q });
594
+ d({ ...X, ...q });
595
595
  }, []), I(() => {
596
596
  if (typeof window > "u") return;
597
597
  const f = () => {
598
- u((A) => {
598
+ d((A) => {
599
599
  if (A === null) return null;
600
- const { vw: $, vh: q } = zt(), X = Jt(A.width, A.height, {
600
+ const { vw: $, vh: q } = Ht(), X = Jt(A.width, A.height, {
601
601
  minWidth: o,
602
602
  minHeight: s,
603
603
  edgeMargin: a,
@@ -613,78 +613,78 @@ function ti(e) {
613
613
  };
614
614
  return window.addEventListener("resize", f), () => window.removeEventListener("resize", f);
615
615
  }, [o, s, a]);
616
- const E = k(
616
+ const E = L(
617
617
  (f) => {
618
618
  if (!t || f.pointerType === "mouse" && f.button !== 0) return;
619
619
  const A = f.target;
620
620
  if (A && typeof A.closest == "function" && A.closest('button, a, input, select, textarea, [role="listbox"], [role="option"], [data-ll-no-drag]'))
621
621
  return;
622
- let $, q, X, ee;
622
+ let $, q, X, te;
623
623
  const W = w.current;
624
624
  if (W)
625
- ({ top: $, left: q, width: X, height: ee } = W);
625
+ ({ top: $, left: q, width: X, height: te } = W);
626
626
  else {
627
- const te = f.currentTarget.closest(".ll-widget"), oe = te == null ? void 0 : te.getBoundingClientRect();
628
- if (!oe) return;
629
- $ = oe.top, q = oe.left, X = oe.width, ee = oe.height;
627
+ const ne = f.currentTarget.closest(".ll-widget"), ie = ne == null ? void 0 : ne.getBoundingClientRect();
628
+ if (!ie) return;
629
+ $ = ie.top, q = ie.left, X = ie.width, te = ie.height;
630
630
  }
631
631
  try {
632
632
  f.currentTarget.setPointerCapture(f.pointerId);
633
633
  } catch {
634
634
  }
635
- _.current = {
635
+ x.current = {
636
636
  startClientX: f.clientX,
637
637
  startClientY: f.clientY,
638
638
  startTop: $,
639
639
  startLeft: q,
640
640
  width: X,
641
- height: ee,
641
+ height: te,
642
642
  moved: !1
643
643
  };
644
644
  },
645
645
  [t]
646
- ), v = k(
646
+ ), b = L(
647
647
  (f) => {
648
- const A = _.current;
648
+ const A = x.current;
649
649
  if (!A) return;
650
650
  const $ = f.clientX - A.startClientX, q = f.clientY - A.startClientY;
651
- if (!A.moved && Math.abs($) + Math.abs(q) > Qr && (A.moved = !0, p(!0)), !A.moved) return;
652
- const { vw: X, vh: ee } = zt(), W = Zt(
651
+ if (!A.moved && Math.abs($) + Math.abs(q) > ei && (A.moved = !0, p(!0)), !A.moved) return;
652
+ const { vw: X, vh: te } = Ht(), W = Zt(
653
653
  A.startTop + q,
654
654
  A.startLeft + $,
655
655
  A.width,
656
656
  A.height,
657
- { edgeMargin: a, vw: X, vh: ee }
657
+ { edgeMargin: a, vw: X, vh: te }
658
658
  );
659
- u({ ...W, width: A.width, height: A.height });
659
+ d({ ...W, width: A.width, height: A.height });
660
660
  },
661
661
  [a]
662
- ), O = k(
662
+ ), O = L(
663
663
  (f) => {
664
- const A = _.current;
664
+ const A = x.current;
665
665
  if (A) {
666
666
  try {
667
667
  f.currentTarget.releasePointerCapture(f.pointerId);
668
668
  } catch {
669
669
  }
670
- _.current = null, A.moved && (p(!1), u(($) => ($ && D($), $)));
670
+ x.current = null, A.moved && (p(!1), d(($) => ($ && P($), $)));
671
671
  }
672
672
  },
673
- [D]
674
- ), y = k(() => {
675
- _.current = null, C.current = null, p(!1), P(!1), u(null), D(null);
676
- }, [D]), z = k(
673
+ [P]
674
+ ), v = L(() => {
675
+ x.current = null, C.current = null, p(!1), D(!1), d(null), P(null);
676
+ }, [P]), z = L(
677
677
  (f) => {
678
678
  if (!n || f.pointerType === "mouse" && f.button !== 0) return;
679
679
  f.stopPropagation();
680
680
  let A, $, q, X;
681
- const ee = w.current;
682
- if (ee)
683
- ({ top: A, left: $, width: q, height: X } = ee);
681
+ const te = w.current;
682
+ if (te)
683
+ ({ top: A, left: $, width: q, height: X } = te);
684
684
  else {
685
- const W = f.currentTarget.closest(".ll-widget"), te = W == null ? void 0 : W.getBoundingClientRect();
686
- if (!te) return;
687
- A = te.top, $ = te.left, q = te.width, X = te.height;
685
+ const W = f.currentTarget.closest(".ll-widget"), ne = W == null ? void 0 : W.getBoundingClientRect();
686
+ if (!ne) return;
687
+ A = ne.top, $ = ne.left, q = ne.width, X = ne.height;
688
688
  }
689
689
  try {
690
690
  f.currentTarget.setPointerCapture(f.pointerId);
@@ -697,36 +697,36 @@ function ti(e) {
697
697
  startHeight: X,
698
698
  top: A,
699
699
  left: $
700
- }, P(!0);
700
+ }, D(!0);
701
701
  },
702
702
  [n]
703
- ), B = k(
703
+ ), B = L(
704
704
  (f) => {
705
705
  const A = C.current;
706
706
  if (!A) return;
707
- const $ = f.clientX - A.startClientX, q = f.clientY - A.startClientY, { vw: X, vh: ee } = zt(), W = X - A.left - a, te = ee - A.top - a, oe = Jt(A.startWidth + $, A.startHeight + q, {
707
+ const $ = f.clientX - A.startClientX, q = f.clientY - A.startClientY, { vw: X, vh: te } = Ht(), W = X - A.left - a, ne = te - A.top - a, ie = Jt(A.startWidth + $, A.startHeight + q, {
708
708
  minWidth: o,
709
709
  minHeight: s,
710
710
  edgeMargin: a,
711
711
  // Clamp the available viewport to the room from the anchored corner
712
712
  // so the widget can't grow past the bottom/right edge.
713
713
  vw: Math.min(X, A.left + W + a),
714
- vh: Math.min(ee, A.top + te + a)
714
+ vh: Math.min(te, A.top + ne + a)
715
715
  });
716
- u({ top: A.top, left: A.left, ...oe });
716
+ d({ top: A.top, left: A.left, ...ie });
717
717
  },
718
718
  [a, o, s]
719
- ), J = k(
719
+ ), J = L(
720
720
  (f) => {
721
721
  if (C.current) {
722
722
  try {
723
723
  f.currentTarget.releasePointerCapture(f.pointerId);
724
724
  } catch {
725
725
  }
726
- C.current = null, P(!1), u(($) => ($ && D($), $));
726
+ C.current = null, D(!1), d(($) => ($ && P($), $));
727
727
  }
728
728
  },
729
- [D]
729
+ [P]
730
730
  );
731
731
  return {
732
732
  style: c === null ? {} : {
@@ -739,14 +739,14 @@ function ti(e) {
739
739
  height: `${c.height}px`
740
740
  },
741
741
  hasGeometry: c !== null,
742
- isDragging: m,
743
- isResizing: h,
742
+ isDragging: g,
743
+ isResizing: m,
744
744
  dragHandleProps: {
745
745
  onPointerDown: E,
746
- onPointerMove: v,
746
+ onPointerMove: b,
747
747
  onPointerUp: O,
748
748
  onPointerCancel: O,
749
- onDoubleClick: y,
749
+ onDoubleClick: v,
750
750
  "data-ll-drag-handle": t ? "" : void 0
751
751
  },
752
752
  resizeHandleProps: {
@@ -756,78 +756,78 @@ function ti(e) {
756
756
  onPointerCancel: J,
757
757
  "data-ll-resize-handle": n ? "" : void 0
758
758
  },
759
- reset: y
759
+ reset: v
760
760
  };
761
761
  }
762
- const Nn = "__llHistoryPatched", Ot = "ll:pathname";
763
- function ni() {
764
- if (typeof window > "u" || window.history[Nn]) return;
762
+ const Mn = "__llHistoryPatched", Bt = "ll:pathname";
763
+ function ri() {
764
+ if (typeof window > "u" || window.history[Mn]) return;
765
765
  const e = window.history.pushState, t = window.history.replaceState;
766
766
  window.history.pushState = function(...n) {
767
767
  const i = e.apply(this, n);
768
- return window.dispatchEvent(new Event(Ot)), i;
768
+ return window.dispatchEvent(new Event(Bt)), i;
769
769
  }, window.history.replaceState = function(...n) {
770
770
  const i = t.apply(this, n);
771
- return window.dispatchEvent(new Event(Ot)), i;
772
- }, window.history[Nn] = !0;
771
+ return window.dispatchEvent(new Event(Bt)), i;
772
+ }, window.history[Mn] = !0;
773
773
  }
774
- function Mn() {
774
+ function In() {
775
775
  return typeof window > "u" ? "/" : window.location.pathname || "/";
776
776
  }
777
- function ri(e) {
777
+ function ii(e) {
778
778
  const [t, n] = M(
779
- () => e ?? Mn()
779
+ () => e ?? In()
780
780
  );
781
781
  return I(() => {
782
782
  if (e !== void 0) return;
783
- ni();
784
- const i = () => n(Mn());
785
- return i(), window.addEventListener("popstate", i), window.addEventListener(Ot, i), () => {
786
- window.removeEventListener("popstate", i), window.removeEventListener(Ot, i);
783
+ ri();
784
+ const i = () => n(In());
785
+ return i(), window.addEventListener("popstate", i), window.addEventListener(Bt, i), () => {
786
+ window.removeEventListener("popstate", i), window.removeEventListener(Bt, i);
787
787
  };
788
788
  }, [e]), e ?? t;
789
789
  }
790
- const In = /* @__PURE__ */ new Map(), ii = /[\\^$+?.()|{}[\]]/g;
791
- function oi(e) {
792
- return e.replace(ii, "\\$&");
793
- }
790
+ const Rn = /* @__PURE__ */ new Map(), oi = /[\\^$+?.()|{}[\]]/g;
794
791
  function li(e) {
795
- const t = In.get(e);
792
+ return e.replace(oi, "\\$&");
793
+ }
794
+ function ai(e) {
795
+ const t = Rn.get(e);
796
796
  if (t) return t;
797
- const n = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", l = "", o = n.replace(/\*\*/g, i).replace(/\*/g, l), a = oi(o).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(l, "g"), "[^/]+"), c = new RegExp(`^${a}\\/?$`);
798
- return In.set(e, c), c;
797
+ const n = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", l = "", o = n.replace(/\*\*/g, i).replace(/\*/g, l), a = li(o).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(l, "g"), "[^/]+"), c = new RegExp(`^${a}\\/?$`);
798
+ return Rn.set(e, c), c;
799
799
  }
800
- function ai(e, t) {
800
+ function si(e, t) {
801
801
  const n = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
802
- return li(e).test(n);
802
+ return ai(e).test(n);
803
803
  }
804
- function si(e, t) {
805
- return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : ai(e, t);
804
+ function ci(e, t) {
805
+ return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : si(e, t);
806
806
  }
807
807
  function Tn(e, t) {
808
808
  if (!e || e.length === 0) return !1;
809
809
  for (const n of e)
810
- if (si(n, t)) return !0;
810
+ if (ci(n, t)) return !0;
811
811
  return !1;
812
812
  }
813
- function ci(e, t, n) {
813
+ function ui(e, t, n) {
814
814
  return e === void 0 ? !0 : Tn(n, e) ? !1 : t && t.length > 0 ? Tn(t, e) : !0;
815
815
  }
816
- function ui(e, t, n) {
816
+ function di(e, t, n) {
817
817
  return at(
818
- () => ci(e, t, n),
818
+ () => ui(e, t, n),
819
819
  [e, t, n]
820
820
  );
821
821
  }
822
- function di(e) {
822
+ function fi(e) {
823
823
  return e === !1 ? { navigate: !1, thinking: !1, action: !1 } : e === void 0 || e === !0 ? { navigate: !0, thinking: !0, action: !0 } : {
824
824
  navigate: e.navigate !== !1,
825
825
  thinking: e.thinking !== !1,
826
826
  action: e.action !== !1
827
827
  };
828
828
  }
829
- function fi(e) {
830
- const t = at(() => di(e.config), [e.config]), n = e.baseUrl.replace(/\/+$/, ""), i = T(null), l = k(
829
+ function pi(e) {
830
+ const t = at(() => fi(e.config), [e.config]), n = e.baseUrl.replace(/\/+$/, ""), i = R(null), l = L(
831
831
  (c) => {
832
832
  try {
833
833
  new Audio(`${n}${c}`).play().catch(() => {
@@ -836,11 +836,11 @@ function fi(e) {
836
836
  }
837
837
  },
838
838
  [n]
839
- ), o = k(() => {
839
+ ), o = L(() => {
840
840
  t.navigate && l("/audio/page-change-sound.mp3");
841
- }, [t.navigate, l]), s = k(() => {
841
+ }, [t.navigate, l]), s = L(() => {
842
842
  t.action && l("/audio/confirmation-sound.mp3");
843
- }, [t.action, l]), a = k(
843
+ }, [t.action, l]), a = L(
844
844
  (c) => {
845
845
  if (!t.thinking) {
846
846
  if (i.current) {
@@ -855,10 +855,10 @@ function fi(e) {
855
855
  if (c) {
856
856
  if (i.current) return;
857
857
  try {
858
- const u = new Audio(`${n}/audio/thinking-sound.mp3`);
859
- u.loop = !0, u.volume = 0.3, u.play().catch(() => {
858
+ const d = new Audio(`${n}/audio/thinking-sound.mp3`);
859
+ d.loop = !0, d.volume = 0.3, d.play().catch(() => {
860
860
  i.current = null;
861
- }), i.current = u;
861
+ }), i.current = d;
862
862
  } catch {
863
863
  }
864
864
  } else if (i.current) {
@@ -884,7 +884,7 @@ function fi(e) {
884
884
  [o, s, a]
885
885
  );
886
886
  }
887
- const Rn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ S(
887
+ const Pn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ S(
888
888
  "svg",
889
889
  {
890
890
  className: t,
@@ -948,7 +948,7 @@ const Rn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ S(
948
948
  }
949
949
  )
950
950
  }
951
- ), pi = ({ className: e }) => /* @__PURE__ */ r(
951
+ ), hi = ({ className: e }) => /* @__PURE__ */ r(
952
952
  "svg",
953
953
  {
954
954
  className: e,
@@ -959,12 +959,12 @@ const Rn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ S(
959
959
  "aria-hidden": "true",
960
960
  children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
961
961
  }
962
- ), hi = {
962
+ ), mi = {
963
963
  left: 180,
964
964
  right: 0,
965
965
  up: -90,
966
966
  down: 90
967
- }, Pn = ({ direction: e = "right", className: t }) => /* @__PURE__ */ r(
967
+ }, zn = ({ direction: e = "right", className: t }) => /* @__PURE__ */ r(
968
968
  "svg",
969
969
  {
970
970
  className: t,
@@ -972,19 +972,19 @@ const Rn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ S(
972
972
  viewBox: "0 0 24 24",
973
973
  stroke: "currentColor",
974
974
  strokeWidth: 2,
975
- style: { transform: `rotate(${hi[e]}deg)` },
975
+ style: { transform: `rotate(${mi[e]}deg)` },
976
976
  "aria-hidden": "true",
977
977
  children: /* @__PURE__ */ r("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" })
978
978
  }
979
979
  );
980
- function mi(e) {
980
+ function gi(e) {
981
981
  return e === "top-left" || e === "bottom-left" ? "left" : "right";
982
982
  }
983
- const rr = "ll-hidden-tab-center-y", gi = 5, zn = 16;
984
- function yi() {
983
+ const ir = "ll-hidden-tab-center-y", yi = 5, $n = 16;
984
+ function vi() {
985
985
  if (typeof window > "u") return null;
986
986
  try {
987
- const e = window.localStorage.getItem(rr);
987
+ const e = window.localStorage.getItem(ir);
988
988
  if (!e) return null;
989
989
  const t = Number.parseFloat(e);
990
990
  return Number.isFinite(t) ? t : null;
@@ -992,14 +992,14 @@ function yi() {
992
992
  return null;
993
993
  }
994
994
  }
995
- function $n(e) {
995
+ function Hn(e) {
996
996
  if (!(typeof window > "u"))
997
997
  try {
998
- window.localStorage.setItem(rr, String(e));
998
+ window.localStorage.setItem(ir, String(e));
999
999
  } catch {
1000
1000
  }
1001
1001
  }
1002
- const vi = ({
1002
+ const bi = ({
1003
1003
  position: e,
1004
1004
  isMobile: t,
1005
1005
  isSpeaking: n,
@@ -1009,50 +1009,50 @@ const vi = ({
1009
1009
  agentName: s,
1010
1010
  containerEl: a
1011
1011
  }) => {
1012
- const c = mi(e), u = c === "right" ? "left" : "right", m = t ? 80 : 72, p = !!o, h = !!a, [P, _] = M(null), [C, g] = M(!1), w = T(null), D = T(!1), E = k(
1012
+ const c = gi(e), d = c === "right" ? "left" : "right", g = t ? 80 : 72, p = !!o, m = !!a, [D, x] = M(null), [C, y] = M(!1), w = R(null), P = R(!1), E = L(
1013
1013
  (H) => {
1014
1014
  if (typeof window > "u") return H;
1015
- const G = m / 2, f = zn + G, A = window.innerHeight - zn - G;
1015
+ const G = g / 2, f = $n + G, A = window.innerHeight - $n - G;
1016
1016
  return A < f ? Math.max(f, H) : Math.max(f, Math.min(A, H));
1017
1017
  },
1018
- [m]
1018
+ [g]
1019
1019
  );
1020
1020
  I(() => {
1021
- if (h) {
1022
- _(null);
1021
+ if (m) {
1022
+ x(null);
1023
1023
  return;
1024
1024
  }
1025
- const H = yi();
1026
- _(E(H ?? window.innerHeight / 2));
1025
+ const H = vi();
1026
+ x(E(H ?? window.innerHeight / 2));
1027
1027
  const G = () => {
1028
- _((f) => f === null ? null : E(f));
1028
+ x((f) => f === null ? null : E(f));
1029
1029
  };
1030
1030
  return window.addEventListener("resize", G), () => window.removeEventListener("resize", G);
1031
- }, [E, h]);
1032
- const v = k(
1031
+ }, [E, m]);
1032
+ const b = L(
1033
1033
  (H) => {
1034
- if (!h && !(H.pointerType === "mouse" && H.button !== 0) && P !== null) {
1034
+ if (!m && !(H.pointerType === "mouse" && H.button !== 0) && D !== null) {
1035
1035
  try {
1036
1036
  H.currentTarget.setPointerCapture(H.pointerId);
1037
1037
  } catch {
1038
1038
  }
1039
1039
  w.current = {
1040
1040
  startClientY: H.clientY,
1041
- startCenterY: P,
1041
+ startCenterY: D,
1042
1042
  moved: !1
1043
1043
  };
1044
1044
  }
1045
1045
  },
1046
- [P, h]
1047
- ), O = k(
1046
+ [D, m]
1047
+ ), O = L(
1048
1048
  (H) => {
1049
1049
  const G = w.current;
1050
1050
  if (!G) return;
1051
1051
  const f = H.clientY - G.startClientY;
1052
- !G.moved && Math.abs(f) > gi && (G.moved = !0, g(!0)), G.moved && _(E(G.startCenterY + f));
1052
+ !G.moved && Math.abs(f) > yi && (G.moved = !0, y(!0)), G.moved && x(E(G.startCenterY + f));
1053
1053
  },
1054
1054
  [E]
1055
- ), y = k(
1055
+ ), v = L(
1056
1056
  (H) => {
1057
1057
  const G = w.current;
1058
1058
  if (G) {
@@ -1060,25 +1060,25 @@ const vi = ({
1060
1060
  H.currentTarget.releasePointerCapture(H.pointerId);
1061
1061
  } catch {
1062
1062
  }
1063
- w.current = null, G.moved && (g(!1), D.current = !0, _((f) => (f !== null && $n(f), f)));
1063
+ w.current = null, G.moved && (y(!1), P.current = !0, x((f) => (f !== null && Hn(f), f)));
1064
1064
  }
1065
1065
  },
1066
1066
  []
1067
- ), z = k(() => {
1068
- if (D.current) {
1069
- D.current = !1;
1067
+ ), z = L(() => {
1068
+ if (P.current) {
1069
+ P.current = !1;
1070
1070
  return;
1071
1071
  }
1072
1072
  i();
1073
- }, [i]), B = k(
1073
+ }, [i]), B = L(
1074
1074
  (H) => {
1075
1075
  if (H.key === "ArrowUp" || H.key === "ArrowDown") {
1076
1076
  H.preventDefault();
1077
1077
  const G = H.key === "ArrowUp" ? -8 : 8;
1078
- _((f) => {
1078
+ x((f) => {
1079
1079
  if (f === null) return f;
1080
1080
  const A = E(f + G);
1081
- return $n(A), A;
1081
+ return Hn(A), A;
1082
1082
  });
1083
1083
  }
1084
1084
  },
@@ -1090,22 +1090,22 @@ const vi = ({
1090
1090
  n ? "ll-hidden--speaking" : null,
1091
1091
  C ? "is-dragging" : null,
1092
1092
  p ? "ll-hidden--with-avatar" : null,
1093
- h ? "ll-hidden--scoped" : null
1094
- ].filter(Boolean).join(" "), ae = P === null ? void 0 : { top: `${P - m / 2}px`, transform: "none" };
1093
+ m ? "ll-hidden--scoped" : null
1094
+ ].filter(Boolean).join(" "), le = D === null ? void 0 : { top: `${D - g / 2}px`, transform: "none" };
1095
1095
  return /* @__PURE__ */ r(
1096
1096
  "button",
1097
1097
  {
1098
1098
  type: "button",
1099
1099
  className: J,
1100
- onPointerDown: v,
1100
+ onPointerDown: b,
1101
1101
  onPointerMove: O,
1102
- onPointerUp: y,
1103
- onPointerCancel: y,
1102
+ onPointerUp: v,
1103
+ onPointerCancel: v,
1104
1104
  onClick: z,
1105
1105
  onKeyDown: B,
1106
1106
  "aria-label": l,
1107
1107
  "data-position": e,
1108
- style: ae,
1108
+ style: le,
1109
1109
  children: p ? (
1110
1110
  // Layout: tiny chevron flush against the inward edge (peeks out
1111
1111
  // as the click affordance), then the circular avatar photo
@@ -1113,9 +1113,9 @@ const vi = ({
1113
1113
  // avatar-based experience" even when collapsed.
1114
1114
  /* @__PURE__ */ S(Ve, { children: [
1115
1115
  /* @__PURE__ */ r(
1116
- Pn,
1116
+ zn,
1117
1117
  {
1118
- direction: u,
1118
+ direction: d,
1119
1119
  className: "ll-hidden__chevron ll-hidden__chevron--mini"
1120
1120
  }
1121
1121
  ),
@@ -1130,15 +1130,15 @@ const vi = ({
1130
1130
  )
1131
1131
  ] })
1132
1132
  ) : /* @__PURE__ */ r(
1133
- Pn,
1133
+ zn,
1134
1134
  {
1135
- direction: u,
1135
+ direction: d,
1136
1136
  className: "ll-hidden__chevron"
1137
1137
  }
1138
1138
  )
1139
1139
  }
1140
1140
  );
1141
- }, bi = ({
1141
+ }, wi = ({
1142
1142
  audioLevel: e,
1143
1143
  bars: t = 20,
1144
1144
  maxHeight: n = 20,
@@ -1146,31 +1146,31 @@ const vi = ({
1146
1146
  className: l,
1147
1147
  barClassName: o
1148
1148
  }) => {
1149
- const s = T(null), a = T([]), c = at(() => {
1150
- const m = (Math.sqrt(5) - 1) / 2;
1151
- return Array.from({ length: t }, (p, h) => 0.5 + h * m % 1 * 0.5);
1149
+ const s = R(null), a = R([]), c = at(() => {
1150
+ const g = (Math.sqrt(5) - 1) / 2;
1151
+ return Array.from({ length: t }, (p, m) => 0.5 + m * g % 1 * 0.5);
1152
1152
  }, [t]);
1153
1153
  I(() => e.subscribe((p) => {
1154
- for (let h = 0; h < t; h++) {
1155
- const P = a.current[h];
1156
- if (!P) continue;
1157
- const _ = Math.max(i, p * n * c[h]);
1158
- P.style.height = `${_}px`;
1154
+ for (let m = 0; m < t; m++) {
1155
+ const D = a.current[m];
1156
+ if (!D) continue;
1157
+ const x = Math.max(i, p * n * c[m]);
1158
+ D.style.height = `${x}px`;
1159
1159
  }
1160
1160
  }), [e, t, n, i, c]);
1161
- const u = ["ll-waveform", l].filter(Boolean).join(" ");
1162
- return /* @__PURE__ */ r("div", { ref: s, className: u, "aria-hidden": "true", children: Array.from({ length: t }, (m, p) => /* @__PURE__ */ r(
1161
+ const d = ["ll-waveform", l].filter(Boolean).join(" ");
1162
+ return /* @__PURE__ */ r("div", { ref: s, className: d, "aria-hidden": "true", children: Array.from({ length: t }, (g, p) => /* @__PURE__ */ r(
1163
1163
  "div",
1164
1164
  {
1165
- ref: (h) => {
1166
- a.current[p] = h;
1165
+ ref: (m) => {
1166
+ a.current[p] = m;
1167
1167
  },
1168
1168
  className: ["ll-waveform__bar", o].filter(Boolean).join(" "),
1169
1169
  style: { height: `${i}px` }
1170
1170
  },
1171
1171
  p
1172
1172
  )) });
1173
- }, wi = ({
1173
+ }, _i = ({
1174
1174
  position: e,
1175
1175
  isMobile: t,
1176
1176
  agentName: n,
@@ -1180,7 +1180,7 @@ const vi = ({
1180
1180
  audioLevel: s,
1181
1181
  onExpand: a,
1182
1182
  onToggleMute: c,
1183
- onClose: u
1183
+ onClose: d
1184
1184
  }) => t ? /* @__PURE__ */ r(
1185
1185
  "div",
1186
1186
  {
@@ -1207,7 +1207,7 @@ const vi = ({
1207
1207
  )
1208
1208
  ) : /* @__PURE__ */ r("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
1209
1209
  /* @__PURE__ */ r(
1210
- bi,
1210
+ wi,
1211
1211
  {
1212
1212
  audioLevel: s,
1213
1213
  bars: 16,
@@ -1223,14 +1223,14 @@ const vi = ({
1223
1223
  className: "ll-minimized__btn",
1224
1224
  role: "button",
1225
1225
  tabIndex: 0,
1226
- onClick: (m) => {
1227
- m.stopPropagation(), c();
1226
+ onClick: (g) => {
1227
+ g.stopPropagation(), c();
1228
1228
  },
1229
- onKeyDown: (m) => {
1230
- (m.key === "Enter" || m.key === " ") && (m.stopPropagation(), m.preventDefault(), c());
1229
+ onKeyDown: (g) => {
1230
+ (g.key === "Enter" || g.key === " ") && (g.stopPropagation(), g.preventDefault(), c());
1231
1231
  },
1232
1232
  "aria-label": o ? "Unmute microphone" : "Mute microphone",
1233
- children: /* @__PURE__ */ r(Rn, { muted: o, className: "ll-minimized__icon" })
1233
+ children: /* @__PURE__ */ r(Pn, { muted: o, className: "ll-minimized__icon" })
1234
1234
  }
1235
1235
  ),
1236
1236
  /* @__PURE__ */ r(Dn, { className: "ll-minimized__icon ll-minimized__icon--expand" })
@@ -1270,7 +1270,7 @@ const vi = ({
1270
1270
  className: "ll-minimized__btn",
1271
1271
  onClick: c,
1272
1272
  "aria-label": o ? "Unmute microphone" : "Mute microphone",
1273
- children: /* @__PURE__ */ r(Rn, { muted: o, className: "ll-minimized__icon" })
1273
+ children: /* @__PURE__ */ r(Pn, { muted: o, className: "ll-minimized__icon" })
1274
1274
  }
1275
1275
  ),
1276
1276
  /* @__PURE__ */ r(
@@ -1288,22 +1288,22 @@ const vi = ({
1288
1288
  {
1289
1289
  type: "button",
1290
1290
  className: "ll-minimized__btn ll-minimized__btn--close",
1291
- onClick: u,
1291
+ onClick: d,
1292
1292
  "aria-label": "Close widget",
1293
- children: /* @__PURE__ */ r(pi, { className: "ll-minimized__icon" })
1293
+ children: /* @__PURE__ */ r(hi, { className: "ll-minimized__icon" })
1294
1294
  }
1295
1295
  )
1296
1296
  ] })
1297
1297
  ] })
1298
1298
  }
1299
- ), _i = ({
1299
+ ), xi = ({
1300
1300
  src: e,
1301
1301
  alt: t,
1302
1302
  preCannedPlaying: n = !1,
1303
1303
  className: i,
1304
1304
  style: l
1305
1305
  }) => {
1306
- const [o, s] = M(!1), a = T(e);
1306
+ const [o, s] = M(!1), a = R(e);
1307
1307
  if (I(() => {
1308
1308
  a.current !== e && (a.current = e, s(!1));
1309
1309
  }, [e]), !e) return null;
@@ -1334,11 +1334,11 @@ const vi = ({
1334
1334
  }
1335
1335
  )
1336
1336
  );
1337
- }, xi = "#E06540";
1337
+ }, ki = "#E06540";
1338
1338
  function Li({
1339
1339
  size: e = 14,
1340
1340
  className: t,
1341
- fill: n = xi
1341
+ fill: n = ki
1342
1342
  }) {
1343
1343
  return /* @__PURE__ */ S(
1344
1344
  "svg",
@@ -1376,14 +1376,14 @@ function Li({
1376
1376
  }
1377
1377
  );
1378
1378
  }
1379
- const ki = 8, Hn = 8, Ci = ({
1379
+ const Ci = 8, On = 8, Si = ({
1380
1380
  open: e,
1381
1381
  onClose: t,
1382
1382
  anchorRef: n,
1383
1383
  children: i
1384
1384
  }) => {
1385
- const l = T(null), [o, s] = M(null);
1386
- return Qn(() => {
1385
+ const l = R(null), [o, s] = M(null);
1386
+ return er(() => {
1387
1387
  if (!e) {
1388
1388
  s(null);
1389
1389
  return;
@@ -1391,22 +1391,22 @@ const ki = 8, Hn = 8, Ci = ({
1391
1391
  const a = n.current;
1392
1392
  if (!a) return;
1393
1393
  const c = () => {
1394
- const u = a.getBoundingClientRect(), m = {
1395
- top: u.top - ki,
1396
- left: u.left + u.width / 2
1397
- }, p = Hn + 90, h = window.innerWidth - Hn - 90;
1398
- m.left < p && (m.left = p), m.left > h && (m.left = h), s(m);
1394
+ const d = a.getBoundingClientRect(), g = {
1395
+ top: d.top - Ci,
1396
+ left: d.left + d.width / 2
1397
+ }, p = On + 90, m = window.innerWidth - On - 90;
1398
+ g.left < p && (g.left = p), g.left > m && (g.left = m), s(g);
1399
1399
  };
1400
1400
  return c(), window.addEventListener("scroll", c, !0), window.addEventListener("resize", c), () => {
1401
1401
  window.removeEventListener("scroll", c, !0), window.removeEventListener("resize", c);
1402
1402
  };
1403
1403
  }, [e, n]), I(() => {
1404
1404
  if (!e) return;
1405
- const a = (u) => {
1406
- const m = u.target, p = l.current, h = n.current;
1407
- p && p.contains(m) || h && h.contains(m) || t();
1408
- }, c = (u) => {
1409
- u.key === "Escape" && (u.stopPropagation(), t());
1405
+ const a = (d) => {
1406
+ const g = d.target, p = l.current, m = n.current;
1407
+ p && p.contains(g) || m && m.contains(g) || t();
1408
+ }, c = (d) => {
1409
+ d.key === "Escape" && (d.stopPropagation(), t());
1410
1410
  };
1411
1411
  return document.addEventListener("mousedown", a), document.addEventListener("keydown", c), () => {
1412
1412
  document.removeEventListener("mousedown", a), document.removeEventListener("keydown", c);
@@ -1431,7 +1431,7 @@ const ki = 8, Hn = 8, Ci = ({
1431
1431
  ),
1432
1432
  document.body
1433
1433
  );
1434
- }, Si = ({
1434
+ }, Ei = ({
1435
1435
  isMuted: e,
1436
1436
  onToggleMute: t,
1437
1437
  isCameraEnabled: n,
@@ -1441,13 +1441,13 @@ const ki = 8, Hn = 8, Ci = ({
1441
1441
  onToggleScreenShare: s,
1442
1442
  allowScreenShare: a,
1443
1443
  isSpeakerMuted: c,
1444
- onToggleSpeaker: u,
1445
- allowTyping: m,
1444
+ onToggleSpeaker: d,
1445
+ allowTyping: g,
1446
1446
  isTypingOpen: p,
1447
- onToggleTyping: h,
1448
- onDisconnect: P
1447
+ onToggleTyping: m,
1448
+ onDisconnect: D
1449
1449
  }) => {
1450
- const [_, C] = M(!1), g = T(null);
1450
+ const [x, C] = M(!1), y = R(null);
1451
1451
  return /* @__PURE__ */ S(Ve, { children: [
1452
1452
  /* @__PURE__ */ S(
1453
1453
  "div",
@@ -1463,20 +1463,20 @@ const ki = 8, Hn = 8, Ci = ({
1463
1463
  className: `ll-tool ${e ? "is-muted" : ""}`,
1464
1464
  onClick: t,
1465
1465
  "aria-label": e ? "Unmute microphone" : "Mute microphone",
1466
- children: /* @__PURE__ */ r(lr, { muted: e })
1466
+ children: /* @__PURE__ */ r(ar, { muted: e })
1467
1467
  }
1468
1468
  ),
1469
1469
  /* @__PURE__ */ r(
1470
1470
  "button",
1471
1471
  {
1472
- ref: g,
1472
+ ref: y,
1473
1473
  type: "button",
1474
- className: `ll-tool ${_ ? "is-on" : ""}`,
1474
+ className: `ll-tool ${x ? "is-on" : ""}`,
1475
1475
  onClick: () => C((w) => !w),
1476
1476
  "aria-label": "More controls",
1477
1477
  "aria-haspopup": "menu",
1478
- "aria-expanded": _,
1479
- children: /* @__PURE__ */ r(Ei, {})
1478
+ "aria-expanded": x,
1479
+ children: /* @__PURE__ */ r(Ai, {})
1480
1480
  }
1481
1481
  ),
1482
1482
  /* @__PURE__ */ r(
@@ -1484,20 +1484,20 @@ const ki = 8, Hn = 8, Ci = ({
1484
1484
  {
1485
1485
  type: "button",
1486
1486
  className: "ll-tool ll-tool--danger",
1487
- onClick: P,
1487
+ onClick: D,
1488
1488
  "aria-label": "End conversation",
1489
- children: /* @__PURE__ */ r(sr, {})
1489
+ children: /* @__PURE__ */ r(cr, {})
1490
1490
  }
1491
1491
  )
1492
1492
  ]
1493
1493
  }
1494
1494
  ),
1495
1495
  /* @__PURE__ */ S(
1496
- Ci,
1496
+ Si,
1497
1497
  {
1498
- open: _,
1498
+ open: x,
1499
1499
  onClose: () => C(!1),
1500
- anchorRef: g,
1500
+ anchorRef: y,
1501
1501
  children: [
1502
1502
  l && /* @__PURE__ */ S(
1503
1503
  "button",
@@ -1508,7 +1508,7 @@ const ki = 8, Hn = 8, Ci = ({
1508
1508
  i(), C(!1);
1509
1509
  },
1510
1510
  children: [
1511
- /* @__PURE__ */ r(or, {}),
1511
+ /* @__PURE__ */ r(lr, {}),
1512
1512
  /* @__PURE__ */ r("span", { children: n ? "Stop camera" : "Start camera" })
1513
1513
  ]
1514
1514
  }
@@ -1522,7 +1522,7 @@ const ki = 8, Hn = 8, Ci = ({
1522
1522
  s(), C(!1);
1523
1523
  },
1524
1524
  children: [
1525
- /* @__PURE__ */ r(ir, {}),
1525
+ /* @__PURE__ */ r(or, {}),
1526
1526
  /* @__PURE__ */ r("span", { children: o ? "Stop sharing" : "Share screen" })
1527
1527
  ]
1528
1528
  }
@@ -1533,24 +1533,24 @@ const ki = 8, Hn = 8, Ci = ({
1533
1533
  type: "button",
1534
1534
  className: `ll-overflow-popover__item ${c ? "is-on" : ""}`,
1535
1535
  onClick: () => {
1536
- u(), C(!1);
1536
+ d(), C(!1);
1537
1537
  },
1538
1538
  children: [
1539
- /* @__PURE__ */ r(ar, { muted: c }),
1539
+ /* @__PURE__ */ r(sr, { muted: c }),
1540
1540
  /* @__PURE__ */ r("span", { children: c ? "Unmute speaker" : "Mute speaker" })
1541
1541
  ]
1542
1542
  }
1543
1543
  ),
1544
- m && /* @__PURE__ */ S(
1544
+ g && /* @__PURE__ */ S(
1545
1545
  "button",
1546
1546
  {
1547
1547
  type: "button",
1548
1548
  className: `ll-overflow-popover__item ${p ? "is-on" : ""}`,
1549
1549
  onClick: () => {
1550
- h(), C(!1);
1550
+ m(), C(!1);
1551
1551
  },
1552
1552
  children: [
1553
- /* @__PURE__ */ r(Ai, {}),
1553
+ /* @__PURE__ */ r(Ni, {}),
1554
1554
  /* @__PURE__ */ r("span", { children: p ? "Hide typing" : "Type a message" })
1555
1555
  ]
1556
1556
  }
@@ -1573,7 +1573,7 @@ const ki = 8, Hn = 8, Ci = ({
1573
1573
  )
1574
1574
  ] });
1575
1575
  };
1576
- function Ei() {
1576
+ function Ai() {
1577
1577
  return /* @__PURE__ */ S(
1578
1578
  "svg",
1579
1579
  {
@@ -1590,7 +1590,7 @@ function Ei() {
1590
1590
  }
1591
1591
  );
1592
1592
  }
1593
- function Ai() {
1593
+ function Ni() {
1594
1594
  return /* @__PURE__ */ r(
1595
1595
  "svg",
1596
1596
  {
@@ -1607,7 +1607,7 @@ function Ai() {
1607
1607
  }
1608
1608
  );
1609
1609
  }
1610
- const Ni = ({
1610
+ const Mi = ({
1611
1611
  position: e,
1612
1612
  isMobile: t,
1613
1613
  agentName: n,
@@ -1617,24 +1617,24 @@ const Ni = ({
1617
1617
  branding: s,
1618
1618
  teamMembers: a,
1619
1619
  currentTeamMemberId: c,
1620
- isSwitchingTeamMember: u,
1621
- teamSwitcherOpen: m,
1620
+ isSwitchingTeamMember: d,
1621
+ teamSwitcherOpen: g,
1622
1622
  onToggleTeamSwitcher: p,
1623
- onSelectTeamMember: h,
1624
- languageMenuOpen: P,
1625
- onToggleLanguageMenu: _,
1623
+ onSelectTeamMember: m,
1624
+ languageMenuOpen: D,
1625
+ onToggleLanguageMenu: x,
1626
1626
  connectionState: C,
1627
- agentState: g,
1627
+ agentState: y,
1628
1628
  transcript: w,
1629
- canResume: D,
1629
+ canResume: P,
1630
1630
  needsUserGesture: E,
1631
- error: v,
1631
+ error: b,
1632
1632
  isMuted: O,
1633
- micError: y,
1633
+ micError: v,
1634
1634
  micDevices: z,
1635
1635
  activeMicId: B,
1636
1636
  isCameraEnabled: J,
1637
- cameraPreviewEl: ae,
1637
+ cameraPreviewEl: le,
1638
1638
  cameraDevices: H,
1639
1639
  activeCameraId: G,
1640
1640
  isScreenShareEnabled: f,
@@ -1642,21 +1642,21 @@ const Ni = ({
1642
1642
  isSpeakerMuted: $,
1643
1643
  allowCamera: q,
1644
1644
  allowScreenShare: X,
1645
- allowTyping: ee,
1645
+ allowTyping: te,
1646
1646
  showMinimize: W = !0,
1647
- showClose: te = !0,
1648
- chromeless: oe = !1,
1647
+ showClose: ne = !0,
1648
+ chromeless: ie = !1,
1649
1649
  compactControls: U = !1,
1650
1650
  transforming: ge,
1651
1651
  transformingLabel: Z,
1652
1652
  avatarVideoContainerRef: Le,
1653
- agentVideoEl: ne,
1654
- onConnect: Te,
1653
+ agentVideoEl: re,
1654
+ onConnect: Me,
1655
1655
  onDisconnect: st,
1656
- onRetry: wt,
1657
- onResumeAudio: _t,
1656
+ onRetry: _t,
1657
+ onResumeAudio: xt,
1658
1658
  onToggleMute: ct,
1659
- onSwitchMicDevice: xt,
1659
+ onSwitchMicDevice: kt,
1660
1660
  onToggleCamera: Ye,
1661
1661
  onSwitchCameraDevice: Ge,
1662
1662
  onToggleScreenShare: $e,
@@ -1668,98 +1668,98 @@ const Ni = ({
1668
1668
  dragHandleProps: We,
1669
1669
  resizeHandleProps: F
1670
1670
  }) => {
1671
- var At;
1672
- const qe = ((a == null ? void 0 : a.length) ?? 0) > 1, Ke = C === "connecting" || C === "connected", ke = C === "connected", Lt = C === "idle" || C === "disconnected" || C === "error", [ut, Re] = M(!1);
1671
+ var et;
1672
+ const qe = ((a == null ? void 0 : a.length) ?? 0) > 1, Ke = C === "connecting" || C === "connected", Ce = C === "connected", Lt = C === "idle" || C === "disconnected" || C === "error", [ut, Ie] = M(!1);
1673
1673
  I(() => {
1674
- if (!ne) {
1675
- Re(!1);
1674
+ if (!re) {
1675
+ Ie(!1);
1676
1676
  return;
1677
1677
  }
1678
- if (!ne.paused && ne.readyState >= 2) {
1679
- Re(!0);
1678
+ if (!re.paused && re.readyState >= 2) {
1679
+ Ie(!0);
1680
1680
  return;
1681
1681
  }
1682
- Re(!1);
1683
- const x = () => Re(!0);
1684
- return ne.addEventListener("playing", x), ne.addEventListener("loadeddata", x), () => {
1685
- ne.removeEventListener("playing", x), ne.removeEventListener("loadeddata", x);
1682
+ Ie(!1);
1683
+ const k = () => Ie(!0);
1684
+ return re.addEventListener("playing", k), re.addEventListener("loadeddata", k), () => {
1685
+ re.removeEventListener("playing", k), re.removeEventListener("loadeddata", k);
1686
1686
  };
1687
- }, [ne]);
1688
- const [Bt, kt] = M(!1);
1687
+ }, [re]);
1688
+ const [dt, Ct] = M(!1);
1689
1689
  I(() => {
1690
- g === "speaking" && kt(!0);
1691
- }, [g]), I(() => {
1692
- (C === "disconnected" || C === "idle") && kt(!1);
1690
+ y === "speaking" && Ct(!0);
1691
+ }, [y]), I(() => {
1692
+ (C === "disconnected" || C === "idle") && Ct(!1);
1693
1693
  }, [C]);
1694
- const Me = Bt && ut, [de, dt] = M(!1);
1694
+ const [Ue, ue] = M(!1);
1695
1695
  I(() => {
1696
- if (!ke) {
1697
- dt(!1);
1696
+ if (!Ce) {
1697
+ ue(!1);
1698
1698
  return;
1699
1699
  }
1700
- if (Me) return;
1701
- const x = setTimeout(() => dt(!0), 12e3);
1702
- return () => clearTimeout(x);
1703
- }, [ke, Me]);
1704
- const fe = C === "connecting" || ke && !Me && !de, ve = T(null), Ct = T(null);
1700
+ if (dt) return;
1701
+ const k = setTimeout(() => ue(!0), 12e3);
1702
+ return () => clearTimeout(k);
1703
+ }, [Ce, dt]);
1704
+ const St = C === "connecting" || Ce && !dt && !Ue, de = R(null), ve = R(null);
1705
1705
  I(() => {
1706
- const x = ve.current;
1707
- x && (x.innerHTML = "", ae && (ae.style.width = "100%", ae.style.height = "100%", ae.style.objectFit = "cover", ae.style.transform = "scaleX(-1)", x.appendChild(ae)));
1708
- }, [ae]), I(() => {
1709
- const x = Ct.current;
1710
- x && (x.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "contain", x.appendChild(A)));
1706
+ const k = de.current;
1707
+ k && (k.innerHTML = "", le && (le.style.width = "100%", le.style.height = "100%", le.style.objectFit = "cover", le.style.transform = "scaleX(-1)", k.appendChild(le)));
1708
+ }, [le]), I(() => {
1709
+ const k = ve.current;
1710
+ k && (k.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "contain", k.appendChild(A)));
1711
1711
  }, [A]);
1712
- const [Je, pe] = M(!1), [be, Ze] = M(!1), St = T(null), Et = T(null);
1712
+ const [Je, Ze] = M(!1), [pe, be] = M(!1), Et = R(null), At = R(null);
1713
1713
  I(() => {
1714
- if (!Je && !be && !P && !m) return;
1715
- const x = () => {
1716
- pe(!1), Ze(!1), P && _(), m && p();
1714
+ if (!Je && !pe && !D && !g) return;
1715
+ const k = () => {
1716
+ Ze(!1), be(!1), D && x(), g && p();
1717
1717
  };
1718
- return document.addEventListener("click", x), () => document.removeEventListener("click", x);
1718
+ return document.addEventListener("click", k), () => document.removeEventListener("click", k);
1719
1719
  }, [
1720
1720
  Je,
1721
- be,
1722
- P,
1723
- m,
1724
- _,
1721
+ pe,
1722
+ D,
1723
+ g,
1724
+ x,
1725
1725
  p
1726
1726
  ]);
1727
- const [Wt, an] = M(!1), De = k(() => an((x) => !x), []), [Ce, Se] = M(""), Ue = k(
1728
- (x) => {
1729
- x.preventDefault();
1730
- const re = Ce.trim();
1731
- re && (Oe(re), Se(""));
1727
+ const [Nt, an] = M(!1), sn = L(() => an((k) => !k), []), [_e, Re] = M(""), Ae = L(
1728
+ (k) => {
1729
+ k.preventDefault();
1730
+ const ae = _e.trim();
1731
+ ae && (Oe(ae), Re(""));
1732
1732
  },
1733
- [Ce, Oe]
1734
- ), Qe = s.productName || "Live Layer", qt = !s.productName;
1735
- let Ee = null, Ae = null;
1736
- for (let x = w.length - 1; x >= 0; x--) {
1737
- const re = w[x];
1738
- if (!Ee && re.role === "agent" ? Ee = re : !Ae && re.role === "user" && (Ae = re), Ee && Ae) break;
1733
+ [_e, Oe]
1734
+ ), Te = s.productName || "Live Layer", ft = !s.productName;
1735
+ let Pe = null, Se = null;
1736
+ for (let k = w.length - 1; k >= 0; k--) {
1737
+ const ae = w[k];
1738
+ if (!Pe && ae.role === "agent" ? Pe = ae : !Se && ae.role === "user" && (Se = ae), Pe && Se) break;
1739
1739
  }
1740
- const ft = ke ? (Ee == null ? void 0 : Ee.text) || null : o || null, et = ke && (Ae == null ? void 0 : Ae.text) || null, pt = [
1740
+ const Qe = Ce ? (Pe == null ? void 0 : Pe.text) || null : o || null, pt = Ce && (Se == null ? void 0 : Se.text) || null, ht = [
1741
1741
  "ll-expanded",
1742
1742
  t ? "ll-expanded--mobile" : "ll-expanded--desktop"
1743
1743
  ].join(" ");
1744
1744
  return /* @__PURE__ */ S(
1745
1745
  "div",
1746
1746
  {
1747
- className: pt,
1747
+ className: ht,
1748
1748
  "data-position": e,
1749
- "data-state": ke ? "connected" : Ke ? "connecting" : "idle",
1749
+ "data-state": Ce ? "connected" : Ke ? "connecting" : "idle",
1750
1750
  role: "dialog",
1751
1751
  "aria-label": `${n} widget`,
1752
1752
  children: [
1753
1753
  /* @__PURE__ */ S("div", { className: "ll-expanded__bg", children: [
1754
1754
  i ? /* @__PURE__ */ r(
1755
- _i,
1755
+ xi,
1756
1756
  {
1757
1757
  src: i,
1758
1758
  alt: n,
1759
1759
  className: "ll-expanded__bg-img"
1760
1760
  }
1761
- ) : /* @__PURE__ */ r("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ r("span", { className: "ll-expanded__bg-initial", children: ((At = n == null ? void 0 : n.charAt(0)) == null ? void 0 : At.toUpperCase()) || "A" }) }),
1762
- l && !ke && /* @__PURE__ */ r(
1761
+ ) : /* @__PURE__ */ r("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ r("span", { className: "ll-expanded__bg-initial", children: ((et = n == null ? void 0 : n.charAt(0)) == null ? void 0 : et.toUpperCase()) || "A" }) }),
1762
+ l && !Ce && /* @__PURE__ */ r(
1763
1763
  "video",
1764
1764
  {
1765
1765
  className: "ll-expanded__bg-idle",
@@ -1771,17 +1771,24 @@ const Ni = ({
1771
1771
  }
1772
1772
  )
1773
1773
  ] }),
1774
- /* @__PURE__ */ r("div", { ref: Le, className: "ll-expanded__video" }),
1775
- fe && /* @__PURE__ */ S("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1774
+ /* @__PURE__ */ r(
1775
+ "div",
1776
+ {
1777
+ ref: Le,
1778
+ className: "ll-expanded__video",
1779
+ "data-ready": ut
1780
+ }
1781
+ ),
1782
+ St && /* @__PURE__ */ S("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1776
1783
  /* @__PURE__ */ r("div", { className: "ll-expanded__spinner" }),
1777
- /* @__PURE__ */ r("p", { className: "ll-expanded__overlay-text", children: u ? "Switching..." : "Connecting..." })
1784
+ /* @__PURE__ */ r("p", { className: "ll-expanded__overlay-text", children: d ? "Switching..." : "Connecting..." })
1778
1785
  ] }),
1779
- E && ke && /* @__PURE__ */ S(
1786
+ E && Ce && /* @__PURE__ */ S(
1780
1787
  "button",
1781
1788
  {
1782
1789
  type: "button",
1783
1790
  className: "ll-expanded__overlay ll-expanded__overlay--gesture",
1784
- onClick: _t,
1791
+ onClick: xt,
1785
1792
  children: [
1786
1793
  /* @__PURE__ */ r("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ r("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" }) }),
1787
1794
  /* @__PURE__ */ r("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
@@ -1803,52 +1810,52 @@ const Ni = ({
1803
1810
  ),
1804
1811
  Ke ? /* @__PURE__ */ S(Ve, { children: [
1805
1812
  !U && /* @__PURE__ */ S("div", { className: "ll-expanded__topbar", ...We, children: [
1806
- !oe && /* @__PURE__ */ S("div", { className: "ll-expanded__topbar-left", children: [
1813
+ !ie && /* @__PURE__ */ S("div", { className: "ll-expanded__topbar-left", children: [
1807
1814
  /* @__PURE__ */ S("div", { className: "ll-expanded__pill-wrap", children: [
1808
1815
  /* @__PURE__ */ S(
1809
1816
  "button",
1810
1817
  {
1811
1818
  type: "button",
1812
1819
  className: "ll-hpill",
1813
- onClick: (x) => {
1814
- qe && (x.stopPropagation(), p());
1820
+ onClick: (k) => {
1821
+ qe && (k.stopPropagation(), p());
1815
1822
  },
1816
1823
  "aria-haspopup": qe ? "listbox" : void 0,
1817
- "aria-expanded": qe ? m : void 0,
1824
+ "aria-expanded": qe ? g : void 0,
1818
1825
  children: [
1819
1826
  /* @__PURE__ */ r("span", { className: "ll-hpill__label", children: n }),
1820
- qe && /* @__PURE__ */ r($t, {})
1827
+ qe && /* @__PURE__ */ r(Ot, {})
1821
1828
  ]
1822
1829
  }
1823
1830
  ),
1824
- qe && m && /* @__PURE__ */ r(
1831
+ qe && g && /* @__PURE__ */ r(
1825
1832
  "div",
1826
1833
  {
1827
1834
  className: "ll-hmenu",
1828
- onClick: (x) => x.stopPropagation(),
1835
+ onClick: (k) => k.stopPropagation(),
1829
1836
  role: "listbox",
1830
- children: a == null ? void 0 : a.map((x) => /* @__PURE__ */ S(
1837
+ children: a == null ? void 0 : a.map((k) => /* @__PURE__ */ S(
1831
1838
  "button",
1832
1839
  {
1833
1840
  type: "button",
1834
- className: `ll-hmenu__item ${x.id === c ? "is-active" : ""}`,
1835
- onClick: () => h(x.id),
1841
+ className: `ll-hmenu__item ${k.id === c ? "is-active" : ""}`,
1842
+ onClick: () => m(k.id),
1836
1843
  role: "option",
1837
- "aria-selected": x.id === c,
1844
+ "aria-selected": k.id === c,
1838
1845
  children: [
1839
- x.avatarImageUrl && /* @__PURE__ */ r(
1846
+ k.avatarImageUrl && /* @__PURE__ */ r(
1840
1847
  "img",
1841
1848
  {
1842
- src: x.avatarImageUrl,
1849
+ src: k.avatarImageUrl,
1843
1850
  alt: "",
1844
1851
  className: "ll-hmenu__avatar"
1845
1852
  }
1846
1853
  ),
1847
- /* @__PURE__ */ r("span", { className: "ll-hmenu__name", children: x.name }),
1848
- x.role && /* @__PURE__ */ r("span", { className: "ll-hmenu__role", children: x.role })
1854
+ /* @__PURE__ */ r("span", { className: "ll-hmenu__name", children: k.name }),
1855
+ k.role && /* @__PURE__ */ r("span", { className: "ll-hmenu__role", children: k.role })
1849
1856
  ]
1850
1857
  },
1851
- x.id
1858
+ k.id
1852
1859
  ))
1853
1860
  }
1854
1861
  )
@@ -1859,24 +1866,24 @@ const Ni = ({
1859
1866
  {
1860
1867
  type: "button",
1861
1868
  className: "ll-hpill ll-hpill--compact",
1862
- onClick: (x) => {
1863
- x.stopPropagation(), _();
1869
+ onClick: (k) => {
1870
+ k.stopPropagation(), x();
1864
1871
  },
1865
1872
  "aria-haspopup": "listbox",
1866
- "aria-expanded": P,
1873
+ "aria-expanded": D,
1867
1874
  "aria-label": "Language: English",
1868
1875
  title: "Language: English",
1869
1876
  children: [
1870
1877
  /* @__PURE__ */ r("span", { className: "ll-hpill__label", children: "EN" }),
1871
- /* @__PURE__ */ r($t, {})
1878
+ /* @__PURE__ */ r(Ot, {})
1872
1879
  ]
1873
1880
  }
1874
1881
  ),
1875
- P && /* @__PURE__ */ r(
1882
+ D && /* @__PURE__ */ r(
1876
1883
  "div",
1877
1884
  {
1878
1885
  className: "ll-hmenu",
1879
- onClick: (x) => x.stopPropagation(),
1886
+ onClick: (k) => k.stopPropagation(),
1880
1887
  role: "listbox",
1881
1888
  children: /* @__PURE__ */ r(
1882
1889
  "button",
@@ -1894,8 +1901,8 @@ const Ni = ({
1894
1901
  /* @__PURE__ */ r(
1895
1902
  "span",
1896
1903
  {
1897
- className: `ll-expanded__state ll-expanded__state--${g}`,
1898
- children: g
1904
+ className: `ll-expanded__state ll-expanded__state--${y}`,
1905
+ children: y
1899
1906
  }
1900
1907
  )
1901
1908
  ] }),
@@ -1908,10 +1915,10 @@ const Ni = ({
1908
1915
  onClick: Fe,
1909
1916
  "aria-label": "Minimize widget",
1910
1917
  title: "Minimize",
1911
- children: /* @__PURE__ */ r(Fn, {})
1918
+ children: /* @__PURE__ */ r(Bn, {})
1912
1919
  }
1913
1920
  ),
1914
- te !== !1 && /* @__PURE__ */ r(
1921
+ ne !== !1 && /* @__PURE__ */ r(
1915
1922
  "button",
1916
1923
  {
1917
1924
  type: "button",
@@ -1919,14 +1926,14 @@ const Ni = ({
1919
1926
  onClick: Be,
1920
1927
  "aria-label": "End call",
1921
1928
  title: "End call",
1922
- children: /* @__PURE__ */ r(On, {})
1929
+ children: /* @__PURE__ */ r(Fn, {})
1923
1930
  }
1924
1931
  )
1925
1932
  ] })
1926
1933
  ] }),
1927
- U && /* @__PURE__ */ S("div", { className: "ll-compact-status", "data-state": g, children: [
1934
+ U && /* @__PURE__ */ S("div", { className: "ll-compact-status", "data-state": y, children: [
1928
1935
  /* @__PURE__ */ r("span", { className: "ll-compact-status__dot", "aria-hidden": !0 }),
1929
- /* @__PURE__ */ r("span", { className: "ll-compact-status__label", children: g })
1936
+ /* @__PURE__ */ r("span", { className: "ll-compact-status__label", children: y })
1930
1937
  ] })
1931
1938
  ] }) : (
1932
1939
  // Idle-state header. In compactControls mode (mobile WIDGET +
@@ -1938,7 +1945,7 @@ const Ni = ({
1938
1945
  // pre-0.18.0 behavior) left users no way out short of scrolling
1939
1946
  // the page itself.
1940
1947
  /* @__PURE__ */ S("div", { className: "ll-expanded__header ll-expanded__header--idle", ...We, children: [
1941
- !U && (qt ? /* @__PURE__ */ S(
1948
+ !U && (ft ? /* @__PURE__ */ S(
1942
1949
  "a",
1943
1950
  {
1944
1951
  className: "ll-expanded__brand ll-expanded__brand--link",
@@ -1949,10 +1956,10 @@ const Ni = ({
1949
1956
  title: "Powered by LiveLayer — visit livelayer.studio",
1950
1957
  children: [
1951
1958
  /* @__PURE__ */ r(Li, { size: 14, className: "ll-expanded__brand-mark" }),
1952
- /* @__PURE__ */ r("span", { children: Qe })
1959
+ /* @__PURE__ */ r("span", { children: Te })
1953
1960
  ]
1954
1961
  }
1955
- ) : /* @__PURE__ */ r("span", { className: "ll-expanded__brand", children: Qe })),
1962
+ ) : /* @__PURE__ */ r("span", { className: "ll-expanded__brand", children: Te })),
1956
1963
  /* @__PURE__ */ S("div", { className: "ll-expanded__header-actions", children: [
1957
1964
  !U && W !== !1 && /* @__PURE__ */ r(
1958
1965
  "button",
@@ -1961,35 +1968,35 @@ const Ni = ({
1961
1968
  className: "ll-hbtn ll-hbtn--ghost",
1962
1969
  onClick: Fe,
1963
1970
  "aria-label": "Minimize widget",
1964
- children: /* @__PURE__ */ r(Fn, {})
1971
+ children: /* @__PURE__ */ r(Bn, {})
1965
1972
  }
1966
1973
  ),
1967
- te !== !1 && /* @__PURE__ */ r(
1974
+ ne !== !1 && /* @__PURE__ */ r(
1968
1975
  "button",
1969
1976
  {
1970
1977
  type: "button",
1971
1978
  className: "ll-hbtn ll-hbtn--danger",
1972
1979
  onClick: Be,
1973
1980
  "aria-label": "Close widget",
1974
- children: /* @__PURE__ */ r(On, {})
1981
+ children: /* @__PURE__ */ r(Fn, {})
1975
1982
  }
1976
1983
  )
1977
1984
  ] })
1978
1985
  ] })
1979
1986
  ),
1980
1987
  Lt && /* @__PURE__ */ (() => {
1981
- const x = D ? "Resume session" : C === "disconnected" ? "Reconnect to agent" : "Start video call";
1988
+ const k = P ? "Resume session" : C === "disconnected" ? "Reconnect to agent" : "Start video call";
1982
1989
  return /* @__PURE__ */ S(Ve, { children: [
1983
- !v && /* @__PURE__ */ S(
1990
+ !b && /* @__PURE__ */ S(
1984
1991
  "button",
1985
1992
  {
1986
1993
  type: "button",
1987
1994
  className: "ll-expanded__play",
1988
- onClick: Te,
1989
- "aria-label": x,
1995
+ onClick: Me,
1996
+ "aria-label": k,
1990
1997
  children: [
1991
1998
  /* @__PURE__ */ r("div", { className: "ll-expanded__play-circle", children: /* @__PURE__ */ r("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ r("polygon", { points: "6 3 20 12 6 21 6 3" }) }) }),
1992
- U && /* @__PURE__ */ r("span", { className: "ll-expanded__play-label", children: x })
1999
+ U && /* @__PURE__ */ r("span", { className: "ll-expanded__play-label", children: k })
1993
2000
  ]
1994
2001
  }
1995
2002
  ),
@@ -2000,9 +2007,9 @@ const Ni = ({
2000
2007
  {
2001
2008
  type: "button",
2002
2009
  className: "ll-expanded__cta",
2003
- onClick: Te,
2004
- "aria-label": x,
2005
- children: x
2010
+ onClick: Me,
2011
+ "aria-label": k,
2012
+ children: k
2006
2013
  }
2007
2014
  )
2008
2015
  ] })
@@ -2016,14 +2023,14 @@ const Ni = ({
2016
2023
  /* @__PURE__ */ r(
2017
2024
  "div",
2018
2025
  {
2019
- ref: Ct,
2026
+ ref: ve,
2020
2027
  className: f ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
2021
2028
  }
2022
2029
  ),
2023
2030
  /* @__PURE__ */ r(
2024
2031
  "div",
2025
2032
  {
2026
- ref: ve,
2033
+ ref: de,
2027
2034
  className: !f && J ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
2028
2035
  }
2029
2036
  )
@@ -2031,23 +2038,23 @@ const Ni = ({
2031
2038
  }
2032
2039
  ),
2033
2040
  Ke ? /* @__PURE__ */ S("div", { className: "ll-expanded__bottom", children: [
2034
- !U && ft && /* @__PURE__ */ r(
2041
+ !U && Qe && /* @__PURE__ */ r(
2035
2042
  "div",
2036
2043
  {
2037
2044
  className: "ll-expanded__transcript ll-expanded__transcript--agent",
2038
2045
  "data-role": "agent",
2039
- children: /* @__PURE__ */ r("p", { className: "ll-expanded__transcript-text", children: ft })
2046
+ children: /* @__PURE__ */ r("p", { className: "ll-expanded__transcript-text", children: Qe })
2040
2047
  }
2041
2048
  ),
2042
- !U && et && /* @__PURE__ */ r(
2049
+ !U && pt && /* @__PURE__ */ r(
2043
2050
  "div",
2044
2051
  {
2045
2052
  className: "ll-expanded__transcript ll-expanded__transcript--user",
2046
2053
  "data-role": "user",
2047
- children: /* @__PURE__ */ r("p", { className: "ll-expanded__transcript-text", children: et })
2054
+ children: /* @__PURE__ */ r("p", { className: "ll-expanded__transcript-text", children: pt })
2048
2055
  }
2049
2056
  ),
2050
- !oe && !U && /* @__PURE__ */ S("div", { className: "ll-toolbar", onClick: (x) => x.stopPropagation(), children: [
2057
+ !ie && !U && /* @__PURE__ */ S("div", { className: "ll-toolbar", onClick: (k) => k.stopPropagation(), children: [
2051
2058
  X && /* @__PURE__ */ r(
2052
2059
  "button",
2053
2060
  {
@@ -2056,7 +2063,7 @@ const Ni = ({
2056
2063
  onClick: $e,
2057
2064
  "aria-label": f ? "Stop sharing screen" : "Share screen",
2058
2065
  title: f ? "Stop sharing" : "Share screen",
2059
- children: /* @__PURE__ */ r(ir, {})
2066
+ children: /* @__PURE__ */ r(or, {})
2060
2067
  }
2061
2068
  ),
2062
2069
  q && /* @__PURE__ */ S("div", { className: "ll-tool-split", children: [
@@ -2068,33 +2075,33 @@ const Ni = ({
2068
2075
  onClick: Ye,
2069
2076
  "aria-label": J ? "Turn off camera" : "Turn on camera",
2070
2077
  title: J ? "Stop camera" : "Start camera",
2071
- children: /* @__PURE__ */ r(or, {})
2078
+ children: /* @__PURE__ */ r(lr, {})
2072
2079
  }
2073
2080
  ),
2074
2081
  /* @__PURE__ */ r(
2075
2082
  "button",
2076
2083
  {
2077
- ref: Et,
2084
+ ref: At,
2078
2085
  type: "button",
2079
2086
  className: `ll-tool ll-tool--right ${J ? "is-on" : ""}`,
2080
- onClick: (x) => {
2081
- x.stopPropagation(), Ze((re) => !re), pe(!1);
2087
+ onClick: (k) => {
2088
+ k.stopPropagation(), be((ae) => !ae), Ze(!1);
2082
2089
  },
2083
2090
  "aria-label": "Camera devices",
2084
2091
  "aria-haspopup": "listbox",
2085
- "aria-expanded": be,
2086
- children: /* @__PURE__ */ r($t, {})
2092
+ "aria-expanded": pe,
2093
+ children: /* @__PURE__ */ r(Ot, {})
2087
2094
  }
2088
2095
  ),
2089
- be && H.length > 0 && /* @__PURE__ */ r(
2090
- Bn,
2096
+ pe && H.length > 0 && /* @__PURE__ */ r(
2097
+ Wn,
2091
2098
  {
2092
2099
  label: "Camera",
2093
2100
  devices: H,
2094
2101
  activeId: G,
2095
- anchorRef: Et,
2096
- onPick: (x) => {
2097
- Ze(!1), Ge(x);
2102
+ anchorRef: At,
2103
+ onPick: (k) => {
2104
+ be(!1), Ge(k);
2098
2105
  }
2099
2106
  }
2100
2107
  )
@@ -2108,33 +2115,33 @@ const Ni = ({
2108
2115
  onClick: ct,
2109
2116
  "aria-label": O ? "Unmute microphone" : "Mute microphone",
2110
2117
  title: O ? "Unmute" : "Mute",
2111
- children: /* @__PURE__ */ r(lr, { muted: O })
2118
+ children: /* @__PURE__ */ r(ar, { muted: O })
2112
2119
  }
2113
2120
  ),
2114
2121
  /* @__PURE__ */ r(
2115
2122
  "button",
2116
2123
  {
2117
- ref: St,
2124
+ ref: Et,
2118
2125
  type: "button",
2119
2126
  className: `ll-tool ll-tool--right ${O ? "is-muted" : ""}`,
2120
- onClick: (x) => {
2121
- x.stopPropagation(), pe((re) => !re), Ze(!1);
2127
+ onClick: (k) => {
2128
+ k.stopPropagation(), Ze((ae) => !ae), be(!1);
2122
2129
  },
2123
2130
  "aria-label": "Microphone devices",
2124
2131
  "aria-haspopup": "listbox",
2125
2132
  "aria-expanded": Je,
2126
- children: /* @__PURE__ */ r($t, {})
2133
+ children: /* @__PURE__ */ r(Ot, {})
2127
2134
  }
2128
2135
  ),
2129
2136
  Je && z.length > 0 && /* @__PURE__ */ r(
2130
- Bn,
2137
+ Wn,
2131
2138
  {
2132
2139
  label: "Microphone",
2133
2140
  devices: z,
2134
2141
  activeId: B,
2135
- anchorRef: St,
2136
- onPick: (x) => {
2137
- pe(!1), xt(x);
2142
+ anchorRef: Et,
2143
+ onPick: (k) => {
2144
+ Ze(!1), kt(k);
2138
2145
  }
2139
2146
  }
2140
2147
  )
@@ -2147,7 +2154,7 @@ const Ni = ({
2147
2154
  onClick: He,
2148
2155
  "aria-label": $ ? "Unmute speaker" : "Mute speaker",
2149
2156
  title: $ ? "Unmute speaker" : "Mute speaker",
2150
- children: /* @__PURE__ */ r(ar, { muted: $ })
2157
+ children: /* @__PURE__ */ r(sr, { muted: $ })
2151
2158
  }
2152
2159
  ),
2153
2160
  /* @__PURE__ */ r(
@@ -2158,12 +2165,12 @@ const Ni = ({
2158
2165
  onClick: st,
2159
2166
  "aria-label": "End conversation",
2160
2167
  title: "End conversation",
2161
- children: /* @__PURE__ */ r(sr, {})
2168
+ children: /* @__PURE__ */ r(cr, {})
2162
2169
  }
2163
2170
  )
2164
2171
  ] }),
2165
- !oe && U && /* @__PURE__ */ r(
2166
- Si,
2172
+ !ie && U && /* @__PURE__ */ r(
2173
+ Ei,
2167
2174
  {
2168
2175
  isMuted: O,
2169
2176
  onToggleMute: ct,
@@ -2175,39 +2182,39 @@ const Ni = ({
2175
2182
  allowScreenShare: X,
2176
2183
  isSpeakerMuted: $,
2177
2184
  onToggleSpeaker: He,
2178
- allowTyping: ee,
2179
- isTypingOpen: Wt,
2180
- onToggleTyping: De,
2185
+ allowTyping: te,
2186
+ isTypingOpen: Nt,
2187
+ onToggleTyping: sn,
2181
2188
  onDisconnect: st
2182
2189
  }
2183
2190
  ),
2184
- !oe && ee && (U ? Wt : !0) && /* @__PURE__ */ S("form", { className: "ll-message-input", onSubmit: Ue, children: [
2191
+ !ie && te && (U ? Nt : !0) && /* @__PURE__ */ S("form", { className: "ll-message-input", onSubmit: Ae, children: [
2185
2192
  /* @__PURE__ */ r(
2186
2193
  "input",
2187
2194
  {
2188
2195
  type: "text",
2189
2196
  className: "ll-message-input__field",
2190
2197
  placeholder: "Message...",
2191
- value: Ce,
2192
- onChange: (x) => Se(x.target.value),
2198
+ value: _e,
2199
+ onChange: (k) => Re(k.target.value),
2193
2200
  "aria-label": "Message the agent"
2194
2201
  }
2195
2202
  ),
2196
- Ce.trim() && /* @__PURE__ */ r(
2203
+ _e.trim() && /* @__PURE__ */ r(
2197
2204
  "button",
2198
2205
  {
2199
2206
  type: "submit",
2200
2207
  className: "ll-message-input__send",
2201
2208
  "aria-label": "Send message",
2202
- children: /* @__PURE__ */ r(Mi, {})
2209
+ children: /* @__PURE__ */ r(Ii, {})
2203
2210
  }
2204
2211
  )
2205
2212
  ] })
2206
2213
  ] }) : null,
2207
2214
  (() => {
2208
- if (y && C !== "error")
2215
+ if (v && C !== "error")
2209
2216
  return /* @__PURE__ */ S("div", { className: "ll-expanded__banner", role: "alert", children: [
2210
- /* @__PURE__ */ r("span", { children: y }),
2217
+ /* @__PURE__ */ r("span", { children: v }),
2211
2218
  /* @__PURE__ */ r(
2212
2219
  "button",
2213
2220
  {
@@ -2219,17 +2226,17 @@ const Ni = ({
2219
2226
  }
2220
2227
  )
2221
2228
  ] });
2222
- if (!v || C !== "error") return null;
2223
- let x = "Failed to connect", re = "Try again";
2224
- return v === "MIC_PERMISSION_DENIED" ? x = "Microphone blocked. Allow access to talk." : v === "MIC_NOT_FOUND" ? x = "No microphone found. Plug one in + retry." : v === "MIC_UNAVAILABLE" ? x = "Mic unavailable. Check other apps using it." : v === "AGENT_TIMEOUT" ? x = "Agent didn't pick up. Try again." : v === "CONNECT_FAILED" ? x = "Connection failed. Check your network." : v.length < 80 && (x = v), /* @__PURE__ */ S("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
2225
- /* @__PURE__ */ r("span", { children: x }),
2229
+ if (!b || C !== "error") return null;
2230
+ let k = "Failed to connect", ae = "Try again";
2231
+ return b === "MIC_PERMISSION_DENIED" ? k = "Microphone blocked. Allow access to talk." : b === "MIC_NOT_FOUND" ? k = "No microphone found. Plug one in + retry." : b === "MIC_UNAVAILABLE" ? k = "Mic unavailable. Check other apps using it." : b === "AGENT_TIMEOUT" ? k = "Agent didn't pick up. Try again." : b === "CONNECT_FAILED" ? k = "Connection failed. Check your network." : b.length < 80 && (k = b), /* @__PURE__ */ S("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
2232
+ /* @__PURE__ */ r("span", { children: k }),
2226
2233
  /* @__PURE__ */ r(
2227
2234
  "button",
2228
2235
  {
2229
2236
  type: "button",
2230
2237
  className: "ll-expanded__banner-retry",
2231
- onClick: wt,
2232
- children: re
2238
+ onClick: _t,
2239
+ children: ae
2233
2240
  }
2234
2241
  )
2235
2242
  ] });
@@ -2250,32 +2257,32 @@ const Ni = ({
2250
2257
  }
2251
2258
  );
2252
2259
  };
2253
- function $t() {
2260
+ function Ot() {
2254
2261
  return /* @__PURE__ */ r("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ r("polyline", { points: "6 9 12 15 18 9" }) });
2255
2262
  }
2256
- function On() {
2263
+ function Fn() {
2257
2264
  return /* @__PURE__ */ S("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
2258
2265
  /* @__PURE__ */ r("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
2259
2266
  /* @__PURE__ */ r("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
2260
2267
  ] });
2261
2268
  }
2262
- function Fn() {
2269
+ function Bn() {
2263
2270
  return /* @__PURE__ */ r("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ r("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
2264
2271
  }
2265
- function ir() {
2272
+ function or() {
2266
2273
  return /* @__PURE__ */ S("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: [
2267
2274
  /* @__PURE__ */ r("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
2268
2275
  /* @__PURE__ */ r("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
2269
2276
  /* @__PURE__ */ r("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
2270
2277
  ] });
2271
2278
  }
2272
- function or() {
2279
+ function lr() {
2273
2280
  return /* @__PURE__ */ S("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: [
2274
2281
  /* @__PURE__ */ r("path", { d: "M23 7l-7 5 7 5V7z" }),
2275
2282
  /* @__PURE__ */ r("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
2276
2283
  ] });
2277
2284
  }
2278
- function lr({ muted: e }) {
2285
+ function ar({ muted: e }) {
2279
2286
  return /* @__PURE__ */ S("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: [
2280
2287
  /* @__PURE__ */ r("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
2281
2288
  /* @__PURE__ */ r("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
@@ -2283,7 +2290,7 @@ function lr({ muted: e }) {
2283
2290
  e && /* @__PURE__ */ r("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
2284
2291
  ] });
2285
2292
  }
2286
- function ar({ muted: e }) {
2293
+ function sr({ muted: e }) {
2287
2294
  return /* @__PURE__ */ S("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: [
2288
2295
  /* @__PURE__ */ r("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
2289
2296
  e ? /* @__PURE__ */ r("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ S(Ve, { children: [
@@ -2292,13 +2299,13 @@ function ar({ muted: e }) {
2292
2299
  ] })
2293
2300
  ] });
2294
2301
  }
2295
- function Mi() {
2302
+ function Ii() {
2296
2303
  return /* @__PURE__ */ S("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
2297
2304
  /* @__PURE__ */ r("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
2298
2305
  /* @__PURE__ */ r("polyline", { points: "12 5 19 12 12 19" })
2299
2306
  ] });
2300
2307
  }
2301
- function sr() {
2308
+ function cr() {
2302
2309
  return /* @__PURE__ */ r("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__ */ r(
2303
2310
  "path",
2304
2311
  {
@@ -2307,7 +2314,7 @@ function sr() {
2307
2314
  }
2308
2315
  ) });
2309
2316
  }
2310
- const Bn = ({
2317
+ const Wn = ({
2311
2318
  label: e,
2312
2319
  devices: t,
2313
2320
  activeId: n,
@@ -2315,14 +2322,14 @@ const Bn = ({
2315
2322
  anchorRef: l
2316
2323
  }) => {
2317
2324
  const [o, s] = M(null);
2318
- return Qn(() => {
2325
+ return er(() => {
2319
2326
  const a = () => {
2320
2327
  const c = l.current;
2321
2328
  if (!c) return;
2322
- const u = c.getBoundingClientRect(), m = 126, p = window.innerWidth - 16 - 110, h = u.left + u.width / 2;
2329
+ const d = c.getBoundingClientRect(), g = 126, p = window.innerWidth - 16 - 110, m = d.left + d.width / 2;
2323
2330
  s({
2324
- top: u.top - 8,
2325
- left: Math.max(m, Math.min(p, h))
2331
+ top: d.top - 8,
2332
+ left: Math.max(g, Math.min(p, m))
2326
2333
  });
2327
2334
  };
2328
2335
  return a(), window.addEventListener("scroll", a, !0), window.addEventListener("resize", a), () => {
@@ -2345,17 +2352,17 @@ const Bn = ({
2345
2352
  children: [
2346
2353
  /* @__PURE__ */ r("p", { className: "ll-device-menu__label", children: e }),
2347
2354
  t.map((a, c) => {
2348
- const u = n === a.deviceId;
2355
+ const d = n === a.deviceId;
2349
2356
  return /* @__PURE__ */ S(
2350
2357
  "button",
2351
2358
  {
2352
2359
  type: "button",
2353
- className: `ll-device-menu__item ${u ? "is-active" : ""}`,
2360
+ className: `ll-device-menu__item ${d ? "is-active" : ""}`,
2354
2361
  onClick: () => i(a.deviceId),
2355
2362
  role: "option",
2356
- "aria-selected": u,
2363
+ "aria-selected": d,
2357
2364
  children: [
2358
- u && /* @__PURE__ */ r("span", { className: "ll-device-menu__dot", children: "●" }),
2365
+ d && /* @__PURE__ */ r("span", { className: "ll-device-menu__dot", children: "●" }),
2359
2366
  /* @__PURE__ */ r("span", { className: "ll-device-menu__name", children: a.label || `${e} ${c + 1}` })
2360
2367
  ]
2361
2368
  },
@@ -2367,7 +2374,7 @@ const Bn = ({
2367
2374
  ),
2368
2375
  document.body
2369
2376
  );
2370
- }, Ii = [
2377
+ }, Ri = [
2371
2378
  // Accept any value (or empty) — `<input data-ll-private />` and
2372
2379
  // `<input data-ll-private="true" />` both opt out. The bare attribute
2373
2380
  // is the recommended spelling; "true" is preserved for back-compat.
@@ -2375,17 +2382,17 @@ const Bn = ({
2375
2382
  "[data-ll-skip]",
2376
2383
  ".ll-widget"
2377
2384
  ];
2378
- function Ft(e) {
2385
+ function Wt(e) {
2379
2386
  let t = e;
2380
2387
  for (; t; ) {
2381
- for (const n of Ii)
2388
+ for (const n of Ri)
2382
2389
  if (t.matches(n)) return !0;
2383
2390
  t = t.parentElement;
2384
2391
  }
2385
2392
  return !1;
2386
2393
  }
2387
2394
  function nn(e) {
2388
- if (Ft(e)) return !1;
2395
+ if (Wt(e)) return !1;
2389
2396
  if (e instanceof HTMLInputElement) {
2390
2397
  if (e.type === "password") return !1;
2391
2398
  const t = (e.getAttribute("autocomplete") || "").toLowerCase();
@@ -2393,66 +2400,66 @@ function nn(e) {
2393
2400
  }
2394
2401
  return !0;
2395
2402
  }
2396
- const Ti = /\b(continue|next|proceed|move\s*on|forward)\b|→|›/i, Wn = /\b(back|previous|prev|go\s*back)\b|←|‹/i, Ri = /\b(submit|finish|done|complete|send)\b/i, bt = /* @__PURE__ */ new Map();
2397
- function qn(e) {
2398
- const t = bt.get(e);
2403
+ const Ti = /\b(continue|next|proceed|move\s*on|forward)\b|→|›/i, qn = /\b(back|previous|prev|go\s*back)\b|←|‹/i, Pi = /\b(submit|finish|done|complete|send)\b/i, wt = /* @__PURE__ */ new Map();
2404
+ function Un(e) {
2405
+ const t = wt.get(e);
2399
2406
  return t && t.isConnected ? t : null;
2400
2407
  }
2401
2408
  function it(e) {
2402
- if (Ft(e) || e.hidden || e.getAttribute("aria-hidden") === "true") return !0;
2409
+ if (Wt(e) || e.hidden || e.getAttribute("aria-hidden") === "true") return !0;
2403
2410
  const t = typeof window < "u" && window.getComputedStyle ? window.getComputedStyle(e) : null;
2404
2411
  return !!(t && (t.display === "none" || t.visibility === "hidden"));
2405
2412
  }
2406
2413
  function Di(e) {
2407
2414
  return !!(e.disabled || e.getAttribute("aria-disabled") === "true");
2408
2415
  }
2409
- function Pi(e) {
2416
+ function zi(e) {
2410
2417
  return (e.innerText || e.textContent || e.getAttribute("aria-label") || e.value || "").trim();
2411
2418
  }
2412
- function zi(e) {
2419
+ function $i(e) {
2413
2420
  return Array.from(e.querySelectorAll('button, [role="button"], input[type="submit"], input[type="button"]')).filter(
2414
2421
  (n) => !it(n) && !Di(n)
2415
2422
  );
2416
2423
  }
2417
- function cr(e) {
2418
- bt.clear();
2419
- const t = zi(e);
2424
+ function ur(e) {
2425
+ wt.clear();
2426
+ const t = $i(e);
2420
2427
  let n, i, l;
2421
2428
  for (const a of t) {
2422
- const c = Pi(a);
2429
+ const c = zi(a);
2423
2430
  if (!c || c.length > 40) continue;
2424
- const u = a.getAttribute("type") === "submit" || a.tagName === "BUTTON" && !a.getAttribute("type") && !!a.closest("form");
2425
- !n && Ti.test(c) && !Wn.test(c) ? (n = { id: "ll-advance", label: c }, bt.set("ll-advance", a)) : !i && Wn.test(c) ? (i = { id: "ll-back", label: c }, bt.set("ll-back", a)) : !l && (Ri.test(c) || u) && (l = { id: "ll-submit", label: c }, bt.set("ll-submit", a));
2431
+ const d = a.getAttribute("type") === "submit" || a.tagName === "BUTTON" && !a.getAttribute("type") && !!a.closest("form");
2432
+ !n && Ti.test(c) && !qn.test(c) ? (n = { id: "ll-advance", label: c }, wt.set("ll-advance", a)) : !i && qn.test(c) ? (i = { id: "ll-back", label: c }, wt.set("ll-back", a)) : !l && (Pi.test(c) || d) && (l = { id: "ll-submit", label: c }, wt.set("ll-submit", a));
2426
2433
  }
2427
- const o = qi(e);
2434
+ const o = Ui(e);
2428
2435
  return { kind: n || o.totalSteps ? "multi-step" : "single-page", advance: n, back: i, submit: l, ...o };
2429
2436
  }
2430
- const $i = 60;
2431
- function ur(e) {
2432
- return e.replace(/^\s*(step\s+)?\d{1,2}(?:[.):\-]+\s*|\s+)/i, "").replace(/\s+/g, " ").trim().slice(0, $i);
2437
+ const Hi = 60;
2438
+ function dr(e) {
2439
+ return e.replace(/^\s*(step\s+)?\d{1,2}(?:[.):\-]+\s*|\s+)/i, "").replace(/\s+/g, " ").trim().slice(0, Hi);
2433
2440
  }
2434
- function Hi(e) {
2441
+ function Oi(e) {
2435
2442
  const t = e.getAttribute("class");
2436
2443
  return t ? t.toLowerCase() : "";
2437
2444
  }
2438
- const Oi = /stepper|wizard|ant-steps|step-indicator/;
2439
- function Fi(e) {
2440
- return Oi.test(Hi(e));
2445
+ const Fi = /stepper|wizard|ant-steps|step-indicator/;
2446
+ function Bi(e) {
2447
+ return Fi.test(Oi(e));
2441
2448
  }
2442
- function Un(e) {
2449
+ function jn(e) {
2443
2450
  const t = e.getAttribute("aria-current");
2444
2451
  return t === "step" || t === "true" ? !0 : Array.from(e.classList).some(
2445
2452
  (n) => /(^|[-_])(active|current|selected)([-_]|$)/i.test(n)
2446
2453
  );
2447
2454
  }
2448
- const Bi = '[aria-current="step"],[aria-current="true"],[class*="active"],[class*="Active"],[class*="current"],[class*="Current"],[class*="selected"],[class*="Selected"]';
2449
- function Wi(e) {
2450
- return Un(e) ? !0 : Array.from(e.querySelectorAll(Bi)).some(
2451
- Un
2455
+ const Wi = '[aria-current="step"],[aria-current="true"],[class*="active"],[class*="Active"],[class*="current"],[class*="Current"],[class*="selected"],[class*="Selected"]';
2456
+ function qi(e) {
2457
+ return jn(e) ? !0 : Array.from(e.querySelectorAll(Wi)).some(
2458
+ jn
2452
2459
  );
2453
2460
  }
2454
- function jn(e, t) {
2455
- const n = ur(
2461
+ function Vn(e, t) {
2462
+ const n = dr(
2456
2463
  e[t].innerText || e[t].textContent || ""
2457
2464
  );
2458
2465
  return {
@@ -2461,13 +2468,13 @@ function jn(e, t) {
2461
2468
  ...n ? { stepLabel: n } : {}
2462
2469
  };
2463
2470
  }
2464
- function qi(e) {
2471
+ function Ui(e) {
2465
2472
  const t = e.querySelector('[aria-current="step"]');
2466
2473
  if (t && t.parentElement && !it(t)) {
2467
2474
  const l = Array.from(t.parentElement.children).filter(
2468
2475
  (s) => s.tagName === t.tagName && !it(s)
2469
2476
  ), o = l.indexOf(t);
2470
- if (o >= 0 && l.length >= 2) return jn(l, o);
2477
+ if (o >= 0 && l.length >= 2) return Vn(l, o);
2471
2478
  }
2472
2479
  const n = e.querySelector('[role="progressbar"]');
2473
2480
  if (n && !it(n)) {
@@ -2477,7 +2484,7 @@ function qi(e) {
2477
2484
  return {
2478
2485
  totalSteps: o,
2479
2486
  currentStep: l,
2480
- ...s ? { stepLabel: ur(s) } : {}
2487
+ ...s ? { stepLabel: dr(s) } : {}
2481
2488
  };
2482
2489
  }
2483
2490
  }
@@ -2485,19 +2492,19 @@ function qi(e) {
2485
2492
  e.querySelectorAll(
2486
2493
  '[class*="step"], [class*="Step"], [class*="wizard"], [class*="Wizard"]'
2487
2494
  )
2488
- ).filter((l) => !it(l) && Fi(l));
2495
+ ).filter((l) => !it(l) && Bi(l));
2489
2496
  for (const l of i) {
2490
2497
  const o = Array.from(l.children).filter(
2491
2498
  (a) => !it(a) && (a.textContent || "").trim().length > 0
2492
2499
  );
2493
2500
  if (o.length < 2 || o.length > 12) continue;
2494
- const s = o.findIndex(Wi);
2501
+ const s = o.findIndex(qi);
2495
2502
  if (!(s < 0))
2496
- return jn(o, s);
2503
+ return Vn(o, s);
2497
2504
  }
2498
2505
  return {};
2499
2506
  }
2500
- const Ht = 4096, Ui = 20, ji = 20, Vi = 10, Yi = 10, Gi = 30, Xi = 20, Vn = 500, Ki = [
2507
+ const Ft = 4096, ji = 20, Vi = 20, Yi = 10, Gi = 10, Xi = 30, Ki = 20, Yn = 500, Ji = [
2501
2508
  '[data-ll-private="true"]',
2502
2509
  ".ll-widget",
2503
2510
  "script",
@@ -2505,24 +2512,24 @@ const Ht = 4096, Ui = 20, ji = 20, Vi = 10, Yi = 10, Gi = 30, Xi = 20, Vn = 500,
2505
2512
  "noscript",
2506
2513
  "iframe"
2507
2514
  ];
2508
- function yt(e) {
2515
+ function vt(e) {
2509
2516
  if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
2510
2517
  let t = e;
2511
2518
  for (; t; ) {
2512
- for (const n of Ki)
2519
+ for (const n of Ji)
2513
2520
  if (t.matches(n)) return !0;
2514
2521
  t = t.parentElement;
2515
2522
  }
2516
2523
  return !1;
2517
2524
  }
2518
- function vt(e) {
2525
+ function bt(e) {
2519
2526
  if (typeof window > "u") return !0;
2520
2527
  const t = e.getBoundingClientRect();
2521
2528
  if (t.width <= 0 || t.height <= 0) return !1;
2522
2529
  const n = window.innerHeight || document.documentElement.clientHeight, i = window.innerWidth || document.documentElement.clientWidth;
2523
2530
  return t.bottom > 0 && t.right > 0 && t.top < n && t.left < i;
2524
2531
  }
2525
- function Yn(e) {
2532
+ function Gn(e) {
2526
2533
  const t = e.getAttribute("id");
2527
2534
  if (t) {
2528
2535
  const o = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(t) : t.replace(/"/g, '\\"'), s = document.querySelector(`label[for="${o}"]`);
@@ -2552,10 +2559,10 @@ function Yn(e) {
2552
2559
  function ce(e, t) {
2553
2560
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
2554
2561
  }
2555
- function Ji(e) {
2562
+ function Zi(e) {
2556
2563
  return e && e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || null;
2557
2564
  }
2558
- function Zi(e) {
2565
+ function Qi(e) {
2559
2566
  const t = e.getAttribute("aria-label");
2560
2567
  if (t) return t.trim().slice(0, 80);
2561
2568
  const n = e.getAttribute("aria-labelledby");
@@ -2584,7 +2591,7 @@ function Zi(e) {
2584
2591
  function rt(e) {
2585
2592
  return e.length;
2586
2593
  }
2587
- function Qi(e, t = {}) {
2594
+ function eo(e, t = {}) {
2588
2595
  const n = t.doc ?? (typeof document < "u" ? document : null);
2589
2596
  if (!n)
2590
2597
  return {
@@ -2601,62 +2608,62 @@ function Qi(e, t = {}) {
2601
2608
  const i = typeof window < "u" && window.location.href || "", l = typeof window < "u" && window.location.pathname || "/", o = n.title || "", s = Array.from(
2602
2609
  n.querySelectorAll("[data-ll-region]")
2603
2610
  ), a = [];
2604
- for (const y of s) {
2605
- if (a.length >= Vi) break;
2606
- if (yt(y) || !vt(y)) continue;
2607
- const z = y.getAttribute("data-ll-region") ?? "", B = y.getAttribute("data-ll-intent") ?? void 0, J = ce(
2608
- (y.innerText || y.textContent || "").trim(),
2609
- Vn * 2
2611
+ for (const v of s) {
2612
+ if (a.length >= Yi) break;
2613
+ if (vt(v) || !bt(v)) continue;
2614
+ const z = v.getAttribute("data-ll-region") ?? "", B = v.getAttribute("data-ll-intent") ?? void 0, J = ce(
2615
+ (v.innerText || v.textContent || "").trim(),
2616
+ Yn * 2
2610
2617
  );
2611
2618
  !z || !J || a.push({ id: z, intent: B, text: J });
2612
2619
  }
2613
- const c = [], u = ["H1", "H2", "H3", "H4", "H5", "H6"], m = Array.from(
2620
+ const c = [], d = ["H1", "H2", "H3", "H4", "H5", "H6"], g = Array.from(
2614
2621
  n.querySelectorAll("h1, h2, h3, h4, h5, h6")
2615
2622
  );
2616
- for (const y of m) {
2617
- if (yt(y) || !vt(y)) continue;
2618
- const z = (y.textContent || "").trim();
2619
- z && c.push(`${y.tagName}: ${ce(z, 200)}`);
2623
+ for (const v of g) {
2624
+ if (vt(v) || !bt(v)) continue;
2625
+ const z = (v.textContent || "").trim();
2626
+ z && c.push(`${v.tagName}: ${ce(z, 200)}`);
2620
2627
  }
2621
2628
  const p = Array.from(n.querySelectorAll("p, li"));
2622
- for (const y of p) {
2623
- if (yt(y) || !vt(y) || u.includes(y.tagName)) continue;
2624
- const z = (y.textContent || "").trim();
2625
- z.length > 10 && c.push(ce(z, Vn));
2629
+ for (const v of p) {
2630
+ if (vt(v) || !bt(v) || d.includes(v.tagName)) continue;
2631
+ const z = (v.textContent || "").trim();
2632
+ z.length > 10 && c.push(ce(z, Yn));
2626
2633
  }
2627
- const h = c.join(`
2628
- `), P = [], _ = Array.from(n.querySelectorAll("a[href]"));
2629
- for (const y of _) {
2630
- if (P.length >= Ui) break;
2631
- if (yt(y) || !vt(y)) continue;
2632
- const z = y.getAttribute("href") || "", B = (y.textContent || "").trim();
2633
- !z || !B || P.push({ href: z, text: ce(B, 100) });
2634
+ const m = c.join(`
2635
+ `), D = [], x = Array.from(n.querySelectorAll("a[href]"));
2636
+ for (const v of x) {
2637
+ if (D.length >= ji) break;
2638
+ if (vt(v) || !bt(v)) continue;
2639
+ const z = v.getAttribute("href") || "", B = (v.textContent || "").trim();
2640
+ !z || !B || D.push({ href: z, text: ce(B, 100) });
2634
2641
  }
2635
- const C = [], g = Array.from(
2642
+ const C = [], y = Array.from(
2636
2643
  n.querySelectorAll(
2637
2644
  "input, textarea, select"
2638
2645
  )
2639
2646
  );
2640
- for (const y of g) {
2641
- if (C.length >= ji) break;
2642
- if (yt(y) || !nn(y) || !vt(y)) continue;
2643
- const z = Yn(y), B = y instanceof HTMLInputElement ? y.type : y.tagName.toLowerCase();
2647
+ for (const v of y) {
2648
+ if (C.length >= Vi) break;
2649
+ if (vt(v) || !nn(v) || !bt(v)) continue;
2650
+ const z = Gn(v), B = v instanceof HTMLInputElement ? v.type : v.tagName.toLowerCase();
2644
2651
  z && C.push({ label: ce(z, 100), type: B });
2645
2652
  }
2646
- const w = Array.from(n.querySelectorAll("form")), D = [];
2653
+ const w = Array.from(n.querySelectorAll("form")), P = [];
2647
2654
  let E = 0;
2648
- for (const y of w) {
2649
- if (D.length >= Yi) break;
2650
- if (Ft(y) || y.matches(".ll-widget *, .ll-widget")) continue;
2651
- const z = y.getAttribute("id") || y.getAttribute("name") || Ji(y.getAttribute("data-ll-intent")) || `form_${E++}`, B = y.getAttribute("data-ll-intent") || Zi(y) || void 0, J = Array.from(
2652
- y.querySelectorAll(
2655
+ for (const v of w) {
2656
+ if (P.length >= Gi) break;
2657
+ if (Wt(v) || v.matches(".ll-widget *, .ll-widget")) continue;
2658
+ const z = v.getAttribute("id") || v.getAttribute("name") || Zi(v.getAttribute("data-ll-intent")) || `form_${E++}`, B = v.getAttribute("data-ll-intent") || Qi(v) || void 0, J = Array.from(
2659
+ v.querySelectorAll(
2653
2660
  "input, textarea, select"
2654
2661
  )
2655
- ), ae = [];
2662
+ ), le = [];
2656
2663
  let H = 0;
2657
2664
  const G = /* @__PURE__ */ new Set();
2658
2665
  for (const f of J) {
2659
- if (ae.length >= Gi) break;
2666
+ if (le.length >= Xi) break;
2660
2667
  if (!nn(f)) continue;
2661
2668
  if (f instanceof HTMLInputElement) {
2662
2669
  const U = f.type;
@@ -2665,14 +2672,14 @@ function Qi(e, t = {}) {
2665
2672
  const A = f.getAttribute("name") || "", $ = f.getAttribute("id") || "";
2666
2673
  let q = A || $ || `field_${H}`;
2667
2674
  G.has(q) && (q = `${q}__${H}`), G.add(q), H++;
2668
- const X = Yn(f) || q, ee = f instanceof HTMLInputElement ? f.type : f.tagName.toLowerCase(), W = {
2675
+ const X = Gn(f) || q, te = f instanceof HTMLInputElement ? f.type : f.tagName.toLowerCase(), W = {
2669
2676
  name: q,
2670
2677
  label: ce(X, 100),
2671
- type: ee
2678
+ type: te
2672
2679
  };
2673
2680
  f.required === !0 && (W.required = !0);
2674
- const te = f.getAttribute("placeholder");
2675
- if (te && (W.placeholder = ce(te.trim(), 100)), f instanceof HTMLInputElement || f instanceof HTMLTextAreaElement) {
2681
+ const ne = f.getAttribute("placeholder");
2682
+ if (ne && (W.placeholder = ce(ne.trim(), 100)), f instanceof HTMLInputElement || f instanceof HTMLTextAreaElement) {
2676
2683
  const U = f.getAttribute("minlength");
2677
2684
  if (U !== null) {
2678
2685
  const Z = parseInt(U, 10);
@@ -2693,8 +2700,8 @@ function Qi(e, t = {}) {
2693
2700
  Z !== null && (W.step = ce(Z, 20));
2694
2701
  const Le = f.getAttribute("pattern");
2695
2702
  Le !== null && (W.pattern = ce(Le, 200));
2696
- const ne = (f.getAttribute("autocomplete") || "").toLowerCase();
2697
- ne && ne !== "off" && !ne.startsWith("cc-") && (W.autocomplete = ce(ne, 50));
2703
+ const re = (f.getAttribute("autocomplete") || "").toLowerCase();
2704
+ re && re !== "off" && !re.startsWith("cc-") && (W.autocomplete = ce(re, 50));
2698
2705
  }
2699
2706
  if (f instanceof HTMLSelectElement) {
2700
2707
  const U = [];
@@ -2702,59 +2709,59 @@ function Qi(e, t = {}) {
2702
2709
  const Z = f.options[ge];
2703
2710
  if (!Z) continue;
2704
2711
  if (Z.value === "" || Z.disabled) {
2705
- const Te = (Z.textContent || "").trim();
2706
- if (Te && !W.placeholderOption && (W.placeholderOption = ce(Te, 60)), W.hasEmptyOption = !0, Z.disabled) continue;
2712
+ const Me = (Z.textContent || "").trim();
2713
+ if (Me && !W.placeholderOption && (W.placeholderOption = ce(Me, 60)), W.hasEmptyOption = !0, Z.disabled) continue;
2707
2714
  }
2708
- if (U.length >= Xi) break;
2709
- const Le = Z.value || "", ne = (Z.textContent || "").trim() || Le;
2710
- !Le && !ne || U.push({ value: Le, label: ce(ne, 60) });
2715
+ if (U.length >= Ki) break;
2716
+ const Le = Z.value || "", re = (Z.textContent || "").trim() || Le;
2717
+ !Le && !re || U.push({ value: Le, label: ce(re, 60) });
2711
2718
  }
2712
2719
  U.length > 0 && (W.options = U);
2713
2720
  }
2714
- const oe = typeof f.validationMessage == "string" ? f.validationMessage : "";
2715
- oe && (W.validationMessage = ce(oe, 200)), ae.push(W);
2721
+ const ie = typeof f.validationMessage == "string" ? f.validationMessage : "";
2722
+ ie && (W.validationMessage = ce(ie, 200)), le.push(W);
2716
2723
  }
2717
- D.push({ id: z, intent: B, fields: ae });
2724
+ P.push({ id: z, intent: B, fields: le });
2718
2725
  }
2719
- const v = {
2726
+ const b = {
2720
2727
  url: i,
2721
2728
  title: o,
2722
2729
  pathname: l,
2723
2730
  regions: a,
2724
- visibleText: h,
2725
- visibleLinks: P,
2731
+ visibleText: m,
2732
+ visibleLinks: D,
2726
2733
  visibleFields: C,
2727
- forms: D,
2728
- flow: cr(n),
2734
+ forms: P,
2735
+ flow: ur(n),
2729
2736
  extras: e
2730
2737
  };
2731
- let O = rt(JSON.stringify(v.regions)) + rt(v.visibleText) + rt(JSON.stringify(v.visibleLinks)) + rt(JSON.stringify(v.visibleFields));
2732
- for (; O > Ht && v.visibleFields.length > 0; )
2733
- v.visibleFields.pop(), O = rt(JSON.stringify(v.visibleFields));
2734
- for (; O > Ht && v.visibleLinks.length > 0; )
2735
- v.visibleLinks.pop(), O -= 80;
2736
- return rt(v.visibleText) > Ht && (v.visibleText = ce(v.visibleText, Ht - 100)), v;
2738
+ let O = rt(JSON.stringify(b.regions)) + rt(b.visibleText) + rt(JSON.stringify(b.visibleLinks)) + rt(JSON.stringify(b.visibleFields));
2739
+ for (; O > Ft && b.visibleFields.length > 0; )
2740
+ b.visibleFields.pop(), O = rt(JSON.stringify(b.visibleFields));
2741
+ for (; O > Ft && b.visibleLinks.length > 0; )
2742
+ b.visibleLinks.pop(), O -= 80;
2743
+ return rt(b.visibleText) > Ft && (b.visibleText = ce(b.visibleText, Ft - 100)), b;
2737
2744
  }
2738
2745
  let ot = null;
2739
- function eo(e) {
2746
+ function to(e) {
2740
2747
  const t = e.querySelectorAll("form");
2741
2748
  let n = `f${t.length}`;
2742
2749
  return t.forEach((i) => {
2743
2750
  n += `|${i.id || i.getAttribute("name") || ""}:${i.querySelectorAll("input,select,textarea").length}`;
2744
2751
  }), n;
2745
2752
  }
2746
- function Gn(e, t = {}) {
2747
- const n = Date.now(), i = t.doc ?? (typeof document < "u" ? document : null), l = typeof window < "u" && window.location.pathname || "/", o = typeof window < "u" ? window.scrollY : 0, s = `${l}::${o}::${i ? eo(i) : ""}`;
2753
+ function Xn(e, t = {}) {
2754
+ const n = Date.now(), i = t.doc ?? (typeof document < "u" ? document : null), l = typeof window < "u" && window.location.pathname || "/", o = typeof window < "u" ? window.scrollY : 0, s = `${l}::${o}::${i ? to(i) : ""}`;
2748
2755
  if (ot && ot.key === s && n - ot.at < 1e3)
2749
2756
  return ot.ctx;
2750
- const a = Qi(e, t);
2757
+ const a = eo(e, t);
2751
2758
  return ot = { key: s, at: n, ctx: a }, a;
2752
2759
  }
2753
- function to() {
2760
+ function no() {
2754
2761
  ot = null;
2755
2762
  }
2756
- const no = 200;
2757
- function ro(e) {
2763
+ const ro = 200;
2764
+ function io(e) {
2758
2765
  const t = String(e.href || "");
2759
2766
  return {
2760
2767
  href: t,
@@ -2764,44 +2771,44 @@ function ro(e) {
2764
2771
  description: e.description
2765
2772
  };
2766
2773
  }
2767
- function io(e) {
2774
+ function oo(e) {
2768
2775
  return !(!e || e.startsWith("#") || e.startsWith("javascript:") || e.startsWith("mailto:") || e.startsWith("tel:"));
2769
2776
  }
2770
- function oo(e) {
2777
+ function lo(e) {
2771
2778
  const t = e ?? (typeof document < "u" ? document : null);
2772
2779
  if (!t) return [];
2773
2780
  const n = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), l = [], o = Array.from(t.querySelectorAll("a[href]"));
2774
2781
  for (const s of o) {
2775
- if (l.length >= no) break;
2776
- if (Ft(s)) continue;
2782
+ if (l.length >= ro) break;
2783
+ if (Wt(s)) continue;
2777
2784
  const a = s.getAttribute("href") || "";
2778
- if (!io(a)) continue;
2779
- let c = a, u = !0;
2785
+ if (!oo(a)) continue;
2786
+ let c = a, d = !0;
2780
2787
  try {
2781
2788
  if (typeof window < "u") {
2782
2789
  const p = new URL(a, n);
2783
- u = p.origin === n, u && a.startsWith("http") && (c = p.pathname + p.search + p.hash);
2790
+ d = p.origin === n, d && a.startsWith("http") && (c = p.pathname + p.search + p.hash);
2784
2791
  }
2785
2792
  } catch {
2786
2793
  continue;
2787
2794
  }
2788
2795
  if (i.has(c)) continue;
2789
2796
  i.add(c);
2790
- const m = (s.textContent || "").trim().slice(0, 120);
2791
- l.push({ href: c, text: m, internal: u });
2797
+ const g = (s.textContent || "").trim().slice(0, 120);
2798
+ l.push({ href: c, text: g, internal: d });
2792
2799
  }
2793
2800
  return l;
2794
2801
  }
2795
2802
  let lt = null;
2796
- const lo = 5e3;
2803
+ const ao = 5e3;
2797
2804
  function Qt() {
2798
2805
  const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
2799
- if (lt && lt.pathname === t && e - lt.at < lo)
2806
+ if (lt && lt.pathname === t && e - lt.at < ao)
2800
2807
  return lt.routes;
2801
- const n = oo();
2808
+ const n = lo();
2802
2809
  return lt = { at: e, pathname: t, routes: n }, n;
2803
2810
  }
2804
- function ao() {
2811
+ function so() {
2805
2812
  lt = null;
2806
2813
  }
2807
2814
  function rn(e) {
@@ -2812,7 +2819,7 @@ function rn(e) {
2812
2819
  }
2813
2820
  return !0;
2814
2821
  }
2815
- function so(e, t) {
2822
+ function co(e, t) {
2816
2823
  return e.getAttribute("name") || e.getAttribute("id") || `field_${t}`;
2817
2824
  }
2818
2825
  function ze(e) {
@@ -2822,7 +2829,7 @@ function en(e) {
2822
2829
  const t = e.lastIndexOf(".");
2823
2830
  return t >= 0 ? e.slice(t + 1) : e;
2824
2831
  }
2825
- function co(e) {
2832
+ function uo(e) {
2826
2833
  var i;
2827
2834
  const t = e.getAttribute("id");
2828
2835
  if (t)
@@ -2836,7 +2843,7 @@ function co(e) {
2836
2843
  const n = e.closest("label");
2837
2844
  return n != null && n.textContent ? n.textContent : e.getAttribute("aria-label") || e.getAttribute("placeholder") || "";
2838
2845
  }
2839
- function uo(e, t) {
2846
+ function fo(e, t) {
2840
2847
  const n = ze(t);
2841
2848
  if (n.length < 2) return null;
2842
2849
  let i = null, l = 0;
@@ -2850,16 +2857,16 @@ function uo(e, t) {
2850
2857
  ze(s),
2851
2858
  ze(a)
2852
2859
  ];
2853
- let u = 0;
2854
- c.some((m) => m.length >= 2 && m === n) ? u = 4 : [
2860
+ let d = 0;
2861
+ c.some((g) => g.length >= 2 && g === n) ? d = 4 : [
2855
2862
  ze(s),
2856
2863
  ze(en(s)),
2857
- ze(co(o))
2858
- ].some((p) => p.length >= 3 && (p.includes(n) || n.includes(p))) && (u = 2), u > l && (l = u, i = o);
2864
+ ze(uo(o))
2865
+ ].some((p) => p.length >= 3 && (p.includes(n) || n.includes(p))) && (d = 2), d > l && (l = d, i = o);
2859
2866
  }
2860
2867
  return l >= 2 ? i : null;
2861
2868
  }
2862
- function fo(e, t) {
2869
+ function po(e, t) {
2863
2870
  if (!t) return null;
2864
2871
  try {
2865
2872
  const o = e.querySelector(
@@ -2875,22 +2882,22 @@ function fo(e, t) {
2875
2882
  const l = /* @__PURE__ */ new Map();
2876
2883
  for (const o of n) {
2877
2884
  if (!rn(o)) continue;
2878
- const s = so(o, i);
2885
+ const s = co(o, i);
2879
2886
  let a = s;
2880
2887
  if (l.has(s) && (a = `${s}__${i}`), a === t) return o;
2881
2888
  l.set(s, o), i++;
2882
2889
  }
2883
- return uo(e, t);
2890
+ return fo(e, t);
2884
2891
  }
2885
- function Xn(e, t) {
2886
- const n = fo(e, t);
2892
+ function Kn(e, t) {
2893
+ const n = po(e, t);
2887
2894
  return n ? nn(n) ? { el: n } : { el: null, reason: "private" } : { el: null, reason: "not_found" };
2888
2895
  }
2889
- function po(e, t) {
2896
+ function ho(e, t) {
2890
2897
  const n = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, i = Object.getOwnPropertyDescriptor(n, "value"), l = i == null ? void 0 : i.set;
2891
2898
  l ? l.call(e, t) : e.value = t;
2892
2899
  }
2893
- function ho(e, t, n = {}) {
2900
+ function mo(e, t, n = {}) {
2894
2901
  const i = n.triggerInput ?? !0, l = n.triggerChange ?? !0;
2895
2902
  if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
2896
2903
  const o = Object.getOwnPropertyDescriptor(
@@ -2900,9 +2907,9 @@ function ho(e, t, n = {}) {
2900
2907
  s ? s.call(e, a) : e.checked = a, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), l && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2901
2908
  return;
2902
2909
  }
2903
- po(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), l && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2910
+ ho(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), l && e.dispatchEvent(new Event("change", { bubbles: !0 }));
2904
2911
  }
2905
- function Kn(e, t) {
2912
+ function Jn(e, t) {
2906
2913
  if (!t) return null;
2907
2914
  const n = t.replace(/"/g, '\\"'), i = (a) => a.closest('[data-ll-private="true"], [data-ll-skip], .ll-widget') !== null;
2908
2915
  try {
@@ -2925,23 +2932,23 @@ function Kn(e, t) {
2925
2932
  ).filter((a) => !i(a));
2926
2933
  for (const a of s) {
2927
2934
  const c = a.getAttribute("data-ll-intent");
2928
- if (c && mo(c) === t) return a;
2935
+ if (c && go(c) === t) return a;
2929
2936
  }
2930
2937
  if (/^form_\d+$/.test(t)) {
2931
2938
  const a = parseInt(t.slice(5), 10);
2932
2939
  let c = 0;
2933
- for (const u of s)
2934
- if (!(u.id || u.getAttribute("name") || u.getAttribute("data-ll-intent"))) {
2935
- if (c === a) return u;
2940
+ for (const d of s)
2941
+ if (!(d.id || d.getAttribute("name") || d.getAttribute("data-ll-intent"))) {
2942
+ if (c === a) return d;
2936
2943
  c++;
2937
2944
  }
2938
2945
  }
2939
2946
  return s.length === 1 ? s[0] : null;
2940
2947
  }
2941
- function mo(e) {
2948
+ function go(e) {
2942
2949
  return e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || null;
2943
2950
  }
2944
- function go() {
2951
+ function yo() {
2945
2952
  if (typeof window > "u" || typeof document > "u")
2946
2953
  return !1;
2947
2954
  const e = document.scrollingElement || document.documentElement;
@@ -2949,19 +2956,19 @@ function go() {
2949
2956
  const t = window.getComputedStyle(e);
2950
2957
  return !(t.overflowY === "hidden" || t.overflowY === "clip");
2951
2958
  }
2952
- function yo(e) {
2959
+ function vo(e) {
2953
2960
  if (!(e instanceof HTMLElement)) return !1;
2954
2961
  const n = window.getComputedStyle(e).overflowY;
2955
2962
  return !(n !== "auto" && n !== "scroll" || e.scrollHeight <= e.clientHeight + 2);
2956
2963
  }
2957
- function vo() {
2964
+ function bo() {
2958
2965
  if (typeof document > "u") return null;
2959
2966
  const e = Array.from(
2960
2967
  document.querySelectorAll("body, body *")
2961
2968
  );
2962
2969
  let t = null, n = 0;
2963
2970
  for (const i of e) {
2964
- if (!yo(i)) continue;
2971
+ if (!vo(i)) continue;
2965
2972
  const l = i.getBoundingClientRect();
2966
2973
  if (l.bottom <= 0 || l.top >= window.innerHeight || l.right <= 0 || l.left >= window.innerWidth || l.width <= 0 || l.height <= 0 || i.closest(".ll-widget")) continue;
2967
2974
  const o = l.width * l.height;
@@ -2969,24 +2976,24 @@ function vo() {
2969
2976
  }
2970
2977
  return t;
2971
2978
  }
2972
- function bo() {
2979
+ function wo() {
2973
2980
  if (typeof window > "u")
2974
2981
  return null;
2975
- if (go()) return window;
2976
- const e = vo();
2982
+ if (yo()) return window;
2983
+ const e = bo();
2977
2984
  return e || window;
2978
2985
  }
2979
- function Jn(e) {
2986
+ function Zn(e) {
2980
2987
  return e instanceof Window ? e.innerHeight || 0 : e.clientHeight || 0;
2981
2988
  }
2982
- function wo(e) {
2989
+ function _o(e) {
2983
2990
  var t, n;
2984
2991
  return e instanceof Window ? typeof document > "u" ? 0 : Math.max(
2985
2992
  ((t = document.body) == null ? void 0 : t.scrollHeight) ?? 0,
2986
2993
  ((n = document.documentElement) == null ? void 0 : n.scrollHeight) ?? 0
2987
2994
  ) : e.scrollHeight - e.clientHeight;
2988
2995
  }
2989
- const _o = /* @__PURE__ */ new Set([
2996
+ const xo = /* @__PURE__ */ new Set([
2990
2997
  "agent_state",
2991
2998
  "avatar_stream_ready",
2992
2999
  "avatar_active",
@@ -3021,9 +3028,9 @@ const _o = /* @__PURE__ */ new Set([
3021
3028
  // to onAgentCommand.
3022
3029
  "task_field_updated",
3023
3030
  "task_completed"
3024
- ]), dr = on(
3031
+ ]), fr = on(
3025
3032
  function(t, n) {
3026
- var vn, bn, wn, _n, xn, Ln, kn;
3033
+ var bn, wn, _n, xn, kn, Ln, Cn;
3027
3034
  const {
3028
3035
  agentId: i,
3029
3036
  apiKey: l,
@@ -3031,8 +3038,8 @@ const _o = /* @__PURE__ */ new Set([
3031
3038
  sessionEndpoint: s,
3032
3039
  sessionBody: a,
3033
3040
  soundEffects: c,
3034
- experienceMode: u = "WIDGET",
3035
- autoConnect: m = !1,
3041
+ experienceMode: d = "WIDGET",
3042
+ autoConnect: g = !1,
3036
3043
  displayMode: p,
3037
3044
  // Initial display mode. Mobile gets a smaller card layout (not the
3038
3045
  // full-screen sheet) so "expanded" is the right default on every
@@ -3041,21 +3048,21 @@ const _o = /* @__PURE__ */ new Set([
3041
3048
  // expanded widget but card-sized, not the bottom bar that
3042
3049
  // minimized produced). The card sizing now lives in CSS — see
3043
3050
  // .ll-expanded--mobile in styles.css.
3044
- defaultDisplayMode: h = "expanded",
3045
- onDisplayModeChange: P,
3046
- position: _ = "bottom-right",
3051
+ defaultDisplayMode: m = "expanded",
3052
+ onDisplayModeChange: D,
3053
+ position: x = "bottom-right",
3047
3054
  mobileBreakpoint: C = 640,
3048
- draggable: g,
3055
+ draggable: y,
3049
3056
  resizable: w,
3050
- persistKey: D = "ll-widget",
3057
+ persistKey: P = "ll-widget",
3051
3058
  disablePersistence: E = !1,
3052
- teamMembers: v,
3059
+ teamMembers: b,
3053
3060
  currentTeamMemberId: O,
3054
- onTeamMemberChange: y,
3061
+ onTeamMemberChange: v,
3055
3062
  idleLoopUrl: z,
3056
3063
  greeting: B,
3057
3064
  avatarImageUrl: J,
3058
- agentName: ae,
3065
+ agentName: le,
3059
3066
  branding: H = {},
3060
3067
  allowCamera: G = !0,
3061
3068
  allowScreenShare: f = !0,
@@ -3063,21 +3070,21 @@ const _o = /* @__PURE__ */ new Set([
3063
3070
  blurUntilFirstSpeech: $ = !0,
3064
3071
  showMinimize: q,
3065
3072
  showClose: X,
3066
- chromeless: ee = !1,
3073
+ chromeless: te = !1,
3067
3074
  floatingChromeContainer: W = null,
3068
- compactControls: te = !1,
3069
- transforming: oe = !1,
3075
+ compactControls: ne = !1,
3076
+ transforming: ie = !1,
3070
3077
  transformingLabel: U = "Transforming…",
3071
3078
  showOn: ge,
3072
3079
  hideOn: Z,
3073
3080
  pathname: Le,
3074
- onNavigate: ne,
3075
- onScrollToSelector: Te,
3081
+ onNavigate: re,
3082
+ onScrollToSelector: Me,
3076
3083
  getPageContext: st,
3077
- pageContextExtras: wt,
3078
- getRoutes: _t,
3084
+ pageContextExtras: _t,
3085
+ getRoutes: xt,
3079
3086
  onScrollPage: ct,
3080
- onClick: xt,
3087
+ onClick: kt,
3081
3088
  capabilities: Ye,
3082
3089
  onConnect: Ge,
3083
3090
  onDisconnect: $e,
@@ -3090,103 +3097,103 @@ const _o = /* @__PURE__ */ new Set([
3090
3097
  controlledSession: F,
3091
3098
  className: qe,
3092
3099
  style: Ke,
3093
- zIndex: ke = 2147483647
3094
- } = t, Lt = ri(Le), ut = ui(Lt, ge, Z);
3100
+ zIndex: Ce = 2147483647
3101
+ } = t, Lt = ii(Le), ut = di(Lt, ge, Z);
3095
3102
  I(() => {
3096
- to(), ao();
3103
+ no(), so();
3097
3104
  }, [Lt]);
3098
- const Re = O !== void 0, [Bt, kt] = M(() => {
3099
- var b;
3100
- return O ?? ((b = v == null ? void 0 : v[0]) == null ? void 0 : b.id);
3101
- }), Me = Re ? O : Bt, de = at(
3102
- () => (v == null ? void 0 : v.find((b) => b.id === Me)) ?? null,
3103
- [v, Me]
3104
- ), dt = (de == null ? void 0 : de.agentId) ?? i, fe = u === "EMBEDDED", ve = Xr(C), [Ct, Je] = Yr({
3105
+ const Ie = O !== void 0, [dt, Ct] = M(() => {
3106
+ var h;
3107
+ return O ?? ((h = b == null ? void 0 : b[0]) == null ? void 0 : h.id);
3108
+ }), Ue = Ie ? O : dt, ue = at(
3109
+ () => (b == null ? void 0 : b.find((h) => h.id === Ue)) ?? null,
3110
+ [b, Ue]
3111
+ ), St = (ue == null ? void 0 : ue.agentId) ?? i, de = d === "EMBEDDED", ve = Kr(C), [Je, Ze] = Gr({
3105
3112
  value: p,
3106
- defaultValue: h,
3107
- onChange: P,
3108
- persistKey: D,
3109
- disablePersistence: fe || E
3110
- }), pe = fe ? "expanded" : Ct, be = fe ? () => {
3111
- } : Je, Ze = q ?? !fe, St = X ?? !fe, Et = te || !fe && ve, De = ti({
3112
- draggable: !fe && (g ?? !ve),
3113
- resizable: !fe && (w ?? !ve),
3114
- persistKey: D,
3115
- disablePersistence: fe || E
3116
- }), Ce = Pr(), Se = Or(), Ue = Fr(), Qe = Br(), [qt, Ee] = M(!1), [Ae, ft] = M(!1), [et, pt] = M(!1), [At, x] = M(!1), [re, fr] = M(!1), Nt = fi({ baseUrl: o, config: c }), Mt = T(Nt);
3117
- Mt.current = Nt;
3118
- const Ut = T(ne), jt = T(Te), Vt = T(ct), Yt = T(xt), sn = T(st), cn = T(wt), un = T(_t), Gt = T(Ye), Ne = T(null);
3119
- Ut.current = ne, jt.current = Te, Vt.current = ct, Yt.current = xt, sn.current = st, cn.current = wt, un.current = _t, Gt.current = Ye;
3120
- function _e(b) {
3121
- const d = Gt.current;
3122
- return d ? d.includes(b) : !0;
3113
+ defaultValue: m,
3114
+ onChange: D,
3115
+ persistKey: P,
3116
+ disablePersistence: de || E
3117
+ }), pe = de ? "expanded" : Je, be = de ? () => {
3118
+ } : Ze, Et = q ?? !de, At = X ?? !de, Nt = ne || !de && ve, _e = ni({
3119
+ draggable: !de && (y ?? !ve),
3120
+ resizable: !de && (w ?? !ve),
3121
+ persistKey: P,
3122
+ disablePersistence: de || E
3123
+ }), Re = zr(), Ae = Fr(), Te = Br(), ft = Wr(), [Pe, Se] = M(!1), [Qe, pt] = M(!1), [ht, et] = M(!1), [k, ae] = M(!1), [qt, pr] = M(!1), Mt = pi({ baseUrl: o, config: c }), It = R(Mt);
3124
+ It.current = Mt;
3125
+ const Ut = R(re), jt = R(Me), Vt = R(ct), Yt = R(kt), cn = R(st), un = R(_t), dn = R(xt), Gt = R(Ye), Ee = R(null);
3126
+ Ut.current = re, jt.current = Me, Vt.current = ct, Yt.current = kt, cn.current = st, un.current = _t, dn.current = xt, Gt.current = Ye;
3127
+ function xe(h) {
3128
+ const u = Gt.current;
3129
+ return u ? u.includes(h) : !0;
3123
3130
  }
3124
- function xe(b, d) {
3131
+ function ke(h, u) {
3125
3132
  console.warn(
3126
- `[LiveLayer] Agent command "${b}" blocked — capability "${d}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
3133
+ `[LiveLayer] Agent command "${h}" blocked — capability "${u}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
3127
3134
  );
3128
3135
  }
3129
- const ht = k(
3130
- (b) => {
3131
- var ie, ue, Ie, gt, Pe, Cn;
3132
- const d = b;
3133
- if (!(!d.type || typeof d.type != "string")) {
3134
- if (Be == null || Be({ eventName: d.type, data: b }), d.type === "navigate") {
3135
- if (!_e("navigate")) {
3136
- xe("navigate", "navigate");
3136
+ const mt = L(
3137
+ (h) => {
3138
+ var Q, fe, Ne, yt, De, Sn;
3139
+ const u = h;
3140
+ if (!(!u.type || typeof u.type != "string")) {
3141
+ if (Be == null || Be({ eventName: u.type, data: h }), u.type === "navigate") {
3142
+ if (!xe("navigate")) {
3143
+ ke("navigate", "navigate");
3137
3144
  return;
3138
3145
  }
3139
- const N = typeof d.href == "string" ? d.href : null;
3146
+ const N = typeof u.href == "string" ? u.href : null;
3140
3147
  if (!N) {
3141
3148
  console.warn(
3142
3149
  `[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
3143
3150
  );
3144
3151
  return;
3145
3152
  }
3146
- if (Mt.current.playPageChange(), Ut.current) {
3153
+ if (It.current.playPageChange(), Ut.current) {
3147
3154
  try {
3148
3155
  Ut.current(N);
3149
- } catch (R) {
3156
+ } catch (T) {
3150
3157
  console.warn(
3151
3158
  `[LiveLayer] onNavigate threw for "${N}". Falling back. Error:`,
3152
- R
3159
+ T
3153
3160
  );
3154
3161
  }
3155
3162
  return;
3156
3163
  }
3157
3164
  if (typeof document < "u") {
3158
- const R = document.querySelector(
3165
+ const T = document.querySelector(
3159
3166
  `a[href="${N.replace(/"/g, '\\"')}"]`
3160
3167
  );
3161
- if (R) {
3162
- R.click();
3168
+ if (T) {
3169
+ T.click();
3163
3170
  return;
3164
3171
  }
3165
3172
  }
3166
3173
  if (typeof window < "u" && typeof history < "u")
3167
3174
  try {
3168
3175
  history.pushState({}, "", N), window.dispatchEvent(new PopStateEvent("popstate"));
3169
- } catch (R) {
3176
+ } catch (T) {
3170
3177
  console.warn(
3171
3178
  `[LiveLayer] history.pushState fallback failed for "${N}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
3172
- R
3179
+ T
3173
3180
  );
3174
3181
  }
3175
3182
  return;
3176
3183
  }
3177
- if (d.type === "scroll_to") {
3178
- if (!_e("scroll")) {
3179
- xe("scroll_to", "scroll");
3184
+ if (u.type === "scroll_to") {
3185
+ if (!xe("scroll")) {
3186
+ ke("scroll_to", "scroll");
3180
3187
  return;
3181
3188
  }
3182
- const N = typeof d.selector == "string" ? d.selector : null;
3189
+ const N = typeof u.selector == "string" ? u.selector : null;
3183
3190
  if (!N) return;
3184
- const R = d.behavior === "instant" ? "instant" : "smooth";
3191
+ const T = u.behavior === "instant" ? "instant" : "smooth";
3185
3192
  if (jt.current) {
3186
3193
  try {
3187
3194
  jt.current(
3188
3195
  N,
3189
- R
3196
+ T
3190
3197
  );
3191
3198
  } catch (Y) {
3192
3199
  console.warn("[LiveLayer] onScrollToSelector threw.", Y);
@@ -3210,53 +3217,53 @@ const _o = /* @__PURE__ */ new Set([
3210
3217
  return;
3211
3218
  }
3212
3219
  Y.scrollIntoView({
3213
- behavior: R,
3220
+ behavior: T,
3214
3221
  block: "start"
3215
3222
  });
3216
3223
  }
3217
3224
  return;
3218
3225
  }
3219
- if (d.type === "request_page_context") {
3220
- if (!_e("read_page")) {
3221
- xe("request_page_context", "read_page");
3226
+ if (u.type === "request_page_context") {
3227
+ if (!xe("read_page")) {
3228
+ ke("request_page_context", "read_page");
3222
3229
  return;
3223
3230
  }
3224
- const N = typeof d.requestId == "string" ? d.requestId : void 0, R = (ie = Ne.current) == null ? void 0 : ie.call(Ne), Y = (Q) => {
3225
- const V = R, he = V == null ? void 0 : V.localParticipant;
3231
+ const N = typeof u.requestId == "string" ? u.requestId : void 0, T = (Q = Ee.current) == null ? void 0 : Q.call(Ee), Y = (ee) => {
3232
+ const V = T, he = V == null ? void 0 : V.localParticipant;
3226
3233
  if (he != null && he.publishData)
3227
3234
  try {
3228
- const me = N ? { ...Q, requestId: N } : Q, le = new TextEncoder().encode(JSON.stringify(me));
3229
- he.publishData(le, { reliable: !0 });
3235
+ const me = N ? { ...ee, requestId: N } : ee, oe = new TextEncoder().encode(JSON.stringify(me));
3236
+ he.publishData(oe, { reliable: !0 });
3230
3237
  } catch (me) {
3231
3238
  console.warn("[LiveLayer] publishData failed.", me);
3232
3239
  }
3233
- }, j = cn.current, K = sn.current;
3240
+ }, j = un.current, K = cn.current;
3234
3241
  try {
3235
3242
  if (K) {
3236
- const Q = K(j);
3237
- if (Q instanceof Promise) {
3238
- Y({ type: "page_context_pending" }), Q.then((V) => Y({ type: "page_context", context: V })).catch((V) => {
3243
+ const ee = K(j);
3244
+ if (ee instanceof Promise) {
3245
+ Y({ type: "page_context_pending" }), ee.then((V) => Y({ type: "page_context", context: V })).catch((V) => {
3239
3246
  console.warn(
3240
3247
  "[LiveLayer] getPageContext rejected; falling back to default walker.",
3241
3248
  V
3242
3249
  ), Y({
3243
3250
  type: "page_context",
3244
- context: Gn(j)
3251
+ context: Xn(j)
3245
3252
  });
3246
3253
  });
3247
3254
  return;
3248
3255
  }
3249
- Y({ type: "page_context", context: Q });
3256
+ Y({ type: "page_context", context: ee });
3250
3257
  return;
3251
3258
  }
3252
3259
  Y({
3253
3260
  type: "page_context",
3254
- context: Gn(j)
3261
+ context: Xn(j)
3255
3262
  });
3256
- } catch (Q) {
3263
+ } catch (ee) {
3257
3264
  console.warn(
3258
3265
  "[LiveLayer] page-context extraction threw. Sending empty context.",
3259
- Q
3266
+ ee
3260
3267
  ), Y({
3261
3268
  type: "page_context",
3262
3269
  context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: j }
@@ -3264,24 +3271,24 @@ const _o = /* @__PURE__ */ new Set([
3264
3271
  }
3265
3272
  return;
3266
3273
  }
3267
- if (d.type === "scroll_page") {
3268
- if (!_e("scroll")) {
3269
- xe("scroll_page", "scroll");
3274
+ if (u.type === "scroll_page") {
3275
+ if (!xe("scroll")) {
3276
+ ke("scroll_page", "scroll");
3270
3277
  return;
3271
3278
  }
3272
- const N = d.direction;
3279
+ const N = u.direction;
3273
3280
  if (N !== "up" && N !== "down" && N !== "top" && N !== "bottom") {
3274
3281
  console.warn(
3275
3282
  `[LiveLayer] scroll_page: invalid direction "${String(N)}". Expected up | down | top | bottom.`
3276
3283
  );
3277
3284
  return;
3278
3285
  }
3279
- const R = d.behavior === "instant" ? "instant" : "smooth";
3286
+ const T = u.behavior === "instant" ? "instant" : "smooth";
3280
3287
  if (Vt.current) {
3281
3288
  try {
3282
3289
  Vt.current(
3283
3290
  N,
3284
- R
3291
+ T
3285
3292
  );
3286
3293
  } catch (V) {
3287
3294
  console.warn("[LiveLayer] onScrollPage threw.", V);
@@ -3289,20 +3296,20 @@ const _o = /* @__PURE__ */ new Set([
3289
3296
  return;
3290
3297
  }
3291
3298
  if (typeof window > "u") return;
3292
- const Y = { behavior: R }, j = bo(), K = (V) => {
3299
+ const Y = { behavior: T }, j = wo(), K = (V) => {
3293
3300
  j instanceof Window ? j.scrollBy({ top: V, ...Y }) : j.scrollBy({ top: V, ...Y });
3294
- }, Q = (V) => {
3301
+ }, ee = (V) => {
3295
3302
  j instanceof Window ? j.scrollTo({ top: V, ...Y }) : j.scrollTo({ top: V, ...Y });
3296
3303
  };
3297
- N === "up" ? K(-Jn(j)) : N === "down" ? K(Jn(j)) : Q(N === "top" ? 0 : wo(j));
3304
+ N === "up" ? K(-Zn(j)) : N === "down" ? K(Zn(j)) : ee(N === "top" ? 0 : _o(j));
3298
3305
  return;
3299
3306
  }
3300
- if (d.type === "click") {
3301
- if (!_e("click")) {
3302
- xe("click", "click");
3307
+ if (u.type === "click") {
3308
+ if (!xe("click")) {
3309
+ ke("click", "click");
3303
3310
  return;
3304
3311
  }
3305
- const N = typeof d.selector == "string" ? d.selector : null;
3312
+ const N = typeof u.selector == "string" ? u.selector : null;
3306
3313
  if (!N) {
3307
3314
  console.warn("[LiveLayer] click: missing selector.");
3308
3315
  return;
@@ -3316,77 +3323,77 @@ const _o = /* @__PURE__ */ new Set([
3316
3323
  return;
3317
3324
  }
3318
3325
  if (typeof document > "u") return;
3319
- let R = null;
3326
+ let T = null;
3320
3327
  try {
3321
- R = document.querySelector(N);
3328
+ T = document.querySelector(N);
3322
3329
  } catch {
3323
3330
  console.warn(
3324
3331
  `[LiveLayer] click: invalid selector "${N}".`
3325
3332
  );
3326
3333
  return;
3327
3334
  }
3328
- if (!R) {
3335
+ if (!T) {
3329
3336
  console.warn(
3330
3337
  `[LiveLayer] click: no element matched "${N}". See https://livelayer.studio/docs/errors/click-no-match`
3331
3338
  );
3332
3339
  return;
3333
3340
  }
3334
- if (R.closest('[data-ll-private="true"], .ll-widget')) {
3341
+ if (T.closest('[data-ll-private="true"], .ll-widget')) {
3335
3342
  console.warn(
3336
3343
  "[LiveLayer] click: refusing to click element inside a private subtree."
3337
3344
  );
3338
3345
  return;
3339
3346
  }
3340
- (ue = R.click) == null || ue.call(R);
3347
+ (fe = T.click) == null || fe.call(T);
3341
3348
  return;
3342
3349
  }
3343
- if (d.type === "advance_step" || d.type === "go_back" || d.type === "submit_flow") {
3344
- if (!_e("click")) {
3345
- xe(d.type, "click");
3350
+ if (u.type === "advance_step" || u.type === "go_back" || u.type === "submit_flow") {
3351
+ if (!xe("click")) {
3352
+ ke(u.type, "click");
3346
3353
  return;
3347
3354
  }
3348
3355
  if (typeof document > "u") return;
3349
- const N = d.type === "advance_step" ? "ll-advance" : d.type === "go_back" ? "ll-back" : "ll-submit";
3350
- let R = qn(N);
3351
- if (R || (cr(document), R = qn(N)), !R) {
3352
- console.warn(`[LiveLayer] ${d.type}: no "${N}" control found.`);
3356
+ const N = u.type === "advance_step" ? "ll-advance" : u.type === "go_back" ? "ll-back" : "ll-submit";
3357
+ let T = Un(N);
3358
+ if (T || (ur(document), T = Un(N)), !T) {
3359
+ console.warn(`[LiveLayer] ${u.type}: no "${N}" control found.`);
3353
3360
  return;
3354
3361
  }
3355
- (Ie = R.click) == null || Ie.call(R);
3362
+ (Ne = T.click) == null || Ne.call(T);
3356
3363
  return;
3357
3364
  }
3358
- if (d.type === "fill_form" || d.type === "focus_field") {
3359
- if (!_e("fill_forms")) {
3360
- xe(d.type, "fill_forms");
3365
+ if (u.type === "fill_form" || u.type === "focus_field") {
3366
+ if (!xe("fill_forms")) {
3367
+ ke(u.type, "fill_forms");
3361
3368
  return;
3362
3369
  }
3363
3370
  if (typeof document > "u") return;
3364
- d.type === "fill_form" && Mt.current.playConfirmation();
3365
- const N = typeof d.formId == "string" ? d.formId : null;
3371
+ u.type === "fill_form" && It.current.playConfirmation();
3372
+ const N = typeof u.formId == "string" ? u.formId : null;
3366
3373
  if (!N) {
3367
- console.warn(`[LiveLayer] ${d.type}: missing formId.`);
3374
+ console.warn(`[LiveLayer] ${u.type}: missing formId.`);
3368
3375
  return;
3369
3376
  }
3370
- const R = Kn(document, N);
3371
- if (!R) {
3377
+ const T = Jn(document, N);
3378
+ if (!T) {
3372
3379
  console.warn(
3373
- `[LiveLayer] ${d.type}: no <form> matched id="${N}" (or matching name / data-ll-intent slug). Forms are auto-discovered — make sure the form has an \`id\`, \`name\`, or \`data-ll-intent\` attribute the agent observed in PageContext.forms.`
3380
+ `[LiveLayer] ${u.type}: no <form> matched id="${N}" (or matching name / data-ll-intent slug). Forms are auto-discovered — make sure the form has an \`id\`, \`name\`, or \`data-ll-intent\` attribute the agent observed in PageContext.forms.`
3374
3381
  );
3375
3382
  return;
3376
3383
  }
3377
- if (R.closest('[data-ll-private="true"], [data-ll-skip], .ll-widget')) {
3384
+ if (T.closest('[data-ll-private="true"], [data-ll-skip], .ll-widget')) {
3378
3385
  console.warn(
3379
- `[LiveLayer] ${d.type}: refusing to touch a form in a private / opted-out subtree.`
3386
+ `[LiveLayer] ${u.type}: refusing to touch a form in a private / opted-out subtree.`
3380
3387
  );
3381
3388
  return;
3382
3389
  }
3383
- if (d.type === "focus_field") {
3384
- const j = typeof d.fieldName == "string" ? d.fieldName : null;
3390
+ if (u.type === "focus_field") {
3391
+ const j = typeof u.fieldName == "string" ? u.fieldName : null;
3385
3392
  if (!j) {
3386
3393
  console.warn("[LiveLayer] focus_field: missing fieldName.");
3387
3394
  return;
3388
3395
  }
3389
- const K = Xn(R, j);
3396
+ const K = Kn(T, j);
3390
3397
  if (K.el === null) {
3391
3398
  K.reason === "private" ? console.warn(
3392
3399
  `[LiveLayer] focus_field: field "${j}" is privacy-protected and not focusable.`
@@ -3398,16 +3405,16 @@ const _o = /* @__PURE__ */ new Set([
3398
3405
  K.el.focus();
3399
3406
  return;
3400
3407
  }
3401
- const Y = d.values && typeof d.values == "object" ? d.values : null;
3408
+ const Y = u.values && typeof u.values == "object" ? u.values : null;
3402
3409
  if (!Y) {
3403
3410
  console.warn("[LiveLayer] fill_form: missing or invalid values.");
3404
3411
  return;
3405
3412
  }
3406
3413
  for (const [j, K] of Object.entries(Y)) {
3407
3414
  if (typeof K != "string") continue;
3408
- const Q = Xn(R, j);
3409
- if (Q.el === null) {
3410
- Q.reason === "private" ? console.warn(
3415
+ const ee = Kn(T, j);
3416
+ if (ee.el === null) {
3417
+ ee.reason === "private" ? console.warn(
3411
3418
  `[LiveLayer] fill_form: field "${j}" is privacy-protected (password / cc-* / data-ll-private). Skipping.`
3412
3419
  ) : console.warn(
3413
3420
  `[LiveLayer] fill_form: no input matching key="${j}" in form "${N}". The agent should use the field.name it observed in PageContext.forms[].fields[]. Skipping.`
@@ -3415,7 +3422,7 @@ const _o = /* @__PURE__ */ new Set([
3415
3422
  continue;
3416
3423
  }
3417
3424
  try {
3418
- ho(Q.el, K);
3425
+ mo(ee.el, K);
3419
3426
  } catch (V) {
3420
3427
  console.warn(
3421
3428
  `[LiveLayer] fill_form: failed to set "${j}".`,
@@ -3425,61 +3432,61 @@ const _o = /* @__PURE__ */ new Set([
3425
3432
  }
3426
3433
  return;
3427
3434
  }
3428
- if (d.type === "submit_form") {
3429
- if (!_e("submit_forms")) {
3430
- xe("submit_form", "submit_forms");
3435
+ if (u.type === "submit_form") {
3436
+ if (!xe("submit_forms")) {
3437
+ ke("submit_form", "submit_forms");
3431
3438
  return;
3432
3439
  }
3433
3440
  if (typeof document > "u") return;
3434
- const N = typeof d.formId == "string" ? d.formId : null;
3441
+ const N = typeof u.formId == "string" ? u.formId : null;
3435
3442
  if (!N) {
3436
3443
  console.warn("[LiveLayer] submit_form: missing formId.");
3437
3444
  return;
3438
3445
  }
3439
- Mt.current.playConfirmation();
3440
- const R = Kn(document, N);
3441
- if (!R) {
3446
+ It.current.playConfirmation();
3447
+ const T = Jn(document, N);
3448
+ if (!T) {
3442
3449
  console.warn(
3443
3450
  `[LiveLayer] submit_form: no <form> matched id="${N}" (or matching name / data-ll-intent slug).`
3444
3451
  );
3445
3452
  return;
3446
3453
  }
3447
- if (R.closest('[data-ll-private="true"], [data-ll-skip], .ll-widget')) {
3454
+ if (T.closest('[data-ll-private="true"], [data-ll-skip], .ll-widget')) {
3448
3455
  console.warn(
3449
3456
  "[LiveLayer] submit_form: refusing to submit a form in a private / opted-out subtree."
3450
3457
  );
3451
3458
  return;
3452
3459
  }
3453
- const Y = typeof d.requestId == "string" ? d.requestId : void 0, j = (gt = Ne.current) == null ? void 0 : gt.call(Ne), K = (le) => {
3460
+ const Y = typeof u.requestId == "string" ? u.requestId : void 0, j = (yt = Ee.current) == null ? void 0 : yt.call(Ee), K = (oe) => {
3454
3461
  const ye = j, je = ye == null ? void 0 : ye.localParticipant;
3455
3462
  if (je != null && je.publishData)
3456
3463
  try {
3457
- const Rt = Y ? { ...le, requestId: Y } : le, Dt = new TextEncoder().encode(JSON.stringify(Rt));
3458
- je.publishData(Dt, { reliable: !0 });
3464
+ const Dt = Y ? { ...oe, requestId: Y } : oe, zt = new TextEncoder().encode(JSON.stringify(Dt));
3465
+ je.publishData(zt, { reliable: !0 });
3459
3466
  } catch {
3460
3467
  }
3461
- }, Q = (le) => {
3462
- var Dt, Sn, En, An;
3463
- const ye = le, je = (Dt = ye.getAttribute) == null ? void 0 : Dt.call(ye, "aria-label");
3468
+ }, ee = (oe) => {
3469
+ var zt, En, An, Nn;
3470
+ const ye = oe, je = (zt = ye.getAttribute) == null ? void 0 : zt.call(ye, "aria-label");
3464
3471
  if (je) return je;
3465
- const Rt = ye.id;
3466
- if (Rt) {
3467
- const Pt = (Sn = R.ownerDocument) == null ? void 0 : Sn.querySelector(`label[for="${Rt}"]`);
3468
- if ((En = Pt == null ? void 0 : Pt.textContent) != null && En.trim()) return Pt.textContent.trim();
3472
+ const Dt = ye.id;
3473
+ if (Dt) {
3474
+ const $t = (En = T.ownerDocument) == null ? void 0 : En.querySelector(`label[for="${Dt}"]`);
3475
+ if ((An = $t == null ? void 0 : $t.textContent) != null && An.trim()) return $t.textContent.trim();
3469
3476
  }
3470
- return ((An = ye.getAttribute) == null ? void 0 : An.call(ye, "name")) || ye.id || ye.type || "field";
3477
+ return ((Nn = ye.getAttribute) == null ? void 0 : Nn.call(ye, "name")) || ye.id || ye.type || "field";
3471
3478
  }, V = () => {
3472
3479
  try {
3473
- return Array.from(R.elements).filter(
3474
- (le) => "willValidate" in le && le.willValidate && !le.checkValidity()
3475
- ).map((le) => `${Q(le)}: ${le.validationMessage}`);
3480
+ return Array.from(T.elements).filter(
3481
+ (oe) => "willValidate" in oe && oe.willValidate && !oe.checkValidity()
3482
+ ).map((oe) => `${ee(oe)}: ${oe.validationMessage}`);
3476
3483
  } catch {
3477
3484
  return [];
3478
3485
  }
3479
3486
  };
3480
- if (typeof R.checkValidity == "function" && !R.checkValidity()) {
3487
+ if (typeof T.checkValidity == "function" && !T.checkValidity()) {
3481
3488
  try {
3482
- (Pe = R.reportValidity) == null || Pe.call(R);
3489
+ (De = T.reportValidity) == null || De.call(T);
3483
3490
  } catch {
3484
3491
  }
3485
3492
  K({
@@ -3491,16 +3498,16 @@ const _o = /* @__PURE__ */ new Set([
3491
3498
  return;
3492
3499
  }
3493
3500
  let he = !1;
3494
- const me = (le) => {
3501
+ const me = (oe) => {
3495
3502
  he = !0, queueMicrotask(() => {
3496
- le.defaultPrevented ? K({ type: "form_submit_uncertain", formId: N, reason: "spa_prevented" }) : K({ type: "form_submitted", formId: N });
3503
+ oe.defaultPrevented ? K({ type: "form_submit_uncertain", formId: N, reason: "spa_prevented" }) : K({ type: "form_submitted", formId: N });
3497
3504
  });
3498
3505
  };
3499
- R.addEventListener("submit", me, { once: !0 });
3506
+ T.addEventListener("submit", me, { once: !0 });
3500
3507
  try {
3501
- typeof R.requestSubmit == "function" ? R.requestSubmit() : R.submit();
3502
- } catch (le) {
3503
- console.warn("[LiveLayer] submit_form: requestSubmit threw.", le), R.removeEventListener("submit", me), K({
3508
+ typeof T.requestSubmit == "function" ? T.requestSubmit() : T.submit();
3509
+ } catch (oe) {
3510
+ console.warn("[LiveLayer] submit_form: requestSubmit threw.", oe), T.removeEventListener("submit", me), K({
3504
3511
  type: "form_submit_blocked",
3505
3512
  formId: N,
3506
3513
  reason: "exception"
@@ -3508,7 +3515,7 @@ const _o = /* @__PURE__ */ new Set([
3508
3515
  return;
3509
3516
  }
3510
3517
  setTimeout(() => {
3511
- he || (R.removeEventListener("submit", me), K({
3518
+ he || (T.removeEventListener("submit", me), K({
3512
3519
  type: "form_submit_blocked",
3513
3520
  formId: N,
3514
3521
  reason: "validation",
@@ -3517,12 +3524,12 @@ const _o = /* @__PURE__ */ new Set([
3517
3524
  }, 500);
3518
3525
  return;
3519
3526
  }
3520
- if (d.type === "request_routes") {
3521
- if (!_e("read_page")) {
3522
- xe("request_routes", "read_page");
3527
+ if (u.type === "request_routes") {
3528
+ if (!xe("read_page")) {
3529
+ ke("request_routes", "read_page");
3523
3530
  return;
3524
3531
  }
3525
- const N = typeof d.requestId == "string" ? d.requestId : void 0, Y = (Cn = Ne.current) == null ? void 0 : Cn.call(Ne), j = Y == null ? void 0 : Y.localParticipant;
3532
+ const N = typeof u.requestId == "string" ? u.requestId : void 0, Y = (Sn = Ee.current) == null ? void 0 : Sn.call(Ee), j = Y == null ? void 0 : Y.localParticipant;
3526
3533
  if (!(j != null && j.publishData)) return;
3527
3534
  const K = (V) => {
3528
3535
  try {
@@ -3531,15 +3538,15 @@ const _o = /* @__PURE__ */ new Set([
3531
3538
  } catch (he) {
3532
3539
  console.warn("[LiveLayer] request_routes: publishData failed.", he);
3533
3540
  }
3534
- }, Q = un.current;
3535
- if (Q) {
3541
+ }, ee = dn.current;
3542
+ if (ee) {
3536
3543
  try {
3537
- const V = Q(), he = (me) => {
3544
+ const V = ee(), he = (me) => {
3538
3545
  if (!Array.isArray(me)) {
3539
3546
  K([]);
3540
3547
  return;
3541
3548
  }
3542
- K(me.map(ro).slice(0, 200));
3549
+ K(me.map(io).slice(0, 200));
3543
3550
  };
3544
3551
  V instanceof Promise ? V.then(he).catch((me) => {
3545
3552
  console.warn(
@@ -3562,20 +3569,20 @@ const _o = /* @__PURE__ */ new Set([
3562
3569
  }
3563
3570
  return;
3564
3571
  }
3565
- if (d.type === "task_field_updated") {
3566
- if (!_e("collect_data")) {
3567
- xe("task_field_updated", "collect_data");
3572
+ if (u.type === "task_field_updated") {
3573
+ if (!xe("collect_data")) {
3574
+ ke("task_field_updated", "collect_data");
3568
3575
  return;
3569
3576
  }
3570
3577
  const N = {
3571
3578
  phase: "field",
3572
- fieldId: typeof d.fieldId == "string" ? d.fieldId : "",
3573
- fieldName: typeof d.fieldName == "string" ? d.fieldName : typeof d.fieldId == "string" ? d.fieldId : "",
3574
- value: typeof d.value == "string" ? d.value : "",
3575
- kind: typeof d.kind == "string" ? d.kind : "text",
3576
- source: d.source === "slide" ? "slide" : d.source === "page" ? "page" : "agent",
3577
- ...typeof d.slideId == "string" ? { slideId: d.slideId } : {},
3578
- ...typeof d.formId == "string" ? { formId: d.formId } : {}
3579
+ fieldId: typeof u.fieldId == "string" ? u.fieldId : "",
3580
+ fieldName: typeof u.fieldName == "string" ? u.fieldName : typeof u.fieldId == "string" ? u.fieldId : "",
3581
+ value: typeof u.value == "string" ? u.value : "",
3582
+ kind: typeof u.kind == "string" ? u.kind : "text",
3583
+ source: u.source === "slide" ? "slide" : u.source === "page" ? "page" : "agent",
3584
+ ...typeof u.slideId == "string" ? { slideId: u.slideId } : {},
3585
+ ...typeof u.formId == "string" ? { formId: u.formId } : {}
3579
3586
  };
3580
3587
  if (typeof document < "u")
3581
3588
  try {
@@ -3586,12 +3593,12 @@ const _o = /* @__PURE__ */ new Set([
3586
3593
  }
3587
3594
  return;
3588
3595
  }
3589
- if (d.type === "task_completed") {
3590
- if (!_e("collect_data")) {
3591
- xe("task_completed", "collect_data");
3596
+ if (u.type === "task_completed") {
3597
+ if (!xe("collect_data")) {
3598
+ ke("task_completed", "collect_data");
3592
3599
  return;
3593
3600
  }
3594
- const N = d.result;
3601
+ const N = u.result;
3595
3602
  if (!N || typeof N != "object") {
3596
3603
  console.warn(
3597
3604
  "[LiveLayer] task_completed missing `result` payload."
@@ -3611,45 +3618,45 @@ const _o = /* @__PURE__ */ new Set([
3611
3618
  We == null || We(
3612
3619
  N
3613
3620
  );
3614
- } catch (R) {
3615
- console.warn("[LiveLayer] onCollect threw.", R);
3621
+ } catch (T) {
3622
+ console.warn("[LiveLayer] onCollect threw.", T);
3616
3623
  }
3617
3624
  return;
3618
3625
  }
3619
- _o.has(d.type) || Xe == null || Xe(d);
3626
+ xo.has(u.type) || Xe == null || Xe(u);
3620
3627
  }
3621
3628
  },
3622
3629
  [Xe, Be, We]
3623
3630
  ), se = Dr({
3624
- agentId: F ? "__controlled__" : dt,
3631
+ agentId: F ? "__controlled__" : St,
3625
3632
  baseUrl: o,
3626
3633
  apiKey: l,
3627
3634
  sessionEndpoint: s,
3628
3635
  sessionBody: a,
3629
- onDataMessage: F ? void 0 : ht
3636
+ onDataMessage: F ? void 0 : mt
3630
3637
  });
3631
3638
  I(() => {
3632
3639
  if (F != null && F.subscribeToDataMessages)
3633
- return F.subscribeToDataMessages(ht);
3634
- }, [F, ht]), Ne.current = () => {
3635
- var b;
3636
- return (b = se.getRoom) == null ? void 0 : b.call(se);
3640
+ return F.subscribeToDataMessages(mt);
3641
+ }, [F, mt]), Ee.current = () => {
3642
+ var h;
3643
+ return (h = se.getRoom) == null ? void 0 : h.call(se);
3637
3644
  }, I(() => {
3638
- var ie;
3645
+ var Q;
3639
3646
  if (typeof window > "u") return;
3640
- const b = ((ie = window.location) == null ? void 0 : ie.hostname) || "";
3641
- if (b === "localhost" || b === "127.0.0.1" || b === "0.0.0.0" || b.endsWith(".local") || b.endsWith(".test"))
3642
- return window.__livelayerSimulateCommand = (ue) => {
3647
+ const h = ((Q = window.location) == null ? void 0 : Q.hostname) || "";
3648
+ if (h === "localhost" || h === "127.0.0.1" || h === "0.0.0.0" || h.endsWith(".local") || h.endsWith(".test"))
3649
+ return window.__livelayerSimulateCommand = (fe) => {
3643
3650
  try {
3644
- ht(ue);
3645
- } catch (Ie) {
3646
- console.warn("[LiveLayer] simulate-command threw:", Ie);
3651
+ mt(fe);
3652
+ } catch (Ne) {
3653
+ console.warn("[LiveLayer] simulate-command threw:", Ne);
3647
3654
  }
3648
3655
  }, () => {
3649
3656
  delete window.__livelayerSimulateCommand;
3650
3657
  };
3651
- }, [ht]);
3652
- const L = at(() => F ? {
3658
+ }, [mt]);
3659
+ const _ = at(() => F ? {
3653
3660
  connectionState: F.connectionState,
3654
3661
  agentState: F.agentState,
3655
3662
  transcript: F.transcript,
@@ -3680,265 +3687,280 @@ const _o = /* @__PURE__ */ new Set([
3680
3687
  disconnect: se.disconnect,
3681
3688
  getRoom: se.getRoom,
3682
3689
  isControlled: !1
3683
- }, [F, se]), dn = T(L);
3684
- dn.current = L;
3685
- const fn = T(F);
3686
- fn.current = F, Er(
3690
+ }, [F, se]), fn = R(_);
3691
+ fn.current = _;
3692
+ const pn = R(F);
3693
+ pn.current = F, Ar(
3687
3694
  n,
3688
3695
  () => ({
3689
- sendData: async (b) => {
3690
- var Ie, gt;
3691
- const d = fn.current;
3692
- if (d != null && d.publishData) {
3696
+ sendData: async (h) => {
3697
+ var Ne, yt;
3698
+ const u = pn.current;
3699
+ if (u != null && u.publishData) {
3693
3700
  try {
3694
- await d.publishData(b);
3695
- } catch (Pe) {
3696
- console.warn("[AvatarWidget] sendData (controlled) failed:", Pe);
3701
+ await u.publishData(h);
3702
+ } catch (De) {
3703
+ console.warn("[AvatarWidget] sendData (controlled) failed:", De);
3697
3704
  }
3698
3705
  return;
3699
3706
  }
3700
- const ie = (gt = (Ie = dn.current) == null ? void 0 : Ie.getRoom) == null ? void 0 : gt.call(Ie), ue = ie == null ? void 0 : ie.localParticipant;
3701
- if (ue != null && ue.publishData)
3707
+ const Q = (yt = (Ne = fn.current) == null ? void 0 : Ne.getRoom) == null ? void 0 : yt.call(Ne), fe = Q == null ? void 0 : Q.localParticipant;
3708
+ if (fe != null && fe.publishData)
3702
3709
  try {
3703
- const Pe = new TextEncoder().encode(JSON.stringify(b));
3704
- await ue.publishData(Pe, { reliable: !0 });
3705
- } catch (Pe) {
3706
- console.warn("[AvatarWidget] sendData failed:", Pe);
3710
+ const De = new TextEncoder().encode(JSON.stringify(h));
3711
+ await fe.publishData(De, { reliable: !0 });
3712
+ } catch (De) {
3713
+ console.warn("[AvatarWidget] sendData failed:", De);
3707
3714
  }
3708
3715
  }
3709
3716
  }),
3710
3717
  []
3711
3718
  );
3712
- const pn = T(null);
3719
+ const hn = R(null);
3713
3720
  I(() => {
3714
- const b = L.videoElement, d = pn.current;
3715
- if (!(!b || !d))
3716
- return d.appendChild(b), () => {
3717
- b.parentNode === d && d.removeChild(b);
3721
+ const h = _.videoElement, u = hn.current;
3722
+ if (!(!h || !u))
3723
+ return u.appendChild(h), () => {
3724
+ h.parentNode === u && u.removeChild(h);
3718
3725
  };
3719
- }, [L.videoElement]);
3720
- const [tt, It] = M(!1);
3726
+ }, [_.videoElement]);
3727
+ const [tt, Rt] = M(!1);
3721
3728
  I(() => {
3722
3729
  if (!$) {
3723
- It(!0);
3730
+ Rt(!0);
3724
3731
  return;
3725
3732
  }
3726
- L.agentState === "speaking" && !tt && It(!0);
3727
- }, [$, L.agentState, tt]), I(() => {
3733
+ _.agentState === "speaking" && !tt && Rt(!0);
3734
+ }, [$, _.agentState, tt]), I(() => {
3728
3735
  if (!$) return;
3729
- const b = L.connectionState;
3730
- (b === "disconnected" || b === "idle") && It(!1);
3731
- }, [$, L.connectionState]), I(() => {
3732
- if (!$ || !L.videoElement || tt) return;
3733
- const b = setTimeout(() => It(!0), 5e3);
3734
- return () => clearTimeout(b);
3735
- }, [$, L.videoElement, tt]), I(() => {
3736
- const b = L.videoElement;
3737
- if (b) {
3736
+ const h = _.connectionState;
3737
+ (h === "disconnected" || h === "idle") && Rt(!1);
3738
+ }, [$, _.connectionState]), I(() => {
3739
+ if (!$ || !_.videoElement || tt) return;
3740
+ const h = setTimeout(() => Rt(!0), 5e3);
3741
+ return () => clearTimeout(h);
3742
+ }, [$, _.videoElement, tt]), I(() => {
3743
+ const h = _.videoElement;
3744
+ if (h) {
3738
3745
  if (!$) {
3739
- b.style.filter = "";
3746
+ h.style.filter = "";
3740
3747
  return;
3741
3748
  }
3742
- b.style.transition = "filter 500ms ease-out", b.style.filter = tt ? "" : "blur(8px)";
3749
+ h.style.transition = "filter 500ms ease-out", h.style.filter = tt ? "" : "blur(8px)";
3743
3750
  }
3744
- }, [$, L.videoElement, tt]), I(() => {
3745
- const b = L.audioElement;
3746
- if (!b) return;
3747
- const d = document.createElement("div");
3748
- d.className = "ll-audio-sink", d.setAttribute("aria-hidden", "true"), d.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;clip:rect(0 0 0 0);pointer-events:none;", d.appendChild(b), document.body.appendChild(d), Ce.attach(b);
3749
- const ie = b.play();
3750
- return ie && typeof ie.catch == "function" && ie.catch((ue) => {
3751
- (ue == null ? void 0 : ue.name) === "NotAllowedError" && Ee(!0);
3752
- }), () => {
3753
- Ce.detach(), b.parentNode === d && d.removeChild(b), d.parentNode === document.body && document.body.removeChild(d);
3754
- };
3755
- }, [L.audioElement]);
3756
- const we = $r({
3751
+ }, [$, _.videoElement, tt]);
3752
+ const Tt = R(/* @__PURE__ */ new Map());
3753
+ I(() => {
3754
+ const h = _.audioElement;
3755
+ if (!h || Tt.current.has(h)) return;
3756
+ const u = document.createElement("div");
3757
+ u.className = "ll-audio-sink", u.setAttribute("aria-hidden", "true"), u.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;clip:rect(0 0 0 0);pointer-events:none;", u.appendChild(h), document.body.appendChild(u), Tt.current.set(h, u), Re.attach(h);
3758
+ const Q = h.play();
3759
+ Q && typeof Q.catch == "function" && Q.catch((fe) => {
3760
+ (fe == null ? void 0 : fe.name) === "NotAllowedError" && Se(!0);
3761
+ });
3762
+ }, [_.audioElement]), I(() => {
3763
+ const h = _.connectionState;
3764
+ if (!(h !== "disconnected" && h !== "idle" && h !== "error")) {
3765
+ Re.detach();
3766
+ for (const [u, Q] of Tt.current)
3767
+ u.parentNode === Q && Q.removeChild(u), Q.parentNode === document.body && document.body.removeChild(Q);
3768
+ Tt.current.clear();
3769
+ }
3770
+ }, [_.connectionState]);
3771
+ const we = Hr({
3757
3772
  gateUntilAgentReady: !0,
3758
- agentState: L.agentState
3773
+ agentState: _.agentState
3759
3774
  });
3760
3775
  I(() => {
3761
- if (L.isControlled || L.connectionState !== "connected") return;
3762
- const b = L.getRoom();
3763
- if (b)
3764
- return we.setupMic(b).then(() => {
3765
- const d = we.getMicStream();
3766
- d && Ce.attachStream(d, "mic");
3776
+ if (_.isControlled || _.connectionState !== "connected") return;
3777
+ const h = _.getRoom();
3778
+ if (h)
3779
+ return we.setupMic(h).then(() => {
3780
+ const u = we.getMicStream();
3781
+ u && Re.attachStream(u, "mic");
3767
3782
  }).catch(() => {
3768
3783
  }), () => {
3769
- Ce.detachSlot("mic"), we.teardownMic();
3784
+ Re.detachSlot("mic"), we.teardownMic();
3770
3785
  };
3771
- }, [L.isControlled, L.connectionState]), I(() => {
3772
- var d;
3773
- if (L.connectionState !== "connected") return;
3774
- const b = L.isControlled ? (d = F == null ? void 0 : F.getRoom) == null ? void 0 : d.call(F) : L.getRoom();
3775
- if (b)
3776
- return Se.attachRoom(b), Ue.attachRoom(b), L.isControlled && we.attachRoom(b), Qe.refresh(), () => {
3777
- Se.teardown(), Ue.teardown();
3786
+ }, [_.isControlled, _.connectionState]), I(() => {
3787
+ var u;
3788
+ if (_.connectionState !== "connected") return;
3789
+ const h = _.isControlled ? (u = F == null ? void 0 : F.getRoom) == null ? void 0 : u.call(F) : _.getRoom();
3790
+ if (h)
3791
+ return Ae.attachRoom(h), Te.attachRoom(h), _.isControlled && we.attachRoom(h), ft.refresh(), () => {
3792
+ Ae.teardown(), Te.teardown();
3778
3793
  };
3779
- }, [L.isControlled, L.connectionState, F]), I(() => {
3780
- const b = L.audioElement;
3781
- b && (b.muted = re);
3782
- }, [L.audioElement, re]);
3783
- const pr = k((b) => {
3784
- const d = { type: "user_message", text: b };
3794
+ }, [_.isControlled, _.connectionState, F]), I(() => {
3795
+ const h = _.audioElement;
3796
+ h && (h.muted = qt);
3797
+ }, [_.audioElement, qt]);
3798
+ const hr = L((h) => {
3799
+ const u = { type: "user_message", text: h };
3785
3800
  if (F != null && F.publishData) {
3786
3801
  try {
3787
- F.publishData(d);
3802
+ F.publishData(u);
3788
3803
  } catch {
3789
3804
  }
3790
3805
  return;
3791
3806
  }
3792
- const ie = L.getRoom();
3793
- if (ie)
3807
+ const Q = _.getRoom();
3808
+ if (Q)
3794
3809
  try {
3795
- const ue = new TextEncoder().encode(JSON.stringify(d));
3796
- ie.localParticipant.publishData(ue, { reliable: !0 });
3810
+ const fe = new TextEncoder().encode(JSON.stringify(u));
3811
+ Q.localParticipant.publishData(fe, { reliable: !0 });
3797
3812
  } catch {
3798
3813
  }
3799
- }, [L, F]), hr = k(() => {
3800
- fr((b) => !b);
3814
+ }, [_, F]), mr = L(() => {
3815
+ pr((h) => !h);
3801
3816
  }, []);
3802
3817
  I(() => {
3803
- Fe == null || Fe(L.connectionState), L.connectionState === "connected" ? Ge == null || Ge() : L.connectionState === "disconnected" && ($e == null || $e());
3804
- }, [L.connectionState, Ge, $e, Fe]), I(() => {
3805
- He == null || He(L.transcript);
3806
- }, [L.transcript, He]), I(() => {
3807
- Oe == null || Oe(L.agentState);
3808
- }, [L.agentState, Oe]), I(() => {
3809
- Nt.setThinking(L.agentState === "thinking");
3810
- }, [L.agentState, Nt]);
3811
- const hn = T(!1);
3818
+ Fe == null || Fe(_.connectionState), _.connectionState === "connected" ? Ge == null || Ge() : _.connectionState === "disconnected" && ($e == null || $e());
3819
+ }, [_.connectionState, Ge, $e, Fe]), I(() => {
3820
+ He == null || He(_.transcript);
3821
+ }, [_.transcript, He]), I(() => {
3822
+ Oe == null || Oe(_.agentState);
3823
+ }, [_.agentState, Oe]), I(() => {
3824
+ Mt.setThinking(_.agentState === "thinking");
3825
+ }, [_.agentState, Mt]);
3826
+ const mn = R(!1);
3812
3827
  I(() => {
3813
- !m || hn.current || ut && L.connectionState === "idle" && (hn.current = !0, L.connect());
3814
- }, [m, L.connectionState, L, ut]);
3815
- const mr = k(
3816
- (b) => {
3817
- const d = v == null ? void 0 : v.find((ie) => ie.id === b);
3818
- d && (pt(!1), b !== Me && (ft(!0), L.disconnect(), Re || kt(b), y == null || y(d)));
3828
+ !g || mn.current || ut && _.connectionState === "idle" && (mn.current = !0, _.connect());
3829
+ }, [g, _.connectionState, _, ut]);
3830
+ const gr = L(
3831
+ (h) => {
3832
+ const u = b == null ? void 0 : b.find((Q) => Q.id === h);
3833
+ u && (et(!1), h !== Ue && (pt(!0), _.disconnect(), Ie || Ct(h), v == null || v(u)));
3819
3834
  },
3820
3835
  [
3821
- v,
3822
- Me,
3823
- L,
3824
- Re,
3825
- y
3836
+ b,
3837
+ Ue,
3838
+ _,
3839
+ Ie,
3840
+ v
3826
3841
  ]
3827
3842
  );
3828
3843
  I(() => {
3829
- Ae && L.connectionState === "connected" && ft(!1);
3830
- }, [L.connectionState, Ae]), I(() => {
3831
- if (!et) return;
3832
- const b = (d) => {
3833
- d.key === "Escape" && pt(!1);
3844
+ Qe && _.connectionState === "connected" && pt(!1);
3845
+ }, [_.connectionState, Qe]), I(() => {
3846
+ if (!ht) return;
3847
+ const h = (u) => {
3848
+ u.key === "Escape" && et(!1);
3834
3849
  };
3835
- return window.addEventListener("keydown", b), () => window.removeEventListener("keydown", b);
3836
- }, [et]);
3837
- const gr = !!J || !!(de != null && de.avatarImageUrl) || L.isControlled, mt = Wr(dt, o, gr);
3838
- Ye === void 0 && ((vn = mt.info) != null && vn.capabilities) && (Gt.current = mt.info.capabilities);
3839
- const Tt = (de == null ? void 0 : de.name) ?? ae ?? ((bn = L.agentConfig) == null ? void 0 : bn.name) ?? ((wn = mt.info) == null ? void 0 : wn.name) ?? "Live Layer", Xt = (de == null ? void 0 : de.avatarImageUrl) ?? J ?? ((_n = L.agentConfig) == null ? void 0 : _n.avatarImageUrl) ?? ((xn = mt.info) == null ? void 0 : xn.avatarImageUrl) ?? null, yr = z ?? ((Ln = L.agentConfig) == null ? void 0 : Ln.idleLoopUrl) ?? ((kn = mt.info) == null ? void 0 : kn.idleLoopUrl) ?? null, vr = B ?? null, br = k(() => be("expanded"), [be]), wr = k(
3850
+ return window.addEventListener("keydown", h), () => window.removeEventListener("keydown", h);
3851
+ }, [ht]);
3852
+ const yr = !!J || !!(ue != null && ue.avatarImageUrl) || _.isControlled, gt = qr(St, o, yr);
3853
+ Ye === void 0 && ((bn = gt.info) != null && bn.capabilities) && (Gt.current = gt.info.capabilities);
3854
+ const Pt = (ue == null ? void 0 : ue.name) ?? le ?? ((wn = _.agentConfig) == null ? void 0 : wn.name) ?? ((_n = gt.info) == null ? void 0 : _n.name) ?? "Live Layer", Xt = (ue == null ? void 0 : ue.avatarImageUrl) ?? J ?? ((xn = _.agentConfig) == null ? void 0 : xn.avatarImageUrl) ?? ((kn = gt.info) == null ? void 0 : kn.avatarImageUrl) ?? null, vr = z ?? ((Ln = _.agentConfig) == null ? void 0 : Ln.idleLoopUrl) ?? ((Cn = gt.info) == null ? void 0 : Cn.idleLoopUrl) ?? null, br = B ?? null, wr = L(() => be("expanded"), [be]), _r = L(
3840
3855
  () => be("minimized"),
3841
3856
  [be]
3842
- ), mn = k(() => {
3843
- L.disconnect(), be("hidden");
3844
- }, [L, be]), _r = k(() => {
3845
- const b = L.audioElement;
3846
- b && b.play().then(() => Ee(!1)).catch(() => {
3857
+ ), gn = L(() => {
3858
+ _.disconnect(), be("hidden");
3859
+ }, [_, be]), xr = L(() => {
3860
+ const h = _.audioElement;
3861
+ h && h.play().then(() => Se(!1)).catch(() => {
3847
3862
  });
3848
- }, [L.audioElement]), xr = k(() => {
3849
- Ee(!1), L.connect();
3850
- }, [L]), nt = {
3863
+ }, [_.audioElement]), kr = L(() => {
3864
+ Se(!1), _.connect();
3865
+ }, [_]), nt = {
3851
3866
  ...Ke,
3852
- ...fe ? {} : { zIndex: ke }
3867
+ ...de ? {} : { zIndex: Ce }
3853
3868
  };
3854
3869
  H.primaryColor && (nt["--ll-color-primary"] = H.primaryColor), H.accentColor && (nt["--ll-color-accent"] = H.accentColor), H.backgroundColor && (nt["--ll-color-bg"] = H.backgroundColor), H.textColor && (nt["--ll-color-fg"] = H.textColor);
3855
3870
  const Lr = {
3856
3871
  ...nt,
3857
- ...De.style
3858
- }, kr = [
3872
+ ..._e.style
3873
+ }, Cr = [
3859
3874
  "ll-widget",
3860
3875
  `ll-widget--${pe}`,
3861
3876
  `ll-widget--${ve ? "mobile" : "desktop"}`,
3862
- De.hasGeometry ? "ll-widget--has-geometry" : null,
3863
- De.isDragging ? "is-dragging" : null,
3864
- De.isResizing ? "is-resizing" : null,
3877
+ _e.hasGeometry ? "ll-widget--has-geometry" : null,
3878
+ _e.isDragging ? "is-dragging" : null,
3879
+ _e.isResizing ? "is-resizing" : null,
3865
3880
  qe
3866
3881
  ].filter(Boolean).join(" ");
3867
3882
  if (!ut) return null;
3868
- const Cr = /* @__PURE__ */ r(
3883
+ const Sr = /* @__PURE__ */ r(
3869
3884
  "div",
3870
3885
  {
3871
- className: kr,
3886
+ className: Cr,
3872
3887
  style: Lr,
3873
3888
  "data-display-mode": pe,
3874
- "data-position": _,
3875
- "data-experience-mode": u === "EMBEDDED" ? "embedded" : "widget",
3889
+ "data-position": x,
3890
+ "data-experience-mode": d === "EMBEDDED" ? "embedded" : "widget",
3876
3891
  children: pe === "expanded" && /* @__PURE__ */ r(
3877
- Ni,
3892
+ Mi,
3878
3893
  {
3879
- position: _,
3894
+ position: x,
3880
3895
  isMobile: ve,
3881
- agentName: Tt,
3896
+ agentName: Pt,
3882
3897
  avatarImageUrl: Xt,
3883
- idleLoopUrl: yr,
3884
- greeting: vr,
3898
+ idleLoopUrl: vr,
3899
+ greeting: br,
3885
3900
  branding: H,
3886
- teamMembers: v,
3887
- currentTeamMemberId: Me,
3888
- isSwitchingTeamMember: Ae,
3889
- teamSwitcherOpen: et,
3890
- onToggleTeamSwitcher: () => pt((b) => !b),
3891
- onSelectTeamMember: mr,
3892
- connectionState: L.connectionState,
3893
- agentState: L.agentState,
3894
- transcript: L.transcript,
3901
+ teamMembers: b,
3902
+ currentTeamMemberId: Ue,
3903
+ isSwitchingTeamMember: Qe,
3904
+ teamSwitcherOpen: ht,
3905
+ onToggleTeamSwitcher: () => et((h) => !h),
3906
+ onSelectTeamMember: gr,
3907
+ connectionState: _.connectionState,
3908
+ agentState: _.agentState,
3909
+ transcript: _.transcript,
3895
3910
  isMuted: we.isMuted,
3896
- micDevices: Qe.mics,
3911
+ micDevices: ft.mics,
3897
3912
  activeMicId: we.activeDeviceId,
3898
- isCameraEnabled: Se.isEnabled,
3899
- cameraPreviewEl: Se.previewEl,
3900
- cameraDevices: Qe.cameras,
3901
- activeCameraId: Se.activeDeviceId,
3902
- isScreenShareEnabled: Ue.isEnabled,
3903
- screenPreviewEl: Ue.previewEl,
3904
- isSpeakerMuted: re,
3913
+ isCameraEnabled: Ae.isEnabled,
3914
+ cameraPreviewEl: Ae.previewEl,
3915
+ cameraDevices: ft.cameras,
3916
+ activeCameraId: Ae.activeDeviceId,
3917
+ isScreenShareEnabled: Te.isEnabled,
3918
+ screenPreviewEl: Te.previewEl,
3919
+ isSpeakerMuted: qt,
3905
3920
  allowCamera: G,
3906
3921
  allowScreenShare: f,
3907
3922
  allowTyping: A,
3908
- showMinimize: ve && !fe ? !1 : Ze,
3909
- showClose: St,
3910
- chromeless: ee,
3911
- compactControls: Et,
3912
- transforming: oe,
3923
+ showMinimize: ve && !de ? !1 : Et,
3924
+ showClose: At,
3925
+ chromeless: te,
3926
+ compactControls: Nt,
3927
+ transforming: ie,
3913
3928
  transformingLabel: U,
3914
- languageMenuOpen: At,
3915
- onToggleLanguageMenu: () => x((b) => !b),
3916
- needsUserGesture: qt,
3917
- canResume: L.canResume,
3929
+ languageMenuOpen: k,
3930
+ onToggleLanguageMenu: () => ae((h) => !h),
3931
+ needsUserGesture: Pe,
3932
+ canResume: _.canResume,
3918
3933
  micError: we.micError,
3919
- error: L.error,
3920
- avatarVideoContainerRef: pn,
3921
- agentVideoEl: L.videoElement,
3922
- onConnect: () => void L.connect(),
3923
- onDisconnect: () => L.disconnect(),
3924
- onRetry: xr,
3925
- onResumeAudio: _r,
3934
+ error: _.error,
3935
+ avatarVideoContainerRef: hn,
3936
+ agentVideoEl: _.videoElement,
3937
+ onConnect: () => {
3938
+ Promise.resolve(_.connect()).then(() => {
3939
+ var u;
3940
+ const h = (u = _.getRoom) == null ? void 0 : u.call(_);
3941
+ h != null && h.startAudio && h.canPlaybackAudio === !1 && h.startAudio().catch(() => {
3942
+ });
3943
+ });
3944
+ },
3945
+ onDisconnect: () => _.disconnect(),
3946
+ onRetry: kr,
3947
+ onResumeAudio: xr,
3926
3948
  onToggleMute: we.toggleMute,
3927
- onSwitchMicDevice: (b) => void we.switchDevice(b),
3928
- onToggleCamera: () => void Se.toggle(),
3929
- onSwitchCameraDevice: (b) => void Se.switchDevice(b),
3930
- onToggleScreenShare: () => void Ue.toggle(),
3931
- onToggleSpeaker: hr,
3932
- onSendMessage: pr,
3933
- onMinimize: wr,
3934
- onClose: mn,
3949
+ onSwitchMicDevice: (h) => void we.switchDevice(h),
3950
+ onToggleCamera: () => void Ae.toggle(),
3951
+ onSwitchCameraDevice: (h) => void Ae.switchDevice(h),
3952
+ onToggleScreenShare: () => void Te.toggle(),
3953
+ onToggleSpeaker: mr,
3954
+ onSendMessage: hr,
3955
+ onMinimize: _r,
3956
+ onClose: gn,
3935
3957
  onClearMicError: we.clearError,
3936
- dragHandleProps: De.dragHandleProps,
3937
- resizeHandleProps: De.resizeHandleProps
3958
+ dragHandleProps: _e.dragHandleProps,
3959
+ resizeHandleProps: _e.resizeHandleProps
3938
3960
  }
3939
3961
  )
3940
3962
  }
3941
- ), gn = !fe && (pe === "hidden" || pe === "minimized") ? /* @__PURE__ */ S(
3963
+ ), yn = !de && (pe === "hidden" || pe === "minimized") ? /* @__PURE__ */ S(
3942
3964
  "div",
3943
3965
  {
3944
3966
  className: [
@@ -3949,53 +3971,53 @@ const _o = /* @__PURE__ */ new Set([
3949
3971
  ].join(" "),
3950
3972
  style: nt,
3951
3973
  "data-display-mode": pe,
3952
- "data-position": _,
3974
+ "data-position": x,
3953
3975
  children: [
3954
3976
  pe === "hidden" && /* @__PURE__ */ r(
3955
- vi,
3977
+ bi,
3956
3978
  {
3957
- position: _,
3979
+ position: x,
3958
3980
  isMobile: ve,
3959
- isSpeaking: L.agentState === "speaking",
3981
+ isSpeaking: _.agentState === "speaking",
3960
3982
  onExpand: () => be("expanded"),
3961
- label: `Open ${Tt} widget`,
3983
+ label: `Open ${Pt} widget`,
3962
3984
  avatarImageUrl: Xt,
3963
- agentName: Tt,
3985
+ agentName: Pt,
3964
3986
  containerEl: W
3965
3987
  }
3966
3988
  ),
3967
3989
  pe === "minimized" && /* @__PURE__ */ r(
3968
- wi,
3990
+ _i,
3969
3991
  {
3970
- position: _,
3992
+ position: x,
3971
3993
  isMobile: ve,
3972
- agentName: Tt,
3994
+ agentName: Pt,
3973
3995
  avatarImageUrl: Xt,
3974
- agentState: L.agentState,
3996
+ agentState: _.agentState,
3975
3997
  isMuted: we.isMuted,
3976
- audioLevel: Ce,
3977
- onExpand: br,
3998
+ audioLevel: Re,
3999
+ onExpand: wr,
3978
4000
  onToggleMute: we.toggleMute,
3979
- onClose: mn
4001
+ onClose: gn
3980
4002
  }
3981
4003
  )
3982
4004
  ]
3983
4005
  }
3984
- ) : null, yn = W ?? (typeof document < "u" ? document.body : null);
4006
+ ) : null, vn = W ?? (typeof document < "u" ? document.body : null);
3985
4007
  return /* @__PURE__ */ S(Ve, { children: [
3986
- Cr,
3987
- gn && yn && ln(gn, yn)
4008
+ Sr,
4009
+ yn && vn && ln(yn, vn)
3988
4010
  ] });
3989
4011
  }
3990
4012
  );
3991
- dr.displayName = "AvatarWidgetInner";
3992
- const xo = on(
4013
+ fr.displayName = "AvatarWidgetInner";
4014
+ const ko = on(
3993
4015
  function(t, n) {
3994
- return /* @__PURE__ */ r(Rr, { children: /* @__PURE__ */ r(dr, { ...t, ref: n }) });
4016
+ return /* @__PURE__ */ r(Pr, { children: /* @__PURE__ */ r(fr, { ...t, ref: n }) });
3995
4017
  }
3996
4018
  );
3997
- xo.displayName = "AvatarWidget";
3998
- const Ro = ({
4019
+ ko.displayName = "AvatarWidget";
4020
+ const Po = ({
3999
4021
  agentId: e,
4000
4022
  baseUrl: t,
4001
4023
  apiKey: n,
@@ -4004,26 +4026,26 @@ const Ro = ({
4004
4026
  className: o,
4005
4027
  style: s
4006
4028
  }) => {
4007
- const a = T(null), c = T(null), u = T(l);
4008
- u.current = l;
4009
- const m = k((p) => {
4010
- var P;
4011
- const h = p.detail;
4012
- (P = u.current) == null || P.call(u, h);
4029
+ const a = R(null), c = R(null), d = R(l);
4030
+ d.current = l;
4031
+ const g = L((p) => {
4032
+ var D;
4033
+ const m = p.detail;
4034
+ (D = d.current) == null || D.call(d, m);
4013
4035
  }, []);
4014
4036
  return I(() => {
4015
4037
  const p = a.current;
4016
4038
  if (!p) return;
4017
- const h = document.createElement("livelayer-widget");
4018
- return h.setAttribute("agent-id", e), t && h.setAttribute("base-url", t), n && h.setAttribute("api-key", n), i && h.setAttribute("mode", i), h.addEventListener("agent-event", m), p.appendChild(h), c.current = h, () => {
4019
- h.removeEventListener("agent-event", m), p.removeChild(h), c.current = null;
4039
+ const m = document.createElement("livelayer-widget");
4040
+ return m.setAttribute("agent-id", e), t && m.setAttribute("base-url", t), n && m.setAttribute("api-key", n), i && m.setAttribute("mode", i), m.addEventListener("agent-event", g), p.appendChild(m), c.current = m, () => {
4041
+ m.removeEventListener("agent-event", g), p.removeChild(m), c.current = null;
4020
4042
  };
4021
4043
  }, [e]), I(() => {
4022
4044
  c.current && (i ? c.current.setAttribute("mode", i) : c.current.removeAttribute("mode"));
4023
4045
  }, [i]), /* @__PURE__ */ r("div", { ref: a, className: o, style: s });
4024
4046
  }, Do = on(
4025
4047
  function({ id: t, intent: n, as: i = "div", className: l, style: o, children: s }, a) {
4026
- return Ar(
4048
+ return Nr(
4027
4049
  i,
4028
4050
  {
4029
4051
  ref: a,
@@ -4036,60 +4058,60 @@ const Ro = ({
4036
4058
  );
4037
4059
  }
4038
4060
  );
4039
- function Po(e = {}) {
4040
- const { onFieldUpdate: t, onComplete: n, source: i = "all" } = e, [l, o] = M({}), [s, a] = M(!1), [c, u] = M(null), m = T(t), p = T(n), h = T(i);
4061
+ function zo(e = {}) {
4062
+ const { onFieldUpdate: t, onComplete: n, source: i = "all" } = e, [l, o] = M({}), [s, a] = M(!1), [c, d] = M(null), g = R(t), p = R(n), m = R(i);
4041
4063
  I(() => {
4042
- m.current = t, p.current = n, h.current = i;
4064
+ g.current = t, p.current = n, m.current = i;
4043
4065
  }, [t, n, i]);
4044
- const P = k(() => {
4066
+ const D = L(() => {
4045
4067
  o({}), a(!1);
4046
4068
  }, []);
4047
4069
  return I(() => {
4048
4070
  if (typeof window > "u") return;
4049
- const _ = (C) => {
4050
- var w, D;
4051
- const g = C.detail;
4052
- if (g) {
4053
- if (g.phase === "field") {
4054
- if (h.current !== "all" && g.source !== h.current)
4071
+ const x = (C) => {
4072
+ var w, P;
4073
+ const y = C.detail;
4074
+ if (y) {
4075
+ if (y.phase === "field") {
4076
+ if (m.current !== "all" && y.source !== m.current)
4055
4077
  return;
4056
4078
  a(!0), o(
4057
- (E) => E[g.fieldName] === g.value ? E : { ...E, [g.fieldName]: g.value }
4079
+ (E) => E[y.fieldName] === y.value ? E : { ...E, [y.fieldName]: y.value }
4058
4080
  );
4059
4081
  try {
4060
- (w = m.current) == null || w.call(m, g);
4082
+ (w = g.current) == null || w.call(g, y);
4061
4083
  } catch (E) {
4062
4084
  console.warn("[LiveLayer] useCollect onFieldUpdate threw.", E);
4063
4085
  }
4064
4086
  return;
4065
4087
  }
4066
- if (g.phase === "complete") {
4067
- const E = g.result;
4068
- if (h.current !== "all" && E.source !== h.current)
4088
+ if (y.phase === "complete") {
4089
+ const E = y.result;
4090
+ if (m.current !== "all" && E.source !== m.current)
4069
4091
  return;
4070
- u(E), a(!1);
4092
+ d(E), a(!1);
4071
4093
  try {
4072
- (D = p.current) == null || D.call(p, E);
4073
- } catch (v) {
4074
- console.warn("[LiveLayer] useCollect onComplete threw.", v);
4094
+ (P = p.current) == null || P.call(p, E);
4095
+ } catch (b) {
4096
+ console.warn("[LiveLayer] useCollect onComplete threw.", b);
4075
4097
  }
4076
4098
  }
4077
4099
  }
4078
4100
  };
4079
- return document.addEventListener("ll-collected", _), () => document.removeEventListener("ll-collected", _);
4080
- }, []), { fields: l, isCollecting: s, lastResult: c, reset: P };
4101
+ return document.addEventListener("ll-collected", x), () => document.removeEventListener("ll-collected", x);
4102
+ }, []), { fields: l, isCollecting: s, lastResult: c, reset: D };
4081
4103
  }
4082
- let Zn = 1;
4083
- function zo({
4104
+ let Qn = 1;
4105
+ function $o({
4084
4106
  onMount: e,
4085
4107
  defaultOpen: t = !1,
4086
4108
  storageKey: n = "ll-debug-open"
4087
4109
  }) {
4088
- const [i, l] = M(t), [o, s] = M([]), [a, c] = M(""), [u, m] = M(!1), p = T(/* @__PURE__ */ new Set()), h = T([]), P = T(u);
4089
- P.current = u, I(() => {
4110
+ const [i, l] = M(t), [o, s] = M([]), [a, c] = M(""), [d, g] = M(!1), p = R(/* @__PURE__ */ new Set()), m = R([]), D = R(d);
4111
+ D.current = d, I(() => {
4090
4112
  try {
4091
- const g = localStorage.getItem(n);
4092
- g === "1" && l(!0), g === "0" && l(!1);
4113
+ const y = localStorage.getItem(n);
4114
+ y === "1" && l(!0), y === "0" && l(!1);
4093
4115
  } catch {
4094
4116
  }
4095
4117
  }, [n]), I(() => {
@@ -4098,48 +4120,48 @@ function zo({
4098
4120
  } catch {
4099
4121
  }
4100
4122
  }, [i, n]), I(() => {
4101
- const g = (w) => {
4102
- (w.metaKey || w.ctrlKey) && w.shiftKey && w.key.toLowerCase() === "l" && (w.preventDefault(), l((D) => !D));
4123
+ const y = (w) => {
4124
+ (w.metaKey || w.ctrlKey) && w.shiftKey && w.key.toLowerCase() === "l" && (w.preventDefault(), l((P) => !P));
4103
4125
  };
4104
- return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
4126
+ return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
4105
4127
  }, []), I(() => {
4106
- const g = setInterval(() => {
4107
- if (h.current.length === 0 || P.current) return;
4108
- const w = h.current.splice(0, h.current.length);
4128
+ const y = setInterval(() => {
4129
+ if (m.current.length === 0 || D.current) return;
4130
+ const w = m.current.splice(0, m.current.length);
4109
4131
  s(
4110
- (D) => [...w.reverse(), ...D].slice(0, 200)
4132
+ (P) => [...w.reverse(), ...P].slice(0, 200)
4111
4133
  );
4112
4134
  }, 100);
4113
- return () => clearInterval(g);
4135
+ return () => clearInterval(y);
4114
4136
  }, []);
4115
- const _ = T(!1);
4137
+ const x = R(!1);
4116
4138
  if (I(() => {
4117
- !e || _.current || (_.current = !0, e((g) => {
4118
- h.current.push({
4119
- id: Zn++,
4139
+ !e || x.current || (x.current = !0, e((y) => {
4140
+ m.current.push({
4141
+ id: Qn++,
4120
4142
  ts: Date.now(),
4121
4143
  kind: "event",
4122
- type: g.eventName,
4123
- data: g.data
4144
+ type: y.eventName,
4145
+ data: y.data
4124
4146
  });
4125
4147
  }));
4126
4148
  }, [e]), I(() => {
4127
- const g = console.warn, w = console.log, D = (E, v) => function(...O) {
4149
+ const y = console.warn, w = console.log, P = (E, b) => function(...O) {
4128
4150
  try {
4129
- const y = typeof O[0] == "string" ? O[0] : "";
4130
- y.startsWith("[LiveLayer]") && h.current.push({
4131
- id: Zn++,
4151
+ const v = typeof O[0] == "string" ? O[0] : "";
4152
+ v.startsWith("[LiveLayer]") && m.current.push({
4153
+ id: Qn++,
4132
4154
  ts: Date.now(),
4133
4155
  kind: E,
4134
- type: y.slice(0, 120),
4135
- data: { args: O.slice(1).map((z) => ko(z)) }
4156
+ type: v.slice(0, 120),
4157
+ data: { args: O.slice(1).map((z) => Co(z)) }
4136
4158
  });
4137
4159
  } catch {
4138
4160
  }
4139
- return v.apply(this, O);
4161
+ return b.apply(this, O);
4140
4162
  };
4141
- return console.warn = D("warn", g), console.log = D("log", w), () => {
4142
- console.warn = g, console.log = w;
4163
+ return console.warn = P("warn", y), console.log = P("log", w), () => {
4164
+ console.warn = y, console.log = w;
4143
4165
  };
4144
4166
  }, []), !i)
4145
4167
  return /* @__PURE__ */ r(
@@ -4168,10 +4190,10 @@ function zo({
4168
4190
  children: "🛰 LL debug"
4169
4191
  }
4170
4192
  );
4171
- const C = o.filter((g) => {
4193
+ const C = o.filter((y) => {
4172
4194
  if (!a) return !0;
4173
4195
  const w = a.toLowerCase();
4174
- return g.type.toLowerCase().includes(w) || JSON.stringify(g.data || {}).toLowerCase().includes(w);
4196
+ return y.type.toLowerCase().includes(w) || JSON.stringify(y.data || {}).toLowerCase().includes(w);
4175
4197
  });
4176
4198
  return /* @__PURE__ */ S(
4177
4199
  "div",
@@ -4218,10 +4240,10 @@ function zo({
4218
4240
  "button",
4219
4241
  {
4220
4242
  type: "button",
4221
- onClick: () => m((g) => !g),
4222
- style: tn(u ? "#f59e0b" : "transparent"),
4243
+ onClick: () => g((y) => !y),
4244
+ style: tn(d ? "#f59e0b" : "transparent"),
4223
4245
  title: "Pause / resume capture",
4224
- children: u ? "▶ resume" : "⏸ pause"
4246
+ children: d ? "▶ resume" : "⏸ pause"
4225
4247
  }
4226
4248
  ),
4227
4249
  /* @__PURE__ */ r(
@@ -4229,7 +4251,7 @@ function zo({
4229
4251
  {
4230
4252
  type: "button",
4231
4253
  onClick: () => {
4232
- s([]), h.current = [];
4254
+ s([]), m.current = [];
4233
4255
  },
4234
4256
  style: tn("transparent"),
4235
4257
  title: "Clear buffer",
@@ -4255,7 +4277,7 @@ function zo({
4255
4277
  {
4256
4278
  type: "text",
4257
4279
  value: a,
4258
- onChange: (g) => c(g.target.value),
4280
+ onChange: (y) => c(y.target.value),
4259
4281
  placeholder: "filter by type or data…",
4260
4282
  style: {
4261
4283
  margin: 8,
@@ -4307,16 +4329,16 @@ function zo({
4307
4329
  )
4308
4330
  ]
4309
4331
  }
4310
- ) : C.map((g) => /* @__PURE__ */ r(
4332
+ ) : C.map((y) => /* @__PURE__ */ r(
4311
4333
  Lo,
4312
4334
  {
4313
- entry: g,
4314
- expanded: p.current.has(g.id),
4335
+ entry: y,
4336
+ expanded: p.current.has(y.id),
4315
4337
  onToggle: () => {
4316
- p.current.has(g.id) ? p.current.delete(g.id) : p.current.add(g.id), s((w) => [...w]);
4338
+ p.current.has(y.id) ? p.current.delete(y.id) : p.current.add(y.id), s((w) => [...w]);
4317
4339
  }
4318
4340
  },
4319
- g.id
4341
+ y.id
4320
4342
  ))
4321
4343
  }
4322
4344
  )
@@ -4405,22 +4427,22 @@ function tn(e) {
4405
4427
  cursor: "pointer"
4406
4428
  };
4407
4429
  }
4408
- function ko(e) {
4430
+ function Co(e) {
4409
4431
  try {
4410
4432
  return e instanceof Error ? { message: e.message, stack: e.stack } : (JSON.stringify(e), e);
4411
4433
  } catch {
4412
4434
  return String(e);
4413
4435
  }
4414
4436
  }
4415
- function Co(e) {
4437
+ function So(e) {
4416
4438
  const t = JSON.stringify(e);
4417
- I(() => Mr(e), [t]);
4439
+ I(() => Ir(e), [t]);
4418
4440
  }
4419
- function $o({ fields: e, children: t }) {
4420
- return Co(e), /* @__PURE__ */ r(Ve, { children: t });
4441
+ function Ho({ fields: e, children: t }) {
4442
+ return So(e), /* @__PURE__ */ r(Ve, { children: t });
4421
4443
  }
4422
- function Ho() {
4423
- const [e, t] = M([]), n = k((l) => {
4444
+ function Oo() {
4445
+ const [e, t] = M([]), n = L((l) => {
4424
4446
  t((o) => {
4425
4447
  const s = o.findIndex((a) => a.id === l.id);
4426
4448
  if (s >= 0) {
@@ -4429,7 +4451,7 @@ function Ho() {
4429
4451
  }
4430
4452
  return [...o, l];
4431
4453
  });
4432
- }, []), i = k(() => t([]), []);
4454
+ }, []), i = L(() => t([]), []);
4433
4455
  return {
4434
4456
  entries: e,
4435
4457
  pushSegment: n,
@@ -4438,38 +4460,38 @@ function Ho() {
4438
4460
  };
4439
4461
  }
4440
4462
  export {
4441
- xo as AvatarWidget,
4442
- Rr as ErrorBoundary,
4443
- $o as FieldProvider,
4444
- zo as LiveLayerDebugPanel,
4463
+ ko as AvatarWidget,
4464
+ Pr as ErrorBoundary,
4465
+ Ho as FieldProvider,
4466
+ $o as LiveLayerDebugPanel,
4445
4467
  Do as LiveLayerRegion,
4446
- Ro as LiveLayerWidget,
4447
- Bo as clearFieldRegistry,
4448
- to as clearPageContextCache,
4449
- ao as clearRoutesCache,
4450
- Qi as extractPageContext,
4451
- oo as extractRoutes,
4452
- Gn as getCachedPageContext,
4468
+ Po as LiveLayerWidget,
4469
+ Wo as clearFieldRegistry,
4470
+ no as clearPageContextCache,
4471
+ so as clearRoutesCache,
4472
+ eo as extractPageContext,
4473
+ lo as extractRoutes,
4474
+ Xn as getCachedPageContext,
4453
4475
  Qt as getCachedRoutes,
4454
- Wo as getRegisteredFields,
4455
- si as matchesPattern,
4456
- ro as normalizeRouteInput,
4457
- qo as registerFields,
4458
- Uo as setFieldValue,
4459
- ci as shouldRenderAtPath,
4460
- Wr as useAgentInfo,
4461
- Pr as useAudioLevel,
4462
- Or as useCameraState,
4463
- Po as useCollect,
4464
- Ur as useDisplayMode,
4465
- Yr as useDisplayModePersistence,
4466
- Xr as useIsMobile,
4476
+ qo as getRegisteredFields,
4477
+ ci as matchesPattern,
4478
+ io as normalizeRouteInput,
4479
+ Uo as registerFields,
4480
+ jo as setFieldValue,
4481
+ ui as shouldRenderAtPath,
4482
+ qr as useAgentInfo,
4483
+ zr as useAudioLevel,
4484
+ Fr as useCameraState,
4485
+ zo as useCollect,
4486
+ jr as useDisplayMode,
4487
+ Gr as useDisplayModePersistence,
4488
+ Kr as useIsMobile,
4467
4489
  Dr as useLiveKitSession,
4468
- Br as useMediaDevices,
4469
- $r as useMicrophoneState,
4470
- ri as usePathname,
4471
- Co as useRegisterFields,
4472
- ui as useRouteMatch,
4473
- Fr as useScreenShareState,
4474
- Ho as useTranscript
4490
+ Wr as useMediaDevices,
4491
+ Hr as useMicrophoneState,
4492
+ ii as usePathname,
4493
+ So as useRegisterFields,
4494
+ di as useRouteMatch,
4495
+ Br as useScreenShareState,
4496
+ Oo as useTranscript
4475
4497
  };