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