@vincentt-xr/sdk 2.0.0-alpha.6 → 2.0.0-alpha.7

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.
Files changed (77) hide show
  1. package/GROUNDING.md +81 -3
  2. package/dist/{DebuggerUI-DYT_dk1E.cjs → DebuggerUI-B6bP6P9r.cjs} +1 -1
  3. package/dist/{DebuggerUI-C_rbLdkh.js → DebuggerUI-BjOMr8q_.js} +1 -1
  4. package/dist/{FaceMeshRenderer-D1WsrTLA.cjs → FaceMeshRenderer-C5l6VLdO.cjs} +6 -6
  5. package/dist/{FaceMeshRenderer-DSCd1H55.js → FaceMeshRenderer-wjAHrJzP.js} +102 -96
  6. package/dist/{FaceRetouch-DsE0Dbw-.cjs → FaceRetouch-BkJzoA79.cjs} +1 -1
  7. package/dist/{FaceRetouch-CMJbGThL.js → FaceRetouch-DwbKQJAN.js} +4 -4
  8. package/dist/components/FaceMesh/FaceMeshRenderer.d.ts +11 -3
  9. package/dist/components/FaceMesh/canonical/CanonicalFaceMeshRenderer.d.ts +10 -4
  10. package/dist/components/FaceMesh/index.d.ts +2 -2
  11. package/dist/components/SceneObjectRenderer/index.d.ts +9 -2
  12. package/dist/components/XRMediaSurface/index.d.ts +2 -1
  13. package/dist/{contexts-DvQI4PqI.js → contexts-ByhzppYl.js} +3 -3
  14. package/dist/{contexts-h-9TRH0r.cjs → contexts-Dr62It_K.cjs} +1 -1
  15. package/dist/debug-ui/media-source.cjs +1 -1
  16. package/dist/debug-ui/media-source.js +1 -1
  17. package/dist/debug-ui.cjs +1 -1
  18. package/dist/debug-ui.js +10 -10
  19. package/dist/entries/core.d.ts +3 -2
  20. package/dist/entries/face-effects.d.ts +2 -2
  21. package/dist/entries/tracking.d.ts +2 -0
  22. package/dist/face-effects.cjs +1 -1
  23. package/dist/face-effects.js +25 -24
  24. package/dist/{getFaceInfo-B43Cwq4n.js → getFaceInfo-C4QpCQIY.js} +1 -1
  25. package/dist/{getFaceInfo-DEzcL_Ub.cjs → getFaceInfo-fA1bFBub.cjs} +1 -1
  26. package/dist/hooks/useXRSession/facade.d.ts +2 -0
  27. package/dist/{index-I4eF5TKT.js → index-9dlAQAhy.js} +405 -400
  28. package/dist/{index-CY7Z8cHV.cjs → index-BjmTe9eM.cjs} +1 -1
  29. package/dist/{index-D67hHm44.cjs → index-BpEf2BBb.cjs} +1 -1
  30. package/dist/{index-B-s4YbWu.js → index-ByoNj0QP.js} +1 -1
  31. package/dist/{index-CxMEeCRP.cjs → index-CyUUurQT.cjs} +1 -1
  32. package/dist/index-DCiMbxC3.cjs +1 -0
  33. package/dist/{index-G_5h_FJQ.js → index-DXT3WccE.js} +808 -787
  34. package/dist/index-DpI-qo5X.cjs +17 -0
  35. package/dist/{index-DYfY9ljy.js → index-DyVF4vEW.js} +1 -1
  36. package/dist/{index-uE3sKczj.js → index-VJ0SJwmG.js} +1 -1
  37. package/dist/{internal-MvKrz0Nt.cjs → internal-Cq-TEQ5Y.cjs} +1 -1
  38. package/dist/{internal-ldPYiUF0.js → internal-Dmk1cTXq.js} +3 -3
  39. package/dist/internal.cjs +1 -1
  40. package/dist/internal.js +1 -1
  41. package/dist/low-level.cjs +1 -1
  42. package/dist/low-level.js +344 -330
  43. package/dist/main.cjs +1 -1
  44. package/dist/main.js +94 -91
  45. package/dist/{renderGroups-BJsx32q5.cjs → renderGroups-80H3DpTl.cjs} +1 -1
  46. package/dist/{renderGroups-CFt1yYLB.js → renderGroups-KZk6eRiY.js} +1 -1
  47. package/dist/{renderPasses-D-Krl6D0.cjs → renderPasses-BOoBSr8z.cjs} +1 -1
  48. package/dist/{renderPasses-C72MbZ-a.js → renderPasses-BcquyVtu.js} +4 -4
  49. package/dist/scene-object.cjs +1 -1
  50. package/dist/scene-object.js +2 -2
  51. package/dist/screen2d/coordinates.d.ts +20 -0
  52. package/dist/{selectors-ByKNTXeA.js → selectors-B8H97CKA.js} +1 -1
  53. package/dist/{selectors-CAwmL9VW.cjs → selectors-CZLKT2Iv.cjs} +1 -1
  54. package/dist/{session-CANvoLD6.cjs → session-CpkiK5YA.cjs} +1 -1
  55. package/dist/{session-Dhi0OqZo.js → session-DLFN_VII.js} +1 -1
  56. package/dist/tracking/coordinates.d.ts +5 -0
  57. package/dist/tracking.cjs +1 -1
  58. package/dist/tracking.js +69 -66
  59. package/dist/types/common.d.ts +11 -1
  60. package/dist/types/gesture-tracking.d.ts +2 -2
  61. package/dist/types/hand-tracking.d.ts +3 -3
  62. package/dist/types/nodes.d.ts +2 -2
  63. package/dist/types/session.d.ts +7 -1
  64. package/dist/{useFaceInfo-BSZq7AO1.cjs → useFaceInfo-BJ8-_MOs.cjs} +1 -1
  65. package/dist/{useFaceInfo-FVQBBNdY.js → useFaceInfo-Dk426LTu.js} +3 -3
  66. package/dist/{useFaceResults-D62STzT1.js → useFaceResults-CtetsO9M.js} +1 -1
  67. package/dist/{useFaceResults-C3oZkn2Z.cjs → useFaceResults-wBJF3zyp.cjs} +1 -1
  68. package/docs/SDK_DOCUMENTATION.md +3 -0
  69. package/docs/api/capture-recording.mdx +9 -1
  70. package/docs/api/face-mesh.mdx +33 -0
  71. package/docs/api/runtime-3d.mdx +5 -0
  72. package/docs/api/screen-image.mdx +3 -1
  73. package/docs/api/screen-space-coordinates.mdx +31 -0
  74. package/docs/api/trackers.mdx +13 -0
  75. package/package.json +4 -1
  76. package/dist/index-C0-fg1Hk.cjs +0 -1
  77. package/dist/index-DPPpU5By.cjs +0 -17
