@livelayer/react 0.2.6 → 0.3.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 +257 -26
- package/dist/index.d.ts +148 -0
- package/dist/index.js +2 -1
- package/dist/index.mjs +1371 -993
- package/dist/styles.css +31 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as _, jsx as
|
|
3
|
-
import { Component as
|
|
4
|
-
import { LiveKitSession as
|
|
5
|
-
import { createLocalAudioTrack as
|
|
6
|
-
class
|
|
2
|
+
import { jsxs as _, jsx as t, Fragment as _t } from "react/jsx-runtime";
|
|
3
|
+
import { Component as Dt, useState as C, useRef as A, useEffect as I, useCallback as y, useMemo as De, forwardRef as zt, createElement as $t } from "react";
|
|
4
|
+
import { LiveKitSession as Bt } from "@livelayer/sdk";
|
|
5
|
+
import { createLocalAudioTrack as Ut, Track as xt, createLocalVideoTrack as Ot } from "livekit-client";
|
|
6
|
+
class Ht extends Dt {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments), this.state = { hasError: !1, error: null }, this.reset = () => {
|
|
9
9
|
this.setState({ hasError: !1, error: null });
|
|
@@ -12,16 +12,16 @@ class it extends et {
|
|
|
12
12
|
static getDerivedStateFromError(n) {
|
|
13
13
|
return { hasError: !0, error: n };
|
|
14
14
|
}
|
|
15
|
-
componentDidCatch(n,
|
|
16
|
-
var
|
|
17
|
-
(
|
|
15
|
+
componentDidCatch(n, r) {
|
|
16
|
+
var i, o;
|
|
17
|
+
(o = (i = this.props).onError) == null || o.call(i, n, r);
|
|
18
18
|
}
|
|
19
19
|
render() {
|
|
20
20
|
var n;
|
|
21
21
|
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ _("div", { className: "ll-error-boundary", role: "alert", children: [
|
|
22
|
-
/* @__PURE__ */
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
-
/* @__PURE__ */
|
|
22
|
+
/* @__PURE__ */ t("p", { className: "ll-error-boundary__title", children: "Widget crashed" }),
|
|
23
|
+
/* @__PURE__ */ t("p", { className: "ll-error-boundary__message", children: ((n = this.state.error) == null ? void 0 : n.message) || "Something went wrong." }),
|
|
24
|
+
/* @__PURE__ */ t(
|
|
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 [n,
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
onConnectionStateChange: (
|
|
41
|
-
|
|
36
|
+
function jt(e) {
|
|
37
|
+
const [n, r] = C("idle"), [i, o] = C("idle"), [l, d] = C([]), [u, s] = C(null), [g, f] = C(null), [a, c] = C(null), [S, x] = C(!1), [E, P] = C(null), b = A(null), T = A(e.onDataMessage);
|
|
38
|
+
T.current = e.onDataMessage, I(() => {
|
|
39
|
+
const k = {
|
|
40
|
+
onConnectionStateChange: (w) => {
|
|
41
|
+
r(w), w === "connected" && P(null);
|
|
42
42
|
},
|
|
43
|
-
onAgentStateChange:
|
|
44
|
-
onTranscript: (
|
|
45
|
-
onAgentConfig:
|
|
46
|
-
onAudioTrack: (
|
|
47
|
-
onVideoTrack: (
|
|
48
|
-
onVideoTrackRemoved: () =>
|
|
49
|
-
onError: (
|
|
50
|
-
onDataMessage: (
|
|
51
|
-
var
|
|
52
|
-
(
|
|
43
|
+
onAgentStateChange: o,
|
|
44
|
+
onTranscript: (w) => d([...w]),
|
|
45
|
+
onAgentConfig: s,
|
|
46
|
+
onAudioTrack: (w) => c(w),
|
|
47
|
+
onVideoTrack: (w) => f(w),
|
|
48
|
+
onVideoTrackRemoved: () => f(null),
|
|
49
|
+
onError: (w) => P(w),
|
|
50
|
+
onDataMessage: (w) => {
|
|
51
|
+
var z;
|
|
52
|
+
(z = T.current) == null || z.call(T, w);
|
|
53
53
|
},
|
|
54
|
-
onResumabilityChange:
|
|
55
|
-
},
|
|
54
|
+
onResumabilityChange: x
|
|
55
|
+
}, L = new Bt(
|
|
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
|
+
k
|
|
64
64
|
);
|
|
65
|
-
return
|
|
66
|
-
var
|
|
67
|
-
(
|
|
65
|
+
return b.current = L, r("idle"), o("idle"), d([]), s(null), f(null), c(null), x(!1), P(null), () => {
|
|
66
|
+
var w;
|
|
67
|
+
(w = L.destroy) == null || w.call(L), b.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 p = y(async () => {
|
|
77
|
+
const k = b.current;
|
|
78
|
+
if (k)
|
|
79
79
|
try {
|
|
80
|
-
await
|
|
81
|
-
} catch (
|
|
82
|
-
throw
|
|
80
|
+
await k.connect();
|
|
81
|
+
} catch (L) {
|
|
82
|
+
throw P(L instanceof Error ? L.message : String(L)), L;
|
|
83
83
|
}
|
|
84
|
-
}, []),
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
}, []),
|
|
88
|
-
var
|
|
89
|
-
return ((
|
|
84
|
+
}, []), N = y(() => {
|
|
85
|
+
const k = b.current;
|
|
86
|
+
k && k.disconnect();
|
|
87
|
+
}, []), R = y(() => {
|
|
88
|
+
var k;
|
|
89
|
+
return ((k = b.current) == null ? void 0 : k.getRoom()) ?? null;
|
|
90
90
|
}, []);
|
|
91
91
|
return {
|
|
92
92
|
connectionState: n,
|
|
93
|
-
agentState:
|
|
94
|
-
transcript:
|
|
95
|
-
agentConfig:
|
|
96
|
-
videoElement:
|
|
97
|
-
audioElement:
|
|
98
|
-
canResume:
|
|
99
|
-
error:
|
|
100
|
-
connect:
|
|
101
|
-
disconnect:
|
|
102
|
-
getRoom:
|
|
103
|
-
session:
|
|
93
|
+
agentState: i,
|
|
94
|
+
transcript: l,
|
|
95
|
+
agentConfig: u,
|
|
96
|
+
videoElement: g,
|
|
97
|
+
audioElement: a,
|
|
98
|
+
canResume: S,
|
|
99
|
+
error: E,
|
|
100
|
+
connect: p,
|
|
101
|
+
disconnect: N,
|
|
102
|
+
getRoom: R,
|
|
103
|
+
session: b.current
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
if (!
|
|
110
|
-
|
|
106
|
+
function Ft() {
|
|
107
|
+
const e = A(null), n = A(null), r = A(null), i = A(null), o = A(/* @__PURE__ */ new Set()), l = A(null), d = y(() => {
|
|
108
|
+
const a = n.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 S = 0;
|
|
119
|
+
for (let E = 0; E < c.length; E++) S += c[E];
|
|
120
|
+
const x = S / c.length / 255;
|
|
121
|
+
for (const E of o.current)
|
|
122
122
|
try {
|
|
123
|
-
|
|
124
|
-
} catch (
|
|
125
|
-
console.error("[useAudioLevel] subscriber threw:",
|
|
123
|
+
E(x);
|
|
124
|
+
} catch (P) {
|
|
125
|
+
console.error("[useAudioLevel] subscriber threw:", P);
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
}, []),
|
|
129
|
-
if (
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
}, []),
|
|
133
|
-
(
|
|
134
|
-
if (
|
|
135
|
-
if (
|
|
127
|
+
i.current = requestAnimationFrame(d);
|
|
128
|
+
}, []), u = y(() => {
|
|
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, n.current = c;
|
|
132
|
+
}, []), s = y(
|
|
133
|
+
(a) => {
|
|
134
|
+
if (u(), !(!e.current || !n.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(n.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(d));
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
|
-
[
|
|
153
|
-
),
|
|
154
|
-
if (
|
|
152
|
+
[u, d]
|
|
153
|
+
), g = y(() => {
|
|
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
|
-
}, []),
|
|
162
|
-
|
|
161
|
+
}, []), f = y((a) => (o.current.add(a), () => {
|
|
162
|
+
o.current.delete(a);
|
|
163
163
|
}), []);
|
|
164
|
-
return
|
|
165
|
-
if (
|
|
164
|
+
return I(() => () => {
|
|
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 (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: s, detach: g, subscribe: f };
|
|
181
181
|
}
|
|
182
|
-
function
|
|
183
|
-
const [
|
|
184
|
-
if (
|
|
182
|
+
function Vt() {
|
|
183
|
+
const [e, n] = C(!1), [r, i] = C(null), o = A(null), l = A(null), d = y(async (f) => {
|
|
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 = f, i(null);
|
|
192
192
|
try {
|
|
193
|
-
const
|
|
193
|
+
const a = await Ut({
|
|
194
194
|
echoCancellation: !0,
|
|
195
195
|
noiseSuppression: !0
|
|
196
196
|
});
|
|
197
|
-
await
|
|
198
|
-
} catch (
|
|
199
|
-
const
|
|
200
|
-
throw
|
|
197
|
+
await f.localParticipant.publishTrack(a), o.current = a, n(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
|
|
204
|
-
|
|
205
|
-
}, []),
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
202
|
+
}, []), u = y(() => {
|
|
203
|
+
const f = o.current;
|
|
204
|
+
f && (f.isMuted ? (f.unmute(), n(!1)) : (f.mute(), n(!0)));
|
|
205
|
+
}, []), s = y(() => {
|
|
206
|
+
const f = o.current, a = l.current;
|
|
207
|
+
if (f && a) {
|
|
208
208
|
try {
|
|
209
|
-
|
|
209
|
+
a.localParticipant.unpublishTrack(f);
|
|
210
210
|
} catch {
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
f.stop();
|
|
213
213
|
}
|
|
214
|
-
|
|
215
|
-
}, []),
|
|
214
|
+
o.current = null, l.current = null, n(!1);
|
|
215
|
+
}, []), g = y(() => 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: u,
|
|
220
|
+
setupMic: d,
|
|
221
|
+
teardownMic: s,
|
|
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 Wt = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
226
|
+
function qt() {
|
|
227
|
+
const [e, n] = C(!1), [r, i] = C(null), [o, l] = C(null), [d, u] = C(""), s = A(null), g = A(null), f = y((b) => {
|
|
228
|
+
s.current = b;
|
|
229
|
+
}, []), a = y(() => {
|
|
230
|
+
const b = s.current, T = g.current;
|
|
231
|
+
if (T && b) {
|
|
232
|
+
const p = b.localParticipant.getTrackPublication(xt.Source.Camera);
|
|
233
|
+
if (p != null && p.track) {
|
|
234
234
|
try {
|
|
235
|
-
|
|
235
|
+
b.localParticipant.unpublishTrack(p.track);
|
|
236
236
|
} catch {
|
|
237
237
|
}
|
|
238
|
-
|
|
238
|
+
p.track.stop();
|
|
239
239
|
} else
|
|
240
|
-
|
|
240
|
+
T.stop();
|
|
241
241
|
}
|
|
242
|
-
|
|
243
|
-
}, []),
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
-
|
|
242
|
+
g.current = null, l(null), n(!1);
|
|
243
|
+
}, []), c = y(async (b) => {
|
|
244
|
+
const T = s.current;
|
|
245
|
+
if (T) {
|
|
246
|
+
i(null);
|
|
247
247
|
try {
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
const
|
|
251
|
-
await
|
|
252
|
-
const
|
|
253
|
-
|
|
248
|
+
const p = { ...Wt };
|
|
249
|
+
b && (p.deviceId = b);
|
|
250
|
+
const N = await Ot(p);
|
|
251
|
+
await T.localParticipant.publishTrack(N), g.current = N;
|
|
252
|
+
const R = N.attach();
|
|
253
|
+
l(R), n(!0), b && u(b);
|
|
254
254
|
try {
|
|
255
|
-
|
|
255
|
+
T.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 (p) {
|
|
262
|
+
const N = p instanceof Error && p.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
|
|
263
|
+
i(N);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
-
}, []),
|
|
267
|
-
|
|
268
|
-
}, [
|
|
269
|
-
|
|
270
|
-
}, [
|
|
271
|
-
|
|
272
|
-
}, [
|
|
273
|
-
return
|
|
274
|
-
|
|
266
|
+
}, []), S = y(async () => {
|
|
267
|
+
e ? a() : await c(d || void 0);
|
|
268
|
+
}, [e, d, a, c]), x = y(async (b) => {
|
|
269
|
+
a(), await c(b);
|
|
270
|
+
}, [a, c]), E = y(() => {
|
|
271
|
+
a(), s.current = null, i(null), u("");
|
|
272
|
+
}, [a]), P = y(() => 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:
|
|
282
|
-
attachRoom:
|
|
283
|
-
teardown:
|
|
284
|
-
clearError:
|
|
276
|
+
isEnabled: e,
|
|
277
|
+
error: r,
|
|
278
|
+
previewEl: o,
|
|
279
|
+
activeDeviceId: d,
|
|
280
|
+
toggle: S,
|
|
281
|
+
switchDevice: x,
|
|
282
|
+
attachRoom: f,
|
|
283
|
+
teardown: E,
|
|
284
|
+
clearError: P
|
|
285
285
|
};
|
|
286
286
|
}
|
|
287
|
-
function
|
|
288
|
-
const [
|
|
289
|
-
|
|
290
|
-
}, []),
|
|
291
|
-
const
|
|
292
|
-
if (
|
|
293
|
-
if (
|
|
287
|
+
function Gt() {
|
|
288
|
+
const [e, n] = C(!1), [r, i] = C(null), [o, l] = C(null), d = A(null), u = y((c) => {
|
|
289
|
+
d.current = c;
|
|
290
|
+
}, []), s = y(() => l(null), []), g = y(async () => {
|
|
291
|
+
const c = d.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
|
+
s(), n(!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 S = 0;
|
|
305
|
+
const x = () => {
|
|
306
|
+
const E = c.localParticipant.getTrackPublication(xt.Source.ScreenShare);
|
|
307
|
+
if (E != null && E.track) {
|
|
308
|
+
const P = E.track.attach();
|
|
309
|
+
l(P), n(!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,132 +316,192 @@ function dt() {
|
|
|
316
316
|
}
|
|
317
317
|
return;
|
|
318
318
|
}
|
|
319
|
-
|
|
319
|
+
S++ < 10 ? setTimeout(x, 100) : n(!0);
|
|
320
320
|
};
|
|
321
|
-
|
|
322
|
-
} catch (
|
|
323
|
-
const
|
|
324
|
-
|
|
321
|
+
x();
|
|
322
|
+
} catch (S) {
|
|
323
|
+
const x = S instanceof Error ? S.name : "";
|
|
324
|
+
x !== "NotAllowedError" && x !== "AbortError" && i("Screen share unavailable. Try again."), n(!1);
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
|
-
}, [
|
|
328
|
-
const
|
|
329
|
-
if (
|
|
327
|
+
}, [e, s]), f = y(() => {
|
|
328
|
+
const c = d.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
|
+
s(), n(!1), i(null), d.current = null;
|
|
335
|
+
}, [e, s]), a = y(() => i(null), []);
|
|
336
|
+
return { isEnabled: e, error: r, previewEl: o, toggle: g, attachRoom: u, teardown: f, clearError: a };
|
|
337
337
|
}
|
|
338
|
-
function
|
|
339
|
-
const [
|
|
338
|
+
function Yt() {
|
|
339
|
+
const [e, n] = C([]), [r, i] = C([]), o = y(async () => {
|
|
340
340
|
if (!(typeof navigator > "u" || !navigator.mediaDevices))
|
|
341
341
|
try {
|
|
342
|
-
const
|
|
343
|
-
n(
|
|
342
|
+
const l = await navigator.mediaDevices.enumerateDevices();
|
|
343
|
+
n(l.filter((d) => d.kind === "audioinput")), i(l.filter((d) => d.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 Kt(e, n, r = !1) {
|
|
354
|
+
const [i, o] = C(null), [l, d] = C(null), [u, s] = C(!r && !!e);
|
|
355
|
+
return I(() => {
|
|
356
|
+
if (r || !e) {
|
|
357
|
+
s(!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(), f = n || "https://app.livelayer.studio";
|
|
361
|
+
return s(!0), d(null), fetch(`${f}/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), s(!1));
|
|
371
|
+
}).catch((a) => {
|
|
372
|
+
g.signal.aborted || (d(a instanceof Error ? a.message : "Agent lookup failed"), s(!1));
|
|
373
|
+
}), () => g.abort();
|
|
374
|
+
}, [e, n, r]), { info: i, error: l, loading: u };
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function Xt(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 Jt(e, n) {
|
|
385
385
|
if (!(typeof window > "u"))
|
|
386
386
|
try {
|
|
387
|
-
window.localStorage.setItem(
|
|
387
|
+
window.localStorage.setItem(e, n);
|
|
388
388
|
} catch {
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
-
function
|
|
392
|
-
value:
|
|
391
|
+
function Qt({
|
|
392
|
+
value: e,
|
|
393
393
|
defaultValue: n = "expanded",
|
|
394
|
-
onChange:
|
|
394
|
+
onChange: r
|
|
395
395
|
} = {}) {
|
|
396
|
-
const
|
|
397
|
-
(
|
|
398
|
-
|
|
396
|
+
const i = e !== void 0, [o, l] = C(n), d = i ? e : o, u = y(
|
|
397
|
+
(s) => {
|
|
398
|
+
s !== d && (i || l(s), r == null || r(s));
|
|
399
399
|
},
|
|
400
|
-
[
|
|
400
|
+
[d, i, r]
|
|
401
401
|
);
|
|
402
|
-
return [
|
|
402
|
+
return [d, u];
|
|
403
403
|
}
|
|
404
|
-
const
|
|
405
|
-
function
|
|
406
|
-
return
|
|
404
|
+
const Zt = ["hidden", "minimized", "expanded"];
|
|
405
|
+
function en(e) {
|
|
406
|
+
return e && Zt.includes(e) ? e : null;
|
|
407
407
|
}
|
|
408
|
-
function
|
|
409
|
-
value:
|
|
408
|
+
function tn({
|
|
409
|
+
value: e,
|
|
410
410
|
defaultValue: n = "expanded",
|
|
411
|
-
onChange:
|
|
412
|
-
persistKey:
|
|
413
|
-
disablePersistence:
|
|
411
|
+
onChange: r,
|
|
412
|
+
persistKey: i = "ll-widget",
|
|
413
|
+
disablePersistence: o = !1
|
|
414
414
|
} = {}) {
|
|
415
|
-
const
|
|
416
|
-
value:
|
|
415
|
+
const l = `${i}:display-mode`, d = A(!1), [u, s] = Qt({
|
|
416
|
+
value: e,
|
|
417
417
|
defaultValue: n,
|
|
418
|
-
onChange: (
|
|
419
|
-
|
|
418
|
+
onChange: (g) => {
|
|
419
|
+
e === void 0 && !o && Jt(l, g), r == null || r(g);
|
|
420
420
|
}
|
|
421
421
|
});
|
|
422
|
-
return
|
|
423
|
-
if (
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
}, []), [
|
|
422
|
+
return I(() => {
|
|
423
|
+
if (d.current || (d.current = !0, o || e !== void 0)) return;
|
|
424
|
+
const g = en(Xt(l));
|
|
425
|
+
g && g !== u && s(g);
|
|
426
|
+
}, []), [u, s];
|
|
427
427
|
}
|
|
428
|
-
const
|
|
429
|
-
function
|
|
430
|
-
const [n,
|
|
431
|
-
return
|
|
432
|
-
if (
|
|
433
|
-
|
|
428
|
+
const nn = 640;
|
|
429
|
+
function rn(e = nn) {
|
|
430
|
+
const [n, r] = C(!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]), n;
|
|
443
|
+
}
|
|
444
|
+
const ct = "__llHistoryPatched", ze = "ll:pathname";
|
|
445
|
+
function on() {
|
|
446
|
+
if (typeof window > "u" || window.history[ct]) return;
|
|
447
|
+
const e = window.history.pushState, n = window.history.replaceState;
|
|
448
|
+
window.history.pushState = function(...r) {
|
|
449
|
+
const i = e.apply(this, r);
|
|
450
|
+
return window.dispatchEvent(new Event(ze)), i;
|
|
451
|
+
}, window.history.replaceState = function(...r) {
|
|
452
|
+
const i = n.apply(this, r);
|
|
453
|
+
return window.dispatchEvent(new Event(ze)), i;
|
|
454
|
+
}, window.history[ct] = !0;
|
|
455
|
+
}
|
|
456
|
+
function st() {
|
|
457
|
+
return typeof window > "u" ? "/" : window.location.pathname || "/";
|
|
458
|
+
}
|
|
459
|
+
function ln(e) {
|
|
460
|
+
const [n, r] = C(
|
|
461
|
+
() => e ?? st()
|
|
462
|
+
);
|
|
463
|
+
return I(() => {
|
|
464
|
+
if (e !== void 0) return;
|
|
465
|
+
on();
|
|
466
|
+
const i = () => r(st());
|
|
467
|
+
return i(), window.addEventListener("popstate", i), window.addEventListener(ze, i), () => {
|
|
468
|
+
window.removeEventListener("popstate", i), window.removeEventListener(ze, i);
|
|
469
|
+
};
|
|
470
|
+
}, [e]), e ?? n;
|
|
443
471
|
}
|
|
444
|
-
const
|
|
472
|
+
const dt = /* @__PURE__ */ new Map(), an = /[\\^$+?.()|{}[\]]/g;
|
|
473
|
+
function cn(e) {
|
|
474
|
+
return e.replace(an, "\\$&");
|
|
475
|
+
}
|
|
476
|
+
function sn(e) {
|
|
477
|
+
const n = dt.get(e);
|
|
478
|
+
if (n) return n;
|
|
479
|
+
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", o = "", l = r.replace(/\*\*/g, i).replace(/\*/g, o), u = cn(l).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(o, "g"), "[^/]+"), s = new RegExp(`^${u}\\/?$`);
|
|
480
|
+
return dt.set(e, s), s;
|
|
481
|
+
}
|
|
482
|
+
function dn(e, n) {
|
|
483
|
+
const r = n.length > 1 && n.endsWith("/") ? n.slice(0, -1) : n;
|
|
484
|
+
return sn(e).test(r);
|
|
485
|
+
}
|
|
486
|
+
function un(e, n) {
|
|
487
|
+
return typeof e == "function" ? e(n) : e instanceof RegExp ? e.test(n) : dn(e, n);
|
|
488
|
+
}
|
|
489
|
+
function ut(e, n) {
|
|
490
|
+
if (!e || e.length === 0) return !1;
|
|
491
|
+
for (const r of e)
|
|
492
|
+
if (un(r, n)) return !0;
|
|
493
|
+
return !1;
|
|
494
|
+
}
|
|
495
|
+
function hn(e, n, r) {
|
|
496
|
+
return e === void 0 ? !0 : ut(r, e) ? !1 : n && n.length > 0 ? ut(n, e) : !0;
|
|
497
|
+
}
|
|
498
|
+
function fn(e, n, r) {
|
|
499
|
+
return De(
|
|
500
|
+
() => hn(e, n, r),
|
|
501
|
+
[e, n, r]
|
|
502
|
+
);
|
|
503
|
+
}
|
|
504
|
+
const ht = ({ muted: e = !1, className: n }) => e ? /* @__PURE__ */ _(
|
|
445
505
|
"svg",
|
|
446
506
|
{
|
|
447
507
|
className: n,
|
|
@@ -451,7 +511,7 @@ const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ _(
|
|
|
451
511
|
strokeWidth: 2,
|
|
452
512
|
"aria-hidden": "true",
|
|
453
513
|
children: [
|
|
454
|
-
/* @__PURE__ */
|
|
514
|
+
/* @__PURE__ */ t(
|
|
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__ */ t(
|
|
463
523
|
"path",
|
|
464
524
|
{
|
|
465
525
|
strokeLinecap: "round",
|
|
@@ -469,7 +529,7 @@ const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ _(
|
|
|
469
529
|
)
|
|
470
530
|
]
|
|
471
531
|
}
|
|
472
|
-
) : /* @__PURE__ */
|
|
532
|
+
) : /* @__PURE__ */ t(
|
|
473
533
|
"svg",
|
|
474
534
|
{
|
|
475
535
|
className: n,
|
|
@@ -478,7 +538,7 @@ const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ _(
|
|
|
478
538
|
stroke: "currentColor",
|
|
479
539
|
strokeWidth: 2,
|
|
480
540
|
"aria-hidden": "true",
|
|
481
|
-
children: /* @__PURE__ */
|
|
541
|
+
children: /* @__PURE__ */ t(
|
|
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
|
+
), ft = ({ className: e }) => /* @__PURE__ */ t(
|
|
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__ */ t(
|
|
500
560
|
"path",
|
|
501
561
|
{
|
|
502
562
|
strokeLinecap: "round",
|
|
@@ -505,23 +565,23 @@ const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ _(
|
|
|
505
565
|
}
|
|
506
566
|
)
|
|
507
567
|
}
|
|
508
|
-
),
|
|
568
|
+
), pn = ({ className: e }) => /* @__PURE__ */ t(
|
|
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__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
518
578
|
}
|
|
519
|
-
),
|
|
579
|
+
), mn = {
|
|
520
580
|
left: 180,
|
|
521
581
|
right: 0,
|
|
522
582
|
up: -90,
|
|
523
583
|
down: 90
|
|
524
|
-
},
|
|
584
|
+
}, gn = ({ direction: e = "right", className: n }) => /* @__PURE__ */ t(
|
|
525
585
|
"svg",
|
|
526
586
|
{
|
|
527
587
|
className: n,
|
|
@@ -529,304 +589,304 @@ const Pe = ({ muted: t = !1, className: n }) => t ? /* @__PURE__ */ _(
|
|
|
529
589
|
viewBox: "0 0 24 24",
|
|
530
590
|
stroke: "currentColor",
|
|
531
591
|
strokeWidth: 2,
|
|
532
|
-
style: { transform: `rotate(${
|
|
592
|
+
style: { transform: `rotate(${mn[e]}deg)` },
|
|
533
593
|
"aria-hidden": "true",
|
|
534
|
-
children: /* @__PURE__ */
|
|
594
|
+
children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M9 6l6 6-6 6" })
|
|
535
595
|
}
|
|
536
596
|
);
|
|
537
|
-
function
|
|
538
|
-
return
|
|
597
|
+
function vn(e) {
|
|
598
|
+
return e === "top-left" || e === "bottom-left" ? "left" : "right";
|
|
539
599
|
}
|
|
540
|
-
const
|
|
541
|
-
function
|
|
600
|
+
const kt = "ll-hidden-tab-center-y", yn = 5, pt = 16;
|
|
601
|
+
function bn() {
|
|
542
602
|
if (typeof window > "u") return null;
|
|
543
603
|
try {
|
|
544
|
-
const
|
|
545
|
-
if (!
|
|
546
|
-
const n = Number.parseFloat(
|
|
604
|
+
const e = window.localStorage.getItem(kt);
|
|
605
|
+
if (!e) return null;
|
|
606
|
+
const n = Number.parseFloat(e);
|
|
547
607
|
return Number.isFinite(n) ? n : null;
|
|
548
608
|
} catch {
|
|
549
609
|
return null;
|
|
550
610
|
}
|
|
551
611
|
}
|
|
552
|
-
function
|
|
612
|
+
function mt(e) {
|
|
553
613
|
if (!(typeof window > "u"))
|
|
554
614
|
try {
|
|
555
|
-
window.localStorage.setItem(
|
|
615
|
+
window.localStorage.setItem(kt, String(e));
|
|
556
616
|
} catch {
|
|
557
617
|
}
|
|
558
618
|
}
|
|
559
|
-
const
|
|
560
|
-
position:
|
|
619
|
+
const wn = ({
|
|
620
|
+
position: e,
|
|
561
621
|
isMobile: n,
|
|
562
|
-
isSpeaking:
|
|
563
|
-
onExpand:
|
|
564
|
-
label:
|
|
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 = vn(e), d = l === "right" ? "left" : "right", u = n ? 80 : 72, [s, g] = C(null), [f, a] = C(!1), c = A(null), S = A(!1), x = y(
|
|
627
|
+
(k) => {
|
|
628
|
+
if (typeof window > "u") return k;
|
|
629
|
+
const L = u / 2, w = pt + L, z = window.innerHeight - pt - L;
|
|
630
|
+
return z < w ? Math.max(w, k) : Math.max(w, Math.min(z, k));
|
|
571
631
|
},
|
|
572
|
-
[
|
|
632
|
+
[u]
|
|
573
633
|
);
|
|
574
|
-
|
|
575
|
-
const
|
|
576
|
-
|
|
577
|
-
const
|
|
578
|
-
|
|
634
|
+
I(() => {
|
|
635
|
+
const k = bn();
|
|
636
|
+
g(x(k ?? window.innerHeight / 2));
|
|
637
|
+
const L = () => {
|
|
638
|
+
g((w) => w === null ? null : x(w));
|
|
579
639
|
};
|
|
580
|
-
return window.addEventListener("resize",
|
|
581
|
-
}, [
|
|
582
|
-
const
|
|
583
|
-
(
|
|
584
|
-
if (!(
|
|
640
|
+
return window.addEventListener("resize", L), () => window.removeEventListener("resize", L);
|
|
641
|
+
}, [x]);
|
|
642
|
+
const E = y(
|
|
643
|
+
(k) => {
|
|
644
|
+
if (!(k.pointerType === "mouse" && k.button !== 0) && s !== null) {
|
|
585
645
|
try {
|
|
586
|
-
|
|
646
|
+
k.currentTarget.setPointerCapture(k.pointerId);
|
|
587
647
|
} catch {
|
|
588
648
|
}
|
|
589
|
-
|
|
590
|
-
startClientY:
|
|
591
|
-
startCenterY:
|
|
649
|
+
c.current = {
|
|
650
|
+
startClientY: k.clientY,
|
|
651
|
+
startCenterY: s,
|
|
592
652
|
moved: !1
|
|
593
653
|
};
|
|
594
654
|
}
|
|
595
655
|
},
|
|
596
|
-
[
|
|
597
|
-
),
|
|
598
|
-
(
|
|
599
|
-
const
|
|
600
|
-
if (!
|
|
601
|
-
const
|
|
602
|
-
!
|
|
656
|
+
[s]
|
|
657
|
+
), P = y(
|
|
658
|
+
(k) => {
|
|
659
|
+
const L = c.current;
|
|
660
|
+
if (!L) return;
|
|
661
|
+
const w = k.clientY - L.startClientY;
|
|
662
|
+
!L.moved && Math.abs(w) > yn && (L.moved = !0, a(!0)), L.moved && g(x(L.startCenterY + w));
|
|
603
663
|
},
|
|
604
|
-
[
|
|
605
|
-
),
|
|
606
|
-
(
|
|
607
|
-
const
|
|
608
|
-
if (
|
|
664
|
+
[x]
|
|
665
|
+
), b = y(
|
|
666
|
+
(k) => {
|
|
667
|
+
const L = c.current;
|
|
668
|
+
if (L) {
|
|
609
669
|
try {
|
|
610
|
-
|
|
670
|
+
k.currentTarget.releasePointerCapture(k.pointerId);
|
|
611
671
|
} catch {
|
|
612
672
|
}
|
|
613
|
-
|
|
673
|
+
c.current = null, L.moved && (a(!1), S.current = !0, g((w) => (w !== null && mt(w), w)));
|
|
614
674
|
}
|
|
615
675
|
},
|
|
616
676
|
[]
|
|
617
|
-
),
|
|
618
|
-
if (
|
|
619
|
-
|
|
677
|
+
), T = y(() => {
|
|
678
|
+
if (S.current) {
|
|
679
|
+
S.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]), p = y(
|
|
684
|
+
(k) => {
|
|
685
|
+
if (k.key === "ArrowUp" || k.key === "ArrowDown") {
|
|
686
|
+
k.preventDefault();
|
|
687
|
+
const L = k.key === "ArrowUp" ? -8 : 8;
|
|
688
|
+
g((w) => {
|
|
689
|
+
if (w === null) return w;
|
|
690
|
+
const z = x(w + L);
|
|
691
|
+
return mt(z), z;
|
|
632
692
|
});
|
|
633
693
|
}
|
|
634
694
|
},
|
|
635
|
-
[
|
|
636
|
-
),
|
|
695
|
+
[x]
|
|
696
|
+
), N = [
|
|
637
697
|
"ll-hidden",
|
|
638
|
-
`ll-hidden--${
|
|
698
|
+
`ll-hidden--${l}`,
|
|
639
699
|
n ? "ll-hidden--mobile" : "ll-hidden--desktop",
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
].filter(Boolean).join(" "),
|
|
643
|
-
return /* @__PURE__ */
|
|
700
|
+
r ? "ll-hidden--speaking" : null,
|
|
701
|
+
f ? "is-dragging" : null
|
|
702
|
+
].filter(Boolean).join(" "), R = s === null ? void 0 : { top: `${s - u / 2}px`, transform: "none" };
|
|
703
|
+
return /* @__PURE__ */ t(
|
|
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: N,
|
|
708
|
+
onPointerDown: E,
|
|
709
|
+
onPointerMove: P,
|
|
710
|
+
onPointerUp: b,
|
|
711
|
+
onPointerCancel: b,
|
|
712
|
+
onClick: T,
|
|
713
|
+
onKeyDown: p,
|
|
714
|
+
"aria-label": o,
|
|
715
|
+
"data-position": e,
|
|
716
|
+
style: R,
|
|
717
|
+
children: /* @__PURE__ */ t(gn, { direction: d, className: "ll-hidden__chevron" })
|
|
658
718
|
}
|
|
659
719
|
);
|
|
660
|
-
},
|
|
661
|
-
audioLevel:
|
|
720
|
+
}, _n = ({
|
|
721
|
+
audioLevel: e,
|
|
662
722
|
bars: n = 20,
|
|
663
|
-
maxHeight:
|
|
664
|
-
minHeight:
|
|
665
|
-
className:
|
|
666
|
-
barClassName:
|
|
723
|
+
maxHeight: r = 20,
|
|
724
|
+
minHeight: i = 4,
|
|
725
|
+
className: o,
|
|
726
|
+
barClassName: l
|
|
667
727
|
}) => {
|
|
668
|
-
const
|
|
669
|
-
const
|
|
670
|
-
return Array.from({ length: n }, (
|
|
728
|
+
const d = A(null), u = A([]), s = De(() => {
|
|
729
|
+
const f = (Math.sqrt(5) - 1) / 2;
|
|
730
|
+
return Array.from({ length: n }, (a, c) => 0.5 + c * f % 1 * 0.5);
|
|
671
731
|
}, [n]);
|
|
672
|
-
|
|
673
|
-
for (let
|
|
674
|
-
const
|
|
675
|
-
if (!
|
|
676
|
-
const
|
|
677
|
-
|
|
732
|
+
I(() => e.subscribe((a) => {
|
|
733
|
+
for (let c = 0; c < n; c++) {
|
|
734
|
+
const S = u.current[c];
|
|
735
|
+
if (!S) continue;
|
|
736
|
+
const x = Math.max(i, a * r * s[c]);
|
|
737
|
+
S.style.height = `${x}px`;
|
|
678
738
|
}
|
|
679
|
-
}), [
|
|
680
|
-
const
|
|
681
|
-
return /* @__PURE__ */
|
|
739
|
+
}), [e, n, r, i, s]);
|
|
740
|
+
const g = ["ll-waveform", o].filter(Boolean).join(" ");
|
|
741
|
+
return /* @__PURE__ */ t("div", { ref: d, className: g, "aria-hidden": "true", children: Array.from({ length: n }, (f, a) => /* @__PURE__ */ t(
|
|
682
742
|
"div",
|
|
683
743
|
{
|
|
684
|
-
ref: (
|
|
685
|
-
|
|
744
|
+
ref: (c) => {
|
|
745
|
+
u.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:
|
|
752
|
+
}, xn = ({
|
|
753
|
+
position: e,
|
|
694
754
|
isMobile: n,
|
|
695
|
-
agentName:
|
|
696
|
-
avatarImageUrl:
|
|
697
|
-
agentState:
|
|
698
|
-
isMuted:
|
|
699
|
-
audioLevel:
|
|
700
|
-
onExpand:
|
|
701
|
-
onToggleMute:
|
|
702
|
-
onClose:
|
|
703
|
-
}) => n ? /* @__PURE__ */
|
|
755
|
+
agentName: r,
|
|
756
|
+
avatarImageUrl: i,
|
|
757
|
+
agentState: o,
|
|
758
|
+
isMuted: l,
|
|
759
|
+
audioLevel: d,
|
|
760
|
+
onExpand: u,
|
|
761
|
+
onToggleMute: s,
|
|
762
|
+
onClose: g
|
|
763
|
+
}) => n ? /* @__PURE__ */ t(
|
|
704
764
|
"div",
|
|
705
765
|
{
|
|
706
766
|
className: "ll-minimized ll-minimized--mobile",
|
|
707
767
|
role: "region",
|
|
708
|
-
"aria-label": `${
|
|
768
|
+
"aria-label": `${r} widget`,
|
|
709
769
|
children: /* @__PURE__ */ _(
|
|
710
770
|
"button",
|
|
711
771
|
{
|
|
712
772
|
type: "button",
|
|
713
773
|
className: "ll-minimized__surface",
|
|
714
|
-
onClick:
|
|
715
|
-
"aria-label": `Expand ${
|
|
774
|
+
onClick: u,
|
|
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__ */ t(
|
|
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__ */ t("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
|
|
788
|
+
/* @__PURE__ */ t(
|
|
789
|
+
_n,
|
|
730
790
|
{
|
|
731
|
-
audioLevel:
|
|
791
|
+
audioLevel: d,
|
|
732
792
|
bars: 16,
|
|
733
793
|
maxHeight: 18,
|
|
734
794
|
className: "ll-minimized__waveform"
|
|
735
795
|
}
|
|
736
796
|
),
|
|
737
|
-
/* @__PURE__ */
|
|
797
|
+
/* @__PURE__ */ t("span", { className: "ll-minimized__name", children: r }),
|
|
738
798
|
/* @__PURE__ */ _("div", { className: "ll-minimized__controls", children: [
|
|
739
|
-
/* @__PURE__ */
|
|
799
|
+
/* @__PURE__ */ t(
|
|
740
800
|
"span",
|
|
741
801
|
{
|
|
742
802
|
className: "ll-minimized__btn",
|
|
743
803
|
role: "button",
|
|
744
804
|
tabIndex: 0,
|
|
745
|
-
onClick: (
|
|
746
|
-
|
|
805
|
+
onClick: (f) => {
|
|
806
|
+
f.stopPropagation(), s();
|
|
747
807
|
},
|
|
748
|
-
onKeyDown: (
|
|
749
|
-
(
|
|
808
|
+
onKeyDown: (f) => {
|
|
809
|
+
(f.key === "Enter" || f.key === " ") && (f.stopPropagation(), f.preventDefault(), s());
|
|
750
810
|
},
|
|
751
|
-
"aria-label":
|
|
752
|
-
children: /* @__PURE__ */
|
|
811
|
+
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
812
|
+
children: /* @__PURE__ */ t(ht, { muted: l, className: "ll-minimized__icon" })
|
|
753
813
|
}
|
|
754
814
|
),
|
|
755
|
-
/* @__PURE__ */
|
|
815
|
+
/* @__PURE__ */ t(ft, { className: "ll-minimized__icon ll-minimized__icon--expand" })
|
|
756
816
|
] })
|
|
757
817
|
]
|
|
758
818
|
}
|
|
759
819
|
)
|
|
760
820
|
}
|
|
761
|
-
) : /* @__PURE__ */
|
|
821
|
+
) : /* @__PURE__ */ t(
|
|
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": `${
|
|
827
|
+
"aria-label": `${r} widget`,
|
|
768
828
|
children: /* @__PURE__ */ _("div", { className: "ll-minimized__surface", children: [
|
|
769
|
-
|
|
829
|
+
i ? (
|
|
770
830
|
// eslint-disable-next-line @next/next/no-img-element
|
|
771
|
-
/* @__PURE__ */
|
|
831
|
+
/* @__PURE__ */ t(
|
|
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__ */
|
|
839
|
+
) : /* @__PURE__ */ t("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
|
|
780
840
|
/* @__PURE__ */ _("div", { className: "ll-minimized__meta", children: [
|
|
781
|
-
/* @__PURE__ */
|
|
782
|
-
/* @__PURE__ */
|
|
841
|
+
/* @__PURE__ */ t("span", { className: "ll-minimized__name", children: r }),
|
|
842
|
+
/* @__PURE__ */ t("span", { className: "ll-minimized__state", children: o === "speaking" ? "Speaking" : o === "thinking" ? "Thinking" : "Listening" })
|
|
783
843
|
] }),
|
|
784
844
|
/* @__PURE__ */ _("div", { className: "ll-minimized__controls", children: [
|
|
785
|
-
/* @__PURE__ */
|
|
845
|
+
/* @__PURE__ */ t(
|
|
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: s,
|
|
851
|
+
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
852
|
+
children: /* @__PURE__ */ t(ht, { muted: l, className: "ll-minimized__icon" })
|
|
793
853
|
}
|
|
794
854
|
),
|
|
795
|
-
/* @__PURE__ */
|
|
855
|
+
/* @__PURE__ */ t(
|
|
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: u,
|
|
861
|
+
"aria-label": `Expand ${r} widget`,
|
|
862
|
+
children: /* @__PURE__ */ t(ft, { className: "ll-minimized__icon" })
|
|
803
863
|
}
|
|
804
864
|
),
|
|
805
|
-
/* @__PURE__ */
|
|
865
|
+
/* @__PURE__ */ t(
|
|
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__ */ t(pn, { className: "ll-minimized__icon" })
|
|
813
873
|
}
|
|
814
874
|
)
|
|
815
875
|
] })
|
|
816
876
|
] })
|
|
817
877
|
}
|
|
818
|
-
),
|
|
819
|
-
src:
|
|
878
|
+
), kn = ({
|
|
879
|
+
src: e,
|
|
820
880
|
alt: n,
|
|
821
|
-
preCannedPlaying:
|
|
822
|
-
className:
|
|
823
|
-
style:
|
|
881
|
+
preCannedPlaying: r = !1,
|
|
882
|
+
className: i,
|
|
883
|
+
style: o
|
|
824
884
|
}) => {
|
|
825
|
-
const [
|
|
826
|
-
if (
|
|
827
|
-
|
|
828
|
-
}, [
|
|
829
|
-
const
|
|
885
|
+
const [l, d] = C(!1), u = A(e);
|
|
886
|
+
if (I(() => {
|
|
887
|
+
u.current !== e && (u.current = e, d(!1));
|
|
888
|
+
}, [e]), !e) return null;
|
|
889
|
+
const s = {
|
|
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__ */ t(
|
|
844
904
|
"img",
|
|
845
905
|
{
|
|
846
|
-
src:
|
|
906
|
+
src: e,
|
|
847
907
|
alt: n,
|
|
848
|
-
className:
|
|
849
|
-
style:
|
|
908
|
+
className: i,
|
|
909
|
+
style: s,
|
|
850
910
|
loading: "eager",
|
|
851
911
|
fetchpriority: "high",
|
|
852
|
-
onLoad: () =>
|
|
912
|
+
onLoad: () => d(!0)
|
|
853
913
|
}
|
|
854
914
|
)
|
|
855
915
|
);
|
|
856
|
-
},
|
|
857
|
-
position:
|
|
916
|
+
}, Cn = ({
|
|
917
|
+
position: e,
|
|
858
918
|
isMobile: n,
|
|
859
|
-
agentName:
|
|
860
|
-
avatarImageUrl:
|
|
861
|
-
idleLoopUrl:
|
|
862
|
-
greeting:
|
|
863
|
-
branding:
|
|
864
|
-
teamMembers:
|
|
865
|
-
currentTeamMemberId:
|
|
866
|
-
isSwitchingTeamMember:
|
|
867
|
-
teamSwitcherOpen:
|
|
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:
|
|
919
|
+
agentName: r,
|
|
920
|
+
avatarImageUrl: i,
|
|
921
|
+
idleLoopUrl: o,
|
|
922
|
+
greeting: l,
|
|
923
|
+
branding: d,
|
|
924
|
+
teamMembers: u,
|
|
925
|
+
currentTeamMemberId: s,
|
|
926
|
+
isSwitchingTeamMember: g,
|
|
927
|
+
teamSwitcherOpen: f,
|
|
928
|
+
onToggleTeamSwitcher: a,
|
|
929
|
+
onSelectTeamMember: c,
|
|
930
|
+
languageMenuOpen: S,
|
|
931
|
+
onToggleLanguageMenu: x,
|
|
932
|
+
connectionState: E,
|
|
933
|
+
agentState: P,
|
|
934
|
+
transcript: b,
|
|
935
|
+
canResume: T,
|
|
936
|
+
needsUserGesture: p,
|
|
937
|
+
error: N,
|
|
938
|
+
isMuted: R,
|
|
939
|
+
micError: k,
|
|
940
|
+
micDevices: L,
|
|
941
|
+
isCameraEnabled: w,
|
|
942
|
+
cameraPreviewEl: z,
|
|
943
|
+
cameraDevices: Ee,
|
|
944
|
+
activeCameraId: $e,
|
|
945
|
+
isScreenShareEnabled: K,
|
|
946
|
+
screenPreviewEl: X,
|
|
947
|
+
isSpeakerMuted: Z,
|
|
948
|
+
allowCamera: Ne,
|
|
949
|
+
allowScreenShare: oe,
|
|
950
|
+
allowTyping: le,
|
|
951
|
+
avatarVideoContainerRef: ae,
|
|
952
|
+
onConnect: ee,
|
|
953
|
+
onDisconnect: ce,
|
|
954
|
+
onRetry: se,
|
|
955
|
+
onResumeAudio: de,
|
|
956
|
+
onToggleMute: D,
|
|
957
|
+
onToggleCamera: Be,
|
|
958
|
+
onSwitchCameraDevice: Ue,
|
|
959
|
+
onToggleScreenShare: Oe,
|
|
960
|
+
onToggleSpeaker: Se,
|
|
961
|
+
onSendMessage: ue,
|
|
962
|
+
onMinimize: he,
|
|
963
|
+
onClose: Le,
|
|
964
|
+
onClearMicError: He
|
|
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 Me;
|
|
967
|
+
const V = b.length > 0 ? b[b.length - 1] : null, $ = ((u == null ? void 0 : u.length) ?? 0) > 1, te = E === "connecting" || E === "connected", W = E === "connected", J = E === "idle" || E === "disconnected" || E === "error", ne = A(null), fe = A(null);
|
|
968
|
+
I(() => {
|
|
969
|
+
const h = ne.current;
|
|
970
|
+
h && (h.innerHTML = "", z && (z.style.width = "100%", z.style.height = "100%", z.style.objectFit = "cover", z.style.transform = "scaleX(-1)", h.appendChild(z)));
|
|
971
|
+
}, [z]), I(() => {
|
|
972
|
+
const h = fe.current;
|
|
973
|
+
h && (h.innerHTML = "", X && (X.style.width = "100%", X.style.height = "100%", X.style.objectFit = "contain", h.appendChild(X)));
|
|
974
|
+
}, [X]);
|
|
975
|
+
const [j, F] = C(!1), [q, Q] = C(!1);
|
|
976
|
+
I(() => {
|
|
977
|
+
if (!j && !q && !S && !f) return;
|
|
918
978
|
const h = () => {
|
|
919
|
-
|
|
979
|
+
F(!1), Q(!1), S && x(), f && a();
|
|
920
980
|
};
|
|
921
981
|
return document.addEventListener("click", h), () => document.removeEventListener("click", h);
|
|
922
982
|
}, [
|
|
983
|
+
j,
|
|
923
984
|
q,
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
o
|
|
985
|
+
S,
|
|
986
|
+
f,
|
|
987
|
+
x,
|
|
988
|
+
a
|
|
929
989
|
]);
|
|
930
|
-
const [
|
|
990
|
+
const [pe, me] = C(""), we = y(
|
|
931
991
|
(h) => {
|
|
932
992
|
h.preventDefault();
|
|
933
|
-
const
|
|
934
|
-
|
|
993
|
+
const O = pe.trim();
|
|
994
|
+
O && (ue(O), me(""));
|
|
935
995
|
},
|
|
936
|
-
[
|
|
937
|
-
),
|
|
996
|
+
[pe, ue]
|
|
997
|
+
), Ae = d.productName || "Live Layer", ge = W && (V != null && V.text) ? V.text : l || "", _e = [
|
|
938
998
|
"ll-expanded",
|
|
939
999
|
n ? "ll-expanded--mobile" : "ll-expanded--desktop"
|
|
940
1000
|
].join(" ");
|
|
941
1001
|
return /* @__PURE__ */ _(
|
|
942
1002
|
"div",
|
|
943
1003
|
{
|
|
944
|
-
className:
|
|
945
|
-
"data-position":
|
|
946
|
-
"data-state":
|
|
1004
|
+
className: _e,
|
|
1005
|
+
"data-position": e,
|
|
1006
|
+
"data-state": W ? "connected" : te ? "connecting" : "idle",
|
|
947
1007
|
role: "dialog",
|
|
948
|
-
"aria-label": `${
|
|
1008
|
+
"aria-label": `${r} widget`,
|
|
949
1009
|
children: [
|
|
950
1010
|
/* @__PURE__ */ _("div", { className: "ll-expanded__bg", children: [
|
|
951
|
-
|
|
952
|
-
|
|
1011
|
+
i ? /* @__PURE__ */ t(
|
|
1012
|
+
kn,
|
|
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__ */ t("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ t("span", { className: "ll-expanded__bg-initial", children: ((Me = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Me.toUpperCase()) || "A" }) }),
|
|
1019
|
+
o && !W && /* @__PURE__ */ t(
|
|
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,24 +1028,24 @@ const St = ({
|
|
|
968
1028
|
}
|
|
969
1029
|
)
|
|
970
1030
|
] }),
|
|
971
|
-
/* @__PURE__ */
|
|
972
|
-
|
|
973
|
-
/* @__PURE__ */
|
|
974
|
-
/* @__PURE__ */
|
|
1031
|
+
/* @__PURE__ */ t("div", { ref: ae, className: "ll-expanded__video" }),
|
|
1032
|
+
E === "connecting" && /* @__PURE__ */ _("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
|
|
1033
|
+
/* @__PURE__ */ t("div", { className: "ll-expanded__spinner" }),
|
|
1034
|
+
/* @__PURE__ */ t("p", { className: "ll-expanded__overlay-text", children: g ? "Switching..." : "Connecting..." })
|
|
975
1035
|
] }),
|
|
976
|
-
|
|
1036
|
+
p && W && /* @__PURE__ */ _(
|
|
977
1037
|
"button",
|
|
978
1038
|
{
|
|
979
1039
|
type: "button",
|
|
980
1040
|
className: "ll-expanded__overlay ll-expanded__overlay--gesture",
|
|
981
|
-
onClick:
|
|
1041
|
+
onClick: de,
|
|
982
1042
|
children: [
|
|
983
|
-
/* @__PURE__ */
|
|
984
|
-
/* @__PURE__ */
|
|
1043
|
+
/* @__PURE__ */ t("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ t("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__ */ t("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
|
|
985
1045
|
]
|
|
986
1046
|
}
|
|
987
1047
|
),
|
|
988
|
-
|
|
1048
|
+
te ? /* @__PURE__ */ _("div", { className: "ll-expanded__topbar", children: [
|
|
989
1049
|
/* @__PURE__ */ _("div", { className: "ll-expanded__topbar-left", children: [
|
|
990
1050
|
/* @__PURE__ */ _("div", { className: "ll-expanded__pill-wrap", children: [
|
|
991
1051
|
/* @__PURE__ */ _(
|
|
@@ -994,32 +1054,32 @@ const St = ({
|
|
|
994
1054
|
type: "button",
|
|
995
1055
|
className: "ll-hpill",
|
|
996
1056
|
onClick: (h) => {
|
|
997
|
-
|
|
1057
|
+
$ && (h.stopPropagation(), a());
|
|
998
1058
|
},
|
|
999
|
-
"aria-haspopup":
|
|
1000
|
-
"aria-expanded":
|
|
1059
|
+
"aria-haspopup": $ ? "listbox" : void 0,
|
|
1060
|
+
"aria-expanded": $ ? f : void 0,
|
|
1001
1061
|
children: [
|
|
1002
|
-
/* @__PURE__ */
|
|
1003
|
-
|
|
1062
|
+
/* @__PURE__ */ t("span", { className: "ll-hpill__label", children: r }),
|
|
1063
|
+
$ && /* @__PURE__ */ t(Te, {})
|
|
1004
1064
|
]
|
|
1005
1065
|
}
|
|
1006
1066
|
),
|
|
1007
|
-
|
|
1067
|
+
$ && f && /* @__PURE__ */ t(
|
|
1008
1068
|
"div",
|
|
1009
1069
|
{
|
|
1010
1070
|
className: "ll-hmenu",
|
|
1011
1071
|
onClick: (h) => h.stopPropagation(),
|
|
1012
1072
|
role: "listbox",
|
|
1013
|
-
children:
|
|
1073
|
+
children: u == null ? void 0 : u.map((h) => /* @__PURE__ */ _(
|
|
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 === s ? "is-active" : ""}`,
|
|
1078
|
+
onClick: () => c(h.id),
|
|
1019
1079
|
role: "option",
|
|
1020
|
-
"aria-selected": h.id ===
|
|
1080
|
+
"aria-selected": h.id === s,
|
|
1021
1081
|
children: [
|
|
1022
|
-
h.avatarImageUrl && /* @__PURE__ */
|
|
1082
|
+
h.avatarImageUrl && /* @__PURE__ */ t(
|
|
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__ */ t("span", { className: "ll-hmenu__name", children: h.name }),
|
|
1091
|
+
h.role && /* @__PURE__ */ t("span", { className: "ll-hmenu__role", children: h.role })
|
|
1032
1092
|
]
|
|
1033
1093
|
},
|
|
1034
1094
|
h.id
|
|
@@ -1043,294 +1103,309 @@ const St = ({
|
|
|
1043
1103
|
type: "button",
|
|
1044
1104
|
className: "ll-hpill ll-hpill--compact",
|
|
1045
1105
|
onClick: (h) => {
|
|
1046
|
-
h.stopPropagation(),
|
|
1106
|
+
h.stopPropagation(), x();
|
|
1047
1107
|
},
|
|
1048
1108
|
"aria-haspopup": "listbox",
|
|
1049
|
-
"aria-expanded":
|
|
1109
|
+
"aria-expanded": S,
|
|
1050
1110
|
"aria-label": "Language: English",
|
|
1051
1111
|
title: "Language: English",
|
|
1052
1112
|
children: [
|
|
1053
|
-
/* @__PURE__ */
|
|
1054
|
-
/* @__PURE__ */
|
|
1113
|
+
/* @__PURE__ */ t("span", { className: "ll-hpill__label", children: "EN" }),
|
|
1114
|
+
/* @__PURE__ */ t(Te, {})
|
|
1055
1115
|
]
|
|
1056
1116
|
}
|
|
1057
1117
|
),
|
|
1058
|
-
|
|
1118
|
+
S && /* @__PURE__ */ t(
|
|
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__ */ t(
|
|
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__ */ t("span", { className: "ll-hmenu__name", children: "English" })
|
|
1072
1132
|
}
|
|
1073
1133
|
)
|
|
1074
1134
|
}
|
|
1075
1135
|
)
|
|
1076
1136
|
] }),
|
|
1077
|
-
/* @__PURE__ */
|
|
1137
|
+
/* @__PURE__ */ t(
|
|
1078
1138
|
"span",
|
|
1079
1139
|
{
|
|
1080
|
-
className: `ll-expanded__state ll-expanded__state--${
|
|
1081
|
-
children:
|
|
1140
|
+
className: `ll-expanded__state ll-expanded__state--${P}`,
|
|
1141
|
+
children: P
|
|
1082
1142
|
}
|
|
1083
1143
|
)
|
|
1084
1144
|
] }),
|
|
1085
1145
|
/* @__PURE__ */ _("div", { className: "ll-expanded__header-actions", children: [
|
|
1086
|
-
/* @__PURE__ */
|
|
1146
|
+
/* @__PURE__ */ t(
|
|
1087
1147
|
"button",
|
|
1088
1148
|
{
|
|
1089
1149
|
type: "button",
|
|
1090
1150
|
className: "ll-hbtn",
|
|
1091
|
-
onClick:
|
|
1151
|
+
onClick: he,
|
|
1092
1152
|
"aria-label": "Minimize widget",
|
|
1093
1153
|
title: "Minimize",
|
|
1094
|
-
children: /* @__PURE__ */
|
|
1154
|
+
children: /* @__PURE__ */ t(vt, {})
|
|
1095
1155
|
}
|
|
1096
1156
|
),
|
|
1097
|
-
/* @__PURE__ */
|
|
1157
|
+
/* @__PURE__ */ t(
|
|
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: Le,
|
|
1163
|
+
"aria-label": "End call",
|
|
1164
|
+
title: "End call",
|
|
1165
|
+
children: /* @__PURE__ */ t(gt, {})
|
|
1106
1166
|
}
|
|
1107
1167
|
)
|
|
1108
1168
|
] })
|
|
1109
1169
|
] }) : (
|
|
1110
1170
|
// Idle-state header with Live Layer product name + minimize/close
|
|
1111
1171
|
/* @__PURE__ */ _("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
|
|
1112
|
-
/* @__PURE__ */
|
|
1172
|
+
/* @__PURE__ */ t("span", { className: "ll-expanded__brand", children: Ae }),
|
|
1113
1173
|
/* @__PURE__ */ _("div", { className: "ll-expanded__header-actions", children: [
|
|
1114
|
-
/* @__PURE__ */
|
|
1174
|
+
/* @__PURE__ */ t(
|
|
1115
1175
|
"button",
|
|
1116
1176
|
{
|
|
1117
1177
|
type: "button",
|
|
1118
1178
|
className: "ll-hbtn ll-hbtn--ghost",
|
|
1119
|
-
onClick:
|
|
1179
|
+
onClick: he,
|
|
1120
1180
|
"aria-label": "Minimize widget",
|
|
1121
|
-
children: /* @__PURE__ */
|
|
1181
|
+
children: /* @__PURE__ */ t(vt, {})
|
|
1122
1182
|
}
|
|
1123
1183
|
),
|
|
1124
|
-
/* @__PURE__ */
|
|
1184
|
+
/* @__PURE__ */ t(
|
|
1125
1185
|
"button",
|
|
1126
1186
|
{
|
|
1127
1187
|
type: "button",
|
|
1128
1188
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1129
|
-
onClick:
|
|
1189
|
+
onClick: Le,
|
|
1130
1190
|
"aria-label": "Close widget",
|
|
1131
|
-
children: /* @__PURE__ */
|
|
1191
|
+
children: /* @__PURE__ */ t(gt, {})
|
|
1132
1192
|
}
|
|
1133
1193
|
)
|
|
1134
1194
|
] })
|
|
1135
1195
|
] })
|
|
1136
1196
|
),
|
|
1137
|
-
|
|
1138
|
-
"
|
|
1139
|
-
{
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1197
|
+
J && /* @__PURE__ */ (() => {
|
|
1198
|
+
const h = T ? "Restart paused session" : E === "disconnected" ? "Reconnect to agent" : "Start video call", O = T ? "Pick up where you left off" : null;
|
|
1199
|
+
return /* @__PURE__ */ _(_t, { children: [
|
|
1200
|
+
E === "idle" && !T && !N && /* @__PURE__ */ _(
|
|
1201
|
+
"button",
|
|
1202
|
+
{
|
|
1203
|
+
type: "button",
|
|
1204
|
+
className: "ll-expanded__play",
|
|
1205
|
+
onClick: ee,
|
|
1206
|
+
"aria-label": h,
|
|
1207
|
+
children: [
|
|
1208
|
+
/* @__PURE__ */ t("div", { className: "ll-expanded__play-circle", children: /* @__PURE__ */ t("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ t("polygon", { points: "6 3 20 12 6 21 6 3" }) }) }),
|
|
1209
|
+
/* @__PURE__ */ t("span", { className: "ll-expanded__play-label", children: h })
|
|
1210
|
+
]
|
|
1211
|
+
}
|
|
1212
|
+
),
|
|
1213
|
+
/* @__PURE__ */ _("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
|
|
1214
|
+
l && /* @__PURE__ */ t("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ t("p", { className: "ll-expanded__transcript-text", children: l }) }),
|
|
1215
|
+
O && /* @__PURE__ */ t("p", { className: "ll-expanded__cta-sublabel", children: O }),
|
|
1216
|
+
/* @__PURE__ */ t(
|
|
1217
|
+
"button",
|
|
1218
|
+
{
|
|
1219
|
+
type: "button",
|
|
1220
|
+
className: "ll-expanded__cta",
|
|
1221
|
+
onClick: ee,
|
|
1222
|
+
"aria-label": h,
|
|
1223
|
+
children: h
|
|
1224
|
+
}
|
|
1225
|
+
)
|
|
1226
|
+
] })
|
|
1227
|
+
] });
|
|
1228
|
+
})(),
|
|
1151
1229
|
/* @__PURE__ */ _(
|
|
1152
1230
|
"div",
|
|
1153
1231
|
{
|
|
1154
|
-
className: `ll-expanded__pip ${
|
|
1232
|
+
className: `ll-expanded__pip ${te && (w || K) ? "is-visible" : ""}`,
|
|
1155
1233
|
children: [
|
|
1156
|
-
/* @__PURE__ */
|
|
1234
|
+
/* @__PURE__ */ t(
|
|
1157
1235
|
"div",
|
|
1158
1236
|
{
|
|
1159
|
-
ref:
|
|
1160
|
-
className:
|
|
1237
|
+
ref: fe,
|
|
1238
|
+
className: K ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1161
1239
|
}
|
|
1162
1240
|
),
|
|
1163
|
-
/* @__PURE__ */
|
|
1241
|
+
/* @__PURE__ */ t(
|
|
1164
1242
|
"div",
|
|
1165
1243
|
{
|
|
1166
|
-
ref:
|
|
1167
|
-
className:
|
|
1244
|
+
ref: ne,
|
|
1245
|
+
className: !K && w ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1168
1246
|
}
|
|
1169
1247
|
)
|
|
1170
1248
|
]
|
|
1171
1249
|
}
|
|
1172
1250
|
),
|
|
1173
|
-
|
|
1174
|
-
|
|
1251
|
+
te ? /* @__PURE__ */ _("div", { className: "ll-expanded__bottom", children: [
|
|
1252
|
+
ge && /* @__PURE__ */ t("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ t("p", { className: "ll-expanded__transcript-text", children: ge }) }),
|
|
1175
1253
|
/* @__PURE__ */ _("div", { className: "ll-toolbar", onClick: (h) => h.stopPropagation(), children: [
|
|
1176
|
-
|
|
1254
|
+
oe && /* @__PURE__ */ t(
|
|
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 ${K ? "is-on" : ""}`,
|
|
1259
|
+
onClick: Oe,
|
|
1260
|
+
"aria-label": K ? "Stop sharing screen" : "Share screen",
|
|
1261
|
+
title: K ? "Stop sharing" : "Share screen",
|
|
1262
|
+
children: /* @__PURE__ */ t(En, {})
|
|
1185
1263
|
}
|
|
1186
1264
|
),
|
|
1187
|
-
|
|
1188
|
-
/* @__PURE__ */
|
|
1265
|
+
Ne && /* @__PURE__ */ _("div", { className: "ll-tool-split", children: [
|
|
1266
|
+
/* @__PURE__ */ t(
|
|
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__ */ t(Nn, {})
|
|
1197
1275
|
}
|
|
1198
1276
|
),
|
|
1199
|
-
/* @__PURE__ */
|
|
1277
|
+
/* @__PURE__ */ t(
|
|
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(), Q((O) => !O), F(!1);
|
|
1206
1284
|
},
|
|
1207
1285
|
"aria-label": "Camera devices",
|
|
1208
1286
|
"aria-haspopup": "listbox",
|
|
1209
|
-
"aria-expanded":
|
|
1210
|
-
children: /* @__PURE__ */
|
|
1287
|
+
"aria-expanded": q,
|
|
1288
|
+
children: /* @__PURE__ */ t(Te, {})
|
|
1211
1289
|
}
|
|
1212
1290
|
),
|
|
1213
|
-
|
|
1214
|
-
|
|
1291
|
+
q && Ee.length > 0 && /* @__PURE__ */ t(
|
|
1292
|
+
yt,
|
|
1215
1293
|
{
|
|
1216
1294
|
label: "Camera",
|
|
1217
|
-
devices:
|
|
1218
|
-
activeId:
|
|
1295
|
+
devices: Ee,
|
|
1296
|
+
activeId: $e,
|
|
1219
1297
|
onPick: (h) => {
|
|
1220
|
-
|
|
1298
|
+
Q(!1), Ue(h);
|
|
1221
1299
|
}
|
|
1222
1300
|
}
|
|
1223
1301
|
)
|
|
1224
1302
|
] }),
|
|
1225
1303
|
/* @__PURE__ */ _("div", { className: "ll-tool-split", children: [
|
|
1226
|
-
/* @__PURE__ */
|
|
1304
|
+
/* @__PURE__ */ t(
|
|
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 ${R ? "is-muted" : ""}`,
|
|
1309
|
+
onClick: D,
|
|
1310
|
+
"aria-label": R ? "Unmute microphone" : "Mute microphone",
|
|
1311
|
+
title: R ? "Unmute" : "Mute",
|
|
1312
|
+
children: /* @__PURE__ */ t(Sn, { muted: R })
|
|
1235
1313
|
}
|
|
1236
1314
|
),
|
|
1237
|
-
/* @__PURE__ */
|
|
1315
|
+
/* @__PURE__ */ t(
|
|
1238
1316
|
"button",
|
|
1239
1317
|
{
|
|
1240
1318
|
type: "button",
|
|
1241
|
-
className: `ll-tool ll-tool--right ${
|
|
1319
|
+
className: `ll-tool ll-tool--right ${R ? "is-muted" : ""}`,
|
|
1242
1320
|
onClick: (h) => {
|
|
1243
|
-
h.stopPropagation(),
|
|
1321
|
+
h.stopPropagation(), F((O) => !O), Q(!1);
|
|
1244
1322
|
},
|
|
1245
1323
|
"aria-label": "Microphone devices",
|
|
1246
1324
|
"aria-haspopup": "listbox",
|
|
1247
|
-
"aria-expanded":
|
|
1248
|
-
children: /* @__PURE__ */
|
|
1325
|
+
"aria-expanded": j,
|
|
1326
|
+
children: /* @__PURE__ */ t(Te, {})
|
|
1249
1327
|
}
|
|
1250
1328
|
),
|
|
1251
|
-
|
|
1252
|
-
|
|
1329
|
+
j && L.length > 0 && /* @__PURE__ */ t(
|
|
1330
|
+
yt,
|
|
1253
1331
|
{
|
|
1254
1332
|
label: "Microphone",
|
|
1255
|
-
devices:
|
|
1333
|
+
devices: L,
|
|
1256
1334
|
activeId: "",
|
|
1257
|
-
onPick: () =>
|
|
1335
|
+
onPick: () => F(!1)
|
|
1258
1336
|
}
|
|
1259
1337
|
)
|
|
1260
1338
|
] }),
|
|
1261
|
-
/* @__PURE__ */
|
|
1339
|
+
/* @__PURE__ */ t(
|
|
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 ${Z ? "is-muted" : ""}`,
|
|
1344
|
+
onClick: Se,
|
|
1345
|
+
"aria-label": Z ? "Unmute speaker" : "Mute speaker",
|
|
1346
|
+
title: Z ? "Unmute speaker" : "Mute speaker",
|
|
1347
|
+
children: /* @__PURE__ */ t(Ln, { muted: Z })
|
|
1270
1348
|
}
|
|
1271
1349
|
)
|
|
1272
1350
|
] }),
|
|
1273
|
-
|
|
1274
|
-
/* @__PURE__ */
|
|
1351
|
+
le && /* @__PURE__ */ _("form", { className: "ll-message-input", onSubmit: we, children: [
|
|
1352
|
+
/* @__PURE__ */ t(
|
|
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: pe,
|
|
1359
|
+
onChange: (h) => me(h.target.value),
|
|
1282
1360
|
"aria-label": "Message the agent"
|
|
1283
1361
|
}
|
|
1284
1362
|
),
|
|
1285
|
-
|
|
1363
|
+
pe.trim() && /* @__PURE__ */ t(
|
|
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__ */ t(An, {})
|
|
1292
1370
|
}
|
|
1293
1371
|
)
|
|
1294
1372
|
] }),
|
|
1295
|
-
/* @__PURE__ */
|
|
1373
|
+
/* @__PURE__ */ t(
|
|
1296
1374
|
"button",
|
|
1297
1375
|
{
|
|
1298
1376
|
type: "button",
|
|
1299
1377
|
className: "ll-expanded__end",
|
|
1300
|
-
onClick:
|
|
1378
|
+
onClick: ce,
|
|
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 (
|
|
1384
|
+
if (k && E !== "error")
|
|
1310
1385
|
return /* @__PURE__ */ _("div", { className: "ll-expanded__banner", role: "alert", children: [
|
|
1311
|
-
/* @__PURE__ */
|
|
1312
|
-
/* @__PURE__ */
|
|
1386
|
+
/* @__PURE__ */ t("span", { children: k }),
|
|
1387
|
+
/* @__PURE__ */ t(
|
|
1313
1388
|
"button",
|
|
1314
1389
|
{
|
|
1315
1390
|
type: "button",
|
|
1316
1391
|
className: "ll-expanded__banner-x",
|
|
1317
|
-
onClick:
|
|
1392
|
+
onClick: He,
|
|
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 (!N || E !== "error") return null;
|
|
1399
|
+
let h = "Failed to connect", O = "Try again";
|
|
1400
|
+
return N === "MIC_PERMISSION_DENIED" ? h = "Microphone blocked. Allow access to talk." : N === "MIC_NOT_FOUND" ? h = "No microphone found. Plug one in + retry." : N === "MIC_UNAVAILABLE" ? h = "Mic unavailable. Check other apps using it." : N === "AGENT_TIMEOUT" ? h = "Agent didn't pick up. Try again." : N === "CONNECT_FAILED" ? h = "Connection failed. Check your network." : N.length < 80 && (h = N), /* @__PURE__ */ _("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
|
|
1401
|
+
/* @__PURE__ */ t("span", { children: h }),
|
|
1402
|
+
/* @__PURE__ */ t(
|
|
1328
1403
|
"button",
|
|
1329
1404
|
{
|
|
1330
1405
|
type: "button",
|
|
1331
1406
|
className: "ll-expanded__banner-retry",
|
|
1332
|
-
onClick:
|
|
1333
|
-
children:
|
|
1407
|
+
onClick: se,
|
|
1408
|
+
children: O
|
|
1334
1409
|
}
|
|
1335
1410
|
)
|
|
1336
1411
|
] });
|
|
@@ -1339,83 +1414,218 @@ const St = ({
|
|
|
1339
1414
|
}
|
|
1340
1415
|
);
|
|
1341
1416
|
};
|
|
1342
|
-
function
|
|
1343
|
-
return /* @__PURE__ */
|
|
1417
|
+
function Te() {
|
|
1418
|
+
return /* @__PURE__ */ t("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ t("polyline", { points: "6 9 12 15 18 9" }) });
|
|
1344
1419
|
}
|
|
1345
|
-
function
|
|
1420
|
+
function gt() {
|
|
1346
1421
|
return /* @__PURE__ */ _("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
|
|
1347
|
-
/* @__PURE__ */
|
|
1348
|
-
/* @__PURE__ */
|
|
1422
|
+
/* @__PURE__ */ t("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1423
|
+
/* @__PURE__ */ t("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1349
1424
|
] });
|
|
1350
1425
|
}
|
|
1351
|
-
function
|
|
1352
|
-
return /* @__PURE__ */
|
|
1426
|
+
function vt() {
|
|
1427
|
+
return /* @__PURE__ */ t("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ t("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
|
|
1353
1428
|
}
|
|
1354
|
-
function
|
|
1429
|
+
function En() {
|
|
1355
1430
|
return /* @__PURE__ */ _("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: [
|
|
1356
|
-
/* @__PURE__ */
|
|
1357
|
-
/* @__PURE__ */
|
|
1358
|
-
/* @__PURE__ */
|
|
1431
|
+
/* @__PURE__ */ t("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
|
|
1432
|
+
/* @__PURE__ */ t("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
|
|
1433
|
+
/* @__PURE__ */ t("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
|
|
1359
1434
|
] });
|
|
1360
1435
|
}
|
|
1361
|
-
function
|
|
1436
|
+
function Nn() {
|
|
1362
1437
|
return /* @__PURE__ */ _("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: [
|
|
1363
|
-
/* @__PURE__ */
|
|
1364
|
-
/* @__PURE__ */
|
|
1438
|
+
/* @__PURE__ */ t("path", { d: "M23 7l-7 5 7 5V7z" }),
|
|
1439
|
+
/* @__PURE__ */ t("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
|
|
1365
1440
|
] });
|
|
1366
1441
|
}
|
|
1367
|
-
function
|
|
1442
|
+
function Sn({ muted: e }) {
|
|
1368
1443
|
return /* @__PURE__ */ _("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: [
|
|
1369
|
-
/* @__PURE__ */
|
|
1370
|
-
/* @__PURE__ */
|
|
1371
|
-
/* @__PURE__ */
|
|
1372
|
-
|
|
1444
|
+
/* @__PURE__ */ t("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
|
|
1445
|
+
/* @__PURE__ */ t("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
|
|
1446
|
+
/* @__PURE__ */ t("line", { x1: "12", y1: "19", x2: "12", y2: "23" }),
|
|
1447
|
+
e && /* @__PURE__ */ t("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
1373
1448
|
] });
|
|
1374
1449
|
}
|
|
1375
|
-
function
|
|
1450
|
+
function Ln({ muted: e }) {
|
|
1376
1451
|
return /* @__PURE__ */ _("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: [
|
|
1377
|
-
/* @__PURE__ */
|
|
1378
|
-
|
|
1379
|
-
/* @__PURE__ */
|
|
1380
|
-
/* @__PURE__ */
|
|
1452
|
+
/* @__PURE__ */ t("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
1453
|
+
e ? /* @__PURE__ */ t("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ _(_t, { children: [
|
|
1454
|
+
/* @__PURE__ */ t("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
|
|
1455
|
+
/* @__PURE__ */ t("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
|
|
1381
1456
|
] })
|
|
1382
1457
|
] });
|
|
1383
1458
|
}
|
|
1384
|
-
function
|
|
1459
|
+
function An() {
|
|
1385
1460
|
return /* @__PURE__ */ _("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1386
|
-
/* @__PURE__ */
|
|
1387
|
-
/* @__PURE__ */
|
|
1461
|
+
/* @__PURE__ */ t("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
|
|
1462
|
+
/* @__PURE__ */ t("polyline", { points: "12 5 19 12 12 19" })
|
|
1388
1463
|
] });
|
|
1389
1464
|
}
|
|
1390
|
-
const
|
|
1465
|
+
const yt = ({ label: e, devices: n, activeId: r, onPick: i }) => /* @__PURE__ */ _(
|
|
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
|
-
n.map((
|
|
1399
|
-
const
|
|
1472
|
+
/* @__PURE__ */ t("p", { className: "ll-device-menu__label", children: e }),
|
|
1473
|
+
n.map((o, l) => {
|
|
1474
|
+
const d = r === o.deviceId;
|
|
1400
1475
|
return /* @__PURE__ */ _(
|
|
1401
1476
|
"button",
|
|
1402
1477
|
{
|
|
1403
1478
|
type: "button",
|
|
1404
|
-
className: `ll-device-menu__item ${
|
|
1405
|
-
onClick: () =>
|
|
1479
|
+
className: `ll-device-menu__item ${d ? "is-active" : ""}`,
|
|
1480
|
+
onClick: () => i(o.deviceId),
|
|
1406
1481
|
role: "option",
|
|
1407
|
-
"aria-selected":
|
|
1482
|
+
"aria-selected": d,
|
|
1408
1483
|
children: [
|
|
1409
|
-
|
|
1410
|
-
/* @__PURE__ */
|
|
1484
|
+
d && /* @__PURE__ */ t("span", { className: "ll-device-menu__dot", children: "●" }),
|
|
1485
|
+
/* @__PURE__ */ t("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
|
+
), Pe = 4096, Mn = 20, Rn = 20, In = 10, bt = 500, Tn = [
|
|
1494
|
+
'[data-ll-private="true"]',
|
|
1495
|
+
".ll-widget",
|
|
1496
|
+
"script",
|
|
1497
|
+
"style",
|
|
1498
|
+
"noscript",
|
|
1499
|
+
"iframe"
|
|
1500
|
+
];
|
|
1501
|
+
function ke(e) {
|
|
1502
|
+
if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
|
|
1503
|
+
let n = e;
|
|
1504
|
+
for (; n; ) {
|
|
1505
|
+
for (const r of Tn)
|
|
1506
|
+
if (n.matches(r)) return !0;
|
|
1507
|
+
n = n.parentElement;
|
|
1508
|
+
}
|
|
1509
|
+
return !1;
|
|
1510
|
+
}
|
|
1511
|
+
function Ce(e) {
|
|
1512
|
+
if (typeof window > "u") return !0;
|
|
1513
|
+
const n = e.getBoundingClientRect();
|
|
1514
|
+
if (n.width <= 0 || n.height <= 0) return !1;
|
|
1515
|
+
const r = window.innerHeight || document.documentElement.clientHeight, i = window.innerWidth || document.documentElement.clientWidth;
|
|
1516
|
+
return n.bottom > 0 && n.right > 0 && n.top < r && n.left < i;
|
|
1517
|
+
}
|
|
1518
|
+
function Pn(e) {
|
|
1519
|
+
if (e.type === "password") return !0;
|
|
1520
|
+
const n = (e.getAttribute("autocomplete") || "").toLowerCase();
|
|
1521
|
+
return !!(n === "off" || n.startsWith("cc-"));
|
|
1522
|
+
}
|
|
1523
|
+
function Dn(e) {
|
|
1524
|
+
const n = e.getAttribute("id");
|
|
1525
|
+
if (n) {
|
|
1526
|
+
const l = document.querySelector(`label[for="${CSS.escape(n)}"]`);
|
|
1527
|
+
if (l != null && l.textContent) return l.textContent.trim();
|
|
1528
|
+
}
|
|
1529
|
+
const r = e.getAttribute("aria-label");
|
|
1530
|
+
if (r) return r.trim();
|
|
1531
|
+
const i = e.getAttribute("placeholder");
|
|
1532
|
+
if (i) return i.trim();
|
|
1533
|
+
const o = e.closest("label");
|
|
1534
|
+
return o != null && o.textContent ? o.textContent.trim() : "";
|
|
1535
|
+
}
|
|
1536
|
+
function ve(e, n) {
|
|
1537
|
+
return e.length <= n ? e : e.slice(0, n - 1) + "…";
|
|
1538
|
+
}
|
|
1539
|
+
function ye(e) {
|
|
1540
|
+
return e.length;
|
|
1541
|
+
}
|
|
1542
|
+
function zn(e, n = {}) {
|
|
1543
|
+
const r = n.doc ?? (typeof document < "u" ? document : null);
|
|
1544
|
+
if (!r)
|
|
1545
|
+
return {
|
|
1546
|
+
url: "",
|
|
1547
|
+
title: "",
|
|
1548
|
+
pathname: "/",
|
|
1549
|
+
regions: [],
|
|
1550
|
+
visibleText: "",
|
|
1551
|
+
visibleLinks: [],
|
|
1552
|
+
visibleFields: [],
|
|
1553
|
+
extras: e
|
|
1554
|
+
};
|
|
1555
|
+
const i = typeof window < "u" && window.location.href || "", o = typeof window < "u" && window.location.pathname || "/", l = r.title || "", d = Array.from(
|
|
1556
|
+
r.querySelectorAll("[data-ll-region]")
|
|
1557
|
+
), u = [];
|
|
1558
|
+
for (const p of d) {
|
|
1559
|
+
if (u.length >= In) break;
|
|
1560
|
+
if (ke(p) || !Ce(p)) continue;
|
|
1561
|
+
const N = p.getAttribute("data-ll-region") ?? "", R = p.getAttribute("data-ll-intent") ?? void 0, k = ve(
|
|
1562
|
+
(p.innerText || p.textContent || "").trim(),
|
|
1563
|
+
bt * 2
|
|
1564
|
+
);
|
|
1565
|
+
!N || !k || u.push({ id: N, intent: R, text: k });
|
|
1566
|
+
}
|
|
1567
|
+
const s = [], g = ["H1", "H2", "H3", "H4", "H5", "H6"], f = Array.from(
|
|
1568
|
+
r.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
|
1569
|
+
);
|
|
1570
|
+
for (const p of f) {
|
|
1571
|
+
if (ke(p) || !Ce(p)) continue;
|
|
1572
|
+
const N = (p.textContent || "").trim();
|
|
1573
|
+
N && s.push(`${p.tagName}: ${ve(N, 200)}`);
|
|
1574
|
+
}
|
|
1575
|
+
const a = Array.from(r.querySelectorAll("p, li"));
|
|
1576
|
+
for (const p of a) {
|
|
1577
|
+
if (ke(p) || !Ce(p) || g.includes(p.tagName)) continue;
|
|
1578
|
+
const N = (p.textContent || "").trim();
|
|
1579
|
+
N.length > 10 && s.push(ve(N, bt));
|
|
1580
|
+
}
|
|
1581
|
+
const c = s.join(`
|
|
1582
|
+
`), S = [], x = Array.from(r.querySelectorAll("a[href]"));
|
|
1583
|
+
for (const p of x) {
|
|
1584
|
+
if (S.length >= Mn) break;
|
|
1585
|
+
if (ke(p) || !Ce(p)) continue;
|
|
1586
|
+
const N = p.getAttribute("href") || "", R = (p.textContent || "").trim();
|
|
1587
|
+
!N || !R || S.push({ href: N, text: ve(R, 100) });
|
|
1588
|
+
}
|
|
1589
|
+
const E = [], P = Array.from(
|
|
1590
|
+
r.querySelectorAll(
|
|
1591
|
+
"input, textarea, select"
|
|
1592
|
+
)
|
|
1593
|
+
);
|
|
1594
|
+
for (const p of P) {
|
|
1595
|
+
if (E.length >= Rn) break;
|
|
1596
|
+
if (ke(p) || p instanceof HTMLInputElement && Pn(p) || !Ce(p)) continue;
|
|
1597
|
+
const N = Dn(p), R = p instanceof HTMLInputElement ? p.type : p.tagName.toLowerCase();
|
|
1598
|
+
N && E.push({ label: ve(N, 100), type: R });
|
|
1599
|
+
}
|
|
1600
|
+
const b = {
|
|
1601
|
+
url: i,
|
|
1602
|
+
title: l,
|
|
1603
|
+
pathname: o,
|
|
1604
|
+
regions: u,
|
|
1605
|
+
visibleText: c,
|
|
1606
|
+
visibleLinks: S,
|
|
1607
|
+
visibleFields: E,
|
|
1608
|
+
extras: e
|
|
1609
|
+
};
|
|
1610
|
+
let T = ye(JSON.stringify(b.regions)) + ye(b.visibleText) + ye(JSON.stringify(b.visibleLinks)) + ye(JSON.stringify(b.visibleFields));
|
|
1611
|
+
for (; T > Pe && b.visibleFields.length > 0; )
|
|
1612
|
+
b.visibleFields.pop(), T = ye(JSON.stringify(b.visibleFields));
|
|
1613
|
+
for (; T > Pe && b.visibleLinks.length > 0; )
|
|
1614
|
+
b.visibleLinks.pop(), T -= 80;
|
|
1615
|
+
return ye(b.visibleText) > Pe && (b.visibleText = ve(b.visibleText, Pe - 100)), b;
|
|
1616
|
+
}
|
|
1617
|
+
let be = null;
|
|
1618
|
+
function wt(e, n = {}) {
|
|
1619
|
+
const r = Date.now(), o = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
|
|
1620
|
+
if (be && be.key === o && r - be.at < 1e3)
|
|
1621
|
+
return be.ctx;
|
|
1622
|
+
const l = zn(e, n);
|
|
1623
|
+
return be = { key: o, at: r, ctx: l }, l;
|
|
1624
|
+
}
|
|
1625
|
+
function $n() {
|
|
1626
|
+
be = null;
|
|
1627
|
+
}
|
|
1628
|
+
const Bn = /* @__PURE__ */ new Set([
|
|
1419
1629
|
"agent_state",
|
|
1420
1630
|
"avatar_stream_ready",
|
|
1421
1631
|
"avatar_active",
|
|
@@ -1423,89 +1633,235 @@ const Oe = ({ label: t, devices: n, activeId: i, onPick: l }) => /* @__PURE__ */
|
|
|
1423
1633
|
"bot_ready",
|
|
1424
1634
|
"agent_error",
|
|
1425
1635
|
"idle_warning",
|
|
1426
|
-
"idle_timeout"
|
|
1636
|
+
"idle_timeout",
|
|
1637
|
+
// 0.3.0 — page-aware commands. Handled internally by the widget.
|
|
1638
|
+
// Consumers who want observability subscribe via onAgentEvent (which
|
|
1639
|
+
// fires for every message including these).
|
|
1640
|
+
"navigate",
|
|
1641
|
+
"scroll_to",
|
|
1642
|
+
"request_page_context"
|
|
1427
1643
|
]);
|
|
1428
|
-
function
|
|
1429
|
-
var
|
|
1644
|
+
function Un(e) {
|
|
1645
|
+
var tt, nt, rt, it, ot, lt;
|
|
1430
1646
|
const {
|
|
1431
1647
|
agentId: n,
|
|
1432
|
-
apiKey:
|
|
1433
|
-
baseUrl:
|
|
1434
|
-
sessionEndpoint:
|
|
1435
|
-
sessionBody:
|
|
1436
|
-
autoConnect:
|
|
1437
|
-
displayMode:
|
|
1438
|
-
defaultDisplayMode:
|
|
1439
|
-
onDisplayModeChange:
|
|
1440
|
-
position:
|
|
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
|
-
|
|
1648
|
+
apiKey: r,
|
|
1649
|
+
baseUrl: i = "https://app.livelayer.studio",
|
|
1650
|
+
sessionEndpoint: o,
|
|
1651
|
+
sessionBody: l,
|
|
1652
|
+
autoConnect: d = !1,
|
|
1653
|
+
displayMode: u,
|
|
1654
|
+
defaultDisplayMode: s = "expanded",
|
|
1655
|
+
onDisplayModeChange: g,
|
|
1656
|
+
position: f = "bottom-right",
|
|
1657
|
+
mobileBreakpoint: a = 640,
|
|
1658
|
+
persistKey: c = "ll-widget",
|
|
1659
|
+
disablePersistence: S = !1,
|
|
1660
|
+
teamMembers: x,
|
|
1661
|
+
currentTeamMemberId: E,
|
|
1662
|
+
onTeamMemberChange: P,
|
|
1663
|
+
idleLoopUrl: b,
|
|
1664
|
+
greeting: T,
|
|
1665
|
+
avatarImageUrl: p,
|
|
1666
|
+
agentName: N,
|
|
1667
|
+
branding: R = {},
|
|
1668
|
+
allowCamera: k = !0,
|
|
1669
|
+
allowScreenShare: L = !0,
|
|
1670
|
+
allowTyping: w = !0,
|
|
1671
|
+
showOn: z,
|
|
1672
|
+
hideOn: Ee,
|
|
1673
|
+
pathname: $e,
|
|
1674
|
+
onNavigate: K,
|
|
1675
|
+
onScrollToSelector: X,
|
|
1676
|
+
getPageContext: Z,
|
|
1677
|
+
pageContextExtras: Ne,
|
|
1678
|
+
onConnect: oe,
|
|
1679
|
+
onDisconnect: le,
|
|
1680
|
+
onTranscript: ae,
|
|
1681
|
+
onAgentState: ee,
|
|
1682
|
+
onConnectionStateChange: ce,
|
|
1683
|
+
onAgentEvent: se,
|
|
1684
|
+
onAgentCommand: de,
|
|
1685
|
+
controlledSession: D,
|
|
1686
|
+
className: Be,
|
|
1687
|
+
style: Ue,
|
|
1688
|
+
zIndex: Oe = 2147483647
|
|
1689
|
+
} = e, Se = ln($e), ue = fn(Se, z, Ee);
|
|
1690
|
+
I(() => {
|
|
1691
|
+
$n();
|
|
1692
|
+
}, [Se]);
|
|
1693
|
+
const he = E !== void 0, [Le, He] = C(() => {
|
|
1467
1694
|
var v;
|
|
1468
|
-
return
|
|
1469
|
-
}),
|
|
1470
|
-
() => (
|
|
1471
|
-
[
|
|
1472
|
-
),
|
|
1473
|
-
value:
|
|
1474
|
-
defaultValue:
|
|
1475
|
-
onChange:
|
|
1476
|
-
persistKey:
|
|
1477
|
-
disablePersistence:
|
|
1478
|
-
}),
|
|
1695
|
+
return E ?? ((v = x == null ? void 0 : x[0]) == null ? void 0 : v.id);
|
|
1696
|
+
}), V = he ? E : Le, $ = De(
|
|
1697
|
+
() => (x == null ? void 0 : x.find((v) => v.id === V)) ?? null,
|
|
1698
|
+
[x, V]
|
|
1699
|
+
), te = ($ == null ? void 0 : $.agentId) ?? n, [W, J] = tn({
|
|
1700
|
+
value: u,
|
|
1701
|
+
defaultValue: s,
|
|
1702
|
+
onChange: g,
|
|
1703
|
+
persistKey: c,
|
|
1704
|
+
disablePersistence: S
|
|
1705
|
+
}), ne = rn(a), fe = Ft(), j = Vt(), F = qt(), q = Gt(), Q = Yt(), [pe, me] = C(!1), [we, Ae] = C(!1), [ge, _e] = C(!1), [Me, h] = C(!1), [O, Ye] = C(!1), je = A(K), Fe = A(X), Ke = A(Z), Xe = A(Ne), Re = A(null);
|
|
1706
|
+
je.current = K, Fe.current = X, Ke.current = Z, Xe.current = Ne;
|
|
1707
|
+
const Ve = y(
|
|
1479
1708
|
(v) => {
|
|
1709
|
+
var G;
|
|
1480
1710
|
const M = v;
|
|
1481
|
-
!M.type || typeof M.type != "string"
|
|
1711
|
+
if (!(!M.type || typeof M.type != "string")) {
|
|
1712
|
+
if (se == null || se({ eventName: M.type, data: v }), M.type === "navigate") {
|
|
1713
|
+
const H = typeof M.href == "string" ? M.href : null;
|
|
1714
|
+
if (!H) {
|
|
1715
|
+
console.warn(
|
|
1716
|
+
`[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
|
|
1717
|
+
);
|
|
1718
|
+
return;
|
|
1719
|
+
}
|
|
1720
|
+
if (je.current) {
|
|
1721
|
+
try {
|
|
1722
|
+
je.current(H);
|
|
1723
|
+
} catch (U) {
|
|
1724
|
+
console.warn(
|
|
1725
|
+
`[LiveLayer] onNavigate threw for "${H}". Falling back. Error:`,
|
|
1726
|
+
U
|
|
1727
|
+
);
|
|
1728
|
+
}
|
|
1729
|
+
return;
|
|
1730
|
+
}
|
|
1731
|
+
if (typeof document < "u") {
|
|
1732
|
+
const U = document.querySelector(
|
|
1733
|
+
`a[href="${H.replace(/"/g, '\\"')}"]`
|
|
1734
|
+
);
|
|
1735
|
+
if (U) {
|
|
1736
|
+
U.click();
|
|
1737
|
+
return;
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
if (typeof window < "u" && typeof history < "u")
|
|
1741
|
+
try {
|
|
1742
|
+
history.pushState({}, "", H), window.dispatchEvent(new PopStateEvent("popstate"));
|
|
1743
|
+
} catch (U) {
|
|
1744
|
+
console.warn(
|
|
1745
|
+
`[LiveLayer] history.pushState fallback failed for "${H}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
|
|
1746
|
+
U
|
|
1747
|
+
);
|
|
1748
|
+
}
|
|
1749
|
+
return;
|
|
1750
|
+
}
|
|
1751
|
+
if (M.type === "scroll_to") {
|
|
1752
|
+
const H = typeof M.selector == "string" ? M.selector : null;
|
|
1753
|
+
if (!H) return;
|
|
1754
|
+
const U = M.behavior === "instant" ? "instant" : "smooth";
|
|
1755
|
+
if (Fe.current) {
|
|
1756
|
+
try {
|
|
1757
|
+
Fe.current(
|
|
1758
|
+
H,
|
|
1759
|
+
U
|
|
1760
|
+
);
|
|
1761
|
+
} catch (Y) {
|
|
1762
|
+
console.warn("[LiveLayer] onScrollToSelector threw.", Y);
|
|
1763
|
+
}
|
|
1764
|
+
return;
|
|
1765
|
+
}
|
|
1766
|
+
if (typeof document < "u") {
|
|
1767
|
+
let Y = null;
|
|
1768
|
+
try {
|
|
1769
|
+
Y = document.querySelector(H);
|
|
1770
|
+
} catch {
|
|
1771
|
+
console.warn(
|
|
1772
|
+
`[LiveLayer] scroll_to: invalid selector "${H}".`
|
|
1773
|
+
);
|
|
1774
|
+
return;
|
|
1775
|
+
}
|
|
1776
|
+
if (!Y) {
|
|
1777
|
+
console.warn(
|
|
1778
|
+
`[LiveLayer] scroll_to: no element matched "${H}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
|
|
1779
|
+
);
|
|
1780
|
+
return;
|
|
1781
|
+
}
|
|
1782
|
+
Y.scrollIntoView({
|
|
1783
|
+
behavior: U,
|
|
1784
|
+
block: "start"
|
|
1785
|
+
});
|
|
1786
|
+
}
|
|
1787
|
+
return;
|
|
1788
|
+
}
|
|
1789
|
+
if (M.type === "request_page_context") {
|
|
1790
|
+
const H = (G = Re.current) == null ? void 0 : G.call(Re), U = (re) => {
|
|
1791
|
+
const ie = H, Ie = ie == null ? void 0 : ie.localParticipant;
|
|
1792
|
+
if (Ie != null && Ie.publishData)
|
|
1793
|
+
try {
|
|
1794
|
+
const Ge = new TextEncoder().encode(JSON.stringify(re));
|
|
1795
|
+
Ie.publishData(Ge, { reliable: !0 });
|
|
1796
|
+
} catch (Ge) {
|
|
1797
|
+
console.warn("[LiveLayer] publishData failed.", Ge);
|
|
1798
|
+
}
|
|
1799
|
+
}, Y = Xe.current, at = Ke.current;
|
|
1800
|
+
try {
|
|
1801
|
+
if (at) {
|
|
1802
|
+
const re = at(Y);
|
|
1803
|
+
if (re instanceof Promise) {
|
|
1804
|
+
U({ type: "page_context_pending" }), re.then((ie) => U({ type: "page_context", context: ie })).catch((ie) => {
|
|
1805
|
+
console.warn(
|
|
1806
|
+
"[LiveLayer] getPageContext rejected; falling back to default walker.",
|
|
1807
|
+
ie
|
|
1808
|
+
), U({
|
|
1809
|
+
type: "page_context",
|
|
1810
|
+
context: wt(Y)
|
|
1811
|
+
});
|
|
1812
|
+
});
|
|
1813
|
+
return;
|
|
1814
|
+
}
|
|
1815
|
+
U({ type: "page_context", context: re });
|
|
1816
|
+
return;
|
|
1817
|
+
}
|
|
1818
|
+
U({
|
|
1819
|
+
type: "page_context",
|
|
1820
|
+
context: wt(Y)
|
|
1821
|
+
});
|
|
1822
|
+
} catch (re) {
|
|
1823
|
+
console.warn(
|
|
1824
|
+
"[LiveLayer] page-context extraction threw. Sending empty context.",
|
|
1825
|
+
re
|
|
1826
|
+
), U({
|
|
1827
|
+
type: "page_context",
|
|
1828
|
+
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], extras: Y }
|
|
1829
|
+
});
|
|
1830
|
+
}
|
|
1831
|
+
return;
|
|
1832
|
+
}
|
|
1833
|
+
Bn.has(M.type) || de == null || de(M);
|
|
1834
|
+
}
|
|
1482
1835
|
},
|
|
1483
|
-
[
|
|
1484
|
-
), B =
|
|
1485
|
-
agentId:
|
|
1486
|
-
baseUrl:
|
|
1487
|
-
apiKey:
|
|
1488
|
-
sessionEndpoint:
|
|
1489
|
-
sessionBody:
|
|
1490
|
-
onDataMessage:
|
|
1836
|
+
[de, se]
|
|
1837
|
+
), B = jt({
|
|
1838
|
+
agentId: D ? "__controlled__" : te,
|
|
1839
|
+
baseUrl: i,
|
|
1840
|
+
apiKey: r,
|
|
1841
|
+
sessionEndpoint: o,
|
|
1842
|
+
sessionBody: l,
|
|
1843
|
+
onDataMessage: D ? void 0 : Ve
|
|
1491
1844
|
});
|
|
1492
|
-
|
|
1493
|
-
if (
|
|
1494
|
-
return
|
|
1495
|
-
}, [
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1845
|
+
I(() => {
|
|
1846
|
+
if (D != null && D.subscribeToDataMessages)
|
|
1847
|
+
return D.subscribeToDataMessages(Ve);
|
|
1848
|
+
}, [D, Ve]), Re.current = () => {
|
|
1849
|
+
var v;
|
|
1850
|
+
return (v = B.getRoom) == null ? void 0 : v.call(B);
|
|
1851
|
+
};
|
|
1852
|
+
const m = De(() => D ? {
|
|
1853
|
+
connectionState: D.connectionState,
|
|
1854
|
+
agentState: D.agentState,
|
|
1855
|
+
transcript: D.transcript,
|
|
1856
|
+
videoElement: D.videoElement,
|
|
1857
|
+
audioElement: D.audioElement,
|
|
1858
|
+
canResume: D.canResume,
|
|
1859
|
+
error: D.error,
|
|
1504
1860
|
agentConfig: null,
|
|
1505
1861
|
connect: async () => {
|
|
1506
|
-
await
|
|
1862
|
+
await D.onConnect();
|
|
1507
1863
|
},
|
|
1508
|
-
disconnect: () =>
|
|
1864
|
+
disconnect: () => D.onDisconnect(),
|
|
1509
1865
|
// Dummy getRoom for shape compatibility — controlled consumers own the Room.
|
|
1510
1866
|
// Internal session's getRoom returns null when no real connect has happened,
|
|
1511
1867
|
// so we reuse its reference for type consistency.
|
|
@@ -1524,254 +1880,276 @@ function Ut(t) {
|
|
|
1524
1880
|
disconnect: B.disconnect,
|
|
1525
1881
|
getRoom: B.getRoom,
|
|
1526
1882
|
isControlled: !1
|
|
1527
|
-
}, [
|
|
1528
|
-
|
|
1529
|
-
const v =
|
|
1883
|
+
}, [D, B]), Je = A(null);
|
|
1884
|
+
I(() => {
|
|
1885
|
+
const v = m.videoElement, M = Je.current;
|
|
1530
1886
|
if (!(!v || !M))
|
|
1531
1887
|
return M.appendChild(v), () => {
|
|
1532
1888
|
v.parentNode === M && M.removeChild(v);
|
|
1533
1889
|
};
|
|
1534
|
-
}, [
|
|
1535
|
-
const v =
|
|
1890
|
+
}, [m.videoElement]), I(() => {
|
|
1891
|
+
const v = m.audioElement;
|
|
1536
1892
|
if (!v) return;
|
|
1537
|
-
|
|
1893
|
+
fe.attach(v);
|
|
1538
1894
|
const M = v.play();
|
|
1539
|
-
return M && typeof M.catch == "function" && M.catch((
|
|
1540
|
-
(
|
|
1895
|
+
return M && typeof M.catch == "function" && M.catch((G) => {
|
|
1896
|
+
(G == null ? void 0 : G.name) === "NotAllowedError" && me(!0);
|
|
1541
1897
|
}), () => {
|
|
1542
|
-
|
|
1898
|
+
fe.detach();
|
|
1543
1899
|
};
|
|
1544
|
-
}, [
|
|
1545
|
-
if (
|
|
1546
|
-
const v =
|
|
1900
|
+
}, [m.audioElement]), I(() => {
|
|
1901
|
+
if (m.isControlled || m.connectionState !== "connected") return;
|
|
1902
|
+
const v = m.getRoom();
|
|
1547
1903
|
if (v)
|
|
1548
|
-
return
|
|
1549
|
-
}),
|
|
1550
|
-
|
|
1904
|
+
return j.setupMic(v).catch(() => {
|
|
1905
|
+
}), F.attachRoom(v), q.attachRoom(v), Q.refresh(), () => {
|
|
1906
|
+
j.teardownMic(), F.teardown(), q.teardown();
|
|
1551
1907
|
};
|
|
1552
|
-
}, [
|
|
1553
|
-
const v =
|
|
1554
|
-
v && (v.muted =
|
|
1555
|
-
}, [
|
|
1556
|
-
const
|
|
1557
|
-
const M =
|
|
1908
|
+
}, [m.isControlled, m.connectionState]), I(() => {
|
|
1909
|
+
const v = m.audioElement;
|
|
1910
|
+
v && (v.muted = O);
|
|
1911
|
+
}, [m.audioElement, O]);
|
|
1912
|
+
const Ct = y((v) => {
|
|
1913
|
+
const M = m.getRoom();
|
|
1558
1914
|
if (M)
|
|
1559
1915
|
try {
|
|
1560
|
-
const
|
|
1916
|
+
const G = new TextEncoder().encode(
|
|
1561
1917
|
JSON.stringify({ type: "user_message", text: v })
|
|
1562
1918
|
);
|
|
1563
|
-
M.localParticipant.publishData(
|
|
1919
|
+
M.localParticipant.publishData(G, { reliable: !0 });
|
|
1564
1920
|
} catch {
|
|
1565
1921
|
}
|
|
1566
|
-
}, [
|
|
1567
|
-
|
|
1922
|
+
}, [m]), Et = y(() => {
|
|
1923
|
+
Ye((v) => !v);
|
|
1568
1924
|
}, []);
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
}, [
|
|
1572
|
-
|
|
1573
|
-
}, [
|
|
1574
|
-
|
|
1575
|
-
}, [
|
|
1576
|
-
const
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
}, [
|
|
1580
|
-
const
|
|
1925
|
+
I(() => {
|
|
1926
|
+
ce == null || ce(m.connectionState), m.connectionState === "connected" ? oe == null || oe() : m.connectionState === "disconnected" && (le == null || le());
|
|
1927
|
+
}, [m.connectionState, oe, le, ce]), I(() => {
|
|
1928
|
+
ae == null || ae(m.transcript);
|
|
1929
|
+
}, [m.transcript, ae]), I(() => {
|
|
1930
|
+
ee == null || ee(m.agentState);
|
|
1931
|
+
}, [m.agentState, ee]);
|
|
1932
|
+
const Qe = A(!1);
|
|
1933
|
+
I(() => {
|
|
1934
|
+
m.isControlled || !d || Qe.current || ue && m.connectionState === "idle" && (Qe.current = !0, m.connect());
|
|
1935
|
+
}, [d, m.connectionState, m, ue]);
|
|
1936
|
+
const Nt = y(
|
|
1581
1937
|
(v) => {
|
|
1582
|
-
const M =
|
|
1583
|
-
M && (
|
|
1938
|
+
const M = x == null ? void 0 : x.find((G) => G.id === v);
|
|
1939
|
+
M && (_e(!1), v !== V && (Ae(!0), m.disconnect(), he || He(v), P == null || P(M)));
|
|
1584
1940
|
},
|
|
1585
1941
|
[
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1942
|
+
x,
|
|
1943
|
+
V,
|
|
1944
|
+
m,
|
|
1945
|
+
he,
|
|
1946
|
+
P
|
|
1591
1947
|
]
|
|
1592
1948
|
);
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
}, [
|
|
1596
|
-
if (!
|
|
1949
|
+
I(() => {
|
|
1950
|
+
we && m.connectionState === "connected" && Ae(!1);
|
|
1951
|
+
}, [m.connectionState, we]), I(() => {
|
|
1952
|
+
if (!ge) return;
|
|
1597
1953
|
const v = (M) => {
|
|
1598
|
-
M.key === "Escape" &&
|
|
1954
|
+
M.key === "Escape" && _e(!1);
|
|
1599
1955
|
};
|
|
1600
1956
|
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(() =>
|
|
1957
|
+
}, [ge]);
|
|
1958
|
+
const St = !!p || !!($ != null && $.avatarImageUrl) || m.isControlled, We = Kt(te, i, St), qe = ($ == null ? void 0 : $.name) ?? N ?? ((tt = m.agentConfig) == null ? void 0 : tt.name) ?? ((nt = We.info) == null ? void 0 : nt.name) ?? "Live Layer", Ze = ($ == null ? void 0 : $.avatarImageUrl) ?? p ?? ((rt = m.agentConfig) == null ? void 0 : rt.avatarImageUrl) ?? ((it = We.info) == null ? void 0 : it.avatarImageUrl) ?? null, Lt = b ?? ((ot = m.agentConfig) == null ? void 0 : ot.idleLoopUrl) ?? ((lt = We.info) == null ? void 0 : lt.idleLoopUrl) ?? null, At = T ?? null, Mt = y(() => J("expanded"), [J]), Rt = y(
|
|
1959
|
+
() => J("minimized"),
|
|
1960
|
+
[J]
|
|
1961
|
+
), et = y(() => {
|
|
1962
|
+
m.disconnect(), J("hidden");
|
|
1963
|
+
}, [m, J]), It = y(() => {
|
|
1964
|
+
const v = m.audioElement;
|
|
1965
|
+
v && v.play().then(() => me(!1)).catch(() => {
|
|
1610
1966
|
});
|
|
1611
|
-
}, [
|
|
1612
|
-
|
|
1613
|
-
}, [
|
|
1614
|
-
...
|
|
1615
|
-
zIndex:
|
|
1967
|
+
}, [m.audioElement]), Tt = y(() => {
|
|
1968
|
+
me(!1), m.connect();
|
|
1969
|
+
}, [m]), xe = {
|
|
1970
|
+
...Ue,
|
|
1971
|
+
zIndex: Oe
|
|
1616
1972
|
};
|
|
1617
|
-
|
|
1618
|
-
const
|
|
1973
|
+
R.primaryColor && (xe["--ll-color-primary"] = R.primaryColor), R.accentColor && (xe["--ll-color-accent"] = R.accentColor), R.backgroundColor && (xe["--ll-color-bg"] = R.backgroundColor), R.textColor && (xe["--ll-color-fg"] = R.textColor);
|
|
1974
|
+
const Pt = [
|
|
1619
1975
|
"ll-widget",
|
|
1620
|
-
`ll-widget--${
|
|
1621
|
-
`ll-widget--${
|
|
1622
|
-
|
|
1976
|
+
`ll-widget--${W}`,
|
|
1977
|
+
`ll-widget--${ne ? "mobile" : "desktop"}`,
|
|
1978
|
+
Be
|
|
1623
1979
|
].filter(Boolean).join(" ");
|
|
1624
|
-
return /* @__PURE__ */ _(
|
|
1980
|
+
return ue ? /* @__PURE__ */ _(
|
|
1625
1981
|
"div",
|
|
1626
1982
|
{
|
|
1627
|
-
className:
|
|
1628
|
-
style:
|
|
1629
|
-
"data-display-mode":
|
|
1630
|
-
"data-position":
|
|
1983
|
+
className: Pt,
|
|
1984
|
+
style: xe,
|
|
1985
|
+
"data-display-mode": W,
|
|
1986
|
+
"data-position": f,
|
|
1631
1987
|
children: [
|
|
1632
|
-
|
|
1633
|
-
|
|
1988
|
+
W === "hidden" && /* @__PURE__ */ t(
|
|
1989
|
+
wn,
|
|
1634
1990
|
{
|
|
1635
|
-
position:
|
|
1636
|
-
isMobile:
|
|
1637
|
-
isSpeaking:
|
|
1638
|
-
onExpand: () =>
|
|
1639
|
-
label: `Open ${
|
|
1991
|
+
position: f,
|
|
1992
|
+
isMobile: ne,
|
|
1993
|
+
isSpeaking: m.agentState === "speaking",
|
|
1994
|
+
onExpand: () => J("expanded"),
|
|
1995
|
+
label: `Open ${qe} widget`
|
|
1640
1996
|
}
|
|
1641
1997
|
),
|
|
1642
|
-
|
|
1643
|
-
|
|
1998
|
+
W === "minimized" && /* @__PURE__ */ t(
|
|
1999
|
+
xn,
|
|
1644
2000
|
{
|
|
1645
|
-
position:
|
|
1646
|
-
isMobile:
|
|
1647
|
-
agentName:
|
|
1648
|
-
avatarImageUrl:
|
|
1649
|
-
agentState:
|
|
1650
|
-
isMuted:
|
|
1651
|
-
audioLevel:
|
|
1652
|
-
onExpand:
|
|
1653
|
-
onToggleMute:
|
|
1654
|
-
onClose:
|
|
2001
|
+
position: f,
|
|
2002
|
+
isMobile: ne,
|
|
2003
|
+
agentName: qe,
|
|
2004
|
+
avatarImageUrl: Ze,
|
|
2005
|
+
agentState: m.agentState,
|
|
2006
|
+
isMuted: j.isMuted,
|
|
2007
|
+
audioLevel: fe,
|
|
2008
|
+
onExpand: Mt,
|
|
2009
|
+
onToggleMute: j.toggleMute,
|
|
2010
|
+
onClose: et
|
|
1655
2011
|
}
|
|
1656
2012
|
),
|
|
1657
|
-
|
|
1658
|
-
|
|
2013
|
+
W === "expanded" && /* @__PURE__ */ t(
|
|
2014
|
+
Cn,
|
|
1659
2015
|
{
|
|
1660
|
-
position:
|
|
1661
|
-
isMobile:
|
|
1662
|
-
agentName:
|
|
1663
|
-
avatarImageUrl:
|
|
1664
|
-
idleLoopUrl:
|
|
1665
|
-
greeting:
|
|
1666
|
-
branding:
|
|
1667
|
-
teamMembers:
|
|
1668
|
-
currentTeamMemberId:
|
|
1669
|
-
isSwitchingTeamMember:
|
|
1670
|
-
teamSwitcherOpen:
|
|
1671
|
-
onToggleTeamSwitcher: () =>
|
|
1672
|
-
onSelectTeamMember:
|
|
1673
|
-
connectionState:
|
|
1674
|
-
agentState:
|
|
1675
|
-
transcript:
|
|
1676
|
-
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:
|
|
1692
|
-
micError:
|
|
1693
|
-
error:
|
|
1694
|
-
avatarVideoContainerRef:
|
|
1695
|
-
onConnect: () => void
|
|
1696
|
-
onDisconnect: () =>
|
|
1697
|
-
onRetry:
|
|
1698
|
-
onResumeAudio:
|
|
1699
|
-
onToggleMute:
|
|
1700
|
-
onToggleCamera: () => void
|
|
1701
|
-
onSwitchCameraDevice: (v) => void
|
|
1702
|
-
onToggleScreenShare: () => void
|
|
1703
|
-
onToggleSpeaker:
|
|
1704
|
-
onSendMessage:
|
|
1705
|
-
onMinimize:
|
|
1706
|
-
onClose:
|
|
1707
|
-
onClearMicError:
|
|
2016
|
+
position: f,
|
|
2017
|
+
isMobile: ne,
|
|
2018
|
+
agentName: qe,
|
|
2019
|
+
avatarImageUrl: Ze,
|
|
2020
|
+
idleLoopUrl: Lt,
|
|
2021
|
+
greeting: At,
|
|
2022
|
+
branding: R,
|
|
2023
|
+
teamMembers: x,
|
|
2024
|
+
currentTeamMemberId: V,
|
|
2025
|
+
isSwitchingTeamMember: we,
|
|
2026
|
+
teamSwitcherOpen: ge,
|
|
2027
|
+
onToggleTeamSwitcher: () => _e((v) => !v),
|
|
2028
|
+
onSelectTeamMember: Nt,
|
|
2029
|
+
connectionState: m.connectionState,
|
|
2030
|
+
agentState: m.agentState,
|
|
2031
|
+
transcript: m.transcript,
|
|
2032
|
+
isMuted: j.isMuted,
|
|
2033
|
+
micDevices: Q.mics,
|
|
2034
|
+
isCameraEnabled: F.isEnabled,
|
|
2035
|
+
cameraPreviewEl: F.previewEl,
|
|
2036
|
+
cameraDevices: Q.cameras,
|
|
2037
|
+
activeCameraId: F.activeDeviceId,
|
|
2038
|
+
isScreenShareEnabled: q.isEnabled,
|
|
2039
|
+
screenPreviewEl: q.previewEl,
|
|
2040
|
+
isSpeakerMuted: O,
|
|
2041
|
+
allowCamera: k,
|
|
2042
|
+
allowScreenShare: L,
|
|
2043
|
+
allowTyping: w,
|
|
2044
|
+
languageMenuOpen: Me,
|
|
2045
|
+
onToggleLanguageMenu: () => h((v) => !v),
|
|
2046
|
+
needsUserGesture: pe,
|
|
2047
|
+
canResume: m.canResume,
|
|
2048
|
+
micError: j.micError,
|
|
2049
|
+
error: m.error,
|
|
2050
|
+
avatarVideoContainerRef: Je,
|
|
2051
|
+
onConnect: () => void m.connect(),
|
|
2052
|
+
onDisconnect: () => m.disconnect(),
|
|
2053
|
+
onRetry: Tt,
|
|
2054
|
+
onResumeAudio: It,
|
|
2055
|
+
onToggleMute: j.toggleMute,
|
|
2056
|
+
onToggleCamera: () => void F.toggle(),
|
|
2057
|
+
onSwitchCameraDevice: (v) => void F.switchDevice(v),
|
|
2058
|
+
onToggleScreenShare: () => void q.toggle(),
|
|
2059
|
+
onToggleSpeaker: Et,
|
|
2060
|
+
onSendMessage: Ct,
|
|
2061
|
+
onMinimize: Rt,
|
|
2062
|
+
onClose: et,
|
|
2063
|
+
onClearMicError: j.clearError
|
|
1708
2064
|
}
|
|
1709
2065
|
)
|
|
1710
2066
|
]
|
|
1711
2067
|
}
|
|
1712
|
-
);
|
|
2068
|
+
) : null;
|
|
1713
2069
|
}
|
|
1714
|
-
function
|
|
1715
|
-
return /* @__PURE__ */
|
|
2070
|
+
function Wn(e) {
|
|
2071
|
+
return /* @__PURE__ */ t(Ht, { children: /* @__PURE__ */ t(Un, { ...e }) });
|
|
1716
2072
|
}
|
|
1717
|
-
const
|
|
1718
|
-
agentId:
|
|
2073
|
+
const qn = ({
|
|
2074
|
+
agentId: e,
|
|
1719
2075
|
baseUrl: n,
|
|
1720
|
-
apiKey:
|
|
1721
|
-
mode:
|
|
1722
|
-
onAgentEvent:
|
|
1723
|
-
className:
|
|
1724
|
-
style:
|
|
2076
|
+
apiKey: r,
|
|
2077
|
+
mode: i,
|
|
2078
|
+
onAgentEvent: o,
|
|
2079
|
+
className: l,
|
|
2080
|
+
style: d
|
|
1725
2081
|
}) => {
|
|
1726
|
-
const
|
|
1727
|
-
|
|
1728
|
-
const
|
|
1729
|
-
var
|
|
1730
|
-
const
|
|
1731
|
-
(
|
|
2082
|
+
const u = A(null), s = A(null), g = A(o);
|
|
2083
|
+
g.current = o;
|
|
2084
|
+
const f = y((a) => {
|
|
2085
|
+
var S;
|
|
2086
|
+
const c = a.detail;
|
|
2087
|
+
(S = g.current) == null || S.call(g, c);
|
|
1732
2088
|
}, []);
|
|
1733
|
-
return
|
|
1734
|
-
const
|
|
1735
|
-
if (!
|
|
1736
|
-
const
|
|
1737
|
-
return
|
|
1738
|
-
|
|
2089
|
+
return I(() => {
|
|
2090
|
+
const a = u.current;
|
|
2091
|
+
if (!a) return;
|
|
2092
|
+
const c = document.createElement("livelayer-widget");
|
|
2093
|
+
return c.setAttribute("agent-id", e), n && c.setAttribute("base-url", n), r && c.setAttribute("api-key", r), i && c.setAttribute("mode", i), c.addEventListener("agent-event", f), a.appendChild(c), s.current = c, () => {
|
|
2094
|
+
c.removeEventListener("agent-event", f), a.removeChild(c), s.current = null;
|
|
1739
2095
|
};
|
|
1740
|
-
}, [
|
|
1741
|
-
|
|
1742
|
-
}, [
|
|
1743
|
-
}
|
|
1744
|
-
function
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
2096
|
+
}, [e]), I(() => {
|
|
2097
|
+
s.current && (i ? s.current.setAttribute("mode", i) : s.current.removeAttribute("mode"));
|
|
2098
|
+
}, [i]), /* @__PURE__ */ t("div", { ref: u, className: l, style: d });
|
|
2099
|
+
}, Gn = zt(
|
|
2100
|
+
function({ id: n, intent: r, as: i = "div", className: o, style: l, children: d }, u) {
|
|
2101
|
+
return $t(
|
|
2102
|
+
i,
|
|
2103
|
+
{
|
|
2104
|
+
ref: u,
|
|
2105
|
+
"data-ll-region": n,
|
|
2106
|
+
"data-ll-intent": r,
|
|
2107
|
+
className: o,
|
|
2108
|
+
style: l
|
|
2109
|
+
},
|
|
2110
|
+
d
|
|
2111
|
+
);
|
|
2112
|
+
}
|
|
2113
|
+
);
|
|
2114
|
+
function Yn() {
|
|
2115
|
+
const [e, n] = C([]), r = y((o) => {
|
|
2116
|
+
n((l) => {
|
|
2117
|
+
const d = l.findIndex((u) => u.id === o.id);
|
|
2118
|
+
if (d >= 0) {
|
|
2119
|
+
const u = l.slice();
|
|
2120
|
+
return u[d] = o, u;
|
|
1751
2121
|
}
|
|
1752
|
-
return [...
|
|
2122
|
+
return [...l, o];
|
|
1753
2123
|
});
|
|
1754
|
-
}, []),
|
|
2124
|
+
}, []), i = y(() => n([]), []);
|
|
1755
2125
|
return {
|
|
1756
|
-
entries:
|
|
1757
|
-
pushSegment:
|
|
1758
|
-
clear:
|
|
1759
|
-
latest:
|
|
2126
|
+
entries: e,
|
|
2127
|
+
pushSegment: r,
|
|
2128
|
+
clear: i,
|
|
2129
|
+
latest: e.length > 0 ? e[e.length - 1] : null
|
|
1760
2130
|
};
|
|
1761
2131
|
}
|
|
1762
2132
|
export {
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
2133
|
+
Wn as AvatarWidget,
|
|
2134
|
+
Ht as ErrorBoundary,
|
|
2135
|
+
Gn as LiveLayerRegion,
|
|
2136
|
+
qn as LiveLayerWidget,
|
|
2137
|
+
$n as clearPageContextCache,
|
|
2138
|
+
zn as extractPageContext,
|
|
2139
|
+
wt as getCachedPageContext,
|
|
2140
|
+
un as matchesPattern,
|
|
2141
|
+
hn as shouldRenderAtPath,
|
|
2142
|
+
Kt as useAgentInfo,
|
|
2143
|
+
Ft as useAudioLevel,
|
|
2144
|
+
qt as useCameraState,
|
|
2145
|
+
Qt as useDisplayMode,
|
|
2146
|
+
tn as useDisplayModePersistence,
|
|
2147
|
+
rn as useIsMobile,
|
|
2148
|
+
jt as useLiveKitSession,
|
|
2149
|
+
Yt as useMediaDevices,
|
|
2150
|
+
Vt as useMicrophoneState,
|
|
2151
|
+
ln as usePathname,
|
|
2152
|
+
fn as useRouteMatch,
|
|
2153
|
+
Gt as useScreenShareState,
|
|
2154
|
+
Yn as useTranscript
|
|
1777
2155
|
};
|