@sage-rsc/talking-head-react 1.6.1 → 1.6.2

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 ve, jsx as J } from "react/jsx-runtime";
2
- import { forwardRef as Be, useRef as X, useState as le, useEffect as ge, useCallback as G, useImperativeHandle as Oe, useLayoutEffect as Ke } from "react";
1
+ import { jsxs as Re, jsx as ee } from "react/jsx-runtime";
2
+ import { forwardRef as Ne, useRef as X, useState as le, useEffect as ye, useCallback as V, useImperativeHandle as Ue, useLayoutEffect as Je } from "react";
3
3
  import * as x from "three";
4
- import { OrbitControls as $e } from "three/addons/controls/OrbitControls.js";
5
- import { GLTFLoader as Je } from "three/addons/loaders/GLTFLoader.js";
6
- import { DRACOLoader as et } from "three/addons/loaders/DRACOLoader.js";
7
- import { FBXLoader as Ve } from "three/addons/loaders/FBXLoader.js";
8
- import { RoomEnvironment as tt } from "three/addons/environments/RoomEnvironment.js";
9
- import nt from "three/addons/libs/stats.module.js";
10
- let m, pe, fe;
11
- const H = [0, 0, 0, 0], P = new x.Vector3(), Me = new x.Vector3(), he = new x.Vector3(), Fe = new x.Vector3();
4
+ import { OrbitControls as et } from "three/addons/controls/OrbitControls.js";
5
+ import { GLTFLoader as tt } from "three/addons/loaders/GLTFLoader.js";
6
+ import { DRACOLoader as nt } from "three/addons/loaders/DRACOLoader.js";
7
+ import { FBXLoader as Xe } from "three/addons/loaders/FBXLoader.js";
8
+ import { RoomEnvironment as it } from "three/addons/environments/RoomEnvironment.js";
9
+ import ot from "three/addons/libs/stats.module.js";
10
+ let m, ge, xe;
11
+ const H = [0, 0, 0, 0], O = new x.Vector3(), Pe = new x.Vector3(), de = new x.Vector3(), Be = new x.Vector3();
12
12
  new x.Plane();
13
13
  new x.Ray();
14
14
  new x.Euler();
15
- const de = new x.Quaternion(), Ge = new x.Quaternion(), Re = new x.Matrix4(), Ae = new x.Matrix4();
15
+ const me = new x.Quaternion(), je = new x.Quaternion(), Ie = new x.Matrix4(), Le = new x.Matrix4();
16
16
  new x.Vector3();
