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

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 (275) hide show
  1. package/GROUNDING.md +1109 -13
  2. package/dist/{DebuggerUI-BjOMr8q_.js → DebuggerUI-C-ldiozL.js} +1 -1
  3. package/dist/{DebuggerUI-B6bP6P9r.cjs → DebuggerUI-CWX5EtQv.cjs} +1 -1
  4. package/dist/FaceMeshRenderer-BEEXZwS6.cjs +158 -0
  5. package/dist/FaceMeshRenderer-UuH5sTXG.js +1322 -0
  6. package/dist/FaceRetouch-C7h7x9kd.js +683 -0
  7. package/dist/FaceRetouch-DqftT26Y.cjs +134 -0
  8. package/dist/GLTFLoader-C5q63sKO.js +1633 -0
  9. package/dist/GLTFLoader-Cb_CRwmG.cjs +1 -0
  10. package/dist/SegmentationOverlay-DQuW3dsc.js +133 -0
  11. package/dist/SegmentationOverlay-aWVod8Kl.cjs +1 -0
  12. package/dist/assets/cache.d.ts +99 -0
  13. package/dist/assets/estimate.d.ts +11 -0
  14. package/dist/assets/index.d.ts +7 -0
  15. package/dist/assets/loaders.d.ts +28 -0
  16. package/dist/assets/react.d.ts +33 -0
  17. package/dist/calibration/calibration.d.ts +70 -0
  18. package/dist/calibration/index.d.ts +6 -0
  19. package/dist/calibration/storage.d.ts +13 -0
  20. package/dist/calibration/types.d.ts +53 -0
  21. package/dist/calibration/useXRCalibration.d.ts +46 -0
  22. package/dist/camera/CameraPermissionGate.d.ts +26 -0
  23. package/dist/camera/devices.d.ts +26 -0
  24. package/dist/camera/index.d.ts +8 -0
  25. package/dist/camera/permission.d.ts +86 -0
  26. package/dist/camera/useCameraPermission.d.ts +35 -0
  27. package/dist/capabilities/detect.d.ts +45 -0
  28. package/dist/capabilities/index.d.ts +5 -0
  29. package/dist/capabilities/types.d.ts +120 -0
  30. package/dist/capabilities/useXRCapabilities.d.ts +18 -0
  31. package/dist/compat/environment.d.ts +5 -0
  32. package/dist/compat/index.d.ts +4 -0
  33. package/dist/compat/run.d.ts +18 -0
  34. package/dist/compat/scenarios.d.ts +10 -0
  35. package/dist/compat/types.d.ts +101 -0
  36. package/dist/components/BodyTracker/index.d.ts +9 -0
  37. package/dist/components/FaceMesh/canonical/CanonicalFaceMeshRenderer.d.ts +33 -3
  38. package/dist/components/FaceMesh/canonical/parseCanonicalFaceModel.d.ts +12 -0
  39. package/dist/components/FaceMesh/canonical/shaders.d.ts +1 -1
  40. package/dist/components/FaceMesh/index.d.ts +1 -1
  41. package/dist/components/GestureListener/index.d.ts +11 -0
  42. package/dist/components/HandTracker/index.d.ts +10 -0
  43. package/dist/components/HolisticTracker/index.d.ts +69 -0
  44. package/dist/components/HolisticTracker/settings.d.ts +58 -0
  45. package/dist/components/HolisticTracker/signals.d.ts +49 -0
  46. package/dist/components/IrisEffect/IrisMaterial.d.ts +73 -0
  47. package/dist/components/IrisEffect/index.d.ts +51 -0
  48. package/dist/components/IrisEffect/settings.d.ts +117 -0
  49. package/dist/components/LipEffect/LipEffect.d.ts +7 -1
  50. package/dist/components/LipEffect/LipEffectMaterial.d.ts +43 -7
  51. package/dist/components/LipEffect/LipEffects.d.ts +9 -0
  52. package/dist/components/LipEffect/defaults.d.ts +27 -4
  53. package/dist/components/LipEffect/index.d.ts +11 -3
  54. package/dist/components/LipEffect/settings.d.ts +271 -0
  55. package/dist/components/LipEffect/types.d.ts +56 -9
  56. package/dist/components/LipEffect/useLipDesignTextures.d.ts +11 -0
  57. package/dist/components/LipEffect/uvGuide.d.ts +59 -0
  58. package/dist/components/PersonCutout/index.d.ts +50 -0
  59. package/dist/components/PersonCutout/personCutout.d.ts +16 -0
  60. package/dist/components/ScreenImage/components/ScreenImageBody.d.ts +1 -1
  61. package/dist/components/ScreenImage/index.d.ts +3 -1
  62. package/dist/components/ScreenImage/materials/ScreenImageBlendMaterial.d.ts +1 -1
  63. package/dist/components/ScreenImage/materials/ScreenImageMaskMaterial.d.ts +11 -0
  64. package/dist/components/ScreenImage/source.d.ts +6 -0
  65. package/dist/components/ScreenImage/types.d.ts +18 -0
  66. package/dist/components/SegmentationOverlay/SegmentationOverlay.d.ts +37 -0
  67. package/dist/components/SegmentationOverlay/SegmentationOverlayMaterial.d.ts +31 -0
  68. package/dist/components/SegmentationOverlay/index.d.ts +9 -0
  69. package/dist/components/SegmentationOverlay/maskTexture.d.ts +23 -0
  70. package/dist/components/SegmentationOverlay/providers.d.ts +72 -0
  71. package/dist/components/SegmentationOverlay/settings.d.ts +65 -0
  72. package/dist/components/XRProvider/index.d.ts +16 -2
  73. package/dist/components/XRViewport/hooks/useViewportExternalFaces.d.ts +1 -1
  74. package/dist/components/XRViewport/hooks/useViewportMediaSource.d.ts +1 -1
  75. package/dist/components/XRViewport/hooks/useViewportPipeline.d.ts +1 -1
  76. package/dist/components/index.d.ts +3 -0
  77. package/dist/constants/index.d.ts +4 -1
  78. package/dist/contexts-CO0sd4JQ.cjs +1 -0
  79. package/dist/{contexts-ByhzppYl.js → contexts-FzlnnMYD.js} +252 -246
  80. package/dist/coordinates/feed.d.ts +52 -0
  81. package/dist/coordinates/index.d.ts +5 -0
  82. package/dist/coordinates/spaces.d.ts +49 -0
  83. package/dist/coordinates/viewport.d.ts +22 -0
  84. package/dist/coordinates/world.d.ts +15 -0
  85. package/dist/debug-ui/gesture-settings/index.d.ts +14 -0
  86. package/dist/debug-ui/holistic-tracker-settings/index.d.ts +16 -0
  87. package/dist/debug-ui/index.d.ts +14 -0
  88. package/dist/debug-ui/iris-effect-settings/index.d.ts +12 -0
  89. package/dist/debug-ui/lip-effect-settings/index.d.ts +15 -0
  90. package/dist/debug-ui/media-source.cjs +1 -1
  91. package/dist/debug-ui/media-source.js +1 -1
  92. package/dist/debug-ui/product-hotspots/index.d.ts +24 -0
  93. package/dist/debug-ui/segmentation-overlay-settings/index.d.ts +12 -0
  94. package/dist/debug-ui/xr-diagnostics/index.d.ts +25 -0
  95. package/dist/debug-ui.cjs +3 -3
  96. package/dist/debug-ui.js +2057 -1687
  97. package/dist/detector-K8aej4MB.js +59 -0
  98. package/dist/detector-ijypGtse.cjs +1 -0
  99. package/dist/entries/core.d.ts +18 -1
  100. package/dist/entries/face-effects.d.ts +11 -3
  101. package/dist/entries/low-level.d.ts +22 -3
  102. package/dist/entries/product.d.ts +11 -0
  103. package/dist/entries/tracking.d.ts +24 -1
  104. package/dist/face-effects.cjs +155 -1
  105. package/dist/face-effects.js +1134 -2197
  106. package/dist/gestures/definitions.d.ts +85 -0
  107. package/dist/gestures/detector.d.ts +87 -0
  108. package/dist/gestures/index.d.ts +8 -0
  109. package/dist/gestures/measures.d.ts +101 -0
  110. package/dist/gestures/settings.d.ts +49 -0
  111. package/dist/{getFaceInfo-C4QpCQIY.js → getFaceInfo-BkZfaQs-.js} +5 -5
  112. package/dist/{getFaceInfo-fA1bFBub.cjs → getFaceInfo-ahPxQFGu.cjs} +1 -1
  113. package/dist/hooks/selectors.d.ts +68 -1
  114. package/dist/hooks/useCalibrationFaceTracker.d.ts +1 -1
  115. package/dist/hooks/useFaceInfo.d.ts +13 -1
  116. package/dist/hooks/useFaceInfos.d.ts +1 -1
  117. package/dist/hooks/useGesture.d.ts +32 -0
  118. package/dist/hooks/useIrisTracking.d.ts +45 -0
  119. package/dist/hooks/useXRDiagnostics.d.ts +81 -0
  120. package/dist/hooks/useXRModel.d.ts +7 -0
  121. package/dist/hooks/useXRSession/facade.d.ts +42 -2
  122. package/dist/hooks/useXRSession/index.d.ts +2 -2
  123. package/dist/hooks/useXRSession/reason.d.ts +3 -1
  124. package/dist/hooks/useXRSession/registry.d.ts +14 -0
  125. package/dist/hooks/useXRSession/store.d.ts +52 -3
  126. package/dist/index--RgGzZ6X.cjs +47 -0
  127. package/dist/{index-VJ0SJwmG.js → index-CHVbH0hz.js} +4 -4
  128. package/dist/index-CeVkgsag.cjs +1 -0
  129. package/dist/index-CnGox6Xr.js +3054 -0
  130. package/dist/{index-ByoNj0QP.js → index-CsUdQ-pn.js} +113 -111
  131. package/dist/{index-BjmTe9eM.cjs → index-DKBAh6hV.cjs} +1 -1
  132. package/dist/index-DsZwTfG0.cjs +1 -0
  133. package/dist/index-Dw6tj2Mi.js +144 -0
  134. package/dist/index-OCPjOaeP.cjs +1 -0
  135. package/dist/{index-DXT3WccE.js → index-s9pF4zkG.js} +1065 -1101
  136. package/dist/internal-BYza1h8_.cjs +1 -0
  137. package/dist/{internal-Dmk1cTXq.js → internal-vsfNQycj.js} +15 -16
  138. package/dist/internal.cjs +1 -1
  139. package/dist/internal.js +2 -2
  140. package/dist/iris/compute.d.ts +25 -0
  141. package/dist/iris/index.d.ts +4 -0
  142. package/dist/iris/lead.d.ts +19 -0
  143. package/dist/iris/types.d.ts +87 -0
  144. package/dist/landmarkMask-CbTFzBYG.js +224 -0
  145. package/dist/landmarkMask-u7es2k4X.cjs +1 -0
  146. package/dist/low-level.cjs +1 -1
  147. package/dist/low-level.js +1085 -634
  148. package/dist/main.cjs +1 -1
  149. package/dist/main.js +1519 -465
  150. package/dist/measures-9dQPdw96.js +154 -0
  151. package/dist/measures-KfJzpvod.cjs +1 -0
  152. package/dist/models/Base/index.d.ts +49 -0
  153. package/dist/models/Body/index.d.ts +1 -1
  154. package/dist/models/Face/index.d.ts +1 -1
  155. package/dist/models/Hand/GestureTracking.d.ts +1 -1
  156. package/dist/models/Hand/HandTracking.d.ts +1 -1
  157. package/dist/models/Holistic/index.d.ts +49 -0
  158. package/dist/models/Holistic/result.d.ts +68 -0
  159. package/dist/models/SemanticSegmentation/index.d.ts +31 -0
  160. package/dist/models/SemanticSegmentation/presets.d.ts +28 -0
  161. package/dist/models/index.d.ts +2 -0
  162. package/dist/product/ProductDimensions.d.ts +16 -0
  163. package/dist/product/ProductHotspot.d.ts +16 -0
  164. package/dist/product/ProductViewer.d.ts +9 -0
  165. package/dist/product/details.d.ts +53 -0
  166. package/dist/product/index.d.ts +14 -0
  167. package/dist/product/loadModelViewer.d.ts +4 -0
  168. package/dist/product/types.d.ts +71 -0
  169. package/dist/product/useProductAr.d.ts +37 -0
  170. package/dist/product/useProductDetails.d.ts +60 -0
  171. package/dist/product.cjs +1 -0
  172. package/dist/product.js +414 -0
  173. package/dist/providers-C0Dlhh9Z.js +365 -0
  174. package/dist/providers-YNwkmNeK.cjs +62 -0
  175. package/dist/quality/XRQualityController.d.ts +25 -0
  176. package/dist/quality/controller.d.ts +33 -0
  177. package/dist/quality/index.d.ts +6 -0
  178. package/dist/quality/types.d.ts +100 -0
  179. package/dist/quality/useXRQuality.d.ts +28 -0
  180. package/dist/{renderGroups-KZk6eRiY.js → renderGroups-CN1cGFUo.js} +1 -1
  181. package/dist/{renderGroups-80H3DpTl.cjs → renderGroups-O4KmaMl9.cjs} +1 -1
  182. package/dist/renderPasses-Cg-zqmEz.cjs +21 -0
  183. package/dist/renderPasses-NnKZVfBy.js +1460 -0
  184. package/dist/scene-object.cjs +1 -1
  185. package/dist/scene-object.js +2 -2
  186. package/dist/screenTransform-BenfCtZt.js +44 -0
  187. package/dist/screenTransform-BiXdpVf0.cjs +1 -0
  188. package/dist/segmentation-9PhSvc-R.cjs +1 -0
  189. package/dist/segmentation-CeOTKemr.js +5 -0
  190. package/dist/segmentation2d/faceMemory.d.ts +28 -0
  191. package/dist/segmentation2d/faceRegions.d.ts +24 -0
  192. package/dist/segmentation2d/index.d.ts +9 -0
  193. package/dist/segmentation2d/maskUv.d.ts +23 -0
  194. package/dist/segmentation2d/rasterize.d.ts +14 -0
  195. package/dist/segmentation2d/types.d.ts +46 -0
  196. package/dist/selectors-C5G1PMYL.js +195 -0
  197. package/dist/selectors-Du_PsVnW.cjs +1 -0
  198. package/dist/{session-CpkiK5YA.cjs → session-BBr0yN8h.cjs} +7 -7
  199. package/dist/{session-DLFN_VII.js → session-Cy0m7l7-.js} +76 -76
  200. package/dist/settings-DRR7-snV.cjs +1 -0
  201. package/dist/settings-aQk845NJ.js +73 -0
  202. package/dist/subjects/index.d.ts +2 -0
  203. package/dist/subjects/select.d.ts +62 -0
  204. package/dist/subjects/types.d.ts +55 -0
  205. package/dist/tracking-config/apply.d.ts +57 -0
  206. package/dist/tracking-config/index.d.ts +7 -0
  207. package/dist/tracking-config/resolve.d.ts +25 -0
  208. package/dist/tracking-config/storage.d.ts +8 -0
  209. package/dist/tracking-config/types.d.ts +106 -0
  210. package/dist/tracking-config/useXRTrackingConfig.d.ts +38 -0
  211. package/dist/tracking.cjs +1 -1
  212. package/dist/tracking.js +1056 -383
  213. package/dist/types/compositor.d.ts +21 -0
  214. package/dist/types/holistic.d.ts +121 -0
  215. package/dist/types/index.d.ts +1 -0
  216. package/dist/types/model.d.ts +22 -2
  217. package/dist/types/nodes.d.ts +27 -2
  218. package/dist/types/segmentation.d.ts +19 -0
  219. package/dist/types/session.d.ts +41 -3
  220. package/dist/useFaceInfo-Blf7FCu3.js +303 -0
  221. package/dist/useFaceInfo-C5mO8NQY.cjs +1 -0
  222. package/dist/useXRCapabilities-B1R2ghy-.cjs +1 -0
  223. package/dist/useXRCapabilities-C68v__wB.js +30 -0
  224. package/dist/utils/fns.d.ts +6 -3
  225. package/dist/utils/integrity.d.ts +4 -1
  226. package/dist/utils/updateThrottle.d.ts +2 -0
  227. package/dist/utils/useStableUniforms.d.ts +18 -0
  228. package/docs/api/adaptive-quality.mdx +104 -0
  229. package/docs/api/asset-lifecycle.mdx +78 -0
  230. package/docs/api/camera-permission.mdx +142 -0
  231. package/docs/api/coordinate-spaces.mdx +165 -0
  232. package/docs/api/cross-camera.mdx +88 -0
  233. package/docs/api/diagnostics-calibration.mdx +97 -0
  234. package/docs/api/face-effects.mdx +6 -0
  235. package/docs/api/face-mesh.mdx +4 -2
  236. package/docs/api/gestures.mdx +173 -0
  237. package/docs/api/holistic-tracker.mdx +159 -0
  238. package/docs/api/iris-tracking.mdx +242 -0
  239. package/docs/api/multi-subject.mdx +95 -0
  240. package/docs/api/person-cutout.mdx +136 -0
  241. package/docs/api/product-ar.mdx +111 -0
  242. package/docs/api/product-details.mdx +78 -0
  243. package/docs/api/screen-space-coordinates.mdx +4 -1
  244. package/docs/api/segmentation-overlay.mdx +301 -0
  245. package/docs/api/session-lifecycle.mdx +136 -0
  246. package/docs/api/trackers.mdx +5 -0
  247. package/docs/api/tracking-config.mdx +108 -0
  248. package/docs/docs.json +23 -1
  249. package/docs/examples/lip-shaders.mdx +224 -0
  250. package/docs/guides/lip-effect-textures.mdx +292 -0
  251. package/docs/guides/lip-uv-template.png +0 -0
  252. package/docs/guides/lip-uv-template.svg +1 -0
  253. package/package.json +13 -1
  254. package/dist/FaceMeshRenderer-C5l6VLdO.cjs +0 -155
  255. package/dist/FaceMeshRenderer-wjAHrJzP.js +0 -1270
  256. package/dist/FaceRetouch-BkJzoA79.cjs +0 -134
  257. package/dist/FaceRetouch-DwbKQJAN.js +0 -551
  258. package/dist/contexts-Dr62It_K.cjs +0 -1
  259. package/dist/index-9dlAQAhy.js +0 -1462
  260. package/dist/index-BpEf2BBb.cjs +0 -1
  261. package/dist/index-CyUUurQT.cjs +0 -1
  262. package/dist/index-DCiMbxC3.cjs +0 -1
  263. package/dist/index-DpI-qo5X.cjs +0 -17
  264. package/dist/index-DyVF4vEW.js +0 -111
  265. package/dist/internal-Cq-TEQ5Y.cjs +0 -1
  266. package/dist/renderLayers-lDtL0_43.cjs +0 -1
  267. package/dist/renderLayers-zrK2pv5O.js +0 -13
  268. package/dist/renderPasses-BOoBSr8z.cjs +0 -21
  269. package/dist/renderPasses-BcquyVtu.js +0 -1500
  270. package/dist/selectors-B8H97CKA.js +0 -59
  271. package/dist/selectors-CZLKT2Iv.cjs +0 -1
  272. package/dist/useFaceInfo-BJ8-_MOs.cjs +0 -1
  273. package/dist/useFaceInfo-Dk426LTu.js +0 -62
  274. package/dist/useFaceResults-CtetsO9M.js +0 -19
  275. package/dist/useFaceResults-wBJF3zyp.cjs +0 -1
