@livelayer/react 0.2.6 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +346 -26
- package/dist/index.d.ts +256 -0
- package/dist/index.js +2 -1
- package/dist/index.mjs +1834 -1040
- package/dist/styles.css +31 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { Component as
|
|
4
|
-
import { LiveKitSession as
|
|
5
|
-
import { createLocalAudioTrack as
|
|
6
|
-
class
|
|
2
|
+
import { jsxs as L, jsx as n, Fragment as $t } from "react/jsx-runtime";
|
|
3
|
+
import { Component as Zt, useState as S, useRef as R, useEffect as I, useCallback as _, useMemo as je, forwardRef as rt, createElement as en } from "react";
|
|
4
|
+
import { LiveKitSession as tn } from "@livelayer/sdk";
|
|
5
|
+
import { createLocalAudioTrack as nn, Track as zt, createLocalVideoTrack as rn } from "livekit-client";
|
|
6
|
+
class on extends Zt {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments), this.state = { hasError: !1, error: null }, this.reset = () => {
|
|
9
9
|
this.setState({ hasError: !1, error: null });
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
static getDerivedStateFromError(
|
|
13
|
-
return { hasError: !0, error:
|
|
12
|
+
static getDerivedStateFromError(t) {
|
|
13
|
+
return { hasError: !0, error: t };
|
|
14
14
|
}
|
|
15
|
-
componentDidCatch(
|
|
16
|
-
var
|
|
17
|
-
(
|
|
15
|
+
componentDidCatch(t, r) {
|
|
16
|
+
var i, o;
|
|
17
|
+
(o = (i = this.props).onError) == null || o.call(i, t, r);
|
|
18
18
|
}
|
|
19
19
|
render() {
|
|
20
|
-
var
|
|
21
|
-
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */
|
|
22
|
-
/* @__PURE__ */
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
-
/* @__PURE__ */
|
|
20
|
+
var t;
|
|
21
|
+
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ L("div", { className: "ll-error-boundary", role: "alert", children: [
|
|
22
|
+
/* @__PURE__ */ n("p", { className: "ll-error-boundary__title", children: "Widget crashed" }),
|
|
23
|
+
/* @__PURE__ */ n("p", { className: "ll-error-boundary__message", children: ((t = this.state.error) == null ? void 0 : t.message) || "Something went wrong." }),
|
|
24
|
+
/* @__PURE__ */ n(
|
|
25
25
|
"button",
|
|
26
26
|
{
|
|
27
27
|
type: "button",
|
|
@@ -33,282 +33,282 @@ class it extends et {
|
|
|
33
33
|
] }) : this.props.children;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const [
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
onConnectionStateChange: (
|
|
41
|
-
|
|
36
|
+
function ln(e) {
|
|
37
|
+
const [t, r] = S("idle"), [i, o] = S("idle"), [l, s] = S([]), [d, u] = S(null), [g, p] = S(null), [a, c] = S(null), [N, E] = S(!1), [A, z] = S(null), T = R(null), $ = R(e.onDataMessage);
|
|
38
|
+
$.current = e.onDataMessage, I(() => {
|
|
39
|
+
const y = {
|
|
40
|
+
onConnectionStateChange: (w) => {
|
|
41
|
+
r(w), w === "connected" && z(null);
|
|
42
42
|
},
|
|
43
|
-
onAgentStateChange:
|
|
44
|
-
onTranscript: (
|
|
45
|
-
onAgentConfig:
|
|
46
|
-
onAudioTrack: (
|
|
47
|
-
onVideoTrack: (
|
|
43
|
+
onAgentStateChange: o,
|
|
44
|
+
onTranscript: (w) => s([...w]),
|
|
45
|
+
onAgentConfig: u,
|
|
46
|
+
onAudioTrack: (w) => c(w),
|
|
47
|
+
onVideoTrack: (w) => p(w),
|
|
48
48
|
onVideoTrackRemoved: () => p(null),
|
|
49
|
-
onError: (
|
|
50
|
-
onDataMessage: (
|
|
51
|
-
var
|
|
52
|
-
(
|
|
49
|
+
onError: (w) => z(w),
|
|
50
|
+
onDataMessage: (w) => {
|
|
51
|
+
var H;
|
|
52
|
+
(H = $.current) == null || H.call($, w);
|
|
53
53
|
},
|
|
54
|
-
onResumabilityChange:
|
|
55
|
-
},
|
|
54
|
+
onResumabilityChange: E
|
|
55
|
+
}, C = new tn(
|
|
56
56
|
{
|
|
57
|
-
agentId:
|
|
58
|
-
baseUrl:
|
|
59
|
-
apiKey:
|
|
60
|
-
sessionEndpoint:
|
|
61
|
-
sessionBody:
|
|
57
|
+
agentId: e.agentId,
|
|
58
|
+
baseUrl: e.baseUrl,
|
|
59
|
+
apiKey: e.apiKey,
|
|
60
|
+
sessionEndpoint: e.sessionEndpoint,
|
|
61
|
+
sessionBody: e.sessionBody
|
|
62
62
|
},
|
|
63
|
-
|
|
63
|
+
y
|
|
64
64
|
);
|
|
65
|
-
return
|
|
66
|
-
var
|
|
67
|
-
(
|
|
65
|
+
return T.current = C, r("idle"), o("idle"), s([]), u(null), p(null), c(null), E(!1), z(null), () => {
|
|
66
|
+
var w;
|
|
67
|
+
(w = C.destroy) == null || w.call(C), T.current = null;
|
|
68
68
|
};
|
|
69
69
|
}, [
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
JSON.stringify(
|
|
70
|
+
e.agentId,
|
|
71
|
+
e.baseUrl,
|
|
72
|
+
e.apiKey,
|
|
73
|
+
e.sessionEndpoint,
|
|
74
|
+
JSON.stringify(e.sessionBody ?? {})
|
|
75
75
|
]);
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
76
|
+
const M = _(async () => {
|
|
77
|
+
const y = T.current;
|
|
78
|
+
if (y)
|
|
79
79
|
try {
|
|
80
|
-
await
|
|
81
|
-
} catch (
|
|
82
|
-
throw
|
|
80
|
+
await y.connect();
|
|
81
|
+
} catch (C) {
|
|
82
|
+
throw z(C instanceof Error ? C.message : String(C)), C;
|
|
83
83
|
}
|
|
84
|
-
}, []),
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
}, []),
|
|
88
|
-
var
|
|
89
|
-
return ((
|
|
84
|
+
}, []), D = _(() => {
|
|
85
|
+
const y = T.current;
|
|
86
|
+
y && y.disconnect();
|
|
87
|
+
}, []), m = _(() => {
|
|
88
|
+
var y;
|
|
89
|
+
return ((y = T.current) == null ? void 0 : y.getRoom()) ?? null;
|
|
90
90
|
}, []);
|
|
91
91
|
return {
|
|
92
|
-
connectionState:
|
|
93
|
-
agentState:
|
|
94
|
-
transcript:
|
|
95
|
-
agentConfig:
|
|
96
|
-
videoElement:
|
|
97
|
-
audioElement:
|
|
98
|
-
canResume:
|
|
99
|
-
error:
|
|
100
|
-
connect:
|
|
101
|
-
disconnect:
|
|
102
|
-
getRoom:
|
|
103
|
-
session:
|
|
92
|
+
connectionState: t,
|
|
93
|
+
agentState: i,
|
|
94
|
+
transcript: l,
|
|
95
|
+
agentConfig: d,
|
|
96
|
+
videoElement: g,
|
|
97
|
+
audioElement: a,
|
|
98
|
+
canResume: N,
|
|
99
|
+
error: A,
|
|
100
|
+
connect: M,
|
|
101
|
+
disconnect: D,
|
|
102
|
+
getRoom: m,
|
|
103
|
+
session: T.current
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
if (!
|
|
110
|
-
|
|
106
|
+
function an() {
|
|
107
|
+
const e = R(null), t = R(null), r = R(null), i = R(null), o = R(/* @__PURE__ */ new Set()), l = R(null), s = _(() => {
|
|
108
|
+
const a = t.current;
|
|
109
|
+
if (!a) {
|
|
110
|
+
i.current = null;
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
|
-
(!
|
|
114
|
-
new ArrayBuffer(
|
|
113
|
+
(!l.current || l.current.length !== a.frequencyBinCount) && (l.current = new Uint8Array(
|
|
114
|
+
new ArrayBuffer(a.frequencyBinCount)
|
|
115
115
|
));
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
let
|
|
119
|
-
for (let
|
|
120
|
-
const
|
|
121
|
-
for (const
|
|
116
|
+
const c = l.current;
|
|
117
|
+
a.getByteFrequencyData(c);
|
|
118
|
+
let N = 0;
|
|
119
|
+
for (let A = 0; A < c.length; A++) N += c[A];
|
|
120
|
+
const E = N / c.length / 255;
|
|
121
|
+
for (const A of o.current)
|
|
122
122
|
try {
|
|
123
|
-
|
|
124
|
-
} catch (
|
|
125
|
-
console.error("[useAudioLevel] subscriber threw:",
|
|
123
|
+
A(E);
|
|
124
|
+
} catch (z) {
|
|
125
|
+
console.error("[useAudioLevel] subscriber threw:", z);
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
}, []),
|
|
129
|
-
if (
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
}, []),
|
|
133
|
-
(
|
|
134
|
-
if (
|
|
135
|
-
if (
|
|
127
|
+
i.current = requestAnimationFrame(s);
|
|
128
|
+
}, []), d = _(() => {
|
|
129
|
+
if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
|
|
130
|
+
const a = new AudioContext(), c = a.createAnalyser();
|
|
131
|
+
c.fftSize = 64, c.connect(a.destination), e.current = a, t.current = c;
|
|
132
|
+
}, []), u = _(
|
|
133
|
+
(a) => {
|
|
134
|
+
if (d(), !(!e.current || !t.current)) {
|
|
135
|
+
if (r.current) {
|
|
136
136
|
try {
|
|
137
|
-
|
|
137
|
+
r.current.disconnect();
|
|
138
138
|
} catch {
|
|
139
139
|
}
|
|
140
|
-
|
|
140
|
+
r.current = null;
|
|
141
141
|
}
|
|
142
142
|
try {
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
} catch (
|
|
146
|
-
console.warn("[useAudioLevel] createMediaElementSource failed:",
|
|
143
|
+
const c = e.current.createMediaElementSource(a);
|
|
144
|
+
c.connect(t.current), r.current = c;
|
|
145
|
+
} catch (c) {
|
|
146
|
+
console.warn("[useAudioLevel] createMediaElementSource failed:", c);
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
|
-
|
|
149
|
+
i.current === null && (i.current = requestAnimationFrame(s));
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
|
-
[
|
|
153
|
-
),
|
|
154
|
-
if (
|
|
152
|
+
[d, s]
|
|
153
|
+
), g = _(() => {
|
|
154
|
+
if (i.current !== null && (cancelAnimationFrame(i.current), i.current = null), r.current) {
|
|
155
155
|
try {
|
|
156
|
-
|
|
156
|
+
r.current.disconnect();
|
|
157
157
|
} catch {
|
|
158
158
|
}
|
|
159
|
-
|
|
159
|
+
r.current = null;
|
|
160
160
|
}
|
|
161
|
-
}, []), p =
|
|
162
|
-
|
|
161
|
+
}, []), p = _((a) => (o.current.add(a), () => {
|
|
162
|
+
o.current.delete(a);
|
|
163
163
|
}), []);
|
|
164
|
-
return
|
|
165
|
-
if (
|
|
164
|
+
return I(() => () => {
|
|
165
|
+
if (g(), t.current) {
|
|
166
166
|
try {
|
|
167
|
-
|
|
167
|
+
t.current.disconnect();
|
|
168
168
|
} catch {
|
|
169
169
|
}
|
|
170
|
-
|
|
170
|
+
t.current = null;
|
|
171
171
|
}
|
|
172
|
-
if (
|
|
172
|
+
if (e.current) {
|
|
173
173
|
try {
|
|
174
|
-
|
|
174
|
+
e.current.close();
|
|
175
175
|
} catch {
|
|
176
176
|
}
|
|
177
|
-
|
|
177
|
+
e.current = null;
|
|
178
178
|
}
|
|
179
|
-
|
|
180
|
-
}, [
|
|
179
|
+
o.current.clear(), l.current = null;
|
|
180
|
+
}, [g]), { attach: u, detach: g, subscribe: p };
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
const [
|
|
184
|
-
if (
|
|
182
|
+
function cn() {
|
|
183
|
+
const [e, t] = S(!1), [r, i] = S(null), o = R(null), l = R(null), s = _(async (p) => {
|
|
184
|
+
if (o.current && l.current) {
|
|
185
185
|
try {
|
|
186
|
-
await
|
|
186
|
+
await l.current.localParticipant.unpublishTrack(o.current);
|
|
187
187
|
} catch {
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
o.current.stop(), o.current = null;
|
|
190
190
|
}
|
|
191
|
-
|
|
191
|
+
l.current = p, i(null);
|
|
192
192
|
try {
|
|
193
|
-
const
|
|
193
|
+
const a = await nn({
|
|
194
194
|
echoCancellation: !0,
|
|
195
195
|
noiseSuppression: !0
|
|
196
196
|
});
|
|
197
|
-
await p.localParticipant.publishTrack(
|
|
198
|
-
} catch (
|
|
199
|
-
const
|
|
200
|
-
throw
|
|
197
|
+
await p.localParticipant.publishTrack(a), o.current = a, t(a.isMuted);
|
|
198
|
+
} catch (a) {
|
|
199
|
+
const c = a instanceof Error && a.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
|
|
200
|
+
throw i(c), a;
|
|
201
201
|
}
|
|
202
|
-
}, []),
|
|
203
|
-
const p =
|
|
204
|
-
p && (p.isMuted ? (p.unmute(),
|
|
205
|
-
}, []),
|
|
206
|
-
const p =
|
|
207
|
-
if (p &&
|
|
202
|
+
}, []), d = _(() => {
|
|
203
|
+
const p = o.current;
|
|
204
|
+
p && (p.isMuted ? (p.unmute(), t(!1)) : (p.mute(), t(!0)));
|
|
205
|
+
}, []), u = _(() => {
|
|
206
|
+
const p = o.current, a = l.current;
|
|
207
|
+
if (p && a) {
|
|
208
208
|
try {
|
|
209
|
-
|
|
209
|
+
a.localParticipant.unpublishTrack(p);
|
|
210
210
|
} catch {
|
|
211
211
|
}
|
|
212
212
|
p.stop();
|
|
213
213
|
}
|
|
214
|
-
|
|
215
|
-
}, []),
|
|
214
|
+
o.current = null, l.current = null, t(!1);
|
|
215
|
+
}, []), g = _(() => i(null), []);
|
|
216
216
|
return {
|
|
217
|
-
isMuted:
|
|
218
|
-
micError:
|
|
219
|
-
toggleMute:
|
|
220
|
-
setupMic:
|
|
221
|
-
teardownMic:
|
|
222
|
-
clearError:
|
|
217
|
+
isMuted: e,
|
|
218
|
+
micError: r,
|
|
219
|
+
toggleMute: d,
|
|
220
|
+
setupMic: s,
|
|
221
|
+
teardownMic: u,
|
|
222
|
+
clearError: g
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
|
-
const
|
|
226
|
-
function
|
|
227
|
-
const [
|
|
228
|
-
|
|
229
|
-
}, []),
|
|
230
|
-
const
|
|
231
|
-
if (
|
|
232
|
-
const
|
|
233
|
-
if (
|
|
225
|
+
const sn = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
226
|
+
function dn() {
|
|
227
|
+
const [e, t] = S(!1), [r, i] = S(null), [o, l] = S(null), [s, d] = S(""), u = R(null), g = R(null), p = _((T) => {
|
|
228
|
+
u.current = T;
|
|
229
|
+
}, []), a = _(() => {
|
|
230
|
+
const T = u.current, $ = g.current;
|
|
231
|
+
if ($ && T) {
|
|
232
|
+
const M = T.localParticipant.getTrackPublication(zt.Source.Camera);
|
|
233
|
+
if (M != null && M.track) {
|
|
234
234
|
try {
|
|
235
|
-
|
|
235
|
+
T.localParticipant.unpublishTrack(M.track);
|
|
236
236
|
} catch {
|
|
237
237
|
}
|
|
238
|
-
|
|
238
|
+
M.track.stop();
|
|
239
239
|
} else
|
|
240
|
-
|
|
240
|
+
$.stop();
|
|
241
241
|
}
|
|
242
|
-
|
|
243
|
-
}, []),
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
-
|
|
242
|
+
g.current = null, l(null), t(!1);
|
|
243
|
+
}, []), c = _(async (T) => {
|
|
244
|
+
const $ = u.current;
|
|
245
|
+
if ($) {
|
|
246
|
+
i(null);
|
|
247
247
|
try {
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
const
|
|
251
|
-
await
|
|
252
|
-
const
|
|
253
|
-
|
|
248
|
+
const M = { ...sn };
|
|
249
|
+
T && (M.deviceId = T);
|
|
250
|
+
const D = await rn(M);
|
|
251
|
+
await $.localParticipant.publishTrack(D), g.current = D;
|
|
252
|
+
const m = D.attach();
|
|
253
|
+
l(m), t(!0), T && d(T);
|
|
254
254
|
try {
|
|
255
|
-
|
|
255
|
+
$.localParticipant.publishData(
|
|
256
256
|
new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
|
|
257
257
|
{ reliable: !0 }
|
|
258
258
|
);
|
|
259
259
|
} catch {
|
|
260
260
|
}
|
|
261
|
-
} catch (
|
|
262
|
-
const
|
|
263
|
-
|
|
261
|
+
} catch (M) {
|
|
262
|
+
const D = M instanceof Error && M.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
|
|
263
|
+
i(D);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
-
}, []),
|
|
267
|
-
|
|
268
|
-
}, [
|
|
269
|
-
|
|
270
|
-
}, [
|
|
271
|
-
|
|
272
|
-
}, [
|
|
273
|
-
return
|
|
274
|
-
|
|
266
|
+
}, []), N = _(async () => {
|
|
267
|
+
e ? a() : await c(s || void 0);
|
|
268
|
+
}, [e, s, a, c]), E = _(async (T) => {
|
|
269
|
+
a(), await c(T);
|
|
270
|
+
}, [a, c]), A = _(() => {
|
|
271
|
+
a(), u.current = null, i(null), d("");
|
|
272
|
+
}, [a]), z = _(() => i(null), []);
|
|
273
|
+
return I(() => () => {
|
|
274
|
+
g.current && g.current.stop();
|
|
275
275
|
}, []), {
|
|
276
|
-
isEnabled:
|
|
277
|
-
error:
|
|
278
|
-
previewEl:
|
|
279
|
-
activeDeviceId:
|
|
280
|
-
toggle:
|
|
281
|
-
switchDevice:
|
|
276
|
+
isEnabled: e,
|
|
277
|
+
error: r,
|
|
278
|
+
previewEl: o,
|
|
279
|
+
activeDeviceId: s,
|
|
280
|
+
toggle: N,
|
|
281
|
+
switchDevice: E,
|
|
282
282
|
attachRoom: p,
|
|
283
|
-
teardown:
|
|
284
|
-
clearError:
|
|
283
|
+
teardown: A,
|
|
284
|
+
clearError: z
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
|
-
function
|
|
288
|
-
const [
|
|
289
|
-
|
|
290
|
-
}, []),
|
|
291
|
-
const
|
|
292
|
-
if (
|
|
293
|
-
if (
|
|
287
|
+
function un() {
|
|
288
|
+
const [e, t] = S(!1), [r, i] = S(null), [o, l] = S(null), s = R(null), d = _((c) => {
|
|
289
|
+
s.current = c;
|
|
290
|
+
}, []), u = _(() => l(null), []), g = _(async () => {
|
|
291
|
+
const c = s.current;
|
|
292
|
+
if (c) {
|
|
293
|
+
if (e) {
|
|
294
294
|
try {
|
|
295
|
-
await
|
|
295
|
+
await c.localParticipant.setScreenShareEnabled(!1);
|
|
296
296
|
} catch {
|
|
297
297
|
}
|
|
298
|
-
|
|
298
|
+
u(), t(!1);
|
|
299
299
|
return;
|
|
300
300
|
}
|
|
301
|
-
|
|
301
|
+
i(null);
|
|
302
302
|
try {
|
|
303
|
-
await
|
|
304
|
-
let
|
|
305
|
-
const
|
|
306
|
-
const
|
|
307
|
-
if (
|
|
308
|
-
const
|
|
309
|
-
|
|
303
|
+
await c.localParticipant.setScreenShareEnabled(!0);
|
|
304
|
+
let N = 0;
|
|
305
|
+
const E = () => {
|
|
306
|
+
const A = c.localParticipant.getTrackPublication(zt.Source.ScreenShare);
|
|
307
|
+
if (A != null && A.track) {
|
|
308
|
+
const z = A.track.attach();
|
|
309
|
+
l(z), t(!0);
|
|
310
310
|
try {
|
|
311
|
-
|
|
311
|
+
c.localParticipant.publishData(
|
|
312
312
|
new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
|
|
313
313
|
{ reliable: !0 }
|
|
314
314
|
);
|
|
@@ -316,142 +316,202 @@ function dt() {
|
|
|
316
316
|
}
|
|
317
317
|
return;
|
|
318
318
|
}
|
|
319
|
-
|
|
319
|
+
N++ < 10 ? setTimeout(E, 100) : t(!0);
|
|
320
320
|
};
|
|
321
|
-
|
|
322
|
-
} catch (
|
|
323
|
-
const
|
|
324
|
-
|
|
321
|
+
E();
|
|
322
|
+
} catch (N) {
|
|
323
|
+
const E = N instanceof Error ? N.name : "";
|
|
324
|
+
E !== "NotAllowedError" && E !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
|
-
}, [
|
|
328
|
-
const
|
|
329
|
-
if (
|
|
327
|
+
}, [e, u]), p = _(() => {
|
|
328
|
+
const c = s.current;
|
|
329
|
+
if (c && e)
|
|
330
330
|
try {
|
|
331
|
-
|
|
331
|
+
c.localParticipant.setScreenShareEnabled(!1);
|
|
332
332
|
} catch {
|
|
333
333
|
}
|
|
334
|
-
|
|
335
|
-
}, [
|
|
336
|
-
return { isEnabled:
|
|
334
|
+
u(), t(!1), i(null), s.current = null;
|
|
335
|
+
}, [e, u]), a = _(() => i(null), []);
|
|
336
|
+
return { isEnabled: e, error: r, previewEl: o, toggle: g, attachRoom: d, teardown: p, clearError: a };
|
|
337
337
|
}
|
|
338
|
-
function
|
|
339
|
-
const [
|
|
338
|
+
function fn() {
|
|
339
|
+
const [e, t] = S([]), [r, i] = S([]), o = _(async () => {
|
|
340
340
|
if (!(typeof navigator > "u" || !navigator.mediaDevices))
|
|
341
341
|
try {
|
|
342
|
-
const
|
|
343
|
-
|
|
342
|
+
const l = await navigator.mediaDevices.enumerateDevices();
|
|
343
|
+
t(l.filter((s) => s.kind === "audioinput")), i(l.filter((s) => s.kind === "videoinput"));
|
|
344
344
|
} catch {
|
|
345
345
|
}
|
|
346
346
|
}, []);
|
|
347
|
-
return
|
|
348
|
-
if (
|
|
349
|
-
const
|
|
350
|
-
return navigator.mediaDevices.addEventListener("devicechange",
|
|
351
|
-
}, [
|
|
347
|
+
return I(() => {
|
|
348
|
+
if (o(), typeof navigator > "u" || !navigator.mediaDevices) return;
|
|
349
|
+
const l = () => void o();
|
|
350
|
+
return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
|
|
351
|
+
}, [o]), { mics: e, cameras: r, refresh: o };
|
|
352
352
|
}
|
|
353
|
-
function
|
|
354
|
-
const [
|
|
355
|
-
return
|
|
356
|
-
if (
|
|
357
|
-
|
|
353
|
+
function pn(e, t, r = !1) {
|
|
354
|
+
const [i, o] = S(null), [l, s] = S(null), [d, u] = S(!r && !!e);
|
|
355
|
+
return I(() => {
|
|
356
|
+
if (r || !e) {
|
|
357
|
+
u(!1);
|
|
358
358
|
return;
|
|
359
359
|
}
|
|
360
|
-
const
|
|
361
|
-
return
|
|
362
|
-
signal:
|
|
363
|
-
}).then(async (
|
|
364
|
-
if (!
|
|
365
|
-
const
|
|
366
|
-
throw new Error(
|
|
360
|
+
const g = new AbortController(), p = t || "https://app.livelayer.studio";
|
|
361
|
+
return u(!0), s(null), fetch(`${p}/api/widget/agent/${encodeURIComponent(e)}`, {
|
|
362
|
+
signal: g.signal
|
|
363
|
+
}).then(async (a) => {
|
|
364
|
+
if (!a.ok) {
|
|
365
|
+
const c = await a.json().catch(() => ({}));
|
|
366
|
+
throw new Error(c.error || `HTTP ${a.status}`);
|
|
367
367
|
}
|
|
368
|
-
return
|
|
369
|
-
}).then((
|
|
370
|
-
|
|
371
|
-
}).catch((
|
|
372
|
-
|
|
373
|
-
}), () =>
|
|
374
|
-
}, [
|
|
368
|
+
return a.json();
|
|
369
|
+
}).then((a) => {
|
|
370
|
+
g.signal.aborted || (o(a), u(!1));
|
|
371
|
+
}).catch((a) => {
|
|
372
|
+
g.signal.aborted || (s(a instanceof Error ? a.message : "Agent lookup failed"), u(!1));
|
|
373
|
+
}), () => g.abort();
|
|
374
|
+
}, [e, t, r]), { info: i, error: l, loading: d };
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function hn(e) {
|
|
377
377
|
if (typeof window > "u") return null;
|
|
378
378
|
try {
|
|
379
|
-
return window.localStorage.getItem(
|
|
379
|
+
return window.localStorage.getItem(e);
|
|
380
380
|
} catch {
|
|
381
381
|
return null;
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
|
-
function
|
|
384
|
+
function mn(e, t) {
|
|
385
385
|
if (!(typeof window > "u"))
|
|
386
386
|
try {
|
|
387
|
-
window.localStorage.setItem(
|
|
387
|
+
window.localStorage.setItem(e, t);
|
|
388
388
|
} catch {
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
-
function
|
|
392
|
-
value:
|
|
393
|
-
defaultValue:
|
|
394
|
-
onChange:
|
|
391
|
+
function gn({
|
|
392
|
+
value: e,
|
|
393
|
+
defaultValue: t = "expanded",
|
|
394
|
+
onChange: r
|
|
395
395
|
} = {}) {
|
|
396
|
-
const
|
|
397
|
-
(
|
|
398
|
-
|
|
396
|
+
const i = e !== void 0, [o, l] = S(t), s = i ? e : o, d = _(
|
|
397
|
+
(u) => {
|
|
398
|
+
u !== s && (i || l(u), r == null || r(u));
|
|
399
399
|
},
|
|
400
|
-
[
|
|
400
|
+
[s, i, r]
|
|
401
401
|
);
|
|
402
|
-
return [
|
|
402
|
+
return [s, d];
|
|
403
403
|
}
|
|
404
|
-
const
|
|
405
|
-
function
|
|
406
|
-
return
|
|
404
|
+
const yn = ["hidden", "minimized", "expanded"];
|
|
405
|
+
function vn(e) {
|
|
406
|
+
return e && yn.includes(e) ? e : null;
|
|
407
407
|
}
|
|
408
|
-
function
|
|
409
|
-
value:
|
|
410
|
-
defaultValue:
|
|
411
|
-
onChange:
|
|
412
|
-
persistKey:
|
|
413
|
-
disablePersistence:
|
|
408
|
+
function bn({
|
|
409
|
+
value: e,
|
|
410
|
+
defaultValue: t = "expanded",
|
|
411
|
+
onChange: r,
|
|
412
|
+
persistKey: i = "ll-widget",
|
|
413
|
+
disablePersistence: o = !1
|
|
414
414
|
} = {}) {
|
|
415
|
-
const
|
|
416
|
-
value:
|
|
417
|
-
defaultValue:
|
|
418
|
-
onChange: (
|
|
419
|
-
|
|
415
|
+
const l = `${i}:display-mode`, s = R(!1), [d, u] = gn({
|
|
416
|
+
value: e,
|
|
417
|
+
defaultValue: t,
|
|
418
|
+
onChange: (g) => {
|
|
419
|
+
e === void 0 && !o && mn(l, g), r == null || r(g);
|
|
420
420
|
}
|
|
421
421
|
});
|
|
422
|
-
return
|
|
423
|
-
if (
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
}, []), [
|
|
422
|
+
return I(() => {
|
|
423
|
+
if (s.current || (s.current = !0, o || e !== void 0)) return;
|
|
424
|
+
const g = vn(hn(l));
|
|
425
|
+
g && g !== d && u(g);
|
|
426
|
+
}, []), [d, u];
|
|
427
427
|
}
|
|
428
|
-
const
|
|
429
|
-
function
|
|
430
|
-
const [
|
|
431
|
-
return
|
|
432
|
-
if (
|
|
433
|
-
|
|
428
|
+
const wn = 640;
|
|
429
|
+
function _n(e = wn) {
|
|
430
|
+
const [t, r] = S(!1);
|
|
431
|
+
return I(() => {
|
|
432
|
+
if (e === !1) {
|
|
433
|
+
r(!1);
|
|
434
434
|
return;
|
|
435
435
|
}
|
|
436
436
|
if (typeof window > "u" || typeof window.matchMedia > "u")
|
|
437
437
|
return;
|
|
438
|
-
const
|
|
439
|
-
return
|
|
440
|
-
|
|
438
|
+
const i = `(max-width: ${e - 1}px)`, o = window.matchMedia(i), l = () => r(o.matches);
|
|
439
|
+
return l(), typeof o.addEventListener == "function" ? (o.addEventListener("change", l), () => o.removeEventListener("change", l)) : (o.addListener(l), () => {
|
|
440
|
+
o.removeListener(l);
|
|
441
441
|
});
|
|
442
|
-
}, [
|
|
442
|
+
}, [e]), t;
|
|
443
|
+
}
|
|
444
|
+
const xt = "__llHistoryPatched", We = "ll:pathname";
|
|
445
|
+
function xn() {
|
|
446
|
+
if (typeof window > "u" || window.history[xt]) return;
|
|
447
|
+
const e = window.history.pushState, t = window.history.replaceState;
|
|
448
|
+
window.history.pushState = function(...r) {
|
|
449
|
+
const i = e.apply(this, r);
|
|
450
|
+
return window.dispatchEvent(new Event(We)), i;
|
|
451
|
+
}, window.history.replaceState = function(...r) {
|
|
452
|
+
const i = t.apply(this, r);
|
|
453
|
+
return window.dispatchEvent(new Event(We)), i;
|
|
454
|
+
}, window.history[xt] = !0;
|
|
455
|
+
}
|
|
456
|
+
function kt() {
|
|
457
|
+
return typeof window > "u" ? "/" : window.location.pathname || "/";
|
|
458
|
+
}
|
|
459
|
+
function kn(e) {
|
|
460
|
+
const [t, r] = S(
|
|
461
|
+
() => e ?? kt()
|
|
462
|
+
);
|
|
463
|
+
return I(() => {
|
|
464
|
+
if (e !== void 0) return;
|
|
465
|
+
xn();
|
|
466
|
+
const i = () => r(kt());
|
|
467
|
+
return i(), window.addEventListener("popstate", i), window.addEventListener(We, i), () => {
|
|
468
|
+
window.removeEventListener("popstate", i), window.removeEventListener(We, i);
|
|
469
|
+
};
|
|
470
|
+
}, [e]), e ?? t;
|
|
471
|
+
}
|
|
472
|
+
const Lt = /* @__PURE__ */ new Map(), Ln = /[\\^$+?.()|{}[\]]/g;
|
|
473
|
+
function En(e) {
|
|
474
|
+
return e.replace(Ln, "\\$&");
|
|
475
|
+
}
|
|
476
|
+
function Cn(e) {
|
|
477
|
+
const t = Lt.get(e);
|
|
478
|
+
if (t) return t;
|
|
479
|
+
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", o = "", l = r.replace(/\*\*/g, i).replace(/\*/g, o), d = En(l).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(o, "g"), "[^/]+"), u = new RegExp(`^${d}\\/?$`);
|
|
480
|
+
return Lt.set(e, u), u;
|
|
481
|
+
}
|
|
482
|
+
function Sn(e, t) {
|
|
483
|
+
const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
|
|
484
|
+
return Cn(e).test(r);
|
|
485
|
+
}
|
|
486
|
+
function Nn(e, t) {
|
|
487
|
+
return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : Sn(e, t);
|
|
488
|
+
}
|
|
489
|
+
function Et(e, t) {
|
|
490
|
+
if (!e || e.length === 0) return !1;
|
|
491
|
+
for (const r of e)
|
|
492
|
+
if (Nn(r, t)) return !0;
|
|
493
|
+
return !1;
|
|
443
494
|
}
|
|
444
|
-
|
|
495
|
+
function An(e, t, r) {
|
|
496
|
+
return e === void 0 ? !0 : Et(r, e) ? !1 : t && t.length > 0 ? Et(t, e) : !0;
|
|
497
|
+
}
|
|
498
|
+
function Mn(e, t, r) {
|
|
499
|
+
return je(
|
|
500
|
+
() => An(e, t, r),
|
|
501
|
+
[e, t, r]
|
|
502
|
+
);
|
|
503
|
+
}
|
|
504
|
+
const Ct = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ L(
|
|
445
505
|
"svg",
|
|
446
506
|
{
|
|
447
|
-
className:
|
|
507
|
+
className: t,
|
|
448
508
|
fill: "none",
|
|
449
509
|
viewBox: "0 0 24 24",
|
|
450
510
|
stroke: "currentColor",
|
|
451
511
|
strokeWidth: 2,
|
|
452
512
|
"aria-hidden": "true",
|
|
453
513
|
children: [
|
|
454
|
-
/* @__PURE__ */
|
|
514
|
+
/* @__PURE__ */ n(
|
|
455
515
|
"path",
|
|
456
516
|
{
|
|
457
517
|
strokeLinecap: "round",
|
|
@@ -459,7 +519,7 @@ const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ _(
|
|
|
459
519
|
d: "M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z"
|
|
460
520
|
}
|
|
461
521
|
),
|
|
462
|
-
/* @__PURE__ */
|
|
522
|
+
/* @__PURE__ */ n(
|
|
463
523
|
"path",
|
|
464
524
|
{
|
|
465
525
|
strokeLinecap: "round",
|
|
@@ -469,16 +529,16 @@ const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ _(
|
|
|
469
529
|
)
|
|
470
530
|
]
|
|
471
531
|
}
|
|
472
|
-
) : /* @__PURE__ */
|
|
532
|
+
) : /* @__PURE__ */ n(
|
|
473
533
|
"svg",
|
|
474
534
|
{
|
|
475
|
-
className:
|
|
535
|
+
className: t,
|
|
476
536
|
fill: "none",
|
|
477
537
|
viewBox: "0 0 24 24",
|
|
478
538
|
stroke: "currentColor",
|
|
479
539
|
strokeWidth: 2,
|
|
480
540
|
"aria-hidden": "true",
|
|
481
|
-
children: /* @__PURE__ */
|
|
541
|
+
children: /* @__PURE__ */ n(
|
|
482
542
|
"path",
|
|
483
543
|
{
|
|
484
544
|
strokeLinecap: "round",
|
|
@@ -487,16 +547,16 @@ const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ _(
|
|
|
487
547
|
}
|
|
488
548
|
)
|
|
489
549
|
}
|
|
490
|
-
),
|
|
550
|
+
), St = ({ className: e }) => /* @__PURE__ */ n(
|
|
491
551
|
"svg",
|
|
492
552
|
{
|
|
493
|
-
className:
|
|
553
|
+
className: e,
|
|
494
554
|
fill: "none",
|
|
495
555
|
viewBox: "0 0 24 24",
|
|
496
556
|
stroke: "currentColor",
|
|
497
557
|
strokeWidth: 2,
|
|
498
558
|
"aria-hidden": "true",
|
|
499
|
-
children: /* @__PURE__ */
|
|
559
|
+
children: /* @__PURE__ */ n(
|
|
500
560
|
"path",
|
|
501
561
|
{
|
|
502
562
|
strokeLinecap: "round",
|
|
@@ -505,328 +565,328 @@ const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ _(
|
|
|
505
565
|
}
|
|
506
566
|
)
|
|
507
567
|
}
|
|
508
|
-
),
|
|
568
|
+
), Rn = ({ className: e }) => /* @__PURE__ */ n(
|
|
509
569
|
"svg",
|
|
510
570
|
{
|
|
511
|
-
className:
|
|
571
|
+
className: e,
|
|
512
572
|
fill: "none",
|
|
513
573
|
viewBox: "0 0 24 24",
|
|
514
574
|
stroke: "currentColor",
|
|
515
575
|
strokeWidth: 2,
|
|
516
576
|
"aria-hidden": "true",
|
|
517
|
-
children: /* @__PURE__ */
|
|
577
|
+
children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
518
578
|
}
|
|
519
|
-
),
|
|
579
|
+
), Tn = {
|
|
520
580
|
left: 180,
|
|
521
581
|
right: 0,
|
|
522
582
|
up: -90,
|
|
523
583
|
down: 90
|
|
524
|
-
},
|
|
584
|
+
}, In = ({ direction: e = "right", className: t }) => /* @__PURE__ */ n(
|
|
525
585
|
"svg",
|
|
526
586
|
{
|
|
527
|
-
className:
|
|
587
|
+
className: t,
|
|
528
588
|
fill: "none",
|
|
529
589
|
viewBox: "0 0 24 24",
|
|
530
590
|
stroke: "currentColor",
|
|
531
591
|
strokeWidth: 2,
|
|
532
|
-
style: { transform: `rotate(${
|
|
592
|
+
style: { transform: `rotate(${Tn[e]}deg)` },
|
|
533
593
|
"aria-hidden": "true",
|
|
534
|
-
children: /* @__PURE__ */
|
|
594
|
+
children: /* @__PURE__ */ n("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" })
|
|
535
595
|
}
|
|
536
596
|
);
|
|
537
|
-
function
|
|
538
|
-
return
|
|
597
|
+
function Pn(e) {
|
|
598
|
+
return e === "top-left" || e === "bottom-left" ? "left" : "right";
|
|
539
599
|
}
|
|
540
|
-
const
|
|
541
|
-
function
|
|
600
|
+
const Ht = "ll-hidden-tab-center-y", Dn = 5, Nt = 16;
|
|
601
|
+
function $n() {
|
|
542
602
|
if (typeof window > "u") return null;
|
|
543
603
|
try {
|
|
544
|
-
const
|
|
545
|
-
if (!
|
|
546
|
-
const
|
|
547
|
-
return Number.isFinite(
|
|
604
|
+
const e = window.localStorage.getItem(Ht);
|
|
605
|
+
if (!e) return null;
|
|
606
|
+
const t = Number.parseFloat(e);
|
|
607
|
+
return Number.isFinite(t) ? t : null;
|
|
548
608
|
} catch {
|
|
549
609
|
return null;
|
|
550
610
|
}
|
|
551
611
|
}
|
|
552
|
-
function
|
|
612
|
+
function At(e) {
|
|
553
613
|
if (!(typeof window > "u"))
|
|
554
614
|
try {
|
|
555
|
-
window.localStorage.setItem(
|
|
615
|
+
window.localStorage.setItem(Ht, String(e));
|
|
556
616
|
} catch {
|
|
557
617
|
}
|
|
558
618
|
}
|
|
559
|
-
const
|
|
560
|
-
position:
|
|
561
|
-
isMobile:
|
|
562
|
-
isSpeaking:
|
|
563
|
-
onExpand:
|
|
564
|
-
label:
|
|
619
|
+
const zn = ({
|
|
620
|
+
position: e,
|
|
621
|
+
isMobile: t,
|
|
622
|
+
isSpeaking: r,
|
|
623
|
+
onExpand: i,
|
|
624
|
+
label: o = "Open widget"
|
|
565
625
|
}) => {
|
|
566
|
-
const
|
|
567
|
-
(
|
|
568
|
-
if (typeof window > "u") return
|
|
569
|
-
const
|
|
570
|
-
return
|
|
626
|
+
const l = Pn(e), s = l === "right" ? "left" : "right", d = t ? 80 : 72, [u, g] = S(null), [p, a] = S(!1), c = R(null), N = R(!1), E = _(
|
|
627
|
+
(y) => {
|
|
628
|
+
if (typeof window > "u") return y;
|
|
629
|
+
const C = d / 2, w = Nt + C, H = window.innerHeight - Nt - C;
|
|
630
|
+
return H < w ? Math.max(w, y) : Math.max(w, Math.min(H, y));
|
|
571
631
|
},
|
|
572
|
-
[
|
|
632
|
+
[d]
|
|
573
633
|
);
|
|
574
|
-
|
|
575
|
-
const
|
|
576
|
-
|
|
577
|
-
const
|
|
578
|
-
|
|
634
|
+
I(() => {
|
|
635
|
+
const y = $n();
|
|
636
|
+
g(E(y ?? window.innerHeight / 2));
|
|
637
|
+
const C = () => {
|
|
638
|
+
g((w) => w === null ? null : E(w));
|
|
579
639
|
};
|
|
580
|
-
return window.addEventListener("resize",
|
|
581
|
-
}, [
|
|
582
|
-
const
|
|
583
|
-
(
|
|
584
|
-
if (!(
|
|
640
|
+
return window.addEventListener("resize", C), () => window.removeEventListener("resize", C);
|
|
641
|
+
}, [E]);
|
|
642
|
+
const A = _(
|
|
643
|
+
(y) => {
|
|
644
|
+
if (!(y.pointerType === "mouse" && y.button !== 0) && u !== null) {
|
|
585
645
|
try {
|
|
586
|
-
|
|
646
|
+
y.currentTarget.setPointerCapture(y.pointerId);
|
|
587
647
|
} catch {
|
|
588
648
|
}
|
|
589
|
-
|
|
590
|
-
startClientY:
|
|
591
|
-
startCenterY:
|
|
649
|
+
c.current = {
|
|
650
|
+
startClientY: y.clientY,
|
|
651
|
+
startCenterY: u,
|
|
592
652
|
moved: !1
|
|
593
653
|
};
|
|
594
654
|
}
|
|
595
655
|
},
|
|
596
|
-
[
|
|
597
|
-
),
|
|
598
|
-
(
|
|
599
|
-
const
|
|
600
|
-
if (!
|
|
601
|
-
const
|
|
602
|
-
!
|
|
656
|
+
[u]
|
|
657
|
+
), z = _(
|
|
658
|
+
(y) => {
|
|
659
|
+
const C = c.current;
|
|
660
|
+
if (!C) return;
|
|
661
|
+
const w = y.clientY - C.startClientY;
|
|
662
|
+
!C.moved && Math.abs(w) > Dn && (C.moved = !0, a(!0)), C.moved && g(E(C.startCenterY + w));
|
|
603
663
|
},
|
|
604
|
-
[
|
|
605
|
-
),
|
|
606
|
-
(
|
|
607
|
-
const
|
|
608
|
-
if (
|
|
664
|
+
[E]
|
|
665
|
+
), T = _(
|
|
666
|
+
(y) => {
|
|
667
|
+
const C = c.current;
|
|
668
|
+
if (C) {
|
|
609
669
|
try {
|
|
610
|
-
|
|
670
|
+
y.currentTarget.releasePointerCapture(y.pointerId);
|
|
611
671
|
} catch {
|
|
612
672
|
}
|
|
613
|
-
|
|
673
|
+
c.current = null, C.moved && (a(!1), N.current = !0, g((w) => (w !== null && At(w), w)));
|
|
614
674
|
}
|
|
615
675
|
},
|
|
616
676
|
[]
|
|
617
|
-
),
|
|
618
|
-
if (
|
|
619
|
-
|
|
677
|
+
), $ = _(() => {
|
|
678
|
+
if (N.current) {
|
|
679
|
+
N.current = !1;
|
|
620
680
|
return;
|
|
621
681
|
}
|
|
622
|
-
|
|
623
|
-
}, [
|
|
624
|
-
(
|
|
625
|
-
if (
|
|
626
|
-
|
|
627
|
-
const
|
|
628
|
-
|
|
629
|
-
if (
|
|
630
|
-
const
|
|
631
|
-
return
|
|
682
|
+
i();
|
|
683
|
+
}, [i]), M = _(
|
|
684
|
+
(y) => {
|
|
685
|
+
if (y.key === "ArrowUp" || y.key === "ArrowDown") {
|
|
686
|
+
y.preventDefault();
|
|
687
|
+
const C = y.key === "ArrowUp" ? -8 : 8;
|
|
688
|
+
g((w) => {
|
|
689
|
+
if (w === null) return w;
|
|
690
|
+
const H = E(w + C);
|
|
691
|
+
return At(H), H;
|
|
632
692
|
});
|
|
633
693
|
}
|
|
634
694
|
},
|
|
635
|
-
[
|
|
636
|
-
),
|
|
695
|
+
[E]
|
|
696
|
+
), D = [
|
|
637
697
|
"ll-hidden",
|
|
638
|
-
`ll-hidden--${
|
|
639
|
-
|
|
640
|
-
|
|
698
|
+
`ll-hidden--${l}`,
|
|
699
|
+
t ? "ll-hidden--mobile" : "ll-hidden--desktop",
|
|
700
|
+
r ? "ll-hidden--speaking" : null,
|
|
641
701
|
p ? "is-dragging" : null
|
|
642
|
-
].filter(Boolean).join(" "),
|
|
643
|
-
return /* @__PURE__ */
|
|
702
|
+
].filter(Boolean).join(" "), m = u === null ? void 0 : { top: `${u - d / 2}px`, transform: "none" };
|
|
703
|
+
return /* @__PURE__ */ n(
|
|
644
704
|
"button",
|
|
645
705
|
{
|
|
646
706
|
type: "button",
|
|
647
|
-
className:
|
|
648
|
-
onPointerDown:
|
|
649
|
-
onPointerMove:
|
|
650
|
-
onPointerUp:
|
|
651
|
-
onPointerCancel:
|
|
652
|
-
onClick:
|
|
653
|
-
onKeyDown:
|
|
654
|
-
"aria-label":
|
|
655
|
-
"data-position":
|
|
656
|
-
style:
|
|
657
|
-
children: /* @__PURE__ */
|
|
707
|
+
className: D,
|
|
708
|
+
onPointerDown: A,
|
|
709
|
+
onPointerMove: z,
|
|
710
|
+
onPointerUp: T,
|
|
711
|
+
onPointerCancel: T,
|
|
712
|
+
onClick: $,
|
|
713
|
+
onKeyDown: M,
|
|
714
|
+
"aria-label": o,
|
|
715
|
+
"data-position": e,
|
|
716
|
+
style: m,
|
|
717
|
+
children: /* @__PURE__ */ n(In, { direction: s, className: "ll-hidden__chevron" })
|
|
658
718
|
}
|
|
659
719
|
);
|
|
660
|
-
},
|
|
661
|
-
audioLevel:
|
|
662
|
-
bars:
|
|
663
|
-
maxHeight:
|
|
664
|
-
minHeight:
|
|
665
|
-
className:
|
|
666
|
-
barClassName:
|
|
720
|
+
}, Hn = ({
|
|
721
|
+
audioLevel: e,
|
|
722
|
+
bars: t = 20,
|
|
723
|
+
maxHeight: r = 20,
|
|
724
|
+
minHeight: i = 4,
|
|
725
|
+
className: o,
|
|
726
|
+
barClassName: l
|
|
667
727
|
}) => {
|
|
668
|
-
const
|
|
728
|
+
const s = R(null), d = R([]), u = je(() => {
|
|
669
729
|
const p = (Math.sqrt(5) - 1) / 2;
|
|
670
|
-
return Array.from({ length:
|
|
671
|
-
}, [
|
|
672
|
-
|
|
673
|
-
for (let
|
|
674
|
-
const
|
|
675
|
-
if (!
|
|
676
|
-
const
|
|
677
|
-
|
|
730
|
+
return Array.from({ length: t }, (a, c) => 0.5 + c * p % 1 * 0.5);
|
|
731
|
+
}, [t]);
|
|
732
|
+
I(() => e.subscribe((a) => {
|
|
733
|
+
for (let c = 0; c < t; c++) {
|
|
734
|
+
const N = d.current[c];
|
|
735
|
+
if (!N) continue;
|
|
736
|
+
const E = Math.max(i, a * r * u[c]);
|
|
737
|
+
N.style.height = `${E}px`;
|
|
678
738
|
}
|
|
679
|
-
}), [t,
|
|
680
|
-
const
|
|
681
|
-
return /* @__PURE__ */
|
|
739
|
+
}), [e, t, r, i, u]);
|
|
740
|
+
const g = ["ll-waveform", o].filter(Boolean).join(" ");
|
|
741
|
+
return /* @__PURE__ */ n("div", { ref: s, className: g, "aria-hidden": "true", children: Array.from({ length: t }, (p, a) => /* @__PURE__ */ n(
|
|
682
742
|
"div",
|
|
683
743
|
{
|
|
684
|
-
ref: (
|
|
685
|
-
|
|
744
|
+
ref: (c) => {
|
|
745
|
+
d.current[a] = c;
|
|
686
746
|
},
|
|
687
|
-
className: ["ll-waveform__bar",
|
|
688
|
-
style: { height: `${
|
|
747
|
+
className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
|
|
748
|
+
style: { height: `${i}px` }
|
|
689
749
|
},
|
|
690
|
-
|
|
750
|
+
a
|
|
691
751
|
)) });
|
|
692
|
-
},
|
|
693
|
-
position:
|
|
694
|
-
isMobile:
|
|
695
|
-
agentName:
|
|
696
|
-
avatarImageUrl:
|
|
697
|
-
agentState:
|
|
698
|
-
isMuted:
|
|
699
|
-
audioLevel:
|
|
700
|
-
onExpand:
|
|
701
|
-
onToggleMute:
|
|
702
|
-
onClose:
|
|
703
|
-
}) =>
|
|
752
|
+
}, On = ({
|
|
753
|
+
position: e,
|
|
754
|
+
isMobile: t,
|
|
755
|
+
agentName: r,
|
|
756
|
+
avatarImageUrl: i,
|
|
757
|
+
agentState: o,
|
|
758
|
+
isMuted: l,
|
|
759
|
+
audioLevel: s,
|
|
760
|
+
onExpand: d,
|
|
761
|
+
onToggleMute: u,
|
|
762
|
+
onClose: g
|
|
763
|
+
}) => t ? /* @__PURE__ */ n(
|
|
704
764
|
"div",
|
|
705
765
|
{
|
|
706
766
|
className: "ll-minimized ll-minimized--mobile",
|
|
707
767
|
role: "region",
|
|
708
|
-
"aria-label": `${
|
|
709
|
-
children: /* @__PURE__ */
|
|
768
|
+
"aria-label": `${r} widget`,
|
|
769
|
+
children: /* @__PURE__ */ L(
|
|
710
770
|
"button",
|
|
711
771
|
{
|
|
712
772
|
type: "button",
|
|
713
773
|
className: "ll-minimized__surface",
|
|
714
|
-
onClick:
|
|
715
|
-
"aria-label": `Expand ${
|
|
774
|
+
onClick: d,
|
|
775
|
+
"aria-label": `Expand ${r} widget`,
|
|
716
776
|
children: [
|
|
717
|
-
|
|
777
|
+
i ? (
|
|
718
778
|
// eslint-disable-next-line @next/next/no-img-element
|
|
719
|
-
/* @__PURE__ */
|
|
779
|
+
/* @__PURE__ */ n(
|
|
720
780
|
"img",
|
|
721
781
|
{
|
|
722
|
-
src:
|
|
723
|
-
alt:
|
|
782
|
+
src: i,
|
|
783
|
+
alt: r,
|
|
724
784
|
className: "ll-minimized__avatar"
|
|
725
785
|
}
|
|
726
786
|
)
|
|
727
|
-
) : /* @__PURE__ */
|
|
728
|
-
/* @__PURE__ */
|
|
729
|
-
|
|
787
|
+
) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
|
|
788
|
+
/* @__PURE__ */ n(
|
|
789
|
+
Hn,
|
|
730
790
|
{
|
|
731
|
-
audioLevel:
|
|
791
|
+
audioLevel: s,
|
|
732
792
|
bars: 16,
|
|
733
793
|
maxHeight: 18,
|
|
734
794
|
className: "ll-minimized__waveform"
|
|
735
795
|
}
|
|
736
796
|
),
|
|
737
|
-
/* @__PURE__ */
|
|
738
|
-
/* @__PURE__ */
|
|
739
|
-
/* @__PURE__ */
|
|
797
|
+
/* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
|
|
798
|
+
/* @__PURE__ */ L("div", { className: "ll-minimized__controls", children: [
|
|
799
|
+
/* @__PURE__ */ n(
|
|
740
800
|
"span",
|
|
741
801
|
{
|
|
742
802
|
className: "ll-minimized__btn",
|
|
743
803
|
role: "button",
|
|
744
804
|
tabIndex: 0,
|
|
745
805
|
onClick: (p) => {
|
|
746
|
-
p.stopPropagation(),
|
|
806
|
+
p.stopPropagation(), u();
|
|
747
807
|
},
|
|
748
808
|
onKeyDown: (p) => {
|
|
749
|
-
(p.key === "Enter" || p.key === " ") && (p.stopPropagation(), p.preventDefault(),
|
|
809
|
+
(p.key === "Enter" || p.key === " ") && (p.stopPropagation(), p.preventDefault(), u());
|
|
750
810
|
},
|
|
751
|
-
"aria-label":
|
|
752
|
-
children: /* @__PURE__ */
|
|
811
|
+
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
812
|
+
children: /* @__PURE__ */ n(Ct, { muted: l, className: "ll-minimized__icon" })
|
|
753
813
|
}
|
|
754
814
|
),
|
|
755
|
-
/* @__PURE__ */
|
|
815
|
+
/* @__PURE__ */ n(St, { className: "ll-minimized__icon ll-minimized__icon--expand" })
|
|
756
816
|
] })
|
|
757
817
|
]
|
|
758
818
|
}
|
|
759
819
|
)
|
|
760
820
|
}
|
|
761
|
-
) : /* @__PURE__ */
|
|
821
|
+
) : /* @__PURE__ */ n(
|
|
762
822
|
"div",
|
|
763
823
|
{
|
|
764
824
|
className: "ll-minimized ll-minimized--desktop",
|
|
765
|
-
"data-position":
|
|
825
|
+
"data-position": e,
|
|
766
826
|
role: "region",
|
|
767
|
-
"aria-label": `${
|
|
768
|
-
children: /* @__PURE__ */
|
|
769
|
-
|
|
827
|
+
"aria-label": `${r} widget`,
|
|
828
|
+
children: /* @__PURE__ */ L("div", { className: "ll-minimized__surface", children: [
|
|
829
|
+
i ? (
|
|
770
830
|
// eslint-disable-next-line @next/next/no-img-element
|
|
771
|
-
/* @__PURE__ */
|
|
831
|
+
/* @__PURE__ */ n(
|
|
772
832
|
"img",
|
|
773
833
|
{
|
|
774
|
-
src:
|
|
775
|
-
alt:
|
|
834
|
+
src: i,
|
|
835
|
+
alt: r,
|
|
776
836
|
className: "ll-minimized__avatar"
|
|
777
837
|
}
|
|
778
838
|
)
|
|
779
|
-
) : /* @__PURE__ */
|
|
780
|
-
/* @__PURE__ */
|
|
781
|
-
/* @__PURE__ */
|
|
782
|
-
/* @__PURE__ */
|
|
839
|
+
) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
|
|
840
|
+
/* @__PURE__ */ L("div", { className: "ll-minimized__meta", children: [
|
|
841
|
+
/* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
|
|
842
|
+
/* @__PURE__ */ n("span", { className: "ll-minimized__state", children: o === "speaking" ? "Speaking" : o === "thinking" ? "Thinking" : "Listening" })
|
|
783
843
|
] }),
|
|
784
|
-
/* @__PURE__ */
|
|
785
|
-
/* @__PURE__ */
|
|
844
|
+
/* @__PURE__ */ L("div", { className: "ll-minimized__controls", children: [
|
|
845
|
+
/* @__PURE__ */ n(
|
|
786
846
|
"button",
|
|
787
847
|
{
|
|
788
848
|
type: "button",
|
|
789
849
|
className: "ll-minimized__btn",
|
|
790
|
-
onClick:
|
|
791
|
-
"aria-label":
|
|
792
|
-
children: /* @__PURE__ */
|
|
850
|
+
onClick: u,
|
|
851
|
+
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
852
|
+
children: /* @__PURE__ */ n(Ct, { muted: l, className: "ll-minimized__icon" })
|
|
793
853
|
}
|
|
794
854
|
),
|
|
795
|
-
/* @__PURE__ */
|
|
855
|
+
/* @__PURE__ */ n(
|
|
796
856
|
"button",
|
|
797
857
|
{
|
|
798
858
|
type: "button",
|
|
799
859
|
className: "ll-minimized__btn",
|
|
800
|
-
onClick:
|
|
801
|
-
"aria-label": `Expand ${
|
|
802
|
-
children: /* @__PURE__ */
|
|
860
|
+
onClick: d,
|
|
861
|
+
"aria-label": `Expand ${r} widget`,
|
|
862
|
+
children: /* @__PURE__ */ n(St, { className: "ll-minimized__icon" })
|
|
803
863
|
}
|
|
804
864
|
),
|
|
805
|
-
/* @__PURE__ */
|
|
865
|
+
/* @__PURE__ */ n(
|
|
806
866
|
"button",
|
|
807
867
|
{
|
|
808
868
|
type: "button",
|
|
809
869
|
className: "ll-minimized__btn ll-minimized__btn--close",
|
|
810
|
-
onClick:
|
|
870
|
+
onClick: g,
|
|
811
871
|
"aria-label": "Close widget",
|
|
812
|
-
children: /* @__PURE__ */
|
|
872
|
+
children: /* @__PURE__ */ n(Rn, { className: "ll-minimized__icon" })
|
|
813
873
|
}
|
|
814
874
|
)
|
|
815
875
|
] })
|
|
816
876
|
] })
|
|
817
877
|
}
|
|
818
|
-
),
|
|
819
|
-
src:
|
|
820
|
-
alt:
|
|
821
|
-
preCannedPlaying:
|
|
822
|
-
className:
|
|
823
|
-
style:
|
|
878
|
+
), Bn = ({
|
|
879
|
+
src: e,
|
|
880
|
+
alt: t,
|
|
881
|
+
preCannedPlaying: r = !1,
|
|
882
|
+
className: i,
|
|
883
|
+
style: o
|
|
824
884
|
}) => {
|
|
825
|
-
const [
|
|
826
|
-
if (
|
|
827
|
-
|
|
828
|
-
}, [
|
|
829
|
-
const
|
|
885
|
+
const [l, s] = S(!1), d = R(e);
|
|
886
|
+
if (I(() => {
|
|
887
|
+
d.current !== e && (d.current = e, s(!1));
|
|
888
|
+
}, [e]), !e) return null;
|
|
889
|
+
const u = {
|
|
830
890
|
position: "absolute",
|
|
831
891
|
inset: 0,
|
|
832
892
|
width: "100%",
|
|
@@ -834,133 +894,133 @@ const St = ({
|
|
|
834
894
|
objectFit: "cover",
|
|
835
895
|
objectPosition: "top",
|
|
836
896
|
transition: "opacity 500ms ease, transform 500ms ease",
|
|
837
|
-
transform:
|
|
838
|
-
opacity:
|
|
839
|
-
...
|
|
897
|
+
transform: r ? "scale(1.02)" : "scale(1)",
|
|
898
|
+
opacity: l ? 1 : 0,
|
|
899
|
+
...o
|
|
840
900
|
};
|
|
841
901
|
return (
|
|
842
902
|
// eslint-disable-next-line @next/next/no-img-element
|
|
843
|
-
/* @__PURE__ */
|
|
903
|
+
/* @__PURE__ */ n(
|
|
844
904
|
"img",
|
|
845
905
|
{
|
|
846
|
-
src:
|
|
847
|
-
alt:
|
|
848
|
-
className:
|
|
849
|
-
style:
|
|
906
|
+
src: e,
|
|
907
|
+
alt: t,
|
|
908
|
+
className: i,
|
|
909
|
+
style: u,
|
|
850
910
|
loading: "eager",
|
|
851
911
|
fetchpriority: "high",
|
|
852
|
-
onLoad: () =>
|
|
912
|
+
onLoad: () => s(!0)
|
|
853
913
|
}
|
|
854
914
|
)
|
|
855
915
|
);
|
|
856
|
-
},
|
|
857
|
-
position:
|
|
858
|
-
isMobile:
|
|
859
|
-
agentName:
|
|
860
|
-
avatarImageUrl:
|
|
861
|
-
idleLoopUrl:
|
|
862
|
-
greeting:
|
|
863
|
-
branding:
|
|
864
|
-
teamMembers:
|
|
865
|
-
currentTeamMemberId:
|
|
866
|
-
isSwitchingTeamMember:
|
|
916
|
+
}, Un = ({
|
|
917
|
+
position: e,
|
|
918
|
+
isMobile: t,
|
|
919
|
+
agentName: r,
|
|
920
|
+
avatarImageUrl: i,
|
|
921
|
+
idleLoopUrl: o,
|
|
922
|
+
greeting: l,
|
|
923
|
+
branding: s,
|
|
924
|
+
teamMembers: d,
|
|
925
|
+
currentTeamMemberId: u,
|
|
926
|
+
isSwitchingTeamMember: g,
|
|
867
927
|
teamSwitcherOpen: p,
|
|
868
|
-
onToggleTeamSwitcher:
|
|
869
|
-
onSelectTeamMember:
|
|
870
|
-
languageMenuOpen:
|
|
871
|
-
onToggleLanguageMenu:
|
|
872
|
-
connectionState:
|
|
873
|
-
agentState:
|
|
874
|
-
transcript:
|
|
875
|
-
canResume:
|
|
876
|
-
needsUserGesture:
|
|
877
|
-
error:
|
|
878
|
-
isMuted:
|
|
879
|
-
micError:
|
|
880
|
-
micDevices:
|
|
881
|
-
isCameraEnabled:
|
|
882
|
-
cameraPreviewEl:
|
|
883
|
-
cameraDevices:
|
|
884
|
-
activeCameraId:
|
|
885
|
-
isScreenShareEnabled:
|
|
886
|
-
screenPreviewEl:
|
|
887
|
-
isSpeakerMuted:
|
|
888
|
-
allowCamera:
|
|
889
|
-
allowScreenShare:
|
|
890
|
-
allowTyping:
|
|
891
|
-
avatarVideoContainerRef:
|
|
892
|
-
onConnect:
|
|
893
|
-
onDisconnect:
|
|
894
|
-
onRetry:
|
|
895
|
-
onResumeAudio:
|
|
896
|
-
onToggleMute:
|
|
897
|
-
onToggleCamera:
|
|
898
|
-
onSwitchCameraDevice:
|
|
899
|
-
onToggleScreenShare:
|
|
900
|
-
onToggleSpeaker:
|
|
901
|
-
onSendMessage:
|
|
902
|
-
onMinimize:
|
|
903
|
-
onClose:
|
|
904
|
-
onClearMicError:
|
|
928
|
+
onToggleTeamSwitcher: a,
|
|
929
|
+
onSelectTeamMember: c,
|
|
930
|
+
languageMenuOpen: N,
|
|
931
|
+
onToggleLanguageMenu: E,
|
|
932
|
+
connectionState: A,
|
|
933
|
+
agentState: z,
|
|
934
|
+
transcript: T,
|
|
935
|
+
canResume: $,
|
|
936
|
+
needsUserGesture: M,
|
|
937
|
+
error: D,
|
|
938
|
+
isMuted: m,
|
|
939
|
+
micError: y,
|
|
940
|
+
micDevices: C,
|
|
941
|
+
isCameraEnabled: w,
|
|
942
|
+
cameraPreviewEl: H,
|
|
943
|
+
cameraDevices: K,
|
|
944
|
+
activeCameraId: se,
|
|
945
|
+
isScreenShareEnabled: X,
|
|
946
|
+
screenPreviewEl: J,
|
|
947
|
+
isSpeakerMuted: de,
|
|
948
|
+
allowCamera: De,
|
|
949
|
+
allowScreenShare: $e,
|
|
950
|
+
allowTyping: ze,
|
|
951
|
+
avatarVideoContainerRef: He,
|
|
952
|
+
onConnect: ue,
|
|
953
|
+
onDisconnect: me,
|
|
954
|
+
onRetry: ge,
|
|
955
|
+
onResumeAudio: ye,
|
|
956
|
+
onToggleMute: ve,
|
|
957
|
+
onToggleCamera: be,
|
|
958
|
+
onSwitchCameraDevice: we,
|
|
959
|
+
onToggleScreenShare: B,
|
|
960
|
+
onToggleSpeaker: Ye,
|
|
961
|
+
onSendMessage: Oe,
|
|
962
|
+
onMinimize: Be,
|
|
963
|
+
onClose: Ce,
|
|
964
|
+
onClearMicError: Se
|
|
905
965
|
}) => {
|
|
906
|
-
var
|
|
907
|
-
const
|
|
908
|
-
|
|
909
|
-
const h =
|
|
910
|
-
h && (h.innerHTML = "",
|
|
911
|
-
}, [
|
|
912
|
-
const h =
|
|
913
|
-
h && (h.innerHTML = "",
|
|
914
|
-
}, [
|
|
915
|
-
const [
|
|
916
|
-
|
|
917
|
-
if (!
|
|
966
|
+
var Re;
|
|
967
|
+
const re = T.length > 0 ? T[T.length - 1] : null, fe = ((d == null ? void 0 : d.length) ?? 0) > 1, _e = A === "connecting" || A === "connected", Q = A === "connected", W = A === "idle" || A === "disconnected" || A === "error", Ne = R(null), ie = R(null);
|
|
968
|
+
I(() => {
|
|
969
|
+
const h = Ne.current;
|
|
970
|
+
h && (h.innerHTML = "", H && (H.style.width = "100%", H.style.height = "100%", H.style.objectFit = "cover", H.style.transform = "scaleX(-1)", h.appendChild(H)));
|
|
971
|
+
}, [H]), I(() => {
|
|
972
|
+
const h = ie.current;
|
|
973
|
+
h && (h.innerHTML = "", J && (J.style.width = "100%", J.style.height = "100%", J.style.objectFit = "contain", h.appendChild(J)));
|
|
974
|
+
}, [J]);
|
|
975
|
+
const [Y, ne] = S(!1), [oe, V] = S(!1);
|
|
976
|
+
I(() => {
|
|
977
|
+
if (!Y && !oe && !N && !p) return;
|
|
918
978
|
const h = () => {
|
|
919
|
-
|
|
979
|
+
ne(!1), V(!1), N && E(), p && a();
|
|
920
980
|
};
|
|
921
981
|
return document.addEventListener("click", h), () => document.removeEventListener("click", h);
|
|
922
982
|
}, [
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
983
|
+
Y,
|
|
984
|
+
oe,
|
|
985
|
+
N,
|
|
926
986
|
p,
|
|
927
|
-
|
|
928
|
-
|
|
987
|
+
E,
|
|
988
|
+
a
|
|
929
989
|
]);
|
|
930
|
-
const [
|
|
990
|
+
const [G, le] = S(""), Ae = _(
|
|
931
991
|
(h) => {
|
|
932
992
|
h.preventDefault();
|
|
933
|
-
const
|
|
934
|
-
|
|
993
|
+
const q = G.trim();
|
|
994
|
+
q && (Oe(q), le(""));
|
|
935
995
|
},
|
|
936
|
-
[
|
|
937
|
-
),
|
|
996
|
+
[G, Oe]
|
|
997
|
+
), Ge = s.productName || "Live Layer", xe = Q && (re != null && re.text) ? re.text : l || "", Me = [
|
|
938
998
|
"ll-expanded",
|
|
939
|
-
|
|
999
|
+
t ? "ll-expanded--mobile" : "ll-expanded--desktop"
|
|
940
1000
|
].join(" ");
|
|
941
|
-
return /* @__PURE__ */
|
|
1001
|
+
return /* @__PURE__ */ L(
|
|
942
1002
|
"div",
|
|
943
1003
|
{
|
|
944
|
-
className:
|
|
945
|
-
"data-position":
|
|
946
|
-
"data-state":
|
|
1004
|
+
className: Me,
|
|
1005
|
+
"data-position": e,
|
|
1006
|
+
"data-state": Q ? "connected" : _e ? "connecting" : "idle",
|
|
947
1007
|
role: "dialog",
|
|
948
|
-
"aria-label": `${
|
|
1008
|
+
"aria-label": `${r} widget`,
|
|
949
1009
|
children: [
|
|
950
|
-
/* @__PURE__ */
|
|
951
|
-
|
|
952
|
-
|
|
1010
|
+
/* @__PURE__ */ L("div", { className: "ll-expanded__bg", children: [
|
|
1011
|
+
i ? /* @__PURE__ */ n(
|
|
1012
|
+
Bn,
|
|
953
1013
|
{
|
|
954
|
-
src:
|
|
955
|
-
alt:
|
|
1014
|
+
src: i,
|
|
1015
|
+
alt: r,
|
|
956
1016
|
className: "ll-expanded__bg-img"
|
|
957
1017
|
}
|
|
958
|
-
) : /* @__PURE__ */
|
|
959
|
-
|
|
1018
|
+
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Re = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Re.toUpperCase()) || "A" }) }),
|
|
1019
|
+
o && !Q && /* @__PURE__ */ n(
|
|
960
1020
|
"video",
|
|
961
1021
|
{
|
|
962
1022
|
className: "ll-expanded__bg-idle",
|
|
963
|
-
src:
|
|
1023
|
+
src: o,
|
|
964
1024
|
autoPlay: !0,
|
|
965
1025
|
loop: !0,
|
|
966
1026
|
muted: !0,
|
|
@@ -968,58 +1028,58 @@ const St = ({
|
|
|
968
1028
|
}
|
|
969
1029
|
)
|
|
970
1030
|
] }),
|
|
971
|
-
/* @__PURE__ */
|
|
972
|
-
|
|
973
|
-
/* @__PURE__ */
|
|
974
|
-
/* @__PURE__ */
|
|
1031
|
+
/* @__PURE__ */ n("div", { ref: He, className: "ll-expanded__video" }),
|
|
1032
|
+
A === "connecting" && /* @__PURE__ */ L("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
|
|
1033
|
+
/* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
|
|
1034
|
+
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: g ? "Switching..." : "Connecting..." })
|
|
975
1035
|
] }),
|
|
976
|
-
|
|
1036
|
+
M && Q && /* @__PURE__ */ L(
|
|
977
1037
|
"button",
|
|
978
1038
|
{
|
|
979
1039
|
type: "button",
|
|
980
1040
|
className: "ll-expanded__overlay ll-expanded__overlay--gesture",
|
|
981
|
-
onClick:
|
|
1041
|
+
onClick: ye,
|
|
982
1042
|
children: [
|
|
983
|
-
/* @__PURE__ */
|
|
984
|
-
/* @__PURE__ */
|
|
1043
|
+
/* @__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" }) }),
|
|
1044
|
+
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
|
|
985
1045
|
]
|
|
986
1046
|
}
|
|
987
1047
|
),
|
|
988
|
-
|
|
989
|
-
/* @__PURE__ */
|
|
990
|
-
/* @__PURE__ */
|
|
991
|
-
/* @__PURE__ */
|
|
1048
|
+
_e ? /* @__PURE__ */ L("div", { className: "ll-expanded__topbar", children: [
|
|
1049
|
+
/* @__PURE__ */ L("div", { className: "ll-expanded__topbar-left", children: [
|
|
1050
|
+
/* @__PURE__ */ L("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1051
|
+
/* @__PURE__ */ L(
|
|
992
1052
|
"button",
|
|
993
1053
|
{
|
|
994
1054
|
type: "button",
|
|
995
1055
|
className: "ll-hpill",
|
|
996
1056
|
onClick: (h) => {
|
|
997
|
-
|
|
1057
|
+
fe && (h.stopPropagation(), a());
|
|
998
1058
|
},
|
|
999
|
-
"aria-haspopup":
|
|
1000
|
-
"aria-expanded":
|
|
1059
|
+
"aria-haspopup": fe ? "listbox" : void 0,
|
|
1060
|
+
"aria-expanded": fe ? p : void 0,
|
|
1001
1061
|
children: [
|
|
1002
|
-
/* @__PURE__ */
|
|
1003
|
-
|
|
1062
|
+
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
|
|
1063
|
+
fe && /* @__PURE__ */ n(Fe, {})
|
|
1004
1064
|
]
|
|
1005
1065
|
}
|
|
1006
1066
|
),
|
|
1007
|
-
|
|
1067
|
+
fe && p && /* @__PURE__ */ n(
|
|
1008
1068
|
"div",
|
|
1009
1069
|
{
|
|
1010
1070
|
className: "ll-hmenu",
|
|
1011
1071
|
onClick: (h) => h.stopPropagation(),
|
|
1012
1072
|
role: "listbox",
|
|
1013
|
-
children:
|
|
1073
|
+
children: d == null ? void 0 : d.map((h) => /* @__PURE__ */ L(
|
|
1014
1074
|
"button",
|
|
1015
1075
|
{
|
|
1016
1076
|
type: "button",
|
|
1017
|
-
className: `ll-hmenu__item ${h.id ===
|
|
1018
|
-
onClick: () =>
|
|
1077
|
+
className: `ll-hmenu__item ${h.id === u ? "is-active" : ""}`,
|
|
1078
|
+
onClick: () => c(h.id),
|
|
1019
1079
|
role: "option",
|
|
1020
|
-
"aria-selected": h.id ===
|
|
1080
|
+
"aria-selected": h.id === u,
|
|
1021
1081
|
children: [
|
|
1022
|
-
h.avatarImageUrl && /* @__PURE__ */
|
|
1082
|
+
h.avatarImageUrl && /* @__PURE__ */ n(
|
|
1023
1083
|
"img",
|
|
1024
1084
|
{
|
|
1025
1085
|
src: h.avatarImageUrl,
|
|
@@ -1027,8 +1087,8 @@ const St = ({
|
|
|
1027
1087
|
className: "ll-hmenu__avatar"
|
|
1028
1088
|
}
|
|
1029
1089
|
),
|
|
1030
|
-
/* @__PURE__ */
|
|
1031
|
-
h.role && /* @__PURE__ */
|
|
1090
|
+
/* @__PURE__ */ n("span", { className: "ll-hmenu__name", children: h.name }),
|
|
1091
|
+
h.role && /* @__PURE__ */ n("span", { className: "ll-hmenu__role", children: h.role })
|
|
1032
1092
|
]
|
|
1033
1093
|
},
|
|
1034
1094
|
h.id
|
|
@@ -1036,301 +1096,316 @@ const St = ({
|
|
|
1036
1096
|
}
|
|
1037
1097
|
)
|
|
1038
1098
|
] }),
|
|
1039
|
-
/* @__PURE__ */
|
|
1040
|
-
/* @__PURE__ */
|
|
1099
|
+
/* @__PURE__ */ L("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1100
|
+
/* @__PURE__ */ L(
|
|
1041
1101
|
"button",
|
|
1042
1102
|
{
|
|
1043
1103
|
type: "button",
|
|
1044
1104
|
className: "ll-hpill ll-hpill--compact",
|
|
1045
1105
|
onClick: (h) => {
|
|
1046
|
-
h.stopPropagation(),
|
|
1106
|
+
h.stopPropagation(), E();
|
|
1047
1107
|
},
|
|
1048
1108
|
"aria-haspopup": "listbox",
|
|
1049
|
-
"aria-expanded":
|
|
1109
|
+
"aria-expanded": N,
|
|
1050
1110
|
"aria-label": "Language: English",
|
|
1051
1111
|
title: "Language: English",
|
|
1052
1112
|
children: [
|
|
1053
|
-
/* @__PURE__ */
|
|
1054
|
-
/* @__PURE__ */
|
|
1113
|
+
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: "EN" }),
|
|
1114
|
+
/* @__PURE__ */ n(Fe, {})
|
|
1055
1115
|
]
|
|
1056
1116
|
}
|
|
1057
1117
|
),
|
|
1058
|
-
|
|
1118
|
+
N && /* @__PURE__ */ n(
|
|
1059
1119
|
"div",
|
|
1060
1120
|
{
|
|
1061
1121
|
className: "ll-hmenu",
|
|
1062
1122
|
onClick: (h) => h.stopPropagation(),
|
|
1063
1123
|
role: "listbox",
|
|
1064
|
-
children: /* @__PURE__ */
|
|
1124
|
+
children: /* @__PURE__ */ n(
|
|
1065
1125
|
"button",
|
|
1066
1126
|
{
|
|
1067
1127
|
type: "button",
|
|
1068
1128
|
className: "ll-hmenu__item is-active",
|
|
1069
1129
|
role: "option",
|
|
1070
1130
|
"aria-selected": !0,
|
|
1071
|
-
children: /* @__PURE__ */
|
|
1131
|
+
children: /* @__PURE__ */ n("span", { className: "ll-hmenu__name", children: "English" })
|
|
1072
1132
|
}
|
|
1073
1133
|
)
|
|
1074
1134
|
}
|
|
1075
1135
|
)
|
|
1076
1136
|
] }),
|
|
1077
|
-
/* @__PURE__ */
|
|
1137
|
+
/* @__PURE__ */ n(
|
|
1078
1138
|
"span",
|
|
1079
1139
|
{
|
|
1080
|
-
className: `ll-expanded__state ll-expanded__state--${
|
|
1081
|
-
children:
|
|
1140
|
+
className: `ll-expanded__state ll-expanded__state--${z}`,
|
|
1141
|
+
children: z
|
|
1082
1142
|
}
|
|
1083
1143
|
)
|
|
1084
1144
|
] }),
|
|
1085
|
-
/* @__PURE__ */
|
|
1086
|
-
/* @__PURE__ */
|
|
1145
|
+
/* @__PURE__ */ L("div", { className: "ll-expanded__header-actions", children: [
|
|
1146
|
+
/* @__PURE__ */ n(
|
|
1087
1147
|
"button",
|
|
1088
1148
|
{
|
|
1089
1149
|
type: "button",
|
|
1090
1150
|
className: "ll-hbtn",
|
|
1091
|
-
onClick:
|
|
1151
|
+
onClick: Be,
|
|
1092
1152
|
"aria-label": "Minimize widget",
|
|
1093
1153
|
title: "Minimize",
|
|
1094
|
-
children: /* @__PURE__ */
|
|
1154
|
+
children: /* @__PURE__ */ n(Rt, {})
|
|
1095
1155
|
}
|
|
1096
1156
|
),
|
|
1097
|
-
/* @__PURE__ */
|
|
1157
|
+
/* @__PURE__ */ n(
|
|
1098
1158
|
"button",
|
|
1099
1159
|
{
|
|
1100
1160
|
type: "button",
|
|
1101
1161
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1102
|
-
onClick:
|
|
1103
|
-
"aria-label": "End
|
|
1104
|
-
title: "End
|
|
1105
|
-
children: /* @__PURE__ */
|
|
1162
|
+
onClick: Ce,
|
|
1163
|
+
"aria-label": "End call",
|
|
1164
|
+
title: "End call",
|
|
1165
|
+
children: /* @__PURE__ */ n(Mt, {})
|
|
1106
1166
|
}
|
|
1107
1167
|
)
|
|
1108
1168
|
] })
|
|
1109
1169
|
] }) : (
|
|
1110
1170
|
// Idle-state header with Live Layer product name + minimize/close
|
|
1111
|
-
/* @__PURE__ */
|
|
1112
|
-
/* @__PURE__ */
|
|
1113
|
-
/* @__PURE__ */
|
|
1114
|
-
/* @__PURE__ */
|
|
1171
|
+
/* @__PURE__ */ L("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
|
|
1172
|
+
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Ge }),
|
|
1173
|
+
/* @__PURE__ */ L("div", { className: "ll-expanded__header-actions", children: [
|
|
1174
|
+
/* @__PURE__ */ n(
|
|
1115
1175
|
"button",
|
|
1116
1176
|
{
|
|
1117
1177
|
type: "button",
|
|
1118
1178
|
className: "ll-hbtn ll-hbtn--ghost",
|
|
1119
|
-
onClick:
|
|
1179
|
+
onClick: Be,
|
|
1120
1180
|
"aria-label": "Minimize widget",
|
|
1121
|
-
children: /* @__PURE__ */
|
|
1181
|
+
children: /* @__PURE__ */ n(Rt, {})
|
|
1122
1182
|
}
|
|
1123
1183
|
),
|
|
1124
|
-
/* @__PURE__ */
|
|
1184
|
+
/* @__PURE__ */ n(
|
|
1125
1185
|
"button",
|
|
1126
1186
|
{
|
|
1127
1187
|
type: "button",
|
|
1128
1188
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1129
|
-
onClick:
|
|
1189
|
+
onClick: Ce,
|
|
1130
1190
|
"aria-label": "Close widget",
|
|
1131
|
-
children: /* @__PURE__ */
|
|
1191
|
+
children: /* @__PURE__ */ n(Mt, {})
|
|
1132
1192
|
}
|
|
1133
1193
|
)
|
|
1134
1194
|
] })
|
|
1135
1195
|
] })
|
|
1136
1196
|
),
|
|
1137
|
-
|
|
1138
|
-
"
|
|
1139
|
-
{
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1197
|
+
W && /* @__PURE__ */ (() => {
|
|
1198
|
+
const h = $ ? "Restart paused session" : A === "disconnected" ? "Reconnect to agent" : "Start video call", q = $ ? "Pick up where you left off" : null;
|
|
1199
|
+
return /* @__PURE__ */ L($t, { children: [
|
|
1200
|
+
A === "idle" && !$ && !D && /* @__PURE__ */ L(
|
|
1201
|
+
"button",
|
|
1202
|
+
{
|
|
1203
|
+
type: "button",
|
|
1204
|
+
className: "ll-expanded__play",
|
|
1205
|
+
onClick: ue,
|
|
1206
|
+
"aria-label": h,
|
|
1207
|
+
children: [
|
|
1208
|
+
/* @__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" }) }) }),
|
|
1209
|
+
/* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: h })
|
|
1210
|
+
]
|
|
1211
|
+
}
|
|
1212
|
+
),
|
|
1213
|
+
/* @__PURE__ */ L("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
|
|
1214
|
+
l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
|
|
1215
|
+
q && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: q }),
|
|
1216
|
+
/* @__PURE__ */ n(
|
|
1217
|
+
"button",
|
|
1218
|
+
{
|
|
1219
|
+
type: "button",
|
|
1220
|
+
className: "ll-expanded__cta",
|
|
1221
|
+
onClick: ue,
|
|
1222
|
+
"aria-label": h,
|
|
1223
|
+
children: h
|
|
1224
|
+
}
|
|
1225
|
+
)
|
|
1226
|
+
] })
|
|
1227
|
+
] });
|
|
1228
|
+
})(),
|
|
1229
|
+
/* @__PURE__ */ L(
|
|
1152
1230
|
"div",
|
|
1153
1231
|
{
|
|
1154
|
-
className: `ll-expanded__pip ${
|
|
1232
|
+
className: `ll-expanded__pip ${_e && (w || X) ? "is-visible" : ""}`,
|
|
1155
1233
|
children: [
|
|
1156
|
-
/* @__PURE__ */
|
|
1234
|
+
/* @__PURE__ */ n(
|
|
1157
1235
|
"div",
|
|
1158
1236
|
{
|
|
1159
|
-
ref:
|
|
1160
|
-
className:
|
|
1237
|
+
ref: ie,
|
|
1238
|
+
className: X ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1161
1239
|
}
|
|
1162
1240
|
),
|
|
1163
|
-
/* @__PURE__ */
|
|
1241
|
+
/* @__PURE__ */ n(
|
|
1164
1242
|
"div",
|
|
1165
1243
|
{
|
|
1166
|
-
ref:
|
|
1167
|
-
className:
|
|
1244
|
+
ref: Ne,
|
|
1245
|
+
className: !X && w ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1168
1246
|
}
|
|
1169
1247
|
)
|
|
1170
1248
|
]
|
|
1171
1249
|
}
|
|
1172
1250
|
),
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
/* @__PURE__ */
|
|
1176
|
-
|
|
1251
|
+
_e ? /* @__PURE__ */ L("div", { className: "ll-expanded__bottom", children: [
|
|
1252
|
+
xe && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: xe }) }),
|
|
1253
|
+
/* @__PURE__ */ L("div", { className: "ll-toolbar", onClick: (h) => h.stopPropagation(), children: [
|
|
1254
|
+
$e && /* @__PURE__ */ n(
|
|
1177
1255
|
"button",
|
|
1178
1256
|
{
|
|
1179
1257
|
type: "button",
|
|
1180
|
-
className: `ll-tool ${
|
|
1181
|
-
onClick:
|
|
1182
|
-
"aria-label":
|
|
1183
|
-
title:
|
|
1184
|
-
children: /* @__PURE__ */
|
|
1258
|
+
className: `ll-tool ${X ? "is-on" : ""}`,
|
|
1259
|
+
onClick: B,
|
|
1260
|
+
"aria-label": X ? "Stop sharing screen" : "Share screen",
|
|
1261
|
+
title: X ? "Stop sharing" : "Share screen",
|
|
1262
|
+
children: /* @__PURE__ */ n(Fn, {})
|
|
1185
1263
|
}
|
|
1186
1264
|
),
|
|
1187
|
-
|
|
1188
|
-
/* @__PURE__ */
|
|
1265
|
+
De && /* @__PURE__ */ L("div", { className: "ll-tool-split", children: [
|
|
1266
|
+
/* @__PURE__ */ n(
|
|
1189
1267
|
"button",
|
|
1190
1268
|
{
|
|
1191
1269
|
type: "button",
|
|
1192
|
-
className: `ll-tool ll-tool--left ${
|
|
1193
|
-
onClick:
|
|
1194
|
-
"aria-label":
|
|
1195
|
-
title:
|
|
1196
|
-
children: /* @__PURE__ */
|
|
1270
|
+
className: `ll-tool ll-tool--left ${w ? "is-on" : ""}`,
|
|
1271
|
+
onClick: be,
|
|
1272
|
+
"aria-label": w ? "Turn off camera" : "Turn on camera",
|
|
1273
|
+
title: w ? "Stop camera" : "Start camera",
|
|
1274
|
+
children: /* @__PURE__ */ n(qn, {})
|
|
1197
1275
|
}
|
|
1198
1276
|
),
|
|
1199
|
-
/* @__PURE__ */
|
|
1277
|
+
/* @__PURE__ */ n(
|
|
1200
1278
|
"button",
|
|
1201
1279
|
{
|
|
1202
1280
|
type: "button",
|
|
1203
|
-
className: `ll-tool ll-tool--right ${
|
|
1281
|
+
className: `ll-tool ll-tool--right ${w ? "is-on" : ""}`,
|
|
1204
1282
|
onClick: (h) => {
|
|
1205
|
-
h.stopPropagation(),
|
|
1283
|
+
h.stopPropagation(), V((q) => !q), ne(!1);
|
|
1206
1284
|
},
|
|
1207
1285
|
"aria-label": "Camera devices",
|
|
1208
1286
|
"aria-haspopup": "listbox",
|
|
1209
|
-
"aria-expanded":
|
|
1210
|
-
children: /* @__PURE__ */
|
|
1287
|
+
"aria-expanded": oe,
|
|
1288
|
+
children: /* @__PURE__ */ n(Fe, {})
|
|
1211
1289
|
}
|
|
1212
1290
|
),
|
|
1213
|
-
|
|
1214
|
-
|
|
1291
|
+
oe && K.length > 0 && /* @__PURE__ */ n(
|
|
1292
|
+
Tt,
|
|
1215
1293
|
{
|
|
1216
1294
|
label: "Camera",
|
|
1217
|
-
devices:
|
|
1218
|
-
activeId:
|
|
1295
|
+
devices: K,
|
|
1296
|
+
activeId: se,
|
|
1219
1297
|
onPick: (h) => {
|
|
1220
|
-
|
|
1298
|
+
V(!1), we(h);
|
|
1221
1299
|
}
|
|
1222
1300
|
}
|
|
1223
1301
|
)
|
|
1224
1302
|
] }),
|
|
1225
|
-
/* @__PURE__ */
|
|
1226
|
-
/* @__PURE__ */
|
|
1303
|
+
/* @__PURE__ */ L("div", { className: "ll-tool-split", children: [
|
|
1304
|
+
/* @__PURE__ */ n(
|
|
1227
1305
|
"button",
|
|
1228
1306
|
{
|
|
1229
1307
|
type: "button",
|
|
1230
|
-
className: `ll-tool ll-tool--left ${
|
|
1231
|
-
onClick:
|
|
1232
|
-
"aria-label":
|
|
1233
|
-
title:
|
|
1234
|
-
children: /* @__PURE__ */
|
|
1308
|
+
className: `ll-tool ll-tool--left ${m ? "is-muted" : ""}`,
|
|
1309
|
+
onClick: ve,
|
|
1310
|
+
"aria-label": m ? "Unmute microphone" : "Mute microphone",
|
|
1311
|
+
title: m ? "Unmute" : "Mute",
|
|
1312
|
+
children: /* @__PURE__ */ n(jn, { muted: m })
|
|
1235
1313
|
}
|
|
1236
1314
|
),
|
|
1237
|
-
/* @__PURE__ */
|
|
1315
|
+
/* @__PURE__ */ n(
|
|
1238
1316
|
"button",
|
|
1239
1317
|
{
|
|
1240
1318
|
type: "button",
|
|
1241
|
-
className: `ll-tool ll-tool--right ${
|
|
1319
|
+
className: `ll-tool ll-tool--right ${m ? "is-muted" : ""}`,
|
|
1242
1320
|
onClick: (h) => {
|
|
1243
|
-
h.stopPropagation(),
|
|
1321
|
+
h.stopPropagation(), ne((q) => !q), V(!1);
|
|
1244
1322
|
},
|
|
1245
1323
|
"aria-label": "Microphone devices",
|
|
1246
1324
|
"aria-haspopup": "listbox",
|
|
1247
|
-
"aria-expanded":
|
|
1248
|
-
children: /* @__PURE__ */
|
|
1325
|
+
"aria-expanded": Y,
|
|
1326
|
+
children: /* @__PURE__ */ n(Fe, {})
|
|
1249
1327
|
}
|
|
1250
1328
|
),
|
|
1251
|
-
|
|
1252
|
-
|
|
1329
|
+
Y && C.length > 0 && /* @__PURE__ */ n(
|
|
1330
|
+
Tt,
|
|
1253
1331
|
{
|
|
1254
1332
|
label: "Microphone",
|
|
1255
|
-
devices:
|
|
1333
|
+
devices: C,
|
|
1256
1334
|
activeId: "",
|
|
1257
|
-
onPick: () =>
|
|
1335
|
+
onPick: () => ne(!1)
|
|
1258
1336
|
}
|
|
1259
1337
|
)
|
|
1260
1338
|
] }),
|
|
1261
|
-
/* @__PURE__ */
|
|
1339
|
+
/* @__PURE__ */ n(
|
|
1262
1340
|
"button",
|
|
1263
1341
|
{
|
|
1264
1342
|
type: "button",
|
|
1265
|
-
className: `ll-tool ${
|
|
1266
|
-
onClick:
|
|
1267
|
-
"aria-label":
|
|
1268
|
-
title:
|
|
1269
|
-
children: /* @__PURE__ */
|
|
1343
|
+
className: `ll-tool ${de ? "is-muted" : ""}`,
|
|
1344
|
+
onClick: Ye,
|
|
1345
|
+
"aria-label": de ? "Unmute speaker" : "Mute speaker",
|
|
1346
|
+
title: de ? "Unmute speaker" : "Mute speaker",
|
|
1347
|
+
children: /* @__PURE__ */ n(Wn, { muted: de })
|
|
1270
1348
|
}
|
|
1271
1349
|
)
|
|
1272
1350
|
] }),
|
|
1273
|
-
|
|
1274
|
-
/* @__PURE__ */
|
|
1351
|
+
ze && /* @__PURE__ */ L("form", { className: "ll-message-input", onSubmit: Ae, children: [
|
|
1352
|
+
/* @__PURE__ */ n(
|
|
1275
1353
|
"input",
|
|
1276
1354
|
{
|
|
1277
1355
|
type: "text",
|
|
1278
1356
|
className: "ll-message-input__field",
|
|
1279
1357
|
placeholder: "Message...",
|
|
1280
|
-
value:
|
|
1281
|
-
onChange: (h) =>
|
|
1358
|
+
value: G,
|
|
1359
|
+
onChange: (h) => le(h.target.value),
|
|
1282
1360
|
"aria-label": "Message the agent"
|
|
1283
1361
|
}
|
|
1284
1362
|
),
|
|
1285
|
-
|
|
1363
|
+
G.trim() && /* @__PURE__ */ n(
|
|
1286
1364
|
"button",
|
|
1287
1365
|
{
|
|
1288
1366
|
type: "submit",
|
|
1289
1367
|
className: "ll-message-input__send",
|
|
1290
1368
|
"aria-label": "Send message",
|
|
1291
|
-
children: /* @__PURE__ */
|
|
1369
|
+
children: /* @__PURE__ */ n(Vn, {})
|
|
1292
1370
|
}
|
|
1293
1371
|
)
|
|
1294
1372
|
] }),
|
|
1295
|
-
/* @__PURE__ */
|
|
1373
|
+
/* @__PURE__ */ n(
|
|
1296
1374
|
"button",
|
|
1297
1375
|
{
|
|
1298
1376
|
type: "button",
|
|
1299
1377
|
className: "ll-expanded__end",
|
|
1300
|
-
onClick:
|
|
1378
|
+
onClick: me,
|
|
1301
1379
|
children: "End conversation"
|
|
1302
1380
|
}
|
|
1303
1381
|
)
|
|
1304
|
-
] }) :
|
|
1305
|
-
// Idle-state footer: start button + greeting
|
|
1306
|
-
s && /* @__PURE__ */ e("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: /* @__PURE__ */ e("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ e("p", { className: "ll-expanded__transcript-text", children: s }) }) })
|
|
1307
|
-
),
|
|
1382
|
+
] }) : null,
|
|
1308
1383
|
(() => {
|
|
1309
|
-
if (
|
|
1310
|
-
return /* @__PURE__ */
|
|
1311
|
-
/* @__PURE__ */
|
|
1312
|
-
/* @__PURE__ */
|
|
1384
|
+
if (y && A !== "error")
|
|
1385
|
+
return /* @__PURE__ */ L("div", { className: "ll-expanded__banner", role: "alert", children: [
|
|
1386
|
+
/* @__PURE__ */ n("span", { children: y }),
|
|
1387
|
+
/* @__PURE__ */ n(
|
|
1313
1388
|
"button",
|
|
1314
1389
|
{
|
|
1315
1390
|
type: "button",
|
|
1316
1391
|
className: "ll-expanded__banner-x",
|
|
1317
|
-
onClick:
|
|
1392
|
+
onClick: Se,
|
|
1318
1393
|
"aria-label": "Dismiss",
|
|
1319
1394
|
children: "×"
|
|
1320
1395
|
}
|
|
1321
1396
|
)
|
|
1322
1397
|
] });
|
|
1323
|
-
if (!
|
|
1324
|
-
let h = "Failed to connect",
|
|
1325
|
-
return
|
|
1326
|
-
/* @__PURE__ */
|
|
1327
|
-
/* @__PURE__ */
|
|
1398
|
+
if (!D || A !== "error") return null;
|
|
1399
|
+
let h = "Failed to connect", q = "Try again";
|
|
1400
|
+
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__ */ L("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
|
|
1401
|
+
/* @__PURE__ */ n("span", { children: h }),
|
|
1402
|
+
/* @__PURE__ */ n(
|
|
1328
1403
|
"button",
|
|
1329
1404
|
{
|
|
1330
1405
|
type: "button",
|
|
1331
1406
|
className: "ll-expanded__banner-retry",
|
|
1332
|
-
onClick:
|
|
1333
|
-
children:
|
|
1407
|
+
onClick: ge,
|
|
1408
|
+
children: q
|
|
1334
1409
|
}
|
|
1335
1410
|
)
|
|
1336
1411
|
] });
|
|
@@ -1339,83 +1414,317 @@ const St = ({
|
|
|
1339
1414
|
}
|
|
1340
1415
|
);
|
|
1341
1416
|
};
|
|
1342
|
-
function
|
|
1343
|
-
return /* @__PURE__ */
|
|
1417
|
+
function Fe() {
|
|
1418
|
+
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" }) });
|
|
1344
1419
|
}
|
|
1345
|
-
function
|
|
1346
|
-
return /* @__PURE__ */
|
|
1347
|
-
/* @__PURE__ */
|
|
1348
|
-
/* @__PURE__ */
|
|
1420
|
+
function Mt() {
|
|
1421
|
+
return /* @__PURE__ */ L("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
|
|
1422
|
+
/* @__PURE__ */ n("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1423
|
+
/* @__PURE__ */ n("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1349
1424
|
] });
|
|
1350
1425
|
}
|
|
1351
|
-
function
|
|
1352
|
-
return /* @__PURE__ */
|
|
1426
|
+
function Rt() {
|
|
1427
|
+
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" }) });
|
|
1353
1428
|
}
|
|
1354
|
-
function
|
|
1355
|
-
return /* @__PURE__ */
|
|
1356
|
-
/* @__PURE__ */
|
|
1357
|
-
/* @__PURE__ */
|
|
1358
|
-
/* @__PURE__ */
|
|
1429
|
+
function Fn() {
|
|
1430
|
+
return /* @__PURE__ */ L("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: [
|
|
1431
|
+
/* @__PURE__ */ n("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
|
|
1432
|
+
/* @__PURE__ */ n("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
|
|
1433
|
+
/* @__PURE__ */ n("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
|
|
1359
1434
|
] });
|
|
1360
1435
|
}
|
|
1361
|
-
function
|
|
1362
|
-
return /* @__PURE__ */
|
|
1363
|
-
/* @__PURE__ */
|
|
1364
|
-
/* @__PURE__ */
|
|
1436
|
+
function qn() {
|
|
1437
|
+
return /* @__PURE__ */ L("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: [
|
|
1438
|
+
/* @__PURE__ */ n("path", { d: "M23 7l-7 5 7 5V7z" }),
|
|
1439
|
+
/* @__PURE__ */ n("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
|
|
1365
1440
|
] });
|
|
1366
1441
|
}
|
|
1367
|
-
function
|
|
1368
|
-
return /* @__PURE__ */
|
|
1369
|
-
/* @__PURE__ */
|
|
1370
|
-
/* @__PURE__ */
|
|
1371
|
-
/* @__PURE__ */
|
|
1372
|
-
|
|
1442
|
+
function jn({ muted: e }) {
|
|
1443
|
+
return /* @__PURE__ */ L("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: [
|
|
1444
|
+
/* @__PURE__ */ n("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
|
|
1445
|
+
/* @__PURE__ */ n("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
|
|
1446
|
+
/* @__PURE__ */ n("line", { x1: "12", y1: "19", x2: "12", y2: "23" }),
|
|
1447
|
+
e && /* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
1373
1448
|
] });
|
|
1374
1449
|
}
|
|
1375
|
-
function
|
|
1376
|
-
return /* @__PURE__ */
|
|
1377
|
-
/* @__PURE__ */
|
|
1378
|
-
|
|
1379
|
-
/* @__PURE__ */
|
|
1380
|
-
/* @__PURE__ */
|
|
1450
|
+
function Wn({ muted: e }) {
|
|
1451
|
+
return /* @__PURE__ */ L("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: [
|
|
1452
|
+
/* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
1453
|
+
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ L($t, { children: [
|
|
1454
|
+
/* @__PURE__ */ n("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
|
|
1455
|
+
/* @__PURE__ */ n("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
|
|
1381
1456
|
] })
|
|
1382
1457
|
] });
|
|
1383
1458
|
}
|
|
1384
|
-
function
|
|
1385
|
-
return /* @__PURE__ */
|
|
1386
|
-
/* @__PURE__ */
|
|
1387
|
-
/* @__PURE__ */
|
|
1459
|
+
function Vn() {
|
|
1460
|
+
return /* @__PURE__ */ L("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1461
|
+
/* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
|
|
1462
|
+
/* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
|
|
1388
1463
|
] });
|
|
1389
1464
|
}
|
|
1390
|
-
const
|
|
1465
|
+
const Tt = ({ label: e, devices: t, activeId: r, onPick: i }) => /* @__PURE__ */ L(
|
|
1391
1466
|
"div",
|
|
1392
1467
|
{
|
|
1393
1468
|
className: "ll-device-menu",
|
|
1394
|
-
onClick: (
|
|
1469
|
+
onClick: (o) => o.stopPropagation(),
|
|
1395
1470
|
role: "listbox",
|
|
1396
1471
|
children: [
|
|
1397
|
-
/* @__PURE__ */
|
|
1398
|
-
|
|
1399
|
-
const
|
|
1400
|
-
return /* @__PURE__ */
|
|
1472
|
+
/* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
|
|
1473
|
+
t.map((o, l) => {
|
|
1474
|
+
const s = r === o.deviceId;
|
|
1475
|
+
return /* @__PURE__ */ L(
|
|
1401
1476
|
"button",
|
|
1402
1477
|
{
|
|
1403
1478
|
type: "button",
|
|
1404
|
-
className: `ll-device-menu__item ${
|
|
1405
|
-
onClick: () =>
|
|
1479
|
+
className: `ll-device-menu__item ${s ? "is-active" : ""}`,
|
|
1480
|
+
onClick: () => i(o.deviceId),
|
|
1406
1481
|
role: "option",
|
|
1407
|
-
"aria-selected":
|
|
1482
|
+
"aria-selected": s,
|
|
1408
1483
|
children: [
|
|
1409
|
-
|
|
1410
|
-
/* @__PURE__ */
|
|
1484
|
+
s && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
|
|
1485
|
+
/* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: o.label || `${e} ${l + 1}` })
|
|
1411
1486
|
]
|
|
1412
1487
|
},
|
|
1413
|
-
|
|
1488
|
+
o.deviceId || l
|
|
1414
1489
|
);
|
|
1415
1490
|
})
|
|
1416
1491
|
]
|
|
1417
1492
|
}
|
|
1418
|
-
),
|
|
1493
|
+
), Yn = [
|
|
1494
|
+
'[data-ll-private="true"]',
|
|
1495
|
+
".ll-widget"
|
|
1496
|
+
];
|
|
1497
|
+
function it(e) {
|
|
1498
|
+
let t = e;
|
|
1499
|
+
for (; t; ) {
|
|
1500
|
+
for (const r of Yn)
|
|
1501
|
+
if (t.matches(r)) return !0;
|
|
1502
|
+
t = t.parentElement;
|
|
1503
|
+
}
|
|
1504
|
+
return !1;
|
|
1505
|
+
}
|
|
1506
|
+
function Ve(e) {
|
|
1507
|
+
if (it(e)) return !1;
|
|
1508
|
+
if (e instanceof HTMLInputElement) {
|
|
1509
|
+
if (e.type === "password") return !1;
|
|
1510
|
+
const t = (e.getAttribute("autocomplete") || "").toLowerCase();
|
|
1511
|
+
if (t === "off" || t.startsWith("cc-")) return !1;
|
|
1512
|
+
}
|
|
1513
|
+
return !0;
|
|
1514
|
+
}
|
|
1515
|
+
const qe = 4096, Gn = 20, Kn = 20, Xn = 10, Jn = 10, Qn = 30, It = 500, Zn = [
|
|
1516
|
+
'[data-ll-private="true"]',
|
|
1517
|
+
".ll-widget",
|
|
1518
|
+
"script",
|
|
1519
|
+
"style",
|
|
1520
|
+
"noscript",
|
|
1521
|
+
"iframe"
|
|
1522
|
+
];
|
|
1523
|
+
function Ie(e) {
|
|
1524
|
+
if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
|
|
1525
|
+
let t = e;
|
|
1526
|
+
for (; t; ) {
|
|
1527
|
+
for (const r of Zn)
|
|
1528
|
+
if (t.matches(r)) return !0;
|
|
1529
|
+
t = t.parentElement;
|
|
1530
|
+
}
|
|
1531
|
+
return !1;
|
|
1532
|
+
}
|
|
1533
|
+
function Pe(e) {
|
|
1534
|
+
if (typeof window > "u") return !0;
|
|
1535
|
+
const t = e.getBoundingClientRect();
|
|
1536
|
+
if (t.width <= 0 || t.height <= 0) return !1;
|
|
1537
|
+
const r = window.innerHeight || document.documentElement.clientHeight, i = window.innerWidth || document.documentElement.clientWidth;
|
|
1538
|
+
return t.bottom > 0 && t.right > 0 && t.top < r && t.left < i;
|
|
1539
|
+
}
|
|
1540
|
+
function Pt(e) {
|
|
1541
|
+
const t = e.getAttribute("id");
|
|
1542
|
+
if (t) {
|
|
1543
|
+
const l = document.querySelector(`label[for="${CSS.escape(t)}"]`);
|
|
1544
|
+
if (l != null && l.textContent) return l.textContent.trim();
|
|
1545
|
+
}
|
|
1546
|
+
const r = e.getAttribute("aria-label");
|
|
1547
|
+
if (r) return r.trim();
|
|
1548
|
+
const i = e.getAttribute("placeholder");
|
|
1549
|
+
if (i) return i.trim();
|
|
1550
|
+
const o = e.closest("label");
|
|
1551
|
+
return o != null && o.textContent ? o.textContent.trim() : "";
|
|
1552
|
+
}
|
|
1553
|
+
function he(e, t) {
|
|
1554
|
+
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
1555
|
+
}
|
|
1556
|
+
function ke(e) {
|
|
1557
|
+
return e.length;
|
|
1558
|
+
}
|
|
1559
|
+
function er(e, t = {}) {
|
|
1560
|
+
const r = t.doc ?? (typeof document < "u" ? document : null);
|
|
1561
|
+
if (!r)
|
|
1562
|
+
return {
|
|
1563
|
+
url: "",
|
|
1564
|
+
title: "",
|
|
1565
|
+
pathname: "/",
|
|
1566
|
+
regions: [],
|
|
1567
|
+
visibleText: "",
|
|
1568
|
+
visibleLinks: [],
|
|
1569
|
+
visibleFields: [],
|
|
1570
|
+
forms: [],
|
|
1571
|
+
extras: e
|
|
1572
|
+
};
|
|
1573
|
+
const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "", s = Array.from(
|
|
1574
|
+
r.querySelectorAll("[data-ll-region]")
|
|
1575
|
+
), d = [];
|
|
1576
|
+
for (const m of s) {
|
|
1577
|
+
if (d.length >= Xn) break;
|
|
1578
|
+
if (Ie(m) || !Pe(m)) continue;
|
|
1579
|
+
const y = m.getAttribute("data-ll-region") ?? "", C = m.getAttribute("data-ll-intent") ?? void 0, w = he(
|
|
1580
|
+
(m.innerText || m.textContent || "").trim(),
|
|
1581
|
+
It * 2
|
|
1582
|
+
);
|
|
1583
|
+
!y || !w || d.push({ id: y, intent: C, text: w });
|
|
1584
|
+
}
|
|
1585
|
+
const u = [], g = ["H1", "H2", "H3", "H4", "H5", "H6"], p = Array.from(
|
|
1586
|
+
r.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
|
1587
|
+
);
|
|
1588
|
+
for (const m of p) {
|
|
1589
|
+
if (Ie(m) || !Pe(m)) continue;
|
|
1590
|
+
const y = (m.textContent || "").trim();
|
|
1591
|
+
y && u.push(`${m.tagName}: ${he(y, 200)}`);
|
|
1592
|
+
}
|
|
1593
|
+
const a = Array.from(r.querySelectorAll("p, li"));
|
|
1594
|
+
for (const m of a) {
|
|
1595
|
+
if (Ie(m) || !Pe(m) || g.includes(m.tagName)) continue;
|
|
1596
|
+
const y = (m.textContent || "").trim();
|
|
1597
|
+
y.length > 10 && u.push(he(y, It));
|
|
1598
|
+
}
|
|
1599
|
+
const c = u.join(`
|
|
1600
|
+
`), N = [], E = Array.from(r.querySelectorAll("a[href]"));
|
|
1601
|
+
for (const m of E) {
|
|
1602
|
+
if (N.length >= Gn) break;
|
|
1603
|
+
if (Ie(m) || !Pe(m)) continue;
|
|
1604
|
+
const y = m.getAttribute("href") || "", C = (m.textContent || "").trim();
|
|
1605
|
+
!y || !C || N.push({ href: y, text: he(C, 100) });
|
|
1606
|
+
}
|
|
1607
|
+
const A = [], z = Array.from(
|
|
1608
|
+
r.querySelectorAll(
|
|
1609
|
+
"input, textarea, select"
|
|
1610
|
+
)
|
|
1611
|
+
);
|
|
1612
|
+
for (const m of z) {
|
|
1613
|
+
if (A.length >= Kn) break;
|
|
1614
|
+
if (Ie(m) || !Ve(m) || !Pe(m)) continue;
|
|
1615
|
+
const y = Pt(m), C = m instanceof HTMLInputElement ? m.type : m.tagName.toLowerCase();
|
|
1616
|
+
y && A.push({ label: he(y, 100), type: C });
|
|
1617
|
+
}
|
|
1618
|
+
const T = Array.from(
|
|
1619
|
+
r.querySelectorAll("[data-ll-form]")
|
|
1620
|
+
), $ = [];
|
|
1621
|
+
for (const m of T) {
|
|
1622
|
+
if ($.length >= Jn) break;
|
|
1623
|
+
if (it(m)) continue;
|
|
1624
|
+
const y = m.getAttribute("data-ll-form") || "";
|
|
1625
|
+
if (!y) continue;
|
|
1626
|
+
const C = m.getAttribute("data-ll-intent") || void 0, w = Array.from(
|
|
1627
|
+
m.querySelectorAll(
|
|
1628
|
+
"[data-ll-field]"
|
|
1629
|
+
)
|
|
1630
|
+
), H = [];
|
|
1631
|
+
for (const K of w) {
|
|
1632
|
+
if (H.length >= Qn) break;
|
|
1633
|
+
if (!Ve(K)) continue;
|
|
1634
|
+
const se = K.getAttribute("data-ll-field") || "";
|
|
1635
|
+
if (!se) continue;
|
|
1636
|
+
const X = Pt(K) || se, J = K instanceof HTMLInputElement ? K.type : K.tagName.toLowerCase();
|
|
1637
|
+
H.push({ name: se, label: he(X, 100), type: J });
|
|
1638
|
+
}
|
|
1639
|
+
$.push({ id: y, intent: C, fields: H });
|
|
1640
|
+
}
|
|
1641
|
+
const M = {
|
|
1642
|
+
url: i,
|
|
1643
|
+
title: l,
|
|
1644
|
+
pathname: o,
|
|
1645
|
+
regions: d,
|
|
1646
|
+
visibleText: c,
|
|
1647
|
+
visibleLinks: N,
|
|
1648
|
+
visibleFields: A,
|
|
1649
|
+
forms: $,
|
|
1650
|
+
extras: e
|
|
1651
|
+
};
|
|
1652
|
+
let D = ke(JSON.stringify(M.regions)) + ke(M.visibleText) + ke(JSON.stringify(M.visibleLinks)) + ke(JSON.stringify(M.visibleFields));
|
|
1653
|
+
for (; D > qe && M.visibleFields.length > 0; )
|
|
1654
|
+
M.visibleFields.pop(), D = ke(JSON.stringify(M.visibleFields));
|
|
1655
|
+
for (; D > qe && M.visibleLinks.length > 0; )
|
|
1656
|
+
M.visibleLinks.pop(), D -= 80;
|
|
1657
|
+
return ke(M.visibleText) > qe && (M.visibleText = he(M.visibleText, qe - 100)), M;
|
|
1658
|
+
}
|
|
1659
|
+
let Le = null;
|
|
1660
|
+
function Dt(e, t = {}) {
|
|
1661
|
+
const r = Date.now(), o = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
|
|
1662
|
+
if (Le && Le.key === o && r - Le.at < 1e3)
|
|
1663
|
+
return Le.ctx;
|
|
1664
|
+
const l = er(e, t);
|
|
1665
|
+
return Le = { key: o, at: r, ctx: l }, l;
|
|
1666
|
+
}
|
|
1667
|
+
function tr() {
|
|
1668
|
+
Le = null;
|
|
1669
|
+
}
|
|
1670
|
+
const nr = 200;
|
|
1671
|
+
function rr(e) {
|
|
1672
|
+
return !(!e || e.startsWith("#") || e.startsWith("javascript:") || e.startsWith("mailto:") || e.startsWith("tel:"));
|
|
1673
|
+
}
|
|
1674
|
+
function ir(e) {
|
|
1675
|
+
const t = e ?? (typeof document < "u" ? document : null);
|
|
1676
|
+
if (!t) return [];
|
|
1677
|
+
const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), o = [], l = Array.from(t.querySelectorAll("a[href]"));
|
|
1678
|
+
for (const s of l) {
|
|
1679
|
+
if (o.length >= nr) break;
|
|
1680
|
+
if (it(s)) continue;
|
|
1681
|
+
const d = s.getAttribute("href") || "";
|
|
1682
|
+
if (!rr(d)) continue;
|
|
1683
|
+
let u = d, g = !0;
|
|
1684
|
+
try {
|
|
1685
|
+
if (typeof window < "u") {
|
|
1686
|
+
const a = new URL(d, r);
|
|
1687
|
+
g = a.origin === r, g && d.startsWith("http") && (u = a.pathname + a.search + a.hash);
|
|
1688
|
+
}
|
|
1689
|
+
} catch {
|
|
1690
|
+
continue;
|
|
1691
|
+
}
|
|
1692
|
+
if (i.has(u)) continue;
|
|
1693
|
+
i.add(u);
|
|
1694
|
+
const p = (s.textContent || "").trim().slice(0, 120);
|
|
1695
|
+
o.push({ href: u, text: p, internal: g });
|
|
1696
|
+
}
|
|
1697
|
+
return o;
|
|
1698
|
+
}
|
|
1699
|
+
let Ee = null;
|
|
1700
|
+
const or = 5e3;
|
|
1701
|
+
function lr() {
|
|
1702
|
+
const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
|
|
1703
|
+
if (Ee && Ee.pathname === t && e - Ee.at < or)
|
|
1704
|
+
return Ee.routes;
|
|
1705
|
+
const r = ir();
|
|
1706
|
+
return Ee = { at: e, pathname: t, routes: r }, r;
|
|
1707
|
+
}
|
|
1708
|
+
function ar() {
|
|
1709
|
+
Ee = null;
|
|
1710
|
+
}
|
|
1711
|
+
function cr(e, t) {
|
|
1712
|
+
const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, i = Object.getOwnPropertyDescriptor(r, "value"), o = i == null ? void 0 : i.set;
|
|
1713
|
+
o ? o.call(e, t) : e.value = t;
|
|
1714
|
+
}
|
|
1715
|
+
function sr(e, t, r = {}) {
|
|
1716
|
+
const i = r.triggerInput ?? !0, o = r.triggerChange ?? !0;
|
|
1717
|
+
if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
|
|
1718
|
+
const l = Object.getOwnPropertyDescriptor(
|
|
1719
|
+
HTMLInputElement.prototype,
|
|
1720
|
+
"checked"
|
|
1721
|
+
), s = l == null ? void 0 : l.set, d = t === "true" || t === "1" || t === "on";
|
|
1722
|
+
s ? s.call(e, d) : e.checked = d, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
1723
|
+
return;
|
|
1724
|
+
}
|
|
1725
|
+
cr(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), o && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
1726
|
+
}
|
|
1727
|
+
const dr = /* @__PURE__ */ new Set([
|
|
1419
1728
|
"agent_state",
|
|
1420
1729
|
"avatar_stream_ready",
|
|
1421
1730
|
"avatar_active",
|
|
@@ -1423,355 +1732,840 @@ const Oe = ({ label: t, devices: n, activeId: i, onPick: l }) => /* @__PURE__ */
|
|
|
1423
1732
|
"bot_ready",
|
|
1424
1733
|
"agent_error",
|
|
1425
1734
|
"idle_warning",
|
|
1426
|
-
"idle_timeout"
|
|
1735
|
+
"idle_timeout",
|
|
1736
|
+
// 0.3.0 — page-aware commands. Handled internally by the widget.
|
|
1737
|
+
// Consumers who want observability subscribe via onAgentEvent (which
|
|
1738
|
+
// fires for every message including these).
|
|
1739
|
+
"navigate",
|
|
1740
|
+
"scroll_to",
|
|
1741
|
+
"request_page_context",
|
|
1742
|
+
// 0.4.0 — interaction commands
|
|
1743
|
+
"scroll_page",
|
|
1744
|
+
"click",
|
|
1745
|
+
"fill_form",
|
|
1746
|
+
"focus_field",
|
|
1747
|
+
"submit_form",
|
|
1748
|
+
"request_routes"
|
|
1427
1749
|
]);
|
|
1428
|
-
function
|
|
1429
|
-
var
|
|
1750
|
+
function ur(e) {
|
|
1751
|
+
var pt, ht, mt, gt, yt, vt;
|
|
1430
1752
|
const {
|
|
1431
|
-
agentId:
|
|
1432
|
-
apiKey:
|
|
1433
|
-
baseUrl:
|
|
1434
|
-
sessionEndpoint:
|
|
1435
|
-
sessionBody:
|
|
1436
|
-
autoConnect:
|
|
1437
|
-
displayMode:
|
|
1438
|
-
defaultDisplayMode:
|
|
1439
|
-
onDisplayModeChange:
|
|
1753
|
+
agentId: t,
|
|
1754
|
+
apiKey: r,
|
|
1755
|
+
baseUrl: i = "https://app.livelayer.studio",
|
|
1756
|
+
sessionEndpoint: o,
|
|
1757
|
+
sessionBody: l,
|
|
1758
|
+
autoConnect: s = !1,
|
|
1759
|
+
displayMode: d,
|
|
1760
|
+
defaultDisplayMode: u = "expanded",
|
|
1761
|
+
onDisplayModeChange: g,
|
|
1440
1762
|
position: p = "bottom-right",
|
|
1441
|
-
mobileBreakpoint:
|
|
1442
|
-
persistKey:
|
|
1443
|
-
disablePersistence:
|
|
1444
|
-
teamMembers:
|
|
1445
|
-
currentTeamMemberId:
|
|
1446
|
-
onTeamMemberChange:
|
|
1447
|
-
idleLoopUrl:
|
|
1448
|
-
greeting:
|
|
1449
|
-
avatarImageUrl:
|
|
1450
|
-
agentName:
|
|
1451
|
-
branding:
|
|
1452
|
-
allowCamera:
|
|
1453
|
-
allowScreenShare:
|
|
1454
|
-
allowTyping:
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1763
|
+
mobileBreakpoint: a = 640,
|
|
1764
|
+
persistKey: c = "ll-widget",
|
|
1765
|
+
disablePersistence: N = !1,
|
|
1766
|
+
teamMembers: E,
|
|
1767
|
+
currentTeamMemberId: A,
|
|
1768
|
+
onTeamMemberChange: z,
|
|
1769
|
+
idleLoopUrl: T,
|
|
1770
|
+
greeting: $,
|
|
1771
|
+
avatarImageUrl: M,
|
|
1772
|
+
agentName: D,
|
|
1773
|
+
branding: m = {},
|
|
1774
|
+
allowCamera: y = !0,
|
|
1775
|
+
allowScreenShare: C = !0,
|
|
1776
|
+
allowTyping: w = !0,
|
|
1777
|
+
showOn: H,
|
|
1778
|
+
hideOn: K,
|
|
1779
|
+
pathname: se,
|
|
1780
|
+
onNavigate: X,
|
|
1781
|
+
onScrollToSelector: J,
|
|
1782
|
+
getPageContext: de,
|
|
1783
|
+
pageContextExtras: De,
|
|
1784
|
+
onScrollPage: $e,
|
|
1785
|
+
onClick: ze,
|
|
1786
|
+
capabilities: He,
|
|
1787
|
+
onConnect: ue,
|
|
1788
|
+
onDisconnect: me,
|
|
1789
|
+
onTranscript: ge,
|
|
1790
|
+
onAgentState: ye,
|
|
1791
|
+
onConnectionStateChange: ve,
|
|
1792
|
+
onAgentEvent: be,
|
|
1793
|
+
onAgentCommand: we,
|
|
1794
|
+
controlledSession: B,
|
|
1795
|
+
className: Ye,
|
|
1796
|
+
style: Oe,
|
|
1797
|
+
zIndex: Be = 2147483647
|
|
1798
|
+
} = e, Ce = kn(se), Se = Mn(Ce, H, K);
|
|
1799
|
+
I(() => {
|
|
1800
|
+
tr(), ar();
|
|
1801
|
+
}, [Ce]);
|
|
1802
|
+
const re = A !== void 0, [fe, _e] = S(() => {
|
|
1467
1803
|
var v;
|
|
1468
|
-
return
|
|
1469
|
-
}), Q =
|
|
1470
|
-
() => (
|
|
1471
|
-
[
|
|
1472
|
-
),
|
|
1473
|
-
value:
|
|
1474
|
-
defaultValue:
|
|
1475
|
-
onChange:
|
|
1476
|
-
persistKey:
|
|
1477
|
-
disablePersistence:
|
|
1478
|
-
}),
|
|
1804
|
+
return A ?? ((v = E == null ? void 0 : E[0]) == null ? void 0 : v.id);
|
|
1805
|
+
}), Q = re ? A : fe, W = je(
|
|
1806
|
+
() => (E == null ? void 0 : E.find((v) => v.id === Q)) ?? null,
|
|
1807
|
+
[E, Q]
|
|
1808
|
+
), Ne = (W == null ? void 0 : W.agentId) ?? t, [ie, Y] = bn({
|
|
1809
|
+
value: d,
|
|
1810
|
+
defaultValue: u,
|
|
1811
|
+
onChange: g,
|
|
1812
|
+
persistKey: c,
|
|
1813
|
+
disablePersistence: N
|
|
1814
|
+
}), ne = _n(a), oe = an(), V = cn(), G = dn(), le = un(), Ae = fn(), [Ge, xe] = S(!1), [Me, Re] = S(!1), [h, q] = S(!1), [ot, Ot] = S(!1), [Ke, Bt] = S(!1), Xe = R(X), Je = R(J), Qe = R($e), Ze = R(ze), lt = R(de), at = R(De), ct = R(He), Z = R(null);
|
|
1815
|
+
Xe.current = X, Je.current = J, Qe.current = $e, Ze.current = ze, lt.current = de, at.current = De, ct.current = He;
|
|
1816
|
+
function ae(v) {
|
|
1817
|
+
const f = ct.current;
|
|
1818
|
+
return f ? f.includes(v) : !0;
|
|
1819
|
+
}
|
|
1820
|
+
function ce(v, f) {
|
|
1821
|
+
console.warn(
|
|
1822
|
+
`[LiveLayer] Agent command "${v}" blocked — capability "${f}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
|
|
1823
|
+
);
|
|
1824
|
+
}
|
|
1825
|
+
const et = _(
|
|
1479
1826
|
(v) => {
|
|
1480
|
-
|
|
1481
|
-
|
|
1827
|
+
var ee, bt, wt, _t;
|
|
1828
|
+
const f = v;
|
|
1829
|
+
if (!(!f.type || typeof f.type != "string")) {
|
|
1830
|
+
if (be == null || be({ eventName: f.type, data: v }), f.type === "navigate") {
|
|
1831
|
+
if (!ae("navigate")) {
|
|
1832
|
+
ce("navigate", "navigate");
|
|
1833
|
+
return;
|
|
1834
|
+
}
|
|
1835
|
+
const x = typeof f.href == "string" ? f.href : null;
|
|
1836
|
+
if (!x) {
|
|
1837
|
+
console.warn(
|
|
1838
|
+
`[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
|
|
1839
|
+
);
|
|
1840
|
+
return;
|
|
1841
|
+
}
|
|
1842
|
+
if (Xe.current) {
|
|
1843
|
+
try {
|
|
1844
|
+
Xe.current(x);
|
|
1845
|
+
} catch (k) {
|
|
1846
|
+
console.warn(
|
|
1847
|
+
`[LiveLayer] onNavigate threw for "${x}". Falling back. Error:`,
|
|
1848
|
+
k
|
|
1849
|
+
);
|
|
1850
|
+
}
|
|
1851
|
+
return;
|
|
1852
|
+
}
|
|
1853
|
+
if (typeof document < "u") {
|
|
1854
|
+
const k = document.querySelector(
|
|
1855
|
+
`a[href="${x.replace(/"/g, '\\"')}"]`
|
|
1856
|
+
);
|
|
1857
|
+
if (k) {
|
|
1858
|
+
k.click();
|
|
1859
|
+
return;
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
if (typeof window < "u" && typeof history < "u")
|
|
1863
|
+
try {
|
|
1864
|
+
history.pushState({}, "", x), window.dispatchEvent(new PopStateEvent("popstate"));
|
|
1865
|
+
} catch (k) {
|
|
1866
|
+
console.warn(
|
|
1867
|
+
`[LiveLayer] history.pushState fallback failed for "${x}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
|
|
1868
|
+
k
|
|
1869
|
+
);
|
|
1870
|
+
}
|
|
1871
|
+
return;
|
|
1872
|
+
}
|
|
1873
|
+
if (f.type === "scroll_to") {
|
|
1874
|
+
if (!ae("scroll")) {
|
|
1875
|
+
ce("scroll_to", "scroll");
|
|
1876
|
+
return;
|
|
1877
|
+
}
|
|
1878
|
+
const x = typeof f.selector == "string" ? f.selector : null;
|
|
1879
|
+
if (!x) return;
|
|
1880
|
+
const k = f.behavior === "instant" ? "instant" : "smooth";
|
|
1881
|
+
if (Je.current) {
|
|
1882
|
+
try {
|
|
1883
|
+
Je.current(
|
|
1884
|
+
x,
|
|
1885
|
+
k
|
|
1886
|
+
);
|
|
1887
|
+
} catch (P) {
|
|
1888
|
+
console.warn("[LiveLayer] onScrollToSelector threw.", P);
|
|
1889
|
+
}
|
|
1890
|
+
return;
|
|
1891
|
+
}
|
|
1892
|
+
if (typeof document < "u") {
|
|
1893
|
+
let P = null;
|
|
1894
|
+
try {
|
|
1895
|
+
P = document.querySelector(x);
|
|
1896
|
+
} catch {
|
|
1897
|
+
console.warn(
|
|
1898
|
+
`[LiveLayer] scroll_to: invalid selector "${x}".`
|
|
1899
|
+
);
|
|
1900
|
+
return;
|
|
1901
|
+
}
|
|
1902
|
+
if (!P) {
|
|
1903
|
+
console.warn(
|
|
1904
|
+
`[LiveLayer] scroll_to: no element matched "${x}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
|
|
1905
|
+
);
|
|
1906
|
+
return;
|
|
1907
|
+
}
|
|
1908
|
+
P.scrollIntoView({
|
|
1909
|
+
behavior: k,
|
|
1910
|
+
block: "start"
|
|
1911
|
+
});
|
|
1912
|
+
}
|
|
1913
|
+
return;
|
|
1914
|
+
}
|
|
1915
|
+
if (f.type === "request_page_context") {
|
|
1916
|
+
if (!ae("read_page")) {
|
|
1917
|
+
ce("request_page_context", "read_page");
|
|
1918
|
+
return;
|
|
1919
|
+
}
|
|
1920
|
+
const x = (ee = Z.current) == null ? void 0 : ee.call(Z), k = (U) => {
|
|
1921
|
+
const j = x, te = j == null ? void 0 : j.localParticipant;
|
|
1922
|
+
if (te != null && te.publishData)
|
|
1923
|
+
try {
|
|
1924
|
+
const pe = new TextEncoder().encode(JSON.stringify(U));
|
|
1925
|
+
te.publishData(pe, { reliable: !0 });
|
|
1926
|
+
} catch (pe) {
|
|
1927
|
+
console.warn("[LiveLayer] publishData failed.", pe);
|
|
1928
|
+
}
|
|
1929
|
+
}, P = at.current, O = lt.current;
|
|
1930
|
+
try {
|
|
1931
|
+
if (O) {
|
|
1932
|
+
const U = O(P);
|
|
1933
|
+
if (U instanceof Promise) {
|
|
1934
|
+
k({ type: "page_context_pending" }), U.then((j) => k({ type: "page_context", context: j })).catch((j) => {
|
|
1935
|
+
console.warn(
|
|
1936
|
+
"[LiveLayer] getPageContext rejected; falling back to default walker.",
|
|
1937
|
+
j
|
|
1938
|
+
), k({
|
|
1939
|
+
type: "page_context",
|
|
1940
|
+
context: Dt(P)
|
|
1941
|
+
});
|
|
1942
|
+
});
|
|
1943
|
+
return;
|
|
1944
|
+
}
|
|
1945
|
+
k({ type: "page_context", context: U });
|
|
1946
|
+
return;
|
|
1947
|
+
}
|
|
1948
|
+
k({
|
|
1949
|
+
type: "page_context",
|
|
1950
|
+
context: Dt(P)
|
|
1951
|
+
});
|
|
1952
|
+
} catch (U) {
|
|
1953
|
+
console.warn(
|
|
1954
|
+
"[LiveLayer] page-context extraction threw. Sending empty context.",
|
|
1955
|
+
U
|
|
1956
|
+
), k({
|
|
1957
|
+
type: "page_context",
|
|
1958
|
+
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], extras: P }
|
|
1959
|
+
});
|
|
1960
|
+
}
|
|
1961
|
+
return;
|
|
1962
|
+
}
|
|
1963
|
+
if (f.type === "scroll_page") {
|
|
1964
|
+
if (!ae("scroll")) {
|
|
1965
|
+
ce("scroll_page", "scroll");
|
|
1966
|
+
return;
|
|
1967
|
+
}
|
|
1968
|
+
const x = f.direction;
|
|
1969
|
+
if (x !== "up" && x !== "down" && x !== "top" && x !== "bottom") {
|
|
1970
|
+
console.warn(
|
|
1971
|
+
`[LiveLayer] scroll_page: invalid direction "${String(x)}". Expected up | down | top | bottom.`
|
|
1972
|
+
);
|
|
1973
|
+
return;
|
|
1974
|
+
}
|
|
1975
|
+
const k = f.behavior === "instant" ? "instant" : "smooth";
|
|
1976
|
+
if (Qe.current) {
|
|
1977
|
+
try {
|
|
1978
|
+
Qe.current(
|
|
1979
|
+
x,
|
|
1980
|
+
k
|
|
1981
|
+
);
|
|
1982
|
+
} catch (O) {
|
|
1983
|
+
console.warn("[LiveLayer] onScrollPage threw.", O);
|
|
1984
|
+
}
|
|
1985
|
+
return;
|
|
1986
|
+
}
|
|
1987
|
+
if (typeof window > "u") return;
|
|
1988
|
+
const P = { behavior: k };
|
|
1989
|
+
x === "up" ? window.scrollBy({ top: -window.innerHeight, ...P }) : x === "down" ? window.scrollBy({ top: window.innerHeight, ...P }) : x === "top" ? window.scrollTo({ top: 0, ...P }) : window.scrollTo({ top: document.body.scrollHeight, ...P });
|
|
1990
|
+
return;
|
|
1991
|
+
}
|
|
1992
|
+
if (f.type === "click") {
|
|
1993
|
+
if (!ae("click")) {
|
|
1994
|
+
ce("click", "click");
|
|
1995
|
+
return;
|
|
1996
|
+
}
|
|
1997
|
+
const x = typeof f.selector == "string" ? f.selector : null;
|
|
1998
|
+
if (!x) {
|
|
1999
|
+
console.warn("[LiveLayer] click: missing selector.");
|
|
2000
|
+
return;
|
|
2001
|
+
}
|
|
2002
|
+
if (Ze.current) {
|
|
2003
|
+
try {
|
|
2004
|
+
Ze.current(x);
|
|
2005
|
+
} catch (P) {
|
|
2006
|
+
console.warn("[LiveLayer] onClick threw.", P);
|
|
2007
|
+
}
|
|
2008
|
+
return;
|
|
2009
|
+
}
|
|
2010
|
+
if (typeof document > "u") return;
|
|
2011
|
+
let k = null;
|
|
2012
|
+
try {
|
|
2013
|
+
k = document.querySelector(x);
|
|
2014
|
+
} catch {
|
|
2015
|
+
console.warn(
|
|
2016
|
+
`[LiveLayer] click: invalid selector "${x}".`
|
|
2017
|
+
);
|
|
2018
|
+
return;
|
|
2019
|
+
}
|
|
2020
|
+
if (!k) {
|
|
2021
|
+
console.warn(
|
|
2022
|
+
`[LiveLayer] click: no element matched "${x}". See https://livelayer.studio/docs/errors/click-no-match`
|
|
2023
|
+
);
|
|
2024
|
+
return;
|
|
2025
|
+
}
|
|
2026
|
+
if (k.closest('[data-ll-private="true"], .ll-widget')) {
|
|
2027
|
+
console.warn(
|
|
2028
|
+
"[LiveLayer] click: refusing to click element inside a private subtree."
|
|
2029
|
+
);
|
|
2030
|
+
return;
|
|
2031
|
+
}
|
|
2032
|
+
(bt = k.click) == null || bt.call(k);
|
|
2033
|
+
return;
|
|
2034
|
+
}
|
|
2035
|
+
if (f.type === "fill_form" || f.type === "focus_field") {
|
|
2036
|
+
if (!ae("fill_forms")) {
|
|
2037
|
+
ce(f.type, "fill_forms");
|
|
2038
|
+
return;
|
|
2039
|
+
}
|
|
2040
|
+
if (typeof document > "u") return;
|
|
2041
|
+
const x = typeof f.formId == "string" ? f.formId : null;
|
|
2042
|
+
if (!x) {
|
|
2043
|
+
console.warn(`[LiveLayer] ${f.type}: missing formId.`);
|
|
2044
|
+
return;
|
|
2045
|
+
}
|
|
2046
|
+
const k = document.querySelector(
|
|
2047
|
+
`[data-ll-form="${x.replace(/"/g, '\\"')}"]`
|
|
2048
|
+
);
|
|
2049
|
+
if (!k) {
|
|
2050
|
+
console.warn(
|
|
2051
|
+
`[LiveLayer] ${f.type}: no form with data-ll-form="${x}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
|
|
2052
|
+
);
|
|
2053
|
+
return;
|
|
2054
|
+
}
|
|
2055
|
+
if (k.closest('[data-ll-private="true"], .ll-widget')) {
|
|
2056
|
+
console.warn(
|
|
2057
|
+
`[LiveLayer] ${f.type}: refusing to touch a form in a private subtree.`
|
|
2058
|
+
);
|
|
2059
|
+
return;
|
|
2060
|
+
}
|
|
2061
|
+
if (f.type === "focus_field") {
|
|
2062
|
+
const O = typeof f.fieldName == "string" ? f.fieldName : null;
|
|
2063
|
+
if (!O) {
|
|
2064
|
+
console.warn("[LiveLayer] focus_field: missing fieldName.");
|
|
2065
|
+
return;
|
|
2066
|
+
}
|
|
2067
|
+
const U = k.querySelector(`[data-ll-field="${O.replace(/"/g, '\\"')}"]`);
|
|
2068
|
+
if (!U) {
|
|
2069
|
+
console.warn(
|
|
2070
|
+
`[LiveLayer] focus_field: no field "${O}" in form "${x}".`
|
|
2071
|
+
);
|
|
2072
|
+
return;
|
|
2073
|
+
}
|
|
2074
|
+
if (!Ve(U)) {
|
|
2075
|
+
console.warn(
|
|
2076
|
+
`[LiveLayer] focus_field: field "${O}" is privacy-protected and not focusable.`
|
|
2077
|
+
);
|
|
2078
|
+
return;
|
|
2079
|
+
}
|
|
2080
|
+
U.focus();
|
|
2081
|
+
return;
|
|
2082
|
+
}
|
|
2083
|
+
const P = f.values && typeof f.values == "object" ? f.values : null;
|
|
2084
|
+
if (!P) {
|
|
2085
|
+
console.warn("[LiveLayer] fill_form: missing or invalid values.");
|
|
2086
|
+
return;
|
|
2087
|
+
}
|
|
2088
|
+
for (const [O, U] of Object.entries(P)) {
|
|
2089
|
+
if (typeof U != "string") continue;
|
|
2090
|
+
const j = k.querySelector(`[data-ll-field="${O.replace(/"/g, '\\"')}"]`);
|
|
2091
|
+
if (!j) {
|
|
2092
|
+
console.warn(
|
|
2093
|
+
`[LiveLayer] fill_form: no field "${O}" in form "${x}". Skipping.`
|
|
2094
|
+
);
|
|
2095
|
+
continue;
|
|
2096
|
+
}
|
|
2097
|
+
if (!Ve(j)) {
|
|
2098
|
+
console.warn(
|
|
2099
|
+
`[LiveLayer] fill_form: field "${O}" is privacy-protected (password / cc-* / private). Skipping.`
|
|
2100
|
+
);
|
|
2101
|
+
continue;
|
|
2102
|
+
}
|
|
2103
|
+
try {
|
|
2104
|
+
sr(j, U);
|
|
2105
|
+
} catch (te) {
|
|
2106
|
+
console.warn(
|
|
2107
|
+
`[LiveLayer] fill_form: failed to set "${O}".`,
|
|
2108
|
+
te
|
|
2109
|
+
);
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
return;
|
|
2113
|
+
}
|
|
2114
|
+
if (f.type === "submit_form") {
|
|
2115
|
+
if (!ae("submit_forms")) {
|
|
2116
|
+
ce("submit_form", "submit_forms");
|
|
2117
|
+
return;
|
|
2118
|
+
}
|
|
2119
|
+
if (typeof document > "u") return;
|
|
2120
|
+
const x = typeof f.formId == "string" ? f.formId : null;
|
|
2121
|
+
if (!x) {
|
|
2122
|
+
console.warn("[LiveLayer] submit_form: missing formId.");
|
|
2123
|
+
return;
|
|
2124
|
+
}
|
|
2125
|
+
const k = document.querySelector(
|
|
2126
|
+
`[data-ll-form="${x.replace(/"/g, '\\"')}"]`
|
|
2127
|
+
);
|
|
2128
|
+
if (!k) {
|
|
2129
|
+
console.warn(
|
|
2130
|
+
`[LiveLayer] submit_form: no form with data-ll-form="${x}".`
|
|
2131
|
+
);
|
|
2132
|
+
return;
|
|
2133
|
+
}
|
|
2134
|
+
if (k.closest('[data-ll-private="true"], .ll-widget')) {
|
|
2135
|
+
console.warn(
|
|
2136
|
+
"[LiveLayer] submit_form: refusing to submit a form in a private subtree."
|
|
2137
|
+
);
|
|
2138
|
+
return;
|
|
2139
|
+
}
|
|
2140
|
+
const P = (wt = Z.current) == null ? void 0 : wt.call(Z), O = (te) => {
|
|
2141
|
+
const pe = P, Ue = pe == null ? void 0 : pe.localParticipant;
|
|
2142
|
+
if (Ue != null && Ue.publishData)
|
|
2143
|
+
try {
|
|
2144
|
+
const Qt = new TextEncoder().encode(JSON.stringify(te));
|
|
2145
|
+
Ue.publishData(Qt, { reliable: !0 });
|
|
2146
|
+
} catch {
|
|
2147
|
+
}
|
|
2148
|
+
};
|
|
2149
|
+
let U = !1;
|
|
2150
|
+
const j = () => {
|
|
2151
|
+
U = !0, O({ type: "form_submitted", formId: x });
|
|
2152
|
+
};
|
|
2153
|
+
k.addEventListener("submit", j, { once: !0 });
|
|
2154
|
+
try {
|
|
2155
|
+
typeof k.requestSubmit == "function" ? k.requestSubmit() : k.submit();
|
|
2156
|
+
} catch (te) {
|
|
2157
|
+
console.warn("[LiveLayer] submit_form: requestSubmit threw.", te), k.removeEventListener("submit", j), O({
|
|
2158
|
+
type: "form_submit_blocked",
|
|
2159
|
+
formId: x,
|
|
2160
|
+
reason: "exception"
|
|
2161
|
+
});
|
|
2162
|
+
return;
|
|
2163
|
+
}
|
|
2164
|
+
setTimeout(() => {
|
|
2165
|
+
U || (k.removeEventListener("submit", j), O({
|
|
2166
|
+
type: "form_submit_blocked",
|
|
2167
|
+
formId: x,
|
|
2168
|
+
reason: "validation"
|
|
2169
|
+
}));
|
|
2170
|
+
}, 500);
|
|
2171
|
+
return;
|
|
2172
|
+
}
|
|
2173
|
+
if (f.type === "request_routes") {
|
|
2174
|
+
if (!ae("read_page")) {
|
|
2175
|
+
ce("request_routes", "read_page");
|
|
2176
|
+
return;
|
|
2177
|
+
}
|
|
2178
|
+
const k = (_t = Z.current) == null ? void 0 : _t.call(Z), P = k == null ? void 0 : k.localParticipant;
|
|
2179
|
+
if (!(P != null && P.publishData)) return;
|
|
2180
|
+
try {
|
|
2181
|
+
const O = lr(), U = new TextEncoder().encode(
|
|
2182
|
+
JSON.stringify({ type: "routes", routes: O })
|
|
2183
|
+
);
|
|
2184
|
+
P.publishData(U, { reliable: !0 });
|
|
2185
|
+
} catch (O) {
|
|
2186
|
+
console.warn("[LiveLayer] request_routes: extractRoutes threw.", O);
|
|
2187
|
+
}
|
|
2188
|
+
return;
|
|
2189
|
+
}
|
|
2190
|
+
dr.has(f.type) || we == null || we(f);
|
|
2191
|
+
}
|
|
1482
2192
|
},
|
|
1483
|
-
[
|
|
1484
|
-
),
|
|
1485
|
-
agentId:
|
|
1486
|
-
baseUrl:
|
|
1487
|
-
apiKey:
|
|
1488
|
-
sessionEndpoint:
|
|
1489
|
-
sessionBody:
|
|
1490
|
-
onDataMessage:
|
|
2193
|
+
[we, be]
|
|
2194
|
+
), F = ln({
|
|
2195
|
+
agentId: B ? "__controlled__" : Ne,
|
|
2196
|
+
baseUrl: i,
|
|
2197
|
+
apiKey: r,
|
|
2198
|
+
sessionEndpoint: o,
|
|
2199
|
+
sessionBody: l,
|
|
2200
|
+
onDataMessage: B ? void 0 : et
|
|
1491
2201
|
});
|
|
1492
|
-
|
|
1493
|
-
if (
|
|
1494
|
-
return
|
|
1495
|
-
}, [
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
2202
|
+
I(() => {
|
|
2203
|
+
if (B != null && B.subscribeToDataMessages)
|
|
2204
|
+
return B.subscribeToDataMessages(et);
|
|
2205
|
+
}, [B, et]), Z.current = () => {
|
|
2206
|
+
var v;
|
|
2207
|
+
return (v = F.getRoom) == null ? void 0 : v.call(F);
|
|
2208
|
+
};
|
|
2209
|
+
const b = je(() => B ? {
|
|
2210
|
+
connectionState: B.connectionState,
|
|
2211
|
+
agentState: B.agentState,
|
|
2212
|
+
transcript: B.transcript,
|
|
2213
|
+
videoElement: B.videoElement,
|
|
2214
|
+
audioElement: B.audioElement,
|
|
2215
|
+
canResume: B.canResume,
|
|
2216
|
+
error: B.error,
|
|
1504
2217
|
agentConfig: null,
|
|
1505
2218
|
connect: async () => {
|
|
1506
|
-
await
|
|
2219
|
+
await B.onConnect();
|
|
1507
2220
|
},
|
|
1508
|
-
disconnect: () =>
|
|
2221
|
+
disconnect: () => B.onDisconnect(),
|
|
1509
2222
|
// Dummy getRoom for shape compatibility — controlled consumers own the Room.
|
|
1510
2223
|
// Internal session's getRoom returns null when no real connect has happened,
|
|
1511
2224
|
// so we reuse its reference for type consistency.
|
|
1512
|
-
getRoom:
|
|
2225
|
+
getRoom: F.getRoom,
|
|
1513
2226
|
isControlled: !0
|
|
1514
2227
|
} : {
|
|
1515
|
-
connectionState:
|
|
1516
|
-
agentState:
|
|
1517
|
-
transcript:
|
|
1518
|
-
videoElement:
|
|
1519
|
-
audioElement:
|
|
1520
|
-
canResume:
|
|
1521
|
-
error:
|
|
1522
|
-
agentConfig:
|
|
1523
|
-
connect:
|
|
1524
|
-
disconnect:
|
|
1525
|
-
getRoom:
|
|
2228
|
+
connectionState: F.connectionState,
|
|
2229
|
+
agentState: F.agentState,
|
|
2230
|
+
transcript: F.transcript,
|
|
2231
|
+
videoElement: F.videoElement,
|
|
2232
|
+
audioElement: F.audioElement,
|
|
2233
|
+
canResume: F.canResume,
|
|
2234
|
+
error: F.error,
|
|
2235
|
+
agentConfig: F.agentConfig,
|
|
2236
|
+
connect: F.connect,
|
|
2237
|
+
disconnect: F.disconnect,
|
|
2238
|
+
getRoom: F.getRoom,
|
|
1526
2239
|
isControlled: !1
|
|
1527
|
-
}, [
|
|
1528
|
-
|
|
1529
|
-
const v =
|
|
1530
|
-
if (!(!v || !
|
|
1531
|
-
return
|
|
1532
|
-
v.parentNode ===
|
|
2240
|
+
}, [B, F]), st = R(null);
|
|
2241
|
+
I(() => {
|
|
2242
|
+
const v = b.videoElement, f = st.current;
|
|
2243
|
+
if (!(!v || !f))
|
|
2244
|
+
return f.appendChild(v), () => {
|
|
2245
|
+
v.parentNode === f && f.removeChild(v);
|
|
1533
2246
|
};
|
|
1534
|
-
}, [
|
|
1535
|
-
const v =
|
|
2247
|
+
}, [b.videoElement]), I(() => {
|
|
2248
|
+
const v = b.audioElement;
|
|
1536
2249
|
if (!v) return;
|
|
1537
|
-
|
|
1538
|
-
const
|
|
1539
|
-
return
|
|
1540
|
-
(
|
|
2250
|
+
oe.attach(v);
|
|
2251
|
+
const f = v.play();
|
|
2252
|
+
return f && typeof f.catch == "function" && f.catch((ee) => {
|
|
2253
|
+
(ee == null ? void 0 : ee.name) === "NotAllowedError" && xe(!0);
|
|
1541
2254
|
}), () => {
|
|
1542
|
-
|
|
2255
|
+
oe.detach();
|
|
1543
2256
|
};
|
|
1544
|
-
}, [
|
|
1545
|
-
if (
|
|
1546
|
-
const v =
|
|
2257
|
+
}, [b.audioElement]), I(() => {
|
|
2258
|
+
if (b.isControlled || b.connectionState !== "connected") return;
|
|
2259
|
+
const v = b.getRoom();
|
|
1547
2260
|
if (v)
|
|
1548
2261
|
return V.setupMic(v).catch(() => {
|
|
1549
|
-
}),
|
|
1550
|
-
V.teardownMic(),
|
|
2262
|
+
}), G.attachRoom(v), le.attachRoom(v), Ae.refresh(), () => {
|
|
2263
|
+
V.teardownMic(), G.teardown(), le.teardown();
|
|
1551
2264
|
};
|
|
1552
|
-
}, [
|
|
1553
|
-
const v =
|
|
1554
|
-
v && (v.muted =
|
|
1555
|
-
}, [
|
|
1556
|
-
const
|
|
1557
|
-
const
|
|
1558
|
-
if (
|
|
2265
|
+
}, [b.isControlled, b.connectionState]), I(() => {
|
|
2266
|
+
const v = b.audioElement;
|
|
2267
|
+
v && (v.muted = Ke);
|
|
2268
|
+
}, [b.audioElement, Ke]);
|
|
2269
|
+
const Ut = _((v) => {
|
|
2270
|
+
const f = b.getRoom();
|
|
2271
|
+
if (f)
|
|
1559
2272
|
try {
|
|
1560
|
-
const
|
|
2273
|
+
const ee = new TextEncoder().encode(
|
|
1561
2274
|
JSON.stringify({ type: "user_message", text: v })
|
|
1562
2275
|
);
|
|
1563
|
-
|
|
2276
|
+
f.localParticipant.publishData(ee, { reliable: !0 });
|
|
1564
2277
|
} catch {
|
|
1565
2278
|
}
|
|
1566
|
-
}, [
|
|
1567
|
-
|
|
2279
|
+
}, [b]), Ft = _(() => {
|
|
2280
|
+
Bt((v) => !v);
|
|
1568
2281
|
}, []);
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
}, [
|
|
1572
|
-
|
|
1573
|
-
}, [
|
|
1574
|
-
|
|
1575
|
-
}, [
|
|
1576
|
-
const
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
}, [
|
|
1580
|
-
const
|
|
2282
|
+
I(() => {
|
|
2283
|
+
ve == null || ve(b.connectionState), b.connectionState === "connected" ? ue == null || ue() : b.connectionState === "disconnected" && (me == null || me());
|
|
2284
|
+
}, [b.connectionState, ue, me, ve]), I(() => {
|
|
2285
|
+
ge == null || ge(b.transcript);
|
|
2286
|
+
}, [b.transcript, ge]), I(() => {
|
|
2287
|
+
ye == null || ye(b.agentState);
|
|
2288
|
+
}, [b.agentState, ye]);
|
|
2289
|
+
const dt = R(!1);
|
|
2290
|
+
I(() => {
|
|
2291
|
+
b.isControlled || !s || dt.current || Se && b.connectionState === "idle" && (dt.current = !0, b.connect());
|
|
2292
|
+
}, [s, b.connectionState, b, Se]);
|
|
2293
|
+
const qt = _(
|
|
1581
2294
|
(v) => {
|
|
1582
|
-
const
|
|
1583
|
-
|
|
2295
|
+
const f = E == null ? void 0 : E.find((ee) => ee.id === v);
|
|
2296
|
+
f && (q(!1), v !== Q && (Re(!0), b.disconnect(), re || _e(v), z == null || z(f)));
|
|
1584
2297
|
},
|
|
1585
2298
|
[
|
|
1586
|
-
|
|
2299
|
+
E,
|
|
1587
2300
|
Q,
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
2301
|
+
b,
|
|
2302
|
+
re,
|
|
2303
|
+
z
|
|
1591
2304
|
]
|
|
1592
2305
|
);
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
}, [
|
|
1596
|
-
if (!
|
|
1597
|
-
const v = (
|
|
1598
|
-
|
|
2306
|
+
I(() => {
|
|
2307
|
+
Me && b.connectionState === "connected" && Re(!1);
|
|
2308
|
+
}, [b.connectionState, Me]), I(() => {
|
|
2309
|
+
if (!h) return;
|
|
2310
|
+
const v = (f) => {
|
|
2311
|
+
f.key === "Escape" && q(!1);
|
|
1599
2312
|
};
|
|
1600
2313
|
return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
|
|
1601
|
-
}, [
|
|
1602
|
-
const
|
|
1603
|
-
() =>
|
|
1604
|
-
[
|
|
1605
|
-
),
|
|
1606
|
-
|
|
1607
|
-
}, [
|
|
1608
|
-
const v =
|
|
1609
|
-
v && v.play().then(() =>
|
|
2314
|
+
}, [h]);
|
|
2315
|
+
const jt = !!M || !!(W != null && W.avatarImageUrl) || b.isControlled, tt = pn(Ne, i, jt), nt = (W == null ? void 0 : W.name) ?? D ?? ((pt = b.agentConfig) == null ? void 0 : pt.name) ?? ((ht = tt.info) == null ? void 0 : ht.name) ?? "Live Layer", ut = (W == null ? void 0 : W.avatarImageUrl) ?? M ?? ((mt = b.agentConfig) == null ? void 0 : mt.avatarImageUrl) ?? ((gt = tt.info) == null ? void 0 : gt.avatarImageUrl) ?? null, Wt = T ?? ((yt = b.agentConfig) == null ? void 0 : yt.idleLoopUrl) ?? ((vt = tt.info) == null ? void 0 : vt.idleLoopUrl) ?? null, Vt = $ ?? null, Yt = _(() => Y("expanded"), [Y]), Gt = _(
|
|
2316
|
+
() => Y("minimized"),
|
|
2317
|
+
[Y]
|
|
2318
|
+
), ft = _(() => {
|
|
2319
|
+
b.disconnect(), Y("hidden");
|
|
2320
|
+
}, [b, Y]), Kt = _(() => {
|
|
2321
|
+
const v = b.audioElement;
|
|
2322
|
+
v && v.play().then(() => xe(!1)).catch(() => {
|
|
1610
2323
|
});
|
|
1611
|
-
}, [
|
|
1612
|
-
|
|
1613
|
-
}, [
|
|
1614
|
-
...
|
|
1615
|
-
zIndex:
|
|
2324
|
+
}, [b.audioElement]), Xt = _(() => {
|
|
2325
|
+
xe(!1), b.connect();
|
|
2326
|
+
}, [b]), Te = {
|
|
2327
|
+
...Oe,
|
|
2328
|
+
zIndex: Be
|
|
1616
2329
|
};
|
|
1617
|
-
|
|
1618
|
-
const
|
|
2330
|
+
m.primaryColor && (Te["--ll-color-primary"] = m.primaryColor), m.accentColor && (Te["--ll-color-accent"] = m.accentColor), m.backgroundColor && (Te["--ll-color-bg"] = m.backgroundColor), m.textColor && (Te["--ll-color-fg"] = m.textColor);
|
|
2331
|
+
const Jt = [
|
|
1619
2332
|
"ll-widget",
|
|
1620
|
-
`ll-widget--${
|
|
1621
|
-
`ll-widget--${
|
|
1622
|
-
|
|
2333
|
+
`ll-widget--${ie}`,
|
|
2334
|
+
`ll-widget--${ne ? "mobile" : "desktop"}`,
|
|
2335
|
+
Ye
|
|
1623
2336
|
].filter(Boolean).join(" ");
|
|
1624
|
-
return /* @__PURE__ */
|
|
2337
|
+
return Se ? /* @__PURE__ */ L(
|
|
1625
2338
|
"div",
|
|
1626
2339
|
{
|
|
1627
|
-
className:
|
|
1628
|
-
style:
|
|
1629
|
-
"data-display-mode":
|
|
2340
|
+
className: Jt,
|
|
2341
|
+
style: Te,
|
|
2342
|
+
"data-display-mode": ie,
|
|
1630
2343
|
"data-position": p,
|
|
1631
2344
|
children: [
|
|
1632
|
-
|
|
1633
|
-
|
|
2345
|
+
ie === "hidden" && /* @__PURE__ */ n(
|
|
2346
|
+
zn,
|
|
1634
2347
|
{
|
|
1635
2348
|
position: p,
|
|
1636
|
-
isMobile:
|
|
1637
|
-
isSpeaking:
|
|
1638
|
-
onExpand: () =>
|
|
1639
|
-
label: `Open ${
|
|
2349
|
+
isMobile: ne,
|
|
2350
|
+
isSpeaking: b.agentState === "speaking",
|
|
2351
|
+
onExpand: () => Y("expanded"),
|
|
2352
|
+
label: `Open ${nt} widget`
|
|
1640
2353
|
}
|
|
1641
2354
|
),
|
|
1642
|
-
|
|
1643
|
-
|
|
2355
|
+
ie === "minimized" && /* @__PURE__ */ n(
|
|
2356
|
+
On,
|
|
1644
2357
|
{
|
|
1645
2358
|
position: p,
|
|
1646
|
-
isMobile:
|
|
1647
|
-
agentName:
|
|
1648
|
-
avatarImageUrl:
|
|
1649
|
-
agentState:
|
|
2359
|
+
isMobile: ne,
|
|
2360
|
+
agentName: nt,
|
|
2361
|
+
avatarImageUrl: ut,
|
|
2362
|
+
agentState: b.agentState,
|
|
1650
2363
|
isMuted: V.isMuted,
|
|
1651
|
-
audioLevel:
|
|
1652
|
-
onExpand:
|
|
2364
|
+
audioLevel: oe,
|
|
2365
|
+
onExpand: Yt,
|
|
1653
2366
|
onToggleMute: V.toggleMute,
|
|
1654
|
-
onClose:
|
|
2367
|
+
onClose: ft
|
|
1655
2368
|
}
|
|
1656
2369
|
),
|
|
1657
|
-
|
|
1658
|
-
|
|
2370
|
+
ie === "expanded" && /* @__PURE__ */ n(
|
|
2371
|
+
Un,
|
|
1659
2372
|
{
|
|
1660
2373
|
position: p,
|
|
1661
|
-
isMobile:
|
|
1662
|
-
agentName:
|
|
1663
|
-
avatarImageUrl:
|
|
1664
|
-
idleLoopUrl:
|
|
1665
|
-
greeting:
|
|
1666
|
-
branding:
|
|
1667
|
-
teamMembers:
|
|
2374
|
+
isMobile: ne,
|
|
2375
|
+
agentName: nt,
|
|
2376
|
+
avatarImageUrl: ut,
|
|
2377
|
+
idleLoopUrl: Wt,
|
|
2378
|
+
greeting: Vt,
|
|
2379
|
+
branding: m,
|
|
2380
|
+
teamMembers: E,
|
|
1668
2381
|
currentTeamMemberId: Q,
|
|
1669
|
-
isSwitchingTeamMember:
|
|
1670
|
-
teamSwitcherOpen:
|
|
2382
|
+
isSwitchingTeamMember: Me,
|
|
2383
|
+
teamSwitcherOpen: h,
|
|
1671
2384
|
onToggleTeamSwitcher: () => q((v) => !v),
|
|
1672
|
-
onSelectTeamMember:
|
|
1673
|
-
connectionState:
|
|
1674
|
-
agentState:
|
|
1675
|
-
transcript:
|
|
2385
|
+
onSelectTeamMember: qt,
|
|
2386
|
+
connectionState: b.connectionState,
|
|
2387
|
+
agentState: b.agentState,
|
|
2388
|
+
transcript: b.transcript,
|
|
1676
2389
|
isMuted: V.isMuted,
|
|
1677
|
-
micDevices:
|
|
1678
|
-
isCameraEnabled:
|
|
1679
|
-
cameraPreviewEl:
|
|
1680
|
-
cameraDevices:
|
|
1681
|
-
activeCameraId:
|
|
1682
|
-
isScreenShareEnabled:
|
|
1683
|
-
screenPreviewEl:
|
|
1684
|
-
isSpeakerMuted:
|
|
1685
|
-
allowCamera:
|
|
1686
|
-
allowScreenShare:
|
|
1687
|
-
allowTyping:
|
|
1688
|
-
languageMenuOpen:
|
|
1689
|
-
onToggleLanguageMenu: () =>
|
|
1690
|
-
needsUserGesture:
|
|
1691
|
-
canResume:
|
|
2390
|
+
micDevices: Ae.mics,
|
|
2391
|
+
isCameraEnabled: G.isEnabled,
|
|
2392
|
+
cameraPreviewEl: G.previewEl,
|
|
2393
|
+
cameraDevices: Ae.cameras,
|
|
2394
|
+
activeCameraId: G.activeDeviceId,
|
|
2395
|
+
isScreenShareEnabled: le.isEnabled,
|
|
2396
|
+
screenPreviewEl: le.previewEl,
|
|
2397
|
+
isSpeakerMuted: Ke,
|
|
2398
|
+
allowCamera: y,
|
|
2399
|
+
allowScreenShare: C,
|
|
2400
|
+
allowTyping: w,
|
|
2401
|
+
languageMenuOpen: ot,
|
|
2402
|
+
onToggleLanguageMenu: () => Ot((v) => !v),
|
|
2403
|
+
needsUserGesture: Ge,
|
|
2404
|
+
canResume: b.canResume,
|
|
1692
2405
|
micError: V.micError,
|
|
1693
|
-
error:
|
|
1694
|
-
avatarVideoContainerRef:
|
|
1695
|
-
onConnect: () => void
|
|
1696
|
-
onDisconnect: () =>
|
|
1697
|
-
onRetry:
|
|
1698
|
-
onResumeAudio:
|
|
2406
|
+
error: b.error,
|
|
2407
|
+
avatarVideoContainerRef: st,
|
|
2408
|
+
onConnect: () => void b.connect(),
|
|
2409
|
+
onDisconnect: () => b.disconnect(),
|
|
2410
|
+
onRetry: Xt,
|
|
2411
|
+
onResumeAudio: Kt,
|
|
1699
2412
|
onToggleMute: V.toggleMute,
|
|
1700
|
-
onToggleCamera: () => void
|
|
1701
|
-
onSwitchCameraDevice: (v) => void
|
|
1702
|
-
onToggleScreenShare: () => void
|
|
1703
|
-
onToggleSpeaker:
|
|
1704
|
-
onSendMessage:
|
|
1705
|
-
onMinimize:
|
|
1706
|
-
onClose:
|
|
2413
|
+
onToggleCamera: () => void G.toggle(),
|
|
2414
|
+
onSwitchCameraDevice: (v) => void G.switchDevice(v),
|
|
2415
|
+
onToggleScreenShare: () => void le.toggle(),
|
|
2416
|
+
onToggleSpeaker: Ft,
|
|
2417
|
+
onSendMessage: Ut,
|
|
2418
|
+
onMinimize: Gt,
|
|
2419
|
+
onClose: ft,
|
|
1707
2420
|
onClearMicError: V.clearError
|
|
1708
2421
|
}
|
|
1709
2422
|
)
|
|
1710
2423
|
]
|
|
1711
2424
|
}
|
|
1712
|
-
);
|
|
2425
|
+
) : null;
|
|
1713
2426
|
}
|
|
1714
|
-
function
|
|
1715
|
-
return /* @__PURE__ */
|
|
2427
|
+
function yr(e) {
|
|
2428
|
+
return /* @__PURE__ */ n(on, { children: /* @__PURE__ */ n(ur, { ...e }) });
|
|
1716
2429
|
}
|
|
1717
|
-
const
|
|
1718
|
-
agentId:
|
|
1719
|
-
baseUrl:
|
|
1720
|
-
apiKey:
|
|
1721
|
-
mode:
|
|
1722
|
-
onAgentEvent:
|
|
1723
|
-
className:
|
|
1724
|
-
style:
|
|
2430
|
+
const vr = ({
|
|
2431
|
+
agentId: e,
|
|
2432
|
+
baseUrl: t,
|
|
2433
|
+
apiKey: r,
|
|
2434
|
+
mode: i,
|
|
2435
|
+
onAgentEvent: o,
|
|
2436
|
+
className: l,
|
|
2437
|
+
style: s
|
|
1725
2438
|
}) => {
|
|
1726
|
-
const
|
|
1727
|
-
|
|
1728
|
-
const p =
|
|
1729
|
-
var
|
|
1730
|
-
const
|
|
1731
|
-
(
|
|
2439
|
+
const d = R(null), u = R(null), g = R(o);
|
|
2440
|
+
g.current = o;
|
|
2441
|
+
const p = _((a) => {
|
|
2442
|
+
var N;
|
|
2443
|
+
const c = a.detail;
|
|
2444
|
+
(N = g.current) == null || N.call(g, c);
|
|
1732
2445
|
}, []);
|
|
1733
|
-
return
|
|
1734
|
-
const
|
|
1735
|
-
if (!
|
|
1736
|
-
const
|
|
1737
|
-
return
|
|
1738
|
-
|
|
2446
|
+
return I(() => {
|
|
2447
|
+
const a = d.current;
|
|
2448
|
+
if (!a) return;
|
|
2449
|
+
const c = document.createElement("livelayer-widget");
|
|
2450
|
+
return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), i && c.setAttribute("mode", i), c.addEventListener("agent-event", p), a.appendChild(c), u.current = c, () => {
|
|
2451
|
+
c.removeEventListener("agent-event", p), a.removeChild(c), u.current = null;
|
|
1739
2452
|
};
|
|
1740
|
-
}, [
|
|
1741
|
-
|
|
1742
|
-
}, [
|
|
1743
|
-
}
|
|
1744
|
-
function
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
2453
|
+
}, [e]), I(() => {
|
|
2454
|
+
u.current && (i ? u.current.setAttribute("mode", i) : u.current.removeAttribute("mode"));
|
|
2455
|
+
}, [i]), /* @__PURE__ */ n("div", { ref: d, className: l, style: s });
|
|
2456
|
+
}, br = rt(
|
|
2457
|
+
function({ id: t, intent: r, as: i = "div", className: o, style: l, children: s }, d) {
|
|
2458
|
+
return en(
|
|
2459
|
+
i,
|
|
2460
|
+
{
|
|
2461
|
+
ref: d,
|
|
2462
|
+
"data-ll-region": t,
|
|
2463
|
+
"data-ll-intent": r,
|
|
2464
|
+
className: o,
|
|
2465
|
+
style: l
|
|
2466
|
+
},
|
|
2467
|
+
s
|
|
2468
|
+
);
|
|
2469
|
+
}
|
|
2470
|
+
), wr = rt(
|
|
2471
|
+
function({ id: t, intent: r, children: i, ...o }, l) {
|
|
2472
|
+
return /* @__PURE__ */ n(
|
|
2473
|
+
"form",
|
|
2474
|
+
{
|
|
2475
|
+
ref: l,
|
|
2476
|
+
"data-ll-form": t,
|
|
2477
|
+
"data-ll-intent": r,
|
|
2478
|
+
...o,
|
|
2479
|
+
children: i
|
|
2480
|
+
}
|
|
2481
|
+
);
|
|
2482
|
+
}
|
|
2483
|
+
), _r = rt(
|
|
2484
|
+
function(t, r) {
|
|
2485
|
+
const { name: i, label: o, labelClassName: l } = t, s = { name: i, "data-ll-field": i };
|
|
2486
|
+
let d;
|
|
2487
|
+
if ("as" in t && t.as === "textarea") {
|
|
2488
|
+
const { name: u, label: g, labelClassName: p, as: a, ...c } = t;
|
|
2489
|
+
d = /* @__PURE__ */ n(
|
|
2490
|
+
"textarea",
|
|
2491
|
+
{
|
|
2492
|
+
ref: r,
|
|
2493
|
+
...s,
|
|
2494
|
+
...c
|
|
2495
|
+
}
|
|
2496
|
+
);
|
|
2497
|
+
} else if ("as" in t && t.as === "select") {
|
|
2498
|
+
const { name: u, label: g, labelClassName: p, as: a, children: c, ...N } = t;
|
|
2499
|
+
d = /* @__PURE__ */ n(
|
|
2500
|
+
"select",
|
|
2501
|
+
{
|
|
2502
|
+
ref: r,
|
|
2503
|
+
...s,
|
|
2504
|
+
...N,
|
|
2505
|
+
children: c
|
|
2506
|
+
}
|
|
2507
|
+
);
|
|
2508
|
+
} else {
|
|
2509
|
+
const { name: u, label: g, labelClassName: p, as: a, ...c } = t;
|
|
2510
|
+
d = /* @__PURE__ */ n(
|
|
2511
|
+
"input",
|
|
2512
|
+
{
|
|
2513
|
+
ref: r,
|
|
2514
|
+
...s,
|
|
2515
|
+
...c
|
|
2516
|
+
}
|
|
2517
|
+
);
|
|
2518
|
+
}
|
|
2519
|
+
return o === void 0 ? d : /* @__PURE__ */ L("label", { className: l, children: [
|
|
2520
|
+
o,
|
|
2521
|
+
d
|
|
2522
|
+
] });
|
|
2523
|
+
}
|
|
2524
|
+
);
|
|
2525
|
+
function xr() {
|
|
2526
|
+
const [e, t] = S([]), r = _((o) => {
|
|
2527
|
+
t((l) => {
|
|
2528
|
+
const s = l.findIndex((d) => d.id === o.id);
|
|
2529
|
+
if (s >= 0) {
|
|
2530
|
+
const d = l.slice();
|
|
2531
|
+
return d[s] = o, d;
|
|
1751
2532
|
}
|
|
1752
|
-
return [...
|
|
2533
|
+
return [...l, o];
|
|
1753
2534
|
});
|
|
1754
|
-
}, []),
|
|
2535
|
+
}, []), i = _(() => t([]), []);
|
|
1755
2536
|
return {
|
|
1756
|
-
entries:
|
|
1757
|
-
pushSegment:
|
|
1758
|
-
clear:
|
|
1759
|
-
latest:
|
|
2537
|
+
entries: e,
|
|
2538
|
+
pushSegment: r,
|
|
2539
|
+
clear: i,
|
|
2540
|
+
latest: e.length > 0 ? e[e.length - 1] : null
|
|
1760
2541
|
};
|
|
1761
2542
|
}
|
|
1762
2543
|
export {
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
2544
|
+
yr as AvatarWidget,
|
|
2545
|
+
on as ErrorBoundary,
|
|
2546
|
+
_r as LiveLayerField,
|
|
2547
|
+
wr as LiveLayerForm,
|
|
2548
|
+
br as LiveLayerRegion,
|
|
2549
|
+
vr as LiveLayerWidget,
|
|
2550
|
+
tr as clearPageContextCache,
|
|
2551
|
+
ar as clearRoutesCache,
|
|
2552
|
+
er as extractPageContext,
|
|
2553
|
+
ir as extractRoutes,
|
|
2554
|
+
Dt as getCachedPageContext,
|
|
2555
|
+
lr as getCachedRoutes,
|
|
2556
|
+
Nn as matchesPattern,
|
|
2557
|
+
An as shouldRenderAtPath,
|
|
2558
|
+
pn as useAgentInfo,
|
|
2559
|
+
an as useAudioLevel,
|
|
2560
|
+
dn as useCameraState,
|
|
2561
|
+
gn as useDisplayMode,
|
|
2562
|
+
bn as useDisplayModePersistence,
|
|
2563
|
+
_n as useIsMobile,
|
|
2564
|
+
ln as useLiveKitSession,
|
|
2565
|
+
fn as useMediaDevices,
|
|
2566
|
+
cn as useMicrophoneState,
|
|
2567
|
+
kn as usePathname,
|
|
2568
|
+
Mn as useRouteMatch,
|
|
2569
|
+
un as useScreenShareState,
|
|
2570
|
+
xr as useTranscript
|
|
1777
2571
|
};
|