@sage-rsc/talking-head-react 1.0.45 → 1.0.47

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.js CHANGED
@@ -1,21 +1,21 @@
1
- import { jsxs as ze, jsx as oe } from "react/jsx-runtime";
2
- import { forwardRef as ye, useRef as Y, useState as re, useCallback as E, useEffect as he, useImperativeHandle as fe, useLayoutEffect as Fe } from "react";
1
+ import { jsxs as Ce, jsx as oe } from "react/jsx-runtime";
2
+ import { forwardRef as be, useRef as X, useState as re, useCallback as E, useEffect as he, useImperativeHandle as Re, useLayoutEffect as Pe } from "react";
3
3
  import * as f from "three";
4
- import { OrbitControls as Pe } from "three/addons/controls/OrbitControls.js";
5
- import { GLTFLoader as Be } from "three/addons/loaders/GLTFLoader.js";
6
- import { DRACOLoader as De } from "three/addons/loaders/DRACOLoader.js";
7
- import { FBXLoader as Ae } from "three/addons/loaders/FBXLoader.js";
8
- import { RoomEnvironment as Oe } from "three/addons/environments/RoomEnvironment.js";
9
- import Ne from "three/addons/libs/stats.module.js";
4
+ import { OrbitControls as Be } from "three/addons/controls/OrbitControls.js";
5
+ import { GLTFLoader as De } from "three/addons/loaders/GLTFLoader.js";
6
+ import { DRACOLoader as Oe } from "three/addons/loaders/DRACOLoader.js";
7
+ import { FBXLoader as Le } from "three/addons/loaders/FBXLoader.js";
8
+ import { RoomEnvironment as Ne } from "three/addons/environments/RoomEnvironment.js";
9
+ import Ue from "three/addons/libs/stats.module.js";
10
10
  let m, Q, J;
11
- const A = [0, 0, 0, 0], k = new f.Vector3(), de = new f.Vector3(), Z = new f.Vector3(), ce = new f.Vector3();
11
+ const A = [0, 0, 0, 0], k = new f.Vector3(), me = new f.Vector3(), G = new f.Vector3(), pe = new f.Vector3();
12
12
  new f.Plane();
13
13
  new f.Ray();
14
14
  new f.Euler();
15
- const X = new f.Quaternion(), Le = new f.Quaternion(), ee = new f.Matrix4(), te = new f.Matrix4();
15
+ const Z = new f.Quaternion(), Se = new f.Quaternion(), ee = new f.Matrix4(), te = new f.Matrix4();
16
16
  new f.Vector3();
17
- const me = new f.Vector3(0, 0, 1), Ue = new f.Vector3(1, 0, 0), We = new f.Vector3(0, 1, 0), Ve = new f.Vector3(0, 0, 1);
18
- class Ge {
17
+ const ge = new f.Vector3(0, 0, 1), We = new f.Vector3(1, 0, 0), Ve = new f.Vector3(0, 1, 0), Ge = new f.Vector3(0, 0, 1);
18
+ class Ze {
19
19
  constructor(t = null) {
20
20
  this.opt = Object.assign({
21
21
  warmupMs: 2e3,
@@ -338,7 +338,7 @@ class Ge {
338
338
  ea: [0, 0, 0, 0]
339
339
  // External acceleration [m/s^2]
340
340
  };
341
- u.boneParent.matrixWorld.decompose(k, X, Z), k.copy(me).applyQuaternion(X).setY(0).normalize(), X.premultiply(Le.setFromUnitVectors(me, k).invert()).normalize(), u.qWorldInverseYaw = X.clone().normalize(), this.data.push(u), this.dict[h] = u;
341
+ u.boneParent.matrixWorld.decompose(k, Z, G), k.copy(ge).applyQuaternion(Z).setY(0).normalize(), Z.premultiply(Se.setFromUnitVectors(ge, k).invert()).normalize(), u.qWorldInverseYaw = Z.clone().normalize(), this.data.push(u), this.dict[h] = u;
342
342
  try {
343
343
  this.setValue(h, "type", s.type), this.setValue(h, "stiffness", s.stiffness), this.setValue(h, "damping", s.damping), this.setValue(h, "external", s.external), this.setValue(h, "limits", s.limits), this.setValue(h, "excludes", s.excludes), this.setValue(h, "deltaLocal", s.deltaLocal), this.setValue(h, "deltaWorld", s.deltaWorld), this.setValue(h, "pivot", s.pivot), this.setValue(h, "helper", s.helper);
344
344
  } catch (l) {
@@ -369,9 +369,9 @@ class Ge {
369
369
  o.vBasis.y + A[1],
370
370
  o.vBasis.z - A[2]
371
371
  );
372
- else if (o.boneParent.quaternion.copy(o.qBasis), o.pivot && this.opt.isPivots && (o.boneParent.updateWorldMatrix(!1, !1), o.boneParent.matrixWorld.decompose(k, X, Z), k.copy(me).applyQuaternion(X).setY(0).normalize(), X.premultiply(Le.setFromUnitVectors(me, k).invert()).normalize(), o.boneParent.quaternion.multiply(X.invert()), o.boneParent.quaternion.multiply(o.qWorldInverseYaw)), o.isZ && (m = Math.atan(A[0] / o.l), X.setFromAxisAngle(Ve, -m), o.boneParent.quaternion.multiply(X)), o.isY && (m = o.l / 3, m = m * Math.tanh(A[1] / m), o.bone.position.setLength(o.l + m)), o.isX && (m = Math.atan(A[2] / o.l), X.setFromAxisAngle(Ue, -m), o.boneParent.quaternion.multiply(X)), o.isT && (m = 1.5 * Math.tanh(A[3] * 1.5), X.setFromAxisAngle(We, -m), o.boneParent.quaternion.multiply(X)), o.boneParent.updateWorldMatrix(!1, !0), o.excludes && this.opt.isExcludes)
372
+ else if (o.boneParent.quaternion.copy(o.qBasis), o.pivot && this.opt.isPivots && (o.boneParent.updateWorldMatrix(!1, !1), o.boneParent.matrixWorld.decompose(k, Z, G), k.copy(ge).applyQuaternion(Z).setY(0).normalize(), Z.premultiply(Se.setFromUnitVectors(ge, k).invert()).normalize(), o.boneParent.quaternion.multiply(Z.invert()), o.boneParent.quaternion.multiply(o.qWorldInverseYaw)), o.isZ && (m = Math.atan(A[0] / o.l), Z.setFromAxisAngle(Ge, -m), o.boneParent.quaternion.multiply(Z)), o.isY && (m = o.l / 3, m = m * Math.tanh(A[1] / m), o.bone.position.setLength(o.l + m)), o.isX && (m = Math.atan(A[2] / o.l), Z.setFromAxisAngle(We, -m), o.boneParent.quaternion.multiply(Z)), o.isT && (m = 1.5 * Math.tanh(A[3] * 1.5), Z.setFromAxisAngle(Ve, -m), o.boneParent.quaternion.multiply(Z)), o.boneParent.updateWorldMatrix(!1, !0), o.excludes && this.opt.isExcludes)
373
373
  for (i = 0, s = o.excludes.length; i < s; i++)
374
- m = o.excludes[i], Z.set(0, 0, 0), m.deltaLocal && (Z.x += m.deltaLocal[0], Z.y += m.deltaLocal[1], Z.z += m.deltaLocal[2]), Z.applyMatrix4(m.bone.matrixWorld), te.copy(o.boneParent.matrixWorld).invert(), Z.applyMatrix4(te), k.copy(o.bone.position), !(k.distanceToSquared(Z) >= m.radiusSq) && (J = k.length(), Q = Z.length(), !(Q > m.radius + J) && (Q < Math.abs(m.radius - J) || (Q = (Q * Q + J * J - m.radiusSq) / (2 * Q), Z.normalize(), ce.copy(Z).multiplyScalar(Q), Q = Math.sqrt(J * J - Q * Q), k.subVectors(k, ce).projectOnPlane(Z).normalize().multiplyScalar(Q), de.subVectors(o.vBasis, ce).projectOnPlane(Z).normalize(), J = de.dot(k), J < 0 && (J = Math.sqrt(Q * Q - J * J), de.multiplyScalar(J), k.add(de)), k.add(ce).normalize(), Z.copy(o.bone.position).normalize(), X.setFromUnitVectors(Z, k), o.boneParent.quaternion.premultiply(X), o.boneParent.updateWorldMatrix(!1, !0))));
374
+ m = o.excludes[i], G.set(0, 0, 0), m.deltaLocal && (G.x += m.deltaLocal[0], G.y += m.deltaLocal[1], G.z += m.deltaLocal[2]), G.applyMatrix4(m.bone.matrixWorld), te.copy(o.boneParent.matrixWorld).invert(), G.applyMatrix4(te), k.copy(o.bone.position), !(k.distanceToSquared(G) >= m.radiusSq) && (J = k.length(), Q = G.length(), !(Q > m.radius + J) && (Q < Math.abs(m.radius - J) || (Q = (Q * Q + J * J - m.radiusSq) / (2 * Q), G.normalize(), pe.copy(G).multiplyScalar(Q), Q = Math.sqrt(J * J - Q * Q), k.subVectors(k, pe).projectOnPlane(G).normalize().multiplyScalar(Q), me.subVectors(o.vBasis, pe).projectOnPlane(G).normalize(), J = me.dot(k), J < 0 && (J = Math.sqrt(Q * Q - J * J), me.multiplyScalar(J), k.add(me)), k.add(pe).normalize(), G.copy(o.bone.position).normalize(), Z.setFromUnitVectors(G, k), o.boneParent.quaternion.premultiply(Z), o.boneParent.updateWorldMatrix(!1, !0))));
375
375
  }
376
376
  this.helpers.isActive && this.updateHelpers();
377
377
  }
@@ -489,7 +489,7 @@ class Ge {
489
489
  this.stop(), this.scene = null, this.armature = null, this.config = [], this.data = [], this.dict = {}, this.objectsUpdate = [], this.timerMs = 0;
490
490
  }
491
491
  }
492
- class Ze {
492
+ class Xe {
493
493
  constructor(t) {
494
494
  this.audioContext = t, this.analyzer = null, this.dataArray = null, this.bufferLength = 0;
495
495
  }
@@ -608,8 +608,8 @@ class Ze {
608
608
  for (let l = 0; l < n / 2; l++) {
609
609
  const c = i[(h + l) * 2], d = i[(h + l) * 2 + 1], g = i[(h + l + n / 2) * 2] * a - i[(h + l + n / 2) * 2 + 1] * u, y = i[(h + l + n / 2) * 2] * u + i[(h + l + n / 2) * 2 + 1] * a;
610
610
  i[(h + l) * 2] = c + g, i[(h + l) * 2 + 1] = d + y, i[(h + l + n / 2) * 2] = c - g, i[(h + l + n / 2) * 2 + 1] = d - y;
611
- const x = a * o - u * r, v = a * r + u * o;
612
- a = x, u = v;
611
+ const x = a * o - u * r, I = a * r + u * o;
612
+ a = x, u = I;
613
613
  }
614
614
  }
615
615
  }
@@ -814,7 +814,7 @@ class Ze {
814
814
  return n * s;
815
815
  }
816
816
  }
817
- class Xe {
817
+ class Ye {
818
818
  /**
819
819
  * @constructor
820
820
  */
@@ -1396,11 +1396,11 @@ class Xe {
1396
1396
  return e;
1397
1397
  }
1398
1398
  }
1399
- const Ye = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1399
+ const je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1400
1400
  __proto__: null,
1401
- LipsyncEn: Xe
1401
+ LipsyncEn: Ye
1402
1402
  }, Symbol.toStringTag, { value: "Module" }));
1403
- class je {
1403
+ class Qe {
1404
1404
  /**
1405
1405
  * @constructor
1406
1406
  */
@@ -1754,11 +1754,11 @@ class je {
1754
1754
  return e;
1755
1755
  }
1756
1756
  }
1757
- const Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1757
+ const qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1758
1758
  __proto__: null,
1759
- LipsyncDe: je
1759
+ LipsyncDe: Qe
1760
1760
  }, Symbol.toStringTag, { value: "Module" }));
1761
- class qe {
1761
+ class _e {
1762
1762
  /**
1763
1763
  * @constructor
1764
1764
  */
@@ -2289,11 +2289,11 @@ class qe {
2289
2289
  return e;
2290
2290
  }
2291
2291
  }
2292
- const _e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2292
+ const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2293
2293
  __proto__: null,
2294
- LipsyncFr: qe
2294
+ LipsyncFr: _e
2295
2295
  }, Symbol.toStringTag, { value: "Module" }));
2296
- class Ke {
2296
+ class Je {
2297
2297
  /**
2298
2298
  * @constructor
2299
2299
  */
@@ -2436,11 +2436,11 @@ class Ke {
2436
2436
  return e;
2437
2437
  }
2438
2438
  }
2439
- const Je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2439
+ const $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2440
2440
  __proto__: null,
2441
- LipsyncFi: Ke
2441
+ LipsyncFi: Je
2442
2442
  }, Symbol.toStringTag, { value: "Module" }));
