@livelayer/react 0.5.5-pr66c.5 → 0.5.5-pr66c.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/dist/index.mjs +593 -579
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as x, jsx as n, Fragment as yt } from "react/jsx-runtime";
|
|
3
|
-
import { Component as pn, useState as C, useRef as E, useEffect as N, useCallback as k, useMemo as
|
|
3
|
+
import { Component as pn, useState as C, useRef as E, useEffect as N, useCallback as k, useMemo as He, forwardRef as vt, createElement as hn } from "react";
|
|
4
4
|
import { LiveKitSession as mn } from "@livelayer/sdk";
|
|
5
5
|
import { createLocalAudioTrack as gn, Track as Kt, createLocalVideoTrack as yn } from "livekit-client";
|
|
6
6
|
class vn extends pn {
|
|
@@ -34,16 +34,16 @@ class vn extends pn {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
function bn(e) {
|
|
37
|
-
const [t, r] = C("idle"), [i, o] = C("idle"), [l,
|
|
37
|
+
const [t, r] = C("idle"), [i, o] = C("idle"), [l, c] = C([]), [d, u] = C(null), [h, m] = C(null), [a, s] = C(null), [R, q] = C(!1), [w, _] = C(null), y = E(null), z = E(e.onDataMessage);
|
|
38
38
|
z.current = e.onDataMessage, N(() => {
|
|
39
39
|
const S = {
|
|
40
40
|
onConnectionStateChange: (D) => {
|
|
41
41
|
r(D), D === "connected" && _(null);
|
|
42
42
|
},
|
|
43
43
|
onAgentStateChange: o,
|
|
44
|
-
onTranscript: (D) =>
|
|
44
|
+
onTranscript: (D) => c([...D]),
|
|
45
45
|
onAgentConfig: u,
|
|
46
|
-
onAudioTrack: (D) =>
|
|
46
|
+
onAudioTrack: (D) => s(D),
|
|
47
47
|
onVideoTrack: (D) => m(D),
|
|
48
48
|
onVideoTrackRemoved: () => m(null),
|
|
49
49
|
onError: (D) => _(D),
|
|
@@ -62,7 +62,7 @@ function bn(e) {
|
|
|
62
62
|
},
|
|
63
63
|
S
|
|
64
64
|
);
|
|
65
|
-
return y.current = B, r("idle"), o("idle"),
|
|
65
|
+
return y.current = B, r("idle"), o("idle"), c([]), u(null), m(null), s(null), q(!1), _(null), () => {
|
|
66
66
|
var D;
|
|
67
67
|
(D = B.destroy) == null || D.call(B), y.current = null;
|
|
68
68
|
};
|
|
@@ -93,7 +93,7 @@ function bn(e) {
|
|
|
93
93
|
agentState: i,
|
|
94
94
|
transcript: l,
|
|
95
95
|
agentConfig: d,
|
|
96
|
-
videoElement:
|
|
96
|
+
videoElement: h,
|
|
97
97
|
audioElement: a,
|
|
98
98
|
canResume: R,
|
|
99
99
|
error: w,
|
|
@@ -104,7 +104,7 @@ function bn(e) {
|
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
function wn() {
|
|
107
|
-
const e = E(null), t = E(null), r = E(null), i = E(null), o = E(/* @__PURE__ */ new Set()), l = E(null),
|
|
107
|
+
const e = E(null), t = E(null), r = E(null), i = E(null), o = E(/* @__PURE__ */ new Set()), l = E(null), c = k(() => {
|
|
108
108
|
const a = t.current;
|
|
109
109
|
if (!a) {
|
|
110
110
|
i.current = null;
|
|
@@ -113,22 +113,22 @@ function wn() {
|
|
|
113
113
|
(!l.current || l.current.length !== a.frequencyBinCount) && (l.current = new Uint8Array(
|
|
114
114
|
new ArrayBuffer(a.frequencyBinCount)
|
|
115
115
|
));
|
|
116
|
-
const
|
|
117
|
-
a.getByteFrequencyData(
|
|
116
|
+
const s = l.current;
|
|
117
|
+
a.getByteFrequencyData(s);
|
|
118
118
|
let R = 0;
|
|
119
|
-
for (let w = 0; w <
|
|
120
|
-
const q = R /
|
|
119
|
+
for (let w = 0; w < s.length; w++) R += s[w];
|
|
120
|
+
const q = R / s.length / 255;
|
|
121
121
|
for (const w of o.current)
|
|
122
122
|
try {
|
|
123
123
|
w(q);
|
|
124
124
|
} catch (_) {
|
|
125
125
|
console.error("[useAudioLevel] subscriber threw:", _);
|
|
126
126
|
}
|
|
127
|
-
i.current = requestAnimationFrame(
|
|
127
|
+
i.current = requestAnimationFrame(c);
|
|
128
128
|
}, []), d = k(() => {
|
|
129
129
|
if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
|
|
130
|
-
const a = new AudioContext(),
|
|
131
|
-
|
|
130
|
+
const a = new AudioContext(), s = a.createAnalyser();
|
|
131
|
+
s.fftSize = 64, s.connect(a.destination), e.current = a, t.current = s;
|
|
132
132
|
}, []), u = k(
|
|
133
133
|
(a) => {
|
|
134
134
|
if (d(), !(!e.current || !t.current)) {
|
|
@@ -140,17 +140,17 @@ function wn() {
|
|
|
140
140
|
r.current = null;
|
|
141
141
|
}
|
|
142
142
|
try {
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
} catch (
|
|
146
|
-
console.warn("[useAudioLevel] createMediaElementSource failed:",
|
|
143
|
+
const s = e.current.createMediaElementSource(a);
|
|
144
|
+
s.connect(t.current), r.current = s;
|
|
145
|
+
} catch (s) {
|
|
146
|
+
console.warn("[useAudioLevel] createMediaElementSource failed:", s);
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
|
-
i.current === null && (i.current = requestAnimationFrame(
|
|
149
|
+
i.current === null && (i.current = requestAnimationFrame(c));
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
|
-
[d,
|
|
153
|
-
),
|
|
152
|
+
[d, c]
|
|
153
|
+
), h = k(() => {
|
|
154
154
|
if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), r.current) {
|
|
155
155
|
try {
|
|
156
156
|
r.current.disconnect();
|
|
@@ -162,7 +162,7 @@ function wn() {
|
|
|
162
162
|
o.current.delete(a);
|
|
163
163
|
}), []);
|
|
164
164
|
return N(() => () => {
|
|
165
|
-
if (
|
|
165
|
+
if (h(), t.current) {
|
|
166
166
|
try {
|
|
167
167
|
t.current.disconnect();
|
|
168
168
|
} catch {
|
|
@@ -177,10 +177,10 @@ function wn() {
|
|
|
177
177
|
e.current = null;
|
|
178
178
|
}
|
|
179
179
|
o.current.clear(), l.current = null;
|
|
180
|
-
}, [
|
|
180
|
+
}, [h]), { attach: u, detach: h, subscribe: m };
|
|
181
181
|
}
|
|
182
182
|
function _n() {
|
|
183
|
-
const [e, t] = C(!1), [r, i] = C(null), o = E(null), l = E(null),
|
|
183
|
+
const [e, t] = C(!1), [r, i] = C(null), o = E(null), l = E(null), c = k(async (m) => {
|
|
184
184
|
if (o.current && l.current) {
|
|
185
185
|
try {
|
|
186
186
|
await l.current.localParticipant.unpublishTrack(o.current);
|
|
@@ -196,8 +196,8 @@ function _n() {
|
|
|
196
196
|
});
|
|
197
197
|
await m.localParticipant.publishTrack(a), o.current = a, t(a.isMuted);
|
|
198
198
|
} catch (a) {
|
|
199
|
-
const
|
|
200
|
-
throw i(
|
|
199
|
+
const s = a instanceof Error && a.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
|
|
200
|
+
throw i(s), a;
|
|
201
201
|
}
|
|
202
202
|
}, []), d = k(() => {
|
|
203
203
|
const m = o.current;
|
|
@@ -212,22 +212,22 @@ function _n() {
|
|
|
212
212
|
m.stop();
|
|
213
213
|
}
|
|
214
214
|
o.current = null, l.current = null, t(!1);
|
|
215
|
-
}, []),
|
|
215
|
+
}, []), h = k(() => i(null), []);
|
|
216
216
|
return {
|
|
217
217
|
isMuted: e,
|
|
218
218
|
micError: r,
|
|
219
219
|
toggleMute: d,
|
|
220
|
-
setupMic:
|
|
220
|
+
setupMic: c,
|
|
221
221
|
teardownMic: u,
|
|
222
|
-
clearError:
|
|
222
|
+
clearError: h
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
225
|
const xn = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
226
226
|
function kn() {
|
|
227
|
-
const [e, t] = C(!1), [r, i] = C(null), [o, l] = C(null), [
|
|
227
|
+
const [e, t] = C(!1), [r, i] = C(null), [o, l] = C(null), [c, d] = C(""), u = E(null), h = E(null), m = k((y) => {
|
|
228
228
|
u.current = y;
|
|
229
229
|
}, []), a = k(() => {
|
|
230
|
-
const y = u.current, z =
|
|
230
|
+
const y = u.current, z = h.current;
|
|
231
231
|
if (z && y) {
|
|
232
232
|
const M = y.localParticipant.getTrackPublication(Kt.Source.Camera);
|
|
233
233
|
if (M != null && M.track) {
|
|
@@ -239,8 +239,8 @@ function kn() {
|
|
|
239
239
|
} else
|
|
240
240
|
z.stop();
|
|
241
241
|
}
|
|
242
|
-
|
|
243
|
-
}, []),
|
|
242
|
+
h.current = null, l(null), t(!1);
|
|
243
|
+
}, []), s = k(async (y) => {
|
|
244
244
|
const z = u.current;
|
|
245
245
|
if (z) {
|
|
246
246
|
i(null);
|
|
@@ -248,7 +248,7 @@ function kn() {
|
|
|
248
248
|
const M = { ...xn };
|
|
249
249
|
y && (M.deviceId = y);
|
|
250
250
|
const H = await yn(M);
|
|
251
|
-
await z.localParticipant.publishTrack(H),
|
|
251
|
+
await z.localParticipant.publishTrack(H), h.current = H;
|
|
252
252
|
const v = H.attach();
|
|
253
253
|
l(v), t(!0), y && d(y);
|
|
254
254
|
try {
|
|
@@ -264,19 +264,19 @@ function kn() {
|
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
}, []), R = k(async () => {
|
|
267
|
-
e ? a() : await c
|
|
268
|
-
}, [e,
|
|
269
|
-
a(), await
|
|
270
|
-
}, [a,
|
|
267
|
+
e ? a() : await s(c || void 0);
|
|
268
|
+
}, [e, c, a, s]), q = k(async (y) => {
|
|
269
|
+
a(), await s(y);
|
|
270
|
+
}, [a, s]), w = k(() => {
|
|
271
271
|
a(), u.current = null, i(null), d("");
|
|
272
272
|
}, [a]), _ = k(() => i(null), []);
|
|
273
273
|
return N(() => () => {
|
|
274
|
-
|
|
274
|
+
h.current && h.current.stop();
|
|
275
275
|
}, []), {
|
|
276
276
|
isEnabled: e,
|
|
277
277
|
error: r,
|
|
278
278
|
previewEl: o,
|
|
279
|
-
activeDeviceId:
|
|
279
|
+
activeDeviceId: c,
|
|
280
280
|
toggle: R,
|
|
281
281
|
switchDevice: q,
|
|
282
282
|
attachRoom: m,
|
|
@@ -285,14 +285,14 @@ function kn() {
|
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
287
|
function Ln() {
|
|
288
|
-
const [e, t] = C(!1), [r, i] = C(null), [o, l] = C(null),
|
|
289
|
-
|
|
290
|
-
}, []), u = k(() => l(null), []),
|
|
291
|
-
const
|
|
292
|
-
if (
|
|
288
|
+
const [e, t] = C(!1), [r, i] = C(null), [o, l] = C(null), c = E(null), d = k((s) => {
|
|
289
|
+
c.current = s;
|
|
290
|
+
}, []), u = k(() => l(null), []), h = k(async () => {
|
|
291
|
+
const s = c.current;
|
|
292
|
+
if (s) {
|
|
293
293
|
if (e) {
|
|
294
294
|
try {
|
|
295
|
-
await
|
|
295
|
+
await s.localParticipant.setScreenShareEnabled(!1);
|
|
296
296
|
} catch {
|
|
297
297
|
}
|
|
298
298
|
u(), t(!1);
|
|
@@ -300,15 +300,15 @@ function Ln() {
|
|
|
300
300
|
}
|
|
301
301
|
i(null);
|
|
302
302
|
try {
|
|
303
|
-
await
|
|
303
|
+
await s.localParticipant.setScreenShareEnabled(!0);
|
|
304
304
|
let R = 0;
|
|
305
305
|
const q = () => {
|
|
306
|
-
const w =
|
|
306
|
+
const w = s.localParticipant.getTrackPublication(Kt.Source.ScreenShare);
|
|
307
307
|
if (w != null && w.track) {
|
|
308
308
|
const _ = w.track.attach();
|
|
309
309
|
l(_), t(!0);
|
|
310
310
|
try {
|
|
311
|
-
|
|
311
|
+
s.localParticipant.publishData(
|
|
312
312
|
new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
|
|
313
313
|
{ reliable: !0 }
|
|
314
314
|
);
|
|
@@ -325,22 +325,22 @@ function Ln() {
|
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
}, [e, u]), m = k(() => {
|
|
328
|
-
const
|
|
329
|
-
if (
|
|
328
|
+
const s = c.current;
|
|
329
|
+
if (s && e)
|
|
330
330
|
try {
|
|
331
|
-
|
|
331
|
+
s.localParticipant.setScreenShareEnabled(!1);
|
|
332
332
|
} catch {
|
|
333
333
|
}
|
|
334
|
-
u(), t(!1), i(null),
|
|
334
|
+
u(), t(!1), i(null), c.current = null;
|
|
335
335
|
}, [e, u]), a = k(() => i(null), []);
|
|
336
|
-
return { isEnabled: e, error: r, previewEl: o, toggle:
|
|
336
|
+
return { isEnabled: e, error: r, previewEl: o, toggle: h, attachRoom: d, teardown: m, clearError: a };
|
|
337
337
|
}
|
|
338
338
|
function Sn() {
|
|
339
339
|
const [e, t] = C([]), [r, i] = C([]), o = k(async () => {
|
|
340
340
|
if (!(typeof navigator > "u" || !navigator.mediaDevices))
|
|
341
341
|
try {
|
|
342
342
|
const l = await navigator.mediaDevices.enumerateDevices();
|
|
343
|
-
t(l.filter((
|
|
343
|
+
t(l.filter((c) => c.kind === "audioinput")), i(l.filter((c) => c.kind === "videoinput"));
|
|
344
344
|
} catch {
|
|
345
345
|
}
|
|
346
346
|
}, []);
|
|
@@ -351,26 +351,26 @@ function Sn() {
|
|
|
351
351
|
}, [o]), { mics: e, cameras: r, refresh: o };
|
|
352
352
|
}
|
|
353
353
|
function Cn(e, t, r = !1) {
|
|
354
|
-
const [i, o] = C(null), [l,
|
|
354
|
+
const [i, o] = C(null), [l, c] = C(null), [d, u] = C(!r && !!e);
|
|
355
355
|
return N(() => {
|
|
356
356
|
if (r || !e) {
|
|
357
357
|
u(!1);
|
|
358
358
|
return;
|
|
359
359
|
}
|
|
360
|
-
const
|
|
361
|
-
return u(!0),
|
|
362
|
-
signal:
|
|
360
|
+
const h = new AbortController(), m = t || "https://app.livelayer.studio";
|
|
361
|
+
return u(!0), c(null), fetch(`${m}/api/widget/agent/${encodeURIComponent(e)}`, {
|
|
362
|
+
signal: h.signal
|
|
363
363
|
}).then(async (a) => {
|
|
364
364
|
if (!a.ok) {
|
|
365
|
-
const
|
|
366
|
-
throw new Error(
|
|
365
|
+
const s = await a.json().catch(() => ({}));
|
|
366
|
+
throw new Error(s.error || `HTTP ${a.status}`);
|
|
367
367
|
}
|
|
368
368
|
return a.json();
|
|
369
369
|
}).then((a) => {
|
|
370
|
-
|
|
370
|
+
h.signal.aborted || (o(a), u(!1));
|
|
371
371
|
}).catch((a) => {
|
|
372
|
-
|
|
373
|
-
}), () =>
|
|
372
|
+
h.signal.aborted || (c(a instanceof Error ? a.message : "Agent lookup failed"), u(!1));
|
|
373
|
+
}), () => h.abort();
|
|
374
374
|
}, [e, t, r]), { info: i, error: l, loading: d };
|
|
375
375
|
}
|
|
376
376
|
function En(e) {
|
|
@@ -393,13 +393,13 @@ function An({
|
|
|
393
393
|
defaultValue: t = "expanded",
|
|
394
394
|
onChange: r
|
|
395
395
|
} = {}) {
|
|
396
|
-
const i = e !== void 0, [o, l] = C(t),
|
|
396
|
+
const i = e !== void 0, [o, l] = C(t), c = i ? e : o, d = k(
|
|
397
397
|
(u) => {
|
|
398
|
-
u !==
|
|
398
|
+
u !== c && (i || l(u), r == null || r(u));
|
|
399
399
|
},
|
|
400
|
-
[
|
|
400
|
+
[c, i, r]
|
|
401
401
|
);
|
|
402
|
-
return [
|
|
402
|
+
return [c, d];
|
|
403
403
|
}
|
|
404
404
|
const Rn = ["hidden", "minimized", "expanded"];
|
|
405
405
|
function In(e) {
|
|
@@ -412,17 +412,17 @@ function Mn({
|
|
|
412
412
|
persistKey: i = "ll-widget",
|
|
413
413
|
disablePersistence: o = !1
|
|
414
414
|
} = {}) {
|
|
415
|
-
const l = `${i}:display-mode`,
|
|
415
|
+
const l = `${i}:display-mode`, c = E(!1), [d, u] = An({
|
|
416
416
|
value: e,
|
|
417
417
|
defaultValue: t,
|
|
418
|
-
onChange: (
|
|
419
|
-
e === void 0 && !o && Nn(l,
|
|
418
|
+
onChange: (h) => {
|
|
419
|
+
e === void 0 && !o && Nn(l, h), r == null || r(h);
|
|
420
420
|
}
|
|
421
421
|
});
|
|
422
422
|
return N(() => {
|
|
423
|
-
if (
|
|
424
|
-
const
|
|
425
|
-
|
|
423
|
+
if (c.current || (c.current = !0, o || e !== void 0)) return;
|
|
424
|
+
const h = In(En(l));
|
|
425
|
+
h && h !== d && u(h);
|
|
426
426
|
}, []), [d, u];
|
|
427
427
|
}
|
|
428
428
|
const Tn = 640;
|
|
@@ -441,16 +441,16 @@ function Pn(e = Tn) {
|
|
|
441
441
|
});
|
|
442
442
|
}, [e]), t;
|
|
443
443
|
}
|
|
444
|
-
const Pt = "__llHistoryPatched",
|
|
444
|
+
const Pt = "__llHistoryPatched", at = "ll:pathname";
|
|
445
445
|
function Dn() {
|
|
446
446
|
if (typeof window > "u" || window.history[Pt]) return;
|
|
447
447
|
const e = window.history.pushState, t = window.history.replaceState;
|
|
448
448
|
window.history.pushState = function(...r) {
|
|
449
449
|
const i = e.apply(this, r);
|
|
450
|
-
return window.dispatchEvent(new Event(
|
|
450
|
+
return window.dispatchEvent(new Event(at)), i;
|
|
451
451
|
}, window.history.replaceState = function(...r) {
|
|
452
452
|
const i = t.apply(this, r);
|
|
453
|
-
return window.dispatchEvent(new Event(
|
|
453
|
+
return window.dispatchEvent(new Event(at)), i;
|
|
454
454
|
}, window.history[Pt] = !0;
|
|
455
455
|
}
|
|
456
456
|
function Dt() {
|
|
@@ -464,8 +464,8 @@ function $n(e) {
|
|
|
464
464
|
if (e !== void 0) return;
|
|
465
465
|
Dn();
|
|
466
466
|
const i = () => r(Dt());
|
|
467
|
-
return i(), window.addEventListener("popstate", i), window.addEventListener(
|
|
468
|
-
window.removeEventListener("popstate", i), window.removeEventListener(
|
|
467
|
+
return i(), window.addEventListener("popstate", i), window.addEventListener(at, i), () => {
|
|
468
|
+
window.removeEventListener("popstate", i), window.removeEventListener(at, i);
|
|
469
469
|
};
|
|
470
470
|
}, [e]), e ?? t;
|
|
471
471
|
}
|
|
@@ -496,7 +496,7 @@ function Wn(e, t, r) {
|
|
|
496
496
|
return e === void 0 ? !0 : zt(r, e) ? !1 : t && t.length > 0 ? zt(t, e) : !0;
|
|
497
497
|
}
|
|
498
498
|
function Fn(e, t, r) {
|
|
499
|
-
return
|
|
499
|
+
return He(
|
|
500
500
|
() => Wn(e, t, r),
|
|
501
501
|
[e, t, r]
|
|
502
502
|
);
|
|
@@ -509,7 +509,7 @@ function Un(e) {
|
|
|
509
509
|
};
|
|
510
510
|
}
|
|
511
511
|
function jn(e) {
|
|
512
|
-
const t =
|
|
512
|
+
const t = He(() => Un(e.config), [e.config]), r = e.baseUrl.replace(/\/+$/, ""), i = E(null), o = k(
|
|
513
513
|
(u) => {
|
|
514
514
|
try {
|
|
515
515
|
new Audio(`${r}${u}`).play().catch(() => {
|
|
@@ -520,7 +520,7 @@ function jn(e) {
|
|
|
520
520
|
[r]
|
|
521
521
|
), l = k(() => {
|
|
522
522
|
t.navigate && o("/audio/page-change-sound.mp3");
|
|
523
|
-
}, [t.navigate, o]),
|
|
523
|
+
}, [t.navigate, o]), c = k(() => {
|
|
524
524
|
t.action && o("/audio/confirmation-sound.mp3");
|
|
525
525
|
}, [t.action, o]), d = k(
|
|
526
526
|
(u) => {
|
|
@@ -537,10 +537,10 @@ function jn(e) {
|
|
|
537
537
|
if (u) {
|
|
538
538
|
if (i.current) return;
|
|
539
539
|
try {
|
|
540
|
-
const
|
|
541
|
-
|
|
540
|
+
const h = new Audio(`${r}/audio/thinking-sound.mp3`);
|
|
541
|
+
h.loop = !0, h.volume = 0.3, h.play().catch(() => {
|
|
542
542
|
i.current = null;
|
|
543
|
-
}), i.current =
|
|
543
|
+
}), i.current = h;
|
|
544
544
|
} catch {
|
|
545
545
|
}
|
|
546
546
|
} else if (i.current) {
|
|
@@ -561,9 +561,9 @@ function jn(e) {
|
|
|
561
561
|
}
|
|
562
562
|
i.current = null;
|
|
563
563
|
}
|
|
564
|
-
}, []),
|
|
565
|
-
() => ({ playPageChange: l, playConfirmation:
|
|
566
|
-
[l,
|
|
564
|
+
}, []), He(
|
|
565
|
+
() => ({ playPageChange: l, playConfirmation: c, setThinking: d }),
|
|
566
|
+
[l, c, d]
|
|
567
567
|
);
|
|
568
568
|
}
|
|
569
569
|
const Ht = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ x(
|
|
@@ -688,21 +688,21 @@ const Kn = ({
|
|
|
688
688
|
onExpand: i,
|
|
689
689
|
label: o = "Open widget",
|
|
690
690
|
avatarImageUrl: l,
|
|
691
|
-
agentName:
|
|
691
|
+
agentName: c
|
|
692
692
|
}) => {
|
|
693
|
-
const d = Gn(e), u = d === "right" ? "left" : "right",
|
|
693
|
+
const d = Gn(e), u = d === "right" ? "left" : "right", h = t ? 80 : 72, m = !!l, [a, s] = C(null), [R, q] = C(!1), w = E(null), _ = E(!1), y = k(
|
|
694
694
|
(A) => {
|
|
695
695
|
if (typeof window > "u") return A;
|
|
696
|
-
const T =
|
|
697
|
-
return
|
|
696
|
+
const T = h / 2, W = Bt + T, G = window.innerHeight - Bt - T;
|
|
697
|
+
return G < W ? Math.max(W, A) : Math.max(W, Math.min(G, A));
|
|
698
698
|
},
|
|
699
|
-
[
|
|
699
|
+
[h]
|
|
700
700
|
);
|
|
701
701
|
N(() => {
|
|
702
702
|
const A = Jn();
|
|
703
|
-
|
|
703
|
+
s(y(A ?? window.innerHeight / 2));
|
|
704
704
|
const T = () => {
|
|
705
|
-
|
|
705
|
+
s((W) => W === null ? null : y(W));
|
|
706
706
|
};
|
|
707
707
|
return window.addEventListener("resize", T), () => window.removeEventListener("resize", T);
|
|
708
708
|
}, [y]);
|
|
@@ -726,7 +726,7 @@ const Kn = ({
|
|
|
726
726
|
const T = w.current;
|
|
727
727
|
if (!T) return;
|
|
728
728
|
const W = A.clientY - T.startClientY;
|
|
729
|
-
!T.moved && Math.abs(W) > Xn && (T.moved = !0, q(!0)), T.moved &&
|
|
729
|
+
!T.moved && Math.abs(W) > Xn && (T.moved = !0, q(!0)), T.moved && s(y(T.startCenterY + W));
|
|
730
730
|
},
|
|
731
731
|
[y]
|
|
732
732
|
), H = k(
|
|
@@ -737,7 +737,7 @@ const Kn = ({
|
|
|
737
737
|
A.currentTarget.releasePointerCapture(A.pointerId);
|
|
738
738
|
} catch {
|
|
739
739
|
}
|
|
740
|
-
w.current = null, T.moved && (q(!1), _.current = !0,
|
|
740
|
+
w.current = null, T.moved && (q(!1), _.current = !0, s((W) => (W !== null && Wt(W), W)));
|
|
741
741
|
}
|
|
742
742
|
},
|
|
743
743
|
[]
|
|
@@ -752,10 +752,10 @@ const Kn = ({
|
|
|
752
752
|
if (A.key === "ArrowUp" || A.key === "ArrowDown") {
|
|
753
753
|
A.preventDefault();
|
|
754
754
|
const T = A.key === "ArrowUp" ? -8 : 8;
|
|
755
|
-
|
|
755
|
+
s((W) => {
|
|
756
756
|
if (W === null) return W;
|
|
757
|
-
const
|
|
758
|
-
return Wt(
|
|
757
|
+
const G = y(W + T);
|
|
758
|
+
return Wt(G), G;
|
|
759
759
|
});
|
|
760
760
|
}
|
|
761
761
|
},
|
|
@@ -767,7 +767,7 @@ const Kn = ({
|
|
|
767
767
|
r ? "ll-hidden--speaking" : null,
|
|
768
768
|
R ? "is-dragging" : null,
|
|
769
769
|
m ? "ll-hidden--with-avatar" : null
|
|
770
|
-
].filter(Boolean).join(" "), D = a === null ? void 0 : { top: `${a -
|
|
770
|
+
].filter(Boolean).join(" "), D = a === null ? void 0 : { top: `${a - h / 2}px`, transform: "none" };
|
|
771
771
|
return /* @__PURE__ */ n(
|
|
772
772
|
"button",
|
|
773
773
|
{
|
|
@@ -799,7 +799,7 @@ const Kn = ({
|
|
|
799
799
|
"img",
|
|
800
800
|
{
|
|
801
801
|
src: l,
|
|
802
|
-
alt:
|
|
802
|
+
alt: c ? `${c} avatar` : "Agent avatar",
|
|
803
803
|
className: "ll-hidden__avatar",
|
|
804
804
|
draggable: !1
|
|
805
805
|
}
|
|
@@ -822,24 +822,24 @@ const Kn = ({
|
|
|
822
822
|
className: o,
|
|
823
823
|
barClassName: l
|
|
824
824
|
}) => {
|
|
825
|
-
const
|
|
825
|
+
const c = E(null), d = E([]), u = He(() => {
|
|
826
826
|
const m = (Math.sqrt(5) - 1) / 2;
|
|
827
|
-
return Array.from({ length: t }, (a,
|
|
827
|
+
return Array.from({ length: t }, (a, s) => 0.5 + s * m % 1 * 0.5);
|
|
828
828
|
}, [t]);
|
|
829
829
|
N(() => e.subscribe((a) => {
|
|
830
|
-
for (let
|
|
831
|
-
const R = d.current[
|
|
830
|
+
for (let s = 0; s < t; s++) {
|
|
831
|
+
const R = d.current[s];
|
|
832
832
|
if (!R) continue;
|
|
833
|
-
const q = Math.max(i, a * r * u[
|
|
833
|
+
const q = Math.max(i, a * r * u[s]);
|
|
834
834
|
R.style.height = `${q}px`;
|
|
835
835
|
}
|
|
836
836
|
}), [e, t, r, i, u]);
|
|
837
|
-
const
|
|
838
|
-
return /* @__PURE__ */ n("div", { ref:
|
|
837
|
+
const h = ["ll-waveform", o].filter(Boolean).join(" ");
|
|
838
|
+
return /* @__PURE__ */ n("div", { ref: c, className: h, "aria-hidden": "true", children: Array.from({ length: t }, (m, a) => /* @__PURE__ */ n(
|
|
839
839
|
"div",
|
|
840
840
|
{
|
|
841
|
-
ref: (
|
|
842
|
-
d.current[a] =
|
|
841
|
+
ref: (s) => {
|
|
842
|
+
d.current[a] = s;
|
|
843
843
|
},
|
|
844
844
|
className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
|
|
845
845
|
style: { height: `${i}px` }
|
|
@@ -853,10 +853,10 @@ const Kn = ({
|
|
|
853
853
|
avatarImageUrl: i,
|
|
854
854
|
agentState: o,
|
|
855
855
|
isMuted: l,
|
|
856
|
-
audioLevel:
|
|
856
|
+
audioLevel: c,
|
|
857
857
|
onExpand: d,
|
|
858
858
|
onToggleMute: u,
|
|
859
|
-
onClose:
|
|
859
|
+
onClose: h
|
|
860
860
|
}) => t ? /* @__PURE__ */ n(
|
|
861
861
|
"div",
|
|
862
862
|
{
|
|
@@ -885,7 +885,7 @@ const Kn = ({
|
|
|
885
885
|
/* @__PURE__ */ n(
|
|
886
886
|
Qn,
|
|
887
887
|
{
|
|
888
|
-
audioLevel:
|
|
888
|
+
audioLevel: c,
|
|
889
889
|
bars: 16,
|
|
890
890
|
maxHeight: 18,
|
|
891
891
|
className: "ll-minimized__waveform"
|
|
@@ -964,7 +964,7 @@ const Kn = ({
|
|
|
964
964
|
{
|
|
965
965
|
type: "button",
|
|
966
966
|
className: "ll-minimized__btn ll-minimized__btn--close",
|
|
967
|
-
onClick:
|
|
967
|
+
onClick: h,
|
|
968
968
|
"aria-label": "Close widget",
|
|
969
969
|
children: /* @__PURE__ */ n(Vn, { className: "ll-minimized__icon" })
|
|
970
970
|
}
|
|
@@ -979,9 +979,9 @@ const Kn = ({
|
|
|
979
979
|
className: i,
|
|
980
980
|
style: o
|
|
981
981
|
}) => {
|
|
982
|
-
const [l,
|
|
982
|
+
const [l, c] = C(!1), d = E(e);
|
|
983
983
|
if (N(() => {
|
|
984
|
-
d.current !== e && (d.current = e,
|
|
984
|
+
d.current !== e && (d.current = e, c(!1));
|
|
985
985
|
}, [e]), !e) return null;
|
|
986
986
|
const u = {
|
|
987
987
|
position: "absolute",
|
|
@@ -1006,7 +1006,7 @@ const Kn = ({
|
|
|
1006
1006
|
style: u,
|
|
1007
1007
|
loading: "eager",
|
|
1008
1008
|
fetchPriority: "high",
|
|
1009
|
-
onLoad: () =>
|
|
1009
|
+
onLoad: () => c(!0)
|
|
1010
1010
|
}
|
|
1011
1011
|
)
|
|
1012
1012
|
);
|
|
@@ -1017,13 +1017,13 @@ const Kn = ({
|
|
|
1017
1017
|
avatarImageUrl: i,
|
|
1018
1018
|
idleLoopUrl: o,
|
|
1019
1019
|
greeting: l,
|
|
1020
|
-
branding:
|
|
1020
|
+
branding: c,
|
|
1021
1021
|
teamMembers: d,
|
|
1022
1022
|
currentTeamMemberId: u,
|
|
1023
|
-
isSwitchingTeamMember:
|
|
1023
|
+
isSwitchingTeamMember: h,
|
|
1024
1024
|
teamSwitcherOpen: m,
|
|
1025
1025
|
onToggleTeamSwitcher: a,
|
|
1026
|
-
onSelectTeamMember:
|
|
1026
|
+
onSelectTeamMember: s,
|
|
1027
1027
|
languageMenuOpen: R,
|
|
1028
1028
|
onToggleLanguageMenu: q,
|
|
1029
1029
|
connectionState: w,
|
|
@@ -1039,95 +1039,101 @@ const Kn = ({
|
|
|
1039
1039
|
cameraPreviewEl: A,
|
|
1040
1040
|
cameraDevices: T,
|
|
1041
1041
|
activeCameraId: W,
|
|
1042
|
-
isScreenShareEnabled:
|
|
1042
|
+
isScreenShareEnabled: G,
|
|
1043
1043
|
screenPreviewEl: re,
|
|
1044
1044
|
isSpeakerMuted: te,
|
|
1045
|
-
allowCamera:
|
|
1046
|
-
allowScreenShare:
|
|
1047
|
-
allowTyping:
|
|
1045
|
+
allowCamera: xe,
|
|
1046
|
+
allowScreenShare: ce,
|
|
1047
|
+
allowTyping: ge,
|
|
1048
1048
|
avatarVideoContainerRef: de,
|
|
1049
1049
|
agentVideoEl: K,
|
|
1050
1050
|
onConnect: ue,
|
|
1051
|
-
onDisconnect:
|
|
1052
|
-
onRetry:
|
|
1053
|
-
onResumeAudio:
|
|
1054
|
-
onToggleMute:
|
|
1055
|
-
onToggleCamera:
|
|
1056
|
-
onSwitchCameraDevice:
|
|
1057
|
-
onToggleScreenShare:
|
|
1058
|
-
onToggleSpeaker:
|
|
1059
|
-
onSendMessage:
|
|
1060
|
-
onMinimize:
|
|
1061
|
-
onClose:
|
|
1062
|
-
onClearMicError:
|
|
1051
|
+
onDisconnect: Le,
|
|
1052
|
+
onRetry: Se,
|
|
1053
|
+
onResumeAudio: Ce,
|
|
1054
|
+
onToggleMute: Ee,
|
|
1055
|
+
onToggleCamera: Ne,
|
|
1056
|
+
onSwitchCameraDevice: Ae,
|
|
1057
|
+
onToggleScreenShare: Re,
|
|
1058
|
+
onToggleSpeaker: V,
|
|
1059
|
+
onSendMessage: Ve,
|
|
1060
|
+
onMinimize: Ye,
|
|
1061
|
+
onClose: Ge,
|
|
1062
|
+
onClearMicError: Xe
|
|
1063
1063
|
}) => {
|
|
1064
|
-
var
|
|
1065
|
-
const
|
|
1064
|
+
var et;
|
|
1065
|
+
const fe = ((d == null ? void 0 : d.length) ?? 0) > 1, ye = w === "connecting" || w === "connected", ie = w === "connected", ct = w === "idle" || w === "disconnected" || w === "error", [pe, Y] = C(!1);
|
|
1066
1066
|
N(() => {
|
|
1067
1067
|
if (!K) {
|
|
1068
|
-
|
|
1068
|
+
Y(!1);
|
|
1069
1069
|
return;
|
|
1070
1070
|
}
|
|
1071
1071
|
if (!K.paused && K.readyState >= 2) {
|
|
1072
|
-
|
|
1072
|
+
Y(!0);
|
|
1073
1073
|
return;
|
|
1074
1074
|
}
|
|
1075
|
-
|
|
1076
|
-
const
|
|
1077
|
-
return K.addEventListener("playing",
|
|
1078
|
-
K.removeEventListener("playing",
|
|
1075
|
+
Y(!1);
|
|
1076
|
+
const f = () => Y(!0);
|
|
1077
|
+
return K.addEventListener("playing", f), K.addEventListener("loadeddata", f), () => {
|
|
1078
|
+
K.removeEventListener("playing", f), K.removeEventListener("loadeddata", f);
|
|
1079
1079
|
};
|
|
1080
1080
|
}, [K]);
|
|
1081
|
-
const [
|
|
1081
|
+
const [Je, ve] = C(!1);
|
|
1082
1082
|
N(() => {
|
|
1083
1083
|
if (!ie) {
|
|
1084
|
-
|
|
1084
|
+
ve(!1);
|
|
1085
1085
|
return;
|
|
1086
1086
|
}
|
|
1087
|
-
if (
|
|
1088
|
-
const
|
|
1089
|
-
return () => clearTimeout(
|
|
1090
|
-
}, [ie,
|
|
1091
|
-
const
|
|
1087
|
+
if (pe) return;
|
|
1088
|
+
const f = setTimeout(() => ve(!0), 8e3);
|
|
1089
|
+
return () => clearTimeout(f);
|
|
1090
|
+
}, [ie, pe]);
|
|
1091
|
+
const he = w === "connecting" || ie && !!i && !pe && !Je, ke = E(null), Ie = E(null);
|
|
1092
1092
|
N(() => {
|
|
1093
|
-
const
|
|
1094
|
-
|
|
1093
|
+
const f = ke.current;
|
|
1094
|
+
f && (f.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "cover", A.style.transform = "scaleX(-1)", f.appendChild(A)));
|
|
1095
1095
|
}, [A]), N(() => {
|
|
1096
|
-
const
|
|
1097
|
-
|
|
1096
|
+
const f = Ie.current;
|
|
1097
|
+
f && (f.innerHTML = "", re && (re.style.width = "100%", re.style.height = "100%", re.style.objectFit = "contain", f.appendChild(re)));
|
|
1098
1098
|
}, [re]);
|
|
1099
|
-
const [
|
|
1099
|
+
const [Z, ne] = C(!1), [oe, be] = C(!1);
|
|
1100
1100
|
N(() => {
|
|
1101
|
-
if (!
|
|
1102
|
-
const
|
|
1103
|
-
|
|
1101
|
+
if (!Z && !oe && !R && !m) return;
|
|
1102
|
+
const f = () => {
|
|
1103
|
+
ne(!1), be(!1), R && q(), m && a();
|
|
1104
1104
|
};
|
|
1105
|
-
return document.addEventListener("click",
|
|
1105
|
+
return document.addEventListener("click", f), () => document.removeEventListener("click", f);
|
|
1106
1106
|
}, [
|
|
1107
|
-
|
|
1108
|
-
|
|
1107
|
+
Z,
|
|
1108
|
+
oe,
|
|
1109
1109
|
R,
|
|
1110
1110
|
m,
|
|
1111
1111
|
q,
|
|
1112
1112
|
a
|
|
1113
1113
|
]);
|
|
1114
|
-
const [
|
|
1115
|
-
(
|
|
1116
|
-
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1114
|
+
const [Me, Te] = C(""), Oe = k(
|
|
1115
|
+
(f) => {
|
|
1116
|
+
f.preventDefault();
|
|
1117
|
+
const U = Me.trim();
|
|
1118
|
+
U && (Ve(U), Te(""));
|
|
1119
1119
|
},
|
|
1120
|
-
[
|
|
1121
|
-
),
|
|
1120
|
+
[Me, Ve]
|
|
1121
|
+
), Ke = c.productName || "Live Layer";
|
|
1122
|
+
let le = null, ae = null;
|
|
1123
|
+
for (let f = y.length - 1; f >= 0; f--) {
|
|
1124
|
+
const U = y[f];
|
|
1125
|
+
if (!le && U.role === "agent" ? le = U : !ae && U.role === "user" && (ae = U), le && ae) break;
|
|
1126
|
+
}
|
|
1127
|
+
const Qe = ie ? (le == null ? void 0 : le.text) || null : l || null, Ze = ie && (ae == null ? void 0 : ae.text) || null, qe = [
|
|
1122
1128
|
"ll-expanded",
|
|
1123
1129
|
t ? "ll-expanded--mobile" : "ll-expanded--desktop"
|
|
1124
1130
|
].join(" ");
|
|
1125
1131
|
return /* @__PURE__ */ x(
|
|
1126
1132
|
"div",
|
|
1127
1133
|
{
|
|
1128
|
-
className:
|
|
1134
|
+
className: qe,
|
|
1129
1135
|
"data-position": e,
|
|
1130
|
-
"data-state": ie ? "connected" :
|
|
1136
|
+
"data-state": ie ? "connected" : ye ? "connecting" : "idle",
|
|
1131
1137
|
role: "dialog",
|
|
1132
1138
|
"aria-label": `${r} widget`,
|
|
1133
1139
|
children: [
|
|
@@ -1139,7 +1145,7 @@ const Kn = ({
|
|
|
1139
1145
|
alt: r,
|
|
1140
1146
|
className: "ll-expanded__bg-img"
|
|
1141
1147
|
}
|
|
1142
|
-
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((
|
|
1148
|
+
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((et = r == null ? void 0 : r.charAt(0)) == null ? void 0 : et.toUpperCase()) || "A" }) }),
|
|
1143
1149
|
o && !ie && /* @__PURE__ */ n(
|
|
1144
1150
|
"video",
|
|
1145
1151
|
{
|
|
@@ -1153,23 +1159,23 @@ const Kn = ({
|
|
|
1153
1159
|
)
|
|
1154
1160
|
] }),
|
|
1155
1161
|
/* @__PURE__ */ n("div", { ref: de, className: "ll-expanded__video" }),
|
|
1156
|
-
|
|
1162
|
+
he && /* @__PURE__ */ x("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
|
|
1157
1163
|
/* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
|
|
1158
|
-
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children:
|
|
1164
|
+
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: h ? "Switching..." : "Connecting..." })
|
|
1159
1165
|
] }),
|
|
1160
1166
|
M && ie && /* @__PURE__ */ x(
|
|
1161
1167
|
"button",
|
|
1162
1168
|
{
|
|
1163
1169
|
type: "button",
|
|
1164
1170
|
className: "ll-expanded__overlay ll-expanded__overlay--gesture",
|
|
1165
|
-
onClick:
|
|
1171
|
+
onClick: Ce,
|
|
1166
1172
|
children: [
|
|
1167
1173
|
/* @__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" }) }),
|
|
1168
1174
|
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
|
|
1169
1175
|
]
|
|
1170
1176
|
}
|
|
1171
1177
|
),
|
|
1172
|
-
|
|
1178
|
+
ye ? /* @__PURE__ */ x("div", { className: "ll-expanded__topbar", children: [
|
|
1173
1179
|
/* @__PURE__ */ x("div", { className: "ll-expanded__topbar-left", children: [
|
|
1174
1180
|
/* @__PURE__ */ x("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1175
1181
|
/* @__PURE__ */ x(
|
|
@@ -1177,14 +1183,14 @@ const Kn = ({
|
|
|
1177
1183
|
{
|
|
1178
1184
|
type: "button",
|
|
1179
1185
|
className: "ll-hpill",
|
|
1180
|
-
onClick: (
|
|
1181
|
-
fe && (
|
|
1186
|
+
onClick: (f) => {
|
|
1187
|
+
fe && (f.stopPropagation(), a());
|
|
1182
1188
|
},
|
|
1183
1189
|
"aria-haspopup": fe ? "listbox" : void 0,
|
|
1184
1190
|
"aria-expanded": fe ? m : void 0,
|
|
1185
1191
|
children: [
|
|
1186
1192
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
|
|
1187
|
-
fe && /* @__PURE__ */ n(
|
|
1193
|
+
fe && /* @__PURE__ */ n(ot, {})
|
|
1188
1194
|
]
|
|
1189
1195
|
}
|
|
1190
1196
|
),
|
|
@@ -1192,30 +1198,30 @@ const Kn = ({
|
|
|
1192
1198
|
"div",
|
|
1193
1199
|
{
|
|
1194
1200
|
className: "ll-hmenu",
|
|
1195
|
-
onClick: (
|
|
1201
|
+
onClick: (f) => f.stopPropagation(),
|
|
1196
1202
|
role: "listbox",
|
|
1197
|
-
children: d == null ? void 0 : d.map((
|
|
1203
|
+
children: d == null ? void 0 : d.map((f) => /* @__PURE__ */ x(
|
|
1198
1204
|
"button",
|
|
1199
1205
|
{
|
|
1200
1206
|
type: "button",
|
|
1201
|
-
className: `ll-hmenu__item ${
|
|
1202
|
-
onClick: () =>
|
|
1207
|
+
className: `ll-hmenu__item ${f.id === u ? "is-active" : ""}`,
|
|
1208
|
+
onClick: () => s(f.id),
|
|
1203
1209
|
role: "option",
|
|
1204
|
-
"aria-selected":
|
|
1210
|
+
"aria-selected": f.id === u,
|
|
1205
1211
|
children: [
|
|
1206
|
-
|
|
1212
|
+
f.avatarImageUrl && /* @__PURE__ */ n(
|
|
1207
1213
|
"img",
|
|
1208
1214
|
{
|
|
1209
|
-
src:
|
|
1215
|
+
src: f.avatarImageUrl,
|
|
1210
1216
|
alt: "",
|
|
1211
1217
|
className: "ll-hmenu__avatar"
|
|
1212
1218
|
}
|
|
1213
1219
|
),
|
|
1214
|
-
/* @__PURE__ */ n("span", { className: "ll-hmenu__name", children:
|
|
1215
|
-
|
|
1220
|
+
/* @__PURE__ */ n("span", { className: "ll-hmenu__name", children: f.name }),
|
|
1221
|
+
f.role && /* @__PURE__ */ n("span", { className: "ll-hmenu__role", children: f.role })
|
|
1216
1222
|
]
|
|
1217
1223
|
},
|
|
1218
|
-
|
|
1224
|
+
f.id
|
|
1219
1225
|
))
|
|
1220
1226
|
}
|
|
1221
1227
|
)
|
|
@@ -1226,8 +1232,8 @@ const Kn = ({
|
|
|
1226
1232
|
{
|
|
1227
1233
|
type: "button",
|
|
1228
1234
|
className: "ll-hpill ll-hpill--compact",
|
|
1229
|
-
onClick: (
|
|
1230
|
-
|
|
1235
|
+
onClick: (f) => {
|
|
1236
|
+
f.stopPropagation(), q();
|
|
1231
1237
|
},
|
|
1232
1238
|
"aria-haspopup": "listbox",
|
|
1233
1239
|
"aria-expanded": R,
|
|
@@ -1235,7 +1241,7 @@ const Kn = ({
|
|
|
1235
1241
|
title: "Language: English",
|
|
1236
1242
|
children: [
|
|
1237
1243
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: "EN" }),
|
|
1238
|
-
/* @__PURE__ */ n(
|
|
1244
|
+
/* @__PURE__ */ n(ot, {})
|
|
1239
1245
|
]
|
|
1240
1246
|
}
|
|
1241
1247
|
),
|
|
@@ -1243,7 +1249,7 @@ const Kn = ({
|
|
|
1243
1249
|
"div",
|
|
1244
1250
|
{
|
|
1245
1251
|
className: "ll-hmenu",
|
|
1246
|
-
onClick: (
|
|
1252
|
+
onClick: (f) => f.stopPropagation(),
|
|
1247
1253
|
role: "listbox",
|
|
1248
1254
|
children: /* @__PURE__ */ n(
|
|
1249
1255
|
"button",
|
|
@@ -1272,7 +1278,7 @@ const Kn = ({
|
|
|
1272
1278
|
{
|
|
1273
1279
|
type: "button",
|
|
1274
1280
|
className: "ll-hbtn",
|
|
1275
|
-
onClick:
|
|
1281
|
+
onClick: Ye,
|
|
1276
1282
|
"aria-label": "Minimize widget",
|
|
1277
1283
|
title: "Minimize",
|
|
1278
1284
|
children: /* @__PURE__ */ n(Ut, {})
|
|
@@ -1283,7 +1289,7 @@ const Kn = ({
|
|
|
1283
1289
|
{
|
|
1284
1290
|
type: "button",
|
|
1285
1291
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1286
|
-
onClick:
|
|
1292
|
+
onClick: Ge,
|
|
1287
1293
|
"aria-label": "End call",
|
|
1288
1294
|
title: "End call",
|
|
1289
1295
|
children: /* @__PURE__ */ n(Ft, {})
|
|
@@ -1293,14 +1299,14 @@ const Kn = ({
|
|
|
1293
1299
|
] }) : (
|
|
1294
1300
|
// Idle-state header with Live Layer product name + minimize/close
|
|
1295
1301
|
/* @__PURE__ */ x("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
|
|
1296
|
-
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children:
|
|
1302
|
+
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Ke }),
|
|
1297
1303
|
/* @__PURE__ */ x("div", { className: "ll-expanded__header-actions", children: [
|
|
1298
1304
|
/* @__PURE__ */ n(
|
|
1299
1305
|
"button",
|
|
1300
1306
|
{
|
|
1301
1307
|
type: "button",
|
|
1302
1308
|
className: "ll-hbtn ll-hbtn--ghost",
|
|
1303
|
-
onClick:
|
|
1309
|
+
onClick: Ye,
|
|
1304
1310
|
"aria-label": "Minimize widget",
|
|
1305
1311
|
children: /* @__PURE__ */ n(Ut, {})
|
|
1306
1312
|
}
|
|
@@ -1310,7 +1316,7 @@ const Kn = ({
|
|
|
1310
1316
|
{
|
|
1311
1317
|
type: "button",
|
|
1312
1318
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1313
|
-
onClick:
|
|
1319
|
+
onClick: Ge,
|
|
1314
1320
|
"aria-label": "Close widget",
|
|
1315
1321
|
children: /* @__PURE__ */ n(Ft, {})
|
|
1316
1322
|
}
|
|
@@ -1318,8 +1324,8 @@ const Kn = ({
|
|
|
1318
1324
|
] })
|
|
1319
1325
|
] })
|
|
1320
1326
|
),
|
|
1321
|
-
|
|
1322
|
-
const
|
|
1327
|
+
ct && /* @__PURE__ */ (() => {
|
|
1328
|
+
const f = z ? "Restart paused session" : w === "disconnected" ? "Reconnect to agent" : "Start video call", U = z ? "Pick up where you left off" : null;
|
|
1323
1329
|
return /* @__PURE__ */ x(yt, { children: [
|
|
1324
1330
|
w === "idle" && !z && !H && /* @__PURE__ */ x(
|
|
1325
1331
|
"button",
|
|
@@ -1327,24 +1333,24 @@ const Kn = ({
|
|
|
1327
1333
|
type: "button",
|
|
1328
1334
|
className: "ll-expanded__play",
|
|
1329
1335
|
onClick: ue,
|
|
1330
|
-
"aria-label":
|
|
1336
|
+
"aria-label": f,
|
|
1331
1337
|
children: [
|
|
1332
1338
|
/* @__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" }) }) }),
|
|
1333
|
-
/* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children:
|
|
1339
|
+
/* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: f })
|
|
1334
1340
|
]
|
|
1335
1341
|
}
|
|
1336
1342
|
),
|
|
1337
1343
|
/* @__PURE__ */ x("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
|
|
1338
1344
|
l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
|
|
1339
|
-
|
|
1345
|
+
U && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: U }),
|
|
1340
1346
|
/* @__PURE__ */ n(
|
|
1341
1347
|
"button",
|
|
1342
1348
|
{
|
|
1343
1349
|
type: "button",
|
|
1344
1350
|
className: "ll-expanded__cta",
|
|
1345
1351
|
onClick: ue,
|
|
1346
|
-
"aria-label":
|
|
1347
|
-
children:
|
|
1352
|
+
"aria-label": f,
|
|
1353
|
+
children: f
|
|
1348
1354
|
}
|
|
1349
1355
|
)
|
|
1350
1356
|
] })
|
|
@@ -1353,53 +1359,61 @@ const Kn = ({
|
|
|
1353
1359
|
/* @__PURE__ */ x(
|
|
1354
1360
|
"div",
|
|
1355
1361
|
{
|
|
1356
|
-
className: `ll-expanded__pip ${
|
|
1362
|
+
className: `ll-expanded__pip ${ye && (D || G) ? "is-visible" : ""}`,
|
|
1357
1363
|
children: [
|
|
1358
1364
|
/* @__PURE__ */ n(
|
|
1359
1365
|
"div",
|
|
1360
1366
|
{
|
|
1361
|
-
ref:
|
|
1362
|
-
className:
|
|
1367
|
+
ref: Ie,
|
|
1368
|
+
className: G ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1363
1369
|
}
|
|
1364
1370
|
),
|
|
1365
1371
|
/* @__PURE__ */ n(
|
|
1366
1372
|
"div",
|
|
1367
1373
|
{
|
|
1368
|
-
ref:
|
|
1369
|
-
className: !
|
|
1374
|
+
ref: ke,
|
|
1375
|
+
className: !G && D ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1370
1376
|
}
|
|
1371
1377
|
)
|
|
1372
1378
|
]
|
|
1373
1379
|
}
|
|
1374
1380
|
),
|
|
1375
|
-
|
|
1376
|
-
|
|
1381
|
+
ye ? /* @__PURE__ */ x("div", { className: "ll-expanded__bottom", children: [
|
|
1382
|
+
Qe && /* @__PURE__ */ n(
|
|
1383
|
+
"div",
|
|
1384
|
+
{
|
|
1385
|
+
className: "ll-expanded__transcript ll-expanded__transcript--agent",
|
|
1386
|
+
"data-role": "agent",
|
|
1387
|
+
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Qe })
|
|
1388
|
+
}
|
|
1389
|
+
),
|
|
1390
|
+
Ze && /* @__PURE__ */ n(
|
|
1377
1391
|
"div",
|
|
1378
1392
|
{
|
|
1379
|
-
className:
|
|
1380
|
-
"data-role":
|
|
1381
|
-
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children:
|
|
1393
|
+
className: "ll-expanded__transcript ll-expanded__transcript--user",
|
|
1394
|
+
"data-role": "user",
|
|
1395
|
+
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Ze })
|
|
1382
1396
|
}
|
|
1383
1397
|
),
|
|
1384
|
-
/* @__PURE__ */ x("div", { className: "ll-toolbar", onClick: (
|
|
1385
|
-
|
|
1398
|
+
/* @__PURE__ */ x("div", { className: "ll-toolbar", onClick: (f) => f.stopPropagation(), children: [
|
|
1399
|
+
ce && /* @__PURE__ */ n(
|
|
1386
1400
|
"button",
|
|
1387
1401
|
{
|
|
1388
1402
|
type: "button",
|
|
1389
|
-
className: `ll-tool ${
|
|
1390
|
-
onClick:
|
|
1391
|
-
"aria-label":
|
|
1392
|
-
title:
|
|
1403
|
+
className: `ll-tool ${G ? "is-on" : ""}`,
|
|
1404
|
+
onClick: Re,
|
|
1405
|
+
"aria-label": G ? "Stop sharing screen" : "Share screen",
|
|
1406
|
+
title: G ? "Stop sharing" : "Share screen",
|
|
1393
1407
|
children: /* @__PURE__ */ n(nr, {})
|
|
1394
1408
|
}
|
|
1395
1409
|
),
|
|
1396
|
-
|
|
1410
|
+
xe && /* @__PURE__ */ x("div", { className: "ll-tool-split", children: [
|
|
1397
1411
|
/* @__PURE__ */ n(
|
|
1398
1412
|
"button",
|
|
1399
1413
|
{
|
|
1400
1414
|
type: "button",
|
|
1401
1415
|
className: `ll-tool ll-tool--left ${D ? "is-on" : ""}`,
|
|
1402
|
-
onClick:
|
|
1416
|
+
onClick: Ne,
|
|
1403
1417
|
"aria-label": D ? "Turn off camera" : "Turn on camera",
|
|
1404
1418
|
title: D ? "Stop camera" : "Start camera",
|
|
1405
1419
|
children: /* @__PURE__ */ n(rr, {})
|
|
@@ -1410,23 +1424,23 @@ const Kn = ({
|
|
|
1410
1424
|
{
|
|
1411
1425
|
type: "button",
|
|
1412
1426
|
className: `ll-tool ll-tool--right ${D ? "is-on" : ""}`,
|
|
1413
|
-
onClick: (
|
|
1414
|
-
|
|
1427
|
+
onClick: (f) => {
|
|
1428
|
+
f.stopPropagation(), be((U) => !U), ne(!1);
|
|
1415
1429
|
},
|
|
1416
1430
|
"aria-label": "Camera devices",
|
|
1417
1431
|
"aria-haspopup": "listbox",
|
|
1418
|
-
"aria-expanded":
|
|
1419
|
-
children: /* @__PURE__ */ n(
|
|
1432
|
+
"aria-expanded": oe,
|
|
1433
|
+
children: /* @__PURE__ */ n(ot, {})
|
|
1420
1434
|
}
|
|
1421
1435
|
),
|
|
1422
|
-
|
|
1436
|
+
oe && T.length > 0 && /* @__PURE__ */ n(
|
|
1423
1437
|
jt,
|
|
1424
1438
|
{
|
|
1425
1439
|
label: "Camera",
|
|
1426
1440
|
devices: T,
|
|
1427
1441
|
activeId: W,
|
|
1428
|
-
onPick: (
|
|
1429
|
-
|
|
1442
|
+
onPick: (f) => {
|
|
1443
|
+
be(!1), Ae(f);
|
|
1430
1444
|
}
|
|
1431
1445
|
}
|
|
1432
1446
|
)
|
|
@@ -1437,7 +1451,7 @@ const Kn = ({
|
|
|
1437
1451
|
{
|
|
1438
1452
|
type: "button",
|
|
1439
1453
|
className: `ll-tool ll-tool--left ${v ? "is-muted" : ""}`,
|
|
1440
|
-
onClick:
|
|
1454
|
+
onClick: Ee,
|
|
1441
1455
|
"aria-label": v ? "Unmute microphone" : "Mute microphone",
|
|
1442
1456
|
title: v ? "Unmute" : "Mute",
|
|
1443
1457
|
children: /* @__PURE__ */ n(ir, { muted: v })
|
|
@@ -1448,22 +1462,22 @@ const Kn = ({
|
|
|
1448
1462
|
{
|
|
1449
1463
|
type: "button",
|
|
1450
1464
|
className: `ll-tool ll-tool--right ${v ? "is-muted" : ""}`,
|
|
1451
|
-
onClick: (
|
|
1452
|
-
|
|
1465
|
+
onClick: (f) => {
|
|
1466
|
+
f.stopPropagation(), ne((U) => !U), be(!1);
|
|
1453
1467
|
},
|
|
1454
1468
|
"aria-label": "Microphone devices",
|
|
1455
1469
|
"aria-haspopup": "listbox",
|
|
1456
|
-
"aria-expanded":
|
|
1457
|
-
children: /* @__PURE__ */ n(
|
|
1470
|
+
"aria-expanded": Z,
|
|
1471
|
+
children: /* @__PURE__ */ n(ot, {})
|
|
1458
1472
|
}
|
|
1459
1473
|
),
|
|
1460
|
-
|
|
1474
|
+
Z && B.length > 0 && /* @__PURE__ */ n(
|
|
1461
1475
|
jt,
|
|
1462
1476
|
{
|
|
1463
1477
|
label: "Microphone",
|
|
1464
1478
|
devices: B,
|
|
1465
1479
|
activeId: "",
|
|
1466
|
-
onPick: () =>
|
|
1480
|
+
onPick: () => ne(!1)
|
|
1467
1481
|
}
|
|
1468
1482
|
)
|
|
1469
1483
|
] }),
|
|
@@ -1472,7 +1486,7 @@ const Kn = ({
|
|
|
1472
1486
|
{
|
|
1473
1487
|
type: "button",
|
|
1474
1488
|
className: `ll-tool ${te ? "is-muted" : ""}`,
|
|
1475
|
-
onClick:
|
|
1489
|
+
onClick: V,
|
|
1476
1490
|
"aria-label": te ? "Unmute speaker" : "Mute speaker",
|
|
1477
1491
|
title: te ? "Unmute speaker" : "Mute speaker",
|
|
1478
1492
|
children: /* @__PURE__ */ n(or, { muted: te })
|
|
@@ -1483,26 +1497,26 @@ const Kn = ({
|
|
|
1483
1497
|
{
|
|
1484
1498
|
type: "button",
|
|
1485
1499
|
className: "ll-tool ll-tool--danger",
|
|
1486
|
-
onClick:
|
|
1500
|
+
onClick: Le,
|
|
1487
1501
|
"aria-label": "End conversation",
|
|
1488
1502
|
title: "End conversation",
|
|
1489
1503
|
children: /* @__PURE__ */ n(ar, {})
|
|
1490
1504
|
}
|
|
1491
1505
|
)
|
|
1492
1506
|
] }),
|
|
1493
|
-
|
|
1507
|
+
ge && /* @__PURE__ */ x("form", { className: "ll-message-input", onSubmit: Oe, children: [
|
|
1494
1508
|
/* @__PURE__ */ n(
|
|
1495
1509
|
"input",
|
|
1496
1510
|
{
|
|
1497
1511
|
type: "text",
|
|
1498
1512
|
className: "ll-message-input__field",
|
|
1499
1513
|
placeholder: "Message...",
|
|
1500
|
-
value:
|
|
1501
|
-
onChange: (
|
|
1514
|
+
value: Me,
|
|
1515
|
+
onChange: (f) => Te(f.target.value),
|
|
1502
1516
|
"aria-label": "Message the agent"
|
|
1503
1517
|
}
|
|
1504
1518
|
),
|
|
1505
|
-
|
|
1519
|
+
Me.trim() && /* @__PURE__ */ n(
|
|
1506
1520
|
"button",
|
|
1507
1521
|
{
|
|
1508
1522
|
type: "submit",
|
|
@@ -1522,23 +1536,23 @@ const Kn = ({
|
|
|
1522
1536
|
{
|
|
1523
1537
|
type: "button",
|
|
1524
1538
|
className: "ll-expanded__banner-x",
|
|
1525
|
-
onClick:
|
|
1539
|
+
onClick: Xe,
|
|
1526
1540
|
"aria-label": "Dismiss",
|
|
1527
1541
|
children: "×"
|
|
1528
1542
|
}
|
|
1529
1543
|
)
|
|
1530
1544
|
] });
|
|
1531
1545
|
if (!H || w !== "error") return null;
|
|
1532
|
-
let
|
|
1533
|
-
return H === "MIC_PERMISSION_DENIED" ?
|
|
1534
|
-
/* @__PURE__ */ n("span", { children:
|
|
1546
|
+
let f = "Failed to connect", U = "Try again";
|
|
1547
|
+
return H === "MIC_PERMISSION_DENIED" ? f = "Microphone blocked. Allow access to talk." : H === "MIC_NOT_FOUND" ? f = "No microphone found. Plug one in + retry." : H === "MIC_UNAVAILABLE" ? f = "Mic unavailable. Check other apps using it." : H === "AGENT_TIMEOUT" ? f = "Agent didn't pick up. Try again." : H === "CONNECT_FAILED" ? f = "Connection failed. Check your network." : H.length < 80 && (f = H), /* @__PURE__ */ x("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
|
|
1548
|
+
/* @__PURE__ */ n("span", { children: f }),
|
|
1535
1549
|
/* @__PURE__ */ n(
|
|
1536
1550
|
"button",
|
|
1537
1551
|
{
|
|
1538
1552
|
type: "button",
|
|
1539
1553
|
className: "ll-expanded__banner-retry",
|
|
1540
|
-
onClick:
|
|
1541
|
-
children:
|
|
1554
|
+
onClick: Se,
|
|
1555
|
+
children: U
|
|
1542
1556
|
}
|
|
1543
1557
|
)
|
|
1544
1558
|
] });
|
|
@@ -1547,7 +1561,7 @@ const Kn = ({
|
|
|
1547
1561
|
}
|
|
1548
1562
|
);
|
|
1549
1563
|
};
|
|
1550
|
-
function
|
|
1564
|
+
function ot() {
|
|
1551
1565
|
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" }) });
|
|
1552
1566
|
}
|
|
1553
1567
|
function Ft() {
|
|
@@ -1613,17 +1627,17 @@ const jt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */
|
|
|
1613
1627
|
children: [
|
|
1614
1628
|
/* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
|
|
1615
1629
|
t.map((o, l) => {
|
|
1616
|
-
const
|
|
1630
|
+
const c = r === o.deviceId;
|
|
1617
1631
|
return /* @__PURE__ */ x(
|
|
1618
1632
|
"button",
|
|
1619
1633
|
{
|
|
1620
1634
|
type: "button",
|
|
1621
|
-
className: `ll-device-menu__item ${
|
|
1635
|
+
className: `ll-device-menu__item ${c ? "is-active" : ""}`,
|
|
1622
1636
|
onClick: () => i(o.deviceId),
|
|
1623
1637
|
role: "option",
|
|
1624
|
-
"aria-selected":
|
|
1638
|
+
"aria-selected": c,
|
|
1625
1639
|
children: [
|
|
1626
|
-
|
|
1640
|
+
c && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
|
|
1627
1641
|
/* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: o.label || `${e} ${l + 1}` })
|
|
1628
1642
|
]
|
|
1629
1643
|
},
|
|
@@ -1632,20 +1646,20 @@ const jt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */
|
|
|
1632
1646
|
})
|
|
1633
1647
|
]
|
|
1634
1648
|
}
|
|
1635
|
-
),
|
|
1649
|
+
), sr = [
|
|
1636
1650
|
'[data-ll-private="true"]',
|
|
1637
1651
|
".ll-widget"
|
|
1638
1652
|
];
|
|
1639
1653
|
function bt(e) {
|
|
1640
1654
|
let t = e;
|
|
1641
1655
|
for (; t; ) {
|
|
1642
|
-
for (const r of
|
|
1656
|
+
for (const r of sr)
|
|
1643
1657
|
if (t.matches(r)) return !0;
|
|
1644
1658
|
t = t.parentElement;
|
|
1645
1659
|
}
|
|
1646
1660
|
return !1;
|
|
1647
1661
|
}
|
|
1648
|
-
function
|
|
1662
|
+
function st(e) {
|
|
1649
1663
|
if (bt(e)) return !1;
|
|
1650
1664
|
if (e instanceof HTMLInputElement) {
|
|
1651
1665
|
if (e.type === "password") return !1;
|
|
@@ -1654,7 +1668,7 @@ function lt(e) {
|
|
|
1654
1668
|
}
|
|
1655
1669
|
return !0;
|
|
1656
1670
|
}
|
|
1657
|
-
const
|
|
1671
|
+
const lt = 4096, cr = 20, dr = 20, ur = 10, fr = 10, pr = 30, hr = 20, Vt = 500, mr = [
|
|
1658
1672
|
'[data-ll-private="true"]',
|
|
1659
1673
|
".ll-widget",
|
|
1660
1674
|
"script",
|
|
@@ -1662,7 +1676,7 @@ const it = 4096, sr = 20, dr = 20, ur = 10, fr = 10, pr = 30, hr = 20, Vt = 500,
|
|
|
1662
1676
|
"noscript",
|
|
1663
1677
|
"iframe"
|
|
1664
1678
|
];
|
|
1665
|
-
function
|
|
1679
|
+
function Ue(e) {
|
|
1666
1680
|
if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
|
|
1667
1681
|
let t = e;
|
|
1668
1682
|
for (; t; ) {
|
|
@@ -1672,7 +1686,7 @@ function Ye(e) {
|
|
|
1672
1686
|
}
|
|
1673
1687
|
return !1;
|
|
1674
1688
|
}
|
|
1675
|
-
function
|
|
1689
|
+
function je(e) {
|
|
1676
1690
|
if (typeof window > "u") return !0;
|
|
1677
1691
|
const t = e.getBoundingClientRect();
|
|
1678
1692
|
if (t.width <= 0 || t.height <= 0) return !1;
|
|
@@ -1692,10 +1706,10 @@ function Yt(e) {
|
|
|
1692
1706
|
const o = e.closest("label");
|
|
1693
1707
|
return o != null && o.textContent ? o.textContent.trim() : "";
|
|
1694
1708
|
}
|
|
1695
|
-
function
|
|
1709
|
+
function me(e, t) {
|
|
1696
1710
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
1697
1711
|
}
|
|
1698
|
-
function
|
|
1712
|
+
function De(e) {
|
|
1699
1713
|
return e.length;
|
|
1700
1714
|
}
|
|
1701
1715
|
function gr(e, t = {}) {
|
|
@@ -1712,39 +1726,39 @@ function gr(e, t = {}) {
|
|
|
1712
1726
|
forms: [],
|
|
1713
1727
|
extras: e
|
|
1714
1728
|
};
|
|
1715
|
-
const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "",
|
|
1729
|
+
const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "", c = Array.from(
|
|
1716
1730
|
r.querySelectorAll("[data-ll-region]")
|
|
1717
1731
|
), d = [];
|
|
1718
|
-
for (const v of
|
|
1732
|
+
for (const v of c) {
|
|
1719
1733
|
if (d.length >= ur) break;
|
|
1720
|
-
if (
|
|
1721
|
-
const S = v.getAttribute("data-ll-region") ?? "", B = v.getAttribute("data-ll-intent") ?? void 0, D =
|
|
1734
|
+
if (Ue(v) || !je(v)) continue;
|
|
1735
|
+
const S = v.getAttribute("data-ll-region") ?? "", B = v.getAttribute("data-ll-intent") ?? void 0, D = me(
|
|
1722
1736
|
(v.innerText || v.textContent || "").trim(),
|
|
1723
1737
|
Vt * 2
|
|
1724
1738
|
);
|
|
1725
1739
|
!S || !D || d.push({ id: S, intent: B, text: D });
|
|
1726
1740
|
}
|
|
1727
|
-
const u = [],
|
|
1741
|
+
const u = [], h = ["H1", "H2", "H3", "H4", "H5", "H6"], m = Array.from(
|
|
1728
1742
|
r.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
|
1729
1743
|
);
|
|
1730
1744
|
for (const v of m) {
|
|
1731
|
-
if (
|
|
1745
|
+
if (Ue(v) || !je(v)) continue;
|
|
1732
1746
|
const S = (v.textContent || "").trim();
|
|
1733
|
-
S && u.push(`${v.tagName}: ${
|
|
1747
|
+
S && u.push(`${v.tagName}: ${me(S, 200)}`);
|
|
1734
1748
|
}
|
|
1735
1749
|
const a = Array.from(r.querySelectorAll("p, li"));
|
|
1736
1750
|
for (const v of a) {
|
|
1737
|
-
if (
|
|
1751
|
+
if (Ue(v) || !je(v) || h.includes(v.tagName)) continue;
|
|
1738
1752
|
const S = (v.textContent || "").trim();
|
|
1739
|
-
S.length > 10 && u.push(
|
|
1753
|
+
S.length > 10 && u.push(me(S, Vt));
|
|
1740
1754
|
}
|
|
1741
|
-
const
|
|
1755
|
+
const s = u.join(`
|
|
1742
1756
|
`), R = [], q = Array.from(r.querySelectorAll("a[href]"));
|
|
1743
1757
|
for (const v of q) {
|
|
1744
|
-
if (R.length >=
|
|
1745
|
-
if (
|
|
1758
|
+
if (R.length >= cr) break;
|
|
1759
|
+
if (Ue(v) || !je(v)) continue;
|
|
1746
1760
|
const S = v.getAttribute("href") || "", B = (v.textContent || "").trim();
|
|
1747
|
-
!S || !B || R.push({ href: S, text:
|
|
1761
|
+
!S || !B || R.push({ href: S, text: me(B, 100) });
|
|
1748
1762
|
}
|
|
1749
1763
|
const w = [], _ = Array.from(
|
|
1750
1764
|
r.querySelectorAll(
|
|
@@ -1753,9 +1767,9 @@ function gr(e, t = {}) {
|
|
|
1753
1767
|
);
|
|
1754
1768
|
for (const v of _) {
|
|
1755
1769
|
if (w.length >= dr) break;
|
|
1756
|
-
if (
|
|
1770
|
+
if (Ue(v) || !st(v) || !je(v)) continue;
|
|
1757
1771
|
const S = Yt(v), B = v instanceof HTMLInputElement ? v.type : v.tagName.toLowerCase();
|
|
1758
|
-
S && w.push({ label:
|
|
1772
|
+
S && w.push({ label: me(S, 100), type: B });
|
|
1759
1773
|
}
|
|
1760
1774
|
const y = Array.from(
|
|
1761
1775
|
r.querySelectorAll("[data-ll-form]")
|
|
@@ -1772,26 +1786,26 @@ function gr(e, t = {}) {
|
|
|
1772
1786
|
), A = [];
|
|
1773
1787
|
for (const T of D) {
|
|
1774
1788
|
if (A.length >= pr) break;
|
|
1775
|
-
if (!
|
|
1789
|
+
if (!st(T)) continue;
|
|
1776
1790
|
const W = T.getAttribute("data-ll-field") || "";
|
|
1777
1791
|
if (!W) continue;
|
|
1778
|
-
const
|
|
1792
|
+
const G = Yt(T) || W, re = T instanceof HTMLInputElement ? T.type : T.tagName.toLowerCase(), te = {
|
|
1779
1793
|
name: W,
|
|
1780
|
-
label:
|
|
1794
|
+
label: me(G, 100),
|
|
1781
1795
|
type: re
|
|
1782
1796
|
};
|
|
1783
1797
|
if (T.required === !0 && (te.required = !0), T instanceof HTMLSelectElement) {
|
|
1784
|
-
const
|
|
1785
|
-
for (let
|
|
1786
|
-
const de = T.options[
|
|
1798
|
+
const ce = [];
|
|
1799
|
+
for (let ge = 0; ge < T.options.length && !(ce.length >= hr); ge++) {
|
|
1800
|
+
const de = T.options[ge];
|
|
1787
1801
|
if (!de || de.disabled) continue;
|
|
1788
1802
|
const K = de.value || "", ue = (de.textContent || "").trim() || K;
|
|
1789
|
-
!K && !ue ||
|
|
1803
|
+
!K && !ue || ce.push({ value: K, label: me(ue, 60) });
|
|
1790
1804
|
}
|
|
1791
|
-
|
|
1805
|
+
ce.length > 0 && (te.options = ce);
|
|
1792
1806
|
}
|
|
1793
|
-
const
|
|
1794
|
-
|
|
1807
|
+
const xe = typeof T.validationMessage == "string" ? T.validationMessage : "";
|
|
1808
|
+
xe && (te.validationMessage = me(xe, 200)), A.push(te);
|
|
1795
1809
|
}
|
|
1796
1810
|
z.push({ id: S, intent: B, fields: A });
|
|
1797
1811
|
}
|
|
@@ -1800,29 +1814,29 @@ function gr(e, t = {}) {
|
|
|
1800
1814
|
title: l,
|
|
1801
1815
|
pathname: o,
|
|
1802
1816
|
regions: d,
|
|
1803
|
-
visibleText:
|
|
1817
|
+
visibleText: s,
|
|
1804
1818
|
visibleLinks: R,
|
|
1805
1819
|
visibleFields: w,
|
|
1806
1820
|
forms: z,
|
|
1807
1821
|
extras: e
|
|
1808
1822
|
};
|
|
1809
|
-
let H =
|
|
1810
|
-
for (; H >
|
|
1811
|
-
M.visibleFields.pop(), H =
|
|
1812
|
-
for (; H >
|
|
1823
|
+
let H = De(JSON.stringify(M.regions)) + De(M.visibleText) + De(JSON.stringify(M.visibleLinks)) + De(JSON.stringify(M.visibleFields));
|
|
1824
|
+
for (; H > lt && M.visibleFields.length > 0; )
|
|
1825
|
+
M.visibleFields.pop(), H = De(JSON.stringify(M.visibleFields));
|
|
1826
|
+
for (; H > lt && M.visibleLinks.length > 0; )
|
|
1813
1827
|
M.visibleLinks.pop(), H -= 80;
|
|
1814
|
-
return
|
|
1828
|
+
return De(M.visibleText) > lt && (M.visibleText = me(M.visibleText, lt - 100)), M;
|
|
1815
1829
|
}
|
|
1816
|
-
let
|
|
1830
|
+
let $e = null;
|
|
1817
1831
|
function Gt(e, t = {}) {
|
|
1818
1832
|
const r = Date.now(), o = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
|
|
1819
|
-
if (
|
|
1820
|
-
return
|
|
1833
|
+
if ($e && $e.key === o && r - $e.at < 1e3)
|
|
1834
|
+
return $e.ctx;
|
|
1821
1835
|
const l = gr(e, t);
|
|
1822
|
-
return
|
|
1836
|
+
return $e = { key: o, at: r, ctx: l }, l;
|
|
1823
1837
|
}
|
|
1824
1838
|
function yr() {
|
|
1825
|
-
|
|
1839
|
+
$e = null;
|
|
1826
1840
|
}
|
|
1827
1841
|
const vr = 200;
|
|
1828
1842
|
function br(e) {
|
|
@@ -1842,38 +1856,38 @@ function _r(e) {
|
|
|
1842
1856
|
const t = e ?? (typeof document < "u" ? document : null);
|
|
1843
1857
|
if (!t) return [];
|
|
1844
1858
|
const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), o = [], l = Array.from(t.querySelectorAll("a[href]"));
|
|
1845
|
-
for (const
|
|
1859
|
+
for (const c of l) {
|
|
1846
1860
|
if (o.length >= vr) break;
|
|
1847
|
-
if (bt(
|
|
1848
|
-
const d =
|
|
1861
|
+
if (bt(c)) continue;
|
|
1862
|
+
const d = c.getAttribute("href") || "";
|
|
1849
1863
|
if (!wr(d)) continue;
|
|
1850
|
-
let u = d,
|
|
1864
|
+
let u = d, h = !0;
|
|
1851
1865
|
try {
|
|
1852
1866
|
if (typeof window < "u") {
|
|
1853
1867
|
const a = new URL(d, r);
|
|
1854
|
-
|
|
1868
|
+
h = a.origin === r, h && d.startsWith("http") && (u = a.pathname + a.search + a.hash);
|
|
1855
1869
|
}
|
|
1856
1870
|
} catch {
|
|
1857
1871
|
continue;
|
|
1858
1872
|
}
|
|
1859
1873
|
if (i.has(u)) continue;
|
|
1860
1874
|
i.add(u);
|
|
1861
|
-
const m = (
|
|
1862
|
-
o.push({ href: u, text: m, internal:
|
|
1875
|
+
const m = (c.textContent || "").trim().slice(0, 120);
|
|
1876
|
+
o.push({ href: u, text: m, internal: h });
|
|
1863
1877
|
}
|
|
1864
1878
|
return o;
|
|
1865
1879
|
}
|
|
1866
|
-
let
|
|
1880
|
+
let ze = null;
|
|
1867
1881
|
const xr = 5e3;
|
|
1868
1882
|
function mt() {
|
|
1869
1883
|
const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
|
|
1870
|
-
if (
|
|
1871
|
-
return
|
|
1884
|
+
if (ze && ze.pathname === t && e - ze.at < xr)
|
|
1885
|
+
return ze.routes;
|
|
1872
1886
|
const r = _r();
|
|
1873
|
-
return
|
|
1887
|
+
return ze = { at: e, pathname: t, routes: r }, r;
|
|
1874
1888
|
}
|
|
1875
1889
|
function kr() {
|
|
1876
|
-
|
|
1890
|
+
ze = null;
|
|
1877
1891
|
}
|
|
1878
1892
|
function Lr(e, t) {
|
|
1879
1893
|
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;
|
|
@@ -1885,8 +1899,8 @@ function Sr(e, t, r = {}) {
|
|
|
1885
1899
|
const l = Object.getOwnPropertyDescriptor(
|
|
1886
1900
|
HTMLInputElement.prototype,
|
|
1887
1901
|
"checked"
|
|
1888
|
-
),
|
|
1889
|
-
|
|
1902
|
+
), c = l == null ? void 0 : l.set, d = t === "true" || t === "1" || t === "on";
|
|
1903
|
+
c ? c.call(e, d) : e.checked = d, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
1890
1904
|
return;
|
|
1891
1905
|
}
|
|
1892
1906
|
Lr(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
@@ -1967,13 +1981,13 @@ function Mr(e) {
|
|
|
1967
1981
|
baseUrl: i = "https://app.livelayer.studio",
|
|
1968
1982
|
sessionEndpoint: o,
|
|
1969
1983
|
sessionBody: l,
|
|
1970
|
-
soundEffects:
|
|
1984
|
+
soundEffects: c,
|
|
1971
1985
|
autoConnect: d = !1,
|
|
1972
1986
|
displayMode: u,
|
|
1973
|
-
defaultDisplayMode:
|
|
1987
|
+
defaultDisplayMode: h = "expanded",
|
|
1974
1988
|
onDisplayModeChange: m,
|
|
1975
1989
|
position: a = "bottom-right",
|
|
1976
|
-
mobileBreakpoint:
|
|
1990
|
+
mobileBreakpoint: s = 640,
|
|
1977
1991
|
persistKey: R = "ll-widget",
|
|
1978
1992
|
disablePersistence: q = !1,
|
|
1979
1993
|
teamMembers: w,
|
|
@@ -1989,75 +2003,75 @@ function Mr(e) {
|
|
|
1989
2003
|
allowTyping: A = !0,
|
|
1990
2004
|
showOn: T,
|
|
1991
2005
|
hideOn: W,
|
|
1992
|
-
pathname:
|
|
2006
|
+
pathname: G,
|
|
1993
2007
|
onNavigate: re,
|
|
1994
2008
|
onScrollToSelector: te,
|
|
1995
|
-
getPageContext:
|
|
1996
|
-
pageContextExtras:
|
|
1997
|
-
getRoutes:
|
|
2009
|
+
getPageContext: xe,
|
|
2010
|
+
pageContextExtras: ce,
|
|
2011
|
+
getRoutes: ge,
|
|
1998
2012
|
onScrollPage: de,
|
|
1999
2013
|
onClick: K,
|
|
2000
2014
|
capabilities: ue,
|
|
2001
|
-
onConnect:
|
|
2002
|
-
onDisconnect:
|
|
2003
|
-
onTranscript:
|
|
2004
|
-
onAgentState:
|
|
2005
|
-
onConnectionStateChange:
|
|
2006
|
-
onAgentEvent:
|
|
2007
|
-
onAgentCommand:
|
|
2008
|
-
controlledSession:
|
|
2009
|
-
className:
|
|
2010
|
-
style:
|
|
2011
|
-
zIndex:
|
|
2012
|
-
} = e,
|
|
2015
|
+
onConnect: Le,
|
|
2016
|
+
onDisconnect: Se,
|
|
2017
|
+
onTranscript: Ce,
|
|
2018
|
+
onAgentState: Ee,
|
|
2019
|
+
onConnectionStateChange: Ne,
|
|
2020
|
+
onAgentEvent: Ae,
|
|
2021
|
+
onAgentCommand: Re,
|
|
2022
|
+
controlledSession: V,
|
|
2023
|
+
className: Ve,
|
|
2024
|
+
style: Ye,
|
|
2025
|
+
zIndex: Ge = 2147483647
|
|
2026
|
+
} = e, Xe = $n(G), fe = Fn(Xe, T, W);
|
|
2013
2027
|
N(() => {
|
|
2014
2028
|
yr(), kr();
|
|
2015
|
-
}, [
|
|
2016
|
-
const
|
|
2029
|
+
}, [Xe]);
|
|
2030
|
+
const ye = _ !== void 0, [ie, ct] = C(() => {
|
|
2017
2031
|
var g;
|
|
2018
2032
|
return _ ?? ((g = w == null ? void 0 : w[0]) == null ? void 0 : g.id);
|
|
2019
|
-
}),
|
|
2020
|
-
() => (w == null ? void 0 : w.find((g) => g.id ===
|
|
2021
|
-
[w,
|
|
2022
|
-
),
|
|
2033
|
+
}), pe = ye ? _ : ie, Y = He(
|
|
2034
|
+
() => (w == null ? void 0 : w.find((g) => g.id === pe)) ?? null,
|
|
2035
|
+
[w, pe]
|
|
2036
|
+
), Je = (Y == null ? void 0 : Y.agentId) ?? t, [ve, he] = Mn({
|
|
2023
2037
|
value: u,
|
|
2024
|
-
defaultValue:
|
|
2038
|
+
defaultValue: h,
|
|
2025
2039
|
onChange: m,
|
|
2026
2040
|
persistKey: R,
|
|
2027
2041
|
disablePersistence: q
|
|
2028
|
-
}),
|
|
2029
|
-
|
|
2030
|
-
const
|
|
2031
|
-
|
|
2032
|
-
function
|
|
2033
|
-
const
|
|
2034
|
-
return
|
|
2042
|
+
}), ke = Pn(s), Ie = wn(), Z = _n(), ne = kn(), oe = Ln(), be = Sn(), [Me, Te] = C(!1), [Oe, Ke] = C(!1), [le, ae] = C(!1), [Qe, Ze] = C(!1), [qe, et] = C(!1), f = jn({ baseUrl: i, config: c }), U = E(f);
|
|
2043
|
+
U.current = f;
|
|
2044
|
+
const tt = E(re), dt = E(te), ut = E(de), ft = E(K), wt = E(xe), _t = E(ce), xt = E(ge), pt = E(ue), se = E(null);
|
|
2045
|
+
tt.current = re, dt.current = te, ut.current = de, ft.current = K, wt.current = xe, _t.current = ce, xt.current = ge, pt.current = ue;
|
|
2046
|
+
function we(g) {
|
|
2047
|
+
const p = pt.current;
|
|
2048
|
+
return p ? p.includes(g) : !0;
|
|
2035
2049
|
}
|
|
2036
|
-
function
|
|
2050
|
+
function _e(g, p) {
|
|
2037
2051
|
console.warn(
|
|
2038
|
-
`[LiveLayer] Agent command "${g}" blocked — capability "${
|
|
2052
|
+
`[LiveLayer] Agent command "${g}" blocked — capability "${p}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
|
|
2039
2053
|
);
|
|
2040
2054
|
}
|
|
2041
|
-
const
|
|
2055
|
+
const Be = k(
|
|
2042
2056
|
(g) => {
|
|
2043
|
-
var ee,
|
|
2044
|
-
const
|
|
2045
|
-
if (!(!
|
|
2046
|
-
if (
|
|
2047
|
-
if (!
|
|
2048
|
-
|
|
2057
|
+
var ee, rt, it, Tt;
|
|
2058
|
+
const p = g;
|
|
2059
|
+
if (!(!p.type || typeof p.type != "string")) {
|
|
2060
|
+
if (Ae == null || Ae({ eventName: p.type, data: g }), p.type === "navigate") {
|
|
2061
|
+
if (!we("navigate")) {
|
|
2062
|
+
_e("navigate", "navigate");
|
|
2049
2063
|
return;
|
|
2050
2064
|
}
|
|
2051
|
-
const L = typeof
|
|
2065
|
+
const L = typeof p.href == "string" ? p.href : null;
|
|
2052
2066
|
if (!L) {
|
|
2053
2067
|
console.warn(
|
|
2054
2068
|
`[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
|
|
2055
2069
|
);
|
|
2056
2070
|
return;
|
|
2057
2071
|
}
|
|
2058
|
-
if (
|
|
2072
|
+
if (U.current.playPageChange(), tt.current) {
|
|
2059
2073
|
try {
|
|
2060
|
-
|
|
2074
|
+
tt.current(L);
|
|
2061
2075
|
} catch (I) {
|
|
2062
2076
|
console.warn(
|
|
2063
2077
|
`[LiveLayer] onNavigate threw for "${L}". Falling back. Error:`,
|
|
@@ -2086,14 +2100,14 @@ function Mr(e) {
|
|
|
2086
2100
|
}
|
|
2087
2101
|
return;
|
|
2088
2102
|
}
|
|
2089
|
-
if (
|
|
2090
|
-
if (!
|
|
2091
|
-
|
|
2103
|
+
if (p.type === "scroll_to") {
|
|
2104
|
+
if (!we("scroll")) {
|
|
2105
|
+
_e("scroll_to", "scroll");
|
|
2092
2106
|
return;
|
|
2093
2107
|
}
|
|
2094
|
-
const L = typeof
|
|
2108
|
+
const L = typeof p.selector == "string" ? p.selector : null;
|
|
2095
2109
|
if (!L) return;
|
|
2096
|
-
const I =
|
|
2110
|
+
const I = p.behavior === "instant" ? "instant" : "smooth";
|
|
2097
2111
|
if (dt.current) {
|
|
2098
2112
|
try {
|
|
2099
2113
|
dt.current(
|
|
@@ -2128,26 +2142,26 @@ function Mr(e) {
|
|
|
2128
2142
|
}
|
|
2129
2143
|
return;
|
|
2130
2144
|
}
|
|
2131
|
-
if (
|
|
2132
|
-
if (!
|
|
2133
|
-
|
|
2145
|
+
if (p.type === "request_page_context") {
|
|
2146
|
+
if (!we("read_page")) {
|
|
2147
|
+
_e("request_page_context", "read_page");
|
|
2134
2148
|
return;
|
|
2135
2149
|
}
|
|
2136
|
-
const L = typeof
|
|
2150
|
+
const L = typeof p.requestId == "string" ? p.requestId : void 0, I = (ee = se.current) == null ? void 0 : ee.call(se), O = (j) => {
|
|
2137
2151
|
const P = I, J = P == null ? void 0 : P.localParticipant;
|
|
2138
2152
|
if (J != null && J.publishData)
|
|
2139
2153
|
try {
|
|
2140
|
-
const
|
|
2141
|
-
J.publishData(
|
|
2142
|
-
} catch (
|
|
2143
|
-
console.warn("[LiveLayer] publishData failed.",
|
|
2154
|
+
const Q = L ? { ...j, requestId: L } : j, Pe = new TextEncoder().encode(JSON.stringify(Q));
|
|
2155
|
+
J.publishData(Pe, { reliable: !0 });
|
|
2156
|
+
} catch (Q) {
|
|
2157
|
+
console.warn("[LiveLayer] publishData failed.", Q);
|
|
2144
2158
|
}
|
|
2145
2159
|
}, $ = _t.current, F = wt.current;
|
|
2146
2160
|
try {
|
|
2147
2161
|
if (F) {
|
|
2148
|
-
const
|
|
2149
|
-
if (
|
|
2150
|
-
O({ type: "page_context_pending" }),
|
|
2162
|
+
const j = F($);
|
|
2163
|
+
if (j instanceof Promise) {
|
|
2164
|
+
O({ type: "page_context_pending" }), j.then((P) => O({ type: "page_context", context: P })).catch((P) => {
|
|
2151
2165
|
console.warn(
|
|
2152
2166
|
"[LiveLayer] getPageContext rejected; falling back to default walker.",
|
|
2153
2167
|
P
|
|
@@ -2158,17 +2172,17 @@ function Mr(e) {
|
|
|
2158
2172
|
});
|
|
2159
2173
|
return;
|
|
2160
2174
|
}
|
|
2161
|
-
O({ type: "page_context", context:
|
|
2175
|
+
O({ type: "page_context", context: j });
|
|
2162
2176
|
return;
|
|
2163
2177
|
}
|
|
2164
2178
|
O({
|
|
2165
2179
|
type: "page_context",
|
|
2166
2180
|
context: Gt($)
|
|
2167
2181
|
});
|
|
2168
|
-
} catch (
|
|
2182
|
+
} catch (j) {
|
|
2169
2183
|
console.warn(
|
|
2170
2184
|
"[LiveLayer] page-context extraction threw. Sending empty context.",
|
|
2171
|
-
|
|
2185
|
+
j
|
|
2172
2186
|
), O({
|
|
2173
2187
|
type: "page_context",
|
|
2174
2188
|
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: $ }
|
|
@@ -2176,19 +2190,19 @@ function Mr(e) {
|
|
|
2176
2190
|
}
|
|
2177
2191
|
return;
|
|
2178
2192
|
}
|
|
2179
|
-
if (
|
|
2180
|
-
if (!
|
|
2181
|
-
|
|
2193
|
+
if (p.type === "scroll_page") {
|
|
2194
|
+
if (!we("scroll")) {
|
|
2195
|
+
_e("scroll_page", "scroll");
|
|
2182
2196
|
return;
|
|
2183
2197
|
}
|
|
2184
|
-
const L =
|
|
2198
|
+
const L = p.direction;
|
|
2185
2199
|
if (L !== "up" && L !== "down" && L !== "top" && L !== "bottom") {
|
|
2186
2200
|
console.warn(
|
|
2187
2201
|
`[LiveLayer] scroll_page: invalid direction "${String(L)}". Expected up | down | top | bottom.`
|
|
2188
2202
|
);
|
|
2189
2203
|
return;
|
|
2190
2204
|
}
|
|
2191
|
-
const I =
|
|
2205
|
+
const I = p.behavior === "instant" ? "instant" : "smooth";
|
|
2192
2206
|
if (ut.current) {
|
|
2193
2207
|
try {
|
|
2194
2208
|
ut.current(
|
|
@@ -2203,18 +2217,18 @@ function Mr(e) {
|
|
|
2203
2217
|
if (typeof window > "u") return;
|
|
2204
2218
|
const O = { behavior: I }, $ = Ar(), F = (P) => {
|
|
2205
2219
|
$ instanceof Window ? $.scrollBy({ top: P, ...O }) : $.scrollBy({ top: P, ...O });
|
|
2206
|
-
},
|
|
2220
|
+
}, j = (P) => {
|
|
2207
2221
|
$ instanceof Window ? $.scrollTo({ top: P, ...O }) : $.scrollTo({ top: P, ...O });
|
|
2208
2222
|
};
|
|
2209
|
-
L === "up" ? F(-Xt($)) : L === "down" ? F(Xt($)) :
|
|
2223
|
+
L === "up" ? F(-Xt($)) : L === "down" ? F(Xt($)) : j(L === "top" ? 0 : Rr($));
|
|
2210
2224
|
return;
|
|
2211
2225
|
}
|
|
2212
|
-
if (
|
|
2213
|
-
if (!
|
|
2214
|
-
|
|
2226
|
+
if (p.type === "click") {
|
|
2227
|
+
if (!we("click")) {
|
|
2228
|
+
_e("click", "click");
|
|
2215
2229
|
return;
|
|
2216
2230
|
}
|
|
2217
|
-
const L = typeof
|
|
2231
|
+
const L = typeof p.selector == "string" ? p.selector : null;
|
|
2218
2232
|
if (!L) {
|
|
2219
2233
|
console.warn("[LiveLayer] click: missing selector.");
|
|
2220
2234
|
return;
|
|
@@ -2249,19 +2263,19 @@ function Mr(e) {
|
|
|
2249
2263
|
);
|
|
2250
2264
|
return;
|
|
2251
2265
|
}
|
|
2252
|
-
(
|
|
2266
|
+
(rt = I.click) == null || rt.call(I);
|
|
2253
2267
|
return;
|
|
2254
2268
|
}
|
|
2255
|
-
if (
|
|
2256
|
-
if (!
|
|
2257
|
-
|
|
2269
|
+
if (p.type === "fill_form" || p.type === "focus_field") {
|
|
2270
|
+
if (!we("fill_forms")) {
|
|
2271
|
+
_e(p.type, "fill_forms");
|
|
2258
2272
|
return;
|
|
2259
2273
|
}
|
|
2260
2274
|
if (typeof document > "u") return;
|
|
2261
|
-
|
|
2262
|
-
const L = typeof
|
|
2275
|
+
p.type === "fill_form" && U.current.playConfirmation();
|
|
2276
|
+
const L = typeof p.formId == "string" ? p.formId : null;
|
|
2263
2277
|
if (!L) {
|
|
2264
|
-
console.warn(`[LiveLayer] ${
|
|
2278
|
+
console.warn(`[LiveLayer] ${p.type}: missing formId.`);
|
|
2265
2279
|
return;
|
|
2266
2280
|
}
|
|
2267
2281
|
const I = document.querySelector(
|
|
@@ -2269,18 +2283,18 @@ function Mr(e) {
|
|
|
2269
2283
|
);
|
|
2270
2284
|
if (!I) {
|
|
2271
2285
|
console.warn(
|
|
2272
|
-
`[LiveLayer] ${
|
|
2286
|
+
`[LiveLayer] ${p.type}: no form with data-ll-form="${L}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
|
|
2273
2287
|
);
|
|
2274
2288
|
return;
|
|
2275
2289
|
}
|
|
2276
2290
|
if (I.closest('[data-ll-private="true"], .ll-widget')) {
|
|
2277
2291
|
console.warn(
|
|
2278
|
-
`[LiveLayer] ${
|
|
2292
|
+
`[LiveLayer] ${p.type}: refusing to touch a form in a private subtree.`
|
|
2279
2293
|
);
|
|
2280
2294
|
return;
|
|
2281
2295
|
}
|
|
2282
|
-
if (
|
|
2283
|
-
const $ = typeof
|
|
2296
|
+
if (p.type === "focus_field") {
|
|
2297
|
+
const $ = typeof p.fieldName == "string" ? p.fieldName : null;
|
|
2284
2298
|
if (!$) {
|
|
2285
2299
|
console.warn("[LiveLayer] focus_field: missing fieldName.");
|
|
2286
2300
|
return;
|
|
@@ -2292,7 +2306,7 @@ function Mr(e) {
|
|
|
2292
2306
|
);
|
|
2293
2307
|
return;
|
|
2294
2308
|
}
|
|
2295
|
-
if (!
|
|
2309
|
+
if (!st(F)) {
|
|
2296
2310
|
console.warn(
|
|
2297
2311
|
`[LiveLayer] focus_field: field "${$}" is privacy-protected and not focusable.`
|
|
2298
2312
|
);
|
|
@@ -2301,28 +2315,28 @@ function Mr(e) {
|
|
|
2301
2315
|
F.focus();
|
|
2302
2316
|
return;
|
|
2303
2317
|
}
|
|
2304
|
-
const O =
|
|
2318
|
+
const O = p.values && typeof p.values == "object" ? p.values : null;
|
|
2305
2319
|
if (!O) {
|
|
2306
2320
|
console.warn("[LiveLayer] fill_form: missing or invalid values.");
|
|
2307
2321
|
return;
|
|
2308
2322
|
}
|
|
2309
2323
|
for (const [$, F] of Object.entries(O)) {
|
|
2310
2324
|
if (typeof F != "string") continue;
|
|
2311
|
-
const
|
|
2312
|
-
if (!
|
|
2325
|
+
const j = I.querySelector(`[data-ll-field="${$.replace(/"/g, '\\"')}"]`);
|
|
2326
|
+
if (!j) {
|
|
2313
2327
|
console.warn(
|
|
2314
2328
|
`[LiveLayer] fill_form: no field "${$}" in form "${L}". Skipping.`
|
|
2315
2329
|
);
|
|
2316
2330
|
continue;
|
|
2317
2331
|
}
|
|
2318
|
-
if (!
|
|
2332
|
+
if (!st(j)) {
|
|
2319
2333
|
console.warn(
|
|
2320
2334
|
`[LiveLayer] fill_form: field "${$}" is privacy-protected (password / cc-* / private). Skipping.`
|
|
2321
2335
|
);
|
|
2322
2336
|
continue;
|
|
2323
2337
|
}
|
|
2324
2338
|
try {
|
|
2325
|
-
Sr(
|
|
2339
|
+
Sr(j, F);
|
|
2326
2340
|
} catch (P) {
|
|
2327
2341
|
console.warn(
|
|
2328
2342
|
`[LiveLayer] fill_form: failed to set "${$}".`,
|
|
@@ -2332,18 +2346,18 @@ function Mr(e) {
|
|
|
2332
2346
|
}
|
|
2333
2347
|
return;
|
|
2334
2348
|
}
|
|
2335
|
-
if (
|
|
2336
|
-
if (!
|
|
2337
|
-
|
|
2349
|
+
if (p.type === "submit_form") {
|
|
2350
|
+
if (!we("submit_forms")) {
|
|
2351
|
+
_e("submit_form", "submit_forms");
|
|
2338
2352
|
return;
|
|
2339
2353
|
}
|
|
2340
2354
|
if (typeof document > "u") return;
|
|
2341
|
-
const L = typeof
|
|
2355
|
+
const L = typeof p.formId == "string" ? p.formId : null;
|
|
2342
2356
|
if (!L) {
|
|
2343
2357
|
console.warn("[LiveLayer] submit_form: missing formId.");
|
|
2344
2358
|
return;
|
|
2345
2359
|
}
|
|
2346
|
-
|
|
2360
|
+
U.current.playConfirmation();
|
|
2347
2361
|
const I = document.querySelector(
|
|
2348
2362
|
`[data-ll-form="${L.replace(/"/g, '\\"')}"]`
|
|
2349
2363
|
);
|
|
@@ -2359,18 +2373,18 @@ function Mr(e) {
|
|
|
2359
2373
|
);
|
|
2360
2374
|
return;
|
|
2361
2375
|
}
|
|
2362
|
-
const O = typeof
|
|
2363
|
-
const
|
|
2364
|
-
if (
|
|
2376
|
+
const O = typeof p.requestId == "string" ? p.requestId : void 0, $ = (it = se.current) == null ? void 0 : it.call(se), F = (J) => {
|
|
2377
|
+
const Q = $, Pe = Q == null ? void 0 : Q.localParticipant;
|
|
2378
|
+
if (Pe != null && Pe.publishData)
|
|
2365
2379
|
try {
|
|
2366
2380
|
const un = O ? { ...J, requestId: O } : J, fn = new TextEncoder().encode(JSON.stringify(un));
|
|
2367
|
-
|
|
2381
|
+
Pe.publishData(fn, { reliable: !0 });
|
|
2368
2382
|
} catch {
|
|
2369
2383
|
}
|
|
2370
2384
|
};
|
|
2371
|
-
let
|
|
2385
|
+
let j = !1;
|
|
2372
2386
|
const P = () => {
|
|
2373
|
-
|
|
2387
|
+
j = !0, F({ type: "form_submitted", formId: L });
|
|
2374
2388
|
};
|
|
2375
2389
|
I.addEventListener("submit", P, { once: !0 });
|
|
2376
2390
|
try {
|
|
@@ -2384,7 +2398,7 @@ function Mr(e) {
|
|
|
2384
2398
|
return;
|
|
2385
2399
|
}
|
|
2386
2400
|
setTimeout(() => {
|
|
2387
|
-
|
|
2401
|
+
j || (I.removeEventListener("submit", P), F({
|
|
2388
2402
|
type: "form_submit_blocked",
|
|
2389
2403
|
formId: L,
|
|
2390
2404
|
reason: "validation"
|
|
@@ -2392,34 +2406,34 @@ function Mr(e) {
|
|
|
2392
2406
|
}, 500);
|
|
2393
2407
|
return;
|
|
2394
2408
|
}
|
|
2395
|
-
if (
|
|
2396
|
-
if (!
|
|
2397
|
-
|
|
2409
|
+
if (p.type === "request_routes") {
|
|
2410
|
+
if (!we("read_page")) {
|
|
2411
|
+
_e("request_routes", "read_page");
|
|
2398
2412
|
return;
|
|
2399
2413
|
}
|
|
2400
|
-
const L = typeof
|
|
2414
|
+
const L = typeof p.requestId == "string" ? p.requestId : void 0, O = (Tt = se.current) == null ? void 0 : Tt.call(se), $ = O == null ? void 0 : O.localParticipant;
|
|
2401
2415
|
if (!($ != null && $.publishData)) return;
|
|
2402
2416
|
const F = (P) => {
|
|
2403
2417
|
try {
|
|
2404
|
-
const J = L ? { type: "routes", routes: P, requestId: L } : { type: "routes", routes: P },
|
|
2405
|
-
$.publishData(
|
|
2418
|
+
const J = L ? { type: "routes", routes: P, requestId: L } : { type: "routes", routes: P }, Q = new TextEncoder().encode(JSON.stringify(J));
|
|
2419
|
+
$.publishData(Q, { reliable: !0 });
|
|
2406
2420
|
} catch (J) {
|
|
2407
2421
|
console.warn("[LiveLayer] request_routes: publishData failed.", J);
|
|
2408
2422
|
}
|
|
2409
|
-
},
|
|
2410
|
-
if (
|
|
2423
|
+
}, j = xt.current;
|
|
2424
|
+
if (j) {
|
|
2411
2425
|
try {
|
|
2412
|
-
const P =
|
|
2413
|
-
if (!Array.isArray(
|
|
2426
|
+
const P = j(), J = (Q) => {
|
|
2427
|
+
if (!Array.isArray(Q)) {
|
|
2414
2428
|
F([]);
|
|
2415
2429
|
return;
|
|
2416
2430
|
}
|
|
2417
|
-
F(
|
|
2431
|
+
F(Q.map(br).slice(0, 200));
|
|
2418
2432
|
};
|
|
2419
|
-
P instanceof Promise ? P.then(J).catch((
|
|
2433
|
+
P instanceof Promise ? P.then(J).catch((Q) => {
|
|
2420
2434
|
console.warn(
|
|
2421
2435
|
"[LiveLayer] getRoutes rejected; falling back to DOM walker.",
|
|
2422
|
-
|
|
2436
|
+
Q
|
|
2423
2437
|
), F(mt());
|
|
2424
2438
|
}) : J(P);
|
|
2425
2439
|
} catch (P) {
|
|
@@ -2437,22 +2451,22 @@ function Mr(e) {
|
|
|
2437
2451
|
}
|
|
2438
2452
|
return;
|
|
2439
2453
|
}
|
|
2440
|
-
Ir.has(
|
|
2454
|
+
Ir.has(p.type) || Re == null || Re(p);
|
|
2441
2455
|
}
|
|
2442
2456
|
},
|
|
2443
|
-
[
|
|
2457
|
+
[Re, Ae]
|
|
2444
2458
|
), X = bn({
|
|
2445
|
-
agentId:
|
|
2459
|
+
agentId: V ? "__controlled__" : Je,
|
|
2446
2460
|
baseUrl: i,
|
|
2447
2461
|
apiKey: r,
|
|
2448
2462
|
sessionEndpoint: o,
|
|
2449
2463
|
sessionBody: l,
|
|
2450
|
-
onDataMessage:
|
|
2464
|
+
onDataMessage: V ? void 0 : Be
|
|
2451
2465
|
});
|
|
2452
2466
|
N(() => {
|
|
2453
|
-
if (
|
|
2454
|
-
return
|
|
2455
|
-
}, [
|
|
2467
|
+
if (V != null && V.subscribeToDataMessages)
|
|
2468
|
+
return V.subscribeToDataMessages(Be);
|
|
2469
|
+
}, [V, Be]), se.current = () => {
|
|
2456
2470
|
var g;
|
|
2457
2471
|
return (g = X.getRoom) == null ? void 0 : g.call(X);
|
|
2458
2472
|
}, N(() => {
|
|
@@ -2460,29 +2474,29 @@ function Mr(e) {
|
|
|
2460
2474
|
if (typeof window > "u") return;
|
|
2461
2475
|
const g = ((ee = window.location) == null ? void 0 : ee.hostname) || "";
|
|
2462
2476
|
if (g === "localhost" || g === "127.0.0.1" || g === "0.0.0.0" || g.endsWith(".local") || g.endsWith(".test"))
|
|
2463
|
-
return window.__livelayerSimulateCommand = (
|
|
2477
|
+
return window.__livelayerSimulateCommand = (rt) => {
|
|
2464
2478
|
try {
|
|
2465
|
-
|
|
2466
|
-
} catch (
|
|
2467
|
-
console.warn("[LiveLayer] simulate-command threw:",
|
|
2479
|
+
Be(rt);
|
|
2480
|
+
} catch (it) {
|
|
2481
|
+
console.warn("[LiveLayer] simulate-command threw:", it);
|
|
2468
2482
|
}
|
|
2469
2483
|
}, () => {
|
|
2470
2484
|
delete window.__livelayerSimulateCommand;
|
|
2471
2485
|
};
|
|
2472
|
-
}, [
|
|
2473
|
-
const b =
|
|
2474
|
-
connectionState:
|
|
2475
|
-
agentState:
|
|
2476
|
-
transcript:
|
|
2477
|
-
videoElement:
|
|
2478
|
-
audioElement:
|
|
2479
|
-
canResume:
|
|
2480
|
-
error:
|
|
2486
|
+
}, [Be]);
|
|
2487
|
+
const b = He(() => V ? {
|
|
2488
|
+
connectionState: V.connectionState,
|
|
2489
|
+
agentState: V.agentState,
|
|
2490
|
+
transcript: V.transcript,
|
|
2491
|
+
videoElement: V.videoElement,
|
|
2492
|
+
audioElement: V.audioElement,
|
|
2493
|
+
canResume: V.canResume,
|
|
2494
|
+
error: V.error,
|
|
2481
2495
|
agentConfig: null,
|
|
2482
2496
|
connect: async () => {
|
|
2483
|
-
await
|
|
2497
|
+
await V.onConnect();
|
|
2484
2498
|
},
|
|
2485
|
-
disconnect: () =>
|
|
2499
|
+
disconnect: () => V.onDisconnect(),
|
|
2486
2500
|
// Dummy getRoom for shape compatibility — controlled consumers own the Room.
|
|
2487
2501
|
// Internal session's getRoom returns null when no real connect has happened,
|
|
2488
2502
|
// so we reuse its reference for type consistency.
|
|
@@ -2501,194 +2515,194 @@ function Mr(e) {
|
|
|
2501
2515
|
disconnect: X.disconnect,
|
|
2502
2516
|
getRoom: X.getRoom,
|
|
2503
2517
|
isControlled: !1
|
|
2504
|
-
}, [
|
|
2518
|
+
}, [V, X]), kt = E(null);
|
|
2505
2519
|
N(() => {
|
|
2506
|
-
const g = b.videoElement,
|
|
2507
|
-
if (!(!g || !
|
|
2508
|
-
return
|
|
2509
|
-
g.parentNode ===
|
|
2520
|
+
const g = b.videoElement, p = kt.current;
|
|
2521
|
+
if (!(!g || !p))
|
|
2522
|
+
return p.appendChild(g), () => {
|
|
2523
|
+
g.parentNode === p && p.removeChild(g);
|
|
2510
2524
|
};
|
|
2511
2525
|
}, [b.videoElement]), N(() => {
|
|
2512
2526
|
const g = b.audioElement;
|
|
2513
2527
|
if (!g) return;
|
|
2514
|
-
|
|
2515
|
-
const
|
|
2516
|
-
return
|
|
2517
|
-
(ee == null ? void 0 : ee.name) === "NotAllowedError" &&
|
|
2528
|
+
Ie.attach(g);
|
|
2529
|
+
const p = g.play();
|
|
2530
|
+
return p && typeof p.catch == "function" && p.catch((ee) => {
|
|
2531
|
+
(ee == null ? void 0 : ee.name) === "NotAllowedError" && Te(!0);
|
|
2518
2532
|
}), () => {
|
|
2519
|
-
|
|
2533
|
+
Ie.detach();
|
|
2520
2534
|
};
|
|
2521
2535
|
}, [b.audioElement]), N(() => {
|
|
2522
2536
|
if (b.isControlled || b.connectionState !== "connected") return;
|
|
2523
2537
|
const g = b.getRoom();
|
|
2524
2538
|
if (g)
|
|
2525
|
-
return
|
|
2526
|
-
}), ne.attachRoom(g),
|
|
2527
|
-
|
|
2539
|
+
return Z.setupMic(g).catch(() => {
|
|
2540
|
+
}), ne.attachRoom(g), oe.attachRoom(g), be.refresh(), () => {
|
|
2541
|
+
Z.teardownMic(), ne.teardown(), oe.teardown();
|
|
2528
2542
|
};
|
|
2529
2543
|
}, [b.isControlled, b.connectionState]), N(() => {
|
|
2530
2544
|
const g = b.audioElement;
|
|
2531
|
-
g && (g.muted =
|
|
2532
|
-
}, [b.audioElement,
|
|
2545
|
+
g && (g.muted = qe);
|
|
2546
|
+
}, [b.audioElement, qe]);
|
|
2533
2547
|
const Zt = k((g) => {
|
|
2534
|
-
const
|
|
2535
|
-
if (
|
|
2548
|
+
const p = b.getRoom();
|
|
2549
|
+
if (p)
|
|
2536
2550
|
try {
|
|
2537
2551
|
const ee = new TextEncoder().encode(
|
|
2538
2552
|
JSON.stringify({ type: "user_message", text: g })
|
|
2539
2553
|
);
|
|
2540
|
-
|
|
2554
|
+
p.localParticipant.publishData(ee, { reliable: !0 });
|
|
2541
2555
|
} catch {
|
|
2542
2556
|
}
|
|
2543
2557
|
}, [b]), en = k(() => {
|
|
2544
|
-
|
|
2558
|
+
et((g) => !g);
|
|
2545
2559
|
}, []);
|
|
2546
2560
|
N(() => {
|
|
2547
|
-
|
|
2548
|
-
}, [b.connectionState,
|
|
2549
|
-
|
|
2550
|
-
}, [b.transcript,
|
|
2551
|
-
|
|
2552
|
-
}, [b.agentState,
|
|
2553
|
-
|
|
2554
|
-
}, [b.agentState,
|
|
2561
|
+
Ne == null || Ne(b.connectionState), b.connectionState === "connected" ? Le == null || Le() : b.connectionState === "disconnected" && (Se == null || Se());
|
|
2562
|
+
}, [b.connectionState, Le, Se, Ne]), N(() => {
|
|
2563
|
+
Ce == null || Ce(b.transcript);
|
|
2564
|
+
}, [b.transcript, Ce]), N(() => {
|
|
2565
|
+
Ee == null || Ee(b.agentState);
|
|
2566
|
+
}, [b.agentState, Ee]), N(() => {
|
|
2567
|
+
f.setThinking(b.agentState === "thinking");
|
|
2568
|
+
}, [b.agentState, f]);
|
|
2555
2569
|
const Lt = E(!1);
|
|
2556
2570
|
N(() => {
|
|
2557
|
-
b.isControlled || !d || Lt.current ||
|
|
2558
|
-
}, [d, b.connectionState, b,
|
|
2571
|
+
b.isControlled || !d || Lt.current || fe && b.connectionState === "idle" && (Lt.current = !0, b.connect());
|
|
2572
|
+
}, [d, b.connectionState, b, fe]);
|
|
2559
2573
|
const tn = k(
|
|
2560
2574
|
(g) => {
|
|
2561
|
-
const
|
|
2562
|
-
|
|
2575
|
+
const p = w == null ? void 0 : w.find((ee) => ee.id === g);
|
|
2576
|
+
p && (ae(!1), g !== pe && (Ke(!0), b.disconnect(), ye || ct(g), y == null || y(p)));
|
|
2563
2577
|
},
|
|
2564
2578
|
[
|
|
2565
2579
|
w,
|
|
2566
|
-
|
|
2580
|
+
pe,
|
|
2567
2581
|
b,
|
|
2568
|
-
|
|
2582
|
+
ye,
|
|
2569
2583
|
y
|
|
2570
2584
|
]
|
|
2571
2585
|
);
|
|
2572
2586
|
N(() => {
|
|
2573
|
-
|
|
2574
|
-
}, [b.connectionState,
|
|
2575
|
-
if (!
|
|
2576
|
-
const g = (
|
|
2577
|
-
|
|
2587
|
+
Oe && b.connectionState === "connected" && Ke(!1);
|
|
2588
|
+
}, [b.connectionState, Oe]), N(() => {
|
|
2589
|
+
if (!le) return;
|
|
2590
|
+
const g = (p) => {
|
|
2591
|
+
p.key === "Escape" && ae(!1);
|
|
2578
2592
|
};
|
|
2579
2593
|
return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
|
|
2580
|
-
}, [
|
|
2581
|
-
const nn = !!H || !!(Y != null && Y.avatarImageUrl) || b.isControlled,
|
|
2582
|
-
ue === void 0 && ((Ct =
|
|
2583
|
-
const
|
|
2584
|
-
() =>
|
|
2585
|
-
[
|
|
2594
|
+
}, [le]);
|
|
2595
|
+
const nn = !!H || !!(Y != null && Y.avatarImageUrl) || b.isControlled, We = Cn(Je, i, nn);
|
|
2596
|
+
ue === void 0 && ((Ct = We.info) != null && Ct.capabilities) && (pt.current = We.info.capabilities);
|
|
2597
|
+
const nt = (Y == null ? void 0 : Y.name) ?? v ?? ((Et = b.agentConfig) == null ? void 0 : Et.name) ?? ((Nt = We.info) == null ? void 0 : Nt.name) ?? "Live Layer", ht = (Y == null ? void 0 : Y.avatarImageUrl) ?? H ?? ((At = b.agentConfig) == null ? void 0 : At.avatarImageUrl) ?? ((Rt = We.info) == null ? void 0 : Rt.avatarImageUrl) ?? null, rn = z ?? ((It = b.agentConfig) == null ? void 0 : It.idleLoopUrl) ?? ((Mt = We.info) == null ? void 0 : Mt.idleLoopUrl) ?? null, on = M ?? null, ln = k(() => he("expanded"), [he]), an = k(
|
|
2598
|
+
() => he("minimized"),
|
|
2599
|
+
[he]
|
|
2586
2600
|
), St = k(() => {
|
|
2587
|
-
b.disconnect(),
|
|
2588
|
-
}, [b,
|
|
2601
|
+
b.disconnect(), he("hidden");
|
|
2602
|
+
}, [b, he]), sn = k(() => {
|
|
2589
2603
|
const g = b.audioElement;
|
|
2590
|
-
g && g.play().then(() =>
|
|
2604
|
+
g && g.play().then(() => Te(!1)).catch(() => {
|
|
2591
2605
|
});
|
|
2592
|
-
}, [b.audioElement]),
|
|
2593
|
-
|
|
2594
|
-
}, [b]),
|
|
2595
|
-
...
|
|
2596
|
-
zIndex:
|
|
2606
|
+
}, [b.audioElement]), cn = k(() => {
|
|
2607
|
+
Te(!1), b.connect();
|
|
2608
|
+
}, [b]), Fe = {
|
|
2609
|
+
...Ye,
|
|
2610
|
+
zIndex: Ge
|
|
2597
2611
|
};
|
|
2598
|
-
S.primaryColor && (
|
|
2612
|
+
S.primaryColor && (Fe["--ll-color-primary"] = S.primaryColor), S.accentColor && (Fe["--ll-color-accent"] = S.accentColor), S.backgroundColor && (Fe["--ll-color-bg"] = S.backgroundColor), S.textColor && (Fe["--ll-color-fg"] = S.textColor);
|
|
2599
2613
|
const dn = [
|
|
2600
2614
|
"ll-widget",
|
|
2601
|
-
`ll-widget--${
|
|
2602
|
-
`ll-widget--${
|
|
2603
|
-
|
|
2615
|
+
`ll-widget--${ve}`,
|
|
2616
|
+
`ll-widget--${ke ? "mobile" : "desktop"}`,
|
|
2617
|
+
Ve
|
|
2604
2618
|
].filter(Boolean).join(" ");
|
|
2605
|
-
return
|
|
2619
|
+
return fe ? /* @__PURE__ */ x(
|
|
2606
2620
|
"div",
|
|
2607
2621
|
{
|
|
2608
2622
|
className: dn,
|
|
2609
|
-
style:
|
|
2610
|
-
"data-display-mode":
|
|
2623
|
+
style: Fe,
|
|
2624
|
+
"data-display-mode": ve,
|
|
2611
2625
|
"data-position": a,
|
|
2612
2626
|
children: [
|
|
2613
|
-
|
|
2627
|
+
ve === "hidden" && /* @__PURE__ */ n(
|
|
2614
2628
|
Kn,
|
|
2615
2629
|
{
|
|
2616
2630
|
position: a,
|
|
2617
|
-
isMobile:
|
|
2631
|
+
isMobile: ke,
|
|
2618
2632
|
isSpeaking: b.agentState === "speaking",
|
|
2619
|
-
onExpand: () =>
|
|
2620
|
-
label: `Open ${
|
|
2633
|
+
onExpand: () => he("expanded"),
|
|
2634
|
+
label: `Open ${nt} widget`,
|
|
2621
2635
|
avatarImageUrl: ht,
|
|
2622
|
-
agentName:
|
|
2636
|
+
agentName: nt
|
|
2623
2637
|
}
|
|
2624
2638
|
),
|
|
2625
|
-
|
|
2639
|
+
ve === "minimized" && /* @__PURE__ */ n(
|
|
2626
2640
|
Zn,
|
|
2627
2641
|
{
|
|
2628
2642
|
position: a,
|
|
2629
|
-
isMobile:
|
|
2630
|
-
agentName:
|
|
2643
|
+
isMobile: ke,
|
|
2644
|
+
agentName: nt,
|
|
2631
2645
|
avatarImageUrl: ht,
|
|
2632
2646
|
agentState: b.agentState,
|
|
2633
|
-
isMuted:
|
|
2634
|
-
audioLevel:
|
|
2647
|
+
isMuted: Z.isMuted,
|
|
2648
|
+
audioLevel: Ie,
|
|
2635
2649
|
onExpand: ln,
|
|
2636
|
-
onToggleMute:
|
|
2650
|
+
onToggleMute: Z.toggleMute,
|
|
2637
2651
|
onClose: St
|
|
2638
2652
|
}
|
|
2639
2653
|
),
|
|
2640
|
-
|
|
2654
|
+
ve === "expanded" && /* @__PURE__ */ n(
|
|
2641
2655
|
tr,
|
|
2642
2656
|
{
|
|
2643
2657
|
position: a,
|
|
2644
|
-
isMobile:
|
|
2645
|
-
agentName:
|
|
2658
|
+
isMobile: ke,
|
|
2659
|
+
agentName: nt,
|
|
2646
2660
|
avatarImageUrl: ht,
|
|
2647
2661
|
idleLoopUrl: rn,
|
|
2648
2662
|
greeting: on,
|
|
2649
2663
|
branding: S,
|
|
2650
2664
|
teamMembers: w,
|
|
2651
|
-
currentTeamMemberId:
|
|
2652
|
-
isSwitchingTeamMember:
|
|
2653
|
-
teamSwitcherOpen:
|
|
2654
|
-
onToggleTeamSwitcher: () =>
|
|
2665
|
+
currentTeamMemberId: pe,
|
|
2666
|
+
isSwitchingTeamMember: Oe,
|
|
2667
|
+
teamSwitcherOpen: le,
|
|
2668
|
+
onToggleTeamSwitcher: () => ae((g) => !g),
|
|
2655
2669
|
onSelectTeamMember: tn,
|
|
2656
2670
|
connectionState: b.connectionState,
|
|
2657
2671
|
agentState: b.agentState,
|
|
2658
2672
|
transcript: b.transcript,
|
|
2659
|
-
isMuted:
|
|
2660
|
-
micDevices:
|
|
2673
|
+
isMuted: Z.isMuted,
|
|
2674
|
+
micDevices: be.mics,
|
|
2661
2675
|
isCameraEnabled: ne.isEnabled,
|
|
2662
2676
|
cameraPreviewEl: ne.previewEl,
|
|
2663
|
-
cameraDevices:
|
|
2677
|
+
cameraDevices: be.cameras,
|
|
2664
2678
|
activeCameraId: ne.activeDeviceId,
|
|
2665
|
-
isScreenShareEnabled:
|
|
2666
|
-
screenPreviewEl:
|
|
2667
|
-
isSpeakerMuted:
|
|
2679
|
+
isScreenShareEnabled: oe.isEnabled,
|
|
2680
|
+
screenPreviewEl: oe.previewEl,
|
|
2681
|
+
isSpeakerMuted: qe,
|
|
2668
2682
|
allowCamera: B,
|
|
2669
2683
|
allowScreenShare: D,
|
|
2670
2684
|
allowTyping: A,
|
|
2671
|
-
languageMenuOpen:
|
|
2672
|
-
onToggleLanguageMenu: () =>
|
|
2673
|
-
needsUserGesture:
|
|
2685
|
+
languageMenuOpen: Qe,
|
|
2686
|
+
onToggleLanguageMenu: () => Ze((g) => !g),
|
|
2687
|
+
needsUserGesture: Me,
|
|
2674
2688
|
canResume: b.canResume,
|
|
2675
|
-
micError:
|
|
2689
|
+
micError: Z.micError,
|
|
2676
2690
|
error: b.error,
|
|
2677
2691
|
avatarVideoContainerRef: kt,
|
|
2678
2692
|
agentVideoEl: b.videoElement,
|
|
2679
2693
|
onConnect: () => void b.connect(),
|
|
2680
2694
|
onDisconnect: () => b.disconnect(),
|
|
2681
|
-
onRetry:
|
|
2682
|
-
onResumeAudio:
|
|
2683
|
-
onToggleMute:
|
|
2695
|
+
onRetry: cn,
|
|
2696
|
+
onResumeAudio: sn,
|
|
2697
|
+
onToggleMute: Z.toggleMute,
|
|
2684
2698
|
onToggleCamera: () => void ne.toggle(),
|
|
2685
2699
|
onSwitchCameraDevice: (g) => void ne.switchDevice(g),
|
|
2686
|
-
onToggleScreenShare: () => void
|
|
2700
|
+
onToggleScreenShare: () => void oe.toggle(),
|
|
2687
2701
|
onToggleSpeaker: en,
|
|
2688
2702
|
onSendMessage: Zt,
|
|
2689
2703
|
onMinimize: an,
|
|
2690
2704
|
onClose: St,
|
|
2691
|
-
onClearMicError:
|
|
2705
|
+
onClearMicError: Z.clearError
|
|
2692
2706
|
}
|
|
2693
2707
|
)
|
|
2694
2708
|
]
|
|
@@ -2705,27 +2719,27 @@ const Br = ({
|
|
|
2705
2719
|
mode: i,
|
|
2706
2720
|
onAgentEvent: o,
|
|
2707
2721
|
className: l,
|
|
2708
|
-
style:
|
|
2722
|
+
style: c
|
|
2709
2723
|
}) => {
|
|
2710
|
-
const d = E(null), u = E(null),
|
|
2711
|
-
|
|
2724
|
+
const d = E(null), u = E(null), h = E(o);
|
|
2725
|
+
h.current = o;
|
|
2712
2726
|
const m = k((a) => {
|
|
2713
2727
|
var R;
|
|
2714
|
-
const
|
|
2715
|
-
(R =
|
|
2728
|
+
const s = a.detail;
|
|
2729
|
+
(R = h.current) == null || R.call(h, s);
|
|
2716
2730
|
}, []);
|
|
2717
2731
|
return N(() => {
|
|
2718
2732
|
const a = d.current;
|
|
2719
2733
|
if (!a) return;
|
|
2720
|
-
const
|
|
2721
|
-
return
|
|
2722
|
-
|
|
2734
|
+
const s = document.createElement("livelayer-widget");
|
|
2735
|
+
return s.setAttribute("agent-id", e), t && s.setAttribute("base-url", t), r && s.setAttribute("api-key", r), i && s.setAttribute("mode", i), s.addEventListener("agent-event", m), a.appendChild(s), u.current = s, () => {
|
|
2736
|
+
s.removeEventListener("agent-event", m), a.removeChild(s), u.current = null;
|
|
2723
2737
|
};
|
|
2724
2738
|
}, [e]), N(() => {
|
|
2725
2739
|
u.current && (i ? u.current.setAttribute("mode", i) : u.current.removeAttribute("mode"));
|
|
2726
|
-
}, [i]), /* @__PURE__ */ n("div", { ref: d, className: l, style:
|
|
2740
|
+
}, [i]), /* @__PURE__ */ n("div", { ref: d, className: l, style: c });
|
|
2727
2741
|
}, Wr = vt(
|
|
2728
|
-
function({ id: t, intent: r, as: i = "div", className: o, style: l, children:
|
|
2742
|
+
function({ id: t, intent: r, as: i = "div", className: o, style: l, children: c }, d) {
|
|
2729
2743
|
return hn(
|
|
2730
2744
|
i,
|
|
2731
2745
|
{
|
|
@@ -2735,7 +2749,7 @@ const Br = ({
|
|
|
2735
2749
|
className: o,
|
|
2736
2750
|
style: l
|
|
2737
2751
|
},
|
|
2738
|
-
|
|
2752
|
+
c
|
|
2739
2753
|
);
|
|
2740
2754
|
}
|
|
2741
2755
|
), Fr = vt(
|
|
@@ -2753,37 +2767,37 @@ const Br = ({
|
|
|
2753
2767
|
}
|
|
2754
2768
|
), Ur = vt(
|
|
2755
2769
|
function(t, r) {
|
|
2756
|
-
const { name: i, label: o, labelClassName: l } = t,
|
|
2770
|
+
const { name: i, label: o, labelClassName: l } = t, c = { name: i, "data-ll-field": i };
|
|
2757
2771
|
let d;
|
|
2758
2772
|
if ("as" in t && t.as === "textarea") {
|
|
2759
|
-
const { name: u, label:
|
|
2773
|
+
const { name: u, label: h, labelClassName: m, as: a, ...s } = t;
|
|
2760
2774
|
d = /* @__PURE__ */ n(
|
|
2761
2775
|
"textarea",
|
|
2762
2776
|
{
|
|
2763
2777
|
ref: r,
|
|
2764
|
-
...
|
|
2765
|
-
...
|
|
2778
|
+
...c,
|
|
2779
|
+
...s
|
|
2766
2780
|
}
|
|
2767
2781
|
);
|
|
2768
2782
|
} else if ("as" in t && t.as === "select") {
|
|
2769
|
-
const { name: u, label:
|
|
2783
|
+
const { name: u, label: h, labelClassName: m, as: a, children: s, ...R } = t;
|
|
2770
2784
|
d = /* @__PURE__ */ n(
|
|
2771
2785
|
"select",
|
|
2772
2786
|
{
|
|
2773
2787
|
ref: r,
|
|
2774
|
-
...
|
|
2788
|
+
...c,
|
|
2775
2789
|
...R,
|
|
2776
|
-
children:
|
|
2790
|
+
children: s
|
|
2777
2791
|
}
|
|
2778
2792
|
);
|
|
2779
2793
|
} else {
|
|
2780
|
-
const { name: u, label:
|
|
2794
|
+
const { name: u, label: h, labelClassName: m, as: a, ...s } = t;
|
|
2781
2795
|
d = /* @__PURE__ */ n(
|
|
2782
2796
|
"input",
|
|
2783
2797
|
{
|
|
2784
2798
|
ref: r,
|
|
2785
|
-
...
|
|
2786
|
-
...
|
|
2799
|
+
...c,
|
|
2800
|
+
...s
|
|
2787
2801
|
}
|
|
2788
2802
|
);
|
|
2789
2803
|
}
|
|
@@ -2799,8 +2813,8 @@ function jr({
|
|
|
2799
2813
|
defaultOpen: t = !1,
|
|
2800
2814
|
storageKey: r = "ll-debug-open"
|
|
2801
2815
|
}) {
|
|
2802
|
-
const [i, o] = C(t), [l,
|
|
2803
|
-
R.current =
|
|
2816
|
+
const [i, o] = C(t), [l, c] = C([]), [d, u] = C(""), [h, m] = C(!1), a = E(/* @__PURE__ */ new Set()), s = E([]), R = E(h);
|
|
2817
|
+
R.current = h, N(() => {
|
|
2804
2818
|
try {
|
|
2805
2819
|
const _ = localStorage.getItem(r);
|
|
2806
2820
|
_ === "1" && o(!0), _ === "0" && o(!1);
|
|
@@ -2818,9 +2832,9 @@ function jr({
|
|
|
2818
2832
|
return window.addEventListener("keydown", _), () => window.removeEventListener("keydown", _);
|
|
2819
2833
|
}, []), N(() => {
|
|
2820
2834
|
const _ = setInterval(() => {
|
|
2821
|
-
if (
|
|
2822
|
-
const y =
|
|
2823
|
-
|
|
2835
|
+
if (s.current.length === 0 || R.current) return;
|
|
2836
|
+
const y = s.current.splice(0, s.current.length);
|
|
2837
|
+
c(
|
|
2824
2838
|
(z) => [...y.reverse(), ...z].slice(0, 200)
|
|
2825
2839
|
);
|
|
2826
2840
|
}, 100);
|
|
@@ -2829,7 +2843,7 @@ function jr({
|
|
|
2829
2843
|
const q = E(!1);
|
|
2830
2844
|
if (N(() => {
|
|
2831
2845
|
!e || q.current || (q.current = !0, e((_) => {
|
|
2832
|
-
|
|
2846
|
+
s.current.push({
|
|
2833
2847
|
id: Jt++,
|
|
2834
2848
|
ts: Date.now(),
|
|
2835
2849
|
kind: "event",
|
|
@@ -2841,7 +2855,7 @@ function jr({
|
|
|
2841
2855
|
const _ = console.warn, y = console.log, z = (M, H) => function(...v) {
|
|
2842
2856
|
try {
|
|
2843
2857
|
const S = typeof v[0] == "string" ? v[0] : "";
|
|
2844
|
-
S.startsWith("[LiveLayer]") &&
|
|
2858
|
+
S.startsWith("[LiveLayer]") && s.current.push({
|
|
2845
2859
|
id: Jt++,
|
|
2846
2860
|
ts: Date.now(),
|
|
2847
2861
|
kind: M,
|
|
@@ -2933,9 +2947,9 @@ function jr({
|
|
|
2933
2947
|
{
|
|
2934
2948
|
type: "button",
|
|
2935
2949
|
onClick: () => m((_) => !_),
|
|
2936
|
-
style: gt(
|
|
2950
|
+
style: gt(h ? "#f59e0b" : "transparent"),
|
|
2937
2951
|
title: "Pause / resume capture",
|
|
2938
|
-
children:
|
|
2952
|
+
children: h ? "▶ resume" : "⏸ pause"
|
|
2939
2953
|
}
|
|
2940
2954
|
),
|
|
2941
2955
|
/* @__PURE__ */ n(
|
|
@@ -2943,7 +2957,7 @@ function jr({
|
|
|
2943
2957
|
{
|
|
2944
2958
|
type: "button",
|
|
2945
2959
|
onClick: () => {
|
|
2946
|
-
|
|
2960
|
+
c([]), s.current = [];
|
|
2947
2961
|
},
|
|
2948
2962
|
style: gt("transparent"),
|
|
2949
2963
|
title: "Clear buffer",
|
|
@@ -3027,7 +3041,7 @@ function jr({
|
|
|
3027
3041
|
entry: _,
|
|
3028
3042
|
expanded: a.current.has(_.id),
|
|
3029
3043
|
onToggle: () => {
|
|
3030
|
-
a.current.has(_.id) ? a.current.delete(_.id) : a.current.add(_.id),
|
|
3044
|
+
a.current.has(_.id) ? a.current.delete(_.id) : a.current.add(_.id), c((y) => [...y]);
|
|
3031
3045
|
}
|
|
3032
3046
|
},
|
|
3033
3047
|
_.id
|
|
@@ -3129,10 +3143,10 @@ function Pr(e) {
|
|
|
3129
3143
|
function Vr() {
|
|
3130
3144
|
const [e, t] = C([]), r = k((o) => {
|
|
3131
3145
|
t((l) => {
|
|
3132
|
-
const
|
|
3133
|
-
if (
|
|
3146
|
+
const c = l.findIndex((d) => d.id === o.id);
|
|
3147
|
+
if (c >= 0) {
|
|
3134
3148
|
const d = l.slice();
|
|
3135
|
-
return d[
|
|
3149
|
+
return d[c] = o, d;
|
|
3136
3150
|
}
|
|
3137
3151
|
return [...l, o];
|
|
3138
3152
|
});
|