@livelayer/react 0.12.6 → 0.13.0
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/README.md +23 -10
- package/dist/index.d.ts +35 -0
- package/dist/index.js +3 -3
- package/dist/index.mjs +516 -502
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as w, jsx as n, Fragment as
|
|
3
|
-
import { Component as Un, useState as E, useRef as N, useEffect as
|
|
2
|
+
import { jsxs as w, jsx as n, Fragment as Pe } from "react/jsx-runtime";
|
|
3
|
+
import { Component as Un, useState as E, useRef as N, useEffect as I, useCallback as C, useMemo as Ge, useLayoutEffect as wn, forwardRef as Dt, useImperativeHandle as jn, createElement as Vn } from "react";
|
|
4
4
|
import { createPortal as Pt } from "react-dom";
|
|
5
|
-
import { LiveKitSession as Yn } from "@livelayer/sdk";
|
|
6
|
-
import {
|
|
7
|
-
|
|
5
|
+
import { LiveKitSession as Yn, registerFields as Gn } from "@livelayer/sdk";
|
|
6
|
+
import { clearFieldRegistry as Do, getRegisteredFields as Po, registerFields as $o, setFieldValue as zo } from "@livelayer/sdk";
|
|
7
|
+
import { createLocalAudioTrack as Jn, Track as _n, createLocalVideoTrack as Kn } from "livekit-client";
|
|
8
|
+
class Xn extends Un {
|
|
8
9
|
constructor() {
|
|
9
10
|
super(...arguments), this.state = { hasError: !1, error: null }, this.reset = () => {
|
|
10
11
|
this.setState({ hasError: !1, error: null });
|
|
@@ -34,16 +35,16 @@ class Kn extends Un {
|
|
|
34
35
|
] }) : this.props.children;
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
-
const [t, r] = E("idle"), [o, i] = E("idle"), [l,
|
|
39
|
-
S.current = e.onDataMessage,
|
|
38
|
+
function Qn(e) {
|
|
39
|
+
const [t, r] = E("idle"), [o, i] = E("idle"), [l, s] = E([]), [a, c] = E(null), [p, v] = E(null), [f, u] = E(null), [R, L] = E(!1), [_, h] = E(null), b = N(null), S = N(e.onDataMessage);
|
|
40
|
+
S.current = e.onDataMessage, I(() => {
|
|
40
41
|
const g = {
|
|
41
42
|
onConnectionStateChange: (H) => {
|
|
42
43
|
r(H), H === "connected" && h(null);
|
|
43
44
|
},
|
|
44
45
|
onAgentStateChange: i,
|
|
45
|
-
onTranscript: (H) =>
|
|
46
|
-
onAgentConfig:
|
|
46
|
+
onTranscript: (H) => s([...H]),
|
|
47
|
+
onAgentConfig: c,
|
|
47
48
|
onAudioTrack: (H) => u(H),
|
|
48
49
|
onVideoTrack: (H) => v(H),
|
|
49
50
|
onVideoTrackRemoved: () => v(null),
|
|
@@ -63,7 +64,7 @@ function Xn(e) {
|
|
|
63
64
|
},
|
|
64
65
|
g
|
|
65
66
|
);
|
|
66
|
-
return b.current = P, r("idle"), i("idle"),
|
|
67
|
+
return b.current = P, r("idle"), i("idle"), s([]), c(null), v(null), u(null), L(!1), h(null), () => {
|
|
67
68
|
var H;
|
|
68
69
|
(H = P.destroy) == null || H.call(P), b.current = null;
|
|
69
70
|
};
|
|
@@ -96,7 +97,7 @@ function Xn(e) {
|
|
|
96
97
|
agentConfig: a,
|
|
97
98
|
videoElement: p,
|
|
98
99
|
audioElement: f,
|
|
99
|
-
canResume:
|
|
100
|
+
canResume: R,
|
|
100
101
|
error: _,
|
|
101
102
|
connect: T,
|
|
102
103
|
disconnect: A,
|
|
@@ -104,8 +105,8 @@ function Xn(e) {
|
|
|
104
105
|
session: b.current
|
|
105
106
|
};
|
|
106
107
|
}
|
|
107
|
-
function
|
|
108
|
-
const e = N(null), t = N(null), r = N(null), o = N(null), i = N(/* @__PURE__ */ new Set()), l = N(null),
|
|
108
|
+
function Zn() {
|
|
109
|
+
const e = N(null), t = N(null), r = N(null), o = N(null), i = N(/* @__PURE__ */ new Set()), l = N(null), s = C(() => {
|
|
109
110
|
const f = t.current;
|
|
110
111
|
if (!f) {
|
|
111
112
|
o.current = null;
|
|
@@ -116,21 +117,21 @@ function Qn() {
|
|
|
116
117
|
));
|
|
117
118
|
const u = l.current;
|
|
118
119
|
f.getByteFrequencyData(u);
|
|
119
|
-
let
|
|
120
|
-
for (let _ = 0; _ < u.length; _++)
|
|
121
|
-
const L =
|
|
120
|
+
let R = 0;
|
|
121
|
+
for (let _ = 0; _ < u.length; _++) R += u[_];
|
|
122
|
+
const L = R / u.length / 255;
|
|
122
123
|
for (const _ of i.current)
|
|
123
124
|
try {
|
|
124
125
|
_(L);
|
|
125
126
|
} catch (h) {
|
|
126
127
|
console.error("[useAudioLevel] subscriber threw:", h);
|
|
127
128
|
}
|
|
128
|
-
o.current = requestAnimationFrame(
|
|
129
|
+
o.current = requestAnimationFrame(s);
|
|
129
130
|
}, []), a = C(() => {
|
|
130
131
|
if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
|
|
131
132
|
const f = new AudioContext(), u = f.createAnalyser();
|
|
132
133
|
u.fftSize = 64, u.connect(f.destination), e.current = f, t.current = u;
|
|
133
|
-
}, []),
|
|
134
|
+
}, []), c = C(
|
|
134
135
|
(f) => {
|
|
135
136
|
if (a(), !(!e.current || !t.current)) {
|
|
136
137
|
if (r.current) {
|
|
@@ -147,10 +148,10 @@ function Qn() {
|
|
|
147
148
|
console.warn("[useAudioLevel] createMediaElementSource failed:", u);
|
|
148
149
|
return;
|
|
149
150
|
}
|
|
150
|
-
o.current === null && (o.current = requestAnimationFrame(
|
|
151
|
+
o.current === null && (o.current = requestAnimationFrame(s));
|
|
151
152
|
}
|
|
152
153
|
},
|
|
153
|
-
[a,
|
|
154
|
+
[a, s]
|
|
154
155
|
), p = C(() => {
|
|
155
156
|
if (o.current !== null && (cancelAnimationFrame(o.current), o.current = null), r.current) {
|
|
156
157
|
try {
|
|
@@ -162,7 +163,7 @@ function Qn() {
|
|
|
162
163
|
}, []), v = C((f) => (i.current.add(f), () => {
|
|
163
164
|
i.current.delete(f);
|
|
164
165
|
}), []);
|
|
165
|
-
return
|
|
166
|
+
return I(() => () => {
|
|
166
167
|
if (p(), t.current) {
|
|
167
168
|
try {
|
|
168
169
|
t.current.disconnect();
|
|
@@ -178,25 +179,25 @@ function Qn() {
|
|
|
178
179
|
e.current = null;
|
|
179
180
|
}
|
|
180
181
|
i.current.clear(), l.current = null;
|
|
181
|
-
}, [p]), { attach:
|
|
182
|
+
}, [p]), { attach: c, detach: p, subscribe: v };
|
|
182
183
|
}
|
|
183
|
-
function
|
|
184
|
-
const [e, t] = E(!1), [r, o] = E(""), [i, l] = E(null),
|
|
184
|
+
function er() {
|
|
185
|
+
const [e, t] = E(!1), [r, o] = E(""), [i, l] = E(null), s = N(null), a = N(null), c = C(async (L) => {
|
|
185
186
|
var _, h;
|
|
186
|
-
if (
|
|
187
|
+
if (s.current && a.current) {
|
|
187
188
|
try {
|
|
188
|
-
await a.current.localParticipant.unpublishTrack(
|
|
189
|
+
await a.current.localParticipant.unpublishTrack(s.current);
|
|
189
190
|
} catch {
|
|
190
191
|
}
|
|
191
|
-
|
|
192
|
+
s.current.stop(), s.current = null;
|
|
192
193
|
}
|
|
193
194
|
a.current = L, l(null);
|
|
194
195
|
try {
|
|
195
|
-
const b = await
|
|
196
|
+
const b = await Jn({
|
|
196
197
|
echoCancellation: !0,
|
|
197
198
|
noiseSuppression: !0
|
|
198
199
|
});
|
|
199
|
-
await L.localParticipant.publishTrack(b),
|
|
200
|
+
await L.localParticipant.publishTrack(b), s.current = b, t(b.isMuted);
|
|
200
201
|
const S = (h = (_ = b.mediaStreamTrack) == null ? void 0 : _.getSettings) == null ? void 0 : h.call(_);
|
|
201
202
|
S != null && S.deviceId && o(S.deviceId);
|
|
202
203
|
} catch (b) {
|
|
@@ -222,7 +223,7 @@ function Zn() {
|
|
|
222
223
|
console.warn("[useMicrophoneState] setMicrophoneEnabled failed:", h), t(!_);
|
|
223
224
|
}
|
|
224
225
|
}, [e]), u = C(() => {
|
|
225
|
-
const L =
|
|
226
|
+
const L = s.current, _ = a.current;
|
|
226
227
|
if (L && _) {
|
|
227
228
|
try {
|
|
228
229
|
_.localParticipant.unpublishTrack(L);
|
|
@@ -230,27 +231,27 @@ function Zn() {
|
|
|
230
231
|
}
|
|
231
232
|
L.stop();
|
|
232
233
|
}
|
|
233
|
-
|
|
234
|
-
}, []),
|
|
234
|
+
s.current = null, a.current = null, t(!1), o("");
|
|
235
|
+
}, []), R = C(() => l(null), []);
|
|
235
236
|
return {
|
|
236
237
|
isMuted: e,
|
|
237
238
|
activeDeviceId: r,
|
|
238
239
|
micError: i,
|
|
239
240
|
toggleMute: f,
|
|
240
|
-
setupMic:
|
|
241
|
+
setupMic: c,
|
|
241
242
|
attachRoom: p,
|
|
242
243
|
switchDevice: v,
|
|
243
244
|
teardownMic: u,
|
|
244
|
-
clearError:
|
|
245
|
+
clearError: R
|
|
245
246
|
};
|
|
246
247
|
}
|
|
247
|
-
const
|
|
248
|
-
function
|
|
249
|
-
const [e, t] = E(!1), [r, o] = E(null), [i, l] = E(null), [
|
|
250
|
-
|
|
248
|
+
const tr = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
249
|
+
function nr() {
|
|
250
|
+
const [e, t] = E(!1), [r, o] = E(null), [i, l] = E(null), [s, a] = E(""), c = N(null), p = N(null), v = C((b) => {
|
|
251
|
+
c.current = b;
|
|
251
252
|
}, []), f = C(() => {
|
|
252
253
|
var T;
|
|
253
|
-
const b =
|
|
254
|
+
const b = c.current, S = p.current;
|
|
254
255
|
if (S && b) {
|
|
255
256
|
const A = b.localParticipant.getTrackPublication(_n.Source.Camera), g = (A == null ? void 0 : A.track) ?? S;
|
|
256
257
|
try {
|
|
@@ -264,13 +265,13 @@ function tr() {
|
|
|
264
265
|
}
|
|
265
266
|
p.current = null, l(null), t(!1);
|
|
266
267
|
}, []), u = C(async (b) => {
|
|
267
|
-
const S =
|
|
268
|
+
const S = c.current;
|
|
268
269
|
if (S) {
|
|
269
270
|
o(null);
|
|
270
271
|
try {
|
|
271
|
-
const T = { ...
|
|
272
|
+
const T = { ...tr };
|
|
272
273
|
b && (T.deviceId = b);
|
|
273
|
-
const A = await
|
|
274
|
+
const A = await Kn(T);
|
|
274
275
|
await S.localParticipant.publishTrack(A), p.current = A;
|
|
275
276
|
const F = A.attach();
|
|
276
277
|
l(F), t(!0), b && a(b);
|
|
@@ -286,45 +287,45 @@ function tr() {
|
|
|
286
287
|
o(A);
|
|
287
288
|
}
|
|
288
289
|
}
|
|
289
|
-
}, []),
|
|
290
|
-
e ? f() : await u(
|
|
291
|
-
}, [e,
|
|
290
|
+
}, []), R = C(async () => {
|
|
291
|
+
e ? f() : await u(s || void 0);
|
|
292
|
+
}, [e, s, f, u]), L = C(async (b) => {
|
|
292
293
|
f(), await u(b);
|
|
293
294
|
}, [f, u]), _ = C(() => {
|
|
294
|
-
f(),
|
|
295
|
+
f(), c.current = null, o(null), a("");
|
|
295
296
|
}, [f]), h = C(() => o(null), []);
|
|
296
|
-
return
|
|
297
|
+
return I(() => () => {
|
|
297
298
|
p.current && p.current.stop();
|
|
298
299
|
}, []), {
|
|
299
300
|
isEnabled: e,
|
|
300
301
|
error: r,
|
|
301
302
|
previewEl: i,
|
|
302
|
-
activeDeviceId:
|
|
303
|
-
toggle:
|
|
303
|
+
activeDeviceId: s,
|
|
304
|
+
toggle: R,
|
|
304
305
|
switchDevice: L,
|
|
305
306
|
attachRoom: v,
|
|
306
307
|
teardown: _,
|
|
307
308
|
clearError: h
|
|
308
309
|
};
|
|
309
310
|
}
|
|
310
|
-
function
|
|
311
|
-
const [e, t] = E(!1), [r, o] = E(null), [i, l] = E(null),
|
|
312
|
-
|
|
313
|
-
}, []),
|
|
314
|
-
const u =
|
|
311
|
+
function rr() {
|
|
312
|
+
const [e, t] = E(!1), [r, o] = E(null), [i, l] = E(null), s = N(null), a = C((u) => {
|
|
313
|
+
s.current = u;
|
|
314
|
+
}, []), c = C(() => l(null), []), p = C(async () => {
|
|
315
|
+
const u = s.current;
|
|
315
316
|
if (u) {
|
|
316
317
|
if (e) {
|
|
317
318
|
try {
|
|
318
319
|
await u.localParticipant.setScreenShareEnabled(!1);
|
|
319
320
|
} catch {
|
|
320
321
|
}
|
|
321
|
-
|
|
322
|
+
c(), t(!1);
|
|
322
323
|
return;
|
|
323
324
|
}
|
|
324
325
|
o(null);
|
|
325
326
|
try {
|
|
326
327
|
await u.localParticipant.setScreenShareEnabled(!0);
|
|
327
|
-
let
|
|
328
|
+
let R = 0;
|
|
328
329
|
const L = () => {
|
|
329
330
|
const _ = u.localParticipant.getTrackPublication(_n.Source.ScreenShare);
|
|
330
331
|
if (_ != null && _.track) {
|
|
@@ -339,49 +340,49 @@ function nr() {
|
|
|
339
340
|
}
|
|
340
341
|
return;
|
|
341
342
|
}
|
|
342
|
-
|
|
343
|
+
R++ < 10 ? setTimeout(L, 100) : t(!0);
|
|
343
344
|
};
|
|
344
345
|
L();
|
|
345
|
-
} catch (
|
|
346
|
-
const L =
|
|
346
|
+
} catch (R) {
|
|
347
|
+
const L = R instanceof Error ? R.name : "";
|
|
347
348
|
L !== "NotAllowedError" && L !== "AbortError" && o("Screen share unavailable. Try again."), t(!1);
|
|
348
349
|
}
|
|
349
350
|
}
|
|
350
|
-
}, [e,
|
|
351
|
-
const u =
|
|
351
|
+
}, [e, c]), v = C(() => {
|
|
352
|
+
const u = s.current;
|
|
352
353
|
if (u && e)
|
|
353
354
|
try {
|
|
354
355
|
u.localParticipant.setScreenShareEnabled(!1);
|
|
355
356
|
} catch {
|
|
356
357
|
}
|
|
357
|
-
|
|
358
|
-
}, [e,
|
|
358
|
+
c(), t(!1), o(null), s.current = null;
|
|
359
|
+
}, [e, c]), f = C(() => o(null), []);
|
|
359
360
|
return { isEnabled: e, error: r, previewEl: i, toggle: p, attachRoom: a, teardown: v, clearError: f };
|
|
360
361
|
}
|
|
361
|
-
function
|
|
362
|
+
function or() {
|
|
362
363
|
const [e, t] = E([]), [r, o] = E([]), i = C(async () => {
|
|
363
364
|
if (!(typeof navigator > "u" || !navigator.mediaDevices))
|
|
364
365
|
try {
|
|
365
366
|
const l = await navigator.mediaDevices.enumerateDevices();
|
|
366
|
-
t(l.filter((
|
|
367
|
+
t(l.filter((s) => s.kind === "audioinput")), o(l.filter((s) => s.kind === "videoinput"));
|
|
367
368
|
} catch {
|
|
368
369
|
}
|
|
369
370
|
}, []);
|
|
370
|
-
return
|
|
371
|
+
return I(() => {
|
|
371
372
|
if (i(), typeof navigator > "u" || !navigator.mediaDevices) return;
|
|
372
373
|
const l = () => void i();
|
|
373
374
|
return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
|
|
374
375
|
}, [i]), { mics: e, cameras: r, refresh: i };
|
|
375
376
|
}
|
|
376
|
-
function
|
|
377
|
-
const [o, i] = E(null), [l,
|
|
378
|
-
return
|
|
377
|
+
function ir(e, t, r = !1) {
|
|
378
|
+
const [o, i] = E(null), [l, s] = E(null), [a, c] = E(!r && !!e);
|
|
379
|
+
return I(() => {
|
|
379
380
|
if (r || !e) {
|
|
380
|
-
|
|
381
|
+
c(!1);
|
|
381
382
|
return;
|
|
382
383
|
}
|
|
383
384
|
const p = new AbortController(), v = t || "https://app.livelayer.studio";
|
|
384
|
-
return
|
|
385
|
+
return c(!0), s(null), fetch(`${v}/api/widget/agent/${encodeURIComponent(e)}`, {
|
|
385
386
|
signal: p.signal
|
|
386
387
|
}).then(async (f) => {
|
|
387
388
|
if (!f.ok) {
|
|
@@ -390,13 +391,13 @@ function or(e, t, r = !1) {
|
|
|
390
391
|
}
|
|
391
392
|
return f.json();
|
|
392
393
|
}).then((f) => {
|
|
393
|
-
p.signal.aborted || (i(f),
|
|
394
|
+
p.signal.aborted || (i(f), c(!1));
|
|
394
395
|
}).catch((f) => {
|
|
395
|
-
p.signal.aborted || (
|
|
396
|
+
p.signal.aborted || (s(f instanceof Error ? f.message : "Agent lookup failed"), c(!1));
|
|
396
397
|
}), () => p.abort();
|
|
397
398
|
}, [e, t, r]), { info: o, error: l, loading: a };
|
|
398
399
|
}
|
|
399
|
-
function
|
|
400
|
+
function lr(e) {
|
|
400
401
|
if (typeof window > "u") return null;
|
|
401
402
|
try {
|
|
402
403
|
return window.localStorage.getItem(e);
|
|
@@ -404,54 +405,54 @@ function ir(e) {
|
|
|
404
405
|
return null;
|
|
405
406
|
}
|
|
406
407
|
}
|
|
407
|
-
function
|
|
408
|
+
function ar(e, t) {
|
|
408
409
|
if (!(typeof window > "u"))
|
|
409
410
|
try {
|
|
410
411
|
window.localStorage.setItem(e, t);
|
|
411
412
|
} catch {
|
|
412
413
|
}
|
|
413
414
|
}
|
|
414
|
-
function
|
|
415
|
+
function sr({
|
|
415
416
|
value: e,
|
|
416
417
|
defaultValue: t = "expanded",
|
|
417
418
|
onChange: r
|
|
418
419
|
} = {}) {
|
|
419
|
-
const o = e !== void 0, [i, l] = E(t),
|
|
420
|
-
(
|
|
421
|
-
|
|
420
|
+
const o = e !== void 0, [i, l] = E(t), s = o ? e : i, a = C(
|
|
421
|
+
(c) => {
|
|
422
|
+
c !== s && (o || l(c), r == null || r(c));
|
|
422
423
|
},
|
|
423
|
-
[
|
|
424
|
+
[s, o, r]
|
|
424
425
|
);
|
|
425
|
-
return [
|
|
426
|
+
return [s, a];
|
|
426
427
|
}
|
|
427
428
|
const cr = ["hidden", "minimized", "expanded"];
|
|
428
|
-
function
|
|
429
|
+
function dr(e) {
|
|
429
430
|
return e && cr.includes(e) ? e : null;
|
|
430
431
|
}
|
|
431
|
-
function
|
|
432
|
+
function ur({
|
|
432
433
|
value: e,
|
|
433
434
|
defaultValue: t = "expanded",
|
|
434
435
|
onChange: r,
|
|
435
436
|
persistKey: o = "ll-widget",
|
|
436
437
|
disablePersistence: i = !1
|
|
437
438
|
} = {}) {
|
|
438
|
-
const l = `${o}:display-mode`,
|
|
439
|
+
const l = `${o}:display-mode`, s = N(!1), [a, c] = sr({
|
|
439
440
|
value: e,
|
|
440
441
|
defaultValue: t,
|
|
441
442
|
onChange: (p) => {
|
|
442
|
-
e === void 0 && !i &&
|
|
443
|
+
e === void 0 && !i && ar(l, p), r == null || r(p);
|
|
443
444
|
}
|
|
444
445
|
});
|
|
445
|
-
return
|
|
446
|
-
if (
|
|
447
|
-
const p =
|
|
448
|
-
p && p !== a &&
|
|
449
|
-
}, []), [a,
|
|
450
|
-
}
|
|
451
|
-
const
|
|
452
|
-
function
|
|
446
|
+
return I(() => {
|
|
447
|
+
if (s.current || (s.current = !0, i || e !== void 0)) return;
|
|
448
|
+
const p = dr(lr(l));
|
|
449
|
+
p && p !== a && c(p);
|
|
450
|
+
}, []), [a, c];
|
|
451
|
+
}
|
|
452
|
+
const fr = 640;
|
|
453
|
+
function pr(e = fr) {
|
|
453
454
|
const [t, r] = E(!1);
|
|
454
|
-
return
|
|
455
|
+
return I(() => {
|
|
455
456
|
if (e === !1) {
|
|
456
457
|
r(!1);
|
|
457
458
|
return;
|
|
@@ -465,7 +466,7 @@ function fr(e = ur) {
|
|
|
465
466
|
}, [e]), t;
|
|
466
467
|
}
|
|
467
468
|
const en = "__llHistoryPatched", _t = "ll:pathname";
|
|
468
|
-
function
|
|
469
|
+
function hr() {
|
|
469
470
|
if (typeof window > "u" || window.history[en]) return;
|
|
470
471
|
const e = window.history.pushState, t = window.history.replaceState;
|
|
471
472
|
window.history.pushState = function(...r) {
|
|
@@ -479,63 +480,63 @@ function pr() {
|
|
|
479
480
|
function tn() {
|
|
480
481
|
return typeof window > "u" ? "/" : window.location.pathname || "/";
|
|
481
482
|
}
|
|
482
|
-
function
|
|
483
|
+
function mr(e) {
|
|
483
484
|
const [t, r] = E(
|
|
484
485
|
() => e ?? tn()
|
|
485
486
|
);
|
|
486
|
-
return
|
|
487
|
+
return I(() => {
|
|
487
488
|
if (e !== void 0) return;
|
|
488
|
-
|
|
489
|
+
hr();
|
|
489
490
|
const o = () => r(tn());
|
|
490
491
|
return o(), window.addEventListener("popstate", o), window.addEventListener(_t, o), () => {
|
|
491
492
|
window.removeEventListener("popstate", o), window.removeEventListener(_t, o);
|
|
492
493
|
};
|
|
493
494
|
}, [e]), e ?? t;
|
|
494
495
|
}
|
|
495
|
-
const nn = /* @__PURE__ */ new Map(),
|
|
496
|
-
function gr(e) {
|
|
497
|
-
return e.replace(mr, "\\$&");
|
|
498
|
-
}
|
|
496
|
+
const nn = /* @__PURE__ */ new Map(), gr = /[\\^$+?.()|{}[\]]/g;
|
|
499
497
|
function yr(e) {
|
|
498
|
+
return e.replace(gr, "\\$&");
|
|
499
|
+
}
|
|
500
|
+
function vr(e) {
|
|
500
501
|
const t = nn.get(e);
|
|
501
502
|
if (t) return t;
|
|
502
|
-
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, o = "", i = "", l = r.replace(/\*\*/g, o).replace(/\*/g, i), a =
|
|
503
|
-
return nn.set(e,
|
|
503
|
+
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, o = "", i = "", l = r.replace(/\*\*/g, o).replace(/\*/g, i), a = yr(l).replace(new RegExp(`\\/${o}`, "g"), "(?:\\/.*)?").replace(new RegExp(o, "g"), ".*").replace(new RegExp(i, "g"), "[^/]+"), c = new RegExp(`^${a}\\/?$`);
|
|
504
|
+
return nn.set(e, c), c;
|
|
504
505
|
}
|
|
505
|
-
function
|
|
506
|
+
function br(e, t) {
|
|
506
507
|
const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
|
|
507
|
-
return
|
|
508
|
+
return vr(e).test(r);
|
|
508
509
|
}
|
|
509
|
-
function
|
|
510
|
-
return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) :
|
|
510
|
+
function wr(e, t) {
|
|
511
|
+
return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : br(e, t);
|
|
511
512
|
}
|
|
512
513
|
function rn(e, t) {
|
|
513
514
|
if (!e || e.length === 0) return !1;
|
|
514
515
|
for (const r of e)
|
|
515
|
-
if (
|
|
516
|
+
if (wr(r, t)) return !0;
|
|
516
517
|
return !1;
|
|
517
518
|
}
|
|
518
|
-
function
|
|
519
|
+
function _r(e, t, r) {
|
|
519
520
|
return e === void 0 ? !0 : rn(r, e) ? !1 : t && t.length > 0 ? rn(t, e) : !0;
|
|
520
521
|
}
|
|
521
|
-
function
|
|
522
|
+
function xr(e, t, r) {
|
|
522
523
|
return Ge(
|
|
523
|
-
() =>
|
|
524
|
+
() => _r(e, t, r),
|
|
524
525
|
[e, t, r]
|
|
525
526
|
);
|
|
526
527
|
}
|
|
527
|
-
function
|
|
528
|
+
function kr(e) {
|
|
528
529
|
return e === !1 ? { navigate: !1, thinking: !1, action: !1 } : e === void 0 || e === !0 ? { navigate: !0, thinking: !0, action: !0 } : {
|
|
529
530
|
navigate: e.navigate !== !1,
|
|
530
531
|
thinking: e.thinking !== !1,
|
|
531
532
|
action: e.action !== !1
|
|
532
533
|
};
|
|
533
534
|
}
|
|
534
|
-
function
|
|
535
|
-
const t = Ge(() =>
|
|
536
|
-
(
|
|
535
|
+
function Lr(e) {
|
|
536
|
+
const t = Ge(() => kr(e.config), [e.config]), r = e.baseUrl.replace(/\/+$/, ""), o = N(null), i = C(
|
|
537
|
+
(c) => {
|
|
537
538
|
try {
|
|
538
|
-
new Audio(`${r}${
|
|
539
|
+
new Audio(`${r}${c}`).play().catch(() => {
|
|
539
540
|
});
|
|
540
541
|
} catch {
|
|
541
542
|
}
|
|
@@ -543,10 +544,10 @@ function kr(e) {
|
|
|
543
544
|
[r]
|
|
544
545
|
), l = C(() => {
|
|
545
546
|
t.navigate && i("/audio/page-change-sound.mp3");
|
|
546
|
-
}, [t.navigate, i]),
|
|
547
|
+
}, [t.navigate, i]), s = C(() => {
|
|
547
548
|
t.action && i("/audio/confirmation-sound.mp3");
|
|
548
549
|
}, [t.action, i]), a = C(
|
|
549
|
-
(
|
|
550
|
+
(c) => {
|
|
550
551
|
if (!t.thinking) {
|
|
551
552
|
if (o.current) {
|
|
552
553
|
try {
|
|
@@ -557,7 +558,7 @@ function kr(e) {
|
|
|
557
558
|
}
|
|
558
559
|
return;
|
|
559
560
|
}
|
|
560
|
-
if (
|
|
561
|
+
if (c) {
|
|
561
562
|
if (o.current) return;
|
|
562
563
|
try {
|
|
563
564
|
const p = new Audio(`${r}/audio/thinking-sound.mp3`);
|
|
@@ -576,7 +577,7 @@ function kr(e) {
|
|
|
576
577
|
},
|
|
577
578
|
[r, t.thinking]
|
|
578
579
|
);
|
|
579
|
-
return
|
|
580
|
+
return I(() => () => {
|
|
580
581
|
if (o.current) {
|
|
581
582
|
try {
|
|
582
583
|
o.current.pause();
|
|
@@ -585,8 +586,8 @@ function kr(e) {
|
|
|
585
586
|
o.current = null;
|
|
586
587
|
}
|
|
587
588
|
}, []), Ge(
|
|
588
|
-
() => ({ playPageChange: l, playConfirmation:
|
|
589
|
-
[l,
|
|
589
|
+
() => ({ playPageChange: l, playConfirmation: s, setThinking: a }),
|
|
590
|
+
[l, s, a]
|
|
590
591
|
);
|
|
591
592
|
}
|
|
592
593
|
const on = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ w(
|
|
@@ -653,7 +654,7 @@ const on = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ w(
|
|
|
653
654
|
}
|
|
654
655
|
)
|
|
655
656
|
}
|
|
656
|
-
),
|
|
657
|
+
), Cr = ({ className: e }) => /* @__PURE__ */ n(
|
|
657
658
|
"svg",
|
|
658
659
|
{
|
|
659
660
|
className: e,
|
|
@@ -664,7 +665,7 @@ const on = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ w(
|
|
|
664
665
|
"aria-hidden": "true",
|
|
665
666
|
children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
666
667
|
}
|
|
667
|
-
),
|
|
668
|
+
), Er = {
|
|
668
669
|
left: 180,
|
|
669
670
|
right: 0,
|
|
670
671
|
up: -90,
|
|
@@ -677,16 +678,16 @@ const on = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ w(
|
|
|
677
678
|
viewBox: "0 0 24 24",
|
|
678
679
|
stroke: "currentColor",
|
|
679
680
|
strokeWidth: 2,
|
|
680
|
-
style: { transform: `rotate(${
|
|
681
|
+
style: { transform: `rotate(${Er[e]}deg)` },
|
|
681
682
|
"aria-hidden": "true",
|
|
682
683
|
children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" })
|
|
683
684
|
}
|
|
684
685
|
);
|
|
685
|
-
function
|
|
686
|
+
function Sr(e) {
|
|
686
687
|
return e === "top-left" || e === "bottom-left" ? "left" : "right";
|
|
687
688
|
}
|
|
688
|
-
const xn = "ll-hidden-tab-center-y",
|
|
689
|
-
function
|
|
689
|
+
const xn = "ll-hidden-tab-center-y", Nr = 5, sn = 16;
|
|
690
|
+
function Ar() {
|
|
690
691
|
if (typeof window > "u") return null;
|
|
691
692
|
try {
|
|
692
693
|
const e = window.localStorage.getItem(xn);
|
|
@@ -697,37 +698,37 @@ function Nr() {
|
|
|
697
698
|
return null;
|
|
698
699
|
}
|
|
699
700
|
}
|
|
700
|
-
function
|
|
701
|
+
function cn(e) {
|
|
701
702
|
if (!(typeof window > "u"))
|
|
702
703
|
try {
|
|
703
704
|
window.localStorage.setItem(xn, String(e));
|
|
704
705
|
} catch {
|
|
705
706
|
}
|
|
706
707
|
}
|
|
707
|
-
const
|
|
708
|
+
const Rr = ({
|
|
708
709
|
position: e,
|
|
709
710
|
isMobile: t,
|
|
710
711
|
isSpeaking: r,
|
|
711
712
|
onExpand: o,
|
|
712
713
|
label: i = "Open widget",
|
|
713
714
|
avatarImageUrl: l,
|
|
714
|
-
agentName:
|
|
715
|
+
agentName: s,
|
|
715
716
|
containerEl: a
|
|
716
717
|
}) => {
|
|
717
|
-
const
|
|
718
|
+
const c = Sr(e), p = c === "right" ? "left" : "right", v = t ? 80 : 72, f = !!l, u = !!a, [R, L] = E(null), [_, h] = E(!1), b = N(null), S = N(!1), T = C(
|
|
718
719
|
(M) => {
|
|
719
720
|
if (typeof window > "u") return M;
|
|
720
|
-
const U = v / 2, B =
|
|
721
|
+
const U = v / 2, B = sn + U, J = window.innerHeight - sn - U;
|
|
721
722
|
return J < B ? Math.max(B, M) : Math.max(B, Math.min(J, M));
|
|
722
723
|
},
|
|
723
724
|
[v]
|
|
724
725
|
);
|
|
725
|
-
|
|
726
|
+
I(() => {
|
|
726
727
|
if (u) {
|
|
727
728
|
L(null);
|
|
728
729
|
return;
|
|
729
730
|
}
|
|
730
|
-
const M =
|
|
731
|
+
const M = Ar();
|
|
731
732
|
L(T(M ?? window.innerHeight / 2));
|
|
732
733
|
const U = () => {
|
|
733
734
|
L((B) => B === null ? null : T(B));
|
|
@@ -736,25 +737,25 @@ const Ar = ({
|
|
|
736
737
|
}, [T, u]);
|
|
737
738
|
const A = C(
|
|
738
739
|
(M) => {
|
|
739
|
-
if (!u && !(M.pointerType === "mouse" && M.button !== 0) &&
|
|
740
|
+
if (!u && !(M.pointerType === "mouse" && M.button !== 0) && R !== null) {
|
|
740
741
|
try {
|
|
741
742
|
M.currentTarget.setPointerCapture(M.pointerId);
|
|
742
743
|
} catch {
|
|
743
744
|
}
|
|
744
745
|
b.current = {
|
|
745
746
|
startClientY: M.clientY,
|
|
746
|
-
startCenterY:
|
|
747
|
+
startCenterY: R,
|
|
747
748
|
moved: !1
|
|
748
749
|
};
|
|
749
750
|
}
|
|
750
751
|
},
|
|
751
|
-
[
|
|
752
|
+
[R, u]
|
|
752
753
|
), F = C(
|
|
753
754
|
(M) => {
|
|
754
755
|
const U = b.current;
|
|
755
756
|
if (!U) return;
|
|
756
757
|
const B = M.clientY - U.startClientY;
|
|
757
|
-
!U.moved && Math.abs(B) >
|
|
758
|
+
!U.moved && Math.abs(B) > Nr && (U.moved = !0, h(!0)), U.moved && L(T(U.startCenterY + B));
|
|
758
759
|
},
|
|
759
760
|
[T]
|
|
760
761
|
), g = C(
|
|
@@ -765,7 +766,7 @@ const Ar = ({
|
|
|
765
766
|
M.currentTarget.releasePointerCapture(M.pointerId);
|
|
766
767
|
} catch {
|
|
767
768
|
}
|
|
768
|
-
b.current = null, U.moved && (h(!1), S.current = !0, L((B) => (B !== null &&
|
|
769
|
+
b.current = null, U.moved && (h(!1), S.current = !0, L((B) => (B !== null && cn(B), B)));
|
|
769
770
|
}
|
|
770
771
|
},
|
|
771
772
|
[]
|
|
@@ -783,20 +784,20 @@ const Ar = ({
|
|
|
783
784
|
L((B) => {
|
|
784
785
|
if (B === null) return B;
|
|
785
786
|
const J = T(B + U);
|
|
786
|
-
return
|
|
787
|
+
return cn(J), J;
|
|
787
788
|
});
|
|
788
789
|
}
|
|
789
790
|
},
|
|
790
791
|
[T]
|
|
791
792
|
), q = [
|
|
792
793
|
"ll-hidden",
|
|
793
|
-
`ll-hidden--${
|
|
794
|
+
`ll-hidden--${c}`,
|
|
794
795
|
t ? "ll-hidden--mobile" : "ll-hidden--desktop",
|
|
795
796
|
r ? "ll-hidden--speaking" : null,
|
|
796
797
|
_ ? "is-dragging" : null,
|
|
797
798
|
f ? "ll-hidden--with-avatar" : null,
|
|
798
799
|
u ? "ll-hidden--scoped" : null
|
|
799
|
-
].filter(Boolean).join(" "), Z =
|
|
800
|
+
].filter(Boolean).join(" "), Z = R === null ? void 0 : { top: `${R - v / 2}px`, transform: "none" };
|
|
800
801
|
return /* @__PURE__ */ n(
|
|
801
802
|
"button",
|
|
802
803
|
{
|
|
@@ -816,7 +817,7 @@ const Ar = ({
|
|
|
816
817
|
// as the click affordance), then the circular avatar photo
|
|
817
818
|
// taking the rest of the tab. Reinforces "this is an
|
|
818
819
|
// avatar-based experience" even when collapsed.
|
|
819
|
-
/* @__PURE__ */ w(
|
|
820
|
+
/* @__PURE__ */ w(Pe, { children: [
|
|
820
821
|
/* @__PURE__ */ n(
|
|
821
822
|
an,
|
|
822
823
|
{
|
|
@@ -828,7 +829,7 @@ const Ar = ({
|
|
|
828
829
|
"img",
|
|
829
830
|
{
|
|
830
831
|
src: l,
|
|
831
|
-
alt:
|
|
832
|
+
alt: s ? `${s} avatar` : "Agent avatar",
|
|
832
833
|
className: "ll-hidden__avatar",
|
|
833
834
|
draggable: !1
|
|
834
835
|
}
|
|
@@ -851,20 +852,20 @@ const Ar = ({
|
|
|
851
852
|
className: i,
|
|
852
853
|
barClassName: l
|
|
853
854
|
}) => {
|
|
854
|
-
const
|
|
855
|
+
const s = N(null), a = N([]), c = Ge(() => {
|
|
855
856
|
const v = (Math.sqrt(5) - 1) / 2;
|
|
856
857
|
return Array.from({ length: t }, (f, u) => 0.5 + u * v % 1 * 0.5);
|
|
857
858
|
}, [t]);
|
|
858
|
-
|
|
859
|
+
I(() => e.subscribe((f) => {
|
|
859
860
|
for (let u = 0; u < t; u++) {
|
|
860
|
-
const
|
|
861
|
-
if (!
|
|
862
|
-
const L = Math.max(o, f * r *
|
|
863
|
-
|
|
861
|
+
const R = a.current[u];
|
|
862
|
+
if (!R) continue;
|
|
863
|
+
const L = Math.max(o, f * r * c[u]);
|
|
864
|
+
R.style.height = `${L}px`;
|
|
864
865
|
}
|
|
865
|
-
}), [e, t, r, o,
|
|
866
|
+
}), [e, t, r, o, c]);
|
|
866
867
|
const p = ["ll-waveform", i].filter(Boolean).join(" ");
|
|
867
|
-
return /* @__PURE__ */ n("div", { ref:
|
|
868
|
+
return /* @__PURE__ */ n("div", { ref: s, className: p, "aria-hidden": "true", children: Array.from({ length: t }, (v, f) => /* @__PURE__ */ n(
|
|
868
869
|
"div",
|
|
869
870
|
{
|
|
870
871
|
ref: (u) => {
|
|
@@ -875,16 +876,16 @@ const Ar = ({
|
|
|
875
876
|
},
|
|
876
877
|
f
|
|
877
878
|
)) });
|
|
878
|
-
},
|
|
879
|
+
}, Mr = ({
|
|
879
880
|
position: e,
|
|
880
881
|
isMobile: t,
|
|
881
882
|
agentName: r,
|
|
882
883
|
avatarImageUrl: o,
|
|
883
884
|
agentState: i,
|
|
884
885
|
isMuted: l,
|
|
885
|
-
audioLevel:
|
|
886
|
+
audioLevel: s,
|
|
886
887
|
onExpand: a,
|
|
887
|
-
onToggleMute:
|
|
888
|
+
onToggleMute: c,
|
|
888
889
|
onClose: p
|
|
889
890
|
}) => t ? /* @__PURE__ */ n(
|
|
890
891
|
"div",
|
|
@@ -914,7 +915,7 @@ const Ar = ({
|
|
|
914
915
|
/* @__PURE__ */ n(
|
|
915
916
|
Ir,
|
|
916
917
|
{
|
|
917
|
-
audioLevel:
|
|
918
|
+
audioLevel: s,
|
|
918
919
|
bars: 16,
|
|
919
920
|
maxHeight: 18,
|
|
920
921
|
className: "ll-minimized__waveform"
|
|
@@ -929,10 +930,10 @@ const Ar = ({
|
|
|
929
930
|
role: "button",
|
|
930
931
|
tabIndex: 0,
|
|
931
932
|
onClick: (v) => {
|
|
932
|
-
v.stopPropagation(),
|
|
933
|
+
v.stopPropagation(), c();
|
|
933
934
|
},
|
|
934
935
|
onKeyDown: (v) => {
|
|
935
|
-
(v.key === "Enter" || v.key === " ") && (v.stopPropagation(), v.preventDefault(),
|
|
936
|
+
(v.key === "Enter" || v.key === " ") && (v.stopPropagation(), v.preventDefault(), c());
|
|
936
937
|
},
|
|
937
938
|
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
938
939
|
children: /* @__PURE__ */ n(on, { muted: l, className: "ll-minimized__icon" })
|
|
@@ -973,7 +974,7 @@ const Ar = ({
|
|
|
973
974
|
{
|
|
974
975
|
type: "button",
|
|
975
976
|
className: "ll-minimized__btn",
|
|
976
|
-
onClick:
|
|
977
|
+
onClick: c,
|
|
977
978
|
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
978
979
|
children: /* @__PURE__ */ n(on, { muted: l, className: "ll-minimized__icon" })
|
|
979
980
|
}
|
|
@@ -995,24 +996,24 @@ const Ar = ({
|
|
|
995
996
|
className: "ll-minimized__btn ll-minimized__btn--close",
|
|
996
997
|
onClick: p,
|
|
997
998
|
"aria-label": "Close widget",
|
|
998
|
-
children: /* @__PURE__ */ n(
|
|
999
|
+
children: /* @__PURE__ */ n(Cr, { className: "ll-minimized__icon" })
|
|
999
1000
|
}
|
|
1000
1001
|
)
|
|
1001
1002
|
] })
|
|
1002
1003
|
] })
|
|
1003
1004
|
}
|
|
1004
|
-
),
|
|
1005
|
+
), Tr = ({
|
|
1005
1006
|
src: e,
|
|
1006
1007
|
alt: t,
|
|
1007
1008
|
preCannedPlaying: r = !1,
|
|
1008
1009
|
className: o,
|
|
1009
1010
|
style: i
|
|
1010
1011
|
}) => {
|
|
1011
|
-
const [l,
|
|
1012
|
-
if (
|
|
1013
|
-
a.current !== e && (a.current = e,
|
|
1012
|
+
const [l, s] = E(!1), a = N(e);
|
|
1013
|
+
if (I(() => {
|
|
1014
|
+
a.current !== e && (a.current = e, s(!1));
|
|
1014
1015
|
}, [e]), !e) return null;
|
|
1015
|
-
const
|
|
1016
|
+
const c = {
|
|
1016
1017
|
position: "absolute",
|
|
1017
1018
|
inset: 0,
|
|
1018
1019
|
width: "100%",
|
|
@@ -1032,47 +1033,47 @@ const Ar = ({
|
|
|
1032
1033
|
src: e,
|
|
1033
1034
|
alt: t,
|
|
1034
1035
|
className: o,
|
|
1035
|
-
style:
|
|
1036
|
+
style: c,
|
|
1036
1037
|
loading: "eager",
|
|
1037
1038
|
fetchPriority: "high",
|
|
1038
|
-
onLoad: () =>
|
|
1039
|
+
onLoad: () => s(!0)
|
|
1039
1040
|
}
|
|
1040
1041
|
)
|
|
1041
1042
|
);
|
|
1042
|
-
},
|
|
1043
|
+
}, Dr = 8, dn = 8, Pr = ({
|
|
1043
1044
|
open: e,
|
|
1044
1045
|
onClose: t,
|
|
1045
1046
|
anchorRef: r,
|
|
1046
1047
|
children: o
|
|
1047
1048
|
}) => {
|
|
1048
|
-
const i = N(null), [l,
|
|
1049
|
+
const i = N(null), [l, s] = E(null);
|
|
1049
1050
|
return wn(() => {
|
|
1050
1051
|
if (!e) {
|
|
1051
|
-
|
|
1052
|
+
s(null);
|
|
1052
1053
|
return;
|
|
1053
1054
|
}
|
|
1054
1055
|
const a = r.current;
|
|
1055
1056
|
if (!a) return;
|
|
1056
|
-
const
|
|
1057
|
+
const c = () => {
|
|
1057
1058
|
const p = a.getBoundingClientRect(), v = {
|
|
1058
|
-
top: p.top -
|
|
1059
|
+
top: p.top - Dr,
|
|
1059
1060
|
left: p.left + p.width / 2
|
|
1060
1061
|
}, f = dn + 90, u = window.innerWidth - dn - 90;
|
|
1061
|
-
v.left < f && (v.left = f), v.left > u && (v.left = u),
|
|
1062
|
+
v.left < f && (v.left = f), v.left > u && (v.left = u), s(v);
|
|
1062
1063
|
};
|
|
1063
|
-
return
|
|
1064
|
-
window.removeEventListener("scroll",
|
|
1064
|
+
return c(), window.addEventListener("scroll", c, !0), window.addEventListener("resize", c), () => {
|
|
1065
|
+
window.removeEventListener("scroll", c, !0), window.removeEventListener("resize", c);
|
|
1065
1066
|
};
|
|
1066
|
-
}, [e, r]),
|
|
1067
|
+
}, [e, r]), I(() => {
|
|
1067
1068
|
if (!e) return;
|
|
1068
1069
|
const a = (p) => {
|
|
1069
1070
|
const v = p.target, f = i.current, u = r.current;
|
|
1070
1071
|
f && f.contains(v) || u && u.contains(v) || t();
|
|
1071
|
-
},
|
|
1072
|
+
}, c = (p) => {
|
|
1072
1073
|
p.key === "Escape" && (p.stopPropagation(), t());
|
|
1073
1074
|
};
|
|
1074
|
-
return document.addEventListener("mousedown", a), document.addEventListener("keydown",
|
|
1075
|
-
document.removeEventListener("mousedown", a), document.removeEventListener("keydown",
|
|
1075
|
+
return document.addEventListener("mousedown", a), document.addEventListener("keydown", c), () => {
|
|
1076
|
+
document.removeEventListener("mousedown", a), document.removeEventListener("keydown", c);
|
|
1076
1077
|
};
|
|
1077
1078
|
}, [e, t, r]), !e || l === null || typeof document > "u" ? null : Pt(
|
|
1078
1079
|
/* @__PURE__ */ n(
|
|
@@ -1094,24 +1095,24 @@ const Ar = ({
|
|
|
1094
1095
|
),
|
|
1095
1096
|
document.body
|
|
1096
1097
|
);
|
|
1097
|
-
},
|
|
1098
|
+
}, $r = ({
|
|
1098
1099
|
isMuted: e,
|
|
1099
1100
|
onToggleMute: t,
|
|
1100
1101
|
isCameraEnabled: r,
|
|
1101
1102
|
onToggleCamera: o,
|
|
1102
1103
|
allowCamera: i,
|
|
1103
1104
|
isScreenShareEnabled: l,
|
|
1104
|
-
onToggleScreenShare:
|
|
1105
|
+
onToggleScreenShare: s,
|
|
1105
1106
|
allowScreenShare: a,
|
|
1106
|
-
isSpeakerMuted:
|
|
1107
|
+
isSpeakerMuted: c,
|
|
1107
1108
|
onToggleSpeaker: p,
|
|
1108
1109
|
allowTyping: v,
|
|
1109
1110
|
isTypingOpen: f,
|
|
1110
1111
|
onToggleTyping: u,
|
|
1111
|
-
onDisconnect:
|
|
1112
|
+
onDisconnect: R
|
|
1112
1113
|
}) => {
|
|
1113
1114
|
const [L, _] = E(!1), h = N(null);
|
|
1114
|
-
return /* @__PURE__ */ w(
|
|
1115
|
+
return /* @__PURE__ */ w(Pe, { children: [
|
|
1115
1116
|
/* @__PURE__ */ w(
|
|
1116
1117
|
"div",
|
|
1117
1118
|
{
|
|
@@ -1139,7 +1140,7 @@ const Ar = ({
|
|
|
1139
1140
|
"aria-label": "More controls",
|
|
1140
1141
|
"aria-haspopup": "menu",
|
|
1141
1142
|
"aria-expanded": L,
|
|
1142
|
-
children: /* @__PURE__ */ n(
|
|
1143
|
+
children: /* @__PURE__ */ n(zr, {})
|
|
1143
1144
|
}
|
|
1144
1145
|
),
|
|
1145
1146
|
/* @__PURE__ */ n(
|
|
@@ -1147,7 +1148,7 @@ const Ar = ({
|
|
|
1147
1148
|
{
|
|
1148
1149
|
type: "button",
|
|
1149
1150
|
className: "ll-tool ll-tool--danger",
|
|
1150
|
-
onClick:
|
|
1151
|
+
onClick: R,
|
|
1151
1152
|
"aria-label": "End conversation",
|
|
1152
1153
|
children: /* @__PURE__ */ n(Sn, {})
|
|
1153
1154
|
}
|
|
@@ -1156,7 +1157,7 @@ const Ar = ({
|
|
|
1156
1157
|
}
|
|
1157
1158
|
),
|
|
1158
1159
|
/* @__PURE__ */ w(
|
|
1159
|
-
|
|
1160
|
+
Pr,
|
|
1160
1161
|
{
|
|
1161
1162
|
open: L,
|
|
1162
1163
|
onClose: () => _(!1),
|
|
@@ -1182,7 +1183,7 @@ const Ar = ({
|
|
|
1182
1183
|
type: "button",
|
|
1183
1184
|
className: `ll-overflow-popover__item ${l ? "is-on" : ""}`,
|
|
1184
1185
|
onClick: () => {
|
|
1185
|
-
|
|
1186
|
+
s(), _(!1);
|
|
1186
1187
|
},
|
|
1187
1188
|
children: [
|
|
1188
1189
|
/* @__PURE__ */ n(kn, {}),
|
|
@@ -1194,13 +1195,13 @@ const Ar = ({
|
|
|
1194
1195
|
"button",
|
|
1195
1196
|
{
|
|
1196
1197
|
type: "button",
|
|
1197
|
-
className: `ll-overflow-popover__item ${
|
|
1198
|
+
className: `ll-overflow-popover__item ${c ? "is-on" : ""}`,
|
|
1198
1199
|
onClick: () => {
|
|
1199
1200
|
p(), _(!1);
|
|
1200
1201
|
},
|
|
1201
1202
|
children: [
|
|
1202
|
-
/* @__PURE__ */ n(En, { muted:
|
|
1203
|
-
/* @__PURE__ */ n("span", { children:
|
|
1203
|
+
/* @__PURE__ */ n(En, { muted: c }),
|
|
1204
|
+
/* @__PURE__ */ n("span", { children: c ? "Unmute speaker" : "Mute speaker" })
|
|
1204
1205
|
]
|
|
1205
1206
|
}
|
|
1206
1207
|
),
|
|
@@ -1213,7 +1214,7 @@ const Ar = ({
|
|
|
1213
1214
|
u(), _(!1);
|
|
1214
1215
|
},
|
|
1215
1216
|
children: [
|
|
1216
|
-
/* @__PURE__ */ n(
|
|
1217
|
+
/* @__PURE__ */ n(Or, {}),
|
|
1217
1218
|
/* @__PURE__ */ n("span", { children: f ? "Hide typing" : "Type a message" })
|
|
1218
1219
|
]
|
|
1219
1220
|
}
|
|
@@ -1236,7 +1237,7 @@ const Ar = ({
|
|
|
1236
1237
|
)
|
|
1237
1238
|
] });
|
|
1238
1239
|
};
|
|
1239
|
-
function
|
|
1240
|
+
function zr() {
|
|
1240
1241
|
return /* @__PURE__ */ w(
|
|
1241
1242
|
"svg",
|
|
1242
1243
|
{
|
|
@@ -1253,7 +1254,7 @@ function $r() {
|
|
|
1253
1254
|
}
|
|
1254
1255
|
);
|
|
1255
1256
|
}
|
|
1256
|
-
function
|
|
1257
|
+
function Or() {
|
|
1257
1258
|
return /* @__PURE__ */ n(
|
|
1258
1259
|
"svg",
|
|
1259
1260
|
{
|
|
@@ -1270,21 +1271,21 @@ function zr() {
|
|
|
1270
1271
|
}
|
|
1271
1272
|
);
|
|
1272
1273
|
}
|
|
1273
|
-
const
|
|
1274
|
+
const Hr = ({
|
|
1274
1275
|
position: e,
|
|
1275
1276
|
isMobile: t,
|
|
1276
1277
|
agentName: r,
|
|
1277
1278
|
avatarImageUrl: o,
|
|
1278
1279
|
idleLoopUrl: i,
|
|
1279
1280
|
greeting: l,
|
|
1280
|
-
branding:
|
|
1281
|
+
branding: s,
|
|
1281
1282
|
teamMembers: a,
|
|
1282
|
-
currentTeamMemberId:
|
|
1283
|
+
currentTeamMemberId: c,
|
|
1283
1284
|
isSwitchingTeamMember: p,
|
|
1284
1285
|
teamSwitcherOpen: v,
|
|
1285
1286
|
onToggleTeamSwitcher: f,
|
|
1286
1287
|
onSelectTeamMember: u,
|
|
1287
|
-
languageMenuOpen:
|
|
1288
|
+
languageMenuOpen: R,
|
|
1288
1289
|
onToggleLanguageMenu: L,
|
|
1289
1290
|
connectionState: _,
|
|
1290
1291
|
agentState: h,
|
|
@@ -1313,68 +1314,68 @@ const Or = ({
|
|
|
1313
1314
|
transforming: dt,
|
|
1314
1315
|
transformingLabel: Je,
|
|
1315
1316
|
avatarVideoContainerRef: ut,
|
|
1316
|
-
agentVideoEl:
|
|
1317
|
+
agentVideoEl: se,
|
|
1317
1318
|
onConnect: Ke,
|
|
1318
1319
|
onDisconnect: Xe,
|
|
1319
1320
|
onRetry: ft,
|
|
1320
1321
|
onResumeAudio: Qe,
|
|
1321
1322
|
onToggleMute: Se,
|
|
1322
|
-
onSwitchMicDevice:
|
|
1323
|
+
onSwitchMicDevice: $e,
|
|
1323
1324
|
onToggleCamera: Ne,
|
|
1324
|
-
onSwitchCameraDevice:
|
|
1325
|
+
onSwitchCameraDevice: ze,
|
|
1325
1326
|
onToggleScreenShare: Ae,
|
|
1326
|
-
onToggleSpeaker:
|
|
1327
|
-
onSendMessage:
|
|
1327
|
+
onToggleSpeaker: Re,
|
|
1328
|
+
onSendMessage: Ie,
|
|
1328
1329
|
onMinimize: Me,
|
|
1329
1330
|
onClose: $,
|
|
1330
1331
|
onClearMicError: kt
|
|
1331
1332
|
}) => {
|
|
1332
1333
|
var mt;
|
|
1333
|
-
const Te = ((a == null ? void 0 : a.length) ?? 0) > 1,
|
|
1334
|
-
|
|
1335
|
-
if (!
|
|
1336
|
-
|
|
1334
|
+
const Te = ((a == null ? void 0 : a.length) ?? 0) > 1, Oe = _ === "connecting" || _ === "connected", ce = _ === "connected", Ze = _ === "idle" || _ === "disconnected" || _ === "error", [De, He] = E(!1);
|
|
1335
|
+
I(() => {
|
|
1336
|
+
if (!se) {
|
|
1337
|
+
He(!1);
|
|
1337
1338
|
return;
|
|
1338
1339
|
}
|
|
1339
|
-
if (!
|
|
1340
|
-
|
|
1340
|
+
if (!se.paused && se.readyState >= 2) {
|
|
1341
|
+
He(!0);
|
|
1341
1342
|
return;
|
|
1342
1343
|
}
|
|
1343
|
-
|
|
1344
|
-
const m = () =>
|
|
1345
|
-
return
|
|
1346
|
-
|
|
1344
|
+
He(!1);
|
|
1345
|
+
const m = () => He(!0);
|
|
1346
|
+
return se.addEventListener("playing", m), se.addEventListener("loadeddata", m), () => {
|
|
1347
|
+
se.removeEventListener("playing", m), se.removeEventListener("loadeddata", m);
|
|
1347
1348
|
};
|
|
1348
|
-
}, [
|
|
1349
|
+
}, [se]);
|
|
1349
1350
|
const [Lt, Le] = E(!1);
|
|
1350
|
-
|
|
1351
|
-
if (!
|
|
1351
|
+
I(() => {
|
|
1352
|
+
if (!ce) {
|
|
1352
1353
|
Le(!1);
|
|
1353
1354
|
return;
|
|
1354
1355
|
}
|
|
1355
1356
|
if (De) return;
|
|
1356
1357
|
const m = setTimeout(() => Le(!0), 8e3);
|
|
1357
1358
|
return () => clearTimeout(m);
|
|
1358
|
-
}, [
|
|
1359
|
-
const ee = _ === "connecting" ||
|
|
1360
|
-
|
|
1359
|
+
}, [ce, De]);
|
|
1360
|
+
const ee = _ === "connecting" || ce && !!o && !De && !Lt, et = N(null), ue = N(null);
|
|
1361
|
+
I(() => {
|
|
1361
1362
|
const m = et.current;
|
|
1362
1363
|
m && (m.innerHTML = "", Z && (Z.style.width = "100%", Z.style.height = "100%", Z.style.objectFit = "cover", Z.style.transform = "scaleX(-1)", m.appendChild(Z)));
|
|
1363
|
-
}, [Z]),
|
|
1364
|
+
}, [Z]), I(() => {
|
|
1364
1365
|
const m = ue.current;
|
|
1365
1366
|
m && (m.innerHTML = "", J && (J.style.width = "100%", J.style.height = "100%", J.style.objectFit = "contain", m.appendChild(J)));
|
|
1366
1367
|
}, [J]);
|
|
1367
|
-
const [
|
|
1368
|
-
|
|
1369
|
-
if (!
|
|
1368
|
+
const [Be, We] = E(!1), [te, le] = E(!1), pt = N(null), ht = N(null);
|
|
1369
|
+
I(() => {
|
|
1370
|
+
if (!Be && !te && !R && !v) return;
|
|
1370
1371
|
const m = () => {
|
|
1371
|
-
|
|
1372
|
+
We(!1), le(!1), R && L(), v && f();
|
|
1372
1373
|
};
|
|
1373
1374
|
return document.addEventListener("click", m), () => document.removeEventListener("click", m);
|
|
1374
1375
|
}, [
|
|
1375
|
-
|
|
1376
|
+
Be,
|
|
1376
1377
|
te,
|
|
1377
|
-
|
|
1378
|
+
R,
|
|
1378
1379
|
v,
|
|
1379
1380
|
L,
|
|
1380
1381
|
f
|
|
@@ -1383,16 +1384,16 @@ const Or = ({
|
|
|
1383
1384
|
(m) => {
|
|
1384
1385
|
m.preventDefault();
|
|
1385
1386
|
const Y = ae.trim();
|
|
1386
|
-
Y && (
|
|
1387
|
+
Y && (Ie(Y), Ee(""));
|
|
1387
1388
|
},
|
|
1388
|
-
[ae,
|
|
1389
|
-
), Ct =
|
|
1389
|
+
[ae, Ie]
|
|
1390
|
+
), Ct = s.productName || "Live Layer";
|
|
1390
1391
|
let fe = null, pe = null;
|
|
1391
1392
|
for (let m = b.length - 1; m >= 0; m--) {
|
|
1392
1393
|
const Y = b[m];
|
|
1393
1394
|
if (!fe && Y.role === "agent" ? fe = Y : !pe && Y.role === "user" && (pe = Y), fe && pe) break;
|
|
1394
1395
|
}
|
|
1395
|
-
const rt =
|
|
1396
|
+
const rt = ce ? (fe == null ? void 0 : fe.text) || null : l || null, qe = ce && (pe == null ? void 0 : pe.text) || null, ot = [
|
|
1396
1397
|
"ll-expanded",
|
|
1397
1398
|
t ? "ll-expanded--mobile" : "ll-expanded--desktop"
|
|
1398
1399
|
].join(" ");
|
|
@@ -1401,20 +1402,20 @@ const Or = ({
|
|
|
1401
1402
|
{
|
|
1402
1403
|
className: ot,
|
|
1403
1404
|
"data-position": e,
|
|
1404
|
-
"data-state":
|
|
1405
|
+
"data-state": ce ? "connected" : Oe ? "connecting" : "idle",
|
|
1405
1406
|
role: "dialog",
|
|
1406
1407
|
"aria-label": `${r} widget`,
|
|
1407
1408
|
children: [
|
|
1408
1409
|
/* @__PURE__ */ w("div", { className: "ll-expanded__bg", children: [
|
|
1409
1410
|
o ? /* @__PURE__ */ n(
|
|
1410
|
-
|
|
1411
|
+
Tr,
|
|
1411
1412
|
{
|
|
1412
1413
|
src: o,
|
|
1413
1414
|
alt: r,
|
|
1414
1415
|
className: "ll-expanded__bg-img"
|
|
1415
1416
|
}
|
|
1416
1417
|
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((mt = r == null ? void 0 : r.charAt(0)) == null ? void 0 : mt.toUpperCase()) || "A" }) }),
|
|
1417
|
-
i && !
|
|
1418
|
+
i && !ce && /* @__PURE__ */ n(
|
|
1418
1419
|
"video",
|
|
1419
1420
|
{
|
|
1420
1421
|
className: "ll-expanded__bg-idle",
|
|
@@ -1431,7 +1432,7 @@ const Or = ({
|
|
|
1431
1432
|
/* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
|
|
1432
1433
|
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: p ? "Switching..." : "Connecting..." })
|
|
1433
1434
|
] }),
|
|
1434
|
-
T &&
|
|
1435
|
+
T && ce && /* @__PURE__ */ w(
|
|
1435
1436
|
"button",
|
|
1436
1437
|
{
|
|
1437
1438
|
type: "button",
|
|
@@ -1456,7 +1457,7 @@ const Or = ({
|
|
|
1456
1457
|
]
|
|
1457
1458
|
}
|
|
1458
1459
|
),
|
|
1459
|
-
|
|
1460
|
+
Oe ? /* @__PURE__ */ w(Pe, { children: [
|
|
1460
1461
|
!ie && /* @__PURE__ */ w("div", { className: "ll-expanded__topbar", children: [
|
|
1461
1462
|
!ve && /* @__PURE__ */ w("div", { className: "ll-expanded__topbar-left", children: [
|
|
1462
1463
|
/* @__PURE__ */ w("div", { className: "ll-expanded__pill-wrap", children: [
|
|
@@ -1486,10 +1487,10 @@ const Or = ({
|
|
|
1486
1487
|
"button",
|
|
1487
1488
|
{
|
|
1488
1489
|
type: "button",
|
|
1489
|
-
className: `ll-hmenu__item ${m.id ===
|
|
1490
|
+
className: `ll-hmenu__item ${m.id === c ? "is-active" : ""}`,
|
|
1490
1491
|
onClick: () => u(m.id),
|
|
1491
1492
|
role: "option",
|
|
1492
|
-
"aria-selected": m.id ===
|
|
1493
|
+
"aria-selected": m.id === c,
|
|
1493
1494
|
children: [
|
|
1494
1495
|
m.avatarImageUrl && /* @__PURE__ */ n(
|
|
1495
1496
|
"img",
|
|
@@ -1518,7 +1519,7 @@ const Or = ({
|
|
|
1518
1519
|
m.stopPropagation(), L();
|
|
1519
1520
|
},
|
|
1520
1521
|
"aria-haspopup": "listbox",
|
|
1521
|
-
"aria-expanded":
|
|
1522
|
+
"aria-expanded": R,
|
|
1522
1523
|
"aria-label": "Language: English",
|
|
1523
1524
|
title: "Language: English",
|
|
1524
1525
|
children: [
|
|
@@ -1527,7 +1528,7 @@ const Or = ({
|
|
|
1527
1528
|
]
|
|
1528
1529
|
}
|
|
1529
1530
|
),
|
|
1530
|
-
|
|
1531
|
+
R && /* @__PURE__ */ n(
|
|
1531
1532
|
"div",
|
|
1532
1533
|
{
|
|
1533
1534
|
className: "ll-hmenu",
|
|
@@ -1616,7 +1617,7 @@ const Or = ({
|
|
|
1616
1617
|
),
|
|
1617
1618
|
Ze && /* @__PURE__ */ (() => {
|
|
1618
1619
|
const m = S ? "Resume session" : _ === "disconnected" ? "Reconnect to agent" : "Start video call";
|
|
1619
|
-
return /* @__PURE__ */ w(
|
|
1620
|
+
return /* @__PURE__ */ w(Pe, { children: [
|
|
1620
1621
|
!A && /* @__PURE__ */ w(
|
|
1621
1622
|
"button",
|
|
1622
1623
|
{
|
|
@@ -1648,7 +1649,7 @@ const Or = ({
|
|
|
1648
1649
|
/* @__PURE__ */ w(
|
|
1649
1650
|
"div",
|
|
1650
1651
|
{
|
|
1651
|
-
className: `ll-expanded__pip ${
|
|
1652
|
+
className: `ll-expanded__pip ${Oe && (q || B) ? "is-visible" : ""}`,
|
|
1652
1653
|
children: [
|
|
1653
1654
|
/* @__PURE__ */ n(
|
|
1654
1655
|
"div",
|
|
@@ -1667,7 +1668,7 @@ const Or = ({
|
|
|
1667
1668
|
]
|
|
1668
1669
|
}
|
|
1669
1670
|
),
|
|
1670
|
-
|
|
1671
|
+
Oe ? /* @__PURE__ */ w("div", { className: "ll-expanded__bottom", children: [
|
|
1671
1672
|
!ie && rt && /* @__PURE__ */ n(
|
|
1672
1673
|
"div",
|
|
1673
1674
|
{
|
|
@@ -1676,12 +1677,12 @@ const Or = ({
|
|
|
1676
1677
|
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: rt })
|
|
1677
1678
|
}
|
|
1678
1679
|
),
|
|
1679
|
-
!ie &&
|
|
1680
|
+
!ie && qe && /* @__PURE__ */ n(
|
|
1680
1681
|
"div",
|
|
1681
1682
|
{
|
|
1682
1683
|
className: "ll-expanded__transcript ll-expanded__transcript--user",
|
|
1683
1684
|
"data-role": "user",
|
|
1684
|
-
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children:
|
|
1685
|
+
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: qe })
|
|
1685
1686
|
}
|
|
1686
1687
|
),
|
|
1687
1688
|
!ve && !ie && /* @__PURE__ */ w("div", { className: "ll-toolbar", onClick: (m) => m.stopPropagation(), children: [
|
|
@@ -1715,7 +1716,7 @@ const Or = ({
|
|
|
1715
1716
|
type: "button",
|
|
1716
1717
|
className: `ll-tool ll-tool--right ${q ? "is-on" : ""}`,
|
|
1717
1718
|
onClick: (m) => {
|
|
1718
|
-
m.stopPropagation(), le((Y) => !Y),
|
|
1719
|
+
m.stopPropagation(), le((Y) => !Y), We(!1);
|
|
1719
1720
|
},
|
|
1720
1721
|
"aria-label": "Camera devices",
|
|
1721
1722
|
"aria-haspopup": "listbox",
|
|
@@ -1731,7 +1732,7 @@ const Or = ({
|
|
|
1731
1732
|
activeId: U,
|
|
1732
1733
|
anchorRef: ht,
|
|
1733
1734
|
onPick: (m) => {
|
|
1734
|
-
le(!1),
|
|
1735
|
+
le(!1), ze(m);
|
|
1735
1736
|
}
|
|
1736
1737
|
}
|
|
1737
1738
|
)
|
|
@@ -1755,15 +1756,15 @@ const Or = ({
|
|
|
1755
1756
|
type: "button",
|
|
1756
1757
|
className: `ll-tool ll-tool--right ${F ? "is-muted" : ""}`,
|
|
1757
1758
|
onClick: (m) => {
|
|
1758
|
-
m.stopPropagation(),
|
|
1759
|
+
m.stopPropagation(), We((Y) => !Y), le(!1);
|
|
1759
1760
|
},
|
|
1760
1761
|
"aria-label": "Microphone devices",
|
|
1761
1762
|
"aria-haspopup": "listbox",
|
|
1762
|
-
"aria-expanded":
|
|
1763
|
+
"aria-expanded": Be,
|
|
1763
1764
|
children: /* @__PURE__ */ n(bt, {})
|
|
1764
1765
|
}
|
|
1765
1766
|
),
|
|
1766
|
-
|
|
1767
|
+
Be && P.length > 0 && /* @__PURE__ */ n(
|
|
1767
1768
|
pn,
|
|
1768
1769
|
{
|
|
1769
1770
|
label: "Microphone",
|
|
@@ -1771,7 +1772,7 @@ const Or = ({
|
|
|
1771
1772
|
activeId: H,
|
|
1772
1773
|
anchorRef: pt,
|
|
1773
1774
|
onPick: (m) => {
|
|
1774
|
-
|
|
1775
|
+
We(!1), $e(m);
|
|
1775
1776
|
}
|
|
1776
1777
|
}
|
|
1777
1778
|
)
|
|
@@ -1781,7 +1782,7 @@ const Or = ({
|
|
|
1781
1782
|
{
|
|
1782
1783
|
type: "button",
|
|
1783
1784
|
className: `ll-tool ${oe ? "is-muted" : ""}`,
|
|
1784
|
-
onClick:
|
|
1785
|
+
onClick: Re,
|
|
1785
1786
|
"aria-label": oe ? "Unmute speaker" : "Mute speaker",
|
|
1786
1787
|
title: oe ? "Unmute speaker" : "Mute speaker",
|
|
1787
1788
|
children: /* @__PURE__ */ n(En, { muted: oe })
|
|
@@ -1800,7 +1801,7 @@ const Or = ({
|
|
|
1800
1801
|
)
|
|
1801
1802
|
] }),
|
|
1802
1803
|
!ve && ie && /* @__PURE__ */ n(
|
|
1803
|
-
|
|
1804
|
+
$r,
|
|
1804
1805
|
{
|
|
1805
1806
|
isMuted: F,
|
|
1806
1807
|
onToggleMute: Se,
|
|
@@ -1811,7 +1812,7 @@ const Or = ({
|
|
|
1811
1812
|
onToggleScreenShare: Ae,
|
|
1812
1813
|
allowScreenShare: K,
|
|
1813
1814
|
isSpeakerMuted: oe,
|
|
1814
|
-
onToggleSpeaker:
|
|
1815
|
+
onToggleSpeaker: Re,
|
|
1815
1816
|
allowTyping: xe,
|
|
1816
1817
|
isTypingOpen: Ce,
|
|
1817
1818
|
onToggleTyping: re,
|
|
@@ -1836,7 +1837,7 @@ const Or = ({
|
|
|
1836
1837
|
type: "submit",
|
|
1837
1838
|
className: "ll-message-input__send",
|
|
1838
1839
|
"aria-label": "Send message",
|
|
1839
|
-
children: /* @__PURE__ */ n(
|
|
1840
|
+
children: /* @__PURE__ */ n(Br, {})
|
|
1840
1841
|
}
|
|
1841
1842
|
)
|
|
1842
1843
|
] })
|
|
@@ -1911,13 +1912,13 @@ function Cn({ muted: e }) {
|
|
|
1911
1912
|
function En({ muted: e }) {
|
|
1912
1913
|
return /* @__PURE__ */ w("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: [
|
|
1913
1914
|
/* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
1914
|
-
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ w(
|
|
1915
|
+
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ w(Pe, { children: [
|
|
1915
1916
|
/* @__PURE__ */ n("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
|
|
1916
1917
|
/* @__PURE__ */ n("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
|
|
1917
1918
|
] })
|
|
1918
1919
|
] });
|
|
1919
1920
|
}
|
|
1920
|
-
function
|
|
1921
|
+
function Br() {
|
|
1921
1922
|
return /* @__PURE__ */ w("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1922
1923
|
/* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
|
|
1923
1924
|
/* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
|
|
@@ -1939,13 +1940,13 @@ const pn = ({
|
|
|
1939
1940
|
onPick: o,
|
|
1940
1941
|
anchorRef: i
|
|
1941
1942
|
}) => {
|
|
1942
|
-
const [l,
|
|
1943
|
+
const [l, s] = E(null);
|
|
1943
1944
|
return wn(() => {
|
|
1944
1945
|
const a = () => {
|
|
1945
|
-
const
|
|
1946
|
-
if (!
|
|
1947
|
-
const p =
|
|
1948
|
-
|
|
1946
|
+
const c = i.current;
|
|
1947
|
+
if (!c) return;
|
|
1948
|
+
const p = c.getBoundingClientRect(), v = 126, f = window.innerWidth - 16 - 110, u = p.left + p.width / 2;
|
|
1949
|
+
s({
|
|
1949
1950
|
top: p.top - 8,
|
|
1950
1951
|
left: Math.max(v, Math.min(f, u))
|
|
1951
1952
|
});
|
|
@@ -1969,7 +1970,7 @@ const pn = ({
|
|
|
1969
1970
|
},
|
|
1970
1971
|
children: [
|
|
1971
1972
|
/* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
|
|
1972
|
-
t.map((a,
|
|
1973
|
+
t.map((a, c) => {
|
|
1973
1974
|
const p = r === a.deviceId;
|
|
1974
1975
|
return /* @__PURE__ */ w(
|
|
1975
1976
|
"button",
|
|
@@ -1981,10 +1982,10 @@ const pn = ({
|
|
|
1981
1982
|
"aria-selected": p,
|
|
1982
1983
|
children: [
|
|
1983
1984
|
p && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
|
|
1984
|
-
/* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: a.label || `${e} ${
|
|
1985
|
+
/* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: a.label || `${e} ${c + 1}` })
|
|
1985
1986
|
]
|
|
1986
1987
|
},
|
|
1987
|
-
a.deviceId ||
|
|
1988
|
+
a.deviceId || c
|
|
1988
1989
|
);
|
|
1989
1990
|
})
|
|
1990
1991
|
]
|
|
@@ -1992,7 +1993,7 @@ const pn = ({
|
|
|
1992
1993
|
),
|
|
1993
1994
|
document.body
|
|
1994
1995
|
);
|
|
1995
|
-
},
|
|
1996
|
+
}, Wr = [
|
|
1996
1997
|
// Accept any value (or empty) — `<input data-ll-private />` and
|
|
1997
1998
|
// `<input data-ll-private="true" />` both opt out. The bare attribute
|
|
1998
1999
|
// is the recommended spelling; "true" is preserved for back-compat.
|
|
@@ -2003,7 +2004,7 @@ const pn = ({
|
|
|
2003
2004
|
function $t(e) {
|
|
2004
2005
|
let t = e;
|
|
2005
2006
|
for (; t; ) {
|
|
2006
|
-
for (const r of
|
|
2007
|
+
for (const r of Wr)
|
|
2007
2008
|
if (t.matches(r)) return !0;
|
|
2008
2009
|
t = t.parentElement;
|
|
2009
2010
|
}
|
|
@@ -2018,7 +2019,7 @@ function xt(e) {
|
|
|
2018
2019
|
}
|
|
2019
2020
|
return !0;
|
|
2020
2021
|
}
|
|
2021
|
-
const wt = 4096,
|
|
2022
|
+
const wt = 4096, qr = 20, Fr = 20, Ur = 10, jr = 10, Vr = 30, Yr = 20, hn = 500, Gr = [
|
|
2022
2023
|
'[data-ll-private="true"]',
|
|
2023
2024
|
".ll-widget",
|
|
2024
2025
|
"script",
|
|
@@ -2026,17 +2027,17 @@ const wt = 4096, Wr = 20, qr = 20, Fr = 10, Ur = 10, jr = 30, Vr = 20, hn = 500,
|
|
|
2026
2027
|
"noscript",
|
|
2027
2028
|
"iframe"
|
|
2028
2029
|
];
|
|
2029
|
-
function
|
|
2030
|
+
function st(e) {
|
|
2030
2031
|
if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
|
|
2031
2032
|
let t = e;
|
|
2032
2033
|
for (; t; ) {
|
|
2033
|
-
for (const r of
|
|
2034
|
+
for (const r of Gr)
|
|
2034
2035
|
if (t.matches(r)) return !0;
|
|
2035
2036
|
t = t.parentElement;
|
|
2036
2037
|
}
|
|
2037
2038
|
return !1;
|
|
2038
2039
|
}
|
|
2039
|
-
function
|
|
2040
|
+
function ct(e) {
|
|
2040
2041
|
if (typeof window > "u") return !0;
|
|
2041
2042
|
const t = e.getBoundingClientRect();
|
|
2042
2043
|
if (t.width <= 0 || t.height <= 0) return !1;
|
|
@@ -2046,8 +2047,8 @@ function st(e) {
|
|
|
2046
2047
|
function mn(e) {
|
|
2047
2048
|
const t = e.getAttribute("id");
|
|
2048
2049
|
if (t) {
|
|
2049
|
-
const l = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(t) : t.replace(/"/g, '\\"'),
|
|
2050
|
-
if (
|
|
2050
|
+
const l = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(t) : t.replace(/"/g, '\\"'), s = document.querySelector(`label[for="${l}"]`);
|
|
2051
|
+
if (s != null && s.textContent) return s.textContent.trim();
|
|
2051
2052
|
}
|
|
2052
2053
|
const r = e.getAttribute("aria-label");
|
|
2053
2054
|
if (r) return r.trim();
|
|
@@ -2059,10 +2060,10 @@ function mn(e) {
|
|
|
2059
2060
|
function we(e, t) {
|
|
2060
2061
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
2061
2062
|
}
|
|
2062
|
-
function
|
|
2063
|
+
function Jr(e) {
|
|
2063
2064
|
return e && e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || null;
|
|
2064
2065
|
}
|
|
2065
|
-
function
|
|
2066
|
+
function Kr(e) {
|
|
2066
2067
|
const t = e.getAttribute("aria-label");
|
|
2067
2068
|
if (t) return t.trim().slice(0, 80);
|
|
2068
2069
|
const r = e.getAttribute("aria-labelledby");
|
|
@@ -2080,18 +2081,18 @@ function Jr(e) {
|
|
|
2080
2081
|
}
|
|
2081
2082
|
let i = e.parentElement;
|
|
2082
2083
|
for (let l = 0; i && l < 4; l++, i = i.parentElement) {
|
|
2083
|
-
const
|
|
2084
|
-
if (
|
|
2085
|
-
const a =
|
|
2084
|
+
const s = i.querySelector("h1, h2, h3, h4");
|
|
2085
|
+
if (s != null && s.textContent) {
|
|
2086
|
+
const a = s.textContent.trim();
|
|
2086
2087
|
if (a && a.length < 80) return a;
|
|
2087
2088
|
}
|
|
2088
2089
|
}
|
|
2089
2090
|
return null;
|
|
2090
2091
|
}
|
|
2091
|
-
function
|
|
2092
|
+
function je(e) {
|
|
2092
2093
|
return e.length;
|
|
2093
2094
|
}
|
|
2094
|
-
function
|
|
2095
|
+
function Xr(e, t = {}) {
|
|
2095
2096
|
const r = t.doc ?? (typeof document < "u" ? document : null);
|
|
2096
2097
|
if (!r)
|
|
2097
2098
|
return {
|
|
@@ -2105,39 +2106,39 @@ function Kr(e, t = {}) {
|
|
|
2105
2106
|
forms: [],
|
|
2106
2107
|
extras: e
|
|
2107
2108
|
};
|
|
2108
|
-
const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "",
|
|
2109
|
+
const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "", s = Array.from(
|
|
2109
2110
|
r.querySelectorAll("[data-ll-region]")
|
|
2110
2111
|
), a = [];
|
|
2111
|
-
for (const g of
|
|
2112
|
-
if (a.length >=
|
|
2113
|
-
if (
|
|
2112
|
+
for (const g of s) {
|
|
2113
|
+
if (a.length >= Ur) break;
|
|
2114
|
+
if (st(g) || !ct(g)) continue;
|
|
2114
2115
|
const P = g.getAttribute("data-ll-region") ?? "", H = g.getAttribute("data-ll-intent") ?? void 0, q = we(
|
|
2115
2116
|
(g.innerText || g.textContent || "").trim(),
|
|
2116
2117
|
hn * 2
|
|
2117
2118
|
);
|
|
2118
2119
|
!P || !q || a.push({ id: P, intent: H, text: q });
|
|
2119
2120
|
}
|
|
2120
|
-
const
|
|
2121
|
+
const c = [], p = ["H1", "H2", "H3", "H4", "H5", "H6"], v = Array.from(
|
|
2121
2122
|
r.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
|
2122
2123
|
);
|
|
2123
2124
|
for (const g of v) {
|
|
2124
|
-
if (
|
|
2125
|
+
if (st(g) || !ct(g)) continue;
|
|
2125
2126
|
const P = (g.textContent || "").trim();
|
|
2126
|
-
P &&
|
|
2127
|
+
P && c.push(`${g.tagName}: ${we(P, 200)}`);
|
|
2127
2128
|
}
|
|
2128
2129
|
const f = Array.from(r.querySelectorAll("p, li"));
|
|
2129
2130
|
for (const g of f) {
|
|
2130
|
-
if (
|
|
2131
|
+
if (st(g) || !ct(g) || p.includes(g.tagName)) continue;
|
|
2131
2132
|
const P = (g.textContent || "").trim();
|
|
2132
|
-
P.length > 10 &&
|
|
2133
|
+
P.length > 10 && c.push(we(P, hn));
|
|
2133
2134
|
}
|
|
2134
|
-
const u =
|
|
2135
|
-
`),
|
|
2135
|
+
const u = c.join(`
|
|
2136
|
+
`), R = [], L = Array.from(r.querySelectorAll("a[href]"));
|
|
2136
2137
|
for (const g of L) {
|
|
2137
|
-
if (
|
|
2138
|
-
if (
|
|
2138
|
+
if (R.length >= qr) break;
|
|
2139
|
+
if (st(g) || !ct(g)) continue;
|
|
2139
2140
|
const P = g.getAttribute("href") || "", H = (g.textContent || "").trim();
|
|
2140
|
-
!P || !H ||
|
|
2141
|
+
!P || !H || R.push({ href: P, text: we(H, 100) });
|
|
2141
2142
|
}
|
|
2142
2143
|
const _ = [], h = Array.from(
|
|
2143
2144
|
r.querySelectorAll(
|
|
@@ -2145,23 +2146,23 @@ function Kr(e, t = {}) {
|
|
|
2145
2146
|
)
|
|
2146
2147
|
);
|
|
2147
2148
|
for (const g of h) {
|
|
2148
|
-
if (_.length >=
|
|
2149
|
-
if (
|
|
2149
|
+
if (_.length >= Fr) break;
|
|
2150
|
+
if (st(g) || !xt(g) || !ct(g)) continue;
|
|
2150
2151
|
const P = mn(g), H = g instanceof HTMLInputElement ? g.type : g.tagName.toLowerCase();
|
|
2151
2152
|
P && _.push({ label: we(P, 100), type: H });
|
|
2152
2153
|
}
|
|
2153
2154
|
const b = Array.from(r.querySelectorAll("form")), S = [];
|
|
2154
2155
|
let T = 0;
|
|
2155
2156
|
for (const g of b) {
|
|
2156
|
-
if (S.length >=
|
|
2157
|
+
if (S.length >= jr) break;
|
|
2157
2158
|
if ($t(g) || g.matches(".ll-widget *, .ll-widget")) continue;
|
|
2158
|
-
const P = g.getAttribute("id") || g.getAttribute("name") ||
|
|
2159
|
+
const P = g.getAttribute("id") || g.getAttribute("name") || Jr(g.getAttribute("data-ll-intent")) || `form_${T++}`, H = g.getAttribute("data-ll-intent") || Kr(g) || void 0, q = Array.from(
|
|
2159
2160
|
g.querySelectorAll(
|
|
2160
2161
|
"input[name], textarea[name], select[name]"
|
|
2161
2162
|
)
|
|
2162
2163
|
), Z = [];
|
|
2163
2164
|
for (const M of q) {
|
|
2164
|
-
if (Z.length >=
|
|
2165
|
+
if (Z.length >= Vr) break;
|
|
2165
2166
|
if (!xt(M)) continue;
|
|
2166
2167
|
if (M instanceof HTMLInputElement) {
|
|
2167
2168
|
const K = M.type;
|
|
@@ -2176,7 +2177,7 @@ function Kr(e, t = {}) {
|
|
|
2176
2177
|
};
|
|
2177
2178
|
if (M.required === !0 && (oe.required = !0), M instanceof HTMLSelectElement) {
|
|
2178
2179
|
const K = [];
|
|
2179
|
-
for (let xe = 0; xe < M.options.length && !(K.length >=
|
|
2180
|
+
for (let xe = 0; xe < M.options.length && !(K.length >= Yr); xe++) {
|
|
2180
2181
|
const ye = M.options[xe];
|
|
2181
2182
|
if (!ye || ye.disabled) continue;
|
|
2182
2183
|
const ke = ye.value || "", ve = (ye.textContent || "").trim() || ke;
|
|
@@ -2195,31 +2196,31 @@ function Kr(e, t = {}) {
|
|
|
2195
2196
|
pathname: i,
|
|
2196
2197
|
regions: a,
|
|
2197
2198
|
visibleText: u,
|
|
2198
|
-
visibleLinks:
|
|
2199
|
+
visibleLinks: R,
|
|
2199
2200
|
visibleFields: _,
|
|
2200
2201
|
forms: S,
|
|
2201
2202
|
extras: e
|
|
2202
2203
|
};
|
|
2203
|
-
let F =
|
|
2204
|
+
let F = je(JSON.stringify(A.regions)) + je(A.visibleText) + je(JSON.stringify(A.visibleLinks)) + je(JSON.stringify(A.visibleFields));
|
|
2204
2205
|
for (; F > wt && A.visibleFields.length > 0; )
|
|
2205
|
-
A.visibleFields.pop(), F =
|
|
2206
|
+
A.visibleFields.pop(), F = je(JSON.stringify(A.visibleFields));
|
|
2206
2207
|
for (; F > wt && A.visibleLinks.length > 0; )
|
|
2207
2208
|
A.visibleLinks.pop(), F -= 80;
|
|
2208
|
-
return
|
|
2209
|
+
return je(A.visibleText) > wt && (A.visibleText = we(A.visibleText, wt - 100)), A;
|
|
2209
2210
|
}
|
|
2210
|
-
let
|
|
2211
|
+
let Ve = null;
|
|
2211
2212
|
function gn(e, t = {}) {
|
|
2212
2213
|
const r = Date.now(), i = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
|
|
2213
|
-
if (
|
|
2214
|
-
return
|
|
2215
|
-
const l =
|
|
2216
|
-
return
|
|
2214
|
+
if (Ve && Ve.key === i && r - Ve.at < 1e3)
|
|
2215
|
+
return Ve.ctx;
|
|
2216
|
+
const l = Xr(e, t);
|
|
2217
|
+
return Ve = { key: i, at: r, ctx: l }, l;
|
|
2217
2218
|
}
|
|
2218
|
-
function
|
|
2219
|
-
|
|
2219
|
+
function Qr() {
|
|
2220
|
+
Ve = null;
|
|
2220
2221
|
}
|
|
2221
|
-
const
|
|
2222
|
-
function
|
|
2222
|
+
const Zr = 200;
|
|
2223
|
+
function eo(e) {
|
|
2223
2224
|
const t = String(e.href || "");
|
|
2224
2225
|
return {
|
|
2225
2226
|
href: t,
|
|
@@ -2229,70 +2230,70 @@ function Zr(e) {
|
|
|
2229
2230
|
description: e.description
|
|
2230
2231
|
};
|
|
2231
2232
|
}
|
|
2232
|
-
function
|
|
2233
|
+
function to(e) {
|
|
2233
2234
|
return !(!e || e.startsWith("#") || e.startsWith("javascript:") || e.startsWith("mailto:") || e.startsWith("tel:"));
|
|
2234
2235
|
}
|
|
2235
|
-
function
|
|
2236
|
+
function no(e) {
|
|
2236
2237
|
const t = e ?? (typeof document < "u" ? document : null);
|
|
2237
2238
|
if (!t) return [];
|
|
2238
2239
|
const r = typeof window < "u" && window.location.origin || "", o = /* @__PURE__ */ new Set(), i = [], l = Array.from(t.querySelectorAll("a[href]"));
|
|
2239
|
-
for (const
|
|
2240
|
-
if (i.length >=
|
|
2241
|
-
if ($t(
|
|
2242
|
-
const a =
|
|
2243
|
-
if (!
|
|
2244
|
-
let
|
|
2240
|
+
for (const s of l) {
|
|
2241
|
+
if (i.length >= Zr) break;
|
|
2242
|
+
if ($t(s)) continue;
|
|
2243
|
+
const a = s.getAttribute("href") || "";
|
|
2244
|
+
if (!to(a)) continue;
|
|
2245
|
+
let c = a, p = !0;
|
|
2245
2246
|
try {
|
|
2246
2247
|
if (typeof window < "u") {
|
|
2247
2248
|
const f = new URL(a, r);
|
|
2248
|
-
p = f.origin === r, p && a.startsWith("http") && (
|
|
2249
|
+
p = f.origin === r, p && a.startsWith("http") && (c = f.pathname + f.search + f.hash);
|
|
2249
2250
|
}
|
|
2250
2251
|
} catch {
|
|
2251
2252
|
continue;
|
|
2252
2253
|
}
|
|
2253
|
-
if (o.has(
|
|
2254
|
-
o.add(
|
|
2255
|
-
const v = (
|
|
2256
|
-
i.push({ href:
|
|
2254
|
+
if (o.has(c)) continue;
|
|
2255
|
+
o.add(c);
|
|
2256
|
+
const v = (s.textContent || "").trim().slice(0, 120);
|
|
2257
|
+
i.push({ href: c, text: v, internal: p });
|
|
2257
2258
|
}
|
|
2258
2259
|
return i;
|
|
2259
2260
|
}
|
|
2260
|
-
let
|
|
2261
|
-
const
|
|
2261
|
+
let Ye = null;
|
|
2262
|
+
const ro = 5e3;
|
|
2262
2263
|
function Mt() {
|
|
2263
2264
|
const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
|
|
2264
|
-
if (
|
|
2265
|
-
return
|
|
2266
|
-
const r =
|
|
2267
|
-
return
|
|
2265
|
+
if (Ye && Ye.pathname === t && e - Ye.at < ro)
|
|
2266
|
+
return Ye.routes;
|
|
2267
|
+
const r = no();
|
|
2268
|
+
return Ye = { at: e, pathname: t, routes: r }, r;
|
|
2268
2269
|
}
|
|
2269
|
-
function
|
|
2270
|
-
|
|
2270
|
+
function oo() {
|
|
2271
|
+
Ye = null;
|
|
2271
2272
|
}
|
|
2272
|
-
function
|
|
2273
|
+
function io(e, t) {
|
|
2273
2274
|
const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, o = Object.getOwnPropertyDescriptor(r, "value"), i = o == null ? void 0 : o.set;
|
|
2274
2275
|
i ? i.call(e, t) : e.value = t;
|
|
2275
2276
|
}
|
|
2276
|
-
function
|
|
2277
|
+
function lo(e, t, r = {}) {
|
|
2277
2278
|
const o = r.triggerInput ?? !0, i = r.triggerChange ?? !0;
|
|
2278
2279
|
if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
|
|
2279
2280
|
const l = Object.getOwnPropertyDescriptor(
|
|
2280
2281
|
HTMLInputElement.prototype,
|
|
2281
2282
|
"checked"
|
|
2282
|
-
),
|
|
2283
|
-
|
|
2283
|
+
), s = l == null ? void 0 : l.set, a = t === "true" || t === "1" || t === "on";
|
|
2284
|
+
s ? s.call(e, a) : e.checked = a, o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
2284
2285
|
return;
|
|
2285
2286
|
}
|
|
2286
|
-
|
|
2287
|
+
io(e, t), o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
2287
2288
|
}
|
|
2288
2289
|
function yn(e, t) {
|
|
2289
2290
|
if (!t) return null;
|
|
2290
2291
|
const r = t.replace(/"/g, '\\"');
|
|
2291
2292
|
try {
|
|
2292
|
-
const
|
|
2293
|
+
const s = e.querySelector(
|
|
2293
2294
|
`form#${CSS.escape(t)}`
|
|
2294
2295
|
);
|
|
2295
|
-
if (
|
|
2296
|
+
if (s) return s;
|
|
2296
2297
|
} catch {
|
|
2297
2298
|
}
|
|
2298
2299
|
const o = e.querySelector(
|
|
@@ -2304,25 +2305,25 @@ function yn(e, t) {
|
|
|
2304
2305
|
);
|
|
2305
2306
|
if (i) return i;
|
|
2306
2307
|
const l = Array.from(e.querySelectorAll("form"));
|
|
2307
|
-
for (const
|
|
2308
|
-
const a =
|
|
2309
|
-
if (a &&
|
|
2308
|
+
for (const s of l) {
|
|
2309
|
+
const a = s.getAttribute("data-ll-intent");
|
|
2310
|
+
if (a && ao(a) === t) return s;
|
|
2310
2311
|
}
|
|
2311
2312
|
if (/^form_\d+$/.test(t)) {
|
|
2312
|
-
const
|
|
2313
|
+
const s = parseInt(t.slice(5), 10);
|
|
2313
2314
|
let a = 0;
|
|
2314
|
-
for (const
|
|
2315
|
-
if (!(
|
|
2316
|
-
if (a ===
|
|
2315
|
+
for (const c of l)
|
|
2316
|
+
if (!(c.id || c.getAttribute("name") || c.getAttribute("data-ll-intent"))) {
|
|
2317
|
+
if (a === s) return c;
|
|
2317
2318
|
a++;
|
|
2318
2319
|
}
|
|
2319
2320
|
}
|
|
2320
2321
|
return null;
|
|
2321
2322
|
}
|
|
2322
|
-
function
|
|
2323
|
+
function ao(e) {
|
|
2323
2324
|
return e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || null;
|
|
2324
2325
|
}
|
|
2325
|
-
function
|
|
2326
|
+
function so() {
|
|
2326
2327
|
if (typeof window > "u" || typeof document > "u")
|
|
2327
2328
|
return !1;
|
|
2328
2329
|
const e = document.scrollingElement || document.documentElement;
|
|
@@ -2335,7 +2336,7 @@ function co(e) {
|
|
|
2335
2336
|
const r = window.getComputedStyle(e).overflowY;
|
|
2336
2337
|
return !(r !== "auto" && r !== "scroll" || e.scrollHeight <= e.clientHeight + 2);
|
|
2337
2338
|
}
|
|
2338
|
-
function
|
|
2339
|
+
function uo() {
|
|
2339
2340
|
if (typeof document > "u") return null;
|
|
2340
2341
|
const e = Array.from(
|
|
2341
2342
|
document.querySelectorAll("body, body *")
|
|
@@ -2350,24 +2351,24 @@ function so() {
|
|
|
2350
2351
|
}
|
|
2351
2352
|
return t;
|
|
2352
2353
|
}
|
|
2353
|
-
function
|
|
2354
|
+
function fo() {
|
|
2354
2355
|
if (typeof window > "u")
|
|
2355
2356
|
return null;
|
|
2356
|
-
if (
|
|
2357
|
-
const e =
|
|
2357
|
+
if (so()) return window;
|
|
2358
|
+
const e = uo();
|
|
2358
2359
|
return e || window;
|
|
2359
2360
|
}
|
|
2360
2361
|
function vn(e) {
|
|
2361
2362
|
return e instanceof Window ? e.innerHeight || 0 : e.clientHeight || 0;
|
|
2362
2363
|
}
|
|
2363
|
-
function
|
|
2364
|
+
function po(e) {
|
|
2364
2365
|
var t, r;
|
|
2365
2366
|
return e instanceof Window ? typeof document > "u" ? 0 : Math.max(
|
|
2366
2367
|
((t = document.body) == null ? void 0 : t.scrollHeight) ?? 0,
|
|
2367
2368
|
((r = document.documentElement) == null ? void 0 : r.scrollHeight) ?? 0
|
|
2368
2369
|
) : e.scrollHeight - e.clientHeight;
|
|
2369
2370
|
}
|
|
2370
|
-
const
|
|
2371
|
+
const ho = /* @__PURE__ */ new Set([
|
|
2371
2372
|
"agent_state",
|
|
2372
2373
|
"avatar_stream_ready",
|
|
2373
2374
|
"avatar_active",
|
|
@@ -2404,14 +2405,14 @@ const po = /* @__PURE__ */ new Set([
|
|
|
2404
2405
|
agentId: o,
|
|
2405
2406
|
apiKey: i,
|
|
2406
2407
|
baseUrl: l = "https://app.livelayer.studio",
|
|
2407
|
-
sessionEndpoint:
|
|
2408
|
+
sessionEndpoint: s,
|
|
2408
2409
|
sessionBody: a,
|
|
2409
|
-
soundEffects:
|
|
2410
|
+
soundEffects: c,
|
|
2410
2411
|
experienceMode: p = "WIDGET",
|
|
2411
2412
|
autoConnect: v = !1,
|
|
2412
2413
|
displayMode: f,
|
|
2413
2414
|
defaultDisplayMode: u = "expanded",
|
|
2414
|
-
onDisplayModeChange:
|
|
2415
|
+
onDisplayModeChange: R,
|
|
2415
2416
|
position: L = "bottom-right",
|
|
2416
2417
|
mobileBreakpoint: _ = 640,
|
|
2417
2418
|
persistKey: h = "ll-widget",
|
|
@@ -2440,46 +2441,46 @@ const po = /* @__PURE__ */ new Set([
|
|
|
2440
2441
|
onNavigate: dt,
|
|
2441
2442
|
onScrollToSelector: Je,
|
|
2442
2443
|
getPageContext: ut,
|
|
2443
|
-
pageContextExtras:
|
|
2444
|
+
pageContextExtras: se,
|
|
2444
2445
|
getRoutes: Ke,
|
|
2445
2446
|
onScrollPage: Xe,
|
|
2446
2447
|
onClick: ft,
|
|
2447
2448
|
capabilities: Qe,
|
|
2448
2449
|
onConnect: Se,
|
|
2449
|
-
onDisconnect:
|
|
2450
|
+
onDisconnect: $e,
|
|
2450
2451
|
onTranscript: Ne,
|
|
2451
|
-
onAgentState:
|
|
2452
|
+
onAgentState: ze,
|
|
2452
2453
|
onConnectionStateChange: Ae,
|
|
2453
|
-
onAgentEvent:
|
|
2454
|
-
onAgentCommand:
|
|
2454
|
+
onAgentEvent: Re,
|
|
2455
|
+
onAgentCommand: Ie,
|
|
2455
2456
|
onCollect: Me,
|
|
2456
2457
|
controlledSession: $,
|
|
2457
2458
|
className: kt,
|
|
2458
2459
|
style: Te,
|
|
2459
|
-
zIndex:
|
|
2460
|
-
} = t,
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
}, [
|
|
2464
|
-
const De = T !== void 0, [
|
|
2460
|
+
zIndex: Oe = 2147483647
|
|
2461
|
+
} = t, ce = mr(ie), Ze = xr(ce, ke, ve);
|
|
2462
|
+
I(() => {
|
|
2463
|
+
Qr(), oo();
|
|
2464
|
+
}, [ce]);
|
|
2465
|
+
const De = T !== void 0, [He, Lt] = E(() => {
|
|
2465
2466
|
var y;
|
|
2466
2467
|
return T ?? ((y = S == null ? void 0 : S[0]) == null ? void 0 : y.id);
|
|
2467
|
-
}), Le = De ? T :
|
|
2468
|
+
}), Le = De ? T : He, ee = Ge(
|
|
2468
2469
|
() => (S == null ? void 0 : S.find((y) => y.id === Le)) ?? null,
|
|
2469
2470
|
[S, Le]
|
|
2470
|
-
), et = (ee == null ? void 0 : ee.agentId) ?? o, ue = p === "EMBEDDED", [
|
|
2471
|
+
), et = (ee == null ? void 0 : ee.agentId) ?? o, ue = p === "EMBEDDED", [Be, We] = ur({
|
|
2471
2472
|
value: f,
|
|
2472
2473
|
defaultValue: u,
|
|
2473
|
-
onChange:
|
|
2474
|
+
onChange: R,
|
|
2474
2475
|
persistKey: h,
|
|
2475
2476
|
disablePersistence: ue || b
|
|
2476
|
-
}), te = ue ? "expanded" :
|
|
2477
|
-
} :
|
|
2477
|
+
}), te = ue ? "expanded" : Be, le = ue ? () => {
|
|
2478
|
+
} : We, pt = B ?? !ue, ht = J ?? !ue, Ce = pr(_), tt = Zn(), re = er(), ae = nr(), Ee = rr(), nt = or(), [Ct, fe] = E(!1), [pe, rt] = E(!1), [qe, ot] = E(!1), [mt, m] = E(!1), [Y, An] = E(!1), gt = Lr({ baseUrl: l, config: c }), yt = N(gt);
|
|
2478
2479
|
yt.current = gt;
|
|
2479
|
-
const Et = N(dt), St = N(Je), Nt = N(Xe), At = N(ft), zt = N(ut), Ot = N(
|
|
2480
|
-
Et.current = dt, St.current = Je, Nt.current = Xe, At.current = ft, zt.current = ut, Ot.current =
|
|
2480
|
+
const Et = N(dt), St = N(Je), Nt = N(Xe), At = N(ft), zt = N(ut), Ot = N(se), Ht = N(Ke), Rt = N(Qe), he = N(null);
|
|
2481
|
+
Et.current = dt, St.current = Je, Nt.current = Xe, At.current = ft, zt.current = ut, Ot.current = se, Ht.current = Ke, Rt.current = Qe;
|
|
2481
2482
|
function me(y) {
|
|
2482
|
-
const d =
|
|
2483
|
+
const d = Rt.current;
|
|
2483
2484
|
return d ? d.includes(y) : !0;
|
|
2484
2485
|
}
|
|
2485
2486
|
function ge(y, d) {
|
|
@@ -2492,7 +2493,7 @@ const po = /* @__PURE__ */ new Set([
|
|
|
2492
2493
|
var G, de, be, at;
|
|
2493
2494
|
const d = y;
|
|
2494
2495
|
if (!(!d.type || typeof d.type != "string")) {
|
|
2495
|
-
if (
|
|
2496
|
+
if (Re == null || Re({ eventName: d.type, data: y }), d.type === "navigate") {
|
|
2496
2497
|
if (!me("navigate")) {
|
|
2497
2498
|
ge("navigate", "navigate");
|
|
2498
2499
|
return;
|
|
@@ -2586,8 +2587,8 @@ const po = /* @__PURE__ */ new Set([
|
|
|
2586
2587
|
const z = D, Q = z == null ? void 0 : z.localParticipant;
|
|
2587
2588
|
if (Q != null && Q.publishData)
|
|
2588
2589
|
try {
|
|
2589
|
-
const ne = x ? { ...V, requestId: x } : V,
|
|
2590
|
-
Q.publishData(
|
|
2590
|
+
const ne = x ? { ...V, requestId: x } : V, Ue = new TextEncoder().encode(JSON.stringify(ne));
|
|
2591
|
+
Q.publishData(Ue, { reliable: !0 });
|
|
2591
2592
|
} catch (ne) {
|
|
2592
2593
|
console.warn("[LiveLayer] publishData failed.", ne);
|
|
2593
2594
|
}
|
|
@@ -2650,12 +2651,12 @@ const po = /* @__PURE__ */ new Set([
|
|
|
2650
2651
|
return;
|
|
2651
2652
|
}
|
|
2652
2653
|
if (typeof window > "u") return;
|
|
2653
|
-
const W = { behavior: D }, O =
|
|
2654
|
+
const W = { behavior: D }, O = fo(), j = (z) => {
|
|
2654
2655
|
O instanceof Window ? O.scrollBy({ top: z, ...W }) : O.scrollBy({ top: z, ...W });
|
|
2655
2656
|
}, V = (z) => {
|
|
2656
2657
|
O instanceof Window ? O.scrollTo({ top: z, ...W }) : O.scrollTo({ top: z, ...W });
|
|
2657
2658
|
};
|
|
2658
|
-
x === "up" ? j(-vn(O)) : x === "down" ? j(vn(O)) : V(x === "top" ? 0 :
|
|
2659
|
+
x === "up" ? j(-vn(O)) : x === "down" ? j(vn(O)) : V(x === "top" ? 0 : po(O));
|
|
2659
2660
|
return;
|
|
2660
2661
|
}
|
|
2661
2662
|
if (d.type === "click") {
|
|
@@ -2769,7 +2770,7 @@ const po = /* @__PURE__ */ new Set([
|
|
|
2769
2770
|
continue;
|
|
2770
2771
|
}
|
|
2771
2772
|
try {
|
|
2772
|
-
|
|
2773
|
+
lo(V, j);
|
|
2773
2774
|
} catch (z) {
|
|
2774
2775
|
console.warn(
|
|
2775
2776
|
`[LiveLayer] fill_form: failed to set "${O}".`,
|
|
@@ -2805,11 +2806,11 @@ const po = /* @__PURE__ */ new Set([
|
|
|
2805
2806
|
return;
|
|
2806
2807
|
}
|
|
2807
2808
|
const W = typeof d.requestId == "string" ? d.requestId : void 0, O = (be = he.current) == null ? void 0 : be.call(he), j = (Q) => {
|
|
2808
|
-
const ne = O,
|
|
2809
|
-
if (
|
|
2809
|
+
const ne = O, Ue = ne == null ? void 0 : ne.localParticipant;
|
|
2810
|
+
if (Ue != null && Ue.publishData)
|
|
2810
2811
|
try {
|
|
2811
2812
|
const qn = W ? { ...Q, requestId: W } : Q, Fn = new TextEncoder().encode(JSON.stringify(qn));
|
|
2812
|
-
|
|
2813
|
+
Ue.publishData(Fn, { reliable: !0 });
|
|
2813
2814
|
} catch {
|
|
2814
2815
|
}
|
|
2815
2816
|
};
|
|
@@ -2859,7 +2860,7 @@ const po = /* @__PURE__ */ new Set([
|
|
|
2859
2860
|
j([]);
|
|
2860
2861
|
return;
|
|
2861
2862
|
}
|
|
2862
|
-
j(ne.map(
|
|
2863
|
+
j(ne.map(eo).slice(0, 200));
|
|
2863
2864
|
};
|
|
2864
2865
|
z instanceof Promise ? z.then(Q).catch((ne) => {
|
|
2865
2866
|
console.warn(
|
|
@@ -2936,25 +2937,25 @@ const po = /* @__PURE__ */ new Set([
|
|
|
2936
2937
|
}
|
|
2937
2938
|
return;
|
|
2938
2939
|
}
|
|
2939
|
-
|
|
2940
|
+
ho.has(d.type) || Ie == null || Ie(d);
|
|
2940
2941
|
}
|
|
2941
2942
|
},
|
|
2942
|
-
[
|
|
2943
|
-
), X =
|
|
2943
|
+
[Ie, Re, Me]
|
|
2944
|
+
), X = Qn({
|
|
2944
2945
|
agentId: $ ? "__controlled__" : et,
|
|
2945
2946
|
baseUrl: l,
|
|
2946
2947
|
apiKey: i,
|
|
2947
|
-
sessionEndpoint:
|
|
2948
|
+
sessionEndpoint: s,
|
|
2948
2949
|
sessionBody: a,
|
|
2949
2950
|
onDataMessage: $ ? void 0 : it
|
|
2950
2951
|
});
|
|
2951
|
-
|
|
2952
|
+
I(() => {
|
|
2952
2953
|
if ($ != null && $.subscribeToDataMessages)
|
|
2953
2954
|
return $.subscribeToDataMessages(it);
|
|
2954
2955
|
}, [$, it]), he.current = () => {
|
|
2955
2956
|
var y;
|
|
2956
2957
|
return (y = X.getRoom) == null ? void 0 : y.call(X);
|
|
2957
|
-
},
|
|
2958
|
+
}, I(() => {
|
|
2958
2959
|
var G;
|
|
2959
2960
|
if (typeof window > "u") return;
|
|
2960
2961
|
const y = ((G = window.location) == null ? void 0 : G.hostname) || "";
|
|
@@ -3030,13 +3031,13 @@ const po = /* @__PURE__ */ new Set([
|
|
|
3030
3031
|
[]
|
|
3031
3032
|
);
|
|
3032
3033
|
const qt = N(null);
|
|
3033
|
-
|
|
3034
|
+
I(() => {
|
|
3034
3035
|
const y = k.videoElement, d = qt.current;
|
|
3035
3036
|
if (!(!y || !d))
|
|
3036
3037
|
return d.appendChild(y), () => {
|
|
3037
3038
|
y.parentNode === d && d.removeChild(y);
|
|
3038
3039
|
};
|
|
3039
|
-
}, [k.videoElement]),
|
|
3040
|
+
}, [k.videoElement]), I(() => {
|
|
3040
3041
|
const y = k.audioElement;
|
|
3041
3042
|
if (!y) return;
|
|
3042
3043
|
tt.attach(y);
|
|
@@ -3046,7 +3047,7 @@ const po = /* @__PURE__ */ new Set([
|
|
|
3046
3047
|
}), () => {
|
|
3047
3048
|
tt.detach();
|
|
3048
3049
|
};
|
|
3049
|
-
}, [k.audioElement]),
|
|
3050
|
+
}, [k.audioElement]), I(() => {
|
|
3050
3051
|
if (k.isControlled || k.connectionState !== "connected") return;
|
|
3051
3052
|
const y = k.getRoom();
|
|
3052
3053
|
if (y)
|
|
@@ -3054,7 +3055,7 @@ const po = /* @__PURE__ */ new Set([
|
|
|
3054
3055
|
}), () => {
|
|
3055
3056
|
re.teardownMic();
|
|
3056
3057
|
};
|
|
3057
|
-
}, [k.isControlled, k.connectionState]),
|
|
3058
|
+
}, [k.isControlled, k.connectionState]), I(() => {
|
|
3058
3059
|
var d;
|
|
3059
3060
|
if (k.connectionState !== "connected") return;
|
|
3060
3061
|
const y = k.isControlled ? (d = $ == null ? void 0 : $.getRoom) == null ? void 0 : d.call($) : k.getRoom();
|
|
@@ -3062,11 +3063,11 @@ const po = /* @__PURE__ */ new Set([
|
|
|
3062
3063
|
return ae.attachRoom(y), Ee.attachRoom(y), k.isControlled && re.attachRoom(y), nt.refresh(), () => {
|
|
3063
3064
|
ae.teardown(), Ee.teardown();
|
|
3064
3065
|
};
|
|
3065
|
-
}, [k.isControlled, k.connectionState, $]),
|
|
3066
|
+
}, [k.isControlled, k.connectionState, $]), I(() => {
|
|
3066
3067
|
const y = k.audioElement;
|
|
3067
3068
|
y && (y.muted = Y);
|
|
3068
3069
|
}, [k.audioElement, Y]);
|
|
3069
|
-
const
|
|
3070
|
+
const Rn = C((y) => {
|
|
3070
3071
|
const d = { type: "user_message", text: y };
|
|
3071
3072
|
if ($ != null && $.publishData) {
|
|
3072
3073
|
try {
|
|
@@ -3082,20 +3083,20 @@ const po = /* @__PURE__ */ new Set([
|
|
|
3082
3083
|
G.localParticipant.publishData(de, { reliable: !0 });
|
|
3083
3084
|
} catch {
|
|
3084
3085
|
}
|
|
3085
|
-
}, [k, $]),
|
|
3086
|
+
}, [k, $]), In = C(() => {
|
|
3086
3087
|
An((y) => !y);
|
|
3087
3088
|
}, []);
|
|
3088
|
-
|
|
3089
|
-
Ae == null || Ae(k.connectionState), k.connectionState === "connected" ? Se == null || Se() : k.connectionState === "disconnected" && (
|
|
3090
|
-
}, [k.connectionState, Se,
|
|
3089
|
+
I(() => {
|
|
3090
|
+
Ae == null || Ae(k.connectionState), k.connectionState === "connected" ? Se == null || Se() : k.connectionState === "disconnected" && ($e == null || $e());
|
|
3091
|
+
}, [k.connectionState, Se, $e, Ae]), I(() => {
|
|
3091
3092
|
Ne == null || Ne(k.transcript);
|
|
3092
|
-
}, [k.transcript, Ne]),
|
|
3093
|
-
|
|
3094
|
-
}, [k.agentState,
|
|
3093
|
+
}, [k.transcript, Ne]), I(() => {
|
|
3094
|
+
ze == null || ze(k.agentState);
|
|
3095
|
+
}, [k.agentState, ze]), I(() => {
|
|
3095
3096
|
gt.setThinking(k.agentState === "thinking");
|
|
3096
3097
|
}, [k.agentState, gt]);
|
|
3097
3098
|
const Ft = N(!1);
|
|
3098
|
-
|
|
3099
|
+
I(() => {
|
|
3099
3100
|
!v || Ft.current || Ze && k.connectionState === "idle" && (Ft.current = !0, k.connect());
|
|
3100
3101
|
}, [v, k.connectionState, k, Ze]);
|
|
3101
3102
|
const Mn = C(
|
|
@@ -3111,18 +3112,18 @@ const po = /* @__PURE__ */ new Set([
|
|
|
3111
3112
|
A
|
|
3112
3113
|
]
|
|
3113
3114
|
);
|
|
3114
|
-
|
|
3115
|
+
I(() => {
|
|
3115
3116
|
pe && k.connectionState === "connected" && rt(!1);
|
|
3116
|
-
}, [k.connectionState, pe]),
|
|
3117
|
-
if (!
|
|
3117
|
+
}, [k.connectionState, pe]), I(() => {
|
|
3118
|
+
if (!qe) return;
|
|
3118
3119
|
const y = (d) => {
|
|
3119
3120
|
d.key === "Escape" && ot(!1);
|
|
3120
3121
|
};
|
|
3121
3122
|
return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
|
|
3122
|
-
}, [
|
|
3123
|
-
const Tn = !!P || !!(ee != null && ee.avatarImageUrl) || k.isControlled, lt =
|
|
3124
|
-
Qe === void 0 && ((Yt = lt.info) != null && Yt.capabilities) && (
|
|
3125
|
-
const vt = (ee == null ? void 0 : ee.name) ?? H ?? ((Gt = k.agentConfig) == null ? void 0 : Gt.name) ?? ((Jt = lt.info) == null ? void 0 : Jt.name) ?? "Live Layer",
|
|
3123
|
+
}, [qe]);
|
|
3124
|
+
const Tn = !!P || !!(ee != null && ee.avatarImageUrl) || k.isControlled, lt = ir(et, l, Tn);
|
|
3125
|
+
Qe === void 0 && ((Yt = lt.info) != null && Yt.capabilities) && (Rt.current = lt.info.capabilities);
|
|
3126
|
+
const vt = (ee == null ? void 0 : ee.name) ?? H ?? ((Gt = k.agentConfig) == null ? void 0 : Gt.name) ?? ((Jt = lt.info) == null ? void 0 : Jt.name) ?? "Live Layer", It = (ee == null ? void 0 : ee.avatarImageUrl) ?? P ?? ((Kt = k.agentConfig) == null ? void 0 : Kt.avatarImageUrl) ?? ((Xt = lt.info) == null ? void 0 : Xt.avatarImageUrl) ?? null, Dn = F ?? ((Qt = k.agentConfig) == null ? void 0 : Qt.idleLoopUrl) ?? ((Zt = lt.info) == null ? void 0 : Zt.idleLoopUrl) ?? null, Pn = g ?? null, $n = C(() => le("expanded"), [le]), zn = C(
|
|
3126
3127
|
() => le("minimized"),
|
|
3127
3128
|
[le]
|
|
3128
3129
|
), Ut = C(() => {
|
|
@@ -3133,11 +3134,11 @@ const po = /* @__PURE__ */ new Set([
|
|
|
3133
3134
|
});
|
|
3134
3135
|
}, [k.audioElement]), Hn = C(() => {
|
|
3135
3136
|
fe(!1), k.connect();
|
|
3136
|
-
}, [k]),
|
|
3137
|
+
}, [k]), Fe = {
|
|
3137
3138
|
...Te,
|
|
3138
|
-
...ue ? {} : { zIndex:
|
|
3139
|
+
...ue ? {} : { zIndex: Oe }
|
|
3139
3140
|
};
|
|
3140
|
-
q.primaryColor && (
|
|
3141
|
+
q.primaryColor && (Fe["--ll-color-primary"] = q.primaryColor), q.accentColor && (Fe["--ll-color-accent"] = q.accentColor), q.backgroundColor && (Fe["--ll-color-bg"] = q.backgroundColor), q.textColor && (Fe["--ll-color-fg"] = q.textColor);
|
|
3141
3142
|
const Bn = [
|
|
3142
3143
|
"ll-widget",
|
|
3143
3144
|
`ll-widget--${te}`,
|
|
@@ -3149,24 +3150,24 @@ const po = /* @__PURE__ */ new Set([
|
|
|
3149
3150
|
"div",
|
|
3150
3151
|
{
|
|
3151
3152
|
className: Bn,
|
|
3152
|
-
style:
|
|
3153
|
+
style: Fe,
|
|
3153
3154
|
"data-display-mode": te,
|
|
3154
3155
|
"data-position": L,
|
|
3155
3156
|
"data-experience-mode": p === "EMBEDDED" ? "embedded" : "widget",
|
|
3156
3157
|
children: te === "expanded" && /* @__PURE__ */ n(
|
|
3157
|
-
|
|
3158
|
+
Hr,
|
|
3158
3159
|
{
|
|
3159
3160
|
position: L,
|
|
3160
3161
|
isMobile: Ce,
|
|
3161
3162
|
agentName: vt,
|
|
3162
|
-
avatarImageUrl:
|
|
3163
|
+
avatarImageUrl: It,
|
|
3163
3164
|
idleLoopUrl: Dn,
|
|
3164
3165
|
greeting: Pn,
|
|
3165
3166
|
branding: q,
|
|
3166
3167
|
teamMembers: S,
|
|
3167
3168
|
currentTeamMemberId: Le,
|
|
3168
3169
|
isSwitchingTeamMember: pe,
|
|
3169
|
-
teamSwitcherOpen:
|
|
3170
|
+
teamSwitcherOpen: qe,
|
|
3170
3171
|
onToggleTeamSwitcher: () => ot((y) => !y),
|
|
3171
3172
|
onSelectTeamMember: Mn,
|
|
3172
3173
|
connectionState: k.connectionState,
|
|
@@ -3208,8 +3209,8 @@ const po = /* @__PURE__ */ new Set([
|
|
|
3208
3209
|
onToggleCamera: () => void ae.toggle(),
|
|
3209
3210
|
onSwitchCameraDevice: (y) => void ae.switchDevice(y),
|
|
3210
3211
|
onToggleScreenShare: () => void Ee.toggle(),
|
|
3211
|
-
onToggleSpeaker:
|
|
3212
|
-
onSendMessage:
|
|
3212
|
+
onToggleSpeaker: In,
|
|
3213
|
+
onSendMessage: Rn,
|
|
3213
3214
|
onMinimize: zn,
|
|
3214
3215
|
onClose: Ut,
|
|
3215
3216
|
onClearMicError: re.clearError
|
|
@@ -3225,30 +3226,30 @@ const po = /* @__PURE__ */ new Set([
|
|
|
3225
3226
|
`ll-widget--${te}`,
|
|
3226
3227
|
`ll-widget--${Ce ? "mobile" : "desktop"}`
|
|
3227
3228
|
].join(" "),
|
|
3228
|
-
style:
|
|
3229
|
+
style: Fe,
|
|
3229
3230
|
"data-display-mode": te,
|
|
3230
3231
|
"data-position": L,
|
|
3231
3232
|
children: [
|
|
3232
3233
|
te === "hidden" && /* @__PURE__ */ n(
|
|
3233
|
-
|
|
3234
|
+
Rr,
|
|
3234
3235
|
{
|
|
3235
3236
|
position: L,
|
|
3236
3237
|
isMobile: Ce,
|
|
3237
3238
|
isSpeaking: k.agentState === "speaking",
|
|
3238
3239
|
onExpand: () => le("expanded"),
|
|
3239
3240
|
label: `Open ${vt} widget`,
|
|
3240
|
-
avatarImageUrl:
|
|
3241
|
+
avatarImageUrl: It,
|
|
3241
3242
|
agentName: vt,
|
|
3242
3243
|
containerEl: _e
|
|
3243
3244
|
}
|
|
3244
3245
|
),
|
|
3245
3246
|
te === "minimized" && /* @__PURE__ */ n(
|
|
3246
|
-
|
|
3247
|
+
Mr,
|
|
3247
3248
|
{
|
|
3248
3249
|
position: L,
|
|
3249
3250
|
isMobile: Ce,
|
|
3250
3251
|
agentName: vt,
|
|
3251
|
-
avatarImageUrl:
|
|
3252
|
+
avatarImageUrl: It,
|
|
3252
3253
|
agentState: k.agentState,
|
|
3253
3254
|
isMuted: re.isMuted,
|
|
3254
3255
|
audioLevel: tt,
|
|
@@ -3260,47 +3261,47 @@ const po = /* @__PURE__ */ new Set([
|
|
|
3260
3261
|
]
|
|
3261
3262
|
}
|
|
3262
3263
|
) : null, Vt = _e ?? (typeof document < "u" ? document.body : null);
|
|
3263
|
-
return /* @__PURE__ */ w(
|
|
3264
|
+
return /* @__PURE__ */ w(Pe, { children: [
|
|
3264
3265
|
Wn,
|
|
3265
3266
|
jt && Vt && Pt(jt, Vt)
|
|
3266
3267
|
] });
|
|
3267
3268
|
}
|
|
3268
3269
|
);
|
|
3269
3270
|
Nn.displayName = "AvatarWidgetInner";
|
|
3270
|
-
const
|
|
3271
|
+
const mo = Dt(
|
|
3271
3272
|
function(t, r) {
|
|
3272
|
-
return /* @__PURE__ */ n(
|
|
3273
|
+
return /* @__PURE__ */ n(Xn, { children: /* @__PURE__ */ n(Nn, { ...t, ref: r }) });
|
|
3273
3274
|
}
|
|
3274
3275
|
);
|
|
3275
|
-
|
|
3276
|
-
const
|
|
3276
|
+
mo.displayName = "AvatarWidget";
|
|
3277
|
+
const Eo = ({
|
|
3277
3278
|
agentId: e,
|
|
3278
3279
|
baseUrl: t,
|
|
3279
3280
|
apiKey: r,
|
|
3280
3281
|
mode: o,
|
|
3281
3282
|
onAgentEvent: i,
|
|
3282
3283
|
className: l,
|
|
3283
|
-
style:
|
|
3284
|
+
style: s
|
|
3284
3285
|
}) => {
|
|
3285
|
-
const a = N(null),
|
|
3286
|
+
const a = N(null), c = N(null), p = N(i);
|
|
3286
3287
|
p.current = i;
|
|
3287
3288
|
const v = C((f) => {
|
|
3288
|
-
var
|
|
3289
|
+
var R;
|
|
3289
3290
|
const u = f.detail;
|
|
3290
|
-
(
|
|
3291
|
+
(R = p.current) == null || R.call(p, u);
|
|
3291
3292
|
}, []);
|
|
3292
|
-
return
|
|
3293
|
+
return I(() => {
|
|
3293
3294
|
const f = a.current;
|
|
3294
3295
|
if (!f) return;
|
|
3295
3296
|
const u = document.createElement("livelayer-widget");
|
|
3296
|
-
return u.setAttribute("agent-id", e), t && u.setAttribute("base-url", t), r && u.setAttribute("api-key", r), o && u.setAttribute("mode", o), u.addEventListener("agent-event", v), f.appendChild(u),
|
|
3297
|
-
u.removeEventListener("agent-event", v), f.removeChild(u),
|
|
3297
|
+
return u.setAttribute("agent-id", e), t && u.setAttribute("base-url", t), r && u.setAttribute("api-key", r), o && u.setAttribute("mode", o), u.addEventListener("agent-event", v), f.appendChild(u), c.current = u, () => {
|
|
3298
|
+
u.removeEventListener("agent-event", v), f.removeChild(u), c.current = null;
|
|
3298
3299
|
};
|
|
3299
|
-
}, [e]),
|
|
3300
|
-
|
|
3301
|
-
}, [o]), /* @__PURE__ */ n("div", { ref: a, className: l, style:
|
|
3302
|
-
},
|
|
3303
|
-
function({ id: t, intent: r, as: o = "div", className: i, style: l, children:
|
|
3300
|
+
}, [e]), I(() => {
|
|
3301
|
+
c.current && (o ? c.current.setAttribute("mode", o) : c.current.removeAttribute("mode"));
|
|
3302
|
+
}, [o]), /* @__PURE__ */ n("div", { ref: a, className: l, style: s });
|
|
3303
|
+
}, So = Dt(
|
|
3304
|
+
function({ id: t, intent: r, as: o = "div", className: i, style: l, children: s }, a) {
|
|
3304
3305
|
return Vn(
|
|
3305
3306
|
o,
|
|
3306
3307
|
{
|
|
@@ -3310,19 +3311,19 @@ const Lo = ({
|
|
|
3310
3311
|
className: i,
|
|
3311
3312
|
style: l
|
|
3312
3313
|
},
|
|
3313
|
-
|
|
3314
|
+
s
|
|
3314
3315
|
);
|
|
3315
3316
|
}
|
|
3316
3317
|
);
|
|
3317
|
-
function
|
|
3318
|
-
const { onFieldUpdate: t, onComplete: r, source: o = "all" } = e, [i, l] = E({}), [
|
|
3319
|
-
|
|
3318
|
+
function No(e = {}) {
|
|
3319
|
+
const { onFieldUpdate: t, onComplete: r, source: o = "all" } = e, [i, l] = E({}), [s, a] = E(!1), [c, p] = E(null), v = N(t), f = N(r), u = N(o);
|
|
3320
|
+
I(() => {
|
|
3320
3321
|
v.current = t, f.current = r, u.current = o;
|
|
3321
3322
|
}, [t, r, o]);
|
|
3322
|
-
const
|
|
3323
|
+
const R = C(() => {
|
|
3323
3324
|
l({}), a(!1);
|
|
3324
3325
|
}, []);
|
|
3325
|
-
return
|
|
3326
|
+
return I(() => {
|
|
3326
3327
|
if (typeof window > "u") return;
|
|
3327
3328
|
const L = (_) => {
|
|
3328
3329
|
var b, S;
|
|
@@ -3355,43 +3356,43 @@ function Eo(e = {}) {
|
|
|
3355
3356
|
}
|
|
3356
3357
|
};
|
|
3357
3358
|
return document.addEventListener("ll-collected", L), () => document.removeEventListener("ll-collected", L);
|
|
3358
|
-
}, []), { fields: i, isCollecting:
|
|
3359
|
+
}, []), { fields: i, isCollecting: s, lastResult: c, reset: R };
|
|
3359
3360
|
}
|
|
3360
3361
|
let bn = 1;
|
|
3361
|
-
function
|
|
3362
|
+
function Ao({
|
|
3362
3363
|
onMount: e,
|
|
3363
3364
|
defaultOpen: t = !1,
|
|
3364
3365
|
storageKey: r = "ll-debug-open"
|
|
3365
3366
|
}) {
|
|
3366
|
-
const [o, i] = E(t), [l,
|
|
3367
|
-
|
|
3367
|
+
const [o, i] = E(t), [l, s] = E([]), [a, c] = E(""), [p, v] = E(!1), f = N(/* @__PURE__ */ new Set()), u = N([]), R = N(p);
|
|
3368
|
+
R.current = p, I(() => {
|
|
3368
3369
|
try {
|
|
3369
3370
|
const h = localStorage.getItem(r);
|
|
3370
3371
|
h === "1" && i(!0), h === "0" && i(!1);
|
|
3371
3372
|
} catch {
|
|
3372
3373
|
}
|
|
3373
|
-
}, [r]),
|
|
3374
|
+
}, [r]), I(() => {
|
|
3374
3375
|
try {
|
|
3375
3376
|
localStorage.setItem(r, o ? "1" : "0");
|
|
3376
3377
|
} catch {
|
|
3377
3378
|
}
|
|
3378
|
-
}, [o, r]),
|
|
3379
|
+
}, [o, r]), I(() => {
|
|
3379
3380
|
const h = (b) => {
|
|
3380
3381
|
(b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(), i((S) => !S));
|
|
3381
3382
|
};
|
|
3382
3383
|
return window.addEventListener("keydown", h), () => window.removeEventListener("keydown", h);
|
|
3383
|
-
}, []),
|
|
3384
|
+
}, []), I(() => {
|
|
3384
3385
|
const h = setInterval(() => {
|
|
3385
|
-
if (u.current.length === 0 ||
|
|
3386
|
+
if (u.current.length === 0 || R.current) return;
|
|
3386
3387
|
const b = u.current.splice(0, u.current.length);
|
|
3387
|
-
|
|
3388
|
+
s(
|
|
3388
3389
|
(S) => [...b.reverse(), ...S].slice(0, 200)
|
|
3389
3390
|
);
|
|
3390
3391
|
}, 100);
|
|
3391
3392
|
return () => clearInterval(h);
|
|
3392
3393
|
}, []);
|
|
3393
3394
|
const L = N(!1);
|
|
3394
|
-
if (
|
|
3395
|
+
if (I(() => {
|
|
3395
3396
|
!e || L.current || (L.current = !0, e((h) => {
|
|
3396
3397
|
u.current.push({
|
|
3397
3398
|
id: bn++,
|
|
@@ -3401,7 +3402,7 @@ function So({
|
|
|
3401
3402
|
data: h.data
|
|
3402
3403
|
});
|
|
3403
3404
|
}));
|
|
3404
|
-
}, [e]),
|
|
3405
|
+
}, [e]), I(() => {
|
|
3405
3406
|
const h = console.warn, b = console.log, S = (T, A) => function(...F) {
|
|
3406
3407
|
try {
|
|
3407
3408
|
const g = typeof F[0] == "string" ? F[0] : "";
|
|
@@ -3410,7 +3411,7 @@ function So({
|
|
|
3410
3411
|
ts: Date.now(),
|
|
3411
3412
|
kind: T,
|
|
3412
3413
|
type: g.slice(0, 120),
|
|
3413
|
-
data: { args: F.slice(1).map((P) =>
|
|
3414
|
+
data: { args: F.slice(1).map((P) => yo(P)) }
|
|
3414
3415
|
});
|
|
3415
3416
|
} catch {
|
|
3416
3417
|
}
|
|
@@ -3507,7 +3508,7 @@ function So({
|
|
|
3507
3508
|
{
|
|
3508
3509
|
type: "button",
|
|
3509
3510
|
onClick: () => {
|
|
3510
|
-
|
|
3511
|
+
s([]), u.current = [];
|
|
3511
3512
|
},
|
|
3512
3513
|
style: Tt("transparent"),
|
|
3513
3514
|
title: "Clear buffer",
|
|
@@ -3533,7 +3534,7 @@ function So({
|
|
|
3533
3534
|
{
|
|
3534
3535
|
type: "text",
|
|
3535
3536
|
value: a,
|
|
3536
|
-
onChange: (h) =>
|
|
3537
|
+
onChange: (h) => c(h.target.value),
|
|
3537
3538
|
placeholder: "filter by type or data…",
|
|
3538
3539
|
style: {
|
|
3539
3540
|
margin: 8,
|
|
@@ -3586,12 +3587,12 @@ function So({
|
|
|
3586
3587
|
]
|
|
3587
3588
|
}
|
|
3588
3589
|
) : _.map((h) => /* @__PURE__ */ n(
|
|
3589
|
-
|
|
3590
|
+
go,
|
|
3590
3591
|
{
|
|
3591
3592
|
entry: h,
|
|
3592
3593
|
expanded: f.current.has(h.id),
|
|
3593
3594
|
onToggle: () => {
|
|
3594
|
-
f.current.has(h.id) ? f.current.delete(h.id) : f.current.add(h.id),
|
|
3595
|
+
f.current.has(h.id) ? f.current.delete(h.id) : f.current.add(h.id), s((b) => [...b]);
|
|
3595
3596
|
}
|
|
3596
3597
|
},
|
|
3597
3598
|
h.id
|
|
@@ -3602,7 +3603,7 @@ function So({
|
|
|
3602
3603
|
}
|
|
3603
3604
|
);
|
|
3604
3605
|
}
|
|
3605
|
-
function
|
|
3606
|
+
function go({
|
|
3606
3607
|
entry: e,
|
|
3607
3608
|
expanded: t,
|
|
3608
3609
|
onToggle: r
|
|
@@ -3683,20 +3684,27 @@ function Tt(e) {
|
|
|
3683
3684
|
cursor: "pointer"
|
|
3684
3685
|
};
|
|
3685
3686
|
}
|
|
3686
|
-
function
|
|
3687
|
+
function yo(e) {
|
|
3687
3688
|
try {
|
|
3688
3689
|
return e instanceof Error ? { message: e.message, stack: e.stack } : (JSON.stringify(e), e);
|
|
3689
3690
|
} catch {
|
|
3690
3691
|
return String(e);
|
|
3691
3692
|
}
|
|
3692
3693
|
}
|
|
3693
|
-
function
|
|
3694
|
+
function vo(e) {
|
|
3695
|
+
const t = JSON.stringify(e);
|
|
3696
|
+
I(() => Gn(e), [t]);
|
|
3697
|
+
}
|
|
3698
|
+
function Ro({ fields: e, children: t }) {
|
|
3699
|
+
return vo(e), /* @__PURE__ */ n(Pe, { children: t });
|
|
3700
|
+
}
|
|
3701
|
+
function Io() {
|
|
3694
3702
|
const [e, t] = E([]), r = C((i) => {
|
|
3695
3703
|
t((l) => {
|
|
3696
|
-
const
|
|
3697
|
-
if (
|
|
3704
|
+
const s = l.findIndex((a) => a.id === i.id);
|
|
3705
|
+
if (s >= 0) {
|
|
3698
3706
|
const a = l.slice();
|
|
3699
|
-
return a[
|
|
3707
|
+
return a[s] = i, a;
|
|
3700
3708
|
}
|
|
3701
3709
|
return [...l, i];
|
|
3702
3710
|
});
|
|
@@ -3709,32 +3717,38 @@ function No() {
|
|
|
3709
3717
|
};
|
|
3710
3718
|
}
|
|
3711
3719
|
export {
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3720
|
+
mo as AvatarWidget,
|
|
3721
|
+
Xn as ErrorBoundary,
|
|
3722
|
+
Ro as FieldProvider,
|
|
3723
|
+
Ao as LiveLayerDebugPanel,
|
|
3724
|
+
So as LiveLayerRegion,
|
|
3725
|
+
Eo as LiveLayerWidget,
|
|
3726
|
+
Do as clearFieldRegistry,
|
|
3727
|
+
Qr as clearPageContextCache,
|
|
3728
|
+
oo as clearRoutesCache,
|
|
3729
|
+
Xr as extractPageContext,
|
|
3730
|
+
no as extractRoutes,
|
|
3721
3731
|
gn as getCachedPageContext,
|
|
3722
3732
|
Mt as getCachedRoutes,
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3733
|
+
Po as getRegisteredFields,
|
|
3734
|
+
wr as matchesPattern,
|
|
3735
|
+
eo as normalizeRouteInput,
|
|
3736
|
+
$o as registerFields,
|
|
3737
|
+
zo as setFieldValue,
|
|
3738
|
+
_r as shouldRenderAtPath,
|
|
3739
|
+
ir as useAgentInfo,
|
|
3740
|
+
Zn as useAudioLevel,
|
|
3741
|
+
nr as useCameraState,
|
|
3742
|
+
No as useCollect,
|
|
3743
|
+
sr as useDisplayMode,
|
|
3744
|
+
ur as useDisplayModePersistence,
|
|
3745
|
+
pr as useIsMobile,
|
|
3746
|
+
Qn as useLiveKitSession,
|
|
3747
|
+
or as useMediaDevices,
|
|
3748
|
+
er as useMicrophoneState,
|
|
3749
|
+
mr as usePathname,
|
|
3750
|
+
vo as useRegisterFields,
|
|
3751
|
+
xr as useRouteMatch,
|
|
3752
|
+
rr as useScreenShareState,
|
|
3753
|
+
Io as useTranscript
|
|
3740
3754
|
};
|