@livelayer/react 0.5.21 → 0.5.22
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 +570 -557
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as _, jsx as n, Fragment as
|
|
3
|
-
import { Component as mn, useState as
|
|
2
|
+
import { jsxs as _, jsx as n, Fragment as Lt } from "react/jsx-runtime";
|
|
3
|
+
import { Component as mn, useState as S, useRef as A, useEffect as N, useCallback as L, useMemo as dt, forwardRef as St, createElement as gn } from "react";
|
|
4
4
|
import { LiveKitSession as yn } from "@livelayer/sdk";
|
|
5
5
|
import { createLocalAudioTrack as vn, Track as en, createLocalVideoTrack as bn } from "livekit-client";
|
|
6
6
|
class wn extends mn {
|
|
@@ -34,8 +34,8 @@ class wn extends mn {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
function _n(e) {
|
|
37
|
-
const [t, r] =
|
|
38
|
-
|
|
37
|
+
const [t, r] = S("idle"), [i, o] = S("idle"), [l, c] = S([]), [u, f] = S(null), [y, b] = S(null), [s, a] = S(null), [x, E] = S(!1), [C, v] = S(null), w = A(null), H = A(e.onDataMessage);
|
|
38
|
+
H.current = e.onDataMessage, N(() => {
|
|
39
39
|
const R = {
|
|
40
40
|
onConnectionStateChange: (z) => {
|
|
41
41
|
r(z), z === "connected" && v(null);
|
|
@@ -49,7 +49,7 @@ function _n(e) {
|
|
|
49
49
|
onError: (z) => v(z),
|
|
50
50
|
onDataMessage: (z) => {
|
|
51
51
|
var M;
|
|
52
|
-
(M =
|
|
52
|
+
(M = H.current) == null || M.call(H, z);
|
|
53
53
|
},
|
|
54
54
|
onResumabilityChange: E
|
|
55
55
|
}, W = new yn(
|
|
@@ -73,7 +73,7 @@ function _n(e) {
|
|
|
73
73
|
e.sessionEndpoint,
|
|
74
74
|
JSON.stringify(e.sessionBody ?? {})
|
|
75
75
|
]);
|
|
76
|
-
const I =
|
|
76
|
+
const I = L(async () => {
|
|
77
77
|
const R = w.current;
|
|
78
78
|
if (R)
|
|
79
79
|
try {
|
|
@@ -81,10 +81,10 @@ function _n(e) {
|
|
|
81
81
|
} catch (W) {
|
|
82
82
|
throw v(W instanceof Error ? W.message : String(W)), W;
|
|
83
83
|
}
|
|
84
|
-
}, []), q =
|
|
84
|
+
}, []), q = L(() => {
|
|
85
85
|
const R = w.current;
|
|
86
86
|
R && R.disconnect();
|
|
87
|
-
}, []), m =
|
|
87
|
+
}, []), m = L(() => {
|
|
88
88
|
var R;
|
|
89
89
|
return ((R = w.current) == null ? void 0 : R.getRoom()) ?? null;
|
|
90
90
|
}, []);
|
|
@@ -104,7 +104,7 @@ function _n(e) {
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
function xn() {
|
|
107
|
-
const e = A(null), t = A(null), r = A(null), i = A(null), o = A(/* @__PURE__ */ new Set()), l = A(null), c =
|
|
107
|
+
const e = A(null), t = A(null), r = A(null), i = A(null), o = A(/* @__PURE__ */ new Set()), l = A(null), c = L(() => {
|
|
108
108
|
const s = t.current;
|
|
109
109
|
if (!s) {
|
|
110
110
|
i.current = null;
|
|
@@ -125,11 +125,11 @@ function xn() {
|
|
|
125
125
|
console.error("[useAudioLevel] subscriber threw:", v);
|
|
126
126
|
}
|
|
127
127
|
i.current = requestAnimationFrame(c);
|
|
128
|
-
}, []), u =
|
|
128
|
+
}, []), u = L(() => {
|
|
129
129
|
if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
|
|
130
130
|
const s = new AudioContext(), a = s.createAnalyser();
|
|
131
131
|
a.fftSize = 64, a.connect(s.destination), e.current = s, t.current = a;
|
|
132
|
-
}, []), f =
|
|
132
|
+
}, []), f = L(
|
|
133
133
|
(s) => {
|
|
134
134
|
if (u(), !(!e.current || !t.current)) {
|
|
135
135
|
if (r.current) {
|
|
@@ -150,7 +150,7 @@ function xn() {
|
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
152
|
[u, c]
|
|
153
|
-
), y =
|
|
153
|
+
), y = L(() => {
|
|
154
154
|
if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), r.current) {
|
|
155
155
|
try {
|
|
156
156
|
r.current.disconnect();
|
|
@@ -158,7 +158,7 @@ function xn() {
|
|
|
158
158
|
}
|
|
159
159
|
r.current = null;
|
|
160
160
|
}
|
|
161
|
-
}, []), b =
|
|
161
|
+
}, []), b = L((s) => (o.current.add(s), () => {
|
|
162
162
|
o.current.delete(s);
|
|
163
163
|
}), []);
|
|
164
164
|
return N(() => () => {
|
|
@@ -180,7 +180,7 @@ function xn() {
|
|
|
180
180
|
}, [y]), { attach: f, detach: y, subscribe: b };
|
|
181
181
|
}
|
|
182
182
|
function kn() {
|
|
183
|
-
const [e, t] =
|
|
183
|
+
const [e, t] = S(!1), [r, i] = S(null), o = A(null), l = A(null), c = L(
|
|
184
184
|
async (s, a) => {
|
|
185
185
|
if (o.current && l.current) {
|
|
186
186
|
try {
|
|
@@ -202,13 +202,13 @@ function kn() {
|
|
|
202
202
|
}
|
|
203
203
|
},
|
|
204
204
|
[]
|
|
205
|
-
), u =
|
|
205
|
+
), u = L(() => {
|
|
206
206
|
const s = o.current;
|
|
207
207
|
s && (s.isMuted ? (s.unmute(), t(!1)) : (s.mute(), t(!0)));
|
|
208
|
-
}, []), f =
|
|
208
|
+
}, []), f = L((s) => {
|
|
209
209
|
const a = o.current;
|
|
210
210
|
a && (s && !a.isMuted ? (a.mute(), t(!0)) : !s && a.isMuted && (a.unmute(), t(!1)));
|
|
211
|
-
}, []), y =
|
|
211
|
+
}, []), y = L(() => {
|
|
212
212
|
const s = o.current, a = l.current;
|
|
213
213
|
if (s && a) {
|
|
214
214
|
try {
|
|
@@ -218,7 +218,7 @@ function kn() {
|
|
|
218
218
|
s.stop();
|
|
219
219
|
}
|
|
220
220
|
o.current = null, l.current = null, t(!1);
|
|
221
|
-
}, []), b =
|
|
221
|
+
}, []), b = L(() => i(null), []);
|
|
222
222
|
return {
|
|
223
223
|
isMuted: e,
|
|
224
224
|
micError: r,
|
|
@@ -231,11 +231,11 @@ function kn() {
|
|
|
231
231
|
}
|
|
232
232
|
const Ln = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
233
233
|
function Sn() {
|
|
234
|
-
const [e, t] =
|
|
234
|
+
const [e, t] = S(!1), [r, i] = S(null), [o, l] = S(null), [c, u] = S(""), f = A(null), y = A(null), b = L((w) => {
|
|
235
235
|
f.current = w;
|
|
236
|
-
}, []), s =
|
|
237
|
-
const w = f.current,
|
|
238
|
-
if (
|
|
236
|
+
}, []), s = L(() => {
|
|
237
|
+
const w = f.current, H = y.current;
|
|
238
|
+
if (H && w) {
|
|
239
239
|
const I = w.localParticipant.getTrackPublication(en.Source.Camera);
|
|
240
240
|
if (I != null && I.track) {
|
|
241
241
|
try {
|
|
@@ -244,22 +244,22 @@ function Sn() {
|
|
|
244
244
|
}
|
|
245
245
|
I.track.stop();
|
|
246
246
|
} else
|
|
247
|
-
|
|
247
|
+
H.stop();
|
|
248
248
|
}
|
|
249
249
|
y.current = null, l(null), t(!1);
|
|
250
|
-
}, []), a =
|
|
251
|
-
const
|
|
252
|
-
if (
|
|
250
|
+
}, []), a = L(async (w) => {
|
|
251
|
+
const H = f.current;
|
|
252
|
+
if (H) {
|
|
253
253
|
i(null);
|
|
254
254
|
try {
|
|
255
255
|
const I = { ...Ln };
|
|
256
256
|
w && (I.deviceId = w);
|
|
257
257
|
const q = await bn(I);
|
|
258
|
-
await
|
|
258
|
+
await H.localParticipant.publishTrack(q), y.current = q;
|
|
259
259
|
const m = q.attach();
|
|
260
260
|
l(m), t(!0), w && u(w);
|
|
261
261
|
try {
|
|
262
|
-
|
|
262
|
+
H.localParticipant.publishData(
|
|
263
263
|
new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
|
|
264
264
|
{ reliable: !0 }
|
|
265
265
|
);
|
|
@@ -270,13 +270,13 @@ function Sn() {
|
|
|
270
270
|
i(q);
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
}, []), x =
|
|
273
|
+
}, []), x = L(async () => {
|
|
274
274
|
e ? s() : await a(c || void 0);
|
|
275
|
-
}, [e, c, s, a]), E =
|
|
275
|
+
}, [e, c, s, a]), E = L(async (w) => {
|
|
276
276
|
s(), await a(w);
|
|
277
|
-
}, [s, a]), C =
|
|
277
|
+
}, [s, a]), C = L(() => {
|
|
278
278
|
s(), f.current = null, i(null), u("");
|
|
279
|
-
}, [s]), v =
|
|
279
|
+
}, [s]), v = L(() => i(null), []);
|
|
280
280
|
return N(() => () => {
|
|
281
281
|
y.current && y.current.stop();
|
|
282
282
|
}, []), {
|
|
@@ -292,9 +292,9 @@ function Sn() {
|
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
294
|
function Cn() {
|
|
295
|
-
const [e, t] =
|
|
295
|
+
const [e, t] = S(!1), [r, i] = S(null), [o, l] = S(null), c = A(null), u = L((a) => {
|
|
296
296
|
c.current = a;
|
|
297
|
-
}, []), f =
|
|
297
|
+
}, []), f = L(() => l(null), []), y = L(async () => {
|
|
298
298
|
const a = c.current;
|
|
299
299
|
if (a) {
|
|
300
300
|
if (e) {
|
|
@@ -331,7 +331,7 @@ function Cn() {
|
|
|
331
331
|
E !== "NotAllowedError" && E !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
|
-
}, [e, f]), b =
|
|
334
|
+
}, [e, f]), b = L(() => {
|
|
335
335
|
const a = c.current;
|
|
336
336
|
if (a && e)
|
|
337
337
|
try {
|
|
@@ -339,11 +339,11 @@ function Cn() {
|
|
|
339
339
|
} catch {
|
|
340
340
|
}
|
|
341
341
|
f(), t(!1), i(null), c.current = null;
|
|
342
|
-
}, [e, f]), s =
|
|
342
|
+
}, [e, f]), s = L(() => i(null), []);
|
|
343
343
|
return { isEnabled: e, error: r, previewEl: o, toggle: y, attachRoom: u, teardown: b, clearError: s };
|
|
344
344
|
}
|
|
345
345
|
function En() {
|
|
346
|
-
const [e, t] =
|
|
346
|
+
const [e, t] = S([]), [r, i] = S([]), o = L(async () => {
|
|
347
347
|
if (!(typeof navigator > "u" || !navigator.mediaDevices))
|
|
348
348
|
try {
|
|
349
349
|
const l = await navigator.mediaDevices.enumerateDevices();
|
|
@@ -358,7 +358,7 @@ function En() {
|
|
|
358
358
|
}, [o]), { mics: e, cameras: r, refresh: o };
|
|
359
359
|
}
|
|
360
360
|
function Nn(e, t, r = !1) {
|
|
361
|
-
const [i, o] =
|
|
361
|
+
const [i, o] = S(null), [l, c] = S(null), [u, f] = S(!r && !!e);
|
|
362
362
|
return N(() => {
|
|
363
363
|
if (r || !e) {
|
|
364
364
|
f(!1);
|
|
@@ -400,7 +400,7 @@ function Mn({
|
|
|
400
400
|
defaultValue: t = "expanded",
|
|
401
401
|
onChange: r
|
|
402
402
|
} = {}) {
|
|
403
|
-
const i = e !== void 0, [o, l] =
|
|
403
|
+
const i = e !== void 0, [o, l] = S(t), c = i ? e : o, u = L(
|
|
404
404
|
(f) => {
|
|
405
405
|
f !== c && (i || l(f), r == null || r(f));
|
|
406
406
|
},
|
|
@@ -412,7 +412,7 @@ const In = ["hidden", "minimized", "expanded"];
|
|
|
412
412
|
function Tn(e) {
|
|
413
413
|
return e && In.includes(e) ? e : null;
|
|
414
414
|
}
|
|
415
|
-
function
|
|
415
|
+
function Dn({
|
|
416
416
|
value: e,
|
|
417
417
|
defaultValue: t = "expanded",
|
|
418
418
|
onChange: r,
|
|
@@ -432,9 +432,9 @@ function Pn({
|
|
|
432
432
|
y && y !== u && f(y);
|
|
433
433
|
}, []), [u, f];
|
|
434
434
|
}
|
|
435
|
-
const
|
|
436
|
-
function $n(e =
|
|
437
|
-
const [t, r] =
|
|
435
|
+
const Pn = 640;
|
|
436
|
+
function $n(e = Pn) {
|
|
437
|
+
const [t, r] = S(!1);
|
|
438
438
|
return N(() => {
|
|
439
439
|
if (e === !1) {
|
|
440
440
|
r(!1);
|
|
@@ -448,43 +448,43 @@ function $n(e = Dn) {
|
|
|
448
448
|
});
|
|
449
449
|
}, [e]), t;
|
|
450
450
|
}
|
|
451
|
-
const
|
|
451
|
+
const Ot = "__llHistoryPatched", ut = "ll:pathname";
|
|
452
452
|
function zn() {
|
|
453
|
-
if (typeof window > "u" || window.history[
|
|
453
|
+
if (typeof window > "u" || window.history[Ot]) return;
|
|
454
454
|
const e = window.history.pushState, t = window.history.replaceState;
|
|
455
455
|
window.history.pushState = function(...r) {
|
|
456
456
|
const i = e.apply(this, r);
|
|
457
|
-
return window.dispatchEvent(new Event(
|
|
457
|
+
return window.dispatchEvent(new Event(ut)), i;
|
|
458
458
|
}, window.history.replaceState = function(...r) {
|
|
459
459
|
const i = t.apply(this, r);
|
|
460
|
-
return window.dispatchEvent(new Event(
|
|
461
|
-
}, window.history[
|
|
460
|
+
return window.dispatchEvent(new Event(ut)), i;
|
|
461
|
+
}, window.history[Ot] = !0;
|
|
462
462
|
}
|
|
463
463
|
function Ht() {
|
|
464
464
|
return typeof window > "u" ? "/" : window.location.pathname || "/";
|
|
465
465
|
}
|
|
466
|
-
function
|
|
467
|
-
const [t, r] =
|
|
466
|
+
function On(e) {
|
|
467
|
+
const [t, r] = S(
|
|
468
468
|
() => e ?? Ht()
|
|
469
469
|
);
|
|
470
470
|
return N(() => {
|
|
471
471
|
if (e !== void 0) return;
|
|
472
472
|
zn();
|
|
473
473
|
const i = () => r(Ht());
|
|
474
|
-
return i(), window.addEventListener("popstate", i), window.addEventListener(
|
|
475
|
-
window.removeEventListener("popstate", i), window.removeEventListener(
|
|
474
|
+
return i(), window.addEventListener("popstate", i), window.addEventListener(ut, i), () => {
|
|
475
|
+
window.removeEventListener("popstate", i), window.removeEventListener(ut, i);
|
|
476
476
|
};
|
|
477
477
|
}, [e]), e ?? t;
|
|
478
478
|
}
|
|
479
|
-
const
|
|
479
|
+
const qt = /* @__PURE__ */ new Map(), Hn = /[\\^$+?.()|{}[\]]/g;
|
|
480
480
|
function qn(e) {
|
|
481
|
-
return e.replace(
|
|
481
|
+
return e.replace(Hn, "\\$&");
|
|
482
482
|
}
|
|
483
483
|
function Bn(e) {
|
|
484
|
-
const t =
|
|
484
|
+
const t = qt.get(e);
|
|
485
485
|
if (t) return t;
|
|
486
486
|
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", o = "", l = r.replace(/\*\*/g, i).replace(/\*/g, o), u = qn(l).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(o, "g"), "[^/]+"), f = new RegExp(`^${u}\\/?$`);
|
|
487
|
-
return
|
|
487
|
+
return qt.set(e, f), f;
|
|
488
488
|
}
|
|
489
489
|
function Wn(e, t) {
|
|
490
490
|
const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
|
|
@@ -493,22 +493,22 @@ function Wn(e, t) {
|
|
|
493
493
|
function Fn(e, t) {
|
|
494
494
|
return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : Wn(e, t);
|
|
495
495
|
}
|
|
496
|
-
function
|
|
496
|
+
function Bt(e, t) {
|
|
497
497
|
if (!e || e.length === 0) return !1;
|
|
498
498
|
for (const r of e)
|
|
499
499
|
if (Fn(r, t)) return !0;
|
|
500
500
|
return !1;
|
|
501
501
|
}
|
|
502
502
|
function Un(e, t, r) {
|
|
503
|
-
return e === void 0 ? !0 :
|
|
503
|
+
return e === void 0 ? !0 : Bt(r, e) ? !1 : t && t.length > 0 ? Bt(t, e) : !0;
|
|
504
504
|
}
|
|
505
505
|
function jn(e, t, r) {
|
|
506
|
-
return
|
|
506
|
+
return dt(
|
|
507
507
|
() => Un(e, t, r),
|
|
508
508
|
[e, t, r]
|
|
509
509
|
);
|
|
510
510
|
}
|
|
511
|
-
const
|
|
511
|
+
const Wt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
|
|
512
512
|
"svg",
|
|
513
513
|
{
|
|
514
514
|
className: t,
|
|
@@ -554,7 +554,7 @@ const Bt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
|
|
|
554
554
|
}
|
|
555
555
|
)
|
|
556
556
|
}
|
|
557
|
-
),
|
|
557
|
+
), Ft = ({ className: e }) => /* @__PURE__ */ n(
|
|
558
558
|
"svg",
|
|
559
559
|
{
|
|
560
560
|
className: e,
|
|
@@ -588,7 +588,7 @@ const Bt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
|
|
|
588
588
|
right: 0,
|
|
589
589
|
up: -90,
|
|
590
590
|
down: 90
|
|
591
|
-
},
|
|
591
|
+
}, Ut = ({ direction: e = "right", className: t }) => /* @__PURE__ */ n(
|
|
592
592
|
"svg",
|
|
593
593
|
{
|
|
594
594
|
className: t,
|
|
@@ -604,7 +604,7 @@ const Bt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ _(
|
|
|
604
604
|
function Jn(e) {
|
|
605
605
|
return e === "top-left" || e === "bottom-left" ? "left" : "right";
|
|
606
606
|
}
|
|
607
|
-
const tn = "ll-hidden-tab-center-y", Kn = 5,
|
|
607
|
+
const tn = "ll-hidden-tab-center-y", Kn = 5, jt = 16;
|
|
608
608
|
function Xn() {
|
|
609
609
|
if (typeof window > "u") return null;
|
|
610
610
|
try {
|
|
@@ -616,7 +616,7 @@ function Xn() {
|
|
|
616
616
|
return null;
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
function
|
|
619
|
+
function Vt(e) {
|
|
620
620
|
if (!(typeof window > "u"))
|
|
621
621
|
try {
|
|
622
622
|
window.localStorage.setItem(tn, String(e));
|
|
@@ -632,10 +632,10 @@ const Gn = ({
|
|
|
632
632
|
avatarImageUrl: l,
|
|
633
633
|
agentName: c
|
|
634
634
|
}) => {
|
|
635
|
-
const u = Jn(e), f = u === "right" ? "left" : "right", y = t ? 80 : 72, b = !!l, [s, a] =
|
|
635
|
+
const u = Jn(e), f = u === "right" ? "left" : "right", y = t ? 80 : 72, b = !!l, [s, a] = S(null), [x, E] = S(!1), C = A(null), v = A(!1), w = L(
|
|
636
636
|
(M) => {
|
|
637
637
|
if (typeof window > "u") return M;
|
|
638
|
-
const B = y / 2, F =
|
|
638
|
+
const B = y / 2, F = jt + B, G = window.innerHeight - jt - B;
|
|
639
639
|
return G < F ? Math.max(F, M) : Math.max(F, Math.min(G, M));
|
|
640
640
|
},
|
|
641
641
|
[y]
|
|
@@ -648,7 +648,7 @@ const Gn = ({
|
|
|
648
648
|
};
|
|
649
649
|
return window.addEventListener("resize", B), () => window.removeEventListener("resize", B);
|
|
650
650
|
}, [w]);
|
|
651
|
-
const
|
|
651
|
+
const H = L(
|
|
652
652
|
(M) => {
|
|
653
653
|
if (!(M.pointerType === "mouse" && M.button !== 0) && s !== null) {
|
|
654
654
|
try {
|
|
@@ -663,7 +663,7 @@ const Gn = ({
|
|
|
663
663
|
}
|
|
664
664
|
},
|
|
665
665
|
[s]
|
|
666
|
-
), I =
|
|
666
|
+
), I = L(
|
|
667
667
|
(M) => {
|
|
668
668
|
const B = C.current;
|
|
669
669
|
if (!B) return;
|
|
@@ -671,7 +671,7 @@ const Gn = ({
|
|
|
671
671
|
!B.moved && Math.abs(F) > Kn && (B.moved = !0, E(!0)), B.moved && a(w(B.startCenterY + F));
|
|
672
672
|
},
|
|
673
673
|
[w]
|
|
674
|
-
), q =
|
|
674
|
+
), q = L(
|
|
675
675
|
(M) => {
|
|
676
676
|
const B = C.current;
|
|
677
677
|
if (B) {
|
|
@@ -679,17 +679,17 @@ const Gn = ({
|
|
|
679
679
|
M.currentTarget.releasePointerCapture(M.pointerId);
|
|
680
680
|
} catch {
|
|
681
681
|
}
|
|
682
|
-
C.current = null, B.moved && (E(!1), v.current = !0, a((F) => (F !== null &&
|
|
682
|
+
C.current = null, B.moved && (E(!1), v.current = !0, a((F) => (F !== null && Vt(F), F)));
|
|
683
683
|
}
|
|
684
684
|
},
|
|
685
685
|
[]
|
|
686
|
-
), m =
|
|
686
|
+
), m = L(() => {
|
|
687
687
|
if (v.current) {
|
|
688
688
|
v.current = !1;
|
|
689
689
|
return;
|
|
690
690
|
}
|
|
691
691
|
i();
|
|
692
|
-
}, [i]), R =
|
|
692
|
+
}, [i]), R = L(
|
|
693
693
|
(M) => {
|
|
694
694
|
if (M.key === "ArrowUp" || M.key === "ArrowDown") {
|
|
695
695
|
M.preventDefault();
|
|
@@ -697,7 +697,7 @@ const Gn = ({
|
|
|
697
697
|
a((F) => {
|
|
698
698
|
if (F === null) return F;
|
|
699
699
|
const G = w(F + B);
|
|
700
|
-
return
|
|
700
|
+
return Vt(G), G;
|
|
701
701
|
});
|
|
702
702
|
}
|
|
703
703
|
},
|
|
@@ -715,7 +715,7 @@ const Gn = ({
|
|
|
715
715
|
{
|
|
716
716
|
type: "button",
|
|
717
717
|
className: W,
|
|
718
|
-
onPointerDown:
|
|
718
|
+
onPointerDown: H,
|
|
719
719
|
onPointerMove: I,
|
|
720
720
|
onPointerUp: q,
|
|
721
721
|
onPointerCancel: q,
|
|
@@ -729,9 +729,9 @@ const Gn = ({
|
|
|
729
729
|
// as the click affordance), then the circular avatar photo
|
|
730
730
|
// taking the rest of the tab. Reinforces "this is an
|
|
731
731
|
// avatar-based experience" even when collapsed.
|
|
732
|
-
/* @__PURE__ */ _(
|
|
732
|
+
/* @__PURE__ */ _(Lt, { children: [
|
|
733
733
|
/* @__PURE__ */ n(
|
|
734
|
-
|
|
734
|
+
Ut,
|
|
735
735
|
{
|
|
736
736
|
direction: f,
|
|
737
737
|
className: "ll-hidden__chevron ll-hidden__chevron--mini"
|
|
@@ -748,7 +748,7 @@ const Gn = ({
|
|
|
748
748
|
)
|
|
749
749
|
] })
|
|
750
750
|
) : /* @__PURE__ */ n(
|
|
751
|
-
|
|
751
|
+
Ut,
|
|
752
752
|
{
|
|
753
753
|
direction: f,
|
|
754
754
|
className: "ll-hidden__chevron"
|
|
@@ -764,7 +764,7 @@ const Gn = ({
|
|
|
764
764
|
className: o,
|
|
765
765
|
barClassName: l
|
|
766
766
|
}) => {
|
|
767
|
-
const c = A(null), u = A([]), f =
|
|
767
|
+
const c = A(null), u = A([]), f = dt(() => {
|
|
768
768
|
const b = (Math.sqrt(5) - 1) / 2;
|
|
769
769
|
return Array.from({ length: t }, (s, a) => 0.5 + a * b % 1 * 0.5);
|
|
770
770
|
}, [t]);
|
|
@@ -848,10 +848,10 @@ const Gn = ({
|
|
|
848
848
|
(b.key === "Enter" || b.key === " ") && (b.stopPropagation(), b.preventDefault(), f());
|
|
849
849
|
},
|
|
850
850
|
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
851
|
-
children: /* @__PURE__ */ n(
|
|
851
|
+
children: /* @__PURE__ */ n(Wt, { muted: l, className: "ll-minimized__icon" })
|
|
852
852
|
}
|
|
853
853
|
),
|
|
854
|
-
/* @__PURE__ */ n(
|
|
854
|
+
/* @__PURE__ */ n(Ft, { className: "ll-minimized__icon ll-minimized__icon--expand" })
|
|
855
855
|
] })
|
|
856
856
|
]
|
|
857
857
|
}
|
|
@@ -888,7 +888,7 @@ const Gn = ({
|
|
|
888
888
|
className: "ll-minimized__btn",
|
|
889
889
|
onClick: f,
|
|
890
890
|
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
891
|
-
children: /* @__PURE__ */ n(
|
|
891
|
+
children: /* @__PURE__ */ n(Wt, { muted: l, className: "ll-minimized__icon" })
|
|
892
892
|
}
|
|
893
893
|
),
|
|
894
894
|
/* @__PURE__ */ n(
|
|
@@ -898,7 +898,7 @@ const Gn = ({
|
|
|
898
898
|
className: "ll-minimized__btn",
|
|
899
899
|
onClick: u,
|
|
900
900
|
"aria-label": `Expand ${r} widget`,
|
|
901
|
-
children: /* @__PURE__ */ n(
|
|
901
|
+
children: /* @__PURE__ */ n(Ft, { className: "ll-minimized__icon" })
|
|
902
902
|
}
|
|
903
903
|
),
|
|
904
904
|
/* @__PURE__ */ n(
|
|
@@ -921,7 +921,7 @@ const Gn = ({
|
|
|
921
921
|
className: i,
|
|
922
922
|
style: o
|
|
923
923
|
}) => {
|
|
924
|
-
const [l, c] =
|
|
924
|
+
const [l, c] = S(!1), u = A(e);
|
|
925
925
|
if (N(() => {
|
|
926
926
|
u.current !== e && (u.current = e, c(!1));
|
|
927
927
|
}, [e]), !e) return null;
|
|
@@ -971,7 +971,7 @@ const Gn = ({
|
|
|
971
971
|
connectionState: C,
|
|
972
972
|
agentState: v,
|
|
973
973
|
transcript: w,
|
|
974
|
-
canResume:
|
|
974
|
+
canResume: H,
|
|
975
975
|
needsUserGesture: I,
|
|
976
976
|
error: q,
|
|
977
977
|
isMuted: m,
|
|
@@ -983,29 +983,29 @@ const Gn = ({
|
|
|
983
983
|
activeCameraId: F,
|
|
984
984
|
isScreenShareEnabled: G,
|
|
985
985
|
screenPreviewEl: ie,
|
|
986
|
-
isSpeakerMuted:
|
|
987
|
-
allowCamera:
|
|
988
|
-
allowScreenShare:
|
|
989
|
-
allowTyping:
|
|
990
|
-
avatarVideoContainerRef:
|
|
986
|
+
isSpeakerMuted: we,
|
|
987
|
+
allowCamera: tt,
|
|
988
|
+
allowScreenShare: nt,
|
|
989
|
+
allowTyping: rt,
|
|
990
|
+
avatarVideoContainerRef: it,
|
|
991
991
|
agentVideoEl: re,
|
|
992
992
|
micGateOpen: ce,
|
|
993
|
-
onConnect:
|
|
994
|
-
onDisconnect:
|
|
995
|
-
onRetry:
|
|
996
|
-
onResumeAudio:
|
|
997
|
-
onToggleMute:
|
|
998
|
-
onToggleCamera:
|
|
993
|
+
onConnect: _e,
|
|
994
|
+
onDisconnect: Ne,
|
|
995
|
+
onRetry: Ae,
|
|
996
|
+
onResumeAudio: Re,
|
|
997
|
+
onToggleMute: Me,
|
|
998
|
+
onToggleCamera: Ie,
|
|
999
999
|
onSwitchCameraDevice: V,
|
|
1000
|
-
onToggleScreenShare:
|
|
1001
|
-
onToggleSpeaker:
|
|
1002
|
-
onSendMessage:
|
|
1003
|
-
onMinimize:
|
|
1004
|
-
onClose:
|
|
1005
|
-
onClearMicError:
|
|
1000
|
+
onToggleScreenShare: pt,
|
|
1001
|
+
onToggleSpeaker: ht,
|
|
1002
|
+
onSendMessage: ot,
|
|
1003
|
+
onMinimize: de,
|
|
1004
|
+
onClose: Te,
|
|
1005
|
+
onClearMicError: Fe
|
|
1006
1006
|
}) => {
|
|
1007
|
-
var
|
|
1008
|
-
const
|
|
1007
|
+
var Oe;
|
|
1008
|
+
const xe = ((u == null ? void 0 : u.length) ?? 0) > 1, De = C === "connecting" || C === "connected", X = C === "connected", ee = C === "idle" || C === "disconnected" || C === "error", [Pe, oe] = S(!1);
|
|
1009
1009
|
N(() => {
|
|
1010
1010
|
if (!re) {
|
|
1011
1011
|
oe(!1);
|
|
@@ -1021,17 +1021,17 @@ const Gn = ({
|
|
|
1021
1021
|
re.removeEventListener("playing", p), re.removeEventListener("loadeddata", p);
|
|
1022
1022
|
};
|
|
1023
1023
|
}, [re]);
|
|
1024
|
-
const [
|
|
1024
|
+
const [ue, ke] = S(!1);
|
|
1025
1025
|
N(() => {
|
|
1026
1026
|
if (!X) {
|
|
1027
|
-
|
|
1027
|
+
ke(!1);
|
|
1028
1028
|
return;
|
|
1029
1029
|
}
|
|
1030
|
-
if (
|
|
1031
|
-
const p = setTimeout(() =>
|
|
1030
|
+
if (Pe) return;
|
|
1031
|
+
const p = setTimeout(() => ke(!0), 8e3);
|
|
1032
1032
|
return () => clearTimeout(p);
|
|
1033
|
-
}, [X,
|
|
1034
|
-
const
|
|
1033
|
+
}, [X, Pe]);
|
|
1034
|
+
const Ue = C === "connecting" || X && !!i && !Pe && !ue, te = A(null), le = A(null);
|
|
1035
1035
|
N(() => {
|
|
1036
1036
|
const p = te.current;
|
|
1037
1037
|
p && (p.innerHTML = "", M && (M.style.width = "100%", M.style.height = "100%", M.style.objectFit = "cover", M.style.transform = "scaleX(-1)", p.appendChild(M)));
|
|
@@ -1039,44 +1039,44 @@ const Gn = ({
|
|
|
1039
1039
|
const p = le.current;
|
|
1040
1040
|
p && (p.innerHTML = "", ie && (ie.style.width = "100%", ie.style.height = "100%", ie.style.objectFit = "contain", p.appendChild(ie)));
|
|
1041
1041
|
}, [ie]);
|
|
1042
|
-
const [ae,
|
|
1042
|
+
const [ae, pe] = S(!1), [$e, he] = S(!1);
|
|
1043
1043
|
N(() => {
|
|
1044
|
-
if (!ae &&
|
|
1044
|
+
if (!ae && !$e && !x && !b) return;
|
|
1045
1045
|
const p = () => {
|
|
1046
|
-
|
|
1046
|
+
pe(!1), he(!1), x && E(), b && s();
|
|
1047
1047
|
};
|
|
1048
1048
|
return document.addEventListener("click", p), () => document.removeEventListener("click", p);
|
|
1049
1049
|
}, [
|
|
1050
1050
|
ae,
|
|
1051
|
-
|
|
1051
|
+
$e,
|
|
1052
1052
|
x,
|
|
1053
1053
|
b,
|
|
1054
1054
|
E,
|
|
1055
1055
|
s
|
|
1056
1056
|
]);
|
|
1057
|
-
const [
|
|
1057
|
+
const [me, je] = S(""), Ve = L(
|
|
1058
1058
|
(p) => {
|
|
1059
1059
|
p.preventDefault();
|
|
1060
|
-
const Y =
|
|
1061
|
-
Y && (
|
|
1060
|
+
const Y = me.trim();
|
|
1061
|
+
Y && (ot(Y), je(""));
|
|
1062
1062
|
},
|
|
1063
|
-
[
|
|
1064
|
-
),
|
|
1065
|
-
let
|
|
1063
|
+
[me, ot]
|
|
1064
|
+
), Ye = c.productName || "Live Layer";
|
|
1065
|
+
let ge = null, ye = null;
|
|
1066
1066
|
for (let p = w.length - 1; p >= 0; p--) {
|
|
1067
1067
|
const Y = w[p];
|
|
1068
|
-
if (!
|
|
1068
|
+
if (!ge && Y.role === "agent" ? ge = Y : !ye && Y.role === "user" && (ye = Y), ge && ye) break;
|
|
1069
1069
|
}
|
|
1070
|
-
const
|
|
1070
|
+
const ze = X ? (ge == null ? void 0 : ge.text) || null : l || null, lt = X && (ye == null ? void 0 : ye.text) || null, Je = [
|
|
1071
1071
|
"ll-expanded",
|
|
1072
1072
|
t ? "ll-expanded--mobile" : "ll-expanded--desktop"
|
|
1073
1073
|
].join(" ");
|
|
1074
1074
|
return /* @__PURE__ */ _(
|
|
1075
1075
|
"div",
|
|
1076
1076
|
{
|
|
1077
|
-
className:
|
|
1077
|
+
className: Je,
|
|
1078
1078
|
"data-position": e,
|
|
1079
|
-
"data-state": X ? "connected" :
|
|
1079
|
+
"data-state": X ? "connected" : De ? "connecting" : "idle",
|
|
1080
1080
|
role: "dialog",
|
|
1081
1081
|
"aria-label": `${r} widget`,
|
|
1082
1082
|
children: [
|
|
@@ -1088,7 +1088,7 @@ const Gn = ({
|
|
|
1088
1088
|
alt: r,
|
|
1089
1089
|
className: "ll-expanded__bg-img"
|
|
1090
1090
|
}
|
|
1091
|
-
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((
|
|
1091
|
+
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Oe = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Oe.toUpperCase()) || "A" }) }),
|
|
1092
1092
|
o && !X && /* @__PURE__ */ n(
|
|
1093
1093
|
"video",
|
|
1094
1094
|
{
|
|
@@ -1101,8 +1101,8 @@ const Gn = ({
|
|
|
1101
1101
|
}
|
|
1102
1102
|
)
|
|
1103
1103
|
] }),
|
|
1104
|
-
/* @__PURE__ */ n("div", { ref:
|
|
1105
|
-
|
|
1104
|
+
/* @__PURE__ */ n("div", { ref: it, className: "ll-expanded__video" }),
|
|
1105
|
+
Ue && /* @__PURE__ */ _("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
|
|
1106
1106
|
/* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
|
|
1107
1107
|
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: y ? "Switching..." : "Connecting..." })
|
|
1108
1108
|
] }),
|
|
@@ -1111,14 +1111,14 @@ const Gn = ({
|
|
|
1111
1111
|
{
|
|
1112
1112
|
type: "button",
|
|
1113
1113
|
className: "ll-expanded__overlay ll-expanded__overlay--gesture",
|
|
1114
|
-
onClick:
|
|
1114
|
+
onClick: Re,
|
|
1115
1115
|
children: [
|
|
1116
1116
|
/* @__PURE__ */ n("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("path", { d: "M3 9v6h4l5 5V4L7 9H3zm13.54.12a5 5 0 0 1 0 5.76l-1.41-1.41a3 3 0 0 0 0-2.94L16.54 9.12z" }) }),
|
|
1117
1117
|
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
|
|
1118
1118
|
]
|
|
1119
1119
|
}
|
|
1120
1120
|
),
|
|
1121
|
-
|
|
1121
|
+
De ? /* @__PURE__ */ _("div", { className: "ll-expanded__topbar", children: [
|
|
1122
1122
|
/* @__PURE__ */ _("div", { className: "ll-expanded__topbar-left", children: [
|
|
1123
1123
|
/* @__PURE__ */ _("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1124
1124
|
/* @__PURE__ */ _(
|
|
@@ -1127,17 +1127,17 @@ const Gn = ({
|
|
|
1127
1127
|
type: "button",
|
|
1128
1128
|
className: "ll-hpill",
|
|
1129
1129
|
onClick: (p) => {
|
|
1130
|
-
|
|
1130
|
+
xe && (p.stopPropagation(), s());
|
|
1131
1131
|
},
|
|
1132
|
-
"aria-haspopup":
|
|
1133
|
-
"aria-expanded":
|
|
1132
|
+
"aria-haspopup": xe ? "listbox" : void 0,
|
|
1133
|
+
"aria-expanded": xe ? b : void 0,
|
|
1134
1134
|
children: [
|
|
1135
1135
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
|
|
1136
|
-
|
|
1136
|
+
xe && /* @__PURE__ */ n(st, {})
|
|
1137
1137
|
]
|
|
1138
1138
|
}
|
|
1139
1139
|
),
|
|
1140
|
-
|
|
1140
|
+
xe && b && /* @__PURE__ */ n(
|
|
1141
1141
|
"div",
|
|
1142
1142
|
{
|
|
1143
1143
|
className: "ll-hmenu",
|
|
@@ -1184,7 +1184,7 @@ const Gn = ({
|
|
|
1184
1184
|
title: "Language: English",
|
|
1185
1185
|
children: [
|
|
1186
1186
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: "EN" }),
|
|
1187
|
-
/* @__PURE__ */ n(
|
|
1187
|
+
/* @__PURE__ */ n(st, {})
|
|
1188
1188
|
]
|
|
1189
1189
|
}
|
|
1190
1190
|
),
|
|
@@ -1221,10 +1221,10 @@ const Gn = ({
|
|
|
1221
1221
|
{
|
|
1222
1222
|
type: "button",
|
|
1223
1223
|
className: "ll-hbtn",
|
|
1224
|
-
onClick:
|
|
1224
|
+
onClick: de,
|
|
1225
1225
|
"aria-label": "Minimize widget",
|
|
1226
1226
|
title: "Minimize",
|
|
1227
|
-
children: /* @__PURE__ */ n(
|
|
1227
|
+
children: /* @__PURE__ */ n(Jt, {})
|
|
1228
1228
|
}
|
|
1229
1229
|
),
|
|
1230
1230
|
/* @__PURE__ */ n(
|
|
@@ -1232,26 +1232,26 @@ const Gn = ({
|
|
|
1232
1232
|
{
|
|
1233
1233
|
type: "button",
|
|
1234
1234
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1235
|
-
onClick:
|
|
1235
|
+
onClick: Te,
|
|
1236
1236
|
"aria-label": "End call",
|
|
1237
1237
|
title: "End call",
|
|
1238
|
-
children: /* @__PURE__ */ n(
|
|
1238
|
+
children: /* @__PURE__ */ n(Yt, {})
|
|
1239
1239
|
}
|
|
1240
1240
|
)
|
|
1241
1241
|
] })
|
|
1242
1242
|
] }) : (
|
|
1243
1243
|
// Idle-state header with Live Layer product name + minimize/close
|
|
1244
1244
|
/* @__PURE__ */ _("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
|
|
1245
|
-
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children:
|
|
1245
|
+
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Ye }),
|
|
1246
1246
|
/* @__PURE__ */ _("div", { className: "ll-expanded__header-actions", children: [
|
|
1247
1247
|
/* @__PURE__ */ n(
|
|
1248
1248
|
"button",
|
|
1249
1249
|
{
|
|
1250
1250
|
type: "button",
|
|
1251
1251
|
className: "ll-hbtn ll-hbtn--ghost",
|
|
1252
|
-
onClick:
|
|
1252
|
+
onClick: de,
|
|
1253
1253
|
"aria-label": "Minimize widget",
|
|
1254
|
-
children: /* @__PURE__ */ n(
|
|
1254
|
+
children: /* @__PURE__ */ n(Jt, {})
|
|
1255
1255
|
}
|
|
1256
1256
|
),
|
|
1257
1257
|
/* @__PURE__ */ n(
|
|
@@ -1259,23 +1259,23 @@ const Gn = ({
|
|
|
1259
1259
|
{
|
|
1260
1260
|
type: "button",
|
|
1261
1261
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1262
|
-
onClick:
|
|
1262
|
+
onClick: Te,
|
|
1263
1263
|
"aria-label": "Close widget",
|
|
1264
|
-
children: /* @__PURE__ */ n(
|
|
1264
|
+
children: /* @__PURE__ */ n(Yt, {})
|
|
1265
1265
|
}
|
|
1266
1266
|
)
|
|
1267
1267
|
] })
|
|
1268
1268
|
] })
|
|
1269
1269
|
),
|
|
1270
1270
|
ee && /* @__PURE__ */ (() => {
|
|
1271
|
-
const p =
|
|
1272
|
-
return /* @__PURE__ */ _(
|
|
1273
|
-
C === "idle" && !
|
|
1271
|
+
const p = H ? "Restart paused session" : C === "disconnected" ? "Reconnect to agent" : "Start video call", Y = H ? "Pick up where you left off" : null;
|
|
1272
|
+
return /* @__PURE__ */ _(Lt, { children: [
|
|
1273
|
+
C === "idle" && !H && !q && /* @__PURE__ */ _(
|
|
1274
1274
|
"button",
|
|
1275
1275
|
{
|
|
1276
1276
|
type: "button",
|
|
1277
1277
|
className: "ll-expanded__play",
|
|
1278
|
-
onClick:
|
|
1278
|
+
onClick: _e,
|
|
1279
1279
|
"aria-label": p,
|
|
1280
1280
|
children: [
|
|
1281
1281
|
/* @__PURE__ */ n("div", { className: "ll-expanded__play-circle", children: /* @__PURE__ */ n("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("polygon", { points: "6 3 20 12 6 21 6 3" }) }) }),
|
|
@@ -1291,7 +1291,7 @@ const Gn = ({
|
|
|
1291
1291
|
{
|
|
1292
1292
|
type: "button",
|
|
1293
1293
|
className: "ll-expanded__cta",
|
|
1294
|
-
onClick:
|
|
1294
|
+
onClick: _e,
|
|
1295
1295
|
"aria-label": p,
|
|
1296
1296
|
children: p
|
|
1297
1297
|
}
|
|
@@ -1302,7 +1302,7 @@ const Gn = ({
|
|
|
1302
1302
|
/* @__PURE__ */ _(
|
|
1303
1303
|
"div",
|
|
1304
1304
|
{
|
|
1305
|
-
className: `ll-expanded__pip ${
|
|
1305
|
+
className: `ll-expanded__pip ${De && (z || G) ? "is-visible" : ""}`,
|
|
1306
1306
|
children: [
|
|
1307
1307
|
/* @__PURE__ */ n(
|
|
1308
1308
|
"div",
|
|
@@ -1321,42 +1321,42 @@ const Gn = ({
|
|
|
1321
1321
|
]
|
|
1322
1322
|
}
|
|
1323
1323
|
),
|
|
1324
|
-
|
|
1325
|
-
|
|
1324
|
+
De ? /* @__PURE__ */ _("div", { className: "ll-expanded__bottom", children: [
|
|
1325
|
+
ze && /* @__PURE__ */ n(
|
|
1326
1326
|
"div",
|
|
1327
1327
|
{
|
|
1328
1328
|
className: "ll-expanded__transcript ll-expanded__transcript--agent",
|
|
1329
1329
|
"data-role": "agent",
|
|
1330
|
-
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children:
|
|
1330
|
+
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: ze })
|
|
1331
1331
|
}
|
|
1332
1332
|
),
|
|
1333
|
-
|
|
1333
|
+
lt && /* @__PURE__ */ n(
|
|
1334
1334
|
"div",
|
|
1335
1335
|
{
|
|
1336
1336
|
className: "ll-expanded__transcript ll-expanded__transcript--user",
|
|
1337
1337
|
"data-role": "user",
|
|
1338
|
-
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children:
|
|
1338
|
+
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: lt })
|
|
1339
1339
|
}
|
|
1340
1340
|
),
|
|
1341
1341
|
/* @__PURE__ */ _("div", { className: "ll-toolbar", onClick: (p) => p.stopPropagation(), children: [
|
|
1342
|
-
|
|
1342
|
+
nt && /* @__PURE__ */ n(
|
|
1343
1343
|
"button",
|
|
1344
1344
|
{
|
|
1345
1345
|
type: "button",
|
|
1346
1346
|
className: `ll-tool ${G ? "is-on" : ""}`,
|
|
1347
|
-
onClick:
|
|
1347
|
+
onClick: pt,
|
|
1348
1348
|
"aria-label": G ? "Stop sharing screen" : "Share screen",
|
|
1349
1349
|
title: G ? "Stop sharing" : "Share screen",
|
|
1350
1350
|
children: /* @__PURE__ */ n(nr, {})
|
|
1351
1351
|
}
|
|
1352
1352
|
),
|
|
1353
|
-
|
|
1353
|
+
tt && /* @__PURE__ */ _("div", { className: "ll-tool-split", children: [
|
|
1354
1354
|
/* @__PURE__ */ n(
|
|
1355
1355
|
"button",
|
|
1356
1356
|
{
|
|
1357
1357
|
type: "button",
|
|
1358
1358
|
className: `ll-tool ll-tool--left ${z ? "is-on" : ""}`,
|
|
1359
|
-
onClick:
|
|
1359
|
+
onClick: Ie,
|
|
1360
1360
|
"aria-label": z ? "Turn off camera" : "Turn on camera",
|
|
1361
1361
|
title: z ? "Stop camera" : "Start camera",
|
|
1362
1362
|
children: /* @__PURE__ */ n(rr, {})
|
|
@@ -1368,22 +1368,22 @@ const Gn = ({
|
|
|
1368
1368
|
type: "button",
|
|
1369
1369
|
className: `ll-tool ll-tool--right ${z ? "is-on" : ""}`,
|
|
1370
1370
|
onClick: (p) => {
|
|
1371
|
-
p.stopPropagation(),
|
|
1371
|
+
p.stopPropagation(), he((Y) => !Y), pe(!1);
|
|
1372
1372
|
},
|
|
1373
1373
|
"aria-label": "Camera devices",
|
|
1374
1374
|
"aria-haspopup": "listbox",
|
|
1375
|
-
"aria-expanded":
|
|
1376
|
-
children: /* @__PURE__ */ n(
|
|
1375
|
+
"aria-expanded": $e,
|
|
1376
|
+
children: /* @__PURE__ */ n(st, {})
|
|
1377
1377
|
}
|
|
1378
1378
|
),
|
|
1379
|
-
|
|
1380
|
-
|
|
1379
|
+
$e && B.length > 0 && /* @__PURE__ */ n(
|
|
1380
|
+
Kt,
|
|
1381
1381
|
{
|
|
1382
1382
|
label: "Camera",
|
|
1383
1383
|
devices: B,
|
|
1384
1384
|
activeId: F,
|
|
1385
1385
|
onPick: (p) => {
|
|
1386
|
-
|
|
1386
|
+
he(!1), V(p);
|
|
1387
1387
|
}
|
|
1388
1388
|
}
|
|
1389
1389
|
)
|
|
@@ -1398,7 +1398,7 @@ const Gn = ({
|
|
|
1398
1398
|
{
|
|
1399
1399
|
type: "button",
|
|
1400
1400
|
className: `ll-tool ll-tool--left ${m ? "is-muted" : ""}`,
|
|
1401
|
-
onClick:
|
|
1401
|
+
onClick: Me,
|
|
1402
1402
|
disabled: !ce && X,
|
|
1403
1403
|
"aria-label": !ce && X ? "Microphone enables once the agent finishes its greeting" : m ? "Unmute microphone" : "Mute microphone",
|
|
1404
1404
|
title: !ce && X ? "Mic enables after greeting" : m ? "Unmute" : "Mute",
|
|
@@ -1411,21 +1411,21 @@ const Gn = ({
|
|
|
1411
1411
|
type: "button",
|
|
1412
1412
|
className: `ll-tool ll-tool--right ${m ? "is-muted" : ""}`,
|
|
1413
1413
|
onClick: (p) => {
|
|
1414
|
-
p.stopPropagation(),
|
|
1414
|
+
p.stopPropagation(), pe((Y) => !Y), he(!1);
|
|
1415
1415
|
},
|
|
1416
1416
|
"aria-label": "Microphone devices",
|
|
1417
1417
|
"aria-haspopup": "listbox",
|
|
1418
1418
|
"aria-expanded": ae,
|
|
1419
|
-
children: /* @__PURE__ */ n(
|
|
1419
|
+
children: /* @__PURE__ */ n(st, {})
|
|
1420
1420
|
}
|
|
1421
1421
|
),
|
|
1422
1422
|
ae && W.length > 0 && /* @__PURE__ */ n(
|
|
1423
|
-
|
|
1423
|
+
Kt,
|
|
1424
1424
|
{
|
|
1425
1425
|
label: "Microphone",
|
|
1426
1426
|
devices: W,
|
|
1427
1427
|
activeId: "",
|
|
1428
|
-
onPick: () =>
|
|
1428
|
+
onPick: () => pe(!1)
|
|
1429
1429
|
}
|
|
1430
1430
|
)
|
|
1431
1431
|
]
|
|
@@ -1435,11 +1435,11 @@ const Gn = ({
|
|
|
1435
1435
|
"button",
|
|
1436
1436
|
{
|
|
1437
1437
|
type: "button",
|
|
1438
|
-
className: `ll-tool ${
|
|
1439
|
-
onClick:
|
|
1440
|
-
"aria-label":
|
|
1441
|
-
title:
|
|
1442
|
-
children: /* @__PURE__ */ n(or, { muted:
|
|
1438
|
+
className: `ll-tool ${we ? "is-muted" : ""}`,
|
|
1439
|
+
onClick: ht,
|
|
1440
|
+
"aria-label": we ? "Unmute speaker" : "Mute speaker",
|
|
1441
|
+
title: we ? "Unmute speaker" : "Mute speaker",
|
|
1442
|
+
children: /* @__PURE__ */ n(or, { muted: we })
|
|
1443
1443
|
}
|
|
1444
1444
|
),
|
|
1445
1445
|
/* @__PURE__ */ n(
|
|
@@ -1447,26 +1447,26 @@ const Gn = ({
|
|
|
1447
1447
|
{
|
|
1448
1448
|
type: "button",
|
|
1449
1449
|
className: "ll-tool ll-tool--danger",
|
|
1450
|
-
onClick:
|
|
1450
|
+
onClick: Ne,
|
|
1451
1451
|
"aria-label": "End conversation",
|
|
1452
1452
|
title: "End conversation",
|
|
1453
1453
|
children: /* @__PURE__ */ n(ar, {})
|
|
1454
1454
|
}
|
|
1455
1455
|
)
|
|
1456
1456
|
] }),
|
|
1457
|
-
|
|
1457
|
+
rt && /* @__PURE__ */ _("form", { className: "ll-message-input", onSubmit: Ve, children: [
|
|
1458
1458
|
/* @__PURE__ */ n(
|
|
1459
1459
|
"input",
|
|
1460
1460
|
{
|
|
1461
1461
|
type: "text",
|
|
1462
1462
|
className: "ll-message-input__field",
|
|
1463
1463
|
placeholder: "Message...",
|
|
1464
|
-
value:
|
|
1465
|
-
onChange: (p) =>
|
|
1464
|
+
value: me,
|
|
1465
|
+
onChange: (p) => je(p.target.value),
|
|
1466
1466
|
"aria-label": "Message the agent"
|
|
1467
1467
|
}
|
|
1468
1468
|
),
|
|
1469
|
-
|
|
1469
|
+
me.trim() && /* @__PURE__ */ n(
|
|
1470
1470
|
"button",
|
|
1471
1471
|
{
|
|
1472
1472
|
type: "submit",
|
|
@@ -1486,7 +1486,7 @@ const Gn = ({
|
|
|
1486
1486
|
{
|
|
1487
1487
|
type: "button",
|
|
1488
1488
|
className: "ll-expanded__banner-x",
|
|
1489
|
-
onClick:
|
|
1489
|
+
onClick: Fe,
|
|
1490
1490
|
"aria-label": "Dismiss",
|
|
1491
1491
|
children: "×"
|
|
1492
1492
|
}
|
|
@@ -1501,7 +1501,7 @@ const Gn = ({
|
|
|
1501
1501
|
{
|
|
1502
1502
|
type: "button",
|
|
1503
1503
|
className: "ll-expanded__banner-retry",
|
|
1504
|
-
onClick:
|
|
1504
|
+
onClick: Ae,
|
|
1505
1505
|
children: Y
|
|
1506
1506
|
}
|
|
1507
1507
|
)
|
|
@@ -1511,16 +1511,16 @@ const Gn = ({
|
|
|
1511
1511
|
}
|
|
1512
1512
|
);
|
|
1513
1513
|
};
|
|
1514
|
-
function
|
|
1514
|
+
function st() {
|
|
1515
1515
|
return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ n("polyline", { points: "6 9 12 15 18 9" }) });
|
|
1516
1516
|
}
|
|
1517
|
-
function
|
|
1517
|
+
function Yt() {
|
|
1518
1518
|
return /* @__PURE__ */ _("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
|
|
1519
1519
|
/* @__PURE__ */ n("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1520
1520
|
/* @__PURE__ */ n("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1521
1521
|
] });
|
|
1522
1522
|
}
|
|
1523
|
-
function
|
|
1523
|
+
function Jt() {
|
|
1524
1524
|
return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
|
|
1525
1525
|
}
|
|
1526
1526
|
function nr() {
|
|
@@ -1547,7 +1547,7 @@ function ir({ muted: e }) {
|
|
|
1547
1547
|
function or({ muted: e }) {
|
|
1548
1548
|
return /* @__PURE__ */ _("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1549
1549
|
/* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
1550
|
-
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ _(
|
|
1550
|
+
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ _(Lt, { children: [
|
|
1551
1551
|
/* @__PURE__ */ n("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
|
|
1552
1552
|
/* @__PURE__ */ n("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
|
|
1553
1553
|
] })
|
|
@@ -1568,7 +1568,7 @@ function ar() {
|
|
|
1568
1568
|
}
|
|
1569
1569
|
) });
|
|
1570
1570
|
}
|
|
1571
|
-
const
|
|
1571
|
+
const Kt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */ _(
|
|
1572
1572
|
"div",
|
|
1573
1573
|
{
|
|
1574
1574
|
className: "ll-device-menu",
|
|
@@ -1600,7 +1600,7 @@ const Jt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */
|
|
|
1600
1600
|
'[data-ll-private="true"]',
|
|
1601
1601
|
".ll-widget"
|
|
1602
1602
|
];
|
|
1603
|
-
function
|
|
1603
|
+
function Ct(e) {
|
|
1604
1604
|
let t = e;
|
|
1605
1605
|
for (; t; ) {
|
|
1606
1606
|
for (const r of sr)
|
|
@@ -1609,8 +1609,8 @@ function xt(e) {
|
|
|
1609
1609
|
}
|
|
1610
1610
|
return !1;
|
|
1611
1611
|
}
|
|
1612
|
-
function
|
|
1613
|
-
if (
|
|
1612
|
+
function ft(e) {
|
|
1613
|
+
if (Ct(e)) return !1;
|
|
1614
1614
|
if (e instanceof HTMLInputElement) {
|
|
1615
1615
|
if (e.type === "password") return !1;
|
|
1616
1616
|
const t = (e.getAttribute("autocomplete") || "").toLowerCase();
|
|
@@ -1618,7 +1618,7 @@ function dt(e) {
|
|
|
1618
1618
|
}
|
|
1619
1619
|
return !0;
|
|
1620
1620
|
}
|
|
1621
|
-
const
|
|
1621
|
+
const ct = 4096, cr = 20, dr = 20, ur = 10, fr = 10, pr = 30, Xt = 500, hr = [
|
|
1622
1622
|
'[data-ll-private="true"]',
|
|
1623
1623
|
".ll-widget",
|
|
1624
1624
|
"script",
|
|
@@ -1626,7 +1626,7 @@ const at = 4096, cr = 20, dr = 20, ur = 10, fr = 10, pr = 30, Kt = 500, hr = [
|
|
|
1626
1626
|
"noscript",
|
|
1627
1627
|
"iframe"
|
|
1628
1628
|
];
|
|
1629
|
-
function
|
|
1629
|
+
function Ze(e) {
|
|
1630
1630
|
if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
|
|
1631
1631
|
let t = e;
|
|
1632
1632
|
for (; t; ) {
|
|
@@ -1636,14 +1636,14 @@ function Xe(e) {
|
|
|
1636
1636
|
}
|
|
1637
1637
|
return !1;
|
|
1638
1638
|
}
|
|
1639
|
-
function
|
|
1639
|
+
function et(e) {
|
|
1640
1640
|
if (typeof window > "u") return !0;
|
|
1641
1641
|
const t = e.getBoundingClientRect();
|
|
1642
1642
|
if (t.width <= 0 || t.height <= 0) return !1;
|
|
1643
1643
|
const r = window.innerHeight || document.documentElement.clientHeight, i = window.innerWidth || document.documentElement.clientWidth;
|
|
1644
1644
|
return t.bottom > 0 && t.right > 0 && t.top < r && t.left < i;
|
|
1645
1645
|
}
|
|
1646
|
-
function
|
|
1646
|
+
function Gt(e) {
|
|
1647
1647
|
const t = e.getAttribute("id");
|
|
1648
1648
|
if (t) {
|
|
1649
1649
|
const l = document.querySelector(`label[for="${CSS.escape(t)}"]`);
|
|
@@ -1656,10 +1656,10 @@ function Xt(e) {
|
|
|
1656
1656
|
const o = e.closest("label");
|
|
1657
1657
|
return o != null && o.textContent ? o.textContent.trim() : "";
|
|
1658
1658
|
}
|
|
1659
|
-
function
|
|
1659
|
+
function Ee(e, t) {
|
|
1660
1660
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
1661
1661
|
}
|
|
1662
|
-
function
|
|
1662
|
+
function qe(e) {
|
|
1663
1663
|
return e.length;
|
|
1664
1664
|
}
|
|
1665
1665
|
function mr(e, t = {}) {
|
|
@@ -1681,10 +1681,10 @@ function mr(e, t = {}) {
|
|
|
1681
1681
|
), u = [];
|
|
1682
1682
|
for (const m of c) {
|
|
1683
1683
|
if (u.length >= ur) break;
|
|
1684
|
-
if (
|
|
1685
|
-
const R = m.getAttribute("data-ll-region") ?? "", W = m.getAttribute("data-ll-intent") ?? void 0, z =
|
|
1684
|
+
if (Ze(m) || !et(m)) continue;
|
|
1685
|
+
const R = m.getAttribute("data-ll-region") ?? "", W = m.getAttribute("data-ll-intent") ?? void 0, z = Ee(
|
|
1686
1686
|
(m.innerText || m.textContent || "").trim(),
|
|
1687
|
-
|
|
1687
|
+
Xt * 2
|
|
1688
1688
|
);
|
|
1689
1689
|
!R || !z || u.push({ id: R, intent: W, text: z });
|
|
1690
1690
|
}
|
|
@@ -1692,23 +1692,23 @@ function mr(e, t = {}) {
|
|
|
1692
1692
|
r.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
|
1693
1693
|
);
|
|
1694
1694
|
for (const m of b) {
|
|
1695
|
-
if (
|
|
1695
|
+
if (Ze(m) || !et(m)) continue;
|
|
1696
1696
|
const R = (m.textContent || "").trim();
|
|
1697
|
-
R && f.push(`${m.tagName}: ${
|
|
1697
|
+
R && f.push(`${m.tagName}: ${Ee(R, 200)}`);
|
|
1698
1698
|
}
|
|
1699
1699
|
const s = Array.from(r.querySelectorAll("p, li"));
|
|
1700
1700
|
for (const m of s) {
|
|
1701
|
-
if (
|
|
1701
|
+
if (Ze(m) || !et(m) || y.includes(m.tagName)) continue;
|
|
1702
1702
|
const R = (m.textContent || "").trim();
|
|
1703
|
-
R.length > 10 && f.push(
|
|
1703
|
+
R.length > 10 && f.push(Ee(R, Xt));
|
|
1704
1704
|
}
|
|
1705
1705
|
const a = f.join(`
|
|
1706
1706
|
`), x = [], E = Array.from(r.querySelectorAll("a[href]"));
|
|
1707
1707
|
for (const m of E) {
|
|
1708
1708
|
if (x.length >= cr) break;
|
|
1709
|
-
if (
|
|
1709
|
+
if (Ze(m) || !et(m)) continue;
|
|
1710
1710
|
const R = m.getAttribute("href") || "", W = (m.textContent || "").trim();
|
|
1711
|
-
!R || !W || x.push({ href: R, text:
|
|
1711
|
+
!R || !W || x.push({ href: R, text: Ee(W, 100) });
|
|
1712
1712
|
}
|
|
1713
1713
|
const C = [], v = Array.from(
|
|
1714
1714
|
r.querySelectorAll(
|
|
@@ -1717,16 +1717,16 @@ function mr(e, t = {}) {
|
|
|
1717
1717
|
);
|
|
1718
1718
|
for (const m of v) {
|
|
1719
1719
|
if (C.length >= dr) break;
|
|
1720
|
-
if (
|
|
1721
|
-
const R =
|
|
1722
|
-
R && C.push({ label:
|
|
1720
|
+
if (Ze(m) || !ft(m) || !et(m)) continue;
|
|
1721
|
+
const R = Gt(m), W = m instanceof HTMLInputElement ? m.type : m.tagName.toLowerCase();
|
|
1722
|
+
R && C.push({ label: Ee(R, 100), type: W });
|
|
1723
1723
|
}
|
|
1724
1724
|
const w = Array.from(
|
|
1725
1725
|
r.querySelectorAll("[data-ll-form]")
|
|
1726
|
-
),
|
|
1726
|
+
), H = [];
|
|
1727
1727
|
for (const m of w) {
|
|
1728
|
-
if (
|
|
1729
|
-
if (
|
|
1728
|
+
if (H.length >= fr) break;
|
|
1729
|
+
if (Ct(m)) continue;
|
|
1730
1730
|
const R = m.getAttribute("data-ll-form") || "";
|
|
1731
1731
|
if (!R) continue;
|
|
1732
1732
|
const W = m.getAttribute("data-ll-intent") || void 0, z = Array.from(
|
|
@@ -1736,13 +1736,13 @@ function mr(e, t = {}) {
|
|
|
1736
1736
|
), M = [];
|
|
1737
1737
|
for (const B of z) {
|
|
1738
1738
|
if (M.length >= pr) break;
|
|
1739
|
-
if (!
|
|
1739
|
+
if (!ft(B)) continue;
|
|
1740
1740
|
const F = B.getAttribute("data-ll-field") || "";
|
|
1741
1741
|
if (!F) continue;
|
|
1742
|
-
const G =
|
|
1743
|
-
M.push({ name: F, label:
|
|
1742
|
+
const G = Gt(B) || F, ie = B instanceof HTMLInputElement ? B.type : B.tagName.toLowerCase();
|
|
1743
|
+
M.push({ name: F, label: Ee(G, 100), type: ie });
|
|
1744
1744
|
}
|
|
1745
|
-
|
|
1745
|
+
H.push({ id: R, intent: W, fields: M });
|
|
1746
1746
|
}
|
|
1747
1747
|
const I = {
|
|
1748
1748
|
url: i,
|
|
@@ -1752,26 +1752,26 @@ function mr(e, t = {}) {
|
|
|
1752
1752
|
visibleText: a,
|
|
1753
1753
|
visibleLinks: x,
|
|
1754
1754
|
visibleFields: C,
|
|
1755
|
-
forms:
|
|
1755
|
+
forms: H,
|
|
1756
1756
|
extras: e
|
|
1757
1757
|
};
|
|
1758
|
-
let q =
|
|
1759
|
-
for (; q >
|
|
1760
|
-
I.visibleFields.pop(), q =
|
|
1761
|
-
for (; q >
|
|
1758
|
+
let q = qe(JSON.stringify(I.regions)) + qe(I.visibleText) + qe(JSON.stringify(I.visibleLinks)) + qe(JSON.stringify(I.visibleFields));
|
|
1759
|
+
for (; q > ct && I.visibleFields.length > 0; )
|
|
1760
|
+
I.visibleFields.pop(), q = qe(JSON.stringify(I.visibleFields));
|
|
1761
|
+
for (; q > ct && I.visibleLinks.length > 0; )
|
|
1762
1762
|
I.visibleLinks.pop(), q -= 80;
|
|
1763
|
-
return
|
|
1763
|
+
return qe(I.visibleText) > ct && (I.visibleText = Ee(I.visibleText, ct - 100)), I;
|
|
1764
1764
|
}
|
|
1765
|
-
let
|
|
1766
|
-
function
|
|
1765
|
+
let Be = null;
|
|
1766
|
+
function _t(e, t = {}) {
|
|
1767
1767
|
const r = Date.now(), o = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
|
|
1768
|
-
if (
|
|
1769
|
-
return
|
|
1768
|
+
if (Be && Be.key === o && r - Be.at < 1e3)
|
|
1769
|
+
return Be.ctx;
|
|
1770
1770
|
const l = mr(e, t);
|
|
1771
|
-
return
|
|
1771
|
+
return Be = { key: o, at: r, ctx: l }, l;
|
|
1772
1772
|
}
|
|
1773
1773
|
function gr() {
|
|
1774
|
-
|
|
1774
|
+
Be = null;
|
|
1775
1775
|
}
|
|
1776
1776
|
const yr = 200;
|
|
1777
1777
|
function vr(e) {
|
|
@@ -1793,7 +1793,7 @@ function wr(e) {
|
|
|
1793
1793
|
const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), o = [], l = Array.from(t.querySelectorAll("a[href]"));
|
|
1794
1794
|
for (const c of l) {
|
|
1795
1795
|
if (o.length >= yr) break;
|
|
1796
|
-
if (
|
|
1796
|
+
if (Ct(c)) continue;
|
|
1797
1797
|
const u = c.getAttribute("href") || "";
|
|
1798
1798
|
if (!br(u)) continue;
|
|
1799
1799
|
let f = u, y = !0;
|
|
@@ -1812,17 +1812,17 @@ function wr(e) {
|
|
|
1812
1812
|
}
|
|
1813
1813
|
return o;
|
|
1814
1814
|
}
|
|
1815
|
-
let
|
|
1815
|
+
let We = null;
|
|
1816
1816
|
const _r = 5e3;
|
|
1817
|
-
function
|
|
1817
|
+
function xt() {
|
|
1818
1818
|
const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
|
|
1819
|
-
if (
|
|
1820
|
-
return
|
|
1819
|
+
if (We && We.pathname === t && e - We.at < _r)
|
|
1820
|
+
return We.routes;
|
|
1821
1821
|
const r = wr();
|
|
1822
|
-
return
|
|
1822
|
+
return We = { at: e, pathname: t, routes: r }, r;
|
|
1823
1823
|
}
|
|
1824
1824
|
function xr() {
|
|
1825
|
-
|
|
1825
|
+
We = null;
|
|
1826
1826
|
}
|
|
1827
1827
|
function kr(e, t) {
|
|
1828
1828
|
const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, i = Object.getOwnPropertyDescriptor(r, "value"), o = i == null ? void 0 : i.set;
|
|
@@ -1909,7 +1909,7 @@ const Rr = /* @__PURE__ */ new Set([
|
|
|
1909
1909
|
"request_routes"
|
|
1910
1910
|
]);
|
|
1911
1911
|
function Mr(e) {
|
|
1912
|
-
var
|
|
1912
|
+
var Mt, It, Tt, Dt, Pt, $t, zt;
|
|
1913
1913
|
const {
|
|
1914
1914
|
agentId: t,
|
|
1915
1915
|
apiKey: r,
|
|
@@ -1928,7 +1928,7 @@ function Mr(e) {
|
|
|
1928
1928
|
currentTeamMemberId: C,
|
|
1929
1929
|
onTeamMemberChange: v,
|
|
1930
1930
|
idleLoopUrl: w,
|
|
1931
|
-
greeting:
|
|
1931
|
+
greeting: H,
|
|
1932
1932
|
avatarImageUrl: I,
|
|
1933
1933
|
agentName: q,
|
|
1934
1934
|
branding: m = {},
|
|
@@ -1940,182 +1940,182 @@ function Mr(e) {
|
|
|
1940
1940
|
pathname: F,
|
|
1941
1941
|
onNavigate: G,
|
|
1942
1942
|
onScrollToSelector: ie,
|
|
1943
|
-
getPageContext:
|
|
1944
|
-
pageContextExtras:
|
|
1945
|
-
getRoutes:
|
|
1946
|
-
onScrollPage:
|
|
1947
|
-
onClick:
|
|
1943
|
+
getPageContext: we,
|
|
1944
|
+
pageContextExtras: tt,
|
|
1945
|
+
getRoutes: nt,
|
|
1946
|
+
onScrollPage: rt,
|
|
1947
|
+
onClick: it,
|
|
1948
1948
|
capabilities: re,
|
|
1949
1949
|
onConnect: ce,
|
|
1950
|
-
onDisconnect:
|
|
1951
|
-
onTranscript:
|
|
1952
|
-
onAgentState:
|
|
1953
|
-
onConnectionStateChange:
|
|
1954
|
-
onAgentEvent:
|
|
1955
|
-
onAgentCommand:
|
|
1950
|
+
onDisconnect: _e,
|
|
1951
|
+
onTranscript: Ne,
|
|
1952
|
+
onAgentState: Ae,
|
|
1953
|
+
onConnectionStateChange: Re,
|
|
1954
|
+
onAgentEvent: Me,
|
|
1955
|
+
onAgentCommand: Ie,
|
|
1956
1956
|
controlledSession: V,
|
|
1957
|
-
className:
|
|
1958
|
-
style:
|
|
1959
|
-
zIndex:
|
|
1960
|
-
} = e,
|
|
1957
|
+
className: pt,
|
|
1958
|
+
style: ht,
|
|
1959
|
+
zIndex: ot = 2147483647
|
|
1960
|
+
} = e, de = On(F), Te = jn(de, M, B);
|
|
1961
1961
|
N(() => {
|
|
1962
1962
|
gr(), xr();
|
|
1963
|
-
}, [
|
|
1964
|
-
const
|
|
1963
|
+
}, [de]);
|
|
1964
|
+
const Fe = C !== void 0, [xe, De] = S(() => {
|
|
1965
1965
|
var h;
|
|
1966
1966
|
return C ?? ((h = E == null ? void 0 : E[0]) == null ? void 0 : h.id);
|
|
1967
|
-
}), X =
|
|
1967
|
+
}), X = Fe ? C : xe, ee = dt(
|
|
1968
1968
|
() => (E == null ? void 0 : E.find((h) => h.id === X)) ?? null,
|
|
1969
1969
|
[E, X]
|
|
1970
|
-
),
|
|
1970
|
+
), Pe = (ee == null ? void 0 : ee.agentId) ?? t, [oe, ue] = Dn({
|
|
1971
1971
|
value: u,
|
|
1972
1972
|
defaultValue: f,
|
|
1973
1973
|
onChange: y,
|
|
1974
1974
|
persistKey: a,
|
|
1975
1975
|
disablePersistence: x
|
|
1976
|
-
}),
|
|
1977
|
-
|
|
1978
|
-
function
|
|
1979
|
-
const d =
|
|
1976
|
+
}), ke = $n(s), Ue = xn(), te = kn(), le = Sn(), ae = Cn(), pe = En(), [$e, he] = S(!1), [me, je] = S(!1), [Ve, Ye] = S(!1), [ge, ye] = S(!1), [ze, lt] = S(!1), Je = A(G), Oe = A(ie), p = A(rt), Y = A(it), mt = A(we), gt = A(tt), Et = A(nt), yt = A(re), ne = A(null);
|
|
1977
|
+
Je.current = G, Oe.current = ie, p.current = rt, Y.current = it, mt.current = we, gt.current = tt, Et.current = nt, yt.current = re;
|
|
1978
|
+
function ve(h) {
|
|
1979
|
+
const d = yt.current;
|
|
1980
1980
|
return d ? d.includes(h) : !0;
|
|
1981
1981
|
}
|
|
1982
|
-
function
|
|
1982
|
+
function be(h, d) {
|
|
1983
1983
|
console.warn(
|
|
1984
1984
|
`[LiveLayer] Agent command "${h}" blocked — capability "${d}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
|
|
1985
1985
|
);
|
|
1986
1986
|
}
|
|
1987
|
-
const
|
|
1987
|
+
const Ke = L(
|
|
1988
1988
|
(h) => {
|
|
1989
|
-
var Z,
|
|
1989
|
+
var Z, Le, fe, He, Se;
|
|
1990
1990
|
const d = h;
|
|
1991
1991
|
if (!(!d.type || typeof d.type != "string")) {
|
|
1992
|
-
if (
|
|
1993
|
-
if (!
|
|
1994
|
-
|
|
1992
|
+
if (Me == null || Me({ eventName: d.type, data: h }), d.type === "navigate") {
|
|
1993
|
+
if (!ve("navigate")) {
|
|
1994
|
+
be("navigate", "navigate");
|
|
1995
1995
|
return;
|
|
1996
1996
|
}
|
|
1997
|
-
const
|
|
1998
|
-
if (!
|
|
1997
|
+
const k = typeof d.href == "string" ? d.href : null;
|
|
1998
|
+
if (!k) {
|
|
1999
1999
|
console.warn(
|
|
2000
2000
|
`[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
|
|
2001
2001
|
);
|
|
2002
2002
|
return;
|
|
2003
2003
|
}
|
|
2004
|
-
if (
|
|
2004
|
+
if (Je.current) {
|
|
2005
2005
|
try {
|
|
2006
|
-
|
|
2007
|
-
} catch (
|
|
2006
|
+
Je.current(k);
|
|
2007
|
+
} catch (T) {
|
|
2008
2008
|
console.warn(
|
|
2009
|
-
`[LiveLayer] onNavigate threw for "${
|
|
2010
|
-
|
|
2009
|
+
`[LiveLayer] onNavigate threw for "${k}". Falling back. Error:`,
|
|
2010
|
+
T
|
|
2011
2011
|
);
|
|
2012
2012
|
}
|
|
2013
2013
|
return;
|
|
2014
2014
|
}
|
|
2015
2015
|
if (typeof document < "u") {
|
|
2016
|
-
const
|
|
2017
|
-
`a[href="${
|
|
2016
|
+
const T = document.querySelector(
|
|
2017
|
+
`a[href="${k.replace(/"/g, '\\"')}"]`
|
|
2018
2018
|
);
|
|
2019
|
-
if (
|
|
2020
|
-
|
|
2019
|
+
if (T) {
|
|
2020
|
+
T.click();
|
|
2021
2021
|
return;
|
|
2022
2022
|
}
|
|
2023
2023
|
}
|
|
2024
2024
|
if (typeof window < "u" && typeof history < "u")
|
|
2025
2025
|
try {
|
|
2026
|
-
history.pushState({}, "",
|
|
2027
|
-
} catch (
|
|
2026
|
+
history.pushState({}, "", k), window.dispatchEvent(new PopStateEvent("popstate"));
|
|
2027
|
+
} catch (T) {
|
|
2028
2028
|
console.warn(
|
|
2029
|
-
`[LiveLayer] history.pushState fallback failed for "${
|
|
2030
|
-
|
|
2029
|
+
`[LiveLayer] history.pushState fallback failed for "${k}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
|
|
2030
|
+
T
|
|
2031
2031
|
);
|
|
2032
2032
|
}
|
|
2033
2033
|
return;
|
|
2034
2034
|
}
|
|
2035
2035
|
if (d.type === "scroll_to") {
|
|
2036
|
-
if (!
|
|
2037
|
-
|
|
2036
|
+
if (!ve("scroll")) {
|
|
2037
|
+
be("scroll_to", "scroll");
|
|
2038
2038
|
return;
|
|
2039
2039
|
}
|
|
2040
|
-
const
|
|
2041
|
-
if (!
|
|
2042
|
-
const
|
|
2043
|
-
if (
|
|
2040
|
+
const k = typeof d.selector == "string" ? d.selector : null;
|
|
2041
|
+
if (!k) return;
|
|
2042
|
+
const T = d.behavior === "instant" ? "instant" : "smooth";
|
|
2043
|
+
if (Oe.current) {
|
|
2044
2044
|
try {
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2045
|
+
Oe.current(
|
|
2046
|
+
k,
|
|
2047
|
+
T
|
|
2048
2048
|
);
|
|
2049
|
-
} catch (
|
|
2050
|
-
console.warn("[LiveLayer] onScrollToSelector threw.",
|
|
2049
|
+
} catch (P) {
|
|
2050
|
+
console.warn("[LiveLayer] onScrollToSelector threw.", P);
|
|
2051
2051
|
}
|
|
2052
2052
|
return;
|
|
2053
2053
|
}
|
|
2054
2054
|
if (typeof document < "u") {
|
|
2055
|
-
let
|
|
2055
|
+
let P = null;
|
|
2056
2056
|
try {
|
|
2057
|
-
|
|
2057
|
+
P = document.querySelector(k);
|
|
2058
2058
|
} catch {
|
|
2059
2059
|
console.warn(
|
|
2060
|
-
`[LiveLayer] scroll_to: invalid selector "${
|
|
2060
|
+
`[LiveLayer] scroll_to: invalid selector "${k}".`
|
|
2061
2061
|
);
|
|
2062
2062
|
return;
|
|
2063
2063
|
}
|
|
2064
|
-
if (!
|
|
2064
|
+
if (!P) {
|
|
2065
2065
|
console.warn(
|
|
2066
|
-
`[LiveLayer] scroll_to: no element matched "${
|
|
2066
|
+
`[LiveLayer] scroll_to: no element matched "${k}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
|
|
2067
2067
|
);
|
|
2068
2068
|
return;
|
|
2069
2069
|
}
|
|
2070
|
-
|
|
2071
|
-
behavior:
|
|
2070
|
+
P.scrollIntoView({
|
|
2071
|
+
behavior: T,
|
|
2072
2072
|
block: "start"
|
|
2073
2073
|
});
|
|
2074
2074
|
}
|
|
2075
2075
|
return;
|
|
2076
2076
|
}
|
|
2077
2077
|
if (d.type === "request_page_context") {
|
|
2078
|
-
if (!
|
|
2079
|
-
|
|
2078
|
+
if (!ve("read_page")) {
|
|
2079
|
+
be("request_page_context", "read_page");
|
|
2080
2080
|
return;
|
|
2081
2081
|
}
|
|
2082
|
-
const
|
|
2083
|
-
const
|
|
2084
|
-
if (
|
|
2082
|
+
const k = typeof d.requestId == "string" ? d.requestId : void 0, T = (Z = ne.current) == null ? void 0 : Z.call(ne), P = (K) => {
|
|
2083
|
+
const D = T, j = D == null ? void 0 : D.localParticipant;
|
|
2084
|
+
if (j != null && j.publishData)
|
|
2085
2085
|
try {
|
|
2086
|
-
const
|
|
2087
|
-
|
|
2088
|
-
} catch (
|
|
2089
|
-
console.warn("[LiveLayer] publishData failed.",
|
|
2086
|
+
const O = k ? { ...K, requestId: k } : K, Q = new TextEncoder().encode(JSON.stringify(O));
|
|
2087
|
+
j.publishData(Q, { reliable: !0 });
|
|
2088
|
+
} catch (O) {
|
|
2089
|
+
console.warn("[LiveLayer] publishData failed.", O);
|
|
2090
2090
|
}
|
|
2091
|
-
}, $ =
|
|
2091
|
+
}, $ = gt.current, J = mt.current;
|
|
2092
2092
|
try {
|
|
2093
2093
|
if (J) {
|
|
2094
2094
|
const K = J($);
|
|
2095
2095
|
if (K instanceof Promise) {
|
|
2096
|
-
|
|
2096
|
+
P({ type: "page_context_pending" }), K.then((D) => P({ type: "page_context", context: D })).catch((D) => {
|
|
2097
2097
|
console.warn(
|
|
2098
2098
|
"[LiveLayer] getPageContext rejected; falling back to default walker.",
|
|
2099
|
-
|
|
2100
|
-
),
|
|
2099
|
+
D
|
|
2100
|
+
), P({
|
|
2101
2101
|
type: "page_context",
|
|
2102
|
-
context:
|
|
2102
|
+
context: _t($)
|
|
2103
2103
|
});
|
|
2104
2104
|
});
|
|
2105
2105
|
return;
|
|
2106
2106
|
}
|
|
2107
|
-
|
|
2107
|
+
P({ type: "page_context", context: K });
|
|
2108
2108
|
return;
|
|
2109
2109
|
}
|
|
2110
|
-
|
|
2110
|
+
P({
|
|
2111
2111
|
type: "page_context",
|
|
2112
|
-
context:
|
|
2112
|
+
context: _t($)
|
|
2113
2113
|
});
|
|
2114
2114
|
} catch (K) {
|
|
2115
2115
|
console.warn(
|
|
2116
2116
|
"[LiveLayer] page-context extraction threw. Sending empty context.",
|
|
2117
2117
|
K
|
|
2118
|
-
),
|
|
2118
|
+
), P({
|
|
2119
2119
|
type: "page_context",
|
|
2120
2120
|
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: $ }
|
|
2121
2121
|
});
|
|
@@ -2123,100 +2123,100 @@ function Mr(e) {
|
|
|
2123
2123
|
return;
|
|
2124
2124
|
}
|
|
2125
2125
|
if (d.type === "scroll_page") {
|
|
2126
|
-
if (!
|
|
2127
|
-
|
|
2126
|
+
if (!ve("scroll")) {
|
|
2127
|
+
be("scroll_page", "scroll");
|
|
2128
2128
|
return;
|
|
2129
2129
|
}
|
|
2130
|
-
const
|
|
2131
|
-
if (
|
|
2130
|
+
const k = d.direction;
|
|
2131
|
+
if (k !== "up" && k !== "down" && k !== "top" && k !== "bottom") {
|
|
2132
2132
|
console.warn(
|
|
2133
|
-
`[LiveLayer] scroll_page: invalid direction "${String(
|
|
2133
|
+
`[LiveLayer] scroll_page: invalid direction "${String(k)}". Expected up | down | top | bottom.`
|
|
2134
2134
|
);
|
|
2135
2135
|
return;
|
|
2136
2136
|
}
|
|
2137
|
-
const
|
|
2137
|
+
const T = d.behavior === "instant" ? "instant" : "smooth";
|
|
2138
2138
|
if (p.current) {
|
|
2139
2139
|
try {
|
|
2140
2140
|
p.current(
|
|
2141
|
-
|
|
2142
|
-
|
|
2141
|
+
k,
|
|
2142
|
+
T
|
|
2143
2143
|
);
|
|
2144
|
-
} catch (
|
|
2145
|
-
console.warn("[LiveLayer] onScrollPage threw.",
|
|
2144
|
+
} catch (D) {
|
|
2145
|
+
console.warn("[LiveLayer] onScrollPage threw.", D);
|
|
2146
2146
|
}
|
|
2147
2147
|
return;
|
|
2148
2148
|
}
|
|
2149
2149
|
if (typeof window > "u") return;
|
|
2150
|
-
const
|
|
2151
|
-
$ instanceof Window ? $.scrollBy({ top:
|
|
2152
|
-
}, K = (
|
|
2153
|
-
$ instanceof Window ? $.scrollTo({ top:
|
|
2150
|
+
const P = { behavior: T }, $ = Nr(), J = (D) => {
|
|
2151
|
+
$ instanceof Window ? $.scrollBy({ top: D, ...P }) : $.scrollBy({ top: D, ...P });
|
|
2152
|
+
}, K = (D) => {
|
|
2153
|
+
$ instanceof Window ? $.scrollTo({ top: D, ...P }) : $.scrollTo({ top: D, ...P });
|
|
2154
2154
|
};
|
|
2155
|
-
|
|
2155
|
+
k === "up" ? J(-Qt($)) : k === "down" ? J(Qt($)) : K(k === "top" ? 0 : Ar($));
|
|
2156
2156
|
return;
|
|
2157
2157
|
}
|
|
2158
2158
|
if (d.type === "click") {
|
|
2159
|
-
if (!
|
|
2160
|
-
|
|
2159
|
+
if (!ve("click")) {
|
|
2160
|
+
be("click", "click");
|
|
2161
2161
|
return;
|
|
2162
2162
|
}
|
|
2163
|
-
const
|
|
2164
|
-
if (!
|
|
2163
|
+
const k = typeof d.selector == "string" ? d.selector : null;
|
|
2164
|
+
if (!k) {
|
|
2165
2165
|
console.warn("[LiveLayer] click: missing selector.");
|
|
2166
2166
|
return;
|
|
2167
2167
|
}
|
|
2168
2168
|
if (Y.current) {
|
|
2169
2169
|
try {
|
|
2170
|
-
Y.current(
|
|
2171
|
-
} catch (
|
|
2172
|
-
console.warn("[LiveLayer] onClick threw.",
|
|
2170
|
+
Y.current(k);
|
|
2171
|
+
} catch (P) {
|
|
2172
|
+
console.warn("[LiveLayer] onClick threw.", P);
|
|
2173
2173
|
}
|
|
2174
2174
|
return;
|
|
2175
2175
|
}
|
|
2176
2176
|
if (typeof document > "u") return;
|
|
2177
|
-
let
|
|
2177
|
+
let T = null;
|
|
2178
2178
|
try {
|
|
2179
|
-
|
|
2179
|
+
T = document.querySelector(k);
|
|
2180
2180
|
} catch {
|
|
2181
2181
|
console.warn(
|
|
2182
|
-
`[LiveLayer] click: invalid selector "${
|
|
2182
|
+
`[LiveLayer] click: invalid selector "${k}".`
|
|
2183
2183
|
);
|
|
2184
2184
|
return;
|
|
2185
2185
|
}
|
|
2186
|
-
if (!
|
|
2186
|
+
if (!T) {
|
|
2187
2187
|
console.warn(
|
|
2188
|
-
`[LiveLayer] click: no element matched "${
|
|
2188
|
+
`[LiveLayer] click: no element matched "${k}". See https://livelayer.studio/docs/errors/click-no-match`
|
|
2189
2189
|
);
|
|
2190
2190
|
return;
|
|
2191
2191
|
}
|
|
2192
|
-
if (
|
|
2192
|
+
if (T.closest('[data-ll-private="true"], .ll-widget')) {
|
|
2193
2193
|
console.warn(
|
|
2194
2194
|
"[LiveLayer] click: refusing to click element inside a private subtree."
|
|
2195
2195
|
);
|
|
2196
2196
|
return;
|
|
2197
2197
|
}
|
|
2198
|
-
(
|
|
2198
|
+
(Le = T.click) == null || Le.call(T);
|
|
2199
2199
|
return;
|
|
2200
2200
|
}
|
|
2201
2201
|
if (d.type === "fill_form" || d.type === "focus_field") {
|
|
2202
|
-
if (!
|
|
2203
|
-
|
|
2202
|
+
if (!ve("fill_forms")) {
|
|
2203
|
+
be(d.type, "fill_forms");
|
|
2204
2204
|
return;
|
|
2205
2205
|
}
|
|
2206
2206
|
if (typeof document > "u") return;
|
|
2207
|
-
const
|
|
2207
|
+
const k = typeof d.requestId == "string" ? d.requestId : void 0, T = (fe = ne.current) == null ? void 0 : fe.call(ne), P = (O) => {
|
|
2208
2208
|
if (d.type !== "fill_form") return;
|
|
2209
|
-
const Q =
|
|
2209
|
+
const Q = T, se = Q == null ? void 0 : Q.localParticipant;
|
|
2210
2210
|
if (se != null && se.publishData)
|
|
2211
2211
|
try {
|
|
2212
|
-
const
|
|
2212
|
+
const Ce = k ? { ...O, requestId: k } : O, hn = new TextEncoder().encode(JSON.stringify(Ce));
|
|
2213
2213
|
se.publishData(hn, { reliable: !0 });
|
|
2214
|
-
} catch (
|
|
2215
|
-
console.warn("[LiveLayer] publishData failed.",
|
|
2214
|
+
} catch (Ce) {
|
|
2215
|
+
console.warn("[LiveLayer] publishData failed.", Ce);
|
|
2216
2216
|
}
|
|
2217
2217
|
}, $ = typeof d.formId == "string" ? d.formId : null;
|
|
2218
2218
|
if (!$) {
|
|
2219
|
-
console.warn(`[LiveLayer] ${d.type}: missing formId.`),
|
|
2219
|
+
console.warn(`[LiveLayer] ${d.type}: missing formId.`), P({ type: "fill_form_result", ok: !1, reason: "missing formId" });
|
|
2220
2220
|
return;
|
|
2221
2221
|
}
|
|
2222
2222
|
const J = document.querySelector(
|
|
@@ -2225,7 +2225,7 @@ function Mr(e) {
|
|
|
2225
2225
|
if (!J) {
|
|
2226
2226
|
console.warn(
|
|
2227
2227
|
`[LiveLayer] ${d.type}: no form with data-ll-form="${$}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
|
|
2228
|
-
),
|
|
2228
|
+
), P({
|
|
2229
2229
|
type: "fill_form_result",
|
|
2230
2230
|
ok: !1,
|
|
2231
2231
|
reason: `no form with data-ll-form="${$}" on this page`,
|
|
@@ -2236,7 +2236,7 @@ function Mr(e) {
|
|
|
2236
2236
|
if (J.closest('[data-ll-private="true"], .ll-widget')) {
|
|
2237
2237
|
console.warn(
|
|
2238
2238
|
`[LiveLayer] ${d.type}: refusing to touch a form in a private subtree.`
|
|
2239
|
-
),
|
|
2239
|
+
), P({
|
|
2240
2240
|
type: "fill_form_result",
|
|
2241
2241
|
ok: !1,
|
|
2242
2242
|
reason: "form is in a private subtree (data-ll-private)",
|
|
@@ -2245,21 +2245,21 @@ function Mr(e) {
|
|
|
2245
2245
|
return;
|
|
2246
2246
|
}
|
|
2247
2247
|
if (d.type === "focus_field") {
|
|
2248
|
-
const
|
|
2249
|
-
if (!
|
|
2248
|
+
const O = typeof d.fieldName == "string" ? d.fieldName : null;
|
|
2249
|
+
if (!O) {
|
|
2250
2250
|
console.warn("[LiveLayer] focus_field: missing fieldName.");
|
|
2251
2251
|
return;
|
|
2252
2252
|
}
|
|
2253
|
-
const Q = J.querySelector(`[data-ll-field="${
|
|
2253
|
+
const Q = J.querySelector(`[data-ll-field="${O.replace(/"/g, '\\"')}"]`);
|
|
2254
2254
|
if (!Q) {
|
|
2255
2255
|
console.warn(
|
|
2256
|
-
`[LiveLayer] focus_field: no field "${
|
|
2256
|
+
`[LiveLayer] focus_field: no field "${O}" in form "${$}".`
|
|
2257
2257
|
);
|
|
2258
2258
|
return;
|
|
2259
2259
|
}
|
|
2260
|
-
if (!
|
|
2260
|
+
if (!ft(Q)) {
|
|
2261
2261
|
console.warn(
|
|
2262
|
-
`[LiveLayer] focus_field: field "${
|
|
2262
|
+
`[LiveLayer] focus_field: field "${O}" is privacy-protected and not focusable.`
|
|
2263
2263
|
);
|
|
2264
2264
|
return;
|
|
2265
2265
|
}
|
|
@@ -2268,7 +2268,7 @@ function Mr(e) {
|
|
|
2268
2268
|
}
|
|
2269
2269
|
const K = d.values && typeof d.values == "object" ? d.values : null;
|
|
2270
2270
|
if (!K) {
|
|
2271
|
-
console.warn("[LiveLayer] fill_form: missing or invalid values."),
|
|
2271
|
+
console.warn("[LiveLayer] fill_form: missing or invalid values."), P({
|
|
2272
2272
|
type: "fill_form_result",
|
|
2273
2273
|
ok: !1,
|
|
2274
2274
|
reason: "missing or invalid values",
|
|
@@ -2276,191 +2276,204 @@ function Mr(e) {
|
|
|
2276
2276
|
});
|
|
2277
2277
|
return;
|
|
2278
2278
|
}
|
|
2279
|
-
const
|
|
2280
|
-
for (const [
|
|
2279
|
+
const D = [], j = [];
|
|
2280
|
+
for (const [O, Q] of Object.entries(K)) {
|
|
2281
2281
|
if (typeof Q != "string") continue;
|
|
2282
|
-
const se = J.querySelector(`[data-ll-field="${
|
|
2282
|
+
const se = J.querySelector(`[data-ll-field="${O.replace(/"/g, '\\"')}"]`);
|
|
2283
2283
|
if (!se) {
|
|
2284
2284
|
console.warn(
|
|
2285
|
-
`[LiveLayer] fill_form: no field "${
|
|
2286
|
-
),
|
|
2285
|
+
`[LiveLayer] fill_form: no field "${O}" in form "${$}". Skipping.`
|
|
2286
|
+
), j.push(O);
|
|
2287
2287
|
continue;
|
|
2288
2288
|
}
|
|
2289
|
-
if (!
|
|
2289
|
+
if (!ft(se)) {
|
|
2290
2290
|
console.warn(
|
|
2291
|
-
`[LiveLayer] fill_form: field "${
|
|
2292
|
-
),
|
|
2291
|
+
`[LiveLayer] fill_form: field "${O}" is privacy-protected (password / cc-* / private). Skipping.`
|
|
2292
|
+
), j.push(O);
|
|
2293
2293
|
continue;
|
|
2294
2294
|
}
|
|
2295
2295
|
try {
|
|
2296
|
-
Lr(se, Q),
|
|
2297
|
-
} catch (
|
|
2296
|
+
Lr(se, Q), D.push(O);
|
|
2297
|
+
} catch (Ce) {
|
|
2298
2298
|
console.warn(
|
|
2299
|
-
`[LiveLayer] fill_form: failed to set "${
|
|
2300
|
-
|
|
2301
|
-
),
|
|
2299
|
+
`[LiveLayer] fill_form: failed to set "${O}".`,
|
|
2300
|
+
Ce
|
|
2301
|
+
), j.push(O);
|
|
2302
2302
|
}
|
|
2303
2303
|
}
|
|
2304
|
-
|
|
2304
|
+
P({
|
|
2305
2305
|
type: "fill_form_result",
|
|
2306
|
-
ok:
|
|
2306
|
+
ok: D.length > 0,
|
|
2307
2307
|
formId: $,
|
|
2308
|
-
filled:
|
|
2309
|
-
skipped:
|
|
2310
|
-
reason:
|
|
2308
|
+
filled: D,
|
|
2309
|
+
skipped: j,
|
|
2310
|
+
reason: D.length === 0 ? `none of the requested fields exist on this form (skipped: ${j.join(", ")})` : void 0
|
|
2311
2311
|
});
|
|
2312
2312
|
return;
|
|
2313
2313
|
}
|
|
2314
2314
|
if (d.type === "submit_form") {
|
|
2315
|
-
if (!
|
|
2316
|
-
|
|
2315
|
+
if (!ve("submit_forms")) {
|
|
2316
|
+
be("submit_form", "submit_forms");
|
|
2317
2317
|
return;
|
|
2318
2318
|
}
|
|
2319
2319
|
if (typeof document > "u") return;
|
|
2320
|
-
const
|
|
2321
|
-
if (!
|
|
2320
|
+
const k = typeof d.formId == "string" ? d.formId : null;
|
|
2321
|
+
if (!k) {
|
|
2322
2322
|
console.warn("[LiveLayer] submit_form: missing formId.");
|
|
2323
2323
|
return;
|
|
2324
2324
|
}
|
|
2325
|
-
const
|
|
2326
|
-
`[data-ll-form="${
|
|
2325
|
+
const T = document.querySelector(
|
|
2326
|
+
`[data-ll-form="${k.replace(/"/g, '\\"')}"]`
|
|
2327
2327
|
);
|
|
2328
|
-
if (!
|
|
2328
|
+
if (!T) {
|
|
2329
2329
|
console.warn(
|
|
2330
|
-
`[LiveLayer] submit_form: no form with data-ll-form="${
|
|
2330
|
+
`[LiveLayer] submit_form: no form with data-ll-form="${k}".`
|
|
2331
2331
|
);
|
|
2332
2332
|
return;
|
|
2333
2333
|
}
|
|
2334
|
-
if (
|
|
2334
|
+
if (T.closest('[data-ll-private="true"], .ll-widget')) {
|
|
2335
2335
|
console.warn(
|
|
2336
2336
|
"[LiveLayer] submit_form: refusing to submit a form in a private subtree."
|
|
2337
2337
|
);
|
|
2338
2338
|
return;
|
|
2339
2339
|
}
|
|
2340
|
-
const
|
|
2341
|
-
const
|
|
2340
|
+
const P = typeof d.requestId == "string" ? d.requestId : void 0, $ = (He = ne.current) == null ? void 0 : He.call(ne), J = (j) => {
|
|
2341
|
+
const O = $, Q = O == null ? void 0 : O.localParticipant;
|
|
2342
2342
|
if (Q != null && Q.publishData)
|
|
2343
2343
|
try {
|
|
2344
|
-
const se =
|
|
2345
|
-
Q.publishData(
|
|
2344
|
+
const se = P ? { ...j, requestId: P } : j, Ce = new TextEncoder().encode(JSON.stringify(se));
|
|
2345
|
+
Q.publishData(Ce, { reliable: !0 });
|
|
2346
2346
|
} catch {
|
|
2347
2347
|
}
|
|
2348
2348
|
};
|
|
2349
2349
|
let K = !1;
|
|
2350
|
-
const
|
|
2351
|
-
K = !0, J({ type: "form_submitted", formId:
|
|
2350
|
+
const D = () => {
|
|
2351
|
+
K = !0, J({ type: "form_submitted", formId: k });
|
|
2352
2352
|
};
|
|
2353
|
-
|
|
2353
|
+
T.addEventListener("submit", D, { once: !0 });
|
|
2354
2354
|
try {
|
|
2355
|
-
typeof
|
|
2356
|
-
} catch (
|
|
2357
|
-
console.warn("[LiveLayer] submit_form: requestSubmit threw.",
|
|
2355
|
+
typeof T.requestSubmit == "function" ? T.requestSubmit() : T.submit();
|
|
2356
|
+
} catch (j) {
|
|
2357
|
+
console.warn("[LiveLayer] submit_form: requestSubmit threw.", j), T.removeEventListener("submit", D), J({
|
|
2358
2358
|
type: "form_submit_blocked",
|
|
2359
|
-
formId:
|
|
2359
|
+
formId: k,
|
|
2360
2360
|
reason: "exception"
|
|
2361
2361
|
});
|
|
2362
2362
|
return;
|
|
2363
2363
|
}
|
|
2364
2364
|
setTimeout(() => {
|
|
2365
|
-
K || (
|
|
2365
|
+
K || (T.removeEventListener("submit", D), J({
|
|
2366
2366
|
type: "form_submit_blocked",
|
|
2367
|
-
formId:
|
|
2367
|
+
formId: k,
|
|
2368
2368
|
reason: "validation"
|
|
2369
2369
|
}));
|
|
2370
2370
|
}, 500);
|
|
2371
2371
|
return;
|
|
2372
2372
|
}
|
|
2373
2373
|
if (d.type === "request_routes") {
|
|
2374
|
-
if (!
|
|
2375
|
-
|
|
2374
|
+
if (!ve("read_page")) {
|
|
2375
|
+
be("request_routes", "read_page");
|
|
2376
2376
|
return;
|
|
2377
2377
|
}
|
|
2378
|
-
const
|
|
2378
|
+
const k = typeof d.requestId == "string" ? d.requestId : void 0, P = (Se = ne.current) == null ? void 0 : Se.call(ne), $ = P == null ? void 0 : P.localParticipant;
|
|
2379
2379
|
if (!($ != null && $.publishData)) return;
|
|
2380
|
-
const J = (
|
|
2380
|
+
const J = (D) => {
|
|
2381
2381
|
try {
|
|
2382
|
-
const
|
|
2383
|
-
$.publishData(
|
|
2384
|
-
} catch (
|
|
2385
|
-
console.warn("[LiveLayer] request_routes: publishData failed.",
|
|
2382
|
+
const j = k ? { type: "routes", routes: D, requestId: k } : { type: "routes", routes: D }, O = new TextEncoder().encode(JSON.stringify(j));
|
|
2383
|
+
$.publishData(O, { reliable: !0 });
|
|
2384
|
+
} catch (j) {
|
|
2385
|
+
console.warn("[LiveLayer] request_routes: publishData failed.", j);
|
|
2386
2386
|
}
|
|
2387
|
-
}, K =
|
|
2387
|
+
}, K = Et.current;
|
|
2388
2388
|
if (K) {
|
|
2389
2389
|
try {
|
|
2390
|
-
const
|
|
2391
|
-
if (!Array.isArray(
|
|
2390
|
+
const D = K(), j = (O) => {
|
|
2391
|
+
if (!Array.isArray(O)) {
|
|
2392
2392
|
J([]);
|
|
2393
2393
|
return;
|
|
2394
2394
|
}
|
|
2395
|
-
J(
|
|
2395
|
+
J(O.map(vr).slice(0, 200));
|
|
2396
2396
|
};
|
|
2397
|
-
|
|
2397
|
+
D instanceof Promise ? D.then(j).catch((O) => {
|
|
2398
2398
|
console.warn(
|
|
2399
2399
|
"[LiveLayer] getRoutes rejected; falling back to DOM walker.",
|
|
2400
|
-
|
|
2401
|
-
), J(
|
|
2402
|
-
}) :
|
|
2403
|
-
} catch (
|
|
2400
|
+
O
|
|
2401
|
+
), J(xt());
|
|
2402
|
+
}) : j(D);
|
|
2403
|
+
} catch (D) {
|
|
2404
2404
|
console.warn(
|
|
2405
2405
|
"[LiveLayer] getRoutes threw; falling back to DOM walker.",
|
|
2406
|
-
|
|
2407
|
-
), J(
|
|
2406
|
+
D
|
|
2407
|
+
), J(xt());
|
|
2408
2408
|
}
|
|
2409
2409
|
return;
|
|
2410
2410
|
}
|
|
2411
2411
|
try {
|
|
2412
|
-
J(
|
|
2413
|
-
} catch (
|
|
2414
|
-
console.warn("[LiveLayer] request_routes: extractRoutes threw.",
|
|
2412
|
+
J(xt());
|
|
2413
|
+
} catch (D) {
|
|
2414
|
+
console.warn("[LiveLayer] request_routes: extractRoutes threw.", D);
|
|
2415
2415
|
}
|
|
2416
2416
|
return;
|
|
2417
2417
|
}
|
|
2418
|
-
Rr.has(d.type) ||
|
|
2418
|
+
Rr.has(d.type) || Ie == null || Ie(d);
|
|
2419
2419
|
}
|
|
2420
2420
|
},
|
|
2421
|
-
[
|
|
2422
|
-
),
|
|
2423
|
-
agentId: V ? "__controlled__" :
|
|
2421
|
+
[Ie, Me]
|
|
2422
|
+
), U = _n({
|
|
2423
|
+
agentId: V ? "__controlled__" : Pe,
|
|
2424
2424
|
baseUrl: i,
|
|
2425
2425
|
apiKey: r,
|
|
2426
2426
|
sessionEndpoint: o,
|
|
2427
2427
|
sessionBody: l,
|
|
2428
|
-
onDataMessage: V ? void 0 :
|
|
2428
|
+
onDataMessage: V ? void 0 : Ke
|
|
2429
2429
|
});
|
|
2430
2430
|
N(() => {
|
|
2431
2431
|
if (V != null && V.subscribeToDataMessages)
|
|
2432
|
-
return V.subscribeToDataMessages(
|
|
2433
|
-
}, [V,
|
|
2432
|
+
return V.subscribeToDataMessages(Ke);
|
|
2433
|
+
}, [V, Ke]), ne.current = () => {
|
|
2434
2434
|
var h;
|
|
2435
|
-
return (h =
|
|
2435
|
+
return (h = U.getRoom) == null ? void 0 : h.call(U);
|
|
2436
2436
|
}, N(() => {
|
|
2437
|
-
var
|
|
2438
|
-
if (!
|
|
2439
|
-
const h = (
|
|
2440
|
-
if (d != null && d.publishData)
|
|
2437
|
+
var Le;
|
|
2438
|
+
if (!de) return;
|
|
2439
|
+
const h = (Le = U.getRoom) == null ? void 0 : Le.call(U), d = h == null ? void 0 : h.localParticipant;
|
|
2440
|
+
if (!(d != null && d.publishData)) return;
|
|
2441
|
+
try {
|
|
2442
|
+
const fe = new TextEncoder().encode(
|
|
2443
|
+
JSON.stringify({ type: "pathname", pathname: de })
|
|
2444
|
+
);
|
|
2445
|
+
d.publishData(fe, { reliable: !0 });
|
|
2446
|
+
} catch {
|
|
2447
|
+
}
|
|
2448
|
+
const Z = setTimeout(() => {
|
|
2449
|
+
var fe;
|
|
2441
2450
|
try {
|
|
2442
|
-
const
|
|
2443
|
-
|
|
2451
|
+
const He = (fe = U.getRoom) == null ? void 0 : fe.call(U), Se = He == null ? void 0 : He.localParticipant;
|
|
2452
|
+
if (!(Se != null && Se.publishData)) return;
|
|
2453
|
+
const k = _t(gt.current), T = new TextEncoder().encode(
|
|
2454
|
+
JSON.stringify({ type: "page_context_push", pathname: de, context: k })
|
|
2444
2455
|
);
|
|
2445
|
-
|
|
2456
|
+
Se.publishData(T, { reliable: !0 });
|
|
2446
2457
|
} catch {
|
|
2447
2458
|
}
|
|
2448
|
-
|
|
2459
|
+
}, 250);
|
|
2460
|
+
return () => clearTimeout(Z);
|
|
2461
|
+
}, [de, U, U.connectionState]), N(() => {
|
|
2449
2462
|
var Z;
|
|
2450
2463
|
if (typeof window > "u") return;
|
|
2451
2464
|
const h = ((Z = window.location) == null ? void 0 : Z.hostname) || "";
|
|
2452
2465
|
if (h === "localhost" || h === "127.0.0.1" || h === "0.0.0.0" || h.endsWith(".local") || h.endsWith(".test"))
|
|
2453
|
-
return window.__livelayerSimulateCommand = (
|
|
2466
|
+
return window.__livelayerSimulateCommand = (Le) => {
|
|
2454
2467
|
try {
|
|
2455
|
-
|
|
2456
|
-
} catch (
|
|
2457
|
-
console.warn("[LiveLayer] simulate-command threw:",
|
|
2468
|
+
Ke(Le);
|
|
2469
|
+
} catch (fe) {
|
|
2470
|
+
console.warn("[LiveLayer] simulate-command threw:", fe);
|
|
2458
2471
|
}
|
|
2459
2472
|
}, () => {
|
|
2460
2473
|
delete window.__livelayerSimulateCommand;
|
|
2461
2474
|
};
|
|
2462
|
-
}, [
|
|
2463
|
-
const g =
|
|
2475
|
+
}, [Ke]);
|
|
2476
|
+
const g = dt(() => V ? {
|
|
2464
2477
|
connectionState: V.connectionState,
|
|
2465
2478
|
agentState: V.agentState,
|
|
2466
2479
|
transcript: V.transcript,
|
|
@@ -2476,24 +2489,24 @@ function Mr(e) {
|
|
|
2476
2489
|
// Dummy getRoom for shape compatibility — controlled consumers own the Room.
|
|
2477
2490
|
// Internal session's getRoom returns null when no real connect has happened,
|
|
2478
2491
|
// so we reuse its reference for type consistency.
|
|
2479
|
-
getRoom:
|
|
2492
|
+
getRoom: U.getRoom,
|
|
2480
2493
|
isControlled: !0
|
|
2481
2494
|
} : {
|
|
2482
|
-
connectionState:
|
|
2483
|
-
agentState:
|
|
2484
|
-
transcript:
|
|
2485
|
-
videoElement:
|
|
2486
|
-
audioElement:
|
|
2487
|
-
canResume:
|
|
2488
|
-
error:
|
|
2489
|
-
agentConfig:
|
|
2490
|
-
connect:
|
|
2491
|
-
disconnect:
|
|
2492
|
-
getRoom:
|
|
2495
|
+
connectionState: U.connectionState,
|
|
2496
|
+
agentState: U.agentState,
|
|
2497
|
+
transcript: U.transcript,
|
|
2498
|
+
videoElement: U.videoElement,
|
|
2499
|
+
audioElement: U.audioElement,
|
|
2500
|
+
canResume: U.canResume,
|
|
2501
|
+
error: U.error,
|
|
2502
|
+
agentConfig: U.agentConfig,
|
|
2503
|
+
connect: U.connect,
|
|
2504
|
+
disconnect: U.disconnect,
|
|
2505
|
+
getRoom: U.getRoom,
|
|
2493
2506
|
isControlled: !1
|
|
2494
|
-
}, [V,
|
|
2507
|
+
}, [V, U]), Nt = A(null);
|
|
2495
2508
|
N(() => {
|
|
2496
|
-
const h = g.videoElement, d =
|
|
2509
|
+
const h = g.videoElement, d = Nt.current;
|
|
2497
2510
|
if (!(!h || !d))
|
|
2498
2511
|
return d.appendChild(h), () => {
|
|
2499
2512
|
h.parentNode === d && d.removeChild(h);
|
|
@@ -2501,40 +2514,40 @@ function Mr(e) {
|
|
|
2501
2514
|
}, [g.videoElement]), N(() => {
|
|
2502
2515
|
const h = g.audioElement;
|
|
2503
2516
|
if (!h) return;
|
|
2504
|
-
|
|
2517
|
+
Ue.attach(h);
|
|
2505
2518
|
const d = h.play();
|
|
2506
2519
|
return d && typeof d.catch == "function" && d.catch((Z) => {
|
|
2507
|
-
(Z == null ? void 0 : Z.name) === "NotAllowedError" &&
|
|
2520
|
+
(Z == null ? void 0 : Z.name) === "NotAllowedError" && he(!0);
|
|
2508
2521
|
}), () => {
|
|
2509
|
-
|
|
2522
|
+
Ue.detach();
|
|
2510
2523
|
};
|
|
2511
2524
|
}, [g.audioElement]), N(() => {
|
|
2512
2525
|
if (g.isControlled || g.connectionState !== "connected") return;
|
|
2513
2526
|
const h = g.getRoom();
|
|
2514
2527
|
if (h)
|
|
2515
2528
|
return te.setupMic(h, { startMuted: !0 }).catch(() => {
|
|
2516
|
-
}), le.attachRoom(h), ae.attachRoom(h),
|
|
2529
|
+
}), le.attachRoom(h), ae.attachRoom(h), pe.refresh(), () => {
|
|
2517
2530
|
te.teardownMic(), le.teardown(), ae.teardown();
|
|
2518
2531
|
};
|
|
2519
2532
|
}, [g.isControlled, g.connectionState]);
|
|
2520
|
-
const [
|
|
2533
|
+
const [Xe, vt] = S(!1), bt = A("idle");
|
|
2521
2534
|
N(() => {
|
|
2522
2535
|
if (g.connectionState === "idle" || g.connectionState === "disconnected") {
|
|
2523
|
-
|
|
2536
|
+
vt(!1), bt.current = "idle";
|
|
2524
2537
|
return;
|
|
2525
2538
|
}
|
|
2526
|
-
!
|
|
2527
|
-
}, [g.agentState, g.connectionState,
|
|
2528
|
-
if (g.connectionState !== "connected" ||
|
|
2539
|
+
!Xe && bt.current === "speaking" && g.agentState !== "speaking" && (vt(!0), te.setMuted(!1)), bt.current = g.agentState;
|
|
2540
|
+
}, [g.agentState, g.connectionState, Xe]), N(() => {
|
|
2541
|
+
if (g.connectionState !== "connected" || Xe) return;
|
|
2529
2542
|
const h = setTimeout(() => {
|
|
2530
|
-
|
|
2543
|
+
vt(!0), te.setMuted(!1);
|
|
2531
2544
|
}, 4e3);
|
|
2532
2545
|
return () => clearTimeout(h);
|
|
2533
|
-
}, [g.connectionState,
|
|
2546
|
+
}, [g.connectionState, Xe]), N(() => {
|
|
2534
2547
|
const h = g.audioElement;
|
|
2535
|
-
h && (h.muted =
|
|
2536
|
-
}, [g.audioElement,
|
|
2537
|
-
const nn =
|
|
2548
|
+
h && (h.muted = ze);
|
|
2549
|
+
}, [g.audioElement, ze]);
|
|
2550
|
+
const nn = L((h) => {
|
|
2538
2551
|
const d = g.getRoom();
|
|
2539
2552
|
if (d)
|
|
2540
2553
|
try {
|
|
@@ -2544,71 +2557,71 @@ function Mr(e) {
|
|
|
2544
2557
|
d.localParticipant.publishData(Z, { reliable: !0 });
|
|
2545
2558
|
} catch {
|
|
2546
2559
|
}
|
|
2547
|
-
}, [g]), rn =
|
|
2548
|
-
|
|
2560
|
+
}, [g]), rn = L(() => {
|
|
2561
|
+
lt((h) => !h);
|
|
2549
2562
|
}, []);
|
|
2550
2563
|
N(() => {
|
|
2551
|
-
|
|
2552
|
-
}, [g.connectionState, ce,
|
|
2553
|
-
|
|
2554
|
-
}, [g.transcript,
|
|
2555
|
-
|
|
2556
|
-
}, [g.agentState,
|
|
2557
|
-
const
|
|
2564
|
+
Re == null || Re(g.connectionState), g.connectionState === "connected" ? ce == null || ce() : g.connectionState === "disconnected" && (_e == null || _e());
|
|
2565
|
+
}, [g.connectionState, ce, _e, Re]), N(() => {
|
|
2566
|
+
Ne == null || Ne(g.transcript);
|
|
2567
|
+
}, [g.transcript, Ne]), N(() => {
|
|
2568
|
+
Ae == null || Ae(g.agentState);
|
|
2569
|
+
}, [g.agentState, Ae]);
|
|
2570
|
+
const At = A(!1);
|
|
2558
2571
|
N(() => {
|
|
2559
|
-
g.isControlled || !c ||
|
|
2560
|
-
}, [c, g.connectionState, g,
|
|
2561
|
-
const on =
|
|
2572
|
+
g.isControlled || !c || At.current || Te && g.connectionState === "idle" && (At.current = !0, g.connect());
|
|
2573
|
+
}, [c, g.connectionState, g, Te]);
|
|
2574
|
+
const on = L(
|
|
2562
2575
|
(h) => {
|
|
2563
2576
|
const d = E == null ? void 0 : E.find((Z) => Z.id === h);
|
|
2564
|
-
d && (
|
|
2577
|
+
d && (Ye(!1), h !== X && (je(!0), g.disconnect(), Fe || De(h), v == null || v(d)));
|
|
2565
2578
|
},
|
|
2566
2579
|
[
|
|
2567
2580
|
E,
|
|
2568
2581
|
X,
|
|
2569
2582
|
g,
|
|
2570
|
-
|
|
2583
|
+
Fe,
|
|
2571
2584
|
v
|
|
2572
2585
|
]
|
|
2573
2586
|
);
|
|
2574
2587
|
N(() => {
|
|
2575
|
-
|
|
2576
|
-
}, [g.connectionState,
|
|
2577
|
-
if (!
|
|
2588
|
+
me && g.connectionState === "connected" && je(!1);
|
|
2589
|
+
}, [g.connectionState, me]), N(() => {
|
|
2590
|
+
if (!Ve) return;
|
|
2578
2591
|
const h = (d) => {
|
|
2579
|
-
d.key === "Escape" &&
|
|
2592
|
+
d.key === "Escape" && Ye(!1);
|
|
2580
2593
|
};
|
|
2581
2594
|
return window.addEventListener("keydown", h), () => window.removeEventListener("keydown", h);
|
|
2582
|
-
}, [
|
|
2583
|
-
const ln = !!I || !!(ee != null && ee.avatarImageUrl) || g.isControlled,
|
|
2584
|
-
re === void 0 && ((
|
|
2585
|
-
const
|
|
2586
|
-
() =>
|
|
2587
|
-
[
|
|
2588
|
-
),
|
|
2589
|
-
g.disconnect(),
|
|
2590
|
-
}, [g,
|
|
2595
|
+
}, [Ve]);
|
|
2596
|
+
const ln = !!I || !!(ee != null && ee.avatarImageUrl) || g.isControlled, Ge = Nn(Pe, i, ln);
|
|
2597
|
+
re === void 0 && ((Mt = Ge.info) != null && Mt.capabilities) && (yt.current = Ge.info.capabilities);
|
|
2598
|
+
const at = (ee == null ? void 0 : ee.name) ?? q ?? ((It = g.agentConfig) == null ? void 0 : It.name) ?? ((Tt = Ge.info) == null ? void 0 : Tt.name) ?? "Live Layer", wt = (ee == null ? void 0 : ee.avatarImageUrl) ?? I ?? ((Dt = g.agentConfig) == null ? void 0 : Dt.avatarImageUrl) ?? ((Pt = Ge.info) == null ? void 0 : Pt.avatarImageUrl) ?? null, an = w ?? (($t = g.agentConfig) == null ? void 0 : $t.idleLoopUrl) ?? ((zt = Ge.info) == null ? void 0 : zt.idleLoopUrl) ?? null, sn = H ?? null, cn = L(() => ue("expanded"), [ue]), dn = L(
|
|
2599
|
+
() => ue("minimized"),
|
|
2600
|
+
[ue]
|
|
2601
|
+
), Rt = L(() => {
|
|
2602
|
+
g.disconnect(), ue("hidden");
|
|
2603
|
+
}, [g, ue]), un = L(() => {
|
|
2591
2604
|
const h = g.audioElement;
|
|
2592
|
-
h && h.play().then(() =>
|
|
2605
|
+
h && h.play().then(() => he(!1)).catch(() => {
|
|
2593
2606
|
});
|
|
2594
|
-
}, [g.audioElement]), fn =
|
|
2595
|
-
|
|
2596
|
-
}, [g]),
|
|
2597
|
-
...
|
|
2598
|
-
zIndex:
|
|
2607
|
+
}, [g.audioElement]), fn = L(() => {
|
|
2608
|
+
he(!1), g.connect();
|
|
2609
|
+
}, [g]), Qe = {
|
|
2610
|
+
...ht,
|
|
2611
|
+
zIndex: ot
|
|
2599
2612
|
};
|
|
2600
|
-
m.primaryColor && (
|
|
2613
|
+
m.primaryColor && (Qe["--ll-color-primary"] = m.primaryColor), m.accentColor && (Qe["--ll-color-accent"] = m.accentColor), m.backgroundColor && (Qe["--ll-color-bg"] = m.backgroundColor), m.textColor && (Qe["--ll-color-fg"] = m.textColor);
|
|
2601
2614
|
const pn = [
|
|
2602
2615
|
"ll-widget",
|
|
2603
2616
|
`ll-widget--${oe}`,
|
|
2604
|
-
`ll-widget--${
|
|
2605
|
-
|
|
2617
|
+
`ll-widget--${ke ? "mobile" : "desktop"}`,
|
|
2618
|
+
pt
|
|
2606
2619
|
].filter(Boolean).join(" ");
|
|
2607
|
-
return
|
|
2620
|
+
return Te ? /* @__PURE__ */ _(
|
|
2608
2621
|
"div",
|
|
2609
2622
|
{
|
|
2610
2623
|
className: pn,
|
|
2611
|
-
style:
|
|
2624
|
+
style: Qe,
|
|
2612
2625
|
"data-display-mode": oe,
|
|
2613
2626
|
"data-position": b,
|
|
2614
2627
|
children: [
|
|
@@ -2616,69 +2629,69 @@ function Mr(e) {
|
|
|
2616
2629
|
Gn,
|
|
2617
2630
|
{
|
|
2618
2631
|
position: b,
|
|
2619
|
-
isMobile:
|
|
2632
|
+
isMobile: ke,
|
|
2620
2633
|
isSpeaking: g.agentState === "speaking",
|
|
2621
|
-
onExpand: () =>
|
|
2622
|
-
label: `Open ${
|
|
2623
|
-
avatarImageUrl:
|
|
2624
|
-
agentName:
|
|
2634
|
+
onExpand: () => ue("expanded"),
|
|
2635
|
+
label: `Open ${at} widget`,
|
|
2636
|
+
avatarImageUrl: wt,
|
|
2637
|
+
agentName: at
|
|
2625
2638
|
}
|
|
2626
2639
|
),
|
|
2627
2640
|
oe === "minimized" && /* @__PURE__ */ n(
|
|
2628
2641
|
Zn,
|
|
2629
2642
|
{
|
|
2630
2643
|
position: b,
|
|
2631
|
-
isMobile:
|
|
2632
|
-
agentName:
|
|
2633
|
-
avatarImageUrl:
|
|
2644
|
+
isMobile: ke,
|
|
2645
|
+
agentName: at,
|
|
2646
|
+
avatarImageUrl: wt,
|
|
2634
2647
|
agentState: g.agentState,
|
|
2635
2648
|
isMuted: te.isMuted,
|
|
2636
|
-
audioLevel:
|
|
2649
|
+
audioLevel: Ue,
|
|
2637
2650
|
onExpand: cn,
|
|
2638
2651
|
onToggleMute: te.toggleMute,
|
|
2639
|
-
onClose:
|
|
2652
|
+
onClose: Rt
|
|
2640
2653
|
}
|
|
2641
2654
|
),
|
|
2642
2655
|
oe === "expanded" && /* @__PURE__ */ n(
|
|
2643
2656
|
tr,
|
|
2644
2657
|
{
|
|
2645
2658
|
position: b,
|
|
2646
|
-
isMobile:
|
|
2647
|
-
agentName:
|
|
2648
|
-
avatarImageUrl:
|
|
2659
|
+
isMobile: ke,
|
|
2660
|
+
agentName: at,
|
|
2661
|
+
avatarImageUrl: wt,
|
|
2649
2662
|
idleLoopUrl: an,
|
|
2650
2663
|
greeting: sn,
|
|
2651
2664
|
branding: m,
|
|
2652
2665
|
teamMembers: E,
|
|
2653
2666
|
currentTeamMemberId: X,
|
|
2654
|
-
isSwitchingTeamMember:
|
|
2655
|
-
teamSwitcherOpen:
|
|
2656
|
-
onToggleTeamSwitcher: () =>
|
|
2667
|
+
isSwitchingTeamMember: me,
|
|
2668
|
+
teamSwitcherOpen: Ve,
|
|
2669
|
+
onToggleTeamSwitcher: () => Ye((h) => !h),
|
|
2657
2670
|
onSelectTeamMember: on,
|
|
2658
2671
|
connectionState: g.connectionState,
|
|
2659
2672
|
agentState: g.agentState,
|
|
2660
2673
|
transcript: g.transcript,
|
|
2661
2674
|
isMuted: te.isMuted,
|
|
2662
|
-
micDevices:
|
|
2675
|
+
micDevices: pe.mics,
|
|
2663
2676
|
isCameraEnabled: le.isEnabled,
|
|
2664
2677
|
cameraPreviewEl: le.previewEl,
|
|
2665
|
-
cameraDevices:
|
|
2678
|
+
cameraDevices: pe.cameras,
|
|
2666
2679
|
activeCameraId: le.activeDeviceId,
|
|
2667
2680
|
isScreenShareEnabled: ae.isEnabled,
|
|
2668
2681
|
screenPreviewEl: ae.previewEl,
|
|
2669
|
-
isSpeakerMuted:
|
|
2682
|
+
isSpeakerMuted: ze,
|
|
2670
2683
|
allowCamera: R,
|
|
2671
2684
|
allowScreenShare: W,
|
|
2672
2685
|
allowTyping: z,
|
|
2673
|
-
languageMenuOpen:
|
|
2674
|
-
onToggleLanguageMenu: () =>
|
|
2675
|
-
needsUserGesture:
|
|
2686
|
+
languageMenuOpen: ge,
|
|
2687
|
+
onToggleLanguageMenu: () => ye((h) => !h),
|
|
2688
|
+
needsUserGesture: $e,
|
|
2676
2689
|
canResume: g.canResume,
|
|
2677
2690
|
micError: te.micError,
|
|
2678
2691
|
error: g.error,
|
|
2679
|
-
avatarVideoContainerRef:
|
|
2692
|
+
avatarVideoContainerRef: Nt,
|
|
2680
2693
|
agentVideoEl: g.videoElement,
|
|
2681
|
-
micGateOpen: g.isControlled ? !0 :
|
|
2694
|
+
micGateOpen: g.isControlled ? !0 : Xe,
|
|
2682
2695
|
onConnect: () => void g.connect(),
|
|
2683
2696
|
onDisconnect: () => g.disconnect(),
|
|
2684
2697
|
onRetry: fn,
|
|
@@ -2690,7 +2703,7 @@ function Mr(e) {
|
|
|
2690
2703
|
onToggleSpeaker: rn,
|
|
2691
2704
|
onSendMessage: nn,
|
|
2692
2705
|
onMinimize: dn,
|
|
2693
|
-
onClose:
|
|
2706
|
+
onClose: Rt,
|
|
2694
2707
|
onClearMicError: te.clearError
|
|
2695
2708
|
}
|
|
2696
2709
|
)
|
|
@@ -2698,7 +2711,7 @@ function Mr(e) {
|
|
|
2698
2711
|
}
|
|
2699
2712
|
) : null;
|
|
2700
2713
|
}
|
|
2701
|
-
function
|
|
2714
|
+
function Hr(e) {
|
|
2702
2715
|
return /* @__PURE__ */ n(wn, { children: /* @__PURE__ */ n(Mr, { ...e }) });
|
|
2703
2716
|
}
|
|
2704
2717
|
const qr = ({
|
|
@@ -2712,7 +2725,7 @@ const qr = ({
|
|
|
2712
2725
|
}) => {
|
|
2713
2726
|
const u = A(null), f = A(null), y = A(o);
|
|
2714
2727
|
y.current = o;
|
|
2715
|
-
const b =
|
|
2728
|
+
const b = L((s) => {
|
|
2716
2729
|
var x;
|
|
2717
2730
|
const a = s.detail;
|
|
2718
2731
|
(x = y.current) == null || x.call(y, a);
|
|
@@ -2727,7 +2740,7 @@ const qr = ({
|
|
|
2727
2740
|
}, [e]), N(() => {
|
|
2728
2741
|
f.current && (i ? f.current.setAttribute("mode", i) : f.current.removeAttribute("mode"));
|
|
2729
2742
|
}, [i]), /* @__PURE__ */ n("div", { ref: u, className: l, style: c });
|
|
2730
|
-
}, Br =
|
|
2743
|
+
}, Br = St(
|
|
2731
2744
|
function({ id: t, intent: r, as: i = "div", className: o, style: l, children: c }, u) {
|
|
2732
2745
|
return gn(
|
|
2733
2746
|
i,
|
|
@@ -2741,7 +2754,7 @@ const qr = ({
|
|
|
2741
2754
|
c
|
|
2742
2755
|
);
|
|
2743
2756
|
}
|
|
2744
|
-
), Wr =
|
|
2757
|
+
), Wr = St(
|
|
2745
2758
|
function({ id: t, intent: r, children: i, ...o }, l) {
|
|
2746
2759
|
return /* @__PURE__ */ n(
|
|
2747
2760
|
"form",
|
|
@@ -2754,7 +2767,7 @@ const qr = ({
|
|
|
2754
2767
|
}
|
|
2755
2768
|
);
|
|
2756
2769
|
}
|
|
2757
|
-
), Fr =
|
|
2770
|
+
), Fr = St(
|
|
2758
2771
|
function(t, r) {
|
|
2759
2772
|
const { name: i, label: o, labelClassName: l } = t, c = { name: i, "data-ll-field": i };
|
|
2760
2773
|
let u;
|
|
@@ -2802,7 +2815,7 @@ function Ur({
|
|
|
2802
2815
|
defaultOpen: t = !1,
|
|
2803
2816
|
storageKey: r = "ll-debug-open"
|
|
2804
2817
|
}) {
|
|
2805
|
-
const [i, o] =
|
|
2818
|
+
const [i, o] = S(t), [l, c] = S([]), [u, f] = S(""), [y, b] = S(!1), s = A(/* @__PURE__ */ new Set()), a = A([]), x = A(y);
|
|
2806
2819
|
x.current = y, N(() => {
|
|
2807
2820
|
try {
|
|
2808
2821
|
const v = localStorage.getItem(r);
|
|
@@ -2816,7 +2829,7 @@ function Ur({
|
|
|
2816
2829
|
}
|
|
2817
2830
|
}, [i, r]), N(() => {
|
|
2818
2831
|
const v = (w) => {
|
|
2819
|
-
(w.metaKey || w.ctrlKey) && w.shiftKey && w.key.toLowerCase() === "l" && (w.preventDefault(), o((
|
|
2832
|
+
(w.metaKey || w.ctrlKey) && w.shiftKey && w.key.toLowerCase() === "l" && (w.preventDefault(), o((H) => !H));
|
|
2820
2833
|
};
|
|
2821
2834
|
return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
|
|
2822
2835
|
}, []), N(() => {
|
|
@@ -2824,7 +2837,7 @@ function Ur({
|
|
|
2824
2837
|
if (a.current.length === 0 || x.current) return;
|
|
2825
2838
|
const w = a.current.splice(0, a.current.length);
|
|
2826
2839
|
c(
|
|
2827
|
-
(
|
|
2840
|
+
(H) => [...w.reverse(), ...H].slice(0, 200)
|
|
2828
2841
|
);
|
|
2829
2842
|
}, 100);
|
|
2830
2843
|
return () => clearInterval(v);
|
|
@@ -2841,7 +2854,7 @@ function Ur({
|
|
|
2841
2854
|
});
|
|
2842
2855
|
}));
|
|
2843
2856
|
}, [e]), N(() => {
|
|
2844
|
-
const v = console.warn, w = console.log,
|
|
2857
|
+
const v = console.warn, w = console.log, H = (I, q) => function(...m) {
|
|
2845
2858
|
try {
|
|
2846
2859
|
const R = typeof m[0] == "string" ? m[0] : "";
|
|
2847
2860
|
R.startsWith("[LiveLayer]") && a.current.push({
|
|
@@ -2855,7 +2868,7 @@ function Ur({
|
|
|
2855
2868
|
}
|
|
2856
2869
|
return q.apply(this, m);
|
|
2857
2870
|
};
|
|
2858
|
-
return console.warn =
|
|
2871
|
+
return console.warn = H("warn", v), console.log = H("log", w), () => {
|
|
2859
2872
|
console.warn = v, console.log = w;
|
|
2860
2873
|
};
|
|
2861
2874
|
}, []), !i)
|
|
@@ -2936,7 +2949,7 @@ function Ur({
|
|
|
2936
2949
|
{
|
|
2937
2950
|
type: "button",
|
|
2938
2951
|
onClick: () => b((v) => !v),
|
|
2939
|
-
style:
|
|
2952
|
+
style: kt(y ? "#f59e0b" : "transparent"),
|
|
2940
2953
|
title: "Pause / resume capture",
|
|
2941
2954
|
children: y ? "▶ resume" : "⏸ pause"
|
|
2942
2955
|
}
|
|
@@ -2948,7 +2961,7 @@ function Ur({
|
|
|
2948
2961
|
onClick: () => {
|
|
2949
2962
|
c([]), a.current = [];
|
|
2950
2963
|
},
|
|
2951
|
-
style:
|
|
2964
|
+
style: kt("transparent"),
|
|
2952
2965
|
title: "Clear buffer",
|
|
2953
2966
|
children: "clear"
|
|
2954
2967
|
}
|
|
@@ -2958,7 +2971,7 @@ function Ur({
|
|
|
2958
2971
|
{
|
|
2959
2972
|
type: "button",
|
|
2960
2973
|
onClick: () => o(!1),
|
|
2961
|
-
style:
|
|
2974
|
+
style: kt("transparent"),
|
|
2962
2975
|
"aria-label": "Close",
|
|
2963
2976
|
title: "Close (Cmd/Ctrl + Shift + L)",
|
|
2964
2977
|
children: "✕"
|
|
@@ -3111,7 +3124,7 @@ function Ir({
|
|
|
3111
3124
|
}
|
|
3112
3125
|
);
|
|
3113
3126
|
}
|
|
3114
|
-
function
|
|
3127
|
+
function kt(e) {
|
|
3115
3128
|
return {
|
|
3116
3129
|
background: e,
|
|
3117
3130
|
color: "#fff",
|
|
@@ -3130,7 +3143,7 @@ function Tr(e) {
|
|
|
3130
3143
|
}
|
|
3131
3144
|
}
|
|
3132
3145
|
function jr() {
|
|
3133
|
-
const [e, t] =
|
|
3146
|
+
const [e, t] = S([]), r = L((o) => {
|
|
3134
3147
|
t((l) => {
|
|
3135
3148
|
const c = l.findIndex((u) => u.id === o.id);
|
|
3136
3149
|
if (c >= 0) {
|
|
@@ -3139,7 +3152,7 @@ function jr() {
|
|
|
3139
3152
|
}
|
|
3140
3153
|
return [...l, o];
|
|
3141
3154
|
});
|
|
3142
|
-
}, []), i =
|
|
3155
|
+
}, []), i = L(() => t([]), []);
|
|
3143
3156
|
return {
|
|
3144
3157
|
entries: e,
|
|
3145
3158
|
pushSegment: r,
|
|
@@ -3148,7 +3161,7 @@ function jr() {
|
|
|
3148
3161
|
};
|
|
3149
3162
|
}
|
|
3150
3163
|
export {
|
|
3151
|
-
|
|
3164
|
+
Hr as AvatarWidget,
|
|
3152
3165
|
wn as ErrorBoundary,
|
|
3153
3166
|
Ur as LiveLayerDebugPanel,
|
|
3154
3167
|
Fr as LiveLayerField,
|
|
@@ -3159,8 +3172,8 @@ export {
|
|
|
3159
3172
|
xr as clearRoutesCache,
|
|
3160
3173
|
mr as extractPageContext,
|
|
3161
3174
|
wr as extractRoutes,
|
|
3162
|
-
|
|
3163
|
-
|
|
3175
|
+
_t as getCachedPageContext,
|
|
3176
|
+
xt as getCachedRoutes,
|
|
3164
3177
|
Fn as matchesPattern,
|
|
3165
3178
|
vr as normalizeRouteInput,
|
|
3166
3179
|
Un as shouldRenderAtPath,
|
|
@@ -3168,12 +3181,12 @@ export {
|
|
|
3168
3181
|
xn as useAudioLevel,
|
|
3169
3182
|
Sn as useCameraState,
|
|
3170
3183
|
Mn as useDisplayMode,
|
|
3171
|
-
|
|
3184
|
+
Dn as useDisplayModePersistence,
|
|
3172
3185
|
$n as useIsMobile,
|
|
3173
3186
|
_n as useLiveKitSession,
|
|
3174
3187
|
En as useMediaDevices,
|
|
3175
3188
|
kn as useMicrophoneState,
|
|
3176
|
-
|
|
3189
|
+
On as usePathname,
|
|
3177
3190
|
jn as useRouteMatch,
|
|
3178
3191
|
Cn as useScreenShareState,
|
|
3179
3192
|
jr as useTranscript
|