@streamoji/avatar-widget 0.2.4 → 0.2.6
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/avatar-widget.cjs +5 -5
- package/dist/avatar-widget.cjs.map +1 -1
- package/dist/avatar-widget.css +1 -1
- package/dist/avatar-widget.js +705 -626
- package/dist/avatar-widget.js.map +1 -1
- package/dist/avatar-widget.umd.css +1 -1
- package/dist/avatar-widget.umd.js +161 -161
- package/dist/avatar-widget.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/avatar-widget.js
CHANGED
|
@@ -1,96 +1,100 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useGLTF as
|
|
3
|
-
import { useFrame as
|
|
4
|
-
import { memo as
|
|
5
|
-
import * as
|
|
6
|
-
import { GLTFLoader as
|
|
7
|
-
const
|
|
8
|
-
},
|
|
9
|
-
},
|
|
10
|
-
const A =
|
|
11
|
-
return
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
14
|
-
const
|
|
15
|
-
if (!
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
(!
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
for (let
|
|
30
|
-
let
|
|
31
|
-
if (
|
|
32
|
-
const
|
|
33
|
-
for (let
|
|
34
|
-
const
|
|
35
|
-
|
|
1
|
+
import { jsx as l, jsxs as oe } from "react/jsx-runtime";
|
|
2
|
+
import { useGLTF as ct, Environment as zt } from "@react-three/drei";
|
|
3
|
+
import { useFrame as Yt, Canvas as Qt, useThree as Xt } from "@react-three/fiber";
|
|
4
|
+
import { memo as Kt, useMemo as dt, useRef as c, useState as b, useEffect as P, useCallback as Qe, useLayoutEffect as Zt, Suspense as en } from "react";
|
|
5
|
+
import * as Ve from "three";
|
|
6
|
+
import { GLTFLoader as tn } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
7
|
+
const lt = "https://ai.streamoji.com", B = (...f) => {
|
|
8
|
+
}, nn = (...f) => {
|
|
9
|
+
}, Tt = ({ analyser: f }) => {
|
|
10
|
+
const A = c(null), w = c(null);
|
|
11
|
+
return P(() => {
|
|
12
|
+
const g = A.current;
|
|
13
|
+
if (!g) return;
|
|
14
|
+
const T = g.getContext("2d", { alpha: !0 });
|
|
15
|
+
if (!T) return;
|
|
16
|
+
let V, E = null;
|
|
17
|
+
f && (f.fftSize = 128, E = new Uint8Array(f.frequencyBinCount));
|
|
18
|
+
const ee = () => {
|
|
19
|
+
V = requestAnimationFrame(ee), (g.width !== g.offsetWidth || g.height !== g.offsetHeight) && (g.width = g.offsetWidth, g.height = g.offsetHeight);
|
|
20
|
+
const ae = g.width, N = g.height;
|
|
21
|
+
if (ae === 0 || N === 0) return;
|
|
22
|
+
const U = N / 2;
|
|
23
|
+
T.clearRect(0, 0, ae, N), T.fillStyle = "#1e293b";
|
|
24
|
+
const _ = 2, m = _ + 2, Y = ae * 0.95, $ = Math.floor(Y / m);
|
|
25
|
+
(!w.current || w.current.length !== $) && (w.current = new Float32Array($).fill(2));
|
|
26
|
+
const pe = $ * m, k = (ae - pe) / 2;
|
|
27
|
+
f && E && f.getByteFrequencyData(E);
|
|
28
|
+
const He = E ? E.length : 0, q = Math.floor(He * 0.7) / $, ge = new Float32Array($);
|
|
29
|
+
for (let I = 0; I < $; I++) {
|
|
30
|
+
let C = 0;
|
|
31
|
+
if (E && q > 0) {
|
|
32
|
+
const be = Math.floor(I * q), L = Math.floor((I + 1) * q);
|
|
33
|
+
for (let v = be; v < L; v++) {
|
|
34
|
+
const y = E[v] || 0;
|
|
35
|
+
y > C && (C = y);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
38
|
+
C < 10 && (C = 0);
|
|
39
|
+
const W = C / 255, M = C > 0 ? Math.max(2, Math.pow(W, 1.4) * N * 0.25) : 2;
|
|
40
|
+
ge[I] = M;
|
|
41
41
|
}
|
|
42
|
-
for (let
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
42
|
+
for (let I = 0; I < $; I++) {
|
|
43
|
+
const C = $ - 1 - I, W = Math.max(ge[I], ge[C]), M = w.current[I] + (W - w.current[I]) * 0.3;
|
|
44
|
+
w.current[I] = M;
|
|
45
|
+
const be = k + I * m, L = U - M / 2;
|
|
46
|
+
T.beginPath(), T.roundRect ? T.roundRect(be, L, _, M, 4) : T.fillRect(be, L, _, M), T.fill();
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
return
|
|
50
|
-
cancelAnimationFrame(
|
|
49
|
+
return ee(), () => {
|
|
50
|
+
cancelAnimationFrame(V);
|
|
51
51
|
};
|
|
52
|
-
}, [
|
|
52
|
+
}, [f]), /* @__PURE__ */ l(
|
|
53
53
|
"canvas",
|
|
54
54
|
{
|
|
55
55
|
ref: A,
|
|
56
56
|
style: { width: "100%", height: "100%", display: "block" }
|
|
57
57
|
}
|
|
58
58
|
);
|
|
59
|
-
},
|
|
60
|
-
async function
|
|
59
|
+
}, rn = "https://pub-48df6f7d60d6440bbd01676ea5d90e55.r2.dev", Et = "https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/default-models/fullbodyavatarmale.glb";
|
|
60
|
+
async function sn(f) {
|
|
61
61
|
const A = await crypto.subtle.digest(
|
|
62
62
|
"SHA-256",
|
|
63
|
-
new TextEncoder().encode(
|
|
63
|
+
new TextEncoder().encode(f)
|
|
64
64
|
);
|
|
65
|
-
return Array.from(new Uint8Array(A)).map((
|
|
65
|
+
return Array.from(new Uint8Array(A)).map((w) => w.toString(16).padStart(2, "0")).join("");
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
const [A,
|
|
69
|
-
return
|
|
70
|
-
if (!
|
|
71
|
-
|
|
67
|
+
function on(f) {
|
|
68
|
+
const [A, w] = b(null);
|
|
69
|
+
return P(() => {
|
|
70
|
+
if (!f) {
|
|
71
|
+
w(null);
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
|
-
let
|
|
75
|
-
return
|
|
76
|
-
if (
|
|
77
|
-
const
|
|
78
|
-
fetch(
|
|
79
|
-
|
|
74
|
+
let g = !1;
|
|
75
|
+
return sn(f).then((T) => {
|
|
76
|
+
if (g) return;
|
|
77
|
+
const V = `${rn}/${T}.glb`;
|
|
78
|
+
fetch(V, { method: "HEAD" }).then((E) => {
|
|
79
|
+
g || w(E.ok ? V : Et);
|
|
80
80
|
}).catch(() => {
|
|
81
|
-
|
|
81
|
+
g || w(Et);
|
|
82
82
|
});
|
|
83
83
|
}), () => {
|
|
84
|
-
|
|
84
|
+
g = !0;
|
|
85
85
|
};
|
|
86
|
-
}, [
|
|
86
|
+
}, [f]), A;
|
|
87
87
|
}
|
|
88
|
-
const
|
|
88
|
+
const an = [
|
|
89
89
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/M_Standing_Idle_Variations_001.glb",
|
|
90
90
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/M_Standing_Idle_Variations_002.glb",
|
|
91
91
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/M_Standing_Idle_002.glb",
|
|
92
92
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/M_Standing_Idle_Variations_005.glb"
|
|
93
|
-
],
|
|
93
|
+
], cn = [
|
|
94
|
+
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/F_Standing_Idle_Variations_001.glb",
|
|
95
|
+
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/F_Standing_Idle_Variations_003.glb",
|
|
96
|
+
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/idle/F_Standing_Idle_Variations_003.glb"
|
|
97
|
+
], ln = [
|
|
94
98
|
{
|
|
95
99
|
id: "m_expr_01",
|
|
96
100
|
name: "Friendly Wave",
|
|
@@ -256,17 +260,17 @@ const jt = [
|
|
|
256
260
|
name: "Take It Easy",
|
|
257
261
|
url: "https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/F_Talking_Variations_006.glb"
|
|
258
262
|
}
|
|
259
|
-
],
|
|
263
|
+
], un = [
|
|
260
264
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_005.glb",
|
|
261
265
|
"https://pub-be53cae7bd99457a8c1f11b4d38f1672.r2.dev/masculine/expression/M_Talking_Variations_007.glb"
|
|
262
|
-
],
|
|
266
|
+
], dn = {
|
|
263
267
|
zoom: 0.85,
|
|
264
268
|
position: [0.15, -0.8, 0],
|
|
265
269
|
scale: 1.5,
|
|
266
270
|
rotation: [0.15, 0.02, 0]
|
|
267
|
-
},
|
|
271
|
+
}, fn = [-0.45, 1.9, 0.1], hn = {
|
|
268
272
|
browInnerUp: 0.2
|
|
269
|
-
},
|
|
273
|
+
}, ut = 0.18, mn = 1, It = "__branding__", Xe = {
|
|
270
274
|
neutral: { eyeLookDownLeft: 0.1, eyeLookDownRight: 0.1 },
|
|
271
275
|
happy: {
|
|
272
276
|
mouthSmileLeft: 0.2,
|
|
@@ -348,7 +352,7 @@ const jt = [
|
|
|
348
352
|
mouthUpperUpLeft: 0.1,
|
|
349
353
|
mouthUpperUpRight: 0.1
|
|
350
354
|
}
|
|
351
|
-
},
|
|
355
|
+
}, pn = [
|
|
352
356
|
{ key: "viseme_aa", mix: { jawOpen: 0.6 } },
|
|
353
357
|
{
|
|
354
358
|
key: "viseme_E",
|
|
@@ -444,7 +448,7 @@ const jt = [
|
|
|
444
448
|
}
|
|
445
449
|
},
|
|
446
450
|
{ key: "viseme_sil", mix: {} }
|
|
447
|
-
],
|
|
451
|
+
], gn = {
|
|
448
452
|
aei: [
|
|
449
453
|
{ v: "E", w: 0.8 },
|
|
450
454
|
{ v: "I", w: 0.2 }
|
|
@@ -473,317 +477,333 @@ const jt = [
|
|
|
473
477
|
],
|
|
474
478
|
sil: [{ v: "sil", w: 1 }]
|
|
475
479
|
};
|
|
476
|
-
function
|
|
477
|
-
if (!
|
|
478
|
-
const A =
|
|
479
|
-
return
|
|
480
|
+
function bn(f) {
|
|
481
|
+
if (!f) return [{ v: "sil", w: 1 }];
|
|
482
|
+
const A = f.toLowerCase();
|
|
483
|
+
return gn[A] ?? [{ v: "sil", w: 1 }];
|
|
480
484
|
}
|
|
481
|
-
function
|
|
482
|
-
const { camera: A } =
|
|
483
|
-
return
|
|
484
|
-
A.lookAt(...
|
|
485
|
-
}, [A,
|
|
485
|
+
function _n({ target: f }) {
|
|
486
|
+
const { camera: A } = Xt();
|
|
487
|
+
return P(() => {
|
|
488
|
+
A.lookAt(...f);
|
|
489
|
+
}, [A, f]), null;
|
|
486
490
|
}
|
|
487
|
-
function
|
|
488
|
-
if (!
|
|
491
|
+
function z(f, A, w) {
|
|
492
|
+
if (!f || !f.morphTargetDictionary)
|
|
489
493
|
return;
|
|
490
|
-
const
|
|
491
|
-
if (
|
|
492
|
-
for (const
|
|
493
|
-
|
|
494
|
+
const g = f, T = g.morphTargetDictionary, V = g.morphTargetInfluences;
|
|
495
|
+
if (V)
|
|
496
|
+
for (const E in T)
|
|
497
|
+
E.toLowerCase() === A.toLowerCase() && (V[T[E]] = w);
|
|
494
498
|
}
|
|
495
|
-
function
|
|
496
|
-
if (!
|
|
497
|
-
const
|
|
498
|
-
if (
|
|
499
|
-
for (let
|
|
500
|
-
|
|
499
|
+
function Mt(f, A = 0.97) {
|
|
500
|
+
if (!f) return;
|
|
501
|
+
const w = f;
|
|
502
|
+
if (w.morphTargetInfluences)
|
|
503
|
+
for (let g = 0; g < w.morphTargetInfluences.length; g++)
|
|
504
|
+
w.morphTargetInfluences[g] *= A;
|
|
501
505
|
}
|
|
502
|
-
const
|
|
506
|
+
const wn = Kt(
|
|
503
507
|
({
|
|
504
|
-
avatarUrl:
|
|
508
|
+
avatarUrl: f,
|
|
505
509
|
isPlayingRef: A,
|
|
506
|
-
visemeQueueRef:
|
|
507
|
-
audioContextRef:
|
|
508
|
-
responseAudioStartTimeRef:
|
|
509
|
-
adjustments:
|
|
510
|
-
mood:
|
|
511
|
-
expression:
|
|
512
|
-
agentResponse:
|
|
513
|
-
isSpeaking:
|
|
514
|
-
nextStartTimeRef:
|
|
515
|
-
stopPlayback:
|
|
516
|
-
setIsSpeaking:
|
|
517
|
-
expressionUrl:
|
|
518
|
-
onExpressionFinished:
|
|
510
|
+
visemeQueueRef: w,
|
|
511
|
+
audioContextRef: g,
|
|
512
|
+
responseAudioStartTimeRef: T,
|
|
513
|
+
adjustments: V,
|
|
514
|
+
mood: E,
|
|
515
|
+
expression: ee,
|
|
516
|
+
agentResponse: ae,
|
|
517
|
+
isSpeaking: N,
|
|
518
|
+
nextStartTimeRef: U,
|
|
519
|
+
stopPlayback: _,
|
|
520
|
+
setIsSpeaking: ce,
|
|
521
|
+
expressionUrl: m,
|
|
522
|
+
onExpressionFinished: Y,
|
|
523
|
+
isNudgeResponse: $,
|
|
524
|
+
avatarGender: pe
|
|
519
525
|
}) => {
|
|
520
|
-
const { scene:
|
|
521
|
-
() => xe.flatMap((
|
|
526
|
+
const { scene: k } = ct(f), xe = ct(pe === "female" ? cn : an), q = dt(
|
|
527
|
+
() => xe.flatMap((d) => d.animations),
|
|
522
528
|
[xe]
|
|
523
|
-
),
|
|
524
|
-
() =>
|
|
525
|
-
[
|
|
526
|
-
),
|
|
527
|
-
|
|
528
|
-
if (!(!
|
|
529
|
-
if (
|
|
530
|
-
const
|
|
531
|
-
if (!
|
|
532
|
-
const
|
|
533
|
-
|
|
529
|
+
), ge = ct(un), I = dt(
|
|
530
|
+
() => ge.flatMap((d) => d.animations),
|
|
531
|
+
[ge]
|
|
532
|
+
), C = c(null), W = c(null), M = c(null), be = c([]), [L] = b(() => new Ve.AnimationMixer(k)), v = c({}), y = c(null), _e = c(0), Ie = c(!1), we = c(0), le = c(null);
|
|
533
|
+
P(() => {
|
|
534
|
+
if (!(!q || !k)) {
|
|
535
|
+
if (q.forEach((d, u) => {
|
|
536
|
+
const i = `idle_${u}`;
|
|
537
|
+
if (!v.current[i]) {
|
|
538
|
+
const r = L.clipAction(d, k);
|
|
539
|
+
r.name = i, r.setLoop(Ve.LoopOnce, 1), r.clampWhenFinished = !0, v.current[i] = r;
|
|
534
540
|
}
|
|
535
|
-
}),
|
|
536
|
-
const
|
|
537
|
-
if (!
|
|
538
|
-
const
|
|
539
|
-
|
|
541
|
+
}), I.forEach((d, u) => {
|
|
542
|
+
const i = `talk_${u}`;
|
|
543
|
+
if (!v.current[i]) {
|
|
544
|
+
const r = L.clipAction(d, k);
|
|
545
|
+
r.name = i, r.setLoop(Ve.LoopOnce, 1), r.clampWhenFinished = !0, v.current[i] = r;
|
|
540
546
|
}
|
|
541
|
-
}),
|
|
542
|
-
const
|
|
543
|
-
|
|
547
|
+
}), q.length > 0) {
|
|
548
|
+
const d = v.current.idle_0, u = y.current && L.existingAction(y.current.getClip());
|
|
549
|
+
d && !u && (d.reset().fadeIn(0.5).play(), y.current = d);
|
|
544
550
|
}
|
|
545
551
|
return () => {
|
|
546
|
-
L.stopAllAction(),
|
|
552
|
+
L.stopAllAction(), v.current = {}, y.current = null;
|
|
547
553
|
};
|
|
548
554
|
}
|
|
549
|
-
}, [
|
|
550
|
-
const
|
|
551
|
-
|
|
552
|
-
if (!
|
|
553
|
-
|
|
554
|
-
|
|
555
|
+
}, [q, I, k, L]);
|
|
556
|
+
const ve = c("");
|
|
557
|
+
P(() => {
|
|
558
|
+
if (!m || !k || m === ve.current) return;
|
|
559
|
+
ve.current = m, le.current = m, new tn().load(
|
|
560
|
+
m,
|
|
555
561
|
(u) => {
|
|
556
562
|
if (u.animations && u.animations.length > 0) {
|
|
557
|
-
const
|
|
558
|
-
if (
|
|
559
|
-
const h =
|
|
560
|
-
|
|
563
|
+
const i = u.animations[0], r = L.clipAction(i, k);
|
|
564
|
+
if (r.name = `EXPR_${m}`, r.setLoop(Ve.LoopOnce, 1), r.clampWhenFinished = !0, v.current[`EXPR_${m}`] = r, N && le.current === m) {
|
|
565
|
+
const h = y.current;
|
|
566
|
+
r.reset().fadeIn(0.3).play(), h && h !== r && h.crossFadeTo(r, 0.3, !0), y.current = r, le.current = null;
|
|
561
567
|
}
|
|
562
568
|
}
|
|
563
569
|
},
|
|
564
570
|
void 0,
|
|
565
571
|
(u) => {
|
|
566
|
-
console.error(`[ANIMATION] Failed to load ${
|
|
572
|
+
console.error(`[ANIMATION] Failed to load ${m}`, u);
|
|
567
573
|
}
|
|
568
574
|
);
|
|
569
|
-
}, [
|
|
570
|
-
const
|
|
571
|
-
const
|
|
572
|
-
if (
|
|
573
|
-
const
|
|
574
|
-
|
|
575
|
-
} else if (
|
|
576
|
-
if (
|
|
577
|
-
const h =
|
|
578
|
-
h && (h.reset().fadeIn(0.5).play(),
|
|
575
|
+
}, [m, k, L, N]), P(() => {
|
|
576
|
+
const d = (u) => {
|
|
577
|
+
const i = u.action, r = i.name || "";
|
|
578
|
+
if (r.startsWith("idle_")) {
|
|
579
|
+
const G = (parseInt(r.split("_")[1]) + 1) % q.length, Q = v.current[`idle_${G}`];
|
|
580
|
+
Q && (Q.reset().fadeIn(0.5).play(), i.crossFadeTo(Q, 0.5, !0), y.current = Q);
|
|
581
|
+
} else if (r.startsWith("EXPR_")) {
|
|
582
|
+
if (N) {
|
|
583
|
+
const h = v.current.talk_0;
|
|
584
|
+
h && (h.reset().fadeIn(0.5).play(), i.crossFadeTo(h, 0.5, !0), y.current = h);
|
|
579
585
|
} else {
|
|
580
|
-
const h =
|
|
581
|
-
h && (h.reset().fadeIn(0.5).play(),
|
|
586
|
+
const h = v.current.idle_0;
|
|
587
|
+
h && (h.reset().fadeIn(0.5).play(), i.crossFadeTo(h, 0.5, !0), y.current = h);
|
|
582
588
|
}
|
|
583
|
-
|
|
584
|
-
} else if (
|
|
585
|
-
if (
|
|
586
|
-
const
|
|
587
|
-
|
|
589
|
+
Y && Y();
|
|
590
|
+
} else if (r.startsWith("talk_"))
|
|
591
|
+
if (N && !$) {
|
|
592
|
+
const G = (parseInt(r.split("_")[1]) + 1) % I.length, Q = v.current[`talk_${G}`];
|
|
593
|
+
Q && (Q.reset().fadeIn(0.3).play(), i.crossFadeTo(Q, 0.3, !0), y.current = Q);
|
|
588
594
|
} else {
|
|
589
|
-
const h =
|
|
590
|
-
h && (h.reset().fadeIn(0.5).play(),
|
|
595
|
+
const h = v.current.idle_0;
|
|
596
|
+
h && (h.reset().fadeIn(0.5).play(), i.crossFadeTo(h, 0.5, !0), y.current = h);
|
|
591
597
|
}
|
|
592
598
|
};
|
|
593
|
-
return L.addEventListener("finished",
|
|
599
|
+
return L.addEventListener("finished", d), () => L.removeEventListener("finished", d);
|
|
594
600
|
}, [
|
|
595
601
|
L,
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
602
|
+
q,
|
|
603
|
+
I,
|
|
604
|
+
N,
|
|
605
|
+
$,
|
|
606
|
+
Y
|
|
607
|
+
]), P(() => {
|
|
608
|
+
if (N && k) {
|
|
609
|
+
const d = y.current, u = d?.name || "";
|
|
603
610
|
if (u.startsWith("idle_") || u.startsWith("talk_") || u === "") {
|
|
604
|
-
const
|
|
605
|
-
if (
|
|
606
|
-
const
|
|
607
|
-
if (
|
|
608
|
-
|
|
611
|
+
const i = le.current;
|
|
612
|
+
if (i) {
|
|
613
|
+
const r = v.current[`EXPR_${i}`];
|
|
614
|
+
if (r) {
|
|
615
|
+
r.reset().fadeIn(0.3).play(), d && d !== r && d.crossFadeTo(r, 0.3, !0), y.current = r, le.current = null;
|
|
609
616
|
return;
|
|
610
617
|
}
|
|
611
618
|
}
|
|
612
619
|
if (u.startsWith("idle_") || u === "") {
|
|
613
|
-
const
|
|
614
|
-
|
|
620
|
+
const r = v.current.talk_0;
|
|
621
|
+
r && (r.reset().fadeIn(0.5).play(), d && d.crossFadeTo(r, 0.5, !0), y.current = r);
|
|
615
622
|
}
|
|
616
623
|
}
|
|
617
|
-
} else if (!
|
|
618
|
-
const
|
|
624
|
+
} else if (!N && k) {
|
|
625
|
+
const d = y.current, u = d?.name || "";
|
|
619
626
|
if (u.startsWith("talk_") || u.startsWith("EXPR_")) {
|
|
620
|
-
const
|
|
621
|
-
|
|
627
|
+
const i = v.current.idle_0;
|
|
628
|
+
i && (i.reset().fadeIn(0.5).play(), d && d.crossFadeTo(i, 0.5, !0), y.current = i);
|
|
622
629
|
}
|
|
623
630
|
}
|
|
624
|
-
}, [
|
|
625
|
-
if (!
|
|
626
|
-
|
|
627
|
-
if (
|
|
628
|
-
const
|
|
629
|
-
(
|
|
631
|
+
}, [N, k, m]), P(() => {
|
|
632
|
+
if (!k) return;
|
|
633
|
+
k.traverse((i) => {
|
|
634
|
+
if (i.isMesh && i.morphTargetDictionary) {
|
|
635
|
+
const r = i.name.toLowerCase();
|
|
636
|
+
(r.includes("head") || r.includes("avatar")) && (W.current = i, B(`[ANIMATION] Found head mesh: ${i.name}`)), r.includes("teeth") && (M.current = i, B(`[ANIMATION] Found teeth mesh: ${i.name}`));
|
|
630
637
|
}
|
|
631
638
|
});
|
|
632
|
-
const
|
|
633
|
-
|
|
634
|
-
(
|
|
639
|
+
const d = W.current?.morphTargetDictionary;
|
|
640
|
+
d && Object.keys(d).filter(
|
|
641
|
+
(i) => i.toLowerCase().includes("brow")
|
|
635
642
|
);
|
|
636
643
|
const u = [];
|
|
637
|
-
|
|
638
|
-
if (
|
|
639
|
-
const h =
|
|
640
|
-
h && Object.keys(h).some((
|
|
644
|
+
k.traverse((i) => {
|
|
645
|
+
if (i.isMesh) {
|
|
646
|
+
const h = i.morphTargetDictionary;
|
|
647
|
+
h && Object.keys(h).some((G) => G.toLowerCase().includes("brow")) && u.push(i);
|
|
641
648
|
}
|
|
642
|
-
}),
|
|
643
|
-
}, [
|
|
644
|
-
const
|
|
645
|
-
const
|
|
646
|
-
if (
|
|
647
|
-
for (const h in
|
|
648
|
-
const
|
|
649
|
-
|
|
649
|
+
}), be.current = u, u.length > 0 && B("[ANIMATION] Meshes with brow morphs:", u.length);
|
|
650
|
+
}, [k]);
|
|
651
|
+
const Ne = (d, u = 1) => {
|
|
652
|
+
const i = `viseme_${d}`.toLowerCase(), r = pn.find((h) => h.key.toLowerCase() === i);
|
|
653
|
+
if (r)
|
|
654
|
+
for (const h in r.mix) {
|
|
655
|
+
const G = r.mix[h] * u;
|
|
656
|
+
z(W.current, h, G), z(M.current, h, G);
|
|
650
657
|
}
|
|
651
|
-
},
|
|
652
|
-
const u =
|
|
653
|
-
for (const
|
|
654
|
-
|
|
658
|
+
}, ke = (d) => {
|
|
659
|
+
const u = Xe[d] ?? Xe.neutral;
|
|
660
|
+
for (const i in u)
|
|
661
|
+
z(W.current, i, u[i]), z(M.current, i, u[i]);
|
|
655
662
|
};
|
|
656
|
-
return
|
|
657
|
-
const
|
|
658
|
-
|
|
659
|
-
const
|
|
663
|
+
return Yt((d, u) => {
|
|
664
|
+
const i = Math.pow(0.88, 60 * u);
|
|
665
|
+
Mt(W.current, i), Mt(M.current, i), ke(E);
|
|
666
|
+
const r = d.clock.elapsedTime;
|
|
660
667
|
let h = 0;
|
|
661
|
-
if (Math.floor(
|
|
668
|
+
if (Math.floor(r) % 5 === 0 && Math.floor((r - u) % 5) !== 0) {
|
|
662
669
|
let J = null;
|
|
663
|
-
|
|
664
|
-
|
|
670
|
+
k.traverse((ne) => {
|
|
671
|
+
ne.name.toLowerCase().includes("hips") && (J = ne);
|
|
665
672
|
});
|
|
666
|
-
const
|
|
667
|
-
|
|
673
|
+
const ye = J ? `Hips Y: ${J.position.y.toFixed(4)}` : "Hips not found";
|
|
674
|
+
B(`[ANIMATION] Mixer Time: ${L.time.toFixed(2)}, ${ye}`);
|
|
668
675
|
}
|
|
669
|
-
if (L.update(u),
|
|
670
|
-
const
|
|
671
|
-
if (
|
|
672
|
-
|
|
676
|
+
if (L.update(u), r > _e.current && !Ie.current && (Ie.current = !0, we.current = r), Ie.current) {
|
|
677
|
+
const ye = (r - we.current) / 0.3;
|
|
678
|
+
if (ye >= 1)
|
|
679
|
+
Ie.current = !1, _e.current = r + 2 + Math.random() * 5;
|
|
673
680
|
else {
|
|
674
|
-
const
|
|
675
|
-
|
|
681
|
+
const ne = ye < 0.5 ? ye * 2 : (1 - ye) * 2;
|
|
682
|
+
z(W.current, "eyeBlinkLeft", ne), z(W.current, "eyeBlinkRight", ne), z(M.current, "eyeBlinkLeft", ne), z(M.current, "eyeBlinkRight", ne), h = ne * hn.browInnerUp;
|
|
676
683
|
}
|
|
677
684
|
}
|
|
678
|
-
const
|
|
679
|
-
if (
|
|
680
|
-
const J = A.current ? 0 :
|
|
681
|
-
|
|
682
|
-
|
|
685
|
+
const G = Xe[E] ?? Xe.neutral, Q = G.browInnerUp ?? 0, Ke = G.browOuterUpLeft ?? 0, $e = G.browOuterUpRight ?? 0, Ue = r * mn, Re = ut * Math.sin(Ue), K = ut * 0.7 * Math.sin(Ue + 0.7), je = ut * 0.7 * Math.sin(Ue + 1.3), te = (J) => Math.max(0, Math.min(1, J)), Ae = te(Q + Re), Le = te(Ke + K), Be = te($e + je), Me = te(Ae + h);
|
|
686
|
+
if (z(W.current, "browInnerUp", Me), z(M.current, "browInnerUp", Me), z(W.current, "browOuterUpLeft", Le), z(M.current, "browOuterUpLeft", Le), z(W.current, "browOuterUpRight", Be), z(M.current, "browOuterUpRight", Be), C.current) {
|
|
687
|
+
const J = A.current ? 0 : V.rotation[1];
|
|
688
|
+
C.current.rotation.y = Ve.MathUtils.lerp(
|
|
689
|
+
C.current.rotation.y,
|
|
683
690
|
J,
|
|
684
691
|
0.1
|
|
685
|
-
),
|
|
692
|
+
), C.current.position.set(...V.position), C.current.scale.setScalar(V.scale), C.current.rotation.x = V.rotation[0], C.current.rotation.z = V.rotation[2];
|
|
686
693
|
}
|
|
687
|
-
if (A.current &&
|
|
688
|
-
const J =
|
|
689
|
-
for (let
|
|
690
|
-
const
|
|
691
|
-
|
|
694
|
+
if (A.current && g.current) {
|
|
695
|
+
const J = g.current.currentTime, De = (J - T.current) * 1e3 - -150;
|
|
696
|
+
for (let Z = 0; Z < w.current.length; Z++) {
|
|
697
|
+
const re = w.current[Z];
|
|
698
|
+
De >= re.vtime && De < re.vtime + re.vduration && Ne(re.viseme, re.weight ?? 1);
|
|
692
699
|
}
|
|
693
|
-
J >
|
|
700
|
+
J > U.current + 0.5 && (_(), ce(!1));
|
|
694
701
|
}
|
|
695
|
-
}), /* @__PURE__ */
|
|
702
|
+
}), /* @__PURE__ */ l("group", { ref: C, children: /* @__PURE__ */ l("primitive", { object: k }) });
|
|
696
703
|
}
|
|
697
704
|
);
|
|
698
|
-
function
|
|
699
|
-
return
|
|
705
|
+
function vn(f) {
|
|
706
|
+
return f ? f.charAt(0).toUpperCase() + f.slice(1).toLowerCase() : "";
|
|
700
707
|
}
|
|
701
|
-
const
|
|
702
|
-
token:
|
|
708
|
+
const yn = ({
|
|
709
|
+
token: f,
|
|
703
710
|
agentToken: A,
|
|
704
|
-
onNavigationRequested:
|
|
711
|
+
onNavigationRequested: w,
|
|
712
|
+
avatarGender: g
|
|
705
713
|
} = {}) => {
|
|
706
|
-
const
|
|
714
|
+
const T = f ?? A ?? "", V = on(T || void 0), [E, ee] = b(""), [ae, N] = b(""), [U, _] = b("Ready"), [ce, m] = b(!1), [Y, $] = b(!1), [pe, k] = b([]), [He, xe] = b(""), q = c(null), [ge, I] = b(
|
|
707
715
|
() => typeof window < "u" ? window.matchMedia("(max-width: 480px)").matches : !1
|
|
708
716
|
);
|
|
709
|
-
|
|
710
|
-
const e = window.matchMedia("(max-width: 480px)"), t = () =>
|
|
717
|
+
P(() => {
|
|
718
|
+
const e = window.matchMedia("(max-width: 480px)"), t = () => I(e.matches);
|
|
711
719
|
return e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
712
720
|
}, []);
|
|
713
|
-
const
|
|
714
|
-
|
|
715
|
-
const
|
|
721
|
+
const C = ge ? 80 : 600, W = c(!1), M = c([]), be = c(0), L = c(!1), v = c([]), y = c(null), _e = c([]);
|
|
722
|
+
c([]);
|
|
723
|
+
const Ie = c([]), we = c(0), le = c(0), ve = c(0), Ne = c(0), ke = c(!1), [d, u] = b(
|
|
716
724
|
null
|
|
717
|
-
),
|
|
725
|
+
), i = c(null), [r, h] = b("neutral"), [G, Q] = b(""), [Ke, $e] = b(""), [Ue, Re] = b("Chat with us"), [K, je] = b(
|
|
718
726
|
null
|
|
719
|
-
), [
|
|
720
|
-
|
|
721
|
-
const [
|
|
722
|
-
|
|
723
|
-
const
|
|
724
|
-
|
|
725
|
-
|
|
727
|
+
), [te, Ae] = b("hidden"), [Le, Be] = b(""), Me = c(null), J = c(te);
|
|
728
|
+
J.current = te;
|
|
729
|
+
const [ye, ne] = b(null), De = c(null), Z = c(null), [re, ft] = b(!1), ht = c(null), [ue, Je] = b("hidden"), [mt, Dt] = b(""), Ze = c(ue);
|
|
730
|
+
Ze.current = ue;
|
|
731
|
+
const he = c(""), Ce = c(!1), Oe = c(""), pt = c(Date.now()), et = c([]), Pe = c(!1), [tt, We] = b(!1), [gt, bt] = b(!1), Se = c(null), Fe = dt(() => re ? "Try again" : U === "Busy" ? "Busy" : U === "Thinking..." || U === "Processing Voice..." ? U : K != null && K !== "" && K !== "none" && K !== "<none>" ? `Enter ${vn(K)}` : ue !== "hidden" || !gt ? null : It, [U, K, re, ue, gt]), _t = !re && U !== "Busy" && U !== "Thinking..." && U !== "Processing Voice..." && (K == null || K === "" || K === "none" || K === "<none>");
|
|
732
|
+
P(() => {
|
|
733
|
+
if (ue !== "hidden" || !_t) {
|
|
734
|
+
bt(!1), Se.current != null && (clearTimeout(Se.current), Se.current = null);
|
|
735
|
+
return;
|
|
736
|
+
}
|
|
737
|
+
return Se.current = setTimeout(() => {
|
|
738
|
+
Se.current = null, bt(!0);
|
|
739
|
+
}, 400), () => {
|
|
740
|
+
Se.current != null && (clearTimeout(Se.current), Se.current = null);
|
|
741
|
+
};
|
|
742
|
+
}, [ue, _t]);
|
|
743
|
+
const qe = Fe != null && Fe !== "";
|
|
744
|
+
P(() => {
|
|
745
|
+
const e = J.current;
|
|
726
746
|
if (!(e === "exiting" || e === "entering")) {
|
|
727
747
|
if (e === "hidden") {
|
|
728
|
-
|
|
748
|
+
qe && (Be(Fe ?? ""), Ae("entering"));
|
|
729
749
|
return;
|
|
730
750
|
}
|
|
731
|
-
e === "visible" && (!
|
|
751
|
+
e === "visible" && (!qe || Fe !== Le) && (Me.current = qe ? Fe : null, Ae("exiting"));
|
|
732
752
|
}
|
|
733
753
|
}, [
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
]),
|
|
739
|
-
if (
|
|
740
|
-
|
|
754
|
+
qe,
|
|
755
|
+
Fe,
|
|
756
|
+
te,
|
|
757
|
+
Le
|
|
758
|
+
]), P(() => {
|
|
759
|
+
if (U !== "Busy") {
|
|
760
|
+
Z.current != null && (clearTimeout(Z.current), Z.current = null);
|
|
741
761
|
return;
|
|
742
762
|
}
|
|
743
|
-
return
|
|
744
|
-
|
|
763
|
+
return Z.current = setTimeout(() => {
|
|
764
|
+
Z.current = null, _("Ready"), ft(!0);
|
|
745
765
|
}, 12e3), () => {
|
|
746
|
-
|
|
766
|
+
Z.current != null && (clearTimeout(Z.current), Z.current = null);
|
|
747
767
|
};
|
|
748
|
-
}, [
|
|
749
|
-
if (!
|
|
750
|
-
const e = setTimeout(() =>
|
|
768
|
+
}, [U]), P(() => {
|
|
769
|
+
if (!re) return;
|
|
770
|
+
const e = setTimeout(() => ft(!1), 2500);
|
|
751
771
|
return () => clearTimeout(e);
|
|
752
|
-
}, [
|
|
753
|
-
const
|
|
754
|
-
const e =
|
|
772
|
+
}, [re]);
|
|
773
|
+
const Ct = Qe(() => {
|
|
774
|
+
const e = J.current;
|
|
755
775
|
if (e === "exiting") {
|
|
756
|
-
|
|
757
|
-
const t =
|
|
758
|
-
|
|
759
|
-
} else e === "entering" &&
|
|
760
|
-
}, []),
|
|
776
|
+
Ae("hidden");
|
|
777
|
+
const t = Me.current;
|
|
778
|
+
Me.current = null, t != null && t !== "" && (Be(t), Ae("entering"));
|
|
779
|
+
} else e === "entering" && Ae("visible");
|
|
780
|
+
}, []), Ot = (e) => {
|
|
761
781
|
if (!e) return;
|
|
762
782
|
if (e.mood != null) {
|
|
763
|
-
const
|
|
764
|
-
|
|
783
|
+
const n = String(e.mood).toLowerCase();
|
|
784
|
+
h(n);
|
|
765
785
|
}
|
|
766
786
|
if (e.expression != null) {
|
|
767
|
-
const
|
|
768
|
-
n
|
|
769
|
-
const a =
|
|
770
|
-
(
|
|
787
|
+
const n = String(e.expression).trim();
|
|
788
|
+
Q(n);
|
|
789
|
+
const a = ln.find(
|
|
790
|
+
(p) => p.name.toLowerCase() === n.toLowerCase()
|
|
771
791
|
);
|
|
772
|
-
|
|
773
|
-
`[STREAM] Animation match for "${
|
|
774
|
-
),
|
|
792
|
+
B(
|
|
793
|
+
`[STREAM] Animation match for "${n}": ${a ? a.name : "NONE"}`
|
|
794
|
+
), $e(a?.url ?? "");
|
|
775
795
|
}
|
|
776
796
|
if (e.navigation != null) {
|
|
777
|
-
const
|
|
778
|
-
|
|
797
|
+
const n = String(e.navigation).trim();
|
|
798
|
+
n !== "" && (w ? w(n) : window.open(n, "_blank"));
|
|
779
799
|
}
|
|
780
|
-
const t = e.ask_for || e.lead_capture?.ask_for,
|
|
781
|
-
if (t && !
|
|
782
|
-
const
|
|
783
|
-
|
|
784
|
-
} else (
|
|
800
|
+
const t = e.ask_for || e.lead_capture?.ask_for, s = t ? String(t).trim().toLowerCase() : "", o = s === "none" || s === "<none>";
|
|
801
|
+
if (t && !o) {
|
|
802
|
+
const n = s;
|
|
803
|
+
je(n || null), Re(n === "email" ? "Enter your email" : n === "name" ? "Enter your name" : n === "phone" ? "Enter your phone number" : "Chat with us");
|
|
804
|
+
} else (o || e.ask_for === null || e.lead_capture && e.lead_capture.ask_for === null || e.ask_for === "none") && (je(null), Ue !== "Chat with us" && Re("Chat with us"));
|
|
785
805
|
e.collected, e.valid;
|
|
786
|
-
},
|
|
806
|
+
}, Ft = (e) => {
|
|
787
807
|
const t = e.trim();
|
|
788
808
|
if (!t) return null;
|
|
789
809
|
if (t.startsWith("{"))
|
|
@@ -793,48 +813,48 @@ const rn = ({
|
|
|
793
813
|
return null;
|
|
794
814
|
}
|
|
795
815
|
if (t.includes(":")) {
|
|
796
|
-
const
|
|
797
|
-
return { [
|
|
816
|
+
const s = t.split(":"), o = s[0].trim().toLowerCase(), n = s.slice(1).join(":").trim();
|
|
817
|
+
return { [o]: n };
|
|
798
818
|
}
|
|
799
819
|
return null;
|
|
800
|
-
},
|
|
801
|
-
}, []),
|
|
802
|
-
if (
|
|
803
|
-
e === "§" ?
|
|
820
|
+
}, Nt = Qe(() => {
|
|
821
|
+
}, []), wt = (e) => {
|
|
822
|
+
if (Ce.current)
|
|
823
|
+
e === "§" ? Ce.current = !1 : (Oe.current += e, N((t) => t + e));
|
|
804
824
|
else if (e === "§") {
|
|
805
|
-
|
|
825
|
+
Ce.current = !0;
|
|
806
826
|
return;
|
|
807
827
|
} else
|
|
808
|
-
for (
|
|
828
|
+
for (he.current += e; he.current.includes(`
|
|
809
829
|
`); ) {
|
|
810
|
-
const t =
|
|
811
|
-
`),
|
|
812
|
-
|
|
813
|
-
const
|
|
814
|
-
|
|
830
|
+
const t = he.current.indexOf(`
|
|
831
|
+
`), s = he.current.slice(0, t).trim();
|
|
832
|
+
he.current = he.current.slice(t + 1);
|
|
833
|
+
const o = Ft(s);
|
|
834
|
+
o && Ot(o);
|
|
815
835
|
}
|
|
816
836
|
};
|
|
817
|
-
|
|
837
|
+
P(() => {
|
|
818
838
|
(async () => {
|
|
819
839
|
if (!sessionStorage.getItem(
|
|
820
840
|
"STREAMOJI_LEADS_SESSION_LEAD_ID"
|
|
821
841
|
)) {
|
|
822
|
-
const
|
|
842
|
+
const s = "secret", o = Math.floor(Date.now() / 1e3).toString();
|
|
823
843
|
try {
|
|
824
|
-
const
|
|
844
|
+
const n = new TextEncoder(), a = await crypto.subtle.importKey(
|
|
825
845
|
"raw",
|
|
826
|
-
|
|
846
|
+
n.encode(s),
|
|
827
847
|
{ name: "HMAC", hash: "SHA-256" },
|
|
828
848
|
!1,
|
|
829
849
|
["sign"]
|
|
830
|
-
),
|
|
850
|
+
), p = await crypto.subtle.sign(
|
|
831
851
|
"HMAC",
|
|
832
852
|
a,
|
|
833
|
-
|
|
834
|
-
),
|
|
835
|
-
sessionStorage.setItem("STREAMOJI_LEADS_SESSION_LEAD_ID",
|
|
836
|
-
} catch (
|
|
837
|
-
console.error("[SESSION] HMAC generation failed:",
|
|
853
|
+
n.encode(o)
|
|
854
|
+
), S = Array.from(new Uint8Array(p)).map((x) => x.toString(16).padStart(2, "0")).join("");
|
|
855
|
+
sessionStorage.setItem("STREAMOJI_LEADS_SESSION_LEAD_ID", S), B("[SESSION] New HMAC UID generated and saved:", S);
|
|
856
|
+
} catch (n) {
|
|
857
|
+
console.error("[SESSION] HMAC generation failed:", n);
|
|
838
858
|
const a = Math.random().toString(36) + Date.now().toString();
|
|
839
859
|
sessionStorage.setItem("STREAMOJI_LEADS_SESSION_LEAD_ID", a);
|
|
840
860
|
}
|
|
@@ -844,8 +864,57 @@ const rn = ({
|
|
|
844
864
|
JSON.stringify([])
|
|
845
865
|
);
|
|
846
866
|
})();
|
|
847
|
-
}, [])
|
|
848
|
-
|
|
867
|
+
}, []), P(() => {
|
|
868
|
+
const e = () => {
|
|
869
|
+
pt.current = Date.now(), Pe.current && (Pe.current = !1, We(!1), k([]), xe(""), N(""), $(!1));
|
|
870
|
+
};
|
|
871
|
+
window.addEventListener("mousemove", e), window.addEventListener("keydown", e), window.addEventListener("mousedown", e), window.addEventListener("touchstart", e);
|
|
872
|
+
const t = setInterval(async () => {
|
|
873
|
+
if (Date.now() - pt.current >= 3e4 && !Y && !ce && U === "Ready" && !Pe.current)
|
|
874
|
+
if (Pe.current = !0, et.current.length > 0)
|
|
875
|
+
We(!0), k(et.current);
|
|
876
|
+
else
|
|
877
|
+
try {
|
|
878
|
+
const n = `${lt}/nudgeUser`, a = {
|
|
879
|
+
navigationUrl: window.location.href,
|
|
880
|
+
token: T
|
|
881
|
+
}, p = await fetch(n, {
|
|
882
|
+
method: "POST",
|
|
883
|
+
headers: {
|
|
884
|
+
"Content-Type": "application/json"
|
|
885
|
+
},
|
|
886
|
+
body: JSON.stringify(a)
|
|
887
|
+
});
|
|
888
|
+
if (p.ok) {
|
|
889
|
+
const S = (await p.json()).nudge_questions;
|
|
890
|
+
S && S.length > 0 && (B("[NUDGE] Received nudge questions from API:", S), et.current = S, We(!0), k(S));
|
|
891
|
+
}
|
|
892
|
+
} catch (n) {
|
|
893
|
+
console.error("[NUDGE] Error calling /nudgeUser:", n), Pe.current = !1;
|
|
894
|
+
}
|
|
895
|
+
}, 1e3);
|
|
896
|
+
return () => {
|
|
897
|
+
window.removeEventListener("mousemove", e), window.removeEventListener("keydown", e), window.removeEventListener("mousedown", e), window.removeEventListener("touchstart", e), clearInterval(t);
|
|
898
|
+
};
|
|
899
|
+
}, [T, Y, ce, U]), P(() => {
|
|
900
|
+
if (pe.length === 0) return;
|
|
901
|
+
let e = 0, t = 0, s = !1, o = 100;
|
|
902
|
+
const n = () => {
|
|
903
|
+
const a = pe[e];
|
|
904
|
+
if (s) {
|
|
905
|
+
const p = a.substring(0, t - 1);
|
|
906
|
+
xe(p), t--, o = 50;
|
|
907
|
+
} else {
|
|
908
|
+
const p = a.substring(0, t + 1);
|
|
909
|
+
xe(p), t++, o = 100;
|
|
910
|
+
}
|
|
911
|
+
!s && t === a.length ? (s = !0, o = 3e3) : s && t === 0 && (s = !1, e = (e + 1) % pe.length, o = 500), q.current = setTimeout(n, o);
|
|
912
|
+
};
|
|
913
|
+
return n(), () => {
|
|
914
|
+
q.current && clearTimeout(q.current);
|
|
915
|
+
};
|
|
916
|
+
}, [pe]);
|
|
917
|
+
const vt = () => {
|
|
849
918
|
try {
|
|
850
919
|
return JSON.parse(
|
|
851
920
|
sessionStorage.getItem("STREAMOJI_LEADS_SESSION_MESSAGES") || "[]"
|
|
@@ -853,232 +922,232 @@ const rn = ({
|
|
|
853
922
|
} catch {
|
|
854
923
|
return [];
|
|
855
924
|
}
|
|
856
|
-
},
|
|
925
|
+
}, Ut = (e) => {
|
|
857
926
|
sessionStorage.setItem(
|
|
858
927
|
"STREAMOJI_LEADS_SESSION_MESSAGES",
|
|
859
928
|
JSON.stringify(e)
|
|
860
929
|
);
|
|
861
|
-
}, [
|
|
930
|
+
}, [nt, rt] = b(!1), [yt, st] = b(0), de = c(null), Ge = c([]), St = c(0), [xt, Bt] = b(
|
|
862
931
|
null
|
|
863
|
-
), [
|
|
932
|
+
), [Pt, it] = b(
|
|
864
933
|
null
|
|
865
|
-
),
|
|
934
|
+
), me = c(null), Te = c(
|
|
866
935
|
null
|
|
867
|
-
),
|
|
868
|
-
e && (
|
|
936
|
+
), ze = Qe((e = !1) => {
|
|
937
|
+
e && (ke.current = !0, m(!1), _("Ready")), v.current = [], M.current = [], L.current = !1, $(!1), we.current = 0, le.current = 0, ve.current = 0, _e.current.forEach((t) => {
|
|
869
938
|
try {
|
|
870
939
|
t.stop();
|
|
871
940
|
} catch {
|
|
872
941
|
}
|
|
873
|
-
}),
|
|
874
|
-
}, []),
|
|
942
|
+
}), De.current && (clearTimeout(De.current), De.current = null), ne(null), $e(""), _e.current = [];
|
|
943
|
+
}, []), Wt = async () => {
|
|
875
944
|
try {
|
|
876
|
-
const e = await navigator.mediaDevices.getUserMedia({ audio: !0 }), t = window.AudioContext || window.webkitAudioContext,
|
|
877
|
-
|
|
945
|
+
const e = await navigator.mediaDevices.getUserMedia({ audio: !0 }), t = window.AudioContext || window.webkitAudioContext, s = new t(), o = s.createMediaStreamSource(e), n = s.createAnalyser();
|
|
946
|
+
n.fftSize = 64, o.connect(n), me.current = s, Te.current = o, it(n);
|
|
878
947
|
const a = new MediaRecorder(e);
|
|
879
|
-
|
|
880
|
-
|
|
948
|
+
de.current = a, Ge.current = [], a.ondataavailable = (p) => {
|
|
949
|
+
p.data.size > 0 && Ge.current.push(p.data);
|
|
881
950
|
}, a.onstop = async () => {
|
|
882
|
-
const
|
|
883
|
-
if (
|
|
884
|
-
_("Recording too short. Hold or click longer."),
|
|
951
|
+
const p = Date.now() - St.current;
|
|
952
|
+
if (it(null), Te.current && (Te.current.disconnect(), Te.current = null), me.current && me.current.state !== "closed" && (me.current.close(), me.current = null), p < 1e3) {
|
|
953
|
+
_("Recording too short. Hold or click longer."), m(!1);
|
|
885
954
|
return;
|
|
886
955
|
}
|
|
887
|
-
const
|
|
956
|
+
const R = new Blob(Ge.current, {
|
|
888
957
|
type: "audio/wav"
|
|
889
958
|
});
|
|
890
|
-
await
|
|
891
|
-
},
|
|
959
|
+
await jt(R);
|
|
960
|
+
}, St.current = Date.now(), a.start(100), rt(!0), _("Listening...");
|
|
892
961
|
} catch (e) {
|
|
893
962
|
console.error("Error accessing microphone:", e), _("Mic Access Error");
|
|
894
963
|
}
|
|
895
|
-
},
|
|
896
|
-
|
|
897
|
-
},
|
|
898
|
-
|
|
964
|
+
}, Vt = () => {
|
|
965
|
+
de.current && de.current.state !== "inactive" && (de.current.stop(), de.current.stream.getTracks().forEach((e) => e.stop()), rt(!1));
|
|
966
|
+
}, Ht = () => {
|
|
967
|
+
de.current && de.current.state !== "inactive" && (de.current.onstop = null, de.current.stop(), de.current.stream.getTracks().forEach((e) => e.stop()), it(null), Te.current && (Te.current.disconnect(), Te.current = null), me.current && me.current.state !== "closed" && (me.current.close(), me.current = null), rt(!1), Ge.current = [], _("Ready"));
|
|
899
968
|
};
|
|
900
|
-
|
|
901
|
-
if (!
|
|
969
|
+
P(() => {
|
|
970
|
+
if (!Y) return;
|
|
902
971
|
const e = () => {
|
|
903
|
-
const t =
|
|
972
|
+
const t = ve.current;
|
|
904
973
|
if (t <= 0) return;
|
|
905
|
-
const
|
|
906
|
-
if (!
|
|
907
|
-
const
|
|
908
|
-
if (
|
|
909
|
-
const
|
|
910
|
-
Math.round(a / t *
|
|
911
|
-
|
|
974
|
+
const s = y.current, o = we.current;
|
|
975
|
+
if (!s) return;
|
|
976
|
+
const n = s.currentTime - o, a = Math.min(Math.max(0, n), t), p = ae.trim().length;
|
|
977
|
+
if (p <= 0) return;
|
|
978
|
+
const R = Math.min(
|
|
979
|
+
Math.round(a / t * p),
|
|
980
|
+
p
|
|
912
981
|
);
|
|
913
|
-
|
|
982
|
+
u(R);
|
|
914
983
|
};
|
|
915
|
-
return clearInterval(
|
|
916
|
-
}, [
|
|
984
|
+
return clearInterval(i.current ?? void 0), i.current = setInterval(e, 90), () => clearInterval(i.current ?? void 0);
|
|
985
|
+
}, [Y, ae, ve.current]), P(() => {
|
|
917
986
|
let e;
|
|
918
|
-
return
|
|
919
|
-
|
|
920
|
-
}, 1e3)) :
|
|
921
|
-
}, [
|
|
922
|
-
const
|
|
923
|
-
const t = e.numberOfChannels,
|
|
987
|
+
return nt ? (st(0), e = window.setInterval(() => {
|
|
988
|
+
st((t) => t + 1);
|
|
989
|
+
}, 1e3)) : st(0), () => clearInterval(e);
|
|
990
|
+
}, [nt]);
|
|
991
|
+
const $t = (e) => {
|
|
992
|
+
const t = e.numberOfChannels, s = e.length * t * 2 + 44, o = new ArrayBuffer(s), n = new DataView(o);
|
|
924
993
|
let a = 0;
|
|
925
|
-
const
|
|
926
|
-
|
|
927
|
-
},
|
|
928
|
-
|
|
994
|
+
const p = (O) => {
|
|
995
|
+
n.setUint16(a, O, !0), a += 2;
|
|
996
|
+
}, R = (O) => {
|
|
997
|
+
n.setUint32(a, O, !0), a += 4;
|
|
929
998
|
};
|
|
930
|
-
|
|
931
|
-
const
|
|
932
|
-
for (let
|
|
999
|
+
R(1179011410), R(s - 8), R(1163280727), R(544501094), R(16), p(1), p(t), R(e.sampleRate), R(e.sampleRate * 2 * t), p(t * 2), p(16), R(1635017060), R(s - a - 4);
|
|
1000
|
+
const S = [];
|
|
1001
|
+
for (let O = 0; O < t; O++) S.push(e.getChannelData(O));
|
|
933
1002
|
let x = 0;
|
|
934
|
-
for (; a <
|
|
935
|
-
for (let
|
|
936
|
-
let
|
|
937
|
-
|
|
1003
|
+
for (; a < s; ) {
|
|
1004
|
+
for (let O = 0; O < t; O++) {
|
|
1005
|
+
let H = Math.max(-1, Math.min(1, S[O][x]));
|
|
1006
|
+
H = H < 0 ? H * 32768 : H * 32767, n.setInt16(a, H, !0), a += 2;
|
|
938
1007
|
}
|
|
939
1008
|
x++;
|
|
940
1009
|
}
|
|
941
|
-
return new Blob([
|
|
942
|
-
},
|
|
943
|
-
if (!
|
|
944
|
-
if (
|
|
945
|
-
|
|
1010
|
+
return new Blob([o], { type: "audio/wav" });
|
|
1011
|
+
}, ot = async (e, t, s = !1) => {
|
|
1012
|
+
if (!ke.current) {
|
|
1013
|
+
if (W.current) {
|
|
1014
|
+
M.current.push({
|
|
946
1015
|
audio: e,
|
|
947
1016
|
visemes: t,
|
|
948
|
-
isNewSegment:
|
|
1017
|
+
isNewSegment: s
|
|
949
1018
|
});
|
|
950
1019
|
return;
|
|
951
1020
|
}
|
|
952
|
-
|
|
1021
|
+
W.current = !0;
|
|
953
1022
|
try {
|
|
954
|
-
const
|
|
955
|
-
|
|
956
|
-
const a = window.atob(e),
|
|
957
|
-
for (let
|
|
958
|
-
|
|
959
|
-
const
|
|
960
|
-
|
|
961
|
-
const
|
|
962
|
-
let x =
|
|
963
|
-
const
|
|
964
|
-
x <
|
|
965
|
-
const
|
|
966
|
-
|
|
967
|
-
let
|
|
968
|
-
if ((!
|
|
969
|
-
|
|
1023
|
+
const o = window.AudioContext || window.webkitAudioContext, n = y.current ?? new o();
|
|
1024
|
+
n.state === "suspended" && await n.resume(), y.current = n;
|
|
1025
|
+
const a = window.atob(e), p = new Uint8Array(a.length);
|
|
1026
|
+
for (let F = 0; F < a.length; F++)
|
|
1027
|
+
p[F] = a.charCodeAt(F);
|
|
1028
|
+
const R = await n.decodeAudioData(p.buffer.slice(0));
|
|
1029
|
+
ve.current += R.duration;
|
|
1030
|
+
const S = n.currentTime;
|
|
1031
|
+
let x = le.current;
|
|
1032
|
+
const O = !L.current;
|
|
1033
|
+
x < S && (x = S + 0.1), le.current = x + R.duration;
|
|
1034
|
+
const H = n.createBufferSource();
|
|
1035
|
+
H.buffer = R;
|
|
1036
|
+
let j = xt;
|
|
1037
|
+
if ((!j || j.context !== n) && (j = n.createAnalyser(), j.fftSize = 64, j.connect(n.destination), Bt(j)), H.connect(j), _e.current.push(H), ke.current) {
|
|
1038
|
+
_e.current = _e.current.filter((F) => F !== H);
|
|
970
1039
|
return;
|
|
971
1040
|
}
|
|
972
|
-
if (
|
|
973
|
-
|
|
1041
|
+
if (O) {
|
|
1042
|
+
L.current = !0, $(!0), B(
|
|
974
1043
|
`[AUDIO] setIsSpeaking(true) - First chunk starting at ${x.toFixed(
|
|
975
1044
|
3
|
|
976
1045
|
)}`
|
|
977
|
-
),
|
|
978
|
-
const
|
|
979
|
-
|
|
1046
|
+
), we.current = x;
|
|
1047
|
+
const F = (x - S) * 1e3;
|
|
1048
|
+
be.current = performance.now() + F, B(
|
|
980
1049
|
`[AUDIO] Response started. Initial startTime: ${x.toFixed(
|
|
981
1050
|
3
|
|
982
|
-
)}, CT: ${
|
|
1051
|
+
)}, CT: ${S.toFixed(3)}`
|
|
983
1052
|
);
|
|
984
1053
|
}
|
|
985
|
-
|
|
986
|
-
const
|
|
987
|
-
|
|
988
|
-
`[AUDIO] New segment detected at +${
|
|
1054
|
+
H.start(x);
|
|
1055
|
+
const X = (x - we.current) * 1e3;
|
|
1056
|
+
s && (Ne.current = X, B(
|
|
1057
|
+
`[AUDIO] New segment detected at +${X.toFixed(
|
|
989
1058
|
0
|
|
990
1059
|
)}ms. Resetting segment offset.`
|
|
991
|
-
)), t.forEach((
|
|
992
|
-
const
|
|
993
|
-
if (
|
|
994
|
-
const
|
|
995
|
-
|
|
996
|
-
`[AUDIO] Viseme "${
|
|
1060
|
+
)), t.forEach((F, se) => {
|
|
1061
|
+
const D = F.symbol ?? "";
|
|
1062
|
+
if (D) {
|
|
1063
|
+
const ie = bn(D), fe = Math.round(F.start * 1e3), Ee = Math.round((F.duration ?? 0) * 1e3), At = Ne.current + fe;
|
|
1064
|
+
se < 3 && B(
|
|
1065
|
+
`[AUDIO] Viseme "${D}": segment_relative=${fe}ms, segment_offset=${Ne.current.toFixed(
|
|
997
1066
|
0
|
|
998
|
-
)}ms => vtime=${
|
|
999
|
-
),
|
|
1000
|
-
|
|
1001
|
-
viseme:
|
|
1002
|
-
weight:
|
|
1003
|
-
vtime:
|
|
1004
|
-
vduration:
|
|
1067
|
+
)}ms => vtime=${At}ms`
|
|
1068
|
+
), ie.forEach((Lt) => {
|
|
1069
|
+
v.current.push({
|
|
1070
|
+
viseme: Lt.v,
|
|
1071
|
+
weight: Lt.w,
|
|
1072
|
+
vtime: At,
|
|
1073
|
+
vduration: Ee
|
|
1005
1074
|
});
|
|
1006
1075
|
});
|
|
1007
1076
|
}
|
|
1008
1077
|
}), _("Speaking...");
|
|
1009
1078
|
} finally {
|
|
1010
|
-
if (
|
|
1011
|
-
const
|
|
1012
|
-
|
|
1079
|
+
if (W.current = !1, M.current.length > 0) {
|
|
1080
|
+
const o = M.current.shift();
|
|
1081
|
+
o && ot(o.audio, o.visemes, o.isNewSegment);
|
|
1013
1082
|
}
|
|
1014
1083
|
}
|
|
1015
1084
|
}
|
|
1016
|
-
},
|
|
1085
|
+
}, jt = async (e) => {
|
|
1017
1086
|
try {
|
|
1018
|
-
|
|
1019
|
-
const t = await e.arrayBuffer(),
|
|
1020
|
-
a.readAsDataURL(
|
|
1021
|
-
const
|
|
1022
|
-
|
|
1023
|
-
const
|
|
1024
|
-
|
|
1025
|
-
)}`,
|
|
1087
|
+
m(!0), We(!1), Oe.current = "", N(""), _("Processing Voice...");
|
|
1088
|
+
const t = await e.arrayBuffer(), o = await new (window.AudioContext || window.webkitAudioContext)().decodeAudioData(t), n = $t(o), a = new FileReader();
|
|
1089
|
+
a.readAsDataURL(n), a.onloadend = async () => {
|
|
1090
|
+
const p = a.result.split(",")[1];
|
|
1091
|
+
ze(), ee(""), he.current = "", Ce.current = !1;
|
|
1092
|
+
const R = `${lt}/stt?token=${encodeURIComponent(
|
|
1093
|
+
T
|
|
1094
|
+
)}`, S = await fetch(R, {
|
|
1026
1095
|
method: "POST",
|
|
1027
1096
|
headers: { "Content-Type": "application/json" },
|
|
1028
1097
|
body: JSON.stringify({
|
|
1029
|
-
audio_base64:
|
|
1098
|
+
audio_base64: p,
|
|
1030
1099
|
audio_format: "wav"
|
|
1031
1100
|
})
|
|
1032
1101
|
});
|
|
1033
|
-
if (
|
|
1102
|
+
if (S.status === 429) {
|
|
1034
1103
|
try {
|
|
1035
|
-
const
|
|
1036
|
-
|
|
1104
|
+
const se = await S.text(), D = JSON.parse(se);
|
|
1105
|
+
B("[STT] 429 agent at capacity:", D?.detail);
|
|
1037
1106
|
} catch {
|
|
1038
1107
|
}
|
|
1039
|
-
|
|
1108
|
+
ee(""), _("Busy"), m(!1);
|
|
1040
1109
|
return;
|
|
1041
1110
|
}
|
|
1042
|
-
if (!
|
|
1043
|
-
const
|
|
1044
|
-
let
|
|
1111
|
+
if (!S.ok) {
|
|
1112
|
+
const se = await S.text();
|
|
1113
|
+
let D = "STT Failed";
|
|
1045
1114
|
try {
|
|
1046
|
-
|
|
1115
|
+
D = JSON.parse(se).error || D;
|
|
1047
1116
|
} catch {
|
|
1048
|
-
|
|
1117
|
+
se && (D = se.slice(0, 200));
|
|
1049
1118
|
}
|
|
1050
|
-
throw new Error(
|
|
1119
|
+
throw new Error(D);
|
|
1051
1120
|
}
|
|
1052
|
-
const x =
|
|
1053
|
-
if (
|
|
1054
|
-
_("STT Failed"),
|
|
1121
|
+
const x = S.body;
|
|
1122
|
+
if (B("this is body" + x), !x) {
|
|
1123
|
+
_("STT Failed"), m(!1);
|
|
1055
1124
|
return;
|
|
1056
1125
|
}
|
|
1057
|
-
const
|
|
1058
|
-
|
|
1059
|
-
const
|
|
1060
|
-
let
|
|
1061
|
-
const
|
|
1062
|
-
switch (
|
|
1126
|
+
const O = x.getReader();
|
|
1127
|
+
ke.current = !1;
|
|
1128
|
+
const H = new TextDecoder();
|
|
1129
|
+
let j = "", X = !1;
|
|
1130
|
+
const F = async (se, D) => {
|
|
1131
|
+
switch (se) {
|
|
1063
1132
|
case "transcript":
|
|
1064
|
-
|
|
1133
|
+
D.transcript != null && ee(String(D.transcript));
|
|
1065
1134
|
break;
|
|
1066
1135
|
case "text": {
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1136
|
+
const ie = D.delta ?? D.text ?? "";
|
|
1137
|
+
ie && wt(ie);
|
|
1069
1138
|
break;
|
|
1070
1139
|
}
|
|
1071
1140
|
case "audio": {
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1141
|
+
const ie = D.chunk, fe = D.visemes ?? [], Ee = !!D.is_new_segment;
|
|
1142
|
+
ie && await ot(ie, fe, Ee);
|
|
1074
1143
|
break;
|
|
1075
1144
|
}
|
|
1076
1145
|
case "done": {
|
|
1077
|
-
|
|
1146
|
+
X = !0, _("Ready"), m(!1);
|
|
1078
1147
|
break;
|
|
1079
1148
|
}
|
|
1080
1149
|
case "error": {
|
|
1081
|
-
|
|
1150
|
+
X = !0, _("STT Failed"), m(!1);
|
|
1082
1151
|
break;
|
|
1083
1152
|
}
|
|
1084
1153
|
default:
|
|
@@ -1086,172 +1155,180 @@ const rn = ({
|
|
|
1086
1155
|
}
|
|
1087
1156
|
};
|
|
1088
1157
|
for (; ; ) {
|
|
1089
|
-
const { done:
|
|
1090
|
-
|
|
1091
|
-
const
|
|
1158
|
+
const { done: se, value: D } = await O.read();
|
|
1159
|
+
D && (j += H.decode(D, { stream: !0 }));
|
|
1160
|
+
const ie = j.split(`
|
|
1092
1161
|
|
|
1093
1162
|
`);
|
|
1094
|
-
|
|
1095
|
-
for (const
|
|
1096
|
-
const
|
|
1097
|
-
|
|
1163
|
+
j = ie.pop() ?? "";
|
|
1164
|
+
for (const fe of ie) {
|
|
1165
|
+
const Ee = Ye(fe);
|
|
1166
|
+
Ee && await F(Ee.event, Ee.data);
|
|
1098
1167
|
}
|
|
1099
|
-
if (
|
|
1100
|
-
if (
|
|
1101
|
-
const
|
|
1102
|
-
|
|
1168
|
+
if (se) {
|
|
1169
|
+
if (j.trim()) {
|
|
1170
|
+
const fe = Ye(j.trim());
|
|
1171
|
+
fe && await F(fe.event, fe.data);
|
|
1103
1172
|
}
|
|
1104
|
-
|
|
1173
|
+
X || (_("Ready"), m(!1));
|
|
1105
1174
|
break;
|
|
1106
1175
|
}
|
|
1107
1176
|
}
|
|
1108
1177
|
};
|
|
1109
1178
|
} catch (t) {
|
|
1110
|
-
console.error("Audio Submission Error:", t), _("STT Failed"),
|
|
1179
|
+
console.error("Audio Submission Error:", t), _("STT Failed"), m(!1);
|
|
1111
1180
|
}
|
|
1112
|
-
},
|
|
1113
|
-
e && e.preventDefault(),
|
|
1114
|
-
},
|
|
1181
|
+
}, Jt = async (e) => {
|
|
1182
|
+
e && e.preventDefault(), We(!1), Oe.current = "", N(""), !(!E || ce) && await qt(E);
|
|
1183
|
+
}, Ye = (e) => {
|
|
1115
1184
|
const t = e.split(/\r?\n/);
|
|
1116
|
-
let
|
|
1185
|
+
let s = "", o = "";
|
|
1117
1186
|
for (const a of t)
|
|
1118
|
-
a.startsWith("event:") ?
|
|
1119
|
-
if (!
|
|
1120
|
-
let
|
|
1121
|
-
if (
|
|
1187
|
+
a.startsWith("event:") ? s = a.slice(6).trim() : a.startsWith("data:") && (o = a.slice(5).trim());
|
|
1188
|
+
if (!s) return null;
|
|
1189
|
+
let n = {};
|
|
1190
|
+
if (o)
|
|
1122
1191
|
try {
|
|
1123
|
-
|
|
1192
|
+
n = JSON.parse(o);
|
|
1124
1193
|
} catch {
|
|
1125
|
-
|
|
1194
|
+
n = { raw: o };
|
|
1126
1195
|
}
|
|
1127
|
-
return { event:
|
|
1128
|
-
},
|
|
1196
|
+
return { event: s, data: n };
|
|
1197
|
+
}, kt = (e, t) => {
|
|
1129
1198
|
switch (e) {
|
|
1130
1199
|
case "connected":
|
|
1131
|
-
|
|
1200
|
+
he.current = "", Ce.current = !1;
|
|
1132
1201
|
break;
|
|
1133
1202
|
case "text": {
|
|
1134
|
-
const
|
|
1135
|
-
|
|
1203
|
+
const s = t.delta ?? "";
|
|
1204
|
+
s && wt(s);
|
|
1136
1205
|
break;
|
|
1137
1206
|
}
|
|
1138
1207
|
case "audio": {
|
|
1139
|
-
const
|
|
1140
|
-
|
|
1208
|
+
const s = t.chunk, o = t.visemes ?? [];
|
|
1209
|
+
s && ot(s, o);
|
|
1141
1210
|
break;
|
|
1142
1211
|
}
|
|
1143
1212
|
case "done": {
|
|
1144
|
-
const
|
|
1145
|
-
...
|
|
1146
|
-
{ role: "user", content:
|
|
1147
|
-
{ role: "assistant", content:
|
|
1213
|
+
const s = vt(), o = Oe.current.trim(), n = [
|
|
1214
|
+
...s,
|
|
1215
|
+
{ role: "user", content: E || "..." },
|
|
1216
|
+
{ role: "assistant", content: o }
|
|
1148
1217
|
];
|
|
1149
|
-
|
|
1218
|
+
Ut(n), Ie.current = [...v.current], _("Ready"), m(!1), ee("");
|
|
1150
1219
|
break;
|
|
1151
1220
|
}
|
|
1152
1221
|
case "error": {
|
|
1153
|
-
const
|
|
1154
|
-
|
|
1222
|
+
const s = t.message ?? "Unknown error";
|
|
1223
|
+
Oe.current = s, N(s), _("Agent Failed"), m(!1);
|
|
1155
1224
|
break;
|
|
1156
1225
|
}
|
|
1157
1226
|
}
|
|
1158
|
-
},
|
|
1159
|
-
|
|
1160
|
-
const t = `${
|
|
1161
|
-
|
|
1227
|
+
}, qt = async (e) => {
|
|
1228
|
+
m(!0), _("Thinking..."), Oe.current = "", he.current = "", Ce.current = !1, ze(), ve.current = 0, u(0);
|
|
1229
|
+
const t = `${lt}/agent/chat?token=${encodeURIComponent(
|
|
1230
|
+
T
|
|
1162
1231
|
)}`;
|
|
1163
1232
|
try {
|
|
1164
|
-
const
|
|
1165
|
-
let
|
|
1166
|
-
|
|
1233
|
+
const s = vt();
|
|
1234
|
+
let o = sessionStorage.getItem("STREAMOJI_LEADS_SESSION_LEAD_ID");
|
|
1235
|
+
o || (nn(
|
|
1167
1236
|
"[CHAT] Session UID missing at send time! Generating emergency backup."
|
|
1168
|
-
),
|
|
1169
|
-
const
|
|
1170
|
-
history:
|
|
1237
|
+
), o = "emergency-" + Math.random().toString(36).substring(7), sessionStorage.setItem("STREAMOJI_LEADS_SESSION_LEAD_ID", o));
|
|
1238
|
+
const n = {
|
|
1239
|
+
history: s,
|
|
1171
1240
|
question: e,
|
|
1172
|
-
lead_id:
|
|
1241
|
+
lead_id: o
|
|
1173
1242
|
};
|
|
1174
|
-
|
|
1243
|
+
B("[CHAT] Sending payload:", n);
|
|
1175
1244
|
const a = await fetch(t, {
|
|
1176
1245
|
method: "POST",
|
|
1177
1246
|
headers: {
|
|
1178
1247
|
"Content-Type": "application/json"
|
|
1179
1248
|
},
|
|
1180
|
-
body: JSON.stringify(
|
|
1249
|
+
body: JSON.stringify(n),
|
|
1181
1250
|
cache: "default"
|
|
1182
1251
|
});
|
|
1183
1252
|
if (a.status === 429) {
|
|
1184
1253
|
try {
|
|
1185
|
-
const
|
|
1186
|
-
|
|
1254
|
+
const O = await a.json();
|
|
1255
|
+
B("[CHAT] 429 agent at capacity:", O?.detail);
|
|
1187
1256
|
} catch {
|
|
1188
1257
|
}
|
|
1189
|
-
|
|
1258
|
+
ee(""), _("Busy"), m(!1);
|
|
1190
1259
|
return;
|
|
1191
1260
|
}
|
|
1192
1261
|
if (!a.ok)
|
|
1193
1262
|
throw new Error("Agent request failed");
|
|
1194
|
-
const
|
|
1195
|
-
if (!
|
|
1196
|
-
_("Agent Failed"),
|
|
1263
|
+
const p = a.body;
|
|
1264
|
+
if (!p) {
|
|
1265
|
+
_("Agent Failed"), m(!1);
|
|
1197
1266
|
return;
|
|
1198
1267
|
}
|
|
1199
|
-
const
|
|
1200
|
-
|
|
1201
|
-
const
|
|
1268
|
+
const R = p.getReader();
|
|
1269
|
+
ke.current = !1;
|
|
1270
|
+
const S = new TextDecoder();
|
|
1202
1271
|
let x = "";
|
|
1203
1272
|
for (; ; ) {
|
|
1204
|
-
const { done:
|
|
1205
|
-
|
|
1206
|
-
`[SSE] Chunk received. done=${
|
|
1207
|
-
),
|
|
1208
|
-
const
|
|
1273
|
+
const { done: O, value: H } = await R.read();
|
|
1274
|
+
B(
|
|
1275
|
+
`[SSE] Chunk received. done=${O}, length=${H?.length || 0}`
|
|
1276
|
+
), H && (x += S.decode(H, { stream: !0 }));
|
|
1277
|
+
const j = x.split(`
|
|
1209
1278
|
|
|
1210
1279
|
`);
|
|
1211
|
-
x =
|
|
1212
|
-
for (const
|
|
1213
|
-
|
|
1214
|
-
const
|
|
1215
|
-
|
|
1280
|
+
x = j.pop() ?? "";
|
|
1281
|
+
for (const X of j) {
|
|
1282
|
+
B(`[SSE] Processing block: ${X.slice(0, 50)}...`);
|
|
1283
|
+
const F = Ye(X);
|
|
1284
|
+
F && (B(`[SSE] Event: ${F.event}`), kt(F.event, F.data));
|
|
1216
1285
|
}
|
|
1217
|
-
if (
|
|
1218
|
-
if (
|
|
1219
|
-
const
|
|
1220
|
-
|
|
1286
|
+
if (O) {
|
|
1287
|
+
if (B("[SSE] Stream finished"), x.trim()) {
|
|
1288
|
+
const X = Ye(x.trim());
|
|
1289
|
+
X && kt(X.event, X.data);
|
|
1221
1290
|
}
|
|
1222
|
-
_("Ready"),
|
|
1291
|
+
_("Ready"), m(!1), ee("");
|
|
1223
1292
|
break;
|
|
1224
1293
|
}
|
|
1225
1294
|
}
|
|
1226
|
-
} catch (
|
|
1227
|
-
console.error("Chat Error:",
|
|
1295
|
+
} catch (s) {
|
|
1296
|
+
console.error("Chat Error:", s), _("Agent Failed"), m(!1);
|
|
1228
1297
|
}
|
|
1229
|
-
},
|
|
1298
|
+
}, Rt = ae.trim(), at = Rt && Y ? Rt.slice(
|
|
1230
1299
|
0,
|
|
1231
|
-
|
|
1300
|
+
d != null && d > 0 ? d : 0
|
|
1232
1301
|
) : "";
|
|
1233
|
-
|
|
1234
|
-
const e =
|
|
1235
|
-
e !== "exiting" && (
|
|
1236
|
-
}, [
|
|
1237
|
-
const
|
|
1238
|
-
const e =
|
|
1239
|
-
e === "entering" ?
|
|
1302
|
+
P(() => {
|
|
1303
|
+
const e = Ze.current;
|
|
1304
|
+
e !== "exiting" && (at ? (Dt(at), e === "hidden" && Je("entering")) : (e === "visible" || e === "entering") && Je("exiting"));
|
|
1305
|
+
}, [at, ue]);
|
|
1306
|
+
const Gt = Qe(() => {
|
|
1307
|
+
const e = Ze.current;
|
|
1308
|
+
e === "entering" ? Je("visible") : e === "exiting" && Je("hidden");
|
|
1240
1309
|
}, []);
|
|
1241
|
-
return
|
|
1242
|
-
const e =
|
|
1310
|
+
return Zt(() => {
|
|
1311
|
+
const e = ht.current;
|
|
1243
1312
|
e && (e.scrollTop = e.scrollHeight);
|
|
1244
|
-
}, [
|
|
1245
|
-
/* @__PURE__ */
|
|
1246
|
-
|
|
1313
|
+
}, [mt]), /* @__PURE__ */ oe("div", { className: "avatar-widget-container", children: [
|
|
1314
|
+
/* @__PURE__ */ oe("div", { className: "avatar-input-area", children: [
|
|
1315
|
+
te !== "hidden" ? /* @__PURE__ */ l(
|
|
1247
1316
|
"div",
|
|
1248
1317
|
{
|
|
1249
|
-
className: `avatar-thinking-tab${
|
|
1250
|
-
onAnimationEnd:
|
|
1251
|
-
children:
|
|
1318
|
+
className: `avatar-thinking-tab${te === "exiting" ? " avatar-thinking-tab--exiting" : te === "entering" ? " avatar-thinking-tab--entering" : ""}`,
|
|
1319
|
+
onAnimationEnd: Ct,
|
|
1320
|
+
children: Le === It ? /* @__PURE__ */ l(
|
|
1321
|
+
"a",
|
|
1322
|
+
{
|
|
1323
|
+
href: "https://leads.streamoji.com",
|
|
1324
|
+
target: "_blank",
|
|
1325
|
+
rel: "noopener noreferrer",
|
|
1326
|
+
children: "Made by Streamoji Leads"
|
|
1327
|
+
}
|
|
1328
|
+
) : Le
|
|
1252
1329
|
}
|
|
1253
1330
|
) : null,
|
|
1254
|
-
/* @__PURE__ */
|
|
1331
|
+
/* @__PURE__ */ l("div", { className: "avatar-input-container", children: /* @__PURE__ */ l(
|
|
1255
1332
|
"div",
|
|
1256
1333
|
{
|
|
1257
1334
|
style: {
|
|
@@ -1260,15 +1337,15 @@ const rn = ({
|
|
|
1260
1337
|
width: "100%",
|
|
1261
1338
|
height: "100%"
|
|
1262
1339
|
},
|
|
1263
|
-
children:
|
|
1264
|
-
/* @__PURE__ */
|
|
1340
|
+
children: nt ? /* @__PURE__ */ oe("div", { className: "avatar-input-recording", children: [
|
|
1341
|
+
/* @__PURE__ */ l(
|
|
1265
1342
|
"button",
|
|
1266
1343
|
{
|
|
1267
1344
|
type: "button",
|
|
1268
1345
|
className: "avatar-recording-cancel",
|
|
1269
|
-
onClick:
|
|
1346
|
+
onClick: Ht,
|
|
1270
1347
|
title: "Cancel",
|
|
1271
|
-
children: /* @__PURE__ */
|
|
1348
|
+
children: /* @__PURE__ */ oe(
|
|
1272
1349
|
"svg",
|
|
1273
1350
|
{
|
|
1274
1351
|
width: "18",
|
|
@@ -1281,14 +1358,14 @@ const rn = ({
|
|
|
1281
1358
|
strokeLinejoin: "round",
|
|
1282
1359
|
style: { display: "block" },
|
|
1283
1360
|
children: [
|
|
1284
|
-
/* @__PURE__ */
|
|
1285
|
-
/* @__PURE__ */
|
|
1361
|
+
/* @__PURE__ */ l("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
1362
|
+
/* @__PURE__ */ l("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
1286
1363
|
]
|
|
1287
1364
|
}
|
|
1288
1365
|
)
|
|
1289
1366
|
}
|
|
1290
1367
|
),
|
|
1291
|
-
/* @__PURE__ */
|
|
1368
|
+
/* @__PURE__ */ oe(
|
|
1292
1369
|
"div",
|
|
1293
1370
|
{
|
|
1294
1371
|
style: {
|
|
@@ -1300,8 +1377,8 @@ const rn = ({
|
|
|
1300
1377
|
minWidth: 0
|
|
1301
1378
|
},
|
|
1302
1379
|
children: [
|
|
1303
|
-
/* @__PURE__ */
|
|
1304
|
-
/* @__PURE__ */
|
|
1380
|
+
/* @__PURE__ */ l("div", { style: { flex: 1, height: "100%" }, children: /* @__PURE__ */ l(Tt, { analyser: Pt }) }),
|
|
1381
|
+
/* @__PURE__ */ oe(
|
|
1305
1382
|
"span",
|
|
1306
1383
|
{
|
|
1307
1384
|
style: {
|
|
@@ -1314,23 +1391,23 @@ const rn = ({
|
|
|
1314
1391
|
fontVariantNumeric: "tabular-nums"
|
|
1315
1392
|
},
|
|
1316
1393
|
children: [
|
|
1317
|
-
Math.floor(
|
|
1394
|
+
Math.floor(yt / 60),
|
|
1318
1395
|
":",
|
|
1319
|
-
String(
|
|
1396
|
+
String(yt % 60).padStart(2, "0")
|
|
1320
1397
|
]
|
|
1321
1398
|
}
|
|
1322
1399
|
)
|
|
1323
1400
|
]
|
|
1324
1401
|
}
|
|
1325
1402
|
),
|
|
1326
|
-
/* @__PURE__ */
|
|
1403
|
+
/* @__PURE__ */ l(
|
|
1327
1404
|
"button",
|
|
1328
1405
|
{
|
|
1329
1406
|
type: "button",
|
|
1330
1407
|
className: "avatar-recording-confirm",
|
|
1331
|
-
onClick:
|
|
1408
|
+
onClick: Vt,
|
|
1332
1409
|
title: "Send",
|
|
1333
|
-
children: /* @__PURE__ */
|
|
1410
|
+
children: /* @__PURE__ */ l(
|
|
1334
1411
|
"svg",
|
|
1335
1412
|
{
|
|
1336
1413
|
width: "18",
|
|
@@ -1342,13 +1419,13 @@ const rn = ({
|
|
|
1342
1419
|
strokeLinecap: "round",
|
|
1343
1420
|
strokeLinejoin: "round",
|
|
1344
1421
|
style: { display: "block" },
|
|
1345
|
-
children: /* @__PURE__ */
|
|
1422
|
+
children: /* @__PURE__ */ l("polyline", { points: "20 6 9 17 4 12" })
|
|
1346
1423
|
}
|
|
1347
1424
|
)
|
|
1348
1425
|
}
|
|
1349
1426
|
)
|
|
1350
|
-
] }) :
|
|
1351
|
-
/* @__PURE__ */
|
|
1427
|
+
] }) : Y && !tt ? /* @__PURE__ */ oe("div", { className: "avatar-input-speaking", children: [
|
|
1428
|
+
/* @__PURE__ */ l(
|
|
1352
1429
|
"div",
|
|
1353
1430
|
{
|
|
1354
1431
|
style: {
|
|
@@ -1358,20 +1435,20 @@ const rn = ({
|
|
|
1358
1435
|
alignItems: "center",
|
|
1359
1436
|
paddingRight: "8px"
|
|
1360
1437
|
},
|
|
1361
|
-
children: /* @__PURE__ */
|
|
1438
|
+
children: /* @__PURE__ */ l(Tt, { analyser: xt })
|
|
1362
1439
|
}
|
|
1363
1440
|
),
|
|
1364
|
-
/* @__PURE__ */
|
|
1441
|
+
/* @__PURE__ */ l(
|
|
1365
1442
|
"button",
|
|
1366
1443
|
{
|
|
1367
1444
|
type: "button",
|
|
1368
1445
|
className: "avatar-speaking-stop",
|
|
1369
|
-
onClick: () =>
|
|
1446
|
+
onClick: () => ze(!0),
|
|
1370
1447
|
title: "Stop",
|
|
1371
|
-
children: /* @__PURE__ */
|
|
1448
|
+
children: /* @__PURE__ */ l("span", { className: "avatar-speaking-stop__icon", "aria-hidden": !0 })
|
|
1372
1449
|
}
|
|
1373
1450
|
)
|
|
1374
|
-
] }) :
|
|
1451
|
+
] }) : ce ? /* @__PURE__ */ l(
|
|
1375
1452
|
"div",
|
|
1376
1453
|
{
|
|
1377
1454
|
style: {
|
|
@@ -1381,12 +1458,12 @@ const rn = ({
|
|
|
1381
1458
|
alignItems: "center",
|
|
1382
1459
|
justifyContent: "center"
|
|
1383
1460
|
},
|
|
1384
|
-
children: /* @__PURE__ */
|
|
1461
|
+
children: /* @__PURE__ */ l("div", { className: "avatar-input-loader" })
|
|
1385
1462
|
}
|
|
1386
|
-
) : /* @__PURE__ */
|
|
1463
|
+
) : /* @__PURE__ */ oe(
|
|
1387
1464
|
"form",
|
|
1388
1465
|
{
|
|
1389
|
-
onSubmit:
|
|
1466
|
+
onSubmit: Jt,
|
|
1390
1467
|
style: {
|
|
1391
1468
|
flex: 1,
|
|
1392
1469
|
display: "flex",
|
|
@@ -1394,20 +1471,20 @@ const rn = ({
|
|
|
1394
1471
|
alignItems: "center"
|
|
1395
1472
|
},
|
|
1396
1473
|
children: [
|
|
1397
|
-
/* @__PURE__ */
|
|
1474
|
+
/* @__PURE__ */ l(
|
|
1398
1475
|
"input",
|
|
1399
1476
|
{
|
|
1400
1477
|
id: "avatar-text-input",
|
|
1401
1478
|
type: "text",
|
|
1402
|
-
value:
|
|
1403
|
-
onChange: (e) =>
|
|
1404
|
-
placeholder:
|
|
1405
|
-
disabled:
|
|
1479
|
+
value: E,
|
|
1480
|
+
onChange: (e) => ee(e.target.value),
|
|
1481
|
+
placeholder: U === "Busy" ? "Assisting another user" : He || "Ask me anything",
|
|
1482
|
+
disabled: ce || U === "Busy",
|
|
1406
1483
|
autoComplete: "off",
|
|
1407
1484
|
style: { width: "100%", height: "100%" }
|
|
1408
1485
|
}
|
|
1409
1486
|
),
|
|
1410
|
-
|
|
1487
|
+
U === "Busy" ? /* @__PURE__ */ l(
|
|
1411
1488
|
"button",
|
|
1412
1489
|
{
|
|
1413
1490
|
type: "button",
|
|
@@ -1415,7 +1492,7 @@ const rn = ({
|
|
|
1415
1492
|
disabled: !0,
|
|
1416
1493
|
style: { backgroundColor: "#1e4a5e" },
|
|
1417
1494
|
title: "Agent at capacity",
|
|
1418
|
-
children: /* @__PURE__ */
|
|
1495
|
+
children: /* @__PURE__ */ l(
|
|
1419
1496
|
"svg",
|
|
1420
1497
|
{
|
|
1421
1498
|
width: "24",
|
|
@@ -1424,7 +1501,7 @@ const rn = ({
|
|
|
1424
1501
|
fill: "none",
|
|
1425
1502
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1426
1503
|
"aria-hidden": "true",
|
|
1427
|
-
children: /* @__PURE__ */
|
|
1504
|
+
children: /* @__PURE__ */ l(
|
|
1428
1505
|
"path",
|
|
1429
1506
|
{
|
|
1430
1507
|
d: "M4 2L20 2L12 10L4 2z M12 14L4 22L20 22L12 14z",
|
|
@@ -1434,15 +1511,15 @@ const rn = ({
|
|
|
1434
1511
|
}
|
|
1435
1512
|
)
|
|
1436
1513
|
}
|
|
1437
|
-
) :
|
|
1514
|
+
) : E.trim() === "" ? /* @__PURE__ */ l(
|
|
1438
1515
|
"button",
|
|
1439
1516
|
{
|
|
1440
1517
|
type: "button",
|
|
1441
1518
|
className: "mic-button",
|
|
1442
|
-
onClick:
|
|
1443
|
-
disabled:
|
|
1519
|
+
onClick: Wt,
|
|
1520
|
+
disabled: ce,
|
|
1444
1521
|
style: { backgroundColor: "#1e4a5e" },
|
|
1445
|
-
children: /* @__PURE__ */
|
|
1522
|
+
children: /* @__PURE__ */ oe(
|
|
1446
1523
|
"svg",
|
|
1447
1524
|
{
|
|
1448
1525
|
width: "28",
|
|
@@ -1451,14 +1528,14 @@ const rn = ({
|
|
|
1451
1528
|
fill: "none",
|
|
1452
1529
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1453
1530
|
children: [
|
|
1454
|
-
/* @__PURE__ */
|
|
1531
|
+
/* @__PURE__ */ l(
|
|
1455
1532
|
"path",
|
|
1456
1533
|
{
|
|
1457
1534
|
d: "M12 14C13.66 14 15 12.66 15 11V5C15 3.34 13.66 2 12 2C10.34 2 9 3.34 9 5V11C9 12.66 10.34 14 12 14Z",
|
|
1458
1535
|
fill: "white"
|
|
1459
1536
|
}
|
|
1460
1537
|
),
|
|
1461
|
-
/* @__PURE__ */
|
|
1538
|
+
/* @__PURE__ */ l(
|
|
1462
1539
|
"path",
|
|
1463
1540
|
{
|
|
1464
1541
|
d: "M17 11C17 13.76 14.76 16 12 16C9.24 16 7 13.76 7 11H5C5 14.53 7.61 17.43 11 17.93V21H13V17.93C16.39 17.43 19 14.53 19 11H17Z",
|
|
@@ -1469,15 +1546,15 @@ const rn = ({
|
|
|
1469
1546
|
}
|
|
1470
1547
|
)
|
|
1471
1548
|
}
|
|
1472
|
-
) : /* @__PURE__ */
|
|
1549
|
+
) : /* @__PURE__ */ l(
|
|
1473
1550
|
"button",
|
|
1474
1551
|
{
|
|
1475
1552
|
type: "submit",
|
|
1476
1553
|
className: "mic-button",
|
|
1477
|
-
disabled:
|
|
1554
|
+
disabled: ce,
|
|
1478
1555
|
style: { backgroundColor: "#1e4a5e" },
|
|
1479
1556
|
title: "Send",
|
|
1480
|
-
children: /* @__PURE__ */
|
|
1557
|
+
children: /* @__PURE__ */ l(
|
|
1481
1558
|
"svg",
|
|
1482
1559
|
{
|
|
1483
1560
|
width: 24,
|
|
@@ -1485,7 +1562,7 @@ const rn = ({
|
|
|
1485
1562
|
viewBox: "0 0 24 24",
|
|
1486
1563
|
fill: "none",
|
|
1487
1564
|
"aria-hidden": "true",
|
|
1488
|
-
children: /* @__PURE__ */
|
|
1565
|
+
children: /* @__PURE__ */ l(
|
|
1489
1566
|
"path",
|
|
1490
1567
|
{
|
|
1491
1568
|
d: "M19 12H5M19 12L14 17M19 12L14 7",
|
|
@@ -1505,22 +1582,22 @@ const rn = ({
|
|
|
1505
1582
|
}
|
|
1506
1583
|
) })
|
|
1507
1584
|
] }),
|
|
1508
|
-
/* @__PURE__ */
|
|
1509
|
-
|
|
1585
|
+
/* @__PURE__ */ l("div", { className: "avatar-wrapper", children: /* @__PURE__ */ oe("div", { className: "avatar-scene-wrapper", children: [
|
|
1586
|
+
ue !== "hidden" && /* @__PURE__ */ l(
|
|
1510
1587
|
"div",
|
|
1511
1588
|
{
|
|
1512
|
-
className: `avatar-bubble${
|
|
1513
|
-
onAnimationEnd:
|
|
1514
|
-
children: /* @__PURE__ */
|
|
1589
|
+
className: `avatar-bubble${ue === "entering" ? " avatar-bubble--entering" : ue === "exiting" ? " avatar-bubble--exiting" : ""}`,
|
|
1590
|
+
onAnimationEnd: Gt,
|
|
1591
|
+
children: /* @__PURE__ */ l("div", { ref: ht, className: `avatar-bubble__content${tt ? " avatar-bubble__content--nudge" : ""}`, children: mt })
|
|
1515
1592
|
}
|
|
1516
1593
|
),
|
|
1517
|
-
/* @__PURE__ */
|
|
1594
|
+
/* @__PURE__ */ l(
|
|
1518
1595
|
"div",
|
|
1519
1596
|
{
|
|
1520
1597
|
className: "avatar-canvas-layer",
|
|
1521
|
-
style: { width:
|
|
1522
|
-
children: /* @__PURE__ */
|
|
1523
|
-
|
|
1598
|
+
style: { width: C, height: C },
|
|
1599
|
+
children: /* @__PURE__ */ oe(
|
|
1600
|
+
Qt,
|
|
1524
1601
|
{
|
|
1525
1602
|
shadows: !0,
|
|
1526
1603
|
camera: { position: [0.2, 1.4, 3], fov: 42 },
|
|
@@ -1528,28 +1605,30 @@ const rn = ({
|
|
|
1528
1605
|
dpr: 1.8,
|
|
1529
1606
|
style: { pointerEvents: "none", width: "100%", height: "100%" },
|
|
1530
1607
|
children: [
|
|
1531
|
-
/* @__PURE__ */
|
|
1532
|
-
/* @__PURE__ */
|
|
1533
|
-
/* @__PURE__ */
|
|
1534
|
-
/* @__PURE__ */
|
|
1535
|
-
/* @__PURE__ */
|
|
1536
|
-
|
|
1608
|
+
/* @__PURE__ */ l(_n, { target: fn }),
|
|
1609
|
+
/* @__PURE__ */ l("ambientLight", { intensity: 0.7 }),
|
|
1610
|
+
/* @__PURE__ */ l("directionalLight", { position: [0, 2, 2], intensity: 1 }),
|
|
1611
|
+
/* @__PURE__ */ l(zt, { preset: "city" }),
|
|
1612
|
+
/* @__PURE__ */ l(en, { fallback: null, children: V !== null && /* @__PURE__ */ l(
|
|
1613
|
+
wn,
|
|
1537
1614
|
{
|
|
1538
|
-
avatarUrl:
|
|
1539
|
-
isPlayingRef:
|
|
1540
|
-
visemeQueueRef:
|
|
1541
|
-
audioContextRef:
|
|
1542
|
-
responseAudioStartTimeRef:
|
|
1543
|
-
adjustments:
|
|
1544
|
-
mood:
|
|
1545
|
-
expression:
|
|
1546
|
-
agentResponse:
|
|
1547
|
-
isSpeaking:
|
|
1548
|
-
nextStartTimeRef:
|
|
1549
|
-
stopPlayback:
|
|
1550
|
-
setIsSpeaking:
|
|
1551
|
-
expressionUrl:
|
|
1552
|
-
onExpressionFinished:
|
|
1615
|
+
avatarUrl: V,
|
|
1616
|
+
isPlayingRef: L,
|
|
1617
|
+
visemeQueueRef: v,
|
|
1618
|
+
audioContextRef: y,
|
|
1619
|
+
responseAudioStartTimeRef: we,
|
|
1620
|
+
adjustments: dn,
|
|
1621
|
+
mood: r,
|
|
1622
|
+
expression: G,
|
|
1623
|
+
agentResponse: ae,
|
|
1624
|
+
isSpeaking: Y,
|
|
1625
|
+
nextStartTimeRef: le,
|
|
1626
|
+
stopPlayback: ze,
|
|
1627
|
+
setIsSpeaking: $,
|
|
1628
|
+
expressionUrl: Ke,
|
|
1629
|
+
onExpressionFinished: Nt,
|
|
1630
|
+
isNudgeResponse: tt,
|
|
1631
|
+
avatarGender: g
|
|
1553
1632
|
}
|
|
1554
1633
|
) })
|
|
1555
1634
|
]
|
|
@@ -1559,17 +1638,17 @@ const rn = ({
|
|
|
1559
1638
|
)
|
|
1560
1639
|
] }) })
|
|
1561
1640
|
] });
|
|
1562
|
-
},
|
|
1563
|
-
token:
|
|
1641
|
+
}, Ln = ({
|
|
1642
|
+
token: f,
|
|
1564
1643
|
onNavigationRequested: A
|
|
1565
|
-
}) => /* @__PURE__ */
|
|
1566
|
-
|
|
1644
|
+
}) => /* @__PURE__ */ l(
|
|
1645
|
+
yn,
|
|
1567
1646
|
{
|
|
1568
|
-
token:
|
|
1647
|
+
token: f,
|
|
1569
1648
|
onNavigationRequested: A
|
|
1570
1649
|
}
|
|
1571
1650
|
);
|
|
1572
1651
|
export {
|
|
1573
|
-
|
|
1652
|
+
Ln as AvatarWidget
|
|
1574
1653
|
};
|
|
1575
1654
|
//# sourceMappingURL=avatar-widget.js.map
|