2443
- class $e {
2443
+ class et {
2444
2444
  /**
2445
2445
  * @constructor
2446
2446
  */
@@ -2620,24 +2620,24 @@ class $e {
2620
2620
  return e;
2621
2621
  }
2622
2622
  }
2623
- const et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2623
+ const tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2624
2624
  __proto__: null,
2625
- LipsyncLt: $e
2626
- }, Symbol.toStringTag, { value: "Module" })), tt = new URL("data:text/javascript;base64,Y2xhc3MgUGxheWJhY2tXb3JrbGV0IGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgRlNNID0gewogICAgSURMRTogMCwKICAgIFBMQVlJTkc6IDEsCiAgfTsKCiAgY29uc3RydWN0b3Iob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H0KICAgICAgICAgICAgLy8gU2VuZCBmaW5hbCBtZXRyaWNzIHNob3dpbmcgY2xlYXJlZCBzdGF0ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9IGNhdGNoIChfKSB7IH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnJlc2V0KCk7IC8vIFJlc2V0IHRvIElETEUgc3RhdGUgZm9yIHJldXNlCiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlIGxvb3AKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIC8vIEJVRkZFUiBVTkRFUlJVTiAoTEFHKTogUGxheSBzaWxlbmNlIGFuZCB3YWl0IGZvciBtb3JlIGRhdGEuCiAgICAgICAgICAgIHRoaXMuX3NpbGVuY2VGcmFtZX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ykgewogICAgICAgIHRoaXMuX2xhc3RNZXRyaWNzU2VudEF0RnJhbWUgPSB0aGlzLl9mcmFtZXNQcm9jZXNzZWQ7CiAgICAgICAgdHJ5IHsKICAgICAgICAgIHRoaXMucG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgIHR5cGU6ICJtZXRyaWNzIiwKICAgICAgICAgICAgZGF0YTogewogICAgICAgICAgICAgIHN0YXRlOiB0aGlzLl9zdGF0ZSwKICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzLAogICAgICAgICAgICAgIHF1ZXVlZE1zOiBNYXRoLnJvdW5kKChxdWV1ZWRTYW1wbGVzIC8gdGhpcy5fc2FtcGxlUmF0ZSkgKiAxMDAwKSwKICAgICAgICAgICAgICBtYXhRdWV1ZWRNczogTWF0aC5yb3VuZCgodGhpcy5fbWF4UXVldWVTYW1wbGVzIC8gdGhpcy5fc2FtcGxlUmF0ZSkgKiAxMDAwKSwKICAgICAgICAgICAgICB1bmRlcnJ1bkJsb2NrczogdGhpcy5fdW5kZXJydW5CbG9ja3MsCiAgICAgICAgICAgICAgZnJhbWVzUHJvY2Vzc2VkOiB0aGlzLl9mcmFtZXNQcm9jZXNzZWQKICAgICAgICAgICAgfQogICAgICAgICAgfSk7CiAgICAgICAgfSBjYXRjaCAoXykgeyB9CiAgICAgICAgLy8gRG9uJ3QgcmVzZXQgbWF4IHRyYWNrZXIgLSBrZWVwIHNlc3Npb24gcGVhayB1bnRpbCBpZGxlCiAgICAgIH0KICAgIH0KCiAgICAvLyBBTFdBWVMgcmV0dXJuIHRydWUgdG8ga2VlcCB0aGUgcHJvY2Vzc29yIGFsaXZlIGZvciByZXVzZS4KICAgIHJldHVybiB0cnVlOwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoInBsYXliYWNrLXdvcmtsZXQiLCBQbGF5YmFja1dvcmtsZXQpOwo=", import.meta.url), Se = {
2627
- en: Ye,
2628
- de: Qe,
2629
- fr: _e,
2630
- fi: Je,
2631
- lt: et
2632
- }, N = new f.Quaternion(), M = new f.Euler(), ie = new f.Vector3(), ne = new f.Vector3(), ke = new f.Box3();
2625
+ LipsyncLt: et
2626
+ }, Symbol.toStringTag, { value: "Module" })), it = new URL("data:text/javascript;base64,Y2xhc3MgUGxheWJhY2tXb3JrbGV0IGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgRlNNID0gewogICAgSURMRTogMCwKICAgIFBMQVlJTkc6IDEsCiAgfTsKCiAgY29uc3RydWN0b3Iob3B0aW9ucykgewogICAgc3VwZXIoKTsKICAgIHRoaXMucG9ydC5vbm1lc3NhZ2UgPSB0aGlzLmhhbmRsZU1lc3NhZ2UuYmluZCh0aGlzKTsKCiAgICB0aGlzLl9zYW1wbGVSYXRlID0gb3B0aW9ucz8ucHJvY2Vzc29yT3B0aW9ucz8uc2FtcGxlUmF0ZSB8fCBzYW1wbGVSYXRlOwogICAgdGhpcy5fc2NhbGUgPSAxIC8gMzI3Njg7IC8vIFBDTTE2IC0+IGZsb2F0CgogICAgLy8gU2lsZW5jZSBkZXRlY3Rpb24gdGhyZXNob2xkICgxIHNlY29uZCkgYXMgYSBmYWxsYmFjayBzYWZldHkgbmV0CiAgICBjb25zdCBzaWxlbmNlRHVyYXRpb25TZWNvbmRzID0gMS4wOwogICAgdGhpcy5fc2lsZW5jZVRocmVzaG9sZEJsb2NrcyA9IE1hdGguY2VpbCgodGhpcy5fc2FtcGxlUmF0ZSAqIHNpbGVuY2VEdXJhdGlvblNlY29uZHMpIC8gMTI4KTsKCiAgICAvLyBNZXRyaWNzIGNvbmZpZ3VyYXRpb24gdmlhIG9wdGlvbnMKICAgIGNvbnN0IG1ldHJpY3NDZmcgPSBvcHRpb25zPy5wcm9jZXNzb3JPcHRpb25zPy5tZXRyaWNzIHx8IHt9OwogICAgdGhpcy5fbWV0cmljc0VuYWJsZWQgPSBtZXRyaWNzQ2ZnLmVuYWJsZWQgIT09IGZhbHNlOwogICAg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dCkgewogICAgICAgICAgICAvLyBFTkQgT0YgUExBWUJBQ0s6IEVpdGhlciBleHBsaWNpdGx5IHNpZ25hbGVkIG9yIHRpbWVkIG91dC4KICAgICAgICAgICAgaWYgKCF0aGlzLl9oYXNTZW50RW5kZWQpIHsKICAgICAgICAgICAgICB0aGlzLnBvcnQucG9zdE1lc3NhZ2UoeyB0eXBlOiAicGxheWJhY2stZW5kZWQiIH0pOwogICAgICAgICAgICAgIHRoaXMuX2hhc1NlbnRFbmRlZCA9IHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgLy8gU2VuZCBmaW5hbCBtZXRyaWNzIHNob3dpbmcgY2xlYXJlZCBzdGF0ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9IGNhdGNoIChfKSB7IH0KICAgICA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gcGVhayB1bnRpbCBpZGxlCiAgICAgIH0KICAgIH0KCiAgICAvLyBBTFdBWVMgcmV0dXJuIHRydWUgdG8ga2VlcCB0aGUgcHJvY2Vzc29yIGFsaXZlIGZvciByZXVzZS4KICAgIHJldHVybiB0cnVlOwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoInBsYXliYWNrLXdvcmtsZXQiLCBQbGF5YmFja1dvcmtsZXQpOwo=", import.meta.url), ke = {
2627
+ en: je,
2628
+ de: qe,
2629
+ fr: Ke,
2630
+ fi: $e,
2631
+ lt: tt
2632
+ }, N = new f.Quaternion(), M = new f.Euler(), ie = new f.Vector3(), ne = new f.Vector3(), we = new f.Box3();
2633
2633
  new f.Matrix4();
2634
2634
  new f.Matrix4();
2635
2635
  new f.Vector3();
2636
2636
  new f.Vector3(0, 0, 1);
2637
- const it = new f.Vector3(1, 0, 0);
2637
+ const nt = new f.Vector3(1, 0, 0);
2638
2638
  new f.Vector3(0, 1, 0);
2639
2639
  new f.Vector3(0, 0, 1);
2640
- class Ce {
2640
+ class He {
2641
2641
  /**
2642
2642
  * Avatar.
2643
2643
  * @typedef {Object} Avatar
@@ -2763,7 +2763,7 @@ class Ce {
2763
2763
  avatarOnlyCamera: null,
2764
2764
  statsNode: null,
2765
2765
  statsStyle: null
2766
- }, Object.assign(this.opt, e || {}), this.opt.statsNode && (this.stats = new Ne(), this.opt.statsStyle && (this.stats.dom.style.cssText = this.opt.statsStyle), this.opt.statsNode.appendChild(this.stats.dom)), this.poseTemplates = {
2766
+ }, Object.assign(this.opt, e || {}), this.opt.statsNode && (this.stats = new Ue(), this.opt.statsStyle && (this.stats.dom.style.cssText = this.opt.statsStyle), this.opt.statsNode.appendChild(this.stats.dom)), this.poseTemplates = {
2767
2767
  side: {
2768
2768
  standing: !0,
2769
2769
  props: {
@@ -4062,7 +4062,7 @@ class Ce {
4062
4062
  this.opt.lightSpotDispersion
4063
4063
  ), this.setLighting(this.opt);
4064
4064
  const r = new f.PMREMGenerator(this.renderer);
4065
- r.compileEquirectangularShader(), this.scene.environment = r.fromScene(new Oe()).texture, this.resizeobserver = new ResizeObserver(this.onResize.bind(this)), this.resizeobserver.observe(this.nodeAvatar), this.controls = new Pe(this.camera, this.renderer.domElement), this.controls.enableZoom = this.opt.cameraZoomEnable, this.controls.enableRotate = this.opt.cameraRotateEnable, this.controls.enablePan = this.opt.cameraPanEnable, this.controls.minDistance = 2, this.controls.maxDistance = 2e3, this.controls.autoRotateSpeed = 0, this.controls.autoRotate = !1, this.controls.update(), this.cameraClock = null;
4065
+ r.compileEquirectangularShader(), this.scene.environment = r.fromScene(new Ne()).texture, this.resizeobserver = new ResizeObserver(this.onResize.bind(this)), this.resizeobserver.observe(this.nodeAvatar), this.controls = new Be(this.camera, this.renderer.domElement), this.controls.enableZoom = this.opt.cameraZoomEnable, this.controls.enableRotate = this.opt.cameraRotateEnable, this.controls.enablePan = this.opt.cameraPanEnable, this.controls.minDistance = 2, this.controls.maxDistance = 2e3, this.controls.autoRotateSpeed = 0, this.controls.autoRotate = !1, this.controls.update(), this.cameraClock = null;
4066
4066
  }
4067
4067
  this.ikMesh = new f.SkinnedMesh();
4068
4068
  const s = {
@@ -4080,14 +4080,14 @@ class Ce {
4080
4080
  Object.entries(s).forEach((r, h) => {
4081
4081
  const a = new f.Bone();
4082
4082
  a.name = r[0], r[1] ? this.ikMesh.getObjectByName(r[1]).add(a) : this.ikMesh.add(a), o.push(a);
4083
- }), this.ikMesh.bind(new f.Skeleton(o)), this.dynamicbones = new Ge(), this.isStreaming = !1, this.streamWorkletNode = null, this.streamAudioStartTime = null, this.streamWaitForAudioChunks = !0, this.streamLipsyncLang = null, this.streamLipsyncType = "visemes", this.streamLipsyncQueue = [];
4083
+ }), this.ikMesh.bind(new f.Skeleton(o)), this.dynamicbones = new Ze(), this.isStreaming = !1, this.streamWorkletNode = null, this.streamAudioStartTime = null, this.streamWaitForAudioChunks = !0, this.streamLipsyncLang = null, this.streamLipsyncType = "visemes", this.streamLipsyncQueue = [];
4084
4084
  }
4085
4085
  /**
4086
4086
  * Helper that re/creates the audio context and the other nodes.
4087
4087
  * @param {number} sampleRate
4088
4088
  */
4089
4089
  initAudioGraph(t = null) {
4090
- if (this.audioCtx && this.audioCtx.state !== "closed" && this.audioCtx.close(), t ? this.audioCtx = new AudioContext({ sampleRate: t }) : this.audioCtx = new AudioContext(), this.audioSpeechSource = this.audioCtx.createBufferSource(), this.audioBackgroundSource = this.audioCtx.createBufferSource(), this.audioBackgroundGainNode = this.audioCtx.createGain(), this.audioSpeechGainNode = this.audioCtx.createGain(), this.audioStreamGainNode = this.audioCtx.createGain(), this.audioAnalyzerNode = this.audioCtx.createAnalyser(), this.audioAnalyzerNode.fftSize = 256, this.audioAnalyzerNode.smoothingTimeConstant = 0.1, this.audioAnalyzerNode.minDecibels = -70, this.audioAnalyzerNode.maxDecibels = -10, this.audioAnalyzer = new Ze(this.audioCtx), this.audioReverbNode = this.audioCtx.createConvolver(), this.audioBackgroundGainNode.connect(this.audioReverbNode), this.audioAnalyzerNode.connect(this.audioSpeechGainNode), this.audioSpeechGainNode.connect(this.audioReverbNode), this.audioStreamGainNode.connect(this.audioReverbNode), this.audioReverbNode.connect(this.audioCtx.destination), this.setReverb(this.currentReverb || null), this.setMixerGain(
4090
+ if (this.audioCtx && this.audioCtx.state !== "closed" && this.audioCtx.close(), t ? this.audioCtx = new AudioContext({ sampleRate: t }) : this.audioCtx = new AudioContext(), this.audioSpeechSource = this.audioCtx.createBufferSource(), this.audioBackgroundSource = this.audioCtx.createBufferSource(), this.audioBackgroundGainNode = this.audioCtx.createGain(), this.audioSpeechGainNode = this.audioCtx.createGain(), this.audioStreamGainNode = this.audioCtx.createGain(), this.audioAnalyzerNode = this.audioCtx.createAnalyser(), this.audioAnalyzerNode.fftSize = 256, this.audioAnalyzerNode.smoothingTimeConstant = 0.1, this.audioAnalyzerNode.minDecibels = -70, this.audioAnalyzerNode.maxDecibels = -10, this.audioAnalyzer = new Xe(this.audioCtx), this.audioReverbNode = this.audioCtx.createConvolver(), this.audioBackgroundGainNode.connect(this.audioReverbNode), this.audioAnalyzerNode.connect(this.audioSpeechGainNode), this.audioSpeechGainNode.connect(this.audioReverbNode), this.audioStreamGainNode.connect(this.audioReverbNode), this.audioReverbNode.connect(this.audioCtx.destination), this.setReverb(this.currentReverb || null), this.setMixerGain(
4091
4091
  this.opt.mixerGainSpeech,
4092
4092
  this.opt.mixerGainBackground
4093
4093
  ), this.workletLoaded = !1, this.streamWorkletNode) {
@@ -4204,13 +4204,13 @@ class Ce {
4204
4204
  const l = s.morphTargetDictionary[a], c = o.morphAttributes.position[l], d = o.morphAttributes.normal?.[l];
4205
4205
  r || (r = new f.Float32BufferAttribute(c.count * 3, 3), d && (h = new f.Float32BufferAttribute(c.count * 3, 3)));
4206
4206
  for (let g = 0; g < c.count; g++) {
4207
- const y = r.getX(g) + c.getX(g) * u, x = r.getY(g) + c.getY(g) * u, v = r.getZ(g) + c.getZ(g) * u;
4208
- r.setXYZ(g, y, x, v);
4207
+ const y = r.getX(g) + c.getX(g) * u, x = r.getY(g) + c.getY(g) * u, I = r.getZ(g) + c.getZ(g) * u;
4208
+ r.setXYZ(g, y, x, I);
4209
4209
  }
4210
4210
  if (d)
4211
4211
  for (let g = 0; g < c.count; g++) {
4212
- const y = h.getX(g) + d.getX(g) * u, x = h.getY(g) + d.getY(g) * u, v = h.getZ(g) + d.getZ(g) * u;
4213
- h.setXYZ(g, y, x, v);
4212
+ const y = h.getX(g) + d.getX(g) * u, x = h.getY(g) + d.getY(g) * u, I = h.getZ(g) + d.getZ(g) * u;
4213
+ h.setXYZ(g, y, x, I);
4214
4214
  }
4215
4215
  }
4216
4216
  if (r) {
@@ -4228,9 +4228,9 @@ class Ce {
4228
4228
  async showAvatar(t, e = null) {
4229
4229
  if (!t || !t.hasOwnProperty("url"))
4230
4230
  throw new Error("Invalid parameter. The avatar must have at least 'url' specified.");
4231
- const i = new Be();
4231
+ const i = new De();
4232
4232
  if (this.dracoEnabled) {
4233
- const a = new De();
4233
+ const a = new Oe();
4234
4234
  a.setDecoderPath(this.dracoDecoderPath), i.setDRACOLoader(a);
4235
4235
  }
4236
4236
  let n = await i.loadAsync(t.url, e);
@@ -5180,7 +5180,7 @@ class Ce {
5180
5180
  eyeLookOutRight: [null, 0],
5181
5181
  eyeContact: [0]
5182
5182
  }
5183
- })))), e > 2 * this.animFrameDur && (e = 2 * this.animFrameDur), (this.viewName !== "full" || this.isAvatarOnly) && (i = this.mtRandomized[Math.floor(Math.random() * this.mtRandomized.length)], n = this.mtAvatar[i], n.needsUpdate || Object.assign(n, { base: (this.mood.baseline[i] || 0) + (1 + r / 255) * Math.random() / 5, needsUpdate: !0 })), this.updatePoseBase(this.animClock), this.mixer && this.mixer.update(e / 1e3 * this.mixer.timeScale), this.updatePoseDelta(), (this.isSpeaking || this.isListening) && h ? r > this.volumeMax ? (this.volumeHeadBase = 0.05, Math.random() > 0.6 && (this.volumeHeadTarget = -0.05 - Math.random() / 15), this.volumeMax = r) : (this.volumeMax *= 0.92, this.volumeHeadTarget = this.volumeHeadBase - 0.9 * (this.volumeHeadBase - this.volumeHeadTarget)) : (this.volumeHeadTarget = 0, this.volumeMax = 0), i = this.volumeHeadTarget - this.volumeHeadCurrent, n = Math.abs(i), n > 1e-4 && (o = n * (this.volumeHeadEasing(Math.min(1, this.volumeHeadVelocity * e / 1e3 / n) / 2 + 0.5) - 0.5), this.volumeHeadCurrent += Math.sign(i) * Math.min(n, o)), Math.abs(this.volumeHeadCurrent) > 1e-4 && (N.setFromAxisAngle(it, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(N)), ke.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(ie), ie.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(ne), ne.sub(this.armature.position), this.objectHips.position.y -= ke.min.y / 2, this.objectHips.position.x -= (ie.x + ne.x) / 4, this.objectHips.position.z -= (ie.z + ne.z) / 2, this.dynamicbones.update(e), this.fbxAnimationLoader && this.fbxAnimationLoader.update(), this.opt.update && this.opt.update(e), this.updateMorphTargets(e), this.isAvatarOnly)
5183
+ })))), e > 2 * this.animFrameDur && (e = 2 * this.animFrameDur), (this.viewName !== "full" || this.isAvatarOnly) && (i = this.mtRandomized[Math.floor(Math.random() * this.mtRandomized.length)], n = this.mtAvatar[i], n.needsUpdate || Object.assign(n, { base: (this.mood.baseline[i] || 0) + (1 + r / 255) * Math.random() / 5, needsUpdate: !0 })), this.updatePoseBase(this.animClock), this.mixer && this.mixer.update(e / 1e3 * this.mixer.timeScale), this.updatePoseDelta(), (this.isSpeaking || this.isListening) && h ? r > this.volumeMax ? (this.volumeHeadBase = 0.05, Math.random() > 0.6 && (this.volumeHeadTarget = -0.05 - Math.random() / 15), this.volumeMax = r) : (this.volumeMax *= 0.92, this.volumeHeadTarget = this.volumeHeadBase - 0.9 * (this.volumeHeadBase - this.volumeHeadTarget)) : (this.volumeHeadTarget = 0, this.volumeMax = 0), i = this.volumeHeadTarget - this.volumeHeadCurrent, n = Math.abs(i), n > 1e-4 && (o = n * (this.volumeHeadEasing(Math.min(1, this.volumeHeadVelocity * e / 1e3 / n) / 2 + 0.5) - 0.5), this.volumeHeadCurrent += Math.sign(i) * Math.min(n, o)), Math.abs(this.volumeHeadCurrent) > 1e-4 && (N.setFromAxisAngle(nt, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(N)), we.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(ie), ie.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(ne), ne.sub(this.armature.position), this.objectHips.position.y -= we.min.y / 2, this.objectHips.position.x -= (ie.x + ne.x) / 4, this.objectHips.position.z -= (ie.z + ne.z) / 2, this.dynamicbones.update(e), this.fbxAnimationLoader && this.fbxAnimationLoader.update(), this.opt.update && this.opt.update(e), this.updateMorphTargets(e), this.isAvatarOnly)
5184
5184
  this.stats && this.stats.end();
