@livelayer/react 0.2.5 → 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 +1381 -1001
- package/dist/styles.css +50 -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;
|
|
471
|
+
}
|
|
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
|
+
);
|
|
443
503
|
}
|
|
444
|
-
const
|
|
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
|
|
@@ -1041,294 +1101,311 @@ const St = ({
|
|
|
1041
1101
|
"button",
|
|
1042
1102
|
{
|
|
1043
1103
|
type: "button",
|
|
1044
|
-
className: "ll-hpill",
|
|
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,
|
|
1110
|
+
"aria-label": "Language: English",
|
|
1111
|
+
title: "Language: English",
|
|
1050
1112
|
children: [
|
|
1051
|
-
/* @__PURE__ */
|
|
1052
|
-
/* @__PURE__ */
|
|
1113
|
+
/* @__PURE__ */ t("span", { className: "ll-hpill__label", children: "EN" }),
|
|
1114
|
+
/* @__PURE__ */ t(Te, {})
|
|
1053
1115
|
]
|
|
1054
1116
|
}
|
|
1055
1117
|
),
|
|
1056
|
-
|
|
1118
|
+
S && /* @__PURE__ */ t(
|
|
1057
1119
|
"div",
|
|
1058
1120
|
{
|
|
1059
1121
|
className: "ll-hmenu",
|
|
1060
1122
|
onClick: (h) => h.stopPropagation(),
|
|
1061
1123
|
role: "listbox",
|
|
1062
|
-
children: /* @__PURE__ */
|
|
1124
|
+
children: /* @__PURE__ */ t(
|
|
1063
1125
|
"button",
|
|
1064
1126
|
{
|
|
1065
1127
|
type: "button",
|
|
1066
1128
|
className: "ll-hmenu__item is-active",
|
|
1067
1129
|
role: "option",
|
|
1068
1130
|
"aria-selected": !0,
|
|
1069
|
-
children: /* @__PURE__ */
|
|
1131
|
+
children: /* @__PURE__ */ t("span", { className: "ll-hmenu__name", children: "English" })
|
|
1070
1132
|
}
|
|
1071
1133
|
)
|
|
1072
1134
|
}
|
|
1073
1135
|
)
|
|
1074
1136
|
] }),
|
|
1075
|
-
/* @__PURE__ */
|
|
1137
|
+
/* @__PURE__ */ t(
|
|
1076
1138
|
"span",
|
|
1077
1139
|
{
|
|
1078
|
-
className: `ll-expanded__state ll-expanded__state--${
|
|
1079
|
-
children:
|
|
1140
|
+
className: `ll-expanded__state ll-expanded__state--${P}`,
|
|
1141
|
+
children: P
|
|
1080
1142
|
}
|
|
1081
1143
|
)
|
|
1082
1144
|
] }),
|
|
1083
1145
|
/* @__PURE__ */ _("div", { className: "ll-expanded__header-actions", children: [
|
|
1084
|
-
/* @__PURE__ */
|
|
1146
|
+
/* @__PURE__ */ t(
|
|
1085
1147
|
"button",
|
|
1086
1148
|
{
|
|
1087
1149
|
type: "button",
|
|
1088
1150
|
className: "ll-hbtn",
|
|
1089
|
-
onClick:
|
|
1151
|
+
onClick: he,
|
|
1090
1152
|
"aria-label": "Minimize widget",
|
|
1091
1153
|
title: "Minimize",
|
|
1092
|
-
children: /* @__PURE__ */
|
|
1154
|
+
children: /* @__PURE__ */ t(vt, {})
|
|
1093
1155
|
}
|
|
1094
1156
|
),
|
|
1095
|
-
/* @__PURE__ */
|
|
1157
|
+
/* @__PURE__ */ t(
|
|
1096
1158
|
"button",
|
|
1097
1159
|
{
|
|
1098
1160
|
type: "button",
|
|
1099
1161
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1100
|
-
onClick:
|
|
1101
|
-
"aria-label": "End
|
|
1102
|
-
title: "End
|
|
1103
|
-
children: /* @__PURE__ */
|
|
1162
|
+
onClick: Le,
|
|
1163
|
+
"aria-label": "End call",
|
|
1164
|
+
title: "End call",
|
|
1165
|
+
children: /* @__PURE__ */ t(gt, {})
|
|
1104
1166
|
}
|
|
1105
1167
|
)
|
|
1106
1168
|
] })
|
|
1107
1169
|
] }) : (
|
|
1108
1170
|
// Idle-state header with Live Layer product name + minimize/close
|
|
1109
1171
|
/* @__PURE__ */ _("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
|
|
1110
|
-
/* @__PURE__ */
|
|
1172
|
+
/* @__PURE__ */ t("span", { className: "ll-expanded__brand", children: Ae }),
|
|
1111
1173
|
/* @__PURE__ */ _("div", { className: "ll-expanded__header-actions", children: [
|
|
1112
|
-
/* @__PURE__ */
|
|
1174
|
+
/* @__PURE__ */ t(
|
|
1113
1175
|
"button",
|
|
1114
1176
|
{
|
|
1115
1177
|
type: "button",
|
|
1116
1178
|
className: "ll-hbtn ll-hbtn--ghost",
|
|
1117
|
-
onClick:
|
|
1179
|
+
onClick: he,
|
|
1118
1180
|
"aria-label": "Minimize widget",
|
|
1119
|
-
children: /* @__PURE__ */
|
|
1181
|
+
children: /* @__PURE__ */ t(vt, {})
|
|
1120
1182
|
}
|
|
1121
1183
|
),
|
|
1122
|
-
/* @__PURE__ */
|
|
1184
|
+
/* @__PURE__ */ t(
|
|
1123
1185
|
"button",
|
|
1124
1186
|
{
|
|
1125
1187
|
type: "button",
|
|
1126
1188
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1127
|
-
onClick:
|
|
1189
|
+
onClick: Le,
|
|
1128
1190
|
"aria-label": "Close widget",
|
|
1129
|
-
children: /* @__PURE__ */
|
|
1191
|
+
children: /* @__PURE__ */ t(gt, {})
|
|
1130
1192
|
}
|
|
1131
1193
|
)
|
|
1132
1194
|
] })
|
|
1133
1195
|
] })
|
|
1134
1196
|
),
|
|
1135
|
-
|
|
1136
|
-
"
|
|
1137
|
-
{
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
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
|
+
})(),
|
|
1149
1229
|
/* @__PURE__ */ _(
|
|
1150
1230
|
"div",
|
|
1151
1231
|
{
|
|
1152
|
-
className: `ll-expanded__pip ${
|
|
1232
|
+
className: `ll-expanded__pip ${te && (w || K) ? "is-visible" : ""}`,
|
|
1153
1233
|
children: [
|
|
1154
|
-
/* @__PURE__ */
|
|
1234
|
+
/* @__PURE__ */ t(
|
|
1155
1235
|
"div",
|
|
1156
1236
|
{
|
|
1157
|
-
ref:
|
|
1158
|
-
className:
|
|
1237
|
+
ref: fe,
|
|
1238
|
+
className: K ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1159
1239
|
}
|
|
1160
1240
|
),
|
|
1161
|
-
/* @__PURE__ */
|
|
1241
|
+
/* @__PURE__ */ t(
|
|
1162
1242
|
"div",
|
|
1163
1243
|
{
|
|
1164
|
-
ref:
|
|
1165
|
-
className:
|
|
1244
|
+
ref: ne,
|
|
1245
|
+
className: !K && w ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1166
1246
|
}
|
|
1167
1247
|
)
|
|
1168
1248
|
]
|
|
1169
1249
|
}
|
|
1170
1250
|
),
|
|
1171
|
-
|
|
1172
|
-
|
|
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 }) }),
|
|
1173
1253
|
/* @__PURE__ */ _("div", { className: "ll-toolbar", onClick: (h) => h.stopPropagation(), children: [
|
|
1174
|
-
|
|
1254
|
+
oe && /* @__PURE__ */ t(
|
|
1175
1255
|
"button",
|
|
1176
1256
|
{
|
|
1177
1257
|
type: "button",
|
|
1178
|
-
className: `ll-tool ${
|
|
1179
|
-
onClick:
|
|
1180
|
-
"aria-label":
|
|
1181
|
-
title:
|
|
1182
|
-
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, {})
|
|
1183
1263
|
}
|
|
1184
1264
|
),
|
|
1185
|
-
|
|
1186
|
-
/* @__PURE__ */
|
|
1265
|
+
Ne && /* @__PURE__ */ _("div", { className: "ll-tool-split", children: [
|
|
1266
|
+
/* @__PURE__ */ t(
|
|
1187
1267
|
"button",
|
|
1188
1268
|
{
|
|
1189
1269
|
type: "button",
|
|
1190
|
-
className: `ll-tool ll-tool--left ${
|
|
1191
|
-
onClick:
|
|
1192
|
-
"aria-label":
|
|
1193
|
-
title:
|
|
1194
|
-
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, {})
|
|
1195
1275
|
}
|
|
1196
1276
|
),
|
|
1197
|
-
/* @__PURE__ */
|
|
1277
|
+
/* @__PURE__ */ t(
|
|
1198
1278
|
"button",
|
|
1199
1279
|
{
|
|
1200
1280
|
type: "button",
|
|
1201
|
-
className: `ll-tool ll-tool--right ${
|
|
1281
|
+
className: `ll-tool ll-tool--right ${w ? "is-on" : ""}`,
|
|
1202
1282
|
onClick: (h) => {
|
|
1203
|
-
h.stopPropagation(),
|
|
1283
|
+
h.stopPropagation(), Q((O) => !O), F(!1);
|
|
1204
1284
|
},
|
|
1205
1285
|
"aria-label": "Camera devices",
|
|
1206
1286
|
"aria-haspopup": "listbox",
|
|
1207
|
-
"aria-expanded":
|
|
1208
|
-
children: /* @__PURE__ */
|
|
1287
|
+
"aria-expanded": q,
|
|
1288
|
+
children: /* @__PURE__ */ t(Te, {})
|
|
1209
1289
|
}
|
|
1210
1290
|
),
|
|
1211
|
-
|
|
1212
|
-
|
|
1291
|
+
q && Ee.length > 0 && /* @__PURE__ */ t(
|
|
1292
|
+
yt,
|
|
1213
1293
|
{
|
|
1214
1294
|
label: "Camera",
|
|
1215
|
-
devices:
|
|
1216
|
-
activeId:
|
|
1295
|
+
devices: Ee,
|
|
1296
|
+
activeId: $e,
|
|
1217
1297
|
onPick: (h) => {
|
|
1218
|
-
|
|
1298
|
+
Q(!1), Ue(h);
|
|
1219
1299
|
}
|
|
1220
1300
|
}
|
|
1221
1301
|
)
|
|
1222
1302
|
] }),
|
|
1223
1303
|
/* @__PURE__ */ _("div", { className: "ll-tool-split", children: [
|
|
1224
|
-
/* @__PURE__ */
|
|
1304
|
+
/* @__PURE__ */ t(
|
|
1225
1305
|
"button",
|
|
1226
1306
|
{
|
|
1227
1307
|
type: "button",
|
|
1228
|
-
className: `ll-tool ll-tool--left ${
|
|
1229
|
-
onClick:
|
|
1230
|
-
"aria-label":
|
|
1231
|
-
title:
|
|
1232
|
-
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 })
|
|
1233
1313
|
}
|
|
1234
1314
|
),
|
|
1235
|
-
/* @__PURE__ */
|
|
1315
|
+
/* @__PURE__ */ t(
|
|
1236
1316
|
"button",
|
|
1237
1317
|
{
|
|
1238
1318
|
type: "button",
|
|
1239
|
-
className: `ll-tool ll-tool--right ${
|
|
1319
|
+
className: `ll-tool ll-tool--right ${R ? "is-muted" : ""}`,
|
|
1240
1320
|
onClick: (h) => {
|
|
1241
|
-
h.stopPropagation(),
|
|
1321
|
+
h.stopPropagation(), F((O) => !O), Q(!1);
|
|
1242
1322
|
},
|
|
1243
1323
|
"aria-label": "Microphone devices",
|
|
1244
1324
|
"aria-haspopup": "listbox",
|
|
1245
|
-
"aria-expanded":
|
|
1246
|
-
children: /* @__PURE__ */
|
|
1325
|
+
"aria-expanded": j,
|
|
1326
|
+
children: /* @__PURE__ */ t(Te, {})
|
|
1247
1327
|
}
|
|
1248
1328
|
),
|
|
1249
|
-
|
|
1250
|
-
|
|
1329
|
+
j && L.length > 0 && /* @__PURE__ */ t(
|
|
1330
|
+
yt,
|
|
1251
1331
|
{
|
|
1252
1332
|
label: "Microphone",
|
|
1253
|
-
devices:
|
|
1333
|
+
devices: L,
|
|
1254
1334
|
activeId: "",
|
|
1255
|
-
onPick: () =>
|
|
1335
|
+
onPick: () => F(!1)
|
|
1256
1336
|
}
|
|
1257
1337
|
)
|
|
1258
1338
|
] }),
|
|
1259
|
-
/* @__PURE__ */
|
|
1339
|
+
/* @__PURE__ */ t(
|
|
1260
1340
|
"button",
|
|
1261
1341
|
{
|
|
1262
1342
|
type: "button",
|
|
1263
|
-
className: `ll-tool ${
|
|
1264
|
-
onClick:
|
|
1265
|
-
"aria-label":
|
|
1266
|
-
title:
|
|
1267
|
-
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 })
|
|
1268
1348
|
}
|
|
1269
1349
|
)
|
|
1270
1350
|
] }),
|
|
1271
|
-
|
|
1272
|
-
/* @__PURE__ */
|
|
1351
|
+
le && /* @__PURE__ */ _("form", { className: "ll-message-input", onSubmit: we, children: [
|
|
1352
|
+
/* @__PURE__ */ t(
|
|
1273
1353
|
"input",
|
|
1274
1354
|
{
|
|
1275
1355
|
type: "text",
|
|
1276
1356
|
className: "ll-message-input__field",
|
|
1277
1357
|
placeholder: "Message...",
|
|
1278
|
-
value:
|
|
1279
|
-
onChange: (h) =>
|
|
1358
|
+
value: pe,
|
|
1359
|
+
onChange: (h) => me(h.target.value),
|
|
1280
1360
|
"aria-label": "Message the agent"
|
|
1281
1361
|
}
|
|
1282
1362
|
),
|
|
1283
|
-
|
|
1363
|
+
pe.trim() && /* @__PURE__ */ t(
|
|
1284
1364
|
"button",
|
|
1285
1365
|
{
|
|
1286
1366
|
type: "submit",
|
|
1287
1367
|
className: "ll-message-input__send",
|
|
1288
1368
|
"aria-label": "Send message",
|
|
1289
|
-
children: /* @__PURE__ */
|
|
1369
|
+
children: /* @__PURE__ */ t(An, {})
|
|
1290
1370
|
}
|
|
1291
1371
|
)
|
|
1292
1372
|
] }),
|
|
1293
|
-
/* @__PURE__ */
|
|
1373
|
+
/* @__PURE__ */ t(
|
|
1294
1374
|
"button",
|
|
1295
1375
|
{
|
|
1296
1376
|
type: "button",
|
|
1297
1377
|
className: "ll-expanded__end",
|
|
1298
|
-
onClick:
|
|
1378
|
+
onClick: ce,
|
|
1299
1379
|
children: "End conversation"
|
|
1300
1380
|
}
|
|
1301
1381
|
)
|
|
1302
|
-
] }) :
|
|
1303
|
-
// Idle-state footer: start button + greeting
|
|
1304
|
-
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 }) }) })
|
|
1305
|
-
),
|
|
1382
|
+
] }) : null,
|
|
1306
1383
|
(() => {
|
|
1307
|
-
if (
|
|
1384
|
+
if (k && E !== "error")
|
|
1308
1385
|
return /* @__PURE__ */ _("div", { className: "ll-expanded__banner", role: "alert", children: [
|
|
1309
|
-
/* @__PURE__ */
|
|
1310
|
-
/* @__PURE__ */
|
|
1386
|
+
/* @__PURE__ */ t("span", { children: k }),
|
|
1387
|
+
/* @__PURE__ */ t(
|
|
1311
1388
|
"button",
|
|
1312
1389
|
{
|
|
1313
1390
|
type: "button",
|
|
1314
1391
|
className: "ll-expanded__banner-x",
|
|
1315
|
-
onClick:
|
|
1392
|
+
onClick: He,
|
|
1316
1393
|
"aria-label": "Dismiss",
|
|
1317
1394
|
children: "×"
|
|
1318
1395
|
}
|
|
1319
1396
|
)
|
|
1320
1397
|
] });
|
|
1321
|
-
if (!
|
|
1322
|
-
let h = "Failed to connect",
|
|
1323
|
-
return
|
|
1324
|
-
/* @__PURE__ */
|
|
1325
|
-
/* @__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(
|
|
1326
1403
|
"button",
|
|
1327
1404
|
{
|
|
1328
1405
|
type: "button",
|
|
1329
1406
|
className: "ll-expanded__banner-retry",
|
|
1330
|
-
onClick:
|
|
1331
|
-
children:
|
|
1407
|
+
onClick: se,
|
|
1408
|
+
children: O
|
|
1332
1409
|
}
|
|
1333
1410
|
)
|
|
1334
1411
|
] });
|
|
@@ -1337,83 +1414,218 @@ const St = ({
|
|
|
1337
1414
|
}
|
|
1338
1415
|
);
|
|
1339
1416
|
};
|
|
1340
|
-
function
|
|
1341
|
-
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" }) });
|
|
1342
1419
|
}
|
|
1343
|
-
function
|
|
1420
|
+
function gt() {
|
|
1344
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: [
|
|
1345
|
-
/* @__PURE__ */
|
|
1346
|
-
/* @__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" })
|
|
1347
1424
|
] });
|
|
1348
1425
|
}
|
|
1349
|
-
function
|
|
1350
|
-
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" }) });
|
|
1351
1428
|
}
|
|
1352
|
-
function
|
|
1429
|
+
function En() {
|
|
1353
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: [
|
|
1354
|
-
/* @__PURE__ */
|
|
1355
|
-
/* @__PURE__ */
|
|
1356
|
-
/* @__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" })
|
|
1357
1434
|
] });
|
|
1358
1435
|
}
|
|
1359
|
-
function
|
|
1436
|
+
function Nn() {
|
|
1360
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: [
|
|
1361
|
-
/* @__PURE__ */
|
|
1362
|
-
/* @__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" })
|
|
1363
1440
|
] });
|
|
1364
1441
|
}
|
|
1365
|
-
function
|
|
1442
|
+
function Sn({ muted: e }) {
|
|
1366
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: [
|
|
1367
|
-
/* @__PURE__ */
|
|
1368
|
-
/* @__PURE__ */
|
|
1369
|
-
/* @__PURE__ */
|
|
1370
|
-
|
|
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" })
|
|
1371
1448
|
] });
|
|
1372
1449
|
}
|
|
1373
|
-
function
|
|
1450
|
+
function Ln({ muted: e }) {
|
|
1374
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: [
|
|
1375
|
-
/* @__PURE__ */
|
|
1376
|
-
|
|
1377
|
-
/* @__PURE__ */
|
|
1378
|
-
/* @__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" })
|
|
1379
1456
|
] })
|
|
1380
1457
|
] });
|
|
1381
1458
|
}
|
|
1382
|
-
function
|
|
1459
|
+
function An() {
|
|
1383
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: [
|
|
1384
|
-
/* @__PURE__ */
|
|
1385
|
-
/* @__PURE__ */
|
|
1461
|
+
/* @__PURE__ */ t("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
|
|
1462
|
+
/* @__PURE__ */ t("polyline", { points: "12 5 19 12 12 19" })
|
|
1386
1463
|
] });
|
|
1387
1464
|
}
|
|
1388
|
-
const
|
|
1465
|
+
const yt = ({ label: e, devices: n, activeId: r, onPick: i }) => /* @__PURE__ */ _(
|
|
1389
1466
|
"div",
|
|
1390
1467
|
{
|
|
1391
1468
|
className: "ll-device-menu",
|
|
1392
|
-
onClick: (
|
|
1469
|
+
onClick: (o) => o.stopPropagation(),
|
|
1393
1470
|
role: "listbox",
|
|
1394
1471
|
children: [
|
|
1395
|
-
/* @__PURE__ */
|
|
1396
|
-
n.map((
|
|
1397
|
-
const
|
|
1472
|
+
/* @__PURE__ */ t("p", { className: "ll-device-menu__label", children: e }),
|
|
1473
|
+
n.map((o, l) => {
|
|
1474
|
+
const d = r === o.deviceId;
|
|
1398
1475
|
return /* @__PURE__ */ _(
|
|
1399
1476
|
"button",
|
|
1400
1477
|
{
|
|
1401
1478
|
type: "button",
|
|
1402
|
-
className: `ll-device-menu__item ${
|
|
1403
|
-
onClick: () =>
|
|
1479
|
+
className: `ll-device-menu__item ${d ? "is-active" : ""}`,
|
|
1480
|
+
onClick: () => i(o.deviceId),
|
|
1404
1481
|
role: "option",
|
|
1405
|
-
"aria-selected":
|
|
1482
|
+
"aria-selected": d,
|
|
1406
1483
|
children: [
|
|
1407
|
-
|
|
1408
|
-
/* @__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}` })
|
|
1409
1486
|
]
|
|
1410
1487
|
},
|
|
1411
|
-
|
|
1488
|
+
o.deviceId || l
|
|
1412
1489
|
);
|
|
1413
1490
|
})
|
|
1414
1491
|
]
|
|
1415
1492
|
}
|
|
1416
|
-
),
|
|
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([
|
|
1417
1629
|
"agent_state",
|
|
1418
1630
|
"avatar_stream_ready",
|
|
1419
1631
|
"avatar_active",
|
|
@@ -1421,89 +1633,235 @@ const Oe = ({ label: t, devices: n, activeId: i, onPick: l }) => /* @__PURE__ */
|
|
|
1421
1633
|
"bot_ready",
|
|
1422
1634
|
"agent_error",
|
|
1423
1635
|
"idle_warning",
|
|
1424
|
-
"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"
|
|
1425
1643
|
]);
|
|
1426
|
-
function
|
|
1427
|
-
var
|
|
1644
|
+
function Un(e) {
|
|
1645
|
+
var tt, nt, rt, it, ot, lt;
|
|
1428
1646
|
const {
|
|
1429
1647
|
agentId: n,
|
|
1430
|
-
apiKey:
|
|
1431
|
-
baseUrl:
|
|
1432
|
-
sessionEndpoint:
|
|
1433
|
-
sessionBody:
|
|
1434
|
-
autoConnect:
|
|
1435
|
-
displayMode:
|
|
1436
|
-
defaultDisplayMode:
|
|
1437
|
-
onDisplayModeChange:
|
|
1438
|
-
position:
|
|
1439
|
-
mobileBreakpoint:
|
|
1440
|
-
persistKey:
|
|
1441
|
-
disablePersistence:
|
|
1442
|
-
teamMembers:
|
|
1443
|
-
currentTeamMemberId:
|
|
1444
|
-
onTeamMemberChange:
|
|
1445
|
-
idleLoopUrl:
|
|
1446
|
-
greeting:
|
|
1447
|
-
avatarImageUrl:
|
|
1448
|
-
agentName:
|
|
1449
|
-
branding:
|
|
1450
|
-
allowCamera:
|
|
1451
|
-
allowScreenShare:
|
|
1452
|
-
allowTyping:
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
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(() => {
|
|
1465
1694
|
var v;
|
|
1466
|
-
return
|
|
1467
|
-
}),
|
|
1468
|
-
() => (
|
|
1469
|
-
[
|
|
1470
|
-
),
|
|
1471
|
-
value:
|
|
1472
|
-
defaultValue:
|
|
1473
|
-
onChange:
|
|
1474
|
-
persistKey:
|
|
1475
|
-
disablePersistence:
|
|
1476
|
-
}),
|
|
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(
|
|
1477
1708
|
(v) => {
|
|
1478
|
-
|
|
1479
|
-
|
|
1709
|
+
var G;
|
|
1710
|
+
const M = v;
|
|
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
|
+
}
|
|
1480
1835
|
},
|
|
1481
|
-
[
|
|
1482
|
-
), B =
|
|
1483
|
-
agentId:
|
|
1484
|
-
baseUrl:
|
|
1485
|
-
apiKey:
|
|
1486
|
-
sessionEndpoint:
|
|
1487
|
-
sessionBody:
|
|
1488
|
-
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
|
|
1489
1844
|
});
|
|
1490
|
-
|
|
1491
|
-
if (
|
|
1492
|
-
return
|
|
1493
|
-
}, [
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
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,
|
|
1502
1860
|
agentConfig: null,
|
|
1503
1861
|
connect: async () => {
|
|
1504
|
-
await
|
|
1862
|
+
await D.onConnect();
|
|
1505
1863
|
},
|
|
1506
|
-
disconnect: () =>
|
|
1864
|
+
disconnect: () => D.onDisconnect(),
|
|
1507
1865
|
// Dummy getRoom for shape compatibility — controlled consumers own the Room.
|
|
1508
1866
|
// Internal session's getRoom returns null when no real connect has happened,
|
|
1509
1867
|
// so we reuse its reference for type consistency.
|
|
@@ -1522,254 +1880,276 @@ function Ut(t) {
|
|
|
1522
1880
|
disconnect: B.disconnect,
|
|
1523
1881
|
getRoom: B.getRoom,
|
|
1524
1882
|
isControlled: !1
|
|
1525
|
-
}, [
|
|
1526
|
-
|
|
1527
|
-
const v =
|
|
1528
|
-
if (!(!v || !
|
|
1529
|
-
return
|
|
1530
|
-
v.parentNode ===
|
|
1883
|
+
}, [D, B]), Je = A(null);
|
|
1884
|
+
I(() => {
|
|
1885
|
+
const v = m.videoElement, M = Je.current;
|
|
1886
|
+
if (!(!v || !M))
|
|
1887
|
+
return M.appendChild(v), () => {
|
|
1888
|
+
v.parentNode === M && M.removeChild(v);
|
|
1531
1889
|
};
|
|
1532
|
-
}, [
|
|
1533
|
-
const v =
|
|
1890
|
+
}, [m.videoElement]), I(() => {
|
|
1891
|
+
const v = m.audioElement;
|
|
1534
1892
|
if (!v) return;
|
|
1535
|
-
|
|
1536
|
-
const
|
|
1537
|
-
return
|
|
1538
|
-
(
|
|
1893
|
+
fe.attach(v);
|
|
1894
|
+
const M = v.play();
|
|
1895
|
+
return M && typeof M.catch == "function" && M.catch((G) => {
|
|
1896
|
+
(G == null ? void 0 : G.name) === "NotAllowedError" && me(!0);
|
|
1539
1897
|
}), () => {
|
|
1540
|
-
|
|
1898
|
+
fe.detach();
|
|
1541
1899
|
};
|
|
1542
|
-
}, [
|
|
1543
|
-
if (
|
|
1544
|
-
const v =
|
|
1900
|
+
}, [m.audioElement]), I(() => {
|
|
1901
|
+
if (m.isControlled || m.connectionState !== "connected") return;
|
|
1902
|
+
const v = m.getRoom();
|
|
1545
1903
|
if (v)
|
|
1546
|
-
return
|
|
1547
|
-
}),
|
|
1548
|
-
|
|
1904
|
+
return j.setupMic(v).catch(() => {
|
|
1905
|
+
}), F.attachRoom(v), q.attachRoom(v), Q.refresh(), () => {
|
|
1906
|
+
j.teardownMic(), F.teardown(), q.teardown();
|
|
1549
1907
|
};
|
|
1550
|
-
}, [
|
|
1551
|
-
const v =
|
|
1552
|
-
v && (v.muted =
|
|
1553
|
-
}, [
|
|
1554
|
-
const
|
|
1555
|
-
const
|
|
1556
|
-
if (
|
|
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();
|
|
1914
|
+
if (M)
|
|
1557
1915
|
try {
|
|
1558
|
-
const
|
|
1916
|
+
const G = new TextEncoder().encode(
|
|
1559
1917
|
JSON.stringify({ type: "user_message", text: v })
|
|
1560
1918
|
);
|
|
1561
|
-
|
|
1919
|
+
M.localParticipant.publishData(G, { reliable: !0 });
|
|
1562
1920
|
} catch {
|
|
1563
1921
|
}
|
|
1564
|
-
}, [
|
|
1565
|
-
|
|
1922
|
+
}, [m]), Et = y(() => {
|
|
1923
|
+
Ye((v) => !v);
|
|
1566
1924
|
}, []);
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
}, [
|
|
1570
|
-
|
|
1571
|
-
}, [
|
|
1572
|
-
|
|
1573
|
-
}, [
|
|
1574
|
-
const
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
}, [
|
|
1578
|
-
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(
|
|
1579
1937
|
(v) => {
|
|
1580
|
-
const
|
|
1581
|
-
|
|
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)));
|
|
1582
1940
|
},
|
|
1583
1941
|
[
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1942
|
+
x,
|
|
1943
|
+
V,
|
|
1944
|
+
m,
|
|
1945
|
+
he,
|
|
1946
|
+
P
|
|
1589
1947
|
]
|
|
1590
1948
|
);
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
}, [
|
|
1594
|
-
if (!
|
|
1595
|
-
const v = (
|
|
1596
|
-
|
|
1949
|
+
I(() => {
|
|
1950
|
+
we && m.connectionState === "connected" && Ae(!1);
|
|
1951
|
+
}, [m.connectionState, we]), I(() => {
|
|
1952
|
+
if (!ge) return;
|
|
1953
|
+
const v = (M) => {
|
|
1954
|
+
M.key === "Escape" && _e(!1);
|
|
1597
1955
|
};
|
|
1598
1956
|
return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
|
|
1599
|
-
}, [
|
|
1600
|
-
const
|
|
1601
|
-
() =>
|
|
1602
|
-
[
|
|
1603
|
-
),
|
|
1604
|
-
|
|
1605
|
-
}, [
|
|
1606
|
-
const v =
|
|
1607
|
-
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(() => {
|
|
1608
1966
|
});
|
|
1609
|
-
}, [
|
|
1610
|
-
|
|
1611
|
-
}, [
|
|
1612
|
-
...
|
|
1613
|
-
zIndex:
|
|
1967
|
+
}, [m.audioElement]), Tt = y(() => {
|
|
1968
|
+
me(!1), m.connect();
|
|
1969
|
+
}, [m]), xe = {
|
|
1970
|
+
...Ue,
|
|
1971
|
+
zIndex: Oe
|
|
1614
1972
|
};
|
|
1615
|
-
|
|
1616
|
-
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 = [
|
|
1617
1975
|
"ll-widget",
|
|
1618
|
-
`ll-widget--${
|
|
1619
|
-
`ll-widget--${
|
|
1620
|
-
|
|
1976
|
+
`ll-widget--${W}`,
|
|
1977
|
+
`ll-widget--${ne ? "mobile" : "desktop"}`,
|
|
1978
|
+
Be
|
|
1621
1979
|
].filter(Boolean).join(" ");
|
|
1622
|
-
return /* @__PURE__ */ _(
|
|
1980
|
+
return ue ? /* @__PURE__ */ _(
|
|
1623
1981
|
"div",
|
|
1624
1982
|
{
|
|
1625
|
-
className:
|
|
1626
|
-
style:
|
|
1627
|
-
"data-display-mode":
|
|
1628
|
-
"data-position":
|
|
1983
|
+
className: Pt,
|
|
1984
|
+
style: xe,
|
|
1985
|
+
"data-display-mode": W,
|
|
1986
|
+
"data-position": f,
|
|
1629
1987
|
children: [
|
|
1630
|
-
|
|
1631
|
-
|
|
1988
|
+
W === "hidden" && /* @__PURE__ */ t(
|
|
1989
|
+
wn,
|
|
1632
1990
|
{
|
|
1633
|
-
position:
|
|
1634
|
-
isMobile:
|
|
1635
|
-
isSpeaking:
|
|
1636
|
-
onExpand: () =>
|
|
1637
|
-
label: `Open ${
|
|
1991
|
+
position: f,
|
|
1992
|
+
isMobile: ne,
|
|
1993
|
+
isSpeaking: m.agentState === "speaking",
|
|
1994
|
+
onExpand: () => J("expanded"),
|
|
1995
|
+
label: `Open ${qe} widget`
|
|
1638
1996
|
}
|
|
1639
1997
|
),
|
|
1640
|
-
|
|
1641
|
-
|
|
1998
|
+
W === "minimized" && /* @__PURE__ */ t(
|
|
1999
|
+
xn,
|
|
1642
2000
|
{
|
|
1643
|
-
position:
|
|
1644
|
-
isMobile:
|
|
1645
|
-
agentName:
|
|
1646
|
-
avatarImageUrl:
|
|
1647
|
-
agentState:
|
|
1648
|
-
isMuted:
|
|
1649
|
-
audioLevel:
|
|
1650
|
-
onExpand:
|
|
1651
|
-
onToggleMute:
|
|
1652
|
-
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
|
|
1653
2011
|
}
|
|
1654
2012
|
),
|
|
1655
|
-
|
|
1656
|
-
|
|
2013
|
+
W === "expanded" && /* @__PURE__ */ t(
|
|
2014
|
+
Cn,
|
|
1657
2015
|
{
|
|
1658
|
-
position:
|
|
1659
|
-
isMobile:
|
|
1660
|
-
agentName:
|
|
1661
|
-
avatarImageUrl:
|
|
1662
|
-
idleLoopUrl:
|
|
1663
|
-
greeting:
|
|
1664
|
-
branding:
|
|
1665
|
-
teamMembers:
|
|
1666
|
-
currentTeamMemberId:
|
|
1667
|
-
isSwitchingTeamMember:
|
|
1668
|
-
teamSwitcherOpen:
|
|
1669
|
-
onToggleTeamSwitcher: () =>
|
|
1670
|
-
onSelectTeamMember:
|
|
1671
|
-
connectionState:
|
|
1672
|
-
agentState:
|
|
1673
|
-
transcript:
|
|
1674
|
-
isMuted:
|
|
1675
|
-
micDevices:
|
|
1676
|
-
isCameraEnabled:
|
|
1677
|
-
cameraPreviewEl:
|
|
1678
|
-
cameraDevices:
|
|
1679
|
-
activeCameraId:
|
|
1680
|
-
isScreenShareEnabled:
|
|
1681
|
-
screenPreviewEl:
|
|
1682
|
-
isSpeakerMuted:
|
|
1683
|
-
allowCamera:
|
|
1684
|
-
allowScreenShare:
|
|
1685
|
-
allowTyping:
|
|
1686
|
-
languageMenuOpen:
|
|
1687
|
-
onToggleLanguageMenu: () =>
|
|
1688
|
-
needsUserGesture:
|
|
1689
|
-
canResume:
|
|
1690
|
-
micError:
|
|
1691
|
-
error:
|
|
1692
|
-
avatarVideoContainerRef:
|
|
1693
|
-
onConnect: () => void
|
|
1694
|
-
onDisconnect: () =>
|
|
1695
|
-
onRetry:
|
|
1696
|
-
onResumeAudio:
|
|
1697
|
-
onToggleMute:
|
|
1698
|
-
onToggleCamera: () => void
|
|
1699
|
-
onSwitchCameraDevice: (v) => void
|
|
1700
|
-
onToggleScreenShare: () => void
|
|
1701
|
-
onToggleSpeaker:
|
|
1702
|
-
onSendMessage:
|
|
1703
|
-
onMinimize:
|
|
1704
|
-
onClose:
|
|
1705
|
-
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
|
|
1706
2064
|
}
|
|
1707
2065
|
)
|
|
1708
2066
|
]
|
|
1709
2067
|
}
|
|
1710
|
-
);
|
|
2068
|
+
) : null;
|
|
1711
2069
|
}
|
|
1712
|
-
function
|
|
1713
|
-
return /* @__PURE__ */
|
|
2070
|
+
function Wn(e) {
|
|
2071
|
+
return /* @__PURE__ */ t(Ht, { children: /* @__PURE__ */ t(Un, { ...e }) });
|
|
1714
2072
|
}
|
|
1715
|
-
const
|
|
1716
|
-
agentId:
|
|
2073
|
+
const qn = ({
|
|
2074
|
+
agentId: e,
|
|
1717
2075
|
baseUrl: n,
|
|
1718
|
-
apiKey:
|
|
1719
|
-
mode:
|
|
1720
|
-
onAgentEvent:
|
|
1721
|
-
className:
|
|
1722
|
-
style:
|
|
2076
|
+
apiKey: r,
|
|
2077
|
+
mode: i,
|
|
2078
|
+
onAgentEvent: o,
|
|
2079
|
+
className: l,
|
|
2080
|
+
style: d
|
|
1723
2081
|
}) => {
|
|
1724
|
-
const
|
|
1725
|
-
|
|
1726
|
-
const
|
|
1727
|
-
var
|
|
1728
|
-
const
|
|
1729
|
-
(
|
|
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);
|
|
1730
2088
|
}, []);
|
|
1731
|
-
return
|
|
1732
|
-
const
|
|
1733
|
-
if (!
|
|
1734
|
-
const
|
|
1735
|
-
return
|
|
1736
|
-
|
|
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;
|
|
1737
2095
|
};
|
|
1738
|
-
}, [
|
|
1739
|
-
|
|
1740
|
-
}, [
|
|
1741
|
-
}
|
|
1742
|
-
function
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
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;
|
|
1749
2121
|
}
|
|
1750
|
-
return [...
|
|
2122
|
+
return [...l, o];
|
|
1751
2123
|
});
|
|
1752
|
-
}, []),
|
|
2124
|
+
}, []), i = y(() => n([]), []);
|
|
1753
2125
|
return {
|
|
1754
|
-
entries:
|
|
1755
|
-
pushSegment:
|
|
1756
|
-
clear:
|
|
1757
|
-
latest:
|
|
2126
|
+
entries: e,
|
|
2127
|
+
pushSegment: r,
|
|
2128
|
+
clear: i,
|
|
2129
|
+
latest: e.length > 0 ? e[e.length - 1] : null
|
|
1758
2130
|
};
|
|
1759
2131
|
}
|
|
1760
2132
|
export {
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
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
|
|
1775
2155
|
};
|