package/dist/low-level.js CHANGED
@@ -1,24 +1,28 @@
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
- import { PerspectiveCamera as pe } from "@react-three/drei";
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
- import * as L from "three";
1
+ import { u as ie, X as D, a as he, z as $, m as ge, d as ye, A as we, s as be, g as ee } from "./index-CnGox6Xr.js";
2
+ import { I as At, G as Lt, C as _t, J as Xt, f as Ot, V as zt, K as Dt, L as Pt, B as Vt, H as $t, M as Bt, N as Nt, O as Wt, P as Ht, Q as qt, W as Gt, R as Ut, T as jt, U as Kt, E as Qt } from "./index-CnGox6Xr.js";
3
+ import { u as Se } from "./index-CsUdQ-pn.js";
4
+ import { H as Jt, a as Zt } from "./index-CsUdQ-pn.js";
5
+ import { a as ve } from "./selectors-C5G1PMYL.js";
6
+ import { k as tr, j as rr, u as ar, c as nr, o as sr, f as ir, l as or, g as lr, m as cr, p as dr, e as ur, d as mr, b as fr, n as pr, i as hr, h as gr } from "./selectors-C5G1PMYL.js";
7
+ import { useEffect as A, useState as M, useRef as _, useCallback as xe, useLayoutEffect as Re, useMemo as G, Children as Ce, isValidElement as Ee } from "react";
8
+ import { e as Me } from "./getFaceInfo-BkZfaQs-.js";
9
+ import { c as wr, b as br } from "./getFaceInfo-BkZfaQs-.js";
10
+ import { jsx as b, jsxs as X, Fragment as N } from "react/jsx-runtime";
11
+ import { PerspectiveCamera as ke } from "@react-three/drei";
12
+ import { S as vr, g as xr, b as Rr, c as Cr, u as Er } from "./index-CHVbH0hz.js";
13
+ import { u as oe } from "./measures-9dQPdw96.js";
14
+ import { H as kr, O as Tr, P as Ir, h as Fr, a as Ar, c as Lr, f as _r, d as Xr, e as Or, g as zr, m as Dr, b as Pr, t as Vr, i as $r } from "./measures-9dQPdw96.js";
15
+ import { h as Nr } from "./hasFullUnitUVBounds-BGvcFsQM.js";
16
+ import { X as Te, a as Ie, b as Fe } from "./contexts-FzlnnMYD.js";
17
+ import { B as Hr, M as qr, h as Gr, i as Ur, T as jr, c as Kr, j as Qr, k as Yr, g as Jr, e as Zr, f as ea, r as ta, t as ra, d as aa, u as na } from "./contexts-FzlnnMYD.js";
18
+ import { c as ia, g as oa, s as la, a as ca } from "./detector-K8aej4MB.js";
19
+ import { v as ua, j as ma, I as fa, M as pa, S as ha, m as ga, k as ya, w as wa, l as ba, c as Sa, n as va, q as xa, x as Ra, r as Ca, t as Ea, o as Ma, u as ka, p as Ta, s as Ia, b as Fa, a as Aa } from "./providers-C0Dlhh9Z.js";
20
+ import * as z from "three";
17
21
  const B = ({
18
22
  children: e,
19
23
  config: t,
20
- style: n
21
- }) => /* @__PURE__ */ g(
24
+ style: a
25
+ }) => /* @__PURE__ */ b(
22
26
  "div",
23
27
  {
24
28
  "data-render-target": t.name,
@@ -30,88 +34,88 @@ const B = ({
30
34
  pointerEvents: t.pointerEvents ?? "none",
31
35
  zIndex: t.zIndex,
32
36
  opacity: t.hidden ? 0 : 1,
33
- ...n
37
+ ...a
34
38
  },
35
39
  children: e
36
40
  }
37
- ), q = ({
41
+ ), U = ({
38
42
  canvas: e,
39
43
  layout: t,
40
- media: n,
44
+ media: a,
41
45
  mirrored: r,
42
- filter: i
46
+ filter: n
43
47
  }) => {
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
- const s = e.getContext("2d");
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 = ({
48
+ const c = Math.round(t.destination.width), u = Math.round(t.destination.height);
49
+ e.width !== c && (e.width = c), e.height !== u && (e.height = u);
50
+ const d = e.getContext("2d");
51
+ d && (d.setTransform(1, 0, 0, 1, 0, 0), d.clearRect(0, 0, c, u), r && (d.translate(c, 0), d.scale(-1, 1)), n && (d.filter = n), d.drawImage(a, t.offsetX, t.offsetY, t.drawWidth, t.drawHeight), n && (d.filter = "none"), d.setTransform(1, 0, 0, 1, 0, 0));
52
+ }, le = ({
49
53
  canvasRef: e,
50
54
  enabled: t = !0,
51
- fps: n = 30,
55
+ fps: a = 30,
52
56
  imageRef: r,
53
- layout: i,
54
- mirrored: o,
55
- sourceKind: a,
56
- videoRef: s
57
+ layout: n,
58
+ mirrored: c,
59
+ sourceKind: u,
60
+ videoRef: d
57
61
  }) => {
58
- z(() => {
62
+ A(() => {
59
63
  if (!t) {
60
- const b = e.current, f = b == null ? void 0 : b.getContext("2d");
61
- b && f && f.clearRect(0, 0, b.width, b.height);
64
+ const p = e.current, g = p == null ? void 0 : p.getContext("2d");
65
+ p && g && g.clearRect(0, 0, p.width, p.height);
62
66
  return;
63
67
  }
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
- const f = e.current;
69
- if (!f || !i) return;
70
- if (a === "image") {
71
- const p = r.current;
72
- if (!p || !p.complete || p.naturalWidth <= 0 || p.naturalHeight <= 0)
68
+ let i = 0, f = 0;
69
+ const h = a > 0 ? 1e3 / a : 0, s = (p) => {
70
+ if (i = requestAnimationFrame(s), h > 0 && p - f < h) return;
71
+ f = p;
72
+ const g = e.current;
73
+ if (!g || !n) return;
74
+ if (u === "image") {
75
+ const l = r.current;
76
+ if (!l || !l.complete || l.naturalWidth <= 0 || l.naturalHeight <= 0)
73
77
  return;
74
- q({
75
- canvas: f,
76
- layout: i,
77
- media: p,
78
- mirrored: o
78
+ U({
79
+ canvas: g,
80
+ layout: n,
81
+ media: l,
82
+ mirrored: c
79
83
  });
80
84
  return;
81
85
  }
82
- const w = s.current;
83
- !w || w.readyState < 2 || w.videoWidth <= 0 || w.videoHeight <= 0 || q({
84
- canvas: f,
85
- layout: i,
86
- media: w,
87
- mirrored: o
86
+ const o = d.current;
87
+ !o || o.readyState < 2 || o.videoWidth <= 0 || o.videoHeight <= 0 || U({
88
+ canvas: g,
89
+ layout: n,
90
+ media: o,
91
+ mirrored: c
88
92
  });
89
93
  };
90
- return l = requestAnimationFrame(h), () => {
91
- cancelAnimationFrame(l);
94
+ return i = requestAnimationFrame(s), () => {
95
+ cancelAnimationFrame(i);
92
96
  };
93
- }, [e, t, n, r, i, o, a, s]);
94
- }, xe = ({
97
+ }, [e, t, a, r, n, c, u, d]);
98
+ }, Ae = ({
95
99
  canvasRef: e,
96
100
  imageRef: t,
97
- layer: n,
101
+ layer: a,
98
102
  layout: r,
99
- mirrored: i,
100
- onCaptureTarget: o,
101
- sourceKind: a,
102
- videoRef: s
103
- }) => (re({
103
+ mirrored: n,
104
+ onCaptureTarget: c,
105
+ sourceKind: u,
106
+ videoRef: d
107
+ }) => (le({
104
108
  canvasRef: e,
105
109
  imageRef: t,
106
110
  layout: r,
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(
111
+ mirrored: n,
112
+ sourceKind: u,
113
+ videoRef: d
114
+ }), A(() => {
115
+ const i = e.current;
116
+ if (i)
117
+ return c == null || c(i), () => c == null ? void 0 : c(void 0);
118
+ }, [e, c]), /* @__PURE__ */ b(B, { config: a, children: /* @__PURE__ */ b(
115
119
  "canvas",
116
120
  {
117
121
  ref: e,
@@ -124,84 +128,84 @@ const B = ({
124
128
  background: "#000"
125
129
  }
126
130
  }
127
- ) })), tt = ({
131
+ ) })), St = ({
128
132
  canvasRef: e,
129
133
  controlInsetTop: t,
130
- debugVisible: n,
134
+ debugVisible: a,
131
135
  fps: r = 15,
132
- imageRef: i,
133
- layer: o,
134
- layout: a,
135
- mirrored: s,
136
- sourceKind: l,
137
- videoRef: d,
138
- viewportSize: c
136
+ imageRef: n,
137
+ layer: c,
138
+ layout: u,
139
+ mirrored: d,
140
+ sourceKind: i,
141
+ videoRef: f,
142
+ viewportSize: h
139
143
  }) => {
140
- re({
144
+ le({
141
145
  canvasRef: e,
142
- enabled: n,
146
+ enabled: a,
143
147
  fps: r,
144
- imageRef: i,
145
- layout: a,
146
- mirrored: s,
147
- sourceKind: l,
148
- videoRef: d
148
+ imageRef: n,
149
+ layout: u,
150
+ mirrored: d,
151
+ sourceKind: i,
152
+ videoRef: f
149
153
  });
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(
154
+ const s = Math.min(220, Math.max(120, h.width * 0.22)), p = h.width > 0 && h.height > 0 ? h.width / h.height : 1, g = Math.min(h.height - 24, Math.max(t ?? 16, 16));
155
+ return /* @__PURE__ */ b(B, { config: c, children: /* @__PURE__ */ b(
152
156
  "canvas",
153
157
  {
154
158
  ref: e,
155
159
  style: {
156
160
  position: "absolute",
157
161
  left: 16,
158
- top: f,
159
- width: n ? h : 1,
160
- height: n ? "auto" : 1,
161
- aspectRatio: `${b}`,
162
- opacity: n ? 0.85 : 0,
162
+ top: g,
163
+ width: a ? s : 1,
164
+ height: a ? "auto" : 1,
165
+ aspectRatio: `${p}`,
166
+ opacity: a ? 0.85 : 0,
163
167
  borderRadius: 10,
164
- border: n ? "1px solid rgba(255,255,255,0.16)" : "none",
168
+ border: a ? "1px solid rgba(255,255,255,0.16)" : "none",
165
169
  pointerEvents: "none",
166
170
  objectFit: "contain",
167
171
  background: "#000"
168
172
  }
169
173
  }
170
174
  ) });
171
- }, ve = {
175
+ }, Le = {
172
176
  audio: !1,
173
177
  video: {
174
178
  facingMode: "user",
175
179
  frameRate: { ideal: 30, max: 60 }
176
180
  }
177
- }, Se = {
181
+ }, _e = {
178
182
  name: "viewport-live",
179
183
  clearColor: "#000000",
180
184
  pointerEvents: "none",
181
185
  zIndex: 0
182
- }, ye = {
186
+ }, Xe = {
183
187
  name: "viewport-ui",
184
188
  clearColor: "transparent",
185
189
  pointerEvents: "auto",
186
190
  zIndex: 5
187
- }, Ce = {
191
+ }, Oe = {
188
192
  name: "viewport-scene",
189
193
  clearColor: "transparent",
190
194
  pointerEvents: "auto",
191
195
  zIndex: 1
192
- }, A = {
196
+ }, O = {
193
197
  webcam: { icon: "◉", label: "Webcam" },
194
198
  image: { icon: "▣", label: "Images" },
195
199
  video: { icon: "▶", label: "Videos" }
196
- }, Re = ({
200
+ }, ze = ({
197
201
  imageRef: e,
198
202
  selectedSource: t,
199
- videoRef: n
200
- }) => /* @__PURE__ */ k(_, { children: [
201
- /* @__PURE__ */ g(
203
+ videoRef: a
204
+ }) => /* @__PURE__ */ X(N, { children: [
205
+ /* @__PURE__ */ b(
202
206
  "video",
203
207
  {
204
- ref: n,
208
+ ref: a,
205
209
  style: {
206
210
  position: "absolute",
207
211
  width: 1,
@@ -211,7 +215,7 @@ const B = ({
211
215
  }
212
216
  }
213
217
  ),
214
- /* @__PURE__ */ g(
218
+ /* @__PURE__ */ b(
215
219
  "img",
216
220
  {
217
221
  ref: e,
@@ -225,13 +229,13 @@ const B = ({
225
229
  }
226
230
  }
227
231
  )
228
- ] }), Y = ({
232
+ ] }), te = ({
229
233
  dock: e,
230
234
  label: t,
231
- onChange: n,
235
+ onChange: a,
232
236
  options: r,
233
- value: i
234
- }) => /* @__PURE__ */ g(
237
+ value: n
238
+ }) => /* @__PURE__ */ b(
235
239
  "div",
236
240
  {
237
241
  style: {
@@ -248,7 +252,7 @@ const B = ({
248
252
  boxShadow: "0 12px 30px rgba(0,0,0,0.18)",
249
253
  backdropFilter: "blur(10px)"
250
254
  },
251
- children: /* @__PURE__ */ k(
255
+ children: /* @__PURE__ */ X(
252
256
  "label",
253
257
  {
254
258
  style: {
@@ -259,12 +263,12 @@ const B = ({
259
263
  fontWeight: 700
260
264
  },
261
265
  children: [
262
- /* @__PURE__ */ g("span", { children: t }),
263
- /* @__PURE__ */ g(
266
+ /* @__PURE__ */ b("span", { children: t }),
267
+ /* @__PURE__ */ b(
264
268
  "select",
265
269
  {
266
- value: i,
267
- onChange: (o) => n(o.target.value),
270
+ value: n,
271
+ onChange: (c) => a(c.target.value),
268
272
  style: {
269
273
  minWidth: 180,
270
274
  maxWidth: "calc(100vw - 52px)",
@@ -275,31 +279,31 @@ const B = ({
275
279
  color: "#e5eefb",
276
280
  padding: "0 10px"
277
281
  },
278
- children: r.map((o) => /* @__PURE__ */ g("option", { value: o.id, style: { color: "#111827" }, children: o.label }, o.id))
282
+ children: r.map((c) => /* @__PURE__ */ b("option", { value: c.id, style: { color: "#111827" }, children: c.label }, c.id))
279
283
  }
280
284
  )
281
285
  ]
282
286
  }
283
287
  )
284
288
  }
285
- ), Ie = ({
289
+ ), De = ({
286
290
  dock: e,
287
291
  imageOptions: t,
288
- selectedImageId: n,
292
+ selectedImageId: a,
289
293
  selectedSource: r,
290
- selectedVideoId: i,
291
- setSelectedImageId: o,
292
- setSelectedSource: a,
293
- setSelectedVideoId: s,
294
- showMediaControls: l,
295
- videoOptions: d
294
+ selectedVideoId: n,
295
+ setSelectedImageId: c,
296
+ setSelectedSource: u,
297
+ setSelectedVideoId: d,
298
+ showMediaControls: i,
299
+ videoOptions: f
296
300
  }) => {
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(
301
+ const [h, s] = M(!1), p = ["webcam", "image", "video"].filter((g) => g === "image" ? t.length > 0 : g === "video" ? f.length > 0 : !0);
302
+ return i ? h ? /* @__PURE__ */ b(
299
303
  "button",
300
304
  {
301
305
  type: "button",
302
- onClick: () => h(!1),
306
+ onClick: () => s(!1),
303
307
  "aria-label": "Open media controls",
304
308
  title: "Open media controls",
305
309
  style: {
@@ -320,8 +324,8 @@ const B = ({
320
324
  },
321
325
  children: "≡"
322
326
  }
323
- ) : /* @__PURE__ */ k(_, { children: [
324
- /* @__PURE__ */ k(
327
+ ) : /* @__PURE__ */ X(N, { children: [
328
+ /* @__PURE__ */ X(
325
329
  "div",
326
330
  {
327
331
  style: {
@@ -336,7 +340,7 @@ const B = ({
336
340
  maxWidth: "calc(100vw - 32px)"
337
341
  },
338
342
  children: [
339
- /* @__PURE__ */ g(
343
+ /* @__PURE__ */ b(
340
344
  "div",
341
345
  {
342
346
  style: {
@@ -351,15 +355,15 @@ const B = ({
351
355
  backdropFilter: "blur(10px)",
352
356
  overflowX: "auto"
353
357
  },
354
- children: b.map((f) => {
355
- const w = f === r;
356
- return /* @__PURE__ */ k(
358
+ children: p.map((g) => {
359
+ const o = g === r;
360
+ return /* @__PURE__ */ X(
357
361
  "button",
358
362
  {
359
363
  type: "button",
360
- onClick: () => a(f),
361
- "aria-pressed": w,
362
- title: A[f].label,
364
+ onClick: () => u(g),
365
+ "aria-pressed": o,
366
+ title: O[g].label,
363
367
  style: {
364
368
  border: "none",
365
369
  borderRadius: 999,
@@ -370,26 +374,26 @@ const B = ({
370
374
  alignItems: "center",
371
375
  justifyContent: "center",
372
376
  gap: 8,
373
- background: w ? "rgba(56, 189, 248, 0.18)" : "rgba(255,255,255,0.04)",
374
- color: w ? "#e0f2fe" : "rgba(229,238,251,0.82)",
377
+ background: o ? "rgba(56, 189, 248, 0.18)" : "rgba(255,255,255,0.04)",
378
+ color: o ? "#e0f2fe" : "rgba(229,238,251,0.82)",
375
379
  cursor: "pointer",
376
380
  flex: "0 0 auto"
377
381
  },
378
382
  children: [
379
- /* @__PURE__ */ g("span", { style: { fontSize: 14, lineHeight: 1 }, children: A[f].icon }),
380
- /* @__PURE__ */ g("span", { style: { fontSize: 12, fontWeight: 700, letterSpacing: "0.01em" }, children: A[f].label })
383
+ /* @__PURE__ */ b("span", { style: { fontSize: 14, lineHeight: 1 }, children: O[g].icon }),
384
+ /* @__PURE__ */ b("span", { style: { fontSize: 12, fontWeight: 700, letterSpacing: "0.01em" }, children: O[g].label })
381
385
  ]
382
386
  },
383
- f
387
+ g
384
388
  );
385
389
  })
386
390
  }
387
391
  ),
388
- /* @__PURE__ */ g(
392
+ /* @__PURE__ */ b(
389
393
  "button",
390
394
  {
391
395
  type: "button",
392
- onClick: () => h(!0),
396
+ onClick: () => s(!0),
393
397
  "aria-label": "Close media controls",
394
398
  title: "Close media controls",
395
399
  style: {
@@ -410,55 +414,55 @@ const B = ({
410
414
  ]
411
415
  }
412
416
  ),
413
- r === "image" && t.length > 0 && /* @__PURE__ */ g(
414
- Y,
417
+ r === "image" && t.length > 0 && /* @__PURE__ */ b(
418
+ te,
415
419
  {
416
420
  dock: e,
417
421
  label: "Image Asset",
418
422
  options: t,
419
- value: n,
420
- onChange: o
423
+ value: a,
424
+ onChange: c
421
425
  }
422
426
  ),
423
- r === "video" && d.length > 0 && /* @__PURE__ */ g(
424
- Y,
427
+ r === "video" && f.length > 0 && /* @__PURE__ */ b(
428
+ te,
425
429
  {
426
430
  dock: e,
427
431
  label: "Video Asset",
428
- options: d,
429
- value: i,
430
- onChange: s
432
+ options: f,
433
+ value: n,
434
+ onChange: d
431
435
  }
432
436
  )
433
437
  ] }) : null;
434
- }, Ee = ({
438
+ }, Pe = ({
435
439
  containerRef: e,
436
440
  displayCanvasRef: t,
437
- imageOptions: n,
441
+ imageOptions: a,
438
442
  imageRef: r,
439
- layout: i,
440
- managesOwnMedia: o,
441
- mediaDock: a,
442
- mode: s,
443
- overlayContent: l,
444
- renderOutputs: d,
445
- sceneContent: c,
446
- selectedImageId: h,
447
- selectedSource: b,
448
- selectedVideoId: f,
449
- setSceneRenderOutputs: w,
450
- setSelectedImageId: p,
443
+ layout: n,
444
+ managesOwnMedia: c,
445
+ mediaDock: u,
446
+ mode: d,
447
+ overlayContent: i,
448
+ renderOutputs: f,
449
+ sceneContent: h,
450
+ selectedImageId: s,
451
+ selectedSource: p,
452
+ selectedVideoId: g,
453
+ setSceneRenderOutputs: o,
454
+ setSelectedImageId: l,
451
455
  setSelectedSource: m,
452
- setSelectedVideoId: S,
453
- showMediaControls: M,
456
+ setSelectedVideoId: w,
457
+ showMediaControls: S,
454
458
  style: R,
455
- videoOptions: v,
459
+ videoOptions: x,
456
460
  videoRef: E,
457
- viewportSize: x,
458
- mirrored: u
461
+ viewportSize: v,
462
+ mirrored: y
459
463
  }) => {
460
- const { session: I } = O();
461
- return /* @__PURE__ */ k(
464
+ const { session: k } = ie();
465
+ return /* @__PURE__ */ X(
462
466
  "div",
463
467
  {
464
468
  ref: e,
@@ -470,576 +474,568 @@ const B = ({
470
474
  ...R
471
475
  },
472
476
  children: [
473
- /* @__PURE__ */ g(Re, { imageRef: r, selectedSource: b, videoRef: E }),
474
- s === "dom" && o && /* @__PURE__ */ g(
475
- xe,
477
+ /* @__PURE__ */ b(ze, { imageRef: r, selectedSource: p, videoRef: E }),
478
+ d === "dom" && c && /* @__PURE__ */ b(
479
+ Ae,
476
480
  {
477
481
  canvasRef: t,
478
482
  imageRef: r,
479
483
  videoRef: E,
480
- layer: Se,
481
- layout: i,
482
- mirrored: u,
483
- onCaptureTarget: I._setCaptureTarget,
484
- sourceKind: b === "image" ? "image" : "video"
484
+ layer: _e,
485
+ layout: n,
486
+ mirrored: y,
487
+ onCaptureTarget: k._setCaptureTarget,
488
+ sourceKind: p === "image" ? "image" : "video"
485
489
  }
486
490
  ),
487
- (s === "r3f" || s === "hybrid") && /* @__PURE__ */ g(B, { config: Ce, children: /* @__PURE__ */ g(
488
- ge,
491
+ (d === "r3f" || d === "hybrid") && /* @__PURE__ */ b(B, { config: Oe, children: /* @__PURE__ */ b(
492
+ Te,
489
493
  {
490
- onRenderOutputs: w,
494
+ onRenderOutputs: o,
491
495
  renderOutputs: {
492
- sceneColor: d.sceneColor || d.finalColor,
493
- sceneDepth: d.sceneDepth
496
+ sceneColor: f.sceneColor || f.finalColor,
497
+ sceneDepth: f.sceneDepth
494
498
  },
495
- renderTargetSize: x,
499
+ renderTargetSize: v,
496
500
  style: { width: "100%", height: "100%" },
497
- children: c
501
+ children: h
498
502
  }
499
503
  ) }),
500
- /* @__PURE__ */ k(B, { config: ye, children: [
501
- o && /* @__PURE__ */ g(
502
- Ie,
504
+ /* @__PURE__ */ X(B, { config: Xe, children: [
505
+ c && /* @__PURE__ */ b(
506
+ De,
503
507
  {
504
- dock: a,
505
- imageOptions: n,
506
- selectedImageId: h,
507
- selectedSource: b,
508
- selectedVideoId: f,
509
- setSelectedImageId: p,
508
+ dock: u,
509
+ imageOptions: a,
510
+ selectedImageId: s,
511
+ selectedSource: p,
512
+ selectedVideoId: g,
513
+ setSelectedImageId: l,
510
514
  setSelectedSource: m,
511
- setSelectedVideoId: S,
512
- showMediaControls: M,
513
- videoOptions: v
515
+ setSelectedVideoId: w,
516
+ showMediaControls: S,
517
+ videoOptions: x
514
518
  }
515
519
  ),
516
- l
520
+ i
517
521
  ] })
518
522
  ]
519
523
  }
520
524
  );
521
- }, Fe = 5, Me = 1, Te = (e, t) => t, ze = "brightness(2.2) contrast(1.5) saturate(1.25)", Xe = ({
525
+ }, Ve = 5, $e = 1, Be = (e, t) => t, Ne = "brightness(2.2) contrast(1.5) saturate(1.25)", We = ({
522
526
  enabled: e,
523
527
  displayMirrored: t,
524
- imageRef: n,
528
+ imageRef: a,
525
529
  layout: r,
526
- mode: i,
527
- numFaces: o,
528
- selectedSource: a,
529
- sourceStream: s,
530
- videoRef: l
530
+ mode: n,
531
+ numFaces: c,
532
+ selectedSource: u,
533
+ sourceStream: d,
534
+ videoRef: i
531
535
  }) => {
532
- const { session: d } = O(), c = X(null), h = X(!1), b = X(document.createElement("canvas")), {
533
- ready: f,
534
- node: w,
535
- error: p
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({
539
- node: v ? w : null,
540
- enabled: v,
541
- selectedSource: a,
542
- onFrame: ce(() => {
543
- R(null), S("ready");
536
+ const { session: f } = ie(), h = _(null), s = _(!1), p = _(document.createElement("canvas")), {
537
+ ready: g,
538
+ node: o,
539
+ error: l
540
+ } = Se(D.FACE_TRACKER, {
541
+ numFaces: c ?? (n === "head-binding" ? $e : Ve)
542
+ }), [m, w] = M("idle"), [S, R] = M(null), x = e && g && !!o, E = oe({
543
+ node: x ? o : null,
544
+ enabled: x,
545
+ selectedSource: u,
546
+ onFrame: xe(() => {
547
+ R(null), w("ready");
544
548
  }, [])
545
549
  });
546
- return z(() => {
550
+ return A(() => {
547
551
  if (!e || !r) return;
548
- const x = () => {
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)
552
+ const v = () => {
553
+ const C = u === "image" ? a.current : i.current;
554
+ if (C) {
555
+ if (C instanceof HTMLImageElement) {
556
+ if (!C.complete || C.naturalWidth <= 0 || C.naturalHeight <= 0) return;
557
+ } else if (C.readyState < 2 || C.videoWidth <= 0 || C.videoHeight <= 0)
554
558
  return;
555
- q({
556
- canvas: b.current,
559
+ U({
560
+ canvas: p.current,
557
561
  layout: r,
558
- media: y,
562
+ media: C,
559
563
  mirrored: t,
560
- filter: a === "webcam" ? ze : void 0
564
+ filter: u === "webcam" ? Ne : void 0
561
565
  });
562
566
  }
563
567
  };
564
- if (a === "image") {
565
- x();
568
+ if (u === "image") {
569
+ v();
566
570
  return;
567
571
  }
568
- let u = 0;
569
- const I = () => {
570
- u = requestAnimationFrame(I), x();
572
+ let y = 0;
573
+ const k = () => {
574
+ y = requestAnimationFrame(k), v();
571
575
  };
572
- return u = requestAnimationFrame(I), () => cancelAnimationFrame(u);
573
- }, [t, e, n, r, a, l]), z(() => {
574
- var V;
576
+ return y = requestAnimationFrame(k), () => cancelAnimationFrame(y);
577
+ }, [t, e, a, r, u, i]), A(() => {
578
+ var P;
575
579
  if (!e) {
576
- S("idle"), R(null), h.current = !1, c.current = null;
580
+ w("idle"), R(null), s.current = !1, h.current = null;
577
581
  return;
578
582
  }
579
583
  if (!r) {
580
- S("initializing");
584
+ w("initializing");
581
585
  return;
582
586
  }
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;
587
+ const v = (d == null ? void 0 : d.id) ?? (((P = i.current) == null ? void 0 : P.srcObject) instanceof MediaStream ? i.current.srcObject.id : "none"), k = u === "webcam" ? `webcam:${v}` : u;
588
+ h.current !== k && (s.current = !1, h.current = k);
589
+ let C = !1;
586
590
  return (async () => {
587
591
  try {
588
- S("initializing");
589
- const T = !h.current;
590
- if (T && await d.setFrameSource({
591
- canvas: b.current,
592
- sourceKind: a
593
- }), await d._setRenderSize(
592
+ w("initializing");
593
+ const F = !s.current;
594
+ if (F && await f.setFrameSource({
595
+ canvas: p.current,
596
+ sourceKind: u
597
+ }), await f._setRenderSize(
594
598
  Math.round(r.destination.width),
595
599
  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");
600
+ ), F && (await f.start(), s.current = !0), C) return;
601
+ R(null), w("initializing");
602
+ } catch (F) {
603
+ if (C) return;
604
+ w("error"), R(F instanceof Error ? F.message : "Failed to initialize SDK face tracking");
601
605
  }
602
606
  })(), () => {
603
- y = !0;
607
+ C = !0;
604
608
  };
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]), {
609
+ }, [e, r, u, f, d, i]), A(() => {
610
+ !x && e && !l && w("initializing");
611
+ }, [x, e, l]), A(() => {
612
+ l && (w("error"), R(l.message));
613
+ }, [l]), A(() => () => {
614
+ s.current = !1, f.stop();
615
+ }, [f]), {
612
616
  activeDelegate: "GPU",
613
617
  faces: E,
614
618
  status: m,
615
- error: M
619
+ error: S
616
620
  };
617
- }, ke = (e, t) => e === "auto" ? t === "webcam" ? "cover" : "contain" : e, Ae = ({
621
+ }, He = (e, t) => e === "auto" ? t === "webcam" ? "cover" : "contain" : e, qe = ({
618
622
  imageOptions: e,
619
623
  initialImageId: t,
620
- initialSource: n,
624
+ initialSource: a,
621
625
  initialVideoId: r,
622
- source: i,
623
- videoOptions: o
626
+ source: n,
627
+ videoOptions: c
624
628
  }) => {
625
- var l, d, c, h;
626
- const a = (i == null ? void 0 : i.kind) ?? n ?? "webcam";
629
+ var i, f, h, s;
630
+ const u = (n == null ? void 0 : n.kind) ?? a ?? "webcam";
627
631
  return {
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) ?? ""
632
+ selectedSource: u === "image" && e.length === 0 || u === "video" && c.length === 0 ? "webcam" : u,
633
+ selectedImageId: (n == null ? void 0 : n.kind) === "image" ? n.assetId ?? ((i = e[0]) == null ? void 0 : i.id) ?? "" : t ?? ((f = e[0]) == null ? void 0 : f.id) ?? "",
634
+ selectedVideoId: (n == null ? void 0 : n.kind) === "video" ? n.assetId ?? ((h = c[0]) == null ? void 0 : h.id) ?? "" : r ?? ((s = c[0]) == null ? void 0 : s.id) ?? ""
631
635
  };
632
- }, Le = (e, t, n) => {
636
+ }, Ge = (e, t, a) => {
633
637
  if (e.width <= 0 || e.height <= 0 || t.width <= 0 || t.height <= 0)
634
638
  return null;
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;
636
- return {
637
- source: e,
638
- destination: t,
639
- drawWidth: i,
640
- drawHeight: o,
641
- offsetX: (t.width - i) * 0.5,
642
- offsetY: (t.height - o) * 0.5,
643
- scale: r
644
- };
645
- }, Ve = (e) => {
639
+ const r = he(e, t, a);
640
+ return r ? { source: e, destination: t, ...r } : null;
641
+ }, Ue = (e) => {
646
642
  if (!e) return { width: 0, height: 0 };
647
643
  const t = e.getBoundingClientRect();
648
644
  return {
649
645
  width: t.width || e.clientWidth,
650
646
  height: t.height || e.clientHeight
651
647
  };
652
- }, De = (e) => {
653
- const [t, n] = C({ width: 0, height: 0 });
654
- return ue(() => {
648
+ }, je = (e) => {
649
+ const [t, a] = M({ width: 0, height: 0 });
650
+ return Re(() => {
655
651
  const r = e.current;
656
652
  if (!r) return;
657
- let i = 0;
658
- const o = () => {
659
- const d = Ve(r);
660
- n(
661
- (c) => c.width === d.width && c.height === d.height ? c : d
653
+ let n = 0;
654
+ const c = () => {
655
+ const f = Ue(r);
656
+ a(
657
+ (h) => h.width === f.width && h.height === f.height ? h : f
662
658
  );
663
- }, a = () => {
664
- o(), i && cancelAnimationFrame(i), i = requestAnimationFrame(o);
659
+ }, u = () => {
660
+ c(), n && cancelAnimationFrame(n), n = requestAnimationFrame(c);
665
661
  };
666
- a();
667
- const s = new ResizeObserver(a);
668
- s.observe(r);
669
- const l = window.visualViewport;
670
- return window.addEventListener("resize", a), window.addEventListener("orientationchange", a), l == null || l.addEventListener("resize", a), l == null || l.addEventListener("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);
662
+ u();
663
+ const d = new ResizeObserver(u);
664
+ d.observe(r);
665
+ const i = window.visualViewport;
666
+ return window.addEventListener("resize", u), window.addEventListener("orientationchange", u), i == null || i.addEventListener("resize", u), i == null || i.addEventListener("scroll", u), () => {
667
+ n && cancelAnimationFrame(n), d.disconnect(), window.removeEventListener("resize", u), window.removeEventListener("orientationchange", u), i == null || i.removeEventListener("resize", u), i == null || i.removeEventListener("scroll", u);
672
668
  };
673
669
  }, [e]), t;
674
- }, Be = ({
670
+ }, Ke = ({
675
671
  enabled: e,
676
672
  selectedSource: t
677
673
  }) => {
678
- const n = de(ee.FACE_TRACKER);
674
+ const a = ve(D.FACE_TRACKER);
679
675
  return {
680
- faces: te({ node: n, enabled: e, selectedSource: t }),
681
- trackerStatus: n ? "ready" : "idle"
676
+ faces: oe({ node: a, enabled: e, selectedSource: t }),
677
+ trackerStatus: a ? "ready" : "idle"
682
678
  };
683
- }, J = (e) => {
679
+ }, re = (e) => {
684
680
  e && (e.pause(), e.removeAttribute("src"), e.srcObject = null, e.load());
685
- }, Q = (e) => {
681
+ }, ae = (e) => {
686
682
  e && e.removeAttribute("src");
687
- }, _e = ({
683
+ }, Qe = ({
688
684
  enabled: e,
689
685
  imageAsset: t,
690
- selectedSource: n,
686
+ selectedSource: a,
691
687
  videoAsset: r
692
688
  }) => {
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(() => {
689
+ const n = _(null), c = _(null), [u, d] = M(null), [i, f] = M({ width: 0, height: 0 }), [h, s] = M("idle"), [p, g] = M(null);
690
+ return A(() => {
695
691
  if (!e) {
696
- J(i.current), Q(o.current), s(null), d({ width: 0, height: 0 }), h("idle"), f(null);
692
+ re(n.current), ae(c.current), d(null), f({ width: 0, height: 0 }), s("idle"), g(null);
697
693
  return;
698
694
  }
699
- let w = !1, p = null;
700
- const m = (x, u) => {
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 () => {
705
- h("requesting");
706
- const x = await navigator.mediaDevices.getUserMedia(ve);
707
- if (w) {
708
- x.getTracks().forEach((I) => I.stop());
695
+ let o = !1, l = null;
696
+ const m = (v, y) => {
697
+ o || (f({ width: v, height: y }), s("ready"), g(null));
698
+ }, w = () => {
699
+ re(n.current), ae(c.current), l == null || l.getTracks().forEach((v) => v.stop()), l = null, d(null);
700
+ }, S = async () => {
701
+ s("requesting");
702
+ const v = await navigator.mediaDevices.getUserMedia(Le);
703
+ if (o) {
704
+ v.getTracks().forEach((k) => k.stop());
709
705
  return;
710
706
  }
711
- p = x, s(x);
712
- const u = i.current;
713
- u && (u.srcObject = x, u.muted = !0, u.playsInline = !0, u.autoplay = !0, await u.play(), m(u.videoWidth, u.videoHeight));
714
- }, R = async (x) => {
715
- h("requesting"), s(null);
716
- const u = i.current;
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));
718
- }, v = async (x) => {
719
- h("requesting"), s(null);
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;
723
- }), m(u.naturalWidth, u.naturalHeight));
707
+ l = v, d(v);
708
+ const y = n.current;
709
+ y && (y.srcObject = v, y.muted = !0, y.playsInline = !0, y.autoplay = !0, await y.play(), m(y.videoWidth, y.videoHeight));
710
+ }, R = async (v) => {
711
+ s("requesting"), d(null);
712
+ const y = n.current;
713
+ y && (y.src = v, y.muted = !0, y.loop = !0, y.playsInline = !0, y.autoplay = !0, y.crossOrigin = "anonymous", await y.play(), m(y.videoWidth, y.videoHeight));
714
+ }, x = async (v) => {
715
+ s("requesting"), d(null);
716
+ const y = c.current;
717
+ y && (await new Promise((k, C) => {
718
+ y.onload = () => k(), y.onerror = () => C(new Error("Unable to load image")), y.src = v;
719
+ }), m(y.naturalWidth, y.naturalHeight));
724
720
  };
725
- return S(), (async () => {
721
+ return w(), (async () => {
726
722
  try {
727
- if (n === "webcam") {
728
- await M();
723
+ if (a === "webcam") {
724
+ await S();
729
725
  return;
730
726
  }
731
- if (n === "video") {
727
+ if (a === "video") {
732
728
  if (!(r != null && r.src)) throw new Error("Missing video source");
733
729
  await R(r.src);
734
730
  return;
735
731
  }
736
732
  if (!(t != null && t.src)) throw new Error("Missing image source");
737
- await v(t.src);
738
- } catch (x) {
739
- if (w) return;
740
- h("error"), f(x instanceof Error ? x.message : `Unable to initialize ${n}`);
733
+ await x(t.src);
734
+ } catch (v) {
735
+ if (o) return;
736
+ s("error"), g(v instanceof Error ? v.message : `Unable to initialize ${a}`);
741
737
  }
742
738
  })(), () => {
743
- w = !0, S();
739
+ o = !0, w();
744
740
  };
745
- }, [e, t, n, r]), {
746
- videoRef: i,
747
- imageRef: o,
748
- stream: a,
749
- mediaSize: l,
750
- status: c,
751
- error: b
741
+ }, [e, t, a, r]), {
742
+ videoRef: n,
743
+ imageRef: c,
744
+ stream: u,
745
+ mediaSize: i,
746
+ status: h,
747
+ error: p
752
748
  };
753
- }, We = ({
749
+ }, Ye = ({
754
750
  enabled: e,
755
751
  imageRef: t,
756
- selectedSource: n,
752
+ selectedSource: a,
757
753
  status: r,
758
- videoRef: i
754
+ videoRef: n
759
755
  }) => {
760
- const [o, a] = C(null);
761
- return z(() => {
756
+ const [c, u] = M(null);
757
+ return A(() => {
762
758
  if (!e || r !== "ready") {
763
- a((d) => (d == null || d.dispose(), null));
759
+ u((f) => (f == null || f.dispose(), null));
764
760
  return;
765
761
  }
766
- const s = n === "image" ? t.current : i.current;
767
- if (!s) return;
768
- const l = n === "image" ? new L.Texture(s) : new L.VideoTexture(s);
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)), () => {
770
- l.dispose();
762
+ const d = a === "image" ? t.current : n.current;
763
+ if (!d) return;
764
+ const i = a === "image" ? new z.Texture(d) : new z.VideoTexture(d);
765
+ return i.colorSpace = z.SRGBColorSpace, i.minFilter = z.LinearFilter, i.magFilter = z.LinearFilter, i.generateMipmaps = !1, i.needsUpdate = !0, u((f) => (f == null || f.dispose(), i)), () => {
766
+ i.dispose();
771
767
  };
772
- }, [e, t, n, r, i]), o;
773
- }, He = ({
768
+ }, [e, t, a, r, n]), c;
769
+ }, Je = ({
774
770
  externalTracker: e,
775
771
  imageOptions: t,
776
- layout: n,
772
+ layout: a,
777
773
  managesOwnMedia: r,
778
- mediaError: i,
779
- mediaFitMode: o,
780
- mediaSize: a,
781
- mediaStatus: s,
782
- mirrored: l,
783
- selectedImage: d,
784
- selectedImageId: c,
785
- selectedSource: h,
786
- selectedVideo: b,
787
- selectedVideoId: f,
788
- setMirrored: w,
789
- setSelectedImageId: p,
774
+ mediaError: n,
775
+ mediaFitMode: c,
776
+ mediaSize: u,
777
+ mediaStatus: d,
778
+ mirrored: i,
779
+ selectedImage: f,
780
+ selectedImageId: h,
781
+ selectedSource: s,
782
+ selectedVideo: p,
783
+ selectedVideoId: g,
784
+ setMirrored: o,
785
+ setSelectedImageId: l,
790
786
  setSelectedSource: m,
791
- setSelectedVideoId: S,
792
- setShowMediaControls: M,
787
+ setSelectedVideoId: w,
788
+ setShowMediaControls: S,
793
789
  showMediaControls: R,
794
- tracker: v,
790
+ tracker: x,
795
791
  videoOptions: E,
796
- viewportSize: x
792
+ viewportSize: v
797
793
  }) => {
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;
794
+ const y = s === "image" ? `${O.image.label}: ${(f == null ? void 0 : f.label) ?? ""}` : s === "video" ? `${O.video.label}: ${(p == null ? void 0 : p.label) ?? ""}` : O.webcam.label;
799
795
  return {
800
- activeDelegate: r ? v.activeDelegate : null,
801
- faces: r ? v.faces : e.faces,
796
+ activeDelegate: r ? x.activeDelegate : null,
797
+ faces: r ? x.faces : e.faces,
802
798
  imageOptions: t,
803
- layout: n,
804
- mediaError: i,
805
- mediaFitMode: o,
806
- mediaLabel: u,
807
- mediaStatus: s,
808
- mirrored: l,
809
- selectedImageId: c,
810
- selectedSource: h,
811
- selectedVideoId: f,
812
- setMirrored: w,
813
- setSelectedImageId: p,
799
+ layout: a,
800
+ mediaError: n,
801
+ mediaFitMode: c,
802
+ mediaLabel: y,
803
+ mediaStatus: d,
804
+ mirrored: i,
805
+ selectedImageId: h,
806
+ selectedSource: s,
807
+ selectedVideoId: g,
808
+ setMirrored: o,
809
+ setSelectedImageId: l,
814
810
  setSelectedSource: m,
815
- setSelectedVideoId: S,
816
- setShowMediaControls: M,
811
+ setSelectedVideoId: w,
812
+ setShowMediaControls: S,
817
813
  showMediaControls: R,
818
- trackerError: r ? v.error : null,
819
- trackerStatus: r ? v.status : e.trackerStatus,
814
+ trackerError: r ? x.error : null,
815
+ trackerStatus: r ? x.status : e.trackerStatus,
820
816
  videoOptions: E,
821
- viewportSize: x,
822
- mediaSize: a
817
+ viewportSize: v,
818
+ mediaSize: u
823
819
  };
824
- }, Pe = ({
820
+ }, Ze = ({
825
821
  mediaTexture: e,
826
822
  previewMode: t,
827
- renderOutputs: n,
823
+ renderOutputs: a,
828
824
  sceneRenderOutputs: r
829
- }) => $(
825
+ }) => G(
830
826
  () => ({
831
- requested: n,
827
+ requested: a,
832
828
  previewMode: t,
833
829
  mediaColorTexture: e,
834
830
  sceneColorTexture: r.sceneColorTexture,
835
- finalColorTexture: n.finalColor ? r.sceneColorTexture : null,
831
+ finalColorTexture: a.finalColor ? r.sceneColorTexture : null,
836
832
  sceneDepthTexture: r.sceneDepthTexture,
837
833
  estimatedDepthTexture: null,
838
834
  available: {
839
835
  mediaColor: e !== null,
840
836
  sceneColor: r.sceneColorTexture !== null,
841
- finalColor: !!(n.finalColor && r.sceneColorTexture),
837
+ finalColor: !!(a.finalColor && r.sceneColorTexture),
842
838
  sceneDepth: r.sceneDepthTexture !== null,
843
839
  estimatedDepth: !1
844
840
  }
845
841
  }),
846
- [e, t, n, r]
847
- ), $e = ({
842
+ [e, t, a, r]
843
+ ), et = ({
848
844
  fitMode: e,
849
845
  imageOptions: t,
850
- initialImageId: n,
846
+ initialImageId: a,
851
847
  initialMirrored: r,
852
- initialSource: i,
853
- initialVideoId: o,
854
- mediaStrategy: a,
855
- previewMode: s,
856
- renderOutputs: l,
857
- showMediaControlsByDefault: d,
858
- source: c,
859
- videoOptions: h
848
+ initialSource: n,
849
+ initialVideoId: c,
850
+ mediaStrategy: u,
851
+ previewMode: d,
852
+ renderOutputs: i,
853
+ showMediaControlsByDefault: f,
854
+ source: h,
855
+ videoOptions: s
860
856
  }) => {
861
- const b = X(null), f = X(null), w = De(b), p = $(
862
- () => Ae({
857
+ const p = _(null), g = _(null), o = je(p), l = G(
858
+ () => qe({
863
859
  imageOptions: t,
864
- initialImageId: n,
865
- initialSource: i,
866
- initialVideoId: o,
867
- source: c,
868
- videoOptions: h
860
+ initialImageId: a,
861
+ initialSource: n,
862
+ initialVideoId: c,
863
+ source: h,
864
+ videoOptions: s
869
865
  }),
870
- [t, n, i, o, c, h]
871
- ), [m, S] = C(r), [M, R] = C(d), [v, E] = C(
872
- p.selectedSource
873
- ), [x, u] = C(p.selectedImageId), [I, y] = C(p.selectedVideoId), [j, V] = C({
866
+ [t, a, n, c, h, s]
867
+ ), [m, w] = M(r), [S, R] = M(f), [x, E] = M(
868
+ l.selectedSource
869
+ ), [v, y] = M(l.selectedImageId), [k, C] = M(l.selectedVideoId), [Y, P] = M({
874
870
  sceneColorTexture: null,
875
871
  sceneDepthTexture: null
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,
882
- imageAsset: K,
883
- selectedSource: v,
884
- videoAsset: G
885
- }), W = ke(e, v), D = $(
886
- () => Le(F.mediaSize, w, W),
887
- [F.mediaSize, W, w]
888
- ), ne = We({
889
- enabled: !!(l.mediaColor || l.finalColor),
890
- imageRef: F.imageRef,
891
- selectedSource: v,
892
- status: F.status,
893
- videoRef: F.videoRef
894
- }), H = Te(v, m), oe = Xe({
872
+ }), F = u === "internal";
873
+ A(() => {
874
+ h && (E(l.selectedSource), y(l.selectedImageId), C(l.selectedVideoId));
875
+ }, [l, h]);
876
+ const J = t.find((q) => q.id === v) ?? t[0], Z = s.find((q) => q.id === k) ?? s[0], T = Qe({
877
+ enabled: F,
878
+ imageAsset: J,
879
+ selectedSource: x,
880
+ videoAsset: Z
881
+ }), W = He(e, x), V = G(
882
+ () => Ge(T.mediaSize, o, W),
883
+ [T.mediaSize, W, o]
884
+ ), de = Ye({
885
+ enabled: !!(i.mediaColor || i.finalColor),
886
+ imageRef: T.imageRef,
887
+ selectedSource: x,
888
+ status: T.status,
889
+ videoRef: T.videoRef
890
+ }), H = Be(x, m), ue = We({
895
891
  displayMirrored: H,
896
- enabled: T && F.status === "ready" && D !== null,
897
- imageRef: F.imageRef,
898
- layout: D,
899
- selectedSource: v,
900
- sourceStream: F.stream,
901
- videoRef: F.videoRef
902
- }), ie = Be({
903
- enabled: !T,
904
- selectedSource: v
905
- }), ae = He({
906
- externalTracker: ie,
892
+ enabled: F && T.status === "ready" && V !== null,
893
+ imageRef: T.imageRef,
894
+ layout: V,
895
+ selectedSource: x,
896
+ sourceStream: T.stream,
897
+ videoRef: T.videoRef
898
+ }), me = Ke({
899
+ enabled: !F,
900
+ selectedSource: x
901
+ }), fe = Je({
902
+ externalTracker: me,
907
903
  imageOptions: t,
908
- layout: D,
909
- managesOwnMedia: T,
910
- mediaError: F.error,
904
+ layout: V,
905
+ managesOwnMedia: F,
906
+ mediaError: T.error,
911
907
  mediaFitMode: W,
912
- mediaSize: F.mediaSize,
913
- mediaStatus: F.status,
908
+ mediaSize: T.mediaSize,
909
+ mediaStatus: T.status,
914
910
  mirrored: H,
915
- selectedImage: K,
916
- selectedImageId: x,
917
- selectedSource: v,
918
- selectedVideo: G,
919
- selectedVideoId: I,
920
- setMirrored: S,
921
- setSelectedImageId: u,
911
+ selectedImage: J,
912
+ selectedImageId: v,
913
+ selectedSource: x,
914
+ selectedVideo: Z,
915
+ selectedVideoId: k,
916
+ setMirrored: w,
917
+ setSelectedImageId: y,
922
918
  setSelectedSource: E,
923
- setSelectedVideoId: y,
919
+ setSelectedVideoId: C,
924
920
  setShowMediaControls: R,
925
- showMediaControls: M,
926
- tracker: oe,
927
- videoOptions: h,
928
- viewportSize: w
929
- }), se = Pe({
930
- mediaTexture: ne,
931
- previewMode: s,
932
- renderOutputs: l,
933
- sceneRenderOutputs: j
921
+ showMediaControls: S,
922
+ tracker: ue,
923
+ videoOptions: s,
924
+ viewportSize: o
925
+ }), pe = Ze({
926
+ mediaTexture: de,
927
+ previewMode: d,
928
+ renderOutputs: i,
929
+ sceneRenderOutputs: Y
934
930
  });
935
931
  return {
936
- containerRef: b,
937
- displayCanvasRef: f,
932
+ containerRef: p,
933
+ displayCanvasRef: g,
938
934
  displayMirrored: H,
939
- layout: D,
940
- managesOwnMedia: T,
941
- media: F,
942
- renderOutputState: se,
943
- renderState: ae,
944
- selectedImageId: x,
945
- selectedSource: v,
946
- selectedVideoId: I,
947
- setSceneRenderOutputs: V,
948
- setSelectedImageId: u,
935
+ layout: V,
936
+ managesOwnMedia: F,
937
+ media: T,
938
+ renderOutputState: pe,
939
+ renderState: fe,
940
+ selectedImageId: v,
941
+ selectedSource: x,
942
+ selectedVideoId: k,
943
+ setSceneRenderOutputs: P,
944
+ setSelectedImageId: y,
949
945
  setSelectedSource: E,
950
- setSelectedVideoId: y,
951
- showMediaControls: M,
952
- viewportSize: w
946
+ setSelectedVideoId: C,
947
+ showMediaControls: S,
948
+ viewportSize: o
953
949
  };
954
- }, U = ({ children: e }) => /* @__PURE__ */ g(_, { children: e });
955
- U.displayName = "XRViewport.Scene";
956
- const N = ({ children: e }) => /* @__PURE__ */ g(_, { children: e });
957
- N.displayName = "XRViewport.Overlay";
958
- const qe = (e, t) => {
950
+ }, K = ({ children: e }) => /* @__PURE__ */ b(N, { children: e });
951
+ K.displayName = "XRViewport.Scene";
952
+ const Q = ({ children: e }) => /* @__PURE__ */ b(N, { children: e });
953
+ Q.displayName = "XRViewport.Overlay";
954
+ const tt = (e, t) => {
959
955
  if (e === "dom")
960
956
  return {
961
957
  sceneContent: null,
962
958
  overlayContent: t
963
959
  };
964
- let n = null, r = null;
965
- const i = [];
966
- return he.forEach(t, (o) => {
967
- var s;
968
- if (!me(o)) {
969
- o != null && i.push(o);
960
+ let a = null, r = null;
961
+ const n = [];
962
+ return Ce.forEach(t, (c) => {
963
+ var d;
964
+ if (!Ee(c)) {
965
+ c != null && n.push(c);
970
966
  return;
971
967
  }
972
- const a = (s = o.type) == null ? void 0 : s.displayName;
973
- if (a === U.displayName) {
974
- n = o.props.children;
968
+ const u = (d = c.type) == null ? void 0 : d.displayName;
969
+ if (u === K.displayName) {
970
+ a = c.props.children;
975
971
  return;
976
972
  }
977
- if (a === N.displayName) {
978
- r = o.props.children;
973
+ if (u === Q.displayName) {
974
+ r = c.props.children;
979
975
  return;
980
976
  }
981
- i.push(o);
982
- }), !r && i.length > 0 && (r = i), {
983
- sceneContent: n,
977
+ n.push(c);
978
+ }), !r && n.length > 0 && (r = n), {
979
+ sceneContent: a,
984
980
  overlayContent: r
985
981
  };
986
- }, Z = (e, t) => typeof e == "function" ? e(t) : e;
987
- function Ue(e) {
988
- return e.Scene = U, e.Overlay = N, e;
982
+ }, ne = (e, t) => typeof e == "function" ? e(t) : e;
983
+ function rt(e) {
984
+ return e.Scene = K, e.Overlay = Q, e;
989
985
  }
990
- const rt = Ue(({
986
+ const vt = rt(({
991
987
  children: e,
992
988
  fitMode: t = "auto",
993
- imageOptions: n = [],
989
+ imageOptions: a = [],
994
990
  initialImageId: r,
995
- initialMirrored: i = !0,
996
- initialSource: o = "webcam",
997
- initialVideoId: a,
998
- mediaStrategy: s = "internal",
999
- mediaDock: l = "bottom-left",
1000
- mode: d = "dom",
1001
- previewMode: c = "finalColor",
1002
- renderOutputs: h = {},
1003
- showMediaControlsByDefault: b = !0,
1004
- source: f,
1005
- style: w,
1006
- videoOptions: p = []
991
+ initialMirrored: n = !0,
992
+ initialSource: c = "webcam",
993
+ initialVideoId: u,
994
+ mediaStrategy: d = "internal",
995
+ mediaDock: i = "bottom-left",
996
+ mode: f = "dom",
997
+ previewMode: h = "finalColor",
998
+ renderOutputs: s = {},
999
+ showMediaControlsByDefault: p = !0,
1000
+ source: g,
1001
+ style: o,
1002
+ videoOptions: l = []
1007
1003
  }) => {
1008
- const m = $e({
1004
+ const m = et({
1009
1005
  fitMode: t,
1010
- imageOptions: n,
1006
+ imageOptions: a,
1011
1007
  initialImageId: r,
1012
- initialMirrored: i,
1013
- initialSource: o,
1014
- initialVideoId: a,
1015
- mediaStrategy: s,
1016
- previewMode: c,
1017
- renderOutputs: h,
1018
- showMediaControlsByDefault: b,
1019
- source: f,
1020
- videoOptions: p
1021
- }), S = typeof e == "function" ? e(m.renderState) : e, { sceneContent: M, overlayContent: R } = qe(d, S), v = Z(
1022
- M,
1008
+ initialMirrored: n,
1009
+ initialSource: c,
1010
+ initialVideoId: u,
1011
+ mediaStrategy: d,
1012
+ previewMode: h,
1013
+ renderOutputs: s,
1014
+ showMediaControlsByDefault: p,
1015
+ source: g,
1016
+ videoOptions: l
1017
+ }), w = typeof e == "function" ? e(m.renderState) : e, { sceneContent: S, overlayContent: R } = tt(f, w), x = ne(
1018
+ S,
1023
1019
  m.renderState
1024
- ), E = Z(
1020
+ ), E = ne(
1025
1021
  R,
1026
1022
  m.renderState
1027
1023
  );
1028
- return /* @__PURE__ */ g(be.Provider, { value: m.renderState, children: /* @__PURE__ */ g(we.Provider, { value: m.renderOutputState, children: /* @__PURE__ */ g(
1029
- Ee,
1024
+ return /* @__PURE__ */ b(Ie.Provider, { value: m.renderState, children: /* @__PURE__ */ b(Fe.Provider, { value: m.renderOutputState, children: /* @__PURE__ */ b(
1025
+ Pe,
1030
1026
  {
1031
1027
  containerRef: m.containerRef,
1032
1028
  displayCanvasRef: m.displayCanvasRef,
1033
- imageOptions: n,
1029
+ imageOptions: a,
1034
1030
  imageRef: m.media.imageRef,
1035
1031
  layout: m.layout,
1036
1032
  managesOwnMedia: m.managesOwnMedia,
1037
- mediaDock: l,
1033
+ mediaDock: i,
1038
1034
  mirrored: m.displayMirrored,
1039
- mode: d,
1035
+ mode: f,
1040
1036
  overlayContent: E,
1041
- renderOutputs: h,
1042
- sceneContent: v,
1037
+ renderOutputs: s,
1038
+ sceneContent: x,
1043
1039
  selectedImageId: m.selectedImageId,
1044
1040
  selectedSource: m.selectedSource,
1045
1041
  selectedVideoId: m.selectedVideoId,
@@ -1048,13 +1044,13 @@ const rt = Ue(({
1048
1044
  setSelectedSource: m.setSelectedSource,
1049
1045
  setSelectedVideoId: m.setSelectedVideoId,
1050
1046
  showMediaControls: m.showMediaControls,
1051
- style: w,
1052
- videoOptions: p,
1047
+ style: o,
1048
+ videoOptions: l,
1053
1049
  videoRef: m.media.videoRef,
1054
1050
  viewportSize: m.viewportSize
1055
1051
  }
1056
1052
  ) }) });
1057
- }), Ne = {
1053
+ }), at = {
1058
1054
  position: "absolute",
1059
1055
  top: -28,
1060
1056
  left: 0,
@@ -1065,13 +1061,13 @@ const rt = Ue(({
1065
1061
  fontWeight: 700,
1066
1062
  padding: "4px 8px",
1067
1063
  whiteSpace: "nowrap"
1068
- }, nt = ({
1064
+ }, xt = ({
1069
1065
  boundingBox: e,
1070
1066
  label: t = "face bounding box",
1071
- color: n = "#22c55e",
1067
+ color: a = "#22c55e",
1072
1068
  style: r,
1073
- labelStyle: i
1074
- }) => /* @__PURE__ */ g(
1069
+ labelStyle: n
1070
+ }) => /* @__PURE__ */ b(
1075
1071
  "div",
1076
1072
  {
1077
1073
  style: {
@@ -1080,43 +1076,416 @@ const rt = Ue(({
1080
1076
  top: `${e.top * 100}%`,
1081
1077
  width: `${e.width * 100}%`,
1082
1078
  height: `${e.height * 100}%`,
1083
- border: `3px solid ${n}`,
1079
+ border: `3px solid ${a}`,
1084
1080
  boxSizing: "border-box",
1085
1081
  pointerEvents: "none",
1086
1082
  zIndex: 20,
1087
1083
  ...r
1088
1084
  },
1089
- children: t !== null && /* @__PURE__ */ g("div", { style: { ...Ne, ...i }, children: t })
1085
+ children: t !== null && /* @__PURE__ */ b("div", { style: { ...at, ...n }, children: t })
1086
+ }
1087
+ ), j = [
1088
+ {
1089
+ id: "capabilities",
1090
+ title: "Capability report",
1091
+ steps: "Run detectXRCapabilities with model probes.",
1092
+ expect: "Rendering supported (WebGL, OffscreenCanvas, WebAssembly); camera not unsupported; model assets reachable.",
1093
+ mode: "automated",
1094
+ layer: "capability"
1095
+ },
1096
+ {
1097
+ id: "session-start",
1098
+ title: "Session binds and starts",
1099
+ steps: "setMediaSource (webcam or the supplied stream) and start().",
1100
+ expect: "Lifecycle reaches running within the timeout; feed frames advance.",
1101
+ mode: "automated",
1102
+ layer: "lifecycle"
1103
+ },
1104
+ {
1105
+ id: "model-ready",
1106
+ title: "Tracker models initialize",
1107
+ steps: "Acquire each requested model and wait for ready.",
1108
+ expect: "Every model reaches ready; none errors.",
1109
+ mode: "automated",
1110
+ layer: "model"
1111
+ },
1112
+ {
1113
+ id: "model-detects",
1114
+ title: "Trackers run inference",
1115
+ steps: "Sample diagnostics while running.",
1116
+ expect: "Each ready model reports inferences > 0 (detection itself needs a subject in frame).",
1117
+ mode: "automated",
1118
+ layer: "model"
1119
+ },
1120
+ {
1121
+ id: "pause-resume",
1122
+ title: "Pause and resume",
1123
+ steps: "session.pause(), then resume().",
1124
+ expect: "Lifecycle paused then running; feed resumes.",
1125
+ mode: "automated",
1126
+ layer: "lifecycle"
1127
+ },
1128
+ {
1129
+ id: "stop-start",
1130
+ title: "Stop and rebind",
1131
+ steps: "session.stop(), then setMediaSource + start() again.",
1132
+ expect: "Lifecycle stopped then running on the same source.",
1133
+ mode: "automated",
1134
+ layer: "lifecycle"
1135
+ },
1136
+ {
1137
+ id: "performance",
1138
+ title: "Performance sample",
1139
+ steps: "Measure frame rate and tracker inference over the window.",
1140
+ expect: "Frame rate ≥ 20 fps and total inference ≤ 50 ms while running.",
1141
+ mode: "automated",
1142
+ layer: "performance"
1143
+ }
1144
+ ], nt = [
1145
+ {
1146
+ id: "permission-prompt",
1147
+ title: "First-visit permission prompt",
1148
+ steps: "Open the app in a fresh profile; tap Allow on the prompt.",
1149
+ expect: "Camera starts; no second prompt on reload.",
1150
+ mode: "manual",
1151
+ layer: "capability"
1152
+ },
1153
+ {
1154
+ id: "permission-blocked",
1155
+ title: "Blocked camera recovers",
1156
+ steps: "Block the camera in site settings, reload, then allow it from the address bar.",
1157
+ expect: "Gate shows blocked with instructions; allowing flips it without a reload.",
1158
+ mode: "manual",
1159
+ layer: "capability"
1160
+ },
1161
+ {
1162
+ id: "rear-camera",
1163
+ title: "Rear camera",
1164
+ steps: "Switch front → rear on /camera-switching.",
1165
+ expect: "Rear feed is straight (text readable); tracking stays aligned.",
1166
+ mode: "manual",
1167
+ layer: "lifecycle"
1168
+ },
1169
+ {
1170
+ id: "orientation",
1171
+ title: "Rotate the device",
1172
+ steps: "Rotate portrait ↔ landscape while tracking a face.",
1173
+ expect: "Anchored content stays on the face; no stretched feed.",
1174
+ mode: "manual",
1175
+ layer: "lifecycle"
1176
+ },
1177
+ {
1178
+ id: "background-foreground",
1179
+ title: "Background and return",
1180
+ steps: "Switch apps / lock the screen for 10 s and come back.",
1181
+ expect: "Feed resumes by itself; no frozen frame; trackers continue.",
1182
+ mode: "manual",
1183
+ layer: "lifecycle"
1184
+ },
1185
+ {
1186
+ id: "camera-interrupted",
1187
+ title: "Camera taken by another app",
1188
+ steps: "Take a call or open the native camera, then return.",
1189
+ expect: "Session reports camera-lost and recovers on retry.",
1190
+ mode: "manual",
1191
+ layer: "lifecycle"
1192
+ },
1193
+ {
1194
+ id: "thermal",
1195
+ title: "Sustained use",
1196
+ steps: "Run face + body tracking for 5 minutes.",
1197
+ expect: "Adaptive quality steps down before the frame rate collapses; no crash.",
1198
+ mode: "manual",
1199
+ layer: "performance"
1200
+ },
1201
+ {
1202
+ id: "low-end",
1203
+ title: "Low-end device",
1204
+ steps: "Run the automated set on the slowest supported device.",
1205
+ expect: "All pass; performance may land on the low tier.",
1206
+ mode: "manual",
1207
+ layer: "performance"
1208
+ }
1209
+ ], Rt = (e) => j.find((t) => t.id === e) ?? nt.find((t) => t.id === e), I = (e, t) => {
1210
+ const a = e.match(t);
1211
+ return a ? a[1] : "";
1212
+ }, st = (e) => {
1213
+ const t = /iPhone|iPad|iPod/.test(e) || /Macintosh/.test(e) && /Mobile/.test(e), a = /Android/.test(e);
1214
+ let r = { name: "unknown", version: "" };
1215
+ /Edg\//.test(e) ? r = { name: "Edge", version: I(e, /Edg\/(\d+)/) } : /OPR\//.test(e) ? r = { name: "Opera", version: I(e, /OPR\/(\d+)/) } : /SamsungBrowser\//.test(e) ? r = { name: "Samsung Internet", version: I(e, /SamsungBrowser\/(\d+)/) } : /CriOS\//.test(e) ? r = { name: "Chrome iOS", version: I(e, /CriOS\/(\d+)/) } : /FxiOS\//.test(e) ? r = { name: "Firefox iOS", version: I(e, /FxiOS\/(\d+)/) } : /Firefox\//.test(e) ? r = { name: "Firefox", version: I(e, /Firefox\/(\d+)/) } : /Chrome\//.test(e) ? r = { name: "Chrome", version: I(e, /Chrome\/(\d+)/) } : /Safari\//.test(e) && (r = { name: "Safari", version: I(e, /Version\/(\d+)/) });
1216
+ let n = { name: "unknown", version: "" };
1217
+ return t ? n = { name: "iOS", version: I(e, /OS (\d+[._]\d+)/).replace("_", ".") } : a ? n = { name: "Android", version: I(e, /Android (\d+(?:\.\d+)?)/) } : /Mac OS X/.test(e) ? n = { name: "macOS", version: I(e, /Mac OS X (\d+[._]\d+)/).replace("_", ".") } : /Windows NT/.test(e) ? n = { name: "Windows", version: I(e, /Windows NT (\d+\.\d+)/) } : /Linux/.test(e) && (n = { name: "Linux", version: "" }), { browser: r, os: n, mobile: t || a || /Mobile/.test(e) };
1218
+ }, it = () => {
1219
+ var r, n;
1220
+ const e = typeof navigator < "u" ? navigator : void 0, t = (e == null ? void 0 : e.userAgent) ?? "", a = st(t);
1221
+ return {
1222
+ userAgent: t,
1223
+ platform: (e == null ? void 0 : e.platform) ?? "",
1224
+ ...a,
1225
+ screen: typeof window < "u" ? {
1226
+ width: ((r = window.screen) == null ? void 0 : r.width) ?? 0,
1227
+ height: ((n = window.screen) == null ? void 0 : n.height) ?? 0,
1228
+ dpr: window.devicePixelRatio || 1
1229
+ } : { width: 0, height: 0, dpr: 1 },
1230
+ deviceMemoryGb: typeof (e == null ? void 0 : e.deviceMemory) == "number" ? e.deviceMemory : null,
1231
+ hardwareConcurrency: typeof (e == null ? void 0 : e.hardwareConcurrency) == "number" ? e.hardwareConcurrency : null,
1232
+ secureContext: typeof window < "u" ? !!window.isSecureContext : !1,
1233
+ videoCaptureStream: typeof HTMLVideoElement < "u" && ("captureStream" in HTMLVideoElement.prototype || "mozCaptureStream" in HTMLVideoElement.prototype),
1234
+ touch: typeof navigator < "u" && (navigator.maxTouchPoints ?? 0) > 0
1235
+ };
1236
+ }, ot = [D.FACE_TRACKER, D.HAND_TRACKER, D.BODY_TRACKER], se = "__xr_compat__", ce = (e) => new Promise((t) => setTimeout(t, e)), L = async (e, t, a = 50) => {
1237
+ const r = Date.now() + t;
1238
+ for (; Date.now() < r; ) {
1239
+ if (e()) return !0;
1240
+ await ce(a);
1241
+ }
1242
+ return e();
1243
+ }, lt = (e, t) => e ? /^(camera-|no-camera|webgl-|offscreen-canvas-|wasm-)/.test(e) ? "capability" : /^model-/.test(e) ? "model" : /^(lifecycle|timeout:lifecycle|feed-stalled|start-)/.test(e) ? "lifecycle" : /^(fps|inference|frame)/.test(e) ? "performance" : t : t, ct = (e) => {
1244
+ const t = {
1245
+ pass: 0,
1246
+ fail: 0,
1247
+ skip: 0,
1248
+ causes: { capability: 0, model: 0, lifecycle: 0, performance: 0, unknown: 0 }
1249
+ };
1250
+ for (const a of e)
1251
+ t[a.status] += 1, a.status === "fail" && (t.causes[a.cause ?? "unknown"] += 1);
1252
+ return t;
1253
+ }, dt = (e, t, a = {}) => ({
1254
+ version: 1,
1255
+ sdkVersion: a.sdkVersion ?? "dev",
1256
+ checkedAt: (/* @__PURE__ */ new Date()).toISOString(),
1257
+ label: a.label ?? "",
1258
+ environment: it(),
1259
+ capabilities: t,
1260
+ results: e,
1261
+ summary: ct(e)
1262
+ }), Ct = async (e, t = {}) => {
1263
+ var h;
1264
+ const a = t.timeoutMs ?? 2e4, r = t.models ?? ot, n = new Set(
1265
+ t.scenarios ?? j.map((s) => s.id)
1266
+ ), c = [];
1267
+ let u = null, d = !1;
1268
+ const i = (s, p, g, o) => {
1269
+ var m;
1270
+ const l = {
1271
+ id: s,
1272
+ status: o.status,
1273
+ cause: o.status === "fail" ? lt(o.code ?? null, p) : null,
1274
+ // Codes describe failures; a pass carries none.
1275
+ code: o.status === "fail" ? o.code ?? null : null,
1276
+ detail: o.detail,
1277
+ durationMs: Math.round(performance.now() - g)
1278
+ };
1279
+ c.push(l), (m = t.onResult) == null || m.call(t, l);
1280
+ }, f = async () => {
1281
+ t.stream ? await e.setMediaSource({
1282
+ source: ee.STREAM,
1283
+ stream: t.stream,
1284
+ sourceKind: "video"
1285
+ }) : await e.setMediaSource({ source: ee.WEBCAM }), await e.start();
1286
+ };
1287
+ try {
1288
+ for (const s of j) {
1289
+ if (!n.has(s.id)) continue;
1290
+ const p = performance.now();
1291
+ try {
1292
+ const g = s.id;
1293
+ switch (g) {
1294
+ case "capabilities": {
1295
+ u = await ye({
1296
+ models: r,
1297
+ timeoutMs: Math.min(a, 8e3)
1298
+ });
1299
+ const o = r.map((m) => we(u, m)).filter((m) => !m.supported && m.reason).map((m) => m.reason.code), l = Array.from(new Set(o));
1300
+ i(s.id, s.layer, p, {
1301
+ status: l.length ? "fail" : "pass",
1302
+ code: l[0] ?? null,
1303
+ detail: l.length ? `blocked: ${l.join(", ")}` : `webgl${u.rendering.webglVersion}, camera ${u.camera.status}`
1304
+ });
1305
+ break;
1306
+ }
1307
+ case "session-start": {
1308
+ await f();
1309
+ const o = await L(
1310
+ () => e.store.getSnapshot().lifecycle === "running",
1311
+ a
1312
+ ), l = e.store.getSnapshot().feedFrames, m = o && await L(() => e.store.getSnapshot().feedFrames > l, a);
1313
+ d = o && m;
1314
+ const w = e.store.getSnapshot().error;
1315
+ i(s.id, s.layer, p, {
1316
+ status: d ? "pass" : "fail",
1317
+ code: w ? w.reason : o ? "feed-stalled" : "timeout:lifecycle",
1318
+ detail: d ? `running on ${e.store.getSnapshot().sourceKind}` : w ? w.message : o ? "running but no feed frames advanced" : `lifecycle ${e.store.getSnapshot().lifecycle}`
1319
+ });
1320
+ break;
1321
+ }
1322
+ case "model-ready": {
1323
+ if (!d) {
1324
+ i(s.id, s.layer, p, {
1325
+ status: "skip",
1326
+ detail: "session did not start"
1327
+ });
1328
+ break;
1329
+ }
1330
+ const o = [];
1331
+ await Promise.all(
1332
+ r.map(async (l) => {
1333
+ try {
1334
+ await e.registry.acquire(l, se), await L(
1335
+ () => e.store.getSnapshot().pipeline.has(l),
1336
+ a
1337
+ ) || o.push(`${l}: timeout`);
1338
+ } catch (m) {
1339
+ o.push(`${l}: ${ge(m).code}`);
1340
+ }
1341
+ })
1342
+ ), i(s.id, s.layer, p, {
1343
+ status: o.length ? "fail" : "pass",
1344
+ code: o.length ? o[0].split(": ")[1] === "timeout" ? "model-init-failed" : o[0].split(": ")[1] : null,
1345
+ detail: o.length ? o.join("; ") : `${r.length} models ready`
1346
+ });
1347
+ break;
1348
+ }
1349
+ case "model-detects": {
1350
+ if (!d) {
1351
+ i(s.id, s.layer, p, {
1352
+ status: "skip",
1353
+ detail: "session did not start"
1354
+ });
1355
+ break;
1356
+ }
1357
+ const o = await L(
1358
+ () => $(e, r, null).models.every((R) => R.state !== "ready" || R.inferences > 0),
1359
+ Math.min(a, 8e3)
1360
+ ), l = $(e, r, null), m = l.models.filter((S) => S.state === "ready" && S.inferences === 0).map((S) => S.label), w = l.models.filter((S) => S.state === "error").map((S) => {
1361
+ var R;
1362
+ return `${S.label}: ${((R = S.error) == null ? void 0 : R.message) ?? "error"}`;
1363
+ });
1364
+ i(s.id, s.layer, p, {
1365
+ status: o && !w.length ? "pass" : "fail",
1366
+ code: w.length ? "model-init-failed" : m.length ? "model-idle" : null,
1367
+ detail: w.length ? w.join("; ") : m.length ? `no inference from ${m.join(", ")}` : l.models.map((S) => `${S.label} ${S.inferences} run · ${S.detections ?? "–"} det`).join(", ")
1368
+ });
1369
+ break;
1370
+ }
1371
+ case "pause-resume": {
1372
+ if (!d) {
1373
+ i(s.id, s.layer, p, {
1374
+ status: "skip",
1375
+ detail: "session did not start"
1376
+ });
1377
+ break;
1378
+ }
1379
+ e.pause();
1380
+ const o = e.store.getSnapshot().lifecycle === "paused";
1381
+ await e.resume();
1382
+ const l = await L(
1383
+ () => e.store.getSnapshot().lifecycle === "running",
1384
+ a
1385
+ ), m = e.store.getSnapshot().feedFrames, w = l && await L(() => e.store.getSnapshot().feedFrames > m, a);
1386
+ i(s.id, s.layer, p, {
1387
+ status: o && l && w ? "pass" : "fail",
1388
+ code: o ? l ? "feed-stalled" : "lifecycle:resume" : "lifecycle:pause",
1389
+ detail: o && l && w ? "paused → running, feed advanced" : `paused=${o} resumed=${l} advanced=${w}`
1390
+ });
1391
+ break;
1392
+ }
1393
+ case "stop-start": {
1394
+ if (!d) {
1395
+ i(s.id, s.layer, p, {
1396
+ status: "skip",
1397
+ detail: "session did not start"
1398
+ });
1399
+ break;
1400
+ }
1401
+ await e.stop();
1402
+ const o = e.store.getSnapshot().lifecycle === "stopped";
1403
+ await f();
1404
+ const l = await L(
1405
+ () => e.store.getSnapshot().lifecycle === "running",
1406
+ a
1407
+ );
1408
+ i(s.id, s.layer, p, {
1409
+ status: o && l ? "pass" : "fail",
1410
+ code: o ? "lifecycle:restart" : "lifecycle:stop",
1411
+ detail: o && l ? "stopped → running" : `stopped=${o} running=${l}`
1412
+ });
1413
+ break;
1414
+ }
1415
+ case "performance": {
1416
+ if (!d) {
1417
+ i(s.id, s.layer, p, {
1418
+ status: "skip",
1419
+ detail: "session did not start"
1420
+ });
1421
+ break;
1422
+ }
1423
+ const o = t.performanceWindowMs ?? 3e3;
1424
+ let l = 0, m = 0;
1425
+ const w = () => {
1426
+ l += 1, m = requestAnimationFrame(w);
1427
+ };
1428
+ m = requestAnimationFrame(w);
1429
+ const S = $(e, r, null);
1430
+ await ce(o), cancelAnimationFrame(m);
1431
+ const R = $(e, r, {
1432
+ feedFrames: S.session.feedFrames,
1433
+ sampledAt: S.sampledAt
1434
+ }), x = l * 1e3 / o, E = R.inferenceMsTotal, v = x >= 20 && E <= 50;
1435
+ i(s.id, s.layer, p, {
1436
+ status: v ? "pass" : "fail",
1437
+ code: x < 20 ? "fps-low" : E > 50 ? "inference-high" : null,
1438
+ detail: `${x.toFixed(0)} fps · feed ${R.session.feedFps.toFixed(0)} fps · inference ${E.toFixed(1)} ms`
1439
+ });
1440
+ break;
1441
+ }
1442
+ default:
1443
+ i(g, s.layer, p, { status: "skip", detail: "no runner" });
1444
+ }
1445
+ } catch (g) {
1446
+ const o = g instanceof Error ? g.message : String(g), l = (h = e.store.getSnapshot().error) == null ? void 0 : h.reason;
1447
+ i(s.id, s.layer, p, {
1448
+ status: "fail",
1449
+ code: l ? be(l).code : null,
1450
+ detail: l ? `${o} (${l})` : o
1451
+ });
1452
+ }
1453
+ }
1454
+ } finally {
1455
+ for (const s of r) e.registry.release(s, se);
1456
+ t.keepSessionRunning || await e.stop().catch(() => {
1457
+ });
1090
1458
  }
1091
- ), ot = (e) => {
1092
- const [t, n] = C(null);
1093
- return z(() => {
1459
+ return dt(c, u, t);
1460
+ }, Et = (e) => {
1461
+ const [t, a] = M(null);
1462
+ return A(() => {
1094
1463
  let r = 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) {
1100
- n(null);
1464
+ const n = () => {
1465
+ var i, f;
1466
+ r = requestAnimationFrame(n);
1467
+ const c = (f = (i = e == null ? void 0 : e.detectionResults) == null ? void 0 : i.faceLandmarks) == null ? void 0 : f[0];
1468
+ if (!c || c.length === 0) {
1469
+ a(null);
1101
1470
  return;
1102
1471
  }
1103
- const a = fe(o), s = {
1104
- left: a.minX,
1105
- top: a.minY,
1106
- width: a.width,
1107
- height: a.height
1472
+ const u = Me(c), d = {
1473
+ left: u.minX,
1474
+ top: u.minY,
1475
+ width: u.width,
1476
+ height: u.height
1108
1477
  };
1109
- n((c) => c && c.left === s.left && c.top === s.top && c.width === s.width && c.height === s.height ? c : s);
1478
+ a((h) => h && h.left === d.left && h.top === d.top && h.width === d.width && h.height === d.height ? h : d);
1110
1479
  };
1111
- return i(), () => {
1480
+ return n(), () => {
1112
1481
  cancelAnimationFrame(r);
1113
1482
  };
1114
1483
  }, [e]), t;
1115
- }, it = ({
1484
+ }, Mt = ({
1116
1485
  background: e = "#000",
1117
1486
  children: t,
1118
- style: n
1119
- }) => /* @__PURE__ */ g(
1487
+ style: a
1488
+ }) => /* @__PURE__ */ b(
1120
1489
  "div",
1121
1490
  {
1122
1491
  style: {
@@ -1124,68 +1493,150 @@ const rt = Ue(({
1124
1493
  inset: 0,
1125
1494
  overflow: "hidden",
1126
1495
  background: e,
1127
- ...n
1496
+ ...a
1128
1497
  },
1129
1498
  children: t
1130
1499
  }
1131
- ), at = (e) => {
1132
- const { makeDefault: t = !0, ...n } = e;
1133
- return /* @__PURE__ */ g(
1134
- pe,
1500
+ ), kt = (e) => {
1501
+ const { makeDefault: t = !0, ...a } = e;
1502
+ return /* @__PURE__ */ b(
1503
+ ke,
1135
1504
  {
1136
1505
  position: [0, 0, 40],
1137
1506
  fov: 30,
1138
1507
  near: 0.1,
1139
1508
  far: 1e3,
1140
1509
  makeDefault: t,
1141
- ...n
1510
+ ...a
1142
1511
  }
1143
1512
  );
1144
- }, st = ["fill", "contain"];
1513
+ }, Tt = ["fill", "contain"];
1145
1514
  export {
1146
- zt as BasicAnimatedTextureController,
1147
- nt as BoundingBoxOverlay,
1148
- ct as HeadTracker,
1149
- Xt as MAX_GIF_BYTES,
1150
- kt as MAX_GIF_FRAMES,
1151
- At as MAX_GIF_PIXELS,
1152
- at as PerspectiveCamera,
1153
- yt as ScreenRectAspectContext,
1154
- st as TEXTURE_FITS,
1155
- Lt as TextureSourceLoadError,
1156
- it as XRCompositor,
1515
+ Hr as BasicAnimatedTextureController,
1516
+ xt as BoundingBoxOverlay,
1517
+ j as COMPAT_SCENARIOS,
1518
+ At as EMPTY_QUALITY_SIGNALS,
1519
+ ua as FACE_REGION_POLYGONS,
1520
+ kr as HAND_JOINTS,
1521
+ Jt as HeadTracker,
1522
+ ma as IRIS_FULL_OPENNESS,
1523
+ fa as IrisLead,
1524
+ nt as MANUAL_COMPAT_SCENARIOS,
1525
+ qr as MAX_GIF_BYTES,
1526
+ Gr as MAX_GIF_FRAMES,
1527
+ Ur as MAX_GIF_PIXELS,
1528
+ pa as MAX_OVERLAY_LABELS,
1529
+ Tr as OscillationTracker,
1530
+ Ir as POSE_JOINTS,
1531
+ kt as PerspectiveCamera,
1532
+ ha as SEGMENTATION_OVERLAY_FRAGMENT_SHADER,
1533
+ ga as SEGMENTATION_OVERLAY_VERTEX_SHADER,
1534
+ vr as ScreenRectAspectContext,
1535
+ Tt as TEXTURE_FITS,
1536
+ jr as TextureSourceLoadError,
1537
+ Mt as XRCompositor,
1157
1538
  B as XRLayer,
1158
- xe as XRMediaSurface,
1159
- tt as XRTrackingOverlay,
1160
- rt as XRViewport,
1161
- fe as computeLandmarkBounds,
1162
- Vt as computeScreenTransform,
1163
- xt as createFaceInfoTarget,
1164
- Dt as createTextureSourceResolver,
1165
- Bt as disposeResolvedTextureSource,
1166
- vt as getFaceInfo,
1167
- _t as getPlaybackFrame,
1168
- Wt as getSequenceFrame,
1169
- Ct as getThreeBlending,
1170
- Rt as getThreeDepthFunction,
1171
- It as getThreeSide,
1172
- Ht as gifTextureSourceProvider,
1173
- Mt as hasFullUnitUVBounds,
1174
- Te as resolveCalibrationFaceDisplayMirrored,
1175
- Pt as resolveTextureSource,
1176
- $t as throwIfAborted,
1177
- Xe as useCalibrationFaceTracker,
1178
- ot as useFaceBoundingBox,
1179
- Et as useScreenSpace,
1180
- ut as useTrackerContext,
1181
- mt as useXRCameraTexture,
1182
- O as useXRContext,
1183
- ft as useXRError,
1184
- le as useXRModel,
1185
- de as useXRModelNode,
1186
- pt as useXRPipelineSnapshot,
1187
- gt as useXRReady,
1188
- bt as useXRRenderSize,
1189
- qt as useXRViewportRenderOutputs,
1190
- Ut as useXRViewportState
1539
+ Ae as XRMediaSurface,
1540
+ St as XRTrackingOverlay,
1541
+ vt as XRViewport,
1542
+ Lt as XR_MODEL_LABELS,
1543
+ _t as classifyCameraFailure,
1544
+ lt as classifyCompatCause,
1545
+ ya as computeIrisEye,
1546
+ Me as computeLandmarkBounds,
1547
+ wa as computeMaskUvTransform,
1548
+ Kr as computeScreenTransform,
1549
+ dt as createCompatReport,
1550
+ wr as createFaceInfoTarget,
1551
+ ia as createGestureDetectorState,
1552
+ ba as createIrisEye,
1553
+ Sa as createIrisResult,
1554
+ Xt as createQualityState,
1555
+ va as createSegmentationOverlayMaterial,
1556
+ xa as createSemanticMaskTexture,
1557
+ Qr as createTextureSourceResolver,
1558
+ it as describeCompatEnvironment,
1559
+ Yr as disposeResolvedTextureSource,
1560
+ Ot as fillLandmarkPolygon,
1561
+ zt as fillPolygon,
1562
+ Rt as findCompatScenario,
1563
+ Fr as fingerExtensions,
1564
+ oa as gestureStatesEqual,
1565
+ br as getFaceInfo,
1566
+ Jr as getPlaybackFrame,
1567
+ Zr as getSequenceFrame,
1568
+ xr as getThreeBlending,
1569
+ Rr as getThreeDepthFunction,
1570
+ Cr as getThreeSide,
1571
+ ea as gifTextureSourceProvider,
1572
+ Nr as hasFullUnitUVBounds,
1573
+ Dt as judgeSample,
1574
+ Pt as lockQuality,
1575
+ Vt as mapDomExceptionToReason,
1576
+ ge as mapModelErrorToReason,
1577
+ Ar as measureArmRaise,
1578
+ Lr as measureFingerPattern,
1579
+ _r as measureGrab,
1580
+ Xr as measureHandHeight,
1581
+ Or as measureOpenPalm,
1582
+ zr as measurePinch,
1583
+ Dr as measureTPose,
1584
+ Pr as measureThumb,
1585
+ st as parseUserAgent,
1586
+ $t as permissionStateToStatus,
1587
+ Ra as rasterizeFaceRegions,
1588
+ Bt as readDeviceSignals,
1589
+ Nt as resetQuality,
1590
+ Ca as resolveActiveOverlayLabelIndices,
1591
+ Be as resolveCalibrationFaceDisplayMirrored,
1592
+ Wt as resolveInitialTierIndex,
1593
+ Ea as resolveMaskSize,
1594
+ Ma as resolveOverlayLabelIndices,
1595
+ Ht as resolvePerformanceBudget,
1596
+ qt as resolveQualityTier,
1597
+ ta as resolveTextureSource,
1598
+ Ct as runCompatChecks,
1599
+ $ as sampleXRDiagnostics,
1600
+ Gt as semanticMaskLabelIndex,
1601
+ be as sessionReasonToFallback,
1602
+ Ut as setQualityTier,
1603
+ la as snapshotGestureState,
1604
+ ca as stepGestureDetector,
1605
+ jt as stepQualityController,
1606
+ ct as summarizeCompatResults,
1607
+ ra as throwIfAborted,
1608
+ Vr as thumbDirection,
1609
+ $r as thumbExtension,
1610
+ Kt as tierToApply,
1611
+ ka as updateIrisResult,
1612
+ Ta as updateSegmentationOverlayMaterial,
1613
+ Ia as uploadSemanticMask,
1614
+ We as useCalibrationFaceTracker,
1615
+ Et as useFaceBoundingBox,
1616
+ Er as useScreenSpace,
1617
+ Fa as useSegmentationOverlayMaterial,
1618
+ Aa as useSemanticMaskTexture,
1619
+ Zt as useTrackerContext,
1620
+ tr as useXRCameraDeviceId,
1621
+ rr as useXRCameraFacing,
1622
+ ar as useXRCameraTexture,
1623
+ ie as useXRContext,
1624
+ Qt as useXRDiagnostics,
1625
+ nr as useXRError,
1626
+ sr as useXRFeedCrop,
1627
+ ir as useXRLifecycle,
1628
+ or as useXRMirrored,
1629
+ Se as useXRModel,
1630
+ lr as useXRModelErrors,
1631
+ ve as useXRModelNode,
1632
+ cr as useXROrientation,
1633
+ dr as useXRPipelineSnapshot,
1634
+ ur as useXRQualityConfig,
1635
+ mr as useXRQualityState,
1636
+ fr as useXRReady,
1637
+ pr as useXRRenderSize,
1638
+ hr as useXRSessionCameraPermission,
1639
+ gr as useXRTrackerStatus,
1640
+ aa as useXRViewportRenderOutputs,
1641
+ na as useXRViewportState
1191
1642
  };