@sage-rsc/talking-head-react 1.0.55 → 1.0.57

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 ke, jsx as ne } from "react/jsx-runtime";
2
- import { forwardRef as fe, useRef as G, useState as re, useEffect as le, useCallback as M, useImperativeHandle as xe, useLayoutEffect as Ee } from "react";
1
+ import { jsxs as Te, jsx as he } from "react/jsx-runtime";
2
+ import { forwardRef as ve, useRef as Z, useState as de, useEffect as pe, useCallback as T, useImperativeHandle as Ie, useLayoutEffect as Oe } from "react";
3
3
  import * as f from "three";
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 Re } 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, j, q;
11
- const A = [0, 0, 0, 0], w = new f.Vector3(), de = new f.Vector3(), Z = new f.Vector3(), ce = new f.Vector3();
4
+ import { OrbitControls as Ne } from "three/addons/controls/OrbitControls.js";
5
+ import { GLTFLoader as Ue } from "three/addons/loaders/GLTFLoader.js";
6
+ import { DRACOLoader as We } from "three/addons/loaders/DRACOLoader.js";
7
+ import { FBXLoader as ke } from "three/addons/loaders/FBXLoader.js";
8
+ import { RoomEnvironment as Ve } from "three/addons/environments/RoomEnvironment.js";
9
+ import Ge from "three/addons/libs/stats.module.js";
10
+ let m, K, $;
11
+ const L = [0, 0, 0, 0], k = new f.Vector3(), fe = new f.Vector3(), Q = new f.Vector3(), xe = new f.Vector3();
12
12
  new f.Plane();
13
13
  new f.Ray();
14
14
  new f.Euler();
15
- const X = new f.Quaternion(), Ie = new f.Quaternion(), $ = new f.Matrix4(), ee = new f.Matrix4();
15
+ const q = new f.Quaternion(), we = new f.Quaternion(), oe = new f.Matrix4(), se = new f.Matrix4();
16
16
  new f.Vector3();
17
- const me = 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 {
17
+ const be = new f.Vector3(0, 0, 1), Ze = new f.Vector3(1, 0, 0), Xe = new f.Vector3(0, 1, 0), Ye = new f.Vector3(0, 0, 1);
18
+ class je {
19
19
  constructor(t = null) {
20
20
  this.opt = Object.assign({
21
21
  warmupMs: 2e3,
@@ -321,7 +321,7 @@ class Ve {
321
321
  /// Bone's parent object
322
322
  vBasis: a.position.clone(),
323
323
  // Original local position
324
- vWorld: a.parent.getWorldPosition(w).clone(),
324
+ vWorld: a.parent.getWorldPosition(k).clone(),
325
325
  // World position, parent
326
326
  qBasis: a.parent.quaternion.clone(),
327
327
  // Original quaternion, parent
@@ -338,7 +338,7 @@ class Ve {
338
338
  ea: [0, 0, 0, 0]
339
339
  // External acceleration [m/s^2]
340
340
  };
341
- h.boneParent.matrixWorld.decompose(w, X, Z), w.copy(me).applyQuaternion(X).setY(0).normalize(), X.premultiply(Ie.setFromUnitVectors(me, w).invert()).normalize(), h.qWorldInverseYaw = X.clone().normalize(), this.data.push(h), this.dict[u] = h;
341
+ h.boneParent.matrixWorld.decompose(k, q, Q), k.copy(be).applyQuaternion(q).setY(0).normalize(), q.premultiply(we.setFromUnitVectors(be, k).invert()).normalize(), h.qWorldInverseYaw = q.clone().normalize(), this.data.push(h), this.dict[u] = h;
342
342
  try {
343
343
  this.setValue(u, "type", s.type), this.setValue(u, "stiffness", s.stiffness), this.setValue(u, "damping", s.damping), this.setValue(u, "external", s.external), this.setValue(u, "limits", s.limits), this.setValue(u, "excludes", s.excludes), this.setValue(u, "deltaLocal", s.deltaLocal), this.setValue(u, "deltaWorld", s.deltaWorld), this.setValue(u, "pivot", s.pivot), this.setValue(u, "helper", s.helper);
344
344
  } catch (r) {
@@ -356,22 +356,22 @@ class Ve {
356
356
  for (this.timerMs += t, t > 1e3 && (this.timerMs = 0), t /= 1e3, e = 0, n = this.objectsUpdate.length; e < n; e++)
357
357
  o = this.objectsUpdate[e], o.updateMatrix(), o.parent === null ? o.matrixWorld.copy(o.matrix) : o.matrixWorld.multiplyMatrices(o.parent.matrixWorld, o.matrix), o.matrixWorldNeedsUpdate = !1;
358
358
  for (e = 0, n = this.data.length; e < n; e++) {
359
- if (o = this.data[e], w.copy(o.vWorld), $.copy(o.boneParent.matrixWorld), ee.copy($).invert(), o.vWorld.setFromMatrixPosition($), w.applyMatrix4(ee), w.length() > 0.5 && (console.info("Info: Unrealistic jump of " + w.length().toFixed(2) + " meters."), w.setLength(0.5)), w.applyQuaternion(o.bone.quaternion), A[0] = w.x, A[1] = w.y, A[2] = -w.z, A[3] = w.length() / 3, o.children)
359
+ if (o = this.data[e], k.copy(o.vWorld), oe.copy(o.boneParent.matrixWorld), se.copy(oe).invert(), o.vWorld.setFromMatrixPosition(oe), k.applyMatrix4(se), k.length() > 0.5 && (console.info("Info: Unrealistic jump of " + k.length().toFixed(2) + " meters."), k.setLength(0.5)), k.applyQuaternion(o.bone.quaternion), L[0] = k.x, L[1] = k.y, L[2] = -k.z, L[3] = k.length() / 3, o.children)
360
360
  for (i = 0, s = o.children.length; i < s; i++)
361
- m = o.children[i], A[0] -= m.v[0] * t / 3, A[1] -= m.v[1] * t / 3, A[2] += m.v[2] * t / 3, A[3] -= m.v[3] * t / 3;
362
- if (m = this.opt.sensitivityFactor, A[0] *= o.ext * m, A[1] *= o.ext * m, A[2] *= o.ext * m, A[3] *= o.ext * m, o.isX && (m = A[0] / t, o.ea[0] = (m - o.ev[0]) / t, o.ev[0] = m, o.a[0] = -o.k[0] * o.p[0] - o.c[0] * o.v[0] - o.ea[0], o.p[0] += o.v[0] * t + o.a[0] * t * t / 2 + A[0], m = o.v[0] + o.a[0] * t / 2, m = -o.k[0] * o.p[0] - o.c[0] * m - o.ea[0], o.v[0] = o.v[0] + (m + o.a[0]) * t / 2), o.isY && (m = A[1] / t, o.ea[1] = (m - o.ev[1]) / t, o.ev[1] = m, o.a[1] = -o.k[1] * o.p[1] - o.c[1] * o.v[1] - o.ea[1], o.p[1] += o.v[1] * t + o.a[1] * t * t / 2 + A[1], m = o.v[1] + o.a[1] * t / 2, m = -o.k[1] * o.p[1] - o.c[1] * m - o.ea[1], o.v[1] = o.v[1] + (m + o.a[1]) * t / 2), o.isZ && (m = A[2] / t, o.ea[2] = (m - o.ev[2]) / t, o.ev[2] = m, o.a[2] = -o.k[2] * o.p[2] - o.c[2] * o.v[2] - o.ea[2], o.p[2] += o.v[2] * t + o.a[2] * t * t / 2 + A[2], m = o.v[2] + o.a[2] * t / 2, m = -o.k[2] * o.p[2] - o.c[2] * m - o.ea[2], o.v[2] = o.v[2] + (m + o.a[2]) * t / 2), o.isT && (m = A[3] / t, o.ea[3] = (m - o.ev[3]) / t, o.ev[3] = m, o.a[3] = -o.k[3] * o.p[3] - o.c[3] * o.v[3] - o.ea[3], o.p[3] += o.v[3] * t + o.a[3] * t * t / 2 + A[3], m = o.v[3] + o.a[3] * t / 2, m = -o.k[3] * o.p[3] - o.c[3] * m - o.ea[3], o.v[3] = o.v[3] + (m + o.a[3]) * t / 2), this.timerMs < this.opt.warmupMs && (o.v[0] *= 1e-4, o.p[0] *= 1e-4, o.v[1] *= 1e-4, o.p[1] *= 1e-4, o.v[2] *= 1e-4, o.p[2] *= 1e-4, o.v[3] *= 1e-4, o.p[3] *= 1e-4), A[0] = o.p[0], A[1] = o.p[1], A[2] = o.p[2], A[3] = o.p[3], m = this.opt.movementFactor, A[0] *= m, A[1] *= m, A[2] *= m, A[3] *= m, o.dl && (m = o.dl, A[0] += m[0], A[1] += m[1], A[2] += m[2]), o.dw && (m = o.dw, w.set(
363
- o.vBasis.x + A[0],
364
- o.vBasis.y + A[1],
365
- o.vBasis.z + A[2]
366
- ), w.applyMatrix4($), w.x += m[0], w.y += m[1], w.z += m[2], w.applyMatrix4(ee), A[0] += w.x - o.vBasis.x, A[1] += w.y - o.vBasis.y, A[2] += w.z - o.vBasis.z), o.limits && this.opt.isLimits && (m = o.limits, m[0] && (m[0][0] !== null && A[0] < m[0][0] && (A[0] = m[0][0]), m[0][1] !== null && A[0] > m[0][1] && (A[0] = m[0][1])), m[1] && (m[1][0] !== null && A[1] < m[1][0] && (A[1] = m[1][0]), m[1][1] !== null && A[1] > m[1][1] && (A[1] = m[1][1])), m[2] && (m[2][0] !== null && A[2] < m[2][0] && (A[2] = m[2][0]), m[2][1] !== null && A[2] > m[2][1] && (A[2] = m[2][1])), m[3] && (m[3][0] !== null && A[3] < m[3][0] && (A[3] = m[3][0]), m[3][1] !== null && A[3] > m[3][1] && (A[3] = m[3][1]))), o.isPoint)
361
+ m = o.children[i], L[0] -= m.v[0] * t / 3, L[1] -= m.v[1] * t / 3, L[2] += m.v[2] * t / 3, L[3] -= m.v[3] * t / 3;
362
+ if (m = this.opt.sensitivityFactor, L[0] *= o.ext * m, L[1] *= o.ext * m, L[2] *= o.ext * m, L[3] *= o.ext * m, o.isX && (m = L[0] / t, o.ea[0] = (m - o.ev[0]) / t, o.ev[0] = m, o.a[0] = -o.k[0] * o.p[0] - o.c[0] * o.v[0] - o.ea[0], o.p[0] += o.v[0] * t + o.a[0] * t * t / 2 + L[0], m = o.v[0] + o.a[0] * t / 2, m = -o.k[0] * o.p[0] - o.c[0] * m - o.ea[0], o.v[0] = o.v[0] + (m + o.a[0]) * t / 2), o.isY && (m = L[1] / t, o.ea[1] = (m - o.ev[1]) / t, o.ev[1] = m, o.a[1] = -o.k[1] * o.p[1] - o.c[1] * o.v[1] - o.ea[1], o.p[1] += o.v[1] * t + o.a[1] * t * t / 2 + L[1], m = o.v[1] + o.a[1] * t / 2, m = -o.k[1] * o.p[1] - o.c[1] * m - o.ea[1], o.v[1] = o.v[1] + (m + o.a[1]) * t / 2), o.isZ && (m = L[2] / t, o.ea[2] = (m - o.ev[2]) / t, o.ev[2] = m, o.a[2] = -o.k[2] * o.p[2] - o.c[2] * o.v[2] - o.ea[2], o.p[2] += o.v[2] * t + o.a[2] * t * t / 2 + L[2], m = o.v[2] + o.a[2] * t / 2, m = -o.k[2] * o.p[2] - o.c[2] * m - o.ea[2], o.v[2] = o.v[2] + (m + o.a[2]) * t / 2), o.isT && (m = L[3] / t, o.ea[3] = (m - o.ev[3]) / t, o.ev[3] = m, o.a[3] = -o.k[3] * o.p[3] - o.c[3] * o.v[3] - o.ea[3], o.p[3] += o.v[3] * t + o.a[3] * t * t / 2 + L[3], m = o.v[3] + o.a[3] * t / 2, m = -o.k[3] * o.p[3] - o.c[3] * m - o.ea[3], o.v[3] = o.v[3] + (m + o.a[3]) * t / 2), this.timerMs < this.opt.warmupMs && (o.v[0] *= 1e-4, o.p[0] *= 1e-4, o.v[1] *= 1e-4, o.p[1] *= 1e-4, o.v[2] *= 1e-4, o.p[2] *= 1e-4, o.v[3] *= 1e-4, o.p[3] *= 1e-4), L[0] = o.p[0], L[1] = o.p[1], L[2] = o.p[2], L[3] = o.p[3], m = this.opt.movementFactor, L[0] *= m, L[1] *= m, L[2] *= m, L[3] *= m, o.dl && (m = o.dl, L[0] += m[0], L[1] += m[1], L[2] += m[2]), o.dw && (m = o.dw, k.set(
363
+ o.vBasis.x + L[0],
364
+ o.vBasis.y + L[1],
365
+ o.vBasis.z + L[2]
366
+ ), k.applyMatrix4(oe), k.x += m[0], k.y += m[1], k.z += m[2], k.applyMatrix4(se), L[0] += k.x - o.vBasis.x, L[1] += k.y - o.vBasis.y, L[2] += k.z - o.vBasis.z), o.limits && this.opt.isLimits && (m = o.limits, m[0] && (m[0][0] !== null && L[0] < m[0][0] && (L[0] = m[0][0]), m[0][1] !== null && L[0] > m[0][1] && (L[0] = m[0][1])), m[1] && (m[1][0] !== null && L[1] < m[1][0] && (L[1] = m[1][0]), m[1][1] !== null && L[1] > m[1][1] && (L[1] = m[1][1])), m[2] && (m[2][0] !== null && L[2] < m[2][0] && (L[2] = m[2][0]), m[2][1] !== null && L[2] > m[2][1] && (L[2] = m[2][1])), m[3] && (m[3][0] !== null && L[3] < m[3][0] && (L[3] = m[3][0]), m[3][1] !== null && L[3] > m[3][1] && (L[3] = m[3][1]))), o.isPoint)
367
367
  o.bone.position.set(
368
- o.vBasis.x + A[0],
369
- o.vBasis.y + A[1],
370
- o.vBasis.z - A[2]
368
+ o.vBasis.x + L[0],
369
+ o.vBasis.y + L[1],
370
+ o.vBasis.z - L[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(w, X, Z), w.copy(me).applyQuaternion(X).setY(0).normalize(), X.premultiply(Ie.setFromUnitVectors(me, w).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(We, -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(Ne, -m), o.boneParent.quaternion.multiply(X)), o.isT && (m = 1.5 * Math.tanh(A[3] * 1.5), X.setFromAxisAngle(Ue, -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, q, Q), k.copy(be).applyQuaternion(q).setY(0).normalize(), q.premultiply(we.setFromUnitVectors(be, k).invert()).normalize(), o.boneParent.quaternion.multiply(q.invert()), o.boneParent.quaternion.multiply(o.qWorldInverseYaw)), o.isZ && (m = Math.atan(L[0] / o.l), q.setFromAxisAngle(Ye, -m), o.boneParent.quaternion.multiply(q)), o.isY && (m = o.l / 3, m = m * Math.tanh(L[1] / m), o.bone.position.setLength(o.l + m)), o.isX && (m = Math.atan(L[2] / o.l), q.setFromAxisAngle(Ze, -m), o.boneParent.quaternion.multiply(q)), o.isT && (m = 1.5 * Math.tanh(L[3] * 1.5), q.setFromAxisAngle(Xe, -m), o.boneParent.quaternion.multiply(q)), 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), ee.copy(o.boneParent.matrixWorld).invert(), Z.applyMatrix4(ee), w.copy(o.bone.position), !(w.distanceToSquared(Z) >= m.radiusSq) && (q = w.length(), j = Z.length(), !(j > m.radius + q) && (j < Math.abs(m.radius - q) || (j = (j * j + q * q - m.radiusSq) / (2 * j), Z.normalize(), ce.copy(Z).multiplyScalar(j), j = Math.sqrt(q * q - j * j), w.subVectors(w, ce).projectOnPlane(Z).normalize().multiplyScalar(j), de.subVectors(o.vBasis, ce).projectOnPlane(Z).normalize(), q = de.dot(w), q < 0 && (q = Math.sqrt(j * j - q * q), de.multiplyScalar(q), w.add(de)), w.add(ce).normalize(), Z.copy(o.bone.position).normalize(), X.setFromUnitVectors(Z, w), o.boneParent.quaternion.premultiply(X), o.boneParent.updateWorldMatrix(!1, !0))));
374
+ m = o.excludes[i], Q.set(0, 0, 0), m.deltaLocal && (Q.x += m.deltaLocal[0], Q.y += m.deltaLocal[1], Q.z += m.deltaLocal[2]), Q.applyMatrix4(m.bone.matrixWorld), se.copy(o.boneParent.matrixWorld).invert(), Q.applyMatrix4(se), k.copy(o.bone.position), !(k.distanceToSquared(Q) >= m.radiusSq) && ($ = k.length(), K = Q.length(), !(K > m.radius + $) && (K < Math.abs(m.radius - $) || (K = (K * K + $ * $ - m.radiusSq) / (2 * K), Q.normalize(), xe.copy(Q).multiplyScalar(K), K = Math.sqrt($ * $ - K * K), k.subVectors(k, xe).projectOnPlane(Q).normalize().multiplyScalar(K), fe.subVectors(o.vBasis, xe).projectOnPlane(Q).normalize(), $ = fe.dot(k), $ < 0 && ($ = Math.sqrt(K * K - $ * $), fe.multiplyScalar($), k.add(fe)), k.add(xe).normalize(), Q.copy(o.bone.position).normalize(), q.setFromUnitVectors(Q, k), o.boneParent.quaternion.premultiply(q), o.boneParent.updateWorldMatrix(!1, !0))));
375
375
  }
376
376
  this.helpers.isActive && this.updateHelpers();
377
377
  }
@@ -442,17 +442,17 @@ class Ve {
442
442
  */
443
443
  updateHelpers() {
444
444
  if (m = this.helpers.points, m.bones.length) {
445
- ee.copy(this.armature.matrixWorld).invert();
445
+ se.copy(this.armature.matrixWorld).invert();
446
446
  const t = m.object.geometry.getAttribute("position");
447
447
  for (let e = 0, i = m.bones.length; e < i; e++)
448
- $.multiplyMatrices(ee, m.bones[e].matrixWorld), w.setFromMatrixPosition($), t.setXYZ(e, w.x, w.y, w.z);
448
+ oe.multiplyMatrices(se, m.bones[e].matrixWorld), k.setFromMatrixPosition(oe), t.setXYZ(e, k.x, k.y, k.z);
449
449
  t.needsUpdate = !0, m.object.updateMatrixWorld();
450
450
  }
451
451
  if (m = this.helpers.lines, m.bones.length) {
452
- ee.copy(this.armature.matrixWorld).invert();
452
+ se.copy(this.armature.matrixWorld).invert();
453
453
  const t = m.object.geometry.getAttribute("position");
454
454
  for (let e = 0, i = 0, n = m.bones.length; e < n; e++, i += 2)
455
- $.multiplyMatrices(ee, m.bones[e].matrixWorld), w.setFromMatrixPosition($), t.setXYZ(i, w.x, w.y, w.z), $.multiplyMatrices(ee, m.bones[e].parent.matrixWorld), w.setFromMatrixPosition($), t.setXYZ(i + 1, w.x, w.y, w.z);
455
+ oe.multiplyMatrices(se, m.bones[e].matrixWorld), k.setFromMatrixPosition(oe), t.setXYZ(i, k.x, k.y, k.z), oe.multiplyMatrices(se, m.bones[e].parent.matrixWorld), k.setFromMatrixPosition(oe), t.setXYZ(i + 1, k.x, k.y, k.z);
456
456
  t.needsUpdate = !0, m.object.updateMatrixWorld();
457
457
  }
458
458
  }
@@ -489,7 +489,7 @@ class Ve {
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 Ge {
492
+ class Qe {
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 Ge {
608
608
  for (let r = 0; r < n / 2; r++) {
609
609
  const d = i[(u + r) * 2], c = i[(u + r) * 2 + 1], g = i[(u + r + n / 2) * 2] * a - i[(u + r + n / 2) * 2 + 1] * h, y = i[(u + r + n / 2) * 2] * h + i[(u + r + n / 2) * 2 + 1] * a;
610
610
  i[(u + r) * 2] = d + g, i[(u + r) * 2 + 1] = c + y, i[(u + r + n / 2) * 2] = d - g, i[(u + r + n / 2) * 2 + 1] = c - y;
611
- const x = a * o - h * l, L = a * l + h * o;
612
- a = x, h = L;
611
+ const x = a * o - h * l, I = a * l + h * o;
612
+ a = x, h = I;
613
613
  }
614
614
  }
615
615
  }
@@ -814,7 +814,7 @@ class Ge {
814
814
  return n * s;
815
815
  }
816
816
  }
817
- class Ze {
817
+ class qe {
818
818
  /**
819
819
  * @constructor
820
820
  */
@@ -1396,11 +1396,11 @@ class Ze {
1396
1396
  return e;
1397
1397
  }
1398
1398
  }
1399
- const Xe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1399
+ const _e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1400
1400
  __proto__: null,
1401
- LipsyncEn: Ze
1401
+ LipsyncEn: qe
1402
1402
  }, Symbol.toStringTag, { value: "Module" }));
1403
- class Ye {
1403
+ class Ke {
1404
1404
  /**
1405
1405
  * @constructor
1406
1406
  */
@@ -1754,11 +1754,11 @@ class Ye {
1754
1754
  return e;
1755
1755
  }
1756
1756
  }
1757
- const je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1757
+ const Je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1758
1758
  __proto__: null,
1759
- LipsyncDe: Ye
1759
+ LipsyncDe: Ke
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 qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2292
+ const et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2293
2293
  __proto__: null,
2294
- LipsyncFr: Qe
2294
+ LipsyncFr: $e
2295
2295
  }, Symbol.toStringTag, { value: "Module" }));
2296
- class _e {
2296
+ class tt {
2297
2297
  /**
2298
2298
  * @constructor
2299
2299
  */
@@ -2436,11 +2436,11 @@ class _e {
2436
2436
  return e;
2437
2437
  }
2438
2438
  }
2439
- const Ke = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2439
+ const it = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2440
2440
  __proto__: null,
2441
- LipsyncFi: _e
2441
+ LipsyncFi: tt
2442
2442
  }, Symbol.toStringTag, { value: "Module" }));
2443
- class Je {
2443
+ class nt {
2444
2444
  /**
2445
2445
  * @constructor
2446
2446
  */
@@ -2620,24 +2620,24 @@ class Je {
2620
2620
  return e;
2621
2621
  }
2622
2622
  }
2623
- const $e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2623
+ const ot = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2624
2624
  __proto__: null,
2625
- LipsyncLt: Je
2626
- }, Symbol.toStringTag, { value: "Module" })), et = new URL("data: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9oYXNTZW50RW5kZWQpIHsKICAgICAgICAgICAgICB0aGlzLnBvcnQucG9zdE1lc3NhZ2UoeyB0eXBlOiAicGxheWJhY2stZW5kZWQiIH0pOwogICAgICAgICAgICAgIHRoaXMuX2hhc1NlbnRFbmRlZCA9IHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgLy8gU2VuZCBmaW5hbCBtZXRyaWNzIHNob3dpbmcgY2xlYXJlZCBzdGF0ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9IGNhdGNoIChfKSB7IH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnJlc2V0KCk7IC8vIFJlc2V0IHRvIElETEUgc3RhdGUgZm9yIHJldXNlCiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlI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KICAgIHJldHVybiB0cnVlOwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoInBsYXliYWNrLXdvcmtsZXQiLCBQbGF5YmFja1dvcmtsZXQpOwo=", import.meta.url), Le = {
2627
- en: Xe,
2628
- de: je,
2629
- fr: qe,
2630
- fi: Ke,
2631
- lt: $e
2632
- }, W = new f.Quaternion(), E = new f.Euler(), te = new f.Vector3(), ie = new f.Vector3(), Ae = new f.Box3();
2625
+ LipsyncLt: nt
2626
+ }, Symbol.toStringTag, { value: "Module" })), st = new URL("data:text/javascript;base64,Y2xhc3MgUGxheWJhY2tXb3JrbGV0IGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgRlNNID0gewogICAgSURMRTogMCwKICAgIFBMQVlJTkc6IDEsCiAgfTsKCiAgY29uc3RydWN0b3Iob3B0aW9ucykgewogICAgc3VwZXIoKTsKICAgIHRoaXMucG9ydC5vbm1lc3NhZ2UgPSB0aGlzLmhhbmRsZU1lc3NhZ2UuYmluZCh0aGlzKTsKCiAgICB0aGlzLl9zYW1wbGVSYXRlID0gb3B0aW9ucz8ucHJvY2Vzc29yT3B0aW9ucz8uc2FtcGxlUmF0ZSB8fCBzYW1wbGVSYXRlOwogICAgdGhpcy5fc2NhbGUgPSAxIC8gMzI3Njg7IC8vIFBDTTE2IC0+IGZsb2F0CgogICAgLy8gU2lsZW5jZSBkZXRlY3Rpb24gdGhyZXNob2xkICgxIHNlY29uZCkgYXMgYSBmYWxsYmFjayBzYWZldHkgbmV0CiAgICBjb25zdCBzaWxlbmNlRHVyYXRpb25TZWNvbmRzID0gMS4wOwogICAgdGhpcy5fc2lsZW5jZVRocmVzaG9sZEJsb2NrcyA9IE1hdGguY2VpbCgodGhpcy5fc2FtcGxlUmF0ZSAqIHNpbGVuY2VEdXJhdGlvblNlY29uZHMpIC8gMTI4KTsKCiAgICAvLyBNZXRyaWNzIGNvbmZpZ3VyYXRpb24gdmlhIG9wdGlvbnM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NvbnN0IGlzVGltZWRPdXQgPSB0aGlzLl9zaWxlbmNlRnJhbWVzQ291bnQgPiB0aGlzLl9zaWxlbmNlVGhyZXNob2xkQmxvY2tzOwoKICAgICAgICAgIGlmICh0aGlzLl9ub01vcmVEYXRhUmVjZWl2ZWQgfHwgaXNUaW1lZE91dCkgewogICAgICAgICAgICAvLyBFTkQgT0YgUExBWUJBQ0s6IEVpdGhlciBleHBsaWNpdGx5IHNpZ25hbGVkIG9yIHRpbWVkIG91dC4KICAgICAgICAgICAgaWYgKCF0aGlzLl9oYXNTZW50RW5kZWQpIHsKICAgICAgICAgICAgICB0aGlzLnBvcnQucG9zdE1lc3NhZ2UoeyB0eXBlOiAicGxheWJhY2stZW5kZWQiIH0pOwogICAgICAgICAgICAgIHRoaXMuX2hhc1NlbnRFbmRlZCA9IHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgLy8gU2VuZCBmaW5hbCBtZXRyaWNzIHNob3dpbmcgY2xlYXJlZCBzdGF0ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJs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2Vzc2VkOiB0aGlzLl9mcmFtZXNQcm9jZXNzZWQKICAgICAgICAgICAgfQogICAgICAgICAgfSk7CiAgICAgICAgfSBjYXRjaCAoXykgeyB9CiAgICAgICAgLy8gRG9uJ3QgcmVzZXQgbWF4IHRyYWNrZXIgLSBrZWVwIHNlc3Npb24gcGVhayB1bnRpbCBpZGxlCiAgICAgIH0KICAgIH0KCiAgICAvLyBBTFdBWVMgcmV0dXJuIHRydWUgdG8ga2VlcCB0aGUgcHJvY2Vzc29yIGFsaXZlIGZvciByZXVzZS4KICAgIHJldHVybiB0cnVlOwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoInBsYXliYWNrLXdvcmtsZXQiLCBQbGF5YmFja1dvcmtsZXQpOwo=", import.meta.url), ze = {
2627
+ en: _e,
2628
+ de: Je,
2629
+ fr: et,
2630
+ fi: it,
2631
+ lt: ot
2632
+ }, U = new f.Quaternion(), M = new f.Euler(), ae = new f.Vector3(), le = new f.Vector3(), Ce = 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 tt = new f.Vector3(1, 0, 0);
2637
+ const at = new f.Vector3(1, 0, 0);
2638
2638
  new f.Vector3(0, 1, 0);
