@sage-rsc/talking-head-react 1.0.43 → 1.0.45
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.cjs +2 -2
- package/dist/index.js +323 -312
- package/package.json +1 -1
- package/src/components/TalkingHeadAvatar.jsx +59 -17
- package/src/lib/talkinghead.mjs +2 -2
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as ye, useRef as
|
|
1
|
+
import { jsxs as ze, jsx as oe } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ye, useRef as Y, useState as re, useCallback as E, useEffect as he, useImperativeHandle as fe, useLayoutEffect as Fe } from "react";
|
|
3
3
|
import * as f from "three";
|
|
4
|
-
import { OrbitControls as
|
|
5
|
-
import { GLTFLoader as
|
|
6
|
-
import { DRACOLoader as
|
|
7
|
-
import { FBXLoader as
|
|
8
|
-
import { RoomEnvironment as
|
|
9
|
-
import
|
|
10
|
-
let m,
|
|
11
|
-
const A = [0, 0, 0, 0], k = new f.Vector3(),
|
|
4
|
+
import { OrbitControls as Pe } from "three/addons/controls/OrbitControls.js";
|
|
5
|
+
import { GLTFLoader as Be } from "three/addons/loaders/GLTFLoader.js";
|
|
6
|
+
import { DRACOLoader as De } from "three/addons/loaders/DRACOLoader.js";
|
|
7
|
+
import { FBXLoader as Ae } from "three/addons/loaders/FBXLoader.js";
|
|
8
|
+
import { RoomEnvironment as Oe } from "three/addons/environments/RoomEnvironment.js";
|
|
9
|
+
import Ne from "three/addons/libs/stats.module.js";
|
|
10
|
+
let m, Q, J;
|
|
11
|
+
const A = [0, 0, 0, 0], k = new f.Vector3(), de = new f.Vector3(), Z = new f.Vector3(), ce = new f.Vector3();
|
|
12
12
|
new f.Plane();
|
|
13
13
|
new f.Ray();
|
|
14
14
|
new f.Euler();
|
|
15
|
-
const
|
|
15
|
+
const X = new f.Quaternion(), Le = new f.Quaternion(), ee = new f.Matrix4(), te = new f.Matrix4();
|
|
16
16
|
new f.Vector3();
|
|
17
|
-
const
|
|
18
|
-
class
|
|
17
|
+
const me = new f.Vector3(0, 0, 1), Ue = new f.Vector3(1, 0, 0), We = new f.Vector3(0, 1, 0), Ve = new f.Vector3(0, 0, 1);
|
|
18
|
+
class Ge {
|
|
19
19
|
constructor(t = null) {
|
|
20
20
|
this.opt = Object.assign({
|
|
21
21
|
warmupMs: 2e3,
|
|
@@ -338,7 +338,7 @@ class Ne {
|
|
|
338
338
|
ea: [0, 0, 0, 0]
|
|
339
339
|
// External acceleration [m/s^2]
|
|
340
340
|
};
|
|
341
|
-
u.boneParent.matrixWorld.decompose(k,
|
|
341
|
+
u.boneParent.matrixWorld.decompose(k, X, Z), k.copy(me).applyQuaternion(X).setY(0).normalize(), X.premultiply(Le.setFromUnitVectors(me, k).invert()).normalize(), u.qWorldInverseYaw = X.clone().normalize(), this.data.push(u), this.dict[h] = u;
|
|
342
342
|
try {
|
|
343
343
|
this.setValue(h, "type", s.type), this.setValue(h, "stiffness", s.stiffness), this.setValue(h, "damping", s.damping), this.setValue(h, "external", s.external), this.setValue(h, "limits", s.limits), this.setValue(h, "excludes", s.excludes), this.setValue(h, "deltaLocal", s.deltaLocal), this.setValue(h, "deltaWorld", s.deltaWorld), this.setValue(h, "pivot", s.pivot), this.setValue(h, "helper", s.helper);
|
|
344
344
|
} catch (l) {
|
|
@@ -369,9 +369,9 @@ class Ne {
|
|
|
369
369
|
o.vBasis.y + A[1],
|
|
370
370
|
o.vBasis.z - A[2]
|
|
371
371
|
);
|
|
372
|
-
else if (o.boneParent.quaternion.copy(o.qBasis), o.pivot && this.opt.isPivots && (o.boneParent.updateWorldMatrix(!1, !1), o.boneParent.matrixWorld.decompose(k,
|
|
372
|
+
else if (o.boneParent.quaternion.copy(o.qBasis), o.pivot && this.opt.isPivots && (o.boneParent.updateWorldMatrix(!1, !1), o.boneParent.matrixWorld.decompose(k, X, Z), k.copy(me).applyQuaternion(X).setY(0).normalize(), X.premultiply(Le.setFromUnitVectors(me, k).invert()).normalize(), o.boneParent.quaternion.multiply(X.invert()), o.boneParent.quaternion.multiply(o.qWorldInverseYaw)), o.isZ && (m = Math.atan(A[0] / o.l), X.setFromAxisAngle(Ve, -m), o.boneParent.quaternion.multiply(X)), o.isY && (m = o.l / 3, m = m * Math.tanh(A[1] / m), o.bone.position.setLength(o.l + m)), o.isX && (m = Math.atan(A[2] / o.l), X.setFromAxisAngle(Ue, -m), o.boneParent.quaternion.multiply(X)), o.isT && (m = 1.5 * Math.tanh(A[3] * 1.5), X.setFromAxisAngle(We, -m), o.boneParent.quaternion.multiply(X)), o.boneParent.updateWorldMatrix(!1, !0), o.excludes && this.opt.isExcludes)
|
|
373
373
|
for (i = 0, s = o.excludes.length; i < s; i++)
|
|
374
|
-
m = o.excludes[i],
|
|
374
|
+
m = o.excludes[i], Z.set(0, 0, 0), m.deltaLocal && (Z.x += m.deltaLocal[0], Z.y += m.deltaLocal[1], Z.z += m.deltaLocal[2]), Z.applyMatrix4(m.bone.matrixWorld), te.copy(o.boneParent.matrixWorld).invert(), Z.applyMatrix4(te), k.copy(o.bone.position), !(k.distanceToSquared(Z) >= m.radiusSq) && (J = k.length(), Q = Z.length(), !(Q > m.radius + J) && (Q < Math.abs(m.radius - J) || (Q = (Q * Q + J * J - m.radiusSq) / (2 * Q), Z.normalize(), ce.copy(Z).multiplyScalar(Q), Q = Math.sqrt(J * J - Q * Q), k.subVectors(k, ce).projectOnPlane(Z).normalize().multiplyScalar(Q), de.subVectors(o.vBasis, ce).projectOnPlane(Z).normalize(), J = de.dot(k), J < 0 && (J = Math.sqrt(Q * Q - J * J), de.multiplyScalar(J), k.add(de)), k.add(ce).normalize(), Z.copy(o.bone.position).normalize(), X.setFromUnitVectors(Z, k), o.boneParent.quaternion.premultiply(X), o.boneParent.updateWorldMatrix(!1, !0))));
|
|
375
375
|
}
|
|
376
376
|
this.helpers.isActive && this.updateHelpers();
|
|
377
377
|
}
|
|
@@ -489,7 +489,7 @@ class Ne {
|
|
|
489
489
|
this.stop(), this.scene = null, this.armature = null, this.config = [], this.data = [], this.dict = {}, this.objectsUpdate = [], this.timerMs = 0;
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
|
-
class
|
|
492
|
+
class Ze {
|
|
493
493
|
constructor(t) {
|
|
494
494
|
this.audioContext = t, this.analyzer = null, this.dataArray = null, this.bufferLength = 0;
|
|
495
495
|
}
|
|
@@ -814,7 +814,7 @@ class Ue {
|
|
|
814
814
|
return n * s;
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
|
-
class
|
|
817
|
+
class Xe {
|
|
818
818
|
/**
|
|
819
819
|
* @constructor
|
|
820
820
|
*/
|
|
@@ -1396,11 +1396,11 @@ class We {
|
|
|
1396
1396
|
return e;
|
|
1397
1397
|
}
|
|
1398
1398
|
}
|
|
1399
|
-
const
|
|
1399
|
+
const Ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1400
1400
|
__proto__: null,
|
|
1401
|
-
LipsyncEn:
|
|
1401
|
+
LipsyncEn: Xe
|
|
1402
1402
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1403
|
-
class
|
|
1403
|
+
class je {
|
|
1404
1404
|
/**
|
|
1405
1405
|
* @constructor
|
|
1406
1406
|
*/
|
|
@@ -1754,11 +1754,11 @@ class Ge {
|
|
|
1754
1754
|
return e;
|
|
1755
1755
|
}
|
|
1756
1756
|
}
|
|
1757
|
-
const
|
|
1757
|
+
const Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1758
1758
|
__proto__: null,
|
|
1759
|
-
LipsyncDe:
|
|
1759
|
+
LipsyncDe: je
|
|
1760
1760
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1761
|
-
class
|
|
1761
|
+
class qe {
|
|
1762
1762
|
/**
|
|
1763
1763
|
* @constructor
|
|
1764
1764
|
*/
|
|
@@ -2289,11 +2289,11 @@ class Xe {
|
|
|
2289
2289
|
return e;
|
|
2290
2290
|
}
|
|
2291
2291
|
}
|
|
2292
|
-
const
|
|
2292
|
+
const _e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2293
2293
|
__proto__: null,
|
|
2294
|
-
LipsyncFr:
|
|
2294
|
+
LipsyncFr: qe
|
|
2295
2295
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2296
|
-
class
|
|
2296
|
+
class Ke {
|
|
2297
2297
|
/**
|
|
2298
2298
|
* @constructor
|
|
2299
2299
|
*/
|
|
@@ -2436,11 +2436,11 @@ class je {
|
|
|
2436
2436
|
return e;
|
|
2437
2437
|
}
|
|
2438
2438
|
}
|
|
2439
|
-
const
|
|
2439
|
+
const Je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2440
2440
|
__proto__: null,
|
|
2441
|
-
LipsyncFi:
|
|
2441
|
+
LipsyncFi: Ke
|
|
2442
2442
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2443
|
-
class
|
|
2443
|
+
class $e {
|
|
2444
2444
|
/**
|
|
2445
2445
|
* @constructor
|
|
2446
2446
|
*/
|
|
@@ -2620,24 +2620,24 @@ class qe {
|
|
|
2620
2620
|
return e;
|
|
2621
2621
|
}
|
|
2622
2622
|
}
|
|
2623
|
-
const
|
|
2623
|
+
const et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2624
2624
|
__proto__: null,
|
|
2625
|
-
LipsyncLt:
|
|
2626
|
-
}, Symbol.toStringTag, { value: "Module" })), Ke = new URL("data:text/javascript;base64,Y2xhc3MgUGxheWJhY2tXb3JrbGV0IGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgRlNNID0gewogICAgSURMRTogMCwKICAgIFBMQVlJTkc6IDEsCiAgfTsKCiAgY29uc3RydWN0b3Iob3B0aW9ucykgewogICAgc3VwZXIoKTsKICAgIHRoaXMuc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yaWNzIHNob3dpbmcgY2xlYXJlZCBzdGF0ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9IGNhdGNoIChfKSB7IH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnJlc2V0KCk7IC8vIFJlc2V0IHRvIElETEUgc3RhdGUgZm9yIHJldXNlCiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlIGxvb3AKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIC8vIEJVRkZFUiBVTkRFUlJVTiAoTEFHKTogUGxheSBzaWxlbmNlIGFuZCB3YWl0IGZvciBtb3JlIGRhdGEuCiAgICAgICAgICAgIHRoaXMuX3NpbGVuY2VGcmFtZXNDb3VudCsrOwogICAgICAgICAgICBpZiAodGhpcy5fbWV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
}, N = new f.Quaternion(),
|
|
2625
|
+
LipsyncLt: $e
|
|
2626
|
+
}, Symbol.toStringTag, { value: "Module" })), tt = new URL("data:text/javascript;base64,Y2xhc3MgUGxheWJhY2tXb3JrbGV0IGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgRlNNID0gewogICAgSURMRTogMCwKICAgIFBMQVlJTkc6IDEsCiAgfTsKCiAgY29uc3RydWN0b3Iob3B0aW9ucykgewogICAgc3VwZXIoKTsKICAgIHRoaXMucG9ydC5vbm1lc3NhZ2UgPSB0aGlzLmhhbmRsZU1lc3NhZ2UuYmluZCh0aGlzKTsKCiAgICB0aGlzLl9zYW1wbGVSYXRlID0gb3B0aW9ucz8ucHJvY2Vzc29yT3B0aW9ucz8uc2FtcGxlUmF0ZSB8fCBzYW1wbGVSYXRlOwogICAgdGhpcy5fc2NhbGUgPSAxIC8gMzI3Njg7IC8vIFBDTTE2IC0+IGZsb2F0CgogICAgLy8gU2lsZW5jZSBkZXRlY3Rpb24gdGhyZXNob2xkICgxIHNlY29uZCkgYXMgYSBmYWxsYmFjayBzYWZldHkgbmV0CiAgICBjb25zdCBzaWxlbmNlRHVyYXRpb25TZWNvbmRzID0gMS4wOwogICAgdGhpcy5fc2lsZW5jZVRocmVzaG9sZEJsb2NrcyA9IE1hdGguY2VpbCgodGhpcy5fc2FtcGxlUmF0ZSAqIHNpbGVuY2VEdXJhdGlvblNlY29uZHMpIC8gMTI4KTsKCiAgICAvLyBNZXRyaWNzIGNvbmZpZ3VyYXRpb24gdmlhIG9wdGlvbnMKICAgIGNvbnN0IG1ldHJpY3NDZmcgPSBvcHRpb25zPy5wcm9jZXNzb3JPcHRpb25zPy5tZXRyaWNzIHx8IHt9OwogICAgdGhpcy5fbWV0cmljc0VuYWJsZWQgPSBtZXRyaWNzQ2ZnLmVuYWJsZWQgIT09IGZhbHNlOwogICAgY29uc3QgaW50ZXJ2YWxIeiA9ICh0eXBlb2YgbWV0c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6IEVpdGhlciBleHBsaWNpdGx5IHNpZ25hbGVkIG9yIHRpbWVkIG91dC4KICAgICAgICAgICAgaWYgKCF0aGlzLl9oYXNTZW50RW5kZWQpIHsKICAgICAgICAgICAgICB0aGlzLnBvcnQucG9zdE1lc3NhZ2UoeyB0eXBlOiAicGxheWJhY2stZW5kZWQiIH0pOwogICAgICAgICAgICAgIHRoaXMuX2hhc1NlbnRFbmRlZCA9IHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgLy8gU2VuZCBmaW5hbCBtZXRyaWNzIHNob3dpbmcgY2xlYXJlZCBzdGF0ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9IGNhdGNoIChfKSB7IH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnJlc2V0KCk7IC8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gICAvLyBBTFdBWVMgcmV0dXJuIHRydWUgdG8ga2VlcCB0aGUgcHJvY2Vzc29yIGFsaXZlIGZvciByZXVzZS4KICAgIHJldHVybiB0cnVlOwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoInBsYXliYWNrLXdvcmtsZXQiLCBQbGF5YmFja1dvcmtsZXQpOwo=", import.meta.url), Se = {
|
|
2627
|
+
en: Ye,
|
|
2628
|
+
de: Qe,
|
|
2629
|
+
fr: _e,
|
|
2630
|
+
fi: Je,
|
|
2631
|
+
lt: et
|
|
2632
|
+
}, N = new f.Quaternion(), M = new f.Euler(), ie = new f.Vector3(), ne = new f.Vector3(), ke = new f.Box3();
|
|
2633
2633
|
new f.Matrix4();
|
|
2634
2634
|
new f.Matrix4();
|
|
2635
2635
|
new f.Vector3();
|
|
2636
2636
|
new f.Vector3(0, 0, 1);
|
|
2637
|
-
const
|
|
2637
|
+
const it = new f.Vector3(1, 0, 0);
|
|
2638
2638
|
new f.Vector3(0, 1, 0);
|
|
2639
2639
|
new f.Vector3(0, 0, 1);
|
|
2640
|
-
class
|
|
2640
|
+
class Ce {
|
|
2641
2641
|
/**
|
|
2642
2642
|
* Avatar.
|
|
2643
2643
|
* @typedef {Object} Avatar
|
|
@@ -2734,9 +2734,9 @@ class Se {
|
|
|
2734
2734
|
cameraPanEnable: !1,
|
|
2735
2735
|
cameraZoomEnable: !1,
|
|
2736
2736
|
lightAmbientColor: 16777215,
|
|
2737
|
-
lightAmbientIntensity:
|
|
2737
|
+
lightAmbientIntensity: 1.25,
|
|
2738
2738
|
lightDirectColor: 8947882,
|
|
2739
|
-
lightDirectIntensity:
|
|
2739
|
+
lightDirectIntensity: 12,
|
|
2740
2740
|
lightDirectPhi: 1,
|
|
2741
2741
|
lightDirectTheta: 2,
|
|
2742
2742
|
lightSpotIntensity: 0,
|
|
@@ -2763,7 +2763,7 @@ class Se {
|
|
|
2763
2763
|
avatarOnlyCamera: null,
|
|
2764
2764
|
statsNode: null,
|
|
2765
2765
|
statsStyle: null
|
|
2766
|
-
}, Object.assign(this.opt, e || {}), this.opt.statsNode && (this.stats = new
|
|
2766
|
+
}, Object.assign(this.opt, e || {}), this.opt.statsNode && (this.stats = new Ne(), this.opt.statsStyle && (this.stats.dom.style.cssText = this.opt.statsStyle), this.opt.statsNode.appendChild(this.stats.dom)), this.poseTemplates = {
|
|
2767
2767
|
side: {
|
|
2768
2768
|
standing: !0,
|
|
2769
2769
|
props: {
|
|
@@ -4062,7 +4062,7 @@ class Se {
|
|
|
4062
4062
|
this.opt.lightSpotDispersion
|
|
4063
4063
|
), this.setLighting(this.opt);
|
|
4064
4064
|
const r = new f.PMREMGenerator(this.renderer);
|
|
4065
|
-
r.compileEquirectangularShader(), this.scene.environment = r.fromScene(new
|
|
4065
|
+
r.compileEquirectangularShader(), this.scene.environment = r.fromScene(new Oe()).texture, this.resizeobserver = new ResizeObserver(this.onResize.bind(this)), this.resizeobserver.observe(this.nodeAvatar), this.controls = new Pe(this.camera, this.renderer.domElement), this.controls.enableZoom = this.opt.cameraZoomEnable, this.controls.enableRotate = this.opt.cameraRotateEnable, this.controls.enablePan = this.opt.cameraPanEnable, this.controls.minDistance = 2, this.controls.maxDistance = 2e3, this.controls.autoRotateSpeed = 0, this.controls.autoRotate = !1, this.controls.update(), this.cameraClock = null;
|
|
4066
4066
|
}
|
|
4067
4067
|
this.ikMesh = new f.SkinnedMesh();
|
|
4068
4068
|
const s = {
|
|
@@ -4080,14 +4080,14 @@ class Se {
|
|
|
4080
4080
|
Object.entries(s).forEach((r, h) => {
|
|
4081
4081
|
const a = new f.Bone();
|
|
4082
4082
|
a.name = r[0], r[1] ? this.ikMesh.getObjectByName(r[1]).add(a) : this.ikMesh.add(a), o.push(a);
|
|
4083
|
-
}), this.ikMesh.bind(new f.Skeleton(o)), this.dynamicbones = new
|
|
4083
|
+
}), this.ikMesh.bind(new f.Skeleton(o)), this.dynamicbones = new Ge(), this.isStreaming = !1, this.streamWorkletNode = null, this.streamAudioStartTime = null, this.streamWaitForAudioChunks = !0, this.streamLipsyncLang = null, this.streamLipsyncType = "visemes", this.streamLipsyncQueue = [];
|
|
4084
4084
|
}
|
|
4085
4085
|
/**
|
|
4086
4086
|
* Helper that re/creates the audio context and the other nodes.
|
|
4087
4087
|
* @param {number} sampleRate
|
|
4088
4088
|
*/
|
|
4089
4089
|
initAudioGraph(t = null) {
|
|
4090
|
-
if (this.audioCtx && this.audioCtx.state !== "closed" && this.audioCtx.close(), t ? this.audioCtx = new AudioContext({ sampleRate: t }) : this.audioCtx = new AudioContext(), this.audioSpeechSource = this.audioCtx.createBufferSource(), this.audioBackgroundSource = this.audioCtx.createBufferSource(), this.audioBackgroundGainNode = this.audioCtx.createGain(), this.audioSpeechGainNode = this.audioCtx.createGain(), this.audioStreamGainNode = this.audioCtx.createGain(), this.audioAnalyzerNode = this.audioCtx.createAnalyser(), this.audioAnalyzerNode.fftSize = 256, this.audioAnalyzerNode.smoothingTimeConstant = 0.1, this.audioAnalyzerNode.minDecibels = -70, this.audioAnalyzerNode.maxDecibels = -10, this.audioAnalyzer = new
|
|
4090
|
+
if (this.audioCtx && this.audioCtx.state !== "closed" && this.audioCtx.close(), t ? this.audioCtx = new AudioContext({ sampleRate: t }) : this.audioCtx = new AudioContext(), this.audioSpeechSource = this.audioCtx.createBufferSource(), this.audioBackgroundSource = this.audioCtx.createBufferSource(), this.audioBackgroundGainNode = this.audioCtx.createGain(), this.audioSpeechGainNode = this.audioCtx.createGain(), this.audioStreamGainNode = this.audioCtx.createGain(), this.audioAnalyzerNode = this.audioCtx.createAnalyser(), this.audioAnalyzerNode.fftSize = 256, this.audioAnalyzerNode.smoothingTimeConstant = 0.1, this.audioAnalyzerNode.minDecibels = -70, this.audioAnalyzerNode.maxDecibels = -10, this.audioAnalyzer = new Ze(this.audioCtx), this.audioReverbNode = this.audioCtx.createConvolver(), this.audioBackgroundGainNode.connect(this.audioReverbNode), this.audioAnalyzerNode.connect(this.audioSpeechGainNode), this.audioSpeechGainNode.connect(this.audioReverbNode), this.audioStreamGainNode.connect(this.audioReverbNode), this.audioReverbNode.connect(this.audioCtx.destination), this.setReverb(this.currentReverb || null), this.setMixerGain(
|
|
4091
4091
|
this.opt.mixerGainSpeech,
|
|
4092
4092
|
this.opt.mixerGainBackground
|
|
4093
4093
|
), this.workletLoaded = !1, this.streamWorkletNode) {
|
|
@@ -4228,9 +4228,9 @@ class Se {
|
|
|
4228
4228
|
async showAvatar(t, e = null) {
|
|
4229
4229
|
if (!t || !t.hasOwnProperty("url"))
|
|
4230
4230
|
throw new Error("Invalid parameter. The avatar must have at least 'url' specified.");
|
|
4231
|
-
const i = new
|
|
4231
|
+
const i = new Be();
|
|
4232
4232
|
if (this.dracoEnabled) {
|
|
4233
|
-
const a = new
|
|
4233
|
+
const a = new De();
|
|
4234
4234
|
a.setDecoderPath(this.dracoDecoderPath), i.setDRACOLoader(a);
|
|
4235
4235
|
}
|
|
4236
4236
|
let n = await i.loadAsync(t.url, e);
|
|
@@ -4374,9 +4374,9 @@ class Se {
|
|
|
4374
4374
|
updatePoseDelta() {
|
|
4375
4375
|
for (const [t, e] of Object.entries(this.poseDelta.props)) {
|
|
4376
4376
|
if (e.x === 0 && e.y === 0 && e.z === 0) continue;
|
|
4377
|
-
|
|
4377
|
+
M.set(e.x, e.y, e.z);
|
|
4378
4378
|
const i = this.poseAvatar.props[t];
|
|
4379
|
-
i.isQuaternion ? (N.setFromEuler(
|
|
4379
|
+
i.isQuaternion ? (N.setFromEuler(M), i.multiply(N)) : i.isVector3 && i.add(M);
|
|
4380
4380
|
}
|
|
4381
4381
|
}
|
|
4382
4382
|
/**
|
|
@@ -5159,7 +5159,7 @@ class Se {
|
|
|
5159
5159
|
}, n.x ? new f.Vector3(n.x, n.y, n.z) : null, !0, n.d);
|
|
5160
5160
|
break;
|
|
5161
5161
|
}
|
|
5162
|
-
if ((h || a) && (
|
|
5162
|
+
if ((h || a) && (M.setFromQuaternion(this.poseAvatar.props["Head.quaternion"]), M.x = Math.max(-0.9, Math.min(0.9, 2 * M.x - 0.5)), M.y = Math.max(-0.9, Math.min(0.9, -2.5 * M.y)), h ? (Object.assign(this.mtAvatar.eyesLookDown, { system: M.x < 0 ? -M.x : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyesLookUp, { system: M.x < 0 ? 0 : M.x, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInLeft, { system: M.y < 0 ? -M.y : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutLeft, { system: M.y < 0 ? 0 : M.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInRight, { system: M.y < 0 ? 0 : M.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutRight, { system: M.y < 0 ? -M.y : 0, needsUpdate: !0 }), a && (i = -this.mtAvatar.bodyRotateY.value, n = this.gaussianRandom(-0.2, 0.2), this.animQueue.push(this.animFactory({
|
|
5163
5163
|
name: "headmove",
|
|
5164
5164
|
dt: [[1e3, 2e3], [1e3, 2e3, 1, 2], [1e3, 2e3], [1e3, 2e3, 1, 2]],
|
|
5165
5165
|
vs: {
|
|
@@ -5180,7 +5180,7 @@ class Se {
|
|
|
5180
5180
|
eyeLookOutRight: [null, 0],
|
|
5181
5181
|
eyeContact: [0]
|
|
5182
5182
|
}
|
|
5183
|
-
})))), e > 2 * this.animFrameDur && (e = 2 * this.animFrameDur), (this.viewName !== "full" || this.isAvatarOnly) && (i = this.mtRandomized[Math.floor(Math.random() * this.mtRandomized.length)], n = this.mtAvatar[i], n.needsUpdate || Object.assign(n, { base: (this.mood.baseline[i] || 0) + (1 + r / 255) * Math.random() / 5, needsUpdate: !0 })), this.updatePoseBase(this.animClock), this.mixer && this.mixer.update(e / 1e3 * this.mixer.timeScale), this.updatePoseDelta(), (this.isSpeaking || this.isListening) && h ? r > this.volumeMax ? (this.volumeHeadBase = 0.05, Math.random() > 0.6 && (this.volumeHeadTarget = -0.05 - Math.random() / 15), this.volumeMax = r) : (this.volumeMax *= 0.92, this.volumeHeadTarget = this.volumeHeadBase - 0.9 * (this.volumeHeadBase - this.volumeHeadTarget)) : (this.volumeHeadTarget = 0, this.volumeMax = 0), i = this.volumeHeadTarget - this.volumeHeadCurrent, n = Math.abs(i), n > 1e-4 && (o = n * (this.volumeHeadEasing(Math.min(1, this.volumeHeadVelocity * e / 1e3 / n) / 2 + 0.5) - 0.5), this.volumeHeadCurrent += Math.sign(i) * Math.min(n, o)), Math.abs(this.volumeHeadCurrent) > 1e-4 && (N.setFromAxisAngle(
|
|
5183
|
+
})))), e > 2 * this.animFrameDur && (e = 2 * this.animFrameDur), (this.viewName !== "full" || this.isAvatarOnly) && (i = this.mtRandomized[Math.floor(Math.random() * this.mtRandomized.length)], n = this.mtAvatar[i], n.needsUpdate || Object.assign(n, { base: (this.mood.baseline[i] || 0) + (1 + r / 255) * Math.random() / 5, needsUpdate: !0 })), this.updatePoseBase(this.animClock), this.mixer && this.mixer.update(e / 1e3 * this.mixer.timeScale), this.updatePoseDelta(), (this.isSpeaking || this.isListening) && h ? r > this.volumeMax ? (this.volumeHeadBase = 0.05, Math.random() > 0.6 && (this.volumeHeadTarget = -0.05 - Math.random() / 15), this.volumeMax = r) : (this.volumeMax *= 0.92, this.volumeHeadTarget = this.volumeHeadBase - 0.9 * (this.volumeHeadBase - this.volumeHeadTarget)) : (this.volumeHeadTarget = 0, this.volumeMax = 0), i = this.volumeHeadTarget - this.volumeHeadCurrent, n = Math.abs(i), n > 1e-4 && (o = n * (this.volumeHeadEasing(Math.min(1, this.volumeHeadVelocity * e / 1e3 / n) / 2 + 0.5) - 0.5), this.volumeHeadCurrent += Math.sign(i) * Math.min(n, o)), Math.abs(this.volumeHeadCurrent) > 1e-4 && (N.setFromAxisAngle(it, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(N)), ke.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(ie), ie.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(ne), ne.sub(this.armature.position), this.objectHips.position.y -= ke.min.y / 2, this.objectHips.position.x -= (ie.x + ne.x) / 4, this.objectHips.position.z -= (ie.z + ne.z) / 2, this.dynamicbones.update(e), this.fbxAnimationLoader && this.fbxAnimationLoader.update(), this.opt.update && this.opt.update(e), this.updateMorphTargets(e), this.isAvatarOnly)
|
|
5184
5184
|
this.stats && this.stats.end();
|
|
5185
5185
|
else {
|
|
5186
5186
|
if (this.cameraClock !== null && this.cameraClock < 1e3) {
|
|
@@ -5211,8 +5211,8 @@ class Se {
|
|
|
5211
5211
|
if (!this.lipsync.hasOwnProperty(t)) {
|
|
5212
5212
|
const i = t.toLowerCase(), n = "Lipsync" + t.charAt(0).toUpperCase() + t.slice(1);
|
|
5213
5213
|
try {
|
|
5214
|
-
const s =
|
|
5215
|
-
s && s[n] ? (this.lipsync[t] = new s[n](), console.log(`Loaded lip-sync module for ${t}`)) : console.warn(`Lip-sync module for ${t} not found. Available modules:`, Object.keys(
|
|
5214
|
+
const s = Se[i];
|
|
5215
|
+
s && s[n] ? (this.lipsync[t] = new s[n](), console.log(`Loaded lip-sync module for ${t}`)) : console.warn(`Lip-sync module for ${t} not found. Available modules:`, Object.keys(Se));
|
|
5216
5216
|
} catch (s) {
|
|
5217
5217
|
console.warn(`Failed to load lip-sync module for ${t}:`, s);
|
|
5218
5218
|
}
|
|
@@ -5251,10 +5251,10 @@ class Se {
|
|
|
5251
5251
|
let u = "", l = "", c = 0, d = [], g = [];
|
|
5252
5252
|
const y = Array.from(this.segmenter.segment(t), (x) => x.segment);
|
|
5253
5253
|
for (let x = 0; x < y.length; x++) {
|
|
5254
|
-
const v = x === y.length - 1,
|
|
5254
|
+
const v = x === y.length - 1, H = y[x].match(r);
|
|
5255
5255
|
let p = y[x].match(s);
|
|
5256
|
-
const
|
|
5257
|
-
if (p && !v && !
|
|
5256
|
+
const F = y[x].match(h), z = y[x].match(o);
|
|
5257
|
+
if (p && !v && !F && y[x + 1].match(s) && (p = !1), i && (u += y[x]), H && (!n || n.every((I) => x < I[0] || x > I[1])) && (l += y[x]), (z || p || v) && (l.length && (l = this.lipsyncPreProcessText(l, a), l.length && d.push({
|
|
5258
5258
|
mark: c,
|
|
5259
5259
|
word: l
|
|
5260
5260
|
})), u.length && (g.push({
|
|
@@ -5267,14 +5267,14 @@ class Se {
|
|
|
5267
5267
|
}), u = ""), l.length)) {
|
|
5268
5268
|
const I = this.lipsyncWordsToVisemes(l, a);
|
|
5269
5269
|
if (I && I.visemes && I.visemes.length) {
|
|
5270
|
-
const
|
|
5271
|
-
for (let
|
|
5270
|
+
const O = I.times[I.visemes.length - 1] + I.durations[I.visemes.length - 1];
|
|
5271
|
+
for (let B = 0; B < I.visemes.length; B++)
|
|
5272
5272
|
g.push({
|
|
5273
5273
|
mark: c,
|
|
5274
5274
|
template: { name: "viseme" },
|
|
5275
|
-
ts: [(I.times[
|
|
5275
|
+
ts: [(I.times[B] - 0.6) / O, (I.times[B] + 0.5) / O, (I.times[B] + I.durations[B] + 0.5) / O],
|
|
5276
5276
|
vs: {
|
|
5277
|
-
["viseme_" + I.visemes[
|
|
5277
|
+
["viseme_" + I.visemes[B]]: [null, I.visemes[B] === "PP" || I.visemes[B] === "FF" ? 0.9 : 0.6, 0]
|
|
5278
5278
|
}
|
|
5279
5279
|
});
|
|
5280
5280
|
}
|
|
@@ -5287,7 +5287,7 @@ class Se {
|
|
|
5287
5287
|
};
|
|
5288
5288
|
i && (I.onSubtitles = i), d.length && !e.avatarMute && (I.text = d, e.avatarMood && (I.mood = e.avatarMood), e.ttsLang && (I.lang = e.ttsLang), e.ttsVoice && (I.voice = e.ttsVoice), e.ttsRate && (I.rate = e.ttsRate), e.ttsVoice && (I.pitch = e.ttsPitch), e.ttsVolume && (I.volume = e.ttsVolume)), this.speechQueue.push(I), d = [], l = "", c = 0, g = [];
|
|
5289
5289
|
}
|
|
5290
|
-
if (
|
|
5290
|
+
if (F) {
|
|
5291
5291
|
let I = this.animEmojis[y[x]];
|
|
5292
5292
|
I && I.link && (I = this.animEmojis[I.link]), I && this.speechQueue.push({ emoji: I });
|
|
5293
5293
|
}
|
|
@@ -5385,10 +5385,10 @@ class Se {
|
|
|
5385
5385
|
let y = 0.6 + this.convertRange(g, [0, u], [0, 0.4]);
|
|
5386
5386
|
if (u = Math.min(u, c.visemes.length * 200), d > 0)
|
|
5387
5387
|
for (let x = 0; x < c.visemes.length; x++) {
|
|
5388
|
-
const v = a + c.times[x] / d * u,
|
|
5388
|
+
const v = a + c.times[x] / d * u, H = c.durations[x] / d * u;
|
|
5389
5389
|
o.push({
|
|
5390
5390
|
template: { name: "viseme" },
|
|
5391
|
-
ts: [v - Math.min(60, 2 *
|
|
5391
|
+
ts: [v - Math.min(60, 2 * H / 3), v + Math.min(25, H / 2), v + H + Math.min(60, H / 2)],
|
|
5392
5392
|
vs: {
|
|
5393
5393
|
["viseme_" + c.visemes[x]]: [null, c.visemes[x] === "PP" || c.visemes[x] === "FF" ? 0.9 : y, 0]
|
|
5394
5394
|
}
|
|
@@ -5470,7 +5470,7 @@ class Se {
|
|
|
5470
5470
|
s.lang = o, s.rate = Math.max(0.1, Math.min(10, r)), s.pitch = Math.max(0, Math.min(2, h)), s.volume = Math.max(0, Math.min(1, a));
|
|
5471
5471
|
const u = speechSynthesis.getVoices(), l = t.voice || this.avatar.ttsVoice || this.opt.ttsVoice;
|
|
5472
5472
|
if (l && u.length > 0) {
|
|
5473
|
-
const p = u.find((
|
|
5473
|
+
const p = u.find((F) => F.name.includes(l) || F.lang === o);
|
|
5474
5474
|
p && (s.voice = p);
|
|
5475
5475
|
}
|
|
5476
5476
|
const c = n.length * 100 / s.rate, d = this.audioCtx.createBuffer(1, this.audioCtx.sampleRate * (c / 1e3), this.audioCtx.sampleRate), g = this.avatar.lipsyncLang || this.opt.lipsyncLang || "en", y = this.lipsyncPreProcessText(n, g), x = this.lipsyncWordsToVisemes(y, g);
|
|
@@ -5485,19 +5485,19 @@ class Se {
|
|
|
5485
5485
|
const v = [];
|
|
5486
5486
|
if (x && x.visemes && x.visemes.length > 0) {
|
|
5487
5487
|
const p = x.times[x.visemes.length - 1] + x.durations[x.visemes.length - 1];
|
|
5488
|
-
for (let
|
|
5489
|
-
const z = x.visemes[
|
|
5488
|
+
for (let F = 0; F < x.visemes.length; F++) {
|
|
5489
|
+
const z = x.visemes[F], I = x.times[F] / p, O = x.durations[F] / p, B = I * c, $ = O * c;
|
|
5490
5490
|
v.push({
|
|
5491
5491
|
template: { name: "viseme" },
|
|
5492
|
-
ts: [
|
|
5492
|
+
ts: [B - Math.min(60, 2 * $ / 3), B + Math.min(25, $ / 2), B + $ + Math.min(60, $ / 2)],
|
|
5493
5493
|
vs: {
|
|
5494
5494
|
["viseme_" + z]: [null, z === "PP" || z === "FF" ? 0.9 : 0.6, 0]
|
|
5495
5495
|
}
|
|
5496
5496
|
});
|
|
5497
5497
|
}
|
|
5498
5498
|
}
|
|
5499
|
-
const
|
|
5500
|
-
this.audioPlaylist.push({ anim:
|
|
5499
|
+
const H = [...t.anim, ...v];
|
|
5500
|
+
this.audioPlaylist.push({ anim: H, audio: d }), this.onSubtitles = t.onSubtitles || null, this.resetLips(), t.mood && this.setMood(t.mood), this.playAudio(), s.onend = () => {
|
|
5501
5501
|
e();
|
|
5502
5502
|
}, s.onerror = (p) => {
|
|
5503
5503
|
console.error("Speech synthesis error:", p.error), i(p.error);
|
|
@@ -5895,7 +5895,7 @@ class Se {
|
|
|
5895
5895
|
}
|
|
5896
5896
|
if (!this.workletLoaded)
|
|
5897
5897
|
try {
|
|
5898
|
-
const r = this.audioCtx.audioWorklet.addModule(
|
|
5898
|
+
const r = this.audioCtx.audioWorklet.addModule(tt.href), h = new Promise(
|
|
5899
5899
|
(a, u) => setTimeout(() => u(new Error("Worklet loading timed out")), 5e3)
|
|
5900
5900
|
);
|
|
5901
5901
|
await Promise.race([r, h]), this.workletLoaded = !0;
|
|
@@ -6133,7 +6133,7 @@ class Se {
|
|
|
6133
6133
|
*/
|
|
6134
6134
|
lookAtCamera(t) {
|
|
6135
6135
|
let e;
|
|
6136
|
-
if (this.speakTo && (e = new f.Vector3(), this.speakTo.objectLeftEye?.isObject3D ? (this.speakTo.armature.objectHead, this.speakTo.objectLeftEye.updateMatrixWorld(!0), this.speakTo.objectRightEye.updateMatrixWorld(!0), ie.setFromMatrixPosition(this.speakTo.objectLeftEye.matrixWorld),
|
|
6136
|
+
if (this.speakTo && (e = new f.Vector3(), this.speakTo.objectLeftEye?.isObject3D ? (this.speakTo.armature.objectHead, this.speakTo.objectLeftEye.updateMatrixWorld(!0), this.speakTo.objectRightEye.updateMatrixWorld(!0), ie.setFromMatrixPosition(this.speakTo.objectLeftEye.matrixWorld), ne.setFromMatrixPosition(this.speakTo.objectRightEye.matrixWorld), e.addVectors(ie, ne).divideScalar(2)) : this.speakTo.isObject3D ? this.speakTo.getWorldPosition(e) : this.speakTo.isVector3 ? e.set(this.speakTo) : this.speakTo.x && this.speakTo.y && this.speakTo.z && e.set(this.speakTo.x, this.speakTo.y, this.speakTo.z)), !e) {
|
|
6137
6137
|
if (this.avatar.hasOwnProperty("avatarIgnoreCamera")) {
|
|
6138
6138
|
if (this.avatar.avatarIgnoreCamera) {
|
|
6139
6139
|
this.lookAhead(t);
|
|
@@ -6146,12 +6146,12 @@ class Se {
|
|
|
6146
6146
|
this.lookAt(null, null, t);
|
|
6147
6147
|
return;
|
|
6148
6148
|
}
|
|
6149
|
-
this.objectLeftEye.updateMatrixWorld(!0), this.objectRightEye.updateMatrixWorld(!0), ie.setFromMatrixPosition(this.objectLeftEye.matrixWorld),
|
|
6149
|
+
this.objectLeftEye.updateMatrixWorld(!0), this.objectRightEye.updateMatrixWorld(!0), ie.setFromMatrixPosition(this.objectLeftEye.matrixWorld), ne.setFromMatrixPosition(this.objectRightEye.matrixWorld), ie.add(ne).divideScalar(2), N.copy(this.armature.quaternion), N.multiply(this.poseTarget.props["Hips.quaternion"]), N.multiply(this.poseTarget.props["Spine.quaternion"]), N.multiply(this.poseTarget.props["Spine1.quaternion"]), N.multiply(this.poseTarget.props["Spine2.quaternion"]), N.multiply(this.poseTarget.props["Neck.quaternion"]), N.multiply(this.poseTarget.props["Head.quaternion"]);
|
|
6150
6150
|
const i = new f.Vector3().subVectors(e, ie).normalize(), n = Math.atan2(i.x, i.z), s = Math.asin(-i.y);
|
|
6151
|
-
|
|
6152
|
-
const r = new f.Quaternion().setFromEuler(
|
|
6153
|
-
|
|
6154
|
-
let a =
|
|
6151
|
+
M.set(s, n, 0, "YXZ");
|
|
6152
|
+
const r = new f.Quaternion().setFromEuler(M), h = new f.Quaternion().copy(r).multiply(N.clone().invert());
|
|
6153
|
+
M.setFromQuaternion(h, "YXZ");
|
|
6154
|
+
let a = M.x / (40 / 24) + 0.2, u = M.y / (9 / 4), l = Math.min(0.6, Math.max(-0.3, a)), c = Math.min(0.8, Math.max(-0.8, u)), d = (Math.random() - 0.5) / 4, g = (Math.random() - 0.5) / 4;
|
|
6155
6155
|
if (t) {
|
|
6156
6156
|
let y = this.animQueue.findIndex((v) => v.template.name === "lookat");
|
|
6157
6157
|
y !== -1 && this.animQueue.splice(y, 1);
|
|
@@ -6186,20 +6186,20 @@ class Se {
|
|
|
6186
6186
|
const s = new f.Vector3().setFromMatrixPosition(this.objectLeftEye.matrixWorld), o = new f.Vector3().setFromMatrixPosition(this.objectRightEye.matrixWorld), r = new f.Vector3().addVectors(s, o).divideScalar(2);
|
|
6187
6187
|
r.project(this.camera);
|
|
6188
6188
|
let h = (r.x + 1) / 2 * n.width + n.left, a = -(r.y - 1) / 2 * n.height + n.top;
|
|
6189
|
-
t === null && (t = h), e === null && (e = a), N.copy(this.armature.quaternion), N.multiply(this.poseTarget.props["Hips.quaternion"]), N.multiply(this.poseTarget.props["Spine.quaternion"]), N.multiply(this.poseTarget.props["Spine1.quaternion"]), N.multiply(this.poseTarget.props["Spine2.quaternion"]), N.multiply(this.poseTarget.props["Neck.quaternion"]), N.multiply(this.poseTarget.props["Head.quaternion"]),
|
|
6190
|
-
let u =
|
|
6189
|
+
t === null && (t = h), e === null && (e = a), N.copy(this.armature.quaternion), N.multiply(this.poseTarget.props["Hips.quaternion"]), N.multiply(this.poseTarget.props["Spine.quaternion"]), N.multiply(this.poseTarget.props["Spine1.quaternion"]), N.multiply(this.poseTarget.props["Spine2.quaternion"]), N.multiply(this.poseTarget.props["Neck.quaternion"]), N.multiply(this.poseTarget.props["Head.quaternion"]), M.setFromQuaternion(N);
|
|
6190
|
+
let u = M.x / (40 / 24), l = M.y / (9 / 4), c = Math.min(0.4, Math.max(-0.4, this.camera.rotation.x)), d = Math.min(0.4, Math.max(-0.4, this.camera.rotation.y)), g = Math.max(window.innerWidth - h, h), y = Math.max(window.innerHeight - a, a), x = this.convertRange(e, [a - y, a + y], [-0.3, 0.6]) - u + c, v = this.convertRange(t, [h - g, h + g], [-0.8, 0.8]) - l + d;
|
|
6191
6191
|
x = Math.min(0.6, Math.max(-0.3, x)), v = Math.min(0.8, Math.max(-0.8, v));
|
|
6192
|
-
let
|
|
6192
|
+
let H = (Math.random() - 0.5) / 4, p = (Math.random() - 0.5) / 4;
|
|
6193
6193
|
if (i) {
|
|
6194
|
-
let
|
|
6195
|
-
|
|
6194
|
+
let F = this.animQueue.findIndex((I) => I.template.name === "lookat");
|
|
6195
|
+
F !== -1 && this.animQueue.splice(F, 1);
|
|
6196
6196
|
const z = {
|
|
6197
6197
|
name: "lookat",
|
|
6198
6198
|
dt: [750, i],
|
|
6199
6199
|
vs: {
|
|
6200
|
-
bodyRotateX: [x +
|
|
6200
|
+
bodyRotateX: [x + H],
|
|
6201
6201
|
bodyRotateY: [v + p],
|
|
6202
|
-
eyesRotateX: [-3 *
|
|
6202
|
+
eyesRotateX: [-3 * H + 0.1],
|
|
6203
6203
|
eyesRotateY: [-5 * p],
|
|
6204
6204
|
browInnerUp: [[0, 0.7]],
|
|
6205
6205
|
mouthLeft: [[0, 0.7]],
|
|
@@ -6403,7 +6403,7 @@ class Se {
|
|
|
6403
6403
|
} catch (c) {
|
|
6404
6404
|
console.warn(`Could not verify file existence for ${t}, attempting to load anyway:`, c);
|
|
6405
6405
|
}
|
|
6406
|
-
const u = new
|
|
6406
|
+
const u = new Ae();
|
|
6407
6407
|
let l;
|
|
6408
6408
|
try {
|
|
6409
6409
|
l = await u.loadAsync(t, e);
|
|
@@ -6480,7 +6480,7 @@ class Se {
|
|
|
6480
6480
|
let r = this.animQueue.find((h) => h.template.name === "pose");
|
|
6481
6481
|
r && (r.ts[0] = this.animClock + i * 1e3 + 2e3), this.setPoseFromTemplate(o);
|
|
6482
6482
|
} else {
|
|
6483
|
-
let h = await new
|
|
6483
|
+
let h = await new Ae().loadAsync(t, e);
|
|
6484
6484
|
if (h && h.animations && h.animations[n]) {
|
|
6485
6485
|
let a = h.animations[n];
|
|
6486
6486
|
const u = {};
|
|
@@ -6577,8 +6577,8 @@ class Se {
|
|
|
6577
6577
|
const x = t.iterations || 10;
|
|
6578
6578
|
if (e)
|
|
6579
6579
|
for (let v = 0; v < x; v++) {
|
|
6580
|
-
let
|
|
6581
|
-
for (let p = 0,
|
|
6580
|
+
let H = !1;
|
|
6581
|
+
for (let p = 0, F = y.length; p < F; p++) {
|
|
6582
6582
|
const z = y[p].bone;
|
|
6583
6583
|
z.matrixWorld.decompose(h, a, u), a.invert(), o.setFromMatrixPosition(g.matrixWorld), r.subVectors(o, h), r.applyQuaternion(a), r.normalize(), s.subVectors(e, h), s.applyQuaternion(a), s.normalize();
|
|
6584
6584
|
let I = s.dot(r);
|
|
@@ -6590,9 +6590,9 @@ class Se {
|
|
|
6590
6590
|
y[p].maxx !== void 0 ? y[p].maxx : 1 / 0,
|
|
6591
6591
|
y[p].maxy !== void 0 ? y[p].maxy : 1 / 0,
|
|
6592
6592
|
y[p].maxz !== void 0 ? y[p].maxz : 1 / 0
|
|
6593
|
-
))), z.updateMatrixWorld(!0),
|
|
6593
|
+
))), z.updateMatrixWorld(!0), H = !0);
|
|
6594
6594
|
}
|
|
6595
|
-
if (!
|
|
6595
|
+
if (!H) break;
|
|
6596
6596
|
}
|
|
6597
6597
|
n && y.forEach((v) => {
|
|
6598
6598
|
this.poseTarget.props[v.link + ".quaternion"].copy(v.bone.quaternion), this.poseTarget.props[v.link + ".quaternion"].t = this.animClock, this.poseTarget.props[v.link + ".quaternion"].d = n;
|
|
@@ -6625,7 +6625,7 @@ const ae = {
|
|
|
6625
6625
|
josh: "VR6AewLTigWG4xSOukaG"
|
|
6626
6626
|
// Male, American
|
|
6627
6627
|
}
|
|
6628
|
-
},
|
|
6628
|
+
}, we = {
|
|
6629
6629
|
defaultVoice: "aura-2-thalia-en",
|
|
6630
6630
|
// Thalia (Female, English)
|
|
6631
6631
|
voices: {
|
|
@@ -6654,17 +6654,17 @@ function xe() {
|
|
|
6654
6654
|
voices: ae.voices
|
|
6655
6655
|
};
|
|
6656
6656
|
}
|
|
6657
|
-
function
|
|
6658
|
-
const
|
|
6659
|
-
return Object.entries(
|
|
6657
|
+
function mt() {
|
|
6658
|
+
const D = xe(), t = [];
|
|
6659
|
+
return Object.entries(D.voices).forEach(([e, i]) => {
|
|
6660
6660
|
t.push({
|
|
6661
6661
|
value: i,
|
|
6662
|
-
label: `${e.charAt(0).toUpperCase() + e.slice(1)} (${
|
|
6662
|
+
label: `${e.charAt(0).toUpperCase() + e.slice(1)} (${D.service})`
|
|
6663
6663
|
});
|
|
6664
6664
|
}), t;
|
|
6665
6665
|
}
|
|
6666
|
-
const
|
|
6667
|
-
avatarUrl:
|
|
6666
|
+
const He = ye(({
|
|
6667
|
+
avatarUrl: D = "/avatars/brunette.glb",
|
|
6668
6668
|
avatarBody: t = "F",
|
|
6669
6669
|
mood: e = "neutral",
|
|
6670
6670
|
ttsLang: i = "en",
|
|
@@ -6685,201 +6685,212 @@ const ke = ye(({
|
|
|
6685
6685
|
style: y = {},
|
|
6686
6686
|
animations: x = {}
|
|
6687
6687
|
}, v) => {
|
|
6688
|
-
const
|
|
6689
|
-
let
|
|
6690
|
-
S === "browser" ?
|
|
6688
|
+
const H = Y(null), p = Y(null), [F, z] = re(!0), [I, O] = re(null), [B, $] = re(!1), j = xe(), S = n || j.service;
|
|
6689
|
+
let P;
|
|
6690
|
+
S === "browser" ? P = {
|
|
6691
6691
|
service: "browser",
|
|
6692
6692
|
endpoint: "",
|
|
6693
6693
|
apiKey: null,
|
|
6694
6694
|
defaultVoice: "Google US English"
|
|
6695
|
-
} : S === "elevenlabs" ?
|
|
6695
|
+
} : S === "elevenlabs" ? P = {
|
|
6696
6696
|
service: "elevenlabs",
|
|
6697
6697
|
endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
|
|
6698
|
-
apiKey: o ||
|
|
6699
|
-
defaultVoice: s ||
|
|
6700
|
-
voices:
|
|
6701
|
-
} : S === "deepgram" ?
|
|
6698
|
+
apiKey: o || j.apiKey,
|
|
6699
|
+
defaultVoice: s || j.defaultVoice || ae.defaultVoice,
|
|
6700
|
+
voices: j.voices || ae.voices
|
|
6701
|
+
} : S === "deepgram" ? P = {
|
|
6702
6702
|
service: "deepgram",
|
|
6703
6703
|
endpoint: "https://api.deepgram.com/v1/speak",
|
|
6704
|
-
apiKey: o ||
|
|
6705
|
-
defaultVoice: s ||
|
|
6706
|
-
voices:
|
|
6707
|
-
} :
|
|
6708
|
-
...
|
|
6704
|
+
apiKey: o || j.apiKey,
|
|
6705
|
+
defaultVoice: s || j.defaultVoice || we.defaultVoice,
|
|
6706
|
+
voices: j.voices || we.voices
|
|
6707
|
+
} : P = {
|
|
6708
|
+
...j,
|
|
6709
6709
|
// Override API key if provided via props
|
|
6710
|
-
apiKey: o !== null ? o :
|
|
6710
|
+
apiKey: o !== null ? o : j.apiKey
|
|
6711
6711
|
};
|
|
6712
6712
|
const W = {
|
|
6713
|
-
url:
|
|
6713
|
+
url: D,
|
|
6714
6714
|
body: t,
|
|
6715
6715
|
avatarMood: e,
|
|
6716
6716
|
ttsLang: S === "browser" ? "en-US" : i,
|
|
6717
|
-
ttsVoice: s ||
|
|
6717
|
+
ttsVoice: s || P.defaultVoice,
|
|
6718
6718
|
lipsyncLang: "en",
|
|
6719
6719
|
showFullAvatar: a,
|
|
6720
6720
|
bodyMovement: r,
|
|
6721
6721
|
movementIntensity: h
|
|
6722
6722
|
}, V = {
|
|
6723
|
-
ttsEndpoint:
|
|
6724
|
-
ttsApikey:
|
|
6723
|
+
ttsEndpoint: P.endpoint,
|
|
6724
|
+
ttsApikey: P.apiKey,
|
|
6725
6725
|
ttsService: S,
|
|
6726
6726
|
lipsyncModules: ["en"],
|
|
6727
6727
|
cameraView: u
|
|
6728
|
-
},
|
|
6729
|
-
if (!(!
|
|
6728
|
+
}, q = E(async () => {
|
|
6729
|
+
if (!(!H.current || p.current))
|
|
6730
6730
|
try {
|
|
6731
|
-
if (z(!0),
|
|
6731
|
+
if (z(!0), O(null), p.current = new Ce(H.current, V), p.current.controls && (p.current.controls.enableRotate = !1, p.current.controls.enableZoom = !1, p.current.controls.enablePan = !1, p.current.controls.enableDamping = !1), x && Object.keys(x).length > 0 && (p.current.customAnimations = x), await p.current.showAvatar(W, (U) => {
|
|
6732
6732
|
if (U.lengthComputable) {
|
|
6733
|
-
const
|
|
6734
|
-
c(
|
|
6733
|
+
const T = Math.min(100, Math.round(U.loaded / U.total * 100));
|
|
6734
|
+
c(T);
|
|
6735
6735
|
}
|
|
6736
6736
|
}), await new Promise((U) => {
|
|
6737
|
-
const
|
|
6738
|
-
p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? U() : setTimeout(
|
|
6737
|
+
const T = () => {
|
|
6738
|
+
p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? U() : setTimeout(T, 100);
|
|
6739
6739
|
};
|
|
6740
|
-
|
|
6740
|
+
T();
|
|
6741
6741
|
}), p.current && p.current.setShowFullAvatar)
|
|
6742
6742
|
try {
|
|
6743
6743
|
p.current.setShowFullAvatar(a);
|
|
6744
6744
|
} catch (U) {
|
|
6745
6745
|
console.warn("Error setting full body mode on initialization:", U);
|
|
6746
6746
|
}
|
|
6747
|
-
p.current && p.current.controls && (p.current.controls.enableRotate = !1, p.current.controls.enableZoom = !1, p.current.controls.enablePan = !1, p.current.controls.enableDamping = !1, p.current.controls.update()), z(!1),
|
|
6748
|
-
const
|
|
6747
|
+
p.current && p.current.controls && (p.current.controls.enableRotate = !1, p.current.controls.enableZoom = !1, p.current.controls.enablePan = !1, p.current.controls.enableDamping = !1, p.current.controls.update()), z(!1), $(!0), l(p.current);
|
|
6748
|
+
const C = () => {
|
|
6749
6749
|
document.visibilityState === "visible" ? p.current?.start() : p.current?.stop();
|
|
6750
6750
|
};
|
|
6751
|
-
return document.addEventListener("visibilitychange",
|
|
6752
|
-
document.removeEventListener("visibilitychange",
|
|
6751
|
+
return document.addEventListener("visibilitychange", C), () => {
|
|
6752
|
+
document.removeEventListener("visibilitychange", C);
|
|
6753
6753
|
};
|
|
6754
6754
|
} catch (L) {
|
|
6755
|
-
console.error("Error initializing TalkingHead:", L),
|
|
6755
|
+
console.error("Error initializing TalkingHead:", L), O(L.message || "Failed to initialize avatar"), z(!1), d(L);
|
|
6756
6756
|
}
|
|
6757
|
-
}, [
|
|
6758
|
-
he(() => (
|
|
6757
|
+
}, [D, t, e, i, n, s, o, a, r, h, u]);
|
|
6758
|
+
he(() => (q(), () => {
|
|
6759
6759
|
p.current && (p.current.stop(), p.current.dispose(), p.current = null);
|
|
6760
|
-
}), [
|
|
6761
|
-
if (!
|
|
6760
|
+
}), [q]), he(() => {
|
|
6761
|
+
if (!H.current || !p.current) return;
|
|
6762
6762
|
const L = new ResizeObserver((U) => {
|
|
6763
|
-
for (const
|
|
6763
|
+
for (const T of U)
|
|
6764
6764
|
p.current && p.current.onResize && p.current.onResize();
|
|
6765
6765
|
});
|
|
6766
|
-
L.observe(
|
|
6767
|
-
const
|
|
6766
|
+
L.observe(H.current);
|
|
6767
|
+
const C = () => {
|
|
6768
6768
|
p.current && p.current.onResize && p.current.onResize();
|
|
6769
6769
|
};
|
|
6770
|
-
return window.addEventListener("resize",
|
|
6771
|
-
L.disconnect(), window.removeEventListener("resize",
|
|
6770
|
+
return window.addEventListener("resize", C), () => {
|
|
6771
|
+
L.disconnect(), window.removeEventListener("resize", C);
|
|
6772
6772
|
};
|
|
6773
|
-
}, [
|
|
6774
|
-
const
|
|
6773
|
+
}, [B]);
|
|
6774
|
+
const _ = E(async () => {
|
|
6775
6775
|
if (p.current && p.current.audioCtx)
|
|
6776
6776
|
try {
|
|
6777
6777
|
(p.current.audioCtx.state === "suspended" || p.current.audioCtx.state === "interrupted") && (await p.current.audioCtx.resume(), console.log("Audio context resumed"));
|
|
6778
6778
|
} catch (L) {
|
|
6779
6779
|
console.warn("Failed to resume audio context:", L);
|
|
6780
6780
|
}
|
|
6781
|
-
}, []), le =
|
|
6782
|
-
if (p.current &&
|
|
6781
|
+
}, []), le = E(async (L, C = {}) => {
|
|
6782
|
+
if (p.current && B)
|
|
6783
6783
|
try {
|
|
6784
|
-
await
|
|
6784
|
+
await _();
|
|
6785
6785
|
const U = {
|
|
6786
|
-
...
|
|
6787
|
-
lipsyncLang:
|
|
6786
|
+
...C,
|
|
6787
|
+
lipsyncLang: C.lipsyncLang || W.lipsyncLang || "en"
|
|
6788
6788
|
};
|
|
6789
|
-
if (
|
|
6790
|
-
const
|
|
6791
|
-
let
|
|
6792
|
-
const
|
|
6793
|
-
|
|
6794
|
-
|
|
6789
|
+
if (C.onSpeechEnd && p.current) {
|
|
6790
|
+
const T = p.current;
|
|
6791
|
+
let G = null, se = 0, ue = !1;
|
|
6792
|
+
const Me = 1200, Ee = 1e4;
|
|
6793
|
+
let be = 0;
|
|
6794
|
+
const Re = setInterval(() => {
|
|
6795
|
+
if (be++, T && T.isSpeaking && (T.audioPlaylist && T.audioPlaylist.length > 0 || T.isAudioPlaying === !0) && (ue = !0, clearInterval(Re), G = setInterval(ve, 50)), be * 50 > Ee)
|
|
6796
|
+
if (clearInterval(Re), T && T.isSpeaking)
|
|
6797
|
+
ue = !0, G = setInterval(ve, 50);
|
|
6798
|
+
else
|
|
6799
|
+
try {
|
|
6800
|
+
C.onSpeechEnd();
|
|
6801
|
+
} catch (Ie) {
|
|
6802
|
+
console.error("Error in onSpeechEnd callback:", Ie);
|
|
6803
|
+
}
|
|
6804
|
+
}, 50), ve = () => {
|
|
6805
|
+
if (se++, se > Me) {
|
|
6806
|
+
G && (clearInterval(G), G = null);
|
|
6795
6807
|
try {
|
|
6796
|
-
|
|
6808
|
+
C.onSpeechEnd();
|
|
6797
6809
|
} catch (ge) {
|
|
6798
6810
|
console.error("Error in onSpeechEnd callback:", ge);
|
|
6799
6811
|
}
|
|
6800
6812
|
return;
|
|
6801
6813
|
}
|
|
6802
|
-
|
|
6814
|
+
if (!ue)
|
|
6815
|
+
return;
|
|
6816
|
+
T && (!T.isSpeaking || T.isSpeaking === !1) && (!T.audioPlaylist || T.audioPlaylist.length === 0) && (!T.isAudioPlaying || T.isAudioPlaying === !1) && (G && (clearInterval(G), G = null), setTimeout(() => {
|
|
6803
6817
|
try {
|
|
6804
|
-
|
|
6818
|
+
C.onSpeechEnd();
|
|
6805
6819
|
} catch (ge) {
|
|
6806
6820
|
console.error("Error in onSpeechEnd callback:", ge);
|
|
6807
6821
|
}
|
|
6808
|
-
},
|
|
6822
|
+
}, 50));
|
|
6809
6823
|
};
|
|
6810
|
-
setTimeout(() => {
|
|
6811
|
-
$ = setInterval(Ce, 50);
|
|
6812
|
-
}, 100);
|
|
6813
6824
|
}
|
|
6814
6825
|
p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(L, U)) : setTimeout(async () => {
|
|
6815
|
-
await
|
|
6826
|
+
await _(), p.current && p.current.lipsync && (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(L, U));
|
|
6816
6827
|
}, 100);
|
|
6817
6828
|
} catch (U) {
|
|
6818
|
-
console.error("Error speaking text:", U),
|
|
6829
|
+
console.error("Error speaking text:", U), O(U.message || "Failed to speak text");
|
|
6819
6830
|
}
|
|
6820
|
-
}, [
|
|
6831
|
+
}, [B, _, W.lipsyncLang]), pe = E(() => {
|
|
6821
6832
|
p.current && (p.current.stopSpeaking(), p.current.setSlowdownRate && p.current.setSlowdownRate(1));
|
|
6822
|
-
}, []),
|
|
6833
|
+
}, []), K = E((L) => {
|
|
6823
6834
|
p.current && p.current.setMood(L);
|
|
6824
|
-
}, []), b =
|
|
6835
|
+
}, []), b = E((L) => {
|
|
6825
6836
|
p.current && p.current.setSlowdownRate && p.current.setSlowdownRate(L);
|
|
6826
|
-
}, []), R =
|
|
6837
|
+
}, []), R = E((L, C = !1) => {
|
|
6827
6838
|
if (p.current && p.current.playAnimation) {
|
|
6828
6839
|
if (x && x[L] && (L = x[L]), p.current.setShowFullAvatar)
|
|
6829
6840
|
try {
|
|
6830
6841
|
p.current.setShowFullAvatar(!0);
|
|
6831
|
-
} catch (
|
|
6832
|
-
console.warn("Error setting full body mode:",
|
|
6842
|
+
} catch (T) {
|
|
6843
|
+
console.warn("Error setting full body mode:", T);
|
|
6833
6844
|
}
|
|
6834
6845
|
if (L.includes("."))
|
|
6835
6846
|
try {
|
|
6836
|
-
p.current.playAnimation(L, null, 10, 0, 0.01,
|
|
6837
|
-
} catch (
|
|
6838
|
-
console.warn(`Failed to play ${L}:`,
|
|
6847
|
+
p.current.playAnimation(L, null, 10, 0, 0.01, C);
|
|
6848
|
+
} catch (T) {
|
|
6849
|
+
console.warn(`Failed to play ${L}:`, T);
|
|
6839
6850
|
try {
|
|
6840
6851
|
p.current.setBodyMovement("idle");
|
|
6841
|
-
} catch (
|
|
6842
|
-
console.warn("Fallback animation also failed:",
|
|
6852
|
+
} catch (G) {
|
|
6853
|
+
console.warn("Fallback animation also failed:", G);
|
|
6843
6854
|
}
|
|
6844
6855
|
}
|
|
6845
6856
|
else {
|
|
6846
|
-
const
|
|
6847
|
-
let
|
|
6848
|
-
for (const
|
|
6857
|
+
const T = [".fbx", ".glb", ".gltf"];
|
|
6858
|
+
let G = !1;
|
|
6859
|
+
for (const se of T)
|
|
6849
6860
|
try {
|
|
6850
|
-
p.current.playAnimation(L +
|
|
6861
|
+
p.current.playAnimation(L + se, null, 10, 0, 0.01, C), G = !0;
|
|
6851
6862
|
break;
|
|
6852
6863
|
} catch {
|
|
6853
6864
|
}
|
|
6854
|
-
if (!
|
|
6865
|
+
if (!G) {
|
|
6855
6866
|
console.warn("Animation not found:", L);
|
|
6856
6867
|
try {
|
|
6857
6868
|
p.current.setBodyMovement("idle");
|
|
6858
|
-
} catch (
|
|
6859
|
-
console.warn("Fallback animation also failed:",
|
|
6869
|
+
} catch (se) {
|
|
6870
|
+
console.warn("Fallback animation also failed:", se);
|
|
6860
6871
|
}
|
|
6861
6872
|
}
|
|
6862
6873
|
}
|
|
6863
6874
|
}
|
|
6864
|
-
}, [x]), w =
|
|
6875
|
+
}, [x]), w = E(() => {
|
|
6865
6876
|
p.current && p.current.onResize && p.current.onResize();
|
|
6866
6877
|
}, []);
|
|
6867
6878
|
return fe(v, () => ({
|
|
6868
6879
|
speakText: le,
|
|
6869
|
-
stopSpeaking:
|
|
6870
|
-
resumeAudioContext:
|
|
6871
|
-
setMood:
|
|
6880
|
+
stopSpeaking: pe,
|
|
6881
|
+
resumeAudioContext: _,
|
|
6882
|
+
setMood: K,
|
|
6872
6883
|
setTimingAdjustment: b,
|
|
6873
6884
|
playAnimation: R,
|
|
6874
|
-
isReady:
|
|
6885
|
+
isReady: B,
|
|
6875
6886
|
talkingHead: p.current,
|
|
6876
6887
|
handleResize: w,
|
|
6877
6888
|
setBodyMovement: (L) => {
|
|
6878
6889
|
if (p.current && p.current.setShowFullAvatar && p.current.setBodyMovement)
|
|
6879
6890
|
try {
|
|
6880
6891
|
p.current.setShowFullAvatar(!0), p.current.setBodyMovement(L);
|
|
6881
|
-
} catch (
|
|
6882
|
-
console.warn("Error setting body movement:",
|
|
6892
|
+
} catch (C) {
|
|
6893
|
+
console.warn("Error setting body movement:", C);
|
|
6883
6894
|
}
|
|
6884
6895
|
},
|
|
6885
6896
|
setMovementIntensity: (L) => p.current?.setMovementIntensity(L),
|
|
@@ -6895,8 +6906,8 @@ const ke = ye(({
|
|
|
6895
6906
|
if (p.current && p.current.setShowFullAvatar && p.current.playReaction)
|
|
6896
6907
|
try {
|
|
6897
6908
|
p.current.setShowFullAvatar(!0), p.current.playReaction(L);
|
|
6898
|
-
} catch (
|
|
6899
|
-
console.warn("Error playing reaction:",
|
|
6909
|
+
} catch (C) {
|
|
6910
|
+
console.warn("Error playing reaction:", C);
|
|
6900
6911
|
}
|
|
6901
6912
|
},
|
|
6902
6913
|
playCelebration: () => {
|
|
@@ -6911,8 +6922,8 @@ const ke = ye(({
|
|
|
6911
6922
|
if (p.current && p.current.setShowFullAvatar)
|
|
6912
6923
|
try {
|
|
6913
6924
|
p.current.setShowFullAvatar(L);
|
|
6914
|
-
} catch (
|
|
6915
|
-
console.warn("Error setting showFullAvatar:",
|
|
6925
|
+
} catch (C) {
|
|
6926
|
+
console.warn("Error setting showFullAvatar:", C);
|
|
6916
6927
|
}
|
|
6917
6928
|
},
|
|
6918
6929
|
lockAvatarPosition: () => {
|
|
@@ -6931,7 +6942,7 @@ const ke = ye(({
|
|
|
6931
6942
|
console.warn("Error unlocking avatar position:", L);
|
|
6932
6943
|
}
|
|
6933
6944
|
}
|
|
6934
|
-
})), /* @__PURE__ */
|
|
6945
|
+
})), /* @__PURE__ */ ze(
|
|
6935
6946
|
"div",
|
|
6936
6947
|
{
|
|
6937
6948
|
className: `talking-head-avatar ${g}`,
|
|
@@ -6942,10 +6953,10 @@ const ke = ye(({
|
|
|
6942
6953
|
...y
|
|
6943
6954
|
},
|
|
6944
6955
|
children: [
|
|
6945
|
-
/* @__PURE__ */
|
|
6956
|
+
/* @__PURE__ */ oe(
|
|
6946
6957
|
"div",
|
|
6947
6958
|
{
|
|
6948
|
-
ref:
|
|
6959
|
+
ref: H,
|
|
6949
6960
|
className: "talking-head-viewer",
|
|
6950
6961
|
style: {
|
|
6951
6962
|
width: "100%",
|
|
@@ -6954,7 +6965,7 @@ const ke = ye(({
|
|
|
6954
6965
|
}
|
|
6955
6966
|
}
|
|
6956
6967
|
),
|
|
6957
|
-
|
|
6968
|
+
F && /* @__PURE__ */ oe("div", { className: "loading-overlay", style: {
|
|
6958
6969
|
position: "absolute",
|
|
6959
6970
|
top: "50%",
|
|
6960
6971
|
left: "50%",
|
|
@@ -6963,7 +6974,7 @@ const ke = ye(({
|
|
|
6963
6974
|
fontSize: "18px",
|
|
6964
6975
|
zIndex: 10
|
|
6965
6976
|
}, children: "Loading avatar..." }),
|
|
6966
|
-
I && /* @__PURE__ */
|
|
6977
|
+
I && /* @__PURE__ */ oe("div", { className: "error-overlay", style: {
|
|
6967
6978
|
position: "absolute",
|
|
6968
6979
|
top: "50%",
|
|
6969
6980
|
left: "50%",
|
|
@@ -6979,9 +6990,9 @@ const ke = ye(({
|
|
|
6979
6990
|
}
|
|
6980
6991
|
);
|
|
6981
6992
|
});
|
|
6982
|
-
|
|
6983
|
-
const
|
|
6984
|
-
text:
|
|
6993
|
+
He.displayName = "TalkingHeadAvatar";
|
|
6994
|
+
const nt = ye(({
|
|
6995
|
+
text: D = "Hello! I'm a talking avatar. How are you today?",
|
|
6985
6996
|
onLoading: t = () => {
|
|
6986
6997
|
},
|
|
6987
6998
|
onError: e = () => {
|
|
@@ -6992,7 +7003,7 @@ const $e = ye(({
|
|
|
6992
7003
|
style: s = {},
|
|
6993
7004
|
avatarConfig: o = {}
|
|
6994
7005
|
}, r) => {
|
|
6995
|
-
const h =
|
|
7006
|
+
const h = Y(null), a = Y(null), [u, l] = re(!0), [c, d] = re(null), [g, y] = re(!1), x = xe(), v = o.ttsService || x.service, H = v === "browser" ? {
|
|
6996
7007
|
endpoint: "",
|
|
6997
7008
|
apiKey: null,
|
|
6998
7009
|
defaultVoice: "Google US English"
|
|
@@ -7008,7 +7019,7 @@ const $e = ye(({
|
|
|
7008
7019
|
body: "F",
|
|
7009
7020
|
avatarMood: "neutral",
|
|
7010
7021
|
ttsLang: v === "browser" ? "en-US" : "en",
|
|
7011
|
-
ttsVoice: o.ttsVoice ||
|
|
7022
|
+
ttsVoice: o.ttsVoice || H.defaultVoice,
|
|
7012
7023
|
lipsyncLang: "en",
|
|
7013
7024
|
// English lip-sync
|
|
7014
7025
|
showFullAvatar: !0,
|
|
@@ -7016,16 +7027,16 @@ const $e = ye(({
|
|
|
7016
7027
|
bodyMovement: "idle",
|
|
7017
7028
|
movementIntensity: 0.5,
|
|
7018
7029
|
...o
|
|
7019
|
-
},
|
|
7020
|
-
ttsEndpoint:
|
|
7021
|
-
ttsApikey:
|
|
7030
|
+
}, F = {
|
|
7031
|
+
ttsEndpoint: H.endpoint,
|
|
7032
|
+
ttsApikey: H.apiKey,
|
|
7022
7033
|
ttsService: v,
|
|
7023
7034
|
lipsyncModules: ["en"],
|
|
7024
7035
|
cameraView: "upper"
|
|
7025
|
-
}, z =
|
|
7036
|
+
}, z = E(async () => {
|
|
7026
7037
|
if (!(!h.current || a.current))
|
|
7027
7038
|
try {
|
|
7028
|
-
if (l(!0), d(null), a.current = new
|
|
7039
|
+
if (l(!0), d(null), a.current = new Ce(h.current, F), await a.current.showAvatar(p, (W) => {
|
|
7029
7040
|
if (W.lengthComputable) {
|
|
7030
7041
|
const V = Math.min(100, Math.round(W.loaded / W.total * 100));
|
|
7031
7042
|
t(V);
|
|
@@ -7033,7 +7044,7 @@ const $e = ye(({
|
|
|
7033
7044
|
}), a.current.morphs && a.current.morphs.length > 0) {
|
|
7034
7045
|
const W = a.current.morphs[0].morphTargetDictionary;
|
|
7035
7046
|
console.log("Available morph targets:", Object.keys(W));
|
|
7036
|
-
const V = Object.keys(W).filter((
|
|
7047
|
+
const V = Object.keys(W).filter((q) => q.startsWith("viseme_"));
|
|
7037
7048
|
console.log("Viseme morph targets found:", V), V.length === 0 && (console.warn("No viseme morph targets found! Lip-sync will not work properly."), console.log("Expected viseme targets: viseme_aa, viseme_E, viseme_I, viseme_O, viseme_U, viseme_PP, viseme_SS, viseme_TH, viseme_DD, viseme_FF, viseme_kk, viseme_nn, viseme_RR, viseme_CH, viseme_sil"));
|
|
7038
7049
|
}
|
|
7039
7050
|
if (await new Promise((W) => {
|
|
@@ -7048,11 +7059,11 @@ const $e = ye(({
|
|
|
7048
7059
|
console.warn("Error setting full body mode on initialization:", W);
|
|
7049
7060
|
}
|
|
7050
7061
|
l(!1), y(!0), i(a.current);
|
|
7051
|
-
const
|
|
7062
|
+
const P = () => {
|
|
7052
7063
|
document.visibilityState === "visible" ? a.current?.start() : a.current?.stop();
|
|
7053
7064
|
};
|
|
7054
|
-
return document.addEventListener("visibilitychange",
|
|
7055
|
-
document.removeEventListener("visibilitychange",
|
|
7065
|
+
return document.addEventListener("visibilitychange", P), () => {
|
|
7066
|
+
document.removeEventListener("visibilitychange", P);
|
|
7056
7067
|
};
|
|
7057
7068
|
} catch (S) {
|
|
7058
7069
|
console.error("Error initializing TalkingHead:", S), d(S.message || "Failed to initialize avatar"), l(!1), e(S);
|
|
@@ -7061,24 +7072,24 @@ const $e = ye(({
|
|
|
7061
7072
|
he(() => (z(), () => {
|
|
7062
7073
|
a.current && (a.current.stop(), a.current.dispose(), a.current = null);
|
|
7063
7074
|
}), [z]);
|
|
7064
|
-
const I =
|
|
7075
|
+
const I = E((S) => {
|
|
7065
7076
|
if (a.current && g)
|
|
7066
7077
|
try {
|
|
7067
7078
|
console.log("Speaking text:", S), console.log("Avatar config:", p), console.log("TalkingHead instance:", a.current), a.current.lipsync && Object.keys(a.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(a.current.lipsync)), a.current.setSlowdownRate && (a.current.setSlowdownRate(1.05), console.log("Applied timing adjustment for better lip-sync")), a.current.speakText(S)) : (console.warn("Lip-sync modules not ready, waiting..."), setTimeout(() => {
|
|
7068
7079
|
a.current && a.current.lipsync ? (console.log("Lip-sync now ready, speaking..."), a.current.setSlowdownRate && (a.current.setSlowdownRate(1.05), console.log("Applied timing adjustment for better lip-sync")), a.current.speakText(S)) : console.error("Lip-sync still not ready after waiting");
|
|
7069
7080
|
}, 500));
|
|
7070
|
-
} catch (
|
|
7071
|
-
console.error("Error speaking text:",
|
|
7081
|
+
} catch (P) {
|
|
7082
|
+
console.error("Error speaking text:", P), d(P.message || "Failed to speak text");
|
|
7072
7083
|
}
|
|
7073
7084
|
else
|
|
7074
7085
|
console.warn("Avatar not ready for speaking. isReady:", g, "talkingHeadRef:", !!a.current);
|
|
7075
|
-
}, [g, p]),
|
|
7086
|
+
}, [g, p]), O = E(() => {
|
|
7076
7087
|
a.current && (a.current.stopSpeaking(), a.current.setSlowdownRate && (a.current.setSlowdownRate(1), console.log("Reset timing to normal")));
|
|
7077
|
-
}, []),
|
|
7088
|
+
}, []), B = E((S) => {
|
|
7078
7089
|
a.current && a.current.setMood(S);
|
|
7079
|
-
}, []),
|
|
7090
|
+
}, []), $ = E((S) => {
|
|
7080
7091
|
a.current && a.current.setSlowdownRate && (a.current.setSlowdownRate(S), console.log("Timing adjustment set to:", S));
|
|
7081
|
-
}, []),
|
|
7092
|
+
}, []), j = E((S, P = !1) => {
|
|
7082
7093
|
if (a.current && a.current.playAnimation) {
|
|
7083
7094
|
if (a.current.setShowFullAvatar)
|
|
7084
7095
|
try {
|
|
@@ -7088,31 +7099,31 @@ const $e = ye(({
|
|
|
7088
7099
|
}
|
|
7089
7100
|
if (S.includes("."))
|
|
7090
7101
|
try {
|
|
7091
|
-
a.current.playAnimation(S, null, 10, 0, 0.01,
|
|
7102
|
+
a.current.playAnimation(S, null, 10, 0, 0.01, P), console.log("Playing animation:", S);
|
|
7092
7103
|
} catch (V) {
|
|
7093
7104
|
console.log(`Failed to play ${S}:`, V);
|
|
7094
7105
|
try {
|
|
7095
7106
|
a.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
|
|
7096
|
-
} catch (
|
|
7097
|
-
console.warn("Fallback animation also failed:",
|
|
7107
|
+
} catch (q) {
|
|
7108
|
+
console.warn("Fallback animation also failed:", q);
|
|
7098
7109
|
}
|
|
7099
7110
|
}
|
|
7100
7111
|
else {
|
|
7101
7112
|
const V = [".fbx", ".glb", ".gltf"];
|
|
7102
|
-
let
|
|
7103
|
-
for (const
|
|
7113
|
+
let q = !1;
|
|
7114
|
+
for (const _ of V)
|
|
7104
7115
|
try {
|
|
7105
|
-
a.current.playAnimation(S +
|
|
7116
|
+
a.current.playAnimation(S + _, null, 10, 0, 0.01, P), console.log("Playing animation:", S + _), q = !0;
|
|
7106
7117
|
break;
|
|
7107
7118
|
} catch {
|
|
7108
|
-
console.log(`Failed to play ${S}${
|
|
7119
|
+
console.log(`Failed to play ${S}${_}, trying next format...`);
|
|
7109
7120
|
}
|
|
7110
|
-
if (!
|
|
7121
|
+
if (!q) {
|
|
7111
7122
|
console.warn("Animation system not available or animation not found:", S);
|
|
7112
7123
|
try {
|
|
7113
7124
|
a.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
|
|
7114
|
-
} catch (
|
|
7115
|
-
console.warn("Fallback animation also failed:",
|
|
7125
|
+
} catch (_) {
|
|
7126
|
+
console.warn("Fallback animation also failed:", _);
|
|
7116
7127
|
}
|
|
7117
7128
|
}
|
|
7118
7129
|
}
|
|
@@ -7121,18 +7132,18 @@ const $e = ye(({
|
|
|
7121
7132
|
}, []);
|
|
7122
7133
|
return fe(r, () => ({
|
|
7123
7134
|
speakText: I,
|
|
7124
|
-
stopSpeaking:
|
|
7125
|
-
setMood:
|
|
7126
|
-
setTimingAdjustment:
|
|
7127
|
-
playAnimation:
|
|
7135
|
+
stopSpeaking: O,
|
|
7136
|
+
setMood: B,
|
|
7137
|
+
setTimingAdjustment: $,
|
|
7138
|
+
playAnimation: j,
|
|
7128
7139
|
isReady: g,
|
|
7129
7140
|
talkingHead: a.current,
|
|
7130
7141
|
setBodyMovement: (S) => {
|
|
7131
7142
|
if (a.current && a.current.setShowFullAvatar && a.current.setBodyMovement)
|
|
7132
7143
|
try {
|
|
7133
7144
|
a.current.setShowFullAvatar(!0), a.current.setBodyMovement(S), console.log("Body movement set with full body mode:", S);
|
|
7134
|
-
} catch (
|
|
7135
|
-
console.warn("Error setting body movement:",
|
|
7145
|
+
} catch (P) {
|
|
7146
|
+
console.warn("Error setting body movement:", P);
|
|
7136
7147
|
}
|
|
7137
7148
|
},
|
|
7138
7149
|
setMovementIntensity: (S) => a.current?.setMovementIntensity(S),
|
|
@@ -7148,8 +7159,8 @@ const $e = ye(({
|
|
|
7148
7159
|
if (a.current && a.current.setShowFullAvatar && a.current.playReaction)
|
|
7149
7160
|
try {
|
|
7150
7161
|
a.current.setShowFullAvatar(!0), a.current.playReaction(S), console.log("Reaction played with full body mode:", S);
|
|
7151
|
-
} catch (
|
|
7152
|
-
console.warn("Error playing reaction:",
|
|
7162
|
+
} catch (P) {
|
|
7163
|
+
console.warn("Error playing reaction:", P);
|
|
7153
7164
|
}
|
|
7154
7165
|
},
|
|
7155
7166
|
playCelebration: () => {
|
|
@@ -7164,8 +7175,8 @@ const $e = ye(({
|
|
|
7164
7175
|
if (a.current && a.current.setShowFullAvatar)
|
|
7165
7176
|
try {
|
|
7166
7177
|
a.current.setShowFullAvatar(S), console.log("Show full avatar set to:", S);
|
|
7167
|
-
} catch (
|
|
7168
|
-
console.warn("Error setting showFullAvatar:",
|
|
7178
|
+
} catch (P) {
|
|
7179
|
+
console.warn("Error setting showFullAvatar:", P);
|
|
7169
7180
|
}
|
|
7170
7181
|
},
|
|
7171
7182
|
lockAvatarPosition: () => {
|
|
@@ -7184,8 +7195,8 @@ const $e = ye(({
|
|
|
7184
7195
|
console.warn("Error unlocking avatar position:", S);
|
|
7185
7196
|
}
|
|
7186
7197
|
}
|
|
7187
|
-
})), /* @__PURE__ */
|
|
7188
|
-
/* @__PURE__ */
|
|
7198
|
+
})), /* @__PURE__ */ ze("div", { className: `talking-head-container ${n}`, style: s, children: [
|
|
7199
|
+
/* @__PURE__ */ oe(
|
|
7189
7200
|
"div",
|
|
7190
7201
|
{
|
|
7191
7202
|
ref: h,
|
|
@@ -7197,7 +7208,7 @@ const $e = ye(({
|
|
|
7197
7208
|
}
|
|
7198
7209
|
}
|
|
7199
7210
|
),
|
|
7200
|
-
u && /* @__PURE__ */
|
|
7211
|
+
u && /* @__PURE__ */ oe("div", { className: "loading-overlay", style: {
|
|
7201
7212
|
position: "absolute",
|
|
7202
7213
|
top: "50%",
|
|
7203
7214
|
left: "50%",
|
|
@@ -7206,7 +7217,7 @@ const $e = ye(({
|
|
|
7206
7217
|
fontSize: "18px",
|
|
7207
7218
|
zIndex: 10
|
|
7208
7219
|
}, children: "Loading avatar..." }),
|
|
7209
|
-
c && /* @__PURE__ */
|
|
7220
|
+
c && /* @__PURE__ */ oe("div", { className: "error-overlay", style: {
|
|
7210
7221
|
position: "absolute",
|
|
7211
7222
|
top: "50%",
|
|
7212
7223
|
left: "50%",
|
|
@@ -7220,9 +7231,9 @@ const $e = ye(({
|
|
|
7220
7231
|
}, children: c })
|
|
7221
7232
|
] });
|
|
7222
7233
|
});
|
|
7223
|
-
|
|
7224
|
-
const
|
|
7225
|
-
curriculumData:
|
|
7234
|
+
nt.displayName = "TalkingHeadComponent";
|
|
7235
|
+
const ot = ye(({
|
|
7236
|
+
curriculumData: D = null,
|
|
7226
7237
|
avatarConfig: t = {},
|
|
7227
7238
|
animations: e = {},
|
|
7228
7239
|
onLessonStart: i = () => {
|
|
@@ -7237,7 +7248,7 @@ const et = ye(({
|
|
|
7237
7248
|
},
|
|
7238
7249
|
autoStart: h = !1
|
|
7239
7250
|
}, a) => {
|
|
7240
|
-
const u =
|
|
7251
|
+
const u = Y(null), l = Y({
|
|
7241
7252
|
currentModuleIndex: 0,
|
|
7242
7253
|
currentLessonIndex: 0,
|
|
7243
7254
|
currentQuestionIndex: 0,
|
|
@@ -7247,18 +7258,18 @@ const et = ye(({
|
|
|
7247
7258
|
curriculumCompleted: !1,
|
|
7248
7259
|
score: 0,
|
|
7249
7260
|
totalQuestions: 0
|
|
7250
|
-
}), c =
|
|
7261
|
+
}), c = Y({
|
|
7251
7262
|
onLessonStart: i,
|
|
7252
7263
|
onLessonComplete: n,
|
|
7253
7264
|
onQuestionAnswer: s,
|
|
7254
7265
|
onCurriculumComplete: o,
|
|
7255
7266
|
onCustomAction: r
|
|
7256
|
-
}), d =
|
|
7267
|
+
}), d = Y(null), g = Y(null), y = Y(null), x = Y(null), v = Y(null), H = Y(null), p = Y(null), F = Y(D?.curriculum || {
|
|
7257
7268
|
title: "Default Curriculum",
|
|
7258
7269
|
description: "No curriculum data provided",
|
|
7259
7270
|
language: "en",
|
|
7260
7271
|
modules: []
|
|
7261
|
-
}), z =
|
|
7272
|
+
}), z = Y({
|
|
7262
7273
|
avatarUrl: t.avatarUrl || "/avatars/brunette.glb",
|
|
7263
7274
|
avatarBody: t.avatarBody || "F",
|
|
7264
7275
|
mood: t.mood || "happy",
|
|
@@ -7281,7 +7292,7 @@ const et = ye(({
|
|
|
7281
7292
|
onCustomAction: r
|
|
7282
7293
|
};
|
|
7283
7294
|
}, [i, n, s, o, r]), he(() => {
|
|
7284
|
-
|
|
7295
|
+
F.current = D?.curriculum || {
|
|
7285
7296
|
title: "Default Curriculum",
|
|
7286
7297
|
description: "No curriculum data provided",
|
|
7287
7298
|
language: "en",
|
|
@@ -7300,8 +7311,8 @@ const et = ye(({
|
|
|
7300
7311
|
animations: e,
|
|
7301
7312
|
lipsyncLang: "en"
|
|
7302
7313
|
};
|
|
7303
|
-
}, [
|
|
7304
|
-
const I =
|
|
7314
|
+
}, [D, t, e]);
|
|
7315
|
+
const I = E(() => (F.current || { modules: [] }).modules[l.current.currentModuleIndex]?.lessons[l.current.currentLessonIndex], []), O = E(() => I()?.questions[l.current.currentQuestionIndex], [I]), B = E((b, R) => R.type === "multiple_choice" || R.type === "true_false" ? b === R.answer : R.type === "code_test" && typeof b == "object" && b !== null ? b.passed === !0 : !1, []), $ = E(() => {
|
|
7305
7316
|
l.current.lessonCompleted = !0, l.current.isQuestionMode = !1;
|
|
7306
7317
|
const b = l.current.totalQuestions > 0 ? Math.round(l.current.score / l.current.totalQuestions * 100) : 100;
|
|
7307
7318
|
let R = "Congratulations! You've completed this lesson";
|
|
@@ -7325,22 +7336,22 @@ const et = ye(({
|
|
|
7325
7336
|
} catch {
|
|
7326
7337
|
u.current.playCelebration();
|
|
7327
7338
|
}
|
|
7328
|
-
const w =
|
|
7329
|
-
|
|
7330
|
-
lipsyncLang:
|
|
7339
|
+
const w = F.current || { modules: [] }, L = w.modules[l.current.currentModuleIndex], C = l.current.currentLessonIndex < (L?.lessons?.length || 0) - 1, U = l.current.currentModuleIndex < (w.modules?.length || 0) - 1, T = C || U, G = z.current || { lipsyncLang: "en" };
|
|
7340
|
+
T ? u.current.speakText(R, {
|
|
7341
|
+
lipsyncLang: G.lipsyncLang,
|
|
7331
7342
|
onSpeechEnd: () => {
|
|
7332
7343
|
g.current && g.current();
|
|
7333
7344
|
}
|
|
7334
7345
|
}) : u.current.speakText(R, {
|
|
7335
|
-
lipsyncLang:
|
|
7346
|
+
lipsyncLang: G.lipsyncLang,
|
|
7336
7347
|
onSpeechEnd: () => {
|
|
7337
7348
|
v.current && v.current();
|
|
7338
7349
|
}
|
|
7339
7350
|
});
|
|
7340
7351
|
}
|
|
7341
|
-
}, [e.lessonComplete]),
|
|
7352
|
+
}, [e.lessonComplete]), j = E(() => {
|
|
7342
7353
|
l.current.curriculumCompleted = !0;
|
|
7343
|
-
const b =
|
|
7354
|
+
const b = F.current || { modules: [] };
|
|
7344
7355
|
if (c.current.onCurriculumComplete({
|
|
7345
7356
|
modules: b.modules.length,
|
|
7346
7357
|
totalLessons: b.modules.reduce((R, w) => R + w.lessons.length, 0)
|
|
@@ -7354,10 +7365,10 @@ const et = ye(({
|
|
|
7354
7365
|
const R = z.current || { lipsyncLang: "en" };
|
|
7355
7366
|
u.current.speakText("Amazing! You've completed the entire curriculum! You're now ready to move on to more advanced topics. Well done!", { lipsyncLang: R.lipsyncLang });
|
|
7356
7367
|
}
|
|
7357
|
-
}, [e.curriculumComplete]), S =
|
|
7368
|
+
}, [e.curriculumComplete]), S = E(() => {
|
|
7358
7369
|
const b = I();
|
|
7359
7370
|
l.current.isQuestionMode = !0, l.current.currentQuestionIndex = 0, l.current.totalQuestions = b?.questions?.length || 0;
|
|
7360
|
-
const R =
|
|
7371
|
+
const R = O();
|
|
7361
7372
|
if (R && c.current.onCustomAction({
|
|
7362
7373
|
type: "questionStart",
|
|
7363
7374
|
moduleIndex: l.current.currentModuleIndex,
|
|
@@ -7379,13 +7390,13 @@ const et = ye(({
|
|
|
7379
7390
|
u.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang: w.lipsyncLang });
|
|
7380
7391
|
} else
|
|
7381
7392
|
setTimeout(() => {
|
|
7382
|
-
|
|
7393
|
+
H.current && H.current();
|
|
7383
7394
|
}, 100);
|
|
7384
|
-
}, [e.questionStart, I,
|
|
7395
|
+
}, [e.questionStart, I, O]), P = E(() => {
|
|
7385
7396
|
const b = I();
|
|
7386
7397
|
if (l.current.currentQuestionIndex < (b?.questions?.length || 0) - 1) {
|
|
7387
7398
|
l.current.currentQuestionIndex += 1;
|
|
7388
|
-
const R =
|
|
7399
|
+
const R = O();
|
|
7389
7400
|
if (R && c.current.onCustomAction({
|
|
7390
7401
|
type: "nextQuestion",
|
|
7391
7402
|
moduleIndex: l.current.currentModuleIndex,
|
|
@@ -7413,8 +7424,8 @@ const et = ye(({
|
|
|
7413
7424
|
}
|
|
7414
7425
|
} else
|
|
7415
7426
|
y.current && y.current();
|
|
7416
|
-
}, [e.nextQuestion, I,
|
|
7417
|
-
const b =
|
|
7427
|
+
}, [e.nextQuestion, I, O]), W = E(() => {
|
|
7428
|
+
const b = F.current || { modules: [] }, R = b.modules[l.current.currentModuleIndex];
|
|
7418
7429
|
l.current.currentLessonIndex < (R?.lessons?.length || 0) - 1 ? (l.current.currentLessonIndex += 1, l.current.currentQuestionIndex = 0, l.current.lessonCompleted = !1, l.current.isQuestionMode = !1, l.current.isTeaching = !1, l.current.score = 0, l.current.totalQuestions = 0, c.current.onCustomAction({
|
|
7419
7430
|
type: "lessonStart",
|
|
7420
7431
|
moduleIndex: l.current.currentModuleIndex,
|
|
@@ -7424,12 +7435,12 @@ const et = ye(({
|
|
|
7424
7435
|
moduleIndex: l.current.currentModuleIndex,
|
|
7425
7436
|
lessonIndex: l.current.currentLessonIndex
|
|
7426
7437
|
}), u.current && (u.current.setMood("happy"), u.current.setBodyMovement("idle"), d.current && d.current())) : v.current && v.current();
|
|
7427
|
-
}, []), V =
|
|
7438
|
+
}, []), V = E(() => {
|
|
7428
7439
|
const b = I();
|
|
7429
7440
|
let R = null;
|
|
7430
7441
|
if (b?.avatar_script && b?.body) {
|
|
7431
|
-
const w = b.avatar_script.trim(), L = b.body.trim(),
|
|
7432
|
-
R = `${w}${
|
|
7442
|
+
const w = b.avatar_script.trim(), L = b.body.trim(), C = w.match(/[.!?]$/) ? " " : ". ";
|
|
7443
|
+
R = `${w}${C}${L}`;
|
|
7433
7444
|
} else
|
|
7434
7445
|
R = b?.avatar_script || b?.body || null;
|
|
7435
7446
|
if (u.current && u.current.isReady && R) {
|
|
@@ -7438,8 +7449,8 @@ const et = ye(({
|
|
|
7438
7449
|
if (e.teaching)
|
|
7439
7450
|
try {
|
|
7440
7451
|
u.current.playAnimation(e.teaching, !0), w = !0;
|
|
7441
|
-
} catch (
|
|
7442
|
-
console.warn("Failed to play teaching animation:",
|
|
7452
|
+
} catch (C) {
|
|
7453
|
+
console.warn("Failed to play teaching animation:", C);
|
|
7443
7454
|
}
|
|
7444
7455
|
w || u.current.setBodyMovement("gesturing");
|
|
7445
7456
|
const L = z.current || { lipsyncLang: "en" };
|
|
@@ -7455,12 +7466,12 @@ const et = ye(({
|
|
|
7455
7466
|
}), u.current.speakText(R, {
|
|
7456
7467
|
lipsyncLang: L.lipsyncLang,
|
|
7457
7468
|
onSpeechEnd: () => {
|
|
7458
|
-
l.current.isTeaching = !1, b.questions && b.questions.length > 0 ?
|
|
7469
|
+
l.current.isTeaching = !1, b.questions && b.questions.length > 0 ? H.current && H.current() : y.current && y.current();
|
|
7459
7470
|
}
|
|
7460
7471
|
});
|
|
7461
7472
|
}
|
|
7462
|
-
}, [e.teaching, I]),
|
|
7463
|
-
const R =
|
|
7473
|
+
}, [e.teaching, I]), q = E((b) => {
|
|
7474
|
+
const R = O(), w = B(b, R);
|
|
7464
7475
|
if (w && (l.current.score += 1), c.current.onQuestionAnswer({
|
|
7465
7476
|
moduleIndex: l.current.currentModuleIndex,
|
|
7466
7477
|
lessonIndex: l.current.currentLessonIndex,
|
|
@@ -7477,9 +7488,9 @@ const et = ye(({
|
|
|
7477
7488
|
u.current.setBodyMovement("happy");
|
|
7478
7489
|
}
|
|
7479
7490
|
u.current.setBodyMovement("gesturing");
|
|
7480
|
-
const L = R.type === "code_test" ? `Great job! Your code passed all the tests! ${R.explanation || ""}` : `Excellent! That's correct! ${R.explanation || ""}`,
|
|
7491
|
+
const L = R.type === "code_test" ? `Great job! Your code passed all the tests! ${R.explanation || ""}` : `Excellent! That's correct! ${R.explanation || ""}`, C = z.current || { lipsyncLang: "en" };
|
|
7481
7492
|
u.current.speakText(L, {
|
|
7482
|
-
lipsyncLang:
|
|
7493
|
+
lipsyncLang: C.lipsyncLang,
|
|
7483
7494
|
onSpeechEnd: () => {
|
|
7484
7495
|
x.current && x.current();
|
|
7485
7496
|
}
|
|
@@ -7492,9 +7503,9 @@ const et = ye(({
|
|
|
7492
7503
|
u.current.setBodyMovement("idle");
|
|
7493
7504
|
}
|
|
7494
7505
|
u.current.setBodyMovement("gesturing");
|
|
7495
|
-
const L = R.type === "code_test" ? `Your code didn't pass all the tests. ${R.explanation || "Try again!"}` : `Not quite right, but don't worry! ${R.explanation || ""} Let's move on to the next question.`,
|
|
7506
|
+
const L = R.type === "code_test" ? `Your code didn't pass all the tests. ${R.explanation || "Try again!"}` : `Not quite right, but don't worry! ${R.explanation || ""} Let's move on to the next question.`, C = z.current || { lipsyncLang: "en" };
|
|
7496
7507
|
u.current.speakText(L, {
|
|
7497
|
-
lipsyncLang:
|
|
7508
|
+
lipsyncLang: C.lipsyncLang,
|
|
7498
7509
|
onSpeechEnd: () => {
|
|
7499
7510
|
x.current && x.current();
|
|
7500
7511
|
}
|
|
@@ -7502,8 +7513,8 @@ const et = ye(({
|
|
|
7502
7513
|
}
|
|
7503
7514
|
else
|
|
7504
7515
|
x.current && x.current();
|
|
7505
|
-
}, [e.correct, e.incorrect,
|
|
7506
|
-
const R =
|
|
7516
|
+
}, [e.correct, e.incorrect, O, B]), _ = E((b) => {
|
|
7517
|
+
const R = O();
|
|
7507
7518
|
if (!b || typeof b != "object") {
|
|
7508
7519
|
console.error("Invalid code test result format. Expected object with {passed: boolean, ...}");
|
|
7509
7520
|
return;
|
|
@@ -7530,30 +7541,30 @@ const et = ye(({
|
|
|
7530
7541
|
testResult: w,
|
|
7531
7542
|
question: R
|
|
7532
7543
|
}), p.current && p.current(w);
|
|
7533
|
-
}, [
|
|
7544
|
+
}, [O, B]), le = E(() => {
|
|
7534
7545
|
l.current.currentModuleIndex = 0, l.current.currentLessonIndex = 0, l.current.currentQuestionIndex = 0, l.current.isTeaching = !1, l.current.isQuestionMode = !1, l.current.lessonCompleted = !1, l.current.curriculumCompleted = !1, l.current.score = 0, l.current.totalQuestions = 0;
|
|
7535
|
-
}, []),
|
|
7546
|
+
}, []), pe = E((b) => {
|
|
7536
7547
|
console.log("Avatar is ready!", b);
|
|
7537
7548
|
const R = I(), w = R?.avatar_script || R?.body;
|
|
7538
7549
|
h && w && setTimeout(() => {
|
|
7539
7550
|
d.current && d.current();
|
|
7540
7551
|
}, 10);
|
|
7541
7552
|
}, [h, I]);
|
|
7542
|
-
|
|
7543
|
-
d.current = V, g.current = W, y.current =
|
|
7553
|
+
Fe(() => {
|
|
7554
|
+
d.current = V, g.current = W, y.current = $, x.current = P, v.current = j, H.current = S, p.current = q;
|
|
7544
7555
|
}), fe(a, () => ({
|
|
7545
7556
|
// Curriculum control methods
|
|
7546
7557
|
startTeaching: V,
|
|
7547
7558
|
startQuestions: S,
|
|
7548
|
-
handleAnswerSelect:
|
|
7549
|
-
handleCodeTestResult:
|
|
7550
|
-
nextQuestion:
|
|
7559
|
+
handleAnswerSelect: q,
|
|
7560
|
+
handleCodeTestResult: _,
|
|
7561
|
+
nextQuestion: P,
|
|
7551
7562
|
nextLesson: W,
|
|
7552
|
-
completeLesson:
|
|
7553
|
-
completeCurriculum:
|
|
7563
|
+
completeLesson: $,
|
|
7564
|
+
completeCurriculum: j,
|
|
7554
7565
|
resetCurriculum: le,
|
|
7555
7566
|
getState: () => ({ ...l.current }),
|
|
7556
|
-
getCurrentQuestion: () =>
|
|
7567
|
+
getCurrentQuestion: () => O(),
|
|
7557
7568
|
getCurrentLesson: () => I(),
|
|
7558
7569
|
// Direct access to avatar ref (always returns current value)
|
|
7559
7570
|
getAvatarRef: () => u.current,
|
|
@@ -7602,8 +7613,8 @@ const et = ye(({
|
|
|
7602
7613
|
handleResize: () => u.current?.handleResize(),
|
|
7603
7614
|
// Avatar readiness check (always returns current value)
|
|
7604
7615
|
isAvatarReady: () => u.current?.isReady || !1
|
|
7605
|
-
}), [V, S,
|
|
7606
|
-
const
|
|
7616
|
+
}), [V, S, q, _, P, W, $, j, le, O, I]);
|
|
7617
|
+
const K = z.current || {
|
|
7607
7618
|
avatarUrl: "/avatars/brunette.glb",
|
|
7608
7619
|
avatarBody: "F",
|
|
7609
7620
|
mood: "happy",
|
|
@@ -7616,23 +7627,23 @@ const et = ye(({
|
|
|
7616
7627
|
showFullAvatar: !0,
|
|
7617
7628
|
animations: e
|
|
7618
7629
|
};
|
|
7619
|
-
return /* @__PURE__ */
|
|
7620
|
-
|
|
7630
|
+
return /* @__PURE__ */ oe("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ oe(
|
|
7631
|
+
He,
|
|
7621
7632
|
{
|
|
7622
7633
|
ref: u,
|
|
7623
|
-
avatarUrl:
|
|
7624
|
-
avatarBody:
|
|
7625
|
-
mood:
|
|
7626
|
-
ttsLang:
|
|
7627
|
-
ttsService:
|
|
7628
|
-
ttsVoice:
|
|
7629
|
-
ttsApiKey:
|
|
7630
|
-
bodyMovement:
|
|
7631
|
-
movementIntensity:
|
|
7632
|
-
showFullAvatar:
|
|
7634
|
+
avatarUrl: K.avatarUrl,
|
|
7635
|
+
avatarBody: K.avatarBody,
|
|
7636
|
+
mood: K.mood,
|
|
7637
|
+
ttsLang: K.ttsLang,
|
|
7638
|
+
ttsService: K.ttsService,
|
|
7639
|
+
ttsVoice: K.ttsVoice,
|
|
7640
|
+
ttsApiKey: K.ttsApiKey,
|
|
7641
|
+
bodyMovement: K.bodyMovement,
|
|
7642
|
+
movementIntensity: K.movementIntensity,
|
|
7643
|
+
showFullAvatar: K.showFullAvatar,
|
|
7633
7644
|
cameraView: "upper",
|
|
7634
|
-
animations:
|
|
7635
|
-
onReady:
|
|
7645
|
+
animations: K.animations,
|
|
7646
|
+
onReady: pe,
|
|
7636
7647
|
onLoading: () => {
|
|
7637
7648
|
},
|
|
7638
7649
|
onError: (b) => {
|
|
@@ -7641,8 +7652,8 @@ const et = ye(({
|
|
|
7641
7652
|
}
|
|
7642
7653
|
) });
|
|
7643
7654
|
});
|
|
7644
|
-
|
|
7645
|
-
const
|
|
7655
|
+
ot.displayName = "CurriculumLearning";
|
|
7656
|
+
const Te = {
|
|
7646
7657
|
// Code-based dance animations (no FBX required)
|
|
7647
7658
|
dance: {
|
|
7648
7659
|
name: "dance",
|
|
@@ -7745,14 +7756,14 @@ const we = {
|
|
|
7745
7756
|
duration: 5e3,
|
|
7746
7757
|
description: "Excited, energetic movement"
|
|
7747
7758
|
}
|
|
7748
|
-
},
|
|
7759
|
+
}, pt = (D) => Te[D] || null, gt = (D) => Te.hasOwnProperty(D);
|
|
7749
7760
|
export {
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7761
|
+
ot as CurriculumLearning,
|
|
7762
|
+
He as TalkingHeadAvatar,
|
|
7763
|
+
nt as TalkingHeadComponent,
|
|
7764
|
+
Te as animations,
|
|
7754
7765
|
xe as getActiveTTSConfig,
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7766
|
+
pt as getAnimation,
|
|
7767
|
+
mt as getVoiceOptions,
|
|
7768
|
+
gt as hasAnimation
|
|
7758
7769
|
};
|