@livelayer/react 0.9.7 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +16 -0
- package/dist/index.js +3 -3
- package/dist/index.mjs +1298 -1243
- package/dist/styles.css +89 -17
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { Component as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
class
|
|
2
|
+
import { jsxs as y, jsx as n, Fragment as Ve } from "react/jsx-runtime";
|
|
3
|
+
import { Component as zn, useState as C, useRef as S, useEffect as M, useCallback as E, useMemo as Ye, useLayoutEffect as hn, forwardRef as dt, useImperativeHandle as On, createElement as Hn } from "react";
|
|
4
|
+
import { createPortal as Rt } from "react-dom";
|
|
5
|
+
import { LiveKitSession as Wn } from "@livelayer/sdk";
|
|
6
|
+
import { createLocalAudioTrack as Bn, Track as mn, createLocalVideoTrack as qn } from "livekit-client";
|
|
7
|
+
class Fn extends zn {
|
|
8
8
|
constructor() {
|
|
9
9
|
super(...arguments), this.state = { hasError: !1, error: null }, this.reset = () => {
|
|
10
10
|
this.setState({ hasError: !1, error: null });
|
|
@@ -14,12 +14,12 @@ class Hn extends In {
|
|
|
14
14
|
return { hasError: !0, error: t };
|
|
15
15
|
}
|
|
16
16
|
componentDidCatch(t, r) {
|
|
17
|
-
var
|
|
18
|
-
(
|
|
17
|
+
var o, i;
|
|
18
|
+
(i = (o = this.props).onError) == null || i.call(o, t, r);
|
|
19
19
|
}
|
|
20
20
|
render() {
|
|
21
21
|
var t;
|
|
22
|
-
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */
|
|
22
|
+
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ y("div", { className: "ll-error-boundary", role: "alert", children: [
|
|
23
23
|
/* @__PURE__ */ n("p", { className: "ll-error-boundary__title", children: "Widget crashed" }),
|
|
24
24
|
/* @__PURE__ */ n("p", { className: "ll-error-boundary__message", children: ((t = this.state.error) == null ? void 0 : t.message) || "Something went wrong." }),
|
|
25
25
|
/* @__PURE__ */ n(
|
|
@@ -34,26 +34,26 @@ class Hn extends In {
|
|
|
34
34
|
] }) : this.props.children;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
const [t, r] = C("idle"), [
|
|
39
|
-
|
|
37
|
+
function Un(e) {
|
|
38
|
+
const [t, r] = C("idle"), [o, i] = C("idle"), [l, d] = C([]), [a, s] = C(null), [f, b] = C(null), [u, c] = C(null), [I, k] = C(!1), [w, v] = C(null), m = S(null), N = S(e.onDataMessage);
|
|
39
|
+
N.current = e.onDataMessage, M(() => {
|
|
40
40
|
const R = {
|
|
41
41
|
onConnectionStateChange: (q) => {
|
|
42
|
-
r(q), q === "connected" &&
|
|
42
|
+
r(q), q === "connected" && v(null);
|
|
43
43
|
},
|
|
44
|
-
onAgentStateChange:
|
|
45
|
-
onTranscript: (q) =>
|
|
46
|
-
onAgentConfig:
|
|
44
|
+
onAgentStateChange: i,
|
|
45
|
+
onTranscript: (q) => d([...q]),
|
|
46
|
+
onAgentConfig: s,
|
|
47
47
|
onAudioTrack: (q) => c(q),
|
|
48
|
-
onVideoTrack: (q) =>
|
|
49
|
-
onVideoTrackRemoved: () =>
|
|
50
|
-
onError: (q) =>
|
|
48
|
+
onVideoTrack: (q) => b(q),
|
|
49
|
+
onVideoTrackRemoved: () => b(null),
|
|
50
|
+
onError: (q) => v(q),
|
|
51
51
|
onDataMessage: (q) => {
|
|
52
|
-
var
|
|
53
|
-
(
|
|
52
|
+
var A;
|
|
53
|
+
(A = N.current) == null || A.call(N, q);
|
|
54
54
|
},
|
|
55
|
-
onResumabilityChange:
|
|
56
|
-
}, B = new
|
|
55
|
+
onResumabilityChange: k
|
|
56
|
+
}, B = new Wn(
|
|
57
57
|
{
|
|
58
58
|
agentId: e.agentId,
|
|
59
59
|
baseUrl: e.baseUrl,
|
|
@@ -63,7 +63,7 @@ function Wn(e) {
|
|
|
63
63
|
},
|
|
64
64
|
R
|
|
65
65
|
);
|
|
66
|
-
return m.current = B, r("idle"),
|
|
66
|
+
return m.current = B, r("idle"), i("idle"), d([]), s(null), b(null), c(null), k(!1), v(null), () => {
|
|
67
67
|
var q;
|
|
68
68
|
(q = B.destroy) == null || q.call(B), m.current = null;
|
|
69
69
|
};
|
|
@@ -80,7 +80,7 @@ function Wn(e) {
|
|
|
80
80
|
try {
|
|
81
81
|
await R.connect();
|
|
82
82
|
} catch (B) {
|
|
83
|
-
throw
|
|
83
|
+
throw v(B instanceof Error ? B.message : String(B)), B;
|
|
84
84
|
}
|
|
85
85
|
}, []), D = E(() => {
|
|
86
86
|
const R = m.current;
|
|
@@ -91,24 +91,24 @@ function Wn(e) {
|
|
|
91
91
|
}, []);
|
|
92
92
|
return {
|
|
93
93
|
connectionState: t,
|
|
94
|
-
agentState:
|
|
94
|
+
agentState: o,
|
|
95
95
|
transcript: l,
|
|
96
96
|
agentConfig: a,
|
|
97
97
|
videoElement: f,
|
|
98
98
|
audioElement: u,
|
|
99
99
|
canResume: I,
|
|
100
|
-
error:
|
|
100
|
+
error: w,
|
|
101
101
|
connect: $,
|
|
102
102
|
disconnect: D,
|
|
103
103
|
getRoom: x,
|
|
104
104
|
session: m.current
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
const e =
|
|
107
|
+
function jn() {
|
|
108
|
+
const e = S(null), t = S(null), r = S(null), o = S(null), i = S(/* @__PURE__ */ new Set()), l = S(null), d = E(() => {
|
|
109
109
|
const u = t.current;
|
|
110
110
|
if (!u) {
|
|
111
|
-
|
|
111
|
+
o.current = null;
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
114
|
(!l.current || l.current.length !== u.frequencyBinCount) && (l.current = new Uint8Array(
|
|
@@ -117,20 +117,20 @@ function Bn() {
|
|
|
117
117
|
const c = l.current;
|
|
118
118
|
u.getByteFrequencyData(c);
|
|
119
119
|
let I = 0;
|
|
120
|
-
for (let
|
|
121
|
-
const
|
|
122
|
-
for (const
|
|
120
|
+
for (let w = 0; w < c.length; w++) I += c[w];
|
|
121
|
+
const k = I / c.length / 255;
|
|
122
|
+
for (const w of i.current)
|
|
123
123
|
try {
|
|
124
|
-
|
|
125
|
-
} catch (
|
|
126
|
-
console.error("[useAudioLevel] subscriber threw:",
|
|
124
|
+
w(k);
|
|
125
|
+
} catch (v) {
|
|
126
|
+
console.error("[useAudioLevel] subscriber threw:", v);
|
|
127
127
|
}
|
|
128
|
-
|
|
128
|
+
o.current = requestAnimationFrame(d);
|
|
129
129
|
}, []), a = E(() => {
|
|
130
130
|
if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
|
|
131
131
|
const u = new AudioContext(), c = u.createAnalyser();
|
|
132
132
|
c.fftSize = 64, c.connect(u.destination), e.current = u, t.current = c;
|
|
133
|
-
}, []),
|
|
133
|
+
}, []), s = E(
|
|
134
134
|
(u) => {
|
|
135
135
|
if (a(), !(!e.current || !t.current)) {
|
|
136
136
|
if (r.current) {
|
|
@@ -147,22 +147,22 @@ function Bn() {
|
|
|
147
147
|
console.warn("[useAudioLevel] createMediaElementSource failed:", c);
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
|
-
|
|
150
|
+
o.current === null && (o.current = requestAnimationFrame(d));
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
|
-
[a,
|
|
153
|
+
[a, d]
|
|
154
154
|
), f = E(() => {
|
|
155
|
-
if (
|
|
155
|
+
if (o.current !== null && (cancelAnimationFrame(o.current), o.current = null), r.current) {
|
|
156
156
|
try {
|
|
157
157
|
r.current.disconnect();
|
|
158
158
|
} catch {
|
|
159
159
|
}
|
|
160
160
|
r.current = null;
|
|
161
161
|
}
|
|
162
|
-
}, []),
|
|
163
|
-
|
|
162
|
+
}, []), b = E((u) => (i.current.add(u), () => {
|
|
163
|
+
i.current.delete(u);
|
|
164
164
|
}), []);
|
|
165
|
-
return
|
|
165
|
+
return M(() => () => {
|
|
166
166
|
if (f(), t.current) {
|
|
167
167
|
try {
|
|
168
168
|
t.current.disconnect();
|
|
@@ -177,89 +177,89 @@ function Bn() {
|
|
|
177
177
|
}
|
|
178
178
|
e.current = null;
|
|
179
179
|
}
|
|
180
|
-
|
|
181
|
-
}, [f]), { attach:
|
|
180
|
+
i.current.clear(), l.current = null;
|
|
181
|
+
}, [f]), { attach: s, detach: f, subscribe: b };
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
const [e, t] = C(!1), [r,
|
|
185
|
-
var
|
|
186
|
-
if (
|
|
183
|
+
function Vn() {
|
|
184
|
+
const [e, t] = C(!1), [r, o] = C(""), [i, l] = C(null), d = S(null), a = S(null), s = E(async (k) => {
|
|
185
|
+
var w, v;
|
|
186
|
+
if (d.current && a.current) {
|
|
187
187
|
try {
|
|
188
|
-
await a.current.localParticipant.unpublishTrack(
|
|
188
|
+
await a.current.localParticipant.unpublishTrack(d.current);
|
|
189
189
|
} catch {
|
|
190
190
|
}
|
|
191
|
-
|
|
191
|
+
d.current.stop(), d.current = null;
|
|
192
192
|
}
|
|
193
|
-
a.current =
|
|
193
|
+
a.current = k, l(null);
|
|
194
194
|
try {
|
|
195
|
-
const m = await
|
|
195
|
+
const m = await Bn({
|
|
196
196
|
echoCancellation: !0,
|
|
197
197
|
noiseSuppression: !0
|
|
198
198
|
});
|
|
199
|
-
await
|
|
200
|
-
const
|
|
201
|
-
|
|
199
|
+
await k.localParticipant.publishTrack(m), d.current = m, t(m.isMuted);
|
|
200
|
+
const N = (v = (w = m.mediaStreamTrack) == null ? void 0 : w.getSettings) == null ? void 0 : v.call(w);
|
|
201
|
+
N != null && N.deviceId && o(N.deviceId);
|
|
202
202
|
} catch (m) {
|
|
203
|
-
const
|
|
204
|
-
throw l(
|
|
203
|
+
const N = m instanceof Error && m.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
|
|
204
|
+
throw l(N), m;
|
|
205
205
|
}
|
|
206
|
-
}, []), f = E((
|
|
207
|
-
a.current =
|
|
208
|
-
}, []),
|
|
209
|
-
const
|
|
210
|
-
if (
|
|
206
|
+
}, []), f = E((k) => {
|
|
207
|
+
a.current = k;
|
|
208
|
+
}, []), b = E(async (k) => {
|
|
209
|
+
const w = a.current;
|
|
210
|
+
if (w)
|
|
211
211
|
try {
|
|
212
|
-
await
|
|
213
|
-
} catch (
|
|
214
|
-
console.warn("[useMicrophoneState] switchDevice failed:",
|
|
212
|
+
await w.switchActiveDevice("audioinput", k), o(k);
|
|
213
|
+
} catch (v) {
|
|
214
|
+
console.warn("[useMicrophoneState] switchDevice failed:", v);
|
|
215
215
|
}
|
|
216
216
|
}, []), u = E(() => {
|
|
217
|
-
const
|
|
218
|
-
if (
|
|
219
|
-
|
|
217
|
+
const k = d.current, w = a.current;
|
|
218
|
+
if (k) {
|
|
219
|
+
k.isMuted ? (k.unmute(), t(!1)) : (k.mute(), t(!0));
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
|
-
if (
|
|
223
|
-
const
|
|
224
|
-
t(
|
|
222
|
+
if (w) {
|
|
223
|
+
const v = !e;
|
|
224
|
+
t(v);
|
|
225
225
|
try {
|
|
226
|
-
|
|
226
|
+
w.localParticipant.setMicrophoneEnabled(!v);
|
|
227
227
|
} catch (m) {
|
|
228
228
|
console.warn("[useMicrophoneState] setMicrophoneEnabled failed:", m);
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
}, [e]), c = E(() => {
|
|
232
|
-
const
|
|
233
|
-
if (
|
|
232
|
+
const k = d.current, w = a.current;
|
|
233
|
+
if (k && w) {
|
|
234
234
|
try {
|
|
235
|
-
|
|
235
|
+
w.localParticipant.unpublishTrack(k);
|
|
236
236
|
} catch {
|
|
237
237
|
}
|
|
238
|
-
|
|
238
|
+
k.stop();
|
|
239
239
|
}
|
|
240
|
-
|
|
240
|
+
d.current = null, a.current = null, t(!1), o("");
|
|
241
241
|
}, []), I = E(() => l(null), []);
|
|
242
242
|
return {
|
|
243
243
|
isMuted: e,
|
|
244
244
|
activeDeviceId: r,
|
|
245
|
-
micError:
|
|
245
|
+
micError: i,
|
|
246
246
|
toggleMute: u,
|
|
247
|
-
setupMic:
|
|
247
|
+
setupMic: s,
|
|
248
248
|
attachRoom: f,
|
|
249
|
-
switchDevice:
|
|
249
|
+
switchDevice: b,
|
|
250
250
|
teardownMic: c,
|
|
251
251
|
clearError: I
|
|
252
252
|
};
|
|
253
253
|
}
|
|
254
|
-
const
|
|
255
|
-
function
|
|
256
|
-
const [e, t] = C(!1), [r,
|
|
257
|
-
|
|
254
|
+
const Yn = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
255
|
+
function Gn() {
|
|
256
|
+
const [e, t] = C(!1), [r, o] = C(null), [i, l] = C(null), [d, a] = C(""), s = S(null), f = S(null), b = E((m) => {
|
|
257
|
+
s.current = m;
|
|
258
258
|
}, []), u = E(() => {
|
|
259
259
|
var $;
|
|
260
|
-
const m =
|
|
261
|
-
if (
|
|
262
|
-
const D = m.localParticipant.getTrackPublication(
|
|
260
|
+
const m = s.current, N = f.current;
|
|
261
|
+
if (N && m) {
|
|
262
|
+
const D = m.localParticipant.getTrackPublication(mn.Source.Camera), R = (D == null ? void 0 : D.track) ?? N;
|
|
263
263
|
try {
|
|
264
264
|
m.localParticipant.unpublishTrack(R);
|
|
265
265
|
} catch {
|
|
@@ -271,18 +271,18 @@ function Un() {
|
|
|
271
271
|
}
|
|
272
272
|
f.current = null, l(null), t(!1);
|
|
273
273
|
}, []), c = E(async (m) => {
|
|
274
|
-
const
|
|
275
|
-
if (
|
|
276
|
-
|
|
274
|
+
const N = s.current;
|
|
275
|
+
if (N) {
|
|
276
|
+
o(null);
|
|
277
277
|
try {
|
|
278
|
-
const $ = { ...
|
|
278
|
+
const $ = { ...Yn };
|
|
279
279
|
m && ($.deviceId = m);
|
|
280
|
-
const D = await
|
|
281
|
-
await
|
|
280
|
+
const D = await qn($);
|
|
281
|
+
await N.localParticipant.publishTrack(D), f.current = D;
|
|
282
282
|
const x = D.attach();
|
|
283
283
|
l(x), t(!0), m && a(m);
|
|
284
284
|
try {
|
|
285
|
-
|
|
285
|
+
N.localParticipant.publishData(
|
|
286
286
|
new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
|
|
287
287
|
{ reliable: !0 }
|
|
288
288
|
);
|
|
@@ -290,53 +290,53 @@ function Un() {
|
|
|
290
290
|
}
|
|
291
291
|
} catch ($) {
|
|
292
292
|
const D = $ instanceof Error && $.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
|
|
293
|
-
|
|
293
|
+
o(D);
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
}, []), I = E(async () => {
|
|
297
|
-
e ? u() : await c(
|
|
298
|
-
}, [e,
|
|
297
|
+
e ? u() : await c(d || void 0);
|
|
298
|
+
}, [e, d, u, c]), k = E(async (m) => {
|
|
299
299
|
u(), await c(m);
|
|
300
|
-
}, [u, c]),
|
|
301
|
-
u(),
|
|
302
|
-
}, [u]),
|
|
303
|
-
return
|
|
300
|
+
}, [u, c]), w = E(() => {
|
|
301
|
+
u(), s.current = null, o(null), a("");
|
|
302
|
+
}, [u]), v = E(() => o(null), []);
|
|
303
|
+
return M(() => () => {
|
|
304
304
|
f.current && f.current.stop();
|
|
305
305
|
}, []), {
|
|
306
306
|
isEnabled: e,
|
|
307
307
|
error: r,
|
|
308
|
-
previewEl:
|
|
309
|
-
activeDeviceId:
|
|
308
|
+
previewEl: i,
|
|
309
|
+
activeDeviceId: d,
|
|
310
310
|
toggle: I,
|
|
311
|
-
switchDevice:
|
|
312
|
-
attachRoom:
|
|
313
|
-
teardown:
|
|
314
|
-
clearError:
|
|
311
|
+
switchDevice: k,
|
|
312
|
+
attachRoom: b,
|
|
313
|
+
teardown: w,
|
|
314
|
+
clearError: v
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
|
-
function
|
|
318
|
-
const [e, t] = C(!1), [r,
|
|
319
|
-
|
|
320
|
-
}, []),
|
|
321
|
-
const c =
|
|
317
|
+
function Jn() {
|
|
318
|
+
const [e, t] = C(!1), [r, o] = C(null), [i, l] = C(null), d = S(null), a = E((c) => {
|
|
319
|
+
d.current = c;
|
|
320
|
+
}, []), s = E(() => l(null), []), f = E(async () => {
|
|
321
|
+
const c = d.current;
|
|
322
322
|
if (c) {
|
|
323
323
|
if (e) {
|
|
324
324
|
try {
|
|
325
325
|
await c.localParticipant.setScreenShareEnabled(!1);
|
|
326
326
|
} catch {
|
|
327
327
|
}
|
|
328
|
-
|
|
328
|
+
s(), t(!1);
|
|
329
329
|
return;
|
|
330
330
|
}
|
|
331
|
-
|
|
331
|
+
o(null);
|
|
332
332
|
try {
|
|
333
333
|
await c.localParticipant.setScreenShareEnabled(!0);
|
|
334
334
|
let I = 0;
|
|
335
|
-
const
|
|
336
|
-
const
|
|
337
|
-
if (
|
|
338
|
-
const
|
|
339
|
-
l(
|
|
335
|
+
const k = () => {
|
|
336
|
+
const w = c.localParticipant.getTrackPublication(mn.Source.ScreenShare);
|
|
337
|
+
if (w != null && w.track) {
|
|
338
|
+
const v = w.track.attach();
|
|
339
|
+
l(v), t(!0);
|
|
340
340
|
try {
|
|
341
341
|
c.localParticipant.publishData(
|
|
342
342
|
new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
|
|
@@ -346,49 +346,49 @@ function jn() {
|
|
|
346
346
|
}
|
|
347
347
|
return;
|
|
348
348
|
}
|
|
349
|
-
I++ < 10 ? setTimeout(
|
|
349
|
+
I++ < 10 ? setTimeout(k, 100) : t(!0);
|
|
350
350
|
};
|
|
351
|
-
|
|
351
|
+
k();
|
|
352
352
|
} catch (I) {
|
|
353
|
-
const
|
|
354
|
-
|
|
353
|
+
const k = I instanceof Error ? I.name : "";
|
|
354
|
+
k !== "NotAllowedError" && k !== "AbortError" && o("Screen share unavailable. Try again."), t(!1);
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
|
-
}, [e,
|
|
358
|
-
const c =
|
|
357
|
+
}, [e, s]), b = E(() => {
|
|
358
|
+
const c = d.current;
|
|
359
359
|
if (c && e)
|
|
360
360
|
try {
|
|
361
361
|
c.localParticipant.setScreenShareEnabled(!1);
|
|
362
362
|
} catch {
|
|
363
363
|
}
|
|
364
|
-
|
|
365
|
-
}, [e,
|
|
366
|
-
return { isEnabled: e, error: r, previewEl:
|
|
364
|
+
s(), t(!1), o(null), d.current = null;
|
|
365
|
+
}, [e, s]), u = E(() => o(null), []);
|
|
366
|
+
return { isEnabled: e, error: r, previewEl: i, toggle: f, attachRoom: a, teardown: b, clearError: u };
|
|
367
367
|
}
|
|
368
|
-
function
|
|
369
|
-
const [e, t] = C([]), [r,
|
|
368
|
+
function Kn() {
|
|
369
|
+
const [e, t] = C([]), [r, o] = C([]), i = E(async () => {
|
|
370
370
|
if (!(typeof navigator > "u" || !navigator.mediaDevices))
|
|
371
371
|
try {
|
|
372
372
|
const l = await navigator.mediaDevices.enumerateDevices();
|
|
373
|
-
t(l.filter((
|
|
373
|
+
t(l.filter((d) => d.kind === "audioinput")), o(l.filter((d) => d.kind === "videoinput"));
|
|
374
374
|
} catch {
|
|
375
375
|
}
|
|
376
376
|
}, []);
|
|
377
|
-
return
|
|
378
|
-
if (
|
|
379
|
-
const l = () => void
|
|
377
|
+
return M(() => {
|
|
378
|
+
if (i(), typeof navigator > "u" || !navigator.mediaDevices) return;
|
|
379
|
+
const l = () => void i();
|
|
380
380
|
return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
|
|
381
|
-
}, [
|
|
381
|
+
}, [i]), { mics: e, cameras: r, refresh: i };
|
|
382
382
|
}
|
|
383
|
-
function
|
|
384
|
-
const [
|
|
385
|
-
return
|
|
383
|
+
function Xn(e, t, r = !1) {
|
|
384
|
+
const [o, i] = C(null), [l, d] = C(null), [a, s] = C(!r && !!e);
|
|
385
|
+
return M(() => {
|
|
386
386
|
if (r || !e) {
|
|
387
|
-
|
|
387
|
+
s(!1);
|
|
388
388
|
return;
|
|
389
389
|
}
|
|
390
|
-
const f = new AbortController(),
|
|
391
|
-
return
|
|
390
|
+
const f = new AbortController(), b = t || "https://app.livelayer.studio";
|
|
391
|
+
return s(!0), d(null), fetch(`${b}/api/widget/agent/${encodeURIComponent(e)}`, {
|
|
392
392
|
signal: f.signal
|
|
393
393
|
}).then(async (u) => {
|
|
394
394
|
if (!u.ok) {
|
|
@@ -397,13 +397,13 @@ function Yn(e, t, r = !1) {
|
|
|
397
397
|
}
|
|
398
398
|
return u.json();
|
|
399
399
|
}).then((u) => {
|
|
400
|
-
f.signal.aborted || (
|
|
400
|
+
f.signal.aborted || (i(u), s(!1));
|
|
401
401
|
}).catch((u) => {
|
|
402
|
-
f.signal.aborted || (
|
|
402
|
+
f.signal.aborted || (d(u instanceof Error ? u.message : "Agent lookup failed"), s(!1));
|
|
403
403
|
}), () => f.abort();
|
|
404
|
-
}, [e, t, r]), { info:
|
|
404
|
+
}, [e, t, r]), { info: o, error: l, loading: a };
|
|
405
405
|
}
|
|
406
|
-
function
|
|
406
|
+
function Qn(e) {
|
|
407
407
|
if (typeof window > "u") return null;
|
|
408
408
|
try {
|
|
409
409
|
return window.localStorage.getItem(e);
|
|
@@ -411,192 +411,192 @@ function Gn(e) {
|
|
|
411
411
|
return null;
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
function
|
|
414
|
+
function Zn(e, t) {
|
|
415
415
|
if (!(typeof window > "u"))
|
|
416
416
|
try {
|
|
417
417
|
window.localStorage.setItem(e, t);
|
|
418
418
|
} catch {
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
|
-
function
|
|
421
|
+
function er({
|
|
422
422
|
value: e,
|
|
423
423
|
defaultValue: t = "expanded",
|
|
424
424
|
onChange: r
|
|
425
425
|
} = {}) {
|
|
426
|
-
const
|
|
427
|
-
(
|
|
428
|
-
|
|
426
|
+
const o = e !== void 0, [i, l] = C(t), d = o ? e : i, a = E(
|
|
427
|
+
(s) => {
|
|
428
|
+
s !== d && (o || l(s), r == null || r(s));
|
|
429
429
|
},
|
|
430
|
-
[
|
|
430
|
+
[d, o, r]
|
|
431
431
|
);
|
|
432
|
-
return [
|
|
432
|
+
return [d, a];
|
|
433
433
|
}
|
|
434
|
-
const
|
|
435
|
-
function
|
|
436
|
-
return e &&
|
|
434
|
+
const tr = ["hidden", "minimized", "expanded"];
|
|
435
|
+
function nr(e) {
|
|
436
|
+
return e && tr.includes(e) ? e : null;
|
|
437
437
|
}
|
|
438
|
-
function
|
|
438
|
+
function rr({
|
|
439
439
|
value: e,
|
|
440
440
|
defaultValue: t = "expanded",
|
|
441
441
|
onChange: r,
|
|
442
|
-
persistKey:
|
|
443
|
-
disablePersistence:
|
|
442
|
+
persistKey: o = "ll-widget",
|
|
443
|
+
disablePersistence: i = !1
|
|
444
444
|
} = {}) {
|
|
445
|
-
const l = `${
|
|
445
|
+
const l = `${o}:display-mode`, d = S(!1), [a, s] = er({
|
|
446
446
|
value: e,
|
|
447
447
|
defaultValue: t,
|
|
448
448
|
onChange: (f) => {
|
|
449
|
-
e === void 0 && !
|
|
449
|
+
e === void 0 && !i && Zn(l, f), r == null || r(f);
|
|
450
450
|
}
|
|
451
451
|
});
|
|
452
|
-
return
|
|
453
|
-
if (
|
|
454
|
-
const f = Qn(
|
|
455
|
-
f && f !== a &&
|
|
456
|
-
}, []), [a,
|
|
457
|
-
}
|
|
458
|
-
const
|
|
459
|
-
function
|
|
452
|
+
return M(() => {
|
|
453
|
+
if (d.current || (d.current = !0, i || e !== void 0)) return;
|
|
454
|
+
const f = nr(Qn(l));
|
|
455
|
+
f && f !== a && s(f);
|
|
456
|
+
}, []), [a, s];
|
|
457
|
+
}
|
|
458
|
+
const or = 640;
|
|
459
|
+
function ir(e = or) {
|
|
460
460
|
const [t, r] = C(!1);
|
|
461
|
-
return
|
|
461
|
+
return M(() => {
|
|
462
462
|
if (e === !1) {
|
|
463
463
|
r(!1);
|
|
464
464
|
return;
|
|
465
465
|
}
|
|
466
466
|
if (typeof window > "u" || typeof window.matchMedia > "u")
|
|
467
467
|
return;
|
|
468
|
-
const
|
|
469
|
-
return l(), typeof
|
|
470
|
-
|
|
468
|
+
const o = `(max-width: ${e - 1}px)`, i = window.matchMedia(o), l = () => r(i.matches);
|
|
469
|
+
return l(), typeof i.addEventListener == "function" ? (i.addEventListener("change", l), () => i.removeEventListener("change", l)) : (i.addListener(l), () => {
|
|
470
|
+
i.removeListener(l);
|
|
471
471
|
});
|
|
472
472
|
}, [e]), t;
|
|
473
473
|
}
|
|
474
|
-
const
|
|
475
|
-
function
|
|
476
|
-
if (typeof window > "u" || window.history[
|
|
474
|
+
const Jt = "__llHistoryPatched", wt = "ll:pathname";
|
|
475
|
+
function lr() {
|
|
476
|
+
if (typeof window > "u" || window.history[Jt]) return;
|
|
477
477
|
const e = window.history.pushState, t = window.history.replaceState;
|
|
478
478
|
window.history.pushState = function(...r) {
|
|
479
|
-
const
|
|
480
|
-
return window.dispatchEvent(new Event(
|
|
479
|
+
const o = e.apply(this, r);
|
|
480
|
+
return window.dispatchEvent(new Event(wt)), o;
|
|
481
481
|
}, window.history.replaceState = function(...r) {
|
|
482
|
-
const
|
|
483
|
-
return window.dispatchEvent(new Event(
|
|
484
|
-
}, window.history[
|
|
482
|
+
const o = t.apply(this, r);
|
|
483
|
+
return window.dispatchEvent(new Event(wt)), o;
|
|
484
|
+
}, window.history[Jt] = !0;
|
|
485
485
|
}
|
|
486
|
-
function
|
|
486
|
+
function Kt() {
|
|
487
487
|
return typeof window > "u" ? "/" : window.location.pathname || "/";
|
|
488
488
|
}
|
|
489
|
-
function
|
|
489
|
+
function ar(e) {
|
|
490
490
|
const [t, r] = C(
|
|
491
|
-
() => e ??
|
|
491
|
+
() => e ?? Kt()
|
|
492
492
|
);
|
|
493
|
-
return
|
|
493
|
+
return M(() => {
|
|
494
494
|
if (e !== void 0) return;
|
|
495
|
-
|
|
496
|
-
const
|
|
497
|
-
return
|
|
498
|
-
window.removeEventListener("popstate",
|
|
495
|
+
lr();
|
|
496
|
+
const o = () => r(Kt());
|
|
497
|
+
return o(), window.addEventListener("popstate", o), window.addEventListener(wt, o), () => {
|
|
498
|
+
window.removeEventListener("popstate", o), window.removeEventListener(wt, o);
|
|
499
499
|
};
|
|
500
500
|
}, [e]), e ?? t;
|
|
501
501
|
}
|
|
502
|
-
const
|
|
503
|
-
function
|
|
504
|
-
return e.replace(
|
|
502
|
+
const Xt = /* @__PURE__ */ new Map(), cr = /[\\^$+?.()|{}[\]]/g;
|
|
503
|
+
function sr(e) {
|
|
504
|
+
return e.replace(cr, "\\$&");
|
|
505
505
|
}
|
|
506
|
-
function
|
|
507
|
-
const t =
|
|
506
|
+
function dr(e) {
|
|
507
|
+
const t = Xt.get(e);
|
|
508
508
|
if (t) return t;
|
|
509
|
-
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e,
|
|
510
|
-
return
|
|
509
|
+
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, o = "", i = "", l = r.replace(/\*\*/g, o).replace(/\*/g, i), a = sr(l).replace(new RegExp(`\\/${o}`, "g"), "(?:\\/.*)?").replace(new RegExp(o, "g"), ".*").replace(new RegExp(i, "g"), "[^/]+"), s = new RegExp(`^${a}\\/?$`);
|
|
510
|
+
return Xt.set(e, s), s;
|
|
511
511
|
}
|
|
512
|
-
function
|
|
512
|
+
function ur(e, t) {
|
|
513
513
|
const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
|
|
514
|
-
return
|
|
514
|
+
return dr(e).test(r);
|
|
515
515
|
}
|
|
516
|
-
function
|
|
517
|
-
return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) :
|
|
516
|
+
function fr(e, t) {
|
|
517
|
+
return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : ur(e, t);
|
|
518
518
|
}
|
|
519
|
-
function
|
|
519
|
+
function Qt(e, t) {
|
|
520
520
|
if (!e || e.length === 0) return !1;
|
|
521
521
|
for (const r of e)
|
|
522
|
-
if (
|
|
522
|
+
if (fr(r, t)) return !0;
|
|
523
523
|
return !1;
|
|
524
524
|
}
|
|
525
|
-
function
|
|
526
|
-
return e === void 0 ? !0 :
|
|
525
|
+
function pr(e, t, r) {
|
|
526
|
+
return e === void 0 ? !0 : Qt(r, e) ? !1 : t && t.length > 0 ? Qt(t, e) : !0;
|
|
527
527
|
}
|
|
528
|
-
function
|
|
529
|
-
return
|
|
530
|
-
() =>
|
|
528
|
+
function hr(e, t, r) {
|
|
529
|
+
return Ye(
|
|
530
|
+
() => pr(e, t, r),
|
|
531
531
|
[e, t, r]
|
|
532
532
|
);
|
|
533
533
|
}
|
|
534
|
-
function
|
|
534
|
+
function mr(e) {
|
|
535
535
|
return e === !1 ? { navigate: !1, thinking: !1, action: !1 } : e === void 0 || e === !0 ? { navigate: !0, thinking: !0, action: !0 } : {
|
|
536
536
|
navigate: e.navigate !== !1,
|
|
537
537
|
thinking: e.thinking !== !1,
|
|
538
538
|
action: e.action !== !1
|
|
539
539
|
};
|
|
540
540
|
}
|
|
541
|
-
function
|
|
542
|
-
const t =
|
|
543
|
-
(
|
|
541
|
+
function gr(e) {
|
|
542
|
+
const t = Ye(() => mr(e.config), [e.config]), r = e.baseUrl.replace(/\/+$/, ""), o = S(null), i = E(
|
|
543
|
+
(s) => {
|
|
544
544
|
try {
|
|
545
|
-
new Audio(`${r}${
|
|
545
|
+
new Audio(`${r}${s}`).play().catch(() => {
|
|
546
546
|
});
|
|
547
547
|
} catch {
|
|
548
548
|
}
|
|
549
549
|
},
|
|
550
550
|
[r]
|
|
551
551
|
), l = E(() => {
|
|
552
|
-
t.navigate &&
|
|
553
|
-
}, [t.navigate,
|
|
554
|
-
t.action &&
|
|
555
|
-
}, [t.action,
|
|
556
|
-
(
|
|
552
|
+
t.navigate && i("/audio/page-change-sound.mp3");
|
|
553
|
+
}, [t.navigate, i]), d = E(() => {
|
|
554
|
+
t.action && i("/audio/confirmation-sound.mp3");
|
|
555
|
+
}, [t.action, i]), a = E(
|
|
556
|
+
(s) => {
|
|
557
557
|
if (!t.thinking) {
|
|
558
|
-
if (
|
|
558
|
+
if (o.current) {
|
|
559
559
|
try {
|
|
560
|
-
|
|
560
|
+
o.current.pause();
|
|
561
561
|
} catch {
|
|
562
562
|
}
|
|
563
|
-
|
|
563
|
+
o.current = null;
|
|
564
564
|
}
|
|
565
565
|
return;
|
|
566
566
|
}
|
|
567
|
-
if (
|
|
568
|
-
if (
|
|
567
|
+
if (s) {
|
|
568
|
+
if (o.current) return;
|
|
569
569
|
try {
|
|
570
570
|
const f = new Audio(`${r}/audio/thinking-sound.mp3`);
|
|
571
571
|
f.loop = !0, f.volume = 0.3, f.play().catch(() => {
|
|
572
|
-
|
|
573
|
-
}),
|
|
572
|
+
o.current = null;
|
|
573
|
+
}), o.current = f;
|
|
574
574
|
} catch {
|
|
575
575
|
}
|
|
576
|
-
} else if (
|
|
576
|
+
} else if (o.current) {
|
|
577
577
|
try {
|
|
578
|
-
|
|
578
|
+
o.current.pause();
|
|
579
579
|
} catch {
|
|
580
580
|
}
|
|
581
|
-
|
|
581
|
+
o.current = null;
|
|
582
582
|
}
|
|
583
583
|
},
|
|
584
584
|
[r, t.thinking]
|
|
585
585
|
);
|
|
586
|
-
return
|
|
587
|
-
if (
|
|
586
|
+
return M(() => () => {
|
|
587
|
+
if (o.current) {
|
|
588
588
|
try {
|
|
589
|
-
|
|
589
|
+
o.current.pause();
|
|
590
590
|
} catch {
|
|
591
591
|
}
|
|
592
|
-
|
|
592
|
+
o.current = null;
|
|
593
593
|
}
|
|
594
|
-
}, []),
|
|
595
|
-
() => ({ playPageChange: l, playConfirmation:
|
|
596
|
-
[l,
|
|
594
|
+
}, []), Ye(
|
|
595
|
+
() => ({ playPageChange: l, playConfirmation: d, setThinking: a }),
|
|
596
|
+
[l, d, a]
|
|
597
597
|
);
|
|
598
598
|
}
|
|
599
|
-
const
|
|
599
|
+
const Zt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ y(
|
|
600
600
|
"svg",
|
|
601
601
|
{
|
|
602
602
|
className: t,
|
|
@@ -642,7 +642,7 @@ const Jt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ v(
|
|
|
642
642
|
}
|
|
643
643
|
)
|
|
644
644
|
}
|
|
645
|
-
),
|
|
645
|
+
), en = ({ className: e }) => /* @__PURE__ */ n(
|
|
646
646
|
"svg",
|
|
647
647
|
{
|
|
648
648
|
className: e,
|
|
@@ -660,7 +660,7 @@ const Jt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ v(
|
|
|
660
660
|
}
|
|
661
661
|
)
|
|
662
662
|
}
|
|
663
|
-
),
|
|
663
|
+
), yr = ({ className: e }) => /* @__PURE__ */ n(
|
|
664
664
|
"svg",
|
|
665
665
|
{
|
|
666
666
|
className: e,
|
|
@@ -671,12 +671,12 @@ const Jt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ v(
|
|
|
671
671
|
"aria-hidden": "true",
|
|
672
672
|
children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
673
673
|
}
|
|
674
|
-
),
|
|
674
|
+
), vr = {
|
|
675
675
|
left: 180,
|
|
676
676
|
right: 0,
|
|
677
677
|
up: -90,
|
|
678
678
|
down: 90
|
|
679
|
-
},
|
|
679
|
+
}, tn = ({ direction: e = "right", className: t }) => /* @__PURE__ */ n(
|
|
680
680
|
"svg",
|
|
681
681
|
{
|
|
682
682
|
className: t,
|
|
@@ -684,19 +684,19 @@ const Jt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ v(
|
|
|
684
684
|
viewBox: "0 0 24 24",
|
|
685
685
|
stroke: "currentColor",
|
|
686
686
|
strokeWidth: 2,
|
|
687
|
-
style: { transform: `rotate(${
|
|
687
|
+
style: { transform: `rotate(${vr[e]}deg)` },
|
|
688
688
|
"aria-hidden": "true",
|
|
689
689
|
children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" })
|
|
690
690
|
}
|
|
691
691
|
);
|
|
692
|
-
function
|
|
692
|
+
function br(e) {
|
|
693
693
|
return e === "top-left" || e === "bottom-left" ? "left" : "right";
|
|
694
694
|
}
|
|
695
|
-
const
|
|
696
|
-
function
|
|
695
|
+
const gn = "ll-hidden-tab-center-y", wr = 5, nn = 16;
|
|
696
|
+
function _r() {
|
|
697
697
|
if (typeof window > "u") return null;
|
|
698
698
|
try {
|
|
699
|
-
const e = window.localStorage.getItem(
|
|
699
|
+
const e = window.localStorage.getItem(gn);
|
|
700
700
|
if (!e) return null;
|
|
701
701
|
const t = Number.parseFloat(e);
|
|
702
702
|
return Number.isFinite(t) ? t : null;
|
|
@@ -704,47 +704,47 @@ function yr() {
|
|
|
704
704
|
return null;
|
|
705
705
|
}
|
|
706
706
|
}
|
|
707
|
-
function
|
|
707
|
+
function rn(e) {
|
|
708
708
|
if (!(typeof window > "u"))
|
|
709
709
|
try {
|
|
710
|
-
window.localStorage.setItem(
|
|
710
|
+
window.localStorage.setItem(gn, String(e));
|
|
711
711
|
} catch {
|
|
712
712
|
}
|
|
713
713
|
}
|
|
714
|
-
const
|
|
714
|
+
const xr = ({
|
|
715
715
|
position: e,
|
|
716
716
|
isMobile: t,
|
|
717
717
|
isSpeaking: r,
|
|
718
|
-
onExpand:
|
|
719
|
-
label:
|
|
718
|
+
onExpand: o,
|
|
719
|
+
label: i = "Open widget",
|
|
720
720
|
avatarImageUrl: l,
|
|
721
|
-
agentName:
|
|
721
|
+
agentName: d
|
|
722
722
|
}) => {
|
|
723
|
-
const a =
|
|
724
|
-
(
|
|
725
|
-
if (typeof window > "u") return
|
|
726
|
-
const
|
|
727
|
-
return
|
|
723
|
+
const a = br(e), s = a === "right" ? "left" : "right", f = t ? 80 : 72, b = !!l, [u, c] = C(null), [I, k] = C(!1), w = S(null), v = S(!1), m = E(
|
|
724
|
+
(A) => {
|
|
725
|
+
if (typeof window > "u") return A;
|
|
726
|
+
const T = f / 2, F = nn + T, oe = window.innerHeight - nn - T;
|
|
727
|
+
return oe < F ? Math.max(F, A) : Math.max(F, Math.min(oe, A));
|
|
728
728
|
},
|
|
729
729
|
[f]
|
|
730
730
|
);
|
|
731
|
-
|
|
732
|
-
const
|
|
733
|
-
c(m(
|
|
734
|
-
const
|
|
731
|
+
M(() => {
|
|
732
|
+
const A = _r();
|
|
733
|
+
c(m(A ?? window.innerHeight / 2));
|
|
734
|
+
const T = () => {
|
|
735
735
|
c((F) => F === null ? null : m(F));
|
|
736
736
|
};
|
|
737
|
-
return window.addEventListener("resize",
|
|
737
|
+
return window.addEventListener("resize", T), () => window.removeEventListener("resize", T);
|
|
738
738
|
}, [m]);
|
|
739
|
-
const
|
|
740
|
-
(
|
|
741
|
-
if (!(
|
|
739
|
+
const N = E(
|
|
740
|
+
(A) => {
|
|
741
|
+
if (!(A.pointerType === "mouse" && A.button !== 0) && u !== null) {
|
|
742
742
|
try {
|
|
743
|
-
|
|
743
|
+
A.currentTarget.setPointerCapture(A.pointerId);
|
|
744
744
|
} catch {
|
|
745
745
|
}
|
|
746
|
-
|
|
747
|
-
startClientY:
|
|
746
|
+
w.current = {
|
|
747
|
+
startClientY: A.clientY,
|
|
748
748
|
startCenterY: u,
|
|
749
749
|
moved: !1
|
|
750
750
|
};
|
|
@@ -752,40 +752,40 @@ const vr = ({
|
|
|
752
752
|
},
|
|
753
753
|
[u]
|
|
754
754
|
), $ = E(
|
|
755
|
-
(
|
|
756
|
-
const
|
|
757
|
-
if (!
|
|
758
|
-
const F =
|
|
759
|
-
!
|
|
755
|
+
(A) => {
|
|
756
|
+
const T = w.current;
|
|
757
|
+
if (!T) return;
|
|
758
|
+
const F = A.clientY - T.startClientY;
|
|
759
|
+
!T.moved && Math.abs(F) > wr && (T.moved = !0, k(!0)), T.moved && c(m(T.startCenterY + F));
|
|
760
760
|
},
|
|
761
761
|
[m]
|
|
762
762
|
), D = E(
|
|
763
|
-
(
|
|
764
|
-
const
|
|
765
|
-
if (
|
|
763
|
+
(A) => {
|
|
764
|
+
const T = w.current;
|
|
765
|
+
if (T) {
|
|
766
766
|
try {
|
|
767
|
-
|
|
767
|
+
A.currentTarget.releasePointerCapture(A.pointerId);
|
|
768
768
|
} catch {
|
|
769
769
|
}
|
|
770
|
-
|
|
770
|
+
w.current = null, T.moved && (k(!1), v.current = !0, c((F) => (F !== null && rn(F), F)));
|
|
771
771
|
}
|
|
772
772
|
},
|
|
773
773
|
[]
|
|
774
774
|
), x = E(() => {
|
|
775
|
-
if (
|
|
776
|
-
|
|
775
|
+
if (v.current) {
|
|
776
|
+
v.current = !1;
|
|
777
777
|
return;
|
|
778
778
|
}
|
|
779
|
-
|
|
780
|
-
}, [
|
|
781
|
-
(
|
|
782
|
-
if (
|
|
783
|
-
|
|
784
|
-
const
|
|
779
|
+
o();
|
|
780
|
+
}, [o]), R = E(
|
|
781
|
+
(A) => {
|
|
782
|
+
if (A.key === "ArrowUp" || A.key === "ArrowDown") {
|
|
783
|
+
A.preventDefault();
|
|
784
|
+
const T = A.key === "ArrowUp" ? -8 : 8;
|
|
785
785
|
c((F) => {
|
|
786
786
|
if (F === null) return F;
|
|
787
|
-
const
|
|
788
|
-
return
|
|
787
|
+
const oe = m(F + T);
|
|
788
|
+
return rn(oe), oe;
|
|
789
789
|
});
|
|
790
790
|
}
|
|
791
791
|
},
|
|
@@ -796,32 +796,32 @@ const vr = ({
|
|
|
796
796
|
t ? "ll-hidden--mobile" : "ll-hidden--desktop",
|
|
797
797
|
r ? "ll-hidden--speaking" : null,
|
|
798
798
|
I ? "is-dragging" : null,
|
|
799
|
-
|
|
799
|
+
b ? "ll-hidden--with-avatar" : null
|
|
800
800
|
].filter(Boolean).join(" "), q = u === null ? void 0 : { top: `${u - f / 2}px`, transform: "none" };
|
|
801
801
|
return /* @__PURE__ */ n(
|
|
802
802
|
"button",
|
|
803
803
|
{
|
|
804
804
|
type: "button",
|
|
805
805
|
className: B,
|
|
806
|
-
onPointerDown:
|
|
806
|
+
onPointerDown: N,
|
|
807
807
|
onPointerMove: $,
|
|
808
808
|
onPointerUp: D,
|
|
809
809
|
onPointerCancel: D,
|
|
810
810
|
onClick: x,
|
|
811
811
|
onKeyDown: R,
|
|
812
|
-
"aria-label":
|
|
812
|
+
"aria-label": i,
|
|
813
813
|
"data-position": e,
|
|
814
814
|
style: q,
|
|
815
|
-
children:
|
|
815
|
+
children: b ? (
|
|
816
816
|
// Layout: tiny chevron flush against the inward edge (peeks out
|
|
817
817
|
// as the click affordance), then the circular avatar photo
|
|
818
818
|
// taking the rest of the tab. Reinforces "this is an
|
|
819
819
|
// avatar-based experience" even when collapsed.
|
|
820
|
-
/* @__PURE__ */
|
|
820
|
+
/* @__PURE__ */ y(Ve, { children: [
|
|
821
821
|
/* @__PURE__ */ n(
|
|
822
|
-
|
|
822
|
+
tn,
|
|
823
823
|
{
|
|
824
|
-
direction:
|
|
824
|
+
direction: s,
|
|
825
825
|
className: "ll-hidden__chevron ll-hidden__chevron--mini"
|
|
826
826
|
}
|
|
827
827
|
),
|
|
@@ -829,63 +829,63 @@ const vr = ({
|
|
|
829
829
|
"img",
|
|
830
830
|
{
|
|
831
831
|
src: l,
|
|
832
|
-
alt:
|
|
832
|
+
alt: d ? `${d} avatar` : "Agent avatar",
|
|
833
833
|
className: "ll-hidden__avatar",
|
|
834
834
|
draggable: !1
|
|
835
835
|
}
|
|
836
836
|
)
|
|
837
837
|
] })
|
|
838
838
|
) : /* @__PURE__ */ n(
|
|
839
|
-
|
|
839
|
+
tn,
|
|
840
840
|
{
|
|
841
|
-
direction:
|
|
841
|
+
direction: s,
|
|
842
842
|
className: "ll-hidden__chevron"
|
|
843
843
|
}
|
|
844
844
|
)
|
|
845
845
|
}
|
|
846
846
|
);
|
|
847
|
-
},
|
|
847
|
+
}, kr = ({
|
|
848
848
|
audioLevel: e,
|
|
849
849
|
bars: t = 20,
|
|
850
850
|
maxHeight: r = 20,
|
|
851
|
-
minHeight:
|
|
852
|
-
className:
|
|
851
|
+
minHeight: o = 4,
|
|
852
|
+
className: i,
|
|
853
853
|
barClassName: l
|
|
854
854
|
}) => {
|
|
855
|
-
const
|
|
856
|
-
const
|
|
857
|
-
return Array.from({ length: t }, (u, c) => 0.5 + c *
|
|
855
|
+
const d = S(null), a = S([]), s = Ye(() => {
|
|
856
|
+
const b = (Math.sqrt(5) - 1) / 2;
|
|
857
|
+
return Array.from({ length: t }, (u, c) => 0.5 + c * b % 1 * 0.5);
|
|
858
858
|
}, [t]);
|
|
859
|
-
|
|
859
|
+
M(() => e.subscribe((u) => {
|
|
860
860
|
for (let c = 0; c < t; c++) {
|
|
861
861
|
const I = a.current[c];
|
|
862
862
|
if (!I) continue;
|
|
863
|
-
const
|
|
864
|
-
I.style.height = `${
|
|
863
|
+
const k = Math.max(o, u * r * s[c]);
|
|
864
|
+
I.style.height = `${k}px`;
|
|
865
865
|
}
|
|
866
|
-
}), [e, t, r,
|
|
867
|
-
const f = ["ll-waveform",
|
|
868
|
-
return /* @__PURE__ */ n("div", { ref:
|
|
866
|
+
}), [e, t, r, o, s]);
|
|
867
|
+
const f = ["ll-waveform", i].filter(Boolean).join(" ");
|
|
868
|
+
return /* @__PURE__ */ n("div", { ref: d, className: f, "aria-hidden": "true", children: Array.from({ length: t }, (b, u) => /* @__PURE__ */ n(
|
|
869
869
|
"div",
|
|
870
870
|
{
|
|
871
871
|
ref: (c) => {
|
|
872
872
|
a.current[u] = c;
|
|
873
873
|
},
|
|
874
874
|
className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
|
|
875
|
-
style: { height: `${
|
|
875
|
+
style: { height: `${o}px` }
|
|
876
876
|
},
|
|
877
877
|
u
|
|
878
878
|
)) });
|
|
879
|
-
},
|
|
879
|
+
}, Lr = ({
|
|
880
880
|
position: e,
|
|
881
881
|
isMobile: t,
|
|
882
882
|
agentName: r,
|
|
883
|
-
avatarImageUrl:
|
|
884
|
-
agentState:
|
|
883
|
+
avatarImageUrl: o,
|
|
884
|
+
agentState: i,
|
|
885
885
|
isMuted: l,
|
|
886
|
-
audioLevel:
|
|
886
|
+
audioLevel: d,
|
|
887
887
|
onExpand: a,
|
|
888
|
-
onToggleMute:
|
|
888
|
+
onToggleMute: s,
|
|
889
889
|
onClose: f
|
|
890
890
|
}) => t ? /* @__PURE__ */ n(
|
|
891
891
|
"div",
|
|
@@ -893,7 +893,7 @@ const vr = ({
|
|
|
893
893
|
className: "ll-minimized ll-minimized--mobile",
|
|
894
894
|
role: "region",
|
|
895
895
|
"aria-label": `${r} widget`,
|
|
896
|
-
children: /* @__PURE__ */
|
|
896
|
+
children: /* @__PURE__ */ y(
|
|
897
897
|
"button",
|
|
898
898
|
{
|
|
899
899
|
type: "button",
|
|
@@ -901,45 +901,45 @@ const vr = ({
|
|
|
901
901
|
onClick: a,
|
|
902
902
|
"aria-label": `Expand ${r} widget`,
|
|
903
903
|
children: [
|
|
904
|
-
|
|
904
|
+
o ? (
|
|
905
905
|
// eslint-disable-next-line @next/next/no-img-element
|
|
906
906
|
/* @__PURE__ */ n(
|
|
907
907
|
"img",
|
|
908
908
|
{
|
|
909
|
-
src:
|
|
909
|
+
src: o,
|
|
910
910
|
alt: r,
|
|
911
911
|
className: "ll-minimized__avatar"
|
|
912
912
|
}
|
|
913
913
|
)
|
|
914
914
|
) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
|
|
915
915
|
/* @__PURE__ */ n(
|
|
916
|
-
|
|
916
|
+
kr,
|
|
917
917
|
{
|
|
918
|
-
audioLevel:
|
|
918
|
+
audioLevel: d,
|
|
919
919
|
bars: 16,
|
|
920
920
|
maxHeight: 18,
|
|
921
921
|
className: "ll-minimized__waveform"
|
|
922
922
|
}
|
|
923
923
|
),
|
|
924
924
|
/* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
|
|
925
|
-
/* @__PURE__ */
|
|
925
|
+
/* @__PURE__ */ y("div", { className: "ll-minimized__controls", children: [
|
|
926
926
|
/* @__PURE__ */ n(
|
|
927
927
|
"span",
|
|
928
928
|
{
|
|
929
929
|
className: "ll-minimized__btn",
|
|
930
930
|
role: "button",
|
|
931
931
|
tabIndex: 0,
|
|
932
|
-
onClick: (
|
|
933
|
-
|
|
932
|
+
onClick: (b) => {
|
|
933
|
+
b.stopPropagation(), s();
|
|
934
934
|
},
|
|
935
|
-
onKeyDown: (
|
|
936
|
-
(
|
|
935
|
+
onKeyDown: (b) => {
|
|
936
|
+
(b.key === "Enter" || b.key === " ") && (b.stopPropagation(), b.preventDefault(), s());
|
|
937
937
|
},
|
|
938
938
|
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
939
|
-
children: /* @__PURE__ */ n(
|
|
939
|
+
children: /* @__PURE__ */ n(Zt, { muted: l, className: "ll-minimized__icon" })
|
|
940
940
|
}
|
|
941
941
|
),
|
|
942
|
-
/* @__PURE__ */ n(
|
|
942
|
+
/* @__PURE__ */ n(en, { className: "ll-minimized__icon ll-minimized__icon--expand" })
|
|
943
943
|
] })
|
|
944
944
|
]
|
|
945
945
|
}
|
|
@@ -952,31 +952,31 @@ const vr = ({
|
|
|
952
952
|
"data-position": e,
|
|
953
953
|
role: "region",
|
|
954
954
|
"aria-label": `${r} widget`,
|
|
955
|
-
children: /* @__PURE__ */
|
|
956
|
-
|
|
955
|
+
children: /* @__PURE__ */ y("div", { className: "ll-minimized__surface", children: [
|
|
956
|
+
o ? (
|
|
957
957
|
// eslint-disable-next-line @next/next/no-img-element
|
|
958
958
|
/* @__PURE__ */ n(
|
|
959
959
|
"img",
|
|
960
960
|
{
|
|
961
|
-
src:
|
|
961
|
+
src: o,
|
|
962
962
|
alt: r,
|
|
963
963
|
className: "ll-minimized__avatar"
|
|
964
964
|
}
|
|
965
965
|
)
|
|
966
966
|
) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
|
|
967
|
-
/* @__PURE__ */
|
|
967
|
+
/* @__PURE__ */ y("div", { className: "ll-minimized__meta", children: [
|
|
968
968
|
/* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
|
|
969
|
-
/* @__PURE__ */ n("span", { className: "ll-minimized__state", children:
|
|
969
|
+
/* @__PURE__ */ n("span", { className: "ll-minimized__state", children: i === "speaking" ? "Speaking" : i === "thinking" ? "Thinking" : "Listening" })
|
|
970
970
|
] }),
|
|
971
|
-
/* @__PURE__ */
|
|
971
|
+
/* @__PURE__ */ y("div", { className: "ll-minimized__controls", children: [
|
|
972
972
|
/* @__PURE__ */ n(
|
|
973
973
|
"button",
|
|
974
974
|
{
|
|
975
975
|
type: "button",
|
|
976
976
|
className: "ll-minimized__btn",
|
|
977
|
-
onClick:
|
|
977
|
+
onClick: s,
|
|
978
978
|
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
979
|
-
children: /* @__PURE__ */ n(
|
|
979
|
+
children: /* @__PURE__ */ n(Zt, { muted: l, className: "ll-minimized__icon" })
|
|
980
980
|
}
|
|
981
981
|
),
|
|
982
982
|
/* @__PURE__ */ n(
|
|
@@ -986,7 +986,7 @@ const vr = ({
|
|
|
986
986
|
className: "ll-minimized__btn",
|
|
987
987
|
onClick: a,
|
|
988
988
|
"aria-label": `Expand ${r} widget`,
|
|
989
|
-
children: /* @__PURE__ */ n(
|
|
989
|
+
children: /* @__PURE__ */ n(en, { className: "ll-minimized__icon" })
|
|
990
990
|
}
|
|
991
991
|
),
|
|
992
992
|
/* @__PURE__ */ n(
|
|
@@ -996,24 +996,24 @@ const vr = ({
|
|
|
996
996
|
className: "ll-minimized__btn ll-minimized__btn--close",
|
|
997
997
|
onClick: f,
|
|
998
998
|
"aria-label": "Close widget",
|
|
999
|
-
children: /* @__PURE__ */ n(
|
|
999
|
+
children: /* @__PURE__ */ n(yr, { className: "ll-minimized__icon" })
|
|
1000
1000
|
}
|
|
1001
1001
|
)
|
|
1002
1002
|
] })
|
|
1003
1003
|
] })
|
|
1004
1004
|
}
|
|
1005
|
-
),
|
|
1005
|
+
), Er = ({
|
|
1006
1006
|
src: e,
|
|
1007
1007
|
alt: t,
|
|
1008
1008
|
preCannedPlaying: r = !1,
|
|
1009
|
-
className:
|
|
1010
|
-
style:
|
|
1009
|
+
className: o,
|
|
1010
|
+
style: i
|
|
1011
1011
|
}) => {
|
|
1012
|
-
const [l,
|
|
1013
|
-
if (
|
|
1014
|
-
a.current !== e && (a.current = e,
|
|
1012
|
+
const [l, d] = C(!1), a = S(e);
|
|
1013
|
+
if (M(() => {
|
|
1014
|
+
a.current !== e && (a.current = e, d(!1));
|
|
1015
1015
|
}, [e]), !e) return null;
|
|
1016
|
-
const
|
|
1016
|
+
const s = {
|
|
1017
1017
|
position: "absolute",
|
|
1018
1018
|
inset: 0,
|
|
1019
1019
|
width: "100%",
|
|
@@ -1023,7 +1023,7 @@ const vr = ({
|
|
|
1023
1023
|
transition: "opacity 500ms ease, transform 500ms ease",
|
|
1024
1024
|
transform: r ? "scale(1.02)" : "scale(1)",
|
|
1025
1025
|
opacity: l ? 1 : 0,
|
|
1026
|
-
...
|
|
1026
|
+
...i
|
|
1027
1027
|
};
|
|
1028
1028
|
return (
|
|
1029
1029
|
// eslint-disable-next-line @next/next/no-img-element
|
|
@@ -1032,54 +1032,54 @@ const vr = ({
|
|
|
1032
1032
|
{
|
|
1033
1033
|
src: e,
|
|
1034
1034
|
alt: t,
|
|
1035
|
-
className:
|
|
1036
|
-
style:
|
|
1035
|
+
className: o,
|
|
1036
|
+
style: s,
|
|
1037
1037
|
loading: "eager",
|
|
1038
1038
|
fetchPriority: "high",
|
|
1039
|
-
onLoad: () =>
|
|
1039
|
+
onLoad: () => d(!0)
|
|
1040
1040
|
}
|
|
1041
1041
|
)
|
|
1042
1042
|
);
|
|
1043
|
-
},
|
|
1043
|
+
}, Cr = 8, on = 8, Sr = ({
|
|
1044
1044
|
open: e,
|
|
1045
1045
|
onClose: t,
|
|
1046
1046
|
anchorRef: r,
|
|
1047
|
-
children:
|
|
1047
|
+
children: o
|
|
1048
1048
|
}) => {
|
|
1049
|
-
const
|
|
1050
|
-
return
|
|
1049
|
+
const i = S(null), [l, d] = C(null);
|
|
1050
|
+
return hn(() => {
|
|
1051
1051
|
if (!e) {
|
|
1052
|
-
|
|
1052
|
+
d(null);
|
|
1053
1053
|
return;
|
|
1054
1054
|
}
|
|
1055
1055
|
const a = r.current;
|
|
1056
1056
|
if (!a) return;
|
|
1057
|
-
const
|
|
1058
|
-
const f = a.getBoundingClientRect(),
|
|
1059
|
-
top: f.top -
|
|
1057
|
+
const s = () => {
|
|
1058
|
+
const f = a.getBoundingClientRect(), b = {
|
|
1059
|
+
top: f.top - Cr,
|
|
1060
1060
|
left: f.left + f.width / 2
|
|
1061
|
-
}, u =
|
|
1062
|
-
|
|
1061
|
+
}, u = on + 90, c = window.innerWidth - on - 90;
|
|
1062
|
+
b.left < u && (b.left = u), b.left > c && (b.left = c), d(b);
|
|
1063
1063
|
};
|
|
1064
|
-
return
|
|
1065
|
-
window.removeEventListener("scroll",
|
|
1064
|
+
return s(), window.addEventListener("scroll", s, !0), window.addEventListener("resize", s), () => {
|
|
1065
|
+
window.removeEventListener("scroll", s, !0), window.removeEventListener("resize", s);
|
|
1066
1066
|
};
|
|
1067
|
-
}, [e, r]),
|
|
1067
|
+
}, [e, r]), M(() => {
|
|
1068
1068
|
if (!e) return;
|
|
1069
1069
|
const a = (f) => {
|
|
1070
|
-
const
|
|
1071
|
-
u && u.contains(
|
|
1072
|
-
},
|
|
1070
|
+
const b = f.target, u = i.current, c = r.current;
|
|
1071
|
+
u && u.contains(b) || c && c.contains(b) || t();
|
|
1072
|
+
}, s = (f) => {
|
|
1073
1073
|
f.key === "Escape" && (f.stopPropagation(), t());
|
|
1074
1074
|
};
|
|
1075
|
-
return document.addEventListener("mousedown", a), document.addEventListener("keydown",
|
|
1076
|
-
document.removeEventListener("mousedown", a), document.removeEventListener("keydown",
|
|
1075
|
+
return document.addEventListener("mousedown", a), document.addEventListener("keydown", s), () => {
|
|
1076
|
+
document.removeEventListener("mousedown", a), document.removeEventListener("keydown", s);
|
|
1077
1077
|
};
|
|
1078
|
-
}, [e, t, r]), !e || l === null || typeof document > "u" ? null :
|
|
1078
|
+
}, [e, t, r]), !e || l === null || typeof document > "u" ? null : Rt(
|
|
1079
1079
|
/* @__PURE__ */ n(
|
|
1080
1080
|
"div",
|
|
1081
1081
|
{
|
|
1082
|
-
ref:
|
|
1082
|
+
ref: i,
|
|
1083
1083
|
className: "ll-overflow-popover",
|
|
1084
1084
|
role: "menu",
|
|
1085
1085
|
style: {
|
|
@@ -1090,30 +1090,30 @@ const vr = ({
|
|
|
1090
1090
|
left: l.left,
|
|
1091
1091
|
transform: "translate(-50%, -100%)"
|
|
1092
1092
|
},
|
|
1093
|
-
children:
|
|
1093
|
+
children: o
|
|
1094
1094
|
}
|
|
1095
1095
|
),
|
|
1096
1096
|
document.body
|
|
1097
1097
|
);
|
|
1098
|
-
},
|
|
1098
|
+
}, Nr = ({
|
|
1099
1099
|
isMuted: e,
|
|
1100
1100
|
onToggleMute: t,
|
|
1101
1101
|
isCameraEnabled: r,
|
|
1102
|
-
onToggleCamera:
|
|
1103
|
-
allowCamera:
|
|
1102
|
+
onToggleCamera: o,
|
|
1103
|
+
allowCamera: i,
|
|
1104
1104
|
isScreenShareEnabled: l,
|
|
1105
|
-
onToggleScreenShare:
|
|
1105
|
+
onToggleScreenShare: d,
|
|
1106
1106
|
allowScreenShare: a,
|
|
1107
|
-
isSpeakerMuted:
|
|
1107
|
+
isSpeakerMuted: s,
|
|
1108
1108
|
onToggleSpeaker: f,
|
|
1109
|
-
allowTyping:
|
|
1109
|
+
allowTyping: b,
|
|
1110
1110
|
isTypingOpen: u,
|
|
1111
1111
|
onToggleTyping: c,
|
|
1112
1112
|
onDisconnect: I
|
|
1113
1113
|
}) => {
|
|
1114
|
-
const [
|
|
1115
|
-
return /* @__PURE__ */
|
|
1116
|
-
/* @__PURE__ */
|
|
1114
|
+
const [k, w] = C(!1), v = S(null);
|
|
1115
|
+
return /* @__PURE__ */ y(Ve, { children: [
|
|
1116
|
+
/* @__PURE__ */ y(
|
|
1117
1117
|
"div",
|
|
1118
1118
|
{
|
|
1119
1119
|
className: "ll-toolbar ll-toolbar--compact",
|
|
@@ -1127,20 +1127,20 @@ const vr = ({
|
|
|
1127
1127
|
className: `ll-tool ${e ? "is-muted" : ""}`,
|
|
1128
1128
|
onClick: t,
|
|
1129
1129
|
"aria-label": e ? "Unmute microphone" : "Mute microphone",
|
|
1130
|
-
children: /* @__PURE__ */ n(
|
|
1130
|
+
children: /* @__PURE__ */ n(bn, { muted: e })
|
|
1131
1131
|
}
|
|
1132
1132
|
),
|
|
1133
1133
|
/* @__PURE__ */ n(
|
|
1134
1134
|
"button",
|
|
1135
1135
|
{
|
|
1136
|
-
ref:
|
|
1136
|
+
ref: v,
|
|
1137
1137
|
type: "button",
|
|
1138
|
-
className: `ll-tool ${
|
|
1139
|
-
onClick: () =>
|
|
1138
|
+
className: `ll-tool ${k ? "is-on" : ""}`,
|
|
1139
|
+
onClick: () => w((m) => !m),
|
|
1140
1140
|
"aria-label": "More controls",
|
|
1141
1141
|
"aria-haspopup": "menu",
|
|
1142
|
-
"aria-expanded":
|
|
1143
|
-
children: /* @__PURE__ */ n(
|
|
1142
|
+
"aria-expanded": k,
|
|
1143
|
+
children: /* @__PURE__ */ n(Ar, {})
|
|
1144
1144
|
}
|
|
1145
1145
|
),
|
|
1146
1146
|
/* @__PURE__ */ n(
|
|
@@ -1150,76 +1150,76 @@ const vr = ({
|
|
|
1150
1150
|
className: "ll-tool ll-tool--danger",
|
|
1151
1151
|
onClick: I,
|
|
1152
1152
|
"aria-label": "End conversation",
|
|
1153
|
-
children: /* @__PURE__ */ n(
|
|
1153
|
+
children: /* @__PURE__ */ n(_n, {})
|
|
1154
1154
|
}
|
|
1155
1155
|
)
|
|
1156
1156
|
]
|
|
1157
1157
|
}
|
|
1158
1158
|
),
|
|
1159
|
-
/* @__PURE__ */
|
|
1160
|
-
|
|
1159
|
+
/* @__PURE__ */ y(
|
|
1160
|
+
Sr,
|
|
1161
1161
|
{
|
|
1162
|
-
open:
|
|
1163
|
-
onClose: () =>
|
|
1164
|
-
anchorRef:
|
|
1162
|
+
open: k,
|
|
1163
|
+
onClose: () => w(!1),
|
|
1164
|
+
anchorRef: v,
|
|
1165
1165
|
children: [
|
|
1166
|
-
|
|
1166
|
+
i && /* @__PURE__ */ y(
|
|
1167
1167
|
"button",
|
|
1168
1168
|
{
|
|
1169
1169
|
type: "button",
|
|
1170
1170
|
className: `ll-overflow-popover__item ${r ? "is-on" : ""}`,
|
|
1171
1171
|
onClick: () => {
|
|
1172
|
-
|
|
1172
|
+
o(), w(!1);
|
|
1173
1173
|
},
|
|
1174
1174
|
children: [
|
|
1175
|
-
/* @__PURE__ */ n(
|
|
1175
|
+
/* @__PURE__ */ n(vn, {}),
|
|
1176
1176
|
/* @__PURE__ */ n("span", { children: r ? "Stop camera" : "Start camera" })
|
|
1177
1177
|
]
|
|
1178
1178
|
}
|
|
1179
1179
|
),
|
|
1180
|
-
a && /* @__PURE__ */
|
|
1180
|
+
a && /* @__PURE__ */ y(
|
|
1181
1181
|
"button",
|
|
1182
1182
|
{
|
|
1183
1183
|
type: "button",
|
|
1184
1184
|
className: `ll-overflow-popover__item ${l ? "is-on" : ""}`,
|
|
1185
1185
|
onClick: () => {
|
|
1186
|
-
|
|
1186
|
+
d(), w(!1);
|
|
1187
1187
|
},
|
|
1188
1188
|
children: [
|
|
1189
|
-
/* @__PURE__ */ n(
|
|
1189
|
+
/* @__PURE__ */ n(yn, {}),
|
|
1190
1190
|
/* @__PURE__ */ n("span", { children: l ? "Stop sharing" : "Share screen" })
|
|
1191
1191
|
]
|
|
1192
1192
|
}
|
|
1193
1193
|
),
|
|
1194
|
-
/* @__PURE__ */
|
|
1194
|
+
/* @__PURE__ */ y(
|
|
1195
1195
|
"button",
|
|
1196
1196
|
{
|
|
1197
1197
|
type: "button",
|
|
1198
|
-
className: `ll-overflow-popover__item ${
|
|
1198
|
+
className: `ll-overflow-popover__item ${s ? "is-on" : ""}`,
|
|
1199
1199
|
onClick: () => {
|
|
1200
|
-
f(),
|
|
1200
|
+
f(), w(!1);
|
|
1201
1201
|
},
|
|
1202
1202
|
children: [
|
|
1203
|
-
/* @__PURE__ */ n(
|
|
1204
|
-
/* @__PURE__ */ n("span", { children:
|
|
1203
|
+
/* @__PURE__ */ n(wn, { muted: s }),
|
|
1204
|
+
/* @__PURE__ */ n("span", { children: s ? "Unmute speaker" : "Mute speaker" })
|
|
1205
1205
|
]
|
|
1206
1206
|
}
|
|
1207
1207
|
),
|
|
1208
|
-
|
|
1208
|
+
b && /* @__PURE__ */ y(
|
|
1209
1209
|
"button",
|
|
1210
1210
|
{
|
|
1211
1211
|
type: "button",
|
|
1212
1212
|
className: `ll-overflow-popover__item ${u ? "is-on" : ""}`,
|
|
1213
1213
|
onClick: () => {
|
|
1214
|
-
c(),
|
|
1214
|
+
c(), w(!1);
|
|
1215
1215
|
},
|
|
1216
1216
|
children: [
|
|
1217
|
-
/* @__PURE__ */ n(
|
|
1217
|
+
/* @__PURE__ */ n(Rr, {}),
|
|
1218
1218
|
/* @__PURE__ */ n("span", { children: u ? "Hide typing" : "Type a message" })
|
|
1219
1219
|
]
|
|
1220
1220
|
}
|
|
1221
1221
|
),
|
|
1222
|
-
/* @__PURE__ */
|
|
1222
|
+
/* @__PURE__ */ y(
|
|
1223
1223
|
"button",
|
|
1224
1224
|
{
|
|
1225
1225
|
type: "button",
|
|
@@ -1237,8 +1237,8 @@ const vr = ({
|
|
|
1237
1237
|
)
|
|
1238
1238
|
] });
|
|
1239
1239
|
};
|
|
1240
|
-
function
|
|
1241
|
-
return /* @__PURE__ */
|
|
1240
|
+
function Ar() {
|
|
1241
|
+
return /* @__PURE__ */ y(
|
|
1242
1242
|
"svg",
|
|
1243
1243
|
{
|
|
1244
1244
|
width: "16",
|
|
@@ -1254,7 +1254,7 @@ function Er() {
|
|
|
1254
1254
|
}
|
|
1255
1255
|
);
|
|
1256
1256
|
}
|
|
1257
|
-
function
|
|
1257
|
+
function Rr() {
|
|
1258
1258
|
return /* @__PURE__ */ n(
|
|
1259
1259
|
"svg",
|
|
1260
1260
|
{
|
|
@@ -1271,154 +1271,154 @@ function Cr() {
|
|
|
1271
1271
|
}
|
|
1272
1272
|
);
|
|
1273
1273
|
}
|
|
1274
|
-
const
|
|
1274
|
+
const Ir = ({
|
|
1275
1275
|
position: e,
|
|
1276
1276
|
isMobile: t,
|
|
1277
1277
|
agentName: r,
|
|
1278
|
-
avatarImageUrl:
|
|
1279
|
-
idleLoopUrl:
|
|
1278
|
+
avatarImageUrl: o,
|
|
1279
|
+
idleLoopUrl: i,
|
|
1280
1280
|
greeting: l,
|
|
1281
|
-
branding:
|
|
1281
|
+
branding: d,
|
|
1282
1282
|
teamMembers: a,
|
|
1283
|
-
currentTeamMemberId:
|
|
1283
|
+
currentTeamMemberId: s,
|
|
1284
1284
|
isSwitchingTeamMember: f,
|
|
1285
|
-
teamSwitcherOpen:
|
|
1285
|
+
teamSwitcherOpen: b,
|
|
1286
1286
|
onToggleTeamSwitcher: u,
|
|
1287
1287
|
onSelectTeamMember: c,
|
|
1288
1288
|
languageMenuOpen: I,
|
|
1289
|
-
onToggleLanguageMenu:
|
|
1290
|
-
connectionState:
|
|
1291
|
-
agentState:
|
|
1289
|
+
onToggleLanguageMenu: k,
|
|
1290
|
+
connectionState: w,
|
|
1291
|
+
agentState: v,
|
|
1292
1292
|
transcript: m,
|
|
1293
|
-
canResume:
|
|
1293
|
+
canResume: N,
|
|
1294
1294
|
needsUserGesture: $,
|
|
1295
1295
|
error: D,
|
|
1296
1296
|
isMuted: x,
|
|
1297
1297
|
micError: R,
|
|
1298
1298
|
micDevices: B,
|
|
1299
1299
|
activeMicId: q,
|
|
1300
|
-
isCameraEnabled:
|
|
1301
|
-
cameraPreviewEl:
|
|
1300
|
+
isCameraEnabled: A,
|
|
1301
|
+
cameraPreviewEl: T,
|
|
1302
1302
|
cameraDevices: F,
|
|
1303
|
-
activeCameraId:
|
|
1303
|
+
activeCameraId: oe,
|
|
1304
1304
|
isScreenShareEnabled: ie,
|
|
1305
1305
|
screenPreviewEl: Z,
|
|
1306
|
-
isSpeakerMuted:
|
|
1306
|
+
isSpeakerMuted: ce,
|
|
1307
1307
|
allowCamera: fe,
|
|
1308
|
-
allowScreenShare:
|
|
1308
|
+
allowScreenShare: ye,
|
|
1309
1309
|
allowTyping: pe,
|
|
1310
|
-
showMinimize:
|
|
1310
|
+
showMinimize: ve = !0,
|
|
1311
1311
|
chromeless: he = !1,
|
|
1312
1312
|
compactControls: ee = !1,
|
|
1313
|
-
transforming:
|
|
1314
|
-
transformingLabel:
|
|
1315
|
-
avatarVideoContainerRef:
|
|
1316
|
-
agentVideoEl:
|
|
1317
|
-
onConnect:
|
|
1318
|
-
onDisconnect:
|
|
1319
|
-
onRetry:
|
|
1320
|
-
onResumeAudio:
|
|
1321
|
-
onToggleMute:
|
|
1313
|
+
transforming: ut,
|
|
1314
|
+
transformingLabel: Ge,
|
|
1315
|
+
avatarVideoContainerRef: ft,
|
|
1316
|
+
agentVideoEl: le,
|
|
1317
|
+
onConnect: Je,
|
|
1318
|
+
onDisconnect: Ke,
|
|
1319
|
+
onRetry: pt,
|
|
1320
|
+
onResumeAudio: Xe,
|
|
1321
|
+
onToggleMute: Ce,
|
|
1322
1322
|
onSwitchMicDevice: Pe,
|
|
1323
|
-
onToggleCamera:
|
|
1323
|
+
onToggleCamera: Se,
|
|
1324
1324
|
onSwitchCameraDevice: $e,
|
|
1325
|
-
onToggleScreenShare:
|
|
1326
|
-
onToggleSpeaker:
|
|
1327
|
-
onSendMessage:
|
|
1328
|
-
onMinimize:
|
|
1329
|
-
onClose:
|
|
1330
|
-
onClearMicError:
|
|
1325
|
+
onToggleScreenShare: Ne,
|
|
1326
|
+
onToggleSpeaker: Ae,
|
|
1327
|
+
onSendMessage: Re,
|
|
1328
|
+
onMinimize: z,
|
|
1329
|
+
onClose: ht,
|
|
1330
|
+
onClearMicError: xt
|
|
1331
1331
|
}) => {
|
|
1332
|
-
var
|
|
1333
|
-
const
|
|
1334
|
-
|
|
1335
|
-
if (!
|
|
1336
|
-
|
|
1332
|
+
var De;
|
|
1333
|
+
const Ie = ((a == null ? void 0 : a.length) ?? 0) > 1, Me = w === "connecting" || w === "connected", te = w === "connected", Qe = w === "idle" || w === "disconnected" || w === "error", [Ze, ze] = C(!1);
|
|
1334
|
+
M(() => {
|
|
1335
|
+
if (!le) {
|
|
1336
|
+
ze(!1);
|
|
1337
1337
|
return;
|
|
1338
1338
|
}
|
|
1339
|
-
if (!
|
|
1340
|
-
|
|
1339
|
+
if (!le.paused && le.readyState >= 2) {
|
|
1340
|
+
ze(!0);
|
|
1341
1341
|
return;
|
|
1342
1342
|
}
|
|
1343
|
-
|
|
1344
|
-
const h = () =>
|
|
1345
|
-
return
|
|
1346
|
-
|
|
1343
|
+
ze(!1);
|
|
1344
|
+
const h = () => ze(!0);
|
|
1345
|
+
return le.addEventListener("playing", h), le.addEventListener("loadeddata", h), () => {
|
|
1346
|
+
le.removeEventListener("playing", h), le.removeEventListener("loadeddata", h);
|
|
1347
1347
|
};
|
|
1348
|
-
}, [
|
|
1349
|
-
const [
|
|
1350
|
-
|
|
1348
|
+
}, [le]);
|
|
1349
|
+
const [Te, X] = C(!1);
|
|
1350
|
+
M(() => {
|
|
1351
1351
|
if (!te) {
|
|
1352
|
-
|
|
1352
|
+
X(!1);
|
|
1353
1353
|
return;
|
|
1354
1354
|
}
|
|
1355
|
-
if (
|
|
1356
|
-
const h = setTimeout(() =>
|
|
1355
|
+
if (Ze) return;
|
|
1356
|
+
const h = setTimeout(() => X(!0), 8e3);
|
|
1357
1357
|
return () => clearTimeout(h);
|
|
1358
|
-
}, [te,
|
|
1359
|
-
const
|
|
1360
|
-
|
|
1361
|
-
const h =
|
|
1362
|
-
h && (h.innerHTML = "",
|
|
1363
|
-
}, [
|
|
1364
|
-
const h =
|
|
1358
|
+
}, [te, Ze]);
|
|
1359
|
+
const mt = w === "connecting" || te && !!o && !Ze && !Te, et = S(null), ne = S(null);
|
|
1360
|
+
M(() => {
|
|
1361
|
+
const h = et.current;
|
|
1362
|
+
h && (h.innerHTML = "", T && (T.style.width = "100%", T.style.height = "100%", T.style.objectFit = "cover", T.style.transform = "scaleX(-1)", h.appendChild(T)));
|
|
1363
|
+
}, [T]), M(() => {
|
|
1364
|
+
const h = ne.current;
|
|
1365
1365
|
h && (h.innerHTML = "", Z && (Z.style.width = "100%", Z.style.height = "100%", Z.style.objectFit = "contain", h.appendChild(Z)));
|
|
1366
1366
|
}, [Z]);
|
|
1367
|
-
const [
|
|
1368
|
-
|
|
1369
|
-
if (!
|
|
1367
|
+
const [re, se] = C(!1), [be, G] = C(!1), de = S(null), we = S(null);
|
|
1368
|
+
M(() => {
|
|
1369
|
+
if (!re && !be && !I && !b) return;
|
|
1370
1370
|
const h = () => {
|
|
1371
|
-
|
|
1371
|
+
se(!1), G(!1), I && k(), b && u();
|
|
1372
1372
|
};
|
|
1373
1373
|
return document.addEventListener("click", h), () => document.removeEventListener("click", h);
|
|
1374
1374
|
}, [
|
|
1375
|
-
|
|
1376
|
-
|
|
1375
|
+
re,
|
|
1376
|
+
be,
|
|
1377
1377
|
I,
|
|
1378
|
-
|
|
1379
|
-
|
|
1378
|
+
b,
|
|
1379
|
+
k,
|
|
1380
1380
|
u
|
|
1381
1381
|
]);
|
|
1382
|
-
const [
|
|
1382
|
+
const [Oe, kt] = C(!1), tt = E(() => kt((h) => !h), []), [_e, nt] = C(""), rt = E(
|
|
1383
1383
|
(h) => {
|
|
1384
1384
|
h.preventDefault();
|
|
1385
|
-
const V =
|
|
1386
|
-
V && (
|
|
1385
|
+
const V = _e.trim();
|
|
1386
|
+
V && (Re(V), nt(""));
|
|
1387
1387
|
},
|
|
1388
|
-
[
|
|
1389
|
-
),
|
|
1390
|
-
let
|
|
1388
|
+
[_e, Re]
|
|
1389
|
+
), ot = d.productName || "Live Layer";
|
|
1390
|
+
let xe = null, ke = null;
|
|
1391
1391
|
for (let h = m.length - 1; h >= 0; h--) {
|
|
1392
1392
|
const V = m[h];
|
|
1393
|
-
if (!
|
|
1393
|
+
if (!xe && V.role === "agent" ? xe = V : !ke && V.role === "user" && (ke = V), xe && ke) break;
|
|
1394
1394
|
}
|
|
1395
|
-
const
|
|
1395
|
+
const He = te ? (xe == null ? void 0 : xe.text) || null : l || null, gt = te && (ke == null ? void 0 : ke.text) || null, We = [
|
|
1396
1396
|
"ll-expanded",
|
|
1397
1397
|
t ? "ll-expanded--mobile" : "ll-expanded--desktop"
|
|
1398
1398
|
].join(" ");
|
|
1399
|
-
return /* @__PURE__ */
|
|
1399
|
+
return /* @__PURE__ */ y(
|
|
1400
1400
|
"div",
|
|
1401
1401
|
{
|
|
1402
|
-
className:
|
|
1402
|
+
className: We,
|
|
1403
1403
|
"data-position": e,
|
|
1404
|
-
"data-state": te ? "connected" :
|
|
1404
|
+
"data-state": te ? "connected" : Me ? "connecting" : "idle",
|
|
1405
1405
|
role: "dialog",
|
|
1406
1406
|
"aria-label": `${r} widget`,
|
|
1407
1407
|
children: [
|
|
1408
|
-
/* @__PURE__ */
|
|
1409
|
-
|
|
1410
|
-
|
|
1408
|
+
/* @__PURE__ */ y("div", { className: "ll-expanded__bg", children: [
|
|
1409
|
+
o ? /* @__PURE__ */ n(
|
|
1410
|
+
Er,
|
|
1411
1411
|
{
|
|
1412
|
-
src:
|
|
1412
|
+
src: o,
|
|
1413
1413
|
alt: r,
|
|
1414
1414
|
className: "ll-expanded__bg-img"
|
|
1415
1415
|
}
|
|
1416
|
-
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((
|
|
1417
|
-
|
|
1416
|
+
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((De = r == null ? void 0 : r.charAt(0)) == null ? void 0 : De.toUpperCase()) || "A" }) }),
|
|
1417
|
+
i && !te && /* @__PURE__ */ n(
|
|
1418
1418
|
"video",
|
|
1419
1419
|
{
|
|
1420
1420
|
className: "ll-expanded__bg-idle",
|
|
1421
|
-
src:
|
|
1421
|
+
src: i,
|
|
1422
1422
|
autoPlay: !0,
|
|
1423
1423
|
loop: !0,
|
|
1424
1424
|
muted: !0,
|
|
@@ -1426,70 +1426,70 @@ const Sr = ({
|
|
|
1426
1426
|
}
|
|
1427
1427
|
)
|
|
1428
1428
|
] }),
|
|
1429
|
-
/* @__PURE__ */ n("div", { ref:
|
|
1430
|
-
|
|
1429
|
+
/* @__PURE__ */ n("div", { ref: ft, className: "ll-expanded__video" }),
|
|
1430
|
+
mt && /* @__PURE__ */ y("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
|
|
1431
1431
|
/* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
|
|
1432
1432
|
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: f ? "Switching..." : "Connecting..." })
|
|
1433
1433
|
] }),
|
|
1434
|
-
$ && te && /* @__PURE__ */
|
|
1434
|
+
$ && te && /* @__PURE__ */ y(
|
|
1435
1435
|
"button",
|
|
1436
1436
|
{
|
|
1437
1437
|
type: "button",
|
|
1438
1438
|
className: "ll-expanded__overlay ll-expanded__overlay--gesture",
|
|
1439
|
-
onClick:
|
|
1439
|
+
onClick: Xe,
|
|
1440
1440
|
children: [
|
|
1441
1441
|
/* @__PURE__ */ n("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("path", { d: "M3 9v6h4l5 5V4L7 9H3zm13.54.12a5 5 0 0 1 0 5.76l-1.41-1.41a3 3 0 0 0 0-2.94L16.54 9.12z" }) }),
|
|
1442
1442
|
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
|
|
1443
1443
|
]
|
|
1444
1444
|
}
|
|
1445
1445
|
),
|
|
1446
|
-
|
|
1446
|
+
ut && /* @__PURE__ */ y(
|
|
1447
1447
|
"div",
|
|
1448
1448
|
{
|
|
1449
1449
|
className: "ll-expanded__overlay ll-expanded__overlay--transforming",
|
|
1450
1450
|
role: "status",
|
|
1451
1451
|
"aria-live": "polite",
|
|
1452
|
-
"aria-label":
|
|
1452
|
+
"aria-label": Ge,
|
|
1453
1453
|
children: [
|
|
1454
1454
|
/* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
|
|
1455
|
-
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children:
|
|
1455
|
+
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: Ge })
|
|
1456
1456
|
]
|
|
1457
1457
|
}
|
|
1458
1458
|
),
|
|
1459
|
-
|
|
1460
|
-
!ee && /* @__PURE__ */
|
|
1461
|
-
!he && /* @__PURE__ */
|
|
1462
|
-
/* @__PURE__ */
|
|
1463
|
-
/* @__PURE__ */
|
|
1459
|
+
Me ? /* @__PURE__ */ y(Ve, { children: [
|
|
1460
|
+
!ee && /* @__PURE__ */ y("div", { className: "ll-expanded__topbar", children: [
|
|
1461
|
+
!he && /* @__PURE__ */ y("div", { className: "ll-expanded__topbar-left", children: [
|
|
1462
|
+
/* @__PURE__ */ y("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1463
|
+
/* @__PURE__ */ y(
|
|
1464
1464
|
"button",
|
|
1465
1465
|
{
|
|
1466
1466
|
type: "button",
|
|
1467
1467
|
className: "ll-hpill",
|
|
1468
1468
|
onClick: (h) => {
|
|
1469
|
-
|
|
1469
|
+
Ie && (h.stopPropagation(), u());
|
|
1470
1470
|
},
|
|
1471
|
-
"aria-haspopup":
|
|
1472
|
-
"aria-expanded":
|
|
1471
|
+
"aria-haspopup": Ie ? "listbox" : void 0,
|
|
1472
|
+
"aria-expanded": Ie ? b : void 0,
|
|
1473
1473
|
children: [
|
|
1474
1474
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
|
|
1475
|
-
|
|
1475
|
+
Ie && /* @__PURE__ */ n(vt, {})
|
|
1476
1476
|
]
|
|
1477
1477
|
}
|
|
1478
1478
|
),
|
|
1479
|
-
|
|
1479
|
+
Ie && b && /* @__PURE__ */ n(
|
|
1480
1480
|
"div",
|
|
1481
1481
|
{
|
|
1482
1482
|
className: "ll-hmenu",
|
|
1483
1483
|
onClick: (h) => h.stopPropagation(),
|
|
1484
1484
|
role: "listbox",
|
|
1485
|
-
children: a == null ? void 0 : a.map((h) => /* @__PURE__ */
|
|
1485
|
+
children: a == null ? void 0 : a.map((h) => /* @__PURE__ */ y(
|
|
1486
1486
|
"button",
|
|
1487
1487
|
{
|
|
1488
1488
|
type: "button",
|
|
1489
|
-
className: `ll-hmenu__item ${h.id ===
|
|
1489
|
+
className: `ll-hmenu__item ${h.id === s ? "is-active" : ""}`,
|
|
1490
1490
|
onClick: () => c(h.id),
|
|
1491
1491
|
role: "option",
|
|
1492
|
-
"aria-selected": h.id ===
|
|
1492
|
+
"aria-selected": h.id === s,
|
|
1493
1493
|
children: [
|
|
1494
1494
|
h.avatarImageUrl && /* @__PURE__ */ n(
|
|
1495
1495
|
"img",
|
|
@@ -1508,14 +1508,14 @@ const Sr = ({
|
|
|
1508
1508
|
}
|
|
1509
1509
|
)
|
|
1510
1510
|
] }),
|
|
1511
|
-
/* @__PURE__ */
|
|
1512
|
-
/* @__PURE__ */
|
|
1511
|
+
/* @__PURE__ */ y("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1512
|
+
/* @__PURE__ */ y(
|
|
1513
1513
|
"button",
|
|
1514
1514
|
{
|
|
1515
1515
|
type: "button",
|
|
1516
1516
|
className: "ll-hpill ll-hpill--compact",
|
|
1517
1517
|
onClick: (h) => {
|
|
1518
|
-
h.stopPropagation(),
|
|
1518
|
+
h.stopPropagation(), k();
|
|
1519
1519
|
},
|
|
1520
1520
|
"aria-haspopup": "listbox",
|
|
1521
1521
|
"aria-expanded": I,
|
|
@@ -1523,7 +1523,7 @@ const Sr = ({
|
|
|
1523
1523
|
title: "Language: English",
|
|
1524
1524
|
children: [
|
|
1525
1525
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: "EN" }),
|
|
1526
|
-
/* @__PURE__ */ n(
|
|
1526
|
+
/* @__PURE__ */ n(vt, {})
|
|
1527
1527
|
]
|
|
1528
1528
|
}
|
|
1529
1529
|
),
|
|
@@ -1549,21 +1549,21 @@ const Sr = ({
|
|
|
1549
1549
|
/* @__PURE__ */ n(
|
|
1550
1550
|
"span",
|
|
1551
1551
|
{
|
|
1552
|
-
className: `ll-expanded__state ll-expanded__state--${
|
|
1553
|
-
children:
|
|
1552
|
+
className: `ll-expanded__state ll-expanded__state--${v}`,
|
|
1553
|
+
children: v
|
|
1554
1554
|
}
|
|
1555
1555
|
)
|
|
1556
1556
|
] }),
|
|
1557
|
-
/* @__PURE__ */
|
|
1558
|
-
|
|
1557
|
+
/* @__PURE__ */ y("div", { className: "ll-expanded__header-actions", children: [
|
|
1558
|
+
ve !== !1 && /* @__PURE__ */ n(
|
|
1559
1559
|
"button",
|
|
1560
1560
|
{
|
|
1561
1561
|
type: "button",
|
|
1562
1562
|
className: "ll-hbtn",
|
|
1563
|
-
onClick:
|
|
1563
|
+
onClick: z,
|
|
1564
1564
|
"aria-label": "Minimize widget",
|
|
1565
1565
|
title: "Minimize",
|
|
1566
|
-
children: /* @__PURE__ */ n(
|
|
1566
|
+
children: /* @__PURE__ */ n(an, {})
|
|
1567
1567
|
}
|
|
1568
1568
|
),
|
|
1569
1569
|
/* @__PURE__ */ n(
|
|
@@ -1571,34 +1571,34 @@ const Sr = ({
|
|
|
1571
1571
|
{
|
|
1572
1572
|
type: "button",
|
|
1573
1573
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1574
|
-
onClick:
|
|
1574
|
+
onClick: ht,
|
|
1575
1575
|
"aria-label": "End call",
|
|
1576
1576
|
title: "End call",
|
|
1577
|
-
children: /* @__PURE__ */ n(
|
|
1577
|
+
children: /* @__PURE__ */ n(ln, {})
|
|
1578
1578
|
}
|
|
1579
1579
|
)
|
|
1580
1580
|
] })
|
|
1581
1581
|
] }),
|
|
1582
|
-
ee && /* @__PURE__ */
|
|
1582
|
+
ee && /* @__PURE__ */ y("div", { className: "ll-compact-status", "data-state": v, children: [
|
|
1583
1583
|
/* @__PURE__ */ n("span", { className: "ll-compact-status__dot", "aria-hidden": !0 }),
|
|
1584
|
-
/* @__PURE__ */ n("span", { className: "ll-compact-status__label", children:
|
|
1584
|
+
/* @__PURE__ */ n("span", { className: "ll-compact-status__label", children: v })
|
|
1585
1585
|
] })
|
|
1586
1586
|
] }) : (
|
|
1587
1587
|
// Idle-state header with Live Layer product name + minimize/close.
|
|
1588
1588
|
// Hidden in compact mode — on a 140×210 docked slot the brand pill
|
|
1589
1589
|
// and 40px buttons crowded out the central "Start video call"
|
|
1590
1590
|
// affordance. The user can dismiss by scrolling past the slot.
|
|
1591
|
-
!ee && /* @__PURE__ */
|
|
1592
|
-
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children:
|
|
1593
|
-
/* @__PURE__ */
|
|
1594
|
-
|
|
1591
|
+
!ee && /* @__PURE__ */ y("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
|
|
1592
|
+
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: ot }),
|
|
1593
|
+
/* @__PURE__ */ y("div", { className: "ll-expanded__header-actions", children: [
|
|
1594
|
+
ve !== !1 && /* @__PURE__ */ n(
|
|
1595
1595
|
"button",
|
|
1596
1596
|
{
|
|
1597
1597
|
type: "button",
|
|
1598
1598
|
className: "ll-hbtn ll-hbtn--ghost",
|
|
1599
|
-
onClick:
|
|
1599
|
+
onClick: z,
|
|
1600
1600
|
"aria-label": "Minimize widget",
|
|
1601
|
-
children: /* @__PURE__ */ n(
|
|
1601
|
+
children: /* @__PURE__ */ n(an, {})
|
|
1602
1602
|
}
|
|
1603
1603
|
),
|
|
1604
1604
|
/* @__PURE__ */ n(
|
|
@@ -1606,23 +1606,23 @@ const Sr = ({
|
|
|
1606
1606
|
{
|
|
1607
1607
|
type: "button",
|
|
1608
1608
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1609
|
-
onClick:
|
|
1609
|
+
onClick: ht,
|
|
1610
1610
|
"aria-label": "Close widget",
|
|
1611
|
-
children: /* @__PURE__ */ n(
|
|
1611
|
+
children: /* @__PURE__ */ n(ln, {})
|
|
1612
1612
|
}
|
|
1613
1613
|
)
|
|
1614
1614
|
] })
|
|
1615
1615
|
] })
|
|
1616
1616
|
),
|
|
1617
|
-
|
|
1618
|
-
const h =
|
|
1619
|
-
return /* @__PURE__ */
|
|
1620
|
-
!D && /* @__PURE__ */
|
|
1617
|
+
Qe && /* @__PURE__ */ (() => {
|
|
1618
|
+
const h = N ? "Resume session" : w === "disconnected" ? "Reconnect to agent" : "Start video call";
|
|
1619
|
+
return /* @__PURE__ */ y(Ve, { children: [
|
|
1620
|
+
!D && /* @__PURE__ */ y(
|
|
1621
1621
|
"button",
|
|
1622
1622
|
{
|
|
1623
1623
|
type: "button",
|
|
1624
1624
|
className: "ll-expanded__play",
|
|
1625
|
-
onClick:
|
|
1625
|
+
onClick: Je,
|
|
1626
1626
|
"aria-label": h,
|
|
1627
1627
|
children: [
|
|
1628
1628
|
/* @__PURE__ */ n("div", { className: "ll-expanded__play-circle", children: /* @__PURE__ */ n("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("polygon", { points: "6 3 20 12 6 21 6 3" }) }) }),
|
|
@@ -1630,14 +1630,14 @@ const Sr = ({
|
|
|
1630
1630
|
]
|
|
1631
1631
|
}
|
|
1632
1632
|
),
|
|
1633
|
-
!ee && /* @__PURE__ */
|
|
1633
|
+
!ee && /* @__PURE__ */ y("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
|
|
1634
1634
|
l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
|
|
1635
1635
|
/* @__PURE__ */ n(
|
|
1636
1636
|
"button",
|
|
1637
1637
|
{
|
|
1638
1638
|
type: "button",
|
|
1639
1639
|
className: "ll-expanded__cta",
|
|
1640
|
-
onClick:
|
|
1640
|
+
onClick: Je,
|
|
1641
1641
|
"aria-label": h,
|
|
1642
1642
|
children: h
|
|
1643
1643
|
}
|
|
@@ -1645,129 +1645,133 @@ const Sr = ({
|
|
|
1645
1645
|
] })
|
|
1646
1646
|
] });
|
|
1647
1647
|
})(),
|
|
1648
|
-
/* @__PURE__ */
|
|
1648
|
+
/* @__PURE__ */ y(
|
|
1649
1649
|
"div",
|
|
1650
1650
|
{
|
|
1651
|
-
className: `ll-expanded__pip ${
|
|
1651
|
+
className: `ll-expanded__pip ${Me && (A || ie) ? "is-visible" : ""}`,
|
|
1652
1652
|
children: [
|
|
1653
1653
|
/* @__PURE__ */ n(
|
|
1654
1654
|
"div",
|
|
1655
1655
|
{
|
|
1656
|
-
ref:
|
|
1656
|
+
ref: ne,
|
|
1657
1657
|
className: ie ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1658
1658
|
}
|
|
1659
1659
|
),
|
|
1660
1660
|
/* @__PURE__ */ n(
|
|
1661
1661
|
"div",
|
|
1662
1662
|
{
|
|
1663
|
-
ref:
|
|
1664
|
-
className: !ie &&
|
|
1663
|
+
ref: et,
|
|
1664
|
+
className: !ie && A ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1665
1665
|
}
|
|
1666
1666
|
)
|
|
1667
1667
|
]
|
|
1668
1668
|
}
|
|
1669
1669
|
),
|
|
1670
|
-
|
|
1671
|
-
!ee &&
|
|
1670
|
+
Me ? /* @__PURE__ */ y("div", { className: "ll-expanded__bottom", children: [
|
|
1671
|
+
!ee && He && /* @__PURE__ */ n(
|
|
1672
1672
|
"div",
|
|
1673
1673
|
{
|
|
1674
1674
|
className: "ll-expanded__transcript ll-expanded__transcript--agent",
|
|
1675
1675
|
"data-role": "agent",
|
|
1676
|
-
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children:
|
|
1676
|
+
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: He })
|
|
1677
1677
|
}
|
|
1678
1678
|
),
|
|
1679
|
-
!ee &&
|
|
1679
|
+
!ee && gt && /* @__PURE__ */ n(
|
|
1680
1680
|
"div",
|
|
1681
1681
|
{
|
|
1682
1682
|
className: "ll-expanded__transcript ll-expanded__transcript--user",
|
|
1683
1683
|
"data-role": "user",
|
|
1684
|
-
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children:
|
|
1684
|
+
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: gt })
|
|
1685
1685
|
}
|
|
1686
1686
|
),
|
|
1687
|
-
!he && !ee && /* @__PURE__ */
|
|
1688
|
-
|
|
1687
|
+
!he && !ee && /* @__PURE__ */ y("div", { className: "ll-toolbar", onClick: (h) => h.stopPropagation(), children: [
|
|
1688
|
+
ye && /* @__PURE__ */ n(
|
|
1689
1689
|
"button",
|
|
1690
1690
|
{
|
|
1691
1691
|
type: "button",
|
|
1692
1692
|
className: `ll-tool ${ie ? "is-on" : ""}`,
|
|
1693
|
-
onClick:
|
|
1693
|
+
onClick: Ne,
|
|
1694
1694
|
"aria-label": ie ? "Stop sharing screen" : "Share screen",
|
|
1695
1695
|
title: ie ? "Stop sharing" : "Share screen",
|
|
1696
|
-
children: /* @__PURE__ */ n(
|
|
1696
|
+
children: /* @__PURE__ */ n(yn, {})
|
|
1697
1697
|
}
|
|
1698
1698
|
),
|
|
1699
|
-
fe && /* @__PURE__ */
|
|
1699
|
+
fe && /* @__PURE__ */ y("div", { className: "ll-tool-split", children: [
|
|
1700
1700
|
/* @__PURE__ */ n(
|
|
1701
1701
|
"button",
|
|
1702
1702
|
{
|
|
1703
1703
|
type: "button",
|
|
1704
|
-
className: `ll-tool ll-tool--left ${
|
|
1705
|
-
onClick:
|
|
1706
|
-
"aria-label":
|
|
1707
|
-
title:
|
|
1708
|
-
children: /* @__PURE__ */ n(
|
|
1704
|
+
className: `ll-tool ll-tool--left ${A ? "is-on" : ""}`,
|
|
1705
|
+
onClick: Se,
|
|
1706
|
+
"aria-label": A ? "Turn off camera" : "Turn on camera",
|
|
1707
|
+
title: A ? "Stop camera" : "Start camera",
|
|
1708
|
+
children: /* @__PURE__ */ n(vn, {})
|
|
1709
1709
|
}
|
|
1710
1710
|
),
|
|
1711
1711
|
/* @__PURE__ */ n(
|
|
1712
1712
|
"button",
|
|
1713
1713
|
{
|
|
1714
|
+
ref: we,
|
|
1714
1715
|
type: "button",
|
|
1715
|
-
className: `ll-tool ll-tool--right ${
|
|
1716
|
+
className: `ll-tool ll-tool--right ${A ? "is-on" : ""}`,
|
|
1716
1717
|
onClick: (h) => {
|
|
1717
|
-
h.stopPropagation(),
|
|
1718
|
+
h.stopPropagation(), G((V) => !V), se(!1);
|
|
1718
1719
|
},
|
|
1719
1720
|
"aria-label": "Camera devices",
|
|
1720
1721
|
"aria-haspopup": "listbox",
|
|
1721
|
-
"aria-expanded":
|
|
1722
|
-
children: /* @__PURE__ */ n(
|
|
1722
|
+
"aria-expanded": be,
|
|
1723
|
+
children: /* @__PURE__ */ n(vt, {})
|
|
1723
1724
|
}
|
|
1724
1725
|
),
|
|
1725
|
-
|
|
1726
|
-
|
|
1726
|
+
be && F.length > 0 && /* @__PURE__ */ n(
|
|
1727
|
+
cn,
|
|
1727
1728
|
{
|
|
1728
1729
|
label: "Camera",
|
|
1729
1730
|
devices: F,
|
|
1730
|
-
activeId:
|
|
1731
|
+
activeId: oe,
|
|
1732
|
+
anchorRef: we,
|
|
1731
1733
|
onPick: (h) => {
|
|
1732
|
-
|
|
1734
|
+
G(!1), $e(h);
|
|
1733
1735
|
}
|
|
1734
1736
|
}
|
|
1735
1737
|
)
|
|
1736
1738
|
] }),
|
|
1737
|
-
/* @__PURE__ */
|
|
1739
|
+
/* @__PURE__ */ y("div", { className: "ll-tool-split", children: [
|
|
1738
1740
|
/* @__PURE__ */ n(
|
|
1739
1741
|
"button",
|
|
1740
1742
|
{
|
|
1741
1743
|
type: "button",
|
|
1742
1744
|
className: `ll-tool ll-tool--left ${x ? "is-muted" : ""}`,
|
|
1743
|
-
onClick:
|
|
1745
|
+
onClick: Ce,
|
|
1744
1746
|
"aria-label": x ? "Unmute microphone" : "Mute microphone",
|
|
1745
1747
|
title: x ? "Unmute" : "Mute",
|
|
1746
|
-
children: /* @__PURE__ */ n(
|
|
1748
|
+
children: /* @__PURE__ */ n(bn, { muted: x })
|
|
1747
1749
|
}
|
|
1748
1750
|
),
|
|
1749
1751
|
/* @__PURE__ */ n(
|
|
1750
1752
|
"button",
|
|
1751
1753
|
{
|
|
1754
|
+
ref: de,
|
|
1752
1755
|
type: "button",
|
|
1753
1756
|
className: `ll-tool ll-tool--right ${x ? "is-muted" : ""}`,
|
|
1754
1757
|
onClick: (h) => {
|
|
1755
|
-
h.stopPropagation(),
|
|
1758
|
+
h.stopPropagation(), se((V) => !V), G(!1);
|
|
1756
1759
|
},
|
|
1757
1760
|
"aria-label": "Microphone devices",
|
|
1758
1761
|
"aria-haspopup": "listbox",
|
|
1759
|
-
"aria-expanded":
|
|
1760
|
-
children: /* @__PURE__ */ n(
|
|
1762
|
+
"aria-expanded": re,
|
|
1763
|
+
children: /* @__PURE__ */ n(vt, {})
|
|
1761
1764
|
}
|
|
1762
1765
|
),
|
|
1763
|
-
|
|
1764
|
-
|
|
1766
|
+
re && B.length > 0 && /* @__PURE__ */ n(
|
|
1767
|
+
cn,
|
|
1765
1768
|
{
|
|
1766
1769
|
label: "Microphone",
|
|
1767
1770
|
devices: B,
|
|
1768
1771
|
activeId: q,
|
|
1772
|
+
anchorRef: de,
|
|
1769
1773
|
onPick: (h) => {
|
|
1770
|
-
|
|
1774
|
+
se(!1), Pe(h);
|
|
1771
1775
|
}
|
|
1772
1776
|
}
|
|
1773
1777
|
)
|
|
@@ -1776,11 +1780,11 @@ const Sr = ({
|
|
|
1776
1780
|
"button",
|
|
1777
1781
|
{
|
|
1778
1782
|
type: "button",
|
|
1779
|
-
className: `ll-tool ${
|
|
1780
|
-
onClick:
|
|
1781
|
-
"aria-label":
|
|
1782
|
-
title:
|
|
1783
|
-
children: /* @__PURE__ */ n(
|
|
1783
|
+
className: `ll-tool ${ce ? "is-muted" : ""}`,
|
|
1784
|
+
onClick: Ae,
|
|
1785
|
+
"aria-label": ce ? "Unmute speaker" : "Mute speaker",
|
|
1786
|
+
title: ce ? "Unmute speaker" : "Mute speaker",
|
|
1787
|
+
children: /* @__PURE__ */ n(wn, { muted: ce })
|
|
1784
1788
|
}
|
|
1785
1789
|
),
|
|
1786
1790
|
/* @__PURE__ */ n(
|
|
@@ -1788,80 +1792,80 @@ const Sr = ({
|
|
|
1788
1792
|
{
|
|
1789
1793
|
type: "button",
|
|
1790
1794
|
className: "ll-tool ll-tool--danger",
|
|
1791
|
-
onClick:
|
|
1795
|
+
onClick: Ke,
|
|
1792
1796
|
"aria-label": "End conversation",
|
|
1793
1797
|
title: "End conversation",
|
|
1794
|
-
children: /* @__PURE__ */ n(
|
|
1798
|
+
children: /* @__PURE__ */ n(_n, {})
|
|
1795
1799
|
}
|
|
1796
1800
|
)
|
|
1797
1801
|
] }),
|
|
1798
1802
|
!he && ee && /* @__PURE__ */ n(
|
|
1799
|
-
|
|
1803
|
+
Nr,
|
|
1800
1804
|
{
|
|
1801
1805
|
isMuted: x,
|
|
1802
|
-
onToggleMute:
|
|
1803
|
-
isCameraEnabled:
|
|
1804
|
-
onToggleCamera:
|
|
1806
|
+
onToggleMute: Ce,
|
|
1807
|
+
isCameraEnabled: A,
|
|
1808
|
+
onToggleCamera: Se,
|
|
1805
1809
|
allowCamera: fe,
|
|
1806
1810
|
isScreenShareEnabled: ie,
|
|
1807
|
-
onToggleScreenShare:
|
|
1808
|
-
allowScreenShare:
|
|
1809
|
-
isSpeakerMuted:
|
|
1810
|
-
onToggleSpeaker:
|
|
1811
|
+
onToggleScreenShare: Ne,
|
|
1812
|
+
allowScreenShare: ye,
|
|
1813
|
+
isSpeakerMuted: ce,
|
|
1814
|
+
onToggleSpeaker: Ae,
|
|
1811
1815
|
allowTyping: pe,
|
|
1812
|
-
isTypingOpen:
|
|
1813
|
-
onToggleTyping:
|
|
1814
|
-
onDisconnect:
|
|
1816
|
+
isTypingOpen: Oe,
|
|
1817
|
+
onToggleTyping: tt,
|
|
1818
|
+
onDisconnect: Ke
|
|
1815
1819
|
}
|
|
1816
1820
|
),
|
|
1817
|
-
!he && pe && (ee ?
|
|
1821
|
+
!he && pe && (ee ? Oe : !0) && /* @__PURE__ */ y("form", { className: "ll-message-input", onSubmit: rt, children: [
|
|
1818
1822
|
/* @__PURE__ */ n(
|
|
1819
1823
|
"input",
|
|
1820
1824
|
{
|
|
1821
1825
|
type: "text",
|
|
1822
1826
|
className: "ll-message-input__field",
|
|
1823
1827
|
placeholder: "Message...",
|
|
1824
|
-
value:
|
|
1825
|
-
onChange: (h) =>
|
|
1828
|
+
value: _e,
|
|
1829
|
+
onChange: (h) => nt(h.target.value),
|
|
1826
1830
|
"aria-label": "Message the agent"
|
|
1827
1831
|
}
|
|
1828
1832
|
),
|
|
1829
|
-
|
|
1833
|
+
_e.trim() && /* @__PURE__ */ n(
|
|
1830
1834
|
"button",
|
|
1831
1835
|
{
|
|
1832
1836
|
type: "submit",
|
|
1833
1837
|
className: "ll-message-input__send",
|
|
1834
1838
|
"aria-label": "Send message",
|
|
1835
|
-
children: /* @__PURE__ */ n(
|
|
1839
|
+
children: /* @__PURE__ */ n(Mr, {})
|
|
1836
1840
|
}
|
|
1837
1841
|
)
|
|
1838
1842
|
] })
|
|
1839
1843
|
] }) : null,
|
|
1840
1844
|
(() => {
|
|
1841
|
-
if (R &&
|
|
1842
|
-
return /* @__PURE__ */
|
|
1845
|
+
if (R && w !== "error")
|
|
1846
|
+
return /* @__PURE__ */ y("div", { className: "ll-expanded__banner", role: "alert", children: [
|
|
1843
1847
|
/* @__PURE__ */ n("span", { children: R }),
|
|
1844
1848
|
/* @__PURE__ */ n(
|
|
1845
1849
|
"button",
|
|
1846
1850
|
{
|
|
1847
1851
|
type: "button",
|
|
1848
1852
|
className: "ll-expanded__banner-x",
|
|
1849
|
-
onClick:
|
|
1853
|
+
onClick: xt,
|
|
1850
1854
|
"aria-label": "Dismiss",
|
|
1851
1855
|
children: "×"
|
|
1852
1856
|
}
|
|
1853
1857
|
)
|
|
1854
1858
|
] });
|
|
1855
|
-
if (!D ||
|
|
1859
|
+
if (!D || w !== "error") return null;
|
|
1856
1860
|
let h = "Failed to connect", V = "Try again";
|
|
1857
|
-
return D === "MIC_PERMISSION_DENIED" ? h = "Microphone blocked. Allow access to talk." : D === "MIC_NOT_FOUND" ? h = "No microphone found. Plug one in + retry." : D === "MIC_UNAVAILABLE" ? h = "Mic unavailable. Check other apps using it." : D === "AGENT_TIMEOUT" ? h = "Agent didn't pick up. Try again." : D === "CONNECT_FAILED" ? h = "Connection failed. Check your network." : D.length < 80 && (h = D), /* @__PURE__ */
|
|
1861
|
+
return D === "MIC_PERMISSION_DENIED" ? h = "Microphone blocked. Allow access to talk." : D === "MIC_NOT_FOUND" ? h = "No microphone found. Plug one in + retry." : D === "MIC_UNAVAILABLE" ? h = "Mic unavailable. Check other apps using it." : D === "AGENT_TIMEOUT" ? h = "Agent didn't pick up. Try again." : D === "CONNECT_FAILED" ? h = "Connection failed. Check your network." : D.length < 80 && (h = D), /* @__PURE__ */ y("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
|
|
1858
1862
|
/* @__PURE__ */ n("span", { children: h }),
|
|
1859
1863
|
/* @__PURE__ */ n(
|
|
1860
1864
|
"button",
|
|
1861
1865
|
{
|
|
1862
1866
|
type: "button",
|
|
1863
1867
|
className: "ll-expanded__banner-retry",
|
|
1864
|
-
onClick:
|
|
1868
|
+
onClick: pt,
|
|
1865
1869
|
children: V
|
|
1866
1870
|
}
|
|
1867
1871
|
)
|
|
@@ -1871,55 +1875,55 @@ const Sr = ({
|
|
|
1871
1875
|
}
|
|
1872
1876
|
);
|
|
1873
1877
|
};
|
|
1874
|
-
function
|
|
1878
|
+
function vt() {
|
|
1875
1879
|
return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ n("polyline", { points: "6 9 12 15 18 9" }) });
|
|
1876
1880
|
}
|
|
1877
|
-
function
|
|
1878
|
-
return /* @__PURE__ */
|
|
1881
|
+
function ln() {
|
|
1882
|
+
return /* @__PURE__ */ y("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
|
|
1879
1883
|
/* @__PURE__ */ n("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1880
1884
|
/* @__PURE__ */ n("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1881
1885
|
] });
|
|
1882
1886
|
}
|
|
1883
|
-
function
|
|
1887
|
+
function an() {
|
|
1884
1888
|
return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
|
|
1885
1889
|
}
|
|
1886
|
-
function
|
|
1887
|
-
return /* @__PURE__ */
|
|
1890
|
+
function yn() {
|
|
1891
|
+
return /* @__PURE__ */ y("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1888
1892
|
/* @__PURE__ */ n("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
|
|
1889
1893
|
/* @__PURE__ */ n("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
|
|
1890
1894
|
/* @__PURE__ */ n("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
|
|
1891
1895
|
] });
|
|
1892
1896
|
}
|
|
1893
|
-
function
|
|
1894
|
-
return /* @__PURE__ */
|
|
1897
|
+
function vn() {
|
|
1898
|
+
return /* @__PURE__ */ y("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1895
1899
|
/* @__PURE__ */ n("path", { d: "M23 7l-7 5 7 5V7z" }),
|
|
1896
1900
|
/* @__PURE__ */ n("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
|
|
1897
1901
|
] });
|
|
1898
1902
|
}
|
|
1899
|
-
function
|
|
1900
|
-
return /* @__PURE__ */
|
|
1903
|
+
function bn({ muted: e }) {
|
|
1904
|
+
return /* @__PURE__ */ y("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1901
1905
|
/* @__PURE__ */ n("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
|
|
1902
1906
|
/* @__PURE__ */ n("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
|
|
1903
1907
|
/* @__PURE__ */ n("line", { x1: "12", y1: "19", x2: "12", y2: "23" }),
|
|
1904
1908
|
e && /* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
1905
1909
|
] });
|
|
1906
1910
|
}
|
|
1907
|
-
function
|
|
1908
|
-
return /* @__PURE__ */
|
|
1911
|
+
function wn({ muted: e }) {
|
|
1912
|
+
return /* @__PURE__ */ y("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1909
1913
|
/* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
1910
|
-
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */
|
|
1914
|
+
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ y(Ve, { children: [
|
|
1911
1915
|
/* @__PURE__ */ n("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
|
|
1912
1916
|
/* @__PURE__ */ n("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
|
|
1913
1917
|
] })
|
|
1914
1918
|
] });
|
|
1915
1919
|
}
|
|
1916
|
-
function
|
|
1917
|
-
return /* @__PURE__ */
|
|
1920
|
+
function Mr() {
|
|
1921
|
+
return /* @__PURE__ */ y("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1918
1922
|
/* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
|
|
1919
1923
|
/* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
|
|
1920
1924
|
] });
|
|
1921
1925
|
}
|
|
1922
|
-
function
|
|
1926
|
+
function _n() {
|
|
1923
1927
|
return /* @__PURE__ */ n("svg", { width: "16", height: "16", viewBox: "-4 -4 32 32", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: /* @__PURE__ */ n(
|
|
1924
1928
|
"path",
|
|
1925
1929
|
{
|
|
@@ -1928,49 +1932,81 @@ function gn() {
|
|
|
1928
1932
|
}
|
|
1929
1933
|
) });
|
|
1930
1934
|
}
|
|
1931
|
-
const
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1935
|
+
const cn = ({
|
|
1936
|
+
label: e,
|
|
1937
|
+
devices: t,
|
|
1938
|
+
activeId: r,
|
|
1939
|
+
onPick: o,
|
|
1940
|
+
anchorRef: i
|
|
1941
|
+
}) => {
|
|
1942
|
+
const [l, d] = C(null);
|
|
1943
|
+
return hn(() => {
|
|
1944
|
+
const a = () => {
|
|
1945
|
+
const s = i.current;
|
|
1946
|
+
if (!s) return;
|
|
1947
|
+
const f = s.getBoundingClientRect(), b = 126, u = window.innerWidth - 16 - 110, c = f.left + f.width / 2;
|
|
1948
|
+
d({
|
|
1949
|
+
top: f.top - 8,
|
|
1950
|
+
left: Math.max(b, Math.min(u, c))
|
|
1951
|
+
});
|
|
1952
|
+
};
|
|
1953
|
+
return a(), window.addEventListener("scroll", a, !0), window.addEventListener("resize", a), () => {
|
|
1954
|
+
window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", a);
|
|
1955
|
+
};
|
|
1956
|
+
}, [i]), l === null || typeof document > "u" ? null : Rt(
|
|
1957
|
+
/* @__PURE__ */ y(
|
|
1958
|
+
"div",
|
|
1959
|
+
{
|
|
1960
|
+
className: "ll-device-menu ll-device-menu--floating",
|
|
1961
|
+
onClick: (a) => a.stopPropagation(),
|
|
1962
|
+
role: "listbox",
|
|
1963
|
+
style: {
|
|
1964
|
+
position: "fixed",
|
|
1965
|
+
top: l.top,
|
|
1966
|
+
left: l.left,
|
|
1967
|
+
// translate up by 100% so its BOTTOM edge sits at pos.top.
|
|
1968
|
+
transform: "translate(-50%, -100%)"
|
|
1969
|
+
},
|
|
1970
|
+
children: [
|
|
1971
|
+
/* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
|
|
1972
|
+
t.map((a, s) => {
|
|
1973
|
+
const f = r === a.deviceId;
|
|
1974
|
+
return /* @__PURE__ */ y(
|
|
1975
|
+
"button",
|
|
1976
|
+
{
|
|
1977
|
+
type: "button",
|
|
1978
|
+
className: `ll-device-menu__item ${f ? "is-active" : ""}`,
|
|
1979
|
+
onClick: () => o(a.deviceId),
|
|
1980
|
+
role: "option",
|
|
1981
|
+
"aria-selected": f,
|
|
1982
|
+
children: [
|
|
1983
|
+
f && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
|
|
1984
|
+
/* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: a.label || `${e} ${s + 1}` })
|
|
1985
|
+
]
|
|
1986
|
+
},
|
|
1987
|
+
a.deviceId || s
|
|
1988
|
+
);
|
|
1989
|
+
})
|
|
1990
|
+
]
|
|
1991
|
+
}
|
|
1992
|
+
),
|
|
1993
|
+
document.body
|
|
1994
|
+
);
|
|
1995
|
+
}, Tr = [
|
|
1960
1996
|
'[data-ll-private="true"]',
|
|
1961
1997
|
".ll-widget"
|
|
1962
1998
|
];
|
|
1963
|
-
function
|
|
1999
|
+
function It(e) {
|
|
1964
2000
|
let t = e;
|
|
1965
2001
|
for (; t; ) {
|
|
1966
|
-
for (const r of
|
|
2002
|
+
for (const r of Tr)
|
|
1967
2003
|
if (t.matches(r)) return !0;
|
|
1968
2004
|
t = t.parentElement;
|
|
1969
2005
|
}
|
|
1970
2006
|
return !1;
|
|
1971
2007
|
}
|
|
1972
|
-
function
|
|
1973
|
-
if (
|
|
2008
|
+
function _t(e) {
|
|
2009
|
+
if (It(e)) return !1;
|
|
1974
2010
|
if (e instanceof HTMLInputElement) {
|
|
1975
2011
|
if (e.type === "password") return !1;
|
|
1976
2012
|
const t = (e.getAttribute("autocomplete") || "").toLowerCase();
|
|
@@ -1978,7 +2014,7 @@ function yt(e) {
|
|
|
1978
2014
|
}
|
|
1979
2015
|
return !0;
|
|
1980
2016
|
}
|
|
1981
|
-
const
|
|
2017
|
+
const bt = 4096, Dr = 20, Pr = 20, $r = 10, zr = 10, Or = 30, Hr = 20, sn = 500, Wr = [
|
|
1982
2018
|
'[data-ll-private="true"]',
|
|
1983
2019
|
".ll-widget",
|
|
1984
2020
|
"script",
|
|
@@ -1986,24 +2022,24 @@ const mt = 4096, Rr = 20, Ir = 20, Tr = 10, Mr = 10, Dr = 30, Pr = 20, on = 500,
|
|
|
1986
2022
|
"noscript",
|
|
1987
2023
|
"iframe"
|
|
1988
2024
|
];
|
|
1989
|
-
function
|
|
2025
|
+
function ct(e) {
|
|
1990
2026
|
if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
|
|
1991
2027
|
let t = e;
|
|
1992
2028
|
for (; t; ) {
|
|
1993
|
-
for (const r of
|
|
2029
|
+
for (const r of Wr)
|
|
1994
2030
|
if (t.matches(r)) return !0;
|
|
1995
2031
|
t = t.parentElement;
|
|
1996
2032
|
}
|
|
1997
2033
|
return !1;
|
|
1998
2034
|
}
|
|
1999
|
-
function
|
|
2035
|
+
function st(e) {
|
|
2000
2036
|
if (typeof window > "u") return !0;
|
|
2001
2037
|
const t = e.getBoundingClientRect();
|
|
2002
2038
|
if (t.width <= 0 || t.height <= 0) return !1;
|
|
2003
|
-
const r = window.innerHeight || document.documentElement.clientHeight,
|
|
2004
|
-
return t.bottom > 0 && t.right > 0 && t.top < r && t.left <
|
|
2039
|
+
const r = window.innerHeight || document.documentElement.clientHeight, o = window.innerWidth || document.documentElement.clientWidth;
|
|
2040
|
+
return t.bottom > 0 && t.right > 0 && t.top < r && t.left < o;
|
|
2005
2041
|
}
|
|
2006
|
-
function
|
|
2042
|
+
function dn(e) {
|
|
2007
2043
|
const t = e.getAttribute("id");
|
|
2008
2044
|
if (t) {
|
|
2009
2045
|
const l = document.querySelector(`label[for="${CSS.escape(t)}"]`);
|
|
@@ -2011,18 +2047,18 @@ function ln(e) {
|
|
|
2011
2047
|
}
|
|
2012
2048
|
const r = e.getAttribute("aria-label");
|
|
2013
2049
|
if (r) return r.trim();
|
|
2014
|
-
const
|
|
2015
|
-
if (
|
|
2016
|
-
const
|
|
2017
|
-
return
|
|
2050
|
+
const o = e.getAttribute("placeholder");
|
|
2051
|
+
if (o) return o.trim();
|
|
2052
|
+
const i = e.closest("label");
|
|
2053
|
+
return i != null && i.textContent ? i.textContent.trim() : "";
|
|
2018
2054
|
}
|
|
2019
|
-
function
|
|
2055
|
+
function ge(e, t) {
|
|
2020
2056
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
2021
2057
|
}
|
|
2022
|
-
function
|
|
2058
|
+
function Fe(e) {
|
|
2023
2059
|
return e.length;
|
|
2024
2060
|
}
|
|
2025
|
-
function
|
|
2061
|
+
function Br(e, t = {}) {
|
|
2026
2062
|
const r = t.doc ?? (typeof document < "u" ? document : null);
|
|
2027
2063
|
if (!r)
|
|
2028
2064
|
return {
|
|
@@ -2036,120 +2072,120 @@ function zr(e, t = {}) {
|
|
|
2036
2072
|
forms: [],
|
|
2037
2073
|
extras: e
|
|
2038
2074
|
};
|
|
2039
|
-
const
|
|
2075
|
+
const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "", d = Array.from(
|
|
2040
2076
|
r.querySelectorAll("[data-ll-region]")
|
|
2041
2077
|
), a = [];
|
|
2042
|
-
for (const x of
|
|
2043
|
-
if (a.length >=
|
|
2044
|
-
if (
|
|
2045
|
-
const R = x.getAttribute("data-ll-region") ?? "", B = x.getAttribute("data-ll-intent") ?? void 0, q =
|
|
2078
|
+
for (const x of d) {
|
|
2079
|
+
if (a.length >= $r) break;
|
|
2080
|
+
if (ct(x) || !st(x)) continue;
|
|
2081
|
+
const R = x.getAttribute("data-ll-region") ?? "", B = x.getAttribute("data-ll-intent") ?? void 0, q = ge(
|
|
2046
2082
|
(x.innerText || x.textContent || "").trim(),
|
|
2047
|
-
|
|
2083
|
+
sn * 2
|
|
2048
2084
|
);
|
|
2049
2085
|
!R || !q || a.push({ id: R, intent: B, text: q });
|
|
2050
2086
|
}
|
|
2051
|
-
const
|
|
2087
|
+
const s = [], f = ["H1", "H2", "H3", "H4", "H5", "H6"], b = Array.from(
|
|
2052
2088
|
r.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
|
2053
2089
|
);
|
|
2054
|
-
for (const x of
|
|
2055
|
-
if (
|
|
2090
|
+
for (const x of b) {
|
|
2091
|
+
if (ct(x) || !st(x)) continue;
|
|
2056
2092
|
const R = (x.textContent || "").trim();
|
|
2057
|
-
R &&
|
|
2093
|
+
R && s.push(`${x.tagName}: ${ge(R, 200)}`);
|
|
2058
2094
|
}
|
|
2059
2095
|
const u = Array.from(r.querySelectorAll("p, li"));
|
|
2060
2096
|
for (const x of u) {
|
|
2061
|
-
if (
|
|
2097
|
+
if (ct(x) || !st(x) || f.includes(x.tagName)) continue;
|
|
2062
2098
|
const R = (x.textContent || "").trim();
|
|
2063
|
-
R.length > 10 &&
|
|
2099
|
+
R.length > 10 && s.push(ge(R, sn));
|
|
2064
2100
|
}
|
|
2065
|
-
const c =
|
|
2066
|
-
`), I = [],
|
|
2067
|
-
for (const x of
|
|
2068
|
-
if (I.length >=
|
|
2069
|
-
if (
|
|
2101
|
+
const c = s.join(`
|
|
2102
|
+
`), I = [], k = Array.from(r.querySelectorAll("a[href]"));
|
|
2103
|
+
for (const x of k) {
|
|
2104
|
+
if (I.length >= Dr) break;
|
|
2105
|
+
if (ct(x) || !st(x)) continue;
|
|
2070
2106
|
const R = x.getAttribute("href") || "", B = (x.textContent || "").trim();
|
|
2071
|
-
!R || !B || I.push({ href: R, text:
|
|
2107
|
+
!R || !B || I.push({ href: R, text: ge(B, 100) });
|
|
2072
2108
|
}
|
|
2073
|
-
const
|
|
2109
|
+
const w = [], v = Array.from(
|
|
2074
2110
|
r.querySelectorAll(
|
|
2075
2111
|
"input, textarea, select"
|
|
2076
2112
|
)
|
|
2077
2113
|
);
|
|
2078
|
-
for (const x of
|
|
2079
|
-
if (
|
|
2080
|
-
if (
|
|
2081
|
-
const R =
|
|
2082
|
-
R &&
|
|
2114
|
+
for (const x of v) {
|
|
2115
|
+
if (w.length >= Pr) break;
|
|
2116
|
+
if (ct(x) || !_t(x) || !st(x)) continue;
|
|
2117
|
+
const R = dn(x), B = x instanceof HTMLInputElement ? x.type : x.tagName.toLowerCase();
|
|
2118
|
+
R && w.push({ label: ge(R, 100), type: B });
|
|
2083
2119
|
}
|
|
2084
2120
|
const m = Array.from(
|
|
2085
2121
|
r.querySelectorAll("[data-ll-form]")
|
|
2086
|
-
),
|
|
2122
|
+
), N = [];
|
|
2087
2123
|
for (const x of m) {
|
|
2088
|
-
if (
|
|
2089
|
-
if (
|
|
2124
|
+
if (N.length >= zr) break;
|
|
2125
|
+
if (It(x)) continue;
|
|
2090
2126
|
const R = x.getAttribute("data-ll-form") || "";
|
|
2091
2127
|
if (!R) continue;
|
|
2092
2128
|
const B = x.getAttribute("data-ll-intent") || void 0, q = Array.from(
|
|
2093
2129
|
x.querySelectorAll(
|
|
2094
2130
|
"[data-ll-field]"
|
|
2095
2131
|
)
|
|
2096
|
-
),
|
|
2097
|
-
for (const
|
|
2098
|
-
if (
|
|
2099
|
-
if (!
|
|
2100
|
-
const F =
|
|
2132
|
+
), A = [];
|
|
2133
|
+
for (const T of q) {
|
|
2134
|
+
if (A.length >= Or) break;
|
|
2135
|
+
if (!_t(T)) continue;
|
|
2136
|
+
const F = T.getAttribute("data-ll-field") || "";
|
|
2101
2137
|
if (!F) continue;
|
|
2102
|
-
const
|
|
2138
|
+
const oe = dn(T) || F, ie = T instanceof HTMLInputElement ? T.type : T.tagName.toLowerCase(), Z = {
|
|
2103
2139
|
name: F,
|
|
2104
|
-
label:
|
|
2140
|
+
label: ge(oe, 100),
|
|
2105
2141
|
type: ie
|
|
2106
2142
|
};
|
|
2107
|
-
if (
|
|
2143
|
+
if (T.required === !0 && (Z.required = !0), T instanceof HTMLSelectElement) {
|
|
2108
2144
|
const fe = [];
|
|
2109
|
-
for (let
|
|
2110
|
-
const pe =
|
|
2145
|
+
for (let ye = 0; ye < T.options.length && !(fe.length >= Hr); ye++) {
|
|
2146
|
+
const pe = T.options[ye];
|
|
2111
2147
|
if (!pe || pe.disabled) continue;
|
|
2112
|
-
const
|
|
2113
|
-
!
|
|
2148
|
+
const ve = pe.value || "", he = (pe.textContent || "").trim() || ve;
|
|
2149
|
+
!ve && !he || fe.push({ value: ve, label: ge(he, 60) });
|
|
2114
2150
|
}
|
|
2115
2151
|
fe.length > 0 && (Z.options = fe);
|
|
2116
2152
|
}
|
|
2117
|
-
const
|
|
2118
|
-
|
|
2153
|
+
const ce = typeof T.validationMessage == "string" ? T.validationMessage : "";
|
|
2154
|
+
ce && (Z.validationMessage = ge(ce, 200)), A.push(Z);
|
|
2119
2155
|
}
|
|
2120
|
-
|
|
2156
|
+
N.push({ id: R, intent: B, fields: A });
|
|
2121
2157
|
}
|
|
2122
2158
|
const $ = {
|
|
2123
|
-
url:
|
|
2159
|
+
url: o,
|
|
2124
2160
|
title: l,
|
|
2125
|
-
pathname:
|
|
2161
|
+
pathname: i,
|
|
2126
2162
|
regions: a,
|
|
2127
2163
|
visibleText: c,
|
|
2128
2164
|
visibleLinks: I,
|
|
2129
|
-
visibleFields:
|
|
2130
|
-
forms:
|
|
2165
|
+
visibleFields: w,
|
|
2166
|
+
forms: N,
|
|
2131
2167
|
extras: e
|
|
2132
2168
|
};
|
|
2133
|
-
let D =
|
|
2134
|
-
for (; D >
|
|
2135
|
-
$.visibleFields.pop(), D =
|
|
2136
|
-
for (; D >
|
|
2169
|
+
let D = Fe(JSON.stringify($.regions)) + Fe($.visibleText) + Fe(JSON.stringify($.visibleLinks)) + Fe(JSON.stringify($.visibleFields));
|
|
2170
|
+
for (; D > bt && $.visibleFields.length > 0; )
|
|
2171
|
+
$.visibleFields.pop(), D = Fe(JSON.stringify($.visibleFields));
|
|
2172
|
+
for (; D > bt && $.visibleLinks.length > 0; )
|
|
2137
2173
|
$.visibleLinks.pop(), D -= 80;
|
|
2138
|
-
return
|
|
2174
|
+
return Fe($.visibleText) > bt && ($.visibleText = ge($.visibleText, bt - 100)), $;
|
|
2139
2175
|
}
|
|
2140
|
-
let
|
|
2141
|
-
function
|
|
2142
|
-
const r = Date.now(),
|
|
2143
|
-
if (
|
|
2144
|
-
return
|
|
2145
|
-
const l =
|
|
2146
|
-
return
|
|
2176
|
+
let Ue = null;
|
|
2177
|
+
function un(e, t = {}) {
|
|
2178
|
+
const r = Date.now(), i = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
|
|
2179
|
+
if (Ue && Ue.key === i && r - Ue.at < 1e3)
|
|
2180
|
+
return Ue.ctx;
|
|
2181
|
+
const l = Br(e, t);
|
|
2182
|
+
return Ue = { key: i, at: r, ctx: l }, l;
|
|
2147
2183
|
}
|
|
2148
|
-
function
|
|
2149
|
-
|
|
2184
|
+
function qr() {
|
|
2185
|
+
Ue = null;
|
|
2150
2186
|
}
|
|
2151
|
-
const
|
|
2152
|
-
function
|
|
2187
|
+
const Fr = 200;
|
|
2188
|
+
function Ur(e) {
|
|
2153
2189
|
const t = String(e.href || "");
|
|
2154
2190
|
return {
|
|
2155
2191
|
href: t,
|
|
@@ -2159,63 +2195,63 @@ function Wr(e) {
|
|
|
2159
2195
|
description: e.description
|
|
2160
2196
|
};
|
|
2161
2197
|
}
|
|
2162
|
-
function
|
|
2198
|
+
function jr(e) {
|
|
2163
2199
|
return !(!e || e.startsWith("#") || e.startsWith("javascript:") || e.startsWith("mailto:") || e.startsWith("tel:"));
|
|
2164
2200
|
}
|
|
2165
|
-
function
|
|
2201
|
+
function Vr(e) {
|
|
2166
2202
|
const t = e ?? (typeof document < "u" ? document : null);
|
|
2167
2203
|
if (!t) return [];
|
|
2168
|
-
const r = typeof window < "u" && window.location.origin || "",
|
|
2169
|
-
for (const
|
|
2170
|
-
if (
|
|
2171
|
-
if (
|
|
2172
|
-
const a =
|
|
2173
|
-
if (!
|
|
2174
|
-
let
|
|
2204
|
+
const r = typeof window < "u" && window.location.origin || "", o = /* @__PURE__ */ new Set(), i = [], l = Array.from(t.querySelectorAll("a[href]"));
|
|
2205
|
+
for (const d of l) {
|
|
2206
|
+
if (i.length >= Fr) break;
|
|
2207
|
+
if (It(d)) continue;
|
|
2208
|
+
const a = d.getAttribute("href") || "";
|
|
2209
|
+
if (!jr(a)) continue;
|
|
2210
|
+
let s = a, f = !0;
|
|
2175
2211
|
try {
|
|
2176
2212
|
if (typeof window < "u") {
|
|
2177
2213
|
const u = new URL(a, r);
|
|
2178
|
-
f = u.origin === r, f && a.startsWith("http") && (
|
|
2214
|
+
f = u.origin === r, f && a.startsWith("http") && (s = u.pathname + u.search + u.hash);
|
|
2179
2215
|
}
|
|
2180
2216
|
} catch {
|
|
2181
2217
|
continue;
|
|
2182
2218
|
}
|
|
2183
|
-
if (
|
|
2184
|
-
|
|
2185
|
-
const
|
|
2186
|
-
|
|
2219
|
+
if (o.has(s)) continue;
|
|
2220
|
+
o.add(s);
|
|
2221
|
+
const b = (d.textContent || "").trim().slice(0, 120);
|
|
2222
|
+
i.push({ href: s, text: b, internal: f });
|
|
2187
2223
|
}
|
|
2188
|
-
return
|
|
2224
|
+
return i;
|
|
2189
2225
|
}
|
|
2190
|
-
let
|
|
2191
|
-
const
|
|
2192
|
-
function
|
|
2226
|
+
let je = null;
|
|
2227
|
+
const Yr = 5e3;
|
|
2228
|
+
function Nt() {
|
|
2193
2229
|
const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
|
|
2194
|
-
if (
|
|
2195
|
-
return
|
|
2196
|
-
const r =
|
|
2197
|
-
return
|
|
2230
|
+
if (je && je.pathname === t && e - je.at < Yr)
|
|
2231
|
+
return je.routes;
|
|
2232
|
+
const r = Vr();
|
|
2233
|
+
return je = { at: e, pathname: t, routes: r }, r;
|
|
2198
2234
|
}
|
|
2199
|
-
function
|
|
2200
|
-
|
|
2235
|
+
function Gr() {
|
|
2236
|
+
je = null;
|
|
2201
2237
|
}
|
|
2202
|
-
function
|
|
2203
|
-
const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype,
|
|
2204
|
-
|
|
2238
|
+
function Jr(e, t) {
|
|
2239
|
+
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;
|
|
2240
|
+
i ? i.call(e, t) : e.value = t;
|
|
2205
2241
|
}
|
|
2206
|
-
function
|
|
2207
|
-
const
|
|
2242
|
+
function Kr(e, t, r = {}) {
|
|
2243
|
+
const o = r.triggerInput ?? !0, i = r.triggerChange ?? !0;
|
|
2208
2244
|
if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
|
|
2209
2245
|
const l = Object.getOwnPropertyDescriptor(
|
|
2210
2246
|
HTMLInputElement.prototype,
|
|
2211
2247
|
"checked"
|
|
2212
|
-
),
|
|
2213
|
-
|
|
2248
|
+
), d = l == null ? void 0 : l.set, a = t === "true" || t === "1" || t === "on";
|
|
2249
|
+
d ? d.call(e, a) : e.checked = a, o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
2214
2250
|
return;
|
|
2215
2251
|
}
|
|
2216
|
-
|
|
2252
|
+
Jr(e, t), o && e.dispatchEvent(new Event("input", { bubbles: !0 })), i && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
2217
2253
|
}
|
|
2218
|
-
function
|
|
2254
|
+
function Xr() {
|
|
2219
2255
|
if (typeof window > "u" || typeof document > "u")
|
|
2220
2256
|
return !1;
|
|
2221
2257
|
const e = document.scrollingElement || document.documentElement;
|
|
@@ -2223,44 +2259,44 @@ function Yr() {
|
|
|
2223
2259
|
const t = window.getComputedStyle(e);
|
|
2224
2260
|
return !(t.overflowY === "hidden" || t.overflowY === "clip");
|
|
2225
2261
|
}
|
|
2226
|
-
function
|
|
2262
|
+
function Qr(e) {
|
|
2227
2263
|
if (!(e instanceof HTMLElement)) return !1;
|
|
2228
2264
|
const r = window.getComputedStyle(e).overflowY;
|
|
2229
2265
|
return !(r !== "auto" && r !== "scroll" || e.scrollHeight <= e.clientHeight + 2);
|
|
2230
2266
|
}
|
|
2231
|
-
function
|
|
2267
|
+
function Zr() {
|
|
2232
2268
|
if (typeof document > "u") return null;
|
|
2233
2269
|
const e = Array.from(
|
|
2234
2270
|
document.querySelectorAll("body, body *")
|
|
2235
2271
|
);
|
|
2236
2272
|
let t = null, r = 0;
|
|
2237
|
-
for (const
|
|
2238
|
-
if (!
|
|
2239
|
-
const
|
|
2240
|
-
if (
|
|
2241
|
-
const l =
|
|
2242
|
-
l > r && (r = l, t =
|
|
2273
|
+
for (const o of e) {
|
|
2274
|
+
if (!Qr(o)) continue;
|
|
2275
|
+
const i = o.getBoundingClientRect();
|
|
2276
|
+
if (i.bottom <= 0 || i.top >= window.innerHeight || i.right <= 0 || i.left >= window.innerWidth || i.width <= 0 || i.height <= 0 || o.closest(".ll-widget")) continue;
|
|
2277
|
+
const l = i.width * i.height;
|
|
2278
|
+
l > r && (r = l, t = o);
|
|
2243
2279
|
}
|
|
2244
2280
|
return t;
|
|
2245
2281
|
}
|
|
2246
|
-
function
|
|
2282
|
+
function eo() {
|
|
2247
2283
|
if (typeof window > "u")
|
|
2248
2284
|
return null;
|
|
2249
|
-
if (
|
|
2250
|
-
const e =
|
|
2285
|
+
if (Xr()) return window;
|
|
2286
|
+
const e = Zr();
|
|
2251
2287
|
return e || window;
|
|
2252
2288
|
}
|
|
2253
|
-
function
|
|
2289
|
+
function fn(e) {
|
|
2254
2290
|
return e instanceof Window ? e.innerHeight || 0 : e.clientHeight || 0;
|
|
2255
2291
|
}
|
|
2256
|
-
function
|
|
2292
|
+
function to(e) {
|
|
2257
2293
|
var t, r;
|
|
2258
2294
|
return e instanceof Window ? typeof document > "u" ? 0 : Math.max(
|
|
2259
2295
|
((t = document.body) == null ? void 0 : t.scrollHeight) ?? 0,
|
|
2260
2296
|
((r = document.documentElement) == null ? void 0 : r.scrollHeight) ?? 0
|
|
2261
2297
|
) : e.scrollHeight - e.clientHeight;
|
|
2262
2298
|
}
|
|
2263
|
-
const
|
|
2299
|
+
const no = /* @__PURE__ */ new Set([
|
|
2264
2300
|
"agent_state",
|
|
2265
2301
|
"avatar_stream_ready",
|
|
2266
2302
|
"avatar_active",
|
|
@@ -2282,115 +2318,116 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2282
2318
|
"focus_field",
|
|
2283
2319
|
"submit_form",
|
|
2284
2320
|
"request_routes"
|
|
2285
|
-
]),
|
|
2321
|
+
]), xn = dt(
|
|
2286
2322
|
function(t, r) {
|
|
2287
|
-
var
|
|
2323
|
+
var qt, Ft, Ut, jt, Vt, Yt, Gt;
|
|
2288
2324
|
const {
|
|
2289
|
-
agentId:
|
|
2290
|
-
apiKey:
|
|
2325
|
+
agentId: o,
|
|
2326
|
+
apiKey: i,
|
|
2291
2327
|
baseUrl: l = "https://app.livelayer.studio",
|
|
2292
|
-
sessionEndpoint:
|
|
2328
|
+
sessionEndpoint: d,
|
|
2293
2329
|
sessionBody: a,
|
|
2294
|
-
soundEffects:
|
|
2330
|
+
soundEffects: s,
|
|
2295
2331
|
experienceMode: f = "WIDGET",
|
|
2296
|
-
autoConnect:
|
|
2332
|
+
autoConnect: b = !1,
|
|
2297
2333
|
displayMode: u,
|
|
2298
2334
|
defaultDisplayMode: c = "expanded",
|
|
2299
2335
|
onDisplayModeChange: I,
|
|
2300
|
-
position:
|
|
2301
|
-
mobileBreakpoint:
|
|
2302
|
-
persistKey:
|
|
2336
|
+
position: k = "bottom-right",
|
|
2337
|
+
mobileBreakpoint: w = 640,
|
|
2338
|
+
persistKey: v = "ll-widget",
|
|
2303
2339
|
disablePersistence: m = !1,
|
|
2304
|
-
teamMembers:
|
|
2340
|
+
teamMembers: N,
|
|
2305
2341
|
currentTeamMemberId: $,
|
|
2306
2342
|
onTeamMemberChange: D,
|
|
2307
2343
|
idleLoopUrl: x,
|
|
2308
2344
|
greeting: R,
|
|
2309
2345
|
avatarImageUrl: B,
|
|
2310
2346
|
agentName: q,
|
|
2311
|
-
branding:
|
|
2312
|
-
allowCamera:
|
|
2347
|
+
branding: A = {},
|
|
2348
|
+
allowCamera: T = !0,
|
|
2313
2349
|
allowScreenShare: F = !0,
|
|
2314
|
-
allowTyping:
|
|
2350
|
+
allowTyping: oe = !0,
|
|
2315
2351
|
showMinimize: ie = !0,
|
|
2316
2352
|
chromeless: Z = !1,
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2353
|
+
floatingChromeContainer: ce = null,
|
|
2354
|
+
compactControls: fe = !1,
|
|
2355
|
+
transforming: ye = !1,
|
|
2356
|
+
transformingLabel: pe = "Transforming…",
|
|
2357
|
+
showOn: ve,
|
|
2358
|
+
hideOn: he,
|
|
2359
|
+
pathname: ee,
|
|
2360
|
+
onNavigate: ut,
|
|
2361
|
+
onScrollToSelector: Ge,
|
|
2362
|
+
getPageContext: ft,
|
|
2363
|
+
pageContextExtras: le,
|
|
2364
|
+
getRoutes: Je,
|
|
2365
|
+
onScrollPage: Ke,
|
|
2366
|
+
onClick: pt,
|
|
2367
|
+
capabilities: Xe,
|
|
2368
|
+
onConnect: Ce,
|
|
2369
|
+
onDisconnect: Pe,
|
|
2370
|
+
onTranscript: Se,
|
|
2371
|
+
onAgentState: $e,
|
|
2372
|
+
onConnectionStateChange: Ne,
|
|
2373
|
+
onAgentEvent: Ae,
|
|
2374
|
+
onAgentCommand: Re,
|
|
2338
2375
|
controlledSession: z,
|
|
2339
|
-
className:
|
|
2340
|
-
style:
|
|
2341
|
-
zIndex:
|
|
2342
|
-
} = t,
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
}, [
|
|
2346
|
-
const
|
|
2376
|
+
className: ht,
|
|
2377
|
+
style: xt,
|
|
2378
|
+
zIndex: Ie = 2147483647
|
|
2379
|
+
} = t, Me = ar(ee), te = hr(Me, ve, he);
|
|
2380
|
+
M(() => {
|
|
2381
|
+
qr(), Gr();
|
|
2382
|
+
}, [Me]);
|
|
2383
|
+
const Qe = $ !== void 0, [Ze, ze] = C(() => {
|
|
2347
2384
|
var g;
|
|
2348
|
-
return $ ?? ((g =
|
|
2349
|
-
}),
|
|
2350
|
-
() => (
|
|
2351
|
-
[
|
|
2352
|
-
),
|
|
2353
|
-
value:
|
|
2354
|
-
defaultValue:
|
|
2385
|
+
return $ ?? ((g = N == null ? void 0 : N[0]) == null ? void 0 : g.id);
|
|
2386
|
+
}), Te = Qe ? $ : Ze, X = Ye(
|
|
2387
|
+
() => (N == null ? void 0 : N.find((g) => g.id === Te)) ?? null,
|
|
2388
|
+
[N, Te]
|
|
2389
|
+
), mt = (X == null ? void 0 : X.agentId) ?? o, et = f === "EMBEDDED", [ne, re] = rr({
|
|
2390
|
+
value: u,
|
|
2391
|
+
defaultValue: c,
|
|
2355
2392
|
onChange: I,
|
|
2356
|
-
persistKey:
|
|
2357
|
-
disablePersistence:
|
|
2358
|
-
}),
|
|
2359
|
-
|
|
2360
|
-
const
|
|
2361
|
-
|
|
2362
|
-
function
|
|
2363
|
-
const p =
|
|
2393
|
+
persistKey: v,
|
|
2394
|
+
disablePersistence: et || m
|
|
2395
|
+
}), se = ir(w), be = jn(), G = Vn(), de = Gn(), we = Jn(), Oe = Kn(), [kt, tt] = C(!1), [_e, nt] = C(!1), [rt, ot] = C(!1), [xe, ke] = C(!1), [He, gt] = C(!1), We = gr({ baseUrl: l, config: s }), De = S(We);
|
|
2396
|
+
De.current = We;
|
|
2397
|
+
const h = S(ut), V = S(Ge), Lt = S(Ke), Et = S(pt), Mt = S(ft), Tt = S(le), Dt = S(Je), Ct = S(Xe), ue = S(null);
|
|
2398
|
+
h.current = ut, V.current = Ge, Lt.current = Ke, Et.current = pt, Mt.current = ft, Tt.current = le, Dt.current = Je, Ct.current = Xe;
|
|
2399
|
+
function Le(g) {
|
|
2400
|
+
const p = Ct.current;
|
|
2364
2401
|
return p ? p.includes(g) : !0;
|
|
2365
2402
|
}
|
|
2366
|
-
function
|
|
2403
|
+
function Ee(g, p) {
|
|
2367
2404
|
console.warn(
|
|
2368
2405
|
`[LiveLayer] Agent command "${g}" blocked — capability "${p}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
|
|
2369
2406
|
);
|
|
2370
2407
|
}
|
|
2371
|
-
const
|
|
2408
|
+
const it = E(
|
|
2372
2409
|
(g) => {
|
|
2373
|
-
var Y,
|
|
2410
|
+
var Y, ae, me, at;
|
|
2374
2411
|
const p = g;
|
|
2375
2412
|
if (!(!p.type || typeof p.type != "string")) {
|
|
2376
|
-
if (
|
|
2377
|
-
if (!
|
|
2378
|
-
|
|
2413
|
+
if (Ae == null || Ae({ eventName: p.type, data: g }), p.type === "navigate") {
|
|
2414
|
+
if (!Le("navigate")) {
|
|
2415
|
+
Ee("navigate", "navigate");
|
|
2379
2416
|
return;
|
|
2380
2417
|
}
|
|
2381
|
-
const
|
|
2382
|
-
if (!
|
|
2418
|
+
const L = typeof p.href == "string" ? p.href : null;
|
|
2419
|
+
if (!L) {
|
|
2383
2420
|
console.warn(
|
|
2384
2421
|
`[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
|
|
2385
2422
|
);
|
|
2386
2423
|
return;
|
|
2387
2424
|
}
|
|
2388
|
-
if (
|
|
2425
|
+
if (De.current.playPageChange(), h.current) {
|
|
2389
2426
|
try {
|
|
2390
|
-
|
|
2427
|
+
h.current(L);
|
|
2391
2428
|
} catch (P) {
|
|
2392
2429
|
console.warn(
|
|
2393
|
-
`[LiveLayer] onNavigate threw for "${
|
|
2430
|
+
`[LiveLayer] onNavigate threw for "${L}". Falling back. Error:`,
|
|
2394
2431
|
P
|
|
2395
2432
|
);
|
|
2396
2433
|
}
|
|
@@ -2398,7 +2435,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2398
2435
|
}
|
|
2399
2436
|
if (typeof document < "u") {
|
|
2400
2437
|
const P = document.querySelector(
|
|
2401
|
-
`a[href="${
|
|
2438
|
+
`a[href="${L.replace(/"/g, '\\"')}"]`
|
|
2402
2439
|
);
|
|
2403
2440
|
if (P) {
|
|
2404
2441
|
P.click();
|
|
@@ -2407,27 +2444,27 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2407
2444
|
}
|
|
2408
2445
|
if (typeof window < "u" && typeof history < "u")
|
|
2409
2446
|
try {
|
|
2410
|
-
history.pushState({}, "",
|
|
2447
|
+
history.pushState({}, "", L), window.dispatchEvent(new PopStateEvent("popstate"));
|
|
2411
2448
|
} catch (P) {
|
|
2412
2449
|
console.warn(
|
|
2413
|
-
`[LiveLayer] history.pushState fallback failed for "${
|
|
2450
|
+
`[LiveLayer] history.pushState fallback failed for "${L}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
|
|
2414
2451
|
P
|
|
2415
2452
|
);
|
|
2416
2453
|
}
|
|
2417
2454
|
return;
|
|
2418
2455
|
}
|
|
2419
2456
|
if (p.type === "scroll_to") {
|
|
2420
|
-
if (!
|
|
2421
|
-
|
|
2457
|
+
if (!Le("scroll")) {
|
|
2458
|
+
Ee("scroll_to", "scroll");
|
|
2422
2459
|
return;
|
|
2423
2460
|
}
|
|
2424
|
-
const
|
|
2425
|
-
if (!
|
|
2461
|
+
const L = typeof p.selector == "string" ? p.selector : null;
|
|
2462
|
+
if (!L) return;
|
|
2426
2463
|
const P = p.behavior === "instant" ? "instant" : "smooth";
|
|
2427
|
-
if (
|
|
2464
|
+
if (V.current) {
|
|
2428
2465
|
try {
|
|
2429
|
-
|
|
2430
|
-
|
|
2466
|
+
V.current(
|
|
2467
|
+
L,
|
|
2431
2468
|
P
|
|
2432
2469
|
);
|
|
2433
2470
|
} catch (W) {
|
|
@@ -2438,16 +2475,16 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2438
2475
|
if (typeof document < "u") {
|
|
2439
2476
|
let W = null;
|
|
2440
2477
|
try {
|
|
2441
|
-
W = document.querySelector(
|
|
2478
|
+
W = document.querySelector(L);
|
|
2442
2479
|
} catch {
|
|
2443
2480
|
console.warn(
|
|
2444
|
-
`[LiveLayer] scroll_to: invalid selector "${
|
|
2481
|
+
`[LiveLayer] scroll_to: invalid selector "${L}".`
|
|
2445
2482
|
);
|
|
2446
2483
|
return;
|
|
2447
2484
|
}
|
|
2448
2485
|
if (!W) {
|
|
2449
2486
|
console.warn(
|
|
2450
|
-
`[LiveLayer] scroll_to: no element matched "${
|
|
2487
|
+
`[LiveLayer] scroll_to: no element matched "${L}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
|
|
2451
2488
|
);
|
|
2452
2489
|
return;
|
|
2453
2490
|
}
|
|
@@ -2459,20 +2496,20 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2459
2496
|
return;
|
|
2460
2497
|
}
|
|
2461
2498
|
if (p.type === "request_page_context") {
|
|
2462
|
-
if (!
|
|
2463
|
-
|
|
2499
|
+
if (!Le("read_page")) {
|
|
2500
|
+
Ee("request_page_context", "read_page");
|
|
2464
2501
|
return;
|
|
2465
2502
|
}
|
|
2466
|
-
const
|
|
2503
|
+
const L = typeof p.requestId == "string" ? p.requestId : void 0, P = (Y = ue.current) == null ? void 0 : Y.call(ue), W = (j) => {
|
|
2467
2504
|
const O = P, K = O == null ? void 0 : O.localParticipant;
|
|
2468
2505
|
if (K != null && K.publishData)
|
|
2469
2506
|
try {
|
|
2470
|
-
const Q =
|
|
2471
|
-
K.publishData(
|
|
2507
|
+
const Q = L ? { ...j, requestId: L } : j, qe = new TextEncoder().encode(JSON.stringify(Q));
|
|
2508
|
+
K.publishData(qe, { reliable: !0 });
|
|
2472
2509
|
} catch (Q) {
|
|
2473
2510
|
console.warn("[LiveLayer] publishData failed.", Q);
|
|
2474
2511
|
}
|
|
2475
|
-
}, H =
|
|
2512
|
+
}, H = Tt.current, U = Mt.current;
|
|
2476
2513
|
try {
|
|
2477
2514
|
if (U) {
|
|
2478
2515
|
const j = U(H);
|
|
@@ -2483,7 +2520,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2483
2520
|
O
|
|
2484
2521
|
), W({
|
|
2485
2522
|
type: "page_context",
|
|
2486
|
-
context:
|
|
2523
|
+
context: un(H)
|
|
2487
2524
|
});
|
|
2488
2525
|
});
|
|
2489
2526
|
return;
|
|
@@ -2493,7 +2530,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2493
2530
|
}
|
|
2494
2531
|
W({
|
|
2495
2532
|
type: "page_context",
|
|
2496
|
-
context:
|
|
2533
|
+
context: un(H)
|
|
2497
2534
|
});
|
|
2498
2535
|
} catch (j) {
|
|
2499
2536
|
console.warn(
|
|
@@ -2507,22 +2544,22 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2507
2544
|
return;
|
|
2508
2545
|
}
|
|
2509
2546
|
if (p.type === "scroll_page") {
|
|
2510
|
-
if (!
|
|
2511
|
-
|
|
2547
|
+
if (!Le("scroll")) {
|
|
2548
|
+
Ee("scroll_page", "scroll");
|
|
2512
2549
|
return;
|
|
2513
2550
|
}
|
|
2514
|
-
const
|
|
2515
|
-
if (
|
|
2551
|
+
const L = p.direction;
|
|
2552
|
+
if (L !== "up" && L !== "down" && L !== "top" && L !== "bottom") {
|
|
2516
2553
|
console.warn(
|
|
2517
|
-
`[LiveLayer] scroll_page: invalid direction "${String(
|
|
2554
|
+
`[LiveLayer] scroll_page: invalid direction "${String(L)}". Expected up | down | top | bottom.`
|
|
2518
2555
|
);
|
|
2519
2556
|
return;
|
|
2520
2557
|
}
|
|
2521
2558
|
const P = p.behavior === "instant" ? "instant" : "smooth";
|
|
2522
|
-
if (
|
|
2559
|
+
if (Lt.current) {
|
|
2523
2560
|
try {
|
|
2524
|
-
|
|
2525
|
-
|
|
2561
|
+
Lt.current(
|
|
2562
|
+
L,
|
|
2526
2563
|
P
|
|
2527
2564
|
);
|
|
2528
2565
|
} catch (O) {
|
|
@@ -2531,27 +2568,27 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2531
2568
|
return;
|
|
2532
2569
|
}
|
|
2533
2570
|
if (typeof window > "u") return;
|
|
2534
|
-
const W = { behavior: P }, H =
|
|
2571
|
+
const W = { behavior: P }, H = eo(), U = (O) => {
|
|
2535
2572
|
H instanceof Window ? H.scrollBy({ top: O, ...W }) : H.scrollBy({ top: O, ...W });
|
|
2536
2573
|
}, j = (O) => {
|
|
2537
2574
|
H instanceof Window ? H.scrollTo({ top: O, ...W }) : H.scrollTo({ top: O, ...W });
|
|
2538
2575
|
};
|
|
2539
|
-
|
|
2576
|
+
L === "up" ? U(-fn(H)) : L === "down" ? U(fn(H)) : j(L === "top" ? 0 : to(H));
|
|
2540
2577
|
return;
|
|
2541
2578
|
}
|
|
2542
2579
|
if (p.type === "click") {
|
|
2543
|
-
if (!
|
|
2544
|
-
|
|
2580
|
+
if (!Le("click")) {
|
|
2581
|
+
Ee("click", "click");
|
|
2545
2582
|
return;
|
|
2546
2583
|
}
|
|
2547
|
-
const
|
|
2548
|
-
if (!
|
|
2584
|
+
const L = typeof p.selector == "string" ? p.selector : null;
|
|
2585
|
+
if (!L) {
|
|
2549
2586
|
console.warn("[LiveLayer] click: missing selector.");
|
|
2550
2587
|
return;
|
|
2551
2588
|
}
|
|
2552
|
-
if (
|
|
2589
|
+
if (Et.current) {
|
|
2553
2590
|
try {
|
|
2554
|
-
|
|
2591
|
+
Et.current(L);
|
|
2555
2592
|
} catch (W) {
|
|
2556
2593
|
console.warn("[LiveLayer] onClick threw.", W);
|
|
2557
2594
|
}
|
|
@@ -2560,16 +2597,16 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2560
2597
|
if (typeof document > "u") return;
|
|
2561
2598
|
let P = null;
|
|
2562
2599
|
try {
|
|
2563
|
-
P = document.querySelector(
|
|
2600
|
+
P = document.querySelector(L);
|
|
2564
2601
|
} catch {
|
|
2565
2602
|
console.warn(
|
|
2566
|
-
`[LiveLayer] click: invalid selector "${
|
|
2603
|
+
`[LiveLayer] click: invalid selector "${L}".`
|
|
2567
2604
|
);
|
|
2568
2605
|
return;
|
|
2569
2606
|
}
|
|
2570
2607
|
if (!P) {
|
|
2571
2608
|
console.warn(
|
|
2572
|
-
`[LiveLayer] click: no element matched "${
|
|
2609
|
+
`[LiveLayer] click: no element matched "${L}". See https://livelayer.studio/docs/errors/click-no-match`
|
|
2573
2610
|
);
|
|
2574
2611
|
return;
|
|
2575
2612
|
}
|
|
@@ -2579,27 +2616,27 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2579
2616
|
);
|
|
2580
2617
|
return;
|
|
2581
2618
|
}
|
|
2582
|
-
(
|
|
2619
|
+
(ae = P.click) == null || ae.call(P);
|
|
2583
2620
|
return;
|
|
2584
2621
|
}
|
|
2585
2622
|
if (p.type === "fill_form" || p.type === "focus_field") {
|
|
2586
|
-
if (!
|
|
2587
|
-
|
|
2623
|
+
if (!Le("fill_forms")) {
|
|
2624
|
+
Ee(p.type, "fill_forms");
|
|
2588
2625
|
return;
|
|
2589
2626
|
}
|
|
2590
2627
|
if (typeof document > "u") return;
|
|
2591
|
-
p.type === "fill_form" &&
|
|
2592
|
-
const
|
|
2593
|
-
if (!
|
|
2628
|
+
p.type === "fill_form" && De.current.playConfirmation();
|
|
2629
|
+
const L = typeof p.formId == "string" ? p.formId : null;
|
|
2630
|
+
if (!L) {
|
|
2594
2631
|
console.warn(`[LiveLayer] ${p.type}: missing formId.`);
|
|
2595
2632
|
return;
|
|
2596
2633
|
}
|
|
2597
2634
|
const P = document.querySelector(
|
|
2598
|
-
`[data-ll-form="${
|
|
2635
|
+
`[data-ll-form="${L.replace(/"/g, '\\"')}"]`
|
|
2599
2636
|
);
|
|
2600
2637
|
if (!P) {
|
|
2601
2638
|
console.warn(
|
|
2602
|
-
`[LiveLayer] ${p.type}: no form with data-ll-form="${
|
|
2639
|
+
`[LiveLayer] ${p.type}: no form with data-ll-form="${L}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
|
|
2603
2640
|
);
|
|
2604
2641
|
return;
|
|
2605
2642
|
}
|
|
@@ -2618,11 +2655,11 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2618
2655
|
const U = P.querySelector(`[data-ll-field="${H.replace(/"/g, '\\"')}"]`);
|
|
2619
2656
|
if (!U) {
|
|
2620
2657
|
console.warn(
|
|
2621
|
-
`[LiveLayer] focus_field: no field "${H}" in form "${
|
|
2658
|
+
`[LiveLayer] focus_field: no field "${H}" in form "${L}".`
|
|
2622
2659
|
);
|
|
2623
2660
|
return;
|
|
2624
2661
|
}
|
|
2625
|
-
if (!
|
|
2662
|
+
if (!_t(U)) {
|
|
2626
2663
|
console.warn(
|
|
2627
2664
|
`[LiveLayer] focus_field: field "${H}" is privacy-protected and not focusable.`
|
|
2628
2665
|
);
|
|
@@ -2641,18 +2678,18 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2641
2678
|
const j = P.querySelector(`[data-ll-field="${H.replace(/"/g, '\\"')}"]`);
|
|
2642
2679
|
if (!j) {
|
|
2643
2680
|
console.warn(
|
|
2644
|
-
`[LiveLayer] fill_form: no field "${H}" in form "${
|
|
2681
|
+
`[LiveLayer] fill_form: no field "${H}" in form "${L}". Skipping.`
|
|
2645
2682
|
);
|
|
2646
2683
|
continue;
|
|
2647
2684
|
}
|
|
2648
|
-
if (!
|
|
2685
|
+
if (!_t(j)) {
|
|
2649
2686
|
console.warn(
|
|
2650
2687
|
`[LiveLayer] fill_form: field "${H}" is privacy-protected (password / cc-* / private). Skipping.`
|
|
2651
2688
|
);
|
|
2652
2689
|
continue;
|
|
2653
2690
|
}
|
|
2654
2691
|
try {
|
|
2655
|
-
|
|
2692
|
+
Kr(j, U);
|
|
2656
2693
|
} catch (O) {
|
|
2657
2694
|
console.warn(
|
|
2658
2695
|
`[LiveLayer] fill_form: failed to set "${H}".`,
|
|
@@ -2663,23 +2700,23 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2663
2700
|
return;
|
|
2664
2701
|
}
|
|
2665
2702
|
if (p.type === "submit_form") {
|
|
2666
|
-
if (!
|
|
2667
|
-
|
|
2703
|
+
if (!Le("submit_forms")) {
|
|
2704
|
+
Ee("submit_form", "submit_forms");
|
|
2668
2705
|
return;
|
|
2669
2706
|
}
|
|
2670
2707
|
if (typeof document > "u") return;
|
|
2671
|
-
const
|
|
2672
|
-
if (!
|
|
2708
|
+
const L = typeof p.formId == "string" ? p.formId : null;
|
|
2709
|
+
if (!L) {
|
|
2673
2710
|
console.warn("[LiveLayer] submit_form: missing formId.");
|
|
2674
2711
|
return;
|
|
2675
2712
|
}
|
|
2676
|
-
|
|
2713
|
+
De.current.playConfirmation();
|
|
2677
2714
|
const P = document.querySelector(
|
|
2678
|
-
`[data-ll-form="${
|
|
2715
|
+
`[data-ll-form="${L.replace(/"/g, '\\"')}"]`
|
|
2679
2716
|
);
|
|
2680
2717
|
if (!P) {
|
|
2681
2718
|
console.warn(
|
|
2682
|
-
`[LiveLayer] submit_form: no form with data-ll-form="${
|
|
2719
|
+
`[LiveLayer] submit_form: no form with data-ll-form="${L}".`
|
|
2683
2720
|
);
|
|
2684
2721
|
return;
|
|
2685
2722
|
}
|
|
@@ -2689,18 +2726,18 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2689
2726
|
);
|
|
2690
2727
|
return;
|
|
2691
2728
|
}
|
|
2692
|
-
const W = typeof p.requestId == "string" ? p.requestId : void 0, H = (
|
|
2693
|
-
const Q = H,
|
|
2694
|
-
if (
|
|
2729
|
+
const W = typeof p.requestId == "string" ? p.requestId : void 0, H = (me = ue.current) == null ? void 0 : me.call(ue), U = (K) => {
|
|
2730
|
+
const Q = H, qe = Q == null ? void 0 : Q.localParticipant;
|
|
2731
|
+
if (qe != null && qe.publishData)
|
|
2695
2732
|
try {
|
|
2696
|
-
const
|
|
2697
|
-
|
|
2733
|
+
const Pn = W ? { ...K, requestId: W } : K, $n = new TextEncoder().encode(JSON.stringify(Pn));
|
|
2734
|
+
qe.publishData($n, { reliable: !0 });
|
|
2698
2735
|
} catch {
|
|
2699
2736
|
}
|
|
2700
2737
|
};
|
|
2701
2738
|
let j = !1;
|
|
2702
2739
|
const O = () => {
|
|
2703
|
-
j = !0, U({ type: "form_submitted", formId:
|
|
2740
|
+
j = !0, U({ type: "form_submitted", formId: L });
|
|
2704
2741
|
};
|
|
2705
2742
|
P.addEventListener("submit", O, { once: !0 });
|
|
2706
2743
|
try {
|
|
@@ -2708,7 +2745,7 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2708
2745
|
} catch (K) {
|
|
2709
2746
|
console.warn("[LiveLayer] submit_form: requestSubmit threw.", K), P.removeEventListener("submit", O), U({
|
|
2710
2747
|
type: "form_submit_blocked",
|
|
2711
|
-
formId:
|
|
2748
|
+
formId: L,
|
|
2712
2749
|
reason: "exception"
|
|
2713
2750
|
});
|
|
2714
2751
|
return;
|
|
@@ -2716,27 +2753,27 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2716
2753
|
setTimeout(() => {
|
|
2717
2754
|
j || (P.removeEventListener("submit", O), U({
|
|
2718
2755
|
type: "form_submit_blocked",
|
|
2719
|
-
formId:
|
|
2756
|
+
formId: L,
|
|
2720
2757
|
reason: "validation"
|
|
2721
2758
|
}));
|
|
2722
2759
|
}, 500);
|
|
2723
2760
|
return;
|
|
2724
2761
|
}
|
|
2725
2762
|
if (p.type === "request_routes") {
|
|
2726
|
-
if (!
|
|
2727
|
-
|
|
2763
|
+
if (!Le("read_page")) {
|
|
2764
|
+
Ee("request_routes", "read_page");
|
|
2728
2765
|
return;
|
|
2729
2766
|
}
|
|
2730
|
-
const
|
|
2767
|
+
const L = typeof p.requestId == "string" ? p.requestId : void 0, W = (at = ue.current) == null ? void 0 : at.call(ue), H = W == null ? void 0 : W.localParticipant;
|
|
2731
2768
|
if (!(H != null && H.publishData)) return;
|
|
2732
2769
|
const U = (O) => {
|
|
2733
2770
|
try {
|
|
2734
|
-
const K =
|
|
2771
|
+
const K = L ? { type: "routes", routes: O, requestId: L } : { type: "routes", routes: O }, Q = new TextEncoder().encode(JSON.stringify(K));
|
|
2735
2772
|
H.publishData(Q, { reliable: !0 });
|
|
2736
2773
|
} catch (K) {
|
|
2737
2774
|
console.warn("[LiveLayer] request_routes: publishData failed.", K);
|
|
2738
2775
|
}
|
|
2739
|
-
}, j =
|
|
2776
|
+
}, j = Dt.current;
|
|
2740
2777
|
if (j) {
|
|
2741
2778
|
try {
|
|
2742
2779
|
const O = j(), K = (Q) => {
|
|
@@ -2744,63 +2781,63 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2744
2781
|
U([]);
|
|
2745
2782
|
return;
|
|
2746
2783
|
}
|
|
2747
|
-
U(Q.map(
|
|
2784
|
+
U(Q.map(Ur).slice(0, 200));
|
|
2748
2785
|
};
|
|
2749
2786
|
O instanceof Promise ? O.then(K).catch((Q) => {
|
|
2750
2787
|
console.warn(
|
|
2751
2788
|
"[LiveLayer] getRoutes rejected; falling back to DOM walker.",
|
|
2752
2789
|
Q
|
|
2753
|
-
), U(
|
|
2790
|
+
), U(Nt());
|
|
2754
2791
|
}) : K(O);
|
|
2755
2792
|
} catch (O) {
|
|
2756
2793
|
console.warn(
|
|
2757
2794
|
"[LiveLayer] getRoutes threw; falling back to DOM walker.",
|
|
2758
2795
|
O
|
|
2759
|
-
), U(
|
|
2796
|
+
), U(Nt());
|
|
2760
2797
|
}
|
|
2761
2798
|
return;
|
|
2762
2799
|
}
|
|
2763
2800
|
try {
|
|
2764
|
-
U(
|
|
2801
|
+
U(Nt());
|
|
2765
2802
|
} catch (O) {
|
|
2766
2803
|
console.warn("[LiveLayer] request_routes: extractRoutes threw.", O);
|
|
2767
2804
|
}
|
|
2768
2805
|
return;
|
|
2769
2806
|
}
|
|
2770
|
-
|
|
2807
|
+
no.has(p.type) || Re == null || Re(p);
|
|
2771
2808
|
}
|
|
2772
2809
|
},
|
|
2773
|
-
[
|
|
2774
|
-
), J =
|
|
2775
|
-
agentId: z ? "__controlled__" :
|
|
2810
|
+
[Re, Ae]
|
|
2811
|
+
), J = Un({
|
|
2812
|
+
agentId: z ? "__controlled__" : mt,
|
|
2776
2813
|
baseUrl: l,
|
|
2777
|
-
apiKey:
|
|
2778
|
-
sessionEndpoint:
|
|
2814
|
+
apiKey: i,
|
|
2815
|
+
sessionEndpoint: d,
|
|
2779
2816
|
sessionBody: a,
|
|
2780
|
-
onDataMessage: z ? void 0 :
|
|
2817
|
+
onDataMessage: z ? void 0 : it
|
|
2781
2818
|
});
|
|
2782
|
-
|
|
2819
|
+
M(() => {
|
|
2783
2820
|
if (z != null && z.subscribeToDataMessages)
|
|
2784
|
-
return z.subscribeToDataMessages(
|
|
2785
|
-
}, [z,
|
|
2821
|
+
return z.subscribeToDataMessages(it);
|
|
2822
|
+
}, [z, it]), ue.current = () => {
|
|
2786
2823
|
var g;
|
|
2787
2824
|
return (g = J.getRoom) == null ? void 0 : g.call(J);
|
|
2788
|
-
},
|
|
2825
|
+
}, M(() => {
|
|
2789
2826
|
var Y;
|
|
2790
2827
|
if (typeof window > "u") return;
|
|
2791
2828
|
const g = ((Y = window.location) == null ? void 0 : Y.hostname) || "";
|
|
2792
2829
|
if (g === "localhost" || g === "127.0.0.1" || g === "0.0.0.0" || g.endsWith(".local") || g.endsWith(".test"))
|
|
2793
|
-
return window.__livelayerSimulateCommand = (
|
|
2830
|
+
return window.__livelayerSimulateCommand = (ae) => {
|
|
2794
2831
|
try {
|
|
2795
|
-
|
|
2796
|
-
} catch (
|
|
2797
|
-
console.warn("[LiveLayer] simulate-command threw:",
|
|
2832
|
+
it(ae);
|
|
2833
|
+
} catch (me) {
|
|
2834
|
+
console.warn("[LiveLayer] simulate-command threw:", me);
|
|
2798
2835
|
}
|
|
2799
2836
|
}, () => {
|
|
2800
2837
|
delete window.__livelayerSimulateCommand;
|
|
2801
2838
|
};
|
|
2802
|
-
}, [
|
|
2803
|
-
const
|
|
2839
|
+
}, [it]);
|
|
2840
|
+
const _ = Ye(() => z ? {
|
|
2804
2841
|
connectionState: z.connectionState,
|
|
2805
2842
|
agentState: z.agentState,
|
|
2806
2843
|
transcript: z.transcript,
|
|
@@ -2831,73 +2868,73 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2831
2868
|
disconnect: J.disconnect,
|
|
2832
2869
|
getRoom: J.getRoom,
|
|
2833
2870
|
isControlled: !1
|
|
2834
|
-
}, [z, J]),
|
|
2835
|
-
|
|
2836
|
-
const
|
|
2837
|
-
|
|
2871
|
+
}, [z, J]), Pt = S(_);
|
|
2872
|
+
Pt.current = _;
|
|
2873
|
+
const $t = S(z);
|
|
2874
|
+
$t.current = z, On(
|
|
2838
2875
|
r,
|
|
2839
2876
|
() => ({
|
|
2840
2877
|
sendData: async (g) => {
|
|
2841
|
-
var
|
|
2842
|
-
const p =
|
|
2878
|
+
var me, at;
|
|
2879
|
+
const p = $t.current;
|
|
2843
2880
|
if (p != null && p.publishData) {
|
|
2844
2881
|
try {
|
|
2845
2882
|
await p.publishData(g);
|
|
2846
|
-
} catch (
|
|
2847
|
-
console.warn("[AvatarWidget] sendData (controlled) failed:",
|
|
2883
|
+
} catch (L) {
|
|
2884
|
+
console.warn("[AvatarWidget] sendData (controlled) failed:", L);
|
|
2848
2885
|
}
|
|
2849
2886
|
return;
|
|
2850
2887
|
}
|
|
2851
|
-
const Y = (
|
|
2852
|
-
if (
|
|
2888
|
+
const Y = (at = (me = Pt.current) == null ? void 0 : me.getRoom) == null ? void 0 : at.call(me), ae = Y == null ? void 0 : Y.localParticipant;
|
|
2889
|
+
if (ae != null && ae.publishData)
|
|
2853
2890
|
try {
|
|
2854
|
-
const
|
|
2855
|
-
await
|
|
2856
|
-
} catch (
|
|
2857
|
-
console.warn("[AvatarWidget] sendData failed:",
|
|
2891
|
+
const L = new TextEncoder().encode(JSON.stringify(g));
|
|
2892
|
+
await ae.publishData(L, { reliable: !0 });
|
|
2893
|
+
} catch (L) {
|
|
2894
|
+
console.warn("[AvatarWidget] sendData failed:", L);
|
|
2858
2895
|
}
|
|
2859
2896
|
}
|
|
2860
2897
|
}),
|
|
2861
2898
|
[]
|
|
2862
2899
|
);
|
|
2863
|
-
const
|
|
2864
|
-
|
|
2865
|
-
const g =
|
|
2900
|
+
const zt = S(null);
|
|
2901
|
+
M(() => {
|
|
2902
|
+
const g = _.videoElement, p = zt.current;
|
|
2866
2903
|
if (!(!g || !p))
|
|
2867
2904
|
return p.appendChild(g), () => {
|
|
2868
2905
|
g.parentNode === p && p.removeChild(g);
|
|
2869
2906
|
};
|
|
2870
|
-
}, [
|
|
2871
|
-
const g =
|
|
2907
|
+
}, [_.videoElement]), M(() => {
|
|
2908
|
+
const g = _.audioElement;
|
|
2872
2909
|
if (!g) return;
|
|
2873
|
-
|
|
2910
|
+
be.attach(g);
|
|
2874
2911
|
const p = g.play();
|
|
2875
2912
|
return p && typeof p.catch == "function" && p.catch((Y) => {
|
|
2876
|
-
(Y == null ? void 0 : Y.name) === "NotAllowedError" &&
|
|
2913
|
+
(Y == null ? void 0 : Y.name) === "NotAllowedError" && tt(!0);
|
|
2877
2914
|
}), () => {
|
|
2878
|
-
|
|
2915
|
+
be.detach();
|
|
2879
2916
|
};
|
|
2880
|
-
}, [
|
|
2881
|
-
if (
|
|
2882
|
-
const g =
|
|
2917
|
+
}, [_.audioElement]), M(() => {
|
|
2918
|
+
if (_.isControlled || _.connectionState !== "connected") return;
|
|
2919
|
+
const g = _.getRoom();
|
|
2883
2920
|
if (g)
|
|
2884
2921
|
return G.setupMic(g).catch(() => {
|
|
2885
2922
|
}), () => {
|
|
2886
2923
|
G.teardownMic();
|
|
2887
2924
|
};
|
|
2888
|
-
}, [
|
|
2925
|
+
}, [_.isControlled, _.connectionState]), M(() => {
|
|
2889
2926
|
var p;
|
|
2890
|
-
if (
|
|
2891
|
-
const g =
|
|
2927
|
+
if (_.connectionState !== "connected") return;
|
|
2928
|
+
const g = _.isControlled ? (p = z == null ? void 0 : z.getRoom) == null ? void 0 : p.call(z) : _.getRoom();
|
|
2892
2929
|
if (g)
|
|
2893
|
-
return
|
|
2894
|
-
|
|
2930
|
+
return de.attachRoom(g), we.attachRoom(g), _.isControlled && G.attachRoom(g), Oe.refresh(), () => {
|
|
2931
|
+
de.teardown(), we.teardown();
|
|
2895
2932
|
};
|
|
2896
|
-
}, [
|
|
2897
|
-
const g =
|
|
2933
|
+
}, [_.isControlled, _.connectionState, z]), M(() => {
|
|
2934
|
+
const g = _.audioElement;
|
|
2898
2935
|
g && (g.muted = He);
|
|
2899
|
-
}, [
|
|
2900
|
-
const
|
|
2936
|
+
}, [_.audioElement, He]);
|
|
2937
|
+
const kn = E((g) => {
|
|
2901
2938
|
const p = { type: "user_message", text: g };
|
|
2902
2939
|
if (z != null && z.publishData) {
|
|
2903
2940
|
try {
|
|
@@ -2906,347 +2943,365 @@ const Qr = /* @__PURE__ */ new Set([
|
|
|
2906
2943
|
}
|
|
2907
2944
|
return;
|
|
2908
2945
|
}
|
|
2909
|
-
const Y =
|
|
2946
|
+
const Y = _.getRoom();
|
|
2910
2947
|
if (Y)
|
|
2911
2948
|
try {
|
|
2912
|
-
const
|
|
2913
|
-
Y.localParticipant.publishData(
|
|
2949
|
+
const ae = new TextEncoder().encode(JSON.stringify(p));
|
|
2950
|
+
Y.localParticipant.publishData(ae, { reliable: !0 });
|
|
2914
2951
|
} catch {
|
|
2915
2952
|
}
|
|
2916
|
-
}, [
|
|
2917
|
-
|
|
2953
|
+
}, [_, z]), Ln = E(() => {
|
|
2954
|
+
gt((g) => !g);
|
|
2918
2955
|
}, []);
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
}, [
|
|
2922
|
-
|
|
2923
|
-
}, [
|
|
2924
|
-
|
|
2925
|
-
}, [
|
|
2926
|
-
|
|
2927
|
-
}, [
|
|
2928
|
-
const
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
}, [
|
|
2932
|
-
const
|
|
2956
|
+
M(() => {
|
|
2957
|
+
Ne == null || Ne(_.connectionState), _.connectionState === "connected" ? Ce == null || Ce() : _.connectionState === "disconnected" && (Pe == null || Pe());
|
|
2958
|
+
}, [_.connectionState, Ce, Pe, Ne]), M(() => {
|
|
2959
|
+
Se == null || Se(_.transcript);
|
|
2960
|
+
}, [_.transcript, Se]), M(() => {
|
|
2961
|
+
$e == null || $e(_.agentState);
|
|
2962
|
+
}, [_.agentState, $e]), M(() => {
|
|
2963
|
+
We.setThinking(_.agentState === "thinking");
|
|
2964
|
+
}, [_.agentState, We]);
|
|
2965
|
+
const Ot = S(!1);
|
|
2966
|
+
M(() => {
|
|
2967
|
+
_.isControlled || !b || Ot.current || te && _.connectionState === "idle" && (Ot.current = !0, _.connect());
|
|
2968
|
+
}, [b, _.connectionState, _, te]);
|
|
2969
|
+
const En = E(
|
|
2933
2970
|
(g) => {
|
|
2934
|
-
const p =
|
|
2935
|
-
p && (
|
|
2971
|
+
const p = N == null ? void 0 : N.find((Y) => Y.id === g);
|
|
2972
|
+
p && (ot(!1), g !== Te && (nt(!0), _.disconnect(), Qe || ze(g), D == null || D(p)));
|
|
2936
2973
|
},
|
|
2937
2974
|
[
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2975
|
+
N,
|
|
2976
|
+
Te,
|
|
2977
|
+
_,
|
|
2978
|
+
Qe,
|
|
2942
2979
|
D
|
|
2943
2980
|
]
|
|
2944
2981
|
);
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
}, [
|
|
2948
|
-
if (!
|
|
2982
|
+
M(() => {
|
|
2983
|
+
_e && _.connectionState === "connected" && nt(!1);
|
|
2984
|
+
}, [_.connectionState, _e]), M(() => {
|
|
2985
|
+
if (!rt) return;
|
|
2949
2986
|
const g = (p) => {
|
|
2950
|
-
p.key === "Escape" &&
|
|
2987
|
+
p.key === "Escape" && ot(!1);
|
|
2951
2988
|
};
|
|
2952
2989
|
return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
|
|
2953
|
-
}, [
|
|
2954
|
-
const
|
|
2955
|
-
|
|
2956
|
-
const
|
|
2957
|
-
() =>
|
|
2958
|
-
[
|
|
2959
|
-
),
|
|
2960
|
-
|
|
2961
|
-
}, [
|
|
2962
|
-
const g =
|
|
2963
|
-
g && g.play().then(() =>
|
|
2990
|
+
}, [rt]);
|
|
2991
|
+
const Cn = !!B || !!(X != null && X.avatarImageUrl) || _.isControlled, lt = Xn(mt, l, Cn);
|
|
2992
|
+
Xe === void 0 && ((qt = lt.info) != null && qt.capabilities) && (Ct.current = lt.info.capabilities);
|
|
2993
|
+
const yt = (X == null ? void 0 : X.name) ?? q ?? ((Ft = _.agentConfig) == null ? void 0 : Ft.name) ?? ((Ut = lt.info) == null ? void 0 : Ut.name) ?? "Live Layer", St = (X == null ? void 0 : X.avatarImageUrl) ?? B ?? ((jt = _.agentConfig) == null ? void 0 : jt.avatarImageUrl) ?? ((Vt = lt.info) == null ? void 0 : Vt.avatarImageUrl) ?? null, Sn = x ?? ((Yt = _.agentConfig) == null ? void 0 : Yt.idleLoopUrl) ?? ((Gt = lt.info) == null ? void 0 : Gt.idleLoopUrl) ?? null, Nn = R ?? null, An = E(() => re("expanded"), [re]), Rn = E(
|
|
2994
|
+
() => re("minimized"),
|
|
2995
|
+
[re]
|
|
2996
|
+
), Ht = E(() => {
|
|
2997
|
+
_.disconnect(), re("hidden");
|
|
2998
|
+
}, [_, re]), In = E(() => {
|
|
2999
|
+
const g = _.audioElement;
|
|
3000
|
+
g && g.play().then(() => tt(!1)).catch(() => {
|
|
2964
3001
|
});
|
|
2965
|
-
}, [
|
|
2966
|
-
|
|
2967
|
-
}, [
|
|
2968
|
-
...
|
|
2969
|
-
...
|
|
3002
|
+
}, [_.audioElement]), Mn = E(() => {
|
|
3003
|
+
tt(!1), _.connect();
|
|
3004
|
+
}, [_]), Be = {
|
|
3005
|
+
...xt,
|
|
3006
|
+
...et ? {} : { zIndex: Ie }
|
|
2970
3007
|
};
|
|
2971
|
-
|
|
2972
|
-
const
|
|
3008
|
+
A.primaryColor && (Be["--ll-color-primary"] = A.primaryColor), A.accentColor && (Be["--ll-color-accent"] = A.accentColor), A.backgroundColor && (Be["--ll-color-bg"] = A.backgroundColor), A.textColor && (Be["--ll-color-fg"] = A.textColor);
|
|
3009
|
+
const Tn = [
|
|
2973
3010
|
"ll-widget",
|
|
2974
|
-
`ll-widget--${
|
|
2975
|
-
`ll-widget--${
|
|
2976
|
-
|
|
3011
|
+
`ll-widget--${ne}`,
|
|
3012
|
+
`ll-widget--${se ? "mobile" : "desktop"}`,
|
|
3013
|
+
ht
|
|
2977
3014
|
].filter(Boolean).join(" ");
|
|
2978
|
-
|
|
3015
|
+
if (!te) return null;
|
|
3016
|
+
const Dn = /* @__PURE__ */ n(
|
|
2979
3017
|
"div",
|
|
2980
3018
|
{
|
|
2981
|
-
className:
|
|
2982
|
-
style:
|
|
2983
|
-
"data-display-mode":
|
|
2984
|
-
"data-position":
|
|
3019
|
+
className: Tn,
|
|
3020
|
+
style: Be,
|
|
3021
|
+
"data-display-mode": ne,
|
|
3022
|
+
"data-position": k,
|
|
2985
3023
|
"data-experience-mode": f === "EMBEDDED" ? "embedded" : "widget",
|
|
3024
|
+
children: ne === "expanded" && /* @__PURE__ */ n(
|
|
3025
|
+
Ir,
|
|
3026
|
+
{
|
|
3027
|
+
position: k,
|
|
3028
|
+
isMobile: se,
|
|
3029
|
+
agentName: yt,
|
|
3030
|
+
avatarImageUrl: St,
|
|
3031
|
+
idleLoopUrl: Sn,
|
|
3032
|
+
greeting: Nn,
|
|
3033
|
+
branding: A,
|
|
3034
|
+
teamMembers: N,
|
|
3035
|
+
currentTeamMemberId: Te,
|
|
3036
|
+
isSwitchingTeamMember: _e,
|
|
3037
|
+
teamSwitcherOpen: rt,
|
|
3038
|
+
onToggleTeamSwitcher: () => ot((g) => !g),
|
|
3039
|
+
onSelectTeamMember: En,
|
|
3040
|
+
connectionState: _.connectionState,
|
|
3041
|
+
agentState: _.agentState,
|
|
3042
|
+
transcript: _.transcript,
|
|
3043
|
+
isMuted: G.isMuted,
|
|
3044
|
+
micDevices: Oe.mics,
|
|
3045
|
+
activeMicId: G.activeDeviceId,
|
|
3046
|
+
isCameraEnabled: de.isEnabled,
|
|
3047
|
+
cameraPreviewEl: de.previewEl,
|
|
3048
|
+
cameraDevices: Oe.cameras,
|
|
3049
|
+
activeCameraId: de.activeDeviceId,
|
|
3050
|
+
isScreenShareEnabled: we.isEnabled,
|
|
3051
|
+
screenPreviewEl: we.previewEl,
|
|
3052
|
+
isSpeakerMuted: He,
|
|
3053
|
+
allowCamera: T,
|
|
3054
|
+
allowScreenShare: F,
|
|
3055
|
+
allowTyping: oe,
|
|
3056
|
+
showMinimize: ie,
|
|
3057
|
+
chromeless: Z,
|
|
3058
|
+
compactControls: fe,
|
|
3059
|
+
transforming: ye,
|
|
3060
|
+
transformingLabel: pe,
|
|
3061
|
+
languageMenuOpen: xe,
|
|
3062
|
+
onToggleLanguageMenu: () => ke((g) => !g),
|
|
3063
|
+
needsUserGesture: kt,
|
|
3064
|
+
canResume: _.canResume,
|
|
3065
|
+
micError: G.micError,
|
|
3066
|
+
error: _.error,
|
|
3067
|
+
avatarVideoContainerRef: zt,
|
|
3068
|
+
agentVideoEl: _.videoElement,
|
|
3069
|
+
onConnect: () => void _.connect(),
|
|
3070
|
+
onDisconnect: () => _.disconnect(),
|
|
3071
|
+
onRetry: Mn,
|
|
3072
|
+
onResumeAudio: In,
|
|
3073
|
+
onToggleMute: G.toggleMute,
|
|
3074
|
+
onSwitchMicDevice: (g) => void G.switchDevice(g),
|
|
3075
|
+
onToggleCamera: () => void de.toggle(),
|
|
3076
|
+
onSwitchCameraDevice: (g) => void de.switchDevice(g),
|
|
3077
|
+
onToggleScreenShare: () => void we.toggle(),
|
|
3078
|
+
onToggleSpeaker: Ln,
|
|
3079
|
+
onSendMessage: kn,
|
|
3080
|
+
onMinimize: Rn,
|
|
3081
|
+
onClose: Ht,
|
|
3082
|
+
onClearMicError: G.clearError
|
|
3083
|
+
}
|
|
3084
|
+
)
|
|
3085
|
+
}
|
|
3086
|
+
), Wt = ne === "hidden" || ne === "minimized" ? /* @__PURE__ */ y(
|
|
3087
|
+
"div",
|
|
3088
|
+
{
|
|
3089
|
+
className: [
|
|
3090
|
+
"ll-widget",
|
|
3091
|
+
"ll-widget--floating",
|
|
3092
|
+
`ll-widget--${ne}`,
|
|
3093
|
+
`ll-widget--${se ? "mobile" : "desktop"}`
|
|
3094
|
+
].join(" "),
|
|
3095
|
+
style: Be,
|
|
3096
|
+
"data-display-mode": ne,
|
|
3097
|
+
"data-position": k,
|
|
2986
3098
|
children: [
|
|
2987
|
-
|
|
2988
|
-
|
|
3099
|
+
ne === "hidden" && /* @__PURE__ */ n(
|
|
3100
|
+
xr,
|
|
2989
3101
|
{
|
|
2990
|
-
position:
|
|
2991
|
-
isMobile:
|
|
2992
|
-
isSpeaking:
|
|
2993
|
-
onExpand: () =>
|
|
2994
|
-
label: `Open ${
|
|
2995
|
-
avatarImageUrl:
|
|
2996
|
-
agentName:
|
|
2997
|
-
}
|
|
2998
|
-
),
|
|
2999
|
-
xe === "minimized" && /* @__PURE__ */ n(
|
|
3000
|
-
wr,
|
|
3001
|
-
{
|
|
3002
|
-
position: L,
|
|
3003
|
-
isMobile: me,
|
|
3004
|
-
agentName: pt,
|
|
3005
|
-
avatarImageUrl: Ct,
|
|
3006
|
-
agentState: w.agentState,
|
|
3007
|
-
isMuted: G.isMuted,
|
|
3008
|
-
audioLevel: ke,
|
|
3009
|
-
onExpand: Ln,
|
|
3010
|
-
onToggleMute: G.toggleMute,
|
|
3011
|
-
onClose: zt
|
|
3102
|
+
position: k,
|
|
3103
|
+
isMobile: se,
|
|
3104
|
+
isSpeaking: _.agentState === "speaking",
|
|
3105
|
+
onExpand: () => re("expanded"),
|
|
3106
|
+
label: `Open ${yt} widget`,
|
|
3107
|
+
avatarImageUrl: St,
|
|
3108
|
+
agentName: yt
|
|
3012
3109
|
}
|
|
3013
3110
|
),
|
|
3014
|
-
|
|
3015
|
-
|
|
3111
|
+
ne === "minimized" && /* @__PURE__ */ n(
|
|
3112
|
+
Lr,
|
|
3016
3113
|
{
|
|
3017
|
-
position:
|
|
3018
|
-
isMobile:
|
|
3019
|
-
agentName:
|
|
3020
|
-
avatarImageUrl:
|
|
3021
|
-
|
|
3022
|
-
greeting: kn,
|
|
3023
|
-
branding: N,
|
|
3024
|
-
teamMembers: S,
|
|
3025
|
-
currentTeamMemberId: ce,
|
|
3026
|
-
isSwitchingTeamMember: Oe,
|
|
3027
|
-
teamSwitcherOpen: Qe,
|
|
3028
|
-
onToggleTeamSwitcher: () => de((g) => !g),
|
|
3029
|
-
onSelectTeamMember: wn,
|
|
3030
|
-
connectionState: w.connectionState,
|
|
3031
|
-
agentState: w.agentState,
|
|
3032
|
-
transcript: w.transcript,
|
|
3114
|
+
position: k,
|
|
3115
|
+
isMobile: se,
|
|
3116
|
+
agentName: yt,
|
|
3117
|
+
avatarImageUrl: St,
|
|
3118
|
+
agentState: _.agentState,
|
|
3033
3119
|
isMuted: G.isMuted,
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
isCameraEnabled: ne.isEnabled,
|
|
3037
|
-
cameraPreviewEl: ne.previewEl,
|
|
3038
|
-
cameraDevices: Xe.cameras,
|
|
3039
|
-
activeCameraId: ne.activeDeviceId,
|
|
3040
|
-
isScreenShareEnabled: Le.isEnabled,
|
|
3041
|
-
screenPreviewEl: Le.previewEl,
|
|
3042
|
-
isSpeakerMuted: He,
|
|
3043
|
-
allowCamera: M,
|
|
3044
|
-
allowScreenShare: F,
|
|
3045
|
-
allowTyping: re,
|
|
3046
|
-
showMinimize: ie,
|
|
3047
|
-
chromeless: Z,
|
|
3048
|
-
compactControls: ae,
|
|
3049
|
-
transforming: fe,
|
|
3050
|
-
transformingLabel: ve,
|
|
3051
|
-
languageMenuOpen: Ce,
|
|
3052
|
-
onToggleLanguageMenu: () => ft((g) => !g),
|
|
3053
|
-
needsUserGesture: wt,
|
|
3054
|
-
canResume: w.canResume,
|
|
3055
|
-
micError: G.micError,
|
|
3056
|
-
error: w.error,
|
|
3057
|
-
avatarVideoContainerRef: Pt,
|
|
3058
|
-
agentVideoEl: w.videoElement,
|
|
3059
|
-
onConnect: () => void w.connect(),
|
|
3060
|
-
onDisconnect: () => w.disconnect(),
|
|
3061
|
-
onRetry: Sn,
|
|
3062
|
-
onResumeAudio: Cn,
|
|
3120
|
+
audioLevel: be,
|
|
3121
|
+
onExpand: An,
|
|
3063
3122
|
onToggleMute: G.toggleMute,
|
|
3064
|
-
|
|
3065
|
-
onToggleCamera: () => void ne.toggle(),
|
|
3066
|
-
onSwitchCameraDevice: (g) => void ne.switchDevice(g),
|
|
3067
|
-
onToggleScreenShare: () => void Le.toggle(),
|
|
3068
|
-
onToggleSpeaker: bn,
|
|
3069
|
-
onSendMessage: vn,
|
|
3070
|
-
onMinimize: En,
|
|
3071
|
-
onClose: zt,
|
|
3072
|
-
onClearMicError: G.clearError
|
|
3123
|
+
onClose: Ht
|
|
3073
3124
|
}
|
|
3074
3125
|
)
|
|
3075
3126
|
]
|
|
3076
3127
|
}
|
|
3077
|
-
) : null;
|
|
3128
|
+
) : null, Bt = ce ?? (typeof document < "u" ? document.body : null);
|
|
3129
|
+
return /* @__PURE__ */ y(Ve, { children: [
|
|
3130
|
+
Dn,
|
|
3131
|
+
Wt && Bt && Rt(Wt, Bt)
|
|
3132
|
+
] });
|
|
3078
3133
|
}
|
|
3079
3134
|
);
|
|
3080
|
-
|
|
3081
|
-
const
|
|
3135
|
+
xn.displayName = "AvatarWidgetInner";
|
|
3136
|
+
const ro = dt(
|
|
3082
3137
|
function(t, r) {
|
|
3083
|
-
return /* @__PURE__ */ n(
|
|
3138
|
+
return /* @__PURE__ */ n(Fn, { children: /* @__PURE__ */ n(xn, { ...t, ref: r }) });
|
|
3084
3139
|
}
|
|
3085
3140
|
);
|
|
3086
|
-
|
|
3087
|
-
const
|
|
3141
|
+
ro.displayName = "AvatarWidget";
|
|
3142
|
+
const ho = ({
|
|
3088
3143
|
agentId: e,
|
|
3089
3144
|
baseUrl: t,
|
|
3090
3145
|
apiKey: r,
|
|
3091
|
-
mode:
|
|
3092
|
-
onAgentEvent:
|
|
3146
|
+
mode: o,
|
|
3147
|
+
onAgentEvent: i,
|
|
3093
3148
|
className: l,
|
|
3094
|
-
style:
|
|
3149
|
+
style: d
|
|
3095
3150
|
}) => {
|
|
3096
|
-
const a =
|
|
3097
|
-
f.current =
|
|
3098
|
-
const
|
|
3151
|
+
const a = S(null), s = S(null), f = S(i);
|
|
3152
|
+
f.current = i;
|
|
3153
|
+
const b = E((u) => {
|
|
3099
3154
|
var I;
|
|
3100
3155
|
const c = u.detail;
|
|
3101
3156
|
(I = f.current) == null || I.call(f, c);
|
|
3102
3157
|
}, []);
|
|
3103
|
-
return
|
|
3158
|
+
return M(() => {
|
|
3104
3159
|
const u = a.current;
|
|
3105
3160
|
if (!u) return;
|
|
3106
3161
|
const c = document.createElement("livelayer-widget");
|
|
3107
|
-
return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r),
|
|
3108
|
-
c.removeEventListener("agent-event",
|
|
3162
|
+
return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), o && c.setAttribute("mode", o), c.addEventListener("agent-event", b), u.appendChild(c), s.current = c, () => {
|
|
3163
|
+
c.removeEventListener("agent-event", b), u.removeChild(c), s.current = null;
|
|
3109
3164
|
};
|
|
3110
|
-
}, [e]),
|
|
3111
|
-
|
|
3112
|
-
}, [
|
|
3113
|
-
},
|
|
3114
|
-
function({ id: t, intent: r, as:
|
|
3115
|
-
return
|
|
3116
|
-
|
|
3165
|
+
}, [e]), M(() => {
|
|
3166
|
+
s.current && (o ? s.current.setAttribute("mode", o) : s.current.removeAttribute("mode"));
|
|
3167
|
+
}, [o]), /* @__PURE__ */ n("div", { ref: a, className: l, style: d });
|
|
3168
|
+
}, mo = dt(
|
|
3169
|
+
function({ id: t, intent: r, as: o = "div", className: i, style: l, children: d }, a) {
|
|
3170
|
+
return Hn(
|
|
3171
|
+
o,
|
|
3117
3172
|
{
|
|
3118
3173
|
ref: a,
|
|
3119
3174
|
"data-ll-region": t,
|
|
3120
3175
|
"data-ll-intent": r,
|
|
3121
|
-
className:
|
|
3176
|
+
className: i,
|
|
3122
3177
|
style: l
|
|
3123
3178
|
},
|
|
3124
|
-
|
|
3179
|
+
d
|
|
3125
3180
|
);
|
|
3126
3181
|
}
|
|
3127
|
-
),
|
|
3128
|
-
function({ id: t, intent: r, children:
|
|
3182
|
+
), go = dt(
|
|
3183
|
+
function({ id: t, intent: r, children: o, ...i }, l) {
|
|
3129
3184
|
return /* @__PURE__ */ n(
|
|
3130
3185
|
"form",
|
|
3131
3186
|
{
|
|
3132
3187
|
ref: l,
|
|
3133
3188
|
"data-ll-form": t,
|
|
3134
3189
|
"data-ll-intent": r,
|
|
3135
|
-
...
|
|
3136
|
-
children:
|
|
3190
|
+
...i,
|
|
3191
|
+
children: o
|
|
3137
3192
|
}
|
|
3138
3193
|
);
|
|
3139
3194
|
}
|
|
3140
|
-
),
|
|
3195
|
+
), yo = dt(
|
|
3141
3196
|
function(t, r) {
|
|
3142
|
-
const { name:
|
|
3197
|
+
const { name: o, label: i, labelClassName: l } = t, d = { name: o, "data-ll-field": o };
|
|
3143
3198
|
let a;
|
|
3144
3199
|
if ("as" in t && t.as === "textarea") {
|
|
3145
|
-
const { name:
|
|
3200
|
+
const { name: s, label: f, labelClassName: b, as: u, ...c } = t;
|
|
3146
3201
|
a = /* @__PURE__ */ n(
|
|
3147
3202
|
"textarea",
|
|
3148
3203
|
{
|
|
3149
3204
|
ref: r,
|
|
3150
|
-
...
|
|
3205
|
+
...d,
|
|
3151
3206
|
...c
|
|
3152
3207
|
}
|
|
3153
3208
|
);
|
|
3154
3209
|
} else if ("as" in t && t.as === "select") {
|
|
3155
|
-
const { name:
|
|
3210
|
+
const { name: s, label: f, labelClassName: b, as: u, children: c, ...I } = t;
|
|
3156
3211
|
a = /* @__PURE__ */ n(
|
|
3157
3212
|
"select",
|
|
3158
3213
|
{
|
|
3159
3214
|
ref: r,
|
|
3160
|
-
...
|
|
3215
|
+
...d,
|
|
3161
3216
|
...I,
|
|
3162
3217
|
children: c
|
|
3163
3218
|
}
|
|
3164
3219
|
);
|
|
3165
3220
|
} else {
|
|
3166
|
-
const { name:
|
|
3221
|
+
const { name: s, label: f, labelClassName: b, as: u, ...c } = t;
|
|
3167
3222
|
a = /* @__PURE__ */ n(
|
|
3168
3223
|
"input",
|
|
3169
3224
|
{
|
|
3170
3225
|
ref: r,
|
|
3171
|
-
...
|
|
3226
|
+
...d,
|
|
3172
3227
|
...c
|
|
3173
3228
|
}
|
|
3174
3229
|
);
|
|
3175
3230
|
}
|
|
3176
|
-
return
|
|
3177
|
-
|
|
3231
|
+
return i === void 0 ? a : /* @__PURE__ */ y("label", { className: l, children: [
|
|
3232
|
+
i,
|
|
3178
3233
|
a
|
|
3179
3234
|
] });
|
|
3180
3235
|
}
|
|
3181
3236
|
);
|
|
3182
|
-
let
|
|
3183
|
-
function
|
|
3237
|
+
let pn = 1;
|
|
3238
|
+
function vo({
|
|
3184
3239
|
onMount: e,
|
|
3185
3240
|
defaultOpen: t = !1,
|
|
3186
3241
|
storageKey: r = "ll-debug-open"
|
|
3187
3242
|
}) {
|
|
3188
|
-
const [
|
|
3189
|
-
I.current = f,
|
|
3243
|
+
const [o, i] = C(t), [l, d] = C([]), [a, s] = C(""), [f, b] = C(!1), u = S(/* @__PURE__ */ new Set()), c = S([]), I = S(f);
|
|
3244
|
+
I.current = f, M(() => {
|
|
3190
3245
|
try {
|
|
3191
|
-
const
|
|
3192
|
-
|
|
3246
|
+
const v = localStorage.getItem(r);
|
|
3247
|
+
v === "1" && i(!0), v === "0" && i(!1);
|
|
3193
3248
|
} catch {
|
|
3194
3249
|
}
|
|
3195
|
-
}, [r]),
|
|
3250
|
+
}, [r]), M(() => {
|
|
3196
3251
|
try {
|
|
3197
|
-
localStorage.setItem(r,
|
|
3252
|
+
localStorage.setItem(r, o ? "1" : "0");
|
|
3198
3253
|
} catch {
|
|
3199
3254
|
}
|
|
3200
|
-
}, [
|
|
3201
|
-
const
|
|
3202
|
-
(m.metaKey || m.ctrlKey) && m.shiftKey && m.key.toLowerCase() === "l" && (m.preventDefault(),
|
|
3255
|
+
}, [o, r]), M(() => {
|
|
3256
|
+
const v = (m) => {
|
|
3257
|
+
(m.metaKey || m.ctrlKey) && m.shiftKey && m.key.toLowerCase() === "l" && (m.preventDefault(), i((N) => !N));
|
|
3203
3258
|
};
|
|
3204
|
-
return window.addEventListener("keydown",
|
|
3205
|
-
}, []),
|
|
3206
|
-
const
|
|
3259
|
+
return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
|
|
3260
|
+
}, []), M(() => {
|
|
3261
|
+
const v = setInterval(() => {
|
|
3207
3262
|
if (c.current.length === 0 || I.current) return;
|
|
3208
3263
|
const m = c.current.splice(0, c.current.length);
|
|
3209
|
-
|
|
3210
|
-
(
|
|
3264
|
+
d(
|
|
3265
|
+
(N) => [...m.reverse(), ...N].slice(0, 200)
|
|
3211
3266
|
);
|
|
3212
3267
|
}, 100);
|
|
3213
|
-
return () => clearInterval(
|
|
3268
|
+
return () => clearInterval(v);
|
|
3214
3269
|
}, []);
|
|
3215
|
-
const
|
|
3216
|
-
if (
|
|
3217
|
-
!e ||
|
|
3270
|
+
const k = S(!1);
|
|
3271
|
+
if (M(() => {
|
|
3272
|
+
!e || k.current || (k.current = !0, e((v) => {
|
|
3218
3273
|
c.current.push({
|
|
3219
|
-
id:
|
|
3274
|
+
id: pn++,
|
|
3220
3275
|
ts: Date.now(),
|
|
3221
3276
|
kind: "event",
|
|
3222
|
-
type:
|
|
3223
|
-
data:
|
|
3277
|
+
type: v.eventName,
|
|
3278
|
+
data: v.data
|
|
3224
3279
|
});
|
|
3225
3280
|
}));
|
|
3226
|
-
}, [e]),
|
|
3227
|
-
const
|
|
3281
|
+
}, [e]), M(() => {
|
|
3282
|
+
const v = console.warn, m = console.log, N = ($, D) => function(...x) {
|
|
3228
3283
|
try {
|
|
3229
3284
|
const R = typeof x[0] == "string" ? x[0] : "";
|
|
3230
3285
|
R.startsWith("[LiveLayer]") && c.current.push({
|
|
3231
|
-
id:
|
|
3286
|
+
id: pn++,
|
|
3232
3287
|
ts: Date.now(),
|
|
3233
3288
|
kind: $,
|
|
3234
3289
|
type: R.slice(0, 120),
|
|
3235
|
-
data: { args: x.slice(1).map((B) =>
|
|
3290
|
+
data: { args: x.slice(1).map((B) => io(B)) }
|
|
3236
3291
|
});
|
|
3237
3292
|
} catch {
|
|
3238
3293
|
}
|
|
3239
3294
|
return D.apply(this, x);
|
|
3240
3295
|
};
|
|
3241
|
-
return console.warn =
|
|
3242
|
-
console.warn =
|
|
3296
|
+
return console.warn = N("warn", v), console.log = N("log", m), () => {
|
|
3297
|
+
console.warn = v, console.log = m;
|
|
3243
3298
|
};
|
|
3244
|
-
}, []), !
|
|
3299
|
+
}, []), !o)
|
|
3245
3300
|
return /* @__PURE__ */ n(
|
|
3246
3301
|
"button",
|
|
3247
3302
|
{
|
|
3248
3303
|
type: "button",
|
|
3249
|
-
onClick: () =>
|
|
3304
|
+
onClick: () => i(!0),
|
|
3250
3305
|
title: "Open LiveLayer debug panel (Cmd/Ctrl + Shift + L)",
|
|
3251
3306
|
"aria-label": "Open LiveLayer debug panel",
|
|
3252
3307
|
style: {
|
|
@@ -3268,12 +3323,12 @@ function fi({
|
|
|
3268
3323
|
children: "🛰 LL debug"
|
|
3269
3324
|
}
|
|
3270
3325
|
);
|
|
3271
|
-
const
|
|
3326
|
+
const w = l.filter((v) => {
|
|
3272
3327
|
if (!a) return !0;
|
|
3273
3328
|
const m = a.toLowerCase();
|
|
3274
|
-
return
|
|
3329
|
+
return v.type.toLowerCase().includes(m) || JSON.stringify(v.data || {}).toLowerCase().includes(m);
|
|
3275
3330
|
});
|
|
3276
|
-
return /* @__PURE__ */
|
|
3331
|
+
return /* @__PURE__ */ y(
|
|
3277
3332
|
"div",
|
|
3278
3333
|
{
|
|
3279
3334
|
style: {
|
|
@@ -3295,7 +3350,7 @@ function fi({
|
|
|
3295
3350
|
overflow: "hidden"
|
|
3296
3351
|
},
|
|
3297
3352
|
children: [
|
|
3298
|
-
/* @__PURE__ */
|
|
3353
|
+
/* @__PURE__ */ y(
|
|
3299
3354
|
"div",
|
|
3300
3355
|
{
|
|
3301
3356
|
style: {
|
|
@@ -3308,7 +3363,7 @@ function fi({
|
|
|
3308
3363
|
},
|
|
3309
3364
|
children: [
|
|
3310
3365
|
/* @__PURE__ */ n("span", { style: { fontWeight: 600, fontSize: 12 }, children: "LiveLayer debug" }),
|
|
3311
|
-
/* @__PURE__ */
|
|
3366
|
+
/* @__PURE__ */ y("span", { style: { fontSize: 10, color: "rgba(255,255,255,0.4)" }, children: [
|
|
3312
3367
|
l.length,
|
|
3313
3368
|
" event",
|
|
3314
3369
|
l.length === 1 ? "" : "s"
|
|
@@ -3318,8 +3373,8 @@ function fi({
|
|
|
3318
3373
|
"button",
|
|
3319
3374
|
{
|
|
3320
3375
|
type: "button",
|
|
3321
|
-
onClick: () =>
|
|
3322
|
-
style:
|
|
3376
|
+
onClick: () => b((v) => !v),
|
|
3377
|
+
style: At(f ? "#f59e0b" : "transparent"),
|
|
3323
3378
|
title: "Pause / resume capture",
|
|
3324
3379
|
children: f ? "▶ resume" : "⏸ pause"
|
|
3325
3380
|
}
|
|
@@ -3329,9 +3384,9 @@ function fi({
|
|
|
3329
3384
|
{
|
|
3330
3385
|
type: "button",
|
|
3331
3386
|
onClick: () => {
|
|
3332
|
-
|
|
3387
|
+
d([]), c.current = [];
|
|
3333
3388
|
},
|
|
3334
|
-
style:
|
|
3389
|
+
style: At("transparent"),
|
|
3335
3390
|
title: "Clear buffer",
|
|
3336
3391
|
children: "clear"
|
|
3337
3392
|
}
|
|
@@ -3340,8 +3395,8 @@ function fi({
|
|
|
3340
3395
|
"button",
|
|
3341
3396
|
{
|
|
3342
3397
|
type: "button",
|
|
3343
|
-
onClick: () =>
|
|
3344
|
-
style:
|
|
3398
|
+
onClick: () => i(!1),
|
|
3399
|
+
style: At("transparent"),
|
|
3345
3400
|
"aria-label": "Close",
|
|
3346
3401
|
title: "Close (Cmd/Ctrl + Shift + L)",
|
|
3347
3402
|
children: "✕"
|
|
@@ -3355,7 +3410,7 @@ function fi({
|
|
|
3355
3410
|
{
|
|
3356
3411
|
type: "text",
|
|
3357
3412
|
value: a,
|
|
3358
|
-
onChange: (
|
|
3413
|
+
onChange: (v) => s(v.target.value),
|
|
3359
3414
|
placeholder: "filter by type or data…",
|
|
3360
3415
|
style: {
|
|
3361
3416
|
margin: 8,
|
|
@@ -3377,7 +3432,7 @@ function fi({
|
|
|
3377
3432
|
overflowY: "auto",
|
|
3378
3433
|
padding: "0 8px 8px"
|
|
3379
3434
|
},
|
|
3380
|
-
children:
|
|
3435
|
+
children: w.length === 0 ? /* @__PURE__ */ y(
|
|
3381
3436
|
"div",
|
|
3382
3437
|
{
|
|
3383
3438
|
style: {
|
|
@@ -3407,16 +3462,16 @@ function fi({
|
|
|
3407
3462
|
)
|
|
3408
3463
|
]
|
|
3409
3464
|
}
|
|
3410
|
-
) :
|
|
3411
|
-
|
|
3465
|
+
) : w.map((v) => /* @__PURE__ */ n(
|
|
3466
|
+
oo,
|
|
3412
3467
|
{
|
|
3413
|
-
entry:
|
|
3414
|
-
expanded: u.current.has(
|
|
3468
|
+
entry: v,
|
|
3469
|
+
expanded: u.current.has(v.id),
|
|
3415
3470
|
onToggle: () => {
|
|
3416
|
-
u.current.has(
|
|
3471
|
+
u.current.has(v.id) ? u.current.delete(v.id) : u.current.add(v.id), d((m) => [...m]);
|
|
3417
3472
|
}
|
|
3418
3473
|
},
|
|
3419
|
-
|
|
3474
|
+
v.id
|
|
3420
3475
|
))
|
|
3421
3476
|
}
|
|
3422
3477
|
)
|
|
@@ -3424,15 +3479,15 @@ function fi({
|
|
|
3424
3479
|
}
|
|
3425
3480
|
);
|
|
3426
3481
|
}
|
|
3427
|
-
function
|
|
3482
|
+
function oo({
|
|
3428
3483
|
entry: e,
|
|
3429
3484
|
expanded: t,
|
|
3430
3485
|
onToggle: r
|
|
3431
3486
|
}) {
|
|
3432
|
-
const
|
|
3487
|
+
const o = e.kind === "warn" ? "#f59e0b" : e.type.startsWith("[LiveLayer]") ? "#94a3b8" : e.type === "navigate" || e.type === "scroll_page" || e.type === "scroll_to" || e.type === "click" ? "#22c55e" : e.type === "fill_form" || e.type === "submit_form" || e.type === "focus_field" ? "#a78bfa" : e.type === "request_page_context" || e.type === "request_routes" ? "#38bdf8" : e.type === "agent_state" ? "#facc15" : "#cbd5e1", i = new Date(e.ts).toLocaleTimeString("en-US", {
|
|
3433
3488
|
hour12: !1
|
|
3434
3489
|
});
|
|
3435
|
-
return /* @__PURE__ */
|
|
3490
|
+
return /* @__PURE__ */ y(
|
|
3436
3491
|
"button",
|
|
3437
3492
|
{
|
|
3438
3493
|
type: "button",
|
|
@@ -3450,7 +3505,7 @@ function ei({
|
|
|
3450
3505
|
lineHeight: 1.4
|
|
3451
3506
|
},
|
|
3452
3507
|
children: [
|
|
3453
|
-
/* @__PURE__ */
|
|
3508
|
+
/* @__PURE__ */ y("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
3454
3509
|
/* @__PURE__ */ n(
|
|
3455
3510
|
"span",
|
|
3456
3511
|
{
|
|
@@ -3459,14 +3514,14 @@ function ei({
|
|
|
3459
3514
|
fontVariantNumeric: "tabular-nums",
|
|
3460
3515
|
fontSize: 10
|
|
3461
3516
|
},
|
|
3462
|
-
children:
|
|
3517
|
+
children: i
|
|
3463
3518
|
}
|
|
3464
3519
|
),
|
|
3465
3520
|
/* @__PURE__ */ n(
|
|
3466
3521
|
"span",
|
|
3467
3522
|
{
|
|
3468
3523
|
style: {
|
|
3469
|
-
color:
|
|
3524
|
+
color: o,
|
|
3470
3525
|
fontWeight: 600,
|
|
3471
3526
|
flexShrink: 0
|
|
3472
3527
|
},
|
|
@@ -3494,7 +3549,7 @@ function ei({
|
|
|
3494
3549
|
}
|
|
3495
3550
|
);
|
|
3496
3551
|
}
|
|
3497
|
-
function
|
|
3552
|
+
function At(e) {
|
|
3498
3553
|
return {
|
|
3499
3554
|
background: e,
|
|
3500
3555
|
color: "#fff",
|
|
@@ -3505,59 +3560,59 @@ function Nt(e) {
|
|
|
3505
3560
|
cursor: "pointer"
|
|
3506
3561
|
};
|
|
3507
3562
|
}
|
|
3508
|
-
function
|
|
3563
|
+
function io(e) {
|
|
3509
3564
|
try {
|
|
3510
3565
|
return e instanceof Error ? { message: e.message, stack: e.stack } : (JSON.stringify(e), e);
|
|
3511
3566
|
} catch {
|
|
3512
3567
|
return String(e);
|
|
3513
3568
|
}
|
|
3514
3569
|
}
|
|
3515
|
-
function
|
|
3516
|
-
const [e, t] = C([]), r = E((
|
|
3570
|
+
function bo() {
|
|
3571
|
+
const [e, t] = C([]), r = E((i) => {
|
|
3517
3572
|
t((l) => {
|
|
3518
|
-
const
|
|
3519
|
-
if (
|
|
3573
|
+
const d = l.findIndex((a) => a.id === i.id);
|
|
3574
|
+
if (d >= 0) {
|
|
3520
3575
|
const a = l.slice();
|
|
3521
|
-
return a[
|
|
3576
|
+
return a[d] = i, a;
|
|
3522
3577
|
}
|
|
3523
|
-
return [...l,
|
|
3578
|
+
return [...l, i];
|
|
3524
3579
|
});
|
|
3525
|
-
}, []),
|
|
3580
|
+
}, []), o = E(() => t([]), []);
|
|
3526
3581
|
return {
|
|
3527
3582
|
entries: e,
|
|
3528
3583
|
pushSegment: r,
|
|
3529
|
-
clear:
|
|
3584
|
+
clear: o,
|
|
3530
3585
|
latest: e.length > 0 ? e[e.length - 1] : null
|
|
3531
3586
|
};
|
|
3532
3587
|
}
|
|
3533
3588
|
export {
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3589
|
+
ro as AvatarWidget,
|
|
3590
|
+
Fn as ErrorBoundary,
|
|
3591
|
+
vo as LiveLayerDebugPanel,
|
|
3592
|
+
yo as LiveLayerField,
|
|
3593
|
+
go as LiveLayerForm,
|
|
3594
|
+
mo as LiveLayerRegion,
|
|
3595
|
+
ho as LiveLayerWidget,
|
|
3596
|
+
qr as clearPageContextCache,
|
|
3597
|
+
Gr as clearRoutesCache,
|
|
3598
|
+
Br as extractPageContext,
|
|
3599
|
+
Vr as extractRoutes,
|
|
3600
|
+
un as getCachedPageContext,
|
|
3601
|
+
Nt as getCachedRoutes,
|
|
3602
|
+
fr as matchesPattern,
|
|
3603
|
+
Ur as normalizeRouteInput,
|
|
3604
|
+
pr as shouldRenderAtPath,
|
|
3605
|
+
Xn as useAgentInfo,
|
|
3606
|
+
jn as useAudioLevel,
|
|
3607
|
+
Gn as useCameraState,
|
|
3608
|
+
er as useDisplayMode,
|
|
3609
|
+
rr as useDisplayModePersistence,
|
|
3610
|
+
ir as useIsMobile,
|
|
3611
|
+
Un as useLiveKitSession,
|
|
3612
|
+
Kn as useMediaDevices,
|
|
3613
|
+
Vn as useMicrophoneState,
|
|
3614
|
+
ar as usePathname,
|
|
3615
|
+
hr as useRouteMatch,
|
|
3616
|
+
Jn as useScreenShareState,
|
|
3617
|
+
bo as useTranscript
|
|
3563
3618
|
};
|