@sage-rsc/talking-head-react 1.6.4 → 1.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -3
- package/dist/index.js +513 -503
- package/package.json +1 -1
- package/src/components/SimpleTalkingAvatar.jsx +55 -16
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsxs as ke, jsx as $ } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Ze, useRef as W, useState as ae, useEffect as fe, useCallback as D, useImperativeHandle as Xe, useLayoutEffect as it } 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 z = [0, 0, 0, 0], O = new f.Vector3(),
|
|
4
|
+
import { OrbitControls as ot } from "three/addons/controls/OrbitControls.js";
|
|
5
|
+
import { GLTFLoader as st } from "three/addons/loaders/GLTFLoader.js";
|
|
6
|
+
import { DRACOLoader as rt } from "three/addons/loaders/DRACOLoader.js";
|
|
7
|
+
import { FBXLoader as qe } from "three/addons/loaders/FBXLoader.js";
|
|
8
|
+
import { RoomEnvironment as at } from "three/addons/environments/RoomEnvironment.js";
|
|
9
|
+
import lt from "three/addons/libs/stats.module.js";
|
|
10
|
+
let m, ye, Re;
|
|
11
|
+
const z = [0, 0, 0, 0], O = new f.Vector3(), Ue = new f.Vector3(), he = new f.Vector3(), We = new f.Vector3();
|
|
12
12
|
new f.Plane();
|
|
13
13
|
new f.Ray();
|
|
14
14
|
new f.Euler();
|
|
15
|
-
const
|
|
15
|
+
const de = new f.Quaternion(), _e = new f.Quaternion(), we = new f.Matrix4(), Ce = new f.Matrix4();
|
|
16
16
|
new f.Vector3();
|
|
17
|
-
const
|
|
18
|
-
class
|
|
17
|
+
const Ve = new f.Vector3(0, 0, 1), ut = new f.Vector3(1, 0, 0), ct = new f.Vector3(0, 1, 0), ht = new f.Vector3(0, 0, 1);
|
|
18
|
+
class dt {
|
|
19
19
|
constructor(t = null) {
|
|
20
20
|
this.opt = Object.assign({
|
|
21
21
|
warmupMs: 2e3,
|
|
@@ -338,7 +338,7 @@ class ut {
|
|
|
338
338
|
ea: [0, 0, 0, 0]
|
|
339
339
|
// External acceleration [m/s^2]
|
|
340
340
|
};
|
|
341
|
-
u.boneParent.matrixWorld.decompose(O,
|
|
341
|
+
u.boneParent.matrixWorld.decompose(O, de, he), O.copy(Ve).applyQuaternion(de).setY(0).normalize(), de.premultiply(_e.setFromUnitVectors(Ve, O).invert()).normalize(), u.qWorldInverseYaw = de.clone().normalize(), this.data.push(u), this.dict[c] = u;
|
|
342
342
|
try {
|
|
343
343
|
this.setValue(c, "type", s.type), this.setValue(c, "stiffness", s.stiffness), this.setValue(c, "damping", s.damping), this.setValue(c, "external", s.external), this.setValue(c, "limits", s.limits), this.setValue(c, "excludes", s.excludes), this.setValue(c, "deltaLocal", s.deltaLocal), this.setValue(c, "deltaWorld", s.deltaWorld), this.setValue(c, "pivot", s.pivot), this.setValue(c, "helper", s.helper);
|
|
344
344
|
} catch (r) {
|
|
@@ -356,22 +356,22 @@ class ut {
|
|
|
356
356
|
for (this.timerMs += t, t > 1e3 && (this.timerMs = 0), t /= 1e3, e = 0, o = this.objectsUpdate.length; e < o; e++)
|
|
357
357
|
i = this.objectsUpdate[e], i.updateMatrix(), i.parent === null ? i.matrixWorld.copy(i.matrix) : i.matrixWorld.multiplyMatrices(i.parent.matrixWorld, i.matrix), i.matrixWorldNeedsUpdate = !1;
|
|
358
358
|
for (e = 0, o = this.data.length; e < o; e++) {
|
|
359
|
-
if (i = this.data[e], O.copy(i.vWorld),
|
|
359
|
+
if (i = this.data[e], O.copy(i.vWorld), we.copy(i.boneParent.matrixWorld), Ce.copy(we).invert(), i.vWorld.setFromMatrixPosition(we), O.applyMatrix4(Ce), O.length() > 0.5 && (console.info("Info: Unrealistic jump of " + O.length().toFixed(2) + " meters."), O.setLength(0.5)), O.applyQuaternion(i.bone.quaternion), z[0] = O.x, z[1] = O.y, z[2] = -O.z, z[3] = O.length() / 3, i.children)
|
|
360
360
|
for (n = 0, s = i.children.length; n < s; n++)
|
|
361
361
|
m = i.children[n], z[0] -= m.v[0] * t / 3, z[1] -= m.v[1] * t / 3, z[2] += m.v[2] * t / 3, z[3] -= m.v[3] * t / 3;
|
|
362
362
|
if (m = this.opt.sensitivityFactor, z[0] *= i.ext * m, z[1] *= i.ext * m, z[2] *= i.ext * m, z[3] *= i.ext * m, i.isX && (m = z[0] / t, i.ea[0] = (m - i.ev[0]) / t, i.ev[0] = m, i.a[0] = -i.k[0] * i.p[0] - i.c[0] * i.v[0] - i.ea[0], i.p[0] += i.v[0] * t + i.a[0] * t * t / 2 + z[0], m = i.v[0] + i.a[0] * t / 2, m = -i.k[0] * i.p[0] - i.c[0] * m - i.ea[0], i.v[0] = i.v[0] + (m + i.a[0]) * t / 2), i.isY && (m = z[1] / t, i.ea[1] = (m - i.ev[1]) / t, i.ev[1] = m, i.a[1] = -i.k[1] * i.p[1] - i.c[1] * i.v[1] - i.ea[1], i.p[1] += i.v[1] * t + i.a[1] * t * t / 2 + z[1], m = i.v[1] + i.a[1] * t / 2, m = -i.k[1] * i.p[1] - i.c[1] * m - i.ea[1], i.v[1] = i.v[1] + (m + i.a[1]) * t / 2), i.isZ && (m = z[2] / t, i.ea[2] = (m - i.ev[2]) / t, i.ev[2] = m, i.a[2] = -i.k[2] * i.p[2] - i.c[2] * i.v[2] - i.ea[2], i.p[2] += i.v[2] * t + i.a[2] * t * t / 2 + z[2], m = i.v[2] + i.a[2] * t / 2, m = -i.k[2] * i.p[2] - i.c[2] * m - i.ea[2], i.v[2] = i.v[2] + (m + i.a[2]) * t / 2), i.isT && (m = z[3] / t, i.ea[3] = (m - i.ev[3]) / t, i.ev[3] = m, i.a[3] = -i.k[3] * i.p[3] - i.c[3] * i.v[3] - i.ea[3], i.p[3] += i.v[3] * t + i.a[3] * t * t / 2 + z[3], m = i.v[3] + i.a[3] * t / 2, m = -i.k[3] * i.p[3] - i.c[3] * m - i.ea[3], i.v[3] = i.v[3] + (m + i.a[3]) * t / 2), this.timerMs < this.opt.warmupMs && (i.v[0] *= 1e-4, i.p[0] *= 1e-4, i.v[1] *= 1e-4, i.p[1] *= 1e-4, i.v[2] *= 1e-4, i.p[2] *= 1e-4, i.v[3] *= 1e-4, i.p[3] *= 1e-4), z[0] = i.p[0], z[1] = i.p[1], z[2] = i.p[2], z[3] = i.p[3], m = this.opt.movementFactor, z[0] *= m, z[1] *= m, z[2] *= m, z[3] *= m, i.dl && (m = i.dl, z[0] += m[0], z[1] += m[1], z[2] += m[2]), i.dw && (m = i.dw, O.set(
|
|
363
363
|
i.vBasis.x + z[0],
|
|
364
364
|
i.vBasis.y + z[1],
|
|
365
365
|
i.vBasis.z + z[2]
|
|
366
|
-
), O.applyMatrix4(
|
|
366
|
+
), O.applyMatrix4(we), O.x += m[0], O.y += m[1], O.z += m[2], O.applyMatrix4(Ce), z[0] += O.x - i.vBasis.x, z[1] += O.y - i.vBasis.y, z[2] += O.z - i.vBasis.z), i.limits && this.opt.isLimits && (m = i.limits, m[0] && (m[0][0] !== null && z[0] < m[0][0] && (z[0] = m[0][0]), m[0][1] !== null && z[0] > m[0][1] && (z[0] = m[0][1])), m[1] && (m[1][0] !== null && z[1] < m[1][0] && (z[1] = m[1][0]), m[1][1] !== null && z[1] > m[1][1] && (z[1] = m[1][1])), m[2] && (m[2][0] !== null && z[2] < m[2][0] && (z[2] = m[2][0]), m[2][1] !== null && z[2] > m[2][1] && (z[2] = m[2][1])), m[3] && (m[3][0] !== null && z[3] < m[3][0] && (z[3] = m[3][0]), m[3][1] !== null && z[3] > m[3][1] && (z[3] = m[3][1]))), i.isPoint)
|
|
367
367
|
i.bone.position.set(
|
|
368
368
|
i.vBasis.x + z[0],
|
|
369
369
|
i.vBasis.y + z[1],
|
|
370
370
|
i.vBasis.z - z[2]
|
|
371
371
|
);
|
|
372
|
-
else if (i.boneParent.quaternion.copy(i.qBasis), i.pivot && this.opt.isPivots && (i.boneParent.updateWorldMatrix(!1, !1), i.boneParent.matrixWorld.decompose(O,
|
|
372
|
+
else if (i.boneParent.quaternion.copy(i.qBasis), i.pivot && this.opt.isPivots && (i.boneParent.updateWorldMatrix(!1, !1), i.boneParent.matrixWorld.decompose(O, de, he), O.copy(Ve).applyQuaternion(de).setY(0).normalize(), de.premultiply(_e.setFromUnitVectors(Ve, O).invert()).normalize(), i.boneParent.quaternion.multiply(de.invert()), i.boneParent.quaternion.multiply(i.qWorldInverseYaw)), i.isZ && (m = Math.atan(z[0] / i.l), de.setFromAxisAngle(ht, -m), i.boneParent.quaternion.multiply(de)), i.isY && (m = i.l / 3, m = m * Math.tanh(z[1] / m), i.bone.position.setLength(i.l + m)), i.isX && (m = Math.atan(z[2] / i.l), de.setFromAxisAngle(ut, -m), i.boneParent.quaternion.multiply(de)), i.isT && (m = 1.5 * Math.tanh(z[3] * 1.5), de.setFromAxisAngle(ct, -m), i.boneParent.quaternion.multiply(de)), i.boneParent.updateWorldMatrix(!1, !0), i.excludes && this.opt.isExcludes)
|
|
373
373
|
for (n = 0, s = i.excludes.length; n < s; n++)
|
|
374
|
-
m = i.excludes[n],
|
|
374
|
+
m = i.excludes[n], he.set(0, 0, 0), m.deltaLocal && (he.x += m.deltaLocal[0], he.y += m.deltaLocal[1], he.z += m.deltaLocal[2]), he.applyMatrix4(m.bone.matrixWorld), Ce.copy(i.boneParent.matrixWorld).invert(), he.applyMatrix4(Ce), O.copy(i.bone.position), !(O.distanceToSquared(he) >= m.radiusSq) && (Re = O.length(), ye = he.length(), !(ye > m.radius + Re) && (ye < Math.abs(m.radius - Re) || (ye = (ye * ye + Re * Re - m.radiusSq) / (2 * ye), he.normalize(), We.copy(he).multiplyScalar(ye), ye = Math.sqrt(Re * Re - ye * ye), O.subVectors(O, We).projectOnPlane(he).normalize().multiplyScalar(ye), Ue.subVectors(i.vBasis, We).projectOnPlane(he).normalize(), Re = Ue.dot(O), Re < 0 && (Re = Math.sqrt(ye * ye - Re * Re), Ue.multiplyScalar(Re), O.add(Ue)), O.add(We).normalize(), he.copy(i.bone.position).normalize(), de.setFromUnitVectors(he, O), i.boneParent.quaternion.premultiply(de), i.boneParent.updateWorldMatrix(!1, !0))));
|
|
375
375
|
}
|
|
376
376
|
this.helpers.isActive && this.updateHelpers();
|
|
377
377
|
}
|
|
@@ -442,17 +442,17 @@ class ut {
|
|
|
442
442
|
*/
|
|
443
443
|
updateHelpers() {
|
|
444
444
|
if (m = this.helpers.points, m.bones.length) {
|
|
445
|
-
|
|
445
|
+
Ce.copy(this.armature.matrixWorld).invert();
|
|
446
446
|
const t = m.object.geometry.getAttribute("position");
|
|
447
447
|
for (let e = 0, n = m.bones.length; e < n; e++)
|
|
448
|
-
|
|
448
|
+
we.multiplyMatrices(Ce, m.bones[e].matrixWorld), O.setFromMatrixPosition(we), t.setXYZ(e, O.x, O.y, O.z);
|
|
449
449
|
t.needsUpdate = !0, m.object.updateMatrixWorld();
|
|
450
450
|
}
|
|
451
451
|
if (m = this.helpers.lines, m.bones.length) {
|
|
452
|
-
|
|
452
|
+
Ce.copy(this.armature.matrixWorld).invert();
|
|
453
453
|
const t = m.object.geometry.getAttribute("position");
|
|
454
454
|
for (let e = 0, n = 0, o = m.bones.length; e < o; e++, n += 2)
|
|
455
|
-
|
|
455
|
+
we.multiplyMatrices(Ce, m.bones[e].matrixWorld), O.setFromMatrixPosition(we), t.setXYZ(n, O.x, O.y, O.z), we.multiplyMatrices(Ce, m.bones[e].parent.matrixWorld), O.setFromMatrixPosition(we), t.setXYZ(n + 1, O.x, O.y, O.z);
|
|
456
456
|
t.needsUpdate = !0, m.object.updateMatrixWorld();
|
|
457
457
|
}
|
|
458
458
|
}
|
|
@@ -489,7 +489,7 @@ class ut {
|
|
|
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 mt {
|
|
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 ct {
|
|
|
814
814
|
return o * s;
|
|
815
815
|
}
|
|
816
816
|
}
|
|
817
|
-
class
|
|
817
|
+
class pt {
|
|
818
818
|
/**
|
|
819
819
|
* @constructor
|
|
820
820
|
*/
|
|
@@ -1396,11 +1396,11 @@ class ht {
|
|
|
1396
1396
|
return e;
|
|
1397
1397
|
}
|
|
1398
1398
|
}
|
|
1399
|
-
const
|
|
1399
|
+
const gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1400
1400
|
__proto__: null,
|
|
1401
|
-
LipsyncEn:
|
|
1401
|
+
LipsyncEn: pt
|
|
1402
1402
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1403
|
-
class
|
|
1403
|
+
class yt {
|
|
1404
1404
|
/**
|
|
1405
1405
|
* @constructor
|
|
1406
1406
|
*/
|
|
@@ -1754,11 +1754,11 @@ class mt {
|
|
|
1754
1754
|
return e;
|
|
1755
1755
|
}
|
|
1756
1756
|
}
|
|
1757
|
-
const
|
|
1757
|
+
const ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1758
1758
|
__proto__: null,
|
|
1759
|
-
LipsyncDe:
|
|
1759
|
+
LipsyncDe: yt
|
|
1760
1760
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1761
|
-
class
|
|
1761
|
+
class xt {
|
|
1762
1762
|
/**
|
|
1763
1763
|
* @constructor
|
|
1764
1764
|
*/
|
|
@@ -2289,11 +2289,11 @@ class gt {
|
|
|
2289
2289
|
return e;
|
|
2290
2290
|
}
|
|
2291
2291
|
}
|
|
2292
|
-
const
|
|
2292
|
+
const bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2293
2293
|
__proto__: null,
|
|
2294
|
-
LipsyncFr:
|
|
2294
|
+
LipsyncFr: xt
|
|
2295
2295
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2296
|
-
class
|
|
2296
|
+
class Rt {
|
|
2297
2297
|
/**
|
|
2298
2298
|
* @constructor
|
|
2299
2299
|
*/
|
|
@@ -2436,11 +2436,11 @@ class ft {
|
|
|
2436
2436
|
return e;
|
|
2437
2437
|
}
|
|
2438
2438
|
}
|
|
2439
|
-
const
|
|
2439
|
+
const vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2440
2440
|
__proto__: null,
|
|
2441
|
-
LipsyncFi:
|
|
2441
|
+
LipsyncFi: Rt
|
|
2442
2442
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2443
|
-
class
|
|
2443
|
+
class It {
|
|
2444
2444
|
/**
|
|
2445
2445
|
* @constructor
|
|
2446
2446
|
*/
|
|
@@ -2620,24 +2620,24 @@ class bt {
|
|
|
2620
2620
|
return e;
|
|
2621
2621
|
}
|
|
2622
2622
|
}
|
|
2623
|
-
const
|
|
2623
|
+
const At = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2624
2624
|
__proto__: null,
|
|
2625
|
-
LipsyncLt:
|
|
2626
|
-
}, Symbol.toStringTag, { value: "Module" })), vt = new URL("data:text/javascript;base64,Y2xhc3MgUGxheWJhY2tXb3JrbGV0IGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgRlNNID0gewogICAgSURMRTogMCwKICAgIFBMQVlJTkc6IDEsCiAgfTsKCiAgY29uc3RydWN0b3Iob3B0aW9ucykgewogICAgc3VwZXIoKTsKICAgIHRoaXMucG9ydC5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HNob3dpbmcgY2xlYXJlZCBzdGF0ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9IGNhdGNoIChfKSB7IH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnJlc2V0KCk7IC8vIFJlc2V0IHRvIElETEUgc3RhdGUgZm9yIHJldXNlCiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlIGxvb3AKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIC8vIEJVRkZFUiBVTkRFUlJVTiAoTEFHKTogUGxheSBzaWxlbmNlIGFuZCB3YWl0IGZvciBtb3JlIGRhdGEuCiAgICAgICAgICAgIHRoaXMuX3NpbGVuY2VGcmFtZXNDb3VudCsrOwogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0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pdGx5IHNpZ25hbGVkIG9yIHRpbWVkIG91dC4KICAgICAgICAgICAgaWYgKCF0aGlzLl9oYXNTZW50RW5kZWQpIHsKICAgICAgICAgICAgICB0aGlzLnBvcnQucG9zdE1lc3NhZ2UoeyB0eXBlOiAicGxheWJhY2stZW5kZWQiIH0pOwogICAgICAgICAgICAgIHRoaXMuX2hhc1NlbnRFbmRlZCA9IHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgLy8gU2VuZCBmaW5hbCBtZXRyaWNzIHNob3dpbmcgY2xlYXJlZCBzdGF0ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9IGNhdGNoIChfKSB7IH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnJlc2V0KCk7IC8vIFJlc2V0IHRvIElETEU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V0dXJuIHRydWUgdG8ga2VlcCB0aGUgcHJvY2Vzc29yIGFsaXZlIGZvciByZXVzZS4KICAgIHJldHVybiB0cnVlOwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoInBsYXliYWNrLXdvcmtsZXQiLCBQbGF5YmFja1dvcmtsZXQpOwo=", import.meta.url), Ke = {
|
|
2627
|
+
en: gt,
|
|
2628
|
+
de: ft,
|
|
2629
|
+
fr: bt,
|
|
2630
|
+
fi: vt,
|
|
2631
|
+
lt: At
|
|
2632
|
+
}, ie = new f.Quaternion(), q = new f.Euler(), Te = new f.Vector3(), Ee = new f.Vector3(), Je = 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 St = 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 Qe {
|
|
2641
2641
|
/**
|
|
2642
2642
|
* Avatar.
|
|
2643
2643
|
* @typedef {Object} Avatar
|
|
@@ -2763,7 +2763,7 @@ class Ze {
|
|
|
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 lt(), 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: {
|
|
@@ -4086,7 +4086,7 @@ class Ze {
|
|
|
4086
4086
|
this.opt.lightSpotDispersion
|
|
4087
4087
|
), this.setLighting(this.opt);
|
|
4088
4088
|
const a = new f.PMREMGenerator(this.renderer);
|
|
4089
|
-
a.compileEquirectangularShader(), this.scene.environment = a.fromScene(new
|
|
4089
|
+
a.compileEquirectangularShader(), this.scene.environment = a.fromScene(new at()).texture, this.resizeobserver = new ResizeObserver(this.onResize.bind(this)), this.resizeobserver.observe(this.nodeAvatar), this.controls = new ot(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;
|
|
4090
4090
|
}
|
|
4091
4091
|
this.ikMesh = new f.SkinnedMesh();
|
|
4092
4092
|
const s = {
|
|
@@ -4104,14 +4104,14 @@ class Ze {
|
|
|
4104
4104
|
Object.entries(s).forEach((a, c) => {
|
|
4105
4105
|
const l = new f.Bone();
|
|
4106
4106
|
l.name = a[0], a[1] ? this.ikMesh.getObjectByName(a[1]).add(l) : this.ikMesh.add(l), i.push(l);
|
|
4107
|
-
}), this.ikMesh.bind(new f.Skeleton(i)), this.dynamicbones = new
|
|
4107
|
+
}), this.ikMesh.bind(new f.Skeleton(i)), this.dynamicbones = new dt(), this.isStreaming = !1, this.streamWorkletNode = null, this.streamAudioStartTime = null, this.streamWaitForAudioChunks = !0, this.streamLipsyncLang = null, this.streamLipsyncType = "visemes", this.streamLipsyncQueue = [];
|
|
4108
4108
|
}
|
|
4109
4109
|
/**
|
|
4110
4110
|
* Helper that re/creates the audio context and the other nodes.
|
|
4111
4111
|
* @param {number} sampleRate
|
|
4112
4112
|
*/
|
|
4113
4113
|
initAudioGraph(t = null) {
|
|
4114
|
-
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
|
|
4114
|
+
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 mt(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(
|
|
4115
4115
|
this.opt.mixerGainSpeech,
|
|
4116
4116
|
this.opt.mixerGainBackground
|
|
4117
4117
|
), this.workletLoaded = !1, this.streamWorkletNode) {
|
|
@@ -4252,9 +4252,9 @@ class Ze {
|
|
|
4252
4252
|
async showAvatar(t, e = null) {
|
|
4253
4253
|
if (!t || !t.hasOwnProperty("url"))
|
|
4254
4254
|
throw new Error("Invalid parameter. The avatar must have at least 'url' specified.");
|
|
4255
|
-
const n = new
|
|
4255
|
+
const n = new st();
|
|
4256
4256
|
if (this.dracoEnabled) {
|
|
4257
|
-
const l = new
|
|
4257
|
+
const l = new rt();
|
|
4258
4258
|
l.setDecoderPath(this.dracoDecoderPath), n.setDRACOLoader(l);
|
|
4259
4259
|
}
|
|
4260
4260
|
let o = await n.loadAsync(t.url, e);
|
|
@@ -4412,9 +4412,9 @@ class Ze {
|
|
|
4412
4412
|
updatePoseDelta() {
|
|
4413
4413
|
for (const [t, e] of Object.entries(this.poseDelta.props)) {
|
|
4414
4414
|
if (e.x === 0 && e.y === 0 && e.z === 0) continue;
|
|
4415
|
-
|
|
4415
|
+
q.set(e.x, e.y, e.z);
|
|
4416
4416
|
const n = this.poseAvatar.props[t];
|
|
4417
|
-
n.isQuaternion ? (
|
|
4417
|
+
n.isQuaternion ? (ie.setFromEuler(q), n.multiply(ie)) : n.isVector3 && n.add(q);
|
|
4418
4418
|
}
|
|
4419
4419
|
}
|
|
4420
4420
|
/**
|
|
@@ -5179,7 +5179,7 @@ class Ze {
|
|
|
5179
5179
|
}, o.x ? new f.Vector3(o.x, o.y, o.z) : null, !0, o.d);
|
|
5180
5180
|
break;
|
|
5181
5181
|
}
|
|
5182
|
-
if ((c || l) && (
|
|
5182
|
+
if ((c || l) && (q.setFromQuaternion(this.poseAvatar.props["Head.quaternion"]), q.x = Math.max(-0.9, Math.min(0.9, 2 * q.x - 0.5)), q.y = Math.max(-0.9, Math.min(0.9, -2.5 * q.y)), c ? (Object.assign(this.mtAvatar.eyesLookDown, { system: q.x < 0 ? -q.x : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyesLookUp, { system: q.x < 0 ? 0 : q.x, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInLeft, { system: q.y < 0 ? -q.y : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutLeft, { system: q.y < 0 ? 0 : q.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInRight, { system: q.y < 0 ? 0 : q.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutRight, { system: q.y < 0 ? -q.y : 0, needsUpdate: !0 }), l && (n = -this.mtAvatar.bodyRotateY.value, o = this.gaussianRandom(-0.2, 0.2), this.animQueue.push(this.animFactory({
|
|
5183
5183
|
name: "headmove",
|
|
5184
5184
|
dt: [[1e3, 2e3], [1e3, 2e3, 1, 2], [1e3, 2e3], [1e3, 2e3, 1, 2]],
|
|
5185
5185
|
vs: {
|
|
@@ -5200,7 +5200,7 @@ class Ze {
|
|
|
5200
5200
|
eyeLookOutRight: [null, 0],
|
|
5201
5201
|
eyeContact: [0]
|
|
5202
5202
|
}
|
|
5203
|
-
})))), e > 2 * this.animFrameDur && (e = 2 * this.animFrameDur), (this.viewName !== "full" || this.isAvatarOnly) && (n = this.mtRandomized[Math.floor(Math.random() * this.mtRandomized.length)], o = this.mtAvatar[n], o.needsUpdate || Object.assign(o, { base: (this.mood.baseline[n] || 0) + (1 + a / 255) * Math.random() / 5, needsUpdate: !0 })), this.updatePoseBase(this.animClock), this.mixer && this.mixer.update(e / 1e3 * this.mixer.timeScale), this.updatePoseDelta(), this.applyShoulderAdjustmentToBones(), (this.isSpeaking || this.isListening) && c ? a > this.volumeMax ? (this.volumeHeadBase = 0.05, Math.random() > 0.6 && (this.volumeHeadTarget = -0.05 - Math.random() / 15), this.volumeMax = a) : (this.volumeMax *= 0.92, this.volumeHeadTarget = this.volumeHeadBase - 0.9 * (this.volumeHeadBase - this.volumeHeadTarget)) : (this.volumeHeadTarget = 0, this.volumeMax = 0), n = this.volumeHeadTarget - this.volumeHeadCurrent, o = Math.abs(n), o > 1e-4 && (i = o * (this.volumeHeadEasing(Math.min(1, this.volumeHeadVelocity * e / 1e3 / o) / 2 + 0.5) - 0.5), this.volumeHeadCurrent += Math.sign(n) * Math.min(o, i)), Math.abs(this.volumeHeadCurrent) > 1e-4 && (
|
|
5203
|
+
})))), e > 2 * this.animFrameDur && (e = 2 * this.animFrameDur), (this.viewName !== "full" || this.isAvatarOnly) && (n = this.mtRandomized[Math.floor(Math.random() * this.mtRandomized.length)], o = this.mtAvatar[n], o.needsUpdate || Object.assign(o, { base: (this.mood.baseline[n] || 0) + (1 + a / 255) * Math.random() / 5, needsUpdate: !0 })), this.updatePoseBase(this.animClock), this.mixer && this.mixer.update(e / 1e3 * this.mixer.timeScale), this.updatePoseDelta(), this.applyShoulderAdjustmentToBones(), (this.isSpeaking || this.isListening) && c ? a > this.volumeMax ? (this.volumeHeadBase = 0.05, Math.random() > 0.6 && (this.volumeHeadTarget = -0.05 - Math.random() / 15), this.volumeMax = a) : (this.volumeMax *= 0.92, this.volumeHeadTarget = this.volumeHeadBase - 0.9 * (this.volumeHeadBase - this.volumeHeadTarget)) : (this.volumeHeadTarget = 0, this.volumeMax = 0), n = this.volumeHeadTarget - this.volumeHeadCurrent, o = Math.abs(n), o > 1e-4 && (i = o * (this.volumeHeadEasing(Math.min(1, this.volumeHeadVelocity * e / 1e3 / o) / 2 + 0.5) - 0.5), this.volumeHeadCurrent += Math.sign(n) * Math.min(o, i)), Math.abs(this.volumeHeadCurrent) > 1e-4 && (ie.setFromAxisAngle(St, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(ie)), Je.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(Te), Te.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(Ee), Ee.sub(this.armature.position), this.objectHips.position.y -= Je.min.y / 2, this.objectHips.position.x -= (Te.x + Ee.x) / 4, this.objectHips.position.z -= (Te.z + Ee.z) / 2, this.dynamicbones.update(e), this.fbxAnimationLoader && this.fbxAnimationLoader.update(), this.opt.update && this.opt.update(e), this.updateMorphTargets(e), this.isAvatarOnly)
|
|
5204
5204
|
this.stats && this.stats.end();
|
|
5205
5205
|
else {
|
|
5206
5206
|
if (this.cameraClock !== null && this.cameraClock < 1e3) {
|
|
@@ -5231,8 +5231,8 @@ class Ze {
|
|
|
5231
5231
|
if (!this.lipsync.hasOwnProperty(t)) {
|
|
5232
5232
|
const n = t.toLowerCase(), o = "Lipsync" + t.charAt(0).toUpperCase() + t.slice(1);
|
|
5233
5233
|
try {
|
|
5234
|
-
const s =
|
|
5235
|
-
s && s[o] ? this.lipsync[t] = new s[o]() : console.warn(`Lip-sync module for ${t} not found. Available modules:`, Object.keys(
|
|
5234
|
+
const s = Ke[n];
|
|
5235
|
+
s && s[o] ? this.lipsync[t] = new s[o]() : console.warn(`Lip-sync module for ${t} not found. Available modules:`, Object.keys(Ke));
|
|
5236
5236
|
} catch (s) {
|
|
5237
5237
|
console.warn(`Failed to load lip-sync module for ${t}:`, s);
|
|
5238
5238
|
}
|
|
@@ -5861,7 +5861,7 @@ class Ze {
|
|
|
5861
5861
|
}
|
|
5862
5862
|
if (!this.workletLoaded)
|
|
5863
5863
|
try {
|
|
5864
|
-
const a = this.audioCtx.audioWorklet.addModule(
|
|
5864
|
+
const a = this.audioCtx.audioWorklet.addModule(Lt.href), c = new Promise(
|
|
5865
5865
|
(l, u) => setTimeout(() => u(new Error("Worklet loading timed out")), 5e3)
|
|
5866
5866
|
);
|
|
5867
5867
|
await Promise.race([a, c]), this.workletLoaded = !0;
|
|
@@ -6099,7 +6099,7 @@ class Ze {
|
|
|
6099
6099
|
*/
|
|
6100
6100
|
lookAtCamera(t) {
|
|
6101
6101
|
let e;
|
|
6102
|
-
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),
|
|
6102
|
+
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), Te.setFromMatrixPosition(this.speakTo.objectLeftEye.matrixWorld), Ee.setFromMatrixPosition(this.speakTo.objectRightEye.matrixWorld), e.addVectors(Te, Ee).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) {
|
|
6103
6103
|
if (this.avatar.hasOwnProperty("avatarIgnoreCamera")) {
|
|
6104
6104
|
if (this.avatar.avatarIgnoreCamera) {
|
|
6105
6105
|
this.lookAhead(t);
|
|
@@ -6112,12 +6112,12 @@ class Ze {
|
|
|
6112
6112
|
this.lookAt(null, null, t);
|
|
6113
6113
|
return;
|
|
6114
6114
|
}
|
|
6115
|
-
this.objectLeftEye.updateMatrixWorld(!0), this.objectRightEye.updateMatrixWorld(!0),
|
|
6116
|
-
const n = new f.Vector3().subVectors(e,
|
|
6117
|
-
|
|
6118
|
-
const a = new f.Quaternion().setFromEuler(
|
|
6119
|
-
|
|
6120
|
-
let l =
|
|
6115
|
+
this.objectLeftEye.updateMatrixWorld(!0), this.objectRightEye.updateMatrixWorld(!0), Te.setFromMatrixPosition(this.objectLeftEye.matrixWorld), Ee.setFromMatrixPosition(this.objectRightEye.matrixWorld), Te.add(Ee).divideScalar(2), ie.copy(this.armature.quaternion), ie.multiply(this.poseTarget.props["Hips.quaternion"]), ie.multiply(this.poseTarget.props["Spine.quaternion"]), ie.multiply(this.poseTarget.props["Spine1.quaternion"]), ie.multiply(this.poseTarget.props["Spine2.quaternion"]), ie.multiply(this.poseTarget.props["Neck.quaternion"]), ie.multiply(this.poseTarget.props["Head.quaternion"]);
|
|
6116
|
+
const n = new f.Vector3().subVectors(e, Te).normalize(), o = Math.atan2(n.x, n.z), s = Math.asin(-n.y);
|
|
6117
|
+
q.set(s, o, 0, "YXZ");
|
|
6118
|
+
const a = new f.Quaternion().setFromEuler(q), c = new f.Quaternion().copy(a).multiply(ie.clone().invert());
|
|
6119
|
+
q.setFromQuaternion(c, "YXZ");
|
|
6120
|
+
let l = q.x / (40 / 24) + 0.2, u = q.y / (9 / 4), r = Math.min(0.6, Math.max(-0.3, l)), d = Math.min(0.8, Math.max(-0.8, u)), h = (Math.random() - 0.5) / 4, g = (Math.random() - 0.5) / 4;
|
|
6121
6121
|
if (t) {
|
|
6122
6122
|
let R = this.animQueue.findIndex((L) => L.template.name === "lookat");
|
|
6123
6123
|
R !== -1 && this.animQueue.splice(R, 1);
|
|
@@ -6152,8 +6152,8 @@ class Ze {
|
|
|
6152
6152
|
const s = new f.Vector3().setFromMatrixPosition(this.objectLeftEye.matrixWorld), i = new f.Vector3().setFromMatrixPosition(this.objectRightEye.matrixWorld), a = new f.Vector3().addVectors(s, i).divideScalar(2);
|
|
6153
6153
|
a.project(this.camera);
|
|
6154
6154
|
let c = (a.x + 1) / 2 * o.width + o.left, l = -(a.y - 1) / 2 * o.height + o.top;
|
|
6155
|
-
t === null && (t = c), e === null && (e = l),
|
|
6156
|
-
let u =
|
|
6155
|
+
t === null && (t = c), e === null && (e = l), ie.copy(this.armature.quaternion), ie.multiply(this.poseTarget.props["Hips.quaternion"]), ie.multiply(this.poseTarget.props["Spine.quaternion"]), ie.multiply(this.poseTarget.props["Spine1.quaternion"]), ie.multiply(this.poseTarget.props["Spine2.quaternion"]), ie.multiply(this.poseTarget.props["Neck.quaternion"]), ie.multiply(this.poseTarget.props["Head.quaternion"]), q.setFromQuaternion(ie);
|
|
6156
|
+
let u = q.x / (40 / 24), r = q.y / (9 / 4), d = Math.min(0.4, Math.max(-0.4, this.camera.rotation.x)), h = Math.min(0.4, Math.max(-0.4, this.camera.rotation.y)), g = Math.max(window.innerWidth - c, c), R = Math.max(window.innerHeight - l, l), b = this.convertRange(e, [l - R, l + R], [-0.3, 0.6]) - u + d, L = this.convertRange(t, [c - g, c + g], [-0.8, 0.8]) - r + h;
|
|
6157
6157
|
b = Math.min(0.6, Math.max(-0.3, b)), L = Math.min(0.8, Math.max(-0.8, L));
|
|
6158
6158
|
let T = (Math.random() - 0.5) / 4, p = (Math.random() - 0.5) / 4;
|
|
6159
6159
|
if (n) {
|
|
@@ -6384,7 +6384,7 @@ class Ze {
|
|
|
6384
6384
|
} catch (h) {
|
|
6385
6385
|
console.warn(`Could not verify file existence for ${t}, attempting to load anyway:`, h);
|
|
6386
6386
|
}
|
|
6387
|
-
const r = new
|
|
6387
|
+
const r = new qe();
|
|
6388
6388
|
let d;
|
|
6389
6389
|
try {
|
|
6390
6390
|
d = await r.loadAsync(t, e);
|
|
@@ -6510,8 +6510,8 @@ class Ze {
|
|
|
6510
6510
|
const x = y.name.replaceAll("mixamorig", "").split("."), S = x[0], H = x[1], I = b(S);
|
|
6511
6511
|
if (!(I && (I === "LeftShoulder" || I === "RightShoulder") && (H === "quaternion" || H === "rotation")))
|
|
6512
6512
|
if (I && H) {
|
|
6513
|
-
const
|
|
6514
|
-
|
|
6513
|
+
const U = `${I}.${H}`, G = y.clone();
|
|
6514
|
+
G.name = U, T.push(G), S !== I && R.set(S, I);
|
|
6515
6515
|
} else
|
|
6516
6516
|
p.add(S), (S.toLowerCase().includes("arm") || S.toLowerCase().includes("hand") || S.toLowerCase().includes("shoulder")) && console.warn(`⚠️ Arm bone "${S}" could not be mapped to avatar skeleton`);
|
|
6517
6517
|
}), T.length > 0 ? h = new f.AnimationClip(h.name, h.duration, T) : console.error("No tracks could be mapped! Animation may not work correctly.");
|
|
@@ -6567,7 +6567,7 @@ class Ze {
|
|
|
6567
6567
|
let a = this.animQueue.find((c) => c.template.name === "pose");
|
|
6568
6568
|
a && (a.ts[0] = this.animClock + n * 1e3 + 2e3), this.setPoseFromTemplate(i);
|
|
6569
6569
|
} else {
|
|
6570
|
-
let c = await new
|
|
6570
|
+
let c = await new qe().loadAsync(t, e);
|
|
6571
6571
|
if (c && c.animations && c.animations[o]) {
|
|
6572
6572
|
let l = c.animations[o];
|
|
6573
6573
|
const u = {};
|
|
@@ -6669,7 +6669,7 @@ class Ze {
|
|
|
6669
6669
|
const E = R[p].bone;
|
|
6670
6670
|
E.matrixWorld.decompose(c, l, u), l.invert(), i.setFromMatrixPosition(g.matrixWorld), a.subVectors(i, c), a.applyQuaternion(l), a.normalize(), s.subVectors(e, c), s.applyQuaternion(l), s.normalize();
|
|
6671
6671
|
let y = s.dot(a);
|
|
6672
|
-
y > 1 ? y = 1 : y < -1 && (y = -1), y = Math.acos(y), !(y < 1e-5) && (R[p].minAngle !== void 0 && y < R[p].minAngle && (y = R[p].minAngle), R[p].maxAngle !== void 0 && y > R[p].maxAngle && (y = R[p].maxAngle), r.crossVectors(a, s), r.normalize(),
|
|
6672
|
+
y > 1 ? y = 1 : y < -1 && (y = -1), y = Math.acos(y), !(y < 1e-5) && (R[p].minAngle !== void 0 && y < R[p].minAngle && (y = R[p].minAngle), R[p].maxAngle !== void 0 && y > R[p].maxAngle && (y = R[p].maxAngle), r.crossVectors(a, s), r.normalize(), ie.setFromAxisAngle(r, y), E.quaternion.multiply(ie), E.rotation.setFromVector3(d.setFromEuler(E.rotation).clamp(new f.Vector3(
|
|
6673
6673
|
R[p].minx !== void 0 ? R[p].minx : -1 / 0,
|
|
6674
6674
|
R[p].miny !== void 0 ? R[p].miny : -1 / 0,
|
|
6675
6675
|
R[p].minz !== void 0 ? R[p].minz : -1 / 0
|
|
@@ -6692,7 +6692,7 @@ class Ze {
|
|
|
6692
6692
|
this.isRunning = !1, this.stop(), this.stopSpeaking(), this.streamStop(), this.isAvatarOnly ? this.armature && (this.armature.parent && this.armature.parent.remove(this.armature), this.clearThree(this.armature)) : (this.clearThree(this.scene), this.resizeobserver.disconnect(), this.renderer && (this.renderer.dispose(), this.renderer.domElement && this.renderer.domElement.parentNode && this.renderer.domElement.parentNode.removeChild(this.renderer.domElement), this.renderer = null)), this.clearThree(this.ikMesh), this.dynamicbones.dispose();
|
|
6693
6693
|
}
|
|
6694
6694
|
}
|
|
6695
|
-
const
|
|
6695
|
+
const Pe = {
|
|
6696
6696
|
apiKey: "sk_ace57ef3ef65a92b9d3bee2a00183b78ca790bc3e10964f2",
|
|
6697
6697
|
// Replace with your actual API key (should start with sk_)
|
|
6698
6698
|
endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
|
|
@@ -6712,7 +6712,7 @@ const ze = {
|
|
|
6712
6712
|
josh: "VR6AewLTigWG4xSOukaG"
|
|
6713
6713
|
// Male, American
|
|
6714
6714
|
}
|
|
6715
|
-
},
|
|
6715
|
+
}, Ge = {
|
|
6716
6716
|
defaultVoice: "aura-2-thalia-en",
|
|
6717
6717
|
// Thalia (Female, English)
|
|
6718
6718
|
voices: {
|
|
@@ -6732,26 +6732,26 @@ const ze = {
|
|
|
6732
6732
|
// Male, English - Powerful
|
|
6733
6733
|
}
|
|
6734
6734
|
};
|
|
6735
|
-
function
|
|
6735
|
+
function je() {
|
|
6736
6736
|
return {
|
|
6737
6737
|
service: "elevenlabs",
|
|
6738
|
-
endpoint:
|
|
6739
|
-
apiKey:
|
|
6740
|
-
defaultVoice:
|
|
6741
|
-
voices:
|
|
6738
|
+
endpoint: Pe.endpoint,
|
|
6739
|
+
apiKey: Pe.apiKey,
|
|
6740
|
+
defaultVoice: Pe.defaultVoice,
|
|
6741
|
+
voices: Pe.voices
|
|
6742
6742
|
};
|
|
6743
6743
|
}
|
|
6744
|
-
function
|
|
6745
|
-
const
|
|
6746
|
-
return Object.entries(
|
|
6744
|
+
function Nt() {
|
|
6745
|
+
const V = je(), t = [];
|
|
6746
|
+
return Object.entries(V.voices).forEach(([e, n]) => {
|
|
6747
6747
|
t.push({
|
|
6748
6748
|
value: n,
|
|
6749
|
-
label: `${e.charAt(0).toUpperCase() + e.slice(1)} (${
|
|
6749
|
+
label: `${e.charAt(0).toUpperCase() + e.slice(1)} (${V.service})`
|
|
6750
6750
|
});
|
|
6751
6751
|
}), t;
|
|
6752
6752
|
}
|
|
6753
|
-
const
|
|
6754
|
-
avatarUrl:
|
|
6753
|
+
const et = Ze(({
|
|
6754
|
+
avatarUrl: V = "/avatars/brunette.glb",
|
|
6755
6755
|
avatarBody: t = "F",
|
|
6756
6756
|
mood: e = "neutral",
|
|
6757
6757
|
ttsLang: n = "en",
|
|
@@ -6772,41 +6772,41 @@ const Ke = Ue(({
|
|
|
6772
6772
|
style: R = {},
|
|
6773
6773
|
animations: b = {}
|
|
6774
6774
|
}, L) => {
|
|
6775
|
-
const T =
|
|
6776
|
-
|
|
6775
|
+
const T = W(null), p = W(null), P = W(l), E = W(null), y = W(null), F = W(!1), x = W({ remainingText: null, originalText: null, options: null }), S = W([]), H = W(0), [I, U] = ae(!0), [G, j] = ae(null), [Y, ue] = ae(!1), [le, ve] = ae(!1);
|
|
6776
|
+
fe(() => {
|
|
6777
6777
|
F.current = le;
|
|
6778
|
-
}, [le]),
|
|
6778
|
+
}, [le]), fe(() => {
|
|
6779
6779
|
P.current = l;
|
|
6780
6780
|
}, [l]);
|
|
6781
|
-
const se =
|
|
6781
|
+
const se = je(), ze = o || se.service;
|
|
6782
6782
|
let ee;
|
|
6783
|
-
|
|
6783
|
+
ze === "browser" ? ee = {
|
|
6784
6784
|
service: "browser",
|
|
6785
6785
|
endpoint: "",
|
|
6786
6786
|
apiKey: null,
|
|
6787
6787
|
defaultVoice: "Google US English"
|
|
6788
|
-
} :
|
|
6788
|
+
} : ze === "elevenlabs" ? ee = {
|
|
6789
6789
|
service: "elevenlabs",
|
|
6790
6790
|
endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
|
|
6791
6791
|
apiKey: i || se.apiKey,
|
|
6792
|
-
defaultVoice: s || se.defaultVoice ||
|
|
6793
|
-
voices: se.voices ||
|
|
6794
|
-
} :
|
|
6792
|
+
defaultVoice: s || se.defaultVoice || Pe.defaultVoice,
|
|
6793
|
+
voices: se.voices || Pe.voices
|
|
6794
|
+
} : ze === "deepgram" ? ee = {
|
|
6795
6795
|
service: "deepgram",
|
|
6796
6796
|
endpoint: "https://api.deepgram.com/v1/speak",
|
|
6797
6797
|
apiKey: i || se.apiKey,
|
|
6798
|
-
defaultVoice: s || se.defaultVoice ||
|
|
6799
|
-
voices: se.voices ||
|
|
6798
|
+
defaultVoice: s || se.defaultVoice || Ge.defaultVoice,
|
|
6799
|
+
voices: se.voices || Ge.voices
|
|
6800
6800
|
} : ee = {
|
|
6801
6801
|
...se,
|
|
6802
6802
|
// Override API key if provided via props
|
|
6803
6803
|
apiKey: i !== null ? i : se.apiKey
|
|
6804
6804
|
};
|
|
6805
6805
|
const v = {
|
|
6806
|
-
url:
|
|
6806
|
+
url: V,
|
|
6807
6807
|
body: t,
|
|
6808
6808
|
avatarMood: e,
|
|
6809
|
-
ttsLang:
|
|
6809
|
+
ttsLang: ze === "browser" ? "en-US" : n,
|
|
6810
6810
|
ttsVoice: s || ee.defaultVoice,
|
|
6811
6811
|
lipsyncLang: "en",
|
|
6812
6812
|
showFullAvatar: l,
|
|
@@ -6815,233 +6815,233 @@ const Ke = Ue(({
|
|
|
6815
6815
|
}, A = {
|
|
6816
6816
|
ttsEndpoint: ee.endpoint,
|
|
6817
6817
|
ttsApikey: ee.apiKey,
|
|
6818
|
-
ttsService:
|
|
6818
|
+
ttsService: ze,
|
|
6819
6819
|
lipsyncModules: ["en"],
|
|
6820
6820
|
cameraView: u
|
|
6821
|
-
}, M =
|
|
6821
|
+
}, M = D(async () => {
|
|
6822
6822
|
if (!(!T.current || p.current))
|
|
6823
6823
|
try {
|
|
6824
|
-
if (
|
|
6825
|
-
if (
|
|
6826
|
-
const
|
|
6827
|
-
d(
|
|
6824
|
+
if (U(!0), j(null), p.current = new Qe(T.current, A), p.current.controls && (p.current.controls.enableRotate = !1, p.current.controls.enableZoom = !1, p.current.controls.enablePan = !1, p.current.controls.enableDamping = !1), b && Object.keys(b).length > 0 && (p.current.customAnimations = b), await p.current.showAvatar(v, (Q) => {
|
|
6825
|
+
if (Q.lengthComputable) {
|
|
6826
|
+
const oe = Math.min(100, Math.round(Q.loaded / Q.total * 100));
|
|
6827
|
+
d(oe);
|
|
6828
6828
|
}
|
|
6829
|
-
}), await new Promise((
|
|
6830
|
-
const
|
|
6831
|
-
p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ?
|
|
6829
|
+
}), await new Promise((Q) => {
|
|
6830
|
+
const oe = () => {
|
|
6831
|
+
p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? Q() : setTimeout(oe, 100);
|
|
6832
6832
|
};
|
|
6833
|
-
|
|
6833
|
+
oe();
|
|
6834
6834
|
}), p.current && p.current.setShowFullAvatar)
|
|
6835
6835
|
try {
|
|
6836
6836
|
p.current.setShowFullAvatar(l);
|
|
6837
|
-
} catch (
|
|
6838
|
-
console.warn("Error setting full body mode on initialization:",
|
|
6837
|
+
} catch (Q) {
|
|
6838
|
+
console.warn("Error setting full body mode on initialization:", Q);
|
|
6839
6839
|
}
|
|
6840
|
-
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()),
|
|
6840
|
+
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()), U(!1), ue(!0), r(p.current);
|
|
6841
6841
|
const X = () => {
|
|
6842
6842
|
document.visibilityState === "visible" ? p.current?.start() : p.current?.stop();
|
|
6843
6843
|
};
|
|
6844
6844
|
return document.addEventListener("visibilitychange", X), () => {
|
|
6845
6845
|
document.removeEventListener("visibilitychange", X);
|
|
6846
6846
|
};
|
|
6847
|
-
} catch (
|
|
6848
|
-
console.error("Error initializing TalkingHead:",
|
|
6847
|
+
} catch (w) {
|
|
6848
|
+
console.error("Error initializing TalkingHead:", w), j(w.message || "Failed to initialize avatar"), U(!1), h(w);
|
|
6849
6849
|
}
|
|
6850
|
-
}, [
|
|
6851
|
-
|
|
6850
|
+
}, [V, t, e, n, o, s, i, l, a, c, u]);
|
|
6851
|
+
fe(() => (M(), () => {
|
|
6852
6852
|
p.current && (p.current.stop(), p.current.dispose(), p.current = null);
|
|
6853
|
-
}), [M]),
|
|
6853
|
+
}), [M]), fe(() => {
|
|
6854
6854
|
if (!T.current || !p.current) return;
|
|
6855
|
-
const
|
|
6856
|
-
for (const
|
|
6855
|
+
const w = new ResizeObserver((Q) => {
|
|
6856
|
+
for (const oe of Q)
|
|
6857
6857
|
p.current && p.current.onResize && p.current.onResize();
|
|
6858
6858
|
});
|
|
6859
|
-
|
|
6859
|
+
w.observe(T.current);
|
|
6860
6860
|
const X = () => {
|
|
6861
6861
|
p.current && p.current.onResize && p.current.onResize();
|
|
6862
6862
|
};
|
|
6863
6863
|
return window.addEventListener("resize", X), () => {
|
|
6864
|
-
|
|
6864
|
+
w.disconnect(), window.removeEventListener("resize", X);
|
|
6865
6865
|
};
|
|
6866
6866
|
}, [Y]);
|
|
6867
|
-
const B =
|
|
6867
|
+
const B = D(async () => {
|
|
6868
6868
|
if (p.current && p.current.audioCtx)
|
|
6869
6869
|
try {
|
|
6870
6870
|
(p.current.audioCtx.state === "suspended" || p.current.audioCtx.state === "interrupted") && (await p.current.audioCtx.resume(), console.log("Audio context resumed"));
|
|
6871
|
-
} catch (
|
|
6872
|
-
console.warn("Failed to resume audio context:",
|
|
6871
|
+
} catch (w) {
|
|
6872
|
+
console.warn("Failed to resume audio context:", w);
|
|
6873
6873
|
}
|
|
6874
|
-
}, []), Z =
|
|
6874
|
+
}, []), Z = D(async (w, X = {}) => {
|
|
6875
6875
|
if (p.current && Y)
|
|
6876
6876
|
try {
|
|
6877
|
-
y.current && (clearInterval(y.current), y.current = null), E.current = { text:
|
|
6878
|
-
const
|
|
6879
|
-
S.current =
|
|
6880
|
-
const
|
|
6877
|
+
y.current && (clearInterval(y.current), y.current = null), E.current = { text: w, options: X }, x.current = { remainingText: null, originalText: null, options: null };
|
|
6878
|
+
const Q = /[!\.\?\n\p{Extended_Pictographic}]/ug, oe = w.split(Q).map((_) => _.trim()).filter((_) => _.length > 0);
|
|
6879
|
+
S.current = oe, H.current = 0, ve(!1), F.current = !1, await B();
|
|
6880
|
+
const xe = {
|
|
6881
6881
|
...X,
|
|
6882
6882
|
lipsyncLang: X.lipsyncLang || v.lipsyncLang || "en"
|
|
6883
6883
|
};
|
|
6884
6884
|
if (X.onSpeechEnd && p.current) {
|
|
6885
|
-
const
|
|
6886
|
-
let pe = null,
|
|
6887
|
-
const
|
|
6888
|
-
let
|
|
6885
|
+
const _ = p.current;
|
|
6886
|
+
let pe = null, Ie = 0;
|
|
6887
|
+
const be = 1200;
|
|
6888
|
+
let Le = !1;
|
|
6889
6889
|
pe = setInterval(() => {
|
|
6890
|
-
if (
|
|
6890
|
+
if (Ie++, F.current)
|
|
6891
6891
|
return;
|
|
6892
|
-
if (
|
|
6893
|
-
if (pe && (clearInterval(pe), pe = null, y.current = null), !
|
|
6894
|
-
|
|
6892
|
+
if (Ie > be) {
|
|
6893
|
+
if (pe && (clearInterval(pe), pe = null, y.current = null), !Le && !F.current) {
|
|
6894
|
+
Le = !0;
|
|
6895
6895
|
try {
|
|
6896
6896
|
X.onSpeechEnd();
|
|
6897
|
-
} catch (
|
|
6898
|
-
console.error("Error in onSpeechEnd callback (timeout):",
|
|
6897
|
+
} catch (C) {
|
|
6898
|
+
console.error("Error in onSpeechEnd callback (timeout):", C);
|
|
6899
6899
|
}
|
|
6900
6900
|
}
|
|
6901
6901
|
return;
|
|
6902
6902
|
}
|
|
6903
|
-
const
|
|
6904
|
-
|
|
6905
|
-
if (
|
|
6906
|
-
|
|
6903
|
+
const Ae = !_.speechQueue || _.speechQueue.length === 0, Oe = !_.audioPlaylist || _.audioPlaylist.length === 0;
|
|
6904
|
+
_ && _.isSpeaking === !1 && Ae && Oe && _.isAudioPlaying === !1 && !Le && !F.current && setTimeout(() => {
|
|
6905
|
+
if (_ && !F.current && _.isSpeaking === !1 && (!_.speechQueue || _.speechQueue.length === 0) && (!_.audioPlaylist || _.audioPlaylist.length === 0) && _.isAudioPlaying === !1 && !Le && !F.current) {
|
|
6906
|
+
Le = !0, pe && (clearInterval(pe), pe = null, y.current = null);
|
|
6907
6907
|
try {
|
|
6908
6908
|
X.onSpeechEnd();
|
|
6909
|
-
} catch (
|
|
6910
|
-
console.error("Error in onSpeechEnd callback:",
|
|
6909
|
+
} catch (N) {
|
|
6910
|
+
console.error("Error in onSpeechEnd callback:", N);
|
|
6911
6911
|
}
|
|
6912
6912
|
}
|
|
6913
6913
|
}, 100);
|
|
6914
6914
|
}, 100), y.current = pe;
|
|
6915
6915
|
}
|
|
6916
|
-
p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(
|
|
6917
|
-
await B(), p.current && p.current.lipsync && (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(
|
|
6916
|
+
p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(w, xe)) : setTimeout(async () => {
|
|
6917
|
+
await B(), p.current && p.current.lipsync && (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(w, xe));
|
|
6918
6918
|
}, 100);
|
|
6919
|
-
} catch (
|
|
6920
|
-
console.error("Error speaking text:",
|
|
6919
|
+
} catch (Q) {
|
|
6920
|
+
console.error("Error speaking text:", Q), j(Q.message || "Failed to speak text");
|
|
6921
6921
|
}
|
|
6922
|
-
}, [Y, B, v.lipsyncLang]), re =
|
|
6922
|
+
}, [Y, B, v.lipsyncLang]), re = D(() => {
|
|
6923
6923
|
p.current && (p.current.stopSpeaking(), p.current.setSlowdownRate && p.current.setSlowdownRate(1), E.current = null, ve(!1));
|
|
6924
|
-
}, []),
|
|
6924
|
+
}, []), ne = D(() => {
|
|
6925
6925
|
if (p.current && p.current.pauseSpeaking) {
|
|
6926
|
-
const
|
|
6927
|
-
if (
|
|
6926
|
+
const w = p.current;
|
|
6927
|
+
if (w.isSpeaking || w.audioPlaylist && w.audioPlaylist.length > 0 || w.speechQueue && w.speechQueue.length > 0) {
|
|
6928
6928
|
y.current && (clearInterval(y.current), y.current = null);
|
|
6929
|
-
let
|
|
6929
|
+
let Q = "";
|
|
6930
6930
|
if (E.current && S.current.length > 0) {
|
|
6931
|
-
const
|
|
6932
|
-
if (pe > 0 &&
|
|
6933
|
-
const
|
|
6934
|
-
|
|
6931
|
+
const oe = S.current.length, xe = w.speechQueue ? w.speechQueue.filter((be) => be && be.text && Array.isArray(be.text) && be.text.length > 0).length : 0, _ = w.audioPlaylist && w.audioPlaylist.length > 0, pe = xe + (_ ? 1 : 0), Ie = oe - pe;
|
|
6932
|
+
if (pe > 0 && Ie < oe && (Q = S.current.slice(Ie).join(". ").trim(), !Q && xe > 0 && w.speechQueue)) {
|
|
6933
|
+
const Le = w.speechQueue.filter((Ae) => Ae && Ae.text && Array.isArray(Ae.text) && Ae.text.length > 0).map((Ae) => Ae.text.map((Oe) => Oe.word || "").filter((Oe) => Oe.length > 0).join(" ")).filter((Ae) => Ae.length > 0).join(" ");
|
|
6934
|
+
Le && Le.trim() && (Q = Le.trim());
|
|
6935
6935
|
}
|
|
6936
6936
|
}
|
|
6937
6937
|
E.current && (x.current = {
|
|
6938
|
-
remainingText:
|
|
6938
|
+
remainingText: Q || null,
|
|
6939
6939
|
originalText: E.current.text,
|
|
6940
6940
|
options: E.current.options
|
|
6941
|
-
}),
|
|
6941
|
+
}), w.speechQueue && (w.speechQueue.length = 0), p.current.pauseSpeaking(), F.current = !0, ve(!0);
|
|
6942
6942
|
}
|
|
6943
6943
|
}
|
|
6944
|
-
}, []),
|
|
6944
|
+
}, []), J = D(async () => {
|
|
6945
6945
|
if (!p.current || !le)
|
|
6946
6946
|
return;
|
|
6947
|
-
let
|
|
6947
|
+
let w = "", X = {};
|
|
6948
6948
|
if (x.current && x.current.remainingText)
|
|
6949
|
-
|
|
6949
|
+
w = x.current.remainingText, X = x.current.options || {}, x.current = { remainingText: null, originalText: null, options: null };
|
|
6950
6950
|
else if (E.current && E.current.text)
|
|
6951
|
-
|
|
6951
|
+
w = E.current.text, X = E.current.options || {};
|
|
6952
6952
|
else {
|
|
6953
6953
|
console.warn("Resume called but no paused speech found"), ve(!1), F.current = !1;
|
|
6954
6954
|
return;
|
|
6955
6955
|
}
|
|
6956
6956
|
ve(!1), F.current = !1, await B();
|
|
6957
|
-
const
|
|
6957
|
+
const Q = {
|
|
6958
6958
|
...X,
|
|
6959
6959
|
lipsyncLang: X.lipsyncLang || v.lipsyncLang || "en"
|
|
6960
6960
|
};
|
|
6961
6961
|
try {
|
|
6962
|
-
await Z(
|
|
6963
|
-
} catch (
|
|
6964
|
-
console.error("Error resuming speech:",
|
|
6962
|
+
await Z(w, Q);
|
|
6963
|
+
} catch (oe) {
|
|
6964
|
+
console.error("Error resuming speech:", oe), ve(!1), F.current = !1;
|
|
6965
6965
|
}
|
|
6966
|
-
}, [B, le, Z, v]),
|
|
6967
|
-
p.current && p.current.setMood(
|
|
6968
|
-
}, []),
|
|
6969
|
-
p.current && p.current.setSlowdownRate && p.current.setSlowdownRate(
|
|
6970
|
-
}, []),
|
|
6966
|
+
}, [B, le, Z, v]), me = D((w) => {
|
|
6967
|
+
p.current && p.current.setMood(w);
|
|
6968
|
+
}, []), Me = D((w) => {
|
|
6969
|
+
p.current && p.current.setSlowdownRate && p.current.setSlowdownRate(w);
|
|
6970
|
+
}, []), He = D((w, X = !1) => {
|
|
6971
6971
|
if (p.current && p.current.playAnimation) {
|
|
6972
|
-
if (b && b[
|
|
6972
|
+
if (b && b[w] && (w = b[w]), p.current.setShowFullAvatar)
|
|
6973
6973
|
try {
|
|
6974
6974
|
p.current.setShowFullAvatar(P.current);
|
|
6975
|
-
} catch (
|
|
6976
|
-
console.warn("Error setting full body mode:",
|
|
6975
|
+
} catch (oe) {
|
|
6976
|
+
console.warn("Error setting full body mode:", oe);
|
|
6977
6977
|
}
|
|
6978
|
-
if (
|
|
6978
|
+
if (w.includes("."))
|
|
6979
6979
|
try {
|
|
6980
|
-
p.current.playAnimation(
|
|
6981
|
-
} catch (
|
|
6982
|
-
console.warn(`Failed to play ${
|
|
6980
|
+
p.current.playAnimation(w, null, 10, 0, 0.01, X);
|
|
6981
|
+
} catch (oe) {
|
|
6982
|
+
console.warn(`Failed to play ${w}:`, oe);
|
|
6983
6983
|
try {
|
|
6984
6984
|
p.current.setBodyMovement("idle");
|
|
6985
|
-
} catch (
|
|
6986
|
-
console.warn("Fallback animation also failed:",
|
|
6985
|
+
} catch (xe) {
|
|
6986
|
+
console.warn("Fallback animation also failed:", xe);
|
|
6987
6987
|
}
|
|
6988
6988
|
}
|
|
6989
6989
|
else {
|
|
6990
|
-
const
|
|
6991
|
-
let
|
|
6992
|
-
for (const
|
|
6990
|
+
const oe = [".fbx", ".glb", ".gltf"];
|
|
6991
|
+
let xe = !1;
|
|
6992
|
+
for (const _ of oe)
|
|
6993
6993
|
try {
|
|
6994
|
-
p.current.playAnimation(
|
|
6994
|
+
p.current.playAnimation(w + _, null, 10, 0, 0.01, X), xe = !0;
|
|
6995
6995
|
break;
|
|
6996
6996
|
} catch {
|
|
6997
6997
|
}
|
|
6998
|
-
if (!
|
|
6999
|
-
console.warn("Animation not found:",
|
|
6998
|
+
if (!xe) {
|
|
6999
|
+
console.warn("Animation not found:", w);
|
|
7000
7000
|
try {
|
|
7001
7001
|
p.current.setBodyMovement("idle");
|
|
7002
|
-
} catch (
|
|
7003
|
-
console.warn("Fallback animation also failed:",
|
|
7002
|
+
} catch (_) {
|
|
7003
|
+
console.warn("Fallback animation also failed:", _);
|
|
7004
7004
|
}
|
|
7005
7005
|
}
|
|
7006
7006
|
}
|
|
7007
7007
|
}
|
|
7008
|
-
}, [b]),
|
|
7008
|
+
}, [b]), Ye = D(() => {
|
|
7009
7009
|
p.current && p.current.onResize && p.current.onResize();
|
|
7010
7010
|
}, []);
|
|
7011
|
-
return
|
|
7011
|
+
return Xe(L, () => ({
|
|
7012
7012
|
speakText: Z,
|
|
7013
7013
|
stopSpeaking: re,
|
|
7014
|
-
pauseSpeaking:
|
|
7015
|
-
resumeSpeaking:
|
|
7014
|
+
pauseSpeaking: ne,
|
|
7015
|
+
resumeSpeaking: J,
|
|
7016
7016
|
resumeAudioContext: B,
|
|
7017
|
-
setMood:
|
|
7018
|
-
setTimingAdjustment:
|
|
7019
|
-
playAnimation:
|
|
7017
|
+
setMood: me,
|
|
7018
|
+
setTimingAdjustment: Me,
|
|
7019
|
+
playAnimation: He,
|
|
7020
7020
|
isReady: Y,
|
|
7021
7021
|
isPaused: le,
|
|
7022
7022
|
talkingHead: p.current,
|
|
7023
|
-
handleResize:
|
|
7024
|
-
setBodyMovement: (
|
|
7023
|
+
handleResize: Ye,
|
|
7024
|
+
setBodyMovement: (w) => {
|
|
7025
7025
|
if (p.current && p.current.setShowFullAvatar && p.current.setBodyMovement)
|
|
7026
7026
|
try {
|
|
7027
|
-
p.current.setShowFullAvatar(P.current), p.current.setBodyMovement(
|
|
7027
|
+
p.current.setShowFullAvatar(P.current), p.current.setBodyMovement(w);
|
|
7028
7028
|
} catch (X) {
|
|
7029
7029
|
console.warn("Error setting body movement:", X);
|
|
7030
7030
|
}
|
|
7031
7031
|
},
|
|
7032
|
-
setMovementIntensity: (
|
|
7032
|
+
setMovementIntensity: (w) => p.current?.setMovementIntensity(w),
|
|
7033
7033
|
playRandomDance: () => {
|
|
7034
7034
|
if (p.current && p.current.setShowFullAvatar && p.current.playRandomDance)
|
|
7035
7035
|
try {
|
|
7036
7036
|
p.current.setShowFullAvatar(P.current), p.current.playRandomDance();
|
|
7037
|
-
} catch (
|
|
7038
|
-
console.warn("Error playing random dance:",
|
|
7037
|
+
} catch (w) {
|
|
7038
|
+
console.warn("Error playing random dance:", w);
|
|
7039
7039
|
}
|
|
7040
7040
|
},
|
|
7041
|
-
playReaction: (
|
|
7041
|
+
playReaction: (w) => {
|
|
7042
7042
|
if (p.current && p.current.setShowFullAvatar && p.current.playReaction)
|
|
7043
7043
|
try {
|
|
7044
|
-
p.current.setShowFullAvatar(P.current), p.current.playReaction(
|
|
7044
|
+
p.current.setShowFullAvatar(P.current), p.current.playReaction(w);
|
|
7045
7045
|
} catch (X) {
|
|
7046
7046
|
console.warn("Error playing reaction:", X);
|
|
7047
7047
|
}
|
|
@@ -7050,14 +7050,14 @@ const Ke = Ue(({
|
|
|
7050
7050
|
if (p.current && p.current.setShowFullAvatar && p.current.playCelebration)
|
|
7051
7051
|
try {
|
|
7052
7052
|
p.current.setShowFullAvatar(P.current), p.current.playCelebration();
|
|
7053
|
-
} catch (
|
|
7054
|
-
console.warn("Error playing celebration:",
|
|
7053
|
+
} catch (w) {
|
|
7054
|
+
console.warn("Error playing celebration:", w);
|
|
7055
7055
|
}
|
|
7056
7056
|
},
|
|
7057
|
-
setShowFullAvatar: (
|
|
7057
|
+
setShowFullAvatar: (w) => {
|
|
7058
7058
|
if (p.current && p.current.setShowFullAvatar)
|
|
7059
7059
|
try {
|
|
7060
|
-
P.current =
|
|
7060
|
+
P.current = w, p.current.setShowFullAvatar(w);
|
|
7061
7061
|
} catch (X) {
|
|
7062
7062
|
console.warn("Error setting showFullAvatar:", X);
|
|
7063
7063
|
}
|
|
@@ -7066,19 +7066,19 @@ const Ke = Ue(({
|
|
|
7066
7066
|
if (p.current && p.current.lockAvatarPosition)
|
|
7067
7067
|
try {
|
|
7068
7068
|
p.current.lockAvatarPosition();
|
|
7069
|
-
} catch (
|
|
7070
|
-
console.warn("Error locking avatar position:",
|
|
7069
|
+
} catch (w) {
|
|
7070
|
+
console.warn("Error locking avatar position:", w);
|
|
7071
7071
|
}
|
|
7072
7072
|
},
|
|
7073
7073
|
unlockAvatarPosition: () => {
|
|
7074
7074
|
if (p.current && p.current.unlockAvatarPosition)
|
|
7075
7075
|
try {
|
|
7076
7076
|
p.current.unlockAvatarPosition();
|
|
7077
|
-
} catch (
|
|
7078
|
-
console.warn("Error unlocking avatar position:",
|
|
7077
|
+
} catch (w) {
|
|
7078
|
+
console.warn("Error unlocking avatar position:", w);
|
|
7079
7079
|
}
|
|
7080
7080
|
}
|
|
7081
|
-
})), /* @__PURE__ */
|
|
7081
|
+
})), /* @__PURE__ */ ke(
|
|
7082
7082
|
"div",
|
|
7083
7083
|
{
|
|
7084
7084
|
className: `talking-head-avatar ${g}`,
|
|
@@ -7110,7 +7110,7 @@ const Ke = Ue(({
|
|
|
7110
7110
|
fontSize: "18px",
|
|
7111
7111
|
zIndex: 10
|
|
7112
7112
|
}, children: "Loading avatar..." }),
|
|
7113
|
-
|
|
7113
|
+
G && /* @__PURE__ */ $("div", { className: "error-overlay", style: {
|
|
7114
7114
|
position: "absolute",
|
|
7115
7115
|
top: "50%",
|
|
7116
7116
|
left: "50%",
|
|
@@ -7121,14 +7121,14 @@ const Ke = Ue(({
|
|
|
7121
7121
|
zIndex: 10,
|
|
7122
7122
|
padding: "20px",
|
|
7123
7123
|
borderRadius: "8px"
|
|
7124
|
-
}, children:
|
|
7124
|
+
}, children: G })
|
|
7125
7125
|
]
|
|
7126
7126
|
}
|
|
7127
7127
|
);
|
|
7128
7128
|
});
|
|
7129
|
-
|
|
7130
|
-
const
|
|
7131
|
-
text:
|
|
7129
|
+
et.displayName = "TalkingHeadAvatar";
|
|
7130
|
+
const kt = Ze(({
|
|
7131
|
+
text: V = "Hello! I'm a talking avatar. How are you today?",
|
|
7132
7132
|
onLoading: t = () => {
|
|
7133
7133
|
},
|
|
7134
7134
|
onError: e = () => {
|
|
@@ -7139,7 +7139,7 @@ const At = Ue(({
|
|
|
7139
7139
|
style: s = {},
|
|
7140
7140
|
avatarConfig: i = {}
|
|
7141
7141
|
}, a) => {
|
|
7142
|
-
const c =
|
|
7142
|
+
const c = W(null), l = W(null), [u, r] = ae(!0), [d, h] = ae(null), [g, R] = ae(!1), b = je(), L = i.ttsService || b.service, T = L === "browser" ? {
|
|
7143
7143
|
endpoint: "",
|
|
7144
7144
|
apiKey: null,
|
|
7145
7145
|
defaultVoice: "Google US English"
|
|
@@ -7169,63 +7169,63 @@ const At = Ue(({
|
|
|
7169
7169
|
ttsService: L,
|
|
7170
7170
|
lipsyncModules: ["en"],
|
|
7171
7171
|
cameraView: "upper"
|
|
7172
|
-
}, E =
|
|
7172
|
+
}, E = D(async () => {
|
|
7173
7173
|
if (!(!c.current || l.current))
|
|
7174
7174
|
try {
|
|
7175
|
-
if (r(!0), h(null), l.current = new
|
|
7176
|
-
if (
|
|
7177
|
-
const j = Math.min(100, Math.round(
|
|
7175
|
+
if (r(!0), h(null), l.current = new Qe(c.current, P), await l.current.showAvatar(p, (G) => {
|
|
7176
|
+
if (G.lengthComputable) {
|
|
7177
|
+
const j = Math.min(100, Math.round(G.loaded / G.total * 100));
|
|
7178
7178
|
t(j);
|
|
7179
7179
|
}
|
|
7180
7180
|
}), l.current.morphs && l.current.morphs.length > 0) {
|
|
7181
|
-
const
|
|
7182
|
-
console.log("Available morph targets:", Object.keys(
|
|
7183
|
-
const j = Object.keys(
|
|
7181
|
+
const G = l.current.morphs[0].morphTargetDictionary;
|
|
7182
|
+
console.log("Available morph targets:", Object.keys(G));
|
|
7183
|
+
const j = Object.keys(G).filter((Y) => Y.startsWith("viseme_"));
|
|
7184
7184
|
console.log("Viseme morph targets found:", j), j.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"));
|
|
7185
7185
|
}
|
|
7186
|
-
if (await new Promise((
|
|
7186
|
+
if (await new Promise((G) => {
|
|
7187
7187
|
const j = () => {
|
|
7188
|
-
l.current.lipsync && Object.keys(l.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(l.current.lipsync)),
|
|
7188
|
+
l.current.lipsync && Object.keys(l.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(l.current.lipsync)), G()) : (console.log("Waiting for lip-sync modules to load..."), setTimeout(j, 100));
|
|
7189
7189
|
};
|
|
7190
7190
|
j();
|
|
7191
7191
|
}), l.current && l.current.setShowFullAvatar)
|
|
7192
7192
|
try {
|
|
7193
7193
|
l.current.setShowFullAvatar(!0), console.log("Avatar initialized in full body mode");
|
|
7194
|
-
} catch (
|
|
7195
|
-
console.warn("Error setting full body mode on initialization:",
|
|
7194
|
+
} catch (G) {
|
|
7195
|
+
console.warn("Error setting full body mode on initialization:", G);
|
|
7196
7196
|
}
|
|
7197
7197
|
r(!1), R(!0), n(l.current);
|
|
7198
|
-
const
|
|
7198
|
+
const U = () => {
|
|
7199
7199
|
document.visibilityState === "visible" ? l.current?.start() : l.current?.stop();
|
|
7200
7200
|
};
|
|
7201
|
-
return document.addEventListener("visibilitychange",
|
|
7202
|
-
document.removeEventListener("visibilitychange",
|
|
7201
|
+
return document.addEventListener("visibilitychange", U), () => {
|
|
7202
|
+
document.removeEventListener("visibilitychange", U);
|
|
7203
7203
|
};
|
|
7204
7204
|
} catch (I) {
|
|
7205
7205
|
console.error("Error initializing TalkingHead:", I), h(I.message || "Failed to initialize avatar"), r(!1), e(I);
|
|
7206
7206
|
}
|
|
7207
7207
|
}, []);
|
|
7208
|
-
|
|
7208
|
+
fe(() => (E(), () => {
|
|
7209
7209
|
l.current && (l.current.stop(), l.current.dispose(), l.current = null);
|
|
7210
7210
|
}), [E]);
|
|
7211
|
-
const y =
|
|
7211
|
+
const y = D((I) => {
|
|
7212
7212
|
if (l.current && g)
|
|
7213
7213
|
try {
|
|
7214
7214
|
console.log("Speaking text:", I), console.log("Avatar config:", p), console.log("TalkingHead instance:", l.current), l.current.lipsync && Object.keys(l.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(l.current.lipsync)), l.current.setSlowdownRate && (l.current.setSlowdownRate(1.05), console.log("Applied timing adjustment for better lip-sync")), l.current.speakText(I)) : (console.warn("Lip-sync modules not ready, waiting..."), setTimeout(() => {
|
|
7215
7215
|
l.current && l.current.lipsync ? (console.log("Lip-sync now ready, speaking..."), l.current.setSlowdownRate && (l.current.setSlowdownRate(1.05), console.log("Applied timing adjustment for better lip-sync")), l.current.speakText(I)) : console.error("Lip-sync still not ready after waiting");
|
|
7216
7216
|
}, 500));
|
|
7217
|
-
} catch (
|
|
7218
|
-
console.error("Error speaking text:",
|
|
7217
|
+
} catch (U) {
|
|
7218
|
+
console.error("Error speaking text:", U), h(U.message || "Failed to speak text");
|
|
7219
7219
|
}
|
|
7220
7220
|
else
|
|
7221
7221
|
console.warn("Avatar not ready for speaking. isReady:", g, "talkingHeadRef:", !!l.current);
|
|
7222
|
-
}, [g, p]), F =
|
|
7222
|
+
}, [g, p]), F = D(() => {
|
|
7223
7223
|
l.current && (l.current.stopSpeaking(), l.current.setSlowdownRate && (l.current.setSlowdownRate(1), console.log("Reset timing to normal")));
|
|
7224
|
-
}, []), x =
|
|
7224
|
+
}, []), x = D((I) => {
|
|
7225
7225
|
l.current && l.current.setMood(I);
|
|
7226
|
-
}, []), S =
|
|
7226
|
+
}, []), S = D((I) => {
|
|
7227
7227
|
l.current && l.current.setSlowdownRate && (l.current.setSlowdownRate(I), console.log("Timing adjustment set to:", I));
|
|
7228
|
-
}, []), H =
|
|
7228
|
+
}, []), H = D((I, U = !1) => {
|
|
7229
7229
|
if (l.current && l.current.playAnimation) {
|
|
7230
7230
|
if (l.current.setShowFullAvatar)
|
|
7231
7231
|
try {
|
|
@@ -7235,7 +7235,7 @@ const At = Ue(({
|
|
|
7235
7235
|
}
|
|
7236
7236
|
if (I.includes("."))
|
|
7237
7237
|
try {
|
|
7238
|
-
l.current.playAnimation(I, null, 10, 0, 0.01,
|
|
7238
|
+
l.current.playAnimation(I, null, 10, 0, 0.01, U), console.log("Playing animation:", I);
|
|
7239
7239
|
} catch (j) {
|
|
7240
7240
|
console.log(`Failed to play ${I}:`, j);
|
|
7241
7241
|
try {
|
|
@@ -7249,7 +7249,7 @@ const At = Ue(({
|
|
|
7249
7249
|
let Y = !1;
|
|
7250
7250
|
for (const ue of j)
|
|
7251
7251
|
try {
|
|
7252
|
-
l.current.playAnimation(I + ue, null, 10, 0, 0.01,
|
|
7252
|
+
l.current.playAnimation(I + ue, null, 10, 0, 0.01, U), console.log("Playing animation:", I + ue), Y = !0;
|
|
7253
7253
|
break;
|
|
7254
7254
|
} catch {
|
|
7255
7255
|
console.log(`Failed to play ${I}${ue}, trying next format...`);
|
|
@@ -7266,7 +7266,7 @@ const At = Ue(({
|
|
|
7266
7266
|
} else
|
|
7267
7267
|
console.warn("Animation system not available or animation not found:", I);
|
|
7268
7268
|
}, []);
|
|
7269
|
-
return
|
|
7269
|
+
return Xe(a, () => ({
|
|
7270
7270
|
speakText: y,
|
|
7271
7271
|
stopSpeaking: F,
|
|
7272
7272
|
setMood: x,
|
|
@@ -7278,8 +7278,8 @@ const At = Ue(({
|
|
|
7278
7278
|
if (l.current && l.current.setShowFullAvatar && l.current.setBodyMovement)
|
|
7279
7279
|
try {
|
|
7280
7280
|
l.current.setShowFullAvatar(!0), l.current.setBodyMovement(I), console.log("Body movement set with full body mode:", I);
|
|
7281
|
-
} catch (
|
|
7282
|
-
console.warn("Error setting body movement:",
|
|
7281
|
+
} catch (U) {
|
|
7282
|
+
console.warn("Error setting body movement:", U);
|
|
7283
7283
|
}
|
|
7284
7284
|
},
|
|
7285
7285
|
setMovementIntensity: (I) => l.current?.setMovementIntensity(I),
|
|
@@ -7295,8 +7295,8 @@ const At = Ue(({
|
|
|
7295
7295
|
if (l.current && l.current.setShowFullAvatar && l.current.playReaction)
|
|
7296
7296
|
try {
|
|
7297
7297
|
l.current.setShowFullAvatar(!0), l.current.playReaction(I), console.log("Reaction played with full body mode:", I);
|
|
7298
|
-
} catch (
|
|
7299
|
-
console.warn("Error playing reaction:",
|
|
7298
|
+
} catch (U) {
|
|
7299
|
+
console.warn("Error playing reaction:", U);
|
|
7300
7300
|
}
|
|
7301
7301
|
},
|
|
7302
7302
|
playCelebration: () => {
|
|
@@ -7311,8 +7311,8 @@ const At = Ue(({
|
|
|
7311
7311
|
if (l.current && l.current.setShowFullAvatar)
|
|
7312
7312
|
try {
|
|
7313
7313
|
l.current.setShowFullAvatar(I), console.log("Show full avatar set to:", I);
|
|
7314
|
-
} catch (
|
|
7315
|
-
console.warn("Error setting showFullAvatar:",
|
|
7314
|
+
} catch (U) {
|
|
7315
|
+
console.warn("Error setting showFullAvatar:", U);
|
|
7316
7316
|
}
|
|
7317
7317
|
},
|
|
7318
7318
|
lockAvatarPosition: () => {
|
|
@@ -7331,7 +7331,7 @@ const At = Ue(({
|
|
|
7331
7331
|
console.warn("Error unlocking avatar position:", I);
|
|
7332
7332
|
}
|
|
7333
7333
|
}
|
|
7334
|
-
})), /* @__PURE__ */
|
|
7334
|
+
})), /* @__PURE__ */ ke("div", { className: `talking-head-container ${o}`, style: s, children: [
|
|
7335
7335
|
/* @__PURE__ */ $(
|
|
7336
7336
|
"div",
|
|
7337
7337
|
{
|
|
@@ -7367,10 +7367,10 @@ const At = Ue(({
|
|
|
7367
7367
|
}, children: d })
|
|
7368
7368
|
] });
|
|
7369
7369
|
});
|
|
7370
|
-
|
|
7371
|
-
async function
|
|
7370
|
+
kt.displayName = "TalkingHeadComponent";
|
|
7371
|
+
async function De(V) {
|
|
7372
7372
|
try {
|
|
7373
|
-
const t = await fetch(
|
|
7373
|
+
const t = await fetch(V);
|
|
7374
7374
|
if (!t.ok)
|
|
7375
7375
|
throw new Error(`Failed to fetch manifest: ${t.status} ${t.statusText}`);
|
|
7376
7376
|
return (await t.json()).animations || {};
|
|
@@ -7378,8 +7378,8 @@ async function Me(W) {
|
|
|
7378
7378
|
return console.error("Failed to load animation manifest:", t), {};
|
|
7379
7379
|
}
|
|
7380
7380
|
}
|
|
7381
|
-
async function
|
|
7382
|
-
const e = [], n =
|
|
7381
|
+
async function wt(V, t = "F") {
|
|
7382
|
+
const e = [], n = V.replace(/\/$/, "");
|
|
7383
7383
|
try {
|
|
7384
7384
|
const s = [
|
|
7385
7385
|
`${n}/.list.json`,
|
|
@@ -7417,19 +7417,19 @@ async function Lt(W, t = "F") {
|
|
|
7417
7417
|
}
|
|
7418
7418
|
return e.length > 0, e;
|
|
7419
7419
|
}
|
|
7420
|
-
async function
|
|
7420
|
+
async function $e(V, t = "F") {
|
|
7421
7421
|
const e = {};
|
|
7422
|
-
for (const [n, o] of Object.entries(
|
|
7422
|
+
for (const [n, o] of Object.entries(V))
|
|
7423
7423
|
try {
|
|
7424
|
-
const s = await
|
|
7424
|
+
const s = await wt(o, t);
|
|
7425
7425
|
s.length > 0 && (e[n] = s);
|
|
7426
7426
|
} catch (s) {
|
|
7427
7427
|
console.error(`❌ Failed to auto-load animations from ${o}:`, s);
|
|
7428
7428
|
}
|
|
7429
7429
|
return e;
|
|
7430
7430
|
}
|
|
7431
|
-
const
|
|
7432
|
-
text:
|
|
7431
|
+
const Ct = Ze(({
|
|
7432
|
+
text: V = null,
|
|
7433
7433
|
avatarUrl: t = "/avatars/brunette.glb",
|
|
7434
7434
|
avatarBody: e = "F",
|
|
7435
7435
|
mood: n = "neutral",
|
|
@@ -7458,21 +7458,21 @@ const St = Ue(({
|
|
|
7458
7458
|
// e.g., "idle" - will randomly select from this group when idle
|
|
7459
7459
|
autoSpeak: E = !1
|
|
7460
7460
|
}, y) => {
|
|
7461
|
-
const F =
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
}, [ee]),
|
|
7461
|
+
const F = W(null), x = W(null), S = W(u), H = W(null), I = W(null), U = W(!1), G = W({ remainingText: null, originalText: null, options: null }), j = W([]), [Y, ue] = ae(!0), [le, ve] = ae(null), [se, ze] = ae(!1), [ee, v] = ae(!1), [A, M] = ae(T), B = W(null), Z = W(!1), re = W(null), ne = W([]), J = W([]);
|
|
7462
|
+
fe(() => {
|
|
7463
|
+
U.current = ee;
|
|
7464
|
+
}, [ee]), fe(() => {
|
|
7465
7465
|
(async () => {
|
|
7466
7466
|
if (T.manifest && T.auto)
|
|
7467
7467
|
try {
|
|
7468
|
-
const C = await
|
|
7468
|
+
const C = await De(T.manifest);
|
|
7469
7469
|
M(C);
|
|
7470
7470
|
return;
|
|
7471
7471
|
} catch {
|
|
7472
7472
|
}
|
|
7473
7473
|
if (T.manifest && !T.auto)
|
|
7474
7474
|
try {
|
|
7475
|
-
const C = await
|
|
7475
|
+
const C = await De(T.manifest);
|
|
7476
7476
|
M(C);
|
|
7477
7477
|
} catch (C) {
|
|
7478
7478
|
console.error("Failed to load animation manifest:", C), M(T);
|
|
@@ -7482,48 +7482,48 @@ const St = Ue(({
|
|
|
7482
7482
|
let C = null;
|
|
7483
7483
|
if (T.manifest)
|
|
7484
7484
|
try {
|
|
7485
|
-
C = await
|
|
7485
|
+
C = await De(T.manifest);
|
|
7486
7486
|
} catch {
|
|
7487
7487
|
}
|
|
7488
7488
|
if (typeof T.auto == "string") {
|
|
7489
|
-
const
|
|
7490
|
-
talking: `${
|
|
7491
|
-
idle: `${
|
|
7492
|
-
},
|
|
7493
|
-
|
|
7494
|
-
const
|
|
7495
|
-
if (!Object.values(
|
|
7489
|
+
const N = T.auto, te = {
|
|
7490
|
+
talking: `${N}/talking`,
|
|
7491
|
+
idle: `${N}/idle`
|
|
7492
|
+
}, K = e === "M" ? "male" : "female";
|
|
7493
|
+
te[`${K}_talking`] = `${N}/${K}/talking`, te[`${K}_idle`] = `${N}/${K}/idle`, te.shared_talking = `${N}/shared/talking`, te.shared_idle = `${N}/shared/idle`;
|
|
7494
|
+
const Se = await $e(te, e);
|
|
7495
|
+
if (!Object.values(Se).some((ce) => Array.isArray(ce) && ce.length > 0) && C) {
|
|
7496
7496
|
M(C);
|
|
7497
7497
|
return;
|
|
7498
7498
|
}
|
|
7499
|
-
const
|
|
7499
|
+
const ge = {
|
|
7500
7500
|
_genderSpecific: {
|
|
7501
|
-
[
|
|
7501
|
+
[K]: {},
|
|
7502
7502
|
shared: {}
|
|
7503
7503
|
}
|
|
7504
7504
|
};
|
|
7505
|
-
Object.entries(
|
|
7506
|
-
if (
|
|
7507
|
-
const [
|
|
7508
|
-
|
|
7505
|
+
Object.entries(Se).forEach(([ce, Fe]) => {
|
|
7506
|
+
if (ce.includes("_")) {
|
|
7507
|
+
const [Ne, ...nt] = ce.split("_"), Be = nt.join("_");
|
|
7508
|
+
Ne === "shared" ? (ge._genderSpecific.shared[Be] || (ge._genderSpecific.shared[Be] = []), ge._genderSpecific.shared[Be].push(...Fe)) : Ne === K && (ge._genderSpecific[K][Be] || (ge._genderSpecific[K][Be] = []), ge._genderSpecific[K][Be].push(...Fe));
|
|
7509
7509
|
} else
|
|
7510
|
-
|
|
7511
|
-
}), C && (C._genderSpecific && Object.keys(C._genderSpecific).forEach((
|
|
7512
|
-
|
|
7513
|
-
|
|
7510
|
+
ge[ce] = Fe;
|
|
7511
|
+
}), C && (C._genderSpecific && Object.keys(C._genderSpecific).forEach((ce) => {
|
|
7512
|
+
ge._genderSpecific[ce] || (ge._genderSpecific[ce] = {}), Object.entries(C._genderSpecific[ce]).forEach(([Fe, Ne]) => {
|
|
7513
|
+
ge._genderSpecific[ce][Fe] || (ge._genderSpecific[ce][Fe] = Ne);
|
|
7514
7514
|
});
|
|
7515
|
-
}), Object.entries(C).forEach(([
|
|
7516
|
-
|
|
7517
|
-
})), M(
|
|
7515
|
+
}), Object.entries(C).forEach(([ce, Fe]) => {
|
|
7516
|
+
ce !== "_genderSpecific" && !ge[ce] && (ge[ce] = Fe);
|
|
7517
|
+
})), M(ge);
|
|
7518
7518
|
} else if (typeof T.auto == "object") {
|
|
7519
|
-
const
|
|
7520
|
-
M(!
|
|
7519
|
+
const N = await $e(T.auto, e), te = Object.values(N).some((K) => Array.isArray(K) && K.length > 0);
|
|
7520
|
+
M(!te && C ? C : N);
|
|
7521
7521
|
}
|
|
7522
7522
|
} catch (C) {
|
|
7523
7523
|
if (console.error("Failed to auto-discover animations:", C), T.manifest)
|
|
7524
7524
|
try {
|
|
7525
|
-
const
|
|
7526
|
-
M(
|
|
7525
|
+
const N = await De(T.manifest);
|
|
7526
|
+
M(N);
|
|
7527
7527
|
} catch {
|
|
7528
7528
|
M(T);
|
|
7529
7529
|
}
|
|
@@ -7533,198 +7533,208 @@ const St = Ue(({
|
|
|
7533
7533
|
else
|
|
7534
7534
|
M(T);
|
|
7535
7535
|
})();
|
|
7536
|
-
}, [T, e]),
|
|
7536
|
+
}, [T, e]), fe(() => {
|
|
7537
7537
|
S.current = u;
|
|
7538
7538
|
}, [u]);
|
|
7539
|
-
const
|
|
7540
|
-
let
|
|
7541
|
-
|
|
7539
|
+
const me = je(), Me = s || me.service;
|
|
7540
|
+
let He;
|
|
7541
|
+
Me === "browser" ? He = {
|
|
7542
7542
|
service: "browser",
|
|
7543
7543
|
endpoint: "",
|
|
7544
7544
|
apiKey: null,
|
|
7545
7545
|
defaultVoice: "Google US English"
|
|
7546
|
-
} :
|
|
7546
|
+
} : Me === "elevenlabs" ? He = {
|
|
7547
7547
|
service: "elevenlabs",
|
|
7548
7548
|
endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
|
|
7549
|
-
apiKey: a ||
|
|
7550
|
-
defaultVoice: i ||
|
|
7551
|
-
voices:
|
|
7552
|
-
} :
|
|
7549
|
+
apiKey: a || me.apiKey,
|
|
7550
|
+
defaultVoice: i || me.defaultVoice || Pe.defaultVoice,
|
|
7551
|
+
voices: me.voices || Pe.voices
|
|
7552
|
+
} : Me === "deepgram" ? He = {
|
|
7553
7553
|
service: "deepgram",
|
|
7554
7554
|
endpoint: "https://api.deepgram.com/v1/speak",
|
|
7555
|
-
apiKey: a ||
|
|
7556
|
-
defaultVoice: i ||
|
|
7557
|
-
voices:
|
|
7558
|
-
} :
|
|
7559
|
-
...
|
|
7560
|
-
apiKey: a !== null ? a :
|
|
7555
|
+
apiKey: a || me.apiKey,
|
|
7556
|
+
defaultVoice: i || me.defaultVoice || Ge.defaultVoice,
|
|
7557
|
+
voices: me.voices || Ge.voices
|
|
7558
|
+
} : He = {
|
|
7559
|
+
...me,
|
|
7560
|
+
apiKey: a !== null ? a : me.apiKey
|
|
7561
7561
|
};
|
|
7562
|
-
const
|
|
7562
|
+
const Ye = {
|
|
7563
7563
|
url: t,
|
|
7564
7564
|
body: e,
|
|
7565
7565
|
avatarMood: n,
|
|
7566
|
-
ttsLang:
|
|
7567
|
-
ttsVoice: i ||
|
|
7566
|
+
ttsLang: Me === "browser" ? "en-US" : o,
|
|
7567
|
+
ttsVoice: i || He.defaultVoice,
|
|
7568
7568
|
lipsyncLang: "en",
|
|
7569
7569
|
showFullAvatar: u,
|
|
7570
7570
|
bodyMovement: c,
|
|
7571
7571
|
movementIntensity: l
|
|
7572
|
-
},
|
|
7573
|
-
ttsEndpoint:
|
|
7574
|
-
ttsApikey:
|
|
7575
|
-
ttsService:
|
|
7572
|
+
}, w = {
|
|
7573
|
+
ttsEndpoint: He.endpoint,
|
|
7574
|
+
ttsApikey: He.apiKey,
|
|
7575
|
+
ttsService: Me,
|
|
7576
7576
|
lipsyncModules: ["en"],
|
|
7577
7577
|
cameraView: r
|
|
7578
|
-
},
|
|
7578
|
+
}, X = D(async () => {
|
|
7579
7579
|
if (!(!F.current || x.current))
|
|
7580
7580
|
try {
|
|
7581
|
-
ue(!0), ve(null), x.current = new
|
|
7581
|
+
ue(!0), ve(null), x.current = new Qe(F.current, w), await x.current.showAvatar(Ye, (C) => {
|
|
7582
7582
|
if (C.lengthComputable) {
|
|
7583
|
-
const
|
|
7584
|
-
h(
|
|
7583
|
+
const N = Math.min(100, Math.round(C.loaded / C.total * 100));
|
|
7584
|
+
h(N);
|
|
7585
7585
|
}
|
|
7586
|
-
}), ue(!1),
|
|
7587
|
-
const
|
|
7586
|
+
}), ue(!1), ze(!0), d(x.current);
|
|
7587
|
+
const k = () => {
|
|
7588
7588
|
document.visibilityState === "visible" ? x.current?.start() : x.current?.stop();
|
|
7589
7589
|
};
|
|
7590
|
-
return document.addEventListener("visibilitychange",
|
|
7591
|
-
document.removeEventListener("visibilitychange",
|
|
7590
|
+
return document.addEventListener("visibilitychange", k), () => {
|
|
7591
|
+
document.removeEventListener("visibilitychange", k);
|
|
7592
7592
|
};
|
|
7593
|
-
} catch (
|
|
7594
|
-
console.error("Error initializing TalkingHead:",
|
|
7593
|
+
} catch (k) {
|
|
7594
|
+
console.error("Error initializing TalkingHead:", k), ve(k.message || "Failed to initialize avatar"), ue(!1), g(k);
|
|
7595
7595
|
}
|
|
7596
7596
|
}, []);
|
|
7597
|
-
|
|
7597
|
+
fe(() => (X(), () => {
|
|
7598
7598
|
x.current && (x.current.stop(), x.current.dispose(), x.current = null);
|
|
7599
|
-
}), [
|
|
7600
|
-
const
|
|
7599
|
+
}), [X]);
|
|
7600
|
+
const Q = D(async () => {
|
|
7601
7601
|
if (x.current)
|
|
7602
7602
|
try {
|
|
7603
|
-
const
|
|
7604
|
-
|
|
7605
|
-
} catch (
|
|
7606
|
-
console.warn("Failed to resume audio context:",
|
|
7603
|
+
const k = x.current.audioCtx || x.current.audioContext;
|
|
7604
|
+
k && (k.state === "suspended" || k.state === "interrupted") && await k.resume();
|
|
7605
|
+
} catch (k) {
|
|
7606
|
+
console.warn("Failed to resume audio context:", k);
|
|
7607
7607
|
}
|
|
7608
|
-
}, []),
|
|
7608
|
+
}, []), oe = D((k) => {
|
|
7609
7609
|
if (!A)
|
|
7610
|
-
return
|
|
7610
|
+
return [];
|
|
7611
7611
|
let C = null;
|
|
7612
7612
|
if (A._genderSpecific) {
|
|
7613
|
-
const
|
|
7614
|
-
|
|
7613
|
+
const te = (e?.toUpperCase() || "F") === "M" ? "male" : "female", K = A._genderSpecific[te];
|
|
7614
|
+
K && K[k] ? C = K[k] : A._genderSpecific.shared && A._genderSpecific.shared[k] && (C = A._genderSpecific.shared[k]);
|
|
7615
7615
|
}
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7616
|
+
return !C && A[k] && (C = A[k]), C ? Array.isArray(C) ? [...C] : typeof C == "string" ? [C] : [] : [];
|
|
7617
|
+
}, [A, e]), xe = D((k) => {
|
|
7618
|
+
const C = [...k];
|
|
7619
|
+
for (let N = C.length - 1; N > 0; N--) {
|
|
7620
|
+
const te = Math.floor(Math.random() * (N + 1));
|
|
7621
|
+
[C[N], C[te]] = [C[te], C[N]];
|
|
7622
|
+
}
|
|
7623
|
+
return C;
|
|
7624
|
+
}, []), _ = D((k) => {
|
|
7625
|
+
if (J.current.length === 0) {
|
|
7626
|
+
const N = oe(k);
|
|
7627
|
+
if (N.length === 0)
|
|
7628
|
+
return null;
|
|
7629
|
+
J.current = xe(N), ne.current = [];
|
|
7621
7630
|
}
|
|
7622
|
-
|
|
7623
|
-
|
|
7631
|
+
const C = J.current.shift();
|
|
7632
|
+
return ne.current.push(C), C;
|
|
7633
|
+
}, [oe, xe]), pe = D((k) => k ? k.split("/").pop().replace(".fbx", "").replace(/[-_]/g, " ") : "Unknown", []), Ie = D((k, C = !1, N = null) => {
|
|
7624
7634
|
if (!x.current)
|
|
7625
7635
|
return null;
|
|
7626
|
-
const
|
|
7627
|
-
if (
|
|
7636
|
+
const te = _(k);
|
|
7637
|
+
if (te)
|
|
7628
7638
|
try {
|
|
7629
|
-
const
|
|
7630
|
-
console.log(`🎬 Playing animation: "${
|
|
7631
|
-
const
|
|
7632
|
-
Z.current && re.current ===
|
|
7633
|
-
|
|
7634
|
-
}, 100) :
|
|
7639
|
+
const K = pe(te);
|
|
7640
|
+
console.log(`🎬 Playing animation: "${K}"`);
|
|
7641
|
+
const Se = () => {
|
|
7642
|
+
Z.current && re.current === k ? setTimeout(() => {
|
|
7643
|
+
Ie(k, C, N);
|
|
7644
|
+
}, 100) : N && N();
|
|
7635
7645
|
};
|
|
7636
|
-
return x.current.playAnimation(
|
|
7637
|
-
} catch (
|
|
7638
|
-
return console.error("Failed to play animation:",
|
|
7646
|
+
return x.current.playAnimation(te, null, 10, 0, 0.01, C, Se), te;
|
|
7647
|
+
} catch (K) {
|
|
7648
|
+
return console.error("Failed to play animation:", K), null;
|
|
7639
7649
|
}
|
|
7640
7650
|
return null;
|
|
7641
|
-
}, [
|
|
7642
|
-
if (!x.current || !se || !
|
|
7651
|
+
}, [_, pe]), be = D(async (k, C = {}) => {
|
|
7652
|
+
if (!x.current || !se || !k || k.trim() === "")
|
|
7643
7653
|
return;
|
|
7644
|
-
await
|
|
7645
|
-
const
|
|
7646
|
-
|
|
7647
|
-
const
|
|
7648
|
-
j.current =
|
|
7649
|
-
const
|
|
7654
|
+
await Q();
|
|
7655
|
+
const N = C.animationGroup || p;
|
|
7656
|
+
N && !C.skipAnimation && (Z.current = !0, re.current = N, J.current = [], ne.current = [], Ie(N)), G.current = { remainingText: null, originalText: null, options: null }, j.current = [], H.current = { text: k, options: C }, I.current && (clearInterval(I.current), I.current = null), v(!1), U.current = !1;
|
|
7657
|
+
const te = k.split(/[.!?]+/).filter((Se) => Se.trim().length > 0);
|
|
7658
|
+
j.current = te;
|
|
7659
|
+
const K = {
|
|
7650
7660
|
lipsyncLang: C.lipsyncLang || "en",
|
|
7651
7661
|
onSpeechEnd: () => {
|
|
7652
|
-
I.current && (clearInterval(I.current), I.current = null), Z.current = !1, re.current = null, C.onSpeechEnd && C.onSpeechEnd(), R();
|
|
7662
|
+
I.current && (clearInterval(I.current), I.current = null), Z.current = !1, re.current = null, J.current = [], ne.current = [], C.onSpeechEnd && C.onSpeechEnd(), R();
|
|
7653
7663
|
}
|
|
7654
7664
|
};
|
|
7655
7665
|
try {
|
|
7656
|
-
x.current.speakText(
|
|
7657
|
-
} catch (
|
|
7658
|
-
console.error("Error speaking text:",
|
|
7666
|
+
x.current.speakText(k, K);
|
|
7667
|
+
} catch (Se) {
|
|
7668
|
+
console.error("Error speaking text:", Se), ve(Se.message || "Failed to speak text");
|
|
7659
7669
|
}
|
|
7660
|
-
}, [se, R,
|
|
7661
|
-
|
|
7670
|
+
}, [se, R, Q, p, Ie]);
|
|
7671
|
+
fe(() => {
|
|
7662
7672
|
if (!se || !P || !x.current)
|
|
7663
7673
|
return;
|
|
7664
7674
|
B.current && clearInterval(B.current);
|
|
7665
|
-
const
|
|
7666
|
-
x.current && !
|
|
7675
|
+
const k = () => {
|
|
7676
|
+
x.current && !U.current && Ie(P);
|
|
7667
7677
|
};
|
|
7668
|
-
return
|
|
7669
|
-
|
|
7678
|
+
return k(), B.current = setInterval(() => {
|
|
7679
|
+
k();
|
|
7670
7680
|
}, 12e3 + Math.random() * 3e3), () => {
|
|
7671
7681
|
B.current && (clearInterval(B.current), B.current = null);
|
|
7672
7682
|
};
|
|
7673
|
-
}, [se, P,
|
|
7674
|
-
se &&
|
|
7675
|
-
}, [se,
|
|
7676
|
-
const
|
|
7683
|
+
}, [se, P, Ie]), fe(() => {
|
|
7684
|
+
se && V && E && x.current && be(V);
|
|
7685
|
+
}, [se, V, E, be]);
|
|
7686
|
+
const Le = D(() => {
|
|
7677
7687
|
if (x.current)
|
|
7678
7688
|
try {
|
|
7679
|
-
const
|
|
7680
|
-
if (
|
|
7689
|
+
const k = x.current.isSpeaking || !1, C = x.current.audioPlaylist || [], N = x.current.speechQueue || [];
|
|
7690
|
+
if (k || C.length > 0 || N.length > 0) {
|
|
7681
7691
|
I.current && (clearInterval(I.current), I.current = null);
|
|
7682
|
-
let
|
|
7683
|
-
|
|
7684
|
-
remainingText:
|
|
7692
|
+
let te = "";
|
|
7693
|
+
N.length > 0 && (te = N.map((K) => K.text && Array.isArray(K.text) ? K.text.map((Se) => Se.word).join(" ") : K.text || "").join(" ")), G.current = {
|
|
7694
|
+
remainingText: te || null,
|
|
7685
7695
|
originalText: H.current?.text || null,
|
|
7686
7696
|
options: H.current?.options || null
|
|
7687
|
-
}, x.current.speechQueue.length = 0, x.current.pauseSpeaking(), v(!0),
|
|
7697
|
+
}, x.current.speechQueue.length = 0, x.current.pauseSpeaking(), v(!0), U.current = !0;
|
|
7688
7698
|
}
|
|
7689
|
-
} catch (
|
|
7690
|
-
console.warn("Error pausing speech:",
|
|
7699
|
+
} catch (k) {
|
|
7700
|
+
console.warn("Error pausing speech:", k);
|
|
7691
7701
|
}
|
|
7692
|
-
}, []),
|
|
7702
|
+
}, []), Ae = D(async () => {
|
|
7693
7703
|
if (!(!x.current || !ee))
|
|
7694
7704
|
try {
|
|
7695
|
-
await
|
|
7696
|
-
const
|
|
7697
|
-
|
|
7698
|
-
} catch (
|
|
7699
|
-
console.warn("Error resuming speech:",
|
|
7705
|
+
await Q(), v(!1), U.current = !1;
|
|
7706
|
+
const k = G.current?.remainingText, C = G.current?.originalText || H.current?.text, N = G.current?.options || H.current?.options || {}, te = k || C;
|
|
7707
|
+
te && be(te, N);
|
|
7708
|
+
} catch (k) {
|
|
7709
|
+
console.warn("Error resuming speech:", k), v(!1), U.current = !1;
|
|
7700
7710
|
}
|
|
7701
|
-
}, [ee,
|
|
7702
|
-
x.current && (x.current.stopSpeaking(), I.current && (clearInterval(I.current), I.current = null), Z.current = !1, re.current = null, v(!1),
|
|
7711
|
+
}, [ee, be, Q]), Oe = D(() => {
|
|
7712
|
+
x.current && (x.current.stopSpeaking(), I.current && (clearInterval(I.current), I.current = null), Z.current = !1, re.current = null, J.current = [], ne.current = [], v(!1), U.current = !1);
|
|
7703
7713
|
}, []);
|
|
7704
|
-
return
|
|
7705
|
-
speakText:
|
|
7706
|
-
pauseSpeaking:
|
|
7707
|
-
resumeSpeaking:
|
|
7708
|
-
stopSpeaking:
|
|
7709
|
-
resumeAudioContext:
|
|
7714
|
+
return Xe(y, () => ({
|
|
7715
|
+
speakText: be,
|
|
7716
|
+
pauseSpeaking: Le,
|
|
7717
|
+
resumeSpeaking: Ae,
|
|
7718
|
+
stopSpeaking: Oe,
|
|
7719
|
+
resumeAudioContext: Q,
|
|
7710
7720
|
isPaused: () => ee,
|
|
7711
|
-
setMood: (
|
|
7712
|
-
setBodyMovement: (
|
|
7713
|
-
x.current && x.current.setBodyMovement(
|
|
7721
|
+
setMood: (k) => x.current?.setMood(k),
|
|
7722
|
+
setBodyMovement: (k) => {
|
|
7723
|
+
x.current && x.current.setBodyMovement(k);
|
|
7714
7724
|
},
|
|
7715
|
-
playAnimation: (
|
|
7716
|
-
x.current && x.current.playAnimation && x.current.playAnimation(
|
|
7725
|
+
playAnimation: (k, C = !1) => {
|
|
7726
|
+
x.current && x.current.playAnimation && x.current.playAnimation(k, null, 10, 0, 0.01, C);
|
|
7717
7727
|
},
|
|
7718
|
-
playRandomAnimation: (
|
|
7719
|
-
getRandomAnimation: (
|
|
7720
|
-
playReaction: (
|
|
7728
|
+
playRandomAnimation: (k, C = !1) => Ie(k, C),
|
|
7729
|
+
getRandomAnimation: (k) => getRandomAnimation(k),
|
|
7730
|
+
playReaction: (k) => x.current?.playReaction(k),
|
|
7721
7731
|
playCelebration: () => x.current?.playCelebration(),
|
|
7722
|
-
setShowFullAvatar: (
|
|
7723
|
-
x.current && (S.current =
|
|
7732
|
+
setShowFullAvatar: (k) => {
|
|
7733
|
+
x.current && (S.current = k, x.current.setShowFullAvatar(k));
|
|
7724
7734
|
},
|
|
7725
7735
|
isReady: se,
|
|
7726
7736
|
talkingHead: x.current
|
|
7727
|
-
})), /* @__PURE__ */
|
|
7737
|
+
})), /* @__PURE__ */ ke("div", { className: `simple-talking-avatar-container ${b}`, style: L, children: [
|
|
7728
7738
|
/* @__PURE__ */ $(
|
|
7729
7739
|
"div",
|
|
7730
7740
|
{
|
|
@@ -7760,9 +7770,9 @@ const St = Ue(({
|
|
|
7760
7770
|
}, children: le })
|
|
7761
7771
|
] });
|
|
7762
7772
|
});
|
|
7763
|
-
|
|
7764
|
-
const
|
|
7765
|
-
curriculumData:
|
|
7773
|
+
Ct.displayName = "SimpleTalkingAvatar";
|
|
7774
|
+
const zt = Ze(({
|
|
7775
|
+
curriculumData: V = null,
|
|
7766
7776
|
avatarConfig: t = {},
|
|
7767
7777
|
animations: e = {},
|
|
7768
7778
|
onLessonStart: n = () => {
|
|
@@ -7777,7 +7787,7 @@ const kt = Ue(({
|
|
|
7777
7787
|
},
|
|
7778
7788
|
autoStart: c = !1
|
|
7779
7789
|
}, l) => {
|
|
7780
|
-
const u =
|
|
7790
|
+
const u = W(null), r = W({
|
|
7781
7791
|
currentModuleIndex: 0,
|
|
7782
7792
|
currentLessonIndex: 0,
|
|
7783
7793
|
currentQuestionIndex: 0,
|
|
@@ -7787,18 +7797,18 @@ const kt = Ue(({
|
|
|
7787
7797
|
curriculumCompleted: !1,
|
|
7788
7798
|
score: 0,
|
|
7789
7799
|
totalQuestions: 0
|
|
7790
|
-
}), d =
|
|
7800
|
+
}), d = W({
|
|
7791
7801
|
onLessonStart: n,
|
|
7792
7802
|
onLessonComplete: o,
|
|
7793
7803
|
onQuestionAnswer: s,
|
|
7794
7804
|
onCurriculumComplete: i,
|
|
7795
7805
|
onCustomAction: a
|
|
7796
|
-
}), h =
|
|
7806
|
+
}), h = W(null), g = W(null), R = W(null), b = W(null), L = W(null), T = W(null), p = W(null), P = W(V?.curriculum || {
|
|
7797
7807
|
title: "Default Curriculum",
|
|
7798
7808
|
description: "No curriculum data provided",
|
|
7799
7809
|
language: "en",
|
|
7800
7810
|
modules: []
|
|
7801
|
-
}), E =
|
|
7811
|
+
}), E = W({
|
|
7802
7812
|
avatarUrl: t.avatarUrl || "/avatars/brunette.glb",
|
|
7803
7813
|
avatarBody: t.avatarBody || "F",
|
|
7804
7814
|
mood: t.mood || "happy",
|
|
@@ -7812,7 +7822,7 @@ const kt = Ue(({
|
|
|
7812
7822
|
animations: e,
|
|
7813
7823
|
lipsyncLang: "en"
|
|
7814
7824
|
});
|
|
7815
|
-
|
|
7825
|
+
fe(() => {
|
|
7816
7826
|
d.current = {
|
|
7817
7827
|
onLessonStart: n,
|
|
7818
7828
|
onLessonComplete: o,
|
|
@@ -7820,8 +7830,8 @@ const kt = Ue(({
|
|
|
7820
7830
|
onCurriculumComplete: i,
|
|
7821
7831
|
onCustomAction: a
|
|
7822
7832
|
};
|
|
7823
|
-
}, [n, o, s, i, a]),
|
|
7824
|
-
P.current =
|
|
7833
|
+
}, [n, o, s, i, a]), fe(() => {
|
|
7834
|
+
P.current = V?.curriculum || {
|
|
7825
7835
|
title: "Default Curriculum",
|
|
7826
7836
|
description: "No curriculum data provided",
|
|
7827
7837
|
language: "en",
|
|
@@ -7840,8 +7850,8 @@ const kt = Ue(({
|
|
|
7840
7850
|
animations: e,
|
|
7841
7851
|
lipsyncLang: "en"
|
|
7842
7852
|
};
|
|
7843
|
-
}, [
|
|
7844
|
-
const y =
|
|
7853
|
+
}, [V, t, e]);
|
|
7854
|
+
const y = D(() => (P.current || { modules: [] }).modules[r.current.currentModuleIndex]?.lessons[r.current.currentLessonIndex], []), F = D(() => y()?.questions[r.current.currentQuestionIndex], [y]), x = D((v, A) => A.type === "multiple_choice" || A.type === "true_false" ? v === A.answer : A.type === "code_test" && typeof v == "object" && v !== null ? v.passed === !0 : !1, []), S = D(() => {
|
|
7845
7855
|
r.current.lessonCompleted = !0, r.current.isQuestionMode = !1;
|
|
7846
7856
|
const v = r.current.totalQuestions > 0 ? Math.round(r.current.score / r.current.totalQuestions * 100) : 100;
|
|
7847
7857
|
let A = "Congratulations! You've completed this lesson";
|
|
@@ -7865,9 +7875,9 @@ const kt = Ue(({
|
|
|
7865
7875
|
} catch {
|
|
7866
7876
|
u.current.playCelebration();
|
|
7867
7877
|
}
|
|
7868
|
-
const M = P.current || { modules: [] }, B = M.modules[r.current.currentModuleIndex], Z = r.current.currentLessonIndex < (B?.lessons?.length || 0) - 1, re = r.current.currentModuleIndex < (M.modules?.length || 0) - 1,
|
|
7878
|
+
const M = P.current || { modules: [] }, B = M.modules[r.current.currentModuleIndex], Z = r.current.currentLessonIndex < (B?.lessons?.length || 0) - 1, re = r.current.currentModuleIndex < (M.modules?.length || 0) - 1, ne = Z || re, J = E.current || { lipsyncLang: "en" };
|
|
7869
7879
|
u.current.speakText(A, {
|
|
7870
|
-
lipsyncLang:
|
|
7880
|
+
lipsyncLang: J.lipsyncLang,
|
|
7871
7881
|
onSpeechEnd: () => {
|
|
7872
7882
|
d.current.onCustomAction({
|
|
7873
7883
|
type: "lessonCompleteFeedbackDone",
|
|
@@ -7876,12 +7886,12 @@ const kt = Ue(({
|
|
|
7876
7886
|
score: r.current.score,
|
|
7877
7887
|
totalQuestions: r.current.totalQuestions,
|
|
7878
7888
|
percentage: v,
|
|
7879
|
-
hasNextLesson:
|
|
7889
|
+
hasNextLesson: ne
|
|
7880
7890
|
});
|
|
7881
7891
|
}
|
|
7882
7892
|
});
|
|
7883
7893
|
}
|
|
7884
|
-
}, [e.lessonComplete]), H =
|
|
7894
|
+
}, [e.lessonComplete]), H = D(() => {
|
|
7885
7895
|
r.current.curriculumCompleted = !0;
|
|
7886
7896
|
const v = P.current || { modules: [] };
|
|
7887
7897
|
if (d.current.onCurriculumComplete({
|
|
@@ -7897,7 +7907,7 @@ const kt = Ue(({
|
|
|
7897
7907
|
const A = E.current || { lipsyncLang: "en" };
|
|
7898
7908
|
u.current.speakText("Amazing! You've completed the entire curriculum! You're now ready to move on to more advanced topics. Well done!", { lipsyncLang: A.lipsyncLang });
|
|
7899
7909
|
}
|
|
7900
|
-
}, [e.curriculumComplete]), I =
|
|
7910
|
+
}, [e.curriculumComplete]), I = D(() => {
|
|
7901
7911
|
const v = y();
|
|
7902
7912
|
r.current.isQuestionMode = !0, r.current.currentQuestionIndex = 0, r.current.totalQuestions = v?.questions?.length || 0, r.current.score = 0;
|
|
7903
7913
|
const A = F();
|
|
@@ -7934,7 +7944,7 @@ const kt = Ue(({
|
|
|
7934
7944
|
clearInterval(B);
|
|
7935
7945
|
}, 5e3);
|
|
7936
7946
|
}
|
|
7937
|
-
}, [e.questionStart, y, F]),
|
|
7947
|
+
}, [e.questionStart, y, F]), U = D(() => {
|
|
7938
7948
|
const v = y();
|
|
7939
7949
|
if (r.current.currentQuestionIndex < (v?.questions?.length || 0) - 1) {
|
|
7940
7950
|
u.current && u.current.stopSpeaking && u.current.stopSpeaking(), r.current.currentQuestionIndex += 1;
|
|
@@ -7953,28 +7963,28 @@ const kt = Ue(({
|
|
|
7953
7963
|
if (u.current.setMood("happy"), u.current.setBodyMovement("idle"), e.nextQuestion)
|
|
7954
7964
|
try {
|
|
7955
7965
|
u.current.playAnimation(e.nextQuestion, !0);
|
|
7956
|
-
} catch (
|
|
7957
|
-
console.warn("Failed to play nextQuestion animation:",
|
|
7966
|
+
} catch (J) {
|
|
7967
|
+
console.warn("Failed to play nextQuestion animation:", J);
|
|
7958
7968
|
}
|
|
7959
|
-
const B = E.current || { lipsyncLang: "en" }, re = y()?.questions?.length || 0,
|
|
7969
|
+
const B = E.current || { lipsyncLang: "en" }, re = y()?.questions?.length || 0, ne = r.current.currentQuestionIndex >= re - 1;
|
|
7960
7970
|
if (A.type === "code_test") {
|
|
7961
|
-
const
|
|
7962
|
-
u.current.speakText(
|
|
7971
|
+
const J = ne ? `Great! Here's your final coding challenge: ${A.question}` : `Great! Now let's move on to your next coding challenge: ${A.question}`;
|
|
7972
|
+
u.current.speakText(J, {
|
|
7963
7973
|
lipsyncLang: B.lipsyncLang
|
|
7964
7974
|
});
|
|
7965
7975
|
} else if (A.type === "multiple_choice") {
|
|
7966
|
-
const
|
|
7967
|
-
u.current.speakText(
|
|
7976
|
+
const J = ne ? `Alright! Here's your final question: ${A.question}` : `Alright! Here's your next question: ${A.question}`;
|
|
7977
|
+
u.current.speakText(J, {
|
|
7968
7978
|
lipsyncLang: B.lipsyncLang
|
|
7969
7979
|
});
|
|
7970
7980
|
} else if (A.type === "true_false") {
|
|
7971
|
-
const
|
|
7972
|
-
u.current.speakText(
|
|
7981
|
+
const J = ne ? `Now let's try this final one: ${A.question}` : `Now let's try this one: ${A.question}`;
|
|
7982
|
+
u.current.speakText(J, {
|
|
7973
7983
|
lipsyncLang: B.lipsyncLang
|
|
7974
7984
|
});
|
|
7975
7985
|
} else {
|
|
7976
|
-
const
|
|
7977
|
-
u.current.speakText(
|
|
7986
|
+
const J = ne ? `Here's your final question: ${A.question}` : `Here's the next question: ${A.question}`;
|
|
7987
|
+
u.current.speakText(J, {
|
|
7978
7988
|
lipsyncLang: B.lipsyncLang
|
|
7979
7989
|
});
|
|
7980
7990
|
}
|
|
@@ -7997,16 +8007,16 @@ const kt = Ue(({
|
|
|
7997
8007
|
totalQuestions: r.current.totalQuestions,
|
|
7998
8008
|
score: r.current.score
|
|
7999
8009
|
});
|
|
8000
|
-
}, [e.nextQuestion, y, F]),
|
|
8010
|
+
}, [e.nextQuestion, y, F]), G = D(() => {
|
|
8001
8011
|
const v = P.current || { modules: [] }, A = v.modules[r.current.currentModuleIndex];
|
|
8002
8012
|
if (r.current.currentLessonIndex < (A?.lessons?.length || 0) - 1) {
|
|
8003
8013
|
r.current.currentLessonIndex += 1, r.current.currentQuestionIndex = 0, r.current.lessonCompleted = !1, r.current.isQuestionMode = !1, r.current.isTeaching = !1, r.current.score = 0, r.current.totalQuestions = 0;
|
|
8004
|
-
const B = v.modules[r.current.currentModuleIndex], Z = r.current.currentLessonIndex < (B?.lessons?.length || 0) - 1, re = r.current.currentModuleIndex < (v.modules?.length || 0) - 1,
|
|
8014
|
+
const B = v.modules[r.current.currentModuleIndex], Z = r.current.currentLessonIndex < (B?.lessons?.length || 0) - 1, re = r.current.currentModuleIndex < (v.modules?.length || 0) - 1, ne = Z || re;
|
|
8005
8015
|
d.current.onCustomAction({
|
|
8006
8016
|
type: "lessonStart",
|
|
8007
8017
|
moduleIndex: r.current.currentModuleIndex,
|
|
8008
8018
|
lessonIndex: r.current.currentLessonIndex,
|
|
8009
|
-
hasNextLesson:
|
|
8019
|
+
hasNextLesson: ne
|
|
8010
8020
|
}), d.current.onLessonStart({
|
|
8011
8021
|
moduleIndex: r.current.currentModuleIndex,
|
|
8012
8022
|
lessonIndex: r.current.currentLessonIndex,
|
|
@@ -8014,12 +8024,12 @@ const kt = Ue(({
|
|
|
8014
8024
|
}), u.current && (u.current.setMood("happy"), u.current.setBodyMovement("idle"));
|
|
8015
8025
|
} else if (r.current.currentModuleIndex < (v.modules?.length || 0) - 1) {
|
|
8016
8026
|
r.current.currentModuleIndex += 1, r.current.currentLessonIndex = 0, r.current.currentQuestionIndex = 0, r.current.lessonCompleted = !1, r.current.isQuestionMode = !1, r.current.isTeaching = !1, r.current.score = 0, r.current.totalQuestions = 0;
|
|
8017
|
-
const Z = v.modules[r.current.currentModuleIndex], re = r.current.currentLessonIndex < (Z?.lessons?.length || 0) - 1,
|
|
8027
|
+
const Z = v.modules[r.current.currentModuleIndex], re = r.current.currentLessonIndex < (Z?.lessons?.length || 0) - 1, ne = r.current.currentModuleIndex < (v.modules?.length || 0) - 1, J = re || ne;
|
|
8018
8028
|
d.current.onCustomAction({
|
|
8019
8029
|
type: "lessonStart",
|
|
8020
8030
|
moduleIndex: r.current.currentModuleIndex,
|
|
8021
8031
|
lessonIndex: r.current.currentLessonIndex,
|
|
8022
|
-
hasNextLesson:
|
|
8032
|
+
hasNextLesson: J
|
|
8023
8033
|
}), d.current.onLessonStart({
|
|
8024
8034
|
moduleIndex: r.current.currentModuleIndex,
|
|
8025
8035
|
lessonIndex: r.current.currentLessonIndex,
|
|
@@ -8027,7 +8037,7 @@ const kt = Ue(({
|
|
|
8027
8037
|
}), u.current && (u.current.setMood("happy"), u.current.setBodyMovement("idle"));
|
|
8028
8038
|
} else
|
|
8029
8039
|
L.current && L.current();
|
|
8030
|
-
}, []), j =
|
|
8040
|
+
}, []), j = D(() => {
|
|
8031
8041
|
const v = y();
|
|
8032
8042
|
let A = null;
|
|
8033
8043
|
if (v?.avatar_script && v?.body) {
|
|
@@ -8074,7 +8084,7 @@ const kt = Ue(({
|
|
|
8074
8084
|
}
|
|
8075
8085
|
});
|
|
8076
8086
|
}
|
|
8077
|
-
}, [e.teaching, y]), Y =
|
|
8087
|
+
}, [e.teaching, y]), Y = D((v) => {
|
|
8078
8088
|
const A = F(), M = x(v, A);
|
|
8079
8089
|
if (M && (r.current.score += 1), d.current.onQuestionAnswer({
|
|
8080
8090
|
moduleIndex: r.current.currentModuleIndex,
|
|
@@ -8096,9 +8106,9 @@ const kt = Ue(({
|
|
|
8096
8106
|
r.current.currentQuestionIndex >= Z - 1;
|
|
8097
8107
|
const re = r.current.currentQuestionIndex < Z - 1;
|
|
8098
8108
|
console.log("[CurriculumLearning] Answer feedback - questionIndex:", r.current.currentQuestionIndex, "totalQuestions:", Z, "hasNextQuestion:", re);
|
|
8099
|
-
const
|
|
8100
|
-
u.current.speakText(
|
|
8101
|
-
lipsyncLang:
|
|
8109
|
+
const ne = A.type === "code_test" ? `Great job! Your code passed all the tests! ${A.explanation || ""}` : `Excellent! That's correct! ${A.explanation || ""}`, J = E.current || { lipsyncLang: "en" };
|
|
8110
|
+
u.current.speakText(ne, {
|
|
8111
|
+
lipsyncLang: J.lipsyncLang,
|
|
8102
8112
|
onSpeechEnd: () => {
|
|
8103
8113
|
d.current.onCustomAction({
|
|
8104
8114
|
type: "answerFeedbackComplete",
|
|
@@ -8120,11 +8130,11 @@ const kt = Ue(({
|
|
|
8120
8130
|
u.current.setBodyMovement("idle");
|
|
8121
8131
|
}
|
|
8122
8132
|
u.current.setBodyMovement("gesturing");
|
|
8123
|
-
const Z = y()?.questions?.length || 0, re = r.current.currentQuestionIndex >= Z - 1,
|
|
8124
|
-
console.log("[CurriculumLearning] Answer feedback (incorrect) - questionIndex:", r.current.currentQuestionIndex, "totalQuestions:", Z, "hasNextQuestion:",
|
|
8125
|
-
const
|
|
8126
|
-
u.current.speakText(
|
|
8127
|
-
lipsyncLang:
|
|
8133
|
+
const Z = y()?.questions?.length || 0, re = r.current.currentQuestionIndex >= Z - 1, ne = r.current.currentQuestionIndex < Z - 1;
|
|
8134
|
+
console.log("[CurriculumLearning] Answer feedback (incorrect) - questionIndex:", r.current.currentQuestionIndex, "totalQuestions:", Z, "hasNextQuestion:", ne);
|
|
8135
|
+
const J = A.type === "code_test" ? `Your code didn't pass all the tests. ${A.explanation || "Try again!"}` : `Not quite right, but don't worry! ${A.explanation || ""}${re ? "" : " Let's move on to the next question."}`, me = E.current || { lipsyncLang: "en" };
|
|
8136
|
+
u.current.speakText(J, {
|
|
8137
|
+
lipsyncLang: me.lipsyncLang,
|
|
8128
8138
|
onSpeechEnd: () => {
|
|
8129
8139
|
d.current.onCustomAction({
|
|
8130
8140
|
type: "answerFeedbackComplete",
|
|
@@ -8132,7 +8142,7 @@ const kt = Ue(({
|
|
|
8132
8142
|
lessonIndex: r.current.currentLessonIndex,
|
|
8133
8143
|
questionIndex: r.current.currentQuestionIndex,
|
|
8134
8144
|
isCorrect: !1,
|
|
8135
|
-
hasNextQuestion:
|
|
8145
|
+
hasNextQuestion: ne,
|
|
8136
8146
|
score: r.current.score,
|
|
8137
8147
|
totalQuestions: r.current.totalQuestions
|
|
8138
8148
|
});
|
|
@@ -8153,7 +8163,7 @@ const kt = Ue(({
|
|
|
8153
8163
|
avatarNotReady: !0
|
|
8154
8164
|
});
|
|
8155
8165
|
}
|
|
8156
|
-
}, [e.correct, e.incorrect, F, y, x]), ue =
|
|
8166
|
+
}, [e.correct, e.incorrect, F, y, x]), ue = D((v) => {
|
|
8157
8167
|
const A = F();
|
|
8158
8168
|
if (!v || typeof v != "object") {
|
|
8159
8169
|
console.error("Invalid code test result format. Expected object with {passed: boolean, ...}");
|
|
@@ -8181,7 +8191,7 @@ const kt = Ue(({
|
|
|
8181
8191
|
testResult: M,
|
|
8182
8192
|
question: A
|
|
8183
8193
|
}), p.current && p.current(M);
|
|
8184
|
-
}, [F, x]), le =
|
|
8194
|
+
}, [F, x]), le = D(() => {
|
|
8185
8195
|
if (r.current.currentQuestionIndex > 0) {
|
|
8186
8196
|
r.current.currentQuestionIndex -= 1;
|
|
8187
8197
|
const v = F();
|
|
@@ -8215,7 +8225,7 @@ const kt = Ue(({
|
|
|
8215
8225
|
}, 5e3);
|
|
8216
8226
|
}
|
|
8217
8227
|
}
|
|
8218
|
-
}, [F]), ve =
|
|
8228
|
+
}, [F]), ve = D(() => {
|
|
8219
8229
|
const v = P.current || { modules: [] };
|
|
8220
8230
|
if (v.modules[r.current.currentModuleIndex], r.current.currentLessonIndex > 0)
|
|
8221
8231
|
r.current.currentLessonIndex -= 1, r.current.currentQuestionIndex = 0, r.current.lessonCompleted = !1, r.current.isQuestionMode = !1, r.current.isTeaching = !1, r.current.score = 0, r.current.totalQuestions = 0, d.current.onCustomAction({
|
|
@@ -8239,26 +8249,26 @@ const kt = Ue(({
|
|
|
8239
8249
|
lesson: y()
|
|
8240
8250
|
}), u.current && (u.current.setMood("happy"), u.current.setBodyMovement("idle"));
|
|
8241
8251
|
}
|
|
8242
|
-
}, [y]), se =
|
|
8252
|
+
}, [y]), se = D(() => {
|
|
8243
8253
|
r.current.currentModuleIndex = 0, r.current.currentLessonIndex = 0, r.current.currentQuestionIndex = 0, r.current.isTeaching = !1, r.current.isQuestionMode = !1, r.current.lessonCompleted = !1, r.current.curriculumCompleted = !1, r.current.score = 0, r.current.totalQuestions = 0;
|
|
8244
|
-
}, []),
|
|
8254
|
+
}, []), ze = D((v) => {
|
|
8245
8255
|
console.log("Avatar is ready!", v);
|
|
8246
8256
|
const A = y(), M = A?.avatar_script || A?.body;
|
|
8247
8257
|
c && M && setTimeout(() => {
|
|
8248
8258
|
h.current && h.current();
|
|
8249
8259
|
}, 10);
|
|
8250
8260
|
}, [c, y]);
|
|
8251
|
-
|
|
8252
|
-
h.current = j, g.current =
|
|
8253
|
-
}),
|
|
8261
|
+
it(() => {
|
|
8262
|
+
h.current = j, g.current = G, R.current = S, b.current = U, L.current = H, T.current = I, p.current = Y;
|
|
8263
|
+
}), Xe(l, () => ({
|
|
8254
8264
|
// Curriculum control methods
|
|
8255
8265
|
startTeaching: j,
|
|
8256
8266
|
startQuestions: I,
|
|
8257
8267
|
handleAnswerSelect: Y,
|
|
8258
8268
|
handleCodeTestResult: ue,
|
|
8259
|
-
nextQuestion:
|
|
8269
|
+
nextQuestion: U,
|
|
8260
8270
|
previousQuestion: le,
|
|
8261
|
-
nextLesson:
|
|
8271
|
+
nextLesson: G,
|
|
8262
8272
|
previousLesson: ve,
|
|
8263
8273
|
completeLesson: S,
|
|
8264
8274
|
completeCurriculum: H,
|
|
@@ -8316,7 +8326,7 @@ const kt = Ue(({
|
|
|
8316
8326
|
handleResize: () => u.current?.handleResize(),
|
|
8317
8327
|
// Avatar readiness check (always returns current value)
|
|
8318
8328
|
isAvatarReady: () => u.current?.isReady || !1
|
|
8319
|
-
}), [j, I, Y, ue,
|
|
8329
|
+
}), [j, I, Y, ue, U, G, S, H, se, F, y]);
|
|
8320
8330
|
const ee = E.current || {
|
|
8321
8331
|
avatarUrl: "/avatars/brunette.glb",
|
|
8322
8332
|
avatarBody: "F",
|
|
@@ -8331,7 +8341,7 @@ const kt = Ue(({
|
|
|
8331
8341
|
animations: e
|
|
8332
8342
|
};
|
|
8333
8343
|
return /* @__PURE__ */ $("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ $(
|
|
8334
|
-
|
|
8344
|
+
et,
|
|
8335
8345
|
{
|
|
8336
8346
|
ref: u,
|
|
8337
8347
|
avatarUrl: ee.avatarUrl,
|
|
@@ -8346,7 +8356,7 @@ const kt = Ue(({
|
|
|
8346
8356
|
showFullAvatar: ee.showFullAvatar,
|
|
8347
8357
|
cameraView: "upper",
|
|
8348
8358
|
animations: ee.animations,
|
|
8349
|
-
onReady:
|
|
8359
|
+
onReady: ze,
|
|
8350
8360
|
onLoading: () => {
|
|
8351
8361
|
},
|
|
8352
8362
|
onError: (v) => {
|
|
@@ -8355,9 +8365,9 @@ const kt = Ue(({
|
|
|
8355
8365
|
}
|
|
8356
8366
|
) });
|
|
8357
8367
|
});
|
|
8358
|
-
|
|
8359
|
-
function
|
|
8360
|
-
manifestPath:
|
|
8368
|
+
zt.displayName = "CurriculumLearning";
|
|
8369
|
+
function Ut({
|
|
8370
|
+
manifestPath: V = "/animations/manifest.json",
|
|
8361
8371
|
avatarBody: t = "F",
|
|
8362
8372
|
onAnimationPlay: e = null,
|
|
8363
8373
|
onAnimationsSelected: n = null,
|
|
@@ -8365,19 +8375,19 @@ function Ot({
|
|
|
8365
8375
|
style: s = {}
|
|
8366
8376
|
}) {
|
|
8367
8377
|
const [i, a] = ae([]), [c, l] = ae(/* @__PURE__ */ new Set()), [u, r] = ae(!0), [d, h] = ae(null), [g, R] = ae("all"), [b, L] = ae("");
|
|
8368
|
-
|
|
8378
|
+
fe(() => {
|
|
8369
8379
|
(async () => {
|
|
8370
8380
|
r(!0), h(null);
|
|
8371
8381
|
try {
|
|
8372
|
-
const H = await
|
|
8382
|
+
const H = await De(V), I = [];
|
|
8373
8383
|
if (H._genderSpecific) {
|
|
8374
|
-
const
|
|
8375
|
-
H._genderSpecific[
|
|
8384
|
+
const G = (t?.toUpperCase() || "F") === "M" ? "male" : "female";
|
|
8385
|
+
H._genderSpecific[G] && Object.entries(H._genderSpecific[G]).forEach(([j, Y]) => {
|
|
8376
8386
|
(Array.isArray(Y) ? Y : [Y]).forEach((le) => {
|
|
8377
8387
|
I.push({
|
|
8378
8388
|
path: le,
|
|
8379
8389
|
group: j,
|
|
8380
|
-
gender:
|
|
8390
|
+
gender: G,
|
|
8381
8391
|
name: le.split("/").pop().replace(".fbx", "")
|
|
8382
8392
|
});
|
|
8383
8393
|
});
|
|
@@ -8392,11 +8402,11 @@ function Ot({
|
|
|
8392
8402
|
});
|
|
8393
8403
|
});
|
|
8394
8404
|
}
|
|
8395
|
-
Object.entries(H).forEach(([
|
|
8396
|
-
|
|
8405
|
+
Object.entries(H).forEach(([U, G]) => {
|
|
8406
|
+
U !== "_genderSpecific" && (Array.isArray(G) ? G : [G]).forEach((Y) => {
|
|
8397
8407
|
typeof Y == "string" && I.push({
|
|
8398
8408
|
path: Y,
|
|
8399
|
-
group:
|
|
8409
|
+
group: U,
|
|
8400
8410
|
gender: "root",
|
|
8401
8411
|
name: Y.split("/").pop().replace(".fbx", "")
|
|
8402
8412
|
});
|
|
@@ -8406,7 +8416,7 @@ function Ot({
|
|
|
8406
8416
|
console.error("Failed to load animations:", H), h(H.message), r(!1);
|
|
8407
8417
|
}
|
|
8408
8418
|
})();
|
|
8409
|
-
}, [
|
|
8419
|
+
}, [V, t]);
|
|
8410
8420
|
const T = ["all", ...new Set(i.map((S) => S.group))], p = i.filter((S) => {
|
|
8411
8421
|
const H = g === "all" || S.group === g, I = b === "" || S.name.toLowerCase().includes(b.toLowerCase()) || S.path.toLowerCase().includes(b.toLowerCase());
|
|
8412
8422
|
return H && I;
|
|
@@ -8438,10 +8448,10 @@ ${H.slice(0, 5).join(`
|
|
|
8438
8448
|
}, x = (S) => {
|
|
8439
8449
|
e && e(S);
|
|
8440
8450
|
};
|
|
8441
|
-
return u ? /* @__PURE__ */ $("div", { style: { padding: "20px", textAlign: "center", ...s }, children: /* @__PURE__ */ $("p", { children: "Loading animations..." }) }) : d ? /* @__PURE__ */ $("div", { style: { padding: "20px", color: "red", ...s }, children: /* @__PURE__ */
|
|
8451
|
+
return u ? /* @__PURE__ */ $("div", { style: { padding: "20px", textAlign: "center", ...s }, children: /* @__PURE__ */ $("p", { children: "Loading animations..." }) }) : d ? /* @__PURE__ */ $("div", { style: { padding: "20px", color: "red", ...s }, children: /* @__PURE__ */ ke("p", { children: [
|
|
8442
8452
|
"Error loading animations: ",
|
|
8443
8453
|
d
|
|
8444
|
-
] }) }) : /* @__PURE__ */
|
|
8454
|
+
] }) }) : /* @__PURE__ */ ke("div", { style: {
|
|
8445
8455
|
padding: "20px",
|
|
8446
8456
|
backgroundColor: "#2a2a2a",
|
|
8447
8457
|
borderRadius: "8px",
|
|
@@ -8450,7 +8460,7 @@ ${H.slice(0, 5).join(`
|
|
|
8450
8460
|
}, children: [
|
|
8451
8461
|
/* @__PURE__ */ $("h2", { style: { marginTop: 0 }, children: "Animation Selector" }),
|
|
8452
8462
|
/* @__PURE__ */ $("p", { style: { color: "#aaa", fontSize: "14px" }, children: "Click buttons to play animations. Select animations to keep, then delete will remove the rest." }),
|
|
8453
|
-
/* @__PURE__ */
|
|
8463
|
+
/* @__PURE__ */ ke("div", { style: {
|
|
8454
8464
|
display: "flex",
|
|
8455
8465
|
gap: "10px",
|
|
8456
8466
|
marginBottom: "20px",
|
|
@@ -8524,7 +8534,7 @@ ${H.slice(0, 5).join(`
|
|
|
8524
8534
|
children: "Deselect All Visible"
|
|
8525
8535
|
}
|
|
8526
8536
|
),
|
|
8527
|
-
/* @__PURE__ */
|
|
8537
|
+
/* @__PURE__ */ ke(
|
|
8528
8538
|
"button",
|
|
8529
8539
|
{
|
|
8530
8540
|
onClick: F,
|
|
@@ -8546,7 +8556,7 @@ ${H.slice(0, 5).join(`
|
|
|
8546
8556
|
}
|
|
8547
8557
|
)
|
|
8548
8558
|
] }),
|
|
8549
|
-
/* @__PURE__ */
|
|
8559
|
+
/* @__PURE__ */ ke("div", { style: {
|
|
8550
8560
|
marginBottom: "15px",
|
|
8551
8561
|
fontSize: "14px",
|
|
8552
8562
|
color: "#aaa"
|
|
@@ -8569,7 +8579,7 @@ ${H.slice(0, 5).join(`
|
|
|
8569
8579
|
borderRadius: "6px"
|
|
8570
8580
|
}, children: p.map((S, H) => {
|
|
8571
8581
|
const I = c.has(S.path);
|
|
8572
|
-
return /* @__PURE__ */
|
|
8582
|
+
return /* @__PURE__ */ ke(
|
|
8573
8583
|
"div",
|
|
8574
8584
|
{
|
|
8575
8585
|
style: {
|
|
@@ -8582,21 +8592,21 @@ ${H.slice(0, 5).join(`
|
|
|
8582
8592
|
},
|
|
8583
8593
|
onClick: () => P(S.path),
|
|
8584
8594
|
children: [
|
|
8585
|
-
/* @__PURE__ */
|
|
8595
|
+
/* @__PURE__ */ ke("div", { style: { marginBottom: "8px" }, children: [
|
|
8586
8596
|
/* @__PURE__ */ $(
|
|
8587
8597
|
"input",
|
|
8588
8598
|
{
|
|
8589
8599
|
type: "checkbox",
|
|
8590
8600
|
checked: I,
|
|
8591
8601
|
onChange: () => P(S.path),
|
|
8592
|
-
onClick: (
|
|
8602
|
+
onClick: (U) => U.stopPropagation(),
|
|
8593
8603
|
style: {
|
|
8594
8604
|
marginRight: "8px",
|
|
8595
8605
|
cursor: "pointer"
|
|
8596
8606
|
}
|
|
8597
8607
|
}
|
|
8598
8608
|
),
|
|
8599
|
-
/* @__PURE__ */
|
|
8609
|
+
/* @__PURE__ */ ke("span", { style: { fontSize: "12px", color: "#aaa" }, children: [
|
|
8600
8610
|
S.group,
|
|
8601
8611
|
" ",
|
|
8602
8612
|
S.gender !== "root" && `(${S.gender})`
|
|
@@ -8611,8 +8621,8 @@ ${H.slice(0, 5).join(`
|
|
|
8611
8621
|
/* @__PURE__ */ $(
|
|
8612
8622
|
"button",
|
|
8613
8623
|
{
|
|
8614
|
-
onClick: (
|
|
8615
|
-
|
|
8624
|
+
onClick: (U) => {
|
|
8625
|
+
U.stopPropagation(), x(S.path);
|
|
8616
8626
|
},
|
|
8617
8627
|
style: {
|
|
8618
8628
|
width: "100%",
|
|
@@ -8639,7 +8649,7 @@ ${H.slice(0, 5).join(`
|
|
|
8639
8649
|
}, children: "No animations found matching your filters." })
|
|
8640
8650
|
] });
|
|
8641
8651
|
}
|
|
8642
|
-
const
|
|
8652
|
+
const tt = {
|
|
8643
8653
|
// Code-based dance animations (no FBX required)
|
|
8644
8654
|
dance: {
|
|
8645
8655
|
name: "dance",
|
|
@@ -8742,16 +8752,16 @@ const Je = {
|
|
|
8742
8752
|
duration: 5e3,
|
|
8743
8753
|
description: "Excited, energetic movement"
|
|
8744
8754
|
}
|
|
8745
|
-
},
|
|
8755
|
+
}, Wt = (V) => tt[V] || null, Vt = (V) => tt.hasOwnProperty(V);
|
|
8746
8756
|
export {
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
|
|
8751
|
-
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
+
Ut as AnimationSelector,
|
|
8758
|
+
zt as CurriculumLearning,
|
|
8759
|
+
Ct as SimpleTalkingAvatar,
|
|
8760
|
+
et as TalkingHeadAvatar,
|
|
8761
|
+
kt as TalkingHeadComponent,
|
|
8762
|
+
tt as animations,
|
|
8763
|
+
je as getActiveTTSConfig,
|
|
8764
|
+
Wt as getAnimation,
|
|
8765
|
+
Nt as getVoiceOptions,
|
|
8766
|
+
Vt as hasAnimation
|
|
8757
8767
|
};
|