@rqmii_immersive/agent-react-sdk 1.0.5 → 1.0.6
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Yp, { createContext as mg, useState as jr, useRef as
|
|
1
|
+
import Yp, { createContext as mg, useState as jr, useRef as Et, useEffect as xr, useCallback as Qe, useMemo as Jp, useContext as gg } from "react";
|
|
2
2
|
var Ai = { exports: {} }, Ys = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
@@ -216,8 +216,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
216
216
|
}
|
|
217
217
|
if (ot = null, et !== void 0 && (n(et), ot = "" + et), C(Ae) && (n(Ae.key), ot = "" + Ae.key), "key" in Ae) {
|
|
218
218
|
et = {};
|
|
219
|
-
for (var
|
|
220
|
-
|
|
219
|
+
for (var Yt in Ae)
|
|
220
|
+
Yt !== "key" && (et[Yt] = Ae[Yt]);
|
|
221
221
|
} else et = Ae;
|
|
222
222
|
return ot && R(
|
|
223
223
|
et,
|
|
@@ -276,7 +276,7 @@ var gp;
|
|
|
276
276
|
function vg() {
|
|
277
277
|
return gp || (gp = 1, process.env.NODE_ENV === "production" ? Ai.exports = yg() : Ai.exports = wg()), Ai.exports;
|
|
278
278
|
}
|
|
279
|
-
var
|
|
279
|
+
var lr = vg();
|
|
280
280
|
const Dr = /* @__PURE__ */ Object.create(null);
|
|
281
281
|
Dr.open = "0";
|
|
282
282
|
Dr.close = "1";
|
|
@@ -491,13 +491,13 @@ Lt.prototype.listeners = function(c) {
|
|
|
491
491
|
Lt.prototype.hasListeners = function(c) {
|
|
492
492
|
return !!this.listeners(c).length;
|
|
493
493
|
};
|
|
494
|
-
const Vi = typeof Promise == "function" && typeof Promise.resolve == "function" ? (r) => Promise.resolve().then(r) : (r, n) => n(r, 0),
|
|
494
|
+
const Vi = typeof Promise == "function" && typeof Promise.resolve == "function" ? (r) => Promise.resolve().then(r) : (r, n) => n(r, 0), ur = typeof self < "u" ? self : typeof window < "u" ? window : Function("return this")(), Rg = "arraybuffer";
|
|
495
495
|
function af(c, ...r) {
|
|
496
496
|
return r.reduce((n, a) => (c.hasOwnProperty(a) && (n[a] = c[a]), n), {});
|
|
497
497
|
}
|
|
498
|
-
const Ag =
|
|
498
|
+
const Ag = ur.setTimeout, Mg = ur.clearTimeout;
|
|
499
499
|
function Gi(c, r) {
|
|
500
|
-
r.useNativeTimers ? (c.setTimeoutFn = Ag.bind(
|
|
500
|
+
r.useNativeTimers ? (c.setTimeoutFn = Ag.bind(ur), c.clearTimeoutFn = Mg.bind(ur)) : (c.setTimeoutFn = ur.setTimeout.bind(ur), c.clearTimeoutFn = ur.clearTimeout.bind(ur));
|
|
501
501
|
}
|
|
502
502
|
const Ig = 1.33;
|
|
503
503
|
function Pg(c) {
|
|
@@ -874,7 +874,7 @@ if (typeof document < "u") {
|
|
|
874
874
|
if (typeof attachEvent == "function")
|
|
875
875
|
attachEvent("onunload", _p);
|
|
876
876
|
else if (typeof addEventListener == "function") {
|
|
877
|
-
const c = "onpagehide" in
|
|
877
|
+
const c = "onpagehide" in ur ? "pagehide" : "unload";
|
|
878
878
|
addEventListener(c, _p, !1);
|
|
879
879
|
}
|
|
880
880
|
}
|
|
@@ -907,7 +907,7 @@ function uf(c) {
|
|
|
907
907
|
}
|
|
908
908
|
if (!r)
|
|
909
909
|
try {
|
|
910
|
-
return new
|
|
910
|
+
return new ur[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP");
|
|
911
911
|
} catch {
|
|
912
912
|
}
|
|
913
913
|
}
|
|
@@ -968,7 +968,7 @@ class qg extends Ao {
|
|
|
968
968
|
return this.opts.timestampRequests && (n[this.opts.timestampParam] = of()), this.supportsBinary || (n.b64 = 1), this.createUri(r, n);
|
|
969
969
|
}
|
|
970
970
|
}
|
|
971
|
-
const so =
|
|
971
|
+
const so = ur.WebSocket || ur.MozWebSocket;
|
|
972
972
|
class Wg extends qg {
|
|
973
973
|
createSocket(r, n, a) {
|
|
974
974
|
return df ? new so(r, n, a) : n ? new so(r, n) : new so(r);
|
|
@@ -2738,7 +2738,7 @@ const sn = {
|
|
|
2738
2738
|
RECONNECTING: "reconnecting",
|
|
2739
2739
|
FAILED: "failed",
|
|
2740
2740
|
ENDED: "ended"
|
|
2741
|
-
},
|
|
2741
|
+
}, rr = {
|
|
2742
2742
|
IDLE: "idle",
|
|
2743
2743
|
CONNECTING: "connecting",
|
|
2744
2744
|
LOADING: "loading",
|
|
@@ -2794,7 +2794,7 @@ const sn = {
|
|
|
2794
2794
|
isAudioPlaying: !1,
|
|
2795
2795
|
isAvatarSpeaking: !1,
|
|
2796
2796
|
cloudStream: {
|
|
2797
|
-
state:
|
|
2797
|
+
state: rr.IDLE,
|
|
2798
2798
|
error: null
|
|
2799
2799
|
},
|
|
2800
2800
|
transcript: null,
|
|
@@ -2821,6 +2821,13 @@ const sn = {
|
|
|
2821
2821
|
}, n.setOnEnd(() => {
|
|
2822
2822
|
f || r?.();
|
|
2823
2823
|
}), n._isDestroyed = () => f, n;
|
|
2824
|
+
}, vy = () => {
|
|
2825
|
+
try {
|
|
2826
|
+
const c = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
2827
|
+
return typeof c == "string" && c.trim() ? c.trim() : void 0;
|
|
2828
|
+
} catch {
|
|
2829
|
+
return;
|
|
2830
|
+
}
|
|
2824
2831
|
}, $p = async (c) => {
|
|
2825
2832
|
if (!c?.ok) {
|
|
2826
2833
|
let r = `HTTP ${c.status}`;
|
|
@@ -2833,7 +2840,7 @@ const sn = {
|
|
|
2833
2840
|
}
|
|
2834
2841
|
return c.json();
|
|
2835
2842
|
};
|
|
2836
|
-
function
|
|
2843
|
+
function _y({
|
|
2837
2844
|
children: c,
|
|
2838
2845
|
wsUrl: r,
|
|
2839
2846
|
restUrl: n,
|
|
@@ -2842,10 +2849,10 @@ function vy({
|
|
|
2842
2849
|
pcmOptions: v,
|
|
2843
2850
|
debug: C = !1
|
|
2844
2851
|
}) {
|
|
2845
|
-
const [R, _] = jr(Tp), U =
|
|
2852
|
+
const [R, _] = jr(Tp), U = Et(null), B = Et(null), te = Et(!1), X = Et(!1), ee = Et({
|
|
2846
2853
|
...Sp,
|
|
2847
2854
|
...a
|
|
2848
|
-
}), ie =
|
|
2855
|
+
}), ie = Et(yy()), de = Et(null), le = Et(!1), Le = Et(null), Ce = Et(Tp.session.agentType);
|
|
2849
2856
|
xr(() => {
|
|
2850
2857
|
ee.current = {
|
|
2851
2858
|
...Sp,
|
|
@@ -2924,7 +2931,7 @@ function vy({
|
|
|
2924
2931
|
transcript: null,
|
|
2925
2932
|
partialTranscript: null,
|
|
2926
2933
|
cloudStream: {
|
|
2927
|
-
state:
|
|
2934
|
+
state: rr.IDLE,
|
|
2928
2935
|
error: null
|
|
2929
2936
|
},
|
|
2930
2937
|
session: {
|
|
@@ -2984,7 +2991,7 @@ function vy({
|
|
|
2984
2991
|
re(Vt.ENDED), _((fe) => ({ ...fe, isSessionReady: !1 }));
|
|
2985
2992
|
}), pe.on(lt.TRANSCRIPT, (fe) => {
|
|
2986
2993
|
_((Ue) => {
|
|
2987
|
-
const
|
|
2994
|
+
const Tt = { ...Ue, transcript: fe || null };
|
|
2988
2995
|
if (fe?.is_final && fe?.text?.trim()) {
|
|
2989
2996
|
const Rt = {
|
|
2990
2997
|
id: `transcript-${Date.now()}`,
|
|
@@ -2992,27 +2999,27 @@ function vy({
|
|
|
2992
2999
|
text: fe.text.trim(),
|
|
2993
3000
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
2994
3001
|
};
|
|
2995
|
-
|
|
3002
|
+
Tt.messages = [...Ue.messages, Rt];
|
|
2996
3003
|
}
|
|
2997
|
-
return
|
|
3004
|
+
return Tt;
|
|
2998
3005
|
});
|
|
2999
3006
|
}), pe.on(lt.PARTIAL_TRANSCRIPT, (fe) => {
|
|
3000
3007
|
_((Ue) => ({ ...Ue, partialTranscript: fe || null }));
|
|
3001
3008
|
}), pe.on(lt.AGENT_RESPONSE_CHUNK, (fe) => {
|
|
3002
|
-
const { id: Ue, text:
|
|
3009
|
+
const { id: Ue, text: Tt } = ie.current.addChunk(
|
|
3003
3010
|
fe?.requestId,
|
|
3004
3011
|
fe?.text
|
|
3005
3012
|
);
|
|
3006
3013
|
_((Rt) => {
|
|
3007
|
-
const
|
|
3014
|
+
const jt = Rt.messages.filter((cr) => cr.id !== Ue);
|
|
3008
3015
|
return {
|
|
3009
3016
|
...Rt,
|
|
3010
3017
|
messages: [
|
|
3011
|
-
...
|
|
3018
|
+
...jt,
|
|
3012
3019
|
{
|
|
3013
3020
|
id: Ue,
|
|
3014
3021
|
role: "assistant",
|
|
3015
|
-
text:
|
|
3022
|
+
text: Tt,
|
|
3016
3023
|
streaming: !0,
|
|
3017
3024
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
3018
3025
|
}
|
|
@@ -3020,20 +3027,20 @@ function vy({
|
|
|
3020
3027
|
};
|
|
3021
3028
|
});
|
|
3022
3029
|
}), pe.on(lt.AGENT_RESPONSE, (fe) => {
|
|
3023
|
-
const { id: Ue, text:
|
|
3030
|
+
const { id: Ue, text: Tt } = ie.current.consume(
|
|
3024
3031
|
fe?.requestId,
|
|
3025
3032
|
fe?.text
|
|
3026
3033
|
);
|
|
3027
3034
|
_((Rt) => {
|
|
3028
|
-
const
|
|
3035
|
+
const jt = Rt.messages.filter((cr) => cr.id !== Ue);
|
|
3029
3036
|
return {
|
|
3030
3037
|
...Rt,
|
|
3031
3038
|
messages: [
|
|
3032
|
-
...
|
|
3039
|
+
...jt,
|
|
3033
3040
|
{
|
|
3034
3041
|
id: Ue,
|
|
3035
3042
|
role: "assistant",
|
|
3036
|
-
text:
|
|
3043
|
+
text: Tt,
|
|
3037
3044
|
streaming: !1,
|
|
3038
3045
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
3039
3046
|
}
|
|
@@ -3049,14 +3056,14 @@ function vy({
|
|
|
3049
3056
|
const Ue = io(Ce.current);
|
|
3050
3057
|
if (Ue === sn.CLOUD_AVATAR || Ue === sn.DESKTOP_AVATAR)
|
|
3051
3058
|
return;
|
|
3052
|
-
const
|
|
3053
|
-
if (!
|
|
3059
|
+
const Tt = gy(fe?.audio);
|
|
3060
|
+
if (!Tt) return;
|
|
3054
3061
|
const Rt = he();
|
|
3055
3062
|
if (Rt)
|
|
3056
3063
|
try {
|
|
3057
|
-
Rt.feed(
|
|
3058
|
-
} catch (
|
|
3059
|
-
ce("feed pcm failed",
|
|
3064
|
+
Rt.feed(Tt), _((jt) => ({ ...jt, isAudioPlaying: !0 }));
|
|
3065
|
+
} catch (jt) {
|
|
3066
|
+
ce("feed pcm failed", jt);
|
|
3060
3067
|
}
|
|
3061
3068
|
}), pe.on(lt.AGENT_AUDIO_COMPLETE, () => {
|
|
3062
3069
|
if (!f || !de.current) return;
|
|
@@ -3110,12 +3117,12 @@ function vy({
|
|
|
3110
3117
|
reject: ct
|
|
3111
3118
|
}), wt) {
|
|
3112
3119
|
const Ue = () => {
|
|
3113
|
-
fe.off(lt.RECONNECT_FAILED,
|
|
3114
|
-
},
|
|
3120
|
+
fe.off(lt.RECONNECT_FAILED, Tt), dt();
|
|
3121
|
+
}, Tt = (Rt) => {
|
|
3115
3122
|
fe.off(lt.RECONNECT_SUCCESS, Ue), ct(new Error(Rt?.reason || "Reconnect failed"));
|
|
3116
3123
|
};
|
|
3117
|
-
fe.once(lt.RECONNECT_SUCCESS, Ue), fe.once(lt.RECONNECT_FAILED,
|
|
3118
|
-
fe.off(lt.RECONNECT_SUCCESS, Ue), fe.off(lt.RECONNECT_FAILED,
|
|
3124
|
+
fe.once(lt.RECONNECT_SUCCESS, Ue), fe.once(lt.RECONNECT_FAILED, Tt), setTimeout(() => {
|
|
3125
|
+
fe.off(lt.RECONNECT_SUCCESS, Ue), fe.off(lt.RECONNECT_FAILED, Tt), ct(new Error("Reconnect timed out"));
|
|
3119
3126
|
}, ee.current.timeoutMs);
|
|
3120
3127
|
}
|
|
3121
3128
|
}),
|
|
@@ -3174,20 +3181,25 @@ function vy({
|
|
|
3174
3181
|
method: "POST",
|
|
3175
3182
|
headers: { "Content-Type": "application/json" },
|
|
3176
3183
|
body: JSON.stringify(ct)
|
|
3177
|
-
}).then($p), Ue = fe?.session_id || null,
|
|
3178
|
-
if (!Ue || !
|
|
3184
|
+
}).then($p), Ue = fe?.session_id || null, Tt = fe?.session_token;
|
|
3185
|
+
if (!Ue || !Tt)
|
|
3179
3186
|
throw new Error("Invalid initialize session response");
|
|
3180
|
-
|
|
3181
|
-
...
|
|
3187
|
+
_((jt) => ({
|
|
3188
|
+
...jt,
|
|
3182
3189
|
session: {
|
|
3183
|
-
...
|
|
3190
|
+
...jt.session,
|
|
3184
3191
|
sessionId: Ue,
|
|
3185
|
-
agentType: fe?.streaming_url ? sn.CLOUD_AVATAR :
|
|
3192
|
+
agentType: fe?.streaming_url ? sn.CLOUD_AVATAR : jt.session.agentType,
|
|
3186
3193
|
streamingUrl: fe?.streaming_url || null,
|
|
3187
3194
|
uniqueId: fe?.unique_id || null,
|
|
3188
3195
|
role: null
|
|
3189
3196
|
}
|
|
3190
|
-
})), re(Vt.CONNECTING), fe?.streaming_url ? Ke(
|
|
3197
|
+
})), re(Vt.CONNECTING), fe?.streaming_url ? Ke(rr.CONNECTING) : Ke(rr.IDLE);
|
|
3198
|
+
const Rt = vy();
|
|
3199
|
+
return await yt({
|
|
3200
|
+
authPayload: Rt ? { token: Tt, timezone: Rt } : { token: Tt },
|
|
3201
|
+
queryToken: Tt
|
|
3202
|
+
}), fe;
|
|
3191
3203
|
},
|
|
3192
3204
|
[
|
|
3193
3205
|
yt,
|
|
@@ -3220,7 +3232,10 @@ function vy({
|
|
|
3220
3232
|
role: "user",
|
|
3221
3233
|
agentType: sn.DESKTOP_AVATAR
|
|
3222
3234
|
}
|
|
3223
|
-
})), re(Vt.CONNECTING), Ke(
|
|
3235
|
+
})), re(Vt.CONNECTING), Ke(rr.IDLE), await yt({
|
|
3236
|
+
authPayload: { token: dt },
|
|
3237
|
+
queryToken: dt
|
|
3238
|
+
}), Ne;
|
|
3224
3239
|
},
|
|
3225
3240
|
[
|
|
3226
3241
|
yt,
|
|
@@ -3266,7 +3281,7 @@ function vy({
|
|
|
3266
3281
|
), tt = Qe(
|
|
3267
3282
|
(pe) => pe ? Q(lt.CHANGE_SESSION_LANGUAGE, { language: pe }) : !1,
|
|
3268
3283
|
[Q]
|
|
3269
|
-
),
|
|
3284
|
+
), Yt = Qe(() => {
|
|
3270
3285
|
ie.current.clear(), _((pe) => ({ ...pe, messages: [] }));
|
|
3271
3286
|
}, []);
|
|
3272
3287
|
xr(() => () => {
|
|
@@ -3287,7 +3302,7 @@ function vy({
|
|
|
3287
3302
|
refreshSessionActivity: kt,
|
|
3288
3303
|
clearSessionHistory: ot,
|
|
3289
3304
|
changeSessionLanguage: tt,
|
|
3290
|
-
clearMessages:
|
|
3305
|
+
clearMessages: Yt,
|
|
3291
3306
|
resumeAudioPlayback: me,
|
|
3292
3307
|
attachAudioElement: ut,
|
|
3293
3308
|
setCloudStreamState: Ke,
|
|
@@ -3296,7 +3311,7 @@ function vy({
|
|
|
3296
3311
|
}),
|
|
3297
3312
|
[
|
|
3298
3313
|
ut,
|
|
3299
|
-
|
|
3314
|
+
Yt,
|
|
3300
3315
|
ot,
|
|
3301
3316
|
rt,
|
|
3302
3317
|
Q,
|
|
@@ -3314,7 +3329,7 @@ function vy({
|
|
|
3314
3329
|
R
|
|
3315
3330
|
]
|
|
3316
3331
|
);
|
|
3317
|
-
return /* @__PURE__ */
|
|
3332
|
+
return /* @__PURE__ */ lr.jsx(pf.Provider, { value: vt, children: c });
|
|
3318
3333
|
}
|
|
3319
3334
|
const on = () => {
|
|
3320
3335
|
const c = gg(pf);
|
|
@@ -3323,10 +3338,10 @@ const on = () => {
|
|
|
3323
3338
|
"useRqmiiAgentContext must be used inside <RqmiiAgentProvider>"
|
|
3324
3339
|
);
|
|
3325
3340
|
return c;
|
|
3326
|
-
},
|
|
3341
|
+
}, by = [
|
|
3327
3342
|
"Cannot read properties of null (reading 'state')",
|
|
3328
3343
|
"MicVAD has null stream"
|
|
3329
|
-
], xp = (c) => c ?
|
|
3344
|
+
], xp = (c) => c ? by.some((r) => String(c).includes(r)) : !1;
|
|
3330
3345
|
function ff() {
|
|
3331
3346
|
typeof window > "u" || window.__rqmiiAudioErrorSuppressorsInstalled || (window.__rqmiiAudioErrorSuppressorsInstalled = !0, window.addEventListener("error", (c) => {
|
|
3332
3347
|
if (xp(c?.message))
|
|
@@ -3337,18 +3352,18 @@ function ff() {
|
|
|
3337
3352
|
}));
|
|
3338
3353
|
}
|
|
3339
3354
|
ff();
|
|
3340
|
-
const
|
|
3355
|
+
const Sy = {
|
|
3341
3356
|
echoCancellation: !0,
|
|
3342
3357
|
noiseSuppression: !0,
|
|
3343
3358
|
autoGainControl: !0,
|
|
3344
3359
|
channelCount: 1,
|
|
3345
3360
|
sampleRate: 16e3
|
|
3346
|
-
},
|
|
3361
|
+
}, Ty = [
|
|
3347
3362
|
"audio/webm;codecs=opus",
|
|
3348
3363
|
"audio/webm",
|
|
3349
3364
|
"audio/mp4"
|
|
3350
|
-
],
|
|
3351
|
-
function
|
|
3365
|
+
], $y = () => typeof window > "u" || !window.MediaRecorder?.isTypeSupported ? "" : Ty.find((c) => window.MediaRecorder.isTypeSupported(c)) || "";
|
|
3366
|
+
function Uw(c = {}) {
|
|
3352
3367
|
const {
|
|
3353
3368
|
onAudioChunk: r,
|
|
3354
3369
|
onAudioEnd: n,
|
|
@@ -3356,8 +3371,8 @@ function Nw(c = {}) {
|
|
|
3356
3371
|
holdDelayMs: f = 220,
|
|
3357
3372
|
timesliceMs: v = 100,
|
|
3358
3373
|
interruptOnHoldStart: C = !0,
|
|
3359
|
-
audioConstraints: R =
|
|
3360
|
-
} = c, { sendAudioChunk: _, endAudioStream: U, interrupt: B } = on(), te =
|
|
3374
|
+
audioConstraints: R = Sy
|
|
3375
|
+
} = c, { sendAudioChunk: _, endAudioStream: U, interrupt: B } = on(), te = Et(null), X = Et(null), ee = Et(null), ie = Et(!0), [de, le] = jr(!1), [Le, Ce] = jr(!1), [ce, re] = jr(null), ue = Qe(
|
|
3361
3376
|
async (Be) => {
|
|
3362
3377
|
if (!Be || Be.size <= 0) return;
|
|
3363
3378
|
const Xe = await Be.arrayBuffer();
|
|
@@ -3400,7 +3415,7 @@ function Nw(c = {}) {
|
|
|
3400
3415
|
try {
|
|
3401
3416
|
const Be = await navigator.mediaDevices.getUserMedia({ audio: R });
|
|
3402
3417
|
X.current = Be;
|
|
3403
|
-
const Xe =
|
|
3418
|
+
const Xe = $y(), mt = Xe ? { mimeType: Xe } : void 0, yt = new window.MediaRecorder(Be, mt);
|
|
3404
3419
|
return yt.ondataavailable = (at) => {
|
|
3405
3420
|
ue(at.data);
|
|
3406
3421
|
}, yt.onerror = (at) => {
|
|
@@ -3565,7 +3580,7 @@ function Oo() {
|
|
|
3565
3580
|
return Gr.FrameProcessor = v, Gr;
|
|
3566
3581
|
}
|
|
3567
3582
|
var qr = {};
|
|
3568
|
-
function
|
|
3583
|
+
function dr(c) {
|
|
3569
3584
|
throw new Error('Could not dynamically require "' + c + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
|
|
3570
3585
|
}
|
|
3571
3586
|
var lo = { exports: {} };
|
|
@@ -3575,11 +3590,11 @@ var lo = { exports: {} };
|
|
|
3575
3590
|
* Licensed under the MIT License.
|
|
3576
3591
|
*/
|
|
3577
3592
|
var Mp;
|
|
3578
|
-
function
|
|
3593
|
+
function xy() {
|
|
3579
3594
|
return Mp || (Mp = 1, (function(c, r) {
|
|
3580
3595
|
var n = (() => {
|
|
3581
|
-
var a = Object.defineProperty, f = Object.getOwnPropertyDescriptor, v = Object.getOwnPropertyNames, C = Object.prototype.hasOwnProperty, R = ((e) => typeof
|
|
3582
|
-
if (typeof
|
|
3596
|
+
var a = Object.defineProperty, f = Object.getOwnPropertyDescriptor, v = Object.getOwnPropertyNames, C = Object.prototype.hasOwnProperty, R = ((e) => typeof dr < "u" ? dr : typeof Proxy < "u" ? new Proxy(e, { get: (t, s) => (typeof dr < "u" ? dr : t)[s] }) : e)(function(e) {
|
|
3597
|
+
if (typeof dr < "u") return dr.apply(this, arguments);
|
|
3583
3598
|
throw Error('Dynamic require of "' + e + '" is not supported');
|
|
3584
3599
|
}), _ = (e, t) => () => (e && (t = e(e = 0)), t), U = (e, t) => {
|
|
3585
3600
|
for (var s in t) a(e, s, { get: t[s], enumerable: !0 });
|
|
@@ -3683,7 +3698,7 @@ function $y() {
|
|
|
3683
3698
|
return i;
|
|
3684
3699
|
};
|
|
3685
3700
|
}), Xe, mt, yt, at, Ye, De, rt = _(() => {
|
|
3686
|
-
|
|
3701
|
+
Yt(), Xe = (e, t) => {
|
|
3687
3702
|
if (e === void 0) throw new Error("Image buffer must be defined");
|
|
3688
3703
|
if (t.height === void 0 || t.width === void 0) throw new Error("Image height and width must be defined");
|
|
3689
3704
|
if (t.tensorLayout === "NHWC") throw new Error("NHWC Tensor layout is not supported yet");
|
|
@@ -3763,7 +3778,7 @@ function $y() {
|
|
|
3763
3778
|
}
|
|
3764
3779
|
};
|
|
3765
3780
|
}), qt, kt, ot = _(() => {
|
|
3766
|
-
|
|
3781
|
+
Yt(), qt = (e) => {
|
|
3767
3782
|
let t = 1;
|
|
3768
3783
|
for (let s = 0; s < e.length; s++) {
|
|
3769
3784
|
let i = e[s];
|
|
@@ -3788,7 +3803,7 @@ function $y() {
|
|
|
3788
3803
|
throw new Error(`tensorReshape: tensor location ${e.location} is not supported`);
|
|
3789
3804
|
}
|
|
3790
3805
|
};
|
|
3791
|
-
}), tt,
|
|
3806
|
+
}), tt, Yt = _(() => {
|
|
3792
3807
|
Be(), rt(), gt(), ot(), tt = class {
|
|
3793
3808
|
constructor(e, t, s) {
|
|
3794
3809
|
et();
|
|
@@ -3931,8 +3946,8 @@ function $y() {
|
|
|
3931
3946
|
}
|
|
3932
3947
|
};
|
|
3933
3948
|
}), vt, pe = _(() => {
|
|
3934
|
-
|
|
3935
|
-
}), Ne, wt, dt, ct, fe, Ue,
|
|
3949
|
+
Yt(), vt = tt;
|
|
3950
|
+
}), Ne, wt, dt, ct, fe, Ue, Tt = _(() => {
|
|
3936
3951
|
Me(), Ne = (e, t) => {
|
|
3937
3952
|
(typeof he.trace > "u" ? !he.wasm.trace : !he.trace) || console.timeStamp(`${e}::ORT::${t}`);
|
|
3938
3953
|
}, wt = (e, t) => {
|
|
@@ -3954,8 +3969,8 @@ function $y() {
|
|
|
3954
3969
|
}, Ue = (e) => {
|
|
3955
3970
|
(typeof he.trace > "u" ? !he.wasm.trace : !he.trace) || console.timeEnd(`ORT::${e}`);
|
|
3956
3971
|
};
|
|
3957
|
-
}), Rt,
|
|
3958
|
-
Le(), pe(),
|
|
3972
|
+
}), Rt, jt = _(() => {
|
|
3973
|
+
Le(), pe(), Tt(), Rt = class gf {
|
|
3959
3974
|
constructor(t) {
|
|
3960
3975
|
this.handler = t;
|
|
3961
3976
|
}
|
|
@@ -4048,7 +4063,7 @@ function $y() {
|
|
|
4048
4063
|
}
|
|
4049
4064
|
};
|
|
4050
4065
|
}), cr, Wi = _(() => {
|
|
4051
|
-
|
|
4066
|
+
jt(), cr = Rt;
|
|
4052
4067
|
}), Hi = _(() => {
|
|
4053
4068
|
}), ji = _(() => {
|
|
4054
4069
|
}), Ki = _(() => {
|
|
@@ -4056,12 +4071,12 @@ function $y() {
|
|
|
4056
4071
|
}), ls = {};
|
|
4057
4072
|
U(ls, { InferenceSession: () => cr, TRACE: () => Ne, TRACE_EVENT_BEGIN: () => fe, TRACE_EVENT_END: () => Ue, TRACE_FUNC_BEGIN: () => dt, TRACE_FUNC_END: () => ct, Tensor: () => vt, env: () => me, registerBackend: () => ie });
|
|
4058
4073
|
var zt = _(() => {
|
|
4059
|
-
Ce(), ut(), Wi(), pe(), Hi(), ji(),
|
|
4074
|
+
Ce(), ut(), Wi(), pe(), Hi(), ji(), Tt(), Ki(), Qi();
|
|
4060
4075
|
}), ln = _(() => {
|
|
4061
4076
|
}), us = {};
|
|
4062
4077
|
U(us, { default: () => ds });
|
|
4063
4078
|
var un, dn, ds, Xi = _(() => {
|
|
4064
|
-
Zh(),
|
|
4079
|
+
Zh(), Jt(), mn(), un = "ort-wasm-proxy-worker", dn = globalThis.self?.name === un, dn && (self.onmessage = (e) => {
|
|
4065
4080
|
let { type: t, in: s } = e.data;
|
|
4066
4081
|
try {
|
|
4067
4082
|
switch (t) {
|
|
@@ -4160,7 +4175,7 @@ function $y() {
|
|
|
4160
4175
|
return [d ? h : void 0, await ms(h)];
|
|
4161
4176
|
}
|
|
4162
4177
|
};
|
|
4163
|
-
}), gn, Br, hr, yn, ws, vs, _s, wn, Oe,
|
|
4178
|
+
}), gn, Br, hr, yn, ws, vs, _s, wn, Oe, Jt = _(() => {
|
|
4164
4179
|
mn(), Br = !1, hr = !1, yn = !1, ws = () => {
|
|
4165
4180
|
if (typeof SharedArrayBuffer > "u") return !1;
|
|
4166
4181
|
try {
|
|
@@ -4218,7 +4233,7 @@ function $y() {
|
|
|
4218
4233
|
throw new Error("WebAssembly is not initialized yet.");
|
|
4219
4234
|
};
|
|
4220
4235
|
}), Ct, Nr, ke, vn = _(() => {
|
|
4221
|
-
|
|
4236
|
+
Jt(), Ct = (e, t) => {
|
|
4222
4237
|
let s = Oe(), i = s.lengthBytesUTF8(e) + 1, o = s._malloc(i);
|
|
4223
4238
|
return s.stringToUTF8(e, o, i), t.push(o), o;
|
|
4224
4239
|
}, Nr = (e, t, s, i) => {
|
|
@@ -4245,7 +4260,7 @@ function $y() {
|
|
|
4245
4260
|
}
|
|
4246
4261
|
};
|
|
4247
4262
|
}), bs, Yi = _(() => {
|
|
4248
|
-
|
|
4263
|
+
Jt(), vn(), bs = (e) => {
|
|
4249
4264
|
let t = Oe(), s = 0, i = [], o = e || {};
|
|
4250
4265
|
try {
|
|
4251
4266
|
if (e?.logSeverityLevel === void 0) o.logSeverityLevel = 2;
|
|
@@ -4263,7 +4278,7 @@ function $y() {
|
|
|
4263
4278
|
}
|
|
4264
4279
|
};
|
|
4265
4280
|
}), Ss, Ts, $s, pr, xs, Es, Ji = _(() => {
|
|
4266
|
-
|
|
4281
|
+
Jt(), vn(), Ss = (e) => {
|
|
4267
4282
|
switch (e) {
|
|
4268
4283
|
case "disabled":
|
|
4269
4284
|
return 0;
|
|
@@ -4353,8 +4368,8 @@ function $y() {
|
|
|
4353
4368
|
throw s !== 0 && t._OrtReleaseSessionOptions(s) !== 0 && ke("Can't release session options."), i.forEach((u) => t._free(u)), l;
|
|
4354
4369
|
}
|
|
4355
4370
|
};
|
|
4356
|
-
}),
|
|
4357
|
-
|
|
4371
|
+
}), Zt, er, tr, _n, bn, Sn, Tn, Un, Ie = _(() => {
|
|
4372
|
+
Zt = (e) => {
|
|
4358
4373
|
switch (e) {
|
|
4359
4374
|
case "int8":
|
|
4360
4375
|
return 3;
|
|
@@ -4389,7 +4404,7 @@ function $y() {
|
|
|
4389
4404
|
default:
|
|
4390
4405
|
throw new Error(`unsupported data type: ${e}`);
|
|
4391
4406
|
}
|
|
4392
|
-
},
|
|
4407
|
+
}, er = (e) => {
|
|
4393
4408
|
switch (e) {
|
|
4394
4409
|
case 3:
|
|
4395
4410
|
return "int8";
|
|
@@ -4424,7 +4439,7 @@ function $y() {
|
|
|
4424
4439
|
default:
|
|
4425
4440
|
throw new Error(`unsupported data type: ${e}`);
|
|
4426
4441
|
}
|
|
4427
|
-
},
|
|
4442
|
+
}, tr = (e, t) => {
|
|
4428
4443
|
let s = [-1, 4, 1, 1, 2, 2, 4, 8, -1, 1, 2, 8, 4, 8, -1, -1, -1, -1, -1, -1, -1, 0.5, 0.5][e], i = typeof t == "number" ? t : t.reduce((o, l) => o * l, 1);
|
|
4429
4444
|
return s > 0 ? Math.ceil(i * s) : void 0;
|
|
4430
4445
|
}, _n = (e) => {
|
|
@@ -4518,7 +4533,7 @@ function $y() {
|
|
|
4518
4533
|
}
|
|
4519
4534
|
} else return e instanceof Blob ? new Uint8Array(await e.arrayBuffer()) : e instanceof Uint8Array ? e : new Uint8Array(e);
|
|
4520
4535
|
};
|
|
4521
|
-
}), ks, Fn, Vn, Cr, Gn, qn, Je,
|
|
4536
|
+
}), ks, Fn, Vn, Cr, Gn, qn, Je, nr = _(() => {
|
|
4522
4537
|
Ie(), ks = ["V", "I", "W", "E", "F"], Fn = (e, t) => {
|
|
4523
4538
|
console.log(`[${ks[e]},${(/* @__PURE__ */ new Date()).toISOString()}]${t}`);
|
|
4524
4539
|
}, Gn = (e, t) => {
|
|
@@ -4697,7 +4712,7 @@ function $y() {
|
|
|
4697
4712
|
}), Rr, Xr = _(() => {
|
|
4698
4713
|
Ie(), Rr = (e, t) => new (_n(t))(e);
|
|
4699
4714
|
}), Ur, Yr, xn, En, mr, Ar, jn, Kn, Qn, As, Ms, hi = _(() => {
|
|
4700
|
-
Ie(),
|
|
4715
|
+
Ie(), nr(), Ur = /* @__PURE__ */ new Map([["float32", 32], ["float16", 16], ["int32", 32], ["uint32", 32], ["int64", 64], ["uint64", 64], ["int8", 8], ["uint8", 8], ["int4", 4], ["uint4", 4]]), Yr = (e, t) => {
|
|
4701
4716
|
if (t === "int32") return e;
|
|
4702
4717
|
let s = Ur.get(t);
|
|
4703
4718
|
if (!s) throw new Error(`WebNN backend does not support data type: ${t}`);
|
|
@@ -4913,7 +4928,7 @@ function $y() {
|
|
|
4913
4928
|
}
|
|
4914
4929
|
}, Ms = (...e) => new As(...e);
|
|
4915
4930
|
}), Jr, Is, Ps, Os = _(() => {
|
|
4916
|
-
Ie(),
|
|
4931
|
+
Ie(), Jt(), Xr(), hi(), nr(), Jr = /* @__PURE__ */ new Map([[1, "float32"], [10, "float16"], [6, "int32"], [12, "uint32"], [7, "int64"], [13, "uint64"], [22, "int4"], [21, "uint4"], [3, "int8"], [2, "uint8"], [9, "uint8"]]), Is = (e, t) => {
|
|
4917
4932
|
if (e === t) return !0;
|
|
4918
4933
|
if (e === void 0 || t === void 0) return !1;
|
|
4919
4934
|
let s = Object.keys(e).sort(), i = Object.keys(t).sort();
|
|
@@ -5080,7 +5095,7 @@ function $y() {
|
|
|
5080
5095
|
return s ? s.includes(t) : !1;
|
|
5081
5096
|
}
|
|
5082
5097
|
isGraphInputOutputTypeSupported(e, t, s = !0) {
|
|
5083
|
-
let i = Jr.get(
|
|
5098
|
+
let i = Jr.get(Zt(t)), o = this.mlOpSupportLimitsBySessionId.get(e);
|
|
5084
5099
|
return typeof i > "u" ? !1 : s ? !!o?.input.dataTypes.includes(i) : !!o?.output.dataTypes.includes(i);
|
|
5085
5100
|
}
|
|
5086
5101
|
flush() {
|
|
@@ -5088,7 +5103,7 @@ function $y() {
|
|
|
5088
5103
|
};
|
|
5089
5104
|
}), Xn = _(() => {
|
|
5090
5105
|
}), Yn, Jn, Cn, Zn, es, ts, zs, Ds, pi, Zi = _(() => {
|
|
5091
|
-
|
|
5106
|
+
nr(), Xn(), Yn = /* @__PURE__ */ new Map([[64, 250], [128, 200], [256, 200], [512, 200], [2048, 230], [4096, 200], [8192, 50], [16384, 50], [32768, 50], [65536, 50], [131072, 50], [262144, 50], [524288, 50], [1048576, 50], [2097152, 30], [4194304, 20], [8388608, 10], [12582912, 10], [16777216, 10], [26214400, 15], [33554432, 22], [44236800, 2], [58982400, 6], [67108864, 6], [134217728, 6], [167772160, 6]]), Jn = [], Cn = (e) => Math.ceil(Number(e) / 16) * 16, Zn = (e) => {
|
|
5092
5107
|
for (let t = 0; t < Jn.length; t++) {
|
|
5093
5108
|
let s = Jn[t];
|
|
5094
5109
|
if (e <= s) return s;
|
|
@@ -5419,7 +5434,7 @@ function $y() {
|
|
|
5419
5434
|
return this.uniforms.map((t) => [e(t.type), t.length ?? 1]);
|
|
5420
5435
|
}
|
|
5421
5436
|
}, qe = (e, t) => new $e(e, t);
|
|
5422
|
-
}), Bt, Nt, Mr, Zr, rs, Ls,
|
|
5437
|
+
}), Bt, Nt, Mr, Zr, rs, Ls, $t, ir, Bs, We = _(() => {
|
|
5423
5438
|
Ie(), Re(), A(), _e(), Bt = (e, t) => {
|
|
5424
5439
|
if (!e || e.length !== 1) throw new Error("Transpose requires 1 input.");
|
|
5425
5440
|
if (t.length !== 0 && t.length !== e[0].dims.length) throw new Error(`perm size ${t.length} does not match input rank ${e[0].dims.length}`);
|
|
@@ -5439,7 +5454,7 @@ function $y() {
|
|
|
5439
5454
|
s = e[i];
|
|
5440
5455
|
}
|
|
5441
5456
|
return !0;
|
|
5442
|
-
},
|
|
5457
|
+
}, $t = (e, t) => {
|
|
5443
5458
|
let s = e.dataType, i = e.dims.length, o = Nt(i, t), l = Mr(e.dims, o), u = e.dims, d = l, h = i < 2 || Ls(o, e.dims), p;
|
|
5444
5459
|
if (h) return p = (S) => {
|
|
5445
5460
|
let E = F("input", s, u, 4), I = oe("output", s, d, 4);
|
|
@@ -5503,11 +5518,11 @@ function $y() {
|
|
|
5503
5518
|
let S = H.size(l);
|
|
5504
5519
|
return { outputs: [{ dims: l, dataType: e.dataType }], dispatchGroup: { x: Math.ceil(S / 64) }, programUniforms: [{ type: 12, data: S }, ...L(u, d)] };
|
|
5505
5520
|
}, getShaderSource: p };
|
|
5506
|
-
},
|
|
5507
|
-
Bt(e.inputs, t.perm), e.compute(
|
|
5521
|
+
}, ir = (e, t) => {
|
|
5522
|
+
Bt(e.inputs, t.perm), e.compute($t(e.inputs[0], t.perm));
|
|
5508
5523
|
}, Bs = (e) => $({ perm: e.perm });
|
|
5509
|
-
}),
|
|
5510
|
-
Ie(), Re(), _e(), ta(), We(),
|
|
5524
|
+
}), sr, fi, gr, kn, At, Ht, ns, Rn, Ns, mi, Dt, yr, en, Mt, xt, ar, gi, yi, zo, Do, Lo, wm = _(() => {
|
|
5525
|
+
Ie(), Re(), _e(), ta(), We(), sr = { max: "select(bestValue, candidate, candidate > bestValue)", min: "select(bestValue, candidate, candidate < bestValue)", mean: "bestValue + candidate", sum: "bestValue + candidate", prod: "bestValue * candidate", sumSquare: "bestValue + candidate * candidate", logSumExp: "bestValue + exp(candidate)", l1: "bestValue + abs(candidate)", l2: "bestValue + candidate * candidate", logSum: "bestValue + candidate" }, fi = { max: "select(bestValue, candidate, candidate > bestValue)", min: "select(bestValue, candidate, candidate < bestValue)", mean: "bestValue + candidate", sum: "bestValue + candidate", prod: "bestValue * candidate", sumSquare: "bestValue + candidate", logSumExp: "bestValue + candidate", l1: "bestValue + candidate", l2: "bestValue + candidate", logSum: "bestValue + candidate" }, gr = { max: "_A[offset]", min: "_A[offset]", mean: "0", sum: "0", prod: "1", sumSquare: "0", logSumExp: "0", l1: "0", l2: "0", logSum: "0" }, kn = { max: "bestValue", min: "bestValue", sum: "bestValue", prod: "bestValue", sumSquare: "bestValue", logSumExp: "log(bestValue)", l1: "bestValue", l2: "sqrt(bestValue)", logSum: "log(bestValue)" }, At = (e, t) => {
|
|
5511
5526
|
let s = [];
|
|
5512
5527
|
for (let i = t - e; i < t; ++i) s.push(i);
|
|
5513
5528
|
return s;
|
|
@@ -5550,7 +5565,7 @@ function $y() {
|
|
|
5550
5565
|
let Length = uniforms.reduceSize;
|
|
5551
5566
|
for (var k = local_idx; k < Length; k = k + ${w}) {
|
|
5552
5567
|
let candidate = f32(${g.getByOffset("offset + k")});
|
|
5553
|
-
bestValue = ${
|
|
5568
|
+
bestValue = ${sr[i]};
|
|
5554
5569
|
}
|
|
5555
5570
|
aBestValues[local_idx] = bestValue;
|
|
5556
5571
|
workgroupBarrier();
|
|
@@ -5577,7 +5592,7 @@ function $y() {
|
|
|
5577
5592
|
let o = e.inputs.length === 1 ? s : ea(e.inputs, s), l = o.axes;
|
|
5578
5593
|
l.length === 0 && !o.noopWithEmptyAxes && (l = e.inputs[0].dims.map((b, S) => S));
|
|
5579
5594
|
let u = H.normalizeAxes(l, e.inputs[0].dims.length), d = u, h = e.inputs[0], p = Ns(d, e.inputs[0].dims.length);
|
|
5580
|
-
p.length > 0 && (h = e.compute(
|
|
5595
|
+
p.length > 0 && (h = e.compute($t(e.inputs[0], p), { inputs: [0], outputs: [-1] })[0], d = At(d.length, h.dims.length));
|
|
5581
5596
|
let [g, m] = Ht(h.dims, d), w = g;
|
|
5582
5597
|
o.keepDims && (w = ns(g, u)), e.compute(mi(t, o.cacheKey, [h], i, e.inputs[0].dataType, w, m), { inputs: [h] });
|
|
5583
5598
|
}, yr = (e, t) => {
|
|
@@ -5586,9 +5601,9 @@ function $y() {
|
|
|
5586
5601
|
Dt(e, "ReduceL1Shared", t, "l1");
|
|
5587
5602
|
}, Mt = (e, t) => {
|
|
5588
5603
|
Dt(e, "ReduceL2Shared", t, "l2");
|
|
5589
|
-
},
|
|
5604
|
+
}, xt = (e, t) => {
|
|
5590
5605
|
Dt(e, "ReduceLogSumExpShared", t, "logSumExp");
|
|
5591
|
-
},
|
|
5606
|
+
}, ar = (e, t) => {
|
|
5592
5607
|
Dt(e, "ReduceMaxShared", t, "max");
|
|
5593
5608
|
}, gi = (e, t) => {
|
|
5594
5609
|
Dt(e, "ReduceMinShared", t, "min");
|
|
@@ -5689,9 +5704,9 @@ function $y() {
|
|
|
5689
5704
|
}, Yo = (e, t) => {
|
|
5690
5705
|
_r(e.inputs[0].dims, t.axes, t.noopWithEmptyAxes) ? Fo(e, t) : Mt(e, t);
|
|
5691
5706
|
}, Jo = (e, t) => {
|
|
5692
|
-
_r(e.inputs[0].dims, t.axes, t.noopWithEmptyAxes) ? Vo(e, t) :
|
|
5707
|
+
_r(e.inputs[0].dims, t.axes, t.noopWithEmptyAxes) ? Vo(e, t) : xt(e, t);
|
|
5693
5708
|
}, Zo = (e, t) => {
|
|
5694
|
-
_r(e.inputs[0].dims, t.axes, t.noopWithEmptyAxes) ? Go(e, t) :
|
|
5709
|
+
_r(e.inputs[0].dims, t.axes, t.noopWithEmptyAxes) ? Go(e, t) : ar(e, t);
|
|
5695
5710
|
}, el = (e, t) => {
|
|
5696
5711
|
_r(e.inputs[0].dims, t.axes, t.noopWithEmptyAxes) ? Wo(e, t) : gi(e, t);
|
|
5697
5712
|
}, tl = (e, t) => {
|
|
@@ -6996,7 +7011,7 @@ fn main(@builtin(local_invocation_id) localId : vec3<u32>,
|
|
|
6996
7011
|
return { name: "MatMul", shaderCache: { hint: `${I};${t.activation};${E};${o}`, inputDependencies: ge }, getRunData: () => ({ outputs: [{ dims: l ? l(s) : s, dataType: e[0].dataType }], dispatchGroup: { x: x[0], y: x[1], z: x[2] }, programUniforms: ae }), getShaderSource: Ee };
|
|
6997
7012
|
};
|
|
6998
7013
|
}), Iu, Pu, Em = _(() => {
|
|
6999
|
-
Ie(),
|
|
7014
|
+
Ie(), nr(), _e(), Pn(), da(), xm(), ga(), Iu = (e, t, s, i, o = !1, l, u = 4, d = 4, h = 4, p = "f32") => {
|
|
7000
7015
|
let g = (ae) => {
|
|
7001
7016
|
switch (ae) {
|
|
7002
7017
|
case 1:
|
|
@@ -7136,7 +7151,7 @@ fn main(@builtin(local_invocation_id) localId : vec3<u32>,
|
|
|
7136
7151
|
return { name: "Conv2DMatMul", shaderCache: { hint: `${t.cacheKey};${D};${E};${ae};${ge};${He};${W};${q};${Y}`, inputDependencies: it }, getRunData: () => ({ outputs: [{ dims: h ? h(s) : s, dataType: e[0].dataType }], dispatchGroup: { x: M[0], y: M[1], z: M[2] }, programUniforms: Pe }), getShaderSource: we };
|
|
7137
7152
|
};
|
|
7138
7153
|
}), Ou, ya, Gs, zu, wa, Du, Lu, Bu, Cm = _(() => {
|
|
7139
|
-
Ie(),
|
|
7154
|
+
Ie(), nr(), Re(), _e(), Pn(), da(), Ou = (e) => {
|
|
7140
7155
|
let t = 1;
|
|
7141
7156
|
for (let s = 0; s < e.length; s++) t *= e[s];
|
|
7142
7157
|
return t;
|
|
@@ -7467,7 +7482,7 @@ fn main(@builtin(local_invocation_id) localId : vec3<u32>,
|
|
|
7467
7482
|
if (s.group !== 1) {
|
|
7468
7483
|
let W = [t[0]];
|
|
7469
7484
|
if (o) {
|
|
7470
|
-
let q = e.kernelCustomData.wT ?? e.compute(
|
|
7485
|
+
let q = e.kernelCustomData.wT ?? e.compute($t(t[1], Si), { inputs: [1], outputs: [s.wIsConst ? -2 : -1] })[0];
|
|
7471
7486
|
s.wIsConst && !e.kernelCustomData.wT && (e.kernelCustomData.wT = q), W.push(q);
|
|
7472
7487
|
} else W.push(t[1]);
|
|
7473
7488
|
t.length === 3 && W.push(t[2]), !e.adapterInfo.isArchitecture("ampere") && o && t[1].dims[0] === s.group && t[1].dims[1] === 1 && s.dilations[0] === 1 && s.dilations[1] === 1 ? e.compute(Uu(W, s, l, i), { inputs: W }) : e.compute(Nu(W, s, l, i), { inputs: W });
|
|
@@ -7477,7 +7492,7 @@ fn main(@builtin(local_invocation_id) localId : vec3<u32>,
|
|
|
7477
7492
|
if (E || g === 1 && m === 1 && s.dilations[0] === 1 && s.dilations[1] === 1 && s.strides[0] === 1 && s.strides[1] === 1 && s.pads[0] === 0 && s.pads[1] === 0) {
|
|
7478
7493
|
let W = l[0], q, Y, ae, ge = [];
|
|
7479
7494
|
if (o) {
|
|
7480
|
-
let Pe = e.kernelCustomData.wT ?? e.compute(
|
|
7495
|
+
let Pe = e.kernelCustomData.wT ?? e.compute($t(t[1], Si), { inputs: [1], outputs: [s.wIsConst ? -2 : -1] })[0];
|
|
7481
7496
|
if (s.wIsConst && !e.kernelCustomData.wT && (e.kernelCustomData.wT = Pe), E) {
|
|
7482
7497
|
let it = d * h * p;
|
|
7483
7498
|
q = t[0].reshape([1, W, it]), Y = Pe.reshape([1, it, S]), ae = [1, W, S];
|
|
@@ -7489,7 +7504,7 @@ fn main(@builtin(local_invocation_id) localId : vec3<u32>,
|
|
|
7489
7504
|
He < 8 && Ee < 8 ? e.compute(ca(ge, s, l, ae, o, i), { inputs: ge }) : e.compute(bi(ge, s, l, ae, o, i), { inputs: ge });
|
|
7490
7505
|
return;
|
|
7491
7506
|
}
|
|
7492
|
-
let I = !0, k = e.kernelCustomData.wT ?? e.compute(
|
|
7507
|
+
let I = !0, k = e.kernelCustomData.wT ?? e.compute($t(t[1], Si), { inputs: [1], outputs: [s.wIsConst ? -2 : -1] })[0];
|
|
7493
7508
|
s.wIsConst && !e.kernelCustomData.wT && (e.kernelCustomData.wT = k);
|
|
7494
7509
|
let x = [t[0], k];
|
|
7495
7510
|
u && x.push(t[2]);
|
|
@@ -7512,7 +7527,7 @@ fn main(@builtin(local_invocation_id) localId : vec3<u32>,
|
|
|
7512
7527
|
}
|
|
7513
7528
|
};
|
|
7514
7529
|
}), Wu, Am = _(() => {
|
|
7515
|
-
Ie(),
|
|
7530
|
+
Ie(), nr(), Re(), _e(), Wu = (e, t, s) => {
|
|
7516
7531
|
let i = e.length > 2, o = t.outputShape, l = t.format === "NHWC", u = t.group, d = e[1].dims, h = d[2] / u, p = d[3], g = l ? V(h) : 1, m = l && p === 1 && h >= 4, w = m ? Math.floor(h / 4) * 4 : Math.floor(h / g) * g, b = h - w, S = l ? V(p) : 1, E = l ? p === 1 ? g : S : 1, I = H.size(o) / S, k = [Math.ceil(I / 64), 1, 1];
|
|
7517
7532
|
Je("verbose", () => `[conv2d_backprop_webgpu] dispatch = ${k}`);
|
|
7518
7533
|
let x = ["rank", "rank"], O = [t.strides[0], t.strides[1]], M = [t.kernelShape[l ? 1 : 2], t.kernelShape[l ? 2 : 3]], D = [t.dilations[0], t.dilations[1]], W = [M[0] + (t.dilations[0] <= 1 ? 0 : (t.kernelShape[l ? 1 : 2] - 1) * (t.dilations[0] - 1)), M[1] + (t.dilations[1] <= 1 ? 0 : (t.kernelShape[l ? 2 : 3] - 1) * (t.dilations[1] - 1))], q = [W[0] - 1 - Math.floor((t.pads[0] + t.pads[2]) / 2), W[1] - 1 - Math.floor((t.pads[1] + t.pads[3]) / 2)], Y = [{ type: 12, data: I }, { type: 12, data: O }, { type: 12, data: M }, { type: 12, data: D }, { type: 12, data: W }, { type: 6, data: q }, { type: 12, data: w }, { type: 12, data: h }, { type: 12, data: p }, ...L(e[0].dims, e[1].dims)];
|
|
@@ -7685,7 +7700,7 @@ fn main(@builtin(local_invocation_id) localId : vec3<u32>,
|
|
|
7685
7700
|
if (t.kernelShape.reduce((u, d) => u + d, 0) > 0 && t.kernelShape.length !== 0 && t.kernelShape.length !== e[1].dims.length - 2) throw new Error("invalid kernel shape");
|
|
7686
7701
|
if (t.outputShape.length !== 0 && t.outputShape.length !== e[0].dims.length - 2) throw new Error("invalid output shape");
|
|
7687
7702
|
}, Ta = (e, t, s, i) => {
|
|
7688
|
-
let o = e.kernelCustomData.wT ?? e.compute(
|
|
7703
|
+
let o = e.kernelCustomData.wT ?? e.compute($t(t[1], [2, 3, 0, 1]), { inputs: [1], outputs: [s.wIsConst ? -2 : -1] })[0];
|
|
7689
7704
|
s.wIsConst && !e.kernelCustomData.wT && (e.kernelCustomData.wT = o);
|
|
7690
7705
|
let l = [t[0], o];
|
|
7691
7706
|
t.length === 3 && l.push(t[2]), e.compute(Wu(l, s, i), { inputs: l });
|
|
@@ -8481,9 +8496,9 @@ fn main(@builtin(local_invocation_id) localId : vec3<u32>,
|
|
|
8481
8496
|
}, jd = (e, t) => {
|
|
8482
8497
|
Nd(e.inputs), e.compute(Hd(e.inputs, t));
|
|
8483
8498
|
}, Kd = (e) => $({ alignCorners: e.align_corners, mode: e.mode, paddingMode: e.padding_mode, format: e.format });
|
|
8484
|
-
}),
|
|
8485
|
-
Ie(), Re(), A(), Xn(), sa(), _e(), We(),
|
|
8486
|
-
let s = e[0], i =
|
|
8499
|
+
}), Kt, Qd, Xd, Ca, Yd, Ws, Jd, Zd = _(() => {
|
|
8500
|
+
Ie(), Re(), A(), Xn(), sa(), _e(), We(), Kt = (e, t) => e.length > t && e[t].dims.length > 0 ? e[t] : void 0, Qd = (e, t) => {
|
|
8501
|
+
let s = e[0], i = Kt(e, 1), o = Kt(e, 2), l = Kt(e, 3), u = Kt(e, 4), d = Kt(e, 5), h = Kt(e, 6), p = Kt(e, 7);
|
|
8487
8502
|
if (s.dims.length !== 3 && s.dims.length !== 5) throw new Error("Input query is expected to have 3 or 5 dimensions");
|
|
8488
8503
|
let g = s.dims[0], m = s.dims[1], w = s.dims.length === 3 ? s.dims[2] : t.numHeads * s.dims[4], b = m, S = 0, E = 0, I = Math.floor(w / t.numHeads);
|
|
8489
8504
|
if (h && p && H.size(h.dims) && H.size(p.dims)) {
|
|
@@ -8561,10 +8576,10 @@ fn main(@builtin(local_invocation_id) localId : vec3<u32>,
|
|
|
8561
8576
|
let h = l;
|
|
8562
8577
|
if (u && H.size(u.dims) > 0) {
|
|
8563
8578
|
if (i === 1) throw new Error("AddBiasReshape is not implemented. Please export your model with packed QKV or KV");
|
|
8564
|
-
return h = Yd(e, l, u, t, i, s * o, d), h = h.reshape([t, i, s, o]), s === 1 || i === 1 ? h : e.compute(
|
|
8565
|
-
} else return l.dims.length === 3 && (h = l.reshape([t, i, s, o])), s === 1 || i === 1 ? h : e.compute(
|
|
8579
|
+
return h = Yd(e, l, u, t, i, s * o, d), h = h.reshape([t, i, s, o]), s === 1 || i === 1 ? h : e.compute($t(h, Ca.perm), { inputs: [h], outputs: [-1] })[0];
|
|
8580
|
+
} else return l.dims.length === 3 && (h = l.reshape([t, i, s, o])), s === 1 || i === 1 ? h : e.compute($t(h, Ca.perm), { inputs: [h], outputs: [-1] })[0];
|
|
8566
8581
|
}, Jd = (e, t) => {
|
|
8567
|
-
let s = Qd(e.inputs, t), i = e.inputs[0], o =
|
|
8582
|
+
let s = Qd(e.inputs, t), i = e.inputs[0], o = Kt(e.inputs, 1), l = Kt(e.inputs, 2), u = Kt(e.inputs, 3), d = Kt(e.inputs, 4), h = Kt(e.inputs, 5), p = Kt(e.inputs, 6), g = Kt(e.inputs, 7);
|
|
8568
8583
|
if (i.dims.length === 5) throw new Error("Packed QKV is not implemented");
|
|
8569
8584
|
if (o?.dims.length === 5) throw new Error("Packed KV is not implemented");
|
|
8570
8585
|
let m = o && l && o.dims.length === 4 && l.dims.length === 4, w = Ws(e, s.batchSize, s.numHeads, s.sequenceLength, s.headSize, i, u, 0);
|
|
@@ -8742,7 +8757,7 @@ fn calculateOutputIndex(index: u32) -> u32 {
|
|
|
8742
8757
|
return { batchSize: h, sequenceLength: p, pastSequenceLength: w, kvSequenceLength: m, totalSequenceLength: -1, maxSequenceLength: -1, inputHiddenSize: 0, hiddenSize: g, vHiddenSize: M, headSize: S, vHeadSize: Math.floor(M / t.kvNumHeads), numHeads: t.numHeads, kvNumHeads: t.kvNumHeads, nReps: t.numHeads / t.kvNumHeads, pastPresentShareBuffer: !1, maskType: x, scale: t.scale, broadcastResPosBias: !1, passPastInKv: O, qkvFormat: k };
|
|
8743
8758
|
}, cc = $({ perm: [0, 2, 1, 3] }), Ra = (e, t, s) => {
|
|
8744
8759
|
let i = t, o = s.kvNumHeads;
|
|
8745
|
-
return t.dims.length === 3 && s.kvSequenceLength !== 0 && (i = t.reshape([s.batchSize, s.kvSequenceLength, o, s.headSize]), i = e.compute(
|
|
8760
|
+
return t.dims.length === 3 && s.kvSequenceLength !== 0 && (i = t.reshape([s.batchSize, s.kvSequenceLength, o, s.headSize]), i = e.compute($t(i, cc.perm), { inputs: [i], outputs: [-1] })[0]), i;
|
|
8746
8761
|
}, hc = (e, t, s, i) => {
|
|
8747
8762
|
let o = 7, l = ["type", "type"], u = [e * t], d = e * t, h = [{ type: 12, data: d }, { type: 12, data: t }, { type: 12, data: e }], p = (g) => {
|
|
8748
8763
|
let m = F("seq_lens", s.dataType, s.dims), w = F("total_seq_lens", i.dataType, i.dims), b = oe("pos_ids", o, u), S = [{ name: "output_size", type: "u32" }, { name: "sequence_length", type: "u32" }, { name: "batch_size", type: "u32" }];
|
|
@@ -8859,7 +8874,7 @@ fn calculateOutputIndex(index: u32) -> u32 {
|
|
|
8859
8874
|
let i = t[0].dims, o = i, l = i[0], u = i[i.length - 1], d = H.sizeFromDimension(i, 1) / u, h = V(u), p = H.size(o) / h, g = [{ type: 12, data: d }, { type: 12, data: Math.floor(u / h) }], m = ["type", "type"], w = !1, b = [0, i.length - 1];
|
|
8860
8875
|
for (let k = 0; k < i.length - 2; k++) w = w || i[k + 1] !== 1, b.push(k + 1);
|
|
8861
8876
|
w = w && i[i.length - 1] !== 1;
|
|
8862
|
-
let S = w ? e.compute(
|
|
8877
|
+
let S = w ? e.compute($t(e.inputs[0], b), { inputs: [e.inputs[0]], outputs: [-1] })[0] : e.inputs[0].reshape(Array.from({ length: i.length }, (k, x) => i[b[x]])), E = Aa(e, S, t[1], t[2], l, d, u, s.epsilon), I = (k) => {
|
|
8863
8878
|
let x = G(t[0].dataType), O = h === 1 ? "vec2f" : `mat${h}x2f`, M = (q) => {
|
|
8864
8879
|
let Y = q === 0 ? "x" : "y", ae = h === 1 ? "f32" : `vec${h}f`;
|
|
8865
8880
|
switch (h) {
|
|
@@ -10240,7 +10255,7 @@ fn calculateOutputIndex(index: u32) -> u32 {
|
|
|
10240
10255
|
if (!e || e.length !== 1) throw new Error("Softmax op requires 1 input.");
|
|
10241
10256
|
}, Mh = (e, t) => {
|
|
10242
10257
|
let s = e.inputs[0], i = s.dims, o = H.size(i), l = i.length, u = H.normalizeAxis(t.axis, l), d = u < i.length - 1, h, p = [];
|
|
10243
|
-
d ? (p = Array.from({ length: l }, (q, Y) => Y), p[u] = l - 1, p[l - 1] = u, h = e.compute(
|
|
10258
|
+
d ? (p = Array.from({ length: l }, (q, Y) => Y), p[u] = l - 1, p[l - 1] = u, h = e.compute($t(s, p), { inputs: [s], outputs: [-1] })[0]) : h = s;
|
|
10244
10259
|
let g = h.dims, m = g[l - 1], w = o / m, b = V(m), S = m / b, E = 64;
|
|
10245
10260
|
w === 1 && (E = 256);
|
|
10246
10261
|
let I = (q, Y) => Y === 4 ? `max(max(${q}.x, ${q}.y), max(${q}.z, ${q}.w))` : Y === 2 ? `max(${q}.x, ${q}.y)` : Y === 3 ? `max(max(${q}.x, ${q}.y), ${q}.z)` : q, k = F("x", h.dataType, h.dims, b), x = oe("result", h.dataType, h.dims, b), O = k.type.value, M = G(h.dataType) === "f32" ? `var threadMax = ${O}(-3.4028234663852886e+38f);` : `var threadMax = ${O}(-65504.0h);`, D = (q) => `
|
|
@@ -10318,7 +10333,7 @@ fn calculateOutputIndex(index: u32) -> u32 {
|
|
|
10318
10333
|
setValue(row, col, row_stride, value);
|
|
10319
10334
|
}
|
|
10320
10335
|
}`, W = e.compute({ name: "Softmax", shaderCache: { hint: `${b};${E}`, inputDependencies: ["type"] }, getRunData: () => ({ outputs: [{ dims: g, dataType: h.dataType }], dispatchGroup: { x: w }, programUniforms: [{ type: 6, data: S }] }), getShaderSource: D }, { inputs: [h], outputs: [d ? -1 : 0] })[0];
|
|
10321
|
-
d && e.compute(
|
|
10336
|
+
d && e.compute($t(W, p), { inputs: [W] });
|
|
10322
10337
|
}, Ih = (e, t) => {
|
|
10323
10338
|
Ah(e.inputs), Mh(e, t);
|
|
10324
10339
|
}, Ph = (e) => $({ axis: e.axis });
|
|
@@ -10406,9 +10421,9 @@ fn calculateOutputIndex(index: u32) -> u32 {
|
|
|
10406
10421
|
e.compute(Nh(e.inputs));
|
|
10407
10422
|
};
|
|
10408
10423
|
}), Fh, ig = _(() => {
|
|
10409
|
-
vm(), sa(), _m(), bm(), Sm(), Tm(), $m(), Rm(), Mm(), Im(), Pm(), Om(), zm(), Dm(), Lm(), Bm(), Nm(), Um(), Fm(), Vm(), Gm(), qm(), Wm(), Hm(), jm(), Zd(), Km(), Qm(), Xm(), Ym(), Jm(), ta(), Zm(), uc(), eg(), tg(), rg(), ac(), ng(), We(), la(), sg(), Fh = /* @__PURE__ */ new Map([["Abs", [bl]], ["Acos", [Sl]], ["Acosh", [Tl]], ["Add", [du]], ["ArgMax", [al, na]], ["ArgMin", [il, na]], ["Asin", [$l]], ["Asinh", [xl]], ["Atan", [El]], ["Atanh", [Cl]], ["Attention", [hl]], ["AveragePool", [Nc, Bc]], ["BatchNormalization", [gl]], ["BiasAdd", [vl]], ["BiasSplitGelu", [ou]], ["Cast", [Rl, kl]], ["Ceil", [Il]], ["Clip", [Ml]], ["Concat", [$u, xu]], ["Conv", [ba, va]], ["ConvTranspose", [Ju, Qu]], ["Cos", [Pl]], ["Cosh", [Ol]], ["CumSum", [ed, td]], ["DepthToSpace", [id, ad]], ["DequantizeLinear", [Kc, Qc]], ["Div", [cu]], ["Einsum", [hd, pd]], ["Elu", [zl, Fs]], ["Equal", [hu]], ["Erf", [Dl]], ["Exp", [Ll]], ["Expand", [yd]], ["FastGelu", [vd]], ["Floor", [Bl]], ["FusedConv", [ba, va]], ["Gather", [Td, Sd]], ["GatherElements", [Od, Pd]], ["GatherBlockQuantized", [Rd, Ad]], ["GatherND", [xd, Ed]], ["Gelu", [Nl]], ["Gemm", [Bd, Ld]], ["GlobalAveragePool", [Fc, Uc]], ["GlobalMaxPool", [Wc, qc]], ["Greater", [gu]], ["GreaterOrEqual", [wu]], ["GridSample", [jd, Kd]], ["GroupQueryAttention", [pc]], ["HardSigmoid", [jl, Hl]], ["InstanceNormalization", [gc]], ["LayerNormalization", [vc]], ["LeakyRelu", [Ul, Fs]], ["Less", [yu]], ["LessOrEqual", [vu]], ["Log", [tu]], ["MatMul", [bc]], ["MatMulNBits", [xc, Ec]], ["MaxPool", [Vc, Gc]], ["Mul", [pu]], ["MultiHeadAttention", [Jd, Xd]], ["Neg", [Vl]], ["Not", [Fl]], ["Pad", [zc]], ["Pow", [fu]], ["QuickGelu", [su, Fs]], ["Range", [Jc]], ["Reciprocal", [Gl]], ["ReduceMin", [el]], ["ReduceMean", [Qo]], ["ReduceMax", [Zo]], ["ReduceSum", [rl]], ["ReduceProd", [tl]], ["ReduceL1", [Xo]], ["ReduceL2", [Yo]], ["ReduceLogSum", [sl]], ["ReduceLogSumExp", [Jo]], ["ReduceSumSquare", [nl]], ["Relu", [ql]], ["Resize", [vh, _h]], ["RotaryEmbedding", [lc]], ["ScatterND", [rh, th]], ["Sigmoid", [Wl]], ["Sin", [Kl]], ["Sinh", [Ql]], ["Slice", [kh, Rh]], ["SkipLayerNormalization", [Th]], ["Split", [sc, ic]], ["Sqrt", [Xl]], ["Softmax", [Ih, Ph]], ["Sub", [mu]], ["Tan", [Yl]], ["Tanh", [Jl]], ["ThresholdedRelu", [eu, Fs]], ["Tile", [Lh]], ["Transpose", [
|
|
10424
|
+
vm(), sa(), _m(), bm(), Sm(), Tm(), $m(), Rm(), Mm(), Im(), Pm(), Om(), zm(), Dm(), Lm(), Bm(), Nm(), Um(), Fm(), Vm(), Gm(), qm(), Wm(), Hm(), jm(), Zd(), Km(), Qm(), Xm(), Ym(), Jm(), ta(), Zm(), uc(), eg(), tg(), rg(), ac(), ng(), We(), la(), sg(), Fh = /* @__PURE__ */ new Map([["Abs", [bl]], ["Acos", [Sl]], ["Acosh", [Tl]], ["Add", [du]], ["ArgMax", [al, na]], ["ArgMin", [il, na]], ["Asin", [$l]], ["Asinh", [xl]], ["Atan", [El]], ["Atanh", [Cl]], ["Attention", [hl]], ["AveragePool", [Nc, Bc]], ["BatchNormalization", [gl]], ["BiasAdd", [vl]], ["BiasSplitGelu", [ou]], ["Cast", [Rl, kl]], ["Ceil", [Il]], ["Clip", [Ml]], ["Concat", [$u, xu]], ["Conv", [ba, va]], ["ConvTranspose", [Ju, Qu]], ["Cos", [Pl]], ["Cosh", [Ol]], ["CumSum", [ed, td]], ["DepthToSpace", [id, ad]], ["DequantizeLinear", [Kc, Qc]], ["Div", [cu]], ["Einsum", [hd, pd]], ["Elu", [zl, Fs]], ["Equal", [hu]], ["Erf", [Dl]], ["Exp", [Ll]], ["Expand", [yd]], ["FastGelu", [vd]], ["Floor", [Bl]], ["FusedConv", [ba, va]], ["Gather", [Td, Sd]], ["GatherElements", [Od, Pd]], ["GatherBlockQuantized", [Rd, Ad]], ["GatherND", [xd, Ed]], ["Gelu", [Nl]], ["Gemm", [Bd, Ld]], ["GlobalAveragePool", [Fc, Uc]], ["GlobalMaxPool", [Wc, qc]], ["Greater", [gu]], ["GreaterOrEqual", [wu]], ["GridSample", [jd, Kd]], ["GroupQueryAttention", [pc]], ["HardSigmoid", [jl, Hl]], ["InstanceNormalization", [gc]], ["LayerNormalization", [vc]], ["LeakyRelu", [Ul, Fs]], ["Less", [yu]], ["LessOrEqual", [vu]], ["Log", [tu]], ["MatMul", [bc]], ["MatMulNBits", [xc, Ec]], ["MaxPool", [Vc, Gc]], ["Mul", [pu]], ["MultiHeadAttention", [Jd, Xd]], ["Neg", [Vl]], ["Not", [Fl]], ["Pad", [zc]], ["Pow", [fu]], ["QuickGelu", [su, Fs]], ["Range", [Jc]], ["Reciprocal", [Gl]], ["ReduceMin", [el]], ["ReduceMean", [Qo]], ["ReduceMax", [Zo]], ["ReduceSum", [rl]], ["ReduceProd", [tl]], ["ReduceL1", [Xo]], ["ReduceL2", [Yo]], ["ReduceLogSum", [sl]], ["ReduceLogSumExp", [Jo]], ["ReduceSumSquare", [nl]], ["Relu", [ql]], ["Resize", [vh, _h]], ["RotaryEmbedding", [lc]], ["ScatterND", [rh, th]], ["Sigmoid", [Wl]], ["Sin", [Kl]], ["Sinh", [Ql]], ["Slice", [kh, Rh]], ["SkipLayerNormalization", [Th]], ["Split", [sc, ic]], ["Sqrt", [Xl]], ["Softmax", [Ih, Ph]], ["Sub", [mu]], ["Tan", [Yl]], ["Tanh", [Jl]], ["ThresholdedRelu", [eu, Fs]], ["Tile", [Lh]], ["Transpose", [ir, Bs]], ["Where", [Uh]]]);
|
|
10410
10425
|
}), Vh, ag = _(() => {
|
|
10411
|
-
zt(),
|
|
10426
|
+
zt(), nr(), _e(), Vh = class {
|
|
10412
10427
|
constructor(e) {
|
|
10413
10428
|
this.backend = e, this.repo = /* @__PURE__ */ new Map(), this.attributesBound = !1;
|
|
10414
10429
|
}
|
|
@@ -10462,7 +10477,7 @@ ${l}`, d = s.createShaderModule({ code: u, label: e.name });
|
|
|
10462
10477
|
}), Gh = {};
|
|
10463
10478
|
U(Gh, { WebGpuBackend: () => jh });
|
|
10464
10479
|
var qh, Wh, Hh, jh, og = _(() => {
|
|
10465
|
-
zt(), Ie(),
|
|
10480
|
+
zt(), Ie(), nr(), Xr(), Zi(), ig(), ag(), qh = (e, t) => {
|
|
10466
10481
|
if (t.length !== e.length) throw new Error(`inputDependencies length ${t.length} is not equal to inputTensors length ${e.length}.`);
|
|
10467
10482
|
let s = [];
|
|
10468
10483
|
for (let i = 0; i < e.length; ++i) {
|
|
@@ -10547,15 +10562,15 @@ ${l}`, d = s.createShaderModule({ code: u, label: e.name });
|
|
|
10547
10562
|
typeof this.queryTimeBase > "u" && (this.queryTimeBase = w);
|
|
10548
10563
|
let S = Number(w - this.queryTimeBase), E = Number(b - this.queryTimeBase);
|
|
10549
10564
|
if (!Number.isSafeInteger(S) || !Number.isSafeInteger(E)) throw new RangeError("incorrect timestamp range");
|
|
10550
|
-
if (this.env.webgpu.profiling?.ondata) this.env.webgpu.profiling.ondata({ version: 1, inputsMetadata: g.map((I) => ({ dims: I.dims, dataType:
|
|
10565
|
+
if (this.env.webgpu.profiling?.ondata) this.env.webgpu.profiling.ondata({ version: 1, inputsMetadata: g.map((I) => ({ dims: I.dims, dataType: er(I.dataType) })), outputsMetadata: m.map((I) => ({ dims: I.dims, dataType: er(I.dataType) })), kernelId: l, kernelType: d, kernelName: h, programName: p, startTime: S, endTime: E });
|
|
10551
10566
|
else {
|
|
10552
10567
|
let I = "";
|
|
10553
10568
|
g.forEach((x, O) => {
|
|
10554
|
-
I += `input[${O}]: [${x.dims}] | ${
|
|
10569
|
+
I += `input[${O}]: [${x.dims}] | ${er(x.dataType)}, `;
|
|
10555
10570
|
});
|
|
10556
10571
|
let k = "";
|
|
10557
10572
|
m.forEach((x, O) => {
|
|
10558
|
-
k += `output[${O}]: [${x.dims}] | ${
|
|
10573
|
+
k += `output[${O}]: [${x.dims}] | ${er(x.dataType)}, `;
|
|
10559
10574
|
}), console.log(`[profiling] kernel "${l}|${d}|${h}|${p}" ${I}${k}start time: ${S} ns, execution time: ${E - S} ns`);
|
|
10560
10575
|
}
|
|
10561
10576
|
Ne("GPU", `${p}::${w}::${b}`);
|
|
@@ -10613,7 +10628,7 @@ ${l}`, d = s.createShaderModule({ code: u, label: e.name });
|
|
|
10613
10628
|
else if (q.type === 12) new Uint32Array(D, ae, ge.length).set(ge);
|
|
10614
10629
|
else if (q.type === 10) new Uint16Array(D, ae, ge.length).set(ge);
|
|
10615
10630
|
else if (q.type === 1) new Float32Array(D, ae, ge.length).set(ge);
|
|
10616
|
-
else throw new Error(`Unsupported uniform type: ${
|
|
10631
|
+
else throw new Error(`Unsupported uniform type: ${er(q.type)}`);
|
|
10617
10632
|
});
|
|
10618
10633
|
let W = this.gpuDataManager.create(x, GPUBufferUsage.COPY_DST | GPUBufferUsage.UNIFORM);
|
|
10619
10634
|
this.device.queue.writeBuffer(W.buffer, 0, D, 0, x), this.gpuDataManager.release(W.id), b = { offset: 0, size: x, buffer: W.buffer };
|
|
@@ -10735,7 +10750,7 @@ ${l}`, d = s.createShaderModule({ code: u, label: e.name });
|
|
|
10735
10750
|
}), Kh = {};
|
|
10736
10751
|
U(Kh, { init: () => Xh });
|
|
10737
10752
|
var Ei, Qh, Xh, lg = _(() => {
|
|
10738
|
-
Ie(),
|
|
10753
|
+
Ie(), nr(), Re(), Os(), Ei = class yf {
|
|
10739
10754
|
constructor(t, s, i, o) {
|
|
10740
10755
|
this.module = t, this.dataType = s, this.data = i, this.dims = o;
|
|
10741
10756
|
}
|
|
@@ -10786,7 +10801,7 @@ ${l}`, d = s.createShaderModule({ code: u, label: e.name });
|
|
|
10786
10801
|
}
|
|
10787
10802
|
compute(e, t) {
|
|
10788
10803
|
let s = t?.inputs?.map((u) => typeof u == "number" ? this.inputs[u] : u) ?? this.inputs, i = t?.outputs ?? [], o = (u, d, h) => new Ei(this.module, d, this.output(u, h), h), l = (u, d) => {
|
|
10789
|
-
let h =
|
|
10804
|
+
let h = tr(u, d);
|
|
10790
10805
|
if (!h) throw new Error(`Unsupported data type: ${u}`);
|
|
10791
10806
|
let p = h > 0 ? this.backend.gpuDataManager.create(h).id : 0;
|
|
10792
10807
|
return new Ei(this.module, u, p, d);
|
|
@@ -10833,7 +10848,7 @@ ${l}`, d = s.createShaderModule({ code: u, label: e.name });
|
|
|
10833
10848
|
}
|
|
10834
10849
|
};
|
|
10835
10850
|
}), Yh, Ga, qa, tn, Jh, Wa, Ci, Ha, ja, Ka, Qa, Xa, Ya, Zh = _(() => {
|
|
10836
|
-
zt(), Yi(), Ji(), Ie(),
|
|
10851
|
+
zt(), Yi(), Ji(), Ie(), Jt(), vn(), Cs(), Yh = (e, t) => {
|
|
10837
10852
|
Oe()._OrtInit(e, t) !== 0 && ke("Can't initialize onnxruntime.");
|
|
10838
10853
|
}, Ga = async (e) => {
|
|
10839
10854
|
Yh(e.wasm.numThreads, bn(e.logLevel));
|
|
@@ -10917,13 +10932,13 @@ ${l}`, d = s.createShaderModule({ code: u, label: e.name });
|
|
|
10917
10932
|
let [D, W, q] = Wa(l, M);
|
|
10918
10933
|
D === 0 && ke("Can't get an input name."), p.push(D);
|
|
10919
10934
|
let Y = o.UTF8ToString(D);
|
|
10920
|
-
S.push(Y), I.push(W === 0 ? { name: Y, isTensor: !1 } : { name: Y, isTensor: !0, type:
|
|
10935
|
+
S.push(Y), I.push(W === 0 ? { name: Y, isTensor: !1 } : { name: Y, isTensor: !0, type: er(W), shape: q });
|
|
10921
10936
|
}
|
|
10922
10937
|
for (let M = 0; M < w; M++) {
|
|
10923
10938
|
let [D, W, q] = Wa(l, M + m);
|
|
10924
10939
|
D === 0 && ke("Can't get an output name."), g.push(D);
|
|
10925
10940
|
let Y = o.UTF8ToString(D);
|
|
10926
|
-
E.push(Y), k.push(W === 0 ? { name: Y, isTensor: !1 } : { name: Y, isTensor: !0, type:
|
|
10941
|
+
E.push(Y), k.push(W === 0 ? { name: Y, isTensor: !1 } : { name: Y, isTensor: !0, type: er(W), shape: q });
|
|
10927
10942
|
{
|
|
10928
10943
|
if (b && t?.preferredOutputLocation === void 0) {
|
|
10929
10944
|
x.push("gpu-buffer");
|
|
@@ -10961,7 +10976,7 @@ ${l}`, d = s.createShaderModule({ code: u, label: e.name });
|
|
|
10961
10976
|
if (u && m !== "gpu-buffer") throw new Error(`External buffer must be provided for input/output index ${l} when enableGraphCapture is true.`);
|
|
10962
10977
|
if (m === "gpu-buffer") {
|
|
10963
10978
|
let k = e[2].gpuBuffer;
|
|
10964
|
-
S =
|
|
10979
|
+
S = tr(Zt(p), g);
|
|
10965
10980
|
{
|
|
10966
10981
|
let x = d.jsepRegisterBuffer;
|
|
10967
10982
|
if (!x) throw new Error('Tensor location "gpu-buffer" is not supported without using WebGPU.');
|
|
@@ -10969,10 +10984,10 @@ ${l}`, d = s.createShaderModule({ code: u, label: e.name });
|
|
|
10969
10984
|
}
|
|
10970
10985
|
} else if (m === "ml-tensor") {
|
|
10971
10986
|
let k = e[2].mlTensor;
|
|
10972
|
-
S =
|
|
10987
|
+
S = tr(Zt(p), g);
|
|
10973
10988
|
let x = d.webnnRegisterMLTensor;
|
|
10974
10989
|
if (!x) throw new Error('Tensor location "ml-tensor" is not supported without using WebNN.');
|
|
10975
|
-
b = x(i, k,
|
|
10990
|
+
b = x(i, k, Zt(p), g);
|
|
10976
10991
|
} else {
|
|
10977
10992
|
let k = e[2];
|
|
10978
10993
|
if (Array.isArray(k)) {
|
|
@@ -10986,8 +11001,8 @@ ${l}`, d = s.createShaderModule({ code: u, label: e.name });
|
|
|
10986
11001
|
if (p !== "string" && x && O) {
|
|
10987
11002
|
let M = d.UTF8ToString(o);
|
|
10988
11003
|
if (x(i, M) || O(i, M)) {
|
|
10989
|
-
let D =
|
|
10990
|
-
S =
|
|
11004
|
+
let D = Zt(p);
|
|
11005
|
+
S = tr(D, g), w = "ml-tensor";
|
|
10991
11006
|
let W = d.webnnCreateTemporaryTensor, q = d.webnnUploadTensor;
|
|
10992
11007
|
if (!W || !q) throw new Error('Tensor location "ml-tensor" is not supported without using WebNN.');
|
|
10993
11008
|
let Y = await W(i, D, g);
|
|
@@ -10999,7 +11014,7 @@ ${l}`, d = s.createShaderModule({ code: u, label: e.name });
|
|
|
10999
11014
|
let E = d.stackSave(), I = d.stackAlloc(4 * g.length);
|
|
11000
11015
|
try {
|
|
11001
11016
|
g.forEach((x, O) => d.setValue(I + O * h, x, h === 4 ? "i32" : "i64"));
|
|
11002
|
-
let k = d._OrtCreateTensor(
|
|
11017
|
+
let k = d._OrtCreateTensor(Zt(p), b, S, I, g.length, Un(w));
|
|
11003
11018
|
k === 0 && ke(`Can't create tensor for input/output. session=${i}, index=${l}.`), t.push(k);
|
|
11004
11019
|
} finally {
|
|
11005
11020
|
d.stackRestore(E);
|
|
@@ -11049,7 +11064,7 @@ ${l}`, d = s.createShaderModule({ code: u, label: e.name });
|
|
|
11049
11064
|
for (let Ft = 0; Ft < Sr; Ft++) Pr.push(Number(u.getValue(pt + Ft * d, ve)));
|
|
11050
11065
|
u._OrtFree(pt) !== 0 && ke("Can't free memory for tensor dims.");
|
|
11051
11066
|
let nn = Pr.reduce((Ft, It) => Ft * It, 1);
|
|
11052
|
-
ht =
|
|
11067
|
+
ht = er(Ve);
|
|
11053
11068
|
let Xs = w?.outputPreferredLocations[i[we]];
|
|
11054
11069
|
if (ht === "string") {
|
|
11055
11070
|
if (Xs === "gpu-buffer" || Xs === "ml-tensor") throw new Error("String tensor is not supported on GPU.");
|
|
@@ -11062,7 +11077,7 @@ ${l}`, d = s.createShaderModule({ code: u, label: e.name });
|
|
|
11062
11077
|
} else if (Xs === "gpu-buffer" && nn > 0) {
|
|
11063
11078
|
let Ft = u.jsepGetBuffer;
|
|
11064
11079
|
if (!Ft) throw new Error('preferredLocation "gpu-buffer" is not supported without using WebGPU.');
|
|
11065
|
-
let It = Ft(ne), Vr =
|
|
11080
|
+
let It = Ft(ne), Vr = tr(Ve, nn);
|
|
11066
11081
|
if (Vr === void 0 || !Sn(ht)) throw new Error(`Unsupported data type: ${ht}`);
|
|
11067
11082
|
ze = !0, Pe.push([ht, Pr, { gpuBuffer: It, download: u.jsepCreateDownloader(It, Vr, ht), dispose: () => {
|
|
11068
11083
|
u._OrtReleaseTensor(xe) !== 0 && ke("Can't release tensor.");
|
|
@@ -11070,7 +11085,7 @@ ${l}`, d = s.createShaderModule({ code: u, label: e.name });
|
|
|
11070
11085
|
} else if (Xs === "ml-tensor" && nn > 0) {
|
|
11071
11086
|
let Ft = u.webnnEnsureTensor, It = u.webnnIsGraphInputOutputTypeSupported;
|
|
11072
11087
|
if (!Ft || !It) throw new Error('preferredLocation "ml-tensor" is not supported without using WebNN.');
|
|
11073
|
-
if (
|
|
11088
|
+
if (tr(Ve, nn) === void 0 || !Tn(ht)) throw new Error(`Unsupported data type: ${ht}`);
|
|
11074
11089
|
if (!It(e, ht, !1)) throw new Error(`preferredLocation "ml-tensor" for ${ht} output is not supported by current WebNN Context.`);
|
|
11075
11090
|
let Vr = await Ft(e, ne, Ve, Pr, !1);
|
|
11076
11091
|
ze = !0, Pe.push([ht, Pr, { mlTensor: Vr, download: u.webnnCreateMLTensorDownloader(ne, ht), dispose: () => {
|
|
@@ -11109,12 +11124,12 @@ ${l}`, d = s.createShaderModule({ code: u, label: e.name });
|
|
|
11109
11124
|
}
|
|
11110
11125
|
return t;
|
|
11111
11126
|
};
|
|
11112
|
-
}), rn,
|
|
11113
|
-
zt(), Zh(),
|
|
11127
|
+
}), rn, or, ss, Ks, Qs, ki, Ja, Ri, Dn, Ln, ep, tp, rp, np, sp, ip, ap, op, lp = _(() => {
|
|
11128
|
+
zt(), Zh(), Jt(), mn(), rn = () => !!me.wasm.proxy && typeof document < "u", ss = !1, Ks = !1, Qs = !1, Ri = /* @__PURE__ */ new Map(), Dn = (e, t) => {
|
|
11114
11129
|
let s = Ri.get(e);
|
|
11115
11130
|
s ? s.push(t) : Ri.set(e, [t]);
|
|
11116
11131
|
}, Ln = () => {
|
|
11117
|
-
if (ss || !Ks || Qs || !
|
|
11132
|
+
if (ss || !Ks || Qs || !or) throw new Error("worker not ready");
|
|
11118
11133
|
}, ep = (e) => {
|
|
11119
11134
|
switch (e.data.type) {
|
|
11120
11135
|
case "init-wasm":
|
|
@@ -11136,15 +11151,15 @@ ${l}`, d = s.createShaderModule({ code: u, label: e.name });
|
|
|
11136
11151
|
if (ss) throw new Error("multiple calls to 'initWasm()' detected.");
|
|
11137
11152
|
if (Qs) throw new Error("previous call to 'initWasm()' failed.");
|
|
11138
11153
|
if (ss = !0, rn()) return new Promise((e, t) => {
|
|
11139
|
-
|
|
11154
|
+
or?.terminate(), gs().then(([s, i]) => {
|
|
11140
11155
|
try {
|
|
11141
|
-
|
|
11156
|
+
or = i, or.onerror = (l) => t(l), or.onmessage = ep, Ja = [e, t];
|
|
11142
11157
|
let o = { type: "init-wasm", in: me };
|
|
11143
11158
|
if (!o.in.wasm.wasmPaths && s) {
|
|
11144
11159
|
let l = cn();
|
|
11145
11160
|
l && (o.in.wasm.wasmPaths = l);
|
|
11146
11161
|
}
|
|
11147
|
-
|
|
11162
|
+
or.postMessage(o), ki = s;
|
|
11148
11163
|
} catch (o) {
|
|
11149
11164
|
t(o);
|
|
11150
11165
|
}
|
|
@@ -11162,27 +11177,27 @@ ${l}`, d = s.createShaderModule({ code: u, label: e.name });
|
|
|
11162
11177
|
if (rn()) return Ln(), new Promise((t, s) => {
|
|
11163
11178
|
Dn("init-ep", [t, s]);
|
|
11164
11179
|
let i = { type: "init-ep", in: { epName: e, env: me } };
|
|
11165
|
-
|
|
11180
|
+
or.postMessage(i);
|
|
11166
11181
|
});
|
|
11167
11182
|
await qa(me, e);
|
|
11168
11183
|
}, np = async (e) => rn() ? (Ln(), new Promise((t, s) => {
|
|
11169
11184
|
Dn("copy-from", [t, s]);
|
|
11170
11185
|
let i = { type: "copy-from", in: { buffer: e } };
|
|
11171
|
-
|
|
11186
|
+
or.postMessage(i, [e.buffer]);
|
|
11172
11187
|
})) : Ci(e), sp = async (e, t) => {
|
|
11173
11188
|
if (rn()) {
|
|
11174
11189
|
if (t?.preferredOutputLocation) throw new Error('session option "preferredOutputLocation" is not supported for proxy.');
|
|
11175
11190
|
return Ln(), new Promise((s, i) => {
|
|
11176
11191
|
Dn("create", [s, i]);
|
|
11177
11192
|
let o = { type: "create", in: { model: e, options: { ...t } } }, l = [];
|
|
11178
|
-
e instanceof Uint8Array && l.push(e.buffer),
|
|
11193
|
+
e instanceof Uint8Array && l.push(e.buffer), or.postMessage(o, l);
|
|
11179
11194
|
});
|
|
11180
11195
|
} else return Ha(e, t);
|
|
11181
11196
|
}, ip = async (e) => {
|
|
11182
11197
|
if (rn()) return Ln(), new Promise((t, s) => {
|
|
11183
11198
|
Dn("release", [t, s]);
|
|
11184
11199
|
let i = { type: "release", in: e };
|
|
11185
|
-
|
|
11200
|
+
or.postMessage(i);
|
|
11186
11201
|
});
|
|
11187
11202
|
ja(e);
|
|
11188
11203
|
}, ap = async (e, t, s, i, o, l) => {
|
|
@@ -11192,14 +11207,14 @@ ${l}`, d = s.createShaderModule({ code: u, label: e.name });
|
|
|
11192
11207
|
return Ln(), new Promise((u, d) => {
|
|
11193
11208
|
Dn("run", [u, d]);
|
|
11194
11209
|
let h = s, p = { type: "run", in: { sessionId: e, inputIndices: t, inputs: h, outputIndices: i, options: l } };
|
|
11195
|
-
|
|
11210
|
+
or.postMessage(p, Ya(h));
|
|
11196
11211
|
});
|
|
11197
11212
|
} else return Qa(e, t, s, i, o, l);
|
|
11198
11213
|
}, op = async (e) => {
|
|
11199
11214
|
if (rn()) return Ln(), new Promise((t, s) => {
|
|
11200
11215
|
Dn("end-profiling", [t, s]);
|
|
11201
11216
|
let i = { type: "end-profiling", in: e };
|
|
11202
|
-
|
|
11217
|
+
or.postMessage(i);
|
|
11203
11218
|
});
|
|
11204
11219
|
Xa(e);
|
|
11205
11220
|
};
|
|
@@ -11351,11 +11366,11 @@ ${l}`, d = s.createShaderModule({ code: u, label: e.name });
|
|
|
11351
11366
|
})(lo)), lo.exports;
|
|
11352
11367
|
}
|
|
11353
11368
|
var Bn = {}, uo = {}, Ip;
|
|
11354
|
-
function
|
|
11369
|
+
function Ey() {
|
|
11355
11370
|
return Ip || (Ip = 1, Object.defineProperty(uo, "__esModule", { value: !0 })), uo;
|
|
11356
11371
|
}
|
|
11357
11372
|
var si = {}, Pp;
|
|
11358
|
-
function
|
|
11373
|
+
function Cy() {
|
|
11359
11374
|
if (Pp) return si;
|
|
11360
11375
|
Pp = 1;
|
|
11361
11376
|
var c;
|
|
@@ -11391,7 +11406,7 @@ function Ey() {
|
|
|
11391
11406
|
}, si;
|
|
11392
11407
|
}
|
|
11393
11408
|
var ii = {}, Op;
|
|
11394
|
-
function
|
|
11409
|
+
function ky() {
|
|
11395
11410
|
if (Op) return ii;
|
|
11396
11411
|
Op = 1;
|
|
11397
11412
|
var c;
|
|
@@ -11447,12 +11462,12 @@ function wf() {
|
|
|
11447
11462
|
})), n = Bn && Bn.__exportStar || function(v, C) {
|
|
11448
11463
|
for (var R in v) R !== "default" && !Object.prototype.hasOwnProperty.call(C, R) && r(C, v, R);
|
|
11449
11464
|
};
|
|
11450
|
-
Object.defineProperty(c, "__esModule", { value: !0 }), c.SileroV5 = c.SileroLegacy = void 0, n(
|
|
11451
|
-
var a =
|
|
11465
|
+
Object.defineProperty(c, "__esModule", { value: !0 }), c.SileroV5 = c.SileroLegacy = void 0, n(Ey(), c);
|
|
11466
|
+
var a = Cy();
|
|
11452
11467
|
Object.defineProperty(c, "SileroLegacy", { enumerable: !0, get: function() {
|
|
11453
11468
|
return a.SileroLegacy;
|
|
11454
11469
|
} });
|
|
11455
|
-
var f =
|
|
11470
|
+
var f = ky();
|
|
11456
11471
|
Object.defineProperty(c, "SileroV5", { enumerable: !0, get: function() {
|
|
11457
11472
|
return f.SileroV5;
|
|
11458
11473
|
} });
|
|
@@ -11500,7 +11515,7 @@ function vf() {
|
|
|
11500
11515
|
return ai.Resampler = r, ai;
|
|
11501
11516
|
}
|
|
11502
11517
|
var Lp;
|
|
11503
|
-
function
|
|
11518
|
+
function Ry() {
|
|
11504
11519
|
return Lp || (Lp = 1, (function(c) {
|
|
11505
11520
|
var r = qr && qr.__createBinding || (Object.create ? (function(X, ee, ie, de) {
|
|
11506
11521
|
de === void 0 && (de = ie);
|
|
@@ -11521,7 +11536,7 @@ function ky() {
|
|
|
11521
11536
|
return n(ee, X), ee;
|
|
11522
11537
|
};
|
|
11523
11538
|
Object.defineProperty(c, "__esModule", { value: !0 }), c.NonRealTimeVAD = c.defaultNonRealTimeVADOptions = void 0;
|
|
11524
|
-
const f = a(
|
|
11539
|
+
const f = a(xy()), v = mf(), C = Po(), R = Oo(), _ = qi(), U = wf(), B = vf();
|
|
11525
11540
|
c.defaultNonRealTimeVADOptions = {
|
|
11526
11541
|
...R.defaultFrameProcessorOptions,
|
|
11527
11542
|
modelURL: v.baseAssetPath + "silero_vad_legacy.onnx",
|
|
@@ -11589,7 +11604,7 @@ function ky() {
|
|
|
11589
11604
|
})(qr)), qr;
|
|
11590
11605
|
}
|
|
11591
11606
|
var Tr = {}, Bp;
|
|
11592
|
-
function
|
|
11607
|
+
function Ay() {
|
|
11593
11608
|
if (Bp) return Tr;
|
|
11594
11609
|
Bp = 1, Object.defineProperty(Tr, "__esModule", { value: !0 }), Tr.audioFileToArray = Tr.encodeWAV = Tr.arrayBufferToBase64 = Tr.minFramesForTargetMS = void 0;
|
|
11595
11610
|
function c(R, _, U = 16e3) {
|
|
@@ -11663,11 +11678,11 @@ var Wr = {}, co = { exports: {} };
|
|
|
11663
11678
|
* Licensed under the MIT License.
|
|
11664
11679
|
*/
|
|
11665
11680
|
var Np;
|
|
11666
|
-
function
|
|
11681
|
+
function My() {
|
|
11667
11682
|
return Np || (Np = 1, (function(c, r) {
|
|
11668
11683
|
var n = (() => {
|
|
11669
|
-
var a = Object.defineProperty, f = Object.getOwnPropertyDescriptor, v = Object.getOwnPropertyNames, C = Object.prototype.hasOwnProperty, R = ((y) => typeof
|
|
11670
|
-
if (typeof
|
|
11684
|
+
var a = Object.defineProperty, f = Object.getOwnPropertyDescriptor, v = Object.getOwnPropertyNames, C = Object.prototype.hasOwnProperty, R = ((y) => typeof dr < "u" ? dr : typeof Proxy < "u" ? new Proxy(y, { get: ($, A) => (typeof dr < "u" ? dr : $)[A] }) : y)(function(y) {
|
|
11685
|
+
if (typeof dr < "u") return dr.apply(this, arguments);
|
|
11671
11686
|
throw Error('Dynamic require of "' + y + '" is not supported');
|
|
11672
11687
|
}), _ = (y, $) => () => (y && ($ = y(y = 0)), $), U = (y, $) => {
|
|
11673
11688
|
for (var A in $) a(y, A, { get: $[A], enumerable: !0 });
|
|
@@ -11771,7 +11786,7 @@ function Ay() {
|
|
|
11771
11786
|
return z;
|
|
11772
11787
|
};
|
|
11773
11788
|
}), Xe, mt, yt, at, Ye, De, rt = _(() => {
|
|
11774
|
-
|
|
11789
|
+
Yt(), Xe = (y, $) => {
|
|
11775
11790
|
if (y === void 0) throw new Error("Image buffer must be defined");
|
|
11776
11791
|
if ($.height === void 0 || $.width === void 0) throw new Error("Image height and width must be defined");
|
|
11777
11792
|
if ($.tensorLayout === "NHWC") throw new Error("NHWC Tensor layout is not supported yet");
|
|
@@ -11851,7 +11866,7 @@ function Ay() {
|
|
|
11851
11866
|
}
|
|
11852
11867
|
};
|
|
11853
11868
|
}), qt, kt, ot = _(() => {
|
|
11854
|
-
|
|
11869
|
+
Yt(), qt = (y) => {
|
|
11855
11870
|
let $ = 1;
|
|
11856
11871
|
for (let A = 0; A < y.length; A++) {
|
|
11857
11872
|
let z = y[A];
|
|
@@ -11876,7 +11891,7 @@ function Ay() {
|
|
|
11876
11891
|
throw new Error(`tensorReshape: tensor location ${y.location} is not supported`);
|
|
11877
11892
|
}
|
|
11878
11893
|
};
|
|
11879
|
-
}), tt,
|
|
11894
|
+
}), tt, Yt = _(() => {
|
|
11880
11895
|
Be(), rt(), gt(), ot(), tt = class {
|
|
11881
11896
|
constructor(y, $, A) {
|
|
11882
11897
|
et();
|
|
@@ -12019,8 +12034,8 @@ function Ay() {
|
|
|
12019
12034
|
}
|
|
12020
12035
|
};
|
|
12021
12036
|
}), vt, pe = _(() => {
|
|
12022
|
-
|
|
12023
|
-
}), Ne, wt, dt, ct, fe, Ue,
|
|
12037
|
+
Yt(), vt = tt;
|
|
12038
|
+
}), Ne, wt, dt, ct, fe, Ue, Tt = _(() => {
|
|
12024
12039
|
Me(), Ne = (y, $) => {
|
|
12025
12040
|
(typeof he.trace > "u" ? !he.wasm.trace : !he.trace) || console.timeStamp(`${y}::ORT::${$}`);
|
|
12026
12041
|
}, wt = (y, $) => {
|
|
@@ -12042,8 +12057,8 @@ function Ay() {
|
|
|
12042
12057
|
}, Ue = (y) => {
|
|
12043
12058
|
(typeof he.trace > "u" ? !he.wasm.trace : !he.trace) || console.timeEnd(`ORT::${y}`);
|
|
12044
12059
|
};
|
|
12045
|
-
}), Rt,
|
|
12046
|
-
Le(), pe(),
|
|
12060
|
+
}), Rt, jt = _(() => {
|
|
12061
|
+
Le(), pe(), Tt(), Rt = class _f {
|
|
12047
12062
|
constructor($) {
|
|
12048
12063
|
this.handler = $;
|
|
12049
12064
|
}
|
|
@@ -12136,7 +12151,7 @@ function Ay() {
|
|
|
12136
12151
|
}
|
|
12137
12152
|
};
|
|
12138
12153
|
}), cr, Wi = _(() => {
|
|
12139
|
-
|
|
12154
|
+
jt(), cr = Rt;
|
|
12140
12155
|
}), Hi = _(() => {
|
|
12141
12156
|
}), ji = _(() => {
|
|
12142
12157
|
}), Ki = _(() => {
|
|
@@ -12144,12 +12159,12 @@ function Ay() {
|
|
|
12144
12159
|
}), ls = {};
|
|
12145
12160
|
U(ls, { InferenceSession: () => cr, TRACE: () => Ne, TRACE_EVENT_BEGIN: () => fe, TRACE_EVENT_END: () => Ue, TRACE_FUNC_BEGIN: () => dt, TRACE_FUNC_END: () => ct, Tensor: () => vt, env: () => me, registerBackend: () => ie });
|
|
12146
12161
|
var zt = _(() => {
|
|
12147
|
-
Ce(), ut(), Wi(), pe(), Hi(), ji(),
|
|
12162
|
+
Ce(), ut(), Wi(), pe(), Hi(), ji(), Tt(), Ki(), Qi();
|
|
12148
12163
|
}), ln = _(() => {
|
|
12149
12164
|
}), us = {};
|
|
12150
12165
|
U(us, { default: () => ds });
|
|
12151
12166
|
var un, dn, ds, Xi = _(() => {
|
|
12152
|
-
Rs(),
|
|
12167
|
+
Rs(), Jt(), mn(), un = "ort-wasm-proxy-worker", dn = globalThis.self?.name === un, dn && (self.onmessage = (y) => {
|
|
12153
12168
|
let { type: $, in: A } = y.data;
|
|
12154
12169
|
try {
|
|
12155
12170
|
switch ($) {
|
|
@@ -12180,7 +12195,7 @@ function Ay() {
|
|
|
12180
12195
|
}
|
|
12181
12196
|
case "create": {
|
|
12182
12197
|
let { model: z, options: P } = A;
|
|
12183
|
-
|
|
12198
|
+
nr(z, P).then((G) => {
|
|
12184
12199
|
postMessage({ type: $, out: G });
|
|
12185
12200
|
}, (G) => {
|
|
12186
12201
|
postMessage({ type: $, err: G });
|
|
@@ -12248,7 +12263,7 @@ function Ay() {
|
|
|
12248
12263
|
return [L ? V : void 0, await ms(V)];
|
|
12249
12264
|
}
|
|
12250
12265
|
};
|
|
12251
|
-
}), gn, Br, hr, yn, ws, vs, _s, wn, Oe,
|
|
12266
|
+
}), gn, Br, hr, yn, ws, vs, _s, wn, Oe, Jt = _(() => {
|
|
12252
12267
|
mn(), Br = !1, hr = !1, yn = !1, ws = () => {
|
|
12253
12268
|
if (typeof SharedArrayBuffer > "u") return !1;
|
|
12254
12269
|
try {
|
|
@@ -12306,7 +12321,7 @@ function Ay() {
|
|
|
12306
12321
|
throw new Error("WebAssembly is not initialized yet.");
|
|
12307
12322
|
};
|
|
12308
12323
|
}), Ct, Nr, ke, vn = _(() => {
|
|
12309
|
-
|
|
12324
|
+
Jt(), Ct = (y, $) => {
|
|
12310
12325
|
let A = Oe(), z = A.lengthBytesUTF8(y) + 1, P = A._malloc(z);
|
|
12311
12326
|
return A.stringToUTF8(y, P, z), $.push(P), P;
|
|
12312
12327
|
}, Nr = (y, $, A, z) => {
|
|
@@ -12333,7 +12348,7 @@ function Ay() {
|
|
|
12333
12348
|
}
|
|
12334
12349
|
};
|
|
12335
12350
|
}), bs, Yi = _(() => {
|
|
12336
|
-
|
|
12351
|
+
Jt(), vn(), bs = (y) => {
|
|
12337
12352
|
let $ = Oe(), A = 0, z = [], P = y || {};
|
|
12338
12353
|
try {
|
|
12339
12354
|
if (y?.logSeverityLevel === void 0) P.logSeverityLevel = 2;
|
|
@@ -12351,7 +12366,7 @@ function Ay() {
|
|
|
12351
12366
|
}
|
|
12352
12367
|
};
|
|
12353
12368
|
}), Ss, Ts, $s, pr, xs, Es, Ji = _(() => {
|
|
12354
|
-
|
|
12369
|
+
Jt(), vn(), Ss = (y) => {
|
|
12355
12370
|
switch (y) {
|
|
12356
12371
|
case "disabled":
|
|
12357
12372
|
return 0;
|
|
@@ -12441,8 +12456,8 @@ function Ay() {
|
|
|
12441
12456
|
throw A !== 0 && $._OrtReleaseSessionOptions(A) !== 0 && ke("Can't release session options."), z.forEach((N) => $._free(N)), G;
|
|
12442
12457
|
}
|
|
12443
12458
|
};
|
|
12444
|
-
}),
|
|
12445
|
-
|
|
12459
|
+
}), Zt, er, tr, _n, bn, Sn, Tn, Un, Ie = _(() => {
|
|
12460
|
+
Zt = (y) => {
|
|
12446
12461
|
switch (y) {
|
|
12447
12462
|
case "int8":
|
|
12448
12463
|
return 3;
|
|
@@ -12477,7 +12492,7 @@ function Ay() {
|
|
|
12477
12492
|
default:
|
|
12478
12493
|
throw new Error(`unsupported data type: ${y}`);
|
|
12479
12494
|
}
|
|
12480
|
-
},
|
|
12495
|
+
}, er = (y) => {
|
|
12481
12496
|
switch (y) {
|
|
12482
12497
|
case 3:
|
|
12483
12498
|
return "int8";
|
|
@@ -12512,7 +12527,7 @@ function Ay() {
|
|
|
12512
12527
|
default:
|
|
12513
12528
|
throw new Error(`unsupported data type: ${y}`);
|
|
12514
12529
|
}
|
|
12515
|
-
},
|
|
12530
|
+
}, tr = (y, $) => {
|
|
12516
12531
|
let A = [-1, 4, 1, 1, 2, 2, 4, 8, -1, 1, 2, 8, 4, 8, -1, -1, -1, -1, -1, -1, -1, 0.5, 0.5][y], z = typeof $ == "number" ? $ : $.reduce((P, G) => P * G, 1);
|
|
12517
12532
|
return A > 0 ? Math.ceil(z * A) : void 0;
|
|
12518
12533
|
}, _n = (y) => {
|
|
@@ -12606,8 +12621,8 @@ function Ay() {
|
|
|
12606
12621
|
}
|
|
12607
12622
|
} else return y instanceof Blob ? new Uint8Array(await y.arrayBuffer()) : y instanceof Uint8Array ? y : new Uint8Array(y);
|
|
12608
12623
|
};
|
|
12609
|
-
}), ks, Fn, Vn, Cr, Gn, qn, Je,
|
|
12610
|
-
zt(), Yi(), Ji(), Ie(),
|
|
12624
|
+
}), ks, Fn, Vn, Cr, Gn, qn, Je, nr, Wn, kr, H, Qr, Hn, Rs = _(() => {
|
|
12625
|
+
zt(), Yi(), Ji(), Ie(), Jt(), vn(), Cs(), ks = (y, $) => {
|
|
12611
12626
|
Oe()._OrtInit(y, $) !== 0 && ke("Can't initialize onnxruntime.");
|
|
12612
12627
|
}, Fn = async (y) => {
|
|
12613
12628
|
ks(y.wasm.numThreads, bn(y.logLevel));
|
|
@@ -12659,7 +12674,7 @@ function Ay() {
|
|
|
12659
12674
|
let $ = Oe(), A = $._malloc(y.byteLength);
|
|
12660
12675
|
if (A === 0) throw new Error(`Can't create a session. failed to allocate a buffer of size ${y.byteLength}.`);
|
|
12661
12676
|
return $.HEAPU8.set(y, A), [A, y.byteLength];
|
|
12662
|
-
},
|
|
12677
|
+
}, nr = async (y, $) => {
|
|
12663
12678
|
let A, z, P = Oe();
|
|
12664
12679
|
Array.isArray(y) ? [A, z] = y : y.buffer === P.HEAPU8.buffer ? [A, z] = [y.byteOffset, y.byteLength] : [A, z] = Je(y);
|
|
12665
12680
|
let G = 0, N = 0, L = [], V = [], Z = [];
|
|
@@ -12687,13 +12702,13 @@ function Ay() {
|
|
|
12687
12702
|
let [qe, _e, Bt] = qn(G, $e);
|
|
12688
12703
|
qe === 0 && ke("Can't get an input name."), V.push(qe);
|
|
12689
12704
|
let Nt = P.UTF8ToString(qe);
|
|
12690
|
-
Te.push(Nt), oe.push(_e === 0 ? { name: Nt, isTensor: !1 } : { name: Nt, isTensor: !0, type:
|
|
12705
|
+
Te.push(Nt), oe.push(_e === 0 ? { name: Nt, isTensor: !1 } : { name: Nt, isTensor: !0, type: er(_e), shape: Bt });
|
|
12691
12706
|
}
|
|
12692
12707
|
for (let $e = 0; $e < J; $e++) {
|
|
12693
12708
|
let [qe, _e, Bt] = qn(G, $e + se);
|
|
12694
12709
|
qe === 0 && ke("Can't get an output name."), Z.push(qe);
|
|
12695
12710
|
let Nt = P.UTF8ToString(qe);
|
|
12696
|
-
F.push(Nt), bt.push(_e === 0 ? { name: Nt, isTensor: !1 } : { name: Nt, isTensor: !0, type:
|
|
12711
|
+
F.push(Nt), bt.push(_e === 0 ? { name: Nt, isTensor: !1 } : { name: Nt, isTensor: !0, type: er(_e), shape: Bt });
|
|
12697
12712
|
}
|
|
12698
12713
|
return Cr.set(G, [G, V, Z, null, j, !1]), [G, Te, F, oe, bt];
|
|
12699
12714
|
} catch (se) {
|
|
@@ -12716,7 +12731,7 @@ function Ay() {
|
|
|
12716
12731
|
if (N && J !== "gpu-buffer") throw new Error(`External buffer must be provided for input/output index ${G} when enableGraphCapture is true.`);
|
|
12717
12732
|
if (J === "gpu-buffer") {
|
|
12718
12733
|
let Ge = y[2].gpuBuffer;
|
|
12719
|
-
F =
|
|
12734
|
+
F = tr(Zt(Z), se);
|
|
12720
12735
|
{
|
|
12721
12736
|
let $e = L.jsepRegisterBuffer;
|
|
12722
12737
|
if (!$e) throw new Error('Tensor location "gpu-buffer" is not supported without using WebGPU.');
|
|
@@ -12724,10 +12739,10 @@ function Ay() {
|
|
|
12724
12739
|
}
|
|
12725
12740
|
} else if (J === "ml-tensor") {
|
|
12726
12741
|
let Ge = y[2].mlTensor;
|
|
12727
|
-
F =
|
|
12742
|
+
F = tr(Zt(Z), se);
|
|
12728
12743
|
let $e = L.webnnRegisterMLTensor;
|
|
12729
12744
|
if (!$e) throw new Error('Tensor location "ml-tensor" is not supported without using WebNN.');
|
|
12730
|
-
Te = $e(z, Ge,
|
|
12745
|
+
Te = $e(z, Ge, Zt(Z), se);
|
|
12731
12746
|
} else {
|
|
12732
12747
|
let Ge = y[2];
|
|
12733
12748
|
if (Array.isArray(Ge)) {
|
|
@@ -12741,8 +12756,8 @@ function Ay() {
|
|
|
12741
12756
|
if (Z !== "string" && $e && qe) {
|
|
12742
12757
|
let _e = L.UTF8ToString(P);
|
|
12743
12758
|
if ($e(z, _e) || qe(z, _e)) {
|
|
12744
|
-
let Bt =
|
|
12745
|
-
F =
|
|
12759
|
+
let Bt = Zt(Z);
|
|
12760
|
+
F = tr(Bt, se), j = "ml-tensor";
|
|
12746
12761
|
let Nt = L.webnnCreateTemporaryTensor, Mr = L.webnnUploadTensor;
|
|
12747
12762
|
if (!Nt || !Mr) throw new Error('Tensor location "ml-tensor" is not supported without using WebNN.');
|
|
12748
12763
|
let Zr = await Nt(z, Bt, se);
|
|
@@ -12754,7 +12769,7 @@ function Ay() {
|
|
|
12754
12769
|
let oe = L.stackSave(), bt = L.stackAlloc(4 * se.length);
|
|
12755
12770
|
try {
|
|
12756
12771
|
se.forEach(($e, qe) => L.setValue(bt + qe * V, $e, V === 4 ? "i32" : "i64"));
|
|
12757
|
-
let Ge = L._OrtCreateTensor(
|
|
12772
|
+
let Ge = L._OrtCreateTensor(Zt(Z), Te, F, bt, se.length, Un(j));
|
|
12758
12773
|
Ge === 0 && ke(`Can't create tensor for input/output. session=${z}, index=${G}.`), $.push(Ge);
|
|
12759
12774
|
} finally {
|
|
12760
12775
|
L.stackRestore(oe);
|
|
@@ -12773,71 +12788,71 @@ function Ay() {
|
|
|
12773
12788
|
for (let We = 0; We < F; We++) N.setValue(Mr + We * L, $e[We], "*"), N.setValue(Zr + We * L, se[$[We]], "*");
|
|
12774
12789
|
for (let We = 0; We < oe; We++) N.setValue(rs + We * L, qe[We], "*"), N.setValue(Ls + We * L, J[z[We]], "*");
|
|
12775
12790
|
N.jsepOnRunStart?.(Z), N.webnnOnRunStart?.(Z);
|
|
12776
|
-
let
|
|
12777
|
-
|
|
12778
|
-
let
|
|
12791
|
+
let $t;
|
|
12792
|
+
$t = await N._OrtRun(Z, Zr, Mr, F, Ls, oe, rs, bt), $t !== 0 && ke("failed to call OrtRun().");
|
|
12793
|
+
let ir = [], Bs = [];
|
|
12779
12794
|
fe("wasm ProcessOutputTensor");
|
|
12780
12795
|
for (let We = 0; We < oe; We++) {
|
|
12781
|
-
let
|
|
12782
|
-
if (
|
|
12783
|
-
|
|
12796
|
+
let sr = Number(N.getValue(rs + We * L, "*"));
|
|
12797
|
+
if (sr === qe[We] || Bt.includes(qe[We])) {
|
|
12798
|
+
ir.push(P[We]), sr !== qe[We] && N._OrtReleaseTensor(sr) !== 0 && ke("Can't release tensor.");
|
|
12784
12799
|
continue;
|
|
12785
12800
|
}
|
|
12786
12801
|
let fi = N.stackSave(), gr = N.stackAlloc(4 * L), kn = !1, At, Ht = 0;
|
|
12787
12802
|
try {
|
|
12788
|
-
N._OrtGetTensorData(
|
|
12803
|
+
N._OrtGetTensorData(sr, gr, gr + L, gr + 2 * L, gr + 3 * L) !== 0 && ke(`Can't access output tensor data on index ${We}.`);
|
|
12789
12804
|
let ns = L === 4 ? "i32" : "i64", Rn = Number(N.getValue(gr, ns));
|
|
12790
12805
|
Ht = N.getValue(gr + L, "*");
|
|
12791
12806
|
let Ns = N.getValue(gr + L * 2, "*"), mi = Number(N.getValue(gr + L * 3, ns)), Dt = [];
|
|
12792
12807
|
for (let Mt = 0; Mt < mi; Mt++) Dt.push(Number(N.getValue(Ns + Mt * L, ns)));
|
|
12793
12808
|
N._OrtFree(Ns) !== 0 && ke("Can't free memory for tensor dims.");
|
|
12794
|
-
let yr = Dt.reduce((Mt,
|
|
12795
|
-
At =
|
|
12809
|
+
let yr = Dt.reduce((Mt, xt) => Mt * xt, 1);
|
|
12810
|
+
At = er(Rn);
|
|
12796
12811
|
let en = j?.outputPreferredLocations[z[We]];
|
|
12797
12812
|
if (At === "string") {
|
|
12798
12813
|
if (en === "gpu-buffer" || en === "ml-tensor") throw new Error("String tensor is not supported on GPU.");
|
|
12799
12814
|
let Mt = [];
|
|
12800
|
-
for (let
|
|
12801
|
-
let
|
|
12802
|
-
Mt.push(N.UTF8ToString(
|
|
12815
|
+
for (let xt = 0; xt < yr; xt++) {
|
|
12816
|
+
let ar = N.getValue(Ht + xt * L, "*"), gi = N.getValue(Ht + (xt + 1) * L, "*"), yi = xt === yr - 1 ? void 0 : gi - ar;
|
|
12817
|
+
Mt.push(N.UTF8ToString(ar, yi));
|
|
12803
12818
|
}
|
|
12804
|
-
|
|
12819
|
+
ir.push([At, Dt, Mt, "cpu"]);
|
|
12805
12820
|
} else if (en === "gpu-buffer" && yr > 0) {
|
|
12806
12821
|
let Mt = N.jsepGetBuffer;
|
|
12807
12822
|
if (!Mt) throw new Error('preferredLocation "gpu-buffer" is not supported without using WebGPU.');
|
|
12808
|
-
let
|
|
12809
|
-
if (
|
|
12810
|
-
kn = !0,
|
|
12811
|
-
N._OrtReleaseTensor(
|
|
12823
|
+
let xt = Mt(Ht), ar = tr(Rn, yr);
|
|
12824
|
+
if (ar === void 0 || !Sn(At)) throw new Error(`Unsupported data type: ${At}`);
|
|
12825
|
+
kn = !0, ir.push([At, Dt, { gpuBuffer: xt, download: N.jsepCreateDownloader(xt, ar, At), dispose: () => {
|
|
12826
|
+
N._OrtReleaseTensor(sr) !== 0 && ke("Can't release tensor.");
|
|
12812
12827
|
} }, "gpu-buffer"]);
|
|
12813
12828
|
} else if (en === "ml-tensor" && yr > 0) {
|
|
12814
|
-
let Mt = N.webnnEnsureTensor,
|
|
12815
|
-
if (!Mt ||
|
|
12816
|
-
if (
|
|
12817
|
-
if (
|
|
12818
|
-
let
|
|
12819
|
-
kn = !0,
|
|
12820
|
-
N.webnnReleaseTensorId(Ht), N._OrtReleaseTensor(
|
|
12829
|
+
let Mt = N.webnnEnsureTensor, xt = N.webnnIsGraphInputOutputTypeSupported;
|
|
12830
|
+
if (!Mt || !xt) throw new Error('preferredLocation "ml-tensor" is not supported without using WebNN.');
|
|
12831
|
+
if (tr(Rn, yr) === void 0 || !Tn(At)) throw new Error(`Unsupported data type: ${At}`);
|
|
12832
|
+
if (!xt(y, At, !1)) throw new Error(`preferredLocation "ml-tensor" for ${At} output is not supported by current WebNN Context.`);
|
|
12833
|
+
let ar = await Mt(y, Ht, Rn, Dt, !1);
|
|
12834
|
+
kn = !0, ir.push([At, Dt, { mlTensor: ar, download: N.webnnCreateMLTensorDownloader(Ht, At), dispose: () => {
|
|
12835
|
+
N.webnnReleaseTensorId(Ht), N._OrtReleaseTensor(sr);
|
|
12821
12836
|
} }, "ml-tensor"]);
|
|
12822
12837
|
} else if (en === "ml-tensor-cpu-output" && yr > 0) {
|
|
12823
|
-
let Mt = N.webnnCreateMLTensorDownloader(Ht, At)(),
|
|
12838
|
+
let Mt = N.webnnCreateMLTensorDownloader(Ht, At)(), xt = ir.length;
|
|
12824
12839
|
kn = !0, Bs.push((async () => {
|
|
12825
|
-
let
|
|
12826
|
-
return N.webnnReleaseTensorId(Ht), N._OrtReleaseTensor(
|
|
12827
|
-
})()),
|
|
12840
|
+
let ar = [xt, await Mt];
|
|
12841
|
+
return N.webnnReleaseTensorId(Ht), N._OrtReleaseTensor(sr), ar;
|
|
12842
|
+
})()), ir.push([At, Dt, [], "cpu"]);
|
|
12828
12843
|
} else {
|
|
12829
|
-
let Mt = _n(At),
|
|
12830
|
-
new Uint8Array(
|
|
12844
|
+
let Mt = _n(At), xt = new Mt(yr);
|
|
12845
|
+
new Uint8Array(xt.buffer, xt.byteOffset, xt.byteLength).set(N.HEAPU8.subarray(Ht, Ht + xt.byteLength)), ir.push([At, Dt, xt, "cpu"]);
|
|
12831
12846
|
}
|
|
12832
12847
|
} finally {
|
|
12833
|
-
N.stackRestore(fi), At === "string" && Ht && N._free(Ht), kn || N._OrtReleaseTensor(
|
|
12848
|
+
N.stackRestore(fi), At === "string" && Ht && N._free(Ht), kn || N._OrtReleaseTensor(sr);
|
|
12834
12849
|
}
|
|
12835
12850
|
}
|
|
12836
12851
|
j && !Te && (N._OrtClearBoundOutputs(j.handle) !== 0 && ke("Can't clear bound outputs."), Cr.set(y, [Z, se, J, j, Te, !1]));
|
|
12837
|
-
for (let [We,
|
|
12838
|
-
return Ue("wasm ProcessOutputTensor"),
|
|
12852
|
+
for (let [We, sr] of await Promise.all(Bs)) ir[We][2] = sr;
|
|
12853
|
+
return Ue("wasm ProcessOutputTensor"), ir;
|
|
12839
12854
|
} finally {
|
|
12840
|
-
N.webnnOnRunEnd?.(Z), N.stackRestore(Nt), $e.forEach((
|
|
12855
|
+
N.webnnOnRunEnd?.(Z), N.stackRestore(Nt), $e.forEach(($t) => N._OrtReleaseTensor($t)), qe.forEach(($t) => N._OrtReleaseTensor($t)), _e.forEach(($t) => N._free($t)), bt !== 0 && N._OrtReleaseRunOptions(bt), Ge.forEach(($t) => N._free($t));
|
|
12841
12856
|
}
|
|
12842
12857
|
}, Qr = (y) => {
|
|
12843
12858
|
let $ = Oe(), A = Cr.get(y);
|
|
@@ -12853,7 +12868,7 @@ function Ay() {
|
|
|
12853
12868
|
return $;
|
|
12854
12869
|
};
|
|
12855
12870
|
}), fr, Re, Rr, Xr, Ur, Yr, xn, En, mr, Ar, jn, Kn, Qn, As, Ms, hi, Jr, Is, Ps = _(() => {
|
|
12856
|
-
zt(), Rs(),
|
|
12871
|
+
zt(), Rs(), Jt(), mn(), fr = () => !!me.wasm.proxy && typeof document < "u", Rr = !1, Xr = !1, Ur = !1, En = /* @__PURE__ */ new Map(), mr = (y, $) => {
|
|
12857
12872
|
let A = En.get(y);
|
|
12858
12873
|
A ? A.push($) : En.set(y, [$]);
|
|
12859
12874
|
}, Ar = () => {
|
|
@@ -12920,7 +12935,7 @@ function Ay() {
|
|
|
12920
12935
|
let P = { type: "create", in: { model: y, options: { ...$ } } }, G = [];
|
|
12921
12936
|
y instanceof Uint8Array && G.push(y.buffer), Re.postMessage(P, G);
|
|
12922
12937
|
});
|
|
12923
|
-
} else return
|
|
12938
|
+
} else return nr(y, $);
|
|
12924
12939
|
}, hi = async (y) => {
|
|
12925
12940
|
if (fr()) return Ar(), new Promise(($, A) => {
|
|
12926
12941
|
mr("release", [$, A]);
|
|
@@ -13046,7 +13061,7 @@ function Ay() {
|
|
|
13046
13061
|
})(co)), co.exports;
|
|
13047
13062
|
}
|
|
13048
13063
|
var Up;
|
|
13049
|
-
function
|
|
13064
|
+
function Iy() {
|
|
13050
13065
|
return Up || (Up = 1, (function(c) {
|
|
13051
13066
|
var r = Wr && Wr.__createBinding || (Object.create ? (function(ce, re, ue, he) {
|
|
13052
13067
|
he === void 0 && (he = ue);
|
|
@@ -13067,7 +13082,7 @@ function My() {
|
|
|
13067
13082
|
return n(re, ce), re;
|
|
13068
13083
|
};
|
|
13069
13084
|
Object.defineProperty(c, "__esModule", { value: !0 }), c.MicVAD = c.getDefaultRealTimeVADOptions = c.ort = c.DEFAULT_MODEL = void 0;
|
|
13070
|
-
const f = a(
|
|
13085
|
+
const f = a(My()), v = Po(), C = Oo(), R = di(), _ = qi(), U = wf(), B = vf();
|
|
13071
13086
|
c.DEFAULT_MODEL = "legacy", c.ort = f;
|
|
13072
13087
|
const te = "vad.worklet.bundle.min.js", X = "silero_vad_v5.onnx", ee = "silero_vad_legacy.onnx", ie = (ce) => ({
|
|
13073
13088
|
...C.defaultFrameProcessorOptions,
|
|
@@ -13325,18 +13340,18 @@ function Vp() {
|
|
|
13325
13340
|
Object.defineProperty(c, "Message", { enumerable: !0, get: function() {
|
|
13326
13341
|
return f.Message;
|
|
13327
13342
|
} });
|
|
13328
|
-
var v =
|
|
13343
|
+
var v = Ry();
|
|
13329
13344
|
Object.defineProperty(c, "NonRealTimeVAD", { enumerable: !0, get: function() {
|
|
13330
13345
|
return v.NonRealTimeVAD;
|
|
13331
13346
|
} });
|
|
13332
|
-
const C =
|
|
13347
|
+
const C = Ay();
|
|
13333
13348
|
c.utils = {
|
|
13334
13349
|
audioFileToArray: C.audioFileToArray,
|
|
13335
13350
|
minFramesForTargetMS: C.minFramesForTargetMS,
|
|
13336
13351
|
arrayBufferToBase64: C.arrayBufferToBase64,
|
|
13337
13352
|
encodeWAV: C.encodeWAV
|
|
13338
13353
|
};
|
|
13339
|
-
var R =
|
|
13354
|
+
var R = Iy();
|
|
13340
13355
|
Object.defineProperty(c, "DEFAULT_MODEL", { enumerable: !0, get: function() {
|
|
13341
13356
|
return R.DEFAULT_MODEL;
|
|
13342
13357
|
} }), Object.defineProperty(c, "MicVAD", { enumerable: !0, get: function() {
|
|
@@ -13347,7 +13362,7 @@ function Vp() {
|
|
|
13347
13362
|
})(oo)), oo;
|
|
13348
13363
|
}
|
|
13349
13364
|
var Gp;
|
|
13350
|
-
function
|
|
13365
|
+
function Py() {
|
|
13351
13366
|
return Gp || (Gp = 1, (function(c) {
|
|
13352
13367
|
Object.defineProperty(c, "__esModule", { value: !0 }), c.useMicVAD = c.getDefaultReactRealTimeVADOptions = c.utils = void 0;
|
|
13353
13368
|
const r = Vp(), n = Yp;
|
|
@@ -13464,15 +13479,15 @@ function Iy() {
|
|
|
13464
13479
|
c.useMicVAD = R;
|
|
13465
13480
|
})(ao)), ao;
|
|
13466
13481
|
}
|
|
13467
|
-
var
|
|
13482
|
+
var Oy = Py();
|
|
13468
13483
|
ff();
|
|
13469
13484
|
const qp = {
|
|
13470
13485
|
echoCancellation: !0,
|
|
13471
13486
|
noiseSuppression: !0,
|
|
13472
13487
|
autoGainControl: !0,
|
|
13473
13488
|
channelCount: 1
|
|
13474
|
-
}, Ni = 16e3, bf = 512, Sf = 700,
|
|
13475
|
-
function
|
|
13489
|
+
}, Ni = 16e3, bf = 512, Sf = 700, zy = 300, Dy = bf / Ni * 1e3, Ly = Math.ceil(Sf / Dy);
|
|
13490
|
+
function Fw(c = {}) {
|
|
13476
13491
|
const {
|
|
13477
13492
|
onAudioChunk: r,
|
|
13478
13493
|
onAudioEnd: n,
|
|
@@ -13482,7 +13497,7 @@ function Uw(c = {}) {
|
|
|
13482
13497
|
onError: C,
|
|
13483
13498
|
interruptOnSpeechStart: R = !0,
|
|
13484
13499
|
forceAudioMp4: _ = !1
|
|
13485
|
-
} = c, { sendAudioChunk: U, endAudioStream: B, interrupt: te } = on(), [X, ee] = jr(!1), [ie, de] = jr(null), le =
|
|
13500
|
+
} = c, { sendAudioChunk: U, endAudioStream: B, interrupt: te } = on(), [X, ee] = jr(!1), [ie, de] = jr(null), le = Et(null), Le = Et(null), Ce = Et(null), ce = Et(!1), re = Et(null), ue = Et([]), he = Qe(() => {
|
|
13486
13501
|
if (!(typeof window > "u")) {
|
|
13487
13502
|
if (!Ce.current) {
|
|
13488
13503
|
const De = window.AudioContext || window.webkitAudioContext;
|
|
@@ -13575,7 +13590,7 @@ function Uw(c = {}) {
|
|
|
13575
13590
|
}), Ce.current = null);
|
|
13576
13591
|
}, []), yt = Qe(() => {
|
|
13577
13592
|
le.current && (le.current.getTracks().forEach((De) => De.stop()), le.current = null);
|
|
13578
|
-
}, []), at =
|
|
13593
|
+
}, []), at = Oy.useMicVAD({
|
|
13579
13594
|
model: "v5",
|
|
13580
13595
|
startOnLoad: !1,
|
|
13581
13596
|
processorType: "auto",
|
|
@@ -13598,7 +13613,7 @@ function Uw(c = {}) {
|
|
|
13598
13613
|
onFrameProcessed: (De, rt) => {
|
|
13599
13614
|
if (!rt) return;
|
|
13600
13615
|
const Ze = ue.current;
|
|
13601
|
-
Ze.push(new Float32Array(rt)), Ze.length >
|
|
13616
|
+
Ze.push(new Float32Array(rt)), Ze.length > Ly && Ze.shift();
|
|
13602
13617
|
},
|
|
13603
13618
|
onSpeechStart: () => {
|
|
13604
13619
|
ce.current || (re.current && (clearTimeout(re.current), re.current = null), ee(!0), R && te(), ft(), a?.());
|
|
@@ -13608,7 +13623,7 @@ function Uw(c = {}) {
|
|
|
13608
13623
|
ee(!1), Be(), ce.current = !0, setTimeout(() => {
|
|
13609
13624
|
ce.current = !1;
|
|
13610
13625
|
}, 300), f?.();
|
|
13611
|
-
},
|
|
13626
|
+
}, zy);
|
|
13612
13627
|
},
|
|
13613
13628
|
onVADMisfire: () => {
|
|
13614
13629
|
re.current && (clearTimeout(re.current), re.current = null), ee(!1), Xe(), v?.();
|
|
@@ -13629,7 +13644,7 @@ function Uw(c = {}) {
|
|
|
13629
13644
|
userSpeaking: at.userSpeaking
|
|
13630
13645
|
};
|
|
13631
13646
|
}
|
|
13632
|
-
const
|
|
13647
|
+
const Vw = () => on(), By = () => {
|
|
13633
13648
|
const {
|
|
13634
13649
|
connectionState: c,
|
|
13635
13650
|
isConnected: r,
|
|
@@ -13662,14 +13677,14 @@ const Fw = () => on(), Ly = () => {
|
|
|
13662
13677
|
clearSessionHistory: X,
|
|
13663
13678
|
changeSessionLanguage: ee
|
|
13664
13679
|
};
|
|
13665
|
-
},
|
|
13680
|
+
}, Gw = () => {
|
|
13666
13681
|
const { messages: c, sendTextMessage: r, clearMessages: n } = on();
|
|
13667
13682
|
return {
|
|
13668
13683
|
messages: c,
|
|
13669
13684
|
sendTextMessage: r,
|
|
13670
13685
|
clearMessages: n
|
|
13671
13686
|
};
|
|
13672
|
-
},
|
|
13687
|
+
}, qw = () => {
|
|
13673
13688
|
const {
|
|
13674
13689
|
sendAudioChunk: c,
|
|
13675
13690
|
endAudioStream: r,
|
|
@@ -13690,8 +13705,8 @@ const Fw = () => on(), Ly = () => {
|
|
|
13690
13705
|
resumeAudioPlayback: C,
|
|
13691
13706
|
attachAudioElement: R
|
|
13692
13707
|
};
|
|
13693
|
-
},
|
|
13694
|
-
const { session: c, isAvatarSpeaking: r, cloudStream: n, setCloudStreamState: a } = on(), f = n?.state ||
|
|
13708
|
+
}, Ny = () => {
|
|
13709
|
+
const { session: c, isAvatarSpeaking: r, cloudStream: n, setCloudStreamState: a } = on(), f = n?.state || rr.IDLE;
|
|
13695
13710
|
return {
|
|
13696
13711
|
streamingUrl: c.streamingUrl,
|
|
13697
13712
|
isAvatarSpeaking: r,
|
|
@@ -13700,11 +13715,11 @@ const Fw = () => on(), Ly = () => {
|
|
|
13700
13715
|
isDesktopAvatar: c.agentType === sn.DESKTOP_AVATAR,
|
|
13701
13716
|
cloudStreamState: f,
|
|
13702
13717
|
cloudStreamError: n?.error || null,
|
|
13703
|
-
isCloudStreamConnected: f ===
|
|
13704
|
-
isCloudStreamLoading: f ===
|
|
13718
|
+
isCloudStreamConnected: f === rr.CONNECTED,
|
|
13719
|
+
isCloudStreamLoading: f === rr.CONNECTING || f === rr.LOADING,
|
|
13705
13720
|
setCloudStreamState: a
|
|
13706
13721
|
};
|
|
13707
|
-
},
|
|
13722
|
+
}, Ww = (c) => {
|
|
13708
13723
|
const { attachAudioElement: r, resumeAudioPlayback: n } = on();
|
|
13709
13724
|
xr(() => {
|
|
13710
13725
|
if (!c?.current) return;
|
|
@@ -13717,8 +13732,8 @@ const Fw = () => on(), Ly = () => {
|
|
|
13717
13732
|
};
|
|
13718
13733
|
}, [r, c, n]);
|
|
13719
13734
|
};
|
|
13720
|
-
function
|
|
13721
|
-
const { initializeSession: v, joinDesktopSession: C, disconnect: R } =
|
|
13735
|
+
function Uy({ connect: c = !0, session: r, onError: n, onInitialized: a, children: f }) {
|
|
13736
|
+
const { initializeSession: v, joinDesktopSession: C, disconnect: R } = By(), _ = Et(!1);
|
|
13722
13737
|
return xr(() => {
|
|
13723
13738
|
if (!c || _.current) return;
|
|
13724
13739
|
let U = !1;
|
|
@@ -13744,7 +13759,7 @@ function Ny({ connect: c = !0, session: r, onError: n, onInitialized: a, childre
|
|
|
13744
13759
|
};
|
|
13745
13760
|
}, [c, R, v, C, n, a, r]), f;
|
|
13746
13761
|
}
|
|
13747
|
-
function
|
|
13762
|
+
function Hw({
|
|
13748
13763
|
children: c,
|
|
13749
13764
|
wsUrl: r,
|
|
13750
13765
|
restUrl: n,
|
|
@@ -13757,8 +13772,8 @@ function Ww({
|
|
|
13757
13772
|
onError: U,
|
|
13758
13773
|
onInitialized: B
|
|
13759
13774
|
}) {
|
|
13760
|
-
return /* @__PURE__ */
|
|
13761
|
-
|
|
13775
|
+
return /* @__PURE__ */ lr.jsx(
|
|
13776
|
+
_y,
|
|
13762
13777
|
{
|
|
13763
13778
|
wsUrl: r,
|
|
13764
13779
|
restUrl: n,
|
|
@@ -13766,8 +13781,8 @@ function Ww({
|
|
|
13766
13781
|
enableAudio: C,
|
|
13767
13782
|
pcmOptions: R,
|
|
13768
13783
|
debug: _,
|
|
13769
|
-
children: /* @__PURE__ */
|
|
13770
|
-
|
|
13784
|
+
children: /* @__PURE__ */ lr.jsx(
|
|
13785
|
+
Uy,
|
|
13771
13786
|
{
|
|
13772
13787
|
connect: f,
|
|
13773
13788
|
session: a,
|
|
@@ -13780,7 +13795,7 @@ function Ww({
|
|
|
13780
13795
|
);
|
|
13781
13796
|
}
|
|
13782
13797
|
var ho = { exports: {} }, Wp;
|
|
13783
|
-
function
|
|
13798
|
+
function Fy() {
|
|
13784
13799
|
return Wp || (Wp = 1, (function(c) {
|
|
13785
13800
|
const r = {};
|
|
13786
13801
|
r.generateIdentifier = function() {
|
|
@@ -14169,10 +14184,10 @@ t=0 0\r
|
|
|
14169
14184
|
}, c.exports = r;
|
|
14170
14185
|
})(ho)), ho.exports;
|
|
14171
14186
|
}
|
|
14172
|
-
var Hp =
|
|
14187
|
+
var Hp = Fy(), Er, Ot, Ui = { d: (c, r) => {
|
|
14173
14188
|
for (var n in r) Ui.o(r, n) && !Ui.o(c, n) && Object.defineProperty(c, n, { enumerable: !0, get: r[n] });
|
|
14174
14189
|
}, o: (c, r) => Object.prototype.hasOwnProperty.call(c, r) }, be = {};
|
|
14175
|
-
Ui.d(be, { Dz: () => im, g$: () => kf, Lt: () => Ef, Q9: () => Cf, qf: () => $o, hV: () => dm, z$: () =>
|
|
14190
|
+
Ui.d(be, { Dz: () => im, g$: () => kf, Lt: () => Ef, Q9: () => Cf, qf: () => $o, hV: () => dm, z$: () => Ow, J0: () => Eo, De: () => ow, $C: () => Nn, al: () => Lf, _W: () => Bf, Gv: () => Jf, m: () => Zf, tz: () => Df, Nu: () => lm, zg: () => pm, vp: () => sm, vU: () => K, wF: () => jf, rv: () => am, Nh: () => om, ss: () => hm, qW: () => em, QL: () => Yf, cf: () => mm, eM: () => Hf, Yd: () => T, Tk: () => Se, iM: () => Tf, qy: () => Kr, ce: () => Yy, sK: () => ye, Ok: () => St, q5: () => um, g: () => Pw, xl: () => qf, I: () => Wf, bx: () => xo, dD: () => rm, Ib: () => ci, Az: () => Pt, Iw: () => Or, qY: () => To, db: () => xf, mR: () => ui, Tn: () => So, rV: () => Kf, gh: () => Uf, Mi: () => Ff, j: () => Vf, YB: () => Gf, Yt: () => Xf, i5: () => Qf, x_: () => Hr, Am: () => Co, eR: () => Rf, r8: () => Nf, u3: () => fm, vd: () => Mf, iV: () => Pf, jZ: () => If, SW: () => zf, ZH: () => Of, Ni: () => gm, lh: () => Af, ZP: () => nm, bq: () => $f, $f: () => ym, eu: () => tm, Ax: () => rw, Mc: () => tw });
|
|
14176
14191
|
class T {
|
|
14177
14192
|
static GetStackTrace() {
|
|
14178
14193
|
const r = new Error();
|
|
@@ -14220,27 +14235,27 @@ class Kr {
|
|
|
14220
14235
|
` + JSON.stringify(this, this.sendFilter, 4), 6), JSON.stringify(this, this.sendFilter);
|
|
14221
14236
|
}
|
|
14222
14237
|
}
|
|
14223
|
-
class
|
|
14238
|
+
class Vy extends Kr {
|
|
14224
14239
|
constructor() {
|
|
14225
14240
|
super(), this.type = Er.LIST_STREAMERS;
|
|
14226
14241
|
}
|
|
14227
14242
|
}
|
|
14228
|
-
class
|
|
14243
|
+
class Gy extends Kr {
|
|
14229
14244
|
constructor(r) {
|
|
14230
14245
|
super(), this.type = Er.SUBSCRIBE, this.streamerId = r;
|
|
14231
14246
|
}
|
|
14232
14247
|
}
|
|
14233
|
-
class
|
|
14248
|
+
class qy extends Kr {
|
|
14234
14249
|
constructor() {
|
|
14235
14250
|
super(), this.type = Er.UNSUBSCRIBE;
|
|
14236
14251
|
}
|
|
14237
14252
|
}
|
|
14238
|
-
class
|
|
14253
|
+
class Wy extends Kr {
|
|
14239
14254
|
constructor(r) {
|
|
14240
14255
|
super(), this.type = Er.PONG, this.time = r;
|
|
14241
14256
|
}
|
|
14242
14257
|
}
|
|
14243
|
-
class
|
|
14258
|
+
class Hy extends Kr {
|
|
14244
14259
|
constructor(r, n) {
|
|
14245
14260
|
super(), this.type = Er.OFFER, this.minBitrate = 0, this.maxBitrate = 0, r && (this.type = r.type, this.sdp = r.sdp, this.minBitrate = n.minBitrateBps, this.maxBitrate = n.maxBitrateBps);
|
|
14246
14261
|
}
|
|
@@ -14248,7 +14263,7 @@ class Wy extends Kr {
|
|
|
14248
14263
|
if (r != "minBitrate" && r != "maxBitrate" || !(n <= 0)) return n;
|
|
14249
14264
|
}
|
|
14250
14265
|
}
|
|
14251
|
-
class
|
|
14266
|
+
class jy extends Kr {
|
|
14252
14267
|
constructor(r, n) {
|
|
14253
14268
|
super(), this.type = Er.ANSWER, this.minBitrate = 0, this.maxBitrate = 0, r && (this.type = r.type, this.sdp = r.sdp, this.minBitrate = n.minBitrateBps, this.maxBitrate = n.maxBitrateBps);
|
|
14254
14269
|
}
|
|
@@ -14256,17 +14271,17 @@ class Hy extends Kr {
|
|
|
14256
14271
|
if (r != "minBitrate" && r != "maxBitrate" || !(n <= 0)) return n;
|
|
14257
14272
|
}
|
|
14258
14273
|
}
|
|
14259
|
-
class
|
|
14274
|
+
class Ky extends Kr {
|
|
14260
14275
|
constructor() {
|
|
14261
14276
|
super(), this.type = Er.DATACHANNELREQUEST;
|
|
14262
14277
|
}
|
|
14263
14278
|
}
|
|
14264
|
-
class
|
|
14279
|
+
class Qy extends Kr {
|
|
14265
14280
|
constructor() {
|
|
14266
14281
|
super(), this.type = Er.SFURECVDATACHANNELREADY;
|
|
14267
14282
|
}
|
|
14268
14283
|
}
|
|
14269
|
-
class
|
|
14284
|
+
class Xy {
|
|
14270
14285
|
constructor(r) {
|
|
14271
14286
|
this.type = Er.ICE_CANDIDATE, this.candidate = r;
|
|
14272
14287
|
}
|
|
@@ -14280,7 +14295,7 @@ class Qy {
|
|
|
14280
14295
|
})(Ot || (Ot = {}));
|
|
14281
14296
|
class Tf {
|
|
14282
14297
|
}
|
|
14283
|
-
class
|
|
14298
|
+
class Yy extends Tf {
|
|
14284
14299
|
}
|
|
14285
14300
|
class So {
|
|
14286
14301
|
constructor() {
|
|
@@ -14294,7 +14309,7 @@ class So {
|
|
|
14294
14309
|
}
|
|
14295
14310
|
static setupDefaultHandlers(r) {
|
|
14296
14311
|
r.signallingProtocol.addMessageHandler(Ot.PING, ((n) => {
|
|
14297
|
-
const a = new
|
|
14312
|
+
const a = new Wy((/* @__PURE__ */ new Date()).getTime()).payload();
|
|
14298
14313
|
T.Log(T.GetStackTrace(), Ot.PING + ": " + n, 6), r.webSocket.send(a);
|
|
14299
14314
|
})), r.signallingProtocol.addMessageHandler(Ot.CONFIG, ((n) => {
|
|
14300
14315
|
T.Log(T.GetStackTrace(), Ot.CONFIG, 6);
|
|
@@ -14369,36 +14384,36 @@ class $f {
|
|
|
14369
14384
|
T.Log(T.GetStackTrace(), "Disconnected to the signalling server via WebSocket: " + JSON.stringify(r.code) + " - " + r.reason), this.onClose.dispatchEvent(new CustomEvent("close", { detail: r }));
|
|
14370
14385
|
}
|
|
14371
14386
|
requestStreamerList() {
|
|
14372
|
-
const r = new
|
|
14387
|
+
const r = new Vy();
|
|
14373
14388
|
this.webSocket.send(r.payload());
|
|
14374
14389
|
}
|
|
14375
14390
|
sendSubscribe(r) {
|
|
14376
|
-
const n = new
|
|
14391
|
+
const n = new Gy(r);
|
|
14377
14392
|
this.webSocket.send(n.payload());
|
|
14378
14393
|
}
|
|
14379
14394
|
sendUnsubscribe() {
|
|
14380
|
-
const r = new
|
|
14395
|
+
const r = new qy();
|
|
14381
14396
|
this.webSocket.send(r.payload());
|
|
14382
14397
|
}
|
|
14383
14398
|
sendWebRtcOffer(r, n) {
|
|
14384
|
-
const a = new
|
|
14399
|
+
const a = new Hy(r, n);
|
|
14385
14400
|
this.webSocket.send(a.payload());
|
|
14386
14401
|
}
|
|
14387
14402
|
sendWebRtcAnswer(r, n) {
|
|
14388
|
-
const a = new
|
|
14403
|
+
const a = new jy(r, n);
|
|
14389
14404
|
this.webSocket.send(a.payload());
|
|
14390
14405
|
}
|
|
14391
14406
|
sendWebRtcDatachannelRequest() {
|
|
14392
|
-
const r = new
|
|
14407
|
+
const r = new Ky();
|
|
14393
14408
|
this.webSocket.send(r.payload());
|
|
14394
14409
|
}
|
|
14395
14410
|
sendSFURecvDataChannelReady() {
|
|
14396
|
-
const r = new
|
|
14411
|
+
const r = new Qy();
|
|
14397
14412
|
this.webSocket.send(r.payload());
|
|
14398
14413
|
}
|
|
14399
14414
|
sendIceCandidate(r) {
|
|
14400
14415
|
if (T.Log(T.GetStackTrace(), "Sending Ice Candidate"), this.webSocket && this.webSocket.readyState === this.WS_OPEN_STATE) {
|
|
14401
|
-
const n = new
|
|
14416
|
+
const n = new Xy(r);
|
|
14402
14417
|
this.webSocket.send(n.payload());
|
|
14403
14418
|
}
|
|
14404
14419
|
}
|
|
@@ -14423,7 +14438,7 @@ class $f {
|
|
|
14423
14438
|
onPlayerCount(r) {
|
|
14424
14439
|
}
|
|
14425
14440
|
}
|
|
14426
|
-
class
|
|
14441
|
+
class Jy {
|
|
14427
14442
|
constructor(r) {
|
|
14428
14443
|
this.videoElementProvider = r, this.audioElement = document.createElement("Audio"), this.videoElementProvider.setAudioElement(this.audioElement);
|
|
14429
14444
|
}
|
|
@@ -14438,7 +14453,7 @@ class Yy {
|
|
|
14438
14453
|
n.srcObject != r && n.srcObject && n.srcObject !== r && (this.audioElement.srcObject = r, T.Log(T.GetStackTrace(), "Created new audio element to play separate audio stream."));
|
|
14439
14454
|
}
|
|
14440
14455
|
}
|
|
14441
|
-
class
|
|
14456
|
+
class Zy {
|
|
14442
14457
|
constructor(r) {
|
|
14443
14458
|
this.freezeFrameHeight = 0, this.freezeFrameWidth = 0, this.rootDiv = r, this.rootElement = document.createElement("div"), this.rootElement.id = "freezeFrame", this.rootElement.style.display = "none", this.rootElement.style.pointerEvents = "none", this.rootElement.style.position = "absolute", this.rootElement.style.zIndex = "20", this.imageElement = document.createElement("img"), this.imageElement.style.position = "absolute", this.rootElement.appendChild(this.imageElement), this.rootDiv.appendChild(this.rootElement);
|
|
14444
14459
|
}
|
|
@@ -14463,9 +14478,9 @@ class Jy {
|
|
|
14463
14478
|
}
|
|
14464
14479
|
}
|
|
14465
14480
|
}
|
|
14466
|
-
class
|
|
14481
|
+
class ew {
|
|
14467
14482
|
constructor(r) {
|
|
14468
|
-
this.receiving = !1, this.size = 0, this.jpeg = void 0, this.valid = !1, this.freezeFrameDelay = 50, this.freezeFrame = new
|
|
14483
|
+
this.receiving = !1, this.size = 0, this.jpeg = void 0, this.valid = !1, this.freezeFrameDelay = 50, this.freezeFrame = new Zy(r);
|
|
14469
14484
|
}
|
|
14470
14485
|
showFreezeFrame() {
|
|
14471
14486
|
this.valid && this.freezeFrame.setElementForShow();
|
|
@@ -14798,12 +14813,12 @@ class ui extends Event {
|
|
|
14798
14813
|
super("settingsChanged"), this.data = r;
|
|
14799
14814
|
}
|
|
14800
14815
|
}
|
|
14801
|
-
class
|
|
14816
|
+
class tw extends Event {
|
|
14802
14817
|
constructor() {
|
|
14803
14818
|
super("xrSessionStarted");
|
|
14804
14819
|
}
|
|
14805
14820
|
}
|
|
14806
|
-
class
|
|
14821
|
+
class rw extends Event {
|
|
14807
14822
|
constructor() {
|
|
14808
14823
|
super("xrSessionEnded");
|
|
14809
14824
|
}
|
|
@@ -14837,20 +14852,20 @@ class sm extends EventTarget {
|
|
|
14837
14852
|
class K {
|
|
14838
14853
|
}
|
|
14839
14854
|
K.AutoConnect = "AutoConnect", K.AutoPlayVideo = "AutoPlayVideo", K.AFKDetection = "TimeoutIfIdle", K.BrowserSendOffer = "OfferToReceive", K.HoveringMouseMode = "HoveringMouse", K.ForceMonoAudio = "ForceMonoAudio", K.ForceTURN = "ForceTURN", K.FakeMouseWithTouches = "FakeMouseWithTouches", K.IsQualityController = "ControlsQuality", K.MatchViewportResolution = "MatchViewportRes", K.StartVideoMuted = "StartVideoMuted", K.SuppressBrowserKeys = "SuppressBrowserKeys", K.UseMic = "UseMic", K.KeyboardInput = "KeyboardInput", K.MouseInput = "MouseInput", K.TouchInput = "TouchInput", K.GamepadInput = "GamepadInput", K.XRControllerInput = "XRControllerInput", K.WaitForStreamer = "WaitForStreamer", K.HideUI = "HideUI";
|
|
14840
|
-
const
|
|
14855
|
+
const nw = (c) => Object.getOwnPropertyNames(K).some(((r) => K[r] === c));
|
|
14841
14856
|
class ye {
|
|
14842
14857
|
}
|
|
14843
14858
|
ye.AFKTimeoutSecs = "AFKTimeout", ye.AFKCountdownSecs = "AFKCountdown", ye.MinQP = "MinQP", ye.MaxQP = "MaxQP", ye.WebRTCFPS = "WebRTCFPS", ye.WebRTCMinBitrate = "WebRTCMinBitrate", ye.WebRTCMaxBitrate = "WebRTCMaxBitrate", ye.MaxReconnectAttempts = "MaxReconnectAttempts", ye.StreamerAutoJoinInterval = "StreamerAutoJoinInterval";
|
|
14844
|
-
const
|
|
14859
|
+
const sw = (c) => Object.getOwnPropertyNames(ye).some(((r) => ye[r] === c));
|
|
14845
14860
|
class Hr {
|
|
14846
14861
|
}
|
|
14847
14862
|
Hr.SignallingServerUrl = "ss";
|
|
14848
|
-
const
|
|
14863
|
+
const iw = (c) => Object.getOwnPropertyNames(Hr).some(((r) => Hr[r] === c));
|
|
14849
14864
|
class St {
|
|
14850
14865
|
}
|
|
14851
14866
|
St.PreferredCodec = "PreferredCodec", St.StreamerId = "StreamerId";
|
|
14852
|
-
const
|
|
14853
|
-
class
|
|
14867
|
+
const aw = (c) => Object.getOwnPropertyNames(St).some(((r) => St[r] === c));
|
|
14868
|
+
class ow {
|
|
14854
14869
|
constructor(r = {}) {
|
|
14855
14870
|
this.flags = /* @__PURE__ */ new Map(), this.numericParameters = /* @__PURE__ */ new Map(), this.textParameters = /* @__PURE__ */ new Map(), this.optionParameters = /* @__PURE__ */ new Map();
|
|
14856
14871
|
const { initialSettings: n, useUrlParams: a } = r;
|
|
@@ -14921,7 +14936,7 @@ class aw {
|
|
|
14921
14936
|
this.flags.has(r) ? this.flags.get(r).label = n : T.Warning(T.GetStackTrace(), `Cannot set label for flag called ${r} - it does not exist in the Config.flags map.`);
|
|
14922
14937
|
}
|
|
14923
14938
|
setSettings(r) {
|
|
14924
|
-
for (const n of Object.keys(r))
|
|
14939
|
+
for (const n of Object.keys(r)) nw(n) ? this.setFlagEnabled(n, r[n]) : sw(n) ? this.setNumericSetting(n, r[n]) : iw(n) ? this.setTextSetting(n, r[n]) : aw(n) && this.setOptionSettingValue(n, r[n]);
|
|
14925
14940
|
}
|
|
14926
14941
|
getSettings() {
|
|
14927
14942
|
const r = {};
|
|
@@ -15038,13 +15053,13 @@ class Eo {
|
|
|
15038
15053
|
}
|
|
15039
15054
|
class um {
|
|
15040
15055
|
}
|
|
15041
|
-
class ow {
|
|
15042
|
-
}
|
|
15043
15056
|
class lw {
|
|
15044
15057
|
}
|
|
15058
|
+
class uw {
|
|
15059
|
+
}
|
|
15045
15060
|
class dm {
|
|
15046
15061
|
constructor() {
|
|
15047
|
-
this.inboundVideoStats = new om(), this.inboundAudioStats = new am(), this.DataChannelStats = new lm(), this.outBoundVideoStats = new um(), this.sessionStats = new
|
|
15062
|
+
this.inboundVideoStats = new om(), this.inboundAudioStats = new am(), this.DataChannelStats = new lm(), this.outBoundVideoStats = new um(), this.sessionStats = new lw(), this.streamStats = new uw(), this.codecs = /* @__PURE__ */ new Map();
|
|
15048
15063
|
}
|
|
15049
15064
|
processStats(r) {
|
|
15050
15065
|
this.localCandidates = new Array(), this.remoteCandidates = new Array(), this.candidatePairs = new Array(), r.forEach(((n) => {
|
|
@@ -15193,7 +15208,7 @@ var is, Se, fo = function(c, r, n, a) {
|
|
|
15193
15208
|
_((a = a.apply(c, [])).next());
|
|
15194
15209
|
}));
|
|
15195
15210
|
};
|
|
15196
|
-
class
|
|
15211
|
+
class dw {
|
|
15197
15212
|
constructor(r, n, a) {
|
|
15198
15213
|
this.config = n, this.createPeerConnection(r, a);
|
|
15199
15214
|
}
|
|
@@ -15357,13 +15372,13 @@ class uw {
|
|
|
15357
15372
|
}
|
|
15358
15373
|
class hm {
|
|
15359
15374
|
constructor() {
|
|
15360
|
-
this.PixelStreamingSettings = new
|
|
15375
|
+
this.PixelStreamingSettings = new cw(), this.EncoderSettings = new pm(), this.WebRTCSettings = new fm();
|
|
15361
15376
|
}
|
|
15362
15377
|
ueCompatible() {
|
|
15363
15378
|
this.WebRTCSettings.MaxFPS != null && (this.WebRTCSettings.FPS = this.WebRTCSettings.MaxFPS);
|
|
15364
15379
|
}
|
|
15365
15380
|
}
|
|
15366
|
-
class
|
|
15381
|
+
class cw {
|
|
15367
15382
|
}
|
|
15368
15383
|
class pm {
|
|
15369
15384
|
}
|
|
@@ -15408,7 +15423,7 @@ class mo {
|
|
|
15408
15423
|
} else n.data.length > n.chunks && (n.receiving = !1, T.Error(T.GetStackTrace(), `Received bigger file than advertised: ${n.data.length}/${n.chunks}`));
|
|
15409
15424
|
}
|
|
15410
15425
|
}
|
|
15411
|
-
class
|
|
15426
|
+
class hw {
|
|
15412
15427
|
constructor() {
|
|
15413
15428
|
this.mimetype = "", this.extension = "", this.receiving = !1, this.chunks = 0, this.data = [], this.valid = !1;
|
|
15414
15429
|
}
|
|
@@ -15416,9 +15431,9 @@ class cw {
|
|
|
15416
15431
|
class Wt {
|
|
15417
15432
|
}
|
|
15418
15433
|
Wt.mainButton = 0, Wt.auxiliaryButton = 1, Wt.secondaryButton = 2, Wt.fourthButton = 3, Wt.fifthButton = 4;
|
|
15419
|
-
class
|
|
15434
|
+
class Qt {
|
|
15420
15435
|
}
|
|
15421
|
-
|
|
15436
|
+
Qt.primaryButton = 1, Qt.secondaryButton = 2, Qt.auxiliaryButton = 4, Qt.fourthButton = 8, Qt.fifthButton = 16;
|
|
15422
15437
|
class os {
|
|
15423
15438
|
constructor() {
|
|
15424
15439
|
this.unregisterCallbacks = [];
|
|
@@ -15431,7 +15446,7 @@ class os {
|
|
|
15431
15446
|
this.unregisterCallbacks = [];
|
|
15432
15447
|
}
|
|
15433
15448
|
}
|
|
15434
|
-
class
|
|
15449
|
+
class pw {
|
|
15435
15450
|
constructor(r, n, a) {
|
|
15436
15451
|
this.touchEventListenerTracker = new os(), this.toStreamerMessagesProvider = r, this.videoElementProvider = n, this.coordinateConverter = a;
|
|
15437
15452
|
const f = (R) => this.onTouchStart(R), v = (R) => this.onTouchEnd(R), C = (R) => this.onTouchMove(R);
|
|
@@ -15447,7 +15462,7 @@ class hw {
|
|
|
15447
15462
|
if (this.videoElementProvider.isVideoReady() && r.target === this.videoElementProvider.getVideoElement()) {
|
|
15448
15463
|
if (this.fakeTouchFinger == null) {
|
|
15449
15464
|
const n = r.changedTouches[0];
|
|
15450
|
-
this.fakeTouchFinger = new
|
|
15465
|
+
this.fakeTouchFinger = new fw(n.identifier, n.clientX - this.videoElementParentClientRect.left, n.clientY - this.videoElementParentClientRect.top);
|
|
15451
15466
|
const a = this.videoElementProvider.getVideoParentElement(), f = new MouseEvent("mouseenter", n);
|
|
15452
15467
|
a.dispatchEvent(f);
|
|
15453
15468
|
const v = this.coordinateConverter.normalizeAndQuantizeUnsigned(this.fakeTouchFinger.x, this.fakeTouchFinger.y);
|
|
@@ -15485,15 +15500,15 @@ class hw {
|
|
|
15485
15500
|
r.preventDefault();
|
|
15486
15501
|
}
|
|
15487
15502
|
}
|
|
15488
|
-
class
|
|
15503
|
+
class fw {
|
|
15489
15504
|
constructor(r, n, a) {
|
|
15490
15505
|
this.id = r, this.x = n, this.y = a;
|
|
15491
15506
|
}
|
|
15492
15507
|
}
|
|
15493
|
-
class
|
|
15508
|
+
class Xt {
|
|
15494
15509
|
}
|
|
15495
|
-
|
|
15496
|
-
class
|
|
15510
|
+
Xt.backSpace = 8, Xt.shift = 16, Xt.control = 17, Xt.alt = 18, Xt.rightShift = 253, Xt.rightControl = 254, Xt.rightAlt = 255;
|
|
15511
|
+
class mw {
|
|
15497
15512
|
constructor(r, n, a) {
|
|
15498
15513
|
this.keyboardEventListenerTracker = new os(), this.CodeToKeyCode = { Escape: 27, Digit0: 48, Digit1: 49, Digit2: 50, Digit3: 51, Digit4: 52, Digit5: 53, Digit6: 54, Digit7: 55, Digit8: 56, Digit9: 57, Minus: 173, Equal: 187, Backspace: 8, Tab: 9, KeyQ: 81, KeyW: 87, KeyE: 69, KeyR: 82, KeyT: 84, KeyY: 89, KeyU: 85, KeyI: 73, KeyO: 79, KeyP: 80, BracketLeft: 219, BracketRight: 221, Enter: 13, ControlLeft: 17, KeyA: 65, KeyS: 83, KeyD: 68, KeyF: 70, KeyG: 71, KeyH: 72, KeyJ: 74, KeyK: 75, KeyL: 76, Semicolon: 186, Quote: 222, Backquote: 192, ShiftLeft: 16, Backslash: 220, KeyZ: 90, KeyX: 88, KeyC: 67, KeyV: 86, KeyB: 66, KeyN: 78, KeyM: 77, Comma: 188, Period: 190, Slash: 191, ShiftRight: 253, AltLeft: 18, Space: 32, CapsLock: 20, F1: 112, F2: 113, F3: 114, F4: 115, F5: 116, F6: 117, F7: 118, F8: 119, F9: 120, F10: 121, F11: 122, F12: 123, Pause: 19, ScrollLock: 145, NumpadDivide: 111, NumpadMultiply: 106, NumpadSubtract: 109, NumpadAdd: 107, NumpadDecimal: 110, Numpad9: 105, Numpad8: 104, Numpad7: 103, Numpad6: 102, Numpad5: 101, Numpad4: 100, Numpad3: 99, Numpad2: 98, Numpad1: 97, Numpad0: 96, NumLock: 144, ControlRight: 254, AltRight: 255, Home: 36, End: 35, ArrowUp: 38, ArrowLeft: 37, ArrowRight: 39, ArrowDown: 40, PageUp: 33, PageDown: 34, Insert: 45, Delete: 46, ContextMenu: 93 }, this.toStreamerMessagesProvider = r, this.config = n, this.activeKeysProvider = a;
|
|
15499
15514
|
}
|
|
@@ -15506,7 +15521,7 @@ class fw {
|
|
|
15506
15521
|
}
|
|
15507
15522
|
handleOnKeyDown(r) {
|
|
15508
15523
|
const n = this.getKeycode(r);
|
|
15509
|
-
n && n !== 229 && (T.Log(T.GetStackTrace(), `key down ${n}, repeat = ${r.repeat}`, 6), this.toStreamerMessagesProvider.toStreamerHandlers.get("KeyDown")([this.getKeycode(r), r.repeat ? 1 : 0]), this.activeKeysProvider.getActiveKeys().push(n), n ===
|
|
15524
|
+
n && n !== 229 && (T.Log(T.GetStackTrace(), `key down ${n}, repeat = ${r.repeat}`, 6), this.toStreamerMessagesProvider.toStreamerHandlers.get("KeyDown")([this.getKeycode(r), r.repeat ? 1 : 0]), this.activeKeysProvider.getActiveKeys().push(n), n === Xt.backSpace && document.dispatchEvent(new KeyboardEvent("keypress", { charCode: Xt.backSpace })), this.config.isFlagEnabled(K.SuppressBrowserKeys) && this.isKeyCodeBrowserKey(n) && r.preventDefault());
|
|
15510
15525
|
}
|
|
15511
15526
|
handleOnKeyUp(r) {
|
|
15512
15527
|
const n = this.getKeycode(r);
|
|
@@ -15527,13 +15542,13 @@ class fw {
|
|
|
15527
15542
|
const n = r;
|
|
15528
15543
|
return n.code in this.CodeToKeyCode ? this.CodeToKeyCode[n.code] : (T.Warning(T.GetStackTrace(), `Keyboard code of ${n.code} is not supported in our mapping, ignoring this key.`), null);
|
|
15529
15544
|
}
|
|
15530
|
-
return r.keyCode ===
|
|
15545
|
+
return r.keyCode === Xt.shift && r.code === "ShiftRight" ? Xt.rightShift : r.keyCode === Xt.control && r.code === "ControlRight" ? Xt.rightControl : r.keyCode === Xt.alt && r.code === "AltRight" ? Xt.rightAlt : r.keyCode;
|
|
15531
15546
|
}
|
|
15532
15547
|
isKeyCodeBrowserKey(r) {
|
|
15533
15548
|
return r >= 112 && r <= 123 || r === 9;
|
|
15534
15549
|
}
|
|
15535
15550
|
}
|
|
15536
|
-
class
|
|
15551
|
+
class gw {
|
|
15537
15552
|
constructor(r, n, a) {
|
|
15538
15553
|
this.x = 0, this.y = 0, this.updateMouseMovePositionEvent = (v) => {
|
|
15539
15554
|
this.updateMouseMovePosition(v);
|
|
@@ -15583,7 +15598,7 @@ class mw {
|
|
|
15583
15598
|
this.videoElementProvider.isVideoReady() && this.mouseController.releaseMouseButtons(r.buttons, this.x, this.y);
|
|
15584
15599
|
}
|
|
15585
15600
|
}
|
|
15586
|
-
class
|
|
15601
|
+
class yw {
|
|
15587
15602
|
constructor(r) {
|
|
15588
15603
|
this.mouseController = r;
|
|
15589
15604
|
}
|
|
@@ -15627,7 +15642,7 @@ class gw {
|
|
|
15627
15642
|
this.mouseController.videoElementProvider.isVideoReady() && (T.Log(T.GetStackTrace(), "onMouse release", 6), this.mouseController.releaseMouseButtons(r.buttons, r.offsetX, r.offsetY));
|
|
15628
15643
|
}
|
|
15629
15644
|
}
|
|
15630
|
-
class
|
|
15645
|
+
class ww {
|
|
15631
15646
|
constructor(r, n, a, f) {
|
|
15632
15647
|
this.mouseEventListenerTracker = new os(), this.toStreamerMessagesProvider = r, this.coordinateConverter = a, this.videoElementProvider = n, this.activeKeysProvider = f, this.registerMouseEnterAndLeaveEvents();
|
|
15633
15648
|
}
|
|
@@ -15635,7 +15650,7 @@ class yw {
|
|
|
15635
15650
|
this.mouseEventListenerTracker.unregisterAll();
|
|
15636
15651
|
}
|
|
15637
15652
|
registerLockedMouseEvents(r) {
|
|
15638
|
-
const n = this.videoElementProvider.getVideoParentElement(), a = new
|
|
15653
|
+
const n = this.videoElementProvider.getVideoParentElement(), a = new gw(this.videoElementProvider, r, this.activeKeysProvider);
|
|
15639
15654
|
if (n.requestPointerLock = n.requestPointerLock || n.mozRequestPointerLock, document.exitPointerLock = document.exitPointerLock || document.mozExitPointerLock, n.requestPointerLock) {
|
|
15640
15655
|
const U = () => {
|
|
15641
15656
|
n.requestPointerLock();
|
|
@@ -15650,7 +15665,7 @@ class yw {
|
|
|
15650
15665
|
}));
|
|
15651
15666
|
}
|
|
15652
15667
|
registerHoveringMouseEvents(r) {
|
|
15653
|
-
const n = this.videoElementProvider.getVideoParentElement(), a = new
|
|
15668
|
+
const n = this.videoElementProvider.getVideoParentElement(), a = new yw(r), f = (B) => a.updateMouseMovePosition(B), v = (B) => a.handleMouseDown(B), C = (B) => a.handleMouseUp(B), R = (B) => a.handleContextMenu(B), _ = (B) => a.handleMouseWheel(B), U = (B) => a.handleMouseDouble(B);
|
|
15654
15669
|
n.addEventListener("mousemove", f), n.addEventListener("mousedown", v), n.addEventListener("mouseup", C), n.addEventListener("contextmenu", R), n.addEventListener("wheel", _), n.addEventListener("dblclick", U), this.mouseEventListenerTracker.addUnregisterCallback((() => n.removeEventListener("mousemove", f))), this.mouseEventListenerTracker.addUnregisterCallback((() => n.removeEventListener("mousedown", v))), this.mouseEventListenerTracker.addUnregisterCallback((() => n.removeEventListener("mouseup", C))), this.mouseEventListenerTracker.addUnregisterCallback((() => n.removeEventListener("contextmenu", R))), this.mouseEventListenerTracker.addUnregisterCallback((() => n.removeEventListener("wheel", _))), this.mouseEventListenerTracker.addUnregisterCallback((() => n.removeEventListener("dblclick", U))), this.mouseEventListenerTracker.addUnregisterCallback((() => a.unregisterMouseEvents()));
|
|
15655
15670
|
}
|
|
15656
15671
|
registerMouseEnterAndLeaveEvents() {
|
|
@@ -15663,12 +15678,12 @@ class yw {
|
|
|
15663
15678
|
}
|
|
15664
15679
|
releaseMouseButtons(r, n, a) {
|
|
15665
15680
|
const f = this.coordinateConverter.normalizeAndQuantizeUnsigned(n, a);
|
|
15666
|
-
r &
|
|
15681
|
+
r & Qt.primaryButton && this.sendMouseUp(Wt.mainButton, f.x, f.y), r & Qt.secondaryButton && this.sendMouseUp(Wt.secondaryButton, f.x, f.y), r & Qt.auxiliaryButton && this.sendMouseUp(Wt.auxiliaryButton, f.x, f.y), r & Qt.fourthButton && this.sendMouseUp(Wt.fourthButton, f.x, f.y), r & Qt.fifthButton && this.sendMouseUp(Wt.fifthButton, f.x, f.y);
|
|
15667
15682
|
}
|
|
15668
15683
|
pressMouseButtons(r, n, a) {
|
|
15669
15684
|
if (!this.videoElementProvider.isVideoReady()) return;
|
|
15670
15685
|
const f = this.coordinateConverter.normalizeAndQuantizeUnsigned(n, a);
|
|
15671
|
-
r &
|
|
15686
|
+
r & Qt.primaryButton && this.sendMouseDown(Wt.mainButton, f.x, f.y), r & Qt.secondaryButton && this.sendMouseDown(Wt.secondaryButton, f.x, f.y), r & Qt.auxiliaryButton && this.sendMouseDown(Wt.auxiliaryButton, f.x, f.y), r & Qt.fourthButton && this.sendMouseDown(Wt.fourthButton, f.x, f.y), r & Qt.fifthButton && this.sendMouseDown(Wt.fifthButton, f.x, f.y);
|
|
15672
15687
|
}
|
|
15673
15688
|
sendMouseEnter() {
|
|
15674
15689
|
this.videoElementProvider.isVideoReady() && this.toStreamerMessagesProvider.toStreamerHandlers.get("MouseEnter")();
|
|
@@ -15686,7 +15701,7 @@ class yw {
|
|
|
15686
15701
|
this.toStreamerMessagesProvider.toStreamerHandlers.get("MouseUp")([r, f.x, f.y]);
|
|
15687
15702
|
}
|
|
15688
15703
|
}
|
|
15689
|
-
class
|
|
15704
|
+
class vw {
|
|
15690
15705
|
constructor(r, n, a) {
|
|
15691
15706
|
this.fingers = [9, 8, 7, 6, 5, 4, 3, 2, 1, 0], this.fingerIds = /* @__PURE__ */ new Map(), this.maxByteValue = 255, this.touchEventListenerTracker = new os(), this.toStreamerMessagesProvider = r, this.videoElementProvider = n, this.coordinateConverter = a, this.videoElementParent = n.getVideoElement();
|
|
15692
15707
|
const f = (_) => this.onTouchStart(_), v = (_) => this.onTouchEnd(_), C = (_) => this.onTouchMove(_);
|
|
@@ -15744,7 +15759,7 @@ class ww {
|
|
|
15744
15759
|
}
|
|
15745
15760
|
}
|
|
15746
15761
|
}
|
|
15747
|
-
class
|
|
15762
|
+
class _w {
|
|
15748
15763
|
constructor(r) {
|
|
15749
15764
|
this.gamePadEventListenerTracker = new os(), this.toStreamerMessagesProvider = r, this.requestAnimationFrame = (window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.requestAnimationFrame).bind(window);
|
|
15750
15765
|
const n = window;
|
|
@@ -15812,18 +15827,18 @@ class vw {
|
|
|
15812
15827
|
(function(c) {
|
|
15813
15828
|
c[c.RightClusterBottomButton = 0] = "RightClusterBottomButton", c[c.RightClusterRightButton = 1] = "RightClusterRightButton", c[c.RightClusterLeftButton = 2] = "RightClusterLeftButton", c[c.RightClusterTopButton = 3] = "RightClusterTopButton", c[c.LeftShoulder = 4] = "LeftShoulder", c[c.RightShoulder = 5] = "RightShoulder", c[c.LeftTrigger = 6] = "LeftTrigger", c[c.RightTrigger = 7] = "RightTrigger", c[c.SelectOrBack = 8] = "SelectOrBack", c[c.StartOrForward = 9] = "StartOrForward", c[c.LeftAnalogPress = 10] = "LeftAnalogPress", c[c.RightAnalogPress = 11] = "RightAnalogPress", c[c.LeftClusterTopButton = 12] = "LeftClusterTopButton", c[c.LeftClusterBottomButton = 13] = "LeftClusterBottomButton", c[c.LeftClusterLeftButton = 14] = "LeftClusterLeftButton", c[c.LeftClusterRightButton = 15] = "LeftClusterRightButton", c[c.CentreButton = 16] = "CentreButton", c[c.LeftStickHorizontal = 0] = "LeftStickHorizontal", c[c.LeftStickVertical = 1] = "LeftStickVertical", c[c.RightStickHorizontal = 2] = "RightStickHorizontal", c[c.RightStickVertical = 3] = "RightStickVertical";
|
|
15814
15829
|
})(is || (is = {}));
|
|
15815
|
-
class
|
|
15830
|
+
class bw {
|
|
15816
15831
|
constructor(r, n, a) {
|
|
15817
|
-
this.activeKeys = new
|
|
15832
|
+
this.activeKeys = new Sw(), this.toStreamerMessagesProvider = r, this.videoElementProvider = n, this.coordinateConverter = a;
|
|
15818
15833
|
}
|
|
15819
15834
|
registerKeyBoard(r) {
|
|
15820
15835
|
T.Log(T.GetStackTrace(), "Register Keyboard Events", 7);
|
|
15821
|
-
const n = new
|
|
15836
|
+
const n = new mw(this.toStreamerMessagesProvider, r, this.activeKeys);
|
|
15822
15837
|
return n.registerKeyBoardEvents(), n;
|
|
15823
15838
|
}
|
|
15824
15839
|
registerMouse(r) {
|
|
15825
15840
|
T.Log(T.GetStackTrace(), "Register Mouse Events", 7);
|
|
15826
|
-
const n = new
|
|
15841
|
+
const n = new ww(this.toStreamerMessagesProvider, this.videoElementProvider, this.coordinateConverter, this.activeKeys);
|
|
15827
15842
|
switch (r) {
|
|
15828
15843
|
case Nn.LockedMouse:
|
|
15829
15844
|
n.registerLockedMouseEvents(n);
|
|
@@ -15838,16 +15853,16 @@ class _w {
|
|
|
15838
15853
|
}
|
|
15839
15854
|
registerTouch(r, n) {
|
|
15840
15855
|
if (T.Log(T.GetStackTrace(), "Registering Touch", 6), r) {
|
|
15841
|
-
const a = new
|
|
15856
|
+
const a = new pw(this.toStreamerMessagesProvider, this.videoElementProvider, this.coordinateConverter);
|
|
15842
15857
|
return a.setVideoElementParentClientRect(n), a;
|
|
15843
15858
|
}
|
|
15844
|
-
return new
|
|
15859
|
+
return new vw(this.toStreamerMessagesProvider, this.videoElementProvider, this.coordinateConverter);
|
|
15845
15860
|
}
|
|
15846
15861
|
registerGamePad() {
|
|
15847
|
-
return T.Log(T.GetStackTrace(), "Register Game Pad", 7), new
|
|
15862
|
+
return T.Log(T.GetStackTrace(), "Register Game Pad", 7), new _w(this.toStreamerMessagesProvider);
|
|
15848
15863
|
}
|
|
15849
15864
|
}
|
|
15850
|
-
class
|
|
15865
|
+
class Sw {
|
|
15851
15866
|
constructor() {
|
|
15852
15867
|
this.activeKeys = [], this.activeKeys = [];
|
|
15853
15868
|
}
|
|
@@ -15855,7 +15870,7 @@ class bw {
|
|
|
15855
15870
|
return this.activeKeys;
|
|
15856
15871
|
}
|
|
15857
15872
|
}
|
|
15858
|
-
class
|
|
15873
|
+
class Tw {
|
|
15859
15874
|
constructor(r, n) {
|
|
15860
15875
|
this.lastTimeResized = (/* @__PURE__ */ new Date()).getTime(), this.videoElement = document.createElement("video"), this.config = n, this.videoElement.id = "streamingVideo", this.videoElement.disablePictureInPicture = !0, this.videoElement.playsInline = !0, this.videoElement.style.width = "100%", this.videoElement.style.height = "100%", this.videoElement.style.position = "absolute", this.videoElement.style.pointerEvents = "all", r.appendChild(this.videoElement), this.onResizePlayerCallback = () => {
|
|
15861
15876
|
console.log("Resolution changed, restyling player, did you forget to override this function?");
|
|
@@ -15913,7 +15928,7 @@ class Sw {
|
|
|
15913
15928
|
} else T.Log(T.GetStackTrace(), "Resizing too often - skipping", 6), clearTimeout(this.resizeTimeoutHandle), this.resizeTimeoutHandle = window.setTimeout((() => this.updateVideoStreamSize()), 100);
|
|
15914
15929
|
}
|
|
15915
15930
|
}
|
|
15916
|
-
class
|
|
15931
|
+
class $w {
|
|
15917
15932
|
constructor() {
|
|
15918
15933
|
this.toStreamerHandlers = /* @__PURE__ */ new Map(), this.fromStreamerHandlers = /* @__PURE__ */ new Map(), this.toStreamerMessages = /* @__PURE__ */ new Map(), this.fromStreamerMessages = /* @__PURE__ */ new Map();
|
|
15919
15934
|
}
|
|
@@ -15936,7 +15951,7 @@ class Tw {
|
|
|
15936
15951
|
(function(c) {
|
|
15937
15952
|
c[c.ToStreamer = 0] = "ToStreamer", c[c.FromStreamer = 1] = "FromStreamer";
|
|
15938
15953
|
})(Se || (Se = {}));
|
|
15939
|
-
class
|
|
15954
|
+
class xw {
|
|
15940
15955
|
constructor() {
|
|
15941
15956
|
this.responseEventListeners = /* @__PURE__ */ new Map();
|
|
15942
15957
|
}
|
|
@@ -15954,7 +15969,7 @@ class $w {
|
|
|
15954
15969
|
}));
|
|
15955
15970
|
}
|
|
15956
15971
|
}
|
|
15957
|
-
class
|
|
15972
|
+
class Ew {
|
|
15958
15973
|
constructor(r, n) {
|
|
15959
15974
|
this.dataChannelSender = r, this.toStreamerMessagesMapProvider = n;
|
|
15960
15975
|
}
|
|
@@ -16022,7 +16037,7 @@ class xw {
|
|
|
16022
16037
|
})), this.dataChannelSender.canSend() ? this.dataChannelSender.sendData(C.buffer) : T.Info(T.GetStackTrace(), `Data channel cannot send yet, skipping sending message: ${r} - ${new Uint8Array(C.buffer)}`);
|
|
16023
16038
|
}
|
|
16024
16039
|
}
|
|
16025
|
-
class
|
|
16040
|
+
class Cw {
|
|
16026
16041
|
constructor(r) {
|
|
16027
16042
|
this.sendMessageController = r;
|
|
16028
16043
|
}
|
|
@@ -16045,7 +16060,7 @@ class Ew {
|
|
|
16045
16060
|
this.sendMessageController.sendMessageToStreamer("RequestInitialSettings");
|
|
16046
16061
|
}
|
|
16047
16062
|
}
|
|
16048
|
-
class
|
|
16063
|
+
class kw {
|
|
16049
16064
|
constructor(r) {
|
|
16050
16065
|
this.dataChannelProvider = r;
|
|
16051
16066
|
}
|
|
@@ -16059,7 +16074,7 @@ class Cw {
|
|
|
16059
16074
|
resetAfkWarningTimerOnDataSend() {
|
|
16060
16075
|
}
|
|
16061
16076
|
}
|
|
16062
|
-
class
|
|
16077
|
+
class Rw {
|
|
16063
16078
|
constructor(r) {
|
|
16064
16079
|
this.videoElementProvider = r, this.normalizeAndQuantizeUnsignedFunc = () => {
|
|
16065
16080
|
throw new Error("Normalize and quantize unsigned, method not implemented.");
|
|
@@ -16126,14 +16141,14 @@ class Xp {
|
|
|
16126
16141
|
}
|
|
16127
16142
|
class gm {
|
|
16128
16143
|
constructor(r, n) {
|
|
16129
|
-
this.shouldShowPlayOverlay = !0, this.autoJoinTimer = void 0, this.config = r, this.pixelStreaming = n, this.responseController = new
|
|
16144
|
+
this.shouldShowPlayOverlay = !0, this.autoJoinTimer = void 0, this.config = r, this.pixelStreaming = n, this.responseController = new xw(), this.file = new hw(), this.sdpConstraints = { offerToReceiveAudio: !0, offerToReceiveVideo: !0 }, this.afkController = new im(this.config, this.pixelStreaming, this.onAfkTriggered.bind(this)), this.afkController.onAFKTimedOutCallback = () => {
|
|
16130
16145
|
this.closeSignalingServer("You have been disconnected due to inactivity");
|
|
16131
|
-
}, this.freezeFrameController = new
|
|
16146
|
+
}, this.freezeFrameController = new ew(this.pixelStreaming.videoElementParent), this.videoPlayer = new Tw(this.pixelStreaming.videoElementParent, this.config), this.videoPlayer.onVideoInitialized = () => this.handleVideoInitialized(), this.videoPlayer.onMatchViewportResolutionCallback = (a, f) => {
|
|
16132
16147
|
const v = { "Resolution.Width": a, "Resolution.Height": f };
|
|
16133
16148
|
this.streamMessageController.toStreamerHandlers.get("Command")([JSON.stringify(v)]);
|
|
16134
16149
|
}, this.videoPlayer.onResizePlayerCallback = () => {
|
|
16135
16150
|
this.setUpMouseAndFreezeFrame();
|
|
16136
|
-
}, this.streamController = new
|
|
16151
|
+
}, this.streamController = new Jy(this.videoPlayer), this.coordinateConverter = new Rw(this.videoPlayer), this.sendrecvDataChannelController = new jp(), this.recvDataChannelController = new jp(), this.registerDataChannelEventEmitters(this.sendrecvDataChannelController), this.registerDataChannelEventEmitters(this.recvDataChannelController), this.dataChannelSender = new kw(this.sendrecvDataChannelController), this.dataChannelSender.resetAfkWarningTimerOnDataSend = () => this.afkController.resetAfkWarningTimer(), this.streamMessageController = new $w(), this.webSocketController = new $f(), this.webSocketController.onConfig = (a) => this.handleOnConfigMessage(a), this.webSocketController.onStreamerList = (a) => this.handleStreamerListMessage(a), this.webSocketController.onStreamerIDChanged = (a) => this.handleStreamerIDChangedMessage(a), this.webSocketController.onPlayerCount = (a) => {
|
|
16137
16152
|
this.pixelStreaming._onPlayerCount(a.count);
|
|
16138
16153
|
}, this.webSocketController.onOpen.addEventListener("open", (() => {
|
|
16139
16154
|
this.config.isFlagEnabled(K.BrowserSendOffer) || this.webSocketController.requestStreamerList();
|
|
@@ -16142,7 +16157,7 @@ class gm {
|
|
|
16142
16157
|
this.pixelStreaming._onDisconnect(v, !f && !this.isReconnecting), this.afkController.stopAfkWarningTimer(), this.statsTimerHandle && this.statsTimerHandle !== void 0 && window.clearInterval(this.statsTimerHandle), this.setVideoEncoderAvgQP(0), this.setTouchInputEnabled(!1), this.setMouseInputEnabled(!1), this.setKeyboardInputEnabled(!1), this.setGamePadInputEnabled(!1), f && setTimeout((() => {
|
|
16143
16158
|
this.isReconnecting = !0, this.reconnectAttempt++, this.tryReconnect(a.detail.reason);
|
|
16144
16159
|
}), 2e3);
|
|
16145
|
-
})), this.sendMessageController = new
|
|
16160
|
+
})), this.sendMessageController = new Ew(this.dataChannelSender, this.streamMessageController), this.toStreamerMessagesController = new Cw(this.sendMessageController), this.registerMessageHandlers(), this.streamMessageController.populateDefaultProtocol(), this.inputClassesFactory = new bw(this.streamMessageController, this.videoPlayer, this.coordinateConverter), this.isUsingSFU = !1, this.isQualityController = !1, this.preferredCodec = "", this.shouldReconnect = !0, this.isReconnecting = !1, this.reconnectAttempt = 0, this.config._addOnOptionSettingChangedListener(St.StreamerId, ((a) => {
|
|
16146
16161
|
a !== "" && (this.peerConnectionController.peerConnection.close(), this.peerConnectionController.createPeerConnection(this.peerConfig, this.preferredCodec), this.subscribedStream = a, this.webSocketController.sendSubscribe(a));
|
|
16147
16162
|
})), this.setVideoEncoderAvgQP(-1), this.signallingUrlBuilder = () => {
|
|
16148
16163
|
let a = this.config.getTextSettingValue(Hr.SignallingServerUrl);
|
|
@@ -16281,7 +16296,7 @@ class gm {
|
|
|
16281
16296
|
}
|
|
16282
16297
|
startSession(r) {
|
|
16283
16298
|
if (this.peerConfig = r, this.config.isFlagEnabled(K.ForceTURN) && !this.checkTurnServerAvailability(r)) return T.Info(T.GetStackTrace(), "No turn server was found in the Peer Connection Options. TURN cannot be forced, closing connection. Please use STUN instead"), void this.closeSignalingServer("TURN cannot be forced, closing connection. Please use STUN instead.");
|
|
16284
|
-
this.peerConnectionController = new
|
|
16299
|
+
this.peerConnectionController = new dw(this.peerConfig, this.config, this.preferredCodec), this.peerConnectionController.onVideoStats = (a) => this.handleVideoStats(a), this.peerConnectionController.onSendWebRTCOffer = (a) => this.handleSendWebRTCOffer(a), this.peerConnectionController.onSendWebRTCAnswer = (a) => this.handleSendWebRTCAnswer(a), this.peerConnectionController.onPeerIceCandidate = (a) => this.handleSendIceCandidate(a), this.peerConnectionController.onDataChannel = (a) => this.handleDataChannel(a), this.peerConnectionController.showTextOverlayConnecting = () => this.pixelStreaming._onWebRtcConnecting(), this.peerConnectionController.showTextOverlaySetupFailure = () => this.pixelStreaming._onWebRtcFailed();
|
|
16285
16300
|
let n = !1;
|
|
16286
16301
|
this.peerConnectionController.onIceConnectionStateChange = () => {
|
|
16287
16302
|
!n && ["connected", "completed"].includes(this.peerConnectionController.peerConnection.iceConnectionState) && (this.pixelStreaming._onWebRtcConnected(), n = !0);
|
|
@@ -16627,7 +16642,7 @@ class ym {
|
|
|
16627
16642
|
return location.protocol !== "https:" && T.Info(null, "WebXR requires https, if you want WebXR use https."), navigator.xr ? navigator.xr.isSessionSupported(r) : new Promise((() => !1));
|
|
16628
16643
|
}
|
|
16629
16644
|
}
|
|
16630
|
-
class
|
|
16645
|
+
class Aw {
|
|
16631
16646
|
constructor(r) {
|
|
16632
16647
|
this.editTextButton = null, this.hiddenInput = null, "ontouchstart" in document.documentElement && this.createOnScreenKeyboardHelpers(r);
|
|
16633
16648
|
}
|
|
@@ -16647,7 +16662,7 @@ class Rw {
|
|
|
16647
16662
|
} else this.editTextButton.style.display = "none", this.hiddenInput.blur();
|
|
16648
16663
|
}
|
|
16649
16664
|
}
|
|
16650
|
-
class
|
|
16665
|
+
class Mw {
|
|
16651
16666
|
constructor(r) {
|
|
16652
16667
|
this.seq = r.Seq, this.playerSentTimestamp = Date.now(), this.requestFillerSize = r.Filler ? r.Filler.length : 0;
|
|
16653
16668
|
}
|
|
@@ -16655,7 +16670,7 @@ class Aw {
|
|
|
16655
16670
|
this.playerReceivedTimestamp = Date.now(), this.streamerReceivedTimestamp = r.ReceivedTimestamp, this.streamerSentTimestamp = r.SentTimestamp, this.responseFillerSize = r.Filler ? r.Filler.length : 0;
|
|
16656
16671
|
}
|
|
16657
16672
|
}
|
|
16658
|
-
class
|
|
16673
|
+
class Iw {
|
|
16659
16674
|
constructor(r, n) {
|
|
16660
16675
|
this.sink = r, this.callback = n, this.records = /* @__PURE__ */ new Map(), this.seq = 0;
|
|
16661
16676
|
}
|
|
@@ -16688,16 +16703,16 @@ class Mw {
|
|
|
16688
16703
|
n && n.update(r);
|
|
16689
16704
|
}
|
|
16690
16705
|
sendRequest(r, n) {
|
|
16691
|
-
let a = this.createRequest(r, n), f = new
|
|
16706
|
+
let a = this.createRequest(r, n), f = new Mw(a);
|
|
16692
16707
|
this.records.set(f.seq, f), this.sink(a);
|
|
16693
16708
|
}
|
|
16694
16709
|
createRequest(r, n) {
|
|
16695
16710
|
return { Seq: this.seq++, FillResponseSize: n, Filler: r ? "A".repeat(r) : "" };
|
|
16696
16711
|
}
|
|
16697
16712
|
}
|
|
16698
|
-
class
|
|
16713
|
+
class Pw {
|
|
16699
16714
|
constructor(r, n) {
|
|
16700
|
-
this.allowConsoleCommands = !1, this.config = r, n?.videoElementParent && (this._videoElementParent = n.videoElementParent), this._eventEmitter = new sm(), this.configureSettings(), this.setWebRtcPlayerController(new gm(this.config, this)), this.onScreenKeyboardHelper = new
|
|
16715
|
+
this.allowConsoleCommands = !1, this.config = r, n?.videoElementParent && (this._videoElementParent = n.videoElementParent), this._eventEmitter = new sm(), this.configureSettings(), this.setWebRtcPlayerController(new gm(this.config, this)), this.onScreenKeyboardHelper = new Aw(this.videoElementParent), this.onScreenKeyboardHelper.unquantizeAndDenormalizeUnsigned = (a, f) => this._webRtcController.requestUnquantizedAndDenormalizeUnsigned(a, f), this._activateOnScreenKeyboard = (a) => this.onScreenKeyboardHelper.showOnScreenKeyboard(a), this._webXrController = new ym(this._webRtcController), this._setupWebRtcTCPRelayDetection = this._setupWebRtcTCPRelayDetection.bind(this), this._eventEmitter.addEventListener("webRtcConnected", ((a) => {
|
|
16701
16716
|
this._eventEmitter.addEventListener("statsReceived", this._setupWebRtcTCPRelayDetection);
|
|
16702
16717
|
}));
|
|
16703
16718
|
}
|
|
@@ -16831,7 +16846,7 @@ class Iw {
|
|
|
16831
16846
|
return !!this._webRtcController.videoPlayer.isVideoReady() && (this._webRtcController.sendLatencyTest(), !0);
|
|
16832
16847
|
}
|
|
16833
16848
|
requestDataChannelLatencyTest(r) {
|
|
16834
|
-
return !!this._webRtcController.videoPlayer.isVideoReady() && (this._dataChannelLatencyTestController || (this._dataChannelLatencyTestController = new
|
|
16849
|
+
return !!this._webRtcController.videoPlayer.isVideoReady() && (this._dataChannelLatencyTestController || (this._dataChannelLatencyTestController = new Iw(this._webRtcController.sendDataChannelLatencyTest.bind(this._webRtcController), ((n) => {
|
|
16835
16850
|
this._eventEmitter.dispatchEvent(new Zf({ result: n }));
|
|
16836
16851
|
})), this.addEventListener("dataChannelLatencyTestResponse", (({ data: { response: n } }) => {
|
|
16837
16852
|
this._dataChannelLatencyTestController.receive(n);
|
|
@@ -16889,7 +16904,7 @@ class Iw {
|
|
|
16889
16904
|
return this._webRtcController.isReconnecting;
|
|
16890
16905
|
}
|
|
16891
16906
|
}
|
|
16892
|
-
class
|
|
16907
|
+
class Ow {
|
|
16893
16908
|
}
|
|
16894
16909
|
be.Dz;
|
|
16895
16910
|
be.g$;
|
|
@@ -16899,7 +16914,7 @@ be.qf;
|
|
|
16899
16914
|
be.hV;
|
|
16900
16915
|
be.z$;
|
|
16901
16916
|
be.J0;
|
|
16902
|
-
var
|
|
16917
|
+
var zw = be.De;
|
|
16903
16918
|
be.$C;
|
|
16904
16919
|
be.al;
|
|
16905
16920
|
be._W;
|
|
@@ -16926,7 +16941,7 @@ be.ce;
|
|
|
16926
16941
|
be.sK;
|
|
16927
16942
|
be.Ok;
|
|
16928
16943
|
be.q5;
|
|
16929
|
-
var
|
|
16944
|
+
var Dw = be.g;
|
|
16930
16945
|
be.xl;
|
|
16931
16946
|
be.I;
|
|
16932
16947
|
be.bx;
|
|
@@ -16963,7 +16978,7 @@ be.$f;
|
|
|
16963
16978
|
be.eu;
|
|
16964
16979
|
be.Ax;
|
|
16965
16980
|
be.Mc;
|
|
16966
|
-
const
|
|
16981
|
+
const Lw = ({
|
|
16967
16982
|
signallingUrl: c,
|
|
16968
16983
|
autoConnect: r = !0,
|
|
16969
16984
|
width: n,
|
|
@@ -16975,14 +16990,14 @@ const Dw = ({
|
|
|
16975
16990
|
onError: _,
|
|
16976
16991
|
muted: U = !1
|
|
16977
16992
|
}) => {
|
|
16978
|
-
const B =
|
|
16993
|
+
const B = Et(null), te = Et(null), X = Et(!1), [ee, ie] = jr(!1), [de, le] = jr(!1), [Le, Ce] = jr(null);
|
|
16979
16994
|
return xr(() => {
|
|
16980
16995
|
if (!(!B.current || !c)) {
|
|
16981
16996
|
f && f(), console.log("🎮 Initializing Epic Pixel Streaming with URL:", c), navigator.mediaDevices || (navigator.mediaDevices = {}), navigator.mediaDevices.getUserMedia || (navigator.mediaDevices.getUserMedia = function() {
|
|
16982
16997
|
return Promise.reject(new Error("getUserMedia is not supported"));
|
|
16983
16998
|
});
|
|
16984
16999
|
try {
|
|
16985
|
-
const ce = new
|
|
17000
|
+
const ce = new zw({
|
|
16986
17001
|
useUrlParams: !1,
|
|
16987
17002
|
initialSettings: {
|
|
16988
17003
|
ss: c,
|
|
@@ -17004,7 +17019,7 @@ const Dw = ({
|
|
|
17004
17019
|
WaitForStreamer: !0
|
|
17005
17020
|
// Wait and auto-subscribe when streamer becomes available
|
|
17006
17021
|
}
|
|
17007
|
-
}), re = new
|
|
17022
|
+
}), re = new Dw(ce, {
|
|
17008
17023
|
videoElementParent: B.current
|
|
17009
17024
|
});
|
|
17010
17025
|
re.addEventListener("webRtcConnected", () => {
|
|
@@ -17067,7 +17082,7 @@ const Dw = ({
|
|
|
17067
17082
|
} catch (ce) {
|
|
17068
17083
|
console.error("Error controlling audio:", ce);
|
|
17069
17084
|
}
|
|
17070
|
-
}, [U]), /* @__PURE__ */
|
|
17085
|
+
}, [U]), /* @__PURE__ */ lr.jsxs(
|
|
17071
17086
|
"div",
|
|
17072
17087
|
{
|
|
17073
17088
|
className: "pixel-streaming-container",
|
|
@@ -17086,7 +17101,7 @@ const Dw = ({
|
|
|
17086
17101
|
userSelect: "none"
|
|
17087
17102
|
},
|
|
17088
17103
|
children: [
|
|
17089
|
-
/* @__PURE__ */
|
|
17104
|
+
/* @__PURE__ */ lr.jsx(
|
|
17090
17105
|
"div",
|
|
17091
17106
|
{
|
|
17092
17107
|
ref: B,
|
|
@@ -17102,16 +17117,16 @@ const Dw = ({
|
|
|
17102
17117
|
}
|
|
17103
17118
|
}
|
|
17104
17119
|
),
|
|
17105
|
-
de && /* @__PURE__ */
|
|
17106
|
-
/* @__PURE__ */
|
|
17107
|
-
/* @__PURE__ */
|
|
17120
|
+
de && /* @__PURE__ */ lr.jsxs("div", { className: "loading-overlay", children: [
|
|
17121
|
+
/* @__PURE__ */ lr.jsx("div", { className: "loading-spinner" }),
|
|
17122
|
+
/* @__PURE__ */ lr.jsx("div", { className: "loading-text", children: "Connecting to stream..." })
|
|
17108
17123
|
] }),
|
|
17109
|
-
!ee && !de && Le && /* @__PURE__ */
|
|
17124
|
+
!ee && !de && Le && /* @__PURE__ */ lr.jsx("div", { className: "connection-overlay", children: /* @__PURE__ */ lr.jsx("div", { className: "error-message", children: Le }) })
|
|
17110
17125
|
]
|
|
17111
17126
|
}
|
|
17112
17127
|
);
|
|
17113
17128
|
};
|
|
17114
|
-
function
|
|
17129
|
+
function jw({
|
|
17115
17130
|
className: c,
|
|
17116
17131
|
style: r,
|
|
17117
17132
|
autoConnect: n = !0,
|
|
@@ -17120,22 +17135,22 @@ function Hw({
|
|
|
17120
17135
|
onDisconnected: v,
|
|
17121
17136
|
onError: C
|
|
17122
17137
|
}) {
|
|
17123
|
-
const { streamingUrl: R, setCloudStreamState: _ } =
|
|
17138
|
+
const { streamingUrl: R, setCloudStreamState: _ } = Ny();
|
|
17124
17139
|
if (!R)
|
|
17125
17140
|
return null;
|
|
17126
17141
|
const U = () => {
|
|
17127
|
-
_(
|
|
17142
|
+
_(rr.CONNECTING);
|
|
17128
17143
|
}, B = () => {
|
|
17129
|
-
_(
|
|
17144
|
+
_(rr.LOADING);
|
|
17130
17145
|
}, te = () => {
|
|
17131
|
-
_(
|
|
17146
|
+
_(rr.CONNECTED), f?.();
|
|
17132
17147
|
}, X = () => {
|
|
17133
|
-
_(
|
|
17148
|
+
_(rr.DISCONNECTED), v?.();
|
|
17134
17149
|
}, ee = (ie) => {
|
|
17135
|
-
_(
|
|
17150
|
+
_(rr.ERROR, ie), C?.(ie);
|
|
17136
17151
|
};
|
|
17137
|
-
return /* @__PURE__ */
|
|
17138
|
-
|
|
17152
|
+
return /* @__PURE__ */ lr.jsx("div", { className: c, style: r, children: /* @__PURE__ */ lr.jsx(
|
|
17153
|
+
Lw,
|
|
17139
17154
|
{
|
|
17140
17155
|
signallingUrl: R,
|
|
17141
17156
|
autoConnect: n,
|
|
@@ -17150,21 +17165,21 @@ function Hw({
|
|
|
17150
17165
|
}
|
|
17151
17166
|
export {
|
|
17152
17167
|
sn as AGENT_TYPES,
|
|
17153
|
-
|
|
17168
|
+
rr as CLOUD_STREAM_STATE,
|
|
17154
17169
|
Vt as CONNECTION_STATE,
|
|
17155
|
-
|
|
17156
|
-
|
|
17157
|
-
|
|
17158
|
-
|
|
17170
|
+
Lw as EpicPixelStreamingPlayer,
|
|
17171
|
+
_y as RqmiiAgentProvider,
|
|
17172
|
+
Hw as RqmiiAgentRoom,
|
|
17173
|
+
jw as RqmiiCloudAvatarPlayer,
|
|
17159
17174
|
lt as SOCKET_EVENTS,
|
|
17160
|
-
|
|
17175
|
+
Vw as useRqmiiAgent,
|
|
17161
17176
|
on as useRqmiiAgentContext,
|
|
17162
|
-
|
|
17163
|
-
|
|
17164
|
-
|
|
17165
|
-
|
|
17166
|
-
|
|
17167
|
-
|
|
17168
|
-
|
|
17177
|
+
Ww as useRqmiiAudioElement,
|
|
17178
|
+
Ny as useRqmiiAvatar,
|
|
17179
|
+
By as useRqmiiConnection,
|
|
17180
|
+
Gw as useRqmiiMessages,
|
|
17181
|
+
Uw as useRqmiiPressToTalk,
|
|
17182
|
+
Fw as useRqmiiVAD,
|
|
17183
|
+
qw as useRqmiiVoice
|
|
17169
17184
|
};
|
|
17170
17185
|
//# sourceMappingURL=rqmii-react-agent-sdk.js.map
|