@livelayer/react 0.19.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +24 -1
- package/dist/index.js +3 -3
- package/dist/index.mjs +1441 -1423
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as C, jsx as n, Fragment as
|
|
3
|
-
import { Component as or, useState as M, useRef as I, useEffect as P, useCallback as L, useMemo as
|
|
4
|
-
import { createPortal as
|
|
2
|
+
import { jsxs as C, jsx as n, Fragment as We } from "react/jsx-runtime";
|
|
3
|
+
import { Component as or, useState as M, useRef as I, useEffect as P, useCallback as L, useMemo as nt, useLayoutEffect as In, forwardRef as Bt, useImperativeHandle as lr, createElement as ar } from "react";
|
|
4
|
+
import { createPortal as qt } from "react-dom";
|
|
5
5
|
import { LiveKitSession as sr, registerFields as cr } from "@livelayer/sdk";
|
|
6
6
|
import { clearFieldRegistry as io, getRegisteredFields as oo, registerFields as lo, setFieldValue as ao } from "@livelayer/sdk";
|
|
7
|
-
import { createLocalAudioTrack as
|
|
7
|
+
import { createLocalAudioTrack as ur, Track as Rn, createLocalVideoTrack as dr } from "livekit-client";
|
|
8
8
|
class fr extends or {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments), this.state = { hasError: !1, error: null }, this.reset = () => {
|
|
@@ -15,8 +15,8 @@ class fr extends or {
|
|
|
15
15
|
return { hasError: !0, error: t };
|
|
16
16
|
}
|
|
17
17
|
componentDidCatch(t, r) {
|
|
18
|
-
var i,
|
|
19
|
-
(
|
|
18
|
+
var i, l;
|
|
19
|
+
(l = (i = this.props).onError) == null || l.call(i, t, r);
|
|
20
20
|
}
|
|
21
21
|
render() {
|
|
22
22
|
var t;
|
|
@@ -36,25 +36,25 @@ class fr extends or {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
function pr(e) {
|
|
39
|
-
const [t, r] = M("idle"), [i,
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
onConnectionStateChange: (
|
|
43
|
-
r(
|
|
39
|
+
const [t, r] = M("idle"), [i, l] = M("idle"), [o, s] = M([]), [a, c] = M(null), [d, v] = M(null), [p, h] = M(null), [T, _] = M(!1), [E, g] = M(null), b = I(null), R = I(e.onDataMessage);
|
|
40
|
+
R.current = e.onDataMessage, P(() => {
|
|
41
|
+
const m = {
|
|
42
|
+
onConnectionStateChange: (F) => {
|
|
43
|
+
r(F), F === "connected" && g(null);
|
|
44
44
|
},
|
|
45
|
-
onAgentStateChange:
|
|
46
|
-
onTranscript: (
|
|
45
|
+
onAgentStateChange: l,
|
|
46
|
+
onTranscript: (F) => s([...F]),
|
|
47
47
|
onAgentConfig: c,
|
|
48
|
-
onAudioTrack: (
|
|
49
|
-
onVideoTrack: (
|
|
50
|
-
onVideoTrackRemoved: () =>
|
|
51
|
-
onError: (
|
|
52
|
-
onDataMessage: (
|
|
48
|
+
onAudioTrack: (F) => h(F),
|
|
49
|
+
onVideoTrack: (F) => v(F),
|
|
50
|
+
onVideoTrackRemoved: () => v(null),
|
|
51
|
+
onError: (F) => g(F),
|
|
52
|
+
onDataMessage: (F) => {
|
|
53
53
|
var K;
|
|
54
|
-
(K =
|
|
54
|
+
(K = R.current) == null || K.call(R, F);
|
|
55
55
|
},
|
|
56
|
-
onResumabilityChange:
|
|
57
|
-
},
|
|
56
|
+
onResumabilityChange: _
|
|
57
|
+
}, D = new sr(
|
|
58
58
|
{
|
|
59
59
|
agentId: e.agentId,
|
|
60
60
|
baseUrl: e.baseUrl,
|
|
@@ -62,11 +62,11 @@ function pr(e) {
|
|
|
62
62
|
sessionEndpoint: e.sessionEndpoint,
|
|
63
63
|
sessionBody: e.sessionBody
|
|
64
64
|
},
|
|
65
|
-
|
|
65
|
+
m
|
|
66
66
|
);
|
|
67
|
-
return
|
|
68
|
-
var
|
|
69
|
-
(
|
|
67
|
+
return b.current = D, r("idle"), l("idle"), s([]), c(null), v(null), h(null), _(!1), g(null), () => {
|
|
68
|
+
var F;
|
|
69
|
+
(F = D.destroy) == null || F.call(D), b.current = null;
|
|
70
70
|
};
|
|
71
71
|
}, [
|
|
72
72
|
e.agentId,
|
|
@@ -75,136 +75,136 @@ function pr(e) {
|
|
|
75
75
|
e.sessionEndpoint,
|
|
76
76
|
JSON.stringify(e.sessionBody ?? {})
|
|
77
77
|
]);
|
|
78
|
-
const
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
78
|
+
const k = L(async () => {
|
|
79
|
+
const m = b.current;
|
|
80
|
+
if (m)
|
|
81
81
|
try {
|
|
82
|
-
await
|
|
83
|
-
} catch (
|
|
84
|
-
throw
|
|
82
|
+
await m.connect();
|
|
83
|
+
} catch (D) {
|
|
84
|
+
throw g(D instanceof Error ? D.message : String(D)), D;
|
|
85
85
|
}
|
|
86
|
-
}, []),
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
}, []),
|
|
90
|
-
var
|
|
91
|
-
return ((
|
|
86
|
+
}, []), y = L(() => {
|
|
87
|
+
const m = b.current;
|
|
88
|
+
m && m.disconnect();
|
|
89
|
+
}, []), H = L(() => {
|
|
90
|
+
var m;
|
|
91
|
+
return ((m = b.current) == null ? void 0 : m.getRoom()) ?? null;
|
|
92
92
|
}, []);
|
|
93
93
|
return {
|
|
94
94
|
connectionState: t,
|
|
95
95
|
agentState: i,
|
|
96
96
|
transcript: o,
|
|
97
|
-
agentConfig:
|
|
98
|
-
videoElement:
|
|
99
|
-
audioElement:
|
|
97
|
+
agentConfig: a,
|
|
98
|
+
videoElement: d,
|
|
99
|
+
audioElement: p,
|
|
100
100
|
canResume: T,
|
|
101
|
-
error:
|
|
102
|
-
connect:
|
|
103
|
-
disconnect:
|
|
104
|
-
getRoom:
|
|
105
|
-
session:
|
|
101
|
+
error: E,
|
|
102
|
+
connect: k,
|
|
103
|
+
disconnect: y,
|
|
104
|
+
getRoom: H,
|
|
105
|
+
session: b.current
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
108
|
function hr() {
|
|
109
|
-
const e = I(null), t = I(/* @__PURE__ */ new Map()), r = I(null), i = I(/* @__PURE__ */ new Set()),
|
|
110
|
-
const
|
|
111
|
-
if (
|
|
109
|
+
const e = I(null), t = I(/* @__PURE__ */ new Map()), r = I(null), i = I(/* @__PURE__ */ new Set()), l = L(() => {
|
|
110
|
+
const _ = t.current;
|
|
111
|
+
if (_.size === 0) {
|
|
112
112
|
r.current = null;
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
let
|
|
116
|
-
for (const { analyser:
|
|
117
|
-
|
|
118
|
-
let
|
|
119
|
-
for (let
|
|
120
|
-
const
|
|
121
|
-
|
|
115
|
+
let E = 0;
|
|
116
|
+
for (const { analyser: g, buffer: b } of _.values()) {
|
|
117
|
+
g.getByteFrequencyData(b);
|
|
118
|
+
let R = 0;
|
|
119
|
+
for (let y = 0; y < b.length; y++) R += b[y];
|
|
120
|
+
const k = R / b.length / 255;
|
|
121
|
+
k > E && (E = k);
|
|
122
122
|
}
|
|
123
|
-
for (const
|
|
123
|
+
for (const g of i.current)
|
|
124
124
|
try {
|
|
125
|
-
|
|
126
|
-
} catch (
|
|
127
|
-
console.error("[useAudioLevel] subscriber threw:",
|
|
125
|
+
g(E);
|
|
126
|
+
} catch (b) {
|
|
127
|
+
console.error("[useAudioLevel] subscriber threw:", b);
|
|
128
128
|
}
|
|
129
|
-
r.current = requestAnimationFrame(
|
|
129
|
+
r.current = requestAnimationFrame(l);
|
|
130
130
|
}, []), o = L(() => e.current ? e.current : typeof window > "u" || typeof AudioContext > "u" ? null : (e.current = new AudioContext(), e.current), []), s = L(() => {
|
|
131
|
-
r.current === null && t.current.size > 0 && (r.current = requestAnimationFrame(
|
|
132
|
-
}, [
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
131
|
+
r.current === null && t.current.size > 0 && (r.current = requestAnimationFrame(l));
|
|
132
|
+
}, [l]), a = L((_) => {
|
|
133
|
+
const E = t.current.get(_);
|
|
134
|
+
if (E) {
|
|
135
135
|
try {
|
|
136
|
-
|
|
136
|
+
E.node.disconnect();
|
|
137
137
|
} catch {
|
|
138
138
|
}
|
|
139
139
|
try {
|
|
140
|
-
|
|
140
|
+
E.analyser.disconnect();
|
|
141
141
|
} catch {
|
|
142
142
|
}
|
|
143
|
-
t.current.delete(
|
|
143
|
+
t.current.delete(_);
|
|
144
144
|
}
|
|
145
145
|
}, []), c = L(
|
|
146
|
-
(
|
|
147
|
-
const
|
|
148
|
-
if (!
|
|
149
|
-
|
|
150
|
-
const
|
|
151
|
-
if (!
|
|
152
|
-
const
|
|
153
|
-
|
|
146
|
+
(_, E) => {
|
|
147
|
+
const g = o();
|
|
148
|
+
if (!g) return;
|
|
149
|
+
a(_);
|
|
150
|
+
const b = E(g);
|
|
151
|
+
if (!b) return;
|
|
152
|
+
const R = g.createAnalyser();
|
|
153
|
+
R.fftSize = 64;
|
|
154
154
|
try {
|
|
155
|
-
|
|
156
|
-
} catch (
|
|
157
|
-
console.warn("[useAudioLevel] connect failed for slot",
|
|
155
|
+
b.connect(R);
|
|
156
|
+
} catch (k) {
|
|
157
|
+
console.warn("[useAudioLevel] connect failed for slot", _, k);
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
|
-
t.current.set(
|
|
161
|
-
analyser:
|
|
162
|
-
node:
|
|
163
|
-
buffer: new Uint8Array(new ArrayBuffer(
|
|
160
|
+
t.current.set(_, {
|
|
161
|
+
analyser: R,
|
|
162
|
+
node: b,
|
|
163
|
+
buffer: new Uint8Array(new ArrayBuffer(R.frequencyBinCount))
|
|
164
164
|
}), s();
|
|
165
165
|
},
|
|
166
|
-
[
|
|
167
|
-
),
|
|
168
|
-
(
|
|
169
|
-
c(
|
|
166
|
+
[a, o, s]
|
|
167
|
+
), d = L(
|
|
168
|
+
(_, E = "agent") => {
|
|
169
|
+
c(E, (g) => {
|
|
170
170
|
try {
|
|
171
|
-
return
|
|
172
|
-
} catch (
|
|
171
|
+
return g.createMediaElementSource(_);
|
|
172
|
+
} catch (b) {
|
|
173
173
|
return console.warn(
|
|
174
174
|
"[useAudioLevel] createMediaElementSource failed for slot",
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
E,
|
|
176
|
+
b
|
|
177
177
|
), null;
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
180
|
},
|
|
181
181
|
[c]
|
|
182
|
-
),
|
|
183
|
-
(
|
|
184
|
-
c(
|
|
182
|
+
), v = L(
|
|
183
|
+
(_, E = "mic") => {
|
|
184
|
+
c(E, (g) => {
|
|
185
185
|
try {
|
|
186
|
-
return
|
|
187
|
-
} catch (
|
|
186
|
+
return g.createMediaStreamSource(_);
|
|
187
|
+
} catch (b) {
|
|
188
188
|
return console.warn(
|
|
189
189
|
"[useAudioLevel] createMediaStreamSource failed for slot",
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
E,
|
|
191
|
+
b
|
|
192
192
|
), null;
|
|
193
193
|
}
|
|
194
194
|
});
|
|
195
195
|
},
|
|
196
196
|
[c]
|
|
197
|
-
),
|
|
198
|
-
(
|
|
199
|
-
|
|
197
|
+
), p = L(
|
|
198
|
+
(_) => {
|
|
199
|
+
a(_), t.current.size === 0 && r.current !== null && (cancelAnimationFrame(r.current), r.current = null);
|
|
200
200
|
},
|
|
201
|
-
[
|
|
201
|
+
[a]
|
|
202
202
|
), h = L(() => {
|
|
203
203
|
r.current !== null && (cancelAnimationFrame(r.current), r.current = null);
|
|
204
|
-
for (const
|
|
205
|
-
|
|
206
|
-
}, [
|
|
207
|
-
i.current.delete(
|
|
204
|
+
for (const _ of Array.from(t.current.keys()))
|
|
205
|
+
a(_);
|
|
206
|
+
}, [a]), T = L((_) => (i.current.add(_), () => {
|
|
207
|
+
i.current.delete(_);
|
|
208
208
|
}), []);
|
|
209
209
|
return P(() => () => {
|
|
210
210
|
if (h(), e.current) {
|
|
@@ -215,144 +215,157 @@ function hr() {
|
|
|
215
215
|
e.current = null;
|
|
216
216
|
}
|
|
217
217
|
i.current.clear();
|
|
218
|
-
}, [h]), { attach:
|
|
218
|
+
}, [h]), { attach: d, attachStream: v, detach: h, detachSlot: p, subscribe: T };
|
|
219
219
|
}
|
|
220
220
|
function mr(e) {
|
|
221
221
|
const t = e == null ? void 0 : e.mediaStreamTrack;
|
|
222
222
|
return t ? new MediaStream([t]) : null;
|
|
223
223
|
}
|
|
224
|
-
function gr() {
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
224
|
+
function gr(e = {}) {
|
|
225
|
+
const t = e.gateUntilAgentReady ?? !1, r = e.agentState ?? null, [i, l] = M(t), [o, s] = M(""), [a, c] = M(null), d = I(null), v = I(null), p = I({
|
|
226
|
+
active: t,
|
|
227
|
+
lastAutoIntent: null
|
|
228
|
+
}), h = L(async (k) => {
|
|
229
|
+
var y, H;
|
|
230
|
+
if (d.current && v.current) {
|
|
228
231
|
try {
|
|
229
|
-
await
|
|
232
|
+
await v.current.localParticipant.unpublishTrack(d.current);
|
|
230
233
|
} catch {
|
|
231
234
|
}
|
|
232
|
-
|
|
235
|
+
d.current.stop(), d.current = null;
|
|
233
236
|
}
|
|
234
|
-
|
|
237
|
+
v.current = k, c(null);
|
|
235
238
|
try {
|
|
236
|
-
const
|
|
239
|
+
const m = await ur({
|
|
237
240
|
echoCancellation: !0,
|
|
238
241
|
noiseSuppression: !0
|
|
239
242
|
});
|
|
240
|
-
await
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
} catch (
|
|
244
|
-
const
|
|
245
|
-
throw
|
|
243
|
+
await k.localParticipant.publishTrack(m), d.current = m, p.current.active ? (await k.localParticipant.setMicrophoneEnabled(!1), p.current.lastAutoIntent = !1, l(!0)) : l(m.isMuted);
|
|
244
|
+
const D = (H = (y = m.mediaStreamTrack) == null ? void 0 : y.getSettings) == null ? void 0 : H.call(y);
|
|
245
|
+
D != null && D.deviceId && s(D.deviceId);
|
|
246
|
+
} catch (m) {
|
|
247
|
+
const D = m instanceof Error && m.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
|
|
248
|
+
throw c(D), m;
|
|
246
249
|
}
|
|
247
|
-
}, []),
|
|
248
|
-
|
|
249
|
-
}, []), _ = L(async (
|
|
250
|
-
const
|
|
251
|
-
if (
|
|
250
|
+
}, []), T = L((k) => {
|
|
251
|
+
v.current = k;
|
|
252
|
+
}, []), _ = L(async (k) => {
|
|
253
|
+
const y = v.current;
|
|
254
|
+
if (y)
|
|
252
255
|
try {
|
|
253
|
-
await
|
|
254
|
-
} catch (
|
|
255
|
-
console.warn("[useMicrophoneState] switchDevice failed:",
|
|
256
|
+
await y.switchActiveDevice("audioinput", k), s(k);
|
|
257
|
+
} catch (H) {
|
|
258
|
+
console.warn("[useMicrophoneState] switchDevice failed:", H);
|
|
256
259
|
}
|
|
257
|
-
}, []),
|
|
258
|
-
const
|
|
259
|
-
if (
|
|
260
|
+
}, []), E = L(async () => {
|
|
261
|
+
const k = v.current, y = !i;
|
|
262
|
+
if (l(y), p.current.active = !1, !!k)
|
|
260
263
|
try {
|
|
261
|
-
await
|
|
262
|
-
} catch (
|
|
263
|
-
console.warn("[useMicrophoneState] setMicrophoneEnabled failed:",
|
|
264
|
+
await k.localParticipant.setMicrophoneEnabled(!y);
|
|
265
|
+
} catch (H) {
|
|
266
|
+
console.warn("[useMicrophoneState] setMicrophoneEnabled failed:", H), l(!y);
|
|
264
267
|
}
|
|
265
|
-
}, [
|
|
266
|
-
|
|
267
|
-
if (
|
|
268
|
+
}, [i]);
|
|
269
|
+
P(() => {
|
|
270
|
+
if (!p.current.active || r !== "listening") return;
|
|
271
|
+
const k = v.current, y = k == null ? void 0 : k.localParticipant;
|
|
272
|
+
if (!y) {
|
|
273
|
+
p.current.active = !1;
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
y.isMicrophoneEnabled === p.current.lastAutoIntent && (y.setMicrophoneEnabled(!0), p.current.lastAutoIntent = !0, l(!1)), p.current.active = !1;
|
|
277
|
+
}, [r]);
|
|
278
|
+
const g = L(() => {
|
|
279
|
+
const k = d.current, y = v.current;
|
|
280
|
+
if (k && y) {
|
|
268
281
|
try {
|
|
269
|
-
|
|
282
|
+
y.localParticipant.unpublishTrack(k);
|
|
270
283
|
} catch {
|
|
271
284
|
}
|
|
272
|
-
|
|
285
|
+
k.stop();
|
|
273
286
|
}
|
|
274
|
-
|
|
275
|
-
}, []),
|
|
287
|
+
d.current = null, v.current = null, p.current = { active: t, lastAutoIntent: null }, l(t), s("");
|
|
288
|
+
}, [t]), b = L(() => c(null), []), R = L(() => mr(d.current), []);
|
|
276
289
|
return {
|
|
277
|
-
isMuted:
|
|
278
|
-
activeDeviceId:
|
|
290
|
+
isMuted: i,
|
|
291
|
+
activeDeviceId: o,
|
|
279
292
|
micError: a,
|
|
280
|
-
toggleMute:
|
|
281
|
-
setupMic:
|
|
282
|
-
attachRoom:
|
|
293
|
+
toggleMute: E,
|
|
294
|
+
setupMic: h,
|
|
295
|
+
attachRoom: T,
|
|
283
296
|
switchDevice: _,
|
|
284
|
-
teardownMic:
|
|
285
|
-
clearError:
|
|
286
|
-
getMicStream:
|
|
297
|
+
teardownMic: g,
|
|
298
|
+
clearError: b,
|
|
299
|
+
getMicStream: R
|
|
287
300
|
};
|
|
288
301
|
}
|
|
289
302
|
const yr = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
290
303
|
function vr() {
|
|
291
|
-
const [e, t] = M(!1), [r, i] = M(null), [
|
|
292
|
-
c.current =
|
|
293
|
-
}, []),
|
|
294
|
-
var
|
|
295
|
-
const
|
|
296
|
-
if (
|
|
297
|
-
const
|
|
304
|
+
const [e, t] = M(!1), [r, i] = M(null), [l, o] = M(null), [s, a] = M(""), c = I(null), d = I(null), v = L((b) => {
|
|
305
|
+
c.current = b;
|
|
306
|
+
}, []), p = L(() => {
|
|
307
|
+
var k;
|
|
308
|
+
const b = c.current, R = d.current;
|
|
309
|
+
if (R && b) {
|
|
310
|
+
const y = b.localParticipant.getTrackPublication(Rn.Source.Camera), m = (y == null ? void 0 : y.track) ?? R;
|
|
298
311
|
try {
|
|
299
|
-
|
|
312
|
+
b.localParticipant.unpublishTrack(m);
|
|
300
313
|
} catch {
|
|
301
314
|
}
|
|
302
315
|
try {
|
|
303
|
-
(
|
|
316
|
+
(k = m.stop) == null || k.call(m);
|
|
304
317
|
} catch {
|
|
305
318
|
}
|
|
306
319
|
}
|
|
307
|
-
|
|
308
|
-
}, []), h = L(async (
|
|
309
|
-
const
|
|
310
|
-
if (
|
|
320
|
+
d.current = null, o(null), t(!1);
|
|
321
|
+
}, []), h = L(async (b) => {
|
|
322
|
+
const R = c.current;
|
|
323
|
+
if (R) {
|
|
311
324
|
i(null);
|
|
312
325
|
try {
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
const
|
|
316
|
-
await
|
|
317
|
-
const
|
|
318
|
-
o(
|
|
326
|
+
const k = { ...yr };
|
|
327
|
+
b && (k.deviceId = b);
|
|
328
|
+
const y = await dr(k);
|
|
329
|
+
await R.localParticipant.publishTrack(y), d.current = y;
|
|
330
|
+
const H = y.attach();
|
|
331
|
+
o(H), t(!0), b && a(b);
|
|
319
332
|
try {
|
|
320
|
-
|
|
333
|
+
R.localParticipant.publishData(
|
|
321
334
|
new TextEncoder().encode(JSON.stringify({ type: "user_camera_on" })),
|
|
322
335
|
{ reliable: !0 }
|
|
323
336
|
);
|
|
324
337
|
} catch {
|
|
325
338
|
}
|
|
326
|
-
} catch (
|
|
327
|
-
const
|
|
328
|
-
i(
|
|
339
|
+
} catch (k) {
|
|
340
|
+
const y = k instanceof Error && k.name === "NotAllowedError" ? "Enable your camera in the browser to share video." : "Camera unavailable. Check permissions and try again.";
|
|
341
|
+
i(y);
|
|
329
342
|
}
|
|
330
343
|
}
|
|
331
344
|
}, []), T = L(async () => {
|
|
332
|
-
e ?
|
|
333
|
-
}, [e, s,
|
|
334
|
-
|
|
335
|
-
}, [
|
|
336
|
-
|
|
337
|
-
}, [
|
|
345
|
+
e ? p() : await h(s || void 0);
|
|
346
|
+
}, [e, s, p, h]), _ = L(async (b) => {
|
|
347
|
+
p(), await h(b);
|
|
348
|
+
}, [p, h]), E = L(() => {
|
|
349
|
+
p(), c.current = null, i(null), a("");
|
|
350
|
+
}, [p]), g = L(() => i(null), []);
|
|
338
351
|
return P(() => () => {
|
|
339
|
-
|
|
352
|
+
d.current && d.current.stop();
|
|
340
353
|
}, []), {
|
|
341
354
|
isEnabled: e,
|
|
342
355
|
error: r,
|
|
343
|
-
previewEl:
|
|
356
|
+
previewEl: l,
|
|
344
357
|
activeDeviceId: s,
|
|
345
358
|
toggle: T,
|
|
346
|
-
switchDevice:
|
|
347
|
-
attachRoom:
|
|
348
|
-
teardown:
|
|
349
|
-
clearError:
|
|
359
|
+
switchDevice: _,
|
|
360
|
+
attachRoom: v,
|
|
361
|
+
teardown: E,
|
|
362
|
+
clearError: g
|
|
350
363
|
};
|
|
351
364
|
}
|
|
352
|
-
function
|
|
353
|
-
const [e, t] = M(!1), [r, i] = M(null), [
|
|
365
|
+
function br() {
|
|
366
|
+
const [e, t] = M(!1), [r, i] = M(null), [l, o] = M(null), s = I(null), a = L((h) => {
|
|
354
367
|
s.current = h;
|
|
355
|
-
}, []), c = L(() => o(null), []),
|
|
368
|
+
}, []), c = L(() => o(null), []), d = L(async () => {
|
|
356
369
|
const h = s.current;
|
|
357
370
|
if (h) {
|
|
358
371
|
if (e) {
|
|
@@ -367,11 +380,11 @@ function wr() {
|
|
|
367
380
|
try {
|
|
368
381
|
await h.localParticipant.setScreenShareEnabled(!0);
|
|
369
382
|
let T = 0;
|
|
370
|
-
const
|
|
371
|
-
const
|
|
372
|
-
if (
|
|
373
|
-
const
|
|
374
|
-
o(
|
|
383
|
+
const _ = () => {
|
|
384
|
+
const E = h.localParticipant.getTrackPublication(Rn.Source.ScreenShare);
|
|
385
|
+
if (E != null && E.track) {
|
|
386
|
+
const g = E.track.attach();
|
|
387
|
+
o(g), t(!0);
|
|
375
388
|
try {
|
|
376
389
|
h.localParticipant.publishData(
|
|
377
390
|
new TextEncoder().encode(JSON.stringify({ type: "user_screen_share_on" })),
|
|
@@ -381,15 +394,15 @@ function wr() {
|
|
|
381
394
|
}
|
|
382
395
|
return;
|
|
383
396
|
}
|
|
384
|
-
T++ < 10 ? setTimeout(
|
|
397
|
+
T++ < 10 ? setTimeout(_, 100) : t(!0);
|
|
385
398
|
};
|
|
386
|
-
|
|
399
|
+
_();
|
|
387
400
|
} catch (T) {
|
|
388
|
-
const
|
|
389
|
-
|
|
401
|
+
const _ = T instanceof Error ? T.name : "";
|
|
402
|
+
_ !== "NotAllowedError" && _ !== "AbortError" && i("Screen share unavailable. Try again."), t(!1);
|
|
390
403
|
}
|
|
391
404
|
}
|
|
392
|
-
}, [e, c]),
|
|
405
|
+
}, [e, c]), v = L(() => {
|
|
393
406
|
const h = s.current;
|
|
394
407
|
if (h && e)
|
|
395
408
|
try {
|
|
@@ -397,11 +410,11 @@ function wr() {
|
|
|
397
410
|
} catch {
|
|
398
411
|
}
|
|
399
412
|
c(), t(!1), i(null), s.current = null;
|
|
400
|
-
}, [e, c]),
|
|
401
|
-
return { isEnabled: e, error: r, previewEl:
|
|
413
|
+
}, [e, c]), p = L(() => i(null), []);
|
|
414
|
+
return { isEnabled: e, error: r, previewEl: l, toggle: d, attachRoom: a, teardown: v, clearError: p };
|
|
402
415
|
}
|
|
403
|
-
function
|
|
404
|
-
const [e, t] = M([]), [r, i] = M([]),
|
|
416
|
+
function wr() {
|
|
417
|
+
const [e, t] = M([]), [r, i] = M([]), l = L(async () => {
|
|
405
418
|
if (!(typeof navigator > "u" || !navigator.mediaDevices))
|
|
406
419
|
try {
|
|
407
420
|
const o = await navigator.mediaDevices.enumerateDevices();
|
|
@@ -410,35 +423,35 @@ function br() {
|
|
|
410
423
|
}
|
|
411
424
|
}, []);
|
|
412
425
|
return P(() => {
|
|
413
|
-
if (
|
|
414
|
-
const o = () => void
|
|
426
|
+
if (l(), typeof navigator > "u" || !navigator.mediaDevices) return;
|
|
427
|
+
const o = () => void l();
|
|
415
428
|
return navigator.mediaDevices.addEventListener("devicechange", o), () => navigator.mediaDevices.removeEventListener("devicechange", o);
|
|
416
|
-
}, [
|
|
429
|
+
}, [l]), { mics: e, cameras: r, refresh: l };
|
|
417
430
|
}
|
|
418
431
|
function _r(e, t, r = !1) {
|
|
419
|
-
const [i,
|
|
432
|
+
const [i, l] = M(null), [o, s] = M(null), [a, c] = M(!r && !!e);
|
|
420
433
|
return P(() => {
|
|
421
434
|
if (r || !e) {
|
|
422
435
|
c(!1);
|
|
423
436
|
return;
|
|
424
437
|
}
|
|
425
|
-
const
|
|
426
|
-
return c(!0), s(null), fetch(`${
|
|
427
|
-
signal:
|
|
428
|
-
}).then(async (
|
|
429
|
-
if (!
|
|
430
|
-
const h = await
|
|
431
|
-
throw new Error(h.error || `HTTP ${
|
|
438
|
+
const d = new AbortController(), v = t || "https://app.livelayer.studio";
|
|
439
|
+
return c(!0), s(null), fetch(`${v}/api/widget/agent/${encodeURIComponent(e)}`, {
|
|
440
|
+
signal: d.signal
|
|
441
|
+
}).then(async (p) => {
|
|
442
|
+
if (!p.ok) {
|
|
443
|
+
const h = await p.json().catch(() => ({}));
|
|
444
|
+
throw new Error(h.error || `HTTP ${p.status}`);
|
|
432
445
|
}
|
|
433
|
-
return
|
|
434
|
-
}).then((
|
|
435
|
-
|
|
436
|
-
}).catch((
|
|
437
|
-
|
|
438
|
-
}), () =>
|
|
439
|
-
}, [e, t, r]), { info: i, error: o, loading:
|
|
446
|
+
return p.json();
|
|
447
|
+
}).then((p) => {
|
|
448
|
+
d.signal.aborted || (l(p), c(!1));
|
|
449
|
+
}).catch((p) => {
|
|
450
|
+
d.signal.aborted || (s(p instanceof Error ? p.message : "Agent lookup failed"), c(!1));
|
|
451
|
+
}), () => d.abort();
|
|
452
|
+
}, [e, t, r]), { info: i, error: o, loading: a };
|
|
440
453
|
}
|
|
441
|
-
function
|
|
454
|
+
function Tn(e) {
|
|
442
455
|
if (typeof window > "u") return null;
|
|
443
456
|
try {
|
|
444
457
|
return window.localStorage.getItem(e);
|
|
@@ -446,7 +459,7 @@ function Rn(e) {
|
|
|
446
459
|
return null;
|
|
447
460
|
}
|
|
448
461
|
}
|
|
449
|
-
function
|
|
462
|
+
function Pn(e, t) {
|
|
450
463
|
if (!(typeof window > "u"))
|
|
451
464
|
try {
|
|
452
465
|
window.localStorage.setItem(e, t);
|
|
@@ -465,13 +478,13 @@ function Lr({
|
|
|
465
478
|
defaultValue: t = "expanded",
|
|
466
479
|
onChange: r
|
|
467
480
|
} = {}) {
|
|
468
|
-
const i = e !== void 0, [
|
|
481
|
+
const i = e !== void 0, [l, o] = M(t), s = i ? e : l, a = L(
|
|
469
482
|
(c) => {
|
|
470
483
|
c !== s && (i || o(c), r == null || r(c));
|
|
471
484
|
},
|
|
472
485
|
[s, i, r]
|
|
473
486
|
);
|
|
474
|
-
return [s,
|
|
487
|
+
return [s, a];
|
|
475
488
|
}
|
|
476
489
|
const Cr = ["hidden", "minimized", "expanded"];
|
|
477
490
|
function kr(e) {
|
|
@@ -482,20 +495,20 @@ function Er({
|
|
|
482
495
|
defaultValue: t = "expanded",
|
|
483
496
|
onChange: r,
|
|
484
497
|
persistKey: i = "ll-widget",
|
|
485
|
-
disablePersistence:
|
|
498
|
+
disablePersistence: l = !1
|
|
486
499
|
} = {}) {
|
|
487
|
-
const o = `${i}:display-mode`, s = I(!1), [
|
|
500
|
+
const o = `${i}:display-mode`, s = I(!1), [a, c] = Lr({
|
|
488
501
|
value: e,
|
|
489
502
|
defaultValue: t,
|
|
490
|
-
onChange: (
|
|
491
|
-
e === void 0 && !
|
|
503
|
+
onChange: (d) => {
|
|
504
|
+
e === void 0 && !l && Pn(o, d), r == null || r(d);
|
|
492
505
|
}
|
|
493
506
|
});
|
|
494
507
|
return P(() => {
|
|
495
|
-
if (s.current || (s.current = !0,
|
|
496
|
-
const
|
|
497
|
-
|
|
498
|
-
}, []), [
|
|
508
|
+
if (s.current || (s.current = !0, l || e !== void 0)) return;
|
|
509
|
+
const d = kr(Tn(o));
|
|
510
|
+
d && d !== a && c(d);
|
|
511
|
+
}, []), [a, c];
|
|
499
512
|
}
|
|
500
513
|
const Sr = 640;
|
|
501
514
|
function Nr(e = Sr) {
|
|
@@ -507,14 +520,14 @@ function Nr(e = Sr) {
|
|
|
507
520
|
}
|
|
508
521
|
if (typeof window > "u" || typeof window.matchMedia > "u")
|
|
509
522
|
return;
|
|
510
|
-
const i = `(max-width: ${e - 1}px)`,
|
|
511
|
-
return o(), typeof
|
|
512
|
-
|
|
523
|
+
const i = `(max-width: ${e - 1}px)`, l = window.matchMedia(i), o = () => r(l.matches);
|
|
524
|
+
return o(), typeof l.addEventListener == "function" ? (l.addEventListener("change", o), () => l.removeEventListener("change", o)) : (l.addListener(o), () => {
|
|
525
|
+
l.removeListener(o);
|
|
513
526
|
});
|
|
514
527
|
}, [e]), t;
|
|
515
528
|
}
|
|
516
529
|
const Ar = 280, Mr = 380, Ir = 8, Rr = 4;
|
|
517
|
-
function
|
|
530
|
+
function zt(e) {
|
|
518
531
|
return `${e}:geometry`;
|
|
519
532
|
}
|
|
520
533
|
function Tr(e) {
|
|
@@ -526,24 +539,24 @@ function Tr(e) {
|
|
|
526
539
|
return null;
|
|
527
540
|
}
|
|
528
541
|
if (typeof t != "object" || t === null) return null;
|
|
529
|
-
const r = t, { top: i, left:
|
|
530
|
-
return typeof i != "number" || typeof
|
|
542
|
+
const r = t, { top: i, left: l, width: o, height: s } = r;
|
|
543
|
+
return typeof i != "number" || typeof l != "number" || typeof o != "number" || typeof s != "number" || !Number.isFinite(i) || !Number.isFinite(l) || !Number.isFinite(o) || !Number.isFinite(s) ? null : { top: i, left: l, width: o, height: s };
|
|
531
544
|
}
|
|
532
|
-
function
|
|
545
|
+
function Lt() {
|
|
533
546
|
return typeof window > "u" ? { vw: 0, vh: 0 } : { vw: window.innerWidth, vh: window.innerHeight };
|
|
534
547
|
}
|
|
535
|
-
function
|
|
536
|
-
const { minWidth: i, minHeight:
|
|
548
|
+
function $t(e, t, r) {
|
|
549
|
+
const { minWidth: i, minHeight: l, edgeMargin: o, vw: s, vh: a } = r, c = Math.max(i, s - o * 2), d = Math.max(l, a - o * 2);
|
|
537
550
|
return {
|
|
538
551
|
width: Math.max(i, Math.min(c, e)),
|
|
539
|
-
height: Math.max(
|
|
552
|
+
height: Math.max(l, Math.min(d, t))
|
|
540
553
|
};
|
|
541
554
|
}
|
|
542
|
-
function
|
|
543
|
-
const { edgeMargin: o, vw: s, vh:
|
|
555
|
+
function Ht(e, t, r, i, l) {
|
|
556
|
+
const { edgeMargin: o, vw: s, vh: a } = l, c = o, d = o, v = Math.max(c, s - r - o), p = Math.max(d, a - i - o);
|
|
544
557
|
return {
|
|
545
|
-
top: Math.max(
|
|
546
|
-
left: Math.max(c, Math.min(
|
|
558
|
+
top: Math.max(d, Math.min(p, e)),
|
|
559
|
+
left: Math.max(c, Math.min(v, t))
|
|
547
560
|
};
|
|
548
561
|
}
|
|
549
562
|
function Pr(e) {
|
|
@@ -551,169 +564,169 @@ function Pr(e) {
|
|
|
551
564
|
draggable: t,
|
|
552
565
|
resizable: r,
|
|
553
566
|
persistKey: i,
|
|
554
|
-
disablePersistence:
|
|
567
|
+
disablePersistence: l,
|
|
555
568
|
minWidth: o = Ar,
|
|
556
569
|
minHeight: s = Mr,
|
|
557
|
-
edgeMargin:
|
|
558
|
-
} = e, [c,
|
|
559
|
-
|
|
560
|
-
const
|
|
561
|
-
(
|
|
562
|
-
|
|
570
|
+
edgeMargin: a = Ir
|
|
571
|
+
} = e, [c, d] = M(null), [v, p] = M(!1), [h, T] = M(!1), _ = I(null), E = I(null), g = I(!1), b = I(null);
|
|
572
|
+
b.current = c;
|
|
573
|
+
const R = L(
|
|
574
|
+
(f) => {
|
|
575
|
+
l || (f === null ? xr(zt(i)) : Pn(zt(i), JSON.stringify(f)));
|
|
563
576
|
},
|
|
564
|
-
[
|
|
577
|
+
[l, i]
|
|
565
578
|
);
|
|
566
579
|
P(() => {
|
|
567
|
-
if (
|
|
568
|
-
const
|
|
569
|
-
if (!
|
|
570
|
-
const { vw:
|
|
580
|
+
if (g.current || (g.current = !0, l)) return;
|
|
581
|
+
const f = Tr(Tn(zt(i)));
|
|
582
|
+
if (!f) return;
|
|
583
|
+
const { vw: S, vh: O } = Lt(), q = $t(f.width, f.height, {
|
|
571
584
|
minWidth: o,
|
|
572
585
|
minHeight: s,
|
|
573
|
-
edgeMargin:
|
|
574
|
-
vw:
|
|
575
|
-
vh:
|
|
576
|
-
}), X =
|
|
577
|
-
edgeMargin:
|
|
578
|
-
vw:
|
|
579
|
-
vh:
|
|
586
|
+
edgeMargin: a,
|
|
587
|
+
vw: S,
|
|
588
|
+
vh: O
|
|
589
|
+
}), X = Ht(f.top, f.left, q.width, q.height, {
|
|
590
|
+
edgeMargin: a,
|
|
591
|
+
vw: S,
|
|
592
|
+
vh: O
|
|
580
593
|
});
|
|
581
|
-
|
|
594
|
+
d({ ...X, ...q });
|
|
582
595
|
}, []), P(() => {
|
|
583
596
|
if (typeof window > "u") return;
|
|
584
|
-
const
|
|
585
|
-
|
|
586
|
-
if (
|
|
587
|
-
const { vw:
|
|
597
|
+
const f = () => {
|
|
598
|
+
d((S) => {
|
|
599
|
+
if (S === null) return null;
|
|
600
|
+
const { vw: O, vh: q } = Lt(), X = $t(S.width, S.height, {
|
|
588
601
|
minWidth: o,
|
|
589
602
|
minHeight: s,
|
|
590
|
-
edgeMargin:
|
|
591
|
-
vw:
|
|
592
|
-
vh:
|
|
603
|
+
edgeMargin: a,
|
|
604
|
+
vw: O,
|
|
605
|
+
vh: q
|
|
593
606
|
});
|
|
594
|
-
return {
|
|
595
|
-
edgeMargin:
|
|
596
|
-
vw:
|
|
597
|
-
vh:
|
|
607
|
+
return { ...Ht(S.top, S.left, X.width, X.height, {
|
|
608
|
+
edgeMargin: a,
|
|
609
|
+
vw: O,
|
|
610
|
+
vh: q
|
|
598
611
|
}), ...X };
|
|
599
612
|
});
|
|
600
613
|
};
|
|
601
|
-
return window.addEventListener("resize",
|
|
602
|
-
}, [o, s,
|
|
603
|
-
const
|
|
604
|
-
(
|
|
605
|
-
if (!t ||
|
|
606
|
-
const
|
|
607
|
-
if (
|
|
614
|
+
return window.addEventListener("resize", f), () => window.removeEventListener("resize", f);
|
|
615
|
+
}, [o, s, a]);
|
|
616
|
+
const k = L(
|
|
617
|
+
(f) => {
|
|
618
|
+
if (!t || f.pointerType === "mouse" && f.button !== 0) return;
|
|
619
|
+
const S = f.target;
|
|
620
|
+
if (S && typeof S.closest == "function" && S.closest('button, a, input, select, textarea, [role="listbox"], [role="option"], [data-ll-no-drag]'))
|
|
608
621
|
return;
|
|
609
|
-
let
|
|
610
|
-
const Y =
|
|
622
|
+
let O, q, X, Q;
|
|
623
|
+
const Y = b.current;
|
|
611
624
|
if (Y)
|
|
612
|
-
({ top:
|
|
625
|
+
({ top: O, left: q, width: X, height: Q } = Y);
|
|
613
626
|
else {
|
|
614
|
-
const te =
|
|
615
|
-
if (!
|
|
616
|
-
|
|
627
|
+
const te = f.currentTarget.closest(".ll-widget"), ie = te == null ? void 0 : te.getBoundingClientRect();
|
|
628
|
+
if (!ie) return;
|
|
629
|
+
O = ie.top, q = ie.left, X = ie.width, Q = ie.height;
|
|
617
630
|
}
|
|
618
631
|
try {
|
|
619
|
-
|
|
632
|
+
f.currentTarget.setPointerCapture(f.pointerId);
|
|
620
633
|
} catch {
|
|
621
634
|
}
|
|
622
|
-
|
|
623
|
-
startClientX:
|
|
624
|
-
startClientY:
|
|
625
|
-
startTop:
|
|
626
|
-
startLeft:
|
|
635
|
+
_.current = {
|
|
636
|
+
startClientX: f.clientX,
|
|
637
|
+
startClientY: f.clientY,
|
|
638
|
+
startTop: O,
|
|
639
|
+
startLeft: q,
|
|
627
640
|
width: X,
|
|
628
641
|
height: Q,
|
|
629
642
|
moved: !1
|
|
630
643
|
};
|
|
631
644
|
},
|
|
632
645
|
[t]
|
|
633
|
-
),
|
|
634
|
-
(
|
|
635
|
-
const
|
|
636
|
-
if (!
|
|
637
|
-
const
|
|
638
|
-
if (!
|
|
639
|
-
const { vw: X, vh: Q } =
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
{ edgeMargin:
|
|
646
|
+
), y = L(
|
|
647
|
+
(f) => {
|
|
648
|
+
const S = _.current;
|
|
649
|
+
if (!S) return;
|
|
650
|
+
const O = f.clientX - S.startClientX, q = f.clientY - S.startClientY;
|
|
651
|
+
if (!S.moved && Math.abs(O) + Math.abs(q) > Rr && (S.moved = !0, p(!0)), !S.moved) return;
|
|
652
|
+
const { vw: X, vh: Q } = Lt(), Y = Ht(
|
|
653
|
+
S.startTop + q,
|
|
654
|
+
S.startLeft + O,
|
|
655
|
+
S.width,
|
|
656
|
+
S.height,
|
|
657
|
+
{ edgeMargin: a, vw: X, vh: Q }
|
|
645
658
|
);
|
|
646
|
-
|
|
659
|
+
d({ ...Y, width: S.width, height: S.height });
|
|
647
660
|
},
|
|
648
|
-
[
|
|
649
|
-
),
|
|
650
|
-
(
|
|
651
|
-
const
|
|
652
|
-
if (
|
|
661
|
+
[a]
|
|
662
|
+
), H = L(
|
|
663
|
+
(f) => {
|
|
664
|
+
const S = _.current;
|
|
665
|
+
if (S) {
|
|
653
666
|
try {
|
|
654
|
-
|
|
667
|
+
f.currentTarget.releasePointerCapture(f.pointerId);
|
|
655
668
|
} catch {
|
|
656
669
|
}
|
|
657
|
-
|
|
670
|
+
_.current = null, S.moved && (p(!1), d((O) => (O && R(O), O)));
|
|
658
671
|
}
|
|
659
672
|
},
|
|
660
|
-
[
|
|
661
|
-
),
|
|
662
|
-
|
|
663
|
-
}, [
|
|
664
|
-
(
|
|
665
|
-
if (!r ||
|
|
666
|
-
|
|
667
|
-
let
|
|
668
|
-
const Q =
|
|
673
|
+
[R]
|
|
674
|
+
), m = L(() => {
|
|
675
|
+
_.current = null, E.current = null, p(!1), T(!1), d(null), R(null);
|
|
676
|
+
}, [R]), D = L(
|
|
677
|
+
(f) => {
|
|
678
|
+
if (!r || f.pointerType === "mouse" && f.button !== 0) return;
|
|
679
|
+
f.stopPropagation();
|
|
680
|
+
let S, O, q, X;
|
|
681
|
+
const Q = b.current;
|
|
669
682
|
if (Q)
|
|
670
|
-
({ top:
|
|
683
|
+
({ top: S, left: O, width: q, height: X } = Q);
|
|
671
684
|
else {
|
|
672
|
-
const Y =
|
|
685
|
+
const Y = f.currentTarget.closest(".ll-widget"), te = Y == null ? void 0 : Y.getBoundingClientRect();
|
|
673
686
|
if (!te) return;
|
|
674
|
-
|
|
687
|
+
S = te.top, O = te.left, q = te.width, X = te.height;
|
|
675
688
|
}
|
|
676
689
|
try {
|
|
677
|
-
|
|
690
|
+
f.currentTarget.setPointerCapture(f.pointerId);
|
|
678
691
|
} catch {
|
|
679
692
|
}
|
|
680
|
-
|
|
681
|
-
startClientX:
|
|
682
|
-
startClientY:
|
|
683
|
-
startWidth:
|
|
693
|
+
E.current = {
|
|
694
|
+
startClientX: f.clientX,
|
|
695
|
+
startClientY: f.clientY,
|
|
696
|
+
startWidth: q,
|
|
684
697
|
startHeight: X,
|
|
685
|
-
top:
|
|
686
|
-
left:
|
|
698
|
+
top: S,
|
|
699
|
+
left: O
|
|
687
700
|
}, T(!0);
|
|
688
701
|
},
|
|
689
702
|
[r]
|
|
690
|
-
),
|
|
691
|
-
(
|
|
692
|
-
const
|
|
693
|
-
if (!
|
|
694
|
-
const
|
|
703
|
+
), F = L(
|
|
704
|
+
(f) => {
|
|
705
|
+
const S = E.current;
|
|
706
|
+
if (!S) return;
|
|
707
|
+
const O = f.clientX - S.startClientX, q = f.clientY - S.startClientY, { vw: X, vh: Q } = Lt(), Y = X - S.left - a, te = Q - S.top - a, ie = $t(S.startWidth + O, S.startHeight + q, {
|
|
695
708
|
minWidth: o,
|
|
696
709
|
minHeight: s,
|
|
697
|
-
edgeMargin:
|
|
710
|
+
edgeMargin: a,
|
|
698
711
|
// Clamp the available viewport to the room from the anchored corner
|
|
699
712
|
// so the widget can't grow past the bottom/right edge.
|
|
700
|
-
vw: Math.min(X,
|
|
701
|
-
vh: Math.min(Q,
|
|
713
|
+
vw: Math.min(X, S.left + Y + a),
|
|
714
|
+
vh: Math.min(Q, S.top + te + a)
|
|
702
715
|
});
|
|
703
|
-
|
|
716
|
+
d({ top: S.top, left: S.left, ...ie });
|
|
704
717
|
},
|
|
705
|
-
[
|
|
718
|
+
[a, o, s]
|
|
706
719
|
), K = L(
|
|
707
|
-
(
|
|
708
|
-
if (
|
|
720
|
+
(f) => {
|
|
721
|
+
if (E.current) {
|
|
709
722
|
try {
|
|
710
|
-
|
|
723
|
+
f.currentTarget.releasePointerCapture(f.pointerId);
|
|
711
724
|
} catch {
|
|
712
725
|
}
|
|
713
|
-
|
|
726
|
+
E.current = null, T(!1), d((O) => (O && R(O), O));
|
|
714
727
|
}
|
|
715
728
|
},
|
|
716
|
-
[
|
|
729
|
+
[R]
|
|
717
730
|
);
|
|
718
731
|
return {
|
|
719
732
|
style: c === null ? {} : {
|
|
@@ -726,37 +739,37 @@ function Pr(e) {
|
|
|
726
739
|
height: `${c.height}px`
|
|
727
740
|
},
|
|
728
741
|
hasGeometry: c !== null,
|
|
729
|
-
isDragging:
|
|
742
|
+
isDragging: v,
|
|
730
743
|
isResizing: h,
|
|
731
744
|
dragHandleProps: {
|
|
732
|
-
onPointerDown:
|
|
733
|
-
onPointerMove:
|
|
734
|
-
onPointerUp:
|
|
735
|
-
onPointerCancel:
|
|
736
|
-
onDoubleClick:
|
|
745
|
+
onPointerDown: k,
|
|
746
|
+
onPointerMove: y,
|
|
747
|
+
onPointerUp: H,
|
|
748
|
+
onPointerCancel: H,
|
|
749
|
+
onDoubleClick: m,
|
|
737
750
|
"data-ll-drag-handle": t ? "" : void 0
|
|
738
751
|
},
|
|
739
752
|
resizeHandleProps: {
|
|
740
|
-
onPointerDown:
|
|
741
|
-
onPointerMove:
|
|
753
|
+
onPointerDown: D,
|
|
754
|
+
onPointerMove: F,
|
|
742
755
|
onPointerUp: K,
|
|
743
756
|
onPointerCancel: K,
|
|
744
757
|
"data-ll-resize-handle": r ? "" : void 0
|
|
745
758
|
},
|
|
746
|
-
reset:
|
|
759
|
+
reset: m
|
|
747
760
|
};
|
|
748
761
|
}
|
|
749
|
-
const
|
|
762
|
+
const un = "__llHistoryPatched", Et = "ll:pathname";
|
|
750
763
|
function Dr() {
|
|
751
|
-
if (typeof window > "u" || window.history[
|
|
764
|
+
if (typeof window > "u" || window.history[un]) return;
|
|
752
765
|
const e = window.history.pushState, t = window.history.replaceState;
|
|
753
766
|
window.history.pushState = function(...r) {
|
|
754
767
|
const i = e.apply(this, r);
|
|
755
|
-
return window.dispatchEvent(new Event(
|
|
768
|
+
return window.dispatchEvent(new Event(Et)), i;
|
|
756
769
|
}, window.history.replaceState = function(...r) {
|
|
757
770
|
const i = t.apply(this, r);
|
|
758
|
-
return window.dispatchEvent(new Event(
|
|
759
|
-
}, window.history[
|
|
771
|
+
return window.dispatchEvent(new Event(Et)), i;
|
|
772
|
+
}, window.history[un] = !0;
|
|
760
773
|
}
|
|
761
774
|
function dn() {
|
|
762
775
|
return typeof window > "u" ? "/" : window.location.pathname || "/";
|
|
@@ -769,20 +782,20 @@ function zr(e) {
|
|
|
769
782
|
if (e !== void 0) return;
|
|
770
783
|
Dr();
|
|
771
784
|
const i = () => r(dn());
|
|
772
|
-
return i(), window.addEventListener("popstate", i), window.addEventListener(
|
|
773
|
-
window.removeEventListener("popstate", i), window.removeEventListener(
|
|
785
|
+
return i(), window.addEventListener("popstate", i), window.addEventListener(Et, i), () => {
|
|
786
|
+
window.removeEventListener("popstate", i), window.removeEventListener(Et, i);
|
|
774
787
|
};
|
|
775
788
|
}, [e]), e ?? t;
|
|
776
789
|
}
|
|
777
|
-
const
|
|
790
|
+
const fn = /* @__PURE__ */ new Map(), $r = /[\\^$+?.()|{}[\]]/g;
|
|
778
791
|
function Hr(e) {
|
|
779
792
|
return e.replace($r, "\\$&");
|
|
780
793
|
}
|
|
781
794
|
function Or(e) {
|
|
782
|
-
const t =
|
|
795
|
+
const t = fn.get(e);
|
|
783
796
|
if (t) return t;
|
|
784
|
-
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "",
|
|
785
|
-
return
|
|
797
|
+
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, i = "", l = "", o = r.replace(/\*\*/g, i).replace(/\*/g, l), a = Hr(o).replace(new RegExp(`\\/${i}`, "g"), "(?:\\/.*)?").replace(new RegExp(i, "g"), ".*").replace(new RegExp(l, "g"), "[^/]+"), c = new RegExp(`^${a}\\/?$`);
|
|
798
|
+
return fn.set(e, c), c;
|
|
786
799
|
}
|
|
787
800
|
function Wr(e, t) {
|
|
788
801
|
const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
|
|
@@ -791,17 +804,17 @@ function Wr(e, t) {
|
|
|
791
804
|
function Fr(e, t) {
|
|
792
805
|
return typeof e == "function" ? e(t) : e instanceof RegExp ? e.test(t) : Wr(e, t);
|
|
793
806
|
}
|
|
794
|
-
function
|
|
807
|
+
function pn(e, t) {
|
|
795
808
|
if (!e || e.length === 0) return !1;
|
|
796
809
|
for (const r of e)
|
|
797
810
|
if (Fr(r, t)) return !0;
|
|
798
811
|
return !1;
|
|
799
812
|
}
|
|
800
813
|
function Br(e, t, r) {
|
|
801
|
-
return e === void 0 ? !0 :
|
|
814
|
+
return e === void 0 ? !0 : pn(r, e) ? !1 : t && t.length > 0 ? pn(t, e) : !0;
|
|
802
815
|
}
|
|
803
816
|
function qr(e, t, r) {
|
|
804
|
-
return
|
|
817
|
+
return nt(
|
|
805
818
|
() => Br(e, t, r),
|
|
806
819
|
[e, t, r]
|
|
807
820
|
);
|
|
@@ -814,7 +827,7 @@ function Ur(e) {
|
|
|
814
827
|
};
|
|
815
828
|
}
|
|
816
829
|
function jr(e) {
|
|
817
|
-
const t =
|
|
830
|
+
const t = nt(() => Ur(e.config), [e.config]), r = e.baseUrl.replace(/\/+$/, ""), i = I(null), l = L(
|
|
818
831
|
(c) => {
|
|
819
832
|
try {
|
|
820
833
|
new Audio(`${r}${c}`).play().catch(() => {
|
|
@@ -824,10 +837,10 @@ function jr(e) {
|
|
|
824
837
|
},
|
|
825
838
|
[r]
|
|
826
839
|
), o = L(() => {
|
|
827
|
-
t.navigate &&
|
|
828
|
-
}, [t.navigate,
|
|
829
|
-
t.action &&
|
|
830
|
-
}, [t.action,
|
|
840
|
+
t.navigate && l("/audio/page-change-sound.mp3");
|
|
841
|
+
}, [t.navigate, l]), s = L(() => {
|
|
842
|
+
t.action && l("/audio/confirmation-sound.mp3");
|
|
843
|
+
}, [t.action, l]), a = L(
|
|
831
844
|
(c) => {
|
|
832
845
|
if (!t.thinking) {
|
|
833
846
|
if (i.current) {
|
|
@@ -842,10 +855,10 @@ function jr(e) {
|
|
|
842
855
|
if (c) {
|
|
843
856
|
if (i.current) return;
|
|
844
857
|
try {
|
|
845
|
-
const
|
|
846
|
-
|
|
858
|
+
const d = new Audio(`${r}/audio/thinking-sound.mp3`);
|
|
859
|
+
d.loop = !0, d.volume = 0.3, d.play().catch(() => {
|
|
847
860
|
i.current = null;
|
|
848
|
-
}), i.current =
|
|
861
|
+
}), i.current = d;
|
|
849
862
|
} catch {
|
|
850
863
|
}
|
|
851
864
|
} else if (i.current) {
|
|
@@ -866,12 +879,12 @@ function jr(e) {
|
|
|
866
879
|
}
|
|
867
880
|
i.current = null;
|
|
868
881
|
}
|
|
869
|
-
}, []),
|
|
870
|
-
() => ({ playPageChange: o, playConfirmation: s, setThinking:
|
|
871
|
-
[o, s,
|
|
882
|
+
}, []), nt(
|
|
883
|
+
() => ({ playPageChange: o, playConfirmation: s, setThinking: a }),
|
|
884
|
+
[o, s, a]
|
|
872
885
|
);
|
|
873
886
|
}
|
|
874
|
-
const
|
|
887
|
+
const hn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ C(
|
|
875
888
|
"svg",
|
|
876
889
|
{
|
|
877
890
|
className: t,
|
|
@@ -917,7 +930,7 @@ const pn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ C(
|
|
|
917
930
|
}
|
|
918
931
|
)
|
|
919
932
|
}
|
|
920
|
-
),
|
|
933
|
+
), mn = ({ className: e }) => /* @__PURE__ */ n(
|
|
921
934
|
"svg",
|
|
922
935
|
{
|
|
923
936
|
className: e,
|
|
@@ -951,7 +964,7 @@ const pn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ C(
|
|
|
951
964
|
right: 0,
|
|
952
965
|
up: -90,
|
|
953
966
|
down: 90
|
|
954
|
-
},
|
|
967
|
+
}, gn = ({ direction: e = "right", className: t }) => /* @__PURE__ */ n(
|
|
955
968
|
"svg",
|
|
956
969
|
{
|
|
957
970
|
className: t,
|
|
@@ -967,11 +980,11 @@ const pn = ({ muted: e = !1, className: t }) => e ? /* @__PURE__ */ C(
|
|
|
967
980
|
function Gr(e) {
|
|
968
981
|
return e === "top-left" || e === "bottom-left" ? "left" : "right";
|
|
969
982
|
}
|
|
970
|
-
const
|
|
983
|
+
const Dn = "ll-hidden-tab-center-y", Xr = 5, yn = 16;
|
|
971
984
|
function Kr() {
|
|
972
985
|
if (typeof window > "u") return null;
|
|
973
986
|
try {
|
|
974
|
-
const e = window.localStorage.getItem(
|
|
987
|
+
const e = window.localStorage.getItem(Dn);
|
|
975
988
|
if (!e) return null;
|
|
976
989
|
const t = Number.parseFloat(e);
|
|
977
990
|
return Number.isFinite(t) ? t : null;
|
|
@@ -979,10 +992,10 @@ function Kr() {
|
|
|
979
992
|
return null;
|
|
980
993
|
}
|
|
981
994
|
}
|
|
982
|
-
function
|
|
995
|
+
function vn(e) {
|
|
983
996
|
if (!(typeof window > "u"))
|
|
984
997
|
try {
|
|
985
|
-
window.localStorage.setItem(
|
|
998
|
+
window.localStorage.setItem(Dn, String(e));
|
|
986
999
|
} catch {
|
|
987
1000
|
}
|
|
988
1001
|
}
|
|
@@ -991,118 +1004,118 @@ const Jr = ({
|
|
|
991
1004
|
isMobile: t,
|
|
992
1005
|
isSpeaking: r,
|
|
993
1006
|
onExpand: i,
|
|
994
|
-
label:
|
|
1007
|
+
label: l = "Open widget",
|
|
995
1008
|
avatarImageUrl: o,
|
|
996
1009
|
agentName: s,
|
|
997
|
-
containerEl:
|
|
1010
|
+
containerEl: a
|
|
998
1011
|
}) => {
|
|
999
|
-
const c = Gr(e),
|
|
1000
|
-
(
|
|
1001
|
-
if (typeof window > "u") return
|
|
1002
|
-
const G =
|
|
1003
|
-
return
|
|
1012
|
+
const c = Gr(e), d = c === "right" ? "left" : "right", v = t ? 80 : 72, p = !!o, h = !!a, [T, _] = M(null), [E, g] = M(!1), b = I(null), R = I(!1), k = L(
|
|
1013
|
+
(z) => {
|
|
1014
|
+
if (typeof window > "u") return z;
|
|
1015
|
+
const G = v / 2, f = yn + G, S = window.innerHeight - yn - G;
|
|
1016
|
+
return S < f ? Math.max(f, z) : Math.max(f, Math.min(S, z));
|
|
1004
1017
|
},
|
|
1005
|
-
[
|
|
1018
|
+
[v]
|
|
1006
1019
|
);
|
|
1007
1020
|
P(() => {
|
|
1008
1021
|
if (h) {
|
|
1009
|
-
|
|
1022
|
+
_(null);
|
|
1010
1023
|
return;
|
|
1011
1024
|
}
|
|
1012
|
-
const
|
|
1013
|
-
|
|
1025
|
+
const z = Kr();
|
|
1026
|
+
_(k(z ?? window.innerHeight / 2));
|
|
1014
1027
|
const G = () => {
|
|
1015
|
-
|
|
1028
|
+
_((f) => f === null ? null : k(f));
|
|
1016
1029
|
};
|
|
1017
1030
|
return window.addEventListener("resize", G), () => window.removeEventListener("resize", G);
|
|
1018
|
-
}, [
|
|
1019
|
-
const
|
|
1020
|
-
(
|
|
1021
|
-
if (!h && !(
|
|
1031
|
+
}, [k, h]);
|
|
1032
|
+
const y = L(
|
|
1033
|
+
(z) => {
|
|
1034
|
+
if (!h && !(z.pointerType === "mouse" && z.button !== 0) && T !== null) {
|
|
1022
1035
|
try {
|
|
1023
|
-
|
|
1036
|
+
z.currentTarget.setPointerCapture(z.pointerId);
|
|
1024
1037
|
} catch {
|
|
1025
1038
|
}
|
|
1026
|
-
|
|
1027
|
-
startClientY:
|
|
1039
|
+
b.current = {
|
|
1040
|
+
startClientY: z.clientY,
|
|
1028
1041
|
startCenterY: T,
|
|
1029
1042
|
moved: !1
|
|
1030
1043
|
};
|
|
1031
1044
|
}
|
|
1032
1045
|
},
|
|
1033
1046
|
[T, h]
|
|
1034
|
-
),
|
|
1035
|
-
(
|
|
1036
|
-
const G =
|
|
1047
|
+
), H = L(
|
|
1048
|
+
(z) => {
|
|
1049
|
+
const G = b.current;
|
|
1037
1050
|
if (!G) return;
|
|
1038
|
-
const
|
|
1039
|
-
!G.moved && Math.abs(
|
|
1051
|
+
const f = z.clientY - G.startClientY;
|
|
1052
|
+
!G.moved && Math.abs(f) > Xr && (G.moved = !0, g(!0)), G.moved && _(k(G.startCenterY + f));
|
|
1040
1053
|
},
|
|
1041
|
-
[
|
|
1042
|
-
),
|
|
1043
|
-
(
|
|
1044
|
-
const G =
|
|
1054
|
+
[k]
|
|
1055
|
+
), m = L(
|
|
1056
|
+
(z) => {
|
|
1057
|
+
const G = b.current;
|
|
1045
1058
|
if (G) {
|
|
1046
1059
|
try {
|
|
1047
|
-
|
|
1060
|
+
z.currentTarget.releasePointerCapture(z.pointerId);
|
|
1048
1061
|
} catch {
|
|
1049
1062
|
}
|
|
1050
|
-
|
|
1063
|
+
b.current = null, G.moved && (g(!1), R.current = !0, _((f) => (f !== null && vn(f), f)));
|
|
1051
1064
|
}
|
|
1052
1065
|
},
|
|
1053
1066
|
[]
|
|
1054
|
-
),
|
|
1055
|
-
if (
|
|
1056
|
-
|
|
1067
|
+
), D = L(() => {
|
|
1068
|
+
if (R.current) {
|
|
1069
|
+
R.current = !1;
|
|
1057
1070
|
return;
|
|
1058
1071
|
}
|
|
1059
1072
|
i();
|
|
1060
|
-
}, [i]),
|
|
1061
|
-
(
|
|
1062
|
-
if (
|
|
1063
|
-
|
|
1064
|
-
const G =
|
|
1065
|
-
|
|
1066
|
-
if (
|
|
1067
|
-
const
|
|
1068
|
-
return
|
|
1073
|
+
}, [i]), F = L(
|
|
1074
|
+
(z) => {
|
|
1075
|
+
if (z.key === "ArrowUp" || z.key === "ArrowDown") {
|
|
1076
|
+
z.preventDefault();
|
|
1077
|
+
const G = z.key === "ArrowUp" ? -8 : 8;
|
|
1078
|
+
_((f) => {
|
|
1079
|
+
if (f === null) return f;
|
|
1080
|
+
const S = k(f + G);
|
|
1081
|
+
return vn(S), S;
|
|
1069
1082
|
});
|
|
1070
1083
|
}
|
|
1071
1084
|
},
|
|
1072
|
-
[
|
|
1085
|
+
[k]
|
|
1073
1086
|
), K = [
|
|
1074
1087
|
"ll-hidden",
|
|
1075
1088
|
`ll-hidden--${c}`,
|
|
1076
1089
|
t ? "ll-hidden--mobile" : "ll-hidden--desktop",
|
|
1077
1090
|
r ? "ll-hidden--speaking" : null,
|
|
1078
|
-
|
|
1079
|
-
|
|
1091
|
+
E ? "is-dragging" : null,
|
|
1092
|
+
p ? "ll-hidden--with-avatar" : null,
|
|
1080
1093
|
h ? "ll-hidden--scoped" : null
|
|
1081
|
-
].filter(Boolean).join(" "),
|
|
1094
|
+
].filter(Boolean).join(" "), oe = T === null ? void 0 : { top: `${T - v / 2}px`, transform: "none" };
|
|
1082
1095
|
return /* @__PURE__ */ n(
|
|
1083
1096
|
"button",
|
|
1084
1097
|
{
|
|
1085
1098
|
type: "button",
|
|
1086
1099
|
className: K,
|
|
1087
|
-
onPointerDown:
|
|
1088
|
-
onPointerMove:
|
|
1089
|
-
onPointerUp:
|
|
1090
|
-
onPointerCancel:
|
|
1091
|
-
onClick:
|
|
1092
|
-
onKeyDown:
|
|
1093
|
-
"aria-label":
|
|
1100
|
+
onPointerDown: y,
|
|
1101
|
+
onPointerMove: H,
|
|
1102
|
+
onPointerUp: m,
|
|
1103
|
+
onPointerCancel: m,
|
|
1104
|
+
onClick: D,
|
|
1105
|
+
onKeyDown: F,
|
|
1106
|
+
"aria-label": l,
|
|
1094
1107
|
"data-position": e,
|
|
1095
|
-
style:
|
|
1096
|
-
children:
|
|
1108
|
+
style: oe,
|
|
1109
|
+
children: p ? (
|
|
1097
1110
|
// Layout: tiny chevron flush against the inward edge (peeks out
|
|
1098
1111
|
// as the click affordance), then the circular avatar photo
|
|
1099
1112
|
// taking the rest of the tab. Reinforces "this is an
|
|
1100
1113
|
// avatar-based experience" even when collapsed.
|
|
1101
|
-
/* @__PURE__ */ C(
|
|
1114
|
+
/* @__PURE__ */ C(We, { children: [
|
|
1102
1115
|
/* @__PURE__ */ n(
|
|
1103
|
-
|
|
1116
|
+
gn,
|
|
1104
1117
|
{
|
|
1105
|
-
direction:
|
|
1118
|
+
direction: d,
|
|
1106
1119
|
className: "ll-hidden__chevron ll-hidden__chevron--mini"
|
|
1107
1120
|
}
|
|
1108
1121
|
),
|
|
@@ -1117,9 +1130,9 @@ const Jr = ({
|
|
|
1117
1130
|
)
|
|
1118
1131
|
] })
|
|
1119
1132
|
) : /* @__PURE__ */ n(
|
|
1120
|
-
|
|
1133
|
+
gn,
|
|
1121
1134
|
{
|
|
1122
|
-
direction:
|
|
1135
|
+
direction: d,
|
|
1123
1136
|
className: "ll-hidden__chevron"
|
|
1124
1137
|
}
|
|
1125
1138
|
)
|
|
@@ -1130,44 +1143,44 @@ const Jr = ({
|
|
|
1130
1143
|
bars: t = 20,
|
|
1131
1144
|
maxHeight: r = 20,
|
|
1132
1145
|
minHeight: i = 4,
|
|
1133
|
-
className:
|
|
1146
|
+
className: l,
|
|
1134
1147
|
barClassName: o
|
|
1135
1148
|
}) => {
|
|
1136
|
-
const s = I(null),
|
|
1137
|
-
const
|
|
1138
|
-
return Array.from({ length: t }, (
|
|
1149
|
+
const s = I(null), a = I([]), c = nt(() => {
|
|
1150
|
+
const v = (Math.sqrt(5) - 1) / 2;
|
|
1151
|
+
return Array.from({ length: t }, (p, h) => 0.5 + h * v % 1 * 0.5);
|
|
1139
1152
|
}, [t]);
|
|
1140
|
-
P(() => e.subscribe((
|
|
1153
|
+
P(() => e.subscribe((p) => {
|
|
1141
1154
|
for (let h = 0; h < t; h++) {
|
|
1142
|
-
const T =
|
|
1155
|
+
const T = a.current[h];
|
|
1143
1156
|
if (!T) continue;
|
|
1144
|
-
const
|
|
1145
|
-
T.style.height = `${
|
|
1157
|
+
const _ = Math.max(i, p * r * c[h]);
|
|
1158
|
+
T.style.height = `${_}px`;
|
|
1146
1159
|
}
|
|
1147
1160
|
}), [e, t, r, i, c]);
|
|
1148
|
-
const
|
|
1149
|
-
return /* @__PURE__ */ n("div", { ref: s, className:
|
|
1161
|
+
const d = ["ll-waveform", l].filter(Boolean).join(" ");
|
|
1162
|
+
return /* @__PURE__ */ n("div", { ref: s, className: d, "aria-hidden": "true", children: Array.from({ length: t }, (v, p) => /* @__PURE__ */ n(
|
|
1150
1163
|
"div",
|
|
1151
1164
|
{
|
|
1152
1165
|
ref: (h) => {
|
|
1153
|
-
|
|
1166
|
+
a.current[p] = h;
|
|
1154
1167
|
},
|
|
1155
1168
|
className: ["ll-waveform__bar", o].filter(Boolean).join(" "),
|
|
1156
1169
|
style: { height: `${i}px` }
|
|
1157
1170
|
},
|
|
1158
|
-
|
|
1171
|
+
p
|
|
1159
1172
|
)) });
|
|
1160
1173
|
}, Qr = ({
|
|
1161
1174
|
position: e,
|
|
1162
1175
|
isMobile: t,
|
|
1163
1176
|
agentName: r,
|
|
1164
1177
|
avatarImageUrl: i,
|
|
1165
|
-
agentState:
|
|
1178
|
+
agentState: l,
|
|
1166
1179
|
isMuted: o,
|
|
1167
1180
|
audioLevel: s,
|
|
1168
|
-
onExpand:
|
|
1181
|
+
onExpand: a,
|
|
1169
1182
|
onToggleMute: c,
|
|
1170
|
-
onClose:
|
|
1183
|
+
onClose: d
|
|
1171
1184
|
}) => t ? /* @__PURE__ */ n(
|
|
1172
1185
|
"div",
|
|
1173
1186
|
{
|
|
@@ -1179,7 +1192,7 @@ const Jr = ({
|
|
|
1179
1192
|
{
|
|
1180
1193
|
type: "button",
|
|
1181
1194
|
className: "ll-minimized__surface",
|
|
1182
|
-
onClick:
|
|
1195
|
+
onClick: a,
|
|
1183
1196
|
"aria-label": `Expand ${r} widget`,
|
|
1184
1197
|
children: [
|
|
1185
1198
|
i ? (
|
|
@@ -1210,17 +1223,17 @@ const Jr = ({
|
|
|
1210
1223
|
className: "ll-minimized__btn",
|
|
1211
1224
|
role: "button",
|
|
1212
1225
|
tabIndex: 0,
|
|
1213
|
-
onClick: (
|
|
1214
|
-
|
|
1226
|
+
onClick: (v) => {
|
|
1227
|
+
v.stopPropagation(), c();
|
|
1215
1228
|
},
|
|
1216
|
-
onKeyDown: (
|
|
1217
|
-
(
|
|
1229
|
+
onKeyDown: (v) => {
|
|
1230
|
+
(v.key === "Enter" || v.key === " ") && (v.stopPropagation(), v.preventDefault(), c());
|
|
1218
1231
|
},
|
|
1219
1232
|
"aria-label": o ? "Unmute microphone" : "Mute microphone",
|
|
1220
|
-
children: /* @__PURE__ */ n(
|
|
1233
|
+
children: /* @__PURE__ */ n(hn, { muted: o, className: "ll-minimized__icon" })
|
|
1221
1234
|
}
|
|
1222
1235
|
),
|
|
1223
|
-
/* @__PURE__ */ n(
|
|
1236
|
+
/* @__PURE__ */ n(mn, { className: "ll-minimized__icon ll-minimized__icon--expand" })
|
|
1224
1237
|
] })
|
|
1225
1238
|
]
|
|
1226
1239
|
}
|
|
@@ -1247,7 +1260,7 @@ const Jr = ({
|
|
|
1247
1260
|
) : /* @__PURE__ */ n("div", { className: "ll-minimized__avatar ll-minimized__avatar--placeholder" }),
|
|
1248
1261
|
/* @__PURE__ */ C("div", { className: "ll-minimized__meta", children: [
|
|
1249
1262
|
/* @__PURE__ */ n("span", { className: "ll-minimized__name", children: r }),
|
|
1250
|
-
/* @__PURE__ */ n("span", { className: "ll-minimized__state", children:
|
|
1263
|
+
/* @__PURE__ */ n("span", { className: "ll-minimized__state", children: l === "speaking" ? "Speaking" : l === "thinking" ? "Thinking" : "Listening" })
|
|
1251
1264
|
] }),
|
|
1252
1265
|
/* @__PURE__ */ C("div", { className: "ll-minimized__controls", children: [
|
|
1253
1266
|
/* @__PURE__ */ n(
|
|
@@ -1257,7 +1270,7 @@ const Jr = ({
|
|
|
1257
1270
|
className: "ll-minimized__btn",
|
|
1258
1271
|
onClick: c,
|
|
1259
1272
|
"aria-label": o ? "Unmute microphone" : "Mute microphone",
|
|
1260
|
-
children: /* @__PURE__ */ n(
|
|
1273
|
+
children: /* @__PURE__ */ n(hn, { muted: o, className: "ll-minimized__icon" })
|
|
1261
1274
|
}
|
|
1262
1275
|
),
|
|
1263
1276
|
/* @__PURE__ */ n(
|
|
@@ -1265,9 +1278,9 @@ const Jr = ({
|
|
|
1265
1278
|
{
|
|
1266
1279
|
type: "button",
|
|
1267
1280
|
className: "ll-minimized__btn",
|
|
1268
|
-
onClick:
|
|
1281
|
+
onClick: a,
|
|
1269
1282
|
"aria-label": `Expand ${r} widget`,
|
|
1270
|
-
children: /* @__PURE__ */ n(
|
|
1283
|
+
children: /* @__PURE__ */ n(mn, { className: "ll-minimized__icon" })
|
|
1271
1284
|
}
|
|
1272
1285
|
),
|
|
1273
1286
|
/* @__PURE__ */ n(
|
|
@@ -1275,7 +1288,7 @@ const Jr = ({
|
|
|
1275
1288
|
{
|
|
1276
1289
|
type: "button",
|
|
1277
1290
|
className: "ll-minimized__btn ll-minimized__btn--close",
|
|
1278
|
-
onClick:
|
|
1291
|
+
onClick: d,
|
|
1279
1292
|
"aria-label": "Close widget",
|
|
1280
1293
|
children: /* @__PURE__ */ n(Vr, { className: "ll-minimized__icon" })
|
|
1281
1294
|
}
|
|
@@ -1288,11 +1301,11 @@ const Jr = ({
|
|
|
1288
1301
|
alt: t,
|
|
1289
1302
|
preCannedPlaying: r = !1,
|
|
1290
1303
|
className: i,
|
|
1291
|
-
style:
|
|
1304
|
+
style: l
|
|
1292
1305
|
}) => {
|
|
1293
|
-
const [o, s] = M(!1),
|
|
1306
|
+
const [o, s] = M(!1), a = I(e);
|
|
1294
1307
|
if (P(() => {
|
|
1295
|
-
|
|
1308
|
+
a.current !== e && (a.current = e, s(!1));
|
|
1296
1309
|
}, [e]), !e) return null;
|
|
1297
1310
|
const c = {
|
|
1298
1311
|
position: "absolute",
|
|
@@ -1304,7 +1317,7 @@ const Jr = ({
|
|
|
1304
1317
|
transition: "opacity 500ms ease, transform 500ms ease",
|
|
1305
1318
|
transform: r ? "scale(1.02)" : "scale(1)",
|
|
1306
1319
|
opacity: o ? 1 : 0,
|
|
1307
|
-
...
|
|
1320
|
+
...l
|
|
1308
1321
|
};
|
|
1309
1322
|
return (
|
|
1310
1323
|
// eslint-disable-next-line @next/next/no-img-element
|
|
@@ -1363,46 +1376,46 @@ function ni({
|
|
|
1363
1376
|
}
|
|
1364
1377
|
);
|
|
1365
1378
|
}
|
|
1366
|
-
const ri = 8,
|
|
1379
|
+
const ri = 8, bn = 8, ii = ({
|
|
1367
1380
|
open: e,
|
|
1368
1381
|
onClose: t,
|
|
1369
1382
|
anchorRef: r,
|
|
1370
1383
|
children: i
|
|
1371
1384
|
}) => {
|
|
1372
|
-
const
|
|
1373
|
-
return
|
|
1385
|
+
const l = I(null), [o, s] = M(null);
|
|
1386
|
+
return In(() => {
|
|
1374
1387
|
if (!e) {
|
|
1375
1388
|
s(null);
|
|
1376
1389
|
return;
|
|
1377
1390
|
}
|
|
1378
|
-
const
|
|
1379
|
-
if (!
|
|
1391
|
+
const a = r.current;
|
|
1392
|
+
if (!a) return;
|
|
1380
1393
|
const c = () => {
|
|
1381
|
-
const
|
|
1382
|
-
top:
|
|
1383
|
-
left:
|
|
1384
|
-
},
|
|
1385
|
-
|
|
1394
|
+
const d = a.getBoundingClientRect(), v = {
|
|
1395
|
+
top: d.top - ri,
|
|
1396
|
+
left: d.left + d.width / 2
|
|
1397
|
+
}, p = bn + 90, h = window.innerWidth - bn - 90;
|
|
1398
|
+
v.left < p && (v.left = p), v.left > h && (v.left = h), s(v);
|
|
1386
1399
|
};
|
|
1387
1400
|
return c(), window.addEventListener("scroll", c, !0), window.addEventListener("resize", c), () => {
|
|
1388
1401
|
window.removeEventListener("scroll", c, !0), window.removeEventListener("resize", c);
|
|
1389
1402
|
};
|
|
1390
1403
|
}, [e, r]), P(() => {
|
|
1391
1404
|
if (!e) return;
|
|
1392
|
-
const
|
|
1393
|
-
const
|
|
1394
|
-
|
|
1395
|
-
}, c = (
|
|
1396
|
-
|
|
1405
|
+
const a = (d) => {
|
|
1406
|
+
const v = d.target, p = l.current, h = r.current;
|
|
1407
|
+
p && p.contains(v) || h && h.contains(v) || t();
|
|
1408
|
+
}, c = (d) => {
|
|
1409
|
+
d.key === "Escape" && (d.stopPropagation(), t());
|
|
1397
1410
|
};
|
|
1398
|
-
return document.addEventListener("mousedown",
|
|
1399
|
-
document.removeEventListener("mousedown",
|
|
1411
|
+
return document.addEventListener("mousedown", a), document.addEventListener("keydown", c), () => {
|
|
1412
|
+
document.removeEventListener("mousedown", a), document.removeEventListener("keydown", c);
|
|
1400
1413
|
};
|
|
1401
|
-
}, [e, t, r]), !e || o === null || typeof document > "u" ? null :
|
|
1414
|
+
}, [e, t, r]), !e || o === null || typeof document > "u" ? null : qt(
|
|
1402
1415
|
/* @__PURE__ */ n(
|
|
1403
1416
|
"div",
|
|
1404
1417
|
{
|
|
1405
|
-
ref:
|
|
1418
|
+
ref: l,
|
|
1406
1419
|
className: "ll-overflow-popover",
|
|
1407
1420
|
role: "menu",
|
|
1408
1421
|
style: {
|
|
@@ -1423,25 +1436,25 @@ const ri = 8, vn = 8, ii = ({
|
|
|
1423
1436
|
onToggleMute: t,
|
|
1424
1437
|
isCameraEnabled: r,
|
|
1425
1438
|
onToggleCamera: i,
|
|
1426
|
-
allowCamera:
|
|
1439
|
+
allowCamera: l,
|
|
1427
1440
|
isScreenShareEnabled: o,
|
|
1428
1441
|
onToggleScreenShare: s,
|
|
1429
|
-
allowScreenShare:
|
|
1442
|
+
allowScreenShare: a,
|
|
1430
1443
|
isSpeakerMuted: c,
|
|
1431
|
-
onToggleSpeaker:
|
|
1432
|
-
allowTyping:
|
|
1433
|
-
isTypingOpen:
|
|
1444
|
+
onToggleSpeaker: d,
|
|
1445
|
+
allowTyping: v,
|
|
1446
|
+
isTypingOpen: p,
|
|
1434
1447
|
onToggleTyping: h,
|
|
1435
1448
|
onDisconnect: T
|
|
1436
1449
|
}) => {
|
|
1437
|
-
const [
|
|
1438
|
-
return /* @__PURE__ */ C(
|
|
1450
|
+
const [_, E] = M(!1), g = I(null);
|
|
1451
|
+
return /* @__PURE__ */ C(We, { children: [
|
|
1439
1452
|
/* @__PURE__ */ C(
|
|
1440
1453
|
"div",
|
|
1441
1454
|
{
|
|
1442
1455
|
className: "ll-toolbar ll-toolbar--compact",
|
|
1443
1456
|
"data-testid": "compact-toolbar",
|
|
1444
|
-
onClick: (
|
|
1457
|
+
onClick: (b) => b.stopPropagation(),
|
|
1445
1458
|
children: [
|
|
1446
1459
|
/* @__PURE__ */ n(
|
|
1447
1460
|
"button",
|
|
@@ -1450,19 +1463,19 @@ const ri = 8, vn = 8, ii = ({
|
|
|
1450
1463
|
className: `ll-tool ${e ? "is-muted" : ""}`,
|
|
1451
1464
|
onClick: t,
|
|
1452
1465
|
"aria-label": e ? "Unmute microphone" : "Mute microphone",
|
|
1453
|
-
children: /* @__PURE__ */ n(
|
|
1466
|
+
children: /* @__PURE__ */ n(Hn, { muted: e })
|
|
1454
1467
|
}
|
|
1455
1468
|
),
|
|
1456
1469
|
/* @__PURE__ */ n(
|
|
1457
1470
|
"button",
|
|
1458
1471
|
{
|
|
1459
|
-
ref:
|
|
1472
|
+
ref: g,
|
|
1460
1473
|
type: "button",
|
|
1461
|
-
className: `ll-tool ${
|
|
1462
|
-
onClick: () =>
|
|
1474
|
+
className: `ll-tool ${_ ? "is-on" : ""}`,
|
|
1475
|
+
onClick: () => E((b) => !b),
|
|
1463
1476
|
"aria-label": "More controls",
|
|
1464
1477
|
"aria-haspopup": "menu",
|
|
1465
|
-
"aria-expanded":
|
|
1478
|
+
"aria-expanded": _,
|
|
1466
1479
|
children: /* @__PURE__ */ n(li, {})
|
|
1467
1480
|
}
|
|
1468
1481
|
),
|
|
@@ -1473,7 +1486,7 @@ const ri = 8, vn = 8, ii = ({
|
|
|
1473
1486
|
className: "ll-tool ll-tool--danger",
|
|
1474
1487
|
onClick: T,
|
|
1475
1488
|
"aria-label": "End conversation",
|
|
1476
|
-
children: /* @__PURE__ */ n(
|
|
1489
|
+
children: /* @__PURE__ */ n(Wn, {})
|
|
1477
1490
|
}
|
|
1478
1491
|
)
|
|
1479
1492
|
]
|
|
@@ -1482,34 +1495,34 @@ const ri = 8, vn = 8, ii = ({
|
|
|
1482
1495
|
/* @__PURE__ */ C(
|
|
1483
1496
|
ii,
|
|
1484
1497
|
{
|
|
1485
|
-
open:
|
|
1486
|
-
onClose: () =>
|
|
1487
|
-
anchorRef:
|
|
1498
|
+
open: _,
|
|
1499
|
+
onClose: () => E(!1),
|
|
1500
|
+
anchorRef: g,
|
|
1488
1501
|
children: [
|
|
1489
|
-
|
|
1502
|
+
l && /* @__PURE__ */ C(
|
|
1490
1503
|
"button",
|
|
1491
1504
|
{
|
|
1492
1505
|
type: "button",
|
|
1493
1506
|
className: `ll-overflow-popover__item ${r ? "is-on" : ""}`,
|
|
1494
1507
|
onClick: () => {
|
|
1495
|
-
i(),
|
|
1508
|
+
i(), E(!1);
|
|
1496
1509
|
},
|
|
1497
1510
|
children: [
|
|
1498
|
-
/* @__PURE__ */ n(
|
|
1511
|
+
/* @__PURE__ */ n($n, {}),
|
|
1499
1512
|
/* @__PURE__ */ n("span", { children: r ? "Stop camera" : "Start camera" })
|
|
1500
1513
|
]
|
|
1501
1514
|
}
|
|
1502
1515
|
),
|
|
1503
|
-
|
|
1516
|
+
a && /* @__PURE__ */ C(
|
|
1504
1517
|
"button",
|
|
1505
1518
|
{
|
|
1506
1519
|
type: "button",
|
|
1507
1520
|
className: `ll-overflow-popover__item ${o ? "is-on" : ""}`,
|
|
1508
1521
|
onClick: () => {
|
|
1509
|
-
s(),
|
|
1522
|
+
s(), E(!1);
|
|
1510
1523
|
},
|
|
1511
1524
|
children: [
|
|
1512
|
-
/* @__PURE__ */ n(
|
|
1525
|
+
/* @__PURE__ */ n(zn, {}),
|
|
1513
1526
|
/* @__PURE__ */ n("span", { children: o ? "Stop sharing" : "Share screen" })
|
|
1514
1527
|
]
|
|
1515
1528
|
}
|
|
@@ -1520,25 +1533,25 @@ const ri = 8, vn = 8, ii = ({
|
|
|
1520
1533
|
type: "button",
|
|
1521
1534
|
className: `ll-overflow-popover__item ${c ? "is-on" : ""}`,
|
|
1522
1535
|
onClick: () => {
|
|
1523
|
-
|
|
1536
|
+
d(), E(!1);
|
|
1524
1537
|
},
|
|
1525
1538
|
children: [
|
|
1526
|
-
/* @__PURE__ */ n(
|
|
1539
|
+
/* @__PURE__ */ n(On, { muted: c }),
|
|
1527
1540
|
/* @__PURE__ */ n("span", { children: c ? "Unmute speaker" : "Mute speaker" })
|
|
1528
1541
|
]
|
|
1529
1542
|
}
|
|
1530
1543
|
),
|
|
1531
|
-
|
|
1544
|
+
v && /* @__PURE__ */ C(
|
|
1532
1545
|
"button",
|
|
1533
1546
|
{
|
|
1534
1547
|
type: "button",
|
|
1535
|
-
className: `ll-overflow-popover__item ${
|
|
1548
|
+
className: `ll-overflow-popover__item ${p ? "is-on" : ""}`,
|
|
1536
1549
|
onClick: () => {
|
|
1537
|
-
h(),
|
|
1550
|
+
h(), E(!1);
|
|
1538
1551
|
},
|
|
1539
1552
|
children: [
|
|
1540
1553
|
/* @__PURE__ */ n(ai, {}),
|
|
1541
|
-
/* @__PURE__ */ n("span", { children:
|
|
1554
|
+
/* @__PURE__ */ n("span", { children: p ? "Hide typing" : "Type a message" })
|
|
1542
1555
|
]
|
|
1543
1556
|
}
|
|
1544
1557
|
),
|
|
@@ -1599,135 +1612,135 @@ const si = ({
|
|
|
1599
1612
|
isMobile: t,
|
|
1600
1613
|
agentName: r,
|
|
1601
1614
|
avatarImageUrl: i,
|
|
1602
|
-
idleLoopUrl:
|
|
1615
|
+
idleLoopUrl: l,
|
|
1603
1616
|
greeting: o,
|
|
1604
1617
|
branding: s,
|
|
1605
|
-
teamMembers:
|
|
1618
|
+
teamMembers: a,
|
|
1606
1619
|
currentTeamMemberId: c,
|
|
1607
|
-
isSwitchingTeamMember:
|
|
1608
|
-
teamSwitcherOpen:
|
|
1609
|
-
onToggleTeamSwitcher:
|
|
1620
|
+
isSwitchingTeamMember: d,
|
|
1621
|
+
teamSwitcherOpen: v,
|
|
1622
|
+
onToggleTeamSwitcher: p,
|
|
1610
1623
|
onSelectTeamMember: h,
|
|
1611
1624
|
languageMenuOpen: T,
|
|
1612
|
-
onToggleLanguageMenu:
|
|
1613
|
-
connectionState:
|
|
1614
|
-
agentState:
|
|
1615
|
-
transcript:
|
|
1616
|
-
canResume:
|
|
1617
|
-
needsUserGesture:
|
|
1618
|
-
error:
|
|
1619
|
-
isMuted:
|
|
1620
|
-
micError:
|
|
1621
|
-
micDevices:
|
|
1622
|
-
activeMicId:
|
|
1625
|
+
onToggleLanguageMenu: _,
|
|
1626
|
+
connectionState: E,
|
|
1627
|
+
agentState: g,
|
|
1628
|
+
transcript: b,
|
|
1629
|
+
canResume: R,
|
|
1630
|
+
needsUserGesture: k,
|
|
1631
|
+
error: y,
|
|
1632
|
+
isMuted: H,
|
|
1633
|
+
micError: m,
|
|
1634
|
+
micDevices: D,
|
|
1635
|
+
activeMicId: F,
|
|
1623
1636
|
isCameraEnabled: K,
|
|
1624
|
-
cameraPreviewEl:
|
|
1625
|
-
cameraDevices:
|
|
1637
|
+
cameraPreviewEl: oe,
|
|
1638
|
+
cameraDevices: z,
|
|
1626
1639
|
activeCameraId: G,
|
|
1627
|
-
isScreenShareEnabled:
|
|
1628
|
-
screenPreviewEl:
|
|
1629
|
-
isSpeakerMuted:
|
|
1630
|
-
allowCamera:
|
|
1640
|
+
isScreenShareEnabled: f,
|
|
1641
|
+
screenPreviewEl: S,
|
|
1642
|
+
isSpeakerMuted: O,
|
|
1643
|
+
allowCamera: q,
|
|
1631
1644
|
allowScreenShare: X,
|
|
1632
1645
|
allowTyping: Q,
|
|
1633
1646
|
showMinimize: Y = !0,
|
|
1634
1647
|
showClose: te = !0,
|
|
1635
|
-
chromeless:
|
|
1636
|
-
compactControls:
|
|
1637
|
-
transforming:
|
|
1648
|
+
chromeless: ie = !1,
|
|
1649
|
+
compactControls: U = !1,
|
|
1650
|
+
transforming: ge,
|
|
1638
1651
|
transformingLabel: ee,
|
|
1639
|
-
avatarVideoContainerRef:
|
|
1652
|
+
avatarVideoContainerRef: ve,
|
|
1640
1653
|
agentVideoEl: ne,
|
|
1641
|
-
onConnect:
|
|
1642
|
-
onDisconnect:
|
|
1643
|
-
onRetry:
|
|
1644
|
-
onResumeAudio:
|
|
1645
|
-
onToggleMute:
|
|
1646
|
-
onSwitchMicDevice:
|
|
1654
|
+
onConnect: rt,
|
|
1655
|
+
onDisconnect: it,
|
|
1656
|
+
onRetry: mt,
|
|
1657
|
+
onResumeAudio: gt,
|
|
1658
|
+
onToggleMute: ot,
|
|
1659
|
+
onSwitchMicDevice: lt,
|
|
1647
1660
|
onToggleCamera: Me,
|
|
1648
|
-
onSwitchCameraDevice:
|
|
1661
|
+
onSwitchCameraDevice: Fe,
|
|
1649
1662
|
onToggleScreenShare: Ie,
|
|
1650
1663
|
onToggleSpeaker: Re,
|
|
1651
1664
|
onSendMessage: Te,
|
|
1652
1665
|
onMinimize: Pe,
|
|
1653
1666
|
onClose: De,
|
|
1654
|
-
onClearMicError:
|
|
1655
|
-
dragHandleProps:
|
|
1656
|
-
resizeHandleProps:
|
|
1667
|
+
onClearMicError: Be,
|
|
1668
|
+
dragHandleProps: W,
|
|
1669
|
+
resizeHandleProps: qe
|
|
1657
1670
|
}) => {
|
|
1658
|
-
var
|
|
1659
|
-
const ze = ((
|
|
1671
|
+
var Ke;
|
|
1672
|
+
const ze = ((a == null ? void 0 : a.length) ?? 0) > 1, Ue = E === "connecting" || E === "connected", be = E === "connected", at = E === "idle" || E === "disconnected" || E === "error", [$e, je] = M(!1);
|
|
1660
1673
|
P(() => {
|
|
1661
1674
|
if (!ne) {
|
|
1662
|
-
|
|
1675
|
+
je(!1);
|
|
1663
1676
|
return;
|
|
1664
1677
|
}
|
|
1665
1678
|
if (!ne.paused && ne.readyState >= 2) {
|
|
1666
|
-
|
|
1679
|
+
je(!0);
|
|
1667
1680
|
return;
|
|
1668
1681
|
}
|
|
1669
|
-
|
|
1670
|
-
const
|
|
1671
|
-
return ne.addEventListener("playing",
|
|
1672
|
-
ne.removeEventListener("playing",
|
|
1682
|
+
je(!1);
|
|
1683
|
+
const w = () => je(!0);
|
|
1684
|
+
return ne.addEventListener("playing", w), ne.addEventListener("loadeddata", w), () => {
|
|
1685
|
+
ne.removeEventListener("playing", w), ne.removeEventListener("loadeddata", w);
|
|
1673
1686
|
};
|
|
1674
1687
|
}, [ne]);
|
|
1675
|
-
const [
|
|
1688
|
+
const [St, Ne] = M(!1);
|
|
1676
1689
|
P(() => {
|
|
1677
1690
|
if (!be) {
|
|
1678
|
-
|
|
1691
|
+
Ne(!1);
|
|
1679
1692
|
return;
|
|
1680
1693
|
}
|
|
1681
1694
|
if ($e) return;
|
|
1682
|
-
const
|
|
1683
|
-
return () => clearTimeout(
|
|
1695
|
+
const w = setTimeout(() => Ne(!0), 8e3);
|
|
1696
|
+
return () => clearTimeout(w);
|
|
1684
1697
|
}, [be, $e]);
|
|
1685
|
-
const
|
|
1698
|
+
const fe = E === "connecting" || be && !!i && !$e && !St, st = I(null), ce = I(null);
|
|
1686
1699
|
P(() => {
|
|
1687
|
-
const
|
|
1688
|
-
|
|
1689
|
-
}, [
|
|
1690
|
-
const
|
|
1691
|
-
|
|
1692
|
-
}, [
|
|
1693
|
-
const [
|
|
1700
|
+
const w = st.current;
|
|
1701
|
+
w && (w.innerHTML = "", oe && (oe.style.width = "100%", oe.style.height = "100%", oe.style.objectFit = "cover", oe.style.transform = "scaleX(-1)", w.appendChild(oe)));
|
|
1702
|
+
}, [oe]), P(() => {
|
|
1703
|
+
const w = ce.current;
|
|
1704
|
+
w && (w.innerHTML = "", S && (S.style.width = "100%", S.style.height = "100%", S.style.objectFit = "contain", w.appendChild(S)));
|
|
1705
|
+
}, [S]);
|
|
1706
|
+
const [pe, Ve] = M(!1), [Ye, he] = M(!1), we = I(null), yt = I(null);
|
|
1694
1707
|
P(() => {
|
|
1695
|
-
if (!
|
|
1696
|
-
const
|
|
1697
|
-
|
|
1708
|
+
if (!pe && !Ye && !T && !v) return;
|
|
1709
|
+
const w = () => {
|
|
1710
|
+
Ve(!1), he(!1), T && _(), v && p();
|
|
1698
1711
|
};
|
|
1699
|
-
return document.addEventListener("click",
|
|
1712
|
+
return document.addEventListener("click", w), () => document.removeEventListener("click", w);
|
|
1700
1713
|
}, [
|
|
1701
|
-
|
|
1702
|
-
|
|
1714
|
+
pe,
|
|
1715
|
+
Ye,
|
|
1703
1716
|
T,
|
|
1717
|
+
v,
|
|
1704
1718
|
_,
|
|
1705
|
-
|
|
1706
|
-
g
|
|
1719
|
+
p
|
|
1707
1720
|
]);
|
|
1708
|
-
const [
|
|
1709
|
-
(
|
|
1710
|
-
|
|
1711
|
-
const
|
|
1712
|
-
|
|
1721
|
+
const [vt, Nt] = M(!1), jt = L(() => Nt((w) => !w), []), [ct, Ee] = M(""), He = L(
|
|
1722
|
+
(w) => {
|
|
1723
|
+
w.preventDefault();
|
|
1724
|
+
const le = ct.trim();
|
|
1725
|
+
le && (Te(le), Ee(""));
|
|
1713
1726
|
},
|
|
1714
|
-
[
|
|
1715
|
-
),
|
|
1716
|
-
let
|
|
1717
|
-
for (let
|
|
1718
|
-
const
|
|
1719
|
-
if (!
|
|
1727
|
+
[ct, Te]
|
|
1728
|
+
), _e = s.productName || "Live Layer", Oe = !s.productName;
|
|
1729
|
+
let xe = null, Ae = null;
|
|
1730
|
+
for (let w = b.length - 1; w >= 0; w--) {
|
|
1731
|
+
const le = b[w];
|
|
1732
|
+
if (!xe && le.role === "agent" ? xe = le : !Ae && le.role === "user" && (Ae = le), xe && Ae) break;
|
|
1720
1733
|
}
|
|
1721
|
-
const
|
|
1734
|
+
const Ge = be ? (xe == null ? void 0 : xe.text) || null : o || null, Xe = be && (Ae == null ? void 0 : Ae.text) || null, bt = [
|
|
1722
1735
|
"ll-expanded",
|
|
1723
1736
|
t ? "ll-expanded--mobile" : "ll-expanded--desktop"
|
|
1724
1737
|
].join(" ");
|
|
1725
1738
|
return /* @__PURE__ */ C(
|
|
1726
1739
|
"div",
|
|
1727
1740
|
{
|
|
1728
|
-
className:
|
|
1741
|
+
className: bt,
|
|
1729
1742
|
"data-position": e,
|
|
1730
|
-
"data-state": be ? "connected" :
|
|
1743
|
+
"data-state": be ? "connected" : Ue ? "connecting" : "idle",
|
|
1731
1744
|
role: "dialog",
|
|
1732
1745
|
"aria-label": `${r} widget`,
|
|
1733
1746
|
children: [
|
|
@@ -1739,12 +1752,12 @@ const si = ({
|
|
|
1739
1752
|
alt: r,
|
|
1740
1753
|
className: "ll-expanded__bg-img"
|
|
1741
1754
|
}
|
|
1742
|
-
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((
|
|
1743
|
-
|
|
1755
|
+
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Ke = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Ke.toUpperCase()) || "A" }) }),
|
|
1756
|
+
l && !be && /* @__PURE__ */ n(
|
|
1744
1757
|
"video",
|
|
1745
1758
|
{
|
|
1746
1759
|
className: "ll-expanded__bg-idle",
|
|
1747
|
-
src:
|
|
1760
|
+
src: l,
|
|
1748
1761
|
autoPlay: !0,
|
|
1749
1762
|
loop: !0,
|
|
1750
1763
|
muted: !0,
|
|
@@ -1752,24 +1765,24 @@ const si = ({
|
|
|
1752
1765
|
}
|
|
1753
1766
|
)
|
|
1754
1767
|
] }),
|
|
1755
|
-
/* @__PURE__ */ n("div", { ref:
|
|
1756
|
-
|
|
1768
|
+
/* @__PURE__ */ n("div", { ref: ve, className: "ll-expanded__video" }),
|
|
1769
|
+
fe && /* @__PURE__ */ C("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
|
|
1757
1770
|
/* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
|
|
1758
|
-
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children:
|
|
1771
|
+
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: d ? "Switching..." : "Connecting..." })
|
|
1759
1772
|
] }),
|
|
1760
|
-
|
|
1773
|
+
k && be && /* @__PURE__ */ C(
|
|
1761
1774
|
"button",
|
|
1762
1775
|
{
|
|
1763
1776
|
type: "button",
|
|
1764
1777
|
className: "ll-expanded__overlay ll-expanded__overlay--gesture",
|
|
1765
|
-
onClick:
|
|
1778
|
+
onClick: gt,
|
|
1766
1779
|
children: [
|
|
1767
1780
|
/* @__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" }) }),
|
|
1768
1781
|
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
|
|
1769
1782
|
]
|
|
1770
1783
|
}
|
|
1771
1784
|
),
|
|
1772
|
-
|
|
1785
|
+
ge && /* @__PURE__ */ C(
|
|
1773
1786
|
"div",
|
|
1774
1787
|
{
|
|
1775
1788
|
className: "ll-expanded__overlay ll-expanded__overlay--transforming",
|
|
@@ -1782,54 +1795,54 @@ const si = ({
|
|
|
1782
1795
|
]
|
|
1783
1796
|
}
|
|
1784
1797
|
),
|
|
1785
|
-
|
|
1786
|
-
!
|
|
1787
|
-
!
|
|
1798
|
+
Ue ? /* @__PURE__ */ C(We, { children: [
|
|
1799
|
+
!U && /* @__PURE__ */ C("div", { className: "ll-expanded__topbar", ...W, children: [
|
|
1800
|
+
!ie && /* @__PURE__ */ C("div", { className: "ll-expanded__topbar-left", children: [
|
|
1788
1801
|
/* @__PURE__ */ C("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1789
1802
|
/* @__PURE__ */ C(
|
|
1790
1803
|
"button",
|
|
1791
1804
|
{
|
|
1792
1805
|
type: "button",
|
|
1793
1806
|
className: "ll-hpill",
|
|
1794
|
-
onClick: (
|
|
1795
|
-
ze && (
|
|
1807
|
+
onClick: (w) => {
|
|
1808
|
+
ze && (w.stopPropagation(), p());
|
|
1796
1809
|
},
|
|
1797
1810
|
"aria-haspopup": ze ? "listbox" : void 0,
|
|
1798
|
-
"aria-expanded": ze ?
|
|
1811
|
+
"aria-expanded": ze ? v : void 0,
|
|
1799
1812
|
children: [
|
|
1800
1813
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
|
|
1801
|
-
ze && /* @__PURE__ */ n(
|
|
1814
|
+
ze && /* @__PURE__ */ n(Ct, {})
|
|
1802
1815
|
]
|
|
1803
1816
|
}
|
|
1804
1817
|
),
|
|
1805
|
-
ze &&
|
|
1818
|
+
ze && v && /* @__PURE__ */ n(
|
|
1806
1819
|
"div",
|
|
1807
1820
|
{
|
|
1808
1821
|
className: "ll-hmenu",
|
|
1809
|
-
onClick: (
|
|
1822
|
+
onClick: (w) => w.stopPropagation(),
|
|
1810
1823
|
role: "listbox",
|
|
1811
|
-
children:
|
|
1824
|
+
children: a == null ? void 0 : a.map((w) => /* @__PURE__ */ C(
|
|
1812
1825
|
"button",
|
|
1813
1826
|
{
|
|
1814
1827
|
type: "button",
|
|
1815
|
-
className: `ll-hmenu__item ${
|
|
1816
|
-
onClick: () => h(
|
|
1828
|
+
className: `ll-hmenu__item ${w.id === c ? "is-active" : ""}`,
|
|
1829
|
+
onClick: () => h(w.id),
|
|
1817
1830
|
role: "option",
|
|
1818
|
-
"aria-selected":
|
|
1831
|
+
"aria-selected": w.id === c,
|
|
1819
1832
|
children: [
|
|
1820
|
-
|
|
1833
|
+
w.avatarImageUrl && /* @__PURE__ */ n(
|
|
1821
1834
|
"img",
|
|
1822
1835
|
{
|
|
1823
|
-
src:
|
|
1836
|
+
src: w.avatarImageUrl,
|
|
1824
1837
|
alt: "",
|
|
1825
1838
|
className: "ll-hmenu__avatar"
|
|
1826
1839
|
}
|
|
1827
1840
|
),
|
|
1828
|
-
/* @__PURE__ */ n("span", { className: "ll-hmenu__name", children:
|
|
1829
|
-
|
|
1841
|
+
/* @__PURE__ */ n("span", { className: "ll-hmenu__name", children: w.name }),
|
|
1842
|
+
w.role && /* @__PURE__ */ n("span", { className: "ll-hmenu__role", children: w.role })
|
|
1830
1843
|
]
|
|
1831
1844
|
},
|
|
1832
|
-
|
|
1845
|
+
w.id
|
|
1833
1846
|
))
|
|
1834
1847
|
}
|
|
1835
1848
|
)
|
|
@@ -1840,8 +1853,8 @@ const si = ({
|
|
|
1840
1853
|
{
|
|
1841
1854
|
type: "button",
|
|
1842
1855
|
className: "ll-hpill ll-hpill--compact",
|
|
1843
|
-
onClick: (
|
|
1844
|
-
|
|
1856
|
+
onClick: (w) => {
|
|
1857
|
+
w.stopPropagation(), _();
|
|
1845
1858
|
},
|
|
1846
1859
|
"aria-haspopup": "listbox",
|
|
1847
1860
|
"aria-expanded": T,
|
|
@@ -1849,7 +1862,7 @@ const si = ({
|
|
|
1849
1862
|
title: "Language: English",
|
|
1850
1863
|
children: [
|
|
1851
1864
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: "EN" }),
|
|
1852
|
-
/* @__PURE__ */ n(
|
|
1865
|
+
/* @__PURE__ */ n(Ct, {})
|
|
1853
1866
|
]
|
|
1854
1867
|
}
|
|
1855
1868
|
),
|
|
@@ -1857,7 +1870,7 @@ const si = ({
|
|
|
1857
1870
|
"div",
|
|
1858
1871
|
{
|
|
1859
1872
|
className: "ll-hmenu",
|
|
1860
|
-
onClick: (
|
|
1873
|
+
onClick: (w) => w.stopPropagation(),
|
|
1861
1874
|
role: "listbox",
|
|
1862
1875
|
children: /* @__PURE__ */ n(
|
|
1863
1876
|
"button",
|
|
@@ -1875,8 +1888,8 @@ const si = ({
|
|
|
1875
1888
|
/* @__PURE__ */ n(
|
|
1876
1889
|
"span",
|
|
1877
1890
|
{
|
|
1878
|
-
className: `ll-expanded__state ll-expanded__state--${
|
|
1879
|
-
children:
|
|
1891
|
+
className: `ll-expanded__state ll-expanded__state--${g}`,
|
|
1892
|
+
children: g
|
|
1880
1893
|
}
|
|
1881
1894
|
)
|
|
1882
1895
|
] }),
|
|
@@ -1889,7 +1902,7 @@ const si = ({
|
|
|
1889
1902
|
onClick: Pe,
|
|
1890
1903
|
"aria-label": "Minimize widget",
|
|
1891
1904
|
title: "Minimize",
|
|
1892
|
-
children: /* @__PURE__ */ n(
|
|
1905
|
+
children: /* @__PURE__ */ n(_n, {})
|
|
1893
1906
|
}
|
|
1894
1907
|
),
|
|
1895
1908
|
te !== !1 && /* @__PURE__ */ n(
|
|
@@ -1905,9 +1918,9 @@ const si = ({
|
|
|
1905
1918
|
)
|
|
1906
1919
|
] })
|
|
1907
1920
|
] }),
|
|
1908
|
-
|
|
1921
|
+
U && /* @__PURE__ */ C("div", { className: "ll-compact-status", "data-state": g, children: [
|
|
1909
1922
|
/* @__PURE__ */ n("span", { className: "ll-compact-status__dot", "aria-hidden": !0 }),
|
|
1910
|
-
/* @__PURE__ */ n("span", { className: "ll-compact-status__label", children:
|
|
1923
|
+
/* @__PURE__ */ n("span", { className: "ll-compact-status__label", children: g })
|
|
1911
1924
|
] })
|
|
1912
1925
|
] }) : (
|
|
1913
1926
|
// Idle-state header. In compactControls mode (mobile WIDGET +
|
|
@@ -1918,8 +1931,8 @@ const si = ({
|
|
|
1918
1931
|
// can always dismiss; making the whole header disappear (the
|
|
1919
1932
|
// pre-0.18.0 behavior) left users no way out short of scrolling
|
|
1920
1933
|
// the page itself.
|
|
1921
|
-
/* @__PURE__ */ C("div", { className: "ll-expanded__header ll-expanded__header--idle", ...
|
|
1922
|
-
!
|
|
1934
|
+
/* @__PURE__ */ C("div", { className: "ll-expanded__header ll-expanded__header--idle", ...W, children: [
|
|
1935
|
+
!U && (Oe ? /* @__PURE__ */ C(
|
|
1923
1936
|
"a",
|
|
1924
1937
|
{
|
|
1925
1938
|
className: "ll-expanded__brand ll-expanded__brand--link",
|
|
@@ -1930,19 +1943,19 @@ const si = ({
|
|
|
1930
1943
|
title: "Powered by LiveLayer — visit livelayer.studio",
|
|
1931
1944
|
children: [
|
|
1932
1945
|
/* @__PURE__ */ n(ni, { size: 14, className: "ll-expanded__brand-mark" }),
|
|
1933
|
-
/* @__PURE__ */ n("span", { children:
|
|
1946
|
+
/* @__PURE__ */ n("span", { children: _e })
|
|
1934
1947
|
]
|
|
1935
1948
|
}
|
|
1936
|
-
) : /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children:
|
|
1949
|
+
) : /* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: _e })),
|
|
1937
1950
|
/* @__PURE__ */ C("div", { className: "ll-expanded__header-actions", children: [
|
|
1938
|
-
!
|
|
1951
|
+
!U && Y !== !1 && /* @__PURE__ */ n(
|
|
1939
1952
|
"button",
|
|
1940
1953
|
{
|
|
1941
1954
|
type: "button",
|
|
1942
1955
|
className: "ll-hbtn ll-hbtn--ghost",
|
|
1943
1956
|
onClick: Pe,
|
|
1944
1957
|
"aria-label": "Minimize widget",
|
|
1945
|
-
children: /* @__PURE__ */ n(
|
|
1958
|
+
children: /* @__PURE__ */ n(_n, {})
|
|
1946
1959
|
}
|
|
1947
1960
|
),
|
|
1948
1961
|
te !== !1 && /* @__PURE__ */ n(
|
|
@@ -1958,32 +1971,32 @@ const si = ({
|
|
|
1958
1971
|
] })
|
|
1959
1972
|
] })
|
|
1960
1973
|
),
|
|
1961
|
-
|
|
1962
|
-
const
|
|
1963
|
-
return /* @__PURE__ */ C(
|
|
1964
|
-
!
|
|
1974
|
+
at && /* @__PURE__ */ (() => {
|
|
1975
|
+
const w = R ? "Resume session" : E === "disconnected" ? "Reconnect to agent" : "Start video call";
|
|
1976
|
+
return /* @__PURE__ */ C(We, { children: [
|
|
1977
|
+
!y && /* @__PURE__ */ C(
|
|
1965
1978
|
"button",
|
|
1966
1979
|
{
|
|
1967
1980
|
type: "button",
|
|
1968
1981
|
className: "ll-expanded__play",
|
|
1969
|
-
onClick:
|
|
1970
|
-
"aria-label":
|
|
1982
|
+
onClick: rt,
|
|
1983
|
+
"aria-label": w,
|
|
1971
1984
|
children: [
|
|
1972
1985
|
/* @__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" }) }) }),
|
|
1973
|
-
|
|
1986
|
+
U && /* @__PURE__ */ n("span", { className: "ll-expanded__play-label", children: w })
|
|
1974
1987
|
]
|
|
1975
1988
|
}
|
|
1976
1989
|
),
|
|
1977
|
-
!
|
|
1990
|
+
!U && /* @__PURE__ */ C("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
|
|
1978
1991
|
o && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: o }) }),
|
|
1979
1992
|
/* @__PURE__ */ n(
|
|
1980
1993
|
"button",
|
|
1981
1994
|
{
|
|
1982
1995
|
type: "button",
|
|
1983
1996
|
className: "ll-expanded__cta",
|
|
1984
|
-
onClick:
|
|
1985
|
-
"aria-label":
|
|
1986
|
-
children:
|
|
1997
|
+
onClick: rt,
|
|
1998
|
+
"aria-label": w,
|
|
1999
|
+
children: w
|
|
1987
2000
|
}
|
|
1988
2001
|
)
|
|
1989
2002
|
] })
|
|
@@ -1992,55 +2005,55 @@ const si = ({
|
|
|
1992
2005
|
/* @__PURE__ */ C(
|
|
1993
2006
|
"div",
|
|
1994
2007
|
{
|
|
1995
|
-
className: `ll-expanded__pip ${
|
|
2008
|
+
className: `ll-expanded__pip ${Ue && (K || f) ? "is-visible" : ""}`,
|
|
1996
2009
|
children: [
|
|
1997
2010
|
/* @__PURE__ */ n(
|
|
1998
2011
|
"div",
|
|
1999
2012
|
{
|
|
2000
2013
|
ref: ce,
|
|
2001
|
-
className:
|
|
2014
|
+
className: f ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
2002
2015
|
}
|
|
2003
2016
|
),
|
|
2004
2017
|
/* @__PURE__ */ n(
|
|
2005
2018
|
"div",
|
|
2006
2019
|
{
|
|
2007
|
-
ref:
|
|
2008
|
-
className: !
|
|
2020
|
+
ref: st,
|
|
2021
|
+
className: !f && K ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
2009
2022
|
}
|
|
2010
2023
|
)
|
|
2011
2024
|
]
|
|
2012
2025
|
}
|
|
2013
2026
|
),
|
|
2014
|
-
|
|
2015
|
-
!
|
|
2027
|
+
Ue ? /* @__PURE__ */ C("div", { className: "ll-expanded__bottom", children: [
|
|
2028
|
+
!U && Ge && /* @__PURE__ */ n(
|
|
2016
2029
|
"div",
|
|
2017
2030
|
{
|
|
2018
2031
|
className: "ll-expanded__transcript ll-expanded__transcript--agent",
|
|
2019
2032
|
"data-role": "agent",
|
|
2020
|
-
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children:
|
|
2033
|
+
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Ge })
|
|
2021
2034
|
}
|
|
2022
2035
|
),
|
|
2023
|
-
!
|
|
2036
|
+
!U && Xe && /* @__PURE__ */ n(
|
|
2024
2037
|
"div",
|
|
2025
2038
|
{
|
|
2026
2039
|
className: "ll-expanded__transcript ll-expanded__transcript--user",
|
|
2027
2040
|
"data-role": "user",
|
|
2028
|
-
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children:
|
|
2041
|
+
children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Xe })
|
|
2029
2042
|
}
|
|
2030
2043
|
),
|
|
2031
|
-
!
|
|
2044
|
+
!ie && !U && /* @__PURE__ */ C("div", { className: "ll-toolbar", onClick: (w) => w.stopPropagation(), children: [
|
|
2032
2045
|
X && /* @__PURE__ */ n(
|
|
2033
2046
|
"button",
|
|
2034
2047
|
{
|
|
2035
2048
|
type: "button",
|
|
2036
|
-
className: `ll-tool ${
|
|
2049
|
+
className: `ll-tool ${f ? "is-on" : ""}`,
|
|
2037
2050
|
onClick: Ie,
|
|
2038
|
-
"aria-label":
|
|
2039
|
-
title:
|
|
2040
|
-
children: /* @__PURE__ */ n(
|
|
2051
|
+
"aria-label": f ? "Stop sharing screen" : "Share screen",
|
|
2052
|
+
title: f ? "Stop sharing" : "Share screen",
|
|
2053
|
+
children: /* @__PURE__ */ n(zn, {})
|
|
2041
2054
|
}
|
|
2042
2055
|
),
|
|
2043
|
-
|
|
2056
|
+
q && /* @__PURE__ */ C("div", { className: "ll-tool-split", children: [
|
|
2044
2057
|
/* @__PURE__ */ n(
|
|
2045
2058
|
"button",
|
|
2046
2059
|
{
|
|
@@ -2049,33 +2062,33 @@ const si = ({
|
|
|
2049
2062
|
onClick: Me,
|
|
2050
2063
|
"aria-label": K ? "Turn off camera" : "Turn on camera",
|
|
2051
2064
|
title: K ? "Stop camera" : "Start camera",
|
|
2052
|
-
children: /* @__PURE__ */ n(
|
|
2065
|
+
children: /* @__PURE__ */ n($n, {})
|
|
2053
2066
|
}
|
|
2054
2067
|
),
|
|
2055
2068
|
/* @__PURE__ */ n(
|
|
2056
2069
|
"button",
|
|
2057
2070
|
{
|
|
2058
|
-
ref:
|
|
2071
|
+
ref: yt,
|
|
2059
2072
|
type: "button",
|
|
2060
2073
|
className: `ll-tool ll-tool--right ${K ? "is-on" : ""}`,
|
|
2061
|
-
onClick: (
|
|
2062
|
-
|
|
2074
|
+
onClick: (w) => {
|
|
2075
|
+
w.stopPropagation(), he((le) => !le), Ve(!1);
|
|
2063
2076
|
},
|
|
2064
2077
|
"aria-label": "Camera devices",
|
|
2065
2078
|
"aria-haspopup": "listbox",
|
|
2066
|
-
"aria-expanded":
|
|
2067
|
-
children: /* @__PURE__ */ n(
|
|
2079
|
+
"aria-expanded": Ye,
|
|
2080
|
+
children: /* @__PURE__ */ n(Ct, {})
|
|
2068
2081
|
}
|
|
2069
2082
|
),
|
|
2070
|
-
|
|
2071
|
-
|
|
2083
|
+
Ye && z.length > 0 && /* @__PURE__ */ n(
|
|
2084
|
+
xn,
|
|
2072
2085
|
{
|
|
2073
2086
|
label: "Camera",
|
|
2074
|
-
devices:
|
|
2087
|
+
devices: z,
|
|
2075
2088
|
activeId: G,
|
|
2076
|
-
anchorRef:
|
|
2077
|
-
onPick: (
|
|
2078
|
-
|
|
2089
|
+
anchorRef: yt,
|
|
2090
|
+
onPick: (w) => {
|
|
2091
|
+
he(!1), Fe(w);
|
|
2079
2092
|
}
|
|
2080
2093
|
}
|
|
2081
2094
|
)
|
|
@@ -2085,37 +2098,37 @@ const si = ({
|
|
|
2085
2098
|
"button",
|
|
2086
2099
|
{
|
|
2087
2100
|
type: "button",
|
|
2088
|
-
className: `ll-tool ll-tool--left ${
|
|
2089
|
-
onClick:
|
|
2090
|
-
"aria-label":
|
|
2091
|
-
title:
|
|
2092
|
-
children: /* @__PURE__ */ n(
|
|
2101
|
+
className: `ll-tool ll-tool--left ${H ? "is-muted" : ""}`,
|
|
2102
|
+
onClick: ot,
|
|
2103
|
+
"aria-label": H ? "Unmute microphone" : "Mute microphone",
|
|
2104
|
+
title: H ? "Unmute" : "Mute",
|
|
2105
|
+
children: /* @__PURE__ */ n(Hn, { muted: H })
|
|
2093
2106
|
}
|
|
2094
2107
|
),
|
|
2095
2108
|
/* @__PURE__ */ n(
|
|
2096
2109
|
"button",
|
|
2097
2110
|
{
|
|
2098
|
-
ref:
|
|
2111
|
+
ref: we,
|
|
2099
2112
|
type: "button",
|
|
2100
|
-
className: `ll-tool ll-tool--right ${
|
|
2101
|
-
onClick: (
|
|
2102
|
-
|
|
2113
|
+
className: `ll-tool ll-tool--right ${H ? "is-muted" : ""}`,
|
|
2114
|
+
onClick: (w) => {
|
|
2115
|
+
w.stopPropagation(), Ve((le) => !le), he(!1);
|
|
2103
2116
|
},
|
|
2104
2117
|
"aria-label": "Microphone devices",
|
|
2105
2118
|
"aria-haspopup": "listbox",
|
|
2106
|
-
"aria-expanded":
|
|
2107
|
-
children: /* @__PURE__ */ n(
|
|
2119
|
+
"aria-expanded": pe,
|
|
2120
|
+
children: /* @__PURE__ */ n(Ct, {})
|
|
2108
2121
|
}
|
|
2109
2122
|
),
|
|
2110
|
-
|
|
2111
|
-
|
|
2123
|
+
pe && D.length > 0 && /* @__PURE__ */ n(
|
|
2124
|
+
xn,
|
|
2112
2125
|
{
|
|
2113
2126
|
label: "Microphone",
|
|
2114
|
-
devices:
|
|
2115
|
-
activeId:
|
|
2116
|
-
anchorRef:
|
|
2117
|
-
onPick: (
|
|
2118
|
-
|
|
2127
|
+
devices: D,
|
|
2128
|
+
activeId: F,
|
|
2129
|
+
anchorRef: we,
|
|
2130
|
+
onPick: (w) => {
|
|
2131
|
+
Ve(!1), lt(w);
|
|
2119
2132
|
}
|
|
2120
2133
|
}
|
|
2121
2134
|
)
|
|
@@ -2124,11 +2137,11 @@ const si = ({
|
|
|
2124
2137
|
"button",
|
|
2125
2138
|
{
|
|
2126
2139
|
type: "button",
|
|
2127
|
-
className: `ll-tool ${
|
|
2140
|
+
className: `ll-tool ${O ? "is-muted" : ""}`,
|
|
2128
2141
|
onClick: Re,
|
|
2129
|
-
"aria-label":
|
|
2130
|
-
title:
|
|
2131
|
-
children: /* @__PURE__ */ n(
|
|
2142
|
+
"aria-label": O ? "Unmute speaker" : "Mute speaker",
|
|
2143
|
+
title: O ? "Unmute speaker" : "Mute speaker",
|
|
2144
|
+
children: /* @__PURE__ */ n(On, { muted: O })
|
|
2132
2145
|
}
|
|
2133
2146
|
),
|
|
2134
2147
|
/* @__PURE__ */ n(
|
|
@@ -2136,45 +2149,45 @@ const si = ({
|
|
|
2136
2149
|
{
|
|
2137
2150
|
type: "button",
|
|
2138
2151
|
className: "ll-tool ll-tool--danger",
|
|
2139
|
-
onClick:
|
|
2152
|
+
onClick: it,
|
|
2140
2153
|
"aria-label": "End conversation",
|
|
2141
2154
|
title: "End conversation",
|
|
2142
|
-
children: /* @__PURE__ */ n(
|
|
2155
|
+
children: /* @__PURE__ */ n(Wn, {})
|
|
2143
2156
|
}
|
|
2144
2157
|
)
|
|
2145
2158
|
] }),
|
|
2146
|
-
!
|
|
2159
|
+
!ie && U && /* @__PURE__ */ n(
|
|
2147
2160
|
oi,
|
|
2148
2161
|
{
|
|
2149
|
-
isMuted:
|
|
2150
|
-
onToggleMute:
|
|
2162
|
+
isMuted: H,
|
|
2163
|
+
onToggleMute: ot,
|
|
2151
2164
|
isCameraEnabled: K,
|
|
2152
2165
|
onToggleCamera: Me,
|
|
2153
|
-
allowCamera:
|
|
2154
|
-
isScreenShareEnabled:
|
|
2166
|
+
allowCamera: q,
|
|
2167
|
+
isScreenShareEnabled: f,
|
|
2155
2168
|
onToggleScreenShare: Ie,
|
|
2156
2169
|
allowScreenShare: X,
|
|
2157
|
-
isSpeakerMuted:
|
|
2170
|
+
isSpeakerMuted: O,
|
|
2158
2171
|
onToggleSpeaker: Re,
|
|
2159
2172
|
allowTyping: Q,
|
|
2160
|
-
isTypingOpen:
|
|
2161
|
-
onToggleTyping:
|
|
2162
|
-
onDisconnect:
|
|
2173
|
+
isTypingOpen: vt,
|
|
2174
|
+
onToggleTyping: jt,
|
|
2175
|
+
onDisconnect: it
|
|
2163
2176
|
}
|
|
2164
2177
|
),
|
|
2165
|
-
!
|
|
2178
|
+
!ie && Q && (U ? vt : !0) && /* @__PURE__ */ C("form", { className: "ll-message-input", onSubmit: He, children: [
|
|
2166
2179
|
/* @__PURE__ */ n(
|
|
2167
2180
|
"input",
|
|
2168
2181
|
{
|
|
2169
2182
|
type: "text",
|
|
2170
2183
|
className: "ll-message-input__field",
|
|
2171
2184
|
placeholder: "Message...",
|
|
2172
|
-
value:
|
|
2173
|
-
onChange: (
|
|
2185
|
+
value: ct,
|
|
2186
|
+
onChange: (w) => Ee(w.target.value),
|
|
2174
2187
|
"aria-label": "Message the agent"
|
|
2175
2188
|
}
|
|
2176
2189
|
),
|
|
2177
|
-
|
|
2190
|
+
ct.trim() && /* @__PURE__ */ n(
|
|
2178
2191
|
"button",
|
|
2179
2192
|
{
|
|
2180
2193
|
type: "submit",
|
|
@@ -2186,40 +2199,40 @@ const si = ({
|
|
|
2186
2199
|
] })
|
|
2187
2200
|
] }) : null,
|
|
2188
2201
|
(() => {
|
|
2189
|
-
if (
|
|
2202
|
+
if (m && E !== "error")
|
|
2190
2203
|
return /* @__PURE__ */ C("div", { className: "ll-expanded__banner", role: "alert", children: [
|
|
2191
|
-
/* @__PURE__ */ n("span", { children:
|
|
2204
|
+
/* @__PURE__ */ n("span", { children: m }),
|
|
2192
2205
|
/* @__PURE__ */ n(
|
|
2193
2206
|
"button",
|
|
2194
2207
|
{
|
|
2195
2208
|
type: "button",
|
|
2196
2209
|
className: "ll-expanded__banner-x",
|
|
2197
|
-
onClick:
|
|
2210
|
+
onClick: Be,
|
|
2198
2211
|
"aria-label": "Dismiss",
|
|
2199
2212
|
children: "×"
|
|
2200
2213
|
}
|
|
2201
2214
|
)
|
|
2202
2215
|
] });
|
|
2203
|
-
if (!
|
|
2204
|
-
let
|
|
2205
|
-
return
|
|
2206
|
-
/* @__PURE__ */ n("span", { children:
|
|
2216
|
+
if (!y || E !== "error") return null;
|
|
2217
|
+
let w = "Failed to connect", le = "Try again";
|
|
2218
|
+
return y === "MIC_PERMISSION_DENIED" ? w = "Microphone blocked. Allow access to talk." : y === "MIC_NOT_FOUND" ? w = "No microphone found. Plug one in + retry." : y === "MIC_UNAVAILABLE" ? w = "Mic unavailable. Check other apps using it." : y === "AGENT_TIMEOUT" ? w = "Agent didn't pick up. Try again." : y === "CONNECT_FAILED" ? w = "Connection failed. Check your network." : y.length < 80 && (w = y), /* @__PURE__ */ C("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
|
|
2219
|
+
/* @__PURE__ */ n("span", { children: w }),
|
|
2207
2220
|
/* @__PURE__ */ n(
|
|
2208
2221
|
"button",
|
|
2209
2222
|
{
|
|
2210
2223
|
type: "button",
|
|
2211
2224
|
className: "ll-expanded__banner-retry",
|
|
2212
|
-
onClick:
|
|
2213
|
-
children:
|
|
2225
|
+
onClick: mt,
|
|
2226
|
+
children: le
|
|
2214
2227
|
}
|
|
2215
2228
|
)
|
|
2216
2229
|
] });
|
|
2217
2230
|
})(),
|
|
2218
|
-
(
|
|
2231
|
+
(qe == null ? void 0 : qe["data-ll-resize-handle"]) !== void 0 && /* @__PURE__ */ n(
|
|
2219
2232
|
"div",
|
|
2220
2233
|
{
|
|
2221
2234
|
className: "ll-expanded__resize-grip",
|
|
2222
|
-
...
|
|
2235
|
+
...qe,
|
|
2223
2236
|
"aria-hidden": !0,
|
|
2224
2237
|
children: /* @__PURE__ */ C("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
|
|
2225
2238
|
/* @__PURE__ */ n("line", { x1: "11", y1: "4", x2: "4", y2: "11" }),
|
|
@@ -2231,7 +2244,7 @@ const si = ({
|
|
|
2231
2244
|
}
|
|
2232
2245
|
);
|
|
2233
2246
|
};
|
|
2234
|
-
function
|
|
2247
|
+
function Ct() {
|
|
2235
2248
|
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" }) });
|
|
2236
2249
|
}
|
|
2237
2250
|
function wn() {
|
|
@@ -2240,23 +2253,23 @@ function wn() {
|
|
|
2240
2253
|
/* @__PURE__ */ n("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
2241
2254
|
] });
|
|
2242
2255
|
}
|
|
2243
|
-
function
|
|
2256
|
+
function _n() {
|
|
2244
2257
|
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" }) });
|
|
2245
2258
|
}
|
|
2246
|
-
function
|
|
2259
|
+
function zn() {
|
|
2247
2260
|
return /* @__PURE__ */ C("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: [
|
|
2248
2261
|
/* @__PURE__ */ n("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2" }),
|
|
2249
2262
|
/* @__PURE__ */ n("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
|
|
2250
2263
|
/* @__PURE__ */ n("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
|
|
2251
2264
|
] });
|
|
2252
2265
|
}
|
|
2253
|
-
function
|
|
2266
|
+
function $n() {
|
|
2254
2267
|
return /* @__PURE__ */ C("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: [
|
|
2255
2268
|
/* @__PURE__ */ n("path", { d: "M23 7l-7 5 7 5V7z" }),
|
|
2256
2269
|
/* @__PURE__ */ n("rect", { x: "1", y: "5", width: "15", height: "14", rx: "2" })
|
|
2257
2270
|
] });
|
|
2258
2271
|
}
|
|
2259
|
-
function
|
|
2272
|
+
function Hn({ muted: e }) {
|
|
2260
2273
|
return /* @__PURE__ */ C("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: [
|
|
2261
2274
|
/* @__PURE__ */ n("path", { d: "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z" }),
|
|
2262
2275
|
/* @__PURE__ */ n("path", { d: "M19 10v2a7 7 0 0 1-14 0v-2" }),
|
|
@@ -2264,10 +2277,10 @@ function $n({ muted: e }) {
|
|
|
2264
2277
|
e && /* @__PURE__ */ n("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
2265
2278
|
] });
|
|
2266
2279
|
}
|
|
2267
|
-
function
|
|
2280
|
+
function On({ muted: e }) {
|
|
2268
2281
|
return /* @__PURE__ */ C("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: [
|
|
2269
2282
|
/* @__PURE__ */ n("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
2270
|
-
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ C(
|
|
2283
|
+
e ? /* @__PURE__ */ n("line", { x1: "23", y1: "9", x2: "17", y2: "15" }) : /* @__PURE__ */ C(We, { children: [
|
|
2271
2284
|
/* @__PURE__ */ n("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" }),
|
|
2272
2285
|
/* @__PURE__ */ n("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" })
|
|
2273
2286
|
] })
|
|
@@ -2279,7 +2292,7 @@ function ci() {
|
|
|
2279
2292
|
/* @__PURE__ */ n("polyline", { points: "12 5 19 12 12 19" })
|
|
2280
2293
|
] });
|
|
2281
2294
|
}
|
|
2282
|
-
function
|
|
2295
|
+
function Wn() {
|
|
2283
2296
|
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(
|
|
2284
2297
|
"path",
|
|
2285
2298
|
{
|
|
@@ -2288,33 +2301,33 @@ function On() {
|
|
|
2288
2301
|
}
|
|
2289
2302
|
) });
|
|
2290
2303
|
}
|
|
2291
|
-
const
|
|
2304
|
+
const xn = ({
|
|
2292
2305
|
label: e,
|
|
2293
2306
|
devices: t,
|
|
2294
2307
|
activeId: r,
|
|
2295
2308
|
onPick: i,
|
|
2296
|
-
anchorRef:
|
|
2309
|
+
anchorRef: l
|
|
2297
2310
|
}) => {
|
|
2298
2311
|
const [o, s] = M(null);
|
|
2299
|
-
return
|
|
2300
|
-
const
|
|
2301
|
-
const c =
|
|
2312
|
+
return In(() => {
|
|
2313
|
+
const a = () => {
|
|
2314
|
+
const c = l.current;
|
|
2302
2315
|
if (!c) return;
|
|
2303
|
-
const
|
|
2316
|
+
const d = c.getBoundingClientRect(), v = 126, p = window.innerWidth - 16 - 110, h = d.left + d.width / 2;
|
|
2304
2317
|
s({
|
|
2305
|
-
top:
|
|
2306
|
-
left: Math.max(
|
|
2318
|
+
top: d.top - 8,
|
|
2319
|
+
left: Math.max(v, Math.min(p, h))
|
|
2307
2320
|
});
|
|
2308
2321
|
};
|
|
2309
|
-
return
|
|
2310
|
-
window.removeEventListener("scroll",
|
|
2322
|
+
return a(), window.addEventListener("scroll", a, !0), window.addEventListener("resize", a), () => {
|
|
2323
|
+
window.removeEventListener("scroll", a, !0), window.removeEventListener("resize", a);
|
|
2311
2324
|
};
|
|
2312
|
-
}, [
|
|
2325
|
+
}, [l]), o === null || typeof document > "u" ? null : qt(
|
|
2313
2326
|
/* @__PURE__ */ C(
|
|
2314
2327
|
"div",
|
|
2315
2328
|
{
|
|
2316
2329
|
className: "ll-device-menu ll-device-menu--floating",
|
|
2317
|
-
onClick: (
|
|
2330
|
+
onClick: (a) => a.stopPropagation(),
|
|
2318
2331
|
role: "listbox",
|
|
2319
2332
|
style: {
|
|
2320
2333
|
position: "fixed",
|
|
@@ -2325,22 +2338,22 @@ const _n = ({
|
|
|
2325
2338
|
},
|
|
2326
2339
|
children: [
|
|
2327
2340
|
/* @__PURE__ */ n("p", { className: "ll-device-menu__label", children: e }),
|
|
2328
|
-
t.map((
|
|
2329
|
-
const
|
|
2341
|
+
t.map((a, c) => {
|
|
2342
|
+
const d = r === a.deviceId;
|
|
2330
2343
|
return /* @__PURE__ */ C(
|
|
2331
2344
|
"button",
|
|
2332
2345
|
{
|
|
2333
2346
|
type: "button",
|
|
2334
|
-
className: `ll-device-menu__item ${
|
|
2335
|
-
onClick: () => i(
|
|
2347
|
+
className: `ll-device-menu__item ${d ? "is-active" : ""}`,
|
|
2348
|
+
onClick: () => i(a.deviceId),
|
|
2336
2349
|
role: "option",
|
|
2337
|
-
"aria-selected":
|
|
2350
|
+
"aria-selected": d,
|
|
2338
2351
|
children: [
|
|
2339
|
-
|
|
2340
|
-
/* @__PURE__ */ n("span", { className: "ll-device-menu__name", children:
|
|
2352
|
+
d && /* @__PURE__ */ n("span", { className: "ll-device-menu__dot", children: "●" }),
|
|
2353
|
+
/* @__PURE__ */ n("span", { className: "ll-device-menu__name", children: a.label || `${e} ${c + 1}` })
|
|
2341
2354
|
]
|
|
2342
2355
|
},
|
|
2343
|
-
|
|
2356
|
+
a.deviceId || c
|
|
2344
2357
|
);
|
|
2345
2358
|
})
|
|
2346
2359
|
]
|
|
@@ -2348,7 +2361,7 @@ const _n = ({
|
|
|
2348
2361
|
),
|
|
2349
2362
|
document.body
|
|
2350
2363
|
);
|
|
2351
|
-
},
|
|
2364
|
+
}, ui = [
|
|
2352
2365
|
// Accept any value (or empty) — `<input data-ll-private />` and
|
|
2353
2366
|
// `<input data-ll-private="true" />` both opt out. The bare attribute
|
|
2354
2367
|
// is the recommended spelling; "true" is preserved for back-compat.
|
|
@@ -2356,17 +2369,17 @@ const _n = ({
|
|
|
2356
2369
|
"[data-ll-skip]",
|
|
2357
2370
|
".ll-widget"
|
|
2358
2371
|
];
|
|
2359
|
-
function
|
|
2372
|
+
function Ut(e) {
|
|
2360
2373
|
let t = e;
|
|
2361
2374
|
for (; t; ) {
|
|
2362
|
-
for (const r of
|
|
2375
|
+
for (const r of ui)
|
|
2363
2376
|
if (t.matches(r)) return !0;
|
|
2364
2377
|
t = t.parentElement;
|
|
2365
2378
|
}
|
|
2366
2379
|
return !1;
|
|
2367
2380
|
}
|
|
2368
|
-
function
|
|
2369
|
-
if (
|
|
2381
|
+
function Ft(e) {
|
|
2382
|
+
if (Ut(e)) return !1;
|
|
2370
2383
|
if (e instanceof HTMLInputElement) {
|
|
2371
2384
|
if (e.type === "password") return !1;
|
|
2372
2385
|
const t = (e.getAttribute("autocomplete") || "").toLowerCase();
|
|
@@ -2374,7 +2387,7 @@ function Wt(e) {
|
|
|
2374
2387
|
}
|
|
2375
2388
|
return !0;
|
|
2376
2389
|
}
|
|
2377
|
-
const
|
|
2390
|
+
const kt = 4096, di = 20, fi = 20, pi = 10, hi = 10, mi = 30, gi = 20, Ln = 500, yi = [
|
|
2378
2391
|
'[data-ll-private="true"]',
|
|
2379
2392
|
".ll-widget",
|
|
2380
2393
|
"script",
|
|
@@ -2382,7 +2395,7 @@ const Ct = 4096, ui = 20, fi = 20, pi = 10, hi = 10, mi = 30, gi = 20, xn = 500,
|
|
|
2382
2395
|
"noscript",
|
|
2383
2396
|
"iframe"
|
|
2384
2397
|
];
|
|
2385
|
-
function
|
|
2398
|
+
function pt(e) {
|
|
2386
2399
|
if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
|
|
2387
2400
|
let t = e;
|
|
2388
2401
|
for (; t; ) {
|
|
@@ -2392,14 +2405,14 @@ function ft(e) {
|
|
|
2392
2405
|
}
|
|
2393
2406
|
return !1;
|
|
2394
2407
|
}
|
|
2395
|
-
function
|
|
2408
|
+
function ht(e) {
|
|
2396
2409
|
if (typeof window > "u") return !0;
|
|
2397
2410
|
const t = e.getBoundingClientRect();
|
|
2398
2411
|
if (t.width <= 0 || t.height <= 0) return !1;
|
|
2399
2412
|
const r = window.innerHeight || document.documentElement.clientHeight, i = window.innerWidth || document.documentElement.clientWidth;
|
|
2400
2413
|
return t.bottom > 0 && t.right > 0 && t.top < r && t.left < i;
|
|
2401
2414
|
}
|
|
2402
|
-
function
|
|
2415
|
+
function Cn(e) {
|
|
2403
2416
|
const t = e.getAttribute("id");
|
|
2404
2417
|
if (t) {
|
|
2405
2418
|
const o = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(t) : t.replace(/"/g, '\\"'), s = document.querySelector(`label[for="${o}"]`);
|
|
@@ -2410,29 +2423,29 @@ function Ln(e) {
|
|
|
2410
2423
|
const i = e.closest("label");
|
|
2411
2424
|
if (i) {
|
|
2412
2425
|
const o = [];
|
|
2413
|
-
for (const
|
|
2414
|
-
if (
|
|
2415
|
-
const c = (
|
|
2426
|
+
for (const a of Array.from(i.childNodes))
|
|
2427
|
+
if (a.nodeType === Node.TEXT_NODE) {
|
|
2428
|
+
const c = (a.textContent || "").trim();
|
|
2416
2429
|
c && o.push(c);
|
|
2417
|
-
} else if (
|
|
2418
|
-
if (
|
|
2430
|
+
} else if (a instanceof HTMLElement) {
|
|
2431
|
+
if (a instanceof HTMLInputElement || a instanceof HTMLTextAreaElement || a instanceof HTMLSelectElement || a instanceof HTMLButtonElement)
|
|
2419
2432
|
continue;
|
|
2420
|
-
const c = (
|
|
2433
|
+
const c = (a.textContent || "").trim();
|
|
2421
2434
|
c && o.push(c);
|
|
2422
2435
|
}
|
|
2423
2436
|
const s = o.join(" ").trim();
|
|
2424
2437
|
if (s) return s;
|
|
2425
2438
|
}
|
|
2426
|
-
const
|
|
2427
|
-
return
|
|
2439
|
+
const l = e.getAttribute("placeholder");
|
|
2440
|
+
return l ? l.trim() : "";
|
|
2428
2441
|
}
|
|
2429
|
-
function
|
|
2442
|
+
function de(e, t) {
|
|
2430
2443
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
2431
2444
|
}
|
|
2432
2445
|
function vi(e) {
|
|
2433
2446
|
return e && e.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60) || null;
|
|
2434
2447
|
}
|
|
2435
|
-
function
|
|
2448
|
+
function bi(e) {
|
|
2436
2449
|
const t = e.getAttribute("aria-label");
|
|
2437
2450
|
if (t) return t.trim().slice(0, 80);
|
|
2438
2451
|
const r = e.getAttribute("aria-labelledby");
|
|
@@ -2448,20 +2461,20 @@ function wi(e) {
|
|
|
2448
2461
|
if (o && o.length < 60 && !/^(submit|ok|continue)$/i.test(o))
|
|
2449
2462
|
return o;
|
|
2450
2463
|
}
|
|
2451
|
-
let
|
|
2452
|
-
for (let o = 0;
|
|
2453
|
-
const s =
|
|
2464
|
+
let l = e.parentElement;
|
|
2465
|
+
for (let o = 0; l && o < 4; o++, l = l.parentElement) {
|
|
2466
|
+
const s = l.querySelector("h1, h2, h3, h4");
|
|
2454
2467
|
if (s != null && s.textContent) {
|
|
2455
|
-
const
|
|
2456
|
-
if (
|
|
2468
|
+
const a = s.textContent.trim();
|
|
2469
|
+
if (a && a.length < 80) return a;
|
|
2457
2470
|
}
|
|
2458
2471
|
}
|
|
2459
2472
|
return null;
|
|
2460
2473
|
}
|
|
2461
|
-
function
|
|
2474
|
+
function Qe(e) {
|
|
2462
2475
|
return e.length;
|
|
2463
2476
|
}
|
|
2464
|
-
function
|
|
2477
|
+
function wi(e, t = {}) {
|
|
2465
2478
|
const r = t.doc ?? (typeof document < "u" ? document : null);
|
|
2466
2479
|
if (!r)
|
|
2467
2480
|
return {
|
|
@@ -2475,147 +2488,147 @@ function bi(e, t = {}) {
|
|
|
2475
2488
|
forms: [],
|
|
2476
2489
|
extras: e
|
|
2477
2490
|
};
|
|
2478
|
-
const i = typeof window < "u" && window.location.href || "",
|
|
2491
|
+
const i = typeof window < "u" && window.location.href || "", l = typeof window < "u" && window.location.pathname || "/", o = r.title || "", s = Array.from(
|
|
2479
2492
|
r.querySelectorAll("[data-ll-region]")
|
|
2480
|
-
),
|
|
2481
|
-
for (const
|
|
2482
|
-
if (
|
|
2483
|
-
if (
|
|
2484
|
-
const
|
|
2485
|
-
(
|
|
2486
|
-
|
|
2493
|
+
), a = [];
|
|
2494
|
+
for (const m of s) {
|
|
2495
|
+
if (a.length >= pi) break;
|
|
2496
|
+
if (pt(m) || !ht(m)) continue;
|
|
2497
|
+
const D = m.getAttribute("data-ll-region") ?? "", F = m.getAttribute("data-ll-intent") ?? void 0, K = de(
|
|
2498
|
+
(m.innerText || m.textContent || "").trim(),
|
|
2499
|
+
Ln * 2
|
|
2487
2500
|
);
|
|
2488
|
-
|
|
2501
|
+
!D || !K || a.push({ id: D, intent: F, text: K });
|
|
2489
2502
|
}
|
|
2490
|
-
const c = [],
|
|
2503
|
+
const c = [], d = ["H1", "H2", "H3", "H4", "H5", "H6"], v = Array.from(
|
|
2491
2504
|
r.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
|
2492
2505
|
);
|
|
2493
|
-
for (const
|
|
2494
|
-
if (
|
|
2495
|
-
const
|
|
2496
|
-
|
|
2506
|
+
for (const m of v) {
|
|
2507
|
+
if (pt(m) || !ht(m)) continue;
|
|
2508
|
+
const D = (m.textContent || "").trim();
|
|
2509
|
+
D && c.push(`${m.tagName}: ${de(D, 200)}`);
|
|
2497
2510
|
}
|
|
2498
|
-
const
|
|
2499
|
-
for (const
|
|
2500
|
-
if (
|
|
2501
|
-
const
|
|
2502
|
-
|
|
2511
|
+
const p = Array.from(r.querySelectorAll("p, li"));
|
|
2512
|
+
for (const m of p) {
|
|
2513
|
+
if (pt(m) || !ht(m) || d.includes(m.tagName)) continue;
|
|
2514
|
+
const D = (m.textContent || "").trim();
|
|
2515
|
+
D.length > 10 && c.push(de(D, Ln));
|
|
2503
2516
|
}
|
|
2504
2517
|
const h = c.join(`
|
|
2505
|
-
`), T = [],
|
|
2506
|
-
for (const
|
|
2507
|
-
if (T.length >=
|
|
2508
|
-
if (
|
|
2509
|
-
const
|
|
2510
|
-
|
|
2518
|
+
`), T = [], _ = Array.from(r.querySelectorAll("a[href]"));
|
|
2519
|
+
for (const m of _) {
|
|
2520
|
+
if (T.length >= di) break;
|
|
2521
|
+
if (pt(m) || !ht(m)) continue;
|
|
2522
|
+
const D = m.getAttribute("href") || "", F = (m.textContent || "").trim();
|
|
2523
|
+
!D || !F || T.push({ href: D, text: de(F, 100) });
|
|
2511
2524
|
}
|
|
2512
|
-
const
|
|
2525
|
+
const E = [], g = Array.from(
|
|
2513
2526
|
r.querySelectorAll(
|
|
2514
2527
|
"input, textarea, select"
|
|
2515
2528
|
)
|
|
2516
2529
|
);
|
|
2517
|
-
for (const
|
|
2518
|
-
if (
|
|
2519
|
-
if (
|
|
2520
|
-
const
|
|
2521
|
-
|
|
2530
|
+
for (const m of g) {
|
|
2531
|
+
if (E.length >= fi) break;
|
|
2532
|
+
if (pt(m) || !Ft(m) || !ht(m)) continue;
|
|
2533
|
+
const D = Cn(m), F = m instanceof HTMLInputElement ? m.type : m.tagName.toLowerCase();
|
|
2534
|
+
D && E.push({ label: de(D, 100), type: F });
|
|
2522
2535
|
}
|
|
2523
|
-
const
|
|
2524
|
-
let
|
|
2525
|
-
for (const
|
|
2526
|
-
if (
|
|
2527
|
-
if (
|
|
2528
|
-
const
|
|
2529
|
-
|
|
2536
|
+
const b = Array.from(r.querySelectorAll("form")), R = [];
|
|
2537
|
+
let k = 0;
|
|
2538
|
+
for (const m of b) {
|
|
2539
|
+
if (R.length >= hi) break;
|
|
2540
|
+
if (Ut(m) || m.matches(".ll-widget *, .ll-widget")) continue;
|
|
2541
|
+
const D = m.getAttribute("id") || m.getAttribute("name") || vi(m.getAttribute("data-ll-intent")) || `form_${k++}`, F = m.getAttribute("data-ll-intent") || bi(m) || void 0, K = Array.from(
|
|
2542
|
+
m.querySelectorAll(
|
|
2530
2543
|
"input, textarea, select"
|
|
2531
2544
|
)
|
|
2532
|
-
),
|
|
2533
|
-
let
|
|
2545
|
+
), oe = [];
|
|
2546
|
+
let z = 0;
|
|
2534
2547
|
const G = /* @__PURE__ */ new Set();
|
|
2535
|
-
for (const
|
|
2536
|
-
if (
|
|
2537
|
-
if (!
|
|
2538
|
-
if (
|
|
2539
|
-
const
|
|
2540
|
-
if (
|
|
2548
|
+
for (const f of K) {
|
|
2549
|
+
if (oe.length >= mi) break;
|
|
2550
|
+
if (!Ft(f)) continue;
|
|
2551
|
+
if (f instanceof HTMLInputElement) {
|
|
2552
|
+
const U = f.type;
|
|
2553
|
+
if (U === "submit" || U === "button" || U === "reset" || U === "hidden" || U === "image" || U === "file") continue;
|
|
2541
2554
|
}
|
|
2542
|
-
const
|
|
2543
|
-
let
|
|
2544
|
-
G.has(
|
|
2545
|
-
const X =
|
|
2546
|
-
name:
|
|
2547
|
-
label:
|
|
2555
|
+
const S = f.getAttribute("name") || "", O = f.getAttribute("id") || "";
|
|
2556
|
+
let q = S || O || `field_${z}`;
|
|
2557
|
+
G.has(q) && (q = `${q}__${z}`), G.add(q), z++;
|
|
2558
|
+
const X = Cn(f) || q, Q = f instanceof HTMLInputElement ? f.type : f.tagName.toLowerCase(), Y = {
|
|
2559
|
+
name: q,
|
|
2560
|
+
label: de(X, 100),
|
|
2548
2561
|
type: Q
|
|
2549
2562
|
};
|
|
2550
|
-
|
|
2551
|
-
const te =
|
|
2552
|
-
if (te && (Y.placeholder =
|
|
2553
|
-
const
|
|
2554
|
-
if (
|
|
2555
|
-
const ee = parseInt(
|
|
2563
|
+
f.required === !0 && (Y.required = !0);
|
|
2564
|
+
const te = f.getAttribute("placeholder");
|
|
2565
|
+
if (te && (Y.placeholder = de(te.trim(), 100)), f instanceof HTMLInputElement || f instanceof HTMLTextAreaElement) {
|
|
2566
|
+
const U = f.getAttribute("minlength");
|
|
2567
|
+
if (U !== null) {
|
|
2568
|
+
const ee = parseInt(U, 10);
|
|
2556
2569
|
!Number.isNaN(ee) && ee >= 0 && (Y.minLength = ee);
|
|
2557
2570
|
}
|
|
2558
|
-
const
|
|
2559
|
-
if (
|
|
2560
|
-
const ee = parseInt(
|
|
2571
|
+
const ge = f.getAttribute("maxlength");
|
|
2572
|
+
if (ge !== null) {
|
|
2573
|
+
const ee = parseInt(ge, 10);
|
|
2561
2574
|
!Number.isNaN(ee) && ee >= 0 && (Y.maxLength = ee);
|
|
2562
2575
|
}
|
|
2563
2576
|
}
|
|
2564
|
-
if (
|
|
2565
|
-
const
|
|
2566
|
-
|
|
2567
|
-
const
|
|
2568
|
-
|
|
2569
|
-
const ee =
|
|
2570
|
-
ee !== null && (Y.step =
|
|
2571
|
-
const
|
|
2572
|
-
|
|
2573
|
-
const ne = (
|
|
2574
|
-
ne && ne !== "off" && !ne.startsWith("cc-") && (Y.autocomplete =
|
|
2577
|
+
if (f instanceof HTMLInputElement) {
|
|
2578
|
+
const U = f.getAttribute("min");
|
|
2579
|
+
U !== null && (Y.min = de(U, 50));
|
|
2580
|
+
const ge = f.getAttribute("max");
|
|
2581
|
+
ge !== null && (Y.max = de(ge, 50));
|
|
2582
|
+
const ee = f.getAttribute("step");
|
|
2583
|
+
ee !== null && (Y.step = de(ee, 20));
|
|
2584
|
+
const ve = f.getAttribute("pattern");
|
|
2585
|
+
ve !== null && (Y.pattern = de(ve, 200));
|
|
2586
|
+
const ne = (f.getAttribute("autocomplete") || "").toLowerCase();
|
|
2587
|
+
ne && ne !== "off" && !ne.startsWith("cc-") && (Y.autocomplete = de(ne, 50));
|
|
2575
2588
|
}
|
|
2576
|
-
if (
|
|
2577
|
-
const
|
|
2578
|
-
for (let
|
|
2579
|
-
const ee =
|
|
2589
|
+
if (f instanceof HTMLSelectElement) {
|
|
2590
|
+
const U = [];
|
|
2591
|
+
for (let ge = 0; ge < f.options.length && !(U.length >= gi); ge++) {
|
|
2592
|
+
const ee = f.options[ge];
|
|
2580
2593
|
if (!ee || ee.disabled) continue;
|
|
2581
|
-
const
|
|
2582
|
-
!
|
|
2594
|
+
const ve = ee.value || "", ne = (ee.textContent || "").trim() || ve;
|
|
2595
|
+
!ve && !ne || U.push({ value: ve, label: de(ne, 60) });
|
|
2583
2596
|
}
|
|
2584
|
-
|
|
2597
|
+
U.length > 0 && (Y.options = U);
|
|
2585
2598
|
}
|
|
2586
|
-
const
|
|
2587
|
-
|
|
2599
|
+
const ie = typeof f.validationMessage == "string" ? f.validationMessage : "";
|
|
2600
|
+
ie && (Y.validationMessage = de(ie, 200)), oe.push(Y);
|
|
2588
2601
|
}
|
|
2589
|
-
|
|
2602
|
+
R.push({ id: D, intent: F, fields: oe });
|
|
2590
2603
|
}
|
|
2591
|
-
const
|
|
2604
|
+
const y = {
|
|
2592
2605
|
url: i,
|
|
2593
2606
|
title: o,
|
|
2594
|
-
pathname:
|
|
2595
|
-
regions:
|
|
2607
|
+
pathname: l,
|
|
2608
|
+
regions: a,
|
|
2596
2609
|
visibleText: h,
|
|
2597
2610
|
visibleLinks: T,
|
|
2598
|
-
visibleFields:
|
|
2599
|
-
forms:
|
|
2611
|
+
visibleFields: E,
|
|
2612
|
+
forms: R,
|
|
2600
2613
|
extras: e
|
|
2601
2614
|
};
|
|
2602
|
-
let
|
|
2603
|
-
for (;
|
|
2604
|
-
|
|
2605
|
-
for (;
|
|
2606
|
-
|
|
2607
|
-
return
|
|
2615
|
+
let H = Qe(JSON.stringify(y.regions)) + Qe(y.visibleText) + Qe(JSON.stringify(y.visibleLinks)) + Qe(JSON.stringify(y.visibleFields));
|
|
2616
|
+
for (; H > kt && y.visibleFields.length > 0; )
|
|
2617
|
+
y.visibleFields.pop(), H = Qe(JSON.stringify(y.visibleFields));
|
|
2618
|
+
for (; H > kt && y.visibleLinks.length > 0; )
|
|
2619
|
+
y.visibleLinks.pop(), H -= 80;
|
|
2620
|
+
return Qe(y.visibleText) > kt && (y.visibleText = de(y.visibleText, kt - 100)), y;
|
|
2608
2621
|
}
|
|
2609
|
-
let
|
|
2610
|
-
function
|
|
2611
|
-
const r = Date.now(),
|
|
2612
|
-
if (
|
|
2613
|
-
return
|
|
2614
|
-
const o =
|
|
2615
|
-
return
|
|
2622
|
+
let et = null;
|
|
2623
|
+
function kn(e, t = {}) {
|
|
2624
|
+
const r = Date.now(), l = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
|
|
2625
|
+
if (et && et.key === l && r - et.at < 1e3)
|
|
2626
|
+
return et.ctx;
|
|
2627
|
+
const o = wi(e, t);
|
|
2628
|
+
return et = { key: l, at: r, ctx: o }, o;
|
|
2616
2629
|
}
|
|
2617
2630
|
function _i() {
|
|
2618
|
-
|
|
2631
|
+
et = null;
|
|
2619
2632
|
}
|
|
2620
2633
|
const xi = 200;
|
|
2621
2634
|
function Li(e) {
|
|
@@ -2634,41 +2647,41 @@ function Ci(e) {
|
|
|
2634
2647
|
function ki(e) {
|
|
2635
2648
|
const t = e ?? (typeof document < "u" ? document : null);
|
|
2636
2649
|
if (!t) return [];
|
|
2637
|
-
const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(),
|
|
2650
|
+
const r = typeof window < "u" && window.location.origin || "", i = /* @__PURE__ */ new Set(), l = [], o = Array.from(t.querySelectorAll("a[href]"));
|
|
2638
2651
|
for (const s of o) {
|
|
2639
|
-
if (
|
|
2640
|
-
if (
|
|
2641
|
-
const
|
|
2642
|
-
if (!Ci(
|
|
2643
|
-
let c =
|
|
2652
|
+
if (l.length >= xi) break;
|
|
2653
|
+
if (Ut(s)) continue;
|
|
2654
|
+
const a = s.getAttribute("href") || "";
|
|
2655
|
+
if (!Ci(a)) continue;
|
|
2656
|
+
let c = a, d = !0;
|
|
2644
2657
|
try {
|
|
2645
2658
|
if (typeof window < "u") {
|
|
2646
|
-
const
|
|
2647
|
-
|
|
2659
|
+
const p = new URL(a, r);
|
|
2660
|
+
d = p.origin === r, d && a.startsWith("http") && (c = p.pathname + p.search + p.hash);
|
|
2648
2661
|
}
|
|
2649
2662
|
} catch {
|
|
2650
2663
|
continue;
|
|
2651
2664
|
}
|
|
2652
2665
|
if (i.has(c)) continue;
|
|
2653
2666
|
i.add(c);
|
|
2654
|
-
const
|
|
2655
|
-
|
|
2667
|
+
const v = (s.textContent || "").trim().slice(0, 120);
|
|
2668
|
+
l.push({ href: c, text: v, internal: d });
|
|
2656
2669
|
}
|
|
2657
|
-
return
|
|
2670
|
+
return l;
|
|
2658
2671
|
}
|
|
2659
|
-
let
|
|
2672
|
+
let tt = null;
|
|
2660
2673
|
const Ei = 5e3;
|
|
2661
|
-
function
|
|
2674
|
+
function Ot() {
|
|
2662
2675
|
const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
|
|
2663
|
-
if (
|
|
2664
|
-
return
|
|
2676
|
+
if (tt && tt.pathname === t && e - tt.at < Ei)
|
|
2677
|
+
return tt.routes;
|
|
2665
2678
|
const r = ki();
|
|
2666
|
-
return
|
|
2679
|
+
return tt = { at: e, pathname: t, routes: r }, r;
|
|
2667
2680
|
}
|
|
2668
2681
|
function Si() {
|
|
2669
|
-
|
|
2682
|
+
tt = null;
|
|
2670
2683
|
}
|
|
2671
|
-
function
|
|
2684
|
+
function En(e) {
|
|
2672
2685
|
if (e instanceof HTMLInputElement) {
|
|
2673
2686
|
const t = e.type;
|
|
2674
2687
|
if (t === "submit" || t === "button" || t === "reset" || t === "hidden" || t === "image" || t === "file")
|
|
@@ -2685,44 +2698,44 @@ function Ai(e, t) {
|
|
|
2685
2698
|
const o = e.querySelector(
|
|
2686
2699
|
`[name="${t.replace(/"/g, '\\"')}"]`
|
|
2687
2700
|
);
|
|
2688
|
-
if (o &&
|
|
2701
|
+
if (o && En(o)) return o;
|
|
2689
2702
|
} catch {
|
|
2690
2703
|
}
|
|
2691
2704
|
const r = Array.from(
|
|
2692
2705
|
e.querySelectorAll("input, textarea, select")
|
|
2693
2706
|
);
|
|
2694
2707
|
let i = 0;
|
|
2695
|
-
const
|
|
2708
|
+
const l = /* @__PURE__ */ new Map();
|
|
2696
2709
|
for (const o of r) {
|
|
2697
|
-
if (!
|
|
2710
|
+
if (!En(o)) continue;
|
|
2698
2711
|
const s = Ni(o, i);
|
|
2699
|
-
let
|
|
2700
|
-
if (
|
|
2701
|
-
|
|
2712
|
+
let a = s;
|
|
2713
|
+
if (l.has(s) && (a = `${s}__${i}`), a === t) return o;
|
|
2714
|
+
l.set(s, o), i++;
|
|
2702
2715
|
}
|
|
2703
2716
|
return null;
|
|
2704
2717
|
}
|
|
2705
|
-
function
|
|
2718
|
+
function Sn(e, t) {
|
|
2706
2719
|
const r = Ai(e, t);
|
|
2707
|
-
return r ?
|
|
2720
|
+
return r ? Ft(r) ? { el: r } : { el: null, reason: "private" } : { el: null, reason: "not_found" };
|
|
2708
2721
|
}
|
|
2709
2722
|
function Mi(e, t) {
|
|
2710
|
-
const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, i = Object.getOwnPropertyDescriptor(r, "value"),
|
|
2711
|
-
|
|
2723
|
+
const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, i = Object.getOwnPropertyDescriptor(r, "value"), l = i == null ? void 0 : i.set;
|
|
2724
|
+
l ? l.call(e, t) : e.value = t;
|
|
2712
2725
|
}
|
|
2713
2726
|
function Ii(e, t, r = {}) {
|
|
2714
|
-
const i = r.triggerInput ?? !0,
|
|
2727
|
+
const i = r.triggerInput ?? !0, l = r.triggerChange ?? !0;
|
|
2715
2728
|
if (e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio")) {
|
|
2716
2729
|
const o = Object.getOwnPropertyDescriptor(
|
|
2717
2730
|
HTMLInputElement.prototype,
|
|
2718
2731
|
"checked"
|
|
2719
|
-
), s = o == null ? void 0 : o.set,
|
|
2720
|
-
s ? s.call(e,
|
|
2732
|
+
), s = o == null ? void 0 : o.set, a = t === "true" || t === "1" || t === "on";
|
|
2733
|
+
s ? s.call(e, a) : e.checked = a, i && e.dispatchEvent(new Event("input", { bubbles: !0 })), l && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
2721
2734
|
return;
|
|
2722
2735
|
}
|
|
2723
|
-
Mi(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })),
|
|
2736
|
+
Mi(e, t), i && e.dispatchEvent(new Event("input", { bubbles: !0 })), l && e.dispatchEvent(new Event("change", { bubbles: !0 }));
|
|
2724
2737
|
}
|
|
2725
|
-
function
|
|
2738
|
+
function Nn(e, t) {
|
|
2726
2739
|
if (!t) return null;
|
|
2727
2740
|
const r = t.replace(/"/g, '\\"');
|
|
2728
2741
|
try {
|
|
@@ -2736,22 +2749,22 @@ function Sn(e, t) {
|
|
|
2736
2749
|
`form[name="${r}"]`
|
|
2737
2750
|
);
|
|
2738
2751
|
if (i) return i;
|
|
2739
|
-
const
|
|
2752
|
+
const l = e.querySelector(
|
|
2740
2753
|
`form[data-ll-intent="${r}"]`
|
|
2741
2754
|
);
|
|
2742
|
-
if (
|
|
2755
|
+
if (l) return l;
|
|
2743
2756
|
const o = Array.from(e.querySelectorAll("form"));
|
|
2744
2757
|
for (const s of o) {
|
|
2745
|
-
const
|
|
2746
|
-
if (
|
|
2758
|
+
const a = s.getAttribute("data-ll-intent");
|
|
2759
|
+
if (a && Ri(a) === t) return s;
|
|
2747
2760
|
}
|
|
2748
2761
|
if (/^form_\d+$/.test(t)) {
|
|
2749
2762
|
const s = parseInt(t.slice(5), 10);
|
|
2750
|
-
let
|
|
2763
|
+
let a = 0;
|
|
2751
2764
|
for (const c of o)
|
|
2752
2765
|
if (!(c.id || c.getAttribute("name") || c.getAttribute("data-ll-intent"))) {
|
|
2753
|
-
if (
|
|
2754
|
-
|
|
2766
|
+
if (a === s) return c;
|
|
2767
|
+
a++;
|
|
2755
2768
|
}
|
|
2756
2769
|
}
|
|
2757
2770
|
return null;
|
|
@@ -2780,9 +2793,9 @@ function Di() {
|
|
|
2780
2793
|
let t = null, r = 0;
|
|
2781
2794
|
for (const i of e) {
|
|
2782
2795
|
if (!Pi(i)) continue;
|
|
2783
|
-
const
|
|
2784
|
-
if (
|
|
2785
|
-
const o =
|
|
2796
|
+
const l = i.getBoundingClientRect();
|
|
2797
|
+
if (l.bottom <= 0 || l.top >= window.innerHeight || l.right <= 0 || l.left >= window.innerWidth || l.width <= 0 || l.height <= 0 || i.closest(".ll-widget")) continue;
|
|
2798
|
+
const o = l.width * l.height;
|
|
2786
2799
|
o > r && (r = o, t = i);
|
|
2787
2800
|
}
|
|
2788
2801
|
return t;
|
|
@@ -2794,7 +2807,7 @@ function zi() {
|
|
|
2794
2807
|
const e = Di();
|
|
2795
2808
|
return e || window;
|
|
2796
2809
|
}
|
|
2797
|
-
function
|
|
2810
|
+
function An(e) {
|
|
2798
2811
|
return e instanceof Window ? e.innerHeight || 0 : e.clientHeight || 0;
|
|
2799
2812
|
}
|
|
2800
2813
|
function $i(e) {
|
|
@@ -2834,19 +2847,19 @@ const Hi = /* @__PURE__ */ new Set([
|
|
|
2834
2847
|
// to onAgentCommand.
|
|
2835
2848
|
"task_field_updated",
|
|
2836
2849
|
"task_completed"
|
|
2837
|
-
]),
|
|
2850
|
+
]), Fn = Bt(
|
|
2838
2851
|
function(t, r) {
|
|
2839
|
-
var
|
|
2852
|
+
var nn, rn, on, ln, an, sn, cn;
|
|
2840
2853
|
const {
|
|
2841
2854
|
agentId: i,
|
|
2842
|
-
apiKey:
|
|
2855
|
+
apiKey: l,
|
|
2843
2856
|
baseUrl: o = "https://app.livelayer.studio",
|
|
2844
2857
|
sessionEndpoint: s,
|
|
2845
|
-
sessionBody:
|
|
2858
|
+
sessionBody: a,
|
|
2846
2859
|
soundEffects: c,
|
|
2847
|
-
experienceMode:
|
|
2848
|
-
autoConnect:
|
|
2849
|
-
displayMode:
|
|
2860
|
+
experienceMode: d = "WIDGET",
|
|
2861
|
+
autoConnect: v = !1,
|
|
2862
|
+
displayMode: p,
|
|
2850
2863
|
// Initial display mode. Mobile gets a smaller card layout (not the
|
|
2851
2864
|
// full-screen sheet) so "expanded" is the right default on every
|
|
2852
2865
|
// viewport — the prior 0.15.1-0.15.3 mobile-flip-to-minimized
|
|
@@ -2856,149 +2869,149 @@ const Hi = /* @__PURE__ */ new Set([
|
|
|
2856
2869
|
// .ll-expanded--mobile in styles.css.
|
|
2857
2870
|
defaultDisplayMode: h = "expanded",
|
|
2858
2871
|
onDisplayModeChange: T,
|
|
2859
|
-
position:
|
|
2860
|
-
mobileBreakpoint:
|
|
2861
|
-
draggable:
|
|
2862
|
-
resizable:
|
|
2863
|
-
persistKey:
|
|
2864
|
-
disablePersistence:
|
|
2865
|
-
teamMembers:
|
|
2866
|
-
currentTeamMemberId:
|
|
2867
|
-
onTeamMemberChange:
|
|
2868
|
-
idleLoopUrl:
|
|
2869
|
-
greeting:
|
|
2872
|
+
position: _ = "bottom-right",
|
|
2873
|
+
mobileBreakpoint: E = 640,
|
|
2874
|
+
draggable: g,
|
|
2875
|
+
resizable: b,
|
|
2876
|
+
persistKey: R = "ll-widget",
|
|
2877
|
+
disablePersistence: k = !1,
|
|
2878
|
+
teamMembers: y,
|
|
2879
|
+
currentTeamMemberId: H,
|
|
2880
|
+
onTeamMemberChange: m,
|
|
2881
|
+
idleLoopUrl: D,
|
|
2882
|
+
greeting: F,
|
|
2870
2883
|
avatarImageUrl: K,
|
|
2871
|
-
agentName:
|
|
2872
|
-
branding:
|
|
2884
|
+
agentName: oe,
|
|
2885
|
+
branding: z = {},
|
|
2873
2886
|
allowCamera: G = !0,
|
|
2874
|
-
allowScreenShare:
|
|
2875
|
-
allowTyping:
|
|
2876
|
-
showMinimize:
|
|
2877
|
-
showClose:
|
|
2887
|
+
allowScreenShare: f = !0,
|
|
2888
|
+
allowTyping: S = !0,
|
|
2889
|
+
showMinimize: O,
|
|
2890
|
+
showClose: q,
|
|
2878
2891
|
chromeless: X = !1,
|
|
2879
2892
|
floatingChromeContainer: Q = null,
|
|
2880
2893
|
compactControls: Y = !1,
|
|
2881
2894
|
transforming: te = !1,
|
|
2882
|
-
transformingLabel:
|
|
2883
|
-
showOn:
|
|
2884
|
-
hideOn:
|
|
2895
|
+
transformingLabel: ie = "Transforming…",
|
|
2896
|
+
showOn: U,
|
|
2897
|
+
hideOn: ge,
|
|
2885
2898
|
pathname: ee,
|
|
2886
|
-
onNavigate:
|
|
2899
|
+
onNavigate: ve,
|
|
2887
2900
|
onScrollToSelector: ne,
|
|
2888
|
-
getPageContext:
|
|
2889
|
-
pageContextExtras:
|
|
2890
|
-
getRoutes:
|
|
2891
|
-
onScrollPage:
|
|
2892
|
-
onClick:
|
|
2893
|
-
capabilities:
|
|
2901
|
+
getPageContext: rt,
|
|
2902
|
+
pageContextExtras: it,
|
|
2903
|
+
getRoutes: mt,
|
|
2904
|
+
onScrollPage: gt,
|
|
2905
|
+
onClick: ot,
|
|
2906
|
+
capabilities: lt,
|
|
2894
2907
|
onConnect: Me,
|
|
2895
|
-
onDisconnect:
|
|
2908
|
+
onDisconnect: Fe,
|
|
2896
2909
|
onTranscript: Ie,
|
|
2897
2910
|
onAgentState: Re,
|
|
2898
2911
|
onConnectionStateChange: Te,
|
|
2899
2912
|
onAgentEvent: Pe,
|
|
2900
2913
|
onAgentCommand: De,
|
|
2901
|
-
onCollect:
|
|
2902
|
-
controlledSession:
|
|
2903
|
-
className:
|
|
2914
|
+
onCollect: Be,
|
|
2915
|
+
controlledSession: W,
|
|
2916
|
+
className: qe,
|
|
2904
2917
|
style: ze,
|
|
2905
|
-
zIndex:
|
|
2906
|
-
} = t, be = zr(ee),
|
|
2918
|
+
zIndex: Ue = 2147483647
|
|
2919
|
+
} = t, be = zr(ee), at = qr(be, U, ge);
|
|
2907
2920
|
P(() => {
|
|
2908
2921
|
_i(), Si();
|
|
2909
2922
|
}, [be]);
|
|
2910
|
-
const $e =
|
|
2923
|
+
const $e = H !== void 0, [je, St] = M(() => {
|
|
2911
2924
|
var x;
|
|
2912
|
-
return
|
|
2913
|
-
}),
|
|
2914
|
-
() => (
|
|
2915
|
-
[
|
|
2916
|
-
),
|
|
2917
|
-
value:
|
|
2925
|
+
return H ?? ((x = y == null ? void 0 : y[0]) == null ? void 0 : x.id);
|
|
2926
|
+
}), Ne = $e ? H : je, fe = nt(
|
|
2927
|
+
() => (y == null ? void 0 : y.find((x) => x.id === Ne)) ?? null,
|
|
2928
|
+
[y, Ne]
|
|
2929
|
+
), st = (fe == null ? void 0 : fe.agentId) ?? i, ce = d === "EMBEDDED", pe = Nr(E), [Ve, Ye] = Er({
|
|
2930
|
+
value: p,
|
|
2918
2931
|
defaultValue: h,
|
|
2919
2932
|
onChange: T,
|
|
2920
|
-
persistKey:
|
|
2921
|
-
disablePersistence: ce ||
|
|
2922
|
-
}),
|
|
2923
|
-
} :
|
|
2924
|
-
draggable: !ce && (
|
|
2925
|
-
resizable: !ce && (
|
|
2926
|
-
persistKey:
|
|
2927
|
-
disablePersistence: ce ||
|
|
2928
|
-
}), He = hr(),
|
|
2929
|
-
|
|
2930
|
-
const
|
|
2931
|
-
|
|
2933
|
+
persistKey: R,
|
|
2934
|
+
disablePersistence: ce || k
|
|
2935
|
+
}), he = ce ? "expanded" : Ve, we = ce ? () => {
|
|
2936
|
+
} : Ye, yt = O ?? !ce, vt = q ?? !ce, Nt = Y || !ce && pe, Ee = Pr({
|
|
2937
|
+
draggable: !ce && (g ?? !pe),
|
|
2938
|
+
resizable: !ce && (b ?? !pe),
|
|
2939
|
+
persistKey: R,
|
|
2940
|
+
disablePersistence: ce || k
|
|
2941
|
+
}), He = hr(), _e = vr(), Oe = br(), xe = wr(), [Ae, Ge] = M(!1), [Xe, bt] = M(!1), [Ke, w] = M(!1), [le, Bn] = M(!1), [At, qn] = M(!1), wt = jr({ baseUrl: o, config: c }), _t = I(wt);
|
|
2942
|
+
_t.current = wt;
|
|
2943
|
+
const Mt = I(ve), It = I(ne), Rt = I(gt), Tt = I(ot), Vt = I(rt), Yt = I(it), Gt = I(mt), Pt = I(lt), Le = I(null);
|
|
2944
|
+
Mt.current = ve, It.current = ne, Rt.current = gt, Tt.current = ot, Vt.current = rt, Yt.current = it, Gt.current = mt, Pt.current = lt;
|
|
2932
2945
|
function Ce(x) {
|
|
2933
|
-
const
|
|
2934
|
-
return
|
|
2946
|
+
const u = Pt.current;
|
|
2947
|
+
return u ? u.includes(x) : !0;
|
|
2935
2948
|
}
|
|
2936
|
-
function ke(x,
|
|
2949
|
+
function ke(x, u) {
|
|
2937
2950
|
console.warn(
|
|
2938
|
-
`[LiveLayer] Agent command "${x}" blocked — capability "${
|
|
2951
|
+
`[LiveLayer] Agent command "${x}" blocked — capability "${u}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
|
|
2939
2952
|
);
|
|
2940
2953
|
}
|
|
2941
|
-
const
|
|
2954
|
+
const ut = L(
|
|
2942
2955
|
(x) => {
|
|
2943
|
-
var
|
|
2944
|
-
const
|
|
2945
|
-
if (!(!
|
|
2946
|
-
if (Pe == null || Pe({ eventName:
|
|
2956
|
+
var re, ue, Se, ft;
|
|
2957
|
+
const u = x;
|
|
2958
|
+
if (!(!u.type || typeof u.type != "string")) {
|
|
2959
|
+
if (Pe == null || Pe({ eventName: u.type, data: x }), u.type === "navigate") {
|
|
2947
2960
|
if (!Ce("navigate")) {
|
|
2948
2961
|
ke("navigate", "navigate");
|
|
2949
2962
|
return;
|
|
2950
2963
|
}
|
|
2951
|
-
const
|
|
2952
|
-
if (!
|
|
2964
|
+
const A = typeof u.href == "string" ? u.href : null;
|
|
2965
|
+
if (!A) {
|
|
2953
2966
|
console.warn(
|
|
2954
2967
|
`[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
|
|
2955
2968
|
);
|
|
2956
2969
|
return;
|
|
2957
2970
|
}
|
|
2958
|
-
if (
|
|
2971
|
+
if (_t.current.playPageChange(), Mt.current) {
|
|
2959
2972
|
try {
|
|
2960
|
-
|
|
2961
|
-
} catch (
|
|
2973
|
+
Mt.current(A);
|
|
2974
|
+
} catch ($) {
|
|
2962
2975
|
console.warn(
|
|
2963
|
-
`[LiveLayer] onNavigate threw for "${
|
|
2964
|
-
|
|
2976
|
+
`[LiveLayer] onNavigate threw for "${A}". Falling back. Error:`,
|
|
2977
|
+
$
|
|
2965
2978
|
);
|
|
2966
2979
|
}
|
|
2967
2980
|
return;
|
|
2968
2981
|
}
|
|
2969
2982
|
if (typeof document < "u") {
|
|
2970
|
-
const
|
|
2971
|
-
`a[href="${
|
|
2983
|
+
const $ = document.querySelector(
|
|
2984
|
+
`a[href="${A.replace(/"/g, '\\"')}"]`
|
|
2972
2985
|
);
|
|
2973
|
-
if (
|
|
2974
|
-
|
|
2986
|
+
if ($) {
|
|
2987
|
+
$.click();
|
|
2975
2988
|
return;
|
|
2976
2989
|
}
|
|
2977
2990
|
}
|
|
2978
2991
|
if (typeof window < "u" && typeof history < "u")
|
|
2979
2992
|
try {
|
|
2980
|
-
history.pushState({}, "",
|
|
2981
|
-
} catch (
|
|
2993
|
+
history.pushState({}, "", A), window.dispatchEvent(new PopStateEvent("popstate"));
|
|
2994
|
+
} catch ($) {
|
|
2982
2995
|
console.warn(
|
|
2983
|
-
`[LiveLayer] history.pushState fallback failed for "${
|
|
2984
|
-
|
|
2996
|
+
`[LiveLayer] history.pushState fallback failed for "${A}". Pass an onNavigate prop to use your router directly. See https://livelayer.studio/docs/react/navigation`,
|
|
2997
|
+
$
|
|
2985
2998
|
);
|
|
2986
2999
|
}
|
|
2987
3000
|
return;
|
|
2988
3001
|
}
|
|
2989
|
-
if (
|
|
3002
|
+
if (u.type === "scroll_to") {
|
|
2990
3003
|
if (!Ce("scroll")) {
|
|
2991
3004
|
ke("scroll_to", "scroll");
|
|
2992
3005
|
return;
|
|
2993
3006
|
}
|
|
2994
|
-
const
|
|
2995
|
-
if (!
|
|
2996
|
-
const
|
|
2997
|
-
if (
|
|
3007
|
+
const A = typeof u.selector == "string" ? u.selector : null;
|
|
3008
|
+
if (!A) return;
|
|
3009
|
+
const $ = u.behavior === "instant" ? "instant" : "smooth";
|
|
3010
|
+
if (It.current) {
|
|
2998
3011
|
try {
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3012
|
+
It.current(
|
|
3013
|
+
A,
|
|
3014
|
+
$
|
|
3002
3015
|
);
|
|
3003
3016
|
} catch (V) {
|
|
3004
3017
|
console.warn("[LiveLayer] onScrollToSelector threw.", V);
|
|
@@ -3008,52 +3021,52 @@ const Hi = /* @__PURE__ */ new Set([
|
|
|
3008
3021
|
if (typeof document < "u") {
|
|
3009
3022
|
let V = null;
|
|
3010
3023
|
try {
|
|
3011
|
-
V = document.querySelector(
|
|
3024
|
+
V = document.querySelector(A);
|
|
3012
3025
|
} catch {
|
|
3013
3026
|
console.warn(
|
|
3014
|
-
`[LiveLayer] scroll_to: invalid selector "${
|
|
3027
|
+
`[LiveLayer] scroll_to: invalid selector "${A}".`
|
|
3015
3028
|
);
|
|
3016
3029
|
return;
|
|
3017
3030
|
}
|
|
3018
3031
|
if (!V) {
|
|
3019
3032
|
console.warn(
|
|
3020
|
-
`[LiveLayer] scroll_to: no element matched "${
|
|
3033
|
+
`[LiveLayer] scroll_to: no element matched "${A}". The user may be on a different page. See https://livelayer.studio/docs/errors/scroll-no-match`
|
|
3021
3034
|
);
|
|
3022
3035
|
return;
|
|
3023
3036
|
}
|
|
3024
3037
|
V.scrollIntoView({
|
|
3025
|
-
behavior:
|
|
3038
|
+
behavior: $,
|
|
3026
3039
|
block: "start"
|
|
3027
3040
|
});
|
|
3028
3041
|
}
|
|
3029
3042
|
return;
|
|
3030
3043
|
}
|
|
3031
|
-
if (
|
|
3044
|
+
if (u.type === "request_page_context") {
|
|
3032
3045
|
if (!Ce("read_page")) {
|
|
3033
3046
|
ke("request_page_context", "read_page");
|
|
3034
3047
|
return;
|
|
3035
3048
|
}
|
|
3036
|
-
const
|
|
3037
|
-
const
|
|
3049
|
+
const A = typeof u.requestId == "string" ? u.requestId : void 0, $ = (re = Le.current) == null ? void 0 : re.call(Le), V = (Z) => {
|
|
3050
|
+
const B = $, se = B == null ? void 0 : B.localParticipant;
|
|
3038
3051
|
if (se != null && se.publishData)
|
|
3039
3052
|
try {
|
|
3040
|
-
const
|
|
3041
|
-
se.publishData(
|
|
3042
|
-
} catch (
|
|
3043
|
-
console.warn("[LiveLayer] publishData failed.",
|
|
3053
|
+
const me = A ? { ...Z, requestId: A } : Z, Ze = new TextEncoder().encode(JSON.stringify(me));
|
|
3054
|
+
se.publishData(Ze, { reliable: !0 });
|
|
3055
|
+
} catch (me) {
|
|
3056
|
+
console.warn("[LiveLayer] publishData failed.", me);
|
|
3044
3057
|
}
|
|
3045
|
-
},
|
|
3058
|
+
}, j = Yt.current, J = Vt.current;
|
|
3046
3059
|
try {
|
|
3047
3060
|
if (J) {
|
|
3048
|
-
const Z = J(
|
|
3061
|
+
const Z = J(j);
|
|
3049
3062
|
if (Z instanceof Promise) {
|
|
3050
|
-
V({ type: "page_context_pending" }), Z.then((
|
|
3063
|
+
V({ type: "page_context_pending" }), Z.then((B) => V({ type: "page_context", context: B })).catch((B) => {
|
|
3051
3064
|
console.warn(
|
|
3052
3065
|
"[LiveLayer] getPageContext rejected; falling back to default walker.",
|
|
3053
|
-
|
|
3066
|
+
B
|
|
3054
3067
|
), V({
|
|
3055
3068
|
type: "page_context",
|
|
3056
|
-
context:
|
|
3069
|
+
context: kn(j)
|
|
3057
3070
|
});
|
|
3058
3071
|
});
|
|
3059
3072
|
return;
|
|
@@ -3063,7 +3076,7 @@ const Hi = /* @__PURE__ */ new Set([
|
|
|
3063
3076
|
}
|
|
3064
3077
|
V({
|
|
3065
3078
|
type: "page_context",
|
|
3066
|
-
context:
|
|
3079
|
+
context: kn(j)
|
|
3067
3080
|
});
|
|
3068
3081
|
} catch (Z) {
|
|
3069
3082
|
console.warn(
|
|
@@ -3071,291 +3084,291 @@ const Hi = /* @__PURE__ */ new Set([
|
|
|
3071
3084
|
Z
|
|
3072
3085
|
), V({
|
|
3073
3086
|
type: "page_context",
|
|
3074
|
-
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras:
|
|
3087
|
+
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: j }
|
|
3075
3088
|
});
|
|
3076
3089
|
}
|
|
3077
3090
|
return;
|
|
3078
3091
|
}
|
|
3079
|
-
if (
|
|
3092
|
+
if (u.type === "scroll_page") {
|
|
3080
3093
|
if (!Ce("scroll")) {
|
|
3081
3094
|
ke("scroll_page", "scroll");
|
|
3082
3095
|
return;
|
|
3083
3096
|
}
|
|
3084
|
-
const
|
|
3085
|
-
if (
|
|
3097
|
+
const A = u.direction;
|
|
3098
|
+
if (A !== "up" && A !== "down" && A !== "top" && A !== "bottom") {
|
|
3086
3099
|
console.warn(
|
|
3087
|
-
`[LiveLayer] scroll_page: invalid direction "${String(
|
|
3100
|
+
`[LiveLayer] scroll_page: invalid direction "${String(A)}". Expected up | down | top | bottom.`
|
|
3088
3101
|
);
|
|
3089
3102
|
return;
|
|
3090
3103
|
}
|
|
3091
|
-
const
|
|
3092
|
-
if (
|
|
3104
|
+
const $ = u.behavior === "instant" ? "instant" : "smooth";
|
|
3105
|
+
if (Rt.current) {
|
|
3093
3106
|
try {
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3107
|
+
Rt.current(
|
|
3108
|
+
A,
|
|
3109
|
+
$
|
|
3097
3110
|
);
|
|
3098
|
-
} catch (
|
|
3099
|
-
console.warn("[LiveLayer] onScrollPage threw.",
|
|
3111
|
+
} catch (B) {
|
|
3112
|
+
console.warn("[LiveLayer] onScrollPage threw.", B);
|
|
3100
3113
|
}
|
|
3101
3114
|
return;
|
|
3102
3115
|
}
|
|
3103
3116
|
if (typeof window > "u") return;
|
|
3104
|
-
const V = { behavior:
|
|
3105
|
-
|
|
3106
|
-
}, Z = (
|
|
3107
|
-
|
|
3117
|
+
const V = { behavior: $ }, j = zi(), J = (B) => {
|
|
3118
|
+
j instanceof Window ? j.scrollBy({ top: B, ...V }) : j.scrollBy({ top: B, ...V });
|
|
3119
|
+
}, Z = (B) => {
|
|
3120
|
+
j instanceof Window ? j.scrollTo({ top: B, ...V }) : j.scrollTo({ top: B, ...V });
|
|
3108
3121
|
};
|
|
3109
|
-
|
|
3122
|
+
A === "up" ? J(-An(j)) : A === "down" ? J(An(j)) : Z(A === "top" ? 0 : $i(j));
|
|
3110
3123
|
return;
|
|
3111
3124
|
}
|
|
3112
|
-
if (
|
|
3125
|
+
if (u.type === "click") {
|
|
3113
3126
|
if (!Ce("click")) {
|
|
3114
3127
|
ke("click", "click");
|
|
3115
3128
|
return;
|
|
3116
3129
|
}
|
|
3117
|
-
const
|
|
3118
|
-
if (!
|
|
3130
|
+
const A = typeof u.selector == "string" ? u.selector : null;
|
|
3131
|
+
if (!A) {
|
|
3119
3132
|
console.warn("[LiveLayer] click: missing selector.");
|
|
3120
3133
|
return;
|
|
3121
3134
|
}
|
|
3122
|
-
if (
|
|
3135
|
+
if (Tt.current) {
|
|
3123
3136
|
try {
|
|
3124
|
-
|
|
3137
|
+
Tt.current(A);
|
|
3125
3138
|
} catch (V) {
|
|
3126
3139
|
console.warn("[LiveLayer] onClick threw.", V);
|
|
3127
3140
|
}
|
|
3128
3141
|
return;
|
|
3129
3142
|
}
|
|
3130
3143
|
if (typeof document > "u") return;
|
|
3131
|
-
let
|
|
3144
|
+
let $ = null;
|
|
3132
3145
|
try {
|
|
3133
|
-
|
|
3146
|
+
$ = document.querySelector(A);
|
|
3134
3147
|
} catch {
|
|
3135
3148
|
console.warn(
|
|
3136
|
-
`[LiveLayer] click: invalid selector "${
|
|
3149
|
+
`[LiveLayer] click: invalid selector "${A}".`
|
|
3137
3150
|
);
|
|
3138
3151
|
return;
|
|
3139
3152
|
}
|
|
3140
|
-
if (
|
|
3153
|
+
if (!$) {
|
|
3141
3154
|
console.warn(
|
|
3142
|
-
`[LiveLayer] click: no element matched "${
|
|
3155
|
+
`[LiveLayer] click: no element matched "${A}". See https://livelayer.studio/docs/errors/click-no-match`
|
|
3143
3156
|
);
|
|
3144
3157
|
return;
|
|
3145
3158
|
}
|
|
3146
|
-
if (
|
|
3159
|
+
if ($.closest('[data-ll-private="true"], .ll-widget')) {
|
|
3147
3160
|
console.warn(
|
|
3148
3161
|
"[LiveLayer] click: refusing to click element inside a private subtree."
|
|
3149
3162
|
);
|
|
3150
3163
|
return;
|
|
3151
3164
|
}
|
|
3152
|
-
(ue =
|
|
3165
|
+
(ue = $.click) == null || ue.call($);
|
|
3153
3166
|
return;
|
|
3154
3167
|
}
|
|
3155
|
-
if (
|
|
3168
|
+
if (u.type === "fill_form" || u.type === "focus_field") {
|
|
3156
3169
|
if (!Ce("fill_forms")) {
|
|
3157
|
-
ke(
|
|
3170
|
+
ke(u.type, "fill_forms");
|
|
3158
3171
|
return;
|
|
3159
3172
|
}
|
|
3160
3173
|
if (typeof document > "u") return;
|
|
3161
|
-
|
|
3162
|
-
const
|
|
3163
|
-
if (!
|
|
3164
|
-
console.warn(`[LiveLayer] ${
|
|
3174
|
+
u.type === "fill_form" && _t.current.playConfirmation();
|
|
3175
|
+
const A = typeof u.formId == "string" ? u.formId : null;
|
|
3176
|
+
if (!A) {
|
|
3177
|
+
console.warn(`[LiveLayer] ${u.type}: missing formId.`);
|
|
3165
3178
|
return;
|
|
3166
3179
|
}
|
|
3167
|
-
const
|
|
3168
|
-
if (
|
|
3180
|
+
const $ = Nn(document, A);
|
|
3181
|
+
if (!$) {
|
|
3169
3182
|
console.warn(
|
|
3170
|
-
`[LiveLayer] ${
|
|
3183
|
+
`[LiveLayer] ${u.type}: no <form> matched id="${A}" (or matching name / data-ll-intent slug). Forms are auto-discovered — make sure the form has an \`id\`, \`name\`, or \`data-ll-intent\` attribute the agent observed in PageContext.forms.`
|
|
3171
3184
|
);
|
|
3172
3185
|
return;
|
|
3173
3186
|
}
|
|
3174
|
-
if (
|
|
3187
|
+
if ($.closest('[data-ll-private="true"], [data-ll-skip], .ll-widget')) {
|
|
3175
3188
|
console.warn(
|
|
3176
|
-
`[LiveLayer] ${
|
|
3189
|
+
`[LiveLayer] ${u.type}: refusing to touch a form in a private / opted-out subtree.`
|
|
3177
3190
|
);
|
|
3178
3191
|
return;
|
|
3179
3192
|
}
|
|
3180
|
-
if (
|
|
3181
|
-
const
|
|
3182
|
-
if (!
|
|
3193
|
+
if (u.type === "focus_field") {
|
|
3194
|
+
const j = typeof u.fieldName == "string" ? u.fieldName : null;
|
|
3195
|
+
if (!j) {
|
|
3183
3196
|
console.warn("[LiveLayer] focus_field: missing fieldName.");
|
|
3184
3197
|
return;
|
|
3185
3198
|
}
|
|
3186
|
-
const J =
|
|
3199
|
+
const J = Sn($, j);
|
|
3187
3200
|
if (J.el === null) {
|
|
3188
3201
|
J.reason === "private" ? console.warn(
|
|
3189
|
-
`[LiveLayer] focus_field: field "${
|
|
3202
|
+
`[LiveLayer] focus_field: field "${j}" is privacy-protected and not focusable.`
|
|
3190
3203
|
) : console.warn(
|
|
3191
|
-
`[LiveLayer] focus_field: no input matching key="${
|
|
3204
|
+
`[LiveLayer] focus_field: no input matching key="${j}" in form "${A}". The agent should use the field.name it observed in PageContext.forms[].fields[].`
|
|
3192
3205
|
);
|
|
3193
3206
|
return;
|
|
3194
3207
|
}
|
|
3195
3208
|
J.el.focus();
|
|
3196
3209
|
return;
|
|
3197
3210
|
}
|
|
3198
|
-
const V =
|
|
3211
|
+
const V = u.values && typeof u.values == "object" ? u.values : null;
|
|
3199
3212
|
if (!V) {
|
|
3200
3213
|
console.warn("[LiveLayer] fill_form: missing or invalid values.");
|
|
3201
3214
|
return;
|
|
3202
3215
|
}
|
|
3203
|
-
for (const [
|
|
3216
|
+
for (const [j, J] of Object.entries(V)) {
|
|
3204
3217
|
if (typeof J != "string") continue;
|
|
3205
|
-
const Z =
|
|
3218
|
+
const Z = Sn($, j);
|
|
3206
3219
|
if (Z.el === null) {
|
|
3207
3220
|
Z.reason === "private" ? console.warn(
|
|
3208
|
-
`[LiveLayer] fill_form: field "${
|
|
3221
|
+
`[LiveLayer] fill_form: field "${j}" is privacy-protected (password / cc-* / data-ll-private). Skipping.`
|
|
3209
3222
|
) : console.warn(
|
|
3210
|
-
`[LiveLayer] fill_form: no input matching key="${
|
|
3223
|
+
`[LiveLayer] fill_form: no input matching key="${j}" in form "${A}". The agent should use the field.name it observed in PageContext.forms[].fields[]. Skipping.`
|
|
3211
3224
|
);
|
|
3212
3225
|
continue;
|
|
3213
3226
|
}
|
|
3214
3227
|
try {
|
|
3215
3228
|
Ii(Z.el, J);
|
|
3216
|
-
} catch (
|
|
3229
|
+
} catch (B) {
|
|
3217
3230
|
console.warn(
|
|
3218
|
-
`[LiveLayer] fill_form: failed to set "${
|
|
3219
|
-
|
|
3231
|
+
`[LiveLayer] fill_form: failed to set "${j}".`,
|
|
3232
|
+
B
|
|
3220
3233
|
);
|
|
3221
3234
|
}
|
|
3222
3235
|
}
|
|
3223
3236
|
return;
|
|
3224
3237
|
}
|
|
3225
|
-
if (
|
|
3238
|
+
if (u.type === "submit_form") {
|
|
3226
3239
|
if (!Ce("submit_forms")) {
|
|
3227
3240
|
ke("submit_form", "submit_forms");
|
|
3228
3241
|
return;
|
|
3229
3242
|
}
|
|
3230
3243
|
if (typeof document > "u") return;
|
|
3231
|
-
const
|
|
3232
|
-
if (!
|
|
3244
|
+
const A = typeof u.formId == "string" ? u.formId : null;
|
|
3245
|
+
if (!A) {
|
|
3233
3246
|
console.warn("[LiveLayer] submit_form: missing formId.");
|
|
3234
3247
|
return;
|
|
3235
3248
|
}
|
|
3236
|
-
|
|
3237
|
-
const
|
|
3238
|
-
if (
|
|
3249
|
+
_t.current.playConfirmation();
|
|
3250
|
+
const $ = Nn(document, A);
|
|
3251
|
+
if (!$) {
|
|
3239
3252
|
console.warn(
|
|
3240
|
-
`[LiveLayer] submit_form: no <form> matched id="${
|
|
3253
|
+
`[LiveLayer] submit_form: no <form> matched id="${A}" (or matching name / data-ll-intent slug).`
|
|
3241
3254
|
);
|
|
3242
3255
|
return;
|
|
3243
3256
|
}
|
|
3244
|
-
if (
|
|
3257
|
+
if ($.closest('[data-ll-private="true"], [data-ll-skip], .ll-widget')) {
|
|
3245
3258
|
console.warn(
|
|
3246
3259
|
"[LiveLayer] submit_form: refusing to submit a form in a private / opted-out subtree."
|
|
3247
3260
|
);
|
|
3248
3261
|
return;
|
|
3249
3262
|
}
|
|
3250
|
-
const V = typeof
|
|
3251
|
-
const
|
|
3252
|
-
if (
|
|
3263
|
+
const V = typeof u.requestId == "string" ? u.requestId : void 0, j = (Se = Le.current) == null ? void 0 : Se.call(Le), J = (se) => {
|
|
3264
|
+
const me = j, Ze = me == null ? void 0 : me.localParticipant;
|
|
3265
|
+
if (Ze != null && Ze.publishData)
|
|
3253
3266
|
try {
|
|
3254
3267
|
const rr = V ? { ...se, requestId: V } : se, ir = new TextEncoder().encode(JSON.stringify(rr));
|
|
3255
|
-
|
|
3268
|
+
Ze.publishData(ir, { reliable: !0 });
|
|
3256
3269
|
} catch {
|
|
3257
3270
|
}
|
|
3258
3271
|
};
|
|
3259
3272
|
let Z = !1;
|
|
3260
|
-
const
|
|
3261
|
-
Z = !0, J({ type: "form_submitted", formId:
|
|
3273
|
+
const B = () => {
|
|
3274
|
+
Z = !0, J({ type: "form_submitted", formId: A });
|
|
3262
3275
|
};
|
|
3263
|
-
|
|
3276
|
+
$.addEventListener("submit", B, { once: !0 });
|
|
3264
3277
|
try {
|
|
3265
|
-
typeof
|
|
3278
|
+
typeof $.requestSubmit == "function" ? $.requestSubmit() : $.submit();
|
|
3266
3279
|
} catch (se) {
|
|
3267
|
-
console.warn("[LiveLayer] submit_form: requestSubmit threw.", se),
|
|
3280
|
+
console.warn("[LiveLayer] submit_form: requestSubmit threw.", se), $.removeEventListener("submit", B), J({
|
|
3268
3281
|
type: "form_submit_blocked",
|
|
3269
|
-
formId:
|
|
3282
|
+
formId: A,
|
|
3270
3283
|
reason: "exception"
|
|
3271
3284
|
});
|
|
3272
3285
|
return;
|
|
3273
3286
|
}
|
|
3274
3287
|
setTimeout(() => {
|
|
3275
|
-
Z || (
|
|
3288
|
+
Z || ($.removeEventListener("submit", B), J({
|
|
3276
3289
|
type: "form_submit_blocked",
|
|
3277
|
-
formId:
|
|
3290
|
+
formId: A,
|
|
3278
3291
|
reason: "validation"
|
|
3279
3292
|
}));
|
|
3280
3293
|
}, 500);
|
|
3281
3294
|
return;
|
|
3282
3295
|
}
|
|
3283
|
-
if (
|
|
3296
|
+
if (u.type === "request_routes") {
|
|
3284
3297
|
if (!Ce("read_page")) {
|
|
3285
3298
|
ke("request_routes", "read_page");
|
|
3286
3299
|
return;
|
|
3287
3300
|
}
|
|
3288
|
-
const
|
|
3289
|
-
if (!(
|
|
3290
|
-
const J = (
|
|
3301
|
+
const A = typeof u.requestId == "string" ? u.requestId : void 0, V = (ft = Le.current) == null ? void 0 : ft.call(Le), j = V == null ? void 0 : V.localParticipant;
|
|
3302
|
+
if (!(j != null && j.publishData)) return;
|
|
3303
|
+
const J = (B) => {
|
|
3291
3304
|
try {
|
|
3292
|
-
const se =
|
|
3293
|
-
|
|
3305
|
+
const se = A ? { type: "routes", routes: B, requestId: A } : { type: "routes", routes: B }, me = new TextEncoder().encode(JSON.stringify(se));
|
|
3306
|
+
j.publishData(me, { reliable: !0 });
|
|
3294
3307
|
} catch (se) {
|
|
3295
3308
|
console.warn("[LiveLayer] request_routes: publishData failed.", se);
|
|
3296
3309
|
}
|
|
3297
|
-
}, Z =
|
|
3310
|
+
}, Z = Gt.current;
|
|
3298
3311
|
if (Z) {
|
|
3299
3312
|
try {
|
|
3300
|
-
const
|
|
3301
|
-
if (!Array.isArray(
|
|
3313
|
+
const B = Z(), se = (me) => {
|
|
3314
|
+
if (!Array.isArray(me)) {
|
|
3302
3315
|
J([]);
|
|
3303
3316
|
return;
|
|
3304
3317
|
}
|
|
3305
|
-
J(
|
|
3318
|
+
J(me.map(Li).slice(0, 200));
|
|
3306
3319
|
};
|
|
3307
|
-
|
|
3320
|
+
B instanceof Promise ? B.then(se).catch((me) => {
|
|
3308
3321
|
console.warn(
|
|
3309
3322
|
"[LiveLayer] getRoutes rejected; falling back to DOM walker.",
|
|
3310
|
-
|
|
3311
|
-
), J(
|
|
3312
|
-
}) : se(
|
|
3313
|
-
} catch (
|
|
3323
|
+
me
|
|
3324
|
+
), J(Ot());
|
|
3325
|
+
}) : se(B);
|
|
3326
|
+
} catch (B) {
|
|
3314
3327
|
console.warn(
|
|
3315
3328
|
"[LiveLayer] getRoutes threw; falling back to DOM walker.",
|
|
3316
|
-
|
|
3317
|
-
), J(
|
|
3329
|
+
B
|
|
3330
|
+
), J(Ot());
|
|
3318
3331
|
}
|
|
3319
3332
|
return;
|
|
3320
3333
|
}
|
|
3321
3334
|
try {
|
|
3322
|
-
J(
|
|
3323
|
-
} catch (
|
|
3324
|
-
console.warn("[LiveLayer] request_routes: extractRoutes threw.",
|
|
3335
|
+
J(Ot());
|
|
3336
|
+
} catch (B) {
|
|
3337
|
+
console.warn("[LiveLayer] request_routes: extractRoutes threw.", B);
|
|
3325
3338
|
}
|
|
3326
3339
|
return;
|
|
3327
3340
|
}
|
|
3328
|
-
if (
|
|
3341
|
+
if (u.type === "task_field_updated") {
|
|
3329
3342
|
if (!Ce("collect_data")) {
|
|
3330
3343
|
ke("task_field_updated", "collect_data");
|
|
3331
3344
|
return;
|
|
3332
3345
|
}
|
|
3333
|
-
const
|
|
3346
|
+
const A = {
|
|
3334
3347
|
phase: "field",
|
|
3335
|
-
fieldId: typeof
|
|
3336
|
-
fieldName: typeof
|
|
3337
|
-
value: typeof
|
|
3338
|
-
kind: typeof
|
|
3339
|
-
source:
|
|
3340
|
-
...typeof
|
|
3341
|
-
...typeof
|
|
3348
|
+
fieldId: typeof u.fieldId == "string" ? u.fieldId : "",
|
|
3349
|
+
fieldName: typeof u.fieldName == "string" ? u.fieldName : typeof u.fieldId == "string" ? u.fieldId : "",
|
|
3350
|
+
value: typeof u.value == "string" ? u.value : "",
|
|
3351
|
+
kind: typeof u.kind == "string" ? u.kind : "text",
|
|
3352
|
+
source: u.source === "slide" ? "slide" : u.source === "page" ? "page" : "agent",
|
|
3353
|
+
...typeof u.slideId == "string" ? { slideId: u.slideId } : {},
|
|
3354
|
+
...typeof u.formId == "string" ? { formId: u.formId } : {}
|
|
3342
3355
|
};
|
|
3343
3356
|
if (typeof document < "u")
|
|
3344
3357
|
try {
|
|
3345
3358
|
document.dispatchEvent(
|
|
3346
|
-
new CustomEvent("ll-collected", { detail:
|
|
3359
|
+
new CustomEvent("ll-collected", { detail: A })
|
|
3347
3360
|
);
|
|
3348
3361
|
} catch {
|
|
3349
3362
|
}
|
|
3350
3363
|
return;
|
|
3351
3364
|
}
|
|
3352
|
-
if (
|
|
3365
|
+
if (u.type === "task_completed") {
|
|
3353
3366
|
if (!Ce("collect_data")) {
|
|
3354
3367
|
ke("task_completed", "collect_data");
|
|
3355
3368
|
return;
|
|
3356
3369
|
}
|
|
3357
|
-
const
|
|
3358
|
-
if (!
|
|
3370
|
+
const A = u.result;
|
|
3371
|
+
if (!A || typeof A != "object") {
|
|
3359
3372
|
console.warn(
|
|
3360
3373
|
"[LiveLayer] task_completed missing `result` payload."
|
|
3361
3374
|
);
|
|
@@ -3365,66 +3378,66 @@ const Hi = /* @__PURE__ */ new Set([
|
|
|
3365
3378
|
try {
|
|
3366
3379
|
document.dispatchEvent(
|
|
3367
3380
|
new CustomEvent("ll-collected", {
|
|
3368
|
-
detail: { phase: "complete", result:
|
|
3381
|
+
detail: { phase: "complete", result: A }
|
|
3369
3382
|
})
|
|
3370
3383
|
);
|
|
3371
3384
|
} catch {
|
|
3372
3385
|
}
|
|
3373
3386
|
try {
|
|
3374
|
-
|
|
3375
|
-
|
|
3387
|
+
Be == null || Be(
|
|
3388
|
+
A
|
|
3376
3389
|
);
|
|
3377
|
-
} catch (
|
|
3378
|
-
console.warn("[LiveLayer] onCollect threw.",
|
|
3390
|
+
} catch ($) {
|
|
3391
|
+
console.warn("[LiveLayer] onCollect threw.", $);
|
|
3379
3392
|
}
|
|
3380
3393
|
return;
|
|
3381
3394
|
}
|
|
3382
|
-
Hi.has(
|
|
3395
|
+
Hi.has(u.type) || De == null || De(u);
|
|
3383
3396
|
}
|
|
3384
3397
|
},
|
|
3385
|
-
[De, Pe,
|
|
3398
|
+
[De, Pe, Be]
|
|
3386
3399
|
), ae = pr({
|
|
3387
|
-
agentId:
|
|
3400
|
+
agentId: W ? "__controlled__" : st,
|
|
3388
3401
|
baseUrl: o,
|
|
3389
|
-
apiKey:
|
|
3402
|
+
apiKey: l,
|
|
3390
3403
|
sessionEndpoint: s,
|
|
3391
|
-
sessionBody:
|
|
3392
|
-
onDataMessage:
|
|
3404
|
+
sessionBody: a,
|
|
3405
|
+
onDataMessage: W ? void 0 : ut
|
|
3393
3406
|
});
|
|
3394
3407
|
P(() => {
|
|
3395
|
-
if (
|
|
3396
|
-
return
|
|
3397
|
-
}, [
|
|
3408
|
+
if (W != null && W.subscribeToDataMessages)
|
|
3409
|
+
return W.subscribeToDataMessages(ut);
|
|
3410
|
+
}, [W, ut]), Le.current = () => {
|
|
3398
3411
|
var x;
|
|
3399
3412
|
return (x = ae.getRoom) == null ? void 0 : x.call(ae);
|
|
3400
3413
|
}, P(() => {
|
|
3401
|
-
var
|
|
3414
|
+
var re;
|
|
3402
3415
|
if (typeof window > "u") return;
|
|
3403
|
-
const x = ((
|
|
3416
|
+
const x = ((re = window.location) == null ? void 0 : re.hostname) || "";
|
|
3404
3417
|
if (x === "localhost" || x === "127.0.0.1" || x === "0.0.0.0" || x.endsWith(".local") || x.endsWith(".test"))
|
|
3405
3418
|
return window.__livelayerSimulateCommand = (ue) => {
|
|
3406
3419
|
try {
|
|
3407
|
-
|
|
3408
|
-
} catch (
|
|
3409
|
-
console.warn("[LiveLayer] simulate-command threw:",
|
|
3420
|
+
ut(ue);
|
|
3421
|
+
} catch (Se) {
|
|
3422
|
+
console.warn("[LiveLayer] simulate-command threw:", Se);
|
|
3410
3423
|
}
|
|
3411
3424
|
}, () => {
|
|
3412
3425
|
delete window.__livelayerSimulateCommand;
|
|
3413
3426
|
};
|
|
3414
|
-
}, [
|
|
3415
|
-
const N =
|
|
3416
|
-
connectionState:
|
|
3417
|
-
agentState:
|
|
3418
|
-
transcript:
|
|
3419
|
-
videoElement:
|
|
3420
|
-
audioElement:
|
|
3421
|
-
canResume:
|
|
3422
|
-
error:
|
|
3427
|
+
}, [ut]);
|
|
3428
|
+
const N = nt(() => W ? {
|
|
3429
|
+
connectionState: W.connectionState,
|
|
3430
|
+
agentState: W.agentState,
|
|
3431
|
+
transcript: W.transcript,
|
|
3432
|
+
videoElement: W.videoElement,
|
|
3433
|
+
audioElement: W.audioElement,
|
|
3434
|
+
canResume: W.canResume,
|
|
3435
|
+
error: W.error,
|
|
3423
3436
|
agentConfig: null,
|
|
3424
3437
|
connect: async () => {
|
|
3425
|
-
await
|
|
3438
|
+
await W.onConnect();
|
|
3426
3439
|
},
|
|
3427
|
-
disconnect: () =>
|
|
3440
|
+
disconnect: () => W.onDisconnect(),
|
|
3428
3441
|
// Dummy getRoom for shape compatibility — controlled consumers own the Room.
|
|
3429
3442
|
// Internal session's getRoom returns null when no real connect has happened,
|
|
3430
3443
|
// so we reuse its reference for type consistency.
|
|
@@ -3443,288 +3456,293 @@ const Hi = /* @__PURE__ */ new Set([
|
|
|
3443
3456
|
disconnect: ae.disconnect,
|
|
3444
3457
|
getRoom: ae.getRoom,
|
|
3445
3458
|
isControlled: !1
|
|
3446
|
-
}, [
|
|
3447
|
-
|
|
3448
|
-
const
|
|
3449
|
-
|
|
3459
|
+
}, [W, ae]), Xt = I(N);
|
|
3460
|
+
Xt.current = N;
|
|
3461
|
+
const Kt = I(W);
|
|
3462
|
+
Kt.current = W, lr(
|
|
3450
3463
|
r,
|
|
3451
3464
|
() => ({
|
|
3452
3465
|
sendData: async (x) => {
|
|
3453
|
-
var
|
|
3454
|
-
const
|
|
3455
|
-
if (
|
|
3466
|
+
var Se, ft;
|
|
3467
|
+
const u = Kt.current;
|
|
3468
|
+
if (u != null && u.publishData) {
|
|
3456
3469
|
try {
|
|
3457
|
-
await
|
|
3458
|
-
} catch (
|
|
3459
|
-
console.warn("[AvatarWidget] sendData (controlled) failed:",
|
|
3470
|
+
await u.publishData(x);
|
|
3471
|
+
} catch (A) {
|
|
3472
|
+
console.warn("[AvatarWidget] sendData (controlled) failed:", A);
|
|
3460
3473
|
}
|
|
3461
3474
|
return;
|
|
3462
3475
|
}
|
|
3463
|
-
const
|
|
3476
|
+
const re = (ft = (Se = Xt.current) == null ? void 0 : Se.getRoom) == null ? void 0 : ft.call(Se), ue = re == null ? void 0 : re.localParticipant;
|
|
3464
3477
|
if (ue != null && ue.publishData)
|
|
3465
3478
|
try {
|
|
3466
|
-
const
|
|
3467
|
-
await ue.publishData(
|
|
3468
|
-
} catch (
|
|
3469
|
-
console.warn("[AvatarWidget] sendData failed:",
|
|
3479
|
+
const A = new TextEncoder().encode(JSON.stringify(x));
|
|
3480
|
+
await ue.publishData(A, { reliable: !0 });
|
|
3481
|
+
} catch (A) {
|
|
3482
|
+
console.warn("[AvatarWidget] sendData failed:", A);
|
|
3470
3483
|
}
|
|
3471
3484
|
}
|
|
3472
3485
|
}),
|
|
3473
3486
|
[]
|
|
3474
3487
|
);
|
|
3475
|
-
const
|
|
3488
|
+
const Jt = I(null);
|
|
3476
3489
|
P(() => {
|
|
3477
|
-
const x = N.videoElement,
|
|
3478
|
-
if (!(!x || !
|
|
3479
|
-
return
|
|
3480
|
-
x.parentNode ===
|
|
3490
|
+
const x = N.videoElement, u = Jt.current;
|
|
3491
|
+
if (!(!x || !u))
|
|
3492
|
+
return u.appendChild(x), () => {
|
|
3493
|
+
x.parentNode === u && u.removeChild(x);
|
|
3481
3494
|
};
|
|
3482
3495
|
}, [N.videoElement]), P(() => {
|
|
3483
3496
|
const x = N.audioElement;
|
|
3484
3497
|
if (!x) return;
|
|
3485
|
-
const
|
|
3486
|
-
|
|
3487
|
-
const
|
|
3488
|
-
return
|
|
3489
|
-
(ue == null ? void 0 : ue.name) === "NotAllowedError" &&
|
|
3498
|
+
const u = document.createElement("div");
|
|
3499
|
+
u.className = "ll-audio-sink", u.setAttribute("aria-hidden", "true"), u.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;clip:rect(0 0 0 0);pointer-events:none;", u.appendChild(x), document.body.appendChild(u), He.attach(x);
|
|
3500
|
+
const re = x.play();
|
|
3501
|
+
return re && typeof re.catch == "function" && re.catch((ue) => {
|
|
3502
|
+
(ue == null ? void 0 : ue.name) === "NotAllowedError" && Ge(!0);
|
|
3490
3503
|
}), () => {
|
|
3491
|
-
He.detach(), x.parentNode ===
|
|
3504
|
+
He.detach(), x.parentNode === u && u.removeChild(x), u.parentNode === document.body && document.body.removeChild(u);
|
|
3492
3505
|
};
|
|
3493
|
-
}, [N.audioElement])
|
|
3506
|
+
}, [N.audioElement]);
|
|
3507
|
+
const ye = gr({
|
|
3508
|
+
gateUntilAgentReady: !0,
|
|
3509
|
+
agentState: N.agentState
|
|
3510
|
+
});
|
|
3511
|
+
P(() => {
|
|
3494
3512
|
if (N.isControlled || N.connectionState !== "connected") return;
|
|
3495
3513
|
const x = N.getRoom();
|
|
3496
3514
|
if (x)
|
|
3497
|
-
return
|
|
3498
|
-
const
|
|
3499
|
-
|
|
3515
|
+
return ye.setupMic(x).then(() => {
|
|
3516
|
+
const u = ye.getMicStream();
|
|
3517
|
+
u && He.attachStream(u, "mic");
|
|
3500
3518
|
}).catch(() => {
|
|
3501
3519
|
}), () => {
|
|
3502
|
-
He.detachSlot("mic"),
|
|
3520
|
+
He.detachSlot("mic"), ye.teardownMic();
|
|
3503
3521
|
};
|
|
3504
3522
|
}, [N.isControlled, N.connectionState]), P(() => {
|
|
3505
|
-
var
|
|
3523
|
+
var u;
|
|
3506
3524
|
if (N.connectionState !== "connected") return;
|
|
3507
|
-
const x = N.isControlled ? (
|
|
3525
|
+
const x = N.isControlled ? (u = W == null ? void 0 : W.getRoom) == null ? void 0 : u.call(W) : N.getRoom();
|
|
3508
3526
|
if (x)
|
|
3509
|
-
return
|
|
3510
|
-
|
|
3527
|
+
return _e.attachRoom(x), Oe.attachRoom(x), N.isControlled && ye.attachRoom(x), xe.refresh(), () => {
|
|
3528
|
+
_e.teardown(), Oe.teardown();
|
|
3511
3529
|
};
|
|
3512
|
-
}, [N.isControlled, N.connectionState,
|
|
3530
|
+
}, [N.isControlled, N.connectionState, W]), P(() => {
|
|
3513
3531
|
const x = N.audioElement;
|
|
3514
|
-
x && (x.muted =
|
|
3515
|
-
}, [N.audioElement,
|
|
3532
|
+
x && (x.muted = At);
|
|
3533
|
+
}, [N.audioElement, At]);
|
|
3516
3534
|
const Un = L((x) => {
|
|
3517
|
-
const
|
|
3518
|
-
if (
|
|
3535
|
+
const u = { type: "user_message", text: x };
|
|
3536
|
+
if (W != null && W.publishData) {
|
|
3519
3537
|
try {
|
|
3520
|
-
|
|
3538
|
+
W.publishData(u);
|
|
3521
3539
|
} catch {
|
|
3522
3540
|
}
|
|
3523
3541
|
return;
|
|
3524
3542
|
}
|
|
3525
|
-
const
|
|
3526
|
-
if (
|
|
3543
|
+
const re = N.getRoom();
|
|
3544
|
+
if (re)
|
|
3527
3545
|
try {
|
|
3528
|
-
const ue = new TextEncoder().encode(JSON.stringify(
|
|
3529
|
-
|
|
3546
|
+
const ue = new TextEncoder().encode(JSON.stringify(u));
|
|
3547
|
+
re.localParticipant.publishData(ue, { reliable: !0 });
|
|
3530
3548
|
} catch {
|
|
3531
3549
|
}
|
|
3532
|
-
}, [N,
|
|
3550
|
+
}, [N, W]), jn = L(() => {
|
|
3533
3551
|
qn((x) => !x);
|
|
3534
3552
|
}, []);
|
|
3535
3553
|
P(() => {
|
|
3536
|
-
Te == null || Te(N.connectionState), N.connectionState === "connected" ? Me == null || Me() : N.connectionState === "disconnected" && (
|
|
3537
|
-
}, [N.connectionState, Me,
|
|
3554
|
+
Te == null || Te(N.connectionState), N.connectionState === "connected" ? Me == null || Me() : N.connectionState === "disconnected" && (Fe == null || Fe());
|
|
3555
|
+
}, [N.connectionState, Me, Fe, Te]), P(() => {
|
|
3538
3556
|
Ie == null || Ie(N.transcript);
|
|
3539
3557
|
}, [N.transcript, Ie]), P(() => {
|
|
3540
3558
|
Re == null || Re(N.agentState);
|
|
3541
3559
|
}, [N.agentState, Re]), P(() => {
|
|
3542
3560
|
wt.setThinking(N.agentState === "thinking");
|
|
3543
3561
|
}, [N.agentState, wt]);
|
|
3544
|
-
const
|
|
3562
|
+
const Zt = I(!1);
|
|
3545
3563
|
P(() => {
|
|
3546
|
-
!
|
|
3547
|
-
}, [
|
|
3564
|
+
!v || Zt.current || at && N.connectionState === "idle" && (Zt.current = !0, N.connect());
|
|
3565
|
+
}, [v, N.connectionState, N, at]);
|
|
3548
3566
|
const Vn = L(
|
|
3549
3567
|
(x) => {
|
|
3550
|
-
const
|
|
3551
|
-
|
|
3568
|
+
const u = y == null ? void 0 : y.find((re) => re.id === x);
|
|
3569
|
+
u && (w(!1), x !== Ne && (bt(!0), N.disconnect(), $e || St(x), m == null || m(u)));
|
|
3552
3570
|
},
|
|
3553
3571
|
[
|
|
3554
|
-
|
|
3555
|
-
|
|
3572
|
+
y,
|
|
3573
|
+
Ne,
|
|
3556
3574
|
N,
|
|
3557
3575
|
$e,
|
|
3558
|
-
|
|
3576
|
+
m
|
|
3559
3577
|
]
|
|
3560
3578
|
);
|
|
3561
3579
|
P(() => {
|
|
3562
|
-
|
|
3563
|
-
}, [N.connectionState,
|
|
3564
|
-
if (!
|
|
3565
|
-
const x = (
|
|
3566
|
-
|
|
3580
|
+
Xe && N.connectionState === "connected" && bt(!1);
|
|
3581
|
+
}, [N.connectionState, Xe]), P(() => {
|
|
3582
|
+
if (!Ke) return;
|
|
3583
|
+
const x = (u) => {
|
|
3584
|
+
u.key === "Escape" && w(!1);
|
|
3567
3585
|
};
|
|
3568
3586
|
return window.addEventListener("keydown", x), () => window.removeEventListener("keydown", x);
|
|
3569
|
-
}, [
|
|
3570
|
-
const Yn = !!K || !!(
|
|
3571
|
-
|
|
3572
|
-
const
|
|
3573
|
-
() =>
|
|
3574
|
-
[
|
|
3575
|
-
),
|
|
3576
|
-
N.disconnect(),
|
|
3577
|
-
}, [N,
|
|
3587
|
+
}, [Ke]);
|
|
3588
|
+
const Yn = !!K || !!(fe != null && fe.avatarImageUrl) || N.isControlled, dt = _r(st, o, Yn);
|
|
3589
|
+
lt === void 0 && ((nn = dt.info) != null && nn.capabilities) && (Pt.current = dt.info.capabilities);
|
|
3590
|
+
const xt = (fe == null ? void 0 : fe.name) ?? oe ?? ((rn = N.agentConfig) == null ? void 0 : rn.name) ?? ((on = dt.info) == null ? void 0 : on.name) ?? "Live Layer", Dt = (fe == null ? void 0 : fe.avatarImageUrl) ?? K ?? ((ln = N.agentConfig) == null ? void 0 : ln.avatarImageUrl) ?? ((an = dt.info) == null ? void 0 : an.avatarImageUrl) ?? null, Gn = D ?? ((sn = N.agentConfig) == null ? void 0 : sn.idleLoopUrl) ?? ((cn = dt.info) == null ? void 0 : cn.idleLoopUrl) ?? null, Xn = F ?? null, Kn = L(() => we("expanded"), [we]), Jn = L(
|
|
3591
|
+
() => we("minimized"),
|
|
3592
|
+
[we]
|
|
3593
|
+
), Qt = L(() => {
|
|
3594
|
+
N.disconnect(), we("hidden");
|
|
3595
|
+
}, [N, we]), Zn = L(() => {
|
|
3578
3596
|
const x = N.audioElement;
|
|
3579
|
-
x && x.play().then(() =>
|
|
3597
|
+
x && x.play().then(() => Ge(!1)).catch(() => {
|
|
3580
3598
|
});
|
|
3581
3599
|
}, [N.audioElement]), Qn = L(() => {
|
|
3582
|
-
|
|
3583
|
-
}, [N]),
|
|
3600
|
+
Ge(!1), N.connect();
|
|
3601
|
+
}, [N]), Je = {
|
|
3584
3602
|
...ze,
|
|
3585
|
-
...ce ? {} : { zIndex:
|
|
3603
|
+
...ce ? {} : { zIndex: Ue }
|
|
3586
3604
|
};
|
|
3587
|
-
|
|
3605
|
+
z.primaryColor && (Je["--ll-color-primary"] = z.primaryColor), z.accentColor && (Je["--ll-color-accent"] = z.accentColor), z.backgroundColor && (Je["--ll-color-bg"] = z.backgroundColor), z.textColor && (Je["--ll-color-fg"] = z.textColor);
|
|
3588
3606
|
const er = {
|
|
3589
|
-
...
|
|
3607
|
+
...Je,
|
|
3590
3608
|
...Ee.style
|
|
3591
3609
|
}, tr = [
|
|
3592
3610
|
"ll-widget",
|
|
3593
|
-
`ll-widget--${
|
|
3594
|
-
`ll-widget--${
|
|
3611
|
+
`ll-widget--${he}`,
|
|
3612
|
+
`ll-widget--${pe ? "mobile" : "desktop"}`,
|
|
3595
3613
|
Ee.hasGeometry ? "ll-widget--has-geometry" : null,
|
|
3596
3614
|
Ee.isDragging ? "is-dragging" : null,
|
|
3597
3615
|
Ee.isResizing ? "is-resizing" : null,
|
|
3598
|
-
|
|
3616
|
+
qe
|
|
3599
3617
|
].filter(Boolean).join(" ");
|
|
3600
|
-
if (!
|
|
3618
|
+
if (!at) return null;
|
|
3601
3619
|
const nr = /* @__PURE__ */ n(
|
|
3602
3620
|
"div",
|
|
3603
3621
|
{
|
|
3604
3622
|
className: tr,
|
|
3605
3623
|
style: er,
|
|
3606
|
-
"data-display-mode":
|
|
3607
|
-
"data-position":
|
|
3608
|
-
"data-experience-mode":
|
|
3609
|
-
children:
|
|
3624
|
+
"data-display-mode": he,
|
|
3625
|
+
"data-position": _,
|
|
3626
|
+
"data-experience-mode": d === "EMBEDDED" ? "embedded" : "widget",
|
|
3627
|
+
children: he === "expanded" && /* @__PURE__ */ n(
|
|
3610
3628
|
si,
|
|
3611
3629
|
{
|
|
3612
|
-
position:
|
|
3613
|
-
isMobile:
|
|
3614
|
-
agentName:
|
|
3615
|
-
avatarImageUrl:
|
|
3630
|
+
position: _,
|
|
3631
|
+
isMobile: pe,
|
|
3632
|
+
agentName: xt,
|
|
3633
|
+
avatarImageUrl: Dt,
|
|
3616
3634
|
idleLoopUrl: Gn,
|
|
3617
3635
|
greeting: Xn,
|
|
3618
|
-
branding:
|
|
3619
|
-
teamMembers:
|
|
3620
|
-
currentTeamMemberId:
|
|
3621
|
-
isSwitchingTeamMember:
|
|
3622
|
-
teamSwitcherOpen:
|
|
3623
|
-
onToggleTeamSwitcher: () =>
|
|
3636
|
+
branding: z,
|
|
3637
|
+
teamMembers: y,
|
|
3638
|
+
currentTeamMemberId: Ne,
|
|
3639
|
+
isSwitchingTeamMember: Xe,
|
|
3640
|
+
teamSwitcherOpen: Ke,
|
|
3641
|
+
onToggleTeamSwitcher: () => w((x) => !x),
|
|
3624
3642
|
onSelectTeamMember: Vn,
|
|
3625
3643
|
connectionState: N.connectionState,
|
|
3626
3644
|
agentState: N.agentState,
|
|
3627
3645
|
transcript: N.transcript,
|
|
3628
|
-
isMuted:
|
|
3646
|
+
isMuted: ye.isMuted,
|
|
3629
3647
|
micDevices: xe.mics,
|
|
3630
|
-
activeMicId:
|
|
3631
|
-
isCameraEnabled:
|
|
3632
|
-
cameraPreviewEl:
|
|
3648
|
+
activeMicId: ye.activeDeviceId,
|
|
3649
|
+
isCameraEnabled: _e.isEnabled,
|
|
3650
|
+
cameraPreviewEl: _e.previewEl,
|
|
3633
3651
|
cameraDevices: xe.cameras,
|
|
3634
|
-
activeCameraId:
|
|
3635
|
-
isScreenShareEnabled:
|
|
3636
|
-
screenPreviewEl:
|
|
3637
|
-
isSpeakerMuted:
|
|
3652
|
+
activeCameraId: _e.activeDeviceId,
|
|
3653
|
+
isScreenShareEnabled: Oe.isEnabled,
|
|
3654
|
+
screenPreviewEl: Oe.previewEl,
|
|
3655
|
+
isSpeakerMuted: At,
|
|
3638
3656
|
allowCamera: G,
|
|
3639
|
-
allowScreenShare:
|
|
3640
|
-
allowTyping:
|
|
3641
|
-
showMinimize:
|
|
3642
|
-
showClose:
|
|
3657
|
+
allowScreenShare: f,
|
|
3658
|
+
allowTyping: S,
|
|
3659
|
+
showMinimize: pe && !ce ? !1 : yt,
|
|
3660
|
+
showClose: vt,
|
|
3643
3661
|
chromeless: X,
|
|
3644
|
-
compactControls:
|
|
3662
|
+
compactControls: Nt,
|
|
3645
3663
|
transforming: te,
|
|
3646
|
-
transformingLabel:
|
|
3647
|
-
languageMenuOpen:
|
|
3664
|
+
transformingLabel: ie,
|
|
3665
|
+
languageMenuOpen: le,
|
|
3648
3666
|
onToggleLanguageMenu: () => Bn((x) => !x),
|
|
3649
|
-
needsUserGesture:
|
|
3667
|
+
needsUserGesture: Ae,
|
|
3650
3668
|
canResume: N.canResume,
|
|
3651
|
-
micError:
|
|
3669
|
+
micError: ye.micError,
|
|
3652
3670
|
error: N.error,
|
|
3653
|
-
avatarVideoContainerRef:
|
|
3671
|
+
avatarVideoContainerRef: Jt,
|
|
3654
3672
|
agentVideoEl: N.videoElement,
|
|
3655
3673
|
onConnect: () => void N.connect(),
|
|
3656
3674
|
onDisconnect: () => N.disconnect(),
|
|
3657
3675
|
onRetry: Qn,
|
|
3658
3676
|
onResumeAudio: Zn,
|
|
3659
|
-
onToggleMute:
|
|
3660
|
-
onSwitchMicDevice: (x) => void
|
|
3661
|
-
onToggleCamera: () => void
|
|
3662
|
-
onSwitchCameraDevice: (x) => void
|
|
3663
|
-
onToggleScreenShare: () => void
|
|
3677
|
+
onToggleMute: ye.toggleMute,
|
|
3678
|
+
onSwitchMicDevice: (x) => void ye.switchDevice(x),
|
|
3679
|
+
onToggleCamera: () => void _e.toggle(),
|
|
3680
|
+
onSwitchCameraDevice: (x) => void _e.switchDevice(x),
|
|
3681
|
+
onToggleScreenShare: () => void Oe.toggle(),
|
|
3664
3682
|
onToggleSpeaker: jn,
|
|
3665
3683
|
onSendMessage: Un,
|
|
3666
3684
|
onMinimize: Jn,
|
|
3667
|
-
onClose:
|
|
3668
|
-
onClearMicError:
|
|
3685
|
+
onClose: Qt,
|
|
3686
|
+
onClearMicError: ye.clearError,
|
|
3669
3687
|
dragHandleProps: Ee.dragHandleProps,
|
|
3670
3688
|
resizeHandleProps: Ee.resizeHandleProps
|
|
3671
3689
|
}
|
|
3672
3690
|
)
|
|
3673
3691
|
}
|
|
3674
|
-
),
|
|
3692
|
+
), en = !ce && (he === "hidden" || he === "minimized") ? /* @__PURE__ */ C(
|
|
3675
3693
|
"div",
|
|
3676
3694
|
{
|
|
3677
3695
|
className: [
|
|
3678
3696
|
"ll-widget",
|
|
3679
3697
|
"ll-widget--floating",
|
|
3680
|
-
`ll-widget--${
|
|
3681
|
-
`ll-widget--${
|
|
3698
|
+
`ll-widget--${he}`,
|
|
3699
|
+
`ll-widget--${pe ? "mobile" : "desktop"}`
|
|
3682
3700
|
].join(" "),
|
|
3683
|
-
style:
|
|
3684
|
-
"data-display-mode":
|
|
3685
|
-
"data-position":
|
|
3701
|
+
style: Je,
|
|
3702
|
+
"data-display-mode": he,
|
|
3703
|
+
"data-position": _,
|
|
3686
3704
|
children: [
|
|
3687
|
-
|
|
3705
|
+
he === "hidden" && /* @__PURE__ */ n(
|
|
3688
3706
|
Jr,
|
|
3689
3707
|
{
|
|
3690
|
-
position:
|
|
3691
|
-
isMobile:
|
|
3708
|
+
position: _,
|
|
3709
|
+
isMobile: pe,
|
|
3692
3710
|
isSpeaking: N.agentState === "speaking",
|
|
3693
|
-
onExpand: () =>
|
|
3694
|
-
label: `Open ${
|
|
3695
|
-
avatarImageUrl:
|
|
3696
|
-
agentName:
|
|
3711
|
+
onExpand: () => we("expanded"),
|
|
3712
|
+
label: `Open ${xt} widget`,
|
|
3713
|
+
avatarImageUrl: Dt,
|
|
3714
|
+
agentName: xt,
|
|
3697
3715
|
containerEl: Q
|
|
3698
3716
|
}
|
|
3699
3717
|
),
|
|
3700
|
-
|
|
3718
|
+
he === "minimized" && /* @__PURE__ */ n(
|
|
3701
3719
|
Qr,
|
|
3702
3720
|
{
|
|
3703
|
-
position:
|
|
3704
|
-
isMobile:
|
|
3705
|
-
agentName:
|
|
3706
|
-
avatarImageUrl:
|
|
3721
|
+
position: _,
|
|
3722
|
+
isMobile: pe,
|
|
3723
|
+
agentName: xt,
|
|
3724
|
+
avatarImageUrl: Dt,
|
|
3707
3725
|
agentState: N.agentState,
|
|
3708
|
-
isMuted:
|
|
3726
|
+
isMuted: ye.isMuted,
|
|
3709
3727
|
audioLevel: He,
|
|
3710
3728
|
onExpand: Kn,
|
|
3711
|
-
onToggleMute:
|
|
3712
|
-
onClose:
|
|
3729
|
+
onToggleMute: ye.toggleMute,
|
|
3730
|
+
onClose: Qt
|
|
3713
3731
|
}
|
|
3714
3732
|
)
|
|
3715
3733
|
]
|
|
3716
3734
|
}
|
|
3717
|
-
) : null,
|
|
3718
|
-
return /* @__PURE__ */ C(
|
|
3735
|
+
) : null, tn = Q ?? (typeof document < "u" ? document.body : null);
|
|
3736
|
+
return /* @__PURE__ */ C(We, { children: [
|
|
3719
3737
|
nr,
|
|
3720
|
-
|
|
3738
|
+
en && tn && qt(en, tn)
|
|
3721
3739
|
] });
|
|
3722
3740
|
}
|
|
3723
3741
|
);
|
|
3724
|
-
|
|
3725
|
-
const Oi =
|
|
3742
|
+
Fn.displayName = "AvatarWidgetInner";
|
|
3743
|
+
const Oi = Bt(
|
|
3726
3744
|
function(t, r) {
|
|
3727
|
-
return /* @__PURE__ */ n(fr, { children: /* @__PURE__ */ n(
|
|
3745
|
+
return /* @__PURE__ */ n(fr, { children: /* @__PURE__ */ n(Fn, { ...t, ref: r }) });
|
|
3728
3746
|
}
|
|
3729
3747
|
);
|
|
3730
3748
|
Oi.displayName = "AvatarWidget";
|
|
@@ -3733,36 +3751,36 @@ const Ki = ({
|
|
|
3733
3751
|
baseUrl: t,
|
|
3734
3752
|
apiKey: r,
|
|
3735
3753
|
mode: i,
|
|
3736
|
-
onAgentEvent:
|
|
3754
|
+
onAgentEvent: l,
|
|
3737
3755
|
className: o,
|
|
3738
3756
|
style: s
|
|
3739
3757
|
}) => {
|
|
3740
|
-
const
|
|
3741
|
-
|
|
3742
|
-
const
|
|
3758
|
+
const a = I(null), c = I(null), d = I(l);
|
|
3759
|
+
d.current = l;
|
|
3760
|
+
const v = L((p) => {
|
|
3743
3761
|
var T;
|
|
3744
|
-
const h =
|
|
3745
|
-
(T =
|
|
3762
|
+
const h = p.detail;
|
|
3763
|
+
(T = d.current) == null || T.call(d, h);
|
|
3746
3764
|
}, []);
|
|
3747
3765
|
return P(() => {
|
|
3748
|
-
const
|
|
3749
|
-
if (!
|
|
3766
|
+
const p = a.current;
|
|
3767
|
+
if (!p) return;
|
|
3750
3768
|
const h = document.createElement("livelayer-widget");
|
|
3751
|
-
return h.setAttribute("agent-id", e), t && h.setAttribute("base-url", t), r && h.setAttribute("api-key", r), i && h.setAttribute("mode", i), h.addEventListener("agent-event",
|
|
3752
|
-
h.removeEventListener("agent-event",
|
|
3769
|
+
return h.setAttribute("agent-id", e), t && h.setAttribute("base-url", t), r && h.setAttribute("api-key", r), i && h.setAttribute("mode", i), h.addEventListener("agent-event", v), p.appendChild(h), c.current = h, () => {
|
|
3770
|
+
h.removeEventListener("agent-event", v), p.removeChild(h), c.current = null;
|
|
3753
3771
|
};
|
|
3754
3772
|
}, [e]), P(() => {
|
|
3755
3773
|
c.current && (i ? c.current.setAttribute("mode", i) : c.current.removeAttribute("mode"));
|
|
3756
|
-
}, [i]), /* @__PURE__ */ n("div", { ref:
|
|
3757
|
-
}, Ji =
|
|
3758
|
-
function({ id: t, intent: r, as: i = "div", className:
|
|
3774
|
+
}, [i]), /* @__PURE__ */ n("div", { ref: a, className: o, style: s });
|
|
3775
|
+
}, Ji = Bt(
|
|
3776
|
+
function({ id: t, intent: r, as: i = "div", className: l, style: o, children: s }, a) {
|
|
3759
3777
|
return ar(
|
|
3760
3778
|
i,
|
|
3761
3779
|
{
|
|
3762
|
-
ref:
|
|
3780
|
+
ref: a,
|
|
3763
3781
|
"data-ll-region": t,
|
|
3764
3782
|
"data-ll-intent": r,
|
|
3765
|
-
className:
|
|
3783
|
+
className: l,
|
|
3766
3784
|
style: o
|
|
3767
3785
|
},
|
|
3768
3786
|
s
|
|
@@ -3770,59 +3788,59 @@ const Ki = ({
|
|
|
3770
3788
|
}
|
|
3771
3789
|
);
|
|
3772
3790
|
function Zi(e = {}) {
|
|
3773
|
-
const { onFieldUpdate: t, onComplete: r, source: i = "all" } = e, [
|
|
3791
|
+
const { onFieldUpdate: t, onComplete: r, source: i = "all" } = e, [l, o] = M({}), [s, a] = M(!1), [c, d] = M(null), v = I(t), p = I(r), h = I(i);
|
|
3774
3792
|
P(() => {
|
|
3775
|
-
|
|
3793
|
+
v.current = t, p.current = r, h.current = i;
|
|
3776
3794
|
}, [t, r, i]);
|
|
3777
3795
|
const T = L(() => {
|
|
3778
|
-
o({}),
|
|
3796
|
+
o({}), a(!1);
|
|
3779
3797
|
}, []);
|
|
3780
3798
|
return P(() => {
|
|
3781
3799
|
if (typeof window > "u") return;
|
|
3782
|
-
const
|
|
3783
|
-
var
|
|
3784
|
-
const
|
|
3785
|
-
if (
|
|
3786
|
-
if (
|
|
3787
|
-
if (h.current !== "all" &&
|
|
3800
|
+
const _ = (E) => {
|
|
3801
|
+
var b, R;
|
|
3802
|
+
const g = E.detail;
|
|
3803
|
+
if (g) {
|
|
3804
|
+
if (g.phase === "field") {
|
|
3805
|
+
if (h.current !== "all" && g.source !== h.current)
|
|
3788
3806
|
return;
|
|
3789
|
-
|
|
3790
|
-
(
|
|
3807
|
+
a(!0), o(
|
|
3808
|
+
(k) => k[g.fieldName] === g.value ? k : { ...k, [g.fieldName]: g.value }
|
|
3791
3809
|
);
|
|
3792
3810
|
try {
|
|
3793
|
-
(
|
|
3794
|
-
} catch (
|
|
3795
|
-
console.warn("[LiveLayer] useCollect onFieldUpdate threw.",
|
|
3811
|
+
(b = v.current) == null || b.call(v, g);
|
|
3812
|
+
} catch (k) {
|
|
3813
|
+
console.warn("[LiveLayer] useCollect onFieldUpdate threw.", k);
|
|
3796
3814
|
}
|
|
3797
3815
|
return;
|
|
3798
3816
|
}
|
|
3799
|
-
if (
|
|
3800
|
-
const
|
|
3801
|
-
if (h.current !== "all" &&
|
|
3817
|
+
if (g.phase === "complete") {
|
|
3818
|
+
const k = g.result;
|
|
3819
|
+
if (h.current !== "all" && k.source !== h.current)
|
|
3802
3820
|
return;
|
|
3803
|
-
|
|
3821
|
+
d(k), a(!1);
|
|
3804
3822
|
try {
|
|
3805
|
-
(
|
|
3806
|
-
} catch (
|
|
3807
|
-
console.warn("[LiveLayer] useCollect onComplete threw.",
|
|
3823
|
+
(R = p.current) == null || R.call(p, k);
|
|
3824
|
+
} catch (y) {
|
|
3825
|
+
console.warn("[LiveLayer] useCollect onComplete threw.", y);
|
|
3808
3826
|
}
|
|
3809
3827
|
}
|
|
3810
3828
|
}
|
|
3811
3829
|
};
|
|
3812
|
-
return document.addEventListener("ll-collected",
|
|
3813
|
-
}, []), { fields:
|
|
3830
|
+
return document.addEventListener("ll-collected", _), () => document.removeEventListener("ll-collected", _);
|
|
3831
|
+
}, []), { fields: l, isCollecting: s, lastResult: c, reset: T };
|
|
3814
3832
|
}
|
|
3815
|
-
let
|
|
3833
|
+
let Mn = 1;
|
|
3816
3834
|
function Qi({
|
|
3817
3835
|
onMount: e,
|
|
3818
3836
|
defaultOpen: t = !1,
|
|
3819
3837
|
storageKey: r = "ll-debug-open"
|
|
3820
3838
|
}) {
|
|
3821
|
-
const [i,
|
|
3822
|
-
T.current =
|
|
3839
|
+
const [i, l] = M(t), [o, s] = M([]), [a, c] = M(""), [d, v] = M(!1), p = I(/* @__PURE__ */ new Set()), h = I([]), T = I(d);
|
|
3840
|
+
T.current = d, P(() => {
|
|
3823
3841
|
try {
|
|
3824
|
-
const
|
|
3825
|
-
|
|
3842
|
+
const g = localStorage.getItem(r);
|
|
3843
|
+
g === "1" && l(!0), g === "0" && l(!1);
|
|
3826
3844
|
} catch {
|
|
3827
3845
|
}
|
|
3828
3846
|
}, [r]), P(() => {
|
|
@@ -3831,55 +3849,55 @@ function Qi({
|
|
|
3831
3849
|
} catch {
|
|
3832
3850
|
}
|
|
3833
3851
|
}, [i, r]), P(() => {
|
|
3834
|
-
const
|
|
3835
|
-
(
|
|
3852
|
+
const g = (b) => {
|
|
3853
|
+
(b.metaKey || b.ctrlKey) && b.shiftKey && b.key.toLowerCase() === "l" && (b.preventDefault(), l((R) => !R));
|
|
3836
3854
|
};
|
|
3837
|
-
return window.addEventListener("keydown",
|
|
3855
|
+
return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
|
|
3838
3856
|
}, []), P(() => {
|
|
3839
|
-
const
|
|
3857
|
+
const g = setInterval(() => {
|
|
3840
3858
|
if (h.current.length === 0 || T.current) return;
|
|
3841
|
-
const
|
|
3859
|
+
const b = h.current.splice(0, h.current.length);
|
|
3842
3860
|
s(
|
|
3843
|
-
(
|
|
3861
|
+
(R) => [...b.reverse(), ...R].slice(0, 200)
|
|
3844
3862
|
);
|
|
3845
3863
|
}, 100);
|
|
3846
|
-
return () => clearInterval(
|
|
3864
|
+
return () => clearInterval(g);
|
|
3847
3865
|
}, []);
|
|
3848
|
-
const
|
|
3866
|
+
const _ = I(!1);
|
|
3849
3867
|
if (P(() => {
|
|
3850
|
-
!e ||
|
|
3868
|
+
!e || _.current || (_.current = !0, e((g) => {
|
|
3851
3869
|
h.current.push({
|
|
3852
|
-
id:
|
|
3870
|
+
id: Mn++,
|
|
3853
3871
|
ts: Date.now(),
|
|
3854
3872
|
kind: "event",
|
|
3855
|
-
type:
|
|
3856
|
-
data:
|
|
3873
|
+
type: g.eventName,
|
|
3874
|
+
data: g.data
|
|
3857
3875
|
});
|
|
3858
3876
|
}));
|
|
3859
3877
|
}, [e]), P(() => {
|
|
3860
|
-
const
|
|
3878
|
+
const g = console.warn, b = console.log, R = (k, y) => function(...H) {
|
|
3861
3879
|
try {
|
|
3862
|
-
const
|
|
3863
|
-
|
|
3864
|
-
id:
|
|
3880
|
+
const m = typeof H[0] == "string" ? H[0] : "";
|
|
3881
|
+
m.startsWith("[LiveLayer]") && h.current.push({
|
|
3882
|
+
id: Mn++,
|
|
3865
3883
|
ts: Date.now(),
|
|
3866
|
-
kind:
|
|
3867
|
-
type:
|
|
3868
|
-
data: { args:
|
|
3884
|
+
kind: k,
|
|
3885
|
+
type: m.slice(0, 120),
|
|
3886
|
+
data: { args: H.slice(1).map((D) => Fi(D)) }
|
|
3869
3887
|
});
|
|
3870
3888
|
} catch {
|
|
3871
3889
|
}
|
|
3872
|
-
return
|
|
3890
|
+
return y.apply(this, H);
|
|
3873
3891
|
};
|
|
3874
|
-
return console.warn =
|
|
3875
|
-
console.warn =
|
|
3892
|
+
return console.warn = R("warn", g), console.log = R("log", b), () => {
|
|
3893
|
+
console.warn = g, console.log = b;
|
|
3876
3894
|
};
|
|
3877
3895
|
}, []), !i)
|
|
3878
3896
|
return /* @__PURE__ */ n(
|
|
3879
3897
|
"button",
|
|
3880
3898
|
{
|
|
3881
3899
|
type: "button",
|
|
3882
|
-
onClick: () =>
|
|
3900
|
+
onClick: () => l(!0),
|
|
3883
3901
|
title: "Open LiveLayer debug panel (Cmd/Ctrl + Shift + L)",
|
|
3884
3902
|
"aria-label": "Open LiveLayer debug panel",
|
|
3885
3903
|
style: {
|
|
@@ -3901,10 +3919,10 @@ function Qi({
|
|
|
3901
3919
|
children: "🛰 LL debug"
|
|
3902
3920
|
}
|
|
3903
3921
|
);
|
|
3904
|
-
const
|
|
3905
|
-
if (!
|
|
3906
|
-
const
|
|
3907
|
-
return
|
|
3922
|
+
const E = o.filter((g) => {
|
|
3923
|
+
if (!a) return !0;
|
|
3924
|
+
const b = a.toLowerCase();
|
|
3925
|
+
return g.type.toLowerCase().includes(b) || JSON.stringify(g.data || {}).toLowerCase().includes(b);
|
|
3908
3926
|
});
|
|
3909
3927
|
return /* @__PURE__ */ C(
|
|
3910
3928
|
"div",
|
|
@@ -3951,10 +3969,10 @@ function Qi({
|
|
|
3951
3969
|
"button",
|
|
3952
3970
|
{
|
|
3953
3971
|
type: "button",
|
|
3954
|
-
onClick: () =>
|
|
3955
|
-
style:
|
|
3972
|
+
onClick: () => v((g) => !g),
|
|
3973
|
+
style: Wt(d ? "#f59e0b" : "transparent"),
|
|
3956
3974
|
title: "Pause / resume capture",
|
|
3957
|
-
children:
|
|
3975
|
+
children: d ? "▶ resume" : "⏸ pause"
|
|
3958
3976
|
}
|
|
3959
3977
|
),
|
|
3960
3978
|
/* @__PURE__ */ n(
|
|
@@ -3964,7 +3982,7 @@ function Qi({
|
|
|
3964
3982
|
onClick: () => {
|
|
3965
3983
|
s([]), h.current = [];
|
|
3966
3984
|
},
|
|
3967
|
-
style:
|
|
3985
|
+
style: Wt("transparent"),
|
|
3968
3986
|
title: "Clear buffer",
|
|
3969
3987
|
children: "clear"
|
|
3970
3988
|
}
|
|
@@ -3973,8 +3991,8 @@ function Qi({
|
|
|
3973
3991
|
"button",
|
|
3974
3992
|
{
|
|
3975
3993
|
type: "button",
|
|
3976
|
-
onClick: () =>
|
|
3977
|
-
style:
|
|
3994
|
+
onClick: () => l(!1),
|
|
3995
|
+
style: Wt("transparent"),
|
|
3978
3996
|
"aria-label": "Close",
|
|
3979
3997
|
title: "Close (Cmd/Ctrl + Shift + L)",
|
|
3980
3998
|
children: "✕"
|
|
@@ -3987,8 +4005,8 @@ function Qi({
|
|
|
3987
4005
|
"input",
|
|
3988
4006
|
{
|
|
3989
4007
|
type: "text",
|
|
3990
|
-
value:
|
|
3991
|
-
onChange: (
|
|
4008
|
+
value: a,
|
|
4009
|
+
onChange: (g) => c(g.target.value),
|
|
3992
4010
|
placeholder: "filter by type or data…",
|
|
3993
4011
|
style: {
|
|
3994
4012
|
margin: 8,
|
|
@@ -4010,7 +4028,7 @@ function Qi({
|
|
|
4010
4028
|
overflowY: "auto",
|
|
4011
4029
|
padding: "0 8px 8px"
|
|
4012
4030
|
},
|
|
4013
|
-
children:
|
|
4031
|
+
children: E.length === 0 ? /* @__PURE__ */ C(
|
|
4014
4032
|
"div",
|
|
4015
4033
|
{
|
|
4016
4034
|
style: {
|
|
@@ -4040,16 +4058,16 @@ function Qi({
|
|
|
4040
4058
|
)
|
|
4041
4059
|
]
|
|
4042
4060
|
}
|
|
4043
|
-
) :
|
|
4061
|
+
) : E.map((g) => /* @__PURE__ */ n(
|
|
4044
4062
|
Wi,
|
|
4045
4063
|
{
|
|
4046
|
-
entry:
|
|
4047
|
-
expanded:
|
|
4064
|
+
entry: g,
|
|
4065
|
+
expanded: p.current.has(g.id),
|
|
4048
4066
|
onToggle: () => {
|
|
4049
|
-
|
|
4067
|
+
p.current.has(g.id) ? p.current.delete(g.id) : p.current.add(g.id), s((b) => [...b]);
|
|
4050
4068
|
}
|
|
4051
4069
|
},
|
|
4052
|
-
|
|
4070
|
+
g.id
|
|
4053
4071
|
))
|
|
4054
4072
|
}
|
|
4055
4073
|
)
|
|
@@ -4062,7 +4080,7 @@ function Wi({
|
|
|
4062
4080
|
expanded: t,
|
|
4063
4081
|
onToggle: r
|
|
4064
4082
|
}) {
|
|
4065
|
-
const i = e.kind === "warn" ? "#f59e0b" : e.type.startsWith("[LiveLayer]") ? "#94a3b8" : e.type === "navigate" || e.type === "scroll_page" || e.type === "scroll_to" || e.type === "click" ? "#22c55e" : e.type === "fill_form" || e.type === "submit_form" || e.type === "focus_field" ? "#a78bfa" : e.type === "request_page_context" || e.type === "request_routes" ? "#38bdf8" : e.type === "agent_state" ? "#facc15" : "#cbd5e1",
|
|
4083
|
+
const i = e.kind === "warn" ? "#f59e0b" : e.type.startsWith("[LiveLayer]") ? "#94a3b8" : e.type === "navigate" || e.type === "scroll_page" || e.type === "scroll_to" || e.type === "click" ? "#22c55e" : e.type === "fill_form" || e.type === "submit_form" || e.type === "focus_field" ? "#a78bfa" : e.type === "request_page_context" || e.type === "request_routes" ? "#38bdf8" : e.type === "agent_state" ? "#facc15" : "#cbd5e1", l = new Date(e.ts).toLocaleTimeString("en-US", {
|
|
4066
4084
|
hour12: !1
|
|
4067
4085
|
});
|
|
4068
4086
|
return /* @__PURE__ */ C(
|
|
@@ -4092,7 +4110,7 @@ function Wi({
|
|
|
4092
4110
|
fontVariantNumeric: "tabular-nums",
|
|
4093
4111
|
fontSize: 10
|
|
4094
4112
|
},
|
|
4095
|
-
children:
|
|
4113
|
+
children: l
|
|
4096
4114
|
}
|
|
4097
4115
|
),
|
|
4098
4116
|
/* @__PURE__ */ n(
|
|
@@ -4127,7 +4145,7 @@ function Wi({
|
|
|
4127
4145
|
}
|
|
4128
4146
|
);
|
|
4129
4147
|
}
|
|
4130
|
-
function
|
|
4148
|
+
function Wt(e) {
|
|
4131
4149
|
return {
|
|
4132
4150
|
background: e,
|
|
4133
4151
|
color: "#fff",
|
|
@@ -4150,17 +4168,17 @@ function Bi(e) {
|
|
|
4150
4168
|
P(() => cr(e), [t]);
|
|
4151
4169
|
}
|
|
4152
4170
|
function eo({ fields: e, children: t }) {
|
|
4153
|
-
return Bi(e), /* @__PURE__ */ n(
|
|
4171
|
+
return Bi(e), /* @__PURE__ */ n(We, { children: t });
|
|
4154
4172
|
}
|
|
4155
4173
|
function to() {
|
|
4156
|
-
const [e, t] = M([]), r = L((
|
|
4174
|
+
const [e, t] = M([]), r = L((l) => {
|
|
4157
4175
|
t((o) => {
|
|
4158
|
-
const s = o.findIndex((
|
|
4176
|
+
const s = o.findIndex((a) => a.id === l.id);
|
|
4159
4177
|
if (s >= 0) {
|
|
4160
|
-
const
|
|
4161
|
-
return
|
|
4178
|
+
const a = o.slice();
|
|
4179
|
+
return a[s] = l, a;
|
|
4162
4180
|
}
|
|
4163
|
-
return [...o,
|
|
4181
|
+
return [...o, l];
|
|
4164
4182
|
});
|
|
4165
4183
|
}, []), i = L(() => t([]), []);
|
|
4166
4184
|
return {
|
|
@@ -4180,10 +4198,10 @@ export {
|
|
|
4180
4198
|
io as clearFieldRegistry,
|
|
4181
4199
|
_i as clearPageContextCache,
|
|
4182
4200
|
Si as clearRoutesCache,
|
|
4183
|
-
|
|
4201
|
+
wi as extractPageContext,
|
|
4184
4202
|
ki as extractRoutes,
|
|
4185
|
-
|
|
4186
|
-
|
|
4203
|
+
kn as getCachedPageContext,
|
|
4204
|
+
Ot as getCachedRoutes,
|
|
4187
4205
|
oo as getRegisteredFields,
|
|
4188
4206
|
Fr as matchesPattern,
|
|
4189
4207
|
Li as normalizeRouteInput,
|
|
@@ -4198,11 +4216,11 @@ export {
|
|
|
4198
4216
|
Er as useDisplayModePersistence,
|
|
4199
4217
|
Nr as useIsMobile,
|
|
4200
4218
|
pr as useLiveKitSession,
|
|
4201
|
-
|
|
4219
|
+
wr as useMediaDevices,
|
|
4202
4220
|
gr as useMicrophoneState,
|
|
4203
4221
|
zr as usePathname,
|
|
4204
4222
|
Bi as useRegisterFields,
|
|
4205
4223
|
qr as useRouteMatch,
|
|
4206
|
-
|
|
4224
|
+
br as useScreenShareState,
|
|
4207
4225
|
to as useTranscript
|
|
4208
4226
|
};
|