@spatialwalk/avatarkit 1.0.0-beta.14 → 1.0.0-beta.15

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.
@@ -31,14 +31,14 @@ class rn {
31
31
  }
32
32
  var nn = /* @__PURE__ */ ((r) => (r.CAMERA = "camera", r.ANIMATION_IDLE = "frameIdle", r.ANIMATION_MONO = "frameMono", r.AUDIO_MONO = "audioMono", r.MODEL_SHAPE = "shape", r.MODEL_GS = "gsStandard", r))(nn || {});
33
33
  function Bi(r) {
34
- var e, t, n, i, a, o, s, l, g, c, u, m, v, w, y, b, x;
34
+ var e, t, n, i, a, o, l, s, p, c, u, m, v, w, y, b, I;
35
35
  return {
36
36
  camera: ((t = (e = r.camera) == null ? void 0 : e.resource) == null ? void 0 : t.remote) || null,
37
37
  frameIdle: ((a = (i = (n = r.animations) == null ? void 0 : n.frameIdle) == null ? void 0 : i.resource) == null ? void 0 : a.remote) || null,
38
- frameMono: ((l = (s = (o = r.animations) == null ? void 0 : o.frameMono) == null ? void 0 : s.resource) == null ? void 0 : l.remote) || null,
39
- audioMono: ((u = (c = (g = r.animations) == null ? void 0 : g.audioMono) == null ? void 0 : c.resource) == null ? void 0 : u.remote) || null,
38
+ frameMono: ((s = (l = (o = r.animations) == null ? void 0 : o.frameMono) == null ? void 0 : l.resource) == null ? void 0 : s.remote) || null,
39
+ audioMono: ((u = (c = (p = r.animations) == null ? void 0 : p.audioMono) == null ? void 0 : c.resource) == null ? void 0 : u.remote) || null,
40
40
  shape: ((w = (v = (m = r.models) == null ? void 0 : m.shape) == null ? void 0 : v.resource) == null ? void 0 : w.remote) || null,
41
- gsStandard: ((x = (b = (y = r.models) == null ? void 0 : y.gsStandard) == null ? void 0 : b.resource) == null ? void 0 : x.remote) || null
41
+ gsStandard: ((I = (b = (y = r.models) == null ? void 0 : y.gsStandard) == null ? void 0 : b.resource) == null ? void 0 : I.remote) || null
42
42
  };
43
43
  }
44
44
  function Di(r) {
@@ -48,13 +48,13 @@ function Di(r) {
48
48
  function Oi(r) {
49
49
  var e, t, n, i, a, o;
50
50
  try {
51
- const s = JSON.parse(r);
52
- return !!((n = (t = (e = s == null ? void 0 : s.animations) == null ? void 0 : e.frameMono) == null ? void 0 : t.resource) != null && n.remote && ((o = (a = (i = s == null ? void 0 : s.animations) == null ? void 0 : i.audioMono) == null ? void 0 : a.resource) != null && o.remote));
51
+ const l = JSON.parse(r);
52
+ return !!((n = (t = (e = l == null ? void 0 : l.animations) == null ? void 0 : e.frameMono) == null ? void 0 : t.resource) != null && n.remote && ((o = (a = (i = l == null ? void 0 : l.animations) == null ? void 0 : i.audioMono) == null ? void 0 : a.resource) != null && o.remote));
53
53
  } catch {
54
54
  return !1;
55
55
  }
56
56
  }
57
- var le = /* @__PURE__ */ ((r) => (r.cn = "cn", r.us = "us", r.test = "test", r))(le || {}), oe = /* @__PURE__ */ ((r) => (r.downloading = "downloading", r.completed = "completed", r.failed = "failed", r))(oe || {}), Ae = /* @__PURE__ */ ((r) => (r.disconnected = "disconnected", r.connecting = "connecting", r.connected = "connected", r.failed = "failed", r))(Ae || {}), T = /* @__PURE__ */ ((r) => (r.idle = "idle", r.active = "active", r.playing = "playing", r.paused = "paused", r))(T || {});
57
+ var le = /* @__PURE__ */ ((r) => (r.cn = "cn", r.us = "us", r.test = "test", r))(le || {}), oe = /* @__PURE__ */ ((r) => (r.downloading = "downloading", r.completed = "completed", r.failed = "failed", r))(oe || {}), Se = /* @__PURE__ */ ((r) => (r.disconnected = "disconnected", r.connecting = "connecting", r.connected = "connected", r.failed = "failed", r))(Se || {}), T = /* @__PURE__ */ ((r) => (r.idle = "idle", r.active = "active", r.playing = "playing", r.paused = "paused", r))(T || {});
58
58
  class se extends Error {
59
59
  constructor(e, t) {
60
60
  super(e), this.code = t, this.name = "SPAvatarError";
@@ -146,7 +146,7 @@ function ln() {
146
146
  return this[y];
147
147
  };
148
148
  }
149
- var a = ["isConstructor", "isEval", "isNative", "isToplevel"], o = ["columnNumber", "lineNumber"], s = ["fileName", "functionName", "source"], l = ["args"], g = ["evalOrigin"], c = a.concat(o, s, l, g);
149
+ var a = ["isConstructor", "isEval", "isNative", "isToplevel"], o = ["columnNumber", "lineNumber"], l = ["fileName", "functionName", "source"], s = ["args"], p = ["evalOrigin"], c = a.concat(o, l, s, p);
150
150
  function u(y) {
151
151
  if (y)
152
152
  for (var b = 0; b < c.length; b++)
@@ -173,18 +173,18 @@ function ln() {
173
173
  throw new TypeError("Eval Origin must be an Object or StackFrame");
174
174
  },
175
175
  toString: function() {
176
- var y = this.getFileName() || "", b = this.getLineNumber() || "", x = this.getColumnNumber() || "", L = this.getFunctionName() || "";
177
- return this.getIsEval() ? y ? "[eval] (" + y + ":" + b + ":" + x + ")" : "[eval]:" + b + ":" + x : L ? L + " (" + y + ":" + b + ":" + x + ")" : y + ":" + b + ":" + x;
176
+ var y = this.getFileName() || "", b = this.getLineNumber() || "", I = this.getColumnNumber() || "", L = this.getFunctionName() || "";
177
+ return this.getIsEval() ? y ? "[eval] (" + y + ":" + b + ":" + I + ")" : "[eval]:" + b + ":" + I : L ? L + " (" + y + ":" + b + ":" + I + ")" : y + ":" + b + ":" + I;
178
178
  }
179
179
  }, u.fromString = function(b) {
180
- var x = b.indexOf("("), L = b.lastIndexOf(")"), _ = b.substring(0, x), Y = b.substring(x + 1, L).split(","), G = b.substring(L + 1);
180
+ var I = b.indexOf("("), L = b.lastIndexOf(")"), _ = b.substring(0, I), X = b.substring(I + 1, L).split(","), G = b.substring(L + 1);
181
181
  if (G.indexOf("@") === 0)
182
- var U = /@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(G, ""), j = U[1], X = U[2], J = U[3];
182
+ var U = /@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(G, ""), j = U[1], Y = U[2], J = U[3];
183
183
  return new u({
184
184
  functionName: _,
185
- args: Y || void 0,
185
+ args: X || void 0,
186
186
  fileName: j,
187
- lineNumber: X || void 0,
187
+ lineNumber: Y || void 0,
188
188
  columnNumber: J || void 0
189
189
  });
190
190
  };
@@ -202,12 +202,12 @@ function ln() {
202
202
  this[y] = Number(b);
203
203
  };
204
204
  }(o[v]);
205
- for (var w = 0; w < s.length; w++)
206
- u.prototype["get" + n(s[w])] = i(s[w]), u.prototype["set" + n(s[w])] = /* @__PURE__ */ function(y) {
205
+ for (var w = 0; w < l.length; w++)
206
+ u.prototype["get" + n(l[w])] = i(l[w]), u.prototype["set" + n(l[w])] = /* @__PURE__ */ function(y) {
207
207
  return function(b) {
208
208
  this[y] = String(b);
209
209
  };
210
- }(s[w]);
210
+ }(l[w]);
211
211
  return u;
212
212
  });
213
213
  }(Oe)), Oe.exports;
