@burdenoff/fe-libs 2026.1023.16 → 2026.1024.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared/assistant/avatar/live/LiveAvatarStage.js +5 -1
- package/dist/shared/assistant/avatar/live/LiveAvatarTabView.js +28 -25
- package/dist/shared/assistant/avatar/live/avatarSessionClient.d.ts +17 -1
- package/dist/shared/assistant/avatar/live/avatarSessionClient.js +81 -64
- package/dist/shared/assistant/avatar/live/createLiveAvatarSeam.d.ts +1 -1
- package/dist/shared/assistant/avatar/live/createLiveAvatarSeam.js +61 -50
- package/dist/shared/assistant/avatar/live/liveAvatarController.d.ts +25 -5
- package/dist/shared/assistant/avatar/live/liveAvatarController.js +166 -156
- package/dist/shared/assistant/avatar/live/liveAvatarStatus.d.ts +5 -3
- package/dist/shared/assistant/avatar/live/liveAvatarStatus.js +4 -3
- package/dist/shared/assistant/avatar/useAvatarCopy.d.ts +9 -3
- package/dist/shared/assistant/avatar/useAvatarCopy.js +7 -1
- package/dist/shared/assistant/i18nManifest.d.ts +4 -0
- package/dist/shared/assistant/i18nManifest.js +4 -0
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { createAvatarTransportPort as n } from "./avatarTransportPort.js";
|
|
|
3
3
|
import { createAvatarReplyOutputs as r } from "./avatarReplyOutputs.js";
|
|
4
4
|
import { AvatarApiError as i, avatarAvailabilityRefusal as a, avatarRefusalFor as o } from "./avatarSessionClient.js";
|
|
5
5
|
//#region src/shared/assistant/avatar/live/liveAvatarController.ts
|
|
6
|
-
var s = 12e4, c = 1e4, l = 8e3, ee = 5e3, u = 2e4,
|
|
6
|
+
var s = 12e4, c = 1e4, l = 8e3, ee = 5e3, u = 2e4, te = 1e3, d = {
|
|
7
7
|
voiceLive: !1,
|
|
8
8
|
offered: !1,
|
|
9
9
|
tabOpen: !1,
|
|
@@ -16,11 +16,12 @@ var s = 12e4, c = 1e4, l = 8e3, ee = 5e3, u = 2e4, d = 1e3, f = {
|
|
|
16
16
|
selectedAvatarId: null,
|
|
17
17
|
consentVersion: null,
|
|
18
18
|
problem: null,
|
|
19
|
+
budgetScope: null,
|
|
19
20
|
notice: null,
|
|
20
21
|
audioBlocked: !1,
|
|
21
22
|
videoReady: !1
|
|
22
23
|
};
|
|
23
|
-
function
|
|
24
|
+
function f(e) {
|
|
24
25
|
switch (e) {
|
|
25
26
|
case "permission_revoked": return {
|
|
26
27
|
problem: "unavailable",
|
|
@@ -56,53 +57,53 @@ function p(e) {
|
|
|
56
57
|
};
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
|
-
var
|
|
60
|
+
var p = new Set(["playback-blocked", "needs-hosted-voice"]), m = {
|
|
60
61
|
problem: "unavailable",
|
|
61
62
|
hide: !0
|
|
62
63
|
};
|
|
63
|
-
function
|
|
64
|
-
let { scheduler: c, preferences: l } = s, u = s.idleMs ?? 12e4,
|
|
65
|
-
...
|
|
64
|
+
function h(s) {
|
|
65
|
+
let { scheduler: c, preferences: l } = s, u = s.idleMs ?? 12e4, te = s.endBeforeDeadlineMs ?? 1e4, h = s.connectTimeoutMs ?? 2e4, g = s.requestTimeoutMs ?? 8e3, _ = {
|
|
66
|
+
...d,
|
|
66
67
|
tabOffered: s.browserSupported()
|
|
67
|
-
},
|
|
68
|
+
}, v = /* @__PURE__ */ new Set(), y = !1, b = null, x = 0, S = !1, C = !1, w = 0, T = null, E = null, D = [], O = 0, k = !1, A = "user", j = !1, M = !1, N = null, P = null, F = null, I = null, L = !1;
|
|
68
69
|
function R(e) {
|
|
69
70
|
try {
|
|
70
71
|
s.onLog?.(e);
|
|
71
72
|
} catch {}
|
|
72
73
|
}
|
|
73
74
|
function z() {
|
|
74
|
-
return !
|
|
75
|
+
return !y && s.browserSupported();
|
|
75
76
|
}
|
|
76
77
|
function ne(e, t) {
|
|
77
78
|
return (e || t) && z();
|
|
78
79
|
}
|
|
79
80
|
function B() {
|
|
80
|
-
return
|
|
81
|
+
return _.retryAt !== null && s.now() < _.retryAt;
|
|
81
82
|
}
|
|
82
83
|
function V(e) {
|
|
83
84
|
let t = {
|
|
84
|
-
...
|
|
85
|
+
..._,
|
|
85
86
|
...e
|
|
86
87
|
};
|
|
87
|
-
e.problem !== void 0 && e.retryAt === void 0 &&
|
|
88
|
+
e.problem !== void 0 && e.problem !== _.problem && (e.retryAt === void 0 && (t.retryAt = null), e.budgetScope === void 0 && (t.budgetScope = null));
|
|
88
89
|
let n = {
|
|
89
90
|
...t,
|
|
90
91
|
offered: ne(t.voiceLive, t.tabOpen),
|
|
91
92
|
tabOffered: z(),
|
|
92
93
|
heldByVoice: M && t.voiceLive
|
|
93
94
|
};
|
|
94
|
-
if (!Object.keys(n).every((e) => n[e] ===
|
|
95
|
-
n.retryAt !==
|
|
96
|
-
for (let e of [...
|
|
95
|
+
if (!Object.keys(n).every((e) => n[e] === _[e])) {
|
|
96
|
+
n.retryAt !== _.retryAt && (I?.(), I = null), _ = n;
|
|
97
|
+
for (let e of [...v]) try {
|
|
97
98
|
e();
|
|
98
99
|
} catch {}
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
function H() {
|
|
102
|
-
return
|
|
103
|
+
return k && !j ? "voice_end" : "user";
|
|
103
104
|
}
|
|
104
105
|
function U() {
|
|
105
|
-
l.getState().avatarEnabled !==
|
|
106
|
+
l.getState().avatarEnabled !== S && l.setAvatarEnabled(S);
|
|
106
107
|
}
|
|
107
108
|
let re = {
|
|
108
109
|
positionSec: null,
|
|
@@ -110,15 +111,15 @@ function g(s) {
|
|
|
110
111
|
rpc: "none"
|
|
111
112
|
}, W = r({
|
|
112
113
|
port: {
|
|
113
|
-
isActive: () =>
|
|
114
|
-
isAudioBlocked: () =>
|
|
115
|
-
connectionId: () =>
|
|
116
|
-
isMeterHealthy: () =>
|
|
117
|
-
isMeterAudible: () =>
|
|
118
|
-
openSegment: () =>
|
|
119
|
-
clearBuffer: (e) =>
|
|
120
|
-
setOutputMuted: (e) =>
|
|
121
|
-
subscribe: (e) =>
|
|
114
|
+
isActive: () => E !== null && E.port.isActive(),
|
|
115
|
+
isAudioBlocked: () => E?.port.isAudioBlocked() ?? !1,
|
|
116
|
+
connectionId: () => E?.port.connectionId() ?? 0,
|
|
117
|
+
isMeterHealthy: () => E?.port.isMeterHealthy() ?? !1,
|
|
118
|
+
isMeterAudible: () => E?.port.isMeterAudible() ?? !1,
|
|
119
|
+
openSegment: () => E ? E.port.openSegment() : Promise.reject(new e("connection")),
|
|
120
|
+
clearBuffer: (e) => E ? E.port.clearBuffer(e) : Promise.resolve(re),
|
|
121
|
+
setOutputMuted: (e) => E?.port.setOutputMuted(e),
|
|
122
|
+
subscribe: (e) => E ? E.port.subscribe(e) : () => void 0
|
|
122
123
|
},
|
|
123
124
|
scheduler: c,
|
|
124
125
|
decode: s.decode,
|
|
@@ -134,7 +135,7 @@ function g(s) {
|
|
|
134
135
|
V({ notice: "interrupted" });
|
|
135
136
|
return;
|
|
136
137
|
case "voice-fallback":
|
|
137
|
-
|
|
138
|
+
S && V({ notice: "voice-only" });
|
|
138
139
|
return;
|
|
139
140
|
case "audio-blocked":
|
|
140
141
|
V({
|
|
@@ -150,7 +151,7 @@ function g(s) {
|
|
|
150
151
|
P?.(), P = null;
|
|
151
152
|
return;
|
|
152
153
|
}
|
|
153
|
-
if (
|
|
154
|
+
if (C) {
|
|
154
155
|
K("user", { notice: "time-limit" });
|
|
155
156
|
return;
|
|
156
157
|
}
|
|
@@ -158,8 +159,8 @@ function g(s) {
|
|
|
158
159
|
}
|
|
159
160
|
});
|
|
160
161
|
function G() {
|
|
161
|
-
P?.(), P = null,
|
|
162
|
-
P = null,
|
|
162
|
+
P?.(), P = null, _.phase === "ready" && (P = c.setTimeout(() => {
|
|
163
|
+
P = null, _.phase === "ready" && !W.isBusy() && K("idle", {});
|
|
163
164
|
}, u));
|
|
164
165
|
}
|
|
165
166
|
function ie() {
|
|
@@ -167,8 +168,8 @@ function g(s) {
|
|
|
167
168
|
}
|
|
168
169
|
function ae() {
|
|
169
170
|
W.leave();
|
|
170
|
-
let e =
|
|
171
|
-
if (
|
|
171
|
+
let e = E;
|
|
172
|
+
if (E = null, e !== null) {
|
|
172
173
|
if (e.unsubscribe?.(), e.meter !== null) {
|
|
173
174
|
if (e.meterAudible) {
|
|
174
175
|
e.meterAudible = !1;
|
|
@@ -180,9 +181,9 @@ function g(s) {
|
|
|
180
181
|
}
|
|
181
182
|
}
|
|
182
183
|
function K(e, t) {
|
|
183
|
-
|
|
184
|
-
let n =
|
|
185
|
-
|
|
184
|
+
w += 1, A = e, S = !1, C = !1, M = !1, N = null, ae(), ie();
|
|
185
|
+
let n = T;
|
|
186
|
+
T = null, U(), n !== null && (R({
|
|
186
187
|
event: "session-ended",
|
|
187
188
|
reason: e
|
|
188
189
|
}), s.client()?.end(n, {
|
|
@@ -193,31 +194,39 @@ function g(s) {
|
|
|
193
194
|
closing: !1,
|
|
194
195
|
audioBlocked: !1,
|
|
195
196
|
videoReady: !1,
|
|
196
|
-
...t.problem === void 0 ?
|
|
197
|
+
...t.problem === void 0 ? _.problem !== null && p.has(_.problem) ? { problem: null } : {} : { problem: t.problem },
|
|
197
198
|
...t.notice === void 0 ? {} : { notice: t.notice }
|
|
198
199
|
});
|
|
199
200
|
}
|
|
200
201
|
function q(e) {
|
|
201
202
|
let t = o(e);
|
|
202
|
-
t.hide && (
|
|
203
|
+
t.hide && (y = !0), e instanceof i && R({
|
|
203
204
|
event: "refused",
|
|
204
205
|
status: e.status,
|
|
205
206
|
code: e.code
|
|
206
|
-
}),
|
|
207
|
+
}), S = !1, M = !1, N = null, U();
|
|
207
208
|
let n = t.retryAfterSeconds !== void 0 && t.retryAfterSeconds > 0 ? t.retryAfterSeconds * 1e3 : 0, r = n > 0 ? s.now() + n : null;
|
|
208
209
|
return V({
|
|
209
210
|
phase: "off",
|
|
210
211
|
problem: t.problem,
|
|
211
|
-
retryAt: r
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
retryAt: null
|
|
216
|
-
});
|
|
212
|
+
retryAt: r,
|
|
213
|
+
budgetScope: t.scope ?? null
|
|
214
|
+
}), r !== null && _.retryAt === r && (I = c.setTimeout(() => {
|
|
215
|
+
I = null, J(r);
|
|
217
216
|
}, n)), t;
|
|
218
217
|
}
|
|
219
|
-
function J(e
|
|
220
|
-
|
|
218
|
+
function J(e) {
|
|
219
|
+
_.retryAt === e && V({
|
|
220
|
+
problem: null,
|
|
221
|
+
retryAt: null
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
function Y() {
|
|
225
|
+
let e = _.retryAt;
|
|
226
|
+
L || e === null || B() || J(e);
|
|
227
|
+
}
|
|
228
|
+
function X(e = m) {
|
|
229
|
+
e.hide && (y = !0), S = !1, M = !1, N = null, U(), V({
|
|
221
230
|
phase: "off",
|
|
222
231
|
problem: e.problem,
|
|
223
232
|
retryAt: null,
|
|
@@ -227,7 +236,7 @@ function g(s) {
|
|
|
227
236
|
function oe(e) {
|
|
228
237
|
switch (e.type) {
|
|
229
238
|
case "audioPlayback":
|
|
230
|
-
e.canPlay ?
|
|
239
|
+
e.canPlay ? _.problem === "playback-blocked" ? V({
|
|
231
240
|
audioBlocked: !1,
|
|
232
241
|
problem: null
|
|
233
242
|
}) : V({ audioBlocked: !1 }) : V({
|
|
@@ -243,22 +252,22 @@ function g(s) {
|
|
|
243
252
|
}
|
|
244
253
|
}
|
|
245
254
|
async function se() {
|
|
246
|
-
let e =
|
|
247
|
-
if (e === null ||
|
|
248
|
-
let t =
|
|
255
|
+
let e = T;
|
|
256
|
+
if (e === null || _.phase === "ending" || _.phase === "off") return;
|
|
257
|
+
let t = w;
|
|
249
258
|
V({ phase: "ending" });
|
|
250
259
|
let n = null, r = !1;
|
|
251
260
|
try {
|
|
252
|
-
let t = s.client(), i = t === null ? void 0 : await
|
|
261
|
+
let t = s.client(), i = t === null ? void 0 : await le((n) => t.status(e, n));
|
|
253
262
|
n = i?.endedReason ?? null, r = i !== void 0 && [
|
|
254
263
|
"ended",
|
|
255
264
|
"failed",
|
|
256
265
|
"canceled"
|
|
257
266
|
].includes(i.state);
|
|
258
267
|
} catch {}
|
|
259
|
-
if (
|
|
260
|
-
let i =
|
|
261
|
-
i.hide && (
|
|
268
|
+
if (w !== t) return;
|
|
269
|
+
let i = f(n);
|
|
270
|
+
i.hide && (y = !0), r && (T = null, R({
|
|
262
271
|
event: "session-ended",
|
|
263
272
|
reason: "server"
|
|
264
273
|
})), K("client_error", i);
|
|
@@ -266,10 +275,10 @@ function g(s) {
|
|
|
266
275
|
async function ce(e, r) {
|
|
267
276
|
let i = s.client();
|
|
268
277
|
if (i === null) {
|
|
269
|
-
|
|
278
|
+
X();
|
|
270
279
|
return;
|
|
271
280
|
}
|
|
272
|
-
let a = ++
|
|
281
|
+
let a = ++w;
|
|
273
282
|
V({
|
|
274
283
|
phase: "starting",
|
|
275
284
|
problem: null,
|
|
@@ -279,103 +288,103 @@ function g(s) {
|
|
|
279
288
|
try {
|
|
280
289
|
o = await s.openRoom();
|
|
281
290
|
} catch {
|
|
282
|
-
|
|
291
|
+
w === a && X();
|
|
283
292
|
return;
|
|
284
293
|
}
|
|
285
294
|
let l = () => {
|
|
286
295
|
o.disconnect().catch(() => void 0);
|
|
287
296
|
};
|
|
288
|
-
if (
|
|
297
|
+
if (w !== a) {
|
|
289
298
|
l();
|
|
290
299
|
return;
|
|
291
300
|
}
|
|
292
|
-
let u = c.now(),
|
|
301
|
+
let u = c.now(), d;
|
|
293
302
|
try {
|
|
294
|
-
|
|
303
|
+
d = await i.create({
|
|
295
304
|
avatarId: e,
|
|
296
305
|
consentVersion: r,
|
|
297
306
|
idempotencyKey: s.newIdempotencyKey()
|
|
298
307
|
});
|
|
299
308
|
} catch (e) {
|
|
300
|
-
if (l(),
|
|
301
|
-
q(e).showDisclosure && (
|
|
309
|
+
if (l(), w !== a) return;
|
|
310
|
+
q(e).showDisclosure && (b = null, $.requestOn({ start: !1 }));
|
|
302
311
|
return;
|
|
303
312
|
}
|
|
304
|
-
if (
|
|
305
|
-
l(), i.end(
|
|
313
|
+
if (w !== a) {
|
|
314
|
+
l(), i.end(d.sessionId, { reason: A === "voice_end" ? "voice_end" : "user" }).catch(() => void 0);
|
|
306
315
|
return;
|
|
307
316
|
}
|
|
308
|
-
|
|
309
|
-
let
|
|
317
|
+
T = d.sessionId, V({ phase: "connecting" });
|
|
318
|
+
let f = new t({
|
|
310
319
|
room: o,
|
|
311
|
-
avatarIdentity:
|
|
320
|
+
avatarIdentity: d.avatarIdentity,
|
|
312
321
|
scheduler: c,
|
|
313
322
|
...s.readinessProbe === void 0 ? {} : { readinessProbe: s.readinessProbe }
|
|
314
|
-
}),
|
|
315
|
-
session:
|
|
316
|
-
transport:
|
|
323
|
+
}), p = /* @__PURE__ */ new Set(), m = {
|
|
324
|
+
session: d,
|
|
325
|
+
transport: f,
|
|
317
326
|
audioElement: s.createAudioElement(),
|
|
318
327
|
meter: null,
|
|
319
328
|
meterAudible: !1,
|
|
320
|
-
meterListeners:
|
|
329
|
+
meterListeners: p,
|
|
321
330
|
videoTrack: null,
|
|
322
331
|
unsubscribe: null,
|
|
323
332
|
port: n({
|
|
324
|
-
transport:
|
|
325
|
-
isEnabled: () =>
|
|
326
|
-
subscribeMeter: (e) => (
|
|
327
|
-
|
|
333
|
+
transport: f,
|
|
334
|
+
isEnabled: () => S && !C,
|
|
335
|
+
subscribeMeter: (e) => (p.add(e), () => {
|
|
336
|
+
p.delete(e);
|
|
328
337
|
}),
|
|
329
|
-
isMeterHealthy: () =>
|
|
338
|
+
isMeterHealthy: () => m.meter?.isRunning() ?? !1
|
|
330
339
|
})
|
|
331
340
|
};
|
|
332
|
-
|
|
341
|
+
E = m, m.unsubscribe = f.subscribe(oe);
|
|
333
342
|
try {
|
|
334
|
-
await
|
|
335
|
-
url:
|
|
336
|
-
token:
|
|
337
|
-
audioElement:
|
|
343
|
+
await ue(f.connect({
|
|
344
|
+
url: d.livekitUrl,
|
|
345
|
+
token: d.participantToken,
|
|
346
|
+
audioElement: m.audioElement,
|
|
338
347
|
onAvatarAudio: (e) => {
|
|
339
|
-
if (!(e.mediaStreamTrack === null ||
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
for (let t of [...
|
|
348
|
+
if (!(e.mediaStreamTrack === null || m.meter !== null)) try {
|
|
349
|
+
m.meter = s.startMeter(e.mediaStreamTrack, (e) => {
|
|
350
|
+
m.meterAudible = e;
|
|
351
|
+
for (let t of [...p]) t(e);
|
|
343
352
|
});
|
|
344
353
|
} catch {
|
|
345
|
-
|
|
354
|
+
m.meter = null;
|
|
346
355
|
}
|
|
347
356
|
},
|
|
348
357
|
onAvatarVideo: (e) => {
|
|
349
|
-
|
|
350
|
-
let t =
|
|
351
|
-
t !== null && e.attach(t),
|
|
358
|
+
m.videoTrack = e;
|
|
359
|
+
let t = Z();
|
|
360
|
+
t !== null && e.attach(t), E === m && V({ videoReady: !0 });
|
|
352
361
|
}
|
|
353
|
-
}),
|
|
362
|
+
}), h);
|
|
354
363
|
} catch (e) {
|
|
355
|
-
if (
|
|
364
|
+
if (w !== a) return;
|
|
356
365
|
R({
|
|
357
366
|
event: "connect-failed",
|
|
358
367
|
error: e instanceof Error ? e.name : "error"
|
|
359
368
|
}), K("client_error", { problem: "connection" });
|
|
360
369
|
return;
|
|
361
370
|
}
|
|
362
|
-
if (
|
|
371
|
+
if (w !== a || E !== m) return;
|
|
363
372
|
V({
|
|
364
373
|
phase: "ready",
|
|
365
|
-
audioBlocked:
|
|
366
|
-
...
|
|
374
|
+
audioBlocked: f.audioBlocked,
|
|
375
|
+
...f.audioBlocked ? { problem: "playback-blocked" } : {}
|
|
367
376
|
}), G();
|
|
368
|
-
let
|
|
377
|
+
let g = x > 0 ? u + x - ee - c.now() : d.endsAt - s.now(), _ = Math.max(0, g - te);
|
|
369
378
|
F = c.setTimeout(() => {
|
|
370
|
-
F = null,
|
|
371
|
-
},
|
|
379
|
+
F = null, w === a && (C = !0, V({ closing: !0 }), W.isBusy() || K("user", { notice: "time-limit" }));
|
|
380
|
+
}, _);
|
|
372
381
|
}
|
|
373
|
-
function
|
|
382
|
+
function le(t) {
|
|
374
383
|
let n = new AbortController();
|
|
375
384
|
return new Promise((r, i) => {
|
|
376
385
|
let a = c.setTimeout(() => {
|
|
377
386
|
n.abort(), i(new e("connection"));
|
|
378
|
-
},
|
|
387
|
+
}, g);
|
|
379
388
|
t(n.signal).then((e) => {
|
|
380
389
|
a(), r(e);
|
|
381
390
|
}, (e) => {
|
|
@@ -383,7 +392,7 @@ function g(s) {
|
|
|
383
392
|
});
|
|
384
393
|
});
|
|
385
394
|
}
|
|
386
|
-
function
|
|
395
|
+
function ue(t, n) {
|
|
387
396
|
return new Promise((r, i) => {
|
|
388
397
|
let a = c.setTimeout(() => i(new e("connection")), n);
|
|
389
398
|
t.then((e) => {
|
|
@@ -393,32 +402,32 @@ function g(s) {
|
|
|
393
402
|
});
|
|
394
403
|
});
|
|
395
404
|
}
|
|
396
|
-
function
|
|
397
|
-
return
|
|
405
|
+
function Z() {
|
|
406
|
+
return D[D.length - 1] ?? null;
|
|
398
407
|
}
|
|
399
|
-
function
|
|
400
|
-
let t =
|
|
408
|
+
function de(e) {
|
|
409
|
+
let t = D.indexOf(e);
|
|
401
410
|
if (t === -1) return;
|
|
402
|
-
let n = t ===
|
|
403
|
-
|
|
404
|
-
let r =
|
|
411
|
+
let n = t === D.length - 1;
|
|
412
|
+
D.splice(t, 1);
|
|
413
|
+
let r = E?.videoTrack ?? null;
|
|
405
414
|
if (!n || r === null) return;
|
|
406
415
|
r.detach();
|
|
407
|
-
let i =
|
|
416
|
+
let i = Z();
|
|
408
417
|
i !== null && r.attach(i);
|
|
409
418
|
}
|
|
410
419
|
let Q = [];
|
|
411
420
|
Q.push(l.subscribe(() => {
|
|
412
421
|
let e = l.getState().avatarEnabled;
|
|
413
|
-
if (e !==
|
|
422
|
+
if (e !== S) {
|
|
414
423
|
if (e) {
|
|
415
424
|
l.setAvatarEnabled(!1);
|
|
416
425
|
return;
|
|
417
426
|
}
|
|
418
|
-
|
|
427
|
+
_.phase !== "off" && _.phase !== "checking" && _.phase !== "choosing" ? K(H(), {}) : S = !1;
|
|
419
428
|
}
|
|
420
429
|
})), s.subscribeWorkspaceChange && Q.push(s.subscribeWorkspaceChange(() => {
|
|
421
|
-
if (
|
|
430
|
+
if (y = !1, _.phase === "off" ? V({
|
|
422
431
|
problem: null,
|
|
423
432
|
avatars: [],
|
|
424
433
|
consentVersion: null
|
|
@@ -426,26 +435,26 @@ function g(s) {
|
|
|
426
435
|
avatars: [],
|
|
427
436
|
consentVersion: null
|
|
428
437
|
})), j) {
|
|
429
|
-
let e =
|
|
438
|
+
let e = w;
|
|
430
439
|
c.setTimeout(() => {
|
|
431
|
-
j &&
|
|
440
|
+
j && w === e && $.requestOn({ start: !1 });
|
|
432
441
|
}, 0);
|
|
433
442
|
}
|
|
434
443
|
})), s.subscribePageHide && Q.push(s.subscribePageHide(() => {
|
|
435
|
-
(
|
|
436
|
-
}));
|
|
444
|
+
(T !== null || _.phase !== "off") && K("page_hide", { keepalive: !0 });
|
|
445
|
+
})), s.subscribePageShow && Q.push(s.subscribePageShow(Y));
|
|
437
446
|
let $ = {
|
|
438
447
|
subscribe(e) {
|
|
439
|
-
return
|
|
440
|
-
|
|
448
|
+
return v.add(e), () => {
|
|
449
|
+
v.delete(e);
|
|
441
450
|
};
|
|
442
451
|
},
|
|
443
|
-
getSnapshot: () =>
|
|
452
|
+
getSnapshot: () => _,
|
|
444
453
|
setVoiceLive(e) {
|
|
445
|
-
if (
|
|
454
|
+
if (k = !e, e) {
|
|
446
455
|
V({
|
|
447
456
|
voiceLive: !0,
|
|
448
|
-
problem:
|
|
457
|
+
problem: y || j && B() ? _.problem : null,
|
|
449
458
|
notice: null
|
|
450
459
|
});
|
|
451
460
|
return;
|
|
@@ -454,33 +463,33 @@ function g(s) {
|
|
|
454
463
|
V({ voiceLive: !1 });
|
|
455
464
|
return;
|
|
456
465
|
}
|
|
457
|
-
(
|
|
466
|
+
(T !== null || _.phase !== "off") && (_.phase === "checking" || _.phase === "choosing" ? (w += 1, V({ phase: "off" })) : K("voice_end", {})), V({
|
|
458
467
|
voiceLive: !1,
|
|
459
468
|
notice: null
|
|
460
469
|
});
|
|
461
470
|
},
|
|
462
471
|
requestOn(e = {}) {
|
|
463
|
-
if (L || !
|
|
472
|
+
if (L || !_.offered || _.phase !== "off") return;
|
|
464
473
|
let t = e.start === void 0 ? "auto" : e.start ? "start" : "choose";
|
|
465
474
|
if (t === "start" && B()) return;
|
|
466
|
-
let n = e.avatarId ??
|
|
475
|
+
let n = e.avatarId ?? _.selectedAvatarId, r = _.consentVersion, i = s.client();
|
|
467
476
|
if (i === null) {
|
|
468
|
-
|
|
477
|
+
X();
|
|
469
478
|
return;
|
|
470
479
|
}
|
|
471
480
|
t === "start" && (N = c.now());
|
|
472
|
-
let o = ++
|
|
481
|
+
let o = ++w;
|
|
473
482
|
V({
|
|
474
483
|
phase: "checking",
|
|
475
|
-
problem: B() ?
|
|
484
|
+
problem: B() ? _.problem : null,
|
|
476
485
|
notice: null
|
|
477
|
-
}),
|
|
478
|
-
if (
|
|
486
|
+
}), le((e) => i.availability(e)).then((e) => {
|
|
487
|
+
if (w !== o) return;
|
|
479
488
|
if (!e.available) {
|
|
480
|
-
|
|
489
|
+
X(a(e.reason));
|
|
481
490
|
return;
|
|
482
491
|
}
|
|
483
|
-
|
|
492
|
+
x = e.maxSessionSeconds * 1e3;
|
|
484
493
|
let i = t === "start" && n !== null && e.avatars.includes(n), s = l.getState().avatarId, c = i ? n : s !== null && e.avatars.includes(s) ? s : e.avatars[0] ?? null;
|
|
485
494
|
switch (V({
|
|
486
495
|
phase: "choosing",
|
|
@@ -489,7 +498,7 @@ function g(s) {
|
|
|
489
498
|
consentVersion: e.consentVersion
|
|
490
499
|
}), t) {
|
|
491
500
|
case "auto":
|
|
492
|
-
|
|
501
|
+
b === e.consentVersion && e.avatars.length === 1 && $.confirm();
|
|
493
502
|
return;
|
|
494
503
|
case "start":
|
|
495
504
|
i && r === e.consentVersion ? $.confirm() : N = null;
|
|
@@ -497,45 +506,46 @@ function g(s) {
|
|
|
497
506
|
case "choose": return;
|
|
498
507
|
}
|
|
499
508
|
}, (e) => {
|
|
500
|
-
|
|
509
|
+
w === o && q(e);
|
|
501
510
|
});
|
|
502
511
|
},
|
|
503
512
|
confirm() {
|
|
504
|
-
if (
|
|
505
|
-
let e =
|
|
506
|
-
e === null || t === null || (
|
|
513
|
+
if (_.phase !== "choosing" || !(_.voiceLive || j) || B()) return;
|
|
514
|
+
let e = _.selectedAvatarId, t = _.consentVersion;
|
|
515
|
+
e === null || t === null || (b = t, l.setAvatarId(e), S = !0, M = !j, j && (N ??= c.now()), U(), ce(e, t));
|
|
507
516
|
},
|
|
517
|
+
recheckRetry: Y,
|
|
508
518
|
cancelChoice() {
|
|
509
|
-
|
|
519
|
+
_.phase === "choosing" && (w += 1, N = null, V({ phase: "off" }));
|
|
510
520
|
},
|
|
511
521
|
setTabOpen(e) {
|
|
512
522
|
if (L || e === j) return;
|
|
513
523
|
if (j = e, e) {
|
|
514
|
-
V({ tabOpen: !0 }),
|
|
524
|
+
V({ tabOpen: !0 }), _.phase === "checking" && (w += 1, V({ phase: "off" }), $.requestOn({ start: !1 }));
|
|
515
525
|
return;
|
|
516
526
|
}
|
|
517
527
|
N = null;
|
|
518
|
-
let t =
|
|
528
|
+
let t = _.phase;
|
|
519
529
|
if (t === "checking" || t === "choosing") {
|
|
520
|
-
|
|
530
|
+
w += 1, V({
|
|
521
531
|
tabOpen: !1,
|
|
522
532
|
phase: "off"
|
|
523
533
|
});
|
|
524
534
|
return;
|
|
525
535
|
}
|
|
526
|
-
(
|
|
536
|
+
(T !== null || t !== "off") && !_.heldByVoice && K("user", {}), V({ tabOpen: !1 });
|
|
527
537
|
},
|
|
528
538
|
selectAvatar(e) {
|
|
529
|
-
|
|
539
|
+
_.avatars.includes(e) && V({ selectedAvatarId: e });
|
|
530
540
|
},
|
|
531
541
|
switchOff() {
|
|
532
|
-
let { phase: e } =
|
|
542
|
+
let { phase: e } = _;
|
|
533
543
|
if (!(j && N !== null && (e === "checking" || e === "starting" || e === "connecting") && c.now() - N < 1e3)) {
|
|
534
544
|
if (e === "checking" || e === "choosing") {
|
|
535
|
-
|
|
545
|
+
w += 1, N = null, V({ phase: "off" });
|
|
536
546
|
return;
|
|
537
547
|
}
|
|
538
|
-
if (e === "off" && !
|
|
548
|
+
if (e === "off" && !S) {
|
|
539
549
|
U();
|
|
540
550
|
return;
|
|
541
551
|
}
|
|
@@ -543,41 +553,41 @@ function g(s) {
|
|
|
543
553
|
}
|
|
544
554
|
},
|
|
545
555
|
resumeAudio() {
|
|
546
|
-
let e =
|
|
556
|
+
let e = E;
|
|
547
557
|
e !== null && (e.transport.resumeAudio().catch(() => void 0), e.meter?.resume().catch(() => void 0));
|
|
548
558
|
},
|
|
549
559
|
setStageMounted(e) {
|
|
550
|
-
|
|
560
|
+
O = Math.max(0, O + (e ? 1 : -1));
|
|
551
561
|
},
|
|
552
562
|
attachVideo(e) {
|
|
553
563
|
if (e === null) {
|
|
554
|
-
let e =
|
|
555
|
-
e !== null &&
|
|
564
|
+
let e = Z();
|
|
565
|
+
e !== null && de(e);
|
|
556
566
|
return;
|
|
557
567
|
}
|
|
558
|
-
let t =
|
|
559
|
-
t !== -1 &&
|
|
560
|
-
let n =
|
|
561
|
-
return n !== null && (n.detach(), n.attach(e)), () =>
|
|
568
|
+
let t = D.indexOf(e);
|
|
569
|
+
t !== -1 && D.splice(t, 1), D.push(e);
|
|
570
|
+
let n = E?.videoTrack ?? null;
|
|
571
|
+
return n !== null && (n.detach(), n.attach(e)), () => de(e);
|
|
562
572
|
},
|
|
563
573
|
route(e, t) {
|
|
564
|
-
if (
|
|
574
|
+
if (_.phase !== "ready" || C || !S || O === 0 || E === null || E.port.isAudioBlocked() || e.fallback === !1) return "speakers";
|
|
565
575
|
let n = e.voice;
|
|
566
576
|
return n !== null && n.source !== "hosted" || !t.listVoices().some((e) => e.source === "hosted") ? (R({
|
|
567
577
|
event: "notice",
|
|
568
578
|
notice: { kind: "needs-hosted-voice" }
|
|
569
|
-
}), V({ problem: "needs-hosted-voice" }), "speakers") : (
|
|
579
|
+
}), V({ problem: "needs-hosted-voice" }), "speakers") : (_.problem === "needs-hosted-voice" && V({ problem: null }), "avatar");
|
|
570
580
|
},
|
|
571
581
|
createOutput: () => W.createOutput(),
|
|
572
582
|
dispose() {
|
|
573
583
|
if (!L) {
|
|
574
|
-
L = !0, (
|
|
584
|
+
L = !0, (T !== null || _.phase !== "off") && K("user", {}), I?.(), I = null;
|
|
575
585
|
for (let e of Q.splice(0)) e();
|
|
576
|
-
|
|
586
|
+
v.clear();
|
|
577
587
|
}
|
|
578
588
|
}
|
|
579
589
|
};
|
|
580
590
|
return $;
|
|
581
591
|
}
|
|
582
592
|
//#endregion
|
|
583
|
-
export { u as LIVE_AVATAR_CONNECT_TIMEOUT_MS, c as LIVE_AVATAR_END_BEFORE_DEADLINE_MS, s as LIVE_AVATAR_IDLE_MS, l as LIVE_AVATAR_REQUEST_TIMEOUT_MS,
|
|
593
|
+
export { u as LIVE_AVATAR_CONNECT_TIMEOUT_MS, c as LIVE_AVATAR_END_BEFORE_DEADLINE_MS, s as LIVE_AVATAR_IDLE_MS, l as LIVE_AVATAR_REQUEST_TIMEOUT_MS, te as LIVE_AVATAR_TAB_OFF_GUARD_MS, h as createLiveAvatarController };
|