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