@livelayer/react 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +57 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +1336 -823
- package/dist/styles.css +683 -268
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
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 w, jsx as e, Fragment as Qe } from "react/jsx-runtime";
|
|
3
|
+
import { Component as Ze, useState as x, useRef as S, useEffect as L, useCallback as f, useMemo as Se } from "react";
|
|
4
|
+
import { LiveKitSession as et } from "@livelayer/sdk";
|
|
5
|
+
import { createLocalAudioTrack as tt, Track as Oe, createLocalVideoTrack as nt } from "livekit-client";
|
|
6
|
+
class rt extends Ze {
|
|
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(n) {
|
|
13
|
+
return { hasError: !0, error: n };
|
|
14
14
|
}
|
|
15
|
-
componentDidCatch(
|
|
16
|
-
var
|
|
17
|
-
(
|
|
15
|
+
componentDidCatch(n, i) {
|
|
16
|
+
var o, r;
|
|
17
|
+
(r = (o = this.props).onError) == null || r.call(o, n, i);
|
|
18
18
|
}
|
|
19
19
|
render() {
|
|
20
|
-
var
|
|
21
|
-
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */
|
|
20
|
+
var n;
|
|
21
|
+
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ w("div", { className: "ll-error-boundary", role: "alert", children: [
|
|
22
22
|
/* @__PURE__ */ e("p", { className: "ll-error-boundary__title", children: "Widget crashed" }),
|
|
23
|
-
/* @__PURE__ */ e("p", { className: "ll-error-boundary__message", children: ((
|
|
23
|
+
/* @__PURE__ */ e("p", { className: "ll-error-boundary__message", children: ((n = this.state.error) == null ? void 0 : n.message) || "Something went wrong." }),
|
|
24
24
|
/* @__PURE__ */ e(
|
|
25
25
|
"button",
|
|
26
26
|
{
|
|
@@ -33,267 +33,421 @@ class Ae extends ze {
|
|
|
33
33
|
] }) : this.props.children;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const [
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
onConnectionStateChange: (
|
|
41
|
-
|
|
36
|
+
function it(t) {
|
|
37
|
+
const [n, i] = x("idle"), [o, r] = x("idle"), [a, c] = x([]), [m, d] = x(null), [g, u] = x(null), [s, l] = x(null), [b, _] = x(!1), [N, D] = x(null), E = S(null), R = S(t.onDataMessage);
|
|
38
|
+
R.current = t.onDataMessage, L(() => {
|
|
39
|
+
const k = {
|
|
40
|
+
onConnectionStateChange: (y) => {
|
|
41
|
+
i(y), y === "connected" && D(null);
|
|
42
42
|
},
|
|
43
|
-
onAgentStateChange:
|
|
44
|
-
onTranscript: (
|
|
45
|
-
onAgentConfig:
|
|
46
|
-
onAudioTrack: (
|
|
47
|
-
onVideoTrack: (
|
|
48
|
-
onVideoTrackRemoved: () =>
|
|
49
|
-
onError: (
|
|
50
|
-
onDataMessage: (
|
|
51
|
-
var
|
|
52
|
-
(
|
|
43
|
+
onAgentStateChange: r,
|
|
44
|
+
onTranscript: (y) => c([...y]),
|
|
45
|
+
onAgentConfig: d,
|
|
46
|
+
onAudioTrack: (y) => l(y),
|
|
47
|
+
onVideoTrack: (y) => u(y),
|
|
48
|
+
onVideoTrackRemoved: () => u(null),
|
|
49
|
+
onError: (y) => D(y),
|
|
50
|
+
onDataMessage: (y) => {
|
|
51
|
+
var A;
|
|
52
|
+
(A = R.current) == null || A.call(R, y);
|
|
53
53
|
},
|
|
54
|
-
onResumabilityChange:
|
|
55
|
-
},
|
|
54
|
+
onResumabilityChange: _
|
|
55
|
+
}, C = new et(
|
|
56
56
|
{
|
|
57
|
-
agentId:
|
|
58
|
-
baseUrl:
|
|
59
|
-
apiKey:
|
|
60
|
-
sessionEndpoint:
|
|
61
|
-
sessionBody:
|
|
57
|
+
agentId: t.agentId,
|
|
58
|
+
baseUrl: t.baseUrl,
|
|
59
|
+
apiKey: t.apiKey,
|
|
60
|
+
sessionEndpoint: t.sessionEndpoint,
|
|
61
|
+
sessionBody: t.sessionBody
|
|
62
62
|
},
|
|
63
|
-
|
|
63
|
+
k
|
|
64
64
|
);
|
|
65
|
-
return
|
|
66
|
-
var
|
|
67
|
-
(
|
|
65
|
+
return E.current = C, i("idle"), r("idle"), c([]), d(null), u(null), l(null), _(!1), D(null), () => {
|
|
66
|
+
var y;
|
|
67
|
+
(y = C.destroy) == null || y.call(C), E.current = null;
|
|
68
68
|
};
|
|
69
69
|
}, [
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
JSON.stringify(
|
|
70
|
+
t.agentId,
|
|
71
|
+
t.baseUrl,
|
|
72
|
+
t.apiKey,
|
|
73
|
+
t.sessionEndpoint,
|
|
74
|
+
JSON.stringify(t.sessionBody ?? {})
|
|
75
75
|
]);
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
76
|
+
const T = f(async () => {
|
|
77
|
+
const k = E.current;
|
|
78
|
+
if (k)
|
|
79
79
|
try {
|
|
80
|
-
await
|
|
81
|
-
} catch (
|
|
82
|
-
throw
|
|
80
|
+
await k.connect();
|
|
81
|
+
} catch (C) {
|
|
82
|
+
throw D(C instanceof Error ? C.message : String(C)), C;
|
|
83
83
|
}
|
|
84
|
-
}, []),
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
}, []),
|
|
88
|
-
var
|
|
89
|
-
return ((
|
|
84
|
+
}, []), z = f(() => {
|
|
85
|
+
const k = E.current;
|
|
86
|
+
k && k.disconnect();
|
|
87
|
+
}, []), I = f(() => {
|
|
88
|
+
var k;
|
|
89
|
+
return ((k = E.current) == null ? void 0 : k.getRoom()) ?? null;
|
|
90
90
|
}, []);
|
|
91
91
|
return {
|
|
92
|
-
connectionState:
|
|
93
|
-
agentState:
|
|
92
|
+
connectionState: n,
|
|
93
|
+
agentState: o,
|
|
94
94
|
transcript: a,
|
|
95
|
-
agentConfig:
|
|
95
|
+
agentConfig: m,
|
|
96
96
|
videoElement: g,
|
|
97
|
-
audioElement:
|
|
98
|
-
canResume:
|
|
99
|
-
error:
|
|
100
|
-
connect:
|
|
101
|
-
disconnect:
|
|
102
|
-
getRoom:
|
|
103
|
-
session:
|
|
97
|
+
audioElement: s,
|
|
98
|
+
canResume: b,
|
|
99
|
+
error: N,
|
|
100
|
+
connect: T,
|
|
101
|
+
disconnect: z,
|
|
102
|
+
getRoom: I,
|
|
103
|
+
session: E.current
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
if (!
|
|
110
|
-
|
|
106
|
+
function ot() {
|
|
107
|
+
const t = S(null), n = S(null), i = S(null), o = S(null), r = S(/* @__PURE__ */ new Set()), a = S(null), c = f(() => {
|
|
108
|
+
const s = n.current;
|
|
109
|
+
if (!s) {
|
|
110
|
+
o.current = null;
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
|
-
(!a.current || a.current.length !==
|
|
114
|
-
new ArrayBuffer(
|
|
113
|
+
(!a.current || a.current.length !== s.frequencyBinCount) && (a.current = new Uint8Array(
|
|
114
|
+
new ArrayBuffer(s.frequencyBinCount)
|
|
115
115
|
));
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
let
|
|
119
|
-
for (let
|
|
120
|
-
const
|
|
121
|
-
for (const
|
|
116
|
+
const l = a.current;
|
|
117
|
+
s.getByteFrequencyData(l);
|
|
118
|
+
let b = 0;
|
|
119
|
+
for (let N = 0; N < l.length; N++) b += l[N];
|
|
120
|
+
const _ = b / l.length / 255;
|
|
121
|
+
for (const N of r.current)
|
|
122
122
|
try {
|
|
123
|
-
|
|
124
|
-
} catch (
|
|
125
|
-
console.error("[useAudioLevel] subscriber threw:",
|
|
123
|
+
N(_);
|
|
124
|
+
} catch (D) {
|
|
125
|
+
console.error("[useAudioLevel] subscriber threw:", D);
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
}, []),
|
|
129
|
-
if (
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
}, []),
|
|
133
|
-
(
|
|
134
|
-
if (
|
|
135
|
-
if (
|
|
127
|
+
o.current = requestAnimationFrame(c);
|
|
128
|
+
}, []), m = f(() => {
|
|
129
|
+
if (t.current || typeof window > "u" || typeof AudioContext > "u") return;
|
|
130
|
+
const s = new AudioContext(), l = s.createAnalyser();
|
|
131
|
+
l.fftSize = 64, l.connect(s.destination), t.current = s, n.current = l;
|
|
132
|
+
}, []), d = f(
|
|
133
|
+
(s) => {
|
|
134
|
+
if (m(), !(!t.current || !n.current)) {
|
|
135
|
+
if (i.current) {
|
|
136
136
|
try {
|
|
137
|
-
|
|
137
|
+
i.current.disconnect();
|
|
138
138
|
} catch {
|
|
139
139
|
}
|
|
140
|
-
|
|
140
|
+
i.current = null;
|
|
141
141
|
}
|
|
142
142
|
try {
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
} catch (
|
|
146
|
-
console.warn("[useAudioLevel] createMediaElementSource failed:",
|
|
143
|
+
const l = t.current.createMediaElementSource(s);
|
|
144
|
+
l.connect(n.current), i.current = l;
|
|
145
|
+
} catch (l) {
|
|
146
|
+
console.warn("[useAudioLevel] createMediaElementSource failed:", l);
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
|
-
|
|
149
|
+
o.current === null && (o.current = requestAnimationFrame(c));
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
|
-
[
|
|
153
|
-
), g =
|
|
154
|
-
if (
|
|
152
|
+
[m, c]
|
|
153
|
+
), g = f(() => {
|
|
154
|
+
if (o.current !== null && (cancelAnimationFrame(o.current), o.current = null), i.current) {
|
|
155
155
|
try {
|
|
156
|
-
|
|
156
|
+
i.current.disconnect();
|
|
157
157
|
} catch {
|
|
158
158
|
}
|
|
159
|
-
|
|
159
|
+
i.current = null;
|
|
160
160
|
}
|
|
161
|
-
}, []),
|
|
162
|
-
|
|
161
|
+
}, []), u = f((s) => (r.current.add(s), () => {
|
|
162
|
+
r.current.delete(s);
|
|
163
163
|
}), []);
|
|
164
|
-
return
|
|
165
|
-
if (g(),
|
|
164
|
+
return L(() => () => {
|
|
165
|
+
if (g(), n.current) {
|
|
166
166
|
try {
|
|
167
|
-
|
|
167
|
+
n.current.disconnect();
|
|
168
168
|
} catch {
|
|
169
169
|
}
|
|
170
|
-
|
|
170
|
+
n.current = null;
|
|
171
171
|
}
|
|
172
|
-
if (
|
|
172
|
+
if (t.current) {
|
|
173
173
|
try {
|
|
174
|
-
|
|
174
|
+
t.current.close();
|
|
175
175
|
} catch {
|
|
176
176
|
}
|
|
177
|
-
|
|
177
|
+
t.current = null;
|
|
178
178
|
}
|
|
179
|
-
|
|
180
|
-
}, [g]), { attach:
|
|
179
|
+
r.current.clear(), a.current = null;
|
|
180
|
+
}, [g]), { attach: d, detach: g, subscribe: u };
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
const [
|
|
184
|
-
if (
|
|
182
|
+
function lt() {
|
|
183
|
+
const [t, n] = x(!1), [i, o] = x(null), r = S(null), a = S(null), c = f(async (u) => {
|
|
184
|
+
if (r.current && a.current) {
|
|
185
185
|
try {
|
|
186
|
-
await a.current.localParticipant.unpublishTrack(
|
|
186
|
+
await a.current.localParticipant.unpublishTrack(r.current);
|
|
187
187
|
} catch {
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
r.current.stop(), r.current = null;
|
|
190
190
|
}
|
|
191
|
-
a.current =
|
|
191
|
+
a.current = u, o(null);
|
|
192
192
|
try {
|
|
193
|
-
const
|
|
193
|
+
const s = await tt({
|
|
194
194
|
echoCancellation: !0,
|
|
195
195
|
noiseSuppression: !0
|
|
196
196
|
});
|
|
197
|
-
await
|
|
198
|
-
} catch (
|
|
199
|
-
const
|
|
200
|
-
throw
|
|
197
|
+
await u.localParticipant.publishTrack(s), r.current = s, n(s.isMuted);
|
|
198
|
+
} catch (s) {
|
|
199
|
+
const l = s instanceof Error && s.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
|
|
200
|
+
throw o(l), s;
|
|
201
201
|
}
|
|
202
|
-
}, []),
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
}, []),
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
202
|
+
}, []), m = f(() => {
|
|
203
|
+
const u = r.current;
|
|
204
|
+
u && (u.isMuted ? (u.unmute(), n(!1)) : (u.mute(), n(!0)));
|
|
205
|
+
}, []), d = f(() => {
|
|
206
|
+
const u = r.current, s = a.current;
|
|
207
|
+
if (u && s) {
|
|
208
208
|
try {
|
|
209
|
-
|
|
209
|
+
s.localParticipant.unpublishTrack(u);
|
|
210
210
|
} catch {
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
u.stop();
|
|
213
213
|
}
|
|
214
|
-
|
|
215
|
-
}, []), g =
|
|
214
|
+
r.current = null, a.current = null, n(!1);
|
|
215
|
+
}, []), g = f(() => o(null), []);
|
|
216
216
|
return {
|
|
217
|
-
isMuted:
|
|
218
|
-
micError:
|
|
219
|
-
toggleMute:
|
|
220
|
-
setupMic:
|
|
221
|
-
teardownMic:
|
|
217
|
+
isMuted: t,
|
|
218
|
+
micError: i,
|
|
219
|
+
toggleMute: m,
|
|
220
|
+
setupMic: c,
|
|
221
|
+
teardownMic: d,
|
|
222
222
|
clearError: g
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
|
-
|
|
225
|
+
const at = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
226
|
+
function st() {
|
|
227
|
+
const [t, n] = x(!1), [i, o] = x(null), [r, a] = x(null), [c, m] = x(""), d = S(null), g = S(null), u = f((E) => {
|
|
228
|
+
d.current = E;
|
|
229
|
+
}, []), s = f(() => {
|
|
230
|
+
const E = d.current, R = g.current;
|
|
231
|
+
if (R && E) {
|
|
232
|
+
const T = E.localParticipant.getTrackPublication(Oe.Source.Camera);
|
|
233
|
+
if (T != null && T.track) {
|
|
234
|
+
try {
|
|
235
|
+
E.localParticipant.unpublishTrack(T.track);
|
|
236
|
+
} catch {
|
|
237
|
+
}
|
|
238
|
+
T.track.stop();
|
|
239
|
+
} else
|
|
240
|
+
R.stop();
|
|
241
|
+
}
|
|
242
|
+
g.current = null, a(null), n(!1);
|
|
243
|
+
}, []), l = f(async (E) => {
|
|
244
|
+
const R = d.current;
|
|
245
|
+
if (R) {
|
|
246
|
+
o(null);
|
|
247
|
+
try {
|
|
248
|
+
const T = { ...at };
|
|
249
|
+
E && (T.deviceId = E);
|
|
250
|
+
const z = await nt(T);
|
|
251
|
+
await R.localParticipant.publishTrack(z), g.current = z;
|
|
252
|
+
const I = z.attach();
|
|
253
|
+
a(I), n(!0), E && m(E);
|
|
254
|
+
try {
|
|
255
|
+
R.localParticipant.publishData(
|
|
256
|
+
new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
|
|
257
|
+
{ reliable: !0 }
|
|
258
|
+
);
|
|
259
|
+
} catch {
|
|
260
|
+
}
|
|
261
|
+
} catch (T) {
|
|
262
|
+
const z = T instanceof Error && T.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
|
|
263
|
+
o(z);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}, []), b = f(async () => {
|
|
267
|
+
t ? s() : await l(c || void 0);
|
|
268
|
+
}, [t, c, s, l]), _ = f(async (E) => {
|
|
269
|
+
s(), await l(E);
|
|
270
|
+
}, [s, l]), N = f(() => {
|
|
271
|
+
s(), d.current = null, o(null), m("");
|
|
272
|
+
}, [s]), D = f(() => o(null), []);
|
|
273
|
+
return L(() => () => {
|
|
274
|
+
g.current && g.current.stop();
|
|
275
|
+
}, []), {
|
|
276
|
+
isEnabled: t,
|
|
277
|
+
error: i,
|
|
278
|
+
previewEl: r,
|
|
279
|
+
activeDeviceId: c,
|
|
280
|
+
toggle: b,
|
|
281
|
+
switchDevice: _,
|
|
282
|
+
attachRoom: u,
|
|
283
|
+
teardown: N,
|
|
284
|
+
clearError: D
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
function ct() {
|
|
288
|
+
const [t, n] = x(!1), [i, o] = x(null), [r, a] = x(null), c = S(null), m = f((l) => {
|
|
289
|
+
c.current = l;
|
|
290
|
+
}, []), d = f(() => a(null), []), g = f(async () => {
|
|
291
|
+
const l = c.current;
|
|
292
|
+
if (l) {
|
|
293
|
+
if (t) {
|
|
294
|
+
try {
|
|
295
|
+
await l.localParticipant.setScreenShareEnabled(!1);
|
|
296
|
+
} catch {
|
|
297
|
+
}
|
|
298
|
+
d(), n(!1);
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
o(null);
|
|
302
|
+
try {
|
|
303
|
+
await l.localParticipant.setScreenShareEnabled(!0);
|
|
304
|
+
let b = 0;
|
|
305
|
+
const _ = () => {
|
|
306
|
+
const N = l.localParticipant.getTrackPublication(Oe.Source.ScreenShare);
|
|
307
|
+
if (N != null && N.track) {
|
|
308
|
+
const D = N.track.attach();
|
|
309
|
+
a(D), n(!0);
|
|
310
|
+
try {
|
|
311
|
+
l.localParticipant.publishData(
|
|
312
|
+
new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
|
|
313
|
+
{ reliable: !0 }
|
|
314
|
+
);
|
|
315
|
+
} catch {
|
|
316
|
+
}
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
b++ < 10 ? setTimeout(_, 100) : n(!0);
|
|
320
|
+
};
|
|
321
|
+
_();
|
|
322
|
+
} catch (b) {
|
|
323
|
+
const _ = b instanceof Error ? b.name : "";
|
|
324
|
+
_ !== "NotAllowedError" && _ !== "AbortError" && o("Screen share unavailable. Try again."), n(!1);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}, [t, d]), u = f(() => {
|
|
328
|
+
const l = c.current;
|
|
329
|
+
if (l && t)
|
|
330
|
+
try {
|
|
331
|
+
l.localParticipant.setScreenShareEnabled(!1);
|
|
332
|
+
} catch {
|
|
333
|
+
}
|
|
334
|
+
d(), n(!1), o(null), c.current = null;
|
|
335
|
+
}, [t, d]), s = f(() => o(null), []);
|
|
336
|
+
return { isEnabled: t, error: i, previewEl: r, toggle: g, attachRoom: m, teardown: u, clearError: s };
|
|
337
|
+
}
|
|
338
|
+
function dt() {
|
|
339
|
+
const [t, n] = x([]), [i, o] = x([]), r = f(async () => {
|
|
340
|
+
if (!(typeof navigator > "u" || !navigator.mediaDevices))
|
|
341
|
+
try {
|
|
342
|
+
const a = await navigator.mediaDevices.enumerateDevices();
|
|
343
|
+
n(a.filter((c) => c.kind === "audioinput")), o(a.filter((c) => c.kind === "videoinput"));
|
|
344
|
+
} catch {
|
|
345
|
+
}
|
|
346
|
+
}, []);
|
|
347
|
+
return L(() => {
|
|
348
|
+
if (r(), typeof navigator > "u" || !navigator.mediaDevices) return;
|
|
349
|
+
const a = () => void r();
|
|
350
|
+
return navigator.mediaDevices.addEventListener("devicechange", a), () => navigator.mediaDevices.removeEventListener("devicechange", a);
|
|
351
|
+
}, [r]), { mics: t, cameras: i, refresh: r };
|
|
352
|
+
}
|
|
353
|
+
function ut(t, n, i = !1) {
|
|
354
|
+
const [o, r] = x(null), [a, c] = x(null), [m, d] = x(!i && !!t), g = S("");
|
|
355
|
+
return L(() => {
|
|
356
|
+
if (i || !t) {
|
|
357
|
+
d(!1);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
const u = `${n || ""}::${t}`;
|
|
361
|
+
if (g.current === u) return;
|
|
362
|
+
g.current = u;
|
|
363
|
+
const s = new AbortController(), l = n || "https://app.livelayer.studio";
|
|
364
|
+
return d(!0), c(null), fetch(`${l}/api/widget/agent/${encodeURIComponent(t)}`, {
|
|
365
|
+
signal: s.signal
|
|
366
|
+
}).then(async (b) => {
|
|
367
|
+
if (!b.ok) {
|
|
368
|
+
const _ = await b.json().catch(() => ({}));
|
|
369
|
+
throw new Error(_.error || `HTTP ${b.status}`);
|
|
370
|
+
}
|
|
371
|
+
return b.json();
|
|
372
|
+
}).then((b) => {
|
|
373
|
+
r(b), d(!1);
|
|
374
|
+
}).catch((b) => {
|
|
375
|
+
s.signal.aborted || (c(b instanceof Error ? b.message : "Agent lookup failed"), d(!1));
|
|
376
|
+
}), () => s.abort();
|
|
377
|
+
}, [t, n, i]), { info: o, error: a, loading: m };
|
|
378
|
+
}
|
|
379
|
+
function ht(t) {
|
|
226
380
|
if (typeof window > "u") return null;
|
|
227
381
|
try {
|
|
228
|
-
return window.localStorage.getItem(
|
|
382
|
+
return window.localStorage.getItem(t);
|
|
229
383
|
} catch {
|
|
230
384
|
return null;
|
|
231
385
|
}
|
|
232
386
|
}
|
|
233
|
-
function
|
|
387
|
+
function pt(t, n) {
|
|
234
388
|
if (!(typeof window > "u"))
|
|
235
389
|
try {
|
|
236
|
-
window.localStorage.setItem(
|
|
390
|
+
window.localStorage.setItem(t, n);
|
|
237
391
|
} catch {
|
|
238
392
|
}
|
|
239
393
|
}
|
|
240
|
-
function
|
|
241
|
-
value:
|
|
242
|
-
defaultValue:
|
|
243
|
-
onChange:
|
|
394
|
+
function mt({
|
|
395
|
+
value: t,
|
|
396
|
+
defaultValue: n = "expanded",
|
|
397
|
+
onChange: i
|
|
244
398
|
} = {}) {
|
|
245
|
-
const
|
|
246
|
-
(
|
|
247
|
-
|
|
399
|
+
const o = t !== void 0, [r, a] = x(n), c = o ? t : r, m = f(
|
|
400
|
+
(d) => {
|
|
401
|
+
d !== c && (o || a(d), i == null || i(d));
|
|
248
402
|
},
|
|
249
|
-
[
|
|
403
|
+
[c, o, i]
|
|
250
404
|
);
|
|
251
|
-
return [
|
|
405
|
+
return [c, m];
|
|
252
406
|
}
|
|
253
|
-
const
|
|
254
|
-
function
|
|
255
|
-
return
|
|
407
|
+
const ft = ["hidden", "minimized", "expanded"];
|
|
408
|
+
function gt(t) {
|
|
409
|
+
return t && ft.includes(t) ? t : null;
|
|
256
410
|
}
|
|
257
|
-
function
|
|
258
|
-
value:
|
|
259
|
-
defaultValue:
|
|
260
|
-
onChange:
|
|
261
|
-
persistKey:
|
|
262
|
-
disablePersistence:
|
|
411
|
+
function vt({
|
|
412
|
+
value: t,
|
|
413
|
+
defaultValue: n = "expanded",
|
|
414
|
+
onChange: i,
|
|
415
|
+
persistKey: o = "ll-widget",
|
|
416
|
+
disablePersistence: r = !1
|
|
263
417
|
} = {}) {
|
|
264
|
-
const a = `${
|
|
265
|
-
value:
|
|
266
|
-
defaultValue:
|
|
418
|
+
const a = `${o}:display-mode`, c = S(!1), [m, d] = mt({
|
|
419
|
+
value: t,
|
|
420
|
+
defaultValue: n,
|
|
267
421
|
onChange: (g) => {
|
|
268
|
-
|
|
422
|
+
t === void 0 && !r && pt(a, g), i == null || i(g);
|
|
269
423
|
}
|
|
270
424
|
});
|
|
271
|
-
return
|
|
272
|
-
if (
|
|
273
|
-
const g =
|
|
274
|
-
g && g !==
|
|
275
|
-
}, []), [
|
|
425
|
+
return L(() => {
|
|
426
|
+
if (c.current || (c.current = !0, r || t !== void 0)) return;
|
|
427
|
+
const g = gt(ht(a));
|
|
428
|
+
g && g !== m && d(g);
|
|
429
|
+
}, []), [m, d];
|
|
276
430
|
}
|
|
277
|
-
const
|
|
278
|
-
function
|
|
279
|
-
const [
|
|
280
|
-
return
|
|
281
|
-
if (
|
|
282
|
-
|
|
431
|
+
const yt = 640;
|
|
432
|
+
function _t(t = yt) {
|
|
433
|
+
const [n, i] = x(!1);
|
|
434
|
+
return L(() => {
|
|
435
|
+
if (t === !1) {
|
|
436
|
+
i(!1);
|
|
283
437
|
return;
|
|
284
438
|
}
|
|
285
439
|
if (typeof window > "u" || typeof window.matchMedia > "u")
|
|
286
440
|
return;
|
|
287
|
-
const
|
|
288
|
-
return a(), typeof
|
|
289
|
-
|
|
441
|
+
const o = `(max-width: ${t - 1}px)`, r = window.matchMedia(o), a = () => i(r.matches);
|
|
442
|
+
return a(), typeof r.addEventListener == "function" ? (r.addEventListener("change", a), () => r.removeEventListener("change", a)) : (r.addListener(a), () => {
|
|
443
|
+
r.removeListener(a);
|
|
290
444
|
});
|
|
291
|
-
}, [
|
|
445
|
+
}, [t]), n;
|
|
292
446
|
}
|
|
293
|
-
const
|
|
447
|
+
const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ w(
|
|
294
448
|
"svg",
|
|
295
449
|
{
|
|
296
|
-
className:
|
|
450
|
+
className: n,
|
|
297
451
|
fill: "none",
|
|
298
452
|
viewBox: "0 0 24 24",
|
|
299
453
|
stroke: "currentColor",
|
|
@@ -321,7 +475,7 @@ const oe = ({ muted: n = !1, className: t }) => n ? /* @__PURE__ */ f(
|
|
|
321
475
|
) : /* @__PURE__ */ e(
|
|
322
476
|
"svg",
|
|
323
477
|
{
|
|
324
|
-
className:
|
|
478
|
+
className: n,
|
|
325
479
|
fill: "none",
|
|
326
480
|
viewBox: "0 0 24 24",
|
|
327
481
|
stroke: "currentColor",
|
|
@@ -336,10 +490,10 @@ const oe = ({ muted: n = !1, className: t }) => n ? /* @__PURE__ */ f(
|
|
|
336
490
|
}
|
|
337
491
|
)
|
|
338
492
|
}
|
|
339
|
-
),
|
|
493
|
+
), $e = ({ className: t }) => /* @__PURE__ */ e(
|
|
340
494
|
"svg",
|
|
341
495
|
{
|
|
342
|
-
className:
|
|
496
|
+
className: t,
|
|
343
497
|
fill: "none",
|
|
344
498
|
viewBox: "0 0 24 24",
|
|
345
499
|
stroke: "currentColor",
|
|
@@ -354,21 +508,10 @@ const oe = ({ muted: n = !1, className: t }) => n ? /* @__PURE__ */ f(
|
|
|
354
508
|
}
|
|
355
509
|
)
|
|
356
510
|
}
|
|
357
|
-
),
|
|
358
|
-
"svg",
|
|
359
|
-
{
|
|
360
|
-
className: n,
|
|
361
|
-
fill: "none",
|
|
362
|
-
viewBox: "0 0 24 24",
|
|
363
|
-
stroke: "currentColor",
|
|
364
|
-
strokeWidth: 2,
|
|
365
|
-
"aria-hidden": "true",
|
|
366
|
-
children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
367
|
-
}
|
|
368
|
-
), ve = ({ className: n }) => /* @__PURE__ */ e(
|
|
511
|
+
), bt = ({ className: t }) => /* @__PURE__ */ e(
|
|
369
512
|
"svg",
|
|
370
513
|
{
|
|
371
|
-
className:
|
|
514
|
+
className: t,
|
|
372
515
|
fill: "none",
|
|
373
516
|
viewBox: "0 0 24 24",
|
|
374
517
|
stroke: "currentColor",
|
|
@@ -376,45 +519,12 @@ const oe = ({ muted: n = !1, className: t }) => n ? /* @__PURE__ */ f(
|
|
|
376
519
|
"aria-hidden": "true",
|
|
377
520
|
children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
378
521
|
}
|
|
379
|
-
),
|
|
522
|
+
), wt = {
|
|
380
523
|
left: 180,
|
|
381
524
|
right: 0,
|
|
382
525
|
up: -90,
|
|
383
526
|
down: 90
|
|
384
|
-
},
|
|
385
|
-
"svg",
|
|
386
|
-
{
|
|
387
|
-
className: t,
|
|
388
|
-
fill: "none",
|
|
389
|
-
viewBox: "0 0 24 24",
|
|
390
|
-
stroke: "currentColor",
|
|
391
|
-
strokeWidth: 2,
|
|
392
|
-
style: { transform: `rotate(${Fe[n]}deg)` },
|
|
393
|
-
"aria-hidden": "true",
|
|
394
|
-
children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 5l7 7-7 7" })
|
|
395
|
-
}
|
|
396
|
-
), He = ({ muted: n = !1, className: t }) => /* @__PURE__ */ f(
|
|
397
|
-
"svg",
|
|
398
|
-
{
|
|
399
|
-
className: t,
|
|
400
|
-
fill: "none",
|
|
401
|
-
viewBox: "0 0 24 24",
|
|
402
|
-
stroke: "currentColor",
|
|
403
|
-
strokeWidth: 2,
|
|
404
|
-
"aria-hidden": "true",
|
|
405
|
-
children: [
|
|
406
|
-
/* @__PURE__ */ e(
|
|
407
|
-
"path",
|
|
408
|
-
{
|
|
409
|
-
strokeLinecap: "round",
|
|
410
|
-
strokeLinejoin: "round",
|
|
411
|
-
d: "M15 9v6m3-9v12M9 5l-3 4H3v6h3l3 4V5z"
|
|
412
|
-
}
|
|
413
|
-
),
|
|
414
|
-
n && /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4 20L20 4" })
|
|
415
|
-
]
|
|
416
|
-
}
|
|
417
|
-
), Ye = ({ className: n }) => /* @__PURE__ */ e(
|
|
527
|
+
}, kt = ({ direction: t = "right", className: n }) => /* @__PURE__ */ e(
|
|
418
528
|
"svg",
|
|
419
529
|
{
|
|
420
530
|
className: n,
|
|
@@ -422,140 +532,230 @@ const oe = ({ muted: n = !1, className: t }) => n ? /* @__PURE__ */ f(
|
|
|
422
532
|
viewBox: "0 0 24 24",
|
|
423
533
|
stroke: "currentColor",
|
|
424
534
|
strokeWidth: 2,
|
|
535
|
+
style: { transform: `rotate(${wt[t]}deg)` },
|
|
425
536
|
"aria-hidden": "true",
|
|
426
|
-
children: /* @__PURE__ */ e(
|
|
427
|
-
"path",
|
|
428
|
-
{
|
|
429
|
-
strokeLinecap: "round",
|
|
430
|
-
strokeLinejoin: "round",
|
|
431
|
-
d: "M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"
|
|
432
|
-
}
|
|
433
|
-
)
|
|
537
|
+
children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" })
|
|
434
538
|
}
|
|
435
539
|
);
|
|
436
|
-
function
|
|
437
|
-
return
|
|
540
|
+
function xt(t) {
|
|
541
|
+
return t === "top-left" || t === "bottom-left" ? "left" : "right";
|
|
438
542
|
}
|
|
439
|
-
const
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
543
|
+
const We = "ll-hidden-tab-center-y", Ct = 5, Be = 16;
|
|
544
|
+
function Nt() {
|
|
545
|
+
if (typeof window > "u") return null;
|
|
546
|
+
try {
|
|
547
|
+
const t = window.localStorage.getItem(We);
|
|
548
|
+
if (!t) return null;
|
|
549
|
+
const n = Number.parseFloat(t);
|
|
550
|
+
return Number.isFinite(n) ? n : null;
|
|
551
|
+
} catch {
|
|
552
|
+
return null;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
function Ue(t) {
|
|
556
|
+
if (!(typeof window > "u"))
|
|
557
|
+
try {
|
|
558
|
+
window.localStorage.setItem(We, String(t));
|
|
559
|
+
} catch {
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
const Et = ({
|
|
563
|
+
position: t,
|
|
564
|
+
isMobile: n,
|
|
565
|
+
isSpeaking: i,
|
|
566
|
+
onExpand: o,
|
|
567
|
+
label: r = "Open widget"
|
|
445
568
|
}) => {
|
|
446
|
-
const a =
|
|
569
|
+
const a = xt(t), c = a === "right" ? "left" : "right", m = n ? 80 : 72, [d, g] = x(null), [u, s] = x(!1), l = S(null), b = S(!1), _ = f(
|
|
570
|
+
(k) => {
|
|
571
|
+
if (typeof window > "u") return k;
|
|
572
|
+
const C = m / 2, y = Be + C, A = window.innerHeight - Be - C;
|
|
573
|
+
return A < y ? Math.max(y, k) : Math.max(y, Math.min(A, k));
|
|
574
|
+
},
|
|
575
|
+
[m]
|
|
576
|
+
);
|
|
577
|
+
L(() => {
|
|
578
|
+
const k = Nt();
|
|
579
|
+
g(_(k ?? window.innerHeight / 2));
|
|
580
|
+
const C = () => {
|
|
581
|
+
g((y) => y === null ? null : _(y));
|
|
582
|
+
};
|
|
583
|
+
return window.addEventListener("resize", C), () => window.removeEventListener("resize", C);
|
|
584
|
+
}, [_]);
|
|
585
|
+
const N = f(
|
|
586
|
+
(k) => {
|
|
587
|
+
if (!(k.pointerType === "mouse" && k.button !== 0) && d !== null) {
|
|
588
|
+
try {
|
|
589
|
+
k.currentTarget.setPointerCapture(k.pointerId);
|
|
590
|
+
} catch {
|
|
591
|
+
}
|
|
592
|
+
l.current = {
|
|
593
|
+
startClientY: k.clientY,
|
|
594
|
+
startCenterY: d,
|
|
595
|
+
moved: !1
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
[d]
|
|
600
|
+
), D = f(
|
|
601
|
+
(k) => {
|
|
602
|
+
const C = l.current;
|
|
603
|
+
if (!C) return;
|
|
604
|
+
const y = k.clientY - C.startClientY;
|
|
605
|
+
!C.moved && Math.abs(y) > Ct && (C.moved = !0, s(!0)), C.moved && g(_(C.startCenterY + y));
|
|
606
|
+
},
|
|
607
|
+
[_]
|
|
608
|
+
), E = f(
|
|
609
|
+
(k) => {
|
|
610
|
+
const C = l.current;
|
|
611
|
+
if (C) {
|
|
612
|
+
try {
|
|
613
|
+
k.currentTarget.releasePointerCapture(k.pointerId);
|
|
614
|
+
} catch {
|
|
615
|
+
}
|
|
616
|
+
l.current = null, C.moved && (s(!1), b.current = !0, g((y) => (y !== null && Ue(y), y)));
|
|
617
|
+
}
|
|
618
|
+
},
|
|
619
|
+
[]
|
|
620
|
+
), R = f(() => {
|
|
621
|
+
if (b.current) {
|
|
622
|
+
b.current = !1;
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
o();
|
|
626
|
+
}, [o]), T = f(
|
|
627
|
+
(k) => {
|
|
628
|
+
if (k.key === "ArrowUp" || k.key === "ArrowDown") {
|
|
629
|
+
k.preventDefault();
|
|
630
|
+
const C = k.key === "ArrowUp" ? -8 : 8;
|
|
631
|
+
g((y) => {
|
|
632
|
+
if (y === null) return y;
|
|
633
|
+
const A = _(y + C);
|
|
634
|
+
return Ue(A), A;
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
},
|
|
638
|
+
[_]
|
|
639
|
+
), z = [
|
|
447
640
|
"ll-hidden",
|
|
448
641
|
`ll-hidden--${a}`,
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
642
|
+
n ? "ll-hidden--mobile" : "ll-hidden--desktop",
|
|
643
|
+
i ? "ll-hidden--speaking" : null,
|
|
644
|
+
u ? "is-dragging" : null
|
|
645
|
+
].filter(Boolean).join(" "), I = d === null ? void 0 : { top: `${d - m / 2}px`, transform: "none" };
|
|
452
646
|
return /* @__PURE__ */ e(
|
|
453
647
|
"button",
|
|
454
648
|
{
|
|
455
649
|
type: "button",
|
|
456
|
-
className:
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
650
|
+
className: z,
|
|
651
|
+
onPointerDown: N,
|
|
652
|
+
onPointerMove: D,
|
|
653
|
+
onPointerUp: E,
|
|
654
|
+
onPointerCancel: E,
|
|
655
|
+
onClick: R,
|
|
656
|
+
onKeyDown: T,
|
|
657
|
+
"aria-label": r,
|
|
658
|
+
"data-position": t,
|
|
659
|
+
style: I,
|
|
660
|
+
children: /* @__PURE__ */ e(kt, { direction: c, className: "ll-hidden__chevron" })
|
|
461
661
|
}
|
|
462
662
|
);
|
|
463
|
-
},
|
|
464
|
-
audioLevel:
|
|
465
|
-
bars:
|
|
466
|
-
maxHeight:
|
|
467
|
-
minHeight:
|
|
468
|
-
className:
|
|
663
|
+
}, St = ({
|
|
664
|
+
audioLevel: t,
|
|
665
|
+
bars: n = 20,
|
|
666
|
+
maxHeight: i = 20,
|
|
667
|
+
minHeight: o = 4,
|
|
668
|
+
className: r,
|
|
469
669
|
barClassName: a
|
|
470
670
|
}) => {
|
|
471
|
-
const
|
|
472
|
-
const
|
|
473
|
-
return Array.from({ length:
|
|
474
|
-
}, [
|
|
475
|
-
|
|
476
|
-
for (let
|
|
477
|
-
const
|
|
478
|
-
if (!
|
|
479
|
-
const
|
|
480
|
-
|
|
671
|
+
const c = S(null), m = S([]), d = Se(() => {
|
|
672
|
+
const u = (Math.sqrt(5) - 1) / 2;
|
|
673
|
+
return Array.from({ length: n }, (s, l) => 0.5 + l * u % 1 * 0.5);
|
|
674
|
+
}, [n]);
|
|
675
|
+
L(() => t.subscribe((s) => {
|
|
676
|
+
for (let l = 0; l < n; l++) {
|
|
677
|
+
const b = m.current[l];
|
|
678
|
+
if (!b) continue;
|
|
679
|
+
const _ = Math.max(o, s * i * d[l]);
|
|
680
|
+
b.style.height = `${_}px`;
|
|
481
681
|
}
|
|
482
|
-
}), [
|
|
483
|
-
const g = ["ll-waveform",
|
|
484
|
-
return /* @__PURE__ */ e("div", { ref:
|
|
682
|
+
}), [t, n, i, o, d]);
|
|
683
|
+
const g = ["ll-waveform", r].filter(Boolean).join(" ");
|
|
684
|
+
return /* @__PURE__ */ e("div", { ref: c, className: g, "aria-hidden": "true", children: Array.from({ length: n }, (u, s) => /* @__PURE__ */ e(
|
|
485
685
|
"div",
|
|
486
686
|
{
|
|
487
|
-
ref: (
|
|
488
|
-
|
|
687
|
+
ref: (l) => {
|
|
688
|
+
m.current[s] = l;
|
|
489
689
|
},
|
|
490
690
|
className: ["ll-waveform__bar", a].filter(Boolean).join(" "),
|
|
491
|
-
style: { height: `${
|
|
691
|
+
style: { height: `${o}px` }
|
|
492
692
|
},
|
|
493
|
-
|
|
693
|
+
s
|
|
494
694
|
)) });
|
|
495
|
-
},
|
|
496
|
-
position:
|
|
497
|
-
isMobile:
|
|
498
|
-
agentName:
|
|
499
|
-
avatarImageUrl:
|
|
500
|
-
agentState:
|
|
695
|
+
}, Lt = ({
|
|
696
|
+
position: t,
|
|
697
|
+
isMobile: n,
|
|
698
|
+
agentName: i,
|
|
699
|
+
avatarImageUrl: o,
|
|
700
|
+
agentState: r,
|
|
501
701
|
isMuted: a,
|
|
502
|
-
audioLevel:
|
|
503
|
-
onExpand:
|
|
504
|
-
onToggleMute:
|
|
702
|
+
audioLevel: c,
|
|
703
|
+
onExpand: m,
|
|
704
|
+
onToggleMute: d,
|
|
505
705
|
onClose: g
|
|
506
|
-
}) =>
|
|
706
|
+
}) => n ? /* @__PURE__ */ e(
|
|
507
707
|
"div",
|
|
508
708
|
{
|
|
509
709
|
className: "ll-minimized ll-minimized--mobile",
|
|
510
710
|
role: "region",
|
|
511
|
-
"aria-label": `${
|
|
512
|
-
children: /* @__PURE__ */
|
|
711
|
+
"aria-label": `${i} widget`,
|
|
712
|
+
children: /* @__PURE__ */ w(
|
|
513
713
|
"button",
|
|
514
714
|
{
|
|
515
715
|
type: "button",
|
|
516
716
|
className: "ll-minimized__surface",
|
|
517
|
-
onClick:
|
|
518
|
-
"aria-label": `Expand ${
|
|
717
|
+
onClick: m,
|
|
718
|
+
"aria-label": `Expand ${i} widget`,
|
|
519
719
|
children: [
|
|
520
|
-
|
|
720
|
+
o ? (
|
|
521
721
|
// eslint-disable-next-line @next/next/no-img-element
|
|
522
722
|
/* @__PURE__ */ e(
|
|
523
723
|
"img",
|
|
524
724
|
{
|
|
525
|
-
src:
|
|
526
|
-
alt:
|
|
725
|
+
src: o,
|
|
726
|
+
alt: i,
|
|
527
727
|
className: "ll-minimized__avatar"
|
|
528
728
|
}
|
|
529
729
|
)
|
|
530
730
|
) : /* @__PURE__ */ e("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
|
|
531
731
|
/* @__PURE__ */ e(
|
|
532
|
-
|
|
732
|
+
St,
|
|
533
733
|
{
|
|
534
|
-
audioLevel:
|
|
734
|
+
audioLevel: c,
|
|
535
735
|
bars: 16,
|
|
536
736
|
maxHeight: 18,
|
|
537
737
|
className: "ll-minimized__waveform"
|
|
538
738
|
}
|
|
539
739
|
),
|
|
540
|
-
/* @__PURE__ */ e("span", { className: "ll-minimized__name", children:
|
|
541
|
-
/* @__PURE__ */
|
|
740
|
+
/* @__PURE__ */ e("span", { className: "ll-minimized__name", children: i }),
|
|
741
|
+
/* @__PURE__ */ w("div", { className: "ll-minimized__controls", children: [
|
|
542
742
|
/* @__PURE__ */ e(
|
|
543
743
|
"span",
|
|
544
744
|
{
|
|
545
745
|
className: "ll-minimized__btn",
|
|
546
746
|
role: "button",
|
|
547
747
|
tabIndex: 0,
|
|
548
|
-
onClick: (
|
|
549
|
-
|
|
748
|
+
onClick: (u) => {
|
|
749
|
+
u.stopPropagation(), d();
|
|
550
750
|
},
|
|
551
|
-
onKeyDown: (
|
|
552
|
-
(
|
|
751
|
+
onKeyDown: (u) => {
|
|
752
|
+
(u.key === "Enter" || u.key === " ") && (u.stopPropagation(), u.preventDefault(), d());
|
|
553
753
|
},
|
|
554
754
|
"aria-label": a ? "Unmute microphone" : "Mute microphone",
|
|
555
|
-
children: /* @__PURE__ */ e(
|
|
755
|
+
children: /* @__PURE__ */ e(Pe, { muted: a, className: "ll-minimized__icon" })
|
|
556
756
|
}
|
|
557
757
|
),
|
|
558
|
-
/* @__PURE__ */ e(
|
|
758
|
+
/* @__PURE__ */ e($e, { className: "ll-minimized__icon ll-minimized__icon--expand" })
|
|
559
759
|
] })
|
|
560
760
|
]
|
|
561
761
|
}
|
|
@@ -565,34 +765,34 @@ const Je = ({
|
|
|
565
765
|
"div",
|
|
566
766
|
{
|
|
567
767
|
className: "ll-minimized ll-minimized--desktop",
|
|
568
|
-
"data-position":
|
|
768
|
+
"data-position": t,
|
|
569
769
|
role: "region",
|
|
570
|
-
"aria-label": `${
|
|
571
|
-
children: /* @__PURE__ */
|
|
572
|
-
|
|
770
|
+
"aria-label": `${i} widget`,
|
|
771
|
+
children: /* @__PURE__ */ w("div", { className: "ll-minimized__surface", children: [
|
|
772
|
+
o ? (
|
|
573
773
|
// eslint-disable-next-line @next/next/no-img-element
|
|
574
774
|
/* @__PURE__ */ e(
|
|
575
775
|
"img",
|
|
576
776
|
{
|
|
577
|
-
src:
|
|
578
|
-
alt:
|
|
777
|
+
src: o,
|
|
778
|
+
alt: i,
|
|
579
779
|
className: "ll-minimized__avatar"
|
|
580
780
|
}
|
|
581
781
|
)
|
|
582
782
|
) : /* @__PURE__ */ e("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
|
|
583
|
-
/* @__PURE__ */
|
|
584
|
-
/* @__PURE__ */ e("span", { className: "ll-minimized__name", children:
|
|
585
|
-
/* @__PURE__ */ e("span", { className: "ll-minimized__state", children:
|
|
783
|
+
/* @__PURE__ */ w("div", { className: "ll-minimized__meta", children: [
|
|
784
|
+
/* @__PURE__ */ e("span", { className: "ll-minimized__name", children: i }),
|
|
785
|
+
/* @__PURE__ */ e("span", { className: "ll-minimized__state", children: r === "speaking" ? "Speaking" : r === "thinking" ? "Thinking" : "Listening" })
|
|
586
786
|
] }),
|
|
587
|
-
/* @__PURE__ */
|
|
787
|
+
/* @__PURE__ */ w("div", { className: "ll-minimized__controls", children: [
|
|
588
788
|
/* @__PURE__ */ e(
|
|
589
789
|
"button",
|
|
590
790
|
{
|
|
591
791
|
type: "button",
|
|
592
792
|
className: "ll-minimized__btn",
|
|
593
|
-
onClick:
|
|
793
|
+
onClick: d,
|
|
594
794
|
"aria-label": a ? "Unmute microphone" : "Mute microphone",
|
|
595
|
-
children: /* @__PURE__ */ e(
|
|
795
|
+
children: /* @__PURE__ */ e(Pe, { muted: a, className: "ll-minimized__icon" })
|
|
596
796
|
}
|
|
597
797
|
),
|
|
598
798
|
/* @__PURE__ */ e(
|
|
@@ -600,9 +800,9 @@ const Je = ({
|
|
|
600
800
|
{
|
|
601
801
|
type: "button",
|
|
602
802
|
className: "ll-minimized__btn",
|
|
603
|
-
onClick:
|
|
604
|
-
"aria-label": `Expand ${
|
|
605
|
-
children: /* @__PURE__ */ e(
|
|
803
|
+
onClick: m,
|
|
804
|
+
"aria-label": `Expand ${i} widget`,
|
|
805
|
+
children: /* @__PURE__ */ e($e, { className: "ll-minimized__icon" })
|
|
606
806
|
}
|
|
607
807
|
),
|
|
608
808
|
/* @__PURE__ */ e(
|
|
@@ -612,24 +812,24 @@ const Je = ({
|
|
|
612
812
|
className: "ll-minimized__btn ll-minimized__btn--close",
|
|
613
813
|
onClick: g,
|
|
614
814
|
"aria-label": "Close widget",
|
|
615
|
-
children: /* @__PURE__ */ e(
|
|
815
|
+
children: /* @__PURE__ */ e(bt, { className: "ll-minimized__icon" })
|
|
616
816
|
}
|
|
617
817
|
)
|
|
618
818
|
] })
|
|
619
819
|
] })
|
|
620
820
|
}
|
|
621
|
-
),
|
|
622
|
-
src:
|
|
623
|
-
alt:
|
|
624
|
-
preCannedPlaying:
|
|
625
|
-
className:
|
|
626
|
-
style:
|
|
821
|
+
), Mt = ({
|
|
822
|
+
src: t,
|
|
823
|
+
alt: n,
|
|
824
|
+
preCannedPlaying: i = !1,
|
|
825
|
+
className: o,
|
|
826
|
+
style: r
|
|
627
827
|
}) => {
|
|
628
|
-
const [a,
|
|
629
|
-
if (
|
|
630
|
-
|
|
631
|
-
}, [
|
|
632
|
-
const
|
|
828
|
+
const [a, c] = x(!1), m = S(t);
|
|
829
|
+
if (L(() => {
|
|
830
|
+
m.current !== t && (m.current = t, c(!1));
|
|
831
|
+
}, [t]), !t) return null;
|
|
832
|
+
const d = {
|
|
633
833
|
position: "absolute",
|
|
634
834
|
inset: 0,
|
|
635
835
|
width: "100%",
|
|
@@ -637,302 +837,573 @@ const Je = ({
|
|
|
637
837
|
objectFit: "cover",
|
|
638
838
|
objectPosition: "top",
|
|
639
839
|
transition: "opacity 500ms ease, transform 500ms ease",
|
|
640
|
-
transform:
|
|
840
|
+
transform: i ? "scale(1.02)" : "scale(1)",
|
|
641
841
|
opacity: a ? 1 : 0,
|
|
642
|
-
...
|
|
842
|
+
...r
|
|
643
843
|
};
|
|
644
844
|
return (
|
|
645
845
|
// eslint-disable-next-line @next/next/no-img-element
|
|
646
846
|
/* @__PURE__ */ e(
|
|
647
847
|
"img",
|
|
648
848
|
{
|
|
649
|
-
src:
|
|
650
|
-
alt:
|
|
651
|
-
className:
|
|
652
|
-
style:
|
|
849
|
+
src: t,
|
|
850
|
+
alt: n,
|
|
851
|
+
className: o,
|
|
852
|
+
style: d,
|
|
653
853
|
loading: "eager",
|
|
654
854
|
fetchpriority: "high",
|
|
655
|
-
onLoad: () =>
|
|
855
|
+
onLoad: () => c(!0)
|
|
656
856
|
}
|
|
657
857
|
)
|
|
658
858
|
);
|
|
659
|
-
},
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
const r = ["ll-pill", `ll-pill--${n}`, t].filter(Boolean).join(" ");
|
|
666
|
-
return /* @__PURE__ */ f("div", { className: r, "data-agent-state": n, children: [
|
|
667
|
-
/* @__PURE__ */ e("span", { className: "ll-pill__dot" }),
|
|
668
|
-
/* @__PURE__ */ e("span", { className: "ll-pill__label", children: en[n] })
|
|
669
|
-
] });
|
|
670
|
-
}, tn = ({
|
|
671
|
-
position: n,
|
|
672
|
-
isMobile: t,
|
|
673
|
-
agentName: r,
|
|
674
|
-
avatarImageUrl: i,
|
|
675
|
-
idleLoopUrl: l,
|
|
859
|
+
}, It = ({
|
|
860
|
+
position: t,
|
|
861
|
+
isMobile: n,
|
|
862
|
+
agentName: i,
|
|
863
|
+
avatarImageUrl: o,
|
|
864
|
+
idleLoopUrl: r,
|
|
676
865
|
greeting: a,
|
|
677
|
-
branding:
|
|
678
|
-
teamMembers:
|
|
679
|
-
currentTeamMemberId:
|
|
866
|
+
branding: c,
|
|
867
|
+
teamMembers: m,
|
|
868
|
+
currentTeamMemberId: d,
|
|
680
869
|
isSwitchingTeamMember: g,
|
|
681
|
-
teamSwitcherOpen:
|
|
682
|
-
onToggleTeamSwitcher:
|
|
683
|
-
onSelectTeamMember:
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
canResume:
|
|
690
|
-
|
|
691
|
-
error:
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
870
|
+
teamSwitcherOpen: u,
|
|
871
|
+
onToggleTeamSwitcher: s,
|
|
872
|
+
onSelectTeamMember: l,
|
|
873
|
+
languageMenuOpen: b,
|
|
874
|
+
onToggleLanguageMenu: _,
|
|
875
|
+
connectionState: N,
|
|
876
|
+
agentState: D,
|
|
877
|
+
transcript: E,
|
|
878
|
+
canResume: R,
|
|
879
|
+
needsUserGesture: T,
|
|
880
|
+
error: z,
|
|
881
|
+
isMuted: I,
|
|
882
|
+
micError: k,
|
|
883
|
+
micDevices: C,
|
|
884
|
+
isCameraEnabled: y,
|
|
885
|
+
cameraPreviewEl: A,
|
|
886
|
+
cameraDevices: X,
|
|
887
|
+
activeCameraId: ne,
|
|
888
|
+
isScreenShareEnabled: U,
|
|
889
|
+
screenPreviewEl: j,
|
|
890
|
+
isSpeakerMuted: F,
|
|
891
|
+
allowCamera: re,
|
|
892
|
+
allowScreenShare: P,
|
|
893
|
+
allowTyping: be,
|
|
894
|
+
avatarVideoContainerRef: we,
|
|
895
|
+
onConnect: ge,
|
|
896
|
+
onDisconnect: de,
|
|
897
|
+
onRetry: ke,
|
|
898
|
+
onResumeAudio: xe,
|
|
899
|
+
onToggleMute: Q,
|
|
900
|
+
onToggleCamera: B,
|
|
901
|
+
onSwitchCameraDevice: ve,
|
|
902
|
+
onToggleScreenShare: Z,
|
|
903
|
+
onToggleSpeaker: G,
|
|
904
|
+
onSendMessage: ee,
|
|
905
|
+
onMinimize: ue,
|
|
906
|
+
onClose: V,
|
|
907
|
+
onClearMicError: K
|
|
701
908
|
}) => {
|
|
702
|
-
|
|
909
|
+
var ye;
|
|
910
|
+
const O = E.length > 0 ? E[E.length - 1] : null, Y = ((m == null ? void 0 : m.length) ?? 0) > 1, ie = N === "connecting" || N === "connected", H = N === "connected", he = N === "idle" || N === "disconnected" || N === "error", pe = S(null), oe = S(null);
|
|
911
|
+
L(() => {
|
|
912
|
+
const h = pe.current;
|
|
913
|
+
h && (h.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "cover", A.style.transform = "scaleX(-1)", h.appendChild(A)));
|
|
914
|
+
}, [A]), L(() => {
|
|
915
|
+
const h = oe.current;
|
|
916
|
+
h && (h.innerHTML = "", j && (j.style.width = "100%", j.style.height = "100%", j.style.objectFit = "contain", h.appendChild(j)));
|
|
917
|
+
}, [j]);
|
|
918
|
+
const [q, le] = x(!1), [ae, J] = x(!1);
|
|
919
|
+
L(() => {
|
|
920
|
+
if (!q && !ae && !b && !u) return;
|
|
921
|
+
const h = () => {
|
|
922
|
+
le(!1), J(!1), b && _(), u && s();
|
|
923
|
+
};
|
|
924
|
+
return document.addEventListener("click", h), () => document.removeEventListener("click", h);
|
|
925
|
+
}, [
|
|
926
|
+
q,
|
|
927
|
+
ae,
|
|
928
|
+
b,
|
|
929
|
+
u,
|
|
930
|
+
_,
|
|
931
|
+
s
|
|
932
|
+
]);
|
|
933
|
+
const [se, ce] = x(""), $ = f(
|
|
934
|
+
(h) => {
|
|
935
|
+
h.preventDefault();
|
|
936
|
+
const W = se.trim();
|
|
937
|
+
W && (ee(W), ce(""));
|
|
938
|
+
},
|
|
939
|
+
[se, ee]
|
|
940
|
+
), p = c.productName || "Live Layer", me = H && (O != null && O.text) ? O.text : a || "", Ce = [
|
|
703
941
|
"ll-expanded",
|
|
704
|
-
|
|
942
|
+
n ? "ll-expanded--mobile" : "ll-expanded--desktop"
|
|
705
943
|
].join(" ");
|
|
706
|
-
return /* @__PURE__ */
|
|
944
|
+
return /* @__PURE__ */ w(
|
|
707
945
|
"div",
|
|
708
946
|
{
|
|
709
|
-
className:
|
|
710
|
-
"data-position":
|
|
947
|
+
className: Ce,
|
|
948
|
+
"data-position": t,
|
|
949
|
+
"data-state": H ? "connected" : ie ? "connecting" : "idle",
|
|
711
950
|
role: "dialog",
|
|
712
|
-
"aria-label": `${
|
|
951
|
+
"aria-label": `${i} widget`,
|
|
713
952
|
children: [
|
|
714
|
-
/* @__PURE__ */
|
|
715
|
-
/* @__PURE__ */
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
"
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
953
|
+
/* @__PURE__ */ w("div", { className: "ll-expanded__bg", children: [
|
|
954
|
+
o ? /* @__PURE__ */ e(
|
|
955
|
+
Mt,
|
|
956
|
+
{
|
|
957
|
+
src: o,
|
|
958
|
+
alt: i,
|
|
959
|
+
className: "ll-expanded__bg-img"
|
|
960
|
+
}
|
|
961
|
+
) : /* @__PURE__ */ e("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ e("span", { className: "ll-expanded__bg-initial", children: ((ye = i == null ? void 0 : i.charAt(0)) == null ? void 0 : ye.toUpperCase()) || "A" }) }),
|
|
962
|
+
r && !H && /* @__PURE__ */ e(
|
|
963
|
+
"video",
|
|
964
|
+
{
|
|
965
|
+
className: "ll-expanded__bg-idle",
|
|
966
|
+
src: r,
|
|
967
|
+
autoPlay: !0,
|
|
968
|
+
loop: !0,
|
|
969
|
+
muted: !0,
|
|
970
|
+
playsInline: !0
|
|
971
|
+
}
|
|
972
|
+
)
|
|
973
|
+
] }),
|
|
974
|
+
/* @__PURE__ */ e("div", { ref: we, className: "ll-expanded__video" }),
|
|
975
|
+
N === "connecting" && /* @__PURE__ */ w("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
|
|
976
|
+
/* @__PURE__ */ e("div", { className: "ll-expanded__spinner" }),
|
|
977
|
+
/* @__PURE__ */ e("p", { className: "ll-expanded__overlay-text", children: g ? "Switching..." : "Connecting..." })
|
|
978
|
+
] }),
|
|
979
|
+
T && H && /* @__PURE__ */ w(
|
|
980
|
+
"button",
|
|
981
|
+
{
|
|
982
|
+
type: "button",
|
|
983
|
+
className: "ll-expanded__overlay ll-expanded__overlay--gesture",
|
|
984
|
+
onClick: xe,
|
|
985
|
+
children: [
|
|
986
|
+
/* @__PURE__ */ e("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ e("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" }) }),
|
|
987
|
+
/* @__PURE__ */ e("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
|
|
988
|
+
]
|
|
989
|
+
}
|
|
990
|
+
),
|
|
991
|
+
ie ? /* @__PURE__ */ w("div", { className: "ll-expanded__topbar", children: [
|
|
992
|
+
/* @__PURE__ */ w("div", { className: "ll-expanded__topbar-left", children: [
|
|
993
|
+
/* @__PURE__ */ w("div", { className: "ll-expanded__pill-wrap", children: [
|
|
994
|
+
/* @__PURE__ */ w(
|
|
995
|
+
"button",
|
|
996
|
+
{
|
|
997
|
+
type: "button",
|
|
998
|
+
className: "ll-hpill",
|
|
999
|
+
onClick: (h) => {
|
|
1000
|
+
Y && (h.stopPropagation(), s());
|
|
1001
|
+
},
|
|
1002
|
+
"aria-haspopup": Y ? "listbox" : void 0,
|
|
1003
|
+
"aria-expanded": Y ? u : void 0,
|
|
1004
|
+
children: [
|
|
1005
|
+
/* @__PURE__ */ e("span", { className: "ll-hpill__label", children: i }),
|
|
1006
|
+
Y && /* @__PURE__ */ e(_e, {})
|
|
1007
|
+
]
|
|
1008
|
+
}
|
|
1009
|
+
),
|
|
1010
|
+
Y && u && /* @__PURE__ */ e(
|
|
1011
|
+
"div",
|
|
1012
|
+
{
|
|
1013
|
+
className: "ll-hmenu",
|
|
1014
|
+
onClick: (h) => h.stopPropagation(),
|
|
1015
|
+
role: "listbox",
|
|
1016
|
+
children: m == null ? void 0 : m.map((h) => /* @__PURE__ */ w(
|
|
1017
|
+
"button",
|
|
737
1018
|
{
|
|
738
|
-
|
|
1019
|
+
type: "button",
|
|
1020
|
+
className: `ll-hmenu__item ${h.id === d ? "is-active" : ""}`,
|
|
1021
|
+
onClick: () => l(h.id),
|
|
1022
|
+
role: "option",
|
|
1023
|
+
"aria-selected": h.id === d,
|
|
1024
|
+
children: [
|
|
1025
|
+
h.avatarImageUrl && /* @__PURE__ */ e(
|
|
1026
|
+
"img",
|
|
1027
|
+
{
|
|
1028
|
+
src: h.avatarImageUrl,
|
|
1029
|
+
alt: "",
|
|
1030
|
+
className: "ll-hmenu__avatar"
|
|
1031
|
+
}
|
|
1032
|
+
),
|
|
1033
|
+
/* @__PURE__ */ e("span", { className: "ll-hmenu__name", children: h.name }),
|
|
1034
|
+
h.role && /* @__PURE__ */ e("span", { className: "ll-hmenu__role", children: h.role })
|
|
1035
|
+
]
|
|
1036
|
+
},
|
|
1037
|
+
h.id
|
|
1038
|
+
))
|
|
1039
|
+
}
|
|
1040
|
+
)
|
|
1041
|
+
] }),
|
|
1042
|
+
/* @__PURE__ */ w("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1043
|
+
/* @__PURE__ */ w(
|
|
1044
|
+
"button",
|
|
1045
|
+
{
|
|
1046
|
+
type: "button",
|
|
1047
|
+
className: "ll-hpill",
|
|
1048
|
+
onClick: (h) => {
|
|
1049
|
+
h.stopPropagation(), _();
|
|
1050
|
+
},
|
|
1051
|
+
"aria-haspopup": "listbox",
|
|
1052
|
+
"aria-expanded": b,
|
|
1053
|
+
children: [
|
|
1054
|
+
/* @__PURE__ */ e("span", { className: "ll-hpill__label", children: "English" }),
|
|
1055
|
+
/* @__PURE__ */ e(_e, {})
|
|
1056
|
+
]
|
|
1057
|
+
}
|
|
1058
|
+
),
|
|
1059
|
+
b && /* @__PURE__ */ e(
|
|
1060
|
+
"div",
|
|
1061
|
+
{
|
|
1062
|
+
className: "ll-hmenu",
|
|
1063
|
+
onClick: (h) => h.stopPropagation(),
|
|
1064
|
+
role: "listbox",
|
|
1065
|
+
children: /* @__PURE__ */ e(
|
|
1066
|
+
"button",
|
|
1067
|
+
{
|
|
1068
|
+
type: "button",
|
|
1069
|
+
className: "ll-hmenu__item is-active",
|
|
1070
|
+
role: "option",
|
|
1071
|
+
"aria-selected": !0,
|
|
1072
|
+
children: /* @__PURE__ */ e("span", { className: "ll-hmenu__name", children: "English" })
|
|
739
1073
|
}
|
|
740
1074
|
)
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
] }),
|
|
745
|
-
/* @__PURE__ */ f("div", { className: "ll-expanded__header-right", children: [
|
|
746
|
-
/* @__PURE__ */ e(
|
|
747
|
-
"button",
|
|
748
|
-
{
|
|
749
|
-
type: "button",
|
|
750
|
-
className: "ll-expanded__icon-btn",
|
|
751
|
-
onClick: V,
|
|
752
|
-
"aria-label": S ? "Unmute microphone" : "Mute microphone",
|
|
753
|
-
title: S ? "Unmute" : "Mute",
|
|
754
|
-
children: /* @__PURE__ */ e(He, { muted: S, className: "ll-expanded__icon" })
|
|
755
|
-
}
|
|
756
|
-
),
|
|
757
|
-
t ? null : /* @__PURE__ */ e(
|
|
758
|
-
"button",
|
|
759
|
-
{
|
|
760
|
-
type: "button",
|
|
761
|
-
className: "ll-expanded__icon-btn",
|
|
762
|
-
onClick: W,
|
|
763
|
-
"aria-label": "Minimize widget",
|
|
764
|
-
title: "Minimize",
|
|
765
|
-
children: /* @__PURE__ */ e(ge, { className: "ll-expanded__icon" })
|
|
766
|
-
}
|
|
767
|
-
),
|
|
1075
|
+
}
|
|
1076
|
+
)
|
|
1077
|
+
] }),
|
|
768
1078
|
/* @__PURE__ */ e(
|
|
769
|
-
"
|
|
1079
|
+
"span",
|
|
770
1080
|
{
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
onClick: K,
|
|
774
|
-
"aria-label": "Close widget",
|
|
775
|
-
title: "Close",
|
|
776
|
-
children: /* @__PURE__ */ e(ve, { className: "ll-expanded__icon" })
|
|
1081
|
+
className: `ll-expanded__state ll-expanded__state--${D}`,
|
|
1082
|
+
children: D
|
|
777
1083
|
}
|
|
778
1084
|
)
|
|
1085
|
+
] }),
|
|
1086
|
+
/* @__PURE__ */ e(
|
|
1087
|
+
"button",
|
|
1088
|
+
{
|
|
1089
|
+
type: "button",
|
|
1090
|
+
className: "ll-hbtn",
|
|
1091
|
+
onClick: V,
|
|
1092
|
+
"aria-label": "Close widget",
|
|
1093
|
+
title: "Close",
|
|
1094
|
+
children: /* @__PURE__ */ e(je, {})
|
|
1095
|
+
}
|
|
1096
|
+
)
|
|
1097
|
+
] }) : (
|
|
1098
|
+
// Idle-state header with Live Layer product name + minimize/close
|
|
1099
|
+
/* @__PURE__ */ w("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
|
|
1100
|
+
/* @__PURE__ */ e("span", { className: "ll-expanded__brand", children: p }),
|
|
1101
|
+
/* @__PURE__ */ w("div", { className: "ll-expanded__header-actions", children: [
|
|
1102
|
+
/* @__PURE__ */ e(
|
|
1103
|
+
"button",
|
|
1104
|
+
{
|
|
1105
|
+
type: "button",
|
|
1106
|
+
className: "ll-hbtn ll-hbtn--ghost",
|
|
1107
|
+
onClick: ue,
|
|
1108
|
+
"aria-label": "Minimize widget",
|
|
1109
|
+
children: /* @__PURE__ */ e(At, {})
|
|
1110
|
+
}
|
|
1111
|
+
),
|
|
1112
|
+
/* @__PURE__ */ e(
|
|
1113
|
+
"button",
|
|
1114
|
+
{
|
|
1115
|
+
type: "button",
|
|
1116
|
+
className: "ll-hbtn ll-hbtn--ghost",
|
|
1117
|
+
onClick: V,
|
|
1118
|
+
"aria-label": "Close widget",
|
|
1119
|
+
children: /* @__PURE__ */ e(je, {})
|
|
1120
|
+
}
|
|
1121
|
+
)
|
|
1122
|
+
] })
|
|
779
1123
|
] })
|
|
780
|
-
|
|
781
|
-
|
|
1124
|
+
),
|
|
1125
|
+
he && /* @__PURE__ */ w(
|
|
782
1126
|
"button",
|
|
783
1127
|
{
|
|
784
1128
|
type: "button",
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
1129
|
+
className: "ll-expanded__play",
|
|
1130
|
+
onClick: ge,
|
|
1131
|
+
"aria-label": R ? "Resume session" : "Start video call",
|
|
1132
|
+
children: [
|
|
1133
|
+
/* @__PURE__ */ e("div", { className: "ll-expanded__play-circle", children: /* @__PURE__ */ e("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ e("polygon", { points: "6 3 20 12 6 21 6 3" }) }) }),
|
|
1134
|
+
/* @__PURE__ */ e("span", { className: "ll-expanded__play-label", children: R ? "Restart session" : "Start video call" }),
|
|
1135
|
+
R && /* @__PURE__ */ e("span", { className: "ll-expanded__play-sublabel", children: "Pick up where you left off" })
|
|
1136
|
+
]
|
|
1137
|
+
}
|
|
1138
|
+
),
|
|
1139
|
+
/* @__PURE__ */ w(
|
|
1140
|
+
"div",
|
|
1141
|
+
{
|
|
1142
|
+
className: `ll-expanded__pip ${ie && (y || U) ? "is-visible" : ""}`,
|
|
788
1143
|
children: [
|
|
789
|
-
T.avatarImageUrl && // eslint-disable-next-line @next/next/no-img-element
|
|
790
1144
|
/* @__PURE__ */ e(
|
|
791
|
-
"
|
|
1145
|
+
"div",
|
|
792
1146
|
{
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
className: "ll-expanded__team-item-avatar"
|
|
1147
|
+
ref: oe,
|
|
1148
|
+
className: U ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
796
1149
|
}
|
|
797
1150
|
),
|
|
798
|
-
/* @__PURE__ */
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
1151
|
+
/* @__PURE__ */ e(
|
|
1152
|
+
"div",
|
|
1153
|
+
{
|
|
1154
|
+
ref: pe,
|
|
1155
|
+
className: !U && y ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1156
|
+
}
|
|
1157
|
+
)
|
|
802
1158
|
]
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
1159
|
+
}
|
|
1160
|
+
),
|
|
1161
|
+
ie ? /* @__PURE__ */ w("div", { className: "ll-expanded__bottom", children: [
|
|
1162
|
+
me && /* @__PURE__ */ e("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ e("p", { className: "ll-expanded__transcript-text", children: me }) }),
|
|
1163
|
+
/* @__PURE__ */ w("div", { className: "ll-toolbar", onClick: (h) => h.stopPropagation(), children: [
|
|
1164
|
+
P && /* @__PURE__ */ e(
|
|
1165
|
+
"button",
|
|
1166
|
+
{
|
|
1167
|
+
type: "button",
|
|
1168
|
+
className: `ll-tool ${U ? "is-on" : ""}`,
|
|
1169
|
+
onClick: Z,
|
|
1170
|
+
"aria-label": U ? "Stop sharing screen" : "Share screen",
|
|
1171
|
+
title: U ? "Stop sharing" : "Share screen",
|
|
1172
|
+
children: /* @__PURE__ */ e(Dt, {})
|
|
1173
|
+
}
|
|
1174
|
+
),
|
|
1175
|
+
re && /* @__PURE__ */ w("div", { className: "ll-tool-split", children: [
|
|
1176
|
+
/* @__PURE__ */ e(
|
|
1177
|
+
"button",
|
|
1178
|
+
{
|
|
1179
|
+
type: "button",
|
|
1180
|
+
className: `ll-tool ll-tool--left ${y ? "is-on" : ""}`,
|
|
1181
|
+
onClick: B,
|
|
1182
|
+
"aria-label": y ? "Turn off camera" : "Turn on camera",
|
|
1183
|
+
title: y ? "Stop camera" : "Start camera",
|
|
1184
|
+
children: /* @__PURE__ */ e(Rt, {})
|
|
1185
|
+
}
|
|
1186
|
+
),
|
|
1187
|
+
/* @__PURE__ */ e(
|
|
1188
|
+
"button",
|
|
1189
|
+
{
|
|
1190
|
+
type: "button",
|
|
1191
|
+
className: `ll-tool ll-tool--right ${y ? "is-on" : ""}`,
|
|
1192
|
+
onClick: (h) => {
|
|
1193
|
+
h.stopPropagation(), J((W) => !W), le(!1);
|
|
1194
|
+
},
|
|
1195
|
+
"aria-label": "Camera devices",
|
|
1196
|
+
"aria-haspopup": "listbox",
|
|
1197
|
+
"aria-expanded": ae,
|
|
1198
|
+
children: /* @__PURE__ */ e(_e, {})
|
|
1199
|
+
}
|
|
1200
|
+
),
|
|
1201
|
+
ae && X.length > 0 && /* @__PURE__ */ e(
|
|
1202
|
+
Ve,
|
|
1203
|
+
{
|
|
1204
|
+
label: "Camera",
|
|
1205
|
+
devices: X,
|
|
1206
|
+
activeId: ne,
|
|
1207
|
+
onPick: (h) => {
|
|
1208
|
+
J(!1), ve(h);
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
)
|
|
1212
|
+
] }),
|
|
1213
|
+
/* @__PURE__ */ w("div", { className: "ll-tool-split", children: [
|
|
1214
|
+
/* @__PURE__ */ e(
|
|
1215
|
+
"button",
|
|
1216
|
+
{
|
|
1217
|
+
type: "button",
|
|
1218
|
+
className: `ll-tool ll-tool--left ${I ? "is-muted" : ""}`,
|
|
1219
|
+
onClick: Q,
|
|
1220
|
+
"aria-label": I ? "Unmute microphone" : "Mute microphone",
|
|
1221
|
+
title: I ? "Unmute" : "Mute",
|
|
1222
|
+
children: /* @__PURE__ */ e(Tt, { muted: I })
|
|
1223
|
+
}
|
|
1224
|
+
),
|
|
1225
|
+
/* @__PURE__ */ e(
|
|
1226
|
+
"button",
|
|
1227
|
+
{
|
|
1228
|
+
type: "button",
|
|
1229
|
+
className: `ll-tool ll-tool--right ${I ? "is-muted" : ""}`,
|
|
1230
|
+
onClick: (h) => {
|
|
1231
|
+
h.stopPropagation(), le((W) => !W), J(!1);
|
|
1232
|
+
},
|
|
1233
|
+
"aria-label": "Microphone devices",
|
|
1234
|
+
"aria-haspopup": "listbox",
|
|
1235
|
+
"aria-expanded": q,
|
|
1236
|
+
children: /* @__PURE__ */ e(_e, {})
|
|
1237
|
+
}
|
|
1238
|
+
),
|
|
1239
|
+
q && C.length > 0 && /* @__PURE__ */ e(
|
|
1240
|
+
Ve,
|
|
1241
|
+
{
|
|
1242
|
+
label: "Microphone",
|
|
1243
|
+
devices: C,
|
|
1244
|
+
activeId: "",
|
|
1245
|
+
onPick: () => le(!1)
|
|
1246
|
+
}
|
|
1247
|
+
)
|
|
1248
|
+
] }),
|
|
869
1249
|
/* @__PURE__ */ e(
|
|
870
1250
|
"button",
|
|
871
1251
|
{
|
|
872
1252
|
type: "button",
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
1253
|
+
className: `ll-tool ${F ? "is-muted" : ""}`,
|
|
1254
|
+
onClick: G,
|
|
1255
|
+
"aria-label": F ? "Unmute speaker" : "Mute speaker",
|
|
1256
|
+
title: F ? "Unmute speaker" : "Mute speaker",
|
|
1257
|
+
children: /* @__PURE__ */ e(zt, { muted: F })
|
|
877
1258
|
}
|
|
878
1259
|
)
|
|
879
1260
|
] }),
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
/* @__PURE__ */ e("span", { children: "Connecting..." })
|
|
904
|
-
]
|
|
905
|
-
}
|
|
906
|
-
),
|
|
907
|
-
_ === "connected" && /* @__PURE__ */ e(
|
|
1261
|
+
be && /* @__PURE__ */ w("form", { className: "ll-message-input", onSubmit: $, children: [
|
|
1262
|
+
/* @__PURE__ */ e(
|
|
1263
|
+
"input",
|
|
1264
|
+
{
|
|
1265
|
+
type: "text",
|
|
1266
|
+
className: "ll-message-input__field",
|
|
1267
|
+
placeholder: "Message...",
|
|
1268
|
+
value: se,
|
|
1269
|
+
onChange: (h) => ce(h.target.value),
|
|
1270
|
+
"aria-label": "Message the agent"
|
|
1271
|
+
}
|
|
1272
|
+
),
|
|
1273
|
+
se.trim() && /* @__PURE__ */ e(
|
|
1274
|
+
"button",
|
|
1275
|
+
{
|
|
1276
|
+
type: "submit",
|
|
1277
|
+
className: "ll-message-input__send",
|
|
1278
|
+
"aria-label": "Send message",
|
|
1279
|
+
children: /* @__PURE__ */ e(Pt, {})
|
|
1280
|
+
}
|
|
1281
|
+
)
|
|
1282
|
+
] }),
|
|
1283
|
+
/* @__PURE__ */ e(
|
|
908
1284
|
"button",
|
|
909
1285
|
{
|
|
910
1286
|
type: "button",
|
|
911
|
-
className: "ll-
|
|
912
|
-
onClick:
|
|
1287
|
+
className: "ll-expanded__end",
|
|
1288
|
+
onClick: de,
|
|
913
1289
|
children: "End conversation"
|
|
914
1290
|
}
|
|
915
|
-
)
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
1291
|
+
)
|
|
1292
|
+
] }) : (
|
|
1293
|
+
// Idle-state footer: start button + greeting
|
|
1294
|
+
a && /* @__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: a }) }) })
|
|
1295
|
+
),
|
|
1296
|
+
(() => {
|
|
1297
|
+
if (k && N !== "error")
|
|
1298
|
+
return /* @__PURE__ */ w("div", { className: "ll-expanded__banner", role: "alert", children: [
|
|
1299
|
+
/* @__PURE__ */ e("span", { children: k }),
|
|
1300
|
+
/* @__PURE__ */ e(
|
|
1301
|
+
"button",
|
|
1302
|
+
{
|
|
1303
|
+
type: "button",
|
|
1304
|
+
className: "ll-expanded__banner-x",
|
|
1305
|
+
onClick: K,
|
|
1306
|
+
"aria-label": "Dismiss",
|
|
1307
|
+
children: "×"
|
|
1308
|
+
}
|
|
1309
|
+
)
|
|
1310
|
+
] });
|
|
1311
|
+
if (!z || N !== "error") return null;
|
|
1312
|
+
let h = "Failed to connect", W = "Try again";
|
|
1313
|
+
return z === "MIC_PERMISSION_DENIED" ? h = "Microphone blocked. Allow access to talk." : z === "MIC_NOT_FOUND" ? h = "No microphone found. Plug one in + retry." : z === "MIC_UNAVAILABLE" ? h = "Mic unavailable. Check other apps using it." : z === "AGENT_TIMEOUT" ? h = "Agent didn't pick up. Try again." : z === "CONNECT_FAILED" ? h = "Connection failed. Check your network." : z.length < 80 && (h = z), /* @__PURE__ */ w("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
|
|
1314
|
+
/* @__PURE__ */ e("span", { children: h }),
|
|
1315
|
+
/* @__PURE__ */ e(
|
|
919
1316
|
"button",
|
|
920
1317
|
{
|
|
921
1318
|
type: "button",
|
|
922
|
-
className: "ll-
|
|
923
|
-
onClick:
|
|
924
|
-
children:
|
|
925
|
-
/* @__PURE__ */ e(oe, { muted: !1, className: "ll-expanded__cta-icon" }),
|
|
926
|
-
/* @__PURE__ */ e("span", { children: "Try again" })
|
|
927
|
-
]
|
|
1319
|
+
className: "ll-expanded__banner-retry",
|
|
1320
|
+
onClick: ke,
|
|
1321
|
+
children: W
|
|
928
1322
|
}
|
|
929
1323
|
)
|
|
930
|
-
] })
|
|
931
|
-
|
|
1324
|
+
] });
|
|
1325
|
+
})()
|
|
932
1326
|
]
|
|
933
1327
|
}
|
|
934
1328
|
);
|
|
935
|
-
}
|
|
1329
|
+
};
|
|
1330
|
+
function _e() {
|
|
1331
|
+
return /* @__PURE__ */ e("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ e("polyline", { points: "6 9 12 15 18 9" }) });
|
|
1332
|
+
}
|
|
1333
|
+
function je() {
|
|
1334
|
+
return /* @__PURE__ */ w("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
|
|
1335
|
+
/* @__PURE__ */ e("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1336
|
+
/* @__PURE__ */ e("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1337
|
+
] });
|
|
1338
|
+
}
|
|
1339
|
+
function At() {
|
|
1340
|
+
return /* @__PURE__ */ e("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ e("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
|
|
1341
|
+
}
|
|
1342
|
+
function Dt() {
|
|
1343
|
+
return /* @__PURE__ */ w("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1344
|
+
/* @__PURE__ */ e("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
|
|
1345
|
+
/* @__PURE__ */ e("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
|
|
1346
|
+
/* @__PURE__ */ e("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
|
|
1347
|
+
] });
|
|
1348
|
+
}
|
|
1349
|
+
function Rt() {
|
|
1350
|
+
return /* @__PURE__ */ w("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1351
|
+
/* @__PURE__ */ e("path", { d: "M23 7l-7 5 7 5V7z" }),
|
|
1352
|
+
/* @__PURE__ */ e("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
|
|
1353
|
+
] });
|
|
1354
|
+
}
|
|
1355
|
+
function Tt({ muted: t }) {
|
|
1356
|
+
return /* @__PURE__ */ w("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1357
|
+
/* @__PURE__ */ e("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
|
|
1358
|
+
/* @__PURE__ */ e("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
|
|
1359
|
+
/* @__PURE__ */ e("line", { x1: "12", y1: "19", x2: "12", y2: "23" }),
|
|
1360
|
+
t && /* @__PURE__ */ e("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
1361
|
+
] });
|
|
1362
|
+
}
|
|
1363
|
+
function zt({ muted: t }) {
|
|
1364
|
+
return /* @__PURE__ */ w("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1365
|
+
/* @__PURE__ */ e("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
1366
|
+
t ? /* @__PURE__ */ e("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ w(Qe, { children: [
|
|
1367
|
+
/* @__PURE__ */ e("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
|
|
1368
|
+
/* @__PURE__ */ e("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
|
|
1369
|
+
] })
|
|
1370
|
+
] });
|
|
1371
|
+
}
|
|
1372
|
+
function Pt() {
|
|
1373
|
+
return /* @__PURE__ */ w("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1374
|
+
/* @__PURE__ */ e("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
|
|
1375
|
+
/* @__PURE__ */ e("polyline", { points: "12 5 19 12 12 19" })
|
|
1376
|
+
] });
|
|
1377
|
+
}
|
|
1378
|
+
const Ve = ({ label: t, devices: n, activeId: i, onPick: o }) => /* @__PURE__ */ w(
|
|
1379
|
+
"div",
|
|
1380
|
+
{
|
|
1381
|
+
className: "ll-device-menu",
|
|
1382
|
+
onClick: (r) => r.stopPropagation(),
|
|
1383
|
+
role: "listbox",
|
|
1384
|
+
children: [
|
|
1385
|
+
/* @__PURE__ */ e("p", { className: "ll-device-menu__label", children: t }),
|
|
1386
|
+
n.map((r, a) => {
|
|
1387
|
+
const c = i === r.deviceId;
|
|
1388
|
+
return /* @__PURE__ */ w(
|
|
1389
|
+
"button",
|
|
1390
|
+
{
|
|
1391
|
+
type: "button",
|
|
1392
|
+
className: `ll-device-menu__item ${c ? "is-active" : ""}`,
|
|
1393
|
+
onClick: () => o(r.deviceId),
|
|
1394
|
+
role: "option",
|
|
1395
|
+
"aria-selected": c,
|
|
1396
|
+
children: [
|
|
1397
|
+
c && /* @__PURE__ */ e("span", { className: "ll-device-menu__dot", children: "●" }),
|
|
1398
|
+
/* @__PURE__ */ e("span", { className: "ll-device-menu__name", children: r.label || `${t} ${a + 1}` })
|
|
1399
|
+
]
|
|
1400
|
+
},
|
|
1401
|
+
r.deviceId || a
|
|
1402
|
+
);
|
|
1403
|
+
})
|
|
1404
|
+
]
|
|
1405
|
+
}
|
|
1406
|
+
), $t = /* @__PURE__ */ new Set([
|
|
936
1407
|
"agent_state",
|
|
937
1408
|
"avatar_stream_ready",
|
|
938
1409
|
"avatar_active",
|
|
@@ -942,309 +1413,351 @@ const Je = ({
|
|
|
942
1413
|
"idle_warning",
|
|
943
1414
|
"idle_timeout"
|
|
944
1415
|
]);
|
|
945
|
-
function
|
|
946
|
-
var
|
|
1416
|
+
function Bt(t) {
|
|
1417
|
+
var Ie, Ae, De, Re, Te, ze;
|
|
947
1418
|
const {
|
|
948
|
-
agentId:
|
|
949
|
-
apiKey:
|
|
950
|
-
baseUrl:
|
|
951
|
-
sessionEndpoint:
|
|
1419
|
+
agentId: n,
|
|
1420
|
+
apiKey: i,
|
|
1421
|
+
baseUrl: o = "https://app.livelayer.studio",
|
|
1422
|
+
sessionEndpoint: r,
|
|
952
1423
|
sessionBody: a,
|
|
953
|
-
autoConnect:
|
|
954
|
-
displayMode:
|
|
955
|
-
defaultDisplayMode:
|
|
1424
|
+
autoConnect: c = !1,
|
|
1425
|
+
displayMode: m,
|
|
1426
|
+
defaultDisplayMode: d = "expanded",
|
|
956
1427
|
onDisplayModeChange: g,
|
|
957
|
-
position:
|
|
958
|
-
mobileBreakpoint:
|
|
959
|
-
persistKey:
|
|
960
|
-
disablePersistence:
|
|
961
|
-
teamMembers:
|
|
962
|
-
currentTeamMemberId:
|
|
963
|
-
onTeamMemberChange:
|
|
964
|
-
idleLoopUrl:
|
|
965
|
-
greeting:
|
|
966
|
-
avatarImageUrl:
|
|
967
|
-
agentName:
|
|
968
|
-
branding:
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
[
|
|
986
|
-
),
|
|
987
|
-
|
|
988
|
-
|
|
1428
|
+
position: u = "bottom-right",
|
|
1429
|
+
mobileBreakpoint: s = 640,
|
|
1430
|
+
persistKey: l = "ll-widget",
|
|
1431
|
+
disablePersistence: b = !1,
|
|
1432
|
+
teamMembers: _,
|
|
1433
|
+
currentTeamMemberId: N,
|
|
1434
|
+
onTeamMemberChange: D,
|
|
1435
|
+
idleLoopUrl: E,
|
|
1436
|
+
greeting: R,
|
|
1437
|
+
avatarImageUrl: T,
|
|
1438
|
+
agentName: z,
|
|
1439
|
+
branding: I = {},
|
|
1440
|
+
allowCamera: k = !0,
|
|
1441
|
+
allowScreenShare: C = !0,
|
|
1442
|
+
allowTyping: y = !0,
|
|
1443
|
+
onConnect: A,
|
|
1444
|
+
onDisconnect: X,
|
|
1445
|
+
onTranscript: ne,
|
|
1446
|
+
onAgentState: U,
|
|
1447
|
+
onConnectionStateChange: j,
|
|
1448
|
+
onAgentEvent: F,
|
|
1449
|
+
onAgentCommand: re,
|
|
1450
|
+
controlledSession: P,
|
|
1451
|
+
className: be,
|
|
1452
|
+
style: we,
|
|
1453
|
+
zIndex: ge = 2147483647
|
|
1454
|
+
} = t, de = N !== void 0, [ke, xe] = x(() => {
|
|
1455
|
+
var v;
|
|
1456
|
+
return N ?? ((v = _ == null ? void 0 : _[0]) == null ? void 0 : v.id);
|
|
1457
|
+
}), Q = de ? N : ke, B = Se(
|
|
1458
|
+
() => (_ == null ? void 0 : _.find((v) => v.id === Q)) ?? null,
|
|
1459
|
+
[_, Q]
|
|
1460
|
+
), ve = (B == null ? void 0 : B.agentId) ?? n, [Z, G] = vt({
|
|
1461
|
+
value: m,
|
|
1462
|
+
defaultValue: d,
|
|
989
1463
|
onChange: g,
|
|
990
|
-
persistKey:
|
|
991
|
-
disablePersistence:
|
|
992
|
-
}),
|
|
993
|
-
(
|
|
994
|
-
const
|
|
995
|
-
!
|
|
1464
|
+
persistKey: l,
|
|
1465
|
+
disablePersistence: b
|
|
1466
|
+
}), ee = _t(s), ue = ot(), V = lt(), K = st(), O = ct(), Y = dt(), [ie, H] = x(!1), [he, pe] = x(!1), [oe, q] = x(!1), [le, ae] = x(!1), [J, se] = x(!1), ce = f(
|
|
1467
|
+
(v) => {
|
|
1468
|
+
const M = v;
|
|
1469
|
+
!M.type || typeof M.type != "string" || (F == null || F({ eventName: M.type, data: v }), $t.has(M.type) || re == null || re(M));
|
|
996
1470
|
},
|
|
997
|
-
[
|
|
998
|
-
),
|
|
999
|
-
agentId:
|
|
1000
|
-
baseUrl:
|
|
1001
|
-
apiKey:
|
|
1002
|
-
sessionEndpoint:
|
|
1471
|
+
[re, F]
|
|
1472
|
+
), $ = it({
|
|
1473
|
+
agentId: P ? "__controlled__" : ve,
|
|
1474
|
+
baseUrl: o,
|
|
1475
|
+
apiKey: i,
|
|
1476
|
+
sessionEndpoint: r,
|
|
1003
1477
|
sessionBody: a,
|
|
1004
|
-
onDataMessage:
|
|
1478
|
+
onDataMessage: P ? void 0 : ce
|
|
1005
1479
|
});
|
|
1006
|
-
|
|
1007
|
-
if (
|
|
1008
|
-
return
|
|
1009
|
-
}, [
|
|
1010
|
-
const
|
|
1011
|
-
connectionState:
|
|
1012
|
-
agentState:
|
|
1013
|
-
transcript:
|
|
1014
|
-
videoElement:
|
|
1015
|
-
audioElement:
|
|
1016
|
-
canResume:
|
|
1017
|
-
error:
|
|
1480
|
+
L(() => {
|
|
1481
|
+
if (P != null && P.subscribeToDataMessages)
|
|
1482
|
+
return P.subscribeToDataMessages(ce);
|
|
1483
|
+
}, [P, ce]);
|
|
1484
|
+
const p = Se(() => P ? {
|
|
1485
|
+
connectionState: P.connectionState,
|
|
1486
|
+
agentState: P.agentState,
|
|
1487
|
+
transcript: P.transcript,
|
|
1488
|
+
videoElement: P.videoElement,
|
|
1489
|
+
audioElement: P.audioElement,
|
|
1490
|
+
canResume: P.canResume,
|
|
1491
|
+
error: P.error,
|
|
1018
1492
|
agentConfig: null,
|
|
1019
1493
|
connect: async () => {
|
|
1020
|
-
await
|
|
1494
|
+
await P.onConnect();
|
|
1021
1495
|
},
|
|
1022
|
-
disconnect: () =>
|
|
1496
|
+
disconnect: () => P.onDisconnect(),
|
|
1023
1497
|
// Dummy getRoom for shape compatibility — controlled consumers own the Room.
|
|
1024
1498
|
// Internal session's getRoom returns null when no real connect has happened,
|
|
1025
1499
|
// so we reuse its reference for type consistency.
|
|
1026
|
-
getRoom:
|
|
1500
|
+
getRoom: $.getRoom,
|
|
1027
1501
|
isControlled: !0
|
|
1028
1502
|
} : {
|
|
1029
|
-
connectionState:
|
|
1030
|
-
agentState:
|
|
1031
|
-
transcript:
|
|
1032
|
-
videoElement:
|
|
1033
|
-
audioElement:
|
|
1034
|
-
canResume:
|
|
1035
|
-
error:
|
|
1036
|
-
agentConfig:
|
|
1037
|
-
connect:
|
|
1038
|
-
disconnect:
|
|
1039
|
-
getRoom:
|
|
1503
|
+
connectionState: $.connectionState,
|
|
1504
|
+
agentState: $.agentState,
|
|
1505
|
+
transcript: $.transcript,
|
|
1506
|
+
videoElement: $.videoElement,
|
|
1507
|
+
audioElement: $.audioElement,
|
|
1508
|
+
canResume: $.canResume,
|
|
1509
|
+
error: $.error,
|
|
1510
|
+
agentConfig: $.agentConfig,
|
|
1511
|
+
connect: $.connect,
|
|
1512
|
+
disconnect: $.disconnect,
|
|
1513
|
+
getRoom: $.getRoom,
|
|
1040
1514
|
isControlled: !1
|
|
1041
|
-
}, [
|
|
1042
|
-
|
|
1043
|
-
const
|
|
1044
|
-
if (!(!
|
|
1045
|
-
return
|
|
1046
|
-
|
|
1515
|
+
}, [P, $]), me = S(null);
|
|
1516
|
+
L(() => {
|
|
1517
|
+
const v = p.videoElement, M = me.current;
|
|
1518
|
+
if (!(!v || !M))
|
|
1519
|
+
return M.appendChild(v), () => {
|
|
1520
|
+
v.parentNode === M && M.removeChild(v);
|
|
1047
1521
|
};
|
|
1048
|
-
}, [
|
|
1049
|
-
const
|
|
1050
|
-
if (!
|
|
1051
|
-
|
|
1052
|
-
const
|
|
1053
|
-
return
|
|
1054
|
-
(
|
|
1522
|
+
}, [p.videoElement]), L(() => {
|
|
1523
|
+
const v = p.audioElement;
|
|
1524
|
+
if (!v) return;
|
|
1525
|
+
ue.attach(v);
|
|
1526
|
+
const M = v.play();
|
|
1527
|
+
return M && typeof M.catch == "function" && M.catch((te) => {
|
|
1528
|
+
(te == null ? void 0 : te.name) === "NotAllowedError" && H(!0);
|
|
1055
1529
|
}), () => {
|
|
1056
|
-
|
|
1530
|
+
ue.detach();
|
|
1057
1531
|
};
|
|
1058
|
-
}, [
|
|
1059
|
-
if (
|
|
1060
|
-
const
|
|
1061
|
-
if (
|
|
1062
|
-
return
|
|
1063
|
-
}), () => {
|
|
1064
|
-
|
|
1532
|
+
}, [p.audioElement]), L(() => {
|
|
1533
|
+
if (p.isControlled || p.connectionState !== "connected") return;
|
|
1534
|
+
const v = p.getRoom();
|
|
1535
|
+
if (v)
|
|
1536
|
+
return V.setupMic(v).catch(() => {
|
|
1537
|
+
}), K.attachRoom(v), O.attachRoom(v), Y.refresh(), () => {
|
|
1538
|
+
V.teardownMic(), K.teardown(), O.teardown();
|
|
1065
1539
|
};
|
|
1066
|
-
}, [
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1540
|
+
}, [p.isControlled, p.connectionState]), L(() => {
|
|
1541
|
+
const v = p.audioElement;
|
|
1542
|
+
v && (v.muted = J);
|
|
1543
|
+
}, [p.audioElement, J]);
|
|
1544
|
+
const Ce = f((v) => {
|
|
1545
|
+
const M = p.getRoom();
|
|
1546
|
+
if (M)
|
|
1547
|
+
try {
|
|
1548
|
+
const te = new TextEncoder().encode(
|
|
1549
|
+
JSON.stringify({ type: "user_message", text: v })
|
|
1550
|
+
);
|
|
1551
|
+
M.localParticipant.publishData(te, { reliable: !0 });
|
|
1552
|
+
} catch {
|
|
1553
|
+
}
|
|
1554
|
+
}, [p]), ye = f(() => {
|
|
1555
|
+
se((v) => !v);
|
|
1556
|
+
}, []);
|
|
1557
|
+
L(() => {
|
|
1558
|
+
j == null || j(p.connectionState), p.connectionState === "connected" ? A == null || A() : p.connectionState === "disconnected" && (X == null || X());
|
|
1559
|
+
}, [p.connectionState, A, X, j]), L(() => {
|
|
1560
|
+
ne == null || ne(p.transcript);
|
|
1561
|
+
}, [p.transcript, ne]), L(() => {
|
|
1562
|
+
U == null || U(p.agentState);
|
|
1563
|
+
}, [p.agentState, U]);
|
|
1564
|
+
const h = S(!1);
|
|
1565
|
+
L(() => {
|
|
1566
|
+
p.isControlled || !c || h.current || p.connectionState === "idle" && (h.current = !0, p.connect());
|
|
1567
|
+
}, [c, p.connectionState, p]);
|
|
1568
|
+
const W = f(
|
|
1569
|
+
(v) => {
|
|
1570
|
+
const M = _ == null ? void 0 : _.find((te) => te.id === v);
|
|
1571
|
+
M && (q(!1), v !== Q && (pe(!0), p.disconnect(), de || xe(v), D == null || D(M)));
|
|
1081
1572
|
},
|
|
1082
1573
|
[
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1574
|
+
_,
|
|
1575
|
+
Q,
|
|
1576
|
+
p,
|
|
1577
|
+
de,
|
|
1578
|
+
D
|
|
1088
1579
|
]
|
|
1089
1580
|
);
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
}, [
|
|
1093
|
-
if (!
|
|
1094
|
-
const
|
|
1095
|
-
|
|
1581
|
+
L(() => {
|
|
1582
|
+
he && p.connectionState === "connected" && pe(!1);
|
|
1583
|
+
}, [p.connectionState, he]), L(() => {
|
|
1584
|
+
if (!oe) return;
|
|
1585
|
+
const v = (M) => {
|
|
1586
|
+
M.key === "Escape" && q(!1);
|
|
1096
1587
|
};
|
|
1097
|
-
return window.addEventListener("keydown",
|
|
1098
|
-
}, [
|
|
1099
|
-
const
|
|
1100
|
-
() =>
|
|
1101
|
-
[
|
|
1102
|
-
),
|
|
1103
|
-
const
|
|
1104
|
-
|
|
1588
|
+
return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
|
|
1589
|
+
}, [oe]);
|
|
1590
|
+
const Fe = !!T || !!(B != null && B.avatarImageUrl) || p.isControlled, Ne = ut(ve, o, Fe), Ee = (B == null ? void 0 : B.name) ?? z ?? ((Ie = p.agentConfig) == null ? void 0 : Ie.name) ?? ((Ae = Ne.info) == null ? void 0 : Ae.name) ?? "Live Layer", Le = (B == null ? void 0 : B.avatarImageUrl) ?? T ?? ((De = p.agentConfig) == null ? void 0 : De.avatarImageUrl) ?? ((Re = Ne.info) == null ? void 0 : Re.avatarImageUrl) ?? null, Ge = E ?? ((Te = p.agentConfig) == null ? void 0 : Te.idleLoopUrl) ?? ((ze = Ne.info) == null ? void 0 : ze.idleLoopUrl) ?? null, Ke = R ?? null, Ye = f(() => G("expanded"), [G]), He = f(
|
|
1591
|
+
() => G("minimized"),
|
|
1592
|
+
[G]
|
|
1593
|
+
), Me = f(() => G("hidden"), [G]), qe = f(() => {
|
|
1594
|
+
const v = p.audioElement;
|
|
1595
|
+
v && v.play().then(() => H(!1)).catch(() => {
|
|
1105
1596
|
});
|
|
1106
|
-
}, [
|
|
1107
|
-
|
|
1108
|
-
}, [
|
|
1109
|
-
...
|
|
1110
|
-
zIndex:
|
|
1597
|
+
}, [p.audioElement]), Je = f(() => {
|
|
1598
|
+
H(!1), p.connect();
|
|
1599
|
+
}, [p]), fe = {
|
|
1600
|
+
...we,
|
|
1601
|
+
zIndex: ge
|
|
1111
1602
|
};
|
|
1112
|
-
|
|
1113
|
-
const
|
|
1603
|
+
I.primaryColor && (fe["--ll-color-primary"] = I.primaryColor), I.accentColor && (fe["--ll-color-accent"] = I.accentColor), I.backgroundColor && (fe["--ll-color-bg"] = I.backgroundColor), I.textColor && (fe["--ll-color-fg"] = I.textColor);
|
|
1604
|
+
const Xe = [
|
|
1114
1605
|
"ll-widget",
|
|
1115
|
-
`ll-widget--${
|
|
1116
|
-
`ll-widget--${
|
|
1117
|
-
|
|
1606
|
+
`ll-widget--${Z}`,
|
|
1607
|
+
`ll-widget--${ee ? "mobile" : "desktop"}`,
|
|
1608
|
+
be
|
|
1118
1609
|
].filter(Boolean).join(" ");
|
|
1119
|
-
return /* @__PURE__ */
|
|
1610
|
+
return /* @__PURE__ */ w(
|
|
1120
1611
|
"div",
|
|
1121
1612
|
{
|
|
1122
|
-
className:
|
|
1123
|
-
style:
|
|
1124
|
-
"data-display-mode":
|
|
1125
|
-
"data-position":
|
|
1613
|
+
className: Xe,
|
|
1614
|
+
style: fe,
|
|
1615
|
+
"data-display-mode": Z,
|
|
1616
|
+
"data-position": u,
|
|
1126
1617
|
children: [
|
|
1127
|
-
|
|
1128
|
-
|
|
1618
|
+
Z === "hidden" && /* @__PURE__ */ e(
|
|
1619
|
+
Et,
|
|
1129
1620
|
{
|
|
1130
|
-
position:
|
|
1131
|
-
isMobile:
|
|
1132
|
-
isSpeaking:
|
|
1133
|
-
onExpand: () =>
|
|
1134
|
-
label: `Open ${
|
|
1621
|
+
position: u,
|
|
1622
|
+
isMobile: ee,
|
|
1623
|
+
isSpeaking: p.agentState === "speaking",
|
|
1624
|
+
onExpand: () => G("expanded"),
|
|
1625
|
+
label: `Open ${Ee} widget`
|
|
1135
1626
|
}
|
|
1136
1627
|
),
|
|
1137
|
-
|
|
1138
|
-
|
|
1628
|
+
Z === "minimized" && /* @__PURE__ */ e(
|
|
1629
|
+
Lt,
|
|
1139
1630
|
{
|
|
1140
|
-
position:
|
|
1141
|
-
isMobile:
|
|
1142
|
-
agentName:
|
|
1143
|
-
avatarImageUrl:
|
|
1144
|
-
agentState:
|
|
1145
|
-
isMuted:
|
|
1146
|
-
audioLevel:
|
|
1147
|
-
onExpand:
|
|
1148
|
-
onToggleMute:
|
|
1149
|
-
onClose:
|
|
1631
|
+
position: u,
|
|
1632
|
+
isMobile: ee,
|
|
1633
|
+
agentName: Ee,
|
|
1634
|
+
avatarImageUrl: Le,
|
|
1635
|
+
agentState: p.agentState,
|
|
1636
|
+
isMuted: V.isMuted,
|
|
1637
|
+
audioLevel: ue,
|
|
1638
|
+
onExpand: Ye,
|
|
1639
|
+
onToggleMute: V.toggleMute,
|
|
1640
|
+
onClose: Me
|
|
1150
1641
|
}
|
|
1151
1642
|
),
|
|
1152
|
-
|
|
1153
|
-
|
|
1643
|
+
Z === "expanded" && /* @__PURE__ */ e(
|
|
1644
|
+
It,
|
|
1154
1645
|
{
|
|
1155
|
-
position:
|
|
1156
|
-
isMobile:
|
|
1157
|
-
agentName:
|
|
1158
|
-
avatarImageUrl:
|
|
1159
|
-
idleLoopUrl:
|
|
1160
|
-
greeting:
|
|
1161
|
-
branding:
|
|
1162
|
-
teamMembers:
|
|
1163
|
-
currentTeamMemberId:
|
|
1164
|
-
isSwitchingTeamMember:
|
|
1165
|
-
teamSwitcherOpen:
|
|
1166
|
-
onToggleTeamSwitcher: () =>
|
|
1167
|
-
onSelectTeamMember:
|
|
1168
|
-
connectionState:
|
|
1169
|
-
agentState:
|
|
1170
|
-
transcript:
|
|
1171
|
-
isMuted:
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1646
|
+
position: u,
|
|
1647
|
+
isMobile: ee,
|
|
1648
|
+
agentName: Ee,
|
|
1649
|
+
avatarImageUrl: Le,
|
|
1650
|
+
idleLoopUrl: Ge,
|
|
1651
|
+
greeting: Ke,
|
|
1652
|
+
branding: I,
|
|
1653
|
+
teamMembers: _,
|
|
1654
|
+
currentTeamMemberId: Q,
|
|
1655
|
+
isSwitchingTeamMember: he,
|
|
1656
|
+
teamSwitcherOpen: oe,
|
|
1657
|
+
onToggleTeamSwitcher: () => q((v) => !v),
|
|
1658
|
+
onSelectTeamMember: W,
|
|
1659
|
+
connectionState: p.connectionState,
|
|
1660
|
+
agentState: p.agentState,
|
|
1661
|
+
transcript: p.transcript,
|
|
1662
|
+
isMuted: V.isMuted,
|
|
1663
|
+
micDevices: Y.mics,
|
|
1664
|
+
isCameraEnabled: K.isEnabled,
|
|
1665
|
+
cameraPreviewEl: K.previewEl,
|
|
1666
|
+
cameraDevices: Y.cameras,
|
|
1667
|
+
activeCameraId: K.activeDeviceId,
|
|
1668
|
+
isScreenShareEnabled: O.isEnabled,
|
|
1669
|
+
screenPreviewEl: O.previewEl,
|
|
1670
|
+
isSpeakerMuted: J,
|
|
1671
|
+
allowCamera: k,
|
|
1672
|
+
allowScreenShare: C,
|
|
1673
|
+
allowTyping: y,
|
|
1674
|
+
languageMenuOpen: le,
|
|
1675
|
+
onToggleLanguageMenu: () => ae((v) => !v),
|
|
1676
|
+
needsUserGesture: ie,
|
|
1677
|
+
canResume: p.canResume,
|
|
1678
|
+
micError: V.micError,
|
|
1679
|
+
error: p.error,
|
|
1680
|
+
avatarVideoContainerRef: me,
|
|
1681
|
+
onConnect: () => void p.connect(),
|
|
1682
|
+
onDisconnect: () => p.disconnect(),
|
|
1683
|
+
onRetry: Je,
|
|
1684
|
+
onResumeAudio: qe,
|
|
1685
|
+
onToggleMute: V.toggleMute,
|
|
1686
|
+
onToggleCamera: () => void K.toggle(),
|
|
1687
|
+
onSwitchCameraDevice: (v) => void K.switchDevice(v),
|
|
1688
|
+
onToggleScreenShare: () => void O.toggle(),
|
|
1689
|
+
onToggleSpeaker: ye,
|
|
1690
|
+
onSendMessage: Ce,
|
|
1691
|
+
onMinimize: He,
|
|
1692
|
+
onClose: Me,
|
|
1693
|
+
onClearMicError: V.clearError
|
|
1185
1694
|
}
|
|
1186
1695
|
)
|
|
1187
1696
|
]
|
|
1188
1697
|
}
|
|
1189
1698
|
);
|
|
1190
1699
|
}
|
|
1191
|
-
function
|
|
1192
|
-
return /* @__PURE__ */ e(
|
|
1700
|
+
function Ft(t) {
|
|
1701
|
+
return /* @__PURE__ */ e(rt, { children: /* @__PURE__ */ e(Bt, { ...t }) });
|
|
1193
1702
|
}
|
|
1194
|
-
const
|
|
1195
|
-
agentId:
|
|
1196
|
-
baseUrl:
|
|
1197
|
-
apiKey:
|
|
1198
|
-
mode:
|
|
1199
|
-
onAgentEvent:
|
|
1703
|
+
const Gt = ({
|
|
1704
|
+
agentId: t,
|
|
1705
|
+
baseUrl: n,
|
|
1706
|
+
apiKey: i,
|
|
1707
|
+
mode: o,
|
|
1708
|
+
onAgentEvent: r,
|
|
1200
1709
|
className: a,
|
|
1201
|
-
style:
|
|
1710
|
+
style: c
|
|
1202
1711
|
}) => {
|
|
1203
|
-
const
|
|
1204
|
-
g.current =
|
|
1205
|
-
const
|
|
1206
|
-
var
|
|
1207
|
-
const
|
|
1208
|
-
(
|
|
1712
|
+
const m = S(null), d = S(null), g = S(r);
|
|
1713
|
+
g.current = r;
|
|
1714
|
+
const u = f((s) => {
|
|
1715
|
+
var b;
|
|
1716
|
+
const l = s.detail;
|
|
1717
|
+
(b = g.current) == null || b.call(g, l);
|
|
1209
1718
|
}, []);
|
|
1210
|
-
return
|
|
1211
|
-
const
|
|
1212
|
-
if (!
|
|
1213
|
-
const
|
|
1214
|
-
return
|
|
1215
|
-
|
|
1719
|
+
return L(() => {
|
|
1720
|
+
const s = m.current;
|
|
1721
|
+
if (!s) return;
|
|
1722
|
+
const l = document.createElement("livelayer-widget");
|
|
1723
|
+
return l.setAttribute("agent-id", t), n && l.setAttribute("base-url", n), i && l.setAttribute("api-key", i), o && l.setAttribute("mode", o), l.addEventListener("agent-event", u), s.appendChild(l), d.current = l, () => {
|
|
1724
|
+
l.removeEventListener("agent-event", u), s.removeChild(l), d.current = null;
|
|
1216
1725
|
};
|
|
1217
|
-
}, [
|
|
1218
|
-
|
|
1219
|
-
}, [
|
|
1726
|
+
}, [t]), L(() => {
|
|
1727
|
+
d.current && (o ? d.current.setAttribute("mode", o) : d.current.removeAttribute("mode"));
|
|
1728
|
+
}, [o]), /* @__PURE__ */ e("div", { ref: m, className: a, style: c });
|
|
1220
1729
|
};
|
|
1221
|
-
function
|
|
1222
|
-
const [
|
|
1223
|
-
|
|
1224
|
-
const
|
|
1225
|
-
if (
|
|
1226
|
-
const
|
|
1227
|
-
return
|
|
1730
|
+
function Kt() {
|
|
1731
|
+
const [t, n] = x([]), i = f((r) => {
|
|
1732
|
+
n((a) => {
|
|
1733
|
+
const c = a.findIndex((m) => m.id === r.id);
|
|
1734
|
+
if (c >= 0) {
|
|
1735
|
+
const m = a.slice();
|
|
1736
|
+
return m[c] = r, m;
|
|
1228
1737
|
}
|
|
1229
|
-
return [...a,
|
|
1738
|
+
return [...a, r];
|
|
1230
1739
|
});
|
|
1231
|
-
}, []),
|
|
1740
|
+
}, []), o = f(() => n([]), []);
|
|
1232
1741
|
return {
|
|
1233
|
-
entries:
|
|
1234
|
-
pushSegment:
|
|
1235
|
-
clear:
|
|
1236
|
-
latest:
|
|
1742
|
+
entries: t,
|
|
1743
|
+
pushSegment: i,
|
|
1744
|
+
clear: o,
|
|
1745
|
+
latest: t.length > 0 ? t[t.length - 1] : null
|
|
1237
1746
|
};
|
|
1238
1747
|
}
|
|
1239
1748
|
export {
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1749
|
+
Ft as AvatarWidget,
|
|
1750
|
+
rt as ErrorBoundary,
|
|
1751
|
+
Gt as LiveLayerWidget,
|
|
1752
|
+
ut as useAgentInfo,
|
|
1753
|
+
ot as useAudioLevel,
|
|
1754
|
+
st as useCameraState,
|
|
1755
|
+
mt as useDisplayMode,
|
|
1756
|
+
vt as useDisplayModePersistence,
|
|
1757
|
+
_t as useIsMobile,
|
|
1758
|
+
it as useLiveKitSession,
|
|
1759
|
+
dt as useMediaDevices,
|
|
1760
|
+
lt as useMicrophoneState,
|
|
1761
|
+
ct as useScreenShareState,
|
|
1762
|
+
Kt as useTranscript
|
|
1250
1763
|
};
|