@livelayer/react 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { jsxs as b, jsx as e, Fragment as Qe } from "react/jsx-runtime";
3
- import { Component as Ze, useState as k, useRef as L, useEffect as S, useCallback as g, useMemo as Se } from "react";
4
- import { LiveKitSession as et } from "@livelayer/sdk";
5
- import { createLocalAudioTrack as tt, Track as Oe, createLocalVideoTrack as nt } from "livekit-client";
6
- class rt extends Ze {
2
+ import { jsxs as _, jsx as e, Fragment as Ze } from "react/jsx-runtime";
3
+ import { Component as et, useState as k, useRef as M, useEffect as S, useCallback as g, useMemo as Se } from "react";
4
+ import { LiveKitSession as tt } from "@livelayer/sdk";
5
+ import { createLocalAudioTrack as nt, Track as We, createLocalVideoTrack as rt } from "livekit-client";
6
+ class it extends et {
7
7
  constructor() {
8
8
  super(...arguments), this.state = { hasError: !1, error: null }, this.reset = () => {
9
9
  this.setState({ hasError: !1, error: null });
@@ -13,12 +13,12 @@ class rt extends Ze {
13
13
  return { hasError: !0, error: n };
14
14
  }
15
15
  componentDidCatch(n, i) {
16
- var o, r;
17
- (r = (o = this.props).onError) == null || r.call(o, n, i);
16
+ var l, r;
17
+ (r = (l = this.props).onError) == null || r.call(l, n, i);
18
18
  }
19
19
  render() {
20
20
  var n;
21
- return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ b("div", { className: "ll-error-boundary", role: "alert", children: [
21
+ return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ _("div", { className: "ll-error-boundary", role: "alert", children: [
22
22
  /* @__PURE__ */ e("p", { className: "ll-error-boundary__title", children: "Widget crashed" }),
23
23
  /* @__PURE__ */ e("p", { className: "ll-error-boundary__message", children: ((n = this.state.error) == null ? void 0 : n.message) || "Something went wrong." }),
24
24
  /* @__PURE__ */ e(
@@ -33,8 +33,8 @@ class rt extends Ze {
33
33
  ] }) : this.props.children;
34
34
  }
35
35
  }
36
- function it(t) {
37
- const [n, i] = k("idle"), [o, r] = k("idle"), [s, c] = k([]), [m, d] = k(null), [f, h] = k(null), [l, a] = k(null), [C, _] = k(!1), [N, D] = k(null), E = L(null), R = L(t.onDataMessage);
36
+ function lt(t) {
37
+ const [n, i] = k("idle"), [l, r] = k("idle"), [s, c] = k([]), [m, d] = k(null), [f, p] = k(null), [o, a] = k(null), [C, b] = k(!1), [N, D] = k(null), E = M(null), R = M(t.onDataMessage);
38
38
  R.current = t.onDataMessage, S(() => {
39
39
  const w = {
40
40
  onConnectionStateChange: (y) => {
@@ -44,15 +44,15 @@ function it(t) {
44
44
  onTranscript: (y) => c([...y]),
45
45
  onAgentConfig: d,
46
46
  onAudioTrack: (y) => a(y),
47
- onVideoTrack: (y) => h(y),
48
- onVideoTrackRemoved: () => h(null),
47
+ onVideoTrack: (y) => p(y),
48
+ onVideoTrackRemoved: () => p(null),
49
49
  onError: (y) => D(y),
50
50
  onDataMessage: (y) => {
51
51
  var A;
52
52
  (A = R.current) == null || A.call(R, y);
53
53
  },
54
- onResumabilityChange: _
55
- }, x = new et(
54
+ onResumabilityChange: b
55
+ }, x = new tt(
56
56
  {
57
57
  agentId: t.agentId,
58
58
  baseUrl: t.baseUrl,
@@ -62,7 +62,7 @@ function it(t) {
62
62
  },
63
63
  w
64
64
  );
65
- return E.current = x, i("idle"), r("idle"), c([]), d(null), h(null), a(null), _(!1), D(null), () => {
65
+ return E.current = x, i("idle"), r("idle"), c([]), d(null), p(null), a(null), b(!1), D(null), () => {
66
66
  var y;
67
67
  (y = x.destroy) == null || y.call(x), E.current = null;
68
68
  };
@@ -90,11 +90,11 @@ function it(t) {
90
90
  }, []);
91
91
  return {
92
92
  connectionState: n,
93
- agentState: o,
93
+ agentState: l,
94
94
  transcript: s,
95
95
  agentConfig: m,
96
96
  videoElement: f,
97
- audioElement: l,
97
+ audioElement: o,
98
98
  canResume: C,
99
99
  error: N,
100
100
  connect: T,
@@ -104,33 +104,33 @@ function it(t) {
104
104
  };
105
105
  }
106
106
  function ot() {
107
- const t = L(null), n = L(null), i = L(null), o = L(null), r = L(/* @__PURE__ */ new Set()), s = L(null), c = g(() => {
108
- const l = n.current;
109
- if (!l) {
110
- o.current = null;
107
+ const t = M(null), n = M(null), i = M(null), l = M(null), r = M(/* @__PURE__ */ new Set()), s = M(null), c = g(() => {
108
+ const o = n.current;
109
+ if (!o) {
110
+ l.current = null;
111
111
  return;
112
112
  }
113
- (!s.current || s.current.length !== l.frequencyBinCount) && (s.current = new Uint8Array(
114
- new ArrayBuffer(l.frequencyBinCount)
113
+ (!s.current || s.current.length !== o.frequencyBinCount) && (s.current = new Uint8Array(
114
+ new ArrayBuffer(o.frequencyBinCount)
115
115
  ));
116
116
  const a = s.current;
117
- l.getByteFrequencyData(a);
117
+ o.getByteFrequencyData(a);
118
118
  let C = 0;
119
119
  for (let N = 0; N < a.length; N++) C += a[N];
120
- const _ = C / a.length / 255;
120
+ const b = C / a.length / 255;
121
121
  for (const N of r.current)
122
122
  try {
123
- N(_);
123
+ N(b);
124
124
  } catch (D) {
125
125
  console.error("[useAudioLevel] subscriber threw:", D);
126
126
  }
127
- o.current = requestAnimationFrame(c);
127
+ l.current = requestAnimationFrame(c);
128
128
  }, []), m = g(() => {
129
129
  if (t.current || typeof window > "u" || typeof AudioContext > "u") return;
130
- const l = new AudioContext(), a = l.createAnalyser();
131
- a.fftSize = 64, a.connect(l.destination), t.current = l, n.current = a;
130
+ const o = new AudioContext(), a = o.createAnalyser();
131
+ a.fftSize = 64, a.connect(o.destination), t.current = o, n.current = a;
132
132
  }, []), d = g(
133
- (l) => {
133
+ (o) => {
134
134
  if (m(), !(!t.current || !n.current)) {
135
135
  if (i.current) {
136
136
  try {
@@ -140,26 +140,26 @@ function ot() {
140
140
  i.current = null;
141
141
  }
142
142
  try {
143
- const a = t.current.createMediaElementSource(l);
143
+ const a = t.current.createMediaElementSource(o);
144
144
  a.connect(n.current), i.current = a;
145
145
  } catch (a) {
146
146
  console.warn("[useAudioLevel] createMediaElementSource failed:", a);
147
147
  return;
148
148
  }
149
- o.current === null && (o.current = requestAnimationFrame(c));
149
+ l.current === null && (l.current = requestAnimationFrame(c));
150
150
  }
151
151
  },
152
152
  [m, c]
153
153
  ), f = g(() => {
154
- if (o.current !== null && (cancelAnimationFrame(o.current), o.current = null), i.current) {
154
+ if (l.current !== null && (cancelAnimationFrame(l.current), l.current = null), i.current) {
155
155
  try {
156
156
  i.current.disconnect();
157
157
  } catch {
158
158
  }
159
159
  i.current = null;
160
160
  }
161
- }, []), h = g((l) => (r.current.add(l), () => {
162
- r.current.delete(l);
161
+ }, []), p = g((o) => (r.current.add(o), () => {
162
+ r.current.delete(o);
163
163
  }), []);
164
164
  return S(() => () => {
165
165
  if (f(), n.current) {
@@ -177,10 +177,10 @@ function ot() {
177
177
  t.current = null;
178
178
  }
179
179
  r.current.clear(), s.current = null;
180
- }, [f]), { attach: d, detach: f, subscribe: h };
180
+ }, [f]), { attach: d, detach: f, subscribe: p };
181
181
  }
182
- function lt() {
183
- const [t, n] = k(!1), [i, o] = k(null), r = L(null), s = L(null), c = g(async (h) => {
182
+ function at() {
183
+ const [t, n] = k(!1), [i, l] = k(null), r = M(null), s = M(null), c = g(async (p) => {
184
184
  if (r.current && s.current) {
185
185
  try {
186
186
  await s.current.localParticipant.unpublishTrack(r.current);
@@ -188,31 +188,31 @@ function lt() {
188
188
  }
189
189
  r.current.stop(), r.current = null;
190
190
  }
191
- s.current = h, o(null);
191
+ s.current = p, l(null);
192
192
  try {
193
- const l = await tt({
193
+ const o = await nt({
194
194
  echoCancellation: !0,
195
195
  noiseSuppression: !0
196
196
  });
197
- await h.localParticipant.publishTrack(l), r.current = l, n(l.isMuted);
198
- } catch (l) {
199
- const a = l instanceof Error && l.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
200
- throw o(a), l;
197
+ await p.localParticipant.publishTrack(o), r.current = o, n(o.isMuted);
198
+ } catch (o) {
199
+ const a = o instanceof Error && o.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
200
+ throw l(a), o;
201
201
  }
202
202
  }, []), m = g(() => {
203
- const h = r.current;
204
- h && (h.isMuted ? (h.unmute(), n(!1)) : (h.mute(), n(!0)));
203
+ const p = r.current;
204
+ p && (p.isMuted ? (p.unmute(), n(!1)) : (p.mute(), n(!0)));
205
205
  }, []), d = g(() => {
206
- const h = r.current, l = s.current;
207
- if (h && l) {
206
+ const p = r.current, o = s.current;
207
+ if (p && o) {
208
208
  try {
209
- l.localParticipant.unpublishTrack(h);
209
+ o.localParticipant.unpublishTrack(p);
210
210
  } catch {
211
211
  }
212
- h.stop();
212
+ p.stop();
213
213
  }
214
214
  r.current = null, s.current = null, n(!1);
215
- }, []), f = g(() => o(null), []);
215
+ }, []), f = g(() => l(null), []);
216
216
  return {
217
217
  isMuted: t,
218
218
  micError: i,
@@ -222,14 +222,14 @@ function lt() {
222
222
  clearError: f
223
223
  };
224
224
  }
225
- const at = { resolution: { width: 640, height: 480, frameRate: 24 } };
226
- function st() {
227
- const [t, n] = k(!1), [i, o] = k(null), [r, s] = k(null), [c, m] = k(""), d = L(null), f = L(null), h = g((E) => {
225
+ const st = { resolution: { width: 640, height: 480, frameRate: 24 } };
226
+ function ct() {
227
+ const [t, n] = k(!1), [i, l] = k(null), [r, s] = k(null), [c, m] = k(""), d = M(null), f = M(null), p = g((E) => {
228
228
  d.current = E;
229
- }, []), l = g(() => {
229
+ }, []), o = g(() => {
230
230
  const E = d.current, R = f.current;
231
231
  if (R && E) {
232
- const T = E.localParticipant.getTrackPublication(Oe.Source.Camera);
232
+ const T = E.localParticipant.getTrackPublication(We.Source.Camera);
233
233
  if (T != null && T.track) {
234
234
  try {
235
235
  E.localParticipant.unpublishTrack(T.track);
@@ -243,11 +243,11 @@ function st() {
243
243
  }, []), a = g(async (E) => {
244
244
  const R = d.current;
245
245
  if (R) {
246
- o(null);
246
+ l(null);
247
247
  try {
248
- const T = { ...at };
248
+ const T = { ...st };
249
249
  E && (T.deviceId = E);
250
- const z = await nt(T);
250
+ const z = await rt(T);
251
251
  await R.localParticipant.publishTrack(z), f.current = z;
252
252
  const I = z.attach();
253
253
  s(I), n(!0), E && m(E);
@@ -260,16 +260,16 @@ function st() {
260
260
  }
261
261
  } catch (T) {
262
262
  const z = T instanceof Error && T.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
263
- o(z);
263
+ l(z);
264
264
  }
265
265
  }
266
266
  }, []), C = g(async () => {
267
- t ? l() : await a(c || void 0);
268
- }, [t, c, l, a]), _ = g(async (E) => {
269
- l(), await a(E);
270
- }, [l, a]), N = g(() => {
271
- l(), d.current = null, o(null), m("");
272
- }, [l]), D = g(() => o(null), []);
267
+ t ? o() : await a(c || void 0);
268
+ }, [t, c, o, a]), b = g(async (E) => {
269
+ o(), await a(E);
270
+ }, [o, a]), N = g(() => {
271
+ o(), d.current = null, l(null), m("");
272
+ }, [o]), D = g(() => l(null), []);
273
273
  return S(() => () => {
274
274
  f.current && f.current.stop();
275
275
  }, []), {
@@ -278,14 +278,14 @@ function st() {
278
278
  previewEl: r,
279
279
  activeDeviceId: c,
280
280
  toggle: C,
281
- switchDevice: _,
282
- attachRoom: h,
281
+ switchDevice: b,
282
+ attachRoom: p,
283
283
  teardown: N,
284
284
  clearError: D
285
285
  };
286
286
  }
287
- function ct() {
288
- const [t, n] = k(!1), [i, o] = k(null), [r, s] = k(null), c = L(null), m = g((a) => {
287
+ function dt() {
288
+ const [t, n] = k(!1), [i, l] = k(null), [r, s] = k(null), c = M(null), m = g((a) => {
289
289
  c.current = a;
290
290
  }, []), d = g(() => s(null), []), f = g(async () => {
291
291
  const a = c.current;
@@ -298,12 +298,12 @@ function ct() {
298
298
  d(), n(!1);
299
299
  return;
300
300
  }
301
- o(null);
301
+ l(null);
302
302
  try {
303
303
  await a.localParticipant.setScreenShareEnabled(!0);
304
304
  let C = 0;
305
- const _ = () => {
306
- const N = a.localParticipant.getTrackPublication(Oe.Source.ScreenShare);
305
+ const b = () => {
306
+ const N = a.localParticipant.getTrackPublication(We.Source.ScreenShare);
307
307
  if (N != null && N.track) {
308
308
  const D = N.track.attach();
309
309
  s(D), n(!0);
@@ -316,31 +316,31 @@ function ct() {
316
316
  }
317
317
  return;
318
318
  }
319
- C++ < 10 ? setTimeout(_, 100) : n(!0);
319
+ C++ < 10 ? setTimeout(b, 100) : n(!0);
320
320
  };
321
- _();
321
+ b();
322
322
  } catch (C) {
323
- const _ = C instanceof Error ? C.name : "";
324
- _ !== "NotAllowedError" && _ !== "AbortError" && o("Screen share unavailable. Try again."), n(!1);
323
+ const b = C instanceof Error ? C.name : "";
324
+ b !== "NotAllowedError" && b !== "AbortError" && l("Screen share unavailable. Try again."), n(!1);
325
325
  }
326
326
  }
327
- }, [t, d]), h = g(() => {
327
+ }, [t, d]), p = g(() => {
328
328
  const a = c.current;
329
329
  if (a && t)
330
330
  try {
331
331
  a.localParticipant.setScreenShareEnabled(!1);
332
332
  } catch {
333
333
  }
334
- d(), n(!1), o(null), c.current = null;
335
- }, [t, d]), l = g(() => o(null), []);
336
- return { isEnabled: t, error: i, previewEl: r, toggle: f, attachRoom: m, teardown: h, clearError: l };
334
+ d(), n(!1), l(null), c.current = null;
335
+ }, [t, d]), o = g(() => l(null), []);
336
+ return { isEnabled: t, error: i, previewEl: r, toggle: f, attachRoom: m, teardown: p, clearError: o };
337
337
  }
338
- function dt() {
339
- const [t, n] = k([]), [i, o] = k([]), r = g(async () => {
338
+ function ut() {
339
+ const [t, n] = k([]), [i, l] = k([]), r = g(async () => {
340
340
  if (!(typeof navigator > "u" || !navigator.mediaDevices))
341
341
  try {
342
342
  const s = await navigator.mediaDevices.enumerateDevices();
343
- n(s.filter((c) => c.kind === "audioinput")), o(s.filter((c) => c.kind === "videoinput"));
343
+ n(s.filter((c) => c.kind === "audioinput")), l(s.filter((c) => c.kind === "videoinput"));
344
344
  } catch {
345
345
  }
346
346
  }, []);
@@ -350,30 +350,30 @@ function dt() {
350
350
  return navigator.mediaDevices.addEventListener("devicechange", s), () => navigator.mediaDevices.removeEventListener("devicechange", s);
351
351
  }, [r]), { mics: t, cameras: i, refresh: r };
352
352
  }
353
- function ut(t, n, i = !1) {
354
- const [o, r] = k(null), [s, c] = k(null), [m, d] = k(!i && !!t);
353
+ function ht(t, n, i = !1) {
354
+ const [l, r] = k(null), [s, c] = k(null), [m, d] = k(!i && !!t);
355
355
  return S(() => {
356
356
  if (i || !t) {
357
357
  d(!1);
358
358
  return;
359
359
  }
360
- const f = new AbortController(), h = n || "https://app.livelayer.studio";
361
- return d(!0), c(null), fetch(`${h}/api/widget/agent/${encodeURIComponent(t)}`, {
360
+ const f = new AbortController(), p = n || "https://app.livelayer.studio";
361
+ return d(!0), c(null), fetch(`${p}/api/widget/agent/${encodeURIComponent(t)}`, {
362
362
  signal: f.signal
363
- }).then(async (l) => {
364
- if (!l.ok) {
365
- const a = await l.json().catch(() => ({}));
366
- throw new Error(a.error || `HTTP ${l.status}`);
363
+ }).then(async (o) => {
364
+ if (!o.ok) {
365
+ const a = await o.json().catch(() => ({}));
366
+ throw new Error(a.error || `HTTP ${o.status}`);
367
367
  }
368
- return l.json();
369
- }).then((l) => {
370
- f.signal.aborted || (r(l), d(!1));
371
- }).catch((l) => {
372
- f.signal.aborted || (c(l instanceof Error ? l.message : "Agent lookup failed"), d(!1));
368
+ return o.json();
369
+ }).then((o) => {
370
+ f.signal.aborted || (r(o), d(!1));
371
+ }).catch((o) => {
372
+ f.signal.aborted || (c(o instanceof Error ? o.message : "Agent lookup failed"), d(!1));
373
373
  }), () => f.abort();
374
- }, [t, n, i]), { info: o, error: s, loading: m };
374
+ }, [t, n, i]), { info: l, error: s, loading: m };
375
375
  }
376
- function ht(t) {
376
+ function pt(t) {
377
377
  if (typeof window > "u") return null;
378
378
  try {
379
379
  return window.localStorage.getItem(t);
@@ -381,52 +381,52 @@ function ht(t) {
381
381
  return null;
382
382
  }
383
383
  }
384
- function pt(t, n) {
384
+ function mt(t, n) {
385
385
  if (!(typeof window > "u"))
386
386
  try {
387
387
  window.localStorage.setItem(t, n);
388
388
  } catch {
389
389
  }
390
390
  }
391
- function mt({
391
+ function ft({
392
392
  value: t,
393
393
  defaultValue: n = "expanded",
394
394
  onChange: i
395
395
  } = {}) {
396
- const o = t !== void 0, [r, s] = k(n), c = o ? t : r, m = g(
396
+ const l = t !== void 0, [r, s] = k(n), c = l ? t : r, m = g(
397
397
  (d) => {
398
- d !== c && (o || s(d), i == null || i(d));
398
+ d !== c && (l || s(d), i == null || i(d));
399
399
  },
400
- [c, o, i]
400
+ [c, l, i]
401
401
  );
402
402
  return [c, m];
403
403
  }
404
- const ft = ["hidden", "minimized", "expanded"];
405
- function gt(t) {
406
- return t && ft.includes(t) ? t : null;
404
+ const gt = ["hidden", "minimized", "expanded"];
405
+ function vt(t) {
406
+ return t && gt.includes(t) ? t : null;
407
407
  }
408
- function vt({
408
+ function yt({
409
409
  value: t,
410
410
  defaultValue: n = "expanded",
411
411
  onChange: i,
412
- persistKey: o = "ll-widget",
412
+ persistKey: l = "ll-widget",
413
413
  disablePersistence: r = !1
414
414
  } = {}) {
415
- const s = `${o}:display-mode`, c = L(!1), [m, d] = mt({
415
+ const s = `${l}:display-mode`, c = M(!1), [m, d] = ft({
416
416
  value: t,
417
417
  defaultValue: n,
418
418
  onChange: (f) => {
419
- t === void 0 && !r && pt(s, f), i == null || i(f);
419
+ t === void 0 && !r && mt(s, f), i == null || i(f);
420
420
  }
421
421
  });
422
422
  return S(() => {
423
423
  if (c.current || (c.current = !0, r || t !== void 0)) return;
424
- const f = gt(ht(s));
424
+ const f = vt(pt(s));
425
425
  f && f !== m && d(f);
426
426
  }, []), [m, d];
427
427
  }
428
- const yt = 640;
429
- function _t(t = yt) {
428
+ const _t = 640;
429
+ function bt(t = _t) {
430
430
  const [n, i] = k(!1);
431
431
  return S(() => {
432
432
  if (t === !1) {
@@ -435,13 +435,13 @@ function _t(t = yt) {
435
435
  }
436
436
  if (typeof window > "u" || typeof window.matchMedia > "u")
437
437
  return;
438
- const o = `(max-width: ${t - 1}px)`, r = window.matchMedia(o), s = () => i(r.matches);
438
+ const l = `(max-width: ${t - 1}px)`, r = window.matchMedia(l), s = () => i(r.matches);
439
439
  return s(), typeof r.addEventListener == "function" ? (r.addEventListener("change", s), () => r.removeEventListener("change", s)) : (r.addListener(s), () => {
440
440
  r.removeListener(s);
441
441
  });
442
442
  }, [t]), n;
443
443
  }
444
- const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ b(
444
+ const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ _(
445
445
  "svg",
446
446
  {
447
447
  className: n,
@@ -505,7 +505,7 @@ const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ b(
505
505
  }
506
506
  )
507
507
  }
508
- ), bt = ({ className: t }) => /* @__PURE__ */ e(
508
+ ), wt = ({ className: t }) => /* @__PURE__ */ e(
509
509
  "svg",
510
510
  {
511
511
  className: t,
@@ -516,12 +516,12 @@ const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ b(
516
516
  "aria-hidden": "true",
517
517
  children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
518
518
  }
519
- ), wt = {
519
+ ), kt = {
520
520
  left: 180,
521
521
  right: 0,
522
522
  up: -90,
523
523
  down: 90
524
- }, kt = ({ direction: t = "right", className: n }) => /* @__PURE__ */ e(
524
+ }, xt = ({ direction: t = "right", className: n }) => /* @__PURE__ */ e(
525
525
  "svg",
526
526
  {
527
527
  className: n,
@@ -529,19 +529,19 @@ const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ b(
529
529
  viewBox: "0 0 24 24",
530
530
  stroke: "currentColor",
531
531
  strokeWidth: 2,
532
- style: { transform: `rotate(${wt[t]}deg)` },
532
+ style: { transform: `rotate(${kt[t]}deg)` },
533
533
  "aria-hidden": "true",
534
534
  children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" })
535
535
  }
536
536
  );
537
- function xt(t) {
537
+ function Ct(t) {
538
538
  return t === "top-left" || t === "bottom-left" ? "left" : "right";
539
539
  }
540
- const We = "ll-hidden-tab-center-y", Ct = 5, Ue = 16;
541
- function Nt() {
540
+ const Fe = "ll-hidden-tab-center-y", Nt = 5, Ue = 16;
541
+ function Et() {
542
542
  if (typeof window > "u") return null;
543
543
  try {
544
- const t = window.localStorage.getItem(We);
544
+ const t = window.localStorage.getItem(Fe);
545
545
  if (!t) return null;
546
546
  const n = Number.parseFloat(t);
547
547
  return Number.isFinite(n) ? n : null;
@@ -552,18 +552,18 @@ function Nt() {
552
552
  function $e(t) {
553
553
  if (!(typeof window > "u"))
554
554
  try {
555
- window.localStorage.setItem(We, String(t));
555
+ window.localStorage.setItem(Fe, String(t));
556
556
  } catch {
557
557
  }
558
558
  }
559
- const Et = ({
559
+ const St = ({
560
560
  position: t,
561
561
  isMobile: n,
562
562
  isSpeaking: i,
563
- onExpand: o,
563
+ onExpand: l,
564
564
  label: r = "Open widget"
565
565
  }) => {
566
- const s = xt(t), c = s === "right" ? "left" : "right", m = n ? 80 : 72, [d, f] = k(null), [h, l] = k(!1), a = L(null), C = L(!1), _ = g(
566
+ const s = Ct(t), c = s === "right" ? "left" : "right", m = n ? 80 : 72, [d, f] = k(null), [p, o] = k(!1), a = M(null), C = M(!1), b = g(
567
567
  (w) => {
568
568
  if (typeof window > "u") return w;
569
569
  const x = m / 2, y = Ue + x, A = window.innerHeight - Ue - x;
@@ -572,13 +572,13 @@ const Et = ({
572
572
  [m]
573
573
  );
574
574
  S(() => {
575
- const w = Nt();
576
- f(_(w ?? window.innerHeight / 2));
575
+ const w = Et();
576
+ f(b(w ?? window.innerHeight / 2));
577
577
  const x = () => {
578
- f((y) => y === null ? null : _(y));
578
+ f((y) => y === null ? null : b(y));
579
579
  };
580
580
  return window.addEventListener("resize", x), () => window.removeEventListener("resize", x);
581
- }, [_]);
581
+ }, [b]);
582
582
  const N = g(
583
583
  (w) => {
584
584
  if (!(w.pointerType === "mouse" && w.button !== 0) && d !== null) {
@@ -599,9 +599,9 @@ const Et = ({
599
599
  const x = a.current;
600
600
  if (!x) return;
601
601
  const y = w.clientY - x.startClientY;
602
- !x.moved && Math.abs(y) > Ct && (x.moved = !0, l(!0)), x.moved && f(_(x.startCenterY + y));
602
+ !x.moved && Math.abs(y) > Nt && (x.moved = !0, o(!0)), x.moved && f(b(x.startCenterY + y));
603
603
  },
604
- [_]
604
+ [b]
605
605
  ), E = g(
606
606
  (w) => {
607
607
  const x = a.current;
@@ -610,7 +610,7 @@ const Et = ({
610
610
  w.currentTarget.releasePointerCapture(w.pointerId);
611
611
  } catch {
612
612
  }
613
- a.current = null, x.moved && (l(!1), C.current = !0, f((y) => (y !== null && $e(y), y)));
613
+ a.current = null, x.moved && (o(!1), C.current = !0, f((y) => (y !== null && $e(y), y)));
614
614
  }
615
615
  },
616
616
  []
@@ -619,26 +619,26 @@ const Et = ({
619
619
  C.current = !1;
620
620
  return;
621
621
  }
622
- o();
623
- }, [o]), T = g(
622
+ l();
623
+ }, [l]), T = g(
624
624
  (w) => {
625
625
  if (w.key === "ArrowUp" || w.key === "ArrowDown") {
626
626
  w.preventDefault();
627
627
  const x = w.key === "ArrowUp" ? -8 : 8;
628
628
  f((y) => {
629
629
  if (y === null) return y;
630
- const A = _(y + x);
630
+ const A = b(y + x);
631
631
  return $e(A), A;
632
632
  });
633
633
  }
634
634
  },
635
- [_]
635
+ [b]
636
636
  ), z = [
637
637
  "ll-hidden",
638
638
  `ll-hidden--${s}`,
639
639
  n ? "ll-hidden--mobile" : "ll-hidden--desktop",
640
640
  i ? "ll-hidden--speaking" : null,
641
- h ? "is-dragging" : null
641
+ p ? "is-dragging" : null
642
642
  ].filter(Boolean).join(" "), I = d === null ? void 0 : { top: `${d - m / 2}px`, transform: "none" };
643
643
  return /* @__PURE__ */ e(
644
644
  "button",
@@ -654,46 +654,46 @@ const Et = ({
654
654
  "aria-label": r,
655
655
  "data-position": t,
656
656
  style: I,
657
- children: /* @__PURE__ */ e(kt, { direction: c, className: "ll-hidden__chevron" })
657
+ children: /* @__PURE__ */ e(xt, { direction: c, className: "ll-hidden__chevron" })
658
658
  }
659
659
  );
660
- }, St = ({
660
+ }, Mt = ({
661
661
  audioLevel: t,
662
662
  bars: n = 20,
663
663
  maxHeight: i = 20,
664
- minHeight: o = 4,
664
+ minHeight: l = 4,
665
665
  className: r,
666
666
  barClassName: s
667
667
  }) => {
668
- const c = L(null), m = L([]), d = Se(() => {
669
- const h = (Math.sqrt(5) - 1) / 2;
670
- return Array.from({ length: n }, (l, a) => 0.5 + a * h % 1 * 0.5);
668
+ const c = M(null), m = M([]), d = Se(() => {
669
+ const p = (Math.sqrt(5) - 1) / 2;
670
+ return Array.from({ length: n }, (o, a) => 0.5 + a * p % 1 * 0.5);
671
671
  }, [n]);
672
- S(() => t.subscribe((l) => {
672
+ S(() => t.subscribe((o) => {
673
673
  for (let a = 0; a < n; a++) {
674
674
  const C = m.current[a];
675
675
  if (!C) continue;
676
- const _ = Math.max(o, l * i * d[a]);
677
- C.style.height = `${_}px`;
676
+ const b = Math.max(l, o * i * d[a]);
677
+ C.style.height = `${b}px`;
678
678
  }
679
- }), [t, n, i, o, d]);
679
+ }), [t, n, i, l, d]);
680
680
  const f = ["ll-waveform", r].filter(Boolean).join(" ");
681
- return /* @__PURE__ */ e("div", { ref: c, className: f, "aria-hidden": "true", children: Array.from({ length: n }, (h, l) => /* @__PURE__ */ e(
681
+ return /* @__PURE__ */ e("div", { ref: c, className: f, "aria-hidden": "true", children: Array.from({ length: n }, (p, o) => /* @__PURE__ */ e(
682
682
  "div",
683
683
  {
684
684
  ref: (a) => {
685
- m.current[l] = a;
685
+ m.current[o] = a;
686
686
  },
687
687
  className: ["ll-waveform__bar", s].filter(Boolean).join(" "),
688
- style: { height: `${o}px` }
688
+ style: { height: `${l}px` }
689
689
  },
690
- l
690
+ o
691
691
  )) });
692
692
  }, Lt = ({
693
693
  position: t,
694
694
  isMobile: n,
695
695
  agentName: i,
696
- avatarImageUrl: o,
696
+ avatarImageUrl: l,
697
697
  agentState: r,
698
698
  isMuted: s,
699
699
  audioLevel: c,
@@ -706,7 +706,7 @@ const Et = ({
706
706
  className: "ll-minimized ll-minimized--mobile",
707
707
  role: "region",
708
708
  "aria-label": `${i} widget`,
709
- children: /* @__PURE__ */ b(
709
+ children: /* @__PURE__ */ _(
710
710
  "button",
711
711
  {
712
712
  type: "button",
@@ -714,19 +714,19 @@ const Et = ({
714
714
  onClick: m,
715
715
  "aria-label": `Expand ${i} widget`,
716
716
  children: [
717
- o ? (
717
+ l ? (
718
718
  // eslint-disable-next-line @next/next/no-img-element
719
719
  /* @__PURE__ */ e(
720
720
  "img",
721
721
  {
722
- src: o,
722
+ src: l,
723
723
  alt: i,
724
724
  className: "ll-minimized__avatar"
725
725
  }
726
726
  )
727
727
  ) : /* @__PURE__ */ e("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
728
728
  /* @__PURE__ */ e(
729
- St,
729
+ Mt,
730
730
  {
731
731
  audioLevel: c,
732
732
  bars: 16,
@@ -735,18 +735,18 @@ const Et = ({
735
735
  }
736
736
  ),
737
737
  /* @__PURE__ */ e("span", { className: "ll-minimized__name", children: i }),
738
- /* @__PURE__ */ b("div", { className: "ll-minimized__controls", children: [
738
+ /* @__PURE__ */ _("div", { className: "ll-minimized__controls", children: [
739
739
  /* @__PURE__ */ e(
740
740
  "span",
741
741
  {
742
742
  className: "ll-minimized__btn",
743
743
  role: "button",
744
744
  tabIndex: 0,
745
- onClick: (h) => {
746
- h.stopPropagation(), d();
745
+ onClick: (p) => {
746
+ p.stopPropagation(), d();
747
747
  },
748
- onKeyDown: (h) => {
749
- (h.key === "Enter" || h.key === " ") && (h.stopPropagation(), h.preventDefault(), d());
748
+ onKeyDown: (p) => {
749
+ (p.key === "Enter" || p.key === " ") && (p.stopPropagation(), p.preventDefault(), d());
750
750
  },
751
751
  "aria-label": s ? "Unmute microphone" : "Mute microphone",
752
752
  children: /* @__PURE__ */ e(Pe, { muted: s, className: "ll-minimized__icon" })
@@ -765,23 +765,23 @@ const Et = ({
765
765
  "data-position": t,
766
766
  role: "region",
767
767
  "aria-label": `${i} widget`,
768
- children: /* @__PURE__ */ b("div", { className: "ll-minimized__surface", children: [
769
- o ? (
768
+ children: /* @__PURE__ */ _("div", { className: "ll-minimized__surface", children: [
769
+ l ? (
770
770
  // eslint-disable-next-line @next/next/no-img-element
771
771
  /* @__PURE__ */ e(
772
772
  "img",
773
773
  {
774
- src: o,
774
+ src: l,
775
775
  alt: i,
776
776
  className: "ll-minimized__avatar"
777
777
  }
778
778
  )
779
779
  ) : /* @__PURE__ */ e("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
780
- /* @__PURE__ */ b("div", { className: "ll-minimized__meta", children: [
780
+ /* @__PURE__ */ _("div", { className: "ll-minimized__meta", children: [
781
781
  /* @__PURE__ */ e("span", { className: "ll-minimized__name", children: i }),
782
782
  /* @__PURE__ */ e("span", { className: "ll-minimized__state", children: r === "speaking" ? "Speaking" : r === "thinking" ? "Thinking" : "Listening" })
783
783
  ] }),
784
- /* @__PURE__ */ b("div", { className: "ll-minimized__controls", children: [
784
+ /* @__PURE__ */ _("div", { className: "ll-minimized__controls", children: [
785
785
  /* @__PURE__ */ e(
786
786
  "button",
787
787
  {
@@ -809,20 +809,20 @@ const Et = ({
809
809
  className: "ll-minimized__btn ll-minimized__btn--close",
810
810
  onClick: f,
811
811
  "aria-label": "Close widget",
812
- children: /* @__PURE__ */ e(bt, { className: "ll-minimized__icon" })
812
+ children: /* @__PURE__ */ e(wt, { className: "ll-minimized__icon" })
813
813
  }
814
814
  )
815
815
  ] })
816
816
  ] })
817
817
  }
818
- ), Mt = ({
818
+ ), It = ({
819
819
  src: t,
820
820
  alt: n,
821
821
  preCannedPlaying: i = !1,
822
- className: o,
822
+ className: l,
823
823
  style: r
824
824
  }) => {
825
- const [s, c] = k(!1), m = L(t);
825
+ const [s, c] = k(!1), m = M(t);
826
826
  if (S(() => {
827
827
  m.current !== t && (m.current = t, c(!1));
828
828
  }, [t]), !t) return null;
@@ -845,7 +845,7 @@ const Et = ({
845
845
  {
846
846
  src: t,
847
847
  alt: n,
848
- className: o,
848
+ className: l,
849
849
  style: d,
850
850
  loading: "eager",
851
851
  fetchpriority: "high",
@@ -853,22 +853,22 @@ const Et = ({
853
853
  }
854
854
  )
855
855
  );
856
- }, It = ({
856
+ }, At = ({
857
857
  position: t,
858
858
  isMobile: n,
859
859
  agentName: i,
860
- avatarImageUrl: o,
860
+ avatarImageUrl: l,
861
861
  idleLoopUrl: r,
862
862
  greeting: s,
863
863
  branding: c,
864
864
  teamMembers: m,
865
865
  currentTeamMemberId: d,
866
866
  isSwitchingTeamMember: f,
867
- teamSwitcherOpen: h,
868
- onToggleTeamSwitcher: l,
867
+ teamSwitcherOpen: p,
868
+ onToggleTeamSwitcher: o,
869
869
  onSelectTeamMember: a,
870
870
  languageMenuOpen: C,
871
- onToggleLanguageMenu: _,
871
+ onToggleLanguageMenu: b,
872
872
  connectionState: N,
873
873
  agentState: D,
874
874
  transcript: E,
@@ -890,7 +890,7 @@ const Et = ({
890
890
  allowTyping: be,
891
891
  avatarVideoContainerRef: we,
892
892
  onConnect: ge,
893
- onDisconnect: de,
893
+ onDisconnect: ue,
894
894
  onRetry: ke,
895
895
  onResumeAudio: xe,
896
896
  onToggleMute: Q,
@@ -899,59 +899,59 @@ const Et = ({
899
899
  onToggleScreenShare: Z,
900
900
  onToggleSpeaker: G,
901
901
  onSendMessage: ee,
902
- onMinimize: ue,
902
+ onMinimize: ie,
903
903
  onClose: V,
904
904
  onClearMicError: K
905
905
  }) => {
906
906
  var ye;
907
- const O = E.length > 0 ? E[E.length - 1] : null, Y = ((m == null ? void 0 : m.length) ?? 0) > 1, ie = N === "connecting" || N === "connected", H = N === "connected", he = N === "idle" || N === "disconnected" || N === "error", pe = L(null), oe = L(null);
907
+ const O = E.length > 0 ? E[E.length - 1] : null, Y = ((m == null ? void 0 : m.length) ?? 0) > 1, le = N === "connecting" || N === "connected", H = N === "connected", he = N === "idle" || N === "disconnected" || N === "error", pe = M(null), oe = M(null);
908
908
  S(() => {
909
- const u = pe.current;
910
- u && (u.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "cover", A.style.transform = "scaleX(-1)", u.appendChild(A)));
909
+ const h = pe.current;
910
+ h && (h.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "cover", A.style.transform = "scaleX(-1)", h.appendChild(A)));
911
911
  }, [A]), S(() => {
912
- const u = oe.current;
913
- u && (u.innerHTML = "", j && (j.style.width = "100%", j.style.height = "100%", j.style.objectFit = "contain", u.appendChild(j)));
912
+ const h = oe.current;
913
+ h && (h.innerHTML = "", j && (j.style.width = "100%", j.style.height = "100%", j.style.objectFit = "contain", h.appendChild(j)));
914
914
  }, [j]);
915
- const [q, le] = k(!1), [ae, J] = k(!1);
915
+ const [q, ae] = k(!1), [se, J] = k(!1);
916
916
  S(() => {
917
- if (!q && !ae && !C && !h) return;
918
- const u = () => {
919
- le(!1), J(!1), C && _(), h && l();
917
+ if (!q && !se && !C && !p) return;
918
+ const h = () => {
919
+ ae(!1), J(!1), C && b(), p && o();
920
920
  };
921
- return document.addEventListener("click", u), () => document.removeEventListener("click", u);
921
+ return document.addEventListener("click", h), () => document.removeEventListener("click", h);
922
922
  }, [
923
923
  q,
924
- ae,
924
+ se,
925
925
  C,
926
- h,
927
- _,
928
- l
926
+ p,
927
+ b,
928
+ o
929
929
  ]);
930
- const [se, ce] = k(""), B = g(
931
- (u) => {
932
- u.preventDefault();
933
- const W = se.trim();
934
- W && (ee(W), ce(""));
930
+ const [ce, de] = k(""), B = g(
931
+ (h) => {
932
+ h.preventDefault();
933
+ const W = ce.trim();
934
+ W && (ee(W), de(""));
935
935
  },
936
- [se, ee]
937
- ), p = c.productName || "Live Layer", me = H && (O != null && O.text) ? O.text : s || "", Ce = [
936
+ [ce, ee]
937
+ ), u = c.productName || "Live Layer", me = H && (O != null && O.text) ? O.text : s || "", Ce = [
938
938
  "ll-expanded",
939
939
  n ? "ll-expanded--mobile" : "ll-expanded--desktop"
940
940
  ].join(" ");
941
- return /* @__PURE__ */ b(
941
+ return /* @__PURE__ */ _(
942
942
  "div",
943
943
  {
944
944
  className: Ce,
945
945
  "data-position": t,
946
- "data-state": H ? "connected" : ie ? "connecting" : "idle",
946
+ "data-state": H ? "connected" : le ? "connecting" : "idle",
947
947
  role: "dialog",
948
948
  "aria-label": `${i} widget`,
949
949
  children: [
950
- /* @__PURE__ */ b("div", { className: "ll-expanded__bg", children: [
951
- o ? /* @__PURE__ */ e(
952
- Mt,
950
+ /* @__PURE__ */ _("div", { className: "ll-expanded__bg", children: [
951
+ l ? /* @__PURE__ */ e(
952
+ It,
953
953
  {
954
- src: o,
954
+ src: l,
955
955
  alt: i,
956
956
  className: "ll-expanded__bg-img"
957
957
  }
@@ -969,11 +969,11 @@ const Et = ({
969
969
  )
970
970
  ] }),
971
971
  /* @__PURE__ */ e("div", { ref: we, className: "ll-expanded__video" }),
972
- N === "connecting" && /* @__PURE__ */ b("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
972
+ N === "connecting" && /* @__PURE__ */ _("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
973
973
  /* @__PURE__ */ e("div", { className: "ll-expanded__spinner" }),
974
974
  /* @__PURE__ */ e("p", { className: "ll-expanded__overlay-text", children: f ? "Switching..." : "Connecting..." })
975
975
  ] }),
976
- T && H && /* @__PURE__ */ b(
976
+ T && H && /* @__PURE__ */ _(
977
977
  "button",
978
978
  {
979
979
  type: "button",
@@ -985,65 +985,65 @@ const Et = ({
985
985
  ]
986
986
  }
987
987
  ),
988
- ie ? /* @__PURE__ */ b("div", { className: "ll-expanded__topbar", children: [
989
- /* @__PURE__ */ b("div", { className: "ll-expanded__topbar-left", children: [
990
- /* @__PURE__ */ b("div", { className: "ll-expanded__pill-wrap", children: [
991
- /* @__PURE__ */ b(
988
+ le ? /* @__PURE__ */ _("div", { className: "ll-expanded__topbar", children: [
989
+ /* @__PURE__ */ _("div", { className: "ll-expanded__topbar-left", children: [
990
+ /* @__PURE__ */ _("div", { className: "ll-expanded__pill-wrap", children: [
991
+ /* @__PURE__ */ _(
992
992
  "button",
993
993
  {
994
994
  type: "button",
995
995
  className: "ll-hpill",
996
- onClick: (u) => {
997
- Y && (u.stopPropagation(), l());
996
+ onClick: (h) => {
997
+ Y && (h.stopPropagation(), o());
998
998
  },
999
999
  "aria-haspopup": Y ? "listbox" : void 0,
1000
- "aria-expanded": Y ? h : void 0,
1000
+ "aria-expanded": Y ? p : void 0,
1001
1001
  children: [
1002
1002
  /* @__PURE__ */ e("span", { className: "ll-hpill__label", children: i }),
1003
1003
  Y && /* @__PURE__ */ e(_e, {})
1004
1004
  ]
1005
1005
  }
1006
1006
  ),
1007
- Y && h && /* @__PURE__ */ e(
1007
+ Y && p && /* @__PURE__ */ e(
1008
1008
  "div",
1009
1009
  {
1010
1010
  className: "ll-hmenu",
1011
- onClick: (u) => u.stopPropagation(),
1011
+ onClick: (h) => h.stopPropagation(),
1012
1012
  role: "listbox",
1013
- children: m == null ? void 0 : m.map((u) => /* @__PURE__ */ b(
1013
+ children: m == null ? void 0 : m.map((h) => /* @__PURE__ */ _(
1014
1014
  "button",
1015
1015
  {
1016
1016
  type: "button",
1017
- className: `ll-hmenu__item ${u.id === d ? "is-active" : ""}`,
1018
- onClick: () => a(u.id),
1017
+ className: `ll-hmenu__item ${h.id === d ? "is-active" : ""}`,
1018
+ onClick: () => a(h.id),
1019
1019
  role: "option",
1020
- "aria-selected": u.id === d,
1020
+ "aria-selected": h.id === d,
1021
1021
  children: [
1022
- u.avatarImageUrl && /* @__PURE__ */ e(
1022
+ h.avatarImageUrl && /* @__PURE__ */ e(
1023
1023
  "img",
1024
1024
  {
1025
- src: u.avatarImageUrl,
1025
+ src: h.avatarImageUrl,
1026
1026
  alt: "",
1027
1027
  className: "ll-hmenu__avatar"
1028
1028
  }
1029
1029
  ),
1030
- /* @__PURE__ */ e("span", { className: "ll-hmenu__name", children: u.name }),
1031
- u.role && /* @__PURE__ */ e("span", { className: "ll-hmenu__role", children: u.role })
1030
+ /* @__PURE__ */ e("span", { className: "ll-hmenu__name", children: h.name }),
1031
+ h.role && /* @__PURE__ */ e("span", { className: "ll-hmenu__role", children: h.role })
1032
1032
  ]
1033
1033
  },
1034
- u.id
1034
+ h.id
1035
1035
  ))
1036
1036
  }
1037
1037
  )
1038
1038
  ] }),
1039
- /* @__PURE__ */ b("div", { className: "ll-expanded__pill-wrap", children: [
1040
- /* @__PURE__ */ b(
1039
+ /* @__PURE__ */ _("div", { className: "ll-expanded__pill-wrap", children: [
1040
+ /* @__PURE__ */ _(
1041
1041
  "button",
1042
1042
  {
1043
1043
  type: "button",
1044
1044
  className: "ll-hpill",
1045
- onClick: (u) => {
1046
- u.stopPropagation(), _();
1045
+ onClick: (h) => {
1046
+ h.stopPropagation(), b();
1047
1047
  },
1048
1048
  "aria-haspopup": "listbox",
1049
1049
  "aria-expanded": C,
@@ -1057,7 +1057,7 @@ const Et = ({
1057
1057
  "div",
1058
1058
  {
1059
1059
  className: "ll-hmenu",
1060
- onClick: (u) => u.stopPropagation(),
1060
+ onClick: (h) => h.stopPropagation(),
1061
1061
  role: "listbox",
1062
1062
  children: /* @__PURE__ */ e(
1063
1063
  "button",
@@ -1080,37 +1080,50 @@ const Et = ({
1080
1080
  }
1081
1081
  )
1082
1082
  ] }),
1083
- /* @__PURE__ */ e(
1084
- "button",
1085
- {
1086
- type: "button",
1087
- className: "ll-hbtn",
1088
- onClick: V,
1089
- "aria-label": "Close widget",
1090
- title: "Close",
1091
- children: /* @__PURE__ */ e(je, {})
1092
- }
1093
- )
1083
+ /* @__PURE__ */ _("div", { className: "ll-expanded__header-actions", children: [
1084
+ /* @__PURE__ */ e(
1085
+ "button",
1086
+ {
1087
+ type: "button",
1088
+ className: "ll-hbtn",
1089
+ onClick: ie,
1090
+ "aria-label": "Minimize widget",
1091
+ title: "Minimize",
1092
+ children: /* @__PURE__ */ e(Ve, {})
1093
+ }
1094
+ ),
1095
+ /* @__PURE__ */ e(
1096
+ "button",
1097
+ {
1098
+ type: "button",
1099
+ className: "ll-hbtn ll-hbtn--danger",
1100
+ onClick: V,
1101
+ "aria-label": "End conversation",
1102
+ title: "End conversation",
1103
+ children: /* @__PURE__ */ e(je, {})
1104
+ }
1105
+ )
1106
+ ] })
1094
1107
  ] }) : (
1095
1108
  // Idle-state header with Live Layer product name + minimize/close
1096
- /* @__PURE__ */ b("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
1097
- /* @__PURE__ */ e("span", { className: "ll-expanded__brand", children: p }),
1098
- /* @__PURE__ */ b("div", { className: "ll-expanded__header-actions", children: [
1109
+ /* @__PURE__ */ _("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
1110
+ /* @__PURE__ */ e("span", { className: "ll-expanded__brand", children: u }),
1111
+ /* @__PURE__ */ _("div", { className: "ll-expanded__header-actions", children: [
1099
1112
  /* @__PURE__ */ e(
1100
1113
  "button",
1101
1114
  {
1102
1115
  type: "button",
1103
1116
  className: "ll-hbtn ll-hbtn--ghost",
1104
- onClick: ue,
1117
+ onClick: ie,
1105
1118
  "aria-label": "Minimize widget",
1106
- children: /* @__PURE__ */ e(At, {})
1119
+ children: /* @__PURE__ */ e(Ve, {})
1107
1120
  }
1108
1121
  ),
1109
1122
  /* @__PURE__ */ e(
1110
1123
  "button",
1111
1124
  {
1112
1125
  type: "button",
1113
- className: "ll-hbtn ll-hbtn--ghost",
1126
+ className: "ll-hbtn ll-hbtn--danger",
1114
1127
  onClick: V,
1115
1128
  "aria-label": "Close widget",
1116
1129
  children: /* @__PURE__ */ e(je, {})
@@ -1119,7 +1132,7 @@ const Et = ({
1119
1132
  ] })
1120
1133
  ] })
1121
1134
  ),
1122
- he && /* @__PURE__ */ b(
1135
+ he && /* @__PURE__ */ _(
1123
1136
  "button",
1124
1137
  {
1125
1138
  type: "button",
@@ -1133,10 +1146,10 @@ const Et = ({
1133
1146
  ]
1134
1147
  }
1135
1148
  ),
1136
- /* @__PURE__ */ b(
1149
+ /* @__PURE__ */ _(
1137
1150
  "div",
1138
1151
  {
1139
- className: `ll-expanded__pip ${ie && (y || $) ? "is-visible" : ""}`,
1152
+ className: `ll-expanded__pip ${le && (y || $) ? "is-visible" : ""}`,
1140
1153
  children: [
1141
1154
  /* @__PURE__ */ e(
1142
1155
  "div",
@@ -1155,9 +1168,9 @@ const Et = ({
1155
1168
  ]
1156
1169
  }
1157
1170
  ),
1158
- ie ? /* @__PURE__ */ b("div", { className: "ll-expanded__bottom", children: [
1171
+ le ? /* @__PURE__ */ _("div", { className: "ll-expanded__bottom", children: [
1159
1172
  me && /* @__PURE__ */ e("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ e("p", { className: "ll-expanded__transcript-text", children: me }) }),
1160
- /* @__PURE__ */ b("div", { className: "ll-toolbar", onClick: (u) => u.stopPropagation(), children: [
1173
+ /* @__PURE__ */ _("div", { className: "ll-toolbar", onClick: (h) => h.stopPropagation(), children: [
1161
1174
  P && /* @__PURE__ */ e(
1162
1175
  "button",
1163
1176
  {
@@ -1169,7 +1182,7 @@ const Et = ({
1169
1182
  children: /* @__PURE__ */ e(Dt, {})
1170
1183
  }
1171
1184
  ),
1172
- re && /* @__PURE__ */ b("div", { className: "ll-tool-split", children: [
1185
+ re && /* @__PURE__ */ _("div", { className: "ll-tool-split", children: [
1173
1186
  /* @__PURE__ */ e(
1174
1187
  "button",
1175
1188
  {
@@ -1186,28 +1199,28 @@ const Et = ({
1186
1199
  {
1187
1200
  type: "button",
1188
1201
  className: `ll-tool ll-tool--right ${y ? "is-on" : ""}`,
1189
- onClick: (u) => {
1190
- u.stopPropagation(), J((W) => !W), le(!1);
1202
+ onClick: (h) => {
1203
+ h.stopPropagation(), J((W) => !W), ae(!1);
1191
1204
  },
1192
1205
  "aria-label": "Camera devices",
1193
1206
  "aria-haspopup": "listbox",
1194
- "aria-expanded": ae,
1207
+ "aria-expanded": se,
1195
1208
  children: /* @__PURE__ */ e(_e, {})
1196
1209
  }
1197
1210
  ),
1198
- ae && X.length > 0 && /* @__PURE__ */ e(
1199
- Ve,
1211
+ se && X.length > 0 && /* @__PURE__ */ e(
1212
+ Oe,
1200
1213
  {
1201
1214
  label: "Camera",
1202
1215
  devices: X,
1203
1216
  activeId: ne,
1204
- onPick: (u) => {
1205
- J(!1), ve(u);
1217
+ onPick: (h) => {
1218
+ J(!1), ve(h);
1206
1219
  }
1207
1220
  }
1208
1221
  )
1209
1222
  ] }),
1210
- /* @__PURE__ */ b("div", { className: "ll-tool-split", children: [
1223
+ /* @__PURE__ */ _("div", { className: "ll-tool-split", children: [
1211
1224
  /* @__PURE__ */ e(
1212
1225
  "button",
1213
1226
  {
@@ -1224,8 +1237,8 @@ const Et = ({
1224
1237
  {
1225
1238
  type: "button",
1226
1239
  className: `ll-tool ll-tool--right ${I ? "is-muted" : ""}`,
1227
- onClick: (u) => {
1228
- u.stopPropagation(), le((W) => !W), J(!1);
1240
+ onClick: (h) => {
1241
+ h.stopPropagation(), ae((W) => !W), J(!1);
1229
1242
  },
1230
1243
  "aria-label": "Microphone devices",
1231
1244
  "aria-haspopup": "listbox",
@@ -1234,12 +1247,12 @@ const Et = ({
1234
1247
  }
1235
1248
  ),
1236
1249
  q && x.length > 0 && /* @__PURE__ */ e(
1237
- Ve,
1250
+ Oe,
1238
1251
  {
1239
1252
  label: "Microphone",
1240
1253
  devices: x,
1241
1254
  activeId: "",
1242
- onPick: () => le(!1)
1255
+ onPick: () => ae(!1)
1243
1256
  }
1244
1257
  )
1245
1258
  ] }),
@@ -1255,19 +1268,19 @@ const Et = ({
1255
1268
  }
1256
1269
  )
1257
1270
  ] }),
1258
- be && /* @__PURE__ */ b("form", { className: "ll-message-input", onSubmit: B, children: [
1271
+ be && /* @__PURE__ */ _("form", { className: "ll-message-input", onSubmit: B, children: [
1259
1272
  /* @__PURE__ */ e(
1260
1273
  "input",
1261
1274
  {
1262
1275
  type: "text",
1263
1276
  className: "ll-message-input__field",
1264
1277
  placeholder: "Message...",
1265
- value: se,
1266
- onChange: (u) => ce(u.target.value),
1278
+ value: ce,
1279
+ onChange: (h) => de(h.target.value),
1267
1280
  "aria-label": "Message the agent"
1268
1281
  }
1269
1282
  ),
1270
- se.trim() && /* @__PURE__ */ e(
1283
+ ce.trim() && /* @__PURE__ */ e(
1271
1284
  "button",
1272
1285
  {
1273
1286
  type: "submit",
@@ -1282,7 +1295,7 @@ const Et = ({
1282
1295
  {
1283
1296
  type: "button",
1284
1297
  className: "ll-expanded__end",
1285
- onClick: de,
1298
+ onClick: ue,
1286
1299
  children: "End conversation"
1287
1300
  }
1288
1301
  )
@@ -1292,7 +1305,7 @@ const Et = ({
1292
1305
  ),
1293
1306
  (() => {
1294
1307
  if (w && N !== "error")
1295
- return /* @__PURE__ */ b("div", { className: "ll-expanded__banner", role: "alert", children: [
1308
+ return /* @__PURE__ */ _("div", { className: "ll-expanded__banner", role: "alert", children: [
1296
1309
  /* @__PURE__ */ e("span", { children: w }),
1297
1310
  /* @__PURE__ */ e(
1298
1311
  "button",
@@ -1306,9 +1319,9 @@ const Et = ({
1306
1319
  )
1307
1320
  ] });
1308
1321
  if (!z || N !== "error") return null;
1309
- let u = "Failed to connect", W = "Try again";
1310
- return z === "MIC_PERMISSION_DENIED" ? u = "Microphone blocked. Allow access to talk." : z === "MIC_NOT_FOUND" ? u = "No microphone found. Plug one in + retry." : z === "MIC_UNAVAILABLE" ? u = "Mic unavailable. Check other apps using it." : z === "AGENT_TIMEOUT" ? u = "Agent didn't pick up. Try again." : z === "CONNECT_FAILED" ? u = "Connection failed. Check your network." : z.length < 80 && (u = z), /* @__PURE__ */ b("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1311
- /* @__PURE__ */ e("span", { children: u }),
1322
+ let h = "Failed to connect", W = "Try again";
1323
+ return z === "MIC_PERMISSION_DENIED" ? h = "Microphone blocked. Allow access to talk." : z === "MIC_NOT_FOUND" ? h = "No microphone found. Plug one in + retry." : z === "MIC_UNAVAILABLE" ? h = "Mic unavailable. Check other apps using it." : z === "AGENT_TIMEOUT" ? h = "Agent didn't pick up. Try again." : z === "CONNECT_FAILED" ? h = "Connection failed. Check your network." : z.length < 80 && (h = z), /* @__PURE__ */ _("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
1324
+ /* @__PURE__ */ e("span", { children: h }),
1312
1325
  /* @__PURE__ */ e(
1313
1326
  "button",
1314
1327
  {
@@ -1328,29 +1341,29 @@ function _e() {
1328
1341
  return /* @__PURE__ */ e("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ e("polyline", { points: "6 9 12 15 18 9" }) });
1329
1342
  }
1330
1343
  function je() {
1331
- return /* @__PURE__ */ b("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
1344
+ return /* @__PURE__ */ _("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
1332
1345
  /* @__PURE__ */ e("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1333
1346
  /* @__PURE__ */ e("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1334
1347
  ] });
1335
1348
  }
1336
- function At() {
1349
+ function Ve() {
1337
1350
  return /* @__PURE__ */ e("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ e("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
1338
1351
  }
1339
1352
  function Dt() {
1340
- return /* @__PURE__ */ b("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1353
+ return /* @__PURE__ */ _("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1341
1354
  /* @__PURE__ */ e("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
1342
1355
  /* @__PURE__ */ e("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
1343
1356
  /* @__PURE__ */ e("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
1344
1357
  ] });
1345
1358
  }
1346
1359
  function Rt() {
1347
- return /* @__PURE__ */ b("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1360
+ return /* @__PURE__ */ _("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1348
1361
  /* @__PURE__ */ e("path", { d: "M23 7l-7 5 7 5V7z" }),
1349
1362
  /* @__PURE__ */ e("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
1350
1363
  ] });
1351
1364
  }
1352
1365
  function Tt({ muted: t }) {
1353
- return /* @__PURE__ */ b("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1366
+ return /* @__PURE__ */ _("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1354
1367
  /* @__PURE__ */ e("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
1355
1368
  /* @__PURE__ */ e("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
1356
1369
  /* @__PURE__ */ e("line", { x1: "12", y1: "19", x2: "12", y2: "23" }),
@@ -1358,21 +1371,21 @@ function Tt({ muted: t }) {
1358
1371
  ] });
1359
1372
  }
1360
1373
  function zt({ muted: t }) {
1361
- return /* @__PURE__ */ b("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1374
+ return /* @__PURE__ */ _("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1362
1375
  /* @__PURE__ */ e("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
1363
- t ? /* @__PURE__ */ e("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ b(Qe, { children: [
1376
+ t ? /* @__PURE__ */ e("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ _(Ze, { children: [
1364
1377
  /* @__PURE__ */ e("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
1365
1378
  /* @__PURE__ */ e("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
1366
1379
  ] })
1367
1380
  ] });
1368
1381
  }
1369
1382
  function Pt() {
1370
- return /* @__PURE__ */ b("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1383
+ return /* @__PURE__ */ _("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
1371
1384
  /* @__PURE__ */ e("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
1372
1385
  /* @__PURE__ */ e("polyline", { points: "12 5 19 12 12 19" })
1373
1386
  ] });
1374
1387
  }
1375
- const Ve = ({ label: t, devices: n, activeId: i, onPick: o }) => /* @__PURE__ */ b(
1388
+ const Oe = ({ label: t, devices: n, activeId: i, onPick: l }) => /* @__PURE__ */ _(
1376
1389
  "div",
1377
1390
  {
1378
1391
  className: "ll-device-menu",
@@ -1382,12 +1395,12 @@ const Ve = ({ label: t, devices: n, activeId: i, onPick: o }) => /* @__PURE__ */
1382
1395
  /* @__PURE__ */ e("p", { className: "ll-device-menu__label", children: t }),
1383
1396
  n.map((r, s) => {
1384
1397
  const c = i === r.deviceId;
1385
- return /* @__PURE__ */ b(
1398
+ return /* @__PURE__ */ _(
1386
1399
  "button",
1387
1400
  {
1388
1401
  type: "button",
1389
1402
  className: `ll-device-menu__item ${c ? "is-active" : ""}`,
1390
- onClick: () => o(r.deviceId),
1403
+ onClick: () => l(r.deviceId),
1391
1404
  role: "option",
1392
1405
  "aria-selected": c,
1393
1406
  children: [
@@ -1415,18 +1428,18 @@ function Ut(t) {
1415
1428
  const {
1416
1429
  agentId: n,
1417
1430
  apiKey: i,
1418
- baseUrl: o = "https://app.livelayer.studio",
1431
+ baseUrl: l = "https://app.livelayer.studio",
1419
1432
  sessionEndpoint: r,
1420
1433
  sessionBody: s,
1421
1434
  autoConnect: c = !1,
1422
1435
  displayMode: m,
1423
1436
  defaultDisplayMode: d = "expanded",
1424
1437
  onDisplayModeChange: f,
1425
- position: h = "bottom-right",
1426
- mobileBreakpoint: l = 640,
1438
+ position: p = "bottom-right",
1439
+ mobileBreakpoint: o = 640,
1427
1440
  persistKey: a = "ll-widget",
1428
1441
  disablePersistence: C = !1,
1429
- teamMembers: _,
1442
+ teamMembers: b,
1430
1443
  currentTeamMemberId: N,
1431
1444
  onTeamMemberChange: D,
1432
1445
  idleLoopUrl: E,
@@ -1448,37 +1461,37 @@ function Ut(t) {
1448
1461
  className: be,
1449
1462
  style: we,
1450
1463
  zIndex: ge = 2147483647
1451
- } = t, de = N !== void 0, [ke, xe] = k(() => {
1464
+ } = t, ue = N !== void 0, [ke, xe] = k(() => {
1452
1465
  var v;
1453
- return N ?? ((v = _ == null ? void 0 : _[0]) == null ? void 0 : v.id);
1454
- }), Q = de ? N : ke, U = Se(
1455
- () => (_ == null ? void 0 : _.find((v) => v.id === Q)) ?? null,
1456
- [_, Q]
1457
- ), ve = (U == null ? void 0 : U.agentId) ?? n, [Z, G] = vt({
1466
+ return N ?? ((v = b == null ? void 0 : b[0]) == null ? void 0 : v.id);
1467
+ }), Q = ue ? N : ke, U = Se(
1468
+ () => (b == null ? void 0 : b.find((v) => v.id === Q)) ?? null,
1469
+ [b, Q]
1470
+ ), ve = (U == null ? void 0 : U.agentId) ?? n, [Z, G] = yt({
1458
1471
  value: m,
1459
1472
  defaultValue: d,
1460
1473
  onChange: f,
1461
1474
  persistKey: a,
1462
1475
  disablePersistence: C
1463
- }), ee = _t(l), ue = ot(), V = lt(), K = st(), O = ct(), Y = dt(), [ie, H] = k(!1), [he, pe] = k(!1), [oe, q] = k(!1), [le, ae] = k(!1), [J, se] = k(!1), ce = g(
1476
+ }), ee = bt(o), ie = ot(), V = at(), K = ct(), O = dt(), Y = ut(), [le, H] = k(!1), [he, pe] = k(!1), [oe, q] = k(!1), [ae, se] = k(!1), [J, ce] = k(!1), de = g(
1464
1477
  (v) => {
1465
- const M = v;
1466
- !M.type || typeof M.type != "string" || (F == null || F({ eventName: M.type, data: v }), Bt.has(M.type) || re == null || re(M));
1478
+ const L = v;
1479
+ !L.type || typeof L.type != "string" || (F == null || F({ eventName: L.type, data: v }), Bt.has(L.type) || re == null || re(L));
1467
1480
  },
1468
1481
  [re, F]
1469
- ), B = it({
1482
+ ), B = lt({
1470
1483
  agentId: P ? "__controlled__" : ve,
1471
- baseUrl: o,
1484
+ baseUrl: l,
1472
1485
  apiKey: i,
1473
1486
  sessionEndpoint: r,
1474
1487
  sessionBody: s,
1475
- onDataMessage: P ? void 0 : ce
1488
+ onDataMessage: P ? void 0 : de
1476
1489
  });
1477
1490
  S(() => {
1478
1491
  if (P != null && P.subscribeToDataMessages)
1479
- return P.subscribeToDataMessages(ce);
1480
- }, [P, ce]);
1481
- const p = Se(() => P ? {
1492
+ return P.subscribeToDataMessages(de);
1493
+ }, [P, de]);
1494
+ const u = Se(() => P ? {
1482
1495
  connectionState: P.connectionState,
1483
1496
  agentState: P.agentState,
1484
1497
  transcript: P.transcript,
@@ -1509,115 +1522,117 @@ function Ut(t) {
1509
1522
  disconnect: B.disconnect,
1510
1523
  getRoom: B.getRoom,
1511
1524
  isControlled: !1
1512
- }, [P, B]), me = L(null);
1525
+ }, [P, B]), me = M(null);
1513
1526
  S(() => {
1514
- const v = p.videoElement, M = me.current;
1515
- if (!(!v || !M))
1516
- return M.appendChild(v), () => {
1517
- v.parentNode === M && M.removeChild(v);
1527
+ const v = u.videoElement, L = me.current;
1528
+ if (!(!v || !L))
1529
+ return L.appendChild(v), () => {
1530
+ v.parentNode === L && L.removeChild(v);
1518
1531
  };
1519
- }, [p.videoElement]), S(() => {
1520
- const v = p.audioElement;
1532
+ }, [u.videoElement]), S(() => {
1533
+ const v = u.audioElement;
1521
1534
  if (!v) return;
1522
- ue.attach(v);
1523
- const M = v.play();
1524
- return M && typeof M.catch == "function" && M.catch((te) => {
1535
+ ie.attach(v);
1536
+ const L = v.play();
1537
+ return L && typeof L.catch == "function" && L.catch((te) => {
1525
1538
  (te == null ? void 0 : te.name) === "NotAllowedError" && H(!0);
1526
1539
  }), () => {
1527
- ue.detach();
1540
+ ie.detach();
1528
1541
  };
1529
- }, [p.audioElement]), S(() => {
1530
- if (p.isControlled || p.connectionState !== "connected") return;
1531
- const v = p.getRoom();
1542
+ }, [u.audioElement]), S(() => {
1543
+ if (u.isControlled || u.connectionState !== "connected") return;
1544
+ const v = u.getRoom();
1532
1545
  if (v)
1533
1546
  return V.setupMic(v).catch(() => {
1534
1547
  }), K.attachRoom(v), O.attachRoom(v), Y.refresh(), () => {
1535
1548
  V.teardownMic(), K.teardown(), O.teardown();
1536
1549
  };
1537
- }, [p.isControlled, p.connectionState]), S(() => {
1538
- const v = p.audioElement;
1550
+ }, [u.isControlled, u.connectionState]), S(() => {
1551
+ const v = u.audioElement;
1539
1552
  v && (v.muted = J);
1540
- }, [p.audioElement, J]);
1553
+ }, [u.audioElement, J]);
1541
1554
  const Ce = g((v) => {
1542
- const M = p.getRoom();
1543
- if (M)
1555
+ const L = u.getRoom();
1556
+ if (L)
1544
1557
  try {
1545
1558
  const te = new TextEncoder().encode(
1546
1559
  JSON.stringify({ type: "user_message", text: v })
1547
1560
  );
1548
- M.localParticipant.publishData(te, { reliable: !0 });
1561
+ L.localParticipant.publishData(te, { reliable: !0 });
1549
1562
  } catch {
1550
1563
  }
1551
- }, [p]), ye = g(() => {
1552
- se((v) => !v);
1564
+ }, [u]), ye = g(() => {
1565
+ ce((v) => !v);
1553
1566
  }, []);
1554
1567
  S(() => {
1555
- j == null || j(p.connectionState), p.connectionState === "connected" ? A == null || A() : p.connectionState === "disconnected" && (X == null || X());
1556
- }, [p.connectionState, A, X, j]), S(() => {
1557
- ne == null || ne(p.transcript);
1558
- }, [p.transcript, ne]), S(() => {
1559
- $ == null || $(p.agentState);
1560
- }, [p.agentState, $]);
1561
- const u = L(!1);
1568
+ j == null || j(u.connectionState), u.connectionState === "connected" ? A == null || A() : u.connectionState === "disconnected" && (X == null || X());
1569
+ }, [u.connectionState, A, X, j]), S(() => {
1570
+ ne == null || ne(u.transcript);
1571
+ }, [u.transcript, ne]), S(() => {
1572
+ $ == null || $(u.agentState);
1573
+ }, [u.agentState, $]);
1574
+ const h = M(!1);
1562
1575
  S(() => {
1563
- p.isControlled || !c || u.current || p.connectionState === "idle" && (u.current = !0, p.connect());
1564
- }, [c, p.connectionState, p]);
1576
+ u.isControlled || !c || h.current || u.connectionState === "idle" && (h.current = !0, u.connect());
1577
+ }, [c, u.connectionState, u]);
1565
1578
  const W = g(
1566
1579
  (v) => {
1567
- const M = _ == null ? void 0 : _.find((te) => te.id === v);
1568
- M && (q(!1), v !== Q && (pe(!0), p.disconnect(), de || xe(v), D == null || D(M)));
1580
+ const L = b == null ? void 0 : b.find((te) => te.id === v);
1581
+ L && (q(!1), v !== Q && (pe(!0), u.disconnect(), ue || xe(v), D == null || D(L)));
1569
1582
  },
1570
1583
  [
1571
- _,
1584
+ b,
1572
1585
  Q,
1573
- p,
1574
- de,
1586
+ u,
1587
+ ue,
1575
1588
  D
1576
1589
  ]
1577
1590
  );
1578
1591
  S(() => {
1579
- he && p.connectionState === "connected" && pe(!1);
1580
- }, [p.connectionState, he]), S(() => {
1592
+ he && u.connectionState === "connected" && pe(!1);
1593
+ }, [u.connectionState, he]), S(() => {
1581
1594
  if (!oe) return;
1582
- const v = (M) => {
1583
- M.key === "Escape" && q(!1);
1595
+ const v = (L) => {
1596
+ L.key === "Escape" && q(!1);
1584
1597
  };
1585
1598
  return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
1586
1599
  }, [oe]);
1587
- const Fe = !!T || !!(U != null && U.avatarImageUrl) || p.isControlled, Ne = ut(ve, o, Fe), Ee = (U == null ? void 0 : U.name) ?? z ?? ((Ie = p.agentConfig) == null ? void 0 : Ie.name) ?? ((Ae = Ne.info) == null ? void 0 : Ae.name) ?? "Live Layer", Le = (U == null ? void 0 : U.avatarImageUrl) ?? T ?? ((De = p.agentConfig) == null ? void 0 : De.avatarImageUrl) ?? ((Re = Ne.info) == null ? void 0 : Re.avatarImageUrl) ?? null, Ge = E ?? ((Te = p.agentConfig) == null ? void 0 : Te.idleLoopUrl) ?? ((ze = Ne.info) == null ? void 0 : ze.idleLoopUrl) ?? null, Ke = R ?? null, Ye = g(() => G("expanded"), [G]), He = g(
1600
+ const Ge = !!T || !!(U != null && U.avatarImageUrl) || u.isControlled, Ne = ht(ve, l, Ge), Ee = (U == null ? void 0 : U.name) ?? z ?? ((Ie = u.agentConfig) == null ? void 0 : Ie.name) ?? ((Ae = Ne.info) == null ? void 0 : Ae.name) ?? "Live Layer", Me = (U == null ? void 0 : U.avatarImageUrl) ?? T ?? ((De = u.agentConfig) == null ? void 0 : De.avatarImageUrl) ?? ((Re = Ne.info) == null ? void 0 : Re.avatarImageUrl) ?? null, Ke = E ?? ((Te = u.agentConfig) == null ? void 0 : Te.idleLoopUrl) ?? ((ze = Ne.info) == null ? void 0 : ze.idleLoopUrl) ?? null, Ye = R ?? null, He = g(() => G("expanded"), [G]), qe = g(
1588
1601
  () => G("minimized"),
1589
1602
  [G]
1590
- ), Me = g(() => G("hidden"), [G]), qe = g(() => {
1591
- const v = p.audioElement;
1603
+ ), Le = g(() => {
1604
+ u.disconnect(), G("hidden");
1605
+ }, [u, G]), Je = g(() => {
1606
+ const v = u.audioElement;
1592
1607
  v && v.play().then(() => H(!1)).catch(() => {
1593
1608
  });
1594
- }, [p.audioElement]), Je = g(() => {
1595
- H(!1), p.connect();
1596
- }, [p]), fe = {
1609
+ }, [u.audioElement]), Xe = g(() => {
1610
+ H(!1), u.connect();
1611
+ }, [u]), fe = {
1597
1612
  ...we,
1598
1613
  zIndex: ge
1599
1614
  };
1600
1615
  I.primaryColor && (fe["--ll-color-primary"] = I.primaryColor), I.accentColor && (fe["--ll-color-accent"] = I.accentColor), I.backgroundColor && (fe["--ll-color-bg"] = I.backgroundColor), I.textColor && (fe["--ll-color-fg"] = I.textColor);
1601
- const Xe = [
1616
+ const Qe = [
1602
1617
  "ll-widget",
1603
1618
  `ll-widget--${Z}`,
1604
1619
  `ll-widget--${ee ? "mobile" : "desktop"}`,
1605
1620
  be
1606
1621
  ].filter(Boolean).join(" ");
1607
- return /* @__PURE__ */ b(
1622
+ return /* @__PURE__ */ _(
1608
1623
  "div",
1609
1624
  {
1610
- className: Xe,
1625
+ className: Qe,
1611
1626
  style: fe,
1612
1627
  "data-display-mode": Z,
1613
- "data-position": h,
1628
+ "data-position": p,
1614
1629
  children: [
1615
1630
  Z === "hidden" && /* @__PURE__ */ e(
1616
- Et,
1631
+ St,
1617
1632
  {
1618
- position: h,
1633
+ position: p,
1619
1634
  isMobile: ee,
1620
- isSpeaking: p.agentState === "speaking",
1635
+ isSpeaking: u.agentState === "speaking",
1621
1636
  onExpand: () => G("expanded"),
1622
1637
  label: `Open ${Ee} widget`
1623
1638
  }
@@ -1625,37 +1640,37 @@ function Ut(t) {
1625
1640
  Z === "minimized" && /* @__PURE__ */ e(
1626
1641
  Lt,
1627
1642
  {
1628
- position: h,
1643
+ position: p,
1629
1644
  isMobile: ee,
1630
1645
  agentName: Ee,
1631
- avatarImageUrl: Le,
1632
- agentState: p.agentState,
1646
+ avatarImageUrl: Me,
1647
+ agentState: u.agentState,
1633
1648
  isMuted: V.isMuted,
1634
- audioLevel: ue,
1635
- onExpand: Ye,
1649
+ audioLevel: ie,
1650
+ onExpand: He,
1636
1651
  onToggleMute: V.toggleMute,
1637
- onClose: Me
1652
+ onClose: Le
1638
1653
  }
1639
1654
  ),
1640
1655
  Z === "expanded" && /* @__PURE__ */ e(
1641
- It,
1656
+ At,
1642
1657
  {
1643
- position: h,
1658
+ position: p,
1644
1659
  isMobile: ee,
1645
1660
  agentName: Ee,
1646
- avatarImageUrl: Le,
1647
- idleLoopUrl: Ge,
1648
- greeting: Ke,
1661
+ avatarImageUrl: Me,
1662
+ idleLoopUrl: Ke,
1663
+ greeting: Ye,
1649
1664
  branding: I,
1650
- teamMembers: _,
1665
+ teamMembers: b,
1651
1666
  currentTeamMemberId: Q,
1652
1667
  isSwitchingTeamMember: he,
1653
1668
  teamSwitcherOpen: oe,
1654
1669
  onToggleTeamSwitcher: () => q((v) => !v),
1655
1670
  onSelectTeamMember: W,
1656
- connectionState: p.connectionState,
1657
- agentState: p.agentState,
1658
- transcript: p.transcript,
1671
+ connectionState: u.connectionState,
1672
+ agentState: u.agentState,
1673
+ transcript: u.transcript,
1659
1674
  isMuted: V.isMuted,
1660
1675
  micDevices: Y.mics,
1661
1676
  isCameraEnabled: K.isEnabled,
@@ -1668,25 +1683,25 @@ function Ut(t) {
1668
1683
  allowCamera: w,
1669
1684
  allowScreenShare: x,
1670
1685
  allowTyping: y,
1671
- languageMenuOpen: le,
1672
- onToggleLanguageMenu: () => ae((v) => !v),
1673
- needsUserGesture: ie,
1674
- canResume: p.canResume,
1686
+ languageMenuOpen: ae,
1687
+ onToggleLanguageMenu: () => se((v) => !v),
1688
+ needsUserGesture: le,
1689
+ canResume: u.canResume,
1675
1690
  micError: V.micError,
1676
- error: p.error,
1691
+ error: u.error,
1677
1692
  avatarVideoContainerRef: me,
1678
- onConnect: () => void p.connect(),
1679
- onDisconnect: () => p.disconnect(),
1680
- onRetry: Je,
1681
- onResumeAudio: qe,
1693
+ onConnect: () => void u.connect(),
1694
+ onDisconnect: () => u.disconnect(),
1695
+ onRetry: Xe,
1696
+ onResumeAudio: Je,
1682
1697
  onToggleMute: V.toggleMute,
1683
1698
  onToggleCamera: () => void K.toggle(),
1684
1699
  onSwitchCameraDevice: (v) => void K.switchDevice(v),
1685
1700
  onToggleScreenShare: () => void O.toggle(),
1686
1701
  onToggleSpeaker: ye,
1687
1702
  onSendMessage: Ce,
1688
- onMinimize: He,
1689
- onClose: Me,
1703
+ onMinimize: qe,
1704
+ onClose: Le,
1690
1705
  onClearMicError: V.clearError
1691
1706
  }
1692
1707
  )
@@ -1695,34 +1710,34 @@ function Ut(t) {
1695
1710
  );
1696
1711
  }
1697
1712
  function Ft(t) {
1698
- return /* @__PURE__ */ e(rt, { children: /* @__PURE__ */ e(Ut, { ...t }) });
1713
+ return /* @__PURE__ */ e(it, { children: /* @__PURE__ */ e(Ut, { ...t }) });
1699
1714
  }
1700
1715
  const Gt = ({
1701
1716
  agentId: t,
1702
1717
  baseUrl: n,
1703
1718
  apiKey: i,
1704
- mode: o,
1719
+ mode: l,
1705
1720
  onAgentEvent: r,
1706
1721
  className: s,
1707
1722
  style: c
1708
1723
  }) => {
1709
- const m = L(null), d = L(null), f = L(r);
1724
+ const m = M(null), d = M(null), f = M(r);
1710
1725
  f.current = r;
1711
- const h = g((l) => {
1726
+ const p = g((o) => {
1712
1727
  var C;
1713
- const a = l.detail;
1728
+ const a = o.detail;
1714
1729
  (C = f.current) == null || C.call(f, a);
1715
1730
  }, []);
1716
1731
  return S(() => {
1717
- const l = m.current;
1718
- if (!l) return;
1732
+ const o = m.current;
1733
+ if (!o) return;
1719
1734
  const a = document.createElement("livelayer-widget");
1720
- return a.setAttribute("agent-id", t), n && a.setAttribute("base-url", n), i && a.setAttribute("api-key", i), o && a.setAttribute("mode", o), a.addEventListener("agent-event", h), l.appendChild(a), d.current = a, () => {
1721
- a.removeEventListener("agent-event", h), l.removeChild(a), d.current = null;
1735
+ return a.setAttribute("agent-id", t), n && a.setAttribute("base-url", n), i && a.setAttribute("api-key", i), l && a.setAttribute("mode", l), a.addEventListener("agent-event", p), o.appendChild(a), d.current = a, () => {
1736
+ a.removeEventListener("agent-event", p), o.removeChild(a), d.current = null;
1722
1737
  };
1723
1738
  }, [t]), S(() => {
1724
- d.current && (o ? d.current.setAttribute("mode", o) : d.current.removeAttribute("mode"));
1725
- }, [o]), /* @__PURE__ */ e("div", { ref: m, className: s, style: c });
1739
+ d.current && (l ? d.current.setAttribute("mode", l) : d.current.removeAttribute("mode"));
1740
+ }, [l]), /* @__PURE__ */ e("div", { ref: m, className: s, style: c });
1726
1741
  };
1727
1742
  function Kt() {
1728
1743
  const [t, n] = k([]), i = g((r) => {
@@ -1734,27 +1749,27 @@ function Kt() {
1734
1749
  }
1735
1750
  return [...s, r];
1736
1751
  });
1737
- }, []), o = g(() => n([]), []);
1752
+ }, []), l = g(() => n([]), []);
1738
1753
  return {
1739
1754
  entries: t,
1740
1755
  pushSegment: i,
1741
- clear: o,
1756
+ clear: l,
1742
1757
  latest: t.length > 0 ? t[t.length - 1] : null
1743
1758
  };
1744
1759
  }
1745
1760
  export {
1746
1761
  Ft as AvatarWidget,
1747
- rt as ErrorBoundary,
1762
+ it as ErrorBoundary,
1748
1763
  Gt as LiveLayerWidget,
1749
- ut as useAgentInfo,
1764
+ ht as useAgentInfo,
1750
1765
  ot as useAudioLevel,
1751
- st as useCameraState,
1752
- mt as useDisplayMode,
1753
- vt as useDisplayModePersistence,
1754
- _t as useIsMobile,
1755
- it as useLiveKitSession,
1756
- dt as useMediaDevices,
1757
- lt as useMicrophoneState,
1758
- ct as useScreenShareState,
1766
+ ct as useCameraState,
1767
+ ft as useDisplayMode,
1768
+ yt as useDisplayModePersistence,
1769
+ bt as useIsMobile,
1770
+ lt as useLiveKitSession,
1771
+ ut as useMediaDevices,
1772
+ at as useMicrophoneState,
1773
+ dt as useScreenShareState,
1759
1774
  Kt as useTranscript
1760
1775
  };