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