@burdenoff/fe-libs 2026.1024.3 → 2026.1026.1
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/LiveAvatarMinutes.d.ts +24 -0
- package/dist/shared/assistant/avatar/live/LiveAvatarMinutes.js +161 -0
- package/dist/shared/assistant/avatar/live/LiveAvatarStage.js +95 -74
- package/dist/shared/assistant/avatar/live/LiveAvatarTabView.d.ts +6 -0
- package/dist/shared/assistant/avatar/live/LiveAvatarTabView.js +195 -172
- package/dist/shared/assistant/avatar/live/avatarPorts.d.ts +9 -0
- package/dist/shared/assistant/avatar/live/avatarSessionClient.d.ts +77 -1
- package/dist/shared/assistant/avatar/live/avatarSessionClient.js +193 -72
- package/dist/shared/assistant/avatar/live/avatarTransport.d.ts +25 -3
- package/dist/shared/assistant/avatar/live/avatarTransport.js +29 -2
- package/dist/shared/assistant/avatar/live/createLiveAvatarSeam.d.ts +35 -4
- package/dist/shared/assistant/avatar/live/createLiveAvatarSeam.js +136 -79
- package/dist/shared/assistant/avatar/live/liveAvatarController.d.ts +79 -3
- package/dist/shared/assistant/avatar/live/liveAvatarController.js +424 -245
- package/dist/shared/assistant/avatar/live/liveAvatarMinutesView.d.ts +127 -0
- package/dist/shared/assistant/avatar/live/liveAvatarMinutesView.js +168 -0
- package/dist/shared/assistant/avatar/live/liveAvatarStatus.d.ts +3 -0
- package/dist/shared/assistant/avatar/live/liveAvatarStatus.js +11 -7
- package/dist/shared/assistant/avatar/live/liveKitAvatarRoom.js +6 -1
- package/dist/shared/assistant/avatar/useAvatarCopy.d.ts +127 -2
- package/dist/shared/assistant/avatar/useAvatarCopy.js +116 -7
- package/dist/shared/assistant/i18nManifest.d.ts +32 -1
- package/dist/shared/assistant/i18nManifest.js +55 -24
- package/dist/shared/assistant/index.d.ts +2 -0
- package/dist/shared/assistant/ui/AssistantChatArea.js +17 -17
- package/dist/shared/assistant/ui/AssistantMarkdownRenderer.d.ts +5 -2
- package/dist/shared/assistant/ui/assistantLiveAvatarSeam.d.ts +11 -3
- package/dist/shared/assistant/ui/avatar/AssistantAvatarTab.js +78 -76
- package/dist/shared/assistant/ui/avatar/avatarAskGate.d.ts +2 -0
- package/dist/shared/assistant/ui/avatar/avatarAskGate.js +1 -0
- package/dist/shared/events/index.d.ts +2 -1
- package/dist/shared-assistant.js +227 -225
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AvatarNotReadyError as e, LiveKitAvatarTransport as t } from "./avatarTransport.js";
|
|
2
2
|
import { createAvatarTransportPort as n } from "./avatarTransportPort.js";
|
|
3
3
|
import { createAvatarReplyOutputs as r } from "./avatarReplyOutputs.js";
|
|
4
|
-
import { AvatarApiError as i, avatarAvailabilityRefusal as a,
|
|
4
|
+
import { AvatarApiError as i, avatarAvailabilityRefusal as a, avatarMinutesRefusal as o, avatarRefusalFor as s } from "./avatarSessionClient.js";
|
|
5
5
|
//#region src/shared/assistant/avatar/live/liveAvatarController.ts
|
|
6
|
-
var
|
|
6
|
+
var c = 12e4, l = 1e4, u = 8e3, ee = 5e3, d = 2e4, f = 15e3, te = 2, ne = 5, p = 6e3, m = 1e3, re = {
|
|
7
7
|
voiceLive: !1,
|
|
8
8
|
offered: !1,
|
|
9
9
|
tabOpen: !1,
|
|
@@ -19,9 +19,15 @@ var s = 12e4, c = 1e4, l = 8e3, ee = 5e3, u = 2e4, te = 1e3, d = {
|
|
|
19
19
|
budgetScope: null,
|
|
20
20
|
notice: null,
|
|
21
21
|
audioBlocked: !1,
|
|
22
|
-
videoReady: !1
|
|
22
|
+
videoReady: !1,
|
|
23
|
+
videoBlocked: !1,
|
|
24
|
+
minutes: null,
|
|
25
|
+
minutesReason: null,
|
|
26
|
+
sessionMinutes: null,
|
|
27
|
+
sessionEndsAt: null,
|
|
28
|
+
purchase: "idle"
|
|
23
29
|
};
|
|
24
|
-
function
|
|
30
|
+
function ie(e) {
|
|
25
31
|
switch (e) {
|
|
26
32
|
case "permission_revoked": return {
|
|
27
33
|
problem: "unavailable",
|
|
@@ -57,88 +63,97 @@ function f(e) {
|
|
|
57
63
|
};
|
|
58
64
|
}
|
|
59
65
|
}
|
|
60
|
-
var
|
|
66
|
+
var ae = new Set(["playback-blocked", "needs-hosted-voice"]), oe = {
|
|
61
67
|
problem: "unavailable",
|
|
62
68
|
hide: !0
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
}, se = new Set([
|
|
70
|
+
"minutes-exhausted",
|
|
71
|
+
"minutes-in-use",
|
|
72
|
+
"minutes-in-use-self",
|
|
73
|
+
"minutes-unavailable"
|
|
74
|
+
]), ce = new Set([
|
|
75
|
+
"minutes-exhausted",
|
|
76
|
+
"minutes-in-use",
|
|
77
|
+
"minutes-in-use-self"
|
|
78
|
+
]);
|
|
79
|
+
function h(c) {
|
|
80
|
+
let { scheduler: l, preferences: u } = c, d = c.idleMs ?? 12e4, te = c.endBeforeDeadlineMs ?? 1e4, ne = c.connectTimeoutMs ?? 2e4, m = c.requestTimeoutMs ?? 8e3, h = {
|
|
81
|
+
...re,
|
|
82
|
+
tabOffered: c.browserSupported()
|
|
83
|
+
}, g = /* @__PURE__ */ new Set(), _ = !1, v = null, le = null, ue = 0, y = !1, b = !1, x = 0, S = null, C = null, w = [], de = 0, fe = !1, pe = "user", T = !1, E = !1, D = null, O = null, k = null, A = null, j = !1, me = 0, M = 0, N = null, P = !1, F = !1, I = null, L = null, R = 0, z = 0, he = !1, B = 0, V = null, H = !1;
|
|
84
|
+
function U(e) {
|
|
70
85
|
try {
|
|
71
|
-
|
|
86
|
+
c.onLog?.(e);
|
|
72
87
|
} catch {}
|
|
73
88
|
}
|
|
74
|
-
function
|
|
75
|
-
return !
|
|
89
|
+
function ge() {
|
|
90
|
+
return !_ && c.browserSupported();
|
|
76
91
|
}
|
|
77
|
-
function
|
|
78
|
-
return (e || t) &&
|
|
92
|
+
function _e(e, t) {
|
|
93
|
+
return (e || t) && ge();
|
|
79
94
|
}
|
|
80
|
-
function
|
|
81
|
-
return
|
|
95
|
+
function W() {
|
|
96
|
+
return h.retryAt !== null && c.now() < h.retryAt;
|
|
82
97
|
}
|
|
83
|
-
function
|
|
98
|
+
function G(e) {
|
|
84
99
|
let t = {
|
|
85
|
-
...
|
|
100
|
+
...h,
|
|
86
101
|
...e
|
|
87
102
|
};
|
|
88
|
-
e.problem !== void 0 && e.problem !==
|
|
103
|
+
e.problem !== void 0 && e.problem !== h.problem && (e.retryAt === void 0 && (t.retryAt = null), e.budgetScope === void 0 && (t.budgetScope = null), e.minutesReason === void 0 && (t.minutesReason = null));
|
|
89
104
|
let n = {
|
|
90
105
|
...t,
|
|
91
|
-
offered:
|
|
92
|
-
tabOffered:
|
|
93
|
-
heldByVoice:
|
|
106
|
+
offered: _e(t.voiceLive, t.tabOpen),
|
|
107
|
+
tabOffered: ge(),
|
|
108
|
+
heldByVoice: E && t.voiceLive
|
|
94
109
|
};
|
|
95
|
-
if (!Object.keys(n).every((e) => n[e] ===
|
|
96
|
-
n.retryAt !==
|
|
97
|
-
for (let e of [...
|
|
110
|
+
if (!Object.keys(n).every((e) => n[e] === h[e])) {
|
|
111
|
+
n.retryAt !== h.retryAt && (A?.(), A = null), h = n;
|
|
112
|
+
for (let e of [...g]) try {
|
|
98
113
|
e();
|
|
99
114
|
} catch {}
|
|
100
115
|
}
|
|
101
116
|
}
|
|
102
|
-
function
|
|
103
|
-
return
|
|
117
|
+
function ve() {
|
|
118
|
+
return fe && !T ? "voice_end" : "user";
|
|
104
119
|
}
|
|
105
|
-
function
|
|
106
|
-
|
|
120
|
+
function K() {
|
|
121
|
+
u.getState().avatarEnabled !== y && u.setAvatarEnabled(y);
|
|
107
122
|
}
|
|
108
|
-
let
|
|
123
|
+
let ye = {
|
|
109
124
|
positionSec: null,
|
|
110
125
|
synthetic: !0,
|
|
111
126
|
rpc: "none"
|
|
112
|
-
},
|
|
127
|
+
}, q = r({
|
|
113
128
|
port: {
|
|
114
|
-
isActive: () =>
|
|
115
|
-
isAudioBlocked: () =>
|
|
116
|
-
connectionId: () =>
|
|
117
|
-
isMeterHealthy: () =>
|
|
118
|
-
isMeterAudible: () =>
|
|
119
|
-
openSegment: () =>
|
|
120
|
-
clearBuffer: (e) =>
|
|
121
|
-
setOutputMuted: (e) =>
|
|
122
|
-
subscribe: (e) =>
|
|
129
|
+
isActive: () => C !== null && C.port.isActive(),
|
|
130
|
+
isAudioBlocked: () => C?.port.isAudioBlocked() ?? !1,
|
|
131
|
+
connectionId: () => C?.port.connectionId() ?? 0,
|
|
132
|
+
isMeterHealthy: () => C?.port.isMeterHealthy() ?? !1,
|
|
133
|
+
isMeterAudible: () => C?.port.isMeterAudible() ?? !1,
|
|
134
|
+
openSegment: () => C ? C.port.openSegment() : Promise.reject(new e("connection")),
|
|
135
|
+
clearBuffer: (e) => C ? C.port.clearBuffer(e) : Promise.resolve(ye),
|
|
136
|
+
setOutputMuted: (e) => C?.port.setOutputMuted(e),
|
|
137
|
+
subscribe: (e) => C ? C.port.subscribe(e) : () => void 0
|
|
123
138
|
},
|
|
124
|
-
scheduler:
|
|
125
|
-
decode:
|
|
126
|
-
...
|
|
127
|
-
...
|
|
128
|
-
...
|
|
139
|
+
scheduler: l,
|
|
140
|
+
decode: c.decode,
|
|
141
|
+
...c.trackerConfig ? { trackerConfig: c.trackerConfig } : {},
|
|
142
|
+
...c.maxDrainMs === void 0 ? {} : { maxDrainMs: c.maxDrainMs },
|
|
143
|
+
...c.stallMs === void 0 ? {} : { stallMs: c.stallMs },
|
|
129
144
|
onNotice: (e) => {
|
|
130
|
-
switch (
|
|
145
|
+
switch (U({
|
|
131
146
|
event: "notice",
|
|
132
147
|
notice: e
|
|
133
148
|
}), e.kind) {
|
|
134
149
|
case "interrupted":
|
|
135
|
-
|
|
150
|
+
G({ notice: "interrupted" });
|
|
136
151
|
return;
|
|
137
152
|
case "voice-fallback":
|
|
138
|
-
|
|
153
|
+
y && G({ notice: "voice-only" });
|
|
139
154
|
return;
|
|
140
155
|
case "audio-blocked":
|
|
141
|
-
|
|
156
|
+
G({
|
|
142
157
|
audioBlocked: !0,
|
|
143
158
|
problem: "playback-blocked"
|
|
144
159
|
});
|
|
@@ -148,28 +163,31 @@ function h(s) {
|
|
|
148
163
|
},
|
|
149
164
|
onActivity: (e) => {
|
|
150
165
|
if (e) {
|
|
151
|
-
|
|
166
|
+
O?.(), O = null;
|
|
152
167
|
return;
|
|
153
168
|
}
|
|
154
|
-
if (
|
|
155
|
-
|
|
169
|
+
if (b) {
|
|
170
|
+
J("user", { notice: be() });
|
|
156
171
|
return;
|
|
157
172
|
}
|
|
158
|
-
|
|
173
|
+
xe();
|
|
159
174
|
}
|
|
160
175
|
});
|
|
161
|
-
function
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
function
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
176
|
+
function be() {
|
|
177
|
+
return he ? "minutes-ended" : "time-limit";
|
|
178
|
+
}
|
|
179
|
+
function xe() {
|
|
180
|
+
O?.(), O = null, h.phase === "ready" && (O = l.setTimeout(() => {
|
|
181
|
+
O = null, h.phase === "ready" && !q.isBusy() && J("idle", {});
|
|
182
|
+
}, d));
|
|
183
|
+
}
|
|
184
|
+
function Se() {
|
|
185
|
+
O?.(), O = null, k?.(), k = null;
|
|
186
|
+
}
|
|
187
|
+
function Ce() {
|
|
188
|
+
q.leave();
|
|
189
|
+
let e = C;
|
|
190
|
+
if (C = null, e !== null) {
|
|
173
191
|
if (e.unsubscribe?.(), e.meter !== null) {
|
|
174
192
|
if (e.meterAudible) {
|
|
175
193
|
e.meterAudible = !1;
|
|
@@ -177,153 +195,260 @@ function h(s) {
|
|
|
177
195
|
}
|
|
178
196
|
e.meter.stop();
|
|
179
197
|
}
|
|
180
|
-
e.videoTrack?.detach(), e.transport.dispose(), e.audioElement !== null &&
|
|
198
|
+
e.videoTrack?.detach(), e.transport.dispose(), e.audioElement !== null && c.releaseAudioElement(e.audioElement);
|
|
181
199
|
}
|
|
182
200
|
}
|
|
183
|
-
function
|
|
184
|
-
|
|
185
|
-
let n =
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
201
|
+
function J(e, t) {
|
|
202
|
+
x += 1, pe = e, y = !1, b = !1, E = !1, D = null, he = !1, Ce(), Se();
|
|
203
|
+
let n = S;
|
|
204
|
+
if (S = null, K(), n !== null) {
|
|
205
|
+
U({
|
|
206
|
+
event: "session-ended",
|
|
207
|
+
reason: e
|
|
208
|
+
});
|
|
209
|
+
let r = c.client(), i = () => ze(e);
|
|
210
|
+
r?.end(n, {
|
|
211
|
+
reason: e,
|
|
212
|
+
keepalive: t.keepalive === !0
|
|
213
|
+
}).then(i, i);
|
|
214
|
+
}
|
|
215
|
+
Be(), G({
|
|
193
216
|
phase: "off",
|
|
194
217
|
closing: !1,
|
|
195
218
|
audioBlocked: !1,
|
|
196
219
|
videoReady: !1,
|
|
197
|
-
|
|
220
|
+
videoBlocked: !1,
|
|
221
|
+
sessionMinutes: null,
|
|
222
|
+
sessionEndsAt: null,
|
|
223
|
+
...t.problem === void 0 ? h.problem !== null && ae.has(h.problem) ? { problem: null } : {} : { problem: t.problem },
|
|
198
224
|
...t.notice === void 0 ? {} : { notice: t.notice }
|
|
199
225
|
});
|
|
200
226
|
}
|
|
201
|
-
function
|
|
202
|
-
let t =
|
|
203
|
-
t.hide && (
|
|
227
|
+
function we(e) {
|
|
228
|
+
let t = s(e);
|
|
229
|
+
t.hide && (_ = !0), e instanceof i && U({
|
|
204
230
|
event: "refused",
|
|
205
231
|
status: e.status,
|
|
206
232
|
code: e.code
|
|
207
|
-
}),
|
|
208
|
-
let n = t.retryAfterSeconds !== void 0 && t.retryAfterSeconds > 0 ? t.retryAfterSeconds * 1e3 : 0, r = n > 0 ?
|
|
209
|
-
return
|
|
233
|
+
}), y = !1, E = !1, D = null, K();
|
|
234
|
+
let n = t.retryAfterSeconds !== void 0 && t.retryAfterSeconds > 0 ? t.retryAfterSeconds * 1e3 : 0, r = n > 0 ? c.now() + n : null;
|
|
235
|
+
return G({
|
|
210
236
|
phase: "off",
|
|
211
237
|
problem: t.problem,
|
|
212
238
|
retryAt: r,
|
|
213
|
-
budgetScope: t.scope ?? null
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
239
|
+
budgetScope: t.scope ?? null,
|
|
240
|
+
minutesReason: t.minutesReason ?? null
|
|
241
|
+
}), r !== null && h.retryAt === r && (A = l.setTimeout(() => {
|
|
242
|
+
A = null, Te(r);
|
|
243
|
+
}, n)), t.problem !== null && se.has(t.problem) && Z(!0), t;
|
|
217
244
|
}
|
|
218
|
-
function
|
|
219
|
-
|
|
245
|
+
function Te(e) {
|
|
246
|
+
h.retryAt === e && G({
|
|
220
247
|
problem: null,
|
|
221
248
|
retryAt: null
|
|
222
249
|
});
|
|
223
250
|
}
|
|
224
|
-
function
|
|
225
|
-
let e =
|
|
226
|
-
|
|
251
|
+
function Ee() {
|
|
252
|
+
let e = h.retryAt;
|
|
253
|
+
j || e === null || W() || Te(e);
|
|
254
|
+
}
|
|
255
|
+
function Y(e = oe) {
|
|
256
|
+
e.hide && (_ = !0), y = !1, E = !1, D = null, K(), Pe(), G({
|
|
257
|
+
phase: "off",
|
|
258
|
+
problem: e.problem,
|
|
259
|
+
retryAt: null,
|
|
260
|
+
avatars: [],
|
|
261
|
+
minutes: null,
|
|
262
|
+
minutesReason: null
|
|
263
|
+
});
|
|
227
264
|
}
|
|
228
|
-
function
|
|
229
|
-
|
|
265
|
+
function De(e) {
|
|
266
|
+
D = null, G({
|
|
230
267
|
phase: "off",
|
|
231
268
|
problem: e.problem,
|
|
232
269
|
retryAt: null,
|
|
233
|
-
|
|
270
|
+
minutesReason: e.minutesReason ?? null
|
|
234
271
|
});
|
|
235
272
|
}
|
|
236
|
-
function
|
|
273
|
+
function Oe() {
|
|
274
|
+
return N = l.now(), me += 1, me;
|
|
275
|
+
}
|
|
276
|
+
function ke(e) {
|
|
277
|
+
return e <= M ? !1 : (M = e, !0);
|
|
278
|
+
}
|
|
279
|
+
function Ae(e, t) {
|
|
280
|
+
return ke(e) ? { minutes: t } : {};
|
|
281
|
+
}
|
|
282
|
+
function je(e, t) {
|
|
283
|
+
if (!ke(e)) return {};
|
|
284
|
+
let { problem: n } = h;
|
|
285
|
+
if (!(n !== null && ce.has(n) && h.retryAt === null && h.minutesReason !== "ZERO_SESSION_LIMIT")) return { minutes: t };
|
|
286
|
+
let r = o(t);
|
|
287
|
+
return {
|
|
288
|
+
minutes: t,
|
|
289
|
+
problem: r?.problem ?? null,
|
|
290
|
+
minutesReason: r?.minutesReason ?? null
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
function Me() {
|
|
294
|
+
return c.isPageVisible?.() ?? !0;
|
|
295
|
+
}
|
|
296
|
+
function Ne() {
|
|
297
|
+
I?.(), I = null, L = null;
|
|
298
|
+
}
|
|
299
|
+
function X() {
|
|
300
|
+
B += 1, V?.(), V = null, h.purchase !== "idle" && G({ purchase: "idle" });
|
|
301
|
+
}
|
|
302
|
+
function Pe() {
|
|
303
|
+
M = me, F = !1, R = 0, Ne(), X();
|
|
304
|
+
}
|
|
305
|
+
function Fe() {
|
|
306
|
+
return !j && h.minutes !== null && h.offered && (h.phase === "off" || h.phase === "choosing");
|
|
307
|
+
}
|
|
308
|
+
function Z(e) {
|
|
309
|
+
if (e && (R = 0), !Fe() || !Me()) return;
|
|
310
|
+
if (P) {
|
|
311
|
+
F = !0;
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
let t = l.now(), n = Math.max(N === null ? t : N + f, z);
|
|
315
|
+
if (t < n) {
|
|
316
|
+
Ie(n);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
let r = c.client();
|
|
320
|
+
r !== null && Re(r);
|
|
321
|
+
}
|
|
322
|
+
function Ie(e) {
|
|
323
|
+
I !== null && L !== null && L <= e || (Ne(), L = e, I = l.setTimeout(() => {
|
|
324
|
+
I = null, L = null, Z(!1);
|
|
325
|
+
}, e - l.now()));
|
|
326
|
+
}
|
|
327
|
+
function Le(e) {
|
|
328
|
+
return !(e instanceof i) || e.status !== 429 ? !1 : (z = Math.max(z, l.now() + Math.max(0, e.retryAfterSeconds ?? 0) * 1e3), !0);
|
|
329
|
+
}
|
|
330
|
+
function Re(e) {
|
|
331
|
+
let t = Oe();
|
|
332
|
+
P = !0, Ge((t) => e.availability(t)).then((e) => {
|
|
333
|
+
j || (R = 0, G(je(t, e.available ? e.minutes ?? null : null)));
|
|
334
|
+
}, (e) => {
|
|
335
|
+
j || Le(e) && t > M && R < 2 && (R += 1, F = !0);
|
|
336
|
+
}).finally(() => {
|
|
337
|
+
P = !1, F && (F = !1, Z(!1));
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
function ze(e) {
|
|
341
|
+
e === "workspace_switch" || e === "page_hide" || Z(!0);
|
|
342
|
+
}
|
|
343
|
+
function Be() {
|
|
344
|
+
let e = v;
|
|
345
|
+
v = null, e?.();
|
|
346
|
+
}
|
|
347
|
+
function Ve() {
|
|
348
|
+
v !== null || !c.subscribeUserGesture || (v = c.subscribeUserGesture(() => {
|
|
349
|
+
let e = C;
|
|
350
|
+
e === null || !h.videoBlocked || e.transport.resumeVideo().catch(() => void 0);
|
|
351
|
+
}));
|
|
352
|
+
}
|
|
353
|
+
function He(e) {
|
|
237
354
|
switch (e.type) {
|
|
238
355
|
case "audioPlayback":
|
|
239
|
-
e.canPlay ?
|
|
356
|
+
e.canPlay ? h.problem === "playback-blocked" ? G({
|
|
240
357
|
audioBlocked: !1,
|
|
241
358
|
problem: null
|
|
242
|
-
}) :
|
|
359
|
+
}) : G({ audioBlocked: !1 }) : G({
|
|
243
360
|
audioBlocked: !0,
|
|
244
361
|
problem: "playback-blocked"
|
|
245
362
|
});
|
|
246
363
|
return;
|
|
364
|
+
case "videoPlayback":
|
|
365
|
+
G({ videoBlocked: !e.canPlay }), e.canPlay ? Be() : Ve();
|
|
366
|
+
return;
|
|
247
367
|
case "avatarLeft":
|
|
248
368
|
case "disconnected":
|
|
249
|
-
|
|
369
|
+
Ue();
|
|
250
370
|
return;
|
|
251
371
|
default: return;
|
|
252
372
|
}
|
|
253
373
|
}
|
|
254
|
-
async function
|
|
255
|
-
let e =
|
|
256
|
-
if (e === null ||
|
|
257
|
-
let t =
|
|
258
|
-
|
|
374
|
+
async function Ue() {
|
|
375
|
+
let e = S;
|
|
376
|
+
if (e === null || h.phase === "ending" || h.phase === "off") return;
|
|
377
|
+
let t = x;
|
|
378
|
+
G({ phase: "ending" });
|
|
259
379
|
let n = null, r = !1;
|
|
260
380
|
try {
|
|
261
|
-
let t =
|
|
381
|
+
let t = c.client(), i = t === null ? void 0 : await Ge((n) => t.status(e, n));
|
|
262
382
|
n = i?.endedReason ?? null, r = i !== void 0 && [
|
|
263
383
|
"ended",
|
|
264
384
|
"failed",
|
|
265
385
|
"canceled"
|
|
266
386
|
].includes(i.state);
|
|
267
387
|
} catch {}
|
|
268
|
-
if (
|
|
269
|
-
let i =
|
|
270
|
-
i.hide && (
|
|
388
|
+
if (x !== t) return;
|
|
389
|
+
let i = ie(n);
|
|
390
|
+
i.hide && (_ = !0), r && (S = null, U({
|
|
271
391
|
event: "session-ended",
|
|
272
392
|
reason: "server"
|
|
273
|
-
}))
|
|
393
|
+
}));
|
|
394
|
+
let a = i.notice === "time-limit" ? be() : i.notice;
|
|
395
|
+
J("client_error", {
|
|
396
|
+
problem: i.problem,
|
|
397
|
+
notice: a
|
|
398
|
+
}), r && ze("client_error");
|
|
274
399
|
}
|
|
275
|
-
async function
|
|
276
|
-
let i =
|
|
400
|
+
async function We(e, r) {
|
|
401
|
+
let i = c.client();
|
|
277
402
|
if (i === null) {
|
|
278
|
-
|
|
403
|
+
Y();
|
|
279
404
|
return;
|
|
280
405
|
}
|
|
281
|
-
let a = ++
|
|
282
|
-
|
|
406
|
+
let a = ++x;
|
|
407
|
+
G({
|
|
283
408
|
phase: "starting",
|
|
284
409
|
problem: null,
|
|
285
410
|
notice: null
|
|
286
411
|
});
|
|
287
412
|
let o;
|
|
288
413
|
try {
|
|
289
|
-
o = await
|
|
414
|
+
o = await c.openRoom();
|
|
290
415
|
} catch {
|
|
291
|
-
|
|
416
|
+
x === a && Y();
|
|
292
417
|
return;
|
|
293
418
|
}
|
|
294
|
-
let
|
|
419
|
+
let s = () => {
|
|
295
420
|
o.disconnect().catch(() => void 0);
|
|
296
421
|
};
|
|
297
|
-
if (
|
|
298
|
-
|
|
422
|
+
if (x !== a) {
|
|
423
|
+
s();
|
|
299
424
|
return;
|
|
300
425
|
}
|
|
301
|
-
let u =
|
|
426
|
+
let u = l.now(), d;
|
|
302
427
|
try {
|
|
303
428
|
d = await i.create({
|
|
304
429
|
avatarId: e,
|
|
305
430
|
consentVersion: r,
|
|
306
|
-
idempotencyKey:
|
|
431
|
+
idempotencyKey: c.newIdempotencyKey()
|
|
307
432
|
});
|
|
308
433
|
} catch (e) {
|
|
309
|
-
if (
|
|
310
|
-
|
|
434
|
+
if (s(), x !== a) return;
|
|
435
|
+
we(e).showDisclosure && (le = null, $.requestOn({ start: !1 }));
|
|
311
436
|
return;
|
|
312
437
|
}
|
|
313
|
-
if (
|
|
314
|
-
|
|
438
|
+
if (x !== a) {
|
|
439
|
+
s(), i.end(d.sessionId, { reason: pe === "voice_end" ? "voice_end" : "user" }).catch(() => void 0);
|
|
315
440
|
return;
|
|
316
441
|
}
|
|
317
|
-
|
|
442
|
+
S = d.sessionId, G({ phase: "connecting" });
|
|
318
443
|
let f = new t({
|
|
319
444
|
room: o,
|
|
320
445
|
avatarIdentity: d.avatarIdentity,
|
|
321
|
-
scheduler:
|
|
322
|
-
...
|
|
446
|
+
scheduler: l,
|
|
447
|
+
...c.readinessProbe === void 0 ? {} : { readinessProbe: c.readinessProbe }
|
|
323
448
|
}), p = /* @__PURE__ */ new Set(), m = {
|
|
324
449
|
session: d,
|
|
325
450
|
transport: f,
|
|
326
|
-
audioElement:
|
|
451
|
+
audioElement: c.createAudioElement(),
|
|
327
452
|
meter: null,
|
|
328
453
|
meterAudible: !1,
|
|
329
454
|
meterListeners: p,
|
|
@@ -331,22 +456,22 @@ function h(s) {
|
|
|
331
456
|
unsubscribe: null,
|
|
332
457
|
port: n({
|
|
333
458
|
transport: f,
|
|
334
|
-
isEnabled: () =>
|
|
459
|
+
isEnabled: () => y && !b,
|
|
335
460
|
subscribeMeter: (e) => (p.add(e), () => {
|
|
336
461
|
p.delete(e);
|
|
337
462
|
}),
|
|
338
463
|
isMeterHealthy: () => m.meter?.isRunning() ?? !1
|
|
339
464
|
})
|
|
340
465
|
};
|
|
341
|
-
|
|
466
|
+
C = m, m.unsubscribe = f.subscribe(He);
|
|
342
467
|
try {
|
|
343
|
-
await
|
|
468
|
+
await Ke(f.connect({
|
|
344
469
|
url: d.livekitUrl,
|
|
345
470
|
token: d.participantToken,
|
|
346
471
|
audioElement: m.audioElement,
|
|
347
472
|
onAvatarAudio: (e) => {
|
|
348
473
|
if (!(e.mediaStreamTrack === null || m.meter !== null)) try {
|
|
349
|
-
m.meter =
|
|
474
|
+
m.meter = c.startMeter(e.mediaStreamTrack, (e) => {
|
|
350
475
|
m.meterAudible = e;
|
|
351
476
|
for (let t of [...p]) t(e);
|
|
352
477
|
});
|
|
@@ -356,35 +481,39 @@ function h(s) {
|
|
|
356
481
|
},
|
|
357
482
|
onAvatarVideo: (e) => {
|
|
358
483
|
m.videoTrack = e;
|
|
359
|
-
let t =
|
|
360
|
-
t !== null && e.attach(t),
|
|
484
|
+
let t = qe();
|
|
485
|
+
t !== null && e.attach(t), C === m && G({ videoReady: !0 });
|
|
361
486
|
}
|
|
362
|
-
}),
|
|
487
|
+
}), ne);
|
|
363
488
|
} catch (e) {
|
|
364
|
-
if (
|
|
365
|
-
|
|
489
|
+
if (x !== a) return;
|
|
490
|
+
U({
|
|
366
491
|
event: "connect-failed",
|
|
367
492
|
error: e instanceof Error ? e.name : "error"
|
|
368
|
-
}),
|
|
493
|
+
}), J("client_error", { problem: "connection" });
|
|
369
494
|
return;
|
|
370
495
|
}
|
|
371
|
-
if (
|
|
372
|
-
|
|
496
|
+
if (x !== a || C !== m) return;
|
|
497
|
+
let re = d.maxSessionSeconds === void 0 ? ue : d.maxSessionSeconds * 1e3, ie = re > 0 ? u + re - ee - l.now() : d.endsAt - c.now();
|
|
498
|
+
he = d.minutes?.limitedByBalance === !0, G({
|
|
373
499
|
phase: "ready",
|
|
374
500
|
audioBlocked: f.audioBlocked,
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
501
|
+
videoBlocked: f.videoBlocked,
|
|
502
|
+
...f.audioBlocked ? { problem: "playback-blocked" } : {},
|
|
503
|
+
sessionMinutes: d.minutes ?? null,
|
|
504
|
+
sessionEndsAt: d.maxSessionSeconds === void 0 ? null : c.now() + ie
|
|
505
|
+
}), xe();
|
|
506
|
+
let ae = Math.max(0, ie - te);
|
|
507
|
+
k = l.setTimeout(() => {
|
|
508
|
+
k = null, x === a && (b = !0, G({ closing: !0 }), q.isBusy() || J("user", { notice: be() }));
|
|
509
|
+
}, ae);
|
|
510
|
+
}
|
|
511
|
+
function Ge(t) {
|
|
383
512
|
let n = new AbortController();
|
|
384
513
|
return new Promise((r, i) => {
|
|
385
|
-
let a =
|
|
514
|
+
let a = l.setTimeout(() => {
|
|
386
515
|
n.abort(), i(new e("connection"));
|
|
387
|
-
},
|
|
516
|
+
}, m);
|
|
388
517
|
t(n.signal).then((e) => {
|
|
389
518
|
a(), r(e);
|
|
390
519
|
}, (e) => {
|
|
@@ -392,9 +521,9 @@ function h(s) {
|
|
|
392
521
|
});
|
|
393
522
|
});
|
|
394
523
|
}
|
|
395
|
-
function
|
|
524
|
+
function Ke(t, n) {
|
|
396
525
|
return new Promise((r, i) => {
|
|
397
|
-
let a =
|
|
526
|
+
let a = l.setTimeout(() => i(new e("connection")), n);
|
|
398
527
|
t.then((e) => {
|
|
399
528
|
a(), r(e);
|
|
400
529
|
}, (e) => {
|
|
@@ -402,192 +531,242 @@ function h(s) {
|
|
|
402
531
|
});
|
|
403
532
|
});
|
|
404
533
|
}
|
|
405
|
-
function
|
|
406
|
-
return
|
|
534
|
+
function qe() {
|
|
535
|
+
return w[w.length - 1] ?? null;
|
|
407
536
|
}
|
|
408
|
-
function
|
|
409
|
-
let t =
|
|
537
|
+
function Je(e) {
|
|
538
|
+
let t = w.indexOf(e);
|
|
410
539
|
if (t === -1) return;
|
|
411
|
-
let n = t ===
|
|
412
|
-
|
|
413
|
-
let r =
|
|
540
|
+
let n = t === w.length - 1;
|
|
541
|
+
w.splice(t, 1);
|
|
542
|
+
let r = C?.videoTrack ?? null;
|
|
414
543
|
if (!n || r === null) return;
|
|
415
544
|
r.detach();
|
|
416
|
-
let i =
|
|
545
|
+
let i = qe();
|
|
417
546
|
i !== null && r.attach(i);
|
|
418
547
|
}
|
|
419
548
|
let Q = [];
|
|
420
|
-
Q.push(
|
|
421
|
-
let e =
|
|
422
|
-
if (e !==
|
|
549
|
+
Q.push(u.subscribe(() => {
|
|
550
|
+
let e = u.getState().avatarEnabled;
|
|
551
|
+
if (e !== y) {
|
|
423
552
|
if (e) {
|
|
424
|
-
|
|
553
|
+
u.setAvatarEnabled(!1);
|
|
425
554
|
return;
|
|
426
555
|
}
|
|
427
|
-
|
|
556
|
+
h.phase !== "off" && h.phase !== "checking" && h.phase !== "choosing" ? J(ve(), {}) : y = !1;
|
|
428
557
|
}
|
|
429
|
-
})),
|
|
430
|
-
if (
|
|
558
|
+
})), c.subscribeWorkspaceChange && Q.push(c.subscribeWorkspaceChange(() => {
|
|
559
|
+
if (_ = !1, Pe(), h.phase === "off" ? G({
|
|
431
560
|
problem: null,
|
|
432
561
|
avatars: [],
|
|
433
|
-
consentVersion: null
|
|
434
|
-
|
|
562
|
+
consentVersion: null,
|
|
563
|
+
minutes: null
|
|
564
|
+
}) : (J("workspace_switch", { problem: null }), G({
|
|
435
565
|
avatars: [],
|
|
436
|
-
consentVersion: null
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
566
|
+
consentVersion: null,
|
|
567
|
+
minutes: null
|
|
568
|
+
})), T) {
|
|
569
|
+
let e = x;
|
|
570
|
+
l.setTimeout(() => {
|
|
571
|
+
T && x === e && $.requestOn({ start: !1 });
|
|
441
572
|
}, 0);
|
|
442
573
|
}
|
|
443
|
-
})),
|
|
444
|
-
(
|
|
445
|
-
})),
|
|
574
|
+
})), c.subscribePageHide && Q.push(c.subscribePageHide(() => {
|
|
575
|
+
(S !== null || h.phase !== "off") && J("page_hide", { keepalive: !0 });
|
|
576
|
+
})), c.subscribePageHidden && Q.push(c.subscribePageHidden(() => {
|
|
577
|
+
c.endOnHide?.() === !0 && (S !== null || h.phase !== "off") && J("page_hide", { keepalive: !0 });
|
|
578
|
+
})), c.subscribePageVisible && Q.push(c.subscribePageVisible(() => {
|
|
579
|
+
P || Z(!0);
|
|
580
|
+
})), c.subscribePageShow && Q.push(c.subscribePageShow(Ee));
|
|
446
581
|
let $ = {
|
|
447
582
|
subscribe(e) {
|
|
448
|
-
return
|
|
449
|
-
|
|
583
|
+
return g.add(e), () => {
|
|
584
|
+
g.delete(e);
|
|
450
585
|
};
|
|
451
586
|
},
|
|
452
|
-
getSnapshot: () =>
|
|
587
|
+
getSnapshot: () => h,
|
|
453
588
|
setVoiceLive(e) {
|
|
454
|
-
if (
|
|
455
|
-
|
|
589
|
+
if (fe = !e, e) {
|
|
590
|
+
G({
|
|
456
591
|
voiceLive: !0,
|
|
457
|
-
problem:
|
|
592
|
+
problem: _ || T && W() ? h.problem : null,
|
|
458
593
|
notice: null
|
|
459
594
|
});
|
|
460
595
|
return;
|
|
461
596
|
}
|
|
462
|
-
if (
|
|
463
|
-
|
|
597
|
+
if (E = !1, T) {
|
|
598
|
+
G({ voiceLive: !1 });
|
|
464
599
|
return;
|
|
465
600
|
}
|
|
466
|
-
(
|
|
601
|
+
(S !== null || h.phase !== "off") && (h.phase === "checking" || h.phase === "choosing" ? (x += 1, G({ phase: "off" })) : J("voice_end", {})), G({
|
|
467
602
|
voiceLive: !1,
|
|
468
603
|
notice: null
|
|
469
604
|
});
|
|
470
605
|
},
|
|
471
606
|
requestOn(e = {}) {
|
|
472
|
-
if (
|
|
607
|
+
if (j || !h.offered || h.phase !== "off") return;
|
|
473
608
|
let t = e.start === void 0 ? "auto" : e.start ? "start" : "choose";
|
|
474
|
-
if (t === "start" &&
|
|
475
|
-
let n = e.avatarId ??
|
|
609
|
+
if (t === "start" && W()) return;
|
|
610
|
+
let n = e.avatarId ?? h.selectedAvatarId, r = h.consentVersion, i = c.client();
|
|
476
611
|
if (i === null) {
|
|
477
|
-
|
|
612
|
+
Y();
|
|
478
613
|
return;
|
|
479
614
|
}
|
|
480
|
-
t === "start" && (
|
|
481
|
-
let o = ++
|
|
482
|
-
|
|
615
|
+
t === "start" && (D = l.now());
|
|
616
|
+
let o = ++x, s = Oe();
|
|
617
|
+
F = !1, Ne(), G({
|
|
483
618
|
phase: "checking",
|
|
484
|
-
problem:
|
|
619
|
+
problem: W() ? h.problem : null,
|
|
485
620
|
notice: null
|
|
486
|
-
}),
|
|
487
|
-
if (
|
|
621
|
+
}), Ge((e) => i.availability(e)).then((e) => {
|
|
622
|
+
if (x !== o) return;
|
|
488
623
|
if (!e.available) {
|
|
489
|
-
|
|
624
|
+
Y(a(e.reason));
|
|
490
625
|
return;
|
|
491
626
|
}
|
|
492
|
-
|
|
493
|
-
let i = t === "start" && n !== null && e.avatars.includes(n),
|
|
494
|
-
switch (
|
|
627
|
+
ue = e.maxSessionSeconds * 1e3;
|
|
628
|
+
let i = t === "start" && n !== null && e.avatars.includes(n), c = u.getState().avatarId, l = i ? n : c !== null && e.avatars.includes(c) ? c : e.avatars[0] ?? null;
|
|
629
|
+
switch (G({
|
|
495
630
|
phase: "choosing",
|
|
496
631
|
avatars: e.avatars,
|
|
497
|
-
selectedAvatarId:
|
|
498
|
-
consentVersion: e.consentVersion
|
|
632
|
+
selectedAvatarId: l,
|
|
633
|
+
consentVersion: e.consentVersion,
|
|
634
|
+
...Ae(s, e.minutes ?? null)
|
|
499
635
|
}), t) {
|
|
500
636
|
case "auto":
|
|
501
|
-
|
|
637
|
+
le === e.consentVersion && e.avatars.length === 1 && $.confirm();
|
|
502
638
|
return;
|
|
503
639
|
case "start":
|
|
504
|
-
i && r === e.consentVersion ? $.confirm() :
|
|
640
|
+
i && r === e.consentVersion ? $.confirm() : D = null;
|
|
505
641
|
return;
|
|
506
642
|
case "choose": return;
|
|
507
643
|
}
|
|
508
644
|
}, (e) => {
|
|
509
|
-
|
|
645
|
+
Le(e), x === o && we(e);
|
|
510
646
|
});
|
|
511
647
|
},
|
|
512
648
|
confirm() {
|
|
513
|
-
if (
|
|
514
|
-
let e =
|
|
515
|
-
|
|
649
|
+
if (h.phase !== "choosing" || !(h.voiceLive || T) || W()) return;
|
|
650
|
+
let e = o(h.minutes);
|
|
651
|
+
if (e !== null) {
|
|
652
|
+
De(e);
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
let t = h.selectedAvatarId, n = h.consentVersion;
|
|
656
|
+
t === null || n === null || (le = n, u.setAvatarId(t), y = !0, E = !T, T && (D ??= l.now()), K(), We(t, n));
|
|
516
657
|
},
|
|
517
|
-
recheckRetry:
|
|
658
|
+
recheckRetry: Ee,
|
|
518
659
|
cancelChoice() {
|
|
519
|
-
|
|
660
|
+
h.phase === "choosing" && (x += 1, D = null, G({ phase: "off" }));
|
|
661
|
+
},
|
|
662
|
+
refreshMinutes() {
|
|
663
|
+
Z(!0);
|
|
664
|
+
},
|
|
665
|
+
checkMinutesPurchase() {
|
|
666
|
+
if (j || h.minutes === null) return;
|
|
667
|
+
let e = c.client();
|
|
668
|
+
if (e === null) return;
|
|
669
|
+
X();
|
|
670
|
+
let t = B, n = l.now(), r = N === null ? n : Math.max(n, N + p), i = h.minutes.balance?.availableMinutes ?? 0, a = 0;
|
|
671
|
+
G({ purchase: "checking" });
|
|
672
|
+
let o = () => {
|
|
673
|
+
if (V = null, t !== B) return;
|
|
674
|
+
a += 1;
|
|
675
|
+
let n = a >= 5;
|
|
676
|
+
if (h.phase !== "off" && h.phase !== "choosing" && h.phase !== "checking") {
|
|
677
|
+
X();
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
if (n || (V = l.setTimeout(o, r + a * p - l.now())), !Me() || h.phase === "checking" || P || H || l.now() < z) {
|
|
681
|
+
n && X();
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
H = !0;
|
|
685
|
+
let s = Oe();
|
|
686
|
+
Ge((t) => e.availability(t)).then((e) => {
|
|
687
|
+
if (H = !1, j) return;
|
|
688
|
+
let r = e.available ? e.minutes ?? null : null;
|
|
689
|
+
G(je(s, r)), t === B && ((r?.balance?.availableMinutes ?? 0) > i || n) && X();
|
|
690
|
+
}, (e) => {
|
|
691
|
+
H = !1, !j && (Le(e), t === B && n && X());
|
|
692
|
+
});
|
|
693
|
+
};
|
|
694
|
+
r > n ? V = l.setTimeout(o, r - n) : o();
|
|
520
695
|
},
|
|
521
696
|
setTabOpen(e) {
|
|
522
|
-
if (
|
|
523
|
-
if (
|
|
524
|
-
|
|
697
|
+
if (j || e === T) return;
|
|
698
|
+
if (T = e, e) {
|
|
699
|
+
if (G({ tabOpen: !0 }), h.phase === "checking") {
|
|
700
|
+
x += 1, G({ phase: "off" }), $.requestOn({ start: !1 });
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
Z(!0);
|
|
525
704
|
return;
|
|
526
705
|
}
|
|
527
|
-
|
|
528
|
-
let t =
|
|
706
|
+
D = null;
|
|
707
|
+
let t = h.phase;
|
|
529
708
|
if (t === "checking" || t === "choosing") {
|
|
530
|
-
|
|
709
|
+
x += 1, G({
|
|
531
710
|
tabOpen: !1,
|
|
532
711
|
phase: "off"
|
|
533
712
|
});
|
|
534
713
|
return;
|
|
535
714
|
}
|
|
536
|
-
(
|
|
715
|
+
(S !== null || t !== "off") && !h.heldByVoice && J("user", {}), G({ tabOpen: !1 });
|
|
537
716
|
},
|
|
538
717
|
selectAvatar(e) {
|
|
539
|
-
|
|
718
|
+
h.avatars.includes(e) && G({ selectedAvatarId: e });
|
|
540
719
|
},
|
|
541
720
|
switchOff() {
|
|
542
|
-
let { phase: e } =
|
|
543
|
-
if (!(
|
|
721
|
+
let { phase: e } = h;
|
|
722
|
+
if (!(T && D !== null && (e === "checking" || e === "starting" || e === "connecting") && l.now() - D < 1e3)) {
|
|
544
723
|
if (e === "checking" || e === "choosing") {
|
|
545
|
-
|
|
724
|
+
x += 1, D = null, G({ phase: "off" });
|
|
546
725
|
return;
|
|
547
726
|
}
|
|
548
|
-
if (e === "off" && !
|
|
549
|
-
|
|
727
|
+
if (e === "off" && !y) {
|
|
728
|
+
K();
|
|
550
729
|
return;
|
|
551
730
|
}
|
|
552
|
-
|
|
731
|
+
J(ve(), {});
|
|
553
732
|
}
|
|
554
733
|
},
|
|
555
734
|
resumeAudio() {
|
|
556
|
-
let e =
|
|
557
|
-
e !== null && (e.transport.resumeAudio().catch(() => void 0), e.meter?.resume().catch(() => void 0));
|
|
735
|
+
let e = C;
|
|
736
|
+
e !== null && (e.transport.resumeAudio().catch(() => void 0), e.meter?.resume().catch(() => void 0), h.videoBlocked && e.transport.resumeVideo().catch(() => void 0));
|
|
558
737
|
},
|
|
559
738
|
setStageMounted(e) {
|
|
560
|
-
|
|
739
|
+
de = Math.max(0, de + (e ? 1 : -1));
|
|
561
740
|
},
|
|
562
741
|
attachVideo(e) {
|
|
563
742
|
if (e === null) {
|
|
564
|
-
let e =
|
|
565
|
-
e !== null &&
|
|
743
|
+
let e = qe();
|
|
744
|
+
e !== null && Je(e);
|
|
566
745
|
return;
|
|
567
746
|
}
|
|
568
|
-
let t =
|
|
569
|
-
t !== -1 &&
|
|
570
|
-
let n =
|
|
571
|
-
return n !== null && (n.detach(), n.attach(e)), () =>
|
|
747
|
+
let t = w.indexOf(e);
|
|
748
|
+
t !== -1 && w.splice(t, 1), w.push(e);
|
|
749
|
+
let n = C?.videoTrack ?? null;
|
|
750
|
+
return n !== null && (n.detach(), n.attach(e)), () => Je(e);
|
|
572
751
|
},
|
|
573
752
|
route(e, t) {
|
|
574
|
-
if (
|
|
753
|
+
if (h.phase !== "ready" || b || !y || de === 0 || C === null || C.port.isAudioBlocked() || e.fallback === !1) return "speakers";
|
|
575
754
|
let n = e.voice;
|
|
576
|
-
return n !== null && n.source !== "hosted" || !t.listVoices().some((e) => e.source === "hosted") ? (
|
|
755
|
+
return n !== null && n.source !== "hosted" || !t.listVoices().some((e) => e.source === "hosted") ? (U({
|
|
577
756
|
event: "notice",
|
|
578
757
|
notice: { kind: "needs-hosted-voice" }
|
|
579
|
-
}),
|
|
758
|
+
}), G({ problem: "needs-hosted-voice" }), "speakers") : (h.problem === "needs-hosted-voice" && G({ problem: null }), "avatar");
|
|
580
759
|
},
|
|
581
|
-
createOutput: () =>
|
|
760
|
+
createOutput: () => q.createOutput(),
|
|
582
761
|
dispose() {
|
|
583
|
-
if (!
|
|
584
|
-
|
|
762
|
+
if (!j) {
|
|
763
|
+
j = !0, (S !== null || h.phase !== "off") && J("user", {}), A?.(), A = null, Ne(), B += 1, V?.(), V = null;
|
|
585
764
|
for (let e of Q.splice(0)) e();
|
|
586
|
-
|
|
765
|
+
Be(), g.clear();
|
|
587
766
|
}
|
|
588
767
|
}
|
|
589
768
|
};
|
|
590
769
|
return $;
|
|
591
770
|
}
|
|
592
771
|
//#endregion
|
|
593
|
-
export {
|
|
772
|
+
export { d as LIVE_AVATAR_CONNECT_TIMEOUT_MS, l as LIVE_AVATAR_END_BEFORE_DEADLINE_MS, c as LIVE_AVATAR_IDLE_MS, te as LIVE_AVATAR_MINUTES_BUSY_RETRIES, f as LIVE_AVATAR_MINUTES_REFRESH_MS, ne as LIVE_AVATAR_PURCHASE_POLLS, p as LIVE_AVATAR_PURCHASE_POLL_MS, u as LIVE_AVATAR_REQUEST_TIMEOUT_MS, m as LIVE_AVATAR_TAB_OFF_GUARD_MS, h as createLiveAvatarController };
|