@livelayer/react 0.5.5 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -13,8 +13,8 @@ class mn extends dn {
13
13
  return { hasError: !0, error: t };
14
14
  }
15
15
  componentDidCatch(t, r) {
16
- var o, i;
17
- (i = (o = this.props).onError) == null || i.call(o, t, r);
16
+ var i, o;
17
+ (o = (i = this.props).onError) == null || o.call(i, t, r);
18
18
  }
19
19
  render() {
20
20
  var t;
@@ -34,18 +34,18 @@ class mn extends dn {
34
34
  }
35
35
  }
36
36
  function gn(e) {
37
- const [t, r] = S("idle"), [o, i] = S("idle"), [l, s] = S([]), [d, u] = S(null), [m, h] = S(null), [a, c] = S(null), [R, C] = S(!1), [L, v] = S(null), b = E(null), z = E(e.onDataMessage);
37
+ const [t, r] = S("idle"), [i, o] = S("idle"), [l, s] = S([]), [d, f] = S(null), [g, m] = S(null), [a, c] = S(null), [R, C] = S(!1), [L, v] = S(null), b = E(null), z = E(e.onDataMessage);
38
38
  z.current = e.onDataMessage, T(() => {
39
39
  const N = {
40
40
  onConnectionStateChange: (D) => {
41
41
  r(D), D === "connected" && v(null);
42
42
  },
43
- onAgentStateChange: i,
43
+ onAgentStateChange: o,
44
44
  onTranscript: (D) => s([...D]),
45
- onAgentConfig: u,
45
+ onAgentConfig: f,
46
46
  onAudioTrack: (D) => c(D),
47
- onVideoTrack: (D) => h(D),
48
- onVideoTrackRemoved: () => h(null),
47
+ onVideoTrack: (D) => m(D),
48
+ onVideoTrackRemoved: () => m(null),
49
49
  onError: (D) => v(D),
50
50
  onDataMessage: (D) => {
51
51
  var A;
@@ -62,7 +62,7 @@ function gn(e) {
62
62
  },
63
63
  N
64
64
  );
65
- return b.current = B, r("idle"), i("idle"), s([]), u(null), h(null), c(null), C(!1), v(null), () => {
65
+ return b.current = B, r("idle"), o("idle"), s([]), f(null), m(null), c(null), C(!1), v(null), () => {
66
66
  var D;
67
67
  (D = B.destroy) == null || D.call(B), b.current = null;
68
68
  };
@@ -90,10 +90,10 @@ function gn(e) {
90
90
  }, []);
91
91
  return {
92
92
  connectionState: t,
93
- agentState: o,
93
+ agentState: i,
94
94
  transcript: l,
95
95
  agentConfig: d,
96
- videoElement: m,
96
+ videoElement: g,
97
97
  audioElement: a,
98
98
  canResume: R,
99
99
  error: L,
@@ -104,10 +104,10 @@ function gn(e) {
104
104
  };
105
105
  }
106
106
  function yn() {
107
- const e = E(null), t = E(null), r = E(null), o = E(null), i = E(/* @__PURE__ */ new Set()), l = E(null), s = k(() => {
107
+ const e = E(null), t = E(null), r = E(null), i = E(null), o = E(/* @__PURE__ */ new Set()), l = E(null), s = k(() => {
108
108
  const a = t.current;
109
109
  if (!a) {
110
- o.current = null;
110
+ i.current = null;
111
111
  return;
112
112
  }
113
113
  (!l.current || l.current.length !== a.frequencyBinCount) && (l.current = new Uint8Array(
@@ -118,18 +118,18 @@ function yn() {
118
118
  let R = 0;
119
119
  for (let L = 0; L < c.length; L++) R += c[L];
120
120
  const C = R / c.length / 255;
121
- for (const L of i.current)
121
+ for (const L of o.current)
122
122
  try {
123
123
  L(C);
124
124
  } catch (v) {
125
125
  console.error("[useAudioLevel] subscriber threw:", v);
126
126
  }
127
- o.current = requestAnimationFrame(s);
127
+ i.current = requestAnimationFrame(s);
128
128
  }, []), d = k(() => {
129
129
  if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
130
130
  const a = new AudioContext(), c = a.createAnalyser();
131
131
  c.fftSize = 64, c.connect(a.destination), e.current = a, t.current = c;
132
- }, []), u = k(
132
+ }, []), f = k(
133
133
  (a) => {
134
134
  if (d(), !(!e.current || !t.current)) {
135
135
  if (r.current) {
@@ -146,23 +146,23 @@ function yn() {
146
146
  console.warn("[useAudioLevel] createMediaElementSource failed:", c);
147
147
  return;
148
148
  }
149
- o.current === null && (o.current = requestAnimationFrame(s));
149
+ i.current === null && (i.current = requestAnimationFrame(s));
150
150
  }
151
151
  },
152
152
  [d, s]
153
- ), m = k(() => {
154
- if (o.current !== null && (cancelAnimationFrame(o.current), o.current = null), r.current) {
153
+ ), g = k(() => {
154
+ if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), r.current) {
155
155
  try {
156
156
  r.current.disconnect();
157
157
  } catch {
158
158
  }
159
159
  r.current = null;
160
160
  }
161
- }, []), h = k((a) => (i.current.add(a), () => {
162
- i.current.delete(a);
161
+ }, []), m = k((a) => (o.current.add(a), () => {
162
+ o.current.delete(a);
163
163
  }), []);
164
164
  return T(() => () => {
165
- if (m(), t.current) {
165
+ if (g(), t.current) {
166
166
  try {
167
167
  t.current.disconnect();
168
168
  } catch {
@@ -176,58 +176,58 @@ function yn() {
176
176
  }
177
177
  e.current = null;
178
178
  }
179
- i.current.clear(), l.current = null;
180
- }, [m]), { attach: u, detach: m, subscribe: h };
179
+ o.current.clear(), l.current = null;
180
+ }, [g]), { attach: f, detach: g, subscribe: m };
181
181
  }
182
182
  function vn() {
183
- const [e, t] = S(!1), [r, o] = S(null), i = E(null), l = E(null), s = k(async (h) => {
184
- if (i.current && l.current) {
183
+ const [e, t] = S(!1), [r, i] = S(null), o = E(null), l = E(null), s = k(async (m) => {
184
+ if (o.current && l.current) {
185
185
  try {
186
- await l.current.localParticipant.unpublishTrack(i.current);
186
+ await l.current.localParticipant.unpublishTrack(o.current);
187
187
  } catch {
188
188
  }
189
- i.current.stop(), i.current = null;
189
+ o.current.stop(), o.current = null;
190
190
  }
191
- l.current = h, o(null);
191
+ l.current = m, i(null);
192
192
  try {
193
193
  const a = await pn({
194
194
  echoCancellation: !0,
195
195
  noiseSuppression: !0
196
196
  });
197
- await h.localParticipant.publishTrack(a), i.current = a, t(a.isMuted);
197
+ await m.localParticipant.publishTrack(a), o.current = a, t(a.isMuted);
198
198
  } catch (a) {
199
199
  const c = a instanceof Error && a.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
200
- throw o(c), a;
200
+ throw i(c), a;
201
201
  }
202
202
  }, []), d = k(() => {
203
- const h = i.current;
204
- h && (h.isMuted ? (h.unmute(), t(!1)) : (h.mute(), t(!0)));
205
- }, []), u = k(() => {
206
- const h = i.current, a = l.current;
207
- if (h && a) {
203
+ const m = o.current;
204
+ m && (m.isMuted ? (m.unmute(), t(!1)) : (m.mute(), t(!0)));
205
+ }, []), f = k(() => {
206
+ const m = o.current, a = l.current;
207
+ if (m && a) {
208
208
  try {
209
- a.localParticipant.unpublishTrack(h);
209
+ a.localParticipant.unpublishTrack(m);
210
210
  } catch {
211
211
  }
212
- h.stop();
212
+ m.stop();
213
213
  }
214
- i.current = null, l.current = null, t(!1);
215
- }, []), m = k(() => o(null), []);
214
+ o.current = null, l.current = null, t(!1);
215
+ }, []), g = k(() => i(null), []);
216
216
  return {
217
217
  isMuted: e,
218
218
  micError: r,
219
219
  toggleMute: d,
220
220
  setupMic: s,
221
- teardownMic: u,
222
- clearError: m
221
+ teardownMic: f,
222
+ clearError: g
223
223
  };
224
224
  }
225
225
  const bn = { resolution: { width: 640, height: 480, frameRate: 24 } };
226
226
  function wn() {
227
- const [e, t] = S(!1), [r, o] = S(null), [i, l] = S(null), [s, d] = S(""), u = E(null), m = E(null), h = k((b) => {
228
- u.current = b;
227
+ const [e, t] = S(!1), [r, i] = S(null), [o, l] = S(null), [s, d] = S(""), f = E(null), g = E(null), m = k((b) => {
228
+ f.current = b;
229
229
  }, []), a = k(() => {
230
- const b = u.current, z = m.current;
230
+ const b = f.current, z = g.current;
231
231
  if (z && b) {
232
232
  const I = b.localParticipant.getTrackPublication(jt.Source.Camera);
233
233
  if (I != null && I.track) {
@@ -239,16 +239,16 @@ function wn() {
239
239
  } else
240
240
  z.stop();
241
241
  }
242
- m.current = null, l(null), t(!1);
242
+ g.current = null, l(null), t(!1);
243
243
  }, []), c = k(async (b) => {
244
- const z = u.current;
244
+ const z = f.current;
245
245
  if (z) {
246
- o(null);
246
+ i(null);
247
247
  try {
248
248
  const I = { ...bn };
249
249
  b && (I.deviceId = b);
250
250
  const H = await hn(I);
251
- await z.localParticipant.publishTrack(H), m.current = H;
251
+ await z.localParticipant.publishTrack(H), g.current = H;
252
252
  const p = H.attach();
253
253
  l(p), t(!0), b && d(b);
254
254
  try {
@@ -260,7 +260,7 @@ function wn() {
260
260
  }
261
261
  } catch (I) {
262
262
  const H = I instanceof Error && I.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
263
- o(H);
263
+ i(H);
264
264
  }
265
265
  }
266
266
  }, []), R = k(async () => {
@@ -268,26 +268,26 @@ function wn() {
268
268
  }, [e, s, a, c]), C = k(async (b) => {
269
269
  a(), await c(b);
270
270
  }, [a, c]), L = k(() => {
271
- a(), u.current = null, o(null), d("");
272
- }, [a]), v = k(() => o(null), []);
271
+ a(), f.current = null, i(null), d("");
272
+ }, [a]), v = k(() => i(null), []);
273
273
  return T(() => () => {
274
- m.current && m.current.stop();
274
+ g.current && g.current.stop();
275
275
  }, []), {
276
276
  isEnabled: e,
277
277
  error: r,
278
- previewEl: i,
278
+ previewEl: o,
279
279
  activeDeviceId: s,
280
280
  toggle: R,
281
281
  switchDevice: C,
282
- attachRoom: h,
282
+ attachRoom: m,
283
283
  teardown: L,
284
284
  clearError: v
285
285
  };
286
286
  }
287
287
  function _n() {
288
- const [e, t] = S(!1), [r, o] = S(null), [i, l] = S(null), s = E(null), d = k((c) => {
288
+ const [e, t] = S(!1), [r, i] = S(null), [o, l] = S(null), s = E(null), d = k((c) => {
289
289
  s.current = c;
290
- }, []), u = k(() => l(null), []), m = k(async () => {
290
+ }, []), f = k(() => l(null), []), g = k(async () => {
291
291
  const c = s.current;
292
292
  if (c) {
293
293
  if (e) {
@@ -295,10 +295,10 @@ function _n() {
295
295
  await c.localParticipant.setScreenShareEnabled(!1);
296
296
  } catch {
297
297
  }
298
- u(), t(!1);
298
+ f(), t(!1);
299
299
  return;
300
300
  }
301
- o(null);
301
+ i(null);
302
302
  try {
303
303
  await c.localParticipant.setScreenShareEnabled(!0);
304
304
  let R = 0;
@@ -321,45 +321,45 @@ function _n() {
321
321
  C();
322
322
  } catch (R) {
323
323
  const C = R instanceof Error ? R.name : "";
324
- C !== "NotAllowedError" && C !== "AbortError" && o("Screen share unavailable. Try again."), t(!1);
324
+ C !== "NotAllowedError" && C !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
325
325
  }
326
326
  }
327
- }, [e, u]), h = k(() => {
327
+ }, [e, f]), m = k(() => {
328
328
  const c = s.current;
329
329
  if (c && e)
330
330
  try {
331
331
  c.localParticipant.setScreenShareEnabled(!1);
332
332
  } catch {
333
333
  }
334
- u(), t(!1), o(null), s.current = null;
335
- }, [e, u]), a = k(() => o(null), []);
336
- return { isEnabled: e, error: r, previewEl: i, toggle: m, attachRoom: d, teardown: h, clearError: a };
334
+ f(), t(!1), i(null), s.current = null;
335
+ }, [e, f]), a = k(() => i(null), []);
336
+ return { isEnabled: e, error: r, previewEl: o, toggle: g, attachRoom: d, teardown: m, clearError: a };
337
337
  }
338
338
  function xn() {
339
- const [e, t] = S([]), [r, o] = S([]), i = k(async () => {
339
+ const [e, t] = S([]), [r, i] = S([]), o = k(async () => {
340
340
  if (!(typeof navigator > "u" || !navigator.mediaDevices))
341
341
  try {
342
342
  const l = await navigator.mediaDevices.enumerateDevices();
343
- t(l.filter((s) => s.kind === "audioinput")), o(l.filter((s) => s.kind === "videoinput"));
343
+ t(l.filter((s) => s.kind === "audioinput")), i(l.filter((s) => s.kind === "videoinput"));
344
344
  } catch {
345
345
  }
346
346
  }, []);
347
347
  return T(() => {
348
- if (i(), typeof navigator > "u" || !navigator.mediaDevices) return;
349
- const l = () => void i();
348
+ if (o(), typeof navigator > "u" || !navigator.mediaDevices) return;
349
+ const l = () => void o();
350
350
  return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
351
- }, [i]), { mics: e, cameras: r, refresh: i };
351
+ }, [o]), { mics: e, cameras: r, refresh: o };
352
352
  }
353
353
  function kn(e, t, r = !1) {
354
- const [o, i] = S(null), [l, s] = S(null), [d, u] = S(!r && !!e);
354
+ const [i, o] = S(null), [l, s] = S(null), [d, f] = S(!r && !!e);
355
355
  return T(() => {
356
356
  if (r || !e) {
357
- u(!1);
357
+ f(!1);
358
358
  return;
359
359
  }
360
- const m = new AbortController(), h = t || "https://app.livelayer.studio";
361
- return u(!0), s(null), fetch(`${h}/api/widget/agent/${encodeURIComponent(e)}`, {
362
- signal: m.signal
360
+ const g = new AbortController(), m = t || "https://app.livelayer.studio";
361
+ return f(!0), s(null), fetch(`${m}/api/widget/agent/${encodeURIComponent(e)}`, {
362
+ signal: g.signal
363
363
  }).then(async (a) => {
364
364
  if (!a.ok) {
365
365
  const c = await a.json().catch(() => ({}));
@@ -367,11 +367,11 @@ function kn(e, t, r = !1) {
367
367
  }
368
368
  return a.json();
369
369
  }).then((a) => {
370
- m.signal.aborted || (i(a), u(!1));
370
+ g.signal.aborted || (o(a), f(!1));
371
371
  }).catch((a) => {
372
- m.signal.aborted || (s(a instanceof Error ? a.message : "Agent lookup failed"), u(!1));
373
- }), () => m.abort();
374
- }, [e, t, r]), { info: o, error: l, loading: d };
372
+ g.signal.aborted || (s(a instanceof Error ? a.message : "Agent lookup failed"), f(!1));
373
+ }), () => g.abort();
374
+ }, [e, t, r]), { info: i, error: l, loading: d };
375
375
  }
376
376
  function Ln(e) {
377
377
  if (typeof window > "u") return null;
@@ -393,11 +393,11 @@ function Cn({
393
393
  defaultValue: t = "expanded",
394
394
  onChange: r
395
395
  } = {}) {
396
- const o = e !== void 0, [i, l] = S(t), s = o ? e : i, d = k(
397
- (u) => {
398
- u !== s && (o || l(u), r == null || r(u));
396
+ const i = e !== void 0, [o, l] = S(t), s = i ? e : o, d = k(
397
+ (f) => {
398
+ f !== s && (i || l(f), r == null || r(f));
399
399
  },
400
- [s, o, r]
400
+ [s, i, r]
401
401
  );
402
402
  return [s, d];
403
403
  }
@@ -409,21 +409,21 @@ function An({
409
409
  value: e,
410
410
  defaultValue: t = "expanded",
411
411
  onChange: r,
412
- persistKey: o = "ll-widget",
413
- disablePersistence: i = !1
412
+ persistKey: i = "ll-widget",
413
+ disablePersistence: o = !1
414
414
  } = {}) {
415
- const l = `${o}:display-mode`, s = E(!1), [d, u] = Cn({
415
+ const l = `${i}:display-mode`, s = E(!1), [d, f] = Cn({
416
416
  value: e,
417
417
  defaultValue: t,
418
- onChange: (m) => {
419
- e === void 0 && !i && Sn(l, m), r == null || r(m);
418
+ onChange: (g) => {
419
+ e === void 0 && !o && Sn(l, g), r == null || r(g);
420
420
  }
421
421
  });
422
422
  return T(() => {
423
- if (s.current || (s.current = !0, i || e !== void 0)) return;
424
- const m = Nn(Ln(l));
425
- m && m !== d && u(m);
426
- }, []), [d, u];
423
+ if (s.current || (s.current = !0, o || e !== void 0)) return;
424
+ const g = Nn(Ln(l));
425
+ g && g !== d && f(g);
426
+ }, []), [d, f];
427
427
  }
428
428
  const Rn = 640;
429
429
  function In(e = Rn) {
@@ -435,9 +435,9 @@ function In(e = Rn) {
435
435
  }
436
436
  if (typeof window > "u" || typeof window.matchMedia > "u")
437
437
  return;
438
- const o = `(max-width: ${e - 1}px)`, i = window.matchMedia(o), l = () => r(i.matches);
439
- return l(), typeof i.addEventListener == "function" ? (i.addEventListener("change", l), () => i.removeEventListener("change", l)) : (i.addListener(l), () => {
440
- i.removeListener(l);
438
+ const i = `(max-width: ${e - 1}px)`, o = window.matchMedia(i), l = () => r(o.matches);
439
+ return l(), typeof o.addEventListener == "function" ? (o.addEventListener("change", l), () => o.removeEventListener("change", l)) : (o.addListener(l), () => {
440
+ o.removeListener(l);
441
441
  });
442
442
  }, [e]), t;
443
443
  }
@@ -446,11 +446,11 @@ function Mn() {
446
446
  if (typeof window > "u" || window.history[Nt]) return;
447
447
  const e = window.history.pushState, t = window.history.replaceState;
448
448
  window.history.pushState = function(...r) {
449
- const o = e.apply(this, r);
450
- return window.dispatchEvent(new Event(et)), o;
449
+ const i = e.apply(this, r);
450
+ return window.dispatchEvent(new Event(et)), i;
451
451
  }, window.history.replaceState = function(...r) {
452
- const o = t.apply(this, r);
453
- return window.dispatchEvent(new Event(et)), o;
452
+ const i = t.apply(this, r);
453
+ return window.dispatchEvent(new Event(et)), i;
454
454
  }, window.history[Nt] = !0;
455
455
  }
456
456
  function At() {
@@ -463,9 +463,9 @@ function Tn(e) {
463
463
  return T(() => {
464
464
  if (e !== void 0) return;
465
465
  Mn();
466
- const o = () => r(At());
467
- return o(), window.addEventListener("popstate", o), window.addEventListener(et, o), () => {
468
- window.removeEventListener("popstate", o), window.removeEventListener(et, o);
466
+ const i = () => r(At());
467
+ return i(), window.addEventListener("popstate", i), window.addEventListener(et, i), () => {
468
+ window.removeEventListener("popstate", i), window.removeEventListener(et, i);
469
469
  };
470
470
  }, [e]), e ?? t;
471
471
  }
@@ -476,8 +476,8 @@ function Dn(e) {
476
476
  function $n(e) {
477
477
  const t = Rt.get(e);
478
478
  if (t) return t;
479
- const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, o = "", i = "", l = r.replace(/\*\*/g, o).replace(/\*/g, i), d = Dn(l).replace(new RegExp(`\\/${o}`, "g"), "(?:\\/.*)?").replace(new RegExp(o, "g"), ".*").replace(new RegExp(i, "g"), "[^/]+"), u = new RegExp(`^${d}\\/?$`);
480
- return Rt.set(e, u), u;
479
+ const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", o = "", l = r.replace(/\*\*/g, i).replace(/\*/g, o), d = Dn(l).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(o, "g"), "[^/]+"), f = new RegExp(`^${d}\\/?$`);
480
+ return Rt.set(e, f), f;
481
481
  }
482
482
  function zn(e, t) {
483
483
  const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
@@ -620,18 +620,18 @@ const Vn = ({
620
620
  position: e,
621
621
  isMobile: t,
622
622
  isSpeaking: r,
623
- onExpand: o,
624
- label: i = "Open widget",
623
+ onExpand: i,
624
+ label: o = "Open widget",
625
625
  avatarImageUrl: l,
626
626
  agentName: s
627
627
  }) => {
628
- const d = Fn(e), u = d === "right" ? "left" : "right", m = t ? 80 : 72, h = !!l, [a, c] = S(null), [R, C] = S(!1), L = E(null), v = E(!1), b = k(
628
+ const d = Fn(e), f = d === "right" ? "left" : "right", g = t ? 80 : 72, m = !!l, [a, c] = S(null), [R, C] = S(!1), L = E(null), v = E(!1), b = k(
629
629
  (A) => {
630
630
  if (typeof window > "u") return A;
631
- const O = m / 2, W = Dt + O, V = window.innerHeight - Dt - O;
632
- return V < W ? Math.max(W, A) : Math.max(W, Math.min(V, A));
631
+ const O = g / 2, W = Dt + O, Y = window.innerHeight - Dt - O;
632
+ return Y < W ? Math.max(W, A) : Math.max(W, Math.min(Y, A));
633
633
  },
634
- [m]
634
+ [g]
635
635
  );
636
636
  T(() => {
637
637
  const A = jn();
@@ -681,16 +681,16 @@ const Vn = ({
681
681
  v.current = !1;
682
682
  return;
683
683
  }
684
- o();
685
- }, [o]), N = k(
684
+ i();
685
+ }, [i]), N = k(
686
686
  (A) => {
687
687
  if (A.key === "ArrowUp" || A.key === "ArrowDown") {
688
688
  A.preventDefault();
689
689
  const O = A.key === "ArrowUp" ? -8 : 8;
690
690
  c((W) => {
691
691
  if (W === null) return W;
692
- const V = b(W + O);
693
- return $t(V), V;
692
+ const Y = b(W + O);
693
+ return $t(Y), Y;
694
694
  });
695
695
  }
696
696
  },
@@ -701,8 +701,8 @@ const Vn = ({
701
701
  t ? "ll-hidden--mobile" : "ll-hidden--desktop",
702
702
  r ? "ll-hidden--speaking" : null,
703
703
  R ? "is-dragging" : null,
704
- h ? "ll-hidden--with-avatar" : null
705
- ].filter(Boolean).join(" "), D = a === null ? void 0 : { top: `${a - m / 2}px`, transform: "none" };
704
+ m ? "ll-hidden--with-avatar" : null
705
+ ].filter(Boolean).join(" "), D = a === null ? void 0 : { top: `${a - g / 2}px`, transform: "none" };
706
706
  return /* @__PURE__ */ n(
707
707
  "button",
708
708
  {
@@ -714,10 +714,10 @@ const Vn = ({
714
714
  onPointerCancel: H,
715
715
  onClick: p,
716
716
  onKeyDown: N,
717
- "aria-label": i,
717
+ "aria-label": o,
718
718
  "data-position": e,
719
719
  style: D,
720
- children: h ? (
720
+ children: m ? (
721
721
  // Layout: tiny chevron flush against the inward edge (peeks out
722
722
  // as the click affordance), then the circular avatar photo
723
723
  // taking the rest of the tab. Reinforces "this is an
@@ -726,7 +726,7 @@ const Vn = ({
726
726
  /* @__PURE__ */ n(
727
727
  Pt,
728
728
  {
729
- direction: u,
729
+ direction: f,
730
730
  className: "ll-hidden__chevron ll-hidden__chevron--mini"
731
731
  }
732
732
  ),
@@ -743,7 +743,7 @@ const Vn = ({
743
743
  ) : /* @__PURE__ */ n(
744
744
  Pt,
745
745
  {
746
- direction: u,
746
+ direction: f,
747
747
  className: "ll-hidden__chevron"
748
748
  }
749
749
  )
@@ -753,45 +753,45 @@ const Vn = ({
753
753
  audioLevel: e,
754
754
  bars: t = 20,
755
755
  maxHeight: r = 20,
756
- minHeight: o = 4,
757
- className: i,
756
+ minHeight: i = 4,
757
+ className: o,
758
758
  barClassName: l
759
759
  }) => {
760
- const s = E(null), d = E([]), u = Ze(() => {
761
- const h = (Math.sqrt(5) - 1) / 2;
762
- return Array.from({ length: t }, (a, c) => 0.5 + c * h % 1 * 0.5);
760
+ const s = E(null), d = E([]), f = Ze(() => {
761
+ const m = (Math.sqrt(5) - 1) / 2;
762
+ return Array.from({ length: t }, (a, c) => 0.5 + c * m % 1 * 0.5);
763
763
  }, [t]);
764
764
  T(() => e.subscribe((a) => {
765
765
  for (let c = 0; c < t; c++) {
766
766
  const R = d.current[c];
767
767
  if (!R) continue;
768
- const C = Math.max(o, a * r * u[c]);
768
+ const C = Math.max(i, a * r * f[c]);
769
769
  R.style.height = `${C}px`;
770
770
  }
771
- }), [e, t, r, o, u]);
772
- const m = ["ll-waveform", i].filter(Boolean).join(" ");
773
- return /* @__PURE__ */ n("div", { ref: s, className: m, "aria-hidden": "true", children: Array.from({ length: t }, (h, a) => /* @__PURE__ */ n(
771
+ }), [e, t, r, i, f]);
772
+ const g = ["ll-waveform", o].filter(Boolean).join(" ");
773
+ return /* @__PURE__ */ n("div", { ref: s, className: g, "aria-hidden": "true", children: Array.from({ length: t }, (m, a) => /* @__PURE__ */ n(
774
774
  "div",
775
775
  {
776
776
  ref: (c) => {
777
777
  d.current[a] = c;
778
778
  },
779
779
  className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
780
- style: { height: `${o}px` }
780
+ style: { height: `${i}px` }
781
781
  },
782
782
  a
783
783
  )) });
784
- }, Gn = ({
784
+ }, Jn = ({
785
785
  position: e,
786
786
  isMobile: t,
787
787
  agentName: r,
788
- avatarImageUrl: o,
789
- agentState: i,
788
+ avatarImageUrl: i,
789
+ agentState: o,
790
790
  isMuted: l,
791
791
  audioLevel: s,
792
792
  onExpand: d,
793
- onToggleMute: u,
794
- onClose: m
793
+ onToggleMute: f,
794
+ onClose: g
795
795
  }) => t ? /* @__PURE__ */ n(
796
796
  "div",
797
797
  {
@@ -806,12 +806,12 @@ const Vn = ({
806
806
  onClick: d,
807
807
  "aria-label": `Expand ${r} widget`,
808
808
  children: [
809
- o ? (
809
+ i ? (
810
810
  // eslint-disable-next-line @next/next/no-img-element
811
811
  /* @__PURE__ */ n(
812
812
  "img",
813
813
  {
814
- src: o,
814
+ src: i,
815
815
  alt: r,
816
816
  className: "ll-minimized__avatar"
817
817
  }
@@ -834,11 +834,11 @@ const Vn = ({
834
834
  className: "ll-minimized__btn",
835
835
  role: "button",
836
836
  tabIndex: 0,
837
- onClick: (h) => {
838
- h.stopPropagation(), u();
837
+ onClick: (m) => {
838
+ m.stopPropagation(), f();
839
839
  },
840
- onKeyDown: (h) => {
841
- (h.key === "Enter" || h.key === " ") && (h.stopPropagation(), h.preventDefault(), u());
840
+ onKeyDown: (m) => {
841
+ (m.key === "Enter" || m.key === " ") && (m.stopPropagation(), m.preventDefault(), f());
842
842
  },
843
843
  "aria-label": l ? "Unmute microphone" : "Mute microphone",
844
844
  children: /* @__PURE__ */ n(Mt, { muted: l, className: "ll-minimized__icon" })
@@ -858,12 +858,12 @@ const Vn = ({
858
858
  role: "region",
859
859
  "aria-label": `${r} widget`,
860
860
  children: /* @__PURE__ */ w("div", { className: "ll-minimized__surface", children: [
861
- o ? (
861
+ i ? (
862
862
  // eslint-disable-next-line @next/next/no-img-element
863
863
  /* @__PURE__ */ n(
864
864
  "img",
865
865
  {
866
- src: o,
866
+ src: i,
867
867
  alt: r,
868
868
  className: "ll-minimized__avatar"
869
869
  }
@@ -871,7 +871,7 @@ const Vn = ({
871
871
  ) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
872
872
  /* @__PURE__ */ w("div", { className: "ll-minimized__meta", children: [
873
873
  /* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
874
- /* @__PURE__ */ n("span", { className: "ll-minimized__state", children: i === "speaking" ? "Speaking" : i === "thinking" ? "Thinking" : "Listening" })
874
+ /* @__PURE__ */ n("span", { className: "ll-minimized__state", children: o === "speaking" ? "Speaking" : o === "thinking" ? "Thinking" : "Listening" })
875
875
  ] }),
876
876
  /* @__PURE__ */ w("div", { className: "ll-minimized__controls", children: [
877
877
  /* @__PURE__ */ n(
@@ -879,7 +879,7 @@ const Vn = ({
879
879
  {
880
880
  type: "button",
881
881
  className: "ll-minimized__btn",
882
- onClick: u,
882
+ onClick: f,
883
883
  "aria-label": l ? "Unmute microphone" : "Mute microphone",
884
884
  children: /* @__PURE__ */ n(Mt, { muted: l, className: "ll-minimized__icon" })
885
885
  }
@@ -899,7 +899,7 @@ const Vn = ({
899
899
  {
900
900
  type: "button",
901
901
  className: "ll-minimized__btn ll-minimized__btn--close",
902
- onClick: m,
902
+ onClick: g,
903
903
  "aria-label": "Close widget",
904
904
  children: /* @__PURE__ */ n(Bn, { className: "ll-minimized__icon" })
905
905
  }
@@ -907,18 +907,18 @@ const Vn = ({
907
907
  ] })
908
908
  ] })
909
909
  }
910
- ), Jn = ({
910
+ ), Gn = ({
911
911
  src: e,
912
912
  alt: t,
913
913
  preCannedPlaying: r = !1,
914
- className: o,
915
- style: i
914
+ className: i,
915
+ style: o
916
916
  }) => {
917
917
  const [l, s] = S(!1), d = E(e);
918
918
  if (T(() => {
919
919
  d.current !== e && (d.current = e, s(!1));
920
920
  }, [e]), !e) return null;
921
- const u = {
921
+ const f = {
922
922
  position: "absolute",
923
923
  inset: 0,
924
924
  width: "100%",
@@ -928,7 +928,7 @@ const Vn = ({
928
928
  transition: "opacity 500ms ease, transform 500ms ease",
929
929
  transform: r ? "scale(1.02)" : "scale(1)",
930
930
  opacity: l ? 1 : 0,
931
- ...i
931
+ ...o
932
932
  };
933
933
  return (
934
934
  // eslint-disable-next-line @next/next/no-img-element
@@ -937,10 +937,10 @@ const Vn = ({
937
937
  {
938
938
  src: e,
939
939
  alt: t,
940
- className: o,
941
- style: u,
940
+ className: i,
941
+ style: f,
942
942
  loading: "eager",
943
- fetchpriority: "high",
943
+ fetchPriority: "high",
944
944
  onLoad: () => s(!0)
945
945
  }
946
946
  )
@@ -949,14 +949,14 @@ const Vn = ({
949
949
  position: e,
950
950
  isMobile: t,
951
951
  agentName: r,
952
- avatarImageUrl: o,
953
- idleLoopUrl: i,
952
+ avatarImageUrl: i,
953
+ idleLoopUrl: o,
954
954
  greeting: l,
955
955
  branding: s,
956
956
  teamMembers: d,
957
- currentTeamMemberId: u,
958
- isSwitchingTeamMember: m,
959
- teamSwitcherOpen: h,
957
+ currentTeamMemberId: f,
958
+ isSwitchingTeamMember: g,
959
+ teamSwitcherOpen: m,
960
960
  onToggleTeamSwitcher: a,
961
961
  onSelectTeamMember: c,
962
962
  languageMenuOpen: R,
@@ -974,85 +974,85 @@ const Vn = ({
974
974
  cameraPreviewEl: A,
975
975
  cameraDevices: O,
976
976
  activeCameraId: W,
977
- isScreenShareEnabled: V,
977
+ isScreenShareEnabled: Y,
978
978
  screenPreviewEl: te,
979
979
  isSpeakerMuted: ue,
980
- allowCamera: He,
981
- allowScreenShare: Oe,
982
- allowTyping: qe,
983
- avatarVideoContainerRef: Be,
984
- onConnect: me,
985
- onDisconnect: ge,
986
- onRetry: ye,
987
- onResumeAudio: ve,
988
- onToggleMute: be,
989
- onToggleCamera: we,
990
- onSwitchCameraDevice: _e,
991
- onToggleScreenShare: xe,
980
+ allowCamera: qe,
981
+ allowScreenShare: Be,
982
+ allowTyping: We,
983
+ avatarVideoContainerRef: Fe,
984
+ onConnect: ge,
985
+ onDisconnect: ye,
986
+ onRetry: ve,
987
+ onResumeAudio: be,
988
+ onToggleMute: we,
989
+ onToggleCamera: _e,
990
+ onSwitchCameraDevice: xe,
991
+ onToggleScreenShare: ke,
992
992
  onToggleSpeaker: j,
993
- onSendMessage: We,
994
- onMinimize: Fe,
995
- onClose: Ue,
996
- onClearMicError: je
993
+ onSendMessage: Ue,
994
+ onMinimize: je,
995
+ onClose: Ve,
996
+ onClearMicError: fe
997
997
  }) => {
998
- var Se;
999
- const ae = b.length > 0 ? b[b.length - 1] : null, ie = ((d == null ? void 0 : d.length) ?? 0) > 1, ke = L === "connecting" || L === "connected", Le = L === "connected", fe = L === "idle" || L === "disconnected" || L === "error", J = E(null), Re = E(null);
998
+ var Ce;
999
+ const ae = b.length > 0 ? b[b.length - 1] : null, oe = ((d == null ? void 0 : d.length) ?? 0) > 1, Le = L === "connecting" || L === "connected", Se = L === "connected", pe = L === "idle" || L === "disconnected" || L === "error", K = E(null), Me = E(null);
1000
1000
  T(() => {
1001
- const y = J.current;
1001
+ const y = K.current;
1002
1002
  y && (y.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "cover", A.style.transform = "scaleX(-1)", y.appendChild(A)));
1003
1003
  }, [A]), T(() => {
1004
- const y = Re.current;
1004
+ const y = Me.current;
1005
1005
  y && (y.innerHTML = "", te && (te.style.width = "100%", te.style.height = "100%", te.style.objectFit = "contain", y.appendChild(te)));
1006
1006
  }, [te]);
1007
1007
  const [ne, ee] = S(!1), [le, ce] = S(!1);
1008
1008
  T(() => {
1009
- if (!ne && !le && !R && !h) return;
1009
+ if (!ne && !le && !R && !m) return;
1010
1010
  const y = () => {
1011
- ee(!1), ce(!1), R && C(), h && a();
1011
+ ee(!1), ce(!1), R && C(), m && a();
1012
1012
  };
1013
1013
  return document.addEventListener("click", y), () => document.removeEventListener("click", y);
1014
1014
  }, [
1015
1015
  ne,
1016
1016
  le,
1017
1017
  R,
1018
- h,
1018
+ m,
1019
1019
  C,
1020
1020
  a
1021
1021
  ]);
1022
- const [Q, re] = S(""), pe = k(
1022
+ const [Z, re] = S(""), he = k(
1023
1023
  (y) => {
1024
1024
  y.preventDefault();
1025
- const K = Q.trim();
1026
- K && (We(K), re(""));
1025
+ const X = Z.trim();
1026
+ X && (Ue(X), re(""));
1027
1027
  },
1028
- [Q, We]
1029
- ), Ie = s.productName || "Live Layer", Ve = Le && (ae != null && ae.text) ? ae.text : l || "", Me = [
1028
+ [Z, Ue]
1029
+ ), Te = s.productName || "Live Layer", Ye = Se && (ae != null && ae.text) ? ae.text : l || "", Pe = [
1030
1030
  "ll-expanded",
1031
1031
  t ? "ll-expanded--mobile" : "ll-expanded--desktop"
1032
1032
  ].join(" ");
1033
1033
  return /* @__PURE__ */ w(
1034
1034
  "div",
1035
1035
  {
1036
- className: Me,
1036
+ className: Pe,
1037
1037
  "data-position": e,
1038
- "data-state": Le ? "connected" : ke ? "connecting" : "idle",
1038
+ "data-state": Se ? "connected" : Le ? "connecting" : "idle",
1039
1039
  role: "dialog",
1040
1040
  "aria-label": `${r} widget`,
1041
1041
  children: [
1042
1042
  /* @__PURE__ */ w("div", { className: "ll-expanded__bg", children: [
1043
- o ? /* @__PURE__ */ n(
1044
- Jn,
1043
+ i ? /* @__PURE__ */ n(
1044
+ Gn,
1045
1045
  {
1046
- src: o,
1046
+ src: i,
1047
1047
  alt: r,
1048
1048
  className: "ll-expanded__bg-img"
1049
1049
  }
1050
- ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Se = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Se.toUpperCase()) || "A" }) }),
1051
- i && !Le && /* @__PURE__ */ n(
1050
+ ) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Ce = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Ce.toUpperCase()) || "A" }) }),
1051
+ o && !Se && /* @__PURE__ */ n(
1052
1052
  "video",
1053
1053
  {
1054
1054
  className: "ll-expanded__bg-idle",
1055
- src: i,
1055
+ src: o,
1056
1056
  autoPlay: !0,
1057
1057
  loop: !0,
1058
1058
  muted: !0,
@@ -1060,24 +1060,24 @@ const Vn = ({
1060
1060
  }
1061
1061
  )
1062
1062
  ] }),
1063
- /* @__PURE__ */ n("div", { ref: Be, className: "ll-expanded__video" }),
1063
+ /* @__PURE__ */ n("div", { ref: Fe, className: "ll-expanded__video" }),
1064
1064
  L === "connecting" && /* @__PURE__ */ w("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
1065
1065
  /* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
1066
- /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: m ? "Switching..." : "Connecting..." })
1066
+ /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: g ? "Switching..." : "Connecting..." })
1067
1067
  ] }),
1068
- I && Le && /* @__PURE__ */ w(
1068
+ I && Se && /* @__PURE__ */ w(
1069
1069
  "button",
1070
1070
  {
1071
1071
  type: "button",
1072
1072
  className: "ll-expanded__overlay ll-expanded__overlay--gesture",
1073
- onClick: ve,
1073
+ onClick: be,
1074
1074
  children: [
1075
1075
  /* @__PURE__ */ n("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("path", { d: "M3 9v6h4l5 5V4L7 9H3zm13.54.12a5 5 0 0 1 0 5.76l-1.41-1.41a3 3 0 0 0 0-2.94L16.54 9.12z" }) }),
1076
1076
  /* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
1077
1077
  ]
1078
1078
  }
1079
1079
  ),
1080
- ke ? /* @__PURE__ */ w("div", { className: "ll-expanded__topbar", children: [
1080
+ Le ? /* @__PURE__ */ w("div", { className: "ll-expanded__topbar", children: [
1081
1081
  /* @__PURE__ */ w("div", { className: "ll-expanded__topbar-left", children: [
1082
1082
  /* @__PURE__ */ w("div", { className: "ll-expanded__pill-wrap", children: [
1083
1083
  /* @__PURE__ */ w(
@@ -1086,17 +1086,17 @@ const Vn = ({
1086
1086
  type: "button",
1087
1087
  className: "ll-hpill",
1088
1088
  onClick: (y) => {
1089
- ie && (y.stopPropagation(), a());
1089
+ oe && (y.stopPropagation(), a());
1090
1090
  },
1091
- "aria-haspopup": ie ? "listbox" : void 0,
1092
- "aria-expanded": ie ? h : void 0,
1091
+ "aria-haspopup": oe ? "listbox" : void 0,
1092
+ "aria-expanded": oe ? m : void 0,
1093
1093
  children: [
1094
1094
  /* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
1095
- ie && /* @__PURE__ */ n(Xe, {})
1095
+ oe && /* @__PURE__ */ n(Xe, {})
1096
1096
  ]
1097
1097
  }
1098
1098
  ),
1099
- ie && h && /* @__PURE__ */ n(
1099
+ oe && m && /* @__PURE__ */ n(
1100
1100
  "div",
1101
1101
  {
1102
1102
  className: "ll-hmenu",
@@ -1106,10 +1106,10 @@ const Vn = ({
1106
1106
  "button",
1107
1107
  {
1108
1108
  type: "button",
1109
- className: `ll-hmenu__item ${y.id === u ? "is-active" : ""}`,
1109
+ className: `ll-hmenu__item ${y.id === f ? "is-active" : ""}`,
1110
1110
  onClick: () => c(y.id),
1111
1111
  role: "option",
1112
- "aria-selected": y.id === u,
1112
+ "aria-selected": y.id === f,
1113
1113
  children: [
1114
1114
  y.avatarImageUrl && /* @__PURE__ */ n(
1115
1115
  "img",
@@ -1180,7 +1180,7 @@ const Vn = ({
1180
1180
  {
1181
1181
  type: "button",
1182
1182
  className: "ll-hbtn",
1183
- onClick: Fe,
1183
+ onClick: je,
1184
1184
  "aria-label": "Minimize widget",
1185
1185
  title: "Minimize",
1186
1186
  children: /* @__PURE__ */ n(Ht, {})
@@ -1191,7 +1191,7 @@ const Vn = ({
1191
1191
  {
1192
1192
  type: "button",
1193
1193
  className: "ll-hbtn ll-hbtn--danger",
1194
- onClick: Ue,
1194
+ onClick: Ve,
1195
1195
  "aria-label": "End call",
1196
1196
  title: "End call",
1197
1197
  children: /* @__PURE__ */ n(zt, {})
@@ -1201,14 +1201,14 @@ const Vn = ({
1201
1201
  ] }) : (
1202
1202
  // Idle-state header with Live Layer product name + minimize/close
1203
1203
  /* @__PURE__ */ w("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
1204
- /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Ie }),
1204
+ /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Te }),
1205
1205
  /* @__PURE__ */ w("div", { className: "ll-expanded__header-actions", children: [
1206
1206
  /* @__PURE__ */ n(
1207
1207
  "button",
1208
1208
  {
1209
1209
  type: "button",
1210
1210
  className: "ll-hbtn ll-hbtn--ghost",
1211
- onClick: Fe,
1211
+ onClick: je,
1212
1212
  "aria-label": "Minimize widget",
1213
1213
  children: /* @__PURE__ */ n(Ht, {})
1214
1214
  }
@@ -1218,7 +1218,7 @@ const Vn = ({
1218
1218
  {
1219
1219
  type: "button",
1220
1220
  className: "ll-hbtn ll-hbtn--danger",
1221
- onClick: Ue,
1221
+ onClick: Ve,
1222
1222
  "aria-label": "Close widget",
1223
1223
  children: /* @__PURE__ */ n(zt, {})
1224
1224
  }
@@ -1226,15 +1226,15 @@ const Vn = ({
1226
1226
  ] })
1227
1227
  ] })
1228
1228
  ),
1229
- fe && /* @__PURE__ */ (() => {
1230
- const y = z ? "Restart paused session" : L === "disconnected" ? "Reconnect to agent" : "Start video call", K = z ? "Pick up where you left off" : null;
1229
+ pe && /* @__PURE__ */ (() => {
1230
+ const y = z ? "Restart paused session" : L === "disconnected" ? "Reconnect to agent" : "Start video call", X = z ? "Pick up where you left off" : null;
1231
1231
  return /* @__PURE__ */ w(ut, { children: [
1232
1232
  L === "idle" && !z && !H && /* @__PURE__ */ w(
1233
1233
  "button",
1234
1234
  {
1235
1235
  type: "button",
1236
1236
  className: "ll-expanded__play",
1237
- onClick: me,
1237
+ onClick: ge,
1238
1238
  "aria-label": y,
1239
1239
  children: [
1240
1240
  /* @__PURE__ */ n("div", { className: "ll-expanded__play-circle", children: /* @__PURE__ */ n("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("polygon", { points: "6 3 20 12 6 21 6 3" }) }) }),
@@ -1244,13 +1244,13 @@ const Vn = ({
1244
1244
  ),
1245
1245
  /* @__PURE__ */ w("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
1246
1246
  l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
1247
- K && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: K }),
1247
+ X && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: X }),
1248
1248
  /* @__PURE__ */ n(
1249
1249
  "button",
1250
1250
  {
1251
1251
  type: "button",
1252
1252
  className: "ll-expanded__cta",
1253
- onClick: me,
1253
+ onClick: ge,
1254
1254
  "aria-label": y,
1255
1255
  children: y
1256
1256
  }
@@ -1261,46 +1261,46 @@ const Vn = ({
1261
1261
  /* @__PURE__ */ w(
1262
1262
  "div",
1263
1263
  {
1264
- className: `ll-expanded__pip ${ke && (D || V) ? "is-visible" : ""}`,
1264
+ className: `ll-expanded__pip ${Le && (D || Y) ? "is-visible" : ""}`,
1265
1265
  children: [
1266
1266
  /* @__PURE__ */ n(
1267
1267
  "div",
1268
1268
  {
1269
- ref: Re,
1270
- className: V ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1269
+ ref: Me,
1270
+ className: Y ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1271
1271
  }
1272
1272
  ),
1273
1273
  /* @__PURE__ */ n(
1274
1274
  "div",
1275
1275
  {
1276
- ref: J,
1277
- className: !V && D ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1276
+ ref: K,
1277
+ className: !Y && D ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
1278
1278
  }
1279
1279
  )
1280
1280
  ]
1281
1281
  }
1282
1282
  ),
1283
- ke ? /* @__PURE__ */ w("div", { className: "ll-expanded__bottom", children: [
1284
- Ve && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Ve }) }),
1283
+ Le ? /* @__PURE__ */ w("div", { className: "ll-expanded__bottom", children: [
1284
+ Ye && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Ye }) }),
1285
1285
  /* @__PURE__ */ w("div", { className: "ll-toolbar", onClick: (y) => y.stopPropagation(), children: [
1286
- Oe && /* @__PURE__ */ n(
1286
+ Be && /* @__PURE__ */ n(
1287
1287
  "button",
1288
1288
  {
1289
1289
  type: "button",
1290
- className: `ll-tool ${V ? "is-on" : ""}`,
1291
- onClick: xe,
1292
- "aria-label": V ? "Stop sharing screen" : "Share screen",
1293
- title: V ? "Stop sharing" : "Share screen",
1290
+ className: `ll-tool ${Y ? "is-on" : ""}`,
1291
+ onClick: ke,
1292
+ "aria-label": Y ? "Stop sharing screen" : "Share screen",
1293
+ title: Y ? "Stop sharing" : "Share screen",
1294
1294
  children: /* @__PURE__ */ n(Xn, {})
1295
1295
  }
1296
1296
  ),
1297
- He && /* @__PURE__ */ w("div", { className: "ll-tool-split", children: [
1297
+ qe && /* @__PURE__ */ w("div", { className: "ll-tool-split", children: [
1298
1298
  /* @__PURE__ */ n(
1299
1299
  "button",
1300
1300
  {
1301
1301
  type: "button",
1302
1302
  className: `ll-tool ll-tool--left ${D ? "is-on" : ""}`,
1303
- onClick: we,
1303
+ onClick: _e,
1304
1304
  "aria-label": D ? "Turn off camera" : "Turn on camera",
1305
1305
  title: D ? "Stop camera" : "Start camera",
1306
1306
  children: /* @__PURE__ */ n(Qn, {})
@@ -1312,7 +1312,7 @@ const Vn = ({
1312
1312
  type: "button",
1313
1313
  className: `ll-tool ll-tool--right ${D ? "is-on" : ""}`,
1314
1314
  onClick: (y) => {
1315
- y.stopPropagation(), ce((K) => !K), ee(!1);
1315
+ y.stopPropagation(), ce((X) => !X), ee(!1);
1316
1316
  },
1317
1317
  "aria-label": "Camera devices",
1318
1318
  "aria-haspopup": "listbox",
@@ -1327,7 +1327,7 @@ const Vn = ({
1327
1327
  devices: O,
1328
1328
  activeId: W,
1329
1329
  onPick: (y) => {
1330
- ce(!1), _e(y);
1330
+ ce(!1), xe(y);
1331
1331
  }
1332
1332
  }
1333
1333
  )
@@ -1338,7 +1338,7 @@ const Vn = ({
1338
1338
  {
1339
1339
  type: "button",
1340
1340
  className: `ll-tool ll-tool--left ${p ? "is-muted" : ""}`,
1341
- onClick: be,
1341
+ onClick: we,
1342
1342
  "aria-label": p ? "Unmute microphone" : "Mute microphone",
1343
1343
  title: p ? "Unmute" : "Mute",
1344
1344
  children: /* @__PURE__ */ n(Zn, { muted: p })
@@ -1350,7 +1350,7 @@ const Vn = ({
1350
1350
  type: "button",
1351
1351
  className: `ll-tool ll-tool--right ${p ? "is-muted" : ""}`,
1352
1352
  onClick: (y) => {
1353
- y.stopPropagation(), ee((K) => !K), ce(!1);
1353
+ y.stopPropagation(), ee((X) => !X), ce(!1);
1354
1354
  },
1355
1355
  "aria-label": "Microphone devices",
1356
1356
  "aria-haspopup": "listbox",
@@ -1380,19 +1380,19 @@ const Vn = ({
1380
1380
  }
1381
1381
  )
1382
1382
  ] }),
1383
- qe && /* @__PURE__ */ w("form", { className: "ll-message-input", onSubmit: pe, children: [
1383
+ We && /* @__PURE__ */ w("form", { className: "ll-message-input", onSubmit: he, children: [
1384
1384
  /* @__PURE__ */ n(
1385
1385
  "input",
1386
1386
  {
1387
1387
  type: "text",
1388
1388
  className: "ll-message-input__field",
1389
1389
  placeholder: "Message...",
1390
- value: Q,
1390
+ value: Z,
1391
1391
  onChange: (y) => re(y.target.value),
1392
1392
  "aria-label": "Message the agent"
1393
1393
  }
1394
1394
  ),
1395
- Q.trim() && /* @__PURE__ */ n(
1395
+ Z.trim() && /* @__PURE__ */ n(
1396
1396
  "button",
1397
1397
  {
1398
1398
  type: "submit",
@@ -1407,7 +1407,7 @@ const Vn = ({
1407
1407
  {
1408
1408
  type: "button",
1409
1409
  className: "ll-expanded__end",
1410
- onClick: ge,
1410
+ onClick: ye,
1411
1411
  children: "End conversation"
1412
1412
  }
1413
1413
  )
@@ -1421,14 +1421,14 @@ const Vn = ({
1421
1421
  {
1422
1422
  type: "button",
1423
1423
  className: "ll-expanded__banner-x",
1424
- onClick: je,
1424
+ onClick: fe,
1425
1425
  "aria-label": "Dismiss",
1426
1426
  children: "×"
1427
1427
  }
1428
1428
  )
1429
1429
  ] });
1430
1430
  if (!H || L !== "error") return null;
1431
- let y = "Failed to connect", K = "Try again";
1431
+ let y = "Failed to connect", X = "Try again";
1432
1432
  return H === "MIC_PERMISSION_DENIED" ? y = "Microphone blocked. Allow access to talk." : H === "MIC_NOT_FOUND" ? y = "No microphone found. Plug one in + retry." : H === "MIC_UNAVAILABLE" ? y = "Mic unavailable. Check other apps using it." : H === "AGENT_TIMEOUT" ? y = "Agent didn't pick up. Try again." : H === "CONNECT_FAILED" ? y = "Connection failed. Check your network." : H.length < 80 && (y = H), /* @__PURE__ */ w("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1433
1433
  /* @__PURE__ */ n("span", { children: y }),
1434
1434
  /* @__PURE__ */ n(
@@ -1436,8 +1436,8 @@ const Vn = ({
1436
1436
  {
1437
1437
  type: "button",
1438
1438
  className: "ll-expanded__banner-retry",
1439
- onClick: ye,
1440
- children: K
1439
+ onClick: ve,
1440
+ children: X
1441
1441
  }
1442
1442
  )
1443
1443
  ] });
@@ -1494,30 +1494,30 @@ function tr() {
1494
1494
  /* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
1495
1495
  ] });
1496
1496
  }
1497
- const Ot = ({ label: e, devices: t, activeId: r, onPick: o }) => /* @__PURE__ */ w(
1497
+ const Ot = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */ w(
1498
1498
  "div",
1499
1499
  {
1500
1500
  className: "ll-device-menu",
1501
- onClick: (i) => i.stopPropagation(),
1501
+ onClick: (o) => o.stopPropagation(),
1502
1502
  role: "listbox",
1503
1503
  children: [
1504
1504
  /* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
1505
- t.map((i, l) => {
1506
- const s = r === i.deviceId;
1505
+ t.map((o, l) => {
1506
+ const s = r === o.deviceId;
1507
1507
  return /* @__PURE__ */ w(
1508
1508
  "button",
1509
1509
  {
1510
1510
  type: "button",
1511
1511
  className: `ll-device-menu__item ${s ? "is-active" : ""}`,
1512
- onClick: () => o(i.deviceId),
1512
+ onClick: () => i(o.deviceId),
1513
1513
  role: "option",
1514
1514
  "aria-selected": s,
1515
1515
  children: [
1516
1516
  s && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
1517
- /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: i.label || `${e} ${l + 1}` })
1517
+ /* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: o.label || `${e} ${l + 1}` })
1518
1518
  ]
1519
1519
  },
1520
- i.deviceId || l
1520
+ o.deviceId || l
1521
1521
  );
1522
1522
  })
1523
1523
  ]
@@ -1544,7 +1544,7 @@ function tt(e) {
1544
1544
  }
1545
1545
  return !0;
1546
1546
  }
1547
- const Qe = 4096, rr = 20, or = 20, ir = 10, lr = 10, ar = 30, qt = 500, cr = [
1547
+ const Qe = 4096, rr = 20, ir = 20, or = 10, lr = 10, ar = 30, qt = 500, cr = [
1548
1548
  '[data-ll-private="true"]',
1549
1549
  ".ll-widget",
1550
1550
  "script",
@@ -1552,7 +1552,7 @@ const Qe = 4096, rr = 20, or = 20, ir = 10, lr = 10, ar = 30, qt = 500, cr = [
1552
1552
  "noscript",
1553
1553
  "iframe"
1554
1554
  ];
1555
- function $e(e) {
1555
+ function He(e) {
1556
1556
  if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
1557
1557
  let t = e;
1558
1558
  for (; t; ) {
@@ -1562,12 +1562,12 @@ function $e(e) {
1562
1562
  }
1563
1563
  return !1;
1564
1564
  }
1565
- function ze(e) {
1565
+ function Oe(e) {
1566
1566
  if (typeof window > "u") return !0;
1567
1567
  const t = e.getBoundingClientRect();
1568
1568
  if (t.width <= 0 || t.height <= 0) return !1;
1569
- const r = window.innerHeight || document.documentElement.clientHeight, o = window.innerWidth || document.documentElement.clientWidth;
1570
- return t.bottom > 0 && t.right > 0 && t.top < r && t.left < o;
1569
+ const r = window.innerHeight || document.documentElement.clientHeight, i = window.innerWidth || document.documentElement.clientWidth;
1570
+ return t.bottom > 0 && t.right > 0 && t.top < r && t.left < i;
1571
1571
  }
1572
1572
  function Bt(e) {
1573
1573
  const t = e.getAttribute("id");
@@ -1577,15 +1577,15 @@ function Bt(e) {
1577
1577
  }
1578
1578
  const r = e.getAttribute("aria-label");
1579
1579
  if (r) return r.trim();
1580
- const o = e.getAttribute("placeholder");
1581
- if (o) return o.trim();
1582
- const i = e.closest("label");
1583
- return i != null && i.textContent ? i.textContent.trim() : "";
1580
+ const i = e.getAttribute("placeholder");
1581
+ if (i) return i.trim();
1582
+ const o = e.closest("label");
1583
+ return o != null && o.textContent ? o.textContent.trim() : "";
1584
1584
  }
1585
- function he(e, t) {
1585
+ function me(e, t) {
1586
1586
  return e.length <= t ? e : e.slice(0, t - 1) + "…";
1587
1587
  }
1588
- function Ee(e) {
1588
+ function Ae(e) {
1589
1589
  return e.length;
1590
1590
  }
1591
1591
  function sr(e, t = {}) {
@@ -1602,39 +1602,39 @@ function sr(e, t = {}) {
1602
1602
  forms: [],
1603
1603
  extras: e
1604
1604
  };
1605
- const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "", s = Array.from(
1605
+ const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "", s = Array.from(
1606
1606
  r.querySelectorAll("[data-ll-region]")
1607
1607
  ), d = [];
1608
1608
  for (const p of s) {
1609
- if (d.length >= ir) break;
1610
- if ($e(p) || !ze(p)) continue;
1611
- const N = p.getAttribute("data-ll-region") ?? "", B = p.getAttribute("data-ll-intent") ?? void 0, D = he(
1609
+ if (d.length >= or) break;
1610
+ if (He(p) || !Oe(p)) continue;
1611
+ const N = p.getAttribute("data-ll-region") ?? "", B = p.getAttribute("data-ll-intent") ?? void 0, D = me(
1612
1612
  (p.innerText || p.textContent || "").trim(),
1613
1613
  qt * 2
1614
1614
  );
1615
1615
  !N || !D || d.push({ id: N, intent: B, text: D });
1616
1616
  }
1617
- const u = [], m = ["H1", "H2", "H3", "H4", "H5", "H6"], h = Array.from(
1617
+ const f = [], g = ["H1", "H2", "H3", "H4", "H5", "H6"], m = Array.from(
1618
1618
  r.querySelectorAll("h1, h2, h3, h4, h5, h6")
1619
1619
  );
1620
- for (const p of h) {
1621
- if ($e(p) || !ze(p)) continue;
1620
+ for (const p of m) {
1621
+ if (He(p) || !Oe(p)) continue;
1622
1622
  const N = (p.textContent || "").trim();
1623
- N && u.push(`${p.tagName}: ${he(N, 200)}`);
1623
+ N && f.push(`${p.tagName}: ${me(N, 200)}`);
1624
1624
  }
1625
1625
  const a = Array.from(r.querySelectorAll("p, li"));
1626
1626
  for (const p of a) {
1627
- if ($e(p) || !ze(p) || m.includes(p.tagName)) continue;
1627
+ if (He(p) || !Oe(p) || g.includes(p.tagName)) continue;
1628
1628
  const N = (p.textContent || "").trim();
1629
- N.length > 10 && u.push(he(N, qt));
1629
+ N.length > 10 && f.push(me(N, qt));
1630
1630
  }
1631
- const c = u.join(`
1631
+ const c = f.join(`
1632
1632
  `), R = [], C = Array.from(r.querySelectorAll("a[href]"));
1633
1633
  for (const p of C) {
1634
1634
  if (R.length >= rr) break;
1635
- if ($e(p) || !ze(p)) continue;
1635
+ if (He(p) || !Oe(p)) continue;
1636
1636
  const N = p.getAttribute("href") || "", B = (p.textContent || "").trim();
1637
- !N || !B || R.push({ href: N, text: he(B, 100) });
1637
+ !N || !B || R.push({ href: N, text: me(B, 100) });
1638
1638
  }
1639
1639
  const L = [], v = Array.from(
1640
1640
  r.querySelectorAll(
@@ -1642,10 +1642,10 @@ function sr(e, t = {}) {
1642
1642
  )
1643
1643
  );
1644
1644
  for (const p of v) {
1645
- if (L.length >= or) break;
1646
- if ($e(p) || !tt(p) || !ze(p)) continue;
1645
+ if (L.length >= ir) break;
1646
+ if (He(p) || !tt(p) || !Oe(p)) continue;
1647
1647
  const N = Bt(p), B = p instanceof HTMLInputElement ? p.type : p.tagName.toLowerCase();
1648
- N && L.push({ label: he(N, 100), type: B });
1648
+ N && L.push({ label: me(N, 100), type: B });
1649
1649
  }
1650
1650
  const b = Array.from(
1651
1651
  r.querySelectorAll("[data-ll-form]")
@@ -1665,15 +1665,15 @@ function sr(e, t = {}) {
1665
1665
  if (!tt(O)) continue;
1666
1666
  const W = O.getAttribute("data-ll-field") || "";
1667
1667
  if (!W) continue;
1668
- const V = Bt(O) || W, te = O instanceof HTMLInputElement ? O.type : O.tagName.toLowerCase();
1669
- A.push({ name: W, label: he(V, 100), type: te });
1668
+ const Y = Bt(O) || W, te = O instanceof HTMLInputElement ? O.type : O.tagName.toLowerCase();
1669
+ A.push({ name: W, label: me(Y, 100), type: te });
1670
1670
  }
1671
1671
  z.push({ id: N, intent: B, fields: A });
1672
1672
  }
1673
1673
  const I = {
1674
- url: o,
1674
+ url: i,
1675
1675
  title: l,
1676
- pathname: i,
1676
+ pathname: o,
1677
1677
  regions: d,
1678
1678
  visibleText: c,
1679
1679
  visibleLinks: R,
@@ -1681,23 +1681,23 @@ function sr(e, t = {}) {
1681
1681
  forms: z,
1682
1682
  extras: e
1683
1683
  };
1684
- let H = Ee(JSON.stringify(I.regions)) + Ee(I.visibleText) + Ee(JSON.stringify(I.visibleLinks)) + Ee(JSON.stringify(I.visibleFields));
1684
+ let H = Ae(JSON.stringify(I.regions)) + Ae(I.visibleText) + Ae(JSON.stringify(I.visibleLinks)) + Ae(JSON.stringify(I.visibleFields));
1685
1685
  for (; H > Qe && I.visibleFields.length > 0; )
1686
- I.visibleFields.pop(), H = Ee(JSON.stringify(I.visibleFields));
1686
+ I.visibleFields.pop(), H = Ae(JSON.stringify(I.visibleFields));
1687
1687
  for (; H > Qe && I.visibleLinks.length > 0; )
1688
1688
  I.visibleLinks.pop(), H -= 80;
1689
- return Ee(I.visibleText) > Qe && (I.visibleText = he(I.visibleText, Qe - 100)), I;
1689
+ return Ae(I.visibleText) > Qe && (I.visibleText = me(I.visibleText, Qe - 100)), I;
1690
1690
  }
1691
- let Ne = null;
1691
+ let Re = null;
1692
1692
  function Wt(e, t = {}) {
1693
- const r = Date.now(), i = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
1694
- if (Ne && Ne.key === i && r - Ne.at < 1e3)
1695
- return Ne.ctx;
1693
+ const r = Date.now(), o = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
1694
+ if (Re && Re.key === o && r - Re.at < 1e3)
1695
+ return Re.ctx;
1696
1696
  const l = sr(e, t);
1697
- return Ne = { key: i, at: r, ctx: l }, l;
1697
+ return Re = { key: o, at: r, ctx: l }, l;
1698
1698
  }
1699
1699
  function dr() {
1700
- Ne = null;
1700
+ Re = null;
1701
1701
  }
1702
1702
  const ur = 200;
1703
1703
  function fr(e) {
@@ -1716,55 +1716,55 @@ function pr(e) {
1716
1716
  function hr(e) {
1717
1717
  const t = e ?? (typeof document < "u" ? document : null);
1718
1718
  if (!t) return [];
1719
- const r = typeof window < "u" && window.location.origin || "", o = /* @__PURE__ */ new Set(), i = [], l = Array.from(t.querySelectorAll("a[href]"));
1719
+ const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), o = [], l = Array.from(t.querySelectorAll("a[href]"));
1720
1720
  for (const s of l) {
1721
- if (i.length >= ur) break;
1721
+ if (o.length >= ur) break;
1722
1722
  if (pt(s)) continue;
1723
1723
  const d = s.getAttribute("href") || "";
1724
1724
  if (!pr(d)) continue;
1725
- let u = d, m = !0;
1725
+ let f = d, g = !0;
1726
1726
  try {
1727
1727
  if (typeof window < "u") {
1728
1728
  const a = new URL(d, r);
1729
- m = a.origin === r, m && d.startsWith("http") && (u = a.pathname + a.search + a.hash);
1729
+ g = a.origin === r, g && d.startsWith("http") && (f = a.pathname + a.search + a.hash);
1730
1730
  }
1731
1731
  } catch {
1732
1732
  continue;
1733
1733
  }
1734
- if (o.has(u)) continue;
1735
- o.add(u);
1736
- const h = (s.textContent || "").trim().slice(0, 120);
1737
- i.push({ href: u, text: h, internal: m });
1734
+ if (i.has(f)) continue;
1735
+ i.add(f);
1736
+ const m = (s.textContent || "").trim().slice(0, 120);
1737
+ o.push({ href: f, text: m, internal: g });
1738
1738
  }
1739
- return i;
1739
+ return o;
1740
1740
  }
1741
- let Ae = null;
1741
+ let Ie = null;
1742
1742
  const mr = 5e3;
1743
1743
  function st() {
1744
1744
  const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
1745
- if (Ae && Ae.pathname === t && e - Ae.at < mr)
1746
- return Ae.routes;
1745
+ if (Ie && Ie.pathname === t && e - Ie.at < mr)
1746
+ return Ie.routes;
1747
1747
  const r = hr();
1748
- return Ae = { at: e, pathname: t, routes: r }, r;
1748
+ return Ie = { at: e, pathname: t, routes: r }, r;
1749
1749
  }
1750
1750
  function gr() {
1751
- Ae = null;
1751
+ Ie = null;
1752
1752
  }
1753
1753
  function yr(e, t) {
1754
- const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, o = Object.getOwnPropertyDescriptor(r, "value"), i = o == null ? void 0 : o.set;
1755
- i ? i.call(e, t) : e.value = t;
1754
+ const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, i = Object.getOwnPropertyDescriptor(r, "value"), o = i == null ? void 0 : i.set;
1755
+ o ? o.call(e, t) : e.value = t;
1756
1756
  }
1757
1757
  function vr(e, t, r = {}) {
1758
- const o = r.triggerInput ?? !0, i = r.triggerChange ?? !0;
1758
+ const i = r.triggerInput ?? !0, o = r.triggerChange ?? !0;
1759
1759
  if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
1760
1760
  const l = Object.getOwnPropertyDescriptor(
1761
1761
  HTMLInputElement.prototype,
1762
1762
  "checked"
1763
1763
  ), s = l == null ? void 0 : l.set, d = t === "true" || t === "1" || t === "on";
1764
- s ? s.call(e, d) : e.checked = d, o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1764
+ s ? s.call(e, d) : e.checked = d, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1765
1765
  return;
1766
1766
  }
1767
- yr(e, t), o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1767
+ yr(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
1768
1768
  }
1769
1769
  function br() {
1770
1770
  if (typeof window > "u" || typeof document > "u")
@@ -1785,12 +1785,12 @@ function _r() {
1785
1785
  document.querySelectorAll("body, body *")
1786
1786
  );
1787
1787
  let t = null, r = 0;
1788
- for (const o of e) {
1789
- if (!wr(o)) continue;
1790
- const i = o.getBoundingClientRect();
1791
- if (i.bottom <= 0 || i.top >= window.innerHeight || i.right <= 0 || i.left >= window.innerWidth || i.width <= 0 || i.height <= 0 || o.closest(".ll-widget")) continue;
1792
- const l = i.width * i.height;
1793
- l > r && (r = l, t = o);
1788
+ for (const i of e) {
1789
+ if (!wr(i)) continue;
1790
+ const o = i.getBoundingClientRect();
1791
+ if (o.bottom <= 0 || o.top >= window.innerHeight || o.right <= 0 || o.left >= window.innerWidth || o.width <= 0 || o.height <= 0 || i.closest(".ll-widget")) continue;
1792
+ const l = o.width * o.height;
1793
+ l > r && (r = l, t = i);
1794
1794
  }
1795
1795
  return t;
1796
1796
  }
@@ -1839,14 +1839,14 @@ function Sr(e) {
1839
1839
  const {
1840
1840
  agentId: t,
1841
1841
  apiKey: r,
1842
- baseUrl: o = "https://app.livelayer.studio",
1843
- sessionEndpoint: i,
1842
+ baseUrl: i = "https://app.livelayer.studio",
1843
+ sessionEndpoint: o,
1844
1844
  sessionBody: l,
1845
1845
  autoConnect: s = !1,
1846
1846
  displayMode: d,
1847
- defaultDisplayMode: u = "expanded",
1848
- onDisplayModeChange: m,
1849
- position: h = "bottom-right",
1847
+ defaultDisplayMode: f = "expanded",
1848
+ onDisplayModeChange: g,
1849
+ position: m = "bottom-right",
1850
1850
  mobileBreakpoint: a = 640,
1851
1851
  persistKey: c = "ll-widget",
1852
1852
  disablePersistence: R = !1,
@@ -1864,63 +1864,75 @@ function Sr(e) {
1864
1864
  showOn: A,
1865
1865
  hideOn: O,
1866
1866
  pathname: W,
1867
- onNavigate: V,
1867
+ onNavigate: Y,
1868
1868
  onScrollToSelector: te,
1869
1869
  getPageContext: ue,
1870
- pageContextExtras: He,
1871
- getRoutes: Oe,
1872
- onScrollPage: qe,
1873
- onClick: Be,
1874
- capabilities: me,
1875
- onConnect: ge,
1876
- onDisconnect: ye,
1877
- onTranscript: ve,
1878
- onAgentState: be,
1879
- onConnectionStateChange: we,
1880
- onAgentEvent: _e,
1881
- onAgentCommand: xe,
1870
+ pageContextExtras: qe,
1871
+ getRoutes: Be,
1872
+ onScrollPage: We,
1873
+ onClick: Fe,
1874
+ capabilities: ge,
1875
+ onConnect: ye,
1876
+ onDisconnect: ve,
1877
+ onTranscript: be,
1878
+ onAgentState: we,
1879
+ onConnectionStateChange: _e,
1880
+ onAgentEvent: xe,
1881
+ onAgentCommand: ke,
1882
1882
  controlledSession: j,
1883
- className: We,
1884
- style: Fe,
1885
- zIndex: Ue = 2147483647
1886
- } = e, je = Tn(W), ae = qn(je, A, O);
1883
+ className: Ue,
1884
+ style: je,
1885
+ zIndex: Ve = 2147483647
1886
+ } = e, fe = Tn(W), ae = qn(fe, A, O);
1887
1887
  T(() => {
1888
1888
  dr(), gr();
1889
- }, [je]);
1890
- const ie = L !== void 0, [ke, Le] = S(() => {
1891
- var g;
1892
- return L ?? ((g = C == null ? void 0 : C[0]) == null ? void 0 : g.id);
1893
- }), fe = ie ? L : ke, J = Ze(
1894
- () => (C == null ? void 0 : C.find((g) => g.id === fe)) ?? null,
1895
- [C, fe]
1896
- ), Re = (J == null ? void 0 : J.agentId) ?? t, [ne, ee] = An({
1889
+ }, [fe]), T(() => {
1890
+ var J;
1891
+ if (!fe) return;
1892
+ const h = (J = V.getRoom) == null ? void 0 : J.call(V), u = h == null ? void 0 : h.localParticipant;
1893
+ if (u != null && u.publishData)
1894
+ try {
1895
+ const Ee = new TextEncoder().encode(
1896
+ JSON.stringify({ type: "pathname", pathname: fe })
1897
+ );
1898
+ u.publishData(Ee, { reliable: !0 });
1899
+ } catch {
1900
+ }
1901
+ }, [fe, V]);
1902
+ const oe = L !== void 0, [Le, Se] = S(() => {
1903
+ var h;
1904
+ return L ?? ((h = C == null ? void 0 : C[0]) == null ? void 0 : h.id);
1905
+ }), pe = oe ? L : Le, K = Ze(
1906
+ () => (C == null ? void 0 : C.find((h) => h.id === pe)) ?? null,
1907
+ [C, pe]
1908
+ ), Me = (K == null ? void 0 : K.agentId) ?? t, [ne, ee] = An({
1897
1909
  value: d,
1898
- defaultValue: u,
1899
- onChange: m,
1910
+ defaultValue: f,
1911
+ onChange: g,
1900
1912
  persistKey: c,
1901
1913
  disablePersistence: R
1902
- }), le = In(a), ce = yn(), Q = vn(), re = wn(), pe = _n(), Ie = xn(), [Ve, Me] = S(!1), [Se, y] = S(!1), [K, Ye] = S(!1), [Yt, Gt] = S(!1), [nt, Jt] = S(!1), rt = E(V), ot = E(te), it = E(qe), lt = E(Be), ht = E(ue), mt = E(He), gt = E(Oe), at = E(me), oe = E(null);
1903
- rt.current = V, ot.current = te, it.current = qe, lt.current = Be, ht.current = ue, mt.current = He, gt.current = Oe, at.current = me;
1904
- function se(g) {
1905
- const f = at.current;
1906
- return f ? f.includes(g) : !0;
1914
+ }), le = In(a), ce = yn(), Z = vn(), re = wn(), he = _n(), Te = xn(), [Ye, Pe] = S(!1), [Ce, y] = S(!1), [X, Je] = S(!1), [Yt, Jt] = S(!1), [nt, Gt] = S(!1), rt = E(Y), it = E(te), ot = E(We), lt = E(Fe), ht = E(ue), mt = E(qe), gt = E(Be), at = E(ge), ie = E(null);
1915
+ rt.current = Y, it.current = te, ot.current = We, lt.current = Fe, ht.current = ue, mt.current = qe, gt.current = Be, at.current = ge;
1916
+ function se(h) {
1917
+ const u = at.current;
1918
+ return u ? u.includes(h) : !0;
1907
1919
  }
1908
- function de(g, f) {
1920
+ function de(h, u) {
1909
1921
  console.warn(
1910
- `[LiveLayer] Agent command "${g}" blocked — capability "${f}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
1922
+ `[LiveLayer] Agent command "${h}" blocked — capability "${u}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
1911
1923
  );
1912
1924
  }
1913
- const Te = k(
1914
- (g) => {
1915
- var Z, Je, Ke, Et;
1916
- const f = g;
1917
- if (!(!f.type || typeof f.type != "string")) {
1918
- if (_e == null || _e({ eventName: f.type, data: g }), f.type === "navigate") {
1925
+ const De = k(
1926
+ (h) => {
1927
+ var J, Ee, Ke, Et;
1928
+ const u = h;
1929
+ if (!(!u.type || typeof u.type != "string")) {
1930
+ if (xe == null || xe({ eventName: u.type, data: h }), u.type === "navigate") {
1919
1931
  if (!se("navigate")) {
1920
1932
  de("navigate", "navigate");
1921
1933
  return;
1922
1934
  }
1923
- const x = typeof f.href == "string" ? f.href : null;
1935
+ const x = typeof u.href == "string" ? u.href : null;
1924
1936
  if (!x) {
1925
1937
  console.warn(
1926
1938
  `[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
@@ -1958,17 +1970,17 @@ function Sr(e) {
1958
1970
  }
1959
1971
  return;
1960
1972
  }
1961
- if (f.type === "scroll_to") {
1973
+ if (u.type === "scroll_to") {
1962
1974
  if (!se("scroll")) {
1963
1975
  de("scroll_to", "scroll");
1964
1976
  return;
1965
1977
  }
1966
- const x = typeof f.selector == "string" ? f.selector : null;
1978
+ const x = typeof u.selector == "string" ? u.selector : null;
1967
1979
  if (!x) return;
1968
- const M = f.behavior === "instant" ? "instant" : "smooth";
1969
- if (ot.current) {
1980
+ const M = u.behavior === "instant" ? "instant" : "smooth";
1981
+ if (it.current) {
1970
1982
  try {
1971
- ot.current(
1983
+ it.current(
1972
1984
  x,
1973
1985
  M
1974
1986
  );
@@ -2000,19 +2012,19 @@ function Sr(e) {
2000
2012
  }
2001
2013
  return;
2002
2014
  }
2003
- if (f.type === "request_page_context") {
2015
+ if (u.type === "request_page_context") {
2004
2016
  if (!se("read_page")) {
2005
2017
  de("request_page_context", "read_page");
2006
2018
  return;
2007
2019
  }
2008
- const x = typeof f.requestId == "string" ? f.requestId : void 0, M = (Z = oe.current) == null ? void 0 : Z.call(oe), q = (U) => {
2020
+ const x = typeof u.requestId == "string" ? u.requestId : void 0, M = (J = ie.current) == null ? void 0 : J.call(ie), q = (U) => {
2009
2021
  const P = M, G = P == null ? void 0 : P.localParticipant;
2010
2022
  if (G != null && G.publishData)
2011
2023
  try {
2012
- const X = x ? { ...U, requestId: x } : U, Ce = new TextEncoder().encode(JSON.stringify(X));
2013
- G.publishData(Ce, { reliable: !0 });
2014
- } catch (X) {
2015
- console.warn("[LiveLayer] publishData failed.", X);
2024
+ const Q = x ? { ...U, requestId: x } : U, Ne = new TextEncoder().encode(JSON.stringify(Q));
2025
+ G.publishData(Ne, { reliable: !0 });
2026
+ } catch (Q) {
2027
+ console.warn("[LiveLayer] publishData failed.", Q);
2016
2028
  }
2017
2029
  }, $ = mt.current, F = ht.current;
2018
2030
  try {
@@ -2048,22 +2060,22 @@ function Sr(e) {
2048
2060
  }
2049
2061
  return;
2050
2062
  }
2051
- if (f.type === "scroll_page") {
2063
+ if (u.type === "scroll_page") {
2052
2064
  if (!se("scroll")) {
2053
2065
  de("scroll_page", "scroll");
2054
2066
  return;
2055
2067
  }
2056
- const x = f.direction;
2068
+ const x = u.direction;
2057
2069
  if (x !== "up" && x !== "down" && x !== "top" && x !== "bottom") {
2058
2070
  console.warn(
2059
2071
  `[LiveLayer] scroll_page: invalid direction "${String(x)}". Expected up | down | top | bottom.`
2060
2072
  );
2061
2073
  return;
2062
2074
  }
2063
- const M = f.behavior === "instant" ? "instant" : "smooth";
2064
- if (it.current) {
2075
+ const M = u.behavior === "instant" ? "instant" : "smooth";
2076
+ if (ot.current) {
2065
2077
  try {
2066
- it.current(
2078
+ ot.current(
2067
2079
  x,
2068
2080
  M
2069
2081
  );
@@ -2081,12 +2093,12 @@ function Sr(e) {
2081
2093
  x === "up" ? F(-Ft($)) : x === "down" ? F(Ft($)) : U(x === "top" ? 0 : kr($));
2082
2094
  return;
2083
2095
  }
2084
- if (f.type === "click") {
2096
+ if (u.type === "click") {
2085
2097
  if (!se("click")) {
2086
2098
  de("click", "click");
2087
2099
  return;
2088
2100
  }
2089
- const x = typeof f.selector == "string" ? f.selector : null;
2101
+ const x = typeof u.selector == "string" ? u.selector : null;
2090
2102
  if (!x) {
2091
2103
  console.warn("[LiveLayer] click: missing selector.");
2092
2104
  return;
@@ -2121,18 +2133,18 @@ function Sr(e) {
2121
2133
  );
2122
2134
  return;
2123
2135
  }
2124
- (Je = M.click) == null || Je.call(M);
2136
+ (Ee = M.click) == null || Ee.call(M);
2125
2137
  return;
2126
2138
  }
2127
- if (f.type === "fill_form" || f.type === "focus_field") {
2139
+ if (u.type === "fill_form" || u.type === "focus_field") {
2128
2140
  if (!se("fill_forms")) {
2129
- de(f.type, "fill_forms");
2141
+ de(u.type, "fill_forms");
2130
2142
  return;
2131
2143
  }
2132
2144
  if (typeof document > "u") return;
2133
- const x = typeof f.formId == "string" ? f.formId : null;
2145
+ const x = typeof u.formId == "string" ? u.formId : null;
2134
2146
  if (!x) {
2135
- console.warn(`[LiveLayer] ${f.type}: missing formId.`);
2147
+ console.warn(`[LiveLayer] ${u.type}: missing formId.`);
2136
2148
  return;
2137
2149
  }
2138
2150
  const M = document.querySelector(
@@ -2140,18 +2152,18 @@ function Sr(e) {
2140
2152
  );
2141
2153
  if (!M) {
2142
2154
  console.warn(
2143
- `[LiveLayer] ${f.type}: no form with data-ll-form="${x}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
2155
+ `[LiveLayer] ${u.type}: no form with data-ll-form="${x}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
2144
2156
  );
2145
2157
  return;
2146
2158
  }
2147
2159
  if (M.closest('[data-ll-private="true"], .ll-widget')) {
2148
2160
  console.warn(
2149
- `[LiveLayer] ${f.type}: refusing to touch a form in a private subtree.`
2161
+ `[LiveLayer] ${u.type}: refusing to touch a form in a private subtree.`
2150
2162
  );
2151
2163
  return;
2152
2164
  }
2153
- if (f.type === "focus_field") {
2154
- const $ = typeof f.fieldName == "string" ? f.fieldName : null;
2165
+ if (u.type === "focus_field") {
2166
+ const $ = typeof u.fieldName == "string" ? u.fieldName : null;
2155
2167
  if (!$) {
2156
2168
  console.warn("[LiveLayer] focus_field: missing fieldName.");
2157
2169
  return;
@@ -2172,7 +2184,7 @@ function Sr(e) {
2172
2184
  F.focus();
2173
2185
  return;
2174
2186
  }
2175
- const q = f.values && typeof f.values == "object" ? f.values : null;
2187
+ const q = u.values && typeof u.values == "object" ? u.values : null;
2176
2188
  if (!q) {
2177
2189
  console.warn("[LiveLayer] fill_form: missing or invalid values.");
2178
2190
  return;
@@ -2203,13 +2215,13 @@ function Sr(e) {
2203
2215
  }
2204
2216
  return;
2205
2217
  }
2206
- if (f.type === "submit_form") {
2218
+ if (u.type === "submit_form") {
2207
2219
  if (!se("submit_forms")) {
2208
2220
  de("submit_form", "submit_forms");
2209
2221
  return;
2210
2222
  }
2211
2223
  if (typeof document > "u") return;
2212
- const x = typeof f.formId == "string" ? f.formId : null;
2224
+ const x = typeof u.formId == "string" ? u.formId : null;
2213
2225
  if (!x) {
2214
2226
  console.warn("[LiveLayer] submit_form: missing formId.");
2215
2227
  return;
@@ -2229,12 +2241,12 @@ function Sr(e) {
2229
2241
  );
2230
2242
  return;
2231
2243
  }
2232
- const q = typeof f.requestId == "string" ? f.requestId : void 0, $ = (Ke = oe.current) == null ? void 0 : Ke.call(oe), F = (G) => {
2233
- const X = $, Ce = X == null ? void 0 : X.localParticipant;
2234
- if (Ce != null && Ce.publishData)
2244
+ const q = typeof u.requestId == "string" ? u.requestId : void 0, $ = (Ke = ie.current) == null ? void 0 : Ke.call(ie), F = (G) => {
2245
+ const Q = $, Ne = Q == null ? void 0 : Q.localParticipant;
2246
+ if (Ne != null && Ne.publishData)
2235
2247
  try {
2236
2248
  const cn = q ? { ...G, requestId: q } : G, sn = new TextEncoder().encode(JSON.stringify(cn));
2237
- Ce.publishData(sn, { reliable: !0 });
2249
+ Ne.publishData(sn, { reliable: !0 });
2238
2250
  } catch {
2239
2251
  }
2240
2252
  };
@@ -2262,34 +2274,34 @@ function Sr(e) {
2262
2274
  }, 500);
2263
2275
  return;
2264
2276
  }
2265
- if (f.type === "request_routes") {
2277
+ if (u.type === "request_routes") {
2266
2278
  if (!se("read_page")) {
2267
2279
  de("request_routes", "read_page");
2268
2280
  return;
2269
2281
  }
2270
- const x = typeof f.requestId == "string" ? f.requestId : void 0, q = (Et = oe.current) == null ? void 0 : Et.call(oe), $ = q == null ? void 0 : q.localParticipant;
2282
+ const x = typeof u.requestId == "string" ? u.requestId : void 0, q = (Et = ie.current) == null ? void 0 : Et.call(ie), $ = q == null ? void 0 : q.localParticipant;
2271
2283
  if (!($ != null && $.publishData)) return;
2272
2284
  const F = (P) => {
2273
2285
  try {
2274
- const G = x ? { type: "routes", routes: P, requestId: x } : { type: "routes", routes: P }, X = new TextEncoder().encode(JSON.stringify(G));
2275
- $.publishData(X, { reliable: !0 });
2286
+ const G = x ? { type: "routes", routes: P, requestId: x } : { type: "routes", routes: P }, Q = new TextEncoder().encode(JSON.stringify(G));
2287
+ $.publishData(Q, { reliable: !0 });
2276
2288
  } catch (G) {
2277
2289
  console.warn("[LiveLayer] request_routes: publishData failed.", G);
2278
2290
  }
2279
2291
  }, U = gt.current;
2280
2292
  if (U) {
2281
2293
  try {
2282
- const P = U(), G = (X) => {
2283
- if (!Array.isArray(X)) {
2294
+ const P = U(), G = (Q) => {
2295
+ if (!Array.isArray(Q)) {
2284
2296
  F([]);
2285
2297
  return;
2286
2298
  }
2287
- F(X.map(fr).slice(0, 200));
2299
+ F(Q.map(fr).slice(0, 200));
2288
2300
  };
2289
- P instanceof Promise ? P.then(G).catch((X) => {
2301
+ P instanceof Promise ? P.then(G).catch((Q) => {
2290
2302
  console.warn(
2291
2303
  "[LiveLayer] getRoutes rejected; falling back to DOM walker.",
2292
- X
2304
+ Q
2293
2305
  ), F(st());
2294
2306
  }) : G(P);
2295
2307
  } catch (P) {
@@ -2307,39 +2319,39 @@ function Sr(e) {
2307
2319
  }
2308
2320
  return;
2309
2321
  }
2310
- Lr.has(f.type) || xe == null || xe(f);
2322
+ Lr.has(u.type) || ke == null || ke(u);
2311
2323
  }
2312
2324
  },
2313
- [xe, _e]
2314
- ), Y = gn({
2315
- agentId: j ? "__controlled__" : Re,
2316
- baseUrl: o,
2325
+ [ke, xe]
2326
+ ), V = gn({
2327
+ agentId: j ? "__controlled__" : Me,
2328
+ baseUrl: i,
2317
2329
  apiKey: r,
2318
- sessionEndpoint: i,
2330
+ sessionEndpoint: o,
2319
2331
  sessionBody: l,
2320
- onDataMessage: j ? void 0 : Te
2332
+ onDataMessage: j ? void 0 : De
2321
2333
  });
2322
2334
  T(() => {
2323
2335
  if (j != null && j.subscribeToDataMessages)
2324
- return j.subscribeToDataMessages(Te);
2325
- }, [j, Te]), oe.current = () => {
2326
- var g;
2327
- return (g = Y.getRoom) == null ? void 0 : g.call(Y);
2336
+ return j.subscribeToDataMessages(De);
2337
+ }, [j, De]), ie.current = () => {
2338
+ var h;
2339
+ return (h = V.getRoom) == null ? void 0 : h.call(V);
2328
2340
  }, T(() => {
2329
- var Z;
2341
+ var J;
2330
2342
  if (typeof window > "u") return;
2331
- const g = ((Z = window.location) == null ? void 0 : Z.hostname) || "";
2332
- if (g === "localhost" || g === "127.0.0.1" || g === "0.0.0.0" || g.endsWith(".local") || g.endsWith(".test"))
2333
- return window.__livelayerSimulateCommand = (Je) => {
2343
+ const h = ((J = window.location) == null ? void 0 : J.hostname) || "";
2344
+ if (h === "localhost" || h === "127.0.0.1" || h === "0.0.0.0" || h.endsWith(".local") || h.endsWith(".test"))
2345
+ return window.__livelayerSimulateCommand = (Ee) => {
2334
2346
  try {
2335
- Te(Je);
2347
+ De(Ee);
2336
2348
  } catch (Ke) {
2337
2349
  console.warn("[LiveLayer] simulate-command threw:", Ke);
2338
2350
  }
2339
2351
  }, () => {
2340
2352
  delete window.__livelayerSimulateCommand;
2341
2353
  };
2342
- }, [Te]);
2354
+ }, [De]);
2343
2355
  const _ = Ze(() => j ? {
2344
2356
  connectionState: j.connectionState,
2345
2357
  agentState: j.agentState,
@@ -2356,132 +2368,132 @@ function Sr(e) {
2356
2368
  // Dummy getRoom for shape compatibility — controlled consumers own the Room.
2357
2369
  // Internal session's getRoom returns null when no real connect has happened,
2358
2370
  // so we reuse its reference for type consistency.
2359
- getRoom: Y.getRoom,
2371
+ getRoom: V.getRoom,
2360
2372
  isControlled: !0
2361
2373
  } : {
2362
- connectionState: Y.connectionState,
2363
- agentState: Y.agentState,
2364
- transcript: Y.transcript,
2365
- videoElement: Y.videoElement,
2366
- audioElement: Y.audioElement,
2367
- canResume: Y.canResume,
2368
- error: Y.error,
2369
- agentConfig: Y.agentConfig,
2370
- connect: Y.connect,
2371
- disconnect: Y.disconnect,
2372
- getRoom: Y.getRoom,
2374
+ connectionState: V.connectionState,
2375
+ agentState: V.agentState,
2376
+ transcript: V.transcript,
2377
+ videoElement: V.videoElement,
2378
+ audioElement: V.audioElement,
2379
+ canResume: V.canResume,
2380
+ error: V.error,
2381
+ agentConfig: V.agentConfig,
2382
+ connect: V.connect,
2383
+ disconnect: V.disconnect,
2384
+ getRoom: V.getRoom,
2373
2385
  isControlled: !1
2374
- }, [j, Y]), yt = E(null);
2386
+ }, [j, V]), yt = E(null);
2375
2387
  T(() => {
2376
- const g = _.videoElement, f = yt.current;
2377
- if (!(!g || !f))
2378
- return f.appendChild(g), () => {
2379
- g.parentNode === f && f.removeChild(g);
2388
+ const h = _.videoElement, u = yt.current;
2389
+ if (!(!h || !u))
2390
+ return u.appendChild(h), () => {
2391
+ h.parentNode === u && u.removeChild(h);
2380
2392
  };
2381
2393
  }, [_.videoElement]), T(() => {
2382
- const g = _.audioElement;
2383
- if (!g) return;
2384
- ce.attach(g);
2385
- const f = g.play();
2386
- return f && typeof f.catch == "function" && f.catch((Z) => {
2387
- (Z == null ? void 0 : Z.name) === "NotAllowedError" && Me(!0);
2394
+ const h = _.audioElement;
2395
+ if (!h) return;
2396
+ ce.attach(h);
2397
+ const u = h.play();
2398
+ return u && typeof u.catch == "function" && u.catch((J) => {
2399
+ (J == null ? void 0 : J.name) === "NotAllowedError" && Pe(!0);
2388
2400
  }), () => {
2389
2401
  ce.detach();
2390
2402
  };
2391
2403
  }, [_.audioElement]), T(() => {
2392
2404
  if (_.isControlled || _.connectionState !== "connected") return;
2393
- const g = _.getRoom();
2394
- if (g)
2395
- return Q.setupMic(g).catch(() => {
2396
- }), re.attachRoom(g), pe.attachRoom(g), Ie.refresh(), () => {
2397
- Q.teardownMic(), re.teardown(), pe.teardown();
2405
+ const h = _.getRoom();
2406
+ if (h)
2407
+ return Z.setupMic(h).catch(() => {
2408
+ }), re.attachRoom(h), he.attachRoom(h), Te.refresh(), () => {
2409
+ Z.teardownMic(), re.teardown(), he.teardown();
2398
2410
  };
2399
2411
  }, [_.isControlled, _.connectionState]), T(() => {
2400
- const g = _.audioElement;
2401
- g && (g.muted = nt);
2412
+ const h = _.audioElement;
2413
+ h && (h.muted = nt);
2402
2414
  }, [_.audioElement, nt]);
2403
- const Kt = k((g) => {
2404
- const f = _.getRoom();
2405
- if (f)
2415
+ const Kt = k((h) => {
2416
+ const u = _.getRoom();
2417
+ if (u)
2406
2418
  try {
2407
- const Z = new TextEncoder().encode(
2408
- JSON.stringify({ type: "user_message", text: g })
2419
+ const J = new TextEncoder().encode(
2420
+ JSON.stringify({ type: "user_message", text: h })
2409
2421
  );
2410
- f.localParticipant.publishData(Z, { reliable: !0 });
2422
+ u.localParticipant.publishData(J, { reliable: !0 });
2411
2423
  } catch {
2412
2424
  }
2413
2425
  }, [_]), Xt = k(() => {
2414
- Jt((g) => !g);
2426
+ Gt((h) => !h);
2415
2427
  }, []);
2416
2428
  T(() => {
2417
- we == null || we(_.connectionState), _.connectionState === "connected" ? ge == null || ge() : _.connectionState === "disconnected" && (ye == null || ye());
2418
- }, [_.connectionState, ge, ye, we]), T(() => {
2419
- ve == null || ve(_.transcript);
2420
- }, [_.transcript, ve]), T(() => {
2421
- be == null || be(_.agentState);
2422
- }, [_.agentState, be]);
2429
+ _e == null || _e(_.connectionState), _.connectionState === "connected" ? ye == null || ye() : _.connectionState === "disconnected" && (ve == null || ve());
2430
+ }, [_.connectionState, ye, ve, _e]), T(() => {
2431
+ be == null || be(_.transcript);
2432
+ }, [_.transcript, be]), T(() => {
2433
+ we == null || we(_.agentState);
2434
+ }, [_.agentState, we]);
2423
2435
  const vt = E(!1);
2424
2436
  T(() => {
2425
2437
  _.isControlled || !s || vt.current || ae && _.connectionState === "idle" && (vt.current = !0, _.connect());
2426
2438
  }, [s, _.connectionState, _, ae]);
2427
2439
  const Qt = k(
2428
- (g) => {
2429
- const f = C == null ? void 0 : C.find((Z) => Z.id === g);
2430
- f && (Ye(!1), g !== fe && (y(!0), _.disconnect(), ie || Le(g), v == null || v(f)));
2440
+ (h) => {
2441
+ const u = C == null ? void 0 : C.find((J) => J.id === h);
2442
+ u && (Je(!1), h !== pe && (y(!0), _.disconnect(), oe || Se(h), v == null || v(u)));
2431
2443
  },
2432
2444
  [
2433
2445
  C,
2434
- fe,
2446
+ pe,
2435
2447
  _,
2436
- ie,
2448
+ oe,
2437
2449
  v
2438
2450
  ]
2439
2451
  );
2440
2452
  T(() => {
2441
- Se && _.connectionState === "connected" && y(!1);
2442
- }, [_.connectionState, Se]), T(() => {
2443
- if (!K) return;
2444
- const g = (f) => {
2445
- f.key === "Escape" && Ye(!1);
2453
+ Ce && _.connectionState === "connected" && y(!1);
2454
+ }, [_.connectionState, Ce]), T(() => {
2455
+ if (!X) return;
2456
+ const h = (u) => {
2457
+ u.key === "Escape" && Je(!1);
2446
2458
  };
2447
- return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
2448
- }, [K]);
2449
- const Zt = !!I || !!(J != null && J.avatarImageUrl) || _.isControlled, Pe = kn(Re, o, Zt);
2450
- me === void 0 && ((wt = Pe.info) != null && wt.capabilities) && (at.current = Pe.info.capabilities);
2451
- const Ge = (J == null ? void 0 : J.name) ?? H ?? ((_t = _.agentConfig) == null ? void 0 : _t.name) ?? ((xt = Pe.info) == null ? void 0 : xt.name) ?? "Live Layer", ct = (J == null ? void 0 : J.avatarImageUrl) ?? I ?? ((kt = _.agentConfig) == null ? void 0 : kt.avatarImageUrl) ?? ((Lt = Pe.info) == null ? void 0 : Lt.avatarImageUrl) ?? null, en = b ?? ((St = _.agentConfig) == null ? void 0 : St.idleLoopUrl) ?? ((Ct = Pe.info) == null ? void 0 : Ct.idleLoopUrl) ?? null, tn = z ?? null, nn = k(() => ee("expanded"), [ee]), rn = k(
2459
+ return window.addEventListener("keydown", h), () => window.removeEventListener("keydown", h);
2460
+ }, [X]);
2461
+ const Zt = !!I || !!(K != null && K.avatarImageUrl) || _.isControlled, $e = kn(Me, i, Zt);
2462
+ ge === void 0 && ((wt = $e.info) != null && wt.capabilities) && (at.current = $e.info.capabilities);
2463
+ const Ge = (K == null ? void 0 : K.name) ?? H ?? ((_t = _.agentConfig) == null ? void 0 : _t.name) ?? ((xt = $e.info) == null ? void 0 : xt.name) ?? "Live Layer", ct = (K == null ? void 0 : K.avatarImageUrl) ?? I ?? ((kt = _.agentConfig) == null ? void 0 : kt.avatarImageUrl) ?? ((Lt = $e.info) == null ? void 0 : Lt.avatarImageUrl) ?? null, en = b ?? ((St = _.agentConfig) == null ? void 0 : St.idleLoopUrl) ?? ((Ct = $e.info) == null ? void 0 : Ct.idleLoopUrl) ?? null, tn = z ?? null, nn = k(() => ee("expanded"), [ee]), rn = k(
2452
2464
  () => ee("minimized"),
2453
2465
  [ee]
2454
2466
  ), bt = k(() => {
2455
2467
  _.disconnect(), ee("hidden");
2456
2468
  }, [_, ee]), on = k(() => {
2457
- const g = _.audioElement;
2458
- g && g.play().then(() => Me(!1)).catch(() => {
2469
+ const h = _.audioElement;
2470
+ h && h.play().then(() => Pe(!1)).catch(() => {
2459
2471
  });
2460
2472
  }, [_.audioElement]), ln = k(() => {
2461
- Me(!1), _.connect();
2462
- }, [_]), De = {
2463
- ...Fe,
2464
- zIndex: Ue
2473
+ Pe(!1), _.connect();
2474
+ }, [_]), ze = {
2475
+ ...je,
2476
+ zIndex: Ve
2465
2477
  };
2466
- p.primaryColor && (De["--ll-color-primary"] = p.primaryColor), p.accentColor && (De["--ll-color-accent"] = p.accentColor), p.backgroundColor && (De["--ll-color-bg"] = p.backgroundColor), p.textColor && (De["--ll-color-fg"] = p.textColor);
2478
+ p.primaryColor && (ze["--ll-color-primary"] = p.primaryColor), p.accentColor && (ze["--ll-color-accent"] = p.accentColor), p.backgroundColor && (ze["--ll-color-bg"] = p.backgroundColor), p.textColor && (ze["--ll-color-fg"] = p.textColor);
2467
2479
  const an = [
2468
2480
  "ll-widget",
2469
2481
  `ll-widget--${ne}`,
2470
2482
  `ll-widget--${le ? "mobile" : "desktop"}`,
2471
- We
2483
+ Ue
2472
2484
  ].filter(Boolean).join(" ");
2473
2485
  return ae ? /* @__PURE__ */ w(
2474
2486
  "div",
2475
2487
  {
2476
2488
  className: an,
2477
- style: De,
2489
+ style: ze,
2478
2490
  "data-display-mode": ne,
2479
- "data-position": h,
2491
+ "data-position": m,
2480
2492
  children: [
2481
2493
  ne === "hidden" && /* @__PURE__ */ n(
2482
2494
  Vn,
2483
2495
  {
2484
- position: h,
2496
+ position: m,
2485
2497
  isMobile: le,
2486
2498
  isSpeaking: _.agentState === "speaking",
2487
2499
  onExpand: () => ee("expanded"),
@@ -2491,24 +2503,24 @@ function Sr(e) {
2491
2503
  }
2492
2504
  ),
2493
2505
  ne === "minimized" && /* @__PURE__ */ n(
2494
- Gn,
2506
+ Jn,
2495
2507
  {
2496
- position: h,
2508
+ position: m,
2497
2509
  isMobile: le,
2498
2510
  agentName: Ge,
2499
2511
  avatarImageUrl: ct,
2500
2512
  agentState: _.agentState,
2501
- isMuted: Q.isMuted,
2513
+ isMuted: Z.isMuted,
2502
2514
  audioLevel: ce,
2503
2515
  onExpand: nn,
2504
- onToggleMute: Q.toggleMute,
2516
+ onToggleMute: Z.toggleMute,
2505
2517
  onClose: bt
2506
2518
  }
2507
2519
  ),
2508
2520
  ne === "expanded" && /* @__PURE__ */ n(
2509
2521
  Kn,
2510
2522
  {
2511
- position: h,
2523
+ position: m,
2512
2524
  isMobile: le,
2513
2525
  agentName: Ge,
2514
2526
  avatarImageUrl: ct,
@@ -2516,46 +2528,46 @@ function Sr(e) {
2516
2528
  greeting: tn,
2517
2529
  branding: p,
2518
2530
  teamMembers: C,
2519
- currentTeamMemberId: fe,
2520
- isSwitchingTeamMember: Se,
2521
- teamSwitcherOpen: K,
2522
- onToggleTeamSwitcher: () => Ye((g) => !g),
2531
+ currentTeamMemberId: pe,
2532
+ isSwitchingTeamMember: Ce,
2533
+ teamSwitcherOpen: X,
2534
+ onToggleTeamSwitcher: () => Je((h) => !h),
2523
2535
  onSelectTeamMember: Qt,
2524
2536
  connectionState: _.connectionState,
2525
2537
  agentState: _.agentState,
2526
2538
  transcript: _.transcript,
2527
- isMuted: Q.isMuted,
2528
- micDevices: Ie.mics,
2539
+ isMuted: Z.isMuted,
2540
+ micDevices: Te.mics,
2529
2541
  isCameraEnabled: re.isEnabled,
2530
2542
  cameraPreviewEl: re.previewEl,
2531
- cameraDevices: Ie.cameras,
2543
+ cameraDevices: Te.cameras,
2532
2544
  activeCameraId: re.activeDeviceId,
2533
- isScreenShareEnabled: pe.isEnabled,
2534
- screenPreviewEl: pe.previewEl,
2545
+ isScreenShareEnabled: he.isEnabled,
2546
+ screenPreviewEl: he.previewEl,
2535
2547
  isSpeakerMuted: nt,
2536
2548
  allowCamera: N,
2537
2549
  allowScreenShare: B,
2538
2550
  allowTyping: D,
2539
2551
  languageMenuOpen: Yt,
2540
- onToggleLanguageMenu: () => Gt((g) => !g),
2541
- needsUserGesture: Ve,
2552
+ onToggleLanguageMenu: () => Jt((h) => !h),
2553
+ needsUserGesture: Ye,
2542
2554
  canResume: _.canResume,
2543
- micError: Q.micError,
2555
+ micError: Z.micError,
2544
2556
  error: _.error,
2545
2557
  avatarVideoContainerRef: yt,
2546
2558
  onConnect: () => void _.connect(),
2547
2559
  onDisconnect: () => _.disconnect(),
2548
2560
  onRetry: ln,
2549
2561
  onResumeAudio: on,
2550
- onToggleMute: Q.toggleMute,
2562
+ onToggleMute: Z.toggleMute,
2551
2563
  onToggleCamera: () => void re.toggle(),
2552
- onSwitchCameraDevice: (g) => void re.switchDevice(g),
2553
- onToggleScreenShare: () => void pe.toggle(),
2564
+ onSwitchCameraDevice: (h) => void re.switchDevice(h),
2565
+ onToggleScreenShare: () => void he.toggle(),
2554
2566
  onToggleSpeaker: Xt,
2555
2567
  onSendMessage: Kt,
2556
2568
  onMinimize: rn,
2557
2569
  onClose: bt,
2558
- onClearMicError: Q.clearError
2570
+ onClearMicError: Z.clearError
2559
2571
  }
2560
2572
  )
2561
2573
  ]
@@ -2569,61 +2581,61 @@ const Pr = ({
2569
2581
  agentId: e,
2570
2582
  baseUrl: t,
2571
2583
  apiKey: r,
2572
- mode: o,
2573
- onAgentEvent: i,
2584
+ mode: i,
2585
+ onAgentEvent: o,
2574
2586
  className: l,
2575
2587
  style: s
2576
2588
  }) => {
2577
- const d = E(null), u = E(null), m = E(i);
2578
- m.current = i;
2579
- const h = k((a) => {
2589
+ const d = E(null), f = E(null), g = E(o);
2590
+ g.current = o;
2591
+ const m = k((a) => {
2580
2592
  var R;
2581
2593
  const c = a.detail;
2582
- (R = m.current) == null || R.call(m, c);
2594
+ (R = g.current) == null || R.call(g, c);
2583
2595
  }, []);
2584
2596
  return T(() => {
2585
2597
  const a = d.current;
2586
2598
  if (!a) return;
2587
2599
  const c = document.createElement("livelayer-widget");
2588
- return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), o && c.setAttribute("mode", o), c.addEventListener("agent-event", h), a.appendChild(c), u.current = c, () => {
2589
- c.removeEventListener("agent-event", h), a.removeChild(c), u.current = null;
2600
+ return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), i && c.setAttribute("mode", i), c.addEventListener("agent-event", m), a.appendChild(c), f.current = c, () => {
2601
+ c.removeEventListener("agent-event", m), a.removeChild(c), f.current = null;
2590
2602
  };
2591
2603
  }, [e]), T(() => {
2592
- u.current && (o ? u.current.setAttribute("mode", o) : u.current.removeAttribute("mode"));
2593
- }, [o]), /* @__PURE__ */ n("div", { ref: d, className: l, style: s });
2604
+ f.current && (i ? f.current.setAttribute("mode", i) : f.current.removeAttribute("mode"));
2605
+ }, [i]), /* @__PURE__ */ n("div", { ref: d, className: l, style: s });
2594
2606
  }, Dr = ft(
2595
- function({ id: t, intent: r, as: o = "div", className: i, style: l, children: s }, d) {
2607
+ function({ id: t, intent: r, as: i = "div", className: o, style: l, children: s }, d) {
2596
2608
  return un(
2597
- o,
2609
+ i,
2598
2610
  {
2599
2611
  ref: d,
2600
2612
  "data-ll-region": t,
2601
2613
  "data-ll-intent": r,
2602
- className: i,
2614
+ className: o,
2603
2615
  style: l
2604
2616
  },
2605
2617
  s
2606
2618
  );
2607
2619
  }
2608
2620
  ), $r = ft(
2609
- function({ id: t, intent: r, children: o, ...i }, l) {
2621
+ function({ id: t, intent: r, children: i, ...o }, l) {
2610
2622
  return /* @__PURE__ */ n(
2611
2623
  "form",
2612
2624
  {
2613
2625
  ref: l,
2614
2626
  "data-ll-form": t,
2615
2627
  "data-ll-intent": r,
2616
- ...i,
2617
- children: o
2628
+ ...o,
2629
+ children: i
2618
2630
  }
2619
2631
  );
2620
2632
  }
2621
2633
  ), zr = ft(
2622
2634
  function(t, r) {
2623
- const { name: o, label: i, labelClassName: l } = t, s = { name: o, "data-ll-field": o };
2635
+ const { name: i, label: o, labelClassName: l } = t, s = { name: i, "data-ll-field": i };
2624
2636
  let d;
2625
2637
  if ("as" in t && t.as === "textarea") {
2626
- const { name: u, label: m, labelClassName: h, as: a, ...c } = t;
2638
+ const { name: f, label: g, labelClassName: m, as: a, ...c } = t;
2627
2639
  d = /* @__PURE__ */ n(
2628
2640
  "textarea",
2629
2641
  {
@@ -2633,7 +2645,7 @@ const Pr = ({
2633
2645
  }
2634
2646
  );
2635
2647
  } else if ("as" in t && t.as === "select") {
2636
- const { name: u, label: m, labelClassName: h, as: a, children: c, ...R } = t;
2648
+ const { name: f, label: g, labelClassName: m, as: a, children: c, ...R } = t;
2637
2649
  d = /* @__PURE__ */ n(
2638
2650
  "select",
2639
2651
  {
@@ -2644,7 +2656,7 @@ const Pr = ({
2644
2656
  }
2645
2657
  );
2646
2658
  } else {
2647
- const { name: u, label: m, labelClassName: h, as: a, ...c } = t;
2659
+ const { name: f, label: g, labelClassName: m, as: a, ...c } = t;
2648
2660
  d = /* @__PURE__ */ n(
2649
2661
  "input",
2650
2662
  {
@@ -2654,8 +2666,8 @@ const Pr = ({
2654
2666
  }
2655
2667
  );
2656
2668
  }
2657
- return i === void 0 ? d : /* @__PURE__ */ w("label", { className: l, children: [
2658
- i,
2669
+ return o === void 0 ? d : /* @__PURE__ */ w("label", { className: l, children: [
2670
+ o,
2659
2671
  d
2660
2672
  ] });
2661
2673
  }
@@ -2666,21 +2678,21 @@ function Hr({
2666
2678
  defaultOpen: t = !1,
2667
2679
  storageKey: r = "ll-debug-open"
2668
2680
  }) {
2669
- const [o, i] = S(t), [l, s] = S([]), [d, u] = S(""), [m, h] = S(!1), a = E(/* @__PURE__ */ new Set()), c = E([]), R = E(m);
2670
- R.current = m, T(() => {
2681
+ const [i, o] = S(t), [l, s] = S([]), [d, f] = S(""), [g, m] = S(!1), a = E(/* @__PURE__ */ new Set()), c = E([]), R = E(g);
2682
+ R.current = g, T(() => {
2671
2683
  try {
2672
2684
  const v = localStorage.getItem(r);
2673
- v === "1" && i(!0), v === "0" && i(!1);
2685
+ v === "1" && o(!0), v === "0" && o(!1);
2674
2686
  } catch {
2675
2687
  }
2676
2688
  }, [r]), T(() => {
2677
2689
  try {
2678
- localStorage.setItem(r, o ? "1" : "0");
2690
+ localStorage.setItem(r, i ? "1" : "0");
2679
2691
  } catch {
2680
2692
  }
2681
- }, [o, r]), T(() => {
2693
+ }, [i, r]), T(() => {
2682
2694
  const v = (b) => {
2683
- (b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(), i((z) => !z));
2695
+ (b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(), o((z) => !z));
2684
2696
  };
2685
2697
  return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
2686
2698
  }, []), T(() => {
@@ -2722,12 +2734,12 @@ function Hr({
2722
2734
  return console.warn = z("warn", v), console.log = z("log", b), () => {
2723
2735
  console.warn = v, console.log = b;
2724
2736
  };
2725
- }, []), !o)
2737
+ }, []), !i)
2726
2738
  return /* @__PURE__ */ n(
2727
2739
  "button",
2728
2740
  {
2729
2741
  type: "button",
2730
- onClick: () => i(!0),
2742
+ onClick: () => o(!0),
2731
2743
  title: "Open LiveLayer debug panel (Cmd/Ctrl + Shift + L)",
2732
2744
  "aria-label": "Open LiveLayer debug panel",
2733
2745
  style: {
@@ -2799,10 +2811,10 @@ function Hr({
2799
2811
  "button",
2800
2812
  {
2801
2813
  type: "button",
2802
- onClick: () => h((v) => !v),
2803
- style: dt(m ? "#f59e0b" : "transparent"),
2814
+ onClick: () => m((v) => !v),
2815
+ style: dt(g ? "#f59e0b" : "transparent"),
2804
2816
  title: "Pause / resume capture",
2805
- children: m ? "▶ resume" : "⏸ pause"
2817
+ children: g ? "▶ resume" : "⏸ pause"
2806
2818
  }
2807
2819
  ),
2808
2820
  /* @__PURE__ */ n(
@@ -2821,7 +2833,7 @@ function Hr({
2821
2833
  "button",
2822
2834
  {
2823
2835
  type: "button",
2824
- onClick: () => i(!1),
2836
+ onClick: () => o(!1),
2825
2837
  style: dt("transparent"),
2826
2838
  "aria-label": "Close",
2827
2839
  title: "Close (Cmd/Ctrl + Shift + L)",
@@ -2836,7 +2848,7 @@ function Hr({
2836
2848
  {
2837
2849
  type: "text",
2838
2850
  value: d,
2839
- onChange: (v) => u(v.target.value),
2851
+ onChange: (v) => f(v.target.value),
2840
2852
  placeholder: "filter by type or data…",
2841
2853
  style: {
2842
2854
  margin: 8,
@@ -2910,7 +2922,7 @@ function Cr({
2910
2922
  expanded: t,
2911
2923
  onToggle: r
2912
2924
  }) {
2913
- const o = e.kind === "warn" ? "#f59e0b" : e.type.startsWith("[LiveLayer]") ? "#94a3b8" : e.type === "navigate" || e.type === "scroll_page" || e.type === "scroll_to" || e.type === "click" ? "#22c55e" : e.type === "fill_form" || e.type === "submit_form" || e.type === "focus_field" ? "#a78bfa" : e.type === "request_page_context" || e.type === "request_routes" ? "#38bdf8" : e.type === "agent_state" ? "#facc15" : "#cbd5e1", i = new Date(e.ts).toLocaleTimeString("en-US", {
2925
+ const i = e.kind === "warn" ? "#f59e0b" : e.type.startsWith("[LiveLayer]") ? "#94a3b8" : e.type === "navigate" || e.type === "scroll_page" || e.type === "scroll_to" || e.type === "click" ? "#22c55e" : e.type === "fill_form" || e.type === "submit_form" || e.type === "focus_field" ? "#a78bfa" : e.type === "request_page_context" || e.type === "request_routes" ? "#38bdf8" : e.type === "agent_state" ? "#facc15" : "#cbd5e1", o = new Date(e.ts).toLocaleTimeString("en-US", {
2914
2926
  hour12: !1
2915
2927
  });
2916
2928
  return /* @__PURE__ */ w(
@@ -2940,14 +2952,14 @@ function Cr({
2940
2952
  fontVariantNumeric: "tabular-nums",
2941
2953
  fontSize: 10
2942
2954
  },
2943
- children: i
2955
+ children: o
2944
2956
  }
2945
2957
  ),
2946
2958
  /* @__PURE__ */ n(
2947
2959
  "span",
2948
2960
  {
2949
2961
  style: {
2950
- color: o,
2962
+ color: i,
2951
2963
  fontWeight: 600,
2952
2964
  flexShrink: 0
2953
2965
  },
@@ -2994,20 +3006,20 @@ function Er(e) {
2994
3006
  }
2995
3007
  }
2996
3008
  function Or() {
2997
- const [e, t] = S([]), r = k((i) => {
3009
+ const [e, t] = S([]), r = k((o) => {
2998
3010
  t((l) => {
2999
- const s = l.findIndex((d) => d.id === i.id);
3011
+ const s = l.findIndex((d) => d.id === o.id);
3000
3012
  if (s >= 0) {
3001
3013
  const d = l.slice();
3002
- return d[s] = i, d;
3014
+ return d[s] = o, d;
3003
3015
  }
3004
- return [...l, i];
3016
+ return [...l, o];
3005
3017
  });
3006
- }, []), o = k(() => t([]), []);
3018
+ }, []), i = k(() => t([]), []);
3007
3019
  return {
3008
3020
  entries: e,
3009
3021
  pushSegment: r,
3010
- clear: o,
3022
+ clear: i,
3011
3023
  latest: e.length > 0 ? e[e.length - 1] : null
3012
3024
  };
3013
3025
  }