@livelayer/react 0.5.15 → 0.5.17
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.js +3 -3
- package/dist/index.mjs +326 -320
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as _, jsx as n, Fragment as
|
|
3
|
-
import { Component as pn, useState as S, useRef as
|
|
2
|
+
import { jsxs as _, jsx as n, Fragment as vt } from "react/jsx-runtime";
|
|
3
|
+
import { Component as pn, useState as S, useRef as A, useEffect as N, useCallback as L, useMemo as lt, forwardRef as bt, createElement as hn } from "react";
|
|
4
4
|
import { LiveKitSession as mn } from "@livelayer/sdk";
|
|
5
5
|
import { createLocalAudioTrack as gn, Track as Xt, createLocalVideoTrack as yn } from "livekit-client";
|
|
6
6
|
class vn extends pn {
|
|
@@ -34,8 +34,8 @@ class vn extends pn {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
function bn(e) {
|
|
37
|
-
const [t, r] = S("idle"), [i, o] = S("idle"), [l, c] = S([]), [d, f] = S(null), [
|
|
38
|
-
z.current = e.onDataMessage,
|
|
37
|
+
const [t, r] = S("idle"), [i, o] = S("idle"), [l, c] = S([]), [d, f] = S(null), [y, b] = S(null), [s, a] = S(null), [k, E] = S(!1), [C, v] = S(null), w = A(null), z = A(e.onDataMessage);
|
|
38
|
+
z.current = e.onDataMessage, N(() => {
|
|
39
39
|
const R = {
|
|
40
40
|
onConnectionStateChange: (D) => {
|
|
41
41
|
r(D), D === "connected" && v(null);
|
|
@@ -84,7 +84,7 @@ function bn(e) {
|
|
|
84
84
|
}, []), H = L(() => {
|
|
85
85
|
const R = w.current;
|
|
86
86
|
R && R.disconnect();
|
|
87
|
-
}, []),
|
|
87
|
+
}, []), m = L(() => {
|
|
88
88
|
var R;
|
|
89
89
|
return ((R = w.current) == null ? void 0 : R.getRoom()) ?? null;
|
|
90
90
|
}, []);
|
|
@@ -93,18 +93,18 @@ function bn(e) {
|
|
|
93
93
|
agentState: i,
|
|
94
94
|
transcript: l,
|
|
95
95
|
agentConfig: d,
|
|
96
|
-
videoElement:
|
|
96
|
+
videoElement: y,
|
|
97
97
|
audioElement: s,
|
|
98
98
|
canResume: k,
|
|
99
99
|
error: C,
|
|
100
100
|
connect: I,
|
|
101
101
|
disconnect: H,
|
|
102
|
-
getRoom:
|
|
102
|
+
getRoom: m,
|
|
103
103
|
session: w.current
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
function wn() {
|
|
107
|
-
const e =
|
|
107
|
+
const e = A(null), t = A(null), r = A(null), i = A(null), o = A(/* @__PURE__ */ new Set()), l = A(null), c = L(() => {
|
|
108
108
|
const s = t.current;
|
|
109
109
|
if (!s) {
|
|
110
110
|
i.current = null;
|
|
@@ -150,7 +150,7 @@ function wn() {
|
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
152
|
[d, c]
|
|
153
|
-
),
|
|
153
|
+
), y = L(() => {
|
|
154
154
|
if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), r.current) {
|
|
155
155
|
try {
|
|
156
156
|
r.current.disconnect();
|
|
@@ -161,8 +161,8 @@ function wn() {
|
|
|
161
161
|
}, []), b = L((s) => (o.current.add(s), () => {
|
|
162
162
|
o.current.delete(s);
|
|
163
163
|
}), []);
|
|
164
|
-
return
|
|
165
|
-
if (
|
|
164
|
+
return N(() => () => {
|
|
165
|
+
if (y(), t.current) {
|
|
166
166
|
try {
|
|
167
167
|
t.current.disconnect();
|
|
168
168
|
} catch {
|
|
@@ -177,10 +177,10 @@ function wn() {
|
|
|
177
177
|
e.current = null;
|
|
178
178
|
}
|
|
179
179
|
o.current.clear(), l.current = null;
|
|
180
|
-
}, [
|
|
180
|
+
}, [y]), { attach: f, detach: y, subscribe: b };
|
|
181
181
|
}
|
|
182
182
|
function _n() {
|
|
183
|
-
const [e, t] = S(!1), [r, i] = S(null), o =
|
|
183
|
+
const [e, t] = S(!1), [r, i] = S(null), o = A(null), l = A(null), c = L(
|
|
184
184
|
async (s, a) => {
|
|
185
185
|
if (o.current && l.current) {
|
|
186
186
|
try {
|
|
@@ -208,7 +208,7 @@ function _n() {
|
|
|
208
208
|
}, []), f = L((s) => {
|
|
209
209
|
const a = o.current;
|
|
210
210
|
a && (s && !a.isMuted ? (a.mute(), t(!0)) : !s && a.isMuted && (a.unmute(), t(!1)));
|
|
211
|
-
}, []),
|
|
211
|
+
}, []), y = L(() => {
|
|
212
212
|
const s = o.current, a = l.current;
|
|
213
213
|
if (s && a) {
|
|
214
214
|
try {
|
|
@@ -225,16 +225,16 @@ function _n() {
|
|
|
225
225
|
toggleMute: d,
|
|
226
226
|
setMuted: f,
|
|
227
227
|
setupMic: c,
|
|
228
|
-
teardownMic:
|
|
228
|
+
teardownMic: y,
|
|
229
229
|
clearError: b
|
|
230
230
|
};
|
|
231
231
|
}
|
|
232
232
|
const xn = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
233
233
|
function kn() {
|
|
234
|
-
const [e, t] = S(!1), [r, i] = S(null), [o, l] = S(null), [c, d] = S(""), f =
|
|
234
|
+
const [e, t] = S(!1), [r, i] = S(null), [o, l] = S(null), [c, d] = S(""), f = A(null), y = A(null), b = L((w) => {
|
|
235
235
|
f.current = w;
|
|
236
236
|
}, []), s = L(() => {
|
|
237
|
-
const w = f.current, z =
|
|
237
|
+
const w = f.current, z = y.current;
|
|
238
238
|
if (z && w) {
|
|
239
239
|
const I = w.localParticipant.getTrackPublication(Xt.Source.Camera);
|
|
240
240
|
if (I != null && I.track) {
|
|
@@ -246,7 +246,7 @@ function kn() {
|
|
|
246
246
|
} else
|
|
247
247
|
z.stop();
|
|
248
248
|
}
|
|
249
|
-
|
|
249
|
+
y.current = null, l(null), t(!1);
|
|
250
250
|
}, []), a = L(async (w) => {
|
|
251
251
|
const z = f.current;
|
|
252
252
|
if (z) {
|
|
@@ -255,9 +255,9 @@ function kn() {
|
|
|
255
255
|
const I = { ...xn };
|
|
256
256
|
w && (I.deviceId = w);
|
|
257
257
|
const H = await yn(I);
|
|
258
|
-
await z.localParticipant.publishTrack(H),
|
|
259
|
-
const
|
|
260
|
-
l(
|
|
258
|
+
await z.localParticipant.publishTrack(H), y.current = H;
|
|
259
|
+
const m = H.attach();
|
|
260
|
+
l(m), t(!0), w && d(w);
|
|
261
261
|
try {
|
|
262
262
|
z.localParticipant.publishData(
|
|
263
263
|
new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
|
|
@@ -277,8 +277,8 @@ function kn() {
|
|
|
277
277
|
}, [s, a]), C = L(() => {
|
|
278
278
|
s(), f.current = null, i(null), d("");
|
|
279
279
|
}, [s]), v = L(() => i(null), []);
|
|
280
|
-
return
|
|
281
|
-
|
|
280
|
+
return N(() => () => {
|
|
281
|
+
y.current && y.current.stop();
|
|
282
282
|
}, []), {
|
|
283
283
|
isEnabled: e,
|
|
284
284
|
error: r,
|
|
@@ -292,9 +292,9 @@ function kn() {
|
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
294
|
function Ln() {
|
|
295
|
-
const [e, t] = S(!1), [r, i] = S(null), [o, l] = S(null), c =
|
|
295
|
+
const [e, t] = S(!1), [r, i] = S(null), [o, l] = S(null), c = A(null), d = L((a) => {
|
|
296
296
|
c.current = a;
|
|
297
|
-
}, []), f = L(() => l(null), []),
|
|
297
|
+
}, []), f = L(() => l(null), []), y = L(async () => {
|
|
298
298
|
const a = c.current;
|
|
299
299
|
if (a) {
|
|
300
300
|
if (e) {
|
|
@@ -340,7 +340,7 @@ function Ln() {
|
|
|
340
340
|
}
|
|
341
341
|
f(), t(!1), i(null), c.current = null;
|
|
342
342
|
}, [e, f]), s = L(() => i(null), []);
|
|
343
|
-
return { isEnabled: e, error: r, previewEl: o, toggle:
|
|
343
|
+
return { isEnabled: e, error: r, previewEl: o, toggle: y, attachRoom: d, teardown: b, clearError: s };
|
|
344
344
|
}
|
|
345
345
|
function Sn() {
|
|
346
346
|
const [e, t] = S([]), [r, i] = S([]), o = L(async () => {
|
|
@@ -351,7 +351,7 @@ function Sn() {
|
|
|
351
351
|
} catch {
|
|
352
352
|
}
|
|
353
353
|
}, []);
|
|
354
|
-
return
|
|
354
|
+
return N(() => {
|
|
355
355
|
if (o(), typeof navigator > "u" || !navigator.mediaDevices) return;
|
|
356
356
|
const l = () => void o();
|
|
357
357
|
return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
|
|
@@ -359,14 +359,14 @@ function Sn() {
|
|
|
359
359
|
}
|
|
360
360
|
function Cn(e, t, r = !1) {
|
|
361
361
|
const [i, o] = S(null), [l, c] = S(null), [d, f] = S(!r && !!e);
|
|
362
|
-
return
|
|
362
|
+
return N(() => {
|
|
363
363
|
if (r || !e) {
|
|
364
364
|
f(!1);
|
|
365
365
|
return;
|
|
366
366
|
}
|
|
367
|
-
const
|
|
367
|
+
const y = new AbortController(), b = t || "https://app.livelayer.studio";
|
|
368
368
|
return f(!0), c(null), fetch(`${b}/api/widget/agent/${encodeURIComponent(e)}`, {
|
|
369
|
-
signal:
|
|
369
|
+
signal: y.signal
|
|
370
370
|
}).then(async (s) => {
|
|
371
371
|
if (!s.ok) {
|
|
372
372
|
const a = await s.json().catch(() => ({}));
|
|
@@ -374,10 +374,10 @@ function Cn(e, t, r = !1) {
|
|
|
374
374
|
}
|
|
375
375
|
return s.json();
|
|
376
376
|
}).then((s) => {
|
|
377
|
-
|
|
377
|
+
y.signal.aborted || (o(s), f(!1));
|
|
378
378
|
}).catch((s) => {
|
|
379
|
-
|
|
380
|
-
}), () =>
|
|
379
|
+
y.signal.aborted || (c(s instanceof Error ? s.message : "Agent lookup failed"), f(!1));
|
|
380
|
+
}), () => y.abort();
|
|
381
381
|
}, [e, t, r]), { info: i, error: l, loading: d };
|
|
382
382
|
}
|
|
383
383
|
function En(e) {
|
|
@@ -419,23 +419,23 @@ function In({
|
|
|
419
419
|
persistKey: i = "ll-widget",
|
|
420
420
|
disablePersistence: o = !1
|
|
421
421
|
} = {}) {
|
|
422
|
-
const l = `${i}:display-mode`, c =
|
|
422
|
+
const l = `${i}:display-mode`, c = A(!1), [d, f] = An({
|
|
423
423
|
value: e,
|
|
424
424
|
defaultValue: t,
|
|
425
|
-
onChange: (
|
|
426
|
-
e === void 0 && !o && Nn(l,
|
|
425
|
+
onChange: (y) => {
|
|
426
|
+
e === void 0 && !o && Nn(l, y), r == null || r(y);
|
|
427
427
|
}
|
|
428
428
|
});
|
|
429
|
-
return
|
|
429
|
+
return N(() => {
|
|
430
430
|
if (c.current || (c.current = !0, o || e !== void 0)) return;
|
|
431
|
-
const
|
|
432
|
-
|
|
431
|
+
const y = Mn(En(l));
|
|
432
|
+
y && y !== d && f(y);
|
|
433
433
|
}, []), [d, f];
|
|
434
434
|
}
|
|
435
435
|
const Tn = 640;
|
|
436
436
|
function Pn(e = Tn) {
|
|
437
437
|
const [t, r] = S(!1);
|
|
438
|
-
return
|
|
438
|
+
return N(() => {
|
|
439
439
|
if (e === !1) {
|
|
440
440
|
r(!1);
|
|
441
441
|
return;
|
|
@@ -448,16 +448,16 @@ function Pn(e = Tn) {
|
|
|
448
448
|
});
|
|
449
449
|
}, [e]), t;
|
|
450
450
|
}
|
|
451
|
-
const Pt = "__llHistoryPatched",
|
|
451
|
+
const Pt = "__llHistoryPatched", at = "ll:pathname";
|
|
452
452
|
function Dn() {
|
|
453
453
|
if (typeof window > "u" || window.history[Pt]) return;
|
|
454
454
|
const e = window.history.pushState, t = window.history.replaceState;
|
|
455
455
|
window.history.pushState = function(...r) {
|
|
456
456
|
const i = e.apply(this, r);
|
|
457
|
-
return window.dispatchEvent(new Event(
|
|
457
|
+
return window.dispatchEvent(new Event(at)), i;
|
|
458
458
|
}, window.history.replaceState = function(...r) {
|
|
459
459
|
const i = t.apply(this, r);
|
|
460
|
-
return window.dispatchEvent(new Event(
|
|
460
|
+
return window.dispatchEvent(new Event(at)), i;
|
|
461
461
|
}, window.history[Pt] = !0;
|
|
462
462
|
}
|
|
463
463
|
function Dt() {
|
|
@@ -467,12 +467,12 @@ function $n(e) {
|
|
|
467
467
|
const [t, r] = S(
|
|
468
468
|
() => e ?? Dt()
|
|
469
469
|
);
|
|
470
|
-
return
|
|
470
|
+
return N(() => {
|
|
471
471
|
if (e !== void 0) return;
|
|
472
472
|
Dn();
|
|
473
473
|
const i = () => r(Dt());
|
|
474
|
-
return i(), window.addEventListener("popstate", i), window.addEventListener(
|
|
475
|
-
window.removeEventListener("popstate", i), window.removeEventListener(
|
|
474
|
+
return i(), window.addEventListener("popstate", i), window.addEventListener(at, i), () => {
|
|
475
|
+
window.removeEventListener("popstate", i), window.removeEventListener(at, i);
|
|
476
476
|
};
|
|
477
477
|
}, [e]), e ?? t;
|
|
478
478
|
}
|
|
@@ -503,7 +503,7 @@ function Wn(e, t, r) {
|
|
|
503
503
|
return e === void 0 ? !0 : zt(r, e) ? !1 : t && t.length > 0 ? zt(t, e) : !0;
|
|
504
504
|
}
|
|
505
505
|
function Fn(e, t, r) {
|
|
506
|
-
return
|
|
506
|
+
return lt(
|
|
507
507
|
() => Wn(e, t, r),
|
|
508
508
|
[e, t, r]
|
|
509
509
|
);
|
|
@@ -632,15 +632,15 @@ const Jn = ({
|
|
|
632
632
|
avatarImageUrl: l,
|
|
633
633
|
agentName: c
|
|
634
634
|
}) => {
|
|
635
|
-
const d = Vn(e), f = d === "right" ? "left" : "right",
|
|
635
|
+
const d = Vn(e), f = d === "right" ? "left" : "right", y = t ? 80 : 72, b = !!l, [s, a] = S(null), [k, E] = S(!1), C = A(null), v = A(!1), w = L(
|
|
636
636
|
(M) => {
|
|
637
637
|
if (typeof window > "u") return M;
|
|
638
|
-
const O =
|
|
638
|
+
const O = y / 2, W = qt + O, J = window.innerHeight - qt - O;
|
|
639
639
|
return J < W ? Math.max(W, M) : Math.max(W, Math.min(J, M));
|
|
640
640
|
},
|
|
641
|
-
[
|
|
641
|
+
[y]
|
|
642
642
|
);
|
|
643
|
-
|
|
643
|
+
N(() => {
|
|
644
644
|
const M = Gn();
|
|
645
645
|
a(w(M ?? window.innerHeight / 2));
|
|
646
646
|
const O = () => {
|
|
@@ -683,7 +683,7 @@ const Jn = ({
|
|
|
683
683
|
}
|
|
684
684
|
},
|
|
685
685
|
[]
|
|
686
|
-
),
|
|
686
|
+
), m = L(() => {
|
|
687
687
|
if (v.current) {
|
|
688
688
|
v.current = !1;
|
|
689
689
|
return;
|
|
@@ -709,7 +709,7 @@ const Jn = ({
|
|
|
709
709
|
r ? "ll-hidden--speaking" : null,
|
|
710
710
|
k ? "is-dragging" : null,
|
|
711
711
|
b ? "ll-hidden--with-avatar" : null
|
|
712
|
-
].filter(Boolean).join(" "), D = s === null ? void 0 : { top: `${s -
|
|
712
|
+
].filter(Boolean).join(" "), D = s === null ? void 0 : { top: `${s - y / 2}px`, transform: "none" };
|
|
713
713
|
return /* @__PURE__ */ n(
|
|
714
714
|
"button",
|
|
715
715
|
{
|
|
@@ -719,7 +719,7 @@ const Jn = ({
|
|
|
719
719
|
onPointerMove: I,
|
|
720
720
|
onPointerUp: H,
|
|
721
721
|
onPointerCancel: H,
|
|
722
|
-
onClick:
|
|
722
|
+
onClick: m,
|
|
723
723
|
onKeyDown: R,
|
|
724
724
|
"aria-label": o,
|
|
725
725
|
"data-position": e,
|
|
@@ -729,7 +729,7 @@ const Jn = ({
|
|
|
729
729
|
// as the click affordance), then the circular avatar photo
|
|
730
730
|
// taking the rest of the tab. Reinforces "this is an
|
|
731
731
|
// avatar-based experience" even when collapsed.
|
|
732
|
-
/* @__PURE__ */ _(
|
|
732
|
+
/* @__PURE__ */ _(vt, { children: [
|
|
733
733
|
/* @__PURE__ */ n(
|
|
734
734
|
Bt,
|
|
735
735
|
{
|
|
@@ -764,11 +764,11 @@ const Jn = ({
|
|
|
764
764
|
className: o,
|
|
765
765
|
barClassName: l
|
|
766
766
|
}) => {
|
|
767
|
-
const c =
|
|
767
|
+
const c = A(null), d = A([]), f = lt(() => {
|
|
768
768
|
const b = (Math.sqrt(5) - 1) / 2;
|
|
769
769
|
return Array.from({ length: t }, (s, a) => 0.5 + a * b % 1 * 0.5);
|
|
770
770
|
}, [t]);
|
|
771
|
-
|
|
771
|
+
N(() => e.subscribe((s) => {
|
|
772
772
|
for (let a = 0; a < t; a++) {
|
|
773
773
|
const k = d.current[a];
|
|
774
774
|
if (!k) continue;
|
|
@@ -776,8 +776,8 @@ const Jn = ({
|
|
|
776
776
|
k.style.height = `${E}px`;
|
|
777
777
|
}
|
|
778
778
|
}), [e, t, r, i, f]);
|
|
779
|
-
const
|
|
780
|
-
return /* @__PURE__ */ n("div", { ref: c, className:
|
|
779
|
+
const y = ["ll-waveform", o].filter(Boolean).join(" ");
|
|
780
|
+
return /* @__PURE__ */ n("div", { ref: c, className: y, "aria-hidden": "true", children: Array.from({ length: t }, (b, s) => /* @__PURE__ */ n(
|
|
781
781
|
"div",
|
|
782
782
|
{
|
|
783
783
|
ref: (a) => {
|
|
@@ -798,7 +798,7 @@ const Jn = ({
|
|
|
798
798
|
audioLevel: c,
|
|
799
799
|
onExpand: d,
|
|
800
800
|
onToggleMute: f,
|
|
801
|
-
onClose:
|
|
801
|
+
onClose: y
|
|
802
802
|
}) => t ? /* @__PURE__ */ n(
|
|
803
803
|
"div",
|
|
804
804
|
{
|
|
@@ -906,7 +906,7 @@ const Jn = ({
|
|
|
906
906
|
{
|
|
907
907
|
type: "button",
|
|
908
908
|
className: "ll-minimized__btn ll-minimized__btn--close",
|
|
909
|
-
onClick:
|
|
909
|
+
onClick: y,
|
|
910
910
|
"aria-label": "Close widget",
|
|
911
911
|
children: /* @__PURE__ */ n(Un, { className: "ll-minimized__icon" })
|
|
912
912
|
}
|
|
@@ -921,8 +921,8 @@ const Jn = ({
|
|
|
921
921
|
className: i,
|
|
922
922
|
style: o
|
|
923
923
|
}) => {
|
|
924
|
-
const [l, c] = S(!1), d =
|
|
925
|
-
if (
|
|
924
|
+
const [l, c] = S(!1), d = A(e);
|
|
925
|
+
if (N(() => {
|
|
926
926
|
d.current !== e && (d.current = e, c(!1));
|
|
927
927
|
}, [e]), !e) return null;
|
|
928
928
|
const f = {
|
|
@@ -962,7 +962,7 @@ const Jn = ({
|
|
|
962
962
|
branding: c,
|
|
963
963
|
teamMembers: d,
|
|
964
964
|
currentTeamMemberId: f,
|
|
965
|
-
isSwitchingTeamMember:
|
|
965
|
+
isSwitchingTeamMember: y,
|
|
966
966
|
teamSwitcherOpen: b,
|
|
967
967
|
onToggleTeamSwitcher: s,
|
|
968
968
|
onSelectTeamMember: a,
|
|
@@ -974,7 +974,7 @@ const Jn = ({
|
|
|
974
974
|
canResume: z,
|
|
975
975
|
needsUserGesture: I,
|
|
976
976
|
error: H,
|
|
977
|
-
isMuted:
|
|
977
|
+
isMuted: m,
|
|
978
978
|
micError: R,
|
|
979
979
|
micDevices: q,
|
|
980
980
|
isCameraEnabled: D,
|
|
@@ -984,11 +984,11 @@ const Jn = ({
|
|
|
984
984
|
isScreenShareEnabled: J,
|
|
985
985
|
screenPreviewEl: ne,
|
|
986
986
|
isSpeakerMuted: ye,
|
|
987
|
-
allowCamera:
|
|
988
|
-
allowScreenShare:
|
|
989
|
-
allowTyping:
|
|
990
|
-
avatarVideoContainerRef:
|
|
991
|
-
agentVideoEl:
|
|
987
|
+
allowCamera: Ke,
|
|
988
|
+
allowScreenShare: Xe,
|
|
989
|
+
allowTyping: Qe,
|
|
990
|
+
avatarVideoContainerRef: Ze,
|
|
991
|
+
agentVideoEl: te,
|
|
992
992
|
micGateOpen: ae,
|
|
993
993
|
onConnect: ve,
|
|
994
994
|
onDisconnect: xe,
|
|
@@ -997,32 +997,32 @@ const Jn = ({
|
|
|
997
997
|
onToggleMute: Se,
|
|
998
998
|
onToggleCamera: Ce,
|
|
999
999
|
onSwitchCameraDevice: V,
|
|
1000
|
-
onToggleScreenShare:
|
|
1001
|
-
onToggleSpeaker:
|
|
1002
|
-
onSendMessage:
|
|
1000
|
+
onToggleScreenShare: ct,
|
|
1001
|
+
onToggleSpeaker: dt,
|
|
1002
|
+
onSendMessage: et,
|
|
1003
1003
|
onMinimize: ce,
|
|
1004
1004
|
onClose: Ee,
|
|
1005
1005
|
onClearMicError: He
|
|
1006
1006
|
}) => {
|
|
1007
1007
|
var Ie;
|
|
1008
1008
|
const be = ((d == null ? void 0 : d.length) ?? 0) > 1, Ne = C === "connecting" || C === "connected", G = C === "connected", Q = C === "idle" || C === "disconnected" || C === "error", [Ae, re] = S(!1);
|
|
1009
|
-
|
|
1010
|
-
if (!
|
|
1009
|
+
N(() => {
|
|
1010
|
+
if (!te) {
|
|
1011
1011
|
re(!1);
|
|
1012
1012
|
return;
|
|
1013
1013
|
}
|
|
1014
|
-
if (!
|
|
1014
|
+
if (!te.paused && te.readyState >= 2) {
|
|
1015
1015
|
re(!0);
|
|
1016
1016
|
return;
|
|
1017
1017
|
}
|
|
1018
1018
|
re(!1);
|
|
1019
1019
|
const p = () => re(!0);
|
|
1020
|
-
return
|
|
1021
|
-
|
|
1020
|
+
return te.addEventListener("playing", p), te.addEventListener("loadeddata", p), () => {
|
|
1021
|
+
te.removeEventListener("playing", p), te.removeEventListener("loadeddata", p);
|
|
1022
1022
|
};
|
|
1023
|
-
}, [
|
|
1023
|
+
}, [te]);
|
|
1024
1024
|
const [se, we] = S(!1);
|
|
1025
|
-
|
|
1025
|
+
N(() => {
|
|
1026
1026
|
if (!G) {
|
|
1027
1027
|
we(!1);
|
|
1028
1028
|
return;
|
|
@@ -1031,16 +1031,16 @@ const Jn = ({
|
|
|
1031
1031
|
const p = setTimeout(() => we(!0), 8e3);
|
|
1032
1032
|
return () => clearTimeout(p);
|
|
1033
1033
|
}, [G, Ae]);
|
|
1034
|
-
const Oe = C === "connecting" || G && !!i && !Ae && !se,
|
|
1035
|
-
|
|
1036
|
-
const p =
|
|
1034
|
+
const Oe = C === "connecting" || G && !!i && !Ae && !se, ee = A(null), ie = A(null);
|
|
1035
|
+
N(() => {
|
|
1036
|
+
const p = ee.current;
|
|
1037
1037
|
p && (p.innerHTML = "", M && (M.style.width = "100%", M.style.height = "100%", M.style.objectFit = "cover", M.style.transform = "scaleX(-1)", p.appendChild(M)));
|
|
1038
|
-
}, [M]),
|
|
1038
|
+
}, [M]), N(() => {
|
|
1039
1039
|
const p = ie.current;
|
|
1040
1040
|
p && (p.innerHTML = "", ne && (ne.style.width = "100%", ne.style.height = "100%", ne.style.objectFit = "contain", p.appendChild(ne)));
|
|
1041
1041
|
}, [ne]);
|
|
1042
1042
|
const [oe, de] = S(!1), [Re, ue] = S(!1);
|
|
1043
|
-
|
|
1043
|
+
N(() => {
|
|
1044
1044
|
if (!oe && !Re && !k && !b) return;
|
|
1045
1045
|
const p = () => {
|
|
1046
1046
|
de(!1), ue(!1), k && E(), b && s();
|
|
@@ -1058,16 +1058,16 @@ const Jn = ({
|
|
|
1058
1058
|
(p) => {
|
|
1059
1059
|
p.preventDefault();
|
|
1060
1060
|
const Y = fe.trim();
|
|
1061
|
-
Y && (
|
|
1061
|
+
Y && (et(Y), Be(""));
|
|
1062
1062
|
},
|
|
1063
|
-
[fe,
|
|
1063
|
+
[fe, et]
|
|
1064
1064
|
), We = c.productName || "Live Layer";
|
|
1065
1065
|
let pe = null, he = null;
|
|
1066
1066
|
for (let p = w.length - 1; p >= 0; p--) {
|
|
1067
1067
|
const Y = w[p];
|
|
1068
1068
|
if (!pe && Y.role === "agent" ? pe = Y : !he && Y.role === "user" && (he = Y), pe && he) break;
|
|
1069
1069
|
}
|
|
1070
|
-
const Me = G ? (pe == null ? void 0 : pe.text) || null : l || null,
|
|
1070
|
+
const Me = G ? (pe == null ? void 0 : pe.text) || null : l || null, tt = G && (he == null ? void 0 : he.text) || null, Fe = [
|
|
1071
1071
|
"ll-expanded",
|
|
1072
1072
|
t ? "ll-expanded--mobile" : "ll-expanded--desktop"
|
|
1073
1073
|
].join(" ");
|
|
@@ -1101,10 +1101,10 @@ const Jn = ({
|
|
|
1101
1101
|
}
|
|
1102
1102
|
)
|
|
1103
1103
|
] }),
|
|
1104
|
-
/* @__PURE__ */ n("div", { ref:
|
|
1104
|
+
/* @__PURE__ */ n("div", { ref: Ze, className: "ll-expanded__video" }),
|
|
1105
1105
|
Oe && /* @__PURE__ */ _("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
|
|
1106
1106
|
/* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
|
|
1107
|
-
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children:
|
|
1107
|
+
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: y ? "Switching..." : "Connecting..." })
|
|
1108
1108
|
] }),
|
|
1109
1109
|
I && G && /* @__PURE__ */ _(
|
|
1110
1110
|
"button",
|
|
@@ -1133,7 +1133,7 @@ const Jn = ({
|
|
|
1133
1133
|
"aria-expanded": be ? b : void 0,
|
|
1134
1134
|
children: [
|
|
1135
1135
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
|
|
1136
|
-
be && /* @__PURE__ */ n(
|
|
1136
|
+
be && /* @__PURE__ */ n(it, {})
|
|
1137
1137
|
]
|
|
1138
1138
|
}
|
|
1139
1139
|
),
|
|
@@ -1184,7 +1184,7 @@ const Jn = ({
|
|
|
1184
1184
|
title: "Language: English",
|
|
1185
1185
|
children: [
|
|
1186
1186
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: "EN" }),
|
|
1187
|
-
/* @__PURE__ */ n(
|
|
1187
|
+
/* @__PURE__ */ n(it, {})
|
|
1188
1188
|
]
|
|
1189
1189
|
}
|
|
1190
1190
|
),
|
|
@@ -1269,7 +1269,7 @@ const Jn = ({
|
|
|
1269
1269
|
),
|
|
1270
1270
|
Q && /* @__PURE__ */ (() => {
|
|
1271
1271
|
const p = z ? "Restart paused session" : C === "disconnected" ? "Reconnect to agent" : "Start video call", Y = z ? "Pick up where you left off" : null;
|
|
1272
|
-
return /* @__PURE__ */ _(
|
|
1272
|
+
return /* @__PURE__ */ _(vt, { children: [
|
|
1273
1273
|
C === "idle" && !z && !H && /* @__PURE__ */ _(
|
|
1274
1274
|
"button",
|
|
1275
1275
|
{
|
|
@@ -1314,7 +1314,7 @@ const Jn = ({
|
|
|
1314
1314
|
/* @__PURE__ */ n(
|
|
1315
1315
|
"div",
|
|
1316
1316
|
{
|
|
1317
|
-
ref:
|
|
1317
|
+
ref: ee,
|
|
1318
1318
|
className: !J && D ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1319
1319
|
}
|
|
1320
1320
|
)
|
|
@@ -1330,27 +1330,27 @@ const Jn = ({
|
|
|
1330
1330
|
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Me })
|
|
1331
1331
|
}
|
|
1332
1332
|
),
|
|
1333
|
-
|
|
1333
|
+
tt && /* @__PURE__ */ n(
|
|
1334
1334
|
"div",
|
|
1335
1335
|
{
|
|
1336
1336
|
className: "ll-expanded__transcript ll-expanded__transcript--user",
|
|
1337
1337
|
"data-role": "user",
|
|
1338
|
-
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children:
|
|
1338
|
+
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: tt })
|
|
1339
1339
|
}
|
|
1340
1340
|
),
|
|
1341
1341
|
/* @__PURE__ */ _("div", { className: "ll-toolbar", onClick: (p) => p.stopPropagation(), children: [
|
|
1342
|
-
|
|
1342
|
+
Xe && /* @__PURE__ */ n(
|
|
1343
1343
|
"button",
|
|
1344
1344
|
{
|
|
1345
1345
|
type: "button",
|
|
1346
1346
|
className: `ll-tool ${J ? "is-on" : ""}`,
|
|
1347
|
-
onClick:
|
|
1347
|
+
onClick: ct,
|
|
1348
1348
|
"aria-label": J ? "Stop sharing screen" : "Share screen",
|
|
1349
1349
|
title: J ? "Stop sharing" : "Share screen",
|
|
1350
1350
|
children: /* @__PURE__ */ n(er, {})
|
|
1351
1351
|
}
|
|
1352
1352
|
),
|
|
1353
|
-
|
|
1353
|
+
Ke && /* @__PURE__ */ _("div", { className: "ll-tool-split", children: [
|
|
1354
1354
|
/* @__PURE__ */ n(
|
|
1355
1355
|
"button",
|
|
1356
1356
|
{
|
|
@@ -1373,7 +1373,7 @@ const Jn = ({
|
|
|
1373
1373
|
"aria-label": "Camera devices",
|
|
1374
1374
|
"aria-haspopup": "listbox",
|
|
1375
1375
|
"aria-expanded": Re,
|
|
1376
|
-
children: /* @__PURE__ */ n(
|
|
1376
|
+
children: /* @__PURE__ */ n(it, {})
|
|
1377
1377
|
}
|
|
1378
1378
|
),
|
|
1379
1379
|
Re && O.length > 0 && /* @__PURE__ */ n(
|
|
@@ -1397,26 +1397,26 @@ const Jn = ({
|
|
|
1397
1397
|
"button",
|
|
1398
1398
|
{
|
|
1399
1399
|
type: "button",
|
|
1400
|
-
className: `ll-tool ll-tool--left ${
|
|
1400
|
+
className: `ll-tool ll-tool--left ${m ? "is-muted" : ""}`,
|
|
1401
1401
|
onClick: Se,
|
|
1402
1402
|
disabled: !ae && G,
|
|
1403
|
-
"aria-label": !ae && G ? "Microphone enables once the agent finishes its greeting" :
|
|
1404
|
-
title: !ae && G ? "Mic enables after greeting" :
|
|
1405
|
-
children: /* @__PURE__ */ n(nr, { muted:
|
|
1403
|
+
"aria-label": !ae && G ? "Microphone enables once the agent finishes its greeting" : m ? "Unmute microphone" : "Mute microphone",
|
|
1404
|
+
title: !ae && G ? "Mic enables after greeting" : m ? "Unmute" : "Mute",
|
|
1405
|
+
children: /* @__PURE__ */ n(nr, { muted: m })
|
|
1406
1406
|
}
|
|
1407
1407
|
),
|
|
1408
1408
|
/* @__PURE__ */ n(
|
|
1409
1409
|
"button",
|
|
1410
1410
|
{
|
|
1411
1411
|
type: "button",
|
|
1412
|
-
className: `ll-tool ll-tool--right ${
|
|
1412
|
+
className: `ll-tool ll-tool--right ${m ? "is-muted" : ""}`,
|
|
1413
1413
|
onClick: (p) => {
|
|
1414
1414
|
p.stopPropagation(), de((Y) => !Y), ue(!1);
|
|
1415
1415
|
},
|
|
1416
1416
|
"aria-label": "Microphone devices",
|
|
1417
1417
|
"aria-haspopup": "listbox",
|
|
1418
1418
|
"aria-expanded": oe,
|
|
1419
|
-
children: /* @__PURE__ */ n(
|
|
1419
|
+
children: /* @__PURE__ */ n(it, {})
|
|
1420
1420
|
}
|
|
1421
1421
|
),
|
|
1422
1422
|
oe && q.length > 0 && /* @__PURE__ */ n(
|
|
@@ -1436,7 +1436,7 @@ const Jn = ({
|
|
|
1436
1436
|
{
|
|
1437
1437
|
type: "button",
|
|
1438
1438
|
className: `ll-tool ${ye ? "is-muted" : ""}`,
|
|
1439
|
-
onClick:
|
|
1439
|
+
onClick: dt,
|
|
1440
1440
|
"aria-label": ye ? "Unmute speaker" : "Mute speaker",
|
|
1441
1441
|
title: ye ? "Unmute speaker" : "Mute speaker",
|
|
1442
1442
|
children: /* @__PURE__ */ n(rr, { muted: ye })
|
|
@@ -1454,7 +1454,7 @@ const Jn = ({
|
|
|
1454
1454
|
}
|
|
1455
1455
|
)
|
|
1456
1456
|
] }),
|
|
1457
|
-
|
|
1457
|
+
Qe && /* @__PURE__ */ _("form", { className: "ll-message-input", onSubmit: qe, children: [
|
|
1458
1458
|
/* @__PURE__ */ n(
|
|
1459
1459
|
"input",
|
|
1460
1460
|
{
|
|
@@ -1511,7 +1511,7 @@ const Jn = ({
|
|
|
1511
1511
|
}
|
|
1512
1512
|
);
|
|
1513
1513
|
};
|
|
1514
|
-
function
|
|
1514
|
+
function it() {
|
|
1515
1515
|
return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ n("polyline", { points: "6 9 12 15 18 9" }) });
|
|
1516
1516
|
}
|
|
1517
1517
|
function Ft() {
|
|
@@ -1547,7 +1547,7 @@ function nr({ muted: e }) {
|
|
|
1547
1547
|
function rr({ muted: e }) {
|
|
1548
1548
|
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: [
|
|
1549
1549
|
/* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
1550
|
-
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ _(
|
|
1550
|
+
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ _(vt, { children: [
|
|
1551
1551
|
/* @__PURE__ */ n("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
|
|
1552
1552
|
/* @__PURE__ */ n("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
|
|
1553
1553
|
] })
|
|
@@ -1600,7 +1600,7 @@ const jt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */
|
|
|
1600
1600
|
'[data-ll-private="true"]',
|
|
1601
1601
|
".ll-widget"
|
|
1602
1602
|
];
|
|
1603
|
-
function
|
|
1603
|
+
function wt(e) {
|
|
1604
1604
|
let t = e;
|
|
1605
1605
|
for (; t; ) {
|
|
1606
1606
|
for (const r of lr)
|
|
@@ -1609,8 +1609,8 @@ function bt(e) {
|
|
|
1609
1609
|
}
|
|
1610
1610
|
return !1;
|
|
1611
1611
|
}
|
|
1612
|
-
function
|
|
1613
|
-
if (
|
|
1612
|
+
function st(e) {
|
|
1613
|
+
if (wt(e)) return !1;
|
|
1614
1614
|
if (e instanceof HTMLInputElement) {
|
|
1615
1615
|
if (e.type === "password") return !1;
|
|
1616
1616
|
const t = (e.getAttribute("autocomplete") || "").toLowerCase();
|
|
@@ -1618,7 +1618,7 @@ function at(e) {
|
|
|
1618
1618
|
}
|
|
1619
1619
|
return !0;
|
|
1620
1620
|
}
|
|
1621
|
-
const
|
|
1621
|
+
const ot = 4096, ar = 20, sr = 20, cr = 10, dr = 10, ur = 30, Vt = 500, fr = [
|
|
1622
1622
|
'[data-ll-private="true"]',
|
|
1623
1623
|
".ll-widget",
|
|
1624
1624
|
"script",
|
|
@@ -1626,7 +1626,7 @@ const it = 4096, ar = 20, sr = 20, cr = 10, dr = 10, ur = 30, Vt = 500, fr = [
|
|
|
1626
1626
|
"noscript",
|
|
1627
1627
|
"iframe"
|
|
1628
1628
|
];
|
|
1629
|
-
function
|
|
1629
|
+
function Ge(e) {
|
|
1630
1630
|
if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
|
|
1631
1631
|
let t = e;
|
|
1632
1632
|
for (; t; ) {
|
|
@@ -1636,7 +1636,7 @@ function Ye(e) {
|
|
|
1636
1636
|
}
|
|
1637
1637
|
return !1;
|
|
1638
1638
|
}
|
|
1639
|
-
function
|
|
1639
|
+
function Je(e) {
|
|
1640
1640
|
if (typeof window > "u") return !0;
|
|
1641
1641
|
const t = e.getBoundingClientRect();
|
|
1642
1642
|
if (t.width <= 0 || t.height <= 0) return !1;
|
|
@@ -1679,35 +1679,35 @@ function pr(e, t = {}) {
|
|
|
1679
1679
|
const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "", c = Array.from(
|
|
1680
1680
|
r.querySelectorAll("[data-ll-region]")
|
|
1681
1681
|
), d = [];
|
|
1682
|
-
for (const
|
|
1682
|
+
for (const m of c) {
|
|
1683
1683
|
if (d.length >= cr) break;
|
|
1684
|
-
if (
|
|
1685
|
-
const R =
|
|
1686
|
-
(
|
|
1684
|
+
if (Ge(m) || !Je(m)) continue;
|
|
1685
|
+
const R = m.getAttribute("data-ll-region") ?? "", q = m.getAttribute("data-ll-intent") ?? void 0, D = _e(
|
|
1686
|
+
(m.innerText || m.textContent || "").trim(),
|
|
1687
1687
|
Vt * 2
|
|
1688
1688
|
);
|
|
1689
1689
|
!R || !D || d.push({ id: R, intent: q, text: D });
|
|
1690
1690
|
}
|
|
1691
|
-
const f = [],
|
|
1691
|
+
const f = [], y = ["H1", "H2", "H3", "H4", "H5", "H6"], b = Array.from(
|
|
1692
1692
|
r.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
|
1693
1693
|
);
|
|
1694
|
-
for (const
|
|
1695
|
-
if (
|
|
1696
|
-
const R = (
|
|
1697
|
-
R && f.push(`${
|
|
1694
|
+
for (const m of b) {
|
|
1695
|
+
if (Ge(m) || !Je(m)) continue;
|
|
1696
|
+
const R = (m.textContent || "").trim();
|
|
1697
|
+
R && f.push(`${m.tagName}: ${_e(R, 200)}`);
|
|
1698
1698
|
}
|
|
1699
1699
|
const s = Array.from(r.querySelectorAll("p, li"));
|
|
1700
|
-
for (const
|
|
1701
|
-
if (
|
|
1702
|
-
const R = (
|
|
1700
|
+
for (const m of s) {
|
|
1701
|
+
if (Ge(m) || !Je(m) || y.includes(m.tagName)) continue;
|
|
1702
|
+
const R = (m.textContent || "").trim();
|
|
1703
1703
|
R.length > 10 && f.push(_e(R, Vt));
|
|
1704
1704
|
}
|
|
1705
1705
|
const a = f.join(`
|
|
1706
1706
|
`), k = [], E = Array.from(r.querySelectorAll("a[href]"));
|
|
1707
|
-
for (const
|
|
1707
|
+
for (const m of E) {
|
|
1708
1708
|
if (k.length >= ar) break;
|
|
1709
|
-
if (
|
|
1710
|
-
const R =
|
|
1709
|
+
if (Ge(m) || !Je(m)) continue;
|
|
1710
|
+
const R = m.getAttribute("href") || "", q = (m.textContent || "").trim();
|
|
1711
1711
|
!R || !q || k.push({ href: R, text: _e(q, 100) });
|
|
1712
1712
|
}
|
|
1713
1713
|
const C = [], v = Array.from(
|
|
@@ -1715,28 +1715,28 @@ function pr(e, t = {}) {
|
|
|
1715
1715
|
"input, textarea, select"
|
|
1716
1716
|
)
|
|
1717
1717
|
);
|
|
1718
|
-
for (const
|
|
1718
|
+
for (const m of v) {
|
|
1719
1719
|
if (C.length >= sr) break;
|
|
1720
|
-
if (
|
|
1721
|
-
const R = Yt(
|
|
1720
|
+
if (Ge(m) || !st(m) || !Je(m)) continue;
|
|
1721
|
+
const R = Yt(m), q = m instanceof HTMLInputElement ? m.type : m.tagName.toLowerCase();
|
|
1722
1722
|
R && C.push({ label: _e(R, 100), type: q });
|
|
1723
1723
|
}
|
|
1724
1724
|
const w = Array.from(
|
|
1725
1725
|
r.querySelectorAll("[data-ll-form]")
|
|
1726
1726
|
), z = [];
|
|
1727
|
-
for (const
|
|
1727
|
+
for (const m of w) {
|
|
1728
1728
|
if (z.length >= dr) break;
|
|
1729
|
-
if (
|
|
1730
|
-
const R =
|
|
1729
|
+
if (wt(m)) continue;
|
|
1730
|
+
const R = m.getAttribute("data-ll-form") || "";
|
|
1731
1731
|
if (!R) continue;
|
|
1732
|
-
const q =
|
|
1733
|
-
|
|
1732
|
+
const q = m.getAttribute("data-ll-intent") || void 0, D = Array.from(
|
|
1733
|
+
m.querySelectorAll(
|
|
1734
1734
|
"[data-ll-field]"
|
|
1735
1735
|
)
|
|
1736
1736
|
), M = [];
|
|
1737
1737
|
for (const O of D) {
|
|
1738
1738
|
if (M.length >= ur) break;
|
|
1739
|
-
if (!
|
|
1739
|
+
if (!st(O)) continue;
|
|
1740
1740
|
const W = O.getAttribute("data-ll-field") || "";
|
|
1741
1741
|
if (!W) continue;
|
|
1742
1742
|
const J = Yt(O) || W, ne = O instanceof HTMLInputElement ? O.type : O.tagName.toLowerCase();
|
|
@@ -1756,11 +1756,11 @@ function pr(e, t = {}) {
|
|
|
1756
1756
|
extras: e
|
|
1757
1757
|
};
|
|
1758
1758
|
let H = De(JSON.stringify(I.regions)) + De(I.visibleText) + De(JSON.stringify(I.visibleLinks)) + De(JSON.stringify(I.visibleFields));
|
|
1759
|
-
for (; H >
|
|
1759
|
+
for (; H > ot && I.visibleFields.length > 0; )
|
|
1760
1760
|
I.visibleFields.pop(), H = De(JSON.stringify(I.visibleFields));
|
|
1761
|
-
for (; H >
|
|
1761
|
+
for (; H > ot && I.visibleLinks.length > 0; )
|
|
1762
1762
|
I.visibleLinks.pop(), H -= 80;
|
|
1763
|
-
return De(I.visibleText) >
|
|
1763
|
+
return De(I.visibleText) > ot && (I.visibleText = _e(I.visibleText, ot - 100)), I;
|
|
1764
1764
|
}
|
|
1765
1765
|
let $e = null;
|
|
1766
1766
|
function Gt(e, t = {}) {
|
|
@@ -1793,14 +1793,14 @@ function vr(e) {
|
|
|
1793
1793
|
const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), o = [], l = Array.from(t.querySelectorAll("a[href]"));
|
|
1794
1794
|
for (const c of l) {
|
|
1795
1795
|
if (o.length >= mr) break;
|
|
1796
|
-
if (
|
|
1796
|
+
if (wt(c)) continue;
|
|
1797
1797
|
const d = c.getAttribute("href") || "";
|
|
1798
1798
|
if (!yr(d)) continue;
|
|
1799
|
-
let f = d,
|
|
1799
|
+
let f = d, y = !0;
|
|
1800
1800
|
try {
|
|
1801
1801
|
if (typeof window < "u") {
|
|
1802
1802
|
const s = new URL(d, r);
|
|
1803
|
-
|
|
1803
|
+
y = s.origin === r, y && d.startsWith("http") && (f = s.pathname + s.search + s.hash);
|
|
1804
1804
|
}
|
|
1805
1805
|
} catch {
|
|
1806
1806
|
continue;
|
|
@@ -1808,13 +1808,13 @@ function vr(e) {
|
|
|
1808
1808
|
if (i.has(f)) continue;
|
|
1809
1809
|
i.add(f);
|
|
1810
1810
|
const b = (c.textContent || "").trim().slice(0, 120);
|
|
1811
|
-
o.push({ href: f, text: b, internal:
|
|
1811
|
+
o.push({ href: f, text: b, internal: y });
|
|
1812
1812
|
}
|
|
1813
1813
|
return o;
|
|
1814
1814
|
}
|
|
1815
1815
|
let ze = null;
|
|
1816
1816
|
const br = 5e3;
|
|
1817
|
-
function
|
|
1817
|
+
function gt() {
|
|
1818
1818
|
const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
|
|
1819
1819
|
if (ze && ze.pathname === t && e - ze.at < br)
|
|
1820
1820
|
return ze.routes;
|
|
@@ -1919,7 +1919,7 @@ function Ar(e) {
|
|
|
1919
1919
|
autoConnect: c = !1,
|
|
1920
1920
|
displayMode: d,
|
|
1921
1921
|
defaultDisplayMode: f = "expanded",
|
|
1922
|
-
onDisplayModeChange:
|
|
1922
|
+
onDisplayModeChange: y,
|
|
1923
1923
|
position: b = "bottom-right",
|
|
1924
1924
|
mobileBreakpoint: s = 640,
|
|
1925
1925
|
persistKey: a = "ll-widget",
|
|
@@ -1931,7 +1931,7 @@ function Ar(e) {
|
|
|
1931
1931
|
greeting: z,
|
|
1932
1932
|
avatarImageUrl: I,
|
|
1933
1933
|
agentName: H,
|
|
1934
|
-
branding:
|
|
1934
|
+
branding: m = {},
|
|
1935
1935
|
allowCamera: R = !0,
|
|
1936
1936
|
allowScreenShare: q = !0,
|
|
1937
1937
|
allowTyping: D = !0,
|
|
@@ -1941,11 +1941,11 @@ function Ar(e) {
|
|
|
1941
1941
|
onNavigate: J,
|
|
1942
1942
|
onScrollToSelector: ne,
|
|
1943
1943
|
getPageContext: ye,
|
|
1944
|
-
pageContextExtras:
|
|
1945
|
-
getRoutes:
|
|
1946
|
-
onScrollPage:
|
|
1947
|
-
onClick:
|
|
1948
|
-
capabilities:
|
|
1944
|
+
pageContextExtras: Ke,
|
|
1945
|
+
getRoutes: Xe,
|
|
1946
|
+
onScrollPage: Qe,
|
|
1947
|
+
onClick: Ze,
|
|
1948
|
+
capabilities: te,
|
|
1949
1949
|
onConnect: ae,
|
|
1950
1950
|
onDisconnect: ve,
|
|
1951
1951
|
onTranscript: xe,
|
|
@@ -1954,42 +1954,42 @@ function Ar(e) {
|
|
|
1954
1954
|
onAgentEvent: Se,
|
|
1955
1955
|
onAgentCommand: Ce,
|
|
1956
1956
|
controlledSession: V,
|
|
1957
|
-
className:
|
|
1958
|
-
style:
|
|
1959
|
-
zIndex:
|
|
1957
|
+
className: ct,
|
|
1958
|
+
style: dt,
|
|
1959
|
+
zIndex: et = 2147483647
|
|
1960
1960
|
} = e, ce = $n(W), Ee = Fn(ce, M, O);
|
|
1961
|
-
|
|
1961
|
+
N(() => {
|
|
1962
1962
|
hr(), wr();
|
|
1963
1963
|
}, [ce]);
|
|
1964
1964
|
const He = C !== void 0, [be, Ne] = S(() => {
|
|
1965
|
-
var
|
|
1966
|
-
return C ?? ((
|
|
1967
|
-
}), G = He ? C : be, Q =
|
|
1968
|
-
() => (E == null ? void 0 : E.find((
|
|
1965
|
+
var h;
|
|
1966
|
+
return C ?? ((h = E == null ? void 0 : E[0]) == null ? void 0 : h.id);
|
|
1967
|
+
}), G = He ? C : be, Q = lt(
|
|
1968
|
+
() => (E == null ? void 0 : E.find((h) => h.id === G)) ?? null,
|
|
1969
1969
|
[E, G]
|
|
1970
1970
|
), Ae = (Q == null ? void 0 : Q.agentId) ?? t, [re, se] = In({
|
|
1971
1971
|
value: d,
|
|
1972
1972
|
defaultValue: f,
|
|
1973
|
-
onChange:
|
|
1973
|
+
onChange: y,
|
|
1974
1974
|
persistKey: a,
|
|
1975
1975
|
disablePersistence: k
|
|
1976
|
-
}), we = Pn(s), Oe = wn(),
|
|
1977
|
-
Fe.current = J, Ie.current = ne, p.current =
|
|
1978
|
-
function me(
|
|
1979
|
-
const u =
|
|
1980
|
-
return u ? u.includes(
|
|
1976
|
+
}), we = Pn(s), Oe = wn(), ee = _n(), ie = kn(), oe = Ln(), de = Sn(), [Re, ue] = S(!1), [fe, Be] = S(!1), [qe, We] = S(!1), [pe, he] = S(!1), [Me, tt] = S(!1), Fe = A(J), Ie = A(ne), p = A(Qe), Y = A(Ze), ut = A(ye), _t = A(Ke), xt = A(Xe), ft = A(te), le = A(null);
|
|
1977
|
+
Fe.current = J, Ie.current = ne, p.current = Qe, Y.current = Ze, ut.current = ye, _t.current = Ke, xt.current = Xe, ft.current = te;
|
|
1978
|
+
function me(h) {
|
|
1979
|
+
const u = ft.current;
|
|
1980
|
+
return u ? u.includes(h) : !0;
|
|
1981
1981
|
}
|
|
1982
|
-
function ge(
|
|
1982
|
+
function ge(h, u) {
|
|
1983
1983
|
console.warn(
|
|
1984
|
-
`[LiveLayer] Agent command "${
|
|
1984
|
+
`[LiveLayer] Agent command "${h}" blocked — capability "${u}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
|
|
1985
1985
|
);
|
|
1986
1986
|
}
|
|
1987
1987
|
const Ue = L(
|
|
1988
|
-
(
|
|
1989
|
-
var K, Te,
|
|
1990
|
-
const u =
|
|
1988
|
+
(h) => {
|
|
1989
|
+
var K, Te, rt, Tt;
|
|
1990
|
+
const u = h;
|
|
1991
1991
|
if (!(!u.type || typeof u.type != "string")) {
|
|
1992
|
-
if (Se == null || Se({ eventName: u.type, data:
|
|
1992
|
+
if (Se == null || Se({ eventName: u.type, data: h }), u.type === "navigate") {
|
|
1993
1993
|
if (!me("navigate")) {
|
|
1994
1994
|
ge("navigate", "navigate");
|
|
1995
1995
|
return;
|
|
@@ -2088,7 +2088,7 @@ function Ar(e) {
|
|
|
2088
2088
|
} catch (Z) {
|
|
2089
2089
|
console.warn("[LiveLayer] publishData failed.", Z);
|
|
2090
2090
|
}
|
|
2091
|
-
}, $ =
|
|
2091
|
+
}, $ = _t.current, F = ut.current;
|
|
2092
2092
|
try {
|
|
2093
2093
|
if (F) {
|
|
2094
2094
|
const j = F($);
|
|
@@ -2237,7 +2237,7 @@ function Ar(e) {
|
|
|
2237
2237
|
);
|
|
2238
2238
|
return;
|
|
2239
2239
|
}
|
|
2240
|
-
if (!
|
|
2240
|
+
if (!st(F)) {
|
|
2241
2241
|
console.warn(
|
|
2242
2242
|
`[LiveLayer] focus_field: field "${$}" is privacy-protected and not focusable.`
|
|
2243
2243
|
);
|
|
@@ -2260,7 +2260,7 @@ function Ar(e) {
|
|
|
2260
2260
|
);
|
|
2261
2261
|
continue;
|
|
2262
2262
|
}
|
|
2263
|
-
if (!
|
|
2263
|
+
if (!st(j)) {
|
|
2264
2264
|
console.warn(
|
|
2265
2265
|
`[LiveLayer] fill_form: field "${$}" is privacy-protected (password / cc-* / private). Skipping.`
|
|
2266
2266
|
);
|
|
@@ -2303,7 +2303,7 @@ function Ar(e) {
|
|
|
2303
2303
|
);
|
|
2304
2304
|
return;
|
|
2305
2305
|
}
|
|
2306
|
-
const B = typeof u.requestId == "string" ? u.requestId : void 0, $ = (
|
|
2306
|
+
const B = typeof u.requestId == "string" ? u.requestId : void 0, $ = (rt = le.current) == null ? void 0 : rt.call(le), F = (X) => {
|
|
2307
2307
|
const Z = $, Pe = Z == null ? void 0 : Z.localParticipant;
|
|
2308
2308
|
if (Pe != null && Pe.publishData)
|
|
2309
2309
|
try {
|
|
@@ -2350,7 +2350,7 @@ function Ar(e) {
|
|
|
2350
2350
|
} catch (X) {
|
|
2351
2351
|
console.warn("[LiveLayer] request_routes: publishData failed.", X);
|
|
2352
2352
|
}
|
|
2353
|
-
}, j =
|
|
2353
|
+
}, j = xt.current;
|
|
2354
2354
|
if (j) {
|
|
2355
2355
|
try {
|
|
2356
2356
|
const P = j(), X = (Z) => {
|
|
@@ -2364,18 +2364,18 @@ function Ar(e) {
|
|
|
2364
2364
|
console.warn(
|
|
2365
2365
|
"[LiveLayer] getRoutes rejected; falling back to DOM walker.",
|
|
2366
2366
|
Z
|
|
2367
|
-
), F(
|
|
2367
|
+
), F(gt());
|
|
2368
2368
|
}) : X(P);
|
|
2369
2369
|
} catch (P) {
|
|
2370
2370
|
console.warn(
|
|
2371
2371
|
"[LiveLayer] getRoutes threw; falling back to DOM walker.",
|
|
2372
2372
|
P
|
|
2373
|
-
), F(
|
|
2373
|
+
), F(gt());
|
|
2374
2374
|
}
|
|
2375
2375
|
return;
|
|
2376
2376
|
}
|
|
2377
2377
|
try {
|
|
2378
|
-
F(
|
|
2378
|
+
F(gt());
|
|
2379
2379
|
} catch (P) {
|
|
2380
2380
|
console.warn("[LiveLayer] request_routes: extractRoutes threw.", P);
|
|
2381
2381
|
}
|
|
@@ -2393,16 +2393,16 @@ function Ar(e) {
|
|
|
2393
2393
|
sessionBody: l,
|
|
2394
2394
|
onDataMessage: V ? void 0 : Ue
|
|
2395
2395
|
});
|
|
2396
|
-
|
|
2396
|
+
N(() => {
|
|
2397
2397
|
if (V != null && V.subscribeToDataMessages)
|
|
2398
2398
|
return V.subscribeToDataMessages(Ue);
|
|
2399
2399
|
}, [V, Ue]), le.current = () => {
|
|
2400
|
-
var
|
|
2401
|
-
return (
|
|
2402
|
-
},
|
|
2400
|
+
var h;
|
|
2401
|
+
return (h = U.getRoom) == null ? void 0 : h.call(U);
|
|
2402
|
+
}, N(() => {
|
|
2403
2403
|
var K;
|
|
2404
2404
|
if (!ce) return;
|
|
2405
|
-
const
|
|
2405
|
+
const h = (K = U.getRoom) == null ? void 0 : K.call(U), u = h == null ? void 0 : h.localParticipant;
|
|
2406
2406
|
if (u != null && u.publishData)
|
|
2407
2407
|
try {
|
|
2408
2408
|
const Te = new TextEncoder().encode(
|
|
@@ -2411,22 +2411,22 @@ function Ar(e) {
|
|
|
2411
2411
|
u.publishData(Te, { reliable: !0 });
|
|
2412
2412
|
} catch {
|
|
2413
2413
|
}
|
|
2414
|
-
}, [ce, U, U.connectionState]),
|
|
2414
|
+
}, [ce, U, U.connectionState]), N(() => {
|
|
2415
2415
|
var K;
|
|
2416
2416
|
if (typeof window > "u") return;
|
|
2417
|
-
const
|
|
2418
|
-
if (
|
|
2417
|
+
const h = ((K = window.location) == null ? void 0 : K.hostname) || "";
|
|
2418
|
+
if (h === "localhost" || h === "127.0.0.1" || h === "0.0.0.0" || h.endsWith(".local") || h.endsWith(".test"))
|
|
2419
2419
|
return window.__livelayerSimulateCommand = (Te) => {
|
|
2420
2420
|
try {
|
|
2421
2421
|
Ue(Te);
|
|
2422
|
-
} catch (
|
|
2423
|
-
console.warn("[LiveLayer] simulate-command threw:",
|
|
2422
|
+
} catch (rt) {
|
|
2423
|
+
console.warn("[LiveLayer] simulate-command threw:", rt);
|
|
2424
2424
|
}
|
|
2425
2425
|
}, () => {
|
|
2426
2426
|
delete window.__livelayerSimulateCommand;
|
|
2427
2427
|
};
|
|
2428
2428
|
}, [Ue]);
|
|
2429
|
-
const
|
|
2429
|
+
const g = lt(() => V ? {
|
|
2430
2430
|
connectionState: V.connectionState,
|
|
2431
2431
|
agentState: V.agentState,
|
|
2432
2432
|
transcript: V.transcript,
|
|
@@ -2457,118 +2457,124 @@ function Ar(e) {
|
|
|
2457
2457
|
disconnect: U.disconnect,
|
|
2458
2458
|
getRoom: U.getRoom,
|
|
2459
2459
|
isControlled: !1
|
|
2460
|
-
}, [V, U]),
|
|
2461
|
-
|
|
2462
|
-
const
|
|
2463
|
-
if (!(!
|
|
2464
|
-
return u.appendChild(
|
|
2465
|
-
|
|
2460
|
+
}, [V, U]), kt = A(null);
|
|
2461
|
+
N(() => {
|
|
2462
|
+
const h = g.videoElement, u = kt.current;
|
|
2463
|
+
if (!(!h || !u))
|
|
2464
|
+
return u.appendChild(h), () => {
|
|
2465
|
+
h.parentNode === u && u.removeChild(h);
|
|
2466
2466
|
};
|
|
2467
|
-
}, [
|
|
2468
|
-
const
|
|
2469
|
-
if (!
|
|
2470
|
-
Oe.attach(
|
|
2471
|
-
const u =
|
|
2467
|
+
}, [g.videoElement]), N(() => {
|
|
2468
|
+
const h = g.audioElement;
|
|
2469
|
+
if (!h) return;
|
|
2470
|
+
Oe.attach(h);
|
|
2471
|
+
const u = h.play();
|
|
2472
2472
|
return u && typeof u.catch == "function" && u.catch((K) => {
|
|
2473
2473
|
(K == null ? void 0 : K.name) === "NotAllowedError" && ue(!0);
|
|
2474
2474
|
}), () => {
|
|
2475
2475
|
Oe.detach();
|
|
2476
2476
|
};
|
|
2477
|
-
}, [
|
|
2478
|
-
if (
|
|
2479
|
-
const
|
|
2480
|
-
if (
|
|
2481
|
-
return
|
|
2482
|
-
}), ie.attachRoom(
|
|
2483
|
-
|
|
2477
|
+
}, [g.audioElement]), N(() => {
|
|
2478
|
+
if (g.isControlled || g.connectionState !== "connected") return;
|
|
2479
|
+
const h = g.getRoom();
|
|
2480
|
+
if (h)
|
|
2481
|
+
return ee.setupMic(h, { startMuted: !0 }).catch(() => {
|
|
2482
|
+
}), ie.attachRoom(h), oe.attachRoom(h), de.refresh(), () => {
|
|
2483
|
+
ee.teardownMic(), ie.teardown(), oe.teardown();
|
|
2484
2484
|
};
|
|
2485
|
-
}, [
|
|
2486
|
-
const [
|
|
2487
|
-
|
|
2488
|
-
if (
|
|
2489
|
-
|
|
2485
|
+
}, [g.isControlled, g.connectionState]);
|
|
2486
|
+
const [je, pt] = S(!1), ht = A("idle");
|
|
2487
|
+
N(() => {
|
|
2488
|
+
if (g.connectionState === "idle" || g.connectionState === "disconnected") {
|
|
2489
|
+
pt(!1), ht.current = "idle";
|
|
2490
2490
|
return;
|
|
2491
2491
|
}
|
|
2492
|
-
!
|
|
2493
|
-
}, [
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2492
|
+
!je && ht.current === "speaking" && g.agentState !== "speaking" && (pt(!0), ee.setMuted(!1)), ht.current = g.agentState;
|
|
2493
|
+
}, [g.agentState, g.connectionState, je]), N(() => {
|
|
2494
|
+
if (g.connectionState !== "connected" || je) return;
|
|
2495
|
+
const h = setTimeout(() => {
|
|
2496
|
+
pt(!0), ee.setMuted(!1);
|
|
2497
|
+
}, 4e3);
|
|
2498
|
+
return () => clearTimeout(h);
|
|
2499
|
+
}, [g.connectionState, je]), N(() => {
|
|
2500
|
+
const h = g.audioElement;
|
|
2501
|
+
h && (h.muted = Me);
|
|
2502
|
+
}, [g.audioElement, Me]);
|
|
2503
|
+
const Zt = L((h) => {
|
|
2504
|
+
const u = g.getRoom();
|
|
2499
2505
|
if (u)
|
|
2500
2506
|
try {
|
|
2501
2507
|
const K = new TextEncoder().encode(
|
|
2502
|
-
JSON.stringify({ type: "user_message", text:
|
|
2508
|
+
JSON.stringify({ type: "user_message", text: h })
|
|
2503
2509
|
);
|
|
2504
2510
|
u.localParticipant.publishData(K, { reliable: !0 });
|
|
2505
2511
|
} catch {
|
|
2506
2512
|
}
|
|
2507
|
-
}, [
|
|
2508
|
-
|
|
2513
|
+
}, [g]), en = L(() => {
|
|
2514
|
+
tt((h) => !h);
|
|
2509
2515
|
}, []);
|
|
2510
|
-
|
|
2511
|
-
Le == null || Le(
|
|
2512
|
-
}, [
|
|
2513
|
-
xe == null || xe(
|
|
2514
|
-
}, [
|
|
2515
|
-
ke == null || ke(
|
|
2516
|
-
}, [
|
|
2517
|
-
const Lt =
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
}, [c,
|
|
2516
|
+
N(() => {
|
|
2517
|
+
Le == null || Le(g.connectionState), g.connectionState === "connected" ? ae == null || ae() : g.connectionState === "disconnected" && (ve == null || ve());
|
|
2518
|
+
}, [g.connectionState, ae, ve, Le]), N(() => {
|
|
2519
|
+
xe == null || xe(g.transcript);
|
|
2520
|
+
}, [g.transcript, xe]), N(() => {
|
|
2521
|
+
ke == null || ke(g.agentState);
|
|
2522
|
+
}, [g.agentState, ke]);
|
|
2523
|
+
const Lt = A(!1);
|
|
2524
|
+
N(() => {
|
|
2525
|
+
g.isControlled || !c || Lt.current || Ee && g.connectionState === "idle" && (Lt.current = !0, g.connect());
|
|
2526
|
+
}, [c, g.connectionState, g, Ee]);
|
|
2521
2527
|
const tn = L(
|
|
2522
|
-
(
|
|
2523
|
-
const u = E == null ? void 0 : E.find((K) => K.id ===
|
|
2524
|
-
u && (We(!1),
|
|
2528
|
+
(h) => {
|
|
2529
|
+
const u = E == null ? void 0 : E.find((K) => K.id === h);
|
|
2530
|
+
u && (We(!1), h !== G && (Be(!0), g.disconnect(), He || Ne(h), v == null || v(u)));
|
|
2525
2531
|
},
|
|
2526
2532
|
[
|
|
2527
2533
|
E,
|
|
2528
2534
|
G,
|
|
2529
|
-
|
|
2535
|
+
g,
|
|
2530
2536
|
He,
|
|
2531
2537
|
v
|
|
2532
2538
|
]
|
|
2533
2539
|
);
|
|
2534
|
-
|
|
2535
|
-
fe &&
|
|
2536
|
-
}, [
|
|
2540
|
+
N(() => {
|
|
2541
|
+
fe && g.connectionState === "connected" && Be(!1);
|
|
2542
|
+
}, [g.connectionState, fe]), N(() => {
|
|
2537
2543
|
if (!qe) return;
|
|
2538
|
-
const
|
|
2544
|
+
const h = (u) => {
|
|
2539
2545
|
u.key === "Escape" && We(!1);
|
|
2540
2546
|
};
|
|
2541
|
-
return window.addEventListener("keydown",
|
|
2547
|
+
return window.addEventListener("keydown", h), () => window.removeEventListener("keydown", h);
|
|
2542
2548
|
}, [qe]);
|
|
2543
|
-
const nn = !!I || !!(Q != null && Q.avatarImageUrl) ||
|
|
2544
|
-
|
|
2545
|
-
const
|
|
2549
|
+
const nn = !!I || !!(Q != null && Q.avatarImageUrl) || g.isControlled, Ve = Cn(Ae, i, nn);
|
|
2550
|
+
te === void 0 && ((Ct = Ve.info) != null && Ct.capabilities) && (ft.current = Ve.info.capabilities);
|
|
2551
|
+
const nt = (Q == null ? void 0 : Q.name) ?? H ?? ((Et = g.agentConfig) == null ? void 0 : Et.name) ?? ((Nt = Ve.info) == null ? void 0 : Nt.name) ?? "Live Layer", mt = (Q == null ? void 0 : Q.avatarImageUrl) ?? I ?? ((At = g.agentConfig) == null ? void 0 : At.avatarImageUrl) ?? ((Rt = Ve.info) == null ? void 0 : Rt.avatarImageUrl) ?? null, rn = w ?? ((Mt = g.agentConfig) == null ? void 0 : Mt.idleLoopUrl) ?? ((It = Ve.info) == null ? void 0 : It.idleLoopUrl) ?? null, on = z ?? null, ln = L(() => se("expanded"), [se]), an = L(
|
|
2546
2552
|
() => se("minimized"),
|
|
2547
2553
|
[se]
|
|
2548
2554
|
), St = L(() => {
|
|
2549
|
-
|
|
2550
|
-
}, [
|
|
2551
|
-
const
|
|
2552
|
-
|
|
2555
|
+
g.disconnect(), se("hidden");
|
|
2556
|
+
}, [g, se]), sn = L(() => {
|
|
2557
|
+
const h = g.audioElement;
|
|
2558
|
+
h && h.play().then(() => ue(!1)).catch(() => {
|
|
2553
2559
|
});
|
|
2554
|
-
}, [
|
|
2555
|
-
ue(!1),
|
|
2556
|
-
}, [
|
|
2557
|
-
...
|
|
2558
|
-
zIndex:
|
|
2560
|
+
}, [g.audioElement]), cn = L(() => {
|
|
2561
|
+
ue(!1), g.connect();
|
|
2562
|
+
}, [g]), Ye = {
|
|
2563
|
+
...dt,
|
|
2564
|
+
zIndex: et
|
|
2559
2565
|
};
|
|
2560
|
-
|
|
2566
|
+
m.primaryColor && (Ye["--ll-color-primary"] = m.primaryColor), m.accentColor && (Ye["--ll-color-accent"] = m.accentColor), m.backgroundColor && (Ye["--ll-color-bg"] = m.backgroundColor), m.textColor && (Ye["--ll-color-fg"] = m.textColor);
|
|
2561
2567
|
const dn = [
|
|
2562
2568
|
"ll-widget",
|
|
2563
2569
|
`ll-widget--${re}`,
|
|
2564
2570
|
`ll-widget--${we ? "mobile" : "desktop"}`,
|
|
2565
|
-
|
|
2571
|
+
ct
|
|
2566
2572
|
].filter(Boolean).join(" ");
|
|
2567
2573
|
return Ee ? /* @__PURE__ */ _(
|
|
2568
2574
|
"div",
|
|
2569
2575
|
{
|
|
2570
2576
|
className: dn,
|
|
2571
|
-
style:
|
|
2577
|
+
style: Ye,
|
|
2572
2578
|
"data-display-mode": re,
|
|
2573
2579
|
"data-position": b,
|
|
2574
2580
|
children: [
|
|
@@ -2577,11 +2583,11 @@ function Ar(e) {
|
|
|
2577
2583
|
{
|
|
2578
2584
|
position: b,
|
|
2579
2585
|
isMobile: we,
|
|
2580
|
-
isSpeaking:
|
|
2586
|
+
isSpeaking: g.agentState === "speaking",
|
|
2581
2587
|
onExpand: () => se("expanded"),
|
|
2582
|
-
label: `Open ${
|
|
2583
|
-
avatarImageUrl:
|
|
2584
|
-
agentName:
|
|
2588
|
+
label: `Open ${nt} widget`,
|
|
2589
|
+
avatarImageUrl: mt,
|
|
2590
|
+
agentName: nt
|
|
2585
2591
|
}
|
|
2586
2592
|
),
|
|
2587
2593
|
re === "minimized" && /* @__PURE__ */ n(
|
|
@@ -2589,13 +2595,13 @@ function Ar(e) {
|
|
|
2589
2595
|
{
|
|
2590
2596
|
position: b,
|
|
2591
2597
|
isMobile: we,
|
|
2592
|
-
agentName:
|
|
2593
|
-
avatarImageUrl:
|
|
2594
|
-
agentState:
|
|
2595
|
-
isMuted:
|
|
2598
|
+
agentName: nt,
|
|
2599
|
+
avatarImageUrl: mt,
|
|
2600
|
+
agentState: g.agentState,
|
|
2601
|
+
isMuted: ee.isMuted,
|
|
2596
2602
|
audioLevel: Oe,
|
|
2597
2603
|
onExpand: ln,
|
|
2598
|
-
onToggleMute:
|
|
2604
|
+
onToggleMute: ee.toggleMute,
|
|
2599
2605
|
onClose: St
|
|
2600
2606
|
}
|
|
2601
2607
|
),
|
|
@@ -2604,21 +2610,21 @@ function Ar(e) {
|
|
|
2604
2610
|
{
|
|
2605
2611
|
position: b,
|
|
2606
2612
|
isMobile: we,
|
|
2607
|
-
agentName:
|
|
2608
|
-
avatarImageUrl:
|
|
2613
|
+
agentName: nt,
|
|
2614
|
+
avatarImageUrl: mt,
|
|
2609
2615
|
idleLoopUrl: rn,
|
|
2610
2616
|
greeting: on,
|
|
2611
|
-
branding:
|
|
2617
|
+
branding: m,
|
|
2612
2618
|
teamMembers: E,
|
|
2613
2619
|
currentTeamMemberId: G,
|
|
2614
2620
|
isSwitchingTeamMember: fe,
|
|
2615
2621
|
teamSwitcherOpen: qe,
|
|
2616
|
-
onToggleTeamSwitcher: () => We((
|
|
2622
|
+
onToggleTeamSwitcher: () => We((h) => !h),
|
|
2617
2623
|
onSelectTeamMember: tn,
|
|
2618
|
-
connectionState:
|
|
2619
|
-
agentState:
|
|
2620
|
-
transcript:
|
|
2621
|
-
isMuted:
|
|
2624
|
+
connectionState: g.connectionState,
|
|
2625
|
+
agentState: g.agentState,
|
|
2626
|
+
transcript: g.transcript,
|
|
2627
|
+
isMuted: ee.isMuted,
|
|
2622
2628
|
micDevices: de.mics,
|
|
2623
2629
|
isCameraEnabled: ie.isEnabled,
|
|
2624
2630
|
cameraPreviewEl: ie.previewEl,
|
|
@@ -2631,27 +2637,27 @@ function Ar(e) {
|
|
|
2631
2637
|
allowScreenShare: q,
|
|
2632
2638
|
allowTyping: D,
|
|
2633
2639
|
languageMenuOpen: pe,
|
|
2634
|
-
onToggleLanguageMenu: () => he((
|
|
2640
|
+
onToggleLanguageMenu: () => he((h) => !h),
|
|
2635
2641
|
needsUserGesture: Re,
|
|
2636
|
-
canResume:
|
|
2637
|
-
micError:
|
|
2638
|
-
error:
|
|
2639
|
-
avatarVideoContainerRef:
|
|
2640
|
-
agentVideoEl:
|
|
2641
|
-
micGateOpen:
|
|
2642
|
-
onConnect: () => void
|
|
2643
|
-
onDisconnect: () =>
|
|
2642
|
+
canResume: g.canResume,
|
|
2643
|
+
micError: ee.micError,
|
|
2644
|
+
error: g.error,
|
|
2645
|
+
avatarVideoContainerRef: kt,
|
|
2646
|
+
agentVideoEl: g.videoElement,
|
|
2647
|
+
micGateOpen: g.isControlled ? !0 : je,
|
|
2648
|
+
onConnect: () => void g.connect(),
|
|
2649
|
+
onDisconnect: () => g.disconnect(),
|
|
2644
2650
|
onRetry: cn,
|
|
2645
2651
|
onResumeAudio: sn,
|
|
2646
|
-
onToggleMute:
|
|
2652
|
+
onToggleMute: ee.toggleMute,
|
|
2647
2653
|
onToggleCamera: () => void ie.toggle(),
|
|
2648
|
-
onSwitchCameraDevice: (
|
|
2654
|
+
onSwitchCameraDevice: (h) => void ie.switchDevice(h),
|
|
2649
2655
|
onToggleScreenShare: () => void oe.toggle(),
|
|
2650
2656
|
onToggleSpeaker: en,
|
|
2651
2657
|
onSendMessage: Zt,
|
|
2652
2658
|
onMinimize: an,
|
|
2653
2659
|
onClose: St,
|
|
2654
|
-
onClearMicError:
|
|
2660
|
+
onClearMicError: ee.clearError
|
|
2655
2661
|
}
|
|
2656
2662
|
)
|
|
2657
2663
|
]
|
|
@@ -2670,24 +2676,24 @@ const Hr = ({
|
|
|
2670
2676
|
className: l,
|
|
2671
2677
|
style: c
|
|
2672
2678
|
}) => {
|
|
2673
|
-
const d =
|
|
2674
|
-
|
|
2679
|
+
const d = A(null), f = A(null), y = A(o);
|
|
2680
|
+
y.current = o;
|
|
2675
2681
|
const b = L((s) => {
|
|
2676
2682
|
var k;
|
|
2677
2683
|
const a = s.detail;
|
|
2678
|
-
(k =
|
|
2684
|
+
(k = y.current) == null || k.call(y, a);
|
|
2679
2685
|
}, []);
|
|
2680
|
-
return
|
|
2686
|
+
return N(() => {
|
|
2681
2687
|
const s = d.current;
|
|
2682
2688
|
if (!s) return;
|
|
2683
2689
|
const a = document.createElement("livelayer-widget");
|
|
2684
2690
|
return a.setAttribute("agent-id", e), t && a.setAttribute("base-url", t), r && a.setAttribute("api-key", r), i && a.setAttribute("mode", i), a.addEventListener("agent-event", b), s.appendChild(a), f.current = a, () => {
|
|
2685
2691
|
a.removeEventListener("agent-event", b), s.removeChild(a), f.current = null;
|
|
2686
2692
|
};
|
|
2687
|
-
}, [e]),
|
|
2693
|
+
}, [e]), N(() => {
|
|
2688
2694
|
f.current && (i ? f.current.setAttribute("mode", i) : f.current.removeAttribute("mode"));
|
|
2689
2695
|
}, [i]), /* @__PURE__ */ n("div", { ref: d, className: l, style: c });
|
|
2690
|
-
}, Or =
|
|
2696
|
+
}, Or = bt(
|
|
2691
2697
|
function({ id: t, intent: r, as: i = "div", className: o, style: l, children: c }, d) {
|
|
2692
2698
|
return hn(
|
|
2693
2699
|
i,
|
|
@@ -2701,7 +2707,7 @@ const Hr = ({
|
|
|
2701
2707
|
c
|
|
2702
2708
|
);
|
|
2703
2709
|
}
|
|
2704
|
-
), Br =
|
|
2710
|
+
), Br = bt(
|
|
2705
2711
|
function({ id: t, intent: r, children: i, ...o }, l) {
|
|
2706
2712
|
return /* @__PURE__ */ n(
|
|
2707
2713
|
"form",
|
|
@@ -2714,12 +2720,12 @@ const Hr = ({
|
|
|
2714
2720
|
}
|
|
2715
2721
|
);
|
|
2716
2722
|
}
|
|
2717
|
-
), qr =
|
|
2723
|
+
), qr = bt(
|
|
2718
2724
|
function(t, r) {
|
|
2719
2725
|
const { name: i, label: o, labelClassName: l } = t, c = { name: i, "data-ll-field": i };
|
|
2720
2726
|
let d;
|
|
2721
2727
|
if ("as" in t && t.as === "textarea") {
|
|
2722
|
-
const { name: f, label:
|
|
2728
|
+
const { name: f, label: y, labelClassName: b, as: s, ...a } = t;
|
|
2723
2729
|
d = /* @__PURE__ */ n(
|
|
2724
2730
|
"textarea",
|
|
2725
2731
|
{
|
|
@@ -2729,7 +2735,7 @@ const Hr = ({
|
|
|
2729
2735
|
}
|
|
2730
2736
|
);
|
|
2731
2737
|
} else if ("as" in t && t.as === "select") {
|
|
2732
|
-
const { name: f, label:
|
|
2738
|
+
const { name: f, label: y, labelClassName: b, as: s, children: a, ...k } = t;
|
|
2733
2739
|
d = /* @__PURE__ */ n(
|
|
2734
2740
|
"select",
|
|
2735
2741
|
{
|
|
@@ -2740,7 +2746,7 @@ const Hr = ({
|
|
|
2740
2746
|
}
|
|
2741
2747
|
);
|
|
2742
2748
|
} else {
|
|
2743
|
-
const { name: f, label:
|
|
2749
|
+
const { name: f, label: y, labelClassName: b, as: s, ...a } = t;
|
|
2744
2750
|
d = /* @__PURE__ */ n(
|
|
2745
2751
|
"input",
|
|
2746
2752
|
{
|
|
@@ -2762,24 +2768,24 @@ function Wr({
|
|
|
2762
2768
|
defaultOpen: t = !1,
|
|
2763
2769
|
storageKey: r = "ll-debug-open"
|
|
2764
2770
|
}) {
|
|
2765
|
-
const [i, o] = S(t), [l, c] = S([]), [d, f] = S(""), [
|
|
2766
|
-
k.current =
|
|
2771
|
+
const [i, o] = S(t), [l, c] = S([]), [d, f] = S(""), [y, b] = S(!1), s = A(/* @__PURE__ */ new Set()), a = A([]), k = A(y);
|
|
2772
|
+
k.current = y, N(() => {
|
|
2767
2773
|
try {
|
|
2768
2774
|
const v = localStorage.getItem(r);
|
|
2769
2775
|
v === "1" && o(!0), v === "0" && o(!1);
|
|
2770
2776
|
} catch {
|
|
2771
2777
|
}
|
|
2772
|
-
}, [r]),
|
|
2778
|
+
}, [r]), N(() => {
|
|
2773
2779
|
try {
|
|
2774
2780
|
localStorage.setItem(r, i ? "1" : "0");
|
|
2775
2781
|
} catch {
|
|
2776
2782
|
}
|
|
2777
|
-
}, [i, r]),
|
|
2783
|
+
}, [i, r]), N(() => {
|
|
2778
2784
|
const v = (w) => {
|
|
2779
2785
|
(w.metaKey || w.ctrlKey) && w.shiftKey && w.key.toLowerCase() === "l" && (w.preventDefault(), o((z) => !z));
|
|
2780
2786
|
};
|
|
2781
2787
|
return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
|
|
2782
|
-
}, []),
|
|
2788
|
+
}, []), N(() => {
|
|
2783
2789
|
const v = setInterval(() => {
|
|
2784
2790
|
if (a.current.length === 0 || k.current) return;
|
|
2785
2791
|
const w = a.current.splice(0, a.current.length);
|
|
@@ -2789,8 +2795,8 @@ function Wr({
|
|
|
2789
2795
|
}, 100);
|
|
2790
2796
|
return () => clearInterval(v);
|
|
2791
2797
|
}, []);
|
|
2792
|
-
const E =
|
|
2793
|
-
if (
|
|
2798
|
+
const E = A(!1);
|
|
2799
|
+
if (N(() => {
|
|
2794
2800
|
!e || E.current || (E.current = !0, e((v) => {
|
|
2795
2801
|
a.current.push({
|
|
2796
2802
|
id: Kt++,
|
|
@@ -2800,20 +2806,20 @@ function Wr({
|
|
|
2800
2806
|
data: v.data
|
|
2801
2807
|
});
|
|
2802
2808
|
}));
|
|
2803
|
-
}, [e]),
|
|
2804
|
-
const v = console.warn, w = console.log, z = (I, H) => function(...
|
|
2809
|
+
}, [e]), N(() => {
|
|
2810
|
+
const v = console.warn, w = console.log, z = (I, H) => function(...m) {
|
|
2805
2811
|
try {
|
|
2806
|
-
const R = typeof
|
|
2812
|
+
const R = typeof m[0] == "string" ? m[0] : "";
|
|
2807
2813
|
R.startsWith("[LiveLayer]") && a.current.push({
|
|
2808
2814
|
id: Kt++,
|
|
2809
2815
|
ts: Date.now(),
|
|
2810
2816
|
kind: I,
|
|
2811
2817
|
type: R.slice(0, 120),
|
|
2812
|
-
data: { args:
|
|
2818
|
+
data: { args: m.slice(1).map((q) => Mr(q)) }
|
|
2813
2819
|
});
|
|
2814
2820
|
} catch {
|
|
2815
2821
|
}
|
|
2816
|
-
return H.apply(this,
|
|
2822
|
+
return H.apply(this, m);
|
|
2817
2823
|
};
|
|
2818
2824
|
return console.warn = z("warn", v), console.log = z("log", w), () => {
|
|
2819
2825
|
console.warn = v, console.log = w;
|
|
@@ -2896,9 +2902,9 @@ function Wr({
|
|
|
2896
2902
|
{
|
|
2897
2903
|
type: "button",
|
|
2898
2904
|
onClick: () => b((v) => !v),
|
|
2899
|
-
style:
|
|
2905
|
+
style: yt(y ? "#f59e0b" : "transparent"),
|
|
2900
2906
|
title: "Pause / resume capture",
|
|
2901
|
-
children:
|
|
2907
|
+
children: y ? "▶ resume" : "⏸ pause"
|
|
2902
2908
|
}
|
|
2903
2909
|
),
|
|
2904
2910
|
/* @__PURE__ */ n(
|
|
@@ -2908,7 +2914,7 @@ function Wr({
|
|
|
2908
2914
|
onClick: () => {
|
|
2909
2915
|
c([]), a.current = [];
|
|
2910
2916
|
},
|
|
2911
|
-
style:
|
|
2917
|
+
style: yt("transparent"),
|
|
2912
2918
|
title: "Clear buffer",
|
|
2913
2919
|
children: "clear"
|
|
2914
2920
|
}
|
|
@@ -2918,7 +2924,7 @@ function Wr({
|
|
|
2918
2924
|
{
|
|
2919
2925
|
type: "button",
|
|
2920
2926
|
onClick: () => o(!1),
|
|
2921
|
-
style:
|
|
2927
|
+
style: yt("transparent"),
|
|
2922
2928
|
"aria-label": "Close",
|
|
2923
2929
|
title: "Close (Cmd/Ctrl + Shift + L)",
|
|
2924
2930
|
children: "✕"
|
|
@@ -3071,7 +3077,7 @@ function Rr({
|
|
|
3071
3077
|
}
|
|
3072
3078
|
);
|
|
3073
3079
|
}
|
|
3074
|
-
function
|
|
3080
|
+
function yt(e) {
|
|
3075
3081
|
return {
|
|
3076
3082
|
background: e,
|
|
3077
3083
|
color: "#fff",
|
|
@@ -3120,7 +3126,7 @@ export {
|
|
|
3120
3126
|
pr as extractPageContext,
|
|
3121
3127
|
vr as extractRoutes,
|
|
3122
3128
|
Gt as getCachedPageContext,
|
|
3123
|
-
|
|
3129
|
+
gt as getCachedRoutes,
|
|
3124
3130
|
qn as matchesPattern,
|
|
3125
3131
|
gr as normalizeRouteInput,
|
|
3126
3132
|
Wn as shouldRenderAtPath,
|