@sage-rsc/talking-head-react 1.0.50 → 1.0.51

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 He, jsx as se } from "react/jsx-runtime";
2
- import { forwardRef as Re, useRef as G, useState as he, useEffect as ue, useCallback as E, useImperativeHandle as ve, useLayoutEffect as Be } from "react";
1
+ import { jsxs as ke, jsx as se } from "react/jsx-runtime";
2
+ import { forwardRef as ye, useRef as G, useState as he, useEffect as ue, useCallback as E, useImperativeHandle as fe, useLayoutEffect as Ee } from "react";
3
3
  import * as f from "three";
4
- import { OrbitControls as De } from "three/addons/controls/OrbitControls.js";
5
- import { GLTFLoader as Oe } from "three/addons/loaders/GLTFLoader.js";
6
- import { DRACOLoader as Ne } from "three/addons/loaders/DRACOLoader.js";
7
- import { FBXLoader as Se } from "three/addons/loaders/FBXLoader.js";
8
- import { RoomEnvironment as Ue } from "three/addons/environments/RoomEnvironment.js";
9
- import We from "three/addons/libs/stats.module.js";
10
- let m, q, K;
11
- const A = [0, 0, 0, 0], k = new f.Vector3(), pe = new f.Vector3(), X = new f.Vector3(), ge = new f.Vector3();
4
+ import { OrbitControls as Fe } from "three/addons/controls/OrbitControls.js";
5
+ import { GLTFLoader as Pe } from "three/addons/loaders/GLTFLoader.js";
6
+ import { DRACOLoader as Be } from "three/addons/loaders/DRACOLoader.js";
7
+ import { FBXLoader as ve } from "three/addons/loaders/FBXLoader.js";
8
+ import { RoomEnvironment as De } from "three/addons/environments/RoomEnvironment.js";
9
+ import Oe from "three/addons/libs/stats.module.js";
10
+ let m, Q, K;
11
+ const A = [0, 0, 0, 0], k = new f.Vector3(), ce = new f.Vector3(), X = new f.Vector3(), me = new f.Vector3();
12
12
  new f.Plane();
13
13
  new f.Ray();
14
14
  new f.Euler();
15
- const Y = new f.Quaternion(), ke = new f.Quaternion(), ee = new f.Matrix4(), te = new f.Matrix4();
15
+ const Y = new f.Quaternion(), Ie = new f.Quaternion(), ee = new f.Matrix4(), te = new f.Matrix4();
16
16
  new f.Vector3();
17
- const ye = new f.Vector3(0, 0, 1), Ve = new f.Vector3(1, 0, 0), Ge = new f.Vector3(0, 1, 0), Ze = new f.Vector3(0, 0, 1);
18
- class Xe {
17
+ const pe = new f.Vector3(0, 0, 1), Ne = new f.Vector3(1, 0, 0), Ue = new f.Vector3(0, 1, 0), We = new f.Vector3(0, 0, 1);
18
+ class Ve {
19
19
  constructor(t = null) {
20
20
  this.opt = Object.assign({
21
21
  warmupMs: 2e3,
@@ -338,7 +338,7 @@ class Xe {
338
338
  ea: [0, 0, 0, 0]
339
339
  // External acceleration [m/s^2]
340
340
  };
341
- u.boneParent.matrixWorld.decompose(k, Y, X), k.copy(ye).applyQuaternion(Y).setY(0).normalize(), Y.premultiply(ke.setFromUnitVectors(ye, k).invert()).normalize(), u.qWorldInverseYaw = Y.clone().normalize(), this.data.push(u), this.dict[h] = u;
341
+ u.boneParent.matrixWorld.decompose(k, Y, X), k.copy(pe).applyQuaternion(Y).setY(0).normalize(), Y.premultiply(Ie.setFromUnitVectors(pe, k).invert()).normalize(), u.qWorldInverseYaw = Y.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 Xe {
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, Y, X), k.copy(ye).applyQuaternion(Y).setY(0).normalize(), Y.premultiply(ke.setFromUnitVectors(ye, k).invert()).normalize(), o.boneParent.quaternion.multiply(Y.invert()), o.boneParent.quaternion.multiply(o.qWorldInverseYaw)), o.isZ && (m = Math.atan(A[0] / o.l), Y.setFromAxisAngle(Ze, -m), o.boneParent.quaternion.multiply(Y)), 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), Y.setFromAxisAngle(Ve, -m), o.boneParent.quaternion.multiply(Y)), o.isT && (m = 1.5 * Math.tanh(A[3] * 1.5), Y.setFromAxisAngle(Ge, -m), o.boneParent.quaternion.multiply(Y)), 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, Y, X), k.copy(pe).applyQuaternion(Y).setY(0).normalize(), Y.premultiply(Ie.setFromUnitVectors(pe, k).invert()).normalize(), o.boneParent.quaternion.multiply(Y.invert()), o.boneParent.quaternion.multiply(o.qWorldInverseYaw)), o.isZ && (m = Math.atan(A[0] / o.l), Y.setFromAxisAngle(We, -m), o.boneParent.quaternion.multiply(Y)), 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), Y.setFromAxisAngle(Ne, -m), o.boneParent.quaternion.multiply(Y)), o.isT && (m = 1.5 * Math.tanh(A[3] * 1.5), Y.setFromAxisAngle(Ue, -m), o.boneParent.quaternion.multiply(Y)), 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], X.set(0, 0, 0), m.deltaLocal && (X.x += m.deltaLocal[0], X.y += m.deltaLocal[1], X.z += m.deltaLocal[2]), X.applyMatrix4(m.bone.matrixWorld), te.copy(o.boneParent.matrixWorld).invert(), X.applyMatrix4(te), k.copy(o.bone.position), !(k.distanceToSquared(X) >= m.radiusSq) && (K = k.length(), q = X.length(), !(q > m.radius + K) && (q < Math.abs(m.radius - K) || (q = (q * q + K * K - m.radiusSq) / (2 * q), X.normalize(), ge.copy(X).multiplyScalar(q), q = Math.sqrt(K * K - q * q), k.subVectors(k, ge).projectOnPlane(X).normalize().multiplyScalar(q), pe.subVectors(o.vBasis, ge).projectOnPlane(X).normalize(), K = pe.dot(k), K < 0 && (K = Math.sqrt(q * q - K * K), pe.multiplyScalar(K), k.add(pe)), k.add(ge).normalize(), X.copy(o.bone.position).normalize(), Y.setFromUnitVectors(X, k), o.boneParent.quaternion.premultiply(Y), o.boneParent.updateWorldMatrix(!1, !0))));
374
+ m = o.excludes[i], X.set(0, 0, 0), m.deltaLocal && (X.x += m.deltaLocal[0], X.y += m.deltaLocal[1], X.z += m.deltaLocal[2]), X.applyMatrix4(m.bone.matrixWorld), te.copy(o.boneParent.matrixWorld).invert(), X.applyMatrix4(te), k.copy(o.bone.position), !(k.distanceToSquared(X) >= m.radiusSq) && (K = k.length(), Q = X.length(), !(Q > m.radius + K) && (Q < Math.abs(m.radius - K) || (Q = (Q * Q + K * K - m.radiusSq) / (2 * Q), X.normalize(), me.copy(X).multiplyScalar(Q), Q = Math.sqrt(K * K - Q * Q), k.subVectors(k, me).projectOnPlane(X).normalize().multiplyScalar(Q), ce.subVectors(o.vBasis, me).projectOnPlane(X).normalize(), K = ce.dot(k), K < 0 && (K = Math.sqrt(Q * Q - K * K), ce.multiplyScalar(K), k.add(ce)), k.add(me).normalize(), X.copy(o.bone.position).normalize(), Y.setFromUnitVectors(X, k), o.boneParent.quaternion.premultiply(Y), o.boneParent.updateWorldMatrix(!1, !0))));
375
375
  }
376
376
  this.helpers.isActive && this.updateHelpers();
377
377
  }
@@ -489,7 +489,7 @@ class Xe {
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 Ye {
492
+ class Ge {
493
493
  constructor(t) {
494
494
  this.audioContext = t, this.analyzer = null, this.dataArray = null, this.bufferLength = 0;
495
495
  }
@@ -814,7 +814,7 @@ class Ye {
814
814
  return n * s;
815
815
  }
816
816
  }
817
- class je {
817
+ class Ze {
818
818
  /**
819
819
  * @constructor
820
820
  */
@@ -1396,11 +1396,11 @@ class je {
1396
1396
  return e;
1397
1397
  }
1398
1398
  }
1399
- const Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1399
+ const Xe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1400
1400
  __proto__: null,
1401
- LipsyncEn: je
1401
+ LipsyncEn: Ze
1402
1402
  }, Symbol.toStringTag, { value: "Module" }));
1403
- class qe {
1403
+ class Ye {
1404
1404
  /**
1405
1405
  * @constructor
1406
1406
  */
@@ -1754,11 +1754,11 @@ class qe {
1754
1754
  return e;
1755
1755
  }
1756
1756
  }
1757
- const _e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1757
+ const je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1758
1758
  __proto__: null,
1759
- LipsyncDe: qe
1759
+ LipsyncDe: Ye
1760
1760
  }, Symbol.toStringTag, { value: "Module" }));
1761
- class Ke {
1761
+ class Qe {
1762
1762
  /**
1763
1763
  * @constructor
1764
1764
  */
@@ -2289,11 +2289,11 @@ class Ke {
2289
2289
  return e;
2290
2290
  }
2291
2291
  }
2292
- const Je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2292
+ const qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2293
2293
  __proto__: null,
2294
- LipsyncFr: Ke
2294
+ LipsyncFr: Qe
2295
2295
  }, Symbol.toStringTag, { value: "Module" }));
2296
- class $e {
2296
+ class _e {
2297
2297
  /**
2298
2298
  * @constructor
2299
2299
  */
@@ -2436,11 +2436,11 @@ class $e {
2436
2436
  return e;
2437
2437
  }
2438
2438
  }
2439
- const et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2439
+ const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2440
2440
  __proto__: null,
2441
- LipsyncFi: $e
2441
+ LipsyncFi: _e
2442
2442
  }, Symbol.toStringTag, { value: "Module" }));
