@vincentt-xr/sdk 2.0.0-alpha.7 → 2.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GROUNDING.md +5651 -82
- package/README.md +1 -0
- package/dist/CanonicalHeadFrame-BHcWyaiK.js +1506 -0
- package/dist/CanonicalHeadFrame-D-_T1OMU.cjs +1 -0
- package/dist/DebuggerUI-7ngnJsBe.js +275 -0
- package/dist/DebuggerUI-CoglgKdO.cjs +1 -0
- package/dist/FaceRetouch-CLoTfrcs.js +1071 -0
- package/dist/FaceRetouch-J1lC1WbS.cjs +134 -0
- package/dist/FaceSurface-CHAMEeG1.cjs +1 -0
- package/dist/FaceSurface-DmP9AEeC.js +27 -0
- package/dist/SegmentationOverlay-D_FWkcyP.cjs +35 -0
- package/dist/SegmentationOverlay-vn5x_knv.js +6237 -0
- package/dist/SkeletonUtils-C2r90MtN.js +21 -0
- package/dist/SkeletonUtils-CddIup1F.cjs +1 -0
- package/dist/TextLabel-XE0rQSDn.cjs +2 -0
- package/dist/TextLabel-c9BCucOI.js +961 -0
- package/dist/assets/cache.d.ts +99 -0
- package/dist/assets/estimate.d.ts +11 -0
- package/dist/assets/gltfLoader.d.ts +16 -0
- package/dist/assets/index.d.ts +7 -0
- package/dist/assets/loaders.d.ts +43 -0
- package/dist/assets/react.d.ts +33 -0
- package/dist/body-pose/index.d.ts +521 -0
- package/dist/body-trigger/__fixtures__/syntheticBody.d.ts +83 -0
- package/dist/body-trigger/frame.d.ts +88 -0
- package/dist/body-trigger/index.d.ts +6 -0
- package/dist/body-trigger/moves.d.ts +235 -0
- package/dist/body-trigger/trigger.d.ts +75 -0
- package/dist/calibration/calibration.d.ts +75 -0
- package/dist/calibration/index.d.ts +6 -0
- package/dist/calibration/storage.d.ts +13 -0
- package/dist/calibration/types.d.ts +53 -0
- package/dist/calibration/useXRCalibration.d.ts +46 -0
- package/dist/camera/CameraPermissionGate.d.ts +26 -0
- package/dist/camera/devices.d.ts +26 -0
- package/dist/camera/index.d.ts +8 -0
- package/dist/camera/permission.d.ts +86 -0
- package/dist/camera/useCameraPermission.d.ts +35 -0
- package/dist/canonicalFace-BHwyCx1c.js +9 -0
- package/dist/canonicalFace-C83I225R.cjs +1 -0
- package/dist/capabilities/detect.d.ts +45 -0
- package/dist/capabilities/index.d.ts +5 -0
- package/dist/capabilities/types.d.ts +120 -0
- package/dist/capabilities/useXRCapabilities.d.ts +18 -0
- package/dist/compat/environment.d.ts +5 -0
- package/dist/compat/index.d.ts +4 -0
- package/dist/compat/run.d.ts +18 -0
- package/dist/compat/scenarios.d.ts +10 -0
- package/dist/compat/types.d.ts +101 -0
- package/dist/components/BodyInstruction/BodyPoseHint.d.ts +63 -0
- package/dist/components/BodyInstruction/index.d.ts +69 -0
- package/dist/components/BodyInstruction/useBodyPose.d.ts +23 -0
- package/dist/components/BodyTracker/index.d.ts +17 -0
- package/dist/components/BodyTrigger/index.d.ts +49 -0
- package/dist/components/Debugger/DebuggerProvider.d.ts +14 -1
- package/dist/components/Debugger/DebuggerUI.d.ts +3 -1
- package/dist/components/FaceAtlas/FaceAtlasLayer.d.ts +114 -0
- package/dist/components/FaceAtlas/MadeUpCamera.d.ts +80 -0
- package/dist/components/FaceAtlas/constants.d.ts +8 -0
- package/dist/components/FaceAtlas/index.d.ts +7 -0
- package/dist/components/FaceAtlas/useFaceAtlasSurface.d.ts +84 -0
- package/dist/components/FaceAtlas/useFaceSkin.d.ts +84 -0
- package/dist/components/FaceCharacter/ExternalFaceMesh.d.ts +109 -0
- package/dist/components/FaceCharacter/FaceExpressionController.d.ts +53 -0
- package/dist/components/FaceCharacter/FaceMorph.d.ts +71 -0
- package/dist/components/FaceCharacter/FacePiercing.d.ts +65 -0
- package/dist/components/FaceCharacter/FaceReprojection.d.ts +85 -0
- package/dist/components/FaceCharacter/FaceRig.d.ts +38 -0
- package/dist/components/FaceCharacter/FaceSurface.d.ts +49 -0
- package/dist/components/FaceCharacter/FaceSurfaceOccluder.d.ts +39 -0
- package/dist/components/FaceCharacter/PinToFaceMesh.d.ts +68 -0
- package/dist/components/FaceCharacter/index.d.ts +18 -0
- package/dist/components/FaceCharacter/useFaceReprojector.d.ts +10 -0
- package/dist/components/FaceInset/FaceInset.d.ts +68 -0
- package/dist/components/FaceInset/frame.d.ts +94 -0
- package/dist/components/FaceInset/index.d.ts +6 -0
- package/dist/components/FaceInset/material.d.ts +40 -0
- package/dist/components/FaceInset/useFaceInsetTexture.d.ts +37 -0
- package/dist/components/FaceInstruction/FaceExpressionHint.d.ts +43 -0
- package/dist/components/FaceInstruction/index.d.ts +56 -0
- package/dist/components/FaceInstruction/useFaceExpression.d.ts +20 -0
- package/dist/components/FaceLiquify/FaceLiquify.d.ts +49 -0
- package/dist/components/FaceLiquify/debug.d.ts +37 -0
- package/dist/components/FaceLiquify/frame.d.ts +55 -0
- package/dist/components/FaceLiquify/index.d.ts +10 -0
- package/dist/components/FaceLiquify/material.d.ts +39 -0
- package/dist/components/FaceLiquify/pass.d.ts +49 -0
- package/dist/components/FaceLiquify/presence.d.ts +25 -0
- package/dist/components/FaceLiquify/presets.d.ts +82 -0
- package/dist/components/FaceLiquify/selfTest.d.ts +66 -0
- package/dist/components/FaceLiquify/target.d.ts +85 -0
- package/dist/components/FaceLiquify/warp.d.ts +72 -0
- package/dist/components/FaceMesh/canonical/CanonicalFaceMeshRenderer.d.ts +37 -5
- package/dist/components/FaceMesh/canonical/geometryGroups.d.ts +21 -0
- package/dist/components/FaceMesh/canonical/parseCanonicalFaceModel.d.ts +21 -0
- package/dist/components/FaceMesh/canonical/shaders.d.ts +1 -1
- package/dist/components/FaceMesh/index.d.ts +2 -2
- package/dist/components/FaceRetouch/Background.d.ts +3 -1
- package/dist/components/FaceRetouch/FaceRetouch.d.ts +5 -0
- package/dist/components/FaceRetouch/renderState.d.ts +19 -0
- package/dist/components/FaceSwap/FaceMirror.d.ts +46 -0
- package/dist/components/FaceSwap/FaceSwap.d.ts +58 -0
- package/dist/components/FaceSwap/FaceTextureLayer.d.ts +72 -0
- package/dist/components/FaceSwap/faceSwapPlan.d.ts +91 -0
- package/dist/components/FaceSwap/index.d.ts +13 -0
- package/dist/components/FaceSwap/settings.d.ts +300 -0
- package/dist/components/FaceSwap/useFaceTexture.d.ts +35 -0
- package/dist/components/FaceSwap/useLiveFace.d.ts +38 -0
- package/dist/components/FaceSwap/useLiveFaceTexture.d.ts +31 -0
- package/dist/components/FaceWarp3D/FaceWarp3D.d.ts +50 -0
- package/dist/components/FaceWarp3D/index.d.ts +2 -3
- package/dist/components/Faceless/Faceless.d.ts +51 -0
- package/dist/components/Faceless/index.d.ts +2 -0
- package/dist/components/GestureListener/index.d.ts +11 -0
- package/dist/components/HairLock/HairLock.d.ts +39 -0
- package/dist/components/HairLock/index.d.ts +2 -0
- package/dist/components/HairLock/lockGeometry.d.ts +15 -0
- package/dist/components/HandCutout/index.d.ts +35 -0
- package/dist/components/HandInstruction/HandGestureHint.d.ts +70 -0
- package/dist/components/HandInstruction/index.d.ts +74 -0
- package/dist/components/HandInstruction/useHandGesture.d.ts +22 -0
- package/dist/components/HandRig/ForearmOccluder.d.ts +29 -0
- package/dist/components/HandRig/HandAttachment.d.ts +34 -0
- package/dist/components/HandRig/HandOccluder.d.ts +55 -0
- package/dist/components/HandRig/HandTattoo.d.ts +61 -0
- package/dist/components/HandRig/WristAttachment.d.ts +34 -0
- package/dist/components/HandRig/index.d.ts +101 -0
- package/dist/components/HandRig/useArmMask.d.ts +29 -0
- package/dist/components/HandRig/wristSolve.d.ts +69 -0
- package/dist/components/HandTouch/HandTouch.d.ts +62 -0
- package/dist/components/HandTouch/Touchable.d.ts +36 -0
- package/dist/components/HandTouch/index.d.ts +2 -0
- package/dist/components/HandTracker/index.d.ts +10 -0
- package/dist/components/HeadBinding/index.d.ts +14 -0
- package/dist/components/HeadOccluder/CanonicalHeadFrame.d.ts +22 -0
- package/dist/components/HeadOccluder/Earrings.d.ts +55 -0
- package/dist/components/HeadOccluder/HeadAttachment.d.ts +38 -0
- package/dist/components/HeadOccluder/NeckOccluder.d.ts +64 -0
- package/dist/components/HeadOccluder/earringPlacement.d.ts +31 -0
- package/dist/components/HeadOccluder/headAttachmentPoints.d.ts +69 -0
- package/dist/components/HeadOccluder/index.d.ts +57 -3
- package/dist/components/HeadOccluder/useCanonicalHeadFit.d.ts +36 -0
- package/dist/components/HeadOccluder/useLandmarkPoseFit.d.ts +80 -0
- package/dist/components/HolisticTracker/index.d.ts +69 -0
- package/dist/components/HolisticTracker/settings.d.ts +58 -0
- package/dist/components/HolisticTracker/signals.d.ts +49 -0
- package/dist/components/Instruction/HintStage.d.ts +29 -0
- package/dist/components/Instruction/InstructionCue.d.ts +126 -0
- package/dist/components/Instruction/gestureHold.d.ts +20 -0
- package/dist/components/Instruction/ghost.d.ts +129 -0
- package/dist/components/Instruction/hintBlend.d.ts +19 -0
- package/dist/components/Instruction/hintLook.d.ts +81 -0
- package/dist/components/Instruction/hintLoop.d.ts +36 -0
- package/dist/components/Instruction/index.d.ts +41 -0
- package/dist/components/Instruction/useGhostModel.d.ts +33 -0
- package/dist/components/Instruction/useInstructionHold.d.ts +72 -0
- package/dist/components/IrisEffect/IrisMaterial.d.ts +73 -0
- package/dist/components/IrisEffect/index.d.ts +51 -0
- package/dist/components/IrisEffect/settings.d.ts +117 -0
- package/dist/components/LipEffect/LipEffect.d.ts +27 -1
- package/dist/components/LipEffect/LipEffectMaterial.d.ts +95 -7
- package/dist/components/LipEffect/LipEffects.d.ts +12 -0
- package/dist/components/LipEffect/defaults.d.ts +46 -4
- package/dist/components/LipEffect/index.d.ts +11 -3
- package/dist/components/LipEffect/lipShading.d.ts +73 -0
- package/dist/components/LipEffect/settings.d.ts +375 -0
- package/dist/components/LipEffect/shader.d.ts +39 -0
- package/dist/components/LipEffect/types.d.ts +128 -9
- package/dist/components/LipEffect/useLipDesignTextures.d.ts +17 -0
- package/dist/components/LipEffect/uvGuide.d.ts +74 -0
- package/dist/components/Makeup/Blush.d.ts +18 -0
- package/dist/components/Makeup/Brows.d.ts +20 -0
- package/dist/components/Makeup/Contour.d.ts +17 -0
- package/dist/components/Makeup/Eyeliner.d.ts +20 -0
- package/dist/components/Makeup/Eyeshadow.d.ts +20 -0
- package/dist/components/Makeup/Highlighter.d.ts +18 -0
- package/dist/components/Makeup/MakeupDesign.d.ts +37 -0
- package/dist/components/Makeup/MakeupRegion.d.ts +132 -0
- package/dist/components/Makeup/constants.d.ts +44 -0
- package/dist/components/Makeup/design.d.ts +106 -0
- package/dist/components/Makeup/designSamples.d.ts +42 -0
- package/dist/components/Makeup/eyes.d.ts +114 -0
- package/dist/components/Makeup/fields.d.ts +10 -0
- package/dist/components/Makeup/geometry.d.ts +106 -0
- package/dist/components/Makeup/index.d.ts +26 -0
- package/dist/components/Makeup/looks.d.ts +28 -0
- package/dist/components/Makeup/material.d.ts +239 -0
- package/dist/components/Makeup/settings.d.ts +54 -0
- package/dist/components/Makeup/shades.d.ts +143 -0
- package/dist/components/Makeup/shapes.d.ts +27 -0
- package/dist/components/Makeup/skinTone.d.ts +135 -0
- package/dist/components/Makeup/types.d.ts +110 -0
- package/dist/components/Makeup/useMakeupSkinTone.d.ts +40 -0
- package/dist/components/Necklace/Necklace.d.ts +44 -0
- package/dist/components/Necklace/index.d.ts +1 -0
- package/dist/components/ParticleEmitter/ParticleEmitter.d.ts +69 -0
- package/dist/components/ParticleEmitter/index.d.ts +1 -0
- package/dist/components/PersonCutout/index.d.ts +50 -0
- package/dist/components/PersonCutout/personCutout.d.ts +16 -0
- package/dist/components/ScreenImage/components/ScreenImageBody.d.ts +1 -1
- package/dist/components/ScreenImage/index.d.ts +3 -1
- package/dist/components/ScreenImage/materials/ScreenImageBlendMaterial.d.ts +1 -1
- package/dist/components/ScreenImage/materials/ScreenImageMaskMaterial.d.ts +11 -0
- package/dist/components/ScreenImage/source.d.ts +6 -0
- package/dist/components/ScreenImage/types.d.ts +18 -0
- package/dist/components/SegmentationOverlay/SegmentationOverlay.d.ts +37 -0
- package/dist/components/SegmentationOverlay/SegmentationOverlayMaterial.d.ts +31 -0
- package/dist/components/SegmentationOverlay/index.d.ts +9 -0
- package/dist/components/SegmentationOverlay/maskTexture.d.ts +23 -0
- package/dist/components/SegmentationOverlay/providers.d.ts +72 -0
- package/dist/components/SegmentationOverlay/settings.d.ts +65 -0
- package/dist/components/ShoulderOccluder/index.d.ts +43 -0
- package/dist/components/ShoulderOccluder/useCanonicalTorsoFit.d.ts +24 -0
- package/dist/components/SpringSwing/SpringSwing.d.ts +22 -0
- package/dist/components/SpringSwing/index.d.ts +1 -0
- package/dist/components/XRProvider/index.d.ts +16 -2
- package/dist/components/XRScene/renderOutputTarget.d.ts +12 -0
- package/dist/components/XRViewport/hooks/useViewportExternalFaces.d.ts +1 -1
- package/dist/components/XRViewport/hooks/useViewportMediaSource.d.ts +1 -1
- package/dist/components/XRViewport/hooks/useViewportPipeline.d.ts +1 -1
- package/dist/components/index.d.ts +11 -0
- package/dist/config/index.d.ts +0 -1
- package/dist/constants/index.d.ts +4 -1
- package/dist/context-DTxSQvp4.js +13 -0
- package/dist/context-hA0Rb2Xa.cjs +1 -0
- package/dist/contexts-BH7PdKFS.cjs +1 -0
- package/dist/contexts-jak8-tND.js +667 -0
- package/dist/coordinates/feed.d.ts +52 -0
- package/dist/coordinates/index.d.ts +7 -0
- package/dist/coordinates/side.d.ts +40 -0
- package/dist/coordinates/spaces.d.ts +49 -0
- package/dist/coordinates/viewport.d.ts +22 -0
- package/dist/coordinates/world.d.ts +15 -0
- package/dist/debug-ui/default-setting.cjs +2 -2
- package/dist/debug-ui/face-swap-settings/index.d.ts +22 -0
- package/dist/debug-ui/gesture-settings/index.d.ts +14 -0
- package/dist/debug-ui/hierarchy-panel/index.d.ts +3 -2
- package/dist/debug-ui/holistic-tracker-settings/index.d.ts +16 -0
- package/dist/debug-ui/index.d.ts +18 -3
- package/dist/debug-ui/iris-effect-settings/index.d.ts +12 -0
- package/dist/debug-ui/lip-effect-settings/index.d.ts +15 -0
- package/dist/debug-ui/media-source/index.d.ts +1 -1
- package/dist/debug-ui/media-source/session.d.ts +30 -2
- package/dist/debug-ui/media-source.cjs +1 -1
- package/dist/debug-ui/media-source.js +1 -1
- package/dist/debug-ui/object-inspector-panel/index.d.ts +3 -2
- package/dist/debug-ui/product-hotspots/index.d.ts +25 -0
- package/dist/debug-ui/scene-editor/hierarchy-panel.d.ts +3 -1
- package/dist/debug-ui/scene-editor/inspector-panel.d.ts +3 -1
- package/dist/debug-ui/screen-image-settings/index.d.ts +3 -1
- package/dist/debug-ui/screen-text-settings/ScreenTextSettingsPanel.d.ts +1 -1
- package/dist/debug-ui/screen-text-settings/types.d.ts +2 -0
- package/dist/debug-ui/segmentation-overlay-settings/index.d.ts +12 -0
- package/dist/debug-ui/settings-panel/index.d.ts +6 -1
- package/dist/debug-ui/shared/debugWindow.d.ts +51 -0
- package/dist/debug-ui/xr-diagnostics/index.d.ts +26 -0
- package/dist/debug-ui.cjs +3 -3
- package/dist/debug-ui.js +2695 -2547
- package/dist/detector-K8aej4MB.js +59 -0
- package/dist/detector-ijypGtse.cjs +1 -0
- package/dist/entries/all.d.ts +3 -1
- package/dist/entries/core.d.ts +20 -2
- package/dist/entries/face-effects.d.ts +123 -9
- package/dist/entries/instructions.d.ts +48 -0
- package/dist/entries/internal.d.ts +2 -1
- package/dist/entries/low-level.d.ts +49 -3
- package/dist/entries/particles.d.ts +11 -0
- package/dist/entries/product.d.ts +11 -0
- package/dist/entries/tracking.d.ts +60 -2
- package/dist/face-atlas/attributes.d.ts +30 -0
- package/dist/face-atlas/eyes.d.ts +272 -0
- package/dist/face-atlas/faceAtlas.generated.d.ts +46 -0
- package/dist/face-atlas/glsl/atlasVertex.d.ts +46 -0
- package/dist/face-atlas/glsl/common.d.ts +55 -0
- package/dist/face-atlas/glsl/design.d.ts +49 -0
- package/dist/face-atlas/glsl/eyes.d.ts +73 -0
- package/dist/face-atlas/glsl/finish.d.ts +24 -0
- package/dist/face-atlas/glsl/format.d.ts +4 -0
- package/dist/face-atlas/glsl/index.d.ts +59 -0
- package/dist/face-atlas/glsl/shading.d.ts +15 -0
- package/dist/face-atlas/glsl/shapes.d.ts +66 -0
- package/dist/face-atlas/glsl/sparkle.d.ts +19 -0
- package/dist/face-atlas/glsl/uniforms.d.ts +106 -0
- package/dist/face-atlas/guide.d.ts +51 -0
- package/dist/face-atlas/index.d.ts +25 -0
- package/dist/face-atlas/lead.d.ts +117 -0
- package/dist/face-atlas/madeUpCamera.d.ts +125 -0
- package/dist/face-atlas/masks.d.ts +53 -0
- package/dist/face-atlas/obj.d.ts +69 -0
- package/dist/face-atlas/polylines.d.ts +63 -0
- package/dist/face-atlas/probe/FaceSkinProbe.d.ts +208 -0
- package/dist/face-atlas/probe/__fixtures__/emulate.d.ts +9 -0
- package/dist/face-atlas/probe/__fixtures__/face.d.ts +24 -0
- package/dist/face-atlas/probe/constants.d.ts +137 -0
- package/dist/face-atlas/probe/glsl.d.ts +43 -0
- package/dist/face-atlas/probe/lightFit.d.ts +108 -0
- package/dist/face-atlas/probe/schedule.d.ts +44 -0
- package/dist/face-atlas/probe/selfTest.d.ts +87 -0
- package/dist/face-atlas/probe/stats.d.ts +143 -0
- package/dist/face-atlas/probe/targets.d.ts +70 -0
- package/dist/face-atlas/probe/unwrap.d.ts +76 -0
- package/dist/face-atlas/quality.d.ts +28 -0
- package/dist/face-atlas/regions.d.ts +31 -0
- package/dist/face-atlas/registry.d.ts +252 -0
- package/dist/face-atlas/renderState.d.ts +86 -0
- package/dist/face-atlas/selfOcclusion.d.ts +62 -0
- package/dist/face-atlas/shading.d.ts +406 -0
- package/dist/face-atlas/shapes.d.ts +86 -0
- package/dist/face-atlas/sides.d.ts +41 -0
- package/dist/face-atlas/skinMask.d.ts +35 -0
- package/dist/face-atlas/surface.d.ts +155 -0
- package/dist/face-atlas/topology.d.ts +44 -0
- package/dist/face-character/__fixtures__/faceImageDetections.d.ts +25 -0
- package/dist/face-character/__fixtures__/faceNode.d.ts +22 -0
- package/dist/face-character/bindFaceModel.d.ts +106 -0
- package/dist/face-character/canonicalFace.d.ts +17 -0
- package/dist/face-character/canonicalFaceGeometry.d.ts +11 -0
- package/dist/face-character/canonicalFacePositions.d.ts +7 -0
- package/dist/face-character/driveFaceModel.d.ts +57 -0
- package/dist/face-character/expressionOutputs.d.ts +45 -0
- package/dist/face-character/faceExpressions.d.ts +104 -0
- package/dist/face-character/faceImageLandmarker.d.ts +93 -0
- package/dist/face-character/faceMeshBinding.d.ts +62 -0
- package/dist/face-character/faceMorph.d.ts +77 -0
- package/dist/face-character/faceMorphs.d.ts +46 -0
- package/dist/face-character/facePhoto.d.ts +138 -0
- package/dist/face-character/facePiercings.d.ts +116 -0
- package/dist/face-character/facePin.d.ts +131 -0
- package/dist/face-character/faceReprojection.d.ts +273 -0
- package/dist/face-character/faceReprojector.d.ts +171 -0
- package/dist/face-character/faceRig.d.ts +176 -0
- package/dist/face-character/faceSwapPresence.d.ts +85 -0
- package/dist/face-character/faceTexture.d.ts +169 -0
- package/dist/face-character/faceTextureBaker.d.ts +86 -0
- package/dist/face-character/faceTextureGuide.d.ts +106 -0
- package/dist/face-character/faceTextureStats.d.ts +298 -0
- package/dist/face-character/faceTransfer.d.ts +396 -0
- package/dist/face-character/faceTransferGeometry.d.ts +109 -0
- package/dist/face-character/faceTransferSelfTest.d.ts +94 -0
- package/dist/face-character/faceWarp3D.d.ts +101 -0
- package/dist/face-character/faceless.d.ts +79 -0
- package/dist/face-character/featureWarp.d.ts +28 -0
- package/dist/face-character/liveFaceRegistry.d.ts +370 -0
- package/dist/face-character/liveValue.d.ts +12 -0
- package/dist/face-character/memo.d.ts +15 -0
- package/dist/face-effects.cjs +2324 -1
- package/dist/face-effects.js +14208 -2268
- package/dist/face-expression/index.d.ts +182 -0
- package/dist/face-info/landmarks.d.ts +17 -3
- package/dist/face-info/types.d.ts +20 -3
- package/dist/gestures/definitions.d.ts +98 -0
- package/dist/gestures/detector.d.ts +87 -0
- package/dist/gestures/index.d.ts +8 -0
- package/dist/gestures/measures.d.ts +114 -0
- package/dist/gestures/settings.d.ts +49 -0
- package/dist/getFaceInfo-B1otSDMX.cjs +1 -0
- package/dist/getFaceInfo-Cu4xDWiL.js +62 -0
- package/dist/hand/armFit.d.ts +46 -0
- package/dist/hand/armMask.d.ts +178 -0
- package/dist/hand/handCutout.d.ts +23 -0
- package/dist/hand/handCutoutRegistry.d.ts +7 -0
- package/dist/hand/handGestures.d.ts +524 -0
- package/dist/hand/handPose.d.ts +98 -0
- package/dist/hand/handRigSolver.d.ts +159 -0
- package/dist/hand/handTattoo.d.ts +81 -0
- package/dist/hand/handTouch.d.ts +240 -0
- package/dist/hand/wrist.d.ts +44 -0
- package/dist/hand/wristFilter.d.ts +44 -0
- package/dist/hooks/selectors.d.ts +76 -1
- package/dist/hooks/useCalibrationFaceTracker.d.ts +1 -1
- package/dist/hooks/useFaceInfo.d.ts +13 -1
- package/dist/hooks/useFaceInfos.d.ts +1 -1
- package/dist/hooks/useFaceModelAcquisition.d.ts +38 -0
- package/dist/hooks/useGesture.d.ts +32 -0
- package/dist/hooks/useIrisTracking.d.ts +45 -0
- package/dist/hooks/useTrackerContext.d.ts +6 -0
- package/dist/hooks/useXRDiagnostics.d.ts +81 -0
- package/dist/hooks/useXRModel.d.ts +7 -0
- package/dist/hooks/useXRSession/facade.d.ts +42 -2
- package/dist/hooks/useXRSession/index.d.ts +2 -2
- package/dist/hooks/useXRSession/reason.d.ts +3 -1
- package/dist/hooks/useXRSession/registry.d.ts +14 -0
- package/dist/hooks/useXRSession/store.d.ts +52 -3
- package/dist/index-B1_TzJaI.js +1104 -0
- package/dist/index-BavF06C6.js +190 -0
- package/dist/index-BfFmpddl.cjs +21 -0
- package/dist/index-BuBzneeW.cjs +46 -0
- package/dist/index-CGsQWodV.cjs +1 -0
- package/dist/index-CIe7eCMH.js +3200 -0
- package/dist/index-CfSF8LXa.cjs +1 -0
- package/dist/index-D5GTzOzD.cjs +1 -0
- package/dist/index-DBhQzvVa.js +314 -0
- package/dist/index-DE17y0ZI.cjs +1 -0
- package/dist/index-JII7huPk.js +442 -0
- package/dist/index-tpCr9CLj.cjs +1 -0
- package/dist/index-w1S7fI2B.js +1432 -0
- package/dist/index-zGaqrz_K.js +188 -0
- package/dist/instructions.cjs +30 -0
- package/dist/instructions.js +1507 -0
- package/dist/{internal-Dmk1cTXq.js → internal-B90P-clC.js} +138 -119
- package/dist/internal-Cjinca64.cjs +1 -0
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +15 -10
- package/dist/iris/compute.d.ts +27 -0
- package/dist/iris/index.d.ts +4 -0
- package/dist/iris/lead.d.ts +19 -0
- package/dist/iris/types.d.ts +89 -0
- package/dist/landmarkMask-BFDyBnKM.js +224 -0
- package/dist/landmarkMask-u7es2k4X.cjs +1 -0
- package/dist/landmarks-BlUqf5MZ.cjs +1 -0
- package/dist/landmarks-bftdwq6Z.js +76 -0
- package/dist/loaders-BGAUACsd.js +363 -0
- package/dist/loaders-BJ1_QCHt.cjs +1 -0
- package/dist/low-level.cjs +1 -1
- package/dist/low-level.js +1190 -675
- package/dist/main.cjs +1 -1
- package/dist/main.js +1190 -452
- package/dist/models/Base/index.d.ts +49 -0
- package/dist/models/Body/index.d.ts +3 -1
- package/dist/models/Face/constants.d.ts +8 -0
- package/dist/models/Face/index.d.ts +4 -12
- package/dist/models/Face/rotation.d.ts +18 -3
- package/dist/models/Hand/GestureTracking.d.ts +1 -1
- package/dist/models/Hand/HandTracking.d.ts +17 -1
- package/dist/models/Holistic/index.d.ts +49 -0
- package/dist/models/Holistic/result.d.ts +68 -0
- package/dist/models/Segmentation/index.d.ts +2 -0
- package/dist/models/SemanticSegmentation/index.d.ts +31 -0
- package/dist/models/SemanticSegmentation/presets.d.ts +28 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/nodeSource.d.ts +9 -0
- package/dist/particles/emission.d.ts +24 -0
- package/dist/particles/eyes.d.ts +24 -0
- package/dist/particles/glsl.d.ts +14 -0
- package/dist/particles/index.d.ts +10 -0
- package/dist/particles/motion.d.ts +42 -0
- package/dist/particles/presets.d.ts +12 -0
- package/dist/particles/ring.d.ts +58 -0
- package/dist/particles/selfTest.d.ts +53 -0
- package/dist/particles/settings.d.ts +127 -0
- package/dist/particles/shapes.d.ts +29 -0
- package/dist/particles/spawner.d.ts +60 -0
- package/dist/particles/system.d.ts +64 -0
- package/dist/particles.cjs +122 -0
- package/dist/particles.js +774 -0
- package/dist/product/ProductDimensions.d.ts +16 -0
- package/dist/product/ProductHotspot.d.ts +16 -0
- package/dist/product/ProductViewer.d.ts +9 -0
- package/dist/product/details.d.ts +53 -0
- package/dist/product/index.d.ts +14 -0
- package/dist/product/loadModelViewer.d.ts +4 -0
- package/dist/product/types.d.ts +71 -0
- package/dist/product/useProductAr.d.ts +37 -0
- package/dist/product/useProductDetails.d.ts +60 -0
- package/dist/product.cjs +1 -0
- package/dist/product.js +414 -0
- package/dist/providers-C8rE26Uf.js +366 -0
- package/dist/providers-DHsrhDI2.cjs +62 -0
- package/dist/quality/XRQualityController.d.ts +25 -0
- package/dist/quality/controller.d.ts +33 -0
- package/dist/quality/index.d.ts +6 -0
- package/dist/quality/types.d.ts +100 -0
- package/dist/quality/useXRQuality.d.ts +28 -0
- package/dist/render/renderPasses.d.ts +8 -0
- package/dist/render/sceneBeforeRender.d.ts +12 -0
- package/dist/{renderGroups-KZk6eRiY.js → renderGroups-B38pUaX2.js} +1 -1
- package/dist/{renderGroups-80H3DpTl.cjs → renderGroups-Cb_4Ar1Q.cjs} +1 -1
- package/dist/renderPasses-B6l8IpJv.js +1290 -0
- package/dist/renderPasses-dqmkft4P.cjs +158 -0
- package/dist/renderState-CJNmj5jz.js +39 -0
- package/dist/renderState-apSfg4eR.cjs +1 -0
- package/dist/scene-object.cjs +1 -1
- package/dist/scene-object.js +2 -2
- package/dist/segmentation-Cb3ouK6Z.js +1758 -0
- package/dist/segmentation-D9pYO6aR.cjs +1 -0
- package/dist/segmentation2d/faceMemory.d.ts +28 -0
- package/dist/segmentation2d/faceRegions.d.ts +24 -0
- package/dist/segmentation2d/index.d.ts +9 -0
- package/dist/segmentation2d/maskUv.d.ts +23 -0
- package/dist/segmentation2d/rasterize.d.ts +14 -0
- package/dist/segmentation2d/types.d.ts +52 -0
- package/dist/select-Ck5LGz-J.cjs +1 -0
- package/dist/select-pYRo_win.js +233 -0
- package/dist/selectors-C4X71aoD.cjs +1 -0
- package/dist/selectors-DmNaKIwE.js +196 -0
- package/dist/session-BrH8G7iJ.cjs +31 -0
- package/dist/session-DgA_z6O1.js +418 -0
- package/dist/settings-BJ7FMBsO.js +111 -0
- package/dist/settings-C63FMBlF.cjs +1 -0
- package/dist/similarityFit-BFqHND2e.cjs +1 -0
- package/dist/similarityFit-Bbz-R8AY.js +91 -0
- package/dist/spring/index.d.ts +2 -0
- package/dist/spring/spring.d.ts +69 -0
- package/dist/spring/swing.d.ts +54 -0
- package/dist/subjects/index.d.ts +2 -0
- package/dist/subjects/select.d.ts +62 -0
- package/dist/subjects/types.d.ts +55 -0
- package/dist/tracking-config/apply.d.ts +57 -0
- package/dist/tracking-config/index.d.ts +7 -0
- package/dist/tracking-config/resolve.d.ts +25 -0
- package/dist/tracking-config/storage.d.ts +8 -0
- package/dist/tracking-config/types.d.ts +106 -0
- package/dist/tracking-config/useXRTrackingConfig.d.ts +38 -0
- package/dist/tracking.cjs +10 -1
- package/dist/tracking.js +1326 -506
- package/dist/trigger-D0Pm9noT.cjs +49 -0
- package/dist/trigger-IQeys0oS.js +2128 -0
- package/dist/types/compositor.d.ts +21 -0
- package/dist/types/face.d.ts +20 -1
- package/dist/types/hand-tracking.d.ts +9 -0
- package/dist/types/holistic.d.ts +121 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/model.d.ts +22 -2
- package/dist/types/nodes.d.ts +47 -3
- package/dist/types/segmentation.d.ts +24 -0
- package/dist/types/session.d.ts +41 -3
- package/dist/updateThrottle-BseecYag.js +4 -0
- package/dist/updateThrottle-Of5Y4SVa.cjs +1 -0
- package/dist/useFaceInfo-BHDNCvsJ.cjs +1 -0
- package/dist/useFaceInfo-J4x7LsqL.js +76 -0
- package/dist/useFaceResultReader-BvEo5REG.js +61 -0
- package/dist/useFaceResultReader-DuaL1KJG.cjs +1 -0
- package/dist/useInstructionHold-DOu-RpCM.js +53 -0
- package/dist/useInstructionHold-DwJY1Alr.cjs +1 -0
- package/dist/useLandmarkPoseFit-Bg-h9BPb.cjs +1 -0
- package/dist/useLandmarkPoseFit-Bmb3h6Mw.js +87 -0
- package/dist/useXRCapabilities-Cr3RzuAW.cjs +1 -0
- package/dist/useXRCapabilities-Cxmlmpbd.js +30 -0
- package/dist/utils/canonicalRigidLandmarks.d.ts +8 -0
- package/dist/utils/fns.d.ts +6 -3
- package/dist/utils/headOccluderFit.d.ts +42 -0
- package/dist/utils/integrity.d.ts +21 -1
- package/dist/utils/resolveNumFaces.d.ts +13 -0
- package/dist/utils/shoulderOccluderFit.d.ts +38 -0
- package/dist/utils/similarityFit.d.ts +23 -0
- package/dist/utils/updateThrottle.d.ts +2 -0
- package/dist/utils/useStableUniforms.d.ts +18 -0
- package/dist/uv-BMFt19bg.cjs +1 -0
- package/dist/{index-ByoNj0QP.js → uv-DJU_XfmN.js} +15 -247
- package/docs/SDK_DOCUMENTATION.md +1 -2
- package/docs/api/adaptive-quality.mdx +104 -0
- package/docs/api/asset-lifecycle.mdx +78 -0
- package/docs/api/body-instructions.mdx +285 -0
- package/docs/api/body-triggers.mdx +234 -0
- package/docs/api/camera-permission.mdx +142 -0
- package/docs/api/coordinate-spaces.mdx +168 -0
- package/docs/api/cross-camera.mdx +89 -0
- package/docs/api/debug-ui-scene-editor.mdx +23 -2
- package/docs/api/diagnostics-calibration.mdx +97 -0
- package/docs/api/external-face-mesh.mdx +231 -0
- package/docs/api/face-actions.mdx +20 -16
- package/docs/api/face-attribute-expression.mdx +1 -1
- package/docs/api/face-binding-anchors.mdx +4 -2
- package/docs/api/face-character.mdx +157 -0
- package/docs/api/face-effects.mdx +9 -0
- package/docs/api/face-expression-controller.mdx +153 -0
- package/docs/api/face-info.mdx +17 -11
- package/docs/api/face-inset.mdx +204 -0
- package/docs/api/face-instructions.mdx +183 -0
- package/docs/api/face-liquify.mdx +196 -0
- package/docs/api/face-mesh.mdx +8 -9
- package/docs/api/face-morph.mdx +117 -0
- package/docs/api/face-painting.mdx +7 -0
- package/docs/api/face-reprojection.mdx +154 -0
- package/docs/api/face-retouching.mdx +18 -10
- package/docs/api/face-swap.mdx +350 -0
- package/docs/api/face-warp-3d.mdx +166 -0
- package/docs/api/faceless.mdx +143 -0
- package/docs/api/gestures.mdx +209 -0
- package/docs/api/hair.mdx +97 -0
- package/docs/api/hand-instructions.mdx +222 -0
- package/docs/api/hand-rig.mdx +535 -0
- package/docs/api/hand-touch.mdx +162 -0
- package/docs/api/head-occluder.mdx +563 -0
- package/docs/api/holistic-tracker.mdx +164 -0
- package/docs/api/instructions.mdx +323 -0
- package/docs/api/iris-tracking.mdx +247 -0
- package/docs/api/made-up-camera.mdx +131 -0
- package/docs/api/makeup-skin-tone.mdx +135 -0
- package/docs/api/makeup.mdx +353 -0
- package/docs/api/multi-subject.mdx +98 -0
- package/docs/api/particles.mdx +155 -0
- package/docs/api/person-cutout.mdx +136 -0
- package/docs/api/pin-to-face-mesh.mdx +274 -0
- package/docs/api/product-ar.mdx +114 -0
- package/docs/api/product-details.mdx +78 -0
- package/docs/api/screen-space-coordinates.mdx +4 -1
- package/docs/api/segmentation-overlay.mdx +301 -0
- package/docs/api/session-lifecycle.mdx +136 -0
- package/docs/api/trackers.mdx +5 -0
- package/docs/api/tracking-config.mdx +108 -0
- package/docs/docs.json +51 -1
- package/docs/examples/lip-shaders.mdx +273 -0
- package/docs/guides/face-atlas-template.svg +1 -0
- package/docs/guides/face-atlas-textures.mdx +186 -0
- package/docs/guides/face-texture-template.svg +1 -0
- package/docs/guides/harness-debug-ui.mdx +4 -4
- package/docs/guides/lip-effect-textures.mdx +368 -0
- package/docs/guides/lip-uv-template.png +0 -0
- package/docs/guides/lip-uv-template.svg +1 -0
- package/docs/guides/makeup-design-textures.mdx +109 -0
- package/docs/introduction.mdx +1 -2
- package/package.json +23 -1
- package/dist/DebuggerUI-B6bP6P9r.cjs +0 -1
- package/dist/DebuggerUI-BjOMr8q_.js +0 -269
- package/dist/FaceMeshRenderer-C5l6VLdO.cjs +0 -155
- package/dist/FaceMeshRenderer-wjAHrJzP.js +0 -1270
- package/dist/FaceRetouch-BkJzoA79.cjs +0 -134
- package/dist/FaceRetouch-DwbKQJAN.js +0 -551
- package/dist/components/FaceWarp3D/FaceWarp3DHead.d.ts +0 -15
- package/dist/components/FaceWarp3D/defaults.d.ts +0 -37
- package/dist/components/FaceWarp3D/warp.d.ts +0 -13
- package/dist/contexts-ByhzppYl.js +0 -663
- package/dist/contexts-Dr62It_K.cjs +0 -1
- package/dist/debug-ui/face-warp-3d/index.d.ts +0 -6
- package/dist/getFaceInfo-C4QpCQIY.js +0 -118
- package/dist/getFaceInfo-fA1bFBub.cjs +0 -1
- package/dist/index-9dlAQAhy.js +0 -1462
- package/dist/index-BjmTe9eM.cjs +0 -1
- package/dist/index-BpEf2BBb.cjs +0 -1
- package/dist/index-CyUUurQT.cjs +0 -1
- package/dist/index-DCiMbxC3.cjs +0 -1
- package/dist/index-DXT3WccE.js +0 -2089
- package/dist/index-DpI-qo5X.cjs +0 -17
- package/dist/index-DyVF4vEW.js +0 -111
- package/dist/index-VJ0SJwmG.js +0 -214
- package/dist/internal-Cq-TEQ5Y.cjs +0 -1
- package/dist/renderLayers-lDtL0_43.cjs +0 -1
- package/dist/renderLayers-zrK2pv5O.js +0 -13
- package/dist/renderPasses-BOoBSr8z.cjs +0 -21
- package/dist/renderPasses-BcquyVtu.js +0 -1500
- package/dist/selectors-B8H97CKA.js +0 -59
- package/dist/selectors-CZLKT2Iv.cjs +0 -1
- package/dist/session-CpkiK5YA.cjs +0 -31
- package/dist/session-DLFN_VII.js +0 -363
- package/dist/useFaceInfo-BJ8-_MOs.cjs +0 -1
- package/dist/useFaceInfo-Dk426LTu.js +0 -62
- package/dist/useFaceResults-CtetsO9M.js +0 -19
- package/dist/useFaceResults-wBJF3zyp.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var Os=Object.defineProperty;var Hs=(e,s,t)=>s in e?Os(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t;var h=(e,s,t)=>Hs(e,typeof s!="symbol"?s+"":s,t);const Pe=require("react/jsx-runtime"),I=require("react"),q=require("@mediapipe/tasks-vision"),X=require("three");function Ns(e){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(s,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return s.default=e,Object.freeze(s)}const W=Ns(X),B={assetStorageEndpoint:"https://cdn.vincentt.studio",sdkAssetsBaseUrl:"https://cdn.vincentt.studio/assets/sdk/face/v1",loggerPrefix:"[vincentt-xr]:",sessionCheckInterval:3e4};var F=(e=>(e.WEBCAM="webcam",e.STREAM="stream",e.CANVAS="canvas",e))(F||{}),A=(e=>(e.HAND_TRACKER="vincentt.xr.hand-tracker",e.GESTURE_TRACKER="vincentt.xr.gesture-tracker",e.FACE_TRACKER="vincentt.xr.face-tracker",e.BODY_TRACKER="vincentt.xr.body-tracker",e.HOLISTIC_TRACKER="vincentt.xr.holistic-tracker",e.BACKGROUND_SEGMENTATION="vincentt.xr.background-segmentation",e.SEMANTIC_SEGMENTATION="vincentt.xr.semantic-segmentation",e))(A||{});const Le=e=>Array.from({length:e},()=>({x:0,y:0,z:0}));class Mt{constructor(s){h(this,"slots",[]);this.options=s}setOptions(s){this.options=s}update(s,t){const{holdMs:n,predictMs:r,maxVelocityGapMs:i=250}=this.options,c=[],o=Math.max(s.length,this.slots.length);for(let d=0;d<o;d+=1){const l=s[d],u=this.slots[d]??null;if(l&&l.length>0){const S=u&&u.points.length===l.length?u:null,M=S??{points:Le(l.length),velocity:Le(l.length),lastSeen:t,output:Le(l.length)},C=(t-M.lastSeen)/1e3,E=S!==null&&C>0&&C*1e3<=i;for(let P=0;P<l.length;P+=1){const g=l[P],v=M.points[P],w=M.velocity[P],x=g.z??0;E?(w.x=.5*w.x+.5*((g.x-v.x)/C),w.y=.5*w.y+.5*((g.y-v.y)/C),w.z=.5*w.z+.5*((x-v.z)/C)):(w.x=0,w.y=0,w.z=0),v.x=g.x,v.y=g.y,v.z=x}M.lastSeen=t,this.slots[d]=M,c.push(l);continue}if(!u)continue;const m=t-u.lastSeen;if(m>n){this.slots[d]=null;continue}const y=Math.max(0,Math.min(m,r))/1e3;for(let S=0;S<u.points.length;S+=1)u.output[S].x=u.points[S].x+u.velocity[S].x*y,u.output[S].y=u.points[S].y+u.velocity[S].y*y,u.output[S].z=u.points[S].z+u.velocity[S].z*y;c.push(u.output)}for(;this.slots.length>0&&this.slots[this.slots.length-1]===null;)this.slots.pop();return c}reset(){this.slots=[]}}const le=(e,s={x:0,y:0,z:0})=>(s.x=e.x*2-1,s.y=1-e.y*2,s.z=-e.z,s),Us=(e,s={x:0,y:0,z:0})=>(s.x=(e.x+1)/2,s.y=(1-e.y)/2,s.z=-e.z,s),ze="https://storage.googleapis.com/mediapipe-models/holistic_landmarker/holistic_landmarker/float16/latest/holistic_landmarker.task",Ct=250,kt=0,xt=768,Se=e=>({hands:(e==null?void 0:e.hands)??"both",analysisMaxDimension:(e==null?void 0:e.analysisMaxDimension)??xt,holdMs:(e==null?void 0:e.holdMs)??Ct,predictMs:(e==null?void 0:e.predictMs)??kt}),Bs=()=>({version:0,timestampMs:0,face:null,leftHand:null,rightHand:null,pose:null}),mt=[0,4,5,6,1,2,3,8,7,10,9,12,11,14,13,16,15,18,17,20,19,22,21,24,23,26,25,28,27,30,29,32,31],ft=(e,s)=>{if(e.length!==mt.length)return e;s.length=e.length;for(let t=0;t<e.length;t+=1)s[t]=e[mt[t]];return s};class we{constructor(s,t){h(this,"memory");h(this,"holdMs");h(this,"lastLiveMs",-1/0);h(this,"lastConfidence",0);this.holdMs=s,this.memory=new Mt({holdMs:s,predictMs:t})}setOptions(s,t){this.holdMs=s,this.memory.setOptions({holdMs:s,predictMs:t})}reset(){this.memory.reset(),this.lastLiveMs=-1/0,this.lastConfidence=0}bridge(s,t,n){const r=s!==void 0&&s.length>0,i=this.memory.update(r?[s]:[],n)[0];if(!i)return;if(r)return this.lastLiveMs=n,this.lastConfidence=t,{points:i,held:!1,confidence:t};const c=n-this.lastLiveMs,o=this.holdMs>0?Math.max(0,1-c/this.holdMs):0;return{points:i,held:!0,confidence:this.lastConfidence*o}}}const oe=(e,s,t)=>{for(e.length>s&&(e.length=s);e.length<s;)e.push(t());return e},De=(e,s)=>{e.x=s.x,e.y=s.y,e.z=s.z},zs=e=>{if(e.length===0)return 0;let s=0;for(let t=0;t<e.length;t+=1)s+=e[t].visibility??0;return s/e.length};class Ws{constructor(s){h(this,"options",Se());h(this,"faceMemory",new we(this.options.holdMs,this.options.predictMs));h(this,"leftHandMemory",new we(this.options.holdMs,this.options.predictMs));h(this,"rightHandMemory",new we(this.options.holdMs,this.options.predictMs));h(this,"poseMemory",new we(this.options.holdMs,this.options.predictMs));h(this,"face",{landmarks:[],blendshapes:{},confidence:0,held:!1});h(this,"leftHand",{handedness:"left",landmarks:[],worldLandmarks:[],confidence:0,held:!1});h(this,"rightHand",{handedness:"right",landmarks:[],worldLandmarks:[],confidence:0,held:!1});h(this,"poseScratch",[]);h(this,"poseWorldScratch",[]);h(this,"pose",{landmarks:[],worldLandmarks:[],visibility:[],confidence:0,held:!1});this.setOptions(s)}getOptions(){return this.options}setOptions(s){this.options=Se({...this.options,...s});const{holdMs:t,predictMs:n}=this.options;for(const r of this.memories())r.setOptions(t,n)}reset(){for(const s of this.memories())s.reset()}memories(){return[this.faceMemory,this.leftHandMemory,this.rightHandMemory,this.poseMemory]}update(s,t,n,r=!1){var l,u,m,y;n.face=this.updateFace(s,t);const i={landmarks:(l=s==null?void 0:s.leftHandLandmarks)==null?void 0:l[0],world:(u=s==null?void 0:s.leftHandWorldLandmarks)==null?void 0:u[0]},c={landmarks:(m=s==null?void 0:s.rightHandLandmarks)==null?void 0:m[0],world:(y=s==null?void 0:s.rightHandWorldLandmarks)==null?void 0:y[0]},o=r?c:i,d=r?i:c;return n.leftHand=this.updateHand("left",o.landmarks,o.world,t),n.rightHand=this.updateHand("right",d.landmarks,d.world,t),n.pose=this.updatePose(s,t,r),n.timestampMs=t,n.version+=1,n}updateFace(s,t){var o,d,l,u;const n=(o=s==null?void 0:s.faceLandmarks)==null?void 0:o[0],r=this.faceMemory.bridge(n,1,t);if(!r)return null;const{face:i}=this,c=!r.held&&n;oe(i.landmarks,r.points.length,()=>({x:0,y:0,z:0,visibility:0}));for(let m=0;m<r.points.length;m+=1){const y=i.landmarks[m];De(y,r.points[m]),y.visibility=c?((d=n[m])==null?void 0:d.visibility)??0:0}if(c){const m=(u=(l=s==null?void 0:s.faceBlendshapes)==null?void 0:l[0])==null?void 0:u.categories;if(m)for(const y of m)i.blendshapes[y.categoryName]=y.score}return i.confidence=r.confidence,i.held=r.held,i}updateHand(s,t,n,r){const i=s==="left"?this.leftHandMemory:this.rightHandMemory,{hands:c}=this.options;if(c==="none"||c!=="both"&&c!==s)return i.reset(),null;const o=i.bridge(t,1,r);if(!o)return null;const d=s==="left"?this.leftHand:this.rightHand;oe(d.landmarks,o.points.length,()=>({x:0,y:0,z:0}));for(let l=0;l<o.points.length;l+=1)le(o.points[l],d.landmarks[l]);if(!o.held&&n){oe(d.worldLandmarks,n.length,()=>({x:0,y:0,z:0}));for(let l=0;l<n.length;l+=1)De(d.worldLandmarks[l],n[l])}return d.confidence=o.confidence,d.held=o.held,d}updatePose(s,t,n){var m,y,S;const r=(m=s==null?void 0:s.poseLandmarks)==null?void 0:m[0],i=r&&n?ft(r,this.poseScratch):r,c=this.poseMemory.bridge(i,i?zs(i):0,t);if(!c)return null;const{pose:o}=this,d=!c.held&&i;oe(o.landmarks,c.points.length,()=>({x:0,y:0,z:0})),oe(o.visibility,c.points.length,()=>0);for(let M=0;M<c.points.length;M+=1)le(c.points[M],o.landmarks[M]),d&&(o.visibility[M]=((y=i[M])==null?void 0:y.visibility)??0);const l=(S=s==null?void 0:s.poseWorldLandmarks)==null?void 0:S[0],u=l&&n?ft(l,this.poseWorldScratch):l;if(d&&u){oe(o.worldLandmarks,u.length,()=>({x:0,y:0,z:0}));for(let M=0;M<u.length;M+=1)De(o.worldLandmarks[M],u[M])}return o.confidence=c.confidence,o.held=c.held,o}}const We={"camera-permission-denied":"Camera access was blocked. Allow camera permissions in your browser, then refresh.","camera-in-use":"Camera is already in use by another app or browser tab. Close it and refresh.","no-camera":"No camera was found on this device.","camera-insecure-context":"Camera access needs HTTPS (or localhost). Open the page over HTTPS.","camera-unsupported":"This browser cannot open the camera.","camera-lost":"The camera stopped sending frames (disconnected, revoked, or taken by another app).","webgl-unavailable":"WebGL is unavailable, so nothing can render or track.","offscreen-canvas-unavailable":"OffscreenCanvas is unavailable; the tracker feed cannot be built.","wasm-unavailable":"WebAssembly is unavailable; the tracking engine cannot load.","model-unreachable":"The tracker model could not be downloaded.","model-integrity":"The tracker model failed its integrity check.","model-init-failed":"The tracker failed to initialize on this device.","placement-unsupported":"This device cannot place 3D objects in the room (no WebXR, Scene Viewer or Quick Look).",unknown:"Tracking is unavailable for an unknown reason."},qs={"camera-permission-denied":!0,"camera-in-use":!0,"no-camera":!1,"camera-insecure-context":!1,"camera-unsupported":!1,"camera-lost":!0,"webgl-unavailable":!1,"offscreen-canvas-unavailable":!1,"wasm-unavailable":!1,"model-unreachable":!0,"model-integrity":!1,"model-init-failed":!1,"placement-unsupported":!1,unknown:!0},_=(e,s=We[e])=>({code:e,message:s,recoverable:qs[e]}),Tt={[A.FACE_TRACKER]:"/assets/xr/models/face_tracking.task",[A.HAND_TRACKER]:"/assets/xr/models/hand_tracking.task",[A.GESTURE_TRACKER]:"/assets/xr/models/gesture_tracking.task",[A.BODY_TRACKER]:"/assets/xr/models/body_tracking.task",[A.BACKGROUND_SEGMENTATION]:"/assets/xr/models/segmentation.tflite",[A.SEMANTIC_SEGMENTATION]:"/assets/xr/models/selfie_multiclass_256x256.tflite",[A.HOLISTIC_TRACKER]:ze},qe=e=>{const s=Tt[e];return s?/^https?:/.test(s)?s:new URL(s,B.assetStorageEndpoint).toString():null},Vs=Object.values(A),Ks=()=>{var t,n,r;const e=typeof window<"u",s=typeof document<"u";return{navigator:typeof navigator<"u"?navigator:void 0,isSecureContext:e?window.isSecureContext:void 0,createCanvas:s?()=>document.createElement("canvas"):void 0,offscreenCanvas:typeof OffscreenCanvas<"u",wasm:typeof WebAssembly<"u",fetch:typeof fetch<"u"?fetch.bind(globalThis):void 0,now:()=>typeof performance<"u"?performance.now():Date.now(),xrSessionSupported:typeof navigator<"u"&&((t=navigator.xr)!=null&&t.isSessionSupported)?i=>navigator.xr.isSessionSupported(i).catch(()=>!1):void 0,relSupportsAr:s?((r=(n=document.createElement("a").relList)==null?void 0:n.supports)==null?void 0:r.call(n,"ar"))===!0:void 0,userAgent:typeof navigator<"u"?navigator.userAgent:void 0}},Xs=e=>!!e&&/Android/.test(e)&&/(Chrome|SamsungBrowser)\//.test(e)&&!/Firefox|OPR\//.test(e),Gs=async e=>{let s=!1;if(e.xrSessionSupported)try{s=await e.xrSessionSupported("immersive-ar")}catch{s=!1}const t=Xs(e.userAgent),n=e.relSupportsAr===!0,r=s||t||n;return{webxr:s,sceneViewer:t,quickLook:n,any:r,reason:r?null:_("placement-unsupported")}},bt=e=>{switch(e){case"granted":return"supported";case"denied":return"permission-denied";case"prompt":return"permission-prompt";default:return"unknown"}},js=async(e,s)=>{var o,d,l;const t=e.isSecureContext??!0,n=(o=e.navigator)==null?void 0:o.mediaDevices;if(!t)return{status:"unsupported",reason:_("camera-insecure-context"),deviceCount:null,secureContext:t};if(!n||typeof n.getUserMedia!="function")return{status:"unsupported",reason:_("camera-unsupported"),deviceCount:null,secureContext:t};let r="unknown";if(s&&((l=(d=e.navigator)==null?void 0:d.permissions)!=null&&l.query))try{const u=await e.navigator.permissions.query({name:"camera"});r=bt(u.state)}catch{r="unknown"}let i=null,c=!1;if(typeof n.enumerateDevices=="function")try{const u=await n.enumerateDevices();i=u.filter(m=>m.kind==="videoinput").length,c=u.some(m=>!!m.label)}catch{i=null}return r==="permission-denied"?{status:r,reason:_("camera-permission-denied"),deviceCount:i,secureContext:t}:i===0&&(r==="supported"||c)?{status:"unsupported",reason:_("no-camera"),deviceCount:i,secureContext:t}:{status:r,reason:null,deviceCount:i,secureContext:t}},Qs=e=>{var t;const s=(t=e.createCanvas)==null?void 0:t.call(e);if(!s)return 0;try{if(s.getContext("webgl2"))return 2;if(s.getContext("webgl")||s.getContext("experimental-webgl"))return 1}catch{return 0}return 0},Ys=e=>{var c;const s=Qs(e),t=e.offscreenCanvas??!1,n=e.wasm??!1,r=!!((c=e.navigator)!=null&&c.gpu);let i=null;return s===0?i=_("webgl-unavailable"):t?n||(i=_("wasm-unavailable")):i=_("offscreen-canvas-unavailable"),{status:i?"unsupported":"supported",reason:i,webglVersion:s,webgpu:r,offscreenCanvas:t,wasm:n}},Zs=async(e,s,t)=>{var c,o;const n=qe(e);if(!n||!s.fetch)return{model:e,status:"unknown",reason:null,url:n,bytes:null};const r=typeof AbortController<"u"?new AbortController:void 0,i=setTimeout(()=>r==null?void 0:r.abort(),t);try{const d=await s.fetch(n,{method:"HEAD",signal:r==null?void 0:r.signal});if(!d.ok)return{model:e,status:"unsupported",reason:_("model-unreachable",`${We["model-unreachable"]} (${d.status})`),url:n,bytes:null};const l=Number(((o=(c=d.headers)==null?void 0:c.get)==null?void 0:o.call(c,"content-length"))??NaN);return{model:e,status:"supported",reason:null,url:n,bytes:Number.isFinite(l)&&l>0?l:null}}catch{return{model:e,status:"unsupported",reason:_("model-unreachable"),url:n,bytes:null}}finally{clearTimeout(i)}},Js=async(e={},s=Ks())=>{const t=e.timeoutMs??4e3,n=new Set(e.models??[]),[r,i,c]=await Promise.all([js(s,e.queryPermission??!0),Promise.all(Vs.map(async l=>n.has(l)?Zs(l,s,t):{model:l,status:"unknown",reason:null,url:qe(l),bytes:null})),Gs(s)]),o=Ys(s),d=Object.fromEntries(i.map(l=>[l.model,l]));return{camera:r,rendering:o,placement:c,models:d,canRunTracking:o.status==="supported"&&r.status!=="unsupported",checkedAt:s.now?s.now():Date.now()}},Ve=e=>{switch(e){case"permission-denied":return _("camera-permission-denied");case"camera-in-use":return _("camera-in-use");case"no-camera":return _("no-camera");case"camera-lost":return _("camera-lost");case"unsupported":return _("camera-unsupported");default:return _("unknown")}},$s=(e,s)=>{const{camera:t,rendering:n}=e,r=e.models[s],i=t.status==="permission-prompt"||t.status==="unknown";return n.reason?{supported:!1,reason:n.reason,needsPermission:i}:t.reason?{supported:!1,reason:t.reason,needsPermission:i}:r!=null&&r.reason?{supported:!1,reason:r.reason,needsPermission:i}:{supported:!0,reason:null,needsPermission:i}},en=e=>{const s=e instanceof Error?e.message:String(e??""),t=s.toLowerCase();return t.includes("integrity")||t.includes("sha-384")||t.includes("sha384")?_("model-integrity",s):t.includes("failed to fetch")||t.includes("networkerror")||t.includes("load failed")||/\b(404|403|5\d\d)\b/.test(t)||t.includes("fetch")?_("model-unreachable",s):t.includes("webgl")||t.includes("gpu")?_("webgl-unavailable",s):s?_("model-init-failed",s):_("unknown")},Ke=e=>{switch(e instanceof DOMException?e.name:""){case"NotAllowedError":case"PermissionDeniedError":return"permission-denied";case"NotReadableError":case"TrackStartError":return"camera-in-use";case"NotFoundError":case"DevicesNotFoundError":return"no-camera";case"NotSupportedError":case"SecurityError":case"OverconstrainedError":return"unsupported";default:return e instanceof TypeError?"unsupported":"unknown"}},gt={"permission-denied":"Camera access was blocked. Allow camera permissions in your browser, then refresh.","camera-in-use":"Camera is already in use by another app or browser tab. Close it and refresh.","no-camera":"No camera was found on this device.","camera-lost":"The camera stopped sending frames. Reconnect it or re-allow access, then start again.",unsupported:"Unable to access camera. Allow camera permissions in your browser, then refresh.",unknown:"Unable to access camera. Allow camera permissions in your browser, then refresh."},ke=()=>({mediaDevices:typeof navigator<"u"?navigator.mediaDevices:void 0,permissions:typeof navigator<"u"?navigator.permissions:void 0,isSecureContext:typeof window<"u"?window.isSecureContext:void 0}),Xe=async(e=ke())=>{var s;if(!((s=e.permissions)!=null&&s.query))return{state:"unknown",prompt:!1};try{const t=await e.permissions.query({name:"camera"});return t.state==="granted"?{state:"granted",prompt:!1}:t.state==="denied"?{state:"blocked",prompt:!1}:{state:"unknown",prompt:t.state==="prompt"}}catch{return{state:"unknown",prompt:!1}}},Ge=(e,s)=>e==="permission-denied"?{state:s==="blocked"?"blocked":"denied",reason:_("camera-permission-denied")}:{state:"unavailable",reason:Ve(e)},tn=async(e={},s=ke())=>{var n;if(s.isSecureContext===!1)return{state:"unavailable",reason:_("camera-insecure-context"),stream:null};const t=(n=s.mediaDevices)==null?void 0:n.getUserMedia;if(typeof t!="function")return{state:"unavailable",reason:_("camera-unsupported"),stream:null};try{const r=await t.call(s.mediaDevices,e.constraints??{video:{facingMode:"user"}});return e.keepStream?{state:"granted",reason:null,stream:r}:(r.getTracks().forEach(i=>i.stop()),{state:"granted",reason:null,stream:null})}catch(r){const i=Ke(r),c=await Xe(s);return{...Ge(i,c.state),stream:null}}},sn=async(e,s=ke())=>{var t,n;if(!((t=s.permissions)!=null&&t.query))return()=>{};try{const r=await s.permissions.query({name:"camera"}),i=()=>{r.state==="granted"?e({state:"granted",prompt:!1}):r.state==="denied"?e({state:"blocked",prompt:!1}):e({state:"unknown",prompt:r.state==="prompt"})};return(n=r.addEventListener)==null||n.call(r,"change",i),()=>{var c;return(c=r.removeEventListener)==null?void 0:c.call(r,"change",i)}}catch{return()=>{}}},nn=e=>e==="unknown"||e==="denied"||e==="granted",rn={unknown:"This experience uses your camera. Nothing is recorded or uploaded.",requesting:"Waiting for you to allow the camera…",granted:"Camera access granted.",denied:"Camera access was not allowed. You can try again.",blocked:"Camera access is blocked for this site. Allow it in your browser's site settings, then reload.",unavailable:"The camera is unavailable on this device right now."},Et=(e,s,t="cover",n=1)=>{if(e.width<=0||e.height<=0||s.width<=0||s.height<=0)return null;const r=Number.isFinite(n)&&n>0?n:1,i=s.width/e.width,c=s.height/e.height,o=t==="contain"?c<=i:c>=i,d=(o?c:i)*r,l=o?e.width*c*r:s.width*r,u=o?s.height*r:e.height*i*r;return{scale:d,drawWidth:l,drawHeight:u,offsetX:(s.width-l)/2,offsetY:(s.height-u)/2}},ge=e=>e==="webcam"||e===void 0,At=({source:e,feed:s,zoom:t=1,mirrored:n=!1})=>{const r=Et(e,s,"cover",t);return r?{...r,source:e,feed:s,zoom:Number.isFinite(t)&&t>0?t:1,mirrored:n}:null},an=(e,s,t={x:0,y:0})=>{const n=s.mirrored?s.source.width-e.x:e.x;return t.x=(s.offsetX+n*s.scale)/s.feed.width,t.y=(s.offsetY+e.y*s.scale)/s.feed.height,t},Rt=(e,s,t={x:0,y:0})=>{const n=(e.x*s.feed.width-s.offsetX)/s.scale;return t.x=s.mirrored?s.source.width-n:n,t.y=(e.y*s.feed.height-s.offsetY)/s.scale,t},on=(e,s)=>{const t=Rt(e,s);return t.x>=0&&t.x<=s.source.width&&t.y>=0&&t.y<=s.source.height},cn=(e,s={x:0,y:0})=>(s.x=1-e.x,s.y=e.y,e.z!==void 0&&(s.z=e.z),s),ln=(e,s,t,n={x:0,y:0})=>{switch(t){case 90:return n.x=s.height-e.y,n.y=e.x,n;case 180:return n.x=s.width-e.x,n.y=s.height-e.y,n;case 270:return n.x=e.y,n.y=s.width-e.x,n;default:return n.x=e.x,n.y=e.y,n}},dn=(e,s)=>s===90||s===270?{width:e.height,height:e.width}:{width:e.width,height:e.height};class H extends Error{constructor(s){super(s),this.name="VincenttXRError"}}class un{constructor(s){h(this,"options");const t={verbose:!1,prefix:B.loggerPrefix};this.options={...t,...s}}log(...s){const{verbose:t,prefix:n}=this.options;t&&console.info(n,...s)}error(...s){const{verbose:t,prefix:n}=this.options;t&&console.error(n,...s)}}const pt=new W.Vector3,Oe=new W.Vector3,Ft=(e,s,t,n,r)=>{pt.set(e,s,0).unproject(t),Oe.copy(pt).sub(t.position).normalize();const i=(n-t.position.z)/Oe.z;return r.copy(t.position).addScaledVector(Oe,i)},It=(e,s,t=new W.Vector3,n=0)=>Ft((e.x-.5)*2,(.5-e.y)*2,s,n,t),hn=(e,s,t=new W.Vector3,n=0)=>Ft(e.x,e.y,s,n,t),Z=new W.Vector3,mn=(e,s,t={x:0,y:0,z:0})=>(Z.set(e.x,e.y,e.z).project(s),t.x=Z.x/2+.5,t.y=.5-Z.y/2,t.z=Z.z,t),fn=(e,s,t={x:0,y:0,z:0})=>(Z.set(e.x,e.y,e.z).project(s),t.x=Z.x,t.y=Z.y,t.z=Z.z,t),ve=(e,s,t)=>It(e,s,t,0),gn=(e,s,t=.2)=>t*s+(1-t)*e;class me{constructor(s){h(this,"canvas");h(this,"scale",1);this.maxDimension=s}setScale(s){this.scale=Math.min(1,Math.max(.25,Number.isFinite(s)&&s>0?s:1))}draw(s){const t=s.width,n=s.height,r=Math.min(1,this.maxDimension*this.scale/Math.max(t,n));if(r>=1)return s;const i=Math.max(1,Math.round(t*r)),c=Math.max(1,Math.round(n*r));(!this.canvas||this.canvas.width!==i||this.canvas.height!==c)&&(this.canvas=new OffscreenCanvas(i,c));const o=this.canvas.getContext("2d");return o?(o.setTransform(1,0,0,1,0,0),o.clearRect(0,0,i,c),o.drawImage(s,0,0,i,c),this.canvas):s}dispose(){this.canvas=void 0}}const pn={"/assets/xr/models/face_tracking.task":"sha384-tYQh+yJE8llY+zO4RviZmWaSKs5W9tsB0ix5rjQVpF5/CLTqmwtP7bYtkUi2w65P","/assets/xr/models/hand_tracking.task":"sha384-uWvruVKd887ov8k43S+DBHCsi7UXXS+CKvvdM1PX00rjPzx/B0QrAPfJ1U9yKcze","/assets/xr/models/gesture_tracking.task":"sha384-2zuseP9JKKWAYlWQGKA2N+ooabB8V/yIxu23Mv8mtY7SowcySB+xKiOmqBhVvlUC","/assets/xr/models/body_tracking.task":"sha384-3Wk9dvRYo36b3Nc9xVjKamb4wCKt9FwiPjcHKfrvyJL/jXoGs+uRLnii6yjWLKul","/assets/xr/models/segmentation.tflite":"sha384-A2bQ8+iZyQM3KIGVBUf0FyetqxuynyKpjsjCE8uzoJEnj1ghCu6ge2daiRffAiS5","/assets/xr/3d-models/head-occluder-v2.glb":"sha384-+0G60Q6EBVE6hpITxGzQgofAeKexPltpsfPq5T5et9GGBjRhFP5HOdsKAhe73OaI","/assets/xr/3d-models/head-occluder-v3.glb":"sha384-bmKKYb7k1qsGqkOSUBwv3oqI9eOche97/OvRxXDxrqZAgqpy+4PJ5HU9O94lrjFO","/assets/xr/3d-models/shoulder-occluder-v1.glb":"sha384-iXxOvC+IoXfgpf8S/JSsV6lLzzLs6vtmaslJy7R0iLtl5Yb17U+/ATfGdhpmamae","/assets/xr/models/hair_segmenter.tflite":"sha384-1Eu/EdJcYV/7talPYVVbxPZBLg7UIxqsKisUNh/pEsyvAuUcE49HuqijSXWSHXHK","/mediapipe-models/image_segmenter/hair_segmenter/float32/latest/hair_segmenter.tflite":"sha384-1Eu/EdJcYV/7talPYVVbxPZBLg7UIxqsKisUNh/pEsyvAuUcE49HuqijSXWSHXHK","/assets/xr/models/selfie_multiclass_256x256.tflite":"sha384-LPLPyzBZ6TTE8146rnDx8CZ5LykB8memkmeO8FNVbGlNthvlUltn3W3KeJmtq9bL","/mediapipe-models/image_segmenter/selfie_multiclass_256x256/float32/latest/selfie_multiclass_256x256.tflite":"sha384-LPLPyzBZ6TTE8146rnDx8CZ5LykB8memkmeO8FNVbGlNthvlUltn3W3KeJmtq9bL","/assets/xr/models/holistic_landmarker.task":"sha384-6Y2fQ5yP5QtlvJIasfv0fHEyoMqRYYpLtEpsyeXjYDOuFCEXfKIZPZSXq8TLXmsg","/mediapipe-models/holistic_landmarker/holistic_landmarker/float16/latest/holistic_landmarker.task":"sha384-6Y2fQ5yP5QtlvJIasfv0fHEyoMqRYYpLtEpsyeXjYDOuFCEXfKIZPZSXq8TLXmsg","/assets/sdk/face/v1/canonical_face_model.obj":"sha384-xP8YM/72TXKvbMptXB9a8JUlUf3MZQ8uLurExrsZc05v6/P5RrsaNGMUYS/BZx8A","/opencv/facial_expression_recognition/resolve/main/facial_expression_recognition_mobilefacenet_2022july_int8.onnx":"sha384-g8mtFubiIc/yhqi591RsxD76AJLw2CfYgKhKbVkIiFlwBmIyG7ZAIVyGPXafrDGB"};async function _t(e,s){const t=await fetch(e,s!=null&&s.signal?{signal:s.signal}:void 0);if(!t.ok)throw new Error(`fetchAndVerify: ${t.status} ${e}`);const n=await t.arrayBuffer(),r=yn(e);if(!r){if(Pt(e))throw new Error(`[xr-sdk integrity] no SRI hash for SDK asset ${e}`);return console.warn(`[xr-sdk integrity] no SRI hash for ${e} — passing through`),n}const i=await wn(n);if(i!==r)throw new Error(`[xr-sdk integrity] SRI mismatch for ${e}: expected ${r}, got ${i}`);return n}function Pt(e){try{return new URL(e).origin===new URL(B.assetStorageEndpoint).origin}catch{return!1}}async function ee(e){const s=await _t(e);return new Uint8Array(s)}const ce=new Map;function Lt(e){let s=ce.get(e);if(!s){const r={bytes:ee(e),holders:0};r.bytes.catch(()=>{ce.get(e)===r&&ce.delete(e)}),ce.set(e,r),s=r}const t=s;t.holders+=1;let n=!1;return{bytes:t.bytes,release:()=>{n||(n=!0,t.holders-=1,t.holders<=0&&ce.get(e)===t&&ce.delete(e))}}}function yn(e){try{const s=new URL(e);return pn[s.pathname]}catch{return}}async function wn(e){const s=await crypto.subtle.digest("SHA-384",e),t=new Uint8Array(s);let n="";for(let r=0;r<t.byteLength;r++)n+=String.fromCharCode(t[r]);return`sha384-${btoa(n)}`}const He=new Map;function $(e){const s=e.wasmBinaryPath;let t=He.get(s);return t||(t=vn(s).catch(()=>{He.delete(s)}),He.set(s,t)),t}async function vn(e){const s=await fetch(e,{credentials:"same-origin"});if(!s.ok||!s.body)throw new Error(`warmVisionWasm: ${s.status} ${e}`);const t=s.body.getReader();for(;;){const{done:n}=await t.read();if(n)return}}class te{constructor(){h(this,"disposed",!1);h(this,"paused",!1);h(this,"rafId",null);h(this,"statInferenceMs",null);h(this,"statInferences",0);h(this,"statWindowStart",0);h(this,"statWindowCount",0);h(this,"statFps",0);h(this,"statSkipped",0);h(this,"statDetections",null);h(this,"statConfidence",null);h(this,"statStatus","ready");h(this,"statError",null);h(this,"targetFrameIntervalMs",0);h(this,"lastInferenceMs",0);h(this,"analysisScale",1)}recordInference(s,t=performance.now()){const n=t-s;this.statInferenceMs=n,this.statInferences+=1,this.statWindowCount+=1,this.statWindowStart===0&&(this.statWindowStart=t);const r=t-this.statWindowStart;return r>=1e3&&(this.statFps=this.statWindowCount*1e3/r,this.statWindowStart=t,this.statWindowCount=0),n}recordDetections(s,t=null){this.statDetections=s,this.statConfidence=t}recordInferenceError(s){this.statStatus=s?"error":"ready",this.statError=s}getDiagnostics(){const s=this.statWindowStart>0&&performance.now()-this.statWindowStart>1500;return{inferenceMs:this.statInferenceMs,inferenceFps:s?0:this.statFps,inferences:this.statInferences,skippedFrames:this.statSkipped,detections:this.statDetections,confidence:this.statConfidence,status:this.statStatus,error:this.statError,paused:this.paused,disposed:this.disposed}}setAnalysisScale(s){this.analysisScale=s!==void 0&&Number.isFinite(s)&&s>0?Math.min(1,Math.max(.25,s)):1}setTargetFps(s){this.targetFrameIntervalMs=s&&s>0?1e3/s:0}shouldRunInference(){if(this.targetFrameIntervalMs<=0)return!0;const s=performance.now();return s-this.lastInferenceMs<this.targetFrameIntervalMs?(this.statSkipped+=1,!1):(this.lastInferenceMs=s,!0)}async initialize(s){}async run(s){}getModelNode(){return{}}async getPerformanceData(){return{name:this.constructor.name,processingTime:null}}pause(){this.paused=!0,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}resume(){this.paused=!1}dispose(){this.disposed=!0,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}}const Sn=768;class Mn extends te{constructor(){super();h(this,"landmarker",null);h(this,"processingTime",null);h(this,"coordinates");h(this,"visibility");h(this,"sourceCanvas");h(this,"downscaler",new me(Sn))}async getBodyData(){if(!this.landmarker||!this.sourceCanvas)return;const t=this.downscaler.draw(this.sourceCanvas),n=performance.now(),r=this.landmarker.detectForVideo(t,n),i=performance.now();this.processingTime=i-n,this.recordInference(n,i);const c=r.landmarks,o=c==null?void 0:c[0];this.recordDetections((c==null?void 0:c.length)??0,o&&o.length?o.reduce((u,m)=>u+(m.visibility??0),0)/o.length:null);const d=[],l=[];if(c)return c.forEach((u,m)=>{d[m]||(d[m]=[],l[m]=[]),u.forEach(y=>{d[m].push(le(y)),l[m].push(y.visibility??1)})}),{coordinatesList:d,visibilityList:l}}async processBodyTracking(){if(!(this.disposed||this.paused||!this.landmarker)){if(this.shouldRunInference()){const t=await this.getBodyData();t&&(this.coordinates=t.coordinatesList,this.visibility=t.visibilityList)}this.disposed||this.paused||(this.rafId=requestAnimationFrame(this.processBodyTracking.bind(this)))}}resume(){this.paused&&(super.resume(),this.processBodyTracking())}dispose(){if(super.dispose(),this.landmarker){try{this.landmarker.close()}catch{}this.landmarker=null}this.sourceCanvas=void 0,this.downscaler.dispose(),this.coordinates=void 0,this.visibility=void 0}getLandmarks2D(t=0){if(this.coordinates)return this.coordinates[t]}getVisibility(t=0){var n;return(n=this.visibility)==null?void 0:n[t]}async initialize(t){const n=await q.FilesetResolver.forVisionTasks(new URL("/assets/xr/wasm",B.assetStorageEndpoint).toString()),[r]=await Promise.all([ee(new URL("/assets/xr/models/body_tracking.task",B.assetStorageEndpoint).toString()),$(n)]);this.landmarker=await q.PoseLandmarker.createFromOptions(n,{baseOptions:{modelAssetBuffer:r,delegate:"GPU"},runningMode:"VIDEO",numPoses:(t==null?void 0:t.numPoses)||1})}async run({sourceCanvas:t,targetFps:n,analysisScale:r}){this.setAnalysisScale(r),this.downscaler.setScale(this.analysisScale),this.sourceCanvas=t,this.setTargetFps(n),this.rafId===null&&await this.processBodyTracking()}getModelNode(){return{getLandmarks2D:this.getLandmarks2D.bind(this),getVisibility:this.getVisibility.bind(this)}}async getPerformanceData(){return{name:this.constructor.name,processingTime:this.processingTime}}}const Dt=Symbol("xr.modelNodeSource"),Cn=e=>e[Dt]??e,kn=.11,xn=.004,Ot="/assets/xr/models/face_tracking.task",Ht="/assets/xr/wasm",Tn=(e,s,t=!0)=>t?s.set(e.x,-e.y,e.z):s.set(e.x,e.y,-e.z),bn=(e,s)=>s.setFromRotationMatrix(e).normalize();class En extends te{constructor(){super();h(this,"landmarker",null);h(this,"modelBytes",null);h(this,"processingTime",null);h(this,"sourceCanvas");h(this,"analysisCanvas");h(this,"getSource");h(this,"detectionResults");h(this,"numFaces",1);h(this,"cameras",[]);h(this,"faces",[]);h(this,"leftCheekScratch",[]);h(this,"rightCheekScratch",[]);h(this,"rotMatrixScratch",new W.Matrix4);h(this,"rotQuatScratch",new W.Quaternion);h(this,"rotEulerScratch",new W.Euler)}extractAndUpdateFaceData(t){var i;if(!t.faceLandmarks.length){this.faces=[];return}const n=t.faceLandmarks.length;this.faces.length>n&&(this.faces.length=n,this.leftCheekScratch.length=n,this.rightCheekScratch.length=n);const r=ge((i=this.getSource)==null?void 0:i.call(this));for(;this.faces.length<n;)this.faces.push({transform:{position:new W.Vector3,rotation:new W.Vector3,quaternion:new W.Quaternion,scale:new W.Vector3},gestures:{},mirrored:r}),this.leftCheekScratch.push(new W.Vector3),this.rightCheekScratch.push(new W.Vector3);for(let c=0;c<n;c+=1)this.faces[c].mirrored=r;for(let c=0;c<n;c+=1){if(!this.cameras[c])continue;const o=this.faces[c],d=t.faceLandmarks[c],l=t.facialTransformationMatrixes[c];this.rotMatrixScratch.fromArray(l.data),bn(this.rotMatrixScratch,o.transform.quaternion),this.rotQuatScratch.copy(o.transform.quaternion),this.rotQuatScratch.set(-this.rotQuatScratch.x,this.rotQuatScratch.y,this.rotQuatScratch.z,this.rotQuatScratch.w),this.rotEulerScratch.setFromQuaternion(this.rotQuatScratch,"XYZ"),Tn(this.rotEulerScratch,o.transform.rotation,r),ve(d[4],this.cameras[c],o.transform.position),ve(d[50],this.cameras[c],this.leftCheekScratch[c]),ve(d[280],this.cameras[c],this.rightCheekScratch[c]);const m=this.leftCheekScratch[c].distanceTo(this.rightCheekScratch[c])*kn,y=Math.abs(W.MathUtils.radToDeg(this.rotEulerScratch.y)),S=m+y*xn,M=o.transform.scale.x,C=gn(isNaN(M)?0:M,S);o.transform.scale.set(C,C,C);const E=o.gestures,P=t.faceBlendshapes[c].categories;for(const g of P)E[g.categoryName]=g.score}}async processFaceTracking(){if(this.disposed||this.paused||!this.landmarker||!this.sourceCanvas)return null;if(!this.shouldRunInference()){this.rafId=requestAnimationFrame(this.processFaceTracking.bind(this));return}const t=An(this.numFaces)*this.analysisScale,n=this.sourceCanvas.width,r=this.sourceCanvas.height,i=Math.min(1,t/Math.max(n,r)),c=Math.max(1,Math.round(n*i)),o=Math.max(1,Math.round(r*i));(!this.analysisCanvas||this.analysisCanvas.width!==c||this.analysisCanvas.height!==o)&&(this.analysisCanvas=new OffscreenCanvas(c,o));const d=this.analysisCanvas.getContext("2d");if(!d){this.rafId=requestAnimationFrame(this.processFaceTracking.bind(this));return}d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,c,o),d.drawImage(this.sourceCanvas,0,0,c,o);const l=performance.now(),u=this.landmarker.detectForVideo(this.analysisCanvas,l),m=performance.now();this.processingTime=m-l,this.recordInference(l,m),this.recordDetections(u.faceLandmarks.length,null),this.detectionResults=u,this.extractAndUpdateFaceData(u),!(this.disposed||this.paused)&&(this.rafId=requestAnimationFrame(this.processFaceTracking.bind(this)))}resume(){this.paused&&(super.resume(),this.processFaceTracking())}dispose(){if(super.dispose(),this.landmarker){try{this.landmarker.close()}catch{}this.landmarker=null}this.releaseModelBytes(),this.sourceCanvas=void 0,this.getSource=void 0,this.analysisCanvas=void 0,this.detectionResults=void 0,this.processingTime=null,this.cameras=[],this.faces=[],this.leftCheekScratch=[],this.rightCheekScratch=[]}getFace(t=0){return this.faces[t]}getDetectionResults(){return this.detectionResults}getRawFaceTrackingData(t=0){var n,r,i,c;if(this.detectionResults)return{landmarks:(n=this.detectionResults.faceLandmarks)==null?void 0:n[t],blendshapes:(i=(r=this.detectionResults.faceBlendshapes)==null?void 0:r[t])==null?void 0:i.categories,transformationMatrix:(c=this.detectionResults.facialTransformationMatrixes)==null?void 0:c[t]}}async initialize(t){var c;this.numFaces=(t==null?void 0:t.numFaces)||1;const n=await q.FilesetResolver.forVisionTasks(new URL(Ht,B.assetStorageEndpoint).toString());(c=this.modelBytes)==null||c.release();const r=Lt(new URL(Ot,B.assetStorageEndpoint).toString());this.modelBytes=r;let i;try{const[o]=await Promise.all([r.bytes,$(n)]);i=await q.FaceLandmarker.createFromOptions(n,{baseOptions:{modelAssetBuffer:o,delegate:"GPU"},minFaceDetectionConfidence:.3,minFacePresenceConfidence:.3,minTrackingConfidence:.3,outputFaceBlendshapes:!0,outputFacialTransformationMatrixes:!0,runningMode:"VIDEO",numFaces:this.numFaces})}catch(o){throw this.releaseModelBytes(r),o}if(this.disposed){i.close(),this.releaseModelBytes(r);return}this.landmarker=i}releaseModelBytes(t=this.modelBytes){t==null||t.release(),this.modelBytes===t&&(this.modelBytes=null)}async run({sourceCanvas:t,getSource:n,targetFps:r,analysisScale:i}){this.sourceCanvas=t,this.getSource=n,this.setTargetFps(r),this.setAnalysisScale(i),this.analysisCanvas=void 0,this.rafId===null&&this.processFaceTracking()}getModelNode(){const t=this,n={get detectionResults(){return t.detectionResults},get numFaces(){return t.numFaces},getDetectionResults:this.getDetectionResults.bind(this),getFace:this.getFace.bind(this),getRawFaceTrackingData:this.getRawFaceTrackingData.bind(this),setCamera:(r,i=0)=>{this.cameras[i]=r}};return Object.defineProperty(n,Dt,{value:t}),n}async getPerformanceData(){return{name:this.constructor.name,processingTime:this.processingTime}}}const An=e=>e>1?1024:512;var Q=(e=>(e.ClosedFist="closed_fist",e.OpenPalm="open_palm",e.PointingUp="pointing_up",e.ThumbDown="thumb_down",e.ThumbUp="thumb_up",e.Victory="victory",e.ILoveYou="i_love_you",e.None="none",e))(Q||{});const Rn=512,Fn={Closed_Fist:Q.ClosedFist,Open_Palm:Q.OpenPalm,Pointing_Up:Q.PointingUp,Thumb_Down:Q.ThumbDown,Thumb_Up:Q.ThumbUp,Victory:Q.Victory,ILoveYou:Q.ILoveYou,None:Q.None},In=15;class _n extends te{constructor(){super();h(this,"landmarker",null);h(this,"processingTime",null);h(this,"coordinates");h(this,"gesture");h(this,"sourceCanvas");h(this,"downscaler",new me(Rn))}async getGestureData(){var d,l;if(!this.landmarker||!this.sourceCanvas)return;const t=this.downscaler.draw(this.sourceCanvas),n=performance.now(),r=this.landmarker.recognizeForVideo(t,n),i=performance.now();this.processingTime=i-n,this.recordInference(n,i),this.recordDetections(r.landmarks.length,((l=(d=r.gestures[0])==null?void 0:d[0])==null?void 0:l.score)??null);const c=r.landmarks[0],o=[];if(c){const u=r.gestures[0][0].categoryName;return c.forEach(m=>{o.push(le(m))}),{coordinates:o,gesture:Fn[u]}}return{coordinates:void 0,gesture:void 0}}async processGestureTracking(){if(!this.disposed){if(this.shouldRunInference()){const t=await this.getGestureData();t&&(this.coordinates=t.coordinates,this.gesture=t.gesture)}this.disposed||this.paused||(this.rafId=requestAnimationFrame(this.processGestureTracking.bind(this)))}}resume(){this.paused&&(super.resume(),this.processGestureTracking())}dispose(){if(super.dispose(),this.landmarker){try{this.landmarker.close()}catch{}this.landmarker=null}this.sourceCanvas=void 0,this.downscaler.dispose(),this.coordinates=void 0,this.gesture=void 0}async initialize(){const t=await q.FilesetResolver.forVisionTasks(new URL("/assets/xr/wasm",B.assetStorageEndpoint).toString()),[n]=await Promise.all([ee(new URL("/assets/xr/models/gesture_tracking.task",B.assetStorageEndpoint).toString()),$(t)]),r=await q.GestureRecognizer.createFromOptions(t,{baseOptions:{modelAssetBuffer:n,delegate:"GPU"},runningMode:"VIDEO",numHands:1});this.landmarker=r}async run({sourceCanvas:t,targetFps:n,analysisScale:r}){this.setAnalysisScale(r),this.downscaler.setScale(this.analysisScale),this.sourceCanvas=t,this.setTargetFps(n??In),this.rafId===null&&await this.processGestureTracking()}getModelNode(){const t=this;return{get coordinates(){return t.coordinates},get gesture(){return t.gesture}}}async getPerformanceData(){return{name:this.constructor.name,processingTime:this.processingTime}}}class Pn extends te{constructor(){super();h(this,"landmarker",null);h(this,"status","loading");h(this,"error",null);h(this,"processingTime",null);h(this,"sourceCanvas");h(this,"getSource");h(this,"downscaler",new me(Se().analysisMaxDimension));h(this,"raw");h(this,"delegatePolicy","auto");h(this,"delegate","GPU");h(this,"vision",null);h(this,"modelBuffer",null);h(this,"graphOptions",{});h(this,"rebuilding",!1);h(this,"fallbackAttempted",!1);h(this,"result",Bs());h(this,"builder",new Ws);h(this,"node");this.node={getResult:()=>this.result,getRawResult:()=>this.raw,getStatus:()=>this.status,getError:()=>this.error,getDelegate:()=>this.delegate,setOptions:t=>this.setRuntimeOptions(t)}}setRuntimeOptions(t){const n=this.builder.getOptions().analysisMaxDimension;this.builder.setOptions(t);const r=this.builder.getOptions().analysisMaxDimension;r!==n&&(this.downscaler.dispose(),this.downscaler=new me(r),this.downscaler.setScale(this.analysisScale))}async initialize(t){this.status="loading",this.error=null,this.setRuntimeOptions(t??{});try{const n=await q.FilesetResolver.forVisionTasks(new URL("/assets/xr/wasm",B.assetStorageEndpoint).toString()),[r]=await Promise.all([ee((t==null?void 0:t.modelUrl)??ze),$(n)]);this.vision=n,this.modelBuffer=r,this.graphOptions={runningMode:"VIDEO",outputFaceBlendshapes:(t==null?void 0:t.outputFaceBlendshapes)??!0,minFaceDetectionConfidence:t==null?void 0:t.minFaceDetectionConfidence,minFacePresenceConfidence:t==null?void 0:t.minFacePresenceConfidence,minPoseDetectionConfidence:t==null?void 0:t.minPoseDetectionConfidence,minPosePresenceConfidence:t==null?void 0:t.minPosePresenceConfidence,minHandLandmarksConfidence:t==null?void 0:t.minHandLandmarksConfidence},this.delegatePolicy=(t==null?void 0:t.delegate)??"auto",this.delegate=this.delegatePolicy==="CPU"?"CPU":"GPU";const i=await this.createLandmarker(this.delegate);if(this.disposed){i.close();return}this.landmarker=i,this.status="ready"}catch(n){throw this.status="error",this.error=n instanceof Error?n:new Error(String(n)),this.error}}createLandmarker(t){if(!this.vision||!this.modelBuffer)throw new Error("HolisticTrackingModel: initialize() has not loaded the model");return q.HolisticLandmarker.createFromOptions(this.vision,{baseOptions:{modelAssetBuffer:this.modelBuffer,delegate:t},...this.graphOptions})}async fallbackToCpu(t){this.fallbackAttempted=!0,this.rebuilding=!0,this.status="loading",console.warn("[xr-sdk holistic] GPU inference failed; rebuilding the graph on the CPU delegate.",t.message);const n=this.landmarker;try{const r=await this.createLandmarker("CPU");if(this.disposed){r.close();return}this.landmarker=r,this.delegate="CPU",this.status="ready",this.error=null;try{n==null||n.close()}catch{}this.rebuilding=!1,this.detectOnce()}catch(r){this.rebuilding=!1,this.status="error",this.error=r instanceof Error?r:new Error(String(r))}}detectOnce(){this.disposed||!this.landmarker||!this.sourceCanvas||(this.detect(),this.builder.update(this.raw,performance.now(),this.result,this.isMirrored()))}detect(){var r,i,c,o,d;if(!this.landmarker||!this.sourceCanvas)return;const t=this.downscaler.draw(this.sourceCanvas),n=performance.now();try{this.raw=this.landmarker.detectForVideo(t,n),this.status==="error"&&(this.status="ready",this.error=null),this.recordInferenceError(null);const l=this.raw,u=((r=l.faceLandmarks)!=null&&r.length?1:0)+((i=l.leftHandLandmarks)!=null&&i.length?1:0)+((c=l.rightHandLandmarks)!=null&&c.length?1:0)+((o=l.poseLandmarks)!=null&&o.length?1:0),m=(d=l.poseLandmarks)==null?void 0:d[0];this.recordDetections(u,m&&m.length?m.reduce((y,S)=>y+(S.visibility??0),0)/m.length:null)}catch(l){const u=l instanceof Error?l:new Error(String(l));this.delegatePolicy==="auto"&&this.delegate==="GPU"&&!this.fallbackAttempted?this.fallbackToCpu(u):(this.status="error",this.error=u,this.recordInferenceError(u))}this.processingTime=performance.now()-n,this.recordInference(n)}isMirrored(){var t;return ge((t=this.getSource)==null?void 0:t.call(this))}async run({sourceCanvas:t,getSource:n,targetFps:r,analysisScale:i}){this.sourceCanvas=t,this.getSource=n,this.setTargetFps(r),this.setAnalysisScale(i),this.downscaler.setScale(this.analysisScale),this.rafId===null&&await this.process()}async process(){this.disposed||this.paused||!this.landmarker||(!this.rebuilding&&this.shouldRunInference()&&this.detect(),this.builder.update(this.raw,performance.now(),this.result,this.isMirrored()),!(this.disposed||this.paused)&&(this.rafId=requestAnimationFrame(this.process.bind(this))))}resume(){this.paused&&(super.resume(),this.process())}dispose(){if(super.dispose(),this.landmarker){try{this.landmarker.close()}catch{}this.landmarker=null}this.sourceCanvas=void 0,this.getSource=void 0,this.downscaler.dispose(),this.vision=null,this.modelBuffer=null,this.raw=void 0,this.builder.reset(),this.result.face=null,this.result.leftHand=null,this.result.rightHand=null,this.result.pose=null}getModelNode(){return this.node}async getPerformanceData(){return{name:this.constructor.name,processingTime:this.processingTime}}}const Nt=e=>e==="left"?"right":"left",Ut=(e,s)=>s?Nt(e):e,Ln=/left|right|Left|Right/,Dn={left:"right",right:"left",Left:"Right",Right:"Left"},Bt=e=>e.replace(Ln,s=>Dn[s]),On=(e,s)=>s?Bt(e):e,Hn=e=>e?-1:1,zt=["wrist","thumbCmc","thumbMcp","thumbIp","thumbTip","indexMcp","indexPip","indexDip","indexTip","middleMcp","middlePip","middleDip","middleTip","ringMcp","ringPip","ringDip","ringTip","pinkyMcp","pinkyPip","pinkyDip","pinkyTip"],Nn=Object.fromEntries(zt.map((e,s)=>[e,s])),Wt=200,ue=(e,s)=>Math.hypot(e.x-s.x,e.y-s.y),he=e=>e==="left"?"right":"left",Ne=(e,s,t)=>({handedness:s,score:e.score,world:e.world,image:e.image,timestampMs:t,held:!1}),qt=(e,s,t,{holdMs:n=Wt,confidentScore:r=.8,continuityMs:i=500}={})=>{const c=l=>!!l&&t-l.timestampMs<=i&&l.image.length>0,o={left:null,right:null},d=e.filter(l=>l.image.length>0).slice(0,2);if(d.length===2){const[l,u]=d,m=l.handedness!==void 0&&u.handedness!==void 0&&l.handedness!==u.handedness,y=l.score>=r&&u.score>=r;let S;if(m&&y)S=l.handedness;else if(c(s.left)&&c(s.right)){const M=ue(l.image[0],s.left.image[0])+ue(u.image[0],s.right.image[0]),C=ue(l.image[0],s.right.image[0])+ue(u.image[0],s.left.image[0]);S=M<=C?"left":"right"}else if(m)S=l.handedness;else{const M=l.score>=u.score?l:u,C=M.handedness??"right";S=M===l?C:he(C)}o[S]=Ne(l,S,t),o[he(S)]=Ne(u,he(S),t)}else if(d.length===1){const[l]=d;let u=l.handedness??"right";if(l.score<r||l.handedness===void 0){const m=M=>c(M)?ue(l.image[0],M.image[0]):1/0,y=m(s[u]);m(s[he(u)])<y&&(u=he(u))}o[u]=Ne(l,u,t)}for(const l of["left","right"]){const u=s[l];o[l]||!u||t-u.timestampMs<=n&&(o[l]={...u,held:!0})}return o},Vt=(e,s)=>{const t=e==null?void 0:e.toLowerCase();if(!(t!=="left"&&t!=="right"))return Ut(t,s)},Kt=(e,s={x:0,y:0,z:0})=>(s.x=e.x*100,s.y=-e.y*100,s.z=-e.z*100,s),Un=512,Bn=Object.freeze({minHandDetectionConfidence:.5,minHandPresenceConfidence:.65,minTrackingConfidence:.5});class zn extends te{constructor(){super();h(this,"landmarker",null);h(this,"processingTime",null);h(this,"hands");h(this,"coordinates");h(this,"gesture");h(this,"handedness");h(this,"poses",{left:null,right:null});h(this,"sourceCanvas");h(this,"getSource");h(this,"downscaler",new me(Un))}async getHandData(){var m,y,S;if(!this.landmarker||!this.sourceCanvas)return;const t=this.downscaler.draw(this.sourceCanvas),n=performance.now(),r=this.landmarker.detectForVideo(t,n),i=performance.now();this.processingTime=i-n,this.recordInference(n,i);const c=[],o=[],d=r.handedness??r.handednesses??[];this.recordDetections(r.landmarks.length,((y=(m=d[0])==null?void 0:m[0])==null?void 0:y.score)??null);const l=ge((S=this.getSource)==null?void 0:S.call(this));if(r.landmarks.forEach((M,C)=>{var N,b;if(!M||M.length===0)return;const E=M.map(z=>le(z)),P=(((N=r.worldLandmarks)==null?void 0:N[C])??[]).map(z=>Kt(z)),g=(b=d[C])==null?void 0:b[0],v=Vt(g==null?void 0:g.categoryName,l),w=(g==null?void 0:g.score)??0,x=M[0].z<0?"closed_fist":"open_palm";c.push({coordinates:E,worldCoordinates:P,gesture:x,handedness:v,handednessScore:w}),o.push({handedness:v,score:w,world:P,image:E})}),this.poses=qt(o,this.poses,n),!c.length)return{hands:void 0,coordinates:void 0,gesture:void 0,handedness:void 0};const u=c[0];return{hands:c,coordinates:u.coordinates,gesture:u.gesture,handedness:u.handedness}}async processHandTracking(){if(!this.disposed){if(this.shouldRunInference()){const t=await this.getHandData();t&&(this.hands=t.hands,this.coordinates=t.coordinates,this.gesture=t.gesture,this.handedness=t.handedness)}this.disposed||this.paused||(this.rafId=requestAnimationFrame(this.processHandTracking.bind(this)))}}resume(){this.paused&&(super.resume(),this.processHandTracking())}dispose(){if(super.dispose(),this.landmarker){try{this.landmarker.close()}catch{}this.landmarker=null}this.sourceCanvas=void 0,this.getSource=void 0,this.hands=void 0,this.poses={left:null,right:null},this.downscaler.dispose(),this.coordinates=void 0,this.gesture=void 0,this.handedness=void 0}async initialize(){const t=await q.FilesetResolver.forVisionTasks(new URL("/assets/xr/wasm",B.assetStorageEndpoint).toString()),[n]=await Promise.all([ee(new URL("/assets/xr/models/hand_tracking.task",B.assetStorageEndpoint).toString()),$(t)]),r=await q.HandLandmarker.createFromOptions(t,{baseOptions:{modelAssetBuffer:n,delegate:"GPU"},runningMode:"VIDEO",numHands:2,...Bn});this.landmarker=r}async run({sourceCanvas:t,getSource:n,targetFps:r,analysisScale:i}){this.getSource=n,this.setAnalysisScale(i),this.downscaler.setScale(this.analysisScale),this.sourceCanvas=t,this.setTargetFps(r),this.rafId===null&&await this.processHandTracking()}getModelNode(){const t=this;return{get hands(){return t.hands},get coordinates(){return t.coordinates},get gesture(){return t.gesture},get handedness(){return t.handedness},get poses(){return t.poses},getHandPose:n=>t.poses[n]}}async getPerformanceData(){return{name:this.constructor.name,processingTime:this.processingTime}}}const Wn=24,qn=720,Vn=[[255,255,255,255],[0,0,0,0]];class Kn extends te{constructor(){super();h(this,"segmenter",null);h(this,"processingTime",null);h(this,"sourceCanvas");h(this,"processCanvas");h(this,"filterCanvas");h(this,"inputSource");h(this,"inputSourceSize");h(this,"glCanvas");h(this,"drawingUtils");h(this,"useGpuMaskPath",!1);h(this,"maskImageData");h(this,"maskCanvas",null);h(this,"segmentationMaskTexture");h(this,"isMaskSetup",!1);h(this,"isProcessing",!1);h(this,"latestMask",null);h(this,"rawCache",null);h(this,"latestMaskTimeMs",0);h(this,"quality","medium");h(this,"stagingCanvas")}getQualityScaleFactor(){switch(this.quality){case"low":return .5;case"medium":return .75;case"high":return 1;default:return .5}}setInputSource(t){this.inputSource=t,this.inputSourceSize=t?this.readIntrinsicSize(t):void 0}readIntrinsicSize(t){if(t instanceof HTMLVideoElement)return t.videoWidth>0?{width:t.videoWidth,height:t.videoHeight}:void 0;if(t instanceof HTMLImageElement)return t.naturalWidth>0?{width:t.naturalWidth,height:t.naturalHeight}:void 0;const n=t.width,r=t.height;return typeof n=="number"&&n>0&&typeof r=="number"&&r>0?{width:n,height:r}:void 0}ensureProcessCanvasForInput(){if(!this.processCanvas||!this.inputSource)return;const t=this.readIntrinsicSize(this.inputSource);if(!t)return;this.inputSourceSize=t;const n=Math.min(1,qn/Math.max(t.width,t.height)),r=Math.max(1,Math.round(t.width*n)),i=Math.max(1,Math.round(t.height*n));this.processCanvas.width===r&&this.processCanvas.height===i||(this.processCanvas.width=r,this.processCanvas.height=i,this.glCanvas&&(this.glCanvas.width=r,this.glCanvas.height=i),this.maskImageData=void 0)}async processSegmentation(){if(this.disposed||!this.isProcessing||!this.maskCanvas||!this.processCanvas)return;if(!this.shouldRunInference()){if(this.disposed||this.paused)return;this.rafId=requestAnimationFrame(this.processSegmentation.bind(this));return}const t=this.inputSource??this.sourceCanvas;if(!this.segmenter||!t){if(this.disposed||this.paused)return;this.rafId=requestAnimationFrame(this.processSegmentation.bind(this));return}const n=performance.now();this.ensureProcessCanvasForInput();const r=this.processCanvas.getContext("2d");if(r){const d=this.processCanvas.width,l=this.processCanvas.height;if(r.clearRect(0,0,d,l),this.inputSource&&this.inputSourceSize){const{width:u,height:m}=this.inputSourceSize,y=Math.min(d/u,l/m),S=u*y,M=m*y;r.drawImage(this.inputSource,(d-S)/2,(l-M)/2,S,M)}else r.drawImage(t,0,0,d,l)}const i=performance.now(),o=this.segmenter.segmentForVideo(this.processCanvas,i).categoryMask;if(!o){if(this.disposed||this.paused)return;this.rafId=requestAnimationFrame(this.processSegmentation.bind(this));return}if(this.rawCache=null,this.latestMaskTimeMs=i,this.latestMask&&(this.latestMask.close(),this.latestMask=null),this.useGpuMaskPath&&this.drawingUtils&&this.glCanvas)this.drawingUtils.drawCategoryMask(o,Vn),this.latestMask=o.clone(),o.close(),this.blitGlToMask();else{this.latestMask=o.clone();const d=this.readMaskToImageData(o);o.close(),d&&this.blitImageDataToMask(d)}this.segmentationMaskTexture&&(this.isMaskSetup||(this.segmentationMaskTexture.format=X.RGBAFormat,this.segmentationMaskTexture.minFilter=X.LinearFilter,this.segmentationMaskTexture.magFilter=X.LinearFilter,this.segmentationMaskTexture.generateMipmaps=!1,this.isMaskSetup=!0),this.segmentationMaskTexture.needsUpdate=!0),this.processingTime=performance.now()-n,this.recordInference(n),this.recordDetections(1,null),!(this.disposed||this.paused)&&(this.rafId=requestAnimationFrame(this.processSegmentation.bind(this)))}blitGlToMask(){if(!this.maskCanvas||!this.filterCanvas||!this.glCanvas)return;const t=this.maskCanvas.getContext("2d"),n=this.filterCanvas.getContext("2d");!t||!n||(n.filter="blur(0.5px)",n.clearRect(0,0,this.filterCanvas.width,this.filterCanvas.height),n.drawImage(this.glCanvas,0,0,this.filterCanvas.width,this.filterCanvas.height),t.clearRect(0,0,this.maskCanvas.width,this.maskCanvas.height),t.drawImage(this.filterCanvas,0,0,this.maskCanvas.width,this.maskCanvas.height))}readMaskToImageData(t){const n=t.getAsUint8Array(),{width:r,height:i}=t;if(!n||r<=0||i<=0)return null;(!this.maskImageData||this.maskImageData.width!==r||this.maskImageData.height!==i)&&(this.maskImageData=new ImageData(r,i));const c=this.maskImageData.data;for(let o=0;o<n.length;o+=1){const d=n[o]===255?0:255;c[o*4]=255,c[o*4+1]=d,c[o*4+2]=255,c[o*4+3]=d}return this.maskImageData}blitImageDataToMask(t){if(!this.maskCanvas||!this.filterCanvas)return;const n=this.maskCanvas.getContext("2d"),r=this.filterCanvas.getContext("2d");if(!n||!r)return;const i=this.getStagingCanvas(t.width,t.height),c=i.getContext("2d");c&&(c.putImageData(t,0,0),r.filter="blur(0.5px)",r.clearRect(0,0,this.filterCanvas.width,this.filterCanvas.height),r.drawImage(i,0,0,this.filterCanvas.width,this.filterCanvas.height),n.clearRect(0,0,this.maskCanvas.width,this.maskCanvas.height),n.drawImage(this.filterCanvas,0,0,this.maskCanvas.width,this.maskCanvas.height))}getStagingCanvas(t,n){return this.stagingCanvas||(this.stagingCanvas=document.createElement("canvas")),this.stagingCanvas.width!==t&&(this.stagingCanvas.width=t),this.stagingCanvas.height!==n&&(this.stagingCanvas.height=n),this.stagingCanvas}resume(){this.paused&&(super.resume(),this.processSegmentation())}dispose(){if(super.dispose(),this.isProcessing=!1,this.latestMask){try{this.latestMask.close()}catch{}this.latestMask=null}if(this.rawCache=null,this.segmenter){try{this.segmenter.close()}catch{}this.segmenter=null}this.drawingUtils=void 0,this.glCanvas=void 0,this.maskImageData=void 0,this.segmentationMaskTexture&&(this.segmentationMaskTexture.dispose(),this.segmentationMaskTexture=void 0),this.sourceCanvas=void 0,this.inputSource=void 0,this.inputSourceSize=void 0,this.processCanvas=void 0,this.filterCanvas=void 0,this.stagingCanvas=void 0,this.maskCanvas=null}async initialize(t){this.quality=(t==null?void 0:t.quality)??"low";const n=await q.FilesetResolver.forVisionTasks(new URL("/assets/xr/wasm",B.assetStorageEndpoint).toString()),[r]=await Promise.all([ee(new URL("/assets/xr/models/segmentation.tflite",B.assetStorageEndpoint).toString()),$(n)]);this.glCanvas=new OffscreenCanvas(1,1);const i=this.glCanvas.getContext("webgl2",{preserveDrawingBuffer:!0});this.segmenter=await q.ImageSegmenter.createFromOptions(n,{baseOptions:{modelAssetBuffer:r,delegate:"GPU"},...i?{canvas:this.glCanvas}:{},outputCategoryMask:!0,outputConfidenceMasks:!1,runningMode:"VIDEO"}),i?(this.drawingUtils=new q.DrawingUtils(i),this.useGpuMaskPath=!0):this.useGpuMaskPath=!1}async run({sourceCanvas:t,renderWidth:n,renderHeight:r,targetFps:i}){var o;if(!t)return;this.setTargetFps(i??Wn),this.isProcessing=!1,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null);const c=this.getQualityScaleFactor();this.sourceCanvas=t,this.processCanvas=document.createElement("canvas"),this.processCanvas.width=t.width*c,this.processCanvas.height=t.height*c,this.glCanvas&&(this.glCanvas.width=this.processCanvas.width,this.glCanvas.height=this.processCanvas.height),this.maskImageData=void 0,this.maskCanvas=document.createElement("canvas"),this.maskCanvas.width=n,this.maskCanvas.height=r,this.filterCanvas=document.createElement("canvas"),this.filterCanvas.width=n,this.filterCanvas.height=r,(o=this.segmentationMaskTexture)==null||o.dispose(),this.segmentationMaskTexture=new X.CanvasTexture(this.maskCanvas),this.isMaskSetup=!1,this.rawCache=null,this.isProcessing=!0,this.lastInferenceMs=0,this.rafId=requestAnimationFrame(this.processSegmentation.bind(this))}getRawSegmentationData(){if(this.rawCache)return this.rawCache;if(!this.latestMask)return null;const t=this.latestMask.getAsUint8Array();return this.rawCache={maskData:t,width:this.latestMask.width,height:this.latestMask.height,timestampMs:this.latestMaskTimeMs},this.rawCache}getModelNode(){const t=this;return{get backgroundSegmentationMask(){return t.segmentationMaskTexture},getMaskCanvas:()=>t.maskCanvas,getRawSegmentationData:()=>t.getRawSegmentationData(),setInputSource:n=>t.setInputSource(n??void 0)}}async getPerformanceData(){return{name:this.constructor.name,processingTime:this.processingTime}}}const Xt=(e,s,t,n="feed")=>({width:Math.max(1,Math.round(e)),height:Math.max(1,Math.round(s)),indices:new Uint8Array(Math.max(1,Math.round(e))*Math.max(1,Math.round(s))),labels:t,space:n,version:0}),Xn=e=>{e.indices.fill(0)},Gn=(e,s)=>e.labels.indexOf(s),Gt=(e,s,t)=>{const{width:n,height:r,indices:i}=e,c=s.length;if(c<3)return;let o=1/0,d=-1/0;for(let y=0;y<c;y+=1){const S=s[y].y*r;S<o&&(o=S),S>d&&(d=S)}const l=Math.max(0,Math.floor(o)),u=Math.min(r-1,Math.ceil(d)),m=[];for(let y=l;y<=u;y+=1){const S=y+.5;m.length=0;for(let C=0;C<c;C+=1){const E=s[C],P=s[(C+1)%c],g=E.y*r,v=P.y*r;if(S<g==S<v)continue;const w=(S-g)/(v-g);m.push((E.x+w*(P.x-E.x))*n)}m.sort((C,E)=>C-E);const M=y*n;for(let C=0;C+1<m.length;C+=2){const E=Math.max(0,Math.round(m[C])),P=Math.min(n,Math.round(m[C+1]));for(let g=E;g<P;g+=1)i[M+g]=t}}},jn=(e,s,t,n,r=[])=>{r.length=0;for(let i=0;i<t.length;i+=1){const c=s[t[i]];if(!c)return;r.push(c)}Gt(e,r,n)},yt=e=>e,Be={hair:{labels:["bg","hair"],assetPath:"/assets/xr/models/hair_segmenter.tflite",defaultUrl:"https://storage.googleapis.com/mediapipe-models/image_segmenter/hair_segmenter/float32/latest/hair_segmenter.tflite",decode:yt},multiclass:{labels:["bg","hair","body_skin","face_skin","clothes","others"],assetPath:"/assets/xr/models/selfie_multiclass_256x256.tflite",defaultUrl:"https://storage.googleapis.com/mediapipe-models/image_segmenter/selfie_multiclass_256x256/float32/latest/selfie_multiclass_256x256.tflite",decode:yt}},Qn=(e,s,t)=>{const n=t.length===e.length?t:new Uint8Array(e.length);for(let r=0;r<e.length;r+=1)n[r]=s(e[r]);return n},Yn=15,Zn={low:.5,medium:.75,high:1};class Jn extends te{constructor(){super();h(this,"segmenter",null);h(this,"preset","hair");h(this,"quality","medium");h(this,"status","loading");h(this,"error",null);h(this,"processingTime",null);h(this,"sourceCanvas");h(this,"processCanvas");h(this,"isProcessing",!1);h(this,"mask",Xt(1,1,["bg"]));h(this,"node");this.node={getMask:()=>this.mask,getStatus:()=>this.status,getError:()=>this.error}}async initialize(t){this.preset=(t==null?void 0:t.preset)??"hair",this.quality=(t==null?void 0:t.quality)??"medium";const n=Be[this.preset];this.mask.labels=n.labels,this.status="loading",this.error=null;try{const r=await q.FilesetResolver.forVisionTasks(new URL("/assets/xr/wasm",B.assetStorageEndpoint).toString()),i=(t==null?void 0:t.modelUrl)??n.defaultUrl,[c]=await Promise.all([ee(i),$(r)]);this.segmenter=await q.ImageSegmenter.createFromOptions(r,{baseOptions:{modelAssetBuffer:c,delegate:"GPU"},outputCategoryMask:!0,outputConfidenceMasks:!1,runningMode:"VIDEO"}),this.status="ready"}catch(r){throw this.status="error",this.error=r instanceof Error?r:new Error(String(r)),this.error}}async run({sourceCanvas:t,targetFps:n}){t&&(this.setTargetFps(n??Yn),this.isProcessing=!1,this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.sourceCanvas=t,this.processCanvas=document.createElement("canvas"),this.isProcessing=!0,this.lastInferenceMs=0,this.rafId=requestAnimationFrame(this.process.bind(this)))}process(){if(this.disposed||this.paused||!this.isProcessing)return;const{segmenter:t,sourceCanvas:n,processCanvas:r}=this;if(!t||!n||!r||!this.shouldRunInference()){this.rafId=requestAnimationFrame(this.process.bind(this));return}const i=performance.now(),c=Zn[this.quality],o=Math.max(1,Math.round(n.width*c)),d=Math.max(1,Math.round(n.height*c));(r.width!==o||r.height!==d)&&(r.width=o,r.height=d);const l=r.getContext("2d");l&&l.drawImage(n,0,0,o,d);try{const m=t.segmentForVideo(r,performance.now()).categoryMask;if(m){const y=m.getAsUint8Array();(this.mask.width!==m.width||this.mask.height!==m.height)&&(this.mask.width=m.width,this.mask.height=m.height),this.mask.indices=Qn(y,Be[this.preset].decode,this.mask.indices),this.mask.version+=1,this.mask.timestampMs=i,m.close()}this.status==="error"&&(this.status="ready",this.error=null),this.recordInferenceError(null),this.recordDetections(m?1:0,null)}catch(u){this.status="error",this.error=u instanceof Error?u:new Error(String(u)),this.recordInferenceError(this.error)}this.processingTime=performance.now()-i,this.recordInference(i),!(this.disposed||this.paused)&&(this.rafId=requestAnimationFrame(this.process.bind(this)))}resume(){this.paused&&(super.resume(),this.isProcessing&&(this.rafId=requestAnimationFrame(this.process.bind(this))))}getModelNode(){return this.node}async getPerformanceData(){return{name:this.constructor.name,processingTime:this.processingTime}}dispose(){var t;super.dispose(),this.isProcessing=!1;try{(t=this.segmenter)==null||t.close()}catch{}this.segmenter=null,this.sourceCanvas=void 0,this.processCanvas=void 0}}const wt={[A.BACKGROUND_SEGMENTATION]:Kn,[A.SEMANTIC_SEGMENTATION]:Jn,[A.HAND_TRACKER]:zn,[A.GESTURE_TRACKER]:_n,[A.FACE_TRACKER]:En,[A.BODY_TRACKER]:Mn,[A.HOLISTIC_TRACKER]:Pn},$n=async e=>{const s=document.createElement("video");s.srcObject=e,s.muted=!0,s.playsInline=!0,s.autoplay=!0,await new Promise(n=>{s.onloadedmetadata=()=>{s.play(),n()}});const t=s;return await new Promise(n=>{const r=setTimeout(n,150),i=()=>{clearTimeout(r),n()};typeof t.requestVideoFrameCallback=="function"?t.requestVideoFrameCallback(i):requestAnimationFrame(()=>requestAnimationFrame(()=>i()))}),s},er=e=>{const s=new X.CanvasTexture(e);return s.colorSpace=X.SRGBColorSpace,s.format=X.RGBAFormat,s.minFilter=X.LinearFilter,s.magFilter=X.LinearFilter,s.generateMipmaps=!1,s.needsUpdate=!0,s},tr=(e,s)=>{const t=e.videoWidth,n=e.videoHeight;t>0&&n>0&&(s.width!==t&&(s.width=t),s.height!==n&&(s.height=n));const r=s.getContext("2d",{colorSpace:"srgb"});r.save(),r.scale(-1,1),r.drawImage(e,-s.width,0,s.width,s.height),r.restore()},sr=(e,s,t=1)=>{const n=s.getContext("2d",{colorSpace:"srgb"}),r=At({source:{width:e.width,height:e.height},feed:{width:s.width,height:s.height},zoom:t});r&&(n.setTransform(1,0,0,1,0,0),n.clearRect(0,0,s.width,s.height),n.drawImage(e,0,0,e.width,e.height,r.offsetX,r.offsetY,r.drawWidth,r.drawHeight))},nr=(e,s,t)=>{const n=new Map,r=new WeakSet;let i=!1;const c=(g,v)=>{const w=e.getSnapshot().modelErrors;if(v===null&&!w.has(g))return;const x=new Map(w);v===null?x.delete(g):x.set(g,{model:g,error:v,at:performance.now()}),e.set({modelErrors:x})},o=(g,v)=>{var w;try{(w=v.dispose)==null||w.call(v)}catch(x){console.warn(`[xr-sdk registry] dispose threw for ${g}`,x)}};return{acquire:async(g,v,w)=>{let x=n.get(g);if(x)return x.refs.add(v),x.activeRefs.add(v),x.initPromise;const N=s[g];if(!N)throw new Error(`Invalid model: ${g}`);const b=new N,z=new Set([v]),G=new Set([v]);c(g,null);const D=(async()=>{await b.initialize(w);const R=n.get(g);if(!R||R.model!==b||R.refs.size===0)return o(g,b),b;t&&await t(g,b);const K=n.get(g);return K&&K.refs.size>0&&(r.add(b),e.setPipeline(j=>j.set(g,b))),b})();return x={model:b,refs:z,activeRefs:G,initPromise:D,options:w},n.set(g,x),D.catch(R=>{n.get(g)===x&&(n.delete(g),e.setPipeline(j=>j.delete(g)),c(g,R instanceof Error?R:new Error(String(R)))),o(g,b)}),D},release:(g,v)=>{const w=n.get(g);w&&(w.refs.delete(v),w.activeRefs.delete(v)&&w.refs.size>0&&w.activeRefs.size===0&&w.model.pause(),!(w.refs.size>0)&&(n.delete(g),o(g,w.model),e.setPipeline(x=>x.delete(g))))},setActive:(g,v,w)=>{const x=n.get(g);if(!x||!x.refs.has(v))return;const N=x.activeRefs.size>0;w?x.activeRefs.add(v):x.activeRefs.delete(v);const b=x.activeRefs.size>0;N!==b&&(b&&!i?x.model.resume():x.model.pause())},suspendAll:()=>{i=!0;for(const g of n.values())g.model.pause()},resumeActive:()=>{i=!1;for(const g of n.values())g.activeRefs.size>0&&g.model.resume()},get:g=>{var v;return(v=n.get(g))==null?void 0:v.model},getOptions:g=>{var v;return(v=n.get(g))==null?void 0:v.options},releaseAll:()=>{for(const g of Array.from(n.keys())){const v=n.get(g);v&&(v.refs.clear(),n.delete(g),o(g,v.model))}e.setPipeline(g=>g.clear())},getState:g=>{const v=n.get(g);return v?r.has(v.model)?"ready":"initializing":e.getSnapshot().modelErrors.has(g)?"error":"idle"},getOwners:g=>{const v=n.get(g);return{refs:v?Array.from(v.refs):[],active:v?Array.from(v.activeRefs):[]}}}},rr={lifecycle:"idle",ready:!1,error:void 0,cameraTexture:void 0,renderWidth:0,renderHeight:0,source:void 0,sourceKind:void 0,cameraFacing:null,cameraDeviceId:null,orientation:{type:"portrait",angle:0},quality:null,qualityConfig:null,sourceWidth:0,sourceHeight:0,cameraZoom:1.2,pipeline:new Map,modelErrors:new Map,cameraPermission:"unknown",cameraPermissionReason:null,feedFrames:0},ir=()=>{let e={...rr,pipeline:new Map,modelErrors:new Map};const s=new Set,t=()=>{s.forEach(n=>n())};return{getSnapshot:()=>e,set:n=>{let r=!1;for(const i of Object.keys(n))if(n[i]!==e[i]){r=!0;break}r&&(e={...e,...n},t())},setPipeline:n=>{const r=new Map(e.pipeline);return n(r),e={...e,pipeline:r},t(),r},subscribe:n=>(s.add(n),()=>{s.delete(n)})}},vt=(e,s)=>s??e==="user",ar=({renderHeight:e,renderWidth:s,videoHeight:t,videoWidth:n})=>({height:e||t,width:s||n}),or=(e,s)=>{const t=new un({verbose:!0}),n=ir();n.set({cameraZoom:(e==null?void 0:e.cameraZoom)??1.2});let r=s,i=e;const c=a=>{var p;const f=(p=V.getOptions(a))==null?void 0:p.targetFps;return typeof f=="number"?f:i==null?void 0:i.targetFps};let o,d,l,u,m,y,S,M,C,E,P,g,v=!1,w=!1,x=!1,N=0,b,z,G,D=!1,R=0,K=new WeakSet;const j=new Set,pe=a=>{const f=n.getSnapshot().cameraTexture;f&&f.dispose();const p=er(a);return n.set({cameraTexture:p}),p},xe=async(a,f)=>{if(K.has(f)||n.getSnapshot().lifecycle!=="running"||!m)return;K.add(f);const p=R;try{await f.run({sourceCanvas:m,renderWidth:n.getSnapshot().renderWidth,renderHeight:n.getSnapshot().renderHeight,getSource:()=>n.getSnapshot().sourceKind,targetFps:c(a),analysisScale:i==null?void 0:i.analysisScale}),D&&(await new Promise(k=>requestAnimationFrame(()=>k())),await new Promise(k=>requestAnimationFrame(()=>k())),D&&R===p&&V.suspendAll())}catch(k){throw K.delete(f),k}},V=nr(n,wt,(a,f)=>xe(a,f));n.subscribe(()=>{if(n.getSnapshot().lifecycle!=="running")return;const a=n.getSnapshot().pipeline;for(const[f,p]of a.entries())K.has(p)||xe(f,p)});const Je=()=>{g!==void 0&&(cancelAnimationFrame(g),g=void 0)},se=()=>{if(Je(),b==null||b(),b=void 0,d){try{d.pause()}catch{}try{d.srcObject=null}catch{}d=void 0}if(l){try{l.getTracks().forEach(a=>a.stop())}catch{}l=void 0}},Te=()=>{if(v||!d||!u||!m)return;const a=typeof window<"u"?window.__xr_debugger_metrics:void 0;if(a!=null&&a.trackCameraFrame&&a.trackCameraFrame(),ge(n.getSnapshot().sourceKind))tr(d,u);else{const T=u.getContext("2d");if(!T)return;const L=d.videoWidth,O=d.videoHeight;u.width!==L&&(u.width=L),u.height!==O&&(u.height=O),T.setTransform(1,0,0,1,0,0),T.clearRect(0,0,L,O),T.drawImage(d,0,0,L,O)}sr(u,m,(i==null?void 0:i.cameraZoom)??1.2);const p=n.getSnapshot();(p.sourceWidth!==d.videoWidth||p.sourceHeight!==d.videoHeight)&&n.set({sourceWidth:d.videoWidth,sourceHeight:d.videoHeight}),N+=1,N%10===0&&n.set({feedFrames:N});const k=n.getSnapshot().cameraTexture;k&&(k.needsUpdate=!0)},be=()=>{if(!d||!u||!m)return;if(D){Te();return}const a=()=>{g=requestAnimationFrame(a),Te()};g=requestAnimationFrame(a)},cs=async(a,f)=>{if(a.source===F.WEBCAM)try{const p=i!=null&&i.camRes&&i.camRes>0?i.camRes:960;n.set({cameraPermission:"requesting",cameraPermissionReason:null});const k=a.deviceId?{deviceId:{exact:a.deviceId}}:{facingMode:{ideal:a.facingMode??"user"}},T={frameRate:{min:24,ideal:30,max:60},width:{ideal:p},...k};let L;try{L=await navigator.mediaDevices.getUserMedia({video:T})}catch(O){if(!(O instanceof DOMException&&O.name==="OverconstrainedError"))throw O;L=await navigator.mediaDevices.getUserMedia({video:{frameRate:{ideal:30},width:{ideal:p},...k}})}return f===R&&n.set({cameraPermission:"granted",cameraPermissionReason:null}),L}catch(p){const k=Ke(p),T=gt[k],L=await Xe(),O=Ge(k,L.state);throw f===R&&n.set({error:{error:"PermissionError",message:T,reason:k},cameraPermission:O.state,cameraPermissionReason:O.reason}),new H(p instanceof Error?p.message:"getUserMedia failed")}return a.stream},$e=a=>{const{lifecycle:f}=n.getSnapshot();f==="idle"||f==="stopped"||v||(se(),V.suspendAll(),R+=1,o=void 0,n.set({lifecycle:"stopped",ready:!1,error:{error:"PermissionError",message:gt[a],reason:a},cameraPermission:a==="permission-denied"?"blocked":"unavailable",cameraPermissionReason:Ve(a)}),t.log("XR session stopped: camera lost.",a))},ls=a=>{var k;b==null||b();const f=((k=a.getVideoTracks)==null?void 0:k.call(a))??[],p=()=>{l===a&&$e("camera-lost")};f.forEach(T=>{var L;return(L=T.addEventListener)==null?void 0:L.call(T,"ended",p)}),b=()=>{f.forEach(T=>{var L;return(L=T.removeEventListener)==null?void 0:L.call(T,"ended",p)})}},ds=async()=>{if(z||typeof navigator>"u")return;const a=navigator.permissions;if(a!=null&&a.query)try{const f=await a.query({name:"camera"});if(w)return;z=f,G=()=>{f.state==="denied"&&(o==null?void 0:o.source)===F.WEBCAM&&$e("permission-denied")},f.addEventListener("change",G)}catch{}},us=()=>{var a;z&&G&&((a=z.removeEventListener)==null||a.call(z,"change",G)),z=void 0,G=void 0},Ee=async a=>{var dt,ye,ut;const f=R,p=await cs(a,f);if(f!==R)throw p.getTracks().forEach(ae=>ae.stop()),new H("Media source superseded by a newer bind");l=p,ls(p);const k=await $n(p);if(f!==R||w)throw p.getTracks().forEach(ae=>ae.stop()),new H("Media source superseded by a newer bind");d=k,u=new OffscreenCanvas(k.videoWidth,k.videoHeight);const{renderWidth:T,renderHeight:L}=n.getSnapshot(),O=ar({renderWidth:T,renderHeight:L,videoWidth:k.videoWidth,videoHeight:k.videoHeight});m?(m.width!==O.width||m.height!==O.height)&&(m.width=O.width,m.height=O.height,pe(m)):(m=new OffscreenCanvas(O.width,O.height),pe(m));const lt=a.source===F.STREAM?a.static===!0:!1;D=lt;const ie=(ut=(ye=(dt=p.getVideoTracks)==null?void 0:dt.call(p)[0])==null?void 0:ye.getSettings)==null?void 0:ut.call(ye),_e=ie==null?void 0:ie.facingMode,Ds=_e==="user"||_e==="environment"?_e:null;if(a.source===F.WEBCAM){const ae=Ds??a.facingMode??"user",ht=vt(ae,a.mirrored);o={source:F.WEBCAM,sourceKind:ht?"webcam":"rear-camera",facingMode:ae,deviceId:a.deviceId,mirrored:ht}}else o={source:F.STREAM,stream:a.stream,static:lt,sourceKind:a.sourceKind??"webcam"};n.set({source:a.source,sourceKind:o.sourceKind,cameraFacing:o.source===F.WEBCAM?o.facingMode:null,cameraDeviceId:o.source===F.WEBCAM?(ie==null?void 0:ie.deviceId)??o.deviceId??null:null,sourceWidth:k.videoWidth,sourceHeight:k.videoHeight,error:void 0}),a.source===F.WEBCAM&&ds()},Ae=async a=>{const f=a.sourceKind??"webcam";m=a.canvas;const p=pe(m);n.set({cameraTexture:p,source:F.CANVAS,sourceKind:f,cameraFacing:null,cameraDeviceId:null,renderWidth:m.width,renderHeight:m.height,error:void 0}),o={source:F.CANVAS,canvas:a.canvas,sourceKind:f}},hs=(a,f)=>{if(!f||a.source!==f.source)return!1;if(a.source===F.STREAM&&f.source===F.STREAM)return a.stream===f.stream&&(a.sourceKind??"webcam")===f.sourceKind;if(a.source===F.WEBCAM&&f.source===F.WEBCAM){const p=a.facingMode??"user";return p===f.facingMode&&a.deviceId===f.deviceId&&vt(p,a.mirrored)===f.mirrored}return!1},et=async()=>{if(!m)return;const a=R,f=n.getSnapshot().pipeline;for(const[,p]of f.entries())p.resume();await new Promise(p=>requestAnimationFrame(()=>p())),await new Promise(p=>requestAnimationFrame(()=>p())),D&&R===a&&V.suspendAll()},ms=(a,f)=>!f||f.source!==F.CANVAS?!1:a.canvas===f.canvas&&(a.sourceKind??"webcam")===f.sourceKind,Re=async a=>{const f=a.source;if(f!==F.WEBCAM&&f!==F.STREAM)throw new H(`Invalid media source: ${String(f)}`);if(w)throw new H("session.setMediaSource() called after the provider unmounted");if(hs(a,o)){t.log("Media source unchanged, skipping rebind.");return}R+=1;const{lifecycle:p}=n.getSnapshot();if(p==="idle"||p==="stopped"){await Ee(a),n.set({lifecycle:"media-bound"}),t.log("Media source set to:",a.source);return}if(p==="media-bound"){se(),await Ee(a),t.log("Media source rebound to:",a.source);return}const k=p==="paused";v=!0,await new Promise(T=>requestAnimationFrame(()=>T())),se();try{await Ee(a)}finally{v=!1}if(k){d==null||d.pause(),t.log("Media source swapped (paused) to:",a.source);return}be(),D?await et():V.resumeActive(),t.log("Media source swapped to:",a.source)},fs=async a=>{if(w)throw new H("session.setFrameSource() called after the provider unmounted");if(ms(a,o)){t.log("Frame source unchanged, skipping rebind.");return}R+=1;const{lifecycle:f}=n.getSnapshot();if(f==="idle"||f==="stopped"){await Ae(a),n.set({lifecycle:"media-bound"}),t.log("Frame source set to canvas.");return}if(f==="media-bound"){se(),await Ae(a),t.log("Frame source rebound to canvas.");return}v=!0,await new Promise(p=>requestAnimationFrame(()=>p())),se();try{await Ae(a)}finally{v=!1}t.log("Frame source swapped to canvas.")},tt=async()=>{if(w)throw new H("session.start() called after the provider unmounted");const{lifecycle:a}=n.getSnapshot();if(a==="running")return;if(a==="paused"){await Fe();return}if(a==="idle")throw new H("session.start() called before setMediaSource — call setMediaSource first");if(!m)throw new H("session.start(): media source not bound");const f=(o==null?void 0:o.source)===F.CANVAS;if(!f&&(!d||!u))throw a==="stopped"?new H("session.start() called from stopped state without a media source — call setMediaSource first"):new H("session.start(): media source not bound");f||be(),V.resumeActive(),n.set({lifecycle:"running"}),await new Promise(k=>requestAnimationFrame(()=>k()));const p=n.getSnapshot().pipeline;for(const[k,T]of p.entries())await xe(k,T);n.set({ready:!0}),t.log("XR session started.")},st=()=>{if(n.getSnapshot().lifecycle==="running"){Je(),V.suspendAll();try{d==null||d.pause()}catch{}n.set({lifecycle:"paused"}),t.log("XR session paused.")}},Fe=async()=>{if(w)throw new H("session.resume() called after the provider unmounted");n.getSnapshot().lifecycle==="paused"&&(x=!1,d&&d.play().catch(()=>{}),(o==null?void 0:o.source)!==F.CANVAS&&be(),n.set({lifecycle:"running"}),D?await et():V.resumeActive(),t.log("XR session resumed."))},gs=async(a={})=>{await Re({source:F.WEBCAM,...a});const{lifecycle:f}=n.getSnapshot();return(f==="media-bound"||f==="stopped")&&await tt(),n.getSnapshot().cameraFacing??a.facingMode??"user"},nt=async()=>{const{lifecycle:a}=n.getSnapshot();a==="stopped"||a==="idle"||(x=!1,se(),V.suspendAll(),o=void 0,n.set({lifecycle:"stopped",ready:!1}),t.log("XR session stopped."))},rt=async()=>{await nt(),V.releaseAll(),j.clear();const a=n.getSnapshot().cameraTexture;a&&a.dispose(),K=new WeakSet,o=void 0,R+=1,m=void 0,u=void 0,S=void 0,D=!1,us(),n.set({lifecycle:"idle",cameraTexture:void 0,source:void 0,sourceKind:void 0,cameraFacing:null,cameraDeviceId:null,error:void 0,modelErrors:new Map,cameraPermission:"unknown",cameraPermissionReason:null}),t.log("XR session reset.")},ps=async()=>{w||(w=!0,re==null||re(),re=void 0,ne==null||ne(),ne=void 0,await rt(),t.log("XR session disposed."))},ys=()=>{w&&(w=!1,ct(),ot(),t.log("XR session re-armed."))},ws=()=>w,vs=async a=>{const f="legacy:registerXRPipeline",p=[];await Promise.all(a.map(async k=>{const{model:T}=k;if(!wt[T])throw new H(`Invalid model: ${T}`);j.has(T)||p.push(T);const L="options"in k?k.options:void 0;await V.acquire(T,f,L)})),p.length>0&&(p.forEach(k=>j.add(k)),t.log("XR pipeline registered."))},Ss=a=>{const f=V.get(a);if(!f)throw new H(`Model ${a} is not registered in the pipeline`);return f.getModelNode()},it=async(a,f)=>{a<=0||f<=0||(n.set({renderWidth:a,renderHeight:f}),m&&(m.width!==a||m.height!==f)&&(m.width=a,m.height=f,pe(m),D&&Te()),t.log(`Source canvas set. Render size: ${a}x${f}`))},Ms=async a=>{var T;y=a;const f=(T=a.getBoundingClientRect)==null?void 0:T.call(a),p=f&&f.width>0?Math.round(f.width):a.clientWidth,k=f&&f.height>0?Math.round(f.height):a.clientHeight;await it(p,k)},Cs=a=>{S=a},Ie=()=>y&&M&&C&&E?y:S,ks=a=>{M=a.renderer,C=a.scene,E=a.camera,P=a.renderFrame},at=()=>{if(!M||!C||!E)throw new H("XR frame render requested before the R3F state was bound — make sure <XRScene> is mounted");P?P():M.render(C,E)},xs=()=>{const a=y;if(a&&Ie()===a)return at(),a.toDataURL("image/png");const f=Ie();if(f)return f.toDataURL("image/png");throw new H("session.captureFrame() called before an XRScene or XRMediaSurface capture target was bound")},Ts=(a=30)=>{const f=Ie();if(!(f!=null&&f.captureStream))throw new H("session.captureStream() called before an XRScene or XRMediaSurface capture target was bound");return f.captureStream(a)},bs=()=>d,Es=()=>m??null,As=a=>{if(i=a,n.set({cameraZoom:(a==null?void 0:a.cameraZoom)??1.2}),n.getSnapshot().lifecycle!=="running"||!m)return;const f=n.getSnapshot().pipeline;for(const[p,k]of f.entries())k.run({sourceCanvas:m,renderWidth:n.getSnapshot().renderWidth,renderHeight:n.getSnapshot().renderHeight,getSource:()=>n.getSnapshot().sourceKind,targetFps:c(p),analysisScale:i==null?void 0:i.analysisScale})},Rs=()=>i,Fs=async()=>{if(!o||o.source!==F.WEBCAM)return;const{facingMode:a,deviceId:f,mirrored:p}=o;o=void 0,await Re({source:F.WEBCAM,facingMode:a,deviceId:f,mirrored:p})},Is=a=>{n.set({quality:a})},_s=a=>{n.set({qualityConfig:a})},Ps=a=>{r=a},Ls=()=>{var T;if(typeof window>"u")return{type:"portrait",angle:0};const a=(T=window.screen)==null?void 0:T.orientation,f=(a==null?void 0:a.angle)??0,p=f===90||f===180||f===270?f:0;return{type:a!=null&&a.type?a.type.startsWith("landscape")?"landscape":"portrait":window.innerWidth>window.innerHeight?"landscape":"portrait",angle:p}},de=()=>{const a=Ls(),f=n.getSnapshot().orientation,p=f.type!==a.type||f.angle!==a.angle?{orientation:a}:{};d&&d.videoWidth>0&&(p.sourceWidth=d.videoWidth,p.sourceHeight=d.videoHeight),Object.keys(p).length&&n.set(p)};let ne;const ot=()=>{var f,p,k;if(ne||typeof window>"u")return;const a=(f=window.screen)==null?void 0:f.orientation;(p=a==null?void 0:a.addEventListener)==null||p.call(a,"change",de),(k=window.addEventListener)==null||k.call(window,"resize",de),ne=()=>{var T,L;(T=a==null?void 0:a.removeEventListener)==null||T.call(a,"change",de),(L=window.removeEventListener)==null||L.call(window,"resize",de)},de()};let re;const ct=()=>{if(re||typeof document>"u"||typeof document.addEventListener!="function")return;const a=()=>{if(!w){if(document.hidden){r!=null&&r.pauseWhenHidden&&n.getSnapshot().lifecycle==="running"&&(st(),x=!0);return}if(x&&n.getSnapshot().lifecycle==="paused"){Fe();return}n.getSnapshot().lifecycle==="running"&&(d!=null&&d.paused)&&d.play().catch(()=>{})}};document.addEventListener("visibilitychange",a),re=()=>document.removeEventListener("visibilitychange",a)};return ct(),ot(),{store:n,registry:V,setMediaSource:Re,start:tt,stop:nt,reset:rt,pause:st,resume:Fe,switchCamera:gs,dispose:ps,rearm:ys,isDisposed:ws,setFrameSource:fs,registerXRPipeline:vs,getModelNode:Ss,captureFrame:xs,captureStream:Ts,getInputFrame:Es,_setRenderTarget:Ms,_setCaptureTarget:Cs,_setRenderSize:it,_setR3FState:ks,_renderFrame:at,_getVideoElement:bs,_setPerf:As,_setLifecycle:Ps,_rebindMedia:Fs,_setQuality:Is,_setQualityConfig:_s,_getPerf:Rs}},cr=(e,s)=>{const t=I.useRef(e),n=I.useRef(s),r=I.useMemo(()=>or(t.current,n.current),[]),i=JSON.stringify(s??{});I.useEffect(()=>{r._setLifecycle(s)},[r,i]),I.useEffect(()=>(r.rearm(),()=>void r.dispose()),[r]);const c=JSON.stringify(e??{});return I.useEffect(()=>{r._setPerf(e)},[r,c]),r},Ue=new Map,lr=()=>({register:(e,s)=>{s?Ue.set(e,s):Ue.delete(e)},resolve:e=>e?Ue.get(e)??null:null}),jt=lr(),Qt=I.createContext(null),dr=({children:e})=>{const s=I.useRef(new Map),t=I.useCallback((i,c)=>{c?s.current.set(i,c):s.current.delete(i)},[]),n=I.useCallback(i=>i?s.current.get(i)??null:null,[]),r=I.useMemo(()=>({register:t,resolve:n}),[t,n]);return I.createElement(Qt.Provider,{value:r},e)},Yt=()=>I.useContext(Qt)??jt,ur=()=>Yt().register,hr=()=>Yt().resolve;jt.register;const Zt={[A.FACE_TRACKER]:"face",[A.HAND_TRACKER]:"hand",[A.GESTURE_TRACKER]:"gesture",[A.BODY_TRACKER]:"body",[A.HOLISTIC_TRACKER]:"holistic",[A.BACKGROUND_SEGMENTATION]:"segmentation",[A.SEMANTIC_SEGMENTATION]:"semantic-seg"},St=Object.values(A),mr=(e,s)=>{var n;const t=(n=e.registry.getOptions(s))==null?void 0:n.targetFps;return typeof t=="number"?t:null},Me=(e,s,t,n=performance.now())=>{const r=e.store.getSnapshot(),i=t?n-t.sampledAt:0,c=t&&i>0?Math.max(0,(r.feedFrames-t.feedFrames)*1e3/i):0,o=r.lifecycle==="running",d=s.map(u=>{var E;const m=e.registry.getState(u),y=e.store.getSnapshot().pipeline.get(u),S=((E=r.modelErrors.get(u))==null?void 0:E.error)??null,M=(y==null?void 0:y.getDiagnostics())??{inferenceMs:null,inferenceFps:0,inferences:0,skippedFrames:0,detections:null,confidence:null,status:S?"error":"ready",error:S,paused:!1,disposed:!1};let C;return m==="error"||M.status==="error"?C="error":m==="idle"?C="unavailable":m==="initializing"?C="loading":M.paused||!o?C="paused":C="ready",{...M,error:M.error??S,model:u,label:Zt[u]??u,state:C,targetFps:mr(e,u),owners:e.registry.getOwners(u)}}),l=r.quality;return{quality:l?{tier:l.decision.tier.name,index:l.index,locked:l.locked,reason:l.decision.reason}:null,session:{lifecycle:r.lifecycle,ready:r.ready,error:r.error,source:r.source,sourceKind:r.sourceKind,sourceWidth:r.sourceWidth,sourceHeight:r.sourceHeight,renderWidth:r.renderWidth,renderHeight:r.renderHeight,feedFps:c,feedFrames:r.feedFrames},models:d,inferenceMsTotal:d.reduce((u,m)=>u+(m.state==="ready"?m.inferenceMs??0:0),0),sampledAt:n}},fr=(e={})=>{const{intervalMs:s=250,enabled:t=!0}=e,{session:n}=Ze(),r=(e.models??St).join("|"),i=I.useMemo(()=>e.models&&e.models.length?e.models:St,[r]),c=I.useRef(null),[o,d]=I.useState(()=>Me(n,i,null));return I.useEffect(()=>{if(!t)return;const l=()=>{const m=Me(n,i,c.current);c.current={feedFrames:m.session.feedFrames,sampledAt:m.sampledAt},d(m)};l();const u=window.setInterval(l,Math.max(50,s));return()=>window.clearInterval(u)},[n,i,s,t]),o},Jt=[{name:"high",targetFps:30,renderScale:1,analysisScale:1,camRes:960},{name:"medium",targetFps:24,renderScale:.8,analysisScale:.85,camRes:720},{name:"low",targetFps:15,renderScale:.6,analysisScale:.7,camRes:640}],Y={maxFrameMs:1e3/24,maxInferenceMs:24,maxMemoryMb:null,sampleMs:1e3,downgradeAfter:2,upgradeAfter:6,upgradeHeadroom:.75,cooldownMs:4e3},je={frameMs:null,fps:null,inferenceMs:null,feedFps:null,memoryMb:null,deviceMemoryGb:null,hardwareConcurrency:null,thermal:"unknown"},fe=(e,s,t)=>Math.min(t,Math.max(s,e)),U=(e,s)=>typeof e=="number"&&Number.isFinite(e)?e:s,$t=(e,s)=>({name:typeof e.name=="string"&&e.name?e.name:`tier-${s}`,...U(e.targetFps,NaN)>0?{targetFps:U(e.targetFps,0)}:{},...U(e.renderScale,NaN)>0?{renderScale:fe(U(e.renderScale,1),.25,1)}:{},...U(e.analysisScale,NaN)>0?{analysisScale:fe(U(e.analysisScale,1),.25,1)}:{},...U(e.camRes,NaN)>0?{camRes:Math.round(U(e.camRes,0))}:{},...e.rebindCamera?{rebindCamera:!0}:{}}),es=(e={})=>({maxFrameMs:Math.max(1,U(e.maxFrameMs,Y.maxFrameMs)),maxInferenceMs:Math.max(0,U(e.maxInferenceMs,Y.maxInferenceMs)),maxMemoryMb:e.maxMemoryMb===null||e.maxMemoryMb===void 0?null:Math.max(1,U(e.maxMemoryMb,0))||null,sampleMs:Math.max(100,U(e.sampleMs,Y.sampleMs)),downgradeAfter:Math.max(1,Math.round(U(e.downgradeAfter,Y.downgradeAfter))),upgradeAfter:Math.max(1,Math.round(U(e.upgradeAfter,Y.upgradeAfter))),upgradeHeadroom:fe(U(e.upgradeHeadroom,Y.upgradeHeadroom),.1,1),cooldownMs:Math.max(0,U(e.cooldownMs,Y.cooldownMs))}),J=(e,s,t)=>{if(typeof s=="number"&&Number.isInteger(s)&&s>=0&&s<e.length)return s;if(typeof s=="string"){const n=e.findIndex(r=>r.name===s);if(n>=0)return n}return t},ts=(e={})=>{const s=e.tiers&&e.tiers.length?e.tiers.map((r,i)=>$t(r,i)):Jt,t=J(s,e.maxTier,0),n=Math.max(t,J(s,e.minTier,s.length-1));return{tiers:s,budget:es(e.budget),...e.initialTier!==void 0?{initialTier:e.initialTier}:{},minTier:n,maxTier:t,adaptive:e.adaptive!==!1,historySize:Math.max(1,Math.round(U(e.historySize,20)))}},ss=(e,s)=>{const t=J(e.tiers,e.maxTier,0),n=J(e.tiers,e.minTier,e.tiers.length-1);if(e.initialTier!==void 0)return fe(J(e.tiers,e.initialTier,t),t,n);const r=s.deviceMemoryGb!==null&&s.deviceMemoryGb<=4||s.hardwareConcurrency!==null&&s.hardwareConcurrency<=4;return fe(r?t+1:t,t,n)},Qe=(e,s=je,t=0)=>{const n=ss(e,s),r={index:n,tier:e.tiers[n],reason:"init",at:t};return{index:n,locked:!1,badStreak:0,goodStreak:0,lastChangeAt:t,decision:r,history:[r],signals:s}},Ce=(e,s,t,n,r,i=e.signals)=>{const c={index:t,tier:s.tiers[t],reason:n,at:r};return{...e,index:t,badStreak:0,goodStreak:0,lastChangeAt:r,decision:c,history:[c,...e.history].slice(0,s.historySize),signals:i}},ns=(e,s)=>e.thermal==="critical"?"thermal":s.maxMemoryMb!==null&&e.memoryMb!==null&&e.memoryMb>s.maxMemoryMb?"memory":e.inferenceMs!==null&&e.inferenceMs>s.maxInferenceMs?"inference":e.frameMs!==null&&e.frameMs>s.maxFrameMs?"frame-time":null,rs=(e,s,t,n)=>{const{budget:r}=t,i=J(t.tiers,t.maxTier,0),c=J(t.tiers,t.minTier,t.tiers.length-1);if(e.locked||!t.adaptive)return{...e,signals:s};const o=ns(s,r),d=o===null&&s.frameMs!==null&&s.frameMs<=r.maxFrameMs*r.upgradeHeadroom&&(s.inferenceMs===null||s.inferenceMs<=r.maxInferenceMs*r.upgradeHeadroom),l=o?e.badStreak+1:0,u=d?e.goodStreak+1:0,m=n-e.lastChangeAt>=r.cooldownMs;if(o&&l>=r.downgradeAfter&&m){if(e.index<c)return Ce(e,t,e.index+1,o,n,s);const y=o==="frame-time"?"suspected":s.thermal;return{...e,badStreak:l,goodStreak:u,signals:{...s,thermal:y}}}return d&&u>=r.upgradeAfter&&m&&e.index>i?Ce(e,t,e.index-1,"recovered",n,s):{...e,badStreak:l,goodStreak:u,signals:s}},gr=(e,s,t,n)=>{const r=J(s.tiers,t,e.index);return r===e.index?e:Ce(e,s,r,"manual",n)},pr=(e,s,t,n)=>t===e.locked?e:{...Ce(e,s,e.index,t?"locked":"manual",n),locked:t},is=(e,s)=>e.decision.tier===s?null:e.decision.tier,yr=(e,s,t)=>{const n=Qe(e,s,t);return{...n,decision:{...n.decision,reason:"reset"},history:[{...n.decision,reason:"reset"}]}},wr=Object.values(A),as=()=>{if(typeof navigator>"u")return{deviceMemoryGb:null,hardwareConcurrency:null};const e=navigator;return{deviceMemoryGb:typeof e.deviceMemory=="number"?e.deviceMemory:null,hardwareConcurrency:typeof e.hardwareConcurrency=="number"?e.hardwareConcurrency:null}},vr=()=>{const e=performance.memory;return e?e.usedJSHeapSize/1048576:null},os=({config:e,thermal:s,onDecision:t})=>{const{session:n}=Ze(),r=JSON.stringify(e??{}),i=I.useMemo(()=>ts(e),[r]),c=I.useRef(s??"unknown");c.current=s??"unknown";const o=I.useRef(t);return o.current=t,I.useEffect(()=>{const d=as();let l=Qe(i,{...je,...d},performance.now());const u=n.store.getSnapshot().quality;u&&u.index<i.tiers.length&&(l={...u,decision:{...u.decision,tier:i.tiers[u.index]}}),n._setQualityConfig(i),n._setQuality(l);let m=n._getPerf(),y=null;const S=async(w,x)=>{const N={...m,...w.targetFps!==void 0?{targetFps:w.targetFps}:{},...w.analysisScale!==void 0?{analysisScale:w.analysisScale}:{},...w.camRes!==void 0&&w.rebindCamera?{camRes:w.camRes}:{}};n._setPerf(N),w.rebindCamera&&w.camRes!==void 0&&w.camRes!==(x==null?void 0:x.camRes)&&await n._rebindMedia().catch(()=>{})};y=l.decision.tier,S(l.decision.tier,null);let M=0,C=performance.now(),E=0;const P=()=>{M+=1,E=requestAnimationFrame(P)};E=requestAnimationFrame(P);let g=null;const v=window.setInterval(()=>{var K;if(typeof document<"u"&&document.hidden){M=0,C=performance.now();return}const w=performance.now(),x=w-C,N=Me(n,wr,g,w);g={feedFrames:N.session.feedFrames,sampledAt:w};const b=n.store.getSnapshot().lifecycle==="running",z={frameMs:M>0&&x>0&&b?x/M:null,fps:M>0&&x>0?M*1e3/x:null,inferenceMs:b?N.inferenceMsTotal:null,feedFps:N.session.feedFps,memoryMb:vr(),...d,thermal:c.current};M=0,C=w;const G=n.store.getSnapshot().quality??l,D=rs(G,z,i,w);l=D,n._setQuality(D);const R=is(D,y);if(R){const j=y;y=R,S(R,j),(K=o.current)==null||K.call(o,D)}},i.budget.sampleMs);return()=>{cancelAnimationFrame(E),window.clearInterval(v);const w=(y==null?void 0:y.rebindCamera)&&y.camRes!==void 0;n._setPerf(m),w&&(m==null?void 0:m.camRes)!==(y==null?void 0:y.camRes)&&n._rebindMedia().catch(()=>{}),m=void 0,n._setQualityConfig(null)}},[n,i]),null},Ye=I.createContext(void 0),Ze=()=>{const e=I.useContext(Ye);if(!e)throw new H("XR context can only be used inside XRProvider, did you forget to wrap your app in <XRProvider>?");return e},Sr=()=>I.useContext(Ye)??null,Mr=({children:e,perf:s,lifecycle:t,quality:n})=>{const r=cr(s,t),i=I.useMemo(()=>({session:r}),[r]);return Pe.jsxs(Ye.Provider,{value:i,children:[n!==!1&&Pe.jsx(os,{config:n||void 0}),Pe.jsx(dr,{children:e})]})};exports.CAMERA_PERMISSION_MESSAGES=rn;exports.DEFAULT_HOLISTIC_ANALYSIS_MAX_DIMENSION=xt;exports.DEFAULT_HOLISTIC_HOLD_MS=Ct;exports.DEFAULT_HOLISTIC_MODEL_URL=ze;exports.DEFAULT_HOLISTIC_PREDICT_MS=kt;exports.DEFAULT_PERFORMANCE_BUDGET=Y;exports.DEFAULT_QUALITY_TIERS=Jt;exports.EMPTY_QUALITY_SIGNALS=je;exports.FACE_TRACKING_MODEL_PATH=Ot;exports.FaceTrackMemory=Mt;exports.HAND_JOINT_INDEX=Nn;exports.HAND_JOINT_NAMES=zt;exports.HAND_POSE_DEFAULT_HOLD_MS=Wt;exports.SEMANTIC_SEGMENTATION_PRESET_SPECS=Be;exports.VISION_WASM_PATH=Ht;exports.XRMediaSource=F;exports.XRModel=A;exports.XRProvider=Mr;exports.XRQualityController=os;exports.XR_FALLBACK_MESSAGES=We;exports.XR_MODEL_ASSET_URLS=Tt;exports.XR_MODEL_LABELS=Zt;exports.acquireVerifiedBytes=Lt;exports.anatomicalHandedness=Vt;exports.assignHandPoses=qt;exports.canPromptForCamera=nn;exports.classifyCameraFailure=Ge;exports.clearSemanticMask=Xn;exports.computeFeedCrop=At;exports.computeFitLayout=Et;exports.createFallbackReason=_;exports.createQualityState=Qe;exports.createSemanticMask=Xt;exports.defaultCameraEnvironment=ke;exports.detectXRCapabilities=Js;exports.feedSidedName=On;exports.feedToSource=Rt;exports.feedToWorld=It;exports.fetchAndVerify=_t;exports.fillLandmarkPolygon=jn;exports.fillPolygon=Gt;exports.handWorldLandmarkToJoint=Kt;exports.isFeedPointInSource=on;exports.isMirroredSourceKind=ge;exports.isSdkOwnedUrl=Pt;exports.judgeSample=ns;exports.libConfig=B;exports.lockQuality=pr;exports.mapDomExceptionToReason=Ke;exports.mapModelErrorToReason=en;exports.mirrorFeedX=cn;exports.modelNodeSource=Cn;exports.normalizedTrackerPointToTrackerPoint=le;exports.orientSourcePoint=ln;exports.orientedSize=dn;exports.otherSide=Nt;exports.permissionStateToStatus=bt;exports.personLeftSign=Hn;exports.personSide=Ut;exports.queryCameraPermission=Xe;exports.readDeviceSignals=as;exports.requestCameraAccess=tn;exports.resetQuality=yr;exports.resolveHolisticRuntimeOptions=Se;exports.resolveInitialTierIndex=ss;exports.resolveModelAssetUrl=qe;exports.resolvePerformanceBudget=es;exports.resolveQualityConfig=ts;exports.resolveQualityTier=$t;exports.resolveTrackerSupport=$s;exports.sampleXRDiagnostics=Me;exports.semanticMaskLabelIndex=Gn;exports.sessionReasonToFallback=Ve;exports.setQualityTier=gr;exports.sourceToFeed=an;exports.stepQualityController=rs;exports.subscribeCameraPermission=sn;exports.swapSidedName=Bt;exports.tierToApply=is;exports.trackerPointToNormalizedTrackerPoint=Us;exports.trackerToWorld=hn;exports.unprojectToZZeroInto=ve;exports.useOptionalXRContext=Sr;exports.useRegisterRuntimeObject=ur;exports.useResolveRuntimeObject=hr;exports.useXRContext=Ze;exports.useXRDiagnostics=fr;exports.warmVisionWasm=$;exports.worldToFeed=mn;exports.worldToTracker=fn;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const P=require("three"),v=require("react/jsx-runtime"),k=require("@react-three/fiber"),w=require("react"),z=require("./uv-BMFt19bg.cjs"),I=require("./index-DE17y0ZI.cjs");function L(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const g=L(P),m={width:720,height:1280},D=32,O=.5,_={enabled:!0,position:{x:0,y:0},size:{width:680,height:1230},pivot:[.5,.5],rotation:0,scale2D:{x:1,y:1},referencePixelsPerUnit:D,renderOrder:999,overlay:!0,visible:!0,showTransformGuides:!1},H=Math.PI/180,b=(e,t)=>t<=0?e:Math.round(e/t)*t,G=({transform:e,parentSize:t,root:n=m,snapIncrement:a=O})=>{const r=Math.min(t.width/n.width,t.height/n.height)*(D/e.referencePixelsPerUnit),c=e.size.width*e.scale2D.x*r,h=e.size.height*e.scale2D.y*r,s=b(e.position.x,a)*r,l=b(e.position.y,a)*r,o=(e.pivot[0]-.5)*c,d=(e.pivot[1]-.5)*h;return{center:[s-o,l-d,0],size:[c,h,1],rotation:[0,0,e.rotation*H],pivotOffset:[o/Math.max(c,1e-6),d/Math.max(h,1e-6),0],aspect:c>0&&h>0?Math.abs(c/h):1}},B=e=>({..._,...e,position:{..._.position,...e==null?void 0:e.position},size:{..._.size,...e==null?void 0:e.size},scale2D:{..._.scale2D,...e==null?void 0:e.scale2D}}),x=(e,t)=>e<t?e*65536+t:t*65536+e,S=(e,t)=>[e[t*3],e[t*3+1],e[t*3+2]],q=(e,t,n)=>{const a=Math.floor(e.length/3),i=new Map,r=new Set(n),c=u=>{const[A,E,N]=S(e,u);return[x(A,E),x(E,N),x(N,A)]},h=u=>S(e,u).every(A=>r.has(A)),s=u=>u.map((A,E)=>x(A,u[(E+1)%u.length])),l=s(n),o=new Set([...s(t),...l]);for(let u=0;u<a;u+=1)c(u).forEach(A=>{const E=i.get(A);E?E.push(u):i.set(A,[u])});let d=-1;for(const u of l){const A=(i.get(u)??[]).find(E=>!h(E));if(A!==void 0){d=A;break}}if(d<0)return[];const f=new Set([d]),p=[d],y=new Map;for(;p.length>0;){const u=p.pop();c(u).forEach(A=>{y.set(A,(y.get(A)??0)+1),!o.has(A)&&(i.get(A)??[]).forEach(E=>{f.has(E)||(f.add(E),p.push(E))})})}const R=[...y].filter(([,u])=>u===1).map(([u])=>u);return R.length===o.size&&R.every(u=>o.has(u))?[...f].sort((u,A)=>u-A):[]},V=(e,t,n,a)=>{const i=new Float32Array(t).fill(1),r=new Map,c=(o,d)=>{r.has(o)||r.set(o,new Set),r.get(o).add(d)};for(let o=0;o+2<e.length;o+=3){const d=e[o],f=e[o+1],p=e[o+2];c(d,f),c(f,d),c(f,p),c(p,f),c(p,d),c(d,p)}const h=o=>{const d=new Map,f=o.filter(p=>r.has(p));f.forEach(p=>d.set(p,0));for(let p=0;p<f.length;p+=1){const y=f[p],R=d.get(y)+1;r.get(y).forEach(T=>{d.has(T)||(d.set(T,R),f.push(T))})}return d},s=h(n),l=h(a);return r.forEach((o,d)=>{const f=s.get(d)??0,p=l.get(d)??0;i[d]=f+p===0?1:f/(f+p)}),i},K=(e,t,n)=>{const a=Array.from({length:t},()=>new Set);for(let c=0;c+2<e.length;c+=3){const[h,s,l]=S(e,c/3);a[h].add(s).add(l),a[s].add(h).add(l),a[l].add(h).add(s)}const i=new Float32Array(t).fill(1/0),r=[...n];n.forEach(c=>{i[c]=0});for(let c=0;c<r.length;c+=1){const h=r[c];a[h].forEach(s=>{i[s]===1/0&&(i[s]=i[h]+1,r.push(s))})}return i},j=(e,t,n,a)=>{const i=Array.from({length:n},()=>new Set);for(let s=0;s+2<t.length;s+=3){const[l,o,d]=S(t,s/3);i[l].add(o).add(d),i[o].add(l).add(d),i[d].add(l).add(o)}const r=(s,l)=>Math.hypot(e[s*3]-e[l*3],e[s*3+1]-e[l*3+1],e[s*3+2]-e[l*3+2]),c=new Float64Array(n).fill(1/0),h=new Uint8Array(n);a.forEach(s=>{c[s]=0});for(let s=0;s<n;s+=1){let l=-1;for(let o=0;o<n;o+=1)!h[o]&&(l<0||c[o]<c[l])&&(l=o);if(l<0||c[l]===1/0)break;h[l]=1,i[l].forEach(o=>{const d=c[l]+r(l,o);d<c[o]&&(c[o]=d)})}return Float32Array.from(c)},W=(e,t,n)=>{const a=new Float32Array(n*3);for(let i=0;i+2<t.length;i+=3){const[r,c,h]=S(t,i/3),s=e[c*3]-e[r*3],l=e[c*3+1]-e[r*3+1],o=e[c*3+2]-e[r*3+2],d=e[h*3]-e[r*3],f=e[h*3+1]-e[r*3+1],p=e[h*3+2]-e[r*3+2],y=l*p-o*f,R=o*d-s*p,T=s*f-l*d;[r,c,h].forEach(u=>{a[u*3]+=y,a[u*3+1]+=R,a[u*3+2]+=T})}for(let i=0;i<n;i+=1){const r=Math.hypot(a[i*3],a[i*3+1],a[i*3+2]);r>0&&(a[i*3]/=r,a[i*3+1]/=r,a[i*3+2]/=r)}return a},X=(e,t)=>{const n=new Uint16Array(e.length*3);for(let a=0;a<e.length;a+=1){const i=e[a];n[a*3]=t[i*3],n[a*3+1]=t[i*3+1],n[a*3+2]=t[i*3+2]}return n},Y="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO2YpZcAAAAASUVORK5CYII=",$=()=>{const e=new Uint8Array([32,32,32,255,96,96,96,255,176,176,176,255,255,255,255,255]),t=new g.DataTexture(e,4,1,g.RGBAFormat);return t.minFilter=g.NearestFilter,t.magFilter=g.NearestFilter,t.generateMipmaps=!1,t.needsUpdate=!0,t},Q=()=>{const e=document.createElement("canvas");e.width=256,e.height=256;const t=e.getContext("2d");if(!t)return new g.CanvasTexture(e);const n=t.createRadialGradient(96,80,10,128,128,128);n.addColorStop(0,"#ffffff"),n.addColorStop(.18,"#f7d794"),n.addColorStop(.45,"#d97706"),n.addColorStop(.72,"#78350f"),n.addColorStop(1,"#120701"),t.fillStyle=n,t.fillRect(0,0,e.width,e.height);const a=new g.CanvasTexture(e);return a.needsUpdate=!0,a},Z=["face.center","face.forehead","face.noseTip","face.chin","face.leftEyeOuter","face.rightEyeOuter","face.leftCheek","face.rightCheek","face.mouthCenter","face.leftEye","face.rightEye","face.leftEarlobe","face.rightEarlobe","face.custom"],J=["hand.wrist","hand.thumbTip","hand.indexTip","hand.middleTip","hand.ringTip","hand.pinkyTip","hand.indexBase","hand.middleBase","hand.ringBase","hand.pinkyBase"],ee=["body.head","body.neck","body.leftShoulder","body.rightShoulder","body.leftElbow","body.rightElbow","body.leftWrist","body.rightWrist","body.leftHip","body.rightHip","body.leftKnee","body.rightKnee","body.leftAnkle","body.rightAnkle"],C=e=>e.startsWith("face.")?"face":e.startsWith("hand.")?"hand":e.startsWith("body.")?"body":null,te={target:"face.center",customAnchorPoint:{x:0,y:0,z:0},offset:{x:0,y:0,z:0},smoothing:0,followFaceRoll:!1},F=(e,t,n)=>t+n*(e-t),M=(e,t)=>1/(1+1/(2*Math.PI*e)/t),ne=(e,t,n,a,i,r)=>{if(!e.initialized||n<=0)return e.pos.copy(t),e.prevRaw.copy(t),e.dxHat.set(0,0,0),e.initialized=!0,e;const c=M(r,n),h=["x","y","z"];for(const s of h){const l=(t[s]-e.prevRaw[s])/n,o=F(l,e.dxHat[s],c);e.dxHat[s]=o;const d=a+i*Math.abs(o),f=M(d,n);e.pos[s]=F(t[s],e.pos[s],f),e.prevRaw[s]=t[s]}return e},U=(e,t,n,a)=>ne(e,t,n,a*.1,.5,1),ce=({target:e,customAnchorPoint:t,offset:n,smoothing:a=0,children:i})=>{const r=I.useTrackerContext(),c=w.useRef(null),h=w.useRef(!1),s=w.useRef(new g.Vector3),l=w.useRef({pos:new g.Vector3,prevRaw:new g.Vector3,dxHat:new g.Vector3,initialized:!1}),o=C(e),d=r!==null&&o!==null&&r.type!==o,f=r===null,p=f||d||o===null;return w.useEffect(()=>{f?console.warn(`[TrackingAnchor] target "${e}" requires a FaceTracker / HandTracker / BodyTracker ancestor; rendering null.`):d?console.warn(`[TrackingAnchor] target "${e}" namespace does not match parent tracker type "${r==null?void 0:r.type}"; rendering null.`):o===null&&console.warn(`[TrackingAnchor] target "${e}" is not a recognized face/hand/body landmark; rendering null.`)},[e,o,f,d,r==null?void 0:r.type]),k.useFrame((y,R)=>{if(p||!c.current||!r)return;const T=r.resolveLandmark(e,t);if(!T){c.current.visible=!1,h.current=!1,l.current.initialized=!1;return}c.current.visible=!0;const u=s.current.copy(T.position),A=c.current.parent;if(A){A.updateMatrixWorld();const E=new g.Matrix4().copy(A.matrixWorld).invert();u.applyMatrix4(E)}n&&(u.x+=n[0],u.y+=n[1],u.z+=n[2]),a>0?(U(l.current,u,h.current?R:0,a),c.current.position.copy(l.current.pos)):c.current.position.copy(u),h.current=!0,T.quaternion&&c.current.quaternion.copy(T.quaternion)}),p?null:v.jsx("group",{ref:c,renderOrder:z.RENDER_LAYERS.TRACKED,children:i})};exports.BODY_TARGETS=ee;exports.DEFAULT_PIXEL_SNAP_INCREMENT=O;exports.DEFAULT_REFERENCE_PIXELS_PER_UNIT=D;exports.DEFAULT_SCREEN_TRANSFORM_2D=_;exports.DEFAULT_SCREEN_TRANSFORM_ROOT=m;exports.DEFAULT_TRACKING_ANCHOR=te;exports.FACE_TARGETS=Z;exports.HAND_TARGETS=J;exports.TRANSPARENT_TEXTURE_DATA_URL=Y;exports.TrackingAnchor=ce;exports.collectRingBandTriangles=q;exports.computeEdgeDistance=j;exports.computeHopDistance=K;exports.computeRingDistance=V;exports.computeVertexNormals=W;exports.createMatcapTexture=Q;exports.createToonGradientTexture=$;exports.getTargetNamespace=C;exports.mergeScreenTransform2D=B;exports.resolveScreenTransform2D=G;exports.stepTrackingSmoothing=U;exports.triangleIdsToVertices=X;
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import * as E from "three";
|
|
2
|
+
import { jsx as C } from "react/jsx-runtime";
|
|
3
|
+
import { useFrame as N } from "@react-three/fiber";
|
|
4
|
+
import { useRef as x, useEffect as U } from "react";
|
|
5
|
+
import { R as v } from "./uv-DJU_XfmN.js";
|
|
6
|
+
import { u as z } from "./index-BavF06C6.js";
|
|
7
|
+
const k = {
|
|
8
|
+
width: 720,
|
|
9
|
+
height: 1280
|
|
10
|
+
}, M = 32, O = 0.5, S = {
|
|
11
|
+
enabled: !0,
|
|
12
|
+
position: { x: 0, y: 0 },
|
|
13
|
+
size: { width: 680, height: 1230 },
|
|
14
|
+
pivot: [0.5, 0.5],
|
|
15
|
+
rotation: 0,
|
|
16
|
+
scale2D: { x: 1, y: 1 },
|
|
17
|
+
referencePixelsPerUnit: M,
|
|
18
|
+
renderOrder: 999,
|
|
19
|
+
overlay: !0,
|
|
20
|
+
visible: !0,
|
|
21
|
+
showTransformGuides: !1
|
|
22
|
+
}, P = Math.PI / 180, D = (e, t) => t <= 0 ? e : Math.round(e / t) * t, q = ({
|
|
23
|
+
transform: e,
|
|
24
|
+
parentSize: t,
|
|
25
|
+
root: o = k,
|
|
26
|
+
snapIncrement: s = O
|
|
27
|
+
}) => {
|
|
28
|
+
const r = Math.min(t.width / o.width, t.height / o.height) * (M / e.referencePixelsPerUnit), n = e.size.width * e.scale2D.x * r, f = e.size.height * e.scale2D.y * r, a = D(e.position.x, s) * r, l = D(e.position.y, s) * r, c = (e.pivot[0] - 0.5) * n, d = (e.pivot[1] - 0.5) * f;
|
|
29
|
+
return {
|
|
30
|
+
center: [a - c, l - d, 0],
|
|
31
|
+
size: [n, f, 1],
|
|
32
|
+
rotation: [0, 0, e.rotation * P],
|
|
33
|
+
pivotOffset: [c / Math.max(n, 1e-6), d / Math.max(f, 1e-6), 0],
|
|
34
|
+
aspect: n > 0 && f > 0 ? Math.abs(n / f) : 1
|
|
35
|
+
};
|
|
36
|
+
}, Y = (e) => ({
|
|
37
|
+
...S,
|
|
38
|
+
...e,
|
|
39
|
+
position: { ...S.position, ...e == null ? void 0 : e.position },
|
|
40
|
+
size: { ...S.size, ...e == null ? void 0 : e.size },
|
|
41
|
+
scale2D: { ...S.scale2D, ...e == null ? void 0 : e.scale2D }
|
|
42
|
+
}), b = (e, t) => e < t ? e * 65536 + t : t * 65536 + e, R = (e, t) => [
|
|
43
|
+
e[t * 3],
|
|
44
|
+
e[t * 3 + 1],
|
|
45
|
+
e[t * 3 + 2]
|
|
46
|
+
], X = (e, t, o) => {
|
|
47
|
+
const s = Math.floor(e.length / 3), i = /* @__PURE__ */ new Map(), r = new Set(o), n = (h) => {
|
|
48
|
+
const [y, A, m] = R(e, h);
|
|
49
|
+
return [b(y, A), b(A, m), b(m, y)];
|
|
50
|
+
}, f = (h) => R(e, h).every((y) => r.has(y)), a = (h) => h.map((y, A) => b(y, h[(A + 1) % h.length])), l = a(o), c = /* @__PURE__ */ new Set([...a(t), ...l]);
|
|
51
|
+
for (let h = 0; h < s; h += 1)
|
|
52
|
+
n(h).forEach((y) => {
|
|
53
|
+
const A = i.get(y);
|
|
54
|
+
A ? A.push(h) : i.set(y, [h]);
|
|
55
|
+
});
|
|
56
|
+
let d = -1;
|
|
57
|
+
for (const h of l) {
|
|
58
|
+
const y = (i.get(h) ?? []).find((A) => !f(A));
|
|
59
|
+
if (y !== void 0) {
|
|
60
|
+
d = y;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (d < 0) return [];
|
|
65
|
+
const u = /* @__PURE__ */ new Set([d]), p = [d], T = /* @__PURE__ */ new Map();
|
|
66
|
+
for (; p.length > 0; ) {
|
|
67
|
+
const h = p.pop();
|
|
68
|
+
n(h).forEach((y) => {
|
|
69
|
+
T.set(y, (T.get(y) ?? 0) + 1), !c.has(y) && (i.get(y) ?? []).forEach((A) => {
|
|
70
|
+
u.has(A) || (u.add(A), p.push(A));
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const w = [...T].filter(([, h]) => h === 1).map(([h]) => h);
|
|
75
|
+
return w.length === c.size && w.every((h) => c.has(h)) ? [...u].sort((h, y) => h - y) : [];
|
|
76
|
+
}, $ = (e, t, o, s) => {
|
|
77
|
+
const i = new Float32Array(t).fill(1), r = /* @__PURE__ */ new Map(), n = (c, d) => {
|
|
78
|
+
r.has(c) || r.set(c, /* @__PURE__ */ new Set()), r.get(c).add(d);
|
|
79
|
+
};
|
|
80
|
+
for (let c = 0; c + 2 < e.length; c += 3) {
|
|
81
|
+
const d = e[c], u = e[c + 1], p = e[c + 2];
|
|
82
|
+
n(d, u), n(u, d), n(u, p), n(p, u), n(p, d), n(d, p);
|
|
83
|
+
}
|
|
84
|
+
const f = (c) => {
|
|
85
|
+
const d = /* @__PURE__ */ new Map(), u = c.filter((p) => r.has(p));
|
|
86
|
+
u.forEach((p) => d.set(p, 0));
|
|
87
|
+
for (let p = 0; p < u.length; p += 1) {
|
|
88
|
+
const T = u[p], w = d.get(T) + 1;
|
|
89
|
+
r.get(T).forEach((g) => {
|
|
90
|
+
d.has(g) || (d.set(g, w), u.push(g));
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return d;
|
|
94
|
+
}, a = f(o), l = f(s);
|
|
95
|
+
return r.forEach((c, d) => {
|
|
96
|
+
const u = a.get(d) ?? 0, p = l.get(d) ?? 0;
|
|
97
|
+
i[d] = u + p === 0 ? 1 : u / (u + p);
|
|
98
|
+
}), i;
|
|
99
|
+
}, j = (e, t, o) => {
|
|
100
|
+
const s = Array.from({ length: t }, () => /* @__PURE__ */ new Set());
|
|
101
|
+
for (let n = 0; n + 2 < e.length; n += 3) {
|
|
102
|
+
const [f, a, l] = R(e, n / 3);
|
|
103
|
+
s[f].add(a).add(l), s[a].add(f).add(l), s[l].add(f).add(a);
|
|
104
|
+
}
|
|
105
|
+
const i = new Float32Array(t).fill(1 / 0), r = [...o];
|
|
106
|
+
o.forEach((n) => {
|
|
107
|
+
i[n] = 0;
|
|
108
|
+
});
|
|
109
|
+
for (let n = 0; n < r.length; n += 1) {
|
|
110
|
+
const f = r[n];
|
|
111
|
+
s[f].forEach((a) => {
|
|
112
|
+
i[a] === 1 / 0 && (i[a] = i[f] + 1, r.push(a));
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return i;
|
|
116
|
+
}, Q = (e, t, o, s) => {
|
|
117
|
+
const i = Array.from({ length: o }, () => /* @__PURE__ */ new Set());
|
|
118
|
+
for (let a = 0; a + 2 < t.length; a += 3) {
|
|
119
|
+
const [l, c, d] = R(t, a / 3);
|
|
120
|
+
i[l].add(c).add(d), i[c].add(l).add(d), i[d].add(l).add(c);
|
|
121
|
+
}
|
|
122
|
+
const r = (a, l) => Math.hypot(
|
|
123
|
+
e[a * 3] - e[l * 3],
|
|
124
|
+
e[a * 3 + 1] - e[l * 3 + 1],
|
|
125
|
+
e[a * 3 + 2] - e[l * 3 + 2]
|
|
126
|
+
), n = new Float64Array(o).fill(1 / 0), f = new Uint8Array(o);
|
|
127
|
+
s.forEach((a) => {
|
|
128
|
+
n[a] = 0;
|
|
129
|
+
});
|
|
130
|
+
for (let a = 0; a < o; a += 1) {
|
|
131
|
+
let l = -1;
|
|
132
|
+
for (let c = 0; c < o; c += 1)
|
|
133
|
+
!f[c] && (l < 0 || n[c] < n[l]) && (l = c);
|
|
134
|
+
if (l < 0 || n[l] === 1 / 0) break;
|
|
135
|
+
f[l] = 1, i[l].forEach((c) => {
|
|
136
|
+
const d = n[l] + r(l, c);
|
|
137
|
+
d < n[c] && (n[c] = d);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return Float32Array.from(n);
|
|
141
|
+
}, Z = (e, t, o) => {
|
|
142
|
+
const s = new Float32Array(o * 3);
|
|
143
|
+
for (let i = 0; i + 2 < t.length; i += 3) {
|
|
144
|
+
const [r, n, f] = R(t, i / 3), a = e[n * 3] - e[r * 3], l = e[n * 3 + 1] - e[r * 3 + 1], c = e[n * 3 + 2] - e[r * 3 + 2], d = e[f * 3] - e[r * 3], u = e[f * 3 + 1] - e[r * 3 + 1], p = e[f * 3 + 2] - e[r * 3 + 2], T = l * p - c * u, w = c * d - a * p, g = a * u - l * d;
|
|
145
|
+
[r, n, f].forEach((h) => {
|
|
146
|
+
s[h * 3] += T, s[h * 3 + 1] += w, s[h * 3 + 2] += g;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
for (let i = 0; i < o; i += 1) {
|
|
150
|
+
const r = Math.hypot(
|
|
151
|
+
s[i * 3],
|
|
152
|
+
s[i * 3 + 1],
|
|
153
|
+
s[i * 3 + 2]
|
|
154
|
+
);
|
|
155
|
+
r > 0 && (s[i * 3] /= r, s[i * 3 + 1] /= r, s[i * 3 + 2] /= r);
|
|
156
|
+
}
|
|
157
|
+
return s;
|
|
158
|
+
}, J = (e, t) => {
|
|
159
|
+
const o = new Uint16Array(e.length * 3);
|
|
160
|
+
for (let s = 0; s < e.length; s += 1) {
|
|
161
|
+
const i = e[s];
|
|
162
|
+
o[s * 3] = t[i * 3], o[s * 3 + 1] = t[i * 3 + 1], o[s * 3 + 2] = t[i * 3 + 2];
|
|
163
|
+
}
|
|
164
|
+
return o;
|
|
165
|
+
}, ee = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO2YpZcAAAAASUVORK5CYII=", te = () => {
|
|
166
|
+
const e = new Uint8Array([
|
|
167
|
+
32,
|
|
168
|
+
32,
|
|
169
|
+
32,
|
|
170
|
+
255,
|
|
171
|
+
96,
|
|
172
|
+
96,
|
|
173
|
+
96,
|
|
174
|
+
255,
|
|
175
|
+
176,
|
|
176
|
+
176,
|
|
177
|
+
176,
|
|
178
|
+
255,
|
|
179
|
+
255,
|
|
180
|
+
255,
|
|
181
|
+
255,
|
|
182
|
+
255
|
|
183
|
+
]), t = new E.DataTexture(e, 4, 1, E.RGBAFormat);
|
|
184
|
+
return t.minFilter = E.NearestFilter, t.magFilter = E.NearestFilter, t.generateMipmaps = !1, t.needsUpdate = !0, t;
|
|
185
|
+
}, ne = () => {
|
|
186
|
+
const e = document.createElement("canvas");
|
|
187
|
+
e.width = 256, e.height = 256;
|
|
188
|
+
const t = e.getContext("2d");
|
|
189
|
+
if (!t)
|
|
190
|
+
return new E.CanvasTexture(e);
|
|
191
|
+
const o = t.createRadialGradient(96, 80, 10, 128, 128, 128);
|
|
192
|
+
o.addColorStop(0, "#ffffff"), o.addColorStop(0.18, "#f7d794"), o.addColorStop(0.45, "#d97706"), o.addColorStop(0.72, "#78350f"), o.addColorStop(1, "#120701"), t.fillStyle = o, t.fillRect(0, 0, e.width, e.height);
|
|
193
|
+
const s = new E.CanvasTexture(e);
|
|
194
|
+
return s.needsUpdate = !0, s;
|
|
195
|
+
}, oe = [
|
|
196
|
+
"face.center",
|
|
197
|
+
"face.forehead",
|
|
198
|
+
"face.noseTip",
|
|
199
|
+
"face.chin",
|
|
200
|
+
"face.leftEyeOuter",
|
|
201
|
+
"face.rightEyeOuter",
|
|
202
|
+
"face.leftCheek",
|
|
203
|
+
"face.rightCheek",
|
|
204
|
+
"face.mouthCenter",
|
|
205
|
+
"face.leftEye",
|
|
206
|
+
"face.rightEye",
|
|
207
|
+
"face.leftEarlobe",
|
|
208
|
+
"face.rightEarlobe",
|
|
209
|
+
"face.custom"
|
|
210
|
+
], re = [
|
|
211
|
+
"hand.wrist",
|
|
212
|
+
"hand.thumbTip",
|
|
213
|
+
"hand.indexTip",
|
|
214
|
+
"hand.middleTip",
|
|
215
|
+
"hand.ringTip",
|
|
216
|
+
"hand.pinkyTip",
|
|
217
|
+
"hand.indexBase",
|
|
218
|
+
"hand.middleBase",
|
|
219
|
+
"hand.ringBase",
|
|
220
|
+
"hand.pinkyBase"
|
|
221
|
+
], ce = [
|
|
222
|
+
"body.head",
|
|
223
|
+
"body.neck",
|
|
224
|
+
"body.leftShoulder",
|
|
225
|
+
"body.rightShoulder",
|
|
226
|
+
"body.leftElbow",
|
|
227
|
+
"body.rightElbow",
|
|
228
|
+
"body.leftWrist",
|
|
229
|
+
"body.rightWrist",
|
|
230
|
+
"body.leftHip",
|
|
231
|
+
"body.rightHip",
|
|
232
|
+
"body.leftKnee",
|
|
233
|
+
"body.rightKnee",
|
|
234
|
+
"body.leftAnkle",
|
|
235
|
+
"body.rightAnkle"
|
|
236
|
+
], H = (e) => e.startsWith("face.") ? "face" : e.startsWith("hand.") ? "hand" : e.startsWith("body.") ? "body" : null, ae = {
|
|
237
|
+
target: "face.center",
|
|
238
|
+
customAnchorPoint: { x: 0, y: 0, z: 0 },
|
|
239
|
+
offset: { x: 0, y: 0, z: 0 },
|
|
240
|
+
smoothing: 0,
|
|
241
|
+
followFaceRoll: !1
|
|
242
|
+
}, _ = (e, t, o) => t + o * (e - t), F = (e, t) => 1 / (1 + 1 / (2 * Math.PI * e) / t), I = (e, t, o, s, i, r) => {
|
|
243
|
+
if (!e.initialized || o <= 0)
|
|
244
|
+
return e.pos.copy(t), e.prevRaw.copy(t), e.dxHat.set(0, 0, 0), e.initialized = !0, e;
|
|
245
|
+
const n = F(r, o), f = ["x", "y", "z"];
|
|
246
|
+
for (const a of f) {
|
|
247
|
+
const l = (t[a] - e.prevRaw[a]) / o, c = _(l, e.dxHat[a], n);
|
|
248
|
+
e.dxHat[a] = c;
|
|
249
|
+
const d = s + i * Math.abs(c), u = F(d, o);
|
|
250
|
+
e.pos[a] = _(t[a], e.pos[a], u), e.prevRaw[a] = t[a];
|
|
251
|
+
}
|
|
252
|
+
return e;
|
|
253
|
+
}, B = (e, t, o, s) => I(e, t, o, s * 0.1, 0.5, 1), se = ({
|
|
254
|
+
target: e,
|
|
255
|
+
customAnchorPoint: t,
|
|
256
|
+
offset: o,
|
|
257
|
+
smoothing: s = 0,
|
|
258
|
+
children: i
|
|
259
|
+
}) => {
|
|
260
|
+
const r = z(), n = x(null), f = x(!1), a = x(new E.Vector3()), l = x({
|
|
261
|
+
pos: new E.Vector3(),
|
|
262
|
+
prevRaw: new E.Vector3(),
|
|
263
|
+
dxHat: new E.Vector3(),
|
|
264
|
+
initialized: !1
|
|
265
|
+
}), c = H(e), d = r !== null && c !== null && r.type !== c, u = r === null, p = u || d || c === null;
|
|
266
|
+
return U(() => {
|
|
267
|
+
u ? console.warn(
|
|
268
|
+
`[TrackingAnchor] target "${e}" requires a FaceTracker / HandTracker / BodyTracker ancestor; rendering null.`
|
|
269
|
+
) : d ? console.warn(
|
|
270
|
+
`[TrackingAnchor] target "${e}" namespace does not match parent tracker type "${r == null ? void 0 : r.type}"; rendering null.`
|
|
271
|
+
) : c === null && console.warn(
|
|
272
|
+
`[TrackingAnchor] target "${e}" is not a recognized face/hand/body landmark; rendering null.`
|
|
273
|
+
);
|
|
274
|
+
}, [e, c, u, d, r == null ? void 0 : r.type]), N((T, w) => {
|
|
275
|
+
if (p || !n.current || !r) return;
|
|
276
|
+
const g = r.resolveLandmark(e, t);
|
|
277
|
+
if (!g) {
|
|
278
|
+
n.current.visible = !1, f.current = !1, l.current.initialized = !1;
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
n.current.visible = !0;
|
|
282
|
+
const h = a.current.copy(g.position), y = n.current.parent;
|
|
283
|
+
if (y) {
|
|
284
|
+
y.updateMatrixWorld();
|
|
285
|
+
const A = new E.Matrix4().copy(y.matrixWorld).invert();
|
|
286
|
+
h.applyMatrix4(A);
|
|
287
|
+
}
|
|
288
|
+
o && (h.x += o[0], h.y += o[1], h.z += o[2]), s > 0 ? (B(l.current, h, f.current ? w : 0, s), n.current.position.copy(l.current.pos)) : n.current.position.copy(h), f.current = !0, g.quaternion && n.current.quaternion.copy(g.quaternion);
|
|
289
|
+
}), p ? null : /* @__PURE__ */ C("group", { ref: n, renderOrder: v.TRACKED, children: i });
|
|
290
|
+
};
|
|
291
|
+
export {
|
|
292
|
+
ce as B,
|
|
293
|
+
k as D,
|
|
294
|
+
oe as F,
|
|
295
|
+
re as H,
|
|
296
|
+
ee as T,
|
|
297
|
+
M as a,
|
|
298
|
+
S as b,
|
|
299
|
+
ae as c,
|
|
300
|
+
X as d,
|
|
301
|
+
$ as e,
|
|
302
|
+
te as f,
|
|
303
|
+
ne as g,
|
|
304
|
+
j as h,
|
|
305
|
+
Q as i,
|
|
306
|
+
Z as j,
|
|
307
|
+
O as k,
|
|
308
|
+
se as l,
|
|
309
|
+
Y as m,
|
|
310
|
+
H as n,
|
|
311
|
+
q as r,
|
|
312
|
+
B as s,
|
|
313
|
+
J as t
|
|
314
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const E=require("react/jsx-runtime"),_=require("@react-three/fiber"),n=require("react"),X=require("three"),g=require("./index-CfSF8LXa.cjs"),j=require("./uv-BMFt19bg.cjs"),N=require("./landmarks-BlUqf5MZ.cjs");function W(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const c=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,c.get?c:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const M=W(X),U=({materialProps:e,settings:t})=>t.type==="basic"?E.jsx("meshBasicMaterial",{...e}):E.jsx("meshStandardMaterial",{...e,roughness:t.roughness,metalness:t.metalness}),P=1e-6,Z=e=>{const{x:t,y:r,z:c}=e.scale;return Math.abs(t-r)<=P&&Math.abs(t-c)<=P?t:1},B=(e,t,r,c)=>{if(!r.enabled)return e;const a=Z(r);return c.x=t.x+(e.x-t.x)*a+r.position.x,c.y=t.y+(e.y-t.y)*a-r.position.y,c.z=t.z+(e.z-t.z)*a+r.position.z,c},K=(e,t,r)=>g.unprojectToZZeroInto(e,t,r),I=(e,t,r)=>{const c=(e.x-.5)*2,a=(.5-e.y)*2,m=M.MathUtils.clamp(e.z*2,-1,1);return r.set(c,a,m).unproject(t)},Y=(e,t,r,c,a,m)=>{const T=Math.min(t,e.length);for(let h=0;h<T;h++){a(e[h],c,m);const o=h*3;r[o]=m.x,r[o+1]=m.y,r[o+2]=m.z}return T},H=468,G=H*3,Q={type:"standard",color:"#ffffff",opacity:1,wireframe:!1,roughness:1,metalness:0},w=({material:e,faceIndex:t=0,numFaces:r,visible:c=!0,children:a})=>{const{ready:m,node:T}=N.useXRModel(g.XRModel.FACE_TRACKER,r===void 0?void 0:{numFaces:r}),{camera:h}=_.useThree(),o=n.useRef(null),F=n.useRef(null),v=n.useRef(null),p=n.useRef(null),C=n.useRef(null),y=n.useRef(new M.Vector3),l=n.useMemo(()=>{const f=new Uint16Array(j.FACE_MESH_INDICES),d=new M.BufferAttribute(f,1),u=new M.Float32BufferAttribute(j.FACE_MESH_UV,2),A=new M.Float32BufferAttribute(new Float32Array(G),3);A.setUsage(M.DynamicDrawUsage);const s=A.array;return{indexAttr:d,uvAttr:u,positionAttr:A,positions:s}},[]);n.useEffect(()=>{p.current=l.indexAttr,C.current=l.uvAttr,v.current=l.positionAttr,F.current=l.positions;const f=o.current;if(f){const d=f.geometry;d.setAttribute("position",l.positionAttr),d.setAttribute("uv",l.uvAttr),d.setIndex(l.indexAttr)}return()=>{p.current=null,C.current=null,v.current=null,F.current=null}},[l]),_.useFrame(()=>{var R;if(!m||!T||!o.current)return;const{detectionResults:f}=T,d=(R=f==null?void 0:f.faceLandmarks)==null?void 0:R[t],u=o.current.geometry,A=F.current,s=v.current;if(!d||d.length===0||!A||!s){u.drawRange.count!==0&&u.setDrawRange(0,0);return}u.getAttribute("position")!==s&&(u.setAttribute("position",s),u.setAttribute("uv",C.current),u.setIndex(p.current)),u.drawRange.count===0&&u.setDrawRange(0,1/0),Y(d,H,A,h,K,y.current),s.needsUpdate=!0,u.computeVertexNormals()});const k=a!=null&&a!==!1;return E.jsxs("mesh",{material:e,ref:o,visible:c,children:[E.jsx("bufferGeometry",{}),!e&&!k&&E.jsx(U,{settings:Q,materialProps:{attach:"material",transparent:!0,depthWrite:!1,side:M.DoubleSide,needsUpdate:!0}}),!e&&k?a:null]})};w.displayName="FaceMesh";const D=n.createContext(null),$=()=>n.useContext(D),L=new M.Euler,J=({faceIndex:e=0,numFaces:t,scaleWithFace:r=!1,followFaceRoll:c=!0,targetFps:a,active:m=!0,children:T})=>{const h=n.useRef(null),o=n.useRef(null),F=n.useMemo(()=>{if(!(t===void 0&&a===void 0))return{...t===void 0?{}:{numFaces:t},...a===void 0?{}:{targetFps:a}}},[t,a]),{ready:v,node:p}=N.useXRModel(g.XRModel.FACE_TRACKER,F,m),{camera:C}=_.useThree(),y=n.useRef(C);y.current=C;const l=n.useRef(null),k=n.useRef({x:0,y:0,z:0,visibility:0});_.useFrame(()=>{if(!v||!p||!o.current)return;l.current=p;const s=h.current;y.current&&((s==null?void 0:s.node)!==p||s.faceIndex!==e||s.camera!==y.current)&&(p.setCamera(y.current,e),h.current={node:p,faceIndex:e,camera:y.current});const R=p.getFace(e);if(!R){o.current.visible=!1;return}o.current.visible=!0;const{position:i,quaternion:x,scale:b}=R.transform;o.current.position.set(i.x,i.y,i.z),o.current.quaternion.copy(x),c||(L.setFromQuaternion(x,"XYZ"),L.z=0,o.current.quaternion.setFromEuler(L)),r?o.current.scale.set(b.x,b.y,b.z):o.current.scale.set(1,1,1)});const f=n.useCallback((s,R)=>{var z,O,q;const i=l.current,x=(O=(z=i==null?void 0:i.detectionResults)==null?void 0:z.faceLandmarks)==null?void 0:O[e];if(!x||x.length===0)return null;const b=N.resolveFaceAnchorPoint(s,x,R,k.current,((q=i==null?void 0:i.getFace(e))==null?void 0:q.mirrored)!==!1);return b?{position:g.feedToWorld(b,y.current)}:null},[e]),d=n.useMemo(()=>({type:"face",resolveLandmark:f,faceIndex:e}),[f,e]);let u;const A=[];return n.Children.forEach(T,s=>{var R,i;n.isValidElement(s)&&(((R=s.type)==null?void 0:R.displayName)==="FaceTracker.Mesh"||((i=s.type)==null?void 0:i.displayName)==="FaceMesh")?u=n.cloneElement(s,{faceIndex:e,numFaces:t}):A.push(s)}),E.jsxs(D.Provider,{value:d,children:[E.jsx("group",{ref:o,renderOrder:j.RENDER_LAYERS.TRACKED,children:A}),u]})},V=e=>E.jsx(w,{...e});V.displayName="FaceTracker.Mesh";const S=J;S.Mesh=V;const ee=S;exports.FaceMesh=w;exports.FaceTracker=S;exports.HeadTracker=ee;exports.MeshMaterial=U;exports.TrackerContext=D;exports.projectLandmarkWithDepth=I;exports.transformFaceMeshLandmark=B;exports.useTrackerContext=$;
|