@sage-rsc/talking-head-react 1.0.45 → 1.0.46
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 +232 -219
- package/package.json +1 -1
- package/src/components/TalkingHeadAvatar.jsx +25 -2
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsxs as Ce, jsx as oe } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as be, useRef as Y, useState as re, useCallback as E, useEffect as he, useImperativeHandle as Re, useLayoutEffect as Pe } 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
|
|
4
|
+
import { OrbitControls as Be } from "three/addons/controls/OrbitControls.js";
|
|
5
|
+
import { GLTFLoader as De } from "three/addons/loaders/GLTFLoader.js";
|
|
6
|
+
import { DRACOLoader as Oe } from "three/addons/loaders/DRACOLoader.js";
|
|
7
|
+
import { FBXLoader as Le } from "three/addons/loaders/FBXLoader.js";
|
|
8
|
+
import { RoomEnvironment as Ne } from "three/addons/environments/RoomEnvironment.js";
|
|
9
|
+
import Ue from "three/addons/libs/stats.module.js";
|
|
10
10
|
let m, Q, J;
|
|
11
|
-
const A = [0, 0, 0, 0], k = new f.Vector3(),
|
|
11
|
+
const A = [0, 0, 0, 0], k = new f.Vector3(), me = new f.Vector3(), Z = new f.Vector3(), pe = new f.Vector3();
|
|
12
12
|
new f.Plane();
|
|
13
13
|
new f.Ray();
|
|
14
14
|
new f.Euler();
|
|
15
|
-
const X = new f.Quaternion(),
|
|
15
|
+
const X = new f.Quaternion(), Se = new f.Quaternion(), ee = new f.Matrix4(), te = new f.Matrix4();
|
|
16
16
|
new f.Vector3();
|
|
17
|
-
const
|
|
18
|
-
class
|
|
17
|
+
const ge = new f.Vector3(0, 0, 1), We = new f.Vector3(1, 0, 0), Ve = new f.Vector3(0, 1, 0), Ge = new f.Vector3(0, 0, 1);
|
|
18
|
+
class Ze {
|
|
19
19
|
constructor(t = null) {
|
|
20
20
|
this.opt = Object.assign({
|
|
21
21
|
warmupMs: 2e3,
|
|
@@ -338,7 +338,7 @@ class Ge {
|
|
|
338
338
|
ea: [0, 0, 0, 0]
|
|
339
339
|
// External acceleration [m/s^2]
|
|
340
340
|
};
|
|
341
|
-
u.boneParent.matrixWorld.decompose(k, X, Z), k.copy(
|
|
341
|
+
u.boneParent.matrixWorld.decompose(k, X, Z), k.copy(ge).applyQuaternion(X).setY(0).normalize(), X.premultiply(Se.setFromUnitVectors(ge, 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 Ge {
|
|
|
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, X, Z), k.copy(
|
|
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(ge).applyQuaternion(X).setY(0).normalize(), X.premultiply(Se.setFromUnitVectors(ge, 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(Ge, -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(We, -m), o.boneParent.quaternion.multiply(X)), o.isT && (m = 1.5 * Math.tanh(A[3] * 1.5), X.setFromAxisAngle(Ve, -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], 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(),
|
|
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(), pe.copy(Z).multiplyScalar(Q), Q = Math.sqrt(J * J - Q * Q), k.subVectors(k, pe).projectOnPlane(Z).normalize().multiplyScalar(Q), me.subVectors(o.vBasis, pe).projectOnPlane(Z).normalize(), J = me.dot(k), J < 0 && (J = Math.sqrt(Q * Q - J * J), me.multiplyScalar(J), k.add(me)), k.add(pe).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 Ge {
|
|
|
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 Xe {
|
|
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 Ze {
|
|
|
814
814
|
return n * s;
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
|
-
class
|
|
817
|
+
class Ye {
|
|
818
818
|
/**
|
|
819
819
|
* @constructor
|
|
820
820
|
*/
|
|
@@ -1396,11 +1396,11 @@ class Xe {
|
|
|
1396
1396
|
return e;
|
|
1397
1397
|
}
|
|
1398
1398
|
}
|
|
1399
|
-
const
|
|
1399
|
+
const je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1400
1400
|
__proto__: null,
|
|
1401
|
-
LipsyncEn:
|
|
1401
|
+
LipsyncEn: Ye
|
|
1402
1402
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1403
|
-
class
|
|
1403
|
+
class Qe {
|
|
1404
1404
|
/**
|
|
1405
1405
|
* @constructor
|
|
1406
1406
|
*/
|
|
@@ -1754,11 +1754,11 @@ class je {
|
|
|
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: Qe
|
|
1760
1760
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1761
|
-
class
|
|
1761
|
+
class _e {
|
|
1762
1762
|
/**
|
|
1763
1763
|
* @constructor
|
|
1764
1764
|
*/
|
|
@@ -2289,11 +2289,11 @@ class qe {
|
|
|
2289
2289
|
return e;
|
|
2290
2290
|
}
|
|
2291
2291
|
}
|
|
2292
|
-
const
|
|
2292
|
+
const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2293
2293
|
__proto__: null,
|
|
2294
|
-
LipsyncFr:
|
|
2294
|
+
LipsyncFr: _e
|
|
2295
2295
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2296
|
-
class
|
|
2296
|
+
class Je {
|
|
2297
2297
|
/**
|
|
2298
2298
|
* @constructor
|
|
2299
2299
|
*/
|
|
@@ -2436,11 +2436,11 @@ class Ke {
|
|
|
2436
2436
|
return e;
|
|
2437
2437
|
}
|
|
2438
2438
|
}
|
|
2439
|
-
const
|
|
2439
|
+
const $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2440
2440
|
__proto__: null,
|
|
2441
|
-
LipsyncFi:
|
|
2441
|
+
LipsyncFi: Je
|
|
2442
2442
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2443
|
-
class
|
|
2443
|
+
class et {
|
|
2444
2444
|
/**
|
|
2445
2445
|
* @constructor
|
|
2446
2446
|
*/
|
|
@@ -2620,24 +2620,24 @@ class $e {
|
|
|
2620
2620
|
return e;
|
|
2621
2621
|
}
|
|
2622
2622
|
}
|
|
2623
|
-
const
|
|
2623
|
+
const tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2624
2624
|
__proto__: null,
|
|
2625
|
-
Lip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bGVkIG9yIHRpbWVkIG91dC4KICAgICAgICAgICAgaWYgKCF0aGlzLl9oYXNTZW50RW5kZWQpIHsKICAgICAgICAgICAgICB0aGlzLnBvcnQucG9zdE1lc3NhZ2UoeyB0eXBlOiAicGxheWJhY2stZW5kZWQiIH0pOwogICAgICAgICAgICAgIHRoaXMuX2hhc1NlbnRFbmRlZCA9IHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgLy8gU2VuZCBmaW5hbCBtZXRyaWNzIHNob3dpbmcgY2xlYXJlZCBzdGF0ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9IGNhdGNoIChfKSB7IH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnJlc2V0KCk7IC8vIFJlc2V0IHRvIElETEUgc3RhdGUgZm9y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dG8ga2VlcCB0aGUgcHJvY2Vzc29yIGFsaXZlIGZvciByZXVzZS4KICAgIHJldHVybiB0cnVlOwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoInBsYXliYWNrLXdvcmtsZXQiLCBQbGF5YmFja1dvcmtsZXQpOwo=", import.meta.url), Se = {
|
|
2627
|
-
en:
|
|
2628
|
-
de:
|
|
2629
|
-
fr:
|
|
2630
|
-
fi:
|
|
2631
|
-
lt:
|
|
2632
|
-
}, N = new f.Quaternion(), M = new f.Euler(), ie = new f.Vector3(), ne = new f.Vector3(),
|
|
2625
|
+
LipsyncLt: et
|
|
2626
|
+
}, Symbol.toStringTag, { value: "Module" })), it = new URL("data:text/javascript;base64,Y2xhc3MgUGxheWJhY2tXb3JrbGV0IGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgRlNNID0gewogICAgSURMRTogMCwKICAgIFBMQVlJTkc6IDEsCiAgfTsKCiAgY29uc3RydWN0b3Iob3B0aW9ucykgewogICAgc3VwZXIoKTsKICAgIHRoaXMucG9ydC5vbm1lc3NhZ2UgPSB0aGlzLmhhbmRsZU1lc3NhZ2UuYmluZCh0aGlzKTsKCiAgICB0aGlzLl9zYW1wbGVSYXRlID0gb3B0aW9ucz8ucHJvY2Vzc29yT3B0aW9ucz8uc2FtcGxlUmF0ZSB8fCBzYW1wbGVSYXRlOwogICAgdGhpcy5fc2NhbGUgPSAxIC8gMzI3Njg7IC8vIFBDTTE2IC0+IGZsb2F0CgogICAgLy8gU2lsZW5jZSBkZXRlY3Rpb24gdGhyZXNob2xkICgxIHNlY29uZCkgYXMgYSBmYWxsYmFjayBzYWZldHkgbmV0CiAgICBjb25zdCBzaWxlbmNlRHVyYXRpb25TZWNvbmRzID0gMS4wOwogICAgdGhpcy5fc2lsZW5jZVRocmVzaG9sZEJsb2NrcyA9IE1hdGguY2VpbCgodGhpcy5fc2FtcGxlUmF0ZSAqIHNpbGVuY2VEdXJhdGl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ICAgICAgICAvLyBCdWZmZXIgaXMgZW1wdHkuIENoZWNrIGZvciBlbmQgY29uZGl0aW9ucy4KICAgICAgICAgIGNvbnN0IGlzVGltZWRPdXQgPSB0aGlzLl9zaWxlbmNlRnJhbWVzQ291bnQgPiB0aGlzLl9zaWxlbmNlVGhyZXNob2xkQmxvY2tzOwoKICAgICAgICAgIGlmICh0aGlzLl9ub01vcmVEYXRhUmVjZWl2ZWQgfHwgaXNUaW1lZE91dCkgewogICAgICAgICAgICAvLyBFTkQgT0YgUExBWUJBQ0s6IEVpdGhlciBleHBsaWNpdGx5IHNpZ25hbGVkIG9yIHRpbWVkIG91dC4KICAgICAgICAgICAgaWYgKCF0aGlzLl9oYXNTZW50RW5kZWQpIHsKICAgICAgICAgICAgICB0aGlzLnBvcnQucG9zdE1lc3NhZ2UoeyB0eXBlOiAicGxheWJhY2stZW5kZWQiIH0pOwogICAgICAgICAgICAgIHRoaXMuX2hhc1NlbnRFbmRlZCA9IHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgLy8gU2VuZCBmaW5hbCBtZXRyaWNzIHNob3dpbmcgY2xlYXJlZCBzdGF0ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9IGNhdGNoIChfKSB7IH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnJlc2V0KCk7IC8vIFJlc2V0IHRvIElETEUgc3RhdGUgZm9yIHJldXNlCiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlIGxvb3AKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIC8vIEJVRkZFUiBVTkRFUlJVTiAoTEFHKTogUGxheSBzaWxlbmNlIGFuZCB3YWl0IGZvciBtb3JlIGRhdGEuCiAgICAgICAgICAgIHRoaXMuX3NpbGVuY2VGcmFtZXNDb3VudCsrOwogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHRoaXMuX3VuZGVycnVuQmxvY2tzKys7CiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlIGxvb3AKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KCiAgICAgIC8vIElmIHdlIGhhdmUgYSBjaHVuayAoY291bGQgYmUgYSBuZXcgb25lIGZyb20gdGhlIGxvZ2ljIGFib3ZlKSwgcHJvY2VzcyBpdC4KICAgICAgaWYgKHRoaXMuX2N1cnJlbnRDaHVuaykgewogICAgICAgIGNvbnN0IHNhbXBsZXNUb0NvcHkgPSBNYXRoLm1pbigKICAgICAgICAgIGJsb2NrU2l6ZSAtIHNhbXBsZXNDb3BpZWQsCiAgICAgICAgICB0aGlzLl9jdXJyZW50Q2h1bmsubGVuZ3RoIC0gdGhpcy5fY3VycmVudENodW5rT2Zmc2V0CiAgICAgICAgKTsKICAgICA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B1bmRlcnJ1bkJsb2NrczogdGhpcy5fdW5kZXJydW5CbG9ja3MsCiAgICAgICAgICAgICAgZnJhbWVzUHJvY2Vzc2VkOiB0aGlzLl9mcmFtZXNQcm9jZXNzZWQKICAgICAgICAgICAgfQogICAgICAgICAgfSk7CiAgICAgICAgfSBjYXRjaCAoXykgeyB9CiAgICAgICAgLy8gRG9uJ3QgcmVzZXQgbWF4IHRyYWNrZXIgLSBrZWVwIHNlc3Npb24gcGVhayB1bnRpbCBpZGxlCiAgICAgIH0KICAgIH0KCiAgICAvLyBBTFdBWVMgcmV0dXJuIHRydWUgdG8ga2VlcCB0aGUgcHJvY2Vzc29yIGFsaXZlIGZvciByZXVzZS4KICAgIHJldHVybiB0cnVlOwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoInBsYXliYWNrLXdvcmtsZXQiLCBQbGF5YmFja1dvcmtsZXQpOwo=", import.meta.url), ke = {
|
|
2627
|
+
en: je,
|
|
2628
|
+
de: qe,
|
|
2629
|
+
fr: Ke,
|
|
2630
|
+
fi: $e,
|
|
2631
|
+
lt: tt
|
|
2632
|
+
}, N = new f.Quaternion(), M = new f.Euler(), ie = new f.Vector3(), ne = new f.Vector3(), we = 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 nt = 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 He {
|
|
2641
2641
|
/**
|
|
2642
2642
|
* Avatar.
|
|
2643
2643
|
* @typedef {Object} Avatar
|
|
@@ -2763,7 +2763,7 @@ class Ce {
|
|
|
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 Ue(), 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 Ce {
|
|
|
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 Ne()).texture, this.resizeobserver = new ResizeObserver(this.onResize.bind(this)), this.resizeobserver.observe(this.nodeAvatar), this.controls = new Be(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 Ce {
|
|
|
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 Ze(), 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 Xe(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 Ce {
|
|
|
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 De();
|
|
4232
4232
|
if (this.dracoEnabled) {
|
|
4233
|
-
const a = new
|
|
4233
|
+
const a = new Oe();
|
|
4234
4234
|
a.setDecoderPath(this.dracoDecoderPath), i.setDRACOLoader(a);
|
|
4235
4235
|
}
|
|
4236
4236
|
let n = await i.loadAsync(t.url, e);
|
|
@@ -5180,7 +5180,7 @@ class Ce {
|
|
|
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(nt, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(N)), we.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 -= we.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 Ce {
|
|
|
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 = ke[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(ke));
|
|
5216
5216
|
} catch (s) {
|
|
5217
5217
|
console.warn(`Failed to load lip-sync module for ${t}:`, s);
|
|
5218
5218
|
}
|
|
@@ -5251,10 +5251,10 @@ class Ce {
|
|
|
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, T = y[x].match(r);
|
|
5255
5255
|
let p = y[x].match(s);
|
|
5256
|
-
const F = y[x].match(h),
|
|
5257
|
-
if (p && !v && !F && y[x + 1].match(s) && (p = !1), i && (u += y[x]),
|
|
5256
|
+
const F = y[x].match(h), C = y[x].match(o);
|
|
5257
|
+
if (p && !v && !F && y[x + 1].match(s) && (p = !1), i && (u += y[x]), T && (!n || n.every((I) => x < I[0] || x > I[1])) && (l += y[x]), (C || 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({
|
|
@@ -5385,10 +5385,10 @@ class Ce {
|
|
|
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, T = 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 * T / 3), v + Math.min(25, T / 2), v + T + Math.min(60, T / 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
|
}
|
|
@@ -5486,18 +5486,18 @@ class Ce {
|
|
|
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
5488
|
for (let F = 0; F < x.visemes.length; F++) {
|
|
5489
|
-
const
|
|
5489
|
+
const C = 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
5492
|
ts: [B - Math.min(60, 2 * $ / 3), B + Math.min(25, $ / 2), B + $ + Math.min(60, $ / 2)],
|
|
5493
5493
|
vs: {
|
|
5494
|
-
["viseme_" +
|
|
5494
|
+
["viseme_" + C]: [null, C === "PP" || C === "FF" ? 0.9 : 0.6, 0]
|
|
5495
5495
|
}
|
|
5496
5496
|
});
|
|
5497
5497
|
}
|
|
5498
5498
|
}
|
|
5499
|
-
const
|
|
5500
|
-
this.audioPlaylist.push({ anim:
|
|
5499
|
+
const T = [...t.anim, ...v];
|
|
5500
|
+
this.audioPlaylist.push({ anim: T, 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 Ce {
|
|
|
5895
5895
|
}
|
|
5896
5896
|
if (!this.workletLoaded)
|
|
5897
5897
|
try {
|
|
5898
|
-
const r = this.audioCtx.audioWorklet.addModule(
|
|
5898
|
+
const r = this.audioCtx.audioWorklet.addModule(it.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;
|
|
@@ -6189,17 +6189,17 @@ class Ce {
|
|
|
6189
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
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 T = (Math.random() - 0.5) / 4, p = (Math.random() - 0.5) / 4;
|
|
6193
6193
|
if (i) {
|
|
6194
6194
|
let F = this.animQueue.findIndex((I) => I.template.name === "lookat");
|
|
6195
6195
|
F !== -1 && this.animQueue.splice(F, 1);
|
|
6196
|
-
const
|
|
6196
|
+
const C = {
|
|
6197
6197
|
name: "lookat",
|
|
6198
6198
|
dt: [750, i],
|
|
6199
6199
|
vs: {
|
|
6200
|
-
bodyRotateX: [x +
|
|
6200
|
+
bodyRotateX: [x + T],
|
|
6201
6201
|
bodyRotateY: [v + p],
|
|
6202
|
-
eyesRotateX: [-3 *
|
|
6202
|
+
eyesRotateX: [-3 * T + 0.1],
|
|
6203
6203
|
eyesRotateY: [-5 * p],
|
|
6204
6204
|
browInnerUp: [[0, 0.7]],
|
|
6205
6205
|
mouthLeft: [[0, 0.7]],
|
|
@@ -6208,7 +6208,7 @@ class Ce {
|
|
|
6208
6208
|
headMove: [0]
|
|
6209
6209
|
}
|
|
6210
6210
|
};
|
|
6211
|
-
this.animQueue.push(this.animFactory(
|
|
6211
|
+
this.animQueue.push(this.animFactory(C));
|
|
6212
6212
|
}
|
|
6213
6213
|
}
|
|
6214
6214
|
/**
|
|
@@ -6403,7 +6403,7 @@ class Ce {
|
|
|
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 Le();
|
|
6407
6407
|
let l;
|
|
6408
6408
|
try {
|
|
6409
6409
|
l = await u.loadAsync(t, e);
|
|
@@ -6480,7 +6480,7 @@ class Ce {
|
|
|
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 Le().loadAsync(t, e);
|
|
6484
6484
|
if (h && h.animations && h.animations[n]) {
|
|
6485
6485
|
let a = h.animations[n];
|
|
6486
6486
|
const u = {};
|
|
@@ -6577,12 +6577,12 @@ class Ce {
|
|
|
6577
6577
|
const x = t.iterations || 10;
|
|
6578
6578
|
if (e)
|
|
6579
6579
|
for (let v = 0; v < x; v++) {
|
|
6580
|
-
let
|
|
6580
|
+
let T = !1;
|
|
6581
6581
|
for (let p = 0, F = y.length; p < F; p++) {
|
|
6582
|
-
const
|
|
6583
|
-
|
|
6582
|
+
const C = y[p].bone;
|
|
6583
|
+
C.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);
|
|
6585
|
-
I > 1 ? I = 1 : I < -1 && (I = -1), I = Math.acos(I), !(I < 1e-5) && (y[p].minAngle !== void 0 && I < y[p].minAngle && (I = y[p].minAngle), y[p].maxAngle !== void 0 && I > y[p].maxAngle && (I = y[p].maxAngle), l.crossVectors(r, s), l.normalize(), N.setFromAxisAngle(l, I),
|
|
6585
|
+
I > 1 ? I = 1 : I < -1 && (I = -1), I = Math.acos(I), !(I < 1e-5) && (y[p].minAngle !== void 0 && I < y[p].minAngle && (I = y[p].minAngle), y[p].maxAngle !== void 0 && I > y[p].maxAngle && (I = y[p].maxAngle), l.crossVectors(r, s), l.normalize(), N.setFromAxisAngle(l, I), C.quaternion.multiply(N), C.rotation.setFromVector3(c.setFromEuler(C.rotation).clamp(new f.Vector3(
|
|
6586
6586
|
y[p].minx !== void 0 ? y[p].minx : -1 / 0,
|
|
6587
6587
|
y[p].miny !== void 0 ? y[p].miny : -1 / 0,
|
|
6588
6588
|
y[p].minz !== void 0 ? y[p].minz : -1 / 0
|
|
@@ -6590,9 +6590,9 @@ class Ce {
|
|
|
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
|
-
))),
|
|
6593
|
+
))), C.updateMatrixWorld(!0), T = !0);
|
|
6594
6594
|
}
|
|
6595
|
-
if (!
|
|
6595
|
+
if (!T) 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
|
+
}, ze = {
|
|
6629
6629
|
defaultVoice: "aura-2-thalia-en",
|
|
6630
6630
|
// Thalia (Female, English)
|
|
6631
6631
|
voices: {
|
|
@@ -6645,7 +6645,7 @@ const ae = {
|
|
|
6645
6645
|
// Male, English - Powerful
|
|
6646
6646
|
}
|
|
6647
6647
|
};
|
|
6648
|
-
function
|
|
6648
|
+
function ve() {
|
|
6649
6649
|
return {
|
|
6650
6650
|
service: "elevenlabs",
|
|
6651
6651
|
endpoint: ae.endpoint,
|
|
@@ -6654,8 +6654,8 @@ function xe() {
|
|
|
6654
6654
|
voices: ae.voices
|
|
6655
6655
|
};
|
|
6656
6656
|
}
|
|
6657
|
-
function
|
|
6658
|
-
const D =
|
|
6657
|
+
function pt() {
|
|
6658
|
+
const D = ve(), t = [];
|
|
6659
6659
|
return Object.entries(D.voices).forEach(([e, i]) => {
|
|
6660
6660
|
t.push({
|
|
6661
6661
|
value: i,
|
|
@@ -6663,7 +6663,7 @@ function mt() {
|
|
|
6663
6663
|
});
|
|
6664
6664
|
}), t;
|
|
6665
6665
|
}
|
|
6666
|
-
const
|
|
6666
|
+
const Te = be(({
|
|
6667
6667
|
avatarUrl: D = "/avatars/brunette.glb",
|
|
6668
6668
|
avatarBody: t = "F",
|
|
6669
6669
|
mood: e = "neutral",
|
|
@@ -6685,7 +6685,7 @@ const He = ye(({
|
|
|
6685
6685
|
style: y = {},
|
|
6686
6686
|
animations: x = {}
|
|
6687
6687
|
}, v) => {
|
|
6688
|
-
const
|
|
6688
|
+
const T = Y(null), p = Y(null), [F, C] = re(!0), [I, O] = re(null), [B, $] = re(!1), j = ve(), S = n || j.service;
|
|
6689
6689
|
let P;
|
|
6690
6690
|
S === "browser" ? P = {
|
|
6691
6691
|
service: "browser",
|
|
@@ -6702,8 +6702,8 @@ const He = ye(({
|
|
|
6702
6702
|
service: "deepgram",
|
|
6703
6703
|
endpoint: "https://api.deepgram.com/v1/speak",
|
|
6704
6704
|
apiKey: o || j.apiKey,
|
|
6705
|
-
defaultVoice: s || j.defaultVoice ||
|
|
6706
|
-
voices: j.voices ||
|
|
6705
|
+
defaultVoice: s || j.defaultVoice || ze.defaultVoice,
|
|
6706
|
+
voices: j.voices || ze.voices
|
|
6707
6707
|
} : P = {
|
|
6708
6708
|
...j,
|
|
6709
6709
|
// Override API key if provided via props
|
|
@@ -6726,49 +6726,49 @@ const He = ye(({
|
|
|
6726
6726
|
lipsyncModules: ["en"],
|
|
6727
6727
|
cameraView: u
|
|
6728
6728
|
}, q = E(async () => {
|
|
6729
|
-
if (!(!
|
|
6729
|
+
if (!(!T.current || p.current))
|
|
6730
6730
|
try {
|
|
6731
|
-
if (
|
|
6731
|
+
if (C(!0), O(null), p.current = new He(T.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 w = Math.min(100, Math.round(U.loaded / U.total * 100));
|
|
6734
|
+
c(w);
|
|
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 w = () => {
|
|
6738
|
+
p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? U() : setTimeout(w, 100);
|
|
6739
6739
|
};
|
|
6740
|
-
|
|
6740
|
+
w();
|
|
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()),
|
|
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()), C(!1), $(!0), l(p.current);
|
|
6748
|
+
const H = () => {
|
|
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", H), () => {
|
|
6752
|
+
document.removeEventListener("visibilitychange", H);
|
|
6753
6753
|
};
|
|
6754
6754
|
} catch (L) {
|
|
6755
|
-
console.error("Error initializing TalkingHead:", L), O(L.message || "Failed to initialize avatar"),
|
|
6755
|
+
console.error("Error initializing TalkingHead:", L), O(L.message || "Failed to initialize avatar"), C(!1), d(L);
|
|
6756
6756
|
}
|
|
6757
6757
|
}, [D, t, e, i, n, s, o, a, r, h, u]);
|
|
6758
6758
|
he(() => (q(), () => {
|
|
6759
6759
|
p.current && (p.current.stop(), p.current.dispose(), p.current = null);
|
|
6760
6760
|
}), [q]), he(() => {
|
|
6761
|
-
if (!
|
|
6761
|
+
if (!T.current || !p.current) return;
|
|
6762
6762
|
const L = new ResizeObserver((U) => {
|
|
6763
|
-
for (const
|
|
6763
|
+
for (const w of U)
|
|
6764
6764
|
p.current && p.current.onResize && p.current.onResize();
|
|
6765
6765
|
});
|
|
6766
|
-
L.observe(
|
|
6767
|
-
const
|
|
6766
|
+
L.observe(T.current);
|
|
6767
|
+
const H = () => {
|
|
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", H), () => {
|
|
6771
|
+
L.disconnect(), window.removeEventListener("resize", H);
|
|
6772
6772
|
};
|
|
6773
6773
|
}, [B]);
|
|
6774
6774
|
const _ = E(async () => {
|
|
@@ -6778,46 +6778,59 @@ const He = ye(({
|
|
|
6778
6778
|
} catch (L) {
|
|
6779
6779
|
console.warn("Failed to resume audio context:", L);
|
|
6780
6780
|
}
|
|
6781
|
-
}, []), le = E(async (L,
|
|
6781
|
+
}, []), le = E(async (L, H = {}) => {
|
|
6782
6782
|
if (p.current && B)
|
|
6783
6783
|
try {
|
|
6784
6784
|
await _();
|
|
6785
6785
|
const U = {
|
|
6786
|
-
...
|
|
6787
|
-
lipsyncLang:
|
|
6786
|
+
...H,
|
|
6787
|
+
lipsyncLang: H.lipsyncLang || W.lipsyncLang || "en"
|
|
6788
6788
|
};
|
|
6789
|
-
if (
|
|
6790
|
-
const
|
|
6789
|
+
if (H.onSpeechEnd && p.current) {
|
|
6790
|
+
const w = p.current;
|
|
6791
6791
|
let G = null, se = 0, ue = !1;
|
|
6792
|
-
const
|
|
6793
|
-
let
|
|
6794
|
-
const
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6792
|
+
const Ee = 1200, Fe = 1e4;
|
|
6793
|
+
let Ie = 0;
|
|
6794
|
+
const fe = setInterval(() => {
|
|
6795
|
+
Ie++, w && w.isSpeaking && (w.audioPlaylist && w.audioPlaylist.length > 0 || w.isAudioPlaying === !0) && (ue = !0, clearInterval(fe), G = setInterval(Ae, 50));
|
|
6796
|
+
const de = !w.speechQueue || w.speechQueue.length === 0;
|
|
6797
|
+
if (w && !w.isSpeaking && de && (!w.audioPlaylist || w.audioPlaylist.length === 0) && (!w.isAudioPlaying || w.isAudioPlaying === !1)) {
|
|
6798
|
+
clearInterval(fe);
|
|
6799
|
+
try {
|
|
6800
|
+
H.onSpeechEnd();
|
|
6801
|
+
} catch (ce) {
|
|
6802
|
+
console.error("Error in onSpeechEnd callback:", ce);
|
|
6803
|
+
}
|
|
6804
|
+
return;
|
|
6805
|
+
}
|
|
6806
|
+
if (Ie * 50 > Fe) {
|
|
6807
|
+
if (clearInterval(fe), w && w.isSpeaking)
|
|
6808
|
+
ue = !0, G = setInterval(Ae, 50);
|
|
6809
|
+
else if (w && !w.isSpeaking && de && (!w.audioPlaylist || w.audioPlaylist.length === 0) && (!w.isAudioPlaying || w.isAudioPlaying === !1))
|
|
6799
6810
|
try {
|
|
6800
|
-
|
|
6801
|
-
} catch (
|
|
6802
|
-
console.error("Error in onSpeechEnd callback:",
|
|
6811
|
+
H.onSpeechEnd();
|
|
6812
|
+
} catch (ce) {
|
|
6813
|
+
console.error("Error in onSpeechEnd callback:", ce);
|
|
6803
6814
|
}
|
|
6804
|
-
|
|
6805
|
-
|
|
6815
|
+
}
|
|
6816
|
+
}, 50), Ae = () => {
|
|
6817
|
+
if (se++, se > Ee) {
|
|
6806
6818
|
G && (clearInterval(G), G = null);
|
|
6807
6819
|
try {
|
|
6808
|
-
|
|
6809
|
-
} catch (
|
|
6810
|
-
console.error("Error in onSpeechEnd callback:",
|
|
6820
|
+
H.onSpeechEnd();
|
|
6821
|
+
} catch (xe) {
|
|
6822
|
+
console.error("Error in onSpeechEnd callback:", xe);
|
|
6811
6823
|
}
|
|
6812
6824
|
return;
|
|
6813
6825
|
}
|
|
6814
6826
|
if (!ue)
|
|
6815
6827
|
return;
|
|
6816
|
-
|
|
6828
|
+
const de = !w.speechQueue || w.speechQueue.length === 0;
|
|
6829
|
+
w && (!w.isSpeaking || w.isSpeaking === !1) && (!w.audioPlaylist || w.audioPlaylist.length === 0) && (!w.isAudioPlaying || w.isAudioPlaying === !1) && de && (G && (clearInterval(G), G = null), setTimeout(() => {
|
|
6817
6830
|
try {
|
|
6818
|
-
|
|
6819
|
-
} catch (
|
|
6820
|
-
console.error("Error in onSpeechEnd callback:",
|
|
6831
|
+
H.onSpeechEnd();
|
|
6832
|
+
} catch (xe) {
|
|
6833
|
+
console.error("Error in onSpeechEnd callback:", xe);
|
|
6821
6834
|
}
|
|
6822
6835
|
}, 50));
|
|
6823
6836
|
};
|
|
@@ -6828,25 +6841,25 @@ const He = ye(({
|
|
|
6828
6841
|
} catch (U) {
|
|
6829
6842
|
console.error("Error speaking text:", U), O(U.message || "Failed to speak text");
|
|
6830
6843
|
}
|
|
6831
|
-
}, [B, _, W.lipsyncLang]),
|
|
6844
|
+
}, [B, _, W.lipsyncLang]), ye = E(() => {
|
|
6832
6845
|
p.current && (p.current.stopSpeaking(), p.current.setSlowdownRate && p.current.setSlowdownRate(1));
|
|
6833
6846
|
}, []), K = E((L) => {
|
|
6834
6847
|
p.current && p.current.setMood(L);
|
|
6835
6848
|
}, []), b = E((L) => {
|
|
6836
6849
|
p.current && p.current.setSlowdownRate && p.current.setSlowdownRate(L);
|
|
6837
|
-
}, []), R = E((L,
|
|
6850
|
+
}, []), R = E((L, H = !1) => {
|
|
6838
6851
|
if (p.current && p.current.playAnimation) {
|
|
6839
6852
|
if (x && x[L] && (L = x[L]), p.current.setShowFullAvatar)
|
|
6840
6853
|
try {
|
|
6841
6854
|
p.current.setShowFullAvatar(!0);
|
|
6842
|
-
} catch (
|
|
6843
|
-
console.warn("Error setting full body mode:",
|
|
6855
|
+
} catch (w) {
|
|
6856
|
+
console.warn("Error setting full body mode:", w);
|
|
6844
6857
|
}
|
|
6845
6858
|
if (L.includes("."))
|
|
6846
6859
|
try {
|
|
6847
|
-
p.current.playAnimation(L, null, 10, 0, 0.01,
|
|
6848
|
-
} catch (
|
|
6849
|
-
console.warn(`Failed to play ${L}:`,
|
|
6860
|
+
p.current.playAnimation(L, null, 10, 0, 0.01, H);
|
|
6861
|
+
} catch (w) {
|
|
6862
|
+
console.warn(`Failed to play ${L}:`, w);
|
|
6850
6863
|
try {
|
|
6851
6864
|
p.current.setBodyMovement("idle");
|
|
6852
6865
|
} catch (G) {
|
|
@@ -6854,11 +6867,11 @@ const He = ye(({
|
|
|
6854
6867
|
}
|
|
6855
6868
|
}
|
|
6856
6869
|
else {
|
|
6857
|
-
const
|
|
6870
|
+
const w = [".fbx", ".glb", ".gltf"];
|
|
6858
6871
|
let G = !1;
|
|
6859
|
-
for (const se of
|
|
6872
|
+
for (const se of w)
|
|
6860
6873
|
try {
|
|
6861
|
-
p.current.playAnimation(L + se, null, 10, 0, 0.01,
|
|
6874
|
+
p.current.playAnimation(L + se, null, 10, 0, 0.01, H), G = !0;
|
|
6862
6875
|
break;
|
|
6863
6876
|
} catch {
|
|
6864
6877
|
}
|
|
@@ -6872,25 +6885,25 @@ const He = ye(({
|
|
|
6872
6885
|
}
|
|
6873
6886
|
}
|
|
6874
6887
|
}
|
|
6875
|
-
}, [x]),
|
|
6888
|
+
}, [x]), z = E(() => {
|
|
6876
6889
|
p.current && p.current.onResize && p.current.onResize();
|
|
6877
6890
|
}, []);
|
|
6878
|
-
return
|
|
6891
|
+
return Re(v, () => ({
|
|
6879
6892
|
speakText: le,
|
|
6880
|
-
stopSpeaking:
|
|
6893
|
+
stopSpeaking: ye,
|
|
6881
6894
|
resumeAudioContext: _,
|
|
6882
6895
|
setMood: K,
|
|
6883
6896
|
setTimingAdjustment: b,
|
|
6884
6897
|
playAnimation: R,
|
|
6885
6898
|
isReady: B,
|
|
6886
6899
|
talkingHead: p.current,
|
|
6887
|
-
handleResize:
|
|
6900
|
+
handleResize: z,
|
|
6888
6901
|
setBodyMovement: (L) => {
|
|
6889
6902
|
if (p.current && p.current.setShowFullAvatar && p.current.setBodyMovement)
|
|
6890
6903
|
try {
|
|
6891
6904
|
p.current.setShowFullAvatar(!0), p.current.setBodyMovement(L);
|
|
6892
|
-
} catch (
|
|
6893
|
-
console.warn("Error setting body movement:",
|
|
6905
|
+
} catch (H) {
|
|
6906
|
+
console.warn("Error setting body movement:", H);
|
|
6894
6907
|
}
|
|
6895
6908
|
},
|
|
6896
6909
|
setMovementIntensity: (L) => p.current?.setMovementIntensity(L),
|
|
@@ -6906,8 +6919,8 @@ const He = ye(({
|
|
|
6906
6919
|
if (p.current && p.current.setShowFullAvatar && p.current.playReaction)
|
|
6907
6920
|
try {
|
|
6908
6921
|
p.current.setShowFullAvatar(!0), p.current.playReaction(L);
|
|
6909
|
-
} catch (
|
|
6910
|
-
console.warn("Error playing reaction:",
|
|
6922
|
+
} catch (H) {
|
|
6923
|
+
console.warn("Error playing reaction:", H);
|
|
6911
6924
|
}
|
|
6912
6925
|
},
|
|
6913
6926
|
playCelebration: () => {
|
|
@@ -6922,8 +6935,8 @@ const He = ye(({
|
|
|
6922
6935
|
if (p.current && p.current.setShowFullAvatar)
|
|
6923
6936
|
try {
|
|
6924
6937
|
p.current.setShowFullAvatar(L);
|
|
6925
|
-
} catch (
|
|
6926
|
-
console.warn("Error setting showFullAvatar:",
|
|
6938
|
+
} catch (H) {
|
|
6939
|
+
console.warn("Error setting showFullAvatar:", H);
|
|
6927
6940
|
}
|
|
6928
6941
|
},
|
|
6929
6942
|
lockAvatarPosition: () => {
|
|
@@ -6942,7 +6955,7 @@ const He = ye(({
|
|
|
6942
6955
|
console.warn("Error unlocking avatar position:", L);
|
|
6943
6956
|
}
|
|
6944
6957
|
}
|
|
6945
|
-
})), /* @__PURE__ */
|
|
6958
|
+
})), /* @__PURE__ */ Ce(
|
|
6946
6959
|
"div",
|
|
6947
6960
|
{
|
|
6948
6961
|
className: `talking-head-avatar ${g}`,
|
|
@@ -6956,7 +6969,7 @@ const He = ye(({
|
|
|
6956
6969
|
/* @__PURE__ */ oe(
|
|
6957
6970
|
"div",
|
|
6958
6971
|
{
|
|
6959
|
-
ref:
|
|
6972
|
+
ref: T,
|
|
6960
6973
|
className: "talking-head-viewer",
|
|
6961
6974
|
style: {
|
|
6962
6975
|
width: "100%",
|
|
@@ -6990,8 +7003,8 @@ const He = ye(({
|
|
|
6990
7003
|
}
|
|
6991
7004
|
);
|
|
6992
7005
|
});
|
|
6993
|
-
|
|
6994
|
-
const
|
|
7006
|
+
Te.displayName = "TalkingHeadAvatar";
|
|
7007
|
+
const ot = be(({
|
|
6995
7008
|
text: D = "Hello! I'm a talking avatar. How are you today?",
|
|
6996
7009
|
onLoading: t = () => {
|
|
6997
7010
|
},
|
|
@@ -7003,7 +7016,7 @@ const nt = ye(({
|
|
|
7003
7016
|
style: s = {},
|
|
7004
7017
|
avatarConfig: o = {}
|
|
7005
7018
|
}, r) => {
|
|
7006
|
-
const h = Y(null), a = Y(null), [u, l] = re(!0), [c, d] = re(null), [g, y] = re(!1), x =
|
|
7019
|
+
const h = Y(null), a = Y(null), [u, l] = re(!0), [c, d] = re(null), [g, y] = re(!1), x = ve(), v = o.ttsService || x.service, T = v === "browser" ? {
|
|
7007
7020
|
endpoint: "",
|
|
7008
7021
|
apiKey: null,
|
|
7009
7022
|
defaultVoice: "Google US English"
|
|
@@ -7019,7 +7032,7 @@ const nt = ye(({
|
|
|
7019
7032
|
body: "F",
|
|
7020
7033
|
avatarMood: "neutral",
|
|
7021
7034
|
ttsLang: v === "browser" ? "en-US" : "en",
|
|
7022
|
-
ttsVoice: o.ttsVoice ||
|
|
7035
|
+
ttsVoice: o.ttsVoice || T.defaultVoice,
|
|
7023
7036
|
lipsyncLang: "en",
|
|
7024
7037
|
// English lip-sync
|
|
7025
7038
|
showFullAvatar: !0,
|
|
@@ -7028,15 +7041,15 @@ const nt = ye(({
|
|
|
7028
7041
|
movementIntensity: 0.5,
|
|
7029
7042
|
...o
|
|
7030
7043
|
}, F = {
|
|
7031
|
-
ttsEndpoint:
|
|
7032
|
-
ttsApikey:
|
|
7044
|
+
ttsEndpoint: T.endpoint,
|
|
7045
|
+
ttsApikey: T.apiKey,
|
|
7033
7046
|
ttsService: v,
|
|
7034
7047
|
lipsyncModules: ["en"],
|
|
7035
7048
|
cameraView: "upper"
|
|
7036
|
-
},
|
|
7049
|
+
}, C = E(async () => {
|
|
7037
7050
|
if (!(!h.current || a.current))
|
|
7038
7051
|
try {
|
|
7039
|
-
if (l(!0), d(null), a.current = new
|
|
7052
|
+
if (l(!0), d(null), a.current = new He(h.current, F), await a.current.showAvatar(p, (W) => {
|
|
7040
7053
|
if (W.lengthComputable) {
|
|
7041
7054
|
const V = Math.min(100, Math.round(W.loaded / W.total * 100));
|
|
7042
7055
|
t(V);
|
|
@@ -7069,9 +7082,9 @@ const nt = ye(({
|
|
|
7069
7082
|
console.error("Error initializing TalkingHead:", S), d(S.message || "Failed to initialize avatar"), l(!1), e(S);
|
|
7070
7083
|
}
|
|
7071
7084
|
}, []);
|
|
7072
|
-
he(() => (
|
|
7085
|
+
he(() => (C(), () => {
|
|
7073
7086
|
a.current && (a.current.stop(), a.current.dispose(), a.current = null);
|
|
7074
|
-
}), [
|
|
7087
|
+
}), [C]);
|
|
7075
7088
|
const I = E((S) => {
|
|
7076
7089
|
if (a.current && g)
|
|
7077
7090
|
try {
|
|
@@ -7130,7 +7143,7 @@ const nt = ye(({
|
|
|
7130
7143
|
} else
|
|
7131
7144
|
console.warn("Animation system not available or animation not found:", S);
|
|
7132
7145
|
}, []);
|
|
7133
|
-
return
|
|
7146
|
+
return Re(r, () => ({
|
|
7134
7147
|
speakText: I,
|
|
7135
7148
|
stopSpeaking: O,
|
|
7136
7149
|
setMood: B,
|
|
@@ -7195,7 +7208,7 @@ const nt = ye(({
|
|
|
7195
7208
|
console.warn("Error unlocking avatar position:", S);
|
|
7196
7209
|
}
|
|
7197
7210
|
}
|
|
7198
|
-
})), /* @__PURE__ */
|
|
7211
|
+
})), /* @__PURE__ */ Ce("div", { className: `talking-head-container ${n}`, style: s, children: [
|
|
7199
7212
|
/* @__PURE__ */ oe(
|
|
7200
7213
|
"div",
|
|
7201
7214
|
{
|
|
@@ -7231,8 +7244,8 @@ const nt = ye(({
|
|
|
7231
7244
|
}, children: c })
|
|
7232
7245
|
] });
|
|
7233
7246
|
});
|
|
7234
|
-
|
|
7235
|
-
const
|
|
7247
|
+
ot.displayName = "TalkingHeadComponent";
|
|
7248
|
+
const st = be(({
|
|
7236
7249
|
curriculumData: D = null,
|
|
7237
7250
|
avatarConfig: t = {},
|
|
7238
7251
|
animations: e = {},
|
|
@@ -7264,12 +7277,12 @@ const ot = ye(({
|
|
|
7264
7277
|
onQuestionAnswer: s,
|
|
7265
7278
|
onCurriculumComplete: o,
|
|
7266
7279
|
onCustomAction: r
|
|
7267
|
-
}), d = Y(null), g = Y(null), y = Y(null), x = Y(null), v = Y(null),
|
|
7280
|
+
}), d = Y(null), g = Y(null), y = Y(null), x = Y(null), v = Y(null), T = Y(null), p = Y(null), F = Y(D?.curriculum || {
|
|
7268
7281
|
title: "Default Curriculum",
|
|
7269
7282
|
description: "No curriculum data provided",
|
|
7270
7283
|
language: "en",
|
|
7271
7284
|
modules: []
|
|
7272
|
-
}),
|
|
7285
|
+
}), C = Y({
|
|
7273
7286
|
avatarUrl: t.avatarUrl || "/avatars/brunette.glb",
|
|
7274
7287
|
avatarBody: t.avatarBody || "F",
|
|
7275
7288
|
mood: t.mood || "happy",
|
|
@@ -7297,7 +7310,7 @@ const ot = ye(({
|
|
|
7297
7310
|
description: "No curriculum data provided",
|
|
7298
7311
|
language: "en",
|
|
7299
7312
|
modules: []
|
|
7300
|
-
},
|
|
7313
|
+
}, C.current = {
|
|
7301
7314
|
avatarUrl: t.avatarUrl || "/avatars/brunette.glb",
|
|
7302
7315
|
avatarBody: t.avatarBody || "F",
|
|
7303
7316
|
mood: t.mood || "happy",
|
|
@@ -7336,8 +7349,8 @@ const ot = ye(({
|
|
|
7336
7349
|
} catch {
|
|
7337
7350
|
u.current.playCelebration();
|
|
7338
7351
|
}
|
|
7339
|
-
const
|
|
7340
|
-
|
|
7352
|
+
const z = F.current || { modules: [] }, L = z.modules[l.current.currentModuleIndex], H = l.current.currentLessonIndex < (L?.lessons?.length || 0) - 1, U = l.current.currentModuleIndex < (z.modules?.length || 0) - 1, w = H || U, G = C.current || { lipsyncLang: "en" };
|
|
7353
|
+
w ? u.current.speakText(R, {
|
|
7341
7354
|
lipsyncLang: G.lipsyncLang,
|
|
7342
7355
|
onSpeechEnd: () => {
|
|
7343
7356
|
g.current && g.current();
|
|
@@ -7354,7 +7367,7 @@ const ot = ye(({
|
|
|
7354
7367
|
const b = F.current || { modules: [] };
|
|
7355
7368
|
if (c.current.onCurriculumComplete({
|
|
7356
7369
|
modules: b.modules.length,
|
|
7357
|
-
totalLessons: b.modules.reduce((R,
|
|
7370
|
+
totalLessons: b.modules.reduce((R, z) => R + z.lessons.length, 0)
|
|
7358
7371
|
}), u.current) {
|
|
7359
7372
|
if (u.current.setMood("celebrating"), e.curriculumComplete)
|
|
7360
7373
|
try {
|
|
@@ -7362,7 +7375,7 @@ const ot = ye(({
|
|
|
7362
7375
|
} catch {
|
|
7363
7376
|
u.current.playCelebration();
|
|
7364
7377
|
}
|
|
7365
|
-
const R =
|
|
7378
|
+
const R = C.current || { lipsyncLang: "en" };
|
|
7366
7379
|
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 });
|
|
7367
7380
|
}
|
|
7368
7381
|
}, [e.curriculumComplete]), S = E(() => {
|
|
@@ -7383,14 +7396,14 @@ const ot = ye(({
|
|
|
7383
7396
|
} catch (L) {
|
|
7384
7397
|
console.warn("Failed to play questionStart animation:", L);
|
|
7385
7398
|
}
|
|
7386
|
-
const
|
|
7387
|
-
R.type === "code_test" ? u.current.speakText(`Let's test your coding skills! Here's your first challenge: ${R.question}`, { lipsyncLang:
|
|
7399
|
+
const z = C.current || { lipsyncLang: "en" };
|
|
7400
|
+
R.type === "code_test" ? u.current.speakText(`Let's test your coding skills! Here's your first challenge: ${R.question}`, { lipsyncLang: z.lipsyncLang }) : R.type === "multiple_choice" ? u.current.speakText(`Now let me ask you some questions. Here's the first one: ${R.question}`, { lipsyncLang: z.lipsyncLang }) : R.type === "true_false" ? u.current.speakText(`Let's start with some true or false questions. First question: ${R.question}`, { lipsyncLang: z.lipsyncLang }) : u.current.speakText(`Now let me ask you some questions. Here's the first one: ${R.question}`, { lipsyncLang: z.lipsyncLang });
|
|
7388
7401
|
} else if (u.current && u.current.isReady) {
|
|
7389
|
-
const
|
|
7390
|
-
u.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang:
|
|
7402
|
+
const z = C.current || { lipsyncLang: "en" };
|
|
7403
|
+
u.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang: z.lipsyncLang });
|
|
7391
7404
|
} else
|
|
7392
7405
|
setTimeout(() => {
|
|
7393
|
-
|
|
7406
|
+
T.current && T.current();
|
|
7394
7407
|
}, 100);
|
|
7395
7408
|
}, [e.questionStart, I, O]), P = E(() => {
|
|
7396
7409
|
const b = I();
|
|
@@ -7411,15 +7424,15 @@ const ot = ye(({
|
|
|
7411
7424
|
} catch (L) {
|
|
7412
7425
|
console.warn("Failed to play nextQuestion animation:", L);
|
|
7413
7426
|
}
|
|
7414
|
-
const
|
|
7427
|
+
const z = C.current || { lipsyncLang: "en" };
|
|
7415
7428
|
R.type === "code_test" ? u.current.speakText(`Great! Now let's move on to your next coding challenge: ${R.question}`, {
|
|
7416
|
-
lipsyncLang:
|
|
7429
|
+
lipsyncLang: z.lipsyncLang
|
|
7417
7430
|
}) : R.type === "multiple_choice" ? u.current.speakText(`Alright! Here's your next question: ${R.question}`, {
|
|
7418
|
-
lipsyncLang:
|
|
7431
|
+
lipsyncLang: z.lipsyncLang
|
|
7419
7432
|
}) : R.type === "true_false" ? u.current.speakText(`Now let's try this one: ${R.question}`, {
|
|
7420
|
-
lipsyncLang:
|
|
7433
|
+
lipsyncLang: z.lipsyncLang
|
|
7421
7434
|
}) : u.current.speakText(`Here's the next question: ${R.question}`, {
|
|
7422
|
-
lipsyncLang:
|
|
7435
|
+
lipsyncLang: z.lipsyncLang
|
|
7423
7436
|
});
|
|
7424
7437
|
}
|
|
7425
7438
|
} else
|
|
@@ -7439,21 +7452,21 @@ const ot = ye(({
|
|
|
7439
7452
|
const b = I();
|
|
7440
7453
|
let R = null;
|
|
7441
7454
|
if (b?.avatar_script && b?.body) {
|
|
7442
|
-
const
|
|
7443
|
-
R = `${
|
|
7455
|
+
const z = b.avatar_script.trim(), L = b.body.trim(), H = z.match(/[.!?]$/) ? " " : ". ";
|
|
7456
|
+
R = `${z}${H}${L}`;
|
|
7444
7457
|
} else
|
|
7445
7458
|
R = b?.avatar_script || b?.body || null;
|
|
7446
7459
|
if (u.current && u.current.isReady && R) {
|
|
7447
7460
|
l.current.isTeaching = !0, l.current.isQuestionMode = !1, u.current.setMood("happy");
|
|
7448
|
-
let
|
|
7461
|
+
let z = !1;
|
|
7449
7462
|
if (e.teaching)
|
|
7450
7463
|
try {
|
|
7451
|
-
u.current.playAnimation(e.teaching, !0),
|
|
7452
|
-
} catch (
|
|
7453
|
-
console.warn("Failed to play teaching animation:",
|
|
7464
|
+
u.current.playAnimation(e.teaching, !0), z = !0;
|
|
7465
|
+
} catch (H) {
|
|
7466
|
+
console.warn("Failed to play teaching animation:", H);
|
|
7454
7467
|
}
|
|
7455
|
-
|
|
7456
|
-
const L =
|
|
7468
|
+
z || u.current.setBodyMovement("gesturing");
|
|
7469
|
+
const L = C.current || { lipsyncLang: "en" };
|
|
7457
7470
|
c.current.onLessonStart({
|
|
7458
7471
|
moduleIndex: l.current.currentModuleIndex,
|
|
7459
7472
|
lessonIndex: l.current.currentLessonIndex,
|
|
@@ -7466,21 +7479,21 @@ const ot = ye(({
|
|
|
7466
7479
|
}), u.current.speakText(R, {
|
|
7467
7480
|
lipsyncLang: L.lipsyncLang,
|
|
7468
7481
|
onSpeechEnd: () => {
|
|
7469
|
-
l.current.isTeaching = !1, b.questions && b.questions.length > 0 ?
|
|
7482
|
+
l.current.isTeaching = !1, b.questions && b.questions.length > 0 ? T.current && T.current() : y.current && y.current();
|
|
7470
7483
|
}
|
|
7471
7484
|
});
|
|
7472
7485
|
}
|
|
7473
7486
|
}, [e.teaching, I]), q = E((b) => {
|
|
7474
|
-
const R = O(),
|
|
7475
|
-
if (
|
|
7487
|
+
const R = O(), z = B(b, R);
|
|
7488
|
+
if (z && (l.current.score += 1), c.current.onQuestionAnswer({
|
|
7476
7489
|
moduleIndex: l.current.currentModuleIndex,
|
|
7477
7490
|
lessonIndex: l.current.currentLessonIndex,
|
|
7478
7491
|
questionIndex: l.current.currentQuestionIndex,
|
|
7479
7492
|
answer: b,
|
|
7480
|
-
isCorrect:
|
|
7493
|
+
isCorrect: z,
|
|
7481
7494
|
question: R
|
|
7482
7495
|
}), u.current)
|
|
7483
|
-
if (
|
|
7496
|
+
if (z) {
|
|
7484
7497
|
if (u.current.setMood("happy"), e.correct)
|
|
7485
7498
|
try {
|
|
7486
7499
|
u.current.playReaction("happy");
|
|
@@ -7488,9 +7501,9 @@ const ot = ye(({
|
|
|
7488
7501
|
u.current.setBodyMovement("happy");
|
|
7489
7502
|
}
|
|
7490
7503
|
u.current.setBodyMovement("gesturing");
|
|
7491
|
-
const L = R.type === "code_test" ? `Great job! Your code passed all the tests! ${R.explanation || ""}` : `Excellent! That's correct! ${R.explanation || ""}`,
|
|
7504
|
+
const L = R.type === "code_test" ? `Great job! Your code passed all the tests! ${R.explanation || ""}` : `Excellent! That's correct! ${R.explanation || ""}`, H = C.current || { lipsyncLang: "en" };
|
|
7492
7505
|
u.current.speakText(L, {
|
|
7493
|
-
lipsyncLang:
|
|
7506
|
+
lipsyncLang: H.lipsyncLang,
|
|
7494
7507
|
onSpeechEnd: () => {
|
|
7495
7508
|
x.current && x.current();
|
|
7496
7509
|
}
|
|
@@ -7503,9 +7516,9 @@ const ot = ye(({
|
|
|
7503
7516
|
u.current.setBodyMovement("idle");
|
|
7504
7517
|
}
|
|
7505
7518
|
u.current.setBodyMovement("gesturing");
|
|
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.`,
|
|
7519
|
+
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.`, H = C.current || { lipsyncLang: "en" };
|
|
7507
7520
|
u.current.speakText(L, {
|
|
7508
|
-
lipsyncLang:
|
|
7521
|
+
lipsyncLang: H.lipsyncLang,
|
|
7509
7522
|
onSpeechEnd: () => {
|
|
7510
7523
|
x.current && x.current();
|
|
7511
7524
|
}
|
|
@@ -7523,7 +7536,7 @@ const ot = ye(({
|
|
|
7523
7536
|
console.warn("Current question is not a code test. Use handleAnswerSelect for other question types.");
|
|
7524
7537
|
return;
|
|
7525
7538
|
}
|
|
7526
|
-
const
|
|
7539
|
+
const z = {
|
|
7527
7540
|
passed: b.passed === !0,
|
|
7528
7541
|
results: b.results || [],
|
|
7529
7542
|
output: b.output || "",
|
|
@@ -7538,21 +7551,21 @@ const ot = ye(({
|
|
|
7538
7551
|
moduleIndex: l.current.currentModuleIndex,
|
|
7539
7552
|
lessonIndex: l.current.currentLessonIndex,
|
|
7540
7553
|
questionIndex: l.current.currentQuestionIndex,
|
|
7541
|
-
testResult:
|
|
7554
|
+
testResult: z,
|
|
7542
7555
|
question: R
|
|
7543
|
-
}), p.current && p.current(
|
|
7556
|
+
}), p.current && p.current(z);
|
|
7544
7557
|
}, [O, B]), le = E(() => {
|
|
7545
7558
|
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;
|
|
7546
|
-
}, []),
|
|
7559
|
+
}, []), ye = E((b) => {
|
|
7547
7560
|
console.log("Avatar is ready!", b);
|
|
7548
|
-
const R = I(),
|
|
7549
|
-
h &&
|
|
7561
|
+
const R = I(), z = R?.avatar_script || R?.body;
|
|
7562
|
+
h && z && setTimeout(() => {
|
|
7550
7563
|
d.current && d.current();
|
|
7551
7564
|
}, 10);
|
|
7552
7565
|
}, [h, I]);
|
|
7553
|
-
|
|
7554
|
-
d.current = V, g.current = W, y.current = $, x.current = P, v.current = j,
|
|
7555
|
-
}),
|
|
7566
|
+
Pe(() => {
|
|
7567
|
+
d.current = V, g.current = W, y.current = $, x.current = P, v.current = j, T.current = S, p.current = q;
|
|
7568
|
+
}), Re(a, () => ({
|
|
7556
7569
|
// Curriculum control methods
|
|
7557
7570
|
startTeaching: V,
|
|
7558
7571
|
startQuestions: S,
|
|
@@ -7571,8 +7584,8 @@ const ot = ye(({
|
|
|
7571
7584
|
// Convenience methods that delegate to avatar (always check current ref)
|
|
7572
7585
|
speakText: async (b, R = {}) => {
|
|
7573
7586
|
await u.current?.resumeAudioContext?.();
|
|
7574
|
-
const
|
|
7575
|
-
u.current?.speakText(b, { ...R, lipsyncLang: R.lipsyncLang ||
|
|
7587
|
+
const z = C.current || { lipsyncLang: "en" };
|
|
7588
|
+
u.current?.speakText(b, { ...R, lipsyncLang: R.lipsyncLang || z.lipsyncLang });
|
|
7576
7589
|
},
|
|
7577
7590
|
resumeAudioContext: async () => {
|
|
7578
7591
|
if (u.current?.resumeAudioContext)
|
|
@@ -7583,8 +7596,8 @@ const ot = ye(({
|
|
|
7583
7596
|
if (R.state === "suspended" || R.state === "interrupted")
|
|
7584
7597
|
try {
|
|
7585
7598
|
await R.resume(), console.log("Audio context resumed via talkingHead");
|
|
7586
|
-
} catch (
|
|
7587
|
-
console.warn("Failed to resume audio context:",
|
|
7599
|
+
} catch (z) {
|
|
7600
|
+
console.warn("Failed to resume audio context:", z);
|
|
7588
7601
|
}
|
|
7589
7602
|
} else
|
|
7590
7603
|
console.warn("Audio context not available yet");
|
|
@@ -7614,7 +7627,7 @@ const ot = ye(({
|
|
|
7614
7627
|
// Avatar readiness check (always returns current value)
|
|
7615
7628
|
isAvatarReady: () => u.current?.isReady || !1
|
|
7616
7629
|
}), [V, S, q, _, P, W, $, j, le, O, I]);
|
|
7617
|
-
const K =
|
|
7630
|
+
const K = C.current || {
|
|
7618
7631
|
avatarUrl: "/avatars/brunette.glb",
|
|
7619
7632
|
avatarBody: "F",
|
|
7620
7633
|
mood: "happy",
|
|
@@ -7628,7 +7641,7 @@ const ot = ye(({
|
|
|
7628
7641
|
animations: e
|
|
7629
7642
|
};
|
|
7630
7643
|
return /* @__PURE__ */ oe("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ oe(
|
|
7631
|
-
|
|
7644
|
+
Te,
|
|
7632
7645
|
{
|
|
7633
7646
|
ref: u,
|
|
7634
7647
|
avatarUrl: K.avatarUrl,
|
|
@@ -7643,7 +7656,7 @@ const ot = ye(({
|
|
|
7643
7656
|
showFullAvatar: K.showFullAvatar,
|
|
7644
7657
|
cameraView: "upper",
|
|
7645
7658
|
animations: K.animations,
|
|
7646
|
-
onReady:
|
|
7659
|
+
onReady: ye,
|
|
7647
7660
|
onLoading: () => {
|
|
7648
7661
|
},
|
|
7649
7662
|
onError: (b) => {
|
|
@@ -7652,8 +7665,8 @@ const ot = ye(({
|
|
|
7652
7665
|
}
|
|
7653
7666
|
) });
|
|
7654
7667
|
});
|
|
7655
|
-
|
|
7656
|
-
const
|
|
7668
|
+
st.displayName = "CurriculumLearning";
|
|
7669
|
+
const Me = {
|
|
7657
7670
|
// Code-based dance animations (no FBX required)
|
|
7658
7671
|
dance: {
|
|
7659
7672
|
name: "dance",
|
|
@@ -7756,14 +7769,14 @@ const Te = {
|
|
|
7756
7769
|
duration: 5e3,
|
|
7757
7770
|
description: "Excited, energetic movement"
|
|
7758
7771
|
}
|
|
7759
|
-
},
|
|
7772
|
+
}, gt = (D) => Me[D] || null, yt = (D) => Me.hasOwnProperty(D);
|
|
7760
7773
|
export {
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7774
|
+
st as CurriculumLearning,
|
|
7775
|
+
Te as TalkingHeadAvatar,
|
|
7776
|
+
ot as TalkingHeadComponent,
|
|
7777
|
+
Me as animations,
|
|
7778
|
+
ve as getActiveTTSConfig,
|
|
7779
|
+
gt as getAnimation,
|
|
7780
|
+
pt as getVoiceOptions,
|
|
7781
|
+
yt as hasAnimation
|
|
7769
7782
|
};
|