@vincentt-xr/sdk 2.0.0-alpha.2 → 2.0.0-alpha.3
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 +34 -9
- package/dist/{DebuggerUI-Cq28c18s.js → DebuggerUI-xp4bg3gH.js} +1 -1
- package/dist/{FaceMeshRenderer-6t8OsQhK.js → FaceMeshRenderer-CALA4k49.js} +2 -2
- package/dist/{FaceMeshRenderer-lQLhYIW-.cjs → FaceMeshRenderer-D4PFqsb3.cjs} +1 -1
- package/dist/{FaceRetouch-DtNl8-4e.cjs → FaceRetouch-Bq2rtPlV.cjs} +1 -1
- package/dist/{FaceRetouch-CDrL0pXg.js → FaceRetouch-DF5UsOsZ.js} +29 -29
- package/dist/components/MeshRenderer/index.d.ts +1 -0
- package/dist/components/ScreenImage/source.d.ts +3 -0
- package/dist/contexts-D5TQcwmv.js +660 -0
- package/dist/contexts-Dv1SA0bS.cjs +1 -0
- package/dist/debug-ui.cjs +3 -3
- package/dist/debug-ui.js +1246 -1205
- package/dist/entries/low-level.d.ts +3 -0
- package/dist/face-effects.cjs +1 -1
- package/dist/face-effects.js +3 -3
- package/dist/{getFaceInfo-hUKMLFcr.js → getFaceInfo-Cjcgcc4w.js} +1 -1
- package/dist/{getFaceInfo-CyPAKh3h.cjs → getFaceInfo-oQcP40Ha.cjs} +1 -1
- package/dist/hooks/useXRModel.d.ts +5 -0
- package/dist/{index-DSpzjuqd.cjs → index-Be-S7uSm.cjs} +1 -1
- package/dist/index-DdWBnI7A.cjs +17 -0
- package/dist/{index-Di70KWuY.js → index-DpVIEBHw.js} +844 -825
- package/dist/index-DqhqBi7O.cjs +1 -0
- package/dist/{index-UC0Ux38E.js → index-HxT9XEuh.js} +1 -1
- package/dist/index-N7C6fNah.js +214 -0
- package/dist/index-UU5ODHGU.cjs +1 -0
- package/dist/{index-BgQAX8rs.js → index-YMUaJU7U.js} +122 -119
- package/dist/{internal-DuMPpcbp.js → internal-D7NxAsc6.js} +2 -2
- package/dist/internal.js +1 -1
- package/dist/low-level.cjs +1 -1
- package/dist/low-level.js +399 -490
- package/dist/main.cjs +1 -1
- package/dist/main.js +26 -26
- package/dist/{renderGroups-C9QJrAXu.js → renderGroups-JEXqSACh.js} +1 -1
- package/dist/{renderGroups-Dvm1J4lW.cjs → renderGroups-uXXsFpvw.cjs} +1 -1
- package/dist/{renderPasses-CT5iBwtg.cjs → renderPasses-CVWt0t8m.cjs} +2 -2
- package/dist/{renderPasses-CjgG_6kQ.js → renderPasses-CdGZeHHL.js} +4 -4
- package/dist/scene-object.cjs +1 -1
- package/dist/scene-object.js +2 -2
- package/dist/{selectors-Dw3C-gSk.js → selectors-twqYByYZ.js} +3 -3
- package/dist/texture/animatedTexture.d.ts +2 -0
- package/dist/texture/gifReader.d.ts +17 -0
- package/dist/texture/gifTextureSource.d.ts +16 -0
- package/dist/tracking.cjs +1 -1
- package/dist/tracking.js +8 -8
- package/dist/{useFaceInfo-CwsHZedC.js → useFaceInfo-DOJCGlDG.js} +2 -2
- package/dist/{useFaceInfo-C-WfMlYp.cjs → useFaceInfo-DSUmuzzO.cjs} +1 -1
- package/dist/{useFaceResults-VcFdOUFV.cjs → useFaceResults-B1BSGUAW.cjs} +1 -1
- package/dist/{useFaceResults-CkFc1egZ.js → useFaceResults-CBmhT5E8.js} +1 -1
- package/docs/api/screen-image.mdx +27 -3
- package/docs/api/texture-sources.mdx +25 -6
- package/docs/texture-api-consumer.md +26 -0
- package/package.json +3 -3
- package/dist/contexts-BKvTIayr.cjs +0 -1
- package/dist/contexts-Bk5zz_VR.js +0 -214
- package/dist/index-82aENaRq.cjs +0 -1
- package/dist/index-CEc1CAmB.cjs +0 -1
- package/dist/index-CTHeBQOs.js +0 -178
- package/dist/index-DzEzkBIH.cjs +0 -17
package/dist/low-level.js
CHANGED
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import { u as
|
|
6
|
-
import {
|
|
7
|
-
import { c as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { d as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { u as
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
import { c as $t, d as qt, u as Nt } from "./contexts-Bk5zz_VR.js";
|
|
19
|
-
import * as V from "three";
|
|
20
|
-
const W = ({
|
|
1
|
+
import { u as se, X as O } from "./index-JygePOwo.js";
|
|
2
|
+
import { u as le } from "./index-YMUaJU7U.js";
|
|
3
|
+
import { H as dt, a as ut } from "./index-YMUaJU7U.js";
|
|
4
|
+
import { c as ce } from "./selectors-twqYByYZ.js";
|
|
5
|
+
import { u as mt, b as ft, e as pt, a as gt, d as bt } from "./selectors-twqYByYZ.js";
|
|
6
|
+
import { useEffect as M, useState as S, useRef as X, useCallback as de, useLayoutEffect as ue, useMemo as $, Children as he, isValidElement as me } from "react";
|
|
7
|
+
import { c as fe } from "./getFaceInfo-Cjcgcc4w.js";
|
|
8
|
+
import { d as xt, e as vt } from "./getFaceInfo-Cjcgcc4w.js";
|
|
9
|
+
import { jsx as g, jsxs as k, Fragment as W } from "react/jsx-runtime";
|
|
10
|
+
import { PerspectiveCamera as pe } from "@react-three/drei";
|
|
11
|
+
import { S as Ct, g as St, c as Rt, d as It, u as Et } from "./index-N7C6fNah.js";
|
|
12
|
+
import { u as ee } from "./useFaceResults-CBmhT5E8.js";
|
|
13
|
+
import { h as Ft } from "./hasFullUnitUVBounds-BGvcFsQM.js";
|
|
14
|
+
import { X as ge, a as be, b as we } from "./contexts-D5TQcwmv.js";
|
|
15
|
+
import { B as zt, M as Xt, h as kt, i as At, T as Lt, c as Vt, j as Dt, k as Bt, g as Wt, e as _t, f as Ht, r as Pt, t as $t, d as qt, u as Ut } from "./contexts-D5TQcwmv.js";
|
|
16
|
+
import * as L from "three";
|
|
17
|
+
const B = ({
|
|
21
18
|
children: e,
|
|
22
19
|
config: t,
|
|
23
|
-
style:
|
|
20
|
+
style: n
|
|
24
21
|
}) => /* @__PURE__ */ g(
|
|
25
22
|
"div",
|
|
26
23
|
{
|
|
@@ -33,57 +30,57 @@ const W = ({
|
|
|
33
30
|
pointerEvents: t.pointerEvents ?? "none",
|
|
34
31
|
zIndex: t.zIndex,
|
|
35
32
|
opacity: t.hidden ? 0 : 1,
|
|
36
|
-
...
|
|
33
|
+
...n
|
|
37
34
|
},
|
|
38
35
|
children: e
|
|
39
36
|
}
|
|
40
|
-
),
|
|
37
|
+
), q = ({
|
|
41
38
|
canvas: e,
|
|
42
39
|
layout: t,
|
|
43
|
-
media:
|
|
44
|
-
mirrored:
|
|
40
|
+
media: n,
|
|
41
|
+
mirrored: r,
|
|
45
42
|
filter: o
|
|
46
43
|
}) => {
|
|
47
44
|
const i = Math.round(t.destination.width), a = Math.round(t.destination.height);
|
|
48
45
|
e.width !== i && (e.width = i), e.height !== a && (e.height = a);
|
|
49
46
|
const s = e.getContext("2d");
|
|
50
|
-
s && (s.setTransform(1, 0, 0, 1, 0, 0), s.clearRect(0, 0, i, a),
|
|
51
|
-
},
|
|
47
|
+
s && (s.setTransform(1, 0, 0, 1, 0, 0), s.clearRect(0, 0, i, a), r && (s.translate(i, 0), s.scale(-1, 1)), o && (s.filter = o), s.drawImage(n, t.offsetX, t.offsetY, t.drawWidth, t.drawHeight), o && (s.filter = "none"), s.setTransform(1, 0, 0, 1, 0, 0));
|
|
48
|
+
}, te = ({
|
|
52
49
|
canvasRef: e,
|
|
53
50
|
enabled: t = !0,
|
|
54
|
-
fps:
|
|
55
|
-
imageRef:
|
|
51
|
+
fps: n = 30,
|
|
52
|
+
imageRef: r,
|
|
56
53
|
layout: o,
|
|
57
54
|
mirrored: i,
|
|
58
55
|
sourceKind: a,
|
|
59
56
|
videoRef: s
|
|
60
57
|
}) => {
|
|
61
|
-
|
|
58
|
+
M(() => {
|
|
62
59
|
if (!t) {
|
|
63
60
|
const b = e.current, f = b == null ? void 0 : b.getContext("2d");
|
|
64
61
|
b && f && f.clearRect(0, 0, b.width, b.height);
|
|
65
62
|
return;
|
|
66
63
|
}
|
|
67
64
|
let l = 0, c = 0;
|
|
68
|
-
const d =
|
|
65
|
+
const d = n > 0 ? 1e3 / n : 0, h = (b) => {
|
|
69
66
|
if (l = requestAnimationFrame(h), d > 0 && b - c < d) return;
|
|
70
67
|
c = b;
|
|
71
68
|
const f = e.current;
|
|
72
69
|
if (!f || !o) return;
|
|
73
70
|
if (a === "image") {
|
|
74
|
-
const
|
|
75
|
-
if (!
|
|
71
|
+
const p = r.current;
|
|
72
|
+
if (!p || !p.complete || p.naturalWidth <= 0 || p.naturalHeight <= 0)
|
|
76
73
|
return;
|
|
77
|
-
|
|
74
|
+
q({
|
|
78
75
|
canvas: f,
|
|
79
76
|
layout: o,
|
|
80
|
-
media:
|
|
77
|
+
media: p,
|
|
81
78
|
mirrored: i
|
|
82
79
|
});
|
|
83
80
|
return;
|
|
84
81
|
}
|
|
85
82
|
const w = s.current;
|
|
86
|
-
!w || w.readyState < 2 || w.videoWidth <= 0 || w.videoHeight <= 0 ||
|
|
83
|
+
!w || w.readyState < 2 || w.videoWidth <= 0 || w.videoHeight <= 0 || q({
|
|
87
84
|
canvas: f,
|
|
88
85
|
layout: o,
|
|
89
86
|
media: w,
|
|
@@ -93,23 +90,23 @@ const W = ({
|
|
|
93
90
|
return l = requestAnimationFrame(h), () => {
|
|
94
91
|
cancelAnimationFrame(l);
|
|
95
92
|
};
|
|
96
|
-
}, [e, t,
|
|
97
|
-
},
|
|
93
|
+
}, [e, t, n, r, o, i, a, s]);
|
|
94
|
+
}, xe = ({
|
|
98
95
|
canvasRef: e,
|
|
99
96
|
imageRef: t,
|
|
100
|
-
layer:
|
|
101
|
-
layout:
|
|
97
|
+
layer: n,
|
|
98
|
+
layout: r,
|
|
102
99
|
mirrored: o,
|
|
103
100
|
sourceKind: i,
|
|
104
101
|
videoRef: a
|
|
105
|
-
}) => (
|
|
102
|
+
}) => (te({
|
|
106
103
|
canvasRef: e,
|
|
107
104
|
imageRef: t,
|
|
108
|
-
layout:
|
|
105
|
+
layout: r,
|
|
109
106
|
mirrored: o,
|
|
110
107
|
sourceKind: i,
|
|
111
108
|
videoRef: a
|
|
112
|
-
}), /* @__PURE__ */ g(
|
|
109
|
+
}), /* @__PURE__ */ g(B, { config: n, children: /* @__PURE__ */ g(
|
|
113
110
|
"canvas",
|
|
114
111
|
{
|
|
115
112
|
ref: e,
|
|
@@ -122,11 +119,11 @@ const W = ({
|
|
|
122
119
|
background: "#000"
|
|
123
120
|
}
|
|
124
121
|
}
|
|
125
|
-
) })),
|
|
122
|
+
) })), tt = ({
|
|
126
123
|
canvasRef: e,
|
|
127
124
|
controlInsetTop: t,
|
|
128
|
-
debugVisible:
|
|
129
|
-
fps:
|
|
125
|
+
debugVisible: n,
|
|
126
|
+
fps: r = 15,
|
|
130
127
|
imageRef: o,
|
|
131
128
|
layer: i,
|
|
132
129
|
layout: a,
|
|
@@ -135,10 +132,10 @@ const W = ({
|
|
|
135
132
|
videoRef: c,
|
|
136
133
|
viewportSize: d
|
|
137
134
|
}) => {
|
|
138
|
-
|
|
135
|
+
te({
|
|
139
136
|
canvasRef: e,
|
|
140
|
-
enabled:
|
|
141
|
-
fps:
|
|
137
|
+
enabled: n,
|
|
138
|
+
fps: r,
|
|
142
139
|
imageRef: o,
|
|
143
140
|
layout: a,
|
|
144
141
|
mirrored: s,
|
|
@@ -146,7 +143,7 @@ const W = ({
|
|
|
146
143
|
videoRef: c
|
|
147
144
|
});
|
|
148
145
|
const h = Math.min(220, Math.max(120, d.width * 0.22)), b = d.width > 0 && d.height > 0 ? d.width / d.height : 1, f = Math.min(d.height - 24, Math.max(t ?? 16, 16));
|
|
149
|
-
return /* @__PURE__ */ g(
|
|
146
|
+
return /* @__PURE__ */ g(B, { config: i, children: /* @__PURE__ */ g(
|
|
150
147
|
"canvas",
|
|
151
148
|
{
|
|
152
149
|
ref: e,
|
|
@@ -154,52 +151,52 @@ const W = ({
|
|
|
154
151
|
position: "absolute",
|
|
155
152
|
left: 16,
|
|
156
153
|
top: f,
|
|
157
|
-
width:
|
|
158
|
-
height:
|
|
154
|
+
width: n ? h : 1,
|
|
155
|
+
height: n ? "auto" : 1,
|
|
159
156
|
aspectRatio: `${b}`,
|
|
160
|
-
opacity:
|
|
157
|
+
opacity: n ? 0.85 : 0,
|
|
161
158
|
borderRadius: 10,
|
|
162
|
-
border:
|
|
159
|
+
border: n ? "1px solid rgba(255,255,255,0.16)" : "none",
|
|
163
160
|
pointerEvents: "none",
|
|
164
161
|
objectFit: "contain",
|
|
165
162
|
background: "#000"
|
|
166
163
|
}
|
|
167
164
|
}
|
|
168
165
|
) });
|
|
169
|
-
},
|
|
166
|
+
}, ve = {
|
|
170
167
|
audio: !1,
|
|
171
168
|
video: {
|
|
172
169
|
facingMode: "user",
|
|
173
170
|
frameRate: { ideal: 30, max: 60 }
|
|
174
171
|
}
|
|
175
|
-
},
|
|
172
|
+
}, ye = {
|
|
176
173
|
name: "viewport-live",
|
|
177
174
|
clearColor: "#000000",
|
|
178
175
|
pointerEvents: "none",
|
|
179
176
|
zIndex: 0
|
|
180
|
-
},
|
|
177
|
+
}, Ce = {
|
|
181
178
|
name: "viewport-ui",
|
|
182
179
|
clearColor: "transparent",
|
|
183
180
|
pointerEvents: "auto",
|
|
184
181
|
zIndex: 5
|
|
185
|
-
},
|
|
182
|
+
}, Se = {
|
|
186
183
|
name: "viewport-scene",
|
|
187
184
|
clearColor: "transparent",
|
|
188
185
|
pointerEvents: "auto",
|
|
189
186
|
zIndex: 1
|
|
190
|
-
},
|
|
187
|
+
}, A = {
|
|
191
188
|
webcam: { icon: "◉", label: "Webcam" },
|
|
192
189
|
image: { icon: "▣", label: "Images" },
|
|
193
190
|
video: { icon: "▶", label: "Videos" }
|
|
194
|
-
},
|
|
191
|
+
}, Re = ({
|
|
195
192
|
imageRef: e,
|
|
196
193
|
selectedSource: t,
|
|
197
|
-
videoRef:
|
|
198
|
-
}) => /* @__PURE__ */
|
|
194
|
+
videoRef: n
|
|
195
|
+
}) => /* @__PURE__ */ k(W, { children: [
|
|
199
196
|
/* @__PURE__ */ g(
|
|
200
197
|
"video",
|
|
201
198
|
{
|
|
202
|
-
ref:
|
|
199
|
+
ref: n,
|
|
203
200
|
style: {
|
|
204
201
|
position: "absolute",
|
|
205
202
|
width: 1,
|
|
@@ -223,11 +220,11 @@ const W = ({
|
|
|
223
220
|
}
|
|
224
221
|
}
|
|
225
222
|
)
|
|
226
|
-
] }),
|
|
223
|
+
] }), Y = ({
|
|
227
224
|
dock: e,
|
|
228
225
|
label: t,
|
|
229
|
-
onChange:
|
|
230
|
-
options:
|
|
226
|
+
onChange: n,
|
|
227
|
+
options: r,
|
|
231
228
|
value: o
|
|
232
229
|
}) => /* @__PURE__ */ g(
|
|
233
230
|
"div",
|
|
@@ -246,7 +243,7 @@ const W = ({
|
|
|
246
243
|
boxShadow: "0 12px 30px rgba(0,0,0,0.18)",
|
|
247
244
|
backdropFilter: "blur(10px)"
|
|
248
245
|
},
|
|
249
|
-
children: /* @__PURE__ */
|
|
246
|
+
children: /* @__PURE__ */ k(
|
|
250
247
|
"label",
|
|
251
248
|
{
|
|
252
249
|
style: {
|
|
@@ -262,7 +259,7 @@ const W = ({
|
|
|
262
259
|
"select",
|
|
263
260
|
{
|
|
264
261
|
value: o,
|
|
265
|
-
onChange: (i) =>
|
|
262
|
+
onChange: (i) => n(i.target.value),
|
|
266
263
|
style: {
|
|
267
264
|
minWidth: 180,
|
|
268
265
|
maxWidth: "calc(100vw - 52px)",
|
|
@@ -273,18 +270,18 @@ const W = ({
|
|
|
273
270
|
color: "#e5eefb",
|
|
274
271
|
padding: "0 10px"
|
|
275
272
|
},
|
|
276
|
-
children:
|
|
273
|
+
children: r.map((i) => /* @__PURE__ */ g("option", { value: i.id, style: { color: "#111827" }, children: i.label }, i.id))
|
|
277
274
|
}
|
|
278
275
|
)
|
|
279
276
|
]
|
|
280
277
|
}
|
|
281
278
|
)
|
|
282
279
|
}
|
|
283
|
-
),
|
|
280
|
+
), Ie = ({
|
|
284
281
|
dock: e,
|
|
285
282
|
imageOptions: t,
|
|
286
|
-
selectedImageId:
|
|
287
|
-
selectedSource:
|
|
283
|
+
selectedImageId: n,
|
|
284
|
+
selectedSource: r,
|
|
288
285
|
selectedVideoId: o,
|
|
289
286
|
setSelectedImageId: i,
|
|
290
287
|
setSelectedSource: a,
|
|
@@ -318,8 +315,8 @@ const W = ({
|
|
|
318
315
|
},
|
|
319
316
|
children: "≡"
|
|
320
317
|
}
|
|
321
|
-
) : /* @__PURE__ */
|
|
322
|
-
/* @__PURE__ */
|
|
318
|
+
) : /* @__PURE__ */ k(W, { children: [
|
|
319
|
+
/* @__PURE__ */ k(
|
|
323
320
|
"div",
|
|
324
321
|
{
|
|
325
322
|
style: {
|
|
@@ -350,14 +347,14 @@ const W = ({
|
|
|
350
347
|
overflowX: "auto"
|
|
351
348
|
},
|
|
352
349
|
children: b.map((f) => {
|
|
353
|
-
const w = f ===
|
|
354
|
-
return /* @__PURE__ */
|
|
350
|
+
const w = f === r;
|
|
351
|
+
return /* @__PURE__ */ k(
|
|
355
352
|
"button",
|
|
356
353
|
{
|
|
357
354
|
type: "button",
|
|
358
355
|
onClick: () => a(f),
|
|
359
356
|
"aria-pressed": w,
|
|
360
|
-
title:
|
|
357
|
+
title: A[f].label,
|
|
361
358
|
style: {
|
|
362
359
|
border: "none",
|
|
363
360
|
borderRadius: 999,
|
|
@@ -374,8 +371,8 @@ const W = ({
|
|
|
374
371
|
flex: "0 0 auto"
|
|
375
372
|
},
|
|
376
373
|
children: [
|
|
377
|
-
/* @__PURE__ */ g("span", { style: { fontSize: 14, lineHeight: 1 }, children:
|
|
378
|
-
/* @__PURE__ */ g("span", { style: { fontSize: 12, fontWeight: 700, letterSpacing: "0.01em" }, children:
|
|
374
|
+
/* @__PURE__ */ g("span", { style: { fontSize: 14, lineHeight: 1 }, children: A[f].icon }),
|
|
375
|
+
/* @__PURE__ */ g("span", { style: { fontSize: 12, fontWeight: 700, letterSpacing: "0.01em" }, children: A[f].label })
|
|
379
376
|
]
|
|
380
377
|
},
|
|
381
378
|
f
|
|
@@ -408,18 +405,18 @@ const W = ({
|
|
|
408
405
|
]
|
|
409
406
|
}
|
|
410
407
|
),
|
|
411
|
-
|
|
412
|
-
|
|
408
|
+
r === "image" && t.length > 0 && /* @__PURE__ */ g(
|
|
409
|
+
Y,
|
|
413
410
|
{
|
|
414
411
|
dock: e,
|
|
415
412
|
label: "Image Asset",
|
|
416
413
|
options: t,
|
|
417
|
-
value:
|
|
414
|
+
value: n,
|
|
418
415
|
onChange: i
|
|
419
416
|
}
|
|
420
417
|
),
|
|
421
|
-
|
|
422
|
-
|
|
418
|
+
r === "video" && c.length > 0 && /* @__PURE__ */ g(
|
|
419
|
+
Y,
|
|
423
420
|
{
|
|
424
421
|
dock: e,
|
|
425
422
|
label: "Video Asset",
|
|
@@ -429,11 +426,11 @@ const W = ({
|
|
|
429
426
|
}
|
|
430
427
|
)
|
|
431
428
|
] }) : null;
|
|
432
|
-
},
|
|
429
|
+
}, Ee = ({
|
|
433
430
|
containerRef: e,
|
|
434
431
|
displayCanvasRef: t,
|
|
435
|
-
imageOptions:
|
|
436
|
-
imageRef:
|
|
432
|
+
imageOptions: n,
|
|
433
|
+
imageRef: r,
|
|
437
434
|
layout: o,
|
|
438
435
|
managesOwnMedia: i,
|
|
439
436
|
mediaDock: a,
|
|
@@ -445,16 +442,16 @@ const W = ({
|
|
|
445
442
|
selectedSource: b,
|
|
446
443
|
selectedVideoId: f,
|
|
447
444
|
setSceneRenderOutputs: w,
|
|
448
|
-
setSelectedImageId:
|
|
449
|
-
setSelectedSource:
|
|
445
|
+
setSelectedImageId: p,
|
|
446
|
+
setSelectedSource: m,
|
|
450
447
|
setSelectedVideoId: y,
|
|
451
|
-
showMediaControls:
|
|
448
|
+
showMediaControls: F,
|
|
452
449
|
style: R,
|
|
453
450
|
videoOptions: v,
|
|
454
|
-
videoRef:
|
|
451
|
+
videoRef: I,
|
|
455
452
|
viewportSize: x,
|
|
456
453
|
mirrored: u
|
|
457
|
-
}) => /* @__PURE__ */
|
|
454
|
+
}) => /* @__PURE__ */ k(
|
|
458
455
|
"div",
|
|
459
456
|
{
|
|
460
457
|
ref: e,
|
|
@@ -466,21 +463,21 @@ const W = ({
|
|
|
466
463
|
...R
|
|
467
464
|
},
|
|
468
465
|
children: [
|
|
469
|
-
/* @__PURE__ */ g(
|
|
466
|
+
/* @__PURE__ */ g(Re, { imageRef: r, selectedSource: b, videoRef: I }),
|
|
470
467
|
s === "dom" && i && /* @__PURE__ */ g(
|
|
471
|
-
|
|
468
|
+
xe,
|
|
472
469
|
{
|
|
473
470
|
canvasRef: t,
|
|
474
|
-
imageRef:
|
|
475
|
-
videoRef:
|
|
476
|
-
layer:
|
|
471
|
+
imageRef: r,
|
|
472
|
+
videoRef: I,
|
|
473
|
+
layer: ye,
|
|
477
474
|
layout: o,
|
|
478
475
|
mirrored: u,
|
|
479
476
|
sourceKind: b === "image" ? "image" : "video"
|
|
480
477
|
}
|
|
481
478
|
),
|
|
482
|
-
(s === "r3f" || s === "hybrid") && /* @__PURE__ */ g(
|
|
483
|
-
|
|
479
|
+
(s === "r3f" || s === "hybrid") && /* @__PURE__ */ g(B, { config: Se, children: /* @__PURE__ */ g(
|
|
480
|
+
ge,
|
|
484
481
|
{
|
|
485
482
|
onRenderOutputs: w,
|
|
486
483
|
renderOutputs: {
|
|
@@ -492,19 +489,19 @@ const W = ({
|
|
|
492
489
|
children: d
|
|
493
490
|
}
|
|
494
491
|
) }),
|
|
495
|
-
/* @__PURE__ */
|
|
492
|
+
/* @__PURE__ */ k(B, { config: Ce, children: [
|
|
496
493
|
i && /* @__PURE__ */ g(
|
|
497
|
-
|
|
494
|
+
Ie,
|
|
498
495
|
{
|
|
499
496
|
dock: a,
|
|
500
|
-
imageOptions:
|
|
497
|
+
imageOptions: n,
|
|
501
498
|
selectedImageId: h,
|
|
502
499
|
selectedSource: b,
|
|
503
500
|
selectedVideoId: f,
|
|
504
|
-
setSelectedImageId:
|
|
505
|
-
setSelectedSource:
|
|
501
|
+
setSelectedImageId: p,
|
|
502
|
+
setSelectedSource: m,
|
|
506
503
|
setSelectedVideoId: y,
|
|
507
|
-
showMediaControls:
|
|
504
|
+
showMediaControls: F,
|
|
508
505
|
videoOptions: v
|
|
509
506
|
}
|
|
510
507
|
),
|
|
@@ -512,46 +509,46 @@ const W = ({
|
|
|
512
509
|
] })
|
|
513
510
|
]
|
|
514
511
|
}
|
|
515
|
-
),
|
|
512
|
+
), Te = 5, Fe = 1, Me = (e, t) => t, ze = "brightness(2.2) contrast(1.5) saturate(1.25)", Xe = ({
|
|
516
513
|
enabled: e,
|
|
517
514
|
displayMirrored: t,
|
|
518
|
-
imageRef:
|
|
519
|
-
layout:
|
|
515
|
+
imageRef: n,
|
|
516
|
+
layout: r,
|
|
520
517
|
mode: o,
|
|
521
518
|
numFaces: i,
|
|
522
519
|
selectedSource: a,
|
|
523
520
|
sourceStream: s,
|
|
524
521
|
videoRef: l
|
|
525
522
|
}) => {
|
|
526
|
-
const { session: c } =
|
|
523
|
+
const { session: c } = se(), d = X(null), h = X(!1), b = X(document.createElement("canvas")), {
|
|
527
524
|
ready: f,
|
|
528
525
|
node: w,
|
|
529
|
-
error:
|
|
530
|
-
} =
|
|
531
|
-
numFaces: i ?? (o === "head-binding" ?
|
|
532
|
-
}), [
|
|
526
|
+
error: p
|
|
527
|
+
} = le(O.FACE_TRACKER, {
|
|
528
|
+
numFaces: i ?? (o === "head-binding" ? Fe : Te)
|
|
529
|
+
}), [m, y] = S("idle"), [F, R] = S(null), v = e && f && !!w, I = ee({
|
|
533
530
|
node: v ? w : null,
|
|
534
531
|
enabled: v,
|
|
535
532
|
selectedSource: a,
|
|
536
|
-
onFrame:
|
|
533
|
+
onFrame: de(() => {
|
|
537
534
|
R(null), y("ready");
|
|
538
535
|
}, [])
|
|
539
536
|
});
|
|
540
|
-
return
|
|
541
|
-
if (!e || !
|
|
537
|
+
return M(() => {
|
|
538
|
+
if (!e || !r) return;
|
|
542
539
|
const x = () => {
|
|
543
|
-
const C = a === "image" ?
|
|
540
|
+
const C = a === "image" ? n.current : l.current;
|
|
544
541
|
if (C) {
|
|
545
542
|
if (C instanceof HTMLImageElement) {
|
|
546
543
|
if (!C.complete || C.naturalWidth <= 0 || C.naturalHeight <= 0) return;
|
|
547
544
|
} else if (C.readyState < 2 || C.videoWidth <= 0 || C.videoHeight <= 0)
|
|
548
545
|
return;
|
|
549
|
-
|
|
546
|
+
q({
|
|
550
547
|
canvas: b.current,
|
|
551
|
-
layout:
|
|
548
|
+
layout: r,
|
|
552
549
|
media: C,
|
|
553
550
|
mirrored: t,
|
|
554
|
-
filter: a === "webcam" ?
|
|
551
|
+
filter: a === "webcam" ? ze : void 0
|
|
555
552
|
});
|
|
556
553
|
}
|
|
557
554
|
};
|
|
@@ -560,22 +557,22 @@ const W = ({
|
|
|
560
557
|
return;
|
|
561
558
|
}
|
|
562
559
|
let u = 0;
|
|
563
|
-
const
|
|
564
|
-
u = requestAnimationFrame(
|
|
560
|
+
const E = () => {
|
|
561
|
+
u = requestAnimationFrame(E), x();
|
|
565
562
|
};
|
|
566
|
-
return u = requestAnimationFrame(
|
|
567
|
-
}, [t, e,
|
|
568
|
-
var
|
|
563
|
+
return u = requestAnimationFrame(E), () => cancelAnimationFrame(u);
|
|
564
|
+
}, [t, e, n, r, a, l]), M(() => {
|
|
565
|
+
var V;
|
|
569
566
|
if (!e) {
|
|
570
567
|
y("idle"), R(null), h.current = !1, d.current = null;
|
|
571
568
|
return;
|
|
572
569
|
}
|
|
573
|
-
if (!
|
|
570
|
+
if (!r) {
|
|
574
571
|
y("initializing");
|
|
575
572
|
return;
|
|
576
573
|
}
|
|
577
|
-
const x = (s == null ? void 0 : s.id) ?? (((
|
|
578
|
-
d.current !==
|
|
574
|
+
const x = (s == null ? void 0 : s.id) ?? (((V = l.current) == null ? void 0 : V.srcObject) instanceof MediaStream ? l.current.srcObject.id : "none"), E = a === "webcam" ? `webcam:${x}` : a;
|
|
575
|
+
d.current !== E && (h.current = !1, d.current = E);
|
|
579
576
|
let C = !1;
|
|
580
577
|
return (async () => {
|
|
581
578
|
try {
|
|
@@ -584,44 +581,44 @@ const W = ({
|
|
|
584
581
|
sourceKind: a
|
|
585
582
|
}), await c.start(), h.current = !0), C) return;
|
|
586
583
|
R(null), y("initializing");
|
|
587
|
-
} catch (
|
|
584
|
+
} catch (z) {
|
|
588
585
|
if (C) return;
|
|
589
|
-
y("error"), R(
|
|
586
|
+
y("error"), R(z instanceof Error ? z.message : "Failed to initialize SDK face tracking");
|
|
590
587
|
}
|
|
591
588
|
})(), () => {
|
|
592
589
|
C = !0;
|
|
593
590
|
};
|
|
594
|
-
}, [e,
|
|
595
|
-
!v && e && !
|
|
596
|
-
}, [v, e,
|
|
597
|
-
|
|
598
|
-
}, [
|
|
591
|
+
}, [e, r, a, c, s, l]), M(() => {
|
|
592
|
+
!v && e && !p && y("initializing");
|
|
593
|
+
}, [v, e, p]), M(() => {
|
|
594
|
+
p && (y("error"), R(p.message));
|
|
595
|
+
}, [p]), M(() => () => {
|
|
599
596
|
h.current = !1, c.stop();
|
|
600
597
|
}, [c]), {
|
|
601
598
|
activeDelegate: "GPU",
|
|
602
|
-
faces:
|
|
603
|
-
status:
|
|
604
|
-
error:
|
|
599
|
+
faces: I,
|
|
600
|
+
status: m,
|
|
601
|
+
error: F
|
|
605
602
|
};
|
|
606
|
-
},
|
|
603
|
+
}, ke = (e, t) => e === "auto" ? t === "webcam" ? "cover" : "contain" : e, Ae = ({
|
|
607
604
|
imageOptions: e,
|
|
608
605
|
initialImageId: t,
|
|
609
|
-
initialSource:
|
|
610
|
-
initialVideoId:
|
|
606
|
+
initialSource: n,
|
|
607
|
+
initialVideoId: r,
|
|
611
608
|
source: o,
|
|
612
609
|
videoOptions: i
|
|
613
610
|
}) => {
|
|
614
611
|
var l, c, d, h;
|
|
615
|
-
const a = (o == null ? void 0 : o.kind) ??
|
|
612
|
+
const a = (o == null ? void 0 : o.kind) ?? n ?? "webcam";
|
|
616
613
|
return {
|
|
617
614
|
selectedSource: a === "image" && e.length === 0 || a === "video" && i.length === 0 ? "webcam" : a,
|
|
618
615
|
selectedImageId: (o == null ? void 0 : o.kind) === "image" ? o.assetId ?? ((l = e[0]) == null ? void 0 : l.id) ?? "" : t ?? ((c = e[0]) == null ? void 0 : c.id) ?? "",
|
|
619
|
-
selectedVideoId: (o == null ? void 0 : o.kind) === "video" ? o.assetId ?? ((d = i[0]) == null ? void 0 : d.id) ?? "" :
|
|
616
|
+
selectedVideoId: (o == null ? void 0 : o.kind) === "video" ? o.assetId ?? ((d = i[0]) == null ? void 0 : d.id) ?? "" : r ?? ((h = i[0]) == null ? void 0 : h.id) ?? ""
|
|
620
617
|
};
|
|
621
|
-
},
|
|
618
|
+
}, Le = (e, t, n) => {
|
|
622
619
|
if (e.width <= 0 || e.height <= 0 || t.width <= 0 || t.height <= 0)
|
|
623
620
|
return null;
|
|
624
|
-
const
|
|
621
|
+
const r = n === "contain" ? Math.min(t.width / e.width, t.height / e.height) : Math.max(t.width / e.width, t.height / e.height), o = e.width * r, i = e.height * r;
|
|
625
622
|
return {
|
|
626
623
|
source: e,
|
|
627
624
|
destination: t,
|
|
@@ -629,24 +626,24 @@ const W = ({
|
|
|
629
626
|
drawHeight: i,
|
|
630
627
|
offsetX: (t.width - o) * 0.5,
|
|
631
628
|
offsetY: (t.height - i) * 0.5,
|
|
632
|
-
scale:
|
|
629
|
+
scale: r
|
|
633
630
|
};
|
|
634
|
-
},
|
|
631
|
+
}, Ve = (e) => {
|
|
635
632
|
if (!e) return { width: 0, height: 0 };
|
|
636
633
|
const t = e.getBoundingClientRect();
|
|
637
634
|
return {
|
|
638
635
|
width: t.width || e.clientWidth,
|
|
639
636
|
height: t.height || e.clientHeight
|
|
640
637
|
};
|
|
641
|
-
},
|
|
642
|
-
const [t,
|
|
643
|
-
return
|
|
644
|
-
const
|
|
645
|
-
if (!
|
|
638
|
+
}, De = (e) => {
|
|
639
|
+
const [t, n] = S({ width: 0, height: 0 });
|
|
640
|
+
return ue(() => {
|
|
641
|
+
const r = e.current;
|
|
642
|
+
if (!r) return;
|
|
646
643
|
let o = 0;
|
|
647
644
|
const i = () => {
|
|
648
|
-
const c =
|
|
649
|
-
|
|
645
|
+
const c = Ve(r);
|
|
646
|
+
n(
|
|
650
647
|
(d) => d.width === c.width && d.height === c.height ? d : c
|
|
651
648
|
);
|
|
652
649
|
}, a = () => {
|
|
@@ -654,84 +651,84 @@ const W = ({
|
|
|
654
651
|
};
|
|
655
652
|
a();
|
|
656
653
|
const s = new ResizeObserver(a);
|
|
657
|
-
s.observe(
|
|
654
|
+
s.observe(r);
|
|
658
655
|
const l = window.visualViewport;
|
|
659
656
|
return window.addEventListener("resize", a), window.addEventListener("orientationchange", a), l == null || l.addEventListener("resize", a), l == null || l.addEventListener("scroll", a), () => {
|
|
660
657
|
o && cancelAnimationFrame(o), s.disconnect(), window.removeEventListener("resize", a), window.removeEventListener("orientationchange", a), l == null || l.removeEventListener("resize", a), l == null || l.removeEventListener("scroll", a);
|
|
661
658
|
};
|
|
662
659
|
}, [e]), t;
|
|
663
|
-
},
|
|
660
|
+
}, Be = ({
|
|
664
661
|
enabled: e,
|
|
665
662
|
selectedSource: t
|
|
666
663
|
}) => {
|
|
667
|
-
const
|
|
664
|
+
const n = ce(O.FACE_TRACKER);
|
|
668
665
|
return {
|
|
669
|
-
faces:
|
|
670
|
-
trackerStatus:
|
|
666
|
+
faces: ee({ node: n, enabled: e, selectedSource: t }),
|
|
667
|
+
trackerStatus: n ? "ready" : "idle"
|
|
671
668
|
};
|
|
672
|
-
},
|
|
669
|
+
}, J = (e) => {
|
|
673
670
|
e && (e.pause(), e.removeAttribute("src"), e.srcObject = null, e.load());
|
|
674
671
|
}, Q = (e) => {
|
|
675
672
|
e && e.removeAttribute("src");
|
|
676
|
-
},
|
|
673
|
+
}, We = ({
|
|
677
674
|
enabled: e,
|
|
678
675
|
imageAsset: t,
|
|
679
|
-
selectedSource:
|
|
680
|
-
videoAsset:
|
|
676
|
+
selectedSource: n,
|
|
677
|
+
videoAsset: r
|
|
681
678
|
}) => {
|
|
682
|
-
const o =
|
|
683
|
-
return
|
|
679
|
+
const o = X(null), i = X(null), [a, s] = S(null), [l, c] = S({ width: 0, height: 0 }), [d, h] = S("idle"), [b, f] = S(null);
|
|
680
|
+
return M(() => {
|
|
684
681
|
if (!e) {
|
|
685
|
-
|
|
682
|
+
J(o.current), Q(i.current), s(null), c({ width: 0, height: 0 }), h("idle"), f(null);
|
|
686
683
|
return;
|
|
687
684
|
}
|
|
688
|
-
let w = !1,
|
|
689
|
-
const
|
|
685
|
+
let w = !1, p = null;
|
|
686
|
+
const m = (x, u) => {
|
|
690
687
|
w || (c({ width: x, height: u }), h("ready"), f(null));
|
|
691
688
|
}, y = () => {
|
|
692
|
-
|
|
693
|
-
},
|
|
689
|
+
J(o.current), Q(i.current), p == null || p.getTracks().forEach((x) => x.stop()), p = null, s(null);
|
|
690
|
+
}, F = async () => {
|
|
694
691
|
h("requesting");
|
|
695
|
-
const x = await navigator.mediaDevices.getUserMedia(
|
|
692
|
+
const x = await navigator.mediaDevices.getUserMedia(ve);
|
|
696
693
|
if (w) {
|
|
697
|
-
x.getTracks().forEach((
|
|
694
|
+
x.getTracks().forEach((E) => E.stop());
|
|
698
695
|
return;
|
|
699
696
|
}
|
|
700
|
-
|
|
697
|
+
p = x, s(x);
|
|
701
698
|
const u = o.current;
|
|
702
|
-
u && (u.srcObject = x, u.muted = !0, u.playsInline = !0, u.autoplay = !0, await u.play(),
|
|
699
|
+
u && (u.srcObject = x, u.muted = !0, u.playsInline = !0, u.autoplay = !0, await u.play(), m(u.videoWidth, u.videoHeight));
|
|
703
700
|
}, R = async (x) => {
|
|
704
701
|
h("requesting"), s(null);
|
|
705
702
|
const u = o.current;
|
|
706
|
-
u && (u.src = x, u.muted = !0, u.loop = !0, u.playsInline = !0, u.autoplay = !0, u.crossOrigin = "anonymous", await u.play(),
|
|
703
|
+
u && (u.src = x, u.muted = !0, u.loop = !0, u.playsInline = !0, u.autoplay = !0, u.crossOrigin = "anonymous", await u.play(), m(u.videoWidth, u.videoHeight));
|
|
707
704
|
}, v = async (x) => {
|
|
708
705
|
h("requesting"), s(null);
|
|
709
706
|
const u = i.current;
|
|
710
|
-
u && (await new Promise((
|
|
711
|
-
u.onload = () =>
|
|
712
|
-
}),
|
|
707
|
+
u && (await new Promise((E, C) => {
|
|
708
|
+
u.onload = () => E(), u.onerror = () => C(new Error("Unable to load image")), u.src = x;
|
|
709
|
+
}), m(u.naturalWidth, u.naturalHeight));
|
|
713
710
|
};
|
|
714
711
|
return y(), (async () => {
|
|
715
712
|
try {
|
|
716
|
-
if (
|
|
717
|
-
await
|
|
713
|
+
if (n === "webcam") {
|
|
714
|
+
await F();
|
|
718
715
|
return;
|
|
719
716
|
}
|
|
720
|
-
if (
|
|
721
|
-
if (!(
|
|
722
|
-
await R(
|
|
717
|
+
if (n === "video") {
|
|
718
|
+
if (!(r != null && r.src)) throw new Error("Missing video source");
|
|
719
|
+
await R(r.src);
|
|
723
720
|
return;
|
|
724
721
|
}
|
|
725
722
|
if (!(t != null && t.src)) throw new Error("Missing image source");
|
|
726
723
|
await v(t.src);
|
|
727
724
|
} catch (x) {
|
|
728
725
|
if (w) return;
|
|
729
|
-
h("error"), f(x instanceof Error ? x.message : `Unable to initialize ${
|
|
726
|
+
h("error"), f(x instanceof Error ? x.message : `Unable to initialize ${n}`);
|
|
730
727
|
}
|
|
731
728
|
})(), () => {
|
|
732
729
|
w = !0, y();
|
|
733
730
|
};
|
|
734
|
-
}, [e, t,
|
|
731
|
+
}, [e, t, n, r]), {
|
|
735
732
|
videoRef: o,
|
|
736
733
|
imageRef: i,
|
|
737
734
|
stream: a,
|
|
@@ -739,31 +736,31 @@ const W = ({
|
|
|
739
736
|
status: d,
|
|
740
737
|
error: b
|
|
741
738
|
};
|
|
742
|
-
},
|
|
739
|
+
}, _e = ({
|
|
743
740
|
enabled: e,
|
|
744
741
|
imageRef: t,
|
|
745
|
-
selectedSource:
|
|
746
|
-
status:
|
|
742
|
+
selectedSource: n,
|
|
743
|
+
status: r,
|
|
747
744
|
videoRef: o
|
|
748
745
|
}) => {
|
|
749
746
|
const [i, a] = S(null);
|
|
750
|
-
return
|
|
751
|
-
if (!e ||
|
|
747
|
+
return M(() => {
|
|
748
|
+
if (!e || r !== "ready") {
|
|
752
749
|
a((c) => (c == null || c.dispose(), null));
|
|
753
750
|
return;
|
|
754
751
|
}
|
|
755
|
-
const s =
|
|
752
|
+
const s = n === "image" ? t.current : o.current;
|
|
756
753
|
if (!s) return;
|
|
757
|
-
const l =
|
|
758
|
-
return l.colorSpace =
|
|
754
|
+
const l = n === "image" ? new L.Texture(s) : new L.VideoTexture(s);
|
|
755
|
+
return l.colorSpace = L.SRGBColorSpace, l.minFilter = L.LinearFilter, l.magFilter = L.LinearFilter, l.generateMipmaps = !1, l.needsUpdate = !0, a((c) => (c == null || c.dispose(), l)), () => {
|
|
759
756
|
l.dispose();
|
|
760
757
|
};
|
|
761
|
-
}, [e, t,
|
|
762
|
-
},
|
|
758
|
+
}, [e, t, n, r, o]), i;
|
|
759
|
+
}, He = ({
|
|
763
760
|
externalTracker: e,
|
|
764
761
|
imageOptions: t,
|
|
765
|
-
layout:
|
|
766
|
-
managesOwnMedia:
|
|
762
|
+
layout: n,
|
|
763
|
+
managesOwnMedia: r,
|
|
767
764
|
mediaError: o,
|
|
768
765
|
mediaFitMode: i,
|
|
769
766
|
mediaSize: a,
|
|
@@ -775,21 +772,21 @@ const W = ({
|
|
|
775
772
|
selectedVideo: b,
|
|
776
773
|
selectedVideoId: f,
|
|
777
774
|
setMirrored: w,
|
|
778
|
-
setSelectedImageId:
|
|
779
|
-
setSelectedSource:
|
|
775
|
+
setSelectedImageId: p,
|
|
776
|
+
setSelectedSource: m,
|
|
780
777
|
setSelectedVideoId: y,
|
|
781
|
-
setShowMediaControls:
|
|
778
|
+
setShowMediaControls: F,
|
|
782
779
|
showMediaControls: R,
|
|
783
780
|
tracker: v,
|
|
784
|
-
videoOptions:
|
|
781
|
+
videoOptions: I,
|
|
785
782
|
viewportSize: x
|
|
786
783
|
}) => {
|
|
787
|
-
const u = h === "image" ? `${
|
|
784
|
+
const u = h === "image" ? `${A.image.label}: ${(c == null ? void 0 : c.label) ?? ""}` : h === "video" ? `${A.video.label}: ${(b == null ? void 0 : b.label) ?? ""}` : A.webcam.label;
|
|
788
785
|
return {
|
|
789
|
-
activeDelegate:
|
|
790
|
-
faces:
|
|
786
|
+
activeDelegate: r ? v.activeDelegate : null,
|
|
787
|
+
faces: r ? v.faces : e.faces,
|
|
791
788
|
imageOptions: t,
|
|
792
|
-
layout:
|
|
789
|
+
layout: n,
|
|
793
790
|
mediaError: o,
|
|
794
791
|
mediaFitMode: i,
|
|
795
792
|
mediaLabel: u,
|
|
@@ -799,45 +796,45 @@ const W = ({
|
|
|
799
796
|
selectedSource: h,
|
|
800
797
|
selectedVideoId: f,
|
|
801
798
|
setMirrored: w,
|
|
802
|
-
setSelectedImageId:
|
|
803
|
-
setSelectedSource:
|
|
799
|
+
setSelectedImageId: p,
|
|
800
|
+
setSelectedSource: m,
|
|
804
801
|
setSelectedVideoId: y,
|
|
805
|
-
setShowMediaControls:
|
|
802
|
+
setShowMediaControls: F,
|
|
806
803
|
showMediaControls: R,
|
|
807
|
-
trackerError:
|
|
808
|
-
trackerStatus:
|
|
809
|
-
videoOptions:
|
|
804
|
+
trackerError: r ? v.error : null,
|
|
805
|
+
trackerStatus: r ? v.status : e.trackerStatus,
|
|
806
|
+
videoOptions: I,
|
|
810
807
|
viewportSize: x,
|
|
811
808
|
mediaSize: a
|
|
812
809
|
};
|
|
813
|
-
},
|
|
810
|
+
}, Pe = ({
|
|
814
811
|
mediaTexture: e,
|
|
815
812
|
previewMode: t,
|
|
816
|
-
renderOutputs:
|
|
817
|
-
sceneRenderOutputs:
|
|
818
|
-
}) =>
|
|
813
|
+
renderOutputs: n,
|
|
814
|
+
sceneRenderOutputs: r
|
|
815
|
+
}) => $(
|
|
819
816
|
() => ({
|
|
820
|
-
requested:
|
|
817
|
+
requested: n,
|
|
821
818
|
previewMode: t,
|
|
822
819
|
mediaColorTexture: e,
|
|
823
|
-
sceneColorTexture:
|
|
824
|
-
finalColorTexture:
|
|
825
|
-
sceneDepthTexture:
|
|
820
|
+
sceneColorTexture: r.sceneColorTexture,
|
|
821
|
+
finalColorTexture: n.finalColor ? r.sceneColorTexture : null,
|
|
822
|
+
sceneDepthTexture: r.sceneDepthTexture,
|
|
826
823
|
estimatedDepthTexture: null,
|
|
827
824
|
available: {
|
|
828
825
|
mediaColor: e !== null,
|
|
829
|
-
sceneColor:
|
|
830
|
-
finalColor: !!(
|
|
831
|
-
sceneDepth:
|
|
826
|
+
sceneColor: r.sceneColorTexture !== null,
|
|
827
|
+
finalColor: !!(n.finalColor && r.sceneColorTexture),
|
|
828
|
+
sceneDepth: r.sceneDepthTexture !== null,
|
|
832
829
|
estimatedDepth: !1
|
|
833
830
|
}
|
|
834
831
|
}),
|
|
835
|
-
[e, t,
|
|
836
|
-
),
|
|
832
|
+
[e, t, n, r]
|
|
833
|
+
), $e = ({
|
|
837
834
|
fitMode: e,
|
|
838
835
|
imageOptions: t,
|
|
839
|
-
initialImageId:
|
|
840
|
-
initialMirrored:
|
|
836
|
+
initialImageId: n,
|
|
837
|
+
initialMirrored: r,
|
|
841
838
|
initialSource: o,
|
|
842
839
|
initialVideoId: i,
|
|
843
840
|
mediaStrategy: a,
|
|
@@ -847,140 +844,140 @@ const W = ({
|
|
|
847
844
|
source: d,
|
|
848
845
|
videoOptions: h
|
|
849
846
|
}) => {
|
|
850
|
-
const b =
|
|
851
|
-
() =>
|
|
847
|
+
const b = X(null), f = X(null), w = De(b), p = $(
|
|
848
|
+
() => Ae({
|
|
852
849
|
imageOptions: t,
|
|
853
|
-
initialImageId:
|
|
850
|
+
initialImageId: n,
|
|
854
851
|
initialSource: o,
|
|
855
852
|
initialVideoId: i,
|
|
856
853
|
source: d,
|
|
857
854
|
videoOptions: h
|
|
858
855
|
}),
|
|
859
|
-
[t,
|
|
860
|
-
), [
|
|
861
|
-
|
|
862
|
-
), [x, u] = S(
|
|
856
|
+
[t, n, o, i, d, h]
|
|
857
|
+
), [m, y] = S(r), [F, R] = S(c), [v, I] = S(
|
|
858
|
+
p.selectedSource
|
|
859
|
+
), [x, u] = S(p.selectedImageId), [E, C] = S(p.selectedVideoId), [j, V] = S({
|
|
863
860
|
sceneColorTexture: null,
|
|
864
861
|
sceneDepthTexture: null
|
|
865
|
-
}),
|
|
866
|
-
|
|
867
|
-
d && (
|
|
868
|
-
}, [
|
|
869
|
-
const
|
|
870
|
-
enabled:
|
|
871
|
-
imageAsset:
|
|
862
|
+
}), z = a === "internal";
|
|
863
|
+
M(() => {
|
|
864
|
+
d && (I(p.selectedSource), u(p.selectedImageId), C(p.selectedVideoId));
|
|
865
|
+
}, [p, d]);
|
|
866
|
+
const K = t.find((P) => P.id === x) ?? t[0], G = h.find((P) => P.id === E) ?? h[0], T = We({
|
|
867
|
+
enabled: z,
|
|
868
|
+
imageAsset: K,
|
|
872
869
|
selectedSource: v,
|
|
873
|
-
videoAsset:
|
|
874
|
-
}),
|
|
875
|
-
() =>
|
|
876
|
-
[
|
|
877
|
-
),
|
|
870
|
+
videoAsset: G
|
|
871
|
+
}), _ = ke(e, v), D = $(
|
|
872
|
+
() => Le(T.mediaSize, w, _),
|
|
873
|
+
[T.mediaSize, _, w]
|
|
874
|
+
), re = _e({
|
|
878
875
|
enabled: !!(l.mediaColor || l.finalColor),
|
|
879
|
-
imageRef:
|
|
876
|
+
imageRef: T.imageRef,
|
|
880
877
|
selectedSource: v,
|
|
881
|
-
status:
|
|
882
|
-
videoRef:
|
|
883
|
-
}),
|
|
884
|
-
displayMirrored:
|
|
885
|
-
enabled:
|
|
886
|
-
imageRef:
|
|
887
|
-
layout:
|
|
878
|
+
status: T.status,
|
|
879
|
+
videoRef: T.videoRef
|
|
880
|
+
}), H = Me(v, m), ne = Xe({
|
|
881
|
+
displayMirrored: H,
|
|
882
|
+
enabled: z && T.status === "ready" && D !== null,
|
|
883
|
+
imageRef: T.imageRef,
|
|
884
|
+
layout: D,
|
|
888
885
|
selectedSource: v,
|
|
889
|
-
sourceStream:
|
|
890
|
-
videoRef:
|
|
891
|
-
}),
|
|
892
|
-
enabled: !
|
|
886
|
+
sourceStream: T.stream,
|
|
887
|
+
videoRef: T.videoRef
|
|
888
|
+
}), oe = Be({
|
|
889
|
+
enabled: !z,
|
|
893
890
|
selectedSource: v
|
|
894
|
-
}),
|
|
895
|
-
externalTracker:
|
|
891
|
+
}), ie = He({
|
|
892
|
+
externalTracker: oe,
|
|
896
893
|
imageOptions: t,
|
|
897
|
-
layout:
|
|
898
|
-
managesOwnMedia:
|
|
899
|
-
mediaError:
|
|
900
|
-
mediaFitMode:
|
|
901
|
-
mediaSize:
|
|
902
|
-
mediaStatus:
|
|
903
|
-
mirrored:
|
|
904
|
-
selectedImage:
|
|
894
|
+
layout: D,
|
|
895
|
+
managesOwnMedia: z,
|
|
896
|
+
mediaError: T.error,
|
|
897
|
+
mediaFitMode: _,
|
|
898
|
+
mediaSize: T.mediaSize,
|
|
899
|
+
mediaStatus: T.status,
|
|
900
|
+
mirrored: H,
|
|
901
|
+
selectedImage: K,
|
|
905
902
|
selectedImageId: x,
|
|
906
903
|
selectedSource: v,
|
|
907
|
-
selectedVideo:
|
|
908
|
-
selectedVideoId:
|
|
904
|
+
selectedVideo: G,
|
|
905
|
+
selectedVideoId: E,
|
|
909
906
|
setMirrored: y,
|
|
910
907
|
setSelectedImageId: u,
|
|
911
|
-
setSelectedSource:
|
|
908
|
+
setSelectedSource: I,
|
|
912
909
|
setSelectedVideoId: C,
|
|
913
910
|
setShowMediaControls: R,
|
|
914
|
-
showMediaControls:
|
|
915
|
-
tracker:
|
|
911
|
+
showMediaControls: F,
|
|
912
|
+
tracker: ne,
|
|
916
913
|
videoOptions: h,
|
|
917
914
|
viewportSize: w
|
|
918
|
-
}),
|
|
919
|
-
mediaTexture:
|
|
915
|
+
}), ae = Pe({
|
|
916
|
+
mediaTexture: re,
|
|
920
917
|
previewMode: s,
|
|
921
918
|
renderOutputs: l,
|
|
922
|
-
sceneRenderOutputs:
|
|
919
|
+
sceneRenderOutputs: j
|
|
923
920
|
});
|
|
924
921
|
return {
|
|
925
922
|
containerRef: b,
|
|
926
923
|
displayCanvasRef: f,
|
|
927
|
-
displayMirrored:
|
|
928
|
-
layout:
|
|
929
|
-
managesOwnMedia:
|
|
930
|
-
media:
|
|
931
|
-
renderOutputState:
|
|
932
|
-
renderState:
|
|
924
|
+
displayMirrored: H,
|
|
925
|
+
layout: D,
|
|
926
|
+
managesOwnMedia: z,
|
|
927
|
+
media: T,
|
|
928
|
+
renderOutputState: ae,
|
|
929
|
+
renderState: ie,
|
|
933
930
|
selectedImageId: x,
|
|
934
931
|
selectedSource: v,
|
|
935
|
-
selectedVideoId:
|
|
936
|
-
setSceneRenderOutputs:
|
|
932
|
+
selectedVideoId: E,
|
|
933
|
+
setSceneRenderOutputs: V,
|
|
937
934
|
setSelectedImageId: u,
|
|
938
|
-
setSelectedSource:
|
|
935
|
+
setSelectedSource: I,
|
|
939
936
|
setSelectedVideoId: C,
|
|
940
|
-
showMediaControls:
|
|
937
|
+
showMediaControls: F,
|
|
941
938
|
viewportSize: w
|
|
942
939
|
};
|
|
943
|
-
}, U = ({ children: e }) => /* @__PURE__ */ g(
|
|
940
|
+
}, U = ({ children: e }) => /* @__PURE__ */ g(W, { children: e });
|
|
944
941
|
U.displayName = "XRViewport.Scene";
|
|
945
|
-
const
|
|
946
|
-
|
|
947
|
-
const
|
|
942
|
+
const N = ({ children: e }) => /* @__PURE__ */ g(W, { children: e });
|
|
943
|
+
N.displayName = "XRViewport.Overlay";
|
|
944
|
+
const qe = (e, t) => {
|
|
948
945
|
if (e === "dom")
|
|
949
946
|
return {
|
|
950
947
|
sceneContent: null,
|
|
951
948
|
overlayContent: t
|
|
952
949
|
};
|
|
953
|
-
let
|
|
950
|
+
let n = null, r = null;
|
|
954
951
|
const o = [];
|
|
955
|
-
return
|
|
952
|
+
return he.forEach(t, (i) => {
|
|
956
953
|
var s;
|
|
957
|
-
if (!
|
|
954
|
+
if (!me(i)) {
|
|
958
955
|
i != null && o.push(i);
|
|
959
956
|
return;
|
|
960
957
|
}
|
|
961
958
|
const a = (s = i.type) == null ? void 0 : s.displayName;
|
|
962
959
|
if (a === U.displayName) {
|
|
963
|
-
|
|
960
|
+
n = i.props.children;
|
|
964
961
|
return;
|
|
965
962
|
}
|
|
966
|
-
if (a ===
|
|
967
|
-
|
|
963
|
+
if (a === N.displayName) {
|
|
964
|
+
r = i.props.children;
|
|
968
965
|
return;
|
|
969
966
|
}
|
|
970
967
|
o.push(i);
|
|
971
|
-
}), !
|
|
972
|
-
sceneContent:
|
|
973
|
-
overlayContent:
|
|
968
|
+
}), !r && o.length > 0 && (r = o), {
|
|
969
|
+
sceneContent: n,
|
|
970
|
+
overlayContent: r
|
|
974
971
|
};
|
|
975
972
|
}, Z = (e, t) => typeof e == "function" ? e(t) : e;
|
|
976
|
-
function
|
|
977
|
-
return e.Scene = U, e.Overlay =
|
|
973
|
+
function Ue(e) {
|
|
974
|
+
return e.Scene = U, e.Overlay = N, e;
|
|
978
975
|
}
|
|
979
|
-
const
|
|
976
|
+
const rt = Ue(({
|
|
980
977
|
children: e,
|
|
981
978
|
fitMode: t = "auto",
|
|
982
|
-
imageOptions:
|
|
983
|
-
initialImageId:
|
|
979
|
+
imageOptions: n = [],
|
|
980
|
+
initialImageId: r,
|
|
984
981
|
initialMirrored: o = !0,
|
|
985
982
|
initialSource: i = "webcam",
|
|
986
983
|
initialVideoId: a,
|
|
@@ -992,12 +989,12 @@ const ct = Ge(({
|
|
|
992
989
|
showMediaControlsByDefault: b = !0,
|
|
993
990
|
source: f,
|
|
994
991
|
style: w,
|
|
995
|
-
videoOptions:
|
|
992
|
+
videoOptions: p = []
|
|
996
993
|
}) => {
|
|
997
|
-
const
|
|
994
|
+
const m = $e({
|
|
998
995
|
fitMode: t,
|
|
999
|
-
imageOptions:
|
|
1000
|
-
initialImageId:
|
|
996
|
+
imageOptions: n,
|
|
997
|
+
initialImageId: r,
|
|
1001
998
|
initialMirrored: o,
|
|
1002
999
|
initialSource: i,
|
|
1003
1000
|
initialVideoId: a,
|
|
@@ -1006,44 +1003,44 @@ const ct = Ge(({
|
|
|
1006
1003
|
renderOutputs: h,
|
|
1007
1004
|
showMediaControlsByDefault: b,
|
|
1008
1005
|
source: f,
|
|
1009
|
-
videoOptions:
|
|
1010
|
-
}), y = typeof e == "function" ? e(
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
),
|
|
1006
|
+
videoOptions: p
|
|
1007
|
+
}), y = typeof e == "function" ? e(m.renderState) : e, { sceneContent: F, overlayContent: R } = qe(c, y), v = Z(
|
|
1008
|
+
F,
|
|
1009
|
+
m.renderState
|
|
1010
|
+
), I = Z(
|
|
1014
1011
|
R,
|
|
1015
|
-
|
|
1012
|
+
m.renderState
|
|
1016
1013
|
);
|
|
1017
|
-
return /* @__PURE__ */ g(
|
|
1018
|
-
|
|
1014
|
+
return /* @__PURE__ */ g(be.Provider, { value: m.renderState, children: /* @__PURE__ */ g(we.Provider, { value: m.renderOutputState, children: /* @__PURE__ */ g(
|
|
1015
|
+
Ee,
|
|
1019
1016
|
{
|
|
1020
|
-
containerRef:
|
|
1021
|
-
displayCanvasRef:
|
|
1022
|
-
imageOptions:
|
|
1023
|
-
imageRef:
|
|
1024
|
-
layout:
|
|
1025
|
-
managesOwnMedia:
|
|
1017
|
+
containerRef: m.containerRef,
|
|
1018
|
+
displayCanvasRef: m.displayCanvasRef,
|
|
1019
|
+
imageOptions: n,
|
|
1020
|
+
imageRef: m.media.imageRef,
|
|
1021
|
+
layout: m.layout,
|
|
1022
|
+
managesOwnMedia: m.managesOwnMedia,
|
|
1026
1023
|
mediaDock: l,
|
|
1027
|
-
mirrored:
|
|
1024
|
+
mirrored: m.displayMirrored,
|
|
1028
1025
|
mode: c,
|
|
1029
|
-
overlayContent:
|
|
1026
|
+
overlayContent: I,
|
|
1030
1027
|
renderOutputs: h,
|
|
1031
1028
|
sceneContent: v,
|
|
1032
|
-
selectedImageId:
|
|
1033
|
-
selectedSource:
|
|
1034
|
-
selectedVideoId:
|
|
1035
|
-
setSceneRenderOutputs:
|
|
1036
|
-
setSelectedImageId:
|
|
1037
|
-
setSelectedSource:
|
|
1038
|
-
setSelectedVideoId:
|
|
1039
|
-
showMediaControls:
|
|
1029
|
+
selectedImageId: m.selectedImageId,
|
|
1030
|
+
selectedSource: m.selectedSource,
|
|
1031
|
+
selectedVideoId: m.selectedVideoId,
|
|
1032
|
+
setSceneRenderOutputs: m.setSceneRenderOutputs,
|
|
1033
|
+
setSelectedImageId: m.setSelectedImageId,
|
|
1034
|
+
setSelectedSource: m.setSelectedSource,
|
|
1035
|
+
setSelectedVideoId: m.setSelectedVideoId,
|
|
1036
|
+
showMediaControls: m.showMediaControls,
|
|
1040
1037
|
style: w,
|
|
1041
|
-
videoOptions:
|
|
1042
|
-
videoRef:
|
|
1043
|
-
viewportSize:
|
|
1038
|
+
videoOptions: p,
|
|
1039
|
+
videoRef: m.media.videoRef,
|
|
1040
|
+
viewportSize: m.viewportSize
|
|
1044
1041
|
}
|
|
1045
1042
|
) }) });
|
|
1046
|
-
}),
|
|
1043
|
+
}), Ne = {
|
|
1047
1044
|
position: "absolute",
|
|
1048
1045
|
top: -28,
|
|
1049
1046
|
left: 0,
|
|
@@ -1054,11 +1051,11 @@ const ct = Ge(({
|
|
|
1054
1051
|
fontWeight: 700,
|
|
1055
1052
|
padding: "4px 8px",
|
|
1056
1053
|
whiteSpace: "nowrap"
|
|
1057
|
-
},
|
|
1054
|
+
}, nt = ({
|
|
1058
1055
|
boundingBox: e,
|
|
1059
1056
|
label: t = "face bounding box",
|
|
1060
|
-
color:
|
|
1061
|
-
style:
|
|
1057
|
+
color: n = "#22c55e",
|
|
1058
|
+
style: r,
|
|
1062
1059
|
labelStyle: o
|
|
1063
1060
|
}) => /* @__PURE__ */ g(
|
|
1064
1061
|
"div",
|
|
@@ -1069,42 +1066,42 @@ const ct = Ge(({
|
|
|
1069
1066
|
top: `${e.top * 100}%`,
|
|
1070
1067
|
width: `${e.width * 100}%`,
|
|
1071
1068
|
height: `${e.height * 100}%`,
|
|
1072
|
-
border: `3px solid ${
|
|
1069
|
+
border: `3px solid ${n}`,
|
|
1073
1070
|
boxSizing: "border-box",
|
|
1074
1071
|
pointerEvents: "none",
|
|
1075
1072
|
zIndex: 20,
|
|
1076
|
-
...
|
|
1073
|
+
...r
|
|
1077
1074
|
},
|
|
1078
|
-
children: t !== null && /* @__PURE__ */ g("div", { style: { ...
|
|
1075
|
+
children: t !== null && /* @__PURE__ */ g("div", { style: { ...Ne, ...o }, children: t })
|
|
1079
1076
|
}
|
|
1080
|
-
),
|
|
1081
|
-
const [t,
|
|
1082
|
-
return
|
|
1083
|
-
let
|
|
1077
|
+
), ot = (e) => {
|
|
1078
|
+
const [t, n] = S(null);
|
|
1079
|
+
return M(() => {
|
|
1080
|
+
let r = 0;
|
|
1084
1081
|
const o = () => {
|
|
1085
1082
|
var l, c;
|
|
1086
|
-
|
|
1083
|
+
r = requestAnimationFrame(o);
|
|
1087
1084
|
const i = (c = (l = e == null ? void 0 : e.detectionResults) == null ? void 0 : l.faceLandmarks) == null ? void 0 : c[0];
|
|
1088
1085
|
if (!i || i.length === 0) {
|
|
1089
|
-
|
|
1086
|
+
n(null);
|
|
1090
1087
|
return;
|
|
1091
1088
|
}
|
|
1092
|
-
const a =
|
|
1089
|
+
const a = fe(i), s = {
|
|
1093
1090
|
left: a.minX,
|
|
1094
1091
|
top: a.minY,
|
|
1095
1092
|
width: a.width,
|
|
1096
1093
|
height: a.height
|
|
1097
1094
|
};
|
|
1098
|
-
|
|
1095
|
+
n((d) => d && d.left === s.left && d.top === s.top && d.width === s.width && d.height === s.height ? d : s);
|
|
1099
1096
|
};
|
|
1100
1097
|
return o(), () => {
|
|
1101
|
-
cancelAnimationFrame(
|
|
1098
|
+
cancelAnimationFrame(r);
|
|
1102
1099
|
};
|
|
1103
1100
|
}, [e]), t;
|
|
1104
|
-
},
|
|
1101
|
+
}, it = ({
|
|
1105
1102
|
background: e = "#000",
|
|
1106
1103
|
children: t,
|
|
1107
|
-
style:
|
|
1104
|
+
style: n
|
|
1108
1105
|
}) => /* @__PURE__ */ g(
|
|
1109
1106
|
"div",
|
|
1110
1107
|
{
|
|
@@ -1113,156 +1110,68 @@ const ct = Ge(({
|
|
|
1113
1110
|
inset: 0,
|
|
1114
1111
|
overflow: "hidden",
|
|
1115
1112
|
background: e,
|
|
1116
|
-
...
|
|
1113
|
+
...n
|
|
1117
1114
|
},
|
|
1118
1115
|
children: t
|
|
1119
1116
|
}
|
|
1120
|
-
),
|
|
1121
|
-
const { makeDefault: t = !0, ...
|
|
1117
|
+
), at = (e) => {
|
|
1118
|
+
const { makeDefault: t = !0, ...n } = e;
|
|
1122
1119
|
return /* @__PURE__ */ g(
|
|
1123
|
-
|
|
1120
|
+
pe,
|
|
1124
1121
|
{
|
|
1125
1122
|
position: [0, 0, 40],
|
|
1126
1123
|
fov: 30,
|
|
1127
1124
|
near: 0.1,
|
|
1128
1125
|
far: 1e3,
|
|
1129
1126
|
makeDefault: t,
|
|
1130
|
-
...
|
|
1127
|
+
...n
|
|
1131
1128
|
}
|
|
1132
1129
|
);
|
|
1133
|
-
},
|
|
1134
|
-
const i = Math.max(1, Math.floor(t)), a = Math.max(0, Math.floor(e)), s = r === "ping-pong" && i > 1 ? i * 2 - 2 : i, l = Math.floor(a / s), c = o > 0 ? l >= o : !n && a >= s, d = c ? s - 1 : a % s;
|
|
1135
|
-
return { frame: r === "reverse" ? i - 1 - d % i : r === "random" ? d * 7919 % i : r === "ping-pong" && d >= i ? s - d : d, ended: c, loop: l };
|
|
1136
|
-
}, gt = (e, t, r) => {
|
|
1137
|
-
const n = Math.max(1, Math.floor(r));
|
|
1138
|
-
return Math.floor(Math.max(0, e) * Math.max(0, t)) % n;
|
|
1139
|
-
};
|
|
1140
|
-
class bt {
|
|
1141
|
-
constructor(t, r) {
|
|
1142
|
-
X(this, "capabilities");
|
|
1143
|
-
X(this, "snapshot");
|
|
1144
|
-
X(this, "listeners", /* @__PURE__ */ new Set());
|
|
1145
|
-
X(this, "eventListeners", /* @__PURE__ */ new Map());
|
|
1146
|
-
this.capabilities = t, this.snapshot = {
|
|
1147
|
-
state: "idle",
|
|
1148
|
-
frame: 0,
|
|
1149
|
-
time: 0,
|
|
1150
|
-
playMode: "forward",
|
|
1151
|
-
loop: !0,
|
|
1152
|
-
loopCount: 0,
|
|
1153
|
-
...r
|
|
1154
|
-
};
|
|
1155
|
-
}
|
|
1156
|
-
play() {
|
|
1157
|
-
const t = this.snapshot.state === "paused";
|
|
1158
|
-
this.update({ state: "playing" }), this.emit(t ? "Resume" : "PlayBegin");
|
|
1159
|
-
}
|
|
1160
|
-
pause() {
|
|
1161
|
-
this.update({ state: "paused" }), this.emit("Pause");
|
|
1162
|
-
}
|
|
1163
|
-
restart() {
|
|
1164
|
-
this.update({ state: "playing", frame: 0, time: 0 }), this.emit("PlayBegin");
|
|
1165
|
-
}
|
|
1166
|
-
setPlayMode(t) {
|
|
1167
|
-
this.update({ playMode: t });
|
|
1168
|
-
}
|
|
1169
|
-
setLoop(t, r = 0) {
|
|
1170
|
-
this.update({ loop: t, loopCount: r });
|
|
1171
|
-
}
|
|
1172
|
-
seek(t) {
|
|
1173
|
-
this.capabilities.canSeek && this.update({ frame: Math.max(0, Math.floor(t)), time: Math.max(0, t) });
|
|
1174
|
-
}
|
|
1175
|
-
subscribe(t) {
|
|
1176
|
-
return this.listeners.add(t), () => this.listeners.delete(t);
|
|
1177
|
-
}
|
|
1178
|
-
on(t, r) {
|
|
1179
|
-
const n = this.eventListeners.get(t) ?? /* @__PURE__ */ new Set();
|
|
1180
|
-
return n.add(r), this.eventListeners.set(t, n), () => this.off(t, r);
|
|
1181
|
-
}
|
|
1182
|
-
off(t, r) {
|
|
1183
|
-
var n;
|
|
1184
|
-
(n = this.eventListeners.get(t)) == null || n.delete(r);
|
|
1185
|
-
}
|
|
1186
|
-
getSnapshot() {
|
|
1187
|
-
return this.snapshot;
|
|
1188
|
-
}
|
|
1189
|
-
dispose() {
|
|
1190
|
-
this.listeners.clear(), this.eventListeners.clear(), this.snapshot = { ...this.snapshot, state: "idle" };
|
|
1191
|
-
}
|
|
1192
|
-
emit(t) {
|
|
1193
|
-
var r;
|
|
1194
|
-
(r = this.eventListeners.get(t)) == null || r.forEach((n) => n({ type: t, snapshot: this.snapshot }));
|
|
1195
|
-
}
|
|
1196
|
-
update(t) {
|
|
1197
|
-
this.snapshot = { ...this.snapshot, ...t }, this.listeners.forEach((r) => r(this.snapshot));
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
function wt(e) {
|
|
1201
|
-
return async (t, r) => {
|
|
1202
|
-
const n = e.find((o) => o.canResolve(t));
|
|
1203
|
-
if (!n) throw new Je("No texture provider matched source", t);
|
|
1204
|
-
return Oe(n.resolve.bind(n), t, r);
|
|
1205
|
-
};
|
|
1206
|
-
}
|
|
1207
|
-
class Je extends Error {
|
|
1208
|
-
constructor(r, n) {
|
|
1209
|
-
super(r);
|
|
1210
|
-
X(this, "source");
|
|
1211
|
-
this.name = "TextureSourceLoadError", this.source = n;
|
|
1212
|
-
}
|
|
1213
|
-
}
|
|
1214
|
-
function ee(e) {
|
|
1215
|
-
if (e.aborted)
|
|
1216
|
-
throw new DOMException("Texture source load aborted", "AbortError");
|
|
1217
|
-
}
|
|
1218
|
-
async function Oe(e, t, r) {
|
|
1219
|
-
ee(r);
|
|
1220
|
-
const n = await e(t, r);
|
|
1221
|
-
return r.aborted && (n.dispose(), ee(r)), n;
|
|
1222
|
-
}
|
|
1223
|
-
function xt(e) {
|
|
1224
|
-
e == null || e.dispose();
|
|
1225
|
-
}
|
|
1130
|
+
}, st = ["fill", "contain"];
|
|
1226
1131
|
export {
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1132
|
+
zt as BasicAnimatedTextureController,
|
|
1133
|
+
nt as BoundingBoxOverlay,
|
|
1134
|
+
dt as HeadTracker,
|
|
1135
|
+
Xt as MAX_GIF_BYTES,
|
|
1136
|
+
kt as MAX_GIF_FRAMES,
|
|
1137
|
+
At as MAX_GIF_PIXELS,
|
|
1138
|
+
at as PerspectiveCamera,
|
|
1139
|
+
Ct as ScreenRectAspectContext,
|
|
1140
|
+
st as TEXTURE_FITS,
|
|
1141
|
+
Lt as TextureSourceLoadError,
|
|
1142
|
+
it as XRCompositor,
|
|
1143
|
+
B as XRLayer,
|
|
1144
|
+
xe as XRMediaSurface,
|
|
1145
|
+
tt as XRTrackingOverlay,
|
|
1146
|
+
rt as XRViewport,
|
|
1147
|
+
fe as computeLandmarkBounds,
|
|
1148
|
+
Vt as computeScreenTransform,
|
|
1149
|
+
xt as createFaceInfoTarget,
|
|
1150
|
+
Dt as createTextureSourceResolver,
|
|
1151
|
+
Bt as disposeResolvedTextureSource,
|
|
1152
|
+
vt as getFaceInfo,
|
|
1153
|
+
Wt as getPlaybackFrame,
|
|
1154
|
+
_t as getSequenceFrame,
|
|
1155
|
+
St as getThreeBlending,
|
|
1156
|
+
Rt as getThreeDepthFunction,
|
|
1157
|
+
It as getThreeSide,
|
|
1158
|
+
Ht as gifTextureSourceProvider,
|
|
1159
|
+
Ft as hasFullUnitUVBounds,
|
|
1160
|
+
Me as resolveCalibrationFaceDisplayMirrored,
|
|
1161
|
+
Pt as resolveTextureSource,
|
|
1162
|
+
$t as throwIfAborted,
|
|
1163
|
+
Xe as useCalibrationFaceTracker,
|
|
1164
|
+
ot as useFaceBoundingBox,
|
|
1165
|
+
Et as useScreenSpace,
|
|
1166
|
+
ut as useTrackerContext,
|
|
1167
|
+
mt as useXRCameraTexture,
|
|
1168
|
+
se as useXRContext,
|
|
1169
|
+
ft as useXRError,
|
|
1170
|
+
le as useXRModel,
|
|
1171
|
+
ce as useXRModelNode,
|
|
1172
|
+
pt as useXRPipelineSnapshot,
|
|
1173
|
+
gt as useXRReady,
|
|
1174
|
+
bt as useXRRenderSize,
|
|
1266
1175
|
qt as useXRViewportRenderOutputs,
|
|
1267
|
-
|
|
1176
|
+
Ut as useXRViewportState
|
|
1268
1177
|
};
|