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