@vincentt-xr/sdk 2.0.0-alpha.1 → 2.0.0-alpha.2
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 +1588 -20
- package/dist/{DebuggerUI-CatYc-RG.cjs → DebuggerUI-B45_Gb9d.cjs} +1 -1
- package/dist/{DebuggerUI-gLMKiVwJ.js → DebuggerUI-Cq28c18s.js} +1 -1
- package/dist/FaceMeshRenderer-6t8OsQhK.js +1195 -0
- package/dist/FaceMeshRenderer-lQLhYIW-.cjs +155 -0
- package/dist/FaceRetouch-CDrL0pXg.js +551 -0
- package/dist/FaceRetouch-DtNl8-4e.cjs +134 -0
- package/dist/audio/AudioEngine.d.ts +3 -1
- package/dist/audio/AudioPlayer.d.ts +29 -0
- package/dist/audio/AudioPlayerLogic.d.ts +4 -0
- package/dist/audio/index.d.ts +2 -0
- package/dist/components/Axes/index.d.ts +6 -0
- package/dist/components/FaceMesh/FaceMeshRenderer.d.ts +17 -0
- package/dist/components/FaceMesh/canonical/CanonicalFaceMeshRenderer.d.ts +17 -1
- package/dist/components/FaceMesh/canonical/FaceMeshMaterial.d.ts +25 -0
- package/dist/components/FaceMesh/canonical/assets.d.ts +3 -0
- package/dist/components/FaceMesh/canonical/geometryGroups.d.ts +9 -0
- package/dist/components/FaceMesh/canonical/parseCanonicalFaceModel.d.ts +2 -0
- package/dist/components/FaceMesh/canonical/shaders.d.ts +2 -0
- package/dist/components/FaceMesh/deform.d.ts +3 -0
- package/dist/components/FaceMesh/index.d.ts +5 -0
- package/dist/components/FaceMesh/material/defaults.d.ts +70 -0
- package/dist/components/FaceMesh/material/index.d.ts +1 -0
- package/dist/components/FaceMesh/material/options.d.ts +5 -1
- package/dist/components/FaceMesh/material/support.d.ts +7 -2
- package/dist/components/FaceMesh/material/textures.d.ts +4 -0
- package/dist/components/FaceMesh/material/types.d.ts +2 -2
- package/dist/components/FaceRetouch/Background.d.ts +5 -6
- package/dist/components/FaceRetouch/FaceRetouch.d.ts +47 -0
- package/dist/components/FaceRetouch/index.d.ts +2 -8
- package/dist/components/FaceRetouch/landmarkMask.d.ts +0 -5
- package/dist/components/FaceRetouch/useFaceRetouchMask.d.ts +3 -7
- package/dist/components/FaceTracker/index.d.ts +5 -3
- package/dist/components/FaceWarp3D/FaceWarp3DHead.d.ts +1 -1
- package/dist/components/HandJoints2D/index.d.ts +1 -1
- package/dist/components/HandTracking2D/HandVisual.d.ts +1 -1
- package/dist/components/HandTracking2D/index.d.ts +1 -1
- package/dist/components/HandTracking2DController/index.d.ts +1 -1
- package/dist/components/HandTracking3D/index.d.ts +1 -1
- package/dist/components/LightObject/index.d.ts +20 -0
- package/dist/components/LookAt/index.d.ts +23 -0
- package/dist/components/MeshRenderer/index.d.ts +58 -0
- package/dist/components/PerspectiveCamera/index.d.ts +2 -8
- package/dist/components/PinToMesh/index.d.ts +47 -0
- package/dist/components/RenderGroupLayer/index.d.ts +6 -0
- package/dist/components/SceneObjectRenderer/index.d.ts +16 -0
- package/dist/components/Screen2D/ScreenTransformFrame.d.ts +11 -0
- package/dist/components/Screen2D/ScreenTransformHelpers.d.ts +19 -0
- package/dist/components/Screen2D/ScreenTransformInteraction.d.ts +18 -0
- package/dist/components/Screen2D/index.d.ts +5 -0
- package/dist/components/ScreenGlass/defaults.d.ts +3 -0
- package/dist/components/ScreenGlass/index.d.ts +5 -0
- package/dist/components/ScreenGlass/shaders.d.ts +2 -0
- package/dist/components/ScreenGlass/types.d.ts +10 -0
- package/dist/components/ScreenGradient/defaults.d.ts +5 -0
- package/dist/components/ScreenGradient/index.d.ts +5 -0
- package/dist/components/ScreenGradient/shaders.d.ts +2 -0
- package/dist/components/ScreenGradient/types.d.ts +19 -0
- package/dist/components/ScreenImage/ScreenImage.d.ts +4 -0
- package/dist/components/ScreenImage/components/DynamicTextureSync.d.ts +9 -0
- package/dist/components/ScreenImage/components/ScreenImageBody.d.ts +9 -0
- package/dist/components/ScreenImage/components/ScreenImageFrame.d.ts +9 -0
- package/dist/components/ScreenImage/components/ScreenImageTransformFrame.d.ts +9 -0
- package/dist/components/ScreenImage/fit.d.ts +52 -0
- package/dist/components/ScreenImage/index.d.ts +8 -87
- package/dist/components/ScreenImage/materials/ScreenImageBlendMaterial.d.ts +9 -0
- package/dist/components/ScreenImage/materials/ScreenImageMatcap.d.ts +3 -0
- package/dist/components/ScreenImage/source.d.ts +16 -0
- package/dist/components/ScreenImage/types.d.ts +37 -0
- package/dist/components/ScreenImage/utils/ScreenImageConstants.d.ts +9 -0
- package/dist/components/ScreenImage/utils/ScreenImageHelpers.d.ts +4 -0
- package/dist/components/ScreenShape/geometry.d.ts +5 -0
- package/dist/components/ScreenShape/index.d.ts +5 -0
- package/dist/components/ScreenShape/types.d.ts +41 -0
- package/dist/components/ScreenSpaceUI/ScreenTransformGuide.d.ts +15 -0
- package/dist/components/ScreenSpaceUI/ScreenTransformOverlayGuide.d.ts +9 -0
- package/dist/components/ScreenSpaceUI/index.d.ts +2 -0
- package/dist/components/ScreenText/components/ScreenTextBody.d.ts +2 -0
- package/dist/components/ScreenText/components/ScreenTextTransformFrame.d.ts +9 -0
- package/dist/components/ScreenText/constants.d.ts +5 -0
- package/dist/components/ScreenText/index.d.ts +6 -20
- package/dist/components/ScreenText/types.d.ts +31 -0
- package/dist/components/ScreenText/utils/ScreenTextHelpers.d.ts +14 -0
- package/dist/components/ScreenText/utils/ScreenTextMappings.d.ts +17 -0
- package/dist/components/SequentialRenderPasses/index.d.ts +6 -0
- package/dist/components/TextLabel/TextLabel.d.ts +5 -0
- package/dist/components/TextLabel/alignment.d.ts +4 -0
- package/dist/components/TextLabel/bend.d.ts +9 -0
- package/dist/components/TextLabel/canvas/buildTextLabelTexture.d.ts +4 -0
- package/dist/components/TextLabel/canvas/canvasTypography.d.ts +13 -0
- package/dist/components/TextLabel/canvas/drawBackground.d.ts +21 -0
- package/dist/components/TextLabel/canvas/drawEffects.d.ts +34 -0
- package/dist/components/TextLabel/canvas/drawText.d.ts +19 -0
- package/dist/components/TextLabel/components/TextLabelMesh.d.ts +13 -0
- package/dist/components/TextLabel/constants.d.ts +2 -0
- package/dist/components/TextLabel/hooks/useTextLabelTexture.d.ts +7 -0
- package/dist/components/TextLabel/index.d.ts +2 -161
- package/dist/components/TextLabel/layout/measurement.d.ts +8 -0
- package/dist/components/TextLabel/layout/resolveTextLayout.d.ts +25 -0
- package/dist/components/TextLabel/layout/wrapText.d.ts +6 -0
- package/dist/components/TextLabel/types.d.ts +227 -0
- package/dist/components/TrackingAnchor/index.d.ts +18 -2
- package/dist/components/Transform3D/index.d.ts +30 -0
- package/dist/components/XRMediaSurface/index.d.ts +6 -6
- package/dist/components/XRViewport/XRViewport.d.ts +11 -0
- package/dist/components/XRViewport/components/HiddenMedia.d.ts +7 -0
- package/dist/components/XRViewport/components/MediaAssetPicker.d.ts +8 -0
- package/dist/components/XRViewport/components/MediaControlStack.d.ts +13 -0
- package/dist/components/XRViewport/components/XRViewportLayers.d.ts +30 -0
- package/dist/components/XRViewport/constants.d.ts +24 -0
- package/dist/components/XRViewport/contexts.d.ts +6 -0
- package/dist/components/XRViewport/hooks/useViewportExternalFaces.d.ts +13 -0
- package/dist/components/XRViewport/hooks/useViewportMediaSource.d.ts +16 -0
- package/dist/components/XRViewport/hooks/useViewportMediaTexture.d.ts +10 -0
- package/dist/components/XRViewport/hooks/useViewportPipeline.d.ts +41 -0
- package/dist/components/XRViewport/hooks/useViewportRenderState.d.ts +47 -0
- package/dist/components/XRViewport/index.d.ts +3 -118
- package/dist/components/XRViewport/layout.d.ts +16 -0
- package/dist/components/XRViewport/slots.d.ts +16 -0
- package/dist/components/XRViewport/types.d.ts +89 -0
- package/dist/components/XRViewport/useViewportSize.d.ts +3 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/contexts-BKvTIayr.cjs +1 -0
- package/dist/contexts-Bk5zz_VR.js +214 -0
- package/dist/debug-ui/component-editor/index.d.ts +19 -0
- package/dist/debug-ui/face-mesh-renderer-settings/index.d.ts +8 -0
- package/dist/debug-ui/face-retouch/index.d.ts +11 -0
- package/dist/debug-ui/hand-joints-2d/index.d.ts +1 -1
- package/dist/debug-ui/hand-tracking-2d/index.d.ts +1 -1
- package/dist/debug-ui/hand-tracking-2d-controller/index.d.ts +1 -1
- package/dist/debug-ui/hand-tracking-3d/index.d.ts +1 -1
- package/dist/debug-ui/hierarchy-panel/index.d.ts +29 -0
- package/dist/debug-ui/index.d.ts +25 -2
- package/dist/debug-ui/layer-panel/index.d.ts +3 -2
- package/dist/debug-ui/media-source/index.d.ts +2 -0
- package/dist/debug-ui/media-source/session.d.ts +12 -0
- package/dist/debug-ui/media-source.cjs +1 -1
- package/dist/debug-ui/media-source.js +6 -4
- package/dist/debug-ui/mesh-renderer-settings/index.d.ts +6 -0
- package/dist/debug-ui/object-inspector-panel/index.d.ts +25 -0
- package/dist/debug-ui/pin-to-mesh-settings/index.d.ts +10 -0
- package/dist/debug-ui/scene-editor/context.d.ts +38 -0
- package/dist/debug-ui/scene-editor/hierarchy-panel.d.ts +9 -0
- package/dist/debug-ui/scene-editor/index.d.ts +11 -0
- package/dist/debug-ui/scene-editor/inspector-panel.d.ts +7 -0
- package/dist/debug-ui/scene-editor/store-utils.d.ts +2 -0
- package/dist/debug-ui/scene-editor/viewport-toolbar.d.ts +4 -0
- package/dist/debug-ui/scene-editor/viewport.d.ts +21 -0
- package/dist/debug-ui/screen-glass-settings/index.d.ts +6 -0
- package/dist/debug-ui/screen-gradient-settings/GradientStopsEditor.d.ts +5 -0
- package/dist/debug-ui/screen-gradient-settings/index.d.ts +6 -0
- package/dist/debug-ui/screen-gradient-settings/styles.d.ts +3 -0
- package/dist/debug-ui/screen-image-settings/index.d.ts +4 -2
- package/dist/debug-ui/screen-shape-settings/index.d.ts +6 -0
- package/dist/debug-ui/screen-text-settings/NumberField.d.ts +9 -0
- package/dist/debug-ui/screen-text-settings/ScreenTextSettingsPanel.d.ts +3 -0
- package/dist/debug-ui/screen-text-settings/controls/NestedSection.d.ts +7 -0
- package/dist/debug-ui/screen-text-settings/controls/Section.d.ts +8 -0
- package/dist/debug-ui/screen-text-settings/controls/icons.d.ts +4 -0
- package/dist/debug-ui/screen-text-settings/index.d.ts +2 -122
- package/dist/debug-ui/screen-text-settings/sections/BackgroundSection.d.ts +8 -0
- package/dist/debug-ui/screen-text-settings/sections/ContentSection.d.ts +5 -0
- package/dist/debug-ui/screen-text-settings/sections/EffectsSection.d.ts +25 -0
- package/dist/debug-ui/screen-text-settings/sections/StyleSection.d.ts +5 -0
- package/dist/debug-ui/screen-text-settings/sections/TransformSection.d.ts +5 -0
- package/dist/debug-ui/screen-text-settings/sections/background/BackgroundFillControls.d.ts +2 -0
- package/dist/debug-ui/screen-text-settings/sections/background/BackgroundSizeControls.d.ts +2 -0
- package/dist/debug-ui/screen-text-settings/sections/background/BackgroundStrokeControls.d.ts +2 -0
- package/dist/debug-ui/screen-text-settings/sections/background/types.d.ts +7 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/BendEffectSection.d.ts +4 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/EffectChrome.d.ts +21 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/GlowEffectSection.d.ts +4 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/InnerShadowEffectSection.d.ts +4 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/OutlineEffectSection.d.ts +4 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/ShadowEffectSection.d.ts +4 -0
- package/dist/debug-ui/screen-text-settings/sections/effects/types.d.ts +14 -0
- package/dist/debug-ui/screen-text-settings/settings.d.ts +90 -0
- package/dist/debug-ui/screen-text-settings/styles.d.ts +26 -0
- package/dist/debug-ui/screen-text-settings/transform.d.ts +6 -0
- package/dist/debug-ui/screen-text-settings/types.d.ts +9 -0
- package/dist/debug-ui/shared/ScreenTransformSection.d.ts +6 -3
- package/dist/debug-ui/transform-3d-settings/index.d.ts +11 -0
- package/dist/debug-ui.cjs +3 -13
- package/dist/debug-ui.js +7896 -5098
- package/dist/drawNormalizedCrop-B-7zU-Xw.cjs +1 -0
- package/dist/drawNormalizedCrop-CRdIDyl1.js +44 -0
- package/dist/entries/all.d.ts +1 -0
- package/dist/entries/core.d.ts +53 -6
- package/dist/entries/face-effects.d.ts +10 -8
- package/dist/entries/internal.d.ts +1 -1
- package/dist/entries/low-level.d.ts +18 -4
- package/dist/entries/scene-object.d.ts +10 -0
- package/dist/entries/tracking.d.ts +25 -2
- package/dist/face-action/index.d.ts +34 -0
- package/dist/face-attribute-expression/index.d.ts +10 -0
- package/dist/face-effects.cjs +1 -342
- package/dist/face-effects.js +1391 -2767
- package/dist/face-info/blendshapes.d.ts +3 -0
- package/dist/face-info/derive.d.ts +8 -0
- package/dist/face-info/drawFaceCrop.d.ts +10 -0
- package/dist/face-info/getFaceInfo.d.ts +8 -0
- package/dist/face-info/index.d.ts +8 -0
- package/dist/face-info/landmarks.d.ts +21 -0
- package/dist/face-info/types.d.ts +52 -0
- package/dist/getFaceInfo-CyPAKh3h.cjs +1 -0
- package/dist/getFaceInfo-hUKMLFcr.js +118 -0
- package/dist/{handJoints2d.d.ts → hand/handJoints2d.d.ts} +1 -1
- package/dist/{handTracking2d.d.ts → hand/handTracking2d.d.ts} +1 -1
- package/dist/{handTracking2dController.d.ts → hand/handTracking2dController.d.ts} +1 -1
- package/dist/{handTracking3d.d.ts → hand/handTracking3d.d.ts} +1 -1
- package/dist/hooks/faceResults.d.ts +1 -1
- package/dist/hooks/useCalibrationFaceTracker.d.ts +1 -1
- package/dist/hooks/useFaceAction.d.ts +3 -0
- package/dist/hooks/useFaceAttributeExpression.d.ts +16 -0
- package/dist/hooks/useFaceDetection.d.ts +18 -0
- package/dist/hooks/useFaceInfo.d.ts +7 -0
- package/dist/hooks/useFaceInfos.d.ts +15 -0
- package/dist/hooks/useFaceResultReader.d.ts +10 -0
- package/dist/hooks/useFrameCapture.d.ts +18 -0
- package/dist/hooks/useMediaRecorder.d.ts +14 -2
- package/dist/hooks/useOwnedTexture.d.ts +6 -0
- package/dist/hooks/useTrackerContext.d.ts +2 -2
- package/dist/hooks/useXRSession/facade.d.ts +3 -0
- package/dist/hooks/useXRSession/registry.d.ts +9 -0
- package/dist/index-82aENaRq.cjs +1 -0
- package/dist/{index-BGNbrc4C.js → index-BgQAX8rs.js} +213 -125
- package/dist/index-CEc1CAmB.cjs +1 -0
- package/dist/index-CTHeBQOs.js +178 -0
- package/dist/index-D4bLzBr6.cjs +1 -0
- package/dist/index-DSpzjuqd.cjs +1 -0
- package/dist/index-Di70KWuY.js +2049 -0
- package/dist/index-DzEzkBIH.cjs +17 -0
- package/dist/{index-safCs_af.js → index-JygePOwo.js} +565 -508
- package/dist/index-UC0Ux38E.js +111 -0
- package/dist/{internal-Cae1ps15.js → internal-DuMPpcbp.js} +86 -80
- package/dist/internal-i2JkM85N.cjs +1 -0
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +2 -2
- package/dist/low-level.cjs +1 -1
- package/dist/low-level.js +1229 -86
- package/dist/main.cjs +1 -73
- package/dist/main.js +545 -1693
- package/dist/material/MaterialFill.d.ts +20 -0
- package/dist/material/MeshMaterial.d.ts +14 -0
- package/dist/material/index.d.ts +2 -0
- package/dist/models/Body/index.d.ts +1 -1
- package/dist/models/Face/index.d.ts +1 -0
- package/dist/models/Face/rotation.d.ts +3 -0
- package/dist/render/renderGroups.d.ts +47 -0
- package/dist/render/renderPasses.d.ts +18 -0
- package/dist/renderGroups-C9QJrAXu.js +152 -0
- package/dist/renderGroups-Dvm1J4lW.cjs +1 -0
- package/dist/renderLayers-lDtL0_43.cjs +1 -0
- package/dist/renderLayers-zrK2pv5O.js +13 -0
- package/dist/renderPasses-CT5iBwtg.cjs +21 -0
- package/dist/renderPasses-CjgG_6kQ.js +1500 -0
- package/dist/scene-object/index.d.ts +146 -0
- package/dist/scene-object/runtimeRegistry.d.ts +14 -0
- package/dist/scene-object.cjs +1 -0
- package/dist/scene-object.js +40 -0
- package/dist/{screenImageSettings.d.ts → screen-image/screenImageSettings.d.ts} +9 -2
- package/dist/{screenTextSettings.d.ts → screen-text/screenTextSettings.d.ts} +18 -2
- package/dist/screen2d/coordinates.d.ts +87 -0
- package/dist/screen2d/index.d.ts +3 -0
- package/dist/screen2d/screenTransform.d.ts +47 -0
- package/dist/screen2d/smoothing.d.ts +5 -0
- package/dist/{selectors-BLl2JUWW.cjs → selectors-2QvO5RYY.cjs} +1 -1
- package/dist/{selectors-CXd_x-6t.js → selectors-Dw3C-gSk.js} +3 -3
- package/dist/services/MetricsCollector/index.d.ts +7 -1
- package/dist/services/MetricsCollector/utils.d.ts +1 -1
- package/dist/session-BChR4TgK.cjs +31 -0
- package/dist/session-C1StwN0f.js +363 -0
- package/dist/texture/animatedTexture.d.ts +61 -0
- package/dist/texture/animationMath.d.ts +8 -0
- package/dist/texture/sourceResolver.d.ts +30 -0
- package/dist/tracking.cjs +1 -1
- package/dist/tracking.js +580 -321
- package/dist/types/face.d.ts +1 -13
- package/dist/types/index.d.ts +0 -1
- package/dist/types/nodes.d.ts +2 -1
- package/dist/types/session.d.ts +2 -0
- package/dist/types/tracking.d.ts +8 -2
- package/dist/types/util-types.d.ts +1 -1
- package/dist/useFaceInfo-C-WfMlYp.cjs +1 -0
- package/dist/useFaceInfo-CwsHZedC.js +62 -0
- package/dist/useFaceResults-CkFc1egZ.js +19 -0
- package/dist/useFaceResults-VcFdOUFV.cjs +1 -0
- package/dist/utils/drawNormalizedCrop.d.ts +22 -0
- package/dist/utils/integrity.d.ts +4 -25
- package/dist/utils/landmarkBounds.d.ts +1 -1
- package/dist/utils/logger.d.ts +2 -2
- package/docs/MIGRATION_GUIDE.md +589 -0
- package/docs/SDK_DOCUMENTATION.md +1155 -0
- package/docs/api/audio.mdx +36 -0
- package/docs/api/behavior-components.mdx +164 -0
- package/docs/api/capture-recording.mdx +103 -0
- package/docs/api/debug-ui-scene-editor.mdx +249 -0
- package/docs/api/face-actions.mdx +104 -0
- package/docs/api/face-attribute-expression.mdx +87 -0
- package/docs/api/face-binding-anchors.mdx +53 -0
- package/docs/api/face-effects.mdx +19 -0
- package/docs/api/face-info.mdx +112 -0
- package/docs/api/face-mesh.mdx +98 -0
- package/docs/api/face-painting.mdx +33 -0
- package/docs/api/face-retouching.mdx +73 -0
- package/docs/api/material-render-state.mdx +132 -0
- package/docs/api/runtime-3d.mdx +311 -0
- package/docs/api/scene-object-store.mdx +213 -0
- package/docs/api/screen-image.mdx +41 -0
- package/docs/api/screen-shape.mdx +64 -0
- package/docs/api/screen-space-coordinates.mdx +41 -0
- package/docs/api/screen-text.mdx +39 -0
- package/docs/api/texture-sources.mdx +55 -0
- package/docs/api/trackers.mdx +46 -0
- package/docs/docs.json +70 -0
- package/docs/examples/scene-object-recipes.mdx +194 -0
- package/docs/guides/harness-debug-ui.mdx +139 -0
- package/docs/inspector/hierarchy-panel.mdx +51 -0
- package/docs/inspector/object-inspector-panel.mdx +51 -0
- package/docs/introduction.mdx +121 -0
- package/docs/scene-objects/overview.mdx +127 -0
- package/docs/scene-objects/render-groups.mdx +77 -0
- package/docs/scene-objects/runtime-rendering.mdx +75 -0
- package/docs/texture-api-consumer.md +58 -0
- package/package.json +37 -7
- package/dist/MediaSourceSwitcher-C-xYg0nQ.js +0 -317
- package/dist/MediaSourceSwitcher-Cq3g4IKw.cjs +0 -31
- package/dist/components/FaceRetouch/defaults.d.ts +0 -13
- package/dist/components/FaceRetouch/retouchRegions.d.ts +0 -23
- package/dist/components/FaceRetouch/useFaceRetouchRegions.d.ts +0 -12
- package/dist/defaults-BLpcN3pG.cjs +0 -1
- package/dist/defaults-LtY4M7dg.js +0 -55
- package/dist/index-BXyObVHF.cjs +0 -1
- package/dist/index-CY3bUAcW.js +0 -12
- package/dist/index-C_Duh13c.cjs +0 -1
- package/dist/index-D8fpPQkC.cjs +0 -1
- package/dist/index-DxshgBu0.cjs +0 -1
- package/dist/index-O-2crZ3M.js +0 -1102
- package/dist/internal-BjyhBP8i.cjs +0 -1
- package/dist/modules/XRClient/index.d.ts +0 -9
- package/dist/modules/index.d.ts +0 -1
- package/dist/screenImageSettings-6NRg4cx9.js +0 -39
- package/dist/screenImageSettings-y_B4_767.cjs +0 -1
- package/dist/services/ApiService.d.ts +0 -12
- package/dist/types/client.d.ts +0 -3
- package/dist/useFaceResults-cpsSmKKc.js +0 -81
- package/dist/useFaceResults-hVUJYSEY.cjs +0 -1
- package/dist/useXRModel-3DcUa28n.cjs +0 -1
- package/dist/useXRModel-BMJE1hrk.js +0 -28
- /package/dist/{layerStack.d.ts → render/layerStack.d.ts} +0 -0
- /package/dist/{screenImagePresets.d.ts → screen-image/screenImagePresets.d.ts} +0 -0
- /package/dist/{screenTextPresets.d.ts → screen-text/screenTextPresets.d.ts} +0 -0
package/dist/low-level.js
CHANGED
|
@@ -1,14 +1,1049 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { u as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
1
|
+
var ce = Object.defineProperty;
|
|
2
|
+
var de = (e, t, r) => t in e ? ce(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var X = (e, t, r) => de(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { u as ue, X as te } from "./index-JygePOwo.js";
|
|
5
|
+
import { u as he } from "./index-BgQAX8rs.js";
|
|
6
|
+
import { H as Ct, a as St } from "./index-BgQAX8rs.js";
|
|
7
|
+
import { c as pe } from "./selectors-Dw3C-gSk.js";
|
|
8
|
+
import { b as Et, a as It, e as Mt, u as Tt, d as Ft } from "./selectors-Dw3C-gSk.js";
|
|
9
|
+
import { useEffect as F, useState as S, useRef as L, useCallback as fe, useLayoutEffect as me, useMemo as q, Children as ge, isValidElement as be } from "react";
|
|
10
|
+
import { c as we } from "./getFaceInfo-hUKMLFcr.js";
|
|
11
|
+
import { d as Lt, e as zt } from "./getFaceInfo-hUKMLFcr.js";
|
|
12
|
+
import { jsx as g, jsxs as z, Fragment as P } from "react/jsx-runtime";
|
|
13
|
+
import { PerspectiveCamera as xe } from "@react-three/drei";
|
|
14
|
+
import { S as Dt, g as Vt, c as At, d as Bt, u as Wt } from "./index-CTHeBQOs.js";
|
|
15
|
+
import { u as re } from "./useFaceResults-CkFc1egZ.js";
|
|
16
|
+
import { h as Ht } from "./hasFullUnitUVBounds-BGvcFsQM.js";
|
|
17
|
+
import { X as ve, a as ye, b as Ce } from "./contexts-Bk5zz_VR.js";
|
|
18
|
+
import { c as $t, d as qt, u as Nt } from "./contexts-Bk5zz_VR.js";
|
|
19
|
+
import * as V from "three";
|
|
20
|
+
const W = ({
|
|
21
|
+
children: e,
|
|
22
|
+
config: t,
|
|
23
|
+
style: r
|
|
24
|
+
}) => /* @__PURE__ */ g(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
"data-render-target": t.name,
|
|
28
|
+
style: {
|
|
29
|
+
position: "absolute",
|
|
30
|
+
inset: 0,
|
|
31
|
+
overflow: "hidden",
|
|
32
|
+
background: t.clearColor,
|
|
33
|
+
pointerEvents: t.pointerEvents ?? "none",
|
|
34
|
+
zIndex: t.zIndex,
|
|
35
|
+
opacity: t.hidden ? 0 : 1,
|
|
36
|
+
...r
|
|
37
|
+
},
|
|
38
|
+
children: e
|
|
39
|
+
}
|
|
40
|
+
), N = ({
|
|
41
|
+
canvas: e,
|
|
42
|
+
layout: t,
|
|
43
|
+
media: r,
|
|
44
|
+
mirrored: n,
|
|
45
|
+
filter: o
|
|
46
|
+
}) => {
|
|
47
|
+
const i = Math.round(t.destination.width), a = Math.round(t.destination.height);
|
|
48
|
+
e.width !== i && (e.width = i), e.height !== a && (e.height = a);
|
|
49
|
+
const s = e.getContext("2d");
|
|
50
|
+
s && (s.setTransform(1, 0, 0, 1, 0, 0), s.clearRect(0, 0, i, a), n && (s.translate(i, 0), s.scale(-1, 1)), o && (s.filter = o), s.drawImage(r, t.offsetX, t.offsetY, t.drawWidth, t.drawHeight), o && (s.filter = "none"), s.setTransform(1, 0, 0, 1, 0, 0));
|
|
51
|
+
}, ne = ({
|
|
52
|
+
canvasRef: e,
|
|
53
|
+
enabled: t = !0,
|
|
54
|
+
fps: r = 30,
|
|
55
|
+
imageRef: n,
|
|
56
|
+
layout: o,
|
|
57
|
+
mirrored: i,
|
|
58
|
+
sourceKind: a,
|
|
59
|
+
videoRef: s
|
|
60
|
+
}) => {
|
|
61
|
+
F(() => {
|
|
62
|
+
if (!t) {
|
|
63
|
+
const b = e.current, f = b == null ? void 0 : b.getContext("2d");
|
|
64
|
+
b && f && f.clearRect(0, 0, b.width, b.height);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
let l = 0, c = 0;
|
|
68
|
+
const d = r > 0 ? 1e3 / r : 0, h = (b) => {
|
|
69
|
+
if (l = requestAnimationFrame(h), d > 0 && b - c < d) return;
|
|
70
|
+
c = b;
|
|
71
|
+
const f = e.current;
|
|
72
|
+
if (!f || !o) return;
|
|
73
|
+
if (a === "image") {
|
|
74
|
+
const m = n.current;
|
|
75
|
+
if (!m || !m.complete || m.naturalWidth <= 0 || m.naturalHeight <= 0)
|
|
76
|
+
return;
|
|
77
|
+
N({
|
|
78
|
+
canvas: f,
|
|
79
|
+
layout: o,
|
|
80
|
+
media: m,
|
|
81
|
+
mirrored: i
|
|
82
|
+
});
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const w = s.current;
|
|
86
|
+
!w || w.readyState < 2 || w.videoWidth <= 0 || w.videoHeight <= 0 || N({
|
|
87
|
+
canvas: f,
|
|
88
|
+
layout: o,
|
|
89
|
+
media: w,
|
|
90
|
+
mirrored: i
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
return l = requestAnimationFrame(h), () => {
|
|
94
|
+
cancelAnimationFrame(l);
|
|
95
|
+
};
|
|
96
|
+
}, [e, t, r, n, o, i, a, s]);
|
|
97
|
+
}, Se = ({
|
|
98
|
+
canvasRef: e,
|
|
99
|
+
imageRef: t,
|
|
100
|
+
layer: r,
|
|
101
|
+
layout: n,
|
|
102
|
+
mirrored: o,
|
|
103
|
+
sourceKind: i,
|
|
104
|
+
videoRef: a
|
|
105
|
+
}) => (ne({
|
|
106
|
+
canvasRef: e,
|
|
107
|
+
imageRef: t,
|
|
108
|
+
layout: n,
|
|
109
|
+
mirrored: o,
|
|
110
|
+
sourceKind: i,
|
|
111
|
+
videoRef: a
|
|
112
|
+
}), /* @__PURE__ */ g(W, { config: r, children: /* @__PURE__ */ g(
|
|
113
|
+
"canvas",
|
|
114
|
+
{
|
|
115
|
+
ref: e,
|
|
116
|
+
style: {
|
|
117
|
+
position: "absolute",
|
|
118
|
+
inset: 0,
|
|
119
|
+
width: "100%",
|
|
120
|
+
height: "100%",
|
|
121
|
+
display: "block",
|
|
122
|
+
background: "#000"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
) })), lt = ({
|
|
126
|
+
canvasRef: e,
|
|
127
|
+
controlInsetTop: t,
|
|
128
|
+
debugVisible: r,
|
|
129
|
+
fps: n = 15,
|
|
130
|
+
imageRef: o,
|
|
131
|
+
layer: i,
|
|
132
|
+
layout: a,
|
|
133
|
+
mirrored: s,
|
|
134
|
+
sourceKind: l,
|
|
135
|
+
videoRef: c,
|
|
136
|
+
viewportSize: d
|
|
137
|
+
}) => {
|
|
138
|
+
ne({
|
|
139
|
+
canvasRef: e,
|
|
140
|
+
enabled: r,
|
|
141
|
+
fps: n,
|
|
142
|
+
imageRef: o,
|
|
143
|
+
layout: a,
|
|
144
|
+
mirrored: s,
|
|
145
|
+
sourceKind: l,
|
|
146
|
+
videoRef: c
|
|
147
|
+
});
|
|
148
|
+
const h = Math.min(220, Math.max(120, d.width * 0.22)), b = d.width > 0 && d.height > 0 ? d.width / d.height : 1, f = Math.min(d.height - 24, Math.max(t ?? 16, 16));
|
|
149
|
+
return /* @__PURE__ */ g(W, { config: i, children: /* @__PURE__ */ g(
|
|
150
|
+
"canvas",
|
|
151
|
+
{
|
|
152
|
+
ref: e,
|
|
153
|
+
style: {
|
|
154
|
+
position: "absolute",
|
|
155
|
+
left: 16,
|
|
156
|
+
top: f,
|
|
157
|
+
width: r ? h : 1,
|
|
158
|
+
height: r ? "auto" : 1,
|
|
159
|
+
aspectRatio: `${b}`,
|
|
160
|
+
opacity: r ? 0.85 : 0,
|
|
161
|
+
borderRadius: 10,
|
|
162
|
+
border: r ? "1px solid rgba(255,255,255,0.16)" : "none",
|
|
163
|
+
pointerEvents: "none",
|
|
164
|
+
objectFit: "contain",
|
|
165
|
+
background: "#000"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
) });
|
|
169
|
+
}, Re = {
|
|
170
|
+
audio: !1,
|
|
171
|
+
video: {
|
|
172
|
+
facingMode: "user",
|
|
173
|
+
frameRate: { ideal: 30, max: 60 }
|
|
174
|
+
}
|
|
175
|
+
}, Ee = {
|
|
176
|
+
name: "viewport-live",
|
|
177
|
+
clearColor: "#000000",
|
|
178
|
+
pointerEvents: "none",
|
|
179
|
+
zIndex: 0
|
|
180
|
+
}, Ie = {
|
|
181
|
+
name: "viewport-ui",
|
|
182
|
+
clearColor: "transparent",
|
|
183
|
+
pointerEvents: "auto",
|
|
184
|
+
zIndex: 5
|
|
185
|
+
}, Me = {
|
|
186
|
+
name: "viewport-scene",
|
|
187
|
+
clearColor: "transparent",
|
|
188
|
+
pointerEvents: "auto",
|
|
189
|
+
zIndex: 1
|
|
190
|
+
}, D = {
|
|
191
|
+
webcam: { icon: "◉", label: "Webcam" },
|
|
192
|
+
image: { icon: "▣", label: "Images" },
|
|
193
|
+
video: { icon: "▶", label: "Videos" }
|
|
194
|
+
}, Te = ({
|
|
195
|
+
imageRef: e,
|
|
196
|
+
selectedSource: t,
|
|
197
|
+
videoRef: r
|
|
198
|
+
}) => /* @__PURE__ */ z(P, { children: [
|
|
199
|
+
/* @__PURE__ */ g(
|
|
200
|
+
"video",
|
|
201
|
+
{
|
|
202
|
+
ref: r,
|
|
203
|
+
style: {
|
|
204
|
+
position: "absolute",
|
|
205
|
+
width: 1,
|
|
206
|
+
height: 1,
|
|
207
|
+
opacity: t === "image" ? 0 : 1e-3,
|
|
208
|
+
pointerEvents: "none"
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
/* @__PURE__ */ g(
|
|
213
|
+
"img",
|
|
214
|
+
{
|
|
215
|
+
ref: e,
|
|
216
|
+
alt: "",
|
|
217
|
+
style: {
|
|
218
|
+
position: "absolute",
|
|
219
|
+
width: 1,
|
|
220
|
+
height: 1,
|
|
221
|
+
opacity: t === "image" ? 1e-3 : 0,
|
|
222
|
+
pointerEvents: "none"
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
)
|
|
226
|
+
] }), J = ({
|
|
227
|
+
dock: e,
|
|
228
|
+
label: t,
|
|
229
|
+
onChange: r,
|
|
230
|
+
options: n,
|
|
231
|
+
value: o
|
|
232
|
+
}) => /* @__PURE__ */ g(
|
|
233
|
+
"div",
|
|
234
|
+
{
|
|
235
|
+
style: {
|
|
236
|
+
position: "absolute",
|
|
237
|
+
top: e === "top-left" ? 74 : void 0,
|
|
238
|
+
bottom: e === "bottom-left" ? 74 : void 0,
|
|
239
|
+
left: 16,
|
|
240
|
+
zIndex: 5,
|
|
241
|
+
maxWidth: "calc(100vw - 32px)",
|
|
242
|
+
padding: 10,
|
|
243
|
+
borderRadius: 14,
|
|
244
|
+
background: "rgba(15, 23, 42, 0.72)",
|
|
245
|
+
border: "1px solid rgba(255,255,255,0.12)",
|
|
246
|
+
boxShadow: "0 12px 30px rgba(0,0,0,0.18)",
|
|
247
|
+
backdropFilter: "blur(10px)"
|
|
248
|
+
},
|
|
249
|
+
children: /* @__PURE__ */ z(
|
|
250
|
+
"label",
|
|
251
|
+
{
|
|
252
|
+
style: {
|
|
253
|
+
display: "grid",
|
|
254
|
+
gap: 6,
|
|
255
|
+
color: "#e5eefb",
|
|
256
|
+
fontSize: 12,
|
|
257
|
+
fontWeight: 700
|
|
258
|
+
},
|
|
259
|
+
children: [
|
|
260
|
+
/* @__PURE__ */ g("span", { children: t }),
|
|
261
|
+
/* @__PURE__ */ g(
|
|
262
|
+
"select",
|
|
263
|
+
{
|
|
264
|
+
value: o,
|
|
265
|
+
onChange: (i) => r(i.target.value),
|
|
266
|
+
style: {
|
|
267
|
+
minWidth: 180,
|
|
268
|
+
maxWidth: "calc(100vw - 52px)",
|
|
269
|
+
height: 36,
|
|
270
|
+
borderRadius: 10,
|
|
271
|
+
border: "1px solid rgba(255,255,255,0.12)",
|
|
272
|
+
background: "rgba(255,255,255,0.06)",
|
|
273
|
+
color: "#e5eefb",
|
|
274
|
+
padding: "0 10px"
|
|
275
|
+
},
|
|
276
|
+
children: n.map((i) => /* @__PURE__ */ g("option", { value: i.id, style: { color: "#111827" }, children: i.label }, i.id))
|
|
277
|
+
}
|
|
278
|
+
)
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
)
|
|
282
|
+
}
|
|
283
|
+
), Fe = ({
|
|
284
|
+
dock: e,
|
|
285
|
+
imageOptions: t,
|
|
286
|
+
selectedImageId: r,
|
|
287
|
+
selectedSource: n,
|
|
288
|
+
selectedVideoId: o,
|
|
289
|
+
setSelectedImageId: i,
|
|
290
|
+
setSelectedSource: a,
|
|
291
|
+
setSelectedVideoId: s,
|
|
292
|
+
showMediaControls: l,
|
|
293
|
+
videoOptions: c
|
|
294
|
+
}) => {
|
|
295
|
+
const [d, h] = S(!1), b = ["webcam", "image", "video"].filter((f) => f === "image" ? t.length > 0 : f === "video" ? c.length > 0 : !0);
|
|
296
|
+
return l ? d ? /* @__PURE__ */ g(
|
|
297
|
+
"button",
|
|
298
|
+
{
|
|
299
|
+
type: "button",
|
|
300
|
+
onClick: () => h(!1),
|
|
301
|
+
"aria-label": "Open media controls",
|
|
302
|
+
title: "Open media controls",
|
|
303
|
+
style: {
|
|
304
|
+
position: "absolute",
|
|
305
|
+
top: e === "top-left" ? 16 : void 0,
|
|
306
|
+
bottom: e === "bottom-left" ? 16 : void 0,
|
|
307
|
+
left: 16,
|
|
308
|
+
zIndex: 5,
|
|
309
|
+
width: 40,
|
|
310
|
+
height: 40,
|
|
311
|
+
border: "1px solid rgba(255,255,255,0.12)",
|
|
312
|
+
borderRadius: 999,
|
|
313
|
+
background: "rgba(15, 23, 42, 0.72)",
|
|
314
|
+
color: "#e5eefb",
|
|
315
|
+
boxShadow: "0 12px 30px rgba(0,0,0,0.18)",
|
|
316
|
+
backdropFilter: "blur(10px)",
|
|
317
|
+
cursor: "pointer"
|
|
318
|
+
},
|
|
319
|
+
children: "≡"
|
|
320
|
+
}
|
|
321
|
+
) : /* @__PURE__ */ z(P, { children: [
|
|
322
|
+
/* @__PURE__ */ z(
|
|
323
|
+
"div",
|
|
324
|
+
{
|
|
325
|
+
style: {
|
|
326
|
+
position: "absolute",
|
|
327
|
+
top: e === "top-left" ? 16 : void 0,
|
|
328
|
+
bottom: e === "bottom-left" ? 16 : void 0,
|
|
329
|
+
left: 16,
|
|
330
|
+
zIndex: 5,
|
|
331
|
+
display: "inline-flex",
|
|
332
|
+
alignItems: "center",
|
|
333
|
+
gap: 8,
|
|
334
|
+
maxWidth: "calc(100vw - 32px)"
|
|
335
|
+
},
|
|
336
|
+
children: [
|
|
337
|
+
/* @__PURE__ */ g(
|
|
338
|
+
"div",
|
|
339
|
+
{
|
|
340
|
+
style: {
|
|
341
|
+
display: "inline-flex",
|
|
342
|
+
alignItems: "center",
|
|
343
|
+
gap: 8,
|
|
344
|
+
padding: 8,
|
|
345
|
+
borderRadius: 999,
|
|
346
|
+
background: "rgba(15, 23, 42, 0.72)",
|
|
347
|
+
border: "1px solid rgba(255,255,255,0.12)",
|
|
348
|
+
boxShadow: "0 12px 30px rgba(0,0,0,0.18)",
|
|
349
|
+
backdropFilter: "blur(10px)",
|
|
350
|
+
overflowX: "auto"
|
|
351
|
+
},
|
|
352
|
+
children: b.map((f) => {
|
|
353
|
+
const w = f === n;
|
|
354
|
+
return /* @__PURE__ */ z(
|
|
355
|
+
"button",
|
|
356
|
+
{
|
|
357
|
+
type: "button",
|
|
358
|
+
onClick: () => a(f),
|
|
359
|
+
"aria-pressed": w,
|
|
360
|
+
title: D[f].label,
|
|
361
|
+
style: {
|
|
362
|
+
border: "none",
|
|
363
|
+
borderRadius: 999,
|
|
364
|
+
minWidth: 42,
|
|
365
|
+
height: 42,
|
|
366
|
+
padding: "0 12px",
|
|
367
|
+
display: "inline-flex",
|
|
368
|
+
alignItems: "center",
|
|
369
|
+
justifyContent: "center",
|
|
370
|
+
gap: 8,
|
|
371
|
+
background: w ? "rgba(56, 189, 248, 0.18)" : "rgba(255,255,255,0.04)",
|
|
372
|
+
color: w ? "#e0f2fe" : "rgba(229,238,251,0.82)",
|
|
373
|
+
cursor: "pointer",
|
|
374
|
+
flex: "0 0 auto"
|
|
375
|
+
},
|
|
376
|
+
children: [
|
|
377
|
+
/* @__PURE__ */ g("span", { style: { fontSize: 14, lineHeight: 1 }, children: D[f].icon }),
|
|
378
|
+
/* @__PURE__ */ g("span", { style: { fontSize: 12, fontWeight: 700, letterSpacing: "0.01em" }, children: D[f].label })
|
|
379
|
+
]
|
|
380
|
+
},
|
|
381
|
+
f
|
|
382
|
+
);
|
|
383
|
+
})
|
|
384
|
+
}
|
|
385
|
+
),
|
|
386
|
+
/* @__PURE__ */ g(
|
|
387
|
+
"button",
|
|
388
|
+
{
|
|
389
|
+
type: "button",
|
|
390
|
+
onClick: () => h(!0),
|
|
391
|
+
"aria-label": "Close media controls",
|
|
392
|
+
title: "Close media controls",
|
|
393
|
+
style: {
|
|
394
|
+
width: 40,
|
|
395
|
+
height: 40,
|
|
396
|
+
border: "1px solid rgba(255,255,255,0.12)",
|
|
397
|
+
borderRadius: 999,
|
|
398
|
+
background: "rgba(15, 23, 42, 0.72)",
|
|
399
|
+
color: "#e5eefb",
|
|
400
|
+
boxShadow: "0 12px 30px rgba(0,0,0,0.18)",
|
|
401
|
+
backdropFilter: "blur(10px)",
|
|
402
|
+
cursor: "pointer",
|
|
403
|
+
flex: "0 0 auto"
|
|
404
|
+
},
|
|
405
|
+
children: "×"
|
|
406
|
+
}
|
|
407
|
+
)
|
|
408
|
+
]
|
|
409
|
+
}
|
|
410
|
+
),
|
|
411
|
+
n === "image" && t.length > 0 && /* @__PURE__ */ g(
|
|
412
|
+
J,
|
|
413
|
+
{
|
|
414
|
+
dock: e,
|
|
415
|
+
label: "Image Asset",
|
|
416
|
+
options: t,
|
|
417
|
+
value: r,
|
|
418
|
+
onChange: i
|
|
419
|
+
}
|
|
420
|
+
),
|
|
421
|
+
n === "video" && c.length > 0 && /* @__PURE__ */ g(
|
|
422
|
+
J,
|
|
423
|
+
{
|
|
424
|
+
dock: e,
|
|
425
|
+
label: "Video Asset",
|
|
426
|
+
options: c,
|
|
427
|
+
value: o,
|
|
428
|
+
onChange: s
|
|
429
|
+
}
|
|
430
|
+
)
|
|
431
|
+
] }) : null;
|
|
432
|
+
}, ke = ({
|
|
433
|
+
containerRef: e,
|
|
434
|
+
displayCanvasRef: t,
|
|
435
|
+
imageOptions: r,
|
|
436
|
+
imageRef: n,
|
|
437
|
+
layout: o,
|
|
438
|
+
managesOwnMedia: i,
|
|
439
|
+
mediaDock: a,
|
|
440
|
+
mode: s,
|
|
441
|
+
overlayContent: l,
|
|
442
|
+
renderOutputs: c,
|
|
443
|
+
sceneContent: d,
|
|
444
|
+
selectedImageId: h,
|
|
445
|
+
selectedSource: b,
|
|
446
|
+
selectedVideoId: f,
|
|
447
|
+
setSceneRenderOutputs: w,
|
|
448
|
+
setSelectedImageId: m,
|
|
449
|
+
setSelectedSource: p,
|
|
450
|
+
setSelectedVideoId: y,
|
|
451
|
+
showMediaControls: T,
|
|
452
|
+
style: R,
|
|
453
|
+
videoOptions: v,
|
|
454
|
+
videoRef: E,
|
|
455
|
+
viewportSize: x,
|
|
456
|
+
mirrored: u
|
|
457
|
+
}) => /* @__PURE__ */ z(
|
|
458
|
+
"div",
|
|
459
|
+
{
|
|
460
|
+
ref: e,
|
|
461
|
+
style: {
|
|
462
|
+
position: "fixed",
|
|
463
|
+
inset: 0,
|
|
464
|
+
overflow: "hidden",
|
|
465
|
+
background: "#000",
|
|
466
|
+
...R
|
|
467
|
+
},
|
|
468
|
+
children: [
|
|
469
|
+
/* @__PURE__ */ g(Te, { imageRef: n, selectedSource: b, videoRef: E }),
|
|
470
|
+
s === "dom" && i && /* @__PURE__ */ g(
|
|
471
|
+
Se,
|
|
472
|
+
{
|
|
473
|
+
canvasRef: t,
|
|
474
|
+
imageRef: n,
|
|
475
|
+
videoRef: E,
|
|
476
|
+
layer: Ee,
|
|
477
|
+
layout: o,
|
|
478
|
+
mirrored: u,
|
|
479
|
+
sourceKind: b === "image" ? "image" : "video"
|
|
480
|
+
}
|
|
481
|
+
),
|
|
482
|
+
(s === "r3f" || s === "hybrid") && /* @__PURE__ */ g(W, { config: Me, children: /* @__PURE__ */ g(
|
|
483
|
+
ve,
|
|
484
|
+
{
|
|
485
|
+
onRenderOutputs: w,
|
|
486
|
+
renderOutputs: {
|
|
487
|
+
sceneColor: c.sceneColor || c.finalColor,
|
|
488
|
+
sceneDepth: c.sceneDepth
|
|
489
|
+
},
|
|
490
|
+
renderTargetSize: x,
|
|
491
|
+
style: { width: "100%", height: "100%" },
|
|
492
|
+
children: d
|
|
493
|
+
}
|
|
494
|
+
) }),
|
|
495
|
+
/* @__PURE__ */ z(W, { config: Ie, children: [
|
|
496
|
+
i && /* @__PURE__ */ g(
|
|
497
|
+
Fe,
|
|
498
|
+
{
|
|
499
|
+
dock: a,
|
|
500
|
+
imageOptions: r,
|
|
501
|
+
selectedImageId: h,
|
|
502
|
+
selectedSource: b,
|
|
503
|
+
selectedVideoId: f,
|
|
504
|
+
setSelectedImageId: m,
|
|
505
|
+
setSelectedSource: p,
|
|
506
|
+
setSelectedVideoId: y,
|
|
507
|
+
showMediaControls: T,
|
|
508
|
+
videoOptions: v
|
|
509
|
+
}
|
|
510
|
+
),
|
|
511
|
+
l
|
|
512
|
+
] })
|
|
513
|
+
]
|
|
514
|
+
}
|
|
515
|
+
), Le = 5, ze = 1, Xe = (e, t) => t, De = "brightness(2.2) contrast(1.5) saturate(1.25)", Ve = ({
|
|
516
|
+
enabled: e,
|
|
517
|
+
displayMirrored: t,
|
|
518
|
+
imageRef: r,
|
|
519
|
+
layout: n,
|
|
520
|
+
mode: o,
|
|
521
|
+
numFaces: i,
|
|
522
|
+
selectedSource: a,
|
|
523
|
+
sourceStream: s,
|
|
524
|
+
videoRef: l
|
|
525
|
+
}) => {
|
|
526
|
+
const { session: c } = ue(), d = L(null), h = L(!1), b = L(document.createElement("canvas")), {
|
|
527
|
+
ready: f,
|
|
528
|
+
node: w,
|
|
529
|
+
error: m
|
|
530
|
+
} = he(te.FACE_TRACKER, {
|
|
531
|
+
numFaces: i ?? (o === "head-binding" ? ze : Le)
|
|
532
|
+
}), [p, y] = S("idle"), [T, R] = S(null), v = e && f && !!w, E = re({
|
|
533
|
+
node: v ? w : null,
|
|
534
|
+
enabled: v,
|
|
535
|
+
selectedSource: a,
|
|
536
|
+
onFrame: fe(() => {
|
|
537
|
+
R(null), y("ready");
|
|
538
|
+
}, [])
|
|
539
|
+
});
|
|
540
|
+
return F(() => {
|
|
541
|
+
if (!e || !n) return;
|
|
542
|
+
const x = () => {
|
|
543
|
+
const C = a === "image" ? r.current : l.current;
|
|
544
|
+
if (C) {
|
|
545
|
+
if (C instanceof HTMLImageElement) {
|
|
546
|
+
if (!C.complete || C.naturalWidth <= 0 || C.naturalHeight <= 0) return;
|
|
547
|
+
} else if (C.readyState < 2 || C.videoWidth <= 0 || C.videoHeight <= 0)
|
|
548
|
+
return;
|
|
549
|
+
N({
|
|
550
|
+
canvas: b.current,
|
|
551
|
+
layout: n,
|
|
552
|
+
media: C,
|
|
553
|
+
mirrored: t,
|
|
554
|
+
filter: a === "webcam" ? De : void 0
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
if (a === "image") {
|
|
559
|
+
x();
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
let u = 0;
|
|
563
|
+
const I = () => {
|
|
564
|
+
u = requestAnimationFrame(I), x();
|
|
565
|
+
};
|
|
566
|
+
return u = requestAnimationFrame(I), () => cancelAnimationFrame(u);
|
|
567
|
+
}, [t, e, r, n, a, l]), F(() => {
|
|
568
|
+
var A;
|
|
569
|
+
if (!e) {
|
|
570
|
+
y("idle"), R(null), h.current = !1, d.current = null;
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
if (!n) {
|
|
574
|
+
y("initializing");
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
const x = (s == null ? void 0 : s.id) ?? (((A = l.current) == null ? void 0 : A.srcObject) instanceof MediaStream ? l.current.srcObject.id : "none"), I = a === "webcam" ? `webcam:${x}` : a;
|
|
578
|
+
d.current !== I && (h.current = !1, d.current = I);
|
|
579
|
+
let C = !1;
|
|
580
|
+
return (async () => {
|
|
581
|
+
try {
|
|
582
|
+
if (y("initializing"), h.current || (await c.setFrameSource({
|
|
583
|
+
canvas: b.current,
|
|
584
|
+
sourceKind: a
|
|
585
|
+
}), await c.start(), h.current = !0), C) return;
|
|
586
|
+
R(null), y("initializing");
|
|
587
|
+
} catch (k) {
|
|
588
|
+
if (C) return;
|
|
589
|
+
y("error"), R(k instanceof Error ? k.message : "Failed to initialize SDK face tracking");
|
|
590
|
+
}
|
|
591
|
+
})(), () => {
|
|
592
|
+
C = !0;
|
|
593
|
+
};
|
|
594
|
+
}, [e, n, a, c, s, l]), F(() => {
|
|
595
|
+
!v && e && !m && y("initializing");
|
|
596
|
+
}, [v, e, m]), F(() => {
|
|
597
|
+
m && (y("error"), R(m.message));
|
|
598
|
+
}, [m]), F(() => () => {
|
|
599
|
+
h.current = !1, c.stop();
|
|
600
|
+
}, [c]), {
|
|
601
|
+
activeDelegate: "GPU",
|
|
602
|
+
faces: E,
|
|
603
|
+
status: p,
|
|
604
|
+
error: T
|
|
605
|
+
};
|
|
606
|
+
}, Ae = (e, t) => e === "auto" ? t === "webcam" ? "cover" : "contain" : e, Be = ({
|
|
607
|
+
imageOptions: e,
|
|
608
|
+
initialImageId: t,
|
|
609
|
+
initialSource: r,
|
|
610
|
+
initialVideoId: n,
|
|
611
|
+
source: o,
|
|
612
|
+
videoOptions: i
|
|
613
|
+
}) => {
|
|
614
|
+
var l, c, d, h;
|
|
615
|
+
const a = (o == null ? void 0 : o.kind) ?? r ?? "webcam";
|
|
616
|
+
return {
|
|
617
|
+
selectedSource: a === "image" && e.length === 0 || a === "video" && i.length === 0 ? "webcam" : a,
|
|
618
|
+
selectedImageId: (o == null ? void 0 : o.kind) === "image" ? o.assetId ?? ((l = e[0]) == null ? void 0 : l.id) ?? "" : t ?? ((c = e[0]) == null ? void 0 : c.id) ?? "",
|
|
619
|
+
selectedVideoId: (o == null ? void 0 : o.kind) === "video" ? o.assetId ?? ((d = i[0]) == null ? void 0 : d.id) ?? "" : n ?? ((h = i[0]) == null ? void 0 : h.id) ?? ""
|
|
620
|
+
};
|
|
621
|
+
}, We = (e, t, r) => {
|
|
622
|
+
if (e.width <= 0 || e.height <= 0 || t.width <= 0 || t.height <= 0)
|
|
623
|
+
return null;
|
|
624
|
+
const n = r === "contain" ? Math.min(t.width / e.width, t.height / e.height) : Math.max(t.width / e.width, t.height / e.height), o = e.width * n, i = e.height * n;
|
|
625
|
+
return {
|
|
626
|
+
source: e,
|
|
627
|
+
destination: t,
|
|
628
|
+
drawWidth: o,
|
|
629
|
+
drawHeight: i,
|
|
630
|
+
offsetX: (t.width - o) * 0.5,
|
|
631
|
+
offsetY: (t.height - i) * 0.5,
|
|
632
|
+
scale: n
|
|
633
|
+
};
|
|
634
|
+
}, Pe = (e) => {
|
|
635
|
+
if (!e) return { width: 0, height: 0 };
|
|
636
|
+
const t = e.getBoundingClientRect();
|
|
637
|
+
return {
|
|
638
|
+
width: t.width || e.clientWidth,
|
|
639
|
+
height: t.height || e.clientHeight
|
|
640
|
+
};
|
|
641
|
+
}, He = (e) => {
|
|
642
|
+
const [t, r] = S({ width: 0, height: 0 });
|
|
643
|
+
return me(() => {
|
|
644
|
+
const n = e.current;
|
|
645
|
+
if (!n) return;
|
|
646
|
+
let o = 0;
|
|
647
|
+
const i = () => {
|
|
648
|
+
const c = Pe(n);
|
|
649
|
+
r(
|
|
650
|
+
(d) => d.width === c.width && d.height === c.height ? d : c
|
|
651
|
+
);
|
|
652
|
+
}, a = () => {
|
|
653
|
+
i(), o && cancelAnimationFrame(o), o = requestAnimationFrame(i);
|
|
654
|
+
};
|
|
655
|
+
a();
|
|
656
|
+
const s = new ResizeObserver(a);
|
|
657
|
+
s.observe(n);
|
|
658
|
+
const l = window.visualViewport;
|
|
659
|
+
return window.addEventListener("resize", a), window.addEventListener("orientationchange", a), l == null || l.addEventListener("resize", a), l == null || l.addEventListener("scroll", a), () => {
|
|
660
|
+
o && cancelAnimationFrame(o), s.disconnect(), window.removeEventListener("resize", a), window.removeEventListener("orientationchange", a), l == null || l.removeEventListener("resize", a), l == null || l.removeEventListener("scroll", a);
|
|
661
|
+
};
|
|
662
|
+
}, [e]), t;
|
|
663
|
+
}, _e = ({
|
|
664
|
+
enabled: e,
|
|
665
|
+
selectedSource: t
|
|
666
|
+
}) => {
|
|
667
|
+
const r = pe(te.FACE_TRACKER);
|
|
668
|
+
return {
|
|
669
|
+
faces: re({ node: r, enabled: e, selectedSource: t }),
|
|
670
|
+
trackerStatus: r ? "ready" : "idle"
|
|
671
|
+
};
|
|
672
|
+
}, O = (e) => {
|
|
673
|
+
e && (e.pause(), e.removeAttribute("src"), e.srcObject = null, e.load());
|
|
674
|
+
}, Q = (e) => {
|
|
675
|
+
e && e.removeAttribute("src");
|
|
676
|
+
}, $e = ({
|
|
677
|
+
enabled: e,
|
|
678
|
+
imageAsset: t,
|
|
679
|
+
selectedSource: r,
|
|
680
|
+
videoAsset: n
|
|
681
|
+
}) => {
|
|
682
|
+
const o = L(null), i = L(null), [a, s] = S(null), [l, c] = S({ width: 0, height: 0 }), [d, h] = S("idle"), [b, f] = S(null);
|
|
683
|
+
return F(() => {
|
|
684
|
+
if (!e) {
|
|
685
|
+
O(o.current), Q(i.current), s(null), c({ width: 0, height: 0 }), h("idle"), f(null);
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
let w = !1, m = null;
|
|
689
|
+
const p = (x, u) => {
|
|
690
|
+
w || (c({ width: x, height: u }), h("ready"), f(null));
|
|
691
|
+
}, y = () => {
|
|
692
|
+
O(o.current), Q(i.current), m == null || m.getTracks().forEach((x) => x.stop()), m = null, s(null);
|
|
693
|
+
}, T = async () => {
|
|
694
|
+
h("requesting");
|
|
695
|
+
const x = await navigator.mediaDevices.getUserMedia(Re);
|
|
696
|
+
if (w) {
|
|
697
|
+
x.getTracks().forEach((I) => I.stop());
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
m = x, s(x);
|
|
701
|
+
const u = o.current;
|
|
702
|
+
u && (u.srcObject = x, u.muted = !0, u.playsInline = !0, u.autoplay = !0, await u.play(), p(u.videoWidth, u.videoHeight));
|
|
703
|
+
}, R = async (x) => {
|
|
704
|
+
h("requesting"), s(null);
|
|
705
|
+
const u = o.current;
|
|
706
|
+
u && (u.src = x, u.muted = !0, u.loop = !0, u.playsInline = !0, u.autoplay = !0, u.crossOrigin = "anonymous", await u.play(), p(u.videoWidth, u.videoHeight));
|
|
707
|
+
}, v = async (x) => {
|
|
708
|
+
h("requesting"), s(null);
|
|
709
|
+
const u = i.current;
|
|
710
|
+
u && (await new Promise((I, C) => {
|
|
711
|
+
u.onload = () => I(), u.onerror = () => C(new Error("Unable to load image")), u.src = x;
|
|
712
|
+
}), p(u.naturalWidth, u.naturalHeight));
|
|
713
|
+
};
|
|
714
|
+
return y(), (async () => {
|
|
715
|
+
try {
|
|
716
|
+
if (r === "webcam") {
|
|
717
|
+
await T();
|
|
718
|
+
return;
|
|
719
|
+
}
|
|
720
|
+
if (r === "video") {
|
|
721
|
+
if (!(n != null && n.src)) throw new Error("Missing video source");
|
|
722
|
+
await R(n.src);
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
if (!(t != null && t.src)) throw new Error("Missing image source");
|
|
726
|
+
await v(t.src);
|
|
727
|
+
} catch (x) {
|
|
728
|
+
if (w) return;
|
|
729
|
+
h("error"), f(x instanceof Error ? x.message : `Unable to initialize ${r}`);
|
|
730
|
+
}
|
|
731
|
+
})(), () => {
|
|
732
|
+
w = !0, y();
|
|
733
|
+
};
|
|
734
|
+
}, [e, t, r, n]), {
|
|
735
|
+
videoRef: o,
|
|
736
|
+
imageRef: i,
|
|
737
|
+
stream: a,
|
|
738
|
+
mediaSize: l,
|
|
739
|
+
status: d,
|
|
740
|
+
error: b
|
|
741
|
+
};
|
|
742
|
+
}, qe = ({
|
|
743
|
+
enabled: e,
|
|
744
|
+
imageRef: t,
|
|
745
|
+
selectedSource: r,
|
|
746
|
+
status: n,
|
|
747
|
+
videoRef: o
|
|
748
|
+
}) => {
|
|
749
|
+
const [i, a] = S(null);
|
|
750
|
+
return F(() => {
|
|
751
|
+
if (!e || n !== "ready") {
|
|
752
|
+
a((c) => (c == null || c.dispose(), null));
|
|
753
|
+
return;
|
|
754
|
+
}
|
|
755
|
+
const s = r === "image" ? t.current : o.current;
|
|
756
|
+
if (!s) return;
|
|
757
|
+
const l = r === "image" ? new V.Texture(s) : new V.VideoTexture(s);
|
|
758
|
+
return l.colorSpace = V.SRGBColorSpace, l.minFilter = V.LinearFilter, l.magFilter = V.LinearFilter, l.generateMipmaps = !1, l.needsUpdate = !0, a((c) => (c == null || c.dispose(), l)), () => {
|
|
759
|
+
l.dispose();
|
|
760
|
+
};
|
|
761
|
+
}, [e, t, r, n, o]), i;
|
|
762
|
+
}, Ne = ({
|
|
763
|
+
externalTracker: e,
|
|
764
|
+
imageOptions: t,
|
|
765
|
+
layout: r,
|
|
766
|
+
managesOwnMedia: n,
|
|
767
|
+
mediaError: o,
|
|
768
|
+
mediaFitMode: i,
|
|
769
|
+
mediaSize: a,
|
|
770
|
+
mediaStatus: s,
|
|
771
|
+
mirrored: l,
|
|
772
|
+
selectedImage: c,
|
|
773
|
+
selectedImageId: d,
|
|
774
|
+
selectedSource: h,
|
|
775
|
+
selectedVideo: b,
|
|
776
|
+
selectedVideoId: f,
|
|
777
|
+
setMirrored: w,
|
|
778
|
+
setSelectedImageId: m,
|
|
779
|
+
setSelectedSource: p,
|
|
780
|
+
setSelectedVideoId: y,
|
|
781
|
+
setShowMediaControls: T,
|
|
782
|
+
showMediaControls: R,
|
|
783
|
+
tracker: v,
|
|
784
|
+
videoOptions: E,
|
|
785
|
+
viewportSize: x
|
|
786
|
+
}) => {
|
|
787
|
+
const u = h === "image" ? `${D.image.label}: ${(c == null ? void 0 : c.label) ?? ""}` : h === "video" ? `${D.video.label}: ${(b == null ? void 0 : b.label) ?? ""}` : D.webcam.label;
|
|
788
|
+
return {
|
|
789
|
+
activeDelegate: n ? v.activeDelegate : null,
|
|
790
|
+
faces: n ? v.faces : e.faces,
|
|
791
|
+
imageOptions: t,
|
|
792
|
+
layout: r,
|
|
793
|
+
mediaError: o,
|
|
794
|
+
mediaFitMode: i,
|
|
795
|
+
mediaLabel: u,
|
|
796
|
+
mediaStatus: s,
|
|
797
|
+
mirrored: l,
|
|
798
|
+
selectedImageId: d,
|
|
799
|
+
selectedSource: h,
|
|
800
|
+
selectedVideoId: f,
|
|
801
|
+
setMirrored: w,
|
|
802
|
+
setSelectedImageId: m,
|
|
803
|
+
setSelectedSource: p,
|
|
804
|
+
setSelectedVideoId: y,
|
|
805
|
+
setShowMediaControls: T,
|
|
806
|
+
showMediaControls: R,
|
|
807
|
+
trackerError: n ? v.error : null,
|
|
808
|
+
trackerStatus: n ? v.status : e.trackerStatus,
|
|
809
|
+
videoOptions: E,
|
|
810
|
+
viewportSize: x,
|
|
811
|
+
mediaSize: a
|
|
812
|
+
};
|
|
813
|
+
}, Ue = ({
|
|
814
|
+
mediaTexture: e,
|
|
815
|
+
previewMode: t,
|
|
816
|
+
renderOutputs: r,
|
|
817
|
+
sceneRenderOutputs: n
|
|
818
|
+
}) => q(
|
|
819
|
+
() => ({
|
|
820
|
+
requested: r,
|
|
821
|
+
previewMode: t,
|
|
822
|
+
mediaColorTexture: e,
|
|
823
|
+
sceneColorTexture: n.sceneColorTexture,
|
|
824
|
+
finalColorTexture: r.finalColor ? n.sceneColorTexture : null,
|
|
825
|
+
sceneDepthTexture: n.sceneDepthTexture,
|
|
826
|
+
estimatedDepthTexture: null,
|
|
827
|
+
available: {
|
|
828
|
+
mediaColor: e !== null,
|
|
829
|
+
sceneColor: n.sceneColorTexture !== null,
|
|
830
|
+
finalColor: !!(r.finalColor && n.sceneColorTexture),
|
|
831
|
+
sceneDepth: n.sceneDepthTexture !== null,
|
|
832
|
+
estimatedDepth: !1
|
|
833
|
+
}
|
|
834
|
+
}),
|
|
835
|
+
[e, t, r, n]
|
|
836
|
+
), je = ({
|
|
837
|
+
fitMode: e,
|
|
838
|
+
imageOptions: t,
|
|
839
|
+
initialImageId: r,
|
|
840
|
+
initialMirrored: n,
|
|
841
|
+
initialSource: o,
|
|
842
|
+
initialVideoId: i,
|
|
843
|
+
mediaStrategy: a,
|
|
844
|
+
previewMode: s,
|
|
845
|
+
renderOutputs: l,
|
|
846
|
+
showMediaControlsByDefault: c,
|
|
847
|
+
source: d,
|
|
848
|
+
videoOptions: h
|
|
849
|
+
}) => {
|
|
850
|
+
const b = L(null), f = L(null), w = He(b), m = q(
|
|
851
|
+
() => Be({
|
|
852
|
+
imageOptions: t,
|
|
853
|
+
initialImageId: r,
|
|
854
|
+
initialSource: o,
|
|
855
|
+
initialVideoId: i,
|
|
856
|
+
source: d,
|
|
857
|
+
videoOptions: h
|
|
858
|
+
}),
|
|
859
|
+
[t, r, o, i, d, h]
|
|
860
|
+
), [p, y] = S(n), [T, R] = S(c), [v, E] = S(
|
|
861
|
+
m.selectedSource
|
|
862
|
+
), [x, u] = S(m.selectedImageId), [I, C] = S(m.selectedVideoId), [K, A] = S({
|
|
863
|
+
sceneColorTexture: null,
|
|
864
|
+
sceneDepthTexture: null
|
|
865
|
+
}), k = a === "internal";
|
|
866
|
+
F(() => {
|
|
867
|
+
d && (E(m.selectedSource), u(m.selectedImageId), C(m.selectedVideoId));
|
|
868
|
+
}, [m, d]);
|
|
869
|
+
const G = t.find(($) => $.id === x) ?? t[0], Y = h.find(($) => $.id === I) ?? h[0], M = $e({
|
|
870
|
+
enabled: k,
|
|
871
|
+
imageAsset: G,
|
|
872
|
+
selectedSource: v,
|
|
873
|
+
videoAsset: Y
|
|
874
|
+
}), H = Ae(e, v), B = q(
|
|
875
|
+
() => We(M.mediaSize, w, H),
|
|
876
|
+
[M.mediaSize, H, w]
|
|
877
|
+
), oe = qe({
|
|
878
|
+
enabled: !!(l.mediaColor || l.finalColor),
|
|
879
|
+
imageRef: M.imageRef,
|
|
880
|
+
selectedSource: v,
|
|
881
|
+
status: M.status,
|
|
882
|
+
videoRef: M.videoRef
|
|
883
|
+
}), _ = Xe(v, p), ie = Ve({
|
|
884
|
+
displayMirrored: _,
|
|
885
|
+
enabled: k && M.status === "ready" && B !== null,
|
|
886
|
+
imageRef: M.imageRef,
|
|
887
|
+
layout: B,
|
|
888
|
+
selectedSource: v,
|
|
889
|
+
sourceStream: M.stream,
|
|
890
|
+
videoRef: M.videoRef
|
|
891
|
+
}), ae = _e({
|
|
892
|
+
enabled: !k,
|
|
893
|
+
selectedSource: v
|
|
894
|
+
}), se = Ne({
|
|
895
|
+
externalTracker: ae,
|
|
896
|
+
imageOptions: t,
|
|
897
|
+
layout: B,
|
|
898
|
+
managesOwnMedia: k,
|
|
899
|
+
mediaError: M.error,
|
|
900
|
+
mediaFitMode: H,
|
|
901
|
+
mediaSize: M.mediaSize,
|
|
902
|
+
mediaStatus: M.status,
|
|
903
|
+
mirrored: _,
|
|
904
|
+
selectedImage: G,
|
|
905
|
+
selectedImageId: x,
|
|
906
|
+
selectedSource: v,
|
|
907
|
+
selectedVideo: Y,
|
|
908
|
+
selectedVideoId: I,
|
|
909
|
+
setMirrored: y,
|
|
910
|
+
setSelectedImageId: u,
|
|
911
|
+
setSelectedSource: E,
|
|
912
|
+
setSelectedVideoId: C,
|
|
913
|
+
setShowMediaControls: R,
|
|
914
|
+
showMediaControls: T,
|
|
915
|
+
tracker: ie,
|
|
916
|
+
videoOptions: h,
|
|
917
|
+
viewportSize: w
|
|
918
|
+
}), le = Ue({
|
|
919
|
+
mediaTexture: oe,
|
|
920
|
+
previewMode: s,
|
|
921
|
+
renderOutputs: l,
|
|
922
|
+
sceneRenderOutputs: K
|
|
923
|
+
});
|
|
924
|
+
return {
|
|
925
|
+
containerRef: b,
|
|
926
|
+
displayCanvasRef: f,
|
|
927
|
+
displayMirrored: _,
|
|
928
|
+
layout: B,
|
|
929
|
+
managesOwnMedia: k,
|
|
930
|
+
media: M,
|
|
931
|
+
renderOutputState: le,
|
|
932
|
+
renderState: se,
|
|
933
|
+
selectedImageId: x,
|
|
934
|
+
selectedSource: v,
|
|
935
|
+
selectedVideoId: I,
|
|
936
|
+
setSceneRenderOutputs: A,
|
|
937
|
+
setSelectedImageId: u,
|
|
938
|
+
setSelectedSource: E,
|
|
939
|
+
setSelectedVideoId: C,
|
|
940
|
+
showMediaControls: T,
|
|
941
|
+
viewportSize: w
|
|
942
|
+
};
|
|
943
|
+
}, U = ({ children: e }) => /* @__PURE__ */ g(P, { children: e });
|
|
944
|
+
U.displayName = "XRViewport.Scene";
|
|
945
|
+
const j = ({ children: e }) => /* @__PURE__ */ g(P, { children: e });
|
|
946
|
+
j.displayName = "XRViewport.Overlay";
|
|
947
|
+
const Ke = (e, t) => {
|
|
948
|
+
if (e === "dom")
|
|
949
|
+
return {
|
|
950
|
+
sceneContent: null,
|
|
951
|
+
overlayContent: t
|
|
952
|
+
};
|
|
953
|
+
let r = null, n = null;
|
|
954
|
+
const o = [];
|
|
955
|
+
return ge.forEach(t, (i) => {
|
|
956
|
+
var s;
|
|
957
|
+
if (!be(i)) {
|
|
958
|
+
i != null && o.push(i);
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
const a = (s = i.type) == null ? void 0 : s.displayName;
|
|
962
|
+
if (a === U.displayName) {
|
|
963
|
+
r = i.props.children;
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
966
|
+
if (a === j.displayName) {
|
|
967
|
+
n = i.props.children;
|
|
968
|
+
return;
|
|
969
|
+
}
|
|
970
|
+
o.push(i);
|
|
971
|
+
}), !n && o.length > 0 && (n = o), {
|
|
972
|
+
sceneContent: r,
|
|
973
|
+
overlayContent: n
|
|
974
|
+
};
|
|
975
|
+
}, Z = (e, t) => typeof e == "function" ? e(t) : e;
|
|
976
|
+
function Ge(e) {
|
|
977
|
+
return e.Scene = U, e.Overlay = j, e;
|
|
978
|
+
}
|
|
979
|
+
const ct = Ge(({
|
|
980
|
+
children: e,
|
|
981
|
+
fitMode: t = "auto",
|
|
982
|
+
imageOptions: r = [],
|
|
983
|
+
initialImageId: n,
|
|
984
|
+
initialMirrored: o = !0,
|
|
985
|
+
initialSource: i = "webcam",
|
|
986
|
+
initialVideoId: a,
|
|
987
|
+
mediaStrategy: s = "internal",
|
|
988
|
+
mediaDock: l = "bottom-left",
|
|
989
|
+
mode: c = "dom",
|
|
990
|
+
previewMode: d = "finalColor",
|
|
991
|
+
renderOutputs: h = {},
|
|
992
|
+
showMediaControlsByDefault: b = !0,
|
|
993
|
+
source: f,
|
|
994
|
+
style: w,
|
|
995
|
+
videoOptions: m = []
|
|
996
|
+
}) => {
|
|
997
|
+
const p = je({
|
|
998
|
+
fitMode: t,
|
|
999
|
+
imageOptions: r,
|
|
1000
|
+
initialImageId: n,
|
|
1001
|
+
initialMirrored: o,
|
|
1002
|
+
initialSource: i,
|
|
1003
|
+
initialVideoId: a,
|
|
1004
|
+
mediaStrategy: s,
|
|
1005
|
+
previewMode: d,
|
|
1006
|
+
renderOutputs: h,
|
|
1007
|
+
showMediaControlsByDefault: b,
|
|
1008
|
+
source: f,
|
|
1009
|
+
videoOptions: m
|
|
1010
|
+
}), y = typeof e == "function" ? e(p.renderState) : e, { sceneContent: T, overlayContent: R } = Ke(c, y), v = Z(
|
|
1011
|
+
T,
|
|
1012
|
+
p.renderState
|
|
1013
|
+
), E = Z(
|
|
1014
|
+
R,
|
|
1015
|
+
p.renderState
|
|
1016
|
+
);
|
|
1017
|
+
return /* @__PURE__ */ g(ye.Provider, { value: p.renderState, children: /* @__PURE__ */ g(Ce.Provider, { value: p.renderOutputState, children: /* @__PURE__ */ g(
|
|
1018
|
+
ke,
|
|
1019
|
+
{
|
|
1020
|
+
containerRef: p.containerRef,
|
|
1021
|
+
displayCanvasRef: p.displayCanvasRef,
|
|
1022
|
+
imageOptions: r,
|
|
1023
|
+
imageRef: p.media.imageRef,
|
|
1024
|
+
layout: p.layout,
|
|
1025
|
+
managesOwnMedia: p.managesOwnMedia,
|
|
1026
|
+
mediaDock: l,
|
|
1027
|
+
mirrored: p.displayMirrored,
|
|
1028
|
+
mode: c,
|
|
1029
|
+
overlayContent: E,
|
|
1030
|
+
renderOutputs: h,
|
|
1031
|
+
sceneContent: v,
|
|
1032
|
+
selectedImageId: p.selectedImageId,
|
|
1033
|
+
selectedSource: p.selectedSource,
|
|
1034
|
+
selectedVideoId: p.selectedVideoId,
|
|
1035
|
+
setSceneRenderOutputs: p.setSceneRenderOutputs,
|
|
1036
|
+
setSelectedImageId: p.setSelectedImageId,
|
|
1037
|
+
setSelectedSource: p.setSelectedSource,
|
|
1038
|
+
setSelectedVideoId: p.setSelectedVideoId,
|
|
1039
|
+
showMediaControls: p.showMediaControls,
|
|
1040
|
+
style: w,
|
|
1041
|
+
videoOptions: m,
|
|
1042
|
+
videoRef: p.media.videoRef,
|
|
1043
|
+
viewportSize: p.viewportSize
|
|
1044
|
+
}
|
|
1045
|
+
) }) });
|
|
1046
|
+
}), Ye = {
|
|
12
1047
|
position: "absolute",
|
|
13
1048
|
top: -28,
|
|
14
1049
|
left: 0,
|
|
@@ -19,13 +1054,13 @@ const x = {
|
|
|
19
1054
|
fontWeight: 700,
|
|
20
1055
|
padding: "4px 8px",
|
|
21
1056
|
whiteSpace: "nowrap"
|
|
22
|
-
},
|
|
1057
|
+
}, dt = ({
|
|
23
1058
|
boundingBox: e,
|
|
24
1059
|
label: t = "face bounding box",
|
|
25
|
-
color:
|
|
26
|
-
style:
|
|
27
|
-
labelStyle:
|
|
28
|
-
}) => /* @__PURE__ */
|
|
1060
|
+
color: r = "#22c55e",
|
|
1061
|
+
style: n,
|
|
1062
|
+
labelStyle: o
|
|
1063
|
+
}) => /* @__PURE__ */ g(
|
|
29
1064
|
"div",
|
|
30
1065
|
{
|
|
31
1066
|
style: {
|
|
@@ -34,29 +1069,43 @@ const x = {
|
|
|
34
1069
|
top: `${e.top * 100}%`,
|
|
35
1070
|
width: `${e.width * 100}%`,
|
|
36
1071
|
height: `${e.height * 100}%`,
|
|
37
|
-
border: `3px solid ${
|
|
1072
|
+
border: `3px solid ${r}`,
|
|
38
1073
|
boxSizing: "border-box",
|
|
39
1074
|
pointerEvents: "none",
|
|
40
1075
|
zIndex: 20,
|
|
41
|
-
...
|
|
1076
|
+
...n
|
|
42
1077
|
},
|
|
43
|
-
children: t !== null && /* @__PURE__ */
|
|
44
|
-
}
|
|
45
|
-
),
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1078
|
+
children: t !== null && /* @__PURE__ */ g("div", { style: { ...Ye, ...o }, children: t })
|
|
1079
|
+
}
|
|
1080
|
+
), ut = (e) => {
|
|
1081
|
+
const [t, r] = S(null);
|
|
1082
|
+
return F(() => {
|
|
1083
|
+
let n = 0;
|
|
1084
|
+
const o = () => {
|
|
1085
|
+
var l, c;
|
|
1086
|
+
n = requestAnimationFrame(o);
|
|
1087
|
+
const i = (c = (l = e == null ? void 0 : e.detectionResults) == null ? void 0 : l.faceLandmarks) == null ? void 0 : c[0];
|
|
1088
|
+
if (!i || i.length === 0) {
|
|
1089
|
+
r(null);
|
|
1090
|
+
return;
|
|
1091
|
+
}
|
|
1092
|
+
const a = we(i), s = {
|
|
1093
|
+
left: a.minX,
|
|
1094
|
+
top: a.minY,
|
|
1095
|
+
width: a.width,
|
|
1096
|
+
height: a.height
|
|
1097
|
+
};
|
|
1098
|
+
r((d) => d && d.left === s.left && d.top === s.top && d.width === s.width && d.height === s.height ? d : s);
|
|
1099
|
+
};
|
|
1100
|
+
return o(), () => {
|
|
1101
|
+
cancelAnimationFrame(n);
|
|
1102
|
+
};
|
|
1103
|
+
}, [e]), t;
|
|
1104
|
+
}, ht = ({
|
|
56
1105
|
background: e = "#000",
|
|
57
1106
|
children: t,
|
|
58
|
-
style:
|
|
59
|
-
}) => /* @__PURE__ */
|
|
1107
|
+
style: r
|
|
1108
|
+
}) => /* @__PURE__ */ g(
|
|
60
1109
|
"div",
|
|
61
1110
|
{
|
|
62
1111
|
style: {
|
|
@@ -64,62 +1113,156 @@ const x = {
|
|
|
64
1113
|
inset: 0,
|
|
65
1114
|
overflow: "hidden",
|
|
66
1115
|
background: e,
|
|
67
|
-
...
|
|
1116
|
+
...r
|
|
68
1117
|
},
|
|
69
1118
|
children: t
|
|
70
1119
|
}
|
|
71
|
-
),
|
|
72
|
-
const
|
|
73
|
-
return
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
1120
|
+
), pt = (e) => {
|
|
1121
|
+
const { makeDefault: t = !0, ...r } = e;
|
|
1122
|
+
return /* @__PURE__ */ g(
|
|
1123
|
+
xe,
|
|
1124
|
+
{
|
|
1125
|
+
position: [0, 0, 40],
|
|
1126
|
+
fov: 30,
|
|
1127
|
+
near: 0.1,
|
|
1128
|
+
far: 1e3,
|
|
1129
|
+
makeDefault: t,
|
|
1130
|
+
...r
|
|
1131
|
+
}
|
|
1132
|
+
);
|
|
1133
|
+
}, ft = ["fill", "contain"], mt = (e, t, r, n, o) => {
|
|
1134
|
+
const i = Math.max(1, Math.floor(t)), a = Math.max(0, Math.floor(e)), s = r === "ping-pong" && i > 1 ? i * 2 - 2 : i, l = Math.floor(a / s), c = o > 0 ? l >= o : !n && a >= s, d = c ? s - 1 : a % s;
|
|
1135
|
+
return { frame: r === "reverse" ? i - 1 - d % i : r === "random" ? d * 7919 % i : r === "ping-pong" && d >= i ? s - d : d, ended: c, loop: l };
|
|
1136
|
+
}, gt = (e, t, r) => {
|
|
1137
|
+
const n = Math.max(1, Math.floor(r));
|
|
1138
|
+
return Math.floor(Math.max(0, e) * Math.max(0, t)) % n;
|
|
1139
|
+
};
|
|
1140
|
+
class bt {
|
|
1141
|
+
constructor(t, r) {
|
|
1142
|
+
X(this, "capabilities");
|
|
1143
|
+
X(this, "snapshot");
|
|
1144
|
+
X(this, "listeners", /* @__PURE__ */ new Set());
|
|
1145
|
+
X(this, "eventListeners", /* @__PURE__ */ new Map());
|
|
1146
|
+
this.capabilities = t, this.snapshot = {
|
|
1147
|
+
state: "idle",
|
|
1148
|
+
frame: 0,
|
|
1149
|
+
time: 0,
|
|
1150
|
+
playMode: "forward",
|
|
1151
|
+
loop: !0,
|
|
1152
|
+
loopCount: 0,
|
|
1153
|
+
...r
|
|
93
1154
|
};
|
|
94
|
-
}
|
|
95
|
-
|
|
1155
|
+
}
|
|
1156
|
+
play() {
|
|
1157
|
+
const t = this.snapshot.state === "paused";
|
|
1158
|
+
this.update({ state: "playing" }), this.emit(t ? "Resume" : "PlayBegin");
|
|
1159
|
+
}
|
|
1160
|
+
pause() {
|
|
1161
|
+
this.update({ state: "paused" }), this.emit("Pause");
|
|
1162
|
+
}
|
|
1163
|
+
restart() {
|
|
1164
|
+
this.update({ state: "playing", frame: 0, time: 0 }), this.emit("PlayBegin");
|
|
1165
|
+
}
|
|
1166
|
+
setPlayMode(t) {
|
|
1167
|
+
this.update({ playMode: t });
|
|
1168
|
+
}
|
|
1169
|
+
setLoop(t, r = 0) {
|
|
1170
|
+
this.update({ loop: t, loopCount: r });
|
|
1171
|
+
}
|
|
1172
|
+
seek(t) {
|
|
1173
|
+
this.capabilities.canSeek && this.update({ frame: Math.max(0, Math.floor(t)), time: Math.max(0, t) });
|
|
1174
|
+
}
|
|
1175
|
+
subscribe(t) {
|
|
1176
|
+
return this.listeners.add(t), () => this.listeners.delete(t);
|
|
1177
|
+
}
|
|
1178
|
+
on(t, r) {
|
|
1179
|
+
const n = this.eventListeners.get(t) ?? /* @__PURE__ */ new Set();
|
|
1180
|
+
return n.add(r), this.eventListeners.set(t, n), () => this.off(t, r);
|
|
1181
|
+
}
|
|
1182
|
+
off(t, r) {
|
|
1183
|
+
var n;
|
|
1184
|
+
(n = this.eventListeners.get(t)) == null || n.delete(r);
|
|
1185
|
+
}
|
|
1186
|
+
getSnapshot() {
|
|
1187
|
+
return this.snapshot;
|
|
1188
|
+
}
|
|
1189
|
+
dispose() {
|
|
1190
|
+
this.listeners.clear(), this.eventListeners.clear(), this.snapshot = { ...this.snapshot, state: "idle" };
|
|
1191
|
+
}
|
|
1192
|
+
emit(t) {
|
|
1193
|
+
var r;
|
|
1194
|
+
(r = this.eventListeners.get(t)) == null || r.forEach((n) => n({ type: t, snapshot: this.snapshot }));
|
|
1195
|
+
}
|
|
1196
|
+
update(t) {
|
|
1197
|
+
this.snapshot = { ...this.snapshot, ...t }, this.listeners.forEach((r) => r(this.snapshot));
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
function wt(e) {
|
|
1201
|
+
return async (t, r) => {
|
|
1202
|
+
const n = e.find((o) => o.canResolve(t));
|
|
1203
|
+
if (!n) throw new Je("No texture provider matched source", t);
|
|
1204
|
+
return Oe(n.resolve.bind(n), t, r);
|
|
1205
|
+
};
|
|
1206
|
+
}
|
|
1207
|
+
class Je extends Error {
|
|
1208
|
+
constructor(r, n) {
|
|
1209
|
+
super(r);
|
|
1210
|
+
X(this, "source");
|
|
1211
|
+
this.name = "TextureSourceLoadError", this.source = n;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
function ee(e) {
|
|
1215
|
+
if (e.aborted)
|
|
1216
|
+
throw new DOMException("Texture source load aborted", "AbortError");
|
|
1217
|
+
}
|
|
1218
|
+
async function Oe(e, t, r) {
|
|
1219
|
+
ee(r);
|
|
1220
|
+
const n = await e(t, r);
|
|
1221
|
+
return r.aborted && (n.dispose(), ee(r)), n;
|
|
1222
|
+
}
|
|
1223
|
+
function xt(e) {
|
|
1224
|
+
e == null || e.dispose();
|
|
1225
|
+
}
|
|
96
1226
|
export {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
1227
|
+
bt as BasicAnimatedTextureController,
|
|
1228
|
+
dt as BoundingBoxOverlay,
|
|
1229
|
+
Ct as HeadTracker,
|
|
1230
|
+
pt as PerspectiveCamera,
|
|
1231
|
+
Dt as ScreenRectAspectContext,
|
|
1232
|
+
ft as TEXTURE_FITS,
|
|
1233
|
+
Je as TextureSourceLoadError,
|
|
1234
|
+
ht as XRCompositor,
|
|
1235
|
+
W as XRLayer,
|
|
1236
|
+
Se as XRMediaSurface,
|
|
1237
|
+
lt as XRTrackingOverlay,
|
|
1238
|
+
ct as XRViewport,
|
|
1239
|
+
we as computeLandmarkBounds,
|
|
1240
|
+
$t as computeScreenTransform,
|
|
1241
|
+
Lt as createFaceInfoTarget,
|
|
1242
|
+
wt as createTextureSourceResolver,
|
|
1243
|
+
xt as disposeResolvedTextureSource,
|
|
1244
|
+
zt as getFaceInfo,
|
|
1245
|
+
mt as getPlaybackFrame,
|
|
1246
|
+
gt as getSequenceFrame,
|
|
1247
|
+
Vt as getThreeBlending,
|
|
1248
|
+
At as getThreeDepthFunction,
|
|
1249
|
+
Bt as getThreeSide,
|
|
1250
|
+
Ht as hasFullUnitUVBounds,
|
|
1251
|
+
Xe as resolveCalibrationFaceDisplayMirrored,
|
|
1252
|
+
Oe as resolveTextureSource,
|
|
1253
|
+
ee as throwIfAborted,
|
|
1254
|
+
Ve as useCalibrationFaceTracker,
|
|
1255
|
+
ut as useFaceBoundingBox,
|
|
1256
|
+
Wt as useScreenSpace,
|
|
1257
|
+
St as useTrackerContext,
|
|
1258
|
+
Et as useXRCameraTexture,
|
|
1259
|
+
ue as useXRContext,
|
|
1260
|
+
It as useXRError,
|
|
1261
|
+
he as useXRModel,
|
|
1262
|
+
pe as useXRModelNode,
|
|
1263
|
+
Mt as useXRPipelineSnapshot,
|
|
1264
|
+
Tt as useXRReady,
|
|
1265
|
+
Ft as useXRRenderSize,
|
|
1266
|
+
qt as useXRViewportRenderOutputs,
|
|
1267
|
+
Nt as useXRViewportState
|
|
125
1268
|
};
|