package/dist/low-level.js CHANGED
@@ -1,18 +1,18 @@
1
- import { u as se, X as O } from "./index-I4eF5TKT.js";
2
- import { u as le } from "./index-B-s4YbWu.js";
3
- import { H as dt, a as ut } from "./index-B-s4YbWu.js";
4
- import { c as ce } from "./selectors-ByKNTXeA.js";
5
- import { u as mt, b as ft, e as pt, a as gt, d as bt } from "./selectors-ByKNTXeA.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-B43Cwq4n.js";
8
- import { d as xt, e as vt } from "./getFaceInfo-B43Cwq4n.js";
9
- import { jsx as g, jsxs as k, Fragment as W } from "react/jsx-runtime";
1
+ import { u as O, X as ee } from "./index-9dlAQAhy.js";
2
+ import { u as le } from "./index-ByoNj0QP.js";
3
+ import { H as ct, a as ut } from "./index-ByoNj0QP.js";
4
+ import { c as de } from "./selectors-B8H97CKA.js";
5
+ import { u as mt, b as ft, e as pt, a as gt, d as bt } from "./selectors-B8H97CKA.js";
6
+ import { useEffect as z, useState as C, useRef as X, useCallback as ce, useLayoutEffect as ue, useMemo as $, Children as he, isValidElement as me } from "react";
7
+ import { c as fe } from "./getFaceInfo-C4QpCQIY.js";
8
+ import { d as xt, e as vt } from "./getFaceInfo-C4QpCQIY.js";
9
+ import { jsx as g, jsxs as k, Fragment as _ } from "react/jsx-runtime";
10
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-uE3sKczj.js";
12
- import { u as ee } from "./useFaceResults-D62STzT1.js";
13
- import { h as Ft } from "./hasFullUnitUVBounds-BGvcFsQM.js";
14
- import { X as ge, a as be, b as we } from "./contexts-DvQI4PqI.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-DvQI4PqI.js";
11
+ import { S as yt, g as Ct, c as Rt, d as It, u as Et } from "./index-VJ0SJwmG.js";
12
+ import { u as te } from "./useFaceResults-CtetsO9M.js";
13
+ import { h as Mt } from "./hasFullUnitUVBounds-BGvcFsQM.js";
14
+ import { X as ge, a as be, b as we } from "./contexts-ByhzppYl.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 _t, e as Wt, f as Ht, r as Pt, t as $t, d as qt, u as Ut } from "./contexts-ByhzppYl.js";
16
16
  import * as L from "three";
