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