2443
- class tt {
2443
+ class Je {
2444
2444
  /**
2445
2445
  * @constructor
2446
2446
  */
@@ -2620,24 +2620,24 @@ class tt {
2620
2620
  return e;
2621
2621
  }
2622
2622
  }
2623
- const it = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2623
+ const $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2624
2624
  __proto__: null,
2625
- LipsyncLt: tt
2626
- }, Symbol.toStringTag, { value: "Module" })), nt = new URL("data:text/javascript;base64,Y2xhc3MgUGxheWJhY2tXb3JrbGV0IGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgRlNNID0gewogICAgSURMRTogMCwKICAgIFBMQVlJTkc6IDEsCiAgfTsKCiAgY29uc3RydWN0b3Iob3B0aW9ucykgewogICAgc3VwZXIoKTsKICAgIHRoaXMucG9ydC5vbm1lc3NhZ2UgPSB0aGlzLmhhbmRsZU1lc3NhZ2UuYmluZCh0aGlzKTsKCiAgICB0aGlzLl9zYW1wbGVSYXRlID0gb3B0aW9ucz8ucHJvY2Vzc29yT3B0aW9ucz8uc2FtcGxlUmF0ZSB8fCBzYW1wbGVSYXRlOwogICAgdGhpcy5fc2NhbGUgPSAxIC8gMzI3Njg7IC8vIFBDTTE2IC0+IGZsb2F0CgogICAgLy8gU2lsZW5jZSBkZXRlY3Rpb24gdGhyZXNob2xkICgxIHNlY29uZCkgYXMgYSBmYWxsYmFjayBzYWZldHkgbm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ApIHsKICAgICAgICAgIHRoaXMuX2N1cnJlbnRDaHVuayA9IHRoaXMuX2J1ZmZlclF1ZXVlLnNoaWZ0KCk7CiAgICAgICAgICB0aGlzLl9jdXJyZW50Q2h1bmtPZmZzZXQgPSAwOwogICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAvLyBCdWZmZXIgaXMgZW1wdHkuIENoZWNrIGZvciBlbmQgY29uZGl0aW9ucy4KICAgICAgICAgIGNvbnN0IGlzVGltZWRPdXQgPSB0aGlzLl9zaWxlbmNlRnJhbWVzQ291bnQgPiB0aGlzLl9zaWxlbmNlVGhyZXNob2xkQmxvY2tzOwoKICAgICAgICAgIGlmICh0aGlzLl9ub01vcmVEYXRhUmVjZWl2ZWQgfHwgaXNUaW1lZE91dCkgewogICAgICAgICAgICAvLyBFTkQgT0YgUExBWUJBQ0s6IEVpdGhlciBleHBsaWNpdGx5IHNpZ25hbGVkIG9yIHRpbWVkIG91dC4KICAgICAgICAgICAgaWYgKCF0aGlzLl9oYXNTZW50RW5kZWQpIHsKICAgICAgICAgICAgICB0aGlzLnBvcnQucG9zdE1lc3NhZ2UoeyB0eXBlOiAicGxheWJhY2stZW5kZWQiIH0pOwogICAgICAgICAgICAgIHRoaXMuX2hhc1NlbnRFbmRlZCA9IHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgLy8gU2VuZCBmaW5hbCBtZXRyaWNzIHNob3dpbmcgY2xlYXJlZCBzdGF0ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9IGNhdGNoIChfKSB7IH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnJlc2V0KCk7IC8vIFJlc2V0IHRvIElETEUgc3RhdGUgZm9yIHJldXNlCiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlIGxvb3AKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIC8vIEJVRkZFUiBVTkRFUlJVTiAoTEFHKTogUGxheSBzaWxlbmNlIGFuZCB3YWl0IGZvciBtb3JlIGRhdGEuCiAgICAgICAgICAgIHRoaXMuX3NpbGVuY2VGcmFtZXNDb3VudCsrOwogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHRoaXMuX3VuZGVycnVuQmxvY2tzKys7CiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlIGxvb3AKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KCiAgICAgIC8vIElmIHdlIGhhdmUgYSBjaHVuayAoY291bGQgYmUgYSBuZXcgb25lIGZyb20gdGhlIGxvZ2ljIGFib3ZlKSwgcHJvY2VzcyBpdC4KICAgICAgaWYgKHRoaXMuX2N1cnJlbnRDaHVuaykgewogICAgICAgIGNvbnN0IHNhbXBsZXNUb0NvcHkgPSBNY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FtcGxlUmF0ZSkgKiAxMDAwKSwKICAgICAgICAgICAgICBtYXhRdWV1ZWRNczogTWF0aC5yb3VuZCgodGhpcy5fbWF4UXVldWVTYW1wbGVzIC8gdGhpcy5fc2FtcGxlUmF0ZSkgKiAxMDAwKSwKICAgICAgICAgICAgICB1bmRlcnJ1bkJsb2NrczogdGhpcy5fdW5kZXJydW5CbG9ja3MsCiAgICAgICAgICAgICAgZnJhbWVzUHJvY2Vzc2VkOiB0aGlzLl9mcmFtZXNQcm9jZXNzZWQKICAgICAgICAgICAgfQogICAgICAgICAgfSk7CiAgICAgICAgfSBjYXRjaCAoXykgeyB9CiAgICAgICAgLy8gRG9uJ3QgcmVzZXQgbWF4IHRyYWNrZXIgLSBrZWVwIHNlc3Npb24gcGVhayB1bnRpbCBpZGxlCiAgICAgIH0KICAgIH0KCiAgICAvLyBBTFdBWVMgcmV0dXJuIHRydWUgdG8ga2VlcCB0aGUgcHJvY2Vzc29yIGFsaXZlIGZvciByZXVzZS4KICAgIHJldHVybiB0cnVlOwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoInBsYXliYWNrLXdvcmtsZXQiLCBQbGF5YmFja1dvcmtsZXQpOwo=", import.meta.url), we = {
2627
- en: Qe,
2628
- de: _e,
2629
- fr: Je,
2630
- fi: et,
2631
- lt: it
2632
- }, N = new f.Quaternion(), M = new f.Euler(), ie = new f.Vector3(), oe = new f.Vector3(), ze = new f.Box3();
2625
+ LipsyncLt: Je
2626
+ }, Symbol.toStringTag, { value: "Module" })), et = new URL("data:text/javascript;base64,Y2xhc3MgUGxheWJhY2tXb3JrbGV0IGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgRlNNID0gewogICAgSURMRTogMCwKICAgIFBMQVlJTkc6IDEsCiAgfTsKCiAgY29uc3RydWN0b3Iob3B0aW9ucykgewogICAgc3VwZXIoKTsKICAgIHRoaXMucG9ydC5vbm1lc3NhZ2UgPSB0aGlzLmhh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ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9IGNhdGNoIChfKSB7IH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnJlc2V0KCk7IC8vIFJlc2V0IHRvIElETEUgc3RhdGUgZm9yIHJldXNlCiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlIGxvb3AKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIC8vIEJVRkZFUiBVTkRFUlJVTiAoTEFHKTogUGxheSBzaWxlbmNlIGFuZCB3YWl0IGZvciBtb3JlIGRhdGEuCiAgICAgICAgICAgIHRoaXMuX3NpbGVuY2VGcmFtZXNDb3VudCsrOwogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHRoaXMuX3VuZGVyc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m9jZXNzZWQ7CiAgICAgICAgdHJ5IHsKICAgICAgICAgIHRoaXMucG9ydC5wb3N0TWVzc2FnZSh7CiAgICAgICAgICAgIHR5cGU6ICJtZXRyaWNzIiwKICAgICAgICAgICAgZGF0YTogewogICAgICAgICAgICAgIHN0YXRlOiB0aGlzLl9zdGF0ZSwKICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzLAogICAgICAgICAgICAgIHF1ZXVlZE1zOiBNYXRoLnJvdW5kKChxdWV1ZWRTYW1wbGVzIC8gdGhpcy5fc2FtcGxlUmF0ZSkgKiAxMDAwKSwKICAgICAgICAgICAgICBtYXhRdWV1ZWRNczogTWF0aC5yb3VuZCgodGhpcy5fbWF4UXVldWVTYW1wbGVzIC8gdGhpcy5fc2FtcGxlUmF0ZSkgKiAxMDAwKSwKICAgICAgICAgICAgICB1bmRlcnJ1bkJsb2NrczogdGhpcy5fdW5kZXJydW5CbG9ja3MsCiAgICAgICAgICAgICAgZnJhbWVzUHJvY2Vzc2VkOiB0aGlzLl9mcmFtZXNQcm9jZXNzZWQKICAgICAgICAgICAgfQogICAgICAgICAgfSk7CiAgICAgICAgfSBjYXRjaCAoXykgeyB9CiAgICAgICAgLy8gRG9uJ3QgcmVzZXQgbWF4IHRyYWNrZXIgLSBrZWVwIHNlc3Npb24gcGVhayB1bnRpbCBpZGxlCiAgICAgIH0KICAgIH0KCiAgICAvLyBBTFdBWVMgcmV0dXJuIHRydWUgdG8ga2VlcCB0aGUgcHJvY2Vzc29yIGFsaXZlIGZvciByZXVzZS4KICAgIHJldHVybiB0cnVlOwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoInBsYXliYWNrLXdvcmtsZXQiLCBQbGF5YmFja1dvcmtsZXQpOwo=", import.meta.url), Ae = {
2627
+ en: Xe,
2628
+ de: je,
2629
+ fr: qe,
2630
+ fi: Ke,
2631
+ lt: $e
2632
+ }, N = new f.Quaternion(), M = new f.Euler(), ie = new f.Vector3(), oe = new f.Vector3(), Le = 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 ot = new f.Vector3(1, 0, 0);
2637
+ const tt = new f.Vector3(1, 0, 0);
2638
2638
  new f.Vector3(0, 1, 0);
2639
2639
  new f.Vector3(0, 0, 1);