@@ -224,28 +224,28 @@ function ln() {
224
224
  * @param {Error} error object
225
225
  * @return {Array} of StackFrames
226
226
  */
227
- parse: function(l) {
228
- if (typeof l.stacktrace < "u" || typeof l["opera#sourceloc"] < "u")
229
- return this.parseOpera(l);
230
- if (l.stack && l.stack.match(a))
231
- return this.parseV8OrIE(l);
232
- if (l.stack)
233
- return this.parseFFOrSafari(l);
227
+ parse: function(s) {
228
+ if (typeof s.stacktrace < "u" || typeof s["opera#sourceloc"] < "u")
229
+ return this.parseOpera(s);
230
+ if (s.stack && s.stack.match(a))
231
+ return this.parseV8OrIE(s);
232
+ if (s.stack)
233
+ return this.parseFFOrSafari(s);
234
234
  throw new Error("Cannot parse given Error object");
235
235
  },
236
236
  // Separate line and column numbers from a string of the form: (URI:Line:Column)
237
- extractLocation: function(l) {
238
- if (l.indexOf(":") === -1)
239
- return [l];
240
- var g = /(.+?)(?::(\d+))?(?::(\d+))?$/, c = g.exec(l.replace(/[()]/g, ""));
237
+ extractLocation: function(s) {
238
+ if (s.indexOf(":") === -1)
239
+ return [s];
240
+ var p = /(.+?)(?::(\d+))?(?::(\d+))?$/, c = p.exec(s.replace(/[()]/g, ""));
241
241
  return [c[1], c[2] || void 0, c[3] || void 0];
242
242
  },
243
- parseV8OrIE: function(l) {
244
- var g = l.stack.split(`
243
+ parseV8OrIE: function(s) {
244
+ var p = s.stack.split(`
245
245
  `).filter(function(c) {
246
246
  return !!c.match(a);
247
247
  }, this);
248
- return g.map(function(c) {
248
+ return p.map(function(c) {
249
249
  c.indexOf("(eval ") > -1 && (c = c.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, ""));
250
250
  var u = c.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, ""), m = u.match(/ (\(.+\)$)/);
251
251
  u = m ? u.replace(m[0], "") : u;
@@ -259,12 +259,12 @@ function ln() {
259
259
  });
260
260
  }, this);
261
261
  },
262
- parseFFOrSafari: function(l) {
263
- var g = l.stack.split(`
262
+ parseFFOrSafari: function(s) {
263
+ var p = s.stack.split(`
264
264
  `).filter(function(c) {
265
265
  return !c.match(o);
266
266
  }, this);
267
- return g.map(function(c) {
267
+ return p.map(function(c) {
268
268
  if (c.indexOf(" > eval") > -1 && (c = c.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1")), c.indexOf("@") === -1 && c.indexOf(":") === -1)
269
269
  return new n({
270
270
  functionName: c
@@ -279,16 +279,16 @@ function ln() {
279
279
  });
280
280
  }, this);
281
281
  },
282
- parseOpera: function(l) {
283
- return !l.stacktrace || l.message.indexOf(`
284
- `) > -1 && l.message.split(`
285
- `).length > l.stacktrace.split(`
286
- `).length ? this.parseOpera9(l) : l.stack ? this.parseOpera11(l) : this.parseOpera10(l);
282
+ parseOpera: function(s) {
283
+ return !s.stacktrace || s.message.indexOf(`
284
+ `) > -1 && s.message.split(`
285
+ `).length > s.stacktrace.split(`
286
+ `).length ? this.parseOpera9(s) : s.stack ? this.parseOpera11(s) : this.parseOpera10(s);
287
287
  },
288
- parseOpera9: function(l) {
289
- for (var g = /Line (\d+).*script (?:in )?(\S+)/i, c = l.message.split(`
288
+ parseOpera9: function(s) {
289
+ for (var p = /Line (\d+).*script (?:in )?(\S+)/i, c = s.message.split(`
290
290
  `), u = [], m = 2, v = c.length; m < v; m += 2) {
291
- var w = g.exec(c[m]);
291
+ var w = p.exec(c[m]);
292
292
  w && u.push(new n({
293
293
  fileName: w[2],
294
294
  lineNumber: w[1],
@@ -297,10 +297,10 @@ function ln() {
297
297
  }
298
298
  return u;
299
299
  },
300
- parseOpera10: function(l) {
301
- for (var g = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i, c = l.stacktrace.split(`
300
+ parseOpera10: function(s) {
301
+ for (var p = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i, c = s.stacktrace.split(`
302
302
  `), u = [], m = 0, v = c.length; m < v; m += 2) {
303
- var w = g.exec(c[m]);
303
+ var w = p.exec(c[m]);
304
304
  w && u.push(
305
305
  new n({
306
306
  functionName: w[3] || void 0,
@@ -313,12 +313,12 @@ function ln() {
313
313
  return u;
314
314
  },
315
315
  // Opera 10.65+ Error.stack very similar to FF/Safari
316
- parseOpera11: function(l) {
317
- var g = l.stack.split(`
316
+ parseOpera11: function(s) {
317
+ var p = s.stack.split(`
318
318
  `).filter(function(c) {
319
319
  return !!c.match(i) && !c.match(/^Error created at/);
320
320
  }, this);
321
- return g.map(function(c) {
321
+ return p.map(function(c) {
322
322
  var u = c.split("@"), m = this.extractLocation(u.pop()), v = u.shift() || "", w = v.replace(/<anonymous function(: (\w+))?>/, "$2").replace(/\([^)]*\)/g, "") || void 0, y;
323
323
  v.match(/\(([^)]*)\)/) && (y = v.replace(/^[^(]+\(([^)]*)\)$/, "$1"));
324
324
  var b = y === void 0 || y === "[arguments not available]" ? void 0 : y.split(",");
@@ -339,109 +339,109 @@ var cn = qt.exports;
339
339
  const un = /* @__PURE__ */ sn(cn);
340
340
  let ft = () => {
341
341
  var r = (() => {
342
- var e = Object.defineProperty, t = Object.getOwnPropertyDescriptor, n = Object.getOwnPropertyNames, i = Object.prototype.hasOwnProperty, a = (f, p) => {
343
- for (var S in p) e(f, S, { get: p[S], enumerable: !0 });
344
- }, o = (f, p, S, C) => {
345
- if (p && typeof p == "object" || typeof p == "function") for (let E of n(p)) !i.call(f, E) && E !== S && e(f, E, { get: () => p[E], enumerable: !(C = t(p, E)) || C.enumerable });
342
+ var e = Object.defineProperty, t = Object.getOwnPropertyDescriptor, n = Object.getOwnPropertyNames, i = Object.prototype.hasOwnProperty, a = (f, g) => {
343
+ for (var A in g) e(f, A, { get: g[A], enumerable: !0 });
344
+ }, o = (f, g, A, C) => {
345
+ if (g && typeof g == "object" || typeof g == "function") for (let E of n(g)) !i.call(f, E) && E !== A && e(f, E, { get: () => g[E], enumerable: !(C = t(g, E)) || C.enumerable });
346
346
  return f;
347
- }, s = (f) => o(e({}, "__esModule", { value: !0 }), f), l = {};
348
- a(l, { default: () => Xr });
349
- var g = (f) => Array.isArray(f), c = (f) => typeof f == "function", u = (f) => f.length === 0, m = (f) => typeof f == "number", v = (f) => typeof f == "object" && f !== null, w = (f) => f instanceof RegExp, y = (f) => typeof f == "string", b = (f) => f === void 0, x = (f) => {
350
- const p = /* @__PURE__ */ new Map();
351
- return (S) => {
352
- const C = p.get(S);
347
+ }, l = (f) => o(e({}, "__esModule", { value: !0 }), f), s = {};
348
+ a(s, { default: () => Yr });
349
+ var p = (f) => Array.isArray(f), c = (f) => typeof f == "function", u = (f) => f.length === 0, m = (f) => typeof f == "number", v = (f) => typeof f == "object" && f !== null, w = (f) => f instanceof RegExp, y = (f) => typeof f == "string", b = (f) => f === void 0, I = (f) => {
350
+ const g = /* @__PURE__ */ new Map();
351
+ return (A) => {
352
+ const C = g.get(A);
353
353
  if (C) return C;
354
- const E = f(S);
355
- return p.set(S, E), E;
354
+ const E = f(A);
355
+ return g.set(A, E), E;
356
356
  };
357
- }, L = (f, p, S = {}) => {
358
- const C = { cache: {}, input: f, index: 0, indexMax: 0, options: S, output: [] };
359
- if (V(p)(C) && C.index === f.length) return C.output;
357
+ }, L = (f, g, A = {}) => {
358
+ const C = { cache: {}, input: f, index: 0, indexMax: 0, options: A, output: [] };
359
+ if (V(g)(C) && C.index === f.length) return C.output;
360
360
  throw new Error(`Failed to parse at index ${C.indexMax}`);
361
- }, _ = (f, p) => g(f) ? Y(f, p) : y(f) ? U(f, p) : G(f, p), Y = (f, p) => {
362
- const S = {};
361
+ }, _ = (f, g) => p(f) ? X(f, g) : y(f) ? U(f, g) : G(f, g), X = (f, g) => {
362
+ const A = {};
363
363
  for (const C of f) {
364
364
  if (C.length !== 1) throw new Error(`Invalid character: "${C}"`);
365
365
  const E = C.charCodeAt(0);
366
- S[E] = !0;
366
+ A[E] = !0;
367
367
  }
368
368
  return (C) => {
369
369
  const E = C.index, P = C.input;
370
- for (; C.index < P.length && P.charCodeAt(C.index) in S; ) C.index += 1;
370
+ for (; C.index < P.length && P.charCodeAt(C.index) in A; ) C.index += 1;
371
371
  const R = C.index;
372
372
  if (R > E) {
373
- if (!b(p) && !C.options.silent) {
374
- const W = C.input.slice(E, R), H = c(p) ? p(W, P, String(E)) : p;
373
+ if (!b(g) && !C.options.silent) {
374
+ const W = C.input.slice(E, R), H = c(g) ? g(W, P, String(E)) : g;
375
375
  b(H) || C.output.push(H);
376
376
  }
377
377
  C.indexMax = Math.max(C.indexMax, C.index);
378
378
  }
379
379
  return !0;
380
380
  };
381
- }, G = (f, p) => {
382
- const S = f.source, C = f.flags.replace(/y|$/, "y"), E = new RegExp(S, C);
381
+ }, G = (f, g) => {
382
+ const A = f.source, C = f.flags.replace(/y|$/, "y"), E = new RegExp(A, C);
383
383
  return ne((P) => {
384
384
  E.lastIndex = P.index;
385
385
  const R = E.exec(P.input);
386
386
  if (R) {
387
- if (!b(p) && !P.options.silent) {
388
- const W = c(p) ? p(...R, P.input, String(P.index)) : p;
387
+ if (!b(g) && !P.options.silent) {
388
+ const W = c(g) ? g(...R, P.input, String(P.index)) : g;
389
389
  b(W) || P.output.push(W);
390
390
  }
391
391
  return P.index += R[0].length, P.indexMax = Math.max(P.indexMax, P.index), !0;
392
392
  } else return !1;
393
393
  });
394
- }, U = (f, p) => (S) => {
395
- if (S.input.startsWith(f, S.index)) {
396
- if (!b(p) && !S.options.silent) {
397
- const C = c(p) ? p(f, S.input, String(S.index)) : p;
398
- b(C) || S.output.push(C);
394
+ }, U = (f, g) => (A) => {
395
+ if (A.input.startsWith(f, A.index)) {
396
+ if (!b(g) && !A.options.silent) {
397
+ const C = c(g) ? g(f, A.input, String(A.index)) : g;
398
+ b(C) || A.output.push(C);
399
399
  }
400
- return S.index += f.length, S.indexMax = Math.max(S.indexMax, S.index), !0;
400
+ return A.index += f.length, A.indexMax = Math.max(A.indexMax, A.index), !0;
401
401
  } else return !1;
402
- }, j = (f, p, S, C) => {
402
+ }, j = (f, g, A, C) => {
403
403
  const E = V(f);
404
404
  return ne(de(we((P) => {
405
405
  let R = 0;
406
- for (; R < S; ) {
406
+ for (; R < A; ) {
407
407
  const W = P.index;
408
408
  if (!E(P) || (R += 1, P.index === W)) break;
409
409
  }
410
- return R >= p;
410
+ return R >= g;
411
411
  })));
412
- }, X = (f, p) => j(f, 0, 1), J = (f, p) => j(f, 0, 1 / 0), re = (f, p) => {
413
- const S = f.map(V);
412
+ }, Y = (f, g) => j(f, 0, 1), J = (f, g) => j(f, 0, 1 / 0), re = (f, g) => {
413
+ const A = f.map(V);
414
414
  return ne(de(we((C) => {
415
- for (let E = 0, P = S.length; E < P; E++) if (!S[E](C)) return !1;
415
+ for (let E = 0, P = A.length; E < P; E++) if (!A[E](C)) return !1;
416
416
  return !0;
417
417
  })));
418
- }, z = (f, p) => {
419
- const S = f.map(V);
418
+ }, z = (f, g) => {
419
+ const A = f.map(V);
420
420
  return ne(de((C) => {
421
- for (let E = 0, P = S.length; E < P; E++) if (S[E](C)) return !0;
421
+ for (let E = 0, P = A.length; E < P; E++) if (A[E](C)) return !0;
422
422
  return !1;
423
423
  }));
424
- }, we = (f, p = !1) => {
425
- const S = V(f);
424
+ }, we = (f, g = !1) => {
425
+ const A = V(f);
426
426
  return (C) => {
427
- const E = C.index, P = C.output.length, R = S(C);
428
- return (!R || p) && (C.index = E, C.output.length !== P && (C.output.length = P)), R;
427
+ const E = C.index, P = C.output.length, R = A(C);
428
+ return (!R || g) && (C.index = E, C.output.length !== P && (C.output.length = P)), R;
429
429
  };
430
- }, de = (f, p) => V(f), ne = /* @__PURE__ */ (() => {
430
+ }, de = (f, g) => V(f), ne = /* @__PURE__ */ (() => {
431
431
  let f = 0;
432
- return (p) => {
433
- const S = V(p), C = f += 1;
432
+ return (g) => {
433
+ const A = V(g), C = f += 1;
434
434
  return (E) => {
435
435
  var st;
436
436
  var P;
437
- if (E.options.memoization === !1) return S(E);
437
+ if (E.options.memoization === !1) return A(E);
438
438
  const R = E.index, W = (P = E.cache)[C] || (P[C] = /* @__PURE__ */ new Map()), H = W.get(R);
439
439
  if (H === !1) return !1;
440
440
  if (m(H)) return E.index = H, !0;
441
441
  if (H) return E.index = H.index, (st = H.output) != null && st.length && E.output.push(...H.output), !0;
442
442
  {
443
443
  const lt = E.output.length;
444
- if (S(E)) {
444
+ if (A(E)) {
445
445
  const ct = E.index, ut = E.output.length;
446
446
  if (ut > lt) {
447
447
  const Qr = E.output.slice(lt, ut);
@@ -453,42 +453,42 @@ let ft = () => {
453
453
  };
454
454
  };
455
455
  })(), B = (f) => {
456
- let p;
457
- return (S) => (p || (p = V(f())), p(S));
458
- }, V = x((f) => {
456
+ let g;
457
+ return (A) => (g || (g = V(f())), g(A));
458
+ }, V = I((f) => {
459
459
  if (c(f)) return u(f) ? B(f) : f;
460
460
  if (y(f) || w(f)) return _(f);
461
- if (g(f)) return re(f);
461
+ if (p(f)) return re(f);
462
462
  if (v(f)) return z(Object.values(f));
463
463
  throw new Error("Invalid rule");
464
464
  }), ie = "abcdefghijklmnopqrstuvwxyz", Le = (f) => {
465
- let p = "";
465
+ let g = "";
466
466
  for (; f > 0; ) {
467
- const S = (f - 1) % 26;
468
- p = ie[S] + p, f = Math.floor((f - 1) / 26);
467
+ const A = (f - 1) % 26;
468
+ g = ie[A] + g, f = Math.floor((f - 1) / 26);
469
469
  }
470
- return p;
470
+ return g;
471
471
  }, q = (f) => {
472
- let p = 0;
473
- for (let S = 0, C = f.length; S < C; S++) p = p * 26 + ie.indexOf(f[S]) + 1;
474
- return p;
475
- }, Te = (f, p) => {
476
- if (p < f) return Te(p, f);
477
- const S = [];
478
- for (; f <= p; ) S.push(f++);
479
- return S;
480
- }, ir = (f, p, S) => Te(f, p).map((C) => String(C).padStart(S, "0")), Xe = (f, p) => Te(q(f), q(p)).map(Le), Z = (f) => f, Qe = (f) => ar((p) => L(p, f, { memoization: !1 }).join("")), ar = (f) => {
481
- const p = {};
482
- return (S) => p[S] ?? (p[S] = f(S));
483
- }, or = _(/^\*\*\/\*$/, ".*"), sr = _(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (f, p, S) => `.*${p ? "" : "(?:^|/)"}${S.replaceAll(".", "\\.")}`), lr = _(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (f, p, S, C) => `.*${p ? "" : "(?:^|/)"}${S.replaceAll(".", "\\.")}(?:${C.replaceAll(",", "|").replaceAll(".", "\\.")})`), Be = _(/\\./, Z), cr = _(/[$.*+?^(){}[\]\|]/, (f) => `\\${f}`), ur = _(/./, Z), dr = _(/^(?:!!)*!(.*)$/, (f, p) => `(?!^${ot(p)}$).*?`), hr = _(/^(!!)+/, ""), fr = z([dr, hr]), mr = _(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = _(/^(\*\*\/)+/, "(?:^|.*/)"), pr = _(/\/(\*\*)$/, "(?:/.*|$)"), vr = _(/\*\*/, ".*"), et = z([mr, gr, pr, vr]), wr = _(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = _(/\*/, "[^/]*"), tt = z([wr, yr]), rt = _("?", "[^/]"), Sr = _("[", Z), Ar = _("]", Z), br = _(/[!^]/, "^/"), Cr = _(/[a-z]-[a-z]|[0-9]-[0-9]/i, Z), _r = _(/[$.*+?^(){}[\|]/, (f) => `\\${f}`), Er = _(/[^\]]/, Z), xr = z([Be, _r, Cr, Er]), nt = re([Sr, X(br), J(xr), Ar]), Pr = _("{", "(?:"), Ir = _("}", ")"), kr = _(/(\d+)\.\.(\d+)/, (f, p, S) => ir(+p, +S, Math.min(p.length, S.length)).join("|")), Mr = _(/([a-z]+)\.\.([a-z]+)/, (f, p, S) => Xe(p, S).join("|")), Fr = _(/([A-Z]+)\.\.([A-Z]+)/, (f, p, S) => Xe(p.toLowerCase(), S.toLowerCase()).join("|").toUpperCase()), Rr = z([kr, Mr, Fr]), it = re([Pr, Rr, Ir]), Lr = _("{", "(?:"), Tr = _("}", ")"), Br = _(",", "|"), Dr = _(/[$.*+?^(){[\]\|]/, (f) => `\\${f}`), Or = _(/[^}]/, Z), Nr = B(() => at), Ur = z([et, tt, rt, nt, it, Nr, Be, Dr, Br, Or]), at = re([Lr, J(Ur), Tr]), zr = J(z([or, sr, lr, fr, et, tt, rt, nt, it, at, Be, cr, ur])), Vr = zr, $r = Qe(Vr), ot = $r, qr = _(/\\./, Z), Wr = _(/./, Z), Gr = _(/\*\*\*+/, "*"), jr = _(/([^/{[(!])\*\*/, (f, p) => `${p}*`), Hr = _(/(^|.)\*\*(?=[^*/)\]}])/, (f, p) => `${p}*`), Kr = J(z([qr, Gr, jr, Hr, Wr])), Jr = Kr, Zr = Qe(Jr), Yr = Zr, De = (f, p) => {
484
- const S = Array.isArray(f) ? f : [f];
485
- if (!S.length) return !1;
486
- const C = S.map(De.compile), E = S.every((R) => /(\/(?:\*\*)?|\[\/\])$/.test(R)), P = p.replace(/[\\\/]+/g, "/").replace(/\/$/, E ? "/" : "");
472
+ let g = 0;
473
+ for (let A = 0, C = f.length; A < C; A++) g = g * 26 + ie.indexOf(f[A]) + 1;
474
+ return g;
475
+ }, Te = (f, g) => {
476
+ if (g < f) return Te(g, f);
477
+ const A = [];
478
+ for (; f <= g; ) A.push(f++);
479
+ return A;
480
+ }, ir = (f, g, A) => Te(f, g).map((C) => String(C).padStart(A, "0")), Ye = (f, g) => Te(q(f), q(g)).map(Le), Z = (f) => f, Qe = (f) => ar((g) => L(g, f, { memoization: !1 }).join("")), ar = (f) => {
481
+ const g = {};
482
+ return (A) => g[A] ?? (g[A] = f(A));
483
+ }, or = _(/^\*\*\/\*$/, ".*"), sr = _(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (f, g, A) => `.*${g ? "" : "(?:^|/)"}${A.replaceAll(".", "\\.")}`), lr = _(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (f, g, A, C) => `.*${g ? "" : "(?:^|/)"}${A.replaceAll(".", "\\.")}(?:${C.replaceAll(",", "|").replaceAll(".", "\\.")})`), Be = _(/\\./, Z), cr = _(/[$.*+?^(){}[\]\|]/, (f) => `\\${f}`), ur = _(/./, Z), dr = _(/^(?:!!)*!(.*)$/, (f, g) => `(?!^${ot(g)}$).*?`), hr = _(/^(!!)+/, ""), fr = z([dr, hr]), mr = _(/\/(\*\*\/)+/, "(?:/.+/|/)"), pr = _(/^(\*\*\/)+/, "(?:^|.*/)"), gr = _(/\/(\*\*)$/, "(?:/.*|$)"), vr = _(/\*\*/, ".*"), et = z([mr, pr, gr, vr]), wr = _(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = _(/\*/, "[^/]*"), tt = z([wr, yr]), rt = _("?", "[^/]"), Ar = _("[", Z), Sr = _("]", Z), br = _(/[!^]/, "^/"), Cr = _(/[a-z]-[a-z]|[0-9]-[0-9]/i, Z), _r = _(/[$.*+?^(){}[\|]/, (f) => `\\${f}`), Er = _(/[^\]]/, Z), Ir = z([Be, _r, Cr, Er]), nt = re([Ar, Y(br), J(Ir), Sr]), Pr = _("{", "(?:"), xr = _("}", ")"), kr = _(/(\d+)\.\.(\d+)/, (f, g, A) => ir(+g, +A, Math.min(g.length, A.length)).join("|")), Mr = _(/([a-z]+)\.\.([a-z]+)/, (f, g, A) => Ye(g, A).join("|")), Fr = _(/([A-Z]+)\.\.([A-Z]+)/, (f, g, A) => Ye(g.toLowerCase(), A.toLowerCase()).join("|").toUpperCase()), Rr = z([kr, Mr, Fr]), it = re([Pr, Rr, xr]), Lr = _("{", "(?:"), Tr = _("}", ")"), Br = _(",", "|"), Dr = _(/[$.*+?^(){[\]\|]/, (f) => `\\${f}`), Or = _(/[^}]/, Z), Nr = B(() => at), Ur = z([et, tt, rt, nt, it, Nr, Be, Dr, Br, Or]), at = re([Lr, J(Ur), Tr]), zr = J(z([or, sr, lr, fr, et, tt, rt, nt, it, at, Be, cr, ur])), Vr = zr, $r = Qe(Vr), ot = $r, qr = _(/\\./, Z), Wr = _(/./, Z), Gr = _(/\*\*\*+/, "*"), jr = _(/([^/{[(!])\*\*/, (f, g) => `${g}*`), Hr = _(/(^|.)\*\*(?=[^*/)\]}])/, (f, g) => `${g}*`), Kr = J(z([qr, Gr, jr, Hr, Wr])), Jr = Kr, Zr = Qe(Jr), Xr = Zr, De = (f, g) => {
484
+ const A = Array.isArray(f) ? f : [f];
485
+ if (!A.length) return !1;
486
+ const C = A.map(De.compile), E = A.every((R) => /(\/(?:\*\*)?|\[\/\])$/.test(R)), P = g.replace(/[\\\/]+/g, "/").replace(/\/$/, E ? "/" : "");
487
487
  return C.some((R) => R.test(P));
488
488
  };
489
- De.compile = (f) => new RegExp(`^${ot(Yr(f))}$`, "s");
490
- var Xr = De;
491
- return s(l);
489
+ De.compile = (f) => new RegExp(`^${ot(Xr(f))}$`, "s");
490
+ var Yr = De;
491
+ return l(s);
492
492
  })();
493
493
  return r.default || r;
494
494
  }, Ne;
@@ -496,7 +496,7 @@ const dn = (r, e) => (Ne || (Ne = ft(), ft = null), Ne(r, e)), hn = /^[A-Za-z]:\
496
496
  function ce(r = "") {
497
497
  return r && r.replace(/\\/g, "/").replace(hn, (e) => e.toUpperCase());
498
498
  }
499
- const fn = /^[/\\]{2}/, mn = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, Wt = /^[A-Za-z]:$/, mt = /^\/([A-Za-z]:)?$/, gn = /.(\.[^./]+|\.)$/, pn = /^[/\\]|^[a-zA-Z]:[/\\]/, vn = "/", Ke = function(r) {
499
+ const fn = /^[/\\]{2}/, mn = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, Wt = /^[A-Za-z]:$/, mt = /^\/([A-Za-z]:)?$/, pn = /.(\.[^./]+|\.)$/, gn = /^[/\\]|^[a-zA-Z]:[/\\]/, vn = "/", Ke = function(r) {
500
500
  if (r.length === 0)
501
501
  return ".";
502
502
  r = ce(r);
@@ -527,43 +527,43 @@ const Me = function(...r) {
527
527
  };
528
528
  function Je(r, e) {
529
529
  let t = "", n = 0, i = -1, a = 0, o = null;
530
- for (let s = 0; s <= r.length; ++s) {
531
- if (s < r.length)
532
- o = r[s];
530
+ for (let l = 0; l <= r.length; ++l) {
531
+ if (l < r.length)
532
+ o = r[l];
533
533
  else {
534
534
  if (o === "/")
535
535
  break;
536
536
  o = "/";
537
537
  }
538
538
  if (o === "/") {
539
- if (!(i === s - 1 || a === 1)) if (a === 2) {
539
+ if (!(i === l - 1 || a === 1)) if (a === 2) {
540
540
  if (t.length < 2 || n !== 2 || t[t.length - 1] !== "." || t[t.length - 2] !== ".") {
541
541
  if (t.length > 2) {
542
- const l = t.lastIndexOf("/");
543
- l === -1 ? (t = "", n = 0) : (t = t.slice(0, l), n = t.length - 1 - t.lastIndexOf("/")), i = s, a = 0;
542
+ const s = t.lastIndexOf("/");
543
+ s === -1 ? (t = "", n = 0) : (t = t.slice(0, s), n = t.length - 1 - t.lastIndexOf("/")), i = l, a = 0;
544
544
  continue;
545
545
  } else if (t.length > 0) {
546
- t = "", n = 0, i = s, a = 0;
546
+ t = "", n = 0, i = l, a = 0;
547
547
  continue;
548
548
  }
549
549
  }
550
550
  e && (t += t.length > 0 ? "/.." : "..", n = 2);
551
551
  } else
552
- t.length > 0 ? t += `/${r.slice(i + 1, s)}` : t = r.slice(i + 1, s), n = s - i - 1;
553
- i = s, a = 0;
552
+ t.length > 0 ? t += `/${r.slice(i + 1, l)}` : t = r.slice(i + 1, l), n = l - i - 1;
553
+ i = l, a = 0;
554
554
  } else o === "." && a !== -1 ? ++a : a = -1;
555
555
  }
556
556
  return t;
557
557
  }
558
558
  const ve = function(r) {
559
559
  return mn.test(r);
560
- }, Sn = function(r) {
560
+ }, An = function(r) {
561
561
  return ce(r);
562
562
  }, Gt = function(r) {
563
563
  if (r === "..") return "";
564
- const e = gn.exec(ce(r));
564
+ const e = pn.exec(ce(r));
565
565
  return e && e[1] || "";
566
- }, An = function(r, e) {
566
+ }, Sn = function(r, e) {
567
567
  const t = Me(r).replace(mt, "$1").split("/"), n = Me(e).replace(mt, "$1").split("/");
568
568
  if (n[0][1] === ":" && t[0][1] === ":" && t[0] !== n[0])
569
569
  return n.join("/");
@@ -597,7 +597,7 @@ const ve = function(r) {
597
597
  return e && n.endsWith(e) ? n.slice(0, -e.length) : n;
598
598
  }, Cn = function(r) {
599
599
  var i, a;
600
- const e = ((a = (i = pn.exec(r)) == null ? void 0 : i[0]) == null ? void 0 : a.replace(/\\/g, "/")) || "", t = Ht(r), n = Gt(t);
600
+ const e = ((a = (i = gn.exec(r)) == null ? void 0 : i[0]) == null ? void 0 : a.replace(/\\/g, "/")) || "", t = Ht(r), n = Gt(t);
601
601
  return {
602
602
  root: e,
603
603
  dir: jt(r),
@@ -605,7 +605,7 @@ const ve = function(r) {
605
605
  ext: n,
606
606
  name: t.slice(0, t.length - n.length)
607
607
  };
608
- }, _n = (r, e) => dn(e, Ke(r)), gt = {
608
+ }, _n = (r, e) => dn(e, Ke(r)), pt = {
609
609
  __proto__: null,
610
610
  basename: Ht,
611
611
  dirname: jt,
@@ -617,20 +617,20 @@ const ve = function(r) {
617
617
  normalize: Ke,
618
618
  normalizeString: Je,
619
619
  parse: Cn,
620
- relative: An,
620
+ relative: Sn,
621
621
  resolve: Me,
622
622
  sep: vn,
623
- toNamespacedPath: Sn
623
+ toNamespacedPath: An
624
624
  }, En = /* @__PURE__ */ (() => {
625
625
  var r;
626
626
  return ((r = globalThis.process) == null ? void 0 : r.platform) === "win32" ? ";" : ":";
627
- })(), xn = { posix: void 0, win32: void 0 }, Kt = (r = En) => new Proxy(gt, {
627
+ })(), In = { posix: void 0, win32: void 0 }, Kt = (r = En) => new Proxy(pt, {
628
628
  get(e, t) {
629
- return t === "delimiter" ? r : t === "posix" ? We : t === "win32" ? Pn : xn[t] || gt[t];
629
+ return t === "delimiter" ? r : t === "posix" ? We : t === "win32" ? Pn : In[t] || pt[t];
630
630
  }
631
631
  }), We = /* @__PURE__ */ Kt(":"), Pn = /* @__PURE__ */ Kt(";");
632
- 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 || {});
633
- const In = !0;
632
+ 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 || {}), x = /* @__PURE__ */ ((r) => (r.Error = "error", r.Warning = "warn", r.Log = "log", r.Verbose = "verbose", r.Debug = "debug", r))(x || {}), te = /* @__PURE__ */ ((r) => (r.JSON = "json", r.Pretty = "pretty", r))(te || {});
633
+ const xn = !0;
634
634
  function F(r, e, t = r) {
635
635
  return (n) => {
636
636
  const i = `${n}`, a = i.indexOf(e, r.length);
@@ -641,7 +641,7 @@ function Jt(r, e, t, n) {
641
641
  const i = r.substring(0, n) + t, a = r.substring(n + e.length), o = a.indexOf(e);
642
642
  return ~o ? i + Jt(a, e, t, o) : i + a;
643
643
  }
644
- function kn(r = In) {
644
+ function kn(r = xn) {
645
645
  return {
646
646
  isColorSupported: r,
647
647
  reset: r ? (e) => `\x1B[0m${e}\x1B[0m` : String,
@@ -672,23 +672,23 @@ function kn(r = In) {
672
672
  };
673
673
  }
674
674
  const D = kn(), Ge = {
675
- [I.Error]: k.Error,
676
- [I.Warning]: k.Warning,
677
- [I.Log]: k.Log,
678
- [I.Verbose]: k.Verbose,
679
- [I.Debug]: k.Debug
675
+ [x.Error]: k.Error,
676
+ [x.Warning]: k.Warning,
677
+ [x.Log]: k.Log,
678
+ [x.Verbose]: k.Verbose,
679
+ [x.Debug]: k.Debug
680
680
  }, Mn = {
681
- [k.Error]: I.Error,
682
- [k.Warning]: I.Warning,
683
- [k.Log]: I.Log,
684
- [k.Verbose]: I.Verbose,
685
- [k.Debug]: I.Debug
686
- }, pt = [
687
- I.Error,
688
- I.Warning,
689
- I.Log,
690
- I.Verbose,
691
- I.Debug
681
+ [k.Error]: x.Error,
682
+ [k.Warning]: x.Warning,
683
+ [k.Log]: x.Log,
684
+ [k.Verbose]: x.Verbose,
685
+ [k.Debug]: x.Debug
686
+ }, gt = [
687
+ x.Error,
688
+ x.Warning,
689
+ x.Log,
690
+ x.Verbose,
691
+ x.Debug
692
692
  ], Fn = {
693
693
  [k.Error]: D.red,
694
694
  [k.Warning]: D.yellow,
@@ -728,7 +728,7 @@ function Rn(r) {
728
728
  function Zt(r) {
729
729
  return r == null ? !1 : r instanceof Error;
730
730
  }
731
- function Yt(r, e, t, n, i) {
731
+ function Xt(r, e, t, n, i) {
732
732
  let a = { context: "" };
733
733
  typeof t < "u" && t !== null && (a = { ...t }), typeof e < "u" && e !== null && (a.context = e);
734
734
  const o = /* @__PURE__ */ new Date();
@@ -741,7 +741,7 @@ function Yt(r, e, t, n, i) {
741
741
  };
742
742
  }
743
743
  function Ln(r, e, t, n, i, a) {
744
- const o = Yt(r, e, t, n, a);
744
+ const o = Xt(r, e, t, n, a);
745
745
  return typeof i < "u" && i !== null && (o.errored = !0, o.error = { stack: i }), o;
746
746
  }
747
747
  function wt(r) {
@@ -765,7 +765,7 @@ function wt(r) {
765
765
  }
766
766
  return e;
767
767
  }
768
- function xe(r) {
768
+ function Ie(r) {
769
769
  const e = [];
770
770
  e.push(r["@localetime"]), e.push(
771
771
  Fn[Ge[r.level]](
@@ -777,17 +777,17 @@ function xe(r) {
777
777
  const n = Object.entries(r.fields);
778
778
  n.length > 0 && e.push(" {");
779
779
  for (const [a, o] of n) {
780
- let s = o;
780
+ let l = o;
781
781
  if (Zt(o)) {
782
- if (o.message && (s = wt(o.message)), s || (s = ""), o.cause != null)
782
+ if (o.message && (l = wt(o.message)), l || (l = ""), o.cause != null)
783
783
  try {
784
- s += JSON.stringify(o.cause);
784
+ l += JSON.stringify(o.cause);
785
785
  } catch {
786
- s += String(o.cause);
786
+ l += String(o.cause);
787
787
  }
788
788
  } else
789
- s = wt(o);
790
- e.push(`${D.gray(a)}${D.gray("=")}${s}`);
789
+ l = wt(o);
790
+ e.push(`${D.gray(a)}${D.gray("=")}${l}`);
791
791
  }
792
792
  n.length > 0 && e.push("}");
793
793
  let i = e.join(" ");
@@ -809,11 +809,11 @@ function On(r) {
809
809
  function Nn(r) {
810
810
  return r >= k.Error;
811
811
  }
812
- function Xt() {
812
+ function Yt() {
813
813
  return typeof window < "u";
814
814
  }
815
815
  function Un() {
816
- return !Xt() && je() === te.Pretty;
816
+ return !Yt() && je() === te.Pretty;
817
817
  }
818
818
  function zn(r, e) {
819
819
  return Un() ? `\x1B]8;;file://${r}\x1B\\${e}\x1B]8;;\x1B\\` : e;
@@ -878,13 +878,13 @@ function Qt(r) {
878
878
  },
879
879
  withLogLevelString: (c) => {
880
880
  const u = e.child();
881
- if (pt.includes(c))
881
+ if (gt.includes(c))
882
882
  u.logLevel = Ge[c], u.shouldUseGlobalConfig = !1, u.debug(
883
883
  `setting log level to ${c} (${Ge[c]})`
884
884
  );
885
885
  else
886
886
  throw new Error(
887
- `log level ${c} is not available. available log levels are: ${pt.join(
887
+ `log level ${c} is not available. available log levels are: ${gt.join(
888
888
  ", "
889
889
  )}`
890
890
  );
@@ -954,56 +954,56 @@ function Qt(r) {
954
954
  }
955
955
  }, t = () => e.shouldUseGlobalConfig ? yt() : e.logLevel, n = () => e.shouldUseGlobalConfig ? je() : e.format, i = () => e.shouldUseGlobalConfig ? $n() : e.timeFormatter ?? ((c) => c.toISOString()), a = (c) => c != null && c.length > 0 ? Object.keys(e.fields).length > 0 ? [e.fields, ...c] : c : e.fields, o = (c, u, m) => {
956
956
  const v = n();
957
- if (Xt() && v === te.Pretty) {
957
+ if (Yt() && v === te.Pretty) {
958
958
  c.fields = Object.fromEntries(
959
- Object.entries(c.fields).filter(([b, x]) => {
959
+ Object.entries(c.fields).filter(([b, I]) => {
960
960
  if (b === "isNestSystemModule" || b === "nestSystemModule" || b === "context")
961
- return [b, x];
961
+ return [b, I];
962
962
  })
963
963
  );
964
964
  const y = m ?? e.fields;
965
- Array.isArray(y) && y.length > 0 ? console[u](xe(c), ...y) : Object.keys(y).length > 0 ? console[u](xe(c), y) : console[u](xe(c));
965
+ Array.isArray(y) && y.length > 0 ? console[u](Ie(c), ...y) : Object.keys(y).length > 0 ? console[u](Ie(c), y) : console[u](Ie(c));
966
966
  return;
967
967
  }
968
- const w = v === te.Pretty ? xe(c) : JSON.stringify(c);
968
+ const w = v === te.Pretty ? Ie(c) : JSON.stringify(c);
969
969
  console[u](w);
970
- }, s = {
971
- [I.Debug]: Tn,
972
- [I.Verbose]: Bn,
973
- [I.Log]: Dn,
974
- [I.Warning]: On
975
970
  }, l = {
976
- [I.Debug]: "debug",
977
- [I.Verbose]: "log",
978
- [I.Log]: "log",
979
- [I.Warning]: "warn"
980
- }, g = (c, u, m) => {
981
- const v = t(), w = s[c];
971
+ [x.Debug]: Tn,
972
+ [x.Verbose]: Bn,
973
+ [x.Log]: Dn,
974
+ [x.Warning]: On
975
+ }, s = {
976
+ [x.Debug]: "debug",
977
+ [x.Verbose]: "log",
978
+ [x.Log]: "log",
979
+ [x.Warning]: "warn"
980
+ }, p = (c, u, m) => {
981
+ const v = t(), w = l[c];
982
982
  if (!w(v))
983
983
  return;
984
- const y = a(m), b = Yt(
984
+ const y = a(m), b = Xt(
985
985
  c,
986
986
  e.context,
987
987
  y,
988
988
  u,
989
989
  i()
990
990
  );
991
- o(b, l[c], y);
991
+ o(b, s[c], y);
992
992
  };
993
993
  return e.debug = (c, ...u) => {
994
- g(I.Debug, c, u);
994
+ p(x.Debug, c, u);
995
995
  }, e.verbose = (c, ...u) => {
996
- g(I.Verbose, c, u);
996
+ p(x.Verbose, c, u);
997
997
  }, e.log = (c, ...u) => {
998
- g(I.Log, c, u);
998
+ p(x.Log, c, u);
999
999
  }, e.warn = (c, ...u) => {
1000
- g(I.Warning, c, u);
1000
+ p(x.Warning, c, u);
1001
1001
  }, e.error = (c, u, ...m) => {
1002
1002
  const v = t();
1003
1003
  if (!Nn(v))
1004
1004
  return;
1005
1005
  const w = a(m), y = Ln(
1006
- I.Error,
1006
+ x.Error,
1007
1007
  e.context,
1008
1008
  w,
1009
1009
  c,
@@ -1020,7 +1020,7 @@ function qn(r) {
1020
1020
  }
1021
1021
  const Wn = (r) => qn(r).useGlobalConfig();
1022
1022
  let Q = [];
1023
- const St = 100;
1023
+ const At = 100;
1024
1024
  async function Gn() {
1025
1025
  if (Q.length === 0)
1026
1026
  return;
@@ -1029,7 +1029,7 @@ async function Gn() {
1029
1029
  try {
1030
1030
  await jn();
1031
1031
  } catch (e) {
1032
- h.warn("[CLS] Failed to flush logs:", e instanceof Error ? e.message : String(e)), Q.unshift(...r), Q.length > St && (Q = Q.slice(0, St));
1032
+ h.warn("[CLS] Failed to flush logs:", e instanceof Error ? e.message : String(e)), Q.unshift(...r), Q.length > At && (Q = Q.slice(0, At));
1033
1033
  }
1034
1034
  }
1035
1035
  async function jn(r) {
@@ -1102,9 +1102,9 @@ class Zn {
1102
1102
  throw new Error("teethPb is missing or empty!");
1103
1103
  if (!e.teethNpz || e.teethNpz.byteLength === 0)
1104
1104
  throw new Error("teethNpz is missing or empty!");
1105
- const i = this.allocateAndCopy(e.flameModel), a = this.allocateAndCopy(e.flameTemplate), o = this.allocateAndCopy(e.teethPb), s = this.allocateAndCopy(e.teethNpz);
1106
- let l = 0;
1107
- return this.module.setValue(n + l, i.ptr, "i32"), l += 4, this.module.setValue(n + l, i.size, "i32"), l += 4, this.module.setValue(n + l, a.ptr, "i32"), l += 4, this.module.setValue(n + l, a.size, "i32"), l += 4, this.module.setValue(n + l, o.ptr, "i32"), l += 4, this.module.setValue(n + l, o.size, "i32"), l += 4, this.module.setValue(n + l, s.ptr, "i32"), l += 4, this.module.setValue(n + l, s.size, "i32"), l += 4, this.module.setValue(n + l, 0, "i32"), l += 4, this.module.setValue(n + l, 0, "i32"), l += 4, this.structPointers.set("template_config", n), n;
1105
+ const i = this.allocateAndCopy(e.flameModel), a = this.allocateAndCopy(e.flameTemplate), o = this.allocateAndCopy(e.teethPb), l = this.allocateAndCopy(e.teethNpz);
1106
+ let s = 0;
1107
+ return this.module.setValue(n + s, i.ptr, "i32"), s += 4, this.module.setValue(n + s, i.size, "i32"), s += 4, this.module.setValue(n + s, a.ptr, "i32"), s += 4, this.module.setValue(n + s, a.size, "i32"), s += 4, this.module.setValue(n + s, o.ptr, "i32"), s += 4, this.module.setValue(n + s, o.size, "i32"), s += 4, this.module.setValue(n + s, l.ptr, "i32"), s += 4, this.module.setValue(n + s, l.size, "i32"), s += 4, this.module.setValue(n + s, 0, "i32"), s += 4, this.module.setValue(n + s, 0, "i32"), s += 4, this.structPointers.set("template_config", n), n;
1108
1108
  }
1109
1109
  /**
1110
1110
  * 创建 AvatarCharacterData 结构体 - 新版 Emscripten 方式
@@ -1114,8 +1114,8 @@ class Zn {
1114
1114
  if (!i)
1115
1115
  throw new Error("Failed to allocate AvatarCharacterData structure");
1116
1116
  const a = this.allocateAndCopy(e), o = this.allocateAndCopy(t);
1117
- let s = 0;
1118
- return this.module.setValue(i + s, a.ptr, "i32"), s += 4, this.module.setValue(i + s, a.size, "i32"), s += 4, this.module.setValue(i + s, o.ptr, "i32"), s += 4, this.module.setValue(i + s, o.size, "i32"), s += 4, this.structPointers.set("character_data", i), i;
1117
+ let l = 0;
1118
+ return this.module.setValue(i + l, a.ptr, "i32"), l += 4, this.module.setValue(i + l, a.size, "i32"), l += 4, this.module.setValue(i + l, o.ptr, "i32"), l += 4, this.module.setValue(i + l, o.size, "i32"), l += 4, this.structPointers.set("character_data", i), i;
1119
1119
  }
1120
1120
  /**
1121
1121
  * 读取 AvatarFlameParams 结构体数据
@@ -1135,15 +1135,15 @@ class Zn {
1135
1135
  const o = [];
1136
1136
  for (let m = 0; m < 3; m++)
1137
1137
  o.push(this.module.getValue(e + t, "float")), t += 4;
1138
- const s = [];
1139
- for (let m = 0; m < 3; m++)
1140
- s.push(this.module.getValue(e + t, "float")), t += 4;
1141
1138
  const l = [];
1142
1139
  for (let m = 0; m < 3; m++)
1143
1140
  l.push(this.module.getValue(e + t, "float")), t += 4;
1144
- const g = [];
1141
+ const s = [];
1142
+ for (let m = 0; m < 3; m++)
1143
+ s.push(this.module.getValue(e + t, "float")), t += 4;
1144
+ const p = [];
1145
1145
  for (let m = 0; m < 6; m++)
1146
- g.push(this.module.getValue(e + t, "float")), t += 4;
1146
+ p.push(this.module.getValue(e + t, "float")), t += 4;
1147
1147
  const c = [];
1148
1148
  for (let m = 0; m < 2; m++)
1149
1149
  c.push(this.module.getValue(e + t, "float")), t += 4;
@@ -1153,9 +1153,9 @@ class Zn {
1153
1153
  expr_params: i,
1154
1154
  rotation: a,
1155
1155
  translation: o,
1156
- neck_pose: s,
1157
- jaw_pose: l,
1158
- eyes_pose: g,
1156
+ neck_pose: l,
1157
+ jaw_pose: s,
1158
+ eyes_pose: p,
1159
1159
  eyelid: c,
1160
1160
  has_eyelid: u
1161
1161
  };
@@ -1164,7 +1164,7 @@ class Zn {
1164
1164
  * 创建 AvatarFlameParams 结构体 - 新版 Emscripten 方式
1165
1165
  */
1166
1166
  createFlameParams(e) {
1167
- var a, o, s, l, g, c, u, m;
1167
+ var a, o, l, s, p, c, u, m;
1168
1168
  const n = this.module._malloc(1684);
1169
1169
  if (!n)
1170
1170
  throw new Error("Failed to allocate AvatarFlameParams structure");
@@ -1178,15 +1178,15 @@ class Zn {
1178
1178
  this.module.setValue(n + i, w, "float"), i += 4;
1179
1179
  }
1180
1180
  for (let v = 0; v < 3; v++) {
1181
- const w = ((s = e.rotation) == null ? void 0 : s[v]) || 0;
1181
+ const w = ((l = e.rotation) == null ? void 0 : l[v]) || 0;
1182
1182
  this.module.setValue(n + i, w, "float"), i += 4;
1183
1183
  }
1184
1184
  for (let v = 0; v < 3; v++) {
1185
- const w = ((l = e.translation) == null ? void 0 : l[v]) || 0;
1185
+ const w = ((s = e.translation) == null ? void 0 : s[v]) || 0;
1186
1186
  this.module.setValue(n + i, w, "float"), i += 4;
1187
1187
  }
1188
1188
  for (let v = 0; v < 3; v++) {
1189
- const w = ((g = e.neck_pose) == null ? void 0 : g[v]) || 0;
1189
+ const w = ((p = e.neck_pose) == null ? void 0 : p[v]) || 0;
1190
1190
  this.module.setValue(n + i, w, "float"), i += 4;
1191
1191
  }
1192
1192
  for (let v = 0; v < 3; v++) {
@@ -1224,34 +1224,34 @@ class Zn {
1224
1224
  const t = this.module.getValue(e, "i32"), n = this.module.getValue(e + 4, "i32");
1225
1225
  if (n === 0 || !t)
1226
1226
  return null;
1227
- const a = n * 13, o = t / 4, s = new Float32Array(a);
1228
- return s.set(this.module.HEAPF32.subarray(o, o + a)), s;
1227
+ const a = n * 13, o = t / 4, l = new Float32Array(a);
1228
+ return l.set(this.module.HEAPF32.subarray(o, o + a)), l;
1229
1229
  }
1230
1230
  /**
1231
1231
  * 读取AvatarMeshData结构体数据
1232
1232
  */
1233
1233
  readMeshData(e) {
1234
- const t = this.module.getValue(e + 0, "*"), n = this.module.getValue(e + 4, "i32"), i = this.module.getValue(e + 8, "*"), a = this.module.getValue(e + 12, "i32"), o = this.module.getValue(e + 16, "float"), s = this.module.getValue(e + 20, "*"), l = this.module.getValue(e + 24, "i32"), g = new Float32Array(n * 3);
1234
+ const t = this.module.getValue(e + 0, "*"), n = this.module.getValue(e + 4, "i32"), i = this.module.getValue(e + 8, "*"), a = this.module.getValue(e + 12, "i32"), o = this.module.getValue(e + 16, "float"), l = this.module.getValue(e + 20, "*"), s = this.module.getValue(e + 24, "i32"), p = new Float32Array(n * 3);
1235
1235
  if (t && n > 0)
1236
1236
  for (let m = 0; m < n * 3; m++)
1237
- g[m] = this.module.getValue(t + m * 4, "float");
1237
+ p[m] = this.module.getValue(t + m * 4, "float");
1238
1238
  const c = new Uint32Array(a * 3);
1239
1239
  if (i && a > 0)
1240
1240
  for (let m = 0; m < a * 3; m++)
1241
1241
  c[m] = this.module.getValue(i + m * 4, "i32");
1242
1242
  let u = null;
1243
- if (s && l > 0) {
1244
- u = new Float32Array(l * 3);
1245
- for (let m = 0; m < l * 3; m++)
1246
- u[m] = this.module.getValue(s + m * 4, "float");
1243
+ if (l && s > 0) {
1244
+ u = new Float32Array(s * 3);
1245
+ for (let m = 0; m < s * 3; m++)
1246
+ u[m] = this.module.getValue(l + m * 4, "float");
1247
1247
  }
1248
1248
  return {
1249
- vertices: g,
1249
+ vertices: p,
1250
1250
  vertexCount: n,
1251
1251
  faces: c,
1252
1252
  faceCount: a,
1253
1253
  landmarks: u,
1254
- landmarkCount: l,
1254
+ landmarkCount: s,
1255
1255
  computeTime: o
1256
1256
  };
1257
1257
  }
@@ -1290,7 +1290,7 @@ class Zn {
1290
1290
  };
1291
1291
  }
1292
1292
  }
1293
- class Yn {
1293
+ class Xn {
1294
1294
  constructor(e = {}) {
1295
1295
  // 配置
1296
1296
  d(this, "options");
@@ -1359,7 +1359,7 @@ class Yn {
1359
1359
  */
1360
1360
  async loadWASMModule() {
1361
1361
  try {
1362
- const { default: e } = await import("./avatar_core_wasm-D4eEi7Eh.js");
1362
+ const { default: e } = await import("./avatar_core_wasm-D-1WNg4B.js");
1363
1363
  this.wasmConfig && Object.keys(this.wasmConfig).length > 0 ? this.wasmModule = await e(this.wasmConfig) : this.wasmModule = await e(), this.validateWASMModule(), this.memoryManager = new Zn(this.wasmModule), this.setupCAPIFunctions(), h.log("✅ Created new WASM instance with clean C++ memory");
1364
1364
  } catch (e) {
1365
1365
  const t = e instanceof Error ? e.message : String(e);
@@ -1642,8 +1642,8 @@ class Yn {
1642
1642
  n
1643
1643
  );
1644
1644
  this.checkError(i, "avatar_core_get_flame_info");
1645
- const a = this.wasmModule.getValue(e, "i32"), o = this.wasmModule.getValue(t, "i32"), s = this.wasmModule.getValue(n, "i32");
1646
- this.wasmModule._free(e), this.wasmModule._free(t), this.wasmModule._free(n), this.flameInfo = { vertexCount: a, faceCount: o, jointCount: s };
1645
+ const a = this.wasmModule.getValue(e, "i32"), o = this.wasmModule.getValue(t, "i32"), l = this.wasmModule.getValue(n, "i32");
1646
+ this.wasmModule._free(e), this.wasmModule._free(t), this.wasmModule._free(n), this.flameInfo = { vertexCount: a, faceCount: o, jointCount: l };
1647
1647
  } catch (e) {
1648
1648
  const t = e instanceof Error ? e.message : String(e);
1649
1649
  h.errorWithError("❌ Failed to query FLAME info:", t);
@@ -1750,8 +1750,8 @@ class Yn {
1750
1750
  n
1751
1751
  );
1752
1752
  this.checkError(o, "avatar_core_compute_frame_as_splat_points_flat");
1753
- const s = this.memoryManager.readSplatPointFlatArray(n), l = performance.now() - t;
1754
- return this.wasmTime = l, this.performanceMetrics.computeFrames++, this.performanceMetrics.totalComputeTime += l, this.performanceMetrics.averageComputeTime = this.performanceMetrics.totalComputeTime / this.performanceMetrics.computeFrames, s;
1753
+ const l = this.memoryManager.readSplatPointFlatArray(n), s = performance.now() - t;
1754
+ return this.wasmTime = s, this.performanceMetrics.computeFrames++, this.performanceMetrics.totalComputeTime += s, this.performanceMetrics.averageComputeTime = this.performanceMetrics.totalComputeTime / this.performanceMetrics.computeFrames, l;
1755
1755
  } catch (a) {
1756
1756
  h.errorWithError("❌ computeCompleteFrameFlat failed:", a);
1757
1757
  const o = a instanceof Error ? a.message : String(a);
@@ -1778,8 +1778,8 @@ class Yn {
1778
1778
  n
1779
1779
  );
1780
1780
  this.checkError(a, "avatar_core_compute_frame_as_splat_points_flat");
1781
- const o = this.memoryManager.readSplatPointFlatArray(n), s = performance.now() - t;
1782
- return this.wasmTime = s, this.performanceMetrics.computeFrames++, this.performanceMetrics.totalComputeTime += s, this.performanceMetrics.averageComputeTime = this.performanceMetrics.totalComputeTime / this.performanceMetrics.computeFrames, o;
1781
+ const o = this.memoryManager.readSplatPointFlatArray(n), l = performance.now() - t;
1782
+ return this.wasmTime = l, this.performanceMetrics.computeFrames++, this.performanceMetrics.totalComputeTime += l, this.performanceMetrics.averageComputeTime = this.performanceMetrics.totalComputeTime / this.performanceMetrics.computeFrames, o;
1783
1783
  } catch (a) {
1784
1784
  h.errorWithError("❌ computeFrameFlatFromParams failed:", a);
1785
1785
  const o = a instanceof Error ? a.message : String(a);
@@ -1789,7 +1789,7 @@ class Yn {
1789
1789
  }
1790
1790
  }
1791
1791
  }
1792
- class A {
1792
+ class S {
1793
1793
  /**
1794
1794
  * SDK 初始化
1795
1795
  * @param appId 前端需要在 HTTP Headers 和 WebSocket Headers 中都带上
@@ -1819,7 +1819,7 @@ class A {
1819
1819
  */
1820
1820
  static async initializeWASMModule() {
1821
1821
  try {
1822
- h.log("[AvatarKit] Initializing WASM module..."), this._avatarCore = new Yn({
1822
+ h.log("[AvatarKit] Initializing WASM module..."), this._avatarCore = new Xn({
1823
1823
  logLevel: "basic",
1824
1824
  enableValidation: !0,
1825
1825
  enablePerformanceMetrics: !0,
@@ -1953,7 +1953,7 @@ class A {
1953
1953
  h[a](`[Telemetry] ${e}`, i);
1954
1954
  }
1955
1955
  }
1956
- d(A, "_isInitialized", !1), d(A, "_appId", null), d(A, "_configuration", null), d(A, "_sessionToken", null), d(A, "_userId", null), d(A, "_version", "1.0.0-beta.14"), d(A, "_avatarCore", null), d(A, "_dynamicSdkConfig", null), d(A, "_logLevels", {
1956
+ d(S, "_isInitialized", !1), d(S, "_appId", null), d(S, "_configuration", null), d(S, "_sessionToken", null), d(S, "_userId", null), d(S, "_version", "1.0.0-beta.15"), d(S, "_avatarCore", null), d(S, "_dynamicSdkConfig", null), d(S, "_logLevels", {
1957
1957
  debug: "log",
1958
1958
  info: "log",
1959
1959
  warning: "warn",
@@ -2022,7 +2022,7 @@ const Ce = class Ce {
2022
2022
  async createAndInitializeStreamingPlayer() {
2023
2023
  if (this.streamingPlayer)
2024
2024
  return;
2025
- const { StreamingAudioPlayer: e } = await import("./StreamingAudioPlayer-zd5a2zg4.js");
2025
+ const { StreamingAudioPlayer: e } = await import("./StreamingAudioPlayer-Dj1w6HZz.js");
2026
2026
  this.streamingPlayer = new e({
2027
2027
  sampleRate: M.audio.sampleRate,
2028
2028
  channelCount: 1,
@@ -2032,7 +2032,7 @@ const Ce = class Ce {
2032
2032
  await this.streamingPlayer.initialize();
2033
2033
  } catch (t) {
2034
2034
  const n = t instanceof Error ? t.message : String(t);
2035
- throw h.error("[AnimationPlayer] Failed to initialize streaming player:", n), A.logEvent("character_player", "error", {
2035
+ throw h.error("[AnimationPlayer] Failed to initialize streaming player:", n), S.logEvent("character_player", "error", {
2036
2036
  event: "streaming_player_initialize_failed",
2037
2037
  reason: n
2038
2038
  }), t;
@@ -2113,7 +2113,7 @@ const Ce = class Ce {
2113
2113
  };
2114
2114
  d(Ce, "audioUnlocked", !1);
2115
2115
  let be = Ce;
2116
- function Xn() {
2116
+ function Yn() {
2117
2117
  let r = 0, e = 0;
2118
2118
  for (let n = 0; n < 28; n += 7) {
2119
2119
  let i = this.buf[this.pos++];
@@ -2132,29 +2132,29 @@ function Xn() {
2132
2132
  }
2133
2133
  function Ue(r, e, t) {
2134
2134
  for (let a = 0; a < 28; a = a + 7) {
2135
- const o = r >>> a, s = !(!(o >>> 7) && e == 0), l = (s ? o | 128 : o) & 255;
2136
- if (t.push(l), !s)
2135
+ const o = r >>> a, l = !(!(o >>> 7) && e == 0), s = (l ? o | 128 : o) & 255;
2136
+ if (t.push(s), !l)
2137
2137
  return;
2138
2138
  }
2139
2139
  const n = r >>> 28 & 15 | (e & 7) << 4, i = !!(e >> 3);
2140
2140
  if (t.push((i ? n | 128 : n) & 255), !!i) {
2141
2141
  for (let a = 3; a < 31; a = a + 7) {
2142
- const o = e >>> a, s = !!(o >>> 7), l = (s ? o | 128 : o) & 255;
2143
- if (t.push(l), !s)
2142
+ const o = e >>> a, l = !!(o >>> 7), s = (l ? o | 128 : o) & 255;
2143
+ if (t.push(s), !l)
2144
2144
  return;
2145
2145
  }
2146
2146
  t.push(e >>> 31 & 1);
2147
2147
  }
2148
2148
  }
2149
- const Ie = 4294967296;
2150
- function At(r) {
2149
+ const xe = 4294967296;
2150
+ function St(r) {
2151
2151
  const e = r[0] === "-";
2152
2152
  e && (r = r.slice(1));
2153
2153
  const t = 1e6;
2154
2154
  let n = 0, i = 0;
2155
- function a(o, s) {
2156
- const l = Number(r.slice(o, s));
2157
- i *= t, n = n * t + l, n >= Ie && (i = i + (n / Ie | 0), n = n % Ie);
2155
+ function a(o, l) {
2156
+ const s = Number(r.slice(o, l));
2157
+ i *= t, n = n * t + s, n >= xe && (i = i + (n / xe | 0), n = n % xe);
2158
2158
  }
2159
2159
  return a(-24, -18), a(-18, -12), a(-12, -6), a(-6), e ? tr(n, i) : Ze(n, i);
2160
2160
  }
@@ -2167,11 +2167,11 @@ function Qn(r, e) {
2167
2167
  }
2168
2168
  function er(r, e) {
2169
2169
  if ({ lo: r, hi: e } = ei(r, e), e <= 2097151)
2170
- return String(Ie * e + r);
2170
+ return String(xe * e + r);
2171
2171
  const t = r & 16777215, n = (r >>> 24 | e << 8) & 16777215, i = e >> 16 & 65535;
2172
- let a = t + n * 6777216 + i * 6710656, o = n + i * 8147497, s = i * 2;
2173
- const l = 1e7;
2174
- return a >= l && (o += Math.floor(a / l), a %= l), o >= l && (s += Math.floor(o / l), o %= l), s.toString() + bt(o) + bt(a);
2172
+ let a = t + n * 6777216 + i * 6710656, o = n + i * 8147497, l = i * 2;
2173
+ const s = 1e7;
2174
+ return a >= s && (o += Math.floor(a / s), a %= s), o >= s && (l += Math.floor(o / s), o %= s), l.toString() + bt(o) + bt(a);
2175
2175
  }
2176
2176
  function ei(r, e) {
2177
2177
  return { lo: r >>> 0, hi: e >>> 0 };
@@ -2223,16 +2223,16 @@ function ri() {
2223
2223
  zero: BigInt(0),
2224
2224
  supported: !0,
2225
2225
  parse(o) {
2226
- const s = typeof o == "bigint" ? o : BigInt(o);
2227
- if (s > n || s < t)
2226
+ const l = typeof o == "bigint" ? o : BigInt(o);
2227
+ if (l > n || l < t)
2228
2228
  throw new Error(`invalid int64: ${o}`);
2229
- return s;
2229
+ return l;
2230
2230
  },
2231
2231
  uParse(o) {
2232
- const s = typeof o == "bigint" ? o : BigInt(o);
2233
- if (s > a || s < i)
2232
+ const l = typeof o == "bigint" ? o : BigInt(o);
2233
+ if (l > a || l < i)
2234
2234
  throw new Error(`invalid uint64: ${o}`);
2235
- return s;
2235
+ return l;
2236
2236
  },
2237
2237
  enc(o) {
2238
2238
  return r.setBigInt64(0, this.parse(o), !0), {
@@ -2246,11 +2246,11 @@ function ri() {
2246
2246
  hi: r.getInt32(4, !0)
2247
2247
  };
2248
2248
  },
2249
- dec(o, s) {
2250
- return r.setInt32(0, o, !0), r.setInt32(4, s, !0), r.getBigInt64(0, !0);
2249
+ dec(o, l) {
2250
+ return r.setInt32(0, o, !0), r.setInt32(4, l, !0), r.getBigInt64(0, !0);
2251
2251
  },
2252
- uDec(o, s) {
2253
- return r.setInt32(0, o, !0), r.setInt32(4, s, !0), r.getBigUint64(0, !0);
2252
+ uDec(o, l) {
2253
+ return r.setInt32(0, o, !0), r.setInt32(4, l, !0), r.getBigUint64(0, !0);
2254
2254
  }
2255
2255
  };
2256
2256
  }
@@ -2264,10 +2264,10 @@ function ri() {
2264
2264
  return typeof t != "string" && (t = t.toString()), Et(t), t;
2265
2265
  },
2266
2266
  enc(t) {
2267
- return typeof t != "string" && (t = t.toString()), _t(t), At(t);
2267
+ return typeof t != "string" && (t = t.toString()), _t(t), St(t);
2268
2268
  },
2269
2269
  uEnc(t) {
2270
- return typeof t != "string" && (t = t.toString()), Et(t), At(t);
2270
+ return typeof t != "string" && (t = t.toString()), Et(t), St(t);
2271
2271
  },
2272
2272
  dec(t, n) {
2273
2273
  return Qn(t, n);
@@ -2368,7 +2368,7 @@ class ue {
2368
2368
  * Write a `uint32` value, an unsigned 32 bit varint.
2369
2369
  */
2370
2370
  uint32(e) {
2371
- for (xt(e); e > 127; )
2371
+ for (It(e); e > 127; )
2372
2372
  this.buf.push(e & 127 | 128), e = e >>> 7;
2373
2373
  return this.buf.push(e), this;
2374
2374
  }
@@ -2416,7 +2416,7 @@ class ue {
2416
2416
  * Write a `fixed32` value, an unsigned, fixed-length 32-bit integer.
2417
2417
  */
2418
2418
  fixed32(e) {
2419
- xt(e);
2419
+ It(e);
2420
2420
  let t = new Uint8Array(4);
2421
2421
  return new DataView(t.buffer).setUint32(0, e, !0), this.raw(t);
2422
2422
  }
@@ -2472,7 +2472,7 @@ class ue {
2472
2472
  }
2473
2473
  class N {
2474
2474
  constructor(e, t = rr().decodeUtf8) {
2475
- this.decodeUtf8 = t, this.varint64 = Xn, this.uint32 = ti, this.buf = e, this.len = e.length, this.pos = 0, this.view = new DataView(e.buffer, e.byteOffset, e.byteLength);
2475
+ this.decodeUtf8 = t, this.varint64 = Yn, this.uint32 = ti, this.buf = e, this.len = e.length, this.pos = 0, this.view = new DataView(e.buffer, e.byteOffset, e.byteLength);
2476
2476
  }
2477
2477
  /**
2478
2478
  * Reads a tag - field number and wire type.
@@ -2625,7 +2625,7 @@ function Ve(r) {
2625
2625
  if (!Number.isInteger(r) || r > oi || r < si)
2626
2626
  throw new Error("invalid int32: " + r);
2627
2627
  }
2628
- function xt(r) {
2628
+ function It(r) {
2629
2629
  if (typeof r == "string")
2630
2630
  r = Number(r);
2631
2631
  else if (typeof r != "number")
@@ -2737,7 +2737,7 @@ const he = {
2737
2737
  return e.reqId = r.reqId ?? "", e.audio = r.audio ?? new Uint8Array(0), e.end = r.end ?? !1, e;
2738
2738
  }
2739
2739
  };
2740
- function It() {
2740
+ function xt() {
2741
2741
  return { translation: [], rotation: [], neckPose: [], jawPose: [], eyePose: [], eyeLid: [], expression: [] };
2742
2742
  }
2743
2743
  const fe = {
@@ -2768,7 +2768,7 @@ const fe = {
2768
2768
  decode(r, e) {
2769
2769
  const t = r instanceof N ? r : new N(r);
2770
2770
  let n = e === void 0 ? t.len : t.pos + e;
2771
- const i = It();
2771
+ const i = xt();
2772
2772
  for (; t.pos < n; ) {
2773
2773
  const a = t.uint32();
2774
2774
  switch (a >>> 3) {
@@ -2882,17 +2882,17 @@ const fe = {
2882
2882
  };
2883
2883
  },
2884
2884
  toJSON(r) {
2885
- var t, n, i, a, o, s, l;
2885
+ var t, n, i, a, o, l, s;
2886
2886
  const e = {};
2887
- return (t = r.translation) != null && t.length && (e.translation = r.translation), (n = r.rotation) != null && n.length && (e.rotation = r.rotation), (i = r.neckPose) != null && i.length && (e.neckPose = r.neckPose), (a = r.jawPose) != null && a.length && (e.jawPose = r.jawPose), (o = r.eyePose) != null && o.length && (e.eyePose = r.eyePose), (s = r.eyeLid) != null && s.length && (e.eyeLid = r.eyeLid), (l = r.expression) != null && l.length && (e.expression = r.expression), e;
2887
+ return (t = r.translation) != null && t.length && (e.translation = r.translation), (n = r.rotation) != null && n.length && (e.rotation = r.rotation), (i = r.neckPose) != null && i.length && (e.neckPose = r.neckPose), (a = r.jawPose) != null && a.length && (e.jawPose = r.jawPose), (o = r.eyePose) != null && o.length && (e.eyePose = r.eyePose), (l = r.eyeLid) != null && l.length && (e.eyeLid = r.eyeLid), (s = r.expression) != null && s.length && (e.expression = r.expression), e;
2888
2888
  },
2889
2889
  create(r) {
2890
2890
  return fe.fromPartial(r ?? {});
2891
2891
  },
2892
2892
  fromPartial(r) {
2893
- var t, n, i, a, o, s, l;
2894
- const e = It();
2895
- 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;
2893
+ var t, n, i, a, o, l, s;
2894
+ const e = xt();
2895
+ return e.translation = ((t = r.translation) == null ? void 0 : t.map((p) => p)) || [], e.rotation = ((n = r.rotation) == null ? void 0 : n.map((p) => p)) || [], e.neckPose = ((i = r.neckPose) == null ? void 0 : i.map((p) => p)) || [], e.jawPose = ((a = r.jawPose) == null ? void 0 : a.map((p) => p)) || [], e.eyePose = ((o = r.eyePose) == null ? void 0 : o.map((p) => p)) || [], e.eyeLid = ((l = r.eyeLid) == null ? void 0 : l.map((p) => p)) || [], e.expression = ((s = r.expression) == null ? void 0 : s.map((p) => p)) || [], e;
2896
2896
  }
2897
2897
  };
2898
2898
  function kt() {
@@ -2946,7 +2946,7 @@ const me = {
2946
2946
  function Mt() {
2947
2947
  return { reqId: "", animation: void 0 };
2948
2948
  }
2949
- const ge = {
2949
+ const pe = {
2950
2950
  encode(r, e = new ue()) {
2951
2951
  return r.reqId !== "" && e.uint32(10).string(r.reqId), r.animation !== void 0 && me.encode(r.animation, e.uint32(18).fork()).join(), e;
2952
2952
  },
@@ -2987,7 +2987,7 @@ const ge = {
2987
2987
  return r.reqId !== "" && (e.reqId = r.reqId), r.animation !== void 0 && (e.animation = me.toJSON(r.animation)), e;
2988
2988
  },
2989
2989
  create(r) {
2990
- return ge.fromPartial(r ?? {});
2990
+ return pe.fromPartial(r ?? {});
2991
2991
  },
2992
2992
  fromPartial(r) {
2993
2993
  const e = Mt();
@@ -2997,7 +2997,7 @@ const ge = {
2997
2997
  function Ft() {
2998
2998
  return { reqId: "", code: 0, reason: "" };
2999
2999
  }
3000
- const pe = {
3000
+ const ge = {
3001
3001
  encode(r, e = new ue()) {
3002
3002
  return r.reqId !== "" && e.uint32(10).string(r.reqId), r.code !== 0 && e.uint32(16).int32(r.code), r.reason !== "" && e.uint32(26).string(r.reason), e;
3003
3003
  },
@@ -3045,7 +3045,7 @@ const pe = {
3045
3045
  return r.reqId !== "" && (e.reqId = r.reqId), r.code !== 0 && (e.code = Math.round(r.code)), r.reason !== "" && (e.reason = r.reason), e;
3046
3046
  },
3047
3047
  create(r) {
3048
- return pe.fromPartial(r ?? {});
3048
+ return ge.fromPartial(r ?? {});
3049
3049
  },
3050
3050
  fromPartial(r) {
3051
3051
  const e = Ft();
@@ -3057,7 +3057,7 @@ function Rt() {
3057
3057
  }
3058
3058
  const He = {
3059
3059
  encode(r, e = new ue()) {
3060
- return r.type !== 0 && e.uint32(8).int32(r.type), r.error !== void 0 && pe.encode(r.error, e.uint32(18).fork()).join(), r.serverResponseAnimation !== void 0 && ge.encode(r.serverResponseAnimation, e.uint32(26).fork()).join(), r.clientAudioInput !== void 0 && he.encode(r.clientAudioInput, e.uint32(34).fork()).join(), e;
3060
+ return r.type !== 0 && e.uint32(8).int32(r.type), r.error !== void 0 && ge.encode(r.error, e.uint32(18).fork()).join(), r.serverResponseAnimation !== void 0 && pe.encode(r.serverResponseAnimation, e.uint32(26).fork()).join(), r.clientAudioInput !== void 0 && he.encode(r.clientAudioInput, e.uint32(34).fork()).join(), e;
3061
3061
  },
3062
3062
  decode(r, e) {
3063
3063
  const t = r instanceof N ? r : new N(r);
@@ -3075,13 +3075,13 @@ const He = {
3075
3075
  case 2: {
3076
3076
  if (a !== 18)
3077
3077
  break;
3078
- i.error = pe.decode(t, t.uint32());
3078
+ i.error = ge.decode(t, t.uint32());
3079
3079
  continue;
3080
3080
  }
3081
3081
  case 3: {
3082
3082
  if (a !== 26)
3083
3083
  break;
3084
- i.serverResponseAnimation = ge.decode(t, t.uint32());
3084
+ i.serverResponseAnimation = pe.decode(t, t.uint32());
3085
3085
  continue;
3086
3086
  }
3087
3087
  case 4: {
@@ -3100,21 +3100,21 @@ const He = {
3100
3100
  fromJSON(r) {
3101
3101
  return {
3102
3102
  type: $(r.type) ? ci(r.type) : 0,
3103
- error: $(r.error) ? pe.fromJSON(r.error) : void 0,
3104
- serverResponseAnimation: $(r.serverResponseAnimation) ? ge.fromJSON(r.serverResponseAnimation) : void 0,
3103
+ error: $(r.error) ? ge.fromJSON(r.error) : void 0,
3104
+ serverResponseAnimation: $(r.serverResponseAnimation) ? pe.fromJSON(r.serverResponseAnimation) : void 0,
3105
3105
  clientAudioInput: $(r.clientAudioInput) ? he.fromJSON(r.clientAudioInput) : void 0
3106
3106
  };
3107
3107
  },
3108
3108
  toJSON(r) {
3109
3109
  const e = {};
3110
- return r.type !== 0 && (e.type = ui(r.type)), r.error !== void 0 && (e.error = pe.toJSON(r.error)), r.serverResponseAnimation !== void 0 && (e.serverResponseAnimation = ge.toJSON(r.serverResponseAnimation)), r.clientAudioInput !== void 0 && (e.clientAudioInput = he.toJSON(r.clientAudioInput)), e;
3110
+ return r.type !== 0 && (e.type = ui(r.type)), r.error !== void 0 && (e.error = ge.toJSON(r.error)), r.serverResponseAnimation !== void 0 && (e.serverResponseAnimation = pe.toJSON(r.serverResponseAnimation)), r.clientAudioInput !== void 0 && (e.clientAudioInput = he.toJSON(r.clientAudioInput)), e;
3111
3111
  },
3112
3112
  create(r) {
3113
3113
  return He.fromPartial(r ?? {});
3114
3114
  },
3115
3115
  fromPartial(r) {
3116
3116
  const e = Rt();
3117
- return e.type = r.type ?? 0, e.error = r.error !== void 0 && r.error !== null ? pe.fromPartial(r.error) : void 0, e.serverResponseAnimation = r.serverResponseAnimation !== void 0 && r.serverResponseAnimation !== null ? ge.fromPartial(r.serverResponseAnimation) : void 0, e.clientAudioInput = r.clientAudioInput !== void 0 && r.clientAudioInput !== null ? he.fromPartial(r.clientAudioInput) : void 0, e;
3117
+ return e.type = r.type ?? 0, e.error = r.error !== void 0 && r.error !== null ? ge.fromPartial(r.error) : void 0, e.serverResponseAnimation = r.serverResponseAnimation !== void 0 && r.serverResponseAnimation !== null ? pe.fromPartial(r.serverResponseAnimation) : void 0, e.clientAudioInput = r.clientAudioInput !== void 0 && r.clientAudioInput !== null ? he.fromPartial(r.clientAudioInput) : void 0, e;
3118
3118
  }
3119
3119
  };
3120
3120
  function di(r) {
@@ -3137,16 +3137,16 @@ let fi = (r) => crypto.getRandomValues(new Uint8Array(r)), mi = (r, e, t) => {
3137
3137
  return (a = e) => {
3138
3138
  let o = "";
3139
3139
  for (; ; ) {
3140
- let s = t(i), l = i | 0;
3141
- for (; l--; )
3142
- if (o += r[s[l] & n] || "", o.length >= a) return o;
3140
+ let l = t(i), s = i | 0;
3141
+ for (; s--; )
3142
+ if (o += r[l[s] & n] || "", o.length >= a) return o;
3143
3143
  }
3144
3144
  };
3145
- }, gi = (r, e = 21) => mi(r, e | 0, fi);
3146
- const pi = gi("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", 12);
3145
+ }, pi = (r, e = 21) => mi(r, e | 0, fi);
3146
+ const gi = pi("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", 12);
3147
3147
  function vi() {
3148
- const r = /* @__PURE__ */ new Date(), e = r.getUTCFullYear(), t = String(r.getUTCMonth() + 1).padStart(2, "0"), n = String(r.getUTCDate()).padStart(2, "0"), i = String(r.getUTCHours()).padStart(2, "0"), a = String(r.getUTCMinutes()).padStart(2, "0"), o = String(r.getUTCSeconds()).padStart(2, "0"), s = `${e}${t}${n}${i}${a}${o}`, l = pi();
3149
- return `${s}_${l}`;
3148
+ const r = /* @__PURE__ */ new Date(), e = r.getUTCFullYear(), t = String(r.getUTCMonth() + 1).padStart(2, "0"), n = String(r.getUTCDate()).padStart(2, "0"), i = String(r.getUTCHours()).padStart(2, "0"), a = String(r.getUTCMinutes()).padStart(2, "0"), o = String(r.getUTCSeconds()).padStart(2, "0"), l = `${e}${t}${n}${i}${a}${o}`, s = gi();
3149
+ return `${l}_${s}`;
3150
3150
  }
3151
3151
  class wi {
3152
3152
  constructor() {
@@ -3175,13 +3175,14 @@ class yi extends wi {
3175
3175
  d(this, "reconnectAttempts");
3176
3176
  d(this, "debug");
3177
3177
  d(this, "jwtToken");
3178
+ d(this, "appId");
3178
3179
  d(this, "ws", null);
3179
3180
  d(this, "currentCharacterId", "");
3180
3181
  d(this, "currentRetryCount", 0);
3181
3182
  d(this, "isConnecting", !1);
3182
3183
  d(this, "isManuallyDisconnected", !1);
3183
3184
  d(this, "reconnectTimer", null);
3184
- this.wsUrl = t.wsUrl, this.reconnectAttempts = t.reconnectAttempts ?? 5, this.debug = t.debug ?? !1, this.jwtToken = t.jwtToken;
3185
+ this.wsUrl = t.wsUrl, this.reconnectAttempts = t.reconnectAttempts ?? 5, this.debug = t.debug ?? !1, this.jwtToken = t.jwtToken, this.appId = t.appId;
3185
3186
  }
3186
3187
  /**
3187
3188
  * 连接WebSocket
@@ -3198,7 +3199,7 @@ class yi extends wi {
3198
3199
  try {
3199
3200
  this.isConnecting = !0, this.currentCharacterId = t;
3200
3201
  const n = this.buildWebSocketUrl(t);
3201
- h.log("[AnimationWebSocketClient] Connecting to:", n), await this.connectWebSocket(n), h.log("[AnimationWebSocketClient] Connected successfully"), A.logEvent("character_animation_service", "info", {
3202
+ h.log("[AnimationWebSocketClient] Connecting to:", n), await this.connectWebSocket(n), h.log("[AnimationWebSocketClient] Connected successfully"), S.logEvent("character_animation_service", "info", {
3202
3203
  characterId: t,
3203
3204
  event: "connect_success",
3204
3205
  url: n
@@ -3206,7 +3207,7 @@ class yi extends wi {
3206
3207
  } catch (n) {
3207
3208
  this.isConnecting = !1;
3208
3209
  const i = n instanceof Error ? n.message : String(n);
3209
- throw h.error("[AnimationWebSocketClient] Connection failed:", i), A.logEvent("character_animation_service", "error", {
3210
+ throw h.error("[AnimationWebSocketClient] Connection failed:", i), S.logEvent("character_animation_service", "error", {
3210
3211
  characterId: t,
3211
3212
  event: "connect_failed",
3212
3213
  reason: i
@@ -3235,11 +3236,11 @@ class yi extends wi {
3235
3236
  }
3236
3237
  }, o = new ue();
3237
3238
  He.encode(a, o);
3238
- const s = o.finish();
3239
- return this.ws.send(s), !0;
3239
+ const l = o.finish();
3240
+ return this.ws.send(l), !0;
3240
3241
  } catch (a) {
3241
3242
  const o = a instanceof Error ? a.message : String(a);
3242
- return h.error("[AnimationWebSocketClient] Failed to send audio data:", o), A.logEvent("character_animation_service", "warning", {
3243
+ return h.error("[AnimationWebSocketClient] Failed to send audio data:", o), S.logEvent("character_animation_service", "warning", {
3243
3244
  characterId: this.currentCharacterId,
3244
3245
  event: "send_audio_failed",
3245
3246
  reqId: t,
@@ -3269,7 +3270,7 @@ class yi extends wi {
3269
3270
  // ========== 私有方法 ==========
3270
3271
  buildWebSocketUrl(t) {
3271
3272
  const n = new URL(this.wsUrl);
3272
- return n.searchParams.set("id", t), this.jwtToken && n.searchParams.set("token", this.jwtToken), n.toString();
3273
+ return n.searchParams.set("id", t), this.jwtToken && n.searchParams.set("token", this.jwtToken), this.appId && n.searchParams.set("appId", this.appId), n.toString();
3273
3274
  }
3274
3275
  connectWebSocket(t) {
3275
3276
  return new Promise((n, i) => {
@@ -3278,19 +3279,19 @@ class yi extends wi {
3278
3279
  this.isConnecting = !1, this.currentRetryCount = 0, this.isManuallyDisconnected = !1, this.emit("connected"), n();
3279
3280
  }, this.ws.onmessage = (a) => {
3280
3281
  a.data instanceof ArrayBuffer ? this.handleMessage(a.data) : a.data instanceof Blob ? a.data.arrayBuffer().then(this.handleMessage.bind(this)).catch((o) => {
3281
- h.error("[AnimationWebSocketClient] Failed to convert Blob to ArrayBuffer:", o), A.logEvent("character_animation_service", "error", {
3282
+ h.error("[AnimationWebSocketClient] Failed to convert Blob to ArrayBuffer:", o), S.logEvent("character_animation_service", "error", {
3282
3283
  characterId: this.currentCharacterId,
3283
3284
  event: "decode_blob_failed",
3284
3285
  reason: o instanceof Error ? o.message : String(o)
3285
3286
  }), this.emit("error", o);
3286
3287
  }) : h.warn("[AnimationWebSocketClient] Received non-binary data:", typeof a.data);
3287
3288
  }, this.ws.onerror = (a) => {
3288
- h.errorWithError("[AnimationWebSocketClient] WebSocket error:", a), A.logEvent("character_animation_service", "error", {
3289
+ h.errorWithError("[AnimationWebSocketClient] WebSocket error:", a), S.logEvent("character_animation_service", "error", {
3289
3290
  characterId: this.currentCharacterId,
3290
3291
  event: "websocket_error"
3291
3292
  }), this.emit("error", new Error("WebSocket error")), !this.isManuallyDisconnected && this.currentRetryCount < this.reconnectAttempts && this.scheduleReconnect();
3292
3293
  }, this.ws.onclose = (a) => {
3293
- h.log("[AnimationWebSocketClient] WebSocket closed:", a.code, a.reason), this.emit("disconnected", a.reason || "Connection closed"), a.code === 1012 && A.logEvent("character_animation_service", "error", {
3294
+ h.log("[AnimationWebSocketClient] WebSocket closed:", a.code, a.reason), this.emit("disconnected", a.reason || "Connection closed"), a.code === 1012 && S.logEvent("character_animation_service", "error", {
3294
3295
  characterId: this.currentCharacterId,
3295
3296
  event: "service_restart",
3296
3297
  reason: a.reason || "service restart"
@@ -3305,7 +3306,7 @@ class yi extends wi {
3305
3306
  try {
3306
3307
  const n = new N(new Uint8Array(t)), i = He.decode(n);
3307
3308
  if (i.error) {
3308
- h.error(`[AnimationWebSocketClient] Server error: reqId=${i.error.reqId}, code=${i.error.code}, reason=${i.error.reason}`), A.logEvent("character_animation_service", "error", {
3309
+ h.error(`[AnimationWebSocketClient] Server error: reqId=${i.error.reqId}, code=${i.error.code}, reason=${i.error.reason}`), S.logEvent("character_animation_service", "error", {
3309
3310
  characterId: this.currentCharacterId,
3310
3311
  event: "server_error",
3311
3312
  reqId: i.error.reqId,
@@ -3315,7 +3316,7 @@ class yi extends wi {
3315
3316
  return;
3316
3317
  }
3317
3318
  if (i.type === Ee.MESSAGE_ERROR) {
3318
- h.warn("[AnimationWebSocketClient] MESSAGE_ERROR received but no error field in message"), A.logEvent("character_animation_service", "warning", {
3319
+ h.warn("[AnimationWebSocketClient] MESSAGE_ERROR received but no error field in message"), S.logEvent("character_animation_service", "warning", {
3319
3320
  characterId: this.currentCharacterId,
3320
3321
  event: "message_error_without_payload"
3321
3322
  }), this.emit("error", new Error("Server returned error message without error details"));
@@ -3324,7 +3325,7 @@ class yi extends wi {
3324
3325
  this.emit("message", i);
3325
3326
  } catch (n) {
3326
3327
  const i = n instanceof Error ? n.message : String(n);
3327
- h.error("[AnimationWebSocketClient] Failed to decode message:", i), A.logEvent("character_animation_service", "error", {
3328
+ h.error("[AnimationWebSocketClient] Failed to decode message:", i), S.logEvent("character_animation_service", "error", {
3328
3329
  characterId: this.currentCharacterId,
3329
3330
  event: "decode_failed",
3330
3331
  reason: i
@@ -3341,7 +3342,7 @@ class yi extends wi {
3341
3342
  }, t);
3342
3343
  }
3343
3344
  }
3344
- class Si {
3345
+ class Ai {
3345
3346
  constructor(e) {
3346
3347
  d(this, "wsClient");
3347
3348
  d(this, "dataController");
@@ -3351,12 +3352,13 @@ class Si {
3351
3352
  d(this, "audioBytesPerSecond", M.audio.sampleRate * 2);
3352
3353
  d(this, "audioMetrics", this.createAudioMetrics());
3353
3354
  this.dataController = e;
3354
- const t = A.getEnvironmentConfig();
3355
+ const t = S.getEnvironmentConfig();
3355
3356
  this.wsClient = new yi({
3356
3357
  wsUrl: t.driveningressWsUrl,
3357
3358
  reconnectAttempts: 5,
3358
3359
  debug: !1,
3359
- jwtToken: A.sessionToken || void 0
3360
+ jwtToken: S.sessionToken || void 0,
3361
+ appId: S.appId || void 0
3360
3362
  }), this.setupWebSocketListeners();
3361
3363
  }
3362
3364
  /**
@@ -3369,8 +3371,8 @@ class Si {
3369
3371
  * 发送音频数据到服务器
3370
3372
  */
3371
3373
  sendAudioData(e, t) {
3372
- var s, l;
3373
- this.hasSentEnd && this.dataController.getIsPlaying() && this.currentReqId && this.dataController.interrupt(), this.currentReqId || (this.currentReqId = this.wsClient.generateReqId(), this.hasSentEnd = !1, this.resetAudioMetrics(), A.logEvent("character_manager", "info", {
3374
+ var l, s;
3375
+ this.hasSentEnd && this.dataController.getIsPlaying() && this.currentReqId && this.dataController.interrupt(), this.currentReqId || (this.currentReqId = this.wsClient.generateReqId(), this.hasSentEnd = !1, this.resetAudioMetrics(), S.logEvent("character_manager", "info", {
3374
3376
  characterId: this.dataController.getAvatarId(),
3375
3377
  event: "conversation_started",
3376
3378
  reqId: this.currentReqId
@@ -3380,7 +3382,7 @@ class Si {
3380
3382
  n.startTimestamp === 0 && (n.startTimestamp = Date.now(), i = !0), n.accumulatedBytes += e.byteLength;
3381
3383
  const a = n.accumulatedBytes / this.audioBytesPerSecond;
3382
3384
  if (a >= 2 && n.tap2Timestamp === 0 && (n.tap2Timestamp = Date.now(), i = !0), a >= 4 && n.tap4Timestamp === 0 && (n.tap4Timestamp = Date.now(), i = !0), t && n.endTimestamp === 0 && (n.endTimestamp = Date.now(), i = !0), e.byteLength === 0 && !t && h.warn("[NetworkLayer] Warning: sending empty audio data (size=0, end=false)"), !this.wsClient.sendAudioData(this.currentReqId, e, t)) {
3383
- h.error("[NetworkLayer] Failed to send audio data to WebSocket"), (l = (s = this.dataController).onError) == null || l.call(s, new se("Failed to send audio data to WebSocket", "SEND_FAILED")), A.logEvent("character_animation_service", "error", {
3385
+ h.error("[NetworkLayer] Failed to send audio data to WebSocket"), (s = (l = this.dataController).onError) == null || s.call(l, new se("Failed to send audio data to WebSocket", "SEND_FAILED")), S.logEvent("character_animation_service", "error", {
3384
3386
  characterId: this.dataController.getAvatarId(),
3385
3387
  event: "send_audio_failed",
3386
3388
  reqId: this.currentReqId
@@ -3413,29 +3415,29 @@ class Si {
3413
3415
  setupWebSocketListeners() {
3414
3416
  this.wsClient.on("connected", () => {
3415
3417
  var e, t;
3416
- this.dataController.setConnected(!0), (t = (e = this.dataController).onConnectionState) == null || t.call(e, Ae.connected), A.logEvent("character_animation_service", "info", {
3418
+ this.dataController.setConnected(!0), (t = (e = this.dataController).onConnectionState) == null || t.call(e, Se.connected), S.logEvent("character_animation_service", "info", {
3417
3419
  characterId: this.dataController.getAvatarId(),
3418
3420
  event: "connected"
3419
3421
  });
3420
3422
  }), this.wsClient.on("disconnected", () => {
3421
3423
  var e, t;
3422
- this.dataController.setConnected(!1), (t = (e = this.dataController).onConnectionState) == null || t.call(e, Ae.disconnected), A.logEvent("character_animation_service", "warning", {
3424
+ this.dataController.setConnected(!1), (t = (e = this.dataController).onConnectionState) == null || t.call(e, Se.disconnected), S.logEvent("character_animation_service", "warning", {
3423
3425
  characterId: this.dataController.getAvatarId(),
3424
3426
  event: "disconnected"
3425
3427
  });
3426
3428
  }), this.wsClient.on("reconnecting", () => {
3427
- A.logEvent("character_animation_service", "info", {
3429
+ S.logEvent("character_animation_service", "info", {
3428
3430
  characterId: this.dataController.getAvatarId(),
3429
3431
  event: "reconnecting"
3430
3432
  });
3431
3433
  }), this.wsClient.on("error", (e) => {
3432
3434
  var n, i, a, o;
3433
3435
  const t = e instanceof Error ? e.message : String(e);
3434
- h.error("[NetworkLayer] WebSocket error:", t), A.logEvent("character_animation_service", "error", {
3436
+ h.error("[NetworkLayer] WebSocket error:", t), S.logEvent("character_animation_service", "error", {
3435
3437
  characterId: this.dataController.getAvatarId(),
3436
3438
  event: "websocket_error",
3437
3439
  reason: t
3438
- }), (i = (n = this.dataController).onConnectionState) == null || i.call(n, Ae.failed), (o = (a = this.dataController).onError) == null || o.call(a, e);
3440
+ }), (i = (n = this.dataController).onConnectionState) == null || i.call(n, Se.failed), (o = (a = this.dataController).onError) == null || o.call(a, e);
3439
3441
  }), this.wsClient.on("message", (e) => {
3440
3442
  this.handleMessage(e);
3441
3443
  });
@@ -3455,7 +3457,7 @@ class Si {
3455
3457
  }
3456
3458
  } catch (t) {
3457
3459
  const n = t instanceof Error ? t.message : String(t);
3458
- h.error("[NetworkLayer] Failed to handle message:", n), A.logEvent("character_manager", "error", {
3460
+ h.error("[NetworkLayer] Failed to handle message:", n), S.logEvent("character_manager", "error", {
3459
3461
  characterId: this.dataController.getAvatarId(),
3460
3462
  event: "handle_message_failed",
3461
3463
  reason: n
@@ -3472,7 +3474,7 @@ class Si {
3472
3474
  }
3473
3475
  const { reqId: t, animation: n } = e.serverResponseAnimation;
3474
3476
  if (!this.currentReqId || t !== this.currentReqId) {
3475
- h.warn(`[NetworkLayer] Ignoring mismatched animation message - expected reqId: ${this.currentReqId}, received reqId: ${t}`), A.logEvent("character_manager", "warning", {
3477
+ h.warn(`[NetworkLayer] Ignoring mismatched animation message - expected reqId: ${this.currentReqId}, received reqId: ${t}`), S.logEvent("character_manager", "warning", {
3476
3478
  characterId: this.dataController.getAvatarId(),
3477
3479
  event: "animation_reqid_mismatch",
3478
3480
  expectedReqId: this.currentReqId,
@@ -3484,7 +3486,7 @@ class Si {
3484
3486
  const i = n.keyframes;
3485
3487
  this.dataController.sendKeyframes(i), this.dataController.getIsPlaying() || this.dataController.startStreamingPlayback(), this.audioMetrics.didRecvFirstFlame || (this.audioMetrics.didRecvFirstFlame = !0, this.audioMetrics.recvFirstFlameTimestamp = Date.now(), this.currentReqId && this.reportAudioMetrics(this.currentReqId));
3486
3488
  } else
3487
- h.warn(`[NetworkLayer] Animation message has no keyframes - reqId: ${t}`), A.logEvent("character_manager", "warning", {
3489
+ h.warn(`[NetworkLayer] Animation message has no keyframes - reqId: ${t}`), S.logEvent("character_manager", "warning", {
3488
3490
  characterId: this.dataController.getAvatarId(),
3489
3491
  event: "animation_empty_keyframes",
3490
3492
  reqId: t
@@ -3496,13 +3498,13 @@ class Si {
3496
3498
  handleErrorMessage(e) {
3497
3499
  var n, i, a, o;
3498
3500
  if (!e.error) {
3499
- h.warn("[NetworkLayer] MESSAGE_ERROR received but message.error is empty"), e.serverResponseAnimation && (h.warn("[NetworkLayer] MESSAGE_ERROR contains animation data, treating as animation message"), A.logEvent("character_manager", "warning", {
3501
+ h.warn("[NetworkLayer] MESSAGE_ERROR received but message.error is empty"), e.serverResponseAnimation && (h.warn("[NetworkLayer] MESSAGE_ERROR contains animation data, treating as animation message"), S.logEvent("character_manager", "warning", {
3500
3502
  characterId: this.dataController.getAvatarId(),
3501
3503
  event: "message_error_with_payload"
3502
3504
  }), this.handleAnimationMessage(e));
3503
3505
  return;
3504
3506
  }
3505
- h.error(`[NetworkLayer] Server error: reqId=${e.error.reqId}, code=${e.error.code}, reason=${e.error.reason}`), A.logEvent("character_manager", "error", {
3507
+ h.error(`[NetworkLayer] Server error: reqId=${e.error.reqId}, code=${e.error.code}, reason=${e.error.reason}`), S.logEvent("character_manager", "error", {
3506
3508
  characterId: this.dataController.getAvatarId(),
3507
3509
  event: "server_error",
3508
3510
  reqId: e.error.reqId,
@@ -3510,7 +3512,7 @@ class Si {
3510
3512
  reason: e.error.reason
3511
3513
  });
3512
3514
  const t = ((n = e.error.code) == null ? void 0 : n.toString().toLowerCase()) ?? "";
3513
- (t.includes("unauth") || t === "401") && A.logEvent("sdk_verify", "error", {
3515
+ (t.includes("unauth") || t === "401") && S.logEvent("sdk_verify", "error", {
3514
3516
  characterId: this.dataController.getAvatarId(),
3515
3517
  reqId: e.error.reqId,
3516
3518
  reason: e.error.reason
@@ -3543,7 +3545,7 @@ class Si {
3543
3545
  * 上报音频指标
3544
3546
  */
3545
3547
  reportAudioMetrics(e) {
3546
- !e || this.audioMetrics.startTimestamp === 0 || A.logEvent("send_audio_measure", "info", {
3548
+ !e || this.audioMetrics.startTimestamp === 0 || S.logEvent("send_audio_measure", "info", {
3547
3549
  reqId: e,
3548
3550
  start: this.audioMetrics.startTimestamp,
3549
3551
  tap2: this.audioMetrics.tap2Timestamp,
@@ -3553,7 +3555,7 @@ class Si {
3553
3555
  });
3554
3556
  }
3555
3557
  }
3556
- class Ai {
3558
+ class Si {
3557
3559
  constructor(e, t) {
3558
3560
  // ========== Configuration and Composition ==========
3559
3561
  d(this, "networkLayer");
@@ -3578,7 +3580,7 @@ class Ai {
3578
3580
  // ========== Playback Loop ==========
3579
3581
  d(this, "playbackLoopId", null);
3580
3582
  d(this, "lastRenderedFrameIndex", -1);
3581
- this.avatar = e, this.playbackMode = (t == null ? void 0 : t.playbackMode) ?? ke.network, this.playbackMode === ke.network && (this.networkLayer = new Si(this));
3583
+ this.avatar = e, this.playbackMode = (t == null ? void 0 : t.playbackMode) ?? ke.network, this.playbackMode === ke.network && (this.networkLayer = new Ai(this));
3582
3584
  }
3583
3585
  // ========== Internal Accessors (for NetworkLayer and AvatarView) ==========
3584
3586
  /**
@@ -3639,7 +3641,7 @@ class Ai {
3639
3641
  await this.animationPlayer.createAndInitializeStreamingPlayer();
3640
3642
  } catch (e) {
3641
3643
  const t = e instanceof Error ? e.message : String(e);
3642
- throw h.error("[AvatarController] Failed to create streaming player:", t), A.logEvent("character_player", "error", {
3644
+ throw h.error("[AvatarController] Failed to create streaming player:", t), S.logEvent("character_player", "error", {
3643
3645
  characterId: this.avatar.id,
3644
3646
  event: "streaming_player_init_failed",
3645
3647
  reason: t
@@ -3655,7 +3657,7 @@ class Ai {
3655
3657
  send(e, t = !1) {
3656
3658
  var n, i;
3657
3659
  if (!this.networkLayer || !this.isConnected) {
3658
- (n = this.onError) == null || n.call(this, new se("Service not connected", "NOT_CONNECTED")), A.logEvent("character_manager", "warning", {
3660
+ (n = this.onError) == null || n.call(this, new se("Service not connected", "NOT_CONNECTED")), S.logEvent("character_manager", "warning", {
3659
3661
  characterId: this.avatar.id,
3660
3662
  event: "send_not_connected"
3661
3663
  });
@@ -3668,7 +3670,7 @@ class Ai {
3668
3670
  */
3669
3671
  close() {
3670
3672
  var e, t;
3671
- (this.isPlaying || this.currentState === T.paused) && this.stopPlayback(), this.currentKeyframes = [], this.pendingAudioChunks = [], this.lastRenderedFrameIndex = -1, (e = this.networkLayer) == null || e.disconnect(), this.isConnected = !1, (t = this.onConnectionState) == null || t.call(this, Ae.disconnected);
3673
+ (this.isPlaying || this.currentState === T.paused) && this.stopPlayback(), this.currentKeyframes = [], this.pendingAudioChunks = [], this.lastRenderedFrameIndex = -1, (e = this.networkLayer) == null || e.disconnect(), this.isConnected = !1, (t = this.onConnectionState) == null || t.call(this, Se.disconnected);
3672
3674
  }
3673
3675
  // ========== External Data Mode Interface ==========
3674
3676
  /**
@@ -3706,7 +3708,7 @@ class Ai {
3706
3708
  */
3707
3709
  pause() {
3708
3710
  var e, t, n;
3709
- !this.isPlaying || this.currentState === T.paused || (h.log("[AvatarController] Pausing playback"), (e = this.animationPlayer) == null || e.pause(), this.stopPlaybackLoop(), this.currentState = T.paused, (t = this.onAvatarState) == null || t.call(this, T.paused), h.log("[AvatarController] Playback paused"), A.logEvent("character_player", "info", {
3711
+ !this.isPlaying || this.currentState === T.paused || (h.log("[AvatarController] Pausing playback"), (e = this.animationPlayer) == null || e.pause(), this.stopPlaybackLoop(), this.currentState = T.paused, (t = this.onAvatarState) == null || t.call(this, T.paused), h.log("[AvatarController] Playback paused"), S.logEvent("character_player", "info", {
3710
3712
  characterId: this.avatar.id,
3711
3713
  event: "playback_paused",
3712
3714
  reqId: ((n = this.networkLayer) == null ? void 0 : n.getCurrentReqId()) || void 0
@@ -3719,7 +3721,7 @@ class Ai {
3719
3721
  */
3720
3722
  async resume() {
3721
3723
  var e, t, n;
3722
- !this.isPlaying || this.currentState !== T.paused || (h.log("[AvatarController] Resuming playback"), await ((e = this.animationPlayer) == null ? void 0 : e.resume()), this.startPlaybackLoop(), this.currentState = T.playing, (t = this.onAvatarState) == null || t.call(this, T.playing), h.log("[AvatarController] Playback resumed"), A.logEvent("character_player", "info", {
3724
+ !this.isPlaying || this.currentState !== T.paused || (h.log("[AvatarController] Resuming playback"), await ((e = this.animationPlayer) == null ? void 0 : e.resume()), this.startPlaybackLoop(), this.currentState = T.playing, (t = this.onAvatarState) == null || t.call(this, T.playing), h.log("[AvatarController] Playback resumed"), S.logEvent("character_player", "info", {
3723
3725
  characterId: this.avatar.id,
3724
3726
  event: "playback_resumed",
3725
3727
  reqId: ((n = this.networkLayer) == null ? void 0 : n.getCurrentReqId()) || void 0
@@ -3803,14 +3805,14 @@ class Ai {
3803
3805
  try {
3804
3806
  await this.animationPlayer.prepareStreamingPlayer(() => {
3805
3807
  var a, o;
3806
- this.isPlaying = !1, this.currentState = T.idle, (a = this.onAvatarState) == null || a.call(this, T.idle), this.emit("stopRendering"), this.currentKeyframes = [], this.pendingAudioChunks = [], this.lastRenderedFrameIndex = -1, this.networkLayer && this.networkLayer.resetReqId(), A.logEvent("character_player", "info", {
3808
+ this.isPlaying = !1, this.currentState = T.idle, (a = this.onAvatarState) == null || a.call(this, T.idle), this.emit("stopRendering"), this.currentKeyframes = [], this.pendingAudioChunks = [], this.lastRenderedFrameIndex = -1, this.networkLayer && this.networkLayer.resetReqId(), S.logEvent("character_player", "info", {
3807
3809
  characterId: this.avatar.id,
3808
3810
  event: "playback_ended",
3809
3811
  reqId: ((o = this.networkLayer) == null ? void 0 : o.getCurrentReqId()) || void 0
3810
3812
  });
3811
3813
  }), this.emit("startRendering");
3812
3814
  const i = this.animationPlayer.getStreamingPlayer();
3813
- i && i.setAutoStart(!1), i && await i.startNewSession(this.pendingAudioChunks), this.pendingAudioChunks = [], this.isPlaying = !0, this.currentState = T.playing, (e = this.onAvatarState) == null || e.call(this, T.playing), this.startPlaybackLoop(), A.logEvent("character_player", "info", {
3815
+ i && i.setAutoStart(!1), i && await i.startNewSession(this.pendingAudioChunks), this.pendingAudioChunks = [], this.isPlaying = !0, this.currentState = T.playing, (e = this.onAvatarState) == null || e.call(this, T.playing), this.startPlaybackLoop(), S.logEvent("character_player", "info", {
3814
3816
  characterId: this.avatar.id,
3815
3817
  event: "playback_started",
3816
3818
  reqId: ((t = this.networkLayer) == null ? void 0 : t.getCurrentReqId()) || void 0
@@ -3843,10 +3845,10 @@ class Ai {
3843
3845
  return;
3844
3846
  }
3845
3847
  if (this.lastRenderedFrameIndex = i, i >= 0 && i < this.currentKeyframes.length) {
3846
- const a = this.currentKeyframes[i], o = Vt(a), s = A.getAvatarCore();
3847
- if (s) {
3848
- const l = await s.computeFrameFlatFromParams(o);
3849
- l && this.renderCallback && this.renderCallback(l, i);
3848
+ const a = this.currentKeyframes[i], o = Vt(a), l = S.getAvatarCore();
3849
+ if (l) {
3850
+ const s = await l.computeFrameFlatFromParams(o);
3851
+ s && this.renderCallback && this.renderCallback(s, i);
3850
3852
  }
3851
3853
  }
3852
3854
  } catch (n) {
@@ -3919,10 +3921,14 @@ function nr(r) {
3919
3921
  }
3920
3922
  async function bi(r) {
3921
3923
  try {
3922
- const e = await fetch(r);
3923
- if (!e.ok)
3924
- throw new Error(`HTTP ${e.status} ${e.statusText}`);
3925
- return await e.arrayBuffer();
3924
+ const e = {}, t = S.appId, n = S.sessionToken;
3925
+ t && (e["X-App-Id"] = t), n && (e.Authorization = `Bearer ${n}`);
3926
+ const i = await fetch(r, {
3927
+ headers: Object.keys(e).length > 0 ? e : void 0
3928
+ });
3929
+ if (!i.ok)
3930
+ throw new Error(`HTTP ${i.status} ${i.statusText}`);
3931
+ return await i.arrayBuffer();
3926
3932
  } catch (e) {
3927
3933
  const t = nr(e);
3928
3934
  throw new Error(`[downloadResource] ${r} → ${t}`);
@@ -3970,7 +3976,7 @@ class Ci {
3970
3976
  }
3971
3977
  }, a = Object.keys(i).length;
3972
3978
  let o = 0;
3973
- const s = (w, y) => {
3979
+ const l = (w, y) => {
3974
3980
  t && (y && o++, t({
3975
3981
  stage: "template",
3976
3982
  filename: w,
@@ -3978,14 +3984,14 @@ class Ci {
3978
3984
  total: a,
3979
3985
  progress: Math.round(o / a * 100)
3980
3986
  }));
3981
- }, l = {}, g = Object.entries(i).map(async ([w, { url: y, resourceName: b }]) => {
3987
+ }, s = {}, p = Object.entries(i).map(async ([w, { url: y, resourceName: b }]) => {
3982
3988
  if (!y)
3983
3989
  throw new Error(`[loadTemplateResources] Missing CDN URL for ${w} (${b})`);
3984
- s(b, !1), h.log(`📥 Loading ${w} from API CDN: ${y}`);
3985
- const x = await $e(y);
3986
- h.log(`✅ ${w} loaded: ${x.byteLength} bytes`), l[w] = x, s(b, !0);
3990
+ l(b, !1), h.log(`📥 Loading ${w} from API CDN: ${y}`);
3991
+ const I = await $e(y);
3992
+ h.log(`✅ ${w} loaded: ${I.byteLength} bytes`), s[w] = I, l(b, !0);
3987
3993
  });
3988
- return await Promise.all(g), l;
3994
+ return await Promise.all(p), s;
3989
3995
  }
3990
3996
  /**
3991
3997
  * Load global FLAME template resources from CDN
@@ -4011,7 +4017,7 @@ class Ci {
4011
4017
  }
4012
4018
  }, a = Object.keys(i).length;
4013
4019
  let o = 0;
4014
- const s = (c, u) => {
4020
+ const l = (c, u) => {
4015
4021
  e && (u && o++, e({
4016
4022
  stage: "template",
4017
4023
  filename: c,
@@ -4019,12 +4025,12 @@ class Ci {
4019
4025
  total: a,
4020
4026
  progress: Math.round(o / a * 100)
4021
4027
  }));
4022
- }, l = {}, g = Object.entries(i).map(async ([c, { url: u, resourceName: m }]) => {
4023
- s(m, !1), h.log(`📥 Loading ${c} from global CDN: ${u}`);
4028
+ }, s = {}, p = Object.entries(i).map(async ([c, { url: u, resourceName: m }]) => {
4029
+ l(m, !1), h.log(`📥 Loading ${c} from global CDN: ${u}`);
4024
4030
  const v = await $e(u);
4025
- h.log(`✅ ${c} loaded: ${v.byteLength} bytes`), l[c] = v, s(m, !0);
4031
+ h.log(`✅ ${c} loaded: ${v.byteLength} bytes`), s[c] = v, l(m, !0);
4026
4032
  });
4027
- return await Promise.all(g), l;
4033
+ return await Promise.all(p), s;
4028
4034
  }
4029
4035
  /**
4030
4036
  * Load camera settings from CharacterMeta (optional)
@@ -4038,11 +4044,15 @@ class Ci {
4038
4044
  }
4039
4045
  try {
4040
4046
  h.log(`📥 Loading camera info from: ${t}`);
4041
- const a = await fetch(t);
4042
- if (!a.ok)
4043
- throw new Error(`Failed to fetch camera info: ${a.statusText}`);
4044
- const o = await a.json();
4045
- return h.log("✅ Camera info loaded:", o), o;
4047
+ const a = {}, o = S.appId, l = S.sessionToken;
4048
+ o && (a["X-App-Id"] = o), l && (a.Authorization = `Bearer ${l}`);
4049
+ const s = await fetch(t, {
4050
+ headers: Object.keys(a).length > 0 ? a : void 0
4051
+ });
4052
+ if (!s.ok)
4053
+ throw new Error(`Failed to fetch camera info: ${s.statusText}`);
4054
+ const p = await s.json();
4055
+ return h.log("✅ Camera info loaded:", p), p;
4046
4056
  } catch (a) {
4047
4057
  h.warn("⚠️ Failed to load camera info, using default:", a);
4048
4058
  return;
@@ -4052,11 +4062,11 @@ class Ci {
4052
4062
  * Load character data from CharacterMeta (iOS compatible)
4053
4063
  */
4054
4064
  async loadCharacterData(e, t) {
4055
- var b, x, L, _, Y, G, U, j, X, J, re, z, we, de, ne;
4056
- const { loadMonologue: n = !1, progressCallback: i = null } = t || {}, a = (L = (x = (b = e.models) == null ? void 0 : b.shape) == null ? void 0 : x.resource) == null ? void 0 : L.remote, o = (G = (Y = (_ = e.models) == null ? void 0 : _.gsStandard) == null ? void 0 : Y.resource) == null ? void 0 : G.remote, s = (X = (j = (U = e.animations) == null ? void 0 : U.frameIdle) == null ? void 0 : j.resource) == null ? void 0 : X.remote, l = (z = (re = (J = e.animations) == null ? void 0 : J.frameMono) == null ? void 0 : re.resource) == null ? void 0 : z.remote, g = (ne = (de = (we = e.animations) == null ? void 0 : we.audioMono) == null ? void 0 : de.resource) == null ? void 0 : ne.remote;
4065
+ var b, I, L, _, X, G, U, j, Y, J, re, z, we, de, ne;
4066
+ const { loadMonologue: n = !1, progressCallback: i = null } = t || {}, a = (L = (I = (b = e.models) == null ? void 0 : b.shape) == null ? void 0 : I.resource) == null ? void 0 : L.remote, o = (G = (X = (_ = e.models) == null ? void 0 : _.gsStandard) == null ? void 0 : X.resource) == null ? void 0 : G.remote, l = (Y = (j = (U = e.animations) == null ? void 0 : U.frameIdle) == null ? void 0 : j.resource) == null ? void 0 : Y.remote, s = (z = (re = (J = e.animations) == null ? void 0 : J.frameMono) == null ? void 0 : re.resource) == null ? void 0 : z.remote, p = (ne = (de = (we = e.animations) == null ? void 0 : we.audioMono) == null ? void 0 : de.resource) == null ? void 0 : ne.remote;
4057
4067
  if (!a || !o) {
4058
4068
  const B = "Missing required resources: shape or gsStandard (point cloud)";
4059
- throw A.logEvent("character_load", "error", {
4069
+ throw S.logEvent("character_load", "error", {
4060
4070
  characterId: e.characterId ?? "unknown",
4061
4071
  stage: "resource_validation",
4062
4072
  reason: B
@@ -4066,7 +4076,7 @@ class Ci {
4066
4076
  { key: "shape", url: a, filename: "shape.pb" },
4067
4077
  { key: "pointCloud", url: o, filename: "point_cloud.ply" }
4068
4078
  ];
4069
- s && c.push({ key: "idleAnimation", url: s, filename: "idle.pb", optional: !0 }), n && l ? (h.log("📥 Loading monologue animation (enabled by option)"), c.push({ key: "monoAnimation", url: l, filename: "mono.pb", optional: !0 })) : !n && l && h.log("⏭️ Skipping monologue animation (disabled by option)");
4079
+ l && c.push({ key: "idleAnimation", url: l, filename: "idle.pb", optional: !0 }), n && s ? (h.log("📥 Loading monologue animation (enabled by option)"), c.push({ key: "monoAnimation", url: s, filename: "mono.pb", optional: !0 })) : !n && s && h.log("⏭️ Skipping monologue animation (disabled by option)");
4070
4080
  let u = 0;
4071
4081
  const m = c.length, v = (B, V) => {
4072
4082
  i && (V && u++, i({
@@ -4087,9 +4097,9 @@ class Ci {
4087
4097
  return h.warn(`⚠️ Optional resource ${ie} failed to load:`, q), v(ie, !0), { key: B, success: !1 };
4088
4098
  }
4089
4099
  });
4090
- if (await Promise.all(y), n && g && (w.monoAudioUrl = g), !w.shape || !w.pointCloud) {
4100
+ if (await Promise.all(y), n && p && (w.monoAudioUrl = p), !w.shape || !w.pointCloud) {
4091
4101
  const B = "Failed to load character data";
4092
- throw A.logEvent("character_load", "error", {
4102
+ throw S.logEvent("character_load", "error", {
4093
4103
  characterId: e.characterId ?? "unknown",
4094
4104
  stage: "download",
4095
4105
  reason: B
@@ -4101,19 +4111,19 @@ class Ci {
4101
4111
  * Preload all resources (template + character data + camera info + settings)
4102
4112
  */
4103
4113
  async preloadResources(e, t) {
4104
- const { loadMonologue: n = !1, progressCallback: i = null } = t || {}, [a, o, s] = await Promise.all([
4105
- this.loadTemplateResources(e.flame, (l) => {
4114
+ const { loadMonologue: n = !1, progressCallback: i = null } = t || {}, [a, o, l] = await Promise.all([
4115
+ this.loadTemplateResources(e.flame, (s) => {
4106
4116
  i && i({
4107
- ...l,
4108
- stage: `template-${l.stage}`
4117
+ ...s,
4118
+ stage: `template-${s.stage}`
4109
4119
  });
4110
4120
  }),
4111
4121
  this.loadCharacterData(e, {
4112
4122
  loadMonologue: n,
4113
- progressCallback: (l) => {
4123
+ progressCallback: (s) => {
4114
4124
  i && i({
4115
- ...l,
4116
- stage: `character-${l.stage}`
4125
+ ...s,
4126
+ stage: `character-${s.stage}`
4117
4127
  });
4118
4128
  }
4119
4129
  }),
@@ -4122,7 +4132,7 @@ class Ci {
4122
4132
  return {
4123
4133
  templateResources: a,
4124
4134
  characterData: o,
4125
- preloadCameraSettings: s,
4135
+ preloadCameraSettings: l,
4126
4136
  characterSettings: e.characterSettings
4127
4137
  };
4128
4138
  }
@@ -4146,22 +4156,25 @@ class Ci {
4146
4156
  getSdkApiClient() {
4147
4157
  return {
4148
4158
  async request(e, t = {}) {
4149
- const a = A.getEnvironmentConfig().sdkApiBaseUrl + e;
4159
+ const a = S.getEnvironmentConfig().sdkApiBaseUrl + e, o = {
4160
+ "Content-Type": "application/json"
4161
+ }, l = S.appId, s = S.sessionToken;
4162
+ l && (o["X-App-Id"] = l), s && (o.Authorization = `Bearer ${s}`);
4150
4163
  try {
4151
- const o = await fetch(a, {
4164
+ const p = await fetch(a, {
4152
4165
  method: t.method || "GET",
4153
4166
  headers: {
4154
- "Content-Type": "application/json",
4167
+ ...o,
4155
4168
  ...t.headers
4156
4169
  },
4157
4170
  body: t.body ? JSON.stringify(t.body) : void 0
4158
4171
  });
4159
- if (!o.ok)
4160
- throw new Error(`HTTP ${o.status} ${o.statusText}`);
4161
- return o.json();
4162
- } catch (o) {
4163
- const s = nr(o);
4164
- throw new Error(`[SdkApiClient] ${a} → ${s}`);
4172
+ if (!p.ok)
4173
+ throw new Error(`HTTP ${p.status} ${p.statusText}`);
4174
+ return p.json();
4175
+ } catch (p) {
4176
+ const c = nr(p);
4177
+ throw new Error(`[SdkApiClient] ${a} → ${c}`);
4165
4178
  }
4166
4179
  }
4167
4180
  };
@@ -4181,7 +4194,7 @@ class Ci {
4181
4194
  } catch (n) {
4182
4195
  h.errorWithError("Failed to fetch character:", n);
4183
4196
  const i = n && typeof n == "object" && "message" in n ? String(n.message) : "Failed to fetch character", a = n && typeof n == "object" && "data" in n && typeof n.data == "object" && ((t = n.data) != null && t.message) ? String(n.data.message) : null;
4184
- throw A.logEvent("character_load", "error", {
4197
+ throw S.logEvent("character_load", "error", {
4185
4198
  characterId: e ?? "unknown",
4186
4199
  stage: "fetch",
4187
4200
  reason: a || i
@@ -4210,32 +4223,32 @@ const Re = class Re {
4210
4223
  async load(e, t, n) {
4211
4224
  h.log(`[AvatarManager] Loading avatar with id: ${e}`);
4212
4225
  try {
4213
- if (!A.isInitialized)
4226
+ if (!S.isInitialized)
4214
4227
  throw new Error("AvatarKit not initialized. Please call AvatarKit.initialize() first.");
4215
4228
  this.avatarDownloader || (this.avatarDownloader = new Ci()), h.log("[AvatarManager] Step 1: Fetching character metadata..."), t == null || t({ type: oe.downloading, progress: 10 });
4216
4229
  const i = await this.avatarDownloader.getCharacterById(e);
4217
4230
  h.log("[AvatarManager] Step 2: Downloading resources..."), t == null || t({ type: oe.downloading, progress: 30 });
4218
4231
  const a = await this.avatarDownloader.preloadResources(i, {
4219
4232
  loadMonologue: (n == null ? void 0 : n.enableMonologue) ?? !1,
4220
- progressCallback: (l) => {
4221
- const g = 30 + l.progress / 100 * 50;
4233
+ progressCallback: (s) => {
4234
+ const p = 30 + s.progress / 100 * 50;
4222
4235
  t == null || t({
4223
4236
  type: oe.downloading,
4224
- progress: Math.round(g)
4237
+ progress: Math.round(p)
4225
4238
  });
4226
4239
  }
4227
- }), o = A.getAvatarCore();
4240
+ }), o = S.getAvatarCore();
4228
4241
  if (!o)
4229
4242
  throw new Error("AvatarCore not available. AvatarKit initialization may have failed.");
4230
4243
  this._templateInitialized ? h.log("[AvatarManager] WASM Core template resources already initialized, skipping...") : (h.log("[AvatarManager] Step 3: Initializing WASM Core template resources (first time)..."), t == null || t({ type: oe.downloading, progress: 80 }), await o.loadTemplateResourcesFromBuffers(a.templateResources), this._templateInitialized = !0, h.log("[AvatarManager] WASM Core template resources initialized successfully")), h.log("[AvatarManager] Step 4: Creating Avatar instance...");
4231
- const s = new rn(e, i, a);
4232
- return h.log("[AvatarManager] Avatar loaded successfully"), t == null || t({ type: oe.completed }), A.logEvent("character_load", "info", {
4244
+ const l = new rn(e, i, a);
4245
+ return h.log("[AvatarManager] Avatar loaded successfully"), t == null || t({ type: oe.completed }), S.logEvent("character_load", "info", {
4233
4246
  characterId: e,
4234
4247
  event: "load_success"
4235
- }), s;
4248
+ }), l;
4236
4249
  } catch (i) {
4237
4250
  const a = i instanceof Error ? i.message : String(i);
4238
- throw h.error("Failed to load avatar:", a), A.logEvent("character_load", "error", {
4251
+ throw h.error("Failed to load avatar:", a), S.logEvent("character_load", "error", {
4239
4252
  characterId: e,
4240
4253
  reason: a
4241
4254
  }), t == null || t({ type: oe.failed, error: i }), i;
@@ -4250,53 +4263,53 @@ const Re = class Re {
4250
4263
  };
4251
4264
  d(Re, "_instance", null);
4252
4265
  let Tt = Re, ye = null, Bt = null, Dt = null, Ot = null, Nt = null, Ut = null;
4253
- const Ye = 2048, zt = Ye - 1;
4266
+ const Xe = 2048, zt = Xe - 1;
4254
4267
  function _i(r, e, t) {
4255
4268
  const i = r.length / 13;
4256
- (!ye || ye.length !== i) && (ye = new Float32Array(i), Bt = new Uint32Array(ye.buffer), Dt = new Uint32Array(i), Ot = new Uint32Array(i), Nt = new Uint32Array(i), Ut = new Uint32Array(Ye));
4257
- const a = ye, o = Bt, s = Dt, l = Ot, g = Nt, c = Ut, u = e[0], m = e[1], v = e[2], w = t[0], y = t[1], b = t[2];
4258
- for (let x = 0; x < i; x++) {
4259
- const L = x * 13;
4260
- a[x] = (r[L] - u) * w + (r[L + 1] - m) * y + (r[L + 2] - v) * b, s[x] = x;
4261
- }
4262
- for (let x = 0; x < i; x++) {
4263
- const L = o[x];
4264
- o[x] = L ^ (-(L >> 31) | 2147483648);
4265
- }
4266
- qe(o, s, l, c, 0, i), qe(o, l, s, c, 11, i), qe(o, s, l, c, 22, i);
4267
- for (let x = 0; x < i; x++)
4268
- g[x] = l[i - 1 - x];
4269
- return g;
4269
+ (!ye || ye.length !== i) && (ye = new Float32Array(i), Bt = new Uint32Array(ye.buffer), Dt = new Uint32Array(i), Ot = new Uint32Array(i), Nt = new Uint32Array(i), Ut = new Uint32Array(Xe));
4270
+ const a = ye, o = Bt, l = Dt, s = Ot, p = Nt, c = Ut, u = e[0], m = e[1], v = e[2], w = t[0], y = t[1], b = t[2];
4271
+ for (let I = 0; I < i; I++) {
4272
+ const L = I * 13;
4273
+ a[I] = (r[L] - u) * w + (r[L + 1] - m) * y + (r[L + 2] - v) * b, l[I] = I;
4274
+ }
4275
+ for (let I = 0; I < i; I++) {
4276
+ const L = o[I];
4277
+ o[I] = L ^ (-(L >> 31) | 2147483648);
4278
+ }
4279
+ qe(o, l, s, c, 0, i), qe(o, s, l, c, 11, i), qe(o, l, s, c, 22, i);
4280
+ for (let I = 0; I < i; I++)
4281
+ p[I] = s[i - 1 - I];
4282
+ return p;
4270
4283
  }
4271
4284
  function qe(r, e, t, n, i, a) {
4272
4285
  n.fill(0);
4273
- for (let s = 0; s < a; s++) {
4274
- const l = r[e[s]] >> i & zt;
4275
- n[l]++;
4286
+ for (let l = 0; l < a; l++) {
4287
+ const s = r[e[l]] >> i & zt;
4288
+ n[s]++;
4276
4289
  }
4277
4290
  let o = 0;
4278
- for (let s = 0; s < Ye; s++) {
4279
- const l = n[s];
4280
- n[s] = o, o += l;
4291
+ for (let l = 0; l < Xe; l++) {
4292
+ const s = n[l];
4293
+ n[l] = o, o += s;
4281
4294
  }
4282
- for (let s = 0; s < a; s++) {
4283
- const l = e[s], g = r[l] >> i & zt;
4284
- t[n[g]++] = l;
4295
+ for (let l = 0; l < a; l++) {
4296
+ const s = e[l], p = r[s] >> i & zt;
4297
+ t[n[p]++] = s;
4285
4298
  }
4286
4299
  }
4287
4300
  const Pe = 13;
4288
- let Se = null;
4301
+ let Ae = null;
4289
4302
  function Ei(r, e) {
4290
4303
  const t = e.length, n = t * Pe;
4291
- (!Se || Se.length !== n) && (Se = new Float32Array(n));
4304
+ (!Ae || Ae.length !== n) && (Ae = new Float32Array(n));
4292
4305
  for (let i = 0; i < t; i++) {
4293
- const o = e[i] * Pe, s = i * Pe;
4294
- for (let l = 0; l < Pe; l++)
4295
- Se[s + l] = r[o + l];
4306
+ const o = e[i] * Pe, l = i * Pe;
4307
+ for (let s = 0; s < Pe; s++)
4308
+ Ae[l + s] = r[o + s];
4296
4309
  }
4297
- return Se;
4310
+ return Ae;
4298
4311
  }
4299
- const xi = `#version 300 es
4312
+ const Ii = `#version 300 es
4300
4313
  precision highp float;
4301
4314
 
4302
4315
  in vec2 v_relativePosition;
@@ -4494,7 +4507,7 @@ void main() {
4494
4507
  v_relativePosition = relativeCoord * BOUNDS_RADIUS;
4495
4508
  v_color = a_color;
4496
4509
  }`;
4497
- class Ii {
4510
+ class xi {
4498
4511
  // 跟踪当前 buffer 大小
4499
4512
  constructor(e, t) {
4500
4513
  d(this, "canvas");
@@ -4693,7 +4706,7 @@ class Ii {
4693
4706
  const n = e.createShader(e.FRAGMENT_SHADER);
4694
4707
  if (!n)
4695
4708
  throw e.deleteShader(t), new Error("Failed to create fragment shader");
4696
- if (e.shaderSource(n, xi), e.compileShader(n), !e.getShaderParameter(n, e.COMPILE_STATUS)) {
4709
+ if (e.shaderSource(n, Ii), e.compileShader(n), !e.getShaderParameter(n, e.COMPILE_STATUS)) {
4697
4710
  const a = e.getShaderInfoLog(n);
4698
4711
  throw e.deleteShader(t), e.deleteShader(n), new Error(`Fragment shader compilation failed: ${a}`);
4699
4712
  }
@@ -5297,7 +5310,7 @@ class Fi {
5297
5310
  } catch (i) {
5298
5311
  h.warn("⚠️ WebGPU init failed, fallback to WebGL:", i);
5299
5312
  }
5300
- this.renderer = new Ii(this.canvas, t), await this.renderer.initialize(), this.backend = "webgl", h.log("✅ Using WebGL renderer"), this.updateCameraAspect();
5313
+ this.renderer = new xi(this.canvas, t), await this.renderer.initialize(), this.backend = "webgl", h.log("✅ Using WebGL renderer"), this.updateCameraAspect();
5301
5314
  }
5302
5315
  /**
5303
5316
  * Load packed Splat data (zero-copy, GPU format)
@@ -5345,7 +5358,7 @@ class Fi {
5345
5358
  * Handle window resize
5346
5359
  */
5347
5360
  handleResize() {
5348
- this.updateCameraAspect();
5361
+ this.updateCameraAspect(), this.updateCameraMatrices();
5349
5362
  }
5350
5363
  /**
5351
5364
  * 获取当前使用的后端
@@ -5408,8 +5421,8 @@ class Fi {
5408
5421
  * Update perspective projection matrix (reuse buffer)
5409
5422
  */
5410
5423
  updatePerspectiveMatrix(e, t, n, i) {
5411
- const a = e * Math.PI / 180, o = 1 / Math.tan(a / 2), s = i / (n - i), l = this.projectionMatrix;
5412
- l[0] = o / t, l[1] = 0, l[2] = 0, l[3] = 0, l[4] = 0, l[5] = o, l[6] = 0, l[7] = 0, l[8] = 0, l[9] = 0, l[10] = s, l[11] = -1, l[12] = 0, l[13] = 0, l[14] = s * n, l[15] = 0;
5424
+ const a = e * Math.PI / 180, o = 1 / Math.tan(a / 2), l = i / (n - i), s = this.projectionMatrix;
5425
+ s[0] = o / t, s[1] = 0, s[2] = 0, s[3] = 0, s[4] = 0, s[5] = o, s[6] = 0, s[7] = 0, s[8] = 0, s[9] = 0, s[10] = l, s[11] = -1, s[12] = 0, s[13] = 0, s[14] = l * n, s[15] = 0;
5413
5426
  }
5414
5427
  /**
5415
5428
  * Update view matrix (directly update pre-allocated buffer to avoid per-frame allocation)
@@ -5427,14 +5440,14 @@ class Fi {
5427
5440
  i[1] * n[2] - i[2] * n[1],
5428
5441
  i[2] * n[0] - i[0] * n[2],
5429
5442
  i[0] * n[1] - i[1] * n[0]
5430
- ], s = Math.hypot(o[0], o[1], o[2]) || 1;
5431
- o[0] /= s, o[1] /= s, o[2] /= s;
5432
- const l = [
5443
+ ], l = Math.hypot(o[0], o[1], o[2]) || 1;
5444
+ o[0] /= l, o[1] /= l, o[2] /= l;
5445
+ const s = [
5433
5446
  o[1] * i[2] - o[2] * i[1],
5434
5447
  o[2] * i[0] - o[0] * i[2],
5435
5448
  o[0] * i[1] - o[1] * i[0]
5436
- ], g = this.viewMatrix, c = -e[0], u = -e[1], m = -e[2];
5437
- g[0] = o[0], g[1] = l[0], g[2] = -i[0], g[3] = 0, g[4] = o[1], g[5] = l[1], g[6] = -i[1], g[7] = 0, g[8] = o[2], g[9] = l[2], g[10] = -i[2], g[11] = 0, g[12] = c, g[13] = u, g[14] = m, g[15] = 1;
5449
+ ], p = this.viewMatrix, c = -e[0], u = -e[1], m = -e[2];
5450
+ p[0] = o[0], p[1] = s[0], p[2] = -i[0], p[3] = 0, p[4] = o[1], p[5] = s[1], p[6] = -i[1], p[7] = 0, p[8] = o[2], p[9] = s[2], p[10] = -i[2], p[11] = 0, p[12] = c, p[13] = u, p[14] = m, p[15] = 1;
5438
5451
  }
5439
5452
  }
5440
5453
  function ae(r, e, t) {
@@ -5461,8 +5474,8 @@ function Ri(r, e, t) {
5461
5474
  function Li(r, e, t, n = 25) {
5462
5475
  const i = Math.max(1, Math.floor(t / 1e3 * n)), a = Array.from({ length: i });
5463
5476
  for (let o = 0; o < i; o++) {
5464
- const s = o / (i - 1);
5465
- a[o] = Ri(r, e, s);
5477
+ const l = o / (i - 1);
5478
+ a[o] = Ri(r, e, l);
5466
5479
  }
5467
5480
  return a;
5468
5481
  }
@@ -5499,7 +5512,7 @@ class Ni {
5499
5512
  d(this, "idleCurrentFrameIndex", 0);
5500
5513
  this.avatar = e;
5501
5514
  const n = (t == null ? void 0 : t.playbackMode) ?? ke.network;
5502
- this.playbackMode = n, this.avatarController = new Ai(e, {
5515
+ this.playbackMode = n, this.avatarController = new Si(e, {
5503
5516
  playbackMode: n
5504
5517
  }), this.avatarController.setRenderCallback((i, a) => {
5505
5518
  this.renderRealtimeFrame(i, a);
@@ -5511,10 +5524,10 @@ class Ni {
5511
5524
  * 对齐两端 Flame 维度:标量统一长度,expression 取最大长度并零填充
5512
5525
  */
5513
5526
  alignFlamePair(e, t) {
5514
- const n = (s, l) => {
5515
- const g = Array.isArray(s) ? s.slice(0, l) : [];
5516
- for (; g.length < l; ) g.push(0);
5517
- return g;
5527
+ const n = (l, s) => {
5528
+ const p = Array.isArray(l) ? l.slice(0, s) : [];
5529
+ for (; p.length < s; ) p.push(0);
5530
+ return p;
5518
5531
  }, i = {
5519
5532
  translation: n(e == null ? void 0 : e.translation, 3),
5520
5533
  rotation: n(e == null ? void 0 : e.rotation, 3),
@@ -5566,7 +5579,7 @@ class Ni {
5566
5579
  */
5567
5580
  async getCachedIdleFirstFrame() {
5568
5581
  if (!this.cachedIdleFirstFrame) {
5569
- const e = A.getAvatarCore();
5582
+ const e = S.getAvatarCore();
5570
5583
  if (e)
5571
5584
  try {
5572
5585
  const t = await e.getCurrentFrameParams(0);
@@ -5590,10 +5603,10 @@ class Ni {
5590
5603
  const t = document.createElement("canvas");
5591
5604
  let n = 800, i = 600;
5592
5605
  e && e instanceof HTMLElement && (n = e.offsetWidth || 800, i = e.offsetHeight || 600);
5593
- const a = Math.min(n, i), o = window.devicePixelRatio || 1;
5594
- return t.width = Math.floor(a * o), t.height = Math.floor(a * o), t.style.width = `${a}px`, t.style.height = `${a}px`, t.style.display = "block", t.style.margin = "0 auto", t.style.position = "", t.style.top = "", t.style.left = "", t.style.zIndex = "", t.style.background = "none", t.style.border = "none", e && e instanceof HTMLElement ? (e.appendChild(t), e.style.display = "flex", e.style.justifyContent = "center", e.style.alignItems = "center", e.style.position = "relative", this.resizeObserver = new ResizeObserver(() => {
5595
- const s = window.devicePixelRatio || 1, l = Math.floor(e.offsetWidth || 0), g = Math.floor(e.offsetHeight || 0), c = Math.min(l, g);
5596
- t.width = Math.floor(c * s), t.height = Math.floor(c * s), t.style.width = `${c}px`, t.style.height = `${c}px`, this.handleResize();
5606
+ const a = window.devicePixelRatio || 1;
5607
+ return t.width = Math.floor(n * a), t.height = Math.floor(i * a), t.style.width = `${n}px`, t.style.height = `${i}px`, t.style.display = "block", t.style.margin = "0 auto", t.style.position = "", t.style.top = "", t.style.left = "", t.style.zIndex = "", t.style.background = "none", t.style.border = "none", e && e instanceof HTMLElement ? (e.appendChild(t), e.style.display = "flex", e.style.justifyContent = "center", e.style.alignItems = "center", e.style.position = "relative", this.resizeObserver = new ResizeObserver(() => {
5608
+ const o = window.devicePixelRatio || 1, l = Math.floor(e.offsetWidth || 0), s = Math.floor(e.offsetHeight || 0);
5609
+ t.width = Math.floor(l * o), t.height = Math.floor(s * o), t.style.width = `${l}px`, t.style.height = `${s}px`, this.handleResize();
5597
5610
  }), this.resizeObserver.observe(e)) : document.body.appendChild(t), window.addEventListener("resize", this.onWindowResize), t;
5598
5611
  }
5599
5612
  /**
@@ -5609,7 +5622,7 @@ class Ni {
5609
5622
  async initializeView(e) {
5610
5623
  try {
5611
5624
  M.debug && h.log("[AvatarView] Initializing avatar view...");
5612
- const t = A.getAvatarCore();
5625
+ const t = S.getAvatarCore();
5613
5626
  if (!t)
5614
5627
  throw new Error("AvatarCore not available. AvatarKit initialization may have failed.");
5615
5628
  const n = e.getResources();
@@ -5644,8 +5657,8 @@ class Ni {
5644
5657
  * 根据资源解析最终的相机配置,优先使用角色设置,其次 camera.json
5645
5658
  */
5646
5659
  resolveCameraConfig(e) {
5647
- var s, l;
5648
- const t = this.getDefaultCameraConfig(), n = ((s = e.characterSettings) == null ? void 0 : s.camera) ?? null, i = ((l = e.preloadCameraSettings) == null ? void 0 : l.camera) ?? null, a = n ?? i;
5660
+ var l, s;
5661
+ const t = this.getDefaultCameraConfig(), n = ((l = e.characterSettings) == null ? void 0 : l.camera) ?? null, i = ((s = e.preloadCameraSettings) == null ? void 0 : s.camera) ?? null, a = n ?? i;
5649
5662
  if (!a)
5650
5663
  return h.warn("[AvatarView] Camera settings not found in resources, falling back to default camera config"), t;
5651
5664
  const o = n ? "characterSettings" : "camera.json";
@@ -5655,34 +5668,34 @@ class Ni {
5655
5668
  * 从角色设置中推导相机配置
5656
5669
  */
5657
5670
  deriveCameraConfigFromSettings(e, t, n) {
5658
- const i = (j, X) => Number.isFinite(j) ? j : X, a = i(e.translationX, t.position[0]), o = i(e.translationY, t.position[1]), s = i(e.translationZ, t.position[2]), l = i(e.rotation, 0), g = i(e.fovYRadians, 0), c = Math.hypot(a, o, s) > 1e-4, u = g > 0, m = Math.abs(l) > 1e-4;
5671
+ const i = (j, Y) => Number.isFinite(j) ? j : Y, a = i(e.translationX, t.position[0]), o = i(e.translationY, t.position[1]), l = i(e.translationZ, t.position[2]), s = i(e.rotation, 0), p = i(e.fovYRadians, 0), c = Math.hypot(a, o, l) > 1e-4, u = p > 0, m = Math.abs(s) > 1e-4;
5659
5672
  if (!c && !u && !m)
5660
5673
  return h.warn(`[AvatarView] Camera settings from ${n} appear empty, falling back to default config`), t;
5661
- const v = Math.sin(l), w = Math.cos(l), y = c ? [a, o, s] : [...t.position], b = [
5674
+ const v = Math.sin(s), w = Math.cos(s), y = c ? [a, o, l] : [...t.position], b = [
5662
5675
  -v,
5663
5676
  0,
5664
5677
  -w
5665
- ], x = Math.hypot(b[0], b[1], b[2]) || 1, L = [
5666
- b[0] / x,
5667
- b[1] / x,
5668
- b[2] / x
5678
+ ], I = Math.hypot(b[0], b[1], b[2]) || 1, L = [
5679
+ b[0] / I,
5680
+ b[1] / I,
5681
+ b[2] / I
5669
5682
  ], _ = [
5670
5683
  y[0] + L[0],
5671
5684
  y[1] + L[1],
5672
5685
  y[2] + L[2]
5673
- ], Y = [0, 1, 0], G = u ? g * 180 / Math.PI : t.fov, U = {
5686
+ ], X = [0, 1, 0], G = u ? p * 180 / Math.PI : t.fov, U = {
5674
5687
  ...t,
5675
5688
  // 自动继承 near/far 等配置(来自 APP_CONFIG.camera)
5676
5689
  position: y,
5677
5690
  target: _,
5678
- up: Y,
5691
+ up: X,
5679
5692
  fov: G
5680
5693
  // near/far 从 fallback 继承,无需硬编码
5681
5694
  };
5682
5695
  return h.log("[AvatarView] Applied camera settings from resources", {
5683
5696
  source: n,
5684
- translation: [a, o, s],
5685
- yawRadians: l,
5697
+ translation: [a, o, l],
5698
+ yawRadians: s,
5686
5699
  position: y,
5687
5700
  target: _,
5688
5701
  fov: G,
@@ -5696,7 +5709,7 @@ class Ni {
5696
5709
  async renderFirstFrame() {
5697
5710
  if (!this.renderSystem)
5698
5711
  throw new Error("Render system not initialized");
5699
- const e = A.getAvatarCore();
5712
+ const e = S.getAvatarCore();
5700
5713
  if (!e)
5701
5714
  throw new Error("AvatarCore not available");
5702
5715
  const t = {
@@ -5738,14 +5751,14 @@ class Ni {
5738
5751
  return;
5739
5752
  }
5740
5753
  e = a;
5741
- const o = A.getAvatarCore();
5754
+ const o = S.getAvatarCore();
5742
5755
  if (!o)
5743
5756
  return;
5744
- const s = await o.computeCompleteFrameFlat({ frameIndex: this.idleCurrentFrameIndex });
5745
- if (this.idleCurrentFrameIndex++, s) {
5757
+ const l = await o.computeCompleteFrameFlat({ frameIndex: this.idleCurrentFrameIndex });
5758
+ if (this.idleCurrentFrameIndex++, l) {
5746
5759
  if (this.renderingState !== "idle")
5747
5760
  return;
5748
- this.renderSystem.loadSplatsFromPackedData(s), this.renderSystem.renderFrame();
5761
+ this.renderSystem.loadSplatsFromPackedData(l), this.renderSystem.renderFrame();
5749
5762
  }
5750
5763
  this.idleAnimationLoopId = requestAnimationFrame(i);
5751
5764
  } catch (o) {
@@ -5777,12 +5790,12 @@ class Ni {
5777
5790
  this.realtimeAnimationLoopId = requestAnimationFrame(i);
5778
5791
  return;
5779
5792
  }
5780
- const s = performance.now() - this.transitionStartTime, l = Math.min(1, Math.max(0, s / this.transitionDurationMs)), g = this.transitionKeyframes.length, c = Math.min(g - 1, Math.floor(l * (g - 1))), u = this.transitionKeyframes[c], m = Vt(u), v = A.getAvatarCore();
5793
+ const l = performance.now() - this.transitionStartTime, s = Math.min(1, Math.max(0, l / this.transitionDurationMs)), p = this.transitionKeyframes.length, c = Math.min(p - 1, Math.floor(s * (p - 1))), u = this.transitionKeyframes[c], m = Vt(u), v = S.getAvatarCore();
5781
5794
  if (v) {
5782
5795
  const w = await v.computeFrameFlatFromParams(m);
5783
5796
  w && (this.renderSystem.loadSplatsFromPackedData(w), this.renderSystem.renderFrame());
5784
5797
  }
5785
- if (l >= 1) {
5798
+ if (s >= 1) {
5786
5799
  if (o === "transitioningToSpeaking")
5787
5800
  this.setState(
5788
5801
  "speaking"
@@ -5908,7 +5921,7 @@ class Ni {
5908
5921
  /* TransitioningToSpeaking */
5909
5922
  );
5910
5923
  try {
5911
- const n = A.getAvatarCore();
5924
+ const n = S.getAvatarCore();
5912
5925
  if (n && e.length > 0) {
5913
5926
  if (this.renderingState !== "transitioningToSpeaking")
5914
5927
  return;
@@ -5932,7 +5945,7 @@ class Ni {
5932
5945
  * 开始实时渲染循环
5933
5946
  */
5934
5947
  startRealtimeRendering() {
5935
- M.debug && h.log("[AvatarView] Starting realtime rendering with", this.currentKeyframes.length, "keyframes"), A.logEvent("character_view", "info", {
5948
+ M.debug && h.log("[AvatarView] Starting realtime rendering with", this.currentKeyframes.length, "keyframes"), S.logEvent("character_view", "info", {
5936
5949
  characterId: this.avatar.id,
5937
5950
  event: "rendering_started",
5938
5951
  keyframesCount: this.currentKeyframes.length
@@ -5958,7 +5971,7 @@ class Ni {
5958
5971
  try {
5959
5972
  if (this.renderingState !== "transitioningToIdle")
5960
5973
  return;
5961
- if (A.getAvatarCore() && this.currentKeyframes.length > 0) {
5974
+ if (S.getAvatarCore() && this.currentKeyframes.length > 0) {
5962
5975
  const n = this.lastRealtimeProtoFrame || this.currentKeyframes[Math.max(0, this.lastRenderedFrameIndex)], i = await this.getCachedIdleFirstFrame();
5963
5976
  if (i && (this.transitionKeyframes = this.generateAndAlignTransitionFrames(n, i), this.transitionStartTime = performance.now(), this.transitionKeyframes.length > 0 && this.renderingState === "transitioningToIdle")) {
5964
5977
  M.debug && h.log("[AvatarView] Return transition started:", this.transitionKeyframes.length, "frames"), this.realtimeAnimationLoopId || this.startRealtimeAnimationLoop();
@@ -5980,14 +5993,14 @@ class Ni {
5980
5993
  * 关闭 avatarController 并清理所有相关资源
5981
5994
  */
5982
5995
  dispose() {
5983
- M.debug && h.log("[AvatarView] Disposing avatar view..."), A.logEvent("character_view", "info", {
5996
+ M.debug && h.log("[AvatarView] Disposing avatar view..."), S.logEvent("character_view", "info", {
5984
5997
  characterId: this.avatar.id,
5985
5998
  event: "disposed"
5986
5999
  }), this.avatarController && (this.avatarController.clear(), this.avatarController.dispose()), this.stopAllAnimationLoops(), this.setState(
5987
6000
  "idle"
5988
6001
  /* Idle */
5989
6002
  ), this.cachedIdleFirstFrame = null, this.idleCurrentFrameIndex = 0;
5990
- const e = A.getAvatarCore();
6003
+ const e = S.getAvatarCore();
5991
6004
  if (e)
5992
6005
  try {
5993
6006
  e.releaseCurrentCharacter(), M.debug && h.log("[AvatarView] AvatarCore character resources released");
@@ -6032,14 +6045,14 @@ class Ni {
6032
6045
  }
6033
6046
  export {
6034
6047
  M as A,
6035
- Ae as C,
6048
+ Se as C,
6036
6049
  le as E,
6037
6050
  oe as L,
6038
6051
  nn as R,
6039
6052
  se as S,
6040
- A as a,
6053
+ S as a,
6041
6054
  rn as b,
6042
- Ai as c,
6055
+ Si as c,
6043
6056
  Tt as d,
6044
6057
  nr as e,
6045
6058
  Ni as f,
@@ -6050,4 +6063,4 @@ export {
6050
6063
  Oi as k,
6051
6064
  h as l
6052
6065
  };
6053
- //# sourceMappingURL=index-CXkdiMjt.js.map
6066
+ //# sourceMappingURL=index-Bh6KkhoR.js.map