@spatialwalk/avatarkit 1.0.0-beta.7 → 1.0.0-beta.8

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.
@@ -40,7 +40,7 @@ function an() {
40
40
  function on() {
41
41
  return an();
42
42
  }
43
- const M = {
43
+ const k = {
44
44
  testEnv: nn,
45
45
  // Dynamic debug mode check (includes URL parameter)
46
46
  get debug() {
@@ -497,7 +497,7 @@ let ft = () => {
497
497
  }, ir = (f, p, A) => Re(f, p).map((C) => String(C).padStart(A, "0")), Xe = (f, p) => Re($(f), $(p)).map(Fe), J = (f) => f, Qe = (f) => ar((p) => L(p, f, { memoization: !1 }).join("")), ar = (f) => {
498
498
  const p = {};
499
499
  return (A) => p[A] ?? (p[A] = f(A));
500
- }, or = _(/^\*\*\/\*$/, ".*"), sr = _(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (f, p, A) => `.*${p ? "" : "(?:^|/)"}${A.replaceAll(".", "\\.")}`), lr = _(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (f, p, A, C) => `.*${p ? "" : "(?:^|/)"}${A.replaceAll(".", "\\.")}(?:${C.replaceAll(",", "|").replaceAll(".", "\\.")})`), Le = _(/\\./, J), cr = _(/[$.*+?^(){}[\]\|]/, (f) => `\\${f}`), ur = _(/./, J), dr = _(/^(?:!!)*!(.*)$/, (f, p) => `(?!^${ot(p)}$).*?`), hr = _(/^(!!)+/, ""), fr = U([dr, hr]), mr = _(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = _(/^(\*\*\/)+/, "(?:^|.*/)"), pr = _(/\/(\*\*)$/, "(?:/.*|$)"), vr = _(/\*\*/, ".*"), et = U([mr, gr, pr, vr]), wr = _(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = _(/\*/, "[^/]*"), tt = U([wr, yr]), rt = _("?", "[^/]"), Ar = _("[", J), Sr = _("]", J), br = _(/[!^]/, "^/"), Cr = _(/[a-z]-[a-z]|[0-9]-[0-9]/i, J), _r = _(/[$.*+?^(){}[\|]/, (f) => `\\${f}`), Er = _(/[^\]]/, J), xr = U([Le, _r, Cr, Er]), nt = re([Ar, X(br), K(xr), Sr]), Pr = _("{", "(?:"), Ir = _("}", ")"), Mr = _(/(\d+)\.\.(\d+)/, (f, p, A) => ir(+p, +A, Math.min(p.length, A.length)).join("|")), kr = _(/([a-z]+)\.\.([a-z]+)/, (f, p, A) => Xe(p, A).join("|")), Fr = _(/([A-Z]+)\.\.([A-Z]+)/, (f, p, A) => Xe(p.toLowerCase(), A.toLowerCase()).join("|").toUpperCase()), Rr = U([Mr, kr, Fr]), it = re([Pr, Rr, Ir]), Lr = _("{", "(?:"), Tr = _("}", ")"), Br = _(",", "|"), Dr = _(/[$.*+?^(){[\]\|]/, (f) => `\\${f}`), Or = _(/[^}]/, J), Nr = T(() => at), Ur = U([et, tt, rt, nt, it, Nr, Le, Dr, Br, Or]), at = re([Lr, K(Ur), Tr]), zr = K(U([or, sr, lr, fr, et, tt, rt, nt, it, at, Le, cr, ur])), Vr = zr, $r = Qe(Vr), ot = $r, qr = _(/\\./, J), Wr = _(/./, J), Gr = _(/\*\*\*+/, "*"), jr = _(/([^/{[(!])\*\*/, (f, p) => `${p}*`), Hr = _(/(^|.)\*\*(?=[^*/)\]}])/, (f, p) => `${p}*`), Kr = K(U([qr, Gr, jr, Hr, Wr])), Jr = Kr, Zr = Qe(Jr), Yr = Zr, Te = (f, p) => {
500
+ }, or = _(/^\*\*\/\*$/, ".*"), sr = _(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (f, p, A) => `.*${p ? "" : "(?:^|/)"}${A.replaceAll(".", "\\.")}`), lr = _(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (f, p, A, C) => `.*${p ? "" : "(?:^|/)"}${A.replaceAll(".", "\\.")}(?:${C.replaceAll(",", "|").replaceAll(".", "\\.")})`), Le = _(/\\./, J), cr = _(/[$.*+?^(){}[\]\|]/, (f) => `\\${f}`), ur = _(/./, J), dr = _(/^(?:!!)*!(.*)$/, (f, p) => `(?!^${ot(p)}$).*?`), hr = _(/^(!!)+/, ""), fr = U([dr, hr]), mr = _(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = _(/^(\*\*\/)+/, "(?:^|.*/)"), pr = _(/\/(\*\*)$/, "(?:/.*|$)"), vr = _(/\*\*/, ".*"), et = U([mr, gr, pr, vr]), wr = _(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = _(/\*/, "[^/]*"), tt = U([wr, yr]), rt = _("?", "[^/]"), Ar = _("[", J), Sr = _("]", J), br = _(/[!^]/, "^/"), Cr = _(/[a-z]-[a-z]|[0-9]-[0-9]/i, J), _r = _(/[$.*+?^(){}[\|]/, (f) => `\\${f}`), Er = _(/[^\]]/, J), xr = U([Le, _r, Cr, Er]), nt = re([Ar, X(br), K(xr), Sr]), Pr = _("{", "(?:"), Ir = _("}", ")"), kr = _(/(\d+)\.\.(\d+)/, (f, p, A) => ir(+p, +A, Math.min(p.length, A.length)).join("|")), Mr = _(/([a-z]+)\.\.([a-z]+)/, (f, p, A) => Xe(p, A).join("|")), Fr = _(/([A-Z]+)\.\.([A-Z]+)/, (f, p, A) => Xe(p.toLowerCase(), A.toLowerCase()).join("|").toUpperCase()), Rr = U([kr, Mr, Fr]), it = re([Pr, Rr, Ir]), Lr = _("{", "(?:"), Tr = _("}", ")"), Br = _(",", "|"), Dr = _(/[$.*+?^(){[\]\|]/, (f) => `\\${f}`), Or = _(/[^}]/, J), Nr = T(() => at), Ur = U([et, tt, rt, nt, it, Nr, Le, Dr, Br, Or]), at = re([Lr, K(Ur), Tr]), zr = K(U([or, sr, lr, fr, et, tt, rt, nt, it, at, Le, cr, ur])), Vr = zr, $r = Qe(Vr), ot = $r, qr = _(/\\./, J), Wr = _(/./, J), Gr = _(/\*\*\*+/, "*"), jr = _(/([^/{[(!])\*\*/, (f, p) => `${p}*`), Hr = _(/(^|.)\*\*(?=[^*/)\]}])/, (f, p) => `${p}*`), Kr = K(U([qr, Gr, jr, Hr, Wr])), Jr = Kr, Zr = Qe(Jr), Yr = Zr, Te = (f, p) => {
501
501
  const A = Array.isArray(f) ? f : [f];
502
502
  if (!A.length) return !1;
503
503
  const C = A.map(Te.compile), E = A.every((R) => /(\/(?:\*\*)?|\[\/\])$/.test(R)), P = p.replace(/[\\\/]+/g, "/").replace(/\/$/, E ? "/" : "");
@@ -533,7 +533,7 @@ const mn = /^[/\\]{2}/, gn = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,
533
533
  function An() {
534
534
  return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
535
535
  }
536
- const Me = function(...r) {
536
+ const ke = function(...r) {
537
537
  r = r.map((n) => ce(n));
538
538
  let e = "", t = !1;
539
539
  for (let n = r.length - 1; n >= -1 && !t; n--) {
@@ -581,7 +581,7 @@ const ve = function(r) {
581
581
  const e = pn.exec(ce(r));
582
582
  return e && e[1] || "";
583
583
  }, bn = function(r, e) {
584
- const t = Me(r).replace(mt, "$1").split("/"), n = Me(e).replace(mt, "$1").split("/");
584
+ const t = ke(r).replace(mt, "$1").split("/"), n = ke(e).replace(mt, "$1").split("/");
585
585
  if (n[0][1] === ":" && t[0][1] === ":" && t[0] !== n[0])
586
586
  return n.join("/");
587
587
  const i = [...t];
@@ -599,7 +599,7 @@ const ve = function(r) {
599
599
  Boolean
600
600
  );
601
601
  return ce(
602
- r.root ? Me(...t) : t.join("/")
602
+ r.root ? ke(...t) : t.join("/")
603
603
  );
604
604
  }, Kt = function(r, e) {
605
605
  const t = ce(r).split("/");
@@ -635,7 +635,7 @@ const ve = function(r) {
635
635
  normalizeString: Ke,
636
636
  parse: _n,
637
637
  relative: bn,
638
- resolve: Me,
638
+ resolve: ke,
639
639
  sep: wn,
640
640
  toNamespacedPath: Sn
641
641
  }, xn = /* @__PURE__ */ (() => {
@@ -646,8 +646,8 @@ const ve = function(r) {
646
646
  return t === "delimiter" ? r : t === "posix" ? $e : t === "win32" ? In : Pn[t] || gt[t];
647
647
  }
648
648
  }), $e = /* @__PURE__ */ Jt(":"), In = /* @__PURE__ */ Jt(";");
649
- var k = /* @__PURE__ */ ((r) => (r[r.Error = 0] = "Error", r[r.Warning = 1] = "Warning", r[r.Log = 2] = "Log", r[r.Verbose = 3] = "Verbose", r[r.Debug = 4] = "Debug", r))(k || {}), I = /* @__PURE__ */ ((r) => (r.Error = "error", r.Warning = "warn", r.Log = "log", r.Verbose = "verbose", r.Debug = "debug", r))(I || {}), te = /* @__PURE__ */ ((r) => (r.JSON = "json", r.Pretty = "pretty", r))(te || {});
650
- const Mn = !0;
649
+ var M = /* @__PURE__ */ ((r) => (r[r.Error = 0] = "Error", r[r.Warning = 1] = "Warning", r[r.Log = 2] = "Log", r[r.Verbose = 3] = "Verbose", r[r.Debug = 4] = "Debug", r))(M || {}), I = /* @__PURE__ */ ((r) => (r.Error = "error", r.Warning = "warn", r.Log = "log", r.Verbose = "verbose", r.Debug = "debug", r))(I || {}), te = /* @__PURE__ */ ((r) => (r.JSON = "json", r.Pretty = "pretty", r))(te || {});
650
+ const kn = !0;
651
651
  function F(r, e, t = r) {
652
652
  return (n) => {
653
653
  const i = `${n}`, a = i.indexOf(e, r.length);
@@ -658,7 +658,7 @@ function Zt(r, e, t, n) {
658
658
  const i = r.substring(0, n) + t, a = r.substring(n + e.length), o = a.indexOf(e);
659
659
  return ~o ? i + Zt(a, e, t, o) : i + a;
660
660
  }
661
- function kn(r = Mn) {
661
+ function Mn(r = kn) {
662
662
  return {
663
663
  isColorSupported: r,
664
664
  reset: r ? (e) => `\x1B[0m${e}\x1B[0m` : String,
@@ -688,18 +688,18 @@ function kn(r = Mn) {
688
688
  bgWhite: r ? F("\x1B[47m", "\x1B[49m") : String
689
689
  };
690
690
  }
691
- const B = kn(), qe = {
692
- [I.Error]: k.Error,
693
- [I.Warning]: k.Warning,
694
- [I.Log]: k.Log,
695
- [I.Verbose]: k.Verbose,
696
- [I.Debug]: k.Debug
691
+ const B = Mn(), qe = {
692
+ [I.Error]: M.Error,
693
+ [I.Warning]: M.Warning,
694
+ [I.Log]: M.Log,
695
+ [I.Verbose]: M.Verbose,
696
+ [I.Debug]: M.Debug
697
697
  }, Fn = {
698
- [k.Error]: I.Error,
699
- [k.Warning]: I.Warning,
700
- [k.Log]: I.Log,
701
- [k.Verbose]: I.Verbose,
702
- [k.Debug]: I.Debug
698
+ [M.Error]: I.Error,
699
+ [M.Warning]: I.Warning,
700
+ [M.Log]: I.Log,
701
+ [M.Verbose]: I.Verbose,
702
+ [M.Debug]: I.Debug
703
703
  }, pt = [
704
704
  I.Error,
705
705
  I.Warning,
@@ -707,17 +707,17 @@ const B = kn(), qe = {
707
707
  I.Verbose,
708
708
  I.Debug
709
709
  ], Rn = {
710
- [k.Error]: B.red,
711
- [k.Warning]: B.yellow,
712
- [k.Log]: B.blue,
713
- [k.Verbose]: B.cyan,
714
- [k.Debug]: B.green
710
+ [M.Error]: B.red,
711
+ [M.Warning]: B.yellow,
712
+ [M.Log]: B.blue,
713
+ [M.Verbose]: B.cyan,
714
+ [M.Debug]: B.green
715
715
  }, vt = [
716
- k.Error,
717
- k.Warning,
718
- k.Log,
719
- k.Verbose,
720
- k.Debug
716
+ M.Error,
717
+ M.Warning,
718
+ M.Log,
719
+ M.Verbose,
720
+ M.Debug
721
721
  ], wt = [te.JSON, te.Pretty];
722
722
  function Ln(r) {
723
723
  return r.stack == null ? [] : r.stack.split(`
@@ -812,19 +812,19 @@ function Ee(r) {
812
812
  ${r.error.stack}`), i;
813
813
  }
814
814
  function Bn(r) {
815
- return r >= k.Debug;
815
+ return r >= M.Debug;
816
816
  }
817
817
  function Dn(r) {
818
- return r >= k.Verbose;
818
+ return r >= M.Verbose;
819
819
  }
820
820
  function On(r) {
821
- return r >= k.Log;
821
+ return r >= M.Log;
822
822
  }
823
823
  function Nn(r) {
824
- return r >= k.Warning;
824
+ return r >= M.Warning;
825
825
  }
826
826
  function Un(r) {
827
- return r >= k.Error;
827
+ return r >= M.Error;
828
828
  }
829
829
  function Qt() {
830
830
  return typeof window < "u";
@@ -836,7 +836,7 @@ function Vn(r, e) {
836
836
  return zn() ? `\x1B]8;;file://${r}\x1B\\${e}\x1B]8;;\x1B\\` : e;
837
837
  }
838
838
  const Je = {
839
- logLevel: k.Debug,
839
+ logLevel: M.Debug,
840
840
  format: te.JSON,
841
841
  timeFormatter: (r) => r.toISOString()
842
842
  };
@@ -853,7 +853,7 @@ function er(r) {
853
853
  const e = {
854
854
  fields: {},
855
855
  context: r,
856
- logLevel: k.Debug,
856
+ logLevel: M.Debug,
857
857
  format: te.JSON,
858
858
  shouldUseGlobalConfig: !1,
859
859
  errorProcessor: (c) => c,
@@ -1960,7 +1960,7 @@ class b {
1960
1960
  h[a](`[Telemetry] ${e}`, i);
1961
1961
  }
1962
1962
  }
1963
- d(b, "_isInitialized", !1), d(b, "_configuration", null), d(b, "_sessionToken", null), d(b, "_userId", null), d(b, "_version", "1.0.0-beta.7"), d(b, "_avatarCore", null), d(b, "_dynamicSdkConfig", null), d(b, "_logLevels", {
1963
+ d(b, "_isInitialized", !1), d(b, "_configuration", null), d(b, "_sessionToken", null), d(b, "_userId", null), d(b, "_version", "1.0.0-beta.8"), d(b, "_avatarCore", null), d(b, "_dynamicSdkConfig", null), d(b, "_logLevels", {
1964
1964
  debug: "log",
1965
1965
  info: "log",
1966
1966
  warning: "warn",
@@ -1971,7 +1971,7 @@ const Ce = class Ce {
1971
1971
  d(this, "audio", null);
1972
1972
  d(this, "streamingPlayer", null);
1973
1973
  d(this, "_isPlaying", !1);
1974
- d(this, "fps", M.animation.fps);
1974
+ d(this, "fps", k.animation.fps);
1975
1975
  d(this, "onEndedCallback");
1976
1976
  d(this, "useStreaming", !1);
1977
1977
  }
@@ -2029,9 +2029,9 @@ const Ce = class Ce {
2029
2029
  async createAndInitializeStreamingPlayer() {
2030
2030
  if (this.streamingPlayer)
2031
2031
  return;
2032
- const { StreamingAudioPlayer: e } = await import("./StreamingAudioPlayer-D7s8q5h0.js");
2032
+ const { StreamingAudioPlayer: e } = await import("./StreamingAudioPlayer-fSZLLTe1.js");
2033
2033
  this.streamingPlayer = new e({
2034
- sampleRate: M.audio.sampleRate,
2034
+ sampleRate: k.audio.sampleRate,
2035
2035
  channelCount: 1,
2036
2036
  debug: !1
2037
2037
  });
@@ -2730,7 +2730,7 @@ const he = {
2730
2730
  return e.reqId = r.reqId ?? "", e.audio = r.audio ?? new Uint8Array(0), e.end = r.end ?? !1, e;
2731
2731
  }
2732
2732
  };
2733
- function Mt() {
2733
+ function kt() {
2734
2734
  return { translation: [], rotation: [], neckPose: [], jawPose: [], eyePose: [], eyeLid: [], expression: [] };
2735
2735
  }
2736
2736
  const fe = {
@@ -2761,7 +2761,7 @@ const fe = {
2761
2761
  decode(r, e) {
2762
2762
  const t = r instanceof O ? r : new O(r);
2763
2763
  let n = e === void 0 ? t.len : t.pos + e;
2764
- const i = Mt();
2764
+ const i = kt();
2765
2765
  for (; t.pos < n; ) {
2766
2766
  const a = t.uint32();
2767
2767
  switch (a >>> 3) {
@@ -2884,11 +2884,11 @@ const fe = {
2884
2884
  },
2885
2885
  fromPartial(r) {
2886
2886
  var t, n, i, a, o, s, l;
2887
- const e = Mt();
2887
+ const e = kt();
2888
2888
  return e.translation = ((t = r.translation) == null ? void 0 : t.map((g) => g)) || [], e.rotation = ((n = r.rotation) == null ? void 0 : n.map((g) => g)) || [], e.neckPose = ((i = r.neckPose) == null ? void 0 : i.map((g) => g)) || [], e.jawPose = ((a = r.jawPose) == null ? void 0 : a.map((g) => g)) || [], e.eyePose = ((o = r.eyePose) == null ? void 0 : o.map((g) => g)) || [], e.eyeLid = ((s = r.eyeLid) == null ? void 0 : s.map((g) => g)) || [], e.expression = ((l = r.expression) == null ? void 0 : l.map((g) => g)) || [], e;
2889
2889
  }
2890
2890
  };
2891
- function kt() {
2891
+ function Mt() {
2892
2892
  return { keyframes: [] };
2893
2893
  }
2894
2894
  const me = {
@@ -2900,7 +2900,7 @@ const me = {
2900
2900
  decode(r, e) {
2901
2901
  const t = r instanceof O ? r : new O(r);
2902
2902
  let n = e === void 0 ? t.len : t.pos + e;
2903
- const i = kt();
2903
+ const i = Mt();
2904
2904
  for (; t.pos < n; ) {
2905
2905
  const a = t.uint32();
2906
2906
  switch (a >>> 3) {
@@ -2932,7 +2932,7 @@ const me = {
2932
2932
  },
2933
2933
  fromPartial(r) {
2934
2934
  var t;
2935
- const e = kt();
2935
+ const e = Mt();
2936
2936
  return e.keyframes = ((t = r.keyframes) == null ? void 0 : t.map((n) => fe.fromPartial(n))) || [], e;
2937
2937
  }
2938
2938
  };
@@ -3341,7 +3341,7 @@ class Ai {
3341
3341
  // 组合播放层
3342
3342
  d(this, "currentReqId", null);
3343
3343
  d(this, "hasSentEnd", !1);
3344
- d(this, "audioBytesPerSecond", M.audio.sampleRate * 2);
3344
+ d(this, "audioBytesPerSecond", k.audio.sampleRate * 2);
3345
3345
  d(this, "audioMetrics", this.createAudioMetrics());
3346
3346
  this.dataController = e;
3347
3347
  const t = b.getEnvironmentConfig();
@@ -3753,7 +3753,7 @@ class Si {
3753
3753
  try {
3754
3754
  await this.animationPlayer.prepareStreamingPlayer(() => {
3755
3755
  var a, o;
3756
- this.isPlaying = !1, (a = this.onAvatarState) == null || a.call(this, Z.idle), this.emit("stopRendering"), b.logEvent("character_player", "info", {
3756
+ this.isPlaying = !1, (a = this.onAvatarState) == null || a.call(this, Z.idle), this.emit("stopRendering"), this.currentKeyframes = [], this.pendingAudioChunks = [], this.lastRenderedFrameIndex = -1, this.networkLayer && this.networkLayer.resetReqId(), b.logEvent("character_player", "info", {
3757
3757
  characterId: this.avatar.id,
3758
3758
  event: "playback_ended",
3759
3759
  reqId: ((o = this.networkLayer) == null ? void 0 : o.getCurrentReqId()) || void 0
@@ -3776,7 +3776,7 @@ class Si {
3776
3776
  startPlaybackLoop() {
3777
3777
  if (this.playbackLoopId)
3778
3778
  return;
3779
- const e = M.animation.fps, t = async () => {
3779
+ const e = k.animation.fps, t = async () => {
3780
3780
  if (!this.isPlaying || !this.animationPlayer) {
3781
3781
  this.playbackLoopId = null;
3782
3782
  return;
@@ -3942,7 +3942,7 @@ class Ci {
3942
3942
  * Uses centralized FLAME CDN config (shared across all characters)
3943
3943
  */
3944
3944
  async loadGlobalFlameResources(e = null) {
3945
- const { cdnBaseUrl: t, resources: n } = M.flame, i = {
3945
+ const { cdnBaseUrl: t, resources: n } = k.flame, i = {
3946
3946
  flameModel: {
3947
3947
  url: `${t}/${n.flameModel}`,
3948
3948
  resourceName: n.flameModel
@@ -4166,7 +4166,7 @@ class Ci {
4166
4166
  }
4167
4167
  }
4168
4168
  }
4169
- const ke = class ke {
4169
+ const Me = class Me {
4170
4170
  constructor() {
4171
4171
  d(this, "avatarDownloader", null);
4172
4172
  d(this, "_templateInitialized", !1);
@@ -4175,7 +4175,7 @@ const ke = class ke {
4175
4175
  * 通过全局单例来访问
4176
4176
  */
4177
4177
  static get shared() {
4178
- return this._instance || (this._instance = new ke()), this._instance;
4178
+ return this._instance || (this._instance = new Me()), this._instance;
4179
4179
  }
4180
4180
  /**
4181
4181
  * 加载数字人
@@ -4225,8 +4225,8 @@ const ke = class ke {
4225
4225
  this.avatarDownloader && this.avatarDownloader.clear();
4226
4226
  }
4227
4227
  };
4228
- d(ke, "_instance", null);
4229
- let Bt = ke, ye = null, Dt = null, Ot = null, Nt = null, Ut = null, zt = null;
4228
+ d(Me, "_instance", null);
4229
+ let Bt = Me, ye = null, Dt = null, Ot = null, Nt = null, Ut = null, zt = null;
4230
4230
  const Ye = 2048, Vt = Ye - 1;
4231
4231
  function _i(r, e, t) {
4232
4232
  const i = r.length / 13;
@@ -4699,7 +4699,7 @@ class Ii {
4699
4699
  this.isInitialized = !1;
4700
4700
  }
4701
4701
  }
4702
- const Mi = `/**
4702
+ const ki = `/**
4703
4703
  * WebGPU 3DGS 渲染着色器
4704
4704
  *
4705
4705
  * 实例化渲染:每个 splat 绘制一个四边形
@@ -4962,7 +4962,7 @@ fn fragmentMain(input: VertexOutput) -> @location(0) vec4f {
4962
4962
  return vec4f(input.color.rgb * alpha, alpha);
4963
4963
  }
4964
4964
  `;
4965
- class ki {
4965
+ class Mi {
4966
4966
  constructor(e, t) {
4967
4967
  d(this, "canvas");
4968
4968
  d(this, "backgroundColor");
@@ -5049,7 +5049,7 @@ class ki {
5049
5049
  return;
5050
5050
  const e = this.device.createShaderModule({
5051
5051
  label: "3DGS Render Shader",
5052
- code: Mi
5052
+ code: ki
5053
5053
  }), t = this.device.createBindGroupLayout({
5054
5054
  label: "Uniform Bind Group Layout",
5055
5055
  entries: [
@@ -5269,7 +5269,7 @@ class Fi {
5269
5269
  const { preferBackend: e, backgroundColor: t = [0, 0, 0, 0] } = this.options;
5270
5270
  if (e !== "webgl" && await this.checkWebGPUSupport())
5271
5271
  try {
5272
- this.renderer = new ki(this.canvas, t), await this.renderer.initialize(), this.backend = "webgpu", h.log("✅ Using WebGPU renderer"), this.updateCameraAspect();
5272
+ this.renderer = new Mi(this.canvas, t), await this.renderer.initialize(), this.backend = "webgpu", h.log("✅ Using WebGPU renderer"), this.updateCameraAspect();
5273
5273
  return;
5274
5274
  } catch (i) {
5275
5275
  h.warn("⚠️ WebGPU init failed, fallback to WebGL:", i);
@@ -5534,7 +5534,7 @@ class Ni {
5534
5534
  n.from,
5535
5535
  n.to,
5536
5536
  this.transitionDurationMs,
5537
- M.animation.fps
5537
+ k.animation.fps
5538
5538
  );
5539
5539
  return i.length < 2 && (i = [n.from, n.to]), i[0] = n.from, i[i.length - 1] = n.to, i;
5540
5540
  }
@@ -5584,17 +5584,17 @@ class Ni {
5584
5584
  */
5585
5585
  async initializeView(e) {
5586
5586
  try {
5587
- M.debug && h.log("[AvatarView] Initializing avatar view...");
5587
+ k.debug && h.log("[AvatarView] Initializing avatar view...");
5588
5588
  const t = b.getAvatarCore();
5589
5589
  if (!t)
5590
5590
  throw new Error("AvatarCore not available. AvatarKit initialization may have failed.");
5591
5591
  const n = e.getResources();
5592
- M.debug && h.log("[AvatarView] Loading character data..."), await t.loadCharacterFromBuffers(
5592
+ k.debug && h.log("[AvatarView] Loading character data..."), await t.loadCharacterFromBuffers(
5593
5593
  n.characterData.shape,
5594
5594
  n.characterData.pointCloud
5595
- ), n.characterData.idleAnimation && (M.debug && h.log("[AvatarView] Loading idle animation..."), await t.loadAnimationFromBuffer(n.characterData.idleAnimation)), M.debug && h.log("[AvatarView] Initializing render system...");
5595
+ ), n.characterData.idleAnimation && (k.debug && h.log("[AvatarView] Loading idle animation..."), await t.loadAnimationFromBuffer(n.characterData.idleAnimation)), k.debug && h.log("[AvatarView] Initializing render system...");
5596
5596
  const i = this.resolveCameraConfig(n);
5597
- await this.initializeRenderSystem(i), M.debug && h.log("[AvatarView] Starting rendering..."), await this.renderFirstFrame(), this.startIdleAnimationLoop(), this.isInitialized = !0, M.debug && h.log("[AvatarView] Avatar view initialized successfully");
5597
+ await this.initializeRenderSystem(i), k.debug && h.log("[AvatarView] Starting rendering..."), await this.renderFirstFrame(), this.startIdleAnimationLoop(), this.isInitialized = !0, k.debug && h.log("[AvatarView] Avatar view initialized successfully");
5598
5598
  } catch (t) {
5599
5599
  throw h.error("[AvatarView] Failed to initialize avatar view:", t instanceof Error ? t.message : String(t)), t;
5600
5600
  }
@@ -5608,13 +5608,13 @@ class Ni {
5608
5608
  camera: this.cameraConfig,
5609
5609
  backgroundColor: [0, 0, 0, 0]
5610
5610
  // 透明背景,让 CSS 背景透出
5611
- }), await this.renderSystem.initialize(), M.debug && h.log("[AvatarView] Render system initialized successfully");
5611
+ }), await this.renderSystem.initialize(), k.debug && h.log("[AvatarView] Render system initialized successfully");
5612
5612
  }
5613
5613
  /**
5614
5614
  * 获取默认相机配置
5615
5615
  */
5616
5616
  getDefaultCameraConfig() {
5617
- return { ...M.camera };
5617
+ return { ...k.camera };
5618
5618
  }
5619
5619
  /**
5620
5620
  * 根据资源解析最终的相机配置,优先使用角色设置,其次 camera.json
@@ -5685,7 +5685,7 @@ class Ni {
5685
5685
  eyes_pose: [0, 0, 0, 0, 0, 0]
5686
5686
  }, n = await e.computeFrameFlatFromParams(t);
5687
5687
  if (n)
5688
- this.renderSystem.loadSplatsFromPackedData(n), this.renderSystem.renderFrame(), M.debug && h.log("[AvatarView] First frame rendered successfully");
5688
+ this.renderSystem.loadSplatsFromPackedData(n), this.renderSystem.renderFrame(), k.debug && h.log("[AvatarView] First frame rendered successfully");
5689
5689
  else
5690
5690
  throw new Error("Failed to compute first frame splat data");
5691
5691
  }
@@ -5696,7 +5696,7 @@ class Ni {
5696
5696
  if (this.idleAnimationLoopId)
5697
5697
  return;
5698
5698
  if (this.renderingState !== "idle") {
5699
- M.debug && h.log("[AvatarView] Skip starting idle loop because not in idle state");
5699
+ k.debug && h.log("[AvatarView] Skip starting idle loop because not in idle state");
5700
5700
  return;
5701
5701
  }
5702
5702
  this.idleCurrentFrameIndex = 0;
@@ -5728,7 +5728,7 @@ class Ni {
5728
5728
  h.error("[AvatarView] Idle animation loop error:", o instanceof Error ? o.message : String(o)), this.stopIdleAnimationLoop();
5729
5729
  }
5730
5730
  };
5731
- this.idleAnimationLoopId = requestAnimationFrame(i), M.debug && h.log("[AvatarView] Idle animation loop started");
5731
+ this.idleAnimationLoopId = requestAnimationFrame(i), k.debug && h.log("[AvatarView] Idle animation loop started");
5732
5732
  }
5733
5733
  /**
5734
5734
  * 开始实时对话动画循环
@@ -5783,19 +5783,19 @@ class Ni {
5783
5783
  h.error("[AvatarView] Realtime animation loop error:", o instanceof Error ? o.message : String(o)), this.stopRealtimeAnimationLoop();
5784
5784
  }
5785
5785
  };
5786
- this.realtimeAnimationLoopId = requestAnimationFrame(i), M.debug && h.log("[AvatarView] Realtime animation loop started");
5786
+ this.realtimeAnimationLoopId = requestAnimationFrame(i), k.debug && h.log("[AvatarView] Realtime animation loop started");
5787
5787
  }
5788
5788
  /**
5789
5789
  * 停止idle动画循环
5790
5790
  */
5791
5791
  stopIdleAnimationLoop() {
5792
- this.idleAnimationLoopId && (cancelAnimationFrame(this.idleAnimationLoopId), this.idleAnimationLoopId = null, M.debug && h.log("[AvatarView] Idle animation loop stopped"));
5792
+ this.idleAnimationLoopId && (cancelAnimationFrame(this.idleAnimationLoopId), this.idleAnimationLoopId = null, k.debug && h.log("[AvatarView] Idle animation loop stopped"));
5793
5793
  }
5794
5794
  /**
5795
5795
  * 停止实时对话动画循环
5796
5796
  */
5797
5797
  stopRealtimeAnimationLoop() {
5798
- this.realtimeAnimationLoopId && (cancelAnimationFrame(this.realtimeAnimationLoopId), this.realtimeAnimationLoopId = null, M.debug && h.log("[AvatarView] Realtime animation loop stopped"));
5798
+ this.realtimeAnimationLoopId && (cancelAnimationFrame(this.realtimeAnimationLoopId), this.realtimeAnimationLoopId = null, k.debug && h.log("[AvatarView] Realtime animation loop stopped"));
5799
5799
  }
5800
5800
  /**
5801
5801
  * 停止所有动画循环
@@ -5894,7 +5894,7 @@ class Ni {
5894
5894
  this.transitionKeyframes = this.generateAndAlignTransitionFrames(a, o), this.transitionStartTime = performance.now(), this.transitionKeyframes.length === 0 ? (this.setState(
5895
5895
  "speaking"
5896
5896
  /* Speaking */
5897
- ), this.avatarController.onTransitionComplete()) : M.debug && h.log("[AvatarView] Transition started:", this.transitionKeyframes.length, "frames");
5897
+ ), this.avatarController.onTransitionComplete()) : k.debug && h.log("[AvatarView] Transition started:", this.transitionKeyframes.length, "frames");
5898
5898
  }
5899
5899
  } catch (n) {
5900
5900
  h.warn("[AvatarView] Transition generation failed:", n instanceof Error ? n.message : String(n)), this.renderingState === "transitioningToSpeaking" && (this.setState(
@@ -5908,7 +5908,7 @@ class Ni {
5908
5908
  * 开始实时渲染循环
5909
5909
  */
5910
5910
  startRealtimeRendering() {
5911
- M.debug && h.log("[AvatarView] Starting realtime rendering with", this.currentKeyframes.length, "keyframes"), b.logEvent("character_view", "info", {
5911
+ k.debug && h.log("[AvatarView] Starting realtime rendering with", this.currentKeyframes.length, "keyframes"), b.logEvent("character_view", "info", {
5912
5912
  characterId: this.avatar.id,
5913
5913
  event: "rendering_started",
5914
5914
  keyframesCount: this.currentKeyframes.length
@@ -5937,7 +5937,7 @@ class Ni {
5937
5937
  if (b.getAvatarCore() && this.currentKeyframes.length > 0) {
5938
5938
  const n = this.lastRealtimeProtoFrame || this.currentKeyframes[Math.max(0, this.lastRenderedFrameIndex)], i = await this.getCachedIdleFirstFrame();
5939
5939
  if (i && (this.transitionKeyframes = this.generateAndAlignTransitionFrames(n, i), this.transitionStartTime = performance.now(), this.transitionKeyframes.length > 0 && this.renderingState === "transitioningToIdle")) {
5940
- M.debug && h.log("[AvatarView] Return transition started:", this.transitionKeyframes.length, "frames"), this.realtimeAnimationLoopId || this.startRealtimeAnimationLoop();
5940
+ k.debug && h.log("[AvatarView] Return transition started:", this.transitionKeyframes.length, "frames"), this.realtimeAnimationLoopId || this.startRealtimeAnimationLoop();
5941
5941
  return;
5942
5942
  }
5943
5943
  }
@@ -5956,7 +5956,7 @@ class Ni {
5956
5956
  * 关闭 avatarController 并清理所有相关资源
5957
5957
  */
5958
5958
  dispose() {
5959
- M.debug && h.log("[AvatarView] Disposing avatar view..."), b.logEvent("character_view", "info", {
5959
+ k.debug && h.log("[AvatarView] Disposing avatar view..."), b.logEvent("character_view", "info", {
5960
5960
  characterId: this.avatar.id,
5961
5961
  event: "disposed"
5962
5962
  }), this.avatarController && this.avatarController.clear(), this.stopAllAnimationLoops(), this.setState(
@@ -5966,11 +5966,11 @@ class Ni {
5966
5966
  const e = b.getAvatarCore();
5967
5967
  if (e)
5968
5968
  try {
5969
- e.releaseCurrentCharacter(), M.debug && h.log("[AvatarView] AvatarCore character resources released");
5969
+ e.releaseCurrentCharacter(), k.debug && h.log("[AvatarView] AvatarCore character resources released");
5970
5970
  } catch (t) {
5971
5971
  h.error("[AvatarView] Failed to release AvatarCore resources:", t instanceof Error ? t.message : String(t));
5972
5972
  }
5973
- this.renderSystem && (this.renderSystem.dispose(), this.renderSystem = null), this.canvas && this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), window.removeEventListener("resize", this.onWindowResize), this.isInitialized = !1, M.debug && h.log("[AvatarView] Avatar view disposed successfully");
5973
+ this.renderSystem && (this.renderSystem.dispose(), this.renderSystem = null), this.canvas && this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas), this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = null), window.removeEventListener("resize", this.onWindowResize), this.isInitialized = !1, k.debug && h.log("[AvatarView] Avatar view disposed successfully");
5974
5974
  }
5975
5975
  /**
5976
5976
  * 获取相机配置
@@ -5982,7 +5982,7 @@ class Ni {
5982
5982
  * 更新相机配置
5983
5983
  */
5984
5984
  updateCameraConfig(e) {
5985
- this.cameraConfig = e, M.debug && h.log("[AvatarView] Camera config updated:", e), this.renderSystem && (this.renderSystem.updateCamera(e), M.debug && h.log("[AvatarView] Applied new camera config to render system"));
5985
+ this.cameraConfig = e, k.debug && h.log("[AvatarView] Camera config updated:", e), this.renderSystem && (this.renderSystem.updateCamera(e), k.debug && h.log("[AvatarView] Applied new camera config to render system"));
5986
5986
  }
5987
5987
  /**
5988
5988
  * 处理尺寸变化:通知渲染系统更新视口与投影
@@ -6004,7 +6004,7 @@ class Ni {
6004
6004
  }
6005
6005
  }
6006
6006
  export {
6007
- M as A,
6007
+ k as A,
6008
6008
  Se as C,
6009
6009
  le as E,
6010
6010
  oe as L,
@@ -6023,4 +6023,4 @@ export {
6023
6023
  Oi as k,
6024
6024
  h as l
6025
6025
  };
6026
- //# sourceMappingURL=index-CpSvWi6A.js.map
6026
+ //# sourceMappingURL=index-B-JbfZD-.js.map