17
- const Ee = new x.Vector3(0, 0, 1), it = new x.Vector3(1, 0, 0), ot = new x.Vector3(0, 1, 0), st = new x.Vector3(0, 0, 1);
18
- class at {
17
+ const Oe = new x.Vector3(0, 0, 1), st = new x.Vector3(1, 0, 0), at = new x.Vector3(0, 1, 0), rt = new x.Vector3(0, 0, 1);
18
+ class lt {
19
19
  constructor(t = null) {
20
20
  this.opt = Object.assign({
21
21
  warmupMs: 2e3,
@@ -321,7 +321,7 @@ class at {
321
321
  /// Bone's parent object
322
322
  vBasis: a.position.clone(),
323
323
  // Original local position
324
- vWorld: a.parent.getWorldPosition(P).clone(),
324
+ vWorld: a.parent.getWorldPosition(O).clone(),
325
325
  // World position, parent
326
326
  qBasis: a.parent.quaternion.clone(),
327
327
  // Original quaternion, parent
@@ -338,7 +338,7 @@ class at {
338
338
  ea: [0, 0, 0, 0]
339
339
  // External acceleration [m/s^2]
340
340
  };
341
- c.boneParent.matrixWorld.decompose(P, de, he), P.copy(Ee).applyQuaternion(de).setY(0).normalize(), de.premultiply(Ge.setFromUnitVectors(Ee, P).invert()).normalize(), c.qWorldInverseYaw = de.clone().normalize(), this.data.push(c), this.dict[u] = c;
341
+ c.boneParent.matrixWorld.decompose(O, me, de), O.copy(Oe).applyQuaternion(me).setY(0).normalize(), me.premultiply(je.setFromUnitVectors(Oe, O).invert()).normalize(), c.qWorldInverseYaw = me.clone().normalize(), this.data.push(c), this.dict[u] = c;
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 (l) {
@@ -356,22 +356,22 @@ class at {
356
356
  for (this.timerMs += t, t > 1e3 && (this.timerMs = 0), t /= 1e3, e = 0, i = this.objectsUpdate.length; e < i; 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, i = this.data.length; e < i; e++) {
359
- if (o = this.data[e], P.copy(o.vWorld), Re.copy(o.boneParent.matrixWorld), Ae.copy(Re).invert(), o.vWorld.setFromMatrixPosition(Re), P.applyMatrix4(Ae), P.length() > 0.5 && (console.info("Info: Unrealistic jump of " + P.length().toFixed(2) + " meters."), P.setLength(0.5)), P.applyQuaternion(o.bone.quaternion), H[0] = P.x, H[1] = P.y, H[2] = -P.z, H[3] = P.length() / 3, o.children)
359
+ if (o = this.data[e], O.copy(o.vWorld), Ie.copy(o.boneParent.matrixWorld), Le.copy(Ie).invert(), o.vWorld.setFromMatrixPosition(Ie), O.applyMatrix4(Le), O.length() > 0.5 && (console.info("Info: Unrealistic jump of " + O.length().toFixed(2) + " meters."), O.setLength(0.5)), O.applyQuaternion(o.bone.quaternion), H[0] = O.x, H[1] = O.y, H[2] = -O.z, H[3] = O.length() / 3, o.children)
360
360
  for (n = 0, s = o.children.length; n < s; n++)
361
361
  m = o.children[n], H[0] -= m.v[0] * t / 3, H[1] -= m.v[1] * t / 3, H[2] += m.v[2] * t / 3, H[3] -= m.v[3] * t / 3;
362
- if (m = this.opt.sensitivityFactor, H[0] *= o.ext * m, H[1] *= o.ext * m, H[2] *= o.ext * m, H[3] *= o.ext * m, o.isX && (m = H[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 + H[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 = H[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 + H[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 = H[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 + H[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 = H[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 + H[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), H[0] = o.p[0], H[1] = o.p[1], H[2] = o.p[2], H[3] = o.p[3], m = this.opt.movementFactor, H[0] *= m, H[1] *= m, H[2] *= m, H[3] *= m, o.dl && (m = o.dl, H[0] += m[0], H[1] += m[1], H[2] += m[2]), o.dw && (m = o.dw, P.set(
362
+ if (m = this.opt.sensitivityFactor, H[0] *= o.ext * m, H[1] *= o.ext * m, H[2] *= o.ext * m, H[3] *= o.ext * m, o.isX && (m = H[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 + H[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 = H[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 + H[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 = H[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 + H[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 = H[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 + H[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), H[0] = o.p[0], H[1] = o.p[1], H[2] = o.p[2], H[3] = o.p[3], m = this.opt.movementFactor, H[0] *= m, H[1] *= m, H[2] *= m, H[3] *= m, o.dl && (m = o.dl, H[0] += m[0], H[1] += m[1], H[2] += m[2]), o.dw && (m = o.dw, O.set(
363
363
  o.vBasis.x + H[0],
364
364
  o.vBasis.y + H[1],
365
365
  o.vBasis.z + H[2]
366
- ), P.applyMatrix4(Re), P.x += m[0], P.y += m[1], P.z += m[2], P.applyMatrix4(Ae), H[0] += P.x - o.vBasis.x, H[1] += P.y - o.vBasis.y, H[2] += P.z - o.vBasis.z), o.limits && this.opt.isLimits && (m = o.limits, m[0] && (m[0][0] !== null && H[0] < m[0][0] && (H[0] = m[0][0]), m[0][1] !== null && H[0] > m[0][1] && (H[0] = m[0][1])), m[1] && (m[1][0] !== null && H[1] < m[1][0] && (H[1] = m[1][0]), m[1][1] !== null && H[1] > m[1][1] && (H[1] = m[1][1])), m[2] && (m[2][0] !== null && H[2] < m[2][0] && (H[2] = m[2][0]), m[2][1] !== null && H[2] > m[2][1] && (H[2] = m[2][1])), m[3] && (m[3][0] !== null && H[3] < m[3][0] && (H[3] = m[3][0]), m[3][1] !== null && H[3] > m[3][1] && (H[3] = m[3][1]))), o.isPoint)
366
+ ), O.applyMatrix4(Ie), O.x += m[0], O.y += m[1], O.z += m[2], O.applyMatrix4(Le), H[0] += O.x - o.vBasis.x, H[1] += O.y - o.vBasis.y, H[2] += O.z - o.vBasis.z), o.limits && this.opt.isLimits && (m = o.limits, m[0] && (m[0][0] !== null && H[0] < m[0][0] && (H[0] = m[0][0]), m[0][1] !== null && H[0] > m[0][1] && (H[0] = m[0][1])), m[1] && (m[1][0] !== null && H[1] < m[1][0] && (H[1] = m[1][0]), m[1][1] !== null && H[1] > m[1][1] && (H[1] = m[1][1])), m[2] && (m[2][0] !== null && H[2] < m[2][0] && (H[2] = m[2][0]), m[2][1] !== null && H[2] > m[2][1] && (H[2] = m[2][1])), m[3] && (m[3][0] !== null && H[3] < m[3][0] && (H[3] = m[3][0]), m[3][1] !== null && H[3] > m[3][1] && (H[3] = m[3][1]))), o.isPoint)
367
367
  o.bone.position.set(
368
368
  o.vBasis.x + H[0],
369
369
  o.vBasis.y + H[1],
370
370
  o.vBasis.z - H[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(P, de, he), P.copy(Ee).applyQuaternion(de).setY(0).normalize(), de.premultiply(Ge.setFromUnitVectors(Ee, P).invert()).normalize(), o.boneParent.quaternion.multiply(de.invert()), o.boneParent.quaternion.multiply(o.qWorldInverseYaw)), o.isZ && (m = Math.atan(H[0] / o.l), de.setFromAxisAngle(st, -m), o.boneParent.quaternion.multiply(de)), o.isY && (m = o.l / 3, m = m * Math.tanh(H[1] / m), o.bone.position.setLength(o.l + m)), o.isX && (m = Math.atan(H[2] / o.l), de.setFromAxisAngle(it, -m), o.boneParent.quaternion.multiply(de)), o.isT && (m = 1.5 * Math.tanh(H[3] * 1.5), de.setFromAxisAngle(ot, -m), o.boneParent.quaternion.multiply(de)), 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(O, me, de), O.copy(Oe).applyQuaternion(me).setY(0).normalize(), me.premultiply(je.setFromUnitVectors(Oe, O).invert()).normalize(), o.boneParent.quaternion.multiply(me.invert()), o.boneParent.quaternion.multiply(o.qWorldInverseYaw)), o.isZ && (m = Math.atan(H[0] / o.l), me.setFromAxisAngle(rt, -m), o.boneParent.quaternion.multiply(me)), o.isY && (m = o.l / 3, m = m * Math.tanh(H[1] / m), o.bone.position.setLength(o.l + m)), o.isX && (m = Math.atan(H[2] / o.l), me.setFromAxisAngle(st, -m), o.boneParent.quaternion.multiply(me)), o.isT && (m = 1.5 * Math.tanh(H[3] * 1.5), me.setFromAxisAngle(at, -m), o.boneParent.quaternion.multiply(me)), o.boneParent.updateWorldMatrix(!1, !0), o.excludes && this.opt.isExcludes)
373
373
  for (n = 0, s = o.excludes.length; n < s; n++)
374
- m = o.excludes[n], he.set(0, 0, 0), m.deltaLocal && (he.x += m.deltaLocal[0], he.y += m.deltaLocal[1], he.z += m.deltaLocal[2]), he.applyMatrix4(m.bone.matrixWorld), Ae.copy(o.boneParent.matrixWorld).invert(), he.applyMatrix4(Ae), P.copy(o.bone.position), !(P.distanceToSquared(he) >= m.radiusSq) && (fe = P.length(), pe = he.length(), !(pe > m.radius + fe) && (pe < Math.abs(m.radius - fe) || (pe = (pe * pe + fe * fe - m.radiusSq) / (2 * pe), he.normalize(), Fe.copy(he).multiplyScalar(pe), pe = Math.sqrt(fe * fe - pe * pe), P.subVectors(P, Fe).projectOnPlane(he).normalize().multiplyScalar(pe), Me.subVectors(o.vBasis, Fe).projectOnPlane(he).normalize(), fe = Me.dot(P), fe < 0 && (fe = Math.sqrt(pe * pe - fe * fe), Me.multiplyScalar(fe), P.add(Me)), P.add(Fe).normalize(), he.copy(o.bone.position).normalize(), de.setFromUnitVectors(he, P), o.boneParent.quaternion.premultiply(de), o.boneParent.updateWorldMatrix(!1, !0))));
374
+ m = o.excludes[n], de.set(0, 0, 0), m.deltaLocal && (de.x += m.deltaLocal[0], de.y += m.deltaLocal[1], de.z += m.deltaLocal[2]), de.applyMatrix4(m.bone.matrixWorld), Le.copy(o.boneParent.matrixWorld).invert(), de.applyMatrix4(Le), O.copy(o.bone.position), !(O.distanceToSquared(de) >= m.radiusSq) && (xe = O.length(), ge = de.length(), !(ge > m.radius + xe) && (ge < Math.abs(m.radius - xe) || (ge = (ge * ge + xe * xe - m.radiusSq) / (2 * ge), de.normalize(), Be.copy(de).multiplyScalar(ge), ge = Math.sqrt(xe * xe - ge * ge), O.subVectors(O, Be).projectOnPlane(de).normalize().multiplyScalar(ge), Pe.subVectors(o.vBasis, Be).projectOnPlane(de).normalize(), xe = Pe.dot(O), xe < 0 && (xe = Math.sqrt(ge * ge - xe * xe), Pe.multiplyScalar(xe), O.add(Pe)), O.add(Be).normalize(), de.copy(o.bone.position).normalize(), me.setFromUnitVectors(de, O), o.boneParent.quaternion.premultiply(me), o.boneParent.updateWorldMatrix(!1, !0))));
375
375
  }
376
376
  this.helpers.isActive && this.updateHelpers();
377
377
  }
@@ -442,17 +442,17 @@ class at {
442
442
  */
443
443
  updateHelpers() {
444
444
  if (m = this.helpers.points, m.bones.length) {
445
- Ae.copy(this.armature.matrixWorld).invert();
445
+ Le.copy(this.armature.matrixWorld).invert();
446
446
  const t = m.object.geometry.getAttribute("position");
447
447
  for (let e = 0, n = m.bones.length; e < n; e++)
448
- Re.multiplyMatrices(Ae, m.bones[e].matrixWorld), P.setFromMatrixPosition(Re), t.setXYZ(e, P.x, P.y, P.z);
448
+ Ie.multiplyMatrices(Le, m.bones[e].matrixWorld), O.setFromMatrixPosition(Ie), t.setXYZ(e, O.x, O.y, O.z);
449
449
  t.needsUpdate = !0, m.object.updateMatrixWorld();
450
450
  }
451
451
  if (m = this.helpers.lines, m.bones.length) {
452
- Ae.copy(this.armature.matrixWorld).invert();
452
+ Le.copy(this.armature.matrixWorld).invert();
453
453
  const t = m.object.geometry.getAttribute("position");
454
454
  for (let e = 0, n = 0, i = m.bones.length; e < i; e++, n += 2)
455
- Re.multiplyMatrices(Ae, m.bones[e].matrixWorld), P.setFromMatrixPosition(Re), t.setXYZ(n, P.x, P.y, P.z), Re.multiplyMatrices(Ae, m.bones[e].parent.matrixWorld), P.setFromMatrixPosition(Re), t.setXYZ(n + 1, P.x, P.y, P.z);
455
+ Ie.multiplyMatrices(Le, m.bones[e].matrixWorld), O.setFromMatrixPosition(Ie), t.setXYZ(n, O.x, O.y, O.z), Ie.multiplyMatrices(Le, m.bones[e].parent.matrixWorld), O.setFromMatrixPosition(Ie), t.setXYZ(n + 1, O.x, O.y, O.z);
456
456
  t.needsUpdate = !0, m.object.updateMatrixWorld();
457
457
  }
458
458
  }
@@ -489,7 +489,7 @@ class at {
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 rt {
492
+ class ct {
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 rt {
608
608
  for (let l = 0; l < i / 2; l++) {
609
609
  const d = n[(u + l) * 2], h = n[(u + l) * 2 + 1], p = n[(u + l + i / 2) * 2] * a - n[(u + l + i / 2) * 2 + 1] * c, b = n[(u + l + i / 2) * 2] * c + n[(u + l + i / 2) * 2 + 1] * a;
610
610
  n[(u + l) * 2] = d + p, n[(u + l) * 2 + 1] = h + b, n[(u + l + i / 2) * 2] = d - p, n[(u + l + i / 2) * 2 + 1] = h - b;
611
- const f = a * o - c * r, S = a * r + c * o;
612
- a = f, c = S;
611
+ const f = a * o - c * r, k = a * r + c * o;
612
+ a = f, c = k;
613
613
  }
614
614
  }
615
615
  }
@@ -814,7 +814,7 @@ class rt {
814
814
  return i * s;
815
815
  }
816
816
  }
817
- class lt {
817
+ class ut {
818
818
  /**
819
819
  * @constructor
820
820
  */
@@ -1396,11 +1396,11 @@ class lt {
1396
1396
  return e;
1397
1397
  }
1398
1398
  }
1399
- const ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1399
+ const ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1400
1400
  __proto__: null,
1401
- LipsyncEn: lt
1401
+ LipsyncEn: ut
1402
1402
  }, Symbol.toStringTag, { value: "Module" }));
1403
- class ut {
1403
+ class dt {
1404
1404
  /**
1405
1405
  * @constructor
1406
1406
  */
@@ -1754,11 +1754,11 @@ class ut {
1754
1754
  return e;
1755
1755
  }
1756
1756
  }
1757
- const ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1757
+ const mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1758
1758
  __proto__: null,
1759
- LipsyncDe: ut
1759
+ LipsyncDe: dt
1760
1760
  }, Symbol.toStringTag, { value: "Module" }));
1761
- class dt {
1761
+ class pt {
1762
1762
  /**
1763
1763
  * @constructor
1764
1764
  */
@@ -2289,11 +2289,11 @@ class dt {
2289
2289
  return e;
2290
2290
  }
2291
2291
  }
2292
- const mt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2292
+ const gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2293
2293
  __proto__: null,
2294
- LipsyncFr: dt
2294
+ LipsyncFr: pt
2295
2295
  }, Symbol.toStringTag, { value: "Module" }));
2296
- class pt {
2296
+ class yt {
2297
2297
  /**
2298
2298
  * @constructor
2299
2299
  */
@@ -2436,11 +2436,11 @@ class pt {
2436
2436
  return e;
2437
2437
  }
2438
2438
  }
2439
- const gt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2439
+ const ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2440
2440
  __proto__: null,
2441
- LipsyncFi: pt
2441
+ LipsyncFi: yt
2442
2442
  }, Symbol.toStringTag, { value: "Module" }));
2443
- class yt {
2443
+ class xt {
2444
2444
  /**
2445
2445
  * @constructor
2446
2446
  */
@@ -2620,24 +2620,24 @@ class yt {
2620
2620
  return e;
2621
2621
  }
2622
2622
  }
2623
- const ft = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2623
+ const bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2624
2624
  __proto__: null,
2625
- LipsyncLt: yt
2626
- }, Symbol.toStringTag, { value: "Module" })), xt = new URL("data:text/javascript;base64,Y2xhc3MgUGxheWJhY2tXb3JrbGV0IGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgRlNNID0gewogICAgSURMRTogMCwKICAgIFBM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hhc1NlbnRFbmRlZCA9IHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgLy8gU2VuZCBmaW5hbCBtZXRyaWNzIHNob3dpbmcgY2xlYXJlZCBzdGF0ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9KTsKICAgICAgICAgICAgICB9IGNhdGNoIChfKSB7IH0KICAgICAgICAgICAgfQogICAgICAgICAgICB0aGlzLnJlc2V0KCk7IC8vIFJlc2V0IHRvIElETEUgc3RhdGUgZm9yIHJldXNlCiAgICAgICAgICAgIGJyZWFrOyAvLyBFeGl0IHdoaWxlIGxvb3AKICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgIC8vIEJVRkZFUiBVTkRFUlJVTiAoTEFHKTogUGxheSBzaWxlbmNlIGFuZCB3YWl0IGZvciBtb3JlIGRhdGEu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: ct,
2628
- de: ht,
2629
- fr: mt,
2630
- fi: gt,
2631
- lt: ft
2632
- }, oe = new x.Quaternion(), _ = new x.Euler(), Le = new x.Vector3(), Se = new x.Vector3(), Xe = new x.Box3();
2625
+ LipsyncLt: xt
2626
+ }, Symbol.toStringTag, { value: "Module" })), vt = new URL("data:text/javascript;base64,Y2xhc3MgUGxheWJhY2tXb3JrbGV0IGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgRlNNID0gewogICAgSURMRTogMCwKICAgIFBMQVlJTkc6IDEsCiAgfTsKCiAgY29uc3RydWN0b3Iob3B0aW9ucykgewogICAgc3VwZXIoKTsKICAgIHRoaXMucG9ydC5vbm1lc3NhZ2UgPSB0aGlzLmhhbmRsZU1lc3NhZ2UuYmluZCh0aGlzKTsKCiAgICB0aGlzLl9zYW1wbGVSYXRlID0gb3B0aW9ucz8ucHJvY2Vzc29yT3B0aW9ucz8uc2FtcGxlUmF0ZSB8fCBzYW1wbGVSYXRlOwogICAgdGhpcy5fc2NhbGUgPSAxIC8gMzI3Njg7IC8vIFBDTTE2IC0+IGZsb2F0CgogICAgLy8gU2lsZW5jZSBkZXRlY3Rpb24gdGhyZXNob2xkICgxIHNlY29uZCkgYXMgYSBmYWxsYmFjayBzYWZldHkgbmV0CiAgICBjb25zdCBzaWxlbmNlRHVyYXRpb25TZWNvbmRzID0gMS4wOwogICAgdGhpcy5fc2lsZW5jZVRocmVzaG9sZEJsb2NrcyA9IE1hdGguY2VpbCgodGhpcy5fc2FtcGxlUmF0ZSAqIHNpbGVuY2VEdXJhdGlvblNlY29uZHMpIC8gMTI4KTsKCiAgICAvLyBNZXRyaWNzIGNvbmZpZ3VyYXRpb24gdmlhIG9wdGlvbnMKICAgIGNvbnN0IG1ldHJpY3NDZmcgPSBvcHRpb25zPy5wcm9jZXNzb3JPcHRpb25zPy5tZXRyaWNzIHx8IHt9OwogICAgdGhpcy5fbWV0cmljc0VuYWJsZWQgPSB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zLl9ub01vcmVEYXRhUmVjZWl2ZWQgfHwgaXNUaW1lZE91dCkgewogICAgICAgICAgICAvLyBFTkQgT0YgUExBWUJBQ0s6IEVpdGhlciBleHBsaWNpdGx5IHNpZ25hbGVkIG9yIHRpbWVkIG91dC4KICAgICAgICAgICAgaWYgKCF0aGlzLl9oYXNTZW50RW5kZWQpIHsKICAgICAgICAgICAgICB0aGlzLnBvcnQucG9zdE1lc3NhZ2UoeyB0eXBlOiAicGxheWJhY2stZW5kZWQiIH0pOwogICAgICAgICAgICAgIHRoaXMuX2hhc1NlbnRFbmRlZCA9IHRydWU7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgLy8gU2VuZCBmaW5hbCBtZXRyaWNzIHNob3dpbmcgY2xlYXJlZCBzdGF0ZQogICAgICAgICAgICBpZiAodGhpcy5fbWV0cmljc0VuYWJsZWQpIHsKICAgICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgdGhpcy5wb3J0LnBvc3RNZXNzYWdlKHsKICAgICAgICAgICAgICAgICAgdHlwZTogIm1ldHJpY3MiLAogICAgICAgICAgICAgICAgICBkYXRhOiB7CiAgICAgICAgICAgICAgICAgICAgc3RhdGU6IFBsYXliYWNrV29ya2xldC5GU00uSURMRSwKICAgICAgICAgICAgICAgICAgICBxdWV1ZWRTYW1wbGVzOiAwLAogICAgICAgICAgICAgICAgICAgIHF1ZXVlZE1zOiAwLAogICAgICAgICAgICAgICAgICAgIG1heFF1ZXVlZE1zOiBNYXRoLnJvdW5kKCh0aGlzLl9tYXhRdWV1ZVNhbXBsZXMgLyB0aGlzLl9zYW1wbGVSYXRlKSAqIDEwMDApLAogICAgICAgICAgICAgICAgICAgIHVuZGVycnVuQmxvY2tzOiB0aGlzLl91bmRlcnJ1bkJsb2NrcywKICAgICAgICAgICAgICAgICAgICBmcmFtZXNQcm9jZXNzZWQ6IHRoaXMuX2ZyYW1lc1Byb2Nlc3NlZAogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB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QgcmVzZXQgbWF4IHRyYWNrZXIgLSBrZWVwIHNlc3Npb24gcGVhayB1bnRpbCBpZGxlCiAgICAgIH0KICAgIH0KCiAgICAvLyBBTFdBWVMgcmV0dXJuIHRydWUgdG8ga2VlcCB0aGUgcHJvY2Vzc29yIGFsaXZlIGZvciByZXVzZS4KICAgIHJldHVybiB0cnVlOwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoInBsYXliYWNrLXdvcmtsZXQiLCBQbGF5YmFja1dvcmtsZXQpOwo=", import.meta.url), Ye = {
2627
+ en: ht,
2628
+ de: mt,
2629
+ fr: gt,
2630
+ fi: ft,
2631
+ lt: bt
2632
+ }, oe = new x.Quaternion(), K = new x.Euler(), ke = new x.Vector3(), Ce = new x.Vector3(), Qe = new x.Box3();
2633
2633
  new x.Matrix4();
2634
2634
  new x.Matrix4();
2635
2635
  new x.Vector3();
2636
2636
  new x.Vector3(0, 0, 1);
2637
- const bt = new x.Vector3(1, 0, 0);
2637
+ const Rt = new x.Vector3(1, 0, 0);
2638
2638
  new x.Vector3(0, 1, 0);
2639
2639
  new x.Vector3(0, 0, 1);
2640
- class Ue {
2640
+ class Ze {
2641
2641
  /**
2642
2642
  * Avatar.
2643
2643
  * @typedef {Object} Avatar
@@ -2763,7 +2763,7 @@ class Ue {
2763
2763
  avatarOnlyCamera: null,
2764
2764
  statsNode: null,
2765
2765
  statsStyle: null
2766
- }, Object.assign(this.opt, e || {}), this.opt.statsNode && (this.stats = new nt(), 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 ot(), this.opt.statsStyle && (this.stats.dom.style.cssText = this.opt.statsStyle), this.opt.statsNode.appendChild(this.stats.dom)), this.poseTemplates = {
2767
2767
  side: {
2768
2768
  standing: !0,
2769
2769
  props: {
@@ -4086,7 +4086,7 @@ class Ue {
4086
4086
  this.opt.lightSpotDispersion
4087
4087
  ), this.setLighting(this.opt);
4088
4088
  const r = new x.PMREMGenerator(this.renderer);
4089
- r.compileEquirectangularShader(), this.scene.environment = r.fromScene(new tt()).texture, this.resizeobserver = new ResizeObserver(this.onResize.bind(this)), this.resizeobserver.observe(this.nodeAvatar), this.controls = new $e(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;
4089
+ r.compileEquirectangularShader(), this.scene.environment = r.fromScene(new it()).texture, this.resizeobserver = new ResizeObserver(this.onResize.bind(this)), this.resizeobserver.observe(this.nodeAvatar), this.controls = new et(this.camera, this.renderer.domElement), this.controls.enableZoom = this.opt.cameraZoomEnable, this.controls.enableRotate = this.opt.cameraRotateEnable, this.controls.enablePan = this.opt.cameraPanEnable, this.controls.minDistance = 2, this.controls.maxDistance = 2e3, this.controls.autoRotateSpeed = 0, this.controls.autoRotate = !1, this.controls.update(), this.cameraClock = null;
4090
4090
  }
4091
4091
  this.ikMesh = new x.SkinnedMesh();
4092
4092
  const s = {
@@ -4104,14 +4104,14 @@ class Ue {
4104
4104
  Object.entries(s).forEach((r, u) => {
4105
4105
  const a = new x.Bone();
4106
4106
  a.name = r[0], r[1] ? this.ikMesh.getObjectByName(r[1]).add(a) : this.ikMesh.add(a), o.push(a);
4107
- }), this.ikMesh.bind(new x.Skeleton(o)), this.dynamicbones = new at(), this.isStreaming = !1, this.streamWorkletNode = null, this.streamAudioStartTime = null, this.streamWaitForAudioChunks = !0, this.streamLipsyncLang = null, this.streamLipsyncType = "visemes", this.streamLipsyncQueue = [];
4107
+ }), this.ikMesh.bind(new x.Skeleton(o)), this.dynamicbones = new lt(), this.isStreaming = !1, this.streamWorkletNode = null, this.streamAudioStartTime = null, this.streamWaitForAudioChunks = !0, this.streamLipsyncLang = null, this.streamLipsyncType = "visemes", this.streamLipsyncQueue = [];
4108
4108
  }
4109
4109
  /**
4110
4110
  * Helper that re/creates the audio context and the other nodes.
4111
4111
  * @param {number} sampleRate
4112
4112
  */
4113
4113
  initAudioGraph(t = null) {
4114
- if (this.audioCtx && this.audioCtx.state !== "closed" && this.audioCtx.close(), t ? this.audioCtx = new AudioContext({ sampleRate: t }) : this.audioCtx = new AudioContext(), this.audioSpeechSource = this.audioCtx.createBufferSource(), this.audioBackgroundSource = this.audioCtx.createBufferSource(), this.audioBackgroundGainNode = this.audioCtx.createGain(), this.audioSpeechGainNode = this.audioCtx.createGain(), this.audioStreamGainNode = this.audioCtx.createGain(), this.audioAnalyzerNode = this.audioCtx.createAnalyser(), this.audioAnalyzerNode.fftSize = 256, this.audioAnalyzerNode.smoothingTimeConstant = 0.1, this.audioAnalyzerNode.minDecibels = -70, this.audioAnalyzerNode.maxDecibels = -10, this.audioAnalyzer = new rt(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(
4114
+ if (this.audioCtx && this.audioCtx.state !== "closed" && this.audioCtx.close(), t ? this.audioCtx = new AudioContext({ sampleRate: t }) : this.audioCtx = new AudioContext(), this.audioSpeechSource = this.audioCtx.createBufferSource(), this.audioBackgroundSource = this.audioCtx.createBufferSource(), this.audioBackgroundGainNode = this.audioCtx.createGain(), this.audioSpeechGainNode = this.audioCtx.createGain(), this.audioStreamGainNode = this.audioCtx.createGain(), this.audioAnalyzerNode = this.audioCtx.createAnalyser(), this.audioAnalyzerNode.fftSize = 256, this.audioAnalyzerNode.smoothingTimeConstant = 0.1, this.audioAnalyzerNode.minDecibels = -70, this.audioAnalyzerNode.maxDecibels = -10, this.audioAnalyzer = new ct(this.audioCtx), this.audioReverbNode = this.audioCtx.createConvolver(), this.audioBackgroundGainNode.connect(this.audioReverbNode), this.audioAnalyzerNode.connect(this.audioSpeechGainNode), this.audioSpeechGainNode.connect(this.audioReverbNode), this.audioStreamGainNode.connect(this.audioReverbNode), this.audioReverbNode.connect(this.audioCtx.destination), this.setReverb(this.currentReverb || null), this.setMixerGain(
4115
4115
  this.opt.mixerGainSpeech,
4116
4116
  this.opt.mixerGainBackground
4117
4117
  ), this.workletLoaded = !1, this.streamWorkletNode) {
@@ -4228,13 +4228,13 @@ class Ue {
4228
4228
  const l = s.morphTargetDictionary[a], d = o.morphAttributes.position[l], h = o.morphAttributes.normal?.[l];
4229
4229
  r || (r = new x.Float32BufferAttribute(d.count * 3, 3), h && (u = new x.Float32BufferAttribute(d.count * 3, 3)));
4230
4230
  for (let p = 0; p < d.count; p++) {
4231
- const b = r.getX(p) + d.getX(p) * c, f = r.getY(p) + d.getY(p) * c, S = r.getZ(p) + d.getZ(p) * c;
4232
- r.setXYZ(p, b, f, S);
4231
+ const b = r.getX(p) + d.getX(p) * c, f = r.getY(p) + d.getY(p) * c, k = r.getZ(p) + d.getZ(p) * c;
4232
+ r.setXYZ(p, b, f, k);
4233
4233
  }
4234
4234
  if (h)
4235
4235
  for (let p = 0; p < d.count; p++) {
4236
- const b = u.getX(p) + h.getX(p) * c, f = u.getY(p) + h.getY(p) * c, S = u.getZ(p) + h.getZ(p) * c;
4237
- u.setXYZ(p, b, f, S);
4236
+ const b = u.getX(p) + h.getX(p) * c, f = u.getY(p) + h.getY(p) * c, k = u.getZ(p) + h.getZ(p) * c;
4237
+ u.setXYZ(p, b, f, k);
4238
4238
  }
4239
4239
  }
4240
4240
  if (r) {
@@ -4252,9 +4252,9 @@ class Ue {
4252
4252
  async showAvatar(t, e = null) {
4253
4253
  if (!t || !t.hasOwnProperty("url"))
4254
4254
  throw new Error("Invalid parameter. The avatar must have at least 'url' specified.");
4255
- const n = new Je();
4255
+ const n = new tt();
4256
4256
  if (this.dracoEnabled) {
4257
- const a = new et();
4257
+ const a = new nt();
4258
4258
  a.setDecoderPath(this.dracoDecoderPath), n.setDRACOLoader(a);
4259
4259
  }
4260
4260
  let i = await n.loadAsync(t.url, e);
@@ -4412,9 +4412,9 @@ class Ue {
4412
4412
  updatePoseDelta() {
4413
4413
  for (const [t, e] of Object.entries(this.poseDelta.props)) {
4414
4414
  if (e.x === 0 && e.y === 0 && e.z === 0) continue;
4415
- _.set(e.x, e.y, e.z);
4415
+ K.set(e.x, e.y, e.z);
4416
4416
  const n = this.poseAvatar.props[t];
4417
- n.isQuaternion ? (oe.setFromEuler(_), n.multiply(oe)) : n.isVector3 && n.add(_);
4417
+ n.isQuaternion ? (oe.setFromEuler(K), n.multiply(oe)) : n.isVector3 && n.add(K);
4418
4418
  }
4419
4419
  }
4420
4420
  /**
@@ -5186,7 +5186,7 @@ class Ue {
5186
5186
  }, i.x ? new x.Vector3(i.x, i.y, i.z) : null, !0, i.d);
5187
5187
  break;
5188
5188
  }
5189
- if ((u || a) && (_.setFromQuaternion(this.poseAvatar.props["Head.quaternion"]), _.x = Math.max(-0.9, Math.min(0.9, 2 * _.x - 0.5)), _.y = Math.max(-0.9, Math.min(0.9, -2.5 * _.y)), u ? (Object.assign(this.mtAvatar.eyesLookDown, { system: _.x < 0 ? -_.x : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyesLookUp, { system: _.x < 0 ? 0 : _.x, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInLeft, { system: _.y < 0 ? -_.y : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutLeft, { system: _.y < 0 ? 0 : _.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInRight, { system: _.y < 0 ? 0 : _.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutRight, { system: _.y < 0 ? -_.y : 0, needsUpdate: !0 }), a && (n = -this.mtAvatar.bodyRotateY.value, i = this.gaussianRandom(-0.2, 0.2), this.animQueue.push(this.animFactory({
5189
+ if ((u || a) && (K.setFromQuaternion(this.poseAvatar.props["Head.quaternion"]), K.x = Math.max(-0.9, Math.min(0.9, 2 * K.x - 0.5)), K.y = Math.max(-0.9, Math.min(0.9, -2.5 * K.y)), u ? (Object.assign(this.mtAvatar.eyesLookDown, { system: K.x < 0 ? -K.x : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyesLookUp, { system: K.x < 0 ? 0 : K.x, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInLeft, { system: K.y < 0 ? -K.y : 0, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutLeft, { system: K.y < 0 ? 0 : K.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookInRight, { system: K.y < 0 ? 0 : K.y, needsUpdate: !0 }), Object.assign(this.mtAvatar.eyeLookOutRight, { system: K.y < 0 ? -K.y : 0, needsUpdate: !0 }), a && (n = -this.mtAvatar.bodyRotateY.value, i = this.gaussianRandom(-0.2, 0.2), this.animQueue.push(this.animFactory({
5190
5190
  name: "headmove",
5191
5191
  dt: [[1e3, 2e3], [1e3, 2e3, 1, 2], [1e3, 2e3], [1e3, 2e3, 1, 2]],
5192
5192
  vs: {
@@ -5207,7 +5207,7 @@ class Ue {
5207
5207
  eyeLookOutRight: [null, 0],
5208
5208
  eyeContact: [0]
5209
5209
  }
5210
- })))), e > 2 * this.animFrameDur && (e = 2 * this.animFrameDur), (this.viewName !== "full" || this.isAvatarOnly) && (n = this.mtRandomized[Math.floor(Math.random() * this.mtRandomized.length)], i = this.mtAvatar[n], i.needsUpdate || Object.assign(i, { base: (this.mood.baseline[n] || 0) + (1 + r / 255) * Math.random() / 5, needsUpdate: !0 })), this.updatePoseBase(this.animClock), this.mixer && this.mixer.update(e / 1e3 * this.mixer.timeScale), this.updatePoseDelta(), this.applyShoulderAdjustmentToBones(), (this.isSpeaking || this.isListening) && u ? r > this.volumeMax ? (this.volumeHeadBase = 0.05, Math.random() > 0.6 && (this.volumeHeadTarget = -0.05 - Math.random() / 15), this.volumeMax = r) : (this.volumeMax *= 0.92, this.volumeHeadTarget = this.volumeHeadBase - 0.9 * (this.volumeHeadBase - this.volumeHeadTarget)) : (this.volumeHeadTarget = 0, this.volumeMax = 0), n = this.volumeHeadTarget - this.volumeHeadCurrent, i = Math.abs(n), i > 1e-4 && (o = i * (this.volumeHeadEasing(Math.min(1, this.volumeHeadVelocity * e / 1e3 / i) / 2 + 0.5) - 0.5), this.volumeHeadCurrent += Math.sign(n) * Math.min(i, o)), Math.abs(this.volumeHeadCurrent) > 1e-4 && (oe.setFromAxisAngle(bt, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(oe)), Xe.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(Le), Le.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(Se), Se.sub(this.armature.position), this.objectHips.position.y -= Xe.min.y / 2, this.objectHips.position.x -= (Le.x + Se.x) / 4, this.objectHips.position.z -= (Le.z + Se.z) / 2, this.dynamicbones.update(e), this.fbxAnimationLoader && this.fbxAnimationLoader.update(), this.opt.update && this.opt.update(e), this.updateMorphTargets(e), this.isAvatarOnly)
5210
+ })))), e > 2 * this.animFrameDur && (e = 2 * this.animFrameDur), (this.viewName !== "full" || this.isAvatarOnly) && (n = this.mtRandomized[Math.floor(Math.random() * this.mtRandomized.length)], i = this.mtAvatar[n], i.needsUpdate || Object.assign(i, { base: (this.mood.baseline[n] || 0) + (1 + r / 255) * Math.random() / 5, needsUpdate: !0 })), this.updatePoseBase(this.animClock), this.mixer && this.mixer.update(e / 1e3 * this.mixer.timeScale), this.updatePoseDelta(), this.applyShoulderAdjustmentToBones(), (this.isSpeaking || this.isListening) && u ? r > this.volumeMax ? (this.volumeHeadBase = 0.05, Math.random() > 0.6 && (this.volumeHeadTarget = -0.05 - Math.random() / 15), this.volumeMax = r) : (this.volumeMax *= 0.92, this.volumeHeadTarget = this.volumeHeadBase - 0.9 * (this.volumeHeadBase - this.volumeHeadTarget)) : (this.volumeHeadTarget = 0, this.volumeMax = 0), n = this.volumeHeadTarget - this.volumeHeadCurrent, i = Math.abs(n), i > 1e-4 && (o = i * (this.volumeHeadEasing(Math.min(1, this.volumeHeadVelocity * e / 1e3 / i) / 2 + 0.5) - 0.5), this.volumeHeadCurrent += Math.sign(n) * Math.min(i, o)), Math.abs(this.volumeHeadCurrent) > 1e-4 && (oe.setFromAxisAngle(Rt, this.volumeHeadCurrent), this.objectNeck.quaternion.multiply(oe)), Qe.setFromObject(this.armature), this.objectLeftToeBase.getWorldPosition(ke), ke.sub(this.armature.position), this.objectRightToeBase.getWorldPosition(Ce), Ce.sub(this.armature.position), this.objectHips.position.y -= Qe.min.y / 2, this.objectHips.position.x -= (ke.x + Ce.x) / 4, this.objectHips.position.z -= (ke.z + Ce.z) / 2, this.dynamicbones.update(e), this.fbxAnimationLoader && this.fbxAnimationLoader.update(), this.opt.update && this.opt.update(e), this.updateMorphTargets(e), this.isAvatarOnly)
5211
5211
  this.stats && this.stats.end();
5212
5212
  else {
5213
5213
  if (this.cameraClock !== null && this.cameraClock < 1e3) {
@@ -5238,8 +5238,8 @@ class Ue {
5238
5238
  if (!this.lipsync.hasOwnProperty(t)) {
5239
5239
  const n = t.toLowerCase(), i = "Lipsync" + t.charAt(0).toUpperCase() + t.slice(1);
5240
5240
  try {
5241
- const s = Ze[n];
5242
- s && s[i] ? (this.lipsync[t] = new s[i](), console.log(`Loaded lip-sync module for ${t}`)) : console.warn(`Lip-sync module for ${t} not found. Available modules:`, Object.keys(Ze));
5241
+ const s = Ye[n];
5242
+ s && s[i] ? (this.lipsync[t] = new s[i](), console.log(`Loaded lip-sync module for ${t}`)) : console.warn(`Lip-sync module for ${t} not found. Available modules:`, Object.keys(Ye));
5243
5243
  } catch (s) {
5244
5244
  console.warn(`Failed to load lip-sync module for ${t}:`, s);
5245
5245
  }
@@ -5278,10 +5278,10 @@ class Ue {
5278
5278
  let c = "", l = "", d = 0, h = [], p = [];
5279
5279
  const b = Array.from(this.segmenter.segment(t), (f) => f.segment);
5280
5280
  for (let f = 0; f < b.length; f++) {
5281
- const S = f === b.length - 1, B = b[f].match(r);
5281
+ const k = f === b.length - 1, T = b[f].match(r);
5282
5282
  let g = b[f].match(s);
5283
- const D = b[f].match(u), T = b[f].match(o);
5284
- if (g && !S && !D && b[f + 1].match(s) && (g = !1), n && (c += b[f]), B && (!i || i.every((I) => f < I[0] || f > I[1])) && (l += b[f]), (T || g || S) && (l.length && (l = this.lipsyncPreProcessText(l, a), l.length && h.push({
5283
+ const N = b[f].match(u), F = b[f].match(o);
5284
+ if (g && !k && !N && b[f + 1].match(s) && (g = !1), n && (c += b[f]), T && (!i || i.every((I) => f < I[0] || f > I[1])) && (l += b[f]), (F || g || k) && (l.length && (l = this.lipsyncPreProcessText(l, a), l.length && h.push({
5285
5285
  mark: d,
5286
5286
  word: l
5287
5287
  })), c.length && (p.push({
@@ -5294,27 +5294,27 @@ class Ue {
5294
5294
  }), c = ""), l.length)) {
5295
5295
  const I = this.lipsyncWordsToVisemes(l, a);
5296
5296
  if (I && I.visemes && I.visemes.length) {
5297
- const N = I.times[I.visemes.length - 1] + I.durations[I.visemes.length - 1];
5298
- for (let L = 0; L < I.visemes.length; L++)
5297
+ const U = I.times[I.visemes.length - 1] + I.durations[I.visemes.length - 1];
5298
+ for (let S = 0; S < I.visemes.length; S++)
5299
5299
  p.push({
5300
5300
  mark: d,
5301
5301
  template: { name: "viseme" },
5302
- ts: [(I.times[L] - 0.6) / N, (I.times[L] + 0.5) / N, (I.times[L] + I.durations[L] + 0.5) / N],
5302
+ ts: [(I.times[S] - 0.6) / U, (I.times[S] + 0.5) / U, (I.times[S] + I.durations[S] + 0.5) / U],
5303
5303
  vs: {
5304
- ["viseme_" + I.visemes[L]]: [null, I.visemes[L] === "PP" || I.visemes[L] === "FF" ? 0.9 : 0.6, 0]
5304
+ ["viseme_" + I.visemes[S]]: [null, I.visemes[S] === "PP" || I.visemes[S] === "FF" ? 0.9 : 0.6, 0]
5305
5305
  }
5306
5306
  });
5307
5307
  }
5308
5308
  l = "", d++;
5309
5309
  }
5310
- if (g || S) {
5311
- if (h.length || S && p.length) {
5310
+ if (g || k) {
5311
+ if (h.length || k && p.length) {
5312
5312
  const I = {
5313
5313
  anim: p
5314
5314
  };
5315
5315
  n && (I.onSubtitles = n), h.length && !e.avatarMute && (I.text = h, 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), h = [], l = "", d = 0, p = [];
5316
5316
  }
5317
- if (D) {
5317
+ if (N) {
5318
5318
  let I = this.animEmojis[b[f]];
5319
5319
  I && I.link && (I = this.animEmojis[I.link]), I && this.speechQueue.push({ emoji: I });
5320
5320
  }
@@ -5412,10 +5412,10 @@ class Ue {
5412
5412
  let b = 0.6 + this.convertRange(p, [0, c], [0, 0.4]);
5413
5413
  if (c = Math.min(c, d.visemes.length * 200), h > 0)
5414
5414
  for (let f = 0; f < d.visemes.length; f++) {
5415
- const S = a + d.times[f] / h * c, B = d.durations[f] / h * c;
5415
+ const k = a + d.times[f] / h * c, T = d.durations[f] / h * c;
5416
5416
  o.push({
5417
5417
  template: { name: "viseme" },
5418
- ts: [S - Math.min(60, 2 * B / 3), S + Math.min(25, B / 2), S + B + Math.min(60, B / 2)],
5418
+ ts: [k - Math.min(60, 2 * T / 3), k + Math.min(25, T / 2), k + T + Math.min(60, T / 2)],
5419
5419
  vs: {
5420
5420
  ["viseme_" + d.visemes[f]]: [null, d.visemes[f] === "PP" || d.visemes[f] === "FF" ? 0.9 : b, 0]
5421
5421
  }
@@ -5497,7 +5497,7 @@ class Ue {
5497
5497
  s.lang = o, s.rate = Math.max(0.1, Math.min(10, r)), s.pitch = Math.max(0, Math.min(2, u)), s.volume = Math.max(0, Math.min(1, a));
5498
5498
  const c = speechSynthesis.getVoices(), l = t.voice || this.avatar.ttsVoice || this.opt.ttsVoice;
5499
5499
  if (l && c.length > 0) {
5500
- const g = c.find((D) => D.name.includes(l) || D.lang === o);
5500
+ const g = c.find((N) => N.name.includes(l) || N.lang === o);
5501
5501
  g && (s.voice = g);
5502
5502
  }
5503
5503
  const d = i.length * 100 / s.rate, h = this.audioCtx.createBuffer(1, this.audioCtx.sampleRate * (d / 1e3), this.audioCtx.sampleRate), p = this.avatar.lipsyncLang || this.opt.lipsyncLang || "en", b = this.lipsyncPreProcessText(i, p), f = this.lipsyncWordsToVisemes(b, p);
@@ -5509,22 +5509,22 @@ class Ue {
5509
5509
  hasVisemes: f && f.visemes && f.visemes.length > 0,
5510
5510
  estimatedDuration: d
5511
5511
  });
5512
- const S = [];
5512
+ const k = [];
5513
5513
  if (f && f.visemes && f.visemes.length > 0) {
5514
5514
  const g = f.times[f.visemes.length - 1] + f.durations[f.visemes.length - 1];
5515
- for (let D = 0; D < f.visemes.length; D++) {
5516
- const T = f.visemes[D], I = f.times[D] / g, N = f.durations[D] / g, L = I * d, R = N * d;
5517
- S.push({
5515
+ for (let N = 0; N < f.visemes.length; N++) {
5516
+ const F = f.visemes[N], I = f.times[N] / g, U = f.durations[N] / g, S = I * d, R = U * d;
5517
+ k.push({
5518
5518
  template: { name: "viseme" },
5519
- ts: [L - Math.min(60, 2 * R / 3), L + Math.min(25, R / 2), L + R + Math.min(60, R / 2)],
5519
+ ts: [S - Math.min(60, 2 * R / 3), S + Math.min(25, R / 2), S + R + Math.min(60, R / 2)],
5520
5520
  vs: {
5521
- ["viseme_" + T]: [null, T === "PP" || T === "FF" ? 0.9 : 0.6, 0]
5521
+ ["viseme_" + F]: [null, F === "PP" || F === "FF" ? 0.9 : 0.6, 0]
5522
5522
  }
5523
5523
  });
5524
5524
  }
5525
5525
  }
5526
- const B = [...t.anim, ...S];
5527
- this.audioPlaylist.push({ anim: B, audio: h }), this.onSubtitles = t.onSubtitles || null, this.resetLips(), t.mood && this.setMood(t.mood), this.playAudio(), s.onend = () => {
5526
+ const T = [...t.anim, ...k];
5527
+ this.audioPlaylist.push({ anim: T, audio: h }), this.onSubtitles = t.onSubtitles || null, this.resetLips(), t.mood && this.setMood(t.mood), this.playAudio(), s.onend = () => {
5528
5528
  e();
5529
5529
  }, s.onerror = (g) => {
5530
5530
  console.error("Speech synthesis error:", g.error), n(g.error);
@@ -5591,8 +5591,8 @@ class Ue {
5591
5591
  const h = e.toLowerCase().split(/\s+/), p = [];
5592
5592
  for (const b of h)
5593
5593
  for (const f of b) {
5594
- let S = "aa";
5595
- "aeiou".includes(f) ? S = "aa" : "bp".includes(f) ? S = "PP" : "fv".includes(f) ? S = "FF" : "st".includes(f) ? S = "SS" : "dln".includes(f) ? S = "DD" : "kg".includes(f) ? S = "kk" : "rw".includes(f) && (S = "RR"), p.push(S);
5594
+ let k = "aa";
5595
+ "aeiou".includes(f) ? k = "aa" : "bp".includes(f) ? k = "PP" : "fv".includes(f) ? k = "FF" : "st".includes(f) ? k = "SS" : "dln".includes(f) ? k = "DD" : "kg".includes(f) ? k = "kk" : "rw".includes(f) && (k = "RR"), p.push(k);
5596
5596
  }
5597
5597
  a = {
5598
5598
  visemes: p.map((b, f) => ({
@@ -5689,8 +5689,8 @@ class Ue {
5689
5689
  const h = e.toLowerCase().split(/\s+/), p = [];
5690
5690
  for (const b of h)
5691
5691
  for (const f of b) {
5692
- let S = "aa";
5693
- "aeiou".includes(f) ? S = "aa" : "bp".includes(f) ? S = "PP" : "fv".includes(f) ? S = "FF" : "st".includes(f) ? S = "SS" : "dln".includes(f) ? S = "DD" : "kg".includes(f) ? S = "kk" : "rw".includes(f) && (S = "RR"), p.push(S);
5692
+ let k = "aa";
5693
+ "aeiou".includes(f) ? k = "aa" : "bp".includes(f) ? k = "PP" : "fv".includes(f) ? k = "FF" : "st".includes(f) ? k = "SS" : "dln".includes(f) ? k = "DD" : "kg".includes(f) ? k = "kk" : "rw".includes(f) && (k = "RR"), p.push(k);
5694
5694
  }
5695
5695
  a = {
5696
5696
  visemes: p.map((b, f) => ({
@@ -5922,7 +5922,7 @@ class Ue {
5922
5922
  }
5923
5923
  if (!this.workletLoaded)
5924
5924
  try {
5925
- const r = this.audioCtx.audioWorklet.addModule(xt.href), u = new Promise(
5925
+ const r = this.audioCtx.audioWorklet.addModule(vt.href), u = new Promise(
5926
5926
  (a, c) => setTimeout(() => c(new Error("Worklet loading timed out")), 5e3)
5927
5927
  );
5928
5928
  await Promise.race([r, u]), this.workletLoaded = !0;
@@ -6160,7 +6160,7 @@ class Ue {
6160
6160
  */
6161
6161
  lookAtCamera(t) {
6162
6162
  let e;
6163
- if (this.speakTo && (e = new x.Vector3(), this.speakTo.objectLeftEye?.isObject3D ? (this.speakTo.armature.objectHead, this.speakTo.objectLeftEye.updateMatrixWorld(!0), this.speakTo.objectRightEye.updateMatrixWorld(!0), Le.setFromMatrixPosition(this.speakTo.objectLeftEye.matrixWorld), Se.setFromMatrixPosition(this.speakTo.objectRightEye.matrixWorld), e.addVectors(Le, Se).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) {
6163
+ if (this.speakTo && (e = new x.Vector3(), this.speakTo.objectLeftEye?.isObject3D ? (this.speakTo.armature.objectHead, this.speakTo.objectLeftEye.updateMatrixWorld(!0), this.speakTo.objectRightEye.updateMatrixWorld(!0), ke.setFromMatrixPosition(this.speakTo.objectLeftEye.matrixWorld), Ce.setFromMatrixPosition(this.speakTo.objectRightEye.matrixWorld), e.addVectors(ke, Ce).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) {
6164
6164
  if (this.avatar.hasOwnProperty("avatarIgnoreCamera")) {
6165
6165
  if (this.avatar.avatarIgnoreCamera) {
6166
6166
  this.lookAhead(t);
@@ -6173,14 +6173,14 @@ class Ue {
6173
6173
  this.lookAt(null, null, t);
6174
6174
  return;
6175
6175
  }
6176
- this.objectLeftEye.updateMatrixWorld(!0), this.objectRightEye.updateMatrixWorld(!0), Le.setFromMatrixPosition(this.objectLeftEye.matrixWorld), Se.setFromMatrixPosition(this.objectRightEye.matrixWorld), Le.add(Se).divideScalar(2), oe.copy(this.armature.quaternion), oe.multiply(this.poseTarget.props["Hips.quaternion"]), oe.multiply(this.poseTarget.props["Spine.quaternion"]), oe.multiply(this.poseTarget.props["Spine1.quaternion"]), oe.multiply(this.poseTarget.props["Spine2.quaternion"]), oe.multiply(this.poseTarget.props["Neck.quaternion"]), oe.multiply(this.poseTarget.props["Head.quaternion"]);
6177
- const n = new x.Vector3().subVectors(e, Le).normalize(), i = Math.atan2(n.x, n.z), s = Math.asin(-n.y);
6178
- _.set(s, i, 0, "YXZ");
6179
- const r = new x.Quaternion().setFromEuler(_), u = new x.Quaternion().copy(r).multiply(oe.clone().invert());
6180
- _.setFromQuaternion(u, "YXZ");
6181
- let a = _.x / (40 / 24) + 0.2, c = _.y / (9 / 4), l = Math.min(0.6, Math.max(-0.3, a)), d = Math.min(0.8, Math.max(-0.8, c)), h = (Math.random() - 0.5) / 4, p = (Math.random() - 0.5) / 4;
6176
+ this.objectLeftEye.updateMatrixWorld(!0), this.objectRightEye.updateMatrixWorld(!0), ke.setFromMatrixPosition(this.objectLeftEye.matrixWorld), Ce.setFromMatrixPosition(this.objectRightEye.matrixWorld), ke.add(Ce).divideScalar(2), oe.copy(this.armature.quaternion), oe.multiply(this.poseTarget.props["Hips.quaternion"]), oe.multiply(this.poseTarget.props["Spine.quaternion"]), oe.multiply(this.poseTarget.props["Spine1.quaternion"]), oe.multiply(this.poseTarget.props["Spine2.quaternion"]), oe.multiply(this.poseTarget.props["Neck.quaternion"]), oe.multiply(this.poseTarget.props["Head.quaternion"]);
6177
+ const n = new x.Vector3().subVectors(e, ke).normalize(), i = Math.atan2(n.x, n.z), s = Math.asin(-n.y);
6178
+ K.set(s, i, 0, "YXZ");
6179
+ const r = new x.Quaternion().setFromEuler(K), u = new x.Quaternion().copy(r).multiply(oe.clone().invert());
6180
+ K.setFromQuaternion(u, "YXZ");
6181
+ let a = K.x / (40 / 24) + 0.2, c = K.y / (9 / 4), l = Math.min(0.6, Math.max(-0.3, a)), d = Math.min(0.8, Math.max(-0.8, c)), h = (Math.random() - 0.5) / 4, p = (Math.random() - 0.5) / 4;
6182
6182
  if (t) {
6183
- let b = this.animQueue.findIndex((S) => S.template.name === "lookat");
6183
+ let b = this.animQueue.findIndex((k) => k.template.name === "lookat");
6184
6184
  b !== -1 && this.animQueue.splice(b, 1);
6185
6185
  const f = {
6186
6186
  name: "lookat",
@@ -6213,20 +6213,20 @@ class Ue {
6213
6213
  const s = new x.Vector3().setFromMatrixPosition(this.objectLeftEye.matrixWorld), o = new x.Vector3().setFromMatrixPosition(this.objectRightEye.matrixWorld), r = new x.Vector3().addVectors(s, o).divideScalar(2);
6214
6214
  r.project(this.camera);
6215
6215
  let u = (r.x + 1) / 2 * i.width + i.left, a = -(r.y - 1) / 2 * i.height + i.top;
6216
- t === null && (t = u), e === null && (e = a), oe.copy(this.armature.quaternion), oe.multiply(this.poseTarget.props["Hips.quaternion"]), oe.multiply(this.poseTarget.props["Spine.quaternion"]), oe.multiply(this.poseTarget.props["Spine1.quaternion"]), oe.multiply(this.poseTarget.props["Spine2.quaternion"]), oe.multiply(this.poseTarget.props["Neck.quaternion"]), oe.multiply(this.poseTarget.props["Head.quaternion"]), _.setFromQuaternion(oe);
6217
- let c = _.x / (40 / 24), l = _.y / (9 / 4), d = Math.min(0.4, Math.max(-0.4, this.camera.rotation.x)), h = Math.min(0.4, Math.max(-0.4, this.camera.rotation.y)), p = Math.max(window.innerWidth - u, u), b = Math.max(window.innerHeight - a, a), f = this.convertRange(e, [a - b, a + b], [-0.3, 0.6]) - c + d, S = this.convertRange(t, [u - p, u + p], [-0.8, 0.8]) - l + h;
6218
- f = Math.min(0.6, Math.max(-0.3, f)), S = Math.min(0.8, Math.max(-0.8, S));
6219
- let B = (Math.random() - 0.5) / 4, g = (Math.random() - 0.5) / 4;
6216
+ t === null && (t = u), e === null && (e = a), oe.copy(this.armature.quaternion), oe.multiply(this.poseTarget.props["Hips.quaternion"]), oe.multiply(this.poseTarget.props["Spine.quaternion"]), oe.multiply(this.poseTarget.props["Spine1.quaternion"]), oe.multiply(this.poseTarget.props["Spine2.quaternion"]), oe.multiply(this.poseTarget.props["Neck.quaternion"]), oe.multiply(this.poseTarget.props["Head.quaternion"]), K.setFromQuaternion(oe);
6217
+ let c = K.x / (40 / 24), l = K.y / (9 / 4), d = Math.min(0.4, Math.max(-0.4, this.camera.rotation.x)), h = Math.min(0.4, Math.max(-0.4, this.camera.rotation.y)), p = Math.max(window.innerWidth - u, u), b = Math.max(window.innerHeight - a, a), f = this.convertRange(e, [a - b, a + b], [-0.3, 0.6]) - c + d, k = this.convertRange(t, [u - p, u + p], [-0.8, 0.8]) - l + h;
6218
+ f = Math.min(0.6, Math.max(-0.3, f)), k = Math.min(0.8, Math.max(-0.8, k));
6219
+ let T = (Math.random() - 0.5) / 4, g = (Math.random() - 0.5) / 4;
6220
6220
  if (n) {
6221
- let D = this.animQueue.findIndex((I) => I.template.name === "lookat");
6222
- D !== -1 && this.animQueue.splice(D, 1);
6223
- const T = {
6221
+ let N = this.animQueue.findIndex((I) => I.template.name === "lookat");
6222
+ N !== -1 && this.animQueue.splice(N, 1);
6223
+ const F = {
6224
6224
  name: "lookat",
6225
6225
  dt: [750, n],
6226
6226
  vs: {
6227
- bodyRotateX: [f + B],
6228
- bodyRotateY: [S + g],
6229
- eyesRotateX: [-3 * B + 0.1],
6227
+ bodyRotateX: [f + T],
6228
+ bodyRotateY: [k + g],
6229
+ eyesRotateX: [-3 * T + 0.1],
6230
6230
  eyesRotateY: [-5 * g],
6231
6231
  browInnerUp: [[0, 0.7]],
6232
6232
  mouthLeft: [[0, 0.7]],
@@ -6235,7 +6235,7 @@ class Ue {
6235
6235
  headMove: [0]
6236
6236
  }
6237
6237
  };
6238
- this.animQueue.push(this.animFactory(T));
6238
+ this.animQueue.push(this.animFactory(F));
6239
6239
  }
6240
6240
  }
6241
6241
  /**
@@ -6445,7 +6445,7 @@ class Ue {
6445
6445
  } catch (h) {
6446
6446
  console.warn(`Could not verify file existence for ${t}, attempting to load anyway:`, h);
6447
6447
  }
6448
- const l = new Ve();
6448
+ const l = new Xe();
6449
6449
  let d;
6450
6450
  try {
6451
6451
  d = await l.loadAsync(t, e);
@@ -6503,7 +6503,7 @@ class Ue {
6503
6503
  return "LeftShoulder";
6504
6504
  if (y.includes("right") && (y.includes("shoulder") || y.includes("clavicle")) && p.has("RightShoulder"))
6505
6505
  return "RightShoulder";
6506
- const M = {
6506
+ const E = {
6507
6507
  // Arm bones - exact matches
6508
6508
  LeftArm: "LeftArm",
6509
6509
  leftArm: "LeftArm",
@@ -6543,46 +6543,46 @@ class Ue {
6543
6543
  Root: "Hips",
6544
6544
  root: "Hips"
6545
6545
  };
6546
- if (M[z]) {
6547
- const O = M[z];
6548
- if (p.has(O))
6549
- return O;
6546
+ if (E[z]) {
6547
+ const D = E[z];
6548
+ if (p.has(D))
6549
+ return D;
6550
6550
  }
6551
- for (const O of p)
6552
- if (O.toLowerCase() === y)
6553
- return O;
6554
- for (const O of p) {
6555
- const E = O.toLowerCase();
6556
- if ((y.includes("left") && E.includes("left") || y.includes("right") && E.includes("right")) && (y.includes("arm") && E.includes("arm") && !E.includes("fore") || y.includes("forearm") && E.includes("forearm") || y.includes("hand") && E.includes("hand") && !E.includes("index") && !E.includes("thumb") || y.includes("shoulder") && E.includes("shoulder")))
6557
- return O;
6551
+ for (const D of p)
6552
+ if (D.toLowerCase() === y)
6553
+ return D;
6554
+ for (const D of p) {
6555
+ const B = D.toLowerCase();
6556
+ if ((y.includes("left") && B.includes("left") || y.includes("right") && B.includes("right")) && (y.includes("arm") && B.includes("arm") && !B.includes("fore") || y.includes("forearm") && B.includes("forearm") || y.includes("hand") && B.includes("hand") && !B.includes("index") && !B.includes("thumb") || y.includes("shoulder") && B.includes("shoulder")))
6557
+ return D;
6558
6558
  }
6559
6559
  return null;
6560
- }, S = /* @__PURE__ */ new Set();
6560
+ }, k = /* @__PURE__ */ new Set();
6561
6561
  h.tracks.forEach((R) => {
6562
6562
  const z = R.name.split(".");
6563
- S.add(z[0]);
6564
- }), console.log("=== Ready Player Me Animation Bone Analysis ==="), console.log("FBX bone names:", Array.from(S).sort().join(", ")), console.log("Avatar skeleton bone names:", Array.from(p).sort().join(", "));
6565
- const B = Array.from(S).filter(
6563
+ k.add(z[0]);
6564
+ }), console.log("=== Ready Player Me Animation Bone Analysis ==="), console.log("FBX bone names:", Array.from(k).sort().join(", ")), console.log("Avatar skeleton bone names:", Array.from(p).sort().join(", "));
6565
+ const T = Array.from(k).filter(
6566
6566
  (R) => R.toLowerCase().includes("arm") || R.toLowerCase().includes("hand") || R.toLowerCase().includes("shoulder")
6567
6567
  ), g = Array.from(p).filter(
6568
6568
  (R) => R.includes("Arm") || R.includes("Hand") || R.includes("Shoulder")
6569
6569
  );
6570
- console.log("FBX arm/hand/shoulder bones:", B.sort().join(", ")), console.log("Avatar arm/hand/shoulder bones:", g.sort().join(", "));
6571
- const D = [], T = /* @__PURE__ */ new Set();
6570
+ console.log("FBX arm/hand/shoulder bones:", T.sort().join(", ")), console.log("Avatar arm/hand/shoulder bones:", g.sort().join(", "));
6571
+ const N = [], F = /* @__PURE__ */ new Set();
6572
6572
  let I = 0;
6573
6573
  if (h.tracks.forEach((R) => {
6574
- const y = R.name.replaceAll("mixamorig", "").split("."), M = y[0], O = y[1], E = f(M);
6575
- if (E && (E === "LeftShoulder" || E === "RightShoulder") && (O === "quaternion" || O === "rotation")) {
6574
+ const y = R.name.replaceAll("mixamorig", "").split("."), E = y[0], D = y[1], B = f(E);
6575
+ if (B && (B === "LeftShoulder" || B === "RightShoulder") && (D === "quaternion" || D === "rotation")) {
6576
6576
  I++;
6577
6577
  return;
6578
6578
  }
6579
- if (E && O) {
6580
- const j = `${E}.${O}`, ae = R.clone();
6581
- ae.name = j, D.push(ae), M !== E && b.set(M, E);
6579
+ if (B && D) {
6580
+ const Y = `${B}.${D}`, ae = R.clone();
6581
+ ae.name = Y, N.push(ae), E !== B && b.set(E, B);
6582
6582
  } else
6583
- T.add(M), (M.toLowerCase().includes("arm") || M.toLowerCase().includes("hand") || M.toLowerCase().includes("shoulder")) && console.warn(`⚠️ Arm bone "${M}" could not be mapped to avatar skeleton`);
6584
- }), I > 0 && console.log(`✓ Filtered out ${I} shoulder rotation track(s) to prevent high shoulders`), T.size > 0 && console.warn(`⚠️ ${T.size} bone(s) could not be mapped:`, Array.from(T).sort().join(", ")), D.length > 0) {
6585
- h = new x.AnimationClip(h.name, h.duration, D), console.log(`✓ Created animation with ${D.length} mapped tracks (from ${h.tracks.length} original tracks)`), b.size > 0 && console.log(
6583
+ F.add(E), (E.toLowerCase().includes("arm") || E.toLowerCase().includes("hand") || E.toLowerCase().includes("shoulder")) && console.warn(`⚠️ Arm bone "${E}" could not be mapped to avatar skeleton`);
6584
+ }), I > 0 && console.log(`✓ Filtered out ${I} shoulder rotation track(s) to prevent high shoulders`), F.size > 0 && console.warn(`⚠️ ${F.size} bone(s) could not be mapped:`, Array.from(F).sort().join(", ")), N.length > 0) {
6585
+ h = new x.AnimationClip(h.name, h.duration, N), console.log(`✓ Created animation with ${N.length} mapped tracks (from ${h.tracks.length} original tracks)`), b.size > 0 && console.log(
6586
6586
  `✓ Mapped ${b.size} bone(s):`,
6587
6587
  Array.from(b.entries()).map(([z, y]) => `${z}→${y}`).join(", ")
6588
6588
  );
@@ -6592,21 +6592,21 @@ class Ue {
6592
6592
  R.length > 0 ? console.log(`✓ Arm bones mapped: ${R.join(", ")}`) : console.warn("⚠️ No arm bones were mapped! This may cause arm rigging issues.");
6593
6593
  } else
6594
6594
  console.error("❌ No tracks could be mapped! Animation may not work correctly.");
6595
- const N = {};
6595
+ const U = {};
6596
6596
  h.tracks.forEach((R) => {
6597
6597
  R.name = R.name.replaceAll("mixamorig", "");
6598
6598
  const z = R.name.split(".");
6599
6599
  if (z[1] === "position") {
6600
6600
  for (let y = 0; y < R.values.length; y++)
6601
6601
  R.values[y] = R.values[y] * s;
6602
- N[R.name] = new x.Vector3(R.values[0], R.values[1], R.values[2]);
6603
- } else z[1] === "quaternion" ? N[R.name] = new x.Quaternion(R.values[0], R.values[1], R.values[2], R.values[3]) : z[1] === "rotation" && (N[z[0] + ".quaternion"] = new x.Quaternion().setFromEuler(new x.Euler(R.values[0], R.values[1], R.values[2], "XYZ")).normalize());
6602
+ U[R.name] = new x.Vector3(R.values[0], R.values[1], R.values[2]);
6603
+ } else z[1] === "quaternion" ? U[R.name] = new x.Quaternion(R.values[0], R.values[1], R.values[2], R.values[3]) : z[1] === "rotation" && (U[z[0] + ".quaternion"] = new x.Quaternion().setFromEuler(new x.Euler(R.values[0], R.values[1], R.values[2], "XYZ")).normalize());
6604
6604
  });
6605
- const L = { props: N };
6606
- N["Hips.position"] && (N["Hips.position"].y < 0.5 ? L.lying = !0 : L.standing = !0), this.animClips.push({
6605
+ const S = { props: U };
6606
+ U["Hips.position"] && (U["Hips.position"].y < 0.5 ? S.lying = !0 : S.standing = !0), this.animClips.push({
6607
6607
  url: t + "-" + i,
6608
6608
  clip: h,
6609
- pose: L
6609
+ pose: S
6610
6610
  }), this.playAnimation(t, e, n, i, s);
6611
6611
  } else {
6612
6612
  const h = "Animation " + t + " (ndx=" + i + ") not found";
@@ -6644,7 +6644,7 @@ class Ue {
6644
6644
  let r = this.animQueue.find((u) => u.template.name === "pose");
6645
6645
  r && (r.ts[0] = this.animClock + n * 1e3 + 2e3), this.setPoseFromTemplate(o);
6646
6646
  } else {
6647
- let u = await new Ve().loadAsync(t, e);
6647
+ let u = await new Xe().loadAsync(t, e);
6648
6648
  if (u && u.animations && u.animations[i]) {
6649
6649
  let a = u.animations[i];
6650
6650
  const c = {};
@@ -6699,7 +6699,7 @@ class Ue {
6699
6699
  const d = [];
6700
6700
  for (let b = 1; b < r.ts.length; b++) d.push(r.ts[b] - r.ts[b - 1]);
6701
6701
  const h = o.template?.rescale || d.map((b) => b / c), p = e * 1e3 - c;
6702
- r.ts = r.ts.map((b, f, S) => f === 0 ? u : S[f - 1] + d[f - 1] + h[f - 1] * p);
6702
+ r.ts = r.ts.map((b, f, k) => f === 0 ? u : k[f - 1] + d[f - 1] + h[f - 1] * p);
6703
6703
  } else {
6704
6704
  const d = e * 1e3 / c;
6705
6705
  r.ts = r.ts.map((h) => u + d * (h - u));
@@ -6735,18 +6735,18 @@ class Ue {
6735
6735
  const s = new x.Vector3(), o = new x.Vector3(), r = new x.Vector3(), u = new x.Vector3(), a = new x.Quaternion(), c = new x.Vector3(), l = new x.Vector3(), d = new x.Vector3(), h = this.ikMesh.getObjectByName(t.root);
6736
6736
  h.position.setFromMatrixPosition(this.armature.getObjectByName(t.root).matrixWorld), h.quaternion.setFromRotationMatrix(this.armature.getObjectByName(t.root).matrixWorld), e && n && e.applyQuaternion(this.armature.quaternion).add(h.position);
6737
6737
  const p = this.ikMesh.getObjectByName(t.effector), b = t.links;
6738
- b.forEach((S) => {
6739
- S.bone = this.ikMesh.getObjectByName(S.link), S.bone.quaternion.copy(this.getPoseTemplateProp(S.link + ".quaternion"));
6738
+ b.forEach((k) => {
6739
+ k.bone = this.ikMesh.getObjectByName(k.link), k.bone.quaternion.copy(this.getPoseTemplateProp(k.link + ".quaternion"));
6740
6740
  }), h.updateMatrixWorld(!0);
6741
6741
  const f = t.iterations || 10;
6742
6742
  if (e)
6743
- for (let S = 0; S < f; S++) {
6744
- let B = !1;
6745
- for (let g = 0, D = b.length; g < D; g++) {
6746
- const T = b[g].bone;
6747
- T.matrixWorld.decompose(u, a, c), a.invert(), o.setFromMatrixPosition(p.matrixWorld), r.subVectors(o, u), r.applyQuaternion(a), r.normalize(), s.subVectors(e, u), s.applyQuaternion(a), s.normalize();
6743
+ for (let k = 0; k < f; k++) {
6744
+ let T = !1;
6745
+ for (let g = 0, N = b.length; g < N; g++) {
6746
+ const F = b[g].bone;
6747
+ F.matrixWorld.decompose(u, a, c), a.invert(), o.setFromMatrixPosition(p.matrixWorld), r.subVectors(o, u), r.applyQuaternion(a), r.normalize(), s.subVectors(e, u), s.applyQuaternion(a), s.normalize();
6748
6748
  let I = s.dot(r);
6749
- I > 1 ? I = 1 : I < -1 && (I = -1), I = Math.acos(I), !(I < 1e-5) && (b[g].minAngle !== void 0 && I < b[g].minAngle && (I = b[g].minAngle), b[g].maxAngle !== void 0 && I > b[g].maxAngle && (I = b[g].maxAngle), l.crossVectors(r, s), l.normalize(), oe.setFromAxisAngle(l, I), T.quaternion.multiply(oe), T.rotation.setFromVector3(d.setFromEuler(T.rotation).clamp(new x.Vector3(
6749
+ I > 1 ? I = 1 : I < -1 && (I = -1), I = Math.acos(I), !(I < 1e-5) && (b[g].minAngle !== void 0 && I < b[g].minAngle && (I = b[g].minAngle), b[g].maxAngle !== void 0 && I > b[g].maxAngle && (I = b[g].maxAngle), l.crossVectors(r, s), l.normalize(), oe.setFromAxisAngle(l, I), F.quaternion.multiply(oe), F.rotation.setFromVector3(d.setFromEuler(F.rotation).clamp(new x.Vector3(
6750
6750
  b[g].minx !== void 0 ? b[g].minx : -1 / 0,
6751
6751
  b[g].miny !== void 0 ? b[g].miny : -1 / 0,
6752
6752
  b[g].minz !== void 0 ? b[g].minz : -1 / 0
@@ -6754,12 +6754,12 @@ class Ue {
6754
6754
  b[g].maxx !== void 0 ? b[g].maxx : 1 / 0,
6755
6755
  b[g].maxy !== void 0 ? b[g].maxy : 1 / 0,
6756
6756
  b[g].maxz !== void 0 ? b[g].maxz : 1 / 0
6757
- ))), T.updateMatrixWorld(!0), B = !0);
6757
+ ))), F.updateMatrixWorld(!0), T = !0);
6758
6758
  }
6759
- if (!B) break;
6759
+ if (!T) break;
6760
6760
  }
6761
- i && b.forEach((S) => {
6762
- this.poseTarget.props[S.link + ".quaternion"].copy(S.bone.quaternion), this.poseTarget.props[S.link + ".quaternion"].t = this.animClock, this.poseTarget.props[S.link + ".quaternion"].d = i;
6761
+ i && b.forEach((k) => {
6762
+ this.poseTarget.props[k.link + ".quaternion"].copy(k.bone.quaternion), this.poseTarget.props[k.link + ".quaternion"].t = this.animClock, this.poseTarget.props[k.link + ".quaternion"].d = i;
6763
6763
  });
6764
6764
  }
6765
6765
  /**
@@ -6769,7 +6769,7 @@ class Ue {
6769
6769
  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();
6770
6770
  }
6771
6771
  }
6772
- const ke = {
6772
+ const ze = {
6773
6773
  apiKey: "sk_ace57ef3ef65a92b9d3bee2a00183b78ca790bc3e10964f2",
6774
6774
  // Replace with your actual API key (should start with sk_)
6775
6775
  endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
@@ -6789,7 +6789,7 @@ const ke = {
6789
6789
  josh: "VR6AewLTigWG4xSOukaG"
6790
6790
  // Male, American
6791
6791
  }
6792
- }, Pe = {
6792
+ }, De = {
6793
6793
  defaultVoice: "aura-2-thalia-en",
6794
6794
  // Thalia (Female, English)
6795
6795
  voices: {
@@ -6809,26 +6809,26 @@ const ke = {
6809
6809
  // Male, English - Powerful
6810
6810
  }
6811
6811
  };
6812
- function De() {
6812
+ function We() {
6813
6813
  return {
6814
6814
  service: "elevenlabs",
6815
- endpoint: ke.endpoint,
6816
- apiKey: ke.apiKey,
6817
- defaultVoice: ke.defaultVoice,
6818
- voices: ke.voices
6815
+ endpoint: ze.endpoint,
6816
+ apiKey: ze.apiKey,
6817
+ defaultVoice: ze.defaultVoice,
6818
+ voices: ze.voices
6819
6819
  };
6820
6820
  }
6821
- function Mt() {
6822
- const Z = De(), t = [];
6823
- return Object.entries(Z.voices).forEach(([e, n]) => {
6821
+ function Et() {
6822
+ const G = We(), t = [];
6823
+ return Object.entries(G.voices).forEach(([e, n]) => {
6824
6824
  t.push({
6825
6825
  value: n,
6826
- label: `${e.charAt(0).toUpperCase() + e.slice(1)} (${Z.service})`
6826
+ label: `${e.charAt(0).toUpperCase() + e.slice(1)} (${G.service})`
6827
6827
  });
6828
6828
  }), t;
6829
6829
  }
6830
- const Ye = Be(({
6831
- avatarUrl: Z = "/avatars/brunette.glb",
6830
+ const _e = Ne(({
6831
+ avatarUrl: G = "/avatars/brunette.glb",
6832
6832
  avatarBody: t = "F",
6833
6833
  mood: e = "neutral",
6834
6834
  ttsLang: n = "en",
@@ -6848,314 +6848,314 @@ const Ye = Be(({
6848
6848
  className: p = "",
6849
6849
  style: b = {},
6850
6850
  animations: f = {}
6851
- }, S) => {
6852
- const B = X(null), g = X(null), D = X(a), T = X(null), I = X(null), N = X(!1), L = X({ remainingText: null, originalText: null, options: null }), R = X([]), z = X(0), [y, M] = le(!0), [O, E] = le(null), [j, ae] = le(!1), [ce, xe] = le(!1);
6853
- ge(() => {
6854
- N.current = ce;
6855
- }, [ce]), ge(() => {
6856
- D.current = a;
6851
+ }, k) => {
6852
+ const T = X(null), g = X(null), N = X(a), F = X(null), I = X(null), U = X(!1), S = X({ remainingText: null, originalText: null, options: null }), R = X([]), z = X(0), [y, E] = le(!0), [D, B] = le(null), [Y, ae] = le(!1), [ce, be] = le(!1);
6853
+ ye(() => {
6854
+ U.current = ce;
6855
+ }, [ce]), ye(() => {
6856
+ N.current = a;
6857
6857
  }, [a]);
6858
- const se = De(), Ie = i || se.service;
6859
- let ee;
6860
- Ie === "browser" ? ee = {
6858
+ const se = We(), Se = i || se.service;
6859
+ let te;
6860
+ Se === "browser" ? te = {
6861
6861
  service: "browser",
6862
6862
  endpoint: "",
6863
6863
  apiKey: null,
6864
6864
  defaultVoice: "Google US English"
6865
- } : Ie === "elevenlabs" ? ee = {
6865
+ } : Se === "elevenlabs" ? te = {
6866
6866
  service: "elevenlabs",
6867
6867
  endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
6868
6868
  apiKey: o || se.apiKey,
6869
- defaultVoice: s || se.defaultVoice || ke.defaultVoice,
6870
- voices: se.voices || ke.voices
6871
- } : Ie === "deepgram" ? ee = {
6869
+ defaultVoice: s || se.defaultVoice || ze.defaultVoice,
6870
+ voices: se.voices || ze.voices
6871
+ } : Se === "deepgram" ? te = {
6872
6872
  service: "deepgram",
6873
6873
  endpoint: "https://api.deepgram.com/v1/speak",
6874
6874
  apiKey: o || se.apiKey,
6875
- defaultVoice: s || se.defaultVoice || Pe.defaultVoice,
6876
- voices: se.voices || Pe.voices
6877
- } : ee = {
6875
+ defaultVoice: s || se.defaultVoice || De.defaultVoice,
6876
+ voices: se.voices || De.voices
6877
+ } : te = {
6878
6878
  ...se,
6879
6879
  // Override API key if provided via props
6880
6880
  apiKey: o !== null ? o : se.apiKey
6881
6881
  };
6882
6882
  const v = {
6883
- url: Z,
6883
+ url: G,
6884
6884
  body: t,
6885
6885
  avatarMood: e,
6886
- ttsLang: Ie === "browser" ? "en-US" : n,
6887
- ttsVoice: s || ee.defaultVoice,
6886
+ ttsLang: Se === "browser" ? "en-US" : n,
6887
+ ttsVoice: s || te.defaultVoice,
6888
6888
  lipsyncLang: "en",
6889
6889
  showFullAvatar: a,
6890
6890
  bodyMovement: r,
6891
6891
  movementIntensity: u
6892
6892
  }, A = {
6893
- ttsEndpoint: ee.endpoint,
6894
- ttsApikey: ee.apiKey,
6895
- ttsService: Ie,
6893
+ ttsEndpoint: te.endpoint,
6894
+ ttsApikey: te.apiKey,
6895
+ ttsService: Se,
6896
6896
  lipsyncModules: ["en"],
6897
6897
  cameraView: c
6898
- }, F = G(async () => {
6899
- if (!(!B.current || g.current))
6898
+ }, M = V(async () => {
6899
+ if (!(!T.current || g.current))
6900
6900
  try {
6901
- if (M(!0), E(null), g.current = new Ue(B.current, A), g.current.controls && (g.current.controls.enableRotate = !1, g.current.controls.enableZoom = !1, g.current.controls.enablePan = !1, g.current.controls.enableDamping = !1), f && Object.keys(f).length > 0 && (g.current.customAnimations = f), await g.current.showAvatar(v, (q) => {
6902
- if (q.lengthComputable) {
6903
- const ne = Math.min(100, Math.round(q.loaded / q.total * 100));
6904
- d(ne);
6901
+ if (E(!0), B(null), g.current = new Ze(T.current, A), g.current.controls && (g.current.controls.enableRotate = !1, g.current.controls.enableZoom = !1, g.current.controls.enablePan = !1, g.current.controls.enableDamping = !1), f && Object.keys(f).length > 0 && (g.current.customAnimations = f), await g.current.showAvatar(v, (_) => {
6902
+ if (_.lengthComputable) {
6903
+ const ie = Math.min(100, Math.round(_.loaded / _.total * 100));
6904
+ d(ie);
6905
6905
  }
6906
- }), await new Promise((q) => {
6907
- const ne = () => {
6908
- g.current.lipsync && Object.keys(g.current.lipsync).length > 0 ? q() : setTimeout(ne, 100);
6906
+ }), await new Promise((_) => {
6907
+ const ie = () => {
6908
+ g.current.lipsync && Object.keys(g.current.lipsync).length > 0 ? _() : setTimeout(ie, 100);
6909
6909
  };
6910
- ne();
6910
+ ie();
6911
6911
  }), g.current && g.current.setShowFullAvatar)
6912
6912
  try {
6913
6913
  g.current.setShowFullAvatar(a);
6914
- } catch (q) {
6915
- console.warn("Error setting full body mode on initialization:", q);
6914
+ } catch (_) {
6915
+ console.warn("Error setting full body mode on initialization:", _);
6916
6916
  }
6917
- g.current && g.current.controls && (g.current.controls.enableRotate = !1, g.current.controls.enableZoom = !1, g.current.controls.enablePan = !1, g.current.controls.enableDamping = !1, g.current.controls.update()), M(!1), ae(!0), l(g.current);
6918
- const Q = () => {
6917
+ g.current && g.current.controls && (g.current.controls.enableRotate = !1, g.current.controls.enableZoom = !1, g.current.controls.enablePan = !1, g.current.controls.enableDamping = !1, g.current.controls.update()), E(!1), ae(!0), l(g.current);
6918
+ const q = () => {
6919
6919
  document.visibilityState === "visible" ? g.current?.start() : g.current?.stop();
6920
6920
  };
6921
- return document.addEventListener("visibilitychange", Q), () => {
6922
- document.removeEventListener("visibilitychange", Q);
6921
+ return document.addEventListener("visibilitychange", q), () => {
6922
+ document.removeEventListener("visibilitychange", q);
6923
6923
  };
6924
- } catch (w) {
6925
- console.error("Error initializing TalkingHead:", w), E(w.message || "Failed to initialize avatar"), M(!1), h(w);
6924
+ } catch (C) {
6925
+ console.error("Error initializing TalkingHead:", C), B(C.message || "Failed to initialize avatar"), E(!1), h(C);
6926
6926
  }
6927
- }, [Z, t, e, n, i, s, o, a, r, u, c]);
6928
- ge(() => (F(), () => {
6927
+ }, [G, t, e, n, i, s, o, a, r, u, c]);
6928
+ ye(() => (M(), () => {
6929
6929
  g.current && (g.current.stop(), g.current.dispose(), g.current = null);
6930
- }), [F]), ge(() => {
6931
- if (!B.current || !g.current) return;
6932
- const w = new ResizeObserver((q) => {
6933
- for (const ne of q)
6930
+ }), [M]), ye(() => {
6931
+ if (!T.current || !g.current) return;
6932
+ const C = new ResizeObserver((_) => {
6933
+ for (const ie of _)
6934
6934
  g.current && g.current.onResize && g.current.onResize();
6935
6935
  });
6936
- w.observe(B.current);
6937
- const Q = () => {
6936
+ C.observe(T.current);
6937
+ const q = () => {
6938
6938
  g.current && g.current.onResize && g.current.onResize();
6939
6939
  };
6940
- return window.addEventListener("resize", Q), () => {
6941
- w.disconnect(), window.removeEventListener("resize", Q);
6940
+ return window.addEventListener("resize", q), () => {
6941
+ C.disconnect(), window.removeEventListener("resize", q);
6942
6942
  };
6943
- }, [j]);
6944
- const U = G(async () => {
6943
+ }, [Y]);
6944
+ const W = V(async () => {
6945
6945
  if (g.current && g.current.audioCtx)
6946
6946
  try {
6947
6947
  (g.current.audioCtx.state === "suspended" || g.current.audioCtx.state === "interrupted") && (await g.current.audioCtx.resume(), console.log("Audio context resumed"));
6948
- } catch (w) {
6949
- console.warn("Failed to resume audio context:", w);
6948
+ } catch (C) {
6949
+ console.warn("Failed to resume audio context:", C);
6950
6950
  }
6951
- }, []), Y = G(async (w, Q = {}) => {
6952
- if (g.current && j)
6951
+ }, []), Q = V(async (C, q = {}) => {
6952
+ if (g.current && Y)
6953
6953
  try {
6954
- I.current && (clearInterval(I.current), I.current = null), T.current = { text: w, options: Q }, L.current = { remainingText: null, originalText: null, options: null };
6955
- const q = /[!\.\?\n\p{Extended_Pictographic}]/ug, ne = w.split(q).map(($) => $.trim()).filter(($) => $.length > 0);
6956
- R.current = ne, z.current = 0, xe(!1), N.current = !1, await U();
6957
- const be = {
6958
- ...Q,
6959
- lipsyncLang: Q.lipsyncLang || v.lipsyncLang || "en"
6954
+ I.current && (clearInterval(I.current), I.current = null), F.current = { text: C, options: q }, S.current = { remainingText: null, originalText: null, options: null };
6955
+ const _ = /[!\.\?\n\p{Extended_Pictographic}]/ug, ie = C.split(_).map((J) => J.trim()).filter((J) => J.length > 0);
6956
+ R.current = ie, z.current = 0, be(!1), U.current = !1, await W();
6957
+ const ve = {
6958
+ ...q,
6959
+ lipsyncLang: q.lipsyncLang || v.lipsyncLang || "en"
6960
6960
  };
6961
- if (Q.onSpeechEnd && g.current) {
6962
- const $ = g.current;
6963
- let me = null, k = 0;
6964
- const C = 1200;
6965
- let W = !1;
6966
- me = setInterval(() => {
6967
- if (k++, N.current)
6961
+ if (q.onSpeechEnd && g.current) {
6962
+ const J = g.current;
6963
+ let pe = null, w = 0;
6964
+ const L = 1200;
6965
+ let P = !1;
6966
+ pe = setInterval(() => {
6967
+ if (w++, U.current)
6968
6968
  return;
6969
- if (k > C) {
6970
- if (me && (clearInterval(me), me = null, I.current = null), !W && !N.current) {
6971
- W = !0;
6969
+ if (w > L) {
6970
+ if (pe && (clearInterval(pe), pe = null, I.current = null), !P && !U.current) {
6971
+ P = !0;
6972
6972
  try {
6973
- Q.onSpeechEnd();
6974
- } catch (Ce) {
6975
- console.error("Error in onSpeechEnd callback (timeout):", Ce);
6973
+ q.onSpeechEnd();
6974
+ } catch (Ge) {
6975
+ console.error("Error in onSpeechEnd callback (timeout):", Ge);
6976
6976
  }
6977
6977
  }
6978
6978
  return;
6979
6979
  }
6980
- const V = !$.speechQueue || $.speechQueue.length === 0, ie = !$.audioPlaylist || $.audioPlaylist.length === 0;
6981
- $ && $.isSpeaking === !1 && V && ie && $.isAudioPlaying === !1 && !W && !N.current && setTimeout(() => {
6982
- if ($ && !N.current && $.isSpeaking === !1 && (!$.speechQueue || $.speechQueue.length === 0) && (!$.audioPlaylist || $.audioPlaylist.length === 0) && $.isAudioPlaying === !1 && !W && !N.current) {
6983
- W = !0, me && (clearInterval(me), me = null, I.current = null);
6980
+ const Z = !J.speechQueue || J.speechQueue.length === 0, j = !J.audioPlaylist || J.audioPlaylist.length === 0;
6981
+ J && J.isSpeaking === !1 && Z && j && J.isAudioPlaying === !1 && !P && !U.current && setTimeout(() => {
6982
+ if (J && !U.current && J.isSpeaking === !1 && (!J.speechQueue || J.speechQueue.length === 0) && (!J.audioPlaylist || J.audioPlaylist.length === 0) && J.isAudioPlaying === !1 && !P && !U.current) {
6983
+ P = !0, pe && (clearInterval(pe), pe = null, I.current = null);
6984
6984
  try {
6985
- Q.onSpeechEnd();
6986
- } catch (He) {
6987
- console.error("Error in onSpeechEnd callback:", He);
6985
+ q.onSpeechEnd();
6986
+ } catch (ue) {
6987
+ console.error("Error in onSpeechEnd callback:", ue);
6988
6988
  }
6989
6989
  }
6990
6990
  }, 100);
6991
- }, 100), I.current = me;
6991
+ }, 100), I.current = pe;
6992
6992
  }
6993
- g.current.lipsync && Object.keys(g.current.lipsync).length > 0 ? (g.current.setSlowdownRate && g.current.setSlowdownRate(1.05), g.current.speakText(w, be)) : setTimeout(async () => {
6994
- await U(), g.current && g.current.lipsync && (g.current.setSlowdownRate && g.current.setSlowdownRate(1.05), g.current.speakText(w, be));
6993
+ g.current.lipsync && Object.keys(g.current.lipsync).length > 0 ? (g.current.setSlowdownRate && g.current.setSlowdownRate(1.05), g.current.speakText(C, ve)) : setTimeout(async () => {
6994
+ await W(), g.current && g.current.lipsync && (g.current.setSlowdownRate && g.current.setSlowdownRate(1.05), g.current.speakText(C, ve));
6995
6995
  }, 100);
6996
- } catch (q) {
6997
- console.error("Error speaking text:", q), E(q.message || "Failed to speak text");
6996
+ } catch (_) {
6997
+ console.error("Error speaking text:", _), B(_.message || "Failed to speak text");
6998
6998
  }
6999
- }, [j, U, v.lipsyncLang]), re = G(() => {
7000
- g.current && (g.current.stopSpeaking(), g.current.setSlowdownRate && g.current.setSlowdownRate(1), T.current = null, xe(!1));
7001
- }, []), K = G(() => {
6999
+ }, [Y, W, v.lipsyncLang]), re = V(() => {
7000
+ g.current && (g.current.stopSpeaking(), g.current.setSlowdownRate && g.current.setSlowdownRate(1), F.current = null, be(!1));
7001
+ }, []), $ = V(() => {
7002
7002
  if (g.current && g.current.pauseSpeaking) {
7003
- const w = g.current;
7004
- if (w.isSpeaking || w.audioPlaylist && w.audioPlaylist.length > 0 || w.speechQueue && w.speechQueue.length > 0) {
7003
+ const C = g.current;
7004
+ if (C.isSpeaking || C.audioPlaylist && C.audioPlaylist.length > 0 || C.speechQueue && C.speechQueue.length > 0) {
7005
7005
  I.current && (clearInterval(I.current), I.current = null);
7006
- let q = "";
7007
- if (T.current && R.current.length > 0) {
7008
- const ne = R.current.length, be = w.speechQueue ? w.speechQueue.filter((C) => C && C.text && Array.isArray(C.text) && C.text.length > 0).length : 0, $ = w.audioPlaylist && w.audioPlaylist.length > 0, me = be + ($ ? 1 : 0), k = ne - me;
7009
- if (me > 0 && k < ne && (q = R.current.slice(k).join(". ").trim(), !q && be > 0 && w.speechQueue)) {
7010
- const W = w.speechQueue.filter((V) => V && V.text && Array.isArray(V.text) && V.text.length > 0).map((V) => V.text.map((ie) => ie.word || "").filter((ie) => ie.length > 0).join(" ")).filter((V) => V.length > 0).join(" ");
7011
- W && W.trim() && (q = W.trim());
7006
+ let _ = "";
7007
+ if (F.current && R.current.length > 0) {
7008
+ const ie = R.current.length, ve = C.speechQueue ? C.speechQueue.filter((L) => L && L.text && Array.isArray(L.text) && L.text.length > 0).length : 0, J = C.audioPlaylist && C.audioPlaylist.length > 0, pe = ve + (J ? 1 : 0), w = ie - pe;
7009
+ if (pe > 0 && w < ie && (_ = R.current.slice(w).join(". ").trim(), !_ && ve > 0 && C.speechQueue)) {
7010
+ const P = C.speechQueue.filter((Z) => Z && Z.text && Array.isArray(Z.text) && Z.text.length > 0).map((Z) => Z.text.map((j) => j.word || "").filter((j) => j.length > 0).join(" ")).filter((Z) => Z.length > 0).join(" ");
7011
+ P && P.trim() && (_ = P.trim());
7012
7012
  }
7013
7013
  }
7014
- T.current && (L.current = {
7015
- remainingText: q || null,
7016
- originalText: T.current.text,
7017
- options: T.current.options
7018
- }), w.speechQueue && (w.speechQueue.length = 0), g.current.pauseSpeaking(), N.current = !0, xe(!0);
7014
+ F.current && (S.current = {
7015
+ remainingText: _ || null,
7016
+ originalText: F.current.text,
7017
+ options: F.current.options
7018
+ }), C.speechQueue && (C.speechQueue.length = 0), g.current.pauseSpeaking(), U.current = !0, be(!0);
7019
7019
  }
7020
7020
  }
7021
- }, []), te = G(async () => {
7021
+ }, []), ne = V(async () => {
7022
7022
  if (!g.current || !ce)
7023
7023
  return;
7024
- let w = "", Q = {};
7025
- if (L.current && L.current.remainingText)
7026
- w = L.current.remainingText, Q = L.current.options || {}, L.current = { remainingText: null, originalText: null, options: null };
7027
- else if (T.current && T.current.text)
7028
- w = T.current.text, Q = T.current.options || {};
7024
+ let C = "", q = {};
7025
+ if (S.current && S.current.remainingText)
7026
+ C = S.current.remainingText, q = S.current.options || {}, S.current = { remainingText: null, originalText: null, options: null };
7027
+ else if (F.current && F.current.text)
7028
+ C = F.current.text, q = F.current.options || {};
7029
7029
  else {
7030
- console.warn("Resume called but no paused speech found"), xe(!1), N.current = !1;
7030
+ console.warn("Resume called but no paused speech found"), be(!1), U.current = !1;
7031
7031
  return;
7032
7032
  }
7033
- xe(!1), N.current = !1, await U();
7034
- const q = {
7035
- ...Q,
7036
- lipsyncLang: Q.lipsyncLang || v.lipsyncLang || "en"
7033
+ be(!1), U.current = !1, await W();
7034
+ const _ = {
7035
+ ...q,
7036
+ lipsyncLang: q.lipsyncLang || v.lipsyncLang || "en"
7037
7037
  };
7038
7038
  try {
7039
- await Y(w, q);
7040
- } catch (ne) {
7041
- console.error("Error resuming speech:", ne), xe(!1), N.current = !1;
7039
+ await Q(C, _);
7040
+ } catch (ie) {
7041
+ console.error("Error resuming speech:", ie), be(!1), U.current = !1;
7042
7042
  }
7043
- }, [U, ce, Y, v]), ye = G((w) => {
7044
- g.current && g.current.setMood(w);
7045
- }, []), we = G((w) => {
7046
- g.current && g.current.setSlowdownRate && g.current.setSlowdownRate(w);
7047
- }, []), Ne = G((w, Q = !1) => {
7043
+ }, [W, ce, Q, v]), fe = V((C) => {
7044
+ g.current && g.current.setMood(C);
7045
+ }, []), He = V((C) => {
7046
+ g.current && g.current.setSlowdownRate && g.current.setSlowdownRate(C);
7047
+ }, []), Ve = V((C, q = !1) => {
7048
7048
  if (g.current && g.current.playAnimation) {
7049
- if (f && f[w] && (w = f[w]), g.current.setShowFullAvatar)
7049
+ if (f && f[C] && (C = f[C]), g.current.setShowFullAvatar)
7050
7050
  try {
7051
- g.current.setShowFullAvatar(D.current);
7052
- } catch (ne) {
7053
- console.warn("Error setting full body mode:", ne);
7051
+ g.current.setShowFullAvatar(N.current);
7052
+ } catch (ie) {
7053
+ console.warn("Error setting full body mode:", ie);
7054
7054
  }
7055
- if (w.includes("."))
7055
+ if (C.includes("."))
7056
7056
  try {
7057
- g.current.playAnimation(w, null, 10, 0, 0.01, Q);
7058
- } catch (ne) {
7059
- console.warn(`Failed to play ${w}:`, ne);
7057
+ g.current.playAnimation(C, null, 10, 0, 0.01, q);
7058
+ } catch (ie) {
7059
+ console.warn(`Failed to play ${C}:`, ie);
7060
7060
  try {
7061
7061
  g.current.setBodyMovement("idle");
7062
- } catch (be) {
7063
- console.warn("Fallback animation also failed:", be);
7062
+ } catch (ve) {
7063
+ console.warn("Fallback animation also failed:", ve);
7064
7064
  }
7065
7065
  }
7066
7066
  else {
7067
- const ne = [".fbx", ".glb", ".gltf"];
7068
- let be = !1;
7069
- for (const $ of ne)
7067
+ const ie = [".fbx", ".glb", ".gltf"];
7068
+ let ve = !1;
7069
+ for (const J of ie)
7070
7070
  try {
7071
- g.current.playAnimation(w + $, null, 10, 0, 0.01, Q), be = !0;
7071
+ g.current.playAnimation(C + J, null, 10, 0, 0.01, q), ve = !0;
7072
7072
  break;
7073
7073
  } catch {
7074
7074
  }
7075
- if (!be) {
7076
- console.warn("Animation not found:", w);
7075
+ if (!ve) {
7076
+ console.warn("Animation not found:", C);
7077
7077
  try {
7078
7078
  g.current.setBodyMovement("idle");
7079
- } catch ($) {
7080
- console.warn("Fallback animation also failed:", $);
7079
+ } catch (J) {
7080
+ console.warn("Fallback animation also failed:", J);
7081
7081
  }
7082
7082
  }
7083
7083
  }
7084
7084
  }
7085
- }, [f]), Te = G(() => {
7085
+ }, [f]), Fe = V(() => {
7086
7086
  g.current && g.current.onResize && g.current.onResize();
7087
7087
  }, []);
7088
- return Oe(S, () => ({
7089
- speakText: Y,
7088
+ return Ue(k, () => ({
7089
+ speakText: Q,
7090
7090
  stopSpeaking: re,
7091
- pauseSpeaking: K,
7092
- resumeSpeaking: te,
7093
- resumeAudioContext: U,
7094
- setMood: ye,
7095
- setTimingAdjustment: we,
7096
- playAnimation: Ne,
7097
- isReady: j,
7091
+ pauseSpeaking: $,
7092
+ resumeSpeaking: ne,
7093
+ resumeAudioContext: W,
7094
+ setMood: fe,
7095
+ setTimingAdjustment: He,
7096
+ playAnimation: Ve,
7097
+ isReady: Y,
7098
7098
  isPaused: ce,
7099
7099
  talkingHead: g.current,
7100
- handleResize: Te,
7101
- setBodyMovement: (w) => {
7100
+ handleResize: Fe,
7101
+ setBodyMovement: (C) => {
7102
7102
  if (g.current && g.current.setShowFullAvatar && g.current.setBodyMovement)
7103
7103
  try {
7104
- g.current.setShowFullAvatar(D.current), g.current.setBodyMovement(w);
7105
- } catch (Q) {
7106
- console.warn("Error setting body movement:", Q);
7104
+ g.current.setShowFullAvatar(N.current), g.current.setBodyMovement(C);
7105
+ } catch (q) {
7106
+ console.warn("Error setting body movement:", q);
7107
7107
  }
7108
7108
  },
7109
- setMovementIntensity: (w) => g.current?.setMovementIntensity(w),
7109
+ setMovementIntensity: (C) => g.current?.setMovementIntensity(C),
7110
7110
  playRandomDance: () => {
7111
7111
  if (g.current && g.current.setShowFullAvatar && g.current.playRandomDance)
7112
7112
  try {
7113
- g.current.setShowFullAvatar(D.current), g.current.playRandomDance();
7114
- } catch (w) {
7115
- console.warn("Error playing random dance:", w);
7113
+ g.current.setShowFullAvatar(N.current), g.current.playRandomDance();
7114
+ } catch (C) {
7115
+ console.warn("Error playing random dance:", C);
7116
7116
  }
7117
7117
  },
7118
- playReaction: (w) => {
7118
+ playReaction: (C) => {
7119
7119
  if (g.current && g.current.setShowFullAvatar && g.current.playReaction)
7120
7120
  try {
7121
- g.current.setShowFullAvatar(D.current), g.current.playReaction(w);
7122
- } catch (Q) {
7123
- console.warn("Error playing reaction:", Q);
7121
+ g.current.setShowFullAvatar(N.current), g.current.playReaction(C);
7122
+ } catch (q) {
7123
+ console.warn("Error playing reaction:", q);
7124
7124
  }
7125
7125
  },
7126
7126
  playCelebration: () => {
7127
7127
  if (g.current && g.current.setShowFullAvatar && g.current.playCelebration)
7128
7128
  try {
7129
- g.current.setShowFullAvatar(D.current), g.current.playCelebration();
7130
- } catch (w) {
7131
- console.warn("Error playing celebration:", w);
7129
+ g.current.setShowFullAvatar(N.current), g.current.playCelebration();
7130
+ } catch (C) {
7131
+ console.warn("Error playing celebration:", C);
7132
7132
  }
7133
7133
  },
7134
- setShowFullAvatar: (w) => {
7134
+ setShowFullAvatar: (C) => {
7135
7135
  if (g.current && g.current.setShowFullAvatar)
7136
7136
  try {
7137
- D.current = w, g.current.setShowFullAvatar(w);
7138
- } catch (Q) {
7139
- console.warn("Error setting showFullAvatar:", Q);
7137
+ N.current = C, g.current.setShowFullAvatar(C);
7138
+ } catch (q) {
7139
+ console.warn("Error setting showFullAvatar:", q);
7140
7140
  }
7141
7141
  },
7142
7142
  lockAvatarPosition: () => {
7143
7143
  if (g.current && g.current.lockAvatarPosition)
7144
7144
  try {
7145
7145
  g.current.lockAvatarPosition();
7146
- } catch (w) {
7147
- console.warn("Error locking avatar position:", w);
7146
+ } catch (C) {
7147
+ console.warn("Error locking avatar position:", C);
7148
7148
  }
7149
7149
  },
7150
7150
  unlockAvatarPosition: () => {
7151
7151
  if (g.current && g.current.unlockAvatarPosition)
7152
7152
  try {
7153
7153
  g.current.unlockAvatarPosition();
7154
- } catch (w) {
7155
- console.warn("Error unlocking avatar position:", w);
7154
+ } catch (C) {
7155
+ console.warn("Error unlocking avatar position:", C);
7156
7156
  }
7157
7157
  }
7158
- })), /* @__PURE__ */ ve(
7158
+ })), /* @__PURE__ */ Re(
7159
7159
  "div",
7160
7160
  {
7161
7161
  className: `talking-head-avatar ${p}`,
@@ -7166,10 +7166,10 @@ const Ye = Be(({
7166
7166
  ...b
7167
7167
  },
7168
7168
  children: [
7169
- /* @__PURE__ */ J(
7169
+ /* @__PURE__ */ ee(
7170
7170
  "div",
7171
7171
  {
7172
- ref: B,
7172
+ ref: T,
7173
7173
  className: "talking-head-viewer",
7174
7174
  style: {
7175
7175
  width: "100%",
@@ -7178,7 +7178,7 @@ const Ye = Be(({
7178
7178
  }
7179
7179
  }
7180
7180
  ),
7181
- y && /* @__PURE__ */ J("div", { className: "loading-overlay", style: {
7181
+ y && /* @__PURE__ */ ee("div", { className: "loading-overlay", style: {
7182
7182
  position: "absolute",
7183
7183
  top: "50%",
7184
7184
  left: "50%",
@@ -7187,7 +7187,7 @@ const Ye = Be(({
7187
7187
  fontSize: "18px",
7188
7188
  zIndex: 10
7189
7189
  }, children: "Loading avatar..." }),
7190
- O && /* @__PURE__ */ J("div", { className: "error-overlay", style: {
7190
+ D && /* @__PURE__ */ ee("div", { className: "error-overlay", style: {
7191
7191
  position: "absolute",
7192
7192
  top: "50%",
7193
7193
  left: "50%",
@@ -7198,14 +7198,14 @@ const Ye = Be(({
7198
7198
  zIndex: 10,
7199
7199
  padding: "20px",
7200
7200
  borderRadius: "8px"
7201
- }, children: O })
7201
+ }, children: D })
7202
7202
  ]
7203
7203
  }
7204
7204
  );
7205
7205
  });
7206
- Ye.displayName = "TalkingHeadAvatar";
7207
- const vt = Be(({
7208
- text: Z = "Hello! I'm a talking avatar. How are you today?",
7206
+ _e.displayName = "TalkingHeadAvatar";
7207
+ const At = Ne(({
7208
+ text: G = "Hello! I'm a talking avatar. How are you today?",
7209
7209
  onLoading: t = () => {
7210
7210
  },
7211
7211
  onError: e = () => {
@@ -7216,7 +7216,7 @@ const vt = Be(({
7216
7216
  style: s = {},
7217
7217
  avatarConfig: o = {}
7218
7218
  }, r) => {
7219
- const u = X(null), a = X(null), [c, l] = le(!0), [d, h] = le(null), [p, b] = le(!1), f = De(), S = o.ttsService || f.service, B = S === "browser" ? {
7219
+ const u = X(null), a = X(null), [c, l] = le(!0), [d, h] = le(null), [p, b] = le(!1), f = We(), k = o.ttsService || f.service, T = k === "browser" ? {
7220
7220
  endpoint: "",
7221
7221
  apiKey: null,
7222
7222
  defaultVoice: "Google US English"
@@ -7225,14 +7225,14 @@ const vt = Be(({
7225
7225
  // Override API key if provided via avatarConfig
7226
7226
  apiKey: o.ttsApiKey !== void 0 && o.ttsApiKey !== null ? o.ttsApiKey : f.apiKey,
7227
7227
  // Override endpoint for ElevenLabs if service is explicitly set
7228
- endpoint: S === "elevenlabs" && o.ttsApiKey ? "https://api.elevenlabs.io/v1/text-to-speech" : f.endpoint
7228
+ endpoint: k === "elevenlabs" && o.ttsApiKey ? "https://api.elevenlabs.io/v1/text-to-speech" : f.endpoint
7229
7229
  }, g = {
7230
7230
  url: "/avatars/brunette.glb",
7231
7231
  // Use brunette avatar (working glTF file)
7232
7232
  body: "F",
7233
7233
  avatarMood: "neutral",
7234
- ttsLang: S === "browser" ? "en-US" : "en",
7235
- ttsVoice: o.ttsVoice || B.defaultVoice,
7234
+ ttsLang: k === "browser" ? "en-US" : "en",
7235
+ ttsVoice: o.ttsVoice || T.defaultVoice,
7236
7236
  lipsyncLang: "en",
7237
7237
  // English lip-sync
7238
7238
  showFullAvatar: !0,
@@ -7240,98 +7240,98 @@ const vt = Be(({
7240
7240
  bodyMovement: "idle",
7241
7241
  movementIntensity: 0.5,
7242
7242
  ...o
7243
- }, D = {
7244
- ttsEndpoint: B.endpoint,
7245
- ttsApikey: B.apiKey,
7246
- ttsService: S,
7243
+ }, N = {
7244
+ ttsEndpoint: T.endpoint,
7245
+ ttsApikey: T.apiKey,
7246
+ ttsService: k,
7247
7247
  lipsyncModules: ["en"],
7248
7248
  cameraView: "upper"
7249
- }, T = G(async () => {
7249
+ }, F = V(async () => {
7250
7250
  if (!(!u.current || a.current))
7251
7251
  try {
7252
- if (l(!0), h(null), a.current = new Ue(u.current, D), await a.current.showAvatar(g, (O) => {
7253
- if (O.lengthComputable) {
7254
- const E = Math.min(100, Math.round(O.loaded / O.total * 100));
7255
- t(E);
7252
+ if (l(!0), h(null), a.current = new Ze(u.current, N), await a.current.showAvatar(g, (D) => {
7253
+ if (D.lengthComputable) {
7254
+ const B = Math.min(100, Math.round(D.loaded / D.total * 100));
7255
+ t(B);
7256
7256
  }
7257
7257
  }), a.current.morphs && a.current.morphs.length > 0) {
7258
- const O = a.current.morphs[0].morphTargetDictionary;
7259
- console.log("Available morph targets:", Object.keys(O));
7260
- const E = Object.keys(O).filter((j) => j.startsWith("viseme_"));
7261
- 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"));
7258
+ const D = a.current.morphs[0].morphTargetDictionary;
7259
+ console.log("Available morph targets:", Object.keys(D));
7260
+ const B = Object.keys(D).filter((Y) => Y.startsWith("viseme_"));
7261
+ console.log("Viseme morph targets found:", B), B.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"));
7262
7262
  }
7263
- if (await new Promise((O) => {
7264
- const E = () => {
7265
- 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(E, 100));
7263
+ if (await new Promise((D) => {
7264
+ const B = () => {
7265
+ a.current.lipsync && Object.keys(a.current.lipsync).length > 0 ? (console.log("Lip-sync modules loaded:", Object.keys(a.current.lipsync)), D()) : (console.log("Waiting for lip-sync modules to load..."), setTimeout(B, 100));
7266
7266
  };
7267
- E();
7267
+ B();
7268
7268
  }), a.current && a.current.setShowFullAvatar)
7269
7269
  try {
7270
7270
  a.current.setShowFullAvatar(!0), console.log("Avatar initialized in full body mode");
7271
- } catch (O) {
7272
- console.warn("Error setting full body mode on initialization:", O);
7271
+ } catch (D) {
7272
+ console.warn("Error setting full body mode on initialization:", D);
7273
7273
  }
7274
7274
  l(!1), b(!0), n(a.current);
7275
- const M = () => {
7275
+ const E = () => {
7276
7276
  document.visibilityState === "visible" ? a.current?.start() : a.current?.stop();
7277
7277
  };
7278
- return document.addEventListener("visibilitychange", M), () => {
7279
- document.removeEventListener("visibilitychange", M);
7278
+ return document.addEventListener("visibilitychange", E), () => {
7279
+ document.removeEventListener("visibilitychange", E);
7280
7280
  };
7281
7281
  } catch (y) {
7282
7282
  console.error("Error initializing TalkingHead:", y), h(y.message || "Failed to initialize avatar"), l(!1), e(y);
7283
7283
  }
7284
7284
  }, []);
7285
- ge(() => (T(), () => {
7285
+ ye(() => (F(), () => {
7286
7286
  a.current && (a.current.stop(), a.current.dispose(), a.current = null);
7287
- }), [T]);
7288
- const I = G((y) => {
7287
+ }), [F]);
7288
+ const I = V((y) => {
7289
7289
  if (a.current && p)
7290
7290
  try {
7291
7291
  console.log("Speaking text:", y), console.log("Avatar config:", g), 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(y)) : (console.warn("Lip-sync modules not ready, waiting..."), setTimeout(() => {
7292
7292
  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(y)) : console.error("Lip-sync still not ready after waiting");
7293
7293
  }, 500));
7294
- } catch (M) {
7295
- console.error("Error speaking text:", M), h(M.message || "Failed to speak text");
7294
+ } catch (E) {
7295
+ console.error("Error speaking text:", E), h(E.message || "Failed to speak text");
7296
7296
  }
7297
7297
  else
7298
7298
  console.warn("Avatar not ready for speaking. isReady:", p, "talkingHeadRef:", !!a.current);
7299
- }, [p, g]), N = G(() => {
7299
+ }, [p, g]), U = V(() => {
7300
7300
  a.current && (a.current.stopSpeaking(), a.current.setSlowdownRate && (a.current.setSlowdownRate(1), console.log("Reset timing to normal")));
7301
- }, []), L = G((y) => {
7301
+ }, []), S = V((y) => {
7302
7302
  a.current && a.current.setMood(y);
7303
- }, []), R = G((y) => {
7303
+ }, []), R = V((y) => {
7304
7304
  a.current && a.current.setSlowdownRate && (a.current.setSlowdownRate(y), console.log("Timing adjustment set to:", y));
7305
- }, []), z = G((y, M = !1) => {
7305
+ }, []), z = V((y, E = !1) => {
7306
7306
  if (a.current && a.current.playAnimation) {
7307
7307
  if (a.current.setShowFullAvatar)
7308
7308
  try {
7309
7309
  a.current.setShowFullAvatar(!0);
7310
- } catch (E) {
7311
- console.warn("Error setting full body mode:", E);
7310
+ } catch (B) {
7311
+ console.warn("Error setting full body mode:", B);
7312
7312
  }
7313
7313
  if (y.includes("."))
7314
7314
  try {
7315
- a.current.playAnimation(y, null, 10, 0, 0.01, M), console.log("Playing animation:", y);
7316
- } catch (E) {
7317
- console.log(`Failed to play ${y}:`, E);
7315
+ a.current.playAnimation(y, null, 10, 0, 0.01, E), console.log("Playing animation:", y);
7316
+ } catch (B) {
7317
+ console.log(`Failed to play ${y}:`, B);
7318
7318
  try {
7319
7319
  a.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
7320
- } catch (j) {
7321
- console.warn("Fallback animation also failed:", j);
7320
+ } catch (Y) {
7321
+ console.warn("Fallback animation also failed:", Y);
7322
7322
  }
7323
7323
  }
7324
7324
  else {
7325
- const E = [".fbx", ".glb", ".gltf"];
7326
- let j = !1;
7327
- for (const ae of E)
7325
+ const B = [".fbx", ".glb", ".gltf"];
7326
+ let Y = !1;
7327
+ for (const ae of B)
7328
7328
  try {
7329
- a.current.playAnimation(y + ae, null, 10, 0, 0.01, M), console.log("Playing animation:", y + ae), j = !0;
7329
+ a.current.playAnimation(y + ae, null, 10, 0, 0.01, E), console.log("Playing animation:", y + ae), Y = !0;
7330
7330
  break;
7331
7331
  } catch {
7332
7332
  console.log(`Failed to play ${y}${ae}, trying next format...`);
7333
7333
  }
7334
- if (!j) {
7334
+ if (!Y) {
7335
7335
  console.warn("Animation system not available or animation not found:", y);
7336
7336
  try {
7337
7337
  a.current.setBodyMovement("idle"), console.log("Fallback to idle animation");
@@ -7343,10 +7343,10 @@ const vt = Be(({
7343
7343
  } else
7344
7344
  console.warn("Animation system not available or animation not found:", y);
7345
7345
  }, []);
7346
- return Oe(r, () => ({
7346
+ return Ue(r, () => ({
7347
7347
  speakText: I,
7348
- stopSpeaking: N,
7349
- setMood: L,
7348
+ stopSpeaking: U,
7349
+ setMood: S,
7350
7350
  setTimingAdjustment: R,
7351
7351
  playAnimation: z,
7352
7352
  isReady: p,
@@ -7355,8 +7355,8 @@ const vt = Be(({
7355
7355
  if (a.current && a.current.setShowFullAvatar && a.current.setBodyMovement)
7356
7356
  try {
7357
7357
  a.current.setShowFullAvatar(!0), a.current.setBodyMovement(y), console.log("Body movement set with full body mode:", y);
7358
- } catch (M) {
7359
- console.warn("Error setting body movement:", M);
7358
+ } catch (E) {
7359
+ console.warn("Error setting body movement:", E);
7360
7360
  }
7361
7361
  },
7362
7362
  setMovementIntensity: (y) => a.current?.setMovementIntensity(y),
@@ -7372,8 +7372,8 @@ const vt = Be(({
7372
7372
  if (a.current && a.current.setShowFullAvatar && a.current.playReaction)
7373
7373
  try {
7374
7374
  a.current.setShowFullAvatar(!0), a.current.playReaction(y), console.log("Reaction played with full body mode:", y);
7375
- } catch (M) {
7376
- console.warn("Error playing reaction:", M);
7375
+ } catch (E) {
7376
+ console.warn("Error playing reaction:", E);
7377
7377
  }
7378
7378
  },
7379
7379
  playCelebration: () => {
@@ -7388,8 +7388,8 @@ const vt = Be(({
7388
7388
  if (a.current && a.current.setShowFullAvatar)
7389
7389
  try {
7390
7390
  a.current.setShowFullAvatar(y), console.log("Show full avatar set to:", y);
7391
- } catch (M) {
7392
- console.warn("Error setting showFullAvatar:", M);
7391
+ } catch (E) {
7392
+ console.warn("Error setting showFullAvatar:", E);
7393
7393
  }
7394
7394
  },
7395
7395
  lockAvatarPosition: () => {
@@ -7408,8 +7408,8 @@ const vt = Be(({
7408
7408
  console.warn("Error unlocking avatar position:", y);
7409
7409
  }
7410
7410
  }
7411
- })), /* @__PURE__ */ ve("div", { className: `talking-head-container ${i}`, style: s, children: [
7412
- /* @__PURE__ */ J(
7411
+ })), /* @__PURE__ */ Re("div", { className: `talking-head-container ${i}`, style: s, children: [
7412
+ /* @__PURE__ */ ee(
7413
7413
  "div",
7414
7414
  {
7415
7415
  ref: u,
@@ -7421,7 +7421,7 @@ const vt = Be(({
7421
7421
  }
7422
7422
  }
7423
7423
  ),
7424
- c && /* @__PURE__ */ J("div", { className: "loading-overlay", style: {
7424
+ c && /* @__PURE__ */ ee("div", { className: "loading-overlay", style: {
7425
7425
  position: "absolute",
7426
7426
  top: "50%",
7427
7427
  left: "50%",
@@ -7430,7 +7430,7 @@ const vt = Be(({
7430
7430
  fontSize: "18px",
7431
7431
  zIndex: 10
7432
7432
  }, children: "Loading avatar..." }),
7433
- d && /* @__PURE__ */ J("div", { className: "error-overlay", style: {
7433
+ d && /* @__PURE__ */ ee("div", { className: "error-overlay", style: {
7434
7434
  position: "absolute",
7435
7435
  top: "50%",
7436
7436
  left: "50%",
@@ -7444,11 +7444,11 @@ const vt = Be(({
7444
7444
  }, children: d })
7445
7445
  ] });
7446
7446
  });
7447
- vt.displayName = "TalkingHeadComponent";
7448
- async function Qe(Z) {
7447
+ At.displayName = "TalkingHeadComponent";
7448
+ async function Me(G) {
7449
7449
  try {
7450
- console.log(`📥 Loading animation manifest from: ${Z}`);
7451
- const t = await fetch(Z);
7450
+ console.log(`📥 Loading animation manifest from: ${G}`);
7451
+ const t = await fetch(G);
7452
7452
  if (!t.ok)
7453
7453
  throw new Error(`Failed to fetch manifest: ${t.status} ${t.statusText}`);
7454
7454
  const e = await t.json();
@@ -7463,8 +7463,8 @@ async function Qe(Z) {
7463
7463
  return console.error("❌ Failed to load animation manifest:", t), {};
7464
7464
  }
7465
7465
  }
7466
- async function Rt(Z, t = "F") {
7467
- const e = [], n = Z.replace(/\/$/, "");
7466
+ async function It(G, t = "F") {
7467
+ const e = [], n = G.replace(/\/$/, "");
7468
7468
  try {
7469
7469
  const s = [
7470
7470
  `${n}/.list.json`,
@@ -7502,19 +7502,19 @@ async function Rt(Z, t = "F") {
7502
7502
  }
7503
7503
  return e.length > 0 || (console.warn(`⚠️ Could not auto-discover animations from ${n}. Consider using a manifest.json file or a server-side directory listing API.`), console.info(`💡 Tip: Create a ${n}/.list.json file with an array of FBX filenames, or use animations: { manifest: "/animations/manifest.json" }`)), e;
7504
7504
  }
7505
- async function je(Z, t = "F") {
7505
+ async function qe(G, t = "F") {
7506
7506
  const e = {};
7507
- for (const [n, i] of Object.entries(Z))
7507
+ for (const [n, i] of Object.entries(G))
7508
7508
  try {
7509
- const s = await Rt(i, t);
7509
+ const s = await It(i, t);
7510
7510
  s.length > 0 ? (e[n] = s, console.log(`✅ Auto-loaded ${s.length} animations for group "${n}"`)) : console.warn(`⚠️ No animations found in ${i} for group "${n}"`);
7511
7511
  } catch (s) {
7512
7512
  console.error(`❌ Failed to auto-load animations from ${i}:`, s);
7513
7513
  }
7514
7514
  return e;
7515
7515
  }
7516
- const At = Be(({
7517
- text: Z = null,
7516
+ const Lt = Ne(({
7517
+ text: G = null,
7518
7518
  avatarUrl: t = "/avatars/brunette.glb",
7519
7519
  avatarBody: e = "F",
7520
7520
  mood: n = "neutral",
@@ -7535,273 +7535,313 @@ const At = Be(({
7535
7535
  onSpeechEnd: b = () => {
7536
7536
  },
7537
7537
  className: f = "",
7538
- style: S = {},
7539
- animations: B = {},
7538
+ style: k = {},
7539
+ animations: T = {},
7540
7540
  autoAnimationGroup: g = null,
7541
7541
  // e.g., "talking" - will randomly select from this group when speaking
7542
- autoIdleGroup: D = null,
7542
+ autoIdleGroup: N = null,
7543
7543
  // e.g., "idle" - will randomly select from this group when idle
7544
- autoSpeak: T = !1
7544
+ autoSpeak: F = !1
7545
7545
  }, I) => {
7546
- const N = X(null), L = X(null), R = X(c), z = X(null), y = X(null), M = X(!1), O = X({ remainingText: null, originalText: null, options: null }), E = X([]), [j, ae] = le(!0), [ce, xe] = le(null), [se, Ie] = le(!1), [ee, v] = le(!1), [A, F] = le(B), U = X(null), Y = X(!1), re = X(null);
7547
- ge(() => {
7548
- M.current = ee;
7549
- }, [ee]), ge(() => {
7546
+ const U = X(null), S = X(null), R = X(c), z = X(null), y = X(null), E = X(!1), D = X({ remainingText: null, originalText: null, options: null }), B = X([]), [Y, ae] = le(!0), [ce, be] = le(null), [se, Se] = le(!1), [te, v] = le(!1), [A, M] = le(T), W = X(null), Q = X(!1), re = X(null);
7547
+ ye(() => {
7548
+ E.current = te;
7549
+ }, [te]), ye(() => {
7550
7550
  (async () => {
7551
- if (B.manifest)
7551
+ if (T.manifest && T.auto)
7552
7552
  try {
7553
- console.log("🔄 Loading animations from manifest:", B.manifest);
7554
- const C = await Qe(B.manifest);
7555
- F(C), console.log("✅ Animations loaded and set:", C), C._genderSpecific ? console.log("👥 Gender-specific animations detected:", {
7556
- male: Object.keys(C._genderSpecific.male || {}),
7557
- female: Object.keys(C._genderSpecific.female || {}),
7558
- shared: Object.keys(C._genderSpecific.shared || {})
7553
+ console.log("🔄 Loading animations from manifest (priority over auto-discovery):", T.manifest);
7554
+ const L = await Me(T.manifest);
7555
+ M(L), console.log("✅ Animations loaded from manifest:", L), L._genderSpecific && console.log("👥 Gender-specific animations detected:", {
7556
+ male: Object.keys(L._genderSpecific.male || {}),
7557
+ female: Object.keys(L._genderSpecific.female || {}),
7558
+ shared: Object.keys(L._genderSpecific.shared || {})
7559
+ });
7560
+ return;
7561
+ } catch (L) {
7562
+ console.warn("⚠️ Manifest failed, falling back to auto-discovery:", L);
7563
+ }
7564
+ if (T.manifest && !T.auto)
7565
+ try {
7566
+ console.log("🔄 Loading animations from manifest:", T.manifest);
7567
+ const L = await Me(T.manifest);
7568
+ M(L), console.log("✅ Animations loaded and set:", L), L._genderSpecific ? console.log("👥 Gender-specific animations detected:", {
7569
+ male: Object.keys(L._genderSpecific.male || {}),
7570
+ female: Object.keys(L._genderSpecific.female || {}),
7571
+ shared: Object.keys(L._genderSpecific.shared || {})
7559
7572
  }) : console.log("⚠️ No gender-specific animations found in manifest");
7560
- } catch (C) {
7561
- console.error("❌ Failed to load animation manifest:", C), F(B);
7573
+ } catch (L) {
7574
+ console.error("❌ Failed to load animation manifest:", L), M(T);
7562
7575
  }
7563
- else if (B.auto)
7576
+ else if (T.auto)
7564
7577
  try {
7565
- if (console.log("🔄 Auto-discovering animations from folder:", B.auto), typeof B.auto == "string") {
7566
- const C = B.auto, W = {
7567
- talking: `${C}/talking`,
7568
- idle: `${C}/idle`
7569
- }, V = e === "M" ? "male" : "female";
7570
- W[`${V}_talking`] = `${C}/${V}/talking`, W[`${V}_idle`] = `${C}/${V}/idle`, W.shared_talking = `${C}/shared/talking`, W.shared_idle = `${C}/shared/idle`;
7571
- const ie = await je(W, e), ue = {
7578
+ console.log("🔄 Auto-discovering animations from folder:", T.auto);
7579
+ let L = null;
7580
+ if (T.manifest)
7581
+ try {
7582
+ L = await Me(T.manifest), console.log("📦 Loaded manifest as fallback:", L);
7583
+ } catch (P) {
7584
+ console.warn("⚠️ Could not load manifest fallback:", P);
7585
+ }
7586
+ if (typeof T.auto == "string") {
7587
+ const P = T.auto, Z = {
7588
+ talking: `${P}/talking`,
7589
+ idle: `${P}/idle`
7590
+ }, j = e === "M" ? "male" : "female";
7591
+ Z[`${j}_talking`] = `${P}/${j}/talking`, Z[`${j}_idle`] = `${P}/${j}/idle`, Z.shared_talking = `${P}/shared/talking`, Z.shared_idle = `${P}/shared/idle`;
7592
+ const Ae = await qe(Z, e);
7593
+ if (!Object.values(Ae).some((he) => Array.isArray(he) && he.length > 0) && L) {
7594
+ console.log("⚠️ No animations auto-discovered, using manifest fallback"), M(L);
7595
+ return;
7596
+ }
7597
+ const ue = {
7572
7598
  _genderSpecific: {
7573
- [V]: {},
7599
+ [j]: {},
7574
7600
  shared: {}
7575
7601
  }
7576
7602
  };
7577
- Object.entries(ie).forEach(([Ce, He]) => {
7578
- if (Ce.includes("_")) {
7579
- const [We, ..._e] = Ce.split("_"), ze = _e.join("_");
7580
- We === "shared" ? (ue._genderSpecific.shared[ze] || (ue._genderSpecific.shared[ze] = []), ue._genderSpecific.shared[ze].push(...He)) : We === V && (ue._genderSpecific[V][ze] || (ue._genderSpecific[V][ze] = []), ue._genderSpecific[V][ze].push(...He));
7603
+ Object.entries(Ae).forEach(([he, we]) => {
7604
+ if (he.includes("_")) {
7605
+ const [Ee, ...$e] = he.split("_"), Te = $e.join("_");
7606
+ Ee === "shared" ? (ue._genderSpecific.shared[Te] || (ue._genderSpecific.shared[Te] = []), ue._genderSpecific.shared[Te].push(...we)) : Ee === j && (ue._genderSpecific[j][Te] || (ue._genderSpecific[j][Te] = []), ue._genderSpecific[j][Te].push(...we));
7581
7607
  } else
7582
- ue[Ce] = He;
7583
- }), F(ue), console.log("✅ Auto-discovered animations:", ue);
7584
- } else if (typeof B.auto == "object") {
7585
- const C = await je(B.auto, e);
7586
- F(C), console.log("✅ Auto-discovered animations from folders:", C);
7608
+ ue[he] = we;
7609
+ }), L && (L._genderSpecific && Object.keys(L._genderSpecific).forEach((he) => {
7610
+ ue._genderSpecific[he] || (ue._genderSpecific[he] = {}), Object.entries(L._genderSpecific[he]).forEach(([we, Ee]) => {
7611
+ ue._genderSpecific[he][we] || (ue._genderSpecific[he][we] = Ee);
7612
+ });
7613
+ }), Object.entries(L).forEach(([he, we]) => {
7614
+ he !== "_genderSpecific" && !ue[he] && (ue[he] = we);
7615
+ })), M(ue), console.log("✅ Auto-discovered animations:", ue);
7616
+ } else if (typeof T.auto == "object") {
7617
+ const P = await qe(T.auto, e);
7618
+ !Object.values(P).some((j) => Array.isArray(j) && j.length > 0) && L ? (console.log("⚠️ No animations auto-discovered, using manifest fallback"), M(L)) : (M(P), console.log("✅ Auto-discovered animations from folders:", P));
7587
7619
  }
7588
- } catch (C) {
7589
- console.error("❌ Failed to auto-discover animations:", C), F(B);
7620
+ } catch (L) {
7621
+ if (console.error("❌ Failed to auto-discover animations:", L), T.manifest)
7622
+ try {
7623
+ const P = await Me(T.manifest);
7624
+ M(P), console.log("✅ Using manifest fallback after auto-discovery error");
7625
+ } catch {
7626
+ M(T);
7627
+ }
7628
+ else
7629
+ M(T);
7590
7630
  }
7591
7631
  else
7592
- console.log("📝 Using animations from props (no manifest or auto):", B), F(B);
7632
+ console.log("📝 Using animations from props (no manifest or auto):", T), M(T);
7593
7633
  })();
7594
- }, [B, e]), ge(() => {
7634
+ }, [T, e]), ye(() => {
7595
7635
  R.current = c;
7596
7636
  }, [c]);
7597
- const K = De(), te = s || K.service;
7598
- let ye;
7599
- te === "browser" ? ye = {
7637
+ const $ = We(), ne = s || $.service;
7638
+ let fe;
7639
+ ne === "browser" ? fe = {
7600
7640
  service: "browser",
7601
7641
  endpoint: "",
7602
7642
  apiKey: null,
7603
7643
  defaultVoice: "Google US English"
7604
- } : te === "elevenlabs" ? ye = {
7644
+ } : ne === "elevenlabs" ? fe = {
7605
7645
  service: "elevenlabs",
7606
7646
  endpoint: "https://api.elevenlabs.io/v1/text-to-speech",
7607
- apiKey: r || K.apiKey,
7608
- defaultVoice: o || K.defaultVoice || ke.defaultVoice,
7609
- voices: K.voices || ke.voices
7610
- } : te === "deepgram" ? ye = {
7647
+ apiKey: r || $.apiKey,
7648
+ defaultVoice: o || $.defaultVoice || ze.defaultVoice,
7649
+ voices: $.voices || ze.voices
7650
+ } : ne === "deepgram" ? fe = {
7611
7651
  service: "deepgram",
7612
7652
  endpoint: "https://api.deepgram.com/v1/speak",
7613
- apiKey: r || K.apiKey,
7614
- defaultVoice: o || K.defaultVoice || Pe.defaultVoice,
7615
- voices: K.voices || Pe.voices
7616
- } : ye = {
7617
- ...K,
7618
- apiKey: r !== null ? r : K.apiKey
7653
+ apiKey: r || $.apiKey,
7654
+ defaultVoice: o || $.defaultVoice || De.defaultVoice,
7655
+ voices: $.voices || De.voices
7656
+ } : fe = {
7657
+ ...$,
7658
+ apiKey: r !== null ? r : $.apiKey
7619
7659
  };
7620
- const we = {
7660
+ const He = {
7621
7661
  url: t,
7622
7662
  body: e,
7623
7663
  avatarMood: n,
7624
- ttsLang: te === "browser" ? "en-US" : i,
7625
- ttsVoice: o || ye.defaultVoice,
7664
+ ttsLang: ne === "browser" ? "en-US" : i,
7665
+ ttsVoice: o || fe.defaultVoice,
7626
7666
  lipsyncLang: "en",
7627
7667
  showFullAvatar: c,
7628
7668
  bodyMovement: u,
7629
7669
  movementIntensity: a
7630
- }, Ne = {
7631
- ttsEndpoint: ye.endpoint,
7632
- ttsApikey: ye.apiKey,
7633
- ttsService: te,
7670
+ }, Ve = {
7671
+ ttsEndpoint: fe.endpoint,
7672
+ ttsApikey: fe.apiKey,
7673
+ ttsService: ne,
7634
7674
  lipsyncModules: ["en"],
7635
7675
  cameraView: l
7636
- }, Te = G(async () => {
7637
- if (!(!N.current || L.current))
7676
+ }, Fe = V(async () => {
7677
+ if (!(!U.current || S.current))
7638
7678
  try {
7639
- ae(!0), xe(null), L.current = new Ue(N.current, Ne), console.log("Avatar config being passed:", {
7640
- url: we.url,
7641
- body: we.body,
7642
- avatarMood: we.avatarMood
7643
- }), await L.current.showAvatar(we, (C) => {
7644
- if (C.lengthComputable) {
7645
- const W = Math.min(100, Math.round(C.loaded / C.total * 100));
7646
- h(W);
7679
+ ae(!0), be(null), S.current = new Ze(U.current, Ve), console.log("Avatar config being passed:", {
7680
+ url: He.url,
7681
+ body: He.body,
7682
+ avatarMood: He.avatarMood
7683
+ }), await S.current.showAvatar(He, (L) => {
7684
+ if (L.lengthComputable) {
7685
+ const P = Math.min(100, Math.round(L.loaded / L.total * 100));
7686
+ h(P);
7647
7687
  }
7648
- }), L.current?.avatar && console.log("Avatar body after initialization:", L.current.avatar.body), ae(!1), Ie(!0), d(L.current);
7649
- const k = () => {
7650
- document.visibilityState === "visible" ? L.current?.start() : L.current?.stop();
7688
+ }), S.current?.avatar && console.log("Avatar body after initialization:", S.current.avatar.body), ae(!1), Se(!0), d(S.current);
7689
+ const w = () => {
7690
+ document.visibilityState === "visible" ? S.current?.start() : S.current?.stop();
7651
7691
  };
7652
- return document.addEventListener("visibilitychange", k), () => {
7653
- document.removeEventListener("visibilitychange", k);
7692
+ return document.addEventListener("visibilitychange", w), () => {
7693
+ document.removeEventListener("visibilitychange", w);
7654
7694
  };
7655
- } catch (k) {
7656
- console.error("Error initializing TalkingHead:", k), xe(k.message || "Failed to initialize avatar"), ae(!1), p(k);
7695
+ } catch (w) {
7696
+ console.error("Error initializing TalkingHead:", w), be(w.message || "Failed to initialize avatar"), ae(!1), p(w);
7657
7697
  }
7658
7698
  }, []);
7659
- ge(() => (Te(), () => {
7660
- L.current && (L.current.stop(), L.current.dispose(), L.current = null);
7661
- }), [Te]);
7662
- const w = G(async () => {
7663
- if (L.current)
7699
+ ye(() => (Fe(), () => {
7700
+ S.current && (S.current.stop(), S.current.dispose(), S.current = null);
7701
+ }), [Fe]);
7702
+ const C = V(async () => {
7703
+ if (S.current)
7664
7704
  try {
7665
- const k = L.current.audioCtx || L.current.audioContext;
7666
- k && (k.state === "suspended" || k.state === "interrupted") && (await k.resume(), console.log("Audio context resumed"));
7667
- } catch (k) {
7668
- console.warn("Failed to resume audio context:", k);
7705
+ const w = S.current.audioCtx || S.current.audioContext;
7706
+ w && (w.state === "suspended" || w.state === "interrupted") && (await w.resume(), console.log("Audio context resumed"));
7707
+ } catch (w) {
7708
+ console.warn("Failed to resume audio context:", w);
7669
7709
  }
7670
- }, []), Q = G((k) => {
7710
+ }, []), q = V((w) => {
7671
7711
  if (!A)
7672
7712
  return console.warn("No animations loaded"), null;
7673
- let C = null;
7713
+ let L = null;
7674
7714
  if (A._genderSpecific) {
7675
- const V = (e?.toUpperCase() || "F") === "M" ? "male" : "female", ie = A._genderSpecific[V];
7676
- ie && ie[k] ? (C = ie[k], console.log(`Using ${V} animations for "${k}":`, C)) : A._genderSpecific.shared && A._genderSpecific.shared[k] && (C = A._genderSpecific.shared[k], console.log(`Using shared animations for "${k}":`, C));
7715
+ const Z = (e?.toUpperCase() || "F") === "M" ? "male" : "female", j = A._genderSpecific[Z];
7716
+ j && j[w] ? (L = j[w], console.log(`Using ${Z} animations for "${w}":`, L)) : A._genderSpecific.shared && A._genderSpecific.shared[w] && (L = A._genderSpecific.shared[w], console.log(`Using shared animations for "${w}":`, L));
7677
7717
  }
7678
- if (!C && A[k] && (C = A[k], console.log(`Using root-level animations for "${k}":`, C)), !C) {
7679
- if (console.warn(`Animation group "${k}" not found. Available groups:`, Object.keys(A).filter((W) => W !== "_genderSpecific")), A._genderSpecific) {
7680
- const V = (e?.toUpperCase() || "F") === "M" ? "male" : "female";
7681
- console.warn(`Gender-specific groups (${V}):`, Object.keys(A._genderSpecific[V] || {}));
7718
+ if (!L && A[w] && (L = A[w], console.log(`Using root-level animations for "${w}":`, L)), !L) {
7719
+ if (console.warn(`Animation group "${w}" not found. Available groups:`, Object.keys(A).filter((P) => P !== "_genderSpecific")), A._genderSpecific) {
7720
+ const Z = (e?.toUpperCase() || "F") === "M" ? "male" : "female";
7721
+ console.warn(`Gender-specific groups (${Z}):`, Object.keys(A._genderSpecific[Z] || {}));
7682
7722
  }
7683
7723
  return null;
7684
7724
  }
7685
- if (Array.isArray(C) && C.length > 0) {
7686
- const W = Math.floor(Math.random() * C.length);
7687
- return C[W];
7725
+ if (Array.isArray(L) && L.length > 0) {
7726
+ const P = Math.floor(Math.random() * L.length);
7727
+ return L[P];
7688
7728
  }
7689
- return typeof C == "string" ? C : (console.warn(`Animation group "${k}" is not a valid format (expected array or string):`, C), null);
7690
- }, [A, e]), q = G((k, C = !1, W = null) => {
7691
- if (!L.current)
7729
+ return typeof L == "string" ? L : (console.warn(`Animation group "${w}" is not a valid format (expected array or string):`, L), null);
7730
+ }, [A, e]), _ = V((w, L = !1, P = null) => {
7731
+ if (!S.current)
7692
7732
  return console.warn("TalkingHead not initialized yet"), null;
7693
- const V = Q(k);
7694
- if (V)
7733
+ const Z = q(w);
7734
+ if (Z)
7695
7735
  try {
7696
- const ie = () => {
7697
- Y.current && re.current === k ? setTimeout(() => {
7698
- q(k, C, W);
7699
- }, 100) : W && W();
7736
+ const j = () => {
7737
+ Q.current && re.current === w ? setTimeout(() => {
7738
+ _(w, L, P);
7739
+ }, 100) : P && P();
7700
7740
  };
7701
- return L.current.playAnimation(V, null, 10, 0, 0.01, C, ie), console.log(`✅ Playing random animation from "${k}" group:`, V), V;
7702
- } catch (ie) {
7703
- return console.error(`❌ Failed to play random animation from "${k}" group:`, ie), null;
7741
+ return S.current.playAnimation(Z, null, 10, 0, 0.01, L, j), console.log(`✅ Playing random animation from "${w}" group:`, Z), Z;
7742
+ } catch (j) {
7743
+ return console.error(`❌ Failed to play random animation from "${w}" group:`, j), null;
7704
7744
  }
7705
7745
  else
7706
- console.warn(`⚠️ No animation found for group "${k}"`);
7746
+ console.warn(`⚠️ No animation found for group "${w}"`);
7707
7747
  return null;
7708
- }, [Q]), ne = G(async (k, C = {}) => {
7709
- if (!L.current || !se) {
7748
+ }, [q]), ie = V(async (w, L = {}) => {
7749
+ if (!S.current || !se) {
7710
7750
  console.warn("Avatar not ready for speaking");
7711
7751
  return;
7712
7752
  }
7713
- if (!k || k.trim() === "") {
7753
+ if (!w || w.trim() === "") {
7714
7754
  console.warn("No text provided to speak");
7715
7755
  return;
7716
7756
  }
7717
- await w();
7718
- const W = C.animationGroup || g;
7719
- W && !C.skipAnimation ? (console.log(`🎬 Attempting to play animation from group: "${W}"`), console.log(`📊 Current avatarBody: "${e}", loadedAnimations:`, A), Y.current = !0, re.current = W, q(W)) : console.log(`⏭️ Skipping animation (group: ${W}, skipAnimation: ${C.skipAnimation})`), O.current = { remainingText: null, originalText: null, options: null }, E.current = [], z.current = { text: k, options: C }, y.current && (clearInterval(y.current), y.current = null), v(!1), M.current = !1;
7720
- const V = k.split(/[.!?]+/).filter((ue) => ue.trim().length > 0);
7721
- E.current = V;
7722
- const ie = {
7723
- lipsyncLang: C.lipsyncLang || "en",
7757
+ await C();
7758
+ const P = L.animationGroup || g;
7759
+ P && !L.skipAnimation ? (console.log(`🎬 Attempting to play animation from group: "${P}"`), console.log(`📊 Current avatarBody: "${e}", loadedAnimations:`, A), Q.current = !0, re.current = P, _(P)) : console.log(`⏭️ Skipping animation (group: ${P}, skipAnimation: ${L.skipAnimation})`), D.current = { remainingText: null, originalText: null, options: null }, B.current = [], z.current = { text: w, options: L }, y.current && (clearInterval(y.current), y.current = null), v(!1), E.current = !1;
7760
+ const Z = w.split(/[.!?]+/).filter((Ae) => Ae.trim().length > 0);
7761
+ B.current = Z;
7762
+ const j = {
7763
+ lipsyncLang: L.lipsyncLang || "en",
7724
7764
  onSpeechEnd: () => {
7725
- y.current && (clearInterval(y.current), y.current = null), Y.current = !1, re.current = null, C.onSpeechEnd && C.onSpeechEnd(), b();
7765
+ y.current && (clearInterval(y.current), y.current = null), Q.current = !1, re.current = null, L.onSpeechEnd && L.onSpeechEnd(), b();
7726
7766
  }
7727
7767
  };
7728
7768
  try {
7729
- L.current.speakText(k, ie);
7730
- } catch (ue) {
7731
- console.error("Error speaking text:", ue), xe(ue.message || "Failed to speak text");
7769
+ S.current.speakText(w, j);
7770
+ } catch (Ae) {
7771
+ console.error("Error speaking text:", Ae), be(Ae.message || "Failed to speak text");
7732
7772
  }
7733
- }, [se, b, w, g, q]);
7734
- ge(() => {
7735
- if (!se || !D || !L.current)
7773
+ }, [se, b, C, g, _]);
7774
+ ye(() => {
7775
+ if (!se || !N || !S.current)
7736
7776
  return;
7737
- U.current && clearInterval(U.current);
7738
- const k = () => {
7739
- L.current && !M.current && q(D);
7777
+ W.current && clearInterval(W.current);
7778
+ const w = () => {
7779
+ S.current && !E.current && _(N);
7740
7780
  };
7741
- return k(), U.current = setInterval(() => {
7742
- k();
7781
+ return w(), W.current = setInterval(() => {
7782
+ w();
7743
7783
  }, 12e3 + Math.random() * 3e3), () => {
7744
- U.current && (clearInterval(U.current), U.current = null);
7784
+ W.current && (clearInterval(W.current), W.current = null);
7745
7785
  };
7746
- }, [se, D, q]), ge(() => {
7747
- se && Z && T && L.current && ne(Z);
7748
- }, [se, Z, T, ne]);
7749
- const be = G(() => {
7750
- if (L.current)
7786
+ }, [se, N, _]), ye(() => {
7787
+ se && G && F && S.current && ie(G);
7788
+ }, [se, G, F, ie]);
7789
+ const ve = V(() => {
7790
+ if (S.current)
7751
7791
  try {
7752
- const k = L.current.isSpeaking || !1, C = L.current.audioPlaylist || [], W = L.current.speechQueue || [];
7753
- if (k || C.length > 0 || W.length > 0) {
7792
+ const w = S.current.isSpeaking || !1, L = S.current.audioPlaylist || [], P = S.current.speechQueue || [];
7793
+ if (w || L.length > 0 || P.length > 0) {
7754
7794
  y.current && (clearInterval(y.current), y.current = null);
7755
- let V = "";
7756
- W.length > 0 && (V = W.map((ie) => ie.text && Array.isArray(ie.text) ? ie.text.map((ue) => ue.word).join(" ") : ie.text || "").join(" ")), O.current = {
7757
- remainingText: V || null,
7795
+ let Z = "";
7796
+ P.length > 0 && (Z = P.map((j) => j.text && Array.isArray(j.text) ? j.text.map((Ae) => Ae.word).join(" ") : j.text || "").join(" ")), D.current = {
7797
+ remainingText: Z || null,
7758
7798
  originalText: z.current?.text || null,
7759
7799
  options: z.current?.options || null
7760
- }, L.current.speechQueue.length = 0, L.current.pauseSpeaking(), v(!0), M.current = !0;
7800
+ }, S.current.speechQueue.length = 0, S.current.pauseSpeaking(), v(!0), E.current = !0;
7761
7801
  }
7762
- } catch (k) {
7763
- console.warn("Error pausing speech:", k);
7802
+ } catch (w) {
7803
+ console.warn("Error pausing speech:", w);
7764
7804
  }
7765
- }, []), $ = G(async () => {
7766
- if (!(!L.current || !ee))
7805
+ }, []), J = V(async () => {
7806
+ if (!(!S.current || !te))
7767
7807
  try {
7768
- await w(), v(!1), M.current = !1;
7769
- const k = O.current?.remainingText, C = O.current?.originalText || z.current?.text, W = O.current?.options || z.current?.options || {}, V = k || C;
7770
- V && ne(V, W);
7771
- } catch (k) {
7772
- console.warn("Error resuming speech:", k), v(!1), M.current = !1;
7808
+ await C(), v(!1), E.current = !1;
7809
+ const w = D.current?.remainingText, L = D.current?.originalText || z.current?.text, P = D.current?.options || z.current?.options || {}, Z = w || L;
7810
+ Z && ie(Z, P);
7811
+ } catch (w) {
7812
+ console.warn("Error resuming speech:", w), v(!1), E.current = !1;
7773
7813
  }
7774
- }, [ee, ne, w]), me = G(() => {
7775
- L.current && (L.current.stopSpeaking(), y.current && (clearInterval(y.current), y.current = null), Y.current = !1, re.current = null, v(!1), M.current = !1);
7814
+ }, [te, ie, C]), pe = V(() => {
7815
+ S.current && (S.current.stopSpeaking(), y.current && (clearInterval(y.current), y.current = null), Q.current = !1, re.current = null, v(!1), E.current = !1);
7776
7816
  }, []);
7777
- return Oe(I, () => ({
7778
- speakText: ne,
7779
- pauseSpeaking: be,
7780
- resumeSpeaking: $,
7781
- stopSpeaking: me,
7782
- resumeAudioContext: w,
7783
- isPaused: () => ee,
7784
- setMood: (k) => L.current?.setMood(k),
7785
- setBodyMovement: (k) => {
7786
- L.current && L.current.setBodyMovement(k);
7817
+ return Ue(I, () => ({
7818
+ speakText: ie,
7819
+ pauseSpeaking: ve,
7820
+ resumeSpeaking: J,
7821
+ stopSpeaking: pe,
7822
+ resumeAudioContext: C,
7823
+ isPaused: () => te,
7824
+ setMood: (w) => S.current?.setMood(w),
7825
+ setBodyMovement: (w) => {
7826
+ S.current && S.current.setBodyMovement(w);
7787
7827
  },
7788
- playAnimation: (k, C = !1) => {
7789
- L.current && L.current.playAnimation && L.current.playAnimation(k, null, 10, 0, 0.01, C);
7828
+ playAnimation: (w, L = !1) => {
7829
+ S.current && S.current.playAnimation && S.current.playAnimation(w, null, 10, 0, 0.01, L);
7790
7830
  },
7791
- playRandomAnimation: (k, C = !1) => q(k, C),
7792
- getRandomAnimation: (k) => Q(k),
7793
- playReaction: (k) => L.current?.playReaction(k),
7794
- playCelebration: () => L.current?.playCelebration(),
7795
- setShowFullAvatar: (k) => {
7796
- L.current && (R.current = k, L.current.setShowFullAvatar(k));
7831
+ playRandomAnimation: (w, L = !1) => _(w, L),
7832
+ getRandomAnimation: (w) => q(w),
7833
+ playReaction: (w) => S.current?.playReaction(w),
7834
+ playCelebration: () => S.current?.playCelebration(),
7835
+ setShowFullAvatar: (w) => {
7836
+ S.current && (R.current = w, S.current.setShowFullAvatar(w));
7797
7837
  },
7798
7838
  isReady: se,
7799
- talkingHead: L.current
7800
- })), /* @__PURE__ */ ve("div", { className: `simple-talking-avatar-container ${f}`, style: S, children: [
7801
- /* @__PURE__ */ J(
7839
+ talkingHead: S.current
7840
+ })), /* @__PURE__ */ Re("div", { className: `simple-talking-avatar-container ${f}`, style: k, children: [
7841
+ /* @__PURE__ */ ee(
7802
7842
  "div",
7803
7843
  {
7804
- ref: N,
7844
+ ref: U,
7805
7845
  className: "talking-head-viewer",
7806
7846
  style: {
7807
7847
  width: "100%",
@@ -7810,7 +7850,7 @@ const At = Be(({
7810
7850
  }
7811
7851
  }
7812
7852
  ),
7813
- j && /* @__PURE__ */ J("div", { className: "loading-overlay", style: {
7853
+ Y && /* @__PURE__ */ ee("div", { className: "loading-overlay", style: {
7814
7854
  position: "absolute",
7815
7855
  top: "50%",
7816
7856
  left: "50%",
@@ -7819,7 +7859,7 @@ const At = Be(({
7819
7859
  fontSize: "18px",
7820
7860
  zIndex: 10
7821
7861
  }, children: "Loading avatar..." }),
7822
- ce && /* @__PURE__ */ J("div", { className: "error-overlay", style: {
7862
+ ce && /* @__PURE__ */ ee("div", { className: "error-overlay", style: {
7823
7863
  position: "absolute",
7824
7864
  top: "50%",
7825
7865
  left: "50%",
@@ -7833,9 +7873,9 @@ const At = Be(({
7833
7873
  }, children: ce })
7834
7874
  ] });
7835
7875
  });
7836
- At.displayName = "SimpleTalkingAvatar";
7837
- const It = Be(({
7838
- curriculumData: Z = null,
7876
+ Lt.displayName = "SimpleTalkingAvatar";
7877
+ const St = Ne(({
7878
+ curriculumData: G = null,
7839
7879
  avatarConfig: t = {},
7840
7880
  animations: e = {},
7841
7881
  onLessonStart: n = () => {
@@ -7866,12 +7906,12 @@ const It = Be(({
7866
7906
  onQuestionAnswer: s,
7867
7907
  onCurriculumComplete: o,
7868
7908
  onCustomAction: r
7869
- }), h = X(null), p = X(null), b = X(null), f = X(null), S = X(null), B = X(null), g = X(null), D = X(Z?.curriculum || {
7909
+ }), h = X(null), p = X(null), b = X(null), f = X(null), k = X(null), T = X(null), g = X(null), N = X(G?.curriculum || {
7870
7910
  title: "Default Curriculum",
7871
7911
  description: "No curriculum data provided",
7872
7912
  language: "en",
7873
7913
  modules: []
7874
- }), T = X({
7914
+ }), F = X({
7875
7915
  avatarUrl: t.avatarUrl || "/avatars/brunette.glb",
7876
7916
  avatarBody: t.avatarBody || "F",
7877
7917
  mood: t.mood || "happy",
@@ -7885,7 +7925,7 @@ const It = Be(({
7885
7925
  animations: e,
7886
7926
  lipsyncLang: "en"
7887
7927
  });
7888
- ge(() => {
7928
+ ye(() => {
7889
7929
  d.current = {
7890
7930
  onLessonStart: n,
7891
7931
  onLessonComplete: i,
@@ -7893,13 +7933,13 @@ const It = Be(({
7893
7933
  onCurriculumComplete: o,
7894
7934
  onCustomAction: r
7895
7935
  };
7896
- }, [n, i, s, o, r]), ge(() => {
7897
- D.current = Z?.curriculum || {
7936
+ }, [n, i, s, o, r]), ye(() => {
7937
+ N.current = G?.curriculum || {
7898
7938
  title: "Default Curriculum",
7899
7939
  description: "No curriculum data provided",
7900
7940
  language: "en",
7901
7941
  modules: []
7902
- }, T.current = {
7942
+ }, F.current = {
7903
7943
  avatarUrl: t.avatarUrl || "/avatars/brunette.glb",
7904
7944
  avatarBody: t.avatarBody || "F",
7905
7945
  mood: t.mood || "happy",
@@ -7913,8 +7953,8 @@ const It = Be(({
7913
7953
  animations: e,
7914
7954
  lipsyncLang: "en"
7915
7955
  };
7916
- }, [Z, t, e]);
7917
- const I = G(() => (D.current || { modules: [] }).modules[l.current.currentModuleIndex]?.lessons[l.current.currentLessonIndex], []), N = G(() => I()?.questions[l.current.currentQuestionIndex], [I]), L = G((v, A) => A.type === "multiple_choice" || A.type === "true_false" ? v === A.answer : A.type === "code_test" && typeof v == "object" && v !== null ? v.passed === !0 : !1, []), R = G(() => {
7956
+ }, [G, t, e]);
7957
+ const I = V(() => (N.current || { modules: [] }).modules[l.current.currentModuleIndex]?.lessons[l.current.currentLessonIndex], []), U = V(() => I()?.questions[l.current.currentQuestionIndex], [I]), S = V((v, A) => A.type === "multiple_choice" || A.type === "true_false" ? v === A.answer : A.type === "code_test" && typeof v == "object" && v !== null ? v.passed === !0 : !1, []), R = V(() => {
7918
7958
  l.current.lessonCompleted = !0, l.current.isQuestionMode = !1;
7919
7959
  const v = l.current.totalQuestions > 0 ? Math.round(l.current.score / l.current.totalQuestions * 100) : 100;
7920
7960
  let A = "Congratulations! You've completed this lesson";
@@ -7938,9 +7978,9 @@ const It = Be(({
7938
7978
  } catch {
7939
7979
  c.current.playCelebration();
7940
7980
  }
7941
- const F = D.current || { modules: [] }, U = F.modules[l.current.currentModuleIndex], Y = l.current.currentLessonIndex < (U?.lessons?.length || 0) - 1, re = l.current.currentModuleIndex < (F.modules?.length || 0) - 1, K = Y || re, te = T.current || { lipsyncLang: "en" };
7981
+ const M = N.current || { modules: [] }, W = M.modules[l.current.currentModuleIndex], Q = l.current.currentLessonIndex < (W?.lessons?.length || 0) - 1, re = l.current.currentModuleIndex < (M.modules?.length || 0) - 1, $ = Q || re, ne = F.current || { lipsyncLang: "en" };
7942
7982
  c.current.speakText(A, {
7943
- lipsyncLang: te.lipsyncLang,
7983
+ lipsyncLang: ne.lipsyncLang,
7944
7984
  onSpeechEnd: () => {
7945
7985
  d.current.onCustomAction({
7946
7986
  type: "lessonCompleteFeedbackDone",
@@ -7949,17 +7989,17 @@ const It = Be(({
7949
7989
  score: l.current.score,
7950
7990
  totalQuestions: l.current.totalQuestions,
7951
7991
  percentage: v,
7952
- hasNextLesson: K
7992
+ hasNextLesson: $
7953
7993
  });
7954
7994
  }
7955
7995
  });
7956
7996
  }
7957
- }, [e.lessonComplete]), z = G(() => {
7997
+ }, [e.lessonComplete]), z = V(() => {
7958
7998
  l.current.curriculumCompleted = !0;
7959
- const v = D.current || { modules: [] };
7999
+ const v = N.current || { modules: [] };
7960
8000
  if (d.current.onCurriculumComplete({
7961
8001
  modules: v.modules.length,
7962
- totalLessons: v.modules.reduce((A, F) => A + F.lessons.length, 0)
8002
+ totalLessons: v.modules.reduce((A, M) => A + M.lessons.length, 0)
7963
8003
  }), c.current) {
7964
8004
  if (c.current.setMood("celebrating"), e.curriculumComplete)
7965
8005
  try {
@@ -7967,13 +8007,13 @@ const It = Be(({
7967
8007
  } catch {
7968
8008
  c.current.playCelebration();
7969
8009
  }
7970
- const A = T.current || { lipsyncLang: "en" };
8010
+ const A = F.current || { lipsyncLang: "en" };
7971
8011
  c.current.speakText("Amazing! You've completed the entire curriculum! You're now ready to move on to more advanced topics. Well done!", { lipsyncLang: A.lipsyncLang });
7972
8012
  }
7973
- }, [e.curriculumComplete]), y = G(() => {
8013
+ }, [e.curriculumComplete]), y = V(() => {
7974
8014
  const v = I();
7975
8015
  l.current.isQuestionMode = !0, l.current.currentQuestionIndex = 0, l.current.totalQuestions = v?.questions?.length || 0, l.current.score = 0;
7976
- const A = N();
8016
+ const A = U();
7977
8017
  A && d.current.onCustomAction({
7978
8018
  type: "questionStart",
7979
8019
  moduleIndex: l.current.currentModuleIndex,
@@ -7983,35 +8023,35 @@ const It = Be(({
7983
8023
  question: A,
7984
8024
  score: l.current.score
7985
8025
  });
7986
- const F = () => {
8026
+ const M = () => {
7987
8027
  if (!c.current || !A) return;
7988
8028
  if (c.current.setMood("happy"), e.questionStart)
7989
8029
  try {
7990
8030
  c.current.playAnimation(e.questionStart, !0);
7991
- } catch (Y) {
7992
- console.warn("Failed to play questionStart animation:", Y);
8031
+ } catch (Q) {
8032
+ console.warn("Failed to play questionStart animation:", Q);
7993
8033
  }
7994
- const U = T.current || { lipsyncLang: "en" };
7995
- A.type === "code_test" ? c.current.speakText(`Let's test your coding skills! Here's your first challenge: ${A.question}`, { lipsyncLang: U.lipsyncLang }) : A.type === "multiple_choice" ? c.current.speakText(`Now let me ask you some questions. Here's the first one: ${A.question}`, { lipsyncLang: U.lipsyncLang }) : A.type === "true_false" ? c.current.speakText(`Let's start with some true or false questions. First question: ${A.question}`, { lipsyncLang: U.lipsyncLang }) : c.current.speakText(`Now let me ask you some questions. Here's the first one: ${A.question}`, { lipsyncLang: U.lipsyncLang });
8034
+ const W = F.current || { lipsyncLang: "en" };
8035
+ A.type === "code_test" ? c.current.speakText(`Let's test your coding skills! Here's your first challenge: ${A.question}`, { lipsyncLang: W.lipsyncLang }) : A.type === "multiple_choice" ? c.current.speakText(`Now let me ask you some questions. Here's the first one: ${A.question}`, { lipsyncLang: W.lipsyncLang }) : A.type === "true_false" ? c.current.speakText(`Let's start with some true or false questions. First question: ${A.question}`, { lipsyncLang: W.lipsyncLang }) : c.current.speakText(`Now let me ask you some questions. Here's the first one: ${A.question}`, { lipsyncLang: W.lipsyncLang });
7996
8036
  };
7997
8037
  if (c.current && c.current.isReady && A)
7998
- F();
8038
+ M();
7999
8039
  else if (c.current && c.current.isReady) {
8000
- const U = T.current || { lipsyncLang: "en" };
8001
- c.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang: U.lipsyncLang });
8040
+ const W = F.current || { lipsyncLang: "en" };
8041
+ c.current.speakText("Now let me ask you some questions to test your understanding.", { lipsyncLang: W.lipsyncLang });
8002
8042
  } else {
8003
- const U = setInterval(() => {
8004
- c.current && c.current.isReady && (clearInterval(U), A && F());
8043
+ const W = setInterval(() => {
8044
+ c.current && c.current.isReady && (clearInterval(W), A && M());
8005
8045
  }, 100);
8006
8046
  setTimeout(() => {
8007
- clearInterval(U);
8047
+ clearInterval(W);
8008
8048
  }, 5e3);
8009
8049
  }
8010
- }, [e.questionStart, I, N]), M = G(() => {
8050
+ }, [e.questionStart, I, U]), E = V(() => {
8011
8051
  const v = I();
8012
8052
  if (l.current.currentQuestionIndex < (v?.questions?.length || 0) - 1) {
8013
8053
  c.current && c.current.stopSpeaking && c.current.stopSpeaking(), l.current.currentQuestionIndex += 1;
8014
- const A = N();
8054
+ const A = U();
8015
8055
  A && d.current.onCustomAction({
8016
8056
  type: "nextQuestion",
8017
8057
  moduleIndex: l.current.currentModuleIndex,
@@ -8021,45 +8061,45 @@ const It = Be(({
8021
8061
  question: A,
8022
8062
  score: l.current.score
8023
8063
  });
8024
- const F = () => {
8064
+ const M = () => {
8025
8065
  if (!c.current || !A) return;
8026
8066
  if (c.current.setMood("happy"), c.current.setBodyMovement("idle"), e.nextQuestion)
8027
8067
  try {
8028
8068
  c.current.playAnimation(e.nextQuestion, !0);
8029
- } catch (te) {
8030
- console.warn("Failed to play nextQuestion animation:", te);
8069
+ } catch (ne) {
8070
+ console.warn("Failed to play nextQuestion animation:", ne);
8031
8071
  }
8032
- const U = T.current || { lipsyncLang: "en" }, re = I()?.questions?.length || 0, K = l.current.currentQuestionIndex >= re - 1;
8072
+ const W = F.current || { lipsyncLang: "en" }, re = I()?.questions?.length || 0, $ = l.current.currentQuestionIndex >= re - 1;
8033
8073
  if (A.type === "code_test") {
8034
- const te = K ? `Great! Here's your final coding challenge: ${A.question}` : `Great! Now let's move on to your next coding challenge: ${A.question}`;
8035
- c.current.speakText(te, {
8036
- lipsyncLang: U.lipsyncLang
8074
+ const ne = $ ? `Great! Here's your final coding challenge: ${A.question}` : `Great! Now let's move on to your next coding challenge: ${A.question}`;
8075
+ c.current.speakText(ne, {
8076
+ lipsyncLang: W.lipsyncLang
8037
8077
  });
8038
8078
  } else if (A.type === "multiple_choice") {
8039
- const te = K ? `Alright! Here's your final question: ${A.question}` : `Alright! Here's your next question: ${A.question}`;
8040
- c.current.speakText(te, {
8041
- lipsyncLang: U.lipsyncLang
8079
+ const ne = $ ? `Alright! Here's your final question: ${A.question}` : `Alright! Here's your next question: ${A.question}`;
8080
+ c.current.speakText(ne, {
8081
+ lipsyncLang: W.lipsyncLang
8042
8082
  });
8043
8083
  } else if (A.type === "true_false") {
8044
- const te = K ? `Now let's try this final one: ${A.question}` : `Now let's try this one: ${A.question}`;
8045
- c.current.speakText(te, {
8046
- lipsyncLang: U.lipsyncLang
8084
+ const ne = $ ? `Now let's try this final one: ${A.question}` : `Now let's try this one: ${A.question}`;
8085
+ c.current.speakText(ne, {
8086
+ lipsyncLang: W.lipsyncLang
8047
8087
  });
8048
8088
  } else {
8049
- const te = K ? `Here's your final question: ${A.question}` : `Here's the next question: ${A.question}`;
8050
- c.current.speakText(te, {
8051
- lipsyncLang: U.lipsyncLang
8089
+ const ne = $ ? `Here's your final question: ${A.question}` : `Here's the next question: ${A.question}`;
8090
+ c.current.speakText(ne, {
8091
+ lipsyncLang: W.lipsyncLang
8052
8092
  });
8053
8093
  }
8054
8094
  };
8055
8095
  if (c.current && c.current.isReady && A)
8056
- F();
8096
+ M();
8057
8097
  else if (A) {
8058
- const U = setInterval(() => {
8059
- c.current && c.current.isReady && (clearInterval(U), F());
8098
+ const W = setInterval(() => {
8099
+ c.current && c.current.isReady && (clearInterval(W), M());
8060
8100
  }, 100);
8061
8101
  setTimeout(() => {
8062
- clearInterval(U);
8102
+ clearInterval(W);
8063
8103
  }, 5e3);
8064
8104
  }
8065
8105
  } else
@@ -8070,16 +8110,16 @@ const It = Be(({
8070
8110
  totalQuestions: l.current.totalQuestions,
8071
8111
  score: l.current.score
8072
8112
  });
8073
- }, [e.nextQuestion, I, N]), O = G(() => {
8074
- const v = D.current || { modules: [] }, A = v.modules[l.current.currentModuleIndex];
8113
+ }, [e.nextQuestion, I, U]), D = V(() => {
8114
+ const v = N.current || { modules: [] }, A = v.modules[l.current.currentModuleIndex];
8075
8115
  if (l.current.currentLessonIndex < (A?.lessons?.length || 0) - 1) {
8076
8116
  l.current.currentLessonIndex += 1, l.current.currentQuestionIndex = 0, l.current.lessonCompleted = !1, l.current.isQuestionMode = !1, l.current.isTeaching = !1, l.current.score = 0, l.current.totalQuestions = 0;
8077
- const U = v.modules[l.current.currentModuleIndex], Y = l.current.currentLessonIndex < (U?.lessons?.length || 0) - 1, re = l.current.currentModuleIndex < (v.modules?.length || 0) - 1, K = Y || re;
8117
+ const W = v.modules[l.current.currentModuleIndex], Q = l.current.currentLessonIndex < (W?.lessons?.length || 0) - 1, re = l.current.currentModuleIndex < (v.modules?.length || 0) - 1, $ = Q || re;
8078
8118
  d.current.onCustomAction({
8079
8119
  type: "lessonStart",
8080
8120
  moduleIndex: l.current.currentModuleIndex,
8081
8121
  lessonIndex: l.current.currentLessonIndex,
8082
- hasNextLesson: K
8122
+ hasNextLesson: $
8083
8123
  }), d.current.onLessonStart({
8084
8124
  moduleIndex: l.current.currentModuleIndex,
8085
8125
  lessonIndex: l.current.currentLessonIndex,
@@ -8087,38 +8127,38 @@ const It = Be(({
8087
8127
  }), c.current && (c.current.setMood("happy"), c.current.setBodyMovement("idle"));
8088
8128
  } else if (l.current.currentModuleIndex < (v.modules?.length || 0) - 1) {
8089
8129
  l.current.currentModuleIndex += 1, l.current.currentLessonIndex = 0, l.current.currentQuestionIndex = 0, l.current.lessonCompleted = !1, l.current.isQuestionMode = !1, l.current.isTeaching = !1, l.current.score = 0, l.current.totalQuestions = 0;
8090
- const Y = v.modules[l.current.currentModuleIndex], re = l.current.currentLessonIndex < (Y?.lessons?.length || 0) - 1, K = l.current.currentModuleIndex < (v.modules?.length || 0) - 1, te = re || K;
8130
+ const Q = v.modules[l.current.currentModuleIndex], re = l.current.currentLessonIndex < (Q?.lessons?.length || 0) - 1, $ = l.current.currentModuleIndex < (v.modules?.length || 0) - 1, ne = re || $;
8091
8131
  d.current.onCustomAction({
8092
8132
  type: "lessonStart",
8093
8133
  moduleIndex: l.current.currentModuleIndex,
8094
8134
  lessonIndex: l.current.currentLessonIndex,
8095
- hasNextLesson: te
8135
+ hasNextLesson: ne
8096
8136
  }), d.current.onLessonStart({
8097
8137
  moduleIndex: l.current.currentModuleIndex,
8098
8138
  lessonIndex: l.current.currentLessonIndex,
8099
8139
  lesson: I()
8100
8140
  }), c.current && (c.current.setMood("happy"), c.current.setBodyMovement("idle"));
8101
8141
  } else
8102
- S.current && S.current();
8103
- }, []), E = G(() => {
8142
+ k.current && k.current();
8143
+ }, []), B = V(() => {
8104
8144
  const v = I();
8105
8145
  let A = null;
8106
8146
  if (v?.avatar_script && v?.body) {
8107
- const F = v.avatar_script.trim(), U = v.body.trim(), Y = F.match(/[.!?]$/) ? " " : ". ";
8108
- A = `${F}${Y}${U}`;
8147
+ const M = v.avatar_script.trim(), W = v.body.trim(), Q = M.match(/[.!?]$/) ? " " : ". ";
8148
+ A = `${M}${Q}${W}`;
8109
8149
  } else
8110
8150
  A = v?.avatar_script || v?.body || null;
8111
8151
  if (c.current && c.current.isReady && A) {
8112
8152
  l.current.isTeaching = !0, l.current.isQuestionMode = !1, l.current.score = 0, l.current.totalQuestions = 0, c.current.setMood("happy");
8113
- let F = !1;
8153
+ let M = !1;
8114
8154
  if (e.teaching)
8115
8155
  try {
8116
- c.current.playAnimation(e.teaching, !0), F = !0;
8117
- } catch (Y) {
8118
- console.warn("Failed to play teaching animation:", Y);
8156
+ c.current.playAnimation(e.teaching, !0), M = !0;
8157
+ } catch (Q) {
8158
+ console.warn("Failed to play teaching animation:", Q);
8119
8159
  }
8120
- F || c.current.setBodyMovement("gesturing");
8121
- const U = T.current || { lipsyncLang: "en" };
8160
+ M || c.current.setBodyMovement("gesturing");
8161
+ const W = F.current || { lipsyncLang: "en" };
8122
8162
  d.current.onLessonStart({
8123
8163
  moduleIndex: l.current.currentModuleIndex,
8124
8164
  lessonIndex: l.current.currentLessonIndex,
@@ -8129,7 +8169,7 @@ const It = Be(({
8129
8169
  lessonIndex: l.current.currentLessonIndex,
8130
8170
  lesson: v
8131
8171
  }), c.current.speakText(A, {
8132
- lipsyncLang: U.lipsyncLang,
8172
+ lipsyncLang: W.lipsyncLang,
8133
8173
  onSpeechEnd: () => {
8134
8174
  l.current.isTeaching = !1, d.current.onCustomAction({
8135
8175
  type: "teachingComplete",
@@ -8147,17 +8187,17 @@ const It = Be(({
8147
8187
  }
8148
8188
  });
8149
8189
  }
8150
- }, [e.teaching, I]), j = G((v) => {
8151
- const A = N(), F = L(v, A);
8152
- if (F && (l.current.score += 1), d.current.onQuestionAnswer({
8190
+ }, [e.teaching, I]), Y = V((v) => {
8191
+ const A = U(), M = S(v, A);
8192
+ if (M && (l.current.score += 1), d.current.onQuestionAnswer({
8153
8193
  moduleIndex: l.current.currentModuleIndex,
8154
8194
  lessonIndex: l.current.currentLessonIndex,
8155
8195
  questionIndex: l.current.currentQuestionIndex,
8156
8196
  answer: v,
8157
- isCorrect: F,
8197
+ isCorrect: M,
8158
8198
  question: A
8159
8199
  }), c.current)
8160
- if (F) {
8200
+ if (M) {
8161
8201
  if (c.current.setMood("happy"), e.correct)
8162
8202
  try {
8163
8203
  c.current.playReaction("happy");
@@ -8165,13 +8205,13 @@ const It = Be(({
8165
8205
  c.current.setBodyMovement("happy");
8166
8206
  }
8167
8207
  c.current.setBodyMovement("gesturing");
8168
- const Y = I()?.questions?.length || 0;
8169
- l.current.currentQuestionIndex >= Y - 1;
8170
- const re = l.current.currentQuestionIndex < Y - 1;
8171
- console.log("[CurriculumLearning] Answer feedback - questionIndex:", l.current.currentQuestionIndex, "totalQuestions:", Y, "hasNextQuestion:", re);
8172
- const K = A.type === "code_test" ? `Great job! Your code passed all the tests! ${A.explanation || ""}` : `Excellent! That's correct! ${A.explanation || ""}`, te = T.current || { lipsyncLang: "en" };
8173
- c.current.speakText(K, {
8174
- lipsyncLang: te.lipsyncLang,
8208
+ const Q = I()?.questions?.length || 0;
8209
+ l.current.currentQuestionIndex >= Q - 1;
8210
+ const re = l.current.currentQuestionIndex < Q - 1;
8211
+ console.log("[CurriculumLearning] Answer feedback - questionIndex:", l.current.currentQuestionIndex, "totalQuestions:", Q, "hasNextQuestion:", re);
8212
+ const $ = A.type === "code_test" ? `Great job! Your code passed all the tests! ${A.explanation || ""}` : `Excellent! That's correct! ${A.explanation || ""}`, ne = F.current || { lipsyncLang: "en" };
8213
+ c.current.speakText($, {
8214
+ lipsyncLang: ne.lipsyncLang,
8175
8215
  onSpeechEnd: () => {
8176
8216
  d.current.onCustomAction({
8177
8217
  type: "answerFeedbackComplete",
@@ -8193,11 +8233,11 @@ const It = Be(({
8193
8233
  c.current.setBodyMovement("idle");
8194
8234
  }
8195
8235
  c.current.setBodyMovement("gesturing");
8196
- const Y = I()?.questions?.length || 0, re = l.current.currentQuestionIndex >= Y - 1, K = l.current.currentQuestionIndex < Y - 1;
8197
- console.log("[CurriculumLearning] Answer feedback (incorrect) - questionIndex:", l.current.currentQuestionIndex, "totalQuestions:", Y, "hasNextQuestion:", K);
8198
- const te = A.type === "code_test" ? `Your code didn't pass all the tests. ${A.explanation || "Try again!"}` : `Not quite right, but don't worry! ${A.explanation || ""}${re ? "" : " Let's move on to the next question."}`, ye = T.current || { lipsyncLang: "en" };
8199
- c.current.speakText(te, {
8200
- lipsyncLang: ye.lipsyncLang,
8236
+ const Q = I()?.questions?.length || 0, re = l.current.currentQuestionIndex >= Q - 1, $ = l.current.currentQuestionIndex < Q - 1;
8237
+ console.log("[CurriculumLearning] Answer feedback (incorrect) - questionIndex:", l.current.currentQuestionIndex, "totalQuestions:", Q, "hasNextQuestion:", $);
8238
+ const ne = A.type === "code_test" ? `Your code didn't pass all the tests. ${A.explanation || "Try again!"}` : `Not quite right, but don't worry! ${A.explanation || ""}${re ? "" : " Let's move on to the next question."}`, fe = F.current || { lipsyncLang: "en" };
8239
+ c.current.speakText(ne, {
8240
+ lipsyncLang: fe.lipsyncLang,
8201
8241
  onSpeechEnd: () => {
8202
8242
  d.current.onCustomAction({
8203
8243
  type: "answerFeedbackComplete",
@@ -8205,7 +8245,7 @@ const It = Be(({
8205
8245
  lessonIndex: l.current.currentLessonIndex,
8206
8246
  questionIndex: l.current.currentQuestionIndex,
8207
8247
  isCorrect: !1,
8208
- hasNextQuestion: K,
8248
+ hasNextQuestion: $,
8209
8249
  score: l.current.score,
8210
8250
  totalQuestions: l.current.totalQuestions
8211
8251
  });
@@ -8213,21 +8253,21 @@ const It = Be(({
8213
8253
  });
8214
8254
  }
8215
8255
  else {
8216
- const Y = I()?.questions?.length || 0;
8256
+ const Q = I()?.questions?.length || 0;
8217
8257
  d.current.onCustomAction({
8218
8258
  type: "answerFeedbackComplete",
8219
8259
  moduleIndex: l.current.currentModuleIndex,
8220
8260
  lessonIndex: l.current.currentLessonIndex,
8221
8261
  questionIndex: l.current.currentQuestionIndex,
8222
- isCorrect: F,
8223
- hasNextQuestion: l.current.currentQuestionIndex < Y - 1,
8262
+ isCorrect: M,
8263
+ hasNextQuestion: l.current.currentQuestionIndex < Q - 1,
8224
8264
  score: l.current.score,
8225
8265
  totalQuestions: l.current.totalQuestions,
8226
8266
  avatarNotReady: !0
8227
8267
  });
8228
8268
  }
8229
- }, [e.correct, e.incorrect, N, I, L]), ae = G((v) => {
8230
- const A = N();
8269
+ }, [e.correct, e.incorrect, U, I, S]), ae = V((v) => {
8270
+ const A = U();
8231
8271
  if (!v || typeof v != "object") {
8232
8272
  console.error("Invalid code test result format. Expected object with {passed: boolean, ...}");
8233
8273
  return;
@@ -8236,7 +8276,7 @@ const It = Be(({
8236
8276
  console.warn("Current question is not a code test. Use handleAnswerSelect for other question types.");
8237
8277
  return;
8238
8278
  }
8239
- const F = {
8279
+ const M = {
8240
8280
  passed: v.passed === !0,
8241
8281
  results: v.results || [],
8242
8282
  output: v.output || "",
@@ -8251,13 +8291,13 @@ const It = Be(({
8251
8291
  moduleIndex: l.current.currentModuleIndex,
8252
8292
  lessonIndex: l.current.currentLessonIndex,
8253
8293
  questionIndex: l.current.currentQuestionIndex,
8254
- testResult: F,
8294
+ testResult: M,
8255
8295
  question: A
8256
- }), g.current && g.current(F);
8257
- }, [N, L]), ce = G(() => {
8296
+ }), g.current && g.current(M);
8297
+ }, [U, S]), ce = V(() => {
8258
8298
  if (l.current.currentQuestionIndex > 0) {
8259
8299
  l.current.currentQuestionIndex -= 1;
8260
- const v = N();
8300
+ const v = U();
8261
8301
  v && d.current.onCustomAction({
8262
8302
  type: "questionStart",
8263
8303
  moduleIndex: l.current.currentModuleIndex,
@@ -8270,26 +8310,26 @@ const It = Be(({
8270
8310
  const A = () => {
8271
8311
  if (!c.current || !v) return;
8272
8312
  c.current.setMood("happy"), c.current.setBodyMovement("idle");
8273
- const F = T.current || { lipsyncLang: "en" };
8313
+ const M = F.current || { lipsyncLang: "en" };
8274
8314
  v.type === "code_test" ? c.current.speakText(`Let's go back to this coding challenge: ${v.question}`, {
8275
- lipsyncLang: F.lipsyncLang
8315
+ lipsyncLang: M.lipsyncLang
8276
8316
  }) : c.current.speakText(`Going back to: ${v.question}`, {
8277
- lipsyncLang: F.lipsyncLang
8317
+ lipsyncLang: M.lipsyncLang
8278
8318
  });
8279
8319
  };
8280
8320
  if (c.current && c.current.isReady && v)
8281
8321
  A();
8282
8322
  else if (v) {
8283
- const F = setInterval(() => {
8284
- c.current && c.current.isReady && (clearInterval(F), A());
8323
+ const M = setInterval(() => {
8324
+ c.current && c.current.isReady && (clearInterval(M), A());
8285
8325
  }, 100);
8286
8326
  setTimeout(() => {
8287
- clearInterval(F);
8327
+ clearInterval(M);
8288
8328
  }, 5e3);
8289
8329
  }
8290
8330
  }
8291
- }, [N]), xe = G(() => {
8292
- const v = D.current || { modules: [] };
8331
+ }, [U]), be = V(() => {
8332
+ const v = N.current || { modules: [] };
8293
8333
  if (v.modules[l.current.currentModuleIndex], l.current.currentLessonIndex > 0)
8294
8334
  l.current.currentLessonIndex -= 1, l.current.currentQuestionIndex = 0, l.current.lessonCompleted = !1, l.current.isQuestionMode = !1, l.current.isTeaching = !1, l.current.score = 0, l.current.totalQuestions = 0, d.current.onCustomAction({
8295
8335
  type: "lessonStart",
@@ -8301,8 +8341,8 @@ const It = Be(({
8301
8341
  lesson: I()
8302
8342
  }), c.current && (c.current.setMood("happy"), c.current.setBodyMovement("idle"));
8303
8343
  else if (l.current.currentModuleIndex > 0) {
8304
- const U = v.modules[l.current.currentModuleIndex - 1];
8305
- l.current.currentModuleIndex -= 1, l.current.currentLessonIndex = (U?.lessons?.length || 1) - 1, l.current.currentQuestionIndex = 0, l.current.lessonCompleted = !1, l.current.isQuestionMode = !1, l.current.isTeaching = !1, l.current.score = 0, l.current.totalQuestions = 0, d.current.onCustomAction({
8344
+ const W = v.modules[l.current.currentModuleIndex - 1];
8345
+ l.current.currentModuleIndex -= 1, l.current.currentLessonIndex = (W?.lessons?.length || 1) - 1, l.current.currentQuestionIndex = 0, l.current.lessonCompleted = !1, l.current.isQuestionMode = !1, l.current.isTeaching = !1, l.current.score = 0, l.current.totalQuestions = 0, d.current.onCustomAction({
8306
8346
  type: "lessonStart",
8307
8347
  moduleIndex: l.current.currentModuleIndex,
8308
8348
  lessonIndex: l.current.currentLessonIndex
@@ -8312,40 +8352,40 @@ const It = Be(({
8312
8352
  lesson: I()
8313
8353
  }), c.current && (c.current.setMood("happy"), c.current.setBodyMovement("idle"));
8314
8354
  }
8315
- }, [I]), se = G(() => {
8355
+ }, [I]), se = V(() => {
8316
8356
  l.current.currentModuleIndex = 0, l.current.currentLessonIndex = 0, l.current.currentQuestionIndex = 0, l.current.isTeaching = !1, l.current.isQuestionMode = !1, l.current.lessonCompleted = !1, l.current.curriculumCompleted = !1, l.current.score = 0, l.current.totalQuestions = 0;
8317
- }, []), Ie = G((v) => {
8357
+ }, []), Se = V((v) => {
8318
8358
  console.log("Avatar is ready!", v);
8319
- const A = I(), F = A?.avatar_script || A?.body;
8320
- u && F && setTimeout(() => {
8359
+ const A = I(), M = A?.avatar_script || A?.body;
8360
+ u && M && setTimeout(() => {
8321
8361
  h.current && h.current();
8322
8362
  }, 10);
8323
8363
  }, [u, I]);
8324
- Ke(() => {
8325
- h.current = E, p.current = O, b.current = R, f.current = M, S.current = z, B.current = y, g.current = j;
8326
- }), Oe(a, () => ({
8364
+ Je(() => {
8365
+ h.current = B, p.current = D, b.current = R, f.current = E, k.current = z, T.current = y, g.current = Y;
8366
+ }), Ue(a, () => ({
8327
8367
  // Curriculum control methods
8328
- startTeaching: E,
8368
+ startTeaching: B,
8329
8369
  startQuestions: y,
8330
- handleAnswerSelect: j,
8370
+ handleAnswerSelect: Y,
8331
8371
  handleCodeTestResult: ae,
8332
- nextQuestion: M,
8372
+ nextQuestion: E,
8333
8373
  previousQuestion: ce,
8334
- nextLesson: O,
8335
- previousLesson: xe,
8374
+ nextLesson: D,
8375
+ previousLesson: be,
8336
8376
  completeLesson: R,
8337
8377
  completeCurriculum: z,
8338
8378
  resetCurriculum: se,
8339
8379
  getState: () => ({ ...l.current }),
8340
- getCurrentQuestion: () => N(),
8380
+ getCurrentQuestion: () => U(),
8341
8381
  getCurrentLesson: () => I(),
8342
8382
  // Direct access to avatar ref (always returns current value)
8343
8383
  getAvatarRef: () => c.current,
8344
8384
  // Convenience methods that delegate to avatar (always check current ref)
8345
8385
  speakText: async (v, A = {}) => {
8346
8386
  await c.current?.resumeAudioContext?.();
8347
- const F = T.current || { lipsyncLang: "en" };
8348
- c.current?.speakText(v, { ...A, lipsyncLang: A.lipsyncLang || F.lipsyncLang });
8387
+ const M = F.current || { lipsyncLang: "en" };
8388
+ c.current?.speakText(v, { ...A, lipsyncLang: A.lipsyncLang || M.lipsyncLang });
8349
8389
  },
8350
8390
  resumeAudioContext: async () => {
8351
8391
  if (c.current?.resumeAudioContext)
@@ -8356,8 +8396,8 @@ const It = Be(({
8356
8396
  if (A.state === "suspended" || A.state === "interrupted")
8357
8397
  try {
8358
8398
  await A.resume(), console.log("Audio context resumed via talkingHead");
8359
- } catch (F) {
8360
- console.warn("Failed to resume audio context:", F);
8399
+ } catch (M) {
8400
+ console.warn("Failed to resume audio context:", M);
8361
8401
  }
8362
8402
  } else
8363
8403
  console.warn("Audio context not available yet");
@@ -8389,8 +8429,8 @@ const It = Be(({
8389
8429
  handleResize: () => c.current?.handleResize(),
8390
8430
  // Avatar readiness check (always returns current value)
8391
8431
  isAvatarReady: () => c.current?.isReady || !1
8392
- }), [E, y, j, ae, M, O, R, z, se, N, I]);
8393
- const ee = T.current || {
8432
+ }), [B, y, Y, ae, E, D, R, z, se, U, I]);
8433
+ const te = F.current || {
8394
8434
  avatarUrl: "/avatars/brunette.glb",
8395
8435
  avatarBody: "F",
8396
8436
  mood: "happy",
@@ -8403,23 +8443,23 @@ const It = Be(({
8403
8443
  showFullAvatar: !1,
8404
8444
  animations: e
8405
8445
  };
8406
- return /* @__PURE__ */ J("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ J(
8407
- Ye,
8446
+ return /* @__PURE__ */ ee("div", { style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ ee(
8447
+ _e,
8408
8448
  {
8409
8449
  ref: c,
8410
- avatarUrl: ee.avatarUrl,
8411
- avatarBody: ee.avatarBody,
8412
- mood: ee.mood,
8413
- ttsLang: ee.ttsLang,
8414
- ttsService: ee.ttsService,
8415
- ttsVoice: ee.ttsVoice,
8416
- ttsApiKey: ee.ttsApiKey,
8417
- bodyMovement: ee.bodyMovement,
8418
- movementIntensity: ee.movementIntensity,
8419
- showFullAvatar: ee.showFullAvatar,
8450
+ avatarUrl: te.avatarUrl,
8451
+ avatarBody: te.avatarBody,
8452
+ mood: te.mood,
8453
+ ttsLang: te.ttsLang,
8454
+ ttsService: te.ttsService,
8455
+ ttsVoice: te.ttsVoice,
8456
+ ttsApiKey: te.ttsApiKey,
8457
+ bodyMovement: te.bodyMovement,
8458
+ movementIntensity: te.movementIntensity,
8459
+ showFullAvatar: te.showFullAvatar,
8420
8460
  cameraView: "upper",
8421
- animations: ee.animations,
8422
- onReady: Ie,
8461
+ animations: te.animations,
8462
+ onReady: Se,
8423
8463
  onLoading: () => {
8424
8464
  },
8425
8465
  onError: (v) => {
@@ -8428,50 +8468,50 @@ const It = Be(({
8428
8468
  }
8429
8469
  ) });
8430
8470
  });
8431
- It.displayName = "CurriculumLearning";
8432
- function Ft({
8433
- manifestPath: Z = "/animations/manifest.json",
8471
+ St.displayName = "CurriculumLearning";
8472
+ function Pt({
8473
+ manifestPath: G = "/animations/manifest.json",
8434
8474
  avatarBody: t = "F",
8435
8475
  onAnimationPlay: e = null,
8436
8476
  onAnimationsSelected: n = null,
8437
8477
  onDeleteAnimations: i = null,
8438
8478
  style: s = {}
8439
8479
  }) {
8440
- const [o, r] = le([]), [u, a] = le(/* @__PURE__ */ new Set()), [c, l] = le(!0), [d, h] = le(null), [p, b] = le("all"), [f, S] = le("");
8441
- ge(() => {
8480
+ const [o, r] = le([]), [u, a] = le(/* @__PURE__ */ new Set()), [c, l] = le(!0), [d, h] = le(null), [p, b] = le("all"), [f, k] = le("");
8481
+ ye(() => {
8442
8482
  (async () => {
8443
8483
  l(!0), h(null);
8444
8484
  try {
8445
- const z = await Qe(Z), y = [];
8485
+ const z = await Me(G), y = [];
8446
8486
  if (z._genderSpecific) {
8447
- const O = (t?.toUpperCase() || "F") === "M" ? "male" : "female";
8448
- z._genderSpecific[O] && Object.entries(z._genderSpecific[O]).forEach(([E, j]) => {
8449
- (Array.isArray(j) ? j : [j]).forEach((ce) => {
8487
+ const D = (t?.toUpperCase() || "F") === "M" ? "male" : "female";
8488
+ z._genderSpecific[D] && Object.entries(z._genderSpecific[D]).forEach(([B, Y]) => {
8489
+ (Array.isArray(Y) ? Y : [Y]).forEach((ce) => {
8450
8490
  y.push({
8451
8491
  path: ce,
8452
- group: E,
8453
- gender: O,
8492
+ group: B,
8493
+ gender: D,
8454
8494
  name: ce.split("/").pop().replace(".fbx", "")
8455
8495
  });
8456
8496
  });
8457
- }), z._genderSpecific.shared && Object.entries(z._genderSpecific.shared).forEach(([E, j]) => {
8458
- (Array.isArray(j) ? j : [j]).forEach((ce) => {
8497
+ }), z._genderSpecific.shared && Object.entries(z._genderSpecific.shared).forEach(([B, Y]) => {
8498
+ (Array.isArray(Y) ? Y : [Y]).forEach((ce) => {
8459
8499
  y.push({
8460
8500
  path: ce,
8461
- group: E,
8501
+ group: B,
8462
8502
  gender: "shared",
8463
8503
  name: ce.split("/").pop().replace(".fbx", "")
8464
8504
  });
8465
8505
  });
8466
8506
  });
8467
8507
  }
8468
- Object.entries(z).forEach(([M, O]) => {
8469
- M !== "_genderSpecific" && (Array.isArray(O) ? O : [O]).forEach((j) => {
8470
- typeof j == "string" && y.push({
8471
- path: j,
8472
- group: M,
8508
+ Object.entries(z).forEach(([E, D]) => {
8509
+ E !== "_genderSpecific" && (Array.isArray(D) ? D : [D]).forEach((Y) => {
8510
+ typeof Y == "string" && y.push({
8511
+ path: Y,
8512
+ group: E,
8473
8513
  gender: "root",
8474
- name: j.split("/").pop().replace(".fbx", "")
8514
+ name: Y.split("/").pop().replace(".fbx", "")
8475
8515
  });
8476
8516
  });
8477
8517
  }), r(y), l(!1);
@@ -8479,14 +8519,14 @@ function Ft({
8479
8519
  console.error("Failed to load animations:", z), h(z.message), l(!1);
8480
8520
  }
8481
8521
  })();
8482
- }, [Z, t]);
8483
- const B = ["all", ...new Set(o.map((R) => R.group))], g = o.filter((R) => {
8522
+ }, [G, t]);
8523
+ const T = ["all", ...new Set(o.map((R) => R.group))], g = o.filter((R) => {
8484
8524
  const z = p === "all" || R.group === p, y = f === "" || R.name.toLowerCase().includes(f.toLowerCase()) || R.path.toLowerCase().includes(f.toLowerCase());
8485
8525
  return z && y;
8486
- }), D = (R) => {
8526
+ }), N = (R) => {
8487
8527
  const z = new Set(u);
8488
8528
  z.has(R) ? z.delete(R) : z.add(R), a(z), n && n(Array.from(z));
8489
- }, T = () => {
8529
+ }, F = () => {
8490
8530
  const R = new Set(u);
8491
8531
  g.forEach((z) => {
8492
8532
  R.add(z.path);
@@ -8496,7 +8536,7 @@ function Ft({
8496
8536
  g.forEach((z) => {
8497
8537
  R.delete(z.path);
8498
8538
  }), a(R), n && n(Array.from(R));
8499
- }, N = () => {
8539
+ }, U = () => {
8500
8540
  const z = o.filter((y) => !u.has(y.path)).map((y) => y.path);
8501
8541
  if (z.length === 0) {
8502
8542
  alert("No animations to delete. Select animations to keep, then delete will remove the unselected ones.");
@@ -8508,35 +8548,35 @@ This will delete:
8508
8548
  ${z.slice(0, 5).join(`
8509
8549
  `)}${z.length > 5 ? `
8510
8550
  ...` : ""}`) && (i && i(z), r(o.filter((y) => u.has(y.path))), a(/* @__PURE__ */ new Set()));
8511
- }, L = (R) => {
8551
+ }, S = (R) => {
8512
8552
  e && e(R);
8513
8553
  };
8514
- return c ? /* @__PURE__ */ J("div", { style: { padding: "20px", textAlign: "center", ...s }, children: /* @__PURE__ */ J("p", { children: "Loading animations..." }) }) : d ? /* @__PURE__ */ J("div", { style: { padding: "20px", color: "red", ...s }, children: /* @__PURE__ */ ve("p", { children: [
8554
+ return c ? /* @__PURE__ */ ee("div", { style: { padding: "20px", textAlign: "center", ...s }, children: /* @__PURE__ */ ee("p", { children: "Loading animations..." }) }) : d ? /* @__PURE__ */ ee("div", { style: { padding: "20px", color: "red", ...s }, children: /* @__PURE__ */ Re("p", { children: [
8515
8555
  "Error loading animations: ",
8516
8556
  d
8517
- ] }) }) : /* @__PURE__ */ ve("div", { style: {
8557
+ ] }) }) : /* @__PURE__ */ Re("div", { style: {
8518
8558
  padding: "20px",
8519
8559
  backgroundColor: "#2a2a2a",
8520
8560
  borderRadius: "8px",
8521
8561
  color: "#fff",
8522
8562
  ...s
8523
8563
  }, children: [
8524
- /* @__PURE__ */ J("h2", { style: { marginTop: 0 }, children: "Animation Selector" }),
8525
- /* @__PURE__ */ J("p", { style: { color: "#aaa", fontSize: "14px" }, children: "Click buttons to play animations. Select animations to keep, then delete will remove the rest." }),
8526
- /* @__PURE__ */ ve("div", { style: {
8564
+ /* @__PURE__ */ ee("h2", { style: { marginTop: 0 }, children: "Animation Selector" }),
8565
+ /* @__PURE__ */ ee("p", { style: { color: "#aaa", fontSize: "14px" }, children: "Click buttons to play animations. Select animations to keep, then delete will remove the rest." }),
8566
+ /* @__PURE__ */ Re("div", { style: {
8527
8567
  display: "flex",
8528
8568
  gap: "10px",
8529
8569
  marginBottom: "20px",
8530
8570
  flexWrap: "wrap",
8531
8571
  alignItems: "center"
8532
8572
  }, children: [
8533
- /* @__PURE__ */ J(
8573
+ /* @__PURE__ */ ee(
8534
8574
  "input",
8535
8575
  {
8536
8576
  type: "text",
8537
8577
  placeholder: "Search animations...",
8538
8578
  value: f,
8539
- onChange: (R) => S(R.target.value),
8579
+ onChange: (R) => k(R.target.value),
8540
8580
  style: {
8541
8581
  padding: "8px 12px",
8542
8582
  borderRadius: "6px",
@@ -8549,7 +8589,7 @@ ${z.slice(0, 5).join(`
8549
8589
  }
8550
8590
  }
8551
8591
  ),
8552
- /* @__PURE__ */ J(
8592
+ /* @__PURE__ */ ee(
8553
8593
  "select",
8554
8594
  {
8555
8595
  value: p,
@@ -8562,13 +8602,13 @@ ${z.slice(0, 5).join(`
8562
8602
  color: "#fff",
8563
8603
  fontSize: "14px"
8564
8604
  },
8565
- children: B.map((R) => /* @__PURE__ */ J("option", { value: R, children: R === "all" ? "All Groups" : R }, R))
8605
+ children: T.map((R) => /* @__PURE__ */ ee("option", { value: R, children: R === "all" ? "All Groups" : R }, R))
8566
8606
  }
8567
8607
  ),
8568
- /* @__PURE__ */ J(
8608
+ /* @__PURE__ */ ee(
8569
8609
  "button",
8570
8610
  {
8571
- onClick: T,
8611
+ onClick: F,
8572
8612
  style: {
8573
8613
  padding: "8px 16px",
8574
8614
  backgroundColor: "#4CAF50",
@@ -8581,7 +8621,7 @@ ${z.slice(0, 5).join(`
8581
8621
  children: "Select All Visible"
8582
8622
  }
8583
8623
  ),
8584
- /* @__PURE__ */ J(
8624
+ /* @__PURE__ */ ee(
8585
8625
  "button",
8586
8626
  {
8587
8627
  onClick: I,
@@ -8597,10 +8637,10 @@ ${z.slice(0, 5).join(`
8597
8637
  children: "Deselect All Visible"
8598
8638
  }
8599
8639
  ),
8600
- /* @__PURE__ */ ve(
8640
+ /* @__PURE__ */ Re(
8601
8641
  "button",
8602
8642
  {
8603
- onClick: N,
8643
+ onClick: U,
8604
8644
  style: {
8605
8645
  padding: "8px 16px",
8606
8646
  backgroundColor: "#f44336",
@@ -8619,7 +8659,7 @@ ${z.slice(0, 5).join(`
8619
8659
  }
8620
8660
  )
8621
8661
  ] }),
8622
- /* @__PURE__ */ ve("div", { style: {
8662
+ /* @__PURE__ */ Re("div", { style: {
8623
8663
  marginBottom: "15px",
8624
8664
  fontSize: "14px",
8625
8665
  color: "#aaa"
@@ -8631,7 +8671,7 @@ ${z.slice(0, 5).join(`
8631
8671
  " | Showing: ",
8632
8672
  g.length
8633
8673
  ] }),
8634
- /* @__PURE__ */ J("div", { style: {
8674
+ /* @__PURE__ */ ee("div", { style: {
8635
8675
  display: "grid",
8636
8676
  gridTemplateColumns: "repeat(auto-fill, minmax(200px, 1fr))",
8637
8677
  gap: "10px",
@@ -8642,7 +8682,7 @@ ${z.slice(0, 5).join(`
8642
8682
  borderRadius: "6px"
8643
8683
  }, children: g.map((R, z) => {
8644
8684
  const y = u.has(R.path);
8645
- return /* @__PURE__ */ ve(
8685
+ return /* @__PURE__ */ Re(
8646
8686
  "div",
8647
8687
  {
8648
8688
  style: {
@@ -8653,39 +8693,39 @@ ${z.slice(0, 5).join(`
8653
8693
  cursor: "pointer",
8654
8694
  transition: "all 0.2s"
8655
8695
  },
8656
- onClick: () => D(R.path),
8696
+ onClick: () => N(R.path),
8657
8697
  children: [
8658
- /* @__PURE__ */ ve("div", { style: { marginBottom: "8px" }, children: [
8659
- /* @__PURE__ */ J(
8698
+ /* @__PURE__ */ Re("div", { style: { marginBottom: "8px" }, children: [
8699
+ /* @__PURE__ */ ee(
8660
8700
  "input",
8661
8701
  {
8662
8702
  type: "checkbox",
8663
8703
  checked: y,
8664
- onChange: () => D(R.path),
8665
- onClick: (M) => M.stopPropagation(),
8704
+ onChange: () => N(R.path),
8705
+ onClick: (E) => E.stopPropagation(),
8666
8706
  style: {
8667
8707
  marginRight: "8px",
8668
8708
  cursor: "pointer"
8669
8709
  }
8670
8710
  }
8671
8711
  ),
8672
- /* @__PURE__ */ ve("span", { style: { fontSize: "12px", color: "#aaa" }, children: [
8712
+ /* @__PURE__ */ Re("span", { style: { fontSize: "12px", color: "#aaa" }, children: [
8673
8713
  R.group,
8674
8714
  " ",
8675
8715
  R.gender !== "root" && `(${R.gender})`
8676
8716
  ] })
8677
8717
  ] }),
8678
- /* @__PURE__ */ J("div", { style: {
8718
+ /* @__PURE__ */ ee("div", { style: {
8679
8719
  fontSize: "13px",
8680
8720
  fontWeight: "bold",
8681
8721
  marginBottom: "8px",
8682
8722
  wordBreak: "break-word"
8683
8723
  }, children: R.name }),
8684
- /* @__PURE__ */ J(
8724
+ /* @__PURE__ */ ee(
8685
8725
  "button",
8686
8726
  {
8687
- onClick: (M) => {
8688
- M.stopPropagation(), L(R.path);
8727
+ onClick: (E) => {
8728
+ E.stopPropagation(), S(R.path);
8689
8729
  },
8690
8730
  style: {
8691
8731
  width: "100%",
@@ -8705,14 +8745,14 @@ ${z.slice(0, 5).join(`
8705
8745
  `${R.path}-${z}`
8706
8746
  );
8707
8747
  }) }),
8708
- g.length === 0 && /* @__PURE__ */ J("div", { style: {
8748
+ g.length === 0 && /* @__PURE__ */ ee("div", { style: {
8709
8749
  padding: "40px",
8710
8750
  textAlign: "center",
8711
8751
  color: "#aaa"
8712
8752
  }, children: "No animations found matching your filters." })
8713
8753
  ] });
8714
8754
  }
8715
- const qe = {
8755
+ const Ke = {
8716
8756
  // Code-based dance animations (no FBX required)
8717
8757
  dance: {
8718
8758
  name: "dance",
@@ -8815,16 +8855,16 @@ const qe = {
8815
8855
  duration: 5e3,
8816
8856
  description: "Excited, energetic movement"
8817
8857
  }
8818
- }, Et = (Z) => qe[Z] || null, Pt = (Z) => qe.hasOwnProperty(Z);
8858
+ }, Bt = (G) => Ke[G] || null, Ot = (G) => Ke.hasOwnProperty(G);
8819
8859
  export {
8820
- Ft as AnimationSelector,
8821
- It as CurriculumLearning,
8822
- At as SimpleTalkingAvatar,
8823
- Ye as TalkingHeadAvatar,
8824
- vt as TalkingHeadComponent,
8825
- qe as animations,
8826
- De as getActiveTTSConfig,
8827
- Et as getAnimation,
8828
- Mt as getVoiceOptions,
8829
- Pt as hasAnimation
8860
+ Pt as AnimationSelector,
8861
+ St as CurriculumLearning,
8862
+ Lt as SimpleTalkingAvatar,
8863
+ _e as TalkingHeadAvatar,
8864
+ At as TalkingHeadComponent,
8865
+ Ke as animations,
8866
+ We as getActiveTTSConfig,
8867
+ Bt as getAnimation,
8868
+ Et as getVoiceOptions,
8869
+ Ot as hasAnimation
8830
8870
  };