@spatialwalk/avatarkit 1.0.0-beta.17 → 1.0.0-beta.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -1
- package/README.md +135 -107
- package/dist/{StreamingAudioPlayer-a8MwHQ3Q.js → StreamingAudioPlayer-Cw8IygPS.js} +2 -2
- package/dist/{StreamingAudioPlayer-a8MwHQ3Q.js.map → StreamingAudioPlayer-Cw8IygPS.js.map} +1 -1
- package/dist/animation/AnimationWebSocketClient.d.ts +5 -4
- package/dist/animation/AnimationWebSocketClient.d.ts.map +1 -1
- package/dist/core/AvatarController.d.ts +18 -18
- package/dist/core/AvatarController.d.ts.map +1 -1
- package/dist/core/AvatarDownloader.d.ts +0 -4
- package/dist/core/AvatarDownloader.d.ts.map +1 -1
- package/dist/core/AvatarManager.d.ts +1 -3
- package/dist/core/AvatarManager.d.ts.map +1 -1
- package/dist/core/AvatarView.d.ts.map +1 -1
- package/dist/{index-suaZGA5u.js → index-CRv3XrVE.js} +821 -837
- package/dist/index-CRv3XrVE.js.map +1 -0
- package/dist/index.js +11 -13
- package/dist/types/character.d.ts +0 -11
- package/dist/types/character.d.ts.map +1 -1
- package/dist/utils/{reqId.d.ts → conversationId.d.ts} +6 -6
- package/dist/utils/conversationId.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/index-suaZGA5u.js.map +0 -1
- package/dist/utils/reqId.d.ts.map +0 -1
|
@@ -29,38 +29,23 @@ class sn {
|
|
|
29
29
|
return this.resources;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
var on = /* @__PURE__ */ ((r) => (r.CAMERA = "camera", r.ANIMATION_IDLE = "frameIdle", r.
|
|
32
|
+
var on = /* @__PURE__ */ ((r) => (r.CAMERA = "camera", r.ANIMATION_IDLE = "frameIdle", r.MODEL_SHAPE = "shape", r.MODEL_GS = "gsStandard", r))(on || {});
|
|
33
33
|
function Na(r) {
|
|
34
|
-
var e, t, n, a, i, s, o, l, p, c, u
|
|
34
|
+
var e, t, n, a, i, s, o, l, p, c, u;
|
|
35
35
|
return {
|
|
36
36
|
camera: ((t = (e = r.camera) == null ? void 0 : e.resource) == null ? void 0 : t.remote) || null,
|
|
37
37
|
frameIdle: ((i = (a = (n = r.animations) == null ? void 0 : n.frameIdle) == null ? void 0 : a.resource) == null ? void 0 : i.remote) || null,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
shape: ((w = (y = (m = r.models) == null ? void 0 : m.shape) == null ? void 0 : y.resource) == null ? void 0 : w.remote) || null,
|
|
41
|
-
gsStandard: ((E = (S = (A = r.models) == null ? void 0 : A.gsStandard) == null ? void 0 : S.resource) == null ? void 0 : E.remote) || null
|
|
38
|
+
shape: ((l = (o = (s = r.models) == null ? void 0 : s.shape) == null ? void 0 : o.resource) == null ? void 0 : l.remote) || null,
|
|
39
|
+
gsStandard: ((u = (c = (p = r.models) == null ? void 0 : p.gsStandard) == null ? void 0 : c.resource) == null ? void 0 : u.remote) || null
|
|
42
40
|
};
|
|
43
41
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return !!((n = (t = (e = r.animations) == null ? void 0 : e.frameMono) == null ? void 0 : t.resource) != null && n.remote && ((s = (i = (a = r.animations) == null ? void 0 : a.audioMono) == null ? void 0 : i.resource) != null && s.remote));
|
|
47
|
-
}
|
|
48
|
-
function za(r) {
|
|
49
|
-
var e, t, n, a, i, s;
|
|
50
|
-
try {
|
|
51
|
-
const o = JSON.parse(r);
|
|
52
|
-
return !!((n = (t = (e = o == null ? void 0 : o.animations) == null ? void 0 : e.frameMono) == null ? void 0 : t.resource) != null && n.remote && ((s = (i = (a = o == null ? void 0 : o.animations) == null ? void 0 : a.audioMono) == null ? void 0 : i.resource) != null && s.remote));
|
|
53
|
-
} catch {
|
|
54
|
-
return !1;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
var ce = /* @__PURE__ */ ((r) => (r.cn = "cn", r.us = "us", r.test = "test", r))(ce || {}), We = /* @__PURE__ */ ((r) => (r.sdk = "sdk", r.host = "host", r))(We || {}), fe = /* @__PURE__ */ ((r) => (r.downloading = "downloading", r.completed = "completed", r.failed = "failed", r))(fe || {}), _e = /* @__PURE__ */ ((r) => (r.disconnected = "disconnected", r.connecting = "connecting", r.connected = "connected", r.failed = "failed", r))(_e || {}), F = /* @__PURE__ */ ((r) => (r.idle = "idle", r.active = "active", r.playing = "playing", r.paused = "paused", r))(F || {});
|
|
58
|
-
class ee extends Error {
|
|
42
|
+
var ie = /* @__PURE__ */ ((r) => (r.cn = "cn", r.us = "us", r.test = "test", r))(ie || {}), ze = /* @__PURE__ */ ((r) => (r.sdk = "sdk", r.host = "host", r))(ze || {}), le = /* @__PURE__ */ ((r) => (r.downloading = "downloading", r.completed = "completed", r.failed = "failed", r))(le || {}), ye = /* @__PURE__ */ ((r) => (r.disconnected = "disconnected", r.connecting = "connecting", r.connected = "connected", r.failed = "failed", r))(ye || {}), M = /* @__PURE__ */ ((r) => (r.idle = "idle", r.active = "active", r.playing = "playing", r.paused = "paused", r))(M || {});
|
|
43
|
+
class Q extends Error {
|
|
59
44
|
constructor(e, t) {
|
|
60
45
|
super(e), this.code = t, this.name = "SPAvatarError";
|
|
61
46
|
}
|
|
62
47
|
}
|
|
63
|
-
var
|
|
48
|
+
var me = /* @__PURE__ */ ((r) => (r.network = "network", r.external = "external", r))(me || {});
|
|
64
49
|
function ln() {
|
|
65
50
|
return typeof window > "u" ? !1 : new URLSearchParams(window.location.search).get("debug") === "1";
|
|
66
51
|
}
|
|
@@ -99,7 +84,7 @@ const I = {
|
|
|
99
84
|
}
|
|
100
85
|
}
|
|
101
86
|
};
|
|
102
|
-
function
|
|
87
|
+
function Vt(r) {
|
|
103
88
|
var e;
|
|
104
89
|
return {
|
|
105
90
|
translation: r.translation || [0, 0, 0],
|
|
@@ -114,7 +99,7 @@ function $t(r) {
|
|
|
114
99
|
has_eyelid: (((e = r.eyeLid) == null ? void 0 : e.length) || 0) > 0
|
|
115
100
|
};
|
|
116
101
|
}
|
|
117
|
-
function
|
|
102
|
+
function ht(r) {
|
|
118
103
|
return {
|
|
119
104
|
translation: r.translation || [0, 0, 0],
|
|
120
105
|
rotation: r.rotation || [0, 0, 0],
|
|
@@ -125,16 +110,16 @@ function ft(r) {
|
|
|
125
110
|
expression: r.expr_params || []
|
|
126
111
|
};
|
|
127
112
|
}
|
|
128
|
-
var
|
|
113
|
+
var $t = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
129
114
|
function dn(r) {
|
|
130
115
|
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
131
116
|
}
|
|
132
|
-
var Gt = { exports: {} },
|
|
117
|
+
var Gt = { exports: {} }, Re = { exports: {} }, ft;
|
|
133
118
|
function un() {
|
|
134
|
-
return
|
|
119
|
+
return ft || (ft = 1, function(r, e) {
|
|
135
120
|
(function(t, n) {
|
|
136
121
|
r.exports = n();
|
|
137
|
-
})(
|
|
122
|
+
})($t, function() {
|
|
138
123
|
function t(A) {
|
|
139
124
|
return !isNaN(parseFloat(A)) && isFinite(A);
|
|
140
125
|
}
|
|
@@ -149,8 +134,8 @@ function un() {
|
|
|
149
134
|
var i = ["isConstructor", "isEval", "isNative", "isToplevel"], s = ["columnNumber", "lineNumber"], o = ["fileName", "functionName", "source"], l = ["args"], p = ["evalOrigin"], c = i.concat(s, o, l, p);
|
|
150
135
|
function u(A) {
|
|
151
136
|
if (A)
|
|
152
|
-
for (var
|
|
153
|
-
A[c[
|
|
137
|
+
for (var b = 0; b < c.length; b++)
|
|
138
|
+
A[c[b]] !== void 0 && this["set" + n(c[b])](A[c[b]]);
|
|
154
139
|
}
|
|
155
140
|
u.prototype = {
|
|
156
141
|
getArgs: function() {
|
|
@@ -173,49 +158,49 @@ function un() {
|
|
|
173
158
|
throw new TypeError("Eval Origin must be an Object or StackFrame");
|
|
174
159
|
},
|
|
175
160
|
toString: function() {
|
|
176
|
-
var A = this.getFileName() || "",
|
|
177
|
-
return this.getIsEval() ? A ? "[eval] (" + A + ":" +
|
|
161
|
+
var A = this.getFileName() || "", b = this.getLineNumber() || "", E = this.getColumnNumber() || "", B = this.getFunctionName() || "";
|
|
162
|
+
return this.getIsEval() ? A ? "[eval] (" + A + ":" + b + ":" + E + ")" : "[eval]:" + b + ":" + E : B ? B + " (" + A + ":" + b + ":" + E + ")" : A + ":" + b + ":" + E;
|
|
178
163
|
}
|
|
179
|
-
}, u.fromString = function(
|
|
180
|
-
var E =
|
|
164
|
+
}, u.fromString = function(b) {
|
|
165
|
+
var E = b.indexOf("("), B = b.lastIndexOf(")"), _ = b.substring(0, E), X = b.substring(E + 1, B).split(","), G = b.substring(B + 1);
|
|
181
166
|
if (G.indexOf("@") === 0)
|
|
182
|
-
var
|
|
167
|
+
var R = /@(.+?)(?::(\d+))?(?::(\d+))?$/.exec(G, ""), z = R[1], W = R[2], Y = R[3];
|
|
183
168
|
return new u({
|
|
184
169
|
functionName: _,
|
|
185
|
-
args:
|
|
186
|
-
fileName:
|
|
187
|
-
lineNumber:
|
|
188
|
-
columnNumber:
|
|
170
|
+
args: X || void 0,
|
|
171
|
+
fileName: z,
|
|
172
|
+
lineNumber: W || void 0,
|
|
173
|
+
columnNumber: Y || void 0
|
|
189
174
|
});
|
|
190
175
|
};
|
|
191
176
|
for (var m = 0; m < i.length; m++)
|
|
192
177
|
u.prototype["get" + n(i[m])] = a(i[m]), u.prototype["set" + n(i[m])] = /* @__PURE__ */ function(A) {
|
|
193
|
-
return function(
|
|
194
|
-
this[A] = !!
|
|
178
|
+
return function(b) {
|
|
179
|
+
this[A] = !!b;
|
|
195
180
|
};
|
|
196
181
|
}(i[m]);
|
|
197
|
-
for (var
|
|
198
|
-
u.prototype["get" + n(s[
|
|
199
|
-
return function(
|
|
200
|
-
if (!t(
|
|
182
|
+
for (var v = 0; v < s.length; v++)
|
|
183
|
+
u.prototype["get" + n(s[v])] = a(s[v]), u.prototype["set" + n(s[v])] = /* @__PURE__ */ function(A) {
|
|
184
|
+
return function(b) {
|
|
185
|
+
if (!t(b))
|
|
201
186
|
throw new TypeError(A + " must be a Number");
|
|
202
|
-
this[A] = Number(
|
|
187
|
+
this[A] = Number(b);
|
|
203
188
|
};
|
|
204
|
-
}(s[
|
|
205
|
-
for (var
|
|
206
|
-
u.prototype["get" + n(o[
|
|
207
|
-
return function(
|
|
208
|
-
this[A] = String(
|
|
189
|
+
}(s[v]);
|
|
190
|
+
for (var S = 0; S < o.length; S++)
|
|
191
|
+
u.prototype["get" + n(o[S])] = a(o[S]), u.prototype["set" + n(o[S])] = /* @__PURE__ */ function(A) {
|
|
192
|
+
return function(b) {
|
|
193
|
+
this[A] = String(b);
|
|
209
194
|
};
|
|
210
|
-
}(o[
|
|
195
|
+
}(o[S]);
|
|
211
196
|
return u;
|
|
212
197
|
});
|
|
213
|
-
}(
|
|
198
|
+
}(Re)), Re.exports;
|
|
214
199
|
}
|
|
215
200
|
(function(r, e) {
|
|
216
201
|
(function(t, n) {
|
|
217
202
|
r.exports = n(un());
|
|
218
|
-
})(
|
|
203
|
+
})($t, function(n) {
|
|
219
204
|
var a = /(^|@)\S+:\d+/, i = /^\s*at .*(\S+:\d+|\(native\))/m, s = /^(eval@)?(\[native code])?$/;
|
|
220
205
|
return {
|
|
221
206
|
/**
|
|
@@ -249,12 +234,12 @@ function un() {
|
|
|
249
234
|
c.indexOf("(eval ") > -1 && (c = c.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, ""));
|
|
250
235
|
var u = c.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, ""), m = u.match(/ (\(.+\)$)/);
|
|
251
236
|
u = m ? u.replace(m[0], "") : u;
|
|
252
|
-
var
|
|
237
|
+
var v = this.extractLocation(m ? m[1] : u), S = m && u || void 0, A = ["eval", "<anonymous>"].indexOf(v[0]) > -1 ? void 0 : v[0];
|
|
253
238
|
return new n({
|
|
254
|
-
functionName:
|
|
239
|
+
functionName: S,
|
|
255
240
|
fileName: A,
|
|
256
|
-
lineNumber:
|
|
257
|
-
columnNumber:
|
|
241
|
+
lineNumber: v[1],
|
|
242
|
+
columnNumber: v[2],
|
|
258
243
|
source: c
|
|
259
244
|
});
|
|
260
245
|
}, this);
|
|
@@ -269,12 +254,12 @@ function un() {
|
|
|
269
254
|
return new n({
|
|
270
255
|
functionName: c
|
|
271
256
|
});
|
|
272
|
-
var u = /((.*".+"[^@]*)?[^@]*)(?:@)/, m = c.match(u),
|
|
257
|
+
var u = /((.*".+"[^@]*)?[^@]*)(?:@)/, m = c.match(u), v = m && m[1] ? m[1] : void 0, S = this.extractLocation(c.replace(u, ""));
|
|
273
258
|
return new n({
|
|
274
|
-
functionName:
|
|
275
|
-
fileName:
|
|
276
|
-
lineNumber:
|
|
277
|
-
columnNumber:
|
|
259
|
+
functionName: v,
|
|
260
|
+
fileName: S[0],
|
|
261
|
+
lineNumber: S[1],
|
|
262
|
+
columnNumber: S[2],
|
|
278
263
|
source: c
|
|
279
264
|
});
|
|
280
265
|
}, this);
|
|
@@ -287,11 +272,11 @@ function un() {
|
|
|
287
272
|
},
|
|
288
273
|
parseOpera9: function(l) {
|
|
289
274
|
for (var p = /Line (\d+).*script (?:in )?(\S+)/i, c = l.message.split(`
|
|
290
|
-
`), u = [], m = 2,
|
|
291
|
-
var
|
|
292
|
-
|
|
293
|
-
fileName:
|
|
294
|
-
lineNumber:
|
|
275
|
+
`), u = [], m = 2, v = c.length; m < v; m += 2) {
|
|
276
|
+
var S = p.exec(c[m]);
|
|
277
|
+
S && u.push(new n({
|
|
278
|
+
fileName: S[2],
|
|
279
|
+
lineNumber: S[1],
|
|
295
280
|
source: c[m]
|
|
296
281
|
}));
|
|
297
282
|
}
|
|
@@ -299,13 +284,13 @@ function un() {
|
|
|
299
284
|
},
|
|
300
285
|
parseOpera10: function(l) {
|
|
301
286
|
for (var p = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i, c = l.stacktrace.split(`
|
|
302
|
-
`), u = [], m = 0,
|
|
303
|
-
var
|
|
304
|
-
|
|
287
|
+
`), u = [], m = 0, v = c.length; m < v; m += 2) {
|
|
288
|
+
var S = p.exec(c[m]);
|
|
289
|
+
S && u.push(
|
|
305
290
|
new n({
|
|
306
|
-
functionName:
|
|
307
|
-
fileName:
|
|
308
|
-
lineNumber:
|
|
291
|
+
functionName: S[3] || void 0,
|
|
292
|
+
fileName: S[2],
|
|
293
|
+
lineNumber: S[1],
|
|
309
294
|
source: c[m]
|
|
310
295
|
})
|
|
311
296
|
);
|
|
@@ -319,12 +304,12 @@ function un() {
|
|
|
319
304
|
return !!c.match(a) && !c.match(/^Error created at/);
|
|
320
305
|
}, this);
|
|
321
306
|
return p.map(function(c) {
|
|
322
|
-
var u = c.split("@"), m = this.extractLocation(u.pop()),
|
|
323
|
-
|
|
324
|
-
var
|
|
307
|
+
var u = c.split("@"), m = this.extractLocation(u.pop()), v = u.shift() || "", S = v.replace(/<anonymous function(: (\w+))?>/, "$2").replace(/\([^)]*\)/g, "") || void 0, A;
|
|
308
|
+
v.match(/\(([^)]*)\)/) && (A = v.replace(/^[^(]+\(([^)]*)\)$/, "$1"));
|
|
309
|
+
var b = A === void 0 || A === "[arguments not available]" ? void 0 : A.split(",");
|
|
325
310
|
return new n({
|
|
326
|
-
functionName:
|
|
327
|
-
args:
|
|
311
|
+
functionName: S,
|
|
312
|
+
args: b,
|
|
328
313
|
fileName: m[0],
|
|
329
314
|
lineNumber: m[1],
|
|
330
315
|
columnNumber: m[2],
|
|
@@ -337,172 +322,172 @@ function un() {
|
|
|
337
322
|
})(Gt);
|
|
338
323
|
var hn = Gt.exports;
|
|
339
324
|
const fn = /* @__PURE__ */ dn(hn);
|
|
340
|
-
let
|
|
325
|
+
let mt = () => {
|
|
341
326
|
var r = (() => {
|
|
342
327
|
var e = Object.defineProperty, t = Object.getOwnPropertyDescriptor, n = Object.getOwnPropertyNames, a = Object.prototype.hasOwnProperty, i = (f, g) => {
|
|
343
|
-
for (var
|
|
344
|
-
}, s = (f, g,
|
|
345
|
-
if (g && typeof g == "object" || typeof g == "function") for (let P of n(g)) !a.call(f, P) && P !==
|
|
328
|
+
for (var w in g) e(f, w, { get: g[w], enumerable: !0 });
|
|
329
|
+
}, s = (f, g, w, C) => {
|
|
330
|
+
if (g && typeof g == "object" || typeof g == "function") for (let P of n(g)) !a.call(f, P) && P !== w && e(f, P, { get: () => g[P], enumerable: !(C = t(g, P)) || C.enumerable });
|
|
346
331
|
return f;
|
|
347
332
|
}, o = (f) => s(e({}, "__esModule", { value: !0 }), f), l = {};
|
|
348
333
|
i(l, { default: () => tn });
|
|
349
|
-
var p = (f) => Array.isArray(f), c = (f) => typeof f == "function", u = (f) => f.length === 0, m = (f) => typeof f == "number",
|
|
334
|
+
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, S = (f) => f instanceof RegExp, A = (f) => typeof f == "string", b = (f) => f === void 0, E = (f) => {
|
|
350
335
|
const g = /* @__PURE__ */ new Map();
|
|
351
|
-
return (
|
|
352
|
-
const C = g.get(
|
|
336
|
+
return (w) => {
|
|
337
|
+
const C = g.get(w);
|
|
353
338
|
if (C) return C;
|
|
354
|
-
const P = f(
|
|
355
|
-
return g.set(
|
|
339
|
+
const P = f(w);
|
|
340
|
+
return g.set(w, P), P;
|
|
356
341
|
};
|
|
357
|
-
},
|
|
358
|
-
const C = { cache: {}, input: f, index: 0, indexMax: 0, options:
|
|
359
|
-
if (
|
|
342
|
+
}, B = (f, g, w = {}) => {
|
|
343
|
+
const C = { cache: {}, input: f, index: 0, indexMax: 0, options: w, output: [] };
|
|
344
|
+
if (Z(g)(C) && C.index === f.length) return C.output;
|
|
360
345
|
throw new Error(`Failed to parse at index ${C.indexMax}`);
|
|
361
|
-
}, _ = (f, g) => p(f) ?
|
|
362
|
-
const
|
|
346
|
+
}, _ = (f, g) => p(f) ? X(f, g) : A(f) ? R(f, g) : G(f, g), X = (f, g) => {
|
|
347
|
+
const w = {};
|
|
363
348
|
for (const C of f) {
|
|
364
349
|
if (C.length !== 1) throw new Error(`Invalid character: "${C}"`);
|
|
365
350
|
const P = C.charCodeAt(0);
|
|
366
|
-
|
|
351
|
+
w[P] = !0;
|
|
367
352
|
}
|
|
368
353
|
return (C) => {
|
|
369
354
|
const P = C.index, k = C.input;
|
|
370
|
-
for (; C.index < k.length && k.charCodeAt(C.index) in
|
|
371
|
-
const
|
|
372
|
-
if (
|
|
373
|
-
if (!
|
|
374
|
-
const
|
|
375
|
-
|
|
355
|
+
for (; C.index < k.length && k.charCodeAt(C.index) in w; ) C.index += 1;
|
|
356
|
+
const T = C.index;
|
|
357
|
+
if (T > P) {
|
|
358
|
+
if (!b(g) && !C.options.silent) {
|
|
359
|
+
const $ = C.input.slice(P, T), q = c(g) ? g($, k, String(P)) : g;
|
|
360
|
+
b(q) || C.output.push(q);
|
|
376
361
|
}
|
|
377
362
|
C.indexMax = Math.max(C.indexMax, C.index);
|
|
378
363
|
}
|
|
379
364
|
return !0;
|
|
380
365
|
};
|
|
381
366
|
}, G = (f, g) => {
|
|
382
|
-
const
|
|
383
|
-
return
|
|
367
|
+
const w = f.source, C = f.flags.replace(/y|$/, "y"), P = new RegExp(w, C);
|
|
368
|
+
return be((k) => {
|
|
384
369
|
P.lastIndex = k.index;
|
|
385
|
-
const
|
|
386
|
-
if (
|
|
387
|
-
if (!
|
|
388
|
-
const
|
|
389
|
-
|
|
370
|
+
const T = P.exec(k.input);
|
|
371
|
+
if (T) {
|
|
372
|
+
if (!b(g) && !k.options.silent) {
|
|
373
|
+
const $ = c(g) ? g(...T, k.input, String(k.index)) : g;
|
|
374
|
+
b($) || k.output.push($);
|
|
390
375
|
}
|
|
391
|
-
return k.index +=
|
|
376
|
+
return k.index += T[0].length, k.indexMax = Math.max(k.indexMax, k.index), !0;
|
|
392
377
|
} else return !1;
|
|
393
378
|
});
|
|
394
|
-
},
|
|
395
|
-
if (
|
|
396
|
-
if (!
|
|
397
|
-
const C = c(g) ? g(f,
|
|
398
|
-
|
|
379
|
+
}, R = (f, g) => (w) => {
|
|
380
|
+
if (w.input.startsWith(f, w.index)) {
|
|
381
|
+
if (!b(g) && !w.options.silent) {
|
|
382
|
+
const C = c(g) ? g(f, w.input, String(w.index)) : g;
|
|
383
|
+
b(C) || w.output.push(C);
|
|
399
384
|
}
|
|
400
|
-
return
|
|
385
|
+
return w.index += f.length, w.indexMax = Math.max(w.indexMax, w.index), !0;
|
|
401
386
|
} else return !1;
|
|
402
|
-
},
|
|
403
|
-
const P =
|
|
404
|
-
return
|
|
405
|
-
let
|
|
406
|
-
for (;
|
|
407
|
-
const
|
|
408
|
-
if (!P(k) || (
|
|
387
|
+
}, z = (f, g, w, C) => {
|
|
388
|
+
const P = Z(f);
|
|
389
|
+
return be(xe(Xe((k) => {
|
|
390
|
+
let T = 0;
|
|
391
|
+
for (; T < w; ) {
|
|
392
|
+
const $ = k.index;
|
|
393
|
+
if (!P(k) || (T += 1, k.index === $)) break;
|
|
409
394
|
}
|
|
410
|
-
return
|
|
395
|
+
return T >= g;
|
|
411
396
|
})));
|
|
412
|
-
},
|
|
413
|
-
const
|
|
414
|
-
return
|
|
415
|
-
for (let P = 0, k =
|
|
397
|
+
}, W = (f, g) => z(f, 0, 1), Y = (f, g) => z(f, 0, 1 / 0), V = (f, g) => {
|
|
398
|
+
const w = f.map(Z);
|
|
399
|
+
return be(xe(Xe((C) => {
|
|
400
|
+
for (let P = 0, k = w.length; P < k; P++) if (!w[P](C)) return !1;
|
|
416
401
|
return !0;
|
|
417
402
|
})));
|
|
418
|
-
},
|
|
419
|
-
const
|
|
420
|
-
return
|
|
421
|
-
for (let P = 0, k =
|
|
403
|
+
}, j = (f, g) => {
|
|
404
|
+
const w = f.map(Z);
|
|
405
|
+
return be(xe((C) => {
|
|
406
|
+
for (let P = 0, k = w.length; P < k; P++) if (w[P](C)) return !0;
|
|
422
407
|
return !1;
|
|
423
408
|
}));
|
|
424
|
-
},
|
|
425
|
-
const
|
|
409
|
+
}, Xe = (f, g = !1) => {
|
|
410
|
+
const w = Z(f);
|
|
426
411
|
return (C) => {
|
|
427
|
-
const P = C.index, k = C.output.length,
|
|
428
|
-
return (!
|
|
412
|
+
const P = C.index, k = C.output.length, T = w(C);
|
|
413
|
+
return (!T || g) && (C.index = P, C.output.length !== k && (C.output.length = k)), T;
|
|
429
414
|
};
|
|
430
|
-
},
|
|
415
|
+
}, xe = (f, g) => Z(f), be = /* @__PURE__ */ (() => {
|
|
431
416
|
let f = 0;
|
|
432
417
|
return (g) => {
|
|
433
|
-
const
|
|
418
|
+
const w = Z(g), C = f += 1;
|
|
434
419
|
return (P) => {
|
|
435
|
-
var
|
|
420
|
+
var lt;
|
|
436
421
|
var k;
|
|
437
|
-
if (P.options.memoization === !1) return
|
|
438
|
-
const
|
|
439
|
-
if (
|
|
440
|
-
if (m(
|
|
441
|
-
if (
|
|
422
|
+
if (P.options.memoization === !1) return w(P);
|
|
423
|
+
const T = P.index, $ = (k = P.cache)[C] || (k[C] = /* @__PURE__ */ new Map()), q = $.get(T);
|
|
424
|
+
if (q === !1) return !1;
|
|
425
|
+
if (m(q)) return P.index = q, !0;
|
|
426
|
+
if (q) return P.index = q.index, (lt = q.output) != null && lt.length && P.output.push(...q.output), !0;
|
|
442
427
|
{
|
|
443
|
-
const
|
|
444
|
-
if (
|
|
445
|
-
const
|
|
446
|
-
if (
|
|
447
|
-
const rn = P.output.slice(
|
|
448
|
-
|
|
449
|
-
} else
|
|
428
|
+
const ct = P.output.length;
|
|
429
|
+
if (w(P)) {
|
|
430
|
+
const dt = P.index, ut = P.output.length;
|
|
431
|
+
if (ut > ct) {
|
|
432
|
+
const rn = P.output.slice(ct, ut);
|
|
433
|
+
$.set(T, { index: dt, output: rn });
|
|
434
|
+
} else $.set(T, dt);
|
|
450
435
|
return !0;
|
|
451
|
-
} else return
|
|
436
|
+
} else return $.set(T, !1), !1;
|
|
452
437
|
}
|
|
453
438
|
};
|
|
454
439
|
};
|
|
455
|
-
})(),
|
|
440
|
+
})(), Ye = (f) => {
|
|
456
441
|
let g;
|
|
457
|
-
return (
|
|
458
|
-
},
|
|
459
|
-
if (c(f)) return u(f) ?
|
|
460
|
-
if (A(f) ||
|
|
461
|
-
if (p(f)) return
|
|
462
|
-
if (
|
|
442
|
+
return (w) => (g || (g = Z(f())), g(w));
|
|
443
|
+
}, Z = E((f) => {
|
|
444
|
+
if (c(f)) return u(f) ? Ye(f) : f;
|
|
445
|
+
if (A(f) || S(f)) return _(f);
|
|
446
|
+
if (p(f)) return V(f);
|
|
447
|
+
if (v(f)) return j(Object.values(f));
|
|
463
448
|
throw new Error("Invalid rule");
|
|
464
|
-
}),
|
|
449
|
+
}), Ze = "abcdefghijklmnopqrstuvwxyz", sr = (f) => {
|
|
465
450
|
let g = "";
|
|
466
451
|
for (; f > 0; ) {
|
|
467
|
-
const
|
|
468
|
-
g =
|
|
452
|
+
const w = (f - 1) % 26;
|
|
453
|
+
g = Ze[w] + g, f = Math.floor((f - 1) / 26);
|
|
469
454
|
}
|
|
470
455
|
return g;
|
|
471
|
-
},
|
|
456
|
+
}, Je = (f) => {
|
|
472
457
|
let g = 0;
|
|
473
|
-
for (let
|
|
458
|
+
for (let w = 0, C = f.length; w < C; w++) g = g * 26 + Ze.indexOf(f[w]) + 1;
|
|
474
459
|
return g;
|
|
475
|
-
},
|
|
476
|
-
if (g < f) return
|
|
477
|
-
const
|
|
478
|
-
for (; f <= g; )
|
|
479
|
-
return
|
|
480
|
-
}, or = (f, g,
|
|
460
|
+
}, Fe = (f, g) => {
|
|
461
|
+
if (g < f) return Fe(g, f);
|
|
462
|
+
const w = [];
|
|
463
|
+
for (; f <= g; ) w.push(f++);
|
|
464
|
+
return w;
|
|
465
|
+
}, or = (f, g, w) => Fe(f, g).map((C) => String(C).padStart(w, "0")), Qe = (f, g) => Fe(Je(f), Je(g)).map(sr), K = (f) => f, et = (f) => lr((g) => B(g, f, { memoization: !1 }).join("")), lr = (f) => {
|
|
481
466
|
const g = {};
|
|
482
|
-
return (
|
|
483
|
-
}, cr = _(/^\*\*\/\*$/, ".*"), dr = _(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (f, g,
|
|
484
|
-
const
|
|
485
|
-
if (!
|
|
486
|
-
const C =
|
|
487
|
-
return C.some((
|
|
467
|
+
return (w) => g[w] ?? (g[w] = f(w));
|
|
468
|
+
}, cr = _(/^\*\*\/\*$/, ".*"), dr = _(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (f, g, w) => `.*${g ? "" : "(?:^|/)"}${w.replaceAll(".", "\\.")}`), ur = _(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (f, g, w, C) => `.*${g ? "" : "(?:^|/)"}${w.replaceAll(".", "\\.")}(?:${C.replaceAll(",", "|").replaceAll(".", "\\.")})`), Me = _(/\\./, K), hr = _(/[$.*+?^(){}[\]\|]/, (f) => `\\${f}`), fr = _(/./, K), mr = _(/^(?:!!)*!(.*)$/, (f, g) => `(?!^${ot(g)}$).*?`), pr = _(/^(!!)+/, ""), gr = j([mr, pr]), vr = _(/\/(\*\*\/)+/, "(?:/.+/|/)"), yr = _(/^(\*\*\/)+/, "(?:^|.*/)"), wr = _(/\/(\*\*)$/, "(?:/.*|$)"), Ar = _(/\*\*/, ".*"), tt = j([vr, yr, wr, Ar]), Sr = _(/\*\/(?!\*\*\/)/, "[^/]*/"), br = _(/\*/, "[^/]*"), rt = j([Sr, br]), nt = _("?", "[^/]"), Cr = _("[", K), _r = _("]", K), Pr = _(/[!^]/, "^/"), Er = _(/[a-z]-[a-z]|[0-9]-[0-9]/i, K), Ir = _(/[$.*+?^(){}[\|]/, (f) => `\\${f}`), kr = _(/[^\]]/, K), xr = j([Me, Ir, Er, kr]), at = V([Cr, W(Pr), Y(xr), _r]), Fr = _("{", "(?:"), Mr = _("}", ")"), Lr = _(/(\d+)\.\.(\d+)/, (f, g, w) => or(+g, +w, Math.min(g.length, w.length)).join("|")), Rr = _(/([a-z]+)\.\.([a-z]+)/, (f, g, w) => Qe(g, w).join("|")), Tr = _(/([A-Z]+)\.\.([A-Z]+)/, (f, g, w) => Qe(g.toLowerCase(), w.toLowerCase()).join("|").toUpperCase()), Br = j([Lr, Rr, Tr]), it = V([Fr, Br, Mr]), Dr = _("{", "(?:"), Or = _("}", ")"), Nr = _(",", "|"), Ur = _(/[$.*+?^(){[\]\|]/, (f) => `\\${f}`), zr = _(/[^}]/, K), Vr = Ye(() => st), $r = j([tt, rt, nt, at, it, Vr, Me, Ur, Nr, zr]), st = V([Dr, Y($r), Or]), Gr = Y(j([cr, dr, ur, gr, tt, rt, nt, at, it, st, Me, hr, fr])), Wr = Gr, qr = et(Wr), ot = qr, Hr = _(/\\./, K), jr = _(/./, K), Kr = _(/\*\*\*+/, "*"), Xr = _(/([^/{[(!])\*\*/, (f, g) => `${g}*`), Yr = _(/(^|.)\*\*(?=[^*/)\]}])/, (f, g) => `${g}*`), Zr = Y(j([Hr, Kr, Xr, Yr, jr])), Jr = Zr, Qr = et(Jr), en = Qr, Le = (f, g) => {
|
|
469
|
+
const w = Array.isArray(f) ? f : [f];
|
|
470
|
+
if (!w.length) return !1;
|
|
471
|
+
const C = w.map(Le.compile), P = w.every((T) => /(\/(?:\*\*)?|\[\/\])$/.test(T)), k = g.replace(/[\\\/]+/g, "/").replace(/\/$/, P ? "/" : "");
|
|
472
|
+
return C.some((T) => T.test(k));
|
|
488
473
|
};
|
|
489
|
-
|
|
490
|
-
var tn =
|
|
474
|
+
Le.compile = (f) => new RegExp(`^${ot(en(f))}$`, "s");
|
|
475
|
+
var tn = Le;
|
|
491
476
|
return o(l);
|
|
492
477
|
})();
|
|
493
478
|
return r.default || r;
|
|
494
|
-
},
|
|
495
|
-
const mn = (r, e) => (
|
|
496
|
-
function
|
|
479
|
+
}, Te;
|
|
480
|
+
const mn = (r, e) => (Te || (Te = mt(), mt = null), Te(r, e)), pn = /^[A-Za-z]:\//;
|
|
481
|
+
function se(r = "") {
|
|
497
482
|
return r && r.replace(/\\/g, "/").replace(pn, (e) => e.toUpperCase());
|
|
498
483
|
}
|
|
499
|
-
const gn = /^[/\\]{2}/,
|
|
484
|
+
const gn = /^[/\\]{2}/, vn = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, Wt = /^[A-Za-z]:$/, pt = /^\/([A-Za-z]:)?$/, yn = /.(\.[^./]+|\.)$/, wn = /^[/\\]|^[a-zA-Z]:[/\\]/, An = "/", qe = function(r) {
|
|
500
485
|
if (r.length === 0)
|
|
501
486
|
return ".";
|
|
502
|
-
r =
|
|
503
|
-
const e = r.match(gn), t =
|
|
504
|
-
return r =
|
|
505
|
-
},
|
|
487
|
+
r = se(r);
|
|
488
|
+
const e = r.match(gn), t = pe(r), n = r[r.length - 1] === "/";
|
|
489
|
+
return r = He(r, !t), r.length === 0 ? t ? "/" : n ? "./" : "." : (n && (r += "/"), Wt.test(r) && (r += "/"), e ? t ? `//${r}` : `//./${r}` : t && !pe(r) ? `/${r}` : r);
|
|
490
|
+
}, Sn = function(...r) {
|
|
506
491
|
let e = "";
|
|
507
492
|
for (const t of r)
|
|
508
493
|
if (t)
|
|
@@ -511,21 +496,21 @@ const gn = /^[/\\]{2}/, yn = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,
|
|
|
511
496
|
n && a ? e += t.slice(1) : e += n || a ? t : `/${t}`;
|
|
512
497
|
} else
|
|
513
498
|
e += t;
|
|
514
|
-
return
|
|
499
|
+
return qe(e);
|
|
515
500
|
};
|
|
516
|
-
function
|
|
501
|
+
function bn() {
|
|
517
502
|
return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
|
|
518
503
|
}
|
|
519
|
-
const
|
|
520
|
-
r = r.map((n) =>
|
|
504
|
+
const Ee = function(...r) {
|
|
505
|
+
r = r.map((n) => se(n));
|
|
521
506
|
let e = "", t = !1;
|
|
522
507
|
for (let n = r.length - 1; n >= -1 && !t; n--) {
|
|
523
|
-
const a = n >= 0 ? r[n] :
|
|
524
|
-
!a || a.length === 0 || (e = `${a}/${e}`, t =
|
|
508
|
+
const a = n >= 0 ? r[n] : bn();
|
|
509
|
+
!a || a.length === 0 || (e = `${a}/${e}`, t = pe(a));
|
|
525
510
|
}
|
|
526
|
-
return e =
|
|
511
|
+
return e = He(e, !t), t && !pe(e) ? `/${e}` : e.length > 0 ? e : ".";
|
|
527
512
|
};
|
|
528
|
-
function
|
|
513
|
+
function He(r, e) {
|
|
529
514
|
let t = "", n = 0, a = -1, i = 0, s = null;
|
|
530
515
|
for (let o = 0; o <= r.length; ++o) {
|
|
531
516
|
if (o < r.length)
|
|
@@ -555,16 +540,16 @@ function Je(r, e) {
|
|
|
555
540
|
}
|
|
556
541
|
return t;
|
|
557
542
|
}
|
|
558
|
-
const
|
|
559
|
-
return
|
|
543
|
+
const pe = function(r) {
|
|
544
|
+
return vn.test(r);
|
|
560
545
|
}, Cn = function(r) {
|
|
561
|
-
return
|
|
562
|
-
},
|
|
546
|
+
return se(r);
|
|
547
|
+
}, qt = function(r) {
|
|
563
548
|
if (r === "..") return "";
|
|
564
|
-
const e =
|
|
549
|
+
const e = yn.exec(se(r));
|
|
565
550
|
return e && e[1] || "";
|
|
566
551
|
}, _n = function(r, e) {
|
|
567
|
-
const t =
|
|
552
|
+
const t = Ee(r).replace(pt, "$1").split("/"), n = Ee(e).replace(pt, "$1").split("/");
|
|
568
553
|
if (n[0][1] === ":" && t[0][1] === ":" && t[0] !== n[0])
|
|
569
554
|
return n.join("/");
|
|
570
555
|
const a = [...t];
|
|
@@ -574,18 +559,18 @@ const Ae = function(r) {
|
|
|
574
559
|
t.shift(), n.shift();
|
|
575
560
|
}
|
|
576
561
|
return [...t.map(() => ".."), ...n].join("/");
|
|
577
|
-
},
|
|
578
|
-
const e =
|
|
579
|
-
return e.length === 1 && Wt.test(e[0]) && (e[0] += "/"), e.join("/") || (
|
|
562
|
+
}, Ht = function(r) {
|
|
563
|
+
const e = se(r).replace(/\/$/, "").split("/").slice(0, -1);
|
|
564
|
+
return e.length === 1 && Wt.test(e[0]) && (e[0] += "/"), e.join("/") || (pe(r) ? "/" : ".");
|
|
580
565
|
}, Pn = function(r) {
|
|
581
566
|
const e = r.ext ? r.ext.startsWith(".") ? r.ext : `.${r.ext}` : "", t = [r.root, r.dir, r.base ?? (r.name ?? "") + e].filter(
|
|
582
567
|
Boolean
|
|
583
568
|
);
|
|
584
|
-
return
|
|
585
|
-
r.root ?
|
|
569
|
+
return se(
|
|
570
|
+
r.root ? Ee(...t) : t.join("/")
|
|
586
571
|
);
|
|
587
|
-
},
|
|
588
|
-
const t =
|
|
572
|
+
}, jt = function(r, e) {
|
|
573
|
+
const t = se(r).split("/");
|
|
589
574
|
let n = "";
|
|
590
575
|
for (let a = t.length - 1; a >= 0; a--) {
|
|
591
576
|
const i = t[a];
|
|
@@ -597,92 +582,92 @@ const Ae = function(r) {
|
|
|
597
582
|
return e && n.endsWith(e) ? n.slice(0, -e.length) : n;
|
|
598
583
|
}, En = function(r) {
|
|
599
584
|
var a, i;
|
|
600
|
-
const e = ((i = (a = wn.exec(r)) == null ? void 0 : a[0]) == null ? void 0 : i.replace(/\\/g, "/")) || "", t =
|
|
585
|
+
const e = ((i = (a = wn.exec(r)) == null ? void 0 : a[0]) == null ? void 0 : i.replace(/\\/g, "/")) || "", t = jt(r), n = qt(t);
|
|
601
586
|
return {
|
|
602
587
|
root: e,
|
|
603
|
-
dir:
|
|
588
|
+
dir: Ht(r),
|
|
604
589
|
base: t,
|
|
605
590
|
ext: n,
|
|
606
591
|
name: t.slice(0, t.length - n.length)
|
|
607
592
|
};
|
|
608
|
-
}, In = (r, e) => mn(e,
|
|
593
|
+
}, In = (r, e) => mn(e, qe(r)), gt = {
|
|
609
594
|
__proto__: null,
|
|
610
|
-
basename:
|
|
611
|
-
dirname:
|
|
612
|
-
extname:
|
|
595
|
+
basename: jt,
|
|
596
|
+
dirname: Ht,
|
|
597
|
+
extname: qt,
|
|
613
598
|
format: Pn,
|
|
614
|
-
isAbsolute:
|
|
615
|
-
join:
|
|
599
|
+
isAbsolute: pe,
|
|
600
|
+
join: Sn,
|
|
616
601
|
matchesGlob: In,
|
|
617
|
-
normalize:
|
|
618
|
-
normalizeString:
|
|
602
|
+
normalize: qe,
|
|
603
|
+
normalizeString: He,
|
|
619
604
|
parse: En,
|
|
620
605
|
relative: _n,
|
|
621
|
-
resolve:
|
|
606
|
+
resolve: Ee,
|
|
622
607
|
sep: An,
|
|
623
608
|
toNamespacedPath: Cn
|
|
624
609
|
}, kn = /* @__PURE__ */ (() => {
|
|
625
610
|
var r;
|
|
626
611
|
return ((r = globalThis.process) == null ? void 0 : r.platform) === "win32" ? ";" : ":";
|
|
627
|
-
})(), xn = { posix: void 0, win32: void 0 },
|
|
612
|
+
})(), xn = { posix: void 0, win32: void 0 }, Kt = (r = kn) => new Proxy(gt, {
|
|
628
613
|
get(e, t) {
|
|
629
|
-
return t === "delimiter" ? r : t === "posix" ?
|
|
614
|
+
return t === "delimiter" ? r : t === "posix" ? Ve : t === "win32" ? Fn : xn[t] || gt[t];
|
|
630
615
|
}
|
|
631
|
-
}),
|
|
632
|
-
var
|
|
633
|
-
const
|
|
634
|
-
function
|
|
616
|
+
}), Ve = /* @__PURE__ */ Kt(":"), Fn = /* @__PURE__ */ Kt(";");
|
|
617
|
+
var F = /* @__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))(F || {}), 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 || {});
|
|
618
|
+
const Mn = !0;
|
|
619
|
+
function L(r, e, t = r) {
|
|
635
620
|
return (n) => {
|
|
636
621
|
const a = `${n}`, i = a.indexOf(e, r.length);
|
|
637
|
-
return ~i ? r +
|
|
622
|
+
return ~i ? r + Xt(a, e, t, i) + e : r + a + e;
|
|
638
623
|
};
|
|
639
624
|
}
|
|
640
|
-
function
|
|
625
|
+
function Xt(r, e, t, n) {
|
|
641
626
|
const a = r.substring(0, n) + t, i = r.substring(n + e.length), s = i.indexOf(e);
|
|
642
|
-
return ~s ? a +
|
|
627
|
+
return ~s ? a + Xt(i, e, t, s) : a + i;
|
|
643
628
|
}
|
|
644
|
-
function
|
|
629
|
+
function Ln(r = Mn) {
|
|
645
630
|
return {
|
|
646
631
|
isColorSupported: r,
|
|
647
632
|
reset: r ? (e) => `\x1B[0m${e}\x1B[0m` : String,
|
|
648
|
-
bold: r ?
|
|
649
|
-
dim: r ?
|
|
650
|
-
italic: r ?
|
|
651
|
-
underline: r ?
|
|
652
|
-
inverse: r ?
|
|
653
|
-
hidden: r ?
|
|
654
|
-
strikethrough: r ?
|
|
655
|
-
black: r ?
|
|
656
|
-
red: r ?
|
|
657
|
-
green: r ?
|
|
658
|
-
yellow: r ?
|
|
659
|
-
blue: r ?
|
|
660
|
-
magenta: r ?
|
|
661
|
-
cyan: r ?
|
|
662
|
-
white: r ?
|
|
663
|
-
gray: r ?
|
|
664
|
-
bgBlack: r ?
|
|
665
|
-
bgRed: r ?
|
|
666
|
-
bgGreen: r ?
|
|
667
|
-
bgYellow: r ?
|
|
668
|
-
bgBlue: r ?
|
|
669
|
-
bgMagenta: r ?
|
|
670
|
-
bgCyan: r ?
|
|
671
|
-
bgWhite: r ?
|
|
633
|
+
bold: r ? L("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m") : String,
|
|
634
|
+
dim: r ? L("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m") : String,
|
|
635
|
+
italic: r ? L("\x1B[3m", "\x1B[23m") : String,
|
|
636
|
+
underline: r ? L("\x1B[4m", "\x1B[24m") : String,
|
|
637
|
+
inverse: r ? L("\x1B[7m", "\x1B[27m") : String,
|
|
638
|
+
hidden: r ? L("\x1B[8m", "\x1B[28m") : String,
|
|
639
|
+
strikethrough: r ? L("\x1B[9m", "\x1B[29m") : String,
|
|
640
|
+
black: r ? L("\x1B[30m", "\x1B[39m") : String,
|
|
641
|
+
red: r ? L("\x1B[31m", "\x1B[39m") : String,
|
|
642
|
+
green: r ? L("\x1B[32m", "\x1B[39m") : String,
|
|
643
|
+
yellow: r ? L("\x1B[33m", "\x1B[39m") : String,
|
|
644
|
+
blue: r ? L("\x1B[34m", "\x1B[39m") : String,
|
|
645
|
+
magenta: r ? L("\x1B[35m", "\x1B[39m") : String,
|
|
646
|
+
cyan: r ? L("\x1B[36m", "\x1B[39m") : String,
|
|
647
|
+
white: r ? L("\x1B[37m", "\x1B[39m") : String,
|
|
648
|
+
gray: r ? L("\x1B[90m", "\x1B[39m") : String,
|
|
649
|
+
bgBlack: r ? L("\x1B[40m", "\x1B[49m") : String,
|
|
650
|
+
bgRed: r ? L("\x1B[41m", "\x1B[49m") : String,
|
|
651
|
+
bgGreen: r ? L("\x1B[42m", "\x1B[49m") : String,
|
|
652
|
+
bgYellow: r ? L("\x1B[43m", "\x1B[49m") : String,
|
|
653
|
+
bgBlue: r ? L("\x1B[44m", "\x1B[49m") : String,
|
|
654
|
+
bgMagenta: r ? L("\x1B[45m", "\x1B[49m") : String,
|
|
655
|
+
bgCyan: r ? L("\x1B[46m", "\x1B[49m") : String,
|
|
656
|
+
bgWhite: r ? L("\x1B[47m", "\x1B[49m") : String
|
|
672
657
|
};
|
|
673
658
|
}
|
|
674
|
-
const D =
|
|
675
|
-
[x.Error]:
|
|
676
|
-
[x.Warning]:
|
|
677
|
-
[x.Log]:
|
|
678
|
-
[x.Verbose]:
|
|
679
|
-
[x.Debug]:
|
|
680
|
-
},
|
|
681
|
-
[
|
|
682
|
-
[
|
|
683
|
-
[
|
|
684
|
-
[
|
|
685
|
-
[
|
|
659
|
+
const D = Ln(), $e = {
|
|
660
|
+
[x.Error]: F.Error,
|
|
661
|
+
[x.Warning]: F.Warning,
|
|
662
|
+
[x.Log]: F.Log,
|
|
663
|
+
[x.Verbose]: F.Verbose,
|
|
664
|
+
[x.Debug]: F.Debug
|
|
665
|
+
}, Rn = {
|
|
666
|
+
[F.Error]: x.Error,
|
|
667
|
+
[F.Warning]: x.Warning,
|
|
668
|
+
[F.Log]: x.Log,
|
|
669
|
+
[F.Verbose]: x.Verbose,
|
|
670
|
+
[F.Debug]: x.Debug
|
|
686
671
|
}, vt = [
|
|
687
672
|
x.Error,
|
|
688
673
|
x.Warning,
|
|
@@ -690,18 +675,18 @@ const D = Rn(), je = {
|
|
|
690
675
|
x.Verbose,
|
|
691
676
|
x.Debug
|
|
692
677
|
], Tn = {
|
|
693
|
-
[
|
|
694
|
-
[
|
|
695
|
-
[
|
|
696
|
-
[
|
|
697
|
-
[
|
|
698
|
-
},
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
],
|
|
678
|
+
[F.Error]: D.red,
|
|
679
|
+
[F.Warning]: D.yellow,
|
|
680
|
+
[F.Log]: D.blue,
|
|
681
|
+
[F.Verbose]: D.cyan,
|
|
682
|
+
[F.Debug]: D.green
|
|
683
|
+
}, Ie = [
|
|
684
|
+
F.Error,
|
|
685
|
+
F.Warning,
|
|
686
|
+
F.Log,
|
|
687
|
+
F.Verbose,
|
|
688
|
+
F.Debug
|
|
689
|
+
], yt = [te.JSON, te.Pretty];
|
|
705
690
|
function Bn(r) {
|
|
706
691
|
return r.stack == null ? [] : r.stack.split(`
|
|
707
692
|
`).map((e) => e.trim()).slice(1).filter((e) => !!/^at (.*)( \(.*:(\d+):(\d+)\))|at (.*)(:(\d+):(\d+))/i.exec(e)).map((e) => {
|
|
@@ -725,7 +710,7 @@ function Bn(r) {
|
|
|
725
710
|
};
|
|
726
711
|
});
|
|
727
712
|
}
|
|
728
|
-
function
|
|
713
|
+
function Yt(r) {
|
|
729
714
|
return r == null ? !1 : r instanceof Error;
|
|
730
715
|
}
|
|
731
716
|
function Zt(r, e, t, n, a) {
|
|
@@ -744,7 +729,7 @@ function Dn(r, e, t, n, a, i) {
|
|
|
744
729
|
const s = Zt(r, e, t, n, i);
|
|
745
730
|
return typeof a < "u" && a !== null && (s.errored = !0, s.error = { stack: a }), s;
|
|
746
731
|
}
|
|
747
|
-
function
|
|
732
|
+
function wt(r) {
|
|
748
733
|
let e = "";
|
|
749
734
|
switch (typeof r) {
|
|
750
735
|
case "number":
|
|
@@ -765,10 +750,10 @@ function At(r) {
|
|
|
765
750
|
}
|
|
766
751
|
return e;
|
|
767
752
|
}
|
|
768
|
-
function
|
|
753
|
+
function Ce(r) {
|
|
769
754
|
const e = [];
|
|
770
755
|
e.push(r["@localetime"]), e.push(
|
|
771
|
-
Tn[
|
|
756
|
+
Tn[$e[r.level]](
|
|
772
757
|
`[${r.level}]`
|
|
773
758
|
)
|
|
774
759
|
);
|
|
@@ -778,15 +763,15 @@ function ke(r) {
|
|
|
778
763
|
n.length > 0 && e.push(" {");
|
|
779
764
|
for (const [i, s] of n) {
|
|
780
765
|
let o = s;
|
|
781
|
-
if (
|
|
782
|
-
if (s.message && (o =
|
|
766
|
+
if (Yt(s)) {
|
|
767
|
+
if (s.message && (o = wt(s.message)), o || (o = ""), s.cause != null)
|
|
783
768
|
try {
|
|
784
769
|
o += JSON.stringify(s.cause);
|
|
785
770
|
} catch {
|
|
786
771
|
o += String(s.cause);
|
|
787
772
|
}
|
|
788
773
|
} else
|
|
789
|
-
o =
|
|
774
|
+
o = wt(s);
|
|
790
775
|
e.push(`${D.gray(i)}${D.gray("=")}${o}`);
|
|
791
776
|
}
|
|
792
777
|
n.length > 0 && e.push("}");
|
|
@@ -795,67 +780,67 @@ function ke(r) {
|
|
|
795
780
|
${r.error.stack}`), a;
|
|
796
781
|
}
|
|
797
782
|
function On(r) {
|
|
798
|
-
return r >=
|
|
783
|
+
return r >= F.Debug;
|
|
799
784
|
}
|
|
800
785
|
function Nn(r) {
|
|
801
|
-
return r >=
|
|
786
|
+
return r >= F.Verbose;
|
|
802
787
|
}
|
|
803
788
|
function Un(r) {
|
|
804
|
-
return r >=
|
|
789
|
+
return r >= F.Log;
|
|
805
790
|
}
|
|
806
791
|
function zn(r) {
|
|
807
|
-
return r >=
|
|
792
|
+
return r >= F.Warning;
|
|
808
793
|
}
|
|
809
794
|
function Vn(r) {
|
|
810
|
-
return r >=
|
|
795
|
+
return r >= F.Error;
|
|
811
796
|
}
|
|
812
|
-
function
|
|
797
|
+
function Jt() {
|
|
813
798
|
return typeof window < "u";
|
|
814
799
|
}
|
|
815
800
|
function $n() {
|
|
816
|
-
return !
|
|
801
|
+
return !Jt() && Ge() === te.Pretty;
|
|
817
802
|
}
|
|
818
|
-
function
|
|
803
|
+
function Gn(r, e) {
|
|
819
804
|
return $n() ? `\x1B]8;;file://${r}\x1B\\${e}\x1B]8;;\x1B\\` : e;
|
|
820
805
|
}
|
|
821
|
-
const
|
|
806
|
+
const Ae = {
|
|
822
807
|
configured: !1,
|
|
823
|
-
logLevel:
|
|
824
|
-
format:
|
|
808
|
+
logLevel: F.Debug,
|
|
809
|
+
format: te.JSON,
|
|
825
810
|
timeFormatter: (r) => r.toISOString()
|
|
826
811
|
};
|
|
827
|
-
function
|
|
828
|
-
return
|
|
812
|
+
function At() {
|
|
813
|
+
return Ae.logLevel;
|
|
829
814
|
}
|
|
830
|
-
function
|
|
831
|
-
if (
|
|
832
|
-
|
|
815
|
+
function Wn(r) {
|
|
816
|
+
if (Ie.includes(r))
|
|
817
|
+
Ae.logLevel = r;
|
|
833
818
|
else
|
|
834
819
|
throw new Error(
|
|
835
|
-
`log level ${r} is not available. available log levels are: ${
|
|
820
|
+
`log level ${r} is not available. available log levels are: ${Ie.join(
|
|
836
821
|
", "
|
|
837
822
|
)}`
|
|
838
823
|
);
|
|
839
|
-
|
|
824
|
+
Ae.configured = !0;
|
|
840
825
|
}
|
|
841
|
-
function
|
|
842
|
-
return
|
|
826
|
+
function Ge() {
|
|
827
|
+
return Ae.format;
|
|
843
828
|
}
|
|
844
|
-
function
|
|
845
|
-
return
|
|
829
|
+
function qn() {
|
|
830
|
+
return Ae.timeFormatter;
|
|
846
831
|
}
|
|
847
|
-
function
|
|
832
|
+
function Qt(r) {
|
|
848
833
|
const e = {
|
|
849
834
|
fields: {},
|
|
850
835
|
context: r,
|
|
851
|
-
logLevel:
|
|
852
|
-
format:
|
|
836
|
+
logLevel: F.Debug,
|
|
837
|
+
format: te.JSON,
|
|
853
838
|
shouldUseGlobalConfig: !1,
|
|
854
839
|
errorProcessor: (c) => c,
|
|
855
840
|
timeFormatter: (c) => c.toISOString(),
|
|
856
|
-
useGlobalConfig: () => (e.shouldUseGlobalConfig = !0, e.format =
|
|
841
|
+
useGlobalConfig: () => (e.shouldUseGlobalConfig = !0, e.format = Ge(), e.logLevel = At(), e.child()),
|
|
857
842
|
child: (c) => {
|
|
858
|
-
const u =
|
|
843
|
+
const u = Qt(e.context);
|
|
859
844
|
return c != null ? u.fields = { ...e.fields, ...c } : u.fields = e.fields, u.fields != null && "context" in u.fields ? u.context = u.fields.context : u.context = e.context, u.logLevel = e.logLevel, u.format = e.format, u.shouldUseGlobalConfig = e.shouldUseGlobalConfig, u;
|
|
860
845
|
},
|
|
861
846
|
withContext: (c) => {
|
|
@@ -864,13 +849,13 @@ function er(r) {
|
|
|
864
849
|
},
|
|
865
850
|
withLogLevel: (c) => {
|
|
866
851
|
const u = e.child();
|
|
867
|
-
if (
|
|
852
|
+
if (Ie.includes(c))
|
|
868
853
|
u.logLevel = c, u.shouldUseGlobalConfig = !1, u.debug(
|
|
869
|
-
`setting log level to ${
|
|
854
|
+
`setting log level to ${Rn[c]} (${c})`
|
|
870
855
|
);
|
|
871
856
|
else
|
|
872
857
|
throw new Error(
|
|
873
|
-
`log level ${c} is not available. available log levels are: ${
|
|
858
|
+
`log level ${c} is not available. available log levels are: ${Ie.join(
|
|
874
859
|
", "
|
|
875
860
|
)}`
|
|
876
861
|
);
|
|
@@ -879,8 +864,8 @@ function er(r) {
|
|
|
879
864
|
withLogLevelString: (c) => {
|
|
880
865
|
const u = e.child();
|
|
881
866
|
if (vt.includes(c))
|
|
882
|
-
u.logLevel =
|
|
883
|
-
`setting log level to ${c} (${
|
|
867
|
+
u.logLevel = $e[c], u.shouldUseGlobalConfig = !1, u.debug(
|
|
868
|
+
`setting log level to ${c} (${$e[c]})`
|
|
884
869
|
);
|
|
885
870
|
else
|
|
886
871
|
throw new Error(
|
|
@@ -892,11 +877,11 @@ function er(r) {
|
|
|
892
877
|
},
|
|
893
878
|
withFormat: (c) => {
|
|
894
879
|
const u = e.child();
|
|
895
|
-
if (
|
|
880
|
+
if (yt.includes(c))
|
|
896
881
|
u.format = c, u.shouldUseGlobalConfig = !1, u.debug(`setting format to ${c}`);
|
|
897
882
|
else
|
|
898
883
|
throw new Error(
|
|
899
|
-
`format ${c} is not available. available formats are: ${
|
|
884
|
+
`format ${c} is not available. available formats are: ${yt.join(
|
|
900
885
|
", "
|
|
901
886
|
)}`
|
|
902
887
|
);
|
|
@@ -909,7 +894,7 @@ function er(r) {
|
|
|
909
894
|
return e.child({ [c]: u });
|
|
910
895
|
},
|
|
911
896
|
withError: (c) => {
|
|
912
|
-
if (c = e.errorProcessor(c), !
|
|
897
|
+
if (c = e.errorProcessor(c), !Yt(c))
|
|
913
898
|
return e.withField("error", String(c));
|
|
914
899
|
let u = e;
|
|
915
900
|
if (u = u.withField("error", c.message), c.stack != null && (u = u.withField("stack", c.stack)), c.cause != null)
|
|
@@ -952,21 +937,21 @@ function er(r) {
|
|
|
952
937
|
const u = e.child();
|
|
953
938
|
return u.errorProcessor = c, u;
|
|
954
939
|
}
|
|
955
|
-
}, t = () => e.shouldUseGlobalConfig ?
|
|
956
|
-
const
|
|
957
|
-
if (
|
|
940
|
+
}, t = () => e.shouldUseGlobalConfig ? At() : e.logLevel, n = () => e.shouldUseGlobalConfig ? Ge() : e.format, a = () => e.shouldUseGlobalConfig ? qn() : e.timeFormatter ?? ((c) => c.toISOString()), i = (c) => c != null && c.length > 0 ? Object.keys(e.fields).length > 0 ? [e.fields, ...c] : c : e.fields, s = (c, u, m) => {
|
|
941
|
+
const v = n();
|
|
942
|
+
if (Jt() && v === te.Pretty) {
|
|
958
943
|
c.fields = Object.fromEntries(
|
|
959
|
-
Object.entries(c.fields).filter(([
|
|
960
|
-
if (
|
|
961
|
-
return [
|
|
944
|
+
Object.entries(c.fields).filter(([b, E]) => {
|
|
945
|
+
if (b === "isNestSystemModule" || b === "nestSystemModule" || b === "context")
|
|
946
|
+
return [b, E];
|
|
962
947
|
})
|
|
963
948
|
);
|
|
964
949
|
const A = m ?? e.fields;
|
|
965
|
-
Array.isArray(A) && A.length > 0 ? console[u](
|
|
950
|
+
Array.isArray(A) && A.length > 0 ? console[u](Ce(c), ...A) : Object.keys(A).length > 0 ? console[u](Ce(c), A) : console[u](Ce(c));
|
|
966
951
|
return;
|
|
967
952
|
}
|
|
968
|
-
const
|
|
969
|
-
console[u](
|
|
953
|
+
const S = v === te.Pretty ? Ce(c) : JSON.stringify(c);
|
|
954
|
+
console[u](S);
|
|
970
955
|
}, o = {
|
|
971
956
|
[x.Debug]: On,
|
|
972
957
|
[x.Verbose]: Nn,
|
|
@@ -978,17 +963,17 @@ function er(r) {
|
|
|
978
963
|
[x.Log]: "log",
|
|
979
964
|
[x.Warning]: "warn"
|
|
980
965
|
}, p = (c, u, m) => {
|
|
981
|
-
const
|
|
982
|
-
if (!
|
|
966
|
+
const v = t(), S = o[c];
|
|
967
|
+
if (!S(v))
|
|
983
968
|
return;
|
|
984
|
-
const A = i(m),
|
|
969
|
+
const A = i(m), b = Zt(
|
|
985
970
|
c,
|
|
986
971
|
e.context,
|
|
987
972
|
A,
|
|
988
973
|
u,
|
|
989
974
|
a()
|
|
990
975
|
);
|
|
991
|
-
s(
|
|
976
|
+
s(b, l[c], A);
|
|
992
977
|
};
|
|
993
978
|
return e.debug = (c, ...u) => {
|
|
994
979
|
p(x.Debug, c, u);
|
|
@@ -999,50 +984,50 @@ function er(r) {
|
|
|
999
984
|
}, e.warn = (c, ...u) => {
|
|
1000
985
|
p(x.Warning, c, u);
|
|
1001
986
|
}, e.error = (c, u, ...m) => {
|
|
1002
|
-
const
|
|
1003
|
-
if (!Vn(
|
|
987
|
+
const v = t();
|
|
988
|
+
if (!Vn(v))
|
|
1004
989
|
return;
|
|
1005
|
-
const
|
|
990
|
+
const S = i(m), A = Dn(
|
|
1006
991
|
x.Error,
|
|
1007
992
|
e.context,
|
|
1008
|
-
|
|
993
|
+
S,
|
|
1009
994
|
c,
|
|
1010
995
|
u,
|
|
1011
996
|
a()
|
|
1012
997
|
);
|
|
1013
|
-
s(A, "error",
|
|
998
|
+
s(A, "error", S);
|
|
1014
999
|
}, e.errorWithError = (c, u, ...m) => e.withError(u).error(c, void 0, ...m), e;
|
|
1015
1000
|
}
|
|
1016
1001
|
function Hn(r) {
|
|
1017
1002
|
var i;
|
|
1018
|
-
const t = fn.parse(new Error())[1], n = ((i = t.fileName) == null ? void 0 : i.replace("async", "").trim()) ?? "", a =
|
|
1019
|
-
return r = r ?? `${a}:${t.lineNumber}`,
|
|
1003
|
+
const t = fn.parse(new Error())[1], n = ((i = t.fileName) == null ? void 0 : i.replace("async", "").trim()) ?? "", a = Ve.join(...n.split(Ve.sep).slice(-2));
|
|
1004
|
+
return r = r ?? `${a}:${t.lineNumber}`, Qt(Gn(n, r));
|
|
1020
1005
|
}
|
|
1021
1006
|
const jn = (r) => Hn(r).useGlobalConfig();
|
|
1022
|
-
let
|
|
1007
|
+
let J = [];
|
|
1023
1008
|
const St = 100;
|
|
1024
1009
|
async function Kn() {
|
|
1025
|
-
if (
|
|
1010
|
+
if (J.length === 0)
|
|
1026
1011
|
return;
|
|
1027
|
-
const r = [...
|
|
1028
|
-
|
|
1012
|
+
const r = [...J];
|
|
1013
|
+
J = [];
|
|
1029
1014
|
try {
|
|
1030
1015
|
await Xn();
|
|
1031
1016
|
} catch (e) {
|
|
1032
|
-
h.warn("[CLS] Failed to flush logs:", e instanceof Error ? e.message : String(e)),
|
|
1017
|
+
h.warn("[CLS] Failed to flush logs:", e instanceof Error ? e.message : String(e)), J.unshift(...r), J.length > St && (J = J.slice(0, St));
|
|
1033
1018
|
}
|
|
1034
1019
|
}
|
|
1035
1020
|
async function Xn(r) {
|
|
1036
1021
|
}
|
|
1037
1022
|
function Yn() {
|
|
1038
|
-
|
|
1023
|
+
J.length > 0 && Kn(), h.log("[CLS] Cleaned up");
|
|
1039
1024
|
}
|
|
1040
|
-
|
|
1025
|
+
Wn(F.Warning);
|
|
1041
1026
|
const h = jn("Web").withErrorProcessor((r) => r).useGlobalConfig(), O = {
|
|
1042
1027
|
config: null,
|
|
1043
1028
|
promise: null
|
|
1044
1029
|
};
|
|
1045
|
-
async function
|
|
1030
|
+
async function Zn(r) {
|
|
1046
1031
|
return O.promise ? (await O.promise, O.config || {}) : O.config ? O.config : (O.promise = (async () => {
|
|
1047
1032
|
try {
|
|
1048
1033
|
const t = typeof window < "u" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1") ? `/api/config/sdk?version=${r}` : `https://config.spatialwalk.top/sdk?version=${r}`;
|
|
@@ -1059,7 +1044,7 @@ async function Jn(r) {
|
|
|
1059
1044
|
if (!a.endpoints)
|
|
1060
1045
|
throw new Error("Invalid config response: missing endpoints");
|
|
1061
1046
|
const i = {};
|
|
1062
|
-
a.endpoints.cn && (i[
|
|
1047
|
+
a.endpoints.cn && (i[ie.cn] = `https://${a.endpoints.cn}`), a.endpoints.us && (i[ie.us] = `https://${a.endpoints.us}`), a.endpoints.test && (i[ie.test] = `https://${a.endpoints.test}`), O.config = i, h.log("[SdkConfigLoader] SDK config fetched successfully:", i);
|
|
1063
1048
|
} catch {
|
|
1064
1049
|
O.config = {};
|
|
1065
1050
|
} finally {
|
|
@@ -1067,7 +1052,7 @@ async function Jn(r) {
|
|
|
1067
1052
|
}
|
|
1068
1053
|
})(), await O.promise, O.config || {});
|
|
1069
1054
|
}
|
|
1070
|
-
function
|
|
1055
|
+
function Jn() {
|
|
1071
1056
|
O.config = null, O.promise = null;
|
|
1072
1057
|
}
|
|
1073
1058
|
class Qn {
|
|
@@ -1171,37 +1156,37 @@ class Qn {
|
|
|
1171
1156
|
if (!n)
|
|
1172
1157
|
throw new Error("Failed to allocate AvatarFlameParams structure");
|
|
1173
1158
|
let a = 0;
|
|
1174
|
-
for (let
|
|
1175
|
-
const
|
|
1176
|
-
this.module.setValue(n + a,
|
|
1159
|
+
for (let v = 0; v < 300; v++) {
|
|
1160
|
+
const S = ((i = e.shape_params) == null ? void 0 : i[v]) || 0;
|
|
1161
|
+
this.module.setValue(n + a, S, "float"), a += 4;
|
|
1177
1162
|
}
|
|
1178
|
-
for (let
|
|
1179
|
-
const
|
|
1180
|
-
this.module.setValue(n + a,
|
|
1163
|
+
for (let v = 0; v < 100; v++) {
|
|
1164
|
+
const S = ((s = e.expr_params) == null ? void 0 : s[v]) || 0;
|
|
1165
|
+
this.module.setValue(n + a, S, "float"), a += 4;
|
|
1181
1166
|
}
|
|
1182
|
-
for (let
|
|
1183
|
-
const
|
|
1184
|
-
this.module.setValue(n + a,
|
|
1167
|
+
for (let v = 0; v < 3; v++) {
|
|
1168
|
+
const S = ((o = e.rotation) == null ? void 0 : o[v]) || 0;
|
|
1169
|
+
this.module.setValue(n + a, S, "float"), a += 4;
|
|
1185
1170
|
}
|
|
1186
|
-
for (let
|
|
1187
|
-
const
|
|
1188
|
-
this.module.setValue(n + a,
|
|
1171
|
+
for (let v = 0; v < 3; v++) {
|
|
1172
|
+
const S = ((l = e.translation) == null ? void 0 : l[v]) || 0;
|
|
1173
|
+
this.module.setValue(n + a, S, "float"), a += 4;
|
|
1189
1174
|
}
|
|
1190
|
-
for (let
|
|
1191
|
-
const
|
|
1192
|
-
this.module.setValue(n + a,
|
|
1175
|
+
for (let v = 0; v < 3; v++) {
|
|
1176
|
+
const S = ((p = e.neck_pose) == null ? void 0 : p[v]) || 0;
|
|
1177
|
+
this.module.setValue(n + a, S, "float"), a += 4;
|
|
1193
1178
|
}
|
|
1194
|
-
for (let
|
|
1195
|
-
const
|
|
1196
|
-
this.module.setValue(n + a,
|
|
1179
|
+
for (let v = 0; v < 3; v++) {
|
|
1180
|
+
const S = ((c = e.jaw_pose) == null ? void 0 : c[v]) || 0;
|
|
1181
|
+
this.module.setValue(n + a, S, "float"), a += 4;
|
|
1197
1182
|
}
|
|
1198
|
-
for (let
|
|
1199
|
-
const
|
|
1200
|
-
this.module.setValue(n + a,
|
|
1183
|
+
for (let v = 0; v < 6; v++) {
|
|
1184
|
+
const S = ((u = e.eyes_pose) == null ? void 0 : u[v]) || 0;
|
|
1185
|
+
this.module.setValue(n + a, S, "float"), a += 4;
|
|
1201
1186
|
}
|
|
1202
|
-
for (let
|
|
1203
|
-
const
|
|
1204
|
-
this.module.setValue(n + a,
|
|
1187
|
+
for (let v = 0; v < 2; v++) {
|
|
1188
|
+
const S = ((m = e.eyelid) == null ? void 0 : m[v]) || 0;
|
|
1189
|
+
this.module.setValue(n + a, S, "float"), a += 4;
|
|
1205
1190
|
}
|
|
1206
1191
|
return this.module.setValue(n + a, e.has_eyelid ? 1 : 0, "i32"), a += 4, n;
|
|
1207
1192
|
}
|
|
@@ -1806,8 +1791,8 @@ class ea {
|
|
|
1806
1791
|
const s = (e == null ? void 0 : e.frameIndex) ?? 0, o = t || this.characterHandle;
|
|
1807
1792
|
let l;
|
|
1808
1793
|
if (o) {
|
|
1809
|
-
for (const [m,
|
|
1810
|
-
if (
|
|
1794
|
+
for (const [m, v] of this.characterHandles.entries())
|
|
1795
|
+
if (v === o) {
|
|
1811
1796
|
l = m;
|
|
1812
1797
|
break;
|
|
1813
1798
|
}
|
|
@@ -1886,7 +1871,7 @@ class ea {
|
|
|
1886
1871
|
return null;
|
|
1887
1872
|
}
|
|
1888
1873
|
}
|
|
1889
|
-
class
|
|
1874
|
+
class y {
|
|
1890
1875
|
/**
|
|
1891
1876
|
* SDK 初始化
|
|
1892
1877
|
* @param appId 前端需要在 HTTP Headers 和 WebSocket Headers 中都带上
|
|
@@ -2005,7 +1990,7 @@ class v {
|
|
|
2005
1990
|
static cleanup() {
|
|
2006
1991
|
if (this._isInitialized)
|
|
2007
1992
|
try {
|
|
2008
|
-
this._avatarCore && (this._avatarCore.release(), this._avatarCore = null), this._appId = null, this._configuration = null, this._sessionToken = null, this._userId = null, this._dynamicSdkConfig = null, this._isInitialized = !1,
|
|
1993
|
+
this._avatarCore && (this._avatarCore.release(), this._avatarCore = null), this._appId = null, this._configuration = null, this._sessionToken = null, this._userId = null, this._dynamicSdkConfig = null, this._isInitialized = !1, Jn(), Yn(), h.log("[AvatarKit] Cleanup completed");
|
|
2009
1994
|
} catch (e) {
|
|
2010
1995
|
h.error("Failed to cleanup AvatarKit:", e instanceof Error ? e.message : String(e));
|
|
2011
1996
|
}
|
|
@@ -2015,7 +2000,7 @@ class v {
|
|
|
2015
2000
|
*/
|
|
2016
2001
|
static async _fetchSdkConfig() {
|
|
2017
2002
|
try {
|
|
2018
|
-
this._dynamicSdkConfig = await
|
|
2003
|
+
this._dynamicSdkConfig = await Zn(this._version);
|
|
2019
2004
|
} catch (e) {
|
|
2020
2005
|
const t = e instanceof Error ? e.message : String(e);
|
|
2021
2006
|
h.warn("Failed to fetch SDK config from remote, using defaults:", t), this.logEvent("sdk_config", "warning", {
|
|
@@ -2032,15 +2017,15 @@ class v {
|
|
|
2032
2017
|
if (!this._configuration)
|
|
2033
2018
|
throw new Error("AvatarKit not initialized");
|
|
2034
2019
|
const t = {
|
|
2035
|
-
[
|
|
2020
|
+
[ie.cn]: {
|
|
2036
2021
|
sdkApiBaseUrl: "https://api.spatialwalk.top",
|
|
2037
2022
|
driveningressWsUrl: "wss://api.spatialwalk.top/v1/driveningress/websocket"
|
|
2038
2023
|
},
|
|
2039
|
-
[
|
|
2024
|
+
[ie.us]: {
|
|
2040
2025
|
sdkApiBaseUrl: "https://api.spatialwalk.cloud",
|
|
2041
2026
|
driveningressWsUrl: "wss://api.spatialwalk.cloud/v1/driveningress/websocket"
|
|
2042
2027
|
},
|
|
2043
|
-
[
|
|
2028
|
+
[ie.test]: {
|
|
2044
2029
|
sdkApiBaseUrl: "https://api-test.spatialwalk.top",
|
|
2045
2030
|
driveningressWsUrl: "wss://api-test.spatialwalk.top/v1/driveningress/websocket"
|
|
2046
2031
|
}
|
|
@@ -2069,13 +2054,13 @@ class v {
|
|
|
2069
2054
|
h[i](`[Telemetry] ${e}`, a);
|
|
2070
2055
|
}
|
|
2071
2056
|
}
|
|
2072
|
-
d(
|
|
2057
|
+
d(y, "_isInitialized", !1), d(y, "_appId", null), d(y, "_configuration", null), d(y, "_sessionToken", null), d(y, "_userId", null), d(y, "_version", "1.0.0-beta.19"), d(y, "_avatarCore", null), d(y, "_dynamicSdkConfig", null), d(y, "_logLevels", {
|
|
2073
2058
|
debug: "log",
|
|
2074
2059
|
info: "log",
|
|
2075
2060
|
warning: "warn",
|
|
2076
2061
|
error: "error"
|
|
2077
2062
|
});
|
|
2078
|
-
const
|
|
2063
|
+
const we = class we {
|
|
2079
2064
|
constructor() {
|
|
2080
2065
|
d(this, "audio", null);
|
|
2081
2066
|
d(this, "streamingPlayer", null);
|
|
@@ -2089,10 +2074,10 @@ const Pe = class Pe {
|
|
|
2089
2074
|
* 必须在用户交互事件(如 click)中调用
|
|
2090
2075
|
*/
|
|
2091
2076
|
static async unlockAudioContext() {
|
|
2092
|
-
if (!
|
|
2077
|
+
if (!we.audioUnlocked)
|
|
2093
2078
|
try {
|
|
2094
2079
|
const e = new Audio();
|
|
2095
|
-
e.src = "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA", e.volume = 0, await e.play(), e.pause(), e.currentTime = 0,
|
|
2080
|
+
e.src = "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA", e.volume = 0, await e.play(), e.pause(), e.currentTime = 0, we.audioUnlocked = !0, h.log("✅ Audio context unlocked for Safari");
|
|
2096
2081
|
} catch (e) {
|
|
2097
2082
|
h.warn("⚠️ Failed to unlock audio context:", e);
|
|
2098
2083
|
}
|
|
@@ -2138,7 +2123,7 @@ const Pe = class Pe {
|
|
|
2138
2123
|
async createAndInitializeStreamingPlayer() {
|
|
2139
2124
|
if (this.streamingPlayer)
|
|
2140
2125
|
return;
|
|
2141
|
-
const { StreamingAudioPlayer: e } = await import("./StreamingAudioPlayer-
|
|
2126
|
+
const { StreamingAudioPlayer: e } = await import("./StreamingAudioPlayer-Cw8IygPS.js");
|
|
2142
2127
|
this.streamingPlayer = new e({
|
|
2143
2128
|
sampleRate: I.audio.sampleRate,
|
|
2144
2129
|
channelCount: 1,
|
|
@@ -2148,7 +2133,7 @@ const Pe = class Pe {
|
|
|
2148
2133
|
await this.streamingPlayer.initialize();
|
|
2149
2134
|
} catch (t) {
|
|
2150
2135
|
const n = t instanceof Error ? t.message : String(t);
|
|
2151
|
-
throw h.error("[AnimationPlayer] Failed to initialize streaming player:", n),
|
|
2136
|
+
throw h.error("[AnimationPlayer] Failed to initialize streaming player:", n), y.logEvent("character_player", "error", {
|
|
2152
2137
|
event: "streaming_player_initialize_failed",
|
|
2153
2138
|
reason: n
|
|
2154
2139
|
}), t;
|
|
@@ -2227,8 +2212,8 @@ const Pe = class Pe {
|
|
|
2227
2212
|
this.stop(), this.audio && (this.audio.src = "", this.audio = null), this.streamingPlayer && (this.streamingPlayer.dispose(), this.streamingPlayer = null), this.onEndedCallback = void 0;
|
|
2228
2213
|
}
|
|
2229
2214
|
};
|
|
2230
|
-
d(
|
|
2231
|
-
let
|
|
2215
|
+
d(we, "audioUnlocked", !1);
|
|
2216
|
+
let ae = we, ta = (r) => crypto.getRandomValues(new Uint8Array(r)), ra = (r, e, t) => {
|
|
2232
2217
|
let n = (2 << Math.log2(r.length - 1)) - 1, a = -~(1.6 * n * e / r.length);
|
|
2233
2218
|
return (i = e) => {
|
|
2234
2219
|
let s = "";
|
|
@@ -2240,7 +2225,7 @@ let le = Pe, ta = (r) => crypto.getRandomValues(new Uint8Array(r)), ra = (r, e,
|
|
|
2240
2225
|
};
|
|
2241
2226
|
}, na = (r, e = 21) => ra(r, e | 0, ta);
|
|
2242
2227
|
const aa = na("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", 12);
|
|
2243
|
-
function
|
|
2228
|
+
function er() {
|
|
2244
2229
|
const r = /* @__PURE__ */ new Date(), e = r.getUTCFullYear(), t = String(r.getUTCMonth() + 1).padStart(2, "0"), n = String(r.getUTCDate()).padStart(2, "0"), a = String(r.getUTCHours()).padStart(2, "0"), i = String(r.getUTCMinutes()).padStart(2, "0"), s = String(r.getUTCSeconds()).padStart(2, "0"), o = `${e}${t}${n}${a}${i}${s}`, l = aa();
|
|
2245
2230
|
return `${o}_${l}`;
|
|
2246
2231
|
}
|
|
@@ -2261,7 +2246,7 @@ function ia() {
|
|
|
2261
2246
|
}
|
|
2262
2247
|
throw new Error("invalid varint");
|
|
2263
2248
|
}
|
|
2264
|
-
function
|
|
2249
|
+
function Be(r, e, t) {
|
|
2265
2250
|
for (let i = 0; i < 28; i = i + 7) {
|
|
2266
2251
|
const s = r >>> i, o = !(!(s >>> 7) && e == 0), l = (o ? s | 128 : s) & 255;
|
|
2267
2252
|
if (t.push(l), !o)
|
|
@@ -2277,47 +2262,47 @@ function ze(r, e, t) {
|
|
|
2277
2262
|
t.push(e >>> 31 & 1);
|
|
2278
2263
|
}
|
|
2279
2264
|
}
|
|
2280
|
-
const
|
|
2281
|
-
function
|
|
2265
|
+
const Pe = 4294967296;
|
|
2266
|
+
function bt(r) {
|
|
2282
2267
|
const e = r[0] === "-";
|
|
2283
2268
|
e && (r = r.slice(1));
|
|
2284
2269
|
const t = 1e6;
|
|
2285
2270
|
let n = 0, a = 0;
|
|
2286
2271
|
function i(s, o) {
|
|
2287
2272
|
const l = Number(r.slice(s, o));
|
|
2288
|
-
a *= t, n = n * t + l, n >=
|
|
2273
|
+
a *= t, n = n * t + l, n >= Pe && (a = a + (n / Pe | 0), n = n % Pe);
|
|
2289
2274
|
}
|
|
2290
|
-
return i(-24, -18), i(-18, -12), i(-12, -6), i(-6), e ?
|
|
2275
|
+
return i(-24, -18), i(-18, -12), i(-12, -6), i(-6), e ? rr(n, a) : je(n, a);
|
|
2291
2276
|
}
|
|
2292
2277
|
function sa(r, e) {
|
|
2293
|
-
let t =
|
|
2278
|
+
let t = je(r, e);
|
|
2294
2279
|
const n = t.hi & 2147483648;
|
|
2295
|
-
n && (t =
|
|
2296
|
-
const a =
|
|
2280
|
+
n && (t = rr(t.lo, t.hi));
|
|
2281
|
+
const a = tr(t.lo, t.hi);
|
|
2297
2282
|
return n ? "-" + a : a;
|
|
2298
2283
|
}
|
|
2299
|
-
function
|
|
2284
|
+
function tr(r, e) {
|
|
2300
2285
|
if ({ lo: r, hi: e } = oa(r, e), e <= 2097151)
|
|
2301
|
-
return String(
|
|
2286
|
+
return String(Pe * e + r);
|
|
2302
2287
|
const t = r & 16777215, n = (r >>> 24 | e << 8) & 16777215, a = e >> 16 & 65535;
|
|
2303
2288
|
let i = t + n * 6777216 + a * 6710656, s = n + a * 8147497, o = a * 2;
|
|
2304
2289
|
const l = 1e7;
|
|
2305
|
-
return i >= l && (s += Math.floor(i / l), i %= l), s >= l && (o += Math.floor(s / l), s %= l), o.toString() +
|
|
2290
|
+
return i >= l && (s += Math.floor(i / l), i %= l), s >= l && (o += Math.floor(s / l), s %= l), o.toString() + Ct(s) + Ct(i);
|
|
2306
2291
|
}
|
|
2307
2292
|
function oa(r, e) {
|
|
2308
2293
|
return { lo: r >>> 0, hi: e >>> 0 };
|
|
2309
2294
|
}
|
|
2310
|
-
function
|
|
2295
|
+
function je(r, e) {
|
|
2311
2296
|
return { lo: r | 0, hi: e | 0 };
|
|
2312
2297
|
}
|
|
2313
|
-
function
|
|
2314
|
-
return e = ~e, r ? r = ~r + 1 : e += 1,
|
|
2298
|
+
function rr(r, e) {
|
|
2299
|
+
return e = ~e, r ? r = ~r + 1 : e += 1, je(r, e);
|
|
2315
2300
|
}
|
|
2316
|
-
const
|
|
2301
|
+
const Ct = (r) => {
|
|
2317
2302
|
const e = String(r);
|
|
2318
2303
|
return "0000000".slice(e.length) + e;
|
|
2319
2304
|
};
|
|
2320
|
-
function
|
|
2305
|
+
function _t(r, e) {
|
|
2321
2306
|
if (r >= 0) {
|
|
2322
2307
|
for (; r > 127; )
|
|
2323
2308
|
e.push(r & 127 | 128), r = r >>> 7;
|
|
@@ -2345,7 +2330,7 @@ function la() {
|
|
|
2345
2330
|
throw new Error("invalid varint");
|
|
2346
2331
|
return this.assertBounds(), e >>> 0;
|
|
2347
2332
|
}
|
|
2348
|
-
const
|
|
2333
|
+
const H = /* @__PURE__ */ ca();
|
|
2349
2334
|
function ca() {
|
|
2350
2335
|
const r = new DataView(new ArrayBuffer(8));
|
|
2351
2336
|
if (typeof BigInt == "function" && typeof r.getBigInt64 == "function" && typeof r.getBigUint64 == "function" && typeof r.setBigInt64 == "function" && typeof r.setBigUint64 == "function" && (!!globalThis.Deno || typeof process != "object" || typeof process.env != "object" || process.env.BUF_BIGINT_DISABLE !== "1")) {
|
|
@@ -2389,38 +2374,38 @@ function ca() {
|
|
|
2389
2374
|
zero: "0",
|
|
2390
2375
|
supported: !1,
|
|
2391
2376
|
parse(t) {
|
|
2392
|
-
return typeof t != "string" && (t = t.toString()),
|
|
2377
|
+
return typeof t != "string" && (t = t.toString()), Pt(t), t;
|
|
2393
2378
|
},
|
|
2394
2379
|
uParse(t) {
|
|
2395
|
-
return typeof t != "string" && (t = t.toString()),
|
|
2380
|
+
return typeof t != "string" && (t = t.toString()), Et(t), t;
|
|
2396
2381
|
},
|
|
2397
2382
|
enc(t) {
|
|
2398
|
-
return typeof t != "string" && (t = t.toString()),
|
|
2383
|
+
return typeof t != "string" && (t = t.toString()), Pt(t), bt(t);
|
|
2399
2384
|
},
|
|
2400
2385
|
uEnc(t) {
|
|
2401
|
-
return typeof t != "string" && (t = t.toString()),
|
|
2386
|
+
return typeof t != "string" && (t = t.toString()), Et(t), bt(t);
|
|
2402
2387
|
},
|
|
2403
2388
|
dec(t, n) {
|
|
2404
2389
|
return sa(t, n);
|
|
2405
2390
|
},
|
|
2406
2391
|
uDec(t, n) {
|
|
2407
|
-
return
|
|
2392
|
+
return tr(t, n);
|
|
2408
2393
|
}
|
|
2409
2394
|
};
|
|
2410
2395
|
}
|
|
2411
|
-
function
|
|
2396
|
+
function Pt(r) {
|
|
2412
2397
|
if (!/^-?[0-9]+$/.test(r))
|
|
2413
2398
|
throw new Error("invalid int64: " + r);
|
|
2414
2399
|
}
|
|
2415
|
-
function
|
|
2400
|
+
function Et(r) {
|
|
2416
2401
|
if (!/^[0-9]+$/.test(r))
|
|
2417
2402
|
throw new Error("invalid uint64: " + r);
|
|
2418
2403
|
}
|
|
2419
|
-
const
|
|
2420
|
-
function
|
|
2421
|
-
if (globalThis[
|
|
2404
|
+
const De = Symbol.for("@bufbuild/protobuf/text-encoding");
|
|
2405
|
+
function nr() {
|
|
2406
|
+
if (globalThis[De] == null) {
|
|
2422
2407
|
const r = new globalThis.TextEncoder(), e = new globalThis.TextDecoder();
|
|
2423
|
-
globalThis[
|
|
2408
|
+
globalThis[De] = {
|
|
2424
2409
|
encodeUtf8(t) {
|
|
2425
2410
|
return r.encode(t);
|
|
2426
2411
|
},
|
|
@@ -2436,15 +2421,15 @@ function ar() {
|
|
|
2436
2421
|
}
|
|
2437
2422
|
};
|
|
2438
2423
|
}
|
|
2439
|
-
return globalThis[
|
|
2424
|
+
return globalThis[De];
|
|
2440
2425
|
}
|
|
2441
|
-
var
|
|
2426
|
+
var ee;
|
|
2442
2427
|
(function(r) {
|
|
2443
2428
|
r[r.Varint = 0] = "Varint", r[r.Bit64 = 1] = "Bit64", r[r.LengthDelimited = 2] = "LengthDelimited", r[r.StartGroup = 3] = "StartGroup", r[r.EndGroup = 4] = "EndGroup", r[r.Bit32 = 5] = "Bit32";
|
|
2444
|
-
})(
|
|
2429
|
+
})(ee || (ee = {}));
|
|
2445
2430
|
const da = 34028234663852886e22, ua = -34028234663852886e22, ha = 4294967295, fa = 2147483647, ma = -2147483648;
|
|
2446
|
-
class
|
|
2447
|
-
constructor(e =
|
|
2431
|
+
class oe {
|
|
2432
|
+
constructor(e = nr().encodeUtf8) {
|
|
2448
2433
|
this.encodeUtf8 = e, this.stack = [], this.chunks = [], this.buf = [];
|
|
2449
2434
|
}
|
|
2450
2435
|
/**
|
|
@@ -2499,7 +2484,7 @@ class ue {
|
|
|
2499
2484
|
* Write a `uint32` value, an unsigned 32 bit varint.
|
|
2500
2485
|
*/
|
|
2501
2486
|
uint32(e) {
|
|
2502
|
-
for (
|
|
2487
|
+
for (It(e); e > 127; )
|
|
2503
2488
|
this.buf.push(e & 127 | 128), e = e >>> 7;
|
|
2504
2489
|
return this.buf.push(e), this;
|
|
2505
2490
|
}
|
|
@@ -2507,7 +2492,7 @@ class ue {
|
|
|
2507
2492
|
* Write a `int32` value, a signed 32 bit varint.
|
|
2508
2493
|
*/
|
|
2509
2494
|
int32(e) {
|
|
2510
|
-
return
|
|
2495
|
+
return Oe(e), _t(e, this.buf), this;
|
|
2511
2496
|
}
|
|
2512
2497
|
/**
|
|
2513
2498
|
* Write a `bool` value, a variant.
|
|
@@ -2547,7 +2532,7 @@ class ue {
|
|
|
2547
2532
|
* Write a `fixed32` value, an unsigned, fixed-length 32-bit integer.
|
|
2548
2533
|
*/
|
|
2549
2534
|
fixed32(e) {
|
|
2550
|
-
|
|
2535
|
+
It(e);
|
|
2551
2536
|
let t = new Uint8Array(4);
|
|
2552
2537
|
return new DataView(t.buffer).setUint32(0, e, !0), this.raw(t);
|
|
2553
2538
|
}
|
|
@@ -2555,7 +2540,7 @@ class ue {
|
|
|
2555
2540
|
* Write a `sfixed32` value, a signed, fixed-length 32-bit integer.
|
|
2556
2541
|
*/
|
|
2557
2542
|
sfixed32(e) {
|
|
2558
|
-
|
|
2543
|
+
Oe(e);
|
|
2559
2544
|
let t = new Uint8Array(4);
|
|
2560
2545
|
return new DataView(t.buffer).setInt32(0, e, !0), this.raw(t);
|
|
2561
2546
|
}
|
|
@@ -2563,46 +2548,46 @@ class ue {
|
|
|
2563
2548
|
* Write a `sint32` value, a signed, zigzag-encoded 32-bit varint.
|
|
2564
2549
|
*/
|
|
2565
2550
|
sint32(e) {
|
|
2566
|
-
return
|
|
2551
|
+
return Oe(e), e = (e << 1 ^ e >> 31) >>> 0, _t(e, this.buf), this;
|
|
2567
2552
|
}
|
|
2568
2553
|
/**
|
|
2569
2554
|
* Write a `fixed64` value, a signed, fixed-length 64-bit integer.
|
|
2570
2555
|
*/
|
|
2571
2556
|
sfixed64(e) {
|
|
2572
|
-
let t = new Uint8Array(8), n = new DataView(t.buffer), a =
|
|
2557
|
+
let t = new Uint8Array(8), n = new DataView(t.buffer), a = H.enc(e);
|
|
2573
2558
|
return n.setInt32(0, a.lo, !0), n.setInt32(4, a.hi, !0), this.raw(t);
|
|
2574
2559
|
}
|
|
2575
2560
|
/**
|
|
2576
2561
|
* Write a `fixed64` value, an unsigned, fixed-length 64 bit integer.
|
|
2577
2562
|
*/
|
|
2578
2563
|
fixed64(e) {
|
|
2579
|
-
let t = new Uint8Array(8), n = new DataView(t.buffer), a =
|
|
2564
|
+
let t = new Uint8Array(8), n = new DataView(t.buffer), a = H.uEnc(e);
|
|
2580
2565
|
return n.setInt32(0, a.lo, !0), n.setInt32(4, a.hi, !0), this.raw(t);
|
|
2581
2566
|
}
|
|
2582
2567
|
/**
|
|
2583
2568
|
* Write a `int64` value, a signed 64-bit varint.
|
|
2584
2569
|
*/
|
|
2585
2570
|
int64(e) {
|
|
2586
|
-
let t =
|
|
2587
|
-
return
|
|
2571
|
+
let t = H.enc(e);
|
|
2572
|
+
return Be(t.lo, t.hi, this.buf), this;
|
|
2588
2573
|
}
|
|
2589
2574
|
/**
|
|
2590
2575
|
* Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint.
|
|
2591
2576
|
*/
|
|
2592
2577
|
sint64(e) {
|
|
2593
|
-
const t =
|
|
2594
|
-
return
|
|
2578
|
+
const t = H.enc(e), n = t.hi >> 31, a = t.lo << 1 ^ n, i = (t.hi << 1 | t.lo >>> 31) ^ n;
|
|
2579
|
+
return Be(a, i, this.buf), this;
|
|
2595
2580
|
}
|
|
2596
2581
|
/**
|
|
2597
2582
|
* Write a `uint64` value, an unsigned 64-bit varint.
|
|
2598
2583
|
*/
|
|
2599
2584
|
uint64(e) {
|
|
2600
|
-
const t =
|
|
2601
|
-
return
|
|
2585
|
+
const t = H.uEnc(e);
|
|
2586
|
+
return Be(t.lo, t.hi, this.buf), this;
|
|
2602
2587
|
}
|
|
2603
2588
|
}
|
|
2604
2589
|
class N {
|
|
2605
|
-
constructor(e, t =
|
|
2590
|
+
constructor(e, t = nr().decodeUtf8) {
|
|
2606
2591
|
this.decodeUtf8 = t, this.varint64 = ia, this.uint32 = la, this.buf = e, this.len = e.length, this.pos = 0, this.view = new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
2607
2592
|
}
|
|
2608
2593
|
/**
|
|
@@ -2623,23 +2608,23 @@ class N {
|
|
|
2623
2608
|
skip(e, t) {
|
|
2624
2609
|
let n = this.pos;
|
|
2625
2610
|
switch (e) {
|
|
2626
|
-
case
|
|
2611
|
+
case ee.Varint:
|
|
2627
2612
|
for (; this.buf[this.pos++] & 128; )
|
|
2628
2613
|
;
|
|
2629
2614
|
break;
|
|
2630
|
-
case
|
|
2615
|
+
case ee.Bit64:
|
|
2631
2616
|
this.pos += 4;
|
|
2632
|
-
case
|
|
2617
|
+
case ee.Bit32:
|
|
2633
2618
|
this.pos += 4;
|
|
2634
2619
|
break;
|
|
2635
|
-
case
|
|
2620
|
+
case ee.LengthDelimited:
|
|
2636
2621
|
let a = this.uint32();
|
|
2637
2622
|
this.pos += a;
|
|
2638
2623
|
break;
|
|
2639
|
-
case
|
|
2624
|
+
case ee.StartGroup:
|
|
2640
2625
|
for (; ; ) {
|
|
2641
2626
|
const [i, s] = this.tag();
|
|
2642
|
-
if (s ===
|
|
2627
|
+
if (s === ee.EndGroup) {
|
|
2643
2628
|
if (t !== void 0 && i !== t)
|
|
2644
2629
|
throw new Error("invalid end group tag");
|
|
2645
2630
|
break;
|
|
@@ -2676,20 +2661,20 @@ class N {
|
|
|
2676
2661
|
* Read a `int64` field, a signed 64-bit varint.
|
|
2677
2662
|
*/
|
|
2678
2663
|
int64() {
|
|
2679
|
-
return
|
|
2664
|
+
return H.dec(...this.varint64());
|
|
2680
2665
|
}
|
|
2681
2666
|
/**
|
|
2682
2667
|
* Read a `uint64` field, an unsigned 64-bit varint.
|
|
2683
2668
|
*/
|
|
2684
2669
|
uint64() {
|
|
2685
|
-
return
|
|
2670
|
+
return H.uDec(...this.varint64());
|
|
2686
2671
|
}
|
|
2687
2672
|
/**
|
|
2688
2673
|
* Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint.
|
|
2689
2674
|
*/
|
|
2690
2675
|
sint64() {
|
|
2691
2676
|
let [e, t] = this.varint64(), n = -(e & 1);
|
|
2692
|
-
return e = (e >>> 1 | (t & 1) << 31) ^ n, t = t >>> 1 ^ n,
|
|
2677
|
+
return e = (e >>> 1 | (t & 1) << 31) ^ n, t = t >>> 1 ^ n, H.dec(e, t);
|
|
2693
2678
|
}
|
|
2694
2679
|
/**
|
|
2695
2680
|
* Read a `bool` field, a variant.
|
|
@@ -2714,13 +2699,13 @@ class N {
|
|
|
2714
2699
|
* Read a `fixed64` field, an unsigned, fixed-length 64 bit integer.
|
|
2715
2700
|
*/
|
|
2716
2701
|
fixed64() {
|
|
2717
|
-
return
|
|
2702
|
+
return H.uDec(this.sfixed32(), this.sfixed32());
|
|
2718
2703
|
}
|
|
2719
2704
|
/**
|
|
2720
2705
|
* Read a `fixed64` field, a signed, fixed-length 64-bit integer.
|
|
2721
2706
|
*/
|
|
2722
2707
|
sfixed64() {
|
|
2723
|
-
return
|
|
2708
|
+
return H.dec(this.sfixed32(), this.sfixed32());
|
|
2724
2709
|
}
|
|
2725
2710
|
/**
|
|
2726
2711
|
* Read a `float` field, 32-bit floating point number.
|
|
@@ -2748,7 +2733,7 @@ class N {
|
|
|
2748
2733
|
return this.decodeUtf8(this.bytes());
|
|
2749
2734
|
}
|
|
2750
2735
|
}
|
|
2751
|
-
function
|
|
2736
|
+
function Oe(r) {
|
|
2752
2737
|
if (typeof r == "string")
|
|
2753
2738
|
r = Number(r);
|
|
2754
2739
|
else if (typeof r != "number")
|
|
@@ -2756,7 +2741,7 @@ function $e(r) {
|
|
|
2756
2741
|
if (!Number.isInteger(r) || r > fa || r < ma)
|
|
2757
2742
|
throw new Error("invalid int32: " + r);
|
|
2758
2743
|
}
|
|
2759
|
-
function
|
|
2744
|
+
function It(r) {
|
|
2760
2745
|
if (typeof r == "string")
|
|
2761
2746
|
r = Number(r);
|
|
2762
2747
|
else if (typeof r != "number")
|
|
@@ -2774,7 +2759,7 @@ function pa(r) {
|
|
|
2774
2759
|
if (Number.isFinite(r) && (r > da || r < ua))
|
|
2775
2760
|
throw new Error("invalid float32: " + r);
|
|
2776
2761
|
}
|
|
2777
|
-
var
|
|
2762
|
+
var Se = /* @__PURE__ */ ((r) => (r[r.MESSAGE_UNSPECIFIED = 0] = "MESSAGE_UNSPECIFIED", r[r.MESSAGE_ERROR = 2] = "MESSAGE_ERROR", r[r.MESSAGE_SERVER_RESPONSE_ANIMATION = 1004] = "MESSAGE_SERVER_RESPONSE_ANIMATION", r[r.MESSAGE_CLIENT_AUDIO_INPUT = 2003] = "MESSAGE_CLIENT_AUDIO_INPUT", r[r.UNRECOGNIZED = -1] = "UNRECOGNIZED", r))(Se || {});
|
|
2778
2763
|
function ga(r) {
|
|
2779
2764
|
switch (r) {
|
|
2780
2765
|
case 0:
|
|
@@ -2795,7 +2780,7 @@ function ga(r) {
|
|
|
2795
2780
|
return -1;
|
|
2796
2781
|
}
|
|
2797
2782
|
}
|
|
2798
|
-
function
|
|
2783
|
+
function va(r) {
|
|
2799
2784
|
switch (r) {
|
|
2800
2785
|
case 0:
|
|
2801
2786
|
return "MESSAGE_UNSPECIFIED";
|
|
@@ -2810,17 +2795,17 @@ function ya(r) {
|
|
|
2810
2795
|
return "UNRECOGNIZED";
|
|
2811
2796
|
}
|
|
2812
2797
|
}
|
|
2813
|
-
function
|
|
2798
|
+
function kt() {
|
|
2814
2799
|
return { reqId: "", audio: new Uint8Array(0), end: !1 };
|
|
2815
2800
|
}
|
|
2816
|
-
const
|
|
2817
|
-
encode(r, e = new
|
|
2801
|
+
const ce = {
|
|
2802
|
+
encode(r, e = new oe()) {
|
|
2818
2803
|
return r.reqId !== "" && e.uint32(10).string(r.reqId), r.audio.length !== 0 && e.uint32(18).bytes(r.audio), r.end !== !1 && e.uint32(24).bool(r.end), e;
|
|
2819
2804
|
},
|
|
2820
2805
|
decode(r, e) {
|
|
2821
2806
|
const t = r instanceof N ? r : new N(r);
|
|
2822
2807
|
let n = e === void 0 ? t.len : t.pos + e;
|
|
2823
|
-
const a =
|
|
2808
|
+
const a = kt();
|
|
2824
2809
|
for (; t.pos < n; ) {
|
|
2825
2810
|
const i = t.uint32();
|
|
2826
2811
|
switch (i >>> 3) {
|
|
@@ -2851,9 +2836,9 @@ const me = {
|
|
|
2851
2836
|
},
|
|
2852
2837
|
fromJSON(r) {
|
|
2853
2838
|
return {
|
|
2854
|
-
reqId:
|
|
2855
|
-
audio:
|
|
2856
|
-
end:
|
|
2839
|
+
reqId: U(r.reqId) ? globalThis.String(r.reqId) : "",
|
|
2840
|
+
audio: U(r.audio) ? ya(r.audio) : new Uint8Array(0),
|
|
2841
|
+
end: U(r.end) ? globalThis.Boolean(r.end) : !1
|
|
2857
2842
|
};
|
|
2858
2843
|
},
|
|
2859
2844
|
toJSON(r) {
|
|
@@ -2861,18 +2846,18 @@ const me = {
|
|
|
2861
2846
|
return r.reqId !== "" && (e.reqId = r.reqId), r.audio.length !== 0 && (e.audio = wa(r.audio)), r.end !== !1 && (e.end = r.end), e;
|
|
2862
2847
|
},
|
|
2863
2848
|
create(r) {
|
|
2864
|
-
return
|
|
2849
|
+
return ce.fromPartial(r ?? {});
|
|
2865
2850
|
},
|
|
2866
2851
|
fromPartial(r) {
|
|
2867
|
-
const e =
|
|
2852
|
+
const e = kt();
|
|
2868
2853
|
return e.reqId = r.reqId ?? "", e.audio = r.audio ?? new Uint8Array(0), e.end = r.end ?? !1, e;
|
|
2869
2854
|
}
|
|
2870
2855
|
};
|
|
2871
|
-
function
|
|
2856
|
+
function xt() {
|
|
2872
2857
|
return { translation: [], rotation: [], neckPose: [], jawPose: [], eyePose: [], eyeLid: [], expression: [] };
|
|
2873
2858
|
}
|
|
2874
|
-
const
|
|
2875
|
-
encode(r, e = new
|
|
2859
|
+
const de = {
|
|
2860
|
+
encode(r, e = new oe()) {
|
|
2876
2861
|
e.uint32(18).fork();
|
|
2877
2862
|
for (const t of r.translation)
|
|
2878
2863
|
e.float(t);
|
|
@@ -2899,7 +2884,7 @@ const pe = {
|
|
|
2899
2884
|
decode(r, e) {
|
|
2900
2885
|
const t = r instanceof N ? r : new N(r);
|
|
2901
2886
|
let n = e === void 0 ? t.len : t.pos + e;
|
|
2902
|
-
const a =
|
|
2887
|
+
const a = xt();
|
|
2903
2888
|
for (; t.pos < n; ) {
|
|
2904
2889
|
const i = t.uint32();
|
|
2905
2890
|
switch (i >>> 3) {
|
|
@@ -3018,21 +3003,21 @@ const pe = {
|
|
|
3018
3003
|
return (t = r.translation) != null && t.length && (e.translation = r.translation), (n = r.rotation) != null && n.length && (e.rotation = r.rotation), (a = r.neckPose) != null && a.length && (e.neckPose = r.neckPose), (i = r.jawPose) != null && i.length && (e.jawPose = r.jawPose), (s = r.eyePose) != null && s.length && (e.eyePose = r.eyePose), (o = r.eyeLid) != null && o.length && (e.eyeLid = r.eyeLid), (l = r.expression) != null && l.length && (e.expression = r.expression), e;
|
|
3019
3004
|
},
|
|
3020
3005
|
create(r) {
|
|
3021
|
-
return
|
|
3006
|
+
return de.fromPartial(r ?? {});
|
|
3022
3007
|
},
|
|
3023
3008
|
fromPartial(r) {
|
|
3024
3009
|
var t, n, a, i, s, o, l;
|
|
3025
|
-
const e =
|
|
3010
|
+
const e = xt();
|
|
3026
3011
|
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 = ((a = r.neckPose) == null ? void 0 : a.map((p) => p)) || [], e.jawPose = ((i = r.jawPose) == null ? void 0 : i.map((p) => p)) || [], e.eyePose = ((s = r.eyePose) == null ? void 0 : s.map((p) => p)) || [], e.eyeLid = ((o = r.eyeLid) == null ? void 0 : o.map((p) => p)) || [], e.expression = ((l = r.expression) == null ? void 0 : l.map((p) => p)) || [], e;
|
|
3027
3012
|
}
|
|
3028
3013
|
};
|
|
3029
3014
|
function Ft() {
|
|
3030
3015
|
return { keyframes: [] };
|
|
3031
3016
|
}
|
|
3032
|
-
const
|
|
3033
|
-
encode(r, e = new
|
|
3017
|
+
const ue = {
|
|
3018
|
+
encode(r, e = new oe()) {
|
|
3034
3019
|
for (const t of r.keyframes)
|
|
3035
|
-
|
|
3020
|
+
de.encode(t, e.uint32(10).fork()).join();
|
|
3036
3021
|
return e;
|
|
3037
3022
|
},
|
|
3038
3023
|
decode(r, e) {
|
|
@@ -3045,7 +3030,7 @@ const ge = {
|
|
|
3045
3030
|
case 1: {
|
|
3046
3031
|
if (i !== 10)
|
|
3047
3032
|
break;
|
|
3048
|
-
a.keyframes.push(
|
|
3033
|
+
a.keyframes.push(de.decode(t, t.uint32()));
|
|
3049
3034
|
continue;
|
|
3050
3035
|
}
|
|
3051
3036
|
}
|
|
@@ -3057,34 +3042,34 @@ const ge = {
|
|
|
3057
3042
|
},
|
|
3058
3043
|
fromJSON(r) {
|
|
3059
3044
|
return {
|
|
3060
|
-
keyframes: globalThis.Array.isArray(r == null ? void 0 : r.keyframes) ? r.keyframes.map((e) =>
|
|
3045
|
+
keyframes: globalThis.Array.isArray(r == null ? void 0 : r.keyframes) ? r.keyframes.map((e) => de.fromJSON(e)) : []
|
|
3061
3046
|
};
|
|
3062
3047
|
},
|
|
3063
3048
|
toJSON(r) {
|
|
3064
3049
|
var t;
|
|
3065
3050
|
const e = {};
|
|
3066
|
-
return (t = r.keyframes) != null && t.length && (e.keyframes = r.keyframes.map((n) =>
|
|
3051
|
+
return (t = r.keyframes) != null && t.length && (e.keyframes = r.keyframes.map((n) => de.toJSON(n))), e;
|
|
3067
3052
|
},
|
|
3068
3053
|
create(r) {
|
|
3069
|
-
return
|
|
3054
|
+
return ue.fromPartial(r ?? {});
|
|
3070
3055
|
},
|
|
3071
3056
|
fromPartial(r) {
|
|
3072
3057
|
var t;
|
|
3073
3058
|
const e = Ft();
|
|
3074
|
-
return e.keyframes = ((t = r.keyframes) == null ? void 0 : t.map((n) =>
|
|
3059
|
+
return e.keyframes = ((t = r.keyframes) == null ? void 0 : t.map((n) => de.fromPartial(n))) || [], e;
|
|
3075
3060
|
}
|
|
3076
3061
|
};
|
|
3077
|
-
function
|
|
3062
|
+
function Mt() {
|
|
3078
3063
|
return { reqId: "", animation: void 0 };
|
|
3079
3064
|
}
|
|
3080
|
-
const
|
|
3081
|
-
encode(r, e = new
|
|
3082
|
-
return r.reqId !== "" && e.uint32(10).string(r.reqId), r.animation !== void 0 &&
|
|
3065
|
+
const he = {
|
|
3066
|
+
encode(r, e = new oe()) {
|
|
3067
|
+
return r.reqId !== "" && e.uint32(10).string(r.reqId), r.animation !== void 0 && ue.encode(r.animation, e.uint32(18).fork()).join(), e;
|
|
3083
3068
|
},
|
|
3084
3069
|
decode(r, e) {
|
|
3085
3070
|
const t = r instanceof N ? r : new N(r);
|
|
3086
3071
|
let n = e === void 0 ? t.len : t.pos + e;
|
|
3087
|
-
const a =
|
|
3072
|
+
const a = Mt();
|
|
3088
3073
|
for (; t.pos < n; ) {
|
|
3089
3074
|
const i = t.uint32();
|
|
3090
3075
|
switch (i >>> 3) {
|
|
@@ -3097,7 +3082,7 @@ const ye = {
|
|
|
3097
3082
|
case 2: {
|
|
3098
3083
|
if (i !== 18)
|
|
3099
3084
|
break;
|
|
3100
|
-
a.animation =
|
|
3085
|
+
a.animation = ue.decode(t, t.uint32());
|
|
3101
3086
|
continue;
|
|
3102
3087
|
}
|
|
3103
3088
|
}
|
|
@@ -3109,27 +3094,27 @@ const ye = {
|
|
|
3109
3094
|
},
|
|
3110
3095
|
fromJSON(r) {
|
|
3111
3096
|
return {
|
|
3112
|
-
reqId:
|
|
3113
|
-
animation:
|
|
3097
|
+
reqId: U(r.reqId) ? globalThis.String(r.reqId) : "",
|
|
3098
|
+
animation: U(r.animation) ? ue.fromJSON(r.animation) : void 0
|
|
3114
3099
|
};
|
|
3115
3100
|
},
|
|
3116
3101
|
toJSON(r) {
|
|
3117
3102
|
const e = {};
|
|
3118
|
-
return r.reqId !== "" && (e.reqId = r.reqId), r.animation !== void 0 && (e.animation =
|
|
3103
|
+
return r.reqId !== "" && (e.reqId = r.reqId), r.animation !== void 0 && (e.animation = ue.toJSON(r.animation)), e;
|
|
3119
3104
|
},
|
|
3120
3105
|
create(r) {
|
|
3121
|
-
return
|
|
3106
|
+
return he.fromPartial(r ?? {});
|
|
3122
3107
|
},
|
|
3123
3108
|
fromPartial(r) {
|
|
3124
|
-
const e =
|
|
3125
|
-
return e.reqId = r.reqId ?? "", e.animation = r.animation !== void 0 && r.animation !== null ?
|
|
3109
|
+
const e = Mt();
|
|
3110
|
+
return e.reqId = r.reqId ?? "", e.animation = r.animation !== void 0 && r.animation !== null ? ue.fromPartial(r.animation) : void 0, e;
|
|
3126
3111
|
}
|
|
3127
3112
|
};
|
|
3128
3113
|
function Lt() {
|
|
3129
3114
|
return { reqId: "", code: 0, reason: "" };
|
|
3130
3115
|
}
|
|
3131
|
-
const
|
|
3132
|
-
encode(r, e = new
|
|
3116
|
+
const fe = {
|
|
3117
|
+
encode(r, e = new oe()) {
|
|
3133
3118
|
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;
|
|
3134
3119
|
},
|
|
3135
3120
|
decode(r, e) {
|
|
@@ -3166,9 +3151,9 @@ const ve = {
|
|
|
3166
3151
|
},
|
|
3167
3152
|
fromJSON(r) {
|
|
3168
3153
|
return {
|
|
3169
|
-
reqId:
|
|
3170
|
-
code:
|
|
3171
|
-
reason:
|
|
3154
|
+
reqId: U(r.reqId) ? globalThis.String(r.reqId) : "",
|
|
3155
|
+
code: U(r.code) ? globalThis.Number(r.code) : 0,
|
|
3156
|
+
reason: U(r.reason) ? globalThis.String(r.reason) : ""
|
|
3172
3157
|
};
|
|
3173
3158
|
},
|
|
3174
3159
|
toJSON(r) {
|
|
@@ -3176,24 +3161,24 @@ const ve = {
|
|
|
3176
3161
|
return r.reqId !== "" && (e.reqId = r.reqId), r.code !== 0 && (e.code = Math.round(r.code)), r.reason !== "" && (e.reason = r.reason), e;
|
|
3177
3162
|
},
|
|
3178
3163
|
create(r) {
|
|
3179
|
-
return
|
|
3164
|
+
return fe.fromPartial(r ?? {});
|
|
3180
3165
|
},
|
|
3181
3166
|
fromPartial(r) {
|
|
3182
3167
|
const e = Lt();
|
|
3183
3168
|
return e.reqId = r.reqId ?? "", e.code = r.code ?? 0, e.reason = r.reason ?? "", e;
|
|
3184
3169
|
}
|
|
3185
3170
|
};
|
|
3186
|
-
function
|
|
3171
|
+
function Rt() {
|
|
3187
3172
|
return { type: 0, error: void 0, serverResponseAnimation: void 0, clientAudioInput: void 0 };
|
|
3188
3173
|
}
|
|
3189
|
-
const
|
|
3190
|
-
encode(r, e = new
|
|
3191
|
-
return r.type !== 0 && e.uint32(8).int32(r.type), r.error !== void 0 &&
|
|
3174
|
+
const We = {
|
|
3175
|
+
encode(r, e = new oe()) {
|
|
3176
|
+
return r.type !== 0 && e.uint32(8).int32(r.type), r.error !== void 0 && fe.encode(r.error, e.uint32(18).fork()).join(), r.serverResponseAnimation !== void 0 && he.encode(r.serverResponseAnimation, e.uint32(26).fork()).join(), r.clientAudioInput !== void 0 && ce.encode(r.clientAudioInput, e.uint32(34).fork()).join(), e;
|
|
3192
3177
|
},
|
|
3193
3178
|
decode(r, e) {
|
|
3194
3179
|
const t = r instanceof N ? r : new N(r);
|
|
3195
3180
|
let n = e === void 0 ? t.len : t.pos + e;
|
|
3196
|
-
const a =
|
|
3181
|
+
const a = Rt();
|
|
3197
3182
|
for (; t.pos < n; ) {
|
|
3198
3183
|
const i = t.uint32();
|
|
3199
3184
|
switch (i >>> 3) {
|
|
@@ -3206,19 +3191,19 @@ const Xe = {
|
|
|
3206
3191
|
case 2: {
|
|
3207
3192
|
if (i !== 18)
|
|
3208
3193
|
break;
|
|
3209
|
-
a.error =
|
|
3194
|
+
a.error = fe.decode(t, t.uint32());
|
|
3210
3195
|
continue;
|
|
3211
3196
|
}
|
|
3212
3197
|
case 3: {
|
|
3213
3198
|
if (i !== 26)
|
|
3214
3199
|
break;
|
|
3215
|
-
a.serverResponseAnimation =
|
|
3200
|
+
a.serverResponseAnimation = he.decode(t, t.uint32());
|
|
3216
3201
|
continue;
|
|
3217
3202
|
}
|
|
3218
3203
|
case 4: {
|
|
3219
3204
|
if (i !== 34)
|
|
3220
3205
|
break;
|
|
3221
|
-
a.clientAudioInput =
|
|
3206
|
+
a.clientAudioInput = ce.decode(t, t.uint32());
|
|
3222
3207
|
continue;
|
|
3223
3208
|
}
|
|
3224
3209
|
}
|
|
@@ -3230,25 +3215,25 @@ const Xe = {
|
|
|
3230
3215
|
},
|
|
3231
3216
|
fromJSON(r) {
|
|
3232
3217
|
return {
|
|
3233
|
-
type:
|
|
3234
|
-
error:
|
|
3235
|
-
serverResponseAnimation:
|
|
3236
|
-
clientAudioInput:
|
|
3218
|
+
type: U(r.type) ? ga(r.type) : 0,
|
|
3219
|
+
error: U(r.error) ? fe.fromJSON(r.error) : void 0,
|
|
3220
|
+
serverResponseAnimation: U(r.serverResponseAnimation) ? he.fromJSON(r.serverResponseAnimation) : void 0,
|
|
3221
|
+
clientAudioInput: U(r.clientAudioInput) ? ce.fromJSON(r.clientAudioInput) : void 0
|
|
3237
3222
|
};
|
|
3238
3223
|
},
|
|
3239
3224
|
toJSON(r) {
|
|
3240
3225
|
const e = {};
|
|
3241
|
-
return r.type !== 0 && (e.type =
|
|
3226
|
+
return r.type !== 0 && (e.type = va(r.type)), r.error !== void 0 && (e.error = fe.toJSON(r.error)), r.serverResponseAnimation !== void 0 && (e.serverResponseAnimation = he.toJSON(r.serverResponseAnimation)), r.clientAudioInput !== void 0 && (e.clientAudioInput = ce.toJSON(r.clientAudioInput)), e;
|
|
3242
3227
|
},
|
|
3243
3228
|
create(r) {
|
|
3244
|
-
return
|
|
3229
|
+
return We.fromPartial(r ?? {});
|
|
3245
3230
|
},
|
|
3246
3231
|
fromPartial(r) {
|
|
3247
|
-
const e =
|
|
3248
|
-
return e.type = r.type ?? 0, e.error = r.error !== void 0 && r.error !== null ?
|
|
3232
|
+
const e = Rt();
|
|
3233
|
+
return e.type = r.type ?? 0, e.error = r.error !== void 0 && r.error !== null ? fe.fromPartial(r.error) : void 0, e.serverResponseAnimation = r.serverResponseAnimation !== void 0 && r.serverResponseAnimation !== null ? he.fromPartial(r.serverResponseAnimation) : void 0, e.clientAudioInput = r.clientAudioInput !== void 0 && r.clientAudioInput !== null ? ce.fromPartial(r.clientAudioInput) : void 0, e;
|
|
3249
3234
|
}
|
|
3250
3235
|
};
|
|
3251
|
-
function
|
|
3236
|
+
function ya(r) {
|
|
3252
3237
|
const e = globalThis.atob(r), t = new Uint8Array(e.length);
|
|
3253
3238
|
for (let n = 0; n < e.length; ++n)
|
|
3254
3239
|
t[n] = e.charCodeAt(n);
|
|
@@ -3260,7 +3245,7 @@ function wa(r) {
|
|
|
3260
3245
|
e.push(globalThis.String.fromCharCode(t));
|
|
3261
3246
|
}), globalThis.btoa(e.join(""));
|
|
3262
3247
|
}
|
|
3263
|
-
function
|
|
3248
|
+
function U(r) {
|
|
3264
3249
|
return r != null;
|
|
3265
3250
|
}
|
|
3266
3251
|
class Aa {
|
|
@@ -3283,7 +3268,7 @@ class Aa {
|
|
|
3283
3268
|
e ? this.events.delete(e) : this.events.clear();
|
|
3284
3269
|
}
|
|
3285
3270
|
}
|
|
3286
|
-
class
|
|
3271
|
+
class Sa extends Aa {
|
|
3287
3272
|
constructor(t) {
|
|
3288
3273
|
super();
|
|
3289
3274
|
d(this, "wsUrl");
|
|
@@ -3314,7 +3299,7 @@ class ba extends Aa {
|
|
|
3314
3299
|
try {
|
|
3315
3300
|
this.isConnecting = !0, this.currentCharacterId = t;
|
|
3316
3301
|
const n = this.buildWebSocketUrl(t);
|
|
3317
|
-
h.log("[AnimationWebSocketClient] Connecting to:", n), await this.connectWebSocket(n), h.log("[AnimationWebSocketClient] Connected successfully"),
|
|
3302
|
+
h.log("[AnimationWebSocketClient] Connecting to:", n), await this.connectWebSocket(n), h.log("[AnimationWebSocketClient] Connected successfully"), y.logEvent("character_animation_service", "info", {
|
|
3318
3303
|
characterId: t,
|
|
3319
3304
|
event: "connect_success",
|
|
3320
3305
|
url: n
|
|
@@ -3322,7 +3307,7 @@ class ba extends Aa {
|
|
|
3322
3307
|
} catch (n) {
|
|
3323
3308
|
this.isConnecting = !1;
|
|
3324
3309
|
const a = n instanceof Error ? n.message : String(n);
|
|
3325
|
-
throw h.error("[AnimationWebSocketClient] Connection failed:", a),
|
|
3310
|
+
throw h.error("[AnimationWebSocketClient] Connection failed:", a), y.logEvent("character_animation_service", "error", {
|
|
3326
3311
|
characterId: t,
|
|
3327
3312
|
event: "connect_failed",
|
|
3328
3313
|
reason: a
|
|
@@ -3337,38 +3322,40 @@ class ba extends Aa {
|
|
|
3337
3322
|
}
|
|
3338
3323
|
/**
|
|
3339
3324
|
* 发送音频数据
|
|
3325
|
+
* @param conversationId - 会话ID(在 protobuf 协议中映射为 reqId 字段)
|
|
3340
3326
|
*/
|
|
3341
3327
|
sendAudioData(t, n, a) {
|
|
3342
3328
|
if (!this.ws || this.ws.readyState !== WebSocket.OPEN)
|
|
3343
3329
|
return h.error("[AnimationWebSocketClient] WebSocket not connected"), !1;
|
|
3344
3330
|
try {
|
|
3345
3331
|
const i = {
|
|
3346
|
-
type:
|
|
3332
|
+
type: Se.MESSAGE_CLIENT_AUDIO_INPUT,
|
|
3347
3333
|
clientAudioInput: {
|
|
3348
3334
|
reqId: t,
|
|
3335
|
+
// protobuf 协议中使用 reqId 字段名
|
|
3349
3336
|
audio: new Uint8Array(n),
|
|
3350
3337
|
end: a
|
|
3351
3338
|
}
|
|
3352
|
-
}, s = new
|
|
3353
|
-
|
|
3339
|
+
}, s = new oe();
|
|
3340
|
+
We.encode(i, s);
|
|
3354
3341
|
const o = s.finish();
|
|
3355
3342
|
return this.ws.send(o), !0;
|
|
3356
3343
|
} catch (i) {
|
|
3357
3344
|
const s = i instanceof Error ? i.message : String(i);
|
|
3358
|
-
return h.error("[AnimationWebSocketClient] Failed to send audio data:", s),
|
|
3345
|
+
return h.error("[AnimationWebSocketClient] Failed to send audio data:", s), y.logEvent("character_animation_service", "warning", {
|
|
3359
3346
|
characterId: this.currentCharacterId,
|
|
3360
3347
|
event: "send_audio_failed",
|
|
3361
|
-
|
|
3348
|
+
conversationId: t,
|
|
3362
3349
|
reason: s
|
|
3363
3350
|
}), this.emit("error", i), !1;
|
|
3364
3351
|
}
|
|
3365
3352
|
}
|
|
3366
3353
|
/**
|
|
3367
|
-
*
|
|
3368
|
-
*
|
|
3354
|
+
* 生成会话ID
|
|
3355
|
+
* 使用统一的会话ID生成规则:YYYYMMDDHHmmss_nanoid
|
|
3369
3356
|
*/
|
|
3370
|
-
|
|
3371
|
-
return
|
|
3357
|
+
generateConversationId() {
|
|
3358
|
+
return er();
|
|
3372
3359
|
}
|
|
3373
3360
|
/**
|
|
3374
3361
|
* 获取连接状态
|
|
@@ -3394,19 +3381,19 @@ class ba extends Aa {
|
|
|
3394
3381
|
this.isConnecting = !1, this.currentRetryCount = 0, this.isManuallyDisconnected = !1, this.emit("connected"), n();
|
|
3395
3382
|
}, this.ws.onmessage = (i) => {
|
|
3396
3383
|
i.data instanceof ArrayBuffer ? this.handleMessage(i.data) : i.data instanceof Blob ? i.data.arrayBuffer().then(this.handleMessage.bind(this)).catch((s) => {
|
|
3397
|
-
h.error("[AnimationWebSocketClient] Failed to convert Blob to ArrayBuffer:", s),
|
|
3384
|
+
h.error("[AnimationWebSocketClient] Failed to convert Blob to ArrayBuffer:", s), y.logEvent("character_animation_service", "error", {
|
|
3398
3385
|
characterId: this.currentCharacterId,
|
|
3399
3386
|
event: "decode_blob_failed",
|
|
3400
3387
|
reason: s instanceof Error ? s.message : String(s)
|
|
3401
3388
|
}), this.emit("error", s);
|
|
3402
3389
|
}) : h.warn("[AnimationWebSocketClient] Received non-binary data:", typeof i.data);
|
|
3403
3390
|
}, this.ws.onerror = (i) => {
|
|
3404
|
-
h.errorWithError("[AnimationWebSocketClient] WebSocket error:", i),
|
|
3391
|
+
h.errorWithError("[AnimationWebSocketClient] WebSocket error:", i), y.logEvent("character_animation_service", "error", {
|
|
3405
3392
|
characterId: this.currentCharacterId,
|
|
3406
3393
|
event: "websocket_error"
|
|
3407
3394
|
}), this.emit("error", new Error("WebSocket error")), !this.isManuallyDisconnected && this.currentRetryCount < this.reconnectAttempts && this.scheduleReconnect();
|
|
3408
3395
|
}, this.ws.onclose = (i) => {
|
|
3409
|
-
h.log("[AnimationWebSocketClient] WebSocket closed:", i.code, i.reason), this.emit("disconnected", i.reason || "Connection closed"), i.code === 1012 &&
|
|
3396
|
+
h.log("[AnimationWebSocketClient] WebSocket closed:", i.code, i.reason), this.emit("disconnected", i.reason || "Connection closed"), i.code === 1012 && y.logEvent("character_animation_service", "error", {
|
|
3410
3397
|
characterId: this.currentCharacterId,
|
|
3411
3398
|
event: "service_restart",
|
|
3412
3399
|
reason: i.reason || "service restart"
|
|
@@ -3419,9 +3406,9 @@ class ba extends Aa {
|
|
|
3419
3406
|
}
|
|
3420
3407
|
handleMessage(t) {
|
|
3421
3408
|
try {
|
|
3422
|
-
const n = new N(new Uint8Array(t)), a =
|
|
3409
|
+
const n = new N(new Uint8Array(t)), a = We.decode(n);
|
|
3423
3410
|
if (a.error) {
|
|
3424
|
-
h.error(`[AnimationWebSocketClient] Server error: reqId=${a.error.reqId}, code=${a.error.code}, reason=${a.error.reason}`),
|
|
3411
|
+
h.error(`[AnimationWebSocketClient] Server error: reqId=${a.error.reqId}, code=${a.error.code}, reason=${a.error.reason}`), y.logEvent("character_animation_service", "error", {
|
|
3425
3412
|
characterId: this.currentCharacterId,
|
|
3426
3413
|
event: "server_error",
|
|
3427
3414
|
reqId: a.error.reqId,
|
|
@@ -3430,8 +3417,8 @@ class ba extends Aa {
|
|
|
3430
3417
|
}), this.emit("error", new Error(a.error.reason || "Server error"));
|
|
3431
3418
|
return;
|
|
3432
3419
|
}
|
|
3433
|
-
if (a.type ===
|
|
3434
|
-
h.warn("[AnimationWebSocketClient] MESSAGE_ERROR received but no error field in message"),
|
|
3420
|
+
if (a.type === Se.MESSAGE_ERROR) {
|
|
3421
|
+
h.warn("[AnimationWebSocketClient] MESSAGE_ERROR received but no error field in message"), y.logEvent("character_animation_service", "warning", {
|
|
3435
3422
|
characterId: this.currentCharacterId,
|
|
3436
3423
|
event: "message_error_without_payload"
|
|
3437
3424
|
}), this.emit("error", new Error("Server returned error message without error details"));
|
|
@@ -3440,7 +3427,7 @@ class ba extends Aa {
|
|
|
3440
3427
|
this.emit("message", a);
|
|
3441
3428
|
} catch (n) {
|
|
3442
3429
|
const a = n instanceof Error ? n.message : String(n);
|
|
3443
|
-
h.error("[AnimationWebSocketClient] Failed to decode message:", a),
|
|
3430
|
+
h.error("[AnimationWebSocketClient] Failed to decode message:", a), y.logEvent("character_animation_service", "error", {
|
|
3444
3431
|
characterId: this.currentCharacterId,
|
|
3445
3432
|
event: "decode_failed",
|
|
3446
3433
|
reason: a
|
|
@@ -3457,22 +3444,22 @@ class ba extends Aa {
|
|
|
3457
3444
|
}, t);
|
|
3458
3445
|
}
|
|
3459
3446
|
}
|
|
3460
|
-
class
|
|
3447
|
+
class ba {
|
|
3461
3448
|
constructor(e) {
|
|
3462
3449
|
d(this, "wsClient");
|
|
3463
3450
|
d(this, "dataController");
|
|
3464
3451
|
// 组合播放层
|
|
3465
|
-
d(this, "
|
|
3452
|
+
d(this, "currentConversationId", null);
|
|
3466
3453
|
d(this, "audioBytesPerSecond", I.audio.sampleRate * 2);
|
|
3467
3454
|
d(this, "audioMetrics", this.createAudioMetrics());
|
|
3468
3455
|
this.dataController = e;
|
|
3469
|
-
const t =
|
|
3470
|
-
this.wsClient = new
|
|
3456
|
+
const t = y.getEnvironmentConfig();
|
|
3457
|
+
this.wsClient = new Sa({
|
|
3471
3458
|
wsUrl: t.driveningressWsUrl,
|
|
3472
3459
|
reconnectAttempts: 5,
|
|
3473
3460
|
debug: !1,
|
|
3474
|
-
jwtToken:
|
|
3475
|
-
appId:
|
|
3461
|
+
jwtToken: y.sessionToken || void 0,
|
|
3462
|
+
appId: y.appId || void 0
|
|
3476
3463
|
}), this.setupWebSocketListeners();
|
|
3477
3464
|
}
|
|
3478
3465
|
/**
|
|
@@ -3487,42 +3474,42 @@ class Sa {
|
|
|
3487
3474
|
*/
|
|
3488
3475
|
sendAudioData(e, t) {
|
|
3489
3476
|
var o, l;
|
|
3490
|
-
this.
|
|
3477
|
+
this.currentConversationId || (this.currentConversationId = this.wsClient.generateConversationId(), this.resetAudioMetrics(), y.logEvent("character_manager", "info", {
|
|
3491
3478
|
characterId: this.dataController.getAvatarId(),
|
|
3492
3479
|
event: "conversation_started",
|
|
3493
|
-
|
|
3480
|
+
conversationId: this.currentConversationId
|
|
3494
3481
|
}));
|
|
3495
3482
|
const n = this.audioMetrics;
|
|
3496
3483
|
let a = !1;
|
|
3497
3484
|
n.startTimestamp === 0 && (n.startTimestamp = Date.now(), a = !0), n.accumulatedBytes += e.byteLength;
|
|
3498
3485
|
const i = n.accumulatedBytes / this.audioBytesPerSecond;
|
|
3499
|
-
if (i >= 2 && n.tap2Timestamp === 0 && (n.tap2Timestamp = Date.now(), a = !0), i >= 4 && n.tap4Timestamp === 0 && (n.tap4Timestamp = Date.now(), a = !0), t && n.endTimestamp === 0 && (n.endTimestamp = Date.now(), a = !0), e.byteLength === 0 && !t && h.warn("[NetworkLayer] Warning: sending empty audio data (size=0, end=false)"), !this.wsClient.sendAudioData(this.
|
|
3500
|
-
h.error("[NetworkLayer] Failed to send audio data to WebSocket"), (l = (o = this.dataController).onError) == null || l.call(o, new
|
|
3486
|
+
if (i >= 2 && n.tap2Timestamp === 0 && (n.tap2Timestamp = Date.now(), a = !0), i >= 4 && n.tap4Timestamp === 0 && (n.tap4Timestamp = Date.now(), a = !0), t && n.endTimestamp === 0 && (n.endTimestamp = Date.now(), a = !0), e.byteLength === 0 && !t && h.warn("[NetworkLayer] Warning: sending empty audio data (size=0, end=false)"), !this.wsClient.sendAudioData(this.currentConversationId, e, t)) {
|
|
3487
|
+
h.error("[NetworkLayer] Failed to send audio data to WebSocket"), (l = (o = this.dataController).onError) == null || l.call(o, new Q("Failed to send audio data to WebSocket", "SEND_FAILED")), y.logEvent("character_animation_service", "error", {
|
|
3501
3488
|
characterId: this.dataController.getAvatarId(),
|
|
3502
3489
|
event: "send_audio_failed",
|
|
3503
|
-
|
|
3490
|
+
conversationId: this.currentConversationId
|
|
3504
3491
|
});
|
|
3505
3492
|
return;
|
|
3506
3493
|
}
|
|
3507
|
-
a && this.
|
|
3494
|
+
a && this.currentConversationId && this.reportAudioMetrics(this.currentConversationId);
|
|
3508
3495
|
}
|
|
3509
3496
|
/**
|
|
3510
3497
|
* 断开连接
|
|
3511
3498
|
*/
|
|
3512
3499
|
disconnect() {
|
|
3513
|
-
this.wsClient.removeAllListeners(), this.wsClient.disconnect(), this.
|
|
3500
|
+
this.wsClient.removeAllListeners(), this.wsClient.disconnect(), this.currentConversationId = null;
|
|
3514
3501
|
}
|
|
3515
3502
|
/**
|
|
3516
|
-
*
|
|
3503
|
+
* 获取当前会话ID
|
|
3517
3504
|
*/
|
|
3518
|
-
|
|
3519
|
-
return this.
|
|
3505
|
+
getCurrentConversationId() {
|
|
3506
|
+
return this.currentConversationId;
|
|
3520
3507
|
}
|
|
3521
3508
|
/**
|
|
3522
|
-
*
|
|
3509
|
+
* 重置会话ID(用于打断后清理)
|
|
3523
3510
|
*/
|
|
3524
|
-
|
|
3525
|
-
this.
|
|
3511
|
+
resetConversationId() {
|
|
3512
|
+
this.currentConversationId = null, this.resetAudioMetrics();
|
|
3526
3513
|
}
|
|
3527
3514
|
/**
|
|
3528
3515
|
* 设置 WebSocket 事件监听器
|
|
@@ -3531,29 +3518,29 @@ class Sa {
|
|
|
3531
3518
|
setupWebSocketListeners() {
|
|
3532
3519
|
this.wsClient.removeAllListeners(), this.wsClient.on("connected", () => {
|
|
3533
3520
|
var e, t;
|
|
3534
|
-
this.dataController.setConnected(!0), (t = (e = this.dataController).onConnectionState) == null || t.call(e,
|
|
3521
|
+
this.dataController.setConnected(!0), (t = (e = this.dataController).onConnectionState) == null || t.call(e, ye.connected), y.logEvent("character_animation_service", "info", {
|
|
3535
3522
|
characterId: this.dataController.getAvatarId(),
|
|
3536
3523
|
event: "connected"
|
|
3537
3524
|
});
|
|
3538
3525
|
}), this.wsClient.on("disconnected", () => {
|
|
3539
3526
|
var e, t;
|
|
3540
|
-
this.dataController.setConnected(!1), (t = (e = this.dataController).onConnectionState) == null || t.call(e,
|
|
3527
|
+
this.dataController.setConnected(!1), (t = (e = this.dataController).onConnectionState) == null || t.call(e, ye.disconnected), y.logEvent("character_animation_service", "warning", {
|
|
3541
3528
|
characterId: this.dataController.getAvatarId(),
|
|
3542
3529
|
event: "disconnected"
|
|
3543
3530
|
});
|
|
3544
3531
|
}), this.wsClient.on("reconnecting", () => {
|
|
3545
|
-
|
|
3532
|
+
y.logEvent("character_animation_service", "info", {
|
|
3546
3533
|
characterId: this.dataController.getAvatarId(),
|
|
3547
3534
|
event: "reconnecting"
|
|
3548
3535
|
});
|
|
3549
3536
|
}), this.wsClient.on("error", (e) => {
|
|
3550
3537
|
var n, a, i, s;
|
|
3551
3538
|
const t = e instanceof Error ? e.message : String(e);
|
|
3552
|
-
h.error("[NetworkLayer] WebSocket error:", t),
|
|
3539
|
+
h.error("[NetworkLayer] WebSocket error:", t), y.logEvent("character_animation_service", "error", {
|
|
3553
3540
|
characterId: this.dataController.getAvatarId(),
|
|
3554
3541
|
event: "websocket_error",
|
|
3555
3542
|
reason: t
|
|
3556
|
-
}), (a = (n = this.dataController).onConnectionState) == null || a.call(n,
|
|
3543
|
+
}), (a = (n = this.dataController).onConnectionState) == null || a.call(n, ye.failed), (s = (i = this.dataController).onError) == null || s.call(i, e);
|
|
3557
3544
|
}), this.wsClient.on("message", (e) => {
|
|
3558
3545
|
this.handleMessage(e);
|
|
3559
3546
|
});
|
|
@@ -3564,16 +3551,16 @@ class Sa {
|
|
|
3564
3551
|
handleMessage(e) {
|
|
3565
3552
|
try {
|
|
3566
3553
|
switch (e.type) {
|
|
3567
|
-
case
|
|
3554
|
+
case Se.MESSAGE_SERVER_RESPONSE_ANIMATION:
|
|
3568
3555
|
this.handleAnimationMessage(e);
|
|
3569
3556
|
break;
|
|
3570
|
-
case
|
|
3557
|
+
case Se.MESSAGE_ERROR:
|
|
3571
3558
|
this.handleErrorMessage(e);
|
|
3572
3559
|
break;
|
|
3573
3560
|
}
|
|
3574
3561
|
} catch (t) {
|
|
3575
3562
|
const n = t instanceof Error ? t.message : String(t);
|
|
3576
|
-
h.error("[NetworkLayer] Failed to handle message:", n),
|
|
3563
|
+
h.error("[NetworkLayer] Failed to handle message:", n), y.logEvent("character_manager", "error", {
|
|
3577
3564
|
characterId: this.dataController.getAvatarId(),
|
|
3578
3565
|
event: "handle_message_failed",
|
|
3579
3566
|
reason: n
|
|
@@ -3588,54 +3575,55 @@ class Sa {
|
|
|
3588
3575
|
h.error("[NetworkLayer] Invalid animation message");
|
|
3589
3576
|
return;
|
|
3590
3577
|
}
|
|
3591
|
-
const { reqId: t, animation: n } = e.serverResponseAnimation;
|
|
3592
|
-
if (!this.
|
|
3593
|
-
h.warn(`[NetworkLayer] Ignoring mismatched animation message - expected
|
|
3578
|
+
const { reqId: t, animation: n } = e.serverResponseAnimation, a = t;
|
|
3579
|
+
if (!this.currentConversationId || a !== this.currentConversationId) {
|
|
3580
|
+
h.warn(`[NetworkLayer] Ignoring mismatched animation message - expected conversationId: ${this.currentConversationId}, received conversationId: ${a}`), y.logEvent("character_manager", "warning", {
|
|
3594
3581
|
characterId: this.dataController.getAvatarId(),
|
|
3595
|
-
event: "
|
|
3596
|
-
|
|
3597
|
-
|
|
3582
|
+
event: "animation_conversationid_mismatch",
|
|
3583
|
+
expectedConversationId: this.currentConversationId,
|
|
3584
|
+
receivedConversationId: a
|
|
3598
3585
|
});
|
|
3599
3586
|
return;
|
|
3600
3587
|
}
|
|
3601
3588
|
if (n != null && n.keyframes && n.keyframes.length > 0) {
|
|
3602
|
-
const
|
|
3603
|
-
this.dataController.yieldFramesData(
|
|
3589
|
+
const i = n.keyframes;
|
|
3590
|
+
this.dataController.yieldFramesData(i, a), this.dataController.getIsPlaying() || this.dataController.startStreamingPlayback(), this.audioMetrics.didRecvFirstFlame || (this.audioMetrics.didRecvFirstFlame = !0, this.audioMetrics.recvFirstFlameTimestamp = Date.now(), this.currentConversationId && this.reportAudioMetrics(this.currentConversationId));
|
|
3604
3591
|
} else
|
|
3605
|
-
h.warn(`[NetworkLayer] Animation message has no keyframes -
|
|
3592
|
+
h.warn(`[NetworkLayer] Animation message has no keyframes - conversationId: ${a}`), y.logEvent("character_manager", "warning", {
|
|
3606
3593
|
characterId: this.dataController.getAvatarId(),
|
|
3607
3594
|
event: "animation_empty_keyframes",
|
|
3608
|
-
|
|
3595
|
+
conversationId: a
|
|
3609
3596
|
});
|
|
3610
3597
|
}
|
|
3611
3598
|
/**
|
|
3612
3599
|
* 处理错误消息
|
|
3613
3600
|
*/
|
|
3614
3601
|
handleErrorMessage(e) {
|
|
3615
|
-
var
|
|
3602
|
+
var a, i, s, o;
|
|
3616
3603
|
if (!e.error) {
|
|
3617
|
-
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"),
|
|
3604
|
+
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"), y.logEvent("character_manager", "warning", {
|
|
3618
3605
|
characterId: this.dataController.getAvatarId(),
|
|
3619
3606
|
event: "message_error_with_payload"
|
|
3620
3607
|
}), this.handleAnimationMessage(e));
|
|
3621
3608
|
return;
|
|
3622
3609
|
}
|
|
3623
|
-
|
|
3610
|
+
const t = e.error.reqId;
|
|
3611
|
+
h.error(`[NetworkLayer] Server error: conversationId=${t}, code=${e.error.code}, reason=${e.error.reason}`), y.logEvent("character_manager", "error", {
|
|
3624
3612
|
characterId: this.dataController.getAvatarId(),
|
|
3625
3613
|
event: "server_error",
|
|
3626
|
-
|
|
3614
|
+
conversationId: t,
|
|
3627
3615
|
code: e.error.code,
|
|
3628
3616
|
reason: e.error.reason
|
|
3629
3617
|
});
|
|
3630
|
-
const
|
|
3631
|
-
(
|
|
3618
|
+
const n = ((a = e.error.code) == null ? void 0 : a.toString().toLowerCase()) ?? "";
|
|
3619
|
+
(n.includes("unauth") || n === "401") && y.logEvent("sdk_verify", "error", {
|
|
3632
3620
|
characterId: this.dataController.getAvatarId(),
|
|
3633
|
-
|
|
3621
|
+
conversationId: t,
|
|
3634
3622
|
reason: e.error.reason
|
|
3635
|
-
}), (
|
|
3623
|
+
}), (o = (s = this.dataController).onError) == null || o.call(s, new Q(
|
|
3636
3624
|
e.error.reason || "Server error occurred",
|
|
3637
|
-
((
|
|
3638
|
-
)), this.
|
|
3625
|
+
((i = e.error.code) == null ? void 0 : i.toString()) || "SERVER_ERROR"
|
|
3626
|
+
)), this.currentConversationId && t === this.currentConversationId && (h.warn("[NetworkLayer] Server error for current conversation - triggering audio-only mode via empty keyframes"), this.dataController.yieldFramesData([], t));
|
|
3639
3627
|
}
|
|
3640
3628
|
/**
|
|
3641
3629
|
* 创建音频指标
|
|
@@ -3661,8 +3649,8 @@ class Sa {
|
|
|
3661
3649
|
* 上报音频指标
|
|
3662
3650
|
*/
|
|
3663
3651
|
reportAudioMetrics(e) {
|
|
3664
|
-
!e || this.audioMetrics.startTimestamp === 0 ||
|
|
3665
|
-
|
|
3652
|
+
!e || this.audioMetrics.startTimestamp === 0 || y.logEvent("send_audio_measure", "info", {
|
|
3653
|
+
conversationId: e,
|
|
3666
3654
|
start: this.audioMetrics.startTimestamp,
|
|
3667
3655
|
tap2: this.audioMetrics.tap2Timestamp,
|
|
3668
3656
|
tap4: this.audioMetrics.tap4Timestamp,
|
|
@@ -3685,9 +3673,9 @@ class Ca {
|
|
|
3685
3673
|
d(this, "isPlaying", !1);
|
|
3686
3674
|
// ========== State Management ==========
|
|
3687
3675
|
d(this, "isConnected", !1);
|
|
3688
|
-
d(this, "currentState",
|
|
3689
|
-
// ==========
|
|
3690
|
-
d(this, "
|
|
3676
|
+
d(this, "currentState", M.idle);
|
|
3677
|
+
// ========== Conversation ID Management (for external data mode) ==========
|
|
3678
|
+
d(this, "currentConversationId", null);
|
|
3691
3679
|
d(this, "reqEnd", !1);
|
|
3692
3680
|
// ========== Event System ==========
|
|
3693
3681
|
d(this, "onConnectionState", null);
|
|
@@ -3712,7 +3700,7 @@ class Ca {
|
|
|
3712
3700
|
// Maximum pending audio chunks to prevent memory leak
|
|
3713
3701
|
// ========== Audio Only Mode ==========
|
|
3714
3702
|
d(this, "isAudioOnlyMode", !1);
|
|
3715
|
-
this.avatar = e, this.playbackMode = (t == null ? void 0 : t.playbackMode) ??
|
|
3703
|
+
this.avatar = e, this.playbackMode = (t == null ? void 0 : t.playbackMode) ?? me.network, this.playbackMode === me.network && (this.networkLayer = new ba(this));
|
|
3716
3704
|
}
|
|
3717
3705
|
// ========== Internal Accessors (for NetworkLayer and AvatarView) ==========
|
|
3718
3706
|
/**
|
|
@@ -3758,12 +3746,12 @@ class Ca {
|
|
|
3758
3746
|
return this.animationPlayer;
|
|
3759
3747
|
}
|
|
3760
3748
|
/**
|
|
3761
|
-
* Get current
|
|
3762
|
-
* Returns the current
|
|
3763
|
-
* @returns Current
|
|
3749
|
+
* Get current conversation ID
|
|
3750
|
+
* Returns the current conversation ID for the active audio session
|
|
3751
|
+
* @returns Current conversation ID, or null if no active session
|
|
3764
3752
|
*/
|
|
3765
|
-
|
|
3766
|
-
return this.
|
|
3753
|
+
getCurrentConversationId() {
|
|
3754
|
+
return this.getEffectiveConversationId();
|
|
3767
3755
|
}
|
|
3768
3756
|
// ========== Network Mode Interface ==========
|
|
3769
3757
|
/**
|
|
@@ -3771,17 +3759,17 @@ class Ca {
|
|
|
3771
3759
|
*/
|
|
3772
3760
|
async start() {
|
|
3773
3761
|
if (!this.networkLayer)
|
|
3774
|
-
throw new
|
|
3762
|
+
throw new Q(
|
|
3775
3763
|
"Network layer not available. Use network playback mode.",
|
|
3776
3764
|
"NETWORK_LAYER_NOT_AVAILABLE"
|
|
3777
3765
|
);
|
|
3778
3766
|
if (!this.animationPlayer) {
|
|
3779
|
-
this.animationPlayer = new
|
|
3767
|
+
this.animationPlayer = new ae();
|
|
3780
3768
|
try {
|
|
3781
3769
|
await this.animationPlayer.createAndInitializeStreamingPlayer();
|
|
3782
3770
|
} catch (e) {
|
|
3783
3771
|
const t = e instanceof Error ? e.message : String(e);
|
|
3784
|
-
throw h.error("[AvatarController] Failed to create streaming player:", t),
|
|
3772
|
+
throw h.error("[AvatarController] Failed to create streaming player:", t), y.logEvent("character_player", "error", {
|
|
3785
3773
|
characterId: this.avatar.id,
|
|
3786
3774
|
event: "streaming_player_init_failed",
|
|
3787
3775
|
reason: t
|
|
@@ -3793,99 +3781,99 @@ class Ca {
|
|
|
3793
3781
|
/**
|
|
3794
3782
|
* Send audio to server (network mode only)
|
|
3795
3783
|
* Also cache to data layer for playback
|
|
3796
|
-
* @returns
|
|
3784
|
+
* @returns conversationId - Conversation ID for this audio session
|
|
3797
3785
|
*/
|
|
3798
3786
|
send(e, t = !1) {
|
|
3799
3787
|
var a, i;
|
|
3800
3788
|
if (!this.networkLayer || !this.isConnected)
|
|
3801
|
-
return (a = this.onError) == null || a.call(this, new
|
|
3789
|
+
return (a = this.onError) == null || a.call(this, new Q("Service not connected", "NOT_CONNECTED")), y.logEvent("character_manager", "warning", {
|
|
3802
3790
|
characterId: this.avatar.id,
|
|
3803
3791
|
event: "send_not_connected"
|
|
3804
3792
|
}), null;
|
|
3805
|
-
const n = this.networkLayer.
|
|
3806
|
-
return this.reqEnd && this.isPlaying && n && this.interrupt(), this.networkLayer.sendAudioData(e, t), t && (this.reqEnd = !0), this.addAudioChunkToBuffer(new Uint8Array(e), t), (i = this.onAvatarState) == null || i.call(this,
|
|
3793
|
+
const n = this.networkLayer.getCurrentConversationId();
|
|
3794
|
+
return this.reqEnd && this.isPlaying && n && this.interrupt(), this.networkLayer.sendAudioData(e, t), t && (this.reqEnd = !0), this.addAudioChunkToBuffer(new Uint8Array(e), t), (i = this.onAvatarState) == null || i.call(this, M.active), this.networkLayer.getCurrentConversationId();
|
|
3807
3795
|
}
|
|
3808
3796
|
/**
|
|
3809
3797
|
* Close service (network mode only)
|
|
3810
3798
|
*/
|
|
3811
3799
|
close() {
|
|
3812
3800
|
var e;
|
|
3813
|
-
(this.isPlaying || this.currentState ===
|
|
3801
|
+
(this.isPlaying || this.currentState === M.paused) && this.stopPlayback(), this.clearPlaybackData(), this.networkLayer ? this.networkLayer.disconnect() : this.currentConversationId = null, this.reqEnd = !1, this.isConnected = !1, (e = this.onConnectionState) == null || e.call(this, ye.disconnected);
|
|
3814
3802
|
}
|
|
3815
3803
|
// ========== External Data Mode Interface ==========
|
|
3816
3804
|
/**
|
|
3817
3805
|
* Playback existing audio and animation data (external data mode)
|
|
3818
|
-
* Starts a new conversation by generating a new
|
|
3806
|
+
* Starts a new conversation by generating a new conversation ID and interrupting any existing conversation
|
|
3819
3807
|
* @param initialAudioChunks - Existing audio chunks to playback
|
|
3820
3808
|
* @param initialKeyframes - Existing animation keyframes to playback
|
|
3821
|
-
* @returns
|
|
3809
|
+
* @returns conversationId - New conversation ID for this conversation session
|
|
3822
3810
|
*/
|
|
3823
3811
|
async playback(e, t) {
|
|
3824
|
-
if ((this.isPlaying || this.
|
|
3812
|
+
if ((this.isPlaying || this.currentConversationId) && this.interrupt(), this.currentConversationId = this.generateAndLogNewConversationId(), this.reqEnd = !1, this.clearPlaybackData(), this.animationPlayer || (this.animationPlayer = new ae()), this.animationPlayer.isStreamingReady() || await this.animationPlayer.createAndInitializeStreamingPlayer(), e && e.length > 0 && this.pendingAudioChunks.push(...e), t && t.length > 0 ? (this.currentKeyframes = t, this.emit("keyframesUpdate", this.currentKeyframes)) : (h.warn("[AvatarController] Empty animation data in playback - enabling audio-only mode"), y.logEvent("character_manager", "info", {
|
|
3825
3813
|
characterId: this.avatar.id,
|
|
3826
3814
|
event: "empty_animation_data_audio_only_fallback",
|
|
3827
|
-
|
|
3815
|
+
conversationId: this.currentConversationId
|
|
3828
3816
|
}), this.isAudioOnlyMode = !0), this.pendingAudioChunks.length === 0)
|
|
3829
|
-
throw new
|
|
3830
|
-
return this.isAudioOnlyMode ? await this.startAudioOnlyPlayback() : await this.startStreamingPlayback(), this.
|
|
3817
|
+
throw new Q("No audio chunks to play", "NO_AUDIO");
|
|
3818
|
+
return this.isAudioOnlyMode ? await this.startAudioOnlyPlayback() : await this.startStreamingPlayback(), this.currentConversationId;
|
|
3831
3819
|
}
|
|
3832
3820
|
/**
|
|
3833
3821
|
* Send audio data (external data mode)
|
|
3834
3822
|
* Stream additional audio data after playback()
|
|
3835
|
-
* @returns
|
|
3823
|
+
* @returns conversationId - Conversation ID for this audio session
|
|
3836
3824
|
*/
|
|
3837
3825
|
yieldAudioData(e, t = !1) {
|
|
3838
3826
|
var n, a;
|
|
3839
|
-
if (this.reqEnd && this.isPlaying && this.
|
|
3827
|
+
if (this.reqEnd && this.isPlaying && this.currentConversationId && (this.interrupt(), this.currentConversationId = this.generateAndLogNewConversationId(), this.reqEnd = !1), this.currentConversationId || (this.isPlaying && this.interrupt(), this.currentConversationId = this.generateAndLogNewConversationId(), this.reqEnd = !1, this.clearPlaybackData()), t && (this.reqEnd = !0), this.isPlaying && ((n = this.animationPlayer) != null && n.isStreamingReady()))
|
|
3840
3828
|
this.animationPlayer.addAudioChunk(e, t);
|
|
3841
3829
|
else if (e.length > 0 || t) {
|
|
3842
3830
|
if (this.pendingAudioChunks.length >= this.MAX_PENDING_AUDIO_CHUNKS) {
|
|
3843
3831
|
const i = this.pendingAudioChunks.findIndex((s) => s.isLast);
|
|
3844
3832
|
i >= 0 && i < this.pendingAudioChunks.length - 1 ? this.pendingAudioChunks.splice(0, i) : this.pendingAudioChunks.shift(), h.warn(`[AvatarController] Pending audio chunks limit reached (${this.MAX_PENDING_AUDIO_CHUNKS}), removed oldest chunk`);
|
|
3845
3833
|
}
|
|
3846
|
-
this.pendingAudioChunks.push({ data: e, isLast: t }), (a = this.onAvatarState) == null || a.call(this,
|
|
3834
|
+
this.pendingAudioChunks.push({ data: e, isLast: t }), (a = this.onAvatarState) == null || a.call(this, M.active);
|
|
3847
3835
|
}
|
|
3848
|
-
return this.
|
|
3836
|
+
return this.currentConversationId;
|
|
3849
3837
|
}
|
|
3850
3838
|
/**
|
|
3851
3839
|
* Send animation keyframes (external data mode or network mode)
|
|
3852
3840
|
* Stream additional animation data after playback()
|
|
3853
3841
|
* @param keyframes - Animation keyframes to send
|
|
3854
|
-
* @param
|
|
3855
|
-
* Use
|
|
3842
|
+
* @param conversationId - Conversation ID (required). If conversationId doesn't match current conversationId, keyframes will be discarded.
|
|
3843
|
+
* Use getCurrentConversationId() to get the current conversationId.
|
|
3856
3844
|
*/
|
|
3857
3845
|
yieldFramesData(e, t) {
|
|
3858
3846
|
if (!t || typeof t != "string") {
|
|
3859
|
-
h.error("[AvatarController] yieldFramesData requires a valid
|
|
3847
|
+
h.error("[AvatarController] yieldFramesData requires a valid conversationId. Use getCurrentConversationId() to get the current conversationId."), y.logEvent("character_manager", "error", {
|
|
3860
3848
|
characterId: this.avatar.id,
|
|
3861
|
-
event: "
|
|
3862
|
-
|
|
3849
|
+
event: "keyframes_missing_conversationid",
|
|
3850
|
+
receivedConversationId: t
|
|
3863
3851
|
});
|
|
3864
3852
|
return;
|
|
3865
3853
|
}
|
|
3866
|
-
const n = this.
|
|
3854
|
+
const n = this.getEffectiveConversationId();
|
|
3867
3855
|
if (!n || t !== n) {
|
|
3868
|
-
h.warn(`[AvatarController] Ignoring mismatched keyframes - expected
|
|
3856
|
+
h.warn(`[AvatarController] Ignoring mismatched keyframes - expected conversationId: ${n}, received conversationId: ${t}`), y.logEvent("character_manager", "warning", {
|
|
3869
3857
|
characterId: this.avatar.id,
|
|
3870
|
-
event: "
|
|
3871
|
-
|
|
3872
|
-
|
|
3858
|
+
event: "keyframes_conversationid_mismatch",
|
|
3859
|
+
expectedConversationId: n,
|
|
3860
|
+
receivedConversationId: t
|
|
3873
3861
|
});
|
|
3874
3862
|
return;
|
|
3875
3863
|
}
|
|
3876
3864
|
if (this.isAudioOnlyMode) {
|
|
3877
|
-
h.warn("[AvatarController] Ignoring animation data in audio-only mode"),
|
|
3865
|
+
h.warn("[AvatarController] Ignoring animation data in audio-only mode"), y.logEvent("character_manager", "info", {
|
|
3878
3866
|
characterId: this.avatar.id,
|
|
3879
3867
|
event: "animation_data_ignored_audio_only",
|
|
3880
|
-
|
|
3868
|
+
conversationId: t
|
|
3881
3869
|
});
|
|
3882
3870
|
return;
|
|
3883
3871
|
}
|
|
3884
3872
|
if (!e || e.length === 0) {
|
|
3885
|
-
h.warn("[AvatarController] Empty animation data received - enabling audio-only mode"),
|
|
3873
|
+
h.warn("[AvatarController] Empty animation data received - enabling audio-only mode"), y.logEvent("character_manager", "info", {
|
|
3886
3874
|
characterId: this.avatar.id,
|
|
3887
3875
|
event: "empty_animation_data_audio_only_fallback",
|
|
3888
|
-
|
|
3876
|
+
conversationId: t
|
|
3889
3877
|
}), this.enableAudioOnlyMode();
|
|
3890
3878
|
return;
|
|
3891
3879
|
}
|
|
@@ -3893,7 +3881,7 @@ class Ca {
|
|
|
3893
3881
|
const a = I.audio.sampleRate * 2;
|
|
3894
3882
|
this.pendingAudioChunks.reduce((s, o) => s + o.data.length, 0) >= a && this.startStreamingPlayback().catch((s) => {
|
|
3895
3883
|
var o;
|
|
3896
|
-
h.error("[AvatarController] Failed to auto-start playback:", s), (o = this.onError) == null || o.call(this, new
|
|
3884
|
+
h.error("[AvatarController] Failed to auto-start playback:", s), (o = this.onError) == null || o.call(this, new Q("Failed to start playback", "PLAYBACK_START_FAILED"));
|
|
3897
3885
|
});
|
|
3898
3886
|
}
|
|
3899
3887
|
}
|
|
@@ -3904,10 +3892,10 @@ class Ca {
|
|
|
3904
3892
|
*/
|
|
3905
3893
|
pause() {
|
|
3906
3894
|
var e, t, n;
|
|
3907
|
-
!this.isPlaying || this.currentState ===
|
|
3895
|
+
!this.isPlaying || this.currentState === M.paused || (h.log("[AvatarController] Pausing playback"), (e = this.animationPlayer) == null || e.pause(), this.stopPlaybackLoop(), this.currentState = M.paused, (t = this.onAvatarState) == null || t.call(this, M.paused), h.log("[AvatarController] Playback paused"), y.logEvent("character_player", "info", {
|
|
3908
3896
|
characterId: this.avatar.id,
|
|
3909
3897
|
event: "playback_paused",
|
|
3910
|
-
|
|
3898
|
+
conversationId: ((n = this.networkLayer) == null ? void 0 : n.getCurrentConversationId()) || void 0
|
|
3911
3899
|
}));
|
|
3912
3900
|
}
|
|
3913
3901
|
/**
|
|
@@ -3917,10 +3905,10 @@ class Ca {
|
|
|
3917
3905
|
*/
|
|
3918
3906
|
async resume() {
|
|
3919
3907
|
var e, t, n;
|
|
3920
|
-
!this.isPlaying || this.currentState !==
|
|
3908
|
+
!this.isPlaying || this.currentState !== M.paused || (h.log("[AvatarController] Resuming playback"), await ((e = this.animationPlayer) == null ? void 0 : e.resume()), this.startPlaybackLoop(), this.currentState = M.playing, (t = this.onAvatarState) == null || t.call(this, M.playing), h.log("[AvatarController] Playback resumed"), y.logEvent("character_player", "info", {
|
|
3921
3909
|
characterId: this.avatar.id,
|
|
3922
3910
|
event: "playback_resumed",
|
|
3923
|
-
|
|
3911
|
+
conversationId: ((n = this.networkLayer) == null ? void 0 : n.getCurrentConversationId()) || void 0
|
|
3924
3912
|
}));
|
|
3925
3913
|
}
|
|
3926
3914
|
/**
|
|
@@ -3928,15 +3916,15 @@ class Ca {
|
|
|
3928
3916
|
*/
|
|
3929
3917
|
interrupt() {
|
|
3930
3918
|
var e;
|
|
3931
|
-
this.currentState ===
|
|
3932
|
-
})), this.stopPlayback(), this.emit("interrupt"), this.clearPlaybackData(), this.
|
|
3919
|
+
this.currentState === M.paused && ((e = this.animationPlayer) == null || e.resume().catch(() => {
|
|
3920
|
+
})), this.stopPlayback(), this.emit("interrupt"), this.clearPlaybackData(), this.resetConversationIdState(), this.isAudioOnlyMode = !1;
|
|
3933
3921
|
}
|
|
3934
3922
|
/**
|
|
3935
3923
|
* Clear all data and resources
|
|
3936
3924
|
*/
|
|
3937
3925
|
clear() {
|
|
3938
3926
|
var e, t;
|
|
3939
|
-
this.isPlaying && this.stopPlayback(), (e = this.networkLayer) == null || e.disconnect(), this.cleanupPlayers(), this.clearPlaybackData(), this.isConnected = !1, this.currentState =
|
|
3927
|
+
this.isPlaying && this.stopPlayback(), (e = this.networkLayer) == null || e.disconnect(), this.cleanupPlayers(), this.clearPlaybackData(), this.isConnected = !1, this.currentState = M.idle, (t = this.onAvatarState) == null || t.call(this, M.idle), this.networkLayer || (this.currentConversationId = null), this.reqEnd = !1;
|
|
3940
3928
|
}
|
|
3941
3929
|
/**
|
|
3942
3930
|
* Dispose controller, clean up all callbacks to avoid memory leaks
|
|
@@ -3948,15 +3936,15 @@ class Ca {
|
|
|
3948
3936
|
}
|
|
3949
3937
|
// ========== Internal Helper Methods ==========
|
|
3950
3938
|
/**
|
|
3951
|
-
* Generate new
|
|
3939
|
+
* Generate new conversation ID and log conversation started event
|
|
3952
3940
|
* @private
|
|
3953
3941
|
*/
|
|
3954
|
-
|
|
3955
|
-
const e =
|
|
3956
|
-
return
|
|
3942
|
+
generateAndLogNewConversationId() {
|
|
3943
|
+
const e = er();
|
|
3944
|
+
return y.logEvent("character_manager", "info", {
|
|
3957
3945
|
characterId: this.avatar.id,
|
|
3958
3946
|
event: "conversation_started",
|
|
3959
|
-
|
|
3947
|
+
conversationId: e
|
|
3960
3948
|
}), e;
|
|
3961
3949
|
}
|
|
3962
3950
|
/**
|
|
@@ -3967,19 +3955,19 @@ class Ca {
|
|
|
3967
3955
|
this.currentKeyframes = [], this.pendingAudioChunks = [], this.lastRenderedFrameIndex = -1, this.keyframesOffset = 0, this.isAudioOnlyMode = !1;
|
|
3968
3956
|
}
|
|
3969
3957
|
/**
|
|
3970
|
-
* Reset
|
|
3958
|
+
* Reset conversation ID state (for both network and external modes)
|
|
3971
3959
|
* @private
|
|
3972
3960
|
*/
|
|
3973
|
-
|
|
3974
|
-
this.networkLayer ? this.networkLayer.
|
|
3961
|
+
resetConversationIdState() {
|
|
3962
|
+
this.networkLayer ? this.networkLayer.resetConversationId() : this.currentConversationId = null, this.reqEnd = !1, this.isAudioOnlyMode = !1;
|
|
3975
3963
|
}
|
|
3976
3964
|
/**
|
|
3977
|
-
* Get effective
|
|
3965
|
+
* Get effective conversation ID (handles both network and external modes)
|
|
3978
3966
|
* @private
|
|
3979
3967
|
*/
|
|
3980
|
-
|
|
3968
|
+
getEffectiveConversationId() {
|
|
3981
3969
|
var e;
|
|
3982
|
-
return this.playbackMode ===
|
|
3970
|
+
return this.playbackMode === me.network ? ((e = this.networkLayer) == null ? void 0 : e.getCurrentConversationId()) || null : this.currentConversationId;
|
|
3983
3971
|
}
|
|
3984
3972
|
// ========== Internal Methods (for NetworkLayer and AvatarView use) ==========
|
|
3985
3973
|
/**
|
|
@@ -4025,12 +4013,12 @@ class Ca {
|
|
|
4025
4013
|
*/
|
|
4026
4014
|
async startStreamingPlaybackInternal() {
|
|
4027
4015
|
var e, t, n;
|
|
4028
|
-
if (this.animationPlayer || (this.animationPlayer = new
|
|
4016
|
+
if (this.animationPlayer || (this.animationPlayer = new ae()), !this.animationPlayer.isStreamingReady())
|
|
4029
4017
|
try {
|
|
4030
4018
|
await this.animationPlayer.createAndInitializeStreamingPlayer();
|
|
4031
4019
|
} catch (a) {
|
|
4032
4020
|
const i = a instanceof Error ? a.message : String(a);
|
|
4033
|
-
throw h.error("[AvatarController] Failed to create streaming player:", i),
|
|
4021
|
+
throw h.error("[AvatarController] Failed to create streaming player:", i), y.logEvent("character_player", "error", {
|
|
4034
4022
|
characterId: this.avatar.id,
|
|
4035
4023
|
event: "streaming_player_init_failed",
|
|
4036
4024
|
reason: i
|
|
@@ -4043,21 +4031,21 @@ class Ca {
|
|
|
4043
4031
|
try {
|
|
4044
4032
|
await this.animationPlayer.prepareStreamingPlayer(() => {
|
|
4045
4033
|
var i, s;
|
|
4046
|
-
this.isPlaying = !1, this.currentState =
|
|
4034
|
+
this.isPlaying = !1, this.currentState = M.idle, (i = this.onAvatarState) == null || i.call(this, M.idle), this.emit("stopRendering"), this.clearPlaybackData(), this.networkLayer ? this.networkLayer.resetConversationId() : this.currentConversationId = null, this.reqEnd = !1, this.isAudioOnlyMode = !1, y.logEvent("character_player", "info", {
|
|
4047
4035
|
characterId: this.avatar.id,
|
|
4048
4036
|
event: "playback_ended",
|
|
4049
|
-
|
|
4037
|
+
conversationId: ((s = this.networkLayer) == null ? void 0 : s.getCurrentConversationId()) || void 0
|
|
4050
4038
|
});
|
|
4051
4039
|
}), this.emit("startRendering");
|
|
4052
4040
|
const a = this.animationPlayer.getStreamingPlayer();
|
|
4053
|
-
a && a.setAutoStart(!1), a && await a.startNewSession(this.pendingAudioChunks), this.pendingAudioChunks = [], this.isPlaying = !0, this.currentState =
|
|
4041
|
+
a && a.setAutoStart(!1), a && await a.startNewSession(this.pendingAudioChunks), this.pendingAudioChunks = [], this.isPlaying = !0, this.currentState = M.playing, (e = this.onAvatarState) == null || e.call(this, M.playing), this.startPlaybackLoop(), y.logEvent("character_player", "info", {
|
|
4054
4042
|
characterId: this.avatar.id,
|
|
4055
4043
|
event: "playback_started",
|
|
4056
|
-
|
|
4044
|
+
conversationId: ((t = this.networkLayer) == null ? void 0 : t.getCurrentConversationId()) || void 0
|
|
4057
4045
|
});
|
|
4058
4046
|
} catch (a) {
|
|
4059
4047
|
const i = a instanceof Error ? a.message : String(a);
|
|
4060
|
-
h.error("[AvatarController] Failed to start streaming playback:", i), (n = this.onError) == null || n.call(this, new
|
|
4048
|
+
h.error("[AvatarController] Failed to start streaming playback:", i), (n = this.onError) == null || n.call(this, new Q("Failed to start streaming playback", "INIT_FAILED")), this.isPlaying = !1;
|
|
4061
4049
|
}
|
|
4062
4050
|
}
|
|
4063
4051
|
/**
|
|
@@ -4067,7 +4055,7 @@ class Ca {
|
|
|
4067
4055
|
if (this.playbackLoopId)
|
|
4068
4056
|
return;
|
|
4069
4057
|
const e = I.animation.fps, t = async () => {
|
|
4070
|
-
if (!this.isPlaying || this.currentState ===
|
|
4058
|
+
if (!this.isPlaying || this.currentState === M.paused || !this.animationPlayer) {
|
|
4071
4059
|
this.playbackLoopId = null;
|
|
4072
4060
|
return;
|
|
4073
4061
|
}
|
|
@@ -4089,7 +4077,7 @@ class Ca {
|
|
|
4089
4077
|
o > 0 && o < a && (this.currentKeyframes.splice(0, o), this.keyframesOffset += o, i = a - this.keyframesOffset, i < 0 && (i = 0), i >= this.currentKeyframes.length && (i = this.currentKeyframes.length - 1), h.log(`[AvatarController] Cleaned up ${o} old keyframes (kept ${this.currentKeyframes.length} frames, offset: ${this.keyframesOffset})`));
|
|
4090
4078
|
}
|
|
4091
4079
|
if (i >= 0 && i < this.currentKeyframes.length) {
|
|
4092
|
-
const s = this.currentKeyframes[i], o =
|
|
4080
|
+
const s = this.currentKeyframes[i], o = Vt(s), l = y.getAvatarCore();
|
|
4093
4081
|
if (l) {
|
|
4094
4082
|
const p = await l.computeFrameFlatFromParams(o, this.characterHandle ?? void 0);
|
|
4095
4083
|
p && this.renderCallback && this.renderCallback(p, a);
|
|
@@ -4127,12 +4115,12 @@ class Ca {
|
|
|
4127
4115
|
*/
|
|
4128
4116
|
async startAudioOnlyPlayback() {
|
|
4129
4117
|
var e, t;
|
|
4130
|
-
if (this.animationPlayer || (this.animationPlayer = new
|
|
4118
|
+
if (this.animationPlayer || (this.animationPlayer = new ae()), !this.animationPlayer.isStreamingReady())
|
|
4131
4119
|
try {
|
|
4132
4120
|
await this.animationPlayer.createAndInitializeStreamingPlayer();
|
|
4133
4121
|
} catch (n) {
|
|
4134
4122
|
const a = n instanceof Error ? n.message : String(n);
|
|
4135
|
-
throw h.error("[AvatarController] Failed to create streaming player for audio-only mode:", a),
|
|
4123
|
+
throw h.error("[AvatarController] Failed to create streaming player for audio-only mode:", a), y.logEvent("character_player", "error", {
|
|
4136
4124
|
characterId: this.avatar.id,
|
|
4137
4125
|
event: "audio_only_streaming_player_init_failed",
|
|
4138
4126
|
reason: a
|
|
@@ -4141,21 +4129,21 @@ class Ca {
|
|
|
4141
4129
|
try {
|
|
4142
4130
|
await this.animationPlayer.prepareStreamingPlayer(() => {
|
|
4143
4131
|
var a;
|
|
4144
|
-
this.isPlaying = !1, this.currentState =
|
|
4132
|
+
this.isPlaying = !1, this.currentState = M.idle, (a = this.onAvatarState) == null || a.call(this, M.idle), this.isAudioOnlyMode = !1, this.clearPlaybackData(), this.resetConversationIdState(), y.logEvent("character_player", "info", {
|
|
4145
4133
|
characterId: this.avatar.id,
|
|
4146
4134
|
event: "audio_only_playback_ended",
|
|
4147
|
-
|
|
4135
|
+
conversationId: this.getEffectiveConversationId() || void 0
|
|
4148
4136
|
});
|
|
4149
4137
|
});
|
|
4150
4138
|
const n = this.animationPlayer.getStreamingPlayer();
|
|
4151
|
-
n && n.setAutoStart(!0), n && await n.startNewSession(this.pendingAudioChunks), this.pendingAudioChunks = [], this.isPlaying = !0, this.currentState =
|
|
4139
|
+
n && n.setAutoStart(!0), n && await n.startNewSession(this.pendingAudioChunks), this.pendingAudioChunks = [], this.isPlaying = !0, this.currentState = M.playing, (e = this.onAvatarState) == null || e.call(this, M.playing), this.startAudioMonitoringLoop(), y.logEvent("character_player", "info", {
|
|
4152
4140
|
characterId: this.avatar.id,
|
|
4153
4141
|
event: "audio_only_playback_started",
|
|
4154
|
-
|
|
4142
|
+
conversationId: this.getEffectiveConversationId() || void 0
|
|
4155
4143
|
});
|
|
4156
4144
|
} catch (n) {
|
|
4157
4145
|
const a = n instanceof Error ? n.message : String(n);
|
|
4158
|
-
throw h.error("[AvatarController] Failed to start audio-only playback:", a), (t = this.onError) == null || t.call(this, new
|
|
4146
|
+
throw h.error("[AvatarController] Failed to start audio-only playback:", a), (t = this.onError) == null || t.call(this, new Q("Failed to start audio-only playback", "AUDIO_ONLY_INIT_FAILED")), this.isPlaying = !1, this.isAudioOnlyMode = !1, n;
|
|
4159
4147
|
}
|
|
4160
4148
|
}
|
|
4161
4149
|
/**
|
|
@@ -4186,7 +4174,7 @@ class Ca {
|
|
|
4186
4174
|
const t = this.animationPlayer.getStreamingPlayer();
|
|
4187
4175
|
t == null || t.stop();
|
|
4188
4176
|
}
|
|
4189
|
-
this.emit("stopRendering"), this.isPlaying = !1, this.currentState =
|
|
4177
|
+
this.emit("stopRendering"), this.isPlaying = !1, this.currentState = M.idle, (e = this.onAvatarState) == null || e.call(this, M.idle);
|
|
4190
4178
|
}
|
|
4191
4179
|
/**
|
|
4192
4180
|
* Clean up players
|
|
@@ -4198,7 +4186,7 @@ class Ca {
|
|
|
4198
4186
|
* Add audio chunk to buffer
|
|
4199
4187
|
*/
|
|
4200
4188
|
addAudioChunkToBuffer(e, t) {
|
|
4201
|
-
if (this.animationPlayer || (this.animationPlayer = new
|
|
4189
|
+
if (this.animationPlayer || (this.animationPlayer = new ae()), this.isPlaying && this.animationPlayer.isStreamingReady())
|
|
4202
4190
|
this.animationPlayer.addAudioChunk(e, t);
|
|
4203
4191
|
else {
|
|
4204
4192
|
if (this.pendingAudioChunks.length >= this.MAX_PENDING_AUDIO_CHUNKS) {
|
|
@@ -4222,7 +4210,7 @@ class Ca {
|
|
|
4222
4210
|
n && n.forEach((a) => a(t));
|
|
4223
4211
|
}
|
|
4224
4212
|
}
|
|
4225
|
-
function
|
|
4213
|
+
function ar(r) {
|
|
4226
4214
|
if (r instanceof Error)
|
|
4227
4215
|
return r.message;
|
|
4228
4216
|
if (typeof r == "string")
|
|
@@ -4240,7 +4228,7 @@ function ir(r) {
|
|
|
4240
4228
|
}
|
|
4241
4229
|
async function _a(r) {
|
|
4242
4230
|
try {
|
|
4243
|
-
const e = {}, t =
|
|
4231
|
+
const e = {}, t = y.appId, n = y.sessionToken;
|
|
4244
4232
|
t && (e["X-App-Id"] = t), n && (e.Authorization = `Bearer ${n}`);
|
|
4245
4233
|
const a = await fetch(r, {
|
|
4246
4234
|
headers: Object.keys(e).length > 0 ? e : void 0
|
|
@@ -4249,23 +4237,23 @@ async function _a(r) {
|
|
|
4249
4237
|
throw new Error(`HTTP ${a.status} ${a.statusText}`);
|
|
4250
4238
|
return await a.arrayBuffer();
|
|
4251
4239
|
} catch (e) {
|
|
4252
|
-
const t =
|
|
4240
|
+
const t = ar(e);
|
|
4253
4241
|
throw new Error(`[downloadResource] ${r} → ${t}`);
|
|
4254
4242
|
}
|
|
4255
4243
|
}
|
|
4256
|
-
const Pa = 50,
|
|
4257
|
-
async function
|
|
4258
|
-
const e =
|
|
4244
|
+
const Pa = 50, re = /* @__PURE__ */ new Map();
|
|
4245
|
+
async function Ne(r) {
|
|
4246
|
+
const e = re.get(r);
|
|
4259
4247
|
if (e)
|
|
4260
|
-
return
|
|
4248
|
+
return re.delete(r), re.set(r, e), e;
|
|
4261
4249
|
const t = await _a(r);
|
|
4262
|
-
if (
|
|
4263
|
-
const n =
|
|
4264
|
-
n &&
|
|
4250
|
+
if (re.size >= Pa) {
|
|
4251
|
+
const n = re.keys().next().value;
|
|
4252
|
+
n && re.delete(n);
|
|
4265
4253
|
}
|
|
4266
|
-
return
|
|
4254
|
+
return re.set(r, t), t;
|
|
4267
4255
|
}
|
|
4268
|
-
class
|
|
4256
|
+
class ir {
|
|
4269
4257
|
constructor(e = "/") {
|
|
4270
4258
|
d(this, "baseAssetsPath");
|
|
4271
4259
|
this.baseAssetsPath = e;
|
|
@@ -4275,7 +4263,7 @@ class sr {
|
|
|
4275
4263
|
* Falls back to global CDN config if not provided by API
|
|
4276
4264
|
*/
|
|
4277
4265
|
async loadTemplateResources(e, t = null) {
|
|
4278
|
-
var c, u, m,
|
|
4266
|
+
var c, u, m, v;
|
|
4279
4267
|
if (!(e && Object.keys(e).length > 0))
|
|
4280
4268
|
return h.log("⚠️ FLAME resources not provided in CharacterMeta, using global CDN config"), this.loadGlobalFlameResources(t);
|
|
4281
4269
|
h.log("✅ Using FLAME resources from CharacterMeta API");
|
|
@@ -4293,25 +4281,25 @@ class sr {
|
|
|
4293
4281
|
resourceName: "teeth.pb"
|
|
4294
4282
|
},
|
|
4295
4283
|
teethNpz: {
|
|
4296
|
-
url: (
|
|
4284
|
+
url: (v = e.teethNpz) == null ? void 0 : v.remote,
|
|
4297
4285
|
resourceName: "teeth.npz"
|
|
4298
4286
|
}
|
|
4299
4287
|
}, i = Object.keys(a).length;
|
|
4300
4288
|
let s = 0;
|
|
4301
|
-
const o = (
|
|
4289
|
+
const o = (S, A) => {
|
|
4302
4290
|
t && (A && s++, t({
|
|
4303
4291
|
stage: "template",
|
|
4304
|
-
filename:
|
|
4292
|
+
filename: S,
|
|
4305
4293
|
loaded: s,
|
|
4306
4294
|
total: i,
|
|
4307
4295
|
progress: Math.round(s / i * 100)
|
|
4308
4296
|
}));
|
|
4309
|
-
}, l = {}, p = Object.entries(a).map(async ([
|
|
4297
|
+
}, l = {}, p = Object.entries(a).map(async ([S, { url: A, resourceName: b }]) => {
|
|
4310
4298
|
if (!A)
|
|
4311
|
-
throw new Error(`[loadTemplateResources] Missing CDN URL for ${
|
|
4312
|
-
o(
|
|
4313
|
-
const E = await
|
|
4314
|
-
h.log(`✅ ${
|
|
4299
|
+
throw new Error(`[loadTemplateResources] Missing CDN URL for ${S} (${b})`);
|
|
4300
|
+
o(b, !1), h.log(`📥 Loading ${S} from API CDN: ${A}`);
|
|
4301
|
+
const E = await Ne(A);
|
|
4302
|
+
h.log(`✅ ${S} loaded: ${E.byteLength} bytes`), l[S] = E, o(b, !0);
|
|
4315
4303
|
});
|
|
4316
4304
|
return await Promise.all(p), l;
|
|
4317
4305
|
}
|
|
@@ -4350,8 +4338,8 @@ class sr {
|
|
|
4350
4338
|
}));
|
|
4351
4339
|
}, l = {}, p = Object.entries(a).map(async ([c, { url: u, resourceName: m }]) => {
|
|
4352
4340
|
o(m, !1), h.log(`📥 Loading ${c} from global CDN: ${u}`);
|
|
4353
|
-
const
|
|
4354
|
-
h.log(`✅ ${c} loaded: ${
|
|
4341
|
+
const v = await Ne(u);
|
|
4342
|
+
h.log(`✅ ${c} loaded: ${v.byteLength} bytes`), l[c] = v, o(m, !0);
|
|
4355
4343
|
});
|
|
4356
4344
|
return await Promise.all(p), l;
|
|
4357
4345
|
}
|
|
@@ -4367,7 +4355,7 @@ class sr {
|
|
|
4367
4355
|
}
|
|
4368
4356
|
try {
|
|
4369
4357
|
h.log(`📥 Loading camera info from: ${t}`);
|
|
4370
|
-
const i = {}, s =
|
|
4358
|
+
const i = {}, s = y.appId, o = y.sessionToken;
|
|
4371
4359
|
s && (i["X-App-Id"] = s), o && (i.Authorization = `Bearer ${o}`);
|
|
4372
4360
|
const l = await fetch(t, {
|
|
4373
4361
|
headers: Object.keys(i).length > 0 ? i : void 0
|
|
@@ -4385,77 +4373,76 @@ class sr {
|
|
|
4385
4373
|
* Load character data from CharacterMeta (iOS compatible)
|
|
4386
4374
|
*/
|
|
4387
4375
|
async loadCharacterData(e, t) {
|
|
4388
|
-
var
|
|
4389
|
-
const {
|
|
4390
|
-
if (!
|
|
4391
|
-
const
|
|
4392
|
-
throw
|
|
4376
|
+
var v, S, A, b, E, B, _, X, G;
|
|
4377
|
+
const { progressCallback: n = null } = t || {}, a = (A = (S = (v = e.models) == null ? void 0 : v.shape) == null ? void 0 : S.resource) == null ? void 0 : A.remote, i = (B = (E = (b = e.models) == null ? void 0 : b.gsStandard) == null ? void 0 : E.resource) == null ? void 0 : B.remote, s = (G = (X = (_ = e.animations) == null ? void 0 : _.frameIdle) == null ? void 0 : X.resource) == null ? void 0 : G.remote;
|
|
4378
|
+
if (!a || !i) {
|
|
4379
|
+
const R = "Missing required resources: shape or gsStandard (point cloud)";
|
|
4380
|
+
throw y.logEvent("character_load", "error", {
|
|
4393
4381
|
characterId: e.characterId ?? "unknown",
|
|
4394
4382
|
stage: "resource_validation",
|
|
4395
|
-
reason:
|
|
4396
|
-
}), new Error(
|
|
4383
|
+
reason: R
|
|
4384
|
+
}), new Error(R);
|
|
4397
4385
|
}
|
|
4398
|
-
const
|
|
4399
|
-
{ key: "shape", url:
|
|
4400
|
-
{ key: "pointCloud", url:
|
|
4386
|
+
const o = [
|
|
4387
|
+
{ key: "shape", url: a, filename: "shape.pb" },
|
|
4388
|
+
{ key: "pointCloud", url: i, filename: "point_cloud.ply" }
|
|
4401
4389
|
];
|
|
4402
|
-
|
|
4403
|
-
let
|
|
4404
|
-
const
|
|
4405
|
-
|
|
4390
|
+
s && o.push({ key: "idleAnimation", url: s, filename: "idle.pb", optional: !0 });
|
|
4391
|
+
let l = 0;
|
|
4392
|
+
const p = o.length, c = (R, z) => {
|
|
4393
|
+
n && (z && l++, n({
|
|
4406
4394
|
stage: "character",
|
|
4407
|
-
filename:
|
|
4408
|
-
loaded:
|
|
4409
|
-
total:
|
|
4410
|
-
progress: Math.round(
|
|
4395
|
+
filename: R,
|
|
4396
|
+
loaded: l,
|
|
4397
|
+
total: p,
|
|
4398
|
+
progress: Math.round(l / p * 100)
|
|
4411
4399
|
}));
|
|
4412
|
-
},
|
|
4413
|
-
|
|
4400
|
+
}, u = {}, m = o.map(async ({ key: R, url: z, filename: W, optional: Y }) => {
|
|
4401
|
+
c(W, !1);
|
|
4414
4402
|
try {
|
|
4415
|
-
const
|
|
4416
|
-
return
|
|
4417
|
-
} catch (
|
|
4418
|
-
if (!
|
|
4419
|
-
throw
|
|
4420
|
-
return h.warn(`⚠️ Optional resource ${
|
|
4403
|
+
const V = await Ne(z);
|
|
4404
|
+
return R === "shape" ? u.shape = V : R === "pointCloud" ? u.pointCloud = V : R === "idleAnimation" && (u.idleAnimation = V), c(W, !0), { key: R, success: !0 };
|
|
4405
|
+
} catch (V) {
|
|
4406
|
+
if (!Y)
|
|
4407
|
+
throw V;
|
|
4408
|
+
return h.warn(`⚠️ Optional resource ${W} failed to load:`, V), c(W, !0), { key: R, success: !1 };
|
|
4421
4409
|
}
|
|
4422
4410
|
});
|
|
4423
|
-
if (await Promise.all(
|
|
4424
|
-
const
|
|
4425
|
-
throw
|
|
4411
|
+
if (await Promise.all(m), !u.shape || !u.pointCloud) {
|
|
4412
|
+
const R = "Failed to load character data";
|
|
4413
|
+
throw y.logEvent("character_load", "error", {
|
|
4426
4414
|
characterId: e.characterId ?? "unknown",
|
|
4427
4415
|
stage: "download",
|
|
4428
|
-
reason:
|
|
4429
|
-
}), new Error(
|
|
4416
|
+
reason: R
|
|
4417
|
+
}), new Error(R);
|
|
4430
4418
|
}
|
|
4431
|
-
return
|
|
4419
|
+
return u;
|
|
4432
4420
|
}
|
|
4433
4421
|
/**
|
|
4434
4422
|
* Preload all resources (template + character data + camera info + settings)
|
|
4435
4423
|
*/
|
|
4436
4424
|
async preloadResources(e, t) {
|
|
4437
|
-
const {
|
|
4438
|
-
this.loadTemplateResources(e.flame, (
|
|
4439
|
-
|
|
4440
|
-
...
|
|
4441
|
-
stage: `template-${
|
|
4425
|
+
const { progressCallback: n = null } = t || {}, [a, i, s] = await Promise.all([
|
|
4426
|
+
this.loadTemplateResources(e.flame, (o) => {
|
|
4427
|
+
n && n({
|
|
4428
|
+
...o,
|
|
4429
|
+
stage: `template-${o.stage}`
|
|
4442
4430
|
});
|
|
4443
4431
|
}),
|
|
4444
4432
|
this.loadCharacterData(e, {
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
stage: `character-${l.stage}`
|
|
4433
|
+
progressCallback: (o) => {
|
|
4434
|
+
n && n({
|
|
4435
|
+
...o,
|
|
4436
|
+
stage: `character-${o.stage}`
|
|
4450
4437
|
});
|
|
4451
4438
|
}
|
|
4452
4439
|
}),
|
|
4453
4440
|
this.loadCameraSettings(e)
|
|
4454
4441
|
]);
|
|
4455
4442
|
return {
|
|
4456
|
-
templateResources:
|
|
4457
|
-
characterData:
|
|
4458
|
-
preloadCameraSettings:
|
|
4443
|
+
templateResources: a,
|
|
4444
|
+
characterData: i,
|
|
4445
|
+
preloadCameraSettings: s,
|
|
4459
4446
|
characterSettings: e.characterSettings
|
|
4460
4447
|
};
|
|
4461
4448
|
}
|
|
@@ -4472,9 +4459,9 @@ class sr {
|
|
|
4472
4459
|
getSdkApiClient() {
|
|
4473
4460
|
return {
|
|
4474
4461
|
async request(e, t = {}) {
|
|
4475
|
-
const i =
|
|
4462
|
+
const i = y.getEnvironmentConfig().sdkApiBaseUrl + e, s = {
|
|
4476
4463
|
"Content-Type": "application/json"
|
|
4477
|
-
}, o =
|
|
4464
|
+
}, o = y.appId, l = y.sessionToken;
|
|
4478
4465
|
o && (s["X-App-Id"] = o), l && (s.Authorization = `Bearer ${l}`);
|
|
4479
4466
|
try {
|
|
4480
4467
|
const p = await fetch(i, {
|
|
@@ -4489,7 +4476,7 @@ class sr {
|
|
|
4489
4476
|
throw new Error(`HTTP ${p.status} ${p.statusText}`);
|
|
4490
4477
|
return p.json();
|
|
4491
4478
|
} catch (p) {
|
|
4492
|
-
const c =
|
|
4479
|
+
const c = ar(p);
|
|
4493
4480
|
throw new Error(`[SdkApiClient] ${i} → ${c}`);
|
|
4494
4481
|
}
|
|
4495
4482
|
}
|
|
@@ -4510,7 +4497,7 @@ class sr {
|
|
|
4510
4497
|
} catch (n) {
|
|
4511
4498
|
h.errorWithError("Failed to fetch character:", n);
|
|
4512
4499
|
const a = n && typeof n == "object" && "message" in n ? String(n.message) : "Failed to fetch character", i = n && typeof n == "object" && "data" in n && typeof n.data == "object" && ((t = n.data) != null && t.message) ? String(n.data.message) : null;
|
|
4513
|
-
throw
|
|
4500
|
+
throw y.logEvent("character_load", "error", {
|
|
4514
4501
|
characterId: e ?? "unknown",
|
|
4515
4502
|
stage: "fetch",
|
|
4516
4503
|
reason: i || a
|
|
@@ -4520,8 +4507,8 @@ class sr {
|
|
|
4520
4507
|
}
|
|
4521
4508
|
const Ea = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4522
4509
|
__proto__: null,
|
|
4523
|
-
AvatarDownloader:
|
|
4524
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4510
|
+
AvatarDownloader: ir
|
|
4511
|
+
}, Symbol.toStringTag, { value: "Module" })), ke = class ke {
|
|
4525
4512
|
constructor() {
|
|
4526
4513
|
d(this, "avatarDownloader", null);
|
|
4527
4514
|
}
|
|
@@ -4529,7 +4516,7 @@ const Ea = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4529
4516
|
* 通过全局单例来访问
|
|
4530
4517
|
*/
|
|
4531
4518
|
static get shared() {
|
|
4532
|
-
return this._instance || (this._instance = new
|
|
4519
|
+
return this._instance || (this._instance = new ke()), this._instance;
|
|
4533
4520
|
}
|
|
4534
4521
|
/**
|
|
4535
4522
|
* 加载数字人
|
|
@@ -4538,36 +4525,35 @@ const Ea = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4538
4525
|
* @param options 加载选项
|
|
4539
4526
|
* @returns Promise<Avatar>
|
|
4540
4527
|
*/
|
|
4541
|
-
async load(e, t
|
|
4528
|
+
async load(e, t) {
|
|
4542
4529
|
h.log(`[AvatarManager] Loading avatar with id: ${e}`);
|
|
4543
4530
|
try {
|
|
4544
|
-
if (!
|
|
4531
|
+
if (!y.isInitialized)
|
|
4545
4532
|
throw new Error("AvatarKit not initialized. Please call AvatarKit.initialize() first.");
|
|
4546
|
-
this.avatarDownloader || (this.avatarDownloader = new
|
|
4547
|
-
const
|
|
4548
|
-
h.log("[AvatarManager] Step 2: Downloading resources..."), t == null || t({ type:
|
|
4549
|
-
const
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
const l = 30 + o.progress / 100 * 70;
|
|
4533
|
+
this.avatarDownloader || (this.avatarDownloader = new ir()), h.log("[AvatarManager] Step 1: Fetching character metadata..."), t == null || t({ type: le.downloading, progress: 10 });
|
|
4534
|
+
const n = await this.avatarDownloader.getCharacterById(e);
|
|
4535
|
+
h.log("[AvatarManager] Step 2: Downloading resources..."), t == null || t({ type: le.downloading, progress: 30 });
|
|
4536
|
+
const a = await this.avatarDownloader.preloadResources(n, {
|
|
4537
|
+
progressCallback: (s) => {
|
|
4538
|
+
const o = 30 + s.progress / 100 * 70;
|
|
4553
4539
|
t == null || t({
|
|
4554
|
-
type:
|
|
4555
|
-
progress: Math.round(
|
|
4540
|
+
type: le.downloading,
|
|
4541
|
+
progress: Math.round(o)
|
|
4556
4542
|
});
|
|
4557
4543
|
}
|
|
4558
4544
|
});
|
|
4559
4545
|
h.log("[AvatarManager] Step 3: Creating Avatar instance...");
|
|
4560
|
-
const
|
|
4561
|
-
return h.log("[AvatarManager] Avatar loaded successfully"), t == null || t({ type:
|
|
4546
|
+
const i = new sn(e, n, a);
|
|
4547
|
+
return h.log("[AvatarManager] Avatar loaded successfully"), t == null || t({ type: le.completed }), y.logEvent("character_load", "info", {
|
|
4562
4548
|
characterId: e,
|
|
4563
4549
|
event: "load_success"
|
|
4564
|
-
}),
|
|
4565
|
-
} catch (
|
|
4566
|
-
const
|
|
4567
|
-
throw h.error("Failed to load avatar:",
|
|
4550
|
+
}), i;
|
|
4551
|
+
} catch (n) {
|
|
4552
|
+
const a = n instanceof Error ? n.message : String(n);
|
|
4553
|
+
throw h.error("Failed to load avatar:", a), y.logEvent("character_load", "error", {
|
|
4568
4554
|
characterId: e,
|
|
4569
|
-
reason:
|
|
4570
|
-
}), t == null || t({ type:
|
|
4555
|
+
reason: a
|
|
4556
|
+
}), t == null || t({ type: le.failed, error: n }), n;
|
|
4571
4557
|
}
|
|
4572
4558
|
}
|
|
4573
4559
|
/**
|
|
@@ -4577,55 +4563,55 @@ const Ea = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
4577
4563
|
this.avatarDownloader && this.avatarDownloader.clear();
|
|
4578
4564
|
}
|
|
4579
4565
|
};
|
|
4580
|
-
d(
|
|
4581
|
-
let
|
|
4582
|
-
const
|
|
4566
|
+
d(ke, "_instance", null);
|
|
4567
|
+
let Tt = ke, ge = null, Bt = null, Dt = null, Ot = null, Nt = null, Ut = null;
|
|
4568
|
+
const Ke = 2048, zt = Ke - 1;
|
|
4583
4569
|
function Ia(r, e, t) {
|
|
4584
4570
|
const a = r.length / 13;
|
|
4585
|
-
(!
|
|
4586
|
-
const i =
|
|
4571
|
+
(!ge || ge.length !== a) && (ge = new Float32Array(a), Bt = new Uint32Array(ge.buffer), Dt = new Uint32Array(a), Ot = new Uint32Array(a), Nt = new Uint32Array(a), Ut = new Uint32Array(Ke));
|
|
4572
|
+
const i = ge, s = Bt, o = Dt, l = Ot, p = Nt, c = Ut, u = e[0], m = e[1], v = e[2], S = t[0], A = t[1], b = t[2];
|
|
4587
4573
|
for (let E = 0; E < a; E++) {
|
|
4588
|
-
const
|
|
4589
|
-
i[E] = (r[
|
|
4574
|
+
const B = E * 13;
|
|
4575
|
+
i[E] = (r[B] - u) * S + (r[B + 1] - m) * A + (r[B + 2] - v) * b, o[E] = E;
|
|
4590
4576
|
}
|
|
4591
4577
|
for (let E = 0; E < a; E++) {
|
|
4592
|
-
const
|
|
4593
|
-
s[E] =
|
|
4578
|
+
const B = s[E];
|
|
4579
|
+
s[E] = B ^ (-(B >> 31) | 2147483648);
|
|
4594
4580
|
}
|
|
4595
|
-
|
|
4581
|
+
Ue(s, o, l, c, 0, a), Ue(s, l, o, c, 11, a), Ue(s, o, l, c, 22, a);
|
|
4596
4582
|
for (let E = 0; E < a; E++)
|
|
4597
4583
|
p[E] = l[a - 1 - E];
|
|
4598
4584
|
return p;
|
|
4599
4585
|
}
|
|
4600
|
-
function
|
|
4586
|
+
function Ue(r, e, t, n, a, i) {
|
|
4601
4587
|
n.fill(0);
|
|
4602
4588
|
for (let o = 0; o < i; o++) {
|
|
4603
|
-
const l = r[e[o]] >> a &
|
|
4589
|
+
const l = r[e[o]] >> a & zt;
|
|
4604
4590
|
n[l]++;
|
|
4605
4591
|
}
|
|
4606
4592
|
let s = 0;
|
|
4607
|
-
for (let o = 0; o <
|
|
4593
|
+
for (let o = 0; o < Ke; o++) {
|
|
4608
4594
|
const l = n[o];
|
|
4609
4595
|
n[o] = s, s += l;
|
|
4610
4596
|
}
|
|
4611
4597
|
for (let o = 0; o < i; o++) {
|
|
4612
|
-
const l = e[o], p = r[l] >> a &
|
|
4598
|
+
const l = e[o], p = r[l] >> a & zt;
|
|
4613
4599
|
t[n[p]++] = l;
|
|
4614
4600
|
}
|
|
4615
4601
|
}
|
|
4616
|
-
const
|
|
4617
|
-
let
|
|
4602
|
+
const _e = 13;
|
|
4603
|
+
let ve = null;
|
|
4618
4604
|
function ka(r, e) {
|
|
4619
|
-
const t = e.length, n = t *
|
|
4620
|
-
(!
|
|
4605
|
+
const t = e.length, n = t * _e;
|
|
4606
|
+
(!ve || ve.length !== n) && (ve = new Float32Array(n));
|
|
4621
4607
|
for (let a = 0; a < t; a++) {
|
|
4622
|
-
const s = e[a] *
|
|
4623
|
-
|
|
4624
|
-
r.subarray(s, s +
|
|
4608
|
+
const s = e[a] * _e, o = a * _e;
|
|
4609
|
+
ve.set(
|
|
4610
|
+
r.subarray(s, s + _e),
|
|
4625
4611
|
o
|
|
4626
4612
|
);
|
|
4627
4613
|
}
|
|
4628
|
-
return
|
|
4614
|
+
return ve;
|
|
4629
4615
|
}
|
|
4630
4616
|
const xa = `#version 300 es
|
|
4631
4617
|
precision highp float;
|
|
@@ -4657,7 +4643,7 @@ void main() {
|
|
|
4657
4643
|
// 预乘 alpha 输出(匹配 premultipliedAlpha: true)
|
|
4658
4644
|
// 颜色值需要乘以 alpha,这样 WebGL 才能正确混合
|
|
4659
4645
|
fragColor = vec4(v_color.rgb * alpha, alpha);
|
|
4660
|
-
}`,
|
|
4646
|
+
}`, Fa = `#version 300 es
|
|
4661
4647
|
precision highp float;
|
|
4662
4648
|
|
|
4663
4649
|
// 基础四边形顶点属性(共享4个顶点)
|
|
@@ -4825,7 +4811,7 @@ void main() {
|
|
|
4825
4811
|
v_relativePosition = relativeCoord * BOUNDS_RADIUS;
|
|
4826
4812
|
v_color = a_color;
|
|
4827
4813
|
}`;
|
|
4828
|
-
class
|
|
4814
|
+
class Ma {
|
|
4829
4815
|
// 跟踪当前 buffer 大小
|
|
4830
4816
|
constructor(e, t) {
|
|
4831
4817
|
d(this, "canvas");
|
|
@@ -5017,7 +5003,7 @@ class Fa {
|
|
|
5017
5003
|
const t = e.createShader(e.VERTEX_SHADER);
|
|
5018
5004
|
if (!t)
|
|
5019
5005
|
throw new Error("Failed to create vertex shader");
|
|
5020
|
-
if (e.shaderSource(t,
|
|
5006
|
+
if (e.shaderSource(t, Fa), e.compileShader(t), !e.getShaderParameter(t, e.COMPILE_STATUS)) {
|
|
5021
5007
|
const i = e.getShaderInfoLog(t);
|
|
5022
5008
|
throw e.deleteShader(t), new Error(`Vertex shader compilation failed: ${i}`);
|
|
5023
5009
|
}
|
|
@@ -5053,7 +5039,7 @@ class Fa {
|
|
|
5053
5039
|
this.gl = null, this.isInitialized = !1;
|
|
5054
5040
|
}
|
|
5055
5041
|
}
|
|
5056
|
-
const
|
|
5042
|
+
const La = `/**
|
|
5057
5043
|
* WebGPU 3DGS 渲染着色器
|
|
5058
5044
|
*
|
|
5059
5045
|
* 实例化渲染:每个 splat 绘制一个四边形
|
|
@@ -5316,7 +5302,7 @@ fn fragmentMain(input: VertexOutput) -> @location(0) vec4f {
|
|
|
5316
5302
|
return vec4f(input.color.rgb * alpha, alpha);
|
|
5317
5303
|
}
|
|
5318
5304
|
`;
|
|
5319
|
-
class
|
|
5305
|
+
class Ra {
|
|
5320
5306
|
constructor(e, t) {
|
|
5321
5307
|
d(this, "canvas");
|
|
5322
5308
|
d(this, "backgroundColor");
|
|
@@ -5403,7 +5389,7 @@ class La {
|
|
|
5403
5389
|
return;
|
|
5404
5390
|
const e = this.device.createShaderModule({
|
|
5405
5391
|
label: "3DGS Render Shader",
|
|
5406
|
-
code:
|
|
5392
|
+
code: La
|
|
5407
5393
|
}), t = this.device.createBindGroupLayout({
|
|
5408
5394
|
label: "Uniform Bind Group Layout",
|
|
5409
5395
|
entries: [
|
|
@@ -5633,12 +5619,12 @@ class Ta {
|
|
|
5633
5619
|
const { preferBackend: e, backgroundColor: t = [0, 0, 0, 0] } = this.options;
|
|
5634
5620
|
if (e !== "webgl" && await this.checkWebGPUSupport())
|
|
5635
5621
|
try {
|
|
5636
|
-
this.renderer = new
|
|
5622
|
+
this.renderer = new Ra(this.canvas, t), await this.renderer.initialize(), this.backend = "webgpu", h.log("✅ Using WebGPU renderer"), this.updateCameraAspect();
|
|
5637
5623
|
return;
|
|
5638
5624
|
} catch (a) {
|
|
5639
5625
|
h.warn("⚠️ WebGPU init failed, fallback to WebGL:", a);
|
|
5640
5626
|
}
|
|
5641
|
-
this.renderer = new
|
|
5627
|
+
this.renderer = new Ma(this.canvas, t), await this.renderer.initialize(), this.backend = "webgl", h.log("✅ Using WebGL renderer"), this.updateCameraAspect();
|
|
5642
5628
|
}
|
|
5643
5629
|
/**
|
|
5644
5630
|
* Load packed Splat data (zero-copy, GPU format)
|
|
@@ -5774,7 +5760,7 @@ class Ta {
|
|
|
5774
5760
|
s[0] = this.tempRight[0], s[1] = this.tempUp[0], s[2] = -this.tempForward[0], s[3] = 0, s[4] = this.tempRight[1], s[5] = this.tempUp[1], s[6] = -this.tempForward[1], s[7] = 0, s[8] = this.tempRight[2], s[9] = this.tempUp[2], s[10] = -this.tempForward[2], s[11] = 0, s[12] = o, s[13] = l, s[14] = p, s[15] = 1;
|
|
5775
5761
|
}
|
|
5776
5762
|
}
|
|
5777
|
-
function
|
|
5763
|
+
function ne(r, e, t) {
|
|
5778
5764
|
const n = Math.min(r.length, e.length), a = Array.from({ length: n });
|
|
5779
5765
|
for (let i = 0; i < n; i++)
|
|
5780
5766
|
a[i] = r[i] + (e[i] - r[i]) * t;
|
|
@@ -5783,16 +5769,16 @@ function oe(r, e, t) {
|
|
|
5783
5769
|
function Ba(r, e, t) {
|
|
5784
5770
|
const n = 0.5 - Math.cos(t * Math.PI) * 0.5;
|
|
5785
5771
|
return {
|
|
5786
|
-
translation:
|
|
5787
|
-
rotation:
|
|
5788
|
-
neckPose:
|
|
5789
|
-
jawPose:
|
|
5790
|
-
eyePose:
|
|
5772
|
+
translation: ne(r.translation || [0, 0, 0], e.translation || [0, 0, 0], n),
|
|
5773
|
+
rotation: ne(r.rotation || [0, 0, 0], e.rotation || [0, 0, 0], n),
|
|
5774
|
+
neckPose: ne(r.neckPose || [0, 0, 0], e.neckPose || [0, 0, 0], n),
|
|
5775
|
+
jawPose: ne(r.jawPose || [0, 0, 0], e.jawPose || [0, 0, 0], n),
|
|
5776
|
+
eyePose: ne(r.eyePose || [0, 0, 0, 0, 0, 0], e.eyePose || [0, 0, 0, 0, 0, 0], n),
|
|
5791
5777
|
eyeLid: (() => {
|
|
5792
5778
|
const a = r.eyeLid, i = e.eyeLid;
|
|
5793
|
-
return a && a.length > 0 && i && i.length > 0 ?
|
|
5779
|
+
return a && a.length > 0 && i && i.length > 0 ? ne(a, i, n) : a || i || [];
|
|
5794
5780
|
})(),
|
|
5795
|
-
expression:
|
|
5781
|
+
expression: ne(r.expression || [], e.expression || [], n)
|
|
5796
5782
|
};
|
|
5797
5783
|
}
|
|
5798
5784
|
function Da(r, e, t, n = 25) {
|
|
@@ -5803,7 +5789,7 @@ function Da(r, e, t, n = 25) {
|
|
|
5803
5789
|
}
|
|
5804
5790
|
return i;
|
|
5805
5791
|
}
|
|
5806
|
-
class
|
|
5792
|
+
class Ua {
|
|
5807
5793
|
/**
|
|
5808
5794
|
* 构造函数
|
|
5809
5795
|
* 创建统一的 AvatarController,内部根据配置自动组合网络层
|
|
@@ -5850,10 +5836,10 @@ class Va {
|
|
|
5850
5836
|
d(this, "characterHandle", null);
|
|
5851
5837
|
d(this, "characterId");
|
|
5852
5838
|
this.avatar = e, this.characterId = `${e.id}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
5853
|
-
const n =
|
|
5839
|
+
const n = y.configuration;
|
|
5854
5840
|
if (!n)
|
|
5855
5841
|
throw new Error("AvatarKit must be initialized before creating AvatarView. Call AvatarKit.initialize() first.");
|
|
5856
|
-
const i = (n.drivingServiceMode ??
|
|
5842
|
+
const i = (n.drivingServiceMode ?? ze.sdk) === ze.sdk ? me.network : me.external;
|
|
5857
5843
|
this.playbackMode = i, this.avatarController = new Ca(e, {
|
|
5858
5844
|
playbackMode: i
|
|
5859
5845
|
}), this.avatarController.setRenderCallback((s, o) => {
|
|
@@ -5907,11 +5893,11 @@ class Va {
|
|
|
5907
5893
|
*/
|
|
5908
5894
|
async getCachedIdleFirstFrame() {
|
|
5909
5895
|
if (!this.cachedIdleFirstFrame) {
|
|
5910
|
-
const e =
|
|
5896
|
+
const e = y.getAvatarCore();
|
|
5911
5897
|
if (e)
|
|
5912
5898
|
try {
|
|
5913
5899
|
const t = await e.getCurrentFrameParams(0, this.characterId);
|
|
5914
|
-
this.cachedIdleFirstFrame =
|
|
5900
|
+
this.cachedIdleFirstFrame = ht(t);
|
|
5915
5901
|
} catch (t) {
|
|
5916
5902
|
h.warn("[AvatarView] Failed to get idle first frame:", t instanceof Error ? t.message : String(t));
|
|
5917
5903
|
}
|
|
@@ -5947,7 +5933,7 @@ class Va {
|
|
|
5947
5933
|
async initializeView(e) {
|
|
5948
5934
|
try {
|
|
5949
5935
|
I.debug && h.log("[AvatarView] Initializing avatar view...");
|
|
5950
|
-
const t =
|
|
5936
|
+
const t = y.getAvatarCore();
|
|
5951
5937
|
if (!t)
|
|
5952
5938
|
throw new Error("AvatarCore not available. AvatarKit initialization may have failed.");
|
|
5953
5939
|
const n = e.getResources();
|
|
@@ -5955,7 +5941,7 @@ class Va {
|
|
|
5955
5941
|
n.characterData.shape,
|
|
5956
5942
|
n.characterData.pointCloud,
|
|
5957
5943
|
this.characterId
|
|
5958
|
-
), n.characterData.idleAnimation && (I.debug && h.log("[AvatarView] Loading idle animation..."), await t.loadAnimationFromBuffer(n.characterData.idleAnimation, this.characterId)), n.characterData.shape = new ArrayBuffer(0), n.characterData.pointCloud = new ArrayBuffer(0), n.characterData.idleAnimation && (n.characterData.idleAnimation = new ArrayBuffer(0)),
|
|
5944
|
+
), n.characterData.idleAnimation && (I.debug && h.log("[AvatarView] Loading idle animation..."), await t.loadAnimationFromBuffer(n.characterData.idleAnimation, this.characterId)), n.characterData.shape = new ArrayBuffer(0), n.characterData.pointCloud = new ArrayBuffer(0), n.characterData.idleAnimation && (n.characterData.idleAnimation = new ArrayBuffer(0)), this.avatarController.setRenderCallback(
|
|
5959
5945
|
(i, s) => {
|
|
5960
5946
|
this.renderRealtimeFrame(i, s);
|
|
5961
5947
|
},
|
|
@@ -5999,27 +5985,27 @@ class Va {
|
|
|
5999
5985
|
* 从角色设置中推导相机配置
|
|
6000
5986
|
*/
|
|
6001
5987
|
deriveCameraConfigFromSettings(e, t, n) {
|
|
6002
|
-
const a = (
|
|
5988
|
+
const a = (z, W) => Number.isFinite(z) ? z : W, i = a(e.translationX, t.position[0]), s = a(e.translationY, t.position[1]), o = a(e.translationZ, t.position[2]), l = a(e.rotation, 0), p = a(e.fovYRadians, 0), c = Math.hypot(i, s, o) > 1e-4, u = p > 0, m = Math.abs(l) > 1e-4;
|
|
6003
5989
|
if (!c && !u && !m)
|
|
6004
5990
|
return h.warn(`[AvatarView] Camera settings from ${n} appear empty, falling back to default config`), t;
|
|
6005
|
-
const
|
|
6006
|
-
-
|
|
5991
|
+
const v = Math.sin(l), S = Math.cos(l), A = c ? [i, s, o] : [...t.position], b = [
|
|
5992
|
+
-v,
|
|
6007
5993
|
0,
|
|
6008
|
-
-
|
|
6009
|
-
], E = Math.hypot(
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
5994
|
+
-S
|
|
5995
|
+
], E = Math.hypot(b[0], b[1], b[2]) || 1, B = [
|
|
5996
|
+
b[0] / E,
|
|
5997
|
+
b[1] / E,
|
|
5998
|
+
b[2] / E
|
|
6013
5999
|
], _ = [
|
|
6014
|
-
A[0] +
|
|
6015
|
-
A[1] +
|
|
6016
|
-
A[2] +
|
|
6017
|
-
],
|
|
6000
|
+
A[0] + B[0],
|
|
6001
|
+
A[1] + B[1],
|
|
6002
|
+
A[2] + B[2]
|
|
6003
|
+
], X = [0, 1, 0], G = u ? p * 180 / Math.PI : t.fov, R = {
|
|
6018
6004
|
...t,
|
|
6019
6005
|
// 自动继承 near/far 等配置(来自 APP_CONFIG.camera)
|
|
6020
6006
|
position: A,
|
|
6021
6007
|
target: _,
|
|
6022
|
-
up:
|
|
6008
|
+
up: X,
|
|
6023
6009
|
fov: G
|
|
6024
6010
|
// near/far 从 fallback 继承,无需硬编码
|
|
6025
6011
|
};
|
|
@@ -6030,9 +6016,9 @@ class Va {
|
|
|
6030
6016
|
position: A,
|
|
6031
6017
|
target: _,
|
|
6032
6018
|
fov: G,
|
|
6033
|
-
near:
|
|
6034
|
-
far:
|
|
6035
|
-
}),
|
|
6019
|
+
near: R.near,
|
|
6020
|
+
far: R.far
|
|
6021
|
+
}), R;
|
|
6036
6022
|
}
|
|
6037
6023
|
/**
|
|
6038
6024
|
* 渲染第一帧
|
|
@@ -6040,7 +6026,7 @@ class Va {
|
|
|
6040
6026
|
async renderFirstFrame() {
|
|
6041
6027
|
if (!this.renderSystem)
|
|
6042
6028
|
throw new Error("Render system not initialized");
|
|
6043
|
-
const e =
|
|
6029
|
+
const e = y.getAvatarCore();
|
|
6044
6030
|
if (!e)
|
|
6045
6031
|
throw new Error("AvatarCore not available");
|
|
6046
6032
|
const t = {
|
|
@@ -6096,7 +6082,7 @@ class Va {
|
|
|
6096
6082
|
return;
|
|
6097
6083
|
}
|
|
6098
6084
|
e = i;
|
|
6099
|
-
const s =
|
|
6085
|
+
const s = y.getAvatarCore();
|
|
6100
6086
|
if (!s)
|
|
6101
6087
|
return;
|
|
6102
6088
|
const o = await s.computeCompleteFrameFlat({ frameIndex: this.idleCurrentFrameIndex }, this.characterHandle ?? void 0);
|
|
@@ -6136,10 +6122,10 @@ class Va {
|
|
|
6136
6122
|
this.realtimeAnimationLoopId = requestAnimationFrame(a);
|
|
6137
6123
|
return;
|
|
6138
6124
|
}
|
|
6139
|
-
const o = performance.now() - this.transitionStartTime, l = Math.min(1, Math.max(0, o / this.transitionDurationMs)), p = this.transitionKeyframes.length, c = Math.min(p - 1, Math.floor(l * (p - 1))), u = this.transitionKeyframes[c], m =
|
|
6140
|
-
if (
|
|
6141
|
-
const
|
|
6142
|
-
|
|
6125
|
+
const o = performance.now() - this.transitionStartTime, l = Math.min(1, Math.max(0, o / this.transitionDurationMs)), p = this.transitionKeyframes.length, c = Math.min(p - 1, Math.floor(l * (p - 1))), u = this.transitionKeyframes[c], m = Vt(u), v = y.getAvatarCore();
|
|
6126
|
+
if (v) {
|
|
6127
|
+
const S = await v.computeFrameFlatFromParams(m, this.characterHandle ?? void 0);
|
|
6128
|
+
S && (this.renderSystem.loadSplatsFromPackedData(S), this.renderSystem.renderFrame());
|
|
6143
6129
|
}
|
|
6144
6130
|
if (l >= 1) {
|
|
6145
6131
|
if (s === "transitioningToSpeaking")
|
|
@@ -6267,11 +6253,11 @@ class Va {
|
|
|
6267
6253
|
/* TransitioningToSpeaking */
|
|
6268
6254
|
);
|
|
6269
6255
|
try {
|
|
6270
|
-
const n =
|
|
6256
|
+
const n = y.getAvatarCore();
|
|
6271
6257
|
if (n && e.length > 0) {
|
|
6272
6258
|
if (this.renderingState !== "transitioningToSpeaking")
|
|
6273
6259
|
return;
|
|
6274
|
-
const a = await n.getCurrentFrameParams(this.idleCurrentFrameIndex, this.characterId), i =
|
|
6260
|
+
const a = await n.getCurrentFrameParams(this.idleCurrentFrameIndex, this.characterId), i = ht(a);
|
|
6275
6261
|
await this.getCachedIdleFirstFrame();
|
|
6276
6262
|
const s = e[0];
|
|
6277
6263
|
this.transitionKeyframes = this.generateAndAlignTransitionFrames(i, s), this.transitionStartTime = performance.now(), this.transitionKeyframes.length === 0 ? (this.setState(
|
|
@@ -6291,7 +6277,7 @@ class Va {
|
|
|
6291
6277
|
* 开始实时渲染循环
|
|
6292
6278
|
*/
|
|
6293
6279
|
startRealtimeRendering() {
|
|
6294
|
-
I.debug && h.log("[AvatarView] Starting realtime rendering with", this.currentKeyframes.length, "keyframes"),
|
|
6280
|
+
I.debug && h.log("[AvatarView] Starting realtime rendering with", this.currentKeyframes.length, "keyframes"), y.logEvent("character_view", "info", {
|
|
6295
6281
|
characterId: this.avatar.id,
|
|
6296
6282
|
event: "rendering_started",
|
|
6297
6283
|
keyframesCount: this.currentKeyframes.length
|
|
@@ -6317,7 +6303,7 @@ class Va {
|
|
|
6317
6303
|
try {
|
|
6318
6304
|
if (this.renderingState !== "transitioningToIdle")
|
|
6319
6305
|
return;
|
|
6320
|
-
if (
|
|
6306
|
+
if (y.getAvatarCore() && this.currentKeyframes.length > 0) {
|
|
6321
6307
|
const n = this.lastRealtimeProtoFrame || this.currentKeyframes[Math.max(0, this.lastRenderedFrameIndex)], a = await this.getCachedIdleFirstFrame();
|
|
6322
6308
|
if (a && (this.transitionKeyframes = this.generateAndAlignTransitionFrames(n, a), this.transitionStartTime = performance.now(), this.transitionKeyframes.length > 0 && this.renderingState === "transitioningToIdle")) {
|
|
6323
6309
|
I.debug && h.log("[AvatarView] Return transition started:", this.transitionKeyframes.length, "frames"), this.realtimeAnimationLoopId || this.startRealtimeAnimationLoop();
|
|
@@ -6339,14 +6325,14 @@ class Va {
|
|
|
6339
6325
|
* 关闭 avatarController 并清理所有相关资源
|
|
6340
6326
|
*/
|
|
6341
6327
|
dispose() {
|
|
6342
|
-
I.debug && h.log("[AvatarView] Disposing avatar view..."),
|
|
6328
|
+
I.debug && h.log("[AvatarView] Disposing avatar view..."), y.logEvent("character_view", "info", {
|
|
6343
6329
|
characterId: this.avatar.id,
|
|
6344
6330
|
event: "disposed"
|
|
6345
6331
|
}), this.avatarController && (this.avatarController.clear(), this.avatarController.dispose()), this.stopAllAnimationLoops(), this.setState(
|
|
6346
6332
|
"idle"
|
|
6347
6333
|
/* Idle */
|
|
6348
6334
|
), this.cachedIdleFirstFrame = null, this.idleCurrentFrameIndex = 0;
|
|
6349
|
-
const e =
|
|
6335
|
+
const e = y.getAvatarCore();
|
|
6350
6336
|
if (e && this.characterHandle)
|
|
6351
6337
|
try {
|
|
6352
6338
|
e.removeCharacter(this.characterHandle, this.characterId), I.debug && h.log("[AvatarView] AvatarCore character resources released"), this.characterHandle = null;
|
|
@@ -6392,23 +6378,21 @@ class Va {
|
|
|
6392
6378
|
}
|
|
6393
6379
|
export {
|
|
6394
6380
|
I as A,
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
6398
|
-
|
|
6381
|
+
ye as C,
|
|
6382
|
+
ze as D,
|
|
6383
|
+
ie as E,
|
|
6384
|
+
le as L,
|
|
6399
6385
|
on as R,
|
|
6400
|
-
|
|
6401
|
-
|
|
6386
|
+
Q as S,
|
|
6387
|
+
y as a,
|
|
6402
6388
|
sn as b,
|
|
6403
6389
|
Ca as c,
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6390
|
+
Tt as d,
|
|
6391
|
+
ar as e,
|
|
6392
|
+
Ua as f,
|
|
6393
|
+
M as g,
|
|
6394
|
+
me as h,
|
|
6409
6395
|
Na as i,
|
|
6410
|
-
Ua as j,
|
|
6411
|
-
za as k,
|
|
6412
6396
|
h as l
|
|
6413
6397
|
};
|
|
6414
|
-
//# sourceMappingURL=index-
|
|
6398
|
+
//# sourceMappingURL=index-CRv3XrVE.js.map
|