@vincentt-xr/sdk 2.0.0-alpha.0 → 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 +1813 -27
- package/dist/{DebuggerUI-CEfdddkZ.cjs → DebuggerUI-B45_Gb9d.cjs} +1 -1
- package/dist/{DebuggerUI-Dgop6Q6o.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 +22 -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 +74 -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 +4 -2
- package/dist/components/FaceRetouch/Background.d.ts +9 -5
- package/dist/components/FaceRetouch/FaceRetouch.d.ts +47 -0
- package/dist/components/FaceRetouch/index.d.ts +2 -6
- package/dist/components/FaceRetouch/landmarkMask.d.ts +4 -6
- package/dist/components/FaceRetouch/useFaceRetouchMask.d.ts +4 -7
- package/dist/components/FaceTracker/index.d.ts +5 -3
- package/dist/components/FaceWarp3D/FaceWarp3DHead.d.ts +15 -0
- package/dist/components/FaceWarp3D/defaults.d.ts +37 -0
- package/dist/components/FaceWarp3D/index.d.ts +3 -0
- package/dist/components/FaceWarp3D/warp.d.ts +13 -0
- package/dist/components/HandJoints2D/index.d.ts +6 -0
- package/dist/components/HandTracker/index.d.ts +2 -2
- package/dist/components/HandTracking2D/HandVisual.d.ts +12 -0
- package/dist/components/HandTracking2D/index.d.ts +5 -0
- package/dist/components/HandTracking2DController/index.d.ts +5 -0
- package/dist/components/HandTracking3D/index.d.ts +6 -0
- 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 -0
- 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 -0
- 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 -62
- 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/XRScene/index.d.ts +14 -3
- 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 -101
- 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 +19 -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/default-setting/index.d.ts +37 -0
- package/dist/debug-ui/default-setting.cjs +21 -0
- package/dist/debug-ui/default-setting.js +777 -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/face-warp-3d/index.d.ts +6 -0
- package/dist/debug-ui/hand-joints-2d/index.d.ts +6 -0
- package/dist/debug-ui/hand-tracking-2d/index.d.ts +6 -0
- package/dist/debug-ui/hand-tracking-2d-controller/index.d.ts +6 -0
- package/dist/debug-ui/hand-tracking-3d/index.d.ts +6 -0
- package/dist/debug-ui/hierarchy-panel/index.d.ts +29 -0
- package/dist/debug-ui/index.d.ts +46 -0
- package/dist/debug-ui/layer-panel/index.d.ts +18 -0
- package/dist/debug-ui/media-source/MediaSourceSwitcher.d.ts +10 -0
- package/dist/debug-ui/media-source/index.d.ts +6 -0
- package/dist/debug-ui/media-source/media-preset.d.ts +9 -0
- package/dist/debug-ui/media-source/session.d.ts +12 -0
- package/dist/debug-ui/media-source.cjs +1 -0
- package/dist/debug-ui/media-source.js +9 -0
- 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 +9 -0
- 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 -0
- 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/settings-panel/index.d.ts +38 -0
- package/dist/debug-ui/shared/MaterialSection.d.ts +13 -0
- package/dist/debug-ui/shared/ScreenTransformSection.d.ts +32 -0
- package/dist/debug-ui/transform-3d-settings/index.d.ts +11 -0
- package/dist/debug-ui.cjs +10 -0
- package/dist/debug-ui.js +8861 -0
- 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 +55 -4
- package/dist/entries/face-effects.d.ts +12 -8
- package/dist/entries/internal.d.ts +1 -1
- package/dist/entries/low-level.d.ts +21 -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 -252
- package/dist/face-effects.js +1404 -2613
- 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/hand/handJoints2d.d.ts +49 -0
- package/dist/hand/handTracking2d.d.ts +33 -0
- package/dist/hand/handTracking2dController.d.ts +65 -0
- package/dist/hand/handTracking3d.d.ts +52 -0
- 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-BD-JWMjE.js → index-BgQAX8rs.js} +198 -134
- 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-CYMj26Ej.js → index-JygePOwo.js} +565 -498
- package/dist/index-UC0Ux38E.js +111 -0
- package/dist/{internal-KOKJDxCG.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 +959 -632
- package/dist/main.cjs +1 -1
- package/dist/main.js +556 -455
- 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/models/Hand/HandTracking.d.ts +2 -0
- package/dist/render/layerStack.d.ts +29 -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/screen-image/screenImagePresets.d.ts +13 -0
- package/dist/screen-image/screenImageSettings.d.ts +57 -0
- package/dist/screen-text/screenTextPresets.d.ts +6 -0
- package/dist/screen-text/screenTextSettings.d.ts +147 -0
- package/dist/screen2d/coordinates.d.ts +87 -0
- package/dist/screen2d/index.d.ts +7 -0
- package/dist/screen2d/material-runtime.d.ts +32 -0
- package/dist/screen2d/screenTransform.d.ts +47 -0
- package/dist/screen2d/smoothing.d.ts +5 -0
- package/dist/screen2d/texture.d.ts +10 -0
- package/dist/screen2d/transform.d.ts +25 -0
- package/dist/screen2d/types.d.ts +90 -0
- package/dist/{selectors-Bub0o3qy.cjs → selectors-2QvO5RYY.cjs} +1 -1
- package/dist/{selectors-BHO6TnoC.js → selectors-Dw3C-gSk.js} +5 -5
- 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 +582 -298
- package/dist/types/face.d.ts +1 -13
- package/dist/types/hand-tracking.d.ts +8 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/nodes.d.ts +4 -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/dist/x-Co8jPhP0.js +127 -0
- package/dist/x-KC8E4Gaj.cjs +41 -0
- 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 +55 -7
- package/dist/components/FaceRetouch/retouchRegions.d.ts +0 -23
- package/dist/components/FaceRetouch/useFaceRetouchRegions.d.ts +0 -12
- package/dist/index-B5J4gzn2.cjs +0 -1
- package/dist/index-BVBVg96G.cjs +0 -1
- package/dist/index-DtwHElmG.js +0 -157
- package/dist/index-PtFmD6B8.cjs +0 -1
- package/dist/internal-DH5d1Xnq.cjs +0 -1
- package/dist/modules/XRClient/index.d.ts +0 -9
- package/dist/modules/index.d.ts +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/main.js
CHANGED
|
@@ -1,523 +1,483 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
children: /* @__PURE__ */ p("div", { style: { width: e.width, height: e.height, position: "relative" }, children: r })
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
}, de = "rgba(20,40,110,0.88)", he = 24, fe = 512;
|
|
39
|
-
function _e({
|
|
40
|
-
color: r = de,
|
|
1
|
+
var re = Object.defineProperty;
|
|
2
|
+
var ae = (t, e, s) => e in t ? re(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
|
|
3
|
+
var _ = (t, e, s) => ae(t, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
+
import { X as ne, u as oe } from "./index-JygePOwo.js";
|
|
5
|
+
import { c as yt, d as gt } from "./index-JygePOwo.js";
|
|
6
|
+
import { S as ie } from "./contexts-Bk5zz_VR.js";
|
|
7
|
+
import { X as At } from "./contexts-Bk5zz_VR.js";
|
|
8
|
+
import { c as ce } from "./index-Di70KWuY.js";
|
|
9
|
+
import { L as xt, d as vt, R as Ct, e as Pt, a as Lt, S as Ut, b as Dt, f as Nt, T as bt, g as Ft, m as Ot, n as It, h as Gt, i as kt, j as zt, s as Wt, k as Xt, l as Vt, w as Ht } from "./index-Di70KWuY.js";
|
|
10
|
+
import { jsxs as N, jsx as f, Fragment as q } from "react/jsx-runtime";
|
|
11
|
+
import { useRef as A, useMemo as J, useEffect as U, useState as b, Suspense as ue, useCallback as w, forwardRef as le, useImperativeHandle as de } from "react";
|
|
12
|
+
import * as me from "three";
|
|
13
|
+
import { MathUtils as pe, Vector2 as he, Vector3 as fe, DoubleSide as k, RepeatWrapping as Y, LinearFilter as Z } from "three";
|
|
14
|
+
import { T as jt, U as qt, D as Yt, K as Zt, J as Kt, F as $t, N as Jt, O as Qt, V as es, W as ts, H as ss, M as rs, P as as, S as ns, E as os, B as is, L as cs, Q as us, R as ls, G as ds, X as ms, C as ps, I as hs, Y as fs } from "./renderPasses-CjgG_6kQ.js";
|
|
15
|
+
import { useThree as Ee, useFrame as Se } from "@react-three/fiber";
|
|
16
|
+
import { R as Te } from "./renderLayers-zrK2pv5O.js";
|
|
17
|
+
import { b as Me, c as Re } from "./selectors-Dw3C-gSk.js";
|
|
18
|
+
import { useTexture as ye } from "@react-three/drei";
|
|
19
|
+
import { a as ge } from "./index-CTHeBQOs.js";
|
|
20
|
+
import { D as Ss, b as Ts, M as Ms, n as Rs } from "./index-CTHeBQOs.js";
|
|
21
|
+
import { y as gs, w as ws, A as As, M as _s, S as xs, T as vs, z as Cs, x as Ps } from "./FaceMeshRenderer-6t8OsQhK.js";
|
|
22
|
+
import { d as Us, r as Ds } from "./drawNormalizedCrop-CRdIDyl1.js";
|
|
23
|
+
import { M as bs } from "./index-BgQAX8rs.js";
|
|
24
|
+
const I = (t, e, s, r) => pe.damp(t, e, Math.max(0, s), Math.max(0, r)), Je = (t, e, s, r, a = new he()) => a.set(
|
|
25
|
+
I(t.x, e.x, s, r),
|
|
26
|
+
I(t.y, e.y, s, r)
|
|
27
|
+
), Qe = (t, e, s, r, a = new fe()) => a.set(
|
|
28
|
+
I(t.x, e.x, s, r),
|
|
29
|
+
I(t.y, e.y, s, r),
|
|
30
|
+
I(t.z, e.z, s, r)
|
|
31
|
+
), we = "rgba(20,40,110,0.88)", Ae = 24, _e = 512;
|
|
32
|
+
function et({
|
|
33
|
+
color: t = we,
|
|
41
34
|
borderColor: e,
|
|
42
|
-
borderWidth:
|
|
43
|
-
borderRadius:
|
|
44
|
-
resolution:
|
|
45
|
-
aspect:
|
|
35
|
+
borderWidth: s = 0,
|
|
36
|
+
borderRadius: r = Ae,
|
|
37
|
+
resolution: a = _e,
|
|
38
|
+
aspect: i = 1,
|
|
46
39
|
opacity: o = 1,
|
|
47
|
-
name:
|
|
48
|
-
overlay:
|
|
40
|
+
name: c,
|
|
41
|
+
overlay: n = !0,
|
|
49
42
|
position: u,
|
|
50
|
-
rotation:
|
|
51
|
-
scale:
|
|
52
|
-
visible:
|
|
43
|
+
rotation: S,
|
|
44
|
+
scale: d,
|
|
45
|
+
visible: m
|
|
53
46
|
}) {
|
|
54
|
-
const
|
|
55
|
-
width: Math.round(
|
|
56
|
-
height: Math.round(
|
|
57
|
-
color:
|
|
47
|
+
const h = A(null), l = A(null), T = J(() => xe({
|
|
48
|
+
width: Math.round(a * Math.max(i, 0.05)),
|
|
49
|
+
height: Math.round(a),
|
|
50
|
+
color: t,
|
|
58
51
|
borderColor: e,
|
|
59
|
-
borderWidth:
|
|
60
|
-
borderRadius:
|
|
61
|
-
}), [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}, [
|
|
65
|
-
const
|
|
66
|
-
return
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
69
|
-
return
|
|
70
|
-
|
|
52
|
+
borderWidth: s,
|
|
53
|
+
borderRadius: r
|
|
54
|
+
}), [t, e, s, r, a, i]);
|
|
55
|
+
U(() => () => {
|
|
56
|
+
T.dispose();
|
|
57
|
+
}, [T]);
|
|
58
|
+
const g = A(null), E = A(o);
|
|
59
|
+
return E.current !== o && (E.current = o, g.current = null, l.current && (l.current.opacity = o)), U(() => {
|
|
60
|
+
const x = h.current;
|
|
61
|
+
if (x)
|
|
62
|
+
return x.userData.setOpacity = (P) => {
|
|
63
|
+
g.current = P, l.current && (l.current.opacity = P);
|
|
71
64
|
}, () => {
|
|
72
|
-
delete
|
|
65
|
+
delete x.userData.setOpacity;
|
|
73
66
|
};
|
|
74
|
-
}, []), /* @__PURE__ */
|
|
67
|
+
}, []), /* @__PURE__ */ N(
|
|
75
68
|
"mesh",
|
|
76
69
|
{
|
|
77
|
-
ref:
|
|
78
|
-
name:
|
|
70
|
+
ref: h,
|
|
71
|
+
name: c,
|
|
79
72
|
position: u,
|
|
80
|
-
rotation:
|
|
81
|
-
scale:
|
|
82
|
-
visible:
|
|
73
|
+
rotation: S,
|
|
74
|
+
scale: d,
|
|
75
|
+
visible: m,
|
|
83
76
|
children: [
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ f("planeGeometry", { args: [1, 1] }),
|
|
78
|
+
/* @__PURE__ */ f(
|
|
86
79
|
"meshBasicMaterial",
|
|
87
80
|
{
|
|
88
|
-
ref:
|
|
89
|
-
map:
|
|
81
|
+
ref: l,
|
|
82
|
+
map: T,
|
|
90
83
|
transparent: !0,
|
|
91
84
|
opacity: o,
|
|
92
|
-
depthTest: !
|
|
93
|
-
depthWrite: !
|
|
94
|
-
}
|
|
95
|
-
)
|
|
96
|
-
]
|
|
97
|
-
}
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
function me(r) {
|
|
101
|
-
const { width: e, height: t, color: n, borderColor: i, borderWidth: c, borderRadius: o } = r, a = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(e, t) : (() => {
|
|
102
|
-
const m = document.createElement("canvas");
|
|
103
|
-
return m.width = e, m.height = t, m;
|
|
104
|
-
})(), s = a.getContext("2d");
|
|
105
|
-
s.clearRect(0, 0, e, t);
|
|
106
|
-
const u = Math.min(o, Math.min(e, t) / 2);
|
|
107
|
-
s.beginPath(), s.moveTo(u, 0), s.lineTo(e - u, 0), s.quadraticCurveTo(e, 0, e, u), s.lineTo(e, t - u), s.quadraticCurveTo(e, t, e - u, t), s.lineTo(u, t), s.quadraticCurveTo(0, t, 0, t - u), s.lineTo(0, u), s.quadraticCurveTo(0, 0, u, 0), s.closePath(), s.fillStyle = n, s.fill(), i && c > 0 && (s.lineWidth = c, s.strokeStyle = i, s.stroke());
|
|
108
|
-
const g = new K.CanvasTexture(a);
|
|
109
|
-
return g.needsUpdate = !0, g;
|
|
110
|
-
}
|
|
111
|
-
const ze = ({ children: r, depth: e = 0 }) => {
|
|
112
|
-
const { camera: t, size: n } = Y(), i = I(() => {
|
|
113
|
-
if (!(t instanceof J))
|
|
114
|
-
return { width: 10, height: 10 };
|
|
115
|
-
const c = Math.abs(t.position.z - e), o = t.fov * Math.PI / 180, a = 2 * Math.tan(o / 2) * c;
|
|
116
|
-
return { width: a * (n.width / n.height), height: a };
|
|
117
|
-
}, [t, n, e]);
|
|
118
|
-
return /* @__PURE__ */ p(se.Provider, { value: i, children: /* @__PURE__ */ p("group", { position: [0, 0, e], children: r }) });
|
|
119
|
-
};
|
|
120
|
-
function pe(r, e) {
|
|
121
|
-
return !Number.isFinite(r) || !Number.isFinite(e) || r <= 0 || e <= 0 ? [1, 1, 1] : Math.abs(r - e) < 1e-6 ? [1, 1, 1] : r > e ? [e / r, 1, 1] : [1, r / e, 1];
|
|
122
|
-
}
|
|
123
|
-
const ge = { left: -1, right: 1, top: 1, bottom: -1 }, Me = (r, e, t) => {
|
|
124
|
-
const n = r % e, i = Math.floor(r / e);
|
|
125
|
-
return { x: n / e, y: (t - 1 - i) / t };
|
|
126
|
-
}, ve = ({
|
|
127
|
-
sheet: r,
|
|
128
|
-
contentAspect: e,
|
|
129
|
-
renderOrder: t,
|
|
130
|
-
name: n
|
|
131
|
-
}) => {
|
|
132
|
-
const i = ue(r.url), c = y(0), o = y(-1), a = oe(), [s, u] = e != null ? pe(a, e) : [1, 1];
|
|
133
|
-
return ae((g, m) => {
|
|
134
|
-
i.wrapS = q, i.wrapT = q, i.magFilter = H, i.minFilter = H, i.generateMipmaps = !1, i.repeat.set(1 / r.cols, 1 / r.rows), c.current += m;
|
|
135
|
-
const l = Math.floor(c.current * r.fps) % r.frames;
|
|
136
|
-
if (l === o.current) return;
|
|
137
|
-
o.current = l;
|
|
138
|
-
const { x: M, y: v } = Me(l, r.cols, r.rows);
|
|
139
|
-
i.offset.set(M, v);
|
|
140
|
-
}), /* @__PURE__ */ P("mesh", { name: n, renderOrder: t, scale: [s, u, 1], children: [
|
|
141
|
-
/* @__PURE__ */ p("planeGeometry", { args: [1, 1] }),
|
|
142
|
-
/* @__PURE__ */ p("meshBasicMaterial", { map: i, transparent: !0, toneMapped: !1, depthWrite: !1 })
|
|
143
|
-
] });
|
|
144
|
-
}, Be = ({
|
|
145
|
-
sheet: r,
|
|
146
|
-
anchors: e = ge,
|
|
147
|
-
contentAspect: t,
|
|
148
|
-
renderOrder: n = 10,
|
|
149
|
-
name: i = "spriteAnimation"
|
|
150
|
-
}) => /* @__PURE__ */ p(te, { fallback: null, children: /* @__PURE__ */ p(ie, { anchors: e, children: /* @__PURE__ */ p(ve, { sheet: r, contentAspect: t, renderOrder: n, name: i }) }) }), Te = {
|
|
151
|
-
color: "#ffffff",
|
|
152
|
-
fontWeight: "bold",
|
|
153
|
-
fontFamily: "Arial, sans-serif",
|
|
154
|
-
fontSize: 48,
|
|
155
|
-
bgColor: "rgba(20,40,110,0.88)",
|
|
156
|
-
borderWidth: 0,
|
|
157
|
-
borderRadius: 24,
|
|
158
|
-
padding: 32,
|
|
159
|
-
aspect: 2.5,
|
|
160
|
-
resolution: 512,
|
|
161
|
-
opacity: 1
|
|
162
|
-
};
|
|
163
|
-
function Ie(r) {
|
|
164
|
-
const e = { ...Te, ...r }, {
|
|
165
|
-
text: t,
|
|
166
|
-
color: n,
|
|
167
|
-
fontWeight: i,
|
|
168
|
-
fontFamily: c,
|
|
169
|
-
fontSize: o,
|
|
170
|
-
bgColor: a,
|
|
171
|
-
borderColor: s,
|
|
172
|
-
borderWidth: u,
|
|
173
|
-
borderRadius: g,
|
|
174
|
-
padding: m,
|
|
175
|
-
aspect: l,
|
|
176
|
-
resolution: M,
|
|
177
|
-
opacity: v,
|
|
178
|
-
name: w,
|
|
179
|
-
overlay: b = !0,
|
|
180
|
-
position: S,
|
|
181
|
-
rotation: d,
|
|
182
|
-
scale: L,
|
|
183
|
-
visible: N
|
|
184
|
-
} = e, [_, z] = W(null), [B, A] = W(null), h = y(t);
|
|
185
|
-
h.current !== t && (h.current = t, _ !== null && z(null));
|
|
186
|
-
const T = y(a);
|
|
187
|
-
T.current !== a && (T.current = a, B !== null && A(null));
|
|
188
|
-
const f = y(null), E = _ ?? t, D = B ?? a, O = I(
|
|
189
|
-
() => ye({
|
|
190
|
-
text: E,
|
|
191
|
-
color: n,
|
|
192
|
-
fontWeight: i,
|
|
193
|
-
fontFamily: c,
|
|
194
|
-
fontSize: o,
|
|
195
|
-
bgColor: D,
|
|
196
|
-
borderColor: s,
|
|
197
|
-
borderWidth: u,
|
|
198
|
-
borderRadius: g,
|
|
199
|
-
padding: m,
|
|
200
|
-
height: M,
|
|
201
|
-
width: Math.round(M * Math.max(l, 0.1))
|
|
202
|
-
}),
|
|
203
|
-
[
|
|
204
|
-
E,
|
|
205
|
-
n,
|
|
206
|
-
i,
|
|
207
|
-
c,
|
|
208
|
-
o,
|
|
209
|
-
D,
|
|
210
|
-
s,
|
|
211
|
-
u,
|
|
212
|
-
g,
|
|
213
|
-
m,
|
|
214
|
-
l,
|
|
215
|
-
M
|
|
216
|
-
]
|
|
217
|
-
);
|
|
218
|
-
return k(() => {
|
|
219
|
-
const x = f.current;
|
|
220
|
-
if (x)
|
|
221
|
-
return x.userData.setText = (U) => z(U), x.userData.setBgColor = (U) => A(U), () => {
|
|
222
|
-
delete x.userData.setText, delete x.userData.setBgColor;
|
|
223
|
-
};
|
|
224
|
-
}, []), k(() => () => {
|
|
225
|
-
O.dispose();
|
|
226
|
-
}, [O]), /* @__PURE__ */ P(
|
|
227
|
-
"mesh",
|
|
228
|
-
{
|
|
229
|
-
ref: f,
|
|
230
|
-
name: w,
|
|
231
|
-
position: S,
|
|
232
|
-
rotation: d,
|
|
233
|
-
scale: L,
|
|
234
|
-
visible: N,
|
|
235
|
-
children: [
|
|
236
|
-
/* @__PURE__ */ p("planeGeometry", { args: [1, 1] }),
|
|
237
|
-
/* @__PURE__ */ p(
|
|
238
|
-
"meshBasicMaterial",
|
|
239
|
-
{
|
|
240
|
-
map: O,
|
|
241
|
-
transparent: !0,
|
|
242
|
-
opacity: v,
|
|
243
|
-
depthTest: !b,
|
|
244
|
-
depthWrite: !b
|
|
85
|
+
depthTest: !n,
|
|
86
|
+
depthWrite: !n
|
|
245
87
|
}
|
|
246
88
|
)
|
|
247
89
|
]
|
|
248
90
|
}
|
|
249
91
|
);
|
|
250
92
|
}
|
|
251
|
-
function
|
|
252
|
-
const { width: e, height:
|
|
253
|
-
let { fontSize: s, bgColor: u } = r, g;
|
|
254
|
-
const m = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(e, t) : (() => {
|
|
93
|
+
function xe(t) {
|
|
94
|
+
const { width: e, height: s, color: r, borderColor: a, borderWidth: i, borderRadius: o } = t, c = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(e, s) : (() => {
|
|
255
95
|
const d = document.createElement("canvas");
|
|
256
|
-
return d.width = e, d.height =
|
|
257
|
-
})(),
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
const M = e - a * 2;
|
|
264
|
-
let v = Z(l, n, M, o, s, c);
|
|
265
|
-
const w = Math.max(1, Math.floor((t - a * 2) / (s * 1.3)));
|
|
266
|
-
v.length > w && (s = Math.max(12, Math.round(s * 0.75)), v = Z(l, n, M, o, s, c)), l.font = `${o} ${s}px ${c}`;
|
|
267
|
-
const b = s * 1.3, S = t / 2 - (v.length - 1) * b / 2;
|
|
268
|
-
for (let d = 0; d < v.length; d++)
|
|
269
|
-
l.fillText(v[d], e / 2, S + d * b);
|
|
270
|
-
return g = new K.CanvasTexture(m), g.needsUpdate = !0, g;
|
|
271
|
-
}
|
|
272
|
-
function Z(r, e, t, n, i, c) {
|
|
273
|
-
r.font = `${n} ${i}px ${c}`;
|
|
274
|
-
const o = e.split(" "), a = [];
|
|
275
|
-
let s = "";
|
|
276
|
-
for (const u of o) {
|
|
277
|
-
const g = s ? `${s} ${u}` : u;
|
|
278
|
-
r.measureText(g).width > t && s ? (a.push(s), s = u) : s = g;
|
|
279
|
-
}
|
|
280
|
-
return s && a.push(s), a;
|
|
96
|
+
return d.width = e, d.height = s, d;
|
|
97
|
+
})(), n = c.getContext("2d");
|
|
98
|
+
n.clearRect(0, 0, e, s);
|
|
99
|
+
const u = Math.min(o, Math.min(e, s) / 2);
|
|
100
|
+
n.beginPath(), n.moveTo(u, 0), n.lineTo(e - u, 0), n.quadraticCurveTo(e, 0, e, u), n.lineTo(e, s - u), n.quadraticCurveTo(e, s, e - u, s), n.lineTo(u, s), n.quadraticCurveTo(0, s, 0, s - u), n.lineTo(0, u), n.quadraticCurveTo(0, 0, u, 0), n.closePath(), n.fillStyle = r, n.fill(), a && i > 0 && (n.lineWidth = i, n.strokeStyle = a, n.stroke());
|
|
101
|
+
const S = new me.CanvasTexture(c);
|
|
102
|
+
return S.needsUpdate = !0, S;
|
|
281
103
|
}
|
|
282
|
-
const
|
|
283
|
-
segmentationMask:
|
|
104
|
+
const tt = ({
|
|
105
|
+
segmentationMask: t,
|
|
284
106
|
segmentation: e,
|
|
285
|
-
invert:
|
|
286
|
-
customBackground:
|
|
287
|
-
renderOrder:
|
|
107
|
+
invert: s = !1,
|
|
108
|
+
customBackground: r,
|
|
109
|
+
renderOrder: a = Te.BACKGROUND
|
|
288
110
|
}) => {
|
|
289
|
-
const { camera:
|
|
290
|
-
|
|
111
|
+
const { camera: i, size: o } = Ee(), c = Me(), n = Re(ne.BACKGROUND_SEGMENTATION), u = e ? n == null ? void 0 : n.backgroundSegmentationMask : void 0, S = A(!1);
|
|
112
|
+
U(() => {
|
|
291
113
|
if (!e) {
|
|
292
|
-
|
|
114
|
+
S.current = !1;
|
|
293
115
|
return;
|
|
294
116
|
}
|
|
295
|
-
|
|
117
|
+
n === null && !S.current && (console.warn(
|
|
296
118
|
`[VideoBackground] segmentation="${e}" set but no matching <Segmentation> component is mounted; rendering unmasked.`
|
|
297
|
-
),
|
|
298
|
-
}, [e,
|
|
299
|
-
const
|
|
300
|
-
if (!
|
|
119
|
+
), S.current = !0);
|
|
120
|
+
}, [e, n]);
|
|
121
|
+
const d = e ? u : t, m = J(() => {
|
|
122
|
+
if (!i.isPerspectiveCamera)
|
|
301
123
|
return [10, 10];
|
|
302
|
-
const
|
|
303
|
-
return [
|
|
304
|
-
}, [
|
|
305
|
-
return
|
|
306
|
-
/* @__PURE__ */
|
|
307
|
-
/* @__PURE__ */
|
|
308
|
-
/* @__PURE__ */
|
|
124
|
+
const h = i, g = (h.position.z || 5) - -1, E = h.fov * Math.PI / 180, x = 2 * Math.tan(E / 2) * g;
|
|
125
|
+
return [x * (o.width / o.height), x];
|
|
126
|
+
}, [i, o]);
|
|
127
|
+
return c ? /* @__PURE__ */ f("group", { position: [0, 0, -1], children: s ? /* @__PURE__ */ N(q, { children: [
|
|
128
|
+
/* @__PURE__ */ N("mesh", { position: [0, 0, -0.01], renderOrder: a - 1, children: [
|
|
129
|
+
/* @__PURE__ */ f("planeGeometry", { args: m }),
|
|
130
|
+
/* @__PURE__ */ f(
|
|
309
131
|
"meshBasicMaterial",
|
|
310
132
|
{
|
|
311
|
-
map:
|
|
133
|
+
map: c,
|
|
312
134
|
depthTest: !1,
|
|
313
135
|
depthWrite: !1,
|
|
314
|
-
toneMapped: !1
|
|
136
|
+
toneMapped: !1,
|
|
137
|
+
side: k
|
|
315
138
|
}
|
|
316
139
|
)
|
|
317
140
|
] }),
|
|
318
|
-
|
|
319
|
-
/* @__PURE__ */
|
|
320
|
-
/* @__PURE__ */
|
|
141
|
+
r && d && /* @__PURE__ */ N("mesh", { position: [0, 0, 0], renderOrder: a, children: [
|
|
142
|
+
/* @__PURE__ */ f("planeGeometry", { args: m }),
|
|
143
|
+
/* @__PURE__ */ f(
|
|
321
144
|
"meshBasicMaterial",
|
|
322
145
|
{
|
|
323
|
-
map: typeof
|
|
324
|
-
color: typeof
|
|
325
|
-
alphaMap:
|
|
146
|
+
map: typeof r == "string" ? void 0 : r,
|
|
147
|
+
color: typeof r == "string" ? r : void 0,
|
|
148
|
+
alphaMap: d,
|
|
326
149
|
transparent: !1,
|
|
327
150
|
alphaTest: 0.5,
|
|
328
151
|
depthTest: !1,
|
|
329
152
|
depthWrite: !1,
|
|
330
|
-
toneMapped: !1
|
|
153
|
+
toneMapped: !1,
|
|
154
|
+
side: k
|
|
331
155
|
},
|
|
332
156
|
"inverted-mask"
|
|
333
157
|
)
|
|
334
158
|
] })
|
|
335
|
-
] }) : /* @__PURE__ */
|
|
336
|
-
|
|
337
|
-
/* @__PURE__ */
|
|
338
|
-
/* @__PURE__ */
|
|
159
|
+
] }) : /* @__PURE__ */ N(q, { children: [
|
|
160
|
+
r && d && /* @__PURE__ */ N("mesh", { position: [0, 0, -0.01], renderOrder: a - 1, children: [
|
|
161
|
+
/* @__PURE__ */ f("planeGeometry", { args: m }),
|
|
162
|
+
/* @__PURE__ */ f(
|
|
339
163
|
"meshBasicMaterial",
|
|
340
164
|
{
|
|
341
|
-
map: typeof
|
|
342
|
-
color: typeof
|
|
165
|
+
map: typeof r == "string" ? void 0 : r,
|
|
166
|
+
color: typeof r == "string" ? r : void 0,
|
|
343
167
|
depthTest: !1,
|
|
344
168
|
depthWrite: !1,
|
|
345
|
-
toneMapped: !1
|
|
169
|
+
toneMapped: !1,
|
|
170
|
+
side: k
|
|
346
171
|
}
|
|
347
172
|
)
|
|
348
173
|
] }),
|
|
349
|
-
/* @__PURE__ */
|
|
350
|
-
/* @__PURE__ */
|
|
351
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ N("mesh", { position: [0, 0, 0], renderOrder: a, children: [
|
|
175
|
+
/* @__PURE__ */ f("planeGeometry", { args: m }),
|
|
176
|
+
/* @__PURE__ */ f(
|
|
352
177
|
"meshBasicMaterial",
|
|
353
178
|
{
|
|
354
|
-
map:
|
|
355
|
-
alphaMap:
|
|
179
|
+
map: c,
|
|
180
|
+
alphaMap: d,
|
|
356
181
|
transparent: !1,
|
|
357
|
-
alphaTest:
|
|
182
|
+
alphaTest: d ? 0.5 : void 0,
|
|
358
183
|
depthTest: !1,
|
|
359
184
|
depthWrite: !1,
|
|
360
|
-
toneMapped: !1
|
|
185
|
+
toneMapped: !1,
|
|
186
|
+
side: k
|
|
361
187
|
},
|
|
362
|
-
|
|
188
|
+
d ? "with-mask" : "no-mask"
|
|
363
189
|
)
|
|
364
190
|
] })
|
|
365
191
|
] }) }) : null;
|
|
366
|
-
},
|
|
192
|
+
}, V = 9, H = 16, st = ({ children: t }) => {
|
|
193
|
+
const [e, s] = b({ width: 0, height: 0 });
|
|
194
|
+
return U(() => {
|
|
195
|
+
const r = () => {
|
|
196
|
+
const a = document.documentElement.clientWidth, i = document.documentElement.clientHeight, o = a / i, c = V / H;
|
|
197
|
+
let n, u;
|
|
198
|
+
o > c ? (u = i, n = u * V / H) : (n = a, u = n * H / V), s({ width: n, height: u });
|
|
199
|
+
};
|
|
200
|
+
return r(), window.addEventListener("resize", r), () => window.removeEventListener("resize", r);
|
|
201
|
+
}, []), /* @__PURE__ */ f(
|
|
202
|
+
"div",
|
|
203
|
+
{
|
|
204
|
+
style: {
|
|
205
|
+
width: "100vw",
|
|
206
|
+
height: `${window.innerHeight}px`,
|
|
207
|
+
display: "flex",
|
|
208
|
+
alignItems: "center",
|
|
209
|
+
justifyContent: "center",
|
|
210
|
+
backgroundColor: "#0d0d0d"
|
|
211
|
+
},
|
|
212
|
+
children: /* @__PURE__ */ f("div", { style: { width: e.width, height: e.height, position: "relative" }, children: t })
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
}, rt = ({ size: t = 0.25, ...e }) => /* @__PURE__ */ f("axesHelper", { args: [t], ...e }), ve = { left: -1, right: 1, top: 1, bottom: -1 }, Ce = (t, e, s) => {
|
|
216
|
+
const r = t % e, a = Math.floor(t / e);
|
|
217
|
+
return { x: r / e, y: (s - 1 - a) / s };
|
|
218
|
+
}, Pe = ({
|
|
219
|
+
sheet: t,
|
|
220
|
+
contentAspect: e,
|
|
221
|
+
renderOrder: s,
|
|
222
|
+
name: r
|
|
223
|
+
}) => {
|
|
224
|
+
const a = ye(t.url), i = A(0), o = A(-1), c = ge(), [n, u] = e != null ? ce(c, e) : [1, 1];
|
|
225
|
+
return Se((S, d) => {
|
|
226
|
+
a.wrapS = Y, a.wrapT = Y, a.magFilter = Z, a.minFilter = Z, a.generateMipmaps = !1, a.repeat.set(1 / t.cols, 1 / t.rows), i.current += d;
|
|
227
|
+
const m = Math.floor(i.current * t.fps) % t.frames;
|
|
228
|
+
if (m === o.current) return;
|
|
229
|
+
o.current = m;
|
|
230
|
+
const { x: h, y: l } = Ce(m, t.cols, t.rows);
|
|
231
|
+
a.offset.set(h, l);
|
|
232
|
+
}), /* @__PURE__ */ N("mesh", { name: r, renderOrder: s, scale: [n, u, 1], children: [
|
|
233
|
+
/* @__PURE__ */ f("planeGeometry", { args: [1, 1] }),
|
|
234
|
+
/* @__PURE__ */ f("meshBasicMaterial", { map: a, transparent: !0, toneMapped: !1, depthWrite: !1 })
|
|
235
|
+
] });
|
|
236
|
+
}, at = ({
|
|
237
|
+
sheet: t,
|
|
238
|
+
anchors: e = ve,
|
|
239
|
+
contentAspect: s,
|
|
240
|
+
renderOrder: r = 10,
|
|
241
|
+
name: a = "spriteAnimation"
|
|
242
|
+
}) => /* @__PURE__ */ f(ue, { fallback: null, children: /* @__PURE__ */ f(ie, { anchors: e, children: /* @__PURE__ */ f(Pe, { sheet: t, contentAspect: s, renderOrder: r, name: a }) }) }), D = (t) => {
|
|
243
|
+
switch (t) {
|
|
244
|
+
case "start":
|
|
245
|
+
return "starting";
|
|
246
|
+
case "started":
|
|
247
|
+
case "resume":
|
|
248
|
+
return "recording";
|
|
249
|
+
case "pause":
|
|
250
|
+
return "paused";
|
|
251
|
+
case "stop":
|
|
252
|
+
return "stopping";
|
|
253
|
+
case "complete":
|
|
254
|
+
return "completed";
|
|
255
|
+
case "fail":
|
|
256
|
+
return "error";
|
|
257
|
+
case "clear":
|
|
258
|
+
return "idle";
|
|
259
|
+
}
|
|
260
|
+
}, Le = [
|
|
367
261
|
"video/mp4",
|
|
368
262
|
"video/webm;codecs=vp9",
|
|
369
263
|
"video/webm;codecs=vp8",
|
|
370
264
|
"video/webm"
|
|
371
265
|
];
|
|
372
|
-
function
|
|
373
|
-
const {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
266
|
+
function nt(t = {}) {
|
|
267
|
+
const {
|
|
268
|
+
audio: e = !1,
|
|
269
|
+
mimeType: s,
|
|
270
|
+
bitsPerSecond: r,
|
|
271
|
+
onData: a,
|
|
272
|
+
onStop: i,
|
|
273
|
+
onRecordingStart: o,
|
|
274
|
+
onRecordingPause: c,
|
|
275
|
+
onRecordingResume: n,
|
|
276
|
+
onRecordingStop: u,
|
|
277
|
+
onRecordingComplete: S,
|
|
278
|
+
onError: d,
|
|
279
|
+
passThroughStream: m
|
|
280
|
+
} = t, h = A(null), l = A(null), T = A([]), [g, E] = b("idle"), [x, P] = b(null), [W, R] = b(null), L = w(() => {
|
|
281
|
+
var y;
|
|
282
|
+
const p = [s, ...Le].filter(Boolean);
|
|
283
|
+
for (const M of p)
|
|
284
|
+
if ((y = MediaRecorder.isTypeSupported) != null && y.call(MediaRecorder, M)) return M;
|
|
285
|
+
}, [s]), O = w(
|
|
286
|
+
async (p) => {
|
|
287
|
+
const y = new MediaStream();
|
|
288
|
+
if (p.getTracks().forEach((M) => y.addTrack(M)), e) {
|
|
289
|
+
let M;
|
|
383
290
|
if (e instanceof MediaStream)
|
|
384
|
-
|
|
291
|
+
M = e;
|
|
385
292
|
else {
|
|
386
|
-
const
|
|
387
|
-
|
|
293
|
+
const v = typeof e == "object" ? { audio: e } : { audio: !0, video: !1 };
|
|
294
|
+
M = await navigator.mediaDevices.getUserMedia(v);
|
|
388
295
|
}
|
|
389
|
-
|
|
296
|
+
M.getAudioTracks().forEach((v) => y.addTrack(v));
|
|
390
297
|
}
|
|
391
|
-
if (!
|
|
298
|
+
if (!y.getTracks().length)
|
|
392
299
|
throw new Error("No tracks available in combined stream.");
|
|
393
|
-
return
|
|
300
|
+
return l.current = y, y;
|
|
394
301
|
},
|
|
395
302
|
[e]
|
|
396
|
-
),
|
|
397
|
-
async (
|
|
303
|
+
), Q = w(
|
|
304
|
+
async (p, y) => {
|
|
305
|
+
E(D("start")), R(null), P(null);
|
|
398
306
|
try {
|
|
399
|
-
let
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
307
|
+
let M;
|
|
308
|
+
if (m)
|
|
309
|
+
M = m, l.current = M;
|
|
310
|
+
else {
|
|
311
|
+
if (!p) throw new Error("start(stream) requires a MediaStream.");
|
|
312
|
+
M = await O(p);
|
|
313
|
+
}
|
|
314
|
+
const v = L(), X = {};
|
|
315
|
+
v && (X.mimeType = v), r && (X.bitsPerSecond = r);
|
|
316
|
+
const G = new MediaRecorder(M, X);
|
|
317
|
+
G.ondataavailable = (F) => {
|
|
318
|
+
var j;
|
|
319
|
+
((j = F.data) == null ? void 0 : j.size) > 0 && (T.current.push(F.data), a == null || a(F.data));
|
|
320
|
+
}, G.onstop = () => {
|
|
321
|
+
const F = new Blob(T.current, {
|
|
322
|
+
type: v ?? "video/webm"
|
|
410
323
|
});
|
|
411
|
-
|
|
412
|
-
},
|
|
413
|
-
} catch (
|
|
414
|
-
|
|
324
|
+
P(F), i == null || i(F), S == null || S(F), T.current = [], E(D("complete"));
|
|
325
|
+
}, h.current = G, G.start(y), E(D("started")), o == null || o();
|
|
326
|
+
} catch (M) {
|
|
327
|
+
const v = M instanceof Error ? M : new Error(String(M));
|
|
328
|
+
console.error("start(stream) failed", v), R(v), E(D("fail")), d == null || d(v);
|
|
415
329
|
}
|
|
416
330
|
},
|
|
417
|
-
[
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
331
|
+
[
|
|
332
|
+
O,
|
|
333
|
+
L,
|
|
334
|
+
r,
|
|
335
|
+
a,
|
|
336
|
+
i,
|
|
337
|
+
S,
|
|
338
|
+
o,
|
|
339
|
+
d,
|
|
340
|
+
m
|
|
341
|
+
]
|
|
342
|
+
), ee = w(() => {
|
|
343
|
+
const p = h.current;
|
|
344
|
+
!p || p.state === "inactive" || (E(D("stop")), p.stop(), u == null || u());
|
|
345
|
+
}, [u]), te = w(() => {
|
|
346
|
+
const p = h.current;
|
|
347
|
+
(p == null ? void 0 : p.state) === "recording" && (p.pause(), E(D("pause")), c == null || c());
|
|
348
|
+
}, [c]), se = w(() => {
|
|
349
|
+
const p = h.current;
|
|
350
|
+
(p == null ? void 0 : p.state) === "paused" && (p.resume(), E(D("resume")), n == null || n());
|
|
351
|
+
}, [n]), B = w(() => {
|
|
352
|
+
var p;
|
|
429
353
|
try {
|
|
430
|
-
(h =
|
|
431
|
-
} catch (
|
|
432
|
-
console.error("clear failed",
|
|
354
|
+
h.current && (h.current.onstop = null, h.current.state !== "inactive" && h.current.stop()), h.current = null, (p = l.current) == null || p.getTracks().forEach((y) => y.stop()), l.current = null, P(null), E(D("clear")), T.current = [], R(null);
|
|
355
|
+
} catch (y) {
|
|
356
|
+
console.error("clear failed", y);
|
|
433
357
|
}
|
|
434
358
|
}, []);
|
|
435
|
-
return
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
359
|
+
return U(() => () => B(), []), {
|
|
360
|
+
status: g,
|
|
361
|
+
start: Q,
|
|
362
|
+
stop: ee,
|
|
363
|
+
pause: te,
|
|
364
|
+
resume: se,
|
|
365
|
+
clear: B,
|
|
366
|
+
isRecording: g === "recording" || g === "paused",
|
|
367
|
+
isPaused: g === "paused",
|
|
368
|
+
recordedBlob: x,
|
|
369
|
+
error: W,
|
|
370
|
+
getActiveStream: () => l.current
|
|
446
371
|
};
|
|
447
372
|
}
|
|
448
|
-
const
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
373
|
+
const Ue = async (t, e = {}) => {
|
|
374
|
+
var s, r, a;
|
|
375
|
+
(s = e.onCaptureStart) == null || s.call(e), await Promise.resolve();
|
|
376
|
+
try {
|
|
377
|
+
const i = t();
|
|
378
|
+
return (r = e.onCaptureComplete) == null || r.call(e, i), i;
|
|
379
|
+
} catch (i) {
|
|
380
|
+
const o = i instanceof Error ? i : new Error(String(i));
|
|
381
|
+
throw (a = e.onError) == null || a.call(e, o), o;
|
|
382
|
+
}
|
|
383
|
+
}, ot = (t = {}) => {
|
|
384
|
+
const { session: e } = oe(), {
|
|
385
|
+
captureFrame: s = e.captureFrame,
|
|
386
|
+
onCaptureStart: r,
|
|
387
|
+
onCaptureComplete: a,
|
|
388
|
+
onError: i
|
|
389
|
+
} = t, [o, c] = b("idle"), [n, u] = b(null), [S, d] = b(null), m = w(async () => {
|
|
390
|
+
c("capturing"), u(null), d(null);
|
|
391
|
+
try {
|
|
392
|
+
const l = await Ue(s, {
|
|
393
|
+
onCaptureStart: r,
|
|
394
|
+
onCaptureComplete: a,
|
|
395
|
+
onError: i
|
|
396
|
+
});
|
|
397
|
+
return u(l), c("completed"), l;
|
|
398
|
+
} catch (l) {
|
|
399
|
+
const T = l instanceof Error ? l : new Error(String(l));
|
|
400
|
+
return d(T), c("error"), null;
|
|
401
|
+
}
|
|
402
|
+
}, [s, r, a, i]), h = w(() => {
|
|
403
|
+
c("idle"), u(null), d(null);
|
|
404
|
+
}, []);
|
|
405
|
+
return { status: o, capturePhoto: m, clear: h, dataUrl: n, error: S };
|
|
406
|
+
}, it = (t, e) => {
|
|
407
|
+
const s = t.split(","), r = s[0].match(/:(.*?);/), a = r ? r[1] : "application/octet-stream", i = atob(s[s.length - 1]);
|
|
408
|
+
let o = i.length;
|
|
409
|
+
const c = new Uint8Array(o);
|
|
452
410
|
for (; o--; )
|
|
453
|
-
|
|
454
|
-
return new File([
|
|
455
|
-
},
|
|
456
|
-
if (
|
|
411
|
+
c[o] = i.charCodeAt(o);
|
|
412
|
+
return new File([c], e, { type: a });
|
|
413
|
+
}, De = 4, Ne = 50, be = 5e3, z = (t) => Math.min(1, Math.max(0, t)), K = (t) => new Promise((e) => {
|
|
414
|
+
if (t.readyState >= 4) {
|
|
457
415
|
e();
|
|
458
416
|
return;
|
|
459
417
|
}
|
|
460
|
-
let
|
|
461
|
-
const
|
|
462
|
-
|
|
418
|
+
let s = !1;
|
|
419
|
+
const r = () => {
|
|
420
|
+
s || (s = !0, e());
|
|
463
421
|
};
|
|
464
|
-
|
|
465
|
-
}),
|
|
466
|
-
const
|
|
467
|
-
return
|
|
468
|
-
},
|
|
469
|
-
|
|
470
|
-
|
|
422
|
+
t.addEventListener("canplaythrough", r, { once: !0 }), t.addEventListener("error", r, { once: !0 }), setTimeout(r, be);
|
|
423
|
+
}), $ = (t, e) => {
|
|
424
|
+
const s = document.createElement("audio");
|
|
425
|
+
return s.src = t, s.loop = e, s.preload = "auto", s.setAttribute("playsinline", ""), s.setAttribute("webkit-playsinline", ""), s.load(), s;
|
|
426
|
+
}, Fe = (t) => {
|
|
427
|
+
t.muted = !0, t.play().then(() => {
|
|
428
|
+
t.pause(), t.currentTime = 0, t.muted = !1;
|
|
471
429
|
}).catch(() => {
|
|
472
|
-
|
|
430
|
+
t.muted = !1;
|
|
473
431
|
});
|
|
474
432
|
};
|
|
475
|
-
class
|
|
433
|
+
class Oe {
|
|
476
434
|
constructor(e = {}) {
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
435
|
+
_(this, "sfxPoolSize");
|
|
436
|
+
_(this, "coalesceMs");
|
|
437
|
+
_(this, "muted", !0);
|
|
438
|
+
_(this, "listeners", /* @__PURE__ */ new Set());
|
|
439
|
+
_(this, "music", null);
|
|
440
|
+
_(this, "musicUrl", null);
|
|
441
|
+
_(this, "musicReady", null);
|
|
442
|
+
_(this, "musicWanted", null);
|
|
443
|
+
_(this, "pools", /* @__PURE__ */ new Map());
|
|
484
444
|
/** Last play time per SFX URL, for the coalesce window. */
|
|
485
|
-
|
|
445
|
+
_(this, "lastPlayed", /* @__PURE__ */ new Map());
|
|
486
446
|
/** Readiness promises so a loading gate can await decode/buffer. */
|
|
487
|
-
|
|
488
|
-
this.sfxPoolSize = e.sfxPoolSize ??
|
|
447
|
+
_(this, "ready", /* @__PURE__ */ new Map());
|
|
448
|
+
this.sfxPoolSize = e.sfxPoolSize ?? De, this.coalesceMs = e.coalesceMs ?? Ne;
|
|
489
449
|
}
|
|
490
450
|
/**
|
|
491
451
|
* Create + buffer the looping music element. Await in the loading gate so the
|
|
492
452
|
* unmute tap is instant. Idempotent per URL (re-requesting the same track is
|
|
493
453
|
* a no-op that returns the in-flight promise).
|
|
494
454
|
*/
|
|
495
|
-
prefetchMusic(e,
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
this.music =
|
|
500
|
-
const
|
|
501
|
-
return this.
|
|
455
|
+
prefetchMusic(e, s = 0.4) {
|
|
456
|
+
const r = z(s);
|
|
457
|
+
if (this.musicWanted = { url: e, volume: r }, this.musicUrl === e && this.musicReady)
|
|
458
|
+
return this.music && (this.music.volume = r), this.musicReady;
|
|
459
|
+
this.music && (this.music.pause(), this.music.currentTime = 0, this.music.removeAttribute("src"), this.music.load()), this.music = $(e, !0), this.musicUrl = e, this.music.volume = r;
|
|
460
|
+
const a = K(this.music);
|
|
461
|
+
return this.musicReady = a, a;
|
|
502
462
|
}
|
|
503
463
|
/**
|
|
504
464
|
* Create + buffer an SFX voice pool (round-robin so overlapping plays don't
|
|
505
465
|
* cut each other off). Returns a promise that resolves when the first element
|
|
506
466
|
* buffers. Idempotent per URL.
|
|
507
467
|
*/
|
|
508
|
-
registerSound(e,
|
|
509
|
-
const
|
|
510
|
-
if (
|
|
511
|
-
const i = [];
|
|
512
|
-
for (let
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
}), i.push(
|
|
468
|
+
registerSound(e, s = 1) {
|
|
469
|
+
const r = this.ready.get(e);
|
|
470
|
+
if (r) return r;
|
|
471
|
+
const a = z(s), i = [];
|
|
472
|
+
for (let c = 0; c < this.sfxPoolSize; c += 1) {
|
|
473
|
+
const n = $(e, !1);
|
|
474
|
+
n.volume = a, n.addEventListener("ended", () => {
|
|
475
|
+
n.currentTime = 0;
|
|
476
|
+
}), i.push(n);
|
|
517
477
|
}
|
|
518
|
-
this.pools.set(e, { els: i, next: 0, volume:
|
|
519
|
-
const
|
|
520
|
-
return this.ready.set(e,
|
|
478
|
+
this.pools.set(e, { els: i, next: 0, volume: a });
|
|
479
|
+
const o = K(i[0]);
|
|
480
|
+
return this.ready.set(e, o), o;
|
|
521
481
|
}
|
|
522
482
|
/** Subscribe to mute-state changes (for a toggle UI). Fires immediately with
|
|
523
483
|
* the current state. Returns an unsubscribe. */
|
|
@@ -534,7 +494,7 @@ class Ee {
|
|
|
534
494
|
* then start the music. All elements are already buffered, so this is instant.
|
|
535
495
|
*/
|
|
536
496
|
setMuted(e) {
|
|
537
|
-
e !== this.muted && (this.muted = e, this.muted || this.pools.forEach((
|
|
497
|
+
e !== this.muted && (this.muted = e, this.muted || this.pools.forEach((s) => s.els.forEach(Fe)), this.applyMusic(), this.listeners.forEach((s) => s(this.muted)));
|
|
538
498
|
}
|
|
539
499
|
toggleMuted() {
|
|
540
500
|
this.setMuted(!this.muted);
|
|
@@ -545,29 +505,30 @@ class Ee {
|
|
|
545
505
|
* same sound into one play, and does NO synchronous `currentTime` seek on a
|
|
546
506
|
* ready element (the pool rewinds on `ended`, off the hot path).
|
|
547
507
|
*/
|
|
548
|
-
playOneShot(e,
|
|
508
|
+
playOneShot(e, s) {
|
|
549
509
|
if (this.muted) return;
|
|
550
|
-
const
|
|
551
|
-
if (!
|
|
552
|
-
const
|
|
553
|
-
if (
|
|
554
|
-
this.lastPlayed.set(e,
|
|
555
|
-
const
|
|
510
|
+
const r = this.pools.get(e);
|
|
511
|
+
if (!r) return;
|
|
512
|
+
const a = performance.now();
|
|
513
|
+
if (a - (this.lastPlayed.get(e) ?? -1 / 0) < this.coalesceMs) return;
|
|
514
|
+
this.lastPlayed.set(e, a);
|
|
515
|
+
const i = r.els.length;
|
|
556
516
|
let o;
|
|
557
|
-
for (let
|
|
558
|
-
const
|
|
559
|
-
if (
|
|
560
|
-
o =
|
|
517
|
+
for (let c = 0; c < i; c += 1) {
|
|
518
|
+
const n = r.els[(r.next + c) % i];
|
|
519
|
+
if (n.paused) {
|
|
520
|
+
o = n, r.next = (r.next + c + 1) % i;
|
|
561
521
|
break;
|
|
562
522
|
}
|
|
563
523
|
}
|
|
564
|
-
o || (o =
|
|
524
|
+
o || (o = r.els[r.next], r.next = (r.next + 1) % i), o.muted = !1, o.volume = z(s ?? r.volume), o.currentTime !== 0 && (o.currentTime = 0), o.play().catch(() => {
|
|
565
525
|
});
|
|
566
526
|
}
|
|
567
527
|
/** Request the looping background track (buffer it with prefetchMusic, which
|
|
568
528
|
* a loading gate awaits). Remembered while muted; starts on unmute. */
|
|
569
|
-
startMusic(e,
|
|
570
|
-
|
|
529
|
+
startMusic(e, s = 0.4) {
|
|
530
|
+
const r = z(s);
|
|
531
|
+
this.musicUrl !== e && this.prefetchMusic(e, r), this.musicWanted = { url: e, volume: r }, this.applyMusic();
|
|
571
532
|
}
|
|
572
533
|
stopMusic() {
|
|
573
534
|
this.musicWanted = null, this.music && (this.music.pause(), this.music.currentTime = 0);
|
|
@@ -577,36 +538,176 @@ class Ee {
|
|
|
577
538
|
}), this.muted && !this.music.paused && this.music.pause());
|
|
578
539
|
}
|
|
579
540
|
}
|
|
580
|
-
const
|
|
581
|
-
|
|
582
|
-
|
|
541
|
+
const Ie = (t, e, s) => t === "infinite" || t === "loop" && e < Math.max(1, Math.floor(s)) ? "replay" : "ended", Ge = (t, e, s) => t && e !== s, ke = (t) => Math.min(100, Math.max(0, t)) / 100, ct = le(function({
|
|
542
|
+
src: e,
|
|
543
|
+
playMode: s = "once",
|
|
544
|
+
loopCount: r = 1,
|
|
545
|
+
autoplay: a = !1,
|
|
546
|
+
muted: i = !1,
|
|
547
|
+
volume: o = 100,
|
|
548
|
+
preload: c = "auto",
|
|
549
|
+
onReady: n,
|
|
550
|
+
onPlay: u,
|
|
551
|
+
onPause: S,
|
|
552
|
+
onEnded: d,
|
|
553
|
+
onError: m
|
|
554
|
+
}, h) {
|
|
555
|
+
const l = A(null), T = A(0), g = A(null), E = w(async () => {
|
|
556
|
+
const R = l.current;
|
|
557
|
+
if (R)
|
|
558
|
+
try {
|
|
559
|
+
await R.play();
|
|
560
|
+
} catch (L) {
|
|
561
|
+
const O = L instanceof Error ? L : new Error(String(L));
|
|
562
|
+
throw m == null || m(O), O;
|
|
563
|
+
}
|
|
564
|
+
}, [m]), x = w(() => {
|
|
565
|
+
var R;
|
|
566
|
+
return (R = l.current) == null ? void 0 : R.pause();
|
|
567
|
+
}, []), P = w(() => {
|
|
568
|
+
const R = l.current;
|
|
569
|
+
R && (R.pause(), R.currentTime = 0, T.current = 0);
|
|
570
|
+
}, []);
|
|
571
|
+
de(
|
|
572
|
+
h,
|
|
573
|
+
() => ({
|
|
574
|
+
play: E,
|
|
575
|
+
pause: x,
|
|
576
|
+
stop: P,
|
|
577
|
+
get current() {
|
|
578
|
+
return l.current;
|
|
579
|
+
}
|
|
580
|
+
}),
|
|
581
|
+
[x, E, P]
|
|
582
|
+
), U(() => {
|
|
583
|
+
T.current = 0, g.current = null;
|
|
584
|
+
}, [e]), U(() => {
|
|
585
|
+
l.current && (l.current.volume = ke(o));
|
|
586
|
+
}, [o]), U(() => {
|
|
587
|
+
Ge(a, g.current, e) && (g.current = e, E().catch(() => {
|
|
588
|
+
}));
|
|
589
|
+
}, [a, e]);
|
|
590
|
+
const W = w(() => {
|
|
591
|
+
T.current += 1;
|
|
592
|
+
const R = Math.max(1, Math.floor(r));
|
|
593
|
+
if (Ie(s, T.current, R) === "replay") {
|
|
594
|
+
const L = l.current;
|
|
595
|
+
L && (L.currentTime = 0, E().catch(() => {
|
|
596
|
+
}));
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
T.current = 0, d == null || d();
|
|
600
|
+
}, [r, d, E, s]);
|
|
601
|
+
return /* @__PURE__ */ f(
|
|
602
|
+
"audio",
|
|
603
|
+
{
|
|
604
|
+
ref: l,
|
|
605
|
+
src: e,
|
|
606
|
+
preload: c,
|
|
607
|
+
autoPlay: !1,
|
|
608
|
+
muted: i,
|
|
609
|
+
loop: !1,
|
|
610
|
+
playsInline: !0,
|
|
611
|
+
style: { display: "none" },
|
|
612
|
+
onCanPlayThrough: n,
|
|
613
|
+
onPlay: u,
|
|
614
|
+
onPause: S,
|
|
615
|
+
onEnded: W,
|
|
616
|
+
onError: () => m == null ? void 0 : m(new Error(`Unable to load audio: ${e}`))
|
|
617
|
+
}
|
|
618
|
+
);
|
|
619
|
+
}), C = new Oe(), ut = (t, e) => C.prefetchMusic(t, e), lt = (t, e) => C.registerSound(t, e), dt = (t, e) => C.startMusic(t, e), mt = () => C.stopMusic(), pt = (t, e) => C.playOneShot(t, e), ht = (t) => C.setMuted(t), ft = () => C.toggleMuted(), Et = () => C.isMuted(), St = (t) => C.onMuteChange(t), Tt = () => {
|
|
620
|
+
const [t, e] = b(C.isMuted());
|
|
621
|
+
return U(() => C.onMuteChange(e), []), t;
|
|
583
622
|
};
|
|
584
623
|
export {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
624
|
+
st as AspectRatioContainer,
|
|
625
|
+
Oe as AudioEngine,
|
|
626
|
+
ct as AudioPlayer,
|
|
627
|
+
rt as Axes,
|
|
628
|
+
gs as DEFAULT_MATERIAL_FILL,
|
|
629
|
+
Ss as DEFAULT_MESH_RENDERER,
|
|
630
|
+
Ts as DEFAULT_MESH_RENDERER_RENDER_STATE,
|
|
631
|
+
jt as DEFAULT_PIXEL_SNAP_INCREMENT,
|
|
632
|
+
qt as DEFAULT_REFERENCE_PIXELS_PER_UNIT,
|
|
633
|
+
Yt as DEFAULT_SCREEN_GLASS,
|
|
634
|
+
ws as DEFAULT_SCREEN_GRADIENT,
|
|
635
|
+
Zt as DEFAULT_SCREEN_IMAGE_SCENE_SETTINGS,
|
|
636
|
+
Kt as DEFAULT_SCREEN_IMAGE_SETTINGS,
|
|
637
|
+
$t as DEFAULT_SCREEN_SHAPE_SETTINGS,
|
|
638
|
+
Jt as DEFAULT_SCREEN_TEXT_SCENE_SETTINGS,
|
|
639
|
+
Qt as DEFAULT_SCREEN_TEXT_SHADOW_LAYER,
|
|
640
|
+
es as DEFAULT_SCREEN_TRANSFORM_2D,
|
|
641
|
+
ts as DEFAULT_SCREEN_TRANSFORM_ROOT,
|
|
642
|
+
As as DEFAULT_TRANSFORM_3D,
|
|
643
|
+
ss as EXTERNAL_BACKGROUND_RENDER_LAYER,
|
|
644
|
+
xt as LightObject,
|
|
645
|
+
vt as LookAt,
|
|
646
|
+
rs as MAX_RENDER_GROUP_PASSES,
|
|
647
|
+
_s as MaterialFill,
|
|
648
|
+
bs as MeshMaterial,
|
|
649
|
+
Ms as MeshRenderer,
|
|
650
|
+
et as Panel,
|
|
651
|
+
as as PinToMesh,
|
|
652
|
+
Ct as RenderGroupLayer,
|
|
653
|
+
Pt as SceneObjectRenderer,
|
|
654
|
+
ns as ScreenGlassMaterial,
|
|
655
|
+
xs as ScreenGradientMaterial,
|
|
656
|
+
Lt as ScreenImage,
|
|
657
|
+
os as ScreenShape,
|
|
658
|
+
Ut as ScreenSpaceUI,
|
|
659
|
+
Dt as ScreenText,
|
|
589
660
|
ie as ScreenTransform,
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
661
|
+
Nt as SequentialRenderPasses,
|
|
662
|
+
at as SpriteAnimation,
|
|
663
|
+
bt as TextLabel,
|
|
664
|
+
vs as Transform3D,
|
|
665
|
+
tt as VideoBackground,
|
|
666
|
+
yt as XRMediaSource,
|
|
667
|
+
ne as XRModel,
|
|
668
|
+
gt as XRProvider,
|
|
669
|
+
At as XRScene,
|
|
597
670
|
C as audio,
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
671
|
+
Ft as clientToScreenPixels,
|
|
672
|
+
ce as computeContainScale,
|
|
673
|
+
Cs as createTwoStopGradient,
|
|
674
|
+
it as dataURLtoFile,
|
|
675
|
+
Us as drawNormalizedCrop,
|
|
676
|
+
is as getRenderGroupLayer,
|
|
677
|
+
Et as isMuted,
|
|
678
|
+
cs as mapScreenImageSettingsToProps,
|
|
679
|
+
us as mapScreenTextInnerShadowToProps,
|
|
680
|
+
ls as mapScreenTextSettingsToProps,
|
|
681
|
+
Ot as mediaToScreenPixels,
|
|
682
|
+
ds as mergeScreenShapeSettings,
|
|
683
|
+
ms as mergeScreenTransform2D,
|
|
684
|
+
Rs as normalizeMeshRendererRenderState,
|
|
685
|
+
ps as normalizeScreenGlass,
|
|
686
|
+
Ps as normalizeScreenGradient,
|
|
687
|
+
It as normalizedToScreenPixels,
|
|
688
|
+
St as onMuteChange,
|
|
689
|
+
pt as playOneShot,
|
|
690
|
+
ut as prefetchMusic,
|
|
691
|
+
lt as registerSound,
|
|
692
|
+
hs as renderSequentialPasses,
|
|
693
|
+
Ds as resolveNormalizedCrop,
|
|
694
|
+
fs as resolveScreenTransform2D,
|
|
695
|
+
Gt as screenPixelsToClient,
|
|
696
|
+
kt as screenPixelsToMedia,
|
|
697
|
+
zt as screenPixelsToNormalized,
|
|
698
|
+
Wt as screenPixelsToUnits,
|
|
699
|
+
Xt as screenPointToRay,
|
|
700
|
+
Vt as screenUnitsToPixels,
|
|
701
|
+
ht as setMuted,
|
|
702
|
+
I as smoothNumber,
|
|
703
|
+
Je as smoothVector2,
|
|
704
|
+
Qe as smoothVector3,
|
|
705
|
+
dt as startMusic,
|
|
706
|
+
mt as stopMusic,
|
|
707
|
+
ft as toggleMuted,
|
|
708
|
+
ot as useFrameCapture,
|
|
709
|
+
nt as useMediaRecorder,
|
|
710
|
+
Tt as useMuted,
|
|
711
|
+
ge as useScreenRectAspect,
|
|
712
|
+
Ht as worldToScreenPixels
|
|
612
713
|
};
|