2639
2639
  new f.Vector3(0, 0, 1);
2640
- class we {
2640
+ class Me {
2641
2641
  /**
2642
2642
  * Avatar.
2643
2643
  * @typedef {Object} Avatar
@@ -2763,7 +2763,7 @@ class we {
2763
2763
  avatarOnlyCamera: null,
2764
2764
  statsNode: null,
2765
2765
  statsStyle: null
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 = {
2766
+ }, Object.assign(this.opt, e || {}), this.opt.statsNode && (this.stats = new Ge(), 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 we {
4062
4062
  this.opt.lightSpotDispersion
4063
4063
  ), this.setLighting(this.opt);
4064
4064
  const l = new f.PMREMGenerator(this.renderer);
4065
- l.compileEquirectangularShader(), this.scene.environment = l.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;
4065
+ l.compileEquirectangularShader(), this.scene.environment = l.fromScene(new Ve()).texture, this.resizeobserver = new ResizeObserver(this.onResize.bind(this)), this.resizeobserver.observe(this.nodeAvatar), this.controls = new Ne(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 we {
4080
4080
  Object.entries(s).forEach((l, u) => {
4081
4081
  const a = new f.Bone();
4082
4082
  a.name = l[0], l[1] ? this.ikMesh.getObjectByName(l[1]).add(a) : this.ikMesh.add(a), o.push(a);
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 = [];
4083
+ }), this.ikMesh.bind(new f.Skeleton(o)), this.dynamicbones = new je(), 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 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(
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 Qe(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 we {
4204
4204
  const r = s.morphTargetDictionary[a], d = o.morphAttributes.position[r], c = o.morphAttributes.normal?.[r];
4205
4205
  l || (l = new f.Float32BufferAttribute(d.count * 3, 3), c && (u = new f.Float32BufferAttribute(d.count * 3, 3)));
4206
4206
  for (let g = 0; g < d.count; g++) {
4207
- const y = l.getX(g) + d.getX(g) * h, x = l.getY(g) + d.getY(g) * h, L = l.getZ(g) + d.getZ(g) * h;
4208
- l.setXYZ(g, y, x, L);
4207
+ const y = l.getX(g) + d.getX(g) * h, x = l.getY(g) + d.getY(g) * h, I = l.getZ(g) + d.getZ(g) * h;
4208
+ l.setXYZ(g, y, x, I);
4209
4209
  }
4210
4210
  if (c)
4211
4211
  for (let g = 0; g < d.count; g++) {
4212
- const y = u.getX(g) + c.getX(g) * h, x = u.getY(g) + c.getY(g) * h, L = u.getZ(g) + c.getZ(g) * h;
4213
- u.setXYZ(g, y, x, L);
4212
+ const y = u.getX(g) + c.getX(g) * h, x = u.getY(g) + c.getY(g) * h, I = u.getZ(g) + c.getZ(g) * h;
4213
+ u.setXYZ(g, y, x, I);
4214
4214
  }
4215
4215
  }
4216
4216
  if (l) {
@@ -4228,9 +4228,9 @@ class we {
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 Pe();
4231
+ const i = new Ue();
4232
4232
  if (this.dracoEnabled) {
4233
- const a = new Be();
4233
+ const a = new We();
4234
4234
  a.setDecoderPath(this.dracoDecoderPath), i.setDRACOLoader(a);
4235
4235
  }
4236
4236
  let n = await i.loadAsync(t.url, e);
@@ -4374,9 +4374,9 @@ class we {
4374
4374
  updatePoseDelta() {
4375
4375
  for (const [t, e] of Object.entries(this.poseDelta.props)) {
4376
4376
  if (e.x === 0 && e.y === 0 && e.z === 0) continue;
4377
- E.set(e.x, e.y, e.z);
4377
+ M.set(e.x, e.y, e.z);
4378
4378
  const i = this.poseAvatar.props[t];
4379
- i.isQuaternion ? (W.setFromEuler(E), i.multiply(W)) : i.isVector3 && i.add(E);
4379
+ i.isQuaternion ? (U.setFromEuler(M), i.multiply(U)) : i.isVector3 && i.add(M);
4380
4380
  }
4381
4381
  }
4382
4382
  /**
@@ -5159,7 +5159,7 @@ class we {
5159
5159
  }, n.x ? new f.Vector3(n.x, n.y, n.z) : null, !0, n.d);
5160
5160
  break;
5161
5161
  }
5162
- if ((u || a) && (E.setFromQuaternion(this.poseAvatar.props["Head.quaternion"]), E.x = Math.max(-0.9, Math.min(0.9, 2 * E.x - 0.5)), E.y = Math.max(-0.9, Math.min(0.9, -2.5 * E.y)), u ? (Object.assign(this.mtAvatar.eyesLookDown, { system: E.x < 0 ? -E.x : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyesLookUp, { system: E.x < 0 ? 0 : E.x, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInLeft, { system: E.y < 0 ? -E.y : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutLeft, { system: E.y < 0 ? 0 : E.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInRight, { system: E.y < 0 ? 0 : E.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutRight, { system: E.y < 0 ? -E.y : 0, needsUpdate: !0 }), a && (i = -this.mtAvatar.bodyRotateY.value, n = this.gaussianRandom(-0.2, 0.2), this.animQueue.push(this.animFactory({
5162
+ if ((u || a) && (M.setFromQuaternion(this.poseAvatar.props["Head.quaternion"]), M.x = Math.max(-0.9, Math.min(0.9, 2 * M.x - 0.5)), M.y = Math.max(-0.9, Math.min(0.9, -2.5 * M.y)), u ? (Object.assign(this.mtAvatar.eyesLookDown, { system: M.x < 0 ? -M.x : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyesLookUp, { system: M.x < 0 ? 0 : M.x, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInLeft, { system: M.y < 0 ? -M.y : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutLeft, { system: M.y < 0 ? 0 : M.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInRight, { system: M.y < 0 ? 0 : M.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutRight, { system: M.y < 0 ? -M.y : 0, needsUpdate: !0 }), a && (i = -this.mtAvatar.bodyRotateY.value, n = this.gaussianRandom(-0.2, 0.2), this.animQueue.push(this.animFactory({
5163
5163
  name: "headmove",
5164
5164
  dt: [[1e3, 2e3], [1e3, 2e3, 1, 2], [1e3, 2e3], [1e3, 2e3, 1, 2]],
5165
5165
  vs: {
@@ -5180,7 +5180,7 @@ class we {
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 + l / 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) && u ? l > this.volumeMax ? (this.volumeHeadBase = 0.05, Math.random() > 0.6 && (this.volumeHeadTarget = -0.05 - Math.random() / 15), this.volumeMax = l) : (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 && (W.setFromAxisAngle(tt, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(W)), Ae.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(te), te.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(ie), ie.sub(this.armature.position), this.objectHips.position.y -= Ae.min.y / 2, this.objectHips.position.x -= (te.x + ie.x) / 4, this.objectHips.position.z -= (te.z + ie.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 + l / 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) && u ? l > this.volumeMax ? (this.volumeHeadBase = 0.05, Math.random() > 0.6 && (this.volumeHeadTarget = -0.05 - Math.random() / 15), this.volumeMax = l) : (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 && (U.setFromAxisAngle(at, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(U)), Ce.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(ae), ae.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(le), le.sub(this.armature.position), this.objectHips.position.y -= Ce.min.y / 2, this.objectHips.position.x -= (ae.x + le.x) / 4, this.objectHips.position.z -= (ae.z + le.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 we {
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 = Le[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(Le));
5214
+ const s = ze[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(ze));
5216
5216
  } catch (s) {
5217
5217
  console.warn(`Failed to load lip-sync module for ${t}:`, s);
5218
5218
  }
@@ -5251,10 +5251,10 @@ class we {
5251
5251
  let h = "", r = "", d = 0, c = [], 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 L = x === y.length - 1, F = y[x].match(l);
5254
+ const I = x === y.length - 1, F = y[x].match(l);
5255
5255
  let p = y[x].match(s);
5256
- const H = y[x].match(u), T = y[x].match(o);
5257
- if (p && !L && !H && y[x + 1].match(s) && (p = !1), i && (h += y[x]), F && (!n || n.every((I) => x < I[0] || x > I[1])) && (r += y[x]), (T || p || L) && (r.length && (r = this.lipsyncPreProcessText(r, a), r.length && c.push({
5256
+ const H = y[x].match(u), z = y[x].match(o);
5257
+ if (p && !I && !H && y[x + 1].match(s) && (p = !1), i && (h += y[x]), F && (!n || n.every((v) => x < v[0] || x > v[1])) && (r += y[x]), (z || p || I) && (r.length && (r = this.lipsyncPreProcessText(r, a), r.length && c.push({
5258
5258
  mark: d,
5259
5259
  word: r
5260
5260
  })), h.length && (g.push({
@@ -5265,31 +5265,31 @@ class we {
5265
5265
  subtitles: [h]
5266
5266
  }
5267
5267
  }), h = ""), r.length)) {
5268
- const I = this.lipsyncWordsToVisemes(r, a);
5269
- if (I && I.visemes && I.visemes.length) {
5270
- const B = I.times[I.visemes.length - 1] + I.durations[I.visemes.length - 1];
5271
- for (let D = 0; D < I.visemes.length; D++)
5268
+ const v = this.lipsyncWordsToVisemes(r, a);
5269
+ if (v && v.visemes && v.visemes.length) {
5270
+ const B = v.times[v.visemes.length - 1] + v.durations[v.visemes.length - 1];
5271
+ for (let N = 0; N < v.visemes.length; N++)
5272
5272
  g.push({
5273
5273
  mark: d,
5274
5274
  template: { name: "viseme" },
5275
- ts: [(I.times[D] - 0.6) / B, (I.times[D] + 0.5) / B, (I.times[D] + I.durations[D] + 0.5) / B],
5275
+ ts: [(v.times[N] - 0.6) / B, (v.times[N] + 0.5) / B, (v.times[N] + v.durations[N] + 0.5) / B],
5276
5276
  vs: {
5277
- ["viseme_" + I.visemes[D]]: [null, I.visemes[D] === "PP" || I.visemes[D] === "FF" ? 0.9 : 0.6, 0]
5277
+ ["viseme_" + v.visemes[N]]: [null, v.visemes[N] === "PP" || v.visemes[N] === "FF" ? 0.9 : 0.6, 0]
5278
5278
  }
5279
5279
  });
5280
5280
  }
5281
5281
  r = "", d++;
5282
5282
  }
5283
- if (p || L) {
5284
- if (c.length || L && g.length) {
5285
- const I = {
5283
+ if (p || I) {
5284
+ if (c.length || I && g.length) {
5285
+ const v = {
5286
5286
  anim: g
5287
5287
  };
5288
- i && (I.onSubtitles = i), c.length && !e.avatarMute && (I.text = c, 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), c = [], r = "", d = 0, g = [];
5288
+ i && (v.onSubtitles = i), c.length && !e.avatarMute && (v.text = c, e.avatarMood && (v.mood = e.avatarMood), e.ttsLang && (v.lang = e.ttsLang), e.ttsVoice && (v.voice = e.ttsVoice), e.ttsRate && (v.rate = e.ttsRate), e.ttsVoice && (v.pitch = e.ttsPitch), e.ttsVolume && (v.volume = e.ttsVolume)), this.speechQueue.push(v), c = [], r = "", d = 0, g = [];
5289
5289
  }
5290
5290
  if (H) {
5291
- let I = this.animEmojis[y[x]];
5292
- I && I.link && (I = this.animEmojis[I.link]), I && this.speechQueue.push({ emoji: I });
5291
+ let v = this.animEmojis[y[x]];
5292
+ v && v.link && (v = this.animEmojis[v.link]), v && this.speechQueue.push({ emoji: v });
5293
5293
  }
5294
5294
  this.speechQueue.push({ break: 100 });
5295
5295
  }
@@ -5385,10 +5385,10 @@ class we {
5385
5385
  let y = 0.6 + this.convertRange(g, [0, h], [0, 0.4]);
5386
5386
  if (h = Math.min(h, d.visemes.length * 200), c > 0)
5387
5387
  for (let x = 0; x < d.visemes.length; x++) {
5388
- const L = a + d.times[x] / c * h, F = d.durations[x] / c * h;
5388
+ const I = a + d.times[x] / c * h, F = d.durations[x] / c * h;
5389
5389
  o.push({
5390
5390
  template: { name: "viseme" },
5391
- ts: [L - Math.min(60, 2 * F / 3), L + Math.min(25, F / 2), L + F + Math.min(60, F / 2)],
5391
+ ts: [I - Math.min(60, 2 * F / 3), I + Math.min(25, F / 2), I + F + Math.min(60, F / 2)],
5392
5392
  vs: {
5393
5393
  ["viseme_" + d.visemes[x]]: [null, d.visemes[x] === "PP" || d.visemes[x] === "FF" ? 0.9 : y, 0]
5394
5394
  }
@@ -5482,21 +5482,21 @@ class we {
5482
5482
  hasVisemes: x && x.visemes && x.visemes.length > 0,
5483
5483
  estimatedDuration: d
5484
5484
  });
5485
- const L = [];
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 H = 0; H < x.visemes.length; H++) {
5489
- const T = x.visemes[H], I = x.times[H] / p, B = x.durations[H] / p, D = I * d, Y = B * d;
5490
- L.push({
5489
+ const z = x.visemes[H], v = x.times[H] / p, B = x.durations[H] / p, N = v * d, _ = B * d;
5490
+ I.push({
5491
5491
  template: { name: "viseme" },
5492
- ts: [D - Math.min(60, 2 * Y / 3), D + Math.min(25, Y / 2), D + Y + Math.min(60, Y / 2)],
5492
+ ts: [N - Math.min(60, 2 * _ / 3), N + Math.min(25, _ / 2), N + _ + Math.min(60, _ / 2)],
5493
5493
  vs: {
5494
- ["viseme_" + T]: [null, T === "PP" || T === "FF" ? 0.9 : 0.6, 0]
5494
+ ["viseme_" + z]: [null, z === "PP" || z === "FF" ? 0.9 : 0.6, 0]
5495
5495
  }
5496
5496
  });
5497
5497
  }
5498
5498
  }
5499
- const F = [...t.anim, ...L];
5499
+ const F = [...t.anim, ...I];
5500
5500
  this.audioPlaylist.push({ anim: F, audio: c }), 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) => {
@@ -5564,8 +5564,8 @@ class we {
5564
5564
  const c = e.toLowerCase().split(/\s+/), g = [];
5565
5565
  for (const y of c)
5566
5566
  for (const x of y) {
5567
- let L = "aa";
5568
- "aeiou".includes(x) ? L = "aa" : "bp".includes(x) ? L = "PP" : "fv".includes(x) ? L = "FF" : "st".includes(x) ? L = "SS" : "dln".includes(x) ? L = "DD" : "kg".includes(x) ? L = "kk" : "rw".includes(x) && (L = "RR"), g.push(L);
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 we {
5662
5662
  const c = e.toLowerCase().split(/\s+/), g = [];
5663
5663
  for (const y of c)
5664
5664
  for (const x of y) {
5665
- let L = "aa";
5666
- "aeiou".includes(x) ? L = "aa" : "bp".includes(x) ? L = "PP" : "fv".includes(x) ? L = "FF" : "st".includes(x) ? L = "SS" : "dln".includes(x) ? L = "DD" : "kg".includes(x) ? L = "kk" : "rw".includes(x) && (L = "RR"), g.push(L);
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 we {
5895
5895
  }
5896
5896
  if (!this.workletLoaded)
5897
5897
  try {
5898
- const l = this.audioCtx.audioWorklet.addModule(et.href), u = new Promise(
5898
+ const l = this.audioCtx.audioWorklet.addModule(st.href), u = new Promise(
5899
5899
  (a, h) => setTimeout(() => h(new Error("Worklet loading timed out")), 5e3)
5900
5900
  );
5901
5901
  await Promise.race([l, u]), this.workletLoaded = !0;
@@ -6133,7 +6133,7 @@ class we {
6133
6133
  */
6134
6134
  lookAtCamera(t) {
6135
6135
  let e;
6136
- if (this.speakTo && (e = new f.Vector3(), this.speakTo.objectLeftEye?.isObject3D ? (this.speakTo.armature.objectHead, this.speakTo.objectLeftEye.updateMatrixWorld(!0), this.speakTo.objectRightEye.updateMatrixWorld(!0), te.setFromMatrixPosition(this.speakTo.objectLeftEye.matrixWorld), ie.setFromMatrixPosition(this.speakTo.objectRightEye.matrixWorld), e.addVectors(te, ie).divideScalar(2)) : this.speakTo.isObject3D ? this.speakTo.getWorldPosition(e) : this.speakTo.isVector3 ? e.set(this.speakTo) : this.speakTo.x && this.speakTo.y && this.speakTo.z && e.set(this.speakTo.x, this.speakTo.y, this.speakTo.z)), !e) {
6136
+ if (this.speakTo && (e = new f.Vector3(), this.speakTo.objectLeftEye?.isObject3D ? (this.speakTo.armature.objectHead, this.speakTo.objectLeftEye.updateMatrixWorld(!0), this.speakTo.objectRightEye.updateMatrixWorld(!0), ae.setFromMatrixPosition(this.speakTo.objectLeftEye.matrixWorld), le.setFromMatrixPosition(this.speakTo.objectRightEye.matrixWorld), e.addVectors(ae, le).divideScalar(2)) : this.speakTo.isObject3D ? this.speakTo.getWorldPosition(e) : this.speakTo.isVector3 ? e.set(this.speakTo) : this.speakTo.x && this.speakTo.y && this.speakTo.z && e.set(this.speakTo.x, this.speakTo.y, this.speakTo.z)), !e) {
6137
6137
  if (this.avatar.hasOwnProperty("avatarIgnoreCamera")) {
6138
6138
  if (this.avatar.avatarIgnoreCamera) {
6139
6139
  this.lookAhead(t);
@@ -6146,14 +6146,14 @@ class we {
6146
6146
  this.lookAt(null, null, t);
6147
6147
  return;
6148
6148
  }
6149
- this.objectLeftEye.updateMatrixWorld(!0), this.objectRightEye.updateMatrixWorld(!0), te.setFromMatrixPosition(this.objectLeftEye.matrixWorld), ie.setFromMatrixPosition(this.objectRightEye.matrixWorld), te.add(ie).divideScalar(2), W.copy(this.armature.quaternion), W.multiply(this.poseTarget.props["Hips.quaternion"]), W.multiply(this.poseTarget.props["Spine.quaternion"]), W.multiply(this.poseTarget.props["Spine1.quaternion"]), W.multiply(this.poseTarget.props["Spine2.quaternion"]), W.multiply(this.poseTarget.props["Neck.quaternion"]), W.multiply(this.poseTarget.props["Head.quaternion"]);
6150
- const i = new f.Vector3().subVectors(e, te).normalize(), n = Math.atan2(i.x, i.z), s = Math.asin(-i.y);
6151
- E.set(s, n, 0, "YXZ");
6152
- const l = new f.Quaternion().setFromEuler(E), u = new f.Quaternion().copy(l).multiply(W.clone().invert());
6153
- E.setFromQuaternion(u, "YXZ");
6154
- let a = E.x / (40 / 24) + 0.2, h = E.y / (9 / 4), r = Math.min(0.6, Math.max(-0.3, a)), d = Math.min(0.8, Math.max(-0.8, h)), c = (Math.random() - 0.5) / 4, g = (Math.random() - 0.5) / 4;
6149
+ this.objectLeftEye.updateMatrixWorld(!0), this.objectRightEye.updateMatrixWorld(!0), ae.setFromMatrixPosition(this.objectLeftEye.matrixWorld), le.setFromMatrixPosition(this.objectRightEye.matrixWorld), ae.add(le).divideScalar(2), U.copy(this.armature.quaternion), U.multiply(this.poseTarget.props["Hips.quaternion"]), U.multiply(this.poseTarget.props["Spine.quaternion"]), U.multiply(this.poseTarget.props["Spine1.quaternion"]), U.multiply(this.poseTarget.props["Spine2.quaternion"]), U.multiply(this.poseTarget.props["Neck.quaternion"]), U.multiply(this.poseTarget.props["Head.quaternion"]);
6150
+ const i = new f.Vector3().subVectors(e, ae).normalize(), n = Math.atan2(i.x, i.z), s = Math.asin(-i.y);
6151
+ M.set(s, n, 0, "YXZ");
6152
+ const l = new f.Quaternion().setFromEuler(M), u = new f.Quaternion().copy(l).multiply(U.clone().invert());
6153
+ M.setFromQuaternion(u, "YXZ");
6154
+ let a = M.x / (40 / 24) + 0.2, h = M.y / (9 / 4), r = Math.min(0.6, Math.max(-0.3, a)), d = Math.min(0.8, Math.max(-0.8, h)), c = (Math.random() - 0.5) / 4, g = (Math.random() - 0.5) / 4;
6155
6155
  if (t) {
6156
- let y = this.animQueue.findIndex((L) => L.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",
@@ -6186,19 +6186,19 @@ class we {
6186
6186
  const s = new f.Vector3().setFromMatrixPosition(this.objectLeftEye.matrixWorld), o = new f.Vector3().setFromMatrixPosition(this.objectRightEye.matrixWorld), l = new f.Vector3().addVectors(s, o).divideScalar(2);
6187
6187
  l.project(this.camera);
6188
6188
  let u = (l.x + 1) / 2 * n.width + n.left, a = -(l.y - 1) / 2 * n.height + n.top;
6189
- t === null && (t = u), e === null && (e = a), W.copy(this.armature.quaternion), W.multiply(this.poseTarget.props["Hips.quaternion"]), W.multiply(this.poseTarget.props["Spine.quaternion"]), W.multiply(this.poseTarget.props["Spine1.quaternion"]), W.multiply(this.poseTarget.props["Spine2.quaternion"]), W.multiply(this.poseTarget.props["Neck.quaternion"]), W.multiply(this.poseTarget.props["Head.quaternion"]), E.setFromQuaternion(W);
6190
- let h = E.x / (40 / 24), r = E.y / (9 / 4), d = Math.min(0.4, Math.max(-0.4, this.camera.rotation.x)), c = Math.min(0.4, Math.max(-0.4, this.camera.rotation.y)), g = Math.max(window.innerWidth - u, u), y = Math.max(window.innerHeight - a, a), x = this.convertRange(e, [a - y, a + y], [-0.3, 0.6]) - h + d, L = this.convertRange(t, [u - g, u + g], [-0.8, 0.8]) - r + c;
6191
- x = Math.min(0.6, Math.max(-0.3, x)), L = Math.min(0.8, Math.max(-0.8, L));
6189
+ t === null && (t = u), e === null && (e = a), U.copy(this.armature.quaternion), U.multiply(this.poseTarget.props["Hips.quaternion"]), U.multiply(this.poseTarget.props["Spine.quaternion"]), U.multiply(this.poseTarget.props["Spine1.quaternion"]), U.multiply(this.poseTarget.props["Spine2.quaternion"]), U.multiply(this.poseTarget.props["Neck.quaternion"]), U.multiply(this.poseTarget.props["Head.quaternion"]), M.setFromQuaternion(U);
6190
+ let h = M.x / (40 / 24), r = M.y / (9 / 4), d = Math.min(0.4, Math.max(-0.4, this.camera.rotation.x)), c = Math.min(0.4, Math.max(-0.4, this.camera.rotation.y)), g = Math.max(window.innerWidth - u, u), y = Math.max(window.innerHeight - a, a), x = this.convertRange(e, [a - y, a + y], [-0.3, 0.6]) - h + d, I = this.convertRange(t, [u - g, u + g], [-0.8, 0.8]) - r + c;
6191
+ x = Math.min(0.6, Math.max(-0.3, x)), I = Math.min(0.8, Math.max(-0.8, I));
6192
6192
  let F = (Math.random() - 0.5) / 4, p = (Math.random() - 0.5) / 4;
6193
6193
  if (i) {
6194
- let H = this.animQueue.findIndex((I) => I.template.name === "lookat");
6194
+ let H = this.animQueue.findIndex((v) => v.template.name === "lookat");
6195
6195
  H !== -1 && this.animQueue.splice(H, 1);
6196
- const T = {
6196
+ const z = {
6197
6197
  name: "lookat",
6198
6198
  dt: [750, i],
6199
6199
  vs: {
6200
6200
  bodyRotateX: [x + F],
6201
- bodyRotateY: [L + p],
6201
+ bodyRotateY: [I + p],
6202
6202
  eyesRotateX: [-3 * F + 0.1],
6203
6203
  eyesRotateY: [-5 * p],
6204
6204
  browInnerUp: [[0, 0.7]],
@@ -6208,7 +6208,7 @@ class we {
6208
6208
  headMove: [0]
6209
6209
  }
6210
6210
  };
6211
- this.animQueue.push(this.animFactory(T));
6211
+ this.animQueue.push(this.animFactory(z));
6212
6212
  }
6213
6213
  }
6214
6214
  /**
@@ -6403,7 +6403,7 @@ class we {
6403
6403
  } catch (d) {
6404
6404
  console.warn(`Could not verify file existence for ${t}, attempting to load anyway:`, d);
6405
6405
  }
6406
- const h = new Re();
6406
+ const h = new ke();
6407
6407
  let r;
6408
6408
  try {
6409
6409
  r = await h.loadAsync(t, e);
@@ -6433,8 +6433,8 @@ class we {
6433
6433
  y.name = y.name.replaceAll("mixamorig", "");
6434
6434
  const x = y.name.split(".");
6435
6435
  if (x[1] === "position") {
6436
- for (let L = 0; L < y.values.length; L++)
6437
- y.values[L] = y.values[L] * s;
6436
+ for (let I = 0; I < y.values.length; I++)
6437
+ y.values[I] = y.values[I] * s;
6438
6438
  c[y.name] = new f.Vector3(y.values[0], y.values[1], y.values[2]);
6439
6439
  } else x[1] === "quaternion" ? c[y.name] = new f.Quaternion(y.values[0], y.values[1], y.values[2], y.values[3]) : x[1] === "rotation" && (c[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 we {
6480
6480
  let l = this.animQueue.find((u) => u.template.name === "pose");
6481
6481
  l && (l.ts[0] = this.animClock + i * 1e3 + 2e3), this.setPoseFromTemplate(o);
6482
6482
  } else {
6483
- let u = await new Re().loadAsync(t, e);
6483
+ let u = await new ke().loadAsync(t, e);
6484
6484
  if (u && u.animations && u.animations[n]) {
6485
6485
  let a = u.animations[n];
6486
6486
  const h = {};
@@ -6535,7 +6535,7 @@ class we {
6535
6535
  const d = [];
6536
6536
  for (let y = 1; y < l.ts.length; y++) d.push(l.ts[y] - l.ts[y - 1]);
6537
6537
  const c = o.template?.rescale || d.map((y) => y / h), g = e * 1e3 - h;
6538
- l.ts = l.ts.map((y, x, L) => x === 0 ? u : L[x - 1] + d[x - 1] + c[x - 1] * g);
6538
+ l.ts = l.ts.map((y, x, I) => x === 0 ? u : I[x - 1] + d[x - 1] + c[x - 1] * g);
6539
6539
  } else {
6540
6540
  const d = e * 1e3 / h;
6541
6541
  l.ts = l.ts.map((c) => u + d * (c - u));
@@ -6571,18 +6571,18 @@ class we {
6571
6571
  const s = new f.Vector3(), o = new f.Vector3(), l = new f.Vector3(), u = new f.Vector3(), a = new f.Quaternion(), h = new f.Vector3(), r = new f.Vector3(), d = new f.Vector3(), c = this.ikMesh.getObjectByName(t.root);
6572
6572
  c.position.setFromMatrixPosition(this.armature.getObjectByName(t.root).matrixWorld), c.quaternion.setFromRotationMatrix(this.armature.getObjectByName(t.root).matrixWorld), e && i && e.applyQuaternion(this.armature.quaternion).add(c.position);
6573
6573
  const g = this.ikMesh.getObjectByName(t.effector), y = t.links;
6574
- y.forEach((L) => {
6575
- L.bone = this.ikMesh.getObjectByName(L.link), L.bone.quaternion.copy(this.getPoseTemplateProp(L.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
  }), c.updateMatrixWorld(!0);
6577
6577
  const x = t.iterations || 10;
6578
6578
  if (e)
6579
- for (let L = 0; L < x; L++) {
6579
+ for (let I = 0; I < x; I++) {
6580
6580
  let F = !1;
6581
6581
  for (let p = 0, H = y.length; p < H; p++) {
6582
- const T = y[p].bone;
6583
- T.matrixWorld.decompose(u, a, h), a.invert(), o.setFromMatrixPosition(g.matrixWorld), l.subVectors(o, u), l.applyQuaternion(a), l.normalize(), s.subVectors(e, u), s.applyQuaternion(a), s.normalize();
6584
- let I = s.dot(l);
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), r.crossVectors(l, s), r.normalize(), W.setFromAxisAngle(r, I), T.quaternion.multiply(W), T.rotation.setFromVector3(d.setFromEuler(T.rotation).clamp(new f.Vector3(
6582
+ const z = y[p].bone;
6583
+ z.matrixWorld.decompose(u, a, h), a.invert(), o.setFromMatrixPosition(g.matrixWorld), l.subVectors(o, u), l.applyQuaternion(a), l.normalize(), s.subVectors(e, u), s.applyQuaternion(a), s.normalize();
6584
+ let v = s.dot(l);
6585
+ v > 1 ? v = 1 : v < -1 && (v = -1), v = Math.acos(v), !(v < 1e-5) && (y[p].minAngle !== void 0 && v < y[p].minAngle && (v = y[p].minAngle), y[p].maxAngle !== void 0 && v > y[p].maxAngle && (v = y[p].maxAngle), r.crossVectors(l, s), r.normalize(), U.setFromAxisAngle(r, v), z.quaternion.multiply(U), z.rotation.setFromVector3(d.setFromEuler(z.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 we {
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
- ))), T.updateMatrixWorld(!0), F = !0);
6593
+ ))), z.updateMatrixWorld(!0), F = !0);
6594
6594
  }
6595
6595
  if (!F) break;
6596
6596
  }
6597
- n && y.forEach((L) => {
6598
- this.poseTarget.props[L.link + ".quaternion"].copy(L.bone.quaternion), this.poseTarget.props[L.link + ".quaternion"].t = this.animClock, this.poseTarget.props[L.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
  /**
@@ -6605,7 +6605,7 @@ class we {
6605
6605
  this.isRunning = !1, this.stop(), this.stopSpeaking(), this.streamStop(), this.isAvatarOnly ? this.armature && (this.armature.parent && this.armature.parent.remove(this.armature), this.clearThree(this.armature)) : (this.clearThree(this.scene), this.resizeobserver.disconnect(), this.renderer && (this.renderer.dispose(), this.renderer.domElement && this.renderer.domElement.parentNode && this.renderer.domElement.parentNode.removeChild(this.renderer.domElement), this.renderer = null)), this.clearThree(this.ikMesh), this.dynamicbones.dispose();
6606
6606
  }
6607
6607
  }
6608
- const ae = {
6608
+ const me = {
6609
6609
  apiKey: "sk_ace57ef3ef65a92b9d3bee2a00183b78ca790bc3e10964f2",
6610
6610
  // Replace with your actual API key (should start with sk_)
6611
6611
  endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
@@ -6625,7 +6625,7 @@ const ae = {
6625
6625
  josh: "VR6AewLTigWG4xSOukaG"
6626
6626
  // Male, American
6627
6627
  }
6628
- }, Se = {
6628
+ }, He = {
6629
6629
  defaultVoice: "aura-2-thalia-en",
6630
6630
  // Thalia (Female, English)
6631
6631
  voices: {
@@ -6645,26 +6645,26 @@ const ae = {
6645
6645
  // Male, English - Powerful
6646
6646
  }
6647
6647
  };
6648
- function be() {
6648
+ function Le() {
6649
6649
  return {
6650
6650
  service: "elevenlabs",
6651
- endpoint: ae.endpoint,
6652
- apiKey: ae.apiKey,
6653
- defaultVoice: ae.defaultVoice,
6654
- voices: ae.voices
6651
+ endpoint: me.endpoint,
6652
+ apiKey: me.apiKey,
6653
+ defaultVoice: me.defaultVoice,
6654
+ voices: me.voices
6655
6655
  };
6656
6656
  }
6657
- function mt() {
6658
- const N = be(), t = [];
6659
- return Object.entries(N.voices).forEach(([e, i]) => {
6657
+ function xt() {
6658
+ const O = Le(), t = [];
6659
+ return Object.entries(O.voices).forEach(([e, i]) => {
6660
6660
  t.push({
6661
6661
  value: i,
6662
- label: `${e.charAt(0).toUpperCase() + e.slice(1)} (${N.service})`
6662
+ label: `${e.charAt(0).toUpperCase() + e.slice(1)} (${O.service})`
6663
6663
  });
6664
6664
  }), t;
6665
6665
  }
6666
- const ze = fe(({
6667
- avatarUrl: N = "/avatars/brunette.glb",
6666
+ const Ee = ve(({
6667
+ avatarUrl: O = "/avatars/brunette.glb",
6668
6668
  avatarBody: t = "F",
6669
6669
  mood: e = "neutral",
6670
6670
  ttsLang: i = "en",
@@ -6684,263 +6684,280 @@ const ze = fe(({
6684
6684
  className: g = "",
6685
6685
  style: y = {},
6686
6686
  animations: x = {}
6687
- }, L) => {
6688
- const F = G(null), p = G(null), H = G(a), [T, I] = re(!0), [B, D] = re(null), [Y, oe] = re(!1);
6689
- le(() => {
6687
+ }, I) => {
6688
+ const F = Z(null), p = Z(null), H = Z(a), z = Z(null), [v, B] = de(!0), [N, _] = de(null), [ne, S] = de(!1), [V, G] = de(!1);
6689
+ pe(() => {
6690
6690
  H.current = a;
6691
6691
  }, [a]);
6692
- const S = be(), P = n || S.service;
6693
- let O;
6694
- P === "browser" ? O = {
6692
+ const E = Le(), X = n || E.service;
6693
+ let Y;
6694
+ X === "browser" ? Y = {
6695
6695
  service: "browser",
6696
6696
  endpoint: "",
6697
6697
  apiKey: null,
6698
6698
  defaultVoice: "Google US English"
6699
- } : P === "elevenlabs" ? O = {
6699
+ } : X === "elevenlabs" ? Y = {
6700
6700
  service: "elevenlabs",
6701
6701
  endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
6702
- apiKey: o || S.apiKey,
6703
- defaultVoice: s || S.defaultVoice || ae.defaultVoice,
6704
- voices: S.voices || ae.voices
6705
- } : P === "deepgram" ? O = {
6702
+ apiKey: o || E.apiKey,
6703
+ defaultVoice: s || E.defaultVoice || me.defaultVoice,
6704
+ voices: E.voices || me.voices
6705
+ } : X === "deepgram" ? Y = {
6706
6706
  service: "deepgram",
6707
6707
  endpoint: "https://api.deepgram.com/v1/speak",
6708
- apiKey: o || S.apiKey,
6709
- defaultVoice: s || S.defaultVoice || Se.defaultVoice,
6710
- voices: S.voices || Se.voices
6711
- } : O = {
6712
- ...S,
6708
+ apiKey: o || E.apiKey,
6709
+ defaultVoice: s || E.defaultVoice || He.defaultVoice,
6710
+ voices: E.voices || He.voices
6711
+ } : Y = {
6712
+ ...E,
6713
6713
  // Override API key if provided via props
6714
- apiKey: o !== null ? o : S.apiKey
6714
+ apiKey: o !== null ? o : E.apiKey
6715
6715
  };
6716
- const V = {
6717
- url: N,
6716
+ const ue = {
6717
+ url: O,
6718
6718
  body: t,
6719
6719
  avatarMood: e,
6720
- ttsLang: P === "browser" ? "en-US" : i,
6721
- ttsVoice: s || O.defaultVoice,
6720
+ ttsLang: X === "browser" ? "en-US" : i,
6721
+ ttsVoice: s || Y.defaultVoice,
6722
6722
  lipsyncLang: "en",
6723
6723
  showFullAvatar: a,
6724
6724
  bodyMovement: l,
6725
6725
  movementIntensity: u
6726
- }, _ = {
6727
- ttsEndpoint: O.endpoint,
6728
- ttsApikey: O.apiKey,
6729
- ttsService: P,
6726
+ }, Re = {
6727
+ ttsEndpoint: Y.endpoint,
6728
+ ttsApikey: Y.apiKey,
6729
+ ttsService: X,
6730
6730
  lipsyncModules: ["en"],
6731
6731
  cameraView: h
6732
- }, K = M(async () => {
6732
+ }, ge = T(async () => {
6733
6733
  if (!(!F.current || p.current))
6734
6734
  try {
6735
- if (I(!0), D(null), p.current = new we(F.current, _), 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(V, (z) => {
6736
- if (z.lengthComputable) {
6737
- const C = Math.min(100, Math.round(z.loaded / z.total * 100));
6738
- d(C);
6735
+ if (B(!0), _(null), p.current = new Me(F.current, Re), 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(ue, (j) => {
6736
+ if (j.lengthComputable) {
6737
+ const P = Math.min(100, Math.round(j.loaded / j.total * 100));
6738
+ d(P);
6739
6739
  }
6740
- }), await new Promise((z) => {
6741
- const C = () => {
6742
- p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? z() : setTimeout(C, 100);
6740
+ }), await new Promise((j) => {
6741
+ const P = () => {
6742
+ p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? j() : setTimeout(P, 100);
6743
6743
  };
6744
- C();
6744
+ P();
6745
6745
  }), p.current && p.current.setShowFullAvatar)
6746
6746
  try {
6747
6747
  p.current.setShowFullAvatar(a);
6748
- } catch (z) {
6749
- console.warn("Error setting full body mode on initialization:", z);
6748
+ } catch (j) {
6749
+ console.warn("Error setting full body mode on initialization:", j);
6750
6750
  }
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()), I(!1), oe(!0), r(p.current);
6752
- const k = () => {
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), S(!0), r(p.current);
6752
+ const D = () => {
6753
6753
  document.visibilityState === "visible" ? p.current?.start() : p.current?.stop();
6754
6754
  };
6755
- return document.addEventListener("visibilitychange", k), () => {
6756
- document.removeEventListener("visibilitychange", k);
6755
+ return document.addEventListener("visibilitychange", D), () => {
6756
+ document.removeEventListener("visibilitychange", D);
6757
6757
  };
6758
- } catch (v) {
6759
- console.error("Error initializing TalkingHead:", v), D(v.message || "Failed to initialize avatar"), I(!1), c(v);
6758
+ } catch (A) {
6759
+ console.error("Error initializing TalkingHead:", A), _(A.message || "Failed to initialize avatar"), B(!1), c(A);
6760
6760
  }
6761
- }, [N, t, e, i, n, s, o, a, l, u, h]);
6762
- le(() => (K(), () => {
6761
+ }, [O, t, e, i, n, s, o, a, l, u, h]);
6762
+ pe(() => (ge(), () => {
6763
6763
  p.current && (p.current.stop(), p.current.dispose(), p.current = null);
6764
- }), [K]), le(() => {
6764
+ }), [ge]), pe(() => {
6765
6765
  if (!F.current || !p.current) return;
6766
- const v = new ResizeObserver((z) => {
6767
- for (const C of z)
6766
+ const A = new ResizeObserver((j) => {
6767
+ for (const P of j)
6768
6768
  p.current && p.current.onResize && p.current.onResize();
6769
6769
  });
6770
- v.observe(F.current);
6771
- const k = () => {
6770
+ A.observe(F.current);
6771
+ const D = () => {
6772
6772
  p.current && p.current.onResize && p.current.onResize();
6773
6773
  };
6774
- return window.addEventListener("resize", k), () => {
6775
- v.disconnect(), window.removeEventListener("resize", k);
6774
+ return window.addEventListener("resize", D), () => {
6775
+ A.disconnect(), window.removeEventListener("resize", D);
6776
6776
  };
6777
- }, [Y]);
6778
- const se = M(async () => {
6777
+ }, [ne]);
6778
+ const re = T(async () => {
6779
6779
  if (p.current && p.current.audioCtx)
6780
6780
  try {
6781
6781
  (p.current.audioCtx.state === "suspended" || p.current.audioCtx.state === "interrupted") && (await p.current.audioCtx.resume(), console.log("Audio context resumed"));
6782
- } catch (v) {
6783
- console.warn("Failed to resume audio context:", v);
6782
+ } catch (A) {
6783
+ console.warn("Failed to resume audio context:", A);
6784
6784
  }
6785
- }, []), pe = M(async (v, k = {}) => {
6786
- if (p.current && Y)
6785
+ }, []), J = T(async (A, D = {}) => {
6786
+ if (p.current && ne)
6787
6787
  try {
6788
- await se();
6789
- const z = {
6790
- ...k,
6791
- lipsyncLang: k.lipsyncLang || V.lipsyncLang || "en"
6788
+ z.current = { text: A, options: D }, G(!1), await re();
6789
+ const j = {
6790
+ ...D,
6791
+ lipsyncLang: D.lipsyncLang || ue.lipsyncLang || "en"
6792
6792
  };
6793
- if (k.onSpeechEnd && p.current) {
6794
- const C = p.current;
6795
- let U = null, J = 0;
6796
- const ye = 1200;
6797
- let he = !1;
6798
- U = setInterval(() => {
6799
- if (J++, J > ye) {
6800
- if (U && (clearInterval(U), U = null), !he) {
6801
- he = !0;
6793
+ if (D.onSpeechEnd && p.current) {
6794
+ const P = p.current;
6795
+ let ee = null, ce = 0;
6796
+ const Ae = 1200;
6797
+ let ye = !1;
6798
+ ee = setInterval(() => {
6799
+ if (ce++, ce > Ae) {
6800
+ if (ee && (clearInterval(ee), ee = null), !ye) {
6801
+ ye = !0;
6802
6802
  try {
6803
- k.onSpeechEnd();
6804
- } catch (ve) {
6805
- console.error("Error in onSpeechEnd callback (timeout):", ve);
6803
+ D.onSpeechEnd();
6804
+ } catch (Se) {
6805
+ console.error("Error in onSpeechEnd callback (timeout):", Se);
6806
6806
  }
6807
6807
  }
6808
6808
  return;
6809
6809
  }
6810
- const He = !C.speechQueue || C.speechQueue.length === 0, Te = !C.audioPlaylist || C.audioPlaylist.length === 0;
6811
- C && C.isSpeaking === !1 && He && Te && C.isAudioPlaying === !1 && !he && setTimeout(() => {
6812
- if (C && C.isSpeaking === !1 && (!C.speechQueue || C.speechQueue.length === 0) && (!C.audioPlaylist || C.audioPlaylist.length === 0) && C.isAudioPlaying === !1 && !he) {
6813
- he = !0, U && (clearInterval(U), U = null);
6810
+ const Pe = !P.speechQueue || P.speechQueue.length === 0, Be = !P.audioPlaylist || P.audioPlaylist.length === 0;
6811
+ P && P.isSpeaking === !1 && Pe && Be && P.isAudioPlaying === !1 && !ye && setTimeout(() => {
6812
+ if (P && P.isSpeaking === !1 && (!P.speechQueue || P.speechQueue.length === 0) && (!P.audioPlaylist || P.audioPlaylist.length === 0) && P.isAudioPlaying === !1 && !ye) {
6813
+ ye = !0, ee && (clearInterval(ee), ee = null);
6814
6814
  try {
6815
- k.onSpeechEnd();
6816
- } catch (Me) {
6817
- console.error("Error in onSpeechEnd callback:", Me);
6815
+ D.onSpeechEnd();
6816
+ } catch (De) {
6817
+ console.error("Error in onSpeechEnd callback:", De);
6818
6818
  }
6819
6819
  }
6820
6820
  }, 100);
6821
6821
  }, 100);
6822
6822
  }
6823
- p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(v, z)) : setTimeout(async () => {
6824
- await se(), p.current && p.current.lipsync && (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(v, z));
6823
+ p.current.lipsync && Object.keys(p.current.lipsync).length > 0 ? (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(A, j)) : setTimeout(async () => {
6824
+ await re(), p.current && p.current.lipsync && (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(A, j));
6825
6825
  }, 100);
6826
- } catch (z) {
6827
- console.error("Error speaking text:", z), D(z.message || "Failed to speak text");
6826
+ } catch (j) {
6827
+ console.error("Error speaking text:", j), _(j.message || "Failed to speak text");
6828
+ }
6829
+ }, [ne, re, ue.lipsyncLang]), b = T(() => {
6830
+ p.current && (p.current.stopSpeaking(), p.current.setSlowdownRate && p.current.setSlowdownRate(1), z.current = null, G(!1));
6831
+ }, []), R = T(() => {
6832
+ p.current && p.current.pauseSpeaking && z.current && z.current.text && (p.current.pauseSpeaking(), G(!0));
6833
+ }, []), w = T(async () => {
6834
+ if (p.current && z.current) {
6835
+ G(!1);
6836
+ const A = z.current;
6837
+ if (z.current = null, await re(), A.text) {
6838
+ const D = {
6839
+ ...A.options,
6840
+ lipsyncLang: A.options.lipsyncLang || ue.lipsyncLang || "en"
6841
+ };
6842
+ p.current.lipsync && Object.keys(p.current.lipsync).length > 0 && (p.current.setSlowdownRate && p.current.setSlowdownRate(1.05), p.current.speakText(A.text, D));
6828
6843
  }
6829
- }, [Y, se, V.lipsyncLang]), ue = M(() => {
6830
- p.current && (p.current.stopSpeaking(), p.current.setSlowdownRate && p.current.setSlowdownRate(1));
6831
- }, []), ge = M((v) => {
6832
- p.current && p.current.setMood(v);
6833
- }, []), Q = M((v) => {
6834
- p.current && p.current.setSlowdownRate && p.current.setSlowdownRate(v);
6835
- }, []), b = M((v, k = !1) => {
6844
+ }
6845
+ }, [re]), C = T((A) => {
6846
+ p.current && p.current.setMood(A);
6847
+ }, []), W = T((A) => {
6848
+ p.current && p.current.setSlowdownRate && p.current.setSlowdownRate(A);
6849
+ }, []), te = T((A, D = !1) => {
6836
6850
  if (p.current && p.current.playAnimation) {
6837
- if (x && x[v] && (v = x[v]), p.current.setShowFullAvatar)
6851
+ if (x && x[A] && (A = x[A]), p.current.setShowFullAvatar)
6838
6852
  try {
6839
6853
  p.current.setShowFullAvatar(H.current);
6840
- } catch (C) {
6841
- console.warn("Error setting full body mode:", C);
6854
+ } catch (P) {
6855
+ console.warn("Error setting full body mode:", P);
6842
6856
  }
6843
- if (v.includes("."))
6857
+ if (A.includes("."))
6844
6858
  try {
6845
- p.current.playAnimation(v, null, 10, 0, 0.01, k);
6846
- } catch (C) {
6847
- console.warn(`Failed to play ${v}:`, C);
6859
+ p.current.playAnimation(A, null, 10, 0, 0.01, D);
6860
+ } catch (P) {
6861
+ console.warn(`Failed to play ${A}:`, P);
6848
6862
  try {
6849
6863
  p.current.setBodyMovement("idle");
6850
- } catch (U) {
6851
- console.warn("Fallback animation also failed:", U);
6864
+ } catch (ee) {
6865
+ console.warn("Fallback animation also failed:", ee);
6852
6866
  }
6853
6867
  }
6854
6868
  else {
6855
- const C = [".fbx", ".glb", ".gltf"];
6856
- let U = !1;
6857
- for (const J of C)
6869
+ const P = [".fbx", ".glb", ".gltf"];
6870
+ let ee = !1;
6871
+ for (const ce of P)
6858
6872
  try {
6859
- p.current.playAnimation(v + J, null, 10, 0, 0.01, k), U = !0;
6873
+ p.current.playAnimation(A + ce, null, 10, 0, 0.01, D), ee = !0;
6860
6874
  break;
6861
6875
  } catch {
6862
6876
  }
6863
- if (!U) {
6864
- console.warn("Animation not found:", v);
6877
+ if (!ee) {
6878
+ console.warn("Animation not found:", A);
6865
6879
  try {
6866
6880
  p.current.setBodyMovement("idle");
6867
- } catch (J) {
6868
- console.warn("Fallback animation also failed:", J);
6881
+ } catch (ce) {
6882
+ console.warn("Fallback animation also failed:", ce);
6869
6883
  }
6870
6884
  }
6871
6885
  }
6872
6886
  }
6873
- }, [x]), R = M(() => {
6887
+ }, [x]), ie = T(() => {
6874
6888
  p.current && p.current.onResize && p.current.onResize();
6875
6889
  }, []);
6876
- return xe(L, () => ({
6877
- speakText: pe,
6878
- stopSpeaking: ue,
6879
- resumeAudioContext: se,
6880
- setMood: ge,
6881
- setTimingAdjustment: Q,
6882
- playAnimation: b,
6883
- isReady: Y,
6890
+ return Ie(I, () => ({
6891
+ speakText: J,
6892
+ stopSpeaking: b,
6893
+ pauseSpeaking: R,
6894
+ resumeSpeaking: w,
6895
+ resumeAudioContext: re,
6896
+ setMood: C,
6897
+ setTimingAdjustment: W,
6898
+ playAnimation: te,
6899
+ isReady: ne,
6900
+ isPaused: V,
6884
6901
  talkingHead: p.current,
6885
- handleResize: R,
6886
- setBodyMovement: (v) => {
6902
+ handleResize: ie,
6903
+ setBodyMovement: (A) => {
6887
6904
  if (p.current && p.current.setShowFullAvatar && p.current.setBodyMovement)
6888
6905
  try {
6889
- p.current.setShowFullAvatar(H.current), p.current.setBodyMovement(v);
6890
- } catch (k) {
6891
- console.warn("Error setting body movement:", k);
6906
+ p.current.setShowFullAvatar(H.current), p.current.setBodyMovement(A);
6907
+ } catch (D) {
6908
+ console.warn("Error setting body movement:", D);
6892
6909
  }
6893
6910
  },
6894
- setMovementIntensity: (v) => p.current?.setMovementIntensity(v),
6911
+ setMovementIntensity: (A) => p.current?.setMovementIntensity(A),
6895
6912
  playRandomDance: () => {
6896
6913
  if (p.current && p.current.setShowFullAvatar && p.current.playRandomDance)
6897
6914
  try {
6898
6915
  p.current.setShowFullAvatar(H.current), p.current.playRandomDance();
6899
- } catch (v) {
6900
- console.warn("Error playing random dance:", v);
6916
+ } catch (A) {
6917
+ console.warn("Error playing random dance:", A);
6901
6918
  }
6902
6919
  },
6903
- playReaction: (v) => {
6920
+ playReaction: (A) => {
6904
6921
  if (p.current && p.current.setShowFullAvatar && p.current.playReaction)
6905
6922
  try {
6906
- p.current.setShowFullAvatar(H.current), p.current.playReaction(v);
6907
- } catch (k) {
6908
- console.warn("Error playing reaction:", k);
6923
+ p.current.setShowFullAvatar(H.current), p.current.playReaction(A);
6924
+ } catch (D) {
6925
+ console.warn("Error playing reaction:", D);
6909
6926
  }
6910
6927
  },
6911
6928
  playCelebration: () => {
6912
6929
  if (p.current && p.current.setShowFullAvatar && p.current.playCelebration)
6913
6930
  try {
6914
6931
  p.current.setShowFullAvatar(H.current), p.current.playCelebration();
6915
- } catch (v) {
6916
- console.warn("Error playing celebration:", v);
6932
+ } catch (A) {
6933
+ console.warn("Error playing celebration:", A);
6917
6934
  }
6918
6935
  },
6919
- setShowFullAvatar: (v) => {
6936
+ setShowFullAvatar: (A) => {
6920
6937
  if (p.current && p.current.setShowFullAvatar)
6921
6938
  try {
6922
- H.current = v, p.current.setShowFullAvatar(v);
6923
- } catch (k) {
6924
- console.warn("Error setting showFullAvatar:", k);
6939
+ H.current = A, p.current.setShowFullAvatar(A);
6940
+ } catch (D) {
6941
+ console.warn("Error setting showFullAvatar:", D);
6925
6942
  }
6926
6943
  },
6927
6944
  lockAvatarPosition: () => {
6928
6945
  if (p.current && p.current.lockAvatarPosition)
6929
6946
  try {
6930
6947
  p.current.lockAvatarPosition();
6931
- } catch (v) {
6932
- console.warn("Error locking avatar position:", v);
6948
+ } catch (A) {
6949
+ console.warn("Error locking avatar position:", A);
6933
6950
  }
6934
6951
  },
6935
6952
  unlockAvatarPosition: () => {
6936
6953
  if (p.current && p.current.unlockAvatarPosition)
6937
6954
  try {
6938
6955
  p.current.unlockAvatarPosition();
6939
- } catch (v) {
6940
- console.warn("Error unlocking avatar position:", v);
6956
+ } catch (A) {
6957
+ console.warn("Error unlocking avatar position:", A);
6941
6958
  }
6942
6959
  }
6943
- })), /* @__PURE__ */ ke(
6960
+ })), /* @__PURE__ */ Te(
6944
6961
  "div",
6945
6962
  {
6946
6963
  className: `talking-head-avatar ${g}`,
@@ -6951,7 +6968,7 @@ const ze = fe(({
6951
6968
  ...y
6952
6969
  },
6953
6970
  children: [
6954
- /* @__PURE__ */ ne(
6971
+ /* @__PURE__ */ he(
6955
6972
  "div",
6956
6973
  {
6957
6974
  ref: F,
@@ -6963,7 +6980,7 @@ const ze = fe(({
6963
6980
  }
6964
6981
  }
6965
6982
  ),
6966
- T && /* @__PURE__ */ ne("div", { className: "loading-overlay", style: {
6983
+ v && /* @__PURE__ */ he("div", { className: "loading-overlay", style: {
6967
6984
  position: "absolute",
6968
6985
  top: "50%",
6969
6986
  left: "50%",
@@ -6972,7 +6989,7 @@ const ze = fe(({
6972
6989
  fontSize: "18px",
6973
6990
  zIndex: 10
6974
6991
  }, children: "Loading avatar..." }),
6975
- B && /* @__PURE__ */ ne("div", { className: "error-overlay", style: {
6992
+ N && /* @__PURE__ */ he("div", { className: "error-overlay", style: {
6976
6993
  position: "absolute",
6977
6994
  top: "50%",
6978
6995
  left: "50%",
@@ -6983,14 +7000,14 @@ const ze = fe(({
6983
7000
  zIndex: 10,
6984
7001
  padding: "20px",
6985
7002
  borderRadius: "8px"
6986
- }, children: B })
7003
+ }, children: N })
6987
7004
  ]
6988
7005
  }
6989
7006
  );
6990
7007
  });
6991
- ze.displayName = "TalkingHeadAvatar";
6992
- const it = fe(({
6993
- text: N = "Hello! I'm a talking avatar. How are you today?",
7008
+ Ee.displayName = "TalkingHeadAvatar";
7009
+ const rt = ve(({
7010
+ text: O = "Hello! I'm a talking avatar. How are you today?",
6994
7011
  onLoading: t = () => {
6995
7012
  },
6996
7013
  onError: e = () => {
@@ -7001,7 +7018,7 @@ const it = fe(({
7001
7018
  style: s = {},
7002
7019
  avatarConfig: o = {}
7003
7020
  }, l) => {
7004
- const u = G(null), a = G(null), [h, r] = re(!0), [d, c] = re(null), [g, y] = re(!1), x = be(), L = o.ttsService || x.service, F = L === "browser" ? {
7021
+ const u = Z(null), a = Z(null), [h, r] = de(!0), [d, c] = de(null), [g, y] = de(!1), x = Le(), I = o.ttsService || x.service, F = I === "browser" ? {
7005
7022
  endpoint: "",
7006
7023
  apiKey: null,
7007
7024
  defaultVoice: "Google US English"
@@ -7010,13 +7027,13 @@ const it = fe(({
7010
7027
  // Override API key if provided via avatarConfig
7011
7028
  apiKey: o.ttsApiKey !== void 0 && o.ttsApiKey !== null ? o.ttsApiKey : x.apiKey,
7012
7029
  // Override endpoint for ElevenLabs if service is explicitly set
7013
- endpoint: L === "elevenlabs" && o.ttsApiKey ? "https://api.elevenlabs.io/v1/text-to-speech" : x.endpoint
7030
+ endpoint: I === "elevenlabs" && o.ttsApiKey ? "https://api.elevenlabs.io/v1/text-to-speech" : x.endpoint
7014
7031
  }, p = {
7015
7032
  url: "/avatars/brunette.glb",
7016
7033
  // Use brunette avatar (working glTF file)
7017
7034
  body: "F",
7018
7035
  avatarMood: "neutral",
7019
- ttsLang: L === "browser" ? "en-US" : "en",
7036
+ ttsLang: I === "browser" ? "en-US" : "en",
7020
7037
  ttsVoice: o.ttsVoice || F.defaultVoice,
7021
7038
  lipsyncLang: "en",
7022
7039
  // English lip-sync
@@ -7028,120 +7045,120 @@ const it = fe(({
7028
7045
  }, H = {
7029
7046
  ttsEndpoint: F.endpoint,
7030
7047
  ttsApikey: F.apiKey,
7031
- ttsService: L,
7048
+ ttsService: I,
7032
7049
  lipsyncModules: ["en"],
7033
7050
  cameraView: "upper"
7034
- }, T = M(async () => {
7051
+ }, z = T(async () => {
7035
7052
  if (!(!u.current || a.current))
7036
7053
  try {
7037
- if (r(!0), c(null), a.current = new we(u.current, H), await a.current.showAvatar(p, (O) => {
7038
- if (O.lengthComputable) {
7039
- const V = Math.min(100, Math.round(O.loaded / O.total * 100));
7040
- t(V);
7054
+ if (r(!0), c(null), a.current = new Me(u.current, H), await a.current.showAvatar(p, (G) => {
7055
+ if (G.lengthComputable) {
7056
+ const E = Math.min(100, Math.round(G.loaded / G.total * 100));
7057
+ t(E);
7041
7058
  }
7042
7059
  }), a.current.morphs && a.current.morphs.length > 0) {
7043
- const O = a.current.morphs[0].morphTargetDictionary;
7044
- console.log("Available morph targets:", Object.keys(O));
7045
- const V = Object.keys(O).filter((_) => _.startsWith("viseme_"));
7046
- console.log("Viseme morph targets found:", V), V.length === 0 && (console.warn("No viseme morph targets found! Lip-sync will not work properly."), console.log("Expected viseme targets: viseme_aa, viseme_E, viseme_I, viseme_O, viseme_U, viseme_PP, viseme_SS, viseme_TH, viseme_DD, viseme_FF, viseme_kk, viseme_nn, viseme_RR, viseme_CH, viseme_sil"));
7060
+ const G = a.current.morphs[0].morphTargetDictionary;
7061
+ console.log("Available morph targets:", Object.keys(G));
7062
+ const E = Object.keys(G).filter((X) => X.startsWith("viseme_"));
7063
+ console.log("Viseme morph targets found:", E), E.length === 0 && (console.warn("No viseme morph targets found! Lip-sync will not work properly."), console.log("Expected viseme targets: viseme_aa, viseme_E, viseme_I, viseme_O, viseme_U, viseme_PP, viseme_SS, viseme_TH, viseme_DD, viseme_FF, viseme_kk, viseme_nn, viseme_RR, viseme_CH, viseme_sil"));
7047
7064
  }
7048
- if (await new Promise((O) => {
7049
- const V = () => {
7050
- a.current.lipsync && Object.keys(a.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(a.current.lipsync)), O()) : (console.log("Waiting for lip-sync modules to load..."), setTimeout(V, 100));
7065
+ if (await new Promise((G) => {
7066
+ const E = () => {
7067
+ a.current.lipsync && Object.keys(a.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(a.current.lipsync)), G()) : (console.log("Waiting for lip-sync modules to load..."), setTimeout(E, 100));
7051
7068
  };
7052
- V();
7069
+ E();
7053
7070
  }), a.current && a.current.setShowFullAvatar)
7054
7071
  try {
7055
7072
  a.current.setShowFullAvatar(!0), console.log("Avatar initialized in full body mode");
7056
- } catch (O) {
7057
- console.warn("Error setting full body mode on initialization:", O);
7073
+ } catch (G) {
7074
+ console.warn("Error setting full body mode on initialization:", G);
7058
7075
  }
7059
7076
  r(!1), y(!0), i(a.current);
7060
- const P = () => {
7077
+ const V = () => {
7061
7078
  document.visibilityState === "visible" ? a.current?.start() : a.current?.stop();
7062
7079
  };
7063
- return document.addEventListener("visibilitychange", P), () => {
7064
- document.removeEventListener("visibilitychange", P);
7080
+ return document.addEventListener("visibilitychange", V), () => {
7081
+ document.removeEventListener("visibilitychange", V);
7065
7082
  };
7066
7083
  } catch (S) {
7067
7084
  console.error("Error initializing TalkingHead:", S), c(S.message || "Failed to initialize avatar"), r(!1), e(S);
7068
7085
  }
7069
7086
  }, []);
7070
- le(() => (T(), () => {
7087
+ pe(() => (z(), () => {
7071
7088
  a.current && (a.current.stop(), a.current.dispose(), a.current = null);
7072
- }), [T]);
7073
- const I = M((S) => {
7089
+ }), [z]);
7090
+ const v = T((S) => {
7074
7091
  if (a.current && g)
7075
7092
  try {
7076
7093
  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(() => {
7077
7094
  a.current && a.current.lipsync ? (console.log("Lip-sync now ready, speaking..."), a.current.setSlowdownRate && (a.current.setSlowdownRate(1.05), console.log("Applied timing adjustment for better lip-sync")), a.current.speakText(S)) : console.error("Lip-sync still not ready after waiting");
7078
7095
  }, 500));
7079
- } catch (P) {
7080
- console.error("Error speaking text:", P), c(P.message || "Failed to speak text");
7096
+ } catch (V) {
7097
+ console.error("Error speaking text:", V), c(V.message || "Failed to speak text");
7081
7098
  }
7082
7099
  else
7083
7100
  console.warn("Avatar not ready for speaking. isReady:", g, "talkingHeadRef:", !!a.current);
7084
- }, [g, p]), B = M(() => {
7101
+ }, [g, p]), B = T(() => {
7085
7102
  a.current && (a.current.stopSpeaking(), a.current.setSlowdownRate && (a.current.setSlowdownRate(1), console.log("Reset timing to normal")));
7086
- }, []), D = M((S) => {
7103
+ }, []), N = T((S) => {
7087
7104
  a.current && a.current.setMood(S);
7088
- }, []), Y = M((S) => {
7105
+ }, []), _ = T((S) => {
7089
7106
  a.current && a.current.setSlowdownRate && (a.current.setSlowdownRate(S), console.log("Timing adjustment set to:", S));
7090
- }, []), oe = M((S, P = !1) => {
7107
+ }, []), ne = T((S, V = !1) => {
7091
7108
  if (a.current && a.current.playAnimation) {
7092
7109
  if (a.current.setShowFullAvatar)
7093
7110
  try {
7094
7111
  a.current.setShowFullAvatar(!0);
7095
- } catch (V) {
7096
- console.warn("Error setting full body mode:", V);
7112
+ } catch (E) {
7113
+ console.warn("Error setting full body mode:", E);
7097
7114
  }
7098
7115
  if (S.includes("."))
7099
7116
  try {
7100
- a.current.playAnimation(S, null, 10, 0, 0.01, P), console.log("Playing animation:", S);
7101
- } catch (V) {
7102
- console.log(`Failed to play ${S}:`, V);
7117
+ a.current.playAnimation(S, null, 10, 0, 0.01, V), console.log("Playing animation:", S);
7118
+ } catch (E) {
7119
+ console.log(`Failed to play ${S}:`, E);
7103
7120
  try {
7104
7121
  a.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
7105
- } catch (_) {
7106
- console.warn("Fallback animation also failed:", _);
7122
+ } catch (X) {
7123
+ console.warn("Fallback animation also failed:", X);
7107
7124
  }
7108
7125
  }
7109
7126
  else {
7110
- const V = [".fbx", ".glb", ".gltf"];
7111
- let _ = !1;
7112
- for (const K of V)
7127
+ const E = [".fbx", ".glb", ".gltf"];
7128
+ let X = !1;
7129
+ for (const Y of E)
7113
7130
  try {
7114
- a.current.playAnimation(S + K, null, 10, 0, 0.01, P), console.log("Playing animation:", S + K), _ = !0;
7131
+ a.current.playAnimation(S + Y, null, 10, 0, 0.01, V), console.log("Playing animation:", S + Y), X = !0;
7115
7132
  break;
7116
7133
  } catch {
7117
- console.log(`Failed to play ${S}${K}, trying next format...`);
7134
+ console.log(`Failed to play ${S}${Y}, trying next format...`);
7118
7135
  }
7119
- if (!_) {
7136
+ if (!X) {
7120
7137
  console.warn("Animation system not available or animation not found:", S);
7121
7138
  try {
7122
7139
  a.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
7123
- } catch (K) {
7124
- console.warn("Fallback animation also failed:", K);
7140
+ } catch (Y) {
7141
+ console.warn("Fallback animation also failed:", Y);
7125
7142
  }
7126
7143
  }
7127
7144
  }
7128
7145
  } else
7129
7146
  console.warn("Animation system not available or animation not found:", S);
7130
7147
  }, []);
7131
- return xe(l, () => ({
7132
- speakText: I,
7148
+ return Ie(l, () => ({
7149
+ speakText: v,
7133
7150
  stopSpeaking: B,
7134
- setMood: D,
7135
- setTimingAdjustment: Y,
7136
- playAnimation: oe,
7151
+ setMood: N,
7152
+ setTimingAdjustment: _,
7153
+ playAnimation: ne,
7137
7154
  isReady: g,
7138
7155
  talkingHead: a.current,
7139
7156
  setBodyMovement: (S) => {
7140
7157
  if (a.current && a.current.setShowFullAvatar && a.current.setBodyMovement)
7141
7158
  try {
7142
7159
  a.current.setShowFullAvatar(!0), a.current.setBodyMovement(S), console.log("Body movement set with full body mode:", S);
7143
- } catch (P) {
7144
- console.warn("Error setting body movement:", P);
7160
+ } catch (V) {
7161
+ console.warn("Error setting body movement:", V);
7145
7162
  }
7146
7163
  },
7147
7164
  setMovementIntensity: (S) => a.current?.setMovementIntensity(S),
@@ -7157,8 +7174,8 @@ const it = fe(({
7157
7174
  if (a.current && a.current.setShowFullAvatar && a.current.playReaction)
7158
7175
  try {
7159
7176
  a.current.setShowFullAvatar(!0), a.current.playReaction(S), console.log("Reaction played with full body mode:", S);
7160
- } catch (P) {
7161
- console.warn("Error playing reaction:", P);
7177
+ } catch (V) {
7178
+ console.warn("Error playing reaction:", V);
7162
7179
  }
7163
7180
  },
7164
7181
  playCelebration: () => {
@@ -7173,8 +7190,8 @@ const it = fe(({
7173
7190
  if (a.current && a.current.setShowFullAvatar)
7174
7191
  try {
7175
7192
  a.current.setShowFullAvatar(S), console.log("Show full avatar set to:", S);
7176
- } catch (P) {
7177
- console.warn("Error setting showFullAvatar:", P);
7193
+ } catch (V) {
7194
+ console.warn("Error setting showFullAvatar:", V);
7178
7195
  }
7179
7196
  },
7180
7197
  lockAvatarPosition: () => {
@@ -7193,8 +7210,8 @@ const it = fe(({
7193
7210
  console.warn("Error unlocking avatar position:", S);
7194
7211
  }
7195
7212
  }
7196
- })), /* @__PURE__ */ ke("div", { className: `talking-head-container ${n}`, style: s, children: [
7197
- /* @__PURE__ */ ne(
7213
+ })), /* @__PURE__ */ Te("div", { className: `talking-head-container ${n}`, style: s, children: [
7214
+ /* @__PURE__ */ he(
7198
7215
  "div",
7199
7216
  {
7200
7217
  ref: u,
@@ -7206,7 +7223,7 @@ const it = fe(({
7206
7223
  }
7207
7224
  }
7208
7225
  ),
7209
- h && /* @__PURE__ */ ne("div", { className: "loading-overlay", style: {
7226
+ h && /* @__PURE__ */ he("div", { className: "loading-overlay", style: {
7210
7227
  position: "absolute",
7211
7228
  top: "50%",
7212
7229
  left: "50%",
@@ -7215,7 +7232,7 @@ const it = fe(({
7215
7232
  fontSize: "18px",
7216
7233
  zIndex: 10
7217
7234
  }, children: "Loading avatar..." }),
7218
- d && /* @__PURE__ */ ne("div", { className: "error-overlay", style: {
7235
+ d && /* @__PURE__ */ he("div", { className: "error-overlay", style: {
7219
7236
  position: "absolute",
7220
7237
  top: "50%",
7221
7238
  left: "50%",
@@ -7229,9 +7246,9 @@ const it = fe(({
7229
7246
  }, children: d })
7230
7247
  ] });
7231
7248
  });
7232
- it.displayName = "TalkingHeadComponent";
7233
- const nt = fe(({
7234
- curriculumData: N = null,
7249
+ rt.displayName = "TalkingHeadComponent";
7250
+ const lt = ve(({
7251
+ curriculumData: O = null,
7235
7252
  avatarConfig: t = {},
7236
7253
  animations: e = {},
7237
7254
  onLessonStart: i = () => {
@@ -7246,7 +7263,7 @@ const nt = fe(({
7246
7263
  },
7247
7264
  autoStart: u = !1
7248
7265
  }, a) => {
7249
- const h = G(null), r = G({
7266
+ const h = Z(null), r = Z({
7250
7267
  currentModuleIndex: 0,
7251
7268
  currentLessonIndex: 0,
7252
7269
  currentQuestionIndex: 0,
@@ -7256,18 +7273,18 @@ const nt = fe(({
7256
7273
  curriculumCompleted: !1,
7257
7274
  score: 0,
7258
7275
  totalQuestions: 0
7259
- }), d = G({
7276
+ }), d = Z({
7260
7277
  onLessonStart: i,
7261
7278
  onLessonComplete: n,
7262
7279
  onQuestionAnswer: s,
7263
7280
  onCurriculumComplete: o,
7264
7281
  onCustomAction: l
7265
- }), c = G(null), g = G(null), y = G(null), x = G(null), L = G(null), F = G(null), p = G(null), H = G(N?.curriculum || {
7282
+ }), c = Z(null), g = Z(null), y = Z(null), x = Z(null), I = Z(null), F = Z(null), p = Z(null), H = Z(O?.curriculum || {
7266
7283
  title: "Default Curriculum",
7267
7284
  description: "No curriculum data provided",
7268
7285
  language: "en",
7269
7286
  modules: []
7270
- }), T = G({
7287
+ }), z = Z({
7271
7288
  avatarUrl: t.avatarUrl || "/avatars/brunette.glb",
7272
7289
  avatarBody: t.avatarBody || "F",
7273
7290
  mood: t.mood || "happy",
@@ -7281,7 +7298,7 @@ const nt = fe(({
7281
7298
  animations: e,
7282
7299
  lipsyncLang: "en"
7283
7300
  });
7284
- le(() => {
7301
+ pe(() => {
7285
7302
  d.current = {
7286
7303
  onLessonStart: i,
7287
7304
  onLessonComplete: n,
@@ -7289,13 +7306,13 @@ const nt = fe(({
7289
7306
  onCurriculumComplete: o,
7290
7307
  onCustomAction: l
7291
7308
  };
7292
- }, [i, n, s, o, l]), le(() => {
7293
- H.current = N?.curriculum || {
7309
+ }, [i, n, s, o, l]), pe(() => {
7310
+ H.current = O?.curriculum || {
7294
7311
  title: "Default Curriculum",
7295
7312
  description: "No curriculum data provided",
7296
7313
  language: "en",
7297
7314
  modules: []
7298
- }, T.current = {
7315
+ }, z.current = {
7299
7316
  avatarUrl: t.avatarUrl || "/avatars/brunette.glb",
7300
7317
  avatarBody: t.avatarBody || "F",
7301
7318
  mood: t.mood || "happy",
@@ -7309,8 +7326,8 @@ const nt = fe(({
7309
7326
  animations: e,
7310
7327
  lipsyncLang: "en"
7311
7328
  };
7312
- }, [N, t, e]);
7313
- const I = M(() => (H.current || { modules: [] }).modules[r.current.currentModuleIndex]?.lessons[r.current.currentLessonIndex], []), B = M(() => I()?.questions[r.current.currentQuestionIndex], [I]), D = M((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, []), Y = M(() => {
7329
+ }, [O, t, e]);
7330
+ const v = T(() => (H.current || { modules: [] }).modules[r.current.currentModuleIndex]?.lessons[r.current.currentLessonIndex], []), B = T(() => v()?.questions[r.current.currentQuestionIndex], [v]), N = T((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, []), _ = T(() => {
7314
7331
  r.current.lessonCompleted = !0, r.current.isQuestionMode = !1;
7315
7332
  const b = r.current.totalQuestions > 0 ? Math.round(r.current.score / r.current.totalQuestions * 100) : 100;
7316
7333
  let R = "Congratulations! You've completed this lesson";
@@ -7334,9 +7351,9 @@ const nt = fe(({
7334
7351
  } catch {
7335
7352
  h.current.playCelebration();
7336
7353
  }
7337
- const v = H.current || { modules: [] }, k = v.modules[r.current.currentModuleIndex], z = r.current.currentLessonIndex < (k?.lessons?.length || 0) - 1, C = r.current.currentModuleIndex < (v.modules?.length || 0) - 1, U = z || C, J = T.current || { lipsyncLang: "en" };
7354
+ const w = H.current || { modules: [] }, C = w.modules[r.current.currentModuleIndex], W = r.current.currentLessonIndex < (C?.lessons?.length || 0) - 1, te = r.current.currentModuleIndex < (w.modules?.length || 0) - 1, ie = W || te, A = z.current || { lipsyncLang: "en" };
7338
7355
  h.current.speakText(R, {
7339
- lipsyncLang: J.lipsyncLang,
7356
+ lipsyncLang: A.lipsyncLang,
7340
7357
  onSpeechEnd: () => {
7341
7358
  d.current.onCustomAction({
7342
7359
  type: "lessonCompleteFeedbackDone",
@@ -7345,17 +7362,17 @@ const nt = fe(({
7345
7362
  score: r.current.score,
7346
7363
  totalQuestions: r.current.totalQuestions,
7347
7364
  percentage: b,
7348
- hasNextLesson: U
7365
+ hasNextLesson: ie
7349
7366
  });
7350
7367
  }
7351
7368
  });
7352
7369
  }
7353
- }, [e.lessonComplete]), oe = M(() => {
7370
+ }, [e.lessonComplete]), ne = T(() => {
7354
7371
  r.current.curriculumCompleted = !0;
7355
7372
  const b = H.current || { modules: [] };
7356
7373
  if (d.current.onCurriculumComplete({
7357
7374
  modules: b.modules.length,
7358
- totalLessons: b.modules.reduce((R, v) => R + v.lessons.length, 0)
7375
+ totalLessons: b.modules.reduce((R, w) => R + w.lessons.length, 0)
7359
7376
  }), h.current) {
7360
7377
  if (h.current.setMood("celebrating"), e.curriculumComplete)
7361
7378
  try {
@@ -7363,11 +7380,11 @@ const nt = fe(({
7363
7380
  } catch {
7364
7381
  h.current.playCelebration();
7365
7382
  }
7366
- const R = T.current || { lipsyncLang: "en" };
7383
+ const R = z.current || { lipsyncLang: "en" };
7367
7384
  h.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 });
7368
7385
  }
7369
- }, [e.curriculumComplete]), S = M(() => {
7370
- const b = I();
7386
+ }, [e.curriculumComplete]), S = T(() => {
7387
+ const b = v();
7371
7388
  r.current.isQuestionMode = !0, r.current.currentQuestionIndex = 0, r.current.totalQuestions = b?.questions?.length || 0, r.current.score = 0;
7372
7389
  const R = B();
7373
7390
  R && d.current.onCustomAction({
@@ -7379,34 +7396,34 @@ const nt = fe(({
7379
7396
  question: R,
7380
7397
  score: r.current.score
7381
7398
  });
7382
- const v = () => {
7399
+ const w = () => {
7383
7400
  if (!h.current || !R) return;
7384
7401
  if (h.current.setMood("happy"), e.questionStart)
7385
7402
  try {
7386
7403
  h.current.playAnimation(e.questionStart, !0);
7387
- } catch (z) {
7388
- console.warn("Failed to play questionStart animation:", z);
7404
+ } catch (W) {
7405
+ console.warn("Failed to play questionStart animation:", W);
7389
7406
  }
7390
- const k = T.current || { lipsyncLang: "en" };
7391
- R.type === "code_test" ? h.current.speakText(`Let's test your coding skills! Here's your first challenge: ${R.question}`, { lipsyncLang: k.lipsyncLang }) : R.type === "multiple_choice" ? h.current.speakText(`Now let me ask you some questions. Here's the first one: ${R.question}`, { lipsyncLang: k.lipsyncLang }) : R.type === "true_false" ? h.current.speakText(`Let's start with some true or false questions. First question: ${R.question}`, { lipsyncLang: k.lipsyncLang }) : h.current.speakText(`Now let me ask you some questions. Here's the first one: ${R.question}`, { lipsyncLang: k.lipsyncLang });
7407
+ const C = z.current || { lipsyncLang: "en" };
7408
+ R.type === "code_test" ? h.current.speakText(`Let's test your coding skills! Here's your first challenge: ${R.question}`, { lipsyncLang: C.lipsyncLang }) : R.type === "multiple_choice" ? h.current.speakText(`Now let me ask you some questions. Here's the first one: ${R.question}`, { lipsyncLang: C.lipsyncLang }) : R.type === "true_false" ? h.current.speakText(`Let's start with some true or false questions. First question: ${R.question}`, { lipsyncLang: C.lipsyncLang }) : h.current.speakText(`Now let me ask you some questions. Here's the first one: ${R.question}`, { lipsyncLang: C.lipsyncLang });
7392
7409
  };
7393
7410
  if (h.current && h.current.isReady && R)
7394
- v();
7411
+ w();
7395
7412
  else if (h.current && h.current.isReady) {
7396
- const k = T.current || { lipsyncLang: "en" };
7397
- h.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang: k.lipsyncLang });
7413
+ const C = z.current || { lipsyncLang: "en" };
7414
+ h.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang: C.lipsyncLang });
7398
7415
  } else {
7399
- const k = setInterval(() => {
7400
- h.current && h.current.isReady && (clearInterval(k), R && v());
7416
+ const C = setInterval(() => {
7417
+ h.current && h.current.isReady && (clearInterval(C), R && w());
7401
7418
  }, 100);
7402
7419
  setTimeout(() => {
7403
- clearInterval(k);
7420
+ clearInterval(C);
7404
7421
  }, 5e3);
7405
7422
  }
7406
- }, [e.questionStart, I, B]), P = M(() => {
7407
- const b = I();
7423
+ }, [e.questionStart, v, B]), V = T(() => {
7424
+ const b = v();
7408
7425
  if (r.current.currentQuestionIndex < (b?.questions?.length || 0) - 1) {
7409
- r.current.currentQuestionIndex += 1;
7426
+ h.current && h.current.stopSpeaking && h.current.stopSpeaking(), r.current.currentQuestionIndex += 1;
7410
7427
  const R = B();
7411
7428
  R && d.current.onCustomAction({
7412
7429
  type: "nextQuestion",
@@ -7417,33 +7434,33 @@ const nt = fe(({
7417
7434
  question: R,
7418
7435
  score: r.current.score
7419
7436
  });
7420
- const v = () => {
7437
+ const w = () => {
7421
7438
  if (!h.current || !R) return;
7422
7439
  if (h.current.setMood("happy"), h.current.setBodyMovement("idle"), e.nextQuestion)
7423
7440
  try {
7424
7441
  h.current.playAnimation(e.nextQuestion, !0);
7425
- } catch (z) {
7426
- console.warn("Failed to play nextQuestion animation:", z);
7442
+ } catch (W) {
7443
+ console.warn("Failed to play nextQuestion animation:", W);
7427
7444
  }
7428
- const k = T.current || { lipsyncLang: "en" };
7445
+ const C = z.current || { lipsyncLang: "en" };
7429
7446
  R.type === "code_test" ? h.current.speakText(`Great! Now let's move on to your next coding challenge: ${R.question}`, {
7430
- lipsyncLang: k.lipsyncLang
7447
+ lipsyncLang: C.lipsyncLang
7431
7448
  }) : R.type === "multiple_choice" ? h.current.speakText(`Alright! Here's your next question: ${R.question}`, {
7432
- lipsyncLang: k.lipsyncLang
7449
+ lipsyncLang: C.lipsyncLang
7433
7450
  }) : R.type === "true_false" ? h.current.speakText(`Now let's try this one: ${R.question}`, {
7434
- lipsyncLang: k.lipsyncLang
7451
+ lipsyncLang: C.lipsyncLang
7435
7452
  }) : h.current.speakText(`Here's the next question: ${R.question}`, {
7436
- lipsyncLang: k.lipsyncLang
7453
+ lipsyncLang: C.lipsyncLang
7437
7454
  });
7438
7455
  };
7439
7456
  if (h.current && h.current.isReady && R)
7440
- v();
7457
+ w();
7441
7458
  else if (R) {
7442
- const k = setInterval(() => {
7443
- h.current && h.current.isReady && (clearInterval(k), v());
7459
+ const C = setInterval(() => {
7460
+ h.current && h.current.isReady && (clearInterval(C), w());
7444
7461
  }, 100);
7445
7462
  setTimeout(() => {
7446
- clearInterval(k);
7463
+ clearInterval(C);
7447
7464
  }, 5e3);
7448
7465
  }
7449
7466
  } else
@@ -7454,55 +7471,55 @@ const nt = fe(({
7454
7471
  totalQuestions: r.current.totalQuestions,
7455
7472
  score: r.current.score
7456
7473
  });
7457
- }, [e.nextQuestion, I, B]), O = M(() => {
7474
+ }, [e.nextQuestion, v, B]), G = T(() => {
7458
7475
  const b = H.current || { modules: [] }, R = b.modules[r.current.currentModuleIndex];
7459
7476
  if (r.current.currentLessonIndex < (R?.lessons?.length || 0) - 1) {
7460
7477
  r.current.currentLessonIndex += 1, r.current.currentQuestionIndex = 0, r.current.lessonCompleted = !1, r.current.isQuestionMode = !1, r.current.isTeaching = !1, r.current.score = 0, r.current.totalQuestions = 0;
7461
- const k = b.modules[r.current.currentModuleIndex], z = r.current.currentLessonIndex < (k?.lessons?.length || 0) - 1, C = r.current.currentModuleIndex < (b.modules?.length || 0) - 1, U = z || C;
7478
+ const C = b.modules[r.current.currentModuleIndex], W = r.current.currentLessonIndex < (C?.lessons?.length || 0) - 1, te = r.current.currentModuleIndex < (b.modules?.length || 0) - 1, ie = W || te;
7462
7479
  d.current.onCustomAction({
7463
7480
  type: "lessonStart",
7464
7481
  moduleIndex: r.current.currentModuleIndex,
7465
7482
  lessonIndex: r.current.currentLessonIndex,
7466
- hasNextLesson: U
7483
+ hasNextLesson: ie
7467
7484
  }), d.current.onLessonStart({
7468
7485
  moduleIndex: r.current.currentModuleIndex,
7469
7486
  lessonIndex: r.current.currentLessonIndex,
7470
- lesson: I()
7487
+ lesson: v()
7471
7488
  }), h.current && (h.current.setMood("happy"), h.current.setBodyMovement("idle"));
7472
7489
  } else if (r.current.currentModuleIndex < (b.modules?.length || 0) - 1) {
7473
7490
  r.current.currentModuleIndex += 1, r.current.currentLessonIndex = 0, r.current.currentQuestionIndex = 0, r.current.lessonCompleted = !1, r.current.isQuestionMode = !1, r.current.isTeaching = !1, r.current.score = 0, r.current.totalQuestions = 0;
7474
- const z = b.modules[r.current.currentModuleIndex], C = r.current.currentLessonIndex < (z?.lessons?.length || 0) - 1, U = r.current.currentModuleIndex < (b.modules?.length || 0) - 1, J = C || U;
7491
+ const W = b.modules[r.current.currentModuleIndex], te = r.current.currentLessonIndex < (W?.lessons?.length || 0) - 1, ie = r.current.currentModuleIndex < (b.modules?.length || 0) - 1, A = te || ie;
7475
7492
  d.current.onCustomAction({
7476
7493
  type: "lessonStart",
7477
7494
  moduleIndex: r.current.currentModuleIndex,
7478
7495
  lessonIndex: r.current.currentLessonIndex,
7479
- hasNextLesson: J
7496
+ hasNextLesson: A
7480
7497
  }), d.current.onLessonStart({
7481
7498
  moduleIndex: r.current.currentModuleIndex,
7482
7499
  lessonIndex: r.current.currentLessonIndex,
7483
- lesson: I()
7500
+ lesson: v()
7484
7501
  }), h.current && (h.current.setMood("happy"), h.current.setBodyMovement("idle"));
7485
7502
  } else
7486
- L.current && L.current();
7487
- }, []), V = M(() => {
7488
- const b = I();
7503
+ I.current && I.current();
7504
+ }, []), E = T(() => {
7505
+ const b = v();
7489
7506
  let R = null;
7490
7507
  if (b?.avatar_script && b?.body) {
7491
- const v = b.avatar_script.trim(), k = b.body.trim(), z = v.match(/[.!?]$/) ? " " : ". ";
7492
- R = `${v}${z}${k}`;
7508
+ const w = b.avatar_script.trim(), C = b.body.trim(), W = w.match(/[.!?]$/) ? " " : ". ";
7509
+ R = `${w}${W}${C}`;
7493
7510
  } else
7494
7511
  R = b?.avatar_script || b?.body || null;
7495
7512
  if (h.current && h.current.isReady && R) {
7496
7513
  r.current.isTeaching = !0, r.current.isQuestionMode = !1, r.current.score = 0, r.current.totalQuestions = 0, h.current.setMood("happy");
7497
- let v = !1;
7514
+ let w = !1;
7498
7515
  if (e.teaching)
7499
7516
  try {
7500
- h.current.playAnimation(e.teaching, !0), v = !0;
7501
- } catch (z) {
7502
- console.warn("Failed to play teaching animation:", z);
7517
+ h.current.playAnimation(e.teaching, !0), w = !0;
7518
+ } catch (W) {
7519
+ console.warn("Failed to play teaching animation:", W);
7503
7520
  }
7504
- v || h.current.setBodyMovement("gesturing");
7505
- const k = T.current || { lipsyncLang: "en" };
7521
+ w || h.current.setBodyMovement("gesturing");
7522
+ const C = z.current || { lipsyncLang: "en" };
7506
7523
  d.current.onLessonStart({
7507
7524
  moduleIndex: r.current.currentModuleIndex,
7508
7525
  lessonIndex: r.current.currentLessonIndex,
@@ -7513,7 +7530,7 @@ const nt = fe(({
7513
7530
  lessonIndex: r.current.currentLessonIndex,
7514
7531
  lesson: b
7515
7532
  }), h.current.speakText(R, {
7516
- lipsyncLang: k.lipsyncLang,
7533
+ lipsyncLang: C.lipsyncLang,
7517
7534
  onSpeechEnd: () => {
7518
7535
  r.current.isTeaching = !1, d.current.onCustomAction({
7519
7536
  type: "teachingComplete",
@@ -7525,17 +7542,17 @@ const nt = fe(({
7525
7542
  }
7526
7543
  });
7527
7544
  }
7528
- }, [e.teaching, I]), _ = M((b) => {
7529
- const R = B(), v = D(b, R);
7530
- if (v && (r.current.score += 1), d.current.onQuestionAnswer({
7545
+ }, [e.teaching, v]), X = T((b) => {
7546
+ const R = B(), w = N(b, R);
7547
+ if (w && (r.current.score += 1), d.current.onQuestionAnswer({
7531
7548
  moduleIndex: r.current.currentModuleIndex,
7532
7549
  lessonIndex: r.current.currentLessonIndex,
7533
7550
  questionIndex: r.current.currentQuestionIndex,
7534
7551
  answer: b,
7535
- isCorrect: v,
7552
+ isCorrect: w,
7536
7553
  question: R
7537
7554
  }), h.current)
7538
- if (v) {
7555
+ if (w) {
7539
7556
  if (h.current.setMood("happy"), e.correct)
7540
7557
  try {
7541
7558
  h.current.playReaction("happy");
@@ -7543,18 +7560,18 @@ const nt = fe(({
7543
7560
  h.current.setBodyMovement("happy");
7544
7561
  }
7545
7562
  h.current.setBodyMovement("gesturing");
7546
- const k = R.type === "code_test" ? `Great job! Your code passed all the tests! ${R.explanation || ""}` : `Excellent! That's correct! ${R.explanation || ""}`, z = T.current || { lipsyncLang: "en" };
7547
- h.current.speakText(k, {
7548
- lipsyncLang: z.lipsyncLang,
7563
+ const C = R.type === "code_test" ? `Great job! Your code passed all the tests! ${R.explanation || ""}` : `Excellent! That's correct! ${R.explanation || ""}`, W = z.current || { lipsyncLang: "en" };
7564
+ h.current.speakText(C, {
7565
+ lipsyncLang: W.lipsyncLang,
7549
7566
  onSpeechEnd: () => {
7550
- const U = I()?.questions?.length || 0;
7567
+ const ie = v()?.questions?.length || 0;
7551
7568
  d.current.onCustomAction({
7552
7569
  type: "answerFeedbackComplete",
7553
7570
  moduleIndex: r.current.currentModuleIndex,
7554
7571
  lessonIndex: r.current.currentLessonIndex,
7555
7572
  questionIndex: r.current.currentQuestionIndex,
7556
7573
  isCorrect: !0,
7557
- hasNextQuestion: r.current.currentQuestionIndex < U - 1,
7574
+ hasNextQuestion: r.current.currentQuestionIndex < ie - 1,
7558
7575
  score: r.current.score,
7559
7576
  totalQuestions: r.current.totalQuestions
7560
7577
  });
@@ -7568,18 +7585,18 @@ const nt = fe(({
7568
7585
  h.current.setBodyMovement("idle");
7569
7586
  }
7570
7587
  h.current.setBodyMovement("gesturing");
7571
- const k = 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.`, z = T.current || { lipsyncLang: "en" };
7572
- h.current.speakText(k, {
7573
- lipsyncLang: z.lipsyncLang,
7588
+ const C = 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.`, W = z.current || { lipsyncLang: "en" };
7589
+ h.current.speakText(C, {
7590
+ lipsyncLang: W.lipsyncLang,
7574
7591
  onSpeechEnd: () => {
7575
- const U = I()?.questions?.length || 0;
7592
+ const ie = v()?.questions?.length || 0;
7576
7593
  d.current.onCustomAction({
7577
7594
  type: "answerFeedbackComplete",
7578
7595
  moduleIndex: r.current.currentModuleIndex,
7579
7596
  lessonIndex: r.current.currentLessonIndex,
7580
7597
  questionIndex: r.current.currentQuestionIndex,
7581
7598
  isCorrect: !1,
7582
- hasNextQuestion: r.current.currentQuestionIndex < U - 1,
7599
+ hasNextQuestion: r.current.currentQuestionIndex < ie - 1,
7583
7600
  score: r.current.score,
7584
7601
  totalQuestions: r.current.totalQuestions
7585
7602
  });
@@ -7587,20 +7604,20 @@ const nt = fe(({
7587
7604
  });
7588
7605
  }
7589
7606
  else {
7590
- const z = I()?.questions?.length || 0;
7607
+ const W = v()?.questions?.length || 0;
7591
7608
  d.current.onCustomAction({
7592
7609
  type: "answerFeedbackComplete",
7593
7610
  moduleIndex: r.current.currentModuleIndex,
7594
7611
  lessonIndex: r.current.currentLessonIndex,
7595
7612
  questionIndex: r.current.currentQuestionIndex,
7596
- isCorrect: v,
7597
- hasNextQuestion: r.current.currentQuestionIndex < z - 1,
7613
+ isCorrect: w,
7614
+ hasNextQuestion: r.current.currentQuestionIndex < W - 1,
7598
7615
  score: r.current.score,
7599
7616
  totalQuestions: r.current.totalQuestions,
7600
7617
  avatarNotReady: !0
7601
7618
  });
7602
7619
  }
7603
- }, [e.correct, e.incorrect, B, I, D]), K = M((b) => {
7620
+ }, [e.correct, e.incorrect, B, v, N]), Y = T((b) => {
7604
7621
  const R = B();
7605
7622
  if (!b || typeof b != "object") {
7606
7623
  console.error("Invalid code test result format. Expected object with {passed: boolean, ...}");
@@ -7610,7 +7627,7 @@ const nt = fe(({
7610
7627
  console.warn("Current question is not a code test. Use handleAnswerSelect for other question types.");
7611
7628
  return;
7612
7629
  }
7613
- const v = {
7630
+ const w = {
7614
7631
  passed: b.passed === !0,
7615
7632
  results: b.results || [],
7616
7633
  output: b.output || "",
@@ -7625,10 +7642,10 @@ const nt = fe(({
7625
7642
  moduleIndex: r.current.currentModuleIndex,
7626
7643
  lessonIndex: r.current.currentLessonIndex,
7627
7644
  questionIndex: r.current.currentQuestionIndex,
7628
- testResult: v,
7645
+ testResult: w,
7629
7646
  question: R
7630
- }), p.current && p.current(v);
7631
- }, [B, D]), se = M(() => {
7647
+ }), p.current && p.current(w);
7648
+ }, [B, N]), ue = T(() => {
7632
7649
  if (r.current.currentQuestionIndex > 0) {
7633
7650
  r.current.currentQuestionIndex -= 1;
7634
7651
  const b = B();
@@ -7644,25 +7661,25 @@ const nt = fe(({
7644
7661
  const R = () => {
7645
7662
  if (!h.current || !b) return;
7646
7663
  h.current.setMood("happy"), h.current.setBodyMovement("idle");
7647
- const v = T.current || { lipsyncLang: "en" };
7664
+ const w = z.current || { lipsyncLang: "en" };
7648
7665
  b.type === "code_test" ? h.current.speakText(`Let's go back to this coding challenge: ${b.question}`, {
7649
- lipsyncLang: v.lipsyncLang
7666
+ lipsyncLang: w.lipsyncLang
7650
7667
  }) : h.current.speakText(`Going back to: ${b.question}`, {
7651
- lipsyncLang: v.lipsyncLang
7668
+ lipsyncLang: w.lipsyncLang
7652
7669
  });
7653
7670
  };
7654
7671
  if (h.current && h.current.isReady && b)
7655
7672
  R();
7656
7673
  else if (b) {
7657
- const v = setInterval(() => {
7658
- h.current && h.current.isReady && (clearInterval(v), R());
7674
+ const w = setInterval(() => {
7675
+ h.current && h.current.isReady && (clearInterval(w), R());
7659
7676
  }, 100);
7660
7677
  setTimeout(() => {
7661
- clearInterval(v);
7678
+ clearInterval(w);
7662
7679
  }, 5e3);
7663
7680
  }
7664
7681
  }
7665
- }, [B]), pe = M(() => {
7682
+ }, [B]), Re = T(() => {
7666
7683
  const b = H.current || { modules: [] };
7667
7684
  if (b.modules[r.current.currentModuleIndex], r.current.currentLessonIndex > 0)
7668
7685
  r.current.currentLessonIndex -= 1, r.current.currentQuestionIndex = 0, r.current.lessonCompleted = !1, r.current.isQuestionMode = !1, r.current.isTeaching = !1, r.current.score = 0, r.current.totalQuestions = 0, d.current.onCustomAction({
@@ -7672,54 +7689,54 @@ const nt = fe(({
7672
7689
  }), d.current.onLessonStart({
7673
7690
  moduleIndex: r.current.currentModuleIndex,
7674
7691
  lessonIndex: r.current.currentLessonIndex,
7675
- lesson: I()
7692
+ lesson: v()
7676
7693
  }), h.current && (h.current.setMood("happy"), h.current.setBodyMovement("idle"));
7677
7694
  else if (r.current.currentModuleIndex > 0) {
7678
- const k = b.modules[r.current.currentModuleIndex - 1];
7679
- r.current.currentModuleIndex -= 1, r.current.currentLessonIndex = (k?.lessons?.length || 1) - 1, r.current.currentQuestionIndex = 0, r.current.lessonCompleted = !1, r.current.isQuestionMode = !1, r.current.isTeaching = !1, r.current.score = 0, r.current.totalQuestions = 0, d.current.onCustomAction({
7695
+ const C = b.modules[r.current.currentModuleIndex - 1];
7696
+ r.current.currentModuleIndex -= 1, r.current.currentLessonIndex = (C?.lessons?.length || 1) - 1, r.current.currentQuestionIndex = 0, r.current.lessonCompleted = !1, r.current.isQuestionMode = !1, r.current.isTeaching = !1, r.current.score = 0, r.current.totalQuestions = 0, d.current.onCustomAction({
7680
7697
  type: "lessonStart",
7681
7698
  moduleIndex: r.current.currentModuleIndex,
7682
7699
  lessonIndex: r.current.currentLessonIndex
7683
7700
  }), d.current.onLessonStart({
7684
7701
  moduleIndex: r.current.currentModuleIndex,
7685
7702
  lessonIndex: r.current.currentLessonIndex,
7686
- lesson: I()
7703
+ lesson: v()
7687
7704
  }), h.current && (h.current.setMood("happy"), h.current.setBodyMovement("idle"));
7688
7705
  }
7689
- }, [I]), ue = M(() => {
7706
+ }, [v]), ge = T(() => {
7690
7707
  r.current.currentModuleIndex = 0, r.current.currentLessonIndex = 0, r.current.currentQuestionIndex = 0, r.current.isTeaching = !1, r.current.isQuestionMode = !1, r.current.lessonCompleted = !1, r.current.curriculumCompleted = !1, r.current.score = 0, r.current.totalQuestions = 0;
7691
- }, []), ge = M((b) => {
7708
+ }, []), re = T((b) => {
7692
7709
  console.log("Avatar is ready!", b);
7693
- const R = I(), v = R?.avatar_script || R?.body;
7694
- u && v && setTimeout(() => {
7710
+ const R = v(), w = R?.avatar_script || R?.body;
7711
+ u && w && setTimeout(() => {
7695
7712
  c.current && c.current();
7696
7713
  }, 10);
7697
- }, [u, I]);
7698
- Ee(() => {
7699
- c.current = V, g.current = O, y.current = Y, x.current = P, L.current = oe, F.current = S, p.current = _;
7700
- }), xe(a, () => ({
7714
+ }, [u, v]);
7715
+ Oe(() => {
7716
+ c.current = E, g.current = G, y.current = _, x.current = V, I.current = ne, F.current = S, p.current = X;
7717
+ }), Ie(a, () => ({
7701
7718
  // Curriculum control methods
7702
- startTeaching: V,
7719
+ startTeaching: E,
7703
7720
  startQuestions: S,
7704
- handleAnswerSelect: _,
7705
- handleCodeTestResult: K,
7706
- nextQuestion: P,
7707
- previousQuestion: se,
7708
- nextLesson: O,
7709
- previousLesson: pe,
7710
- completeLesson: Y,
7711
- completeCurriculum: oe,
7712
- resetCurriculum: ue,
7721
+ handleAnswerSelect: X,
7722
+ handleCodeTestResult: Y,
7723
+ nextQuestion: V,
7724
+ previousQuestion: ue,
7725
+ nextLesson: G,
7726
+ previousLesson: Re,
7727
+ completeLesson: _,
7728
+ completeCurriculum: ne,
7729
+ resetCurriculum: ge,
7713
7730
  getState: () => ({ ...r.current }),
7714
7731
  getCurrentQuestion: () => B(),
7715
- getCurrentLesson: () => I(),
7732
+ getCurrentLesson: () => v(),
7716
7733
  // Direct access to avatar ref (always returns current value)
7717
7734
  getAvatarRef: () => h.current,
7718
7735
  // Convenience methods that delegate to avatar (always check current ref)
7719
7736
  speakText: async (b, R = {}) => {
7720
7737
  await h.current?.resumeAudioContext?.();
7721
- const v = T.current || { lipsyncLang: "en" };
7722
- h.current?.speakText(b, { ...R, lipsyncLang: R.lipsyncLang || v.lipsyncLang });
7738
+ const w = z.current || { lipsyncLang: "en" };
7739
+ h.current?.speakText(b, { ...R, lipsyncLang: R.lipsyncLang || w.lipsyncLang });
7723
7740
  },
7724
7741
  resumeAudioContext: async () => {
7725
7742
  if (h.current?.resumeAudioContext)
@@ -7730,13 +7747,16 @@ const nt = fe(({
7730
7747
  if (R.state === "suspended" || R.state === "interrupted")
7731
7748
  try {
7732
7749
  await R.resume(), console.log("Audio context resumed via talkingHead");
7733
- } catch (v) {
7734
- console.warn("Failed to resume audio context:", v);
7750
+ } catch (w) {
7751
+ console.warn("Failed to resume audio context:", w);
7735
7752
  }
7736
7753
  } else
7737
7754
  console.warn("Audio context not available yet");
7738
7755
  },
7739
7756
  stopSpeaking: () => h.current?.stopSpeaking(),
7757
+ pauseSpeaking: () => h.current?.pauseSpeaking(),
7758
+ resumeSpeaking: async () => await h.current?.resumeSpeaking(),
7759
+ isPaused: () => h.current?.isPaused || !1,
7740
7760
  setMood: (b) => h.current?.setMood(b),
7741
7761
  playAnimation: (b, R) => h.current?.playAnimation(b, R),
7742
7762
  setBodyMovement: (b) => h.current?.setBodyMovement(b),
@@ -7760,8 +7780,8 @@ const nt = fe(({
7760
7780
  handleResize: () => h.current?.handleResize(),
7761
7781
  // Avatar readiness check (always returns current value)
7762
7782
  isAvatarReady: () => h.current?.isReady || !1
7763
- }), [V, S, _, K, P, O, Y, oe, ue, B, I]);
7764
- const Q = T.current || {
7783
+ }), [E, S, X, Y, V, G, _, ne, ge, B, v]);
7784
+ const J = z.current || {
7765
7785
  avatarUrl: "/avatars/brunette.glb",
7766
7786
  avatarBody: "F",
7767
7787
  mood: "happy",
@@ -7774,23 +7794,23 @@ const nt = fe(({
7774
7794
  showFullAvatar: !1,
7775
7795
  animations: e
7776
7796
  };
7777
- return /* @__PURE__ */ ne("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ ne(
7778
- ze,
7797
+ return /* @__PURE__ */ he("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ he(
7798
+ Ee,
7779
7799
  {
7780
7800
  ref: h,
7781
- avatarUrl: Q.avatarUrl,
7782
- avatarBody: Q.avatarBody,
7783
- mood: Q.mood,
7784
- ttsLang: Q.ttsLang,
7785
- ttsService: Q.ttsService,
7786
- ttsVoice: Q.ttsVoice,
7787
- ttsApiKey: Q.ttsApiKey,
7788
- bodyMovement: Q.bodyMovement,
7789
- movementIntensity: Q.movementIntensity,
7790
- showFullAvatar: Q.showFullAvatar,
7801
+ avatarUrl: J.avatarUrl,
7802
+ avatarBody: J.avatarBody,
7803
+ mood: J.mood,
7804
+ ttsLang: J.ttsLang,
7805
+ ttsService: J.ttsService,
7806
+ ttsVoice: J.ttsVoice,
7807
+ ttsApiKey: J.ttsApiKey,
7808
+ bodyMovement: J.bodyMovement,
7809
+ movementIntensity: J.movementIntensity,
7810
+ showFullAvatar: J.showFullAvatar,
7791
7811
  cameraView: "upper",
7792
- animations: Q.animations,
7793
- onReady: ge,
7812
+ animations: J.animations,
7813
+ onReady: re,
7794
7814
  onLoading: () => {
7795
7815
  },
7796
7816
  onError: (b) => {
@@ -7799,8 +7819,8 @@ const nt = fe(({
7799
7819
  }
7800
7820
  ) });
7801
7821
  });
7802
- nt.displayName = "CurriculumLearning";
7803
- const Ce = {
7822
+ lt.displayName = "CurriculumLearning";
7823
+ const Fe = {
7804
7824
  // Code-based dance animations (no FBX required)
7805
7825
  dance: {
7806
7826
  name: "dance",
@@ -7903,14 +7923,14 @@ const Ce = {
7903
7923
  duration: 5e3,
7904
7924
  description: "Excited, energetic movement"
7905
7925
  }
7906
- }, pt = (N) => Ce[N] || null, gt = (N) => Ce.hasOwnProperty(N);
7926
+ }, bt = (O) => Fe[O] || null, Rt = (O) => Fe.hasOwnProperty(O);
7907
7927
  export {
7908
- nt as CurriculumLearning,
7909
- ze as TalkingHeadAvatar,
7910
- it as TalkingHeadComponent,
7911
- Ce as animations,
7912
- be as getActiveTTSConfig,
7913
- pt as getAnimation,
7914
- mt as getVoiceOptions,
7915
- gt as hasAnimation
7928
+ lt as CurriculumLearning,
7929
+ Ee as TalkingHeadAvatar,
7930
+ rt as TalkingHeadComponent,
7931
+ Fe as animations,
7932
+ Le as getActiveTTSConfig,
7933
+ bt as getAnimation,
7934
+ xt as getVoiceOptions,
7935
+ Rt as hasAnimation
7916
7936
  };