@vincentt-xr/sdk 2.0.0-alpha.0 → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GROUNDING.md +232 -14
- package/dist/{DebuggerUI-CEfdddkZ.cjs → DebuggerUI-CatYc-RG.cjs} +1 -1
- package/dist/{DebuggerUI-Dgop6Q6o.js → DebuggerUI-gLMKiVwJ.js} +1 -1
- package/dist/MediaSourceSwitcher-C-xYg0nQ.js +317 -0
- package/dist/MediaSourceSwitcher-Cq3g4IKw.cjs +31 -0
- package/dist/components/FaceMesh/canonical/CanonicalFaceMeshRenderer.d.ts +6 -1
- package/dist/components/FaceMesh/material/defaults.d.ts +4 -0
- package/dist/components/FaceMesh/material/types.d.ts +2 -0
- package/dist/components/FaceRetouch/Background.d.ts +6 -1
- package/dist/components/FaceRetouch/defaults.d.ts +13 -0
- package/dist/components/FaceRetouch/index.d.ts +3 -1
- package/dist/components/FaceRetouch/landmarkMask.d.ts +4 -1
- package/dist/components/FaceRetouch/useFaceRetouchMask.d.ts +2 -1
- package/dist/components/FaceWarp3D/FaceWarp3DHead.d.ts +15 -0
- package/dist/components/FaceWarp3D/defaults.d.ts +37 -0
- package/dist/components/FaceWarp3D/index.d.ts +3 -0
- package/dist/components/FaceWarp3D/warp.d.ts +13 -0
- package/dist/components/HandJoints2D/index.d.ts +6 -0
- package/dist/components/HandTracker/index.d.ts +2 -2
- package/dist/components/HandTracking2D/HandVisual.d.ts +12 -0
- package/dist/components/HandTracking2D/index.d.ts +5 -0
- package/dist/components/HandTracking2DController/index.d.ts +5 -0
- package/dist/components/HandTracking3D/index.d.ts +6 -0
- package/dist/components/ScreenImage/index.d.ts +87 -0
- package/dist/components/ScreenText/index.d.ts +20 -0
- package/dist/components/TextLabel/index.d.ts +99 -0
- package/dist/components/XRScene/index.d.ts +14 -3
- package/dist/components/XRViewport/index.d.ts +17 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/debug-ui/default-setting/index.d.ts +37 -0
- package/dist/debug-ui/default-setting.cjs +21 -0
- package/dist/debug-ui/default-setting.js +777 -0
- package/dist/debug-ui/face-warp-3d/index.d.ts +6 -0
- package/dist/debug-ui/hand-joints-2d/index.d.ts +6 -0
- package/dist/debug-ui/hand-tracking-2d/index.d.ts +6 -0
- package/dist/debug-ui/hand-tracking-2d-controller/index.d.ts +6 -0
- package/dist/debug-ui/hand-tracking-3d/index.d.ts +6 -0
- package/dist/debug-ui/index.d.ts +23 -0
- package/dist/debug-ui/layer-panel/index.d.ts +17 -0
- package/dist/debug-ui/media-source/MediaSourceSwitcher.d.ts +10 -0
- package/dist/debug-ui/media-source/index.d.ts +4 -0
- package/dist/debug-ui/media-source/media-preset.d.ts +9 -0
- package/dist/debug-ui/media-source.cjs +1 -0
- package/dist/debug-ui/media-source.js +7 -0
- package/dist/debug-ui/screen-image-settings/index.d.ts +7 -0
- package/dist/debug-ui/screen-text-settings/index.d.ts +122 -0
- package/dist/debug-ui/settings-panel/index.d.ts +38 -0
- package/dist/debug-ui/shared/MaterialSection.d.ts +13 -0
- package/dist/debug-ui/shared/ScreenTransformSection.d.ts +29 -0
- package/dist/debug-ui.cjs +20 -0
- package/dist/debug-ui.js +6063 -0
- package/dist/defaults-BLpcN3pG.cjs +1 -0
- package/dist/defaults-LtY4M7dg.js +55 -0
- package/dist/entries/core.d.ts +5 -1
- package/dist/entries/face-effects.d.ts +2 -0
- package/dist/entries/low-level.d.ts +3 -0
- package/dist/face-effects.cjs +113 -23
- package/dist/face-effects.js +1566 -1399
- package/dist/handJoints2d.d.ts +49 -0
- package/dist/handTracking2d.d.ts +33 -0
- package/dist/handTracking2dController.d.ts +65 -0
- package/dist/handTracking3d.d.ts +52 -0
- package/dist/{index-BD-JWMjE.js → index-BGNbrc4C.js} +113 -137
- package/dist/index-BXyObVHF.cjs +1 -0
- package/dist/index-CY3bUAcW.js +12 -0
- package/dist/index-C_Duh13c.cjs +1 -0
- package/dist/index-D8fpPQkC.cjs +1 -0
- package/dist/index-DxshgBu0.cjs +1 -0
- package/dist/index-O-2crZ3M.js +1102 -0
- package/dist/{index-CYMj26Ej.js → index-safCs_af.js} +426 -416
- package/dist/{internal-DH5d1Xnq.cjs → internal-BjyhBP8i.cjs} +1 -1
- package/dist/{internal-KOKJDxCG.js → internal-Cae1ps15.js} +3 -3
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +2 -2
- package/dist/layerStack.d.ts +29 -0
- package/dist/low-level.cjs +1 -1
- package/dist/low-level.js +74 -890
- package/dist/main.cjs +73 -1
- package/dist/main.js +1656 -407
- package/dist/models/Hand/HandTracking.d.ts +2 -0
- package/dist/screen2d/index.d.ts +4 -0
- package/dist/screen2d/material-runtime.d.ts +32 -0
- package/dist/screen2d/texture.d.ts +10 -0
- package/dist/screen2d/transform.d.ts +25 -0
- package/dist/screen2d/types.d.ts +90 -0
- package/dist/screenImagePresets.d.ts +13 -0
- package/dist/screenImageSettings-6NRg4cx9.js +39 -0
- package/dist/screenImageSettings-y_B4_767.cjs +1 -0
- package/dist/screenImageSettings.d.ts +50 -0
- package/dist/screenTextPresets.d.ts +6 -0
- package/dist/screenTextSettings.d.ts +131 -0
- package/dist/{selectors-Bub0o3qy.cjs → selectors-BLl2JUWW.cjs} +1 -1
- package/dist/{selectors-BHO6TnoC.js → selectors-CXd_x-6t.js} +6 -6
- package/dist/tracking.cjs +1 -1
- package/dist/tracking.js +193 -168
- package/dist/types/hand-tracking.d.ts +8 -0
- package/dist/types/nodes.d.ts +2 -0
- package/dist/useXRModel-3DcUa28n.cjs +1 -0
- package/dist/useXRModel-BMJE1hrk.js +28 -0
- package/dist/x-Co8jPhP0.js +127 -0
- package/dist/x-KC8E4Gaj.cjs +41 -0
- package/package.json +19 -1
- package/dist/index-B5J4gzn2.cjs +0 -1
- package/dist/index-BVBVg96G.cjs +0 -1
- package/dist/index-DtwHElmG.js +0 -157
- package/dist/index-PtFmD6B8.cjs +0 -1
package/dist/low-level.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { u as
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
import { PerspectiveCamera as Re } from "@react-three/drei";
|
|
13
|
-
const Ee = {
|
|
1
|
+
import { H as T, u as F } from "./index-BGNbrc4C.js";
|
|
2
|
+
import { u as P } from "./useXRModel-BMJE1hrk.js";
|
|
3
|
+
import { b as E, a as z, d as L, e as V, u as A, c as I } from "./selectors-CXd_x-6t.js";
|
|
4
|
+
import { useState as d, useEffect as m } from "react";
|
|
5
|
+
import { c as f } from "./useFaceResults-cpsSmKKc.js";
|
|
6
|
+
import { S as U, X as D, a as H, d as j, b as q, c as W, r as Y, g as _, u as G, f as J, e as K } from "./index-O-2crZ3M.js";
|
|
7
|
+
import { h as Z } from "./hasFullUnitUVBounds-BGvcFsQM.js";
|
|
8
|
+
import { u as ee } from "./index-safCs_af.js";
|
|
9
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
10
|
+
import { PerspectiveCamera as h } from "@react-three/drei";
|
|
11
|
+
const x = {
|
|
14
12
|
position: "absolute",
|
|
15
13
|
top: -28,
|
|
16
14
|
left: 0,
|
|
@@ -21,13 +19,13 @@ const Ee = {
|
|
|
21
19
|
fontWeight: 700,
|
|
22
20
|
padding: "4px 8px",
|
|
23
21
|
whiteSpace: "nowrap"
|
|
24
|
-
},
|
|
22
|
+
}, b = ({
|
|
25
23
|
boundingBox: e,
|
|
26
24
|
label: t = "face bounding box",
|
|
27
|
-
color:
|
|
28
|
-
style:
|
|
29
|
-
labelStyle:
|
|
30
|
-
}) => /* @__PURE__ */
|
|
25
|
+
color: o = "#22c55e",
|
|
26
|
+
style: s,
|
|
27
|
+
labelStyle: n
|
|
28
|
+
}) => /* @__PURE__ */ u(
|
|
31
29
|
"div",
|
|
32
30
|
{
|
|
33
31
|
style: {
|
|
@@ -36,29 +34,29 @@ const Ee = {
|
|
|
36
34
|
top: `${e.top * 100}%`,
|
|
37
35
|
width: `${e.width * 100}%`,
|
|
38
36
|
height: `${e.height * 100}%`,
|
|
39
|
-
border: `3px solid ${
|
|
37
|
+
border: `3px solid ${o}`,
|
|
40
38
|
boxSizing: "border-box",
|
|
41
39
|
pointerEvents: "none",
|
|
42
40
|
zIndex: 20,
|
|
43
|
-
...
|
|
41
|
+
...s
|
|
44
42
|
},
|
|
45
|
-
children: t !== null && /* @__PURE__ */
|
|
43
|
+
children: t !== null && /* @__PURE__ */ u("div", { style: { ...x, ...n }, children: t })
|
|
46
44
|
}
|
|
47
|
-
),
|
|
48
|
-
const { makeDefault: t = !0, ...
|
|
45
|
+
), v = (e) => {
|
|
46
|
+
const { makeDefault: t = !0, ...o } = e, s = {
|
|
49
47
|
position: [0, 0, 40],
|
|
50
48
|
fov: 30,
|
|
51
49
|
near: 0.1,
|
|
52
50
|
far: 1e3,
|
|
53
51
|
makeDefault: t,
|
|
54
|
-
...
|
|
52
|
+
...o
|
|
55
53
|
};
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
-
},
|
|
54
|
+
return /* @__PURE__ */ u(h, { ...s });
|
|
55
|
+
}, w = ({
|
|
58
56
|
background: e = "#000",
|
|
59
57
|
children: t,
|
|
60
|
-
style:
|
|
61
|
-
}) => /* @__PURE__ */
|
|
58
|
+
style: o
|
|
59
|
+
}) => /* @__PURE__ */ u(
|
|
62
60
|
"div",
|
|
63
61
|
{
|
|
64
62
|
style: {
|
|
@@ -66,876 +64,62 @@ const Ee = {
|
|
|
66
64
|
inset: 0,
|
|
67
65
|
overflow: "hidden",
|
|
68
66
|
background: e,
|
|
69
|
-
...
|
|
67
|
+
...o
|
|
70
68
|
},
|
|
71
69
|
children: t
|
|
72
70
|
}
|
|
73
|
-
),
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
inset: 0,
|
|
84
|
-
overflow: "hidden",
|
|
85
|
-
background: t.clearColor,
|
|
86
|
-
pointerEvents: t.pointerEvents ?? "none",
|
|
87
|
-
zIndex: t.zIndex,
|
|
88
|
-
opacity: t.hidden ? 0 : 1,
|
|
89
|
-
...n
|
|
90
|
-
},
|
|
91
|
-
children: e
|
|
92
|
-
}
|
|
93
|
-
), j = ({
|
|
94
|
-
canvas: e,
|
|
95
|
-
layout: t,
|
|
96
|
-
media: n,
|
|
97
|
-
mirrored: a,
|
|
98
|
-
filter: r
|
|
99
|
-
}) => {
|
|
100
|
-
const i = Math.round(t.destination.width), s = Math.round(t.destination.height);
|
|
101
|
-
e.width !== i && (e.width = i), e.height !== s && (e.height = s);
|
|
102
|
-
const o = e.getContext("2d");
|
|
103
|
-
o && (o.setTransform(1, 0, 0, 1, 0, 0), o.clearRect(0, 0, i, s), a && (o.translate(i, 0), o.scale(-1, 1)), r && (o.filter = r), o.drawImage(n, t.offsetX, t.offsetY, t.drawWidth, t.drawHeight), r && (o.filter = "none"), o.setTransform(1, 0, 0, 1, 0, 0));
|
|
104
|
-
}, ne = ({
|
|
105
|
-
canvasRef: e,
|
|
106
|
-
enabled: t = !0,
|
|
107
|
-
fps: n = 30,
|
|
108
|
-
imageRef: a,
|
|
109
|
-
layout: r,
|
|
110
|
-
mirrored: i,
|
|
111
|
-
sourceKind: s,
|
|
112
|
-
videoRef: o
|
|
113
|
-
}) => {
|
|
114
|
-
M(() => {
|
|
115
|
-
if (!t) {
|
|
116
|
-
const p = e.current, c = p == null ? void 0 : p.getContext("2d");
|
|
117
|
-
p && c && c.clearRect(0, 0, p.width, p.height);
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
let h = 0, m = 0;
|
|
121
|
-
const d = n > 0 ? 1e3 / n : 0, g = (p) => {
|
|
122
|
-
if (h = requestAnimationFrame(g), d > 0 && p - m < d) return;
|
|
123
|
-
m = p;
|
|
124
|
-
const c = e.current;
|
|
125
|
-
if (!c || !r) return;
|
|
126
|
-
if (s === "image") {
|
|
127
|
-
const w = a.current;
|
|
128
|
-
if (!w || !w.complete || w.naturalWidth <= 0 || w.naturalHeight <= 0)
|
|
129
|
-
return;
|
|
130
|
-
j({
|
|
131
|
-
canvas: c,
|
|
132
|
-
layout: r,
|
|
133
|
-
media: w,
|
|
134
|
-
mirrored: i
|
|
135
|
-
});
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
const b = o.current;
|
|
139
|
-
!b || b.readyState < 2 || b.videoWidth <= 0 || b.videoHeight <= 0 || j({
|
|
140
|
-
canvas: c,
|
|
141
|
-
layout: r,
|
|
142
|
-
media: b,
|
|
143
|
-
mirrored: i
|
|
144
|
-
});
|
|
145
|
-
};
|
|
146
|
-
return h = requestAnimationFrame(g), () => {
|
|
147
|
-
cancelAnimationFrame(h);
|
|
148
|
-
};
|
|
149
|
-
}, [e, t, n, a, r, i, s, o]);
|
|
150
|
-
}, Se = ({
|
|
151
|
-
canvasRef: e,
|
|
152
|
-
imageRef: t,
|
|
153
|
-
layer: n,
|
|
154
|
-
layout: a,
|
|
155
|
-
mirrored: r,
|
|
156
|
-
sourceKind: i,
|
|
157
|
-
videoRef: s
|
|
158
|
-
}) => (ne({
|
|
159
|
-
canvasRef: e,
|
|
160
|
-
imageRef: t,
|
|
161
|
-
layout: a,
|
|
162
|
-
mirrored: r,
|
|
163
|
-
sourceKind: i,
|
|
164
|
-
videoRef: s
|
|
165
|
-
}), /* @__PURE__ */ f($, { config: n, children: /* @__PURE__ */ f(
|
|
166
|
-
"canvas",
|
|
167
|
-
{
|
|
168
|
-
ref: e,
|
|
169
|
-
style: {
|
|
170
|
-
position: "absolute",
|
|
171
|
-
inset: 0,
|
|
172
|
-
width: "100%",
|
|
173
|
-
height: "100%",
|
|
174
|
-
display: "block",
|
|
175
|
-
background: "#000"
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
) })), rt = ({
|
|
179
|
-
canvasRef: e,
|
|
180
|
-
controlInsetTop: t,
|
|
181
|
-
debugVisible: n,
|
|
182
|
-
fps: a = 15,
|
|
183
|
-
imageRef: r,
|
|
184
|
-
layer: i,
|
|
185
|
-
layout: s,
|
|
186
|
-
mirrored: o,
|
|
187
|
-
sourceKind: h,
|
|
188
|
-
videoRef: m,
|
|
189
|
-
viewportSize: d
|
|
190
|
-
}) => {
|
|
191
|
-
ne({
|
|
192
|
-
canvasRef: e,
|
|
193
|
-
enabled: n,
|
|
194
|
-
fps: a,
|
|
195
|
-
imageRef: r,
|
|
196
|
-
layout: s,
|
|
197
|
-
mirrored: o,
|
|
198
|
-
sourceKind: h,
|
|
199
|
-
videoRef: m
|
|
200
|
-
});
|
|
201
|
-
const g = Math.min(220, Math.max(120, d.width * 0.22)), p = d.width > 0 && d.height > 0 ? d.width / d.height : 1, c = Math.min(d.height - 24, Math.max(t ?? 16, 16));
|
|
202
|
-
return /* @__PURE__ */ f($, { config: i, children: /* @__PURE__ */ f(
|
|
203
|
-
"canvas",
|
|
204
|
-
{
|
|
205
|
-
ref: e,
|
|
206
|
-
style: {
|
|
207
|
-
position: "absolute",
|
|
208
|
-
left: 16,
|
|
209
|
-
top: c,
|
|
210
|
-
width: n ? g : 1,
|
|
211
|
-
height: n ? "auto" : 1,
|
|
212
|
-
aspectRatio: `${p}`,
|
|
213
|
-
opacity: n ? 0.85 : 0,
|
|
214
|
-
borderRadius: 10,
|
|
215
|
-
border: n ? "1px solid rgba(255,255,255,0.16)" : "none",
|
|
216
|
-
pointerEvents: "none",
|
|
217
|
-
objectFit: "contain",
|
|
218
|
-
background: "#000"
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
) });
|
|
222
|
-
}, Ie = 5, Fe = 1, Me = (e, t) => t, ke = "brightness(2.2) contrast(1.5) saturate(1.25)", ze = ({
|
|
223
|
-
enabled: e,
|
|
224
|
-
displayMirrored: t,
|
|
225
|
-
imageRef: n,
|
|
226
|
-
layout: a,
|
|
227
|
-
mode: r,
|
|
228
|
-
numFaces: i,
|
|
229
|
-
selectedSource: s,
|
|
230
|
-
sourceStream: o,
|
|
231
|
-
videoRef: h
|
|
232
|
-
}) => {
|
|
233
|
-
const { session: m } = ye(), d = k(null), g = k(!1), p = k(document.createElement("canvas")), {
|
|
234
|
-
ready: c,
|
|
235
|
-
node: b,
|
|
236
|
-
error: w
|
|
237
|
-
} = he(re.FACE_TRACKER, {
|
|
238
|
-
numFaces: i ?? (r === "head-binding" ? Fe : Ie)
|
|
239
|
-
}), [S, v] = y("idle"), [A, I] = y(null), F = e && c && !!b, L = te({
|
|
240
|
-
node: F ? b : null,
|
|
241
|
-
enabled: F,
|
|
242
|
-
selectedSource: s,
|
|
243
|
-
onFrame: fe(() => {
|
|
244
|
-
I(null), v("ready");
|
|
245
|
-
}, [])
|
|
246
|
-
});
|
|
247
|
-
return M(() => {
|
|
248
|
-
if (!e || !a) return;
|
|
249
|
-
const u = () => {
|
|
250
|
-
const x = s === "image" ? n.current : h.current;
|
|
251
|
-
if (x) {
|
|
252
|
-
if (x instanceof HTMLImageElement) {
|
|
253
|
-
if (!x.complete || x.naturalWidth <= 0 || x.naturalHeight <= 0) return;
|
|
254
|
-
} else if (x.readyState < 2 || x.videoWidth <= 0 || x.videoHeight <= 0)
|
|
255
|
-
return;
|
|
256
|
-
j({
|
|
257
|
-
canvas: p.current,
|
|
258
|
-
layout: a,
|
|
259
|
-
media: x,
|
|
260
|
-
mirrored: t,
|
|
261
|
-
filter: s === "webcam" ? ke : void 0
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
if (s === "image") {
|
|
266
|
-
u();
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
let l = 0;
|
|
270
|
-
const C = () => {
|
|
271
|
-
l = requestAnimationFrame(C), u();
|
|
272
|
-
};
|
|
273
|
-
return l = requestAnimationFrame(C), () => cancelAnimationFrame(l);
|
|
274
|
-
}, [t, e, n, a, s, h]), M(() => {
|
|
275
|
-
var T;
|
|
276
|
-
if (!e) {
|
|
277
|
-
v("idle"), I(null), g.current = !1, d.current = null;
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
if (!a) {
|
|
281
|
-
v("initializing");
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
const u = (o == null ? void 0 : o.id) ?? (((T = h.current) == null ? void 0 : T.srcObject) instanceof MediaStream ? h.current.srcObject.id : "none"), C = s === "webcam" ? `webcam:${u}` : s;
|
|
285
|
-
d.current !== C && (g.current = !1, d.current = C);
|
|
286
|
-
let x = !1;
|
|
287
|
-
return (async () => {
|
|
288
|
-
try {
|
|
289
|
-
if (v("initializing"), g.current || (await m.setFrameSource({
|
|
290
|
-
canvas: p.current,
|
|
291
|
-
sourceKind: s
|
|
292
|
-
}), await m.start(), g.current = !0), x) return;
|
|
293
|
-
I(null), v("initializing");
|
|
294
|
-
} catch (E) {
|
|
295
|
-
if (x) return;
|
|
296
|
-
v("error"), I(E instanceof Error ? E.message : "Failed to initialize SDK face tracking");
|
|
297
|
-
}
|
|
298
|
-
})(), () => {
|
|
299
|
-
x = !0;
|
|
300
|
-
};
|
|
301
|
-
}, [e, a, s, m, o, h]), M(() => {
|
|
302
|
-
!F && e && !w && v("initializing");
|
|
303
|
-
}, [F, e, w]), M(() => {
|
|
304
|
-
w && (v("error"), I(w.message));
|
|
305
|
-
}, [w]), M(() => () => {
|
|
306
|
-
g.current = !1, m.stop();
|
|
307
|
-
}, [m]), {
|
|
308
|
-
activeDelegate: "GPU",
|
|
309
|
-
faces: L,
|
|
310
|
-
status: S,
|
|
311
|
-
error: A
|
|
312
|
-
};
|
|
313
|
-
}, ie = pe(null), Te = {
|
|
314
|
-
audio: !1,
|
|
315
|
-
video: {
|
|
316
|
-
facingMode: "user",
|
|
317
|
-
frameRate: { ideal: 30, max: 60 }
|
|
318
|
-
}
|
|
319
|
-
}, Xe = {
|
|
320
|
-
name: "viewport-live",
|
|
321
|
-
clearColor: "#000000",
|
|
322
|
-
pointerEvents: "none",
|
|
323
|
-
zIndex: 0
|
|
324
|
-
}, Ae = {
|
|
325
|
-
name: "viewport-ui",
|
|
326
|
-
clearColor: "transparent",
|
|
327
|
-
pointerEvents: "auto",
|
|
328
|
-
zIndex: 5
|
|
329
|
-
}, Le = {
|
|
330
|
-
name: "viewport-scene",
|
|
331
|
-
clearColor: "transparent",
|
|
332
|
-
pointerEvents: "auto",
|
|
333
|
-
zIndex: 1
|
|
334
|
-
}, X = {
|
|
335
|
-
webcam: { icon: "◉", label: "Webcam" },
|
|
336
|
-
image: { icon: "▣", label: "Images" },
|
|
337
|
-
video: { icon: "▶", label: "Videos" }
|
|
338
|
-
}, K = ({ children: e }) => /* @__PURE__ */ f(q, { children: e });
|
|
339
|
-
K.displayName = "XRViewport.Scene";
|
|
340
|
-
const O = ({ children: e }) => /* @__PURE__ */ f(q, { children: e });
|
|
341
|
-
O.displayName = "XRViewport.Overlay";
|
|
342
|
-
const We = (e) => {
|
|
343
|
-
if (!e)
|
|
344
|
-
return { width: 0, height: 0 };
|
|
345
|
-
const t = e.getBoundingClientRect();
|
|
346
|
-
return {
|
|
347
|
-
width: t.width || e.clientWidth,
|
|
348
|
-
height: t.height || e.clientHeight
|
|
349
|
-
};
|
|
350
|
-
}, Be = (e) => {
|
|
351
|
-
const [t, n] = y({ width: 0, height: 0 });
|
|
352
|
-
return be(() => {
|
|
353
|
-
const a = e.current;
|
|
354
|
-
if (!a) return;
|
|
355
|
-
let r = 0;
|
|
356
|
-
const i = () => {
|
|
357
|
-
const m = We(a);
|
|
358
|
-
n(
|
|
359
|
-
(d) => d.width === m.width && d.height === m.height ? d : m
|
|
360
|
-
);
|
|
361
|
-
};
|
|
362
|
-
i(), r = requestAnimationFrame(i);
|
|
363
|
-
const s = new ResizeObserver(() => {
|
|
364
|
-
i(), r && cancelAnimationFrame(r), r = requestAnimationFrame(i);
|
|
365
|
-
});
|
|
366
|
-
s.observe(a);
|
|
367
|
-
const o = window.visualViewport, h = () => {
|
|
368
|
-
i(), r && cancelAnimationFrame(r), r = requestAnimationFrame(i);
|
|
369
|
-
};
|
|
370
|
-
return window.addEventListener("resize", h), window.addEventListener("orientationchange", h), o == null || o.addEventListener("resize", h), o == null || o.addEventListener("scroll", h), () => {
|
|
371
|
-
r && cancelAnimationFrame(r), s.disconnect(), window.removeEventListener("resize", h), window.removeEventListener("orientationchange", h), o == null || o.removeEventListener("resize", h), o == null || o.removeEventListener("scroll", h);
|
|
372
|
-
};
|
|
373
|
-
}, [e]), t;
|
|
374
|
-
}, J = (e) => {
|
|
375
|
-
e && (e.pause(), e.removeAttribute("src"), e.srcObject = null, e.load());
|
|
376
|
-
}, Q = (e) => {
|
|
377
|
-
e && e.removeAttribute("src");
|
|
378
|
-
}, He = ({
|
|
379
|
-
enabled: e,
|
|
380
|
-
imageAsset: t,
|
|
381
|
-
selectedSource: n,
|
|
382
|
-
videoAsset: a
|
|
383
|
-
}) => {
|
|
384
|
-
const r = k(null), i = k(null), [s, o] = y(null), [h, m] = y({ width: 0, height: 0 }), [d, g] = y("idle"), [p, c] = y(null);
|
|
385
|
-
return M(() => {
|
|
386
|
-
if (!e) {
|
|
387
|
-
J(r.current), Q(i.current), o(null), m({ width: 0, height: 0 }), g("idle"), c(null);
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
let b = !1, w = null;
|
|
391
|
-
const S = (u, l) => {
|
|
392
|
-
b || (m({ width: u, height: l }), g("ready"), c(null));
|
|
393
|
-
}, v = () => {
|
|
394
|
-
J(r.current), Q(i.current), w == null || w.getTracks().forEach((u) => u.stop()), w = null, o(null);
|
|
395
|
-
}, A = async () => {
|
|
396
|
-
g("requesting");
|
|
397
|
-
const u = await navigator.mediaDevices.getUserMedia(Te);
|
|
398
|
-
if (b) {
|
|
399
|
-
u.getTracks().forEach((C) => C.stop());
|
|
400
|
-
return;
|
|
401
|
-
}
|
|
402
|
-
w = u, o(u);
|
|
403
|
-
const l = r.current;
|
|
404
|
-
l && (l.srcObject = u, l.muted = !0, l.playsInline = !0, l.autoplay = !0, await l.play(), S(l.videoWidth, l.videoHeight));
|
|
405
|
-
}, I = async (u) => {
|
|
406
|
-
g("requesting"), o(null);
|
|
407
|
-
const l = r.current;
|
|
408
|
-
l && (l.src = u, l.muted = !0, l.loop = !0, l.playsInline = !0, l.autoplay = !0, l.crossOrigin = "anonymous", await l.play(), S(l.videoWidth, l.videoHeight));
|
|
409
|
-
}, F = async (u) => {
|
|
410
|
-
g("requesting"), o(null);
|
|
411
|
-
const l = i.current;
|
|
412
|
-
l && (await new Promise((C, x) => {
|
|
413
|
-
l.onload = () => C(), l.onerror = () => x(new Error("Unable to load image")), l.src = u;
|
|
414
|
-
}), S(l.naturalWidth, l.naturalHeight));
|
|
415
|
-
};
|
|
416
|
-
return v(), (async () => {
|
|
417
|
-
try {
|
|
418
|
-
if (n === "webcam") {
|
|
419
|
-
await A();
|
|
420
|
-
return;
|
|
421
|
-
}
|
|
422
|
-
if (n === "video") {
|
|
423
|
-
if (!(a != null && a.src))
|
|
424
|
-
throw new Error("Missing video source");
|
|
425
|
-
await I(a.src);
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
|
-
if (!(t != null && t.src))
|
|
429
|
-
throw new Error("Missing image source");
|
|
430
|
-
await F(t.src);
|
|
431
|
-
} catch (u) {
|
|
432
|
-
if (b) return;
|
|
433
|
-
g("error"), c(u instanceof Error ? u.message : `Unable to initialize ${n}`);
|
|
434
|
-
}
|
|
435
|
-
})(), () => {
|
|
436
|
-
b = !0, v();
|
|
437
|
-
};
|
|
438
|
-
}, [e, t, n, a]), {
|
|
439
|
-
videoRef: r,
|
|
440
|
-
imageRef: i,
|
|
441
|
-
stream: s,
|
|
442
|
-
mediaSize: h,
|
|
443
|
-
status: d,
|
|
444
|
-
error: p
|
|
445
|
-
};
|
|
446
|
-
}, Ve = (e, t) => e === "auto" ? t === "webcam" ? "cover" : "contain" : e, De = ({
|
|
447
|
-
imageOptions: e,
|
|
448
|
-
initialImageId: t,
|
|
449
|
-
initialSource: n,
|
|
450
|
-
initialVideoId: a,
|
|
451
|
-
source: r,
|
|
452
|
-
videoOptions: i
|
|
453
|
-
}) => {
|
|
454
|
-
var d, g, p, c;
|
|
455
|
-
const s = (r == null ? void 0 : r.kind) ?? n ?? "webcam", o = s === "image" && e.length === 0 || s === "video" && i.length === 0 ? "webcam" : s, h = (r == null ? void 0 : r.kind) === "image" ? r.assetId ?? ((d = e[0]) == null ? void 0 : d.id) ?? "" : t ?? ((g = e[0]) == null ? void 0 : g.id) ?? "", m = (r == null ? void 0 : r.kind) === "video" ? r.assetId ?? ((p = i[0]) == null ? void 0 : p.id) ?? "" : a ?? ((c = i[0]) == null ? void 0 : c.id) ?? "";
|
|
456
|
-
return {
|
|
457
|
-
selectedSource: o,
|
|
458
|
-
selectedImageId: h,
|
|
459
|
-
selectedVideoId: m
|
|
460
|
-
};
|
|
461
|
-
}, _e = (e, t, n) => {
|
|
462
|
-
if (e.width <= 0 || e.height <= 0 || t.width <= 0 || t.height <= 0)
|
|
463
|
-
return null;
|
|
464
|
-
const a = n === "contain" ? Math.min(t.width / e.width, t.height / e.height) : Math.max(t.width / e.width, t.height / e.height), r = e.width * a, i = e.height * a, s = (t.width - r) * 0.5, o = (t.height - i) * 0.5;
|
|
465
|
-
return {
|
|
466
|
-
source: e,
|
|
467
|
-
destination: t,
|
|
468
|
-
drawWidth: r,
|
|
469
|
-
drawHeight: i,
|
|
470
|
-
offsetX: s,
|
|
471
|
-
offsetY: o,
|
|
472
|
-
scale: a
|
|
473
|
-
};
|
|
474
|
-
}, $e = (e, t) => {
|
|
475
|
-
if (e === "dom")
|
|
476
|
-
return {
|
|
477
|
-
sceneContent: null,
|
|
478
|
-
overlayContent: t
|
|
479
|
-
};
|
|
480
|
-
let n = null, a = null;
|
|
481
|
-
const r = [];
|
|
482
|
-
return we.forEach(t, (i) => {
|
|
483
|
-
var o;
|
|
484
|
-
if (!ve(i)) {
|
|
485
|
-
i != null && r.push(i);
|
|
486
|
-
return;
|
|
487
|
-
}
|
|
488
|
-
const s = (o = i.type) == null ? void 0 : o.displayName;
|
|
489
|
-
if (s === K.displayName) {
|
|
490
|
-
n = i.props.children;
|
|
491
|
-
return;
|
|
492
|
-
}
|
|
493
|
-
if (s === O.displayName) {
|
|
494
|
-
a = i.props.children;
|
|
495
|
-
return;
|
|
496
|
-
}
|
|
497
|
-
r.push(i);
|
|
498
|
-
}), !a && r.length > 0 && (a = r), {
|
|
499
|
-
sceneContent: n,
|
|
500
|
-
overlayContent: a
|
|
501
|
-
};
|
|
502
|
-
}, Z = (e, t) => typeof e == "function" ? e(t) : e, nt = () => ge(ie), qe = ({
|
|
503
|
-
imageRef: e,
|
|
504
|
-
selectedSource: t,
|
|
505
|
-
videoRef: n
|
|
506
|
-
}) => /* @__PURE__ */ z(q, { children: [
|
|
507
|
-
/* @__PURE__ */ f(
|
|
508
|
-
"video",
|
|
509
|
-
{
|
|
510
|
-
ref: n,
|
|
511
|
-
style: {
|
|
512
|
-
position: "absolute",
|
|
513
|
-
width: 1,
|
|
514
|
-
height: 1,
|
|
515
|
-
opacity: t === "image" ? 0 : 1e-3,
|
|
516
|
-
pointerEvents: "none"
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
),
|
|
520
|
-
/* @__PURE__ */ f(
|
|
521
|
-
"img",
|
|
522
|
-
{
|
|
523
|
-
ref: e,
|
|
524
|
-
alt: "",
|
|
525
|
-
style: {
|
|
526
|
-
position: "absolute",
|
|
527
|
-
width: 1,
|
|
528
|
-
height: 1,
|
|
529
|
-
opacity: t === "image" ? 1e-3 : 0,
|
|
530
|
-
pointerEvents: "none"
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
)
|
|
534
|
-
] }), ee = ({
|
|
535
|
-
dock: e,
|
|
536
|
-
label: t,
|
|
537
|
-
onChange: n,
|
|
538
|
-
options: a,
|
|
539
|
-
value: r
|
|
540
|
-
}) => /* @__PURE__ */ f(
|
|
541
|
-
"div",
|
|
542
|
-
{
|
|
543
|
-
style: {
|
|
544
|
-
position: "absolute",
|
|
545
|
-
top: e === "top-left" ? 74 : void 0,
|
|
546
|
-
bottom: e === "bottom-left" ? 74 : void 0,
|
|
547
|
-
left: 16,
|
|
548
|
-
zIndex: 5,
|
|
549
|
-
maxWidth: "calc(100vw - 32px)",
|
|
550
|
-
padding: 10,
|
|
551
|
-
borderRadius: 14,
|
|
552
|
-
background: "rgba(15, 23, 42, 0.72)",
|
|
553
|
-
border: "1px solid rgba(255,255,255,0.12)",
|
|
554
|
-
boxShadow: "0 12px 30px rgba(0,0,0,0.18)",
|
|
555
|
-
backdropFilter: "blur(10px)"
|
|
556
|
-
},
|
|
557
|
-
children: /* @__PURE__ */ z(
|
|
558
|
-
"label",
|
|
559
|
-
{
|
|
560
|
-
style: {
|
|
561
|
-
display: "grid",
|
|
562
|
-
gap: 6,
|
|
563
|
-
color: "#e5eefb",
|
|
564
|
-
fontSize: 12,
|
|
565
|
-
fontWeight: 700
|
|
566
|
-
},
|
|
567
|
-
children: [
|
|
568
|
-
/* @__PURE__ */ f("span", { children: t }),
|
|
569
|
-
/* @__PURE__ */ f(
|
|
570
|
-
"select",
|
|
571
|
-
{
|
|
572
|
-
value: r,
|
|
573
|
-
onChange: (i) => n(i.target.value),
|
|
574
|
-
style: {
|
|
575
|
-
minWidth: 180,
|
|
576
|
-
maxWidth: "calc(100vw - 52px)",
|
|
577
|
-
height: 36,
|
|
578
|
-
borderRadius: 10,
|
|
579
|
-
border: "1px solid rgba(255,255,255,0.12)",
|
|
580
|
-
background: "rgba(255,255,255,0.06)",
|
|
581
|
-
color: "#e5eefb",
|
|
582
|
-
padding: "0 10px"
|
|
583
|
-
},
|
|
584
|
-
children: a.map((i) => /* @__PURE__ */ f("option", { value: i.id, style: { color: "#111827" }, children: i.label }, i.id))
|
|
585
|
-
}
|
|
586
|
-
)
|
|
587
|
-
]
|
|
588
|
-
}
|
|
589
|
-
)
|
|
590
|
-
}
|
|
591
|
-
), Ne = ({
|
|
592
|
-
dock: e,
|
|
593
|
-
imageOptions: t,
|
|
594
|
-
selectedImageId: n,
|
|
595
|
-
selectedSource: a,
|
|
596
|
-
selectedVideoId: r,
|
|
597
|
-
setSelectedImageId: i,
|
|
598
|
-
setSelectedSource: s,
|
|
599
|
-
setSelectedVideoId: o,
|
|
600
|
-
showMediaControls: h,
|
|
601
|
-
videoOptions: m
|
|
602
|
-
}) => {
|
|
603
|
-
const [d, g] = y(!1), p = ["webcam", "image", "video"].filter((c) => c === "image" ? t.length > 0 : c === "video" ? m.length > 0 : !0);
|
|
604
|
-
return h ? d ? /* @__PURE__ */ f(
|
|
605
|
-
"button",
|
|
606
|
-
{
|
|
607
|
-
type: "button",
|
|
608
|
-
onClick: () => g(!1),
|
|
609
|
-
"aria-label": "Open media controls",
|
|
610
|
-
title: "Open media controls",
|
|
611
|
-
style: {
|
|
612
|
-
position: "absolute",
|
|
613
|
-
top: e === "top-left" ? 16 : void 0,
|
|
614
|
-
bottom: e === "bottom-left" ? 16 : void 0,
|
|
615
|
-
left: 16,
|
|
616
|
-
zIndex: 5,
|
|
617
|
-
width: 40,
|
|
618
|
-
height: 40,
|
|
619
|
-
border: "1px solid rgba(255,255,255,0.12)",
|
|
620
|
-
borderRadius: 999,
|
|
621
|
-
background: "rgba(15, 23, 42, 0.72)",
|
|
622
|
-
color: "#e5eefb",
|
|
623
|
-
boxShadow: "0 12px 30px rgba(0,0,0,0.18)",
|
|
624
|
-
backdropFilter: "blur(10px)",
|
|
625
|
-
cursor: "pointer"
|
|
626
|
-
},
|
|
627
|
-
children: "≡"
|
|
628
|
-
}
|
|
629
|
-
) : /* @__PURE__ */ z(q, { children: [
|
|
630
|
-
/* @__PURE__ */ z(
|
|
631
|
-
"div",
|
|
632
|
-
{
|
|
633
|
-
style: {
|
|
634
|
-
position: "absolute",
|
|
635
|
-
top: e === "top-left" ? 16 : void 0,
|
|
636
|
-
bottom: e === "bottom-left" ? 16 : void 0,
|
|
637
|
-
left: 16,
|
|
638
|
-
zIndex: 5,
|
|
639
|
-
display: "inline-flex",
|
|
640
|
-
alignItems: "center",
|
|
641
|
-
gap: 8,
|
|
642
|
-
maxWidth: "calc(100vw - 32px)"
|
|
643
|
-
},
|
|
644
|
-
children: [
|
|
645
|
-
/* @__PURE__ */ f(
|
|
646
|
-
"div",
|
|
647
|
-
{
|
|
648
|
-
style: {
|
|
649
|
-
display: "inline-flex",
|
|
650
|
-
alignItems: "center",
|
|
651
|
-
gap: 8,
|
|
652
|
-
padding: 8,
|
|
653
|
-
borderRadius: 999,
|
|
654
|
-
background: "rgba(15, 23, 42, 0.72)",
|
|
655
|
-
border: "1px solid rgba(255,255,255,0.12)",
|
|
656
|
-
boxShadow: "0 12px 30px rgba(0,0,0,0.18)",
|
|
657
|
-
backdropFilter: "blur(10px)",
|
|
658
|
-
overflowX: "auto"
|
|
659
|
-
},
|
|
660
|
-
children: p.map((c) => {
|
|
661
|
-
const b = c === a;
|
|
662
|
-
return /* @__PURE__ */ z(
|
|
663
|
-
"button",
|
|
664
|
-
{
|
|
665
|
-
type: "button",
|
|
666
|
-
onClick: () => s(c),
|
|
667
|
-
"aria-pressed": b,
|
|
668
|
-
title: X[c].label,
|
|
669
|
-
style: {
|
|
670
|
-
border: "none",
|
|
671
|
-
borderRadius: 999,
|
|
672
|
-
minWidth: 42,
|
|
673
|
-
height: 42,
|
|
674
|
-
padding: "0 12px",
|
|
675
|
-
display: "inline-flex",
|
|
676
|
-
alignItems: "center",
|
|
677
|
-
justifyContent: "center",
|
|
678
|
-
gap: 8,
|
|
679
|
-
background: b ? "rgba(56, 189, 248, 0.18)" : "rgba(255,255,255,0.04)",
|
|
680
|
-
color: b ? "#e0f2fe" : "rgba(229,238,251,0.82)",
|
|
681
|
-
cursor: "pointer",
|
|
682
|
-
flex: "0 0 auto"
|
|
683
|
-
},
|
|
684
|
-
children: [
|
|
685
|
-
/* @__PURE__ */ f("span", { style: { fontSize: 14, lineHeight: 1 }, children: X[c].icon }),
|
|
686
|
-
/* @__PURE__ */ f("span", { style: { fontSize: 12, fontWeight: 700, letterSpacing: "0.01em" }, children: X[c].label })
|
|
687
|
-
]
|
|
688
|
-
},
|
|
689
|
-
c
|
|
690
|
-
);
|
|
691
|
-
})
|
|
692
|
-
}
|
|
693
|
-
),
|
|
694
|
-
/* @__PURE__ */ f(
|
|
695
|
-
"button",
|
|
696
|
-
{
|
|
697
|
-
type: "button",
|
|
698
|
-
onClick: () => g(!0),
|
|
699
|
-
"aria-label": "Close media controls",
|
|
700
|
-
title: "Close media controls",
|
|
701
|
-
style: {
|
|
702
|
-
width: 40,
|
|
703
|
-
height: 40,
|
|
704
|
-
border: "1px solid rgba(255,255,255,0.12)",
|
|
705
|
-
borderRadius: 999,
|
|
706
|
-
background: "rgba(15, 23, 42, 0.72)",
|
|
707
|
-
color: "#e5eefb",
|
|
708
|
-
boxShadow: "0 12px 30px rgba(0,0,0,0.18)",
|
|
709
|
-
backdropFilter: "blur(10px)",
|
|
710
|
-
cursor: "pointer",
|
|
711
|
-
flex: "0 0 auto"
|
|
712
|
-
},
|
|
713
|
-
children: "×"
|
|
714
|
-
}
|
|
715
|
-
)
|
|
716
|
-
]
|
|
717
|
-
}
|
|
718
|
-
),
|
|
719
|
-
a === "image" && t.length > 0 && /* @__PURE__ */ f(
|
|
720
|
-
ee,
|
|
721
|
-
{
|
|
722
|
-
dock: e,
|
|
723
|
-
label: "Image Asset",
|
|
724
|
-
options: t,
|
|
725
|
-
value: n,
|
|
726
|
-
onChange: i
|
|
727
|
-
}
|
|
728
|
-
),
|
|
729
|
-
a === "video" && m.length > 0 && /* @__PURE__ */ f(
|
|
730
|
-
ee,
|
|
731
|
-
{
|
|
732
|
-
dock: e,
|
|
733
|
-
label: "Video Asset",
|
|
734
|
-
options: m,
|
|
735
|
-
value: r,
|
|
736
|
-
onChange: o
|
|
737
|
-
}
|
|
738
|
-
)
|
|
739
|
-
] }) : null;
|
|
740
|
-
}, Pe = ({
|
|
741
|
-
enabled: e,
|
|
742
|
-
selectedSource: t
|
|
743
|
-
}) => {
|
|
744
|
-
const n = me(re.FACE_TRACKER);
|
|
745
|
-
return {
|
|
746
|
-
faces: te({ node: n, enabled: e, selectedSource: t }),
|
|
747
|
-
trackerStatus: n ? "ready" : "idle"
|
|
748
|
-
};
|
|
749
|
-
}, oe = ({
|
|
750
|
-
children: e,
|
|
751
|
-
fitMode: t = "auto",
|
|
752
|
-
imageOptions: n = [],
|
|
753
|
-
initialImageId: a,
|
|
754
|
-
initialMirrored: r = !0,
|
|
755
|
-
initialSource: i = "webcam",
|
|
756
|
-
initialVideoId: s,
|
|
757
|
-
mediaStrategy: o = "internal",
|
|
758
|
-
mediaDock: h = "bottom-left",
|
|
759
|
-
mode: m = "dom",
|
|
760
|
-
showMediaControlsByDefault: d = !0,
|
|
761
|
-
source: g,
|
|
762
|
-
style: p,
|
|
763
|
-
videoOptions: c = []
|
|
764
|
-
}) => {
|
|
765
|
-
const b = k(null), w = k(null), S = Be(b), v = G(
|
|
766
|
-
() => De({
|
|
767
|
-
imageOptions: n,
|
|
768
|
-
initialImageId: a,
|
|
769
|
-
initialSource: i,
|
|
770
|
-
initialVideoId: s,
|
|
771
|
-
source: g,
|
|
772
|
-
videoOptions: c
|
|
773
|
-
}),
|
|
774
|
-
[n, a, i, s, g, c]
|
|
775
|
-
), [A, I] = y(r), [F, L] = y(d), [u, l] = y(
|
|
776
|
-
v.selectedSource
|
|
777
|
-
), [C, x] = y(v.selectedImageId), [W, T] = y(v.selectedVideoId), E = o === "internal";
|
|
778
|
-
M(() => {
|
|
779
|
-
g && (l(v.selectedSource), x(v.selectedImageId), T(v.selectedVideoId));
|
|
780
|
-
}, [v, g]);
|
|
781
|
-
const B = n.find((U) => U.id === C) ?? n[0], H = c.find((U) => U.id === W) ?? c[0], R = He({
|
|
782
|
-
enabled: E,
|
|
783
|
-
imageAsset: B,
|
|
784
|
-
selectedSource: u,
|
|
785
|
-
videoAsset: H
|
|
786
|
-
}), N = Ve(t, u), V = G(
|
|
787
|
-
() => _e(R.mediaSize, S, N),
|
|
788
|
-
[R.mediaSize, N, S]
|
|
789
|
-
), P = Me(u, A), D = ze({
|
|
790
|
-
displayMirrored: P,
|
|
791
|
-
enabled: E && R.status === "ready" && V !== null,
|
|
792
|
-
imageRef: R.imageRef,
|
|
793
|
-
layout: V,
|
|
794
|
-
selectedSource: u,
|
|
795
|
-
sourceStream: R.stream,
|
|
796
|
-
videoRef: R.videoRef
|
|
797
|
-
}), Y = Pe({
|
|
798
|
-
enabled: !E,
|
|
799
|
-
selectedSource: u
|
|
800
|
-
}), ae = u === "image" ? `${X.image.label}: ${(B == null ? void 0 : B.label) ?? ""}` : u === "video" ? `${X.video.label}: ${(H == null ? void 0 : H.label) ?? ""}` : X.webcam.label, _ = {
|
|
801
|
-
activeDelegate: E ? D.activeDelegate : null,
|
|
802
|
-
faces: E ? D.faces : Y.faces,
|
|
803
|
-
imageOptions: n,
|
|
804
|
-
layout: V,
|
|
805
|
-
mediaError: R.error,
|
|
806
|
-
mediaFitMode: N,
|
|
807
|
-
mediaLabel: ae,
|
|
808
|
-
mediaStatus: R.status,
|
|
809
|
-
mirrored: P,
|
|
810
|
-
selectedImageId: C,
|
|
811
|
-
selectedSource: u,
|
|
812
|
-
selectedVideoId: W,
|
|
813
|
-
setMirrored: I,
|
|
814
|
-
setSelectedImageId: x,
|
|
815
|
-
setSelectedSource: l,
|
|
816
|
-
setSelectedVideoId: T,
|
|
817
|
-
setShowMediaControls: L,
|
|
818
|
-
showMediaControls: F,
|
|
819
|
-
trackerError: E ? D.error : null,
|
|
820
|
-
trackerStatus: E ? D.status : Y.trackerStatus,
|
|
821
|
-
videoOptions: c,
|
|
822
|
-
viewportSize: S,
|
|
823
|
-
mediaSize: R.mediaSize
|
|
824
|
-
}, se = typeof e == "function" ? e(_) : e, { sceneContent: le, overlayContent: ce } = $e(m, se), de = Z(
|
|
825
|
-
le,
|
|
826
|
-
_
|
|
827
|
-
), ue = Z(
|
|
828
|
-
ce,
|
|
829
|
-
_
|
|
830
|
-
);
|
|
831
|
-
return /* @__PURE__ */ f(ie.Provider, { value: _, children: /* @__PURE__ */ z(
|
|
832
|
-
"div",
|
|
833
|
-
{
|
|
834
|
-
ref: b,
|
|
835
|
-
style: {
|
|
836
|
-
position: "fixed",
|
|
837
|
-
inset: 0,
|
|
838
|
-
overflow: "hidden",
|
|
839
|
-
background: "#000",
|
|
840
|
-
...p
|
|
841
|
-
},
|
|
842
|
-
children: [
|
|
843
|
-
/* @__PURE__ */ f(
|
|
844
|
-
qe,
|
|
845
|
-
{
|
|
846
|
-
imageRef: R.imageRef,
|
|
847
|
-
selectedSource: u,
|
|
848
|
-
videoRef: R.videoRef
|
|
849
|
-
}
|
|
850
|
-
),
|
|
851
|
-
m === "dom" && E && /* @__PURE__ */ f(
|
|
852
|
-
Se,
|
|
853
|
-
{
|
|
854
|
-
canvasRef: w,
|
|
855
|
-
imageRef: R.imageRef,
|
|
856
|
-
videoRef: R.videoRef,
|
|
857
|
-
layer: Xe,
|
|
858
|
-
layout: V,
|
|
859
|
-
mirrored: P,
|
|
860
|
-
sourceKind: u === "image" ? "image" : "video"
|
|
861
|
-
}
|
|
862
|
-
),
|
|
863
|
-
(m === "r3f" || m === "hybrid") && /* @__PURE__ */ f($, { config: Le, children: /* @__PURE__ */ f(Ce, { renderTargetSize: S, style: { width: "100%", height: "100%" }, children: de }) }),
|
|
864
|
-
/* @__PURE__ */ z($, { config: Ae, children: [
|
|
865
|
-
E && /* @__PURE__ */ f(
|
|
866
|
-
Ne,
|
|
867
|
-
{
|
|
868
|
-
dock: h,
|
|
869
|
-
imageOptions: n,
|
|
870
|
-
selectedImageId: C,
|
|
871
|
-
selectedSource: u,
|
|
872
|
-
selectedVideoId: W,
|
|
873
|
-
setSelectedImageId: x,
|
|
874
|
-
setSelectedSource: l,
|
|
875
|
-
setSelectedVideoId: T,
|
|
876
|
-
showMediaControls: F,
|
|
877
|
-
videoOptions: c
|
|
878
|
-
}
|
|
879
|
-
),
|
|
880
|
-
ue
|
|
881
|
-
] })
|
|
882
|
-
]
|
|
883
|
-
}
|
|
884
|
-
) });
|
|
885
|
-
};
|
|
886
|
-
oe.Scene = K;
|
|
887
|
-
oe.Overlay = O;
|
|
888
|
-
const it = (e) => {
|
|
889
|
-
const [t, n] = y(null);
|
|
890
|
-
return M(() => {
|
|
891
|
-
let a = 0;
|
|
892
|
-
const r = () => {
|
|
893
|
-
var h, m;
|
|
894
|
-
a = requestAnimationFrame(r);
|
|
895
|
-
const i = (m = (h = e == null ? void 0 : e.detectionResults) == null ? void 0 : h.faceLandmarks) == null ? void 0 : m[0];
|
|
896
|
-
if (!i || i.length === 0) {
|
|
897
|
-
n(null);
|
|
71
|
+
), C = (e) => {
|
|
72
|
+
const [t, o] = d(null);
|
|
73
|
+
return m(() => {
|
|
74
|
+
let s = 0;
|
|
75
|
+
const n = () => {
|
|
76
|
+
var l, c;
|
|
77
|
+
s = requestAnimationFrame(n);
|
|
78
|
+
const p = (c = (l = e == null ? void 0 : e.detectionResults) == null ? void 0 : l.faceLandmarks) == null ? void 0 : c[0];
|
|
79
|
+
if (!p || p.length === 0) {
|
|
80
|
+
o(null);
|
|
898
81
|
return;
|
|
899
82
|
}
|
|
900
|
-
const
|
|
901
|
-
left:
|
|
902
|
-
top:
|
|
903
|
-
width:
|
|
904
|
-
height:
|
|
83
|
+
const i = f(p), a = {
|
|
84
|
+
left: i.minX,
|
|
85
|
+
top: i.minY,
|
|
86
|
+
width: i.width,
|
|
87
|
+
height: i.height
|
|
905
88
|
};
|
|
906
|
-
|
|
89
|
+
o((r) => r && r.left === a.left && r.top === a.top && r.width === a.width && r.height === a.height ? r : a);
|
|
907
90
|
};
|
|
908
|
-
return
|
|
909
|
-
cancelAnimationFrame(
|
|
91
|
+
return n(), () => {
|
|
92
|
+
cancelAnimationFrame(s);
|
|
910
93
|
};
|
|
911
94
|
}, [e]), t;
|
|
912
|
-
},
|
|
95
|
+
}, y = ["fill", "contain"];
|
|
913
96
|
export {
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
97
|
+
b as BoundingBoxOverlay,
|
|
98
|
+
T as HeadTracker,
|
|
99
|
+
v as PerspectiveCamera,
|
|
100
|
+
U as ScreenRectAspectContext,
|
|
101
|
+
y as TEXTURE_FITS,
|
|
102
|
+
w as XRCompositor,
|
|
103
|
+
D as XRLayer,
|
|
104
|
+
H as XRMediaSurface,
|
|
105
|
+
j as XRTrackingOverlay,
|
|
106
|
+
q as XRViewport,
|
|
107
|
+
f as computeLandmarkBounds,
|
|
108
|
+
W as computeScreenTransform,
|
|
109
|
+
Z as hasFullUnitUVBounds,
|
|
110
|
+
Y as resolveCalibrationFaceDisplayMirrored,
|
|
111
|
+
_ as useCalibrationFaceTracker,
|
|
112
|
+
C as useFaceBoundingBox,
|
|
113
|
+
G as useScreenSpace,
|
|
114
|
+
F as useTrackerContext,
|
|
115
|
+
E as useXRCameraTexture,
|
|
116
|
+
ee as useXRContext,
|
|
117
|
+
z as useXRError,
|
|
118
|
+
P as useXRModel,
|
|
119
|
+
L as useXRModelNode,
|
|
120
|
+
V as useXRPipelineSnapshot,
|
|
121
|
+
A as useXRReady,
|
|
122
|
+
I as useXRRenderSize,
|
|
123
|
+
J as useXRViewportRenderOutputs,
|
|
124
|
+
K as useXRViewportState
|
|
941
125
|
};
|