@livelayer/react 0.23.1 → 0.23.2
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 +465 -458
- package/dist/styles.css +14 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as S, jsx as r, Fragment as Ve } from "react/jsx-runtime";
|
|
3
|
-
import { Component as Sr, useState as M, useRef as T, useEffect as I, useCallback as
|
|
4
|
-
import { createPortal as
|
|
3
|
+
import { Component as Sr, useState as M, useRef as T, useEffect as I, useCallback as C, useMemo as at, useLayoutEffect as Qn, forwardRef as rn, useImperativeHandle as Er, createElement as Ar } from "react";
|
|
4
|
+
import { createPortal as on } from "react-dom";
|
|
5
5
|
import { LiveKitSession as Nr, registerFields as Mr } from "@livelayer/sdk";
|
|
6
6
|
import { clearFieldRegistry as Bo, getRegisteredFields as Wo, registerFields as qo, setFieldValue as Uo } from "@livelayer/sdk";
|
|
7
7
|
import { createLocalAudioTrack as Ir, Track as er, createLocalVideoTrack as Tr } from "livekit-client";
|
|
@@ -36,7 +36,7 @@ class Rr extends Sr {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
function Dr(e) {
|
|
39
|
-
const [t, n] = M("idle"), [i, l] = M("idle"), [o, s] = M([]), [a, c] = M(null), [u, m] = M(null), [p, h] = M(null), [P, _] = M(!1), [
|
|
39
|
+
const [t, n] = M("idle"), [i, l] = M("idle"), [o, s] = M([]), [a, c] = M(null), [u, m] = M(null), [p, h] = M(null), [P, _] = M(!1), [k, g] = M(null), w = T(null), D = T(e.onDataMessage);
|
|
40
40
|
D.current = e.onDataMessage, I(() => {
|
|
41
41
|
const y = {
|
|
42
42
|
onConnectionStateChange: (B) => {
|
|
@@ -75,7 +75,7 @@ function Dr(e) {
|
|
|
75
75
|
e.sessionEndpoint,
|
|
76
76
|
JSON.stringify(e.sessionBody ?? {})
|
|
77
77
|
]);
|
|
78
|
-
const E =
|
|
78
|
+
const E = C(async () => {
|
|
79
79
|
const y = w.current;
|
|
80
80
|
if (y)
|
|
81
81
|
try {
|
|
@@ -83,10 +83,10 @@ function Dr(e) {
|
|
|
83
83
|
} catch (z) {
|
|
84
84
|
throw g(z instanceof Error ? z.message : String(z)), z;
|
|
85
85
|
}
|
|
86
|
-
}, []), v =
|
|
86
|
+
}, []), v = C(() => {
|
|
87
87
|
const y = w.current;
|
|
88
88
|
y && y.disconnect();
|
|
89
|
-
}, []), O =
|
|
89
|
+
}, []), O = C(() => {
|
|
90
90
|
var y;
|
|
91
91
|
return ((y = w.current) == null ? void 0 : y.getRoom()) ?? null;
|
|
92
92
|
}, []);
|
|
@@ -98,7 +98,7 @@ function Dr(e) {
|
|
|
98
98
|
videoElement: u,
|
|
99
99
|
audioElement: p,
|
|
100
100
|
canResume: P,
|
|
101
|
-
error:
|
|
101
|
+
error: k,
|
|
102
102
|
connect: E,
|
|
103
103
|
disconnect: v,
|
|
104
104
|
getRoom: O,
|
|
@@ -106,48 +106,48 @@ function Dr(e) {
|
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
108
|
function Pr() {
|
|
109
|
-
const e = T(null), t = T(/* @__PURE__ */ new Map()), n = T(null), i = T(/* @__PURE__ */ new Set()), l =
|
|
109
|
+
const e = T(null), t = T(/* @__PURE__ */ new Map()), n = T(null), i = T(/* @__PURE__ */ new Set()), l = C(() => {
|
|
110
110
|
const _ = t.current;
|
|
111
111
|
if (_.size === 0) {
|
|
112
112
|
n.current = null;
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
let
|
|
115
|
+
let k = 0;
|
|
116
116
|
for (const { analyser: g, buffer: w } of _.values()) {
|
|
117
117
|
g.getByteFrequencyData(w);
|
|
118
118
|
let D = 0;
|
|
119
119
|
for (let v = 0; v < w.length; v++) D += w[v];
|
|
120
120
|
const E = D / w.length / 255;
|
|
121
|
-
E >
|
|
121
|
+
E > k && (k = E);
|
|
122
122
|
}
|
|
123
123
|
for (const g of i.current)
|
|
124
124
|
try {
|
|
125
|
-
g(
|
|
125
|
+
g(k);
|
|
126
126
|
} catch (w) {
|
|
127
127
|
console.error("[useAudioLevel] subscriber threw:", w);
|
|
128
128
|
}
|
|
129
129
|
n.current = requestAnimationFrame(l);
|
|
130
|
-
}, []), o =
|
|
130
|
+
}, []), o = C(() => e.current ? e.current : typeof window > "u" || typeof AudioContext > "u" ? null : (e.current = new AudioContext(), e.current), []), s = C(() => {
|
|
131
131
|
n.current === null && t.current.size > 0 && (n.current = requestAnimationFrame(l));
|
|
132
|
-
}, [l]), a =
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
132
|
+
}, [l]), a = C((_) => {
|
|
133
|
+
const k = t.current.get(_);
|
|
134
|
+
if (k) {
|
|
135
135
|
try {
|
|
136
|
-
|
|
136
|
+
k.node.disconnect();
|
|
137
137
|
} catch {
|
|
138
138
|
}
|
|
139
139
|
try {
|
|
140
|
-
|
|
140
|
+
k.analyser.disconnect();
|
|
141
141
|
} catch {
|
|
142
142
|
}
|
|
143
143
|
t.current.delete(_);
|
|
144
144
|
}
|
|
145
|
-
}, []), c =
|
|
146
|
-
(_,
|
|
145
|
+
}, []), c = C(
|
|
146
|
+
(_, k) => {
|
|
147
147
|
const g = o();
|
|
148
148
|
if (!g) return;
|
|
149
149
|
a(_);
|
|
150
|
-
const w =
|
|
150
|
+
const w = k(g);
|
|
151
151
|
if (!w) return;
|
|
152
152
|
const D = g.createAnalyser();
|
|
153
153
|
D.fftSize = 64;
|
|
@@ -164,46 +164,46 @@ function Pr() {
|
|
|
164
164
|
}), s();
|
|
165
165
|
},
|
|
166
166
|
[a, o, s]
|
|
167
|
-
), u =
|
|
168
|
-
(_,
|
|
169
|
-
c(
|
|
167
|
+
), u = C(
|
|
168
|
+
(_, k = "agent") => {
|
|
169
|
+
c(k, (g) => {
|
|
170
170
|
try {
|
|
171
171
|
return g.createMediaElementSource(_);
|
|
172
172
|
} catch (w) {
|
|
173
173
|
return console.warn(
|
|
174
174
|
"[useAudioLevel] createMediaElementSource failed for slot",
|
|
175
|
-
|
|
175
|
+
k,
|
|
176
176
|
w
|
|
177
177
|
), null;
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
180
|
},
|
|
181
181
|
[c]
|
|
182
|
-
), m =
|
|
183
|
-
(_,
|
|
184
|
-
c(
|
|
182
|
+
), m = C(
|
|
183
|
+
(_, k = "mic") => {
|
|
184
|
+
c(k, (g) => {
|
|
185
185
|
try {
|
|
186
186
|
return g.createMediaStreamSource(_);
|
|
187
187
|
} catch (w) {
|
|
188
188
|
return console.warn(
|
|
189
189
|
"[useAudioLevel] createMediaStreamSource failed for slot",
|
|
190
|
-
|
|
190
|
+
k,
|
|
191
191
|
w
|
|
192
192
|
), null;
|
|
193
193
|
}
|
|
194
194
|
});
|
|
195
195
|
},
|
|
196
196
|
[c]
|
|
197
|
-
), p =
|
|
197
|
+
), p = C(
|
|
198
198
|
(_) => {
|
|
199
199
|
a(_), t.current.size === 0 && n.current !== null && (cancelAnimationFrame(n.current), n.current = null);
|
|
200
200
|
},
|
|
201
201
|
[a]
|
|
202
|
-
), h =
|
|
202
|
+
), h = C(() => {
|
|
203
203
|
n.current !== null && (cancelAnimationFrame(n.current), n.current = null);
|
|
204
204
|
for (const _ of Array.from(t.current.keys()))
|
|
205
205
|
a(_);
|
|
206
|
-
}, [a]), P =
|
|
206
|
+
}, [a]), P = C((_) => (i.current.add(_), () => {
|
|
207
207
|
i.current.delete(_);
|
|
208
208
|
}), []);
|
|
209
209
|
return I(() => () => {
|
|
@@ -225,7 +225,7 @@ function $r(e = {}) {
|
|
|
225
225
|
const t = e.gateUntilAgentReady ?? !1, n = e.agentState ?? null, [i, l] = M(t), [o, s] = M(""), [a, c] = M(null), u = T(null), m = T(null), p = T({
|
|
226
226
|
active: t,
|
|
227
227
|
lastAutoIntent: null
|
|
228
|
-
}), h =
|
|
228
|
+
}), h = C(async (E) => {
|
|
229
229
|
var v, O;
|
|
230
230
|
if (u.current && m.current) {
|
|
231
231
|
try {
|
|
@@ -247,9 +247,9 @@ function $r(e = {}) {
|
|
|
247
247
|
const z = y instanceof Error && y.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
|
|
248
248
|
throw c(z), y;
|
|
249
249
|
}
|
|
250
|
-
}, []), P =
|
|
250
|
+
}, []), P = C((E) => {
|
|
251
251
|
m.current = E;
|
|
252
|
-
}, []), _ =
|
|
252
|
+
}, []), _ = C(async (E) => {
|
|
253
253
|
const v = m.current;
|
|
254
254
|
if (v)
|
|
255
255
|
try {
|
|
@@ -257,7 +257,7 @@ function $r(e = {}) {
|
|
|
257
257
|
} catch (O) {
|
|
258
258
|
console.warn("[useMicrophoneState] switchDevice failed:", O);
|
|
259
259
|
}
|
|
260
|
-
}, []),
|
|
260
|
+
}, []), k = C(async () => {
|
|
261
261
|
const E = m.current, v = !i;
|
|
262
262
|
if (l(v), p.current.active = !1, !!E)
|
|
263
263
|
try {
|
|
@@ -275,7 +275,7 @@ function $r(e = {}) {
|
|
|
275
275
|
}
|
|
276
276
|
v.isMicrophoneEnabled === p.current.lastAutoIntent && (v.setMicrophoneEnabled(!0), p.current.lastAutoIntent = !0, l(!1)), p.current.active = !1;
|
|
277
277
|
}, [n]);
|
|
278
|
-
const g =
|
|
278
|
+
const g = C(() => {
|
|
279
279
|
const E = u.current, v = m.current;
|
|
280
280
|
if (E && v) {
|
|
281
281
|
try {
|
|
@@ -285,12 +285,12 @@ function $r(e = {}) {
|
|
|
285
285
|
E.stop();
|
|
286
286
|
}
|
|
287
287
|
u.current = null, m.current = null, p.current = { active: t, lastAutoIntent: null }, l(t), s("");
|
|
288
|
-
}, [t]), w =
|
|
288
|
+
}, [t]), w = C(() => c(null), []), D = C(() => zr(u.current), []);
|
|
289
289
|
return {
|
|
290
290
|
isMuted: i,
|
|
291
291
|
activeDeviceId: o,
|
|
292
292
|
micError: a,
|
|
293
|
-
toggleMute:
|
|
293
|
+
toggleMute: k,
|
|
294
294
|
setupMic: h,
|
|
295
295
|
attachRoom: P,
|
|
296
296
|
switchDevice: _,
|
|
@@ -301,9 +301,9 @@ function $r(e = {}) {
|
|
|
301
301
|
}
|
|
302
302
|
const Hr = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
303
303
|
function Or() {
|
|
304
|
-
const [e, t] = M(!1), [n, i] = M(null), [l, o] = M(null), [s, a] = M(""), c = T(null), u = T(null), m =
|
|
304
|
+
const [e, t] = M(!1), [n, i] = M(null), [l, o] = M(null), [s, a] = M(""), c = T(null), u = T(null), m = C((w) => {
|
|
305
305
|
c.current = w;
|
|
306
|
-
}, []), p =
|
|
306
|
+
}, []), p = C(() => {
|
|
307
307
|
var E;
|
|
308
308
|
const w = c.current, D = u.current;
|
|
309
309
|
if (D && w) {
|
|
@@ -318,7 +318,7 @@ function Or() {
|
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
u.current = null, o(null), t(!1);
|
|
321
|
-
}, []), h =
|
|
321
|
+
}, []), h = C(async (w) => {
|
|
322
322
|
const D = c.current;
|
|
323
323
|
if (D) {
|
|
324
324
|
i(null);
|
|
@@ -341,13 +341,13 @@ function Or() {
|
|
|
341
341
|
i(v);
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
}, []), P =
|
|
344
|
+
}, []), P = C(async () => {
|
|
345
345
|
e ? p() : await h(s || void 0);
|
|
346
|
-
}, [e, s, p, h]), _ =
|
|
346
|
+
}, [e, s, p, h]), _ = C(async (w) => {
|
|
347
347
|
p(), await h(w);
|
|
348
|
-
}, [p, h]),
|
|
348
|
+
}, [p, h]), k = C(() => {
|
|
349
349
|
p(), c.current = null, i(null), a("");
|
|
350
|
-
}, [p]), g =
|
|
350
|
+
}, [p]), g = C(() => i(null), []);
|
|
351
351
|
return I(() => () => {
|
|
352
352
|
u.current && u.current.stop();
|
|
353
353
|
}, []), {
|
|
@@ -358,14 +358,14 @@ function Or() {
|
|
|
358
358
|
toggle: P,
|
|
359
359
|
switchDevice: _,
|
|
360
360
|
attachRoom: m,
|
|
361
|
-
teardown:
|
|
361
|
+
teardown: k,
|
|
362
362
|
clearError: g
|
|
363
363
|
};
|
|
364
364
|
}
|
|
365
365
|
function Fr() {
|
|
366
|
-
const [e, t] = M(!1), [n, i] = M(null), [l, o] = M(null), s = T(null), a =
|
|
366
|
+
const [e, t] = M(!1), [n, i] = M(null), [l, o] = M(null), s = T(null), a = C((h) => {
|
|
367
367
|
s.current = h;
|
|
368
|
-
}, []), c =
|
|
368
|
+
}, []), c = C(() => o(null), []), u = C(async () => {
|
|
369
369
|
const h = s.current;
|
|
370
370
|
if (h) {
|
|
371
371
|
if (e) {
|
|
@@ -381,9 +381,9 @@ function Fr() {
|
|
|
381
381
|
await h.localParticipant.setScreenShareEnabled(!0);
|
|
382
382
|
let P = 0;
|
|
383
383
|
const _ = () => {
|
|
384
|
-
const
|
|
385
|
-
if (
|
|
386
|
-
const g =
|
|
384
|
+
const k = h.localParticipant.getTrackPublication(er.Source.ScreenShare);
|
|
385
|
+
if (k != null && k.track) {
|
|
386
|
+
const g = k.track.attach();
|
|
387
387
|
o(g), t(!0);
|
|
388
388
|
try {
|
|
389
389
|
h.localParticipant.publishData(
|
|
@@ -402,7 +402,7 @@ function Fr() {
|
|
|
402
402
|
_ !== "NotAllowedError" && _ !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
|
-
}, [e, c]), m =
|
|
405
|
+
}, [e, c]), m = C(() => {
|
|
406
406
|
const h = s.current;
|
|
407
407
|
if (h && e)
|
|
408
408
|
try {
|
|
@@ -410,11 +410,11 @@ function Fr() {
|
|
|
410
410
|
} catch {
|
|
411
411
|
}
|
|
412
412
|
c(), t(!1), i(null), s.current = null;
|
|
413
|
-
}, [e, c]), p =
|
|
413
|
+
}, [e, c]), p = C(() => i(null), []);
|
|
414
414
|
return { isEnabled: e, error: n, previewEl: l, toggle: u, attachRoom: a, teardown: m, clearError: p };
|
|
415
415
|
}
|
|
416
416
|
function Br() {
|
|
417
|
-
const [e, t] = M([]), [n, i] = M([]), l =
|
|
417
|
+
const [e, t] = M([]), [n, i] = M([]), l = C(async () => {
|
|
418
418
|
if (!(typeof navigator > "u" || !navigator.mediaDevices))
|
|
419
419
|
try {
|
|
420
420
|
const o = await navigator.mediaDevices.enumerateDevices();
|
|
@@ -478,7 +478,7 @@ function Ur({
|
|
|
478
478
|
defaultValue: t = "expanded",
|
|
479
479
|
onChange: n
|
|
480
480
|
} = {}) {
|
|
481
|
-
const i = e !== void 0, [l, o] = M(t), s = i ? e : l, a =
|
|
481
|
+
const i = e !== void 0, [l, o] = M(t), s = i ? e : l, a = C(
|
|
482
482
|
(c) => {
|
|
483
483
|
c !== s && (i || o(c), n == null || n(c));
|
|
484
484
|
},
|
|
@@ -527,7 +527,7 @@ function Xr(e = Gr) {
|
|
|
527
527
|
}, [e]), t;
|
|
528
528
|
}
|
|
529
529
|
const Kr = 280, Jr = 380, Zr = 8, Qr = 4;
|
|
530
|
-
function
|
|
530
|
+
function Xt(e) {
|
|
531
531
|
return `${e}:geometry`;
|
|
532
532
|
}
|
|
533
533
|
function ei(e) {
|
|
@@ -542,17 +542,17 @@ function ei(e) {
|
|
|
542
542
|
const n = t, { top: i, left: l, width: o, height: s } = n;
|
|
543
543
|
return typeof i != "number" || typeof l != "number" || typeof o != "number" || typeof s != "number" || !Number.isFinite(i) || !Number.isFinite(l) || !Number.isFinite(o) || !Number.isFinite(s) ? null : { top: i, left: l, width: o, height: s };
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function $t() {
|
|
546
546
|
return typeof window > "u" ? { vw: 0, vh: 0 } : { vw: window.innerWidth, vh: window.innerHeight };
|
|
547
547
|
}
|
|
548
|
-
function
|
|
548
|
+
function Kt(e, t, n) {
|
|
549
549
|
const { minWidth: i, minHeight: l, edgeMargin: o, vw: s, vh: a } = n, c = Math.max(i, s - o * 2), u = Math.max(l, a - o * 2);
|
|
550
550
|
return {
|
|
551
551
|
width: Math.max(i, Math.min(c, e)),
|
|
552
552
|
height: Math.max(l, Math.min(u, t))
|
|
553
553
|
};
|
|
554
554
|
}
|
|
555
|
-
function
|
|
555
|
+
function Jt(e, t, n, i, l) {
|
|
556
556
|
const { edgeMargin: o, vw: s, vh: a } = l, c = o, u = o, m = Math.max(c, s - n - o), p = Math.max(u, a - i - o);
|
|
557
557
|
return {
|
|
558
558
|
top: Math.max(u, Math.min(p, e)),
|
|
@@ -568,25 +568,25 @@ function ti(e) {
|
|
|
568
568
|
minWidth: o = Kr,
|
|
569
569
|
minHeight: s = Jr,
|
|
570
570
|
edgeMargin: a = Zr
|
|
571
|
-
} = e, [c, u] = M(null), [m, p] = M(!1), [h, P] = M(!1), _ = T(null),
|
|
571
|
+
} = e, [c, u] = M(null), [m, p] = M(!1), [h, P] = M(!1), _ = T(null), k = T(null), g = T(!1), w = T(null);
|
|
572
572
|
w.current = c;
|
|
573
|
-
const D =
|
|
573
|
+
const D = C(
|
|
574
574
|
(f) => {
|
|
575
|
-
l || (f === null ? qr(
|
|
575
|
+
l || (f === null ? qr(Xt(i)) : nr(Xt(i), JSON.stringify(f)));
|
|
576
576
|
},
|
|
577
577
|
[l, i]
|
|
578
578
|
);
|
|
579
579
|
I(() => {
|
|
580
580
|
if (g.current || (g.current = !0, l)) return;
|
|
581
|
-
const f = ei(tr(
|
|
581
|
+
const f = ei(tr(Xt(i)));
|
|
582
582
|
if (!f) return;
|
|
583
|
-
const { vw: A, vh: $ } =
|
|
583
|
+
const { vw: A, vh: $ } = $t(), q = Kt(f.width, f.height, {
|
|
584
584
|
minWidth: o,
|
|
585
585
|
minHeight: s,
|
|
586
586
|
edgeMargin: a,
|
|
587
587
|
vw: A,
|
|
588
588
|
vh: $
|
|
589
|
-
}), X =
|
|
589
|
+
}), X = Jt(f.top, f.left, q.width, q.height, {
|
|
590
590
|
edgeMargin: a,
|
|
591
591
|
vw: A,
|
|
592
592
|
vh: $
|
|
@@ -597,14 +597,14 @@ function ti(e) {
|
|
|
597
597
|
const f = () => {
|
|
598
598
|
u((A) => {
|
|
599
599
|
if (A === null) return null;
|
|
600
|
-
const { vw: $, vh: q } =
|
|
600
|
+
const { vw: $, vh: q } = $t(), X = Kt(A.width, A.height, {
|
|
601
601
|
minWidth: o,
|
|
602
602
|
minHeight: s,
|
|
603
603
|
edgeMargin: a,
|
|
604
604
|
vw: $,
|
|
605
605
|
vh: q
|
|
606
606
|
});
|
|
607
|
-
return { ...
|
|
607
|
+
return { ...Jt(A.top, A.left, X.width, X.height, {
|
|
608
608
|
edgeMargin: a,
|
|
609
609
|
vw: $,
|
|
610
610
|
vh: q
|
|
@@ -613,7 +613,7 @@ function ti(e) {
|
|
|
613
613
|
};
|
|
614
614
|
return window.addEventListener("resize", f), () => window.removeEventListener("resize", f);
|
|
615
615
|
}, [o, s, a]);
|
|
616
|
-
const E =
|
|
616
|
+
const E = C(
|
|
617
617
|
(f) => {
|
|
618
618
|
if (!t || f.pointerType === "mouse" && f.button !== 0) return;
|
|
619
619
|
const A = f.target;
|
|
@@ -624,9 +624,9 @@ function ti(e) {
|
|
|
624
624
|
if (W)
|
|
625
625
|
({ top: $, left: q, width: X, height: ee } = W);
|
|
626
626
|
else {
|
|
627
|
-
const te = f.currentTarget.closest(".ll-widget"),
|
|
628
|
-
if (!
|
|
629
|
-
$ =
|
|
627
|
+
const te = f.currentTarget.closest(".ll-widget"), ie = te == null ? void 0 : te.getBoundingClientRect();
|
|
628
|
+
if (!ie) return;
|
|
629
|
+
$ = ie.top, q = ie.left, X = ie.width, ee = ie.height;
|
|
630
630
|
}
|
|
631
631
|
try {
|
|
632
632
|
f.currentTarget.setPointerCapture(f.pointerId);
|
|
@@ -643,13 +643,13 @@ function ti(e) {
|
|
|
643
643
|
};
|
|
644
644
|
},
|
|
645
645
|
[t]
|
|
646
|
-
), v =
|
|
646
|
+
), v = C(
|
|
647
647
|
(f) => {
|
|
648
648
|
const A = _.current;
|
|
649
649
|
if (!A) return;
|
|
650
650
|
const $ = f.clientX - A.startClientX, q = f.clientY - A.startClientY;
|
|
651
651
|
if (!A.moved && Math.abs($) + Math.abs(q) > Qr && (A.moved = !0, p(!0)), !A.moved) return;
|
|
652
|
-
const { vw: X, vh: ee } =
|
|
652
|
+
const { vw: X, vh: ee } = $t(), W = Jt(
|
|
653
653
|
A.startTop + q,
|
|
654
654
|
A.startLeft + $,
|
|
655
655
|
A.width,
|
|
@@ -659,7 +659,7 @@ function ti(e) {
|
|
|
659
659
|
u({ ...W, width: A.width, height: A.height });
|
|
660
660
|
},
|
|
661
661
|
[a]
|
|
662
|
-
), O =
|
|
662
|
+
), O = C(
|
|
663
663
|
(f) => {
|
|
664
664
|
const A = _.current;
|
|
665
665
|
if (A) {
|
|
@@ -671,9 +671,9 @@ function ti(e) {
|
|
|
671
671
|
}
|
|
672
672
|
},
|
|
673
673
|
[D]
|
|
674
|
-
), y =
|
|
675
|
-
_.current = null,
|
|
676
|
-
}, [D]), z =
|
|
674
|
+
), y = C(() => {
|
|
675
|
+
_.current = null, k.current = null, p(!1), P(!1), u(null), D(null);
|
|
676
|
+
}, [D]), z = C(
|
|
677
677
|
(f) => {
|
|
678
678
|
if (!n || f.pointerType === "mouse" && f.button !== 0) return;
|
|
679
679
|
f.stopPropagation();
|
|
@@ -690,7 +690,7 @@ function ti(e) {
|
|
|
690
690
|
f.currentTarget.setPointerCapture(f.pointerId);
|
|
691
691
|
} catch {
|
|
692
692
|
}
|
|
693
|
-
|
|
693
|
+
k.current = {
|
|
694
694
|
startClientX: f.clientX,
|
|
695
695
|
startClientY: f.clientY,
|
|
696
696
|
startWidth: q,
|
|
@@ -700,11 +700,11 @@ function ti(e) {
|
|
|
700
700
|
}, P(!0);
|
|
701
701
|
},
|
|
702
702
|
[n]
|
|
703
|
-
), B =
|
|
703
|
+
), B = C(
|
|
704
704
|
(f) => {
|
|
705
|
-
const A =
|
|
705
|
+
const A = k.current;
|
|
706
706
|
if (!A) return;
|
|
707
|
-
const $ = f.clientX - A.startClientX, q = f.clientY - A.startClientY, { vw: X, vh: ee } =
|
|
707
|
+
const $ = f.clientX - A.startClientX, q = f.clientY - A.startClientY, { vw: X, vh: ee } = $t(), W = X - A.left - a, te = ee - A.top - a, ie = Kt(A.startWidth + $, A.startHeight + q, {
|
|
708
708
|
minWidth: o,
|
|
709
709
|
minHeight: s,
|
|
710
710
|
edgeMargin: a,
|
|
@@ -713,17 +713,17 @@ function ti(e) {
|
|
|
713
713
|
vw: Math.min(X, A.left + W + a),
|
|
714
714
|
vh: Math.min(ee, A.top + te + a)
|
|
715
715
|
});
|
|
716
|
-
u({ top: A.top, left: A.left, ...
|
|
716
|
+
u({ top: A.top, left: A.left, ...ie });
|
|
717
717
|
},
|
|
718
718
|
[a, o, s]
|
|
719
|
-
), J =
|
|
719
|
+
), J = C(
|
|
720
720
|
(f) => {
|
|
721
|
-
if (
|
|
721
|
+
if (k.current) {
|
|
722
722
|
try {
|
|
723
723
|
f.currentTarget.releasePointerCapture(f.pointerId);
|
|
724
724
|
} catch {
|
|
725
725
|
}
|
|
726
|
-
|
|
726
|
+
k.current = null, P(!1), u(($) => ($ && D($), $));
|
|
727
727
|
}
|
|
728
728
|
},
|
|
729
729
|
[D]
|
|
@@ -759,16 +759,16 @@ function ti(e) {
|
|
|
759
759
|
reset: y
|
|
760
760
|
};
|
|
761
761
|
}
|
|
762
|
-
const Nn = "__llHistoryPatched",
|
|
762
|
+
const Nn = "__llHistoryPatched", Ft = "ll:pathname";
|
|
763
763
|
function ni() {
|
|
764
764
|
if (typeof window > "u" || window.history[Nn]) return;
|
|
765
765
|
const e = window.history.pushState, t = window.history.replaceState;
|
|
766
766
|
window.history.pushState = function(...n) {
|
|
767
767
|
const i = e.apply(this, n);
|
|
768
|
-
return window.dispatchEvent(new Event(
|
|
768
|
+
return window.dispatchEvent(new Event(Ft)), i;
|
|
769
769
|
}, window.history.replaceState = function(...n) {
|
|
770
770
|
const i = t.apply(this, n);
|
|
771
|
-
return window.dispatchEvent(new Event(
|
|
771
|
+
return window.dispatchEvent(new Event(Ft)), i;
|
|
772
772
|
}, window.history[Nn] = !0;
|
|
773
773
|
}
|
|
774
774
|
function Mn() {
|
|
@@ -782,8 +782,8 @@ function ri(e) {
|
|
|
782
782
|
if (e !== void 0) return;
|
|
783
783
|
ni();
|
|
784
784
|
const i = () => n(Mn());
|
|
785
|
-
return i(), window.addEventListener("popstate", i), window.addEventListener(
|
|
786
|
-
window.removeEventListener("popstate", i), window.removeEventListener(
|
|
785
|
+
return i(), window.addEventListener("popstate", i), window.addEventListener(Ft, i), () => {
|
|
786
|
+
window.removeEventListener("popstate", i), window.removeEventListener(Ft, i);
|
|
787
787
|
};
|
|
788
788
|
}, [e]), e ?? t;
|
|
789
789
|
}
|
|
@@ -827,7 +827,7 @@ function di(e) {
|
|
|
827
827
|
};
|
|
828
828
|
}
|
|
829
829
|
function fi(e) {
|
|
830
|
-
const t = at(() => di(e.config), [e.config]), n = e.baseUrl.replace(/\/+$/, ""), i = T(null), l =
|
|
830
|
+
const t = at(() => di(e.config), [e.config]), n = e.baseUrl.replace(/\/+$/, ""), i = T(null), l = C(
|
|
831
831
|
(c) => {
|
|
832
832
|
try {
|
|
833
833
|
new Audio(`${n}${c}`).play().catch(() => {
|
|
@@ -836,11 +836,11 @@ function fi(e) {
|
|
|
836
836
|
}
|
|
837
837
|
},
|
|
838
838
|
[n]
|
|
839
|
-
), o =
|
|
839
|
+
), o = C(() => {
|
|
840
840
|
t.navigate && l("/audio/page-change-sound.mp3");
|
|
841
|
-
}, [t.navigate, l]), s =
|
|
841
|
+
}, [t.navigate, l]), s = C(() => {
|
|
842
842
|
t.action && l("/audio/confirmation-sound.mp3");
|
|
843
|
-
}, [t.action, l]), a =
|
|
843
|
+
}, [t.action, l]), a = C(
|
|
844
844
|
(c) => {
|
|
845
845
|
if (!t.thinking) {
|
|
846
846
|
if (i.current) {
|
|
@@ -1009,7 +1009,7 @@ const vi = ({
|
|
|
1009
1009
|
agentName: s,
|
|
1010
1010
|
containerEl: a
|
|
1011
1011
|
}) => {
|
|
1012
|
-
const c = mi(e), u = c === "right" ? "left" : "right", m = t ? 80 : 72, p = !!o, h = !!a, [P, _] = M(null), [
|
|
1012
|
+
const c = mi(e), u = c === "right" ? "left" : "right", m = t ? 80 : 72, p = !!o, h = !!a, [P, _] = M(null), [k, g] = M(!1), w = T(null), D = T(!1), E = C(
|
|
1013
1013
|
(H) => {
|
|
1014
1014
|
if (typeof window > "u") return H;
|
|
1015
1015
|
const G = m / 2, f = zn + G, A = window.innerHeight - zn - G;
|
|
@@ -1029,7 +1029,7 @@ const vi = ({
|
|
|
1029
1029
|
};
|
|
1030
1030
|
return window.addEventListener("resize", G), () => window.removeEventListener("resize", G);
|
|
1031
1031
|
}, [E, h]);
|
|
1032
|
-
const v =
|
|
1032
|
+
const v = C(
|
|
1033
1033
|
(H) => {
|
|
1034
1034
|
if (!h && !(H.pointerType === "mouse" && H.button !== 0) && P !== null) {
|
|
1035
1035
|
try {
|
|
@@ -1044,7 +1044,7 @@ const vi = ({
|
|
|
1044
1044
|
}
|
|
1045
1045
|
},
|
|
1046
1046
|
[P, h]
|
|
1047
|
-
), O =
|
|
1047
|
+
), O = C(
|
|
1048
1048
|
(H) => {
|
|
1049
1049
|
const G = w.current;
|
|
1050
1050
|
if (!G) return;
|
|
@@ -1052,7 +1052,7 @@ const vi = ({
|
|
|
1052
1052
|
!G.moved && Math.abs(f) > gi && (G.moved = !0, g(!0)), G.moved && _(E(G.startCenterY + f));
|
|
1053
1053
|
},
|
|
1054
1054
|
[E]
|
|
1055
|
-
), y =
|
|
1055
|
+
), y = C(
|
|
1056
1056
|
(H) => {
|
|
1057
1057
|
const G = w.current;
|
|
1058
1058
|
if (G) {
|
|
@@ -1064,13 +1064,13 @@ const vi = ({
|
|
|
1064
1064
|
}
|
|
1065
1065
|
},
|
|
1066
1066
|
[]
|
|
1067
|
-
), z =
|
|
1067
|
+
), z = C(() => {
|
|
1068
1068
|
if (D.current) {
|
|
1069
1069
|
D.current = !1;
|
|
1070
1070
|
return;
|
|
1071
1071
|
}
|
|
1072
1072
|
i();
|
|
1073
|
-
}, [i]), B =
|
|
1073
|
+
}, [i]), B = C(
|
|
1074
1074
|
(H) => {
|
|
1075
1075
|
if (H.key === "ArrowUp" || H.key === "ArrowDown") {
|
|
1076
1076
|
H.preventDefault();
|
|
@@ -1088,10 +1088,10 @@ const vi = ({
|
|
|
1088
1088
|
`ll-hidden--${c}`,
|
|
1089
1089
|
t ? "ll-hidden--mobile" : "ll-hidden--desktop",
|
|
1090
1090
|
n ? "ll-hidden--speaking" : null,
|
|
1091
|
-
|
|
1091
|
+
k ? "is-dragging" : null,
|
|
1092
1092
|
p ? "ll-hidden--with-avatar" : null,
|
|
1093
1093
|
h ? "ll-hidden--scoped" : null
|
|
1094
|
-
].filter(Boolean).join(" "),
|
|
1094
|
+
].filter(Boolean).join(" "), le = P === null ? void 0 : { top: `${P - m / 2}px`, transform: "none" };
|
|
1095
1095
|
return /* @__PURE__ */ r(
|
|
1096
1096
|
"button",
|
|
1097
1097
|
{
|
|
@@ -1105,7 +1105,7 @@ const vi = ({
|
|
|
1105
1105
|
onKeyDown: B,
|
|
1106
1106
|
"aria-label": l,
|
|
1107
1107
|
"data-position": e,
|
|
1108
|
-
style:
|
|
1108
|
+
style: le,
|
|
1109
1109
|
children: p ? (
|
|
1110
1110
|
// Layout: tiny chevron flush against the inward edge (peeks out
|
|
1111
1111
|
// as the click affordance), then the circular avatar photo
|
|
@@ -1376,7 +1376,7 @@ function Li({
|
|
|
1376
1376
|
}
|
|
1377
1377
|
);
|
|
1378
1378
|
}
|
|
1379
|
-
const
|
|
1379
|
+
const Ci = 8, Hn = 8, ki = ({
|
|
1380
1380
|
open: e,
|
|
1381
1381
|
onClose: t,
|
|
1382
1382
|
anchorRef: n,
|
|
@@ -1392,7 +1392,7 @@ const ki = 8, Hn = 8, Ci = ({
|
|
|
1392
1392
|
if (!a) return;
|
|
1393
1393
|
const c = () => {
|
|
1394
1394
|
const u = a.getBoundingClientRect(), m = {
|
|
1395
|
-
top: u.top -
|
|
1395
|
+
top: u.top - Ci,
|
|
1396
1396
|
left: u.left + u.width / 2
|
|
1397
1397
|
}, p = Hn + 90, h = window.innerWidth - Hn - 90;
|
|
1398
1398
|
m.left < p && (m.left = p), m.left > h && (m.left = h), s(m);
|
|
@@ -1411,7 +1411,7 @@ const ki = 8, Hn = 8, Ci = ({
|
|
|
1411
1411
|
return document.addEventListener("mousedown", a), document.addEventListener("keydown", c), () => {
|
|
1412
1412
|
document.removeEventListener("mousedown", a), document.removeEventListener("keydown", c);
|
|
1413
1413
|
};
|
|
1414
|
-
}, [e, t, n]), !e || o === null || typeof document > "u" ? null :
|
|
1414
|
+
}, [e, t, n]), !e || o === null || typeof document > "u" ? null : on(
|
|
1415
1415
|
/* @__PURE__ */ r(
|
|
1416
1416
|
"div",
|
|
1417
1417
|
{
|
|
@@ -1447,7 +1447,7 @@ const ki = 8, Hn = 8, Ci = ({
|
|
|
1447
1447
|
onToggleTyping: h,
|
|
1448
1448
|
onDisconnect: P
|
|
1449
1449
|
}) => {
|
|
1450
|
-
const [_,
|
|
1450
|
+
const [_, k] = M(!1), g = T(null);
|
|
1451
1451
|
return /* @__PURE__ */ S(Ve, { children: [
|
|
1452
1452
|
/* @__PURE__ */ S(
|
|
1453
1453
|
"div",
|
|
@@ -1472,7 +1472,7 @@ const ki = 8, Hn = 8, Ci = ({
|
|
|
1472
1472
|
ref: g,
|
|
1473
1473
|
type: "button",
|
|
1474
1474
|
className: `ll-tool ${_ ? "is-on" : ""}`,
|
|
1475
|
-
onClick: () =>
|
|
1475
|
+
onClick: () => k((w) => !w),
|
|
1476
1476
|
"aria-label": "More controls",
|
|
1477
1477
|
"aria-haspopup": "menu",
|
|
1478
1478
|
"aria-expanded": _,
|
|
@@ -1493,10 +1493,10 @@ const ki = 8, Hn = 8, Ci = ({
|
|
|
1493
1493
|
}
|
|
1494
1494
|
),
|
|
1495
1495
|
/* @__PURE__ */ S(
|
|
1496
|
-
|
|
1496
|
+
ki,
|
|
1497
1497
|
{
|
|
1498
1498
|
open: _,
|
|
1499
|
-
onClose: () =>
|
|
1499
|
+
onClose: () => k(!1),
|
|
1500
1500
|
anchorRef: g,
|
|
1501
1501
|
children: [
|
|
1502
1502
|
l && /* @__PURE__ */ S(
|
|
@@ -1505,7 +1505,7 @@ const ki = 8, Hn = 8, Ci = ({
|
|
|
1505
1505
|
type: "button",
|
|
1506
1506
|
className: `ll-overflow-popover__item ${n ? "is-on" : ""}`,
|
|
1507
1507
|
onClick: () => {
|
|
1508
|
-
i(),
|
|
1508
|
+
i(), k(!1);
|
|
1509
1509
|
},
|
|
1510
1510
|
children: [
|
|
1511
1511
|
/* @__PURE__ */ r(or, {}),
|
|
@@ -1519,7 +1519,7 @@ const ki = 8, Hn = 8, Ci = ({
|
|
|
1519
1519
|
type: "button",
|
|
1520
1520
|
className: `ll-overflow-popover__item ${o ? "is-on" : ""}`,
|
|
1521
1521
|
onClick: () => {
|
|
1522
|
-
s(),
|
|
1522
|
+
s(), k(!1);
|
|
1523
1523
|
},
|
|
1524
1524
|
children: [
|
|
1525
1525
|
/* @__PURE__ */ r(ir, {}),
|
|
@@ -1533,7 +1533,7 @@ const ki = 8, Hn = 8, Ci = ({
|
|
|
1533
1533
|
type: "button",
|
|
1534
1534
|
className: `ll-overflow-popover__item ${c ? "is-on" : ""}`,
|
|
1535
1535
|
onClick: () => {
|
|
1536
|
-
u(),
|
|
1536
|
+
u(), k(!1);
|
|
1537
1537
|
},
|
|
1538
1538
|
children: [
|
|
1539
1539
|
/* @__PURE__ */ r(ar, { muted: c }),
|
|
@@ -1547,7 +1547,7 @@ const ki = 8, Hn = 8, Ci = ({
|
|
|
1547
1547
|
type: "button",
|
|
1548
1548
|
className: `ll-overflow-popover__item ${p ? "is-on" : ""}`,
|
|
1549
1549
|
onClick: () => {
|
|
1550
|
-
h(),
|
|
1550
|
+
h(), k(!1);
|
|
1551
1551
|
},
|
|
1552
1552
|
children: [
|
|
1553
1553
|
/* @__PURE__ */ r(Ai, {}),
|
|
@@ -1623,7 +1623,7 @@ const Ni = ({
|
|
|
1623
1623
|
onSelectTeamMember: h,
|
|
1624
1624
|
languageMenuOpen: P,
|
|
1625
1625
|
onToggleLanguageMenu: _,
|
|
1626
|
-
connectionState:
|
|
1626
|
+
connectionState: k,
|
|
1627
1627
|
agentState: g,
|
|
1628
1628
|
transcript: w,
|
|
1629
1629
|
canResume: D,
|
|
@@ -1634,7 +1634,7 @@ const Ni = ({
|
|
|
1634
1634
|
micDevices: z,
|
|
1635
1635
|
activeMicId: B,
|
|
1636
1636
|
isCameraEnabled: J,
|
|
1637
|
-
cameraPreviewEl:
|
|
1637
|
+
cameraPreviewEl: le,
|
|
1638
1638
|
cameraDevices: H,
|
|
1639
1639
|
activeCameraId: G,
|
|
1640
1640
|
isScreenShareEnabled: f,
|
|
@@ -1645,18 +1645,18 @@ const Ni = ({
|
|
|
1645
1645
|
allowTyping: ee,
|
|
1646
1646
|
showMinimize: W = !0,
|
|
1647
1647
|
showClose: te = !0,
|
|
1648
|
-
chromeless:
|
|
1648
|
+
chromeless: ie = !1,
|
|
1649
1649
|
compactControls: U = !1,
|
|
1650
1650
|
transforming: ge,
|
|
1651
1651
|
transformingLabel: Z,
|
|
1652
|
-
avatarVideoContainerRef:
|
|
1652
|
+
avatarVideoContainerRef: Ce,
|
|
1653
1653
|
agentVideoEl: ne,
|
|
1654
|
-
onConnect:
|
|
1654
|
+
onConnect: Me,
|
|
1655
1655
|
onDisconnect: st,
|
|
1656
|
-
onRetry:
|
|
1657
|
-
onResumeAudio:
|
|
1656
|
+
onRetry: _t,
|
|
1657
|
+
onResumeAudio: xt,
|
|
1658
1658
|
onToggleMute: ct,
|
|
1659
|
-
onSwitchMicDevice:
|
|
1659
|
+
onSwitchMicDevice: Lt,
|
|
1660
1660
|
onToggleCamera: Ye,
|
|
1661
1661
|
onSwitchCameraDevice: Ge,
|
|
1662
1662
|
onToggleScreenShare: $e,
|
|
@@ -1668,83 +1668,83 @@ const Ni = ({
|
|
|
1668
1668
|
dragHandleProps: We,
|
|
1669
1669
|
resizeHandleProps: F
|
|
1670
1670
|
}) => {
|
|
1671
|
-
var
|
|
1672
|
-
const qe = ((a == null ? void 0 : a.length) ?? 0) > 1, Ke =
|
|
1671
|
+
var et;
|
|
1672
|
+
const qe = ((a == null ? void 0 : a.length) ?? 0) > 1, Ke = k === "connecting" || k === "connected", ke = k === "connected", Ct = k === "idle" || k === "disconnected" || k === "error", [ut, Ie] = M(!1);
|
|
1673
1673
|
I(() => {
|
|
1674
1674
|
if (!ne) {
|
|
1675
|
-
|
|
1675
|
+
Ie(!1);
|
|
1676
1676
|
return;
|
|
1677
1677
|
}
|
|
1678
1678
|
if (!ne.paused && ne.readyState >= 2) {
|
|
1679
|
-
|
|
1679
|
+
Ie(!0);
|
|
1680
1680
|
return;
|
|
1681
1681
|
}
|
|
1682
|
-
|
|
1683
|
-
const x = () =>
|
|
1682
|
+
Ie(!1);
|
|
1683
|
+
const x = () => Ie(!0);
|
|
1684
1684
|
return ne.addEventListener("playing", x), ne.addEventListener("loadeddata", x), () => {
|
|
1685
1685
|
ne.removeEventListener("playing", x), ne.removeEventListener("loadeddata", x);
|
|
1686
1686
|
};
|
|
1687
1687
|
}, [ne]);
|
|
1688
|
-
const [
|
|
1688
|
+
const [dt, kt] = M(!1);
|
|
1689
1689
|
I(() => {
|
|
1690
1690
|
g === "speaking" && kt(!0);
|
|
1691
1691
|
}, [g]), I(() => {
|
|
1692
|
-
(
|
|
1693
|
-
}, [
|
|
1694
|
-
const
|
|
1692
|
+
(k === "disconnected" || k === "idle") && kt(!1);
|
|
1693
|
+
}, [k]);
|
|
1694
|
+
const [Ue, ue] = M(!1);
|
|
1695
1695
|
I(() => {
|
|
1696
1696
|
if (!ke) {
|
|
1697
|
-
|
|
1697
|
+
ue(!1);
|
|
1698
1698
|
return;
|
|
1699
1699
|
}
|
|
1700
|
-
if (
|
|
1701
|
-
const x = setTimeout(() =>
|
|
1700
|
+
if (dt) return;
|
|
1701
|
+
const x = setTimeout(() => ue(!0), 12e3);
|
|
1702
1702
|
return () => clearTimeout(x);
|
|
1703
|
-
}, [ke,
|
|
1704
|
-
const
|
|
1703
|
+
}, [ke, dt]);
|
|
1704
|
+
const St = k === "connecting" || ke && !dt && !Ue, de = T(null), ve = T(null);
|
|
1705
1705
|
I(() => {
|
|
1706
|
+
const x = de.current;
|
|
1707
|
+
x && (x.innerHTML = "", le && (le.style.width = "100%", le.style.height = "100%", le.style.objectFit = "cover", le.style.transform = "scaleX(-1)", x.appendChild(le)));
|
|
1708
|
+
}, [le]), I(() => {
|
|
1706
1709
|
const x = ve.current;
|
|
1707
|
-
x && (x.innerHTML = "", ae && (ae.style.width = "100%", ae.style.height = "100%", ae.style.objectFit = "cover", ae.style.transform = "scaleX(-1)", x.appendChild(ae)));
|
|
1708
|
-
}, [ae]), I(() => {
|
|
1709
|
-
const x = Ct.current;
|
|
1710
1710
|
x && (x.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "contain", x.appendChild(A)));
|
|
1711
1711
|
}, [A]);
|
|
1712
|
-
const [Je,
|
|
1712
|
+
const [Je, Ze] = M(!1), [pe, be] = M(!1), Et = T(null), At = T(null);
|
|
1713
1713
|
I(() => {
|
|
1714
|
-
if (!Je && !
|
|
1714
|
+
if (!Je && !pe && !P && !m) return;
|
|
1715
1715
|
const x = () => {
|
|
1716
|
-
|
|
1716
|
+
Ze(!1), be(!1), P && _(), m && p();
|
|
1717
1717
|
};
|
|
1718
1718
|
return document.addEventListener("click", x), () => document.removeEventListener("click", x);
|
|
1719
1719
|
}, [
|
|
1720
1720
|
Je,
|
|
1721
|
-
|
|
1721
|
+
pe,
|
|
1722
1722
|
P,
|
|
1723
1723
|
m,
|
|
1724
1724
|
_,
|
|
1725
1725
|
p
|
|
1726
1726
|
]);
|
|
1727
|
-
const [
|
|
1727
|
+
const [Nt, ln] = M(!1), an = C(() => ln((x) => !x), []), [_e, Te] = M(""), Ae = C(
|
|
1728
1728
|
(x) => {
|
|
1729
1729
|
x.preventDefault();
|
|
1730
|
-
const
|
|
1731
|
-
|
|
1730
|
+
const ae = _e.trim();
|
|
1731
|
+
ae && (Oe(ae), Te(""));
|
|
1732
1732
|
},
|
|
1733
|
-
[
|
|
1734
|
-
),
|
|
1735
|
-
let
|
|
1733
|
+
[_e, Oe]
|
|
1734
|
+
), Re = s.productName || "Live Layer", ft = !s.productName;
|
|
1735
|
+
let De = null, Se = null;
|
|
1736
1736
|
for (let x = w.length - 1; x >= 0; x--) {
|
|
1737
|
-
const
|
|
1738
|
-
if (!
|
|
1737
|
+
const ae = w[x];
|
|
1738
|
+
if (!De && ae.role === "agent" ? De = ae : !Se && ae.role === "user" && (Se = ae), De && Se) break;
|
|
1739
1739
|
}
|
|
1740
|
-
const
|
|
1740
|
+
const Qe = ke ? (De == null ? void 0 : De.text) || null : o || null, pt = ke && (Se == null ? void 0 : Se.text) || null, ht = [
|
|
1741
1741
|
"ll-expanded",
|
|
1742
1742
|
t ? "ll-expanded--mobile" : "ll-expanded--desktop"
|
|
1743
1743
|
].join(" ");
|
|
1744
1744
|
return /* @__PURE__ */ S(
|
|
1745
1745
|
"div",
|
|
1746
1746
|
{
|
|
1747
|
-
className:
|
|
1747
|
+
className: ht,
|
|
1748
1748
|
"data-position": e,
|
|
1749
1749
|
"data-state": ke ? "connected" : Ke ? "connecting" : "idle",
|
|
1750
1750
|
role: "dialog",
|
|
@@ -1758,7 +1758,7 @@ const Ni = ({
|
|
|
1758
1758
|
alt: n,
|
|
1759
1759
|
className: "ll-expanded__bg-img"
|
|
1760
1760
|
}
|
|
1761
|
-
) : /* @__PURE__ */ r("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ r("span", { className: "ll-expanded__bg-initial", children: ((
|
|
1761
|
+
) : /* @__PURE__ */ r("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ r("span", { className: "ll-expanded__bg-initial", children: ((et = n == null ? void 0 : n.charAt(0)) == null ? void 0 : et.toUpperCase()) || "A" }) }),
|
|
1762
1762
|
l && !ke && /* @__PURE__ */ r(
|
|
1763
1763
|
"video",
|
|
1764
1764
|
{
|
|
@@ -1771,8 +1771,15 @@ const Ni = ({
|
|
|
1771
1771
|
}
|
|
1772
1772
|
)
|
|
1773
1773
|
] }),
|
|
1774
|
-
/* @__PURE__ */ r(
|
|
1775
|
-
|
|
1774
|
+
/* @__PURE__ */ r(
|
|
1775
|
+
"div",
|
|
1776
|
+
{
|
|
1777
|
+
ref: Ce,
|
|
1778
|
+
className: "ll-expanded__video",
|
|
1779
|
+
"data-ready": ut
|
|
1780
|
+
}
|
|
1781
|
+
),
|
|
1782
|
+
St && /* @__PURE__ */ S("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
|
|
1776
1783
|
/* @__PURE__ */ r("div", { className: "ll-expanded__spinner" }),
|
|
1777
1784
|
/* @__PURE__ */ r("p", { className: "ll-expanded__overlay-text", children: u ? "Switching..." : "Connecting..." })
|
|
1778
1785
|
] }),
|
|
@@ -1781,7 +1788,7 @@ const Ni = ({
|
|
|
1781
1788
|
{
|
|
1782
1789
|
type: "button",
|
|
1783
1790
|
className: "ll-expanded__overlay ll-expanded__overlay--gesture",
|
|
1784
|
-
onClick:
|
|
1791
|
+
onClick: xt,
|
|
1785
1792
|
children: [
|
|
1786
1793
|
/* @__PURE__ */ r("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ r("path", { d: "M3 9v6h4l5 5V4L7 9H3zm13.54.12a5 5 0 0 1 0 5.76l-1.41-1.41a3 3 0 0 0 0-2.94L16.54 9.12z" }) }),
|
|
1787
1794
|
/* @__PURE__ */ r("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
|
|
@@ -1803,7 +1810,7 @@ const Ni = ({
|
|
|
1803
1810
|
),
|
|
1804
1811
|
Ke ? /* @__PURE__ */ S(Ve, { children: [
|
|
1805
1812
|
!U && /* @__PURE__ */ S("div", { className: "ll-expanded__topbar", ...We, children: [
|
|
1806
|
-
!
|
|
1813
|
+
!ie && /* @__PURE__ */ S("div", { className: "ll-expanded__topbar-left", children: [
|
|
1807
1814
|
/* @__PURE__ */ S("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1808
1815
|
/* @__PURE__ */ S(
|
|
1809
1816
|
"button",
|
|
@@ -1817,7 +1824,7 @@ const Ni = ({
|
|
|
1817
1824
|
"aria-expanded": qe ? m : void 0,
|
|
1818
1825
|
children: [
|
|
1819
1826
|
/* @__PURE__ */ r("span", { className: "ll-hpill__label", children: n }),
|
|
1820
|
-
qe && /* @__PURE__ */ r(
|
|
1827
|
+
qe && /* @__PURE__ */ r(Ht, {})
|
|
1821
1828
|
]
|
|
1822
1829
|
}
|
|
1823
1830
|
),
|
|
@@ -1868,7 +1875,7 @@ const Ni = ({
|
|
|
1868
1875
|
title: "Language: English",
|
|
1869
1876
|
children: [
|
|
1870
1877
|
/* @__PURE__ */ r("span", { className: "ll-hpill__label", children: "EN" }),
|
|
1871
|
-
/* @__PURE__ */ r(
|
|
1878
|
+
/* @__PURE__ */ r(Ht, {})
|
|
1872
1879
|
]
|
|
1873
1880
|
}
|
|
1874
1881
|
),
|
|
@@ -1938,7 +1945,7 @@ const Ni = ({
|
|
|
1938
1945
|
// pre-0.18.0 behavior) left users no way out short of scrolling
|
|
1939
1946
|
// the page itself.
|
|
1940
1947
|
/* @__PURE__ */ S("div", { className: "ll-expanded__header ll-expanded__header--idle", ...We, children: [
|
|
1941
|
-
!U && (
|
|
1948
|
+
!U && (ft ? /* @__PURE__ */ S(
|
|
1942
1949
|
"a",
|
|
1943
1950
|
{
|
|
1944
1951
|
className: "ll-expanded__brand ll-expanded__brand--link",
|
|
@@ -1949,10 +1956,10 @@ const Ni = ({
|
|
|
1949
1956
|
title: "Powered by LiveLayer — visit livelayer.studio",
|
|
1950
1957
|
children: [
|
|
1951
1958
|
/* @__PURE__ */ r(Li, { size: 14, className: "ll-expanded__brand-mark" }),
|
|
1952
|
-
/* @__PURE__ */ r("span", { children:
|
|
1959
|
+
/* @__PURE__ */ r("span", { children: Re })
|
|
1953
1960
|
]
|
|
1954
1961
|
}
|
|
1955
|
-
) : /* @__PURE__ */ r("span", { className: "ll-expanded__brand", children:
|
|
1962
|
+
) : /* @__PURE__ */ r("span", { className: "ll-expanded__brand", children: Re })),
|
|
1956
1963
|
/* @__PURE__ */ S("div", { className: "ll-expanded__header-actions", children: [
|
|
1957
1964
|
!U && W !== !1 && /* @__PURE__ */ r(
|
|
1958
1965
|
"button",
|
|
@@ -1977,15 +1984,15 @@ const Ni = ({
|
|
|
1977
1984
|
] })
|
|
1978
1985
|
] })
|
|
1979
1986
|
),
|
|
1980
|
-
|
|
1981
|
-
const x = D ? "Resume session" :
|
|
1987
|
+
Ct && /* @__PURE__ */ (() => {
|
|
1988
|
+
const x = D ? "Resume session" : k === "disconnected" ? "Reconnect to agent" : "Start video call";
|
|
1982
1989
|
return /* @__PURE__ */ S(Ve, { children: [
|
|
1983
1990
|
!v && /* @__PURE__ */ S(
|
|
1984
1991
|
"button",
|
|
1985
1992
|
{
|
|
1986
1993
|
type: "button",
|
|
1987
1994
|
className: "ll-expanded__play",
|
|
1988
|
-
onClick:
|
|
1995
|
+
onClick: Me,
|
|
1989
1996
|
"aria-label": x,
|
|
1990
1997
|
children: [
|
|
1991
1998
|
/* @__PURE__ */ r("div", { className: "ll-expanded__play-circle", children: /* @__PURE__ */ r("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ r("polygon", { points: "6 3 20 12 6 21 6 3" }) }) }),
|
|
@@ -2000,7 +2007,7 @@ const Ni = ({
|
|
|
2000
2007
|
{
|
|
2001
2008
|
type: "button",
|
|
2002
2009
|
className: "ll-expanded__cta",
|
|
2003
|
-
onClick:
|
|
2010
|
+
onClick: Me,
|
|
2004
2011
|
"aria-label": x,
|
|
2005
2012
|
children: x
|
|
2006
2013
|
}
|
|
@@ -2016,14 +2023,14 @@ const Ni = ({
|
|
|
2016
2023
|
/* @__PURE__ */ r(
|
|
2017
2024
|
"div",
|
|
2018
2025
|
{
|
|
2019
|
-
ref:
|
|
2026
|
+
ref: ve,
|
|
2020
2027
|
className: f ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
2021
2028
|
}
|
|
2022
2029
|
),
|
|
2023
2030
|
/* @__PURE__ */ r(
|
|
2024
2031
|
"div",
|
|
2025
2032
|
{
|
|
2026
|
-
ref:
|
|
2033
|
+
ref: de,
|
|
2027
2034
|
className: !f && J ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
2028
2035
|
}
|
|
2029
2036
|
)
|
|
@@ -2031,23 +2038,23 @@ const Ni = ({
|
|
|
2031
2038
|
}
|
|
2032
2039
|
),
|
|
2033
2040
|
Ke ? /* @__PURE__ */ S("div", { className: "ll-expanded__bottom", children: [
|
|
2034
|
-
!U &&
|
|
2041
|
+
!U && Qe && /* @__PURE__ */ r(
|
|
2035
2042
|
"div",
|
|
2036
2043
|
{
|
|
2037
2044
|
className: "ll-expanded__transcript ll-expanded__transcript--agent",
|
|
2038
2045
|
"data-role": "agent",
|
|
2039
|
-
children: /* @__PURE__ */ r("p", { className: "ll-expanded__transcript-text", children:
|
|
2046
|
+
children: /* @__PURE__ */ r("p", { className: "ll-expanded__transcript-text", children: Qe })
|
|
2040
2047
|
}
|
|
2041
2048
|
),
|
|
2042
|
-
!U &&
|
|
2049
|
+
!U && pt && /* @__PURE__ */ r(
|
|
2043
2050
|
"div",
|
|
2044
2051
|
{
|
|
2045
2052
|
className: "ll-expanded__transcript ll-expanded__transcript--user",
|
|
2046
2053
|
"data-role": "user",
|
|
2047
|
-
children: /* @__PURE__ */ r("p", { className: "ll-expanded__transcript-text", children:
|
|
2054
|
+
children: /* @__PURE__ */ r("p", { className: "ll-expanded__transcript-text", children: pt })
|
|
2048
2055
|
}
|
|
2049
2056
|
),
|
|
2050
|
-
!
|
|
2057
|
+
!ie && !U && /* @__PURE__ */ S("div", { className: "ll-toolbar", onClick: (x) => x.stopPropagation(), children: [
|
|
2051
2058
|
X && /* @__PURE__ */ r(
|
|
2052
2059
|
"button",
|
|
2053
2060
|
{
|
|
@@ -2074,27 +2081,27 @@ const Ni = ({
|
|
|
2074
2081
|
/* @__PURE__ */ r(
|
|
2075
2082
|
"button",
|
|
2076
2083
|
{
|
|
2077
|
-
ref:
|
|
2084
|
+
ref: At,
|
|
2078
2085
|
type: "button",
|
|
2079
2086
|
className: `ll-tool ll-tool--right ${J ? "is-on" : ""}`,
|
|
2080
2087
|
onClick: (x) => {
|
|
2081
|
-
x.stopPropagation(),
|
|
2088
|
+
x.stopPropagation(), be((ae) => !ae), Ze(!1);
|
|
2082
2089
|
},
|
|
2083
2090
|
"aria-label": "Camera devices",
|
|
2084
2091
|
"aria-haspopup": "listbox",
|
|
2085
|
-
"aria-expanded":
|
|
2086
|
-
children: /* @__PURE__ */ r(
|
|
2092
|
+
"aria-expanded": pe,
|
|
2093
|
+
children: /* @__PURE__ */ r(Ht, {})
|
|
2087
2094
|
}
|
|
2088
2095
|
),
|
|
2089
|
-
|
|
2096
|
+
pe && H.length > 0 && /* @__PURE__ */ r(
|
|
2090
2097
|
Bn,
|
|
2091
2098
|
{
|
|
2092
2099
|
label: "Camera",
|
|
2093
2100
|
devices: H,
|
|
2094
2101
|
activeId: G,
|
|
2095
|
-
anchorRef:
|
|
2102
|
+
anchorRef: At,
|
|
2096
2103
|
onPick: (x) => {
|
|
2097
|
-
|
|
2104
|
+
be(!1), Ge(x);
|
|
2098
2105
|
}
|
|
2099
2106
|
}
|
|
2100
2107
|
)
|
|
@@ -2114,16 +2121,16 @@ const Ni = ({
|
|
|
2114
2121
|
/* @__PURE__ */ r(
|
|
2115
2122
|
"button",
|
|
2116
2123
|
{
|
|
2117
|
-
ref:
|
|
2124
|
+
ref: Et,
|
|
2118
2125
|
type: "button",
|
|
2119
2126
|
className: `ll-tool ll-tool--right ${O ? "is-muted" : ""}`,
|
|
2120
2127
|
onClick: (x) => {
|
|
2121
|
-
x.stopPropagation(),
|
|
2128
|
+
x.stopPropagation(), Ze((ae) => !ae), be(!1);
|
|
2122
2129
|
},
|
|
2123
2130
|
"aria-label": "Microphone devices",
|
|
2124
2131
|
"aria-haspopup": "listbox",
|
|
2125
2132
|
"aria-expanded": Je,
|
|
2126
|
-
children: /* @__PURE__ */ r(
|
|
2133
|
+
children: /* @__PURE__ */ r(Ht, {})
|
|
2127
2134
|
}
|
|
2128
2135
|
),
|
|
2129
2136
|
Je && z.length > 0 && /* @__PURE__ */ r(
|
|
@@ -2132,9 +2139,9 @@ const Ni = ({
|
|
|
2132
2139
|
label: "Microphone",
|
|
2133
2140
|
devices: z,
|
|
2134
2141
|
activeId: B,
|
|
2135
|
-
anchorRef:
|
|
2142
|
+
anchorRef: Et,
|
|
2136
2143
|
onPick: (x) => {
|
|
2137
|
-
|
|
2144
|
+
Ze(!1), Lt(x);
|
|
2138
2145
|
}
|
|
2139
2146
|
}
|
|
2140
2147
|
)
|
|
@@ -2162,7 +2169,7 @@ const Ni = ({
|
|
|
2162
2169
|
}
|
|
2163
2170
|
)
|
|
2164
2171
|
] }),
|
|
2165
|
-
!
|
|
2172
|
+
!ie && U && /* @__PURE__ */ r(
|
|
2166
2173
|
Si,
|
|
2167
2174
|
{
|
|
2168
2175
|
isMuted: O,
|
|
@@ -2176,24 +2183,24 @@ const Ni = ({
|
|
|
2176
2183
|
isSpeakerMuted: $,
|
|
2177
2184
|
onToggleSpeaker: He,
|
|
2178
2185
|
allowTyping: ee,
|
|
2179
|
-
isTypingOpen:
|
|
2180
|
-
onToggleTyping:
|
|
2186
|
+
isTypingOpen: Nt,
|
|
2187
|
+
onToggleTyping: an,
|
|
2181
2188
|
onDisconnect: st
|
|
2182
2189
|
}
|
|
2183
2190
|
),
|
|
2184
|
-
!
|
|
2191
|
+
!ie && ee && (U ? Nt : !0) && /* @__PURE__ */ S("form", { className: "ll-message-input", onSubmit: Ae, children: [
|
|
2185
2192
|
/* @__PURE__ */ r(
|
|
2186
2193
|
"input",
|
|
2187
2194
|
{
|
|
2188
2195
|
type: "text",
|
|
2189
2196
|
className: "ll-message-input__field",
|
|
2190
2197
|
placeholder: "Message...",
|
|
2191
|
-
value:
|
|
2192
|
-
onChange: (x) =>
|
|
2198
|
+
value: _e,
|
|
2199
|
+
onChange: (x) => Te(x.target.value),
|
|
2193
2200
|
"aria-label": "Message the agent"
|
|
2194
2201
|
}
|
|
2195
2202
|
),
|
|
2196
|
-
|
|
2203
|
+
_e.trim() && /* @__PURE__ */ r(
|
|
2197
2204
|
"button",
|
|
2198
2205
|
{
|
|
2199
2206
|
type: "submit",
|
|
@@ -2205,7 +2212,7 @@ const Ni = ({
|
|
|
2205
2212
|
] })
|
|
2206
2213
|
] }) : null,
|
|
2207
2214
|
(() => {
|
|
2208
|
-
if (y &&
|
|
2215
|
+
if (y && k !== "error")
|
|
2209
2216
|
return /* @__PURE__ */ S("div", { className: "ll-expanded__banner", role: "alert", children: [
|
|
2210
2217
|
/* @__PURE__ */ r("span", { children: y }),
|
|
2211
2218
|
/* @__PURE__ */ r(
|
|
@@ -2219,8 +2226,8 @@ const Ni = ({
|
|
|
2219
2226
|
}
|
|
2220
2227
|
)
|
|
2221
2228
|
] });
|
|
2222
|
-
if (!v ||
|
|
2223
|
-
let x = "Failed to connect",
|
|
2229
|
+
if (!v || k !== "error") return null;
|
|
2230
|
+
let x = "Failed to connect", ae = "Try again";
|
|
2224
2231
|
return v === "MIC_PERMISSION_DENIED" ? x = "Microphone blocked. Allow access to talk." : v === "MIC_NOT_FOUND" ? x = "No microphone found. Plug one in + retry." : v === "MIC_UNAVAILABLE" ? x = "Mic unavailable. Check other apps using it." : v === "AGENT_TIMEOUT" ? x = "Agent didn't pick up. Try again." : v === "CONNECT_FAILED" ? x = "Connection failed. Check your network." : v.length < 80 && (x = v), /* @__PURE__ */ S("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
|
|
2225
2232
|
/* @__PURE__ */ r("span", { children: x }),
|
|
2226
2233
|
/* @__PURE__ */ r(
|
|
@@ -2228,8 +2235,8 @@ const Ni = ({
|
|
|
2228
2235
|
{
|
|
2229
2236
|
type: "button",
|
|
2230
2237
|
className: "ll-expanded__banner-retry",
|
|
2231
|
-
onClick:
|
|
2232
|
-
children:
|
|
2238
|
+
onClick: _t,
|
|
2239
|
+
children: ae
|
|
2233
2240
|
}
|
|
2234
2241
|
)
|
|
2235
2242
|
] });
|
|
@@ -2250,7 +2257,7 @@ const Ni = ({
|
|
|
2250
2257
|
}
|
|
2251
2258
|
);
|
|
2252
2259
|
};
|
|
2253
|
-
function
|
|
2260
|
+
function Ht() {
|
|
2254
2261
|
return /* @__PURE__ */ r("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ r("polyline", { points: "6 9 12 15 18 9" }) });
|
|
2255
2262
|
}
|
|
2256
2263
|
function On() {
|
|
@@ -2328,7 +2335,7 @@ const Bn = ({
|
|
|
2328
2335
|
return a(), window.addEventListener("scroll", a, !0), window.addEventListener("resize", a), () => {
|
|
2329
2336
|
window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", a);
|
|
2330
2337
|
};
|
|
2331
|
-
}, [l]), o === null || typeof document > "u" ? null :
|
|
2338
|
+
}, [l]), o === null || typeof document > "u" ? null : on(
|
|
2332
2339
|
/* @__PURE__ */ S(
|
|
2333
2340
|
"div",
|
|
2334
2341
|
{
|
|
@@ -2375,7 +2382,7 @@ const Bn = ({
|
|
|
2375
2382
|
"[data-ll-skip]",
|
|
2376
2383
|
".ll-widget"
|
|
2377
2384
|
];
|
|
2378
|
-
function
|
|
2385
|
+
function Bt(e) {
|
|
2379
2386
|
let t = e;
|
|
2380
2387
|
for (; t; ) {
|
|
2381
2388
|
for (const n of Ii)
|
|
@@ -2384,8 +2391,8 @@ function Ft(e) {
|
|
|
2384
2391
|
}
|
|
2385
2392
|
return !1;
|
|
2386
2393
|
}
|
|
2387
|
-
function
|
|
2388
|
-
if (
|
|
2394
|
+
function tn(e) {
|
|
2395
|
+
if (Bt(e)) return !1;
|
|
2389
2396
|
if (e instanceof HTMLInputElement) {
|
|
2390
2397
|
if (e.type === "password") return !1;
|
|
2391
2398
|
const t = (e.getAttribute("autocomplete") || "").toLowerCase();
|
|
@@ -2393,13 +2400,13 @@ function nn(e) {
|
|
|
2393
2400
|
}
|
|
2394
2401
|
return !0;
|
|
2395
2402
|
}
|
|
2396
|
-
const Ti = /\b(continue|next|proceed|move\s*on|forward)\b|→|›/i, Wn = /\b(back|previous|prev|go\s*back)\b|←|‹/i, Ri = /\b(submit|finish|done|complete|send)\b/i,
|
|
2403
|
+
const Ti = /\b(continue|next|proceed|move\s*on|forward)\b|→|›/i, Wn = /\b(back|previous|prev|go\s*back)\b|←|‹/i, Ri = /\b(submit|finish|done|complete|send)\b/i, wt = /* @__PURE__ */ new Map();
|
|
2397
2404
|
function qn(e) {
|
|
2398
|
-
const t =
|
|
2405
|
+
const t = wt.get(e);
|
|
2399
2406
|
return t && t.isConnected ? t : null;
|
|
2400
2407
|
}
|
|
2401
2408
|
function it(e) {
|
|
2402
|
-
if (
|
|
2409
|
+
if (Bt(e) || e.hidden || e.getAttribute("aria-hidden") === "true") return !0;
|
|
2403
2410
|
const t = typeof window < "u" && window.getComputedStyle ? window.getComputedStyle(e) : null;
|
|
2404
2411
|
return !!(t && (t.display === "none" || t.visibility === "hidden"));
|
|
2405
2412
|
}
|
|
@@ -2415,14 +2422,14 @@ function zi(e) {
|
|
|
2415
2422
|
);
|
|
2416
2423
|
}
|
|
2417
2424
|
function cr(e) {
|
|
2418
|
-
|
|
2425
|
+
wt.clear();
|
|
2419
2426
|
const t = zi(e);
|
|
2420
2427
|
let n, i, l;
|
|
2421
2428
|
for (const a of t) {
|
|
2422
2429
|
const c = Pi(a);
|
|
2423
2430
|
if (!c || c.length > 40) continue;
|
|
2424
2431
|
const u = a.getAttribute("type") === "submit" || a.tagName === "BUTTON" && !a.getAttribute("type") && !!a.closest("form");
|
|
2425
|
-
!n && Ti.test(c) && !Wn.test(c) ? (n = { id: "ll-advance", label: c },
|
|
2432
|
+
!n && Ti.test(c) && !Wn.test(c) ? (n = { id: "ll-advance", label: c }, wt.set("ll-advance", a)) : !i && Wn.test(c) ? (i = { id: "ll-back", label: c }, wt.set("ll-back", a)) : !l && (Ri.test(c) || u) && (l = { id: "ll-submit", label: c }, wt.set("ll-submit", a));
|
|
2426
2433
|
}
|
|
2427
2434
|
const o = qi(e);
|
|
2428
2435
|
return { kind: n || o.totalSteps ? "multi-step" : "single-page", advance: n, back: i, submit: l, ...o };
|
|
@@ -2497,7 +2504,7 @@ function qi(e) {
|
|
|
2497
2504
|
}
|
|
2498
2505
|
return {};
|
|
2499
2506
|
}
|
|
2500
|
-
const
|
|
2507
|
+
const Ot = 4096, Ui = 20, ji = 20, Vi = 10, Yi = 10, Gi = 30, Xi = 20, Vn = 500, Ki = [
|
|
2501
2508
|
'[data-ll-private="true"]',
|
|
2502
2509
|
".ll-widget",
|
|
2503
2510
|
"script",
|
|
@@ -2505,7 +2512,7 @@ const Ht = 4096, Ui = 20, ji = 20, Vi = 10, Yi = 10, Gi = 30, Xi = 20, Vn = 500,
|
|
|
2505
2512
|
"noscript",
|
|
2506
2513
|
"iframe"
|
|
2507
2514
|
];
|
|
2508
|
-
function
|
|
2515
|
+
function vt(e) {
|
|
2509
2516
|
if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
|
|
2510
2517
|
let t = e;
|
|
2511
2518
|
for (; t; ) {
|
|
@@ -2515,7 +2522,7 @@ function yt(e) {
|
|
|
2515
2522
|
}
|
|
2516
2523
|
return !1;
|
|
2517
2524
|
}
|
|
2518
|
-
function
|
|
2525
|
+
function bt(e) {
|
|
2519
2526
|
if (typeof window > "u") return !0;
|
|
2520
2527
|
const t = e.getBoundingClientRect();
|
|
2521
2528
|
if (t.width <= 0 || t.height <= 0) return !1;
|
|
@@ -2603,7 +2610,7 @@ function Qi(e, t = {}) {
|
|
|
2603
2610
|
), a = [];
|
|
2604
2611
|
for (const y of s) {
|
|
2605
2612
|
if (a.length >= Vi) break;
|
|
2606
|
-
if (
|
|
2613
|
+
if (vt(y) || !bt(y)) continue;
|
|
2607
2614
|
const z = y.getAttribute("data-ll-region") ?? "", B = y.getAttribute("data-ll-intent") ?? void 0, J = ce(
|
|
2608
2615
|
(y.innerText || y.textContent || "").trim(),
|
|
2609
2616
|
Vn * 2
|
|
@@ -2614,13 +2621,13 @@ function Qi(e, t = {}) {
|
|
|
2614
2621
|
n.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
|
2615
2622
|
);
|
|
2616
2623
|
for (const y of m) {
|
|
2617
|
-
if (
|
|
2624
|
+
if (vt(y) || !bt(y)) continue;
|
|
2618
2625
|
const z = (y.textContent || "").trim();
|
|
2619
2626
|
z && c.push(`${y.tagName}: ${ce(z, 200)}`);
|
|
2620
2627
|
}
|
|
2621
2628
|
const p = Array.from(n.querySelectorAll("p, li"));
|
|
2622
2629
|
for (const y of p) {
|
|
2623
|
-
if (
|
|
2630
|
+
if (vt(y) || !bt(y) || u.includes(y.tagName)) continue;
|
|
2624
2631
|
const z = (y.textContent || "").trim();
|
|
2625
2632
|
z.length > 10 && c.push(ce(z, Vn));
|
|
2626
2633
|
}
|
|
@@ -2628,36 +2635,36 @@ function Qi(e, t = {}) {
|
|
|
2628
2635
|
`), P = [], _ = Array.from(n.querySelectorAll("a[href]"));
|
|
2629
2636
|
for (const y of _) {
|
|
2630
2637
|
if (P.length >= Ui) break;
|
|
2631
|
-
if (
|
|
2638
|
+
if (vt(y) || !bt(y)) continue;
|
|
2632
2639
|
const z = y.getAttribute("href") || "", B = (y.textContent || "").trim();
|
|
2633
2640
|
!z || !B || P.push({ href: z, text: ce(B, 100) });
|
|
2634
2641
|
}
|
|
2635
|
-
const
|
|
2642
|
+
const k = [], g = Array.from(
|
|
2636
2643
|
n.querySelectorAll(
|
|
2637
2644
|
"input, textarea, select"
|
|
2638
2645
|
)
|
|
2639
2646
|
);
|
|
2640
2647
|
for (const y of g) {
|
|
2641
|
-
if (
|
|
2642
|
-
if (
|
|
2648
|
+
if (k.length >= ji) break;
|
|
2649
|
+
if (vt(y) || !tn(y) || !bt(y)) continue;
|
|
2643
2650
|
const z = Yn(y), B = y instanceof HTMLInputElement ? y.type : y.tagName.toLowerCase();
|
|
2644
|
-
z &&
|
|
2651
|
+
z && k.push({ label: ce(z, 100), type: B });
|
|
2645
2652
|
}
|
|
2646
2653
|
const w = Array.from(n.querySelectorAll("form")), D = [];
|
|
2647
2654
|
let E = 0;
|
|
2648
2655
|
for (const y of w) {
|
|
2649
2656
|
if (D.length >= Yi) break;
|
|
2650
|
-
if (
|
|
2657
|
+
if (Bt(y) || y.matches(".ll-widget *, .ll-widget")) continue;
|
|
2651
2658
|
const z = y.getAttribute("id") || y.getAttribute("name") || Ji(y.getAttribute("data-ll-intent")) || `form_${E++}`, B = y.getAttribute("data-ll-intent") || Zi(y) || void 0, J = Array.from(
|
|
2652
2659
|
y.querySelectorAll(
|
|
2653
2660
|
"input, textarea, select"
|
|
2654
2661
|
)
|
|
2655
|
-
),
|
|
2662
|
+
), le = [];
|
|
2656
2663
|
let H = 0;
|
|
2657
2664
|
const G = /* @__PURE__ */ new Set();
|
|
2658
2665
|
for (const f of J) {
|
|
2659
|
-
if (
|
|
2660
|
-
if (!
|
|
2666
|
+
if (le.length >= Gi) break;
|
|
2667
|
+
if (!tn(f)) continue;
|
|
2661
2668
|
if (f instanceof HTMLInputElement) {
|
|
2662
2669
|
const U = f.type;
|
|
2663
2670
|
if (U === "submit" || U === "button" || U === "reset" || U === "hidden" || U === "image" || U === "file") continue;
|
|
@@ -2691,8 +2698,8 @@ function Qi(e, t = {}) {
|
|
|
2691
2698
|
ge !== null && (W.max = ce(ge, 50));
|
|
2692
2699
|
const Z = f.getAttribute("step");
|
|
2693
2700
|
Z !== null && (W.step = ce(Z, 20));
|
|
2694
|
-
const
|
|
2695
|
-
|
|
2701
|
+
const Ce = f.getAttribute("pattern");
|
|
2702
|
+
Ce !== null && (W.pattern = ce(Ce, 200));
|
|
2696
2703
|
const ne = (f.getAttribute("autocomplete") || "").toLowerCase();
|
|
2697
2704
|
ne && ne !== "off" && !ne.startsWith("cc-") && (W.autocomplete = ce(ne, 50));
|
|
2698
2705
|
}
|
|
@@ -2702,19 +2709,19 @@ function Qi(e, t = {}) {
|
|
|
2702
2709
|
const Z = f.options[ge];
|
|
2703
2710
|
if (!Z) continue;
|
|
2704
2711
|
if (Z.value === "" || Z.disabled) {
|
|
2705
|
-
const
|
|
2706
|
-
if (
|
|
2712
|
+
const Me = (Z.textContent || "").trim();
|
|
2713
|
+
if (Me && !W.placeholderOption && (W.placeholderOption = ce(Me, 60)), W.hasEmptyOption = !0, Z.disabled) continue;
|
|
2707
2714
|
}
|
|
2708
2715
|
if (U.length >= Xi) break;
|
|
2709
|
-
const
|
|
2710
|
-
!
|
|
2716
|
+
const Ce = Z.value || "", ne = (Z.textContent || "").trim() || Ce;
|
|
2717
|
+
!Ce && !ne || U.push({ value: Ce, label: ce(ne, 60) });
|
|
2711
2718
|
}
|
|
2712
2719
|
U.length > 0 && (W.options = U);
|
|
2713
2720
|
}
|
|
2714
|
-
const
|
|
2715
|
-
|
|
2721
|
+
const ie = typeof f.validationMessage == "string" ? f.validationMessage : "";
|
|
2722
|
+
ie && (W.validationMessage = ce(ie, 200)), le.push(W);
|
|
2716
2723
|
}
|
|
2717
|
-
D.push({ id: z, intent: B, fields:
|
|
2724
|
+
D.push({ id: z, intent: B, fields: le });
|
|
2718
2725
|
}
|
|
2719
2726
|
const v = {
|
|
2720
2727
|
url: i,
|
|
@@ -2723,17 +2730,17 @@ function Qi(e, t = {}) {
|
|
|
2723
2730
|
regions: a,
|
|
2724
2731
|
visibleText: h,
|
|
2725
2732
|
visibleLinks: P,
|
|
2726
|
-
visibleFields:
|
|
2733
|
+
visibleFields: k,
|
|
2727
2734
|
forms: D,
|
|
2728
2735
|
flow: cr(n),
|
|
2729
2736
|
extras: e
|
|
2730
2737
|
};
|
|
2731
2738
|
let O = rt(JSON.stringify(v.regions)) + rt(v.visibleText) + rt(JSON.stringify(v.visibleLinks)) + rt(JSON.stringify(v.visibleFields));
|
|
2732
|
-
for (; O >
|
|
2739
|
+
for (; O > Ot && v.visibleFields.length > 0; )
|
|
2733
2740
|
v.visibleFields.pop(), O = rt(JSON.stringify(v.visibleFields));
|
|
2734
|
-
for (; O >
|
|
2741
|
+
for (; O > Ot && v.visibleLinks.length > 0; )
|
|
2735
2742
|
v.visibleLinks.pop(), O -= 80;
|
|
2736
|
-
return rt(v.visibleText) >
|
|
2743
|
+
return rt(v.visibleText) > Ot && (v.visibleText = ce(v.visibleText, Ot - 100)), v;
|
|
2737
2744
|
}
|
|
2738
2745
|
let ot = null;
|
|
2739
2746
|
function eo(e) {
|
|
@@ -2773,7 +2780,7 @@ function oo(e) {
|
|
|
2773
2780
|
const n = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), l = [], o = Array.from(t.querySelectorAll("a[href]"));
|
|
2774
2781
|
for (const s of o) {
|
|
2775
2782
|
if (l.length >= no) break;
|
|
2776
|
-
if (
|
|
2783
|
+
if (Bt(s)) continue;
|
|
2777
2784
|
const a = s.getAttribute("href") || "";
|
|
2778
2785
|
if (!io(a)) continue;
|
|
2779
2786
|
let c = a, u = !0;
|
|
@@ -2794,7 +2801,7 @@ function oo(e) {
|
|
|
2794
2801
|
}
|
|
2795
2802
|
let lt = null;
|
|
2796
2803
|
const lo = 5e3;
|
|
2797
|
-
function
|
|
2804
|
+
function Zt() {
|
|
2798
2805
|
const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
|
|
2799
2806
|
if (lt && lt.pathname === t && e - lt.at < lo)
|
|
2800
2807
|
return lt.routes;
|
|
@@ -2804,7 +2811,7 @@ function Qt() {
|
|
|
2804
2811
|
function ao() {
|
|
2805
2812
|
lt = null;
|
|
2806
2813
|
}
|
|
2807
|
-
function
|
|
2814
|
+
function nn(e) {
|
|
2808
2815
|
if (e instanceof HTMLInputElement) {
|
|
2809
2816
|
const t = e.type;
|
|
2810
2817
|
if (t === "submit" || t === "button" || t === "reset" || t === "hidden" || t === "image" || t === "file")
|
|
@@ -2818,7 +2825,7 @@ function so(e, t) {
|
|
|
2818
2825
|
function ze(e) {
|
|
2819
2826
|
return e.toLowerCase().replace(/[^a-z0-9]+/g, "");
|
|
2820
2827
|
}
|
|
2821
|
-
function
|
|
2828
|
+
function Qt(e) {
|
|
2822
2829
|
const t = e.lastIndexOf(".");
|
|
2823
2830
|
return t >= 0 ? e.slice(t + 1) : e;
|
|
2824
2831
|
}
|
|
@@ -2843,17 +2850,17 @@ function uo(e, t) {
|
|
|
2843
2850
|
for (const o of Array.from(
|
|
2844
2851
|
e.querySelectorAll("input, textarea, select")
|
|
2845
2852
|
)) {
|
|
2846
|
-
if (!
|
|
2853
|
+
if (!nn(o)) continue;
|
|
2847
2854
|
const s = o.getAttribute("name") || "", a = o.getAttribute("id") || "", c = [
|
|
2848
|
-
ze(
|
|
2849
|
-
ze(
|
|
2855
|
+
ze(Qt(s)),
|
|
2856
|
+
ze(Qt(a)),
|
|
2850
2857
|
ze(s),
|
|
2851
2858
|
ze(a)
|
|
2852
2859
|
];
|
|
2853
2860
|
let u = 0;
|
|
2854
2861
|
c.some((m) => m.length >= 2 && m === n) ? u = 4 : [
|
|
2855
2862
|
ze(s),
|
|
2856
|
-
ze(
|
|
2863
|
+
ze(Qt(s)),
|
|
2857
2864
|
ze(co(o))
|
|
2858
2865
|
].some((p) => p.length >= 3 && (p.includes(n) || n.includes(p))) && (u = 2), u > l && (l = u, i = o);
|
|
2859
2866
|
}
|
|
@@ -2865,7 +2872,7 @@ function fo(e, t) {
|
|
|
2865
2872
|
const o = e.querySelector(
|
|
2866
2873
|
`[name="${t.replace(/"/g, '\\"')}"]`
|
|
2867
2874
|
);
|
|
2868
|
-
if (o &&
|
|
2875
|
+
if (o && nn(o)) return o;
|
|
2869
2876
|
} catch {
|
|
2870
2877
|
}
|
|
2871
2878
|
const n = Array.from(
|
|
@@ -2874,7 +2881,7 @@ function fo(e, t) {
|
|
|
2874
2881
|
let i = 0;
|
|
2875
2882
|
const l = /* @__PURE__ */ new Map();
|
|
2876
2883
|
for (const o of n) {
|
|
2877
|
-
if (!
|
|
2884
|
+
if (!nn(o)) continue;
|
|
2878
2885
|
const s = so(o, i);
|
|
2879
2886
|
let a = s;
|
|
2880
2887
|
if (l.has(s) && (a = `${s}__${i}`), a === t) return o;
|
|
@@ -2884,7 +2891,7 @@ function fo(e, t) {
|
|
|
2884
2891
|
}
|
|
2885
2892
|
function Xn(e, t) {
|
|
2886
2893
|
const n = fo(e, t);
|
|
2887
|
-
return n ?
|
|
2894
|
+
return n ? tn(n) ? { el: n } : { el: null, reason: "private" } : { el: null, reason: "not_found" };
|
|
2888
2895
|
}
|
|
2889
2896
|
function po(e, t) {
|
|
2890
2897
|
const n = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, i = Object.getOwnPropertyDescriptor(n, "value"), l = i == null ? void 0 : i.set;
|
|
@@ -3021,9 +3028,9 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3021
3028
|
// to onAgentCommand.
|
|
3022
3029
|
"task_field_updated",
|
|
3023
3030
|
"task_completed"
|
|
3024
|
-
]), dr =
|
|
3031
|
+
]), dr = rn(
|
|
3025
3032
|
function(t, n) {
|
|
3026
|
-
var vn, bn, wn, _n, xn, Ln,
|
|
3033
|
+
var vn, bn, wn, _n, xn, Ln, Cn;
|
|
3027
3034
|
const {
|
|
3028
3035
|
agentId: i,
|
|
3029
3036
|
apiKey: l,
|
|
@@ -3044,7 +3051,7 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3044
3051
|
defaultDisplayMode: h = "expanded",
|
|
3045
3052
|
onDisplayModeChange: P,
|
|
3046
3053
|
position: _ = "bottom-right",
|
|
3047
|
-
mobileBreakpoint:
|
|
3054
|
+
mobileBreakpoint: k = 640,
|
|
3048
3055
|
draggable: g,
|
|
3049
3056
|
resizable: w,
|
|
3050
3057
|
persistKey: D = "ll-widget",
|
|
@@ -3055,7 +3062,7 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3055
3062
|
idleLoopUrl: z,
|
|
3056
3063
|
greeting: B,
|
|
3057
3064
|
avatarImageUrl: J,
|
|
3058
|
-
agentName:
|
|
3065
|
+
agentName: le,
|
|
3059
3066
|
branding: H = {},
|
|
3060
3067
|
allowCamera: G = !0,
|
|
3061
3068
|
allowScreenShare: f = !0,
|
|
@@ -3066,18 +3073,18 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3066
3073
|
chromeless: ee = !1,
|
|
3067
3074
|
floatingChromeContainer: W = null,
|
|
3068
3075
|
compactControls: te = !1,
|
|
3069
|
-
transforming:
|
|
3076
|
+
transforming: ie = !1,
|
|
3070
3077
|
transformingLabel: U = "Transforming…",
|
|
3071
3078
|
showOn: ge,
|
|
3072
3079
|
hideOn: Z,
|
|
3073
|
-
pathname:
|
|
3080
|
+
pathname: Ce,
|
|
3074
3081
|
onNavigate: ne,
|
|
3075
|
-
onScrollToSelector:
|
|
3082
|
+
onScrollToSelector: Me,
|
|
3076
3083
|
getPageContext: st,
|
|
3077
|
-
pageContextExtras:
|
|
3078
|
-
getRoutes:
|
|
3084
|
+
pageContextExtras: _t,
|
|
3085
|
+
getRoutes: xt,
|
|
3079
3086
|
onScrollPage: ct,
|
|
3080
|
-
onClick:
|
|
3087
|
+
onClick: Lt,
|
|
3081
3088
|
capabilities: Ye,
|
|
3082
3089
|
onConnect: Ge,
|
|
3083
3090
|
onDisconnect: $e,
|
|
@@ -3091,49 +3098,49 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3091
3098
|
className: qe,
|
|
3092
3099
|
style: Ke,
|
|
3093
3100
|
zIndex: ke = 2147483647
|
|
3094
|
-
} = t,
|
|
3101
|
+
} = t, Ct = ri(Ce), ut = ui(Ct, ge, Z);
|
|
3095
3102
|
I(() => {
|
|
3096
3103
|
to(), ao();
|
|
3097
|
-
}, [
|
|
3098
|
-
const
|
|
3104
|
+
}, [Ct]);
|
|
3105
|
+
const Ie = O !== void 0, [dt, kt] = M(() => {
|
|
3099
3106
|
var b;
|
|
3100
3107
|
return O ?? ((b = v == null ? void 0 : v[0]) == null ? void 0 : b.id);
|
|
3101
|
-
}),
|
|
3102
|
-
() => (v == null ? void 0 : v.find((b) => b.id ===
|
|
3103
|
-
[v,
|
|
3104
|
-
),
|
|
3108
|
+
}), Ue = Ie ? O : dt, ue = at(
|
|
3109
|
+
() => (v == null ? void 0 : v.find((b) => b.id === Ue)) ?? null,
|
|
3110
|
+
[v, Ue]
|
|
3111
|
+
), St = (ue == null ? void 0 : ue.agentId) ?? i, de = u === "EMBEDDED", ve = Xr(k), [Je, Ze] = Yr({
|
|
3105
3112
|
value: p,
|
|
3106
3113
|
defaultValue: h,
|
|
3107
3114
|
onChange: P,
|
|
3108
3115
|
persistKey: D,
|
|
3109
|
-
disablePersistence:
|
|
3110
|
-
}), pe =
|
|
3111
|
-
} :
|
|
3112
|
-
draggable: !
|
|
3113
|
-
resizable: !
|
|
3116
|
+
disablePersistence: de || E
|
|
3117
|
+
}), pe = de ? "expanded" : Je, be = de ? () => {
|
|
3118
|
+
} : Ze, Et = q ?? !de, At = X ?? !de, Nt = te || !de && ve, _e = ti({
|
|
3119
|
+
draggable: !de && (g ?? !ve),
|
|
3120
|
+
resizable: !de && (w ?? !ve),
|
|
3114
3121
|
persistKey: D,
|
|
3115
|
-
disablePersistence:
|
|
3116
|
-
}),
|
|
3117
|
-
|
|
3118
|
-
const
|
|
3119
|
-
|
|
3120
|
-
function
|
|
3121
|
-
const d =
|
|
3122
|
+
disablePersistence: de || E
|
|
3123
|
+
}), Te = Pr(), Ae = Or(), Re = Fr(), ft = Br(), [De, Se] = M(!1), [Qe, pt] = M(!1), [ht, et] = M(!1), [x, ae] = M(!1), [Wt, fr] = M(!1), Mt = fi({ baseUrl: o, config: c }), It = T(Mt);
|
|
3124
|
+
It.current = Mt;
|
|
3125
|
+
const qt = T(ne), Ut = T(Me), jt = T(ct), Vt = T(Lt), sn = T(st), cn = T(_t), un = T(xt), Yt = T(Ye), Ee = T(null);
|
|
3126
|
+
qt.current = ne, Ut.current = Me, jt.current = ct, Vt.current = Lt, sn.current = st, cn.current = _t, un.current = xt, Yt.current = Ye;
|
|
3127
|
+
function xe(b) {
|
|
3128
|
+
const d = Yt.current;
|
|
3122
3129
|
return d ? d.includes(b) : !0;
|
|
3123
3130
|
}
|
|
3124
|
-
function
|
|
3131
|
+
function Le(b, d) {
|
|
3125
3132
|
console.warn(
|
|
3126
3133
|
`[LiveLayer] Agent command "${b}" blocked — capability "${d}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
|
|
3127
3134
|
);
|
|
3128
3135
|
}
|
|
3129
|
-
const
|
|
3136
|
+
const mt = C(
|
|
3130
3137
|
(b) => {
|
|
3131
|
-
var
|
|
3138
|
+
var re, fe, Ne, yt, Pe, kn;
|
|
3132
3139
|
const d = b;
|
|
3133
3140
|
if (!(!d.type || typeof d.type != "string")) {
|
|
3134
3141
|
if (Be == null || Be({ eventName: d.type, data: b }), d.type === "navigate") {
|
|
3135
|
-
if (!
|
|
3136
|
-
|
|
3142
|
+
if (!xe("navigate")) {
|
|
3143
|
+
Le("navigate", "navigate");
|
|
3137
3144
|
return;
|
|
3138
3145
|
}
|
|
3139
3146
|
const N = typeof d.href == "string" ? d.href : null;
|
|
@@ -3143,9 +3150,9 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3143
3150
|
);
|
|
3144
3151
|
return;
|
|
3145
3152
|
}
|
|
3146
|
-
if (
|
|
3153
|
+
if (It.current.playPageChange(), qt.current) {
|
|
3147
3154
|
try {
|
|
3148
|
-
|
|
3155
|
+
qt.current(N);
|
|
3149
3156
|
} catch (R) {
|
|
3150
3157
|
console.warn(
|
|
3151
3158
|
`[LiveLayer] onNavigate threw for "${N}". Falling back. Error:`,
|
|
@@ -3175,16 +3182,16 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3175
3182
|
return;
|
|
3176
3183
|
}
|
|
3177
3184
|
if (d.type === "scroll_to") {
|
|
3178
|
-
if (!
|
|
3179
|
-
|
|
3185
|
+
if (!xe("scroll")) {
|
|
3186
|
+
Le("scroll_to", "scroll");
|
|
3180
3187
|
return;
|
|
3181
3188
|
}
|
|
3182
3189
|
const N = typeof d.selector == "string" ? d.selector : null;
|
|
3183
3190
|
if (!N) return;
|
|
3184
3191
|
const R = d.behavior === "instant" ? "instant" : "smooth";
|
|
3185
|
-
if (
|
|
3192
|
+
if (Ut.current) {
|
|
3186
3193
|
try {
|
|
3187
|
-
|
|
3194
|
+
Ut.current(
|
|
3188
3195
|
N,
|
|
3189
3196
|
R
|
|
3190
3197
|
);
|
|
@@ -3217,16 +3224,16 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3217
3224
|
return;
|
|
3218
3225
|
}
|
|
3219
3226
|
if (d.type === "request_page_context") {
|
|
3220
|
-
if (!
|
|
3221
|
-
|
|
3227
|
+
if (!xe("read_page")) {
|
|
3228
|
+
Le("request_page_context", "read_page");
|
|
3222
3229
|
return;
|
|
3223
3230
|
}
|
|
3224
|
-
const N = typeof d.requestId == "string" ? d.requestId : void 0, R = (
|
|
3231
|
+
const N = typeof d.requestId == "string" ? d.requestId : void 0, R = (re = Ee.current) == null ? void 0 : re.call(Ee), Y = (Q) => {
|
|
3225
3232
|
const V = R, he = V == null ? void 0 : V.localParticipant;
|
|
3226
3233
|
if (he != null && he.publishData)
|
|
3227
3234
|
try {
|
|
3228
|
-
const me = N ? { ...Q, requestId: N } : Q,
|
|
3229
|
-
he.publishData(
|
|
3235
|
+
const me = N ? { ...Q, requestId: N } : Q, oe = new TextEncoder().encode(JSON.stringify(me));
|
|
3236
|
+
he.publishData(oe, { reliable: !0 });
|
|
3230
3237
|
} catch (me) {
|
|
3231
3238
|
console.warn("[LiveLayer] publishData failed.", me);
|
|
3232
3239
|
}
|
|
@@ -3265,8 +3272,8 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3265
3272
|
return;
|
|
3266
3273
|
}
|
|
3267
3274
|
if (d.type === "scroll_page") {
|
|
3268
|
-
if (!
|
|
3269
|
-
|
|
3275
|
+
if (!xe("scroll")) {
|
|
3276
|
+
Le("scroll_page", "scroll");
|
|
3270
3277
|
return;
|
|
3271
3278
|
}
|
|
3272
3279
|
const N = d.direction;
|
|
@@ -3277,9 +3284,9 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3277
3284
|
return;
|
|
3278
3285
|
}
|
|
3279
3286
|
const R = d.behavior === "instant" ? "instant" : "smooth";
|
|
3280
|
-
if (
|
|
3287
|
+
if (jt.current) {
|
|
3281
3288
|
try {
|
|
3282
|
-
|
|
3289
|
+
jt.current(
|
|
3283
3290
|
N,
|
|
3284
3291
|
R
|
|
3285
3292
|
);
|
|
@@ -3298,8 +3305,8 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3298
3305
|
return;
|
|
3299
3306
|
}
|
|
3300
3307
|
if (d.type === "click") {
|
|
3301
|
-
if (!
|
|
3302
|
-
|
|
3308
|
+
if (!xe("click")) {
|
|
3309
|
+
Le("click", "click");
|
|
3303
3310
|
return;
|
|
3304
3311
|
}
|
|
3305
3312
|
const N = typeof d.selector == "string" ? d.selector : null;
|
|
@@ -3307,9 +3314,9 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3307
3314
|
console.warn("[LiveLayer] click: missing selector.");
|
|
3308
3315
|
return;
|
|
3309
3316
|
}
|
|
3310
|
-
if (
|
|
3317
|
+
if (Vt.current) {
|
|
3311
3318
|
try {
|
|
3312
|
-
|
|
3319
|
+
Vt.current(N);
|
|
3313
3320
|
} catch (Y) {
|
|
3314
3321
|
console.warn("[LiveLayer] onClick threw.", Y);
|
|
3315
3322
|
}
|
|
@@ -3337,12 +3344,12 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3337
3344
|
);
|
|
3338
3345
|
return;
|
|
3339
3346
|
}
|
|
3340
|
-
(
|
|
3347
|
+
(fe = R.click) == null || fe.call(R);
|
|
3341
3348
|
return;
|
|
3342
3349
|
}
|
|
3343
3350
|
if (d.type === "advance_step" || d.type === "go_back" || d.type === "submit_flow") {
|
|
3344
|
-
if (!
|
|
3345
|
-
|
|
3351
|
+
if (!xe("click")) {
|
|
3352
|
+
Le(d.type, "click");
|
|
3346
3353
|
return;
|
|
3347
3354
|
}
|
|
3348
3355
|
if (typeof document > "u") return;
|
|
@@ -3352,16 +3359,16 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3352
3359
|
console.warn(`[LiveLayer] ${d.type}: no "${N}" control found.`);
|
|
3353
3360
|
return;
|
|
3354
3361
|
}
|
|
3355
|
-
(
|
|
3362
|
+
(Ne = R.click) == null || Ne.call(R);
|
|
3356
3363
|
return;
|
|
3357
3364
|
}
|
|
3358
3365
|
if (d.type === "fill_form" || d.type === "focus_field") {
|
|
3359
|
-
if (!
|
|
3360
|
-
|
|
3366
|
+
if (!xe("fill_forms")) {
|
|
3367
|
+
Le(d.type, "fill_forms");
|
|
3361
3368
|
return;
|
|
3362
3369
|
}
|
|
3363
3370
|
if (typeof document > "u") return;
|
|
3364
|
-
d.type === "fill_form" &&
|
|
3371
|
+
d.type === "fill_form" && It.current.playConfirmation();
|
|
3365
3372
|
const N = typeof d.formId == "string" ? d.formId : null;
|
|
3366
3373
|
if (!N) {
|
|
3367
3374
|
console.warn(`[LiveLayer] ${d.type}: missing formId.`);
|
|
@@ -3426,8 +3433,8 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3426
3433
|
return;
|
|
3427
3434
|
}
|
|
3428
3435
|
if (d.type === "submit_form") {
|
|
3429
|
-
if (!
|
|
3430
|
-
|
|
3436
|
+
if (!xe("submit_forms")) {
|
|
3437
|
+
Le("submit_form", "submit_forms");
|
|
3431
3438
|
return;
|
|
3432
3439
|
}
|
|
3433
3440
|
if (typeof document > "u") return;
|
|
@@ -3436,7 +3443,7 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3436
3443
|
console.warn("[LiveLayer] submit_form: missing formId.");
|
|
3437
3444
|
return;
|
|
3438
3445
|
}
|
|
3439
|
-
|
|
3446
|
+
It.current.playConfirmation();
|
|
3440
3447
|
const R = Kn(document, N);
|
|
3441
3448
|
if (!R) {
|
|
3442
3449
|
console.warn(
|
|
@@ -3450,29 +3457,29 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3450
3457
|
);
|
|
3451
3458
|
return;
|
|
3452
3459
|
}
|
|
3453
|
-
const Y = typeof d.requestId == "string" ? d.requestId : void 0, j = (
|
|
3460
|
+
const Y = typeof d.requestId == "string" ? d.requestId : void 0, j = (yt = Ee.current) == null ? void 0 : yt.call(Ee), K = (oe) => {
|
|
3454
3461
|
const ye = j, je = ye == null ? void 0 : ye.localParticipant;
|
|
3455
3462
|
if (je != null && je.publishData)
|
|
3456
3463
|
try {
|
|
3457
|
-
const
|
|
3458
|
-
je.publishData(
|
|
3464
|
+
const Dt = Y ? { ...oe, requestId: Y } : oe, Pt = new TextEncoder().encode(JSON.stringify(Dt));
|
|
3465
|
+
je.publishData(Pt, { reliable: !0 });
|
|
3459
3466
|
} catch {
|
|
3460
3467
|
}
|
|
3461
|
-
}, Q = (
|
|
3462
|
-
var
|
|
3463
|
-
const ye =
|
|
3468
|
+
}, Q = (oe) => {
|
|
3469
|
+
var Pt, Sn, En, An;
|
|
3470
|
+
const ye = oe, je = (Pt = ye.getAttribute) == null ? void 0 : Pt.call(ye, "aria-label");
|
|
3464
3471
|
if (je) return je;
|
|
3465
|
-
const
|
|
3466
|
-
if (
|
|
3467
|
-
const
|
|
3468
|
-
if ((En =
|
|
3472
|
+
const Dt = ye.id;
|
|
3473
|
+
if (Dt) {
|
|
3474
|
+
const zt = (Sn = R.ownerDocument) == null ? void 0 : Sn.querySelector(`label[for="${Dt}"]`);
|
|
3475
|
+
if ((En = zt == null ? void 0 : zt.textContent) != null && En.trim()) return zt.textContent.trim();
|
|
3469
3476
|
}
|
|
3470
3477
|
return ((An = ye.getAttribute) == null ? void 0 : An.call(ye, "name")) || ye.id || ye.type || "field";
|
|
3471
3478
|
}, V = () => {
|
|
3472
3479
|
try {
|
|
3473
3480
|
return Array.from(R.elements).filter(
|
|
3474
|
-
(
|
|
3475
|
-
).map((
|
|
3481
|
+
(oe) => "willValidate" in oe && oe.willValidate && !oe.checkValidity()
|
|
3482
|
+
).map((oe) => `${Q(oe)}: ${oe.validationMessage}`);
|
|
3476
3483
|
} catch {
|
|
3477
3484
|
return [];
|
|
3478
3485
|
}
|
|
@@ -3491,16 +3498,16 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3491
3498
|
return;
|
|
3492
3499
|
}
|
|
3493
3500
|
let he = !1;
|
|
3494
|
-
const me = (
|
|
3501
|
+
const me = (oe) => {
|
|
3495
3502
|
he = !0, queueMicrotask(() => {
|
|
3496
|
-
|
|
3503
|
+
oe.defaultPrevented ? K({ type: "form_submit_uncertain", formId: N, reason: "spa_prevented" }) : K({ type: "form_submitted", formId: N });
|
|
3497
3504
|
});
|
|
3498
3505
|
};
|
|
3499
3506
|
R.addEventListener("submit", me, { once: !0 });
|
|
3500
3507
|
try {
|
|
3501
3508
|
typeof R.requestSubmit == "function" ? R.requestSubmit() : R.submit();
|
|
3502
|
-
} catch (
|
|
3503
|
-
console.warn("[LiveLayer] submit_form: requestSubmit threw.",
|
|
3509
|
+
} catch (oe) {
|
|
3510
|
+
console.warn("[LiveLayer] submit_form: requestSubmit threw.", oe), R.removeEventListener("submit", me), K({
|
|
3504
3511
|
type: "form_submit_blocked",
|
|
3505
3512
|
formId: N,
|
|
3506
3513
|
reason: "exception"
|
|
@@ -3518,11 +3525,11 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3518
3525
|
return;
|
|
3519
3526
|
}
|
|
3520
3527
|
if (d.type === "request_routes") {
|
|
3521
|
-
if (!
|
|
3522
|
-
|
|
3528
|
+
if (!xe("read_page")) {
|
|
3529
|
+
Le("request_routes", "read_page");
|
|
3523
3530
|
return;
|
|
3524
3531
|
}
|
|
3525
|
-
const N = typeof d.requestId == "string" ? d.requestId : void 0, Y = (
|
|
3532
|
+
const N = typeof d.requestId == "string" ? d.requestId : void 0, Y = (kn = Ee.current) == null ? void 0 : kn.call(Ee), j = Y == null ? void 0 : Y.localParticipant;
|
|
3526
3533
|
if (!(j != null && j.publishData)) return;
|
|
3527
3534
|
const K = (V) => {
|
|
3528
3535
|
try {
|
|
@@ -3545,26 +3552,26 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3545
3552
|
console.warn(
|
|
3546
3553
|
"[LiveLayer] getRoutes rejected; falling back to DOM walker.",
|
|
3547
3554
|
me
|
|
3548
|
-
), K(
|
|
3555
|
+
), K(Zt());
|
|
3549
3556
|
}) : he(V);
|
|
3550
3557
|
} catch (V) {
|
|
3551
3558
|
console.warn(
|
|
3552
3559
|
"[LiveLayer] getRoutes threw; falling back to DOM walker.",
|
|
3553
3560
|
V
|
|
3554
|
-
), K(
|
|
3561
|
+
), K(Zt());
|
|
3555
3562
|
}
|
|
3556
3563
|
return;
|
|
3557
3564
|
}
|
|
3558
3565
|
try {
|
|
3559
|
-
K(
|
|
3566
|
+
K(Zt());
|
|
3560
3567
|
} catch (V) {
|
|
3561
3568
|
console.warn("[LiveLayer] request_routes: extractRoutes threw.", V);
|
|
3562
3569
|
}
|
|
3563
3570
|
return;
|
|
3564
3571
|
}
|
|
3565
3572
|
if (d.type === "task_field_updated") {
|
|
3566
|
-
if (!
|
|
3567
|
-
|
|
3573
|
+
if (!xe("collect_data")) {
|
|
3574
|
+
Le("task_field_updated", "collect_data");
|
|
3568
3575
|
return;
|
|
3569
3576
|
}
|
|
3570
3577
|
const N = {
|
|
@@ -3587,8 +3594,8 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3587
3594
|
return;
|
|
3588
3595
|
}
|
|
3589
3596
|
if (d.type === "task_completed") {
|
|
3590
|
-
if (!
|
|
3591
|
-
|
|
3597
|
+
if (!xe("collect_data")) {
|
|
3598
|
+
Le("task_completed", "collect_data");
|
|
3592
3599
|
return;
|
|
3593
3600
|
}
|
|
3594
3601
|
const N = d.result;
|
|
@@ -3621,34 +3628,34 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3621
3628
|
},
|
|
3622
3629
|
[Xe, Be, We]
|
|
3623
3630
|
), se = Dr({
|
|
3624
|
-
agentId: F ? "__controlled__" :
|
|
3631
|
+
agentId: F ? "__controlled__" : St,
|
|
3625
3632
|
baseUrl: o,
|
|
3626
3633
|
apiKey: l,
|
|
3627
3634
|
sessionEndpoint: s,
|
|
3628
3635
|
sessionBody: a,
|
|
3629
|
-
onDataMessage: F ? void 0 :
|
|
3636
|
+
onDataMessage: F ? void 0 : mt
|
|
3630
3637
|
});
|
|
3631
3638
|
I(() => {
|
|
3632
3639
|
if (F != null && F.subscribeToDataMessages)
|
|
3633
|
-
return F.subscribeToDataMessages(
|
|
3634
|
-
}, [F,
|
|
3640
|
+
return F.subscribeToDataMessages(mt);
|
|
3641
|
+
}, [F, mt]), Ee.current = () => {
|
|
3635
3642
|
var b;
|
|
3636
3643
|
return (b = se.getRoom) == null ? void 0 : b.call(se);
|
|
3637
3644
|
}, I(() => {
|
|
3638
|
-
var
|
|
3645
|
+
var re;
|
|
3639
3646
|
if (typeof window > "u") return;
|
|
3640
|
-
const b = ((
|
|
3647
|
+
const b = ((re = window.location) == null ? void 0 : re.hostname) || "";
|
|
3641
3648
|
if (b === "localhost" || b === "127.0.0.1" || b === "0.0.0.0" || b.endsWith(".local") || b.endsWith(".test"))
|
|
3642
|
-
return window.__livelayerSimulateCommand = (
|
|
3649
|
+
return window.__livelayerSimulateCommand = (fe) => {
|
|
3643
3650
|
try {
|
|
3644
|
-
|
|
3645
|
-
} catch (
|
|
3646
|
-
console.warn("[LiveLayer] simulate-command threw:",
|
|
3651
|
+
mt(fe);
|
|
3652
|
+
} catch (Ne) {
|
|
3653
|
+
console.warn("[LiveLayer] simulate-command threw:", Ne);
|
|
3647
3654
|
}
|
|
3648
3655
|
}, () => {
|
|
3649
3656
|
delete window.__livelayerSimulateCommand;
|
|
3650
3657
|
};
|
|
3651
|
-
}, [
|
|
3658
|
+
}, [mt]);
|
|
3652
3659
|
const L = at(() => F ? {
|
|
3653
3660
|
connectionState: F.connectionState,
|
|
3654
3661
|
agentState: F.agentState,
|
|
@@ -3687,7 +3694,7 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3687
3694
|
n,
|
|
3688
3695
|
() => ({
|
|
3689
3696
|
sendData: async (b) => {
|
|
3690
|
-
var
|
|
3697
|
+
var Ne, yt;
|
|
3691
3698
|
const d = fn.current;
|
|
3692
3699
|
if (d != null && d.publishData) {
|
|
3693
3700
|
try {
|
|
@@ -3697,11 +3704,11 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3697
3704
|
}
|
|
3698
3705
|
return;
|
|
3699
3706
|
}
|
|
3700
|
-
const
|
|
3701
|
-
if (
|
|
3707
|
+
const re = (yt = (Ne = dn.current) == null ? void 0 : Ne.getRoom) == null ? void 0 : yt.call(Ne), fe = re == null ? void 0 : re.localParticipant;
|
|
3708
|
+
if (fe != null && fe.publishData)
|
|
3702
3709
|
try {
|
|
3703
3710
|
const Pe = new TextEncoder().encode(JSON.stringify(b));
|
|
3704
|
-
await
|
|
3711
|
+
await fe.publishData(Pe, { reliable: !0 });
|
|
3705
3712
|
} catch (Pe) {
|
|
3706
3713
|
console.warn("[AvatarWidget] sendData failed:", Pe);
|
|
3707
3714
|
}
|
|
@@ -3717,20 +3724,20 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3717
3724
|
b.parentNode === d && d.removeChild(b);
|
|
3718
3725
|
};
|
|
3719
3726
|
}, [L.videoElement]);
|
|
3720
|
-
const [tt,
|
|
3727
|
+
const [tt, Tt] = M(!1);
|
|
3721
3728
|
I(() => {
|
|
3722
3729
|
if (!$) {
|
|
3723
|
-
|
|
3730
|
+
Tt(!0);
|
|
3724
3731
|
return;
|
|
3725
3732
|
}
|
|
3726
|
-
L.agentState === "speaking" && !tt &&
|
|
3733
|
+
L.agentState === "speaking" && !tt && Tt(!0);
|
|
3727
3734
|
}, [$, L.agentState, tt]), I(() => {
|
|
3728
3735
|
if (!$) return;
|
|
3729
3736
|
const b = L.connectionState;
|
|
3730
|
-
(b === "disconnected" || b === "idle") &&
|
|
3737
|
+
(b === "disconnected" || b === "idle") && Tt(!1);
|
|
3731
3738
|
}, [$, L.connectionState]), I(() => {
|
|
3732
3739
|
if (!$ || !L.videoElement || tt) return;
|
|
3733
|
-
const b = setTimeout(() =>
|
|
3740
|
+
const b = setTimeout(() => Tt(!0), 5e3);
|
|
3734
3741
|
return () => clearTimeout(b);
|
|
3735
3742
|
}, [$, L.videoElement, tt]), I(() => {
|
|
3736
3743
|
const b = L.videoElement;
|
|
@@ -3745,12 +3752,12 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3745
3752
|
const b = L.audioElement;
|
|
3746
3753
|
if (!b) return;
|
|
3747
3754
|
const d = document.createElement("div");
|
|
3748
|
-
d.className = "ll-audio-sink", d.setAttribute("aria-hidden", "true"), d.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;clip:rect(0 0 0 0);pointer-events:none;", d.appendChild(b), document.body.appendChild(d),
|
|
3749
|
-
const
|
|
3750
|
-
return
|
|
3751
|
-
(
|
|
3755
|
+
d.className = "ll-audio-sink", d.setAttribute("aria-hidden", "true"), d.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;clip:rect(0 0 0 0);pointer-events:none;", d.appendChild(b), document.body.appendChild(d), Te.attach(b);
|
|
3756
|
+
const re = b.play();
|
|
3757
|
+
return re && typeof re.catch == "function" && re.catch((fe) => {
|
|
3758
|
+
(fe == null ? void 0 : fe.name) === "NotAllowedError" && Se(!0);
|
|
3752
3759
|
}), () => {
|
|
3753
|
-
|
|
3760
|
+
Te.detach(), b.parentNode === d && d.removeChild(b), d.parentNode === document.body && document.body.removeChild(d);
|
|
3754
3761
|
};
|
|
3755
3762
|
}, [L.audioElement]);
|
|
3756
3763
|
const we = $r({
|
|
@@ -3763,24 +3770,24 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3763
3770
|
if (b)
|
|
3764
3771
|
return we.setupMic(b).then(() => {
|
|
3765
3772
|
const d = we.getMicStream();
|
|
3766
|
-
d &&
|
|
3773
|
+
d && Te.attachStream(d, "mic");
|
|
3767
3774
|
}).catch(() => {
|
|
3768
3775
|
}), () => {
|
|
3769
|
-
|
|
3776
|
+
Te.detachSlot("mic"), we.teardownMic();
|
|
3770
3777
|
};
|
|
3771
3778
|
}, [L.isControlled, L.connectionState]), I(() => {
|
|
3772
3779
|
var d;
|
|
3773
3780
|
if (L.connectionState !== "connected") return;
|
|
3774
3781
|
const b = L.isControlled ? (d = F == null ? void 0 : F.getRoom) == null ? void 0 : d.call(F) : L.getRoom();
|
|
3775
3782
|
if (b)
|
|
3776
|
-
return
|
|
3777
|
-
|
|
3783
|
+
return Ae.attachRoom(b), Re.attachRoom(b), L.isControlled && we.attachRoom(b), ft.refresh(), () => {
|
|
3784
|
+
Ae.teardown(), Re.teardown();
|
|
3778
3785
|
};
|
|
3779
3786
|
}, [L.isControlled, L.connectionState, F]), I(() => {
|
|
3780
3787
|
const b = L.audioElement;
|
|
3781
|
-
b && (b.muted =
|
|
3782
|
-
}, [L.audioElement,
|
|
3783
|
-
const pr =
|
|
3788
|
+
b && (b.muted = Wt);
|
|
3789
|
+
}, [L.audioElement, Wt]);
|
|
3790
|
+
const pr = C((b) => {
|
|
3784
3791
|
const d = { type: "user_message", text: b };
|
|
3785
3792
|
if (F != null && F.publishData) {
|
|
3786
3793
|
try {
|
|
@@ -3789,14 +3796,14 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3789
3796
|
}
|
|
3790
3797
|
return;
|
|
3791
3798
|
}
|
|
3792
|
-
const
|
|
3793
|
-
if (
|
|
3799
|
+
const re = L.getRoom();
|
|
3800
|
+
if (re)
|
|
3794
3801
|
try {
|
|
3795
|
-
const
|
|
3796
|
-
|
|
3802
|
+
const fe = new TextEncoder().encode(JSON.stringify(d));
|
|
3803
|
+
re.localParticipant.publishData(fe, { reliable: !0 });
|
|
3797
3804
|
} catch {
|
|
3798
3805
|
}
|
|
3799
|
-
}, [L, F]), hr =
|
|
3806
|
+
}, [L, F]), hr = C(() => {
|
|
3800
3807
|
fr((b) => !b);
|
|
3801
3808
|
}, []);
|
|
3802
3809
|
I(() => {
|
|
@@ -3806,69 +3813,69 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3806
3813
|
}, [L.transcript, He]), I(() => {
|
|
3807
3814
|
Oe == null || Oe(L.agentState);
|
|
3808
3815
|
}, [L.agentState, Oe]), I(() => {
|
|
3809
|
-
|
|
3810
|
-
}, [L.agentState,
|
|
3816
|
+
Mt.setThinking(L.agentState === "thinking");
|
|
3817
|
+
}, [L.agentState, Mt]);
|
|
3811
3818
|
const hn = T(!1);
|
|
3812
3819
|
I(() => {
|
|
3813
3820
|
!m || hn.current || ut && L.connectionState === "idle" && (hn.current = !0, L.connect());
|
|
3814
3821
|
}, [m, L.connectionState, L, ut]);
|
|
3815
|
-
const mr =
|
|
3822
|
+
const mr = C(
|
|
3816
3823
|
(b) => {
|
|
3817
|
-
const d = v == null ? void 0 : v.find((
|
|
3818
|
-
d && (
|
|
3824
|
+
const d = v == null ? void 0 : v.find((re) => re.id === b);
|
|
3825
|
+
d && (et(!1), b !== Ue && (pt(!0), L.disconnect(), Ie || kt(b), y == null || y(d)));
|
|
3819
3826
|
},
|
|
3820
3827
|
[
|
|
3821
3828
|
v,
|
|
3822
|
-
|
|
3829
|
+
Ue,
|
|
3823
3830
|
L,
|
|
3824
|
-
|
|
3831
|
+
Ie,
|
|
3825
3832
|
y
|
|
3826
3833
|
]
|
|
3827
3834
|
);
|
|
3828
3835
|
I(() => {
|
|
3829
|
-
|
|
3830
|
-
}, [L.connectionState,
|
|
3831
|
-
if (!
|
|
3836
|
+
Qe && L.connectionState === "connected" && pt(!1);
|
|
3837
|
+
}, [L.connectionState, Qe]), I(() => {
|
|
3838
|
+
if (!ht) return;
|
|
3832
3839
|
const b = (d) => {
|
|
3833
|
-
d.key === "Escape" &&
|
|
3840
|
+
d.key === "Escape" && et(!1);
|
|
3834
3841
|
};
|
|
3835
3842
|
return window.addEventListener("keydown", b), () => window.removeEventListener("keydown", b);
|
|
3836
|
-
}, [
|
|
3837
|
-
const gr = !!J || !!(
|
|
3838
|
-
Ye === void 0 && ((vn =
|
|
3839
|
-
const
|
|
3843
|
+
}, [ht]);
|
|
3844
|
+
const gr = !!J || !!(ue != null && ue.avatarImageUrl) || L.isControlled, gt = Wr(St, o, gr);
|
|
3845
|
+
Ye === void 0 && ((vn = gt.info) != null && vn.capabilities) && (Yt.current = gt.info.capabilities);
|
|
3846
|
+
const Rt = (ue == null ? void 0 : ue.name) ?? le ?? ((bn = L.agentConfig) == null ? void 0 : bn.name) ?? ((wn = gt.info) == null ? void 0 : wn.name) ?? "Live Layer", Gt = (ue == null ? void 0 : ue.avatarImageUrl) ?? J ?? ((_n = L.agentConfig) == null ? void 0 : _n.avatarImageUrl) ?? ((xn = gt.info) == null ? void 0 : xn.avatarImageUrl) ?? null, yr = z ?? ((Ln = L.agentConfig) == null ? void 0 : Ln.idleLoopUrl) ?? ((Cn = gt.info) == null ? void 0 : Cn.idleLoopUrl) ?? null, vr = B ?? null, br = C(() => be("expanded"), [be]), wr = C(
|
|
3840
3847
|
() => be("minimized"),
|
|
3841
3848
|
[be]
|
|
3842
|
-
), mn =
|
|
3849
|
+
), mn = C(() => {
|
|
3843
3850
|
L.disconnect(), be("hidden");
|
|
3844
|
-
}, [L, be]), _r =
|
|
3851
|
+
}, [L, be]), _r = C(() => {
|
|
3845
3852
|
const b = L.audioElement;
|
|
3846
|
-
b && b.play().then(() =>
|
|
3853
|
+
b && b.play().then(() => Se(!1)).catch(() => {
|
|
3847
3854
|
});
|
|
3848
|
-
}, [L.audioElement]), xr =
|
|
3849
|
-
|
|
3855
|
+
}, [L.audioElement]), xr = C(() => {
|
|
3856
|
+
Se(!1), L.connect();
|
|
3850
3857
|
}, [L]), nt = {
|
|
3851
3858
|
...Ke,
|
|
3852
|
-
...
|
|
3859
|
+
...de ? {} : { zIndex: ke }
|
|
3853
3860
|
};
|
|
3854
3861
|
H.primaryColor && (nt["--ll-color-primary"] = H.primaryColor), H.accentColor && (nt["--ll-color-accent"] = H.accentColor), H.backgroundColor && (nt["--ll-color-bg"] = H.backgroundColor), H.textColor && (nt["--ll-color-fg"] = H.textColor);
|
|
3855
3862
|
const Lr = {
|
|
3856
3863
|
...nt,
|
|
3857
|
-
...
|
|
3858
|
-
},
|
|
3864
|
+
..._e.style
|
|
3865
|
+
}, Cr = [
|
|
3859
3866
|
"ll-widget",
|
|
3860
3867
|
`ll-widget--${pe}`,
|
|
3861
3868
|
`ll-widget--${ve ? "mobile" : "desktop"}`,
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3869
|
+
_e.hasGeometry ? "ll-widget--has-geometry" : null,
|
|
3870
|
+
_e.isDragging ? "is-dragging" : null,
|
|
3871
|
+
_e.isResizing ? "is-resizing" : null,
|
|
3865
3872
|
qe
|
|
3866
3873
|
].filter(Boolean).join(" ");
|
|
3867
3874
|
if (!ut) return null;
|
|
3868
|
-
const
|
|
3875
|
+
const kr = /* @__PURE__ */ r(
|
|
3869
3876
|
"div",
|
|
3870
3877
|
{
|
|
3871
|
-
className:
|
|
3878
|
+
className: Cr,
|
|
3872
3879
|
style: Lr,
|
|
3873
3880
|
"data-display-mode": pe,
|
|
3874
3881
|
"data-position": _,
|
|
@@ -3878,42 +3885,42 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3878
3885
|
{
|
|
3879
3886
|
position: _,
|
|
3880
3887
|
isMobile: ve,
|
|
3881
|
-
agentName:
|
|
3882
|
-
avatarImageUrl:
|
|
3888
|
+
agentName: Rt,
|
|
3889
|
+
avatarImageUrl: Gt,
|
|
3883
3890
|
idleLoopUrl: yr,
|
|
3884
3891
|
greeting: vr,
|
|
3885
3892
|
branding: H,
|
|
3886
3893
|
teamMembers: v,
|
|
3887
|
-
currentTeamMemberId:
|
|
3888
|
-
isSwitchingTeamMember:
|
|
3889
|
-
teamSwitcherOpen:
|
|
3890
|
-
onToggleTeamSwitcher: () =>
|
|
3894
|
+
currentTeamMemberId: Ue,
|
|
3895
|
+
isSwitchingTeamMember: Qe,
|
|
3896
|
+
teamSwitcherOpen: ht,
|
|
3897
|
+
onToggleTeamSwitcher: () => et((b) => !b),
|
|
3891
3898
|
onSelectTeamMember: mr,
|
|
3892
3899
|
connectionState: L.connectionState,
|
|
3893
3900
|
agentState: L.agentState,
|
|
3894
3901
|
transcript: L.transcript,
|
|
3895
3902
|
isMuted: we.isMuted,
|
|
3896
|
-
micDevices:
|
|
3903
|
+
micDevices: ft.mics,
|
|
3897
3904
|
activeMicId: we.activeDeviceId,
|
|
3898
|
-
isCameraEnabled:
|
|
3899
|
-
cameraPreviewEl:
|
|
3900
|
-
cameraDevices:
|
|
3901
|
-
activeCameraId:
|
|
3902
|
-
isScreenShareEnabled:
|
|
3903
|
-
screenPreviewEl:
|
|
3904
|
-
isSpeakerMuted:
|
|
3905
|
+
isCameraEnabled: Ae.isEnabled,
|
|
3906
|
+
cameraPreviewEl: Ae.previewEl,
|
|
3907
|
+
cameraDevices: ft.cameras,
|
|
3908
|
+
activeCameraId: Ae.activeDeviceId,
|
|
3909
|
+
isScreenShareEnabled: Re.isEnabled,
|
|
3910
|
+
screenPreviewEl: Re.previewEl,
|
|
3911
|
+
isSpeakerMuted: Wt,
|
|
3905
3912
|
allowCamera: G,
|
|
3906
3913
|
allowScreenShare: f,
|
|
3907
3914
|
allowTyping: A,
|
|
3908
|
-
showMinimize: ve && !
|
|
3909
|
-
showClose:
|
|
3915
|
+
showMinimize: ve && !de ? !1 : Et,
|
|
3916
|
+
showClose: At,
|
|
3910
3917
|
chromeless: ee,
|
|
3911
|
-
compactControls:
|
|
3912
|
-
transforming:
|
|
3918
|
+
compactControls: Nt,
|
|
3919
|
+
transforming: ie,
|
|
3913
3920
|
transformingLabel: U,
|
|
3914
|
-
languageMenuOpen:
|
|
3915
|
-
onToggleLanguageMenu: () =>
|
|
3916
|
-
needsUserGesture:
|
|
3921
|
+
languageMenuOpen: x,
|
|
3922
|
+
onToggleLanguageMenu: () => ae((b) => !b),
|
|
3923
|
+
needsUserGesture: De,
|
|
3917
3924
|
canResume: L.canResume,
|
|
3918
3925
|
micError: we.micError,
|
|
3919
3926
|
error: L.error,
|
|
@@ -3925,20 +3932,20 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3925
3932
|
onResumeAudio: _r,
|
|
3926
3933
|
onToggleMute: we.toggleMute,
|
|
3927
3934
|
onSwitchMicDevice: (b) => void we.switchDevice(b),
|
|
3928
|
-
onToggleCamera: () => void
|
|
3929
|
-
onSwitchCameraDevice: (b) => void
|
|
3930
|
-
onToggleScreenShare: () => void
|
|
3935
|
+
onToggleCamera: () => void Ae.toggle(),
|
|
3936
|
+
onSwitchCameraDevice: (b) => void Ae.switchDevice(b),
|
|
3937
|
+
onToggleScreenShare: () => void Re.toggle(),
|
|
3931
3938
|
onToggleSpeaker: hr,
|
|
3932
3939
|
onSendMessage: pr,
|
|
3933
3940
|
onMinimize: wr,
|
|
3934
3941
|
onClose: mn,
|
|
3935
3942
|
onClearMicError: we.clearError,
|
|
3936
|
-
dragHandleProps:
|
|
3937
|
-
resizeHandleProps:
|
|
3943
|
+
dragHandleProps: _e.dragHandleProps,
|
|
3944
|
+
resizeHandleProps: _e.resizeHandleProps
|
|
3938
3945
|
}
|
|
3939
3946
|
)
|
|
3940
3947
|
}
|
|
3941
|
-
), gn = !
|
|
3948
|
+
), gn = !de && (pe === "hidden" || pe === "minimized") ? /* @__PURE__ */ S(
|
|
3942
3949
|
"div",
|
|
3943
3950
|
{
|
|
3944
3951
|
className: [
|
|
@@ -3958,9 +3965,9 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3958
3965
|
isMobile: ve,
|
|
3959
3966
|
isSpeaking: L.agentState === "speaking",
|
|
3960
3967
|
onExpand: () => be("expanded"),
|
|
3961
|
-
label: `Open ${
|
|
3962
|
-
avatarImageUrl:
|
|
3963
|
-
agentName:
|
|
3968
|
+
label: `Open ${Rt} widget`,
|
|
3969
|
+
avatarImageUrl: Gt,
|
|
3970
|
+
agentName: Rt,
|
|
3964
3971
|
containerEl: W
|
|
3965
3972
|
}
|
|
3966
3973
|
),
|
|
@@ -3969,11 +3976,11 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3969
3976
|
{
|
|
3970
3977
|
position: _,
|
|
3971
3978
|
isMobile: ve,
|
|
3972
|
-
agentName:
|
|
3973
|
-
avatarImageUrl:
|
|
3979
|
+
agentName: Rt,
|
|
3980
|
+
avatarImageUrl: Gt,
|
|
3974
3981
|
agentState: L.agentState,
|
|
3975
3982
|
isMuted: we.isMuted,
|
|
3976
|
-
audioLevel:
|
|
3983
|
+
audioLevel: Te,
|
|
3977
3984
|
onExpand: br,
|
|
3978
3985
|
onToggleMute: we.toggleMute,
|
|
3979
3986
|
onClose: mn
|
|
@@ -3983,13 +3990,13 @@ const _o = /* @__PURE__ */ new Set([
|
|
|
3983
3990
|
}
|
|
3984
3991
|
) : null, yn = W ?? (typeof document < "u" ? document.body : null);
|
|
3985
3992
|
return /* @__PURE__ */ S(Ve, { children: [
|
|
3986
|
-
|
|
3987
|
-
gn && yn &&
|
|
3993
|
+
kr,
|
|
3994
|
+
gn && yn && on(gn, yn)
|
|
3988
3995
|
] });
|
|
3989
3996
|
}
|
|
3990
3997
|
);
|
|
3991
3998
|
dr.displayName = "AvatarWidgetInner";
|
|
3992
|
-
const xo =
|
|
3999
|
+
const xo = rn(
|
|
3993
4000
|
function(t, n) {
|
|
3994
4001
|
return /* @__PURE__ */ r(Rr, { children: /* @__PURE__ */ r(dr, { ...t, ref: n }) });
|
|
3995
4002
|
}
|
|
@@ -4006,7 +4013,7 @@ const Ro = ({
|
|
|
4006
4013
|
}) => {
|
|
4007
4014
|
const a = T(null), c = T(null), u = T(l);
|
|
4008
4015
|
u.current = l;
|
|
4009
|
-
const m =
|
|
4016
|
+
const m = C((p) => {
|
|
4010
4017
|
var P;
|
|
4011
4018
|
const h = p.detail;
|
|
4012
4019
|
(P = u.current) == null || P.call(u, h);
|
|
@@ -4021,7 +4028,7 @@ const Ro = ({
|
|
|
4021
4028
|
}, [e]), I(() => {
|
|
4022
4029
|
c.current && (i ? c.current.setAttribute("mode", i) : c.current.removeAttribute("mode"));
|
|
4023
4030
|
}, [i]), /* @__PURE__ */ r("div", { ref: a, className: o, style: s });
|
|
4024
|
-
}, Do =
|
|
4031
|
+
}, Do = rn(
|
|
4025
4032
|
function({ id: t, intent: n, as: i = "div", className: l, style: o, children: s }, a) {
|
|
4026
4033
|
return Ar(
|
|
4027
4034
|
i,
|
|
@@ -4041,14 +4048,14 @@ function Po(e = {}) {
|
|
|
4041
4048
|
I(() => {
|
|
4042
4049
|
m.current = t, p.current = n, h.current = i;
|
|
4043
4050
|
}, [t, n, i]);
|
|
4044
|
-
const P =
|
|
4051
|
+
const P = C(() => {
|
|
4045
4052
|
o({}), a(!1);
|
|
4046
4053
|
}, []);
|
|
4047
4054
|
return I(() => {
|
|
4048
4055
|
if (typeof window > "u") return;
|
|
4049
|
-
const _ = (
|
|
4056
|
+
const _ = (k) => {
|
|
4050
4057
|
var w, D;
|
|
4051
|
-
const g =
|
|
4058
|
+
const g = k.detail;
|
|
4052
4059
|
if (g) {
|
|
4053
4060
|
if (g.phase === "field") {
|
|
4054
4061
|
if (h.current !== "all" && g.source !== h.current)
|
|
@@ -4132,7 +4139,7 @@ function zo({
|
|
|
4132
4139
|
ts: Date.now(),
|
|
4133
4140
|
kind: E,
|
|
4134
4141
|
type: y.slice(0, 120),
|
|
4135
|
-
data: { args: O.slice(1).map((z) =>
|
|
4142
|
+
data: { args: O.slice(1).map((z) => Co(z)) }
|
|
4136
4143
|
});
|
|
4137
4144
|
} catch {
|
|
4138
4145
|
}
|
|
@@ -4168,7 +4175,7 @@ function zo({
|
|
|
4168
4175
|
children: "🛰 LL debug"
|
|
4169
4176
|
}
|
|
4170
4177
|
);
|
|
4171
|
-
const
|
|
4178
|
+
const k = o.filter((g) => {
|
|
4172
4179
|
if (!a) return !0;
|
|
4173
4180
|
const w = a.toLowerCase();
|
|
4174
4181
|
return g.type.toLowerCase().includes(w) || JSON.stringify(g.data || {}).toLowerCase().includes(w);
|
|
@@ -4219,7 +4226,7 @@ function zo({
|
|
|
4219
4226
|
{
|
|
4220
4227
|
type: "button",
|
|
4221
4228
|
onClick: () => m((g) => !g),
|
|
4222
|
-
style:
|
|
4229
|
+
style: en(u ? "#f59e0b" : "transparent"),
|
|
4223
4230
|
title: "Pause / resume capture",
|
|
4224
4231
|
children: u ? "▶ resume" : "⏸ pause"
|
|
4225
4232
|
}
|
|
@@ -4231,7 +4238,7 @@ function zo({
|
|
|
4231
4238
|
onClick: () => {
|
|
4232
4239
|
s([]), h.current = [];
|
|
4233
4240
|
},
|
|
4234
|
-
style:
|
|
4241
|
+
style: en("transparent"),
|
|
4235
4242
|
title: "Clear buffer",
|
|
4236
4243
|
children: "clear"
|
|
4237
4244
|
}
|
|
@@ -4241,7 +4248,7 @@ function zo({
|
|
|
4241
4248
|
{
|
|
4242
4249
|
type: "button",
|
|
4243
4250
|
onClick: () => l(!1),
|
|
4244
|
-
style:
|
|
4251
|
+
style: en("transparent"),
|
|
4245
4252
|
"aria-label": "Close",
|
|
4246
4253
|
title: "Close (Cmd/Ctrl + Shift + L)",
|
|
4247
4254
|
children: "✕"
|
|
@@ -4277,7 +4284,7 @@ function zo({
|
|
|
4277
4284
|
overflowY: "auto",
|
|
4278
4285
|
padding: "0 8px 8px"
|
|
4279
4286
|
},
|
|
4280
|
-
children:
|
|
4287
|
+
children: k.length === 0 ? /* @__PURE__ */ S(
|
|
4281
4288
|
"div",
|
|
4282
4289
|
{
|
|
4283
4290
|
style: {
|
|
@@ -4307,7 +4314,7 @@ function zo({
|
|
|
4307
4314
|
)
|
|
4308
4315
|
]
|
|
4309
4316
|
}
|
|
4310
|
-
) :
|
|
4317
|
+
) : k.map((g) => /* @__PURE__ */ r(
|
|
4311
4318
|
Lo,
|
|
4312
4319
|
{
|
|
4313
4320
|
entry: g,
|
|
@@ -4394,7 +4401,7 @@ function Lo({
|
|
|
4394
4401
|
}
|
|
4395
4402
|
);
|
|
4396
4403
|
}
|
|
4397
|
-
function
|
|
4404
|
+
function en(e) {
|
|
4398
4405
|
return {
|
|
4399
4406
|
background: e,
|
|
4400
4407
|
color: "#fff",
|
|
@@ -4405,22 +4412,22 @@ function tn(e) {
|
|
|
4405
4412
|
cursor: "pointer"
|
|
4406
4413
|
};
|
|
4407
4414
|
}
|
|
4408
|
-
function
|
|
4415
|
+
function Co(e) {
|
|
4409
4416
|
try {
|
|
4410
4417
|
return e instanceof Error ? { message: e.message, stack: e.stack } : (JSON.stringify(e), e);
|
|
4411
4418
|
} catch {
|
|
4412
4419
|
return String(e);
|
|
4413
4420
|
}
|
|
4414
4421
|
}
|
|
4415
|
-
function
|
|
4422
|
+
function ko(e) {
|
|
4416
4423
|
const t = JSON.stringify(e);
|
|
4417
4424
|
I(() => Mr(e), [t]);
|
|
4418
4425
|
}
|
|
4419
4426
|
function $o({ fields: e, children: t }) {
|
|
4420
|
-
return
|
|
4427
|
+
return ko(e), /* @__PURE__ */ r(Ve, { children: t });
|
|
4421
4428
|
}
|
|
4422
4429
|
function Ho() {
|
|
4423
|
-
const [e, t] = M([]), n =
|
|
4430
|
+
const [e, t] = M([]), n = C((l) => {
|
|
4424
4431
|
t((o) => {
|
|
4425
4432
|
const s = o.findIndex((a) => a.id === l.id);
|
|
4426
4433
|
if (s >= 0) {
|
|
@@ -4429,7 +4436,7 @@ function Ho() {
|
|
|
4429
4436
|
}
|
|
4430
4437
|
return [...o, l];
|
|
4431
4438
|
});
|
|
4432
|
-
}, []), i =
|
|
4439
|
+
}, []), i = C(() => t([]), []);
|
|
4433
4440
|
return {
|
|
4434
4441
|
entries: e,
|
|
4435
4442
|
pushSegment: n,
|
|
@@ -4450,7 +4457,7 @@ export {
|
|
|
4450
4457
|
Qi as extractPageContext,
|
|
4451
4458
|
oo as extractRoutes,
|
|
4452
4459
|
Gn as getCachedPageContext,
|
|
4453
|
-
|
|
4460
|
+
Zt as getCachedRoutes,
|
|
4454
4461
|
Wo as getRegisteredFields,
|
|
4455
4462
|
si as matchesPattern,
|
|
4456
4463
|
ro as normalizeRouteInput,
|
|
@@ -4468,7 +4475,7 @@ export {
|
|
|
4468
4475
|
Br as useMediaDevices,
|
|
4469
4476
|
$r as useMicrophoneState,
|
|
4470
4477
|
ri as usePathname,
|
|
4471
|
-
|
|
4478
|
+
ko as useRegisterFields,
|
|
4472
4479
|
ui as useRouteMatch,
|
|
4473
4480
|
Fr as useScreenShareState,
|
|
4474
4481
|
Ho as useTranscript
|