5185
5185
  else {
5186
5186
  if (this.cameraClock !== null && this.cameraClock < 1e3) {
@@ -5211,8 +5211,8 @@ class Ce {
5211
5211
  if (!this.lipsync.hasOwnProperty(t)) {
5212
5212
  const i = t.toLowerCase(), n = "Lipsync" + t.charAt(0).toUpperCase() + t.slice(1);
5213
5213
  try {
5214
- const s = Se[i];
5215
- s && s[n] ? (this.lipsync[t] = new s[n](), console.log(`Loaded lip-sync module for ${t}`)) : console.warn(`Lip-sync module for ${t} not found. Available modules:`, Object.keys(Se));
5214
+ const s = ke[i];
5215
+ s && s[n] ? (this.lipsync[t] = new s[n](), console.log(`Loaded lip-sync module for ${t}`)) : console.warn(`Lip-sync module for ${t} not found. Available modules:`, Object.keys(ke));
5216
5216
  } catch (s) {
5217
5217
  console.warn(`Failed to load lip-sync module for ${t}:`, s);
5218
5218
  }
@@ -5251,10 +5251,10 @@ class Ce {
5251
5251
  let u = "", l = "", c = 0, d = [], g = [];
5252
5252
  const y = Array.from(this.segmenter.segment(t), (x) => x.segment);
5253
5253
  for (let x = 0; x < y.length; x++) {
5254
- const v = x === y.length - 1, H = y[x].match(r);
5254
+ const I = x === y.length - 1, T = y[x].match(r);
5255
5255
  let p = y[x].match(s);
5256
- const F = y[x].match(h), z = y[x].match(o);
5257
- if (p && !v && !F && y[x + 1].match(s) && (p = !1), i && (u += y[x]), H && (!n || n.every((I) => x < I[0] || x > I[1])) && (l += y[x]), (z || p || v) && (l.length && (l = this.lipsyncPreProcessText(l, a), l.length && d.push({
5256
+ const F = y[x].match(h), C = y[x].match(o);
5257
+ if (p && !I && !F && y[x + 1].match(s) && (p = !1), i && (u += y[x]), T && (!n || n.every((R) => x < R[0] || x > R[1])) && (l += y[x]), (C || p || I) && (l.length && (l = this.lipsyncPreProcessText(l, a), l.length && d.push({
5258
5258
  mark: c,
5259
5259
  word: l
5260
5260
  })), u.length && (g.push({
@@ -5265,31 +5265,31 @@ class Ce {
5265
5265
  subtitles: [u]
5266
5266
  }
5267
5267
  }), u = ""), l.length)) {
5268
- const I = this.lipsyncWordsToVisemes(l, a);
5269
- if (I && I.visemes && I.visemes.length) {
5270
- const O = I.times[I.visemes.length - 1] + I.durations[I.visemes.length - 1];
5271
- for (let B = 0; B < I.visemes.length; B++)
5268
+ const R = this.lipsyncWordsToVisemes(l, a);
5269
+ if (R && R.visemes && R.visemes.length) {
5270
+ const O = R.times[R.visemes.length - 1] + R.durations[R.visemes.length - 1];
5271
+ for (let B = 0; B < R.visemes.length; B++)
5272
5272
  g.push({
5273
5273
  mark: c,
5274
5274
  template: { name: "viseme" },
5275
- ts: [(I.times[B] - 0.6) / O, (I.times[B] + 0.5) / O, (I.times[B] + I.durations[B] + 0.5) / O],
5275
+ ts: [(R.times[B] - 0.6) / O, (R.times[B] + 0.5) / O, (R.times[B] + R.durations[B] + 0.5) / O],
5276
5276
  vs: {
5277
- ["viseme_" + I.visemes[B]]: [null, I.visemes[B] === "PP" || I.visemes[B] === "FF" ? 0.9 : 0.6, 0]
5277
+ ["viseme_" + R.visemes[B]]: [null, R.visemes[B] === "PP" || R.visemes[B] === "FF" ? 0.9 : 0.6, 0]
5278
5278
  }
5279
5279
  });
5280
5280
  }
5281
5281
  l = "", c++;
5282
5282
  }
5283
- if (p || v) {
5284
- if (d.length || v && g.length) {
5285
- const I = {
5283
+ if (p || I) {
5284
+ if (d.length || I && g.length) {
5285
+ const R = {
5286
5286
  anim: g
5287
5287
  };
5288
- i && (I.onSubtitles = i), d.length && !e.avatarMute && (I.text = d, e.avatarMood && (I.mood = e.avatarMood), e.ttsLang && (I.lang = e.ttsLang), e.ttsVoice && (I.voice = e.ttsVoice), e.ttsRate && (I.rate = e.ttsRate), e.ttsVoice && (I.pitch = e.ttsPitch), e.ttsVolume && (I.volume = e.ttsVolume)), this.speechQueue.push(I), d = [], l = "", c = 0, g = [];
5288
+ i && (R.onSubtitles = i), d.length && !e.avatarMute && (R.text = d, e.avatarMood && (R.mood = e.avatarMood), e.ttsLang && (R.lang = e.ttsLang), e.ttsVoice && (R.voice = e.ttsVoice), e.ttsRate && (R.rate = e.ttsRate), e.ttsVoice && (R.pitch = e.ttsPitch), e.ttsVolume && (R.volume = e.ttsVolume)), this.speechQueue.push(R), d = [], l = "", c = 0, g = [];
5289
5289
  }
5290
5290
  if (F) {
5291
- let I = this.animEmojis[y[x]];
5292
- I && I.link && (I = this.animEmojis[I.link]), I && this.speechQueue.push({ emoji: I });
5291
+ let R = this.animEmojis[y[x]];
5292
+ R && R.link && (R = this.animEmojis[R.link]), R && this.speechQueue.push({ emoji: R });
5293
5293
  }
5294
5294
  this.speechQueue.push({ break: 100 });
5295
5295
  }
@@ -5385,10 +5385,10 @@ class Ce {
5385
5385
  let y = 0.6 + this.convertRange(g, [0, u], [0, 0.4]);
5386
5386
  if (u = Math.min(u, c.visemes.length * 200), d > 0)
5387
5387
  for (let x = 0; x < c.visemes.length; x++) {
5388
- const v = a + c.times[x] / d * u, H = c.durations[x] / d * u;
5388
+ const I = a + c.times[x] / d * u, T = c.durations[x] / d * u;
5389
5389
  o.push({
5390
5390
  template: { name: "viseme" },
5391
- ts: [v - Math.min(60, 2 * H / 3), v + Math.min(25, H / 2), v + H + Math.min(60, H / 2)],
5391
+ ts: [I - Math.min(60, 2 * T / 3), I + Math.min(25, T / 2), I + T + Math.min(60, T / 2)],
5392
5392
  vs: {
5393
5393
  ["viseme_" + c.visemes[x]]: [null, c.visemes[x] === "PP" || c.visemes[x] === "FF" ? 0.9 : y, 0]
5394
5394
  }
@@ -5482,22 +5482,22 @@ class Ce {
5482
5482
  hasVisemes: x && x.visemes && x.visemes.length > 0,
5483
5483
  estimatedDuration: c
5484
5484
  });
5485
- const v = [];
5485
+ const I = [];
5486
5486
  if (x && x.visemes && x.visemes.length > 0) {
5487
5487
  const p = x.times[x.visemes.length - 1] + x.durations[x.visemes.length - 1];
5488
5488
  for (let F = 0; F < x.visemes.length; F++) {
5489
- const z = x.visemes[F], I = x.times[F] / p, O = x.durations[F] / p, B = I * c, $ = O * c;
5490
- v.push({
5489
+ const C = x.visemes[F], R = x.times[F] / p, O = x.durations[F] / p, B = R * c, $ = O * c;
5490
+ I.push({
5491
5491
  template: { name: "viseme" },
5492
5492
  ts: [B - Math.min(60, 2 * $ / 3), B + Math.min(25, $ / 2), B + $ + Math.min(60, $ / 2)],
5493
5493
  vs: {
5494
- ["viseme_" + z]: [null, z === "PP" || z === "FF" ? 0.9 : 0.6, 0]
5494
+ ["viseme_" + C]: [null, C === "PP" || C === "FF" ? 0.9 : 0.6, 0]
5495
5495
  }
5496
5496
  });
5497
5497
  }
5498
5498
  }
5499
- const H = [...t.anim, ...v];
5500
- this.audioPlaylist.push({ anim: H, audio: d }), this.onSubtitles = t.onSubtitles || null, this.resetLips(), t.mood && this.setMood(t.mood), this.playAudio(), s.onend = () => {
5499
+ const T = [...t.anim, ...I];
5500
+ this.audioPlaylist.push({ anim: T, audio: d }), this.onSubtitles = t.onSubtitles || null, this.resetLips(), t.mood && this.setMood(t.mood), this.playAudio(), s.onend = () => {
5501
5501
  e();
5502
5502
  }, s.onerror = (p) => {
5503
5503
  console.error("Speech synthesis error:", p.error), i(p.error);
@@ -5564,8 +5564,8 @@ class Ce {
5564
5564
  const d = e.toLowerCase().split(/\s+/), g = [];
5565
5565
  for (const y of d)
5566
5566
  for (const x of y) {
5567
- let v = "aa";
5568
- "aeiou".includes(x) ? v = "aa" : "bp".includes(x) ? v = "PP" : "fv".includes(x) ? v = "FF" : "st".includes(x) ? v = "SS" : "dln".includes(x) ? v = "DD" : "kg".includes(x) ? v = "kk" : "rw".includes(x) && (v = "RR"), g.push(v);
5567
+ let I = "aa";
5568
+ "aeiou".includes(x) ? I = "aa" : "bp".includes(x) ? I = "PP" : "fv".includes(x) ? I = "FF" : "st".includes(x) ? I = "SS" : "dln".includes(x) ? I = "DD" : "kg".includes(x) ? I = "kk" : "rw".includes(x) && (I = "RR"), g.push(I);
5569
5569
  }
5570
5570
  a = {
5571
5571
  visemes: g.map((y, x) => ({
@@ -5662,8 +5662,8 @@ class Ce {
5662
5662
  const d = e.toLowerCase().split(/\s+/), g = [];
5663
5663
  for (const y of d)
5664
5664
  for (const x of y) {
5665
- let v = "aa";
5666
- "aeiou".includes(x) ? v = "aa" : "bp".includes(x) ? v = "PP" : "fv".includes(x) ? v = "FF" : "st".includes(x) ? v = "SS" : "dln".includes(x) ? v = "DD" : "kg".includes(x) ? v = "kk" : "rw".includes(x) && (v = "RR"), g.push(v);
5665
+ let I = "aa";
5666
+ "aeiou".includes(x) ? I = "aa" : "bp".includes(x) ? I = "PP" : "fv".includes(x) ? I = "FF" : "st".includes(x) ? I = "SS" : "dln".includes(x) ? I = "DD" : "kg".includes(x) ? I = "kk" : "rw".includes(x) && (I = "RR"), g.push(I);
5667
5667
  }
5668
5668
  a = {
5669
5669
  visemes: g.map((y, x) => ({
@@ -5895,7 +5895,7 @@ class Ce {
5895
5895
  }
5896
5896
  if (!this.workletLoaded)
5897
5897
  try {
5898
- const r = this.audioCtx.audioWorklet.addModule(tt.href), h = new Promise(
5898
+ const r = this.audioCtx.audioWorklet.addModule(it.href), h = new Promise(
5899
5899
  (a, u) => setTimeout(() => u(new Error("Worklet loading timed out")), 5e3)
5900
5900
  );
5901
5901
  await Promise.race([r, h]), this.workletLoaded = !0;
@@ -6153,7 +6153,7 @@ class Ce {
6153
6153
  M.setFromQuaternion(h, "YXZ");
6154
6154
  let a = M.x / (40 / 24) + 0.2, u = M.y / (9 / 4), l = Math.min(0.6, Math.max(-0.3, a)), c = Math.min(0.8, Math.max(-0.8, u)), d = (Math.random() - 0.5) / 4, g = (Math.random() - 0.5) / 4;
6155
6155
  if (t) {
6156
- let y = this.animQueue.findIndex((v) => v.template.name === "lookat");
6156
+ let y = this.animQueue.findIndex((I) => I.template.name === "lookat");
6157
6157
  y !== -1 && this.animQueue.splice(y, 1);
6158
6158
  const x = {
6159
6159
  name: "lookat",
@@ -6187,19 +6187,19 @@ class Ce {
6187
6187
  r.project(this.camera);
6188
6188
  let h = (r.x + 1) / 2 * n.width + n.left, a = -(r.y - 1) / 2 * n.height + n.top;
6189
6189
  t === null && (t = h), e === null && (e = a), N.copy(this.armature.quaternion), N.multiply(this.poseTarget.props["Hips.quaternion"]), N.multiply(this.poseTarget.props["Spine.quaternion"]), N.multiply(this.poseTarget.props["Spine1.quaternion"]), N.multiply(this.poseTarget.props["Spine2.quaternion"]), N.multiply(this.poseTarget.props["Neck.quaternion"]), N.multiply(this.poseTarget.props["Head.quaternion"]), M.setFromQuaternion(N);
6190
- let u = M.x / (40 / 24), l = M.y / (9 / 4), c = Math.min(0.4, Math.max(-0.4, this.camera.rotation.x)), d = Math.min(0.4, Math.max(-0.4, this.camera.rotation.y)), g = Math.max(window.innerWidth - h, h), y = Math.max(window.innerHeight - a, a), x = this.convertRange(e, [a - y, a + y], [-0.3, 0.6]) - u + c, v = this.convertRange(t, [h - g, h + g], [-0.8, 0.8]) - l + d;
6191
- x = Math.min(0.6, Math.max(-0.3, x)), v = Math.min(0.8, Math.max(-0.8, v));
6192
- let H = (Math.random() - 0.5) / 4, p = (Math.random() - 0.5) / 4;
6190
+ let u = M.x / (40 / 24), l = M.y / (9 / 4), c = Math.min(0.4, Math.max(-0.4, this.camera.rotation.x)), d = Math.min(0.4, Math.max(-0.4, this.camera.rotation.y)), g = Math.max(window.innerWidth - h, h), y = Math.max(window.innerHeight - a, a), x = this.convertRange(e, [a - y, a + y], [-0.3, 0.6]) - u + c, I = this.convertRange(t, [h - g, h + g], [-0.8, 0.8]) - l + d;
6191
+ x = Math.min(0.6, Math.max(-0.3, x)), I = Math.min(0.8, Math.max(-0.8, I));
6192
+ let T = (Math.random() - 0.5) / 4, p = (Math.random() - 0.5) / 4;
6193
6193
  if (i) {
6194
- let F = this.animQueue.findIndex((I) => I.template.name === "lookat");
6194
+ let F = this.animQueue.findIndex((R) => R.template.name === "lookat");
6195
6195
  F !== -1 && this.animQueue.splice(F, 1);
6196
- const z = {
6196
+ const C = {
6197
6197
  name: "lookat",
6198
6198
  dt: [750, i],
6199
6199
  vs: {
6200
- bodyRotateX: [x + H],
6201
- bodyRotateY: [v + p],
6202
- eyesRotateX: [-3 * H + 0.1],
6200
+ bodyRotateX: [x + T],
6201
+ bodyRotateY: [I + p],
6202
+ eyesRotateX: [-3 * T + 0.1],
6203
6203
  eyesRotateY: [-5 * p],
6204
6204
  browInnerUp: [[0, 0.7]],
6205
6205
  mouthLeft: [[0, 0.7]],
@@ -6208,7 +6208,7 @@ class Ce {
6208
6208
  headMove: [0]
6209
6209
  }
6210
6210
  };
6211
- this.animQueue.push(this.animFactory(z));
6211
+ this.animQueue.push(this.animFactory(C));
6212
6212
  }
6213
6213
  }
6214
6214
  /**
@@ -6403,7 +6403,7 @@ class Ce {
6403
6403
  } catch (c) {
6404
6404
  console.warn(`Could not verify file existence for ${t}, attempting to load anyway:`, c);
6405
6405
  }
6406
- const u = new Ae();
6406
+ const u = new Le();
6407
6407
  let l;
6408
6408
  try {
6409
6409
  l = await u.loadAsync(t, e);
@@ -6433,8 +6433,8 @@ class Ce {
6433
6433
  y.name = y.name.replaceAll("mixamorig", "");
6434
6434
  const x = y.name.split(".");
6435
6435
  if (x[1] === "position") {
6436
- for (let v = 0; v < y.values.length; v++)
6437
- y.values[v] = y.values[v] * s;
6436
+ for (let I = 0; I < y.values.length; I++)
6437
+ y.values[I] = y.values[I] * s;
6438
6438
  d[y.name] = new f.Vector3(y.values[0], y.values[1], y.values[2]);
6439
6439
  } else x[1] === "quaternion" ? d[y.name] = new f.Quaternion(y.values[0], y.values[1], y.values[2], y.values[3]) : x[1] === "rotation" && (d[x[0] + ".quaternion"] = new f.Quaternion().setFromEuler(new f.Euler(y.values[0], y.values[1], y.values[2], "XYZ")).normalize());
6440
6440
  });
@@ -6480,7 +6480,7 @@ class Ce {
6480
6480
  let r = this.animQueue.find((h) => h.template.name === "pose");
6481
6481
  r && (r.ts[0] = this.animClock + i * 1e3 + 2e3), this.setPoseFromTemplate(o);
6482
6482
  } else {
6483
- let h = await new Ae().loadAsync(t, e);
6483
+ let h = await new Le().loadAsync(t, e);
6484
6484
  if (h && h.animations && h.animations[n]) {
6485
6485
  let a = h.animations[n];
6486
6486
  const u = {};
@@ -6535,7 +6535,7 @@ class Ce {
6535
6535
  const c = [];
6536
6536
  for (let y = 1; y < r.ts.length; y++) c.push(r.ts[y] - r.ts[y - 1]);
6537
6537
  const d = o.template?.rescale || c.map((y) => y / u), g = e * 1e3 - u;
6538
- r.ts = r.ts.map((y, x, v) => x === 0 ? h : v[x - 1] + c[x - 1] + d[x - 1] * g);
6538
+ r.ts = r.ts.map((y, x, I) => x === 0 ? h : I[x - 1] + c[x - 1] + d[x - 1] * g);
6539
6539
  } else {
6540
6540
  const c = e * 1e3 / u;
6541
6541
  r.ts = r.ts.map((d) => h + c * (d - h));
@@ -6571,18 +6571,18 @@ class Ce {
6571
6571
  const s = new f.Vector3(), o = new f.Vector3(), r = new f.Vector3(), h = new f.Vector3(), a = new f.Quaternion(), u = new f.Vector3(), l = new f.Vector3(), c = new f.Vector3(), d = this.ikMesh.getObjectByName(t.root);
6572
6572
  d.position.setFromMatrixPosition(this.armature.getObjectByName(t.root).matrixWorld), d.quaternion.setFromRotationMatrix(this.armature.getObjectByName(t.root).matrixWorld), e && i && e.applyQuaternion(this.armature.quaternion).add(d.position);
6573
6573
  const g = this.ikMesh.getObjectByName(t.effector), y = t.links;
6574
- y.forEach((v) => {
6575
- v.bone = this.ikMesh.getObjectByName(v.link), v.bone.quaternion.copy(this.getPoseTemplateProp(v.link + ".quaternion"));
6574
+ y.forEach((I) => {
6575
+ I.bone = this.ikMesh.getObjectByName(I.link), I.bone.quaternion.copy(this.getPoseTemplateProp(I.link + ".quaternion"));
6576
6576
  }), d.updateMatrixWorld(!0);
6577
6577
  const x = t.iterations || 10;
6578
6578
  if (e)
6579
- for (let v = 0; v < x; v++) {
6580
- let H = !1;
6579
+ for (let I = 0; I < x; I++) {
6580
+ let T = !1;
6581
6581
  for (let p = 0, F = y.length; p < F; p++) {
6582
- const z = y[p].bone;
6583
- z.matrixWorld.decompose(h, a, u), a.invert(), o.setFromMatrixPosition(g.matrixWorld), r.subVectors(o, h), r.applyQuaternion(a), r.normalize(), s.subVectors(e, h), s.applyQuaternion(a), s.normalize();
6584
- let I = s.dot(r);
6585
- I > 1 ? I = 1 : I < -1 && (I = -1), I = Math.acos(I), !(I < 1e-5) && (y[p].minAngle !== void 0 && I < y[p].minAngle && (I = y[p].minAngle), y[p].maxAngle !== void 0 && I > y[p].maxAngle && (I = y[p].maxAngle), l.crossVectors(r, s), l.normalize(), N.setFromAxisAngle(l, I), z.quaternion.multiply(N), z.rotation.setFromVector3(c.setFromEuler(z.rotation).clamp(new f.Vector3(
6582
+ const C = y[p].bone;
6583
+ C.matrixWorld.decompose(h, a, u), a.invert(), o.setFromMatrixPosition(g.matrixWorld), r.subVectors(o, h), r.applyQuaternion(a), r.normalize(), s.subVectors(e, h), s.applyQuaternion(a), s.normalize();
6584
+ let R = s.dot(r);
6585
+ R > 1 ? R = 1 : R < -1 && (R = -1), R = Math.acos(R), !(R < 1e-5) && (y[p].minAngle !== void 0 && R < y[p].minAngle && (R = y[p].minAngle), y[p].maxAngle !== void 0 && R > y[p].maxAngle && (R = y[p].maxAngle), l.crossVectors(r, s), l.normalize(), N.setFromAxisAngle(l, R), C.quaternion.multiply(N), C.rotation.setFromVector3(c.setFromEuler(C.rotation).clamp(new f.Vector3(
6586
6586
  y[p].minx !== void 0 ? y[p].minx : -1 / 0,
6587
6587
  y[p].miny !== void 0 ? y[p].miny : -1 / 0,
6588
6588
  y[p].minz !== void 0 ? y[p].minz : -1 / 0
@@ -6590,12 +6590,12 @@ class Ce {
6590
6590
  y[p].maxx !== void 0 ? y[p].maxx : 1 / 0,
6591
6591
  y[p].maxy !== void 0 ? y[p].maxy : 1 / 0,
6592
6592
  y[p].maxz !== void 0 ? y[p].maxz : 1 / 0
6593
- ))), z.updateMatrixWorld(!0), H = !0);
6593
+ ))), C.updateMatrixWorld(!0), T = !0);
6594
6594
  }
6595
- if (!H) break;
6595
+ if (!T) break;
6596
6596
  }
6597
- n && y.forEach((v) => {
6598
- this.poseTarget.props[v.link + ".quaternion"].copy(v.bone.quaternion), this.poseTarget.props[v.link + ".quaternion"].t = this.animClock, this.poseTarget.props[v.link + ".quaternion"].d = n;
6597
+ n && y.forEach((I) => {
6598
+ this.poseTarget.props[I.link + ".quaternion"].copy(I.bone.quaternion), this.poseTarget.props[I.link + ".quaternion"].t = this.animClock, this.poseTarget.props[I.link + ".quaternion"].d = n;
6599
6599
  });
6600
6600
  }
6601
6601
  /**
@@ -6625,7 +6625,7 @@ const ae = {
6625
6625
  josh: "VR6AewLTigWG4xSOukaG"
6626
6626
  // Male, American
6627
6627
  }
6628
- }, we = {
6628
+ }, ze = {
6629
6629
  defaultVoice: "aura-2-thalia-en",
6630
6630
  // Thalia (Female, English)
6631
6631
  voices: {
@@ -6645,7 +6645,7 @@ const ae = {
6645
6645
  // Male, English - Powerful
6646
6646
  }
6647
6647
  };
6648
- function xe() {
6648
+ function ve() {
6649
6649
  return {
6650
6650
  service: "elevenlabs",
6651
6651
  endpoint: ae.endpoint,
@@ -6654,8 +6654,8 @@ function xe() {
6654
6654
  voices: ae.voices
6655
6655
  };
6656
6656
  }
6657
- function mt() {
6658
- const D = xe(), t = [];
6657
+ function pt() {
6658
+ const D = ve(), t = [];
6659
6659
  return Object.entries(D.voices).forEach(([e, i]) => {
6660
6660
  t.push({
6661
6661
  value: i,
@@ -6663,7 +6663,7 @@ function mt() {
6663
6663
  });
6664
6664
  }), t;
6665
6665
  }
6666
- const He = ye(({
6666
+ const Te = be(({
6667
6667
  avatarUrl: D = "/avatars/brunette.glb",
6668
6668
  avatarBody: t = "F",
6669
6669
  mood: e = "neutral",
@@ -6684,8 +6684,8 @@ const He = ye(({
6684
6684
  className: g = "",
6685
6685
  style: y = {},
6686
6686
  animations: x = {}
6687
- }, v) => {
6688
- const H = Y(null), p = Y(null), [F, z] = re(!0), [I, O] = re(null), [B, $] = re(!1), j = xe(), S = n || j.service;
6687
+ }, I) => {
6688
+ const T = X(null), p = X(null), [F, C] = re(!0), [R, O] = re(null), [B, $] = re(!1), Y = ve(), S = n || Y.service;
6689
6689
  let P;
6690
6690
  S === "browser" ? P = {
6691
6691
  service: "browser",
@@ -6695,19 +6695,19 @@ const He = ye(({
6695
6695
  } : S === "elevenlabs" ? P = {
6696
6696
  service: "elevenlabs",
6697
6697
  endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
6698
- apiKey: o || j.apiKey,
6699
- defaultVoice: s || j.defaultVoice || ae.defaultVoice,
6700
- voices: j.voices || ae.voices
6698
+ apiKey: o || Y.apiKey,
6699
+ defaultVoice: s || Y.defaultVoice || ae.defaultVoice,
6700
+ voices: Y.voices || ae.voices
6701
6701
  } : S === "deepgram" ? P = {
6702
6702
  service: "deepgram",
6703
6703
  endpoint: "https://api.deepgram.com/v1/speak",
6704
- apiKey: o || j.apiKey,
6705
- defaultVoice: s || j.defaultVoice || we.defaultVoice,
6706
- voices: j.voices || we.voices
6704
+ apiKey: o || Y.apiKey,
6705
+ defaultVoice: s || Y.defaultVoice || ze.defaultVoice,
6706
+ voices: Y.voices || ze.voices
6707
6707
  } : P = {
6708
- ...j,
6708
+ ...Y,
6709
6709
  // Override API key if provided via props
6710
- apiKey: o !== null ? o : j.apiKey
6710
+ apiKey: o !== null ? o : Y.apiKey
6711
6711
  };
6712
6712
  const W = {
6713
6713
  url: D,
@@ -6726,49 +6726,49 @@ const He = ye(({
6726
6726
  lipsyncModules: ["en"],
6727
6727
  cameraView: u
6728
6728
  }, q = E(async () => {
6729
- if (!(!H.current || p.current))
6729
+ if (!(!T.current || p.current))
6730
6730
  try {
6731
- if (z(!0), O(null), p.current = new Ce(H.current, V), p.current.controls && (p.current.controls.enableRotate = !1, p.current.controls.enableZoom = !1, p.current.controls.enablePan = !1, p.current.controls.enableDamping = !1), x && Object.keys(x).length > 0 && (p.current.customAnimations = x), await p.current.showAvatar(W, (U) => {
6731
+ if (C(!0), O(null), p.current = new He(T.current, V), p.current.controls && (p.current.controls.enableRotate = !1, p.current.controls.enableZoom = !1, p.current.controls.enablePan = !1, p.current.controls.enableDamping = !1), x && Object.keys(x).length > 0 && (p.current.customAnimations = x), await p.current.showAvatar(W, (U) => {
6732
6732
  if (U.lengthComputable) {
6733
- const T = Math.min(100, Math.round(U.loaded / U.total * 100));
6734
- c(T);
6733
+ const w = Math.min(100, Math.round(U.loaded / U.total * 100));
6734
+ c(w);
6735
6735
  }
6736
6736
  }), await new Promise((U) => {
6737
- const T = () => {
6738
- p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? U() : setTimeout(T, 100);
6737
+ const w = () => {
6738
+ p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? U() : setTimeout(w, 100);
6739
6739
  };
6740
- T();
6740
+ w();
6741
6741
  }), p.current && p.current.setShowFullAvatar)
6742
6742
  try {
6743
6743
  p.current.setShowFullAvatar(a);
6744
6744
  } catch (U) {
6745
6745
  console.warn("Error setting full body mode on initialization:", U);
6746
6746
  }
6747
- p.current && p.current.controls && (p.current.controls.enableRotate = !1, p.current.controls.enableZoom = !1, p.current.controls.enablePan = !1, p.current.controls.enableDamping = !1, p.current.controls.update()), z(!1), $(!0), l(p.current);
6748
- const C = () => {
6747
+ p.current && p.current.controls && (p.current.controls.enableRotate = !1, p.current.controls.enableZoom = !1, p.current.controls.enablePan = !1, p.current.controls.enableDamping = !1, p.current.controls.update()), C(!1), $(!0), l(p.current);
6748
+ const H = () => {
6749
6749
  document.visibilityState === "visible" ? p.current?.start() : p.current?.stop();
6750
6750
  };
6751
- return document.addEventListener("visibilitychange", C), () => {
6752
- document.removeEventListener("visibilitychange", C);
6751
+ return document.addEventListener("visibilitychange", H), () => {
6752
+ document.removeEventListener("visibilitychange", H);
6753
6753
  };
6754
6754
  } catch (L) {
6755
- console.error("Error initializing TalkingHead:", L), O(L.message || "Failed to initialize avatar"), z(!1), d(L);
6755
+ console.error("Error initializing TalkingHead:", L), O(L.message || "Failed to initialize avatar"), C(!1), d(L);
6756
6756
  }
6757
6757
  }, [D, t, e, i, n, s, o, a, r, h, u]);
6758
6758
  he(() => (q(), () => {
6759
6759
  p.current && (p.current.stop(), p.current.dispose(), p.current = null);
6760
6760
  }), [q]), he(() => {
6761
- if (!H.current || !p.current) return;
6761
+ if (!T.current || !p.current) return;
6762
6762
  const L = new ResizeObserver((U) => {
6763
- for (const T of U)
6763
+ for (const w of U)
6764
6764
  p.current && p.current.onResize && p.current.onResize();
6765
6765
  });
6766
- L.observe(H.current);
6767
- const C = () => {
6766
+ L.observe(T.current);
6767
+ const H = () => {
6768
6768
  p.current && p.current.onResize && p.current.onResize();
6769
6769
  };
6770
- return window.addEventListener("resize", C), () => {
6771
- L.disconnect(), window.removeEventListener("resize", C);
6770
+ return window.addEventListener("resize", H), () => {
6771
+ L.disconnect(), window.removeEventListener("resize", H);
6772
6772
  };
6773
6773
  }, [B]);
6774
6774
  const _ = E(async () => {
@@ -6778,46 +6778,59 @@ const He = ye(({
6778
6778
  } catch (L) {
6779
6779
  console.warn("Failed to resume audio context:", L);
6780
6780
  }
6781
- }, []), le = E(async (L, C = {}) => {
6781
+ }, []), le = E(async (L, H = {}) => {
6782
6782
  if (p.current && B)
6783
6783
  try {
6784
6784
  await _();
6785
6785
  const U = {
6786
- ...C,
6787
- lipsyncLang: C.lipsyncLang || W.lipsyncLang || "en"
6786
+ ...H,
6787
+ lipsyncLang: H.lipsyncLang || W.lipsyncLang || "en"
6788
6788
  };
6789
- if (C.onSpeechEnd && p.current) {
6790
- const T = p.current;
6791
- let G = null, se = 0, ue = !1;
6792
- const Me = 1200, Ee = 1e4;
6793
- let be = 0;
6794
- const Re = setInterval(() => {
6795
- if (be++, T && T.isSpeaking && (T.audioPlaylist && T.audioPlaylist.length > 0 || T.isAudioPlaying === !0) && (ue = !0, clearInterval(Re), G = setInterval(ve, 50)), be * 50 > Ee)
6796
- if (clearInterval(Re), T && T.isSpeaking)
6797
- ue = !0, G = setInterval(ve, 50);
6798
- else
6789
+ if (H.onSpeechEnd && p.current) {
6790
+ const w = p.current;
6791
+ let j = null, se = 0, ue = !1;
6792
+ const Ee = 1200, Fe = 1e4;
6793
+ let Ie = 0;
6794
+ const fe = setInterval(() => {
6795
+ Ie++, w && w.isSpeaking && (w.audioPlaylist && w.audioPlaylist.length > 0 || w.isAudioPlaying === !0) && (ue = !0, clearInterval(fe), j = setInterval(Ae, 50));
6796
+ const de = !w.speechQueue || w.speechQueue.length === 0;
6797
+ if (w && !w.isSpeaking && de && (!w.audioPlaylist || w.audioPlaylist.length === 0) && (!w.isAudioPlaying || w.isAudioPlaying === !1)) {
6798
+ clearInterval(fe);
6799
+ try {
6800
+ H.onSpeechEnd();
6801
+ } catch (ce) {
6802
+ console.error("Error in onSpeechEnd callback:", ce);
6803
+ }
6804
+ return;
6805
+ }
6806
+ if (Ie * 50 > Fe) {
6807
+ if (clearInterval(fe), w && w.isSpeaking)
6808
+ ue = !0, j = setInterval(Ae, 50);
6809
+ else if (w && !w.isSpeaking && de && (!w.audioPlaylist || w.audioPlaylist.length === 0) && (!w.isAudioPlaying || w.isAudioPlaying === !1))
6799
6810
  try {
6800
- C.onSpeechEnd();
6801
- } catch (Ie) {
6802
- console.error("Error in onSpeechEnd callback:", Ie);
6811
+ H.onSpeechEnd();
6812
+ } catch (ce) {
6813
+ console.error("Error in onSpeechEnd callback:", ce);
6803
6814
  }
6804
- }, 50), ve = () => {
6805
- if (se++, se > Me) {
6806
- G && (clearInterval(G), G = null);
6815
+ }
6816
+ }, 50), Ae = () => {
6817
+ if (se++, se > Ee) {
6818
+ j && (clearInterval(j), j = null);
6807
6819
  try {
6808
- C.onSpeechEnd();
6809
- } catch (ge) {
6810
- console.error("Error in onSpeechEnd callback:", ge);
6820
+ H.onSpeechEnd();
6821
+ } catch (xe) {
6822
+ console.error("Error in onSpeechEnd callback:", xe);
6811
6823
  }
6812
6824
  return;
6813
6825
  }
6814
6826
  if (!ue)
6815
6827
  return;
6816
- T && (!T.isSpeaking || T.isSpeaking === !1) && (!T.audioPlaylist || T.audioPlaylist.length === 0) && (!T.isAudioPlaying || T.isAudioPlaying === !1) && (G && (clearInterval(G), G = null), setTimeout(() => {
6828
+ const de = !w.speechQueue || w.speechQueue.length === 0;
6829
+ w && (!w.isSpeaking || w.isSpeaking === !1) && (!w.audioPlaylist || w.audioPlaylist.length === 0) && (!w.isAudioPlaying || w.isAudioPlaying === !1) && de && (j && (clearInterval(j), j = null), setTimeout(() => {
6817
6830
  try {
6818
- C.onSpeechEnd();
6819
- } catch (ge) {
6820
- console.error("Error in onSpeechEnd callback:", ge);
6831
+ H.onSpeechEnd();
6832
+ } catch (xe) {
6833
+ console.error("Error in onSpeechEnd callback:", xe);
6821
6834
  }
6822
6835
  }, 50));
6823
6836
  };
@@ -6828,41 +6841,41 @@ const He = ye(({
6828
6841
  } catch (U) {
6829
6842
  console.error("Error speaking text:", U), O(U.message || "Failed to speak text");
6830
6843
  }
6831
- }, [B, _, W.lipsyncLang]), pe = E(() => {
6844
+ }, [B, _, W.lipsyncLang]), ye = E(() => {
6832
6845
  p.current && (p.current.stopSpeaking(), p.current.setSlowdownRate && p.current.setSlowdownRate(1));
6833
6846
  }, []), K = E((L) => {
6834
6847
  p.current && p.current.setMood(L);
6835
6848
  }, []), b = E((L) => {
6836
6849
  p.current && p.current.setSlowdownRate && p.current.setSlowdownRate(L);
6837
- }, []), R = E((L, C = !1) => {
6850
+ }, []), v = E((L, H = !1) => {
6838
6851
  if (p.current && p.current.playAnimation) {
6839
6852
  if (x && x[L] && (L = x[L]), p.current.setShowFullAvatar)
6840
6853
  try {
6841
6854
  p.current.setShowFullAvatar(!0);
6842
- } catch (T) {
6843
- console.warn("Error setting full body mode:", T);
6855
+ } catch (w) {
6856
+ console.warn("Error setting full body mode:", w);
6844
6857
  }
6845
6858
  if (L.includes("."))
6846
6859
  try {
6847
- p.current.playAnimation(L, null, 10, 0, 0.01, C);
6848
- } catch (T) {
6849
- console.warn(`Failed to play ${L}:`, T);
6860
+ p.current.playAnimation(L, null, 10, 0, 0.01, H);
6861
+ } catch (w) {
6862
+ console.warn(`Failed to play ${L}:`, w);
6850
6863
  try {
6851
6864
  p.current.setBodyMovement("idle");
6852
- } catch (G) {
6853
- console.warn("Fallback animation also failed:", G);
6865
+ } catch (j) {
6866
+ console.warn("Fallback animation also failed:", j);
6854
6867
  }
6855
6868
  }
6856
6869
  else {
6857
- const T = [".fbx", ".glb", ".gltf"];
6858
- let G = !1;
6859
- for (const se of T)
6870
+ const w = [".fbx", ".glb", ".gltf"];
6871
+ let j = !1;
6872
+ for (const se of w)
6860
6873
  try {
6861
- p.current.playAnimation(L + se, null, 10, 0, 0.01, C), G = !0;
6874
+ p.current.playAnimation(L + se, null, 10, 0, 0.01, H), j = !0;
6862
6875
  break;
6863
6876
  } catch {
6864
6877
  }
6865
- if (!G) {
6878
+ if (!j) {
6866
6879
  console.warn("Animation not found:", L);
6867
6880
  try {
6868
6881
  p.current.setBodyMovement("idle");
@@ -6872,25 +6885,25 @@ const He = ye(({
6872
6885
  }
6873
6886
  }
6874
6887
  }
6875
- }, [x]), w = E(() => {
6888
+ }, [x]), z = E(() => {
6876
6889
  p.current && p.current.onResize && p.current.onResize();
6877
6890
  }, []);
6878
- return fe(v, () => ({
6891
+ return Re(I, () => ({
6879
6892
  speakText: le,
6880
- stopSpeaking: pe,
6893
+ stopSpeaking: ye,
6881
6894
  resumeAudioContext: _,
6882
6895
  setMood: K,
6883
6896
  setTimingAdjustment: b,
6884
- playAnimation: R,
6897
+ playAnimation: v,
6885
6898
  isReady: B,
6886
6899
  talkingHead: p.current,
6887
- handleResize: w,
6900
+ handleResize: z,
6888
6901
  setBodyMovement: (L) => {
6889
6902
  if (p.current && p.current.setShowFullAvatar && p.current.setBodyMovement)
6890
6903
  try {
6891
6904
  p.current.setShowFullAvatar(!0), p.current.setBodyMovement(L);
6892
- } catch (C) {
6893
- console.warn("Error setting body movement:", C);
6905
+ } catch (H) {
6906
+ console.warn("Error setting body movement:", H);
6894
6907
  }
6895
6908
  },
6896
6909
  setMovementIntensity: (L) => p.current?.setMovementIntensity(L),
@@ -6906,8 +6919,8 @@ const He = ye(({
6906
6919
  if (p.current && p.current.setShowFullAvatar && p.current.playReaction)
6907
6920
  try {
6908
6921
  p.current.setShowFullAvatar(!0), p.current.playReaction(L);
6909
- } catch (C) {
6910
- console.warn("Error playing reaction:", C);
6922
+ } catch (H) {
6923
+ console.warn("Error playing reaction:", H);
6911
6924
  }
6912
6925
  },
6913
6926
  playCelebration: () => {
@@ -6922,8 +6935,8 @@ const He = ye(({
6922
6935
  if (p.current && p.current.setShowFullAvatar)
6923
6936
  try {
6924
6937
  p.current.setShowFullAvatar(L);
6925
- } catch (C) {
6926
- console.warn("Error setting showFullAvatar:", C);
6938
+ } catch (H) {
6939
+ console.warn("Error setting showFullAvatar:", H);
6927
6940
  }
6928
6941
  },
6929
6942
  lockAvatarPosition: () => {
@@ -6942,7 +6955,7 @@ const He = ye(({
6942
6955
  console.warn("Error unlocking avatar position:", L);
6943
6956
  }
6944
6957
  }
6945
- })), /* @__PURE__ */ ze(
6958
+ })), /* @__PURE__ */ Ce(
6946
6959
  "div",
6947
6960
  {
6948
6961
  className: `talking-head-avatar ${g}`,
@@ -6956,7 +6969,7 @@ const He = ye(({
6956
6969
  /* @__PURE__ */ oe(
6957
6970
  "div",
6958
6971
  {
6959
- ref: H,
6972
+ ref: T,
6960
6973
  className: "talking-head-viewer",
6961
6974
  style: {
6962
6975
  width: "100%",
@@ -6974,7 +6987,7 @@ const He = ye(({
6974
6987
  fontSize: "18px",
6975
6988
  zIndex: 10
6976
6989
  }, children: "Loading avatar..." }),
6977
- I && /* @__PURE__ */ oe("div", { className: "error-overlay", style: {
6990
+ R && /* @__PURE__ */ oe("div", { className: "error-overlay", style: {
6978
6991
  position: "absolute",
6979
6992
  top: "50%",
6980
6993
  left: "50%",
@@ -6985,13 +6998,13 @@ const He = ye(({
6985
6998
  zIndex: 10,
6986
6999
  padding: "20px",
6987
7000
  borderRadius: "8px"
6988
- }, children: I })
7001
+ }, children: R })
6989
7002
  ]
6990
7003
  }
6991
7004
  );
6992
7005
  });
6993
- He.displayName = "TalkingHeadAvatar";
6994
- const nt = ye(({
7006
+ Te.displayName = "TalkingHeadAvatar";
7007
+ const ot = be(({
6995
7008
  text: D = "Hello! I'm a talking avatar. How are you today?",
6996
7009
  onLoading: t = () => {
6997
7010
  },
@@ -7003,7 +7016,7 @@ const nt = ye(({
7003
7016
  style: s = {},
7004
7017
  avatarConfig: o = {}
7005
7018
  }, r) => {
7006
- const h = Y(null), a = Y(null), [u, l] = re(!0), [c, d] = re(null), [g, y] = re(!1), x = xe(), v = o.ttsService || x.service, H = v === "browser" ? {
7019
+ const h = X(null), a = X(null), [u, l] = re(!0), [c, d] = re(null), [g, y] = re(!1), x = ve(), I = o.ttsService || x.service, T = I === "browser" ? {
7007
7020
  endpoint: "",
7008
7021
  apiKey: null,
7009
7022
  defaultVoice: "Google US English"
@@ -7012,14 +7025,14 @@ const nt = ye(({
7012
7025
  // Override API key if provided via avatarConfig
7013
7026
  apiKey: o.ttsApiKey !== void 0 && o.ttsApiKey !== null ? o.ttsApiKey : x.apiKey,
7014
7027
  // Override endpoint for ElevenLabs if service is explicitly set
7015
- endpoint: v === "elevenlabs" && o.ttsApiKey ? "https://api.elevenlabs.io/v1/text-to-speech" : x.endpoint
7028
+ endpoint: I === "elevenlabs" && o.ttsApiKey ? "https://api.elevenlabs.io/v1/text-to-speech" : x.endpoint
7016
7029
  }, p = {
7017
7030
  url: "/avatars/brunette.glb",
7018
7031
  // Use brunette avatar (working glTF file)
7019
7032
  body: "F",
7020
7033
  avatarMood: "neutral",
7021
- ttsLang: v === "browser" ? "en-US" : "en",
7022
- ttsVoice: o.ttsVoice || H.defaultVoice,
7034
+ ttsLang: I === "browser" ? "en-US" : "en",
7035
+ ttsVoice: o.ttsVoice || T.defaultVoice,
7023
7036
  lipsyncLang: "en",
7024
7037
  // English lip-sync
7025
7038
  showFullAvatar: !0,
@@ -7028,15 +7041,15 @@ const nt = ye(({
7028
7041
  movementIntensity: 0.5,
7029
7042
  ...o
7030
7043
  }, F = {
7031
- ttsEndpoint: H.endpoint,
7032
- ttsApikey: H.apiKey,
7033
- ttsService: v,
7044
+ ttsEndpoint: T.endpoint,
7045
+ ttsApikey: T.apiKey,
7046
+ ttsService: I,
7034
7047
  lipsyncModules: ["en"],
7035
7048
  cameraView: "upper"
7036
- }, z = E(async () => {
7049
+ }, C = E(async () => {
7037
7050
  if (!(!h.current || a.current))
7038
7051
  try {
7039
- if (l(!0), d(null), a.current = new Ce(h.current, F), await a.current.showAvatar(p, (W) => {
7052
+ if (l(!0), d(null), a.current = new He(h.current, F), await a.current.showAvatar(p, (W) => {
7040
7053
  if (W.lengthComputable) {
7041
7054
  const V = Math.min(100, Math.round(W.loaded / W.total * 100));
7042
7055
  t(V);
@@ -7069,10 +7082,10 @@ const nt = ye(({
7069
7082
  console.error("Error initializing TalkingHead:", S), d(S.message || "Failed to initialize avatar"), l(!1), e(S);
7070
7083
  }
7071
7084
  }, []);
7072
- he(() => (z(), () => {
7085
+ he(() => (C(), () => {
7073
7086
  a.current && (a.current.stop(), a.current.dispose(), a.current = null);
7074
- }), [z]);
7075
- const I = E((S) => {
7087
+ }), [C]);
7088
+ const R = E((S) => {
7076
7089
  if (a.current && g)
7077
7090
  try {
7078
7091
  console.log("Speaking text:", S), console.log("Avatar config:", p), console.log("TalkingHead instance:", a.current), a.current.lipsync && Object.keys(a.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(a.current.lipsync)), a.current.setSlowdownRate && (a.current.setSlowdownRate(1.05), console.log("Applied timing adjustment for better lip-sync")), a.current.speakText(S)) : (console.warn("Lip-sync modules not ready, waiting..."), setTimeout(() => {
@@ -7089,7 +7102,7 @@ const nt = ye(({
7089
7102
  a.current && a.current.setMood(S);
7090
7103
  }, []), $ = E((S) => {
7091
7104
  a.current && a.current.setSlowdownRate && (a.current.setSlowdownRate(S), console.log("Timing adjustment set to:", S));
7092
- }, []), j = E((S, P = !1) => {
7105
+ }, []), Y = E((S, P = !1) => {
7093
7106
  if (a.current && a.current.playAnimation) {
7094
7107
  if (a.current.setShowFullAvatar)
7095
7108
  try {
@@ -7130,12 +7143,12 @@ const nt = ye(({
7130
7143
  } else
7131
7144
  console.warn("Animation system not available or animation not found:", S);
7132
7145
  }, []);
7133
- return fe(r, () => ({
7134
- speakText: I,
7146
+ return Re(r, () => ({
7147
+ speakText: R,
7135
7148
  stopSpeaking: O,
7136
7149
  setMood: B,
7137
7150
  setTimingAdjustment: $,
7138
- playAnimation: j,
7151
+ playAnimation: Y,
7139
7152
  isReady: g,
7140
7153
  talkingHead: a.current,
7141
7154
  setBodyMovement: (S) => {
@@ -7195,7 +7208,7 @@ const nt = ye(({
7195
7208
  console.warn("Error unlocking avatar position:", S);
7196
7209
  }
7197
7210
  }
7198
- })), /* @__PURE__ */ ze("div", { className: `talking-head-container ${n}`, style: s, children: [
7211
+ })), /* @__PURE__ */ Ce("div", { className: `talking-head-container ${n}`, style: s, children: [
7199
7212
  /* @__PURE__ */ oe(
7200
7213
  "div",
7201
7214
  {
@@ -7231,8 +7244,8 @@ const nt = ye(({
7231
7244
  }, children: c })
7232
7245
  ] });
7233
7246
  });
7234
- nt.displayName = "TalkingHeadComponent";
7235
- const ot = ye(({
7247
+ ot.displayName = "TalkingHeadComponent";
7248
+ const st = be(({
7236
7249
  curriculumData: D = null,
7237
7250
  avatarConfig: t = {},
7238
7251
  animations: e = {},
@@ -7248,7 +7261,7 @@ const ot = ye(({
7248
7261
  },
7249
7262
  autoStart: h = !1
7250
7263
  }, a) => {
7251
- const u = Y(null), l = Y({
7264
+ const u = X(null), l = X({
7252
7265
  currentModuleIndex: 0,
7253
7266
  currentLessonIndex: 0,
7254
7267
  currentQuestionIndex: 0,
@@ -7258,18 +7271,18 @@ const ot = ye(({
7258
7271
  curriculumCompleted: !1,
7259
7272
  score: 0,
7260
7273
  totalQuestions: 0
7261
- }), c = Y({
7274
+ }), c = X({
7262
7275
  onLessonStart: i,
7263
7276
  onLessonComplete: n,
7264
7277
  onQuestionAnswer: s,
7265
7278
  onCurriculumComplete: o,
7266
7279
  onCustomAction: r
7267
- }), d = Y(null), g = Y(null), y = Y(null), x = Y(null), v = Y(null), H = Y(null), p = Y(null), F = Y(D?.curriculum || {
7280
+ }), d = X(null), g = X(null), y = X(null), x = X(null), I = X(null), T = X(null), p = X(null), F = X(D?.curriculum || {
7268
7281
  title: "Default Curriculum",
7269
7282
  description: "No curriculum data provided",
7270
7283
  language: "en",
7271
7284
  modules: []
7272
- }), z = Y({
7285
+ }), C = X({
7273
7286
  avatarUrl: t.avatarUrl || "/avatars/brunette.glb",
7274
7287
  avatarBody: t.avatarBody || "F",
7275
7288
  mood: t.mood || "happy",
@@ -7297,7 +7310,7 @@ const ot = ye(({
7297
7310
  description: "No curriculum data provided",
7298
7311
  language: "en",
7299
7312
  modules: []
7300
- }, z.current = {
7313
+ }, C.current = {
7301
7314
  avatarUrl: t.avatarUrl || "/avatars/brunette.glb",
7302
7315
  avatarBody: t.avatarBody || "F",
7303
7316
  mood: t.mood || "happy",
@@ -7312,11 +7325,11 @@ const ot = ye(({
7312
7325
  lipsyncLang: "en"
7313
7326
  };
7314
7327
  }, [D, t, e]);
7315
- const I = E(() => (F.current || { modules: [] }).modules[l.current.currentModuleIndex]?.lessons[l.current.currentLessonIndex], []), O = E(() => I()?.questions[l.current.currentQuestionIndex], [I]), B = E((b, R) => R.type === "multiple_choice" || R.type === "true_false" ? b === R.answer : R.type === "code_test" && typeof b == "object" && b !== null ? b.passed === !0 : !1, []), $ = E(() => {
7328
+ const R = E(() => (F.current || { modules: [] }).modules[l.current.currentModuleIndex]?.lessons[l.current.currentLessonIndex], []), O = E(() => R()?.questions[l.current.currentQuestionIndex], [R]), B = E((b, v) => v.type === "multiple_choice" || v.type === "true_false" ? b === v.answer : v.type === "code_test" && typeof b == "object" && b !== null ? b.passed === !0 : !1, []), $ = E(() => {
7316
7329
  l.current.lessonCompleted = !0, l.current.isQuestionMode = !1;
7317
7330
  const b = l.current.totalQuestions > 0 ? Math.round(l.current.score / l.current.totalQuestions * 100) : 100;
7318
- let R = "Congratulations! You've completed this lesson";
7319
- if (l.current.totalQuestions > 0 ? R += ` with a score of ${l.current.score} out of ${l.current.totalQuestions} (${b}%). ` : R += "! ", b >= 80 ? R += "Excellent work! You have a great understanding of this topic." : b >= 60 ? R += "Good job! You understand most of the concepts." : R += "Keep practicing! You're making progress.", c.current.onLessonComplete({
7331
+ let v = "Congratulations! You've completed this lesson";
7332
+ if (l.current.totalQuestions > 0 ? v += ` with a score of ${l.current.score} out of ${l.current.totalQuestions} (${b}%). ` : v += "! ", b >= 80 ? v += "Excellent work! You have a great understanding of this topic." : b >= 60 ? v += "Good job! You understand most of the concepts." : v += "Keep practicing! You're making progress.", c.current.onLessonComplete({
7320
7333
  moduleIndex: l.current.currentModuleIndex,
7321
7334
  lessonIndex: l.current.currentLessonIndex,
7322
7335
  score: l.current.score,
@@ -7336,25 +7349,28 @@ const ot = ye(({
7336
7349
  } catch {
7337
7350
  u.current.playCelebration();
7338
7351
  }
7339
- const w = F.current || { modules: [] }, L = w.modules[l.current.currentModuleIndex], C = l.current.currentLessonIndex < (L?.lessons?.length || 0) - 1, U = l.current.currentModuleIndex < (w.modules?.length || 0) - 1, T = C || U, G = z.current || { lipsyncLang: "en" };
7340
- T ? u.current.speakText(R, {
7341
- lipsyncLang: G.lipsyncLang,
7342
- onSpeechEnd: () => {
7343
- g.current && g.current();
7344
- }
7345
- }) : u.current.speakText(R, {
7346
- lipsyncLang: G.lipsyncLang,
7352
+ const z = F.current || { modules: [] }, L = z.modules[l.current.currentModuleIndex], H = l.current.currentLessonIndex < (L?.lessons?.length || 0) - 1, U = l.current.currentModuleIndex < (z.modules?.length || 0) - 1, w = H || U, j = C.current || { lipsyncLang: "en" };
7353
+ u.current.speakText(v, {
7354
+ lipsyncLang: j.lipsyncLang,
7347
7355
  onSpeechEnd: () => {
7348
- v.current && v.current();
7356
+ c.current.onCustomAction({
7357
+ type: "lessonCompleteFeedbackDone",
7358
+ moduleIndex: l.current.currentModuleIndex,
7359
+ lessonIndex: l.current.currentLessonIndex,
7360
+ score: l.current.score,
7361
+ totalQuestions: l.current.totalQuestions,
7362
+ percentage: b,
7363
+ hasNextLesson: w
7364
+ });
7349
7365
  }
7350
7366
  });
7351
7367
  }
7352
- }, [e.lessonComplete]), j = E(() => {
7368
+ }, [e.lessonComplete]), Y = E(() => {
7353
7369
  l.current.curriculumCompleted = !0;
7354
7370
  const b = F.current || { modules: [] };
7355
7371
  if (c.current.onCurriculumComplete({
7356
7372
  modules: b.modules.length,
7357
- totalLessons: b.modules.reduce((R, w) => R + w.lessons.length, 0)
7373
+ totalLessons: b.modules.reduce((v, z) => v + z.lessons.length, 0)
7358
7374
  }), u.current) {
7359
7375
  if (u.current.setMood("celebrating"), e.curriculumComplete)
7360
7376
  try {
@@ -7362,98 +7378,112 @@ const ot = ye(({
7362
7378
  } catch {
7363
7379
  u.current.playCelebration();
7364
7380
  }
7365
- const R = z.current || { lipsyncLang: "en" };
7366
- u.current.speakText("Amazing! You've completed the entire curriculum! You're now ready to move on to more advanced topics. Well done!", { lipsyncLang: R.lipsyncLang });
7381
+ const v = C.current || { lipsyncLang: "en" };
7382
+ u.current.speakText("Amazing! You've completed the entire curriculum! You're now ready to move on to more advanced topics. Well done!", { lipsyncLang: v.lipsyncLang });
7367
7383
  }
7368
7384
  }, [e.curriculumComplete]), S = E(() => {
7369
- const b = I();
7385
+ const b = R();
7370
7386
  l.current.isQuestionMode = !0, l.current.currentQuestionIndex = 0, l.current.totalQuestions = b?.questions?.length || 0;
7371
- const R = O();
7372
- if (R && c.current.onCustomAction({
7387
+ const v = O();
7388
+ if (v && c.current.onCustomAction({
7373
7389
  type: "questionStart",
7374
7390
  moduleIndex: l.current.currentModuleIndex,
7375
7391
  lessonIndex: l.current.currentLessonIndex,
7376
7392
  questionIndex: l.current.currentQuestionIndex,
7377
7393
  totalQuestions: l.current.totalQuestions,
7378
- question: R
7379
- }), u.current && u.current.isReady && R) {
7394
+ question: v
7395
+ }), u.current && u.current.isReady && v) {
7380
7396
  if (u.current.setMood("curious"), e.questionStart)
7381
7397
  try {
7382
7398
  u.current.playAnimation(e.questionStart, !0);
7383
7399
  } catch (L) {
7384
7400
  console.warn("Failed to play questionStart animation:", L);
7385
7401
  }
7386
- const w = z.current || { lipsyncLang: "en" };
7387
- R.type === "code_test" ? u.current.speakText(`Let's test your coding skills! Here's your first challenge: ${R.question}`, { lipsyncLang: w.lipsyncLang }) : R.type === "multiple_choice" ? u.current.speakText(`Now let me ask you some questions. Here's the first one: ${R.question}`, { lipsyncLang: w.lipsyncLang }) : R.type === "true_false" ? u.current.speakText(`Let's start with some true or false questions. First question: ${R.question}`, { lipsyncLang: w.lipsyncLang }) : u.current.speakText(`Now let me ask you some questions. Here's the first one: ${R.question}`, { lipsyncLang: w.lipsyncLang });
7402
+ const z = C.current || { lipsyncLang: "en" };
7403
+ v.type === "code_test" ? u.current.speakText(`Let's test your coding skills! Here's your first challenge: ${v.question}`, { lipsyncLang: z.lipsyncLang }) : v.type === "multiple_choice" ? u.current.speakText(`Now let me ask you some questions. Here's the first one: ${v.question}`, { lipsyncLang: z.lipsyncLang }) : v.type === "true_false" ? u.current.speakText(`Let's start with some true or false questions. First question: ${v.question}`, { lipsyncLang: z.lipsyncLang }) : u.current.speakText(`Now let me ask you some questions. Here's the first one: ${v.question}`, { lipsyncLang: z.lipsyncLang });
7388
7404
  } else if (u.current && u.current.isReady) {
7389
- const w = z.current || { lipsyncLang: "en" };
7390
- u.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang: w.lipsyncLang });
7405
+ const z = C.current || { lipsyncLang: "en" };
7406
+ u.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang: z.lipsyncLang });
7391
7407
  } else
7392
7408
  setTimeout(() => {
7393
- H.current && H.current();
7409
+ T.current && T.current();
7394
7410
  }, 100);
7395
- }, [e.questionStart, I, O]), P = E(() => {
7396
- const b = I();
7411
+ }, [e.questionStart, R, O]), P = E(() => {
7412
+ const b = R();
7397
7413
  if (l.current.currentQuestionIndex < (b?.questions?.length || 0) - 1) {
7398
7414
  l.current.currentQuestionIndex += 1;
7399
- const R = O();
7400
- if (R && c.current.onCustomAction({
7415
+ const v = O();
7416
+ if (v && c.current.onCustomAction({
7401
7417
  type: "nextQuestion",
7402
7418
  moduleIndex: l.current.currentModuleIndex,
7403
7419
  lessonIndex: l.current.currentLessonIndex,
7404
7420
  questionIndex: l.current.currentQuestionIndex,
7405
7421
  totalQuestions: l.current.totalQuestions,
7406
- question: R
7407
- }), u.current && R) {
7422
+ question: v
7423
+ }), u.current && v) {
7408
7424
  if (u.current.setMood("happy"), u.current.setBodyMovement("idle"), e.nextQuestion)
7409
7425
  try {
7410
7426
  u.current.playAnimation(e.nextQuestion, !0);
7411
7427
  } catch (L) {
7412
7428
  console.warn("Failed to play nextQuestion animation:", L);
7413
7429
  }
7414
- const w = z.current || { lipsyncLang: "en" };
7415
- R.type === "code_test" ? u.current.speakText(`Great! Now let's move on to your next coding challenge: ${R.question}`, {
7416
- lipsyncLang: w.lipsyncLang
7417
- }) : R.type === "multiple_choice" ? u.current.speakText(`Alright! Here's your next question: ${R.question}`, {
7418
- lipsyncLang: w.lipsyncLang
7419
- }) : R.type === "true_false" ? u.current.speakText(`Now let's try this one: ${R.question}`, {
7420
- lipsyncLang: w.lipsyncLang
7421
- }) : u.current.speakText(`Here's the next question: ${R.question}`, {
7422
- lipsyncLang: w.lipsyncLang
7430
+ const z = C.current || { lipsyncLang: "en" };
7431
+ v.type === "code_test" ? u.current.speakText(`Great! Now let's move on to your next coding challenge: ${v.question}`, {
7432
+ lipsyncLang: z.lipsyncLang
7433
+ }) : v.type === "multiple_choice" ? u.current.speakText(`Alright! Here's your next question: ${v.question}`, {
7434
+ lipsyncLang: z.lipsyncLang
7435
+ }) : v.type === "true_false" ? u.current.speakText(`Now let's try this one: ${v.question}`, {
7436
+ lipsyncLang: z.lipsyncLang
7437
+ }) : u.current.speakText(`Here's the next question: ${v.question}`, {
7438
+ lipsyncLang: z.lipsyncLang
7423
7439
  });
7424
7440
  }
7425
7441
  } else
7426
- y.current && y.current();
7427
- }, [e.nextQuestion, I, O]), W = E(() => {
7428
- const b = F.current || { modules: [] }, R = b.modules[l.current.currentModuleIndex];
7429
- l.current.currentLessonIndex < (R?.lessons?.length || 0) - 1 ? (l.current.currentLessonIndex += 1, l.current.currentQuestionIndex = 0, l.current.lessonCompleted = !1, l.current.isQuestionMode = !1, l.current.isTeaching = !1, l.current.score = 0, l.current.totalQuestions = 0, c.current.onCustomAction({
7442
+ c.current.onCustomAction({
7443
+ type: "allQuestionsComplete",
7444
+ moduleIndex: l.current.currentModuleIndex,
7445
+ lessonIndex: l.current.currentLessonIndex,
7446
+ totalQuestions: l.current.totalQuestions,
7447
+ score: l.current.score
7448
+ });
7449
+ }, [e.nextQuestion, R, O]), W = E(() => {
7450
+ const b = F.current || { modules: [] }, v = b.modules[l.current.currentModuleIndex];
7451
+ l.current.currentLessonIndex < (v?.lessons?.length || 0) - 1 ? (l.current.currentLessonIndex += 1, l.current.currentQuestionIndex = 0, l.current.lessonCompleted = !1, l.current.isQuestionMode = !1, l.current.isTeaching = !1, l.current.score = 0, l.current.totalQuestions = 0, c.current.onCustomAction({
7430
7452
  type: "lessonStart",
7431
7453
  moduleIndex: l.current.currentModuleIndex,
7432
7454
  lessonIndex: l.current.currentLessonIndex
7433
- }), u.current && (u.current.setMood("happy"), u.current.setBodyMovement("idle"), d.current && d.current())) : l.current.currentModuleIndex < (b.modules?.length || 0) - 1 ? (l.current.currentModuleIndex += 1, l.current.currentLessonIndex = 0, l.current.currentQuestionIndex = 0, l.current.lessonCompleted = !1, l.current.isQuestionMode = !1, l.current.isTeaching = !1, l.current.score = 0, l.current.totalQuestions = 0, c.current.onCustomAction({
7455
+ }), c.current.onLessonStart({
7456
+ moduleIndex: l.current.currentModuleIndex,
7457
+ lessonIndex: l.current.currentLessonIndex,
7458
+ lesson: R()
7459
+ }), u.current && (u.current.setMood("happy"), u.current.setBodyMovement("idle"))) : l.current.currentModuleIndex < (b.modules?.length || 0) - 1 ? (l.current.currentModuleIndex += 1, l.current.currentLessonIndex = 0, l.current.currentQuestionIndex = 0, l.current.lessonCompleted = !1, l.current.isQuestionMode = !1, l.current.isTeaching = !1, l.current.score = 0, l.current.totalQuestions = 0, c.current.onCustomAction({
7434
7460
  type: "lessonStart",
7435
7461
  moduleIndex: l.current.currentModuleIndex,
7436
7462
  lessonIndex: l.current.currentLessonIndex
7437
- }), u.current && (u.current.setMood("happy"), u.current.setBodyMovement("idle"), d.current && d.current())) : v.current && v.current();
7463
+ }), c.current.onLessonStart({
7464
+ moduleIndex: l.current.currentModuleIndex,
7465
+ lessonIndex: l.current.currentLessonIndex,
7466
+ lesson: R()
7467
+ }), u.current && (u.current.setMood("happy"), u.current.setBodyMovement("idle"))) : I.current && I.current();
7438
7468
  }, []), V = E(() => {
7439
- const b = I();
7440
- let R = null;
7469
+ const b = R();
7470
+ let v = null;
7441
7471
  if (b?.avatar_script && b?.body) {
7442
- const w = b.avatar_script.trim(), L = b.body.trim(), C = w.match(/[.!?]$/) ? " " : ". ";
7443
- R = `${w}${C}${L}`;
7472
+ const z = b.avatar_script.trim(), L = b.body.trim(), H = z.match(/[.!?]$/) ? " " : ". ";
7473
+ v = `${z}${H}${L}`;
7444
7474
  } else
7445
- R = b?.avatar_script || b?.body || null;
7446
- if (u.current && u.current.isReady && R) {
7475
+ v = b?.avatar_script || b?.body || null;
7476
+ if (u.current && u.current.isReady && v) {
7447
7477
  l.current.isTeaching = !0, l.current.isQuestionMode = !1, u.current.setMood("happy");
7448
- let w = !1;
7478
+ let z = !1;
7449
7479
  if (e.teaching)
7450
7480
  try {
7451
- u.current.playAnimation(e.teaching, !0), w = !0;
7452
- } catch (C) {
7453
- console.warn("Failed to play teaching animation:", C);
7481
+ u.current.playAnimation(e.teaching, !0), z = !0;
7482
+ } catch (H) {
7483
+ console.warn("Failed to play teaching animation:", H);
7454
7484
  }
7455
- w || u.current.setBodyMovement("gesturing");
7456
- const L = z.current || { lipsyncLang: "en" };
7485
+ z || u.current.setBodyMovement("gesturing");
7486
+ const L = C.current || { lipsyncLang: "en" };
7457
7487
  c.current.onLessonStart({
7458
7488
  moduleIndex: l.current.currentModuleIndex,
7459
7489
  lessonIndex: l.current.currentLessonIndex,
@@ -7463,24 +7493,30 @@ const ot = ye(({
7463
7493
  moduleIndex: l.current.currentModuleIndex,
7464
7494
  lessonIndex: l.current.currentLessonIndex,
7465
7495
  lesson: b
7466
- }), u.current.speakText(R, {
7496
+ }), u.current.speakText(v, {
7467
7497
  lipsyncLang: L.lipsyncLang,
7468
7498
  onSpeechEnd: () => {
7469
- l.current.isTeaching = !1, b.questions && b.questions.length > 0 ? H.current && H.current() : y.current && y.current();
7499
+ l.current.isTeaching = !1, c.current.onCustomAction({
7500
+ type: "teachingComplete",
7501
+ moduleIndex: l.current.currentModuleIndex,
7502
+ lessonIndex: l.current.currentLessonIndex,
7503
+ lesson: b,
7504
+ hasQuestions: b.questions && b.questions.length > 0
7505
+ });
7470
7506
  }
7471
7507
  });
7472
7508
  }
7473
- }, [e.teaching, I]), q = E((b) => {
7474
- const R = O(), w = B(b, R);
7475
- if (w && (l.current.score += 1), c.current.onQuestionAnswer({
7509
+ }, [e.teaching, R]), q = E((b) => {
7510
+ const v = O(), z = B(b, v);
7511
+ if (z && (l.current.score += 1), c.current.onQuestionAnswer({
7476
7512
  moduleIndex: l.current.currentModuleIndex,
7477
7513
  lessonIndex: l.current.currentLessonIndex,
7478
7514
  questionIndex: l.current.currentQuestionIndex,
7479
7515
  answer: b,
7480
- isCorrect: w,
7481
- question: R
7516
+ isCorrect: z,
7517
+ question: v
7482
7518
  }), u.current)
7483
- if (w) {
7519
+ if (z) {
7484
7520
  if (u.current.setMood("happy"), e.correct)
7485
7521
  try {
7486
7522
  u.current.playReaction("happy");
@@ -7488,11 +7524,18 @@ const ot = ye(({
7488
7524
  u.current.setBodyMovement("happy");
7489
7525
  }
7490
7526
  u.current.setBodyMovement("gesturing");
7491
- const L = R.type === "code_test" ? `Great job! Your code passed all the tests! ${R.explanation || ""}` : `Excellent! That's correct! ${R.explanation || ""}`, C = z.current || { lipsyncLang: "en" };
7527
+ const L = v.type === "code_test" ? `Great job! Your code passed all the tests! ${v.explanation || ""}` : `Excellent! That's correct! ${v.explanation || ""}`, H = C.current || { lipsyncLang: "en" };
7492
7528
  u.current.speakText(L, {
7493
- lipsyncLang: C.lipsyncLang,
7529
+ lipsyncLang: H.lipsyncLang,
7494
7530
  onSpeechEnd: () => {
7495
- x.current && x.current();
7531
+ c.current.onCustomAction({
7532
+ type: "answerFeedbackComplete",
7533
+ moduleIndex: l.current.currentModuleIndex,
7534
+ lessonIndex: l.current.currentLessonIndex,
7535
+ questionIndex: l.current.currentQuestionIndex,
7536
+ isCorrect: !0,
7537
+ hasNextQuestion: l.current.currentQuestionIndex < (R()?.questions?.length || 0) - 1
7538
+ });
7496
7539
  }
7497
7540
  });
7498
7541
  } else {
@@ -7503,27 +7546,42 @@ const ot = ye(({
7503
7546
  u.current.setBodyMovement("idle");
7504
7547
  }
7505
7548
  u.current.setBodyMovement("gesturing");
7506
- const L = R.type === "code_test" ? `Your code didn't pass all the tests. ${R.explanation || "Try again!"}` : `Not quite right, but don't worry! ${R.explanation || ""} Let's move on to the next question.`, C = z.current || { lipsyncLang: "en" };
7549
+ const L = v.type === "code_test" ? `Your code didn't pass all the tests. ${v.explanation || "Try again!"}` : `Not quite right, but don't worry! ${v.explanation || ""} Let's move on to the next question.`, H = C.current || { lipsyncLang: "en" };
7507
7550
  u.current.speakText(L, {
7508
- lipsyncLang: C.lipsyncLang,
7551
+ lipsyncLang: H.lipsyncLang,
7509
7552
  onSpeechEnd: () => {
7510
- x.current && x.current();
7553
+ c.current.onCustomAction({
7554
+ type: "answerFeedbackComplete",
7555
+ moduleIndex: l.current.currentModuleIndex,
7556
+ lessonIndex: l.current.currentLessonIndex,
7557
+ questionIndex: l.current.currentQuestionIndex,
7558
+ isCorrect: !1,
7559
+ hasNextQuestion: l.current.currentQuestionIndex < (R()?.questions?.length || 0) - 1
7560
+ });
7511
7561
  }
7512
7562
  });
7513
7563
  }
7514
7564
  else
7515
- x.current && x.current();
7516
- }, [e.correct, e.incorrect, O, B]), _ = E((b) => {
7517
- const R = O();
7565
+ c.current.onCustomAction({
7566
+ type: "answerFeedbackComplete",
7567
+ moduleIndex: l.current.currentModuleIndex,
7568
+ lessonIndex: l.current.currentLessonIndex,
7569
+ questionIndex: l.current.currentQuestionIndex,
7570
+ isCorrect: z,
7571
+ hasNextQuestion: l.current.currentQuestionIndex < (R()?.questions?.length || 0) - 1,
7572
+ avatarNotReady: !0
7573
+ });
7574
+ }, [e.correct, e.incorrect, O, R, B]), _ = E((b) => {
7575
+ const v = O();
7518
7576
  if (!b || typeof b != "object") {
7519
7577
  console.error("Invalid code test result format. Expected object with {passed: boolean, ...}");
7520
7578
  return;
7521
7579
  }
7522
- if (R?.type !== "code_test") {
7580
+ if (v?.type !== "code_test") {
7523
7581
  console.warn("Current question is not a code test. Use handleAnswerSelect for other question types.");
7524
7582
  return;
7525
7583
  }
7526
- const w = {
7584
+ const z = {
7527
7585
  passed: b.passed === !0,
7528
7586
  results: b.results || [],
7529
7587
  output: b.output || "",
@@ -7538,21 +7596,21 @@ const ot = ye(({
7538
7596
  moduleIndex: l.current.currentModuleIndex,
7539
7597
  lessonIndex: l.current.currentLessonIndex,
7540
7598
  questionIndex: l.current.currentQuestionIndex,
7541
- testResult: w,
7542
- question: R
7543
- }), p.current && p.current(w);
7599
+ testResult: z,
7600
+ question: v
7601
+ }), p.current && p.current(z);
7544
7602
  }, [O, B]), le = E(() => {
7545
7603
  l.current.currentModuleIndex = 0, l.current.currentLessonIndex = 0, l.current.currentQuestionIndex = 0, l.current.isTeaching = !1, l.current.isQuestionMode = !1, l.current.lessonCompleted = !1, l.current.curriculumCompleted = !1, l.current.score = 0, l.current.totalQuestions = 0;
7546
- }, []), pe = E((b) => {
7604
+ }, []), ye = E((b) => {
7547
7605
  console.log("Avatar is ready!", b);
7548
- const R = I(), w = R?.avatar_script || R?.body;
7549
- h && w && setTimeout(() => {
7606
+ const v = R(), z = v?.avatar_script || v?.body;
7607
+ h && z && setTimeout(() => {
7550
7608
  d.current && d.current();
7551
7609
  }, 10);
7552
- }, [h, I]);
7553
- Fe(() => {
7554
- d.current = V, g.current = W, y.current = $, x.current = P, v.current = j, H.current = S, p.current = q;
7555
- }), fe(a, () => ({
7610
+ }, [h, R]);
7611
+ Pe(() => {
7612
+ d.current = V, g.current = W, y.current = $, x.current = P, I.current = Y, T.current = S, p.current = q;
7613
+ }), Re(a, () => ({
7556
7614
  // Curriculum control methods
7557
7615
  startTeaching: V,
7558
7616
  startQuestions: S,
@@ -7561,37 +7619,37 @@ const ot = ye(({
7561
7619
  nextQuestion: P,
7562
7620
  nextLesson: W,
7563
7621
  completeLesson: $,
7564
- completeCurriculum: j,
7622
+ completeCurriculum: Y,
7565
7623
  resetCurriculum: le,
7566
7624
  getState: () => ({ ...l.current }),
7567
7625
  getCurrentQuestion: () => O(),
7568
- getCurrentLesson: () => I(),
7626
+ getCurrentLesson: () => R(),
7569
7627
  // Direct access to avatar ref (always returns current value)
7570
7628
  getAvatarRef: () => u.current,
7571
7629
  // Convenience methods that delegate to avatar (always check current ref)
7572
- speakText: async (b, R = {}) => {
7630
+ speakText: async (b, v = {}) => {
7573
7631
  await u.current?.resumeAudioContext?.();
7574
- const w = z.current || { lipsyncLang: "en" };
7575
- u.current?.speakText(b, { ...R, lipsyncLang: R.lipsyncLang || w.lipsyncLang });
7632
+ const z = C.current || { lipsyncLang: "en" };
7633
+ u.current?.speakText(b, { ...v, lipsyncLang: v.lipsyncLang || z.lipsyncLang });
7576
7634
  },
7577
7635
  resumeAudioContext: async () => {
7578
7636
  if (u.current?.resumeAudioContext)
7579
7637
  return await u.current.resumeAudioContext();
7580
7638
  const b = u.current?.talkingHead;
7581
7639
  if (b?.audioCtx) {
7582
- const R = b.audioCtx;
7583
- if (R.state === "suspended" || R.state === "interrupted")
7640
+ const v = b.audioCtx;
7641
+ if (v.state === "suspended" || v.state === "interrupted")
7584
7642
  try {
7585
- await R.resume(), console.log("Audio context resumed via talkingHead");
7586
- } catch (w) {
7587
- console.warn("Failed to resume audio context:", w);
7643
+ await v.resume(), console.log("Audio context resumed via talkingHead");
7644
+ } catch (z) {
7645
+ console.warn("Failed to resume audio context:", z);
7588
7646
  }
7589
7647
  } else
7590
7648
  console.warn("Audio context not available yet");
7591
7649
  },
7592
7650
  stopSpeaking: () => u.current?.stopSpeaking(),
7593
7651
  setMood: (b) => u.current?.setMood(b),
7594
- playAnimation: (b, R) => u.current?.playAnimation(b, R),
7652
+ playAnimation: (b, v) => u.current?.playAnimation(b, v),
7595
7653
  setBodyMovement: (b) => u.current?.setBodyMovement(b),
7596
7654
  setMovementIntensity: (b) => u.current?.setMovementIntensity(b),
7597
7655
  playRandomDance: () => u.current?.playRandomDance(),
@@ -7602,10 +7660,10 @@ const ot = ye(({
7602
7660
  lockAvatarPosition: () => u.current?.lockAvatarPosition(),
7603
7661
  unlockAvatarPosition: () => u.current?.unlockAvatarPosition(),
7604
7662
  // Custom action trigger
7605
- triggerCustomAction: (b, R) => {
7663
+ triggerCustomAction: (b, v) => {
7606
7664
  c.current.onCustomAction({
7607
7665
  type: b,
7608
- ...R,
7666
+ ...v,
7609
7667
  state: { ...l.current }
7610
7668
  });
7611
7669
  },
@@ -7613,8 +7671,8 @@ const ot = ye(({
7613
7671
  handleResize: () => u.current?.handleResize(),
7614
7672
  // Avatar readiness check (always returns current value)
7615
7673
  isAvatarReady: () => u.current?.isReady || !1
7616
- }), [V, S, q, _, P, W, $, j, le, O, I]);
7617
- const K = z.current || {
7674
+ }), [V, S, q, _, P, W, $, Y, le, O, R]);
7675
+ const K = C.current || {
7618
7676
  avatarUrl: "/avatars/brunette.glb",
7619
7677
  avatarBody: "F",
7620
7678
  mood: "happy",
@@ -7628,7 +7686,7 @@ const ot = ye(({
7628
7686
  animations: e
7629
7687
  };
7630
7688
  return /* @__PURE__ */ oe("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ oe(
7631
- He,
7689
+ Te,
7632
7690
  {
7633
7691
  ref: u,
7634
7692
  avatarUrl: K.avatarUrl,
@@ -7643,7 +7701,7 @@ const ot = ye(({
7643
7701
  showFullAvatar: K.showFullAvatar,
7644
7702
  cameraView: "upper",
7645
7703
  animations: K.animations,
7646
- onReady: pe,
7704
+ onReady: ye,
7647
7705
  onLoading: () => {
7648
7706
  },
7649
7707
  onError: (b) => {
@@ -7652,8 +7710,8 @@ const ot = ye(({
7652
7710
  }
7653
7711
  ) });
7654
7712
  });
7655
- ot.displayName = "CurriculumLearning";
7656
- const Te = {
7713
+ st.displayName = "CurriculumLearning";
7714
+ const Me = {
7657
7715
  // Code-based dance animations (no FBX required)
7658
7716
  dance: {
7659
7717
  name: "dance",
@@ -7756,14 +7814,14 @@ const Te = {
7756
7814
  duration: 5e3,
7757
7815
  description: "Excited, energetic movement"
7758
7816
  }
7759
- }, pt = (D) => Te[D] || null, gt = (D) => Te.hasOwnProperty(D);
7817
+ }, gt = (D) => Me[D] || null, yt = (D) => Me.hasOwnProperty(D);
7760
7818
  export {
7761
- ot as CurriculumLearning,
7762
- He as TalkingHeadAvatar,
7763
- nt as TalkingHeadComponent,
7764
- Te as animations,
7765
- xe as getActiveTTSConfig,
7766
- pt as getAnimation,
7767
- mt as getVoiceOptions,
7768
- gt as hasAnimation
7819
+ st as CurriculumLearning,
7820
+ Te as TalkingHeadAvatar,
7821
+ ot as TalkingHeadComponent,
7822
+ Me as animations,
7823
+ ve as getActiveTTSConfig,
7824
+ gt as getAnimation,
7825
+ pt as getVoiceOptions,
7826
+ yt as hasAnimation
7769
7827
  };