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