@vincentt-xr/sdk 2.0.0-alpha.20 → 2.0.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components.json +1 -1
- package/dist/main.cjs +1 -1
- package/dist/main.js +415 -408
- package/package.json +1 -1
- package/settings.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2,60 +2,60 @@ var Be = Object.defineProperty;
|
|
|
2
2
|
var $e = (e, t, r) => t in e ? Be(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
3
|
var D = (e, t, r) => $e(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
4
|
import { j as _, J as Xe, u as He, as as Ke, at as je, au as Ve, av as Ze, aw as Ye, ax as Je } from "./index-BDxJWWyy.js";
|
|
5
|
-
import { b8 as bs, az as
|
|
5
|
+
import { b8 as bs, az as As, b9 as Rs, M as Fs, P as xs, L as Cs, w as _s, ay as ks, ba as vs, b5 as ws, b6 as Ds, aA as Us, c as Ns, z as Ps, y as Ls, d as Is, k as Os, aR as Gs, aS as zs, aT as qs, aU as Ws, n as Bs, aV as $s, i as Xs, aB as Hs, O as Ks, aW as js, aC as Vs, aD as Zs, aX as Ys, aY as Js, b3 as Qs, p as ea, A as ta, b7 as ra, r as sa, K as aa, a3 as na, aI as oa, aZ as ia, aJ as ca, aK as la, aL as ua, aH as da, aM as ma, aN as fa, aE as pa, aO as ha, a_ as ga, b4 as ya, aP as Sa, a$ as Ta, t as Ma, aF as Ea, aG as ba, b0 as Aa, b1 as Ra, aQ as Fa, b2 as xa } from "./index-BDxJWWyy.js";
|
|
6
6
|
import { S as Qe } from "./contexts-Cl-4dUOI.js";
|
|
7
7
|
import { X as _a } from "./contexts-Cl-4dUOI.js";
|
|
8
8
|
import { S as va, T as wa } from "./TextLabel-fEF1o3wE.js";
|
|
9
|
-
import { jsxs as
|
|
10
|
-
import { useRef as
|
|
9
|
+
import { jsxs as z, jsx as y, Fragment as ne } from "react/jsx-runtime";
|
|
10
|
+
import { useRef as R, useMemo as W, useEffect as x, useState as k, Suspense as et, useCallback as F, forwardRef as tt, useImperativeHandle as rt, useContext as st, createContext as at, useId as nt, useSyncExternalStore as ot } from "react";
|
|
11
11
|
import * as de from "three";
|
|
12
12
|
import { MathUtils as it, Vector2 as ct, Vector3 as lt, DoubleSide as se, RepeatWrapping as Ee, LinearFilter as be } from "three";
|
|
13
|
-
import { D as
|
|
14
|
-
import { useThree as ut, useFrame as
|
|
13
|
+
import { D as Ua, H as Na, G as Pa, E as La, J as Ia, K as Oa, P as Ga, S as za, C as qa, I as Wa, L as Ba, M as $a, F as Xa, B as Ha } from "./index-D5NbXaCn.js";
|
|
14
|
+
import { useThree as ut, useFrame as Ue } from "@react-three/fiber";
|
|
15
15
|
import { R as dt } from "./uv-DJU_XfmN.js";
|
|
16
|
-
import { c as
|
|
16
|
+
import { c as Ne, b as mt } from "./selectors-J06V0eDb.js";
|
|
17
17
|
import { u as ft, a as pt, s as ht, F as gt } from "./drawNormalizedCrop-D606u5-F.js";
|
|
18
18
|
import { d as ja, b as Va, r as Za } from "./drawNormalizedCrop-D606u5-F.js";
|
|
19
|
-
import { S as yt, c as St, D as
|
|
19
|
+
import { S as yt, c as St, D as O, L as Tt } from "./index-CM3jkleV.js";
|
|
20
20
|
import { d as Ja, R as Qa, a as en, e as tn, b as rn, f as sn } from "./index-CM3jkleV.js";
|
|
21
21
|
import { g as Mt } from "./Scenes-icIQpHtV.js";
|
|
22
22
|
import { a as nn, b as on, u as cn } from "./Scenes-icIQpHtV.js";
|
|
23
23
|
import { useTexture as Et } from "@react-three/drei";
|
|
24
24
|
import { a as bt } from "./context-DTxSQvp4.js";
|
|
25
|
-
import { j as
|
|
25
|
+
import { j as V, T as At } from "./renderPasses-C0wu5Cwg.js";
|
|
26
26
|
import { k as un, D as dn, E as mn, M as fn, h as pn, S as hn, l as gn, g as yn, n as Sn, r as Tn } from "./renderPasses-C0wu5Cwg.js";
|
|
27
|
-
import { D as
|
|
27
|
+
import { D as Ae, M as Rt } from "./index-Bn72laBn.js";
|
|
28
28
|
import { c as En, n as bn } from "./index-Bn72laBn.js";
|
|
29
|
-
import { M as
|
|
30
|
-
import { u as
|
|
31
|
-
import { g as
|
|
29
|
+
import { M as Rn } from "./index-CbBCl2ZU.js";
|
|
30
|
+
import { u as xn } from "./useXRCapabilities-DPUOvpdf.js";
|
|
31
|
+
import { g as Pe } from "./cache-Mu-VO_6E.js";
|
|
32
32
|
import { D as _n, X as kn, c as vn, u as wn } from "./cache-Mu-VO_6E.js";
|
|
33
33
|
import { a as Ft } from "./segmentation-DccvYBBO.js";
|
|
34
|
-
import { d as
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
import { d as Un, b as Nn, e as Pn, f as Ln, g as In, h as On, i as Gn } from "./segmentation-DccvYBBO.js";
|
|
35
|
+
const ee = (e, t, r, s) => it.damp(e, t, Math.max(0, r), Math.max(0, s)), Or = (e, t, r, s, a = new ct()) => a.set(
|
|
36
|
+
ee(e.x, t.x, r, s),
|
|
37
|
+
ee(e.y, t.y, r, s)
|
|
38
38
|
), Gr = (e, t, r, s, a = new lt()) => a.set(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
),
|
|
39
|
+
ee(e.x, t.x, r, s),
|
|
40
|
+
ee(e.y, t.y, r, s),
|
|
41
|
+
ee(e.z, t.z, r, s)
|
|
42
|
+
), xt = "rgba(20,40,110,0.88)", Ct = 24, _t = 512;
|
|
43
43
|
function zr({
|
|
44
|
-
color: e =
|
|
44
|
+
color: e = xt,
|
|
45
45
|
borderColor: t,
|
|
46
46
|
borderWidth: r = 0,
|
|
47
|
-
borderRadius: s =
|
|
47
|
+
borderRadius: s = Ct,
|
|
48
48
|
resolution: a = _t,
|
|
49
49
|
aspect: n = 1,
|
|
50
|
-
opacity:
|
|
50
|
+
opacity: i = 1,
|
|
51
51
|
name: c,
|
|
52
|
-
overlay:
|
|
52
|
+
overlay: o = !0,
|
|
53
53
|
position: l,
|
|
54
|
-
rotation:
|
|
54
|
+
rotation: p,
|
|
55
55
|
scale: m,
|
|
56
56
|
visible: f
|
|
57
57
|
}) {
|
|
58
|
-
const u =
|
|
58
|
+
const u = R(null), d = R(null), g = W(() => kt({
|
|
59
59
|
width: Math.round(a * Math.max(n, 0.05)),
|
|
60
60
|
height: Math.round(a),
|
|
61
61
|
color: e,
|
|
@@ -66,22 +66,22 @@ function zr({
|
|
|
66
66
|
x(() => () => {
|
|
67
67
|
g.dispose();
|
|
68
68
|
}, [g]);
|
|
69
|
-
const
|
|
70
|
-
return
|
|
69
|
+
const M = R(null), h = R(i);
|
|
70
|
+
return h.current !== i && (h.current = i, M.current = null, d.current && (d.current.opacity = i)), x(() => {
|
|
71
71
|
const S = u.current;
|
|
72
72
|
if (S)
|
|
73
|
-
return S.userData.setOpacity = (
|
|
74
|
-
|
|
73
|
+
return S.userData.setOpacity = (b) => {
|
|
74
|
+
M.current = b, d.current && (d.current.opacity = b);
|
|
75
75
|
}, () => {
|
|
76
76
|
delete S.userData.setOpacity;
|
|
77
77
|
};
|
|
78
|
-
}, []), /* @__PURE__ */
|
|
78
|
+
}, []), /* @__PURE__ */ z(
|
|
79
79
|
"mesh",
|
|
80
80
|
{
|
|
81
81
|
ref: u,
|
|
82
82
|
name: c,
|
|
83
83
|
position: l,
|
|
84
|
-
rotation:
|
|
84
|
+
rotation: p,
|
|
85
85
|
scale: m,
|
|
86
86
|
visible: f,
|
|
87
87
|
children: [
|
|
@@ -92,9 +92,9 @@ function zr({
|
|
|
92
92
|
ref: d,
|
|
93
93
|
map: g,
|
|
94
94
|
transparent: !0,
|
|
95
|
-
opacity:
|
|
96
|
-
depthTest: !
|
|
97
|
-
depthWrite: !
|
|
95
|
+
opacity: i,
|
|
96
|
+
depthTest: !o,
|
|
97
|
+
depthWrite: !o
|
|
98
98
|
}
|
|
99
99
|
)
|
|
100
100
|
]
|
|
@@ -102,15 +102,15 @@ function zr({
|
|
|
102
102
|
);
|
|
103
103
|
}
|
|
104
104
|
function kt(e) {
|
|
105
|
-
const { width: t, height: r, color: s, borderColor: a, borderWidth: n, borderRadius:
|
|
105
|
+
const { width: t, height: r, color: s, borderColor: a, borderWidth: n, borderRadius: i } = e, c = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(t, r) : (() => {
|
|
106
106
|
const m = document.createElement("canvas");
|
|
107
107
|
return m.width = t, m.height = r, m;
|
|
108
|
-
})(),
|
|
109
|
-
|
|
110
|
-
const l = Math.min(
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
return
|
|
108
|
+
})(), o = c.getContext("2d");
|
|
109
|
+
o.clearRect(0, 0, t, r);
|
|
110
|
+
const l = Math.min(i, Math.min(t, r) / 2);
|
|
111
|
+
o.beginPath(), o.moveTo(l, 0), o.lineTo(t - l, 0), o.quadraticCurveTo(t, 0, t, l), o.lineTo(t, r - l), o.quadraticCurveTo(t, r, t - l, r), o.lineTo(l, r), o.quadraticCurveTo(0, r, 0, r - l), o.lineTo(0, l), o.quadraticCurveTo(0, 0, l, 0), o.closePath(), o.fillStyle = s, o.fill(), a && n > 0 && (o.lineWidth = n, o.strokeStyle = a, o.stroke());
|
|
112
|
+
const p = new de.CanvasTexture(c);
|
|
113
|
+
return p.needsUpdate = !0, p;
|
|
114
114
|
}
|
|
115
115
|
const qr = ({
|
|
116
116
|
segmentationMask: e,
|
|
@@ -119,24 +119,24 @@ const qr = ({
|
|
|
119
119
|
customBackground: s,
|
|
120
120
|
renderOrder: a = dt.BACKGROUND
|
|
121
121
|
}) => {
|
|
122
|
-
const { camera: n, size:
|
|
122
|
+
const { camera: n, size: i } = ut(), c = Ne(), o = mt(_.BACKGROUND_SEGMENTATION), l = t ? o == null ? void 0 : o.backgroundSegmentationMask : void 0, p = R(!1);
|
|
123
123
|
x(() => {
|
|
124
124
|
if (!t) {
|
|
125
|
-
|
|
125
|
+
p.current = !1;
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
|
-
|
|
128
|
+
o === null && !p.current && (console.warn(
|
|
129
129
|
`[VideoBackground] segmentation="${t}" set but no matching <Segmentation> component is mounted; rendering unmasked.`
|
|
130
|
-
),
|
|
131
|
-
}, [t,
|
|
132
|
-
const m = t ? l : e, f =
|
|
130
|
+
), p.current = !0);
|
|
131
|
+
}, [t, o]);
|
|
132
|
+
const m = t ? l : e, f = W(() => {
|
|
133
133
|
if (!n.isPerspectiveCamera)
|
|
134
134
|
return [10, 10];
|
|
135
|
-
const u = n,
|
|
136
|
-
return [S * (
|
|
137
|
-
}, [n,
|
|
138
|
-
return c ? /* @__PURE__ */ y("group", { position: [0, 0, -1], children: r ? /* @__PURE__ */
|
|
139
|
-
/* @__PURE__ */
|
|
135
|
+
const u = n, M = (u.position.z || 5) - -1, h = u.fov * Math.PI / 180, S = 2 * Math.tan(h / 2) * M;
|
|
136
|
+
return [S * (i.width / i.height), S];
|
|
137
|
+
}, [n, i]);
|
|
138
|
+
return c ? /* @__PURE__ */ y("group", { position: [0, 0, -1], children: r ? /* @__PURE__ */ z(ne, { children: [
|
|
139
|
+
/* @__PURE__ */ z("mesh", { position: [0, 0, -0.01], renderOrder: a - 1, children: [
|
|
140
140
|
/* @__PURE__ */ y("planeGeometry", { args: f }),
|
|
141
141
|
/* @__PURE__ */ y(
|
|
142
142
|
"meshBasicMaterial",
|
|
@@ -149,7 +149,7 @@ const qr = ({
|
|
|
149
149
|
}
|
|
150
150
|
)
|
|
151
151
|
] }),
|
|
152
|
-
s && m && /* @__PURE__ */
|
|
152
|
+
s && m && /* @__PURE__ */ z("mesh", { position: [0, 0, 0], renderOrder: a, children: [
|
|
153
153
|
/* @__PURE__ */ y("planeGeometry", { args: f }),
|
|
154
154
|
/* @__PURE__ */ y(
|
|
155
155
|
"meshBasicMaterial",
|
|
@@ -167,8 +167,8 @@ const qr = ({
|
|
|
167
167
|
"inverted-mask"
|
|
168
168
|
)
|
|
169
169
|
] })
|
|
170
|
-
] }) : /* @__PURE__ */
|
|
171
|
-
s && m && /* @__PURE__ */
|
|
170
|
+
] }) : /* @__PURE__ */ z(ne, { children: [
|
|
171
|
+
s && m && /* @__PURE__ */ z("mesh", { position: [0, 0, -0.01], renderOrder: a - 1, children: [
|
|
172
172
|
/* @__PURE__ */ y("planeGeometry", { args: f }),
|
|
173
173
|
/* @__PURE__ */ y(
|
|
174
174
|
"meshBasicMaterial",
|
|
@@ -182,7 +182,7 @@ const qr = ({
|
|
|
182
182
|
}
|
|
183
183
|
)
|
|
184
184
|
] }),
|
|
185
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ z("mesh", { position: [0, 0, 0], renderOrder: a, children: [
|
|
186
186
|
/* @__PURE__ */ y("planeGeometry", { args: f }),
|
|
187
187
|
/* @__PURE__ */ y(
|
|
188
188
|
"meshBasicMaterial",
|
|
@@ -207,15 +207,15 @@ const qr = ({
|
|
|
207
207
|
invert: s = !1,
|
|
208
208
|
fallback: a = "camera",
|
|
209
209
|
onStatusChange: n,
|
|
210
|
-
fit:
|
|
210
|
+
fit: i = "cover",
|
|
211
211
|
anchors: c = gt,
|
|
212
|
-
renderOrder:
|
|
212
|
+
renderOrder: o = 100,
|
|
213
213
|
visible: l = !0,
|
|
214
|
-
maskFeather:
|
|
214
|
+
maskFeather: p = 4,
|
|
215
215
|
maskErode: m = 0.7,
|
|
216
216
|
...f
|
|
217
217
|
}) => {
|
|
218
|
-
const u =
|
|
218
|
+
const u = Ne();
|
|
219
219
|
if (x(() => {
|
|
220
220
|
n == null || n(t, r);
|
|
221
221
|
}, [t, r, n]), !u) return null;
|
|
@@ -225,14 +225,14 @@ const qr = ({
|
|
|
225
225
|
{
|
|
226
226
|
...f,
|
|
227
227
|
source: { kind: "texture", texture: u },
|
|
228
|
-
fit:
|
|
228
|
+
fit: i,
|
|
229
229
|
anchors: c,
|
|
230
|
-
renderOrder:
|
|
230
|
+
renderOrder: o,
|
|
231
231
|
visible: l,
|
|
232
232
|
maskTexture: d ? e : null,
|
|
233
233
|
maskChannel: "green",
|
|
234
234
|
maskInvert: s,
|
|
235
|
-
maskFeather:
|
|
235
|
+
maskFeather: p,
|
|
236
236
|
maskErode: m
|
|
237
237
|
}
|
|
238
238
|
);
|
|
@@ -240,15 +240,15 @@ const qr = ({
|
|
|
240
240
|
const { texture: r, status: s, error: a } = pt(e);
|
|
241
241
|
return /* @__PURE__ */ y(Le, { ...t, mask: r, status: s, error: a });
|
|
242
242
|
}, wt = ({ bodyId: e, subject: t, numBodies: r, active: s = !0, ...a }) => {
|
|
243
|
-
const { texture: n, status:
|
|
244
|
-
return /* @__PURE__ */ y(Le, { ...a, mask: n, status:
|
|
243
|
+
const { texture: n, status: i, error: c } = ft({ bodyId: e, subject: t, numBodies: r, active: s });
|
|
244
|
+
return /* @__PURE__ */ y(Le, { ...a, mask: n, status: i, error: c });
|
|
245
245
|
}, Wr = ({ bodyId: e, subject: t, numBodies: r, ...s }) => e !== void 0 || t ? /* @__PURE__ */ y(wt, { ...s, bodyId: e, subject: t, numBodies: r }) : /* @__PURE__ */ y(vt, { ...s }), ce = 9, le = 16, Br = ({ children: e }) => {
|
|
246
246
|
const [t, r] = k({ width: 0, height: 0 });
|
|
247
247
|
return x(() => {
|
|
248
248
|
const s = () => {
|
|
249
|
-
const a = document.documentElement.clientWidth, n = document.documentElement.clientHeight,
|
|
250
|
-
let
|
|
251
|
-
|
|
249
|
+
const a = document.documentElement.clientWidth, n = document.documentElement.clientHeight, i = a / n, c = ce / le;
|
|
250
|
+
let o, l;
|
|
251
|
+
i > c ? (l = n, o = l * ce / le) : (o = a, l = o * le / ce), r({ width: o, height: l });
|
|
252
252
|
};
|
|
253
253
|
return s(), window.addEventListener("resize", s), () => window.removeEventListener("resize", s);
|
|
254
254
|
}, []), /* @__PURE__ */ y(
|
|
@@ -265,24 +265,24 @@ const qr = ({
|
|
|
265
265
|
children: /* @__PURE__ */ y("div", { style: { width: t.width, height: t.height, position: "relative" }, children: e })
|
|
266
266
|
}
|
|
267
267
|
);
|
|
268
|
-
}, $r = ({ size: e = 0.25, ...t }) => /* @__PURE__ */ y("axesHelper", { args: [e], ...t }), Dt = { left: -1, right: 1, top: 1, bottom: -1 },
|
|
268
|
+
}, $r = ({ size: e = 0.25, ...t }) => /* @__PURE__ */ y("axesHelper", { args: [e], ...t }), Dt = { left: -1, right: 1, top: 1, bottom: -1 }, Ut = (e, t, r) => {
|
|
269
269
|
const s = e % t, a = Math.floor(e / t);
|
|
270
270
|
return { x: s / t, y: (r - 1 - a) / r };
|
|
271
|
-
},
|
|
271
|
+
}, Nt = ({
|
|
272
272
|
sheet: e,
|
|
273
273
|
contentAspect: t,
|
|
274
274
|
renderOrder: r,
|
|
275
275
|
name: s
|
|
276
276
|
}) => {
|
|
277
|
-
const a = Et(e.url), n =
|
|
278
|
-
return
|
|
277
|
+
const a = Et(e.url), n = R(0), i = R(-1), c = bt(), [o, l] = t != null ? St(c, t) : [1, 1];
|
|
278
|
+
return Ue((p, m) => {
|
|
279
279
|
a.wrapS = Ee, a.wrapT = Ee, a.magFilter = be, a.minFilter = be, a.generateMipmaps = !1, a.repeat.set(1 / e.cols, 1 / e.rows), n.current += m;
|
|
280
280
|
const f = Math.floor(n.current * e.fps) % e.frames;
|
|
281
|
-
if (f ===
|
|
282
|
-
|
|
283
|
-
const { x: u, y: d } =
|
|
281
|
+
if (f === i.current) return;
|
|
282
|
+
i.current = f;
|
|
283
|
+
const { x: u, y: d } = Ut(f, e.cols, e.rows);
|
|
284
284
|
a.offset.set(u, d);
|
|
285
|
-
}), /* @__PURE__ */
|
|
285
|
+
}), /* @__PURE__ */ z("mesh", { name: s, renderOrder: r, scale: [o, l, 1], children: [
|
|
286
286
|
/* @__PURE__ */ y("planeGeometry", { args: [1, 1] }),
|
|
287
287
|
/* @__PURE__ */ y("meshBasicMaterial", { map: a, transparent: !0, toneMapped: !1, depthWrite: !1 })
|
|
288
288
|
] });
|
|
@@ -292,20 +292,20 @@ const qr = ({
|
|
|
292
292
|
contentAspect: r,
|
|
293
293
|
renderOrder: s = 10,
|
|
294
294
|
name: a = "spriteAnimation"
|
|
295
|
-
}) => /* @__PURE__ */ y(et, { fallback: null, children: /* @__PURE__ */ y(Qe, { anchors: t, children: /* @__PURE__ */ y(
|
|
295
|
+
}) => /* @__PURE__ */ y(et, { fallback: null, children: /* @__PURE__ */ y(Qe, { anchors: t, children: /* @__PURE__ */ y(Nt, { sheet: e, contentAspect: r, renderOrder: s, name: a }) }) }), Pt = 64, Lt = 3, It = /^[A-Za-z][A-Za-z0-9]{0,39}$/, Ot = /^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/, Gt = /^(?:rgb|rgba|hsl|hsla)\([0-9a-z.,%\s/+-]{1,60}\)$/i, zt = /^-?[0-9]{1,4}(?:\.[0-9]{1,4})?(?:px|em|rem|%)?$/, qt = /^[A-Za-z0-9 ,'"_-]{1,120}$/;
|
|
296
296
|
function Wt(e) {
|
|
297
297
|
return Ot.test(e) || Gt.test(e) || zt.test(e) || qt.test(e);
|
|
298
298
|
}
|
|
299
|
-
const
|
|
299
|
+
const Re = (e) => e.map((t) => t.replace(/[A-Z]/g, (r) => `-${r.toLowerCase()}`)).join("-");
|
|
300
300
|
function Bt(e) {
|
|
301
301
|
const t = {};
|
|
302
302
|
let r = 0;
|
|
303
303
|
const s = (a, n) => {
|
|
304
|
-
for (const
|
|
305
|
-
if (r >=
|
|
306
|
-
if (!It.test(
|
|
307
|
-
const c = a[
|
|
308
|
-
typeof c == "number" ? Number.isFinite(c) && (t[`--vincentt-${
|
|
304
|
+
for (const i of Object.keys(a)) {
|
|
305
|
+
if (r >= Pt) return;
|
|
306
|
+
if (!It.test(i)) continue;
|
|
307
|
+
const c = a[i], o = [...n, i];
|
|
308
|
+
typeof c == "number" ? Number.isFinite(c) && (t[`--vincentt-${Re(o)}`] = String(c), r++) : typeof c == "string" ? Wt(c) && (t[`--vincentt-${Re(o)}`] = c, r++) : c && typeof c == "object" && !Array.isArray(c) && o.length < Lt && s(c, o);
|
|
309
309
|
}
|
|
310
310
|
};
|
|
311
311
|
return e && typeof e == "object" && s(e, []), t;
|
|
@@ -328,28 +328,28 @@ function Kr({
|
|
|
328
328
|
material: n,
|
|
329
329
|
// `name` and `locked` are editor metadata; neither changes rendering.
|
|
330
330
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
331
|
-
name:
|
|
331
|
+
name: i,
|
|
332
332
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
333
333
|
locked: c
|
|
334
334
|
}) {
|
|
335
|
-
const [
|
|
335
|
+
const [o, l, p] = [t == null ? void 0 : t.x, t == null ? void 0 : t.y, t == null ? void 0 : t.z], [m, f, u] = [r == null ? void 0 : r.x, r == null ? void 0 : r.y, r == null ? void 0 : r.z], [d, g, M] = [s == null ? void 0 : s.x, s == null ? void 0 : s.y, s == null ? void 0 : s.z], h = W(
|
|
336
336
|
() => ({
|
|
337
|
-
...
|
|
338
|
-
position: ue(
|
|
339
|
-
rotation: ue(
|
|
340
|
-
scale: ue(
|
|
337
|
+
...V,
|
|
338
|
+
position: ue(V.position, { x: o, y: l, z: p }),
|
|
339
|
+
rotation: ue(V.rotation, { x: m, y: f, z: u }),
|
|
340
|
+
scale: ue(V.scale, { x: d, y: g, z: M }),
|
|
341
341
|
visible: a
|
|
342
342
|
}),
|
|
343
|
-
[
|
|
344
|
-
), S =
|
|
343
|
+
[o, l, p, m, f, u, d, g, M, a]
|
|
344
|
+
), S = W(
|
|
345
345
|
() => ({
|
|
346
|
-
...
|
|
346
|
+
...Ae,
|
|
347
347
|
assetUrl: e,
|
|
348
|
-
material: { ...
|
|
348
|
+
material: { ...Ae.material, ...n }
|
|
349
349
|
}),
|
|
350
350
|
[e, n]
|
|
351
351
|
);
|
|
352
|
-
return /* @__PURE__ */ y(
|
|
352
|
+
return /* @__PURE__ */ y(At, { value: h, children: /* @__PURE__ */ y(Rt, { value: S }) });
|
|
353
353
|
}
|
|
354
354
|
const $t = (e) => Array.isArray(e) ? e : [e], Xt = (e) => {
|
|
355
355
|
const [t, r] = k(null);
|
|
@@ -382,23 +382,23 @@ function jr({
|
|
|
382
382
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
383
383
|
name: n,
|
|
384
384
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
385
|
-
locked:
|
|
385
|
+
locked: i
|
|
386
386
|
}) {
|
|
387
|
-
const c =
|
|
388
|
-
for (const [f, { original: u, own: d }] of
|
|
387
|
+
const c = R(null), o = R(/* @__PURE__ */ new Map()), l = Xt(t), p = e !== void 0 || l !== null, m = () => {
|
|
388
|
+
for (const [f, { original: u, own: d }] of o.current)
|
|
389
389
|
f.material = u, d.forEach((g) => g.dispose());
|
|
390
|
-
|
|
390
|
+
o.current.clear();
|
|
391
391
|
};
|
|
392
|
-
return
|
|
393
|
-
!
|
|
392
|
+
return Ue(() => {
|
|
393
|
+
!p || !c.current || c.current.traverse((f) => {
|
|
394
394
|
const u = f;
|
|
395
|
-
if (!u.isMesh ||
|
|
396
|
-
const d = u.material, g = $t(d).map((
|
|
395
|
+
if (!u.isMesh || o.current.has(u)) return;
|
|
396
|
+
const d = u.material, g = $t(d).map((M) => {
|
|
397
397
|
var S;
|
|
398
|
-
const
|
|
399
|
-
return e !== void 0 && ((S =
|
|
398
|
+
const h = M.clone();
|
|
399
|
+
return e !== void 0 && ((S = h.color) == null || S.set(e)), l && (h.map = l, h.needsUpdate = !0), h;
|
|
400
400
|
});
|
|
401
|
-
u.material = Array.isArray(d) ? g : g[0],
|
|
401
|
+
u.material = Array.isArray(d) ? g : g[0], o.current.set(u, { original: d, own: g });
|
|
402
402
|
});
|
|
403
403
|
}), x(() => (m(), m), [e, l]), /* @__PURE__ */ y("group", { ref: c, visible: s, scale: r, children: a });
|
|
404
404
|
}
|
|
@@ -442,19 +442,19 @@ function Zr({
|
|
|
442
442
|
link: s,
|
|
443
443
|
onTap: a,
|
|
444
444
|
color: n,
|
|
445
|
-
visible:
|
|
445
|
+
visible: i = !0,
|
|
446
446
|
className: c,
|
|
447
|
-
children:
|
|
447
|
+
children: o,
|
|
448
448
|
// `name` and `locked` are editor metadata; neither changes rendering.
|
|
449
449
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
450
450
|
name: l,
|
|
451
451
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
452
|
-
locked:
|
|
452
|
+
locked: p
|
|
453
453
|
}) {
|
|
454
|
-
if (!
|
|
455
|
-
const m = n ? { ...Fe, background: n } : Fe, f = t === "scene" && !a && typeof r == "string" && r ? r : void 0, u = t === "scene" ? void 0 : jt(s), d = f ? () => Mt(f) : a, g =
|
|
454
|
+
if (!i) return null;
|
|
455
|
+
const m = n ? { ...Fe, background: n } : Fe, f = t === "scene" && !a && typeof r == "string" && r ? r : void 0, u = t === "scene" ? void 0 : jt(s), d = f ? () => Mt(f) : a, g = o ?? e;
|
|
456
456
|
if (u) {
|
|
457
|
-
const
|
|
457
|
+
const M = /^https?:/i.test(u);
|
|
458
458
|
return /* @__PURE__ */ y(
|
|
459
459
|
"a",
|
|
460
460
|
{
|
|
@@ -462,45 +462,45 @@ function Zr({
|
|
|
462
462
|
className: c,
|
|
463
463
|
style: m,
|
|
464
464
|
onClick: d,
|
|
465
|
-
...
|
|
465
|
+
...M ? { target: "_blank", rel: "noopener noreferrer" } : {},
|
|
466
466
|
children: g
|
|
467
467
|
}
|
|
468
468
|
);
|
|
469
469
|
}
|
|
470
470
|
return /* @__PURE__ */ y("button", { type: "button", className: c, style: m, onClick: d, children: g });
|
|
471
471
|
}
|
|
472
|
-
const
|
|
472
|
+
const xe = (e, t) => ({
|
|
473
473
|
x: (t == null ? void 0 : t.x) ?? e.x,
|
|
474
474
|
y: (t == null ? void 0 : t.y) ?? e.y,
|
|
475
475
|
z: (t == null ? void 0 : t.z) ?? e.z
|
|
476
476
|
});
|
|
477
477
|
function Yr({
|
|
478
|
-
type: e =
|
|
479
|
-
color: t =
|
|
480
|
-
intensity: r =
|
|
481
|
-
enabled: s =
|
|
478
|
+
type: e = O.type,
|
|
479
|
+
color: t = O.color,
|
|
480
|
+
intensity: r = O.intensity,
|
|
481
|
+
enabled: s = O.enabled,
|
|
482
482
|
castShadow: a = !1,
|
|
483
|
-
distance: n =
|
|
484
|
-
decay:
|
|
485
|
-
angle: c =
|
|
486
|
-
penumbra:
|
|
483
|
+
distance: n = O.distance,
|
|
484
|
+
decay: i = O.decay,
|
|
485
|
+
angle: c = O.angle,
|
|
486
|
+
penumbra: o = O.penumbra,
|
|
487
487
|
position: l,
|
|
488
|
-
rotation:
|
|
489
|
-
showHelper: m =
|
|
488
|
+
rotation: p,
|
|
489
|
+
showHelper: m = O.showHelper,
|
|
490
490
|
// `name` and `locked` are editor metadata; neither changes rendering.
|
|
491
491
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
492
492
|
name: f,
|
|
493
493
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
494
494
|
locked: u
|
|
495
495
|
}) {
|
|
496
|
-
const [d, g,
|
|
496
|
+
const [d, g, M] = [l == null ? void 0 : l.x, l == null ? void 0 : l.y, l == null ? void 0 : l.z], [h, S, b] = [p == null ? void 0 : p.x, p == null ? void 0 : p.y, p == null ? void 0 : p.z], I = W(
|
|
497
497
|
() => ({
|
|
498
|
-
...
|
|
499
|
-
position:
|
|
500
|
-
rotation:
|
|
498
|
+
...V,
|
|
499
|
+
position: xe(V.position, { x: d, y: g, z: M }),
|
|
500
|
+
rotation: xe(V.rotation, { x: h, y: S, z: b })
|
|
501
501
|
}),
|
|
502
|
-
[d, g,
|
|
503
|
-
),
|
|
502
|
+
[d, g, M, h, S, b]
|
|
503
|
+
), T = W(
|
|
504
504
|
() => ({
|
|
505
505
|
enabled: s,
|
|
506
506
|
type: e,
|
|
@@ -509,15 +509,15 @@ function Yr({
|
|
|
509
509
|
castShadow: a,
|
|
510
510
|
distance: n,
|
|
511
511
|
angle: c,
|
|
512
|
-
penumbra:
|
|
513
|
-
decay:
|
|
512
|
+
penumbra: o,
|
|
513
|
+
decay: i,
|
|
514
514
|
showHelper: m
|
|
515
515
|
}),
|
|
516
|
-
[s, e, t, r, a, n, c,
|
|
516
|
+
[s, e, t, r, a, n, c, o, i, m]
|
|
517
517
|
);
|
|
518
|
-
return /* @__PURE__ */ y(Tt, { settings:
|
|
518
|
+
return /* @__PURE__ */ y(Tt, { settings: T, transform: I });
|
|
519
519
|
}
|
|
520
|
-
const
|
|
520
|
+
const X = (e) => {
|
|
521
521
|
switch (e) {
|
|
522
522
|
case "start":
|
|
523
523
|
return "starting";
|
|
@@ -548,103 +548,103 @@ function Jr(e = {}) {
|
|
|
548
548
|
bitsPerSecond: s,
|
|
549
549
|
onData: a,
|
|
550
550
|
onStop: n,
|
|
551
|
-
onRecordingStart:
|
|
551
|
+
onRecordingStart: i,
|
|
552
552
|
onRecordingPause: c,
|
|
553
|
-
onRecordingResume:
|
|
553
|
+
onRecordingResume: o,
|
|
554
554
|
onRecordingStop: l,
|
|
555
|
-
onRecordingComplete:
|
|
555
|
+
onRecordingComplete: p,
|
|
556
556
|
onError: m,
|
|
557
557
|
passThroughStream: f
|
|
558
|
-
} = e, u =
|
|
558
|
+
} = e, u = R(null), d = R(null), g = R([]), [M, h] = k("idle"), [S, b] = k(null), [I, T] = k(null), w = F(() => {
|
|
559
559
|
var C;
|
|
560
|
-
const
|
|
561
|
-
for (const
|
|
562
|
-
if ((C = MediaRecorder.isTypeSupported) != null && C.call(MediaRecorder,
|
|
563
|
-
}, [r]),
|
|
564
|
-
async (
|
|
560
|
+
const E = [r, ...Vt].filter(Boolean);
|
|
561
|
+
for (const A of E)
|
|
562
|
+
if ((C = MediaRecorder.isTypeSupported) != null && C.call(MediaRecorder, A)) return A;
|
|
563
|
+
}, [r]), N = F(
|
|
564
|
+
async (E) => {
|
|
565
565
|
const C = new MediaStream();
|
|
566
|
-
if (
|
|
567
|
-
let
|
|
566
|
+
if (E.getTracks().forEach((A) => C.addTrack(A)), t) {
|
|
567
|
+
let A;
|
|
568
568
|
if (t instanceof MediaStream)
|
|
569
|
-
|
|
569
|
+
A = t;
|
|
570
570
|
else {
|
|
571
571
|
const v = typeof t == "object" ? { audio: t } : { audio: !0, video: !1 };
|
|
572
|
-
|
|
572
|
+
A = await navigator.mediaDevices.getUserMedia(v);
|
|
573
573
|
}
|
|
574
|
-
|
|
574
|
+
A.getAudioTracks().forEach((v) => C.addTrack(v));
|
|
575
575
|
}
|
|
576
576
|
if (!C.getTracks().length)
|
|
577
577
|
throw new Error("No tracks available in combined stream.");
|
|
578
578
|
return d.current = C, C;
|
|
579
579
|
},
|
|
580
580
|
[t]
|
|
581
|
-
),
|
|
582
|
-
async (
|
|
583
|
-
|
|
581
|
+
), B = F(
|
|
582
|
+
async (E, C) => {
|
|
583
|
+
h(X("start")), T(null), b(null);
|
|
584
584
|
try {
|
|
585
|
-
let
|
|
585
|
+
let A;
|
|
586
586
|
if (f)
|
|
587
|
-
|
|
587
|
+
A = f, d.current = A;
|
|
588
588
|
else {
|
|
589
|
-
if (!
|
|
590
|
-
|
|
589
|
+
if (!E) throw new Error("start(stream) requires a MediaStream.");
|
|
590
|
+
A = await N(E);
|
|
591
591
|
}
|
|
592
|
-
const v = w(),
|
|
593
|
-
v && (
|
|
594
|
-
const
|
|
595
|
-
|
|
596
|
-
var
|
|
597
|
-
((
|
|
598
|
-
},
|
|
599
|
-
const
|
|
592
|
+
const v = w(), Z = {};
|
|
593
|
+
v && (Z.mimeType = v), s && (Z.bitsPerSecond = s);
|
|
594
|
+
const j = new MediaRecorder(A, Z);
|
|
595
|
+
j.ondataavailable = (L) => {
|
|
596
|
+
var J;
|
|
597
|
+
((J = L.data) == null ? void 0 : J.size) > 0 && (g.current.push(L.data), a == null || a(L.data));
|
|
598
|
+
}, j.onstop = () => {
|
|
599
|
+
const L = new Blob(g.current, {
|
|
600
600
|
type: v ?? "video/webm"
|
|
601
601
|
});
|
|
602
|
-
|
|
603
|
-
}, u.current =
|
|
604
|
-
} catch (
|
|
605
|
-
const v =
|
|
606
|
-
console.error("start(stream) failed", v),
|
|
602
|
+
b(L), n == null || n(L), p == null || p(L), g.current = [], h(X("complete"));
|
|
603
|
+
}, u.current = j, j.start(C), h(X("started")), i == null || i();
|
|
604
|
+
} catch (A) {
|
|
605
|
+
const v = A instanceof Error ? A : new Error(String(A));
|
|
606
|
+
console.error("start(stream) failed", v), T(v), h(X("fail")), m == null || m(v);
|
|
607
607
|
}
|
|
608
608
|
},
|
|
609
609
|
[
|
|
610
|
-
|
|
610
|
+
N,
|
|
611
611
|
w,
|
|
612
612
|
s,
|
|
613
613
|
a,
|
|
614
614
|
n,
|
|
615
|
-
|
|
616
|
-
|
|
615
|
+
p,
|
|
616
|
+
i,
|
|
617
617
|
m,
|
|
618
618
|
f
|
|
619
619
|
]
|
|
620
|
-
),
|
|
621
|
-
const
|
|
622
|
-
!
|
|
620
|
+
), $ = F(() => {
|
|
621
|
+
const E = u.current;
|
|
622
|
+
!E || E.state === "inactive" || (h(X("stop")), E.stop(), l == null || l());
|
|
623
623
|
}, [l]), te = F(() => {
|
|
624
|
-
const
|
|
625
|
-
(
|
|
624
|
+
const E = u.current;
|
|
625
|
+
(E == null ? void 0 : E.state) === "recording" && (E.pause(), h(X("pause")), c == null || c());
|
|
626
626
|
}, [c]), re = F(() => {
|
|
627
|
-
const
|
|
628
|
-
(
|
|
629
|
-
}, [
|
|
630
|
-
var
|
|
627
|
+
const E = u.current;
|
|
628
|
+
(E == null ? void 0 : E.state) === "paused" && (E.resume(), h(X("resume")), o == null || o());
|
|
629
|
+
}, [o]), Y = F(() => {
|
|
630
|
+
var E;
|
|
631
631
|
try {
|
|
632
|
-
u.current && (u.current.onstop = null, u.current.state !== "inactive" && u.current.stop()), u.current = null, (
|
|
632
|
+
u.current && (u.current.onstop = null, u.current.state !== "inactive" && u.current.stop()), u.current = null, (E = d.current) == null || E.getTracks().forEach((C) => C.stop()), d.current = null, b(null), h(X("clear")), g.current = [], T(null);
|
|
633
633
|
} catch (C) {
|
|
634
634
|
console.error("clear failed", C);
|
|
635
635
|
}
|
|
636
636
|
}, []);
|
|
637
|
-
return x(() => () =>
|
|
638
|
-
status:
|
|
639
|
-
start:
|
|
640
|
-
stop:
|
|
637
|
+
return x(() => () => Y(), []), {
|
|
638
|
+
status: M,
|
|
639
|
+
start: B,
|
|
640
|
+
stop: $,
|
|
641
641
|
pause: te,
|
|
642
642
|
resume: re,
|
|
643
|
-
clear:
|
|
644
|
-
isRecording:
|
|
645
|
-
isPaused:
|
|
643
|
+
clear: Y,
|
|
644
|
+
isRecording: M === "recording" || M === "paused",
|
|
645
|
+
isPaused: M === "paused",
|
|
646
646
|
recordedBlob: S,
|
|
647
|
-
error:
|
|
647
|
+
error: I,
|
|
648
648
|
getActiveStream: () => d.current
|
|
649
649
|
};
|
|
650
650
|
}
|
|
@@ -655,8 +655,8 @@ const Zt = async (e, t = {}) => {
|
|
|
655
655
|
const n = e();
|
|
656
656
|
return (s = t.onCaptureComplete) == null || s.call(t, n), n;
|
|
657
657
|
} catch (n) {
|
|
658
|
-
const
|
|
659
|
-
throw (a = t.onError) == null || a.call(t,
|
|
658
|
+
const i = n instanceof Error ? n : new Error(String(n));
|
|
659
|
+
throw (a = t.onError) == null || a.call(t, i), i;
|
|
660
660
|
}
|
|
661
661
|
}, Qr = (e = {}) => {
|
|
662
662
|
const { session: t } = He(), {
|
|
@@ -664,7 +664,7 @@ const Zt = async (e, t = {}) => {
|
|
|
664
664
|
onCaptureStart: s,
|
|
665
665
|
onCaptureComplete: a,
|
|
666
666
|
onError: n
|
|
667
|
-
} = e, [
|
|
667
|
+
} = e, [i, c] = k("idle"), [o, l] = k(null), [p, m] = k(null), f = F(async () => {
|
|
668
668
|
c("capturing"), l(null), m(null);
|
|
669
669
|
try {
|
|
670
670
|
const d = await Zt(r, {
|
|
@@ -680,15 +680,15 @@ const Zt = async (e, t = {}) => {
|
|
|
680
680
|
}, [r, s, a, n]), u = F(() => {
|
|
681
681
|
c("idle"), l(null), m(null);
|
|
682
682
|
}, []);
|
|
683
|
-
return { status:
|
|
683
|
+
return { status: i, capturePhoto: f, clear: u, dataUrl: o, error: p };
|
|
684
684
|
}, es = (e, t) => {
|
|
685
685
|
const r = e.split(","), s = r[0].match(/:(.*?);/), a = s ? s[1] : "application/octet-stream", n = atob(r[r.length - 1]);
|
|
686
|
-
let
|
|
687
|
-
const c = new Uint8Array(
|
|
688
|
-
for (;
|
|
689
|
-
c[
|
|
686
|
+
let i = n.length;
|
|
687
|
+
const c = new Uint8Array(i);
|
|
688
|
+
for (; i--; )
|
|
689
|
+
c[i] = n.charCodeAt(i);
|
|
690
690
|
return new File([c], t, { type: a });
|
|
691
|
-
}, Yt = 4, Jt = 50, Qt = 5e3, ae = (e) => Math.min(1, Math.max(0, e)),
|
|
691
|
+
}, Yt = 4, Jt = 50, Qt = 5e3, ae = (e) => Math.min(1, Math.max(0, e)), Ce = (e) => new Promise((t) => {
|
|
692
692
|
if (e.readyState >= 4) {
|
|
693
693
|
t();
|
|
694
694
|
return;
|
|
@@ -735,7 +735,7 @@ class tr {
|
|
|
735
735
|
if (this.musicWanted = { url: t, volume: s }, this.musicUrl === t && this.musicReady)
|
|
736
736
|
return this.music && (this.music.volume = s), this.musicReady;
|
|
737
737
|
this.music && (this.music.pause(), this.music.currentTime = 0, this.music.removeAttribute("src"), this.music.load()), this.music = _e(t, !0), this.musicUrl = t, this.music.volume = s;
|
|
738
|
-
const a =
|
|
738
|
+
const a = Ce(this.music);
|
|
739
739
|
return this.musicReady = a, a;
|
|
740
740
|
}
|
|
741
741
|
/**
|
|
@@ -748,14 +748,14 @@ class tr {
|
|
|
748
748
|
if (s) return s;
|
|
749
749
|
const a = ae(r), n = [];
|
|
750
750
|
for (let c = 0; c < this.sfxPoolSize; c += 1) {
|
|
751
|
-
const
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
}), n.push(
|
|
751
|
+
const o = _e(t, !1);
|
|
752
|
+
o.volume = a, o.addEventListener("ended", () => {
|
|
753
|
+
o.currentTime = 0;
|
|
754
|
+
}), n.push(o);
|
|
755
755
|
}
|
|
756
756
|
this.pools.set(t, { els: n, next: 0, volume: a });
|
|
757
|
-
const
|
|
758
|
-
return this.ready.set(t,
|
|
757
|
+
const i = Ce(n[0]);
|
|
758
|
+
return this.ready.set(t, i), i;
|
|
759
759
|
}
|
|
760
760
|
/** Subscribe to mute-state changes (for a toggle UI). Fires immediately with
|
|
761
761
|
* the current state. Returns an unsubscribe. */
|
|
@@ -791,15 +791,15 @@ class tr {
|
|
|
791
791
|
if (a - (this.lastPlayed.get(t) ?? -1 / 0) < this.coalesceMs) return;
|
|
792
792
|
this.lastPlayed.set(t, a);
|
|
793
793
|
const n = s.els.length;
|
|
794
|
-
let
|
|
794
|
+
let i;
|
|
795
795
|
for (let c = 0; c < n; c += 1) {
|
|
796
|
-
const
|
|
797
|
-
if (
|
|
798
|
-
|
|
796
|
+
const o = s.els[(s.next + c) % n];
|
|
797
|
+
if (o.paused) {
|
|
798
|
+
i = o, s.next = (s.next + c + 1) % n;
|
|
799
799
|
break;
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
|
-
|
|
802
|
+
i || (i = s.els[s.next], s.next = (s.next + 1) % n), i.muted = !1, i.volume = ae(r ?? s.volume), i.currentTime !== 0 && (i.currentTime = 0), i.play().catch(() => {
|
|
803
803
|
});
|
|
804
804
|
}
|
|
805
805
|
/** Request the looping background track (buffer it with prefetchMusic, which
|
|
@@ -822,121 +822,128 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
822
822
|
loopCount: s = 1,
|
|
823
823
|
autoplay: a = !1,
|
|
824
824
|
muted: n = !1,
|
|
825
|
-
volume:
|
|
825
|
+
volume: i = 100,
|
|
826
826
|
preload: c = "auto",
|
|
827
|
-
onReady:
|
|
827
|
+
onReady: o,
|
|
828
828
|
onPlay: l,
|
|
829
|
-
onPause:
|
|
829
|
+
onPause: p,
|
|
830
830
|
onEnded: m,
|
|
831
831
|
onError: f
|
|
832
832
|
}, u) {
|
|
833
|
-
const d =
|
|
834
|
-
|
|
835
|
-
|
|
833
|
+
const d = R(null);
|
|
834
|
+
d.current === null && typeof Audio < "u" && (d.current = new Audio());
|
|
835
|
+
const g = R(0), M = R(null), h = F(async () => {
|
|
836
|
+
const T = d.current;
|
|
837
|
+
if (T)
|
|
836
838
|
try {
|
|
837
|
-
await
|
|
839
|
+
await T.play();
|
|
838
840
|
} catch (w) {
|
|
839
|
-
const
|
|
840
|
-
throw f == null || f(
|
|
841
|
+
const N = w instanceof Error ? w : new Error(String(w));
|
|
842
|
+
throw f == null || f(N), N;
|
|
841
843
|
}
|
|
842
844
|
}, [f]), S = F(() => {
|
|
843
|
-
var
|
|
844
|
-
return (
|
|
845
|
-
}, []),
|
|
846
|
-
const
|
|
847
|
-
|
|
845
|
+
var T;
|
|
846
|
+
return (T = d.current) == null ? void 0 : T.pause();
|
|
847
|
+
}, []), b = F(() => {
|
|
848
|
+
const T = d.current;
|
|
849
|
+
T && (T.pause(), T.currentTime = 0, g.current = 0);
|
|
848
850
|
}, []);
|
|
849
851
|
rt(
|
|
850
852
|
u,
|
|
851
853
|
() => ({
|
|
852
|
-
play:
|
|
854
|
+
play: h,
|
|
853
855
|
pause: S,
|
|
854
|
-
stop:
|
|
856
|
+
stop: b,
|
|
855
857
|
get current() {
|
|
856
858
|
return d.current;
|
|
857
859
|
}
|
|
858
860
|
}),
|
|
859
|
-
[S,
|
|
861
|
+
[S, h, b]
|
|
860
862
|
), x(() => {
|
|
861
|
-
g.current = 0,
|
|
863
|
+
g.current = 0, M.current = null;
|
|
862
864
|
}, [t]), x(() => {
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
865
|
+
const T = d.current;
|
|
866
|
+
T && (T.preload = c, T.muted = n, T.loop = !1, T.getAttribute("src") !== t && (T.src = t));
|
|
867
|
+
}, [t, c, n]), x(() => {
|
|
868
|
+
const T = d.current;
|
|
869
|
+
return () => {
|
|
870
|
+
T && (T.pause(), T.removeAttribute("src"), T.load());
|
|
871
|
+
};
|
|
872
|
+
}, []), x(() => {
|
|
873
|
+
d.current && (d.current.volume = ar(i));
|
|
874
|
+
}, [i]), x(() => {
|
|
875
|
+
sr(a, M.current, t) && (M.current = t, h().catch(() => {
|
|
866
876
|
}));
|
|
867
877
|
}, [a, t]);
|
|
868
|
-
const
|
|
878
|
+
const I = F(() => {
|
|
869
879
|
g.current += 1;
|
|
870
|
-
const
|
|
871
|
-
if (rr(r, g.current,
|
|
880
|
+
const T = Math.max(1, Math.floor(s));
|
|
881
|
+
if (rr(r, g.current, T) === "replay") {
|
|
872
882
|
const w = d.current;
|
|
873
|
-
w && (w.currentTime = 0,
|
|
883
|
+
w && (w.currentTime = 0, h().catch(() => {
|
|
874
884
|
}));
|
|
875
885
|
return;
|
|
876
886
|
}
|
|
877
887
|
g.current = 0, m == null || m();
|
|
878
|
-
}, [s, m,
|
|
879
|
-
return
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
);
|
|
897
|
-
}), U = new tr(), rs = (e, t) => U.prefetchMusic(e, t), ss = (e, t) => U.registerSound(e, t), as = (e, t) => U.startMusic(e, t), ns = () => U.stopMusic(), os = (e, t) => U.playOneShot(e, t), is = (e) => U.setMuted(e), cs = () => U.toggleMuted(), ls = () => U.isMuted(), us = (e) => U.onMuteChange(e), ds = () => {
|
|
898
|
-
const [e, t] = k(U.isMuted());
|
|
899
|
-
return x(() => U.onMuteChange(t), []), e;
|
|
888
|
+
}, [s, m, h, r]);
|
|
889
|
+
return x(() => {
|
|
890
|
+
const T = d.current;
|
|
891
|
+
if (!T) return;
|
|
892
|
+
const N = [
|
|
893
|
+
["canplaythrough", () => o == null ? void 0 : o()],
|
|
894
|
+
["play", () => l == null ? void 0 : l()],
|
|
895
|
+
["pause", () => p == null ? void 0 : p()],
|
|
896
|
+
["ended", I],
|
|
897
|
+
["error", () => f == null ? void 0 : f(new Error(`Unable to load audio: ${t}`))]
|
|
898
|
+
];
|
|
899
|
+
for (const [B, $] of N) T.addEventListener(B, $);
|
|
900
|
+
return () => {
|
|
901
|
+
for (const [B, $] of N) T.removeEventListener(B, $);
|
|
902
|
+
};
|
|
903
|
+
}, [t, o, l, p, f, I]), null;
|
|
904
|
+
}), P = new tr(), rs = (e, t) => P.prefetchMusic(e, t), ss = (e, t) => P.registerSound(e, t), as = (e, t) => P.startMusic(e, t), ns = () => P.stopMusic(), os = (e, t) => P.playOneShot(e, t), is = (e) => P.setMuted(e), cs = () => P.toggleMuted(), ls = () => P.isMuted(), us = (e) => P.onMuteChange(e), ds = () => {
|
|
905
|
+
const [e, t] = k(P.isMuted());
|
|
906
|
+
return x(() => P.onMuteChange(t), []), e;
|
|
900
907
|
}, nr = (e = {}) => {
|
|
901
|
-
const { auto: t = !1 } = e, r =
|
|
908
|
+
const { auto: t = !1 } = e, r = R(e.env ?? Ke()), s = R(e.constraints);
|
|
902
909
|
s.current = e.constraints;
|
|
903
|
-
const [a, n] = k("unknown"), [
|
|
904
|
-
const m = ++
|
|
905
|
-
if (m !==
|
|
910
|
+
const [a, n] = k("unknown"), [i, c] = k(null), o = R(0), l = F(async () => {
|
|
911
|
+
const m = ++o.current, f = await je(r.current);
|
|
912
|
+
if (m !== o.current) return a;
|
|
906
913
|
const u = f.state === "unknown" ? "unknown" : f.state;
|
|
907
914
|
return n((d) => d === "requesting" ? d : u), u !== "blocked" && c(null), u;
|
|
908
|
-
}, []),
|
|
915
|
+
}, []), p = F(
|
|
909
916
|
async (m) => {
|
|
910
|
-
const f = ++
|
|
917
|
+
const f = ++o.current;
|
|
911
918
|
n("requesting"), c(null);
|
|
912
919
|
const u = await Ve(
|
|
913
920
|
{ constraints: (m == null ? void 0 : m.constraints) ?? s.current, keepStream: !1 },
|
|
914
921
|
r.current
|
|
915
922
|
);
|
|
916
|
-
return f !==
|
|
923
|
+
return f !== o.current || (n(u.state), c(u.reason)), u.state;
|
|
917
924
|
},
|
|
918
925
|
[]
|
|
919
926
|
);
|
|
920
927
|
return x(() => {
|
|
921
928
|
let m = () => {
|
|
922
929
|
}, f = !0;
|
|
923
|
-
return t ?
|
|
930
|
+
return t ? p() : l(), Ze((u) => {
|
|
924
931
|
f && (n((d) => d === "requesting" ? d : u.state === "unknown" ? "unknown" : u.state), u.state !== "blocked" && c(null));
|
|
925
932
|
}, r.current).then((u) => {
|
|
926
933
|
f ? m = u : u();
|
|
927
934
|
}), () => {
|
|
928
|
-
f = !1,
|
|
935
|
+
f = !1, o.current += 1, m();
|
|
929
936
|
};
|
|
930
|
-
}, [t, l,
|
|
937
|
+
}, [t, l, p]), W(
|
|
931
938
|
() => ({
|
|
932
939
|
state: a,
|
|
933
|
-
reason:
|
|
940
|
+
reason: i,
|
|
934
941
|
canPrompt: Ye(a),
|
|
935
942
|
usable: a === "granted",
|
|
936
|
-
request:
|
|
943
|
+
request: p,
|
|
937
944
|
refresh: l
|
|
938
945
|
}),
|
|
939
|
-
[a,
|
|
946
|
+
[a, i, p, l]
|
|
940
947
|
);
|
|
941
948
|
}, or = {
|
|
942
949
|
display: "flex",
|
|
@@ -969,18 +976,18 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
969
976
|
const n = nr({ auto: r, constraints: s });
|
|
970
977
|
if (n.usable) return /* @__PURE__ */ y(ne, { children: e });
|
|
971
978
|
if (t) return /* @__PURE__ */ y(ne, { children: t(n) });
|
|
972
|
-
const { state:
|
|
973
|
-
return /* @__PURE__ */
|
|
974
|
-
/* @__PURE__ */ y("p", { "aria-live": "polite", style: { margin: 0 }, children: (c == null ? void 0 : c.message) ?? Je[
|
|
979
|
+
const { state: i, reason: c, canPrompt: o, request: l } = n;
|
|
980
|
+
return /* @__PURE__ */ z("div", { style: or, role: "region", "aria-label": "Camera access", children: [
|
|
981
|
+
/* @__PURE__ */ y("p", { "aria-live": "polite", style: { margin: 0 }, children: (c == null ? void 0 : c.message) ?? Je[i] }),
|
|
975
982
|
/* @__PURE__ */ y(
|
|
976
983
|
"button",
|
|
977
984
|
{
|
|
978
985
|
type: "button",
|
|
979
986
|
onClick: () => void l(),
|
|
980
|
-
disabled: !
|
|
981
|
-
"aria-disabled": !
|
|
982
|
-
style: { ...ir, opacity:
|
|
983
|
-
children:
|
|
987
|
+
disabled: !o || i === "requesting",
|
|
988
|
+
"aria-disabled": !o || i === "requesting",
|
|
989
|
+
style: { ...ir, opacity: o && i !== "requesting" ? 1 : 0.5 },
|
|
990
|
+
children: i === "requesting" ? "Waiting…" : i === "denied" ? "Try again" : a
|
|
984
991
|
}
|
|
985
992
|
)
|
|
986
993
|
] });
|
|
@@ -1005,12 +1012,12 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1005
1012
|
disposeUnreferencedOnUnmount: t = !0,
|
|
1006
1013
|
children: r
|
|
1007
1014
|
}) => {
|
|
1008
|
-
const s = e ??
|
|
1015
|
+
const s = e ?? Pe();
|
|
1009
1016
|
return x(() => () => {
|
|
1010
1017
|
t && s.disposeUnreferenced();
|
|
1011
1018
|
}, [s, t]), /* @__PURE__ */ y(Ie.Provider, { value: s, children: r });
|
|
1012
|
-
}, Oe = () => st(Ie) ??
|
|
1013
|
-
const { enabled: r = !0 } = t, s = Oe(), a = nt(), n = (e == null ? void 0 : e.key) ?? null, [
|
|
1019
|
+
}, Oe = () => st(Ie) ?? Pe(), gs = (e, t = {}) => {
|
|
1020
|
+
const { enabled: r = !0 } = t, s = Oe(), a = nt(), n = (e == null ? void 0 : e.key) ?? null, [i, c] = k({
|
|
1014
1021
|
value: null,
|
|
1015
1022
|
status: "idle",
|
|
1016
1023
|
error: null
|
|
@@ -1020,16 +1027,16 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1020
1027
|
c({ value: null, status: "idle", error: null });
|
|
1021
1028
|
return;
|
|
1022
1029
|
}
|
|
1023
|
-
let
|
|
1030
|
+
let o = !0;
|
|
1024
1031
|
const l = s.get(e.key);
|
|
1025
|
-
return c({ value: l ?? null, status: l ? "ready" : "loading", error: null }), s.acquire(e, a).then((
|
|
1026
|
-
|
|
1027
|
-
}).catch((
|
|
1028
|
-
|
|
1032
|
+
return c({ value: l ?? null, status: l ? "ready" : "loading", error: null }), s.acquire(e, a).then((p) => {
|
|
1033
|
+
o && c({ value: p, status: "ready", error: null });
|
|
1034
|
+
}).catch((p) => {
|
|
1035
|
+
o && c({ value: null, status: "error", error: p });
|
|
1029
1036
|
}), () => {
|
|
1030
|
-
|
|
1037
|
+
o = !1, s.release(e.key, a);
|
|
1031
1038
|
};
|
|
1032
|
-
}, [s, n, r, a]),
|
|
1039
|
+
}, [s, n, r, a]), i;
|
|
1033
1040
|
}, ys = (e) => {
|
|
1034
1041
|
const t = Oe(), r = e ?? t;
|
|
1035
1042
|
return ot(
|
|
@@ -1065,13 +1072,13 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1065
1072
|
fallbacks: { onUnsupported: "degrade", delegate: "auto" },
|
|
1066
1073
|
assets: { holisticModelUrl: null, semanticSegmentationModelUrl: null },
|
|
1067
1074
|
updatedAt: 0
|
|
1068
|
-
}),
|
|
1075
|
+
}), U = (e, t, r, s, a, n) => {
|
|
1069
1076
|
if (e === void 0) return t;
|
|
1070
1077
|
if (typeof e != "number" || !Number.isFinite(e))
|
|
1071
1078
|
return n(`${a}: not a number, kept ${t}`), t;
|
|
1072
|
-
const
|
|
1073
|
-
return
|
|
1074
|
-
},
|
|
1079
|
+
const i = Math.min(s, Math.max(r, e));
|
|
1080
|
+
return i !== e && n(`${a}: ${e} clamped to ${i}`), i;
|
|
1081
|
+
}, Q = (e, t, r, s) => e === void 0 ? t : e === null ? null : typeof e != "number" || !Number.isFinite(e) || e <= 0 ? (s(`${r}: invalid fps, kept ${t}`), t) : (e > 120 && s(`${r}: ${e} clamped to 120`), Math.min(120, e)), mr = [
|
|
1075
1082
|
"tiers",
|
|
1076
1083
|
"budget",
|
|
1077
1084
|
"initialTier",
|
|
@@ -1083,20 +1090,20 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1083
1090
|
const t = {};
|
|
1084
1091
|
for (const r of mr) e[r] !== void 0 && (t[r] = e[r]);
|
|
1085
1092
|
return t;
|
|
1086
|
-
},
|
|
1087
|
-
var c,
|
|
1088
|
-
const s = (We) => r.push(We), a = e.trackers ?? {}, n = t.trackers,
|
|
1093
|
+
}, G = (e, t, r, s) => e === void 0 ? t : typeof e != "boolean" ? (s(`${r}: not a boolean, kept ${t}`), t) : e, H = (e, t, r, s, a) => e === void 0 ? r : t.includes(e) ? e : (a(`${s}: "${String(e)}" is not one of ${t.join(" | ")}, kept ${r}`), r), ve = (e, t, r, s) => e === void 0 ? t : e === null ? null : typeof e != "string" || !/^https?:\/\//.test(e) ? (s(`${r}: not an http(s) URL, kept ${t === null ? "the SDK default" : t}`), t) : e, K = (e = {}, t = Ge, r = []) => {
|
|
1094
|
+
var c, o, l, p, m, f, u, d, g, M, h, S, b, I, T, w, N, B, $, te, re, Y, E, C, A, v, Z, j, L, J, fe, pe, he, ge, ye, Se, Te, Me;
|
|
1095
|
+
const s = (We) => r.push(We), a = e.trackers ?? {}, n = t.trackers, i = e.quality === void 0 ? t.quality === !1 ? !1 : ke(t.quality) : e.quality === !1 ? !1 : typeof e.quality == "object" && e.quality !== null ? ke(e.quality) : (s("quality: must be an object or false, kept base"), t.quality);
|
|
1089
1096
|
return {
|
|
1090
1097
|
version: oe,
|
|
1091
1098
|
trackers: {
|
|
1092
1099
|
face: {
|
|
1093
|
-
enabled:
|
|
1100
|
+
enabled: G((c = a.face) == null ? void 0 : c.enabled, n.face.enabled, "trackers.face.enabled", s),
|
|
1094
1101
|
numFaces: Math.round(
|
|
1095
|
-
|
|
1102
|
+
U((o = a.face) == null ? void 0 : o.numFaces, n.face.numFaces, 1, 10, "trackers.face.numFaces", s)
|
|
1096
1103
|
),
|
|
1097
|
-
targetFps:
|
|
1098
|
-
holdMs:
|
|
1099
|
-
predictMs:
|
|
1104
|
+
targetFps: Q((l = a.face) == null ? void 0 : l.targetFps, n.face.targetFps, "trackers.face.targetFps", s),
|
|
1105
|
+
holdMs: U((p = a.face) == null ? void 0 : p.holdMs, n.face.holdMs, 0, 5e3, "trackers.face.holdMs", s),
|
|
1106
|
+
predictMs: U(
|
|
1100
1107
|
(m = a.face) == null ? void 0 : m.predictMs,
|
|
1101
1108
|
n.face.predictMs,
|
|
1102
1109
|
0,
|
|
@@ -1104,7 +1111,7 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1104
1111
|
"trackers.face.predictMs",
|
|
1105
1112
|
s
|
|
1106
1113
|
),
|
|
1107
|
-
smoothing:
|
|
1114
|
+
smoothing: U(
|
|
1108
1115
|
(f = a.face) == null ? void 0 : f.smoothing,
|
|
1109
1116
|
n.face.smoothing,
|
|
1110
1117
|
0,
|
|
@@ -1114,38 +1121,38 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1114
1121
|
)
|
|
1115
1122
|
},
|
|
1116
1123
|
hand: {
|
|
1117
|
-
enabled:
|
|
1118
|
-
targetFps:
|
|
1124
|
+
enabled: G((u = a.hand) == null ? void 0 : u.enabled, n.hand.enabled, "trackers.hand.enabled", s),
|
|
1125
|
+
targetFps: Q((d = a.hand) == null ? void 0 : d.targetFps, n.hand.targetFps, "trackers.hand.targetFps", s)
|
|
1119
1126
|
},
|
|
1120
1127
|
gesture: {
|
|
1121
|
-
enabled:
|
|
1122
|
-
targetFps:
|
|
1123
|
-
(
|
|
1128
|
+
enabled: G((g = a.gesture) == null ? void 0 : g.enabled, n.gesture.enabled, "trackers.gesture.enabled", s),
|
|
1129
|
+
targetFps: Q(
|
|
1130
|
+
(M = a.gesture) == null ? void 0 : M.targetFps,
|
|
1124
1131
|
n.gesture.targetFps,
|
|
1125
1132
|
"trackers.gesture.targetFps",
|
|
1126
1133
|
s
|
|
1127
1134
|
)
|
|
1128
1135
|
},
|
|
1129
1136
|
body: {
|
|
1130
|
-
enabled:
|
|
1131
|
-
targetFps:
|
|
1137
|
+
enabled: G((h = a.body) == null ? void 0 : h.enabled, n.body.enabled, "trackers.body.enabled", s),
|
|
1138
|
+
targetFps: Q((S = a.body) == null ? void 0 : S.targetFps, n.body.targetFps, "trackers.body.targetFps", s)
|
|
1132
1139
|
},
|
|
1133
1140
|
holistic: {
|
|
1134
|
-
enabled:
|
|
1135
|
-
targetFps:
|
|
1136
|
-
(
|
|
1141
|
+
enabled: G((b = a.holistic) == null ? void 0 : b.enabled, n.holistic.enabled, "trackers.holistic.enabled", s),
|
|
1142
|
+
targetFps: Q(
|
|
1143
|
+
(I = a.holistic) == null ? void 0 : I.targetFps,
|
|
1137
1144
|
n.holistic.targetFps,
|
|
1138
1145
|
"trackers.holistic.targetFps",
|
|
1139
1146
|
s
|
|
1140
1147
|
),
|
|
1141
|
-
hands:
|
|
1142
|
-
(
|
|
1148
|
+
hands: H(
|
|
1149
|
+
(T = a.holistic) == null ? void 0 : T.hands,
|
|
1143
1150
|
["both", "left", "right", "none"],
|
|
1144
1151
|
n.holistic.hands,
|
|
1145
1152
|
"trackers.holistic.hands",
|
|
1146
1153
|
s
|
|
1147
1154
|
),
|
|
1148
|
-
holdMs:
|
|
1155
|
+
holdMs: U(
|
|
1149
1156
|
(w = a.holistic) == null ? void 0 : w.holdMs,
|
|
1150
1157
|
n.holistic.holdMs,
|
|
1151
1158
|
0,
|
|
@@ -1153,8 +1160,8 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1153
1160
|
"trackers.holistic.holdMs",
|
|
1154
1161
|
s
|
|
1155
1162
|
),
|
|
1156
|
-
predictMs:
|
|
1157
|
-
(
|
|
1163
|
+
predictMs: U(
|
|
1164
|
+
(N = a.holistic) == null ? void 0 : N.predictMs,
|
|
1158
1165
|
n.holistic.predictMs,
|
|
1159
1166
|
0,
|
|
1160
1167
|
1e3,
|
|
@@ -1162,8 +1169,8 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1162
1169
|
s
|
|
1163
1170
|
),
|
|
1164
1171
|
analysisMaxDimension: Math.round(
|
|
1165
|
-
|
|
1166
|
-
(
|
|
1172
|
+
U(
|
|
1173
|
+
(B = a.holistic) == null ? void 0 : B.analysisMaxDimension,
|
|
1167
1174
|
n.holistic.analysisMaxDimension,
|
|
1168
1175
|
128,
|
|
1169
1176
|
2048,
|
|
@@ -1171,13 +1178,13 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1171
1178
|
s
|
|
1172
1179
|
)
|
|
1173
1180
|
),
|
|
1174
|
-
outputFaceBlendshapes:
|
|
1175
|
-
(
|
|
1181
|
+
outputFaceBlendshapes: G(
|
|
1182
|
+
($ = a.holistic) == null ? void 0 : $.outputFaceBlendshapes,
|
|
1176
1183
|
n.holistic.outputFaceBlendshapes,
|
|
1177
1184
|
"trackers.holistic.outputFaceBlendshapes",
|
|
1178
1185
|
s
|
|
1179
1186
|
),
|
|
1180
|
-
confidence:
|
|
1187
|
+
confidence: U(
|
|
1181
1188
|
(te = a.holistic) == null ? void 0 : te.confidence,
|
|
1182
1189
|
n.holistic.confidence,
|
|
1183
1190
|
0,
|
|
@@ -1185,7 +1192,7 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1185
1192
|
"trackers.holistic.confidence",
|
|
1186
1193
|
s
|
|
1187
1194
|
),
|
|
1188
|
-
delegate:
|
|
1195
|
+
delegate: H(
|
|
1189
1196
|
(re = a.holistic) == null ? void 0 : re.delegate,
|
|
1190
1197
|
["auto", "GPU", "CPU"],
|
|
1191
1198
|
n.holistic.delegate,
|
|
@@ -1194,14 +1201,14 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1194
1201
|
)
|
|
1195
1202
|
},
|
|
1196
1203
|
segmentation: {
|
|
1197
|
-
enabled:
|
|
1198
|
-
(
|
|
1204
|
+
enabled: G(
|
|
1205
|
+
(Y = a.segmentation) == null ? void 0 : Y.enabled,
|
|
1199
1206
|
n.segmentation.enabled,
|
|
1200
1207
|
"trackers.segmentation.enabled",
|
|
1201
1208
|
s
|
|
1202
1209
|
),
|
|
1203
|
-
quality:
|
|
1204
|
-
(
|
|
1210
|
+
quality: H(
|
|
1211
|
+
(E = a.segmentation) == null ? void 0 : E.quality,
|
|
1205
1212
|
["low", "medium", "high"],
|
|
1206
1213
|
n.segmentation.quality,
|
|
1207
1214
|
"trackers.segmentation.quality",
|
|
@@ -1209,20 +1216,20 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1209
1216
|
)
|
|
1210
1217
|
},
|
|
1211
1218
|
semanticSegmentation: {
|
|
1212
|
-
enabled:
|
|
1219
|
+
enabled: G(
|
|
1213
1220
|
(C = a.semanticSegmentation) == null ? void 0 : C.enabled,
|
|
1214
1221
|
n.semanticSegmentation.enabled,
|
|
1215
1222
|
"trackers.semanticSegmentation.enabled",
|
|
1216
1223
|
s
|
|
1217
1224
|
),
|
|
1218
|
-
preset:
|
|
1219
|
-
(
|
|
1225
|
+
preset: H(
|
|
1226
|
+
(A = a.semanticSegmentation) == null ? void 0 : A.preset,
|
|
1220
1227
|
Ft,
|
|
1221
1228
|
n.semanticSegmentation.preset,
|
|
1222
1229
|
"trackers.semanticSegmentation.preset",
|
|
1223
1230
|
s
|
|
1224
1231
|
),
|
|
1225
|
-
quality:
|
|
1232
|
+
quality: H(
|
|
1226
1233
|
(v = a.semanticSegmentation) == null ? void 0 : v.quality,
|
|
1227
1234
|
["low", "medium", "high"],
|
|
1228
1235
|
n.semanticSegmentation.quality,
|
|
@@ -1232,11 +1239,11 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1232
1239
|
}
|
|
1233
1240
|
},
|
|
1234
1241
|
perf: {
|
|
1235
|
-
targetFps:
|
|
1236
|
-
camRes: Math.round(
|
|
1237
|
-
cameraZoom:
|
|
1238
|
-
analysisScale:
|
|
1239
|
-
(
|
|
1242
|
+
targetFps: U((Z = e.perf) == null ? void 0 : Z.targetFps, t.perf.targetFps, 0, 120, "perf.targetFps", s),
|
|
1243
|
+
camRes: Math.round(U((j = e.perf) == null ? void 0 : j.camRes, t.perf.camRes, 160, 3840, "perf.camRes", s)),
|
|
1244
|
+
cameraZoom: U((L = e.perf) == null ? void 0 : L.cameraZoom, t.perf.cameraZoom, 1, 3, "perf.cameraZoom", s),
|
|
1245
|
+
analysisScale: U(
|
|
1246
|
+
(J = e.perf) == null ? void 0 : J.analysisScale,
|
|
1240
1247
|
t.perf.analysisScale,
|
|
1241
1248
|
0.25,
|
|
1242
1249
|
1,
|
|
@@ -1245,16 +1252,16 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1245
1252
|
)
|
|
1246
1253
|
},
|
|
1247
1254
|
lifecycle: {
|
|
1248
|
-
pauseWhenHidden:
|
|
1255
|
+
pauseWhenHidden: G(
|
|
1249
1256
|
(fe = e.lifecycle) == null ? void 0 : fe.pauseWhenHidden,
|
|
1250
1257
|
t.lifecycle.pauseWhenHidden,
|
|
1251
1258
|
"lifecycle.pauseWhenHidden",
|
|
1252
1259
|
s
|
|
1253
1260
|
)
|
|
1254
1261
|
},
|
|
1255
|
-
quality:
|
|
1262
|
+
quality: i,
|
|
1256
1263
|
camera: {
|
|
1257
|
-
facingMode:
|
|
1264
|
+
facingMode: H(
|
|
1258
1265
|
(pe = e.camera) == null ? void 0 : pe.facingMode,
|
|
1259
1266
|
["user", "environment"],
|
|
1260
1267
|
t.camera.facingMode,
|
|
@@ -1265,14 +1272,14 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1265
1272
|
mirrored: ((ge = e.camera) == null ? void 0 : ge.mirrored) === void 0 ? t.camera.mirrored : e.camera.mirrored === "auto" || typeof e.camera.mirrored == "boolean" ? e.camera.mirrored : (s('camera.mirrored: must be boolean or "auto", kept base'), t.camera.mirrored)
|
|
1266
1273
|
},
|
|
1267
1274
|
fallbacks: {
|
|
1268
|
-
onUnsupported:
|
|
1275
|
+
onUnsupported: H(
|
|
1269
1276
|
(ye = e.fallbacks) == null ? void 0 : ye.onUnsupported,
|
|
1270
1277
|
["block", "degrade"],
|
|
1271
1278
|
t.fallbacks.onUnsupported,
|
|
1272
1279
|
"fallbacks.onUnsupported",
|
|
1273
1280
|
s
|
|
1274
1281
|
),
|
|
1275
|
-
delegate:
|
|
1282
|
+
delegate: H(
|
|
1276
1283
|
(Se = e.fallbacks) == null ? void 0 : Se.delegate,
|
|
1277
1284
|
["auto", "GPU", "CPU"],
|
|
1278
1285
|
t.fallbacks.delegate,
|
|
@@ -1296,7 +1303,7 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1296
1303
|
},
|
|
1297
1304
|
updatedAt: typeof e.updatedAt == "number" && Number.isFinite(e.updatedAt) ? e.updatedAt : t.updatedAt
|
|
1298
1305
|
};
|
|
1299
|
-
}, we = (e, t, r = Date.now()) =>
|
|
1306
|
+
}, we = (e, t, r = Date.now()) => K({ ...t, updatedAt: r }, e), ze = (e) => JSON.stringify(K({}, e)), qe = (e) => {
|
|
1300
1307
|
const t = [];
|
|
1301
1308
|
let r = e;
|
|
1302
1309
|
if (typeof e == "string")
|
|
@@ -1304,21 +1311,21 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1304
1311
|
r = JSON.parse(e);
|
|
1305
1312
|
} catch {
|
|
1306
1313
|
return {
|
|
1307
|
-
config:
|
|
1314
|
+
config: K(),
|
|
1308
1315
|
migrated: !0,
|
|
1309
1316
|
warnings: ["not valid JSON; defaults used"]
|
|
1310
1317
|
};
|
|
1311
1318
|
}
|
|
1312
1319
|
if (!r || typeof r != "object")
|
|
1313
1320
|
return {
|
|
1314
|
-
config:
|
|
1321
|
+
config: K(),
|
|
1315
1322
|
migrated: !0,
|
|
1316
1323
|
warnings: ["not an object; defaults used"]
|
|
1317
1324
|
};
|
|
1318
1325
|
const s = r, a = s.version !== oe;
|
|
1319
1326
|
return a && t.push(
|
|
1320
1327
|
`migrated from version ${String(s.version ?? "none")} to ${oe}`
|
|
1321
|
-
), { config:
|
|
1328
|
+
), { config: K(s, Ge, t), migrated: a, warnings: t };
|
|
1322
1329
|
}, Ss = [
|
|
1323
1330
|
"face",
|
|
1324
1331
|
"hand",
|
|
@@ -1340,21 +1347,21 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1340
1347
|
facingMode: e.camera.facingMode,
|
|
1341
1348
|
...e.camera.deviceId ? { deviceId: e.camera.deviceId } : {},
|
|
1342
1349
|
...e.camera.mirrored === "auto" ? {} : { mirrored: e.camera.mirrored }
|
|
1343
|
-
}),
|
|
1350
|
+
}), q = (e) => e === null ? {} : { targetFps: e }, hr = (e, t) => {
|
|
1344
1351
|
const r = e.trackers;
|
|
1345
1352
|
return {
|
|
1346
1353
|
face: {
|
|
1347
1354
|
numFaces: r.face.numFaces,
|
|
1348
|
-
...
|
|
1355
|
+
...q(r.face.targetFps),
|
|
1349
1356
|
holdMs: r.face.holdMs,
|
|
1350
1357
|
predictMs: r.face.predictMs,
|
|
1351
1358
|
active: r.face.enabled
|
|
1352
1359
|
},
|
|
1353
|
-
hand: { ...
|
|
1354
|
-
gesture: { ...
|
|
1360
|
+
hand: { ...q(r.hand.targetFps), active: r.hand.enabled },
|
|
1361
|
+
gesture: { ...q(r.gesture.targetFps), active: r.gesture.enabled },
|
|
1355
1362
|
body: { active: r.body.enabled },
|
|
1356
1363
|
holistic: {
|
|
1357
|
-
...
|
|
1364
|
+
...q(r.holistic.targetFps),
|
|
1358
1365
|
hands: r.holistic.hands,
|
|
1359
1366
|
holdMs: r.holistic.holdMs,
|
|
1360
1367
|
predictMs: r.holistic.predictMs,
|
|
@@ -1376,17 +1383,17 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1376
1383
|
const r = e.trackers;
|
|
1377
1384
|
switch (t) {
|
|
1378
1385
|
case _.FACE_TRACKER:
|
|
1379
|
-
return { numFaces: r.face.numFaces, ...
|
|
1386
|
+
return { numFaces: r.face.numFaces, ...q(r.face.targetFps) };
|
|
1380
1387
|
case _.HAND_TRACKER:
|
|
1381
|
-
return { ...
|
|
1388
|
+
return { ...q(r.hand.targetFps) };
|
|
1382
1389
|
case _.GESTURE_TRACKER:
|
|
1383
|
-
return { ...
|
|
1390
|
+
return { ...q(r.gesture.targetFps) };
|
|
1384
1391
|
case _.BODY_TRACKER:
|
|
1385
|
-
return { ...
|
|
1392
|
+
return { ...q(r.body.targetFps) };
|
|
1386
1393
|
case _.HOLISTIC_TRACKER: {
|
|
1387
1394
|
const s = r.holistic;
|
|
1388
1395
|
return {
|
|
1389
|
-
...
|
|
1396
|
+
...q(s.targetFps),
|
|
1390
1397
|
hands: s.hands,
|
|
1391
1398
|
holdMs: s.holdMs,
|
|
1392
1399
|
predictMs: s.predictMs,
|
|
@@ -1443,54 +1450,54 @@ const rr = (e, t, r) => e === "infinite" || e === "loop" && t < Math.max(1, Math
|
|
|
1443
1450
|
} catch {
|
|
1444
1451
|
}
|
|
1445
1452
|
}, Ts = (e = {}) => {
|
|
1446
|
-
const { storageKey: t = ie, persist: r = !0 } = e, s = e.storage, a =
|
|
1447
|
-
f.current =
|
|
1453
|
+
const { storageKey: t = ie, persist: r = !0 } = e, s = e.storage, a = R(e.initial), n = W(() => K(a.current ?? {}), []), [i, c] = k(n), [o, l] = k([]), [p, m] = k(!r), f = R(i);
|
|
1454
|
+
f.current = i, x(() => {
|
|
1448
1455
|
if (!r) {
|
|
1449
1456
|
m(!0);
|
|
1450
1457
|
return;
|
|
1451
1458
|
}
|
|
1452
|
-
const
|
|
1453
|
-
if (
|
|
1454
|
-
const S =
|
|
1455
|
-
f.current = S, c(S), l(
|
|
1459
|
+
const h = Sr(t, s);
|
|
1460
|
+
if (h) {
|
|
1461
|
+
const S = K(h.config, n);
|
|
1462
|
+
f.current = S, c(S), l(h.warnings), h.migrated && De(S, t, s);
|
|
1456
1463
|
}
|
|
1457
1464
|
m(!0);
|
|
1458
1465
|
}, [r, t, s, n]);
|
|
1459
1466
|
const u = F(
|
|
1460
|
-
(
|
|
1467
|
+
(h, S) => (f.current = h, c(h), l(S), r && De(h, t, s), h),
|
|
1461
1468
|
[r, t, s]
|
|
1462
1469
|
), d = F(
|
|
1463
|
-
(
|
|
1464
|
-
const S = [],
|
|
1465
|
-
return u(
|
|
1470
|
+
(h) => {
|
|
1471
|
+
const S = [], b = K({ ...h, updatedAt: Date.now() }, f.current, S);
|
|
1472
|
+
return u(b, S);
|
|
1466
1473
|
},
|
|
1467
1474
|
[u]
|
|
1468
1475
|
), g = F(() => {
|
|
1469
|
-
const
|
|
1470
|
-
return f.current =
|
|
1471
|
-
}, [n, r, t, s]),
|
|
1472
|
-
(
|
|
1473
|
-
const S = qe(
|
|
1474
|
-
return S.warnings.some((
|
|
1476
|
+
const h = we(n, {}, 0);
|
|
1477
|
+
return f.current = h, c(h), l([]), r && Tr(t, s), h;
|
|
1478
|
+
}, [n, r, t, s]), M = F(
|
|
1479
|
+
(h) => {
|
|
1480
|
+
const S = qe(h);
|
|
1481
|
+
return S.warnings.some((b) => b.startsWith("not valid JSON") || b.startsWith("not an object")) ? (l([`import: ${S.warnings[0]}; config unchanged`]), f.current) : u(we(S.config, {}, Date.now()), S.warnings);
|
|
1475
1482
|
},
|
|
1476
1483
|
[u]
|
|
1477
1484
|
);
|
|
1478
|
-
return
|
|
1485
|
+
return W(
|
|
1479
1486
|
() => ({
|
|
1480
|
-
config:
|
|
1481
|
-
hydrated:
|
|
1482
|
-
warnings:
|
|
1487
|
+
config: i,
|
|
1488
|
+
hydrated: p,
|
|
1489
|
+
warnings: o,
|
|
1483
1490
|
update: d,
|
|
1484
1491
|
reset: g,
|
|
1485
|
-
importJson:
|
|
1486
|
-
json: ze(
|
|
1487
|
-
providerProps: fr(
|
|
1488
|
-
cameraRequest: pr(
|
|
1489
|
-
trackerProps: (
|
|
1490
|
-
modelOptions: (
|
|
1491
|
-
enabledModels: yr(
|
|
1492
|
+
importJson: M,
|
|
1493
|
+
json: ze(i),
|
|
1494
|
+
providerProps: fr(i),
|
|
1495
|
+
cameraRequest: pr(i),
|
|
1496
|
+
trackerProps: (h) => hr(i, h),
|
|
1497
|
+
modelOptions: (h) => gr(i, h),
|
|
1498
|
+
enabledModels: yr(i)
|
|
1492
1499
|
}),
|
|
1493
|
-
[
|
|
1500
|
+
[i, p, o, d, g, M]
|
|
1494
1501
|
);
|
|
1495
1502
|
};
|
|
1496
1503
|
export {
|
|
@@ -1503,23 +1510,23 @@ export {
|
|
|
1503
1510
|
ms as CameraPermissionGate,
|
|
1504
1511
|
_n as DEFAULT_ASSET_BUDGET_BYTES,
|
|
1505
1512
|
un as DEFAULT_MATERIAL_FILL,
|
|
1506
|
-
|
|
1513
|
+
Ae as DEFAULT_MESH_RENDERER,
|
|
1507
1514
|
En as DEFAULT_MESH_RENDERER_RENDER_STATE,
|
|
1508
1515
|
bs as DEFAULT_PERFORMANCE_BUDGET,
|
|
1509
|
-
|
|
1510
|
-
|
|
1516
|
+
As as DEFAULT_PIXEL_SNAP_INCREMENT,
|
|
1517
|
+
Rs as DEFAULT_QUALITY_TIERS,
|
|
1511
1518
|
Fs as DEFAULT_REFERENCE_PIXELS_PER_UNIT,
|
|
1512
|
-
|
|
1519
|
+
Ua as DEFAULT_SCREEN_GLASS,
|
|
1513
1520
|
dn as DEFAULT_SCREEN_GRADIENT,
|
|
1514
|
-
|
|
1515
|
-
|
|
1521
|
+
Na as DEFAULT_SCREEN_IMAGE_SCENE_SETTINGS,
|
|
1522
|
+
Pa as DEFAULT_SCREEN_IMAGE_SETTINGS,
|
|
1516
1523
|
La as DEFAULT_SCREEN_SHAPE_SETTINGS,
|
|
1517
1524
|
Ia as DEFAULT_SCREEN_TEXT_SCENE_SETTINGS,
|
|
1518
1525
|
Oa as DEFAULT_SCREEN_TEXT_SHADOW_LAYER,
|
|
1519
|
-
|
|
1520
|
-
|
|
1526
|
+
xs as DEFAULT_SCREEN_TRANSFORM_2D,
|
|
1527
|
+
Cs as DEFAULT_SCREEN_TRANSFORM_ROOT,
|
|
1521
1528
|
Ge as DEFAULT_TRACKING_CONFIG,
|
|
1522
|
-
|
|
1529
|
+
V as DEFAULT_TRANSFORM_3D,
|
|
1523
1530
|
mn as EXTERNAL_BACKGROUND_RENDER_LAYER,
|
|
1524
1531
|
gt as FULL_SCREEN_ANCHORS,
|
|
1525
1532
|
Vr as HtmlRegion,
|
|
@@ -1528,8 +1535,8 @@ export {
|
|
|
1528
1535
|
Ja as LookAt,
|
|
1529
1536
|
fn as MAX_RENDER_GROUP_PASSES,
|
|
1530
1537
|
pn as MaterialFill,
|
|
1531
|
-
|
|
1532
|
-
|
|
1538
|
+
Rn as MeshMaterial,
|
|
1539
|
+
Rt as MeshRenderer,
|
|
1533
1540
|
Kr as Model,
|
|
1534
1541
|
jr as Object3D,
|
|
1535
1542
|
zr as Panel,
|
|
@@ -1554,7 +1561,7 @@ export {
|
|
|
1554
1561
|
oe as TRACKING_CONFIG_VERSION,
|
|
1555
1562
|
wa as TextLabel,
|
|
1556
1563
|
Hr as ThemeProvider,
|
|
1557
|
-
|
|
1564
|
+
At as Transform3D,
|
|
1558
1565
|
qr as VideoBackground,
|
|
1559
1566
|
kn as XRAssetCache,
|
|
1560
1567
|
hs as XRAssetCacheProvider,
|
|
@@ -1565,20 +1572,20 @@ export {
|
|
|
1565
1572
|
_a as XRScene,
|
|
1566
1573
|
ws as XR_FALLBACK_MESSAGES,
|
|
1567
1574
|
Ds as XR_MODEL_ASSET_URLS,
|
|
1568
|
-
|
|
1575
|
+
P as audio,
|
|
1569
1576
|
Ye as canPromptForCamera,
|
|
1570
1577
|
Tr as clearTrackingConfig,
|
|
1571
|
-
|
|
1578
|
+
Us as clientToScreenPixels,
|
|
1572
1579
|
St as computeContainScale,
|
|
1573
|
-
|
|
1574
|
-
|
|
1580
|
+
Ns as computeFeedCrop,
|
|
1581
|
+
Ps as computeFitLayout,
|
|
1575
1582
|
vn as createAssetCache,
|
|
1576
1583
|
Ls as createFallbackReason,
|
|
1577
1584
|
gn as createTwoStopGradient,
|
|
1578
1585
|
es as dataURLtoFile,
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1586
|
+
Un as defineGltfAsset,
|
|
1587
|
+
Nn as defineTextureAsset,
|
|
1588
|
+
Pn as defineVideoAsset,
|
|
1582
1589
|
Is as detectXRCapabilities,
|
|
1583
1590
|
Ln as disposeObject3D,
|
|
1584
1591
|
ja as drawNormalizedCrop,
|
|
@@ -1593,7 +1600,7 @@ export {
|
|
|
1593
1600
|
Ws as feedToViewport,
|
|
1594
1601
|
Bs as feedToWorld,
|
|
1595
1602
|
ps as findCameraByFacing,
|
|
1596
|
-
|
|
1603
|
+
Pe as getDefaultAssetCache,
|
|
1597
1604
|
yn as getRenderGroupLayer,
|
|
1598
1605
|
Mt as goToScene,
|
|
1599
1606
|
$s as isFeedPointInSource,
|
|
@@ -1633,7 +1640,7 @@ export {
|
|
|
1633
1640
|
sa as resolveQualityConfig,
|
|
1634
1641
|
aa as resolveScreenTransform2D,
|
|
1635
1642
|
na as resolveTrackerSupport,
|
|
1636
|
-
|
|
1643
|
+
K as resolveTrackingConfig,
|
|
1637
1644
|
De as saveTrackingConfig,
|
|
1638
1645
|
oa as screenPixelsToClient,
|
|
1639
1646
|
ia as screenPixelsToFeed,
|
|
@@ -1648,7 +1655,7 @@ export {
|
|
|
1648
1655
|
ze as serializeTrackingConfig,
|
|
1649
1656
|
is as setMuted,
|
|
1650
1657
|
ht as shouldDrawFallback,
|
|
1651
|
-
|
|
1658
|
+
ee as smoothNumber,
|
|
1652
1659
|
Or as smoothVector2,
|
|
1653
1660
|
Gr as smoothVector3,
|
|
1654
1661
|
ga as sourceToFeed,
|
|
@@ -1675,12 +1682,12 @@ export {
|
|
|
1675
1682
|
gs as useXRAsset,
|
|
1676
1683
|
Oe as useXRAssetCache,
|
|
1677
1684
|
ys as useXRAssetStats,
|
|
1678
|
-
|
|
1685
|
+
xn as useXRCapabilities,
|
|
1679
1686
|
wn as useXRQuality,
|
|
1680
1687
|
Ts as useXRTrackingConfig,
|
|
1681
1688
|
ba as viewportSizeToTransform2DPixels,
|
|
1682
|
-
|
|
1683
|
-
|
|
1689
|
+
Aa as viewportToFeed,
|
|
1690
|
+
Ra as worldToFeed,
|
|
1684
1691
|
Fa as worldToScreenPixels,
|
|
1685
|
-
|
|
1692
|
+
xa as worldToTracker
|
|
1686
1693
|
};
|