@livelayer/react 0.10.1 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/dist/index.mjs +905 -898
- package/dist/styles.css +22 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { Component as zn, useState as C, useRef as
|
|
2
|
+
import { jsxs as g, jsx as n, Fragment as Ve } from "react/jsx-runtime";
|
|
3
|
+
import { Component as zn, useState as C, useRef as N, useEffect as I, useCallback as E, useMemo as Ye, useLayoutEffect as hn, forwardRef as dt, useImperativeHandle as On, createElement as Hn } from "react";
|
|
4
4
|
import { createPortal as Rt } from "react-dom";
|
|
5
5
|
import { LiveKitSession as Wn } from "@livelayer/sdk";
|
|
6
6
|
import { createLocalAudioTrack as Bn, Track as mn, createLocalVideoTrack as qn } from "livekit-client";
|
|
@@ -19,7 +19,7 @@ class Fn extends zn {
|
|
|
19
19
|
}
|
|
20
20
|
render() {
|
|
21
21
|
var t;
|
|
22
|
-
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */
|
|
22
|
+
return this.state.hasError ? this.props.fallback ? this.props.fallback : /* @__PURE__ */ g("div", { className: "ll-error-boundary", role: "alert", children: [
|
|
23
23
|
/* @__PURE__ */ n("p", { className: "ll-error-boundary__title", children: "Widget crashed" }),
|
|
24
24
|
/* @__PURE__ */ n("p", { className: "ll-error-boundary__message", children: ((t = this.state.error) == null ? void 0 : t.message) || "Something went wrong." }),
|
|
25
25
|
/* @__PURE__ */ n(
|
|
@@ -35,24 +35,24 @@ class Fn extends zn {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
function Un(e) {
|
|
38
|
-
const [t, r] = C("idle"), [o, i] = C("idle"), [l, d] = C([]), [a, s] = C(null), [
|
|
39
|
-
|
|
38
|
+
const [t, r] = C("idle"), [o, i] = C("idle"), [l, d] = C([]), [a, s] = C(null), [u, y] = C(null), [f, c] = C(null), [A, _] = C(!1), [x, b] = C(null), v = N(null), S = N(e.onDataMessage);
|
|
39
|
+
S.current = e.onDataMessage, I(() => {
|
|
40
40
|
const R = {
|
|
41
41
|
onConnectionStateChange: (q) => {
|
|
42
|
-
r(q), q === "connected" &&
|
|
42
|
+
r(q), q === "connected" && b(null);
|
|
43
43
|
},
|
|
44
44
|
onAgentStateChange: i,
|
|
45
45
|
onTranscript: (q) => d([...q]),
|
|
46
46
|
onAgentConfig: s,
|
|
47
47
|
onAudioTrack: (q) => c(q),
|
|
48
|
-
onVideoTrack: (q) =>
|
|
49
|
-
onVideoTrackRemoved: () =>
|
|
50
|
-
onError: (q) =>
|
|
48
|
+
onVideoTrack: (q) => y(q),
|
|
49
|
+
onVideoTrackRemoved: () => y(null),
|
|
50
|
+
onError: (q) => b(q),
|
|
51
51
|
onDataMessage: (q) => {
|
|
52
|
-
var
|
|
53
|
-
(
|
|
52
|
+
var F;
|
|
53
|
+
(F = S.current) == null || F.call(S, q);
|
|
54
54
|
},
|
|
55
|
-
onResumabilityChange:
|
|
55
|
+
onResumabilityChange: _
|
|
56
56
|
}, B = new Wn(
|
|
57
57
|
{
|
|
58
58
|
agentId: e.agentId,
|
|
@@ -63,9 +63,9 @@ function Un(e) {
|
|
|
63
63
|
},
|
|
64
64
|
R
|
|
65
65
|
);
|
|
66
|
-
return
|
|
66
|
+
return v.current = B, r("idle"), i("idle"), d([]), s(null), y(null), c(null), _(!1), b(null), () => {
|
|
67
67
|
var q;
|
|
68
|
-
(q = B.destroy) == null || q.call(B),
|
|
68
|
+
(q = B.destroy) == null || q.call(B), v.current = null;
|
|
69
69
|
};
|
|
70
70
|
}, [
|
|
71
71
|
e.agentId,
|
|
@@ -74,64 +74,64 @@ function Un(e) {
|
|
|
74
74
|
e.sessionEndpoint,
|
|
75
75
|
JSON.stringify(e.sessionBody ?? {})
|
|
76
76
|
]);
|
|
77
|
-
const
|
|
78
|
-
const R =
|
|
77
|
+
const M = E(async () => {
|
|
78
|
+
const R = v.current;
|
|
79
79
|
if (R)
|
|
80
80
|
try {
|
|
81
81
|
await R.connect();
|
|
82
82
|
} catch (B) {
|
|
83
|
-
throw
|
|
83
|
+
throw b(B instanceof Error ? B.message : String(B)), B;
|
|
84
84
|
}
|
|
85
85
|
}, []), D = E(() => {
|
|
86
|
-
const R =
|
|
86
|
+
const R = v.current;
|
|
87
87
|
R && R.disconnect();
|
|
88
|
-
}, []),
|
|
88
|
+
}, []), k = E(() => {
|
|
89
89
|
var R;
|
|
90
|
-
return ((R =
|
|
90
|
+
return ((R = v.current) == null ? void 0 : R.getRoom()) ?? null;
|
|
91
91
|
}, []);
|
|
92
92
|
return {
|
|
93
93
|
connectionState: t,
|
|
94
94
|
agentState: o,
|
|
95
95
|
transcript: l,
|
|
96
96
|
agentConfig: a,
|
|
97
|
-
videoElement:
|
|
98
|
-
audioElement:
|
|
99
|
-
canResume:
|
|
100
|
-
error:
|
|
101
|
-
connect:
|
|
97
|
+
videoElement: u,
|
|
98
|
+
audioElement: f,
|
|
99
|
+
canResume: A,
|
|
100
|
+
error: x,
|
|
101
|
+
connect: M,
|
|
102
102
|
disconnect: D,
|
|
103
|
-
getRoom:
|
|
104
|
-
session:
|
|
103
|
+
getRoom: k,
|
|
104
|
+
session: v.current
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
function jn() {
|
|
108
|
-
const e =
|
|
109
|
-
const
|
|
110
|
-
if (!
|
|
108
|
+
const e = N(null), t = N(null), r = N(null), o = N(null), i = N(/* @__PURE__ */ new Set()), l = N(null), d = E(() => {
|
|
109
|
+
const f = t.current;
|
|
110
|
+
if (!f) {
|
|
111
111
|
o.current = null;
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
|
-
(!l.current || l.current.length !==
|
|
115
|
-
new ArrayBuffer(
|
|
114
|
+
(!l.current || l.current.length !== f.frequencyBinCount) && (l.current = new Uint8Array(
|
|
115
|
+
new ArrayBuffer(f.frequencyBinCount)
|
|
116
116
|
));
|
|
117
117
|
const c = l.current;
|
|
118
|
-
|
|
119
|
-
let
|
|
120
|
-
for (let
|
|
121
|
-
const
|
|
122
|
-
for (const
|
|
118
|
+
f.getByteFrequencyData(c);
|
|
119
|
+
let A = 0;
|
|
120
|
+
for (let x = 0; x < c.length; x++) A += c[x];
|
|
121
|
+
const _ = A / c.length / 255;
|
|
122
|
+
for (const x of i.current)
|
|
123
123
|
try {
|
|
124
|
-
|
|
125
|
-
} catch (
|
|
126
|
-
console.error("[useAudioLevel] subscriber threw:",
|
|
124
|
+
x(_);
|
|
125
|
+
} catch (b) {
|
|
126
|
+
console.error("[useAudioLevel] subscriber threw:", b);
|
|
127
127
|
}
|
|
128
128
|
o.current = requestAnimationFrame(d);
|
|
129
129
|
}, []), a = E(() => {
|
|
130
130
|
if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
|
|
131
|
-
const
|
|
132
|
-
c.fftSize = 64, c.connect(
|
|
131
|
+
const f = new AudioContext(), c = f.createAnalyser();
|
|
132
|
+
c.fftSize = 64, c.connect(f.destination), e.current = f, t.current = c;
|
|
133
133
|
}, []), s = E(
|
|
134
|
-
(
|
|
134
|
+
(f) => {
|
|
135
135
|
if (a(), !(!e.current || !t.current)) {
|
|
136
136
|
if (r.current) {
|
|
137
137
|
try {
|
|
@@ -141,7 +141,7 @@ function jn() {
|
|
|
141
141
|
r.current = null;
|
|
142
142
|
}
|
|
143
143
|
try {
|
|
144
|
-
const c = e.current.createMediaElementSource(
|
|
144
|
+
const c = e.current.createMediaElementSource(f);
|
|
145
145
|
c.connect(t.current), r.current = c;
|
|
146
146
|
} catch (c) {
|
|
147
147
|
console.warn("[useAudioLevel] createMediaElementSource failed:", c);
|
|
@@ -151,7 +151,7 @@ function jn() {
|
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
153
|
[a, d]
|
|
154
|
-
),
|
|
154
|
+
), u = E(() => {
|
|
155
155
|
if (o.current !== null && (cancelAnimationFrame(o.current), o.current = null), r.current) {
|
|
156
156
|
try {
|
|
157
157
|
r.current.disconnect();
|
|
@@ -159,11 +159,11 @@ function jn() {
|
|
|
159
159
|
}
|
|
160
160
|
r.current = null;
|
|
161
161
|
}
|
|
162
|
-
}, []),
|
|
163
|
-
i.current.delete(
|
|
162
|
+
}, []), y = E((f) => (i.current.add(f), () => {
|
|
163
|
+
i.current.delete(f);
|
|
164
164
|
}), []);
|
|
165
|
-
return
|
|
166
|
-
if (
|
|
165
|
+
return I(() => () => {
|
|
166
|
+
if (u(), t.current) {
|
|
167
167
|
try {
|
|
168
168
|
t.current.disconnect();
|
|
169
169
|
} catch {
|
|
@@ -178,11 +178,11 @@ function jn() {
|
|
|
178
178
|
e.current = null;
|
|
179
179
|
}
|
|
180
180
|
i.current.clear(), l.current = null;
|
|
181
|
-
}, [
|
|
181
|
+
}, [u]), { attach: s, detach: u, subscribe: y };
|
|
182
182
|
}
|
|
183
183
|
function Vn() {
|
|
184
|
-
const [e, t] = C(!1), [r, o] = C(""), [i, l] = C(null), d =
|
|
185
|
-
var
|
|
184
|
+
const [e, t] = C(!1), [r, o] = C(""), [i, l] = C(null), d = N(null), a = N(null), s = E(async (_) => {
|
|
185
|
+
var x, b;
|
|
186
186
|
if (d.current && a.current) {
|
|
187
187
|
try {
|
|
188
188
|
await a.current.localParticipant.unpublishTrack(d.current);
|
|
@@ -190,134 +190,134 @@ function Vn() {
|
|
|
190
190
|
}
|
|
191
191
|
d.current.stop(), d.current = null;
|
|
192
192
|
}
|
|
193
|
-
a.current =
|
|
193
|
+
a.current = _, l(null);
|
|
194
194
|
try {
|
|
195
|
-
const
|
|
195
|
+
const v = await Bn({
|
|
196
196
|
echoCancellation: !0,
|
|
197
197
|
noiseSuppression: !0
|
|
198
198
|
});
|
|
199
|
-
await
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
} catch (
|
|
203
|
-
const
|
|
204
|
-
throw l(
|
|
199
|
+
await _.localParticipant.publishTrack(v), d.current = v, t(v.isMuted);
|
|
200
|
+
const S = (b = (x = v.mediaStreamTrack) == null ? void 0 : x.getSettings) == null ? void 0 : b.call(x);
|
|
201
|
+
S != null && S.deviceId && o(S.deviceId);
|
|
202
|
+
} catch (v) {
|
|
203
|
+
const S = v instanceof Error && v.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
|
|
204
|
+
throw l(S), v;
|
|
205
205
|
}
|
|
206
|
-
}, []),
|
|
207
|
-
a.current =
|
|
208
|
-
}, []),
|
|
209
|
-
const
|
|
210
|
-
if (
|
|
206
|
+
}, []), u = E((_) => {
|
|
207
|
+
a.current = _;
|
|
208
|
+
}, []), y = E(async (_) => {
|
|
209
|
+
const x = a.current;
|
|
210
|
+
if (x)
|
|
211
211
|
try {
|
|
212
|
-
await
|
|
213
|
-
} catch (
|
|
214
|
-
console.warn("[useMicrophoneState] switchDevice failed:",
|
|
212
|
+
await x.switchActiveDevice("audioinput", _), o(_);
|
|
213
|
+
} catch (b) {
|
|
214
|
+
console.warn("[useMicrophoneState] switchDevice failed:", b);
|
|
215
215
|
}
|
|
216
|
-
}, []),
|
|
217
|
-
const
|
|
218
|
-
if (
|
|
219
|
-
|
|
216
|
+
}, []), f = E(() => {
|
|
217
|
+
const _ = d.current, x = a.current;
|
|
218
|
+
if (_) {
|
|
219
|
+
_.isMuted ? (_.unmute(), t(!1)) : (_.mute(), t(!0));
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
|
-
if (
|
|
223
|
-
const
|
|
224
|
-
t(
|
|
222
|
+
if (x) {
|
|
223
|
+
const b = !e;
|
|
224
|
+
t(b);
|
|
225
225
|
try {
|
|
226
|
-
|
|
227
|
-
} catch (
|
|
228
|
-
console.warn("[useMicrophoneState] setMicrophoneEnabled failed:",
|
|
226
|
+
x.localParticipant.setMicrophoneEnabled(!b);
|
|
227
|
+
} catch (v) {
|
|
228
|
+
console.warn("[useMicrophoneState] setMicrophoneEnabled failed:", v);
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
}, [e]), c = E(() => {
|
|
232
|
-
const
|
|
233
|
-
if (
|
|
232
|
+
const _ = d.current, x = a.current;
|
|
233
|
+
if (_ && x) {
|
|
234
234
|
try {
|
|
235
|
-
|
|
235
|
+
x.localParticipant.unpublishTrack(_);
|
|
236
236
|
} catch {
|
|
237
237
|
}
|
|
238
|
-
|
|
238
|
+
_.stop();
|
|
239
239
|
}
|
|
240
240
|
d.current = null, a.current = null, t(!1), o("");
|
|
241
|
-
}, []),
|
|
241
|
+
}, []), A = E(() => l(null), []);
|
|
242
242
|
return {
|
|
243
243
|
isMuted: e,
|
|
244
244
|
activeDeviceId: r,
|
|
245
245
|
micError: i,
|
|
246
|
-
toggleMute:
|
|
246
|
+
toggleMute: f,
|
|
247
247
|
setupMic: s,
|
|
248
|
-
attachRoom:
|
|
249
|
-
switchDevice:
|
|
248
|
+
attachRoom: u,
|
|
249
|
+
switchDevice: y,
|
|
250
250
|
teardownMic: c,
|
|
251
|
-
clearError:
|
|
251
|
+
clearError: A
|
|
252
252
|
};
|
|
253
253
|
}
|
|
254
254
|
const Yn = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
255
255
|
function Gn() {
|
|
256
|
-
const [e, t] = C(!1), [r, o] = C(null), [i, l] = C(null), [d, a] = C(""), s =
|
|
257
|
-
s.current =
|
|
258
|
-
}, []),
|
|
259
|
-
var
|
|
260
|
-
const
|
|
261
|
-
if (
|
|
262
|
-
const D =
|
|
256
|
+
const [e, t] = C(!1), [r, o] = C(null), [i, l] = C(null), [d, a] = C(""), s = N(null), u = N(null), y = E((v) => {
|
|
257
|
+
s.current = v;
|
|
258
|
+
}, []), f = E(() => {
|
|
259
|
+
var M;
|
|
260
|
+
const v = s.current, S = u.current;
|
|
261
|
+
if (S && v) {
|
|
262
|
+
const D = v.localParticipant.getTrackPublication(mn.Source.Camera), R = (D == null ? void 0 : D.track) ?? S;
|
|
263
263
|
try {
|
|
264
|
-
|
|
264
|
+
v.localParticipant.unpublishTrack(R);
|
|
265
265
|
} catch {
|
|
266
266
|
}
|
|
267
267
|
try {
|
|
268
|
-
(
|
|
268
|
+
(M = R.stop) == null || M.call(R);
|
|
269
269
|
} catch {
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
|
|
273
|
-
}, []), c = E(async (
|
|
274
|
-
const
|
|
275
|
-
if (
|
|
272
|
+
u.current = null, l(null), t(!1);
|
|
273
|
+
}, []), c = E(async (v) => {
|
|
274
|
+
const S = s.current;
|
|
275
|
+
if (S) {
|
|
276
276
|
o(null);
|
|
277
277
|
try {
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
const D = await qn(
|
|
281
|
-
await
|
|
282
|
-
const
|
|
283
|
-
l(
|
|
278
|
+
const M = { ...Yn };
|
|
279
|
+
v && (M.deviceId = v);
|
|
280
|
+
const D = await qn(M);
|
|
281
|
+
await S.localParticipant.publishTrack(D), u.current = D;
|
|
282
|
+
const k = D.attach();
|
|
283
|
+
l(k), t(!0), v && a(v);
|
|
284
284
|
try {
|
|
285
|
-
|
|
285
|
+
S.localParticipant.publishData(
|
|
286
286
|
new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
|
|
287
287
|
{ reliable: !0 }
|
|
288
288
|
);
|
|
289
289
|
} catch {
|
|
290
290
|
}
|
|
291
|
-
} catch (
|
|
292
|
-
const D =
|
|
291
|
+
} catch (M) {
|
|
292
|
+
const D = M instanceof Error && M.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
|
|
293
293
|
o(D);
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
|
-
}, []),
|
|
297
|
-
e ?
|
|
298
|
-
}, [e, d,
|
|
299
|
-
|
|
300
|
-
}, [
|
|
301
|
-
|
|
302
|
-
}, [
|
|
303
|
-
return
|
|
304
|
-
|
|
296
|
+
}, []), A = E(async () => {
|
|
297
|
+
e ? f() : await c(d || void 0);
|
|
298
|
+
}, [e, d, f, c]), _ = E(async (v) => {
|
|
299
|
+
f(), await c(v);
|
|
300
|
+
}, [f, c]), x = E(() => {
|
|
301
|
+
f(), s.current = null, o(null), a("");
|
|
302
|
+
}, [f]), b = E(() => o(null), []);
|
|
303
|
+
return I(() => () => {
|
|
304
|
+
u.current && u.current.stop();
|
|
305
305
|
}, []), {
|
|
306
306
|
isEnabled: e,
|
|
307
307
|
error: r,
|
|
308
308
|
previewEl: i,
|
|
309
309
|
activeDeviceId: d,
|
|
310
|
-
toggle:
|
|
311
|
-
switchDevice:
|
|
312
|
-
attachRoom:
|
|
313
|
-
teardown:
|
|
314
|
-
clearError:
|
|
310
|
+
toggle: A,
|
|
311
|
+
switchDevice: _,
|
|
312
|
+
attachRoom: y,
|
|
313
|
+
teardown: x,
|
|
314
|
+
clearError: b
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
317
|
function Jn() {
|
|
318
|
-
const [e, t] = C(!1), [r, o] = C(null), [i, l] = C(null), d =
|
|
318
|
+
const [e, t] = C(!1), [r, o] = C(null), [i, l] = C(null), d = N(null), a = E((c) => {
|
|
319
319
|
d.current = c;
|
|
320
|
-
}, []), s = E(() => l(null), []),
|
|
320
|
+
}, []), s = E(() => l(null), []), u = E(async () => {
|
|
321
321
|
const c = d.current;
|
|
322
322
|
if (c) {
|
|
323
323
|
if (e) {
|
|
@@ -331,12 +331,12 @@ function Jn() {
|
|
|
331
331
|
o(null);
|
|
332
332
|
try {
|
|
333
333
|
await c.localParticipant.setScreenShareEnabled(!0);
|
|
334
|
-
let
|
|
335
|
-
const
|
|
336
|
-
const
|
|
337
|
-
if (
|
|
338
|
-
const
|
|
339
|
-
l(
|
|
334
|
+
let A = 0;
|
|
335
|
+
const _ = () => {
|
|
336
|
+
const x = c.localParticipant.getTrackPublication(mn.Source.ScreenShare);
|
|
337
|
+
if (x != null && x.track) {
|
|
338
|
+
const b = x.track.attach();
|
|
339
|
+
l(b), t(!0);
|
|
340
340
|
try {
|
|
341
341
|
c.localParticipant.publishData(
|
|
342
342
|
new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
|
|
@@ -346,15 +346,15 @@ function Jn() {
|
|
|
346
346
|
}
|
|
347
347
|
return;
|
|
348
348
|
}
|
|
349
|
-
|
|
349
|
+
A++ < 10 ? setTimeout(_, 100) : t(!0);
|
|
350
350
|
};
|
|
351
|
-
|
|
352
|
-
} catch (
|
|
353
|
-
const
|
|
354
|
-
|
|
351
|
+
_();
|
|
352
|
+
} catch (A) {
|
|
353
|
+
const _ = A instanceof Error ? A.name : "";
|
|
354
|
+
_ !== "NotAllowedError" && _ !== "AbortError" && o("Screen share unavailable. Try again."), t(!1);
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
|
-
}, [e, s]),
|
|
357
|
+
}, [e, s]), y = E(() => {
|
|
358
358
|
const c = d.current;
|
|
359
359
|
if (c && e)
|
|
360
360
|
try {
|
|
@@ -362,8 +362,8 @@ function Jn() {
|
|
|
362
362
|
} catch {
|
|
363
363
|
}
|
|
364
364
|
s(), t(!1), o(null), d.current = null;
|
|
365
|
-
}, [e, s]),
|
|
366
|
-
return { isEnabled: e, error: r, previewEl: i, toggle:
|
|
365
|
+
}, [e, s]), f = E(() => o(null), []);
|
|
366
|
+
return { isEnabled: e, error: r, previewEl: i, toggle: u, attachRoom: a, teardown: y, clearError: f };
|
|
367
367
|
}
|
|
368
368
|
function Kn() {
|
|
369
369
|
const [e, t] = C([]), [r, o] = C([]), i = E(async () => {
|
|
@@ -374,7 +374,7 @@ function Kn() {
|
|
|
374
374
|
} catch {
|
|
375
375
|
}
|
|
376
376
|
}, []);
|
|
377
|
-
return
|
|
377
|
+
return I(() => {
|
|
378
378
|
if (i(), typeof navigator > "u" || !navigator.mediaDevices) return;
|
|
379
379
|
const l = () => void i();
|
|
380
380
|
return navigator.mediaDevices.addEventListener("devicechange", l), () => navigator.mediaDevices.removeEventListener("devicechange", l);
|
|
@@ -382,25 +382,25 @@ function Kn() {
|
|
|
382
382
|
}
|
|
383
383
|
function Xn(e, t, r = !1) {
|
|
384
384
|
const [o, i] = C(null), [l, d] = C(null), [a, s] = C(!r && !!e);
|
|
385
|
-
return
|
|
385
|
+
return I(() => {
|
|
386
386
|
if (r || !e) {
|
|
387
387
|
s(!1);
|
|
388
388
|
return;
|
|
389
389
|
}
|
|
390
|
-
const
|
|
391
|
-
return s(!0), d(null), fetch(`${
|
|
392
|
-
signal:
|
|
393
|
-
}).then(async (
|
|
394
|
-
if (!
|
|
395
|
-
const c = await
|
|
396
|
-
throw new Error(c.error || `HTTP ${
|
|
390
|
+
const u = new AbortController(), y = t || "https://app.livelayer.studio";
|
|
391
|
+
return s(!0), d(null), fetch(`${y}/api/widget/agent/${encodeURIComponent(e)}`, {
|
|
392
|
+
signal: u.signal
|
|
393
|
+
}).then(async (f) => {
|
|
394
|
+
if (!f.ok) {
|
|
395
|
+
const c = await f.json().catch(() => ({}));
|
|
396
|
+
throw new Error(c.error || `HTTP ${f.status}`);
|
|
397
397
|
}
|
|
398
|
-
return
|
|
399
|
-
}).then((
|
|
400
|
-
|
|
401
|
-
}).catch((
|
|
402
|
-
|
|
403
|
-
}), () =>
|
|
398
|
+
return f.json();
|
|
399
|
+
}).then((f) => {
|
|
400
|
+
u.signal.aborted || (i(f), s(!1));
|
|
401
|
+
}).catch((f) => {
|
|
402
|
+
u.signal.aborted || (d(f instanceof Error ? f.message : "Agent lookup failed"), s(!1));
|
|
403
|
+
}), () => u.abort();
|
|
404
404
|
}, [e, t, r]), { info: o, error: l, loading: a };
|
|
405
405
|
}
|
|
406
406
|
function Qn(e) {
|
|
@@ -442,23 +442,23 @@ function rr({
|
|
|
442
442
|
persistKey: o = "ll-widget",
|
|
443
443
|
disablePersistence: i = !1
|
|
444
444
|
} = {}) {
|
|
445
|
-
const l = `${o}:display-mode`, d =
|
|
445
|
+
const l = `${o}:display-mode`, d = N(!1), [a, s] = er({
|
|
446
446
|
value: e,
|
|
447
447
|
defaultValue: t,
|
|
448
|
-
onChange: (
|
|
449
|
-
e === void 0 && !i && Zn(l,
|
|
448
|
+
onChange: (u) => {
|
|
449
|
+
e === void 0 && !i && Zn(l, u), r == null || r(u);
|
|
450
450
|
}
|
|
451
451
|
});
|
|
452
|
-
return
|
|
452
|
+
return I(() => {
|
|
453
453
|
if (d.current || (d.current = !0, i || e !== void 0)) return;
|
|
454
|
-
const
|
|
455
|
-
|
|
454
|
+
const u = nr(Qn(l));
|
|
455
|
+
u && u !== a && s(u);
|
|
456
456
|
}, []), [a, s];
|
|
457
457
|
}
|
|
458
458
|
const or = 640;
|
|
459
459
|
function ir(e = or) {
|
|
460
460
|
const [t, r] = C(!1);
|
|
461
|
-
return
|
|
461
|
+
return I(() => {
|
|
462
462
|
if (e === !1) {
|
|
463
463
|
r(!1);
|
|
464
464
|
return;
|
|
@@ -490,7 +490,7 @@ function ar(e) {
|
|
|
490
490
|
const [t, r] = C(
|
|
491
491
|
() => e ?? Kt()
|
|
492
492
|
);
|
|
493
|
-
return
|
|
493
|
+
return I(() => {
|
|
494
494
|
if (e !== void 0) return;
|
|
495
495
|
lr();
|
|
496
496
|
const o = () => r(Kt());
|
|
@@ -539,7 +539,7 @@ function mr(e) {
|
|
|
539
539
|
};
|
|
540
540
|
}
|
|
541
541
|
function gr(e) {
|
|
542
|
-
const t = Ye(() => mr(e.config), [e.config]), r = e.baseUrl.replace(/\/+$/, ""), o =
|
|
542
|
+
const t = Ye(() => mr(e.config), [e.config]), r = e.baseUrl.replace(/\/+$/, ""), o = N(null), i = E(
|
|
543
543
|
(s) => {
|
|
544
544
|
try {
|
|
545
545
|
new Audio(`${r}${s}`).play().catch(() => {
|
|
@@ -567,10 +567,10 @@ function gr(e) {
|
|
|
567
567
|
if (s) {
|
|
568
568
|
if (o.current) return;
|
|
569
569
|
try {
|
|
570
|
-
const
|
|
571
|
-
|
|
570
|
+
const u = new Audio(`${r}/audio/thinking-sound.mp3`);
|
|
571
|
+
u.loop = !0, u.volume = 0.3, u.play().catch(() => {
|
|
572
572
|
o.current = null;
|
|
573
|
-
}), o.current =
|
|
573
|
+
}), o.current = u;
|
|
574
574
|
} catch {
|
|
575
575
|
}
|
|
576
576
|
} else if (o.current) {
|
|
@@ -583,7 +583,7 @@ function gr(e) {
|
|
|
583
583
|
},
|
|
584
584
|
[r, t.thinking]
|
|
585
585
|
);
|
|
586
|
-
return
|
|
586
|
+
return I(() => () => {
|
|
587
587
|
if (o.current) {
|
|
588
588
|
try {
|
|
589
589
|
o.current.pause();
|
|
@@ -596,7 +596,7 @@ function gr(e) {
|
|
|
596
596
|
[l, d, a]
|
|
597
597
|
);
|
|
598
598
|
}
|
|
599
|
-
const Zt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */
|
|
599
|
+
const Zt = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ g(
|
|
600
600
|
"svg",
|
|
601
601
|
{
|
|
602
602
|
className: t,
|
|
@@ -718,110 +718,116 @@ const xr = ({
|
|
|
718
718
|
onExpand: o,
|
|
719
719
|
label: i = "Open widget",
|
|
720
720
|
avatarImageUrl: l,
|
|
721
|
-
agentName: d
|
|
721
|
+
agentName: d,
|
|
722
|
+
containerEl: a
|
|
722
723
|
}) => {
|
|
723
|
-
const
|
|
724
|
-
(
|
|
725
|
-
if (typeof window > "u") return
|
|
726
|
-
const
|
|
727
|
-
return
|
|
724
|
+
const s = br(e), u = s === "right" ? "left" : "right", y = t ? 80 : 72, f = !!l, c = !!a, [A, _] = C(null), [x, b] = C(!1), v = N(null), S = N(!1), M = E(
|
|
725
|
+
(O) => {
|
|
726
|
+
if (typeof window > "u") return O;
|
|
727
|
+
const j = y / 2, H = nn + j, G = window.innerHeight - nn - j;
|
|
728
|
+
return G < H ? Math.max(H, O) : Math.max(H, Math.min(G, O));
|
|
728
729
|
},
|
|
729
|
-
[
|
|
730
|
+
[y]
|
|
730
731
|
);
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
732
|
+
I(() => {
|
|
733
|
+
if (c) {
|
|
734
|
+
_(null);
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
const O = _r();
|
|
738
|
+
_(M(O ?? window.innerHeight / 2));
|
|
739
|
+
const j = () => {
|
|
740
|
+
_((H) => H === null ? null : M(H));
|
|
736
741
|
};
|
|
737
|
-
return window.addEventListener("resize",
|
|
738
|
-
}, [
|
|
739
|
-
const
|
|
740
|
-
(
|
|
741
|
-
if (!(
|
|
742
|
+
return window.addEventListener("resize", j), () => window.removeEventListener("resize", j);
|
|
743
|
+
}, [M, c]);
|
|
744
|
+
const D = E(
|
|
745
|
+
(O) => {
|
|
746
|
+
if (!c && !(O.pointerType === "mouse" && O.button !== 0) && A !== null) {
|
|
742
747
|
try {
|
|
743
|
-
|
|
748
|
+
O.currentTarget.setPointerCapture(O.pointerId);
|
|
744
749
|
} catch {
|
|
745
750
|
}
|
|
746
|
-
|
|
747
|
-
startClientY:
|
|
748
|
-
startCenterY:
|
|
751
|
+
v.current = {
|
|
752
|
+
startClientY: O.clientY,
|
|
753
|
+
startCenterY: A,
|
|
749
754
|
moved: !1
|
|
750
755
|
};
|
|
751
756
|
}
|
|
752
757
|
},
|
|
753
|
-
[
|
|
754
|
-
),
|
|
755
|
-
(
|
|
756
|
-
const
|
|
757
|
-
if (!
|
|
758
|
-
const
|
|
759
|
-
!
|
|
758
|
+
[A, c]
|
|
759
|
+
), k = E(
|
|
760
|
+
(O) => {
|
|
761
|
+
const j = v.current;
|
|
762
|
+
if (!j) return;
|
|
763
|
+
const H = O.clientY - j.startClientY;
|
|
764
|
+
!j.moved && Math.abs(H) > wr && (j.moved = !0, b(!0)), j.moved && _(M(j.startCenterY + H));
|
|
760
765
|
},
|
|
761
|
-
[
|
|
762
|
-
),
|
|
763
|
-
(
|
|
764
|
-
const
|
|
765
|
-
if (
|
|
766
|
+
[M]
|
|
767
|
+
), R = E(
|
|
768
|
+
(O) => {
|
|
769
|
+
const j = v.current;
|
|
770
|
+
if (j) {
|
|
766
771
|
try {
|
|
767
|
-
|
|
772
|
+
O.currentTarget.releasePointerCapture(O.pointerId);
|
|
768
773
|
} catch {
|
|
769
774
|
}
|
|
770
|
-
|
|
775
|
+
v.current = null, j.moved && (b(!1), S.current = !0, _((H) => (H !== null && rn(H), H)));
|
|
771
776
|
}
|
|
772
777
|
},
|
|
773
778
|
[]
|
|
774
|
-
),
|
|
775
|
-
if (
|
|
776
|
-
|
|
779
|
+
), B = E(() => {
|
|
780
|
+
if (S.current) {
|
|
781
|
+
S.current = !1;
|
|
777
782
|
return;
|
|
778
783
|
}
|
|
779
784
|
o();
|
|
780
|
-
}, [o]),
|
|
781
|
-
(
|
|
782
|
-
if (
|
|
783
|
-
|
|
784
|
-
const
|
|
785
|
-
|
|
786
|
-
if (
|
|
787
|
-
const
|
|
788
|
-
return rn(
|
|
785
|
+
}, [o]), q = E(
|
|
786
|
+
(O) => {
|
|
787
|
+
if (O.key === "ArrowUp" || O.key === "ArrowDown") {
|
|
788
|
+
O.preventDefault();
|
|
789
|
+
const j = O.key === "ArrowUp" ? -8 : 8;
|
|
790
|
+
_((H) => {
|
|
791
|
+
if (H === null) return H;
|
|
792
|
+
const G = M(H + j);
|
|
793
|
+
return rn(G), G;
|
|
789
794
|
});
|
|
790
795
|
}
|
|
791
796
|
},
|
|
792
|
-
[
|
|
793
|
-
),
|
|
797
|
+
[M]
|
|
798
|
+
), F = [
|
|
794
799
|
"ll-hidden",
|
|
795
|
-
`ll-hidden--${
|
|
800
|
+
`ll-hidden--${s}`,
|
|
796
801
|
t ? "ll-hidden--mobile" : "ll-hidden--desktop",
|
|
797
802
|
r ? "ll-hidden--speaking" : null,
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
803
|
+
x ? "is-dragging" : null,
|
|
804
|
+
f ? "ll-hidden--with-avatar" : null,
|
|
805
|
+
c ? "ll-hidden--scoped" : null
|
|
806
|
+
].filter(Boolean).join(" "), U = A === null ? void 0 : { top: `${A - y / 2}px`, transform: "none" };
|
|
801
807
|
return /* @__PURE__ */ n(
|
|
802
808
|
"button",
|
|
803
809
|
{
|
|
804
810
|
type: "button",
|
|
805
|
-
className:
|
|
806
|
-
onPointerDown:
|
|
807
|
-
onPointerMove:
|
|
808
|
-
onPointerUp:
|
|
809
|
-
onPointerCancel:
|
|
810
|
-
onClick:
|
|
811
|
-
onKeyDown:
|
|
811
|
+
className: F,
|
|
812
|
+
onPointerDown: D,
|
|
813
|
+
onPointerMove: k,
|
|
814
|
+
onPointerUp: R,
|
|
815
|
+
onPointerCancel: R,
|
|
816
|
+
onClick: B,
|
|
817
|
+
onKeyDown: q,
|
|
812
818
|
"aria-label": i,
|
|
813
819
|
"data-position": e,
|
|
814
|
-
style:
|
|
815
|
-
children:
|
|
820
|
+
style: U,
|
|
821
|
+
children: f ? (
|
|
816
822
|
// Layout: tiny chevron flush against the inward edge (peeks out
|
|
817
823
|
// as the click affordance), then the circular avatar photo
|
|
818
824
|
// taking the rest of the tab. Reinforces "this is an
|
|
819
825
|
// avatar-based experience" even when collapsed.
|
|
820
|
-
/* @__PURE__ */
|
|
826
|
+
/* @__PURE__ */ g(Ve, { children: [
|
|
821
827
|
/* @__PURE__ */ n(
|
|
822
828
|
tn,
|
|
823
829
|
{
|
|
824
|
-
direction:
|
|
830
|
+
direction: u,
|
|
825
831
|
className: "ll-hidden__chevron ll-hidden__chevron--mini"
|
|
826
832
|
}
|
|
827
833
|
),
|
|
@@ -838,7 +844,7 @@ const xr = ({
|
|
|
838
844
|
) : /* @__PURE__ */ n(
|
|
839
845
|
tn,
|
|
840
846
|
{
|
|
841
|
-
direction:
|
|
847
|
+
direction: u,
|
|
842
848
|
className: "ll-hidden__chevron"
|
|
843
849
|
}
|
|
844
850
|
)
|
|
@@ -852,29 +858,29 @@ const xr = ({
|
|
|
852
858
|
className: i,
|
|
853
859
|
barClassName: l
|
|
854
860
|
}) => {
|
|
855
|
-
const d =
|
|
856
|
-
const
|
|
857
|
-
return Array.from({ length: t }, (
|
|
861
|
+
const d = N(null), a = N([]), s = Ye(() => {
|
|
862
|
+
const y = (Math.sqrt(5) - 1) / 2;
|
|
863
|
+
return Array.from({ length: t }, (f, c) => 0.5 + c * y % 1 * 0.5);
|
|
858
864
|
}, [t]);
|
|
859
|
-
|
|
865
|
+
I(() => e.subscribe((f) => {
|
|
860
866
|
for (let c = 0; c < t; c++) {
|
|
861
|
-
const
|
|
862
|
-
if (!
|
|
863
|
-
const
|
|
864
|
-
|
|
867
|
+
const A = a.current[c];
|
|
868
|
+
if (!A) continue;
|
|
869
|
+
const _ = Math.max(o, f * r * s[c]);
|
|
870
|
+
A.style.height = `${_}px`;
|
|
865
871
|
}
|
|
866
872
|
}), [e, t, r, o, s]);
|
|
867
|
-
const
|
|
868
|
-
return /* @__PURE__ */ n("div", { ref: d, className:
|
|
873
|
+
const u = ["ll-waveform", i].filter(Boolean).join(" ");
|
|
874
|
+
return /* @__PURE__ */ n("div", { ref: d, className: u, "aria-hidden": "true", children: Array.from({ length: t }, (y, f) => /* @__PURE__ */ n(
|
|
869
875
|
"div",
|
|
870
876
|
{
|
|
871
877
|
ref: (c) => {
|
|
872
|
-
a.current[
|
|
878
|
+
a.current[f] = c;
|
|
873
879
|
},
|
|
874
880
|
className: ["ll-waveform__bar", l].filter(Boolean).join(" "),
|
|
875
881
|
style: { height: `${o}px` }
|
|
876
882
|
},
|
|
877
|
-
|
|
883
|
+
f
|
|
878
884
|
)) });
|
|
879
885
|
}, Lr = ({
|
|
880
886
|
position: e,
|
|
@@ -886,14 +892,14 @@ const xr = ({
|
|
|
886
892
|
audioLevel: d,
|
|
887
893
|
onExpand: a,
|
|
888
894
|
onToggleMute: s,
|
|
889
|
-
onClose:
|
|
895
|
+
onClose: u
|
|
890
896
|
}) => t ? /* @__PURE__ */ n(
|
|
891
897
|
"div",
|
|
892
898
|
{
|
|
893
899
|
className: "ll-minimized ll-minimized--mobile",
|
|
894
900
|
role: "region",
|
|
895
901
|
"aria-label": `${r} widget`,
|
|
896
|
-
children: /* @__PURE__ */
|
|
902
|
+
children: /* @__PURE__ */ g(
|
|
897
903
|
"button",
|
|
898
904
|
{
|
|
899
905
|
type: "button",
|
|
@@ -922,18 +928,18 @@ const xr = ({
|
|
|
922
928
|
}
|
|
923
929
|
),
|
|
924
930
|
/* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
|
|
925
|
-
/* @__PURE__ */
|
|
931
|
+
/* @__PURE__ */ g("div", { className: "ll-minimized__controls", children: [
|
|
926
932
|
/* @__PURE__ */ n(
|
|
927
933
|
"span",
|
|
928
934
|
{
|
|
929
935
|
className: "ll-minimized__btn",
|
|
930
936
|
role: "button",
|
|
931
937
|
tabIndex: 0,
|
|
932
|
-
onClick: (
|
|
933
|
-
|
|
938
|
+
onClick: (y) => {
|
|
939
|
+
y.stopPropagation(), s();
|
|
934
940
|
},
|
|
935
|
-
onKeyDown: (
|
|
936
|
-
(
|
|
941
|
+
onKeyDown: (y) => {
|
|
942
|
+
(y.key === "Enter" || y.key === " ") && (y.stopPropagation(), y.preventDefault(), s());
|
|
937
943
|
},
|
|
938
944
|
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
939
945
|
children: /* @__PURE__ */ n(Zt, { muted: l, className: "ll-minimized__icon" })
|
|
@@ -952,7 +958,7 @@ const xr = ({
|
|
|
952
958
|
"data-position": e,
|
|
953
959
|
role: "region",
|
|
954
960
|
"aria-label": `${r} widget`,
|
|
955
|
-
children: /* @__PURE__ */
|
|
961
|
+
children: /* @__PURE__ */ g("div", { className: "ll-minimized__surface", children: [
|
|
956
962
|
o ? (
|
|
957
963
|
// eslint-disable-next-line @next/next/no-img-element
|
|
958
964
|
/* @__PURE__ */ n(
|
|
@@ -964,11 +970,11 @@ const xr = ({
|
|
|
964
970
|
}
|
|
965
971
|
)
|
|
966
972
|
) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
|
|
967
|
-
/* @__PURE__ */
|
|
973
|
+
/* @__PURE__ */ g("div", { className: "ll-minimized__meta", children: [
|
|
968
974
|
/* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
|
|
969
975
|
/* @__PURE__ */ n("span", { className: "ll-minimized__state", children: i === "speaking" ? "Speaking" : i === "thinking" ? "Thinking" : "Listening" })
|
|
970
976
|
] }),
|
|
971
|
-
/* @__PURE__ */
|
|
977
|
+
/* @__PURE__ */ g("div", { className: "ll-minimized__controls", children: [
|
|
972
978
|
/* @__PURE__ */ n(
|
|
973
979
|
"button",
|
|
974
980
|
{
|
|
@@ -994,7 +1000,7 @@ const xr = ({
|
|
|
994
1000
|
{
|
|
995
1001
|
type: "button",
|
|
996
1002
|
className: "ll-minimized__btn ll-minimized__btn--close",
|
|
997
|
-
onClick:
|
|
1003
|
+
onClick: u,
|
|
998
1004
|
"aria-label": "Close widget",
|
|
999
1005
|
children: /* @__PURE__ */ n(yr, { className: "ll-minimized__icon" })
|
|
1000
1006
|
}
|
|
@@ -1009,8 +1015,8 @@ const xr = ({
|
|
|
1009
1015
|
className: o,
|
|
1010
1016
|
style: i
|
|
1011
1017
|
}) => {
|
|
1012
|
-
const [l, d] = C(!1), a =
|
|
1013
|
-
if (
|
|
1018
|
+
const [l, d] = C(!1), a = N(e);
|
|
1019
|
+
if (I(() => {
|
|
1014
1020
|
a.current !== e && (a.current = e, d(!1));
|
|
1015
1021
|
}, [e]), !e) return null;
|
|
1016
1022
|
const s = {
|
|
@@ -1046,7 +1052,7 @@ const xr = ({
|
|
|
1046
1052
|
anchorRef: r,
|
|
1047
1053
|
children: o
|
|
1048
1054
|
}) => {
|
|
1049
|
-
const i =
|
|
1055
|
+
const i = N(null), [l, d] = C(null);
|
|
1050
1056
|
return hn(() => {
|
|
1051
1057
|
if (!e) {
|
|
1052
1058
|
d(null);
|
|
@@ -1055,22 +1061,22 @@ const xr = ({
|
|
|
1055
1061
|
const a = r.current;
|
|
1056
1062
|
if (!a) return;
|
|
1057
1063
|
const s = () => {
|
|
1058
|
-
const
|
|
1059
|
-
top:
|
|
1060
|
-
left:
|
|
1061
|
-
},
|
|
1062
|
-
|
|
1064
|
+
const u = a.getBoundingClientRect(), y = {
|
|
1065
|
+
top: u.top - Cr,
|
|
1066
|
+
left: u.left + u.width / 2
|
|
1067
|
+
}, f = on + 90, c = window.innerWidth - on - 90;
|
|
1068
|
+
y.left < f && (y.left = f), y.left > c && (y.left = c), d(y);
|
|
1063
1069
|
};
|
|
1064
1070
|
return s(), window.addEventListener("scroll", s, !0), window.addEventListener("resize", s), () => {
|
|
1065
1071
|
window.removeEventListener("scroll", s, !0), window.removeEventListener("resize", s);
|
|
1066
1072
|
};
|
|
1067
|
-
}, [e, r]),
|
|
1073
|
+
}, [e, r]), I(() => {
|
|
1068
1074
|
if (!e) return;
|
|
1069
|
-
const a = (
|
|
1070
|
-
const
|
|
1071
|
-
|
|
1072
|
-
}, s = (
|
|
1073
|
-
|
|
1075
|
+
const a = (u) => {
|
|
1076
|
+
const y = u.target, f = i.current, c = r.current;
|
|
1077
|
+
f && f.contains(y) || c && c.contains(y) || t();
|
|
1078
|
+
}, s = (u) => {
|
|
1079
|
+
u.key === "Escape" && (u.stopPropagation(), t());
|
|
1074
1080
|
};
|
|
1075
1081
|
return document.addEventListener("mousedown", a), document.addEventListener("keydown", s), () => {
|
|
1076
1082
|
document.removeEventListener("mousedown", a), document.removeEventListener("keydown", s);
|
|
@@ -1105,20 +1111,20 @@ const xr = ({
|
|
|
1105
1111
|
onToggleScreenShare: d,
|
|
1106
1112
|
allowScreenShare: a,
|
|
1107
1113
|
isSpeakerMuted: s,
|
|
1108
|
-
onToggleSpeaker:
|
|
1109
|
-
allowTyping:
|
|
1110
|
-
isTypingOpen:
|
|
1114
|
+
onToggleSpeaker: u,
|
|
1115
|
+
allowTyping: y,
|
|
1116
|
+
isTypingOpen: f,
|
|
1111
1117
|
onToggleTyping: c,
|
|
1112
|
-
onDisconnect:
|
|
1118
|
+
onDisconnect: A
|
|
1113
1119
|
}) => {
|
|
1114
|
-
const [
|
|
1115
|
-
return /* @__PURE__ */
|
|
1116
|
-
/* @__PURE__ */
|
|
1120
|
+
const [_, x] = C(!1), b = N(null);
|
|
1121
|
+
return /* @__PURE__ */ g(Ve, { children: [
|
|
1122
|
+
/* @__PURE__ */ g(
|
|
1117
1123
|
"div",
|
|
1118
1124
|
{
|
|
1119
1125
|
className: "ll-toolbar ll-toolbar--compact",
|
|
1120
1126
|
"data-testid": "compact-toolbar",
|
|
1121
|
-
onClick: (
|
|
1127
|
+
onClick: (v) => v.stopPropagation(),
|
|
1122
1128
|
children: [
|
|
1123
1129
|
/* @__PURE__ */ n(
|
|
1124
1130
|
"button",
|
|
@@ -1133,13 +1139,13 @@ const xr = ({
|
|
|
1133
1139
|
/* @__PURE__ */ n(
|
|
1134
1140
|
"button",
|
|
1135
1141
|
{
|
|
1136
|
-
ref:
|
|
1142
|
+
ref: b,
|
|
1137
1143
|
type: "button",
|
|
1138
|
-
className: `ll-tool ${
|
|
1139
|
-
onClick: () =>
|
|
1144
|
+
className: `ll-tool ${_ ? "is-on" : ""}`,
|
|
1145
|
+
onClick: () => x((v) => !v),
|
|
1140
1146
|
"aria-label": "More controls",
|
|
1141
1147
|
"aria-haspopup": "menu",
|
|
1142
|
-
"aria-expanded":
|
|
1148
|
+
"aria-expanded": _,
|
|
1143
1149
|
children: /* @__PURE__ */ n(Ar, {})
|
|
1144
1150
|
}
|
|
1145
1151
|
),
|
|
@@ -1148,7 +1154,7 @@ const xr = ({
|
|
|
1148
1154
|
{
|
|
1149
1155
|
type: "button",
|
|
1150
1156
|
className: "ll-tool ll-tool--danger",
|
|
1151
|
-
onClick:
|
|
1157
|
+
onClick: A,
|
|
1152
1158
|
"aria-label": "End conversation",
|
|
1153
1159
|
children: /* @__PURE__ */ n(_n, {})
|
|
1154
1160
|
}
|
|
@@ -1156,20 +1162,20 @@ const xr = ({
|
|
|
1156
1162
|
]
|
|
1157
1163
|
}
|
|
1158
1164
|
),
|
|
1159
|
-
/* @__PURE__ */
|
|
1165
|
+
/* @__PURE__ */ g(
|
|
1160
1166
|
Sr,
|
|
1161
1167
|
{
|
|
1162
|
-
open:
|
|
1163
|
-
onClose: () =>
|
|
1164
|
-
anchorRef:
|
|
1168
|
+
open: _,
|
|
1169
|
+
onClose: () => x(!1),
|
|
1170
|
+
anchorRef: b,
|
|
1165
1171
|
children: [
|
|
1166
|
-
i && /* @__PURE__ */
|
|
1172
|
+
i && /* @__PURE__ */ g(
|
|
1167
1173
|
"button",
|
|
1168
1174
|
{
|
|
1169
1175
|
type: "button",
|
|
1170
1176
|
className: `ll-overflow-popover__item ${r ? "is-on" : ""}`,
|
|
1171
1177
|
onClick: () => {
|
|
1172
|
-
o(),
|
|
1178
|
+
o(), x(!1);
|
|
1173
1179
|
},
|
|
1174
1180
|
children: [
|
|
1175
1181
|
/* @__PURE__ */ n(vn, {}),
|
|
@@ -1177,13 +1183,13 @@ const xr = ({
|
|
|
1177
1183
|
]
|
|
1178
1184
|
}
|
|
1179
1185
|
),
|
|
1180
|
-
a && /* @__PURE__ */
|
|
1186
|
+
a && /* @__PURE__ */ g(
|
|
1181
1187
|
"button",
|
|
1182
1188
|
{
|
|
1183
1189
|
type: "button",
|
|
1184
1190
|
className: `ll-overflow-popover__item ${l ? "is-on" : ""}`,
|
|
1185
1191
|
onClick: () => {
|
|
1186
|
-
d(),
|
|
1192
|
+
d(), x(!1);
|
|
1187
1193
|
},
|
|
1188
1194
|
children: [
|
|
1189
1195
|
/* @__PURE__ */ n(yn, {}),
|
|
@@ -1191,13 +1197,13 @@ const xr = ({
|
|
|
1191
1197
|
]
|
|
1192
1198
|
}
|
|
1193
1199
|
),
|
|
1194
|
-
/* @__PURE__ */
|
|
1200
|
+
/* @__PURE__ */ g(
|
|
1195
1201
|
"button",
|
|
1196
1202
|
{
|
|
1197
1203
|
type: "button",
|
|
1198
1204
|
className: `ll-overflow-popover__item ${s ? "is-on" : ""}`,
|
|
1199
1205
|
onClick: () => {
|
|
1200
|
-
|
|
1206
|
+
u(), x(!1);
|
|
1201
1207
|
},
|
|
1202
1208
|
children: [
|
|
1203
1209
|
/* @__PURE__ */ n(wn, { muted: s }),
|
|
@@ -1205,21 +1211,21 @@ const xr = ({
|
|
|
1205
1211
|
]
|
|
1206
1212
|
}
|
|
1207
1213
|
),
|
|
1208
|
-
|
|
1214
|
+
y && /* @__PURE__ */ g(
|
|
1209
1215
|
"button",
|
|
1210
1216
|
{
|
|
1211
1217
|
type: "button",
|
|
1212
|
-
className: `ll-overflow-popover__item ${
|
|
1218
|
+
className: `ll-overflow-popover__item ${f ? "is-on" : ""}`,
|
|
1213
1219
|
onClick: () => {
|
|
1214
|
-
c(),
|
|
1220
|
+
c(), x(!1);
|
|
1215
1221
|
},
|
|
1216
1222
|
children: [
|
|
1217
1223
|
/* @__PURE__ */ n(Rr, {}),
|
|
1218
|
-
/* @__PURE__ */ n("span", { children:
|
|
1224
|
+
/* @__PURE__ */ n("span", { children: f ? "Hide typing" : "Type a message" })
|
|
1219
1225
|
]
|
|
1220
1226
|
}
|
|
1221
1227
|
),
|
|
1222
|
-
/* @__PURE__ */
|
|
1228
|
+
/* @__PURE__ */ g(
|
|
1223
1229
|
"button",
|
|
1224
1230
|
{
|
|
1225
1231
|
type: "button",
|
|
@@ -1238,7 +1244,7 @@ const xr = ({
|
|
|
1238
1244
|
] });
|
|
1239
1245
|
};
|
|
1240
1246
|
function Ar() {
|
|
1241
|
-
return /* @__PURE__ */
|
|
1247
|
+
return /* @__PURE__ */ g(
|
|
1242
1248
|
"svg",
|
|
1243
1249
|
{
|
|
1244
1250
|
width: "16",
|
|
@@ -1281,39 +1287,39 @@ const Ir = ({
|
|
|
1281
1287
|
branding: d,
|
|
1282
1288
|
teamMembers: a,
|
|
1283
1289
|
currentTeamMemberId: s,
|
|
1284
|
-
isSwitchingTeamMember:
|
|
1285
|
-
teamSwitcherOpen:
|
|
1286
|
-
onToggleTeamSwitcher:
|
|
1290
|
+
isSwitchingTeamMember: u,
|
|
1291
|
+
teamSwitcherOpen: y,
|
|
1292
|
+
onToggleTeamSwitcher: f,
|
|
1287
1293
|
onSelectTeamMember: c,
|
|
1288
|
-
languageMenuOpen:
|
|
1289
|
-
onToggleLanguageMenu:
|
|
1290
|
-
connectionState:
|
|
1291
|
-
agentState:
|
|
1292
|
-
transcript:
|
|
1293
|
-
canResume:
|
|
1294
|
-
needsUserGesture:
|
|
1294
|
+
languageMenuOpen: A,
|
|
1295
|
+
onToggleLanguageMenu: _,
|
|
1296
|
+
connectionState: x,
|
|
1297
|
+
agentState: b,
|
|
1298
|
+
transcript: v,
|
|
1299
|
+
canResume: S,
|
|
1300
|
+
needsUserGesture: M,
|
|
1295
1301
|
error: D,
|
|
1296
|
-
isMuted:
|
|
1302
|
+
isMuted: k,
|
|
1297
1303
|
micError: R,
|
|
1298
1304
|
micDevices: B,
|
|
1299
1305
|
activeMicId: q,
|
|
1300
|
-
isCameraEnabled:
|
|
1301
|
-
cameraPreviewEl:
|
|
1302
|
-
cameraDevices:
|
|
1303
|
-
activeCameraId:
|
|
1304
|
-
isScreenShareEnabled:
|
|
1305
|
-
screenPreviewEl:
|
|
1306
|
-
isSpeakerMuted:
|
|
1306
|
+
isCameraEnabled: F,
|
|
1307
|
+
cameraPreviewEl: U,
|
|
1308
|
+
cameraDevices: O,
|
|
1309
|
+
activeCameraId: j,
|
|
1310
|
+
isScreenShareEnabled: H,
|
|
1311
|
+
screenPreviewEl: G,
|
|
1312
|
+
isSpeakerMuted: le,
|
|
1307
1313
|
allowCamera: fe,
|
|
1308
1314
|
allowScreenShare: ye,
|
|
1309
1315
|
allowTyping: pe,
|
|
1310
1316
|
showMinimize: ve = !0,
|
|
1311
1317
|
chromeless: he = !1,
|
|
1312
|
-
compactControls:
|
|
1318
|
+
compactControls: ne = !1,
|
|
1313
1319
|
transforming: ut,
|
|
1314
1320
|
transformingLabel: Ge,
|
|
1315
1321
|
avatarVideoContainerRef: ft,
|
|
1316
|
-
agentVideoEl:
|
|
1322
|
+
agentVideoEl: ae,
|
|
1317
1323
|
onConnect: Je,
|
|
1318
1324
|
onDisconnect: Ke,
|
|
1319
1325
|
onRetry: pt,
|
|
@@ -1325,87 +1331,87 @@ const Ir = ({
|
|
|
1325
1331
|
onToggleScreenShare: Ne,
|
|
1326
1332
|
onToggleSpeaker: Ae,
|
|
1327
1333
|
onSendMessage: Re,
|
|
1328
|
-
onMinimize:
|
|
1334
|
+
onMinimize: P,
|
|
1329
1335
|
onClose: ht,
|
|
1330
1336
|
onClearMicError: xt
|
|
1331
1337
|
}) => {
|
|
1332
1338
|
var De;
|
|
1333
|
-
const Ie = ((a == null ? void 0 : a.length) ?? 0) > 1, Me =
|
|
1334
|
-
|
|
1335
|
-
if (!
|
|
1339
|
+
const Ie = ((a == null ? void 0 : a.length) ?? 0) > 1, Me = x === "connecting" || x === "connected", re = x === "connected", Qe = x === "idle" || x === "disconnected" || x === "error", [Ze, ze] = C(!1);
|
|
1340
|
+
I(() => {
|
|
1341
|
+
if (!ae) {
|
|
1336
1342
|
ze(!1);
|
|
1337
1343
|
return;
|
|
1338
1344
|
}
|
|
1339
|
-
if (!
|
|
1345
|
+
if (!ae.paused && ae.readyState >= 2) {
|
|
1340
1346
|
ze(!0);
|
|
1341
1347
|
return;
|
|
1342
1348
|
}
|
|
1343
1349
|
ze(!1);
|
|
1344
1350
|
const h = () => ze(!0);
|
|
1345
|
-
return
|
|
1346
|
-
|
|
1351
|
+
return ae.addEventListener("playing", h), ae.addEventListener("loadeddata", h), () => {
|
|
1352
|
+
ae.removeEventListener("playing", h), ae.removeEventListener("loadeddata", h);
|
|
1347
1353
|
};
|
|
1348
|
-
}, [
|
|
1349
|
-
const [Te,
|
|
1350
|
-
|
|
1351
|
-
if (!
|
|
1352
|
-
|
|
1354
|
+
}, [ae]);
|
|
1355
|
+
const [Te, ee] = C(!1);
|
|
1356
|
+
I(() => {
|
|
1357
|
+
if (!re) {
|
|
1358
|
+
ee(!1);
|
|
1353
1359
|
return;
|
|
1354
1360
|
}
|
|
1355
1361
|
if (Ze) return;
|
|
1356
|
-
const h = setTimeout(() =>
|
|
1362
|
+
const h = setTimeout(() => ee(!0), 8e3);
|
|
1357
1363
|
return () => clearTimeout(h);
|
|
1358
|
-
}, [
|
|
1359
|
-
const mt =
|
|
1360
|
-
|
|
1364
|
+
}, [re, Ze]);
|
|
1365
|
+
const mt = x === "connecting" || re && !!o && !Ze && !Te, et = N(null), oe = N(null);
|
|
1366
|
+
I(() => {
|
|
1361
1367
|
const h = et.current;
|
|
1362
|
-
h && (h.innerHTML = "",
|
|
1363
|
-
}, [
|
|
1364
|
-
const h =
|
|
1365
|
-
h && (h.innerHTML = "",
|
|
1366
|
-
}, [
|
|
1367
|
-
const [
|
|
1368
|
-
|
|
1369
|
-
if (!
|
|
1368
|
+
h && (h.innerHTML = "", U && (U.style.width = "100%", U.style.height = "100%", U.style.objectFit = "cover", U.style.transform = "scaleX(-1)", h.appendChild(U)));
|
|
1369
|
+
}, [U]), I(() => {
|
|
1370
|
+
const h = oe.current;
|
|
1371
|
+
h && (h.innerHTML = "", G && (G.style.width = "100%", G.style.height = "100%", G.style.objectFit = "contain", h.appendChild(G)));
|
|
1372
|
+
}, [G]);
|
|
1373
|
+
const [ie, se] = C(!1), [be, X] = C(!1), de = N(null), we = N(null);
|
|
1374
|
+
I(() => {
|
|
1375
|
+
if (!ie && !be && !A && !y) return;
|
|
1370
1376
|
const h = () => {
|
|
1371
|
-
se(!1),
|
|
1377
|
+
se(!1), X(!1), A && _(), y && f();
|
|
1372
1378
|
};
|
|
1373
1379
|
return document.addEventListener("click", h), () => document.removeEventListener("click", h);
|
|
1374
1380
|
}, [
|
|
1375
|
-
|
|
1381
|
+
ie,
|
|
1376
1382
|
be,
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1383
|
+
A,
|
|
1384
|
+
y,
|
|
1385
|
+
_,
|
|
1386
|
+
f
|
|
1381
1387
|
]);
|
|
1382
1388
|
const [Oe, kt] = C(!1), tt = E(() => kt((h) => !h), []), [_e, nt] = C(""), rt = E(
|
|
1383
1389
|
(h) => {
|
|
1384
1390
|
h.preventDefault();
|
|
1385
|
-
const
|
|
1386
|
-
|
|
1391
|
+
const J = _e.trim();
|
|
1392
|
+
J && (Re(J), nt(""));
|
|
1387
1393
|
},
|
|
1388
1394
|
[_e, Re]
|
|
1389
1395
|
), ot = d.productName || "Live Layer";
|
|
1390
1396
|
let xe = null, ke = null;
|
|
1391
|
-
for (let h =
|
|
1392
|
-
const
|
|
1393
|
-
if (!xe &&
|
|
1397
|
+
for (let h = v.length - 1; h >= 0; h--) {
|
|
1398
|
+
const J = v[h];
|
|
1399
|
+
if (!xe && J.role === "agent" ? xe = J : !ke && J.role === "user" && (ke = J), xe && ke) break;
|
|
1394
1400
|
}
|
|
1395
|
-
const He =
|
|
1401
|
+
const He = re ? (xe == null ? void 0 : xe.text) || null : l || null, gt = re && (ke == null ? void 0 : ke.text) || null, We = [
|
|
1396
1402
|
"ll-expanded",
|
|
1397
1403
|
t ? "ll-expanded--mobile" : "ll-expanded--desktop"
|
|
1398
1404
|
].join(" ");
|
|
1399
|
-
return /* @__PURE__ */
|
|
1405
|
+
return /* @__PURE__ */ g(
|
|
1400
1406
|
"div",
|
|
1401
1407
|
{
|
|
1402
1408
|
className: We,
|
|
1403
1409
|
"data-position": e,
|
|
1404
|
-
"data-state":
|
|
1410
|
+
"data-state": re ? "connected" : Me ? "connecting" : "idle",
|
|
1405
1411
|
role: "dialog",
|
|
1406
1412
|
"aria-label": `${r} widget`,
|
|
1407
1413
|
children: [
|
|
1408
|
-
/* @__PURE__ */
|
|
1414
|
+
/* @__PURE__ */ g("div", { className: "ll-expanded__bg", children: [
|
|
1409
1415
|
o ? /* @__PURE__ */ n(
|
|
1410
1416
|
Er,
|
|
1411
1417
|
{
|
|
@@ -1414,7 +1420,7 @@ const Ir = ({
|
|
|
1414
1420
|
className: "ll-expanded__bg-img"
|
|
1415
1421
|
}
|
|
1416
1422
|
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((De = r == null ? void 0 : r.charAt(0)) == null ? void 0 : De.toUpperCase()) || "A" }) }),
|
|
1417
|
-
i && !
|
|
1423
|
+
i && !re && /* @__PURE__ */ n(
|
|
1418
1424
|
"video",
|
|
1419
1425
|
{
|
|
1420
1426
|
className: "ll-expanded__bg-idle",
|
|
@@ -1427,11 +1433,11 @@ const Ir = ({
|
|
|
1427
1433
|
)
|
|
1428
1434
|
] }),
|
|
1429
1435
|
/* @__PURE__ */ n("div", { ref: ft, className: "ll-expanded__video" }),
|
|
1430
|
-
mt && /* @__PURE__ */
|
|
1436
|
+
mt && /* @__PURE__ */ g("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
|
|
1431
1437
|
/* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
|
|
1432
|
-
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children:
|
|
1438
|
+
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: u ? "Switching..." : "Connecting..." })
|
|
1433
1439
|
] }),
|
|
1434
|
-
|
|
1440
|
+
M && re && /* @__PURE__ */ g(
|
|
1435
1441
|
"button",
|
|
1436
1442
|
{
|
|
1437
1443
|
type: "button",
|
|
@@ -1443,7 +1449,7 @@ const Ir = ({
|
|
|
1443
1449
|
]
|
|
1444
1450
|
}
|
|
1445
1451
|
),
|
|
1446
|
-
ut && /* @__PURE__ */
|
|
1452
|
+
ut && /* @__PURE__ */ g(
|
|
1447
1453
|
"div",
|
|
1448
1454
|
{
|
|
1449
1455
|
className: "ll-expanded__overlay ll-expanded__overlay--transforming",
|
|
@@ -1456,33 +1462,33 @@ const Ir = ({
|
|
|
1456
1462
|
]
|
|
1457
1463
|
}
|
|
1458
1464
|
),
|
|
1459
|
-
Me ? /* @__PURE__ */
|
|
1460
|
-
!
|
|
1461
|
-
!he && /* @__PURE__ */
|
|
1462
|
-
/* @__PURE__ */
|
|
1463
|
-
/* @__PURE__ */
|
|
1465
|
+
Me ? /* @__PURE__ */ g(Ve, { children: [
|
|
1466
|
+
!ne && /* @__PURE__ */ g("div", { className: "ll-expanded__topbar", children: [
|
|
1467
|
+
!he && /* @__PURE__ */ g("div", { className: "ll-expanded__topbar-left", children: [
|
|
1468
|
+
/* @__PURE__ */ g("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1469
|
+
/* @__PURE__ */ g(
|
|
1464
1470
|
"button",
|
|
1465
1471
|
{
|
|
1466
1472
|
type: "button",
|
|
1467
1473
|
className: "ll-hpill",
|
|
1468
1474
|
onClick: (h) => {
|
|
1469
|
-
Ie && (h.stopPropagation(),
|
|
1475
|
+
Ie && (h.stopPropagation(), f());
|
|
1470
1476
|
},
|
|
1471
1477
|
"aria-haspopup": Ie ? "listbox" : void 0,
|
|
1472
|
-
"aria-expanded": Ie ?
|
|
1478
|
+
"aria-expanded": Ie ? y : void 0,
|
|
1473
1479
|
children: [
|
|
1474
1480
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
|
|
1475
1481
|
Ie && /* @__PURE__ */ n(vt, {})
|
|
1476
1482
|
]
|
|
1477
1483
|
}
|
|
1478
1484
|
),
|
|
1479
|
-
Ie &&
|
|
1485
|
+
Ie && y && /* @__PURE__ */ n(
|
|
1480
1486
|
"div",
|
|
1481
1487
|
{
|
|
1482
1488
|
className: "ll-hmenu",
|
|
1483
1489
|
onClick: (h) => h.stopPropagation(),
|
|
1484
1490
|
role: "listbox",
|
|
1485
|
-
children: a == null ? void 0 : a.map((h) => /* @__PURE__ */
|
|
1491
|
+
children: a == null ? void 0 : a.map((h) => /* @__PURE__ */ g(
|
|
1486
1492
|
"button",
|
|
1487
1493
|
{
|
|
1488
1494
|
type: "button",
|
|
@@ -1508,17 +1514,17 @@ const Ir = ({
|
|
|
1508
1514
|
}
|
|
1509
1515
|
)
|
|
1510
1516
|
] }),
|
|
1511
|
-
/* @__PURE__ */
|
|
1512
|
-
/* @__PURE__ */
|
|
1517
|
+
/* @__PURE__ */ g("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1518
|
+
/* @__PURE__ */ g(
|
|
1513
1519
|
"button",
|
|
1514
1520
|
{
|
|
1515
1521
|
type: "button",
|
|
1516
1522
|
className: "ll-hpill ll-hpill--compact",
|
|
1517
1523
|
onClick: (h) => {
|
|
1518
|
-
h.stopPropagation(),
|
|
1524
|
+
h.stopPropagation(), _();
|
|
1519
1525
|
},
|
|
1520
1526
|
"aria-haspopup": "listbox",
|
|
1521
|
-
"aria-expanded":
|
|
1527
|
+
"aria-expanded": A,
|
|
1522
1528
|
"aria-label": "Language: English",
|
|
1523
1529
|
title: "Language: English",
|
|
1524
1530
|
children: [
|
|
@@ -1527,7 +1533,7 @@ const Ir = ({
|
|
|
1527
1533
|
]
|
|
1528
1534
|
}
|
|
1529
1535
|
),
|
|
1530
|
-
|
|
1536
|
+
A && /* @__PURE__ */ n(
|
|
1531
1537
|
"div",
|
|
1532
1538
|
{
|
|
1533
1539
|
className: "ll-hmenu",
|
|
@@ -1549,18 +1555,18 @@ const Ir = ({
|
|
|
1549
1555
|
/* @__PURE__ */ n(
|
|
1550
1556
|
"span",
|
|
1551
1557
|
{
|
|
1552
|
-
className: `ll-expanded__state ll-expanded__state--${
|
|
1553
|
-
children:
|
|
1558
|
+
className: `ll-expanded__state ll-expanded__state--${b}`,
|
|
1559
|
+
children: b
|
|
1554
1560
|
}
|
|
1555
1561
|
)
|
|
1556
1562
|
] }),
|
|
1557
|
-
/* @__PURE__ */
|
|
1563
|
+
/* @__PURE__ */ g("div", { className: "ll-expanded__header-actions", children: [
|
|
1558
1564
|
ve !== !1 && /* @__PURE__ */ n(
|
|
1559
1565
|
"button",
|
|
1560
1566
|
{
|
|
1561
1567
|
type: "button",
|
|
1562
1568
|
className: "ll-hbtn",
|
|
1563
|
-
onClick:
|
|
1569
|
+
onClick: P,
|
|
1564
1570
|
"aria-label": "Minimize widget",
|
|
1565
1571
|
title: "Minimize",
|
|
1566
1572
|
children: /* @__PURE__ */ n(an, {})
|
|
@@ -1579,24 +1585,24 @@ const Ir = ({
|
|
|
1579
1585
|
)
|
|
1580
1586
|
] })
|
|
1581
1587
|
] }),
|
|
1582
|
-
|
|
1588
|
+
ne && /* @__PURE__ */ g("div", { className: "ll-compact-status", "data-state": b, children: [
|
|
1583
1589
|
/* @__PURE__ */ n("span", { className: "ll-compact-status__dot", "aria-hidden": !0 }),
|
|
1584
|
-
/* @__PURE__ */ n("span", { className: "ll-compact-status__label", children:
|
|
1590
|
+
/* @__PURE__ */ n("span", { className: "ll-compact-status__label", children: b })
|
|
1585
1591
|
] })
|
|
1586
1592
|
] }) : (
|
|
1587
1593
|
// Idle-state header with Live Layer product name + minimize/close.
|
|
1588
1594
|
// Hidden in compact mode — on a 140×210 docked slot the brand pill
|
|
1589
1595
|
// and 40px buttons crowded out the central "Start video call"
|
|
1590
1596
|
// affordance. The user can dismiss by scrolling past the slot.
|
|
1591
|
-
!
|
|
1597
|
+
!ne && /* @__PURE__ */ g("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
|
|
1592
1598
|
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: ot }),
|
|
1593
|
-
/* @__PURE__ */
|
|
1599
|
+
/* @__PURE__ */ g("div", { className: "ll-expanded__header-actions", children: [
|
|
1594
1600
|
ve !== !1 && /* @__PURE__ */ n(
|
|
1595
1601
|
"button",
|
|
1596
1602
|
{
|
|
1597
1603
|
type: "button",
|
|
1598
1604
|
className: "ll-hbtn ll-hbtn--ghost",
|
|
1599
|
-
onClick:
|
|
1605
|
+
onClick: P,
|
|
1600
1606
|
"aria-label": "Minimize widget",
|
|
1601
1607
|
children: /* @__PURE__ */ n(an, {})
|
|
1602
1608
|
}
|
|
@@ -1615,9 +1621,9 @@ const Ir = ({
|
|
|
1615
1621
|
] })
|
|
1616
1622
|
),
|
|
1617
1623
|
Qe && /* @__PURE__ */ (() => {
|
|
1618
|
-
const h =
|
|
1619
|
-
return /* @__PURE__ */
|
|
1620
|
-
!D && /* @__PURE__ */
|
|
1624
|
+
const h = S ? "Resume session" : x === "disconnected" ? "Reconnect to agent" : "Start video call";
|
|
1625
|
+
return /* @__PURE__ */ g(Ve, { children: [
|
|
1626
|
+
!D && /* @__PURE__ */ g(
|
|
1621
1627
|
"button",
|
|
1622
1628
|
{
|
|
1623
1629
|
type: "button",
|
|
@@ -1626,11 +1632,11 @@ const Ir = ({
|
|
|
1626
1632
|
"aria-label": h,
|
|
1627
1633
|
children: [
|
|
1628
1634
|
/* @__PURE__ */ n("div", { className: "ll-expanded__play-circle", children: /* @__PURE__ */ n("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("polygon", { points: "6 3 20 12 6 21 6 3" }) }) }),
|
|
1629
|
-
|
|
1635
|
+
ne && /* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: h })
|
|
1630
1636
|
]
|
|
1631
1637
|
}
|
|
1632
1638
|
),
|
|
1633
|
-
!
|
|
1639
|
+
!ne && /* @__PURE__ */ g("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
|
|
1634
1640
|
l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
|
|
1635
1641
|
/* @__PURE__ */ n(
|
|
1636
1642
|
"button",
|
|
@@ -1645,30 +1651,30 @@ const Ir = ({
|
|
|
1645
1651
|
] })
|
|
1646
1652
|
] });
|
|
1647
1653
|
})(),
|
|
1648
|
-
/* @__PURE__ */
|
|
1654
|
+
/* @__PURE__ */ g(
|
|
1649
1655
|
"div",
|
|
1650
1656
|
{
|
|
1651
|
-
className: `ll-expanded__pip ${Me && (
|
|
1657
|
+
className: `ll-expanded__pip ${Me && (F || H) ? "is-visible" : ""}`,
|
|
1652
1658
|
children: [
|
|
1653
1659
|
/* @__PURE__ */ n(
|
|
1654
1660
|
"div",
|
|
1655
1661
|
{
|
|
1656
|
-
ref:
|
|
1657
|
-
className:
|
|
1662
|
+
ref: oe,
|
|
1663
|
+
className: H ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1658
1664
|
}
|
|
1659
1665
|
),
|
|
1660
1666
|
/* @__PURE__ */ n(
|
|
1661
1667
|
"div",
|
|
1662
1668
|
{
|
|
1663
1669
|
ref: et,
|
|
1664
|
-
className: !
|
|
1670
|
+
className: !H && F ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1665
1671
|
}
|
|
1666
1672
|
)
|
|
1667
1673
|
]
|
|
1668
1674
|
}
|
|
1669
1675
|
),
|
|
1670
|
-
Me ? /* @__PURE__ */
|
|
1671
|
-
!
|
|
1676
|
+
Me ? /* @__PURE__ */ g("div", { className: "ll-expanded__bottom", children: [
|
|
1677
|
+
!ne && He && /* @__PURE__ */ n(
|
|
1672
1678
|
"div",
|
|
1673
1679
|
{
|
|
1674
1680
|
className: "ll-expanded__transcript ll-expanded__transcript--agent",
|
|
@@ -1676,7 +1682,7 @@ const Ir = ({
|
|
|
1676
1682
|
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: He })
|
|
1677
1683
|
}
|
|
1678
1684
|
),
|
|
1679
|
-
!
|
|
1685
|
+
!ne && gt && /* @__PURE__ */ n(
|
|
1680
1686
|
"div",
|
|
1681
1687
|
{
|
|
1682
1688
|
className: "ll-expanded__transcript ll-expanded__transcript--user",
|
|
@@ -1684,27 +1690,27 @@ const Ir = ({
|
|
|
1684
1690
|
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: gt })
|
|
1685
1691
|
}
|
|
1686
1692
|
),
|
|
1687
|
-
!he && !
|
|
1693
|
+
!he && !ne && /* @__PURE__ */ g("div", { className: "ll-toolbar", onClick: (h) => h.stopPropagation(), children: [
|
|
1688
1694
|
ye && /* @__PURE__ */ n(
|
|
1689
1695
|
"button",
|
|
1690
1696
|
{
|
|
1691
1697
|
type: "button",
|
|
1692
|
-
className: `ll-tool ${
|
|
1698
|
+
className: `ll-tool ${H ? "is-on" : ""}`,
|
|
1693
1699
|
onClick: Ne,
|
|
1694
|
-
"aria-label":
|
|
1695
|
-
title:
|
|
1700
|
+
"aria-label": H ? "Stop sharing screen" : "Share screen",
|
|
1701
|
+
title: H ? "Stop sharing" : "Share screen",
|
|
1696
1702
|
children: /* @__PURE__ */ n(yn, {})
|
|
1697
1703
|
}
|
|
1698
1704
|
),
|
|
1699
|
-
fe && /* @__PURE__ */
|
|
1705
|
+
fe && /* @__PURE__ */ g("div", { className: "ll-tool-split", children: [
|
|
1700
1706
|
/* @__PURE__ */ n(
|
|
1701
1707
|
"button",
|
|
1702
1708
|
{
|
|
1703
1709
|
type: "button",
|
|
1704
|
-
className: `ll-tool ll-tool--left ${
|
|
1710
|
+
className: `ll-tool ll-tool--left ${F ? "is-on" : ""}`,
|
|
1705
1711
|
onClick: Se,
|
|
1706
|
-
"aria-label":
|
|
1707
|
-
title:
|
|
1712
|
+
"aria-label": F ? "Turn off camera" : "Turn on camera",
|
|
1713
|
+
title: F ? "Stop camera" : "Start camera",
|
|
1708
1714
|
children: /* @__PURE__ */ n(vn, {})
|
|
1709
1715
|
}
|
|
1710
1716
|
),
|
|
@@ -1713,9 +1719,9 @@ const Ir = ({
|
|
|
1713
1719
|
{
|
|
1714
1720
|
ref: we,
|
|
1715
1721
|
type: "button",
|
|
1716
|
-
className: `ll-tool ll-tool--right ${
|
|
1722
|
+
className: `ll-tool ll-tool--right ${F ? "is-on" : ""}`,
|
|
1717
1723
|
onClick: (h) => {
|
|
1718
|
-
h.stopPropagation(),
|
|
1724
|
+
h.stopPropagation(), X((J) => !J), se(!1);
|
|
1719
1725
|
},
|
|
1720
1726
|
"aria-label": "Camera devices",
|
|
1721
1727
|
"aria-haspopup": "listbox",
|
|
@@ -1723,29 +1729,29 @@ const Ir = ({
|
|
|
1723
1729
|
children: /* @__PURE__ */ n(vt, {})
|
|
1724
1730
|
}
|
|
1725
1731
|
),
|
|
1726
|
-
be &&
|
|
1732
|
+
be && O.length > 0 && /* @__PURE__ */ n(
|
|
1727
1733
|
cn,
|
|
1728
1734
|
{
|
|
1729
1735
|
label: "Camera",
|
|
1730
|
-
devices:
|
|
1731
|
-
activeId:
|
|
1736
|
+
devices: O,
|
|
1737
|
+
activeId: j,
|
|
1732
1738
|
anchorRef: we,
|
|
1733
1739
|
onPick: (h) => {
|
|
1734
|
-
|
|
1740
|
+
X(!1), $e(h);
|
|
1735
1741
|
}
|
|
1736
1742
|
}
|
|
1737
1743
|
)
|
|
1738
1744
|
] }),
|
|
1739
|
-
/* @__PURE__ */
|
|
1745
|
+
/* @__PURE__ */ g("div", { className: "ll-tool-split", children: [
|
|
1740
1746
|
/* @__PURE__ */ n(
|
|
1741
1747
|
"button",
|
|
1742
1748
|
{
|
|
1743
1749
|
type: "button",
|
|
1744
|
-
className: `ll-tool ll-tool--left ${
|
|
1750
|
+
className: `ll-tool ll-tool--left ${k ? "is-muted" : ""}`,
|
|
1745
1751
|
onClick: Ce,
|
|
1746
|
-
"aria-label":
|
|
1747
|
-
title:
|
|
1748
|
-
children: /* @__PURE__ */ n(bn, { muted:
|
|
1752
|
+
"aria-label": k ? "Unmute microphone" : "Mute microphone",
|
|
1753
|
+
title: k ? "Unmute" : "Mute",
|
|
1754
|
+
children: /* @__PURE__ */ n(bn, { muted: k })
|
|
1749
1755
|
}
|
|
1750
1756
|
),
|
|
1751
1757
|
/* @__PURE__ */ n(
|
|
@@ -1753,17 +1759,17 @@ const Ir = ({
|
|
|
1753
1759
|
{
|
|
1754
1760
|
ref: de,
|
|
1755
1761
|
type: "button",
|
|
1756
|
-
className: `ll-tool ll-tool--right ${
|
|
1762
|
+
className: `ll-tool ll-tool--right ${k ? "is-muted" : ""}`,
|
|
1757
1763
|
onClick: (h) => {
|
|
1758
|
-
h.stopPropagation(), se((
|
|
1764
|
+
h.stopPropagation(), se((J) => !J), X(!1);
|
|
1759
1765
|
},
|
|
1760
1766
|
"aria-label": "Microphone devices",
|
|
1761
1767
|
"aria-haspopup": "listbox",
|
|
1762
|
-
"aria-expanded":
|
|
1768
|
+
"aria-expanded": ie,
|
|
1763
1769
|
children: /* @__PURE__ */ n(vt, {})
|
|
1764
1770
|
}
|
|
1765
1771
|
),
|
|
1766
|
-
|
|
1772
|
+
ie && B.length > 0 && /* @__PURE__ */ n(
|
|
1767
1773
|
cn,
|
|
1768
1774
|
{
|
|
1769
1775
|
label: "Microphone",
|
|
@@ -1780,11 +1786,11 @@ const Ir = ({
|
|
|
1780
1786
|
"button",
|
|
1781
1787
|
{
|
|
1782
1788
|
type: "button",
|
|
1783
|
-
className: `ll-tool ${
|
|
1789
|
+
className: `ll-tool ${le ? "is-muted" : ""}`,
|
|
1784
1790
|
onClick: Ae,
|
|
1785
|
-
"aria-label":
|
|
1786
|
-
title:
|
|
1787
|
-
children: /* @__PURE__ */ n(wn, { muted:
|
|
1791
|
+
"aria-label": le ? "Unmute speaker" : "Mute speaker",
|
|
1792
|
+
title: le ? "Unmute speaker" : "Mute speaker",
|
|
1793
|
+
children: /* @__PURE__ */ n(wn, { muted: le })
|
|
1788
1794
|
}
|
|
1789
1795
|
),
|
|
1790
1796
|
/* @__PURE__ */ n(
|
|
@@ -1799,18 +1805,18 @@ const Ir = ({
|
|
|
1799
1805
|
}
|
|
1800
1806
|
)
|
|
1801
1807
|
] }),
|
|
1802
|
-
!he &&
|
|
1808
|
+
!he && ne && /* @__PURE__ */ n(
|
|
1803
1809
|
Nr,
|
|
1804
1810
|
{
|
|
1805
|
-
isMuted:
|
|
1811
|
+
isMuted: k,
|
|
1806
1812
|
onToggleMute: Ce,
|
|
1807
|
-
isCameraEnabled:
|
|
1813
|
+
isCameraEnabled: F,
|
|
1808
1814
|
onToggleCamera: Se,
|
|
1809
1815
|
allowCamera: fe,
|
|
1810
|
-
isScreenShareEnabled:
|
|
1816
|
+
isScreenShareEnabled: H,
|
|
1811
1817
|
onToggleScreenShare: Ne,
|
|
1812
1818
|
allowScreenShare: ye,
|
|
1813
|
-
isSpeakerMuted:
|
|
1819
|
+
isSpeakerMuted: le,
|
|
1814
1820
|
onToggleSpeaker: Ae,
|
|
1815
1821
|
allowTyping: pe,
|
|
1816
1822
|
isTypingOpen: Oe,
|
|
@@ -1818,7 +1824,7 @@ const Ir = ({
|
|
|
1818
1824
|
onDisconnect: Ke
|
|
1819
1825
|
}
|
|
1820
1826
|
),
|
|
1821
|
-
!he && pe && (
|
|
1827
|
+
!he && pe && (ne ? Oe : !0) && /* @__PURE__ */ g("form", { className: "ll-message-input", onSubmit: rt, children: [
|
|
1822
1828
|
/* @__PURE__ */ n(
|
|
1823
1829
|
"input",
|
|
1824
1830
|
{
|
|
@@ -1842,8 +1848,8 @@ const Ir = ({
|
|
|
1842
1848
|
] })
|
|
1843
1849
|
] }) : null,
|
|
1844
1850
|
(() => {
|
|
1845
|
-
if (R &&
|
|
1846
|
-
return /* @__PURE__ */
|
|
1851
|
+
if (R && x !== "error")
|
|
1852
|
+
return /* @__PURE__ */ g("div", { className: "ll-expanded__banner", role: "alert", children: [
|
|
1847
1853
|
/* @__PURE__ */ n("span", { children: R }),
|
|
1848
1854
|
/* @__PURE__ */ n(
|
|
1849
1855
|
"button",
|
|
@@ -1856,9 +1862,9 @@ const Ir = ({
|
|
|
1856
1862
|
}
|
|
1857
1863
|
)
|
|
1858
1864
|
] });
|
|
1859
|
-
if (!D ||
|
|
1860
|
-
let h = "Failed to connect",
|
|
1861
|
-
return D === "MIC_PERMISSION_DENIED" ? h = "Microphone blocked. Allow access to talk." : D === "MIC_NOT_FOUND" ? h = "No microphone found. Plug one in + retry." : D === "MIC_UNAVAILABLE" ? h = "Mic unavailable. Check other apps using it." : D === "AGENT_TIMEOUT" ? h = "Agent didn't pick up. Try again." : D === "CONNECT_FAILED" ? h = "Connection failed. Check your network." : D.length < 80 && (h = D), /* @__PURE__ */
|
|
1865
|
+
if (!D || x !== "error") return null;
|
|
1866
|
+
let h = "Failed to connect", J = "Try again";
|
|
1867
|
+
return D === "MIC_PERMISSION_DENIED" ? h = "Microphone blocked. Allow access to talk." : D === "MIC_NOT_FOUND" ? h = "No microphone found. Plug one in + retry." : D === "MIC_UNAVAILABLE" ? h = "Mic unavailable. Check other apps using it." : D === "AGENT_TIMEOUT" ? h = "Agent didn't pick up. Try again." : D === "CONNECT_FAILED" ? h = "Connection failed. Check your network." : D.length < 80 && (h = D), /* @__PURE__ */ g("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
|
|
1862
1868
|
/* @__PURE__ */ n("span", { children: h }),
|
|
1863
1869
|
/* @__PURE__ */ n(
|
|
1864
1870
|
"button",
|
|
@@ -1866,7 +1872,7 @@ const Ir = ({
|
|
|
1866
1872
|
type: "button",
|
|
1867
1873
|
className: "ll-expanded__banner-retry",
|
|
1868
1874
|
onClick: pt,
|
|
1869
|
-
children:
|
|
1875
|
+
children: J
|
|
1870
1876
|
}
|
|
1871
1877
|
)
|
|
1872
1878
|
] });
|
|
@@ -1879,7 +1885,7 @@ function vt() {
|
|
|
1879
1885
|
return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ n("polyline", { points: "6 9 12 15 18 9" }) });
|
|
1880
1886
|
}
|
|
1881
1887
|
function ln() {
|
|
1882
|
-
return /* @__PURE__ */
|
|
1888
|
+
return /* @__PURE__ */ g("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: [
|
|
1883
1889
|
/* @__PURE__ */ n("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1884
1890
|
/* @__PURE__ */ n("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1885
1891
|
] });
|
|
@@ -1888,20 +1894,20 @@ function an() {
|
|
|
1888
1894
|
return /* @__PURE__ */ n("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", "aria-hidden": !0, children: /* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
|
|
1889
1895
|
}
|
|
1890
1896
|
function yn() {
|
|
1891
|
-
return /* @__PURE__ */
|
|
1897
|
+
return /* @__PURE__ */ g("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: [
|
|
1892
1898
|
/* @__PURE__ */ n("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
|
|
1893
1899
|
/* @__PURE__ */ n("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
|
|
1894
1900
|
/* @__PURE__ */ n("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
|
|
1895
1901
|
] });
|
|
1896
1902
|
}
|
|
1897
1903
|
function vn() {
|
|
1898
|
-
return /* @__PURE__ */
|
|
1904
|
+
return /* @__PURE__ */ g("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: [
|
|
1899
1905
|
/* @__PURE__ */ n("path", { d: "M23 7l-7 5 7 5V7z" }),
|
|
1900
1906
|
/* @__PURE__ */ n("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
|
|
1901
1907
|
] });
|
|
1902
1908
|
}
|
|
1903
1909
|
function bn({ muted: e }) {
|
|
1904
|
-
return /* @__PURE__ */
|
|
1910
|
+
return /* @__PURE__ */ g("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: [
|
|
1905
1911
|
/* @__PURE__ */ n("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
|
|
1906
1912
|
/* @__PURE__ */ n("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
|
|
1907
1913
|
/* @__PURE__ */ n("line", { x1: "12", y1: "19", x2: "12", y2: "23" }),
|
|
@@ -1909,16 +1915,16 @@ function bn({ muted: e }) {
|
|
|
1909
1915
|
] });
|
|
1910
1916
|
}
|
|
1911
1917
|
function wn({ muted: e }) {
|
|
1912
|
-
return /* @__PURE__ */
|
|
1918
|
+
return /* @__PURE__ */ g("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: [
|
|
1913
1919
|
/* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
1914
|
-
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */
|
|
1920
|
+
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ g(Ve, { children: [
|
|
1915
1921
|
/* @__PURE__ */ n("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
|
|
1916
1922
|
/* @__PURE__ */ n("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
|
|
1917
1923
|
] })
|
|
1918
1924
|
] });
|
|
1919
1925
|
}
|
|
1920
1926
|
function Mr() {
|
|
1921
|
-
return /* @__PURE__ */
|
|
1927
|
+
return /* @__PURE__ */ g("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": !0, children: [
|
|
1922
1928
|
/* @__PURE__ */ n("line", { x1: "5", y1: "12", x2: "19", y2: "12" }),
|
|
1923
1929
|
/* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
|
|
1924
1930
|
] });
|
|
@@ -1944,17 +1950,17 @@ const cn = ({
|
|
|
1944
1950
|
const a = () => {
|
|
1945
1951
|
const s = i.current;
|
|
1946
1952
|
if (!s) return;
|
|
1947
|
-
const
|
|
1953
|
+
const u = s.getBoundingClientRect(), y = 126, f = window.innerWidth - 16 - 110, c = u.left + u.width / 2;
|
|
1948
1954
|
d({
|
|
1949
|
-
top:
|
|
1950
|
-
left: Math.max(
|
|
1955
|
+
top: u.top - 8,
|
|
1956
|
+
left: Math.max(y, Math.min(f, c))
|
|
1951
1957
|
});
|
|
1952
1958
|
};
|
|
1953
1959
|
return a(), window.addEventListener("scroll", a, !0), window.addEventListener("resize", a), () => {
|
|
1954
1960
|
window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", a);
|
|
1955
1961
|
};
|
|
1956
1962
|
}, [i]), l === null || typeof document > "u" ? null : Rt(
|
|
1957
|
-
/* @__PURE__ */
|
|
1963
|
+
/* @__PURE__ */ g(
|
|
1958
1964
|
"div",
|
|
1959
1965
|
{
|
|
1960
1966
|
className: "ll-device-menu ll-device-menu--floating",
|
|
@@ -1970,17 +1976,17 @@ const cn = ({
|
|
|
1970
1976
|
children: [
|
|
1971
1977
|
/* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
|
|
1972
1978
|
t.map((a, s) => {
|
|
1973
|
-
const
|
|
1974
|
-
return /* @__PURE__ */
|
|
1979
|
+
const u = r === a.deviceId;
|
|
1980
|
+
return /* @__PURE__ */ g(
|
|
1975
1981
|
"button",
|
|
1976
1982
|
{
|
|
1977
1983
|
type: "button",
|
|
1978
|
-
className: `ll-device-menu__item ${
|
|
1984
|
+
className: `ll-device-menu__item ${u ? "is-active" : ""}`,
|
|
1979
1985
|
onClick: () => o(a.deviceId),
|
|
1980
1986
|
role: "option",
|
|
1981
|
-
"aria-selected":
|
|
1987
|
+
"aria-selected": u,
|
|
1982
1988
|
children: [
|
|
1983
|
-
|
|
1989
|
+
u && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
|
|
1984
1990
|
/* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: a.label || `${e} ${s + 1}` })
|
|
1985
1991
|
]
|
|
1986
1992
|
},
|
|
@@ -2075,103 +2081,103 @@ function Br(e, t = {}) {
|
|
|
2075
2081
|
const o = typeof window < "u" && window.location.href || "", i = typeof window < "u" && window.location.pathname || "/", l = r.title || "", d = Array.from(
|
|
2076
2082
|
r.querySelectorAll("[data-ll-region]")
|
|
2077
2083
|
), a = [];
|
|
2078
|
-
for (const
|
|
2084
|
+
for (const k of d) {
|
|
2079
2085
|
if (a.length >= $r) break;
|
|
2080
|
-
if (ct(
|
|
2081
|
-
const R =
|
|
2082
|
-
(
|
|
2086
|
+
if (ct(k) || !st(k)) continue;
|
|
2087
|
+
const R = k.getAttribute("data-ll-region") ?? "", B = k.getAttribute("data-ll-intent") ?? void 0, q = ge(
|
|
2088
|
+
(k.innerText || k.textContent || "").trim(),
|
|
2083
2089
|
sn * 2
|
|
2084
2090
|
);
|
|
2085
2091
|
!R || !q || a.push({ id: R, intent: B, text: q });
|
|
2086
2092
|
}
|
|
2087
|
-
const s = [],
|
|
2093
|
+
const s = [], u = ["H1", "H2", "H3", "H4", "H5", "H6"], y = Array.from(
|
|
2088
2094
|
r.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
|
2089
2095
|
);
|
|
2090
|
-
for (const
|
|
2091
|
-
if (ct(
|
|
2092
|
-
const R = (
|
|
2093
|
-
R && s.push(`${
|
|
2096
|
+
for (const k of y) {
|
|
2097
|
+
if (ct(k) || !st(k)) continue;
|
|
2098
|
+
const R = (k.textContent || "").trim();
|
|
2099
|
+
R && s.push(`${k.tagName}: ${ge(R, 200)}`);
|
|
2094
2100
|
}
|
|
2095
|
-
const
|
|
2096
|
-
for (const
|
|
2097
|
-
if (ct(
|
|
2098
|
-
const R = (
|
|
2101
|
+
const f = Array.from(r.querySelectorAll("p, li"));
|
|
2102
|
+
for (const k of f) {
|
|
2103
|
+
if (ct(k) || !st(k) || u.includes(k.tagName)) continue;
|
|
2104
|
+
const R = (k.textContent || "").trim();
|
|
2099
2105
|
R.length > 10 && s.push(ge(R, sn));
|
|
2100
2106
|
}
|
|
2101
2107
|
const c = s.join(`
|
|
2102
|
-
`),
|
|
2103
|
-
for (const
|
|
2104
|
-
if (
|
|
2105
|
-
if (ct(
|
|
2106
|
-
const R =
|
|
2107
|
-
!R || !B ||
|
|
2108
|
+
`), A = [], _ = Array.from(r.querySelectorAll("a[href]"));
|
|
2109
|
+
for (const k of _) {
|
|
2110
|
+
if (A.length >= Dr) break;
|
|
2111
|
+
if (ct(k) || !st(k)) continue;
|
|
2112
|
+
const R = k.getAttribute("href") || "", B = (k.textContent || "").trim();
|
|
2113
|
+
!R || !B || A.push({ href: R, text: ge(B, 100) });
|
|
2108
2114
|
}
|
|
2109
|
-
const
|
|
2115
|
+
const x = [], b = Array.from(
|
|
2110
2116
|
r.querySelectorAll(
|
|
2111
2117
|
"input, textarea, select"
|
|
2112
2118
|
)
|
|
2113
2119
|
);
|
|
2114
|
-
for (const
|
|
2115
|
-
if (
|
|
2116
|
-
if (ct(
|
|
2117
|
-
const R = dn(
|
|
2118
|
-
R &&
|
|
2120
|
+
for (const k of b) {
|
|
2121
|
+
if (x.length >= Pr) break;
|
|
2122
|
+
if (ct(k) || !_t(k) || !st(k)) continue;
|
|
2123
|
+
const R = dn(k), B = k instanceof HTMLInputElement ? k.type : k.tagName.toLowerCase();
|
|
2124
|
+
R && x.push({ label: ge(R, 100), type: B });
|
|
2119
2125
|
}
|
|
2120
|
-
const
|
|
2126
|
+
const v = Array.from(
|
|
2121
2127
|
r.querySelectorAll("[data-ll-form]")
|
|
2122
|
-
),
|
|
2123
|
-
for (const
|
|
2124
|
-
if (
|
|
2125
|
-
if (It(
|
|
2126
|
-
const R =
|
|
2128
|
+
), S = [];
|
|
2129
|
+
for (const k of v) {
|
|
2130
|
+
if (S.length >= zr) break;
|
|
2131
|
+
if (It(k)) continue;
|
|
2132
|
+
const R = k.getAttribute("data-ll-form") || "";
|
|
2127
2133
|
if (!R) continue;
|
|
2128
|
-
const B =
|
|
2129
|
-
|
|
2134
|
+
const B = k.getAttribute("data-ll-intent") || void 0, q = Array.from(
|
|
2135
|
+
k.querySelectorAll(
|
|
2130
2136
|
"[data-ll-field]"
|
|
2131
2137
|
)
|
|
2132
|
-
),
|
|
2133
|
-
for (const
|
|
2134
|
-
if (
|
|
2135
|
-
if (!_t(
|
|
2136
|
-
const
|
|
2137
|
-
if (!
|
|
2138
|
-
const
|
|
2139
|
-
name:
|
|
2140
|
-
label: ge(
|
|
2141
|
-
type:
|
|
2138
|
+
), F = [];
|
|
2139
|
+
for (const U of q) {
|
|
2140
|
+
if (F.length >= Or) break;
|
|
2141
|
+
if (!_t(U)) continue;
|
|
2142
|
+
const O = U.getAttribute("data-ll-field") || "";
|
|
2143
|
+
if (!O) continue;
|
|
2144
|
+
const j = dn(U) || O, H = U instanceof HTMLInputElement ? U.type : U.tagName.toLowerCase(), G = {
|
|
2145
|
+
name: O,
|
|
2146
|
+
label: ge(j, 100),
|
|
2147
|
+
type: H
|
|
2142
2148
|
};
|
|
2143
|
-
if (
|
|
2149
|
+
if (U.required === !0 && (G.required = !0), U instanceof HTMLSelectElement) {
|
|
2144
2150
|
const fe = [];
|
|
2145
|
-
for (let ye = 0; ye <
|
|
2146
|
-
const pe =
|
|
2151
|
+
for (let ye = 0; ye < U.options.length && !(fe.length >= Hr); ye++) {
|
|
2152
|
+
const pe = U.options[ye];
|
|
2147
2153
|
if (!pe || pe.disabled) continue;
|
|
2148
2154
|
const ve = pe.value || "", he = (pe.textContent || "").trim() || ve;
|
|
2149
2155
|
!ve && !he || fe.push({ value: ve, label: ge(he, 60) });
|
|
2150
2156
|
}
|
|
2151
|
-
fe.length > 0 && (
|
|
2157
|
+
fe.length > 0 && (G.options = fe);
|
|
2152
2158
|
}
|
|
2153
|
-
const
|
|
2154
|
-
|
|
2159
|
+
const le = typeof U.validationMessage == "string" ? U.validationMessage : "";
|
|
2160
|
+
le && (G.validationMessage = ge(le, 200)), F.push(G);
|
|
2155
2161
|
}
|
|
2156
|
-
|
|
2162
|
+
S.push({ id: R, intent: B, fields: F });
|
|
2157
2163
|
}
|
|
2158
|
-
const
|
|
2164
|
+
const M = {
|
|
2159
2165
|
url: o,
|
|
2160
2166
|
title: l,
|
|
2161
2167
|
pathname: i,
|
|
2162
2168
|
regions: a,
|
|
2163
2169
|
visibleText: c,
|
|
2164
|
-
visibleLinks:
|
|
2165
|
-
visibleFields:
|
|
2166
|
-
forms:
|
|
2170
|
+
visibleLinks: A,
|
|
2171
|
+
visibleFields: x,
|
|
2172
|
+
forms: S,
|
|
2167
2173
|
extras: e
|
|
2168
2174
|
};
|
|
2169
|
-
let D = Fe(JSON.stringify(
|
|
2170
|
-
for (; D > bt &&
|
|
2171
|
-
|
|
2172
|
-
for (; D > bt &&
|
|
2173
|
-
|
|
2174
|
-
return Fe(
|
|
2175
|
+
let D = Fe(JSON.stringify(M.regions)) + Fe(M.visibleText) + Fe(JSON.stringify(M.visibleLinks)) + Fe(JSON.stringify(M.visibleFields));
|
|
2176
|
+
for (; D > bt && M.visibleFields.length > 0; )
|
|
2177
|
+
M.visibleFields.pop(), D = Fe(JSON.stringify(M.visibleFields));
|
|
2178
|
+
for (; D > bt && M.visibleLinks.length > 0; )
|
|
2179
|
+
M.visibleLinks.pop(), D -= 80;
|
|
2180
|
+
return Fe(M.visibleText) > bt && (M.visibleText = ge(M.visibleText, bt - 100)), M;
|
|
2175
2181
|
}
|
|
2176
2182
|
let Ue = null;
|
|
2177
2183
|
function un(e, t = {}) {
|
|
@@ -2207,19 +2213,19 @@ function Vr(e) {
|
|
|
2207
2213
|
if (It(d)) continue;
|
|
2208
2214
|
const a = d.getAttribute("href") || "";
|
|
2209
2215
|
if (!jr(a)) continue;
|
|
2210
|
-
let s = a,
|
|
2216
|
+
let s = a, u = !0;
|
|
2211
2217
|
try {
|
|
2212
2218
|
if (typeof window < "u") {
|
|
2213
|
-
const
|
|
2214
|
-
|
|
2219
|
+
const f = new URL(a, r);
|
|
2220
|
+
u = f.origin === r, u && a.startsWith("http") && (s = f.pathname + f.search + f.hash);
|
|
2215
2221
|
}
|
|
2216
2222
|
} catch {
|
|
2217
2223
|
continue;
|
|
2218
2224
|
}
|
|
2219
2225
|
if (o.has(s)) continue;
|
|
2220
2226
|
o.add(s);
|
|
2221
|
-
const
|
|
2222
|
-
i.push({ href: s, text:
|
|
2227
|
+
const y = (d.textContent || "").trim().slice(0, 120);
|
|
2228
|
+
i.push({ href: s, text: y, internal: u });
|
|
2223
2229
|
}
|
|
2224
2230
|
return i;
|
|
2225
2231
|
}
|
|
@@ -2328,39 +2334,39 @@ const no = /* @__PURE__ */ new Set([
|
|
|
2328
2334
|
sessionEndpoint: d,
|
|
2329
2335
|
sessionBody: a,
|
|
2330
2336
|
soundEffects: s,
|
|
2331
|
-
experienceMode:
|
|
2332
|
-
autoConnect:
|
|
2333
|
-
displayMode:
|
|
2337
|
+
experienceMode: u = "WIDGET",
|
|
2338
|
+
autoConnect: y = !1,
|
|
2339
|
+
displayMode: f,
|
|
2334
2340
|
defaultDisplayMode: c = "expanded",
|
|
2335
|
-
onDisplayModeChange:
|
|
2336
|
-
position:
|
|
2337
|
-
mobileBreakpoint:
|
|
2338
|
-
persistKey:
|
|
2339
|
-
disablePersistence:
|
|
2340
|
-
teamMembers:
|
|
2341
|
-
currentTeamMemberId:
|
|
2341
|
+
onDisplayModeChange: A,
|
|
2342
|
+
position: _ = "bottom-right",
|
|
2343
|
+
mobileBreakpoint: x = 640,
|
|
2344
|
+
persistKey: b = "ll-widget",
|
|
2345
|
+
disablePersistence: v = !1,
|
|
2346
|
+
teamMembers: S,
|
|
2347
|
+
currentTeamMemberId: M,
|
|
2342
2348
|
onTeamMemberChange: D,
|
|
2343
|
-
idleLoopUrl:
|
|
2349
|
+
idleLoopUrl: k,
|
|
2344
2350
|
greeting: R,
|
|
2345
2351
|
avatarImageUrl: B,
|
|
2346
2352
|
agentName: q,
|
|
2347
|
-
branding:
|
|
2348
|
-
allowCamera:
|
|
2349
|
-
allowScreenShare:
|
|
2350
|
-
allowTyping:
|
|
2351
|
-
showMinimize:
|
|
2352
|
-
chromeless:
|
|
2353
|
-
floatingChromeContainer:
|
|
2353
|
+
branding: F = {},
|
|
2354
|
+
allowCamera: U = !0,
|
|
2355
|
+
allowScreenShare: O = !0,
|
|
2356
|
+
allowTyping: j = !0,
|
|
2357
|
+
showMinimize: H = !0,
|
|
2358
|
+
chromeless: G = !1,
|
|
2359
|
+
floatingChromeContainer: le = null,
|
|
2354
2360
|
compactControls: fe = !1,
|
|
2355
2361
|
transforming: ye = !1,
|
|
2356
2362
|
transformingLabel: pe = "Transforming…",
|
|
2357
2363
|
showOn: ve,
|
|
2358
2364
|
hideOn: he,
|
|
2359
|
-
pathname:
|
|
2365
|
+
pathname: ne,
|
|
2360
2366
|
onNavigate: ut,
|
|
2361
2367
|
onScrollToSelector: Ge,
|
|
2362
2368
|
getPageContext: ft,
|
|
2363
|
-
pageContextExtras:
|
|
2369
|
+
pageContextExtras: ae,
|
|
2364
2370
|
getRoutes: Je,
|
|
2365
2371
|
onScrollPage: Ke,
|
|
2366
2372
|
onClick: pt,
|
|
@@ -2372,45 +2378,45 @@ const no = /* @__PURE__ */ new Set([
|
|
|
2372
2378
|
onConnectionStateChange: Ne,
|
|
2373
2379
|
onAgentEvent: Ae,
|
|
2374
2380
|
onAgentCommand: Re,
|
|
2375
|
-
controlledSession:
|
|
2381
|
+
controlledSession: P,
|
|
2376
2382
|
className: ht,
|
|
2377
2383
|
style: xt,
|
|
2378
2384
|
zIndex: Ie = 2147483647
|
|
2379
|
-
} = t, Me = ar(
|
|
2380
|
-
|
|
2385
|
+
} = t, Me = ar(ne), re = hr(Me, ve, he);
|
|
2386
|
+
I(() => {
|
|
2381
2387
|
qr(), Gr();
|
|
2382
2388
|
}, [Me]);
|
|
2383
|
-
const Qe =
|
|
2384
|
-
var
|
|
2385
|
-
return
|
|
2386
|
-
}), Te = Qe ?
|
|
2387
|
-
() => (
|
|
2388
|
-
[
|
|
2389
|
-
), mt = (
|
|
2390
|
-
value:
|
|
2389
|
+
const Qe = M !== void 0, [Ze, ze] = C(() => {
|
|
2390
|
+
var m;
|
|
2391
|
+
return M ?? ((m = S == null ? void 0 : S[0]) == null ? void 0 : m.id);
|
|
2392
|
+
}), Te = Qe ? M : Ze, ee = Ye(
|
|
2393
|
+
() => (S == null ? void 0 : S.find((m) => m.id === Te)) ?? null,
|
|
2394
|
+
[S, Te]
|
|
2395
|
+
), mt = (ee == null ? void 0 : ee.agentId) ?? o, et = u === "EMBEDDED", [oe, ie] = rr({
|
|
2396
|
+
value: f,
|
|
2391
2397
|
defaultValue: c,
|
|
2392
|
-
onChange:
|
|
2393
|
-
persistKey:
|
|
2394
|
-
disablePersistence: et ||
|
|
2395
|
-
}), se = ir(
|
|
2398
|
+
onChange: A,
|
|
2399
|
+
persistKey: b,
|
|
2400
|
+
disablePersistence: et || v
|
|
2401
|
+
}), se = ir(x), be = jn(), X = Vn(), de = Gn(), we = Jn(), Oe = Kn(), [kt, tt] = C(!1), [_e, nt] = C(!1), [rt, ot] = C(!1), [xe, ke] = C(!1), [He, gt] = C(!1), We = gr({ baseUrl: l, config: s }), De = N(We);
|
|
2396
2402
|
De.current = We;
|
|
2397
|
-
const h =
|
|
2398
|
-
h.current = ut,
|
|
2399
|
-
function Le(
|
|
2403
|
+
const h = N(ut), J = N(Ge), Lt = N(Ke), Et = N(pt), Mt = N(ft), Tt = N(ae), Dt = N(Je), Ct = N(Xe), ue = N(null);
|
|
2404
|
+
h.current = ut, J.current = Ge, Lt.current = Ke, Et.current = pt, Mt.current = ft, Tt.current = ae, Dt.current = Je, Ct.current = Xe;
|
|
2405
|
+
function Le(m) {
|
|
2400
2406
|
const p = Ct.current;
|
|
2401
|
-
return p ? p.includes(
|
|
2407
|
+
return p ? p.includes(m) : !0;
|
|
2402
2408
|
}
|
|
2403
|
-
function Ee(
|
|
2409
|
+
function Ee(m, p) {
|
|
2404
2410
|
console.warn(
|
|
2405
|
-
`[LiveLayer] Agent command "${
|
|
2411
|
+
`[LiveLayer] Agent command "${m}" blocked — capability "${p}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
|
|
2406
2412
|
);
|
|
2407
2413
|
}
|
|
2408
2414
|
const it = E(
|
|
2409
|
-
(
|
|
2410
|
-
var
|
|
2411
|
-
const p =
|
|
2415
|
+
(m) => {
|
|
2416
|
+
var K, ce, me, at;
|
|
2417
|
+
const p = m;
|
|
2412
2418
|
if (!(!p.type || typeof p.type != "string")) {
|
|
2413
|
-
if (Ae == null || Ae({ eventName: p.type, data:
|
|
2419
|
+
if (Ae == null || Ae({ eventName: p.type, data: m }), p.type === "navigate") {
|
|
2414
2420
|
if (!Le("navigate")) {
|
|
2415
2421
|
Ee("navigate", "navigate");
|
|
2416
2422
|
return;
|
|
@@ -2425,30 +2431,30 @@ const no = /* @__PURE__ */ new Set([
|
|
|
2425
2431
|
if (De.current.playPageChange(), h.current) {
|
|
2426
2432
|
try {
|
|
2427
2433
|
h.current(L);
|
|
2428
|
-
} catch (
|
|
2434
|
+
} catch (T) {
|
|
2429
2435
|
console.warn(
|
|
2430
2436
|
`[LiveLayer] onNavigate threw for "${L}". Falling back. Error:`,
|
|
2431
|
-
|
|
2437
|
+
T
|
|
2432
2438
|
);
|
|
2433
2439
|
}
|
|
2434
2440
|
return;
|
|
2435
2441
|
}
|
|
2436
2442
|
if (typeof document < "u") {
|
|
2437
|
-
const
|
|
2443
|
+
const T = document.querySelector(
|
|
2438
2444
|
`a[href="${L.replace(/"/g, '\\"')}"]`
|
|
2439
2445
|
);
|
|
2440
|
-
if (
|
|
2441
|
-
|
|
2446
|
+
if (T) {
|
|
2447
|
+
T.click();
|
|
2442
2448
|
return;
|
|
2443
2449
|
}
|
|
2444
2450
|
}
|
|
2445
2451
|
if (typeof window < "u" && typeof history < "u")
|
|
2446
2452
|
try {
|
|
2447
2453
|
history.pushState({}, "", L), window.dispatchEvent(new PopStateEvent("popstate"));
|
|
2448
|
-
} catch (
|
|
2454
|
+
} catch (T) {
|
|
2449
2455
|
console.warn(
|
|
2450
2456
|
`[LiveLayer] history.pushState fallback failed for "${L}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
|
|
2451
|
-
|
|
2457
|
+
T
|
|
2452
2458
|
);
|
|
2453
2459
|
}
|
|
2454
2460
|
return;
|
|
@@ -2460,12 +2466,12 @@ const no = /* @__PURE__ */ new Set([
|
|
|
2460
2466
|
}
|
|
2461
2467
|
const L = typeof p.selector == "string" ? p.selector : null;
|
|
2462
2468
|
if (!L) return;
|
|
2463
|
-
const
|
|
2464
|
-
if (
|
|
2469
|
+
const T = p.behavior === "instant" ? "instant" : "smooth";
|
|
2470
|
+
if (J.current) {
|
|
2465
2471
|
try {
|
|
2466
|
-
|
|
2472
|
+
J.current(
|
|
2467
2473
|
L,
|
|
2468
|
-
|
|
2474
|
+
T
|
|
2469
2475
|
);
|
|
2470
2476
|
} catch (W) {
|
|
2471
2477
|
console.warn("[LiveLayer] onScrollToSelector threw.", W);
|
|
@@ -2489,7 +2495,7 @@ const no = /* @__PURE__ */ new Set([
|
|
|
2489
2495
|
return;
|
|
2490
2496
|
}
|
|
2491
2497
|
W.scrollIntoView({
|
|
2492
|
-
behavior:
|
|
2498
|
+
behavior: T,
|
|
2493
2499
|
block: "start"
|
|
2494
2500
|
});
|
|
2495
2501
|
}
|
|
@@ -2500,45 +2506,45 @@ const no = /* @__PURE__ */ new Set([
|
|
|
2500
2506
|
Ee("request_page_context", "read_page");
|
|
2501
2507
|
return;
|
|
2502
2508
|
}
|
|
2503
|
-
const L = typeof p.requestId == "string" ? p.requestId : void 0,
|
|
2504
|
-
const
|
|
2505
|
-
if (
|
|
2509
|
+
const L = typeof p.requestId == "string" ? p.requestId : void 0, T = (K = ue.current) == null ? void 0 : K.call(ue), W = (Y) => {
|
|
2510
|
+
const $ = T, Z = $ == null ? void 0 : $.localParticipant;
|
|
2511
|
+
if (Z != null && Z.publishData)
|
|
2506
2512
|
try {
|
|
2507
|
-
const
|
|
2508
|
-
|
|
2509
|
-
} catch (
|
|
2510
|
-
console.warn("[LiveLayer] publishData failed.",
|
|
2513
|
+
const te = L ? { ...Y, requestId: L } : Y, qe = new TextEncoder().encode(JSON.stringify(te));
|
|
2514
|
+
Z.publishData(qe, { reliable: !0 });
|
|
2515
|
+
} catch (te) {
|
|
2516
|
+
console.warn("[LiveLayer] publishData failed.", te);
|
|
2511
2517
|
}
|
|
2512
|
-
},
|
|
2518
|
+
}, z = Tt.current, V = Mt.current;
|
|
2513
2519
|
try {
|
|
2514
|
-
if (
|
|
2515
|
-
const
|
|
2516
|
-
if (
|
|
2517
|
-
W({ type: "page_context_pending" }),
|
|
2520
|
+
if (V) {
|
|
2521
|
+
const Y = V(z);
|
|
2522
|
+
if (Y instanceof Promise) {
|
|
2523
|
+
W({ type: "page_context_pending" }), Y.then(($) => W({ type: "page_context", context: $ })).catch(($) => {
|
|
2518
2524
|
console.warn(
|
|
2519
2525
|
"[LiveLayer] getPageContext rejected; falling back to default walker.",
|
|
2520
|
-
|
|
2526
|
+
$
|
|
2521
2527
|
), W({
|
|
2522
2528
|
type: "page_context",
|
|
2523
|
-
context: un(
|
|
2529
|
+
context: un(z)
|
|
2524
2530
|
});
|
|
2525
2531
|
});
|
|
2526
2532
|
return;
|
|
2527
2533
|
}
|
|
2528
|
-
W({ type: "page_context", context:
|
|
2534
|
+
W({ type: "page_context", context: Y });
|
|
2529
2535
|
return;
|
|
2530
2536
|
}
|
|
2531
2537
|
W({
|
|
2532
2538
|
type: "page_context",
|
|
2533
|
-
context: un(
|
|
2539
|
+
context: un(z)
|
|
2534
2540
|
});
|
|
2535
|
-
} catch (
|
|
2541
|
+
} catch (Y) {
|
|
2536
2542
|
console.warn(
|
|
2537
2543
|
"[LiveLayer] page-context extraction threw. Sending empty context.",
|
|
2538
|
-
|
|
2544
|
+
Y
|
|
2539
2545
|
), W({
|
|
2540
2546
|
type: "page_context",
|
|
2541
|
-
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras:
|
|
2547
|
+
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: z }
|
|
2542
2548
|
});
|
|
2543
2549
|
}
|
|
2544
2550
|
return;
|
|
@@ -2555,25 +2561,25 @@ const no = /* @__PURE__ */ new Set([
|
|
|
2555
2561
|
);
|
|
2556
2562
|
return;
|
|
2557
2563
|
}
|
|
2558
|
-
const
|
|
2564
|
+
const T = p.behavior === "instant" ? "instant" : "smooth";
|
|
2559
2565
|
if (Lt.current) {
|
|
2560
2566
|
try {
|
|
2561
2567
|
Lt.current(
|
|
2562
2568
|
L,
|
|
2563
|
-
|
|
2569
|
+
T
|
|
2564
2570
|
);
|
|
2565
|
-
} catch (
|
|
2566
|
-
console.warn("[LiveLayer] onScrollPage threw.",
|
|
2571
|
+
} catch ($) {
|
|
2572
|
+
console.warn("[LiveLayer] onScrollPage threw.", $);
|
|
2567
2573
|
}
|
|
2568
2574
|
return;
|
|
2569
2575
|
}
|
|
2570
2576
|
if (typeof window > "u") return;
|
|
2571
|
-
const W = { behavior:
|
|
2572
|
-
|
|
2573
|
-
},
|
|
2574
|
-
|
|
2577
|
+
const W = { behavior: T }, z = eo(), V = ($) => {
|
|
2578
|
+
z instanceof Window ? z.scrollBy({ top: $, ...W }) : z.scrollBy({ top: $, ...W });
|
|
2579
|
+
}, Y = ($) => {
|
|
2580
|
+
z instanceof Window ? z.scrollTo({ top: $, ...W }) : z.scrollTo({ top: $, ...W });
|
|
2575
2581
|
};
|
|
2576
|
-
L === "up" ?
|
|
2582
|
+
L === "up" ? V(-fn(z)) : L === "down" ? V(fn(z)) : Y(L === "top" ? 0 : to(z));
|
|
2577
2583
|
return;
|
|
2578
2584
|
}
|
|
2579
2585
|
if (p.type === "click") {
|
|
@@ -2595,28 +2601,28 @@ const no = /* @__PURE__ */ new Set([
|
|
|
2595
2601
|
return;
|
|
2596
2602
|
}
|
|
2597
2603
|
if (typeof document > "u") return;
|
|
2598
|
-
let
|
|
2604
|
+
let T = null;
|
|
2599
2605
|
try {
|
|
2600
|
-
|
|
2606
|
+
T = document.querySelector(L);
|
|
2601
2607
|
} catch {
|
|
2602
2608
|
console.warn(
|
|
2603
2609
|
`[LiveLayer] click: invalid selector "${L}".`
|
|
2604
2610
|
);
|
|
2605
2611
|
return;
|
|
2606
2612
|
}
|
|
2607
|
-
if (!
|
|
2613
|
+
if (!T) {
|
|
2608
2614
|
console.warn(
|
|
2609
2615
|
`[LiveLayer] click: no element matched "${L}". See https://livelayer.studio/docs/errors/click-no-match`
|
|
2610
2616
|
);
|
|
2611
2617
|
return;
|
|
2612
2618
|
}
|
|
2613
|
-
if (
|
|
2619
|
+
if (T.closest('[data-ll-private="true"], .ll-widget')) {
|
|
2614
2620
|
console.warn(
|
|
2615
2621
|
"[LiveLayer] click: refusing to click element inside a private subtree."
|
|
2616
2622
|
);
|
|
2617
2623
|
return;
|
|
2618
2624
|
}
|
|
2619
|
-
(
|
|
2625
|
+
(ce = T.click) == null || ce.call(T);
|
|
2620
2626
|
return;
|
|
2621
2627
|
}
|
|
2622
2628
|
if (p.type === "fill_form" || p.type === "focus_field") {
|
|
@@ -2631,41 +2637,41 @@ const no = /* @__PURE__ */ new Set([
|
|
|
2631
2637
|
console.warn(`[LiveLayer] ${p.type}: missing formId.`);
|
|
2632
2638
|
return;
|
|
2633
2639
|
}
|
|
2634
|
-
const
|
|
2640
|
+
const T = document.querySelector(
|
|
2635
2641
|
`[data-ll-form="${L.replace(/"/g, '\\"')}"]`
|
|
2636
2642
|
);
|
|
2637
|
-
if (!
|
|
2643
|
+
if (!T) {
|
|
2638
2644
|
console.warn(
|
|
2639
2645
|
`[LiveLayer] ${p.type}: no form with data-ll-form="${L}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
|
|
2640
2646
|
);
|
|
2641
2647
|
return;
|
|
2642
2648
|
}
|
|
2643
|
-
if (
|
|
2649
|
+
if (T.closest('[data-ll-private="true"], .ll-widget')) {
|
|
2644
2650
|
console.warn(
|
|
2645
2651
|
`[LiveLayer] ${p.type}: refusing to touch a form in a private subtree.`
|
|
2646
2652
|
);
|
|
2647
2653
|
return;
|
|
2648
2654
|
}
|
|
2649
2655
|
if (p.type === "focus_field") {
|
|
2650
|
-
const
|
|
2651
|
-
if (!
|
|
2656
|
+
const z = typeof p.fieldName == "string" ? p.fieldName : null;
|
|
2657
|
+
if (!z) {
|
|
2652
2658
|
console.warn("[LiveLayer] focus_field: missing fieldName.");
|
|
2653
2659
|
return;
|
|
2654
2660
|
}
|
|
2655
|
-
const
|
|
2656
|
-
if (!
|
|
2661
|
+
const V = T.querySelector(`[data-ll-field="${z.replace(/"/g, '\\"')}"]`);
|
|
2662
|
+
if (!V) {
|
|
2657
2663
|
console.warn(
|
|
2658
|
-
`[LiveLayer] focus_field: no field "${
|
|
2664
|
+
`[LiveLayer] focus_field: no field "${z}" in form "${L}".`
|
|
2659
2665
|
);
|
|
2660
2666
|
return;
|
|
2661
2667
|
}
|
|
2662
|
-
if (!_t(
|
|
2668
|
+
if (!_t(V)) {
|
|
2663
2669
|
console.warn(
|
|
2664
|
-
`[LiveLayer] focus_field: field "${
|
|
2670
|
+
`[LiveLayer] focus_field: field "${z}" is privacy-protected and not focusable.`
|
|
2665
2671
|
);
|
|
2666
2672
|
return;
|
|
2667
2673
|
}
|
|
2668
|
-
|
|
2674
|
+
V.focus();
|
|
2669
2675
|
return;
|
|
2670
2676
|
}
|
|
2671
2677
|
const W = p.values && typeof p.values == "object" ? p.values : null;
|
|
@@ -2673,27 +2679,27 @@ const no = /* @__PURE__ */ new Set([
|
|
|
2673
2679
|
console.warn("[LiveLayer] fill_form: missing or invalid values.");
|
|
2674
2680
|
return;
|
|
2675
2681
|
}
|
|
2676
|
-
for (const [
|
|
2677
|
-
if (typeof
|
|
2678
|
-
const
|
|
2679
|
-
if (!
|
|
2682
|
+
for (const [z, V] of Object.entries(W)) {
|
|
2683
|
+
if (typeof V != "string") continue;
|
|
2684
|
+
const Y = T.querySelector(`[data-ll-field="${z.replace(/"/g, '\\"')}"]`);
|
|
2685
|
+
if (!Y) {
|
|
2680
2686
|
console.warn(
|
|
2681
|
-
`[LiveLayer] fill_form: no field "${
|
|
2687
|
+
`[LiveLayer] fill_form: no field "${z}" in form "${L}". Skipping.`
|
|
2682
2688
|
);
|
|
2683
2689
|
continue;
|
|
2684
2690
|
}
|
|
2685
|
-
if (!_t(
|
|
2691
|
+
if (!_t(Y)) {
|
|
2686
2692
|
console.warn(
|
|
2687
|
-
`[LiveLayer] fill_form: field "${
|
|
2693
|
+
`[LiveLayer] fill_form: field "${z}" is privacy-protected (password / cc-* / private). Skipping.`
|
|
2688
2694
|
);
|
|
2689
2695
|
continue;
|
|
2690
2696
|
}
|
|
2691
2697
|
try {
|
|
2692
|
-
Kr(
|
|
2693
|
-
} catch (
|
|
2698
|
+
Kr(Y, V);
|
|
2699
|
+
} catch ($) {
|
|
2694
2700
|
console.warn(
|
|
2695
|
-
`[LiveLayer] fill_form: failed to set "${
|
|
2696
|
-
|
|
2701
|
+
`[LiveLayer] fill_form: failed to set "${z}".`,
|
|
2702
|
+
$
|
|
2697
2703
|
);
|
|
2698
2704
|
}
|
|
2699
2705
|
}
|
|
@@ -2711,39 +2717,39 @@ const no = /* @__PURE__ */ new Set([
|
|
|
2711
2717
|
return;
|
|
2712
2718
|
}
|
|
2713
2719
|
De.current.playConfirmation();
|
|
2714
|
-
const
|
|
2720
|
+
const T = document.querySelector(
|
|
2715
2721
|
`[data-ll-form="${L.replace(/"/g, '\\"')}"]`
|
|
2716
2722
|
);
|
|
2717
|
-
if (!
|
|
2723
|
+
if (!T) {
|
|
2718
2724
|
console.warn(
|
|
2719
2725
|
`[LiveLayer] submit_form: no form with data-ll-form="${L}".`
|
|
2720
2726
|
);
|
|
2721
2727
|
return;
|
|
2722
2728
|
}
|
|
2723
|
-
if (
|
|
2729
|
+
if (T.closest('[data-ll-private="true"], .ll-widget')) {
|
|
2724
2730
|
console.warn(
|
|
2725
2731
|
"[LiveLayer] submit_form: refusing to submit a form in a private subtree."
|
|
2726
2732
|
);
|
|
2727
2733
|
return;
|
|
2728
2734
|
}
|
|
2729
|
-
const W = typeof p.requestId == "string" ? p.requestId : void 0,
|
|
2730
|
-
const
|
|
2735
|
+
const W = typeof p.requestId == "string" ? p.requestId : void 0, z = (me = ue.current) == null ? void 0 : me.call(ue), V = (Z) => {
|
|
2736
|
+
const te = z, qe = te == null ? void 0 : te.localParticipant;
|
|
2731
2737
|
if (qe != null && qe.publishData)
|
|
2732
2738
|
try {
|
|
2733
|
-
const Pn = W ? { ...
|
|
2739
|
+
const Pn = W ? { ...Z, requestId: W } : Z, $n = new TextEncoder().encode(JSON.stringify(Pn));
|
|
2734
2740
|
qe.publishData($n, { reliable: !0 });
|
|
2735
2741
|
} catch {
|
|
2736
2742
|
}
|
|
2737
2743
|
};
|
|
2738
|
-
let
|
|
2739
|
-
const
|
|
2740
|
-
|
|
2744
|
+
let Y = !1;
|
|
2745
|
+
const $ = () => {
|
|
2746
|
+
Y = !0, V({ type: "form_submitted", formId: L });
|
|
2741
2747
|
};
|
|
2742
|
-
|
|
2748
|
+
T.addEventListener("submit", $, { once: !0 });
|
|
2743
2749
|
try {
|
|
2744
|
-
typeof
|
|
2745
|
-
} catch (
|
|
2746
|
-
console.warn("[LiveLayer] submit_form: requestSubmit threw.",
|
|
2750
|
+
typeof T.requestSubmit == "function" ? T.requestSubmit() : T.submit();
|
|
2751
|
+
} catch (Z) {
|
|
2752
|
+
console.warn("[LiveLayer] submit_form: requestSubmit threw.", Z), T.removeEventListener("submit", $), V({
|
|
2747
2753
|
type: "form_submit_blocked",
|
|
2748
2754
|
formId: L,
|
|
2749
2755
|
reason: "exception"
|
|
@@ -2751,7 +2757,7 @@ const no = /* @__PURE__ */ new Set([
|
|
|
2751
2757
|
return;
|
|
2752
2758
|
}
|
|
2753
2759
|
setTimeout(() => {
|
|
2754
|
-
|
|
2760
|
+
Y || (T.removeEventListener("submit", $), V({
|
|
2755
2761
|
type: "form_submit_blocked",
|
|
2756
2762
|
formId: L,
|
|
2757
2763
|
reason: "validation"
|
|
@@ -2764,43 +2770,43 @@ const no = /* @__PURE__ */ new Set([
|
|
|
2764
2770
|
Ee("request_routes", "read_page");
|
|
2765
2771
|
return;
|
|
2766
2772
|
}
|
|
2767
|
-
const L = typeof p.requestId == "string" ? p.requestId : void 0, W = (at = ue.current) == null ? void 0 : at.call(ue),
|
|
2768
|
-
if (!(
|
|
2769
|
-
const
|
|
2773
|
+
const L = typeof p.requestId == "string" ? p.requestId : void 0, W = (at = ue.current) == null ? void 0 : at.call(ue), z = W == null ? void 0 : W.localParticipant;
|
|
2774
|
+
if (!(z != null && z.publishData)) return;
|
|
2775
|
+
const V = ($) => {
|
|
2770
2776
|
try {
|
|
2771
|
-
const
|
|
2772
|
-
|
|
2773
|
-
} catch (
|
|
2774
|
-
console.warn("[LiveLayer] request_routes: publishData failed.",
|
|
2777
|
+
const Z = L ? { type: "routes", routes: $, requestId: L } : { type: "routes", routes: $ }, te = new TextEncoder().encode(JSON.stringify(Z));
|
|
2778
|
+
z.publishData(te, { reliable: !0 });
|
|
2779
|
+
} catch (Z) {
|
|
2780
|
+
console.warn("[LiveLayer] request_routes: publishData failed.", Z);
|
|
2775
2781
|
}
|
|
2776
|
-
},
|
|
2777
|
-
if (
|
|
2782
|
+
}, Y = Dt.current;
|
|
2783
|
+
if (Y) {
|
|
2778
2784
|
try {
|
|
2779
|
-
const
|
|
2780
|
-
if (!Array.isArray(
|
|
2781
|
-
|
|
2785
|
+
const $ = Y(), Z = (te) => {
|
|
2786
|
+
if (!Array.isArray(te)) {
|
|
2787
|
+
V([]);
|
|
2782
2788
|
return;
|
|
2783
2789
|
}
|
|
2784
|
-
|
|
2790
|
+
V(te.map(Ur).slice(0, 200));
|
|
2785
2791
|
};
|
|
2786
|
-
|
|
2792
|
+
$ instanceof Promise ? $.then(Z).catch((te) => {
|
|
2787
2793
|
console.warn(
|
|
2788
2794
|
"[LiveLayer] getRoutes rejected; falling back to DOM walker.",
|
|
2789
|
-
|
|
2790
|
-
),
|
|
2791
|
-
}) :
|
|
2792
|
-
} catch (
|
|
2795
|
+
te
|
|
2796
|
+
), V(Nt());
|
|
2797
|
+
}) : Z($);
|
|
2798
|
+
} catch ($) {
|
|
2793
2799
|
console.warn(
|
|
2794
2800
|
"[LiveLayer] getRoutes threw; falling back to DOM walker.",
|
|
2795
|
-
|
|
2796
|
-
),
|
|
2801
|
+
$
|
|
2802
|
+
), V(Nt());
|
|
2797
2803
|
}
|
|
2798
2804
|
return;
|
|
2799
2805
|
}
|
|
2800
2806
|
try {
|
|
2801
|
-
|
|
2802
|
-
} catch (
|
|
2803
|
-
console.warn("[LiveLayer] request_routes: extractRoutes threw.",
|
|
2807
|
+
V(Nt());
|
|
2808
|
+
} catch ($) {
|
|
2809
|
+
console.warn("[LiveLayer] request_routes: extractRoutes threw.", $);
|
|
2804
2810
|
}
|
|
2805
2811
|
return;
|
|
2806
2812
|
}
|
|
@@ -2808,28 +2814,28 @@ const no = /* @__PURE__ */ new Set([
|
|
|
2808
2814
|
}
|
|
2809
2815
|
},
|
|
2810
2816
|
[Re, Ae]
|
|
2811
|
-
),
|
|
2812
|
-
agentId:
|
|
2817
|
+
), Q = Un({
|
|
2818
|
+
agentId: P ? "__controlled__" : mt,
|
|
2813
2819
|
baseUrl: l,
|
|
2814
2820
|
apiKey: i,
|
|
2815
2821
|
sessionEndpoint: d,
|
|
2816
2822
|
sessionBody: a,
|
|
2817
|
-
onDataMessage:
|
|
2823
|
+
onDataMessage: P ? void 0 : it
|
|
2818
2824
|
});
|
|
2819
|
-
|
|
2820
|
-
if (
|
|
2821
|
-
return
|
|
2822
|
-
}, [
|
|
2823
|
-
var
|
|
2824
|
-
return (
|
|
2825
|
-
},
|
|
2826
|
-
var
|
|
2825
|
+
I(() => {
|
|
2826
|
+
if (P != null && P.subscribeToDataMessages)
|
|
2827
|
+
return P.subscribeToDataMessages(it);
|
|
2828
|
+
}, [P, it]), ue.current = () => {
|
|
2829
|
+
var m;
|
|
2830
|
+
return (m = Q.getRoom) == null ? void 0 : m.call(Q);
|
|
2831
|
+
}, I(() => {
|
|
2832
|
+
var K;
|
|
2827
2833
|
if (typeof window > "u") return;
|
|
2828
|
-
const
|
|
2829
|
-
if (
|
|
2830
|
-
return window.__livelayerSimulateCommand = (
|
|
2834
|
+
const m = ((K = window.location) == null ? void 0 : K.hostname) || "";
|
|
2835
|
+
if (m === "localhost" || m === "127.0.0.1" || m === "0.0.0.0" || m.endsWith(".local") || m.endsWith(".test"))
|
|
2836
|
+
return window.__livelayerSimulateCommand = (ce) => {
|
|
2831
2837
|
try {
|
|
2832
|
-
it(
|
|
2838
|
+
it(ce);
|
|
2833
2839
|
} catch (me) {
|
|
2834
2840
|
console.warn("[LiveLayer] simulate-command threw:", me);
|
|
2835
2841
|
}
|
|
@@ -2837,59 +2843,59 @@ const no = /* @__PURE__ */ new Set([
|
|
|
2837
2843
|
delete window.__livelayerSimulateCommand;
|
|
2838
2844
|
};
|
|
2839
2845
|
}, [it]);
|
|
2840
|
-
const
|
|
2841
|
-
connectionState:
|
|
2842
|
-
agentState:
|
|
2843
|
-
transcript:
|
|
2844
|
-
videoElement:
|
|
2845
|
-
audioElement:
|
|
2846
|
-
canResume:
|
|
2847
|
-
error:
|
|
2846
|
+
const w = Ye(() => P ? {
|
|
2847
|
+
connectionState: P.connectionState,
|
|
2848
|
+
agentState: P.agentState,
|
|
2849
|
+
transcript: P.transcript,
|
|
2850
|
+
videoElement: P.videoElement,
|
|
2851
|
+
audioElement: P.audioElement,
|
|
2852
|
+
canResume: P.canResume,
|
|
2853
|
+
error: P.error,
|
|
2848
2854
|
agentConfig: null,
|
|
2849
2855
|
connect: async () => {
|
|
2850
|
-
await
|
|
2856
|
+
await P.onConnect();
|
|
2851
2857
|
},
|
|
2852
|
-
disconnect: () =>
|
|
2858
|
+
disconnect: () => P.onDisconnect(),
|
|
2853
2859
|
// Dummy getRoom for shape compatibility — controlled consumers own the Room.
|
|
2854
2860
|
// Internal session's getRoom returns null when no real connect has happened,
|
|
2855
2861
|
// so we reuse its reference for type consistency.
|
|
2856
|
-
getRoom:
|
|
2862
|
+
getRoom: Q.getRoom,
|
|
2857
2863
|
isControlled: !0
|
|
2858
2864
|
} : {
|
|
2859
|
-
connectionState:
|
|
2860
|
-
agentState:
|
|
2861
|
-
transcript:
|
|
2862
|
-
videoElement:
|
|
2863
|
-
audioElement:
|
|
2864
|
-
canResume:
|
|
2865
|
-
error:
|
|
2866
|
-
agentConfig:
|
|
2867
|
-
connect:
|
|
2868
|
-
disconnect:
|
|
2869
|
-
getRoom:
|
|
2865
|
+
connectionState: Q.connectionState,
|
|
2866
|
+
agentState: Q.agentState,
|
|
2867
|
+
transcript: Q.transcript,
|
|
2868
|
+
videoElement: Q.videoElement,
|
|
2869
|
+
audioElement: Q.audioElement,
|
|
2870
|
+
canResume: Q.canResume,
|
|
2871
|
+
error: Q.error,
|
|
2872
|
+
agentConfig: Q.agentConfig,
|
|
2873
|
+
connect: Q.connect,
|
|
2874
|
+
disconnect: Q.disconnect,
|
|
2875
|
+
getRoom: Q.getRoom,
|
|
2870
2876
|
isControlled: !1
|
|
2871
|
-
}, [
|
|
2872
|
-
Pt.current =
|
|
2873
|
-
const $t =
|
|
2874
|
-
$t.current =
|
|
2877
|
+
}, [P, Q]), Pt = N(w);
|
|
2878
|
+
Pt.current = w;
|
|
2879
|
+
const $t = N(P);
|
|
2880
|
+
$t.current = P, On(
|
|
2875
2881
|
r,
|
|
2876
2882
|
() => ({
|
|
2877
|
-
sendData: async (
|
|
2883
|
+
sendData: async (m) => {
|
|
2878
2884
|
var me, at;
|
|
2879
2885
|
const p = $t.current;
|
|
2880
2886
|
if (p != null && p.publishData) {
|
|
2881
2887
|
try {
|
|
2882
|
-
await p.publishData(
|
|
2888
|
+
await p.publishData(m);
|
|
2883
2889
|
} catch (L) {
|
|
2884
2890
|
console.warn("[AvatarWidget] sendData (controlled) failed:", L);
|
|
2885
2891
|
}
|
|
2886
2892
|
return;
|
|
2887
2893
|
}
|
|
2888
|
-
const
|
|
2889
|
-
if (
|
|
2894
|
+
const K = (at = (me = Pt.current) == null ? void 0 : me.getRoom) == null ? void 0 : at.call(me), ce = K == null ? void 0 : K.localParticipant;
|
|
2895
|
+
if (ce != null && ce.publishData)
|
|
2890
2896
|
try {
|
|
2891
|
-
const L = new TextEncoder().encode(JSON.stringify(
|
|
2892
|
-
await
|
|
2897
|
+
const L = new TextEncoder().encode(JSON.stringify(m));
|
|
2898
|
+
await ce.publishData(L, { reliable: !0 });
|
|
2893
2899
|
} catch (L) {
|
|
2894
2900
|
console.warn("[AvatarWidget] sendData failed:", L);
|
|
2895
2901
|
}
|
|
@@ -2897,152 +2903,152 @@ const no = /* @__PURE__ */ new Set([
|
|
|
2897
2903
|
}),
|
|
2898
2904
|
[]
|
|
2899
2905
|
);
|
|
2900
|
-
const zt =
|
|
2901
|
-
|
|
2902
|
-
const
|
|
2903
|
-
if (!(!
|
|
2904
|
-
return p.appendChild(
|
|
2905
|
-
|
|
2906
|
+
const zt = N(null);
|
|
2907
|
+
I(() => {
|
|
2908
|
+
const m = w.videoElement, p = zt.current;
|
|
2909
|
+
if (!(!m || !p))
|
|
2910
|
+
return p.appendChild(m), () => {
|
|
2911
|
+
m.parentNode === p && p.removeChild(m);
|
|
2906
2912
|
};
|
|
2907
|
-
}, [
|
|
2908
|
-
const
|
|
2909
|
-
if (!
|
|
2910
|
-
be.attach(
|
|
2911
|
-
const p =
|
|
2912
|
-
return p && typeof p.catch == "function" && p.catch((
|
|
2913
|
-
(
|
|
2913
|
+
}, [w.videoElement]), I(() => {
|
|
2914
|
+
const m = w.audioElement;
|
|
2915
|
+
if (!m) return;
|
|
2916
|
+
be.attach(m);
|
|
2917
|
+
const p = m.play();
|
|
2918
|
+
return p && typeof p.catch == "function" && p.catch((K) => {
|
|
2919
|
+
(K == null ? void 0 : K.name) === "NotAllowedError" && tt(!0);
|
|
2914
2920
|
}), () => {
|
|
2915
2921
|
be.detach();
|
|
2916
2922
|
};
|
|
2917
|
-
}, [
|
|
2918
|
-
if (
|
|
2919
|
-
const
|
|
2920
|
-
if (
|
|
2921
|
-
return
|
|
2923
|
+
}, [w.audioElement]), I(() => {
|
|
2924
|
+
if (w.isControlled || w.connectionState !== "connected") return;
|
|
2925
|
+
const m = w.getRoom();
|
|
2926
|
+
if (m)
|
|
2927
|
+
return X.setupMic(m).catch(() => {
|
|
2922
2928
|
}), () => {
|
|
2923
|
-
|
|
2929
|
+
X.teardownMic();
|
|
2924
2930
|
};
|
|
2925
|
-
}, [
|
|
2931
|
+
}, [w.isControlled, w.connectionState]), I(() => {
|
|
2926
2932
|
var p;
|
|
2927
|
-
if (
|
|
2928
|
-
const
|
|
2929
|
-
if (
|
|
2930
|
-
return de.attachRoom(
|
|
2933
|
+
if (w.connectionState !== "connected") return;
|
|
2934
|
+
const m = w.isControlled ? (p = P == null ? void 0 : P.getRoom) == null ? void 0 : p.call(P) : w.getRoom();
|
|
2935
|
+
if (m)
|
|
2936
|
+
return de.attachRoom(m), we.attachRoom(m), w.isControlled && X.attachRoom(m), Oe.refresh(), () => {
|
|
2931
2937
|
de.teardown(), we.teardown();
|
|
2932
2938
|
};
|
|
2933
|
-
}, [
|
|
2934
|
-
const
|
|
2935
|
-
|
|
2936
|
-
}, [
|
|
2937
|
-
const kn = E((
|
|
2938
|
-
const p = { type: "user_message", text:
|
|
2939
|
-
if (
|
|
2939
|
+
}, [w.isControlled, w.connectionState, P]), I(() => {
|
|
2940
|
+
const m = w.audioElement;
|
|
2941
|
+
m && (m.muted = He);
|
|
2942
|
+
}, [w.audioElement, He]);
|
|
2943
|
+
const kn = E((m) => {
|
|
2944
|
+
const p = { type: "user_message", text: m };
|
|
2945
|
+
if (P != null && P.publishData) {
|
|
2940
2946
|
try {
|
|
2941
|
-
|
|
2947
|
+
P.publishData(p);
|
|
2942
2948
|
} catch {
|
|
2943
2949
|
}
|
|
2944
2950
|
return;
|
|
2945
2951
|
}
|
|
2946
|
-
const
|
|
2947
|
-
if (
|
|
2952
|
+
const K = w.getRoom();
|
|
2953
|
+
if (K)
|
|
2948
2954
|
try {
|
|
2949
|
-
const
|
|
2950
|
-
|
|
2955
|
+
const ce = new TextEncoder().encode(JSON.stringify(p));
|
|
2956
|
+
K.localParticipant.publishData(ce, { reliable: !0 });
|
|
2951
2957
|
} catch {
|
|
2952
2958
|
}
|
|
2953
|
-
}, [
|
|
2954
|
-
gt((
|
|
2959
|
+
}, [w, P]), Ln = E(() => {
|
|
2960
|
+
gt((m) => !m);
|
|
2955
2961
|
}, []);
|
|
2956
|
-
|
|
2957
|
-
Ne == null || Ne(
|
|
2958
|
-
}, [
|
|
2959
|
-
Se == null || Se(
|
|
2960
|
-
}, [
|
|
2961
|
-
$e == null || $e(
|
|
2962
|
-
}, [
|
|
2963
|
-
We.setThinking(
|
|
2964
|
-
}, [
|
|
2965
|
-
const Ot =
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
}, [
|
|
2962
|
+
I(() => {
|
|
2963
|
+
Ne == null || Ne(w.connectionState), w.connectionState === "connected" ? Ce == null || Ce() : w.connectionState === "disconnected" && (Pe == null || Pe());
|
|
2964
|
+
}, [w.connectionState, Ce, Pe, Ne]), I(() => {
|
|
2965
|
+
Se == null || Se(w.transcript);
|
|
2966
|
+
}, [w.transcript, Se]), I(() => {
|
|
2967
|
+
$e == null || $e(w.agentState);
|
|
2968
|
+
}, [w.agentState, $e]), I(() => {
|
|
2969
|
+
We.setThinking(w.agentState === "thinking");
|
|
2970
|
+
}, [w.agentState, We]);
|
|
2971
|
+
const Ot = N(!1);
|
|
2972
|
+
I(() => {
|
|
2973
|
+
w.isControlled || !y || Ot.current || re && w.connectionState === "idle" && (Ot.current = !0, w.connect());
|
|
2974
|
+
}, [y, w.connectionState, w, re]);
|
|
2969
2975
|
const En = E(
|
|
2970
|
-
(
|
|
2971
|
-
const p =
|
|
2972
|
-
p && (ot(!1),
|
|
2976
|
+
(m) => {
|
|
2977
|
+
const p = S == null ? void 0 : S.find((K) => K.id === m);
|
|
2978
|
+
p && (ot(!1), m !== Te && (nt(!0), w.disconnect(), Qe || ze(m), D == null || D(p)));
|
|
2973
2979
|
},
|
|
2974
2980
|
[
|
|
2975
|
-
|
|
2981
|
+
S,
|
|
2976
2982
|
Te,
|
|
2977
|
-
|
|
2983
|
+
w,
|
|
2978
2984
|
Qe,
|
|
2979
2985
|
D
|
|
2980
2986
|
]
|
|
2981
2987
|
);
|
|
2982
|
-
|
|
2983
|
-
_e &&
|
|
2984
|
-
}, [
|
|
2988
|
+
I(() => {
|
|
2989
|
+
_e && w.connectionState === "connected" && nt(!1);
|
|
2990
|
+
}, [w.connectionState, _e]), I(() => {
|
|
2985
2991
|
if (!rt) return;
|
|
2986
|
-
const
|
|
2992
|
+
const m = (p) => {
|
|
2987
2993
|
p.key === "Escape" && ot(!1);
|
|
2988
2994
|
};
|
|
2989
|
-
return window.addEventListener("keydown",
|
|
2995
|
+
return window.addEventListener("keydown", m), () => window.removeEventListener("keydown", m);
|
|
2990
2996
|
}, [rt]);
|
|
2991
|
-
const Cn = !!B || !!(
|
|
2997
|
+
const Cn = !!B || !!(ee != null && ee.avatarImageUrl) || w.isControlled, lt = Xn(mt, l, Cn);
|
|
2992
2998
|
Xe === void 0 && ((qt = lt.info) != null && qt.capabilities) && (Ct.current = lt.info.capabilities);
|
|
2993
|
-
const yt = (
|
|
2994
|
-
() =>
|
|
2995
|
-
[
|
|
2999
|
+
const yt = (ee == null ? void 0 : ee.name) ?? q ?? ((Ft = w.agentConfig) == null ? void 0 : Ft.name) ?? ((Ut = lt.info) == null ? void 0 : Ut.name) ?? "Live Layer", St = (ee == null ? void 0 : ee.avatarImageUrl) ?? B ?? ((jt = w.agentConfig) == null ? void 0 : jt.avatarImageUrl) ?? ((Vt = lt.info) == null ? void 0 : Vt.avatarImageUrl) ?? null, Sn = k ?? ((Yt = w.agentConfig) == null ? void 0 : Yt.idleLoopUrl) ?? ((Gt = lt.info) == null ? void 0 : Gt.idleLoopUrl) ?? null, Nn = R ?? null, An = E(() => ie("expanded"), [ie]), Rn = E(
|
|
3000
|
+
() => ie("minimized"),
|
|
3001
|
+
[ie]
|
|
2996
3002
|
), Ht = E(() => {
|
|
2997
|
-
|
|
2998
|
-
}, [
|
|
2999
|
-
const
|
|
3000
|
-
|
|
3003
|
+
w.disconnect(), ie("hidden");
|
|
3004
|
+
}, [w, ie]), In = E(() => {
|
|
3005
|
+
const m = w.audioElement;
|
|
3006
|
+
m && m.play().then(() => tt(!1)).catch(() => {
|
|
3001
3007
|
});
|
|
3002
|
-
}, [
|
|
3003
|
-
tt(!1),
|
|
3004
|
-
}, [
|
|
3008
|
+
}, [w.audioElement]), Mn = E(() => {
|
|
3009
|
+
tt(!1), w.connect();
|
|
3010
|
+
}, [w]), Be = {
|
|
3005
3011
|
...xt,
|
|
3006
3012
|
...et ? {} : { zIndex: Ie }
|
|
3007
3013
|
};
|
|
3008
|
-
|
|
3014
|
+
F.primaryColor && (Be["--ll-color-primary"] = F.primaryColor), F.accentColor && (Be["--ll-color-accent"] = F.accentColor), F.backgroundColor && (Be["--ll-color-bg"] = F.backgroundColor), F.textColor && (Be["--ll-color-fg"] = F.textColor);
|
|
3009
3015
|
const Tn = [
|
|
3010
3016
|
"ll-widget",
|
|
3011
|
-
`ll-widget--${
|
|
3017
|
+
`ll-widget--${oe}`,
|
|
3012
3018
|
`ll-widget--${se ? "mobile" : "desktop"}`,
|
|
3013
3019
|
ht
|
|
3014
3020
|
].filter(Boolean).join(" ");
|
|
3015
|
-
if (!
|
|
3021
|
+
if (!re) return null;
|
|
3016
3022
|
const Dn = /* @__PURE__ */ n(
|
|
3017
3023
|
"div",
|
|
3018
3024
|
{
|
|
3019
3025
|
className: Tn,
|
|
3020
3026
|
style: Be,
|
|
3021
|
-
"data-display-mode":
|
|
3022
|
-
"data-position":
|
|
3023
|
-
"data-experience-mode":
|
|
3024
|
-
children:
|
|
3027
|
+
"data-display-mode": oe,
|
|
3028
|
+
"data-position": _,
|
|
3029
|
+
"data-experience-mode": u === "EMBEDDED" ? "embedded" : "widget",
|
|
3030
|
+
children: oe === "expanded" && /* @__PURE__ */ n(
|
|
3025
3031
|
Ir,
|
|
3026
3032
|
{
|
|
3027
|
-
position:
|
|
3033
|
+
position: _,
|
|
3028
3034
|
isMobile: se,
|
|
3029
3035
|
agentName: yt,
|
|
3030
3036
|
avatarImageUrl: St,
|
|
3031
3037
|
idleLoopUrl: Sn,
|
|
3032
3038
|
greeting: Nn,
|
|
3033
|
-
branding:
|
|
3034
|
-
teamMembers:
|
|
3039
|
+
branding: F,
|
|
3040
|
+
teamMembers: S,
|
|
3035
3041
|
currentTeamMemberId: Te,
|
|
3036
3042
|
isSwitchingTeamMember: _e,
|
|
3037
3043
|
teamSwitcherOpen: rt,
|
|
3038
|
-
onToggleTeamSwitcher: () => ot((
|
|
3044
|
+
onToggleTeamSwitcher: () => ot((m) => !m),
|
|
3039
3045
|
onSelectTeamMember: En,
|
|
3040
|
-
connectionState:
|
|
3041
|
-
agentState:
|
|
3042
|
-
transcript:
|
|
3043
|
-
isMuted:
|
|
3046
|
+
connectionState: w.connectionState,
|
|
3047
|
+
agentState: w.agentState,
|
|
3048
|
+
transcript: w.transcript,
|
|
3049
|
+
isMuted: X.isMuted,
|
|
3044
3050
|
micDevices: Oe.mics,
|
|
3045
|
-
activeMicId:
|
|
3051
|
+
activeMicId: X.activeDeviceId,
|
|
3046
3052
|
isCameraEnabled: de.isEnabled,
|
|
3047
3053
|
cameraPreviewEl: de.previewEl,
|
|
3048
3054
|
cameraDevices: Oe.cameras,
|
|
@@ -3050,83 +3056,84 @@ const no = /* @__PURE__ */ new Set([
|
|
|
3050
3056
|
isScreenShareEnabled: we.isEnabled,
|
|
3051
3057
|
screenPreviewEl: we.previewEl,
|
|
3052
3058
|
isSpeakerMuted: He,
|
|
3053
|
-
allowCamera:
|
|
3054
|
-
allowScreenShare:
|
|
3055
|
-
allowTyping:
|
|
3056
|
-
showMinimize:
|
|
3057
|
-
chromeless:
|
|
3059
|
+
allowCamera: U,
|
|
3060
|
+
allowScreenShare: O,
|
|
3061
|
+
allowTyping: j,
|
|
3062
|
+
showMinimize: H,
|
|
3063
|
+
chromeless: G,
|
|
3058
3064
|
compactControls: fe,
|
|
3059
3065
|
transforming: ye,
|
|
3060
3066
|
transformingLabel: pe,
|
|
3061
3067
|
languageMenuOpen: xe,
|
|
3062
|
-
onToggleLanguageMenu: () => ke((
|
|
3068
|
+
onToggleLanguageMenu: () => ke((m) => !m),
|
|
3063
3069
|
needsUserGesture: kt,
|
|
3064
|
-
canResume:
|
|
3065
|
-
micError:
|
|
3066
|
-
error:
|
|
3070
|
+
canResume: w.canResume,
|
|
3071
|
+
micError: X.micError,
|
|
3072
|
+
error: w.error,
|
|
3067
3073
|
avatarVideoContainerRef: zt,
|
|
3068
|
-
agentVideoEl:
|
|
3069
|
-
onConnect: () => void
|
|
3070
|
-
onDisconnect: () =>
|
|
3074
|
+
agentVideoEl: w.videoElement,
|
|
3075
|
+
onConnect: () => void w.connect(),
|
|
3076
|
+
onDisconnect: () => w.disconnect(),
|
|
3071
3077
|
onRetry: Mn,
|
|
3072
3078
|
onResumeAudio: In,
|
|
3073
|
-
onToggleMute:
|
|
3074
|
-
onSwitchMicDevice: (
|
|
3079
|
+
onToggleMute: X.toggleMute,
|
|
3080
|
+
onSwitchMicDevice: (m) => void X.switchDevice(m),
|
|
3075
3081
|
onToggleCamera: () => void de.toggle(),
|
|
3076
|
-
onSwitchCameraDevice: (
|
|
3082
|
+
onSwitchCameraDevice: (m) => void de.switchDevice(m),
|
|
3077
3083
|
onToggleScreenShare: () => void we.toggle(),
|
|
3078
3084
|
onToggleSpeaker: Ln,
|
|
3079
3085
|
onSendMessage: kn,
|
|
3080
3086
|
onMinimize: Rn,
|
|
3081
3087
|
onClose: Ht,
|
|
3082
|
-
onClearMicError:
|
|
3088
|
+
onClearMicError: X.clearError
|
|
3083
3089
|
}
|
|
3084
3090
|
)
|
|
3085
3091
|
}
|
|
3086
|
-
), Wt =
|
|
3092
|
+
), Wt = oe === "hidden" || oe === "minimized" ? /* @__PURE__ */ g(
|
|
3087
3093
|
"div",
|
|
3088
3094
|
{
|
|
3089
3095
|
className: [
|
|
3090
3096
|
"ll-widget",
|
|
3091
3097
|
"ll-widget--floating",
|
|
3092
|
-
`ll-widget--${
|
|
3098
|
+
`ll-widget--${oe}`,
|
|
3093
3099
|
`ll-widget--${se ? "mobile" : "desktop"}`
|
|
3094
3100
|
].join(" "),
|
|
3095
3101
|
style: Be,
|
|
3096
|
-
"data-display-mode":
|
|
3097
|
-
"data-position":
|
|
3102
|
+
"data-display-mode": oe,
|
|
3103
|
+
"data-position": _,
|
|
3098
3104
|
children: [
|
|
3099
|
-
|
|
3105
|
+
oe === "hidden" && /* @__PURE__ */ n(
|
|
3100
3106
|
xr,
|
|
3101
3107
|
{
|
|
3102
|
-
position:
|
|
3108
|
+
position: _,
|
|
3103
3109
|
isMobile: se,
|
|
3104
|
-
isSpeaking:
|
|
3105
|
-
onExpand: () =>
|
|
3110
|
+
isSpeaking: w.agentState === "speaking",
|
|
3111
|
+
onExpand: () => ie("expanded"),
|
|
3106
3112
|
label: `Open ${yt} widget`,
|
|
3107
3113
|
avatarImageUrl: St,
|
|
3108
|
-
agentName: yt
|
|
3114
|
+
agentName: yt,
|
|
3115
|
+
containerEl: le
|
|
3109
3116
|
}
|
|
3110
3117
|
),
|
|
3111
|
-
|
|
3118
|
+
oe === "minimized" && /* @__PURE__ */ n(
|
|
3112
3119
|
Lr,
|
|
3113
3120
|
{
|
|
3114
|
-
position:
|
|
3121
|
+
position: _,
|
|
3115
3122
|
isMobile: se,
|
|
3116
3123
|
agentName: yt,
|
|
3117
3124
|
avatarImageUrl: St,
|
|
3118
|
-
agentState:
|
|
3119
|
-
isMuted:
|
|
3125
|
+
agentState: w.agentState,
|
|
3126
|
+
isMuted: X.isMuted,
|
|
3120
3127
|
audioLevel: be,
|
|
3121
3128
|
onExpand: An,
|
|
3122
|
-
onToggleMute:
|
|
3129
|
+
onToggleMute: X.toggleMute,
|
|
3123
3130
|
onClose: Ht
|
|
3124
3131
|
}
|
|
3125
3132
|
)
|
|
3126
3133
|
]
|
|
3127
3134
|
}
|
|
3128
|
-
) : null, Bt =
|
|
3129
|
-
return /* @__PURE__ */
|
|
3135
|
+
) : null, Bt = le ?? (typeof document < "u" ? document.body : null);
|
|
3136
|
+
return /* @__PURE__ */ g(Ve, { children: [
|
|
3130
3137
|
Dn,
|
|
3131
3138
|
Wt && Bt && Rt(Wt, Bt)
|
|
3132
3139
|
] });
|
|
@@ -3148,21 +3155,21 @@ const ho = ({
|
|
|
3148
3155
|
className: l,
|
|
3149
3156
|
style: d
|
|
3150
3157
|
}) => {
|
|
3151
|
-
const a =
|
|
3152
|
-
|
|
3153
|
-
const
|
|
3154
|
-
var
|
|
3155
|
-
const c =
|
|
3156
|
-
(
|
|
3158
|
+
const a = N(null), s = N(null), u = N(i);
|
|
3159
|
+
u.current = i;
|
|
3160
|
+
const y = E((f) => {
|
|
3161
|
+
var A;
|
|
3162
|
+
const c = f.detail;
|
|
3163
|
+
(A = u.current) == null || A.call(u, c);
|
|
3157
3164
|
}, []);
|
|
3158
|
-
return
|
|
3159
|
-
const
|
|
3160
|
-
if (!
|
|
3165
|
+
return I(() => {
|
|
3166
|
+
const f = a.current;
|
|
3167
|
+
if (!f) return;
|
|
3161
3168
|
const c = document.createElement("livelayer-widget");
|
|
3162
|
-
return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), o && c.setAttribute("mode", o), c.addEventListener("agent-event",
|
|
3163
|
-
c.removeEventListener("agent-event",
|
|
3169
|
+
return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), o && c.setAttribute("mode", o), c.addEventListener("agent-event", y), f.appendChild(c), s.current = c, () => {
|
|
3170
|
+
c.removeEventListener("agent-event", y), f.removeChild(c), s.current = null;
|
|
3164
3171
|
};
|
|
3165
|
-
}, [e]),
|
|
3172
|
+
}, [e]), I(() => {
|
|
3166
3173
|
s.current && (o ? s.current.setAttribute("mode", o) : s.current.removeAttribute("mode"));
|
|
3167
3174
|
}, [o]), /* @__PURE__ */ n("div", { ref: a, className: l, style: d });
|
|
3168
3175
|
}, mo = dt(
|
|
@@ -3197,7 +3204,7 @@ const ho = ({
|
|
|
3197
3204
|
const { name: o, label: i, labelClassName: l } = t, d = { name: o, "data-ll-field": o };
|
|
3198
3205
|
let a;
|
|
3199
3206
|
if ("as" in t && t.as === "textarea") {
|
|
3200
|
-
const { name: s, label:
|
|
3207
|
+
const { name: s, label: u, labelClassName: y, as: f, ...c } = t;
|
|
3201
3208
|
a = /* @__PURE__ */ n(
|
|
3202
3209
|
"textarea",
|
|
3203
3210
|
{
|
|
@@ -3207,18 +3214,18 @@ const ho = ({
|
|
|
3207
3214
|
}
|
|
3208
3215
|
);
|
|
3209
3216
|
} else if ("as" in t && t.as === "select") {
|
|
3210
|
-
const { name: s, label:
|
|
3217
|
+
const { name: s, label: u, labelClassName: y, as: f, children: c, ...A } = t;
|
|
3211
3218
|
a = /* @__PURE__ */ n(
|
|
3212
3219
|
"select",
|
|
3213
3220
|
{
|
|
3214
3221
|
ref: r,
|
|
3215
3222
|
...d,
|
|
3216
|
-
...
|
|
3223
|
+
...A,
|
|
3217
3224
|
children: c
|
|
3218
3225
|
}
|
|
3219
3226
|
);
|
|
3220
3227
|
} else {
|
|
3221
|
-
const { name: s, label:
|
|
3228
|
+
const { name: s, label: u, labelClassName: y, as: f, ...c } = t;
|
|
3222
3229
|
a = /* @__PURE__ */ n(
|
|
3223
3230
|
"input",
|
|
3224
3231
|
{
|
|
@@ -3228,7 +3235,7 @@ const ho = ({
|
|
|
3228
3235
|
}
|
|
3229
3236
|
);
|
|
3230
3237
|
}
|
|
3231
|
-
return i === void 0 ? a : /* @__PURE__ */
|
|
3238
|
+
return i === void 0 ? a : /* @__PURE__ */ g("label", { className: l, children: [
|
|
3232
3239
|
i,
|
|
3233
3240
|
a
|
|
3234
3241
|
] });
|
|
@@ -3240,61 +3247,61 @@ function vo({
|
|
|
3240
3247
|
defaultOpen: t = !1,
|
|
3241
3248
|
storageKey: r = "ll-debug-open"
|
|
3242
3249
|
}) {
|
|
3243
|
-
const [o, i] = C(t), [l, d] = C([]), [a, s] = C(""), [
|
|
3244
|
-
|
|
3250
|
+
const [o, i] = C(t), [l, d] = C([]), [a, s] = C(""), [u, y] = C(!1), f = N(/* @__PURE__ */ new Set()), c = N([]), A = N(u);
|
|
3251
|
+
A.current = u, I(() => {
|
|
3245
3252
|
try {
|
|
3246
|
-
const
|
|
3247
|
-
|
|
3253
|
+
const b = localStorage.getItem(r);
|
|
3254
|
+
b === "1" && i(!0), b === "0" && i(!1);
|
|
3248
3255
|
} catch {
|
|
3249
3256
|
}
|
|
3250
|
-
}, [r]),
|
|
3257
|
+
}, [r]), I(() => {
|
|
3251
3258
|
try {
|
|
3252
3259
|
localStorage.setItem(r, o ? "1" : "0");
|
|
3253
3260
|
} catch {
|
|
3254
3261
|
}
|
|
3255
|
-
}, [o, r]),
|
|
3256
|
-
const
|
|
3257
|
-
(
|
|
3262
|
+
}, [o, r]), I(() => {
|
|
3263
|
+
const b = (v) => {
|
|
3264
|
+
(v.metaKey || v.ctrlKey) && v.shiftKey && v.key.toLowerCase() === "l" && (v.preventDefault(), i((S) => !S));
|
|
3258
3265
|
};
|
|
3259
|
-
return window.addEventListener("keydown",
|
|
3260
|
-
}, []),
|
|
3261
|
-
const
|
|
3262
|
-
if (c.current.length === 0 ||
|
|
3263
|
-
const
|
|
3266
|
+
return window.addEventListener("keydown", b), () => window.removeEventListener("keydown", b);
|
|
3267
|
+
}, []), I(() => {
|
|
3268
|
+
const b = setInterval(() => {
|
|
3269
|
+
if (c.current.length === 0 || A.current) return;
|
|
3270
|
+
const v = c.current.splice(0, c.current.length);
|
|
3264
3271
|
d(
|
|
3265
|
-
(
|
|
3272
|
+
(S) => [...v.reverse(), ...S].slice(0, 200)
|
|
3266
3273
|
);
|
|
3267
3274
|
}, 100);
|
|
3268
|
-
return () => clearInterval(
|
|
3275
|
+
return () => clearInterval(b);
|
|
3269
3276
|
}, []);
|
|
3270
|
-
const
|
|
3271
|
-
if (
|
|
3272
|
-
!e ||
|
|
3277
|
+
const _ = N(!1);
|
|
3278
|
+
if (I(() => {
|
|
3279
|
+
!e || _.current || (_.current = !0, e((b) => {
|
|
3273
3280
|
c.current.push({
|
|
3274
3281
|
id: pn++,
|
|
3275
3282
|
ts: Date.now(),
|
|
3276
3283
|
kind: "event",
|
|
3277
|
-
type:
|
|
3278
|
-
data:
|
|
3284
|
+
type: b.eventName,
|
|
3285
|
+
data: b.data
|
|
3279
3286
|
});
|
|
3280
3287
|
}));
|
|
3281
|
-
}, [e]),
|
|
3282
|
-
const
|
|
3288
|
+
}, [e]), I(() => {
|
|
3289
|
+
const b = console.warn, v = console.log, S = (M, D) => function(...k) {
|
|
3283
3290
|
try {
|
|
3284
|
-
const R = typeof
|
|
3291
|
+
const R = typeof k[0] == "string" ? k[0] : "";
|
|
3285
3292
|
R.startsWith("[LiveLayer]") && c.current.push({
|
|
3286
3293
|
id: pn++,
|
|
3287
3294
|
ts: Date.now(),
|
|
3288
|
-
kind:
|
|
3295
|
+
kind: M,
|
|
3289
3296
|
type: R.slice(0, 120),
|
|
3290
|
-
data: { args:
|
|
3297
|
+
data: { args: k.slice(1).map((B) => io(B)) }
|
|
3291
3298
|
});
|
|
3292
3299
|
} catch {
|
|
3293
3300
|
}
|
|
3294
|
-
return D.apply(this,
|
|
3301
|
+
return D.apply(this, k);
|
|
3295
3302
|
};
|
|
3296
|
-
return console.warn =
|
|
3297
|
-
console.warn =
|
|
3303
|
+
return console.warn = S("warn", b), console.log = S("log", v), () => {
|
|
3304
|
+
console.warn = b, console.log = v;
|
|
3298
3305
|
};
|
|
3299
3306
|
}, []), !o)
|
|
3300
3307
|
return /* @__PURE__ */ n(
|
|
@@ -3323,12 +3330,12 @@ function vo({
|
|
|
3323
3330
|
children: "🛰 LL debug"
|
|
3324
3331
|
}
|
|
3325
3332
|
);
|
|
3326
|
-
const
|
|
3333
|
+
const x = l.filter((b) => {
|
|
3327
3334
|
if (!a) return !0;
|
|
3328
|
-
const
|
|
3329
|
-
return
|
|
3335
|
+
const v = a.toLowerCase();
|
|
3336
|
+
return b.type.toLowerCase().includes(v) || JSON.stringify(b.data || {}).toLowerCase().includes(v);
|
|
3330
3337
|
});
|
|
3331
|
-
return /* @__PURE__ */
|
|
3338
|
+
return /* @__PURE__ */ g(
|
|
3332
3339
|
"div",
|
|
3333
3340
|
{
|
|
3334
3341
|
style: {
|
|
@@ -3350,7 +3357,7 @@ function vo({
|
|
|
3350
3357
|
overflow: "hidden"
|
|
3351
3358
|
},
|
|
3352
3359
|
children: [
|
|
3353
|
-
/* @__PURE__ */
|
|
3360
|
+
/* @__PURE__ */ g(
|
|
3354
3361
|
"div",
|
|
3355
3362
|
{
|
|
3356
3363
|
style: {
|
|
@@ -3363,7 +3370,7 @@ function vo({
|
|
|
3363
3370
|
},
|
|
3364
3371
|
children: [
|
|
3365
3372
|
/* @__PURE__ */ n("span", { style: { fontWeight: 600, fontSize: 12 }, children: "LiveLayer debug" }),
|
|
3366
|
-
/* @__PURE__ */
|
|
3373
|
+
/* @__PURE__ */ g("span", { style: { fontSize: 10, color: "rgba(255,255,255,0.4)" }, children: [
|
|
3367
3374
|
l.length,
|
|
3368
3375
|
" event",
|
|
3369
3376
|
l.length === 1 ? "" : "s"
|
|
@@ -3373,10 +3380,10 @@ function vo({
|
|
|
3373
3380
|
"button",
|
|
3374
3381
|
{
|
|
3375
3382
|
type: "button",
|
|
3376
|
-
onClick: () =>
|
|
3377
|
-
style: At(
|
|
3383
|
+
onClick: () => y((b) => !b),
|
|
3384
|
+
style: At(u ? "#f59e0b" : "transparent"),
|
|
3378
3385
|
title: "Pause / resume capture",
|
|
3379
|
-
children:
|
|
3386
|
+
children: u ? "▶ resume" : "⏸ pause"
|
|
3380
3387
|
}
|
|
3381
3388
|
),
|
|
3382
3389
|
/* @__PURE__ */ n(
|
|
@@ -3410,7 +3417,7 @@ function vo({
|
|
|
3410
3417
|
{
|
|
3411
3418
|
type: "text",
|
|
3412
3419
|
value: a,
|
|
3413
|
-
onChange: (
|
|
3420
|
+
onChange: (b) => s(b.target.value),
|
|
3414
3421
|
placeholder: "filter by type or data…",
|
|
3415
3422
|
style: {
|
|
3416
3423
|
margin: 8,
|
|
@@ -3432,7 +3439,7 @@ function vo({
|
|
|
3432
3439
|
overflowY: "auto",
|
|
3433
3440
|
padding: "0 8px 8px"
|
|
3434
3441
|
},
|
|
3435
|
-
children:
|
|
3442
|
+
children: x.length === 0 ? /* @__PURE__ */ g(
|
|
3436
3443
|
"div",
|
|
3437
3444
|
{
|
|
3438
3445
|
style: {
|
|
@@ -3462,16 +3469,16 @@ function vo({
|
|
|
3462
3469
|
)
|
|
3463
3470
|
]
|
|
3464
3471
|
}
|
|
3465
|
-
) :
|
|
3472
|
+
) : x.map((b) => /* @__PURE__ */ n(
|
|
3466
3473
|
oo,
|
|
3467
3474
|
{
|
|
3468
|
-
entry:
|
|
3469
|
-
expanded:
|
|
3475
|
+
entry: b,
|
|
3476
|
+
expanded: f.current.has(b.id),
|
|
3470
3477
|
onToggle: () => {
|
|
3471
|
-
|
|
3478
|
+
f.current.has(b.id) ? f.current.delete(b.id) : f.current.add(b.id), d((v) => [...v]);
|
|
3472
3479
|
}
|
|
3473
3480
|
},
|
|
3474
|
-
|
|
3481
|
+
b.id
|
|
3475
3482
|
))
|
|
3476
3483
|
}
|
|
3477
3484
|
)
|
|
@@ -3487,7 +3494,7 @@ function oo({
|
|
|
3487
3494
|
const o = e.kind === "warn" ? "#f59e0b" : e.type.startsWith("[LiveLayer]") ? "#94a3b8" : e.type === "navigate" || e.type === "scroll_page" || e.type === "scroll_to" || e.type === "click" ? "#22c55e" : e.type === "fill_form" || e.type === "submit_form" || e.type === "focus_field" ? "#a78bfa" : e.type === "request_page_context" || e.type === "request_routes" ? "#38bdf8" : e.type === "agent_state" ? "#facc15" : "#cbd5e1", i = new Date(e.ts).toLocaleTimeString("en-US", {
|
|
3488
3495
|
hour12: !1
|
|
3489
3496
|
});
|
|
3490
|
-
return /* @__PURE__ */
|
|
3497
|
+
return /* @__PURE__ */ g(
|
|
3491
3498
|
"button",
|
|
3492
3499
|
{
|
|
3493
3500
|
type: "button",
|
|
@@ -3505,7 +3512,7 @@ function oo({
|
|
|
3505
3512
|
lineHeight: 1.4
|
|
3506
3513
|
},
|
|
3507
3514
|
children: [
|
|
3508
|
-
/* @__PURE__ */
|
|
3515
|
+
/* @__PURE__ */ g("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
3509
3516
|
/* @__PURE__ */ n(
|
|
3510
3517
|
"span",
|
|
3511
3518
|
{
|