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