2640
- class Te {
2640
+ class we {
2641
2641
  /**
2642
2642
  * Avatar.
2643
2643
  * @typedef {Object} Avatar
@@ -2746,9 +2746,9 @@ class Te {
2746
2746
  lightSpotDispersion: 1,
2747
2747
  avatarMood: "neutral",
2748
2748
  avatarMute: !1,
2749
- avatarIdleEyeContact: 0.2,
2749
+ avatarIdleEyeContact: 0.6,
2750
2750
  avatarIdleHeadMove: 0.5,
2751
- avatarSpeakingEyeContact: 0.5,
2751
+ avatarSpeakingEyeContact: 0.8,
2752
2752
  avatarSpeakingHeadMove: 0.5,
2753
2753
  avatarIgnoreCamera: !1,
2754
2754
  listeningSilenceThresholdLevel: 40,
@@ -2763,7 +2763,7 @@ class Te {
2763
2763
  avatarOnlyCamera: null,
2764
2764
  statsNode: null,
2765
2765
  statsStyle: null
2766
- }, Object.assign(this.opt, e || {}), this.opt.statsNode && (this.stats = new We(), 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 Oe(), 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: {
@@ -3631,7 +3631,7 @@ class Te {
3631
3631
  { delay: [1e3, 4e3, 1, 2], dt: [50, [100, 200], 100, [10, 400, 0], 50, [100, 200], 100], vs: { eyeBlinkLeft: [1, 1, 0, 0, 1, 1, 0], eyeBlinkRight: [1, 1, 0, 0, 1, 1, 0] } }
3632
3632
  ] }, this.animMoods = {
3633
3633
  neutral: {
3634
- baseline: { eyesLookDown: 0.1 },
3634
+ baseline: { eyesLookDown: 0 },
3635
3635
  speech: { deltaRate: 0, deltaPitch: 0, deltaVolume: 0 },
3636
3636
  anims: [
3637
3637
  { name: "breathing", delay: 1500, dt: [1200, 500, 1e3], vs: { chestInhale: [0.5, 0.5, 0] } },
@@ -3657,7 +3657,7 @@ class Te {
3657
3657
  ]
3658
3658
  },
3659
3659
  happy: {
3660
- baseline: { mouthSmile: 0.2, eyesLookDown: 0.1 },
3660
+ baseline: { mouthSmile: 0.2, eyesLookDown: 0 },
3661
3661
  speech: { deltaRate: 0, deltaPitch: 0.1, deltaVolume: 0 },
3662
3662
  anims: [
3663
3663
  { name: "breathing", delay: 1500, dt: [1200, 500, 1e3], vs: { chestInhale: [0.5, 0.5, 0] } },
@@ -4062,7 +4062,7 @@ class Te {
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 Ue()).texture, this.resizeobserver = new ResizeObserver(this.onResize.bind(this)), this.resizeobserver.observe(this.nodeAvatar), this.controls = new De(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 De()).texture, this.resizeobserver = new ResizeObserver(this.onResize.bind(this)), this.resizeobserver.observe(this.nodeAvatar), this.controls = new Fe(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 Te {
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 Xe(), 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 Ve(), 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 Ye(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 Ge(this.audioCtx), this.audioReverbNode = this.audioCtx.createConvolver(), this.audioBackgroundGainNode.connect(this.audioReverbNode), this.audioAnalyzerNode.connect(this.audioSpeechGainNode), this.audioSpeechGainNode.connect(this.audioReverbNode), this.audioStreamGainNode.connect(this.audioReverbNode), this.audioReverbNode.connect(this.audioCtx.destination), this.setReverb(this.currentReverb || null), this.setMixerGain(
4091
4091
  this.opt.mixerGainSpeech,
4092
4092
  this.opt.mixerGainBackground
4093
4093
  ), this.workletLoaded = !1, this.streamWorkletNode) {
@@ -4228,9 +4228,9 @@ class Te {
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 Oe();
4231
+ const i = new Pe();
4232
4232
  if (this.dracoEnabled) {
4233
- const a = new Ne();
4233
+ const a = new Be();
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 Te {
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(ot, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(N)), ze.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(ie), ie.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(oe), oe.sub(this.armature.position), this.objectHips.position.y -= ze.min.y / 2, this.objectHips.position.x -= (ie.x + oe.x) / 4, this.objectHips.position.z -= (ie.z + oe.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(tt, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(N)), Le.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(ie), ie.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(oe), oe.sub(this.armature.position), this.objectHips.position.y -= Le.min.y / 2, this.objectHips.position.x -= (ie.x + oe.x) / 4, this.objectHips.position.z -= (ie.z + oe.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 Te {
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 = we[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(we));
5214
+ const s = Ae[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(Ae));
5216
5216
  } catch (s) {
5217
5217
  console.warn(`Failed to load lip-sync module for ${t}:`, s);
5218
5218
  }
@@ -5251,10 +5251,10 @@ class Te {
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 I = x === y.length - 1, T = y[x].match(r);
5254
+ const I = x === y.length - 1, H = y[x].match(r);
5255
5255
  let p = y[x].match(s);
5256
- const C = y[x].match(h), H = y[x].match(o);
5257
- if (p && !I && !C && y[x + 1].match(s) && (p = !1), i && (u += y[x]), T && (!n || n.every((b) => x < b[0] || x > b[1])) && (l += y[x]), (H || p || I) && (l.length && (l = this.lipsyncPreProcessText(l, a), l.length && d.push({
5256
+ const z = y[x].match(h), C = y[x].match(o);
5257
+ if (p && !I && !z && y[x + 1].match(s) && (p = !1), i && (u += y[x]), H && (!n || n.every((b) => x < b[0] || x > b[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({
@@ -5287,7 +5287,7 @@ class Te {
5287
5287
  };
5288
5288
  i && (b.onSubtitles = i), d.length && !e.avatarMute && (b.text = d, e.avatarMood && (b.mood = e.avatarMood), e.ttsLang && (b.lang = e.ttsLang), e.ttsVoice && (b.voice = e.ttsVoice), e.ttsRate && (b.rate = e.ttsRate), e.ttsVoice && (b.pitch = e.ttsPitch), e.ttsVolume && (b.volume = e.ttsVolume)), this.speechQueue.push(b), d = [], l = "", c = 0, g = [];
5289
5289
  }
5290
- if (C) {
5290
+ if (z) {
5291
5291
  let b = this.animEmojis[y[x]];
5292
5292
  b && b.link && (b = this.animEmojis[b.link]), b && this.speechQueue.push({ emoji: b });
5293
5293
  }
@@ -5385,10 +5385,10 @@ class Te {
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 I = a + c.times[x] / d * u, T = c.durations[x] / d * u;
5388
+ const I = a + c.times[x] / d * u, H = c.durations[x] / d * u;
5389
5389
  o.push({
5390
5390
  template: { name: "viseme" },
5391
- ts: [I - Math.min(60, 2 * T / 3), I + Math.min(25, T / 2), I + T + Math.min(60, T / 2)],
5391
+ ts: [I - Math.min(60, 2 * H / 3), I + Math.min(25, H / 2), I + H + Math.min(60, H / 2)],
5392
5392
  vs: {
5393
5393
  ["viseme_" + c.visemes[x]]: [null, c.visemes[x] === "PP" || c.visemes[x] === "FF" ? 0.9 : y, 0]
5394
5394
  }
@@ -5470,7 +5470,7 @@ class Te {
5470
5470
  s.lang = o, s.rate = Math.max(0.1, Math.min(10, r)), s.pitch = Math.max(0, Math.min(2, h)), s.volume = Math.max(0, Math.min(1, a));
5471
5471
  const u = speechSynthesis.getVoices(), l = t.voice || this.avatar.ttsVoice || this.opt.ttsVoice;
5472
5472
  if (l && u.length > 0) {
5473
- const p = u.find((C) => C.name.includes(l) || C.lang === o);
5473
+ const p = u.find((z) => z.name.includes(l) || z.lang === o);
5474
5474
  p && (s.voice = p);
5475
5475
  }
5476
5476
  const c = n.length * 100 / s.rate, d = this.audioCtx.createBuffer(1, this.audioCtx.sampleRate * (c / 1e3), this.audioCtx.sampleRate), g = this.avatar.lipsyncLang || this.opt.lipsyncLang || "en", y = this.lipsyncPreProcessText(n, g), x = this.lipsyncWordsToVisemes(y, g);
@@ -5485,19 +5485,19 @@ class Te {
5485
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
- for (let C = 0; C < x.visemes.length; C++) {
5489
- const H = x.visemes[C], b = x.times[C] / p, U = x.durations[C] / p, B = b * c, j = U * c;
5488
+ for (let z = 0; z < x.visemes.length; z++) {
5489
+ const C = x.visemes[z], b = x.times[z] / p, U = x.durations[z] / p, B = b * c, j = U * c;
5490
5490
  I.push({
5491
5491
  template: { name: "viseme" },
5492
5492
  ts: [B - Math.min(60, 2 * j / 3), B + Math.min(25, j / 2), B + j + Math.min(60, j / 2)],
5493
5493
  vs: {
5494
- ["viseme_" + H]: [null, H === "PP" || H === "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 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 = () => {
5499
+ const H = [...t.anim, ...I];
5500
+ this.audioPlaylist.push({ anim: H, audio: d }), this.onSubtitles = t.onSubtitles || null, this.resetLips(), t.mood && this.setMood(t.mood), this.playAudio(), s.onend = () => {
5501
5501
  e();
5502
5502
  }, s.onerror = (p) => {
5503
5503
  console.error("Speech synthesis error:", p.error), i(p.error);
@@ -5895,7 +5895,7 @@ class Te {
5895
5895
  }
5896
5896
  if (!this.workletLoaded)
5897
5897
  try {
5898
- const r = this.audioCtx.audioWorklet.addModule(nt.href), h = new Promise(
5898
+ const r = this.audioCtx.audioWorklet.addModule(et.href), h = new Promise(
5899
5899
  (a, u) => setTimeout(() => u(new Error("Worklet loading timed out")), 5e3)
5900
5900
  );
5901
5901
  await Promise.race([r, h]), this.workletLoaded = !0;
@@ -6189,17 +6189,17 @@ class Te {
6189
6189
  t === null && (t = h), e === null && (e = a), N.copy(this.armature.quaternion), N.multiply(this.poseTarget.props["Hips.quaternion"]), N.multiply(this.poseTarget.props["Spine.quaternion"]), N.multiply(this.poseTarget.props["Spine1.quaternion"]), N.multiply(this.poseTarget.props["Spine2.quaternion"]), N.multiply(this.poseTarget.props["Neck.quaternion"]), N.multiply(this.poseTarget.props["Head.quaternion"]), M.setFromQuaternion(N);
6190
6190
  let u = M.x / (40 / 24), l = M.y / (9 / 4), c = Math.min(0.4, Math.max(-0.4, this.camera.rotation.x)), d = Math.min(0.4, Math.max(-0.4, this.camera.rotation.y)), g = Math.max(window.innerWidth - h, h), y = Math.max(window.innerHeight - a, a), x = this.convertRange(e, [a - y, a + y], [-0.3, 0.6]) - u + c, I = this.convertRange(t, [h - g, h + g], [-0.8, 0.8]) - l + d;
6191
6191
  x = Math.min(0.6, Math.max(-0.3, x)), I = Math.min(0.8, Math.max(-0.8, I));
6192
- let T = (Math.random() - 0.5) / 4, p = (Math.random() - 0.5) / 4;
6192
+ let H = (Math.random() - 0.5) / 4, p = (Math.random() - 0.5) / 4;
6193
6193
  if (i) {
6194
- let C = this.animQueue.findIndex((b) => b.template.name === "lookat");
6195
- C !== -1 && this.animQueue.splice(C, 1);
6196
- const H = {
6194
+ let z = this.animQueue.findIndex((b) => b.template.name === "lookat");
6195
+ z !== -1 && this.animQueue.splice(z, 1);
6196
+ const C = {
6197
6197
  name: "lookat",
6198
6198
  dt: [750, i],
6199
6199
  vs: {
6200
- bodyRotateX: [x + T],
6200
+ bodyRotateX: [x + H],
6201
6201
  bodyRotateY: [I + p],
6202
- eyesRotateX: [-3 * T + 0.1],
6202
+ eyesRotateX: [-3 * H + 0.1],
6203
6203
  eyesRotateY: [-5 * p],
6204
6204
  browInnerUp: [[0, 0.7]],
6205
6205
  mouthLeft: [[0, 0.7]],
@@ -6208,7 +6208,7 @@ class Te {
6208
6208
  headMove: [0]
6209
6209
  }
6210
6210
  };
6211
- this.animQueue.push(this.animFactory(H));
6211
+ this.animQueue.push(this.animFactory(C));
6212
6212
  }
6213
6213
  }
6214
6214
  /**
@@ -6403,7 +6403,7 @@ class Te {
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 Se();
6406
+ const u = new ve();
6407
6407
  let l;
6408
6408
  try {
6409
6409
  l = await u.loadAsync(t, e);
@@ -6480,7 +6480,7 @@ class Te {
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 Se().loadAsync(t, e);
6483
+ let h = await new ve().loadAsync(t, e);
6484
6484
  if (h && h.animations && h.animations[n]) {
6485
6485
  let a = h.animations[n];
6486
6486
  const u = {};
@@ -6577,12 +6577,12 @@ class Te {
6577
6577
  const x = t.iterations || 10;
6578
6578
  if (e)
6579
6579
  for (let I = 0; I < x; I++) {
6580
- let T = !1;
6581
- for (let p = 0, C = y.length; p < C; p++) {
6582
- const H = y[p].bone;
6583
- H.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();
6580
+ let H = !1;
6581
+ for (let p = 0, z = y.length; p < z; p++) {
6582
+ const C = y[p].bone;
6583
+ C.matrixWorld.decompose(h, a, u), a.invert(), o.setFromMatrixPosition(g.matrixWorld), r.subVectors(o, h), r.applyQuaternion(a), r.normalize(), s.subVectors(e, h), s.applyQuaternion(a), s.normalize();
6584
6584
  let b = s.dot(r);
6585
- b > 1 ? b = 1 : b < -1 && (b = -1), b = Math.acos(b), !(b < 1e-5) && (y[p].minAngle !== void 0 && b < y[p].minAngle && (b = y[p].minAngle), y[p].maxAngle !== void 0 && b > y[p].maxAngle && (b = y[p].maxAngle), l.crossVectors(r, s), l.normalize(), N.setFromAxisAngle(l, b), H.quaternion.multiply(N), H.rotation.setFromVector3(c.setFromEuler(H.rotation).clamp(new f.Vector3(
6585
+ b > 1 ? b = 1 : b < -1 && (b = -1), b = Math.acos(b), !(b < 1e-5) && (y[p].minAngle !== void 0 && b < y[p].minAngle && (b = y[p].minAngle), y[p].maxAngle !== void 0 && b > y[p].maxAngle && (b = y[p].maxAngle), l.crossVectors(r, s), l.normalize(), N.setFromAxisAngle(l, b), C.quaternion.multiply(N), C.rotation.setFromVector3(c.setFromEuler(C.rotation).clamp(new f.Vector3(
6586
6586
  y[p].minx !== void 0 ? y[p].minx : -1 / 0,
6587
6587
  y[p].miny !== void 0 ? y[p].miny : -1 / 0,
6588
6588
  y[p].minz !== void 0 ? y[p].minz : -1 / 0
@@ -6590,9 +6590,9 @@ class Te {
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
- ))), H.updateMatrixWorld(!0), T = !0);
6593
+ ))), C.updateMatrixWorld(!0), H = !0);
6594
6594
  }
6595
- if (!T) break;
6595
+ if (!H) break;
6596
6596
  }
6597
6597
  n && y.forEach((I) => {
6598
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;
@@ -6625,7 +6625,7 @@ const le = {
6625
6625
  josh: "VR6AewLTigWG4xSOukaG"
6626
6626
  // Male, American
6627
6627
  }
6628
- }, Ce = {
6628
+ }, Se = {
6629
6629
  defaultVoice: "aura-2-thalia-en",
6630
6630
  // Thalia (Female, English)
6631
6631
  voices: {
@@ -6645,7 +6645,7 @@ const le = {
6645
6645
  // Male, English - Powerful
6646
6646
  }
6647
6647
  };
6648
- function Ie() {
6648
+ function xe() {
6649
6649
  return {
6650
6650
  service: "elevenlabs",
6651
6651
  endpoint: le.endpoint,
@@ -6654,8 +6654,8 @@ function Ie() {
6654
6654
  voices: le.voices
6655
6655
  };
6656
6656
  }
6657
- function gt() {
6658
- const O = Ie(), t = [];
6657
+ function mt() {
6658
+ const O = xe(), t = [];
6659
6659
  return Object.entries(O.voices).forEach(([e, i]) => {
6660
6660
  t.push({
6661
6661
  value: i,
@@ -6663,7 +6663,7 @@ function gt() {
6663
6663
  });
6664
6664
  }), t;
6665
6665
  }
6666
- const Me = Re(({
6666
+ const ze = ye(({
6667
6667
  avatarUrl: O = "/avatars/brunette.glb",
6668
6668
  avatarBody: t = "F",
6669
6669
  mood: e = "neutral",
@@ -6685,29 +6685,29 @@ const Me = Re(({
6685
6685
  style: y = {},
6686
6686
  animations: x = {}
6687
6687
  }, I) => {
6688
- const T = G(null), p = G(null), C = G(a), [H, b] = he(!0), [U, B] = he(null), [j, ae] = he(!1);
6688
+ const H = G(null), p = G(null), z = G(a), [C, b] = he(!0), [U, B] = he(null), [j, ae] = he(!1);
6689
6689
  ue(() => {
6690
- C.current = a;
6690
+ z.current = a;
6691
6691
  }, [a]);
6692
- const L = Ie(), P = n || L.service;
6692
+ const L = xe(), F = n || L.service;
6693
6693
  let D;
6694
- P === "browser" ? D = {
6694
+ F === "browser" ? D = {
6695
6695
  service: "browser",
6696
6696
  endpoint: "",
6697
6697
  apiKey: null,
6698
6698
  defaultVoice: "Google US English"
6699
- } : P === "elevenlabs" ? D = {
6699
+ } : F === "elevenlabs" ? D = {
6700
6700
  service: "elevenlabs",
6701
6701
  endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
6702
6702
  apiKey: o || L.apiKey,
6703
6703
  defaultVoice: s || L.defaultVoice || le.defaultVoice,
6704
6704
  voices: L.voices || le.voices
6705
- } : P === "deepgram" ? D = {
6705
+ } : F === "deepgram" ? D = {
6706
6706
  service: "deepgram",
6707
6707
  endpoint: "https://api.deepgram.com/v1/speak",
6708
6708
  apiKey: o || L.apiKey,
6709
- defaultVoice: s || L.defaultVoice || Ce.defaultVoice,
6710
- voices: L.voices || Ce.voices
6709
+ defaultVoice: s || L.defaultVoice || Se.defaultVoice,
6710
+ voices: L.voices || Se.voices
6711
6711
  } : D = {
6712
6712
  ...L,
6713
6713
  // Override API key if provided via props
@@ -6717,7 +6717,7 @@ const Me = Re(({
6717
6717
  url: O,
6718
6718
  body: t,
6719
6719
  avatarMood: e,
6720
- ttsLang: P === "browser" ? "en-US" : i,
6720
+ ttsLang: F === "browser" ? "en-US" : i,
6721
6721
  ttsVoice: s || D.defaultVoice,
6722
6722
  lipsyncLang: "en",
6723
6723
  showFullAvatar: a,
@@ -6726,22 +6726,22 @@ const Me = Re(({
6726
6726
  }, J = {
6727
6727
  ttsEndpoint: D.endpoint,
6728
6728
  ttsApikey: D.apiKey,
6729
- ttsService: P,
6729
+ ttsService: F,
6730
6730
  lipsyncModules: ["en"],
6731
6731
  cameraView: u
6732
6732
  }, $ = E(async () => {
6733
- if (!(!T.current || p.current))
6733
+ if (!(!H.current || p.current))
6734
6734
  try {
6735
- if (b(!0), B(null), p.current = new Te(T.current, J), 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, (V) => {
6735
+ if (b(!0), B(null), p.current = new we(H.current, J), 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, (V) => {
6736
6736
  if (V.lengthComputable) {
6737
- const w = Math.min(100, Math.round(V.loaded / V.total * 100));
6738
- c(w);
6737
+ const T = Math.min(100, Math.round(V.loaded / V.total * 100));
6738
+ c(T);
6739
6739
  }
6740
6740
  }), await new Promise((V) => {
6741
- const w = () => {
6742
- p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? V() : setTimeout(w, 100);
6741
+ const T = () => {
6742
+ p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? V() : setTimeout(T, 100);
6743
6743
  };
6744
- w();
6744
+ T();
6745
6745
  }), p.current && p.current.setShowFullAvatar)
6746
6746
  try {
6747
6747
  p.current.setShowFullAvatar(a);
@@ -6749,11 +6749,11 @@ const Me = Re(({
6749
6749
  console.warn("Error setting full body mode on initialization:", V);
6750
6750
  }
6751
6751
  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()), b(!1), ae(!0), l(p.current);
6752
- const F = () => {
6752
+ const P = () => {
6753
6753
  document.visibilityState === "visible" ? p.current?.start() : p.current?.stop();
6754
6754
  };
6755
- return document.addEventListener("visibilitychange", F), () => {
6756
- document.removeEventListener("visibilitychange", F);
6755
+ return document.addEventListener("visibilitychange", P), () => {
6756
+ document.removeEventListener("visibilitychange", P);
6757
6757
  };
6758
6758
  } catch (S) {
6759
6759
  console.error("Error initializing TalkingHead:", S), B(S.message || "Failed to initialize avatar"), b(!1), d(S);
@@ -6762,17 +6762,17 @@ const Me = Re(({
6762
6762
  ue(() => ($(), () => {
6763
6763
  p.current && (p.current.stop(), p.current.dispose(), p.current = null);
6764
6764
  }), [$]), ue(() => {
6765
- if (!T.current || !p.current) return;
6765
+ if (!H.current || !p.current) return;
6766
6766
  const S = new ResizeObserver((V) => {
6767
- for (const w of V)
6767
+ for (const T of V)
6768
6768
  p.current && p.current.onResize && p.current.onResize();
6769
6769
  });
6770
- S.observe(T.current);
6771
- const F = () => {
6770
+ S.observe(H.current);
6771
+ const P = () => {
6772
6772
  p.current && p.current.onResize && p.current.onResize();
6773
6773
  };
6774
- return window.addEventListener("resize", F), () => {
6775
- S.disconnect(), window.removeEventListener("resize", F);
6774
+ return window.addEventListener("resize", P), () => {
6775
+ S.disconnect(), window.removeEventListener("resize", P);
6776
6776
  };
6777
6777
  }, [j]);
6778
6778
  const ne = E(async () => {
@@ -6782,62 +6782,43 @@ const Me = Re(({
6782
6782
  } catch (S) {
6783
6783
  console.warn("Failed to resume audio context:", S);
6784
6784
  }
6785
- }, []), fe = E(async (S, F = {}) => {
6785
+ }, []), ge = E(async (S, P = {}) => {
6786
6786
  if (p.current && j)
6787
6787
  try {
6788
6788
  await ne();
6789
6789
  const V = {
6790
- ...F,
6791
- lipsyncLang: F.lipsyncLang || W.lipsyncLang || "en"
6790
+ ...P,
6791
+ lipsyncLang: P.lipsyncLang || W.lipsyncLang || "en"
6792
6792
  };
6793
- if (F.onSpeechEnd && p.current) {
6794
- const w = p.current;
6795
- let Q = null, re = 0, de = !1;
6796
- const Fe = 1200, Pe = 1e4;
6797
- let Ae = 0;
6798
- const xe = setInterval(() => {
6799
- Ae++, w && w.isSpeaking && (w.audioPlaylist && w.audioPlaylist.length > 0 || w.isAudioPlaying === !0) && (de = !0, clearInterval(xe), Q = setInterval(Le, 50));
6800
- const ce = !w.speechQueue || w.speechQueue.length === 0;
6801
- if (w && !w.isSpeaking && ce && (!w.audioPlaylist || w.audioPlaylist.length === 0) && (!w.isAudioPlaying || w.isAudioPlaying === !1)) {
6802
- clearInterval(xe);
6803
- try {
6804
- F.onSpeechEnd();
6805
- } catch (me) {
6806
- console.error("Error in onSpeechEnd callback:", me);
6807
- }
6808
- return;
6809
- }
6810
- if (Ae * 50 > Pe) {
6811
- if (clearInterval(xe), w && w.isSpeaking)
6812
- de = !0, Q = setInterval(Le, 50);
6813
- else if (w && !w.isSpeaking && ce && (!w.audioPlaylist || w.audioPlaylist.length === 0) && (!w.isAudioPlaying || w.isAudioPlaying === !1))
6793
+ if (P.onSpeechEnd && p.current) {
6794
+ const T = p.current;
6795
+ let _ = null, re = 0;
6796
+ const be = 1200;
6797
+ let de = !1;
6798
+ _ = setInterval(() => {
6799
+ if (re++, re > be) {
6800
+ if (_ && (clearInterval(_), _ = null), !de) {
6801
+ de = !0;
6814
6802
  try {
6815
- F.onSpeechEnd();
6816
- } catch (me) {
6817
- console.error("Error in onSpeechEnd callback:", me);
6803
+ P.onSpeechEnd();
6804
+ } catch (Re) {
6805
+ console.error("Error in onSpeechEnd callback (timeout):", Re);
6818
6806
  }
6819
- }
6820
- }, 50), Le = () => {
6821
- if (re++, re > Fe) {
6822
- Q && (clearInterval(Q), Q = null);
6823
- try {
6824
- F.onSpeechEnd();
6825
- } catch (be) {
6826
- console.error("Error in onSpeechEnd callback:", be);
6827
6807
  }
6828
6808
  return;
6829
6809
  }
6830
- if (!de)
6831
- return;
6832
- const ce = !w.speechQueue || w.speechQueue.length === 0;
6833
- w && (!w.isSpeaking || w.isSpeaking === !1) && (!w.audioPlaylist || w.audioPlaylist.length === 0) && (!w.isAudioPlaying || w.isAudioPlaying === !1) && ce && (Q && (clearInterval(Q), Q = null), setTimeout(() => {
6834
- try {
6835
- F.onSpeechEnd();
6836
- } catch (be) {
6837
- console.error("Error in onSpeechEnd callback:", be);
6810
+ const He = !T.speechQueue || T.speechQueue.length === 0, Te = !T.audioPlaylist || T.audioPlaylist.length === 0;
6811
+ T && T.isSpeaking === !1 && He && Te && T.isAudioPlaying === !1 && !de && setTimeout(() => {
6812
+ if (T && T.isSpeaking === !1 && (!T.speechQueue || T.speechQueue.length === 0) && (!T.audioPlaylist || T.audioPlaylist.length === 0) && T.isAudioPlaying === !1 && !de) {
6813
+ de = !0, _ && (clearInterval(_), _ = null);
6814
+ try {
6815
+ P.onSpeechEnd();
6816
+ } catch (Me) {
6817
+ console.error("Error in onSpeechEnd callback:", Me);
6818
+ }
6838
6819
  }
6839
- }, 50));
6840
- };
6820
+ }, 100);
6821
+ }, 100);
6841
6822
  }
6842
6823
  p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(S, V)) : setTimeout(async () => {
6843
6824
  await ne(), p.current && p.current.lipsync && (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(S, V));
@@ -6845,41 +6826,41 @@ const Me = Re(({
6845
6826
  } catch (V) {
6846
6827
  console.error("Error speaking text:", V), B(V.message || "Failed to speak text");
6847
6828
  }
6848
- }, [j, ne, W.lipsyncLang]), _ = E(() => {
6829
+ }, [j, ne, W.lipsyncLang]), q = E(() => {
6849
6830
  p.current && (p.current.stopSpeaking(), p.current.setSlowdownRate && p.current.setSlowdownRate(1));
6850
6831
  }, []), R = E((S) => {
6851
6832
  p.current && p.current.setMood(S);
6852
6833
  }, []), v = E((S) => {
6853
6834
  p.current && p.current.setSlowdownRate && p.current.setSlowdownRate(S);
6854
- }, []), z = E((S, F = !1) => {
6835
+ }, []), w = E((S, P = !1) => {
6855
6836
  if (p.current && p.current.playAnimation) {
6856
6837
  if (x && x[S] && (S = x[S]), p.current.setShowFullAvatar)
6857
6838
  try {
6858
- p.current.setShowFullAvatar(C.current);
6859
- } catch (w) {
6860
- console.warn("Error setting full body mode:", w);
6839
+ p.current.setShowFullAvatar(z.current);
6840
+ } catch (T) {
6841
+ console.warn("Error setting full body mode:", T);
6861
6842
  }
6862
6843
  if (S.includes("."))
6863
6844
  try {
6864
- p.current.playAnimation(S, null, 10, 0, 0.01, F);
6865
- } catch (w) {
6866
- console.warn(`Failed to play ${S}:`, w);
6845
+ p.current.playAnimation(S, null, 10, 0, 0.01, P);
6846
+ } catch (T) {
6847
+ console.warn(`Failed to play ${S}:`, T);
6867
6848
  try {
6868
6849
  p.current.setBodyMovement("idle");
6869
- } catch (Q) {
6870
- console.warn("Fallback animation also failed:", Q);
6850
+ } catch (_) {
6851
+ console.warn("Fallback animation also failed:", _);
6871
6852
  }
6872
6853
  }
6873
6854
  else {
6874
- const w = [".fbx", ".glb", ".gltf"];
6875
- let Q = !1;
6876
- for (const re of w)
6855
+ const T = [".fbx", ".glb", ".gltf"];
6856
+ let _ = !1;
6857
+ for (const re of T)
6877
6858
  try {
6878
- p.current.playAnimation(S + re, null, 10, 0, 0.01, F), Q = !0;
6859
+ p.current.playAnimation(S + re, null, 10, 0, 0.01, P), _ = !0;
6879
6860
  break;
6880
6861
  } catch {
6881
6862
  }
6882
- if (!Q) {
6863
+ if (!_) {
6883
6864
  console.warn("Animation not found:", S);
6884
6865
  try {
6885
6866
  p.current.setBodyMovement("idle");
@@ -6892,29 +6873,29 @@ const Me = Re(({
6892
6873
  }, [x]), Z = E(() => {
6893
6874
  p.current && p.current.onResize && p.current.onResize();
6894
6875
  }, []);
6895
- return ve(I, () => ({
6896
- speakText: fe,
6897
- stopSpeaking: _,
6876
+ return fe(I, () => ({
6877
+ speakText: ge,
6878
+ stopSpeaking: q,
6898
6879
  resumeAudioContext: ne,
6899
6880
  setMood: R,
6900
6881
  setTimingAdjustment: v,
6901
- playAnimation: z,
6882
+ playAnimation: w,
6902
6883
  isReady: j,
6903
6884
  talkingHead: p.current,
6904
6885
  handleResize: Z,
6905
6886
  setBodyMovement: (S) => {
6906
6887
  if (p.current && p.current.setShowFullAvatar && p.current.setBodyMovement)
6907
6888
  try {
6908
- p.current.setShowFullAvatar(C.current), p.current.setBodyMovement(S);
6909
- } catch (F) {
6910
- console.warn("Error setting body movement:", F);
6889
+ p.current.setShowFullAvatar(z.current), p.current.setBodyMovement(S);
6890
+ } catch (P) {
6891
+ console.warn("Error setting body movement:", P);
6911
6892
  }
6912
6893
  },
6913
6894
  setMovementIntensity: (S) => p.current?.setMovementIntensity(S),
6914
6895
  playRandomDance: () => {
6915
6896
  if (p.current && p.current.setShowFullAvatar && p.current.playRandomDance)
6916
6897
  try {
6917
- p.current.setShowFullAvatar(C.current), p.current.playRandomDance();
6898
+ p.current.setShowFullAvatar(z.current), p.current.playRandomDance();
6918
6899
  } catch (S) {
6919
6900
  console.warn("Error playing random dance:", S);
6920
6901
  }
@@ -6922,15 +6903,15 @@ const Me = Re(({
6922
6903
  playReaction: (S) => {
6923
6904
  if (p.current && p.current.setShowFullAvatar && p.current.playReaction)
6924
6905
  try {
6925
- p.current.setShowFullAvatar(C.current), p.current.playReaction(S);
6926
- } catch (F) {
6927
- console.warn("Error playing reaction:", F);
6906
+ p.current.setShowFullAvatar(z.current), p.current.playReaction(S);
6907
+ } catch (P) {
6908
+ console.warn("Error playing reaction:", P);
6928
6909
  }
6929
6910
  },
6930
6911
  playCelebration: () => {
6931
6912
  if (p.current && p.current.setShowFullAvatar && p.current.playCelebration)
6932
6913
  try {
6933
- p.current.setShowFullAvatar(C.current), p.current.playCelebration();
6914
+ p.current.setShowFullAvatar(z.current), p.current.playCelebration();
6934
6915
  } catch (S) {
6935
6916
  console.warn("Error playing celebration:", S);
6936
6917
  }
@@ -6938,9 +6919,9 @@ const Me = Re(({
6938
6919
  setShowFullAvatar: (S) => {
6939
6920
  if (p.current && p.current.setShowFullAvatar)
6940
6921
  try {
6941
- C.current = S, p.current.setShowFullAvatar(S);
6942
- } catch (F) {
6943
- console.warn("Error setting showFullAvatar:", F);
6922
+ z.current = S, p.current.setShowFullAvatar(S);
6923
+ } catch (P) {
6924
+ console.warn("Error setting showFullAvatar:", P);
6944
6925
  }
6945
6926
  },
6946
6927
  lockAvatarPosition: () => {
@@ -6959,7 +6940,7 @@ const Me = Re(({
6959
6940
  console.warn("Error unlocking avatar position:", S);
6960
6941
  }
6961
6942
  }
6962
- })), /* @__PURE__ */ He(
6943
+ })), /* @__PURE__ */ ke(
6963
6944
  "div",
6964
6945
  {
6965
6946
  className: `talking-head-avatar ${g}`,
@@ -6973,7 +6954,7 @@ const Me = Re(({
6973
6954
  /* @__PURE__ */ se(
6974
6955
  "div",
6975
6956
  {
6976
- ref: T,
6957
+ ref: H,
6977
6958
  className: "talking-head-viewer",
6978
6959
  style: {
6979
6960
  width: "100%",
@@ -6982,7 +6963,7 @@ const Me = Re(({
6982
6963
  }
6983
6964
  }
6984
6965
  ),
6985
- H && /* @__PURE__ */ se("div", { className: "loading-overlay", style: {
6966
+ C && /* @__PURE__ */ se("div", { className: "loading-overlay", style: {
6986
6967
  position: "absolute",
6987
6968
  top: "50%",
6988
6969
  left: "50%",
@@ -7007,8 +6988,8 @@ const Me = Re(({
7007
6988
  }
7008
6989
  );
7009
6990
  });
7010
- Me.displayName = "TalkingHeadAvatar";
7011
- const st = Re(({
6991
+ ze.displayName = "TalkingHeadAvatar";
6992
+ const it = ye(({
7012
6993
  text: O = "Hello! I'm a talking avatar. How are you today?",
7013
6994
  onLoading: t = () => {
7014
6995
  },
@@ -7020,7 +7001,7 @@ const st = Re(({
7020
7001
  style: s = {},
7021
7002
  avatarConfig: o = {}
7022
7003
  }, r) => {
7023
- const h = G(null), a = G(null), [u, l] = he(!0), [c, d] = he(null), [g, y] = he(!1), x = Ie(), I = o.ttsService || x.service, T = I === "browser" ? {
7004
+ const h = G(null), a = G(null), [u, l] = he(!0), [c, d] = he(null), [g, y] = he(!1), x = xe(), I = o.ttsService || x.service, H = I === "browser" ? {
7024
7005
  endpoint: "",
7025
7006
  apiKey: null,
7026
7007
  defaultVoice: "Google US English"
@@ -7036,7 +7017,7 @@ const st = Re(({
7036
7017
  body: "F",
7037
7018
  avatarMood: "neutral",
7038
7019
  ttsLang: I === "browser" ? "en-US" : "en",
7039
- ttsVoice: o.ttsVoice || T.defaultVoice,
7020
+ ttsVoice: o.ttsVoice || H.defaultVoice,
7040
7021
  lipsyncLang: "en",
7041
7022
  // English lip-sync
7042
7023
  showFullAvatar: !0,
@@ -7044,16 +7025,16 @@ const st = Re(({
7044
7025
  bodyMovement: "idle",
7045
7026
  movementIntensity: 0.5,
7046
7027
  ...o
7047
- }, C = {
7048
- ttsEndpoint: T.endpoint,
7049
- ttsApikey: T.apiKey,
7028
+ }, z = {
7029
+ ttsEndpoint: H.endpoint,
7030
+ ttsApikey: H.apiKey,
7050
7031
  ttsService: I,
7051
7032
  lipsyncModules: ["en"],
7052
7033
  cameraView: "upper"
7053
- }, H = E(async () => {
7034
+ }, C = E(async () => {
7054
7035
  if (!(!h.current || a.current))
7055
7036
  try {
7056
- if (l(!0), d(null), a.current = new Te(h.current, C), await a.current.showAvatar(p, (D) => {
7037
+ if (l(!0), d(null), a.current = new we(h.current, z), await a.current.showAvatar(p, (D) => {
7057
7038
  if (D.lengthComputable) {
7058
7039
  const W = Math.min(100, Math.round(D.loaded / D.total * 100));
7059
7040
  t(W);
@@ -7076,27 +7057,27 @@ const st = Re(({
7076
7057
  console.warn("Error setting full body mode on initialization:", D);
7077
7058
  }
7078
7059
  l(!1), y(!0), i(a.current);
7079
- const P = () => {
7060
+ const F = () => {
7080
7061
  document.visibilityState === "visible" ? a.current?.start() : a.current?.stop();
7081
7062
  };
7082
- return document.addEventListener("visibilitychange", P), () => {
7083
- document.removeEventListener("visibilitychange", P);
7063
+ return document.addEventListener("visibilitychange", F), () => {
7064
+ document.removeEventListener("visibilitychange", F);
7084
7065
  };
7085
7066
  } catch (L) {
7086
7067
  console.error("Error initializing TalkingHead:", L), d(L.message || "Failed to initialize avatar"), l(!1), e(L);
7087
7068
  }
7088
7069
  }, []);
7089
- ue(() => (H(), () => {
7070
+ ue(() => (C(), () => {
7090
7071
  a.current && (a.current.stop(), a.current.dispose(), a.current = null);
7091
- }), [H]);
7072
+ }), [C]);
7092
7073
  const b = E((L) => {
7093
7074
  if (a.current && g)
7094
7075
  try {
7095
7076
  console.log("Speaking text:", L), 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(L)) : (console.warn("Lip-sync modules not ready, waiting..."), setTimeout(() => {
7096
7077
  a.current && a.current.lipsync ? (console.log("Lip-sync now ready, speaking..."), a.current.setSlowdownRate && (a.current.setSlowdownRate(1.05), console.log("Applied timing adjustment for better lip-sync")), a.current.speakText(L)) : console.error("Lip-sync still not ready after waiting");
7097
7078
  }, 500));
7098
- } catch (P) {
7099
- console.error("Error speaking text:", P), d(P.message || "Failed to speak text");
7079
+ } catch (F) {
7080
+ console.error("Error speaking text:", F), d(F.message || "Failed to speak text");
7100
7081
  }
7101
7082
  else
7102
7083
  console.warn("Avatar not ready for speaking. isReady:", g, "talkingHeadRef:", !!a.current);
@@ -7106,7 +7087,7 @@ const st = Re(({
7106
7087
  a.current && a.current.setMood(L);
7107
7088
  }, []), j = E((L) => {
7108
7089
  a.current && a.current.setSlowdownRate && (a.current.setSlowdownRate(L), console.log("Timing adjustment set to:", L));
7109
- }, []), ae = E((L, P = !1) => {
7090
+ }, []), ae = E((L, F = !1) => {
7110
7091
  if (a.current && a.current.playAnimation) {
7111
7092
  if (a.current.setShowFullAvatar)
7112
7093
  try {
@@ -7116,7 +7097,7 @@ const st = Re(({
7116
7097
  }
7117
7098
  if (L.includes("."))
7118
7099
  try {
7119
- a.current.playAnimation(L, null, 10, 0, 0.01, P), console.log("Playing animation:", L);
7100
+ a.current.playAnimation(L, null, 10, 0, 0.01, F), console.log("Playing animation:", L);
7120
7101
  } catch (W) {
7121
7102
  console.log(`Failed to play ${L}:`, W);
7122
7103
  try {
@@ -7130,7 +7111,7 @@ const st = Re(({
7130
7111
  let J = !1;
7131
7112
  for (const $ of W)
7132
7113
  try {
7133
- a.current.playAnimation(L + $, null, 10, 0, 0.01, P), console.log("Playing animation:", L + $), J = !0;
7114
+ a.current.playAnimation(L + $, null, 10, 0, 0.01, F), console.log("Playing animation:", L + $), J = !0;
7134
7115
  break;
7135
7116
  } catch {
7136
7117
  console.log(`Failed to play ${L}${$}, trying next format...`);
@@ -7147,7 +7128,7 @@ const st = Re(({
7147
7128
  } else
7148
7129
  console.warn("Animation system not available or animation not found:", L);
7149
7130
  }, []);
7150
- return ve(r, () => ({
7131
+ return fe(r, () => ({
7151
7132
  speakText: b,
7152
7133
  stopSpeaking: U,
7153
7134
  setMood: B,
@@ -7159,8 +7140,8 @@ const st = Re(({
7159
7140
  if (a.current && a.current.setShowFullAvatar && a.current.setBodyMovement)
7160
7141
  try {
7161
7142
  a.current.setShowFullAvatar(!0), a.current.setBodyMovement(L), console.log("Body movement set with full body mode:", L);
7162
- } catch (P) {
7163
- console.warn("Error setting body movement:", P);
7143
+ } catch (F) {
7144
+ console.warn("Error setting body movement:", F);
7164
7145
  }
7165
7146
  },
7166
7147
  setMovementIntensity: (L) => a.current?.setMovementIntensity(L),
@@ -7176,8 +7157,8 @@ const st = Re(({
7176
7157
  if (a.current && a.current.setShowFullAvatar && a.current.playReaction)
7177
7158
  try {
7178
7159
  a.current.setShowFullAvatar(!0), a.current.playReaction(L), console.log("Reaction played with full body mode:", L);
7179
- } catch (P) {
7180
- console.warn("Error playing reaction:", P);
7160
+ } catch (F) {
7161
+ console.warn("Error playing reaction:", F);
7181
7162
  }
7182
7163
  },
7183
7164
  playCelebration: () => {
@@ -7192,8 +7173,8 @@ const st = Re(({
7192
7173
  if (a.current && a.current.setShowFullAvatar)
7193
7174
  try {
7194
7175
  a.current.setShowFullAvatar(L), console.log("Show full avatar set to:", L);
7195
- } catch (P) {
7196
- console.warn("Error setting showFullAvatar:", P);
7176
+ } catch (F) {
7177
+ console.warn("Error setting showFullAvatar:", F);
7197
7178
  }
7198
7179
  },
7199
7180
  lockAvatarPosition: () => {
@@ -7212,7 +7193,7 @@ const st = Re(({
7212
7193
  console.warn("Error unlocking avatar position:", L);
7213
7194
  }
7214
7195
  }
7215
- })), /* @__PURE__ */ He("div", { className: `talking-head-container ${n}`, style: s, children: [
7196
+ })), /* @__PURE__ */ ke("div", { className: `talking-head-container ${n}`, style: s, children: [
7216
7197
  /* @__PURE__ */ se(
7217
7198
  "div",
7218
7199
  {
@@ -7248,8 +7229,8 @@ const st = Re(({
7248
7229
  }, children: c })
7249
7230
  ] });
7250
7231
  });
7251
- st.displayName = "TalkingHeadComponent";
7252
- const at = Re(({
7232
+ it.displayName = "TalkingHeadComponent";
7233
+ const nt = ye(({
7253
7234
  curriculumData: O = null,
7254
7235
  avatarConfig: t = {},
7255
7236
  animations: e = {},
@@ -7281,12 +7262,12 @@ const at = Re(({
7281
7262
  onQuestionAnswer: s,
7282
7263
  onCurriculumComplete: o,
7283
7264
  onCustomAction: r
7284
- }), d = G(null), g = G(null), y = G(null), x = G(null), I = G(null), T = G(null), p = G(null), C = G(O?.curriculum || {
7265
+ }), d = G(null), g = G(null), y = G(null), x = G(null), I = G(null), H = G(null), p = G(null), z = G(O?.curriculum || {
7285
7266
  title: "Default Curriculum",
7286
7267
  description: "No curriculum data provided",
7287
7268
  language: "en",
7288
7269
  modules: []
7289
- }), H = G({
7270
+ }), C = G({
7290
7271
  avatarUrl: t.avatarUrl || "/avatars/brunette.glb",
7291
7272
  avatarBody: t.avatarBody || "F",
7292
7273
  mood: t.mood || "happy",
@@ -7309,12 +7290,12 @@ const at = Re(({
7309
7290
  onCustomAction: r
7310
7291
  };
7311
7292
  }, [i, n, s, o, r]), ue(() => {
7312
- C.current = O?.curriculum || {
7293
+ z.current = O?.curriculum || {
7313
7294
  title: "Default Curriculum",
7314
7295
  description: "No curriculum data provided",
7315
7296
  language: "en",
7316
7297
  modules: []
7317
- }, H.current = {
7298
+ }, C.current = {
7318
7299
  avatarUrl: t.avatarUrl || "/avatars/brunette.glb",
7319
7300
  avatarBody: t.avatarBody || "F",
7320
7301
  mood: t.mood || "happy",
@@ -7329,7 +7310,7 @@ const at = Re(({
7329
7310
  lipsyncLang: "en"
7330
7311
  };
7331
7312
  }, [O, t, e]);
7332
- const b = E(() => (C.current || { modules: [] }).modules[l.current.currentModuleIndex]?.lessons[l.current.currentLessonIndex], []), U = E(() => b()?.questions[l.current.currentQuestionIndex], [b]), B = E((R, v) => v.type === "multiple_choice" || v.type === "true_false" ? R === v.answer : v.type === "code_test" && typeof R == "object" && R !== null ? R.passed === !0 : !1, []), j = E(() => {
7313
+ const b = E(() => (z.current || { modules: [] }).modules[l.current.currentModuleIndex]?.lessons[l.current.currentLessonIndex], []), U = E(() => b()?.questions[l.current.currentQuestionIndex], [b]), B = E((R, v) => v.type === "multiple_choice" || v.type === "true_false" ? R === v.answer : v.type === "code_test" && typeof R == "object" && R !== null ? R.passed === !0 : !1, []), j = E(() => {
7333
7314
  l.current.lessonCompleted = !0, l.current.isQuestionMode = !1;
7334
7315
  const R = l.current.totalQuestions > 0 ? Math.round(l.current.score / l.current.totalQuestions * 100) : 100;
7335
7316
  let v = "Congratulations! You've completed this lesson";
@@ -7353,9 +7334,9 @@ const at = Re(({
7353
7334
  } catch {
7354
7335
  u.current.playCelebration();
7355
7336
  }
7356
- const z = C.current || { modules: [] }, Z = z.modules[l.current.currentModuleIndex], S = l.current.currentLessonIndex < (Z?.lessons?.length || 0) - 1, F = l.current.currentModuleIndex < (z.modules?.length || 0) - 1, V = S || F, w = H.current || { lipsyncLang: "en" };
7337
+ const w = z.current || { modules: [] }, Z = w.modules[l.current.currentModuleIndex], S = l.current.currentLessonIndex < (Z?.lessons?.length || 0) - 1, P = l.current.currentModuleIndex < (w.modules?.length || 0) - 1, V = S || P, T = C.current || { lipsyncLang: "en" };
7357
7338
  u.current.speakText(v, {
7358
- lipsyncLang: w.lipsyncLang,
7339
+ lipsyncLang: T.lipsyncLang,
7359
7340
  onSpeechEnd: () => {
7360
7341
  c.current.onCustomAction({
7361
7342
  type: "lessonCompleteFeedbackDone",
@@ -7371,10 +7352,10 @@ const at = Re(({
7371
7352
  }
7372
7353
  }, [e.lessonComplete]), ae = E(() => {
7373
7354
  l.current.curriculumCompleted = !0;
7374
- const R = C.current || { modules: [] };
7355
+ const R = z.current || { modules: [] };
7375
7356
  if (c.current.onCurriculumComplete({
7376
7357
  modules: R.modules.length,
7377
- totalLessons: R.modules.reduce((v, z) => v + z.lessons.length, 0)
7358
+ totalLessons: R.modules.reduce((v, w) => v + w.lessons.length, 0)
7378
7359
  }), u.current) {
7379
7360
  if (u.current.setMood("celebrating"), e.curriculumComplete)
7380
7361
  try {
@@ -7382,7 +7363,7 @@ const at = Re(({
7382
7363
  } catch {
7383
7364
  u.current.playCelebration();
7384
7365
  }
7385
- const v = H.current || { lipsyncLang: "en" };
7366
+ const v = C.current || { lipsyncLang: "en" };
7386
7367
  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 });
7387
7368
  }
7388
7369
  }, [e.curriculumComplete]), L = E(() => {
@@ -7403,16 +7384,16 @@ const at = Re(({
7403
7384
  } catch (Z) {
7404
7385
  console.warn("Failed to play questionStart animation:", Z);
7405
7386
  }
7406
- const z = H.current || { lipsyncLang: "en" };
7407
- 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 });
7387
+ const w = C.current || { lipsyncLang: "en" };
7388
+ v.type === "code_test" ? u.current.speakText(`Let's test your coding skills! Here's your first challenge: ${v.question}`, { lipsyncLang: w.lipsyncLang }) : v.type === "multiple_choice" ? u.current.speakText(`Now let me ask you some questions. Here's the first one: ${v.question}`, { lipsyncLang: w.lipsyncLang }) : v.type === "true_false" ? u.current.speakText(`Let's start with some true or false questions. First question: ${v.question}`, { lipsyncLang: w.lipsyncLang }) : u.current.speakText(`Now let me ask you some questions. Here's the first one: ${v.question}`, { lipsyncLang: w.lipsyncLang });
7408
7389
  } else if (u.current && u.current.isReady) {
7409
- const z = H.current || { lipsyncLang: "en" };
7410
- u.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang: z.lipsyncLang });
7390
+ const w = C.current || { lipsyncLang: "en" };
7391
+ u.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang: w.lipsyncLang });
7411
7392
  } else
7412
7393
  setTimeout(() => {
7413
- T.current && T.current();
7394
+ H.current && H.current();
7414
7395
  }, 100);
7415
- }, [e.questionStart, b, U]), P = E(() => {
7396
+ }, [e.questionStart, b, U]), F = E(() => {
7416
7397
  const R = b();
7417
7398
  if (l.current.currentQuestionIndex < (R?.questions?.length || 0) - 1) {
7418
7399
  l.current.currentQuestionIndex += 1;
@@ -7431,15 +7412,15 @@ const at = Re(({
7431
7412
  } catch (Z) {
7432
7413
  console.warn("Failed to play nextQuestion animation:", Z);
7433
7414
  }
7434
- const z = H.current || { lipsyncLang: "en" };
7415
+ const w = C.current || { lipsyncLang: "en" };
7435
7416
  v.type === "code_test" ? u.current.speakText(`Great! Now let's move on to your next coding challenge: ${v.question}`, {
7436
- lipsyncLang: z.lipsyncLang
7417
+ lipsyncLang: w.lipsyncLang
7437
7418
  }) : v.type === "multiple_choice" ? u.current.speakText(`Alright! Here's your next question: ${v.question}`, {
7438
- lipsyncLang: z.lipsyncLang
7419
+ lipsyncLang: w.lipsyncLang
7439
7420
  }) : v.type === "true_false" ? u.current.speakText(`Now let's try this one: ${v.question}`, {
7440
- lipsyncLang: z.lipsyncLang
7421
+ lipsyncLang: w.lipsyncLang
7441
7422
  }) : u.current.speakText(`Here's the next question: ${v.question}`, {
7442
- lipsyncLang: z.lipsyncLang
7423
+ lipsyncLang: w.lipsyncLang
7443
7424
  });
7444
7425
  }
7445
7426
  } else
@@ -7451,7 +7432,7 @@ const at = Re(({
7451
7432
  score: l.current.score
7452
7433
  });
7453
7434
  }, [e.nextQuestion, b, U]), D = E(() => {
7454
- const R = C.current || { modules: [] }, v = R.modules[l.current.currentModuleIndex];
7435
+ const R = z.current || { modules: [] }, v = R.modules[l.current.currentModuleIndex];
7455
7436
  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({
7456
7437
  type: "lessonStart",
7457
7438
  moduleIndex: l.current.currentModuleIndex,
@@ -7473,21 +7454,21 @@ const at = Re(({
7473
7454
  const R = b();
7474
7455
  let v = null;
7475
7456
  if (R?.avatar_script && R?.body) {
7476
- const z = R.avatar_script.trim(), Z = R.body.trim(), S = z.match(/[.!?]$/) ? " " : ". ";
7477
- v = `${z}${S}${Z}`;
7457
+ const w = R.avatar_script.trim(), Z = R.body.trim(), S = w.match(/[.!?]$/) ? " " : ". ";
7458
+ v = `${w}${S}${Z}`;
7478
7459
  } else
7479
7460
  v = R?.avatar_script || R?.body || null;
7480
7461
  if (u.current && u.current.isReady && v) {
7481
7462
  l.current.isTeaching = !0, l.current.isQuestionMode = !1, u.current.setMood("happy");
7482
- let z = !1;
7463
+ let w = !1;
7483
7464
  if (e.teaching)
7484
7465
  try {
7485
- u.current.playAnimation(e.teaching, !0), z = !0;
7466
+ u.current.playAnimation(e.teaching, !0), w = !0;
7486
7467
  } catch (S) {
7487
7468
  console.warn("Failed to play teaching animation:", S);
7488
7469
  }
7489
- z || u.current.setBodyMovement("gesturing");
7490
- const Z = H.current || { lipsyncLang: "en" };
7470
+ w || u.current.setBodyMovement("gesturing");
7471
+ const Z = C.current || { lipsyncLang: "en" };
7491
7472
  c.current.onLessonStart({
7492
7473
  moduleIndex: l.current.currentModuleIndex,
7493
7474
  lessonIndex: l.current.currentLessonIndex,
@@ -7511,16 +7492,16 @@ const at = Re(({
7511
7492
  });
7512
7493
  }
7513
7494
  }, [e.teaching, b]), J = E((R) => {
7514
- const v = U(), z = B(R, v);
7515
- if (z && (l.current.score += 1), c.current.onQuestionAnswer({
7495
+ const v = U(), w = B(R, v);
7496
+ if (w && (l.current.score += 1), c.current.onQuestionAnswer({
7516
7497
  moduleIndex: l.current.currentModuleIndex,
7517
7498
  lessonIndex: l.current.currentLessonIndex,
7518
7499
  questionIndex: l.current.currentQuestionIndex,
7519
7500
  answer: R,
7520
- isCorrect: z,
7501
+ isCorrect: w,
7521
7502
  question: v
7522
7503
  }), u.current)
7523
- if (z) {
7504
+ if (w) {
7524
7505
  if (u.current.setMood("happy"), e.correct)
7525
7506
  try {
7526
7507
  u.current.playReaction("happy");
@@ -7528,7 +7509,7 @@ const at = Re(({
7528
7509
  u.current.setBodyMovement("happy");
7529
7510
  }
7530
7511
  u.current.setBodyMovement("gesturing");
7531
- const Z = v.type === "code_test" ? `Great job! Your code passed all the tests! ${v.explanation || ""}` : `Excellent! That's correct! ${v.explanation || ""}`, S = H.current || { lipsyncLang: "en" };
7512
+ const Z = v.type === "code_test" ? `Great job! Your code passed all the tests! ${v.explanation || ""}` : `Excellent! That's correct! ${v.explanation || ""}`, S = C.current || { lipsyncLang: "en" };
7532
7513
  u.current.speakText(Z, {
7533
7514
  lipsyncLang: S.lipsyncLang,
7534
7515
  onSpeechEnd: () => {
@@ -7550,7 +7531,7 @@ const at = Re(({
7550
7531
  u.current.setBodyMovement("idle");
7551
7532
  }
7552
7533
  u.current.setBodyMovement("gesturing");
7553
- const Z = 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.`, S = H.current || { lipsyncLang: "en" };
7534
+ const Z = 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.`, S = C.current || { lipsyncLang: "en" };
7554
7535
  u.current.speakText(Z, {
7555
7536
  lipsyncLang: S.lipsyncLang,
7556
7537
  onSpeechEnd: () => {
@@ -7571,7 +7552,7 @@ const at = Re(({
7571
7552
  moduleIndex: l.current.currentModuleIndex,
7572
7553
  lessonIndex: l.current.currentLessonIndex,
7573
7554
  questionIndex: l.current.currentQuestionIndex,
7574
- isCorrect: z,
7555
+ isCorrect: w,
7575
7556
  hasNextQuestion: l.current.currentQuestionIndex < (b()?.questions?.length || 0) - 1,
7576
7557
  avatarNotReady: !0
7577
7558
  });
@@ -7585,7 +7566,7 @@ const at = Re(({
7585
7566
  console.warn("Current question is not a code test. Use handleAnswerSelect for other question types.");
7586
7567
  return;
7587
7568
  }
7588
- const z = {
7569
+ const w = {
7589
7570
  passed: R.passed === !0,
7590
7571
  results: R.results || [],
7591
7572
  output: R.output || "",
@@ -7600,27 +7581,27 @@ const at = Re(({
7600
7581
  moduleIndex: l.current.currentModuleIndex,
7601
7582
  lessonIndex: l.current.currentLessonIndex,
7602
7583
  questionIndex: l.current.currentQuestionIndex,
7603
- testResult: z,
7584
+ testResult: w,
7604
7585
  question: v
7605
- }), p.current && p.current(z);
7586
+ }), p.current && p.current(w);
7606
7587
  }, [U, B]), ne = E(() => {
7607
7588
  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;
7608
- }, []), fe = E((R) => {
7589
+ }, []), ge = E((R) => {
7609
7590
  console.log("Avatar is ready!", R);
7610
- const v = b(), z = v?.avatar_script || v?.body;
7611
- h && z && setTimeout(() => {
7591
+ const v = b(), w = v?.avatar_script || v?.body;
7592
+ h && w && setTimeout(() => {
7612
7593
  d.current && d.current();
7613
7594
  }, 10);
7614
7595
  }, [h, b]);
7615
- Be(() => {
7616
- d.current = W, g.current = D, y.current = j, x.current = P, I.current = ae, T.current = L, p.current = J;
7617
- }), ve(a, () => ({
7596
+ Ee(() => {
7597
+ d.current = W, g.current = D, y.current = j, x.current = F, I.current = ae, H.current = L, p.current = J;
7598
+ }), fe(a, () => ({
7618
7599
  // Curriculum control methods
7619
7600
  startTeaching: W,
7620
7601
  startQuestions: L,
7621
7602
  handleAnswerSelect: J,
7622
7603
  handleCodeTestResult: $,
7623
- nextQuestion: P,
7604
+ nextQuestion: F,
7624
7605
  nextLesson: D,
7625
7606
  completeLesson: j,
7626
7607
  completeCurriculum: ae,
@@ -7633,8 +7614,8 @@ const at = Re(({
7633
7614
  // Convenience methods that delegate to avatar (always check current ref)
7634
7615
  speakText: async (R, v = {}) => {
7635
7616
  await u.current?.resumeAudioContext?.();
7636
- const z = H.current || { lipsyncLang: "en" };
7637
- u.current?.speakText(R, { ...v, lipsyncLang: v.lipsyncLang || z.lipsyncLang });
7617
+ const w = C.current || { lipsyncLang: "en" };
7618
+ u.current?.speakText(R, { ...v, lipsyncLang: v.lipsyncLang || w.lipsyncLang });
7638
7619
  },
7639
7620
  resumeAudioContext: async () => {
7640
7621
  if (u.current?.resumeAudioContext)
@@ -7645,8 +7626,8 @@ const at = Re(({
7645
7626
  if (v.state === "suspended" || v.state === "interrupted")
7646
7627
  try {
7647
7628
  await v.resume(), console.log("Audio context resumed via talkingHead");
7648
- } catch (z) {
7649
- console.warn("Failed to resume audio context:", z);
7629
+ } catch (w) {
7630
+ console.warn("Failed to resume audio context:", w);
7650
7631
  }
7651
7632
  } else
7652
7633
  console.warn("Audio context not available yet");
@@ -7675,8 +7656,8 @@ const at = Re(({
7675
7656
  handleResize: () => u.current?.handleResize(),
7676
7657
  // Avatar readiness check (always returns current value)
7677
7658
  isAvatarReady: () => u.current?.isReady || !1
7678
- }), [W, L, J, $, P, D, j, ae, ne, U, b]);
7679
- const _ = H.current || {
7659
+ }), [W, L, J, $, F, D, j, ae, ne, U, b]);
7660
+ const q = C.current || {
7680
7661
  avatarUrl: "/avatars/brunette.glb",
7681
7662
  avatarBody: "F",
7682
7663
  mood: "happy",
@@ -7690,22 +7671,22 @@ const at = Re(({
7690
7671
  animations: e
7691
7672
  };
7692
7673
  return /* @__PURE__ */ se("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ se(
7693
- Me,
7674
+ ze,
7694
7675
  {
7695
7676
  ref: u,
7696
- avatarUrl: _.avatarUrl,
7697
- avatarBody: _.avatarBody,
7698
- mood: _.mood,
7699
- ttsLang: _.ttsLang,
7700
- ttsService: _.ttsService,
7701
- ttsVoice: _.ttsVoice,
7702
- ttsApiKey: _.ttsApiKey,
7703
- bodyMovement: _.bodyMovement,
7704
- movementIntensity: _.movementIntensity,
7705
- showFullAvatar: _.showFullAvatar,
7677
+ avatarUrl: q.avatarUrl,
7678
+ avatarBody: q.avatarBody,
7679
+ mood: q.mood,
7680
+ ttsLang: q.ttsLang,
7681
+ ttsService: q.ttsService,
7682
+ ttsVoice: q.ttsVoice,
7683
+ ttsApiKey: q.ttsApiKey,
7684
+ bodyMovement: q.bodyMovement,
7685
+ movementIntensity: q.movementIntensity,
7686
+ showFullAvatar: q.showFullAvatar,
7706
7687
  cameraView: "upper",
7707
- animations: _.animations,
7708
- onReady: fe,
7688
+ animations: q.animations,
7689
+ onReady: ge,
7709
7690
  onLoading: () => {
7710
7691
  },
7711
7692
  onError: (R) => {
@@ -7714,8 +7695,8 @@ const at = Re(({
7714
7695
  }
7715
7696
  ) });
7716
7697
  });
7717
- at.displayName = "CurriculumLearning";
7718
- const Ee = {
7698
+ nt.displayName = "CurriculumLearning";
7699
+ const Ce = {
7719
7700
  // Code-based dance animations (no FBX required)
7720
7701
  dance: {
7721
7702
  name: "dance",
@@ -7818,14 +7799,14 @@ const Ee = {
7818
7799
  duration: 5e3,
7819
7800
  description: "Excited, energetic movement"
7820
7801
  }
7821
- }, yt = (O) => Ee[O] || null, ft = (O) => Ee.hasOwnProperty(O);
7802
+ }, pt = (O) => Ce[O] || null, gt = (O) => Ce.hasOwnProperty(O);
7822
7803
  export {
7823
- at as CurriculumLearning,
7824
- Me as TalkingHeadAvatar,
7825
- st as TalkingHeadComponent,
7826
- Ee as animations,
7827
- Ie as getActiveTTSConfig,
7828
- yt as getAnimation,
7829
- gt as getVoiceOptions,
7830
- ft as hasAnimation
7804
+ nt as CurriculumLearning,
7805
+ ze as TalkingHeadAvatar,
7806
+ it as TalkingHeadComponent,
7807
+ Ce as animations,
7808
+ xe as getActiveTTSConfig,
7809
+ pt as getAnimation,
7810
+ mt as getVoiceOptions,
7811
+ gt as hasAnimation
7831
7812
  };