@livelayer/react 0.10.4 → 0.10.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/dist/index.mjs +367 -374
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { Component as On, useState as
|
|
2
|
+
import { jsxs as y, jsx as n, Fragment as Ye } from "react/jsx-runtime";
|
|
3
|
+
import { Component as On, useState as S, useRef as N, useEffect as I, useCallback as E, useMemo as Ge, useLayoutEffect as mn, forwardRef as ut, useImperativeHandle as Hn, createElement as Wn } from "react";
|
|
4
4
|
import { createPortal as It } from "react-dom";
|
|
5
5
|
import { LiveKitSession as Bn } from "@livelayer/sdk";
|
|
6
6
|
import { createLocalAudioTrack as qn, Track as gn, createLocalVideoTrack as Fn } from "livekit-client";
|
|
@@ -19,7 +19,7 @@ class Un extends On {
|
|
|
19
19
|
}
|
|
20
20
|
render() {
|
|
21
21
|
var t;
|
|
22
|
-
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */
|
|
22
|
+
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ y("div", { className: "ll-error-boundary", role: "alert", children: [
|
|
23
23
|
/* @__PURE__ */ n("p", { className: "ll-error-boundary__title", children: "Widget crashed" }),
|
|
24
24
|
/* @__PURE__ */ n("p", { className: "ll-error-boundary__message", children: ((t = this.state.error) == null ? void 0 : t.message) || "Something went wrong." }),
|
|
25
25
|
/* @__PURE__ */ n(
|
|
@@ -35,24 +35,24 @@ class Un extends On {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
function jn(e) {
|
|
38
|
-
const [t, r] =
|
|
39
|
-
|
|
38
|
+
const [t, r] = S("idle"), [o, i] = S("idle"), [l, d] = S([]), [a, s] = S(null), [u, v] = S(null), [f, c] = S(null), [A, w] = S(!1), [x, _] = S(null), m = N(null), C = N(e.onDataMessage);
|
|
39
|
+
C.current = e.onDataMessage, I(() => {
|
|
40
40
|
const R = {
|
|
41
41
|
onConnectionStateChange: (q) => {
|
|
42
|
-
r(q), q === "connected" &&
|
|
42
|
+
r(q), q === "connected" && _(null);
|
|
43
43
|
},
|
|
44
44
|
onAgentStateChange: i,
|
|
45
45
|
onTranscript: (q) => d([...q]),
|
|
46
46
|
onAgentConfig: s,
|
|
47
47
|
onAudioTrack: (q) => c(q),
|
|
48
|
-
onVideoTrack: (q) =>
|
|
49
|
-
onVideoTrackRemoved: () =>
|
|
50
|
-
onError: (q) =>
|
|
48
|
+
onVideoTrack: (q) => v(q),
|
|
49
|
+
onVideoTrackRemoved: () => v(null),
|
|
50
|
+
onError: (q) => _(q),
|
|
51
51
|
onDataMessage: (q) => {
|
|
52
52
|
var F;
|
|
53
|
-
(F =
|
|
53
|
+
(F = C.current) == null || F.call(C, q);
|
|
54
54
|
},
|
|
55
|
-
onResumabilityChange:
|
|
55
|
+
onResumabilityChange: w
|
|
56
56
|
}, B = new Bn(
|
|
57
57
|
{
|
|
58
58
|
agentId: e.agentId,
|
|
@@ -63,9 +63,9 @@ function jn(e) {
|
|
|
63
63
|
},
|
|
64
64
|
R
|
|
65
65
|
);
|
|
66
|
-
return
|
|
66
|
+
return m.current = B, r("idle"), i("idle"), d([]), s(null), v(null), c(null), w(!1), _(null), () => {
|
|
67
67
|
var q;
|
|
68
|
-
(q = B.destroy) == null || q.call(B),
|
|
68
|
+
(q = B.destroy) == null || q.call(B), m.current = null;
|
|
69
69
|
};
|
|
70
70
|
}, [
|
|
71
71
|
e.agentId,
|
|
@@ -75,19 +75,19 @@ function jn(e) {
|
|
|
75
75
|
JSON.stringify(e.sessionBody ?? {})
|
|
76
76
|
]);
|
|
77
77
|
const M = E(async () => {
|
|
78
|
-
const R =
|
|
78
|
+
const R = m.current;
|
|
79
79
|
if (R)
|
|
80
80
|
try {
|
|
81
81
|
await R.connect();
|
|
82
82
|
} catch (B) {
|
|
83
|
-
throw
|
|
83
|
+
throw _(B instanceof Error ? B.message : String(B)), B;
|
|
84
84
|
}
|
|
85
85
|
}, []), D = E(() => {
|
|
86
|
-
const R =
|
|
86
|
+
const R = m.current;
|
|
87
87
|
R && R.disconnect();
|
|
88
88
|
}, []), k = E(() => {
|
|
89
89
|
var R;
|
|
90
|
-
return ((R =
|
|
90
|
+
return ((R = m.current) == null ? void 0 : R.getRoom()) ?? null;
|
|
91
91
|
}, []);
|
|
92
92
|
return {
|
|
93
93
|
connectionState: t,
|
|
@@ -101,7 +101,7 @@ function jn(e) {
|
|
|
101
101
|
connect: M,
|
|
102
102
|
disconnect: D,
|
|
103
103
|
getRoom: k,
|
|
104
|
-
session:
|
|
104
|
+
session: m.current
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
function Vn() {
|
|
@@ -118,12 +118,12 @@ function Vn() {
|
|
|
118
118
|
f.getByteFrequencyData(c);
|
|
119
119
|
let A = 0;
|
|
120
120
|
for (let x = 0; x < c.length; x++) A += c[x];
|
|
121
|
-
const
|
|
121
|
+
const w = A / c.length / 255;
|
|
122
122
|
for (const x of i.current)
|
|
123
123
|
try {
|
|
124
|
-
x(
|
|
125
|
-
} catch (
|
|
126
|
-
console.error("[useAudioLevel] subscriber threw:",
|
|
124
|
+
x(w);
|
|
125
|
+
} catch (_) {
|
|
126
|
+
console.error("[useAudioLevel] subscriber threw:", _);
|
|
127
127
|
}
|
|
128
128
|
o.current = requestAnimationFrame(d);
|
|
129
129
|
}, []), a = E(() => {
|
|
@@ -159,7 +159,7 @@ function Vn() {
|
|
|
159
159
|
}
|
|
160
160
|
r.current = null;
|
|
161
161
|
}
|
|
162
|
-
}, []),
|
|
162
|
+
}, []), v = E((f) => (i.current.add(f), () => {
|
|
163
163
|
i.current.delete(f);
|
|
164
164
|
}), []);
|
|
165
165
|
return I(() => () => {
|
|
@@ -178,11 +178,11 @@ function Vn() {
|
|
|
178
178
|
e.current = null;
|
|
179
179
|
}
|
|
180
180
|
i.current.clear(), l.current = null;
|
|
181
|
-
}, [u]), { attach: s, detach: u, subscribe:
|
|
181
|
+
}, [u]), { attach: s, detach: u, subscribe: v };
|
|
182
182
|
}
|
|
183
183
|
function Yn() {
|
|
184
|
-
const [e, t] =
|
|
185
|
-
var x,
|
|
184
|
+
const [e, t] = S(!1), [r, o] = S(""), [i, l] = S(null), d = N(null), a = N(null), s = E(async (w) => {
|
|
185
|
+
var x, _;
|
|
186
186
|
if (d.current && a.current) {
|
|
187
187
|
try {
|
|
188
188
|
await a.current.localParticipant.unpublishTrack(d.current);
|
|
@@ -190,52 +190,45 @@ function Yn() {
|
|
|
190
190
|
}
|
|
191
191
|
d.current.stop(), d.current = null;
|
|
192
192
|
}
|
|
193
|
-
a.current =
|
|
193
|
+
a.current = w, l(null);
|
|
194
194
|
try {
|
|
195
|
-
const
|
|
195
|
+
const m = await qn({
|
|
196
196
|
echoCancellation: !0,
|
|
197
197
|
noiseSuppression: !0
|
|
198
198
|
});
|
|
199
|
-
await
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
} catch (
|
|
203
|
-
const
|
|
204
|
-
throw l(
|
|
199
|
+
await w.localParticipant.publishTrack(m), d.current = m, t(m.isMuted);
|
|
200
|
+
const C = (_ = (x = m.mediaStreamTrack) == null ? void 0 : x.getSettings) == null ? void 0 : _.call(x);
|
|
201
|
+
C != null && C.deviceId && o(C.deviceId);
|
|
202
|
+
} catch (m) {
|
|
203
|
+
const C = m instanceof Error && m.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
|
|
204
|
+
throw l(C), m;
|
|
205
205
|
}
|
|
206
|
-
}, []), u = E((
|
|
207
|
-
a.current =
|
|
208
|
-
}, []),
|
|
206
|
+
}, []), u = E((w) => {
|
|
207
|
+
a.current = w;
|
|
208
|
+
}, []), v = E(async (w) => {
|
|
209
209
|
const x = a.current;
|
|
210
210
|
if (x)
|
|
211
211
|
try {
|
|
212
|
-
await x.switchActiveDevice("audioinput",
|
|
213
|
-
} catch (
|
|
214
|
-
console.warn("[useMicrophoneState] switchDevice failed:",
|
|
212
|
+
await x.switchActiveDevice("audioinput", w), o(w);
|
|
213
|
+
} catch (_) {
|
|
214
|
+
console.warn("[useMicrophoneState] switchDevice failed:", _);
|
|
215
215
|
}
|
|
216
|
-
}, []), f = E(() => {
|
|
217
|
-
const
|
|
218
|
-
if (
|
|
219
|
-
_.isMuted ? (_.unmute(), t(!1)) : (_.mute(), t(!0));
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
if (x) {
|
|
223
|
-
const b = !e;
|
|
224
|
-
t(b);
|
|
216
|
+
}, []), f = E(async () => {
|
|
217
|
+
const w = d.current, x = a.current, m = !(w ? w.isMuted : e);
|
|
218
|
+
if (t(m), !!x)
|
|
225
219
|
try {
|
|
226
|
-
x.localParticipant.setMicrophoneEnabled(!
|
|
227
|
-
} catch (
|
|
228
|
-
console.warn("[useMicrophoneState] setMicrophoneEnabled failed:",
|
|
220
|
+
await x.localParticipant.setMicrophoneEnabled(!m), w != null && w.mediaStreamTrack && (w.mediaStreamTrack.enabled = !m);
|
|
221
|
+
} catch (C) {
|
|
222
|
+
console.warn("[useMicrophoneState] setMicrophoneEnabled failed:", C), t(!m);
|
|
229
223
|
}
|
|
230
|
-
}
|
|
231
224
|
}, [e]), c = E(() => {
|
|
232
|
-
const
|
|
233
|
-
if (
|
|
225
|
+
const w = d.current, x = a.current;
|
|
226
|
+
if (w && x) {
|
|
234
227
|
try {
|
|
235
|
-
x.localParticipant.unpublishTrack(
|
|
228
|
+
x.localParticipant.unpublishTrack(w);
|
|
236
229
|
} catch {
|
|
237
230
|
}
|
|
238
|
-
|
|
231
|
+
w.stop();
|
|
239
232
|
}
|
|
240
233
|
d.current = null, a.current = null, t(!1), o("");
|
|
241
234
|
}, []), A = E(() => l(null), []);
|
|
@@ -246,22 +239,22 @@ function Yn() {
|
|
|
246
239
|
toggleMute: f,
|
|
247
240
|
setupMic: s,
|
|
248
241
|
attachRoom: u,
|
|
249
|
-
switchDevice:
|
|
242
|
+
switchDevice: v,
|
|
250
243
|
teardownMic: c,
|
|
251
244
|
clearError: A
|
|
252
245
|
};
|
|
253
246
|
}
|
|
254
247
|
const Gn = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
255
248
|
function Jn() {
|
|
256
|
-
const [e, t] =
|
|
257
|
-
s.current =
|
|
249
|
+
const [e, t] = S(!1), [r, o] = S(null), [i, l] = S(null), [d, a] = S(""), s = N(null), u = N(null), v = E((m) => {
|
|
250
|
+
s.current = m;
|
|
258
251
|
}, []), f = E(() => {
|
|
259
252
|
var M;
|
|
260
|
-
const
|
|
261
|
-
if (
|
|
262
|
-
const D =
|
|
253
|
+
const m = s.current, C = u.current;
|
|
254
|
+
if (C && m) {
|
|
255
|
+
const D = m.localParticipant.getTrackPublication(gn.Source.Camera), R = (D == null ? void 0 : D.track) ?? C;
|
|
263
256
|
try {
|
|
264
|
-
|
|
257
|
+
m.localParticipant.unpublishTrack(R);
|
|
265
258
|
} catch {
|
|
266
259
|
}
|
|
267
260
|
try {
|
|
@@ -270,19 +263,19 @@ function Jn() {
|
|
|
270
263
|
}
|
|
271
264
|
}
|
|
272
265
|
u.current = null, l(null), t(!1);
|
|
273
|
-
}, []), c = E(async (
|
|
274
|
-
const
|
|
275
|
-
if (
|
|
266
|
+
}, []), c = E(async (m) => {
|
|
267
|
+
const C = s.current;
|
|
268
|
+
if (C) {
|
|
276
269
|
o(null);
|
|
277
270
|
try {
|
|
278
271
|
const M = { ...Gn };
|
|
279
|
-
|
|
272
|
+
m && (M.deviceId = m);
|
|
280
273
|
const D = await Fn(M);
|
|
281
|
-
await
|
|
274
|
+
await C.localParticipant.publishTrack(D), u.current = D;
|
|
282
275
|
const k = D.attach();
|
|
283
|
-
l(k), t(!0),
|
|
276
|
+
l(k), t(!0), m && a(m);
|
|
284
277
|
try {
|
|
285
|
-
|
|
278
|
+
C.localParticipant.publishData(
|
|
286
279
|
new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
|
|
287
280
|
{ reliable: !0 }
|
|
288
281
|
);
|
|
@@ -295,11 +288,11 @@ function Jn() {
|
|
|
295
288
|
}
|
|
296
289
|
}, []), A = E(async () => {
|
|
297
290
|
e ? f() : await c(d || void 0);
|
|
298
|
-
}, [e, d, f, c]),
|
|
299
|
-
f(), await c(
|
|
291
|
+
}, [e, d, f, c]), w = E(async (m) => {
|
|
292
|
+
f(), await c(m);
|
|
300
293
|
}, [f, c]), x = E(() => {
|
|
301
294
|
f(), s.current = null, o(null), a("");
|
|
302
|
-
}, [f]),
|
|
295
|
+
}, [f]), _ = E(() => o(null), []);
|
|
303
296
|
return I(() => () => {
|
|
304
297
|
u.current && u.current.stop();
|
|
305
298
|
}, []), {
|
|
@@ -308,14 +301,14 @@ function Jn() {
|
|
|
308
301
|
previewEl: i,
|
|
309
302
|
activeDeviceId: d,
|
|
310
303
|
toggle: A,
|
|
311
|
-
switchDevice:
|
|
312
|
-
attachRoom:
|
|
304
|
+
switchDevice: w,
|
|
305
|
+
attachRoom: v,
|
|
313
306
|
teardown: x,
|
|
314
|
-
clearError:
|
|
307
|
+
clearError: _
|
|
315
308
|
};
|
|
316
309
|
}
|
|
317
310
|
function Kn() {
|
|
318
|
-
const [e, t] =
|
|
311
|
+
const [e, t] = S(!1), [r, o] = S(null), [i, l] = S(null), d = N(null), a = E((c) => {
|
|
319
312
|
d.current = c;
|
|
320
313
|
}, []), s = E(() => l(null), []), u = E(async () => {
|
|
321
314
|
const c = d.current;
|
|
@@ -332,11 +325,11 @@ function Kn() {
|
|
|
332
325
|
try {
|
|
333
326
|
await c.localParticipant.setScreenShareEnabled(!0);
|
|
334
327
|
let A = 0;
|
|
335
|
-
const
|
|
328
|
+
const w = () => {
|
|
336
329
|
const x = c.localParticipant.getTrackPublication(gn.Source.ScreenShare);
|
|
337
330
|
if (x != null && x.track) {
|
|
338
|
-
const
|
|
339
|
-
l(
|
|
331
|
+
const _ = x.track.attach();
|
|
332
|
+
l(_), t(!0);
|
|
340
333
|
try {
|
|
341
334
|
c.localParticipant.publishData(
|
|
342
335
|
new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
|
|
@@ -346,15 +339,15 @@ function Kn() {
|
|
|
346
339
|
}
|
|
347
340
|
return;
|
|
348
341
|
}
|
|
349
|
-
A++ < 10 ? setTimeout(
|
|
342
|
+
A++ < 10 ? setTimeout(w, 100) : t(!0);
|
|
350
343
|
};
|
|
351
|
-
|
|
344
|
+
w();
|
|
352
345
|
} catch (A) {
|
|
353
|
-
const
|
|
354
|
-
|
|
346
|
+
const w = A instanceof Error ? A.name : "";
|
|
347
|
+
w !== "NotAllowedError" && w !== "AbortError" && o("Screen share unavailable. Try again."), t(!1);
|
|
355
348
|
}
|
|
356
349
|
}
|
|
357
|
-
}, [e, s]),
|
|
350
|
+
}, [e, s]), v = E(() => {
|
|
358
351
|
const c = d.current;
|
|
359
352
|
if (c && e)
|
|
360
353
|
try {
|
|
@@ -363,10 +356,10 @@ function Kn() {
|
|
|
363
356
|
}
|
|
364
357
|
s(), t(!1), o(null), d.current = null;
|
|
365
358
|
}, [e, s]), f = E(() => o(null), []);
|
|
366
|
-
return { isEnabled: e, error: r, previewEl: i, toggle: u, attachRoom: a, teardown:
|
|
359
|
+
return { isEnabled: e, error: r, previewEl: i, toggle: u, attachRoom: a, teardown: v, clearError: f };
|
|
367
360
|
}
|
|
368
361
|
function Xn() {
|
|
369
|
-
const [e, t] =
|
|
362
|
+
const [e, t] = S([]), [r, o] = S([]), i = E(async () => {
|
|
370
363
|
if (!(typeof navigator > "u" || !navigator.mediaDevices))
|
|
371
364
|
try {
|
|
372
365
|
const l = await navigator.mediaDevices.enumerateDevices();
|
|
@@ -381,14 +374,14 @@ function Xn() {
|
|
|
381
374
|
}, [i]), { mics: e, cameras: r, refresh: i };
|
|
382
375
|
}
|
|
383
376
|
function Qn(e, t, r = !1) {
|
|
384
|
-
const [o, i] =
|
|
377
|
+
const [o, i] = S(null), [l, d] = S(null), [a, s] = S(!r && !!e);
|
|
385
378
|
return I(() => {
|
|
386
379
|
if (r || !e) {
|
|
387
380
|
s(!1);
|
|
388
381
|
return;
|
|
389
382
|
}
|
|
390
|
-
const u = new AbortController(),
|
|
391
|
-
return s(!0), d(null), fetch(`${
|
|
383
|
+
const u = new AbortController(), v = t || "https://app.livelayer.studio";
|
|
384
|
+
return s(!0), d(null), fetch(`${v}/api/widget/agent/${encodeURIComponent(e)}`, {
|
|
392
385
|
signal: u.signal
|
|
393
386
|
}).then(async (f) => {
|
|
394
387
|
if (!f.ok) {
|
|
@@ -423,7 +416,7 @@ function tr({
|
|
|
423
416
|
defaultValue: t = "expanded",
|
|
424
417
|
onChange: r
|
|
425
418
|
} = {}) {
|
|
426
|
-
const o = e !== void 0, [i, l] =
|
|
419
|
+
const o = e !== void 0, [i, l] = S(t), d = o ? e : i, a = E(
|
|
427
420
|
(s) => {
|
|
428
421
|
s !== d && (o || l(s), r == null || r(s));
|
|
429
422
|
},
|
|
@@ -457,7 +450,7 @@ function or({
|
|
|
457
450
|
}
|
|
458
451
|
const ir = 640;
|
|
459
452
|
function lr(e = ir) {
|
|
460
|
-
const [t, r] =
|
|
453
|
+
const [t, r] = S(!1);
|
|
461
454
|
return I(() => {
|
|
462
455
|
if (e === !1) {
|
|
463
456
|
r(!1);
|
|
@@ -487,7 +480,7 @@ function Xt() {
|
|
|
487
480
|
return typeof window > "u" ? "/" : window.location.pathname || "/";
|
|
488
481
|
}
|
|
489
482
|
function cr(e) {
|
|
490
|
-
const [t, r] =
|
|
483
|
+
const [t, r] = S(
|
|
491
484
|
() => e ?? Xt()
|
|
492
485
|
);
|
|
493
486
|
return I(() => {
|
|
@@ -596,7 +589,7 @@ function yr(e) {
|
|
|
596
589
|
[l, d, a]
|
|
597
590
|
);
|
|
598
591
|
}
|
|
599
|
-
const en = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */
|
|
592
|
+
const en = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ y(
|
|
600
593
|
"svg",
|
|
601
594
|
{
|
|
602
595
|
className: t,
|
|
@@ -721,23 +714,23 @@ const kr = ({
|
|
|
721
714
|
agentName: d,
|
|
722
715
|
containerEl: a
|
|
723
716
|
}) => {
|
|
724
|
-
const s = wr(e), u = s === "right" ? "left" : "right",
|
|
717
|
+
const s = wr(e), u = s === "right" ? "left" : "right", v = t ? 80 : 72, f = !!l, c = !!a, [A, w] = S(null), [x, _] = S(!1), m = N(null), C = N(!1), M = E(
|
|
725
718
|
(O) => {
|
|
726
719
|
if (typeof window > "u") return O;
|
|
727
|
-
const j =
|
|
720
|
+
const j = v / 2, H = rn + j, G = window.innerHeight - rn - j;
|
|
728
721
|
return G < H ? Math.max(H, O) : Math.max(H, Math.min(G, O));
|
|
729
722
|
},
|
|
730
|
-
[
|
|
723
|
+
[v]
|
|
731
724
|
);
|
|
732
725
|
I(() => {
|
|
733
726
|
if (c) {
|
|
734
|
-
|
|
727
|
+
w(null);
|
|
735
728
|
return;
|
|
736
729
|
}
|
|
737
730
|
const O = xr();
|
|
738
|
-
|
|
731
|
+
w(M(O ?? window.innerHeight / 2));
|
|
739
732
|
const j = () => {
|
|
740
|
-
|
|
733
|
+
w((H) => H === null ? null : M(H));
|
|
741
734
|
};
|
|
742
735
|
return window.addEventListener("resize", j), () => window.removeEventListener("resize", j);
|
|
743
736
|
}, [M, c]);
|
|
@@ -748,7 +741,7 @@ const kr = ({
|
|
|
748
741
|
O.currentTarget.setPointerCapture(O.pointerId);
|
|
749
742
|
} catch {
|
|
750
743
|
}
|
|
751
|
-
|
|
744
|
+
m.current = {
|
|
752
745
|
startClientY: O.clientY,
|
|
753
746
|
startCenterY: A,
|
|
754
747
|
moved: !1
|
|
@@ -758,27 +751,27 @@ const kr = ({
|
|
|
758
751
|
[A, c]
|
|
759
752
|
), k = E(
|
|
760
753
|
(O) => {
|
|
761
|
-
const j =
|
|
754
|
+
const j = m.current;
|
|
762
755
|
if (!j) return;
|
|
763
756
|
const H = O.clientY - j.startClientY;
|
|
764
|
-
!j.moved && Math.abs(H) > _r && (j.moved = !0,
|
|
757
|
+
!j.moved && Math.abs(H) > _r && (j.moved = !0, _(!0)), j.moved && w(M(j.startCenterY + H));
|
|
765
758
|
},
|
|
766
759
|
[M]
|
|
767
760
|
), R = E(
|
|
768
761
|
(O) => {
|
|
769
|
-
const j =
|
|
762
|
+
const j = m.current;
|
|
770
763
|
if (j) {
|
|
771
764
|
try {
|
|
772
765
|
O.currentTarget.releasePointerCapture(O.pointerId);
|
|
773
766
|
} catch {
|
|
774
767
|
}
|
|
775
|
-
|
|
768
|
+
m.current = null, j.moved && (_(!1), C.current = !0, w((H) => (H !== null && on(H), H)));
|
|
776
769
|
}
|
|
777
770
|
},
|
|
778
771
|
[]
|
|
779
772
|
), B = E(() => {
|
|
780
|
-
if (
|
|
781
|
-
|
|
773
|
+
if (C.current) {
|
|
774
|
+
C.current = !1;
|
|
782
775
|
return;
|
|
783
776
|
}
|
|
784
777
|
o();
|
|
@@ -787,7 +780,7 @@ const kr = ({
|
|
|
787
780
|
if (O.key === "ArrowUp" || O.key === "ArrowDown") {
|
|
788
781
|
O.preventDefault();
|
|
789
782
|
const j = O.key === "ArrowUp" ? -8 : 8;
|
|
790
|
-
|
|
783
|
+
w((H) => {
|
|
791
784
|
if (H === null) return H;
|
|
792
785
|
const G = M(H + j);
|
|
793
786
|
return on(G), G;
|
|
@@ -803,7 +796,7 @@ const kr = ({
|
|
|
803
796
|
x ? "is-dragging" : null,
|
|
804
797
|
f ? "ll-hidden--with-avatar" : null,
|
|
805
798
|
c ? "ll-hidden--scoped" : null
|
|
806
|
-
].filter(Boolean).join(" "), U = A === null ? void 0 : { top: `${A -
|
|
799
|
+
].filter(Boolean).join(" "), U = A === null ? void 0 : { top: `${A - v / 2}px`, transform: "none" };
|
|
807
800
|
return /* @__PURE__ */ n(
|
|
808
801
|
"button",
|
|
809
802
|
{
|
|
@@ -823,7 +816,7 @@ const kr = ({
|
|
|
823
816
|
// as the click affordance), then the circular avatar photo
|
|
824
817
|
// taking the rest of the tab. Reinforces "this is an
|
|
825
818
|
// avatar-based experience" even when collapsed.
|
|
826
|
-
/* @__PURE__ */
|
|
819
|
+
/* @__PURE__ */ y(Ye, { children: [
|
|
827
820
|
/* @__PURE__ */ n(
|
|
828
821
|
nn,
|
|
829
822
|
{
|
|
@@ -859,19 +852,19 @@ const kr = ({
|
|
|
859
852
|
barClassName: l
|
|
860
853
|
}) => {
|
|
861
854
|
const d = N(null), a = N([]), s = Ge(() => {
|
|
862
|
-
const
|
|
863
|
-
return Array.from({ length: t }, (f, c) => 0.5 + c *
|
|
855
|
+
const v = (Math.sqrt(5) - 1) / 2;
|
|
856
|
+
return Array.from({ length: t }, (f, c) => 0.5 + c * v % 1 * 0.5);
|
|
864
857
|
}, [t]);
|
|
865
858
|
I(() => e.subscribe((f) => {
|
|
866
859
|
for (let c = 0; c < t; c++) {
|
|
867
860
|
const A = a.current[c];
|
|
868
861
|
if (!A) continue;
|
|
869
|
-
const
|
|
870
|
-
A.style.height = `${
|
|
862
|
+
const w = Math.max(o, f * r * s[c]);
|
|
863
|
+
A.style.height = `${w}px`;
|
|
871
864
|
}
|
|
872
865
|
}), [e, t, r, o, s]);
|
|
873
866
|
const u = ["ll-waveform", i].filter(Boolean).join(" ");
|
|
874
|
-
return /* @__PURE__ */ n("div", { ref: d, className: u, "aria-hidden": "true", children: Array.from({ length: t }, (
|
|
867
|
+
return /* @__PURE__ */ n("div", { ref: d, className: u, "aria-hidden": "true", children: Array.from({ length: t }, (v, f) => /* @__PURE__ */ n(
|
|
875
868
|
"div",
|
|
876
869
|
{
|
|
877
870
|
ref: (c) => {
|
|
@@ -899,7 +892,7 @@ const kr = ({
|
|
|
899
892
|
className: "ll-minimized ll-minimized--mobile",
|
|
900
893
|
role: "region",
|
|
901
894
|
"aria-label": `${r} widget`,
|
|
902
|
-
children: /* @__PURE__ */
|
|
895
|
+
children: /* @__PURE__ */ y(
|
|
903
896
|
"button",
|
|
904
897
|
{
|
|
905
898
|
type: "button",
|
|
@@ -928,18 +921,18 @@ const kr = ({
|
|
|
928
921
|
}
|
|
929
922
|
),
|
|
930
923
|
/* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
|
|
931
|
-
/* @__PURE__ */
|
|
924
|
+
/* @__PURE__ */ y("div", { className: "ll-minimized__controls", children: [
|
|
932
925
|
/* @__PURE__ */ n(
|
|
933
926
|
"span",
|
|
934
927
|
{
|
|
935
928
|
className: "ll-minimized__btn",
|
|
936
929
|
role: "button",
|
|
937
930
|
tabIndex: 0,
|
|
938
|
-
onClick: (
|
|
939
|
-
|
|
931
|
+
onClick: (v) => {
|
|
932
|
+
v.stopPropagation(), s();
|
|
940
933
|
},
|
|
941
|
-
onKeyDown: (
|
|
942
|
-
(
|
|
934
|
+
onKeyDown: (v) => {
|
|
935
|
+
(v.key === "Enter" || v.key === " ") && (v.stopPropagation(), v.preventDefault(), s());
|
|
943
936
|
},
|
|
944
937
|
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
945
938
|
children: /* @__PURE__ */ n(en, { muted: l, className: "ll-minimized__icon" })
|
|
@@ -958,7 +951,7 @@ const kr = ({
|
|
|
958
951
|
"data-position": e,
|
|
959
952
|
role: "region",
|
|
960
953
|
"aria-label": `${r} widget`,
|
|
961
|
-
children: /* @__PURE__ */
|
|
954
|
+
children: /* @__PURE__ */ y("div", { className: "ll-minimized__surface", children: [
|
|
962
955
|
o ? (
|
|
963
956
|
// eslint-disable-next-line @next/next/no-img-element
|
|
964
957
|
/* @__PURE__ */ n(
|
|
@@ -970,11 +963,11 @@ const kr = ({
|
|
|
970
963
|
}
|
|
971
964
|
)
|
|
972
965
|
) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
|
|
973
|
-
/* @__PURE__ */
|
|
966
|
+
/* @__PURE__ */ y("div", { className: "ll-minimized__meta", children: [
|
|
974
967
|
/* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
|
|
975
968
|
/* @__PURE__ */ n("span", { className: "ll-minimized__state", children: i === "speaking" ? "Speaking" : i === "thinking" ? "Thinking" : "Listening" })
|
|
976
969
|
] }),
|
|
977
|
-
/* @__PURE__ */
|
|
970
|
+
/* @__PURE__ */ y("div", { className: "ll-minimized__controls", children: [
|
|
978
971
|
/* @__PURE__ */ n(
|
|
979
972
|
"button",
|
|
980
973
|
{
|
|
@@ -1015,7 +1008,7 @@ const kr = ({
|
|
|
1015
1008
|
className: o,
|
|
1016
1009
|
style: i
|
|
1017
1010
|
}) => {
|
|
1018
|
-
const [l, d] =
|
|
1011
|
+
const [l, d] = S(!1), a = N(e);
|
|
1019
1012
|
if (I(() => {
|
|
1020
1013
|
a.current !== e && (a.current = e, d(!1));
|
|
1021
1014
|
}, [e]), !e) return null;
|
|
@@ -1052,7 +1045,7 @@ const kr = ({
|
|
|
1052
1045
|
anchorRef: r,
|
|
1053
1046
|
children: o
|
|
1054
1047
|
}) => {
|
|
1055
|
-
const i = N(null), [l, d] =
|
|
1048
|
+
const i = N(null), [l, d] = S(null);
|
|
1056
1049
|
return mn(() => {
|
|
1057
1050
|
if (!e) {
|
|
1058
1051
|
d(null);
|
|
@@ -1061,11 +1054,11 @@ const kr = ({
|
|
|
1061
1054
|
const a = r.current;
|
|
1062
1055
|
if (!a) return;
|
|
1063
1056
|
const s = () => {
|
|
1064
|
-
const u = a.getBoundingClientRect(),
|
|
1057
|
+
const u = a.getBoundingClientRect(), v = {
|
|
1065
1058
|
top: u.top - Sr,
|
|
1066
1059
|
left: u.left + u.width / 2
|
|
1067
1060
|
}, f = ln + 90, c = window.innerWidth - ln - 90;
|
|
1068
|
-
|
|
1061
|
+
v.left < f && (v.left = f), v.left > c && (v.left = c), d(v);
|
|
1069
1062
|
};
|
|
1070
1063
|
return s(), window.addEventListener("scroll", s, !0), window.addEventListener("resize", s), () => {
|
|
1071
1064
|
window.removeEventListener("scroll", s, !0), window.removeEventListener("resize", s);
|
|
@@ -1073,8 +1066,8 @@ const kr = ({
|
|
|
1073
1066
|
}, [e, r]), I(() => {
|
|
1074
1067
|
if (!e) return;
|
|
1075
1068
|
const a = (u) => {
|
|
1076
|
-
const
|
|
1077
|
-
f && f.contains(
|
|
1069
|
+
const v = u.target, f = i.current, c = r.current;
|
|
1070
|
+
f && f.contains(v) || c && c.contains(v) || t();
|
|
1078
1071
|
}, s = (u) => {
|
|
1079
1072
|
u.key === "Escape" && (u.stopPropagation(), t());
|
|
1080
1073
|
};
|
|
@@ -1112,19 +1105,19 @@ const kr = ({
|
|
|
1112
1105
|
allowScreenShare: a,
|
|
1113
1106
|
isSpeakerMuted: s,
|
|
1114
1107
|
onToggleSpeaker: u,
|
|
1115
|
-
allowTyping:
|
|
1108
|
+
allowTyping: v,
|
|
1116
1109
|
isTypingOpen: f,
|
|
1117
1110
|
onToggleTyping: c,
|
|
1118
1111
|
onDisconnect: A
|
|
1119
1112
|
}) => {
|
|
1120
|
-
const [
|
|
1121
|
-
return /* @__PURE__ */
|
|
1122
|
-
/* @__PURE__ */
|
|
1113
|
+
const [w, x] = S(!1), _ = N(null);
|
|
1114
|
+
return /* @__PURE__ */ y(Ye, { children: [
|
|
1115
|
+
/* @__PURE__ */ y(
|
|
1123
1116
|
"div",
|
|
1124
1117
|
{
|
|
1125
1118
|
className: "ll-toolbar ll-toolbar--compact",
|
|
1126
1119
|
"data-testid": "compact-toolbar",
|
|
1127
|
-
onClick: (
|
|
1120
|
+
onClick: (m) => m.stopPropagation(),
|
|
1128
1121
|
children: [
|
|
1129
1122
|
/* @__PURE__ */ n(
|
|
1130
1123
|
"button",
|
|
@@ -1139,13 +1132,13 @@ const kr = ({
|
|
|
1139
1132
|
/* @__PURE__ */ n(
|
|
1140
1133
|
"button",
|
|
1141
1134
|
{
|
|
1142
|
-
ref:
|
|
1135
|
+
ref: _,
|
|
1143
1136
|
type: "button",
|
|
1144
|
-
className: `ll-tool ${
|
|
1145
|
-
onClick: () => x((
|
|
1137
|
+
className: `ll-tool ${w ? "is-on" : ""}`,
|
|
1138
|
+
onClick: () => x((m) => !m),
|
|
1146
1139
|
"aria-label": "More controls",
|
|
1147
1140
|
"aria-haspopup": "menu",
|
|
1148
|
-
"aria-expanded":
|
|
1141
|
+
"aria-expanded": w,
|
|
1149
1142
|
children: /* @__PURE__ */ n(Rr, {})
|
|
1150
1143
|
}
|
|
1151
1144
|
),
|
|
@@ -1162,14 +1155,14 @@ const kr = ({
|
|
|
1162
1155
|
]
|
|
1163
1156
|
}
|
|
1164
1157
|
),
|
|
1165
|
-
/* @__PURE__ */
|
|
1158
|
+
/* @__PURE__ */ y(
|
|
1166
1159
|
Nr,
|
|
1167
1160
|
{
|
|
1168
|
-
open:
|
|
1161
|
+
open: w,
|
|
1169
1162
|
onClose: () => x(!1),
|
|
1170
|
-
anchorRef:
|
|
1163
|
+
anchorRef: _,
|
|
1171
1164
|
children: [
|
|
1172
|
-
i && /* @__PURE__ */
|
|
1165
|
+
i && /* @__PURE__ */ y(
|
|
1173
1166
|
"button",
|
|
1174
1167
|
{
|
|
1175
1168
|
type: "button",
|
|
@@ -1183,7 +1176,7 @@ const kr = ({
|
|
|
1183
1176
|
]
|
|
1184
1177
|
}
|
|
1185
1178
|
),
|
|
1186
|
-
a && /* @__PURE__ */
|
|
1179
|
+
a && /* @__PURE__ */ y(
|
|
1187
1180
|
"button",
|
|
1188
1181
|
{
|
|
1189
1182
|
type: "button",
|
|
@@ -1197,7 +1190,7 @@ const kr = ({
|
|
|
1197
1190
|
]
|
|
1198
1191
|
}
|
|
1199
1192
|
),
|
|
1200
|
-
/* @__PURE__ */
|
|
1193
|
+
/* @__PURE__ */ y(
|
|
1201
1194
|
"button",
|
|
1202
1195
|
{
|
|
1203
1196
|
type: "button",
|
|
@@ -1211,7 +1204,7 @@ const kr = ({
|
|
|
1211
1204
|
]
|
|
1212
1205
|
}
|
|
1213
1206
|
),
|
|
1214
|
-
|
|
1207
|
+
v && /* @__PURE__ */ y(
|
|
1215
1208
|
"button",
|
|
1216
1209
|
{
|
|
1217
1210
|
type: "button",
|
|
@@ -1225,7 +1218,7 @@ const kr = ({
|
|
|
1225
1218
|
]
|
|
1226
1219
|
}
|
|
1227
1220
|
),
|
|
1228
|
-
/* @__PURE__ */
|
|
1221
|
+
/* @__PURE__ */ y(
|
|
1229
1222
|
"button",
|
|
1230
1223
|
{
|
|
1231
1224
|
type: "button",
|
|
@@ -1244,7 +1237,7 @@ const kr = ({
|
|
|
1244
1237
|
] });
|
|
1245
1238
|
};
|
|
1246
1239
|
function Rr() {
|
|
1247
|
-
return /* @__PURE__ */
|
|
1240
|
+
return /* @__PURE__ */ y(
|
|
1248
1241
|
"svg",
|
|
1249
1242
|
{
|
|
1250
1243
|
width: "16",
|
|
@@ -1288,15 +1281,15 @@ const Mr = ({
|
|
|
1288
1281
|
teamMembers: a,
|
|
1289
1282
|
currentTeamMemberId: s,
|
|
1290
1283
|
isSwitchingTeamMember: u,
|
|
1291
|
-
teamSwitcherOpen:
|
|
1284
|
+
teamSwitcherOpen: v,
|
|
1292
1285
|
onToggleTeamSwitcher: f,
|
|
1293
1286
|
onSelectTeamMember: c,
|
|
1294
1287
|
languageMenuOpen: A,
|
|
1295
|
-
onToggleLanguageMenu:
|
|
1288
|
+
onToggleLanguageMenu: w,
|
|
1296
1289
|
connectionState: x,
|
|
1297
|
-
agentState:
|
|
1298
|
-
transcript:
|
|
1299
|
-
canResume:
|
|
1290
|
+
agentState: _,
|
|
1291
|
+
transcript: m,
|
|
1292
|
+
canResume: C,
|
|
1300
1293
|
needsUserGesture: M,
|
|
1301
1294
|
error: D,
|
|
1302
1295
|
isMuted: k,
|
|
@@ -1337,7 +1330,7 @@ const Mr = ({
|
|
|
1337
1330
|
onClearMicError: kt
|
|
1338
1331
|
}) => {
|
|
1339
1332
|
var De;
|
|
1340
|
-
const Ie = ((a == null ? void 0 : a.length) ?? 0) > 1, Me = x === "connecting" || x === "connected", re = x === "connected", Ze = x === "idle" || x === "disconnected" || x === "error", [et, Oe] =
|
|
1333
|
+
const Ie = ((a == null ? void 0 : a.length) ?? 0) > 1, Me = x === "connecting" || x === "connected", re = x === "connected", Ze = x === "idle" || x === "disconnected" || x === "error", [et, Oe] = S(!1);
|
|
1341
1334
|
I(() => {
|
|
1342
1335
|
if (!le) {
|
|
1343
1336
|
Oe(!1);
|
|
@@ -1353,7 +1346,7 @@ const Mr = ({
|
|
|
1353
1346
|
le.removeEventListener("playing", h), le.removeEventListener("loadeddata", h);
|
|
1354
1347
|
};
|
|
1355
1348
|
}, [le]);
|
|
1356
|
-
const [Te, ee] =
|
|
1349
|
+
const [Te, ee] = S(!1);
|
|
1357
1350
|
I(() => {
|
|
1358
1351
|
if (!re) {
|
|
1359
1352
|
ee(!1);
|
|
@@ -1371,22 +1364,22 @@ const Mr = ({
|
|
|
1371
1364
|
const h = oe.current;
|
|
1372
1365
|
h && (h.innerHTML = "", G && (G.style.width = "100%", G.style.height = "100%", G.style.objectFit = "contain", h.appendChild(G)));
|
|
1373
1366
|
}, [G]);
|
|
1374
|
-
const [ie, de] =
|
|
1367
|
+
const [ie, de] = S(!1), [ve, X] = S(!1), ue = N(null), be = N(null);
|
|
1375
1368
|
I(() => {
|
|
1376
|
-
if (!ie && !ve && !A && !
|
|
1369
|
+
if (!ie && !ve && !A && !v) return;
|
|
1377
1370
|
const h = () => {
|
|
1378
|
-
de(!1), X(!1), A &&
|
|
1371
|
+
de(!1), X(!1), A && w(), v && f();
|
|
1379
1372
|
};
|
|
1380
1373
|
return document.addEventListener("click", h), () => document.removeEventListener("click", h);
|
|
1381
1374
|
}, [
|
|
1382
1375
|
ie,
|
|
1383
1376
|
ve,
|
|
1384
1377
|
A,
|
|
1385
|
-
|
|
1386
|
-
|
|
1378
|
+
v,
|
|
1379
|
+
w,
|
|
1387
1380
|
f
|
|
1388
1381
|
]);
|
|
1389
|
-
const [He, Lt] =
|
|
1382
|
+
const [He, Lt] = S(!1), nt = E(() => Lt((h) => !h), []), [we, rt] = S(""), ot = E(
|
|
1390
1383
|
(h) => {
|
|
1391
1384
|
h.preventDefault();
|
|
1392
1385
|
const J = we.trim();
|
|
@@ -1395,15 +1388,15 @@ const Mr = ({
|
|
|
1395
1388
|
[we, Re]
|
|
1396
1389
|
), it = d.productName || "Live Layer";
|
|
1397
1390
|
let _e = null, xe = null;
|
|
1398
|
-
for (let h =
|
|
1399
|
-
const J =
|
|
1391
|
+
for (let h = m.length - 1; h >= 0; h--) {
|
|
1392
|
+
const J = m[h];
|
|
1400
1393
|
if (!_e && J.role === "agent" ? _e = J : !xe && J.role === "user" && (xe = J), _e && xe) break;
|
|
1401
1394
|
}
|
|
1402
1395
|
const We = re ? (_e == null ? void 0 : _e.text) || null : l || null, yt = re && (xe == null ? void 0 : xe.text) || null, Be = [
|
|
1403
1396
|
"ll-expanded",
|
|
1404
1397
|
t ? "ll-expanded--mobile" : "ll-expanded--desktop"
|
|
1405
1398
|
].join(" ");
|
|
1406
|
-
return /* @__PURE__ */
|
|
1399
|
+
return /* @__PURE__ */ y(
|
|
1407
1400
|
"div",
|
|
1408
1401
|
{
|
|
1409
1402
|
className: Be,
|
|
@@ -1412,7 +1405,7 @@ const Mr = ({
|
|
|
1412
1405
|
role: "dialog",
|
|
1413
1406
|
"aria-label": `${r} widget`,
|
|
1414
1407
|
children: [
|
|
1415
|
-
/* @__PURE__ */
|
|
1408
|
+
/* @__PURE__ */ y("div", { className: "ll-expanded__bg", children: [
|
|
1416
1409
|
o ? /* @__PURE__ */ n(
|
|
1417
1410
|
Cr,
|
|
1418
1411
|
{
|
|
@@ -1434,11 +1427,11 @@ const Mr = ({
|
|
|
1434
1427
|
)
|
|
1435
1428
|
] }),
|
|
1436
1429
|
/* @__PURE__ */ n("div", { ref: pt, className: "ll-expanded__video" }),
|
|
1437
|
-
gt && /* @__PURE__ */
|
|
1430
|
+
gt && /* @__PURE__ */ y("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
|
|
1438
1431
|
/* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
|
|
1439
1432
|
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: u ? "Switching..." : "Connecting..." })
|
|
1440
1433
|
] }),
|
|
1441
|
-
M && re && /* @__PURE__ */
|
|
1434
|
+
M && re && /* @__PURE__ */ y(
|
|
1442
1435
|
"button",
|
|
1443
1436
|
{
|
|
1444
1437
|
type: "button",
|
|
@@ -1450,7 +1443,7 @@ const Mr = ({
|
|
|
1450
1443
|
]
|
|
1451
1444
|
}
|
|
1452
1445
|
),
|
|
1453
|
-
ft && /* @__PURE__ */
|
|
1446
|
+
ft && /* @__PURE__ */ y(
|
|
1454
1447
|
"div",
|
|
1455
1448
|
{
|
|
1456
1449
|
className: "ll-expanded__overlay ll-expanded__overlay--transforming",
|
|
@@ -1463,11 +1456,11 @@ const Mr = ({
|
|
|
1463
1456
|
]
|
|
1464
1457
|
}
|
|
1465
1458
|
),
|
|
1466
|
-
Me ? /* @__PURE__ */
|
|
1467
|
-
!ne && /* @__PURE__ */
|
|
1468
|
-
!Pe && /* @__PURE__ */
|
|
1469
|
-
/* @__PURE__ */
|
|
1470
|
-
/* @__PURE__ */
|
|
1459
|
+
Me ? /* @__PURE__ */ y(Ye, { children: [
|
|
1460
|
+
!ne && /* @__PURE__ */ y("div", { className: "ll-expanded__topbar", children: [
|
|
1461
|
+
!Pe && /* @__PURE__ */ y("div", { className: "ll-expanded__topbar-left", children: [
|
|
1462
|
+
/* @__PURE__ */ y("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1463
|
+
/* @__PURE__ */ y(
|
|
1471
1464
|
"button",
|
|
1472
1465
|
{
|
|
1473
1466
|
type: "button",
|
|
@@ -1476,20 +1469,20 @@ const Mr = ({
|
|
|
1476
1469
|
Ie && (h.stopPropagation(), f());
|
|
1477
1470
|
},
|
|
1478
1471
|
"aria-haspopup": Ie ? "listbox" : void 0,
|
|
1479
|
-
"aria-expanded": Ie ?
|
|
1472
|
+
"aria-expanded": Ie ? v : void 0,
|
|
1480
1473
|
children: [
|
|
1481
1474
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
|
|
1482
1475
|
Ie && /* @__PURE__ */ n(bt, {})
|
|
1483
1476
|
]
|
|
1484
1477
|
}
|
|
1485
1478
|
),
|
|
1486
|
-
Ie &&
|
|
1479
|
+
Ie && v && /* @__PURE__ */ n(
|
|
1487
1480
|
"div",
|
|
1488
1481
|
{
|
|
1489
1482
|
className: "ll-hmenu",
|
|
1490
1483
|
onClick: (h) => h.stopPropagation(),
|
|
1491
1484
|
role: "listbox",
|
|
1492
|
-
children: a == null ? void 0 : a.map((h) => /* @__PURE__ */
|
|
1485
|
+
children: a == null ? void 0 : a.map((h) => /* @__PURE__ */ y(
|
|
1493
1486
|
"button",
|
|
1494
1487
|
{
|
|
1495
1488
|
type: "button",
|
|
@@ -1515,14 +1508,14 @@ const Mr = ({
|
|
|
1515
1508
|
}
|
|
1516
1509
|
)
|
|
1517
1510
|
] }),
|
|
1518
|
-
/* @__PURE__ */
|
|
1519
|
-
/* @__PURE__ */
|
|
1511
|
+
/* @__PURE__ */ y("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1512
|
+
/* @__PURE__ */ y(
|
|
1520
1513
|
"button",
|
|
1521
1514
|
{
|
|
1522
1515
|
type: "button",
|
|
1523
1516
|
className: "ll-hpill ll-hpill--compact",
|
|
1524
1517
|
onClick: (h) => {
|
|
1525
|
-
h.stopPropagation(),
|
|
1518
|
+
h.stopPropagation(), w();
|
|
1526
1519
|
},
|
|
1527
1520
|
"aria-haspopup": "listbox",
|
|
1528
1521
|
"aria-expanded": A,
|
|
@@ -1556,12 +1549,12 @@ const Mr = ({
|
|
|
1556
1549
|
/* @__PURE__ */ n(
|
|
1557
1550
|
"span",
|
|
1558
1551
|
{
|
|
1559
|
-
className: `ll-expanded__state ll-expanded__state--${
|
|
1560
|
-
children:
|
|
1552
|
+
className: `ll-expanded__state ll-expanded__state--${_}`,
|
|
1553
|
+
children: _
|
|
1561
1554
|
}
|
|
1562
1555
|
)
|
|
1563
1556
|
] }),
|
|
1564
|
-
/* @__PURE__ */
|
|
1557
|
+
/* @__PURE__ */ y("div", { className: "ll-expanded__header-actions", children: [
|
|
1565
1558
|
ye !== !1 && /* @__PURE__ */ n(
|
|
1566
1559
|
"button",
|
|
1567
1560
|
{
|
|
@@ -1586,18 +1579,18 @@ const Mr = ({
|
|
|
1586
1579
|
)
|
|
1587
1580
|
] })
|
|
1588
1581
|
] }),
|
|
1589
|
-
ne && /* @__PURE__ */
|
|
1582
|
+
ne && /* @__PURE__ */ y("div", { className: "ll-compact-status", "data-state": _, children: [
|
|
1590
1583
|
/* @__PURE__ */ n("span", { className: "ll-compact-status__dot", "aria-hidden": !0 }),
|
|
1591
|
-
/* @__PURE__ */ n("span", { className: "ll-compact-status__label", children:
|
|
1584
|
+
/* @__PURE__ */ n("span", { className: "ll-compact-status__label", children: _ })
|
|
1592
1585
|
] })
|
|
1593
1586
|
] }) : (
|
|
1594
1587
|
// Idle-state header with Live Layer product name + minimize/close.
|
|
1595
1588
|
// Hidden in compact mode — on a 140×210 docked slot the brand pill
|
|
1596
1589
|
// and 40px buttons crowded out the central "Start video call"
|
|
1597
1590
|
// affordance. The user can dismiss by scrolling past the slot.
|
|
1598
|
-
!ne && /* @__PURE__ */
|
|
1591
|
+
!ne && /* @__PURE__ */ y("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
|
|
1599
1592
|
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: it }),
|
|
1600
|
-
/* @__PURE__ */
|
|
1593
|
+
/* @__PURE__ */ y("div", { className: "ll-expanded__header-actions", children: [
|
|
1601
1594
|
ye !== !1 && /* @__PURE__ */ n(
|
|
1602
1595
|
"button",
|
|
1603
1596
|
{
|
|
@@ -1622,9 +1615,9 @@ const Mr = ({
|
|
|
1622
1615
|
] })
|
|
1623
1616
|
),
|
|
1624
1617
|
Ze && /* @__PURE__ */ (() => {
|
|
1625
|
-
const h =
|
|
1626
|
-
return /* @__PURE__ */
|
|
1627
|
-
!D && /* @__PURE__ */
|
|
1618
|
+
const h = C ? "Resume session" : x === "disconnected" ? "Reconnect to agent" : "Start video call";
|
|
1619
|
+
return /* @__PURE__ */ y(Ye, { children: [
|
|
1620
|
+
!D && /* @__PURE__ */ y(
|
|
1628
1621
|
"button",
|
|
1629
1622
|
{
|
|
1630
1623
|
type: "button",
|
|
@@ -1637,7 +1630,7 @@ const Mr = ({
|
|
|
1637
1630
|
]
|
|
1638
1631
|
}
|
|
1639
1632
|
),
|
|
1640
|
-
!ne && /* @__PURE__ */
|
|
1633
|
+
!ne && /* @__PURE__ */ y("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
|
|
1641
1634
|
l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
|
|
1642
1635
|
/* @__PURE__ */ n(
|
|
1643
1636
|
"button",
|
|
@@ -1652,7 +1645,7 @@ const Mr = ({
|
|
|
1652
1645
|
] })
|
|
1653
1646
|
] });
|
|
1654
1647
|
})(),
|
|
1655
|
-
/* @__PURE__ */
|
|
1648
|
+
/* @__PURE__ */ y(
|
|
1656
1649
|
"div",
|
|
1657
1650
|
{
|
|
1658
1651
|
className: `ll-expanded__pip ${Me && (F || H) ? "is-visible" : ""}`,
|
|
@@ -1674,7 +1667,7 @@ const Mr = ({
|
|
|
1674
1667
|
]
|
|
1675
1668
|
}
|
|
1676
1669
|
),
|
|
1677
|
-
Me ? /* @__PURE__ */
|
|
1670
|
+
Me ? /* @__PURE__ */ y("div", { className: "ll-expanded__bottom", children: [
|
|
1678
1671
|
!ne && We && /* @__PURE__ */ n(
|
|
1679
1672
|
"div",
|
|
1680
1673
|
{
|
|
@@ -1691,7 +1684,7 @@ const Mr = ({
|
|
|
1691
1684
|
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: yt })
|
|
1692
1685
|
}
|
|
1693
1686
|
),
|
|
1694
|
-
!Pe && !ne && /* @__PURE__ */
|
|
1687
|
+
!Pe && !ne && /* @__PURE__ */ y("div", { className: "ll-toolbar", onClick: (h) => h.stopPropagation(), children: [
|
|
1695
1688
|
ge && /* @__PURE__ */ n(
|
|
1696
1689
|
"button",
|
|
1697
1690
|
{
|
|
@@ -1703,7 +1696,7 @@ const Mr = ({
|
|
|
1703
1696
|
children: /* @__PURE__ */ n(vn, {})
|
|
1704
1697
|
}
|
|
1705
1698
|
),
|
|
1706
|
-
se && /* @__PURE__ */
|
|
1699
|
+
se && /* @__PURE__ */ y("div", { className: "ll-tool-split", children: [
|
|
1707
1700
|
/* @__PURE__ */ n(
|
|
1708
1701
|
"button",
|
|
1709
1702
|
{
|
|
@@ -1743,7 +1736,7 @@ const Mr = ({
|
|
|
1743
1736
|
}
|
|
1744
1737
|
)
|
|
1745
1738
|
] }),
|
|
1746
|
-
/* @__PURE__ */
|
|
1739
|
+
/* @__PURE__ */ y("div", { className: "ll-tool-split", children: [
|
|
1747
1740
|
/* @__PURE__ */ n(
|
|
1748
1741
|
"button",
|
|
1749
1742
|
{
|
|
@@ -1825,7 +1818,7 @@ const Mr = ({
|
|
|
1825
1818
|
onDisconnect: Xe
|
|
1826
1819
|
}
|
|
1827
1820
|
),
|
|
1828
|
-
!Pe && pe && (ne ? He : !0) && /* @__PURE__ */
|
|
1821
|
+
!Pe && pe && (ne ? He : !0) && /* @__PURE__ */ y("form", { className: "ll-message-input", onSubmit: ot, children: [
|
|
1829
1822
|
/* @__PURE__ */ n(
|
|
1830
1823
|
"input",
|
|
1831
1824
|
{
|
|
@@ -1850,7 +1843,7 @@ const Mr = ({
|
|
|
1850
1843
|
] }) : null,
|
|
1851
1844
|
(() => {
|
|
1852
1845
|
if (R && x !== "error")
|
|
1853
|
-
return /* @__PURE__ */
|
|
1846
|
+
return /* @__PURE__ */ y("div", { className: "ll-expanded__banner", role: "alert", children: [
|
|
1854
1847
|
/* @__PURE__ */ n("span", { children: R }),
|
|
1855
1848
|
/* @__PURE__ */ n(
|
|
1856
1849
|
"button",
|
|
@@ -1865,7 +1858,7 @@ const Mr = ({
|
|
|
1865
1858
|
] });
|
|
1866
1859
|
if (!D || x !== "error") return null;
|
|
1867
1860
|
let h = "Failed to connect", J = "Try again";
|
|
1868
|
-
return D === "MIC_PERMISSION_DENIED" ? h = "Microphone blocked. Allow access to talk." : D === "MIC_NOT_FOUND" ? h = "No microphone found. Plug one in + retry." : D === "MIC_UNAVAILABLE" ? h = "Mic unavailable. Check other apps using it." : D === "AGENT_TIMEOUT" ? h = "Agent didn't pick up. Try again." : D === "CONNECT_FAILED" ? h = "Connection failed. Check your network." : D.length < 80 && (h = D), /* @__PURE__ */
|
|
1861
|
+
return D === "MIC_PERMISSION_DENIED" ? h = "Microphone blocked. Allow access to talk." : D === "MIC_NOT_FOUND" ? h = "No microphone found. Plug one in + retry." : D === "MIC_UNAVAILABLE" ? h = "Mic unavailable. Check other apps using it." : D === "AGENT_TIMEOUT" ? h = "Agent didn't pick up. Try again." : D === "CONNECT_FAILED" ? h = "Connection failed. Check your network." : D.length < 80 && (h = D), /* @__PURE__ */ y("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
|
|
1869
1862
|
/* @__PURE__ */ n("span", { children: h }),
|
|
1870
1863
|
/* @__PURE__ */ n(
|
|
1871
1864
|
"button",
|
|
@@ -1886,7 +1879,7 @@ function bt() {
|
|
|
1886
1879
|
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" }) });
|
|
1887
1880
|
}
|
|
1888
1881
|
function an() {
|
|
1889
|
-
return /* @__PURE__ */
|
|
1882
|
+
return /* @__PURE__ */ y("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
|
|
1890
1883
|
/* @__PURE__ */ n("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1891
1884
|
/* @__PURE__ */ n("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1892
1885
|
] });
|
|
@@ -1895,20 +1888,20 @@ function cn() {
|
|
|
1895
1888
|
return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
|
|
1896
1889
|
}
|
|
1897
1890
|
function vn() {
|
|
1898
|
-
return /* @__PURE__ */
|
|
1891
|
+
return /* @__PURE__ */ y("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1899
1892
|
/* @__PURE__ */ n("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
|
|
1900
1893
|
/* @__PURE__ */ n("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
|
|
1901
1894
|
/* @__PURE__ */ n("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
|
|
1902
1895
|
] });
|
|
1903
1896
|
}
|
|
1904
1897
|
function bn() {
|
|
1905
|
-
return /* @__PURE__ */
|
|
1898
|
+
return /* @__PURE__ */ y("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1906
1899
|
/* @__PURE__ */ n("path", { d: "M23 7l-7 5 7 5V7z" }),
|
|
1907
1900
|
/* @__PURE__ */ n("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
|
|
1908
1901
|
] });
|
|
1909
1902
|
}
|
|
1910
1903
|
function wn({ muted: e }) {
|
|
1911
|
-
return /* @__PURE__ */
|
|
1904
|
+
return /* @__PURE__ */ y("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1912
1905
|
/* @__PURE__ */ n("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
|
|
1913
1906
|
/* @__PURE__ */ n("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
|
|
1914
1907
|
/* @__PURE__ */ n("line", { x1: "12", y1: "19", x2: "12", y2: "23" }),
|
|
@@ -1916,16 +1909,16 @@ function wn({ muted: e }) {
|
|
|
1916
1909
|
] });
|
|
1917
1910
|
}
|
|
1918
1911
|
function _n({ muted: e }) {
|
|
1919
|
-
return /* @__PURE__ */
|
|
1912
|
+
return /* @__PURE__ */ y("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1920
1913
|
/* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
1921
|
-
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */
|
|
1914
|
+
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ y(Ye, { children: [
|
|
1922
1915
|
/* @__PURE__ */ n("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
|
|
1923
1916
|
/* @__PURE__ */ n("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
|
|
1924
1917
|
] })
|
|
1925
1918
|
] });
|
|
1926
1919
|
}
|
|
1927
1920
|
function Tr() {
|
|
1928
|
-
return /* @__PURE__ */
|
|
1921
|
+
return /* @__PURE__ */ y("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1929
1922
|
/* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
|
|
1930
1923
|
/* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
|
|
1931
1924
|
] });
|
|
@@ -1946,22 +1939,22 @@ const sn = ({
|
|
|
1946
1939
|
onPick: o,
|
|
1947
1940
|
anchorRef: i
|
|
1948
1941
|
}) => {
|
|
1949
|
-
const [l, d] =
|
|
1942
|
+
const [l, d] = S(null);
|
|
1950
1943
|
return mn(() => {
|
|
1951
1944
|
const a = () => {
|
|
1952
1945
|
const s = i.current;
|
|
1953
1946
|
if (!s) return;
|
|
1954
|
-
const u = s.getBoundingClientRect(),
|
|
1947
|
+
const u = s.getBoundingClientRect(), v = 126, f = window.innerWidth - 16 - 110, c = u.left + u.width / 2;
|
|
1955
1948
|
d({
|
|
1956
1949
|
top: u.top - 8,
|
|
1957
|
-
left: Math.max(
|
|
1950
|
+
left: Math.max(v, Math.min(f, c))
|
|
1958
1951
|
});
|
|
1959
1952
|
};
|
|
1960
1953
|
return a(), window.addEventListener("scroll", a, !0), window.addEventListener("resize", a), () => {
|
|
1961
1954
|
window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", a);
|
|
1962
1955
|
};
|
|
1963
1956
|
}, [i]), l === null || typeof document > "u" ? null : It(
|
|
1964
|
-
/* @__PURE__ */
|
|
1957
|
+
/* @__PURE__ */ y(
|
|
1965
1958
|
"div",
|
|
1966
1959
|
{
|
|
1967
1960
|
className: "ll-device-menu ll-device-menu--floating",
|
|
@@ -1978,7 +1971,7 @@ const sn = ({
|
|
|
1978
1971
|
/* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
|
|
1979
1972
|
t.map((a, s) => {
|
|
1980
1973
|
const u = r === a.deviceId;
|
|
1981
|
-
return /* @__PURE__ */
|
|
1974
|
+
return /* @__PURE__ */ y(
|
|
1982
1975
|
"button",
|
|
1983
1976
|
{
|
|
1984
1977
|
type: "button",
|
|
@@ -2091,10 +2084,10 @@ function qr(e, t = {}) {
|
|
|
2091
2084
|
);
|
|
2092
2085
|
!R || !q || a.push({ id: R, intent: B, text: q });
|
|
2093
2086
|
}
|
|
2094
|
-
const s = [], u = ["H1", "H2", "H3", "H4", "H5", "H6"],
|
|
2087
|
+
const s = [], u = ["H1", "H2", "H3", "H4", "H5", "H6"], v = Array.from(
|
|
2095
2088
|
r.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
|
2096
2089
|
);
|
|
2097
|
-
for (const k of
|
|
2090
|
+
for (const k of v) {
|
|
2098
2091
|
if (st(k) || !dt(k)) continue;
|
|
2099
2092
|
const R = (k.textContent || "").trim();
|
|
2100
2093
|
R && s.push(`${k.tagName}: ${me(R, 200)}`);
|
|
@@ -2106,29 +2099,29 @@ function qr(e, t = {}) {
|
|
|
2106
2099
|
R.length > 10 && s.push(me(R, dn));
|
|
2107
2100
|
}
|
|
2108
2101
|
const c = s.join(`
|
|
2109
|
-
`), A = [],
|
|
2110
|
-
for (const k of
|
|
2102
|
+
`), A = [], w = Array.from(r.querySelectorAll("a[href]"));
|
|
2103
|
+
for (const k of w) {
|
|
2111
2104
|
if (A.length >= Pr) break;
|
|
2112
2105
|
if (st(k) || !dt(k)) continue;
|
|
2113
2106
|
const R = k.getAttribute("href") || "", B = (k.textContent || "").trim();
|
|
2114
2107
|
!R || !B || A.push({ href: R, text: me(B, 100) });
|
|
2115
2108
|
}
|
|
2116
|
-
const x = [],
|
|
2109
|
+
const x = [], _ = Array.from(
|
|
2117
2110
|
r.querySelectorAll(
|
|
2118
2111
|
"input, textarea, select"
|
|
2119
2112
|
)
|
|
2120
2113
|
);
|
|
2121
|
-
for (const k of
|
|
2114
|
+
for (const k of _) {
|
|
2122
2115
|
if (x.length >= $r) break;
|
|
2123
2116
|
if (st(k) || !xt(k) || !dt(k)) continue;
|
|
2124
2117
|
const R = un(k), B = k instanceof HTMLInputElement ? k.type : k.tagName.toLowerCase();
|
|
2125
2118
|
R && x.push({ label: me(R, 100), type: B });
|
|
2126
2119
|
}
|
|
2127
|
-
const
|
|
2120
|
+
const m = Array.from(
|
|
2128
2121
|
r.querySelectorAll("[data-ll-form]")
|
|
2129
|
-
),
|
|
2130
|
-
for (const k of
|
|
2131
|
-
if (
|
|
2122
|
+
), C = [];
|
|
2123
|
+
for (const k of m) {
|
|
2124
|
+
if (C.length >= Or) break;
|
|
2132
2125
|
if (Mt(k)) continue;
|
|
2133
2126
|
const R = k.getAttribute("data-ll-form") || "";
|
|
2134
2127
|
if (!R) continue;
|
|
@@ -2160,7 +2153,7 @@ function qr(e, t = {}) {
|
|
|
2160
2153
|
const ce = typeof U.validationMessage == "string" ? U.validationMessage : "";
|
|
2161
2154
|
ce && (G.validationMessage = me(ce, 200)), F.push(G);
|
|
2162
2155
|
}
|
|
2163
|
-
|
|
2156
|
+
C.push({ id: R, intent: B, fields: F });
|
|
2164
2157
|
}
|
|
2165
2158
|
const M = {
|
|
2166
2159
|
url: o,
|
|
@@ -2170,7 +2163,7 @@ function qr(e, t = {}) {
|
|
|
2170
2163
|
visibleText: c,
|
|
2171
2164
|
visibleLinks: A,
|
|
2172
2165
|
visibleFields: x,
|
|
2173
|
-
forms:
|
|
2166
|
+
forms: C,
|
|
2174
2167
|
extras: e
|
|
2175
2168
|
};
|
|
2176
2169
|
let D = Ue(JSON.stringify(M.regions)) + Ue(M.visibleText) + Ue(JSON.stringify(M.visibleLinks)) + Ue(JSON.stringify(M.visibleFields));
|
|
@@ -2225,8 +2218,8 @@ function Yr(e) {
|
|
|
2225
2218
|
}
|
|
2226
2219
|
if (o.has(s)) continue;
|
|
2227
2220
|
o.add(s);
|
|
2228
|
-
const
|
|
2229
|
-
i.push({ href: s, text:
|
|
2221
|
+
const v = (d.textContent || "").trim().slice(0, 120);
|
|
2222
|
+
i.push({ href: s, text: v, internal: u });
|
|
2230
2223
|
}
|
|
2231
2224
|
return i;
|
|
2232
2225
|
}
|
|
@@ -2336,15 +2329,15 @@ const ro = /* @__PURE__ */ new Set([
|
|
|
2336
2329
|
sessionBody: a,
|
|
2337
2330
|
soundEffects: s,
|
|
2338
2331
|
experienceMode: u = "WIDGET",
|
|
2339
|
-
autoConnect:
|
|
2332
|
+
autoConnect: v = !1,
|
|
2340
2333
|
displayMode: f,
|
|
2341
2334
|
defaultDisplayMode: c = "expanded",
|
|
2342
2335
|
onDisplayModeChange: A,
|
|
2343
|
-
position:
|
|
2336
|
+
position: w = "bottom-right",
|
|
2344
2337
|
mobileBreakpoint: x = 640,
|
|
2345
|
-
persistKey:
|
|
2346
|
-
disablePersistence:
|
|
2347
|
-
teamMembers:
|
|
2338
|
+
persistKey: _ = "ll-widget",
|
|
2339
|
+
disablePersistence: m = !1,
|
|
2340
|
+
teamMembers: C,
|
|
2348
2341
|
currentTeamMemberId: M,
|
|
2349
2342
|
onTeamMemberChange: D,
|
|
2350
2343
|
idleLoopUrl: k,
|
|
@@ -2388,37 +2381,37 @@ const ro = /* @__PURE__ */ new Set([
|
|
|
2388
2381
|
I(() => {
|
|
2389
2382
|
Fr(), Jr();
|
|
2390
2383
|
}, [Me]);
|
|
2391
|
-
const Ze = M !== void 0, [et, Oe] =
|
|
2392
|
-
var
|
|
2393
|
-
return M ?? ((
|
|
2384
|
+
const Ze = M !== void 0, [et, Oe] = S(() => {
|
|
2385
|
+
var g;
|
|
2386
|
+
return M ?? ((g = C == null ? void 0 : C[0]) == null ? void 0 : g.id);
|
|
2394
2387
|
}), Te = Ze ? M : et, ee = Ge(
|
|
2395
|
-
() => (
|
|
2396
|
-
[
|
|
2388
|
+
() => (C == null ? void 0 : C.find((g) => g.id === Te)) ?? null,
|
|
2389
|
+
[C, Te]
|
|
2397
2390
|
), gt = (ee == null ? void 0 : ee.agentId) ?? o, tt = u === "EMBEDDED", [oe, ie] = or({
|
|
2398
2391
|
value: f,
|
|
2399
2392
|
defaultValue: c,
|
|
2400
2393
|
onChange: A,
|
|
2401
|
-
persistKey:
|
|
2402
|
-
disablePersistence: tt ||
|
|
2403
|
-
}), de = lr(x), ve = Vn(), X = Yn(), ue = Jn(), be = Kn(), He = Xn(), [Lt, nt] =
|
|
2394
|
+
persistKey: _,
|
|
2395
|
+
disablePersistence: tt || m
|
|
2396
|
+
}), de = lr(x), ve = Vn(), X = Yn(), ue = Jn(), be = Kn(), He = Xn(), [Lt, nt] = S(!1), [we, rt] = S(!1), [ot, it] = S(!1), [_e, xe] = S(!1), [We, yt] = S(!1), Be = yr({ baseUrl: l, config: s }), De = N(Be);
|
|
2404
2397
|
De.current = Be;
|
|
2405
2398
|
const h = N(ft), J = N(Je), Et = N(Xe), Ct = N(ht), Tt = N(pt), Dt = N(le), Pt = N(Ke), St = N(Qe), fe = N(null);
|
|
2406
2399
|
h.current = ft, J.current = Je, Et.current = Xe, Ct.current = ht, Tt.current = pt, Dt.current = le, Pt.current = Ke, St.current = Qe;
|
|
2407
|
-
function ke(
|
|
2400
|
+
function ke(g) {
|
|
2408
2401
|
const p = St.current;
|
|
2409
|
-
return p ? p.includes(
|
|
2402
|
+
return p ? p.includes(g) : !0;
|
|
2410
2403
|
}
|
|
2411
|
-
function Le(
|
|
2404
|
+
function Le(g, p) {
|
|
2412
2405
|
console.warn(
|
|
2413
|
-
`[LiveLayer] Agent command "${
|
|
2406
|
+
`[LiveLayer] Agent command "${g}" blocked — capability "${p}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
|
|
2414
2407
|
);
|
|
2415
2408
|
}
|
|
2416
2409
|
const lt = E(
|
|
2417
|
-
(
|
|
2410
|
+
(g) => {
|
|
2418
2411
|
var K, ae, he, ct;
|
|
2419
|
-
const p =
|
|
2412
|
+
const p = g;
|
|
2420
2413
|
if (!(!p.type || typeof p.type != "string")) {
|
|
2421
|
-
if (Ae == null || Ae({ eventName: p.type, data:
|
|
2414
|
+
if (Ae == null || Ae({ eventName: p.type, data: g }), p.type === "navigate") {
|
|
2422
2415
|
if (!ke("navigate")) {
|
|
2423
2416
|
Le("navigate", "navigate");
|
|
2424
2417
|
return;
|
|
@@ -2828,13 +2821,13 @@ const ro = /* @__PURE__ */ new Set([
|
|
|
2828
2821
|
if (P != null && P.subscribeToDataMessages)
|
|
2829
2822
|
return P.subscribeToDataMessages(lt);
|
|
2830
2823
|
}, [P, lt]), fe.current = () => {
|
|
2831
|
-
var
|
|
2832
|
-
return (
|
|
2824
|
+
var g;
|
|
2825
|
+
return (g = Q.getRoom) == null ? void 0 : g.call(Q);
|
|
2833
2826
|
}, I(() => {
|
|
2834
2827
|
var K;
|
|
2835
2828
|
if (typeof window > "u") return;
|
|
2836
|
-
const
|
|
2837
|
-
if (
|
|
2829
|
+
const g = ((K = window.location) == null ? void 0 : K.hostname) || "";
|
|
2830
|
+
if (g === "localhost" || g === "127.0.0.1" || g === "0.0.0.0" || g.endsWith(".local") || g.endsWith(".test"))
|
|
2838
2831
|
return window.__livelayerSimulateCommand = (ae) => {
|
|
2839
2832
|
try {
|
|
2840
2833
|
lt(ae);
|
|
@@ -2845,7 +2838,7 @@ const ro = /* @__PURE__ */ new Set([
|
|
|
2845
2838
|
delete window.__livelayerSimulateCommand;
|
|
2846
2839
|
};
|
|
2847
2840
|
}, [lt]);
|
|
2848
|
-
const
|
|
2841
|
+
const b = Ge(() => P ? {
|
|
2849
2842
|
connectionState: P.connectionState,
|
|
2850
2843
|
agentState: P.agentState,
|
|
2851
2844
|
transcript: P.transcript,
|
|
@@ -2876,18 +2869,18 @@ const ro = /* @__PURE__ */ new Set([
|
|
|
2876
2869
|
disconnect: Q.disconnect,
|
|
2877
2870
|
getRoom: Q.getRoom,
|
|
2878
2871
|
isControlled: !1
|
|
2879
|
-
}, [P, Q]), $t = N(
|
|
2880
|
-
$t.current =
|
|
2872
|
+
}, [P, Q]), $t = N(b);
|
|
2873
|
+
$t.current = b;
|
|
2881
2874
|
const zt = N(P);
|
|
2882
2875
|
zt.current = P, Hn(
|
|
2883
2876
|
r,
|
|
2884
2877
|
() => ({
|
|
2885
|
-
sendData: async (
|
|
2878
|
+
sendData: async (g) => {
|
|
2886
2879
|
var he, ct;
|
|
2887
2880
|
const p = zt.current;
|
|
2888
2881
|
if (p != null && p.publishData) {
|
|
2889
2882
|
try {
|
|
2890
|
-
await p.publishData(
|
|
2883
|
+
await p.publishData(g);
|
|
2891
2884
|
} catch (L) {
|
|
2892
2885
|
console.warn("[AvatarWidget] sendData (controlled) failed:", L);
|
|
2893
2886
|
}
|
|
@@ -2896,7 +2889,7 @@ const ro = /* @__PURE__ */ new Set([
|
|
|
2896
2889
|
const K = (ct = (he = $t.current) == null ? void 0 : he.getRoom) == null ? void 0 : ct.call(he), ae = K == null ? void 0 : K.localParticipant;
|
|
2897
2890
|
if (ae != null && ae.publishData)
|
|
2898
2891
|
try {
|
|
2899
|
-
const L = new TextEncoder().encode(JSON.stringify(
|
|
2892
|
+
const L = new TextEncoder().encode(JSON.stringify(g));
|
|
2900
2893
|
await ae.publishData(L, { reliable: !0 });
|
|
2901
2894
|
} catch (L) {
|
|
2902
2895
|
console.warn("[AvatarWidget] sendData failed:", L);
|
|
@@ -2907,43 +2900,43 @@ const ro = /* @__PURE__ */ new Set([
|
|
|
2907
2900
|
);
|
|
2908
2901
|
const Ot = N(null);
|
|
2909
2902
|
I(() => {
|
|
2910
|
-
const
|
|
2911
|
-
if (!(!
|
|
2912
|
-
return p.appendChild(
|
|
2913
|
-
|
|
2903
|
+
const g = b.videoElement, p = Ot.current;
|
|
2904
|
+
if (!(!g || !p))
|
|
2905
|
+
return p.appendChild(g), () => {
|
|
2906
|
+
g.parentNode === p && p.removeChild(g);
|
|
2914
2907
|
};
|
|
2915
|
-
}, [
|
|
2916
|
-
const
|
|
2917
|
-
if (!
|
|
2918
|
-
ve.attach(
|
|
2919
|
-
const p =
|
|
2908
|
+
}, [b.videoElement]), I(() => {
|
|
2909
|
+
const g = b.audioElement;
|
|
2910
|
+
if (!g) return;
|
|
2911
|
+
ve.attach(g);
|
|
2912
|
+
const p = g.play();
|
|
2920
2913
|
return p && typeof p.catch == "function" && p.catch((K) => {
|
|
2921
2914
|
(K == null ? void 0 : K.name) === "NotAllowedError" && nt(!0);
|
|
2922
2915
|
}), () => {
|
|
2923
2916
|
ve.detach();
|
|
2924
2917
|
};
|
|
2925
|
-
}, [
|
|
2926
|
-
if (
|
|
2927
|
-
const
|
|
2928
|
-
if (
|
|
2929
|
-
return X.setupMic(
|
|
2918
|
+
}, [b.audioElement]), I(() => {
|
|
2919
|
+
if (b.isControlled || b.connectionState !== "connected") return;
|
|
2920
|
+
const g = b.getRoom();
|
|
2921
|
+
if (g)
|
|
2922
|
+
return X.setupMic(g).catch(() => {
|
|
2930
2923
|
}), () => {
|
|
2931
2924
|
X.teardownMic();
|
|
2932
2925
|
};
|
|
2933
|
-
}, [
|
|
2926
|
+
}, [b.isControlled, b.connectionState]), I(() => {
|
|
2934
2927
|
var p;
|
|
2935
|
-
if (
|
|
2936
|
-
const
|
|
2937
|
-
if (
|
|
2938
|
-
return ue.attachRoom(
|
|
2928
|
+
if (b.connectionState !== "connected") return;
|
|
2929
|
+
const g = b.isControlled ? (p = P == null ? void 0 : P.getRoom) == null ? void 0 : p.call(P) : b.getRoom();
|
|
2930
|
+
if (g)
|
|
2931
|
+
return ue.attachRoom(g), be.attachRoom(g), b.isControlled && X.attachRoom(g), He.refresh(), () => {
|
|
2939
2932
|
ue.teardown(), be.teardown();
|
|
2940
2933
|
};
|
|
2941
|
-
}, [
|
|
2942
|
-
const
|
|
2943
|
-
|
|
2944
|
-
}, [
|
|
2945
|
-
const Ln = E((
|
|
2946
|
-
const p = { type: "user_message", text:
|
|
2934
|
+
}, [b.isControlled, b.connectionState, P]), I(() => {
|
|
2935
|
+
const g = b.audioElement;
|
|
2936
|
+
g && (g.muted = We);
|
|
2937
|
+
}, [b.audioElement, We]);
|
|
2938
|
+
const Ln = E((g) => {
|
|
2939
|
+
const p = { type: "user_message", text: g };
|
|
2947
2940
|
if (P != null && P.publishData) {
|
|
2948
2941
|
try {
|
|
2949
2942
|
P.publishData(p);
|
|
@@ -2951,65 +2944,65 @@ const ro = /* @__PURE__ */ new Set([
|
|
|
2951
2944
|
}
|
|
2952
2945
|
return;
|
|
2953
2946
|
}
|
|
2954
|
-
const K =
|
|
2947
|
+
const K = b.getRoom();
|
|
2955
2948
|
if (K)
|
|
2956
2949
|
try {
|
|
2957
2950
|
const ae = new TextEncoder().encode(JSON.stringify(p));
|
|
2958
2951
|
K.localParticipant.publishData(ae, { reliable: !0 });
|
|
2959
2952
|
} catch {
|
|
2960
2953
|
}
|
|
2961
|
-
}, [
|
|
2962
|
-
yt((
|
|
2954
|
+
}, [b, P]), En = E(() => {
|
|
2955
|
+
yt((g) => !g);
|
|
2963
2956
|
}, []);
|
|
2964
2957
|
I(() => {
|
|
2965
|
-
Ne == null || Ne(
|
|
2966
|
-
}, [
|
|
2967
|
-
Se == null || Se(
|
|
2968
|
-
}, [
|
|
2969
|
-
ze == null || ze(
|
|
2970
|
-
}, [
|
|
2971
|
-
Be.setThinking(
|
|
2972
|
-
}, [
|
|
2958
|
+
Ne == null || Ne(b.connectionState), b.connectionState === "connected" ? Ce == null || Ce() : b.connectionState === "disconnected" && ($e == null || $e());
|
|
2959
|
+
}, [b.connectionState, Ce, $e, Ne]), I(() => {
|
|
2960
|
+
Se == null || Se(b.transcript);
|
|
2961
|
+
}, [b.transcript, Se]), I(() => {
|
|
2962
|
+
ze == null || ze(b.agentState);
|
|
2963
|
+
}, [b.agentState, ze]), I(() => {
|
|
2964
|
+
Be.setThinking(b.agentState === "thinking");
|
|
2965
|
+
}, [b.agentState, Be]);
|
|
2973
2966
|
const Ht = N(!1);
|
|
2974
2967
|
I(() => {
|
|
2975
|
-
|
|
2976
|
-
}, [
|
|
2968
|
+
b.isControlled || !v || Ht.current || re && b.connectionState === "idle" && (Ht.current = !0, b.connect());
|
|
2969
|
+
}, [v, b.connectionState, b, re]);
|
|
2977
2970
|
const Cn = E(
|
|
2978
|
-
(
|
|
2979
|
-
const p =
|
|
2980
|
-
p && (it(!1),
|
|
2971
|
+
(g) => {
|
|
2972
|
+
const p = C == null ? void 0 : C.find((K) => K.id === g);
|
|
2973
|
+
p && (it(!1), g !== Te && (rt(!0), b.disconnect(), Ze || Oe(g), D == null || D(p)));
|
|
2981
2974
|
},
|
|
2982
2975
|
[
|
|
2983
|
-
|
|
2976
|
+
C,
|
|
2984
2977
|
Te,
|
|
2985
|
-
|
|
2978
|
+
b,
|
|
2986
2979
|
Ze,
|
|
2987
2980
|
D
|
|
2988
2981
|
]
|
|
2989
2982
|
);
|
|
2990
2983
|
I(() => {
|
|
2991
|
-
we &&
|
|
2992
|
-
}, [
|
|
2984
|
+
we && b.connectionState === "connected" && rt(!1);
|
|
2985
|
+
}, [b.connectionState, we]), I(() => {
|
|
2993
2986
|
if (!ot) return;
|
|
2994
|
-
const
|
|
2987
|
+
const g = (p) => {
|
|
2995
2988
|
p.key === "Escape" && it(!1);
|
|
2996
2989
|
};
|
|
2997
|
-
return window.addEventListener("keydown",
|
|
2990
|
+
return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
|
|
2998
2991
|
}, [ot]);
|
|
2999
|
-
const Sn = !!B || !!(ee != null && ee.avatarImageUrl) ||
|
|
2992
|
+
const Sn = !!B || !!(ee != null && ee.avatarImageUrl) || b.isControlled, at = Qn(gt, l, Sn);
|
|
3000
2993
|
Qe === void 0 && ((Ft = at.info) != null && Ft.capabilities) && (St.current = at.info.capabilities);
|
|
3001
|
-
const vt = (ee == null ? void 0 : ee.name) ?? q ?? ((Ut =
|
|
2994
|
+
const vt = (ee == null ? void 0 : ee.name) ?? q ?? ((Ut = b.agentConfig) == null ? void 0 : Ut.name) ?? ((jt = at.info) == null ? void 0 : jt.name) ?? "Live Layer", Nt = (ee == null ? void 0 : ee.avatarImageUrl) ?? B ?? ((Vt = b.agentConfig) == null ? void 0 : Vt.avatarImageUrl) ?? ((Yt = at.info) == null ? void 0 : Yt.avatarImageUrl) ?? null, Nn = k ?? ((Gt = b.agentConfig) == null ? void 0 : Gt.idleLoopUrl) ?? ((Jt = at.info) == null ? void 0 : Jt.idleLoopUrl) ?? null, An = R ?? null, Rn = E(() => ie("expanded"), [ie]), In = E(
|
|
3002
2995
|
() => ie("minimized"),
|
|
3003
2996
|
[ie]
|
|
3004
2997
|
), Wt = E(() => {
|
|
3005
|
-
|
|
3006
|
-
}, [
|
|
3007
|
-
const
|
|
3008
|
-
|
|
2998
|
+
b.disconnect(), ie("hidden");
|
|
2999
|
+
}, [b, ie]), Mn = E(() => {
|
|
3000
|
+
const g = b.audioElement;
|
|
3001
|
+
g && g.play().then(() => nt(!1)).catch(() => {
|
|
3009
3002
|
});
|
|
3010
|
-
}, [
|
|
3011
|
-
nt(!1),
|
|
3012
|
-
}, [
|
|
3003
|
+
}, [b.audioElement]), Tn = E(() => {
|
|
3004
|
+
nt(!1), b.connect();
|
|
3005
|
+
}, [b]), qe = {
|
|
3013
3006
|
...kt,
|
|
3014
3007
|
...tt ? {} : { zIndex: Ie }
|
|
3015
3008
|
};
|
|
@@ -3027,27 +3020,27 @@ const ro = /* @__PURE__ */ new Set([
|
|
|
3027
3020
|
className: Dn,
|
|
3028
3021
|
style: qe,
|
|
3029
3022
|
"data-display-mode": oe,
|
|
3030
|
-
"data-position":
|
|
3023
|
+
"data-position": w,
|
|
3031
3024
|
"data-experience-mode": u === "EMBEDDED" ? "embedded" : "widget",
|
|
3032
3025
|
children: oe === "expanded" && /* @__PURE__ */ n(
|
|
3033
3026
|
Mr,
|
|
3034
3027
|
{
|
|
3035
|
-
position:
|
|
3028
|
+
position: w,
|
|
3036
3029
|
isMobile: de,
|
|
3037
3030
|
agentName: vt,
|
|
3038
3031
|
avatarImageUrl: Nt,
|
|
3039
3032
|
idleLoopUrl: Nn,
|
|
3040
3033
|
greeting: An,
|
|
3041
3034
|
branding: F,
|
|
3042
|
-
teamMembers:
|
|
3035
|
+
teamMembers: C,
|
|
3043
3036
|
currentTeamMemberId: Te,
|
|
3044
3037
|
isSwitchingTeamMember: we,
|
|
3045
3038
|
teamSwitcherOpen: ot,
|
|
3046
|
-
onToggleTeamSwitcher: () => it((
|
|
3039
|
+
onToggleTeamSwitcher: () => it((g) => !g),
|
|
3047
3040
|
onSelectTeamMember: Cn,
|
|
3048
|
-
connectionState:
|
|
3049
|
-
agentState:
|
|
3050
|
-
transcript:
|
|
3041
|
+
connectionState: b.connectionState,
|
|
3042
|
+
agentState: b.agentState,
|
|
3043
|
+
transcript: b.transcript,
|
|
3051
3044
|
isMuted: X.isMuted,
|
|
3052
3045
|
micDevices: He.mics,
|
|
3053
3046
|
activeMicId: X.activeDeviceId,
|
|
@@ -3068,21 +3061,21 @@ const ro = /* @__PURE__ */ new Set([
|
|
|
3068
3061
|
transforming: pe,
|
|
3069
3062
|
transformingLabel: ye,
|
|
3070
3063
|
languageMenuOpen: _e,
|
|
3071
|
-
onToggleLanguageMenu: () => xe((
|
|
3064
|
+
onToggleLanguageMenu: () => xe((g) => !g),
|
|
3072
3065
|
needsUserGesture: Lt,
|
|
3073
|
-
canResume:
|
|
3066
|
+
canResume: b.canResume,
|
|
3074
3067
|
micError: X.micError,
|
|
3075
|
-
error:
|
|
3068
|
+
error: b.error,
|
|
3076
3069
|
avatarVideoContainerRef: Ot,
|
|
3077
|
-
agentVideoEl:
|
|
3078
|
-
onConnect: () => void
|
|
3079
|
-
onDisconnect: () =>
|
|
3070
|
+
agentVideoEl: b.videoElement,
|
|
3071
|
+
onConnect: () => void b.connect(),
|
|
3072
|
+
onDisconnect: () => b.disconnect(),
|
|
3080
3073
|
onRetry: Tn,
|
|
3081
3074
|
onResumeAudio: Mn,
|
|
3082
3075
|
onToggleMute: X.toggleMute,
|
|
3083
|
-
onSwitchMicDevice: (
|
|
3076
|
+
onSwitchMicDevice: (g) => void X.switchDevice(g),
|
|
3084
3077
|
onToggleCamera: () => void ue.toggle(),
|
|
3085
|
-
onSwitchCameraDevice: (
|
|
3078
|
+
onSwitchCameraDevice: (g) => void ue.switchDevice(g),
|
|
3086
3079
|
onToggleScreenShare: () => void be.toggle(),
|
|
3087
3080
|
onToggleSpeaker: En,
|
|
3088
3081
|
onSendMessage: Ln,
|
|
@@ -3092,7 +3085,7 @@ const ro = /* @__PURE__ */ new Set([
|
|
|
3092
3085
|
}
|
|
3093
3086
|
)
|
|
3094
3087
|
}
|
|
3095
|
-
), Bt = oe === "hidden" || oe === "minimized" ? /* @__PURE__ */
|
|
3088
|
+
), Bt = oe === "hidden" || oe === "minimized" ? /* @__PURE__ */ y(
|
|
3096
3089
|
"div",
|
|
3097
3090
|
{
|
|
3098
3091
|
className: [
|
|
@@ -3103,14 +3096,14 @@ const ro = /* @__PURE__ */ new Set([
|
|
|
3103
3096
|
].join(" "),
|
|
3104
3097
|
style: qe,
|
|
3105
3098
|
"data-display-mode": oe,
|
|
3106
|
-
"data-position":
|
|
3099
|
+
"data-position": w,
|
|
3107
3100
|
children: [
|
|
3108
3101
|
oe === "hidden" && /* @__PURE__ */ n(
|
|
3109
3102
|
kr,
|
|
3110
3103
|
{
|
|
3111
|
-
position:
|
|
3104
|
+
position: w,
|
|
3112
3105
|
isMobile: de,
|
|
3113
|
-
isSpeaking:
|
|
3106
|
+
isSpeaking: b.agentState === "speaking",
|
|
3114
3107
|
onExpand: () => ie("expanded"),
|
|
3115
3108
|
label: `Open ${vt} widget`,
|
|
3116
3109
|
avatarImageUrl: Nt,
|
|
@@ -3121,11 +3114,11 @@ const ro = /* @__PURE__ */ new Set([
|
|
|
3121
3114
|
oe === "minimized" && /* @__PURE__ */ n(
|
|
3122
3115
|
Er,
|
|
3123
3116
|
{
|
|
3124
|
-
position:
|
|
3117
|
+
position: w,
|
|
3125
3118
|
isMobile: de,
|
|
3126
3119
|
agentName: vt,
|
|
3127
3120
|
avatarImageUrl: Nt,
|
|
3128
|
-
agentState:
|
|
3121
|
+
agentState: b.agentState,
|
|
3129
3122
|
isMuted: X.isMuted,
|
|
3130
3123
|
audioLevel: ve,
|
|
3131
3124
|
onExpand: Rn,
|
|
@@ -3136,7 +3129,7 @@ const ro = /* @__PURE__ */ new Set([
|
|
|
3136
3129
|
]
|
|
3137
3130
|
}
|
|
3138
3131
|
) : null, qt = se ?? (typeof document < "u" ? document.body : null);
|
|
3139
|
-
return /* @__PURE__ */
|
|
3132
|
+
return /* @__PURE__ */ y(Ye, { children: [
|
|
3140
3133
|
Pn,
|
|
3141
3134
|
Bt && qt && It(Bt, qt)
|
|
3142
3135
|
] });
|
|
@@ -3160,7 +3153,7 @@ const mo = ({
|
|
|
3160
3153
|
}) => {
|
|
3161
3154
|
const a = N(null), s = N(null), u = N(i);
|
|
3162
3155
|
u.current = i;
|
|
3163
|
-
const
|
|
3156
|
+
const v = E((f) => {
|
|
3164
3157
|
var A;
|
|
3165
3158
|
const c = f.detail;
|
|
3166
3159
|
(A = u.current) == null || A.call(u, c);
|
|
@@ -3169,8 +3162,8 @@ const mo = ({
|
|
|
3169
3162
|
const f = a.current;
|
|
3170
3163
|
if (!f) return;
|
|
3171
3164
|
const c = document.createElement("livelayer-widget");
|
|
3172
|
-
return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), o && c.setAttribute("mode", o), c.addEventListener("agent-event",
|
|
3173
|
-
c.removeEventListener("agent-event",
|
|
3165
|
+
return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), o && c.setAttribute("mode", o), c.addEventListener("agent-event", v), f.appendChild(c), s.current = c, () => {
|
|
3166
|
+
c.removeEventListener("agent-event", v), f.removeChild(c), s.current = null;
|
|
3174
3167
|
};
|
|
3175
3168
|
}, [e]), I(() => {
|
|
3176
3169
|
s.current && (o ? s.current.setAttribute("mode", o) : s.current.removeAttribute("mode"));
|
|
@@ -3207,7 +3200,7 @@ const mo = ({
|
|
|
3207
3200
|
const { name: o, label: i, labelClassName: l } = t, d = { name: o, "data-ll-field": o };
|
|
3208
3201
|
let a;
|
|
3209
3202
|
if ("as" in t && t.as === "textarea") {
|
|
3210
|
-
const { name: s, label: u, labelClassName:
|
|
3203
|
+
const { name: s, label: u, labelClassName: v, as: f, ...c } = t;
|
|
3211
3204
|
a = /* @__PURE__ */ n(
|
|
3212
3205
|
"textarea",
|
|
3213
3206
|
{
|
|
@@ -3217,7 +3210,7 @@ const mo = ({
|
|
|
3217
3210
|
}
|
|
3218
3211
|
);
|
|
3219
3212
|
} else if ("as" in t && t.as === "select") {
|
|
3220
|
-
const { name: s, label: u, labelClassName:
|
|
3213
|
+
const { name: s, label: u, labelClassName: v, as: f, children: c, ...A } = t;
|
|
3221
3214
|
a = /* @__PURE__ */ n(
|
|
3222
3215
|
"select",
|
|
3223
3216
|
{
|
|
@@ -3228,7 +3221,7 @@ const mo = ({
|
|
|
3228
3221
|
}
|
|
3229
3222
|
);
|
|
3230
3223
|
} else {
|
|
3231
|
-
const { name: s, label: u, labelClassName:
|
|
3224
|
+
const { name: s, label: u, labelClassName: v, as: f, ...c } = t;
|
|
3232
3225
|
a = /* @__PURE__ */ n(
|
|
3233
3226
|
"input",
|
|
3234
3227
|
{
|
|
@@ -3238,7 +3231,7 @@ const mo = ({
|
|
|
3238
3231
|
}
|
|
3239
3232
|
);
|
|
3240
3233
|
}
|
|
3241
|
-
return i === void 0 ? a : /* @__PURE__ */
|
|
3234
|
+
return i === void 0 ? a : /* @__PURE__ */ y("label", { className: l, children: [
|
|
3242
3235
|
i,
|
|
3243
3236
|
a
|
|
3244
3237
|
] });
|
|
@@ -3250,11 +3243,11 @@ function bo({
|
|
|
3250
3243
|
defaultOpen: t = !1,
|
|
3251
3244
|
storageKey: r = "ll-debug-open"
|
|
3252
3245
|
}) {
|
|
3253
|
-
const [o, i] =
|
|
3246
|
+
const [o, i] = S(t), [l, d] = S([]), [a, s] = S(""), [u, v] = S(!1), f = N(/* @__PURE__ */ new Set()), c = N([]), A = N(u);
|
|
3254
3247
|
A.current = u, I(() => {
|
|
3255
3248
|
try {
|
|
3256
|
-
const
|
|
3257
|
-
|
|
3249
|
+
const _ = localStorage.getItem(r);
|
|
3250
|
+
_ === "1" && i(!0), _ === "0" && i(!1);
|
|
3258
3251
|
} catch {
|
|
3259
3252
|
}
|
|
3260
3253
|
}, [r]), I(() => {
|
|
@@ -3263,33 +3256,33 @@ function bo({
|
|
|
3263
3256
|
} catch {
|
|
3264
3257
|
}
|
|
3265
3258
|
}, [o, r]), I(() => {
|
|
3266
|
-
const
|
|
3267
|
-
(
|
|
3259
|
+
const _ = (m) => {
|
|
3260
|
+
(m.metaKey || m.ctrlKey) && m.shiftKey && m.key.toLowerCase() === "l" && (m.preventDefault(), i((C) => !C));
|
|
3268
3261
|
};
|
|
3269
|
-
return window.addEventListener("keydown",
|
|
3262
|
+
return window.addEventListener("keydown", _), () => window.removeEventListener("keydown", _);
|
|
3270
3263
|
}, []), I(() => {
|
|
3271
|
-
const
|
|
3264
|
+
const _ = setInterval(() => {
|
|
3272
3265
|
if (c.current.length === 0 || A.current) return;
|
|
3273
|
-
const
|
|
3266
|
+
const m = c.current.splice(0, c.current.length);
|
|
3274
3267
|
d(
|
|
3275
|
-
(
|
|
3268
|
+
(C) => [...m.reverse(), ...C].slice(0, 200)
|
|
3276
3269
|
);
|
|
3277
3270
|
}, 100);
|
|
3278
|
-
return () => clearInterval(
|
|
3271
|
+
return () => clearInterval(_);
|
|
3279
3272
|
}, []);
|
|
3280
|
-
const
|
|
3273
|
+
const w = N(!1);
|
|
3281
3274
|
if (I(() => {
|
|
3282
|
-
!e ||
|
|
3275
|
+
!e || w.current || (w.current = !0, e((_) => {
|
|
3283
3276
|
c.current.push({
|
|
3284
3277
|
id: hn++,
|
|
3285
3278
|
ts: Date.now(),
|
|
3286
3279
|
kind: "event",
|
|
3287
|
-
type:
|
|
3288
|
-
data:
|
|
3280
|
+
type: _.eventName,
|
|
3281
|
+
data: _.data
|
|
3289
3282
|
});
|
|
3290
3283
|
}));
|
|
3291
3284
|
}, [e]), I(() => {
|
|
3292
|
-
const
|
|
3285
|
+
const _ = console.warn, m = console.log, C = (M, D) => function(...k) {
|
|
3293
3286
|
try {
|
|
3294
3287
|
const R = typeof k[0] == "string" ? k[0] : "";
|
|
3295
3288
|
R.startsWith("[LiveLayer]") && c.current.push({
|
|
@@ -3303,8 +3296,8 @@ function bo({
|
|
|
3303
3296
|
}
|
|
3304
3297
|
return D.apply(this, k);
|
|
3305
3298
|
};
|
|
3306
|
-
return console.warn =
|
|
3307
|
-
console.warn =
|
|
3299
|
+
return console.warn = C("warn", _), console.log = C("log", m), () => {
|
|
3300
|
+
console.warn = _, console.log = m;
|
|
3308
3301
|
};
|
|
3309
3302
|
}, []), !o)
|
|
3310
3303
|
return /* @__PURE__ */ n(
|
|
@@ -3333,12 +3326,12 @@ function bo({
|
|
|
3333
3326
|
children: "🛰 LL debug"
|
|
3334
3327
|
}
|
|
3335
3328
|
);
|
|
3336
|
-
const x = l.filter((
|
|
3329
|
+
const x = l.filter((_) => {
|
|
3337
3330
|
if (!a) return !0;
|
|
3338
|
-
const
|
|
3339
|
-
return
|
|
3331
|
+
const m = a.toLowerCase();
|
|
3332
|
+
return _.type.toLowerCase().includes(m) || JSON.stringify(_.data || {}).toLowerCase().includes(m);
|
|
3340
3333
|
});
|
|
3341
|
-
return /* @__PURE__ */
|
|
3334
|
+
return /* @__PURE__ */ y(
|
|
3342
3335
|
"div",
|
|
3343
3336
|
{
|
|
3344
3337
|
style: {
|
|
@@ -3360,7 +3353,7 @@ function bo({
|
|
|
3360
3353
|
overflow: "hidden"
|
|
3361
3354
|
},
|
|
3362
3355
|
children: [
|
|
3363
|
-
/* @__PURE__ */
|
|
3356
|
+
/* @__PURE__ */ y(
|
|
3364
3357
|
"div",
|
|
3365
3358
|
{
|
|
3366
3359
|
style: {
|
|
@@ -3373,7 +3366,7 @@ function bo({
|
|
|
3373
3366
|
},
|
|
3374
3367
|
children: [
|
|
3375
3368
|
/* @__PURE__ */ n("span", { style: { fontWeight: 600, fontSize: 12 }, children: "LiveLayer debug" }),
|
|
3376
|
-
/* @__PURE__ */
|
|
3369
|
+
/* @__PURE__ */ y("span", { style: { fontSize: 10, color: "rgba(255,255,255,0.4)" }, children: [
|
|
3377
3370
|
l.length,
|
|
3378
3371
|
" event",
|
|
3379
3372
|
l.length === 1 ? "" : "s"
|
|
@@ -3383,7 +3376,7 @@ function bo({
|
|
|
3383
3376
|
"button",
|
|
3384
3377
|
{
|
|
3385
3378
|
type: "button",
|
|
3386
|
-
onClick: () =>
|
|
3379
|
+
onClick: () => v((_) => !_),
|
|
3387
3380
|
style: Rt(u ? "#f59e0b" : "transparent"),
|
|
3388
3381
|
title: "Pause / resume capture",
|
|
3389
3382
|
children: u ? "▶ resume" : "⏸ pause"
|
|
@@ -3420,7 +3413,7 @@ function bo({
|
|
|
3420
3413
|
{
|
|
3421
3414
|
type: "text",
|
|
3422
3415
|
value: a,
|
|
3423
|
-
onChange: (
|
|
3416
|
+
onChange: (_) => s(_.target.value),
|
|
3424
3417
|
placeholder: "filter by type or data…",
|
|
3425
3418
|
style: {
|
|
3426
3419
|
margin: 8,
|
|
@@ -3442,7 +3435,7 @@ function bo({
|
|
|
3442
3435
|
overflowY: "auto",
|
|
3443
3436
|
padding: "0 8px 8px"
|
|
3444
3437
|
},
|
|
3445
|
-
children: x.length === 0 ? /* @__PURE__ */
|
|
3438
|
+
children: x.length === 0 ? /* @__PURE__ */ y(
|
|
3446
3439
|
"div",
|
|
3447
3440
|
{
|
|
3448
3441
|
style: {
|
|
@@ -3472,16 +3465,16 @@ function bo({
|
|
|
3472
3465
|
)
|
|
3473
3466
|
]
|
|
3474
3467
|
}
|
|
3475
|
-
) : x.map((
|
|
3468
|
+
) : x.map((_) => /* @__PURE__ */ n(
|
|
3476
3469
|
io,
|
|
3477
3470
|
{
|
|
3478
|
-
entry:
|
|
3479
|
-
expanded: f.current.has(
|
|
3471
|
+
entry: _,
|
|
3472
|
+
expanded: f.current.has(_.id),
|
|
3480
3473
|
onToggle: () => {
|
|
3481
|
-
f.current.has(
|
|
3474
|
+
f.current.has(_.id) ? f.current.delete(_.id) : f.current.add(_.id), d((m) => [...m]);
|
|
3482
3475
|
}
|
|
3483
3476
|
},
|
|
3484
|
-
|
|
3477
|
+
_.id
|
|
3485
3478
|
))
|
|
3486
3479
|
}
|
|
3487
3480
|
)
|
|
@@ -3497,7 +3490,7 @@ function io({
|
|
|
3497
3490
|
const o = e.kind === "warn" ? "#f59e0b" : e.type.startsWith("[LiveLayer]") ? "#94a3b8" : e.type === "navigate" || e.type === "scroll_page" || e.type === "scroll_to" || e.type === "click" ? "#22c55e" : e.type === "fill_form" || e.type === "submit_form" || e.type === "focus_field" ? "#a78bfa" : e.type === "request_page_context" || e.type === "request_routes" ? "#38bdf8" : e.type === "agent_state" ? "#facc15" : "#cbd5e1", i = new Date(e.ts).toLocaleTimeString("en-US", {
|
|
3498
3491
|
hour12: !1
|
|
3499
3492
|
});
|
|
3500
|
-
return /* @__PURE__ */
|
|
3493
|
+
return /* @__PURE__ */ y(
|
|
3501
3494
|
"button",
|
|
3502
3495
|
{
|
|
3503
3496
|
type: "button",
|
|
@@ -3515,7 +3508,7 @@ function io({
|
|
|
3515
3508
|
lineHeight: 1.4
|
|
3516
3509
|
},
|
|
3517
3510
|
children: [
|
|
3518
|
-
/* @__PURE__ */
|
|
3511
|
+
/* @__PURE__ */ y("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
3519
3512
|
/* @__PURE__ */ n(
|
|
3520
3513
|
"span",
|
|
3521
3514
|
{
|
|
@@ -3578,7 +3571,7 @@ function lo(e) {
|
|
|
3578
3571
|
}
|
|
3579
3572
|
}
|
|
3580
3573
|
function wo() {
|
|
3581
|
-
const [e, t] =
|
|
3574
|
+
const [e, t] = S([]), r = E((i) => {
|
|
3582
3575
|
t((l) => {
|
|
3583
3576
|
const d = l.findIndex((a) => a.id === i.id);
|
|
3584
3577
|
if (d >= 0) {
|