17
17
  const B = ({
18
18
  children: e,
@@ -39,74 +39,79 @@ const B = ({
39
39
  layout: t,
40
40
  media: n,
41
41
  mirrored: r,
42
- filter: o
42
+ filter: i
43
43
  }) => {
44
- const i = Math.round(t.destination.width), a = Math.round(t.destination.height);
45
- e.width !== i && (e.width = i), e.height !== a && (e.height = a);
44
+ const o = Math.round(t.destination.width), a = Math.round(t.destination.height);
45
+ e.width !== o && (e.width = o), e.height !== a && (e.height = a);
46
46
  const s = e.getContext("2d");
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 = ({
47
+ s && (s.setTransform(1, 0, 0, 1, 0, 0), s.clearRect(0, 0, o, a), r && (s.translate(o, 0), s.scale(-1, 1)), i && (s.filter = i), s.drawImage(n, t.offsetX, t.offsetY, t.drawWidth, t.drawHeight), i && (s.filter = "none"), s.setTransform(1, 0, 0, 1, 0, 0));
48
+ }, re = ({
49
49
  canvasRef: e,
50
50
  enabled: t = !0,
51
51
  fps: n = 30,
52
52
  imageRef: r,
53
- layout: o,
54
- mirrored: i,
53
+ layout: i,
54
+ mirrored: o,
55
55
  sourceKind: a,
56
56
  videoRef: s
57
57
  }) => {
58
- M(() => {
58
+ z(() => {
59
59
  if (!t) {
60
60
  const b = e.current, f = b == null ? void 0 : b.getContext("2d");
61
61
  b && f && f.clearRect(0, 0, b.width, b.height);
62
62
  return;
63
63
  }
64
- let l = 0, c = 0;
65
- const d = n > 0 ? 1e3 / n : 0, h = (b) => {
66
- if (l = requestAnimationFrame(h), d > 0 && b - c < d) return;
67
- c = b;
64
+ let l = 0, d = 0;
65
+ const c = n > 0 ? 1e3 / n : 0, h = (b) => {
66
+ if (l = requestAnimationFrame(h), c > 0 && b - d < c) return;
67
+ d = b;
68
68
  const f = e.current;
69
- if (!f || !o) return;
69
+ if (!f || !i) return;
70
70
  if (a === "image") {
71
71
  const p = r.current;
72
72
  if (!p || !p.complete || p.naturalWidth <= 0 || p.naturalHeight <= 0)
73
73
  return;
74
74
  q({
75
75
  canvas: f,
76
- layout: o,
76
+ layout: i,
77
77
  media: p,
78
- mirrored: i
78
+ mirrored: o
79
79
  });
80
80
  return;
81
81
  }
82
82
  const w = s.current;
83
83
  !w || w.readyState < 2 || w.videoWidth <= 0 || w.videoHeight <= 0 || q({
84
84
  canvas: f,
85
- layout: o,
85
+ layout: i,
86
86
  media: w,
87
- mirrored: i
87
+ mirrored: o
88
88
  });
89
89
  };
90
90
  return l = requestAnimationFrame(h), () => {
91
91
  cancelAnimationFrame(l);
92
92
  };
93
- }, [e, t, n, r, o, i, a, s]);
93
+ }, [e, t, n, r, i, o, a, s]);
94
94
  }, xe = ({
95
95
  canvasRef: e,
96
96
  imageRef: t,
97
97
  layer: n,
98
98
  layout: r,
99
- mirrored: o,
100
- sourceKind: i,
101
- videoRef: a
102
- }) => (te({
99
+ mirrored: i,
100
+ onCaptureTarget: o,
101
+ sourceKind: a,
102
+ videoRef: s
103
+ }) => (re({
103
104
  canvasRef: e,
104
105
  imageRef: t,
105
106
  layout: r,
106
- mirrored: o,
107
- sourceKind: i,
108
- videoRef: a
109
- }), /* @__PURE__ */ g(B, { config: n, children: /* @__PURE__ */ g(
107
+ mirrored: i,
108
+ sourceKind: a,
109
+ videoRef: s
110
+ }), z(() => {
111
+ const l = e.current;
112
+ if (l)
113
+ return o == null || o(l), () => o == null ? void 0 : o(void 0);
114
+ }, [e, o]), /* @__PURE__ */ g(B, { config: n, children: /* @__PURE__ */ g(
110
115
  "canvas",
111
116
  {
112
117
  ref: e,
@@ -124,26 +129,26 @@ const B = ({
124
129
  controlInsetTop: t,
125
130
  debugVisible: n,
126
131
  fps: r = 15,
127
- imageRef: o,
128
- layer: i,
132
+ imageRef: i,
133
+ layer: o,
129
134
  layout: a,
130
135
  mirrored: s,
131
136
  sourceKind: l,
132
- videoRef: c,
133
- viewportSize: d
137
+ videoRef: d,
138
+ viewportSize: c
134
139
  }) => {
135
- te({
140
+ re({
136
141
  canvasRef: e,
137
142
  enabled: n,
138
143
  fps: r,
139
- imageRef: o,
144
+ imageRef: i,
140
145
  layout: a,
141
146
  mirrored: s,
142
147
  sourceKind: l,
143
- videoRef: c
148
+ videoRef: d
144
149
  });
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));
146
- return /* @__PURE__ */ g(B, { config: i, children: /* @__PURE__ */ g(
150
+ const h = Math.min(220, Math.max(120, c.width * 0.22)), b = c.width > 0 && c.height > 0 ? c.width / c.height : 1, f = Math.min(c.height - 24, Math.max(t ?? 16, 16));
151
+ return /* @__PURE__ */ g(B, { config: o, children: /* @__PURE__ */ g(
147
152
  "canvas",
148
153
  {
149
154
  ref: e,
@@ -169,17 +174,17 @@ const B = ({
169
174
  facingMode: "user",
170
175
  frameRate: { ideal: 30, max: 60 }
171
176
  }
172
- }, ye = {
177
+ }, Se = {
173
178
  name: "viewport-live",
174
179
  clearColor: "#000000",
175
180
  pointerEvents: "none",
176
181
  zIndex: 0
177
- }, Ce = {
182
+ }, ye = {
178
183
  name: "viewport-ui",
179
184
  clearColor: "transparent",
180
185
  pointerEvents: "auto",
181
186
  zIndex: 5
182
- }, Se = {
187
+ }, Ce = {
183
188
  name: "viewport-scene",
184
189
  clearColor: "transparent",
185
190
  pointerEvents: "auto",
@@ -192,7 +197,7 @@ const B = ({
192
197
  imageRef: e,
193
198
  selectedSource: t,
194
199
  videoRef: n
195
- }) => /* @__PURE__ */ k(W, { children: [
200
+ }) => /* @__PURE__ */ k(_, { children: [
196
201
  /* @__PURE__ */ g(
197
202
  "video",
198
203
  {
@@ -225,7 +230,7 @@ const B = ({
225
230
  label: t,
226
231
  onChange: n,
227
232
  options: r,
228
- value: o
233
+ value: i
229
234
  }) => /* @__PURE__ */ g(
230
235
  "div",
231
236
  {
@@ -258,8 +263,8 @@ const B = ({
258
263
  /* @__PURE__ */ g(
259
264
  "select",
260
265
  {
261
- value: o,
262
- onChange: (i) => n(i.target.value),
266
+ value: i,
267
+ onChange: (o) => n(o.target.value),
263
268
  style: {
264
269
  minWidth: 180,
265
270
  maxWidth: "calc(100vw - 52px)",
@@ -270,7 +275,7 @@ const B = ({
270
275
  color: "#e5eefb",
271
276
  padding: "0 10px"
272
277
  },
273
- children: r.map((i) => /* @__PURE__ */ g("option", { value: i.id, style: { color: "#111827" }, children: i.label }, i.id))
278
+ children: r.map((o) => /* @__PURE__ */ g("option", { value: o.id, style: { color: "#111827" }, children: o.label }, o.id))
274
279
  }
275
280
  )
276
281
  ]
@@ -282,15 +287,15 @@ const B = ({
282
287
  imageOptions: t,
283
288
  selectedImageId: n,
284
289
  selectedSource: r,
285
- selectedVideoId: o,
286
- setSelectedImageId: i,
290
+ selectedVideoId: i,
291
+ setSelectedImageId: o,
287
292
  setSelectedSource: a,
288
293
  setSelectedVideoId: s,
289
294
  showMediaControls: l,
290
- videoOptions: c
295
+ videoOptions: d
291
296
  }) => {
292
- const [d, h] = S(!1), b = ["webcam", "image", "video"].filter((f) => f === "image" ? t.length > 0 : f === "video" ? c.length > 0 : !0);
293
- return l ? d ? /* @__PURE__ */ g(
297
+ const [c, h] = C(!1), b = ["webcam", "image", "video"].filter((f) => f === "image" ? t.length > 0 : f === "video" ? d.length > 0 : !0);
298
+ return l ? c ? /* @__PURE__ */ g(
294
299
  "button",
295
300
  {
296
301
  type: "button",
@@ -315,7 +320,7 @@ const B = ({
315
320
  },
316
321
  children: "≡"
317
322
  }
318
- ) : /* @__PURE__ */ k(W, { children: [
323
+ ) : /* @__PURE__ */ k(_, { children: [
319
324
  /* @__PURE__ */ k(
320
325
  "div",
321
326
  {
@@ -412,16 +417,16 @@ const B = ({
412
417
  label: "Image Asset",
413
418
  options: t,
414
419
  value: n,
415
- onChange: i
420
+ onChange: o
416
421
  }
417
422
  ),
418
- r === "video" && c.length > 0 && /* @__PURE__ */ g(
423
+ r === "video" && d.length > 0 && /* @__PURE__ */ g(
419
424
  Y,
420
425
  {
421
426
  dock: e,
422
427
  label: "Video Asset",
423
- options: c,
424
- value: o,
428
+ options: d,
429
+ value: i,
425
430
  onChange: s
426
431
  }
427
432
  )
@@ -431,122 +436,126 @@ const B = ({
431
436
  displayCanvasRef: t,
432
437
  imageOptions: n,
433
438
  imageRef: r,
434
- layout: o,
435
- managesOwnMedia: i,
439
+ layout: i,
440
+ managesOwnMedia: o,
436
441
  mediaDock: a,
437
442
  mode: s,
438
443
  overlayContent: l,
439
- renderOutputs: c,
440
- sceneContent: d,
444
+ renderOutputs: d,
445
+ sceneContent: c,
441
446
  selectedImageId: h,
442
447
  selectedSource: b,
443
448
  selectedVideoId: f,
444
449
  setSceneRenderOutputs: w,
445
450
  setSelectedImageId: p,
446
451
  setSelectedSource: m,
447
- setSelectedVideoId: y,
448
- showMediaControls: F,
452
+ setSelectedVideoId: S,
453
+ showMediaControls: M,
449
454
  style: R,
450
455
  videoOptions: v,
451
- videoRef: I,
456
+ videoRef: E,
452
457
  viewportSize: x,
453
458
  mirrored: u
454
- }) => /* @__PURE__ */ k(
455
- "div",
456
- {
457
- ref: e,
458
- style: {
459
- position: "fixed",
460
- inset: 0,
461
- overflow: "hidden",
462
- background: "#000",
463
- ...R
464
- },
465
- children: [
466
- /* @__PURE__ */ g(Re, { imageRef: r, selectedSource: b, videoRef: I }),
467
- s === "dom" && i && /* @__PURE__ */ g(
468
- xe,
469
- {
470
- canvasRef: t,
471
- imageRef: r,
472
- videoRef: I,
473
- layer: ye,
474
- layout: o,
475
- mirrored: u,
476
- sourceKind: b === "image" ? "image" : "video"
477
- }
478
- ),
479
- (s === "r3f" || s === "hybrid") && /* @__PURE__ */ g(B, { config: Se, children: /* @__PURE__ */ g(
480
- ge,
481
- {
482
- onRenderOutputs: w,
483
- renderOutputs: {
484
- sceneColor: c.sceneColor || c.finalColor,
485
- sceneDepth: c.sceneDepth
486
- },
487
- renderTargetSize: x,
488
- style: { width: "100%", height: "100%" },
489
- children: d
490
- }
491
- ) }),
492
- /* @__PURE__ */ k(B, { config: Ce, children: [
493
- i && /* @__PURE__ */ g(
494
- Ie,
459
+ }) => {
460
+ const { session: I } = O();
461
+ return /* @__PURE__ */ k(
462
+ "div",
463
+ {
464
+ ref: e,
465
+ style: {
466
+ position: "fixed",
467
+ inset: 0,
468
+ overflow: "hidden",
469
+ background: "#000",
470
+ ...R
471
+ },
472
+ children: [
473
+ /* @__PURE__ */ g(Re, { imageRef: r, selectedSource: b, videoRef: E }),
474
+ s === "dom" && o && /* @__PURE__ */ g(
475
+ xe,
495
476
  {
496
- dock: a,
497
- imageOptions: n,
498
- selectedImageId: h,
499
- selectedSource: b,
500
- selectedVideoId: f,
501
- setSelectedImageId: p,
502
- setSelectedSource: m,
503
- setSelectedVideoId: y,
504
- showMediaControls: F,
505
- videoOptions: v
477
+ canvasRef: t,
478
+ imageRef: r,
479
+ videoRef: E,
480
+ layer: Se,
481
+ layout: i,
482
+ mirrored: u,
483
+ onCaptureTarget: I._setCaptureTarget,
484
+ sourceKind: b === "image" ? "image" : "video"
506
485
  }
507
486
  ),
508
- l
509
- ] })
510
- ]
511
- }
512
- ), Te = 5, Fe = 1, Me = (e, t) => t, ze = "brightness(2.2) contrast(1.5) saturate(1.25)", Xe = ({
487
+ (s === "r3f" || s === "hybrid") && /* @__PURE__ */ g(B, { config: Ce, children: /* @__PURE__ */ g(
488
+ ge,
489
+ {
490
+ onRenderOutputs: w,
491
+ renderOutputs: {
492
+ sceneColor: d.sceneColor || d.finalColor,
493
+ sceneDepth: d.sceneDepth
494
+ },
495
+ renderTargetSize: x,
496
+ style: { width: "100%", height: "100%" },
497
+ children: c
498
+ }
499
+ ) }),
500
+ /* @__PURE__ */ k(B, { config: ye, children: [
501
+ o && /* @__PURE__ */ g(
502
+ Ie,
503
+ {
504
+ dock: a,
505
+ imageOptions: n,
506
+ selectedImageId: h,
507
+ selectedSource: b,
508
+ selectedVideoId: f,
509
+ setSelectedImageId: p,
510
+ setSelectedSource: m,
511
+ setSelectedVideoId: S,
512
+ showMediaControls: M,
513
+ videoOptions: v
514
+ }
515
+ ),
516
+ l
517
+ ] })
518
+ ]
519
+ }
520
+ );
521
+ }, Fe = 5, Me = 1, Te = (e, t) => t, ze = "brightness(2.2) contrast(1.5) saturate(1.25)", Xe = ({
513
522
  enabled: e,
514
523
  displayMirrored: t,
515
524
  imageRef: n,
516
525
  layout: r,
517
- mode: o,
518
- numFaces: i,
526
+ mode: i,
527
+ numFaces: o,
519
528
  selectedSource: a,
520
529
  sourceStream: s,
521
530
  videoRef: l
522
531
  }) => {
523
- const { session: c } = se(), d = X(null), h = X(!1), b = X(document.createElement("canvas")), {
532
+ const { session: d } = O(), c = X(null), h = X(!1), b = X(document.createElement("canvas")), {
524
533
  ready: f,
525
534
  node: w,
526
535
  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({
536
+ } = le(ee.FACE_TRACKER, {
537
+ numFaces: o ?? (i === "head-binding" ? Me : Fe)
538
+ }), [m, S] = C("idle"), [M, R] = C(null), v = e && f && !!w, E = te({
530
539
  node: v ? w : null,
531
540
  enabled: v,
532
541
  selectedSource: a,
533
- onFrame: de(() => {
534
- R(null), y("ready");
542
+ onFrame: ce(() => {
543
+ R(null), S("ready");
535
544
  }, [])
536
545
  });
537
- return M(() => {
546
+ return z(() => {
538
547
  if (!e || !r) return;
539
548
  const x = () => {
540
- const C = a === "image" ? n.current : l.current;
541
- if (C) {
542
- if (C instanceof HTMLImageElement) {
543
- if (!C.complete || C.naturalWidth <= 0 || C.naturalHeight <= 0) return;
544
- } else if (C.readyState < 2 || C.videoWidth <= 0 || C.videoHeight <= 0)
549
+ const y = a === "image" ? n.current : l.current;
550
+ if (y) {
551
+ if (y instanceof HTMLImageElement) {
552
+ if (!y.complete || y.naturalWidth <= 0 || y.naturalHeight <= 0) return;
553
+ } else if (y.readyState < 2 || y.videoWidth <= 0 || y.videoHeight <= 0)
545
554
  return;
546
555
  q({
547
556
  canvas: b.current,
548
557
  layout: r,
549
- media: C,
558
+ media: y,
550
559
  mirrored: t,
551
560
  filter: a === "webcam" ? ze : void 0
552
561
  });
@@ -557,75 +566,80 @@ const B = ({
557
566
  return;
558
567
  }
559
568
  let u = 0;
560
- const E = () => {
561
- u = requestAnimationFrame(E), x();
569
+ const I = () => {
570
+ u = requestAnimationFrame(I), x();
562
571
  };
563
- return u = requestAnimationFrame(E), () => cancelAnimationFrame(u);
564
- }, [t, e, n, r, a, l]), M(() => {
572
+ return u = requestAnimationFrame(I), () => cancelAnimationFrame(u);
573
+ }, [t, e, n, r, a, l]), z(() => {
565
574
  var V;
566
575
  if (!e) {
567
- y("idle"), R(null), h.current = !1, d.current = null;
576
+ S("idle"), R(null), h.current = !1, c.current = null;
568
577
  return;
569
578
  }
570
579
  if (!r) {
571
- y("initializing");
580
+ S("initializing");
572
581
  return;
573
582
  }
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);
576
- let C = !1;
583
+ const x = (s == null ? void 0 : s.id) ?? (((V = l.current) == null ? void 0 : V.srcObject) instanceof MediaStream ? l.current.srcObject.id : "none"), I = a === "webcam" ? `webcam:${x}` : a;
584
+ c.current !== I && (h.current = !1, c.current = I);
585
+ let y = !1;
577
586
  return (async () => {
578
587
  try {
579
- if (y("initializing"), h.current || (await c.setFrameSource({
588
+ S("initializing");
589
+ const T = !h.current;
590
+ if (T && await d.setFrameSource({
580
591
  canvas: b.current,
581
592
  sourceKind: a
582
- }), await c.start(), h.current = !0), C) return;
583
- R(null), y("initializing");
584
- } catch (z) {
585
- if (C) return;
586
- y("error"), R(z instanceof Error ? z.message : "Failed to initialize SDK face tracking");
593
+ }), await d._setRenderSize(
594
+ Math.round(r.destination.width),
595
+ Math.round(r.destination.height)
596
+ ), T && (await d.start(), h.current = !0), y) return;
597
+ R(null), S("initializing");
598
+ } catch (T) {
599
+ if (y) return;
600
+ S("error"), R(T instanceof Error ? T.message : "Failed to initialize SDK face tracking");
587
601
  }
588
602
  })(), () => {
589
- C = !0;
603
+ y = !0;
590
604
  };
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(() => () => {
596
- h.current = !1, c.stop();
597
- }, [c]), {
605
+ }, [e, r, a, d, s, l]), z(() => {
606
+ !v && e && !p && S("initializing");
607
+ }, [v, e, p]), z(() => {
608
+ p && (S("error"), R(p.message));
609
+ }, [p]), z(() => () => {
610
+ h.current = !1, d.stop();
611
+ }, [d]), {
598
612
  activeDelegate: "GPU",
599
- faces: I,
613
+ faces: E,
600
614
  status: m,
601
- error: F
615
+ error: M
602
616
  };
603
617
  }, ke = (e, t) => e === "auto" ? t === "webcam" ? "cover" : "contain" : e, Ae = ({
604
618
  imageOptions: e,
605
619
  initialImageId: t,
606
620
  initialSource: n,
607
621
  initialVideoId: r,
608
- source: o,
609
- videoOptions: i
622
+ source: i,
623
+ videoOptions: o
610
624
  }) => {
611
- var l, c, d, h;
612
- const a = (o == null ? void 0 : o.kind) ?? n ?? "webcam";
625
+ var l, d, c, h;
626
+ const a = (i == null ? void 0 : i.kind) ?? n ?? "webcam";
613
627
  return {
614
- selectedSource: a === "image" && e.length === 0 || a === "video" && i.length === 0 ? "webcam" : a,
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) ?? "",
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) ?? ""
628
+ selectedSource: a === "image" && e.length === 0 || a === "video" && o.length === 0 ? "webcam" : a,
629
+ selectedImageId: (i == null ? void 0 : i.kind) === "image" ? i.assetId ?? ((l = e[0]) == null ? void 0 : l.id) ?? "" : t ?? ((d = e[0]) == null ? void 0 : d.id) ?? "",
630
+ selectedVideoId: (i == null ? void 0 : i.kind) === "video" ? i.assetId ?? ((c = o[0]) == null ? void 0 : c.id) ?? "" : r ?? ((h = o[0]) == null ? void 0 : h.id) ?? ""
617
631
  };
618
632
  }, Le = (e, t, n) => {
619
633
  if (e.width <= 0 || e.height <= 0 || t.width <= 0 || t.height <= 0)
620
634
  return null;
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;
635
+ const r = n === "contain" ? Math.min(t.width / e.width, t.height / e.height) : Math.max(t.width / e.width, t.height / e.height), i = e.width * r, o = e.height * r;
622
636
  return {
623
637
  source: e,
624
638
  destination: t,
625
- drawWidth: o,
626
- drawHeight: i,
627
- offsetX: (t.width - o) * 0.5,
628
- offsetY: (t.height - i) * 0.5,
639
+ drawWidth: i,
640
+ drawHeight: o,
641
+ offsetX: (t.width - i) * 0.5,
642
+ offsetY: (t.height - o) * 0.5,
629
643
  scale: r
630
644
  };
631
645
  }, Ve = (e) => {
@@ -636,82 +650,82 @@ const B = ({
636
650
  height: t.height || e.clientHeight
637
651
  };
638
652
  }, De = (e) => {
639
- const [t, n] = S({ width: 0, height: 0 });
653
+ const [t, n] = C({ width: 0, height: 0 });
640
654
  return ue(() => {
641
655
  const r = e.current;
642
656
  if (!r) return;
643
- let o = 0;
644
- const i = () => {
645
- const c = Ve(r);
657
+ let i = 0;
658
+ const o = () => {
659
+ const d = Ve(r);
646
660
  n(
647
- (d) => d.width === c.width && d.height === c.height ? d : c
661
+ (c) => c.width === d.width && c.height === d.height ? c : d
648
662
  );
649
663
  }, a = () => {
650
- i(), o && cancelAnimationFrame(o), o = requestAnimationFrame(i);
664
+ o(), i && cancelAnimationFrame(i), i = requestAnimationFrame(o);
651
665
  };
652
666
  a();
653
667
  const s = new ResizeObserver(a);
654
668
  s.observe(r);
655
669
  const l = window.visualViewport;
656
670
  return window.addEventListener("resize", a), window.addEventListener("orientationchange", a), l == null || l.addEventListener("resize", a), l == null || l.addEventListener("scroll", a), () => {
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);
671
+ i && cancelAnimationFrame(i), s.disconnect(), window.removeEventListener("resize", a), window.removeEventListener("orientationchange", a), l == null || l.removeEventListener("resize", a), l == null || l.removeEventListener("scroll", a);
658
672
  };
659
673
  }, [e]), t;
660
674
  }, Be = ({
661
675
  enabled: e,
662
676
  selectedSource: t
663
677
  }) => {
664
- const n = ce(O.FACE_TRACKER);
678
+ const n = de(ee.FACE_TRACKER);
665
679
  return {
666
- faces: ee({ node: n, enabled: e, selectedSource: t }),
680
+ faces: te({ node: n, enabled: e, selectedSource: t }),
667
681
  trackerStatus: n ? "ready" : "idle"
668
682
  };
669
683
  }, J = (e) => {
670
684
  e && (e.pause(), e.removeAttribute("src"), e.srcObject = null, e.load());
671
685
  }, Q = (e) => {
672
686
  e && e.removeAttribute("src");
673
- }, We = ({
687
+ }, _e = ({
674
688
  enabled: e,
675
689
  imageAsset: t,
676
690
  selectedSource: n,
677
691
  videoAsset: r
678
692
  }) => {
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(() => {
693
+ const i = X(null), o = X(null), [a, s] = C(null), [l, d] = C({ width: 0, height: 0 }), [c, h] = C("idle"), [b, f] = C(null);
694
+ return z(() => {
681
695
  if (!e) {
682
- J(o.current), Q(i.current), s(null), c({ width: 0, height: 0 }), h("idle"), f(null);
696
+ J(i.current), Q(o.current), s(null), d({ width: 0, height: 0 }), h("idle"), f(null);
683
697
  return;
684
698
  }
685
699
  let w = !1, p = null;
686
700
  const m = (x, u) => {
687
- w || (c({ width: x, height: u }), h("ready"), f(null));
688
- }, y = () => {
689
- J(o.current), Q(i.current), p == null || p.getTracks().forEach((x) => x.stop()), p = null, s(null);
690
- }, F = async () => {
701
+ w || (d({ width: x, height: u }), h("ready"), f(null));
702
+ }, S = () => {
703
+ J(i.current), Q(o.current), p == null || p.getTracks().forEach((x) => x.stop()), p = null, s(null);
704
+ }, M = async () => {
691
705
  h("requesting");
692
706
  const x = await navigator.mediaDevices.getUserMedia(ve);
693
707
  if (w) {
694
- x.getTracks().forEach((E) => E.stop());
708
+ x.getTracks().forEach((I) => I.stop());
695
709
  return;
696
710
  }
697
711
  p = x, s(x);
698
- const u = o.current;
712
+ const u = i.current;
699
713
  u && (u.srcObject = x, u.muted = !0, u.playsInline = !0, u.autoplay = !0, await u.play(), m(u.videoWidth, u.videoHeight));
700
714
  }, R = async (x) => {
701
715
  h("requesting"), s(null);
702
- const u = o.current;
716
+ const u = i.current;
703
717
  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));
704
718
  }, v = async (x) => {
705
719
  h("requesting"), s(null);
706
- const u = i.current;
707
- u && (await new Promise((E, C) => {
708
- u.onload = () => E(), u.onerror = () => C(new Error("Unable to load image")), u.src = x;
720
+ const u = o.current;
721
+ u && (await new Promise((I, y) => {
722
+ u.onload = () => I(), u.onerror = () => y(new Error("Unable to load image")), u.src = x;
709
723
  }), m(u.naturalWidth, u.naturalHeight));
710
724
  };
711
- return y(), (async () => {
725
+ return S(), (async () => {
712
726
  try {
713
727
  if (n === "webcam") {
714
- await F();
728
+ await M();
715
729
  return;
716
730
  }
717
731
  if (n === "video") {
@@ -726,84 +740,84 @@ const B = ({
726
740
  h("error"), f(x instanceof Error ? x.message : `Unable to initialize ${n}`);
727
741
  }
728
742
  })(), () => {
729
- w = !0, y();
743
+ w = !0, S();
730
744
  };
731
745
  }, [e, t, n, r]), {
732
- videoRef: o,
733
- imageRef: i,
746
+ videoRef: i,
747
+ imageRef: o,
734
748
  stream: a,
735
749
  mediaSize: l,
736
- status: d,
750
+ status: c,
737
751
  error: b
738
752
  };
739
- }, _e = ({
753
+ }, We = ({
740
754
  enabled: e,
741
755
  imageRef: t,
742
756
  selectedSource: n,
743
757
  status: r,
744
- videoRef: o
758
+ videoRef: i
745
759
  }) => {
746
- const [i, a] = S(null);
747
- return M(() => {
760
+ const [o, a] = C(null);
761
+ return z(() => {
748
762
  if (!e || r !== "ready") {
749
- a((c) => (c == null || c.dispose(), null));
763
+ a((d) => (d == null || d.dispose(), null));
750
764
  return;
751
765
  }
752
- const s = n === "image" ? t.current : o.current;
766
+ const s = n === "image" ? t.current : i.current;
753
767
  if (!s) return;
754
768
  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)), () => {
769
+ return l.colorSpace = L.SRGBColorSpace, l.minFilter = L.LinearFilter, l.magFilter = L.LinearFilter, l.generateMipmaps = !1, l.needsUpdate = !0, a((d) => (d == null || d.dispose(), l)), () => {
756
770
  l.dispose();
757
771
  };
758
- }, [e, t, n, r, o]), i;
772
+ }, [e, t, n, r, i]), o;
759
773
  }, He = ({
760
774
  externalTracker: e,
761
775
  imageOptions: t,
762
776
  layout: n,
763
777
  managesOwnMedia: r,
764
- mediaError: o,
765
- mediaFitMode: i,
778
+ mediaError: i,
779
+ mediaFitMode: o,
766
780
  mediaSize: a,
767
781
  mediaStatus: s,
768
782
  mirrored: l,
769
- selectedImage: c,
770
- selectedImageId: d,
783
+ selectedImage: d,
784
+ selectedImageId: c,
771
785
  selectedSource: h,
772
786
  selectedVideo: b,
773
787
  selectedVideoId: f,
774
788
  setMirrored: w,
775
789
  setSelectedImageId: p,
776
790
  setSelectedSource: m,
777
- setSelectedVideoId: y,
778
- setShowMediaControls: F,
791
+ setSelectedVideoId: S,
792
+ setShowMediaControls: M,
779
793
  showMediaControls: R,
780
794
  tracker: v,
781
- videoOptions: I,
795
+ videoOptions: E,
782
796
  viewportSize: x
783
797
  }) => {
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;
798
+ const u = h === "image" ? `${A.image.label}: ${(d == null ? void 0 : d.label) ?? ""}` : h === "video" ? `${A.video.label}: ${(b == null ? void 0 : b.label) ?? ""}` : A.webcam.label;
785
799
  return {
786
800
  activeDelegate: r ? v.activeDelegate : null,
787
801
  faces: r ? v.faces : e.faces,
788
802
  imageOptions: t,
789
803
  layout: n,
790
- mediaError: o,
791
- mediaFitMode: i,
804
+ mediaError: i,
805
+ mediaFitMode: o,
792
806
  mediaLabel: u,
793
807
  mediaStatus: s,
794
808
  mirrored: l,
795
- selectedImageId: d,
809
+ selectedImageId: c,
796
810
  selectedSource: h,
797
811
  selectedVideoId: f,
798
812
  setMirrored: w,
799
813
  setSelectedImageId: p,
800
814
  setSelectedSource: m,
801
- setSelectedVideoId: y,
802
- setShowMediaControls: F,
815
+ setSelectedVideoId: S,
816
+ setShowMediaControls: M,
803
817
  showMediaControls: R,
804
818
  trackerError: r ? v.error : null,
805
819
  trackerStatus: r ? v.status : e.trackerStatus,
806
- videoOptions: I,
820
+ videoOptions: E,
807
821
  viewportSize: x,
808
822
  mediaSize: a
809
823
  };
@@ -835,85 +849,85 @@ const B = ({
835
849
  imageOptions: t,
836
850
  initialImageId: n,
837
851
  initialMirrored: r,
838
- initialSource: o,
839
- initialVideoId: i,
852
+ initialSource: i,
853
+ initialVideoId: o,
840
854
  mediaStrategy: a,
841
855
  previewMode: s,
842
856
  renderOutputs: l,
843
- showMediaControlsByDefault: c,
844
- source: d,
857
+ showMediaControlsByDefault: d,
858
+ source: c,
845
859
  videoOptions: h
846
860
  }) => {
847
861
  const b = X(null), f = X(null), w = De(b), p = $(
848
862
  () => Ae({
849
863
  imageOptions: t,
850
864
  initialImageId: n,
851
- initialSource: o,
852
- initialVideoId: i,
853
- source: d,
865
+ initialSource: i,
866
+ initialVideoId: o,
867
+ source: c,
854
868
  videoOptions: h
855
869
  }),
856
- [t, n, o, i, d, h]
857
- ), [m, y] = S(r), [F, R] = S(c), [v, I] = S(
870
+ [t, n, i, o, c, h]
871
+ ), [m, S] = C(r), [M, R] = C(d), [v, E] = C(
858
872
  p.selectedSource
859
- ), [x, u] = S(p.selectedImageId), [E, C] = S(p.selectedVideoId), [j, V] = S({
873
+ ), [x, u] = C(p.selectedImageId), [I, y] = C(p.selectedVideoId), [j, V] = C({
860
874
  sceneColorTexture: null,
861
875
  sceneDepthTexture: null
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,
876
+ }), T = a === "internal";
877
+ z(() => {
878
+ c && (E(p.selectedSource), u(p.selectedImageId), y(p.selectedVideoId));
879
+ }, [p, c]);
880
+ const K = t.find((P) => P.id === x) ?? t[0], G = h.find((P) => P.id === I) ?? h[0], F = _e({
881
+ enabled: T,
868
882
  imageAsset: K,
869
883
  selectedSource: v,
870
884
  videoAsset: G
871
- }), _ = ke(e, v), D = $(
872
- () => Le(T.mediaSize, w, _),
873
- [T.mediaSize, _, w]
874
- ), re = _e({
885
+ }), W = ke(e, v), D = $(
886
+ () => Le(F.mediaSize, w, W),
887
+ [F.mediaSize, W, w]
888
+ ), ne = We({
875
889
  enabled: !!(l.mediaColor || l.finalColor),
876
- imageRef: T.imageRef,
890
+ imageRef: F.imageRef,
877
891
  selectedSource: v,
878
- status: T.status,
879
- videoRef: T.videoRef
880
- }), H = Me(v, m), ne = Xe({
892
+ status: F.status,
893
+ videoRef: F.videoRef
894
+ }), H = Te(v, m), oe = Xe({
881
895
  displayMirrored: H,
882
- enabled: z && T.status === "ready" && D !== null,
883
- imageRef: T.imageRef,
896
+ enabled: T && F.status === "ready" && D !== null,
897
+ imageRef: F.imageRef,
884
898
  layout: D,
885
899
  selectedSource: v,
886
- sourceStream: T.stream,
887
- videoRef: T.videoRef
888
- }), oe = Be({
889
- enabled: !z,
900
+ sourceStream: F.stream,
901
+ videoRef: F.videoRef
902
+ }), ie = Be({
903
+ enabled: !T,
890
904
  selectedSource: v
891
- }), ie = He({
892
- externalTracker: oe,
905
+ }), ae = He({
906
+ externalTracker: ie,
893
907
  imageOptions: t,
894
908
  layout: D,
895
- managesOwnMedia: z,
896
- mediaError: T.error,
897
- mediaFitMode: _,
898
- mediaSize: T.mediaSize,
899
- mediaStatus: T.status,
909
+ managesOwnMedia: T,
910
+ mediaError: F.error,
911
+ mediaFitMode: W,
912
+ mediaSize: F.mediaSize,
913
+ mediaStatus: F.status,
900
914
  mirrored: H,
901
915
  selectedImage: K,
902
916
  selectedImageId: x,
903
917
  selectedSource: v,
904
918
  selectedVideo: G,
905
- selectedVideoId: E,
906
- setMirrored: y,
919
+ selectedVideoId: I,
920
+ setMirrored: S,
907
921
  setSelectedImageId: u,
908
- setSelectedSource: I,
909
- setSelectedVideoId: C,
922
+ setSelectedSource: E,
923
+ setSelectedVideoId: y,
910
924
  setShowMediaControls: R,
911
- showMediaControls: F,
912
- tracker: ne,
925
+ showMediaControls: M,
926
+ tracker: oe,
913
927
  videoOptions: h,
914
928
  viewportSize: w
915
- }), ae = Pe({
916
- mediaTexture: re,
929
+ }), se = Pe({
930
+ mediaTexture: ne,
917
931
  previewMode: s,
918
932
  renderOutputs: l,
919
933
  sceneRenderOutputs: j
@@ -923,23 +937,23 @@ const B = ({
923
937
  displayCanvasRef: f,
924
938
  displayMirrored: H,
925
939
  layout: D,
926
- managesOwnMedia: z,
927
- media: T,
928
- renderOutputState: ae,
929
- renderState: ie,
940
+ managesOwnMedia: T,
941
+ media: F,
942
+ renderOutputState: se,
943
+ renderState: ae,
930
944
  selectedImageId: x,
931
945
  selectedSource: v,
932
- selectedVideoId: E,
946
+ selectedVideoId: I,
933
947
  setSceneRenderOutputs: V,
934
948
  setSelectedImageId: u,
935
- setSelectedSource: I,
936
- setSelectedVideoId: C,
937
- showMediaControls: F,
949
+ setSelectedSource: E,
950
+ setSelectedVideoId: y,
951
+ showMediaControls: M,
938
952
  viewportSize: w
939
953
  };
940
- }, U = ({ children: e }) => /* @__PURE__ */ g(W, { children: e });
954
+ }, U = ({ children: e }) => /* @__PURE__ */ g(_, { children: e });
941
955
  U.displayName = "XRViewport.Scene";
942
- const N = ({ children: e }) => /* @__PURE__ */ g(W, { children: e });
956
+ const N = ({ children: e }) => /* @__PURE__ */ g(_, { children: e });
943
957
  N.displayName = "XRViewport.Overlay";
944
958
  const qe = (e, t) => {
945
959
  if (e === "dom")
@@ -948,24 +962,24 @@ const qe = (e, t) => {
948
962
  overlayContent: t
949
963
  };
950
964
  let n = null, r = null;
951
- const o = [];
952
- return he.forEach(t, (i) => {
965
+ const i = [];
966
+ return he.forEach(t, (o) => {
953
967
  var s;
954
- if (!me(i)) {
955
- i != null && o.push(i);
968
+ if (!me(o)) {
969
+ o != null && i.push(o);
956
970
  return;
957
971
  }
958
- const a = (s = i.type) == null ? void 0 : s.displayName;
972
+ const a = (s = o.type) == null ? void 0 : s.displayName;
959
973
  if (a === U.displayName) {
960
- n = i.props.children;
974
+ n = o.props.children;
961
975
  return;
962
976
  }
963
977
  if (a === N.displayName) {
964
- r = i.props.children;
978
+ r = o.props.children;
965
979
  return;
966
980
  }
967
- o.push(i);
968
- }), !r && o.length > 0 && (r = o), {
981
+ i.push(o);
982
+ }), !r && i.length > 0 && (r = i), {
969
983
  sceneContent: n,
970
984
  overlayContent: r
971
985
  };
@@ -978,13 +992,13 @@ const rt = Ue(({
978
992
  fitMode: t = "auto",
979
993
  imageOptions: n = [],
980
994
  initialImageId: r,
981
- initialMirrored: o = !0,
982
- initialSource: i = "webcam",
995
+ initialMirrored: i = !0,
996
+ initialSource: o = "webcam",
983
997
  initialVideoId: a,
984
998
  mediaStrategy: s = "internal",
985
999
  mediaDock: l = "bottom-left",
986
- mode: c = "dom",
987
- previewMode: d = "finalColor",
1000
+ mode: d = "dom",
1001
+ previewMode: c = "finalColor",
988
1002
  renderOutputs: h = {},
989
1003
  showMediaControlsByDefault: b = !0,
990
1004
  source: f,
@@ -995,19 +1009,19 @@ const rt = Ue(({
995
1009
  fitMode: t,
996
1010
  imageOptions: n,
997
1011
  initialImageId: r,
998
- initialMirrored: o,
999
- initialSource: i,
1012
+ initialMirrored: i,
1013
+ initialSource: o,
1000
1014
  initialVideoId: a,
1001
1015
  mediaStrategy: s,
1002
- previewMode: d,
1016
+ previewMode: c,
1003
1017
  renderOutputs: h,
1004
1018
  showMediaControlsByDefault: b,
1005
1019
  source: f,
1006
1020
  videoOptions: p
1007
- }), y = typeof e == "function" ? e(m.renderState) : e, { sceneContent: F, overlayContent: R } = qe(c, y), v = Z(
1008
- F,
1021
+ }), S = typeof e == "function" ? e(m.renderState) : e, { sceneContent: M, overlayContent: R } = qe(d, S), v = Z(
1022
+ M,
1009
1023
  m.renderState
1010
- ), I = Z(
1024
+ ), E = Z(
1011
1025
  R,
1012
1026
  m.renderState
1013
1027
  );
@@ -1022,8 +1036,8 @@ const rt = Ue(({
1022
1036
  managesOwnMedia: m.managesOwnMedia,
1023
1037
  mediaDock: l,
1024
1038
  mirrored: m.displayMirrored,
1025
- mode: c,
1026
- overlayContent: I,
1039
+ mode: d,
1040
+ overlayContent: E,
1027
1041
  renderOutputs: h,
1028
1042
  sceneContent: v,
1029
1043
  selectedImageId: m.selectedImageId,
@@ -1056,7 +1070,7 @@ const rt = Ue(({
1056
1070
  label: t = "face bounding box",
1057
1071
  color: n = "#22c55e",
1058
1072
  style: r,
1059
- labelStyle: o
1073
+ labelStyle: i
1060
1074
  }) => /* @__PURE__ */ g(
1061
1075
  "div",
1062
1076
  {
@@ -1072,29 +1086,29 @@ const rt = Ue(({
1072
1086
  zIndex: 20,
1073
1087
  ...r
1074
1088
  },
1075
- children: t !== null && /* @__PURE__ */ g("div", { style: { ...Ne, ...o }, children: t })
1089
+ children: t !== null && /* @__PURE__ */ g("div", { style: { ...Ne, ...i }, children: t })
1076
1090
  }
1077
1091
  ), ot = (e) => {
1078
- const [t, n] = S(null);
1079
- return M(() => {
1092
+ const [t, n] = C(null);
1093
+ return z(() => {
1080
1094
  let r = 0;
1081
- const o = () => {
1082
- var l, c;
1083
- r = requestAnimationFrame(o);
1084
- const i = (c = (l = e == null ? void 0 : e.detectionResults) == null ? void 0 : l.faceLandmarks) == null ? void 0 : c[0];
1085
- if (!i || i.length === 0) {
1095
+ const i = () => {
1096
+ var l, d;
1097
+ r = requestAnimationFrame(i);
1098
+ const o = (d = (l = e == null ? void 0 : e.detectionResults) == null ? void 0 : l.faceLandmarks) == null ? void 0 : d[0];
1099
+ if (!o || o.length === 0) {
1086
1100
  n(null);
1087
1101
  return;
1088
1102
  }
1089
- const a = fe(i), s = {
1103
+ const a = fe(o), s = {
1090
1104
  left: a.minX,
1091
1105
  top: a.minY,
1092
1106
  width: a.width,
1093
1107
  height: a.height
1094
1108
  };
1095
- n((d) => d && d.left === s.left && d.top === s.top && d.width === s.width && d.height === s.height ? d : s);
1109
+ n((c) => c && c.left === s.left && c.top === s.top && c.width === s.width && c.height === s.height ? c : s);
1096
1110
  };
1097
- return o(), () => {
1111
+ return i(), () => {
1098
1112
  cancelAnimationFrame(r);
1099
1113
  };
1100
1114
  }, [e]), t;
@@ -1131,12 +1145,12 @@ const rt = Ue(({
1131
1145
  export {
1132
1146
  zt as BasicAnimatedTextureController,
1133
1147
  nt as BoundingBoxOverlay,
1134
- dt as HeadTracker,
1148
+ ct as HeadTracker,
1135
1149
  Xt as MAX_GIF_BYTES,
1136
1150
  kt as MAX_GIF_FRAMES,
1137
1151
  At as MAX_GIF_PIXELS,
1138
1152
  at as PerspectiveCamera,
1139
- Ct as ScreenRectAspectContext,
1153
+ yt as ScreenRectAspectContext,
1140
1154
  st as TEXTURE_FITS,
1141
1155
  Lt as TextureSourceLoadError,
1142
1156
  it as XRCompositor,
@@ -1150,14 +1164,14 @@ export {
1150
1164
  Dt as createTextureSourceResolver,
1151
1165
  Bt as disposeResolvedTextureSource,
1152
1166
  vt as getFaceInfo,
1153
- Wt as getPlaybackFrame,
1154
- _t as getSequenceFrame,
1155
- St as getThreeBlending,
1167
+ _t as getPlaybackFrame,
1168
+ Wt as getSequenceFrame,
1169
+ Ct as getThreeBlending,
1156
1170
  Rt as getThreeDepthFunction,
1157
1171
  It as getThreeSide,
1158
1172
  Ht as gifTextureSourceProvider,
1159
- Ft as hasFullUnitUVBounds,
1160
- Me as resolveCalibrationFaceDisplayMirrored,
1173
+ Mt as hasFullUnitUVBounds,
1174
+ Te as resolveCalibrationFaceDisplayMirrored,
1161
1175
  Pt as resolveTextureSource,
1162
1176
  $t as throwIfAborted,
1163
1177
  Xe as useCalibrationFaceTracker,
@@ -1165,10 +1179,10 @@ export {
1165
1179
  Et as useScreenSpace,
1166
1180
  ut as useTrackerContext,
1167
1181
  mt as useXRCameraTexture,
1168
- se as useXRContext,
1182
+ O as useXRContext,
1169
1183
  ft as useXRError,
1170
1184
  le as useXRModel,
1171
- ce as useXRModelNode,
1185
+ de as useXRModelNode,
1172
1186
  pt as useXRPipelineSnapshot,
1173
1187
  gt as useXRReady,
1174
1188
  bt as useXRRenderSize,