@volter/cyclotron 0.5.201 → 0.5.203
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/BUNDLED_NOTICES +956 -924
- package/LICENSE-BLENDER +11 -0
- package/README.md +16 -10
- package/dist/.vite/manifest.json +2316 -2307
- package/dist/assets/EntityModelDocument-CTq_jwpe.js +1 -0
- package/dist/assets/EnvironmentAssetDocument-CaSQc1HY.js +1 -0
- package/dist/assets/InspectorObjectPreview-P6pJxnGB.js +1 -0
- package/dist/assets/LiveModuleDocument-B6Iw2YIE.js +2 -0
- package/dist/assets/LutAssetDocument-C7Tc5hRu.js +1 -0
- package/dist/assets/ModelAssetDocument-BUOK0YzX.js +1 -0
- package/dist/assets/NonThreeAuthoringBootstrap-Bbtz8I0R.js +1 -0
- package/dist/assets/Object3DDocumentToolbar-GjvQOSkS.js +1 -0
- package/dist/assets/Object3DPreview-BUogCxPt.js +2 -0
- package/dist/assets/QuarksAssetDocument-Cxg3fT6D.js +2 -0
- package/dist/assets/ShaderAssetDocument-BbXBHSY3.js +1 -0
- package/dist/assets/StageHost-BtQd8CQk.js +1179 -0
- package/dist/assets/ToolObject3DPreview-imwBjs0O.js +1 -0
- package/dist/assets/ViewportShadingMenu-Dx1gY8Op.js +1 -0
- package/dist/assets/animation-mixers.service-fNXcr-Vc.js +1 -0
- package/dist/assets/animation-timeline.utility-Dzab5JgT.js +1 -0
- package/dist/assets/asset-preview-BEzZu4j-.js +4 -0
- package/dist/assets/blender-emscripten-engine-BFUuajuh.js +2 -0
- package/dist/assets/blender-node-editor.document-Cu3LXipe.js +1 -0
- package/dist/assets/blender-properties-model-BrD2rboW.js +1 -0
- package/dist/assets/blender-properties-tab-CkbWamuD.js +3 -0
- package/dist/assets/blender-runtime-host-7Wv16WQe.js +7221 -0
- package/dist/assets/blender-runtime.document-CSHvDIaD.js +13 -0
- package/dist/assets/blender-screenshot.menu-CELFKP08.js +1 -0
- package/dist/assets/blender-timeline.document-BvHkPBTZ.js +1 -0
- package/dist/assets/blender-uv-editor.document-DVsbsG0P.js +1 -0
- package/dist/assets/blender-version.status-D_YQqOVz.js +1 -0
- package/dist/assets/blender-wali-engine-C6WYYJ9a.js +2 -0
- package/dist/assets/blender.command-M9NTZ04b.js +1 -0
- package/dist/assets/blender.status-H7PL8qIV.js +1 -0
- package/dist/assets/model-inspection-DAugZuDb.js +1 -0
- package/dist/assets/models.finder-C37d1CqG.js +1 -0
- package/dist/assets/object3d-document-session-registry-Nly7qqyW.js +2 -0
- package/dist/assets/play-live-nju-LbTd.js +1 -0
- package/dist/assets/product-B76VmSfR.js +14 -0
- package/dist/assets/properties-bone-constraints.inspector-CICws11L.js +1 -0
- package/dist/assets/properties-bone.inspector-BTh8HMja.js +1 -0
- package/dist/assets/properties-collection.inspector-CdxnUdEY.js +1 -0
- package/dist/assets/properties-constraints.inspector-CgLm__aq.js +1 -0
- package/dist/assets/properties-data.inspector-CPGohY4g.js +1 -0
- package/dist/assets/properties-material.inspector-BBmS0pWg.js +1 -0
- package/dist/assets/properties-modifiers.inspector-DmwrZuck.js +1 -0
- package/dist/assets/properties-object.inspector-CcLxRnp2.js +1 -0
- package/dist/assets/properties-output.inspector-B21rsdeE.js +1 -0
- package/dist/assets/properties-particles.inspector-3oYMCgFh.js +1 -0
- package/dist/assets/properties-physics.inspector-CXHZdBQv.js +1 -0
- package/dist/assets/properties-render.inspector-BgQVOySW.js +1 -0
- package/dist/assets/properties-scene.inspector-BvJsraNi.js +1 -0
- package/dist/assets/properties-texture.inspector-DPHw4ryw.js +1 -0
- package/dist/assets/properties-view-layer.inspector-MBifnnqO.js +1 -0
- package/dist/assets/properties-world.inspector-DOOIqcDX.js +1 -0
- package/dist/assets/react-18-Ceee8kSy.js +1 -0
- package/dist/assets/session-B_EkWp0b.js +6047 -0
- package/dist/assets/stage-keyboard-CfcRPwij.js +1 -0
- package/dist/assets/stage-overlay-set-B8PO_8GO.js +1 -0
- package/dist/assets/stage-presence-markers-CheQj0g2.js +1 -0
- package/dist/assets/stage-transform-tools-B3kiH81y.js +1 -0
- package/dist/assets/standard-viewport-dressing-4szt4iVE.js +24 -0
- package/dist/assets/three-integration.service-BRF8px1l.js +2 -0
- package/dist/assets/volter-sdk-BKodmrby.js +2363 -0
- package/dist/assets/volter-sdk-account-LQPzi3UZ.js +1 -0
- package/dist/assets/volter-sdk-client-DgRgxfuo.js +1 -0
- package/dist/assets/volter-sdk-contributions-Di1uSPw_.js +1 -0
- package/dist/assets/volter-sdk-css-numeric-style-Gy-GyM9Y.js +1 -0
- package/dist/assets/volter-sdk-document-probe-kPNnaNGr.js +1 -0
- package/dist/assets/volter-sdk-editor-view-g0uNyGJC.js +1 -0
- package/dist/assets/volter-sdk-host-CXSewq8M.js +1 -0
- package/dist/assets/volter-sdk-http-transport.browser-B3TdfhI7.js +1 -0
- package/dist/assets/volter-sdk-index-4Kp3lnTd.js +1 -0
- package/dist/assets/volter-sdk-kit-CapabilityCoverageSection-CjXSPJIo.js +1 -0
- package/dist/assets/volter-sdk-kit-account-client-ByTVy6-o.js +1 -0
- package/dist/assets/volter-sdk-kit-action-registry-D1kqJ80f.js +1 -0
- package/dist/assets/volter-sdk-kit-active-product-CEEc_Nk5.js +1 -0
- package/dist/assets/volter-sdk-kit-active-project-BrcrV5ab.js +1 -0
- package/dist/assets/volter-sdk-kit-adapter-editor-config-DqJAYMZM.js +1 -0
- package/dist/assets/volter-sdk-kit-adapter-module-Cm1FKR3D.js +1 -0
- package/dist/assets/volter-sdk-kit-adapter-observation-DNCkd2d_.js +1 -0
- package/dist/assets/volter-sdk-kit-animation-animation-clock-0FXkaCv-.js +1 -0
- package/dist/assets/volter-sdk-kit-animation-stage-transport-C7MuqkhX.js +1 -0
- package/dist/assets/volter-sdk-kit-api-assets-DC5mYDg9.js +1 -0
- package/dist/assets/volter-sdk-kit-api-base-Jd4izSaw.js +1 -0
- package/dist/assets/volter-sdk-kit-api-build-CXv7iVa0.js +1 -0
- package/dist/assets/volter-sdk-kit-api-logs-BJS5qQS0.js +1 -0
- package/dist/assets/volter-sdk-kit-api-project-identity-BTbrDP21.js +1 -0
- package/dist/assets/volter-sdk-kit-api-project-open-B2xmn-LQ.js +1 -0
- package/dist/assets/volter-sdk-kit-api-project-source-B8I05SPp.js +1 -0
- package/dist/assets/volter-sdk-kit-api-project-state-b7drJlZm.js +1 -0
- package/dist/assets/volter-sdk-kit-api-relay-CXoYAGag.js +1 -0
- package/dist/assets/volter-sdk-kit-api-settings-Ooohukfm.js +1 -0
- package/dist/assets/volter-sdk-kit-api-themes-DWL43Vk4.js +1 -0
- package/dist/assets/volter-sdk-kit-api-worktrees-36I3L3ep.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-capabilities-B_JHyPEo.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-compare-core-k1g4sfK4.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-editor-context-BtXkPrch.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-events-DNL9sOD1.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-inspector-actions-CIyFU73p.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-selection-YBxUZh2F.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-selection-viewer-registry-BP6LhiLy.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-thumbnails-cVPLoYS6.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-viewers-D4Nn4_BR.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-workflow-asset-import-jobs-BSMDOcaj.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-workflow-asset-ledger-Ce2VXJ2Z.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-workflow-asset-ledger-backend-BUyAOAr6.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-workflow-asset-materialization-report-BItOpEbd.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-workflow-asset-pack-manifest-BBeCjirT.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-workflow-audio-preview-player-UfPQty9g.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-workflow-audio-waveform-DDRruLeu.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-workflow-cloud-asset-client-T_DLL58P.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-workflow-hosted-asset-materialization-BjuMcGvJ.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-workflow-image-view-scale-Ciewiory.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-workflow-ledger-write-lock-DNMc3Uhr.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-workflow-pixi-spritesheet-BTZveIZ2.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-workflow-preview-resource-lifetime-CGdTixEp.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-workflow-project-asset-commands-0cIEsyFV.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-workflow-project-content-B883NWEX.js +1 -0
- package/dist/assets/volter-sdk-kit-asset-workflow-thumbnail-system-udhK_bK8.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-active-adapter-CaV79Zym.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-active-systems-D-sRD1JD.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-adapter-key-4m95v2b2.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-authoring-asset-url-CHBNmukT.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-bootstrap-state-Dz5hKatn.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-boundary-authoring-adapter-BHValVeR.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-canvas-scene-guides-RexSF-J2.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-composite-authoring-adapter-CbcNeoQ9.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-consumer-actions-CnMS-_cD.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-design-time-layers-Zg9zdDef.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-design-time-mount-registry-DKLgadwc.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-edit-mode-authoring-M81xEMIH.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-empty-project-authoring-DIwvGeWZ.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-instance-source-menu-EmOGzQA_.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-layered-pick-DmtPQOEU.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-mounted-root-subjects-CEz93V3J.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-no-authoring-adapter-mfK9FD-y.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-object3d-document-persistence-R2pfEtvy.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-panel-authoring-VEFAXYyu.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-project-authoring-session-B2qmlVET.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-provenance-CWNbjFfV.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-react-canvas-navigation-BkL1OUf3.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-react-design-canvas-style-DSJif289.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-react-story-board-DEtWuCdl.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-seam-evidence-yrcHmQZ9.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-selection-scope-DVHy1MNQ.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-shell-document-ops-CrTR4pdw.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-story-board-chrome-fit-CzDJyhVH.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-three-root-DGX0pTp1.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-viewport-tool-context-c-RZK1GX.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-viewport-tool-owner-Cea2wigf.js +1 -0
- package/dist/assets/volter-sdk-kit-authoring-world-session-state-N1az4tj8.js +1 -0
- package/dist/assets/volter-sdk-kit-availability-tick-B-AloCSv.js +1 -0
- package/dist/assets/volter-sdk-kit-bitmap-label-D5-Z31T5.js +1 -0
- package/dist/assets/volter-sdk-kit-boot-routing-XVOVyUc_.js +1 -0
- package/dist/assets/volter-sdk-kit-breakpoint-state-D-KEzzvG.js +1 -0
- package/dist/assets/volter-sdk-kit-build-identity-D-zdIjo6.js +1 -0
- package/dist/assets/volter-sdk-kit-bytes-codec-DVfFaFPs.js +1 -0
- package/dist/assets/volter-sdk-kit-cancellation-reason-DnCUNdRD.js +1 -0
- package/dist/assets/volter-sdk-kit-canvas-frames-BGh2p4Ce.js +1 -0
- package/dist/assets/volter-sdk-kit-capture-camera-pose-WspKGBnF.js +1 -0
- package/dist/assets/volter-sdk-kit-capture-size-DSdRe3ay.js +1 -0
- package/dist/assets/volter-sdk-kit-chrome-registry-D4L_4xEJ.js +1 -0
- package/dist/assets/volter-sdk-kit-chrome-slot-registry-Ce1SavKJ.js +1 -0
- package/dist/assets/volter-sdk-kit-collaboration-client-BklHxwDT.js +1 -0
- package/dist/assets/volter-sdk-kit-collaboration-presence-Cbx-Ojaw.js +1 -0
- package/dist/assets/volter-sdk-kit-command-dispatch-Dyhs6OSN.js +1 -0
- package/dist/assets/volter-sdk-kit-command-listener-CHEIOy3c.js +1 -0
- package/dist/assets/volter-sdk-kit-command-registry-CUKeDb9O.js +1 -0
- package/dist/assets/volter-sdk-kit-component-board-registry-BF8BzQDh.js +1 -0
- package/dist/assets/volter-sdk-kit-component-states-registry-RkljZ-Lm.js +1 -0
- package/dist/assets/volter-sdk-kit-components-AlignToolbar-L-1f9zZf.js +1 -0
- package/dist/assets/volter-sdk-kit-components-ApplicationMenus-BKxEMCFq.js +1 -0
- package/dist/assets/volter-sdk-kit-components-AssetEditorShell-ByYpeg3g.js +1 -0
- package/dist/assets/volter-sdk-kit-components-AssetInspectorToolSection-AzQ_b4hk.js +1 -0
- package/dist/assets/volter-sdk-kit-components-BoardRulers-Cjeqdfie.js +1 -0
- package/dist/assets/volter-sdk-kit-components-CanvasAddNodeDialogs-BOfMdh1M.js +1 -0
- package/dist/assets/volter-sdk-kit-components-CanvasSceneViewport-rZGGuOwh.js +1 -0
- package/dist/assets/volter-sdk-kit-components-ChromeSlot-CYRqS-XZ.js +1 -0
- package/dist/assets/volter-sdk-kit-components-CodeView-CZ4K-R4r.js +1 -0
- package/dist/assets/volter-sdk-kit-components-CompactInspectorShell-C0Jzb6sx.js +1 -0
- package/dist/assets/volter-sdk-kit-components-ConsolePanel-vTD-MnSe.js +1 -0
- package/dist/assets/volter-sdk-kit-components-GameplaySessionTimeline-fQY5p6rX.js +1 -0
- package/dist/assets/volter-sdk-kit-components-InspectionProjection-Dn7ly9U9.js +1 -0
- package/dist/assets/volter-sdk-kit-components-Inspector-DlXSsDRU.js +1 -0
- package/dist/assets/volter-sdk-kit-components-InspectorCanvasPreview-D2fHAo8Q.js +1 -0
- package/dist/assets/volter-sdk-kit-components-InspectorFieldsSection-BACKigHR.js +1 -0
- package/dist/assets/volter-sdk-kit-components-InspectorStoriesSection-C2tFcY5Z.js +1 -0
- package/dist/assets/volter-sdk-kit-components-InspectorToolSection-CKxWWFgq.js +1 -0
- package/dist/assets/volter-sdk-kit-components-InspectorTransformSection-BscOuHaz.js +1 -0
- package/dist/assets/volter-sdk-kit-components-LightExplorerPanel-Czgrsno8.js +1 -0
- package/dist/assets/volter-sdk-kit-components-MediaProperties-4JJy007U.js +1 -0
- package/dist/assets/volter-sdk-kit-components-ProjectHeader-CHXnXf4V.js +1 -0
- package/dist/assets/volter-sdk-kit-components-ReactCanvasControls-CjQh_ckk.js +1 -0
- package/dist/assets/volter-sdk-kit-components-RootSelectionOverlay-CIhN8hQt.js +1 -0
- package/dist/assets/volter-sdk-kit-components-RootTextEditor-Bh2YKApp.js +1 -0
- package/dist/assets/volter-sdk-kit-components-SaveStatus-BD-zOD-c.js +1 -0
- package/dist/assets/volter-sdk-kit-components-SurfaceCrashBoundary-BH1PNp8a.js +1 -0
- package/dist/assets/volter-sdk-kit-components-SurfaceStateOverlay-C4IvdpGQ.js +1 -0
- package/dist/assets/volter-sdk-kit-components-ToolContributionSurfaces-CtiZX-C_.js +1 -0
- package/dist/assets/volter-sdk-kit-components-ToolHost-DLj25ucp.js +1 -0
- package/dist/assets/volter-sdk-kit-components-Toolbar-DOHf2NES.js +1 -0
- package/dist/assets/volter-sdk-kit-components-TransientHint-zFA_MLx1.js +1 -0
- package/dist/assets/volter-sdk-kit-components-VersionControlSection-C9By_77E.js +1 -0
- package/dist/assets/volter-sdk-kit-components-ViewportOverlaysMenu-vr4do7lA.js +1 -0
- package/dist/assets/volter-sdk-kit-components-VolterLogo-DS8HqAPp.js +1 -0
- package/dist/assets/volter-sdk-kit-components-WorktreeSwitcher-DIEnM6m4.js +1 -0
- package/dist/assets/volter-sdk-kit-components-account-documents-C-kuLuRW.js +1 -0
- package/dist/assets/volter-sdk-kit-components-asset-documents-wvxuPzJN.js +1 -0
- package/dist/assets/volter-sdk-kit-components-asset-editor-persistence-DRbF9-yC.js +1 -0
- package/dist/assets/volter-sdk-kit-components-asset-selection-section-D-iE-RCy.js +1 -0
- package/dist/assets/volter-sdk-kit-components-asset-thumbnails-D3TyvHrp.js +1 -0
- package/dist/assets/volter-sdk-kit-components-asset-viewers-AudioViewer-Dk2jKOhT.js +1 -0
- package/dist/assets/volter-sdk-kit-components-asset-viewers-GenericJsonViewer-_nthvrZy.js +1 -0
- package/dist/assets/volter-sdk-kit-components-asset-viewers-ImageViewer-i-UhuMgF.js +1 -0
- package/dist/assets/volter-sdk-kit-components-asset-viewers-JsonAssetDocument-CzBAEr0C.js +1 -0
- package/dist/assets/volter-sdk-kit-components-asset-viewers-OnlineAssetDetail-CyV7UI3C.js +1 -0
- package/dist/assets/volter-sdk-kit-components-asset-viewers-SourceAssetViewer-Bd3a2_oA.js +1 -0
- package/dist/assets/volter-sdk-kit-components-asset-viewers-SpritesheetSpriteView-B0oBgcRW.js +1 -0
- package/dist/assets/volter-sdk-kit-components-asset-viewers-VideoViewer-Ad0PtQNX.js +1 -0
- package/dist/assets/volter-sdk-kit-components-asset-viewers-shader-source-BcRGAaa4.js +1 -0
- package/dist/assets/volter-sdk-kit-components-board-guides-DlFbMQZl.js +1 -0
- package/dist/assets/volter-sdk-kit-components-canvas-scene-hotkeys-C-WHgNDO.js +1 -0
- package/dist/assets/volter-sdk-kit-components-canvas-temporary-pivot-CqErnLHB.js +1 -0
- package/dist/assets/volter-sdk-kit-components-core-utilities-B339nXVW.js +1 -0
- package/dist/assets/volter-sdk-kit-components-inspector-preview-section-fv1kHl0P.js +1 -0
- package/dist/assets/volter-sdk-kit-components-inspector-revert-label-CGouljBF.js +1 -0
- package/dist/assets/volter-sdk-kit-components-inspector-selection-svwL5thP.js +1 -0
- package/dist/assets/volter-sdk-kit-components-inspector-stories-gating-CXI8Z8PL.js +1 -0
- package/dist/assets/volter-sdk-kit-components-inspector-transform-B6n6Cdof.js +1 -0
- package/dist/assets/volter-sdk-kit-components-inspector-transform-subject-C3qg6v_f.js +1 -0
- package/dist/assets/volter-sdk-kit-components-kind-documents-W8USaiPh.js +1 -0
- package/dist/assets/volter-sdk-kit-components-primitives-DraftColorInput-Dd4u-Wtm.js +1 -0
- package/dist/assets/volter-sdk-kit-components-project-tool-documents-DFq82d8o.js +1 -0
- package/dist/assets/volter-sdk-kit-components-scene-documents-B73lYyVv.js +1 -0
- package/dist/assets/volter-sdk-kit-components-status-contributions-FTso27Xh.js +1 -0
- package/dist/assets/volter-sdk-kit-components-tool-documents-BbGwfFpc.js +1 -0
- package/dist/assets/volter-sdk-kit-components-tool-schema-form-BIF8LmJV.js +1 -0
- package/dist/assets/volter-sdk-kit-components-use-after-paint-CtKNo2UU.js +1 -0
- package/dist/assets/volter-sdk-kit-components-use-project-image-assets-G7f6izdS.js +1 -0
- package/dist/assets/volter-sdk-kit-components-workspace-history-B2vo6Xx_.js +1 -0
- package/dist/assets/volter-sdk-kit-components-world-documents-B5tULKmS.js +1 -0
- package/dist/assets/volter-sdk-kit-components-world-overlay-gestures-DDEiWrz7.js +1 -0
- package/dist/assets/volter-sdk-kit-composite-screenshot-BMOK3iYM.js +1 -0
- package/dist/assets/volter-sdk-kit-content-entry-source-registry-B9eUIMgv.js +1 -0
- package/dist/assets/volter-sdk-kit-contribution-surfaces-DC-uHDQg.js +1 -0
- package/dist/assets/volter-sdk-kit-coverage-canvas-reveal-DiRNBVRN.js +1 -0
- package/dist/assets/volter-sdk-kit-coverage-design-time-surfaces-Csc86Z_f.js +1 -0
- package/dist/assets/volter-sdk-kit-coverage-ontology-invariants-Brd3w7kt.js +1 -0
- package/dist/assets/volter-sdk-kit-coverage-session-vitals-BoNy6hEZ.js +1 -0
- package/dist/assets/volter-sdk-kit-creation-site-registry-CdhSUaPD.js +1 -0
- package/dist/assets/volter-sdk-kit-delegate-harness-registry-CHNkXHhB.js +1 -0
- package/dist/assets/volter-sdk-kit-document-areas-7iD_pTF6.js +1 -0
- package/dist/assets/volter-sdk-kit-document-context-registry-6DcBS8uQ.js +1 -0
- package/dist/assets/volter-sdk-kit-document-open-registry-CS2V2rTe.js +1 -0
- package/dist/assets/volter-sdk-kit-document-play-extension-DyULINB5.js +1 -0
- package/dist/assets/volter-sdk-kit-document-preview-source-YxLsIauQ.js +1 -0
- package/dist/assets/volter-sdk-kit-document-renderer-session-IoKOp6Se.js +1 -0
- package/dist/assets/volter-sdk-kit-document-stage-sessions-DSmPpree.js +1 -0
- package/dist/assets/volter-sdk-kit-document-viewports-CvdifVJF.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-api-CB1FgcVg.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-chrome-capture-B-e-WKT4.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-commands-BYWHMTwS.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-console-jCw-ErXD.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-current-view-CbBqd-eR.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-document-probe-BC-zqNPD.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-git-client-BQQFtPz9.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-hotkeys-BzoxjaxK.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-lease-B_3921d6.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-lease-view-Dwm149iL.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-mode-DOBZoYnf.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-notifications-BfExd624.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-presence-DNnOAqPS.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-presentation-activity-CFp63FEl.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-presentation-notice-Df1-39oQ.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-runtime-CCziNuJh.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-server-response-DJiPWdEl.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-session-attribution-qdIqiRBe.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-session-mode-r0EdgfW4.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-state-facets-ChaCu38O.js +1 -0
- package/dist/assets/volter-sdk-kit-editor-view-presentation-Dp6RpQY2.js +1 -0
- package/dist/assets/volter-sdk-kit-environment-images-BUDsa8Yi.js +1 -0
- package/dist/assets/volter-sdk-kit-eyedropper-session-CuB0NOuY.js +1 -0
- package/dist/assets/volter-sdk-kit-files-file-provider-DIDQ2_uI.js +1 -0
- package/dist/assets/volter-sdk-kit-files-project-files-CQvJk0Gq.js +1 -0
- package/dist/assets/volter-sdk-kit-finders-index-DKfmE3QQ.js +1 -0
- package/dist/assets/volter-sdk-kit-finders-scenes-from-entrypoint-selection-CmiBcR6h.js +1 -0
- package/dist/assets/volter-sdk-kit-frame-frame-parts-Dva44YHz.js +1 -0
- package/dist/assets/volter-sdk-kit-framed-document-capture-DB3Ncfrz.js +1 -0
- package/dist/assets/volter-sdk-kit-game-surface-defaults-Cj-0v8BH.js +1 -0
- package/dist/assets/volter-sdk-kit-gameplay-export-state-Xf39gCAN.js +1 -0
- package/dist/assets/volter-sdk-kit-gameplay-replay-F8jJrsPf.js +1 -0
- package/dist/assets/volter-sdk-kit-gameplay-session-time-DTTj1olA.js +1 -0
- package/dist/assets/volter-sdk-kit-gameplay-sessions-CxKyk9Md.js +1 -0
- package/dist/assets/volter-sdk-kit-hierarchy-component-marks-BabNBUji.js +1 -0
- package/dist/assets/volter-sdk-kit-hierarchy-internals-CoK3Z_Xh.js +1 -0
- package/dist/assets/volter-sdk-kit-hierarchy-kind-icon-Cm6Wsuhy.js +1 -0
- package/dist/assets/volter-sdk-kit-hierarchy-menu-registry-DaGff9wa.js +1 -0
- package/dist/assets/volter-sdk-kit-hierarchy-node-rows-BcRUZUvZ.js +1 -0
- package/dist/assets/volter-sdk-kit-hierarchy-panel-view-BZoc7eJQ.js +1 -0
- package/dist/assets/volter-sdk-kit-hierarchy-projection-CHs2jgL8.js +1 -0
- package/dist/assets/volter-sdk-kit-hierarchy-row-media-PFIeRJqY.js +1 -0
- package/dist/assets/volter-sdk-kit-hierarchy-row-model-Cw1It5is.js +1 -0
- package/dist/assets/volter-sdk-kit-hierarchy-rows-Dssu1BMj.js +1 -0
- package/dist/assets/volter-sdk-kit-hierarchy-walk-B1L9eTXm.js +1 -0
- package/dist/assets/volter-sdk-kit-history-editor-session-BtVV5q7v.js +1 -0
- package/dist/assets/volter-sdk-kit-history-history-commands-TABAJNSR.js +1 -0
- package/dist/assets/volter-sdk-kit-history-history-delegate-DeK2Tm-B.js +1 -0
- package/dist/assets/volter-sdk-kit-history-history-limit-notices-BVoYaGBF.js +1 -0
- package/dist/assets/volter-sdk-kit-history-history-service-BHBRoss1.js +1 -0
- package/dist/assets/volter-sdk-kit-history-persistence-coordinator-n84--IYf.js +1 -0
- package/dist/assets/volter-sdk-kit-history-project-file-history-CcXjOv2P.js +1 -0
- package/dist/assets/volter-sdk-kit-history-project-root-history-backends-DTX8q5fG.js +1 -0
- package/dist/assets/volter-sdk-kit-history-resource-registry-CLkqOjdr.js +1 -0
- package/dist/assets/volter-sdk-kit-history-snapshot-store-DycW6GLB.js +1 -0
- package/dist/assets/volter-sdk-kit-history-source-history-backend-9xMoYlbd.js +1 -0
- package/dist/assets/volter-sdk-kit-hmr-registration-group-DmMHpNnB.js +1 -0
- package/dist/assets/volter-sdk-kit-hmr-stable-react-context-D-TLq4Hc.js +1 -0
- package/dist/assets/volter-sdk-kit-hotkeys-XirVHMg5.js +1 -0
- package/dist/assets/volter-sdk-kit-inference-diagnostics-CXk1gv7L.js +1 -0
- package/dist/assets/volter-sdk-kit-initial-project-Cbnj6h8K.js +1 -0
- package/dist/assets/volter-sdk-kit-inspection-active-subject-CZRJ1Iol.js +1 -0
- package/dist/assets/volter-sdk-kit-inspection-active-surface-gAahXjP2.js +1 -0
- package/dist/assets/volter-sdk-kit-inspection-compose-subject-BBlLRs6P.js +1 -0
- package/dist/assets/volter-sdk-kit-inspection-display-D546j-bp.js +1 -0
- package/dist/assets/volter-sdk-kit-inspection-document-subject-DDqyp_xw.js +1 -0
- package/dist/assets/volter-sdk-kit-inspection-game-subject-sQwCYXs1.js +1 -0
- package/dist/assets/volter-sdk-kit-inspection-model-DC9Hl3cj.js +1 -0
- package/dist/assets/volter-sdk-kit-inspection-node-media-DjPyEqvx.js +1 -0
- package/dist/assets/volter-sdk-kit-inspection-null-subject-Ct7EGK3P.js +1 -0
- package/dist/assets/volter-sdk-kit-inspection-serialize-Bq6tap3p.js +1 -0
- package/dist/assets/volter-sdk-kit-inspection-use-active-inspection-C_yp3gfW.js +1 -0
- package/dist/assets/volter-sdk-kit-inspector-presentation-Di1bDrzW.js +1 -0
- package/dist/assets/volter-sdk-kit-inspector-property-grouping-Hrg_OJm5.js +1 -0
- package/dist/assets/volter-sdk-kit-inspector-section-registry-CvrpGvES.js +1 -0
- package/dist/assets/volter-sdk-kit-instance-source-actions-BCuKBxGf.js +1 -0
- package/dist/assets/volter-sdk-kit-js-heap-KxSszS6k.js +1 -0
- package/dist/assets/volter-sdk-kit-key-actions-Wz9BljgB.js +1 -0
- package/dist/assets/volter-sdk-kit-keymap-presets-GXj7fO30.js +1 -0
- package/dist/assets/volter-sdk-kit-layout-policy-cFlperJi.js +1 -0
- package/dist/assets/volter-sdk-kit-light-explorer-model-CkrLkUUZ.js +1 -0
- package/dist/assets/volter-sdk-kit-live-canvas-frame-CIEkO3Ed.js +1 -0
- package/dist/assets/volter-sdk-kit-live-document-DhUo-Edg.js +1 -0
- package/dist/assets/volter-sdk-kit-live-gesture-lock-CMfHfSyJ.js +1 -0
- package/dist/assets/volter-sdk-kit-live-seam-evidence-BwAIj8fP.js +1 -0
- package/dist/assets/volter-sdk-kit-live-session-registry-DLpuZ5fm.js +1 -0
- package/dist/assets/volter-sdk-kit-live-transition-CzY_KNsh.js +1 -0
- package/dist/assets/volter-sdk-kit-manifest-project-D966gGPJ.js +1 -0
- package/dist/assets/volter-sdk-kit-module-fetch-diagnosis-BhBAOyzv.js +1 -0
- package/dist/assets/volter-sdk-kit-mount-failure-report-uZuQLIak.js +1 -0
- package/dist/assets/volter-sdk-kit-native-selection-style-DWR8dlSz.js +1 -0
- package/dist/assets/volter-sdk-kit-object3d-document-write-policy-Bj_jp-7_.js +1 -0
- package/dist/assets/volter-sdk-kit-packaged-runtime-iG7YMb12.js +1 -0
- package/dist/assets/volter-sdk-kit-performance-profiler-CNmFMe3k.js +1 -0
- package/dist/assets/volter-sdk-kit-performance-sources-Dn00aXW5.js +1 -0
- package/dist/assets/volter-sdk-kit-photograph-notice-Dfg0UxVZ.js +1 -0
- package/dist/assets/volter-sdk-kit-play-boot-phase-CXNgzv-J.js +1 -0
- package/dist/assets/volter-sdk-kit-play-camera-flight-DLwGfpJp.js +1 -0
- package/dist/assets/volter-sdk-kit-presentation-surface-cMmRpkGJ.js +1 -0
- package/dist/assets/volter-sdk-kit-product-command-Bu6DLKpE.js +1 -0
- package/dist/assets/volter-sdk-kit-project-adapter-BuzQScGI.js +1 -0
- package/dist/assets/volter-sdk-kit-project-asset-refresh-Bap7mqgb.js +1 -0
- package/dist/assets/volter-sdk-kit-project-asset-roots-By8xlXHl.js +1 -0
- package/dist/assets/volter-sdk-kit-project-local-state-ChdRwLow.js +1 -0
- package/dist/assets/volter-sdk-kit-project-manager-CLiEnNgu.js +1 -0
- package/dist/assets/volter-sdk-kit-project-module-changes-BDpD6OsB.js +1 -0
- package/dist/assets/volter-sdk-kit-project-module-split-CVNdzh8m.js +1 -0
- package/dist/assets/volter-sdk-kit-project-provenance-cp2gtKVj.js +1 -0
- package/dist/assets/volter-sdk-kit-project-ready-D8V6Kzge.js +1 -0
- package/dist/assets/volter-sdk-kit-project-shape-CClCrXxY.js +1 -0
- package/dist/assets/volter-sdk-kit-project-tools-CtP3bOpD.js +1 -0
- package/dist/assets/volter-sdk-kit-readiness-D0ouQROM.js +1 -0
- package/dist/assets/volter-sdk-kit-renderer-resource-counts-aXKN0rxR.js +1 -0
- package/dist/assets/volter-sdk-kit-reported-play-state-C-Mib-ba.js +1 -0
- package/dist/assets/volter-sdk-kit-resolve-contributed-command-BM8YcJz7.js +1 -0
- package/dist/assets/volter-sdk-kit-resolve-relative-specifier-CSTX2j7-.js +1 -0
- package/dist/assets/volter-sdk-kit-retained-document-states-QrHnyn4V.js +1 -0
- package/dist/assets/volter-sdk-kit-scene-document-plan-C9wHG6B7.js +1 -0
- package/dist/assets/volter-sdk-kit-scene-live-open-CXb4AskH.js +1 -0
- package/dist/assets/volter-sdk-kit-scoped-game-css-FdsRmDqV.js +1 -0
- package/dist/assets/volter-sdk-kit-served-url-DIf-qLum.js +1 -0
- package/dist/assets/volter-sdk-kit-session-close-COfy5ras.js +1 -0
- package/dist/assets/volter-sdk-kit-session-tombstone-BitY9Sdx.js +1 -0
- package/dist/assets/volter-sdk-kit-settings-settings-provider-BPuTDIxn.js +1 -0
- package/dist/assets/volter-sdk-kit-settings-store-BPOsFHZe.js +1 -0
- package/dist/assets/volter-sdk-kit-shell-store-DwHeZ5nQ.js +1 -0
- package/dist/assets/volter-sdk-kit-shell-store-door-BWHcu98B.js +1 -0
- package/dist/assets/volter-sdk-kit-source-conflict-CkxYCMk1.js +1 -0
- package/dist/assets/volter-sdk-kit-stage-context-CP-upNgr.js +1 -0
- package/dist/assets/volter-sdk-kit-stage-invalidation-CeDdEl0b.js +1 -0
- package/dist/assets/volter-sdk-kit-stage-store-registry-B2jyIREA.js +1 -0
- package/dist/assets/volter-sdk-kit-startup-failure-DWjZgwSJ.js +1 -0
- package/dist/assets/volter-sdk-kit-state-report-deferral-Dzam5Bu-.js +1 -0
- package/dist/assets/volter-sdk-kit-storage-host-files-storage-BxTEyrKN.js +1 -0
- package/dist/assets/volter-sdk-kit-storage-http-storage-T4fMC6Ww.js +1 -0
- package/dist/assets/volter-sdk-kit-storage-index-C2Gf9k45.js +1 -0
- package/dist/assets/volter-sdk-kit-storage-mem-storage-CcdOLba9.js +1 -0
- package/dist/assets/volter-sdk-kit-storage-path-lock-r7SjMxYI.js +1 -0
- package/dist/assets/volter-sdk-kit-storage-paths-BWI0b699.js +1 -0
- package/dist/assets/volter-sdk-kit-stories-StoryPreviewMount-DPyefE_s.js +1 -0
- package/dist/assets/volter-sdk-kit-stories-compose-project-stories-Dz_zorT8.js +1 -0
- package/dist/assets/volter-sdk-kit-stories-prefabs-finder-VOD4Fih8.js +1 -0
- package/dist/assets/volter-sdk-kit-stories-prefabs-from-stories-BbJ4drXs.js +1 -0
- package/dist/assets/volter-sdk-kit-stories-project-story-regions-CPPt7sAc.js +1 -0
- package/dist/assets/volter-sdk-kit-stories-scope-CIIL7T3O.js +1 -0
- package/dist/assets/volter-sdk-kit-stories-story-capture-DMWk2KXY.js +1 -0
- package/dist/assets/volter-sdk-kit-stories-story-declared-medium-Bx-ygbVe.js +1 -0
- package/dist/assets/volter-sdk-kit-stories-story-discovery-CafUDauh.js +1 -0
- package/dist/assets/volter-sdk-kit-stories-story-dom-runtime-CiCD8tr1.js +1 -0
- package/dist/assets/volter-sdk-kit-stories-story-grouping-BRGub3eG.js +1 -0
- package/dist/assets/volter-sdk-kit-stories-story-presentation-Bt3rB_N9.js +1 -0
- package/dist/assets/volter-sdk-kit-stories-story-registry-bF3ym9Kn.js +1 -0
- package/dist/assets/volter-sdk-kit-story-document-openers-R2-yxXGg.js +1 -0
- package/dist/assets/volter-sdk-kit-story-thumbnails-CI-p0jom.js +1 -0
- package/dist/assets/volter-sdk-kit-surface-keyboard-Bclcg_ZX.js +1 -0
- package/dist/assets/volter-sdk-kit-surface-state-OwSMnQPF.js +1 -0
- package/dist/assets/volter-sdk-kit-system-seam-evidence-mhKxMLF-.js +1 -0
- package/dist/assets/volter-sdk-kit-tab-census-BkucfkR2.js +1 -0
- package/dist/assets/volter-sdk-kit-tab-lifecycle-client-xPlJR_Is.js +1 -0
- package/dist/assets/volter-sdk-kit-theme-library-BmQiddws.js +1 -0
- package/dist/assets/volter-sdk-kit-theme-preference-CY62ohS6.js +1 -0
- package/dist/assets/volter-sdk-kit-three-viewport-presentation-C4zfYkP5.js +1 -0
- package/dist/assets/volter-sdk-kit-tool-contribution-play-D-X4TndA.js +1 -0
- package/dist/assets/volter-sdk-kit-tool-loader-Bppn2i0e.js +1 -0
- package/dist/assets/volter-sdk-kit-transform-mode-request-DVP6KCfG.js +1 -0
- package/dist/assets/volter-sdk-kit-transient-hint-znMlkMOz.js +1 -0
- package/dist/assets/volter-sdk-kit-transport-strip-dGQ-YoNm.js +1 -0
- package/dist/assets/volter-sdk-kit-ui-source-file-region-resolver-bA1RQVjN.js +1 -0
- package/dist/assets/volter-sdk-kit-ui-source-inspect-vbzR9DTw.js +1 -0
- package/dist/assets/volter-sdk-kit-ui-source-source-write-backend-jvrPvSXj.js +1 -0
- package/dist/assets/volter-sdk-kit-ui-source-tier-source-write-backend-_aDOX96f.js +1 -0
- package/dist/assets/volter-sdk-kit-user-local-state-C9PMe7ZC.js +1 -0
- package/dist/assets/volter-sdk-kit-viewport-activation-timings-Bl8_neTA.js +1 -0
- package/dist/assets/volter-sdk-kit-viewport-editor-controls-aUeFDe8t.js +1 -0
- package/dist/assets/volter-sdk-kit-viewport-presentation-IbDRhAjA.js +1 -0
- package/dist/assets/volter-sdk-kit-viewport-surface-status-B0m0crzV.js +1 -0
- package/dist/assets/volter-sdk-kit-wait-until-Bby0hAXq.js +1 -0
- package/dist/assets/volter-sdk-kit-worker-call-metrics-JG55IFWY.js +1 -0
- package/dist/assets/volter-sdk-kit-workspace-areas-D-wnNrv1.js +1 -0
- package/dist/assets/volter-sdk-kit-workspace-aux-commands-iFWD7R5b.js +1 -0
- package/dist/assets/volter-sdk-kit-workspace-available-documents-DEOtsr7U.js +1 -0
- package/dist/assets/volter-sdk-kit-workspace-core-utilities-Do_ivM3K.js +1 -0
- package/dist/assets/volter-sdk-kit-workspace-document-ids-CekfZZKH.js +1 -0
- package/dist/assets/volter-sdk-kit-workspace-document-registry-CtvIBYpT.js +1 -0
- package/dist/assets/volter-sdk-kit-workspace-document-restore-VAID48D1.js +1 -0
- package/dist/assets/volter-sdk-kit-workspace-host-commands-Ddx5Tgyl.js +1 -0
- package/dist/assets/volter-sdk-kit-workspace-persistence-gate-CXlifVZM.js +1 -0
- package/dist/assets/volter-sdk-kit-workspace-play-utilities-ByGVJzRW.js +1 -0
- package/dist/assets/volter-sdk-kit-workspace-presets-CjP5LvcE.js +1 -0
- package/dist/assets/volter-sdk-kit-workspace-regions-iau7y1g3.js +1 -0
- package/dist/assets/volter-sdk-kit-workspace-static-panels-B6jKhrp4.js +1 -0
- package/dist/assets/volter-sdk-kit-workspace-status-registry-g8wytHL5.js +1 -0
- package/dist/assets/volter-sdk-kit-workspace-storage-B5hTXq0f.js +1 -0
- package/dist/assets/volter-sdk-kit-workspace-style-LV2J3BUW.js +1 -0
- package/dist/assets/volter-sdk-kit-workspace-utility-commands-Ci_KJODl.js +1 -0
- package/dist/assets/volter-sdk-kit-workspace-utility-registry-BbjESGwy.js +1 -0
- package/dist/assets/volter-sdk-kit-world-adoption-DQ4KT5o5.js +1 -0
- package/dist/assets/volter-sdk-kit-world-canvas-viewport-state-r5rqWOVZ.js +1 -0
- package/dist/assets/volter-sdk-kit-world-document-routing-D-fYy4j5.js +1 -0
- package/dist/assets/volter-sdk-kit-world-pan-state-CMG7tsSx.js +1 -0
- package/dist/assets/volter-sdk-kit-write-pipe-DNEDBnz-.js +1 -0
- package/dist/assets/volter-sdk-layout-arrangements-CHD3ZMFe.js +1 -0
- package/dist/assets/volter-sdk-layouts-CCA7FuOC.js +1 -0
- package/dist/assets/volter-sdk-selection-D0kL_iDi.js +1 -0
- package/dist/assets/volter-sdk-session-command-table-DA_l3-71.js +1 -0
- package/dist/assets/volter-sdk-session-editor-brand-BF7c04d1.js +1 -0
- package/dist/assets/volter-sdk-session-editor-compatibility-DTohfZFv.js +1 -0
- package/dist/assets/volter-sdk-session-editor-control-protocol-BldcSvMF.js +1 -0
- package/dist/assets/volter-sdk-session-entrypoint-selection-readers-C5lBU-ru.js +1 -0
- package/dist/assets/volter-sdk-session-game-css-scope-BU2odzp5.js +1 -0
- package/dist/assets/volter-sdk-session-project-module-url-BXpMu1Rd.js +1 -0
- package/dist/assets/volter-sdk-session-relative-path-guard-QB40XSDf.js +1 -0
- package/dist/assets/volter-sdk-session-tool-contribution-convention-B_nVNyey.js +1 -0
- package/dist/assets/volter-sdk-types-CpvyGiQa.js +1 -0
- package/dist/assets/volter-sdk-views-DJ_MnaUh.js +1 -0
- package/dist/assets/volter-sdk-widgets-design-system-D7xN8pRO.js +1 -0
- package/dist/assets/volter-sdk-widgets-editor-appearance-Crp-pBLJ.js +1 -0
- package/dist/assets/volter-sdk-widgets-editor-material-MHO-HL-5.js +1 -0
- package/dist/assets/volter-sdk-widgets-icon-set-registry-BV2KyS5k.js +1 -0
- package/dist/assets/volter-sdk-widgets-index-Pv9HbBUF.js +1 -0
- package/dist/assets/volter-sdk-widgets-inspector-widgets-AlignmentGrid-vPIEJ2AQ.js +1 -0
- package/dist/assets/volter-sdk-widgets-inspector-widgets-AssetSlotPicker-0kpmltFh.js +1 -0
- package/dist/assets/volter-sdk-widgets-inspector-widgets-BorderEditor-C1igd7oH.js +1 -0
- package/dist/assets/volter-sdk-widgets-inspector-widgets-ColorPicker-B2hEex_l.js +1 -0
- package/dist/assets/volter-sdk-widgets-inspector-widgets-CurveEditor-cyhMzK5L.js +1 -0
- package/dist/assets/volter-sdk-widgets-inspector-widgets-FilterEditor-DcQAkx63.js +1 -0
- package/dist/assets/volter-sdk-widgets-inspector-widgets-FontPicker--uOgL4qW.js +1 -0
- package/dist/assets/volter-sdk-widgets-inspector-widgets-GradientEditor-DTAtC77d.js +1 -0
- package/dist/assets/volter-sdk-widgets-inspector-widgets-ScrubbableInput-khJ7avew.js +1 -0
- package/dist/assets/volter-sdk-widgets-inspector-widgets-ShadowEditor-eiGFiwHP.js +1 -0
- package/dist/assets/volter-sdk-widgets-inspector-widgets-color-utils-Cd-F281s.js +1 -0
- package/dist/assets/volter-sdk-widgets-inspector-widgets-curve-utils-C7uJEWC0.js +1 -0
- package/dist/assets/volter-sdk-widgets-inspector-widgets-index-B5TWzor-.js +1 -0
- package/dist/assets/volter-sdk-widgets-inspector-widgets-shared-DEQKguQB.js +1 -0
- package/dist/assets/volter-sdk-widgets-interactive-edit-scope-Bl0RzyJQ.js +1 -0
- package/dist/assets/volter-sdk-widgets-patterns-Dialog-UyDjvCxC.js +1 -0
- package/dist/assets/volter-sdk-widgets-patterns-Fields-nF0yD3V1.js +1 -0
- package/dist/assets/volter-sdk-widgets-patterns-List-D34mrQDy.js +1 -0
- package/dist/assets/volter-sdk-widgets-patterns-StateSurface-CLSEwJ2u.js +1 -0
- package/dist/assets/volter-sdk-widgets-patterns-Surfaces-Bnz6CGdv.js +1 -0
- package/dist/assets/volter-sdk-widgets-patterns-Tabs-BGh2nrPU.js +1 -0
- package/dist/assets/volter-sdk-widgets-patterns-Toolbar-DD17mnjd.js +1 -0
- package/dist/assets/volter-sdk-widgets-patterns-Tree-CCzpKURV.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-AnchoredMenu-rAsZA766.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-Button-B1Ppeaoa.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-ColorInput-CHAXdol_.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-DraftTextInput-CnNtxQXT.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-EditorIcon-Cimr9Mco.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-FormControls-CT_S601l.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-HoverPreview-B8HUvMqd.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-JsonInput-B4XDeGeD.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-Layout-Bi7EShmW.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-Menu-CKIw0gyB.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-NumberInput-Cm3QFgJj.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-Panel-Bydp9OuQ.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-SectionHeader-CCux7aOb.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-Text-CX8Zqrmp.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-ThemeRootPortal-9ZuvJNaQ.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-Tooltip-DQ24NxRN.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-Vec3Input-B8ydBBhm.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-banner-tones-DJXfSNS6.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-clamp-to-viewport-BzMgToKr.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-editor-icons-RjhVjrNt.js +1 -0
- package/dist/assets/volter-sdk-widgets-primitives-panel-header-styles-CaqZYWvq.js +1 -0
- package/dist/assets/volter-sdk-widgets-theme-GZiAnowy.js +1 -0
- package/dist/assets/volter-sdk-widgets-z-index-CvywNZqF.js +1 -0
- package/dist/assets/volter-shared-fontawesome-D0om5i4C.js +1 -0
- package/dist/assets/volter-shared-jsx-dev-runtime-Nf2pZiIO.js +1 -0
- package/dist/assets/volter-shared-jsx-runtime-mOtwwECE.js +1 -0
- package/dist/assets/volter-shared-react-D-xjcqWm.js +1 -0
- package/dist/assets/volter-shared-react-dom-DdRTSMx8.js +1 -0
- package/dist/assets/volter-shared-react-dom-client-WSvYqY8Z.js +1 -0
- package/dist/assets/worker-CxcSX7C7.js +8 -0
- package/dist/volter-shared-react.json +6 -6
- package/dist/volter-shared-sdk.json +462 -461
- package/dist-node/cli.js +16100 -2176
- package/dist-node/create.js +42 -36
- package/package.json +11 -9
- package/starter/AGENTS.md +30 -7
- package/starter/add-play/game-state.ts +25 -0
- package/starter/add-play/game.tsx +16 -0
- package/starter/add-play/model.play.ts +77 -0
- package/starter/package.json +5 -0
- package/starter/playable/src/models/canyon.blend +0 -0
- package/starter/playable/src/models/canyon.play.ts +107 -0
- package/starter/playable/src/models/canyon.py +55 -0
- package/starter/playable/src/models/circuit.py +131 -0
- package/starter/playable/src/models/complete_environment.py +35 -0
- package/starter/playable/src/models/course.ts +12 -0
- package/starter/playable/src/models/detail.py +44 -0
- package/starter/playable/src/models/driver_details.py +25 -0
- package/starter/playable/src/models/environment.py +87 -0
- package/starter/playable/src/models/finish_scene.py +13 -0
- package/starter/playable/src/models/kart_finish.py +31 -0
- package/starter/playable/src/models/polish.py +75 -0
- package/starter/playable/src/models/race-state.ts +15 -0
- package/starter/playable/src/models/refine.py +69 -0
- package/starter/playable/src/models/scene_helpers.py +54 -0
- package/starter/playable/src/models/scenery_ao.py +114 -0
- package/starter/playable/src/textures/asphalt.png +0 -0
- package/starter/playable/src/textures/generate.py +16 -0
- package/starter/playable/src/textures/sandstone.png +0 -0
- package/starter/playable/src/ui/game.stories.tsx +16 -0
- package/starter/playable/src/ui/game.tsx +6 -0
- package/starter/playable/src/ui/race-hud.tsx +29 -0
- package/starter/playable/src/ui/race-widgets.tsx +29 -0
- package/dist/assets/EntityModelDocument-SFx7GJi9.js +0 -1
- package/dist/assets/EnvironmentAssetDocument-CpQnoQK7.js +0 -1
- package/dist/assets/InspectorObjectPreview-DhOKGE_h.js +0 -1
- package/dist/assets/LiveModuleDocument-eahaoeUi.js +0 -2
- package/dist/assets/LutAssetDocument-CTFpkbXP.js +0 -1
- package/dist/assets/ModelAssetDocument-qpaA8PMi.js +0 -1
- package/dist/assets/NonThreeAuthoringBootstrap-Cxat6HDi.js +0 -1
- package/dist/assets/Object3DDocumentToolbar-DAGo1TZr.js +0 -1
- package/dist/assets/Object3DPreview-f5xt7xae.js +0 -2
- package/dist/assets/QuarksAssetDocument-B4GuWtSi.js +0 -2
- package/dist/assets/ShaderAssetDocument-D6UrvTPz.js +0 -1
- package/dist/assets/StageHost-CCbIVhfB.js +0 -1179
- package/dist/assets/ToolObject3DPreview-nevU8Vmi.js +0 -1
- package/dist/assets/ViewportShadingMenu-rbW6zaze.js +0 -1
- package/dist/assets/animation-mixers.service-qLmPXMph.js +0 -1
- package/dist/assets/animation-timeline.utility-Cepgwl9G.js +0 -1
- package/dist/assets/asset-preview-C3dOTcRY.js +0 -4
- package/dist/assets/blender-emscripten-engine-DnJ85_-l.js +0 -2
- package/dist/assets/blender-node-editor.document-BjpzVLc9.js +0 -1
- package/dist/assets/blender-properties-model-BNV7uq3w.js +0 -1
- package/dist/assets/blender-properties-tab-BoiBE9VB.js +0 -3
- package/dist/assets/blender-runtime-host-DKW0D0Bb.js +0 -7221
- package/dist/assets/blender-runtime.document-xKuVNUX7.js +0 -13
- package/dist/assets/blender-screenshot.menu-c6UvFn7v.js +0 -1
- package/dist/assets/blender-timeline.document-_vgbH_K5.js +0 -1
- package/dist/assets/blender-uv-editor.document-CjOx4LD3.js +0 -1
- package/dist/assets/blender-version.status-GBqitUon.js +0 -1
- package/dist/assets/blender-wali-engine-x-OfFUGX.js +0 -2
- package/dist/assets/blender.command-CYOL3BTf.js +0 -1
- package/dist/assets/blender.status-BYUrfsCR.js +0 -1
- package/dist/assets/model-inspection-DGW_rNdi.js +0 -1
- package/dist/assets/models.finder-C2OdvWDn.js +0 -1
- package/dist/assets/object3d-document-session-registry-BkSfsQD9.js +0 -2
- package/dist/assets/play-mode-Bfa-EEKv.js +0 -1
- package/dist/assets/product-4XoIi8-H.js +0 -14
- package/dist/assets/properties-bone-constraints.inspector-De28M-3w.js +0 -1
- package/dist/assets/properties-bone.inspector-Dwl_8RHa.js +0 -1
- package/dist/assets/properties-collection.inspector-zgL35H1s.js +0 -1
- package/dist/assets/properties-constraints.inspector-C4HmYG4b.js +0 -1
- package/dist/assets/properties-data.inspector-C84mWYEx.js +0 -1
- package/dist/assets/properties-material.inspector-EXqO4JLk.js +0 -1
- package/dist/assets/properties-modifiers.inspector-B5-5UoW_.js +0 -1
- package/dist/assets/properties-object.inspector-CacLETan.js +0 -1
- package/dist/assets/properties-output.inspector-DpGmXWef.js +0 -1
- package/dist/assets/properties-particles.inspector-XTVoWTZq.js +0 -1
- package/dist/assets/properties-physics.inspector-DlhF0h-n.js +0 -1
- package/dist/assets/properties-render.inspector-Dpnfz8vA.js +0 -1
- package/dist/assets/properties-scene.inspector-DqOfknkg.js +0 -1
- package/dist/assets/properties-texture.inspector-WD0VfQaG.js +0 -1
- package/dist/assets/properties-view-layer.inspector-DWFckdDj.js +0 -1
- package/dist/assets/properties-world.inspector-DcqJkcHc.js +0 -1
- package/dist/assets/react-18-AEAPuaAj.js +0 -1
- package/dist/assets/session-rpZf0raD.js +0 -5972
- package/dist/assets/stage-keyboard-ChQ8dJ_y.js +0 -1
- package/dist/assets/stage-overlay-set-PfEXKWA6.js +0 -1
- package/dist/assets/stage-presence-markers-Dnxnhx_2.js +0 -1
- package/dist/assets/stage-transform-tools-mFUKm77V.js +0 -1
- package/dist/assets/standard-viewport-dressing-DChZYVlW.js +0 -24
- package/dist/assets/three-integration.service-C6HNczqS.js +0 -2
- package/dist/assets/volter-sdk-CjkJnQ6d.js +0 -2363
- package/dist/assets/volter-sdk-account-DZEQFuaU.js +0 -1
- package/dist/assets/volter-sdk-client-D6tlzH-t.js +0 -1
- package/dist/assets/volter-sdk-contributions-Cl4ThyFT.js +0 -1
- package/dist/assets/volter-sdk-css-numeric-style-BSayA78S.js +0 -1
- package/dist/assets/volter-sdk-document-probe-rU9NBzUS.js +0 -1
- package/dist/assets/volter-sdk-editor-view-DfxbbN7q.js +0 -1
- package/dist/assets/volter-sdk-host-Dy6XofbJ.js +0 -1
- package/dist/assets/volter-sdk-http-transport.browser-Co0YCwat.js +0 -1
- package/dist/assets/volter-sdk-index-B2ws1and.js +0 -1
- package/dist/assets/volter-sdk-kit-CapabilityCoverageSection-CBEHQx0y.js +0 -1
- package/dist/assets/volter-sdk-kit-account-client-CLa-z4XH.js +0 -1
- package/dist/assets/volter-sdk-kit-action-registry-ifQNLVPb.js +0 -1
- package/dist/assets/volter-sdk-kit-active-product-v7CkKfFz.js +0 -1
- package/dist/assets/volter-sdk-kit-active-project-Di0hQPIg.js +0 -1
- package/dist/assets/volter-sdk-kit-adapter-editor-config-fdw01apb.js +0 -1
- package/dist/assets/volter-sdk-kit-adapter-observation-CW92skZV.js +0 -1
- package/dist/assets/volter-sdk-kit-animation-animation-clock-B3sM2uit.js +0 -1
- package/dist/assets/volter-sdk-kit-animation-stage-transport-JvYidVYX.js +0 -1
- package/dist/assets/volter-sdk-kit-api-assets-D7VbukcI.js +0 -1
- package/dist/assets/volter-sdk-kit-api-base-DerHHtTE.js +0 -1
- package/dist/assets/volter-sdk-kit-api-build-CeuJY-Zz.js +0 -1
- package/dist/assets/volter-sdk-kit-api-logs-1pMi7TTm.js +0 -1
- package/dist/assets/volter-sdk-kit-api-project-identity-CBU8Hed0.js +0 -1
- package/dist/assets/volter-sdk-kit-api-project-open-D067PXCw.js +0 -1
- package/dist/assets/volter-sdk-kit-api-project-source-Bho3j6pZ.js +0 -1
- package/dist/assets/volter-sdk-kit-api-project-state-BKh_xLbJ.js +0 -1
- package/dist/assets/volter-sdk-kit-api-relay-CC-iWi7D.js +0 -1
- package/dist/assets/volter-sdk-kit-api-settings-sot6qLo3.js +0 -1
- package/dist/assets/volter-sdk-kit-api-themes-Cc-af_-d.js +0 -1
- package/dist/assets/volter-sdk-kit-api-worktrees-D1GTPFtv.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-capabilities-CNOHj_kb.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-compare-core-CXAda1bF.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-editor-context-DsUk8Th6.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-events-BL8DRoc8.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-inspector-actions-0o9QNJKn.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-selection-B3xjSJGy.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-selection-viewer-registry-SEv2CkwZ.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-thumbnails-Dljbgkxh.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-viewers-CxZRO5JV.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-workflow-asset-import-jobs-DqIPpnfC.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-workflow-asset-ledger-D1KEb0Ey.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-workflow-asset-ledger-backend-D6HUnLJm.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-workflow-asset-materialization-report-By1Yv3wm.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-workflow-asset-pack-manifest-DisvezHH.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-workflow-audio-preview-player-BwwiLB40.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-workflow-audio-waveform-FrA-pulC.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-workflow-cloud-asset-client-DDI1Kwjv.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-workflow-hosted-asset-materialization-CzPpDfqY.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-workflow-image-view-scale-DdWpOH6e.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-workflow-ledger-write-lock-Cqtyka10.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-workflow-pixi-spritesheet-BUxJUIx-.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-workflow-preview-resource-lifetime-Dpvl0ufz.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-workflow-project-asset-commands-Clt-ftCc.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-workflow-project-content-BO7LgDmE.js +0 -1
- package/dist/assets/volter-sdk-kit-asset-workflow-thumbnail-system-CCoxMBjk.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-active-adapter-Po4bB0Uj.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-active-systems-B1Bx10Aq.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-adapter-key-BlWE7I0N.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-authoring-asset-url-SOwAcp48.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-bootstrap-state-DnBU8nzt.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-boundary-authoring-adapter-BFAbj3pB.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-canvas-scene-guides-DOJYMXPn.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-composite-authoring-adapter-BoBcdwww.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-consumer-actions-DeU9WESz.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-design-time-layers-ZcfipFHX.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-design-time-mount-registry-4mdJO8W-.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-edit-mode-authoring-Bymo2_8C.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-empty-project-authoring-BeRaeFRT.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-instance-source-menu-De7LQ6t6.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-layered-pick-DMVOLo1B.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-mounted-root-subjects-CXLwIbEX.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-no-authoring-adapter-D_y8WcS6.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-object3d-document-persistence-B8wcp7IQ.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-panel-authoring-sbvO6626.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-project-authoring-session-Cykydx2J.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-provenance-D0b1PE71.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-react-canvas-navigation-CSwEgzI6.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-react-design-canvas-style-Cl2M3OV0.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-react-story-board-bTjtW2CO.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-seam-evidence-pkdnkJtV.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-selection-scope-DVgEaPQM.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-shell-document-ops-BbuK7pxG.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-story-board-chrome-fit-OFpXQxIF.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-three-root-BkH3AlEt.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-viewport-tool-context-Cr0fa0Hl.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-viewport-tool-owner-DTnGce_x.js +0 -1
- package/dist/assets/volter-sdk-kit-authoring-world-session-state-D5Aqfbm8.js +0 -1
- package/dist/assets/volter-sdk-kit-availability-tick-h3DHQ7AK.js +0 -1
- package/dist/assets/volter-sdk-kit-bitmap-label-nN7zK7TR.js +0 -1
- package/dist/assets/volter-sdk-kit-boot-routing-mm6XL4_m.js +0 -1
- package/dist/assets/volter-sdk-kit-breakpoint-state-BhIvquyw.js +0 -1
- package/dist/assets/volter-sdk-kit-build-identity-BUHMFgej.js +0 -1
- package/dist/assets/volter-sdk-kit-bytes-codec-j4IdoVn0.js +0 -1
- package/dist/assets/volter-sdk-kit-cancellation-reason-D-nMBP2I.js +0 -1
- package/dist/assets/volter-sdk-kit-canvas-frames-DEW6SW_n.js +0 -1
- package/dist/assets/volter-sdk-kit-capture-camera-pose-lHuE4-F1.js +0 -1
- package/dist/assets/volter-sdk-kit-capture-size-CfI__WD3.js +0 -1
- package/dist/assets/volter-sdk-kit-chrome-registry-DQC9TBMd.js +0 -1
- package/dist/assets/volter-sdk-kit-chrome-slot-registry-BaA2m-hW.js +0 -1
- package/dist/assets/volter-sdk-kit-collaboration-client-BgCs9YmN.js +0 -1
- package/dist/assets/volter-sdk-kit-collaboration-presence-zP8Qm_Wp.js +0 -1
- package/dist/assets/volter-sdk-kit-command-dispatch-DMN1cHQ0.js +0 -1
- package/dist/assets/volter-sdk-kit-command-listener-Bi6V9vZY.js +0 -1
- package/dist/assets/volter-sdk-kit-command-registry-CbwwOUlX.js +0 -1
- package/dist/assets/volter-sdk-kit-component-board-registry-DuKMXXDn.js +0 -1
- package/dist/assets/volter-sdk-kit-component-states-registry-C8fPwGac.js +0 -1
- package/dist/assets/volter-sdk-kit-components-AlignToolbar-DI9H0cLf.js +0 -1
- package/dist/assets/volter-sdk-kit-components-ApplicationMenus-0EFLpJl3.js +0 -1
- package/dist/assets/volter-sdk-kit-components-AssetEditorShell-W9E9Idk3.js +0 -1
- package/dist/assets/volter-sdk-kit-components-AssetInspectorToolSection-B9C8g1u8.js +0 -1
- package/dist/assets/volter-sdk-kit-components-BoardRulers-TvtGoLvw.js +0 -1
- package/dist/assets/volter-sdk-kit-components-CanvasAddNodeDialogs-BbT71ZLs.js +0 -1
- package/dist/assets/volter-sdk-kit-components-CanvasSceneViewport-DMlRqvRX.js +0 -1
- package/dist/assets/volter-sdk-kit-components-ChromeSlot-CBMhERxH.js +0 -1
- package/dist/assets/volter-sdk-kit-components-CodeView-DaFrODJ5.js +0 -1
- package/dist/assets/volter-sdk-kit-components-CompactInspectorShell-DAU9Rz8t.js +0 -1
- package/dist/assets/volter-sdk-kit-components-ConsolePanel-DL9PRS8g.js +0 -1
- package/dist/assets/volter-sdk-kit-components-GameplaySessionTimeline-BQM829E_.js +0 -1
- package/dist/assets/volter-sdk-kit-components-InspectionProjection-ct5F1-5f.js +0 -1
- package/dist/assets/volter-sdk-kit-components-Inspector-D_LqAGkl.js +0 -1
- package/dist/assets/volter-sdk-kit-components-InspectorCanvasPreview-BE7YIVKr.js +0 -1
- package/dist/assets/volter-sdk-kit-components-InspectorFieldsSection-m9xPIIHr.js +0 -1
- package/dist/assets/volter-sdk-kit-components-InspectorStoriesSection-ZlS3c7i5.js +0 -1
- package/dist/assets/volter-sdk-kit-components-InspectorToolSection-B0nuZPLk.js +0 -1
- package/dist/assets/volter-sdk-kit-components-InspectorTransformSection-nkjme0st.js +0 -1
- package/dist/assets/volter-sdk-kit-components-LightExplorerPanel-BWEMMDqF.js +0 -1
- package/dist/assets/volter-sdk-kit-components-MediaProperties-D7iIz70v.js +0 -1
- package/dist/assets/volter-sdk-kit-components-ProjectHeader-BGak497E.js +0 -1
- package/dist/assets/volter-sdk-kit-components-ReactCanvasControls-DC8ly4DP.js +0 -1
- package/dist/assets/volter-sdk-kit-components-RootSelectionOverlay-BgFEsPuR.js +0 -1
- package/dist/assets/volter-sdk-kit-components-RootTextEditor-D5kNPJPO.js +0 -1
- package/dist/assets/volter-sdk-kit-components-SaveStatus-DUcBxh5_.js +0 -1
- package/dist/assets/volter-sdk-kit-components-SurfaceCrashBoundary-DS5fFxXL.js +0 -1
- package/dist/assets/volter-sdk-kit-components-SurfaceStateOverlay-LQ6wer_f.js +0 -1
- package/dist/assets/volter-sdk-kit-components-ToolContributionSurfaces-CsA2zXqR.js +0 -1
- package/dist/assets/volter-sdk-kit-components-ToolHost-CCgNWoYQ.js +0 -1
- package/dist/assets/volter-sdk-kit-components-Toolbar-BcFqLTKO.js +0 -1
- package/dist/assets/volter-sdk-kit-components-TransientHint-BJ8PYeZC.js +0 -1
- package/dist/assets/volter-sdk-kit-components-VersionControlSection-DmfeMks1.js +0 -1
- package/dist/assets/volter-sdk-kit-components-ViewportOverlaysMenu-CgfsJe_1.js +0 -1
- package/dist/assets/volter-sdk-kit-components-VolterLogo-Bsb05O0W.js +0 -1
- package/dist/assets/volter-sdk-kit-components-WorktreeSwitcher-DHIF6Kg1.js +0 -1
- package/dist/assets/volter-sdk-kit-components-account-documents-CwYhcEZA.js +0 -1
- package/dist/assets/volter-sdk-kit-components-asset-documents-DyPZbhVR.js +0 -1
- package/dist/assets/volter-sdk-kit-components-asset-editor-persistence-DFyUUrtF.js +0 -1
- package/dist/assets/volter-sdk-kit-components-asset-selection-section-CcmRV0Bv.js +0 -1
- package/dist/assets/volter-sdk-kit-components-asset-thumbnails-CVmK39Vm.js +0 -1
- package/dist/assets/volter-sdk-kit-components-asset-viewers-AudioViewer-C7t9xXsJ.js +0 -1
- package/dist/assets/volter-sdk-kit-components-asset-viewers-GenericJsonViewer-DyOUPMrf.js +0 -1
- package/dist/assets/volter-sdk-kit-components-asset-viewers-ImageViewer-BZVLIpzi.js +0 -1
- package/dist/assets/volter-sdk-kit-components-asset-viewers-JsonAssetDocument-MFzv1JKl.js +0 -1
- package/dist/assets/volter-sdk-kit-components-asset-viewers-OnlineAssetDetail-C1I6t0XF.js +0 -1
- package/dist/assets/volter-sdk-kit-components-asset-viewers-SourceAssetViewer-TSnI0wjc.js +0 -1
- package/dist/assets/volter-sdk-kit-components-asset-viewers-SpritesheetSpriteView-DisNEKau.js +0 -1
- package/dist/assets/volter-sdk-kit-components-asset-viewers-VideoViewer-CT1gLpCM.js +0 -1
- package/dist/assets/volter-sdk-kit-components-asset-viewers-shader-source-D-ByF1Z9.js +0 -1
- package/dist/assets/volter-sdk-kit-components-board-guides-C3ZEj1WY.js +0 -1
- package/dist/assets/volter-sdk-kit-components-canvas-scene-hotkeys-BQ9gavD1.js +0 -1
- package/dist/assets/volter-sdk-kit-components-canvas-temporary-pivot-DVB2TYkq.js +0 -1
- package/dist/assets/volter-sdk-kit-components-core-utilities-inT-Nle5.js +0 -1
- package/dist/assets/volter-sdk-kit-components-inspector-preview-section-vfZoaY5P.js +0 -1
- package/dist/assets/volter-sdk-kit-components-inspector-revert-label-DRRZSGIK.js +0 -1
- package/dist/assets/volter-sdk-kit-components-inspector-selection-Bv1ikayS.js +0 -1
- package/dist/assets/volter-sdk-kit-components-inspector-stories-gating-BpG3_W7U.js +0 -1
- package/dist/assets/volter-sdk-kit-components-inspector-transform-CP6nVKqd.js +0 -1
- package/dist/assets/volter-sdk-kit-components-inspector-transform-subject-Du0gXiav.js +0 -1
- package/dist/assets/volter-sdk-kit-components-kind-documents-B_HiV65O.js +0 -1
- package/dist/assets/volter-sdk-kit-components-primitives-DraftColorInput-7rauPX0T.js +0 -1
- package/dist/assets/volter-sdk-kit-components-project-tool-documents-3di65yH2.js +0 -1
- package/dist/assets/volter-sdk-kit-components-scene-documents-Bl1zTaDc.js +0 -1
- package/dist/assets/volter-sdk-kit-components-status-contributions-B8H0B8ft.js +0 -1
- package/dist/assets/volter-sdk-kit-components-tool-documents-C2PpEqP0.js +0 -1
- package/dist/assets/volter-sdk-kit-components-tool-schema-form-72_NOun0.js +0 -1
- package/dist/assets/volter-sdk-kit-components-use-after-paint-DrYvNkkp.js +0 -1
- package/dist/assets/volter-sdk-kit-components-use-project-image-assets-BqKEbF2g.js +0 -1
- package/dist/assets/volter-sdk-kit-components-workspace-history-xnZKFOcO.js +0 -1
- package/dist/assets/volter-sdk-kit-components-world-documents-B_l8OVFP.js +0 -1
- package/dist/assets/volter-sdk-kit-components-world-overlay-gestures-C0aE-brt.js +0 -1
- package/dist/assets/volter-sdk-kit-composite-screenshot-BcGNs7-k.js +0 -1
- package/dist/assets/volter-sdk-kit-content-entry-source-registry-CSDvBeHp.js +0 -1
- package/dist/assets/volter-sdk-kit-contribution-surfaces-CQ2rcWky.js +0 -1
- package/dist/assets/volter-sdk-kit-coverage-canvas-reveal-CaBb6Hfn.js +0 -1
- package/dist/assets/volter-sdk-kit-coverage-design-time-surfaces-BZvDlBew.js +0 -1
- package/dist/assets/volter-sdk-kit-coverage-ontology-invariants-CyWzK029.js +0 -1
- package/dist/assets/volter-sdk-kit-coverage-session-vitals-BSV6PDul.js +0 -1
- package/dist/assets/volter-sdk-kit-creation-site-registry-fCJv-VnD.js +0 -1
- package/dist/assets/volter-sdk-kit-delegate-harness-registry-0s32Ke4a.js +0 -1
- package/dist/assets/volter-sdk-kit-document-areas-d6o-fnVq.js +0 -1
- package/dist/assets/volter-sdk-kit-document-context-registry-C-rdTIZz.js +0 -1
- package/dist/assets/volter-sdk-kit-document-open-registry-VuPIF1dw.js +0 -1
- package/dist/assets/volter-sdk-kit-document-play-extension-CnbtQG5g.js +0 -1
- package/dist/assets/volter-sdk-kit-document-preview-source-BOuN3JP9.js +0 -1
- package/dist/assets/volter-sdk-kit-document-renderer-session-C4Y-LjCl.js +0 -1
- package/dist/assets/volter-sdk-kit-document-stage-sessions-DFQXt_Kt.js +0 -1
- package/dist/assets/volter-sdk-kit-document-viewports-Caa-nlVQ.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-api-C1nO5qN_.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-chrome-capture-Cyo9MOWB.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-commands-DgSsLdds.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-console-D1PH1xFg.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-current-view-Bset7Nwl.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-document-probe-Czf1syZL.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-git-client-CMFbof3B.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-hotkeys-_jIQrvhL.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-lease-CqLtzZdx.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-lease-view-B38iYVxe.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-mode-DhgTI0qH.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-notifications-Yta6jrTE.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-presence-CmU0c8nu.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-presentation-activity-Chb0_n3L.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-presentation-notice-CJJau7kX.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-runtime-C_0J-89o.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-server-response-AowGGRsX.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-session-attribution-CE3iHsa9.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-session-mode-DxwZ4UOE.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-state-facets-CrumZoYh.js +0 -1
- package/dist/assets/volter-sdk-kit-editor-view-presentation-C-p2mMYG.js +0 -1
- package/dist/assets/volter-sdk-kit-environment-images-bVl6oO0J.js +0 -1
- package/dist/assets/volter-sdk-kit-eyedropper-session-xsFx5slJ.js +0 -1
- package/dist/assets/volter-sdk-kit-files-file-provider-BZr0PG4o.js +0 -1
- package/dist/assets/volter-sdk-kit-files-project-files-DlEfa4r5.js +0 -1
- package/dist/assets/volter-sdk-kit-finders-index-1Yh1UrN5.js +0 -1
- package/dist/assets/volter-sdk-kit-finders-scenes-from-entrypoint-selection-BdkJ-g9C.js +0 -1
- package/dist/assets/volter-sdk-kit-frame-frame-parts-DvbxUeaX.js +0 -1
- package/dist/assets/volter-sdk-kit-framed-document-capture-Doq07qaD.js +0 -1
- package/dist/assets/volter-sdk-kit-game-surface-defaults-Cco9xAIy.js +0 -1
- package/dist/assets/volter-sdk-kit-gameplay-export-state-Bh35kQUs.js +0 -1
- package/dist/assets/volter-sdk-kit-gameplay-replay-CJUXUO5Z.js +0 -1
- package/dist/assets/volter-sdk-kit-gameplay-session-time-xKMm2Bmw.js +0 -1
- package/dist/assets/volter-sdk-kit-gameplay-sessions-BtyPVYt1.js +0 -1
- package/dist/assets/volter-sdk-kit-hierarchy-component-marks-CMA_1E0Z.js +0 -1
- package/dist/assets/volter-sdk-kit-hierarchy-internals-C2mw6TEb.js +0 -1
- package/dist/assets/volter-sdk-kit-hierarchy-kind-icon-Uq5N3cYQ.js +0 -1
- package/dist/assets/volter-sdk-kit-hierarchy-menu-registry-BuUQH5-1.js +0 -1
- package/dist/assets/volter-sdk-kit-hierarchy-node-rows-DoIy_rr4.js +0 -1
- package/dist/assets/volter-sdk-kit-hierarchy-panel-view-C28YFK-D.js +0 -1
- package/dist/assets/volter-sdk-kit-hierarchy-projection-BlTrqGJP.js +0 -1
- package/dist/assets/volter-sdk-kit-hierarchy-row-media-Bi4TlkKq.js +0 -1
- package/dist/assets/volter-sdk-kit-hierarchy-row-model-B6Umqjy9.js +0 -1
- package/dist/assets/volter-sdk-kit-hierarchy-rows-LJpacUWB.js +0 -1
- package/dist/assets/volter-sdk-kit-hierarchy-walk-CUME5S0j.js +0 -1
- package/dist/assets/volter-sdk-kit-history-editor-session-vyoZV4Se.js +0 -1
- package/dist/assets/volter-sdk-kit-history-history-commands-BvP_RqsP.js +0 -1
- package/dist/assets/volter-sdk-kit-history-history-delegate-DilFGldE.js +0 -1
- package/dist/assets/volter-sdk-kit-history-history-limit-notices-Bl7qNsVW.js +0 -1
- package/dist/assets/volter-sdk-kit-history-history-service-CUwc9Oh1.js +0 -1
- package/dist/assets/volter-sdk-kit-history-persistence-coordinator-By_l7An0.js +0 -1
- package/dist/assets/volter-sdk-kit-history-project-file-history-stqJ4Wa9.js +0 -1
- package/dist/assets/volter-sdk-kit-history-project-root-history-backends-Dhihw3lO.js +0 -1
- package/dist/assets/volter-sdk-kit-history-resource-registry-BmWUO5On.js +0 -1
- package/dist/assets/volter-sdk-kit-history-snapshot-store-DpGm1CKT.js +0 -1
- package/dist/assets/volter-sdk-kit-history-source-history-backend-CWkNA5B8.js +0 -1
- package/dist/assets/volter-sdk-kit-hmr-registration-group-DXxPfV1d.js +0 -1
- package/dist/assets/volter-sdk-kit-hmr-stable-react-context-DTKg0yz7.js +0 -1
- package/dist/assets/volter-sdk-kit-hotkeys-B-DB4WDn.js +0 -1
- package/dist/assets/volter-sdk-kit-inference-diagnostics-Bg2RC291.js +0 -1
- package/dist/assets/volter-sdk-kit-initial-project-DcV4d4vU.js +0 -1
- package/dist/assets/volter-sdk-kit-inspection-active-subject-Dpg7lLaz.js +0 -1
- package/dist/assets/volter-sdk-kit-inspection-active-surface-CtXLz-UE.js +0 -1
- package/dist/assets/volter-sdk-kit-inspection-compose-subject-DPCLcleB.js +0 -1
- package/dist/assets/volter-sdk-kit-inspection-display-WcRFy6fP.js +0 -1
- package/dist/assets/volter-sdk-kit-inspection-document-subject-Dg6DIr4J.js +0 -1
- package/dist/assets/volter-sdk-kit-inspection-game-subject-CCU0bOnL.js +0 -1
- package/dist/assets/volter-sdk-kit-inspection-model-BHHq-F57.js +0 -1
- package/dist/assets/volter-sdk-kit-inspection-node-media-D3HHlQ-1.js +0 -1
- package/dist/assets/volter-sdk-kit-inspection-null-subject-CojoXu4j.js +0 -1
- package/dist/assets/volter-sdk-kit-inspection-serialize-BXTD5f5F.js +0 -1
- package/dist/assets/volter-sdk-kit-inspection-use-active-inspection-D0tMZbA8.js +0 -1
- package/dist/assets/volter-sdk-kit-inspector-presentation-DDTS4NPQ.js +0 -1
- package/dist/assets/volter-sdk-kit-inspector-property-grouping-C8gM67Ji.js +0 -1
- package/dist/assets/volter-sdk-kit-inspector-section-registry-C0bhf71P.js +0 -1
- package/dist/assets/volter-sdk-kit-instance-source-actions-DxsyQJOt.js +0 -1
- package/dist/assets/volter-sdk-kit-js-heap-COa0ZQO1.js +0 -1
- package/dist/assets/volter-sdk-kit-key-actions-DUdVok9i.js +0 -1
- package/dist/assets/volter-sdk-kit-keymap-presets-CtsgCBMq.js +0 -1
- package/dist/assets/volter-sdk-kit-layout-policy-B1UriNWB.js +0 -1
- package/dist/assets/volter-sdk-kit-light-explorer-model-DDrGjN_l.js +0 -1
- package/dist/assets/volter-sdk-kit-live-canvas-frame-Bx3mSipB.js +0 -1
- package/dist/assets/volter-sdk-kit-live-document-CPBTdxo0.js +0 -1
- package/dist/assets/volter-sdk-kit-live-gesture-lock-B4b9BM5c.js +0 -1
- package/dist/assets/volter-sdk-kit-live-seam-evidence-ByZ2Gf3m.js +0 -1
- package/dist/assets/volter-sdk-kit-live-session-registry-mxT-37yH.js +0 -1
- package/dist/assets/volter-sdk-kit-live-transition-CrRFP373.js +0 -1
- package/dist/assets/volter-sdk-kit-manifest-project-BCBSW7yn.js +0 -1
- package/dist/assets/volter-sdk-kit-module-fetch-diagnosis-ENr7r-oj.js +0 -1
- package/dist/assets/volter-sdk-kit-mount-failure-report-Diw3prSP.js +0 -1
- package/dist/assets/volter-sdk-kit-native-selection-style-D_oHLKGc.js +0 -1
- package/dist/assets/volter-sdk-kit-object3d-document-write-policy-Dq8rnb-h.js +0 -1
- package/dist/assets/volter-sdk-kit-packaged-runtime-2ZtSBw9e.js +0 -1
- package/dist/assets/volter-sdk-kit-performance-profiler-J1GcKurL.js +0 -1
- package/dist/assets/volter-sdk-kit-performance-sources-Dk3RIhPs.js +0 -1
- package/dist/assets/volter-sdk-kit-photograph-notice-CEVpX_yj.js +0 -1
- package/dist/assets/volter-sdk-kit-play-boot-phase-D22MvZjX.js +0 -1
- package/dist/assets/volter-sdk-kit-play-camera-flight-Dh3-SiG2.js +0 -1
- package/dist/assets/volter-sdk-kit-presentation-surface-DtvQ6uwm.js +0 -1
- package/dist/assets/volter-sdk-kit-product-command-DhQ2vGY7.js +0 -1
- package/dist/assets/volter-sdk-kit-project-adapter-lJsp7vSt.js +0 -1
- package/dist/assets/volter-sdk-kit-project-asset-refresh-D94Pa8-n.js +0 -1
- package/dist/assets/volter-sdk-kit-project-asset-roots-DkjE-H4P.js +0 -1
- package/dist/assets/volter-sdk-kit-project-local-state-C3dueXjj.js +0 -1
- package/dist/assets/volter-sdk-kit-project-manager-D8pSoBk5.js +0 -1
- package/dist/assets/volter-sdk-kit-project-module-changes-CmswawEd.js +0 -1
- package/dist/assets/volter-sdk-kit-project-module-split-BWSP4PC6.js +0 -1
- package/dist/assets/volter-sdk-kit-project-provenance-y2LiaenC.js +0 -1
- package/dist/assets/volter-sdk-kit-project-ready-5KOkgAie.js +0 -1
- package/dist/assets/volter-sdk-kit-project-shape-CRi6VMwW.js +0 -1
- package/dist/assets/volter-sdk-kit-project-tools-DefLgVW-.js +0 -1
- package/dist/assets/volter-sdk-kit-readiness-CFiVXonW.js +0 -1
- package/dist/assets/volter-sdk-kit-renderer-resource-counts-yv0wDv9Z.js +0 -1
- package/dist/assets/volter-sdk-kit-reported-play-state-CdBN7lgt.js +0 -1
- package/dist/assets/volter-sdk-kit-resolve-contributed-command-C-UnZAy2.js +0 -1
- package/dist/assets/volter-sdk-kit-resolve-relative-specifier-B0fBf47E.js +0 -1
- package/dist/assets/volter-sdk-kit-retained-document-states-BaHAJmNJ.js +0 -1
- package/dist/assets/volter-sdk-kit-scene-document-plan-ByPu78Ca.js +0 -1
- package/dist/assets/volter-sdk-kit-scene-live-open-WieSHU0m.js +0 -1
- package/dist/assets/volter-sdk-kit-scoped-game-css-Cl-iGkav.js +0 -1
- package/dist/assets/volter-sdk-kit-served-url-CvjRxXVY.js +0 -1
- package/dist/assets/volter-sdk-kit-session-close-Bj5v_SbU.js +0 -1
- package/dist/assets/volter-sdk-kit-session-tombstone-D1LTs2G4.js +0 -1
- package/dist/assets/volter-sdk-kit-settings-settings-provider-CdD8uh79.js +0 -1
- package/dist/assets/volter-sdk-kit-settings-store-CdCWpZpX.js +0 -1
- package/dist/assets/volter-sdk-kit-shell-store-BPMrMgto.js +0 -1
- package/dist/assets/volter-sdk-kit-shell-store-door-D5csR7L7.js +0 -1
- package/dist/assets/volter-sdk-kit-source-conflict-C1LAtXzO.js +0 -1
- package/dist/assets/volter-sdk-kit-stage-context-B5Ashsvr.js +0 -1
- package/dist/assets/volter-sdk-kit-stage-invalidation-DrB2GJkV.js +0 -1
- package/dist/assets/volter-sdk-kit-stage-store-registry-BBmIUDrH.js +0 -1
- package/dist/assets/volter-sdk-kit-startup-failure-B_1Us5LR.js +0 -1
- package/dist/assets/volter-sdk-kit-state-report-deferral-CadDAzqC.js +0 -1
- package/dist/assets/volter-sdk-kit-storage-host-files-storage-DlAZpF8O.js +0 -1
- package/dist/assets/volter-sdk-kit-storage-http-storage-BGzRT9Yh.js +0 -1
- package/dist/assets/volter-sdk-kit-storage-index-BRza5xQo.js +0 -1
- package/dist/assets/volter-sdk-kit-storage-mem-storage--iLg4qqC.js +0 -1
- package/dist/assets/volter-sdk-kit-storage-path-lock-DIiF0WD6.js +0 -1
- package/dist/assets/volter-sdk-kit-storage-paths-RUYTo3ty.js +0 -1
- package/dist/assets/volter-sdk-kit-stories-StoryPreviewMount-CIWFkcHG.js +0 -1
- package/dist/assets/volter-sdk-kit-stories-compose-project-stories-DwoDwmJU.js +0 -1
- package/dist/assets/volter-sdk-kit-stories-prefabs-finder-1J_oByWW.js +0 -1
- package/dist/assets/volter-sdk-kit-stories-prefabs-from-stories-BWzNS_pC.js +0 -1
- package/dist/assets/volter-sdk-kit-stories-project-story-regions-Cmj0gYSU.js +0 -1
- package/dist/assets/volter-sdk-kit-stories-scope-dbPpXRCQ.js +0 -1
- package/dist/assets/volter-sdk-kit-stories-story-capture-3Y8Mr8qy.js +0 -1
- package/dist/assets/volter-sdk-kit-stories-story-declared-medium-D3PDNDCy.js +0 -1
- package/dist/assets/volter-sdk-kit-stories-story-discovery-lsLHfYGO.js +0 -1
- package/dist/assets/volter-sdk-kit-stories-story-dom-runtime-Bcuc8WAV.js +0 -1
- package/dist/assets/volter-sdk-kit-stories-story-grouping-iqNIaFLi.js +0 -1
- package/dist/assets/volter-sdk-kit-stories-story-presentation-CK7iy9Ei.js +0 -1
- package/dist/assets/volter-sdk-kit-stories-story-registry-BgeJ9s08.js +0 -1
- package/dist/assets/volter-sdk-kit-story-document-openers-cYEL6Hy6.js +0 -1
- package/dist/assets/volter-sdk-kit-story-thumbnails-CM9Z-bvM.js +0 -1
- package/dist/assets/volter-sdk-kit-surface-keyboard-DBn-R4RW.js +0 -1
- package/dist/assets/volter-sdk-kit-surface-state-lyZ-F89S.js +0 -1
- package/dist/assets/volter-sdk-kit-system-seam-evidence-M2PpGJaD.js +0 -1
- package/dist/assets/volter-sdk-kit-tab-census-D-cKQr53.js +0 -1
- package/dist/assets/volter-sdk-kit-tab-lifecycle-client-C9bdy1EQ.js +0 -1
- package/dist/assets/volter-sdk-kit-theme-library-C1SMcZX-.js +0 -1
- package/dist/assets/volter-sdk-kit-theme-preference-D7fq5Aos.js +0 -1
- package/dist/assets/volter-sdk-kit-three-viewport-presentation-C3jDpb-D.js +0 -1
- package/dist/assets/volter-sdk-kit-tool-contribution-play-BOVfgHO-.js +0 -1
- package/dist/assets/volter-sdk-kit-tool-loader-cdxKzGe5.js +0 -1
- package/dist/assets/volter-sdk-kit-transform-mode-request-BPBs33SD.js +0 -1
- package/dist/assets/volter-sdk-kit-transient-hint-DvRRSOfn.js +0 -1
- package/dist/assets/volter-sdk-kit-transport-strip-Dd6GTpZe.js +0 -1
- package/dist/assets/volter-sdk-kit-ui-source-file-region-resolver-BPLcvfGC.js +0 -1
- package/dist/assets/volter-sdk-kit-ui-source-inspect-Ckv_4nvy.js +0 -1
- package/dist/assets/volter-sdk-kit-ui-source-source-write-backend-CiReq_FI.js +0 -1
- package/dist/assets/volter-sdk-kit-ui-source-tier-source-write-backend-DZJqZvWO.js +0 -1
- package/dist/assets/volter-sdk-kit-user-local-state-9E2MdgX4.js +0 -1
- package/dist/assets/volter-sdk-kit-viewport-activation-timings-C7D8UOhh.js +0 -1
- package/dist/assets/volter-sdk-kit-viewport-editor-controls-D88BRUuu.js +0 -1
- package/dist/assets/volter-sdk-kit-viewport-presentation-Zb13u02P.js +0 -1
- package/dist/assets/volter-sdk-kit-viewport-surface-status-Ca85AZuU.js +0 -1
- package/dist/assets/volter-sdk-kit-wait-until-pqtZlaLI.js +0 -1
- package/dist/assets/volter-sdk-kit-worker-call-metrics-Cbz-2gPO.js +0 -1
- package/dist/assets/volter-sdk-kit-workspace-areas-B_i10_dm.js +0 -1
- package/dist/assets/volter-sdk-kit-workspace-aux-commands-DtGEjh20.js +0 -1
- package/dist/assets/volter-sdk-kit-workspace-available-documents-C8VSQ_mD.js +0 -1
- package/dist/assets/volter-sdk-kit-workspace-core-utilities-BiDneGhJ.js +0 -1
- package/dist/assets/volter-sdk-kit-workspace-document-ids-BWk99i3Z.js +0 -1
- package/dist/assets/volter-sdk-kit-workspace-document-registry-DS1fKB9K.js +0 -1
- package/dist/assets/volter-sdk-kit-workspace-document-restore-ZPSOlafH.js +0 -1
- package/dist/assets/volter-sdk-kit-workspace-host-commands-BLPz-3R_.js +0 -1
- package/dist/assets/volter-sdk-kit-workspace-persistence-gate-DaFEto7Y.js +0 -1
- package/dist/assets/volter-sdk-kit-workspace-play-utilities-DOoHAHVj.js +0 -1
- package/dist/assets/volter-sdk-kit-workspace-presets-DOs3QGh-.js +0 -1
- package/dist/assets/volter-sdk-kit-workspace-regions-wBvCVXKS.js +0 -1
- package/dist/assets/volter-sdk-kit-workspace-static-panels-ByMR68k-.js +0 -1
- package/dist/assets/volter-sdk-kit-workspace-status-registry-HAD_cNR4.js +0 -1
- package/dist/assets/volter-sdk-kit-workspace-storage-CqQ3PjCZ.js +0 -1
- package/dist/assets/volter-sdk-kit-workspace-style-BQcwaxYJ.js +0 -1
- package/dist/assets/volter-sdk-kit-workspace-utility-commands-et9TkyCh.js +0 -1
- package/dist/assets/volter-sdk-kit-workspace-utility-registry-rYY77c5M.js +0 -1
- package/dist/assets/volter-sdk-kit-world-adoption-Cdr7X1RK.js +0 -1
- package/dist/assets/volter-sdk-kit-world-canvas-viewport-state-CIToIMqL.js +0 -1
- package/dist/assets/volter-sdk-kit-world-document-routing-BZEtZVgX.js +0 -1
- package/dist/assets/volter-sdk-kit-world-pan-state-gNJklP8p.js +0 -1
- package/dist/assets/volter-sdk-kit-write-pipe-BADasoOU.js +0 -1
- package/dist/assets/volter-sdk-layout-arrangements-C2GnUWEf.js +0 -1
- package/dist/assets/volter-sdk-layouts-ai4Mr9iJ.js +0 -1
- package/dist/assets/volter-sdk-selection--L_yVThI.js +0 -1
- package/dist/assets/volter-sdk-session-command-table-HzFjzv-r.js +0 -1
- package/dist/assets/volter-sdk-session-editor-brand-DZQ6PWq1.js +0 -1
- package/dist/assets/volter-sdk-session-editor-compatibility-Dqc8l3ef.js +0 -1
- package/dist/assets/volter-sdk-session-editor-control-protocol-C9Ru_wUN.js +0 -1
- package/dist/assets/volter-sdk-session-entrypoint-selection-readers-zxVRreaL.js +0 -1
- package/dist/assets/volter-sdk-session-game-css-scope-Dqlihty_.js +0 -1
- package/dist/assets/volter-sdk-session-project-module-url-D83kzz0q.js +0 -1
- package/dist/assets/volter-sdk-session-relative-path-guard-CuR0WI9k.js +0 -1
- package/dist/assets/volter-sdk-session-tool-contribution-convention-BCFbkxzk.js +0 -1
- package/dist/assets/volter-sdk-types-CEnscS2I.js +0 -1
- package/dist/assets/volter-sdk-views-C5SjARB1.js +0 -1
- package/dist/assets/volter-sdk-widgets-design-system-CvoouaNJ.js +0 -1
- package/dist/assets/volter-sdk-widgets-editor-appearance-C7o2ovx9.js +0 -1
- package/dist/assets/volter-sdk-widgets-editor-material-DexUBcgV.js +0 -1
- package/dist/assets/volter-sdk-widgets-icon-set-registry-DlFlaNAF.js +0 -1
- package/dist/assets/volter-sdk-widgets-index-yq00_bNp.js +0 -1
- package/dist/assets/volter-sdk-widgets-inspector-widgets-AlignmentGrid-BTgcU6jh.js +0 -1
- package/dist/assets/volter-sdk-widgets-inspector-widgets-AssetSlotPicker-C2o3TwgU.js +0 -1
- package/dist/assets/volter-sdk-widgets-inspector-widgets-BorderEditor-FDtHP3jG.js +0 -1
- package/dist/assets/volter-sdk-widgets-inspector-widgets-ColorPicker-BuPI_wXu.js +0 -1
- package/dist/assets/volter-sdk-widgets-inspector-widgets-CurveEditor-DgzQ9479.js +0 -1
- package/dist/assets/volter-sdk-widgets-inspector-widgets-FilterEditor-DAvp2mOL.js +0 -1
- package/dist/assets/volter-sdk-widgets-inspector-widgets-FontPicker-D0qkPeCp.js +0 -1
- package/dist/assets/volter-sdk-widgets-inspector-widgets-GradientEditor-CCsSB7GO.js +0 -1
- package/dist/assets/volter-sdk-widgets-inspector-widgets-ScrubbableInput-HX8HYQyz.js +0 -1
- package/dist/assets/volter-sdk-widgets-inspector-widgets-ShadowEditor-W6DD40ZY.js +0 -1
- package/dist/assets/volter-sdk-widgets-inspector-widgets-color-utils-Da1Qassw.js +0 -1
- package/dist/assets/volter-sdk-widgets-inspector-widgets-curve-utils-CubhrOnj.js +0 -1
- package/dist/assets/volter-sdk-widgets-inspector-widgets-index-BfEw1ffU.js +0 -1
- package/dist/assets/volter-sdk-widgets-inspector-widgets-shared-BHXdKcVo.js +0 -1
- package/dist/assets/volter-sdk-widgets-interactive-edit-scope-BN0E0Doa.js +0 -1
- package/dist/assets/volter-sdk-widgets-patterns-Dialog-BRrjlh-m.js +0 -1
- package/dist/assets/volter-sdk-widgets-patterns-Fields-DZH1odj7.js +0 -1
- package/dist/assets/volter-sdk-widgets-patterns-List-C6d9TZjZ.js +0 -1
- package/dist/assets/volter-sdk-widgets-patterns-StateSurface-Drk0tBrv.js +0 -1
- package/dist/assets/volter-sdk-widgets-patterns-Surfaces-DDRN7QIn.js +0 -1
- package/dist/assets/volter-sdk-widgets-patterns-Tabs-EjlJmcJW.js +0 -1
- package/dist/assets/volter-sdk-widgets-patterns-Toolbar-CFvWB8mN.js +0 -1
- package/dist/assets/volter-sdk-widgets-patterns-Tree-BuqeZDz5.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-AnchoredMenu-CTTEOeVU.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-Button-C_0ZSSpT.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-ColorInput-CDSl_uTD.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-DraftTextInput-DkmxJEkt.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-EditorIcon-BBWNM0Qo.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-FormControls-BWxUJrgm.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-HoverPreview-DWhR7NPO.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-JsonInput-DT-JU62m.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-Layout-DdGxhqhS.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-Menu-DZZRIImg.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-NumberInput-BhCoXeub.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-Panel-CBt-GWg4.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-SectionHeader-zNqJ43pZ.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-Text-D5kMrfFl.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-ThemeRootPortal-C3qNx2NP.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-Tooltip-BZa_2pgU.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-Vec3Input-DHMZkNZm.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-banner-tones-B0Vu5nrN.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-clamp-to-viewport-gPoKdjpr.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-editor-icons-CzOo1YYK.js +0 -1
- package/dist/assets/volter-sdk-widgets-primitives-panel-header-styles-L08FUXCP.js +0 -1
- package/dist/assets/volter-sdk-widgets-theme-3FhMTQQW.js +0 -1
- package/dist/assets/volter-sdk-widgets-z-index-BY332K7Z.js +0 -1
- package/dist/assets/volter-shared-fontawesome-DpCdukGW.js +0 -1
- package/dist/assets/volter-shared-jsx-dev-runtime-Dzhuy0jr.js +0 -1
- package/dist/assets/volter-shared-jsx-runtime-CZf-NxSP.js +0 -1
- package/dist/assets/volter-shared-react-B8I974G-.js +0 -1
- package/dist/assets/volter-shared-react-dom-BSKZma7T.js +0 -1
- package/dist/assets/volter-shared-react-dom-client-aO0ss-5e.js +0 -1
- package/dist/assets/worker-C7WcdPfy.js +0 -8
- package/starter/race-state.ts +0 -22
- package/starter/track.blend +0 -0
- package/starter/track.play.ts +0 -343
- package/starter/track.py +0 -324
- package/starter/ui/game.stories.tsx +0 -12
- package/starter/ui/game.tsx +0 -10
- package/starter/ui/race-hud.tsx +0 -29
|
@@ -0,0 +1,1179 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/spark.module-CTTm62aa.js","assets/three.module-CtVjCPcj.js","assets/output-pass-j4dAGrPY.js","assets/index-C8BwtQGN.js","assets/stage-transform-tools-B3kiH81y.js","assets/volter-sdk-BKodmrby.js","assets/three-integration.service-BRF8px1l.js","assets/asset-preview-BEzZu4j-.js","assets/object3d-document-session-registry-Nly7qqyW.js","assets/live-mixers-B-bwLZ7c.js","assets/linear-resolve-Cuka7Ypb.js","assets/model-inspection-DAugZuDb.js","assets/standard-viewport-dressing-4szt4iVE.js","assets/OrbitControls-DrHRrSFA.js","assets/stage-overlay-set-B8PO_8GO.js","assets/ViewportShadingMenu-Dx1gY8Op.js","assets/stage-keyboard-CfcRPwij.js","assets/stage-presence-markers-CheQj0g2.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{jC as oh,jD as Kr,jE as $,jF as et,jG as fa,jH as ma,jI as ga,jJ as Qn,jK as ah,jL as ya,bc as lh,jM as Ke,cc as fs,v as st,as as Fi,jN as xn,cl as ch,jO as $n,gv as Vr,jP as _a,jQ as va,jR as wa,cd as xa,jS as hh,jT as dh,jU as uh,jV as ba,t as Ot,dm as Sa,jW as ph,jX as fh,iw as hi,g as wi,jY as mh,iq as Wl,jZ as gh,iC as yh,n as k,j_ as _h,j$ as Xl,j as E,k0 as vh,k1 as Ma,eE as Bi,ct as di,bO as Et,cv as wh,ju as xh,B as Ti,k2 as bh,jw as Sh,k3 as Mh,T as Ca,k4 as Pa,k5 as Aa,k6 as ql,k7 as Ch,aL as Ph,ji as za,cr as Ah,k8 as zh,k9 as Eh,ew as At,iN as Oh,ka as Th,kb as kh,kc as Rh,kd as Ih,ke as Lh,kf as Bh,kg as Fh,kh as Nh,ki as Hh,kj as Dh,kk as Vh,jf as Uh,a9 as Yl,a$ as jh,aY as Gh,kl as Wh,km as Xh,kn as Ea,ko as Oa,kp as Ta,Q as ka,kq as qh,iB as Yh,jj as Jh,ii as Ra,kr as Zh,gF as Qh,ir as Ia,ks as $h,kt as La,ku as Kh,kv as ed,kw as td,kx as id,dx as sd,ky as rd,kz as nd,jy as od,kA as Ba,iz as ad,kB as ld,kC as cd,eP as hd}from"./volter-sdk-BKodmrby.js";import{a as dd,b as mi,e as ud,v as Pr,f as pd,g as yo,C as Fa,h as fd,i as md,j as gd,k as yd,n as _d,d as vd,s as wd,o as xd,V as bd,p as Sd,q as Md,r as Jl,t as Cd,u as Na,w as Kn,x as Pd,y as Zl,z as Ad}from"./three-integration.service-BRF8px1l.js";import{g as Ee,s as Ze,E as K,F as at,G as eo,H as to,i as $s}from"./asset-preview-BEzZu4j-.js";import{v as zd,c as Ed,a as Od}from"./output-pass-j4dAGrPY.js";import{Y as _o,g as Tt,bP as Ql,Z as Td,ab as bn,j as O,p as $l,O as Rt,ap as io,am as Kl,bT as kd,V as v,Q as pe,ae as lt,l as Le,ag as $t,bY as ke,a4 as Se,B as It,h as _s,bZ as ui,bg as ot,b_ as ls,k as kt,E as ec,ac as vo,$ as Di,b$ as Rd,o as Id,f as je,bN as so,aV as wo,af as Vi,bh as tc,bO as Ld,X as St,a3 as xo,b8 as zt,c0 as Bd,bQ as Fd,I as Nd,J as Hd,P as Dd,v as ic,A as sc,a0 as Ui,ay as bo,m as U,c1 as Vd,c2 as Ud,c3 as Nr,b0 as rc,bS as jd,c4 as Gd,an as Ue,aQ as Wd,c5 as nt,S as vs,t as vt,az as Xd,a6 as qd,a7 as Yd,c6 as Jd,c7 as Zd,u as Be,c8 as So,r as Oe,c9 as nc,ax as Qd,aH as $d,aL as Kd,aN as eu,aK as oc,w as Mo,T as Ha,ca as tu,bU as Ie,aT as iu,cb as su,cc as ru,cd as nu,ce as ou,cf as au,cg as lu,n as wt,ch as Da,a_ as Co,L as ac,aW as lc,ci as Va,bW as cu,W as Sn,H as Mn,aX as hu,a5 as du,aw as uu,aa as Ua}from"./three.module-CtVjCPcj.js";import{s as pu,a as cc}from"./live-mixers-B-bwLZ7c.js";import{b as Ur,L as jr,a as Gr,r as fu}from"./linear-resolve-Cuka7Ypb.js";import{t as pi,s as mu,e as gu,o as yu,r as ja,g as Ga,h as _u}from"./object3d-document-session-registry-Nly7qqyW.js";import{a as ji,i as vu,c as wu,b as xu,d as bu,e as Su}from"./model-inspection-DAugZuDb.js";import{S as hc,a as Mu,w as Cu,c as Pu}from"./standard-viewport-dressing-4szt4iVE.js";import{O as Au}from"./OrbitControls-DrHRrSFA.js";class dc extends _o{previousMatrix=new Tt;updateMatrix(){const e=this.matrixWorldNeedsUpdate;this.previousMatrix.copy(this.matrix),super.updateMatrix(),!e&&this.previousMatrix.equals(this.matrix)&&(this.matrixWorldNeedsUpdate=!1)}}const uc=30;function pc(o,e,t){return o<e?e:o>t?t:o}function zu(o,e){const t=o.animations;if(t.length===0)return null;const i=new Ql(o);let s=t[0];if(!s)return null;const r=a=>{i.stopAllAction();const l=i.clipAction(a);l.paused=!1,l.play(),s=a};r(s);const n=e.attach({id:o.uuid,label:o.name||s.name||"Clip",range:()=>({start:0,end:s?.duration??0,fps:uc}),seek:a=>{i.setTime(pc(a,0,s?.duration??0))},clips:()=>t.map(a=>({id:a.name,label:a.name})),setClip:a=>{const l=t.find(c=>c.name===a);l&&r(l)}});return()=>{n(),i.stopAllAction(),i.uncacheRoot(o)}}function Eu(o,e){const t=cc(o);if(!t)return null;let i=t.clips.values().next().value;if(!i)return null;const s=n=>{t.mixer.stopAllAction();const a=t.mixer.clipAction(n);a.paused=!1,a.play(),i=n};return e.attach({id:o.uuid,label:o.name||i.name||"Animation",range:()=>({start:0,end:i?.duration??0,fps:uc}),seek:n=>{t.mixer.setTime(pc(n,0,i?.duration??0))},clips:()=>[...t.clips.entries()].map(([n,a])=>({id:n,label:a.name||n})),setClip:n=>{const a=t.clips.get(n);a&&s(a)}})}function Wa(o,e,t={}){const i=new Map,s=()=>{const a=new Set;(typeof o=="function"?o():o)?.traverse(c=>{if(i.has(c.uuid)){a.add(c.uuid);return}const h=Eu(c,e)??zu(c,e);h&&(i.set(c.uuid,h),a.add(c.uuid))});for(const[c,h]of[...i])a.has(c)||(h(),i.delete(c))};s();const r=t.rescanOnLiveMixers,n=r?pu(()=>{r()&&s()}):()=>{};return{refresh:s,dispose:()=>{n();for(const a of i.values())a();i.clear()}}}class Ou{sources=new Map;frame=0;count=0;bind(e){this.frame++;const t=e.renderBufferDirect,i=this;return e.renderBufferDirect=function(s,r,n,a,l,c){const h=r?.overrideMaterial===a?i.get(a,n,l):a;return t.call(this,s,r,n,h,l,c)},()=>{e.renderBufferDirect=t}}get(e,t,i){if(!(e instanceof Td)||e.transparent||e.map||e.alphaMap||e.displacementMap||e.clippingPlanes||e.onBeforeCompile!==bn.prototype.onBeforeCompile||e.customProgramCacheKey!==bn.prototype.customProgramCacheKey||e.onBeforeRender!==bn.prototype.onBeforeRender||!(i instanceof O)||i instanceof $l||Object.keys(t.morphAttributes).length||i.onAfterRender!==Rt.prototype.onAfterRender)return e;const s=i instanceof io,r=i instanceof Kl;if(i.onBeforeRender!==(s?io.prototype.onBeforeRender:Rt.prototype.onBeforeRender)||r&&(i.instanceColor||i.morphTexture)||s&&Reflect.get(i,"colorTexture")!==null)return e;const n=(s?1:r?2:0)+(e.vertexColors&&t.getAttribute("color")?.itemSize===4?4:0);let a=this.sources.get(e);if(!a){if(this.count>=32)return e;a=new Map,this.sources.set(e,a)}let l=a.get(n);if(l)l.frame!==this.frame&&(l.material.copy(e),l.version!==e.version&&(l.material.needsUpdate=!0),l.version=e.version,l.frame=this.frame);else{if(this.count>=32)return e;l={material:e.clone(),frame:this.frame,version:e.version},a.set(n,l),this.count++}return l.material}dispose(){for(const e of this.sources.values())for(const{material:t}of e.values())t.dispose();this.sources.clear(),this.count=0}}const ro=.1,no=1e3,Tu=2e4,ku=1.25;function Ru(o,e){const t=Number.isFinite(o)?Math.max(0,o):0,i=Number.isFinite(e)?Math.max(0,e):0,s=Math.max(no,(t+i)*ku);return{near:Math.max(ro,s/Tu),far:s}}function Wr(o){const e=Ee(o,"constraints");return Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"&&typeof t.getSnapshot=="function"&&!!t.config):[]}function ys(o){const e=Ee(o,"reflectionProbe");if(!e||typeof e!="object")return null;const t=e;return t.config&&typeof t.recapture=="function"&&typeof t.getSnapshot=="function"?e:null}function oo(o){const e=Ee(o,"triggerVolume");if(!e||typeof e!="object")return null;const{radius:t}=e;return typeof t=="number"&&Number.isFinite(t)&&t>0?{radius:t}:null}const li=new lt,Re=new v,qt=new v,_e=new pe,Xa={X:new v(1,0,0),Y:new v(0,1,0),Z:new v(0,0,1)},Cn={type:"change"},qa={type:"mouseDown",mode:null},Ya={type:"mouseUp",mode:null},Ja={type:"objectChange"};let Pn=class extends kd{constructor(e,t=null){super(void 0,t);const i=new Hu(this);this._root=i;const s=new Du;this._gizmo=s,i.add(s);const r=new Vu;this._plane=r,i.add(r);const n=this;function a(x,S){let C=S;Object.defineProperty(n,x,{get:function(){return C!==void 0?C:S},set:function(b){C!==b&&(C=b,r[x]=b,s[x]=b,n.dispatchEvent({type:x+"-changed",value:b}),n.dispatchEvent(Cn))}}),n[x]=S,r[x]=S,s[x]=S}a("camera",e),a("object",void 0),a("enabled",!0),a("axis",null),a("mode","translate"),a("translationSnap",null),a("rotationSnap",null),a("scaleSnap",null),a("space","world"),a("size",1),a("dragging",!1),a("showX",!0),a("showY",!0),a("showZ",!0),a("minX",-1/0),a("maxX",1/0),a("minY",-1/0),a("maxY",1/0),a("minZ",-1/0),a("maxZ",1/0);const l=new v,c=new v,h=new pe,d=new pe,p=new v,u=new pe,f=new v,m=new v,y=new v,_=0,w=new v;a("worldPosition",l),a("worldPositionStart",c),a("worldQuaternion",h),a("worldQuaternionStart",d),a("cameraPosition",p),a("cameraQuaternion",u),a("pointStart",f),a("pointEnd",m),a("rotationAxis",y),a("rotationAngle",_),a("eye",w),this._offset=new v,this._startNorm=new v,this._endNorm=new v,this._cameraScale=new v,this._parentPosition=new v,this._parentQuaternion=new pe,this._parentQuaternionInv=new pe,this._parentScale=new v,this._worldScaleStart=new v,this._worldQuaternionInv=new pe,this._worldScale=new v,this._positionStart=new v,this._quaternionStart=new pe,this._scaleStart=new v,this._getPointer=Iu.bind(this),this._onPointerDown=Bu.bind(this),this._onPointerHover=Lu.bind(this),this._onPointerMove=Fu.bind(this),this._onPointerUp=Nu.bind(this),t!==null&&this.connect(t)}connect(e){super.connect(e),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.domElement.style.touchAction="auto"}getHelper(){return this._root}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;e!==null&&li.setFromCamera(e,this.camera);const t=An(this._gizmo.picker[this.mode],li);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e!=null&&e.button!==0)&&this.axis!==null){e!==null&&li.setFromCamera(e,this.camera);const t=An(this._plane,li,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,qa.mode=this.mode,this.dispatchEvent(qa)}}pointerMove(e){const t=this.axis,i=this.mode,s=this.object;let r=this.space;if(i==="scale"?r="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(r="world"),s===void 0||t===null||this.dragging===!1||e!==null&&e.button!==-1)return;e!==null&&li.setFromCamera(e,this.camera);const n=An(this._plane,li,!0);if(n){if(this.pointEnd.copy(n.point).sub(this.worldPositionStart),i==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),r==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),r==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),s.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(r==="local"&&(s.position.applyQuaternion(_e.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.position.applyQuaternion(this._quaternionStart)),r==="world"&&(s.parent&&s.position.add(Re.setFromMatrixPosition(s.parent.matrixWorld)),t.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.parent&&s.position.sub(Re.setFromMatrixPosition(s.parent.matrixWorld)))),s.position.x=Math.max(this.minX,Math.min(this.maxX,s.position.x)),s.position.y=Math.max(this.minY,Math.min(this.maxY,s.position.y)),s.position.z=Math.max(this.minZ,Math.min(this.maxZ,s.position.z));else if(i==="scale"){if(t.search("XYZ")!==-1){let a=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(a*=-1),qt.set(a,a,a)}else Re.copy(this.pointStart),qt.copy(this.pointEnd),Re.applyQuaternion(this._worldQuaternionInv),qt.applyQuaternion(this._worldQuaternionInv),qt.divide(Re),t.search("X")===-1&&(qt.x=1),t.search("Y")===-1&&(qt.y=1),t.search("Z")===-1&&(qt.z=1);s.scale.copy(this._scaleStart).multiply(qt),this.scaleSnap&&(t.search("X")!==-1&&(s.scale.x=Math.round(s.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(s.scale.y=Math.round(s.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(s.scale.z=Math.round(s.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(i==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const a=20/this.worldPosition.distanceTo(Re.setFromMatrixPosition(this.camera.matrixWorld));let l=!1;t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Re.copy(this.rotationAxis).cross(this.eye))*a):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(Xa[t]),Re.copy(Xa[t]),r==="local"&&Re.applyQuaternion(this.worldQuaternion),Re.cross(this.eye),Re.length()===0?l=!0:this.rotationAngle=this._offset.dot(Re.normalize())*a),(t==="E"||l)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),r==="local"&&t!=="E"&&t!=="XYZE"?(s.quaternion.copy(this._quaternionStart),s.quaternion.multiply(_e.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),s.quaternion.copy(_e.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),s.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(Cn),this.dispatchEvent(Ja)}}pointerUp(e){e!==null&&e.button!==0||(this.dragging&&this.axis!==null&&(Ya.mode=this.mode,this.dispatchEvent(Ya)),this.dragging=!1,this.axis=null)}dispose(){this.disconnect(),this._root.dispose()}attach(e){return this.object=e,this._root.visible=!0,this}detach(){return this.object=void 0,this.axis=null,this._root.visible=!1,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(Cn),this.dispatchEvent(Ja),this.pointStart.copy(this.pointEnd))}getRaycaster(){return li}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}setColors(e,t,i,s){const r=this._gizmo.materialLib;r.xAxis.color.set(e),r.yAxis.color.set(t),r.zAxis.color.set(i),r.active.color.set(s),r.xAxisTransparent.color.set(e),r.yAxisTransparent.color.set(t),r.zAxisTransparent.color.set(i),r.activeTransparent.color.set(s),r.xAxis._color&&r.xAxis._color.set(e),r.yAxis._color&&r.yAxis._color.set(t),r.zAxis._color&&r.zAxis._color.set(i),r.active._color&&r.active._color.set(s),r.xAxisTransparent._color&&r.xAxisTransparent._color.set(e),r.yAxisTransparent._color&&r.yAxisTransparent._color.set(t),r.zAxisTransparent._color&&r.zAxisTransparent._color.set(i),r.activeTransparent._color&&r.activeTransparent._color.set(s)}};function Iu(o){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:o.button};{const e=this.domElement.getBoundingClientRect();return{x:(o.clientX-e.left)/e.width*2-1,y:-(o.clientY-e.top)/e.height*2+1,button:o.button}}}function Lu(o){if(this.enabled)switch(o.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(o));break}}function Bu(o){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(o.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(o)),this.pointerDown(this._getPointer(o)))}function Fu(o){this.enabled&&this.pointerMove(this._getPointer(o))}function Nu(o){this.enabled&&(this.domElement.releasePointerCapture(o.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(o)))}function An(o,e,t){const i=e.intersectObject(o,!0);for(let s=0;s<i.length;s++)if(i[s].object.visible||t)return i[s];return!1}const Ar=new ec,de=new v(0,1,0),Za=new v(0,0,0),Qa=new Tt,zr=new pe,Hr=new pe,gt=new v,$a=new Tt,ms=new v(1,0,0),ci=new v(0,1,0),gs=new v(0,0,1),Er=new v,cs=new v,hs=new v;class Hu extends Rt{constructor(e){super(),this.isTransformControlsRoot=!0,this.controls=e,this.visible=!1}updateMatrixWorld(e){const t=this.controls;t.object!==void 0&&(t.object.updateMatrixWorld(),t.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):t.object.parent.matrixWorld.decompose(t._parentPosition,t._parentQuaternion,t._parentScale),t.object.matrixWorld.decompose(t.worldPosition,t.worldQuaternion,t._worldScale),t._parentQuaternionInv.copy(t._parentQuaternion).invert(),t._worldQuaternionInv.copy(t.worldQuaternion).invert()),t.camera.updateMatrixWorld(),t.camera.matrixWorld.decompose(t.cameraPosition,t.cameraQuaternion,t._cameraScale),t.camera.isOrthographicCamera?t.camera.getWorldDirection(t.eye).negate():t.eye.copy(t.cameraPosition).sub(t.worldPosition).normalize(),super.updateMatrixWorld(e)}dispose(){this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}}class Du extends Rt{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const e=new Le({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new $t({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=e.clone();i.opacity=.15;const s=t.clone();s.opacity=.5;const r=e.clone();r.color.setHex(16711680);const n=e.clone();n.color.setHex(65280);const a=e.clone();a.color.setHex(255);const l=e.clone();l.color.setHex(16711680),l.opacity=.5;const c=e.clone();c.color.setHex(65280),c.opacity=.5;const h=e.clone();h.color.setHex(255),h.opacity=.5;const d=e.clone();d.opacity=.25;const p=e.clone();p.color.setHex(16776960),p.opacity=.25;const u=e.clone();u.color.setHex(16776960);const f=e.clone();f.color.setHex(7895160),this.materialLib={xAxis:r,yAxis:n,zAxis:a,active:u,xAxisTransparent:l,yAxisTransparent:c,zAxisTransparent:h,activeTransparent:p};const m=new ke(0,.04,.1,12);m.translate(0,.05,0);const y=new Se(.08,.08,.08);y.translate(0,.04,0);const _=new It;_.setAttribute("position",new _s([0,0,0,1,0,0],3));const w=new ke(.0075,.0075,.5,3);w.translate(0,.25,0);function x(X,ue){const j=new ls(X,.0075,3,64,ue*Math.PI*2);return j.rotateY(Math.PI/2),j.rotateX(Math.PI/2),j}function S(){const X=new It;return X.setAttribute("position",new _s([0,0,0,1,1,1],3)),X}const C={X:[[new O(m,r),[.5,0,0],[0,0,-Math.PI/2]],[new O(m,r),[-.5,0,0],[0,0,Math.PI/2]],[new O(w,r),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new O(m,n),[0,.5,0]],[new O(m,n),[0,-.5,0],[Math.PI,0,0]],[new O(w,n)]],Z:[[new O(m,a),[0,0,.5],[Math.PI/2,0,0]],[new O(m,a),[0,0,-.5],[-Math.PI/2,0,0]],[new O(w,a),null,[Math.PI/2,0,0]]],XYZ:[[new O(new ui(.1,0),d),[0,0,0]]],XY:[[new O(new Se(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new O(new Se(.15,.15,.01),l),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new O(new Se(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]]},b={X:[[new O(new ke(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new O(new ke(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new O(new ke(.2,0,.6,4),i),[0,.3,0]],[new O(new ke(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new O(new ke(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new O(new ke(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new O(new ui(.2,0),i)]],XY:[[new O(new Se(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new O(new Se(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new O(new Se(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]]},M={START:[[new O(new ui(.01,2),s),null,null,null,"helper"]],END:[[new O(new ui(.01,2),s),null,null,null,"helper"]],DELTA:[[new ot(S(),s),null,null,null,"helper"]],X:[[new ot(_,s),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new ot(_,s),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new ot(_,s),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},z={XYZE:[[new O(x(.5,1),f),null,[0,Math.PI/2,0]]],X:[[new O(x(.5,.5),r)]],Y:[[new O(x(.5,.5),n),null,[0,0,-Math.PI/2]]],Z:[[new O(x(.5,.5),a),null,[0,Math.PI/2,0]]],E:[[new O(x(.75,1),p),null,[0,Math.PI/2,0]]]},F={AXIS:[[new ot(_,s),[-1e3,0,0],null,[1e6,1,1],"helper"]]},R={XYZE:[[new O(new kt(.25,10,8),i)]],X:[[new O(new ls(.5,.1,4,24),i),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new O(new ls(.5,.1,4,24),i),[0,0,0],[Math.PI/2,0,0]]],Z:[[new O(new ls(.5,.1,4,24),i),[0,0,0],[0,0,-Math.PI/2]]],E:[[new O(new ls(.75,.1,2,24),i)]]},H={X:[[new O(y,r),[.5,0,0],[0,0,-Math.PI/2]],[new O(w,r),[0,0,0],[0,0,-Math.PI/2]],[new O(y,r),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new O(y,n),[0,.5,0]],[new O(w,n)],[new O(y,n),[0,-.5,0],[0,0,Math.PI]]],Z:[[new O(y,a),[0,0,.5],[Math.PI/2,0,0]],[new O(w,a),[0,0,0],[Math.PI/2,0,0]],[new O(y,a),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new O(new Se(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new O(new Se(.15,.15,.01),l),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new O(new Se(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new O(new Se(.1,.1,.1),d)]]},se={X:[[new O(new ke(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new O(new ke(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new O(new ke(.2,0,.6,4),i),[0,.3,0]],[new O(new ke(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new O(new ke(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new O(new ke(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new O(new Se(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new O(new Se(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new O(new Se(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new O(new Se(.2,.2,.2),i),[0,0,0]]]},ve={X:[[new ot(_,s),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new ot(_,s),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new ot(_,s),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function ee(X){const ue=new Rt;for(const j in X)for(let ne=X[j].length;ne--;){const G=X[j][ne][0].clone(),fe=X[j][ne][1],Y=X[j][ne][2],Me=X[j][ne][3],xe=X[j][ne][4];G.name=j,G.tag=xe,fe&&G.position.set(fe[0],fe[1],fe[2]),Y&&G.rotation.set(Y[0],Y[1],Y[2]),Me&&G.scale.set(Me[0],Me[1],Me[2]),G.updateMatrix();const Ce=G.geometry.clone();Ce.applyMatrix4(G.matrix),G.geometry=Ce,G.renderOrder=1/0,G.position.set(0,0,0),G.rotation.set(0,0,0),G.scale.set(1,1,1),ue.add(G)}return ue}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=ee(C)),this.add(this.gizmo.rotate=ee(z)),this.add(this.gizmo.scale=ee(H)),this.add(this.picker.translate=ee(b)),this.add(this.picker.rotate=ee(R)),this.add(this.picker.scale=ee(se)),this.add(this.helper.translate=ee(M)),this.add(this.helper.rotate=ee(F)),this.add(this.helper.scale=ee(ve)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){const i=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:Hr;this.gizmo.translate.visible=this.mode==="translate",this.gizmo.rotate.visible=this.mode==="rotate",this.gizmo.scale.visible=this.mode==="scale",this.helper.translate.visible=this.mode==="translate",this.helper.rotate.visible=this.mode==="rotate",this.helper.scale.visible=this.mode==="scale";let s=[];s=s.concat(this.picker[this.mode].children),s=s.concat(this.gizmo[this.mode].children),s=s.concat(this.helper[this.mode].children);for(let r=0;r<s.length;r++){const n=s[r];n.visible=!0,n.rotation.set(0,0,0),n.position.copy(this.worldPosition);let a;if(this.camera.isOrthographicCamera?a=(this.camera.top-this.camera.bottom)/this.camera.zoom:a=this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),n.scale.set(1,1,1).multiplyScalar(a*this.size/4),n.tag==="helper"){n.visible=!1,n.name==="AXIS"?(n.visible=!!this.axis,this.axis==="X"&&(_e.setFromEuler(Ar.set(0,0,0)),n.quaternion.copy(i).multiply(_e),Math.abs(de.copy(ms).applyQuaternion(i).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Y"&&(_e.setFromEuler(Ar.set(0,0,Math.PI/2)),n.quaternion.copy(i).multiply(_e),Math.abs(de.copy(ci).applyQuaternion(i).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Z"&&(_e.setFromEuler(Ar.set(0,Math.PI/2,0)),n.quaternion.copy(i).multiply(_e),Math.abs(de.copy(gs).applyQuaternion(i).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="XYZE"&&(_e.setFromEuler(Ar.set(0,Math.PI/2,0)),de.copy(this.rotationAxis),n.quaternion.setFromRotationMatrix(Qa.lookAt(Za,de,ci)),n.quaternion.multiply(_e),n.visible=this.dragging),this.axis==="E"&&(n.visible=!1)):n.name==="START"?(n.position.copy(this.worldPositionStart),n.visible=this.dragging):n.name==="END"?(n.position.copy(this.worldPosition),n.visible=this.dragging):n.name==="DELTA"?(n.position.copy(this.worldPositionStart),n.quaternion.copy(this.worldQuaternionStart),Re.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Re.applyQuaternion(this.worldQuaternionStart.clone().invert()),n.scale.copy(Re),n.visible=this.dragging):(n.quaternion.copy(i),this.dragging?n.position.copy(this.worldPositionStart):n.position.copy(this.worldPosition),this.axis&&(n.visible=this.axis.search(n.name)!==-1));continue}n.quaternion.copy(i),this.mode==="translate"||this.mode==="scale"?(n.name==="X"&&Math.abs(de.copy(ms).applyQuaternion(i).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Y"&&Math.abs(de.copy(ci).applyQuaternion(i).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Z"&&Math.abs(de.copy(gs).applyQuaternion(i).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XY"&&Math.abs(de.copy(gs).applyQuaternion(i).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="YZ"&&Math.abs(de.copy(ms).applyQuaternion(i).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XZ"&&Math.abs(de.copy(ci).applyQuaternion(i).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1)):this.mode==="rotate"&&(zr.copy(i),de.copy(this.eye).applyQuaternion(_e.copy(i).invert()),n.name.search("E")!==-1&&n.quaternion.setFromRotationMatrix(Qa.lookAt(this.eye,Za,ci)),n.name==="X"&&(_e.setFromAxisAngle(ms,Math.atan2(-de.y,de.z)),_e.multiplyQuaternions(zr,_e),n.quaternion.copy(_e)),n.name==="Y"&&(_e.setFromAxisAngle(ci,Math.atan2(de.x,de.z)),_e.multiplyQuaternions(zr,_e),n.quaternion.copy(_e)),n.name==="Z"&&(_e.setFromAxisAngle(gs,Math.atan2(de.y,de.x)),_e.multiplyQuaternions(zr,_e),n.quaternion.copy(_e))),n.visible=n.visible&&(n.name.indexOf("X")===-1||this.showX),n.visible=n.visible&&(n.name.indexOf("Y")===-1||this.showY),n.visible=n.visible&&(n.name.indexOf("Z")===-1||this.showZ),n.visible=n.visible&&(n.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),n.material._color=n.material._color||n.material.color.clone(),n.material._opacity=n.material._opacity||n.material.opacity,n.material.color.copy(n.material._color),n.material.opacity=n.material._opacity,this.enabled&&this.axis&&(n.name===this.axis?(n.material.color.copy(this.materialLib.active.color),n.material.opacity=1):this.axis.split("").some(function(l){return n.name===l})&&(n.material.color.copy(this.materialLib.active.color),n.material.opacity=1))}super.updateMatrixWorld(e)}}class Vu extends O{constructor(){super(new vo(1e5,1e5,2,2),new Le({visible:!1,wireframe:!0,side:Di,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),Er.copy(ms).applyQuaternion(t==="local"?this.worldQuaternion:Hr),cs.copy(ci).applyQuaternion(t==="local"?this.worldQuaternion:Hr),hs.copy(gs).applyQuaternion(t==="local"?this.worldQuaternion:Hr),de.copy(cs),this.mode){case"translate":case"scale":switch(this.axis){case"X":de.copy(this.eye).cross(Er),gt.copy(Er).cross(de);break;case"Y":de.copy(this.eye).cross(cs),gt.copy(cs).cross(de);break;case"Z":de.copy(this.eye).cross(hs),gt.copy(hs).cross(de);break;case"XY":gt.copy(hs);break;case"YZ":gt.copy(Er);break;case"XZ":de.copy(hs),gt.copy(cs);break;case"XYZ":case"E":gt.set(0,0,0);break}break;case"rotate":default:gt.set(0,0,0)}gt.length()===0?this.quaternion.copy(this.cameraQuaternion):($a.lookAt(Re.set(0,0,0),gt,de),this.quaternion.setFromRotationMatrix($a)),super.updateMatrixWorld(e)}}const Te=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Ka=1234567;const fc=Math.PI/180,mc=180/Math.PI;function Uu(){const o=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Te[o&255]+Te[o>>8&255]+Te[o>>16&255]+Te[o>>24&255]+"-"+Te[e&255]+Te[e>>8&255]+"-"+Te[e>>16&15|64]+Te[e>>24&255]+"-"+Te[t&63|128]+Te[t>>8&255]+"-"+Te[t>>16&255]+Te[t>>24&255]+Te[i&255]+Te[i>>8&255]+Te[i>>16&255]+Te[i>>24&255]).toLowerCase()}function xt(o,e,t){return Math.max(e,Math.min(t,o))}function gc(o,e){return(o%e+e)%e}function ju(o,e,t,i,s){return i+(o-e)*(s-i)/(t-e)}function Gu(o,e,t){return o!==e?(t-o)/(e-o):0}function yc(o,e,t){return(1-t)*o+t*e}function Wu(o,e,t,i){return yc(o,e,1-Math.exp(-t*i))}function Xu(o,e=1){return e-Math.abs(gc(o,e*2)-e)}function qu(o,e,t){return o<=e?0:o>=t?1:(o=(o-e)/(t-e),o*o*(3-2*o))}function Yu(o,e,t){return o<=e?0:o>=t?1:(o=(o-e)/(t-e),o*o*o*(o*(o*6-15)+10))}function Ju(o,e){return o+Math.floor(Math.random()*(e-o+1))}function Zu(o,e){return o+Math.random()*(e-o)}function Qu(o){return o*(.5-Math.random())}function $u(o){o!==void 0&&(Ka=o);let e=Ka+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Ku(o){return o*fc}function ep(o){return o*mc}function tp(o){return(o&o-1)===0&&o!==0}function ip(o){return Math.pow(2,Math.ceil(Math.log(o)/Math.LN2))}function sp(o){return Math.pow(2,Math.floor(Math.log(o)/Math.LN2))}function rp(o,e,t,i,s){const r=Math.cos,n=Math.sin,a=r(t/2),l=n(t/2),c=r((e+i)/2),h=n((e+i)/2),d=r((e-i)/2),p=n((e-i)/2),u=r((i-e)/2),f=n((i-e)/2);switch(s){case"XYX":o.set(a*h,l*d,l*p,a*c);break;case"YZY":o.set(l*p,a*h,l*d,a*c);break;case"ZXZ":o.set(l*d,l*p,a*h,a*c);break;case"XZX":o.set(a*h,l*f,l*u,a*c);break;case"YXY":o.set(l*u,a*h,l*f,a*c);break;case"ZYZ":o.set(l*f,l*u,a*h,a*c);break;default:console.warn("../math.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function np(o,e){switch(e.constructor){case Float32Array:return o;case Uint32Array:return o/4294967295;case Uint16Array:return o/65535;case Uint8Array:return o/255;case Int32Array:return Math.max(o/2147483647,-1);case Int16Array:return Math.max(o/32767,-1);case Int8Array:return Math.max(o/127,-1);default:throw new Error("Invalid component type.")}}function op(o,e){switch(e.constructor){case Float32Array:return o;case Uint32Array:return Math.round(o*4294967295);case Uint16Array:return Math.round(o*65535);case Uint8Array:return Math.round(o*255);case Int32Array:return Math.round(o*2147483647);case Int16Array:return Math.round(o*32767);case Int8Array:return Math.round(o*127);default:throw new Error("Invalid component type.")}}const Qi={DEG2RAD:fc,RAD2DEG:mc,generateUUID:Uu,clamp:xt,euclideanModulo:gc,mapLinear:ju,inverseLerp:Gu,lerp:yc,damp:Wu,pingpong:Xu,smoothstep:qu,smootherstep:Yu,randInt:Ju,randFloat:Zu,randFloatSpread:Qu,seededRandom:$u,degToRad:Ku,radToDeg:ep,isPowerOfTwo:tp,ceilPowerOfTwo:ip,floorPowerOfTwo:sp,setQuaternionFromProperEuler:rp,normalize:op,denormalize:np};class te{constructor(e=0,t=0,i=0,s=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=s}static slerpFlat(e,t,i,s,r,n,a){let l=i[s+0],c=i[s+1],h=i[s+2],d=i[s+3];const p=r[n+0],u=r[n+1],f=r[n+2],m=r[n+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d;return}if(a===1){e[t+0]=p,e[t+1]=u,e[t+2]=f,e[t+3]=m;return}if(d!==m||l!==p||c!==u||h!==f){let y=1-a;const _=l*p+c*u+h*f+d*m,w=_>=0?1:-1,x=1-_*_;if(x>Number.EPSILON){const C=Math.sqrt(x),b=Math.atan2(C,_*w);y=Math.sin(y*b)/C,a=Math.sin(a*b)/C}const S=a*w;if(l=l*y+p*S,c=c*y+u*S,h=h*y+f*S,d=d*y+m*S,y===1-a){const C=1/Math.sqrt(l*l+c*c+h*h+d*d);l*=C,c*=C,h*=C,d*=C}}e[t]=l,e[t+1]=c,e[t+2]=h,e[t+3]=d}static multiplyQuaternionsFlat(e,t,i,s,r,n){const a=i[s],l=i[s+1],c=i[s+2],h=i[s+3],d=r[n],p=r[n+1],u=r[n+2],f=r[n+3];return e[t]=a*f+h*d+l*u-c*p,e[t+1]=l*f+h*p+c*d-a*u,e[t+2]=c*f+h*u+a*p-l*d,e[t+3]=h*f-a*d-l*p-c*u,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,s){return this._x=e,this._y=t,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new te(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,s=e._y,r=e._z,n=e._order,a=Math.cos,l=Math.sin,c=a(i/2),h=a(s/2),d=a(r/2),p=l(i/2),u=l(s/2),f=l(r/2);switch(n){case"XYZ":this._x=p*h*d+c*u*f,this._y=c*u*d-p*h*f,this._z=c*h*f+p*u*d,this._w=c*h*d-p*u*f;break;case"YXZ":this._x=p*h*d+c*u*f,this._y=c*u*d-p*h*f,this._z=c*h*f-p*u*d,this._w=c*h*d+p*u*f;break;case"ZXY":this._x=p*h*d-c*u*f,this._y=c*u*d+p*h*f,this._z=c*h*f+p*u*d,this._w=c*h*d-p*u*f;break;case"ZYX":this._x=p*h*d-c*u*f,this._y=c*u*d+p*h*f,this._z=c*h*f-p*u*d,this._w=c*h*d+p*u*f;break;case"YZX":this._x=p*h*d+c*u*f,this._y=c*u*d+p*h*f,this._z=c*h*f-p*u*d,this._w=c*h*d-p*u*f;break;case"XZY":this._x=p*h*d-c*u*f,this._y=c*u*d-p*h*f,this._z=c*h*f+p*u*d,this._w=c*h*d+p*u*f;break;default:console.warn("../math.Quaternion: .setFromEuler() encountered an unknown order: "+n)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],s=t[4],r=t[8],n=t[1],a=t[5],l=t[9],c=t[2],h=t[6],d=t[10],p=i+a+d;if(p>0){const u=.5/Math.sqrt(p+1);this._w=.25/u,this._x=(h-l)*u,this._y=(r-c)*u,this._z=(n-s)*u}else if(i>a&&i>d){const u=2*Math.sqrt(1+i-a-d);this._w=(h-l)/u,this._x=.25*u,this._y=(s+n)/u,this._z=(r+c)/u}else if(a>d){const u=2*Math.sqrt(1+a-i-d);this._w=(r-c)/u,this._x=(s+n)/u,this._y=.25*u,this._z=(l+h)/u}else{const u=2*Math.sqrt(1+d-i-a);this._w=(n-s)/u,this._x=(r+c)/u,this._y=(l+h)/u,this._z=.25*u}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(xt(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,t/i);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,s=e._y,r=e._z,n=e._w,a=t._x,l=t._y,c=t._z,h=t._w;return this._x=i*h+n*a+s*c-r*l,this._y=s*h+n*l+r*a-i*c,this._z=r*h+n*c+i*l-s*a,this._w=n*h-i*a-s*l-r*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,s=this._y,r=this._z,n=this._w;let a=n*e._w+i*e._x+s*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=n,this._x=i,this._y=s,this._z=r,this;const l=1-a*a;if(l<=Number.EPSILON){const u=1-t;return this._w=u*n+t*this._w,this._x=u*i+t*this._x,this._y=u*s+t*this._y,this._z=u*r+t*this._z,this.normalize(),this}const c=Math.sqrt(l),h=Math.atan2(c,a),d=Math.sin((1-t)*h)/c,p=Math.sin(t*h)/c;return this._w=n*d+this._w*p,this._x=i*d+this._x*p,this._y=s*d+this._y*p,this._z=r*d+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),s=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(s*Math.sin(e),s*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class N{constructor(e=0,t=0,i=0){this.isVector3=!0,N.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new N(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(el.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(el.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*s,this.y=r[1]*t+r[4]*i+r[7]*s,this.z=r[2]*t+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=e.elements,n=1/(r[3]*t+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*s+r[12])*n,this.y=(r[1]*t+r[5]*i+r[9]*s+r[13])*n,this.z=(r[2]*t+r[6]*i+r[10]*s+r[14])*n,this}applyQuaternion(e){const t=this.x,i=this.y,s=this.z,r=e.x,n=e.y,a=e.z,l=e.w,c=2*(n*s-a*i),h=2*(a*t-r*s),d=2*(r*i-n*t);return this.x=t+l*c+n*d-a*h,this.y=i+l*h+a*c-r*d,this.z=s+l*d+r*h-n*c,this}transformDirection(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*s,this.y=r[1]*t+r[5]*i+r[9]*s,this.z=r[2]*t+r[6]*i+r[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,s=e.y,r=e.z,n=t.x,a=t.y,l=t.z;return this.x=s*l-r*a,this.y=r*n-i*l,this.z=i*a-s*n,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return zn.copy(this).projectOnVector(e),this.sub(zn)}reflect(e){return this.sub(zn.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(xt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return t*t+i*i+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSphericalCoords(e,t,i){const s=Math.sin(t)*e;return this.x=s*Math.sin(i),this.y=Math.cos(t)*e,this.z=s*Math.cos(i),this}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}abs(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const zn=new N,el=new te,Or=2e3,tl=2001;class ht{constructor(e,t,i,s,r,n,a,l,c,h,d,p,u,f,m,y){this.isMatrix4=!0,ht.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,s,r,n,a,l,c,h,d,p,u,f,m,y)}extractPosition(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)}multiplyToArray(e,t,i){return console.error("THREE.Matrix4: .multiplyToArray() has been removed."),this}setRotationFromQuaternion(e){return this.makeRotationFromQuaternion(e)}set(e,t,i,s,r,n,a,l,c,h,d,p,u,f,m,y){const _=this.elements;return _[0]=e,_[4]=t,_[8]=i,_[12]=s,_[1]=r,_[5]=n,_[9]=a,_[13]=l,_[2]=c,_[6]=h,_[10]=d,_[14]=p,_[3]=u,_[7]=f,_[11]=m,_[15]=y,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ht().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,s=1/ki.setFromMatrixColumn(e,0).length(),r=1/ki.setFromMatrixColumn(e,1).length(),n=1/ki.setFromMatrixColumn(e,2).length();return t[0]=i[0]*s,t[1]=i[1]*s,t[2]=i[2]*s,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*n,t[9]=i[9]*n,t[10]=i[10]*n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,s=e.y,r=e.z,n=Math.cos(i),a=Math.sin(i),l=Math.cos(s),c=Math.sin(s),h=Math.cos(r),d=Math.sin(r);if(e.order==="XYZ"){const p=n*h,u=n*d,f=a*h,m=a*d;t[0]=l*h,t[4]=-l*d,t[8]=c,t[1]=u+f*c,t[5]=p-m*c,t[9]=-a*l,t[2]=m-p*c,t[6]=f+u*c,t[10]=n*l}else if(e.order==="YXZ"){const p=l*h,u=l*d,f=c*h,m=c*d;t[0]=p+m*a,t[4]=f*a-u,t[8]=n*c,t[1]=n*d,t[5]=n*h,t[9]=-a,t[2]=u*a-f,t[6]=m+p*a,t[10]=n*l}else if(e.order==="ZXY"){const p=l*h,u=l*d,f=c*h,m=c*d;t[0]=p-m*a,t[4]=-n*d,t[8]=f+u*a,t[1]=u+f*a,t[5]=n*h,t[9]=m-p*a,t[2]=-n*c,t[6]=a,t[10]=n*l}else if(e.order==="ZYX"){const p=n*h,u=n*d,f=a*h,m=a*d;t[0]=l*h,t[4]=f*c-u,t[8]=p*c+m,t[1]=l*d,t[5]=m*c+p,t[9]=u*c-f,t[2]=-c,t[6]=a*l,t[10]=n*l}else if(e.order==="YZX"){const p=n*l,u=n*c,f=a*l,m=a*c;t[0]=l*h,t[4]=m-p*d,t[8]=f*d+u,t[1]=d,t[5]=n*h,t[9]=-a*h,t[2]=-c*h,t[6]=u*d+f,t[10]=p-m*d}else if(e.order==="XZY"){const p=n*l,u=n*c,f=a*l,m=a*c;t[0]=l*h,t[4]=-d,t[8]=c*h,t[1]=p*d+m,t[5]=n*h,t[9]=u*d-f,t[2]=f*d-u,t[6]=a*h,t[10]=m*d+p}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(ap,e,lp)}lookAt(e,t,i){const s=this.elements;return Je.subVectors(e,t),Je.lengthSq()===0&&(Je.z=1),Je.normalize(),Yt.crossVectors(i,Je),Yt.lengthSq()===0&&(Math.abs(i.z)===1?Je.x+=1e-4:Je.z+=1e-4,Je.normalize(),Yt.crossVectors(i,Je)),Yt.normalize(),Tr.crossVectors(Je,Yt),s[0]=Yt.x,s[4]=Tr.x,s[8]=Je.x,s[1]=Yt.y,s[5]=Tr.y,s[9]=Je.y,s[2]=Yt.z,s[6]=Tr.z,s[10]=Je.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,n=i[0],a=i[4],l=i[8],c=i[12],h=i[1],d=i[5],p=i[9],u=i[13],f=i[2],m=i[6],y=i[10],_=i[14],w=i[3],x=i[7],S=i[11],C=i[15],b=s[0],M=s[4],z=s[8],F=s[12],R=s[1],H=s[5],se=s[9],ve=s[13],ee=s[2],X=s[6],ue=s[10],j=s[14],ne=s[3],G=s[7],fe=s[11],Y=s[15];return r[0]=n*b+a*R+l*ee+c*ne,r[4]=n*M+a*H+l*X+c*G,r[8]=n*z+a*se+l*ue+c*fe,r[12]=n*F+a*ve+l*j+c*Y,r[1]=h*b+d*R+p*ee+u*ne,r[5]=h*M+d*H+p*X+u*G,r[9]=h*z+d*se+p*ue+u*fe,r[13]=h*F+d*ve+p*j+u*Y,r[2]=f*b+m*R+y*ee+_*ne,r[6]=f*M+m*H+y*X+_*G,r[10]=f*z+m*se+y*ue+_*fe,r[14]=f*F+m*ve+y*j+_*Y,r[3]=w*b+x*R+S*ee+C*ne,r[7]=w*M+x*H+S*X+C*G,r[11]=w*z+x*se+S*ue+C*fe,r[15]=w*F+x*ve+S*j+C*Y,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],s=e[8],r=e[12],n=e[1],a=e[5],l=e[9],c=e[13],h=e[2],d=e[6],p=e[10],u=e[14],f=e[3],m=e[7],y=e[11],_=e[15];return f*(+r*l*d-s*c*d-r*a*p+i*c*p+s*a*u-i*l*u)+m*(+t*l*u-t*c*p+r*n*p-s*n*u+s*c*h-r*l*h)+y*(+t*c*d-t*a*u-r*n*d+i*n*u+r*a*h-i*c*h)+_*(-s*a*h-t*l*d+t*a*p+s*n*d-i*n*p+i*l*h)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],n=e[4],a=e[5],l=e[6],c=e[7],h=e[8],d=e[9],p=e[10],u=e[11],f=e[12],m=e[13],y=e[14],_=e[15],w=d*y*c-m*p*c+m*l*u-a*y*u-d*l*_+a*p*_,x=f*p*c-h*y*c-f*l*u+n*y*u+h*l*_-n*p*_,S=h*m*c-f*d*c+f*a*u-n*m*u-h*a*_+n*d*_,C=f*d*l-h*m*l-f*a*p+n*m*p+h*a*y-n*d*y,b=t*w+i*x+s*S+r*C;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const M=1/b;return e[0]=w*M,e[1]=(m*p*r-d*y*r-m*s*u+i*y*u+d*s*_-i*p*_)*M,e[2]=(a*y*r-m*l*r+m*s*c-i*y*c-a*s*_+i*l*_)*M,e[3]=(d*l*r-a*p*r-d*s*c+i*p*c+a*s*u-i*l*u)*M,e[4]=x*M,e[5]=(h*y*r-f*p*r+f*s*u-t*y*u-h*s*_+t*p*_)*M,e[6]=(f*l*r-n*y*r-f*s*c+t*y*c+n*s*_-t*l*_)*M,e[7]=(n*p*r-h*l*r+h*s*c-t*p*c-n*s*u+t*l*u)*M,e[8]=S*M,e[9]=(f*d*r-h*m*r-f*i*u+t*m*u+h*i*_-t*d*_)*M,e[10]=(n*m*r-f*a*r+f*i*c-t*m*c-n*i*_+t*a*_)*M,e[11]=(h*a*r-n*d*r-h*i*c+t*d*c+n*i*u-t*a*u)*M,e[12]=C*M,e[13]=(h*m*s-f*d*s+f*i*p-t*m*p-h*i*y+t*d*y)*M,e[14]=(f*a*s-n*m*s-f*i*l+t*m*l+n*i*y-t*a*y)*M,e[15]=(n*d*s-h*a*s+h*i*l-t*d*l-n*i*p+t*a*p)*M,this}scale(e){const t=this.elements,i=e.x,s=e.y,r=e.z;return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,s))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),s=Math.sin(t),r=1-i,n=e.x,a=e.y,l=e.z,c=r*n,h=r*a;return this.set(c*n+i,c*a-s*l,c*l+s*a,0,c*a+s*l,h*a+i,h*l-s*n,0,c*l-s*a,h*l+s*n,r*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,s,r,n){return this.set(1,i,r,0,e,1,n,0,t,s,1,0,0,0,0,1),this}compose(e,t,i){const s=this.elements,r=t._x,n=t._y,a=t._z,l=t._w,c=r+r,h=n+n,d=a+a,p=r*c,u=r*h,f=r*d,m=n*h,y=n*d,_=a*d,w=l*c,x=l*h,S=l*d,C=i.x,b=i.y,M=i.z;return s[0]=(1-(m+_))*C,s[1]=(u+S)*C,s[2]=(f-x)*C,s[3]=0,s[4]=(u-S)*b,s[5]=(1-(p+_))*b,s[6]=(y+w)*b,s[7]=0,s[8]=(f+x)*M,s[9]=(y-w)*M,s[10]=(1-(p+m))*M,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,i){const s=this.elements;let r=ki.set(s[0],s[1],s[2]).length();const n=ki.set(s[4],s[5],s[6]).length(),a=ki.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],rt.copy(this);const c=1/r,h=1/n,d=1/a;return rt.elements[0]*=c,rt.elements[1]*=c,rt.elements[2]*=c,rt.elements[4]*=h,rt.elements[5]*=h,rt.elements[6]*=h,rt.elements[8]*=d,rt.elements[9]*=d,rt.elements[10]*=d,t.setFromRotationMatrix(rt),i.x=r,i.y=n,i.z=a,this}makePerspective(e,t,i,s,r,n,a=Or){const l=this.elements,c=2*r/(t-e),h=2*r/(i-s),d=(t+e)/(t-e),p=(i+s)/(i-s);let u,f;if(a===Or)u=-(n+r)/(n-r),f=-2*n*r/(n-r);else if(a===tl)u=-n/(n-r),f=-n*r/(n-r);else throw new Error("Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=h,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=u,l[14]=f,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,s,r,n,a=Or){const l=this.elements,c=1/(t-e),h=1/(i-s),d=1/(n-r),p=(t+e)*c,u=(i+s)*h;let f,m;if(a===Or)f=(n+r)*d,m=-2*d;else if(a===tl)f=r*d,m=-1*d;else throw new Error("../math.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-p,l[1]=0,l[5]=2*h,l[9]=0,l[13]=-u,l[2]=0,l[6]=0,l[10]=m,l[14]=-f,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<16;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const ki=new N,rt=new ht,ap=new N(0,0,0),lp=new N(1,1,1),Yt=new N,Tr=new N,Je=new N,il=new ht,sl=new te;class ws{constructor(e=0,t=0,i=0,s=ws.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,s=this._order){return this._x=e,this._y=t,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new ws(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const s=e.elements,r=s[0],n=s[4],a=s[8],l=s[1],c=s[5],h=s[9],d=s[2],p=s[6],u=s[10];switch(t){case"XYZ":this._y=Math.asin(xt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,u),this._z=Math.atan2(-n,r)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-xt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,u),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,r),this._z=0);break;case"ZXY":this._x=Math.asin(xt(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-d,u),this._z=Math.atan2(-n,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-xt(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(p,u),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-n,c));break;case"YZX":this._z=Math.asin(xt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,c),this._y=Math.atan2(-d,r)):(this._x=0,this._y=Math.atan2(a,u));break;case"XZY":this._z=Math.asin(-xt(n,-1,1)),Math.abs(n)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-h,u),this._y=0);break;default:console.warn("../math.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return il.makeRotationFromQuaternion(e),this.setFromRotationMatrix(il,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return sl.setFromEuler(this),this.setFromQuaternion(sl,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(e){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}ws.DEFAULT_ORDER="XYZ";class Gi{constructor(e=0,t=0){this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new Gi(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6],this.y=s[1]*t+s[4]*i+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(xt(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}rotateAround(e,t){const i=Math.cos(t),s=Math.sin(t),r=this.x-e.x,n=this.y-e.y;return this.x=r*i-n*s+e.x,this.y=r*s+n*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}Gi.isVector2=!0;class Qe{constructor(e=0,t=0,i=0,s=1){Qe.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,s){return this.x=e,this.y=t,this.z=i,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new Qe(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=this.w,n=e.elements;return this.x=n[0]*t+n[4]*i+n[8]*s+n[12]*r,this.y=n[1]*t+n[5]*i+n[9]*s+n[13]*r,this.z=n[2]*t+n[6]*i+n[10]*s+n[14]*r,this.w=n[3]*t+n[7]*i+n[11]*s+n[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,s,r;const l=e.elements,c=l[0],h=l[4],d=l[8],p=l[1],u=l[5],f=l[9],m=l[2],y=l[6],_=l[10];if(Math.abs(h-p)<.01&&Math.abs(d-m)<.01&&Math.abs(f-y)<.01){if(Math.abs(h+p)<.1&&Math.abs(d+m)<.1&&Math.abs(f+y)<.1&&Math.abs(c+u+_-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(c+1)/2,S=(u+1)/2,C=(_+1)/2,b=(h+p)/4,M=(d+m)/4,z=(f+y)/4;return x>S&&x>C?x<.01?(i=0,s=.707106781,r=.707106781):(i=Math.sqrt(x),s=b/i,r=M/i):S>C?S<.01?(i=.707106781,s=0,r=.707106781):(s=Math.sqrt(S),i=b/s,r=z/s):C<.01?(i=.707106781,s=.707106781,r=0):(r=Math.sqrt(C),i=M/r,s=z/r),this.set(i,s,r,t),this}let w=Math.sqrt((y-f)*(y-f)+(d-m)*(d-m)+(p-h)*(p-h));return Math.abs(w)<.001&&(w=1),this.x=(y-f)/w,this.y=(d-m)/w,this.z=(p-h)/w,this.w=Math.acos((c+u+_-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Mt{constructor(e,t,i,s,r,n,a,l,c){Mt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,s,r,n,a,l,c)}set(e,t,i,s,r,n,a,l,c){const h=this.elements;return h[0]=e,h[1]=s,h[2]=a,h[3]=t,h[4]=r,h[5]=l,h[6]=i,h[7]=n,h[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,n=i[0],a=i[3],l=i[6],c=i[1],h=i[4],d=i[7],p=i[2],u=i[5],f=i[8],m=s[0],y=s[3],_=s[6],w=s[1],x=s[4],S=s[7],C=s[2],b=s[5],M=s[8];return r[0]=n*m+a*w+l*C,r[3]=n*y+a*x+l*b,r[6]=n*_+a*S+l*M,r[1]=c*m+h*w+d*C,r[4]=c*y+h*x+d*b,r[7]=c*_+h*S+d*M,r[2]=p*m+u*w+f*C,r[5]=p*y+u*x+f*b,r[8]=p*_+u*S+f*M,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],n=e[4],a=e[5],l=e[6],c=e[7],h=e[8];return t*n*h-t*a*c-i*r*h+i*a*l+s*r*c-s*n*l}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],n=e[4],a=e[5],l=e[6],c=e[7],h=e[8],d=h*n-a*c,p=a*l-h*r,u=c*r-n*l,f=t*d+i*p+s*u;if(f===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/f;return e[0]=d*m,e[1]=(s*c-h*i)*m,e[2]=(a*i-s*n)*m,e[3]=p*m,e[4]=(h*t-s*l)*m,e[5]=(s*r-a*t)*m,e[6]=u*m,e[7]=(i*l-c*t)*m,e[8]=(n*t-i*r)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,s,r,n,a){const l=Math.cos(r),c=Math.sin(r);return this.set(i*l,i*c,-i*(l*n+c*a)+n+e,-s*c,s*l,-s*(-c*n+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(En.makeScale(e,t)),this}rotate(e){return this.premultiply(En.makeRotation(-e)),this}translate(e,t){return this.premultiply(En.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<9;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new Mt().fromArray(this.elements)}}const En=new Mt;var Fe;(function(o){o[o.Random=0]="Random",o[o.Loop=1]="Loop",o[o.PingPong=2]="PingPong",o[o.Burst=3]="Burst"})(Fe||(Fe={}));function $i(o,e,t,i){let s;switch(Fe.Random===o?e=Math.random():Fe.Burst===o&&i.isBursting&&(e=i.burstParticleIndex/i.burstParticleCount),t>0?s=Math.floor(e/t)*t:s=e,o){case Fe.Loop:s=s%1;break;case Fe.PingPong:s=Math.abs(s%2-1);break}return s}class fi{constructor(e,t,i,s){this.p=[e,t,i,s]}genValue(e){const t=e*e,i=e*e*e,s=1-e,r=s*s,n=r*s;return this.p[0]*n+this.p[1]*r*e*3+this.p[2]*s*t*3+this.p[3]*i}derivativeCoefficients(e){const t=[];for(let i=e,s=i.length-1;s>0;s--){const r=[];for(let n=0;n<s;n++){const a=s*(i[n+1]-i[n]);r.push(a)}t.push(r),i=r}return t}getSlope(e){const t=this.derivativeCoefficients(this.p)[0],i=1-e,s=i*i,r=i*e*2,n=e*e;return s*t[0]+r*t[1]+n*t[2]}controlCurve(e,t){this.p[1]=e/3+this.p[0],this.p[2]=this.p[3]-t/3}hull(e){let t=this.p,i=[],s,r=0,n=0,a=0;const l=[];for(l[r++]=t[0],l[r++]=t[1],l[r++]=t[2],l[r++]=t[3];t.length>1;){for(i=[],n=0,a=t.length-1;n<a;n++)s=e*t[n]+(1-e)*t[n+1],l[r++]=s,i.push(s);t=i}return l}split(e){const t=this.hull(e);return{left:new fi(t[0],t[4],t[7],t[9]),right:new fi(t[9],t[8],t[6],t[3]),span:t}}clone(){return new fi(this.p[0],this.p[1],this.p[2],this.p[3])}toJSON(){return{p0:this.p[0],p1:this.p[1],p2:this.p[2],p3:this.p[3]}}static fromJSON(e){return new fi(e.p0,e.p1,e.p2,e.p3)}}const xs=o=>({r:o.x,g:o.y,b:o.z,a:o.w}),bs=o=>new Qe(o.r,o.g,o.b,o.a),cp=(o,e)=>{switch(e){case"Vector3":return new N(o.x,o.y,o.z);case"Vector4":return new Qe(o.x,o.y,o.z,o.w);case"Color":return new N(o.r,o.g,o.b);case"Number":return o;default:return o}},hp=(o,e)=>{switch(e){case"Vector3":return{x:o.x,y:o.y,z:o.z};case"Vector4":return{x:o.x,y:o.y,z:o.z,w:o.w};case"Color":return{r:o.x,g:o.y,b:o.z};case"Number":return o;default:return o}};class Xr{constructor(e,t){this.a=e,this.b=t,this.type="value"}startGen(e){}genColor(e,t){const i=Math.random();return t.copy(this.a).lerp(this.b,i)}toJSON(){return{type:"RandomColor",a:xs(this.a),b:xs(this.b)}}static fromJSON(e){return new Xr(bs(e.a),bs(e.b))}clone(){return new Xr(this.a.clone(),this.b.clone())}}class Wi{constructor(e,t){this.a=e,this.b=t,this.indexCount=-1,this.type="value"}startGen(e){this.indexCount=e.length,e.push(Math.random())}genColor(e,t){return this.indexCount===-1&&this.startGen(e),t.copy(this.a).lerp(this.b,e[this.indexCount])}toJSON(){return{type:"ColorRange",a:xs(this.a),b:xs(this.b)}}static fromJSON(e){return new Wi(bs(e.a),bs(e.b))}clone(){return new Wi(this.a.clone(),this.b.clone())}}class Qt{constructor(e,t){this.subType=t,this.type="function",this.keys=e}findKey(e){let t=0,i=0,s=this.keys.length-1;for(;i+1<s;)if(t=Math.floor((i+s)/2),e<this.getStartX(t))s=t-1;else if(e>this.getEndX(t))i=t+1;else return t;for(let r=i;r<=s;r++)if(e>=this.getStartX(r)&&e<=this.getEndX(r))return r;return-1}getStartX(e){return this.keys[e][1]}getEndX(e){return e+1<this.keys.length?this.keys[e+1][1]:1}genValue(e,t){const i=this.findKey(t);return this.subType==="Number"?i===-1?this.keys[0][0]:i+1>=this.keys.length?this.keys[this.keys.length-1][0]:(this.keys[i+1][0]-this.keys[i][0])*((t-this.getStartX(i))/(this.getEndX(i)-this.getStartX(i)))+this.keys[i][0]:i===-1?e.copy(this.keys[0][0]):i+1>=this.keys.length?e.copy(this.keys[this.keys.length-1][0]):e.copy(this.keys[i][0]).lerp(this.keys[i+1][0],(t-this.getStartX(i))/(this.getEndX(i)-this.getStartX(i)))}toJSON(){return this.keys[0][0].constructor.name,{type:"CLinearFunction",subType:this.subType,keys:this.keys.map(([e,t])=>({value:hp(e,this.subType),pos:t}))}}static fromJSON(e){return new Qt(e.keys.map(t=>[cp(t.value,e.subType),t.pos]),e.subType)}clone(){return this.subType==="Number"?new Qt(this.keys.map(([e,t])=>[e,t]),this.subType):new Qt(this.keys.map(([e,t])=>[e.clone(),t]),this.subType)}}const kr=new N;class gi{constructor(e=[[new N(0,0,0),0],[new N(1,1,1),0]],t=[[1,0],[1,1]]){this.type="function",this.color=new Qt(e,"Color"),this.alpha=new Qt(t,"Number")}genColor(e,t,i){return this.color.genValue(kr,i),t.set(kr.x,kr.y,kr.z,this.alpha.genValue(1,i))}toJSON(){return{type:"Gradient",color:this.color.toJSON(),alpha:this.alpha.toJSON()}}static fromJSON(e){if(e.functions){const t=e.functions.map(i=>[Wi.fromJSON(i.function).a,i.start]);return e.functions.length>0&&t.push([Wi.fromJSON(e.functions[e.functions.length-1].function).b,1]),new gi(t.map(i=>[new N(i[0].x,i[0].y,i[0].z),i[1]]),t.map(i=>[i[0].w,i[1]]))}else{const t=new gi;return t.alpha=Qt.fromJSON(e.alpha),t.color=Qt.fromJSON(e.color),t}}clone(){const e=new gi;return e.alpha=this.alpha.clone(),e.color=this.color.clone(),e}startGen(e){}}const On=new Qe;class qr{constructor(e,t){this.indexCount=0,this.type="function",this.gradient1=e,this.gradient2=t}startGen(e){this.indexCount=e.length,e.push(Math.random())}genColor(e,t,i){return this.gradient1.genColor(e,t,i),this.gradient2.genColor(e,On,i),e&&e[this.indexCount]!==void 0?t.lerp(On,e[this.indexCount]):t.lerp(On,Math.random()),t}toJSON(){return{type:"RandomColorBetweenGradient",gradient1:this.gradient1.toJSON(),gradient2:this.gradient2.toJSON()}}static fromJSON(e){return new qr(gi.fromJSON(e.gradient1),gi.fromJSON(e.gradient2))}clone(){return new qr(this.gradient1.clone(),this.gradient2.clone())}}class Xi{constructor(e){this.color=e,this.type="value"}startGen(e){}genColor(e,t){return t.copy(this.color)}toJSON(){return{type:"ConstantColor",color:xs(this.color)}}static fromJSON(e){return new Xi(bs(e.color))}clone(){return new Xi(this.color.clone())}}function Po(o){switch(o.type){case"ConstantColor":return Xi.fromJSON(o);case"ColorRange":return Wi.fromJSON(o);case"RandomColor":return Xr.fromJSON(o);case"Gradient":return gi.fromJSON(o);case"RandomColorBetweenGradient":return qr.fromJSON(o);default:return new Xi(new Qe(1,1,1,1))}}class ie{constructor(e){this.value=e,this.type="value"}startGen(e){}genValue(e){return this.value}toJSON(){return{type:"ConstantValue",value:this.value}}static fromJSON(e){return new ie(e.value)}clone(){return new ie(this.value)}}class _i{constructor(e,t){this.a=e,this.b=t,this.indexCount=-1,this.type="value"}startGen(e){this.indexCount=e.length,e.push(Math.random())}genValue(e){return this.indexCount===-1&&this.startGen(e),Qi.lerp(this.a,this.b,e[this.indexCount])}toJSON(){return{type:"IntervalValue",a:this.a,b:this.b}}static fromJSON(e){return new _i(e.a,e.b)}clone(){return new _i(this.a,this.b)}}class dp{constructor(){this.functions=new Array}findFunction(e){let t=0,i=0,s=this.functions.length-1;for(;i+1<s;)if(t=Math.floor((i+s)/2),e<this.getStartX(t))s=t-1;else if(e>this.getEndX(t))i=t+1;else return t;for(let r=i;r<=s;r++)if(e>=this.functions[r][1]&&e<=this.getEndX(r))return r;return-1}getStartX(e){return this.functions[e][1]}setStartX(e,t){e>0&&(this.functions[e][1]=t)}getEndX(e){return e+1<this.functions.length?this.functions[e+1][1]:1}setEndX(e,t){e+1<this.functions.length&&(this.functions[e+1][1]=t)}insertFunction(e,t){const i=this.findFunction(e);this.functions.splice(i+1,0,[t,e])}removeFunction(e){return this.functions.splice(e,1)[0][0]}getFunction(e){return this.functions[e][0]}setFunction(e,t){this.functions[e][0]=t}get numOfFunctions(){return this.functions.length}}class Ss extends dp{constructor(e=[[new fi(0,1/3,1/3*2,1),0]]){super(),this.type="function",this.functions=e}genValue(e,t=0){const i=this.findFunction(t);return i===-1?0:this.functions[i][0].genValue((t-this.getStartX(i))/(this.getEndX(i)-this.getStartX(i)))}toSVG(e,t){if(t<1)return"";let i=["M",0,this.functions[0][0].p[0]].join(" ");for(let s=1/t;s<=1;s+=1/t)i=[i,"L",s*e,this.genValue(void 0,s)].join(" ");return i}toJSON(){return{type:"PiecewiseBezier",functions:this.functions.map(([e,t])=>({function:e.toJSON(),start:t}))}}static fromJSON(e){return new Ss(e.functions.map(t=>[fi.fromJSON(t.function),t.start]))}clone(){return new Ss(this.functions.map(([e,t])=>[e.clone(),t]))}startGen(e){}}function q(o){switch(o.type){case"ConstantValue":return ie.fromJSON(o);case"IntervalValue":return _i.fromJSON(o);case"PiecewiseBezier":return Ss.fromJSON(o);default:return new ie(0)}}class Ms{constructor(){this.indexCount=0,this.type="rotation"}startGen(e){this.indexCount=e.length,e.push(new te);let t,i,s,r,n,a;do t=Math.random()*2-1,i=Math.random()*2-1,s=t*t+i*i;while(s>1);do r=Math.random()*2-1,n=Math.random()*2-1,a=r*r+n*n;while(a>1);const l=Math.sqrt((1-s)/a);e[this.indexCount].set(t,i,l*r,l*n)}genValue(e,t,i,s){return this.indexCount===-1&&this.startGen(e),t.copy(e[this.indexCount]),t}toJSON(){return{type:"RandomQuat"}}static fromJSON(e){return new Ms}clone(){return new Ms}}class Cs{constructor(e,t){this.axis=e,this.angle=t,this.type="rotation"}startGen(e){this.angle.startGen(e)}genValue(e,t,i,s){return t.setFromAxisAngle(this.axis,this.angle.genValue(e,s)*i)}toJSON(){return{type:"AxisAngle",axis:{x:this.axis.x,y:this.axis.y,z:this.axis.z},angle:this.angle.toJSON()}}static fromJSON(e){return new Cs(new N(e.axis.x,e.axis.y,e.axis.z),q(e.angle))}clone(){return new Cs(this.axis.clone(),this.angle.clone())}}class Yr{constructor(e,t,i,s){this.angleX=e,this.angleY=t,this.angleZ=i,this.type="rotation",this.eular=new ws(0,0,0,s)}startGen(e){this.angleX.startGen(e),this.angleY.startGen(e),this.angleZ.startGen(e)}genValue(e,t,i,s){return this.eular.set(this.angleX.genValue(e,s)*i,this.angleY.genValue(e,s)*i,this.angleZ.genValue(e,s)*i),t.setFromEuler(this.eular)}toJSON(){return{type:"Euler",angleX:this.angleX.toJSON(),angleY:this.angleY.toJSON(),angleZ:this.angleZ.toJSON(),eulerOrder:this.eular.order}}static fromJSON(e){return new Yr(q(e.angleX),q(e.angleY),q(e.angleZ),e.eulerOrder)}clone(){return new Yr(this.angleX,this.angleY,this.angleZ,this.eular.order)}}function _c(o){switch(o.type){case"AxisAngle":return Cs.fromJSON(o);case"Euler":return Yr.fromJSON(o);case"RandomQuat":return Ms.fromJSON(o);default:return new Ms}}class vi{constructor(e,t,i){this.x=e,this.y=t,this.z=i,this.type="vec3function"}startGen(e){this.x.startGen(e),this.y.startGen(e),this.z.startGen(e)}genValue(e,t,i){return t.set(this.x.genValue(e,i),this.y.genValue(e,i),this.z.genValue(e,i))}toJSON(){return{type:"Vector3Function",x:this.x.toJSON(),y:this.y.toJSON(),z:this.z.toJSON()}}static fromJSON(e){return new vi(q(e.x),q(e.y),q(e.z))}clone(){return new vi(this.x,this.y,this.z)}}function up(o){switch(o.type){case"Vector3Function":return vi.fromJSON(o);default:return new vi(new ie(0),new ie(0),new ie(0))}}function Jr(o){switch(o.type){case"ConstantValue":case"IntervalValue":case"PiecewiseBezier":return q(o);case"AxisAngle":case"RandomQuat":case"Euler":return _c(o);case"Vector3Function":return up(o);default:return new ie(0)}}class Ps{constructor(e={}){this.type="cone",this.currentValue=0,this.radius=e.radius??10,this.arc=e.arc??2*Math.PI,this.thickness=e.thickness??1,this.angle=e.angle??Math.PI/6,this.mode=e.mode??Fe.Random,this.spread=e.spread??0,this.speed=e.speed??new ie(1),this.memory=[]}update(e,t){Fe.Random!=this.mode&&(this.currentValue+=this.speed.genValue(this.memory,e.emissionState.time/e.duration)*t)}initialize(e,t){const i=$i(this.mode,this.currentValue,this.spread,t),s=Qi.lerp(1-this.thickness,1,Math.random()),r=i*this.arc,n=Math.sqrt(s),a=Math.sin(r),l=Math.cos(r);e.position.x=n*l,e.position.y=n*a,e.position.z=0;const c=this.angle*n;e.velocity.set(0,0,Math.cos(c)).addScaledVector(e.position,Math.sin(c)).multiplyScalar(e.startSpeed),e.position.multiplyScalar(this.radius)}toJSON(){return{type:"cone",radius:this.radius,arc:this.arc,thickness:this.thickness,angle:this.angle,mode:this.mode,spread:this.spread,speed:this.speed.toJSON()}}static fromJSON(e){return new Ps({radius:e.radius,arc:e.arc,thickness:e.thickness,angle:e.angle,mode:e.mode,speed:e.speed?q(e.speed):void 0,spread:e.spread})}clone(){return new Ps({radius:this.radius,arc:this.arc,thickness:this.thickness,angle:this.angle,mode:this.mode,speed:this.speed.clone(),spread:this.spread})}}class As{constructor(e={}){this.type="circle",this.currentValue=0,this.radius=e.radius??10,this.arc=e.arc??2*Math.PI,this.thickness=e.thickness??1,this.mode=e.mode??Fe.Random,this.spread=e.spread??0,this.speed=e.speed??new ie(1),this.memory=[]}update(e,t){this.currentValue+=this.speed.genValue(this.memory,e.emissionState.time/e.duration)*t}initialize(e,t){const i=$i(this.mode,this.currentValue,this.spread,t),s=Qi.lerp(1-this.thickness,1,Math.random()),r=i*this.arc;e.position.x=Math.cos(r),e.position.y=Math.sin(r),e.position.z=0,e.velocity.copy(e.position).multiplyScalar(e.startSpeed),e.position.multiplyScalar(this.radius*s)}toJSON(){return{type:"circle",radius:this.radius,arc:this.arc,thickness:this.thickness,mode:this.mode,spread:this.spread,speed:this.speed.toJSON()}}static fromJSON(e){return new As({radius:e.radius,arc:e.arc,thickness:e.thickness,mode:e.mode,speed:e.speed?q(e.speed):void 0,spread:e.spread})}clone(){return new As({radius:this.radius,arc:this.arc,thickness:this.thickness,mode:this.mode,speed:this.speed.clone(),spread:this.spread})}}function Rr(o,e){return Math.floor(Math.random()*(e-o))+o}const Ks=new N(0,1,0),er=new N(0,0,0),pp=new N(1,1,1),rl=new N(0,0,1);class zs{constructor(e={}){this.type="donut",this.currentValue=0,this.radius=e.radius??10,this.arc=e.arc??2*Math.PI,this.thickness=e.thickness??1,this.donutRadius=e.donutRadius??this.radius*.2,this.mode=e.mode??Fe.Random,this.spread=e.spread??0,this.speed=e.speed??new ie(1),this.memory=[],this._m1=new ht}update(e,t){Fe.Random!=this.mode&&(this.currentValue+=this.speed.genValue(this.memory,e.emissionState.time/e.duration)*t)}initialize(e,t){const i=$i(this.mode,this.currentValue,this.spread,t),s=Math.random(),r=Qi.lerp(1-this.thickness,1,Math.random()),n=i*this.arc,a=s*Math.PI*2,l=Math.sin(n),c=Math.cos(n);e.position.x=this.radius*c,e.position.y=this.radius*l,e.position.z=0,e.velocity.z=this.donutRadius*r*Math.sin(a),e.velocity.x=this.donutRadius*r*Math.cos(a)*c,e.velocity.y=this.donutRadius*r*Math.cos(a)*l,e.position.add(e.velocity),e.velocity.normalize().multiplyScalar(e.startSpeed),e.rotation instanceof te&&(this._m1.lookAt(er,e.velocity,Ks),e.rotation.setFromRotationMatrix(this._m1))}toJSON(){return{type:"donut",radius:this.radius,arc:this.arc,thickness:this.thickness,donutRadius:this.donutRadius,mode:this.mode,spread:this.spread,speed:this.speed.toJSON()}}static fromJSON(e){return new zs({radius:e.radius,arc:e.arc,thickness:e.thickness,donutRadius:e.donutRadius,mode:e.mode,speed:e.speed?q(e.speed):void 0,spread:e.spread})}clone(){return new zs({radius:this.radius,arc:this.arc,thickness:this.thickness,donutRadius:this.donutRadius,mode:this.mode,speed:this.speed.clone(),spread:this.spread})}}class Es{constructor(){this.type="point",this._m1=new ht}update(e,t){}initialize(e){const t=Math.random(),i=Math.random(),s=t*Math.PI*2,r=Math.acos(2*i-1),n=Math.cbrt(Math.random()),a=Math.sin(s),l=Math.cos(s),c=Math.sin(r),h=Math.cos(r);e.velocity.x=n*c*l,e.velocity.y=n*c*a,e.velocity.z=n*h,e.velocity.multiplyScalar(e.startSpeed),e.position.setScalar(0),e.rotation instanceof te&&(this._m1.lookAt(er,e.position,Ks),e.rotation.setFromRotationMatrix(this._m1))}toJSON(){return{type:"point"}}static fromJSON(e){return new Es}clone(){return new Es}}class qi{constructor(e={}){this.type="sphere",this.currentValue=0,this.radius=e.radius??10,this.arc=e.arc??2*Math.PI,this.thickness=e.thickness??1,this.mode=e.mode??Fe.Random,this.spread=e.spread??0,this.speed=e.speed??new ie(1),this.memory=[],this._m1=new ht}update(e,t){Fe.Random!=this.mode&&(this.currentValue+=this.speed.genValue(this.memory,e.emissionState.time/e.duration)*t)}initialize(e,t){const i=$i(this.mode,this.currentValue,this.spread,t),s=Math.random(),r=Qi.lerp(1-this.thickness,1,Math.random()),n=i*this.arc,a=Math.acos(2*s-1),l=Math.sin(n),c=Math.cos(n),h=Math.sin(a),d=Math.cos(a);e.position.x=h*c,e.position.y=h*l,e.position.z=d,e.velocity.copy(e.position).multiplyScalar(e.startSpeed),e.position.multiplyScalar(this.radius*r),e.rotation instanceof te&&(this._m1.lookAt(er,e.position,Ks),e.rotation.setFromRotationMatrix(this._m1))}toJSON(){return{type:"sphere",radius:this.radius,arc:this.arc,thickness:this.thickness,mode:this.mode,spread:this.spread,speed:this.speed.toJSON()}}static fromJSON(e){return new qi({radius:e.radius,arc:e.arc,thickness:e.thickness,mode:e.mode,speed:e.speed?q(e.speed):void 0,spread:e.spread})}clone(){return new qi({radius:this.radius,arc:this.arc,thickness:this.thickness,mode:this.mode,speed:this.speed.clone(),spread:this.spread})}}class Os{constructor(e={}){this.type="hemisphere",this.currentValue=0,this.radius=e.radius??10,this.arc=e.arc??2*Math.PI,this.thickness=e.thickness??1,this.mode=e.mode??Fe.Random,this.spread=e.spread??0,this.speed=e.speed??new ie(1),this.memory=[],this._m1=new ht}update(e,t){Fe.Random!=this.mode&&(this.currentValue+=this.speed.genValue(this.memory,e.emissionState.time/e.duration)*t)}initialize(e,t){const i=$i(this.mode,this.currentValue,this.spread,t),s=Math.random(),r=Qi.lerp(1-this.thickness,1,Math.random()),n=i*this.arc,a=Math.acos(s),l=Math.sin(n),c=Math.cos(n),h=Math.sin(a),d=Math.cos(a);e.position.x=h*c,e.position.y=h*l,e.position.z=d,e.velocity.copy(e.position).multiplyScalar(e.startSpeed),e.position.multiplyScalar(this.radius*r),e.rotation instanceof te&&(this._m1.lookAt(er,e.position,Ks),e.rotation.setFromRotationMatrix(this._m1))}toJSON(){return{type:"hemisphere",radius:this.radius,arc:this.arc,thickness:this.thickness,mode:this.mode,spread:this.spread,speed:this.speed.toJSON()}}static fromJSON(e){return new Os({radius:e.radius,arc:e.arc,thickness:e.thickness,mode:e.mode,speed:e.speed?q(e.speed):void 0,spread:e.spread})}clone(){return new Os({radius:this.radius,arc:this.arc,thickness:this.thickness,mode:this.mode,speed:this.speed.clone(),spread:this.spread})}}class Ts{constructor(e={}){this.type="grid",this.width=e.width??1,this.height=e.height??1,this.column=e.column??10,this.row=e.row??10}initialize(e){const t=Math.floor(Math.random()*this.row),i=Math.floor(Math.random()*this.column);e.position.x=i*this.width/this.column-this.width/2,e.position.y=t*this.height/this.row-this.height/2,e.position.z=0,e.velocity.set(0,0,e.startSpeed)}toJSON(){return{type:"grid",width:this.width,height:this.height,column:this.column,row:this.row}}static fromJSON(e){return new Ts(e)}clone(){return new Ts({width:this.width,height:this.height,column:this.column,row:this.row})}update(e,t){}}class ks{constructor(e={}){this.type="rectangle",this.currentValue=0,this.width=e.width??10,this.height=e.height??10,this.thickness=e.thickness??1,this.mode=e.mode??Fe.Random,this.spread=e.spread??0,this.speed=e.speed??new ie(1),this.memory=[],this._m1=new ht}update(e,t){this.currentValue+=this.speed.genValue(this.memory,e.emissionState.time/e.duration)*t}initialize(e,t){const i=$i(this.mode,this.currentValue,this.spread,t),s=2*(this.width+this.height),r=i*s;let n,a;r<this.width?(n=r-this.width/2,a=-this.height/2):r<this.width+this.height?(n=this.width/2,a=r-this.width-this.height/2):r<2*this.width+this.height?(n=this.width/2-(r-this.width-this.height),a=this.height/2):(n=-this.width/2,a=this.height/2-(r-2*this.width-this.height));const l=Math.random(),c=1-this.thickness*l;e.position.x=n*c,e.position.y=a*c,e.position.z=0,e.velocity.x=n,e.velocity.y=a,e.velocity.z=0,e.velocity.normalize().multiplyScalar(e.startSpeed),e.rotation instanceof te&&(this._m1.lookAt(er,e.velocity,Ks),e.rotation.setFromRotationMatrix(this._m1))}toJSON(){return{type:"rectangle",width:this.width,height:this.height,thickness:this.thickness,mode:this.mode,spread:this.spread,speed:this.speed.toJSON()}}static fromJSON(e){return new ks({width:e.width,height:e.height,thickness:e.thickness,mode:e.mode,speed:e.speed?q(e.speed):void 0,spread:e.spread})}clone(){return new ks({width:this.width,height:this.height,thickness:this.thickness,mode:this.mode,speed:this.speed.clone(),spread:this.spread})}}const ao={circle:{type:"circle",params:[["radius",["number"]],["arc",["radian"]],["thickness",["number"]],["mode",["emitterMode"]],["spread",["number"]],["speed",["valueFunc","value"]]],constructor:As,loadJSON:As.fromJSON},cone:{type:"cone",params:[["radius",["number"]],["arc",["radian"]],["thickness",["number"]],["angle",["radian"]],["mode",["emitterMode"]],["spread",["number"]],["speed",["valueFunc","value"]]],constructor:Ps,loadJSON:Ps.fromJSON},donut:{type:"donut",params:[["radius",["number"]],["arc",["radian"]],["thickness",["number"]],["donutRadius",["number"]],["mode",["emitterMode"]],["spread",["number"]],["speed",["valueFunc","value"]]],constructor:zs,loadJSON:zs.fromJSON},point:{type:"point",params:[],constructor:Es,loadJSON:Es.fromJSON},sphere:{type:"sphere",params:[["radius",["number"]],["arc",["radian"]],["thickness",["number"]],["angle",["radian"]],["mode",["emitterMode"]],["spread",["number"]],["speed",["valueFunc","value"]]],constructor:qi,loadJSON:qi.fromJSON},hemisphere:{type:"hemisphere",params:[["radius",["number"]],["arc",["radian"]],["thickness",["number"]],["angle",["radian"]],["mode",["emitterMode"]],["spread",["number"]],["speed",["valueFunc","value"]]],constructor:Os,loadJSON:Os.fromJSON},grid:{type:"grid",params:[["width",["number"]],["height",["number"]],["rows",["number"]],["column",["number"]]],constructor:Ts,loadJSON:Ts.fromJSON},rectangle:{type:"rectangle",params:[["width",["number"]],["height",["number"]],["thickness",["number"]],["mode",["emitterMode"]],["spread",["number"]],["speed",["valueFunc","value"]]],constructor:ks,loadJSON:ks.fromJSON}};function fp(o,e){return ao[o.type].loadJSON(o,e)}class Rs{constructor(e){this.color=e,this.type="ColorOverLife"}initialize(e){this.color.startGen(e.memory)}update(e,t){this.color.genColor(e.memory,e.color,e.age/e.life),e.color.x*=e.startColor.x,e.color.y*=e.startColor.y,e.color.z*=e.startColor.z,e.color.w*=e.startColor.w}frameUpdate(e){}toJSON(){return{type:this.type,color:this.color.toJSON()}}static fromJSON(e){return new Rs(Po(e.color))}clone(){return new Rs(this.color.clone())}reset(){}}class Is{constructor(e){this.angularVelocity=e,this.type="RotationOverLife"}initialize(e){typeof e.rotation=="number"&&this.angularVelocity.startGen(e.memory)}update(e,t){typeof e.rotation=="number"&&(e.rotation+=t*this.angularVelocity.genValue(e.memory,e.age/e.life))}toJSON(){return{type:this.type,angularVelocity:this.angularVelocity.toJSON()}}static fromJSON(e){return new Is(q(e.angularVelocity))}frameUpdate(e){}clone(){return new Is(this.angularVelocity.clone())}reset(){}}class Ls{constructor(e){this.angularVelocity=e,this.type="Rotation3DOverLife",this.tempQuat=new te,this.tempQuat2=new te}initialize(e){e.rotation instanceof te&&(e.angularVelocity=new te,this.angularVelocity.startGen(e.memory))}update(e,t){e.rotation instanceof te&&(this.angularVelocity.genValue(e.memory,this.tempQuat,t,e.age/e.life),e.rotation.multiply(this.tempQuat))}toJSON(){return{type:this.type,angularVelocity:this.angularVelocity.toJSON()}}static fromJSON(e){return new Ls(_c(e.angularVelocity))}frameUpdate(e){}clone(){return new Ls(this.angularVelocity.clone())}reset(){}}class Bs{initialize(e,t){this.ps=t,this.x.startGen(e.memory),this.y.startGen(e.memory),this.z.startGen(e.memory)}constructor(e,t,i){this.x=e,this.y=t,this.z=i,this.type="ForceOverLife",this._temp=new N,this._tempScale=new N,this._tempQ=new te}update(e,t){this._temp.set(this.x.genValue(e.memory,e.age/e.life),this.y.genValue(e.memory,e.age/e.life),this.z.genValue(e.memory,e.age/e.life)),this.ps.worldSpace?e.velocity.addScaledVector(this._temp,t):(this._temp.multiply(this._tempScale).applyQuaternion(this._tempQ),e.velocity.addScaledVector(this._temp,t))}toJSON(){return{type:this.type,x:this.x.toJSON(),y:this.y.toJSON(),z:this.z.toJSON()}}static fromJSON(e){return new Bs(q(e.x),q(e.y),q(e.z))}frameUpdate(e){if(this.ps&&!this.ps.worldSpace){const t=this._temp,i=this._tempQ,s=this._tempScale;this.ps.emitter.matrixWorld.decompose(t,i,s),i.invert(),s.set(1/s.x,1/s.y,1/s.z)}}clone(){return new Bs(this.x.clone(),this.y.clone(),this.z.clone())}reset(){}}class Fs{initialize(e){this.size.startGen(e.memory)}constructor(e){this.size=e,this.type="SizeOverLife"}update(e){this.size instanceof vi?this.size.genValue(e.memory,e.size,e.age/e.life).multiply(e.startSize):e.size.copy(e.startSize).multiplyScalar(this.size.genValue(e.memory,e.age/e.life))}toJSON(){return{type:this.type,size:this.size.toJSON()}}static fromJSON(e){return new Fs(Jr(e.size))}frameUpdate(e){}clone(){return new Fs(this.size.clone())}reset(){}}class Ns{initialize(e){this.speed.startGen(e.memory)}constructor(e){this.speed=e,this.type="SpeedOverLife"}update(e){e.speedModifier=this.speed.genValue(e.memory,e.age/e.life)}toJSON(){return{type:this.type,speed:this.speed.toJSON()}}static fromJSON(e){return new Ns(q(e.speed))}frameUpdate(e){}clone(){return new Ns(this.speed.clone())}reset(){}}class Hs{constructor(e){this.frame=e,this.type="FrameOverLife"}initialize(e){this.frame.startGen(e.memory)}update(e,t){this.frame instanceof Ss&&(e.uvTile=this.frame.genValue(e.memory,e.age/e.life))}frameUpdate(e){}toJSON(){return{type:this.type,frame:this.frame.toJSON()}}static fromJSON(e){return new Hs(q(e.frame))}clone(){return new Hs(this.frame.clone())}reset(){}}class Ds{constructor(e,t=new N(0,1,0)){this.orbitSpeed=e,this.axis=t,this.type="OrbitOverLife",this.temp=new N,this.rotation=new te}initialize(e){this.orbitSpeed.startGen(e.memory)}update(e,t){this.temp.copy(e.position).projectOnVector(this.axis),this.rotation.setFromAxisAngle(this.axis,this.orbitSpeed.genValue(e.memory,e.age/e.life)*t),e.position.sub(this.temp),e.position.applyQuaternion(this.rotation),e.position.add(this.temp)}frameUpdate(e){}toJSON(){return{type:this.type,orbitSpeed:this.orbitSpeed.toJSON(),axis:[this.axis.x,this.axis.y,this.axis.z]}}static fromJSON(e){return new Ds(q(e.orbitSpeed),e.axis?new N(e.axis[0],e.axis[1],e.axis[2]):void 0)}clone(){return new Ds(this.orbitSpeed.clone())}reset(){}}class Tn{constructor(e){this.data=e,this.next=null,this.prev=null}hasPrev(){return this.prev!==null}hasNext(){return this.next!==null}}class mp{constructor(){this.length=0,this.head=this.tail=null}isEmpty(){return this.head===null}clear(){this.length=0,this.head=this.tail=null}front(){return this.head===null?null:this.head.data}back(){return this.tail===null?null:this.tail.data}dequeue(){if(this.head){const e=this.head.data;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}}pop(){if(this.tail){const e=this.tail.data;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}}queue(e){const t=new Tn(e);this.tail||(this.tail=t),this.head&&(this.head.prev=t,t.next=this.head),this.head=t,this.length++}push(e){const t=new Tn(e);this.head||(this.head=t),this.tail&&(this.tail.next=t,t.prev=this.tail),this.tail=t,this.length++}insertBefore(e,t){const i=new Tn(t);i.next=e,i.prev=e.prev,i.prev!==null&&(i.prev.next=i),i.next.prev=i,e==this.head&&(this.head=i),this.length++}remove(e){if(this.head===null||this.tail===null)return;let t=this.head;for(e===this.head.data&&(this.head=this.head.next),e===this.tail.data&&(this.tail=this.tail.prev);t.next!==null&&t.data!==e;)t=t.next;t.data===e&&(t.prev!==null&&(t.prev.next=t.next),t.next!==null&&(t.next.prev=t.prev),this.length--)}*values(){let e=this.head;for(;e!==null;)yield e.data,e=e.next}}class gp{constructor(){this.startSpeed=0,this.startColor=new Qe,this.startSize=new N(1,1,1),this.position=new N,this.velocity=new N,this.age=0,this.life=1,this.size=new N(1,1,1),this.speedModifier=1,this.rotation=0,this.color=new Qe,this.uvTile=0,this.memory=[]}get died(){return this.age>=this.life}reset(){this.memory.length=0}}class yp{constructor(e,t,i){this.position=e,this.size=t,this.color=i}}class lo{constructor(){this.startSpeed=0,this.startColor=new Qe,this.startSize=new N(1,1,1),this.position=new N,this.velocity=new N,this.age=0,this.life=1,this.size=new N(1,1,1),this.length=100,this.speedModifier=1,this.color=new Qe,this.previous=new mp,this.uvTile=0,this.memory=[]}update(){for(this.age<=this.life?this.previous.push(new yp(this.position.clone(),this.size.x,this.color.clone())):this.previous.length>0&&this.previous.dequeue();this.previous.length>this.length;)this.previous.dequeue()}get died(){return this.age>=this.life}reset(){this.memory.length=0,this.previous.clear()}}class Vs{initialize(e){this.width.startGen(e.memory)}constructor(e){this.width=e,this.type="WidthOverLength"}update(e){if(e instanceof lo){const t=e.previous.values();for(let i=0;i<e.previous.length;i++){const s=t.next();s.value.size=this.width.genValue(e.memory,(e.previous.length-i)/e.length)}}}frameUpdate(e){}toJSON(){return{type:this.type,width:this.width.toJSON()}}static fromJSON(e){return new Vs(q(e.width))}clone(){return new Vs(this.width.clone())}reset(){}}class Us{constructor(e,t){this.direction=e,this.magnitude=t,this.type="ApplyForce",this.memory={data:[],dataCount:0},this.magnitudeValue=this.magnitude.genValue(this.memory)}initialize(e){}update(e,t){e.velocity.addScaledVector(this.direction,this.magnitudeValue*t)}frameUpdate(e){this.magnitudeValue=this.magnitude.genValue(this.memory)}toJSON(){return{type:this.type,direction:[this.direction.x,this.direction.y,this.direction.z],magnitude:this.magnitude.toJSON()}}static fromJSON(e){return new Us(new N(e.direction[0],e.direction[1],e.direction[2]),q(e.magnitude??e.force))}clone(){return new Us(this.direction.clone(),this.magnitude.clone())}reset(){}}class js{constructor(e,t){this.center=e,this.magnitude=t,this.type="GravityForce",this.temp=new N}initialize(e){}update(e,t){this.temp.copy(this.center).sub(e.position).normalize(),e.velocity.addScaledVector(this.temp,this.magnitude/e.position.distanceToSquared(this.center)*t)}frameUpdate(e){}toJSON(){return{type:this.type,center:[this.center.x,this.center.y,this.center.z],magnitude:this.magnitude}}static fromJSON(e){return new js(new N(e.center[0],e.center[1],e.center[2]),e.magnitude)}clone(){return new js(this.center.clone(),this.magnitude)}reset(){}}class Gs{constructor(e){this.angle=e,this.type="ChangeEmitDirection",this._temp=new N,this._q=new te,this.memory={data:[],dataCount:0}}initialize(e){const t=e.velocity.length();t!=0&&(e.velocity.normalize(),e.velocity.x===0&&e.velocity.y===0?this._temp.set(0,e.velocity.z,0):this._temp.set(-e.velocity.y,e.velocity.x,0),this.angle.startGen(this.memory),this._q.setFromAxisAngle(this._temp.normalize(),this.angle.genValue(this.memory)),this._temp.copy(e.velocity),e.velocity.applyQuaternion(this._q),this._q.setFromAxisAngle(this._temp,Math.random()*Math.PI*2),e.velocity.applyQuaternion(this._q),e.velocity.setLength(t))}update(e,t){}frameUpdate(e){}toJSON(){return{type:this.type,angle:this.angle.toJSON()}}static fromJSON(e){return new Gs(q(e.angle))}clone(){return new Gs(this.angle)}reset(){}}var Ni;(function(o){o[o.Death=0]="Death",o[o.Birth=1]="Birth",o[o.Frame=2]="Frame"})(Ni||(Ni={}));class Yi{constructor(e,t,i,s=Ni.Frame,r=1){this.particleSystem=e,this.useVelocityAsBasis=t,this.subParticleSystem=i,this.mode=s,this.emitProbability=r,this.type="EmitSubParticleSystem",this.q_=new te,this.v_=new N,this.v2_=new N,this.subEmissions=new Array,this.subParticleSystem&&this.subParticleSystem.system&&(this.subParticleSystem.system.onlyUsedByOther=!0)}initialize(e){}update(e,t){this.mode===Ni.Frame?this.emit(e,t):this.mode===Ni.Birth&&e.age===0?this.emit(e,t):this.mode===Ni.Death&&e.age+t>=e.life&&this.emit(e,t)}emit(e,t){if(!this.subParticleSystem||Math.random()>this.emitProbability)return;const i=new ht;this.setMatrixFromParticle(i,e),this.subEmissions.push({burstParticleCount:0,burstParticleIndex:0,isBursting:!1,burstIndex:0,burstWaveIndex:0,time:0,waitEmiting:0,matrix:i,travelDistance:0,particle:e})}frameUpdate(e){if(this.subParticleSystem)for(let t=0;t<this.subEmissions.length;t++)if(this.subEmissions[t].time>=this.subParticleSystem.system.duration)this.subEmissions[t]=this.subEmissions[this.subEmissions.length-1],this.subEmissions.length=this.subEmissions.length-1,t--;else{const i=this.subEmissions[t];i.particle&&i.particle.age<i.particle.life?this.setMatrixFromParticle(i.matrix,i.particle):i.particle=void 0,this.subParticleSystem.system.emit(e,i,i.matrix)}}toJSON(){return{type:this.type,subParticleSystem:this.subParticleSystem?this.subParticleSystem.uuid:"",useVelocityAsBasis:this.useVelocityAsBasis,mode:this.mode,emitProbability:this.emitProbability}}static fromJSON(e,t){return new Yi(t,e.useVelocityAsBasis,e.subParticleSystem,e.mode,e.emitProbability)}clone(){return new Yi(this.particleSystem,this.useVelocityAsBasis,this.subParticleSystem,this.mode,this.emitProbability)}reset(){}setMatrixFromParticle(e,t){let i;if(t.rotation===void 0||this.useVelocityAsBasis)if(t.velocity.x===0&&t.velocity.y===0&&(t.velocity.z===1||t.velocity.z===0))e.set(1,0,0,t.position.x,0,1,0,t.position.y,0,0,1,t.position.z,0,0,0,1);else{this.v_.copy(rl).cross(t.velocity),this.v2_.copy(t.velocity).cross(this.v_);const s=this.v_.length(),r=this.v2_.length();e.set(this.v_.x/s,this.v2_.x/r,t.velocity.x,t.position.x,this.v_.y/s,this.v2_.y/r,t.velocity.y,t.position.y,this.v_.z/s,this.v2_.z/r,t.velocity.z,t.position.z,0,0,0,1)}else t.rotation instanceof te?i=t.rotation:(this.q_.setFromAxisAngle(rl,t.rotation),i=this.q_),e.compose(t.position,i,pp);this.particleSystem.worldSpace||e.multiplyMatrices(this.particleSystem.emitter.matrixWorld,e)}}const _p=.5*(Math.sqrt(3)-1),ds=(3-Math.sqrt(3))/6,vp=1/3,yt=1/6,wp=(Math.sqrt(5)-1)/4,ze=(5-Math.sqrt(5))/20,Ae=new Float32Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]),Pe=new Float32Array([0,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,1,0,1,1,1,0,1,-1,1,0,-1,1,1,0,-1,-1,-1,0,1,1,-1,0,1,-1,-1,0,-1,1,-1,0,-1,-1,1,1,0,1,1,1,0,-1,1,-1,0,1,1,-1,0,-1,-1,1,0,1,-1,1,0,-1,-1,-1,0,1,-1,-1,0,-1,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,0]);class vc{constructor(e=Math.random){const t=typeof e=="function"?e:bp(e);this.p=xp(t),this.perm=new Uint8Array(512),this.permMod12=new Uint8Array(512);for(let i=0;i<512;i++)this.perm[i]=this.p[i&255],this.permMod12[i]=this.perm[i]%12}noise2D(e,t){const i=this.permMod12,s=this.perm;let r=0,n=0,a=0;const l=(e+t)*_p,c=Math.floor(e+l),h=Math.floor(t+l),d=(c+h)*ds,p=c-d,u=h-d,f=e-p,m=t-u;let y,_;f>m?(y=1,_=0):(y=0,_=1);const w=f-y+ds,x=m-_+ds,S=f-1+2*ds,C=m-1+2*ds,b=c&255,M=h&255;let z=.5-f*f-m*m;if(z>=0){const H=i[b+s[M]]*3;z*=z,r=z*z*(Ae[H]*f+Ae[H+1]*m)}let F=.5-w*w-x*x;if(F>=0){const H=i[b+y+s[M+_]]*3;F*=F,n=F*F*(Ae[H]*w+Ae[H+1]*x)}let R=.5-S*S-C*C;if(R>=0){const H=i[b+1+s[M+1]]*3;R*=R,a=R*R*(Ae[H]*S+Ae[H+1]*C)}return 70*(r+n+a)}noise3D(e,t,i){const s=this.permMod12,r=this.perm;let n,a,l,c;const h=(e+t+i)*vp,d=Math.floor(e+h),p=Math.floor(t+h),u=Math.floor(i+h),f=(d+p+u)*yt,m=d-f,y=p-f,_=u-f,w=e-m,x=t-y,S=i-_;let C,b,M,z,F,R;w>=x?x>=S?(C=1,b=0,M=0,z=1,F=1,R=0):w>=S?(C=1,b=0,M=0,z=1,F=0,R=1):(C=0,b=0,M=1,z=1,F=0,R=1):x<S?(C=0,b=0,M=1,z=0,F=1,R=1):w<S?(C=0,b=1,M=0,z=0,F=1,R=1):(C=0,b=1,M=0,z=1,F=1,R=0);const H=w-C+yt,se=x-b+yt,ve=S-M+yt,ee=w-z+2*yt,X=x-F+2*yt,ue=S-R+2*yt,j=w-1+3*yt,ne=x-1+3*yt,G=S-1+3*yt,fe=d&255,Y=p&255,Me=u&255;let xe=.6-w*w-x*x-S*S;if(xe<0)n=0;else{const we=s[fe+r[Y+r[Me]]]*3;xe*=xe,n=xe*xe*(Ae[we]*w+Ae[we+1]*x+Ae[we+2]*S)}let Ce=.6-H*H-se*se-ve*ve;if(Ce<0)a=0;else{const we=s[fe+C+r[Y+b+r[Me+M]]]*3;Ce*=Ce,a=Ce*Ce*(Ae[we]*H+Ae[we+1]*se+Ae[we+2]*ve)}let Ne=.6-ee*ee-X*X-ue*ue;if(Ne<0)l=0;else{const we=s[fe+z+r[Y+F+r[Me+R]]]*3;Ne*=Ne,l=Ne*Ne*(Ae[we]*ee+Ae[we+1]*X+Ae[we+2]*ue)}let He=.6-j*j-ne*ne-G*G;if(He<0)c=0;else{const we=s[fe+1+r[Y+1+r[Me+1]]]*3;He*=He,c=He*He*(Ae[we]*j+Ae[we+1]*ne+Ae[we+2]*G)}return 32*(n+a+l+c)}noise4D(e,t,i,s){const r=this.perm;let n,a,l,c,h;const d=(e+t+i+s)*wp,p=Math.floor(e+d),u=Math.floor(t+d),f=Math.floor(i+d),m=Math.floor(s+d),y=(p+u+f+m)*ze,_=p-y,w=u-y,x=f-y,S=m-y,C=e-_,b=t-w,M=i-x,z=s-S;let F=0,R=0,H=0,se=0;C>b?F++:R++,C>M?F++:H++,C>z?F++:se++,b>M?R++:H++,b>z?R++:se++,M>z?H++:se++;const ve=F>=3?1:0,ee=R>=3?1:0,X=H>=3?1:0,ue=se>=3?1:0,j=F>=2?1:0,ne=R>=2?1:0,G=H>=2?1:0,fe=se>=2?1:0,Y=F>=1?1:0,Me=R>=1?1:0,xe=H>=1?1:0,Ce=se>=1?1:0,Ne=C-ve+ze,He=b-ee+ze,we=M-X+ze,Kt=z-ue+ze,ei=C-j+2*ze,ti=b-ne+2*ze,le=M-G+2*ze,tt=z-fe+2*ze,oe=C-Y+3*ze,dt=b-Me+3*ze,ii=M-xe+3*ze,xi=z-Ce+3*ze,ut=C-1+4*ze,si=b-1+4*ze,ri=M-1+4*ze,bi=z-1+4*ze,Ct=p&255,Lt=u&255,Bt=f&255,Ft=m&255;let Pt=.6-C*C-b*b-M*M-z*z;if(Pt<0)n=0;else{const ce=r[Ct+r[Lt+r[Bt+r[Ft]]]]%32*4;Pt*=Pt,n=Pt*Pt*(Pe[ce]*C+Pe[ce+1]*b+Pe[ce+2]*M+Pe[ce+3]*z)}let Nt=.6-Ne*Ne-He*He-we*we-Kt*Kt;if(Nt<0)a=0;else{const ce=r[Ct+ve+r[Lt+ee+r[Bt+X+r[Ft+ue]]]]%32*4;Nt*=Nt,a=Nt*Nt*(Pe[ce]*Ne+Pe[ce+1]*He+Pe[ce+2]*we+Pe[ce+3]*Kt)}let Ht=.6-ei*ei-ti*ti-le*le-tt*tt;if(Ht<0)l=0;else{const ce=r[Ct+j+r[Lt+ne+r[Bt+G+r[Ft+fe]]]]%32*4;Ht*=Ht,l=Ht*Ht*(Pe[ce]*ei+Pe[ce+1]*ti+Pe[ce+2]*le+Pe[ce+3]*tt)}let pt=.6-oe*oe-dt*dt-ii*ii-xi*xi;if(pt<0)c=0;else{const ce=r[Ct+Y+r[Lt+Me+r[Bt+xe+r[Ft+Ce]]]]%32*4;pt*=pt,c=pt*pt*(Pe[ce]*oe+Pe[ce+1]*dt+Pe[ce+2]*ii+Pe[ce+3]*xi)}let Dt=.6-ut*ut-si*si-ri*ri-bi*bi;if(Dt<0)h=0;else{const ce=r[Ct+1+r[Lt+1+r[Bt+1+r[Ft+1]]]]%32*4;Dt*=Dt,h=Dt*Dt*(Pe[ce]*ut+Pe[ce+1]*si+Pe[ce+2]*ri+Pe[ce+3]*bi)}return 27*(n+a+l+c+h)}}function xp(o){const e=new Uint8Array(256);for(let t=0;t<256;t++)e[t]=t;for(let t=0;t<255;t++){const i=t+~~(o()*(256-t)),s=e[t];e[t]=e[i],e[i]=s}return e}function bp(o){let e=0,t=0,i=0,s=1;const r=Sp();return e=r(" "),t=r(" "),i=r(" "),e-=r(o),e<0&&(e+=1),t-=r(o),t<0&&(t+=1),i-=r(o),i<0&&(i+=1),function(){const n=2091639*e+s*23283064365386963e-26;return e=t,t=i,i=n-(s=n|0)}}function Sp(){let o=4022871197;return function(e){e=e.toString();for(let t=0;t<e.length;t++){o+=e.charCodeAt(t);let i=.02519603282416938*o;o=i>>>0,i-=o,i*=o,o=i>>>0,i-=o,o+=i*4294967296}return(o>>>0)*23283064365386963e-26}}class Ws{constructor(e,t,i,s){this.scale=e,this.octaves=t,this.velocityMultiplier=i,this.timeScale=s,this.type="TurbulenceField",this.generator=new vc,this.timeOffset=new N,this.temp=new N,this.temp2=new N,this.timeOffset.x=Math.random()/this.scale.x*this.timeScale.x,this.timeOffset.y=Math.random()/this.scale.y*this.timeScale.y,this.timeOffset.z=Math.random()/this.scale.z*this.timeScale.z}initialize(e){}update(e,t){const i=e.position.x/this.scale.x,s=e.position.y/this.scale.y,r=e.position.z/this.scale.z;this.temp.set(0,0,0);let n=1;for(let a=0;a<this.octaves;a++)this.temp2.set(this.generator.noise4D(i*n,s*n,r*n,this.timeOffset.x*n)/n,this.generator.noise4D(i*n,s*n,r*n,this.timeOffset.y*n)/n,this.generator.noise4D(i*n,s*n,r*n,this.timeOffset.z*n)/n),this.temp.add(this.temp2),n*=2;this.temp.multiply(this.velocityMultiplier),e.velocity.addScaledVector(this.temp,t)}toJSON(){return{type:this.type,scale:[this.scale.x,this.scale.y,this.scale.z],octaves:this.octaves,velocityMultiplier:[this.velocityMultiplier.x,this.velocityMultiplier.y,this.velocityMultiplier.z],timeScale:[this.timeScale.x,this.timeScale.y,this.timeScale.z]}}frameUpdate(e){this.timeOffset.x+=e*this.timeScale.x,this.timeOffset.y+=e*this.timeScale.y,this.timeOffset.z+=e*this.timeScale.z}static fromJSON(e){return new Ws(new N(e.scale[0],e.scale[1],e.scale[2]),e.octaves,new N(e.velocityMultiplier[0],e.velocityMultiplier[1],e.velocityMultiplier[2]),new N(e.timeScale[0],e.timeScale[1],e.timeScale[2]))}clone(){return new Ws(this.scale.clone(),this.octaves,this.velocityMultiplier.clone(),this.timeScale.clone())}reset(){}}const _t=[],kn=new N,Rn=new te;class Xs{constructor(e,t,i=new ie(1),s=new ie(0)){if(this.frequency=e,this.power=t,this.positionAmount=i,this.rotationAmount=s,this.type="Noise",this.duration=0,_t.length===0)for(let r=0;r<100;r++)_t.push(new vc)}initialize(e){e.lastPosNoise=new N,typeof e.rotation=="number"?e.lastRotNoise=0:e.lastRotNoise=new te,e.generatorIndex=[Rr(0,100),Rr(0,100),Rr(0,100),Rr(0,100)],this.positionAmount.startGen(e.memory),this.rotationAmount.startGen(e.memory),this.frequency.startGen(e.memory),this.power.startGen(e.memory)}update(e,t){let i=this.frequency.genValue(e.memory,e.age/e.life),s=this.power.genValue(e.memory,e.age/e.life),r=this.positionAmount.genValue(e.memory,e.age/e.life),n=this.rotationAmount.genValue(e.memory,e.age/e.life);r>0&&e.lastPosNoise!==void 0&&(e.position.sub(e.lastPosNoise),kn.set(_t[e.generatorIndex[0]].noise2D(0,e.age*i)*s*r,_t[e.generatorIndex[1]].noise2D(0,e.age*i)*s*r,_t[e.generatorIndex[2]].noise2D(0,e.age*i)*s*r),e.position.add(kn),e.lastPosNoise.copy(kn)),n>0&&e.lastRotNoise!==void 0&&(typeof e.rotation=="number"?(e.rotation-=e.lastRotNoise,e.rotation+=_t[e.generatorIndex[3]].noise2D(0,e.age*i)*Math.PI*s*n):(e.lastRotNoise.invert(),e.rotation.multiply(e.lastRotNoise),Rn.set(_t[e.generatorIndex[0]].noise2D(0,e.age*i)*s*n,_t[e.generatorIndex[1]].noise2D(0,e.age*i)*s*n,_t[e.generatorIndex[2]].noise2D(0,e.age*i)*s*n,_t[e.generatorIndex[3]].noise2D(0,e.age*i)*s*n).normalize(),e.rotation.multiply(Rn),e.lastRotNoise.copy(Rn)))}toJSON(){return{type:this.type,frequency:this.frequency.toJSON(),power:this.power.toJSON(),positionAmount:this.positionAmount.toJSON(),rotationAmount:this.rotationAmount.toJSON()}}frameUpdate(e){this.duration+=e}static fromJSON(e){return new Xs(q(e.frequency),q(e.power),q(e.positionAmount),q(e.rotationAmount))}clone(){return new Xs(this.frequency.clone(),this.power.clone(),this.positionAmount.clone(),this.rotationAmount.clone())}reset(){}}class qs{constructor(e,t){this.color=e,this.speedRange=t,this.type="ColorBySpeed"}initialize(e){this.color.startGen(e.memory)}update(e,t){const i=(e.startSpeed-this.speedRange.a)/(this.speedRange.b-this.speedRange.a);this.color.genColor(e.memory,e.color,i),e.color.x*=e.startColor.x,e.color.y*=e.startColor.y,e.color.z*=e.startColor.z,e.color.w*=e.startColor.w}frameUpdate(e){}toJSON(){return{type:this.type,color:this.color.toJSON(),speedRange:this.speedRange.toJSON()}}static fromJSON(e){return new qs(Po(e.color),_i.fromJSON(e.speedRange))}clone(){return new qs(this.color.clone(),this.speedRange.clone())}reset(){}}class Ys{initialize(e){this.size.startGen(e.memory)}constructor(e,t){this.size=e,this.speedRange=t,this.type="SizeBySpeed"}update(e){const t=(e.startSpeed-this.speedRange.a)/(this.speedRange.b-this.speedRange.a);this.size instanceof vi?this.size.genValue(e.memory,e.size,t).multiply(e.startSize):e.size.copy(e.startSize).multiplyScalar(this.size.genValue(e.memory,t))}toJSON(){return{type:this.type,size:this.size.toJSON(),speedRange:this.speedRange.toJSON()}}static fromJSON(e){return new Ys(Jr(e.size),_i.fromJSON(e.speedRange))}frameUpdate(e){}clone(){return new Ys(this.size.clone(),this.speedRange.clone())}reset(){}}class Js{constructor(e,t){this.angularVelocity=e,this.speedRange=t,this.type="RotationBySpeed",this.tempQuat=new te}initialize(e){typeof e.rotation=="number"&&this.angularVelocity.startGen(e.memory)}update(e,t){if(typeof e.rotation=="number"){const i=(e.startSpeed-this.speedRange.a)/(this.speedRange.b-this.speedRange.a);e.rotation+=t*this.angularVelocity.genValue(e.memory,i)}}toJSON(){return{type:this.type,angularVelocity:this.angularVelocity.toJSON(),speedRange:this.speedRange.toJSON()}}static fromJSON(e){return new Js(q(e.angularVelocity),_i.fromJSON(e.speedRange))}frameUpdate(e){}clone(){return new Js(this.angularVelocity.clone(),this.speedRange.clone())}reset(){}}class Zs{initialize(e){this.speed.startGen(e.memory)}constructor(e,t){this.speed=e,this.dampen=t,this.type="LimitSpeedOverLife"}update(e,t){let i=e.velocity.length(),s=this.speed.genValue(e.memory,e.age/e.life);if(i>s){const r=(i-s)/i;e.velocity.multiplyScalar(1-r*this.dampen*t*20)}}toJSON(){return{type:this.type,speed:this.speed.toJSON(),dampen:this.dampen}}static fromJSON(e){return new Zs(q(e.speed),e.dampen)}frameUpdate(e){}clone(){return new Zs(this.speed.clone(),this.dampen)}reset(){}}const Zr={ApplyForce:{type:"ApplyForce",constructor:Us,params:[["direction",["vec3"]],["magnitude",["value"]]],loadJSON:Us.fromJSON},Noise:{type:"Noise",constructor:Xs,params:[["frequency",["value"]],["power",["value"]],["positionAmount",["value"]],["rotationAmount",["value"]]],loadJSON:Xs.fromJSON},TurbulenceField:{type:"TurbulenceField",constructor:Ws,params:[["scale",["vec3"]],["octaves",["number"]],["velocityMultiplier",["vec3"]],["timeScale",["vec3"]]],loadJSON:Ws.fromJSON},GravityForce:{type:"GravityForce",constructor:js,params:[["center",["vec3"]],["magnitude",["number"]]],loadJSON:js.fromJSON},ColorOverLife:{type:"ColorOverLife",constructor:Rs,params:[["color",["colorFunc"]]],loadJSON:Rs.fromJSON},RotationOverLife:{type:"RotationOverLife",constructor:Is,params:[["angularVelocity",["value","valueFunc"]]],loadJSON:Is.fromJSON},Rotation3DOverLife:{type:"Rotation3DOverLife",constructor:Ls,params:[["angularVelocity",["rotationFunc"]]],loadJSON:Ls.fromJSON},SizeOverLife:{type:"SizeOverLife",constructor:Fs,params:[["size",["value","valueFunc","vec3Func"]]],loadJSON:Fs.fromJSON},ColorBySpeed:{type:"ColorBySpeed",constructor:qs,params:[["color",["colorFunc"]],["speedRange",["range"]]],loadJSON:qs.fromJSON},RotationBySpeed:{type:"RotationBySpeed",constructor:Js,params:[["angularVelocity",["value","valueFunc"]],["speedRange",["range"]]],loadJSON:Js.fromJSON},SizeBySpeed:{type:"SizeBySpeed",constructor:Ys,params:[["size",["value","valueFunc","vec3Func"]],["speedRange",["range"]]],loadJSON:Ys.fromJSON},SpeedOverLife:{type:"SpeedOverLife",constructor:Ns,params:[["speed",["value","valueFunc"]]],loadJSON:Ns.fromJSON},FrameOverLife:{type:"FrameOverLife",constructor:Hs,params:[["frame",["value","valueFunc"]]],loadJSON:Hs.fromJSON},ForceOverLife:{type:"ForceOverLife",constructor:Bs,params:[["x",["value","valueFunc"]],["y",["value","valueFunc"]],["z",["value","valueFunc"]]],loadJSON:Bs.fromJSON},OrbitOverLife:{type:"OrbitOverLife",constructor:Ds,params:[["orbitSpeed",["value","valueFunc"]],["axis",["vec3"]]],loadJSON:Ds.fromJSON},WidthOverLength:{type:"WidthOverLength",constructor:Vs,params:[["width",["value","valueFunc"]]],loadJSON:Vs.fromJSON},ChangeEmitDirection:{type:"ChangeEmitDirection",constructor:Gs,params:[["angle",["value"]]],loadJSON:Gs.fromJSON},EmitSubParticleSystem:{type:"EmitSubParticleSystem",constructor:Yi,params:[["particleSystem",["self"]],["useVelocityAsBasis",["boolean"]],["subParticleSystem",["particleSystem"]],["mode",["number"]],["emitProbability",["number"]]],loadJSON:Yi.fromJSON},LimitSpeedOverLife:{type:"LimitSpeedOverLife",constructor:Zs,params:[["speed",["value","valueFunc"]],["dampen",["number"]]],loadJSON:Zs.fromJSON}};function Mp(o,e){return Zr[o.type]?Zr[o.type].loadJSON(o,e):null}const Cp=[];function Pp(o){if(!Cp.find(t=>t.id===o.id)){for(const t of o.emitterShapes)ao[t.type]||(ao[t.type]=t);for(const t of o.behaviors)Zr[t.type]||(Zr[t.type]=t)}}class Qs{get geometry(){return this._geometry}set geometry(e){if(this._geometry=e,e===void 0||typeof e=="string")return;const t=new Jd;this._triangleIndexToArea.length=0;let i=0;if(!e.getIndex())return;const s=e.getIndex().array,r=s.length/3;this._triangleIndexToArea.push(0);for(let n=0;n<r;n++)t.setFromAttributeAndIndices(e.getAttribute("position"),s[n*3],s[n*3+1],s[n*3+2]),i+=t.getArea(),this._triangleIndexToArea.push(i);e.userData.triangleIndexToArea=this._triangleIndexToArea}constructor(e){this.type="mesh_surface",this._triangleIndexToArea=[],this._tempA=new v,this._tempB=new v,this._tempC=new v,e&&(this.geometry=e)}initialize(e){const t=this._geometry;if(!t||t.getIndex()===null){e.position.set(0,0,0),e.velocity.set(0,0,1).multiplyScalar(e.startSpeed);return}const i=this._triangleIndexToArea.length-1;let s=0,r=i;const n=Math.random()*this._triangleIndexToArea[i];for(;s+1<r;){const u=Math.floor((s+r)/2);n<this._triangleIndexToArea[u]?r=u:s=u}let a=Math.random(),l=Math.random();a+l>1&&(a=1-a,l=1-l);const c=t.getIndex().array[s*3],h=t.getIndex().array[s*3+1],d=t.getIndex().array[s*3+2],p=t.getAttribute("position");this._tempA.fromBufferAttribute(p,c),this._tempB.fromBufferAttribute(p,h),this._tempC.fromBufferAttribute(p,d),this._tempB.sub(this._tempA),this._tempC.sub(this._tempA),this._tempA.addScaledVector(this._tempB,a).addScaledVector(this._tempC,l),e.position.copy(this._tempA),this._tempA.copy(this._tempB).cross(this._tempC).normalize(),e.velocity.copy(this._tempA).normalize().multiplyScalar(e.startSpeed)}toJSON(){return{type:"mesh_surface",mesh:this._geometry?this._geometry.uuid:""}}static fromJSON(e,t){return new Qs(t.geometries[e.geometry])}clone(){return new Qs(this._geometry)}update(e,t){}}const Ap={id:"three.quarks",emitterShapes:[{type:"mesh_surface",params:[["geometry",["geometry"]]],constructor:Qs,loadJSON:Qs.fromJSON}],behaviors:[]};var zp=`
|
|
3
|
+
#ifdef SOFT_PARTICLES
|
|
4
|
+
|
|
5
|
+
/* #ifdef LOGDEPTH
|
|
6
|
+
float distSample = linearize_depth_log(sampleDepth, near, far);
|
|
7
|
+
#else
|
|
8
|
+
float distSample = ortho ? linearize_depth_ortho(sampleDepth, near, far) : linearize_depth(sampleDepth, near, far);
|
|
9
|
+
#endif */
|
|
10
|
+
|
|
11
|
+
vec2 p2 = projPosition.xy / projPosition.w;
|
|
12
|
+
|
|
13
|
+
p2 = 0.5 * p2 + 0.5;
|
|
14
|
+
|
|
15
|
+
float readDepth = texture2D(depthTexture, p2.xy).r;
|
|
16
|
+
float viewDepth = linearize_depth(readDepth);
|
|
17
|
+
|
|
18
|
+
float softParticlesFade = saturate(SOFT_INV_FADE_DISTANCE * ((viewDepth - SOFT_NEAR_FADE) - linearDepth));
|
|
19
|
+
|
|
20
|
+
gl_FragColor *= softParticlesFade;
|
|
21
|
+
|
|
22
|
+
//gl_FragColor = vec4(softParticlesFade , 0, 0, 1);
|
|
23
|
+
#endif
|
|
24
|
+
`,Ep=`
|
|
25
|
+
#ifdef SOFT_PARTICLES
|
|
26
|
+
|
|
27
|
+
uniform sampler2D depthTexture;
|
|
28
|
+
uniform vec4 projParams;
|
|
29
|
+
uniform vec2 softParams;
|
|
30
|
+
|
|
31
|
+
varying vec4 projPosition;
|
|
32
|
+
varying float linearDepth;
|
|
33
|
+
|
|
34
|
+
#define SOFT_NEAR_FADE softParams.x
|
|
35
|
+
#define SOFT_INV_FADE_DISTANCE softParams.y
|
|
36
|
+
|
|
37
|
+
#define zNear projParams.x
|
|
38
|
+
#define zFar projParams.y
|
|
39
|
+
|
|
40
|
+
float linearize_depth(float d)
|
|
41
|
+
{
|
|
42
|
+
return (zFar * zNear) / (zFar - d * (zFar - zNear));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
#endif
|
|
46
|
+
`,Op=`
|
|
47
|
+
#ifdef SOFT_PARTICLES
|
|
48
|
+
varying vec4 projPosition;
|
|
49
|
+
varying float linearDepth;
|
|
50
|
+
#endif
|
|
51
|
+
`,Tp=`
|
|
52
|
+
#ifdef SOFT_PARTICLES
|
|
53
|
+
projPosition = gl_Position;
|
|
54
|
+
linearDepth = -mvPosition.z;
|
|
55
|
+
#endif
|
|
56
|
+
`,kp=`
|
|
57
|
+
#ifdef USE_MAP
|
|
58
|
+
vec4 texelColor = texture2D( map, vUv);
|
|
59
|
+
#ifdef TILE_BLEND
|
|
60
|
+
texelColor = mix( texelColor, texture2D( map, vUvNext ), vUvBlend );
|
|
61
|
+
#endif
|
|
62
|
+
diffuseColor *= texelColor;
|
|
63
|
+
#endif
|
|
64
|
+
`,Rp=`
|
|
65
|
+
#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
66
|
+
|
|
67
|
+
varying vec2 vUv;
|
|
68
|
+
#ifdef TILE_BLEND
|
|
69
|
+
varying vec2 vUvNext;
|
|
70
|
+
varying float vUvBlend;
|
|
71
|
+
#endif
|
|
72
|
+
|
|
73
|
+
#endif
|
|
74
|
+
#ifdef USE_MAP
|
|
75
|
+
|
|
76
|
+
uniform mat3 mapTransform;
|
|
77
|
+
varying vec2 vMapUv;
|
|
78
|
+
#ifdef TILE_BLEND
|
|
79
|
+
varying vec2 vMapUvNext;
|
|
80
|
+
#endif
|
|
81
|
+
|
|
82
|
+
#endif
|
|
83
|
+
#ifdef USE_ALPHAMAP
|
|
84
|
+
|
|
85
|
+
uniform mat3 alphaMapTransform;
|
|
86
|
+
varying vec2 vAlphaMapUv;
|
|
87
|
+
|
|
88
|
+
#endif
|
|
89
|
+
#ifdef USE_LIGHTMAP
|
|
90
|
+
|
|
91
|
+
uniform mat3 lightMapTransform;
|
|
92
|
+
varying vec2 vLightMapUv;
|
|
93
|
+
|
|
94
|
+
#endif
|
|
95
|
+
#ifdef USE_AOMAP
|
|
96
|
+
|
|
97
|
+
uniform mat3 aoMapTransform;
|
|
98
|
+
varying vec2 vAoMapUv;
|
|
99
|
+
|
|
100
|
+
#endif
|
|
101
|
+
#ifdef USE_BUMPMAP
|
|
102
|
+
|
|
103
|
+
uniform mat3 bumpMapTransform;
|
|
104
|
+
varying vec2 vBumpMapUv;
|
|
105
|
+
|
|
106
|
+
#endif
|
|
107
|
+
#ifdef USE_NORMALMAP
|
|
108
|
+
|
|
109
|
+
uniform mat3 normalMapTransform;
|
|
110
|
+
varying vec2 vNormalMapUv;
|
|
111
|
+
|
|
112
|
+
#endif
|
|
113
|
+
#ifdef USE_DISPLACEMENTMAP
|
|
114
|
+
|
|
115
|
+
uniform mat3 displacementMapTransform;
|
|
116
|
+
varying vec2 vDisplacementMapUv;
|
|
117
|
+
|
|
118
|
+
#endif
|
|
119
|
+
#ifdef USE_EMISSIVEMAP
|
|
120
|
+
|
|
121
|
+
uniform mat3 emissiveMapTransform;
|
|
122
|
+
varying vec2 vEmissiveMapUv;
|
|
123
|
+
|
|
124
|
+
#endif
|
|
125
|
+
#ifdef USE_METALNESSMAP
|
|
126
|
+
|
|
127
|
+
uniform mat3 metalnessMapTransform;
|
|
128
|
+
varying vec2 vMetalnessMapUv;
|
|
129
|
+
|
|
130
|
+
#endif
|
|
131
|
+
#ifdef USE_ROUGHNESSMAP
|
|
132
|
+
|
|
133
|
+
uniform mat3 roughnessMapTransform;
|
|
134
|
+
varying vec2 vRoughnessMapUv;
|
|
135
|
+
|
|
136
|
+
#endif
|
|
137
|
+
#ifdef USE_ANISOTROPYMAP
|
|
138
|
+
|
|
139
|
+
uniform mat3 anisotropyMapTransform;
|
|
140
|
+
varying vec2 vAnisotropyMapUv;
|
|
141
|
+
|
|
142
|
+
#endif
|
|
143
|
+
#ifdef USE_CLEARCOATMAP
|
|
144
|
+
|
|
145
|
+
uniform mat3 clearcoatMapTransform;
|
|
146
|
+
varying vec2 vClearcoatMapUv;
|
|
147
|
+
|
|
148
|
+
#endif
|
|
149
|
+
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
150
|
+
|
|
151
|
+
uniform mat3 clearcoatNormalMapTransform;
|
|
152
|
+
varying vec2 vClearcoatNormalMapUv;
|
|
153
|
+
|
|
154
|
+
#endif
|
|
155
|
+
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
156
|
+
|
|
157
|
+
uniform mat3 clearcoatRoughnessMapTransform;
|
|
158
|
+
varying vec2 vClearcoatRoughnessMapUv;
|
|
159
|
+
|
|
160
|
+
#endif
|
|
161
|
+
#ifdef USE_SHEEN_COLORMAP
|
|
162
|
+
|
|
163
|
+
uniform mat3 sheenColorMapTransform;
|
|
164
|
+
varying vec2 vSheenColorMapUv;
|
|
165
|
+
|
|
166
|
+
#endif
|
|
167
|
+
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|
168
|
+
|
|
169
|
+
uniform mat3 sheenRoughnessMapTransform;
|
|
170
|
+
varying vec2 vSheenRoughnessMapUv;
|
|
171
|
+
|
|
172
|
+
#endif
|
|
173
|
+
#ifdef USE_IRIDESCENCEMAP
|
|
174
|
+
|
|
175
|
+
uniform mat3 iridescenceMapTransform;
|
|
176
|
+
varying vec2 vIridescenceMapUv;
|
|
177
|
+
|
|
178
|
+
#endif
|
|
179
|
+
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
180
|
+
|
|
181
|
+
uniform mat3 iridescenceThicknessMapTransform;
|
|
182
|
+
varying vec2 vIridescenceThicknessMapUv;
|
|
183
|
+
|
|
184
|
+
#endif
|
|
185
|
+
#ifdef USE_SPECULARMAP
|
|
186
|
+
|
|
187
|
+
uniform mat3 specularMapTransform;
|
|
188
|
+
varying vec2 vSpecularMapUv;
|
|
189
|
+
|
|
190
|
+
#endif
|
|
191
|
+
#ifdef USE_SPECULAR_COLORMAP
|
|
192
|
+
|
|
193
|
+
uniform mat3 specularColorMapTransform;
|
|
194
|
+
varying vec2 vSpecularColorMapUv;
|
|
195
|
+
|
|
196
|
+
#endif
|
|
197
|
+
#ifdef USE_SPECULAR_INTENSITYMAP
|
|
198
|
+
|
|
199
|
+
uniform mat3 specularIntensityMapTransform;
|
|
200
|
+
varying vec2 vSpecularIntensityMapUv;
|
|
201
|
+
|
|
202
|
+
#endif
|
|
203
|
+
#ifdef USE_TRANSMISSIONMAP
|
|
204
|
+
|
|
205
|
+
uniform mat3 transmissionMapTransform;
|
|
206
|
+
varying vec2 vTransmissionMapUv;
|
|
207
|
+
|
|
208
|
+
#endif
|
|
209
|
+
#ifdef USE_THICKNESSMAP
|
|
210
|
+
|
|
211
|
+
uniform mat3 thicknessMapTransform;
|
|
212
|
+
varying vec2 vThicknessMapUv;
|
|
213
|
+
|
|
214
|
+
#endif
|
|
215
|
+
`,Ip=`
|
|
216
|
+
#ifdef UV_TILE
|
|
217
|
+
attribute float uvTile;
|
|
218
|
+
uniform vec2 tileCount;
|
|
219
|
+
|
|
220
|
+
mat3 makeTileTransform(float uvTile) {
|
|
221
|
+
float col = mod(uvTile, tileCount.x);
|
|
222
|
+
float row = (tileCount.y - floor(uvTile / tileCount.x) - 1.0);
|
|
223
|
+
|
|
224
|
+
return mat3(
|
|
225
|
+
1.0 / tileCount.x, 0.0, 0.0,
|
|
226
|
+
0.0, 1.0 / tileCount.y, 0.0,
|
|
227
|
+
col / tileCount.x, row / tileCount.y, 1.0);
|
|
228
|
+
}
|
|
229
|
+
#else
|
|
230
|
+
mat3 makeTileTransform(float uvTile) {
|
|
231
|
+
return mat3(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
|
|
232
|
+
}
|
|
233
|
+
#endif
|
|
234
|
+
|
|
235
|
+
#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
236
|
+
|
|
237
|
+
varying vec2 vUv;
|
|
238
|
+
#ifdef TILE_BLEND
|
|
239
|
+
varying vec2 vUvNext;
|
|
240
|
+
varying float vUvBlend;
|
|
241
|
+
#endif
|
|
242
|
+
|
|
243
|
+
#endif
|
|
244
|
+
#ifdef USE_MAP
|
|
245
|
+
|
|
246
|
+
uniform mat3 mapTransform;
|
|
247
|
+
varying vec2 vMapUv;
|
|
248
|
+
#ifdef TILE_BLEND
|
|
249
|
+
varying vec2 vMapUvNext;
|
|
250
|
+
#endif
|
|
251
|
+
|
|
252
|
+
#endif
|
|
253
|
+
#ifdef USE_ALPHAMAP
|
|
254
|
+
|
|
255
|
+
uniform mat3 alphaMapTransform;
|
|
256
|
+
varying vec2 vAlphaMapUv;
|
|
257
|
+
|
|
258
|
+
#endif
|
|
259
|
+
#ifdef USE_LIGHTMAP
|
|
260
|
+
|
|
261
|
+
uniform mat3 lightMapTransform;
|
|
262
|
+
varying vec2 vLightMapUv;
|
|
263
|
+
|
|
264
|
+
#endif
|
|
265
|
+
#ifdef USE_AOMAP
|
|
266
|
+
|
|
267
|
+
uniform mat3 aoMapTransform;
|
|
268
|
+
varying vec2 vAoMapUv;
|
|
269
|
+
|
|
270
|
+
#endif
|
|
271
|
+
#ifdef USE_BUMPMAP
|
|
272
|
+
|
|
273
|
+
uniform mat3 bumpMapTransform;
|
|
274
|
+
varying vec2 vBumpMapUv;
|
|
275
|
+
|
|
276
|
+
#endif
|
|
277
|
+
#ifdef USE_NORMALMAP
|
|
278
|
+
|
|
279
|
+
uniform mat3 normalMapTransform;
|
|
280
|
+
varying vec2 vNormalMapUv;
|
|
281
|
+
|
|
282
|
+
#endif
|
|
283
|
+
#ifdef USE_DISPLACEMENTMAP
|
|
284
|
+
|
|
285
|
+
uniform mat3 displacementMapTransform;
|
|
286
|
+
varying vec2 vDisplacementMapUv;
|
|
287
|
+
|
|
288
|
+
#endif
|
|
289
|
+
#ifdef USE_EMISSIVEMAP
|
|
290
|
+
|
|
291
|
+
uniform mat3 emissiveMapTransform;
|
|
292
|
+
varying vec2 vEmissiveMapUv;
|
|
293
|
+
|
|
294
|
+
#endif
|
|
295
|
+
#ifdef USE_METALNESSMAP
|
|
296
|
+
|
|
297
|
+
uniform mat3 metalnessMapTransform;
|
|
298
|
+
varying vec2 vMetalnessMapUv;
|
|
299
|
+
|
|
300
|
+
#endif
|
|
301
|
+
#ifdef USE_ROUGHNESSMAP
|
|
302
|
+
|
|
303
|
+
uniform mat3 roughnessMapTransform;
|
|
304
|
+
varying vec2 vRoughnessMapUv;
|
|
305
|
+
|
|
306
|
+
#endif
|
|
307
|
+
#ifdef USE_ANISOTROPYMAP
|
|
308
|
+
|
|
309
|
+
uniform mat3 anisotropyMapTransform;
|
|
310
|
+
varying vec2 vAnisotropyMapUv;
|
|
311
|
+
|
|
312
|
+
#endif
|
|
313
|
+
#ifdef USE_CLEARCOATMAP
|
|
314
|
+
|
|
315
|
+
uniform mat3 clearcoatMapTransform;
|
|
316
|
+
varying vec2 vClearcoatMapUv;
|
|
317
|
+
|
|
318
|
+
#endif
|
|
319
|
+
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
320
|
+
|
|
321
|
+
uniform mat3 clearcoatNormalMapTransform;
|
|
322
|
+
varying vec2 vClearcoatNormalMapUv;
|
|
323
|
+
|
|
324
|
+
#endif
|
|
325
|
+
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
326
|
+
|
|
327
|
+
uniform mat3 clearcoatRoughnessMapTransform;
|
|
328
|
+
varying vec2 vClearcoatRoughnessMapUv;
|
|
329
|
+
|
|
330
|
+
#endif
|
|
331
|
+
#ifdef USE_SHEEN_COLORMAP
|
|
332
|
+
|
|
333
|
+
uniform mat3 sheenColorMapTransform;
|
|
334
|
+
varying vec2 vSheenColorMapUv;
|
|
335
|
+
|
|
336
|
+
#endif
|
|
337
|
+
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|
338
|
+
|
|
339
|
+
uniform mat3 sheenRoughnessMapTransform;
|
|
340
|
+
varying vec2 vSheenRoughnessMapUv;
|
|
341
|
+
|
|
342
|
+
#endif
|
|
343
|
+
#ifdef USE_IRIDESCENCEMAP
|
|
344
|
+
|
|
345
|
+
uniform mat3 iridescenceMapTransform;
|
|
346
|
+
varying vec2 vIridescenceMapUv;
|
|
347
|
+
|
|
348
|
+
#endif
|
|
349
|
+
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
350
|
+
|
|
351
|
+
uniform mat3 iridescenceThicknessMapTransform;
|
|
352
|
+
varying vec2 vIridescenceThicknessMapUv;
|
|
353
|
+
|
|
354
|
+
#endif
|
|
355
|
+
#ifdef USE_SPECULARMAP
|
|
356
|
+
|
|
357
|
+
uniform mat3 specularMapTransform;
|
|
358
|
+
varying vec2 vSpecularMapUv;
|
|
359
|
+
|
|
360
|
+
#endif
|
|
361
|
+
#ifdef USE_SPECULAR_COLORMAP
|
|
362
|
+
|
|
363
|
+
uniform mat3 specularColorMapTransform;
|
|
364
|
+
varying vec2 vSpecularColorMapUv;
|
|
365
|
+
|
|
366
|
+
#endif
|
|
367
|
+
#ifdef USE_SPECULAR_INTENSITYMAP
|
|
368
|
+
|
|
369
|
+
uniform mat3 specularIntensityMapTransform;
|
|
370
|
+
varying vec2 vSpecularIntensityMapUv;
|
|
371
|
+
|
|
372
|
+
#endif
|
|
373
|
+
#ifdef USE_TRANSMISSIONMAP
|
|
374
|
+
|
|
375
|
+
uniform mat3 transmissionMapTransform;
|
|
376
|
+
varying vec2 vTransmissionMapUv;
|
|
377
|
+
|
|
378
|
+
#endif
|
|
379
|
+
#ifdef USE_THICKNESSMAP
|
|
380
|
+
|
|
381
|
+
uniform mat3 thicknessMapTransform;
|
|
382
|
+
varying vec2 vThicknessMapUv;
|
|
383
|
+
|
|
384
|
+
#endif
|
|
385
|
+
`,Lp=`
|
|
386
|
+
#ifdef UV_TILE
|
|
387
|
+
mat3 tileTransform = makeTileTransform(floor(uvTile));
|
|
388
|
+
#ifdef TILE_BLEND
|
|
389
|
+
mat3 nextTileTransform = makeTileTransform(ceil(uvTile));
|
|
390
|
+
vUvBlend = fract(uvTile);
|
|
391
|
+
#endif
|
|
392
|
+
#else
|
|
393
|
+
mat3 tileTransform = makeTileTransform(0.0);
|
|
394
|
+
#endif
|
|
395
|
+
|
|
396
|
+
#if defined( USE_UV ) || defined( USE_ANISOTROPY )
|
|
397
|
+
|
|
398
|
+
vUv = (tileTransform *vec3( uv, 1 )).xy;
|
|
399
|
+
#if defined( TILE_BLEND ) && defined( UV_TILE )
|
|
400
|
+
vUvNext = (nextTileTransform *vec3( uv, 1 )).xy;
|
|
401
|
+
#endif
|
|
402
|
+
|
|
403
|
+
#endif
|
|
404
|
+
#ifdef USE_MAP
|
|
405
|
+
|
|
406
|
+
vMapUv = ( tileTransform * (mapTransform * vec3( MAP_UV, 1 ) )).xy;
|
|
407
|
+
#if defined( TILE_BLEND ) && defined( UV_TILE )
|
|
408
|
+
vMapUvNext = (nextTileTransform * (mapTransform * vec3( MAP_UV, 1 ))).xy;
|
|
409
|
+
#endif
|
|
410
|
+
|
|
411
|
+
#endif
|
|
412
|
+
#ifdef USE_ALPHAMAP
|
|
413
|
+
|
|
414
|
+
vAlphaMapUv = ( tileTransform * (alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) )).xy;
|
|
415
|
+
|
|
416
|
+
#endif
|
|
417
|
+
#ifdef USE_LIGHTMAP
|
|
418
|
+
|
|
419
|
+
vLightMapUv = ( tileTransform * (lightMapTransform * vec3( LIGHTMAP_UV, 1 ) )).xy;
|
|
420
|
+
|
|
421
|
+
#endif
|
|
422
|
+
#ifdef USE_AOMAP
|
|
423
|
+
|
|
424
|
+
vAoMapUv = ( tileTransform * (aoMapTransform * vec3( AOMAP_UV, 1 ) )).xy;
|
|
425
|
+
|
|
426
|
+
#endif
|
|
427
|
+
#ifdef USE_BUMPMAP
|
|
428
|
+
|
|
429
|
+
vBumpMapUv = ( tileTransform * (bumpMapTransform * vec3( BUMPMAP_UV, 1 ) )).xy;
|
|
430
|
+
|
|
431
|
+
#endif
|
|
432
|
+
#ifdef USE_NORMALMAP
|
|
433
|
+
|
|
434
|
+
vNormalMapUv = ( tileTransform * (normalMapTransform * vec3( NORMALMAP_UV, 1 ) )).xy;
|
|
435
|
+
|
|
436
|
+
#endif
|
|
437
|
+
#ifdef USE_DISPLACEMENTMAP
|
|
438
|
+
|
|
439
|
+
vDisplacementMapUv = ( tileTransform * (displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) )).xy;
|
|
440
|
+
|
|
441
|
+
#endif
|
|
442
|
+
#ifdef USE_EMISSIVEMAP
|
|
443
|
+
|
|
444
|
+
vEmissiveMapUv = ( tileTransform * (emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) )).xy;
|
|
445
|
+
|
|
446
|
+
#endif
|
|
447
|
+
#ifdef USE_METALNESSMAP
|
|
448
|
+
|
|
449
|
+
vMetalnessMapUv = ( tileTransform * (metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) )).xy;
|
|
450
|
+
|
|
451
|
+
#endif
|
|
452
|
+
#ifdef USE_ROUGHNESSMAP
|
|
453
|
+
|
|
454
|
+
vRoughnessMapUv = ( tileTransform * (roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) )).xy;
|
|
455
|
+
|
|
456
|
+
#endif
|
|
457
|
+
#ifdef USE_ANISOTROPYMAP
|
|
458
|
+
|
|
459
|
+
vAnisotropyMapUv = ( tileTransform * (anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) )).xy;
|
|
460
|
+
|
|
461
|
+
#endif
|
|
462
|
+
#ifdef USE_CLEARCOATMAP
|
|
463
|
+
|
|
464
|
+
vClearcoatMapUv = ( tileTransform * (clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) )).xy;
|
|
465
|
+
|
|
466
|
+
#endif
|
|
467
|
+
#ifdef USE_CLEARCOAT_NORMALMAP
|
|
468
|
+
|
|
469
|
+
vClearcoatNormalMapUv = ( tileTransform * (clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) )).xy;
|
|
470
|
+
|
|
471
|
+
#endif
|
|
472
|
+
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
|
|
473
|
+
|
|
474
|
+
vClearcoatRoughnessMapUv = ( tileTransform * (clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) )).xy;
|
|
475
|
+
|
|
476
|
+
#endif
|
|
477
|
+
#ifdef USE_IRIDESCENCEMAP
|
|
478
|
+
|
|
479
|
+
vIridescenceMapUv = ( tileTransform * (iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) )).xy;
|
|
480
|
+
|
|
481
|
+
#endif
|
|
482
|
+
#ifdef USE_IRIDESCENCE_THICKNESSMAP
|
|
483
|
+
|
|
484
|
+
vIridescenceThicknessMapUv = ( tileTransform * (iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) )).xy;
|
|
485
|
+
|
|
486
|
+
#endif
|
|
487
|
+
#ifdef USE_SHEEN_COLORMAP
|
|
488
|
+
|
|
489
|
+
vSheenColorMapUv = ( tileTransform * (sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) )).xy;
|
|
490
|
+
|
|
491
|
+
#endif
|
|
492
|
+
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|
493
|
+
|
|
494
|
+
vSheenRoughnessMapUv = ( tileTransform * (sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) )).xy;
|
|
495
|
+
|
|
496
|
+
#endif
|
|
497
|
+
#ifdef USE_SPECULARMAP
|
|
498
|
+
|
|
499
|
+
vSpecularMapUv = ( tileTransform * (specularMapTransform * vec3( SPECULARMAP_UV, 1 ) )).xy;
|
|
500
|
+
|
|
501
|
+
#endif
|
|
502
|
+
#ifdef USE_SPECULAR_COLORMAP
|
|
503
|
+
|
|
504
|
+
vSpecularColorMapUv = ( tileTransform * (specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) )).xy;
|
|
505
|
+
|
|
506
|
+
#endif
|
|
507
|
+
#ifdef USE_SPECULAR_INTENSITYMAP
|
|
508
|
+
|
|
509
|
+
vSpecularIntensityMapUv = ( tileTransform * (specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) )).xy;
|
|
510
|
+
|
|
511
|
+
#endif
|
|
512
|
+
#ifdef USE_TRANSMISSIONMAP
|
|
513
|
+
|
|
514
|
+
vTransmissionMapUv = ( tileTransform * transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) )).xy;
|
|
515
|
+
|
|
516
|
+
#endif
|
|
517
|
+
#ifdef USE_THICKNESSMAP
|
|
518
|
+
|
|
519
|
+
vThicknessMapUv = ( tileTransform * thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) )).xy;
|
|
520
|
+
|
|
521
|
+
#endif
|
|
522
|
+
|
|
523
|
+
`;const Jt=Yd;function Bp(){Jt.tile_pars_vertex=Ip,Jt.tile_vertex=Lp,Jt.tile_pars_fragment=Rp,Jt.tile_fragment=kp,Jt.soft_pars_vertex=Op,Jt.soft_vertex=Tp,Jt.soft_pars_fragment=Ep,Jt.soft_fragment=zp}class Fp extends Rt{constructor(e){super(),this.type="ParticleEmitter",this.system=e}clone(){const e=this.system.clone();return e.emitter.copy(this,!0),e.emitter}dispose(){}extractFromCache(e){const t=[];for(const i in e){const s=e[i];delete s.metadata,t.push(s)}return t}toJSON(e,t={}){const i=this.children;this.children=this.children.filter(r=>r.type!=="ParticleSystemPreview");const s=super.toJSON(e);return this.children=i,this.system!==null&&(s.object.ps=this.system.toJSON(e,t)),s}}var B;(function(o){o[o.BillBoard=0]="BillBoard",o[o.StretchedBillBoard=1]="StretchedBillBoard",o[o.Mesh=2]="Mesh",o[o.Trail=3]="Trail",o[o.HorizontalBillBoard=4]="HorizontalBillBoard",o[o.VerticalBillBoard=5]="VerticalBillBoard"})(B||(B={}));class wc extends O{constructor(e){super(),this.type="VFXBatch",this.maxParticles=1e3,this.systems=new Set;const t=new Nr;t.mask=e.layers.mask;const i=e.material.clone();i.defines={},Object.assign(i.defines,e.material.defines),this.settings={instancingGeometry:e.instancingGeometry,renderMode:e.renderMode,renderOrder:e.renderOrder,material:i,uTileCount:e.uTileCount,vTileCount:e.vTileCount,blendTiles:e.blendTiles,softParticles:e.softParticles,softNearFade:e.softNearFade,softFarFade:e.softFarFade,layers:t},this.frustumCulled=!1,this.renderOrder=this.settings.renderOrder}addSystem(e){this.systems.add(e)}removeSystem(e){this.systems.delete(e)}applyDepthTexture(e){const t=this.material.uniforms.depthTexture;t&&t.value!==e&&(t.value=e,this.material.needsUpdate=!0)}getVisibleSystems(){return Array.from(this.systems).filter(e=>e.emitter.visible)}}const Np=new N(0,0,1),In=new te,Hp=new N,Dp=new N;new N;const nl=60,Ir=new vo(1,1,1,1);class Qr{set time(e){this.emissionState.time=e}get time(){return this.emissionState.time}get layers(){return this.rendererSettings.layers}get texture(){return this.rendererSettings.material.map}set texture(e){this.rendererSettings.material.map=e,this.neededToUpdateRender=!0}get material(){return this.rendererSettings.material}set material(e){this.rendererSettings.material=e,this.neededToUpdateRender=!0}get uTileCount(){return this.rendererSettings.uTileCount}set uTileCount(e){this.rendererSettings.uTileCount=e,this.neededToUpdateRender=!0}get vTileCount(){return this.rendererSettings.vTileCount}set vTileCount(e){this.rendererSettings.vTileCount=e,this.neededToUpdateRender=!0}get blendTiles(){return this.rendererSettings.blendTiles}set blendTiles(e){this.rendererSettings.blendTiles=e,this.neededToUpdateRender=!0}get softParticles(){return this.rendererSettings.softParticles}set softParticles(e){this.rendererSettings.softParticles=e,this.neededToUpdateRender=!0}get softNearFade(){return this.rendererSettings.softNearFade}set softNearFade(e){this.rendererSettings.softNearFade=e,this.neededToUpdateRender=!0}get softFarFade(){return this.rendererSettings.softFarFade}set softFarFade(e){this.rendererSettings.softFarFade=e,this.neededToUpdateRender=!0}get instancingGeometry(){return this.rendererSettings.instancingGeometry}set instancingGeometry(e){this.restart(),this.particles.length=0,this.rendererSettings.instancingGeometry=e,this.neededToUpdateRender=!0}get renderMode(){return this.rendererSettings.renderMode}set renderMode(e){if(this.rendererSettings.renderMode!==e){let t=!1;switch(this.rendererSettings.renderMode===B.Trail&&(t=!0),this.rendererSettings.renderMode===B.Mesh&&(this.startRotation=new ie(0)),e){case B.Trail:this.rendererEmitterSettings={startLength:new ie(30),followLocalOrigin:!1},t=!0;break;case B.Mesh:this.rendererEmitterSettings={geometry:Ir},this.startRotation=new Cs(new N(0,1,0),new ie(0));break;case B.StretchedBillBoard:this.rendererEmitterSettings={speedFactor:0,lengthFactor:2},this.rendererSettings.instancingGeometry=Ir;break;case B.BillBoard:case B.VerticalBillBoard:case B.HorizontalBillBoard:this.rendererEmitterSettings={},this.rendererSettings.instancingGeometry=Ir;break}this.rendererSettings.renderMode=e,t&&(this.restart(),this.particles.length=0),this.neededToUpdateRender=!0}}get renderOrder(){return this.rendererSettings.renderOrder}set renderOrder(e){this.rendererSettings.renderOrder=e,this.neededToUpdateRender=!0}get blending(){return this.rendererSettings.material.blending}set blending(e){this.rendererSettings.material.blending=e,this.neededToUpdateRender=!0}constructor(e){if(this.temp=new N,this.travelDistance=0,this.normalMatrix=new Mt,this.memory=[],this.listeners={},this.firstTimeUpdate=!0,this.autoDestroy=e.autoDestroy===void 0?!1:e.autoDestroy,this.duration=e.duration??1,this.looping=e.looping===void 0?!0:e.looping,this.prewarm=e.prewarm===void 0?!1:e.prewarm,this.startLife=e.startLife??new ie(5),this.startSpeed=e.startSpeed??new ie(0),this.startRotation=e.startRotation??new ie(0),this.startSize=e.startSize??new ie(1),this.startColor=e.startColor??new Xi(new Qe(1,1,1,1)),this.emissionOverTime=e.emissionOverTime??new ie(10),this.emissionOverDistance=e.emissionOverDistance??new ie(0),this.emissionBursts=e.emissionBursts??[],this.onlyUsedByOther=e.onlyUsedByOther??!1,this.emitterShape=e.shape??new qi,this.behaviors=e.behaviors??new Array,this.worldSpace=e.worldSpace??!1,this.rendererEmitterSettings=e.rendererEmitterSettings??{},e.renderMode===B.StretchedBillBoard){const t=this.rendererEmitterSettings;e.speedFactor!==void 0&&(t.speedFactor=e.speedFactor),t.speedFactor=t.speedFactor??0,t.lengthFactor=t.lengthFactor??0}this.rendererSettings={instancingGeometry:e.instancingGeometry??Ir,renderMode:e.renderMode??B.BillBoard,renderOrder:e.renderOrder??0,material:e.material,uTileCount:e.uTileCount??1,vTileCount:e.vTileCount??1,blendTiles:e.blendTiles??!1,softParticles:e.softParticles??!1,softNearFade:e.softNearFade??0,softFarFade:e.softFarFade??0,layers:e.layers??new Nr},this.neededToUpdateRender=!0,this.particles=new Array,this.startTileIndex=e.startTileIndex||new ie(0),this.emitter=new Fp(this),this.paused=!1,this.particleNum=0,this.emissionState={isBursting:!1,burstParticleIndex:0,burstParticleCount:0,burstIndex:0,burstWaveIndex:0,time:0,waitEmiting:0,travelDistance:0},this.emissionBursts.forEach(t=>t.count.startGen(this.memory)),this.emissionOverDistance.startGen(this.memory),this.emitEnded=!1,this.markForDestroy=!1,this.prewarmed=!1}pause(){this.paused=!0}play(){this.paused=!1}stop(){this.restart(),this.pause()}spawn(e,t,i){In.setFromRotationMatrix(i);const s=Hp,r=In,n=Dp;i.decompose(s,r,n);for(let a=0;a<e;a++){for(t.burstParticleIndex=a,this.particleNum++;this.particles.length<this.particleNum;)this.rendererSettings.renderMode===B.Trail?this.particles.push(new lo):this.particles.push(new gp);const l=this.particles[this.particleNum-1];if(l.reset(),l.speedModifier=1,this.startColor.startGen(l.memory),this.startColor.genColor(l.memory,l.startColor,this.emissionState.time),l.color.copy(l.startColor),this.startSpeed.startGen(l.memory),l.startSpeed=this.startSpeed.genValue(l.memory,t.time/this.duration),this.startLife.startGen(l.memory),l.life=this.startLife.genValue(l.memory,t.time/this.duration),l.age=0,this.startSize.startGen(l.memory),this.startSize.type==="vec3function")this.startSize.genValue(l.memory,l.startSize,t.time/this.duration);else{const c=this.startSize.genValue(l.memory,t.time/this.duration);l.startSize.set(c,c,c)}if(this.startTileIndex.startGen(l.memory),l.uvTile=this.startTileIndex.genValue(l.memory),l.size.copy(l.startSize),this.rendererSettings.renderMode===B.Mesh||this.rendererSettings.renderMode===B.BillBoard||this.rendererSettings.renderMode===B.VerticalBillBoard||this.rendererSettings.renderMode===B.HorizontalBillBoard||this.rendererSettings.renderMode===B.StretchedBillBoard){const c=l;this.startRotation.startGen(l.memory),this.rendererSettings.renderMode===B.Mesh?(c.rotation instanceof te||(c.rotation=new te),this.startRotation.type==="rotation"?this.startRotation.genValue(l.memory,c.rotation,1,t.time/this.duration):c.rotation.setFromAxisAngle(Np,this.startRotation.genValue(c.memory,t.time/this.duration))):this.startRotation.type==="rotation"?c.rotation=0:c.rotation=this.startRotation.genValue(c.memory,t.time/this.duration)}else if(this.rendererSettings.renderMode===B.Trail){const c=l;this.rendererEmitterSettings.startLength.startGen(c.memory),c.length=this.rendererEmitterSettings.startLength.genValue(c.memory,t.time/this.duration)}if(this.emitterShape.initialize(l,t),this.rendererSettings.renderMode===B.Trail&&this.rendererEmitterSettings.followLocalOrigin){const c=l;c.localPosition=new N().copy(c.position)}this.worldSpace?(l.position.applyMatrix4(i),l.startSize.multiply(n).abs(),l.size.copy(l.startSize),l.velocity.multiply(n).applyMatrix3(this.normalMatrix),l.rotation&&l.rotation instanceof te&&l.rotation.multiplyQuaternions(In,l.rotation)):this.onlyUsedByOther&&(l.parentMatrix=i);for(let c=0;c<this.behaviors.length;c++)this.behaviors[c].initialize(l,this)}}endEmit(){this.emitEnded=!0,this.autoDestroy&&(this.markForDestroy=!0),this.fire({type:"emitEnd",particleSystem:this})}dispose(){this._renderer&&this._renderer.deleteSystem(this),this.emitter.dispose(),this.emitter.parent&&this.emitter.parent.remove(this.emitter),this.fire({type:"destroy",particleSystem:this})}restart(){this.memory.length=0,this.paused=!1,this.particleNum=0,this.emissionState.isBursting=!1,this.emissionState.burstIndex=0,this.emissionState.burstWaveIndex=0,this.emissionState.time=0,this.emissionState.waitEmiting=0,this.behaviors.forEach(e=>{e.reset()}),this.emitEnded=!1,this.markForDestroy=!1,this.prewarmed=!1,this.emissionBursts.forEach(e=>e.count.startGen(this.memory)),this.emissionOverDistance.startGen(this.memory)}update(e){if(this.paused)return;let t=this.emitter;for(;t.parent;)t=t.parent;if(t.type!=="Scene"){this.dispose();return}if(this.firstTimeUpdate&&(this.firstTimeUpdate=!1,this.emitter.updateWorldMatrix(!0,!1)),this.emitEnded&&this.particleNum===0){this.markForDestroy&&this.emitter.parent&&this.dispose();return}if(this.looping&&this.prewarm&&!this.prewarmed){this.prewarmed=!0;for(let i=0;i<this.duration*nl;i++)this.update(1/nl)}e>.1&&(e=.1),this.neededToUpdateRender&&(this._renderer&&this._renderer.updateSystem(this),this.neededToUpdateRender=!1),this.onlyUsedByOther||this.emit(e,this.emissionState,this.emitter.matrixWorld),this.emitterShape.update(this,e);for(let i=0;i<this.behaviors.length;i++){this.behaviors[i].frameUpdate(e);for(let s=0;s<this.particleNum;s++)this.particles[s].died||this.behaviors[i].update(this.particles[s],e)}for(let i=0;i<this.particleNum;i++)this.rendererEmitterSettings.followLocalOrigin&&this.particles[i].localPosition?(this.particles[i].position.copy(this.particles[i].localPosition),this.particles[i].parentMatrix?this.particles[i].position.applyMatrix4(this.particles[i].parentMatrix):this.particles[i].position.applyMatrix4(this.emitter.matrixWorld)):this.particles[i].position.addScaledVector(this.particles[i].velocity,e*this.particles[i].speedModifier),this.particles[i].age+=e;if(this.rendererSettings.renderMode===B.Trail)for(let i=0;i<this.particleNum;i++)this.particles[i].update();for(let i=0;i<this.particleNum;i++){const s=this.particles[i];s.died&&(!(s instanceof lo)||s.previous.length===0)&&(this.particles[i]=this.particles[this.particleNum-1],this.particles[this.particleNum-1]=s,this.particleNum--,i--,this.fire({type:"particleDied",particleSystem:this,particle:s}))}}emit(e,t,i){t.time>this.duration&&(this.looping?(t.time-=this.duration,t.burstIndex=0,this.behaviors.forEach(r=>{r.reset()})):!this.emitEnded&&!this.onlyUsedByOther&&this.endEmit()),this.normalMatrix.getNormalMatrix(i);const s=Math.ceil(t.waitEmiting);for(this.spawn(s,t,i),t.waitEmiting-=s;t.burstIndex<this.emissionBursts.length&&this.emissionBursts[t.burstIndex].time<=t.time;){if(Math.random()<this.emissionBursts[t.burstIndex].probability){const r=this.emissionBursts[t.burstIndex].count.genValue(this.memory,this.time);t.isBursting=!0,t.burstParticleCount=r,this.spawn(r,t,i),t.isBursting=!1}t.burstIndex++}if(!this.emitEnded&&(t.waitEmiting+=e*this.emissionOverTime.genValue(this.memory,t.time/this.duration),t.previousWorldPos!=null)){this.temp.set(i.elements[12],i.elements[13],i.elements[14]),t.travelDistance+=t.previousWorldPos.distanceTo(this.temp);const r=this.emissionOverDistance.genValue(this.memory,t.time/this.duration);if(t.travelDistance*r>0){const n=Math.floor(t.travelDistance*r);t.travelDistance-=n/r,t.waitEmiting+=n}}t.previousWorldPos===void 0&&(t.previousWorldPos=new N),t.previousWorldPos.set(i.elements[12],i.elements[13],i.elements[14]),t.time+=e}toJSON(e,t={}){if((e===void 0||typeof e=="string")&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}}),e.materials[this.rendererSettings.material.uuid]=this.rendererSettings.material.toJSON(e),t.useUrlForImage&&this.texture?.source!==void 0){const n=this.texture.source;e.images[n.uuid]={uuid:n.uuid,url:this.texture.image.url}}let s;this.renderMode===B.Trail?s={startLength:this.rendererEmitterSettings.startLength.toJSON(),followLocalOrigin:this.rendererEmitterSettings.followLocalOrigin}:this.renderMode===B.Mesh?s={}:this.renderMode===B.StretchedBillBoard?s={speedFactor:this.rendererEmitterSettings.speedFactor,lengthFactor:this.rendererEmitterSettings.lengthFactor}:s={};const r=this.rendererSettings.instancingGeometry;return e.geometries&&!e.geometries[r.uuid]&&(e.geometries[r.uuid]=r.toJSON()),{version:"3.0",autoDestroy:this.autoDestroy,looping:this.looping,prewarm:this.prewarm,duration:this.duration,shape:this.emitterShape.toJSON(),startLife:this.startLife.toJSON(),startSpeed:this.startSpeed.toJSON(),startRotation:this.startRotation.toJSON(),startSize:this.startSize.toJSON(),startColor:this.startColor.toJSON(),emissionOverTime:this.emissionOverTime.toJSON(),emissionOverDistance:this.emissionOverDistance.toJSON(),emissionBursts:this.emissionBursts.map(n=>({time:n.time,count:n.count.toJSON(),probability:n.probability,interval:n.interval,cycle:n.cycle})),onlyUsedByOther:this.onlyUsedByOther,instancingGeometry:this.rendererSettings.instancingGeometry.uuid,renderOrder:this.renderOrder,renderMode:this.renderMode,rendererEmitterSettings:s,material:this.rendererSettings.material.uuid,layers:this.layers.mask,startTileIndex:this.startTileIndex.toJSON(),uTileCount:this.uTileCount,vTileCount:this.vTileCount,blendTiles:this.blendTiles,softParticles:this.rendererSettings.softParticles,softFarFade:this.rendererSettings.softFarFade,softNearFade:this.rendererSettings.softNearFade,behaviors:this.behaviors.map(n=>n.toJSON()),worldSpace:this.worldSpace}}static fromJSON(e,t,i){const s=fp(e.shape,t);let r;if(e.renderMode===B.Trail){const l=e.rendererEmitterSettings;r={startLength:l.startLength!=null?q(l.startLength):new ie(30),followLocalOrigin:l.followLocalOrigin}}else e.renderMode===B.Mesh?r={}:e.renderMode===B.StretchedBillBoard?(r=e.rendererEmitterSettings,e.speedFactor!=null&&(r.speedFactor=e.speedFactor)):r={};const n=new Nr;e.layers&&(n.mask=e.layers);const a=new Qr({autoDestroy:e.autoDestroy,looping:e.looping,prewarm:e.prewarm,duration:e.duration,shape:s,startLife:q(e.startLife),startSpeed:q(e.startSpeed),startRotation:Jr(e.startRotation),startSize:Jr(e.startSize),startColor:Po(e.startColor),emissionOverTime:q(e.emissionOverTime),emissionOverDistance:q(e.emissionOverDistance),emissionBursts:e.emissionBursts?.map(l=>({time:l.time,count:typeof l.count=="number"?new ie(l.count):q(l.count),probability:l.probability??1,interval:l.interval??.1,cycle:l.cycle??1})),onlyUsedByOther:e.onlyUsedByOther,instancingGeometry:t.geometries[e.instancingGeometry],renderMode:e.renderMode,rendererEmitterSettings:r,renderOrder:e.renderOrder,layers:n,material:e.material?t.materials[e.material]:e.texture?new Le({map:t.textures[e.texture],transparent:e.transparent??!0,blending:e.blending,side:Di}):new Le({color:16777215,transparent:!0,blending:rc,side:Di}),startTileIndex:typeof e.startTileIndex=="number"?new ie(e.startTileIndex):q(e.startTileIndex),uTileCount:e.uTileCount,vTileCount:e.vTileCount,blendTiles:e.blendTiles,softParticles:e.softParticles,softFarFade:e.softFarFade,softNearFade:e.softNearFade,behaviors:[],worldSpace:e.worldSpace});return a.behaviors=e.behaviors.map(l=>{const c=Mp(l,a);return c&&c.type==="EmitSubParticleSystem"&&(i[l.subParticleSystem]=c),c}).filter(l=>l!==null),a}addBehavior(e){this.behaviors.push(e)}getRendererSettings(){return this.rendererSettings}addEventListener(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}removeAllEventListeners(e){this.listeners[e]&&(this.listeners[e]=[])}removeEventListener(e,t){if(this.listeners[e]){const i=this.listeners[e].indexOf(t);i!==-1&&this.listeners[e].splice(i,1)}}fire(e){this.listeners[e.type]&&this.listeners[e.type].forEach(t=>t(e))}clone(){const e=[];for(const r of this.emissionBursts){const n={};Object.assign(n,r),e.push(n)}const t=[];for(const r of this.behaviors)t.push(r.clone());let i;this.renderMode===B.Trail?i={startLength:this.rendererEmitterSettings.startLength.clone(),followLocalOrigin:this.rendererEmitterSettings.followLocalOrigin}:this.renderMode===B.StretchedBillBoard?i={lengthFactor:this.rendererEmitterSettings.lengthFactor,speedFactor:this.rendererEmitterSettings.speedFactor}:i={};const s=new Nr;return s.mask=this.layers.mask,new Qr({autoDestroy:this.autoDestroy,looping:this.looping,duration:this.duration,shape:this.emitterShape.clone(),startLife:this.startLife.clone(),startSpeed:this.startSpeed.clone(),startRotation:this.startRotation.clone(),startSize:this.startSize.clone(),startColor:this.startColor.clone(),emissionOverTime:this.emissionOverTime.clone(),emissionOverDistance:this.emissionOverDistance.clone(),emissionBursts:e,onlyUsedByOther:this.onlyUsedByOther,instancingGeometry:this.rendererSettings.instancingGeometry,renderMode:this.renderMode,renderOrder:this.renderOrder,rendererEmitterSettings:i,material:this.rendererSettings.material,startTileIndex:this.startTileIndex,uTileCount:this.uTileCount,vTileCount:this.vTileCount,blendTiles:this.blendTiles,softParticles:this.softParticles,softFarFade:this.softFarFade,softNearFade:this.softNearFade,behaviors:t,worldSpace:this.worldSpace,layers:s})}}var Ln=`
|
|
524
|
+
|
|
525
|
+
#include <common>
|
|
526
|
+
#include <color_pars_fragment>
|
|
527
|
+
#include <map_pars_fragment>
|
|
528
|
+
#include <logdepthbuf_pars_fragment>
|
|
529
|
+
#include <clipping_planes_pars_fragment>
|
|
530
|
+
#include <alphatest_pars_fragment>
|
|
531
|
+
|
|
532
|
+
#include <tile_pars_fragment>
|
|
533
|
+
#include <soft_pars_fragment>
|
|
534
|
+
|
|
535
|
+
void main() {
|
|
536
|
+
|
|
537
|
+
#include <clipping_planes_fragment>
|
|
538
|
+
|
|
539
|
+
vec3 outgoingLight = vec3( 0.0 );
|
|
540
|
+
vec4 diffuseColor = vColor;
|
|
541
|
+
|
|
542
|
+
#include <logdepthbuf_fragment>
|
|
543
|
+
|
|
544
|
+
#include <tile_fragment>
|
|
545
|
+
#include <alphatest_fragment>
|
|
546
|
+
|
|
547
|
+
outgoingLight = diffuseColor.rgb;
|
|
548
|
+
|
|
549
|
+
#ifdef USE_COLOR_AS_ALPHA
|
|
550
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.r );
|
|
551
|
+
#else
|
|
552
|
+
gl_FragColor = vec4( outgoingLight, diffuseColor.a );
|
|
553
|
+
#endif
|
|
554
|
+
|
|
555
|
+
#include <soft_fragment>
|
|
556
|
+
#include <tonemapping_fragment>
|
|
557
|
+
}
|
|
558
|
+
`,Ao=`
|
|
559
|
+
#define STANDARD
|
|
560
|
+
|
|
561
|
+
#ifdef PHYSICAL
|
|
562
|
+
#define IOR
|
|
563
|
+
#define USE_SPECULAR
|
|
564
|
+
#endif
|
|
565
|
+
|
|
566
|
+
uniform vec3 diffuse;
|
|
567
|
+
uniform vec3 emissive;
|
|
568
|
+
uniform float roughness;
|
|
569
|
+
uniform float metalness;
|
|
570
|
+
uniform float opacity;
|
|
571
|
+
|
|
572
|
+
#ifdef IOR
|
|
573
|
+
uniform float ior;
|
|
574
|
+
#endif
|
|
575
|
+
|
|
576
|
+
#ifdef USE_SPECULAR
|
|
577
|
+
uniform float specularIntensity;
|
|
578
|
+
uniform vec3 specularColor;
|
|
579
|
+
|
|
580
|
+
#ifdef USE_SPECULAR_COLORMAP
|
|
581
|
+
uniform sampler2D specularColorMap;
|
|
582
|
+
#endif
|
|
583
|
+
|
|
584
|
+
#ifdef USE_SPECULAR_INTENSITYMAP
|
|
585
|
+
uniform sampler2D specularIntensityMap;
|
|
586
|
+
#endif
|
|
587
|
+
#endif
|
|
588
|
+
|
|
589
|
+
#ifdef USE_CLEARCOAT
|
|
590
|
+
uniform float clearcoat;
|
|
591
|
+
uniform float clearcoatRoughness;
|
|
592
|
+
#endif
|
|
593
|
+
|
|
594
|
+
#ifdef USE_DISPERSION
|
|
595
|
+
uniform float dispersion;
|
|
596
|
+
#endif
|
|
597
|
+
|
|
598
|
+
#ifdef USE_IRIDESCENCE
|
|
599
|
+
uniform float iridescence;
|
|
600
|
+
uniform float iridescenceIOR;
|
|
601
|
+
uniform float iridescenceThicknessMinimum;
|
|
602
|
+
uniform float iridescenceThicknessMaximum;
|
|
603
|
+
#endif
|
|
604
|
+
|
|
605
|
+
#ifdef USE_SHEEN
|
|
606
|
+
uniform vec3 sheenColor;
|
|
607
|
+
uniform float sheenRoughness;
|
|
608
|
+
|
|
609
|
+
#ifdef USE_SHEEN_COLORMAP
|
|
610
|
+
uniform sampler2D sheenColorMap;
|
|
611
|
+
#endif
|
|
612
|
+
|
|
613
|
+
#ifdef USE_SHEEN_ROUGHNESSMAP
|
|
614
|
+
uniform sampler2D sheenRoughnessMap;
|
|
615
|
+
#endif
|
|
616
|
+
#endif
|
|
617
|
+
|
|
618
|
+
#ifdef USE_ANISOTROPY
|
|
619
|
+
uniform vec2 anisotropyVector;
|
|
620
|
+
|
|
621
|
+
#ifdef USE_ANISOTROPYMAP
|
|
622
|
+
uniform sampler2D anisotropyMap;
|
|
623
|
+
#endif
|
|
624
|
+
#endif
|
|
625
|
+
|
|
626
|
+
varying vec3 vViewPosition;
|
|
627
|
+
|
|
628
|
+
#include <common>
|
|
629
|
+
#include <packing>
|
|
630
|
+
#include <dithering_pars_fragment>
|
|
631
|
+
#include <color_pars_fragment>
|
|
632
|
+
#include <uv_pars_fragment>
|
|
633
|
+
#include <map_pars_fragment>
|
|
634
|
+
#include <alphamap_pars_fragment>
|
|
635
|
+
#include <alphatest_pars_fragment>
|
|
636
|
+
#include <alphahash_pars_fragment>
|
|
637
|
+
#include <aomap_pars_fragment>
|
|
638
|
+
#include <lightmap_pars_fragment>
|
|
639
|
+
#include <emissivemap_pars_fragment>
|
|
640
|
+
#include <iridescence_fragment>
|
|
641
|
+
#include <cube_uv_reflection_fragment>
|
|
642
|
+
#include <envmap_common_pars_fragment>
|
|
643
|
+
#include <envmap_physical_pars_fragment>
|
|
644
|
+
#include <fog_pars_fragment>
|
|
645
|
+
#include <lights_pars_begin>
|
|
646
|
+
#include <normal_pars_fragment>
|
|
647
|
+
#include <lights_physical_pars_fragment>
|
|
648
|
+
#include <transmission_pars_fragment>
|
|
649
|
+
#include <shadowmap_pars_fragment>
|
|
650
|
+
#include <bumpmap_pars_fragment>
|
|
651
|
+
#include <normalmap_pars_fragment>
|
|
652
|
+
#include <clearcoat_pars_fragment>
|
|
653
|
+
#include <iridescence_pars_fragment>
|
|
654
|
+
#include <roughnessmap_pars_fragment>
|
|
655
|
+
#include <metalnessmap_pars_fragment>
|
|
656
|
+
#include <logdepthbuf_pars_fragment>
|
|
657
|
+
#include <clipping_planes_pars_fragment>
|
|
658
|
+
|
|
659
|
+
void main() {
|
|
660
|
+
|
|
661
|
+
vec4 diffuseColor = vec4( diffuse, opacity );
|
|
662
|
+
#include <clipping_planes_fragment>
|
|
663
|
+
|
|
664
|
+
ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
|
|
665
|
+
vec3 totalEmissiveRadiance = emissive;
|
|
666
|
+
|
|
667
|
+
#include <logdepthbuf_fragment>
|
|
668
|
+
#include <map_fragment>
|
|
669
|
+
#include <color_fragment>
|
|
670
|
+
#include <alphamap_fragment>
|
|
671
|
+
#include <alphatest_fragment>
|
|
672
|
+
#include <alphahash_fragment>
|
|
673
|
+
#include <roughnessmap_fragment>
|
|
674
|
+
#include <metalnessmap_fragment>
|
|
675
|
+
#include <normal_fragment_begin>
|
|
676
|
+
#include <normal_fragment_maps>
|
|
677
|
+
#include <clearcoat_normal_fragment_begin>
|
|
678
|
+
#include <clearcoat_normal_fragment_maps>
|
|
679
|
+
#include <emissivemap_fragment>
|
|
680
|
+
|
|
681
|
+
// accumulation
|
|
682
|
+
#include <lights_physical_fragment>
|
|
683
|
+
#include <lights_fragment_begin>
|
|
684
|
+
#include <lights_fragment_maps>
|
|
685
|
+
#include <lights_fragment_end>
|
|
686
|
+
|
|
687
|
+
// modulation
|
|
688
|
+
#include <aomap_fragment>
|
|
689
|
+
|
|
690
|
+
vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
|
|
691
|
+
vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
|
|
692
|
+
|
|
693
|
+
#include <transmission_fragment>
|
|
694
|
+
|
|
695
|
+
vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
|
|
696
|
+
|
|
697
|
+
#ifdef USE_SHEEN
|
|
698
|
+
|
|
699
|
+
// Sheen energy compensation approximation calculation can be found at the end of
|
|
700
|
+
// https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing
|
|
701
|
+
float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
|
|
702
|
+
|
|
703
|
+
outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
|
|
704
|
+
|
|
705
|
+
#endif
|
|
706
|
+
|
|
707
|
+
#ifdef USE_CLEARCOAT
|
|
708
|
+
|
|
709
|
+
float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
|
|
710
|
+
|
|
711
|
+
vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
|
|
712
|
+
|
|
713
|
+
outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
|
|
714
|
+
|
|
715
|
+
#endif
|
|
716
|
+
|
|
717
|
+
#include <opaque_fragment>
|
|
718
|
+
#include <tonemapping_fragment>
|
|
719
|
+
#include <colorspace_fragment>
|
|
720
|
+
#include <fog_fragment>
|
|
721
|
+
#include <premultiplied_alpha_fragment>
|
|
722
|
+
#include <dithering_fragment>
|
|
723
|
+
}`,Vp=`
|
|
724
|
+
#include <common>
|
|
725
|
+
#include <color_pars_vertex>
|
|
726
|
+
#include <logdepthbuf_pars_vertex>
|
|
727
|
+
#include <clipping_planes_pars_vertex>
|
|
728
|
+
|
|
729
|
+
#include <tile_pars_vertex>
|
|
730
|
+
#include <soft_pars_vertex>
|
|
731
|
+
|
|
732
|
+
attribute vec3 offset;
|
|
733
|
+
attribute float rotation;
|
|
734
|
+
attribute vec3 size;
|
|
735
|
+
|
|
736
|
+
void main() {
|
|
737
|
+
|
|
738
|
+
vec2 alignedPosition = position.xy * size.xy;
|
|
739
|
+
|
|
740
|
+
vec2 rotatedPosition;
|
|
741
|
+
rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
|
|
742
|
+
rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
|
|
743
|
+
#ifdef HORIZONTAL
|
|
744
|
+
vec4 mvPosition = modelMatrix * vec4( offset, 1.0 );
|
|
745
|
+
mvPosition.x += rotatedPosition.x;
|
|
746
|
+
mvPosition.z -= rotatedPosition.y;
|
|
747
|
+
mvPosition = viewMatrix * mvPosition;
|
|
748
|
+
#elif defined(VERTICAL)
|
|
749
|
+
vec4 mvPosition = modelMatrix * vec4( offset, 1.0 );
|
|
750
|
+
mvPosition.y += rotatedPosition.y;
|
|
751
|
+
mvPosition = viewMatrix * mvPosition;
|
|
752
|
+
mvPosition.x += rotatedPosition.x;
|
|
753
|
+
#else
|
|
754
|
+
vec4 mvPosition = modelViewMatrix * vec4( offset, 1.0 );
|
|
755
|
+
mvPosition.xy += rotatedPosition;
|
|
756
|
+
#endif
|
|
757
|
+
|
|
758
|
+
vColor = color;
|
|
759
|
+
|
|
760
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
761
|
+
|
|
762
|
+
#include <logdepthbuf_vertex>
|
|
763
|
+
|
|
764
|
+
#include <clipping_planes_vertex>
|
|
765
|
+
|
|
766
|
+
#include <tile_vertex>
|
|
767
|
+
#include <soft_vertex>
|
|
768
|
+
}
|
|
769
|
+
`,Up=`
|
|
770
|
+
#include <common>
|
|
771
|
+
#include <color_pars_vertex>
|
|
772
|
+
#include <logdepthbuf_pars_vertex>
|
|
773
|
+
#include <clipping_planes_pars_vertex>
|
|
774
|
+
#include <tile_pars_vertex>
|
|
775
|
+
#include <soft_pars_vertex>
|
|
776
|
+
|
|
777
|
+
attribute vec3 offset;
|
|
778
|
+
attribute vec4 rotation;
|
|
779
|
+
attribute vec3 size;
|
|
780
|
+
// attribute vec4 color;
|
|
781
|
+
|
|
782
|
+
void main() {
|
|
783
|
+
|
|
784
|
+
float x2 = rotation.x + rotation.x, y2 = rotation.y + rotation.y, z2 = rotation.z + rotation.z;
|
|
785
|
+
float xx = rotation.x * x2, xy = rotation.x * y2, xz = rotation.x * z2;
|
|
786
|
+
float yy = rotation.y * y2, yz = rotation.y * z2, zz = rotation.z * z2;
|
|
787
|
+
float wx = rotation.w * x2, wy = rotation.w * y2, wz = rotation.w * z2;
|
|
788
|
+
float sx = size.x, sy = size.y, sz = size.z;
|
|
789
|
+
|
|
790
|
+
mat4 matrix = mat4(( 1.0 - ( yy + zz ) ) * sx, ( xy + wz ) * sx, ( xz - wy ) * sx, 0.0, // 1. column
|
|
791
|
+
( xy - wz ) * sy, ( 1.0 - ( xx + zz ) ) * sy, ( yz + wx ) * sy, 0.0, // 2. column
|
|
792
|
+
( xz + wy ) * sz, ( yz - wx ) * sz, ( 1.0 - ( xx + yy ) ) * sz, 0.0, // 3. column
|
|
793
|
+
offset.x, offset.y, offset.z, 1.0);
|
|
794
|
+
|
|
795
|
+
vec4 mvPosition = modelViewMatrix * (matrix * vec4( position, 1.0 ));
|
|
796
|
+
|
|
797
|
+
vColor = color;
|
|
798
|
+
|
|
799
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
800
|
+
|
|
801
|
+
#include <logdepthbuf_vertex>
|
|
802
|
+
#include <clipping_planes_vertex>
|
|
803
|
+
#include <tile_vertex>
|
|
804
|
+
#include <soft_vertex>
|
|
805
|
+
}
|
|
806
|
+
`,zo=`
|
|
807
|
+
#define STANDARD
|
|
808
|
+
varying vec3 vViewPosition;
|
|
809
|
+
#ifdef USE_TRANSMISSION
|
|
810
|
+
varying vec3 vWorldPosition;
|
|
811
|
+
#endif
|
|
812
|
+
#include <common>
|
|
813
|
+
|
|
814
|
+
attribute vec3 offset;
|
|
815
|
+
attribute vec4 rotation;
|
|
816
|
+
attribute vec3 size;
|
|
817
|
+
#include <tile_pars_vertex>
|
|
818
|
+
#include <displacementmap_pars_vertex>
|
|
819
|
+
#include <color_pars_vertex>
|
|
820
|
+
#include <fog_pars_vertex>
|
|
821
|
+
#include <normal_pars_vertex>
|
|
822
|
+
#include <morphtarget_pars_vertex>
|
|
823
|
+
#include <skinning_pars_vertex>
|
|
824
|
+
#include <shadowmap_pars_vertex>
|
|
825
|
+
#include <logdepthbuf_pars_vertex>
|
|
826
|
+
#include <clipping_planes_pars_vertex>
|
|
827
|
+
|
|
828
|
+
void main() {
|
|
829
|
+
|
|
830
|
+
#include <tile_vertex>
|
|
831
|
+
float x2 = rotation.x + rotation.x, y2 = rotation.y + rotation.y, z2 = rotation.z + rotation.z;
|
|
832
|
+
float xx = rotation.x * x2, xy = rotation.x * y2, xz = rotation.x * z2;
|
|
833
|
+
float yy = rotation.y * y2, yz = rotation.y * z2, zz = rotation.z * z2;
|
|
834
|
+
float wx = rotation.w * x2, wy = rotation.w * y2, wz = rotation.w * z2;
|
|
835
|
+
float sx = size.x, sy = size.y, sz = size.z;
|
|
836
|
+
|
|
837
|
+
mat4 particleMatrix = mat4(( 1.0 - ( yy + zz ) ) * sx, ( xy + wz ) * sx, ( xz - wy ) * sx, 0.0, // 1. column
|
|
838
|
+
( xy - wz ) * sy, ( 1.0 - ( xx + zz ) ) * sy, ( yz + wx ) * sy, 0.0, // 2. column
|
|
839
|
+
( xz + wy ) * sz, ( yz - wx ) * sz, ( 1.0 - ( xx + yy ) ) * sz, 0.0, // 3. column
|
|
840
|
+
offset.x, offset.y, offset.z, 1.0);
|
|
841
|
+
|
|
842
|
+
#include <color_vertex>
|
|
843
|
+
#include <morphinstance_vertex>
|
|
844
|
+
#include <morphcolor_vertex>
|
|
845
|
+
#include <batching_vertex>
|
|
846
|
+
|
|
847
|
+
#include <beginnormal_vertex>
|
|
848
|
+
#include <morphnormal_vertex>
|
|
849
|
+
#include <skinbase_vertex>
|
|
850
|
+
#include <skinnormal_vertex>
|
|
851
|
+
|
|
852
|
+
// replace defaultnormal_vertex
|
|
853
|
+
vec3 transformedNormal = objectNormal;
|
|
854
|
+
mat3 m = mat3( particleMatrix );
|
|
855
|
+
transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
|
|
856
|
+
transformedNormal = m * transformedNormal;
|
|
857
|
+
transformedNormal = normalMatrix * transformedNormal;
|
|
858
|
+
#ifdef FLIP_SIDED
|
|
859
|
+
transformedNormal = - transformedNormal;
|
|
860
|
+
#endif
|
|
861
|
+
#ifdef USE_TANGENT
|
|
862
|
+
vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
|
|
863
|
+
#ifdef FLIP_SIDED
|
|
864
|
+
transformedTangent = - transformedTangent;
|
|
865
|
+
#endif
|
|
866
|
+
#endif
|
|
867
|
+
|
|
868
|
+
#include <normal_vertex>
|
|
869
|
+
#include <begin_vertex>
|
|
870
|
+
#include <morphtarget_vertex>
|
|
871
|
+
#include <skinning_vertex>
|
|
872
|
+
#include <displacementmap_vertex>
|
|
873
|
+
|
|
874
|
+
// replace include <project_vertex>
|
|
875
|
+
vec4 mvPosition = vec4( transformed, 1.0 );
|
|
876
|
+
mvPosition = modelViewMatrix * (particleMatrix * mvPosition);
|
|
877
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
878
|
+
|
|
879
|
+
#include <logdepthbuf_vertex>
|
|
880
|
+
#include <clipping_planes_vertex>
|
|
881
|
+
|
|
882
|
+
vViewPosition = - mvPosition.xyz;
|
|
883
|
+
|
|
884
|
+
#include <worldpos_vertex>
|
|
885
|
+
#include <shadowmap_vertex>
|
|
886
|
+
#include <fog_vertex>
|
|
887
|
+
#ifdef USE_TRANSMISSION
|
|
888
|
+
vWorldPosition = worldPosition.xyz;
|
|
889
|
+
#endif
|
|
890
|
+
}
|
|
891
|
+
`,jp=`
|
|
892
|
+
#include <common>
|
|
893
|
+
#include <color_pars_vertex>
|
|
894
|
+
#include <logdepthbuf_pars_vertex>
|
|
895
|
+
#include <clipping_planes_pars_vertex>
|
|
896
|
+
|
|
897
|
+
#include <tile_pars_vertex>
|
|
898
|
+
#include <soft_pars_vertex>
|
|
899
|
+
|
|
900
|
+
attribute vec3 offset;
|
|
901
|
+
attribute float rotation;
|
|
902
|
+
attribute vec3 size;
|
|
903
|
+
attribute vec4 velocity;
|
|
904
|
+
|
|
905
|
+
uniform float speedFactor;
|
|
906
|
+
|
|
907
|
+
void main() {
|
|
908
|
+
float lengthFactor = velocity.w;
|
|
909
|
+
float avgSize = (size.x + size.y) * 0.5;
|
|
910
|
+
#ifdef USE_SKEW
|
|
911
|
+
vec4 mvPosition = modelViewMatrix * vec4( offset, 1.0 );
|
|
912
|
+
vec3 viewVelocity = normalMatrix * velocity.xyz;
|
|
913
|
+
|
|
914
|
+
vec3 scaledPos = vec3(position.xy * size.xy, position.z);
|
|
915
|
+
float vlength = length(viewVelocity);
|
|
916
|
+
vec3 projVelocity = dot(scaledPos, viewVelocity) * viewVelocity / vlength;
|
|
917
|
+
mvPosition.xyz += scaledPos + projVelocity * (speedFactor / avgSize + lengthFactor / vlength);
|
|
918
|
+
#else
|
|
919
|
+
vec4 mvPosition = modelViewMatrix * vec4( offset, 1.0 );
|
|
920
|
+
vec3 viewVelocity = normalMatrix * velocity.xyz;
|
|
921
|
+
float vlength = length(viewVelocity);
|
|
922
|
+
mvPosition.xyz += position.y * normalize(cross(mvPosition.xyz, viewVelocity)) * avgSize; // switch the cross to match unity implementation
|
|
923
|
+
mvPosition.xyz -= (position.x + 0.5) * viewVelocity * (1.0 + lengthFactor / vlength) * avgSize; // minus position.x to match unity implementation
|
|
924
|
+
#endif
|
|
925
|
+
vColor = color;
|
|
926
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
927
|
+
#include <logdepthbuf_vertex>
|
|
928
|
+
#include <clipping_planes_vertex>
|
|
929
|
+
#include <tile_vertex>
|
|
930
|
+
#include <soft_vertex>
|
|
931
|
+
}
|
|
932
|
+
`;function co(o){return o===0?"uv":`uv${o}`}class Gp extends Xd{constructor(e){super(e)}onBeforeCompile(e,t){super.onBeforeCompile(e,t),e.vertexShader=zo,e.fragmentShader=Ao}}class Wp extends qd{constructor(e){super(e)}onBeforeCompile(e,t){super.onBeforeCompile(e,t),e.vertexShader=zo,e.fragmentShader=Ao}}class Xp extends wc{constructor(e){super(e),this.vector_=new N,this.vector2_=new N,this.vector3_=new N,this.quaternion_=new te,this.quaternion2_=new te,this.quaternion3_=new te,this.rotationMat_=new Mt,this.rotationMat2_=new Mt,this.maxParticles=1e3,this.setupBuffers(),this.rebuildMaterial()}buildExpandableBuffers(){this.offsetBuffer=new zt(new Float32Array(this.maxParticles*3),3),this.offsetBuffer.setUsage(Ue),this.geometry.setAttribute("offset",this.offsetBuffer),this.colorBuffer=new zt(new Float32Array(this.maxParticles*4),4),this.colorBuffer.setUsage(Ue),this.geometry.setAttribute("color",this.colorBuffer),this.settings.renderMode===B.Mesh?(this.rotationBuffer=new zt(new Float32Array(this.maxParticles*4),4),this.rotationBuffer.setUsage(Ue),this.geometry.setAttribute("rotation",this.rotationBuffer)):(this.settings.renderMode===B.BillBoard||this.settings.renderMode===B.HorizontalBillBoard||this.settings.renderMode===B.VerticalBillBoard||this.settings.renderMode===B.StretchedBillBoard)&&(this.rotationBuffer=new zt(new Float32Array(this.maxParticles),1),this.rotationBuffer.setUsage(Ue),this.geometry.setAttribute("rotation",this.rotationBuffer)),this.sizeBuffer=new zt(new Float32Array(this.maxParticles*3),3),this.sizeBuffer.setUsage(Ue),this.geometry.setAttribute("size",this.sizeBuffer),this.uvTileBuffer=new zt(new Float32Array(this.maxParticles),1),this.uvTileBuffer.setUsage(Ue),this.geometry.setAttribute("uvTile",this.uvTileBuffer),this.settings.renderMode===B.StretchedBillBoard&&(this.velocityBuffer=new zt(new Float32Array(this.maxParticles*4),4),this.velocityBuffer.setUsage(Ue),this.geometry.setAttribute("velocity",this.velocityBuffer))}setupBuffers(){this.geometry&&this.geometry.dispose(),this.geometry=new Wd,this.geometry.setIndex(this.settings.instancingGeometry.getIndex()),this.settings.instancingGeometry.hasAttribute("normal")&&this.geometry.setAttribute("normal",this.settings.instancingGeometry.getAttribute("normal")),this.geometry.setAttribute("position",this.settings.instancingGeometry.getAttribute("position")),this.settings.instancingGeometry.hasAttribute("uv")&&this.geometry.setAttribute("uv",this.settings.instancingGeometry.getAttribute("uv")),this.buildExpandableBuffers()}expandBuffers(e){for(;e>=this.maxParticles;)this.maxParticles*=2;this.setupBuffers()}rebuildMaterial(){this.layers.mask=this.settings.layers.mask;const e={},t={};this.settings.material.type!=="MeshStandardMaterial"&&this.settings.material.type!=="MeshPhysicalMaterial"&&(e.map=new nt(this.settings.material.map)),this.settings.material.alphaTest&&(t.USE_ALPHATEST="",e.alphaTest=new nt(this.settings.material.alphaTest)),t.USE_UV="";const i=this.settings.uTileCount,s=this.settings.vTileCount;(i>1||s>1)&&(t.UV_TILE="",e.tileCount=new nt(new Gi(i,s))),this.settings.material.defines&&this.settings.material.defines.USE_COLOR_AS_ALPHA!==void 0&&(t.USE_COLOR_AS_ALPHA=""),this.settings.material.normalMap&&(t.USE_NORMALMAP="",t.NORMALMAP_UV=co(this.settings.material.normalMap.channel),e.normalMapTransform=new nt(new Mt().copy(this.settings.material.normalMap.matrix))),this.settings.material.map&&(t.USE_MAP="",this.settings.blendTiles&&(t.TILE_BLEND=""),t.MAP_UV=co(this.settings.material.map.channel),e.mapTransform=new nt(new Mt().copy(this.settings.material.map.matrix))),t.USE_COLOR_ALPHA="";let r;if(this.settings.softParticles){t.SOFT_PARTICLES="";const a=this.settings.softNearFade,l=1/(this.settings.softFarFade-this.settings.softNearFade);e.softParams=new nt(new Gi(a,l)),e.depthTexture=new nt(null);const c=e.projParams=new nt(new Qe);r=(h,d,p)=>{c.value.set(p.near,p.far,0,0)}}let n=!1;if(this.settings.renderMode===B.BillBoard||this.settings.renderMode===B.VerticalBillBoard||this.settings.renderMode===B.HorizontalBillBoard||this.settings.renderMode===B.Mesh){let a,l;this.settings.renderMode===B.Mesh?this.settings.material.type==="MeshStandardMaterial"||this.settings.material.type==="MeshPhysicalMaterial"?(t.USE_COLOR="",a=zo,l=Ao,n=!0):(a=Up,l=Ln):(a=Vp,l=Ln),this.settings.renderMode===B.VerticalBillBoard?t.VERTICAL="":this.settings.renderMode===B.HorizontalBillBoard&&(t.HORIZONTAL="");let c=!1;this.settings.renderMode===B.Mesh&&(this.settings.material.type==="MeshStandardMaterial"?(this.material=new Gp({}),this.material.copy(this.settings.material),this.material.uniforms=e,this.material.defines=t,c=!0):this.settings.material.type==="MeshPhysicalMaterial"&&(this.material=new Wp({}),this.material.copy(this.settings.material),this.material.uniforms=e,this.material.defines=t,c=!0)),c||(this.material=new vs({uniforms:e,defines:t,vertexShader:a,fragmentShader:l,transparent:this.settings.material.transparent,depthWrite:!this.settings.material.transparent,blending:this.settings.material.blending,blendDst:this.settings.material.blendDst,blendSrc:this.settings.material.blendSrc,blendEquation:this.settings.material.blendEquation,premultipliedAlpha:this.settings.material.premultipliedAlpha,side:this.settings.material.side,alphaTest:this.settings.material.alphaTest,depthTest:this.settings.material.depthTest,lights:n}))}else if(this.settings.renderMode===B.StretchedBillBoard)e.speedFactor=new nt(1),this.material=new vs({uniforms:e,defines:t,vertexShader:jp,fragmentShader:Ln,transparent:this.settings.material.transparent,depthWrite:!this.settings.material.transparent,blending:this.settings.material.blending,blendDst:this.settings.material.blendDst,blendSrc:this.settings.material.blendSrc,blendEquation:this.settings.material.blendEquation,premultipliedAlpha:this.settings.material.premultipliedAlpha,side:this.settings.material.side,alphaTest:this.settings.material.alphaTest,depthTest:this.settings.material.depthTest});else throw new Error("render mode unavailable");this.material&&r&&(this.material.onBeforeRender=r)}update(){let e=0,t=0;const i=this.getVisibleSystems();for(const s of i)t+=s.particleNum;t>this.maxParticles&&this.expandBuffers(t);for(const s of i){s.emitter.updateMatrixWorld&&(s.emitter.updateWorldMatrix(!0,!1),s.emitter.updateMatrixWorld(!0));const r=s.particles,n=s.particleNum,a=this.quaternion2_,l=this.vector2_,c=this.vector3_;s.emitter.matrixWorld.decompose(l,a,c),this.rotationMat_.setFromMatrix4(s.emitter.matrixWorld);for(let h=0;h<n;h++,e++){const d=r[h];if(this.settings.renderMode===B.Mesh){let u;if(s.worldSpace)u=d.rotation;else{let f;d.parentMatrix?f=this.quaternion3_.setFromRotationMatrix(d.parentMatrix):f=a,u=this.quaternion_,u.copy(f).multiply(d.rotation)}this.rotationBuffer.setXYZW(e,u.x,u.y,u.z,u.w)}else(this.settings.renderMode===B.StretchedBillBoard||this.settings.renderMode===B.VerticalBillBoard||this.settings.renderMode===B.HorizontalBillBoard||this.settings.renderMode===B.BillBoard)&&this.rotationBuffer.setX(e,d.rotation);let p;if(s.worldSpace?p=d.position:(p=this.vector_,d.parentMatrix?p.copy(d.position).applyMatrix4(d.parentMatrix):p.copy(d.position).applyMatrix4(s.emitter.matrixWorld)),this.offsetBuffer.setXYZ(e,p.x,p.y,p.z),this.colorBuffer.setXYZW(e,d.color.x,d.color.y,d.color.z,d.color.w),s.worldSpace?this.sizeBuffer.setXYZ(e,d.size.x,d.size.y,d.size.z):d.parentMatrix?this.sizeBuffer.setXYZ(e,d.size.x,d.size.y,d.size.z):this.sizeBuffer.setXYZ(e,d.size.x*Math.abs(c.x),d.size.y*Math.abs(c.y),d.size.z*Math.abs(c.z)),this.uvTileBuffer.setX(e,d.uvTile),this.settings.renderMode===B.StretchedBillBoard&&this.velocityBuffer){let u=s.rendererEmitterSettings.speedFactor;u===0&&(u=.001);const f=s.rendererEmitterSettings.lengthFactor;let m;s.worldSpace?m=d.velocity:(m=this.vector_,d.parentMatrix?(this.rotationMat2_.setFromMatrix4(d.parentMatrix),m.copy(d.velocity).applyMatrix3(this.rotationMat2_)):m.copy(d.velocity).applyMatrix3(this.rotationMat_)),this.velocityBuffer.setXYZW(e,m.x*u,m.y*u,m.z*u,f)}}}this.geometry.instanceCount=e,e>0&&(this.offsetBuffer.clearUpdateRanges(),this.offsetBuffer.addUpdateRange(0,e*3),this.offsetBuffer.needsUpdate=!0,this.sizeBuffer.clearUpdateRanges(),this.sizeBuffer.addUpdateRange(0,e*3),this.sizeBuffer.needsUpdate=!0,this.colorBuffer.clearUpdateRanges(),this.colorBuffer.addUpdateRange(0,e*4),this.colorBuffer.needsUpdate=!0,this.uvTileBuffer.clearUpdateRanges(),this.uvTileBuffer.addUpdateRange(0,e),this.uvTileBuffer.needsUpdate=!0,this.settings.renderMode===B.StretchedBillBoard&&this.velocityBuffer&&(this.velocityBuffer.clearUpdateRanges(),this.velocityBuffer.addUpdateRange(0,e*4),this.velocityBuffer.needsUpdate=!0),this.settings.renderMode===B.Mesh?(this.rotationBuffer.clearUpdateRanges(),this.rotationBuffer.addUpdateRange(0,e*4),this.rotationBuffer.needsUpdate=!0):(this.settings.renderMode===B.StretchedBillBoard||this.settings.renderMode===B.HorizontalBillBoard||this.settings.renderMode===B.VerticalBillBoard||this.settings.renderMode===B.BillBoard)&&(this.rotationBuffer.clearUpdateRanges(),this.rotationBuffer.addUpdateRange(0,e),this.rotationBuffer.needsUpdate=!0))}dispose(){this.geometry.dispose()}}var qp=`
|
|
933
|
+
|
|
934
|
+
#include <common>
|
|
935
|
+
#include <tile_pars_fragment>
|
|
936
|
+
#include <map_pars_fragment>
|
|
937
|
+
#include <fog_pars_fragment>
|
|
938
|
+
#include <logdepthbuf_pars_fragment>
|
|
939
|
+
#include <clipping_planes_pars_fragment>
|
|
940
|
+
|
|
941
|
+
uniform sampler2D alphaMap;
|
|
942
|
+
uniform float useAlphaMap;
|
|
943
|
+
uniform float visibility;
|
|
944
|
+
uniform float alphaTest;
|
|
945
|
+
|
|
946
|
+
varying vec4 vColor;
|
|
947
|
+
|
|
948
|
+
void main() {
|
|
949
|
+
#include <clipping_planes_fragment>
|
|
950
|
+
#include <logdepthbuf_fragment>
|
|
951
|
+
|
|
952
|
+
vec4 diffuseColor = vColor;
|
|
953
|
+
|
|
954
|
+
#ifdef USE_MAP
|
|
955
|
+
#include <tile_fragment>
|
|
956
|
+
#ifndef USE_COLOR_AS_ALPHA
|
|
957
|
+
#endif
|
|
958
|
+
#endif
|
|
959
|
+
if( useAlphaMap == 1. ) diffuseColor.a *= texture2D( alphaMap, vUv).a;
|
|
960
|
+
if( diffuseColor.a < alphaTest ) discard;
|
|
961
|
+
gl_FragColor = diffuseColor;
|
|
962
|
+
|
|
963
|
+
#include <fog_fragment>
|
|
964
|
+
#include <tonemapping_fragment>
|
|
965
|
+
}`,Yp=`
|
|
966
|
+
#include <common>
|
|
967
|
+
#include <tile_pars_vertex>
|
|
968
|
+
#include <color_pars_vertex>
|
|
969
|
+
#include <clipping_planes_pars_vertex>
|
|
970
|
+
#include <logdepthbuf_pars_vertex>
|
|
971
|
+
#include <fog_pars_vertex>
|
|
972
|
+
|
|
973
|
+
attribute vec3 previous;
|
|
974
|
+
attribute vec3 next;
|
|
975
|
+
attribute float side;
|
|
976
|
+
attribute float width;
|
|
977
|
+
|
|
978
|
+
uniform vec2 resolution;
|
|
979
|
+
uniform float lineWidth;
|
|
980
|
+
uniform float sizeAttenuation;
|
|
981
|
+
|
|
982
|
+
vec2 fix(vec4 i, float aspect) {
|
|
983
|
+
vec2 res = i.xy / i.w;
|
|
984
|
+
res.x *= aspect;
|
|
985
|
+
return res;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
void main() {
|
|
989
|
+
|
|
990
|
+
#include <tile_vertex>
|
|
991
|
+
|
|
992
|
+
float aspect = resolution.x / resolution.y;
|
|
993
|
+
|
|
994
|
+
vColor = color;
|
|
995
|
+
|
|
996
|
+
mat4 m = projectionMatrix * modelViewMatrix;
|
|
997
|
+
vec4 finalPosition = m * vec4( position, 1.0 );
|
|
998
|
+
vec4 prevPos = m * vec4( previous, 1.0 );
|
|
999
|
+
vec4 nextPos = m * vec4( next, 1.0 );
|
|
1000
|
+
|
|
1001
|
+
vec2 currentP = fix( finalPosition, aspect );
|
|
1002
|
+
vec2 prevP = fix( prevPos, aspect );
|
|
1003
|
+
vec2 nextP = fix( nextPos, aspect );
|
|
1004
|
+
|
|
1005
|
+
float w = lineWidth * width;
|
|
1006
|
+
|
|
1007
|
+
vec2 dir;
|
|
1008
|
+
if( nextP == currentP ) dir = normalize( currentP - prevP );
|
|
1009
|
+
else if( prevP == currentP ) dir = normalize( nextP - currentP );
|
|
1010
|
+
else {
|
|
1011
|
+
vec2 dir1 = normalize( currentP - prevP );
|
|
1012
|
+
vec2 dir2 = normalize( nextP - currentP );
|
|
1013
|
+
dir = normalize( dir1 + dir2 );
|
|
1014
|
+
|
|
1015
|
+
vec2 perp = vec2( -dir1.y, dir1.x );
|
|
1016
|
+
vec2 miter = vec2( -dir.y, dir.x );
|
|
1017
|
+
//w = clamp( w / dot( miter, perp ), 0., 4., * lineWidth * width );
|
|
1018
|
+
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
//vec2 normal = ( cross( vec3( dir, 0. ) vec3( 0., 0., 1. ) ) ).xy;
|
|
1022
|
+
vec4 normal = vec4( -dir.y, dir.x, 0., 1. );
|
|
1023
|
+
normal.xy *= .5 * w;
|
|
1024
|
+
normal *= projectionMatrix;
|
|
1025
|
+
if( sizeAttenuation == 0. ) {
|
|
1026
|
+
normal.xy *= finalPosition.w;
|
|
1027
|
+
normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
finalPosition.xy += normal.xy * side;
|
|
1031
|
+
|
|
1032
|
+
gl_Position = finalPosition;
|
|
1033
|
+
|
|
1034
|
+
#include <logdepthbuf_vertex>
|
|
1035
|
+
#include <clipping_planes_vertex>
|
|
1036
|
+
|
|
1037
|
+
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
|
|
1038
|
+
|
|
1039
|
+
#include <fog_vertex>
|
|
1040
|
+
}`;class Jp extends wc{constructor(e){super(e),this.vector_=new N,this.vector2_=new N,this.vector3_=new N,this.quaternion_=new te,this.maxParticles=1e4,this.setupBuffers(),this.rebuildMaterial()}setupBuffers(){this.geometry&&this.geometry.dispose(),this.geometry=new It,this.indexBuffer=new vt(new Uint32Array(this.maxParticles*6),1),this.indexBuffer.setUsage(Ue),this.geometry.setIndex(this.indexBuffer),this.positionBuffer=new vt(new Float32Array(this.maxParticles*6),3),this.positionBuffer.setUsage(Ue),this.geometry.setAttribute("position",this.positionBuffer),this.previousBuffer=new vt(new Float32Array(this.maxParticles*6),3),this.previousBuffer.setUsage(Ue),this.geometry.setAttribute("previous",this.previousBuffer),this.nextBuffer=new vt(new Float32Array(this.maxParticles*6),3),this.nextBuffer.setUsage(Ue),this.geometry.setAttribute("next",this.nextBuffer),this.widthBuffer=new vt(new Float32Array(this.maxParticles*2),1),this.widthBuffer.setUsage(Ue),this.geometry.setAttribute("width",this.widthBuffer),this.sideBuffer=new vt(new Float32Array(this.maxParticles*2),1),this.sideBuffer.setUsage(Ue),this.geometry.setAttribute("side",this.sideBuffer),this.uvBuffer=new vt(new Float32Array(this.maxParticles*4),2),this.uvBuffer.setUsage(Ue),this.geometry.setAttribute("uv",this.uvBuffer),this.colorBuffer=new vt(new Float32Array(this.maxParticles*8),4),this.colorBuffer.setUsage(Ue),this.geometry.setAttribute("color",this.colorBuffer)}expandBuffers(e){for(;e>=this.maxParticles;)this.maxParticles*=2;this.setupBuffers()}rebuildMaterial(){this.layers.mask=this.settings.layers.mask;const e={lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},resolution:{value:new Gi(1,1)},sizeAttenuation:{value:1},visibility:{value:1},alphaTest:{value:0}},t={};if(t.USE_UV="",t.USE_COLOR_ALPHA="",this.settings.material.map&&(t.USE_MAP="",t.MAP_UV=co(this.settings.material.map.channel),e.map=new nt(this.settings.material.map),e.mapTransform=new nt(new Mt().copy(this.settings.material.map.matrix))),this.settings.material.defines&&this.settings.material.defines.USE_COLOR_AS_ALPHA!==void 0&&(t.USE_COLOR_AS_ALPHA=""),this.settings.renderMode===B.Trail)this.material=new vs({uniforms:e,defines:t,vertexShader:Yp,fragmentShader:qp,transparent:this.settings.material.transparent,depthWrite:!this.settings.material.transparent,side:this.settings.material.side,blending:this.settings.material.blending||rc,blendDst:this.settings.material.blendDst,blendSrc:this.settings.material.blendSrc,blendEquation:this.settings.material.blendEquation,premultipliedAlpha:this.settings.material.premultipliedAlpha});else throw new Error("render mode unavailable")}update(){let e=0,t=0,i=0;const s=this.getVisibleSystems();for(const r of s)for(let n=0;n<r.particleNum;n++)i+=r.particles[n].previous.length*2;i>this.maxParticles&&this.expandBuffers(i);for(const r of s){r.emitter.updateMatrixWorld&&(r.emitter.updateWorldMatrix(!0,!1),r.emitter.updateMatrixWorld(!0));const n=this.quaternion_,a=this.vector2_,l=this.vector3_;r.emitter.matrixWorld.decompose(a,n,l);const c=r.particles,h=r.particleNum,d=this.settings.uTileCount,p=this.settings.vTileCount,u=1/d,f=1/p;for(let m=0;m<h;m++){const y=c[m],_=y.uvTile%p,w=Math.floor(y.uvTile/p+.001),x=y.previous.values();let S=x.next(),C=S.value,b=C;S.done||(S=x.next());let M;S.value!==void 0?M=S.value:M=b;for(let z=0;z<y.previous.length;z++,e+=2){if(this.positionBuffer.setXYZ(e,b.position.x,b.position.y,b.position.z),this.positionBuffer.setXYZ(e+1,b.position.x,b.position.y,b.position.z),r.worldSpace?(this.positionBuffer.setXYZ(e,b.position.x,b.position.y,b.position.z),this.positionBuffer.setXYZ(e+1,b.position.x,b.position.y,b.position.z)):(y.parentMatrix?this.vector_.copy(b.position).applyMatrix4(y.parentMatrix):this.vector_.copy(b.position).applyMatrix4(r.emitter.matrixWorld),this.positionBuffer.setXYZ(e,this.vector_.x,this.vector_.y,this.vector_.z),this.positionBuffer.setXYZ(e+1,this.vector_.x,this.vector_.y,this.vector_.z)),r.worldSpace?(this.previousBuffer.setXYZ(e,C.position.x,C.position.y,C.position.z),this.previousBuffer.setXYZ(e+1,C.position.x,C.position.y,C.position.z)):(y.parentMatrix?this.vector_.copy(C.position).applyMatrix4(y.parentMatrix):this.vector_.copy(C.position).applyMatrix4(r.emitter.matrixWorld),this.previousBuffer.setXYZ(e,this.vector_.x,this.vector_.y,this.vector_.z),this.previousBuffer.setXYZ(e+1,this.vector_.x,this.vector_.y,this.vector_.z)),r.worldSpace?(this.nextBuffer.setXYZ(e,M.position.x,M.position.y,M.position.z),this.nextBuffer.setXYZ(e+1,M.position.x,M.position.y,M.position.z)):(y.parentMatrix?this.vector_.copy(M.position).applyMatrix4(y.parentMatrix):this.vector_.copy(M.position).applyMatrix4(r.emitter.matrixWorld),this.nextBuffer.setXYZ(e,this.vector_.x,this.vector_.y,this.vector_.z),this.nextBuffer.setXYZ(e+1,this.vector_.x,this.vector_.y,this.vector_.z)),this.sideBuffer.setX(e,1),this.sideBuffer.setX(e+1,-1),r.worldSpace)this.widthBuffer.setX(e,b.size),this.widthBuffer.setX(e+1,b.size);else if(y.parentMatrix)this.widthBuffer.setX(e,b.size),this.widthBuffer.setX(e+1,b.size);else{const F=(Math.abs(l.x)+Math.abs(l.y)+Math.abs(l.z))/3;this.widthBuffer.setX(e,b.size*F),this.widthBuffer.setX(e+1,b.size*F)}this.uvBuffer.setXY(e,(z/y.previous.length+_)*u,(p-w-1)*f),this.uvBuffer.setXY(e+1,(z/y.previous.length+_)*u,(p-w)*f),this.colorBuffer.setXYZW(e,b.color.x,b.color.y,b.color.z,b.color.w),this.colorBuffer.setXYZW(e+1,b.color.x,b.color.y,b.color.z,b.color.w),z+1<y.previous.length&&(this.indexBuffer.setX(t*3,e),this.indexBuffer.setX(t*3+1,e+1),this.indexBuffer.setX(t*3+2,e+2),t++,this.indexBuffer.setX(t*3,e+2),this.indexBuffer.setX(t*3+1,e+1),this.indexBuffer.setX(t*3+2,e+3),t++),C=b,b=M,S.done||(S=x.next(),S.value!==void 0&&(M=S.value))}}}this.positionBuffer.clearUpdateRanges(),this.positionBuffer.addUpdateRange(0,e*3),this.positionBuffer.needsUpdate=!0,this.previousBuffer.clearUpdateRanges(),this.previousBuffer.addUpdateRange(0,e*3),this.previousBuffer.needsUpdate=!0,this.nextBuffer.clearUpdateRanges(),this.nextBuffer.addUpdateRange(0,e*3),this.nextBuffer.needsUpdate=!0,this.sideBuffer.clearUpdateRanges(),this.sideBuffer.addUpdateRange(0,e),this.sideBuffer.needsUpdate=!0,this.widthBuffer.clearUpdateRanges(),this.widthBuffer.addUpdateRange(0,e),this.widthBuffer.needsUpdate=!0,this.uvBuffer.clearUpdateRanges(),this.uvBuffer.addUpdateRange(0,e*2),this.uvBuffer.needsUpdate=!0,this.colorBuffer.clearUpdateRanges(),this.colorBuffer.addUpdateRange(0,e*4),this.colorBuffer.needsUpdate=!0,this.indexBuffer.clearUpdateRanges(),this.indexBuffer.addUpdateRange(0,t*3),this.indexBuffer.needsUpdate=!0,this.geometry.setDrawRange(0,t*3)}dispose(){this.geometry.dispose()}}class Eo extends Rt{constructor(){super(),this.batches=[],this.systemToBatchIndex=new Map,this.type="BatchedRenderer",this.depthTexture=null}static equals(e,t){return e.material.side===t.material.side&&e.material.blending===t.material.blending&&e.material.blendSrc===t.material.blendSrc&&e.material.blendDst===t.material.blendDst&&e.material.blendEquation===t.material.blendEquation&&e.material.premultipliedAlpha===t.material.premultipliedAlpha&&e.material.transparent===t.material.transparent&&e.material.depthTest===t.material.depthTest&&e.material.type===t.material.type&&e.material.alphaTest===t.material.alphaTest&&e.material.map===t.material.map&&e.renderMode===t.renderMode&&e.blendTiles===t.blendTiles&&e.softParticles===t.softParticles&&e.softFarFade===t.softFarFade&&e.softNearFade===t.softNearFade&&e.uTileCount===t.uTileCount&&e.vTileCount===t.vTileCount&&e.instancingGeometry===t.instancingGeometry&&e.renderOrder===t.renderOrder&&e.layers.mask===t.layers.mask}addSystem(e){e._renderer=this;const t=e.getRendererSettings();for(let s=0;s<this.batches.length;s++)if(Eo.equals(this.batches[s].settings,t)){this.batches[s].addSystem(e),this.systemToBatchIndex.set(e,s);return}let i;switch(t.renderMode){case B.Trail:i=new Jp(t);break;case B.Mesh:case B.BillBoard:case B.VerticalBillBoard:case B.HorizontalBillBoard:case B.StretchedBillBoard:i=new Xp(t);break}this.depthTexture&&i.applyDepthTexture(this.depthTexture),i.addSystem(e),this.batches.push(i),this.systemToBatchIndex.set(e,this.batches.length-1),this.add(i)}deleteSystem(e){const t=this.systemToBatchIndex.get(e);t!=null&&(this.batches[t].removeSystem(e),this.systemToBatchIndex.delete(e))}setDepthTexture(e){this.depthTexture=e;for(const t of this.batches)t.applyDepthTexture(e)}updateSystem(e){this.deleteSystem(e),this.addSystem(e)}update(e){this.systemToBatchIndex.forEach((t,i)=>{i.update(e)});for(let t=0;t<this.batches.length;t++)this.batches[t].update()}}class Oo extends je{constructor(){super(),this.type="QuarksPrefab",this.animationData=[],this.isPlaying=!1,this.currentTime=-1e-5,this.timeScale=1,this.duration=0,this._mixers=new Map,this._tempAnimationJSON=[],this._clock=new jd(!0)}registerBatchedRenderer(e){this._batchedRenderer=e}getOrCreateMixer(e){if(!this._mixers.has(e)){const t=new Ql(e);this._mixers.set(e,t)}return this._mixers.get(e)}addThreeAnimation(e,t,i=0,s=t.duration,r=!1){const n=this.getOrCreateMixer(e),a=n.clipAction(t);r||(a.setLoop(Gd,1),a.clampWhenFinished=!0);const l={startTime:i,duration:s,type:"three",loop:r,target:e,clip:t,mixer:n,action:a};return this.animationData.push(l),this.updateDuration(),l}addParticleSystemAnimation(e,t=0,i=0,s=!1){i<=0&&(i=e.system.duration);const r={startTime:t,duration:i,type:"ps",loop:s,target:e};return this.animationData.push(r),this.pause(),this.updateDuration(),r}removeAnimation(e){this.animationData.splice(e,1),this.updateDuration()}play(){this.isPlaying||(this.isPlaying=!0)}pause(){this.isPlaying&&(this.isPlaying=!1,this.animationData.forEach(e=>{e.target&&(e.type==="ps"&&!e.target.system.paused?e.target.system.pause():e.type==="three"&&e.action&&e.action.isRunning()&&(e.action.paused=!0))}))}stop(){this.pause(),this.currentTime=-1e-5,this.animationData.forEach(e=>{e.type==="ps"&&e.target?e.target.system.stop():e.type==="three"&&e.mixer&&e.action&&e.action.reset()})}update(e){if(!this.isPlaying)return;const t=e!==void 0?e:this._clock.getDelta();this.currentTime+=t*this.timeScale,this.currentTime>this.duration&&this.stop();const i=new Set;this.animationData.forEach(s=>{const{startTime:r,duration:n,type:a,loop:l,target:c,action:h,mixer:d}=s,p=r+n,u=this.currentTime>=r,f=this.currentTime>p,m=Math.abs(this.currentTime-r)<t;a==="three"&&h&&d?u&&!f?(m?(h.reset(),h.play()):h.paused&&(h.paused=!1,h.play()),this.currentTime-r,i.add(d)):f&&(h.paused=!0):a==="ps"&&c&&(u&&!f?m&&s.target.system.restart():f&&s.target.system.endEmit())}),i.forEach(s=>{s.update(t)})}setTime(e){const t=this.currentTime;this.currentTime=e,this.animationData.forEach(i=>{const{startTime:s,duration:r,type:n,target:a,action:l,mixer:c}=i;if(n==="three"&&l&&c){if(l.reset(),e>=s&&e<s+r){const h=e-s;l.time=h,l.play(),c.update(0),l.paused=!this.isPlaying}}else n==="ps"&&a&&(e>=s&&e<s+r?(t<s||t>=s+r)&&a.system.restart():a.system.endEmit())})}getDuration(){return this.duration}updateDuration(){let e=0;this.animationData.forEach(t=>{const i=t.startTime+t.duration;i>e&&(e=i)}),this.duration=e}resolveReferences(e){this._tempAnimationJSON.forEach(t=>{let i;if(e.traverse(s=>{s.uuid===t.targetUUID&&(i=s)}),i)if(t.type==="three"&&t.clipUUID){let s;i.animations&&(s=i.animations.find(r=>r.uuid===t.clipUUID)),s&&this.addThreeAnimation(i,s,t.startTime,t.duration,t.loop)}else t.type==="ps"&&this.addParticleSystemAnimation(i,t.startTime,t.duration,t.loop)}),this.updateDuration(),this._tempAnimationJSON=[]}toJSON(){const e=super.toJSON();return e.object.animationData=this.animationData.map(t=>({startTime:t.startTime,duration:t.duration,type:t.type,targetUUID:t.target.uuid,clipUUID:t.clip?.uuid,loop:t.loop})),e}static fromJSON(e){const t=new Oo;return e.animationData&&(t._tempAnimationJSON=e.animationData),t}}class Vg extends Rd{constructor(e){super(e)}linkReference(e){const t={};e.traverse(function(i){t[i.uuid]=i}),e.traverse(function(i){if(i.type==="ParticleEmitter"){const s=i.system;s.emitterShape;for(let r=0;r<s.behaviors.length;r++)s.behaviors[r]instanceof Yi&&(s.behaviors[r].subParticleSystem=t[s.behaviors[r].subParticleSystem])}})}parse(e,t){const i=super.parse(e,t);return this.linkReference(i),i}parseObject(e,t,i,s,r){let n;function a(f){return t[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",f),t[f]}function l(f){if(f!==void 0){if(Array.isArray(f)){const m=[];for(let y=0,_=f.length;y<_;y++){const w=f[y];i[w]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",w),m.push(i[w])}return m}return i[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",f),i[f]}}function c(f){return s[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",f),s[f]}let h,d;const p={textures:s,geometries:t,materials:i},u={};switch(e.type){case"QuarksPrefab":n=Oo.fromJSON(e);break;case"ParticleEmitter":n=Qr.fromJSON(e.ps,p,u).emitter;break;case"Scene":n=new _o,e.background!==void 0&&(Number.isInteger(e.background)?n.background=new U(e.background):n.background=c(e.background)),e.environment!==void 0&&(n.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?n.fog=new Vd(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(n.fog=new Ud(e.fog.color,e.fog.density)),e.fog.name!==""&&(n.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(n.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(n.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&n.backgroundRotation.fromArray(e.backgroundRotation),e.environmentIntensity!==void 0&&(n.environmentIntensity=e.environmentIntensity),e.environmentRotation!==void 0&&n.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":n=new bo(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(n.focus=e.focus),e.zoom!==void 0&&(n.zoom=e.zoom),e.filmGauge!==void 0&&(n.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(n.filmOffset=e.filmOffset),e.view!==void 0&&(n.view=Object.assign({},e.view));break;case"OrthographicCamera":n=new Ui(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(n.zoom=e.zoom),e.view!==void 0&&(n.view=Object.assign({},e.view));break;case"AmbientLight":n=new sc(e.color,e.intensity);break;case"DirectionalLight":n=new ic(e.color,e.intensity);break;case"PointLight":n=new Dd(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":n=new Hd(e.color,e.intensity,e.width,e.height);break;case"SpotLight":n=new Nd(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":n=new Fd(e.color,e.groundColor,e.intensity);break;case"LightProbe":n=new Bd().fromJSON(e);break;case"SkinnedMesh":h=a(e.geometry),d=l(e.material),n=new $l(h,d),e.bindMode!==void 0&&(n.bindMode=e.bindMode),e.bindMatrix!==void 0&&n.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(n.skeleton=e.skeleton);break;case"Mesh":h=a(e.geometry),d=l(e.material),n=new O(h,d);break;case"InstancedMesh":{h=a(e.geometry),d=l(e.material);const f=e.count,m=e.instanceMatrix,y=e.instanceColor;n=new Kl(h,d,f),n.instanceMatrix=new zt(new Float32Array(m.array),16),y!==void 0&&(n.instanceColor=new zt(new Float32Array(y.array),y.itemSize));break}case"BatchedMesh":h=a(e.geometry),d=l(e.material),n=new io(e.maxGeometryCount,e.maxVertexCount,e.maxIndexCount,d),n.geometry=h,n.perObjectFrustumCulled=e.perObjectFrustumCulled,n.sortObjects=e.sortObjects,n._drawRanges=e.drawRanges,n._reservedRanges=e.reservedRanges,n._visibility=e.visibility,n._active=e.active,n._bounds=e.bounds.map(f=>{const m=new St;m.min.fromArray(f.boxMin),m.max.fromArray(f.boxMax);const y=new xo;return y.radius=f.sphereRadius,y.center.fromArray(f.sphereCenter),{boxInitialized:f.boxInitialized,box:m,sphereInitialized:f.sphereInitialized,sphere:y}}),n._maxGeometryCount=e.maxGeometryCount,n._maxVertexCount=e.maxVertexCount,n._maxIndexCount=e.maxIndexCount,n._geometryInitialized=e.geometryInitialized,n._geometryCount=e.geometryCount,n._matricesTexture=c(e.matricesTexture.uuid);break;case"LOD":n=new Ld;break;case"Line":n=new ot(a(e.geometry),l(e.material));break;case"LineLoop":n=new tc(a(e.geometry),l(e.material));break;case"LineSegments":n=new Vi(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":n=new wo(a(e.geometry),l(e.material));break;case"Sprite":n=new so(l(e.material));break;case"Group":n=new je;break;case"Bone":n=new Id;break;default:n=new Rt}if(n.uuid=e.uuid,e.name!==void 0&&(n.name=e.name),e.matrix!==void 0?(n.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(n.matrixAutoUpdate=e.matrixAutoUpdate),n.matrixAutoUpdate&&(n.matrix.decompose(n.position,n.quaternion,n.scale),isNaN(n.quaternion.x)&&n.quaternion.set(0,0,0,1))):(e.position!==void 0&&n.position.fromArray(e.position),e.rotation!==void 0&&n.rotation.fromArray(e.rotation),e.quaternion!==void 0&&n.quaternion.fromArray(e.quaternion),e.scale!==void 0&&n.scale.fromArray(e.scale)),e.up!==void 0&&n.up.fromArray(e.up),e.castShadow!==void 0&&(n.castShadow=e.castShadow),e.receiveShadow!==void 0&&(n.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(n.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(n.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(n.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&n.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(n.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(n.visible=e.visible),e.frustumCulled!==void 0&&(n.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(n.renderOrder=e.renderOrder),e.userData!==void 0&&(n.userData=e.userData),e.layers!==void 0&&(n.layers.mask=e.layers),e.children!==void 0){const f=e.children;for(let m=0;m<f.length;m++)n.add(this.parseObject(f[m],t,i,s,r))}if(e.animations!==void 0){const f=e.animations;for(let m=0;m<f.length;m++){const y=f[m];n.animations.push(r[y])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(n.autoUpdate=e.autoUpdate);const f=e.levels;for(let m=0;m<f.length;m++){const y=f[m],_=n.getObjectByProperty("uuid",y.object);_!==void 0&&n.addLevel(_,y.distance)}}else e.type==="QuarksPrefab"&&n.resolveReferences(n);return n}}Bp();Pp(Ap);console.log("%c Particle system powered by three.quarks. https://quarks.art/","font-size: 14px; font-weight: bold;");let xc=null;function ol(o){xc=o,oh(o?.editorControls??null)}function Zp(){return xc}const Bn=new U(4441855),Lr=new U(16758858),Br=new U(14185983),Qp=new U(16731496),al=new U(16777215);function Fn(o){return new ot(new It,new $t({color:o,depthTest:!1,depthWrite:!1,transparent:!0,toneMapped:!1}))}function Nn(o,e){return new O(o,new Le({color:e,depthTest:!1,depthWrite:!1,transparent:!0,toneMapped:!1}))}function Hn(o,e){if(o.visible=e.length>1,!o.visible)return;let t=o.geometry.getAttribute("position");(!t||t.count!==e.length)&&(t=new _s(e.length*3,3),o.geometry.setAttribute("position",t));for(let i=0;i<e.length;i++)t.setXYZ(i,e[i].x,e[i].y,e[i].z);t.needsUpdate=!0,o.geometry.computeBoundingSphere()}class $p extends je{constructor(e){super(),this.source=e,this.name="Constraint Helper",this.renderOrder=999,Ze(this,"editorHelper",!0),Ze(this,"editorHelperType","constraints"),this.layers.set(K),this.refreshStructure()}selected=!1;hoveredControl=null;selectedObjects=new Set;visuals=[];setSelected(e){this.selected=e}setSelectedObjects(e){this.selectedObjects=e}controlMeshes(){return this.visuals.flatMap(e=>[e.targetHit,e.poleHit].filter(t=>t.visible))}presents(e){return e===this.source?!0:this.visuals.some(t=>{const i=t.mark.getSnapshot();return e===i.target||e===i.pole})}controlFor(e){for(const t of this.visuals){const i=t.mark.getSnapshot();if((e===t.target||e===t.targetHit)&&i.target)return{kind:"target",label:i.target.name||`${t.mark.config.label} target`,object:i.target,mesh:t.target};if((e===t.pole||e===t.poleHit)&&i.pole)return{kind:"pole",label:i.pole.name||`${t.mark.config.label} pole`,object:i.pole,mesh:t.pole}}return null}setHoveredControl(e){this.hoveredControl=e}update(e){this.refreshStructure();for(const t of this.visuals)this.updateVisual(t,e)}dispose(){this.clearVisuals(),this.removeFromParent()}refreshStructure(){const e=Wr(this.source);e.length===this.visuals.length&&e.every((i,s)=>{const r=i.getSnapshot(),n=r.chain.length>0?r.chain.length:r.constrained?1:0;return this.visuals[s]?.mark===i&&this.visuals[s]?.positions.length===n})||(this.clearVisuals(),this.visuals=e.map(i=>this.makeVisual(i)))}makeVisual(e){const t=e.getSnapshot(),i=t.chain.length>0?t.chain:t.constrained?[t.constrained]:[],s=Fn(Bn),r=Fn(Lr),n=Fn(Br),a=i.map(()=>Nn(new kt(.035,10,7),Bn)),l=Nn(new ui(.085),Lr),c=Nn(new Zd(.075),Br),h=new Le({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1,colorWrite:!1}),d=new O(new kt(.16,10,7),h),p=new O(new kt(.15,10,7),h.clone());for(const u of[s,r,n,...a,l,c,d,p])u.renderOrder=this.renderOrder,u.layers.set(K),this.add(u);return{mark:e,chain:s,targetLine:r,poleLine:n,joints:a,target:l,pole:c,targetHit:d,poleHit:p,positions:i.map(()=>new v),targetPosition:new v,polePosition:new v}}updateVisual(e,t){const i=e.mark.getSnapshot(),s=i.chain.length>0?i.chain:i.constrained?[i.constrained]:[];for(let p=0;p<s.length;p++)s[p].getWorldPosition(e.positions[p]);Hn(e.chain,e.positions);for(let p=0;p<e.joints.length;p++){const u=e.joints[p],f=e.positions[p];u.visible=!!f,f&&(u.position.copy(f),u.scale.setScalar(this.handleScale(t,f)))}const r=e.positions.at(-1),n=i.target?.getWorldPosition(e.targetPosition)??null,a=i.pole?.getWorldPosition(e.polePosition)??null;Hn(e.targetLine,r&&n?[r,n]:[]),Hn(e.poleLine,e.positions[0]&&a?[e.positions[0],a]:[]),e.target.visible=n!==null,n&&(e.target.position.copy(n),e.target.scale.setScalar(this.handleScale(t,n)*(this.hoveredControl===e.target?1.22:1))),e.targetHit.visible=n!==null,n&&(e.targetHit.position.copy(n),e.targetHit.scale.copy(e.target.scale)),e.pole.visible=a!==null,a&&(e.pole.position.copy(a),e.pole.scale.setScalar(this.handleScale(t,a)*(this.hoveredControl===e.pole?1.22:1))),e.poleHit.visible=a!==null,a&&(e.poleHit.position.copy(a),e.poleHit.scale.copy(e.pole.scale));const l=i.status==="error"||i.status==="unresolved",c=this.selected?1:.52;for(const p of[e.chain,...e.joints]){const u=p.material;u.color.copy(l?Qp:Bn),u.opacity=c}const h=this.hoveredControl===e.target||i.target!==null&&this.selectedObjects.has(i.target),d=this.hoveredControl===e.pole||i.pole!==null&&this.selectedObjects.has(i.pole);e.target.material.color.copy(h?al:Lr),e.pole.material.color.copy(d?al:Br),e.targetLine.material.color.copy(Lr),e.poleLine.material.color.copy(Br),e.targetLine.material.opacity=c,e.poleLine.material.opacity=c,e.target.material.opacity=h?1:c,e.pole.material.opacity=d?1:c}handleScale(e,t){return Be.clamp(e.position.distanceTo(t)/8,.65,4)}clearVisuals(){for(const e of[...this.children]){e.removeFromParent();const t=e;t.geometry.dispose();const i=Array.isArray(t.material)?t.material:[t.material];for(const s of i)s.dispose()}this.visuals=[],this.hoveredControl=null}}const Kp=new U(4892927),ef=new U(7718143),tf=new U(16758858),sf=new U(16777215);class rf extends je{constructor(e){super(),this.source=e,this.name="Reflection Probe Helper",this.matrixAutoUpdate=!1,this.renderOrder=998,Ze(this,"editorHelper",!0),Ze(this,"editorHelperType","reflection-probes"),this.layers.set(K),this.refresh(!0)}signature="";selected=!1;setSelected(e){this.selected!==e&&(this.selected=e,this.refresh(!0))}update(){this.refresh(!1),this.source.updateWorldMatrix(!0,!1),this.matrix.copy(this.source.matrixWorld),this.matrixWorldNeedsUpdate=!0}dispose(){this.clearVisuals(),this.removeFromParent()}refresh(e){const t=ys(this.source);if(!t)return;const i=t.config,s=JSON.stringify(i);if(!e&&s===this.signature)return;this.signature=s,this.clearVisuals();const r=this.selected?ef:Kp,n=this.selected?1:.62,a=Math.max(0,i.blendDistance);if(i.shape==="sphere"){const c=Math.max(.01,i.radius);this.addWire(new kt(c,24,16),r,n),a>0&&c-a>.01&&this.addWire(new kt(c-a,20,12),r,this.selected?.55:.28)}else{const[c,h,d]=i.size.map(u=>Math.max(.01,u));this.addWire(new Se(c,h,d),r,n);const p=[c-a*2,h-a*2,d-a*2];a>0&&p.every(u=>u>.01)&&this.addWire(new Se(p[0],p[1],p[2]),r,this.selected?.55:.28)}if(i.parallaxProjection){const[c,h,d]=i.parallaxSize.map(u=>Math.max(.01,u));this.addWire(new Se(c,h,d),tf,this.selected?.9:.45).position.fromArray(i.parallaxOffset)}this.addWire(new ui(this.selected?.16:.11),sf,this.selected?1:.72).position.fromArray(i.captureOffset),this.traverse(c=>c.layers.set(K))}addWire(e,t,i){const s=new So(e);e.dispose();const r=new $t({color:t,depthTest:!1,transparent:!0,opacity:i,toneMapped:!1}),n=new Vi(s,r);return n.renderOrder=this.renderOrder,this.add(n),n}clearVisuals(){for(const e of[...this.children]){e.removeFromParent();const t=e;t.geometry?.dispose();const i=Array.isArray(t.material)?t.material:[t.material];for(const s of i)s?.dispose()}}}const nf={maxOutlierFraction:.1,minGapFraction:.2,minSampleSize:8,maxPasses:8},of=10,af=.01,lf=["x","y","z"];function ll(o,e){const t=new St;for(const i of e)t.union(o[i]);return t}function cf(o,e,t){let i=null;for(const s of lf)for(const r of["min","max"]){const n=[];for(const l of e)n.push({i:l,v:o[l][r][s]});n.sort((l,c)=>r==="min"?l.v-c.v:c.v-l.v);const a=Math.min(t,n.length-1);for(let l=0;l<a;l++){const c=Math.abs(n[l+1].v-n[l].v);i&&c<=i.gap||(i={gap:c,discard:n.slice(0,l+1).map(h=>h.i)})}}return i}function cl(o,e={}){const t={...nf,...e},i=o.filter(h=>!h.isEmpty()),s=i.map((h,d)=>d),r=ll(i,s);if(i.length<t.minSampleSize)return r;let n=Math.floor(i.length*t.maxOutlierFraction);if(n<1)return r;const a=new Set(s);let l=r;const c=new v;for(let h=0;h<t.maxPasses&&n>0;h++){const d=l.getSize(c).length();if(!(d>0))break;const p=cf(i,a,n);if(!p||p.gap<=t.minGapFraction*d)break;for(const u of p.discard)a.delete(u);n-=p.discard.length,l=ll(i,a)}return l.isEmpty()?r:l}function hf(o,e){const t=o.getWorldDirection(new v),i=new v().setFromMatrixPosition(o.matrixWorld);if(!Number.isFinite(i.lengthSq())||t.lengthSq()===0)return null;if(e.isEmpty())return{position:i,target:i.clone().addScaledVector(t,of)};const s=e.getBoundingSphere(new xo),r=s.center.clone().sub(i).dot(t);return r>s.radius*af?{position:i,target:i.clone().addScaledVector(t,r)}:null}const df=[[0,0],[-.6,.6],[.6,.6],[-.6,-.6],[.6,-.6],[0,.6],[0,-.6],[-.6,0],[.6,0]],uf=.02,hl=new lt,dl=new Oe;function pf(o){for(let e=o;e;e=e.parent)if(!e.visible)return!1;return!0}function ff(o,e,t){if(!(t>0)||e.length===0)return!0;const i=t*uf;for(const[s,r]of df){dl.set(s,r),hl.setFromCamera(dl,o);const a=hl.intersectObjects(e,!0).find(l=>pf(l.object));if(!a||a.distance>i)return!0}return!1}const To=new WeakMap,bc=new kt(1,12,8);function Ji(o){return new v(o[0],o[1],o[2])}function tr(o){const e={color:o.color,transparent:!0,opacity:o.opacity??.68,depthTest:!1};return o.dashed?new nc({...e,dashSize:.18,gapSize:.12}):new $t(e)}function ct(o,e,t,i=!1){const s=i&&e.length>0?[...e,e[0]]:[...e],r=new ot(new It().setFromPoints(s),t);r.renderOrder=997,r.layers.set(K),t instanceof nc&&r.computeLineDistances(),o.add(r)}function Dr(o,e,t,i,s=64){const r=[];for(let n=0;n<s;n++){const a=n/s*Math.PI*2;r.push(o.clone().addScaledVector(t,Math.cos(a)*e).addScaledVector(i,Math.sin(a)*e))}return r}function mf(o){const e=new je,t=Ji(o.center),i=tr(o);return ct(e,Dr(t,o.radius,new v(1,0,0),new v(0,1,0)),i,!0),ct(e,Dr(t,o.radius,new v(1,0,0),new v(0,0,1)),i,!0),ct(e,Dr(t,o.radius,new v(0,1,0),new v(0,0,1)),i,!0),e}function gf(o){const e=new je;return ct(e,o.points.map(Ji),tr(o)),e}function yf(o){const e=new je,t=Ji(o.origin),i=Ji(o.direction).normalize(),s=Math.abs(i.y)<.9?new v(0,1,0):new v(1,0,0),r=new v().crossVectors(s,i).normalize(),n=new v().crossVectors(i,r).normalize(),a=Be.degToRad(Math.max(0,Math.min(360,o.angle))/2),l=tr(o),c=[];for(let h=0;h<64;h++){const d=h/64*Math.PI*2,p=r.clone().multiplyScalar(Math.cos(d)).addScaledVector(n,Math.sin(d));c.push(t.clone().addScaledVector(i,Math.cos(a)*o.length).addScaledVector(p,Math.sin(a)*o.length))}ct(e,c,l,!0);for(const h of[0,16,32,48])ct(e,[t,c[h]],l);return e}function _f(o,e,t){return o.applyQuaternion(new pe(...t)).add(new v(...e))}function vf(o){const e=new je,t=tr(o),[i,s,r]=o.halfExtents,n=[[-i,-s,-r],[i,-s,-r],[i,s,-r],[-i,s,-r],[-i,-s,r],[i,-s,r],[i,s,r],[-i,s,r]].map(([a,l,c])=>_f(new v(a,l,c),o.center,o.rotation));for(const[a,l]of[[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4],[0,4],[1,5],[2,6],[3,7]])ct(e,[n[a],n[l]],t);return e}function wf(o){const e=new je,t=tr(o),i=new pe(...o.rotation),s=Ji(o.center),r=a=>a.applyQuaternion(i).add(s),n=(a,l,c)=>Dr(new v(0,a,0),o.radius,l,c).map(r);ct(e,n(o.halfHeight,new v(1,0,0),new v(0,0,1)),t,!0),ct(e,n(-o.halfHeight,new v(1,0,0),new v(0,0,1)),t,!0);for(const[a,l]of[[o.radius,0],[-o.radius,0],[0,o.radius],[0,-o.radius]])ct(e,[r(new v(a,-o.halfHeight,l)),r(new v(a,o.halfHeight,l))],t);for(const a of["x","z"]){const l=[];for(let c=0;c<=32;c++){const h=c/32*Math.PI,d=new v(0,o.halfHeight+Math.sin(h)*o.radius,0);d[a]=Math.cos(h)*o.radius,l.push(r(d))}for(let c=0;c<=32;c++){const h=Math.PI+c/32*Math.PI,d=new v(0,-o.halfHeight+Math.sin(h)*o.radius,0);d[a]=Math.cos(h)*o.radius,l.push(r(d))}ct(e,l,t)}return e}function xf(o){const e=o.kind==="line"?gf(o):o.kind==="sphere"?mf(o):o.kind==="cone"?yf(o):o.kind==="box"?vf(o):wf(o);return e.layers.set(K),e.traverse(t=>t.layers.set(K)),e}function bf(o,e){const t=new Le({color:e.color,depthTest:!1,transparent:!0,opacity:e.writable?.92:.35}),i=new O(bc,t);return Object.defineProperty(i,"isSpatialHandleMesh",{value:!0}),i.position.copy(Ji(e.position)),i.renderOrder=998,i.layers.set(K),To.set(i,{nodeId:o,handle:e}),i}function Sf(o,e){const t=[],i=[];for(const s of e){for(const r of s.guides)t.push(xf(r));for(const r of s.handles){const n=bf(o,r);t.push(n),i.push(n)}}return{roots:t,handles:i}}function ul(o){return To.get(o)??null}function Dn(o,e){const t=To.get(o);o.material.color.set(e&&t?.handle.writable?"#ffffff":t?.handle.color??"#ffffff")}function pl(o,e){const t=o.position.distanceTo(e.position);o.scale.setScalar(Math.max(.025,t*.012))}function Mf(o,e,t){const i=o,s=i.geometry;s&&s!==bc&&!e.has(s)&&(s.dispose(),e.add(s));const r=Array.isArray(i.material)?i.material:i.material?[i.material]:[];for(const n of r)t.has(n)||(n.dispose(),t.add(n))}function fl(o){const e=new Set,t=new Set;for(const i of o)i.removeFromParent(),i.traverse(s=>Mf(s,e,t))}function yi(o,e,t,i=1.15){if(o.isEmpty())return 3;const s=t.clone().normalize(),r=Math.abs(s.dot(e.up))>.999?new v(0,0,1):e.up,n=new v().crossVectors(r,s).normalize(),a=new v().crossVectors(s,n).normalize(),l=o.getCenter(new v);let c=0,h=0,d=0;for(const m of[o.min.x,o.max.x])for(const y of[o.min.y,o.max.y])for(const _ of[o.min.z,o.max.z]){const w=new v(m,y,_).sub(l);d=Math.max(d,Math.abs(w.dot(n))),h=Math.max(h,Math.abs(w.dot(a))),c=Math.max(c,Math.abs(w.dot(s)))}const p=Be.degToRad(e.fov*.5),u=Math.atan(Math.tan(p)*Math.max(e.aspect,.01)),f=Math.max(h/Math.tan(p),d/Math.tan(u));return Math.max(f*i+c,e.near*4,.01)}const Cf=3,Pf=.05,Af=.03,zf=.6,Ef=.15,Of=.08,Tf=3,kf=.45,Sc=.001,Rf=24,If=6,Lf=[[0,0,0],[0,0,1],[0,1,0],[0,1,1],[1,0,0],[1,0,1],[1,1,0],[1,1,1]];function Bf(o){const e=Be.clamp(o*Ef,Of,Tf);return Math.max(Math.min(e,o*kf),Sc)}function Vn(o){return Be.clamp(o*Pf,Af,zf)}function Ff(o,e,t=!1){const{min:i,max:s}=o,r=h=>t?Math.max(h/2,Sc):Bf(h),n=r(s.x-i.x),a=r(s.y-i.y),l=r(s.z-i.z);let c=0;for(const[h,d,p]of Lf){const u=h===0?i.x:s.x,f=d===0?i.y:s.y,m=p===0?i.z:s.z,y=h===0?n:-n,_=d===0?a:-a,w=p===0?l:-l;e[c++]=u,e[c++]=f,e[c++]=m,e[c++]=u+y,e[c++]=f,e[c++]=m,e[c++]=u,e[c++]=f,e[c++]=m,e[c++]=u,e[c++]=f+_,e[c++]=m,e[c++]=u,e[c++]=f,e[c++]=m,e[c++]=u,e[c++]=f,e[c++]=m+w}}class Un extends Ur{entityObject;_fixedSize;_edges;_objectFrame;_toObject=new Tt;_point=new v;_axisX=new v;_axisY=new v;_axisZ=new v;_scale=new v;_positions=new Float32Array(Rf*If);_box=new St;_worldPos=new v;_fixedExtent=new v;_standoff=new v;_lastRootMatrix=new Float32Array(16);_requiresContinuousBounds;constructor(e,t){const i=new jr,s=new Gr({color:t.color,linewidth:t.lineWidth??Cf,worldUnits:!1,alphaToCoverage:!0,toneMapped:!1,depthTest:!1,depthWrite:!1});super(i,s),this.entityObject=e,this._fixedSize=t.fixedSize,this._edges=t.edges===!0,this._objectFrame=t.frame==="object";let r=!1;e.traverse(n=>{const a=n;(n.isSkinnedMesh||Array.isArray(a.morphTargetInfluences)&&a.morphTargetInfluences.length>0||cc(n)!==null)&&(r=!0)}),this._requiresContinuousBounds=r,this.renderOrder=1,this.frustumCulled=!1,i.setPositions(this._positions),this.update()}setColor(e){this.material.color.setHex(e)}updateIfNeeded(){this.entityObject.updateWorldMatrix(!0,!1);const e=this.entityObject.matrixWorld.elements;let t=!1;for(let i=0;i<e.length;i++)if(e[i]!==this._lastRootMatrix[i]){t=!0;break}(t||this._requiresContinuousBounds)&&this.update()}update(){this.entityObject.updateWorldMatrix(!0,!1);const e=this._objectFrame&&this._fixedSize===void 0&&Math.abs(this.entityObject.matrixWorld.determinant())>1e-30;this.entityObject.matrixWorld.extractBasis(this._axisX,this._axisY,this._axisZ);const t=e?this._scale.set(this._axisX.length(),this._axisY.length(),this._axisZ.length()):this._scale.set(1,1,1);if(this._fixedSize!==void 0)this.entityObject.getWorldPosition(this._worldPos),this._fixedExtent.setScalar(this._fixedSize),this._box.setFromCenterAndSize(this._worldPos,this._fixedExtent);else if(e?(this._toObject.copy(this.entityObject.matrixWorld).invert(),dd(this.entityObject,this._toObject,this._box)):mi(this.entityObject,this._box),this._box.isEmpty())return;if(this._box.getSize(this._standoff).multiply(t),this._standoff.set(Vn(this._standoff.x),Vn(this._standoff.y),Vn(this._standoff.z)).divide(t),this._box.expandByVector(this._standoff),Ff(this._box,this._positions,this._edges),e){const s=this.entityObject.matrixWorld;for(let r=0;r<this._positions.length;r+=3)this._point.set(this._positions[r],this._positions[r+1],this._positions[r+2]).applyMatrix4(s),this._positions[r]=this._point.x,this._positions[r+1]=this._point.y,this._positions[r+2]=this._point.z}const i=this.geometry.getAttribute("instanceStart");i&&(i.data.needsUpdate=!0),this._lastRootMatrix.set(this.entityObject.matrixWorld.elements)}dispose(){this.geometry.dispose(),this.material.dispose()}}function Nf({BlendFunction:o,KernelSize:e,OutlineEffect:t},i,s,r){const n=new t(i,s,{blendFunction:o.ALPHA,visibleEdgeColor:r.visible,hiddenEdgeColor:r.hidden,edgeStrength:5,pulseSpeed:0,blur:!0,kernelSize:e.MEDIUM,resolutionScale:.5,xRay:!0});n.selectionLayer=eo,s.layers.disable(eo);const a=n.getFragmentShader(),l="vec3 color=edge.x*visibleEdgeColor+edge.y*hiddenEdgeColor;",c="edge*=(edgeStrength*mask.x*pulse);";a.includes(l)&&a.includes(c)&&(n.setFragmentShader(a.replace("uniform float edgeStrength;","uniform float edgeStrength;uniform float volterCrisp;").replace(c,"edge*=(edgeStrength*(volterCrisp>0.5?1.0:mask.x)*pulse);").replace(l,`${l}if(volterCrisp>0.5){float volterSum=edge.x+edge.y;if(volterSum>0.0)color/=volterSum;edge=min(edge,vec2(1.0));}`)),n.uniforms.set("volterCrisp",{value:0}));const h=n.update.bind(n);return n.update=(d,p,u)=>{const f=n.camera,m=f.layers.isEnabled(K);f.layers.disable(K);try{h(d,p,u)}finally{m&&f.layers.enable(K)}},Zi.set(n,{colors:r,roots:0}),en(n),n}const ho=new WeakMap;function Hf(o,e,t,i,s){const r=ho.get(e)?.pop();return r?(r.mainScene=t,r.mainCamera=i,i.layers.disable(eo),Zi.set(r,{colors:s,roots:0}),en(r),r):Nf(o,t,i,s)}function Df(o,e,t){e.selection.clear(),t?.setEffects([]);const i=ho.get(o)??[];i.includes(e)||i.push(e),ho.set(o,i)}const Vf=`uniform lowp sampler2D inputBuffer;uniform vec2 texelSize;uniform float volterReach;
|
|
1041
|
+
varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;
|
|
1042
|
+
void main(){
|
|
1043
|
+
vec2 uv=(vUv0+vUv1)*0.5;
|
|
1044
|
+
vec2 c=texture2D(inputBuffer,uv).rg;
|
|
1045
|
+
float edge=0.0;float visibility=1.0;
|
|
1046
|
+
for(int i=1;i<=2;i++){
|
|
1047
|
+
if(float(i)>volterReach||edge>0.0)break;
|
|
1048
|
+
vec2 o=texelSize*float(i);
|
|
1049
|
+
vec2 s0=texture2D(inputBuffer,uv+vec2(o.x,0.0)).rg;vec2 s1=texture2D(inputBuffer,uv-vec2(o.x,0.0)).rg;
|
|
1050
|
+
vec2 s2=texture2D(inputBuffer,uv+vec2(0.0,o.y)).rg;vec2 s3=texture2D(inputBuffer,uv-vec2(0.0,o.y)).rg;
|
|
1051
|
+
if(abs(s0.x-c.x)>0.5||abs(s1.x-c.x)>0.5||abs(s2.x-c.x)>0.5||abs(s3.x-c.x)>0.5)edge=1.0;
|
|
1052
|
+
visibility=min(min(s0.y,s1.y),min(s2.y,s3.y));
|
|
1053
|
+
}
|
|
1054
|
+
gl_FragColor.rg=(1.0-visibility>0.001)?vec2(edge,0.0):vec2(0.0,edge);
|
|
1055
|
+
}`,ml=new WeakMap,Zi=new WeakMap;function en(o){const e=Zi.get(o);if(!e)return;const t=e.roots===1&&e.colors.active?e.colors.active:e.colors;o.visibleEdgeColor.setHex(t.visible),o.hiddenEdgeColor.setHex(t.hidden);const i=e.colors.outline,s=i?.style==="crisp",r=i?.width??2;o.resolution.scale=s?1:.5,o.blurPass.enabled=!s,o.blurPass.kernelSize=2;const n=o.outlinePass.fullscreenMaterial,a=ml.get(n)??n.fragmentShader;ml.set(n,a);const l=s?Vf:a;n.fragmentShader!==l&&(n.fragmentShader=l,n.needsUpdate=!0),n.uniforms.volterReach={value:Math.max(1,Math.round(r/2))},o.edgeStrength=s?8:5;const c=o.uniforms.get("volterCrisp");c&&(c.value=s?1:0),o.xRay=i?.hidden??!0}function Uf(o,e){Zi.set(o,{colors:e,roots:Zi.get(o)?.roots??0}),en(o)}function jf(o){return o.isBone?!1:o.isMesh||o.isLine||o.isPoints||o.isSprite}function Mc(o){const e=[],t=new Set;for(const i of o)i.isBone||i.traverse(s=>{t.has(s)||at(s)||!jf(s)||(t.add(s),e.push(s))});return e}function gl(o,e){const t=[...e],i=t.filter(n=>!n.isBone).length,s=Zi.get(o);s&&s.roots!==i&&(s.roots=i,en(o));const r=Mc(t);o.selection.size===r.length&&r.every(n=>o.selection.has(n))||o.selection.set(r)}function yl(o,e){const t=new U(o);if(!e||e.toneMapping===Qd)return t;const i=e.toneMappingExposure||1;if(e.toneMapping===$d)return t.multiplyScalar(1/i);if(e.toneMapping===Kd)return Gf(t,i);if(e.toneMapping===eu)return Wf(t,i);if(e.toneMapping!==oc)return t;const s=[[.59719,.35458,.04823],[.076,.90834,.01566],[.0284,.13383,.83777]],r=[[1.60475,-.53108,-.07367],[-.10208,1.10813,-.00605],[-.00327,-.07276,1.07602]],n=d=>(d*(d+.0245786)-90537e-9)/(d*(.983729*d+.432951)+.238081),a=d=>{let p=0,u=64;for(let f=0;f<60;f++){const m=(p+u)/2;n(m)<d?p=m:u=m}return(p+u)/2},c=Hi($r(r),[t.r,t.g,t.b]).map(d=>d<=0?0:a(Math.min(d,.999))),h=Hi($r(s),c).map(d=>Math.max(0,d)*(.6/i));return new U().setRGB(h[0],h[1],h[2],Mo)}function Gf(o,e){const t=[[.6274,.3293,.0433],[.0691,.9195,.0113],[.0164,.088,.8956]],i=[[1.6605,-.5876,-.0728],[-.1246,1.1329,-.0083],[-.0182,-.1006,1.1187]],s=[[.856627153315983,.0951212405381588,.0482516061458583],[.137318972929847,.761241990602591,.101439036467562],[.11189821299995,.0767994186031903,.811302368396859]],r=[[1.1271005818144368,-.11060664309660323,-.016493938717834573],[-.1413297634984383,1.157823702216272,-.016493938717834257],[-.14132976349843826,-.11060664309660294,1.2519364065950405]],n=-12.47393,a=4.026069,l=f=>{const m=f*f,y=m*m;return 15.5*y*m-40.14*y*f+31.96*y-6.868*m*f+.4298*m+.1191*f-.00232},c=f=>{let m=0,y=1;for(let _=0;_<60;_++){const w=(m+y)/2;l(w)<f?m=w:y=w}return(m+y)/2},h=Hi(t,[o.r,o.g,o.b]),p=Hi($r(r),h.map(f=>Math.max(0,f)**(1/2.2))).map(f=>2**(c(f)*(a-n)+n)),u=Hi(i,Hi($r(s),p)).map(f=>Math.max(0,f)/e);return new U().setRGB(u[0],u[1],u[2],Mo)}function Hi(o,e){return[o[0][0]*e[0]+o[0][1]*e[1]+o[0][2]*e[2],o[1][0]*e[0]+o[1][1]*e[1]+o[1][2]*e[2],o[2][0]*e[0]+o[2][1]*e[1]+o[2][2]*e[2]]}function $r(o){const[[e,t,i],[s,r,n],[a,l,c]]=o,h=r*c-n*l,d=-(s*c-n*a),p=s*l-r*a,u=e*h+t*d+i*p;return[[h/u,-(t*c-i*l)/u,(t*n-i*r)/u],[d/u,(e*c-i*a)/u,-(e*n-i*s)/u],[p/u,-(e*l-t*a)/u,(e*r-t*s)/u]]}function Wf(o,e){const t=n=>(n*(.88*n+.06)+.002)/(n*(.88*n+.6)+.06)-.03333333333333333,i=t(1),s=n=>t(n)/i,r=n=>{if(n<=0)return 0;let a=0,l=1;for(let c=0;c<60;c++){const h=(a+l)/2;s(h)<n?a=h:l=h}return(a+l)/2};return new U().setRGB(r(Math.min(o.r,.999))/e,r(Math.min(o.g,.999))/e,r(Math.min(o.b,.999))/e,Mo)}const Xf=new U(5231045),qf=new U(10481896),_l=64,Yf=.6;class Jf extends je{constructor(e){super(),this.source=e,this.name="Trigger Volume Helper",this.matrixAutoUpdate=!1,this.renderOrder=998,Ze(this,"editorHelper",!0),Ze(this,"editorHelperType","trigger-volumes"),this.layers.set(K),this.refresh(!0)}signature="";selected=!1;setSelected(e){this.selected!==e&&(this.selected=e,this.refresh(!0))}update(){this.refresh(!1),this.source.updateWorldMatrix(!0,!1),this.matrix.copy(this.source.matrixWorld),this.matrixWorldNeedsUpdate=!0}dispose(){this.clearVisuals(),this.removeFromParent()}refresh(e){const t=oo(this.source);if(!t)return;const i=t.radius,s=String(i);if(!e&&s===this.signature)return;this.signature=s,this.clearVisuals();const r=this.selected?qf:Xf,n=this.selected?1:.62,a=[];for(let u=0;u<_l;u+=1){const f=u/_l*Math.PI*2;a.push(Math.cos(f)*i,0,Math.sin(f)*i)}const l=new It;l.setAttribute("position",new _s(a,3));const c=new tc(l,this.lineMaterial(r,n));c.renderOrder=this.renderOrder,this.add(c);const h=[];for(const[u,f]of[[i,0],[-i,0],[0,i],[0,-i]])h.push(u,0,f,u,Yf,f);const d=new It;d.setAttribute("position",new _s(h,3));const p=new Vi(d,this.lineMaterial(r,n));p.renderOrder=this.renderOrder,this.add(p),this.traverse(u=>u.layers.set(K))}lineMaterial(e,t){return new $t({color:e,depthTest:!1,transparent:!0,opacity:t,toneMapped:!1})}clearVisuals(){for(const e of[...this.children]){e.removeFromParent();const t=e;t.geometry?.dispose();const i=Array.isArray(t.material)?t.material:[t.material];for(const s of i)s?.dispose()}}}function Zf(o){const e=new Set(o.values()),t=[];for(const i of e){let s=i.parent,r=!1;for(;s!==null;){if(e.has(s)){r=!0;break}s=s.parent}r||t.push(i)}return t}function Qf(o,e){const t=new Set;for(const i of e){const s=o.get(i);s&&t.add(s)}return[...t].filter(i=>{for(let s=i.parent;s!==null;s=s.parent)if(t.has(s))return!1;return!0})}const Fr=.5,$f=1e3,Kf=new v(0,1,0),em=new v(0,0,1),jn=new xo,tm=new v,vl=new v,Gn=new pe,wl=new v,im=1e-8,sm=[new v(1,0,0),new v(-1,0,0),new v(0,1,0),new v(0,-1,0),new v(0,0,1),new v(0,0,-1)],Wn=[[.96,.2,.32],[.53,.84,.01],[.16,.55,.96]],xl=[[0,1],[1,1],[2,1]],rm=[[0,1],[2,1],[1,-1]],nm=[[0,1],[2,1],[1,1]],bl=["X","Y","Z"],uo={degrees:50,axis:"vertical"};function Xn(o,e=uo){const t=Number.isFinite(o)&&o>.01?o:1,i=Number.isFinite(e.degrees)&&e.degrees>0&&e.degrees<180?e.degrees:uo.degrees,s=Be.degToRad(i/2),n=e.axis==="horizontal"||e.axis==="larger"&&t>=1||e.axis==="smaller"&&t<1?Math.atan(Math.tan(s)/t):s;return Be.radToDeg(n*2)}function om(o){const e=Math.max(o.r,o.g,o.b),t=Math.min(o.r,o.g,o.b),i=e-t;let s=0;return i>0&&(e===o.r?s=((o.g-o.b)/i+6)%6:e===o.g?s=(o.b-o.r)/i+2:s=(o.r-o.g)/i+4,s/=6),{h:s,s:e===0?0:i/e,v:e}}function am(o,e,t,i){const s=Math.floor(o*6),r=o*6-s,n=t*(1-e),a=t*(1-r*e),l=t*(1-(1-r)*e),[c,h,d]=[[t,l,n],[a,t,n],[n,t,l],[n,a,t],[l,n,t],[t,n,a]][(s%6+6)%6];return i.setRGB(c,h,d)}const lm=.356,cm=7.5/17.5;function hm(o,e){const i=document.createElement("canvas");i.width=32,i.height=32;const s=i.getContext("2d");s&&(s.fillStyle=`#${o.getHexString()}`,s.font=`bold ${Math.round(32*.8)}px system-ui, -apple-system, sans-serif`,s.textAlign="center",s.textBaseline="middle",s.fillText(e,32/2,32/2+1));const r=new Co(i);return r.generateMipmaps=!1,r.minFilter=ac,r.colorSpace=wt,r}function ko(o){const t=document.createElement("canvas");t.width=32,t.height=32;const i=t.getContext("2d");i&&o(i,32,32/2-1);const s=new Co(t);return s.colorSpace=wt,s.generateMipmaps=!1,s.minFilter=ac,s}function dm(){return ko((o,e,t)=>{o.beginPath(),o.arc(e/2,e/2,t,0,Math.PI*2),o.fillStyle="#ffffff",o.fill()})}function um(){return ko((o,e,t)=>{const i=fo/po*e;o.beginPath(),o.arc(e/2,e/2,t-i/2,0,Math.PI*2),o.lineWidth=i,o.strokeStyle="#ffffff",o.stroke()})}function pm(o){return ko((e,t,i)=>{const s=cm*(2*i),r=Math.round(s/.72);e.font=`bold ${r}px system-ui, -apple-system, sans-serif`,e.fillStyle="#ffffff",e.textAlign="center",e.textBaseline="middle",e.fillText(o,t/2,t/2+2,2*i*.86)})}const fm=new v(1,.72,1).normalize(),bt=90,mm=32,po=15,gm=2.75,fo=2,ym=74.5,Ro=73.5,Cc=8.5+ym/2-bt/2,Io=38+Ro/2-bt/2,_m=Cc+bt/2,vm=Io+bt/2+Ro/2,wm=Io+bt/2+Ro/2+16-14.5,Pc=`
|
|
1056
|
+
float volterGrazingFade(vec3 worldPosition, vec3 eye, vec3 planeNormal, float amount) {
|
|
1057
|
+
vec3 toEye = eye - worldPosition;
|
|
1058
|
+
float toEyeLength = max(length(toEye), 1e-6);
|
|
1059
|
+
float graze = 1.0 - abs(dot(toEye / toEyeLength, planeNormal));
|
|
1060
|
+
graze *= graze;
|
|
1061
|
+
return mix(1.0, 1.0 - graze * graze, amount);
|
|
1062
|
+
}
|
|
1063
|
+
`,Lo=200,mo=2,go=Lo*2/mo;function Sl(o){const e=[];for(let t=0;t<go;t++){const i=-Lo+t*mo,s=i+mo;o===0?e.push(i,.001,0,s,.001,0):o===2?e.push(0,.001,i,0,.001,s):e.push(0,i,0,0,s,0)}return e}function xm(o,e,t){o.onBeforeCompile=i=>{i.uniforms.uGrazingFade=e,i.uniforms.uPlaneNormal=t,i.vertexShader=i.vertexShader.replace("void main() {",`varying vec3 vAxisWorld;
|
|
1064
|
+
void main() {`).replace("vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );",`vAxisWorld = ( modelMatrix * vec4( position.y < 0.5 ? instanceStart : instanceEnd, 1.0 ) ).xyz;
|
|
1065
|
+
vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );`),i.fragmentShader=i.fragmentShader.replace("void main() {",`varying vec3 vAxisWorld;
|
|
1066
|
+
uniform float uGrazingFade;
|
|
1067
|
+
uniform vec3 uPlaneNormal;
|
|
1068
|
+
${Pc}
|
|
1069
|
+
void main() {`).replace("gl_FragColor = vec4( diffuseColor.rgb, alpha );","gl_FragColor = vec4( diffuseColor.rgb, alpha * volterGrazingFade( vAxisWorld, cameraPosition, uPlaneNormal, uGrazingFade ) );")},o.customProgramCacheKey=()=>"volter-axis-grazing-fade"}const us=new v,bm=new pe,Ri=new v,Sm=new v(0,1,0);function Mm(o){const e=new vo(o,o);e.rotateX(-Math.PI/2);const t=new vs({uniforms:{uColor:{value:new U(10066329)},uMajorColor:{value:new U(10066329)},uOpacity:{value:1},uLineWidth:{value:1},uMajorWidth:{value:1},uAligned:{value:0},uMajorEvery:{value:10},uFadeStart:{value:o/2*.55},uFadeEnd:{value:o/2},uGrazingFade:{value:0},uPlaneNormal:{value:new v(0,1,0)},uUnit:{value:1},uMinorFade:{value:1},uCenter:{value:new Oe},uReach:{value:1}},vertexShader:`
|
|
1070
|
+
varying vec3 vWorld;
|
|
1071
|
+
void main() {
|
|
1072
|
+
vWorld = (modelMatrix * vec4(position, 1.0)).xyz;
|
|
1073
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
1074
|
+
}
|
|
1075
|
+
`,fragmentShader:`
|
|
1076
|
+
uniform vec3 uColor;
|
|
1077
|
+
uniform vec3 uMajorColor;
|
|
1078
|
+
uniform float uOpacity;
|
|
1079
|
+
uniform float uLineWidth;
|
|
1080
|
+
uniform float uMajorWidth;
|
|
1081
|
+
uniform float uAligned;
|
|
1082
|
+
uniform float uMajorEvery;
|
|
1083
|
+
uniform float uFadeStart;
|
|
1084
|
+
uniform float uFadeEnd;
|
|
1085
|
+
uniform float uGrazingFade;
|
|
1086
|
+
uniform vec3 uPlaneNormal;
|
|
1087
|
+
uniform float uUnit;
|
|
1088
|
+
uniform float uMinorFade;
|
|
1089
|
+
uniform vec2 uCenter;
|
|
1090
|
+
uniform float uReach;
|
|
1091
|
+
varying vec3 vWorld;
|
|
1092
|
+
${Pc}
|
|
1093
|
+
// Coverage of a line WIDTH device pixels across, with a one-pixel
|
|
1094
|
+
// anti-aliased edge — so its core is FULL, the way Blender's is. The
|
|
1095
|
+
// earlier form (1 - distance/width) was a triangle with no plateau:
|
|
1096
|
+
// whether a line reached its own colour depended on where the nearest
|
|
1097
|
+
// fragment centre happened to fall, and the measured peak wandered
|
|
1098
|
+
// between 0.67 and 1 of it.
|
|
1099
|
+
float gridLine(vec2 coord, float width) {
|
|
1100
|
+
vec2 d = max(fwidth(coord), vec2(1e-6));
|
|
1101
|
+
vec2 dist = abs(fract(coord - 0.5) - 0.5) / d;
|
|
1102
|
+
vec2 cov = clamp(width * 0.5 - dist + 0.5, 0.0, 1.0);
|
|
1103
|
+
return max(cov.x, cov.y);
|
|
1104
|
+
}
|
|
1105
|
+
// One device pixel, the one nearest the line, and no anti-aliasing: Blender's lines in an
|
|
1106
|
+
// axis-aligned view (\`GRID_ALIGNED\`, which outputs no line-smoothing data for them).
|
|
1107
|
+
float alignedLine(vec2 coord) {
|
|
1108
|
+
vec2 dist = abs(fract(coord - 0.5) - 0.5) / max(fwidth(coord), vec2(1e-6));
|
|
1109
|
+
return max(step(dist.x, 0.5), step(dist.y, 0.5));
|
|
1110
|
+
}
|
|
1111
|
+
void main() {
|
|
1112
|
+
vec2 world = abs(uPlaneNormal.y) > 0.5 ? vWorld.xz : abs(uPlaneNormal.z) > 0.5 ? vWorld.xy : vWorld.zy;
|
|
1113
|
+
vec2 p = world / uUnit;
|
|
1114
|
+
if (uAligned > 0.5) {
|
|
1115
|
+
// BLENDER'S THREE LEVELS in an axis-aligned orthographic view
|
|
1116
|
+
// (\`overlay_grid_vert.glsl\`, \`OVERLAY_GRID_STEPS_DRAW\` 3): the unit, the next step and
|
|
1117
|
+
// the one after, with f the level's fraction (\`uMinorFade\` is 1 - f). Level 0 is the
|
|
1118
|
+
// grid colour at alpha 1 - f, further faded as its cells shrink toward a pixel
|
|
1119
|
+
// (\`smoothstep(step / 4, step / 64, pixel size)\`, written in increasing order); level 1 is opaque and 1 - f of the
|
|
1120
|
+
// way to the emphasis colour; level 2 is the emphasis colour. A line on a higher level
|
|
1121
|
+
// is that level's.
|
|
1122
|
+
float top = alignedLine(p / (uMajorEvery * uMajorEvery));
|
|
1123
|
+
float middle = alignedLine(p / uMajorEvery);
|
|
1124
|
+
float bottom = alignedLine(p);
|
|
1125
|
+
float pixel = max(fwidth(world).x, fwidth(world).y);
|
|
1126
|
+
float bottomAlpha = uMinorFade * (1.0 - smoothstep(uUnit * 0.015625, uUnit * 0.25, pixel));
|
|
1127
|
+
float emphasis = top > 0.5 ? 1.0 : middle > 0.5 ? uMinorFade : 0.0;
|
|
1128
|
+
// The theme's grid colour carries alpha 0x80 and its emphasis colour none, and the
|
|
1129
|
+
// two colours here were fitted to Blender's PERSPECTIVE frames, where four additive
|
|
1130
|
+
// passes (1 + 1/2 + 1/4 + 1/8) take that alpha to about 0.94. Drawn once, as an
|
|
1131
|
+
// aligned view draws it, the grid colour keeps 0.502 / 0.941 of that. (Measured: the
|
|
1132
|
+
// 10 cm lines +5 over the ground at 198 px per metre, predicted +5.4; the 1 m lines
|
|
1133
|
+
// 89 against 88. The 0.94 is inferred from the passes, not read off a frame.)
|
|
1134
|
+
float levelAlpha = (top > 0.5 || middle > 0.5 ? 1.0 : bottom * bottomAlpha) * mix(0.533, 1.0, emphasis);
|
|
1135
|
+
float edge = 1.0 - smoothstep(uFadeStart * uReach, uFadeEnd * uReach, length(world - uCenter));
|
|
1136
|
+
float alignedAlpha = levelAlpha * edge * uOpacity;
|
|
1137
|
+
if (alignedAlpha <= 0.002) discard;
|
|
1138
|
+
gl_FragColor = vec4(mix(uColor, uMajorColor, emphasis), alignedAlpha);
|
|
1139
|
+
#include <colorspace_fragment>
|
|
1140
|
+
return;
|
|
1141
|
+
}
|
|
1142
|
+
vec2 pixelsPerMetre = 1.0 / max(fwidth(p), vec2(1e-6));
|
|
1143
|
+
float minorVisible = smoothstep(4.0, 14.0, min(pixelsPerMetre.x, pixelsPerMetre.y)) * uMinorFade;
|
|
1144
|
+
// Both levels reach FULL strength in their own colour, as Blender's
|
|
1145
|
+
// do: the 1 m line is measured at exactly the palette's grid colour
|
|
1146
|
+
// and the 10 m line brighter than it (see uMajorColor). The minor
|
|
1147
|
+
// level's only attenuation is its own drop-out as cells shrink.
|
|
1148
|
+
float minor = gridLine(p, uLineWidth) * minorVisible;
|
|
1149
|
+
// The 10 m level is WIDER as well as brighter, which is what lets it
|
|
1150
|
+
// reach full coverage — and so its full colour. Measured across one
|
|
1151
|
+
// scanline of modeling-object-none.png at device resolution: the 1 m
|
|
1152
|
+
// line is 4 px at half rise and plateaus at 83, the 10 m line is 6 px
|
|
1153
|
+
// and plateaus at 101. At one shared width ours drew a 10 m line that
|
|
1154
|
+
// never exceeded 0.75 coverage and so measured 91, not 102.
|
|
1155
|
+
float major = gridLine(p / uMajorEvery, uMajorWidth);
|
|
1156
|
+
float line = max(minor, major);
|
|
1157
|
+
float fade = 1.0 - smoothstep(uFadeStart * uReach, uFadeEnd * uReach, length(world - uCenter));
|
|
1158
|
+
// The floor's DEPTH, beside the band that ends its finite extent:
|
|
1159
|
+
// Blender's own grazing-angle profile, transcribed from its frames
|
|
1160
|
+
// (see GRAZING_FADE_GLSL above). Without it this lattice reads the
|
|
1161
|
+
// same ink at the front of the frame and at the horizon.
|
|
1162
|
+
fade *= volterGrazingFade(vWorld, cameraPosition, uPlaneNormal, uGrazingFade);
|
|
1163
|
+
float alpha = line * fade * uOpacity;
|
|
1164
|
+
if (alpha <= 0.002) discard;
|
|
1165
|
+
// WHICH level a fragment belongs to is the major's SHARE of the
|
|
1166
|
+
// coverage being drawn, never a comparison of the two and never the
|
|
1167
|
+
// major's raw coverage. Every 10 m line is also a 1 m line, so there
|
|
1168
|
+
// the two are equal: a step() between them compares values equal to
|
|
1169
|
+
// within rounding and flips per fragment (photographed with the major
|
|
1170
|
+
// forced white: the 10 m lines came out DOTTED), and mixing by the raw
|
|
1171
|
+
// coverage dilutes the colour by the line's own anti-aliasing (the
|
|
1172
|
+
// same lines then measured 91 where Blender's is 102). As a share it
|
|
1173
|
+
// is exactly 1 wherever the major draws — core and skirt alike, and in
|
|
1174
|
+
// the far field where the minor has dropped out — and 0 on a 1 m line.
|
|
1175
|
+
float majorShare = clamp(major / max(line, 1e-6), 0.0, 1.0);
|
|
1176
|
+
gl_FragColor = vec4(mix(uColor, uMajorColor, majorShare), alpha);
|
|
1177
|
+
#include <colorspace_fragment>
|
|
1178
|
+
}
|
|
1179
|
+
`,transparent:!0,depthWrite:!1,side:Di}),i=new O(e,t);return i.name="editor-floor-grid",i}function Cm(o){const{marqueeLine:e,marqueeFill:t,marqueeGap:i}=Ot.viewport;if(o===null)return{border:`1px solid ${e}`,background:t};const s=o/(window.devicePixelRatio||1),r=(n,a,l)=>`repeating-linear-gradient(${n}, ${e} 0 ${s}px, ${i} ${s}px ${2*s}px) ${a} / ${l} no-repeat border-box`;return{border:"1px solid transparent",background:[r("90deg","left top","100% 1px"),r("90deg","left bottom","100% 1px"),r("180deg","left top","1px 100%"),r("180deg","right top","1px 100%"),t].join(", ")}}class Bo{setTransformMode(e){this._store.shell.setTransformMode(e)}camera;orthographicCamera;orbitControls;transformControls;_auxRotateControls;_auxScaleControls;_activeGizmo;raycaster=(()=>{const e=new lt;return e.layers.enableAll(),e})();grid;_boxHelpers=new Map;_selectionMarks={outline:!0,wire:!1,box:!1};_unsubscribeSelectionTheme=()=>{};_constraintHelpers=new Map;_constraintControlRaycaster=(()=>{const e=new lt;return e.layers.enableAll(),e})();_hoveredConstraintControl=null;_constraintControlPointerSession=!1;_reflectionProbeHelpers=new Map;_triggerVolumeHelpers=new Map;_cameraHelpers=new Map;_lightHelpers=new Map;_audioHelpers=new Map;_spatialHandleRoots=[];_spatialHandleMeshes=[];_spatialHandleRaycaster=(()=>{const e=new lt;return e.layers.enableAll(),e})();_activeSpatialHandle=null;_hoveredSpatialHandle=null;_spatialHandleDragPlane=new Ha;_spatialHandleDragOffset=new v;_spatialHandleDragPoint=new v;_orbitEnabledBeforeHandleDrag=!0;_transformEnabledBeforeHandleDrag=!0;_gizmoHelper;_editorAmbient;_editorDirLight;_lightRig;_scene;_contentBoundsBox=new St;_contentBoundsAt=0;_renderer;_sparkRenderer=null;_sparkRendererLoading=!1;_sparkRendererFailed=!1;_lastSparkDiscoveryAt=Number.NEGATIVE_INFINITY;_disposed=!1;_editorObjects=[];_presentation=null;_axisLines=null;_verticalAxisLine=null;_axisLineWidth=null;_axisLineCss(e){return e===null?2:e/(this._renderer?.getPixelRatio()??1)}_axesWanted=!1;_stageAxes="floor";_lookAxisHexes=[null,null,null];_lookGridHex=null;_lookBackgroundHex=null;_lookToneMapping=null;_lookExposure=null;_lookGizmoSizePx=null;_stageAxisFrame=xl;_appliedAxisSigns=[1,1,1];_gizmoLook={axes:null,navigation:null,hover:null,drag:null,opacity:null,arrowLength:null,arrowHead:null,ringWidth:null,navigationSize:null,navigationForm:"balls",background:null,navigationCorner:"top-right",highlightSaturation:null,highlightValue:null};_stageBoxSelect=null;_transformHandles={scale:!0,viewRotate:!0,freeMove:!0};_appliedArrow={length:1.2,head:1};_appliedRingWidth=1;_store;_objectMap=new Map;_canvas;_interactionElement;_onInteractionPointerUp;_onInteractionDblClick;_authoring;_pick;_drawCamera;get _screenCamera(){return this._drawCamera?.()??this.renderCamera}_standaloneAuthoring;_publishPickContext;_onlineAssetResolver;_onProjectionChange;_pointerDownPos=new Oe;_skipNextSync=!1;_marqueeActive=!1;_pointerSessionActive=!1;_marqueeDiv=null;_pointerDownButton=-1;_altDragOrbit=!1;_vcScene=new _o;_vcCamera;_vcClickTargets=[];_vcBalls=[];_vcStalks=[];_vcSolids=[];_vcSize=bt;_navigation="interactive";_marksLook="";_presentationGrid=!0;_vcMarginRight=Cc;_vcMarginTop=Io;_chromeInsetPx=0;_vcDir=new v;_previewClearColor=new U;_cameraView=null;_projection="perspective";_pendingProjection=null;_viewportAspect=1;_fieldOfView=uo;_orthographicHeight=10;_cameraViewMode=null;_orbitEnabledBeforeCameraView=!0;_orbitTargetBeforeCameraView=new v;_lastGizmoObjectMap=null;_lastGizmoSig="";_lastGizmoEpoch=-1;_threejsToolContextActive=!1;_threeSurfaceShowing=!1;_vcRaycaster=new lt;_dropOverlay=null;_groundPlane=new Ha(new v(0,1,0),0);_dragStartPos=new v;_dragStartQuat=new pe;_dragStartScale=new v;_attachedAuthoringId=null;_otherDragObjects=[];_allDragObjects=[];_preservedChildObjects=[];_activeTransformEditIds=[];_pivotDummy=new Rt;_dummyIsPresentationAnchor=!1;_pivotPos=new v;_surfaceSnapRaycaster=new lt;_surfaceSnapIndicator;_vertexSnapTargets=[];_vertexSnapIndicator;_vertexSnapThreshold=20;batchedRenderer;_helpers=new Map;_snapAnimating=!1;_snapStartTime=0;_snapDuration=400;_snapQ1=new pe;_snapQ2=new pe;_snapDist=0;_flyActive=!1;_snapHold=!1;_flyKeys=new Set;_flySpeed=5;_flyEuler=new ec(0,0,0,"YXZ");_rightMouseDown=!1;constructor(e,t,i,s=e,r={}){ud(),this._canvas=e,this._interactionElement=s,this._scene=t,this._renderer=r.renderer,this._store=i,this._authoring=r.authoring??(()=>Pr().activeAuthoring(this._store.shell)),this._pick=r.pick,this._drawCamera=r.drawCamera,this._standaloneAuthoring=r.authoring!==void 0,this._publishPickContext=r.publishPickContext??!0,this._chromeInsetPx=r.chromeInsetPx??0,this._onlineAssetResolver=r.onlineAssetResolver,this._onProjectionChange=r.onProjectionChange,this.camera=new bo(Xn(e.clientWidth/Math.max(1,e.clientHeight)),e.clientWidth/e.clientHeight,ro,no),this.camera.position.copy(fm).multiplyScalar(17.32),this.camera.lookAt(0,0,0),this.camera.layers.enableAll(),this._viewportAspect=e.clientWidth/Math.max(1,e.clientHeight),this.orthographicCamera=new Ui(-5,5,5,-5,ro,no),this.orthographicCamera.layers.enableAll(),this._syncOrthographicFromPerspective(),this.grid=Mm(400),this.grid.layers.set(K),t.add(this.grid);const n=new jr;n.setPositions(Sl(0)),n.setColors(new Array(go*2*3).fill(1)),this._axisLines=new Ur(n,new Gr({vertexColors:!0,linewidth:2,transparent:!0,opacity:1,depthWrite:!1,toneMapped:!1})),xm(this._axisLines.material,this.grid.material.uniforms.uGrazingFade,this.grid.material.uniforms.uPlaneNormal),this._axisLines.visible=!1,this._axisLines.layers.set(K),t.add(this._axisLines),this._unsubscribeSelectionTheme=Kr(e,()=>{$();const l=JSON.stringify([et(e),fa(e),ma(e)]);l!==this._marksLook&&(this._marksLook=l,this._boxHelpers.size>0&&this._syncBoxHelpers()),this._gizmoLook=ga(e),this._applyViewportLook(Qn(e)),this._applyGridLines(ah(e)),this._lookGizmoSizePx=ya(e),this._applyGizmoSize(),this._applyGizmoArrows(),this._readLookStage(e)}),this._lightRig=r?.lightRig!==!1,this._editorAmbient=new sc(16777215,.5),this._editorAmbient.layers.set(K),t.add(this._editorAmbient),this._editorDirLight=new ic(16777215,1),this._editorDirLight.position.set(10,20,10),this._editorDirLight.layers.set(K),t.add(this._editorDirLight),this._editorAmbient.visible=this._lightRig,this._editorDirLight.visible=this._lightRig,this.batchedRenderer=new Eo,this.batchedRenderer.layers.set(K),t.add(this.batchedRenderer),s.addEventListener("wheel",this._onTrackpadWheel,{passive:!1}),this.orbitControls=new Au(this.camera,s),this.orbitControls.enableDamping=!0,this.orbitControls.dampingFactor=.1,this.applyKeymapNavigation(),this._unsubscribeKeymap=lh(()=>this.applyKeymapNavigation()),this._installTurntable(),this.transformControls=new Pn(this.camera,e),this._auxScaleControls=new Pn(this.camera,e),this._auxScaleControls.setMode("scale"),this._auxRotateControls=new Pn(this.camera,e),this._auxRotateControls.setMode("rotate"),this._activeGizmo=this.transformControls;const a=l=>{const c=l.pointerDown.bind(l);l.pointerDown=h=>{l.getHelper().updateMatrixWorld(!0),c(h)},l.getRaycaster().layers.enableAll(),l.addEventListener("dragging-changed",h=>{const d=h.value;if(d?ph():fh(),this.orbitControls.enabled=!d,d){this._activeGizmo=l;for(const y of this._allGizmos())y!==l&&(y.enabled=!1);const p=l.object,u=l.mode==="translate"?"position":l.mode==="rotate"?"rotation":"scale",f=y=>this._authoring().transforms?.editability?.(y,u).writable??!0,m=this._attachedAuthoringId??(p&&this._authoringIdForObject(p))??"";if(p){if(this._dragStartPos.copy(p.position),this._dragStartQuat.copy(p.quaternion),this._dragStartScale.copy(p.scale),this._otherDragObjects=[],this._allDragObjects=[],this._pivotPos.copy(p.position),p===this._pivotDummy?null:this._authoringIdForObject(p))for(const x of this._store.shell.selectedEntityIds){if(x===m||!f(x))continue;const S=this._objectForAuthoringId(x);S&&this._otherDragObjects.push({id:x,obj:S,startPos:S.position.clone(),startQuat:S.quaternion.clone(),startScale:S.scale.clone()})}else for(const x of this._store.shell.selectedEntityIds){if(!f(x))continue;const S=this._objectForAuthoringId(x);S&&this._allDragObjects.push({id:x,obj:S,startPos:S.position.clone(),startQuat:S.quaternion.clone(),startScale:S.scale.clone()})}const _=p===this._pivotDummy?this._allDragObjects.map(({id:x})=>x):[m,...this._otherDragObjects.map(({id:x})=>x)];this._preservedChildObjects=this._preparePreservedChildren(_.filter(Boolean)),this._activeTransformEditIds=[...new Set([..._.filter(Boolean),...this._preservedChildObjects.map(({id:x})=>x)])];const w=this._authoring();for(const x of this._activeTransformEditIds)_a(w,x)}}else this._surfaceSnapIndicator.visible=!1,this._vertexSnapIndicator.visible=!1,this.syncFromStore()}),l.addEventListener("objectChange",()=>{const h=l.object;if(!h)return;const d=l.mode,p=this._store.shell.pivotMode==="individual-origins"||this._dummyIsPresentationAnchor,f=this._allDragObjects.length>0?this._allDragObjects:this._otherDragObjects;if(f.length>0){if(d==="translate"){const m=h.position.clone().sub(this._dragStartPos);for(const{obj:y,startPos:_}of f)y.position.copy(_).add(m)}else if(d==="rotate"){const m=h.quaternion.clone().multiply(this._dragStartQuat.clone().invert());if(p)for(const{obj:y,startQuat:_}of f)y.quaternion.copy(m).multiply(_);else for(const{obj:y,startPos:_,startQuat:w}of f){const x=_.clone().sub(this._pivotPos);x.applyQuaternion(m),y.position.copy(this._pivotPos).add(x),y.quaternion.copy(m).multiply(w)}}else if(d==="scale"){const m=new v(this._dragStartScale.x!==0?h.scale.x/this._dragStartScale.x:1,this._dragStartScale.y!==0?h.scale.y/this._dragStartScale.y:1,this._dragStartScale.z!==0?h.scale.z/this._dragStartScale.z:1);if(p)for(const{obj:y,startScale:_}of f)y.scale.copy(_).multiply(m);else for(const{obj:y,startPos:_,startScale:w}of f){const x=_.clone().sub(this._pivotPos);x.multiply(m),y.position.copy(this._pivotPos).add(x),y.scale.copy(w).multiply(m)}}}d==="translate"&&this._store.vertexSnapActive&&this._vertexSnapTargets.length>0?this._applyVertexSnap(h,f):d==="translate"&&this._store.shell.snapToSurface&&this._applySurfaceSnap(h,f),this._restorePreservedChildren();for(const m of this._boxHelpers.values())"update"in m&&m.update();this._flushGizmoToStoreLive()}),l.addEventListener("mouseUp",()=>{this._flushGizmoToStore()})};a(this.transformControls),a(this._auxRotateControls),a(this._auxScaleControls),this._gizmoHelper=this.transformControls.getHelper(),this._gizmoHelper.traverse(l=>l.layers.set(K)),t.add(this._gizmoHelper);for(const l of[this._auxRotateControls,this._auxScaleControls]){const c=l.getHelper();c.traverse(h=>h.layers.set(K)),c.visible=!1,t.add(c)}this._pivotDummy.layers.set(K),t.add(this._pivotDummy),this._surfaceSnapIndicator=new O(new tu(.08,.12,16),new Le({color:65416,side:Di,depthTest:!1})),this._surfaceSnapIndicator.rotation.x=-Math.PI/2,this._surfaceSnapIndicator.visible=!1,this._surfaceSnapIndicator.renderOrder=999,this._surfaceSnapIndicator.layers.set(K),t.add(this._surfaceSnapIndicator),this._vertexSnapIndicator=new O(new kt(1,8,8),new Le({color:65450,depthTest:!1})),this._vertexSnapIndicator.visible=!1,this._vertexSnapIndicator.renderOrder=999,this._vertexSnapIndicator.layers.set(K),t.add(this._vertexSnapIndicator),this._gizmoLook=ga(e),this._rebuildAxisLines();for(const l of this._allGizmos())this._installGizmoHighlight(l);this._patchGizmo(this._gizmoHelper),this._patchGizmo(this._auxRotateControls.getHelper()),this._patchGizmo(this._auxScaleControls.getHelper()),this._dropNegativeAxisHandles(this._gizmoHelper,["translate","scale"]),this._dropNegativeAxisHandles(this._auxScaleControls.getHelper(),["scale"]),this._patchCombinedScaleGizmo(this._auxScaleControls.getHelper()),this._applyGizmoArrows(),this._lookGizmoSizePx=ya(e),this._applyGizmoSize(),this._applyGizmoAxisFrame(),this._vcCamera=new Ui(-1.5,1.5,1.5,-1.5,.1,10),this._initOrientationGizmo(),window.addEventListener("keydown",this._onFlyKeyDown),window.addEventListener("keyup",this._onFlyKeyUp),s.addEventListener("pointerdown",this._onFlyPointerDown),s.addEventListener("pointerup",this._onFlyPointerUp),s.addEventListener("pointermove",this._onFlyPointerMove),s.addEventListener("wheel",this._onFlyWheel,{passive:!1}),e.addEventListener("pointerdown",this._onAltOrbitStart,{capture:!0}),window.addEventListener("pointerup",this._onAltOrbitRelease,{capture:!0}),window.addEventListener("pointercancel",this._onAltOrbitRelease,{capture:!0}),window.addEventListener("keydown",this._onSnapHoldKey),window.addEventListener("keyup",this._onSnapHoldKey),e.addEventListener("pointerdown",this._onPointerDown),s.addEventListener("pointermove",this._onPointerMove),this._onInteractionPointerUp=l=>{(l.target===e||l.target===s||this._pointerSessionActive)&&this._onPointerUp(l)},s.addEventListener("pointerup",this._onInteractionPointerUp),this._onInteractionDblClick=l=>{(l.target===e||l.target===s)&&this._onDoubleClick(l)},s.addEventListener("dblclick",this._onInteractionDblClick),e.addEventListener("dragover",this._onDragOver),e.addEventListener("dragleave",this._onDragLeave),e.addEventListener("drop",this._onDrop),this._editorObjects=[this.grid,...this._axisLines?[this._axisLines]:[],this._editorAmbient,this._editorDirLight,this.batchedRenderer,this._gizmoHelper,this._auxRotateControls.getHelper(),this._auxScaleControls.getHelper(),this._pivotDummy,this._surfaceSnapIndicator,this._vertexSnapIndicator],this._publishPickContext&&this._installPickContext(this.camera)}setScene(e){if(e===this._scene)return;for(const i of this._editorObjects)i.removeFromParent(),e.add(i);for(const i of this._boxHelpers.values())i.removeFromParent(),e.add(i);for(const i of this._constraintHelpers.values())i.removeFromParent(),e.add(i);for(const i of this._reflectionProbeHelpers.values())i.removeFromParent(),e.add(i);for(const i of this._triggerVolumeHelpers.values())i.removeFromParent(),e.add(i);for(const{helper:i}of this._cameraHelpers.values())i.removeFromParent(),e.add(i);for(const i of this._spatialHandleRoots)i.removeFromParent(),e.add(i);this._scene=e,this._contentBoundsAt=0;const t=this._lightRig&&!this._store.isAdoptedSceneActive&&this._presentation===null;this._editorAmbient.visible=t,this._editorDirLight.visible=t}get currentScene(){return this._scene}get renderCamera(){return this._cameraView??this.freeCamera}get freeCamera(){return this._projection==="orthographic"?this.orthographicCamera:this.camera}get projection(){return this._projection}_installPickContext(e){this._publishPickContext&&ol({camera:e,canvas:this._canvas,editorControls:{activate:(t,i)=>this._selectConstraintControlAt({clientX:t,clientY:i},!1),hover:(t,i)=>this._hoverConstraintControlAt({clientX:t,clientY:i}),clearHover:()=>this._clearConstraintControlHover()}})}setProjection(e){if(this._cameraView){this._pendingProjection=e;return}if(this._projection===e)return;e==="orthographic"?this._syncOrthographicFromPerspective():this._syncPerspectiveFromOrthographic(),this._projection=e;const t=this.freeCamera;this.orbitControls.object=t;for(const i of this._allGizmos())i.camera=t;this._applyGizmoSize(),this.orbitControls.update(),this._installPickContext(t),this._onProjectionChange?.(e)}_syncOrthographicFromPerspective(e=!1){const t=Math.max(.01,this.camera.position.distanceTo(this.orbitControls?.target??new v));e||(this._orthographicHeight=2*t*Math.tan(Be.degToRad(this.camera.fov*.5))),this.orthographicCamera.position.copy(this.camera.position),this.orthographicCamera.quaternion.copy(this.camera.quaternion),this.orthographicCamera.up.copy(this.camera.up),this.orthographicCamera.zoom=1,this._applyOrthographicFrustum(),this.orthographicCamera.updateMatrixWorld(!0)}_syncPerspectiveFromOrthographic(){const t=this._orthographicHeight/Math.max(this.orthographicCamera.zoom,.01)/(2*Math.tan(Be.degToRad(this.camera.fov*.5))),i=this.orthographicCamera.position.clone().sub(this.orbitControls.target).normalize();this.camera.position.copy(this.orbitControls.target).add(i.multiplyScalar(t)),this.camera.quaternion.copy(this.orthographicCamera.quaternion),this.camera.up.copy(this.orthographicCamera.up),this.camera.updateMatrixWorld(!0)}_applyOrthographicFrustum(){const e=this._orthographicHeight*.5,t=e*this._viewportAspect;this.orthographicCamera.left=-t,this.orthographicCamera.right=t,this.orthographicCamera.top=e,this.orthographicCamera.bottom=-e,this.orthographicCamera.updateProjectionMatrix()}setGizmoCamera(e){const t=e??this.freeCamera;if(this.transformControls.camera!==t){for(const i of this._allGizmos())i.camera=t;this._applyGizmoSize()}}applyKeymapNavigation(){const{orbit:e,turntable:t}=Ke();!t&&this.camera.up.y<.9999&&Math.abs(this.camera.up.z)<.9999&&this.camera.up.set(0,1,0),this.orbitControls.mouseButtons={LEFT:this._altDragOrbit?Ie.ROTATE:-1,MIDDLE:e==="middle"?Ie.ROTATE:Ie.PAN,RIGHT:e==="middle"?-1:Ie.ROTATE}}_unsubscribeKeymap=()=>{};_installTurntable(){const e=this.orbitControls,t=e._handleMouseDownDolly.bind(this.orbitControls),i=e._handleMouseMoveDolly.bind(this.orbitControls);let s=null;e._handleMouseDownDolly=c=>{if(t(c),s=null,Ke().zoom?.drag!=="dolly")return;const h=this._canvas.getBoundingClientRect().top,d=this.orbitControls.object;s={len0:Math.max(5+c.clientY-h,1),offset:d.position.clone().sub(this.orbitControls.target),zoom0:d.zoom??1}},e._handleMouseMoveDolly=c=>{if(Ke().zoom?.drag!=="dolly"||!s){i(c);return}const h=this._canvas.getBoundingClientRect().top,d=Math.max(.01,2*((5+c.clientY-h)/s.len0-1)+1),p=this.orbitControls.object;p.isOrthographicCamera?(p.zoom=s.zoom0/d,p.updateProjectionMatrix(),this.orbitControls.dispatchEvent({type:"change"})):p.position.copy(this.orbitControls.target).addScaledVector(s.offset,d),this.orbitControls.update()};const r=e._handleTouchStartRotate.bind(this.orbitControls);e._handleTouchStartRotate=c=>{for(const h of[...this._rotateStartListeners])h();r(c)};const n=e._handleMouseDownRotate.bind(this.orbitControls),a=e._handleMouseMoveRotate.bind(this.orbitControls);let l=null;e._handleMouseDownRotate=c=>{n(c),l=null;for(const p of[...this._rotateStartListeners])p();if(!Ke().turntable)return;const h=this.orbitControls.object,d=new v(0,1,0).applyQuaternion(h.quaternion);l={x:c.clientX,y:c.clientY,reverse:d.y<0?-1:1}},e._handleMouseMoveRotate=c=>{const h=Ke().turntable;if(!h||!l){a(c);return}const d=c.clientX-l.x,p=c.clientY-l.y;l.x=c.clientX,l.y=c.clientY,this._turntableStep(d,p,l.reverse,Be.degToRad(h.degreesPerPixel))}}_rotateStartListeners=new Set([()=>{if(!Ke().autoPerspective||this._projection!=="orthographic")return;const e=this.camera.position.clone().sub(this.orbitControls.target),t=new v(0,1,0).applyQuaternion(this.camera.quaternion);ji(e,t)!==null&&this.setProjection("perspective")}]);_axisViewListeners=[()=>(Ke().autoPerspective&&this.setProjection("orthographic"),!0)];onAxisView(e){return this._axisViewListeners.push(e),()=>{const t=this._axisViewListeners.indexOf(e);t!==-1&&this._axisViewListeners.splice(t,1)}}onRotateStart(e){return this._rotateStartListeners.add(e),()=>this._rotateStartListeners.delete(e)}stepView(e){const t=this.orbitControls.object,i=this.orbitControls.target,s=Be.degToRad(15),r=new v(0,1,0),n=new v(1,0,0).applyQuaternion(t.quaternion),a=new v(0,0,1).applyQuaternion(t.quaternion),l=new v(0,1,0).applyQuaternion(t.quaternion);this._snapAnimating=!1;const c=this.orbitControls;if(c._sphericalDelta.set(0,0,0),c._panOffset.set(0,0,0),this.orbitControls.dispatchEvent({type:"start"}),e==="opposite"&&ji(a,l)!==null){const u=S=>S.y>.5?new v(0,0,-1):S.y<-.5?new v(0,0,1):new v(0,1,0),f=a.clone().round(),m=f.clone().negate(),y=u(f).angleTo(l)*Math.sign(u(f).cross(l).dot(f)||1),_=u(m).applyAxisAngle(m,y),w=new pe().setFromRotationMatrix(new Tt().lookAt(m,new v,_)),x=t.position.distanceTo(i);t.quaternion.copy(w),t.position.copy(i).addScaledVector(m,x),t.up.copy(_),this.orbitControls.update(),this.orbitControls.dispatchEvent({type:"end"});return}const h=new pe;switch(e){case"orbit-left":h.setFromAxisAngle(r,-s);break;case"orbit-right":h.setFromAxisAngle(r,s);break;case"orbit-up":h.setFromAxisAngle(n,-s);break;case"orbit-down":h.setFromAxisAngle(n,s);break;case"opposite":h.setFromAxisAngle(r,Math.PI);break;case"roll-left":h.setFromAxisAngle(a,-s);break;case"roll-right":h.setFromAxisAngle(a,s);break}const d=h.multiply(t.quaternion).normalize(),p=t.position.distanceTo(i);t.quaternion.copy(d),t.position.copy(i).addScaledVector(new v(0,0,1).applyQuaternion(d),p),t.up.set(0,1,0).applyQuaternion(d),this.orbitControls.update(),this.orbitControls.dispatchEvent({type:"end"})}zoomStep(e){const t=Ke().zoom?.step??1.2,i=e>0?1/t:t,s=this.orbitControls.object;if(this.orbitControls.dispatchEvent({type:"start"}),s.isOrthographicCamera)s.zoom/=i,s.updateProjectionMatrix(),this.orbitControls.dispatchEvent({type:"change"});else{const r=this.orbitControls.target;s.position.sub(r).multiplyScalar(i).add(r)}this.orbitControls.update(),this.orbitControls.dispatchEvent({type:"end"})}_turntableStep(e,t,i,s){const r=this.orbitControls.object,n=this.orbitControls.target,a=new v(0,1,0),l=new v(1,0,0).applyQuaternion(r.quaternion),c=new v(0,0,1).applyQuaternion(r.quaternion),h=new v;if(a.distanceToSquared(c)>.001){h.crossVectors(a,c),h.dot(l)<0&&h.negate();const m=(Math.abs(a.angleTo(c)/Math.PI-.5)*2)**2;h.lerp(l,m)}else h.copy(l);h.lengthSq()===0&&h.copy(l),h.normalize();const d=new pe().setFromAxisAngle(h,-s*t),u=new pe().setFromAxisAngle(a,-s*i*e).multiply(d).multiply(r.quaternion).normalize(),f=r.position.distanceTo(n);r.quaternion.copy(u),r.position.copy(n).addScaledVector(new v(0,0,1).applyQuaternion(u),f),r.up.set(0,1,0).applyQuaternion(u),this.orbitControls.update()}get cameraViewMode(){return this._cameraViewMode}setCameraView(e,t){if(this.clearCameraView(),this._cameraView=e,this._cameraViewMode=t,this._orbitEnabledBeforeCameraView=this.orbitControls.enabled,this._orbitTargetBeforeCameraView.copy(this.orbitControls.target),t==="pilot"){const i=e.getWorldPosition(new v),s=e.getWorldDirection(new v),r=Math.max(1,this.freeCamera.position.distanceTo(this.orbitControls.target));this.orbitControls.object=e,this.orbitControls.target.copy(i).add(s.multiplyScalar(r)),this.orbitControls.enabled=!0,this.orbitControls.update()}else this.orbitControls.enabled=!1;this._publishPickContext&&this._installPickContext(e)}clearCameraView(){if(!this._cameraView)return;this._flyActive&&this._exitFlyMode(),this.orbitControls.object=this.freeCamera,this.orbitControls.target.copy(this._orbitTargetBeforeCameraView),this.orbitControls.enabled=this._orbitEnabledBeforeCameraView,this.orbitControls.update(),this._cameraView=null,this._cameraViewMode=null;const e=this._pendingProjection;this._pendingProjection=null,e&&e!==this._projection&&this.setProjection(e),this._publishPickContext&&this._installPickContext(this.freeCamera)}get objectMap(){return this._objectMap}set objectMap(e){this._objectMap=e}attach(e){const t=this._objectForAuthoringId(e);t&&(this._attachedAuthoringId=e,this._attachGizmosTo(t))}detach(){this._attachedAuthoringId=null,this._detachGizmos()}_objectForAuthoringId(e){const t=this._authoring();return t.hierarchy.node(e)===null?null:pd(t,this._objectMap,e)}_authoringIdForObject(e){return this._authoring().hierarchy.idForObject3D?.(e)??yo(e)??null}_hasBoundableGeometry(e){return Mc([e]).length>0}_makeDiagnosticBounds(e){if(this._hasBoundableGeometry(e))return new Fa(e,et(this._canvas).visible);const t=new Se(Fr,Fr,Fr),i=new So(t);t.dispose();const s=new $t({color:new U(et(this._canvas).visible),toneMapped:!1}),r=new Vi(i,s);return e.getWorldPosition(r.position),r.isBoxHelper=!0,r._entityObj=e,r}_syncBoxHelpers(){for(const t of this._boxHelpers.values())this._scene.remove(t),t.geometry.dispose(),t.material.dispose();this._boxHelpers.clear();const e=(t,i)=>{i.layers.set(K),this._scene.add(i),this._boxHelpers.set(t,i)};if(this._store.shell.showHelpers&&this._store.shell.helperVisibility.bounds)for(const t of this._objectMap.keys()){const i=this._objectForAuthoringId(t);i&&e(`bounds:${t}`,this._makeDiagnosticBounds(i))}for(const t of this._store.shell.selectedEntityIds){const i=this._objectForAuthoringId(t);if(!i)continue;const s=this._hasBoundableGeometry(i);if(s&&this._selectionMarks.wire){let r=0;i.traverse(n=>{const a=n;if(!a.isMesh||!a.geometry||at(a))return;const l=ma(this._canvas),c=new Vi(new iu(a.geometry),new $t({color:l.color??et(this._canvas).visible,transparent:!0,opacity:l.opacity??.5,depthTest:!0}));c.matrixAutoUpdate=!1,c._wireOf=a,e(`wire:${t}:${r++}`,c)})}if(!(s&&!this._selectionMarks.box)){if(s){const r=fa(this._canvas);e(`selection:${t}`,new Un(i,{color:et(this._canvas).visible,edges:r.edges,frame:r.frame,...r.lineWidth===null?{}:{lineWidth:r.lineWidth}}));continue}this._standaloneAuthoring&&i.isBone||[...this._constraintHelpers.values()].some(r=>r.presents(i))||i.userData.volterOwnOverlay||e(`selection:${t}`,new Un(i,{fixedSize:Fr,color:et(this._canvas).visible}))}}}_syncReflectionProbeHelpers(e=null){if(e===null){const t=new Map,i=new Set;for(const[s,r]of this._objectMap)!r||i.has(r)||!ys(r)||(i.add(r),t.set(s,r));for(const[s,r]of this._reflectionProbeHelpers)t.get(s)!==r.source&&(r.dispose(),this._reflectionProbeHelpers.delete(s));for(const[s,r]of t)this._ensureReflectionProbeHelper(s,r)}else{let t=!1;for(const i of e){const s=this._objectMap.get(i),r=s&&ys(s)?s:null,n=this._reflectionProbeHelpers.get(i);n&&n.source!==r&&(r===null&&(t=!0),n.dispose(),this._reflectionProbeHelpers.delete(i)),r&&![...this._reflectionProbeHelpers.values()].some(a=>a.source===r)&&this._ensureReflectionProbeHelper(i,r)}if(t){this._syncReflectionProbeHelpers();return}}for(const[t,i]of this._reflectionProbeHelpers)i.setSelected(this._store.shell.selectedEntityIds.has(t)),i.visible=this._threejsToolContextActive&&this._store.shell.showHelpers&&this._store.shell.helperVisibility.reflectionProbes,i.update()}_ensureReflectionProbeHelper(e,t){if(this._reflectionProbeHelpers.has(e))return;const i=new rf(t);this._reflectionProbeHelpers.set(e,i),this._scene.add(i)}_syncTriggerVolumeHelpers(e=null){if(e===null){const i=new Map,s=new Set;for(const[r,n]of this._objectMap)!n||s.has(n)||!oo(n)||(s.add(n),i.set(r,n));for(const[r,n]of this._triggerVolumeHelpers)i.get(r)!==n.source&&this._disposeTriggerVolumeHelper(r,n);for(const[r,n]of i)this._ensureTriggerVolumeHelper(r,n)}else{let i=!1;for(const s of e){const r=this._objectMap.get(s),n=r&&oo(r)?r:null,a=this._triggerVolumeHelpers.get(s);a&&a.source!==n&&(n===null&&(i=!0),this._disposeTriggerVolumeHelper(s,a)),n&&![...this._triggerVolumeHelpers.values()].some(l=>l.source===n)&&this._ensureTriggerVolumeHelper(s,n)}if(i){this._syncTriggerVolumeHelpers();return}}const t=this._threeSurfaceShowing&&this._store.shell.showHelpers&&this._store.shell.helperVisibility.triggerVolumes;for(const[i,s]of this._triggerVolumeHelpers)s.setSelected(this._store.shell.selectedEntityIds.has(i)),s.visible=t,s.update()}_ensureTriggerVolumeHelper(e,t){if(this._triggerVolumeHelpers.has(e))return;const i=new Jf(t);this._triggerVolumeHelpers.set(e,i),this._scene.add(i)}_disposeTriggerVolumeHelper(e,t){t.dispose(),this._triggerVolumeHelpers.delete(e)}_syncConstraintHelpers(e=null){if(e===null){const i=new Map,s=new Set;for(const[r,n]of this._objectMap)!n||s.has(n)||Wr(n).length===0||(s.add(n),i.set(r,n));for(const[r,n]of this._constraintHelpers)i.get(r)!==n.source&&(this._disposeConstraintHelper(n),this._constraintHelpers.delete(r));for(const[r,n]of i)this._ensureConstraintHelper(r,n)}else{let i=!1;for(const s of e){const r=this._objectMap.get(s),n=r&&Wr(r).length>0?r:null,a=this._constraintHelpers.get(s);a&&a.source!==n&&(n===null&&(i=!0),this._disposeConstraintHelper(a),this._constraintHelpers.delete(s)),n&&![...this._constraintHelpers.values()].some(l=>l.source===n)&&this._ensureConstraintHelper(s,n)}if(i){this._syncConstraintHelpers();return}}const t=new Set;for(const i of this._store.shell.selectedEntityIds){const s=this._objectForAuthoringId(i);s&&t.add(s)}for(const[i,s]of this._constraintHelpers)s.setSelected(this._store.shell.selectedEntityIds.has(i)),s.setSelectedObjects(t),s.visible=this._threejsToolContextActive&&this._store.shell.showHelpers&&this._store.shell.helperVisibility.constraints,s.update(this.camera)}_ensureConstraintHelper(e,t){if(this._constraintHelpers.has(e))return;const i=new $p(t);this._constraintHelpers.set(e,i),this._scene.add(i)}_disposeConstraintHelper(e){this._hoveredConstraintControl?.helper===e&&(this._hoveredConstraintControl=null),e.dispose()}_raycastConstraintControl(e){const t=[];for(const n of this._constraintHelpers.values())n.visible&&t.push(...n.controlMeshes());if(t.length===0)return null;const i=this._canvas.getBoundingClientRect(),s=new Oe((e.clientX-i.left)/i.width*2-1,-((e.clientY-i.top)/i.height)*2+1);this._constraintControlRaycaster.setFromCamera(s,this._screenCamera);const r=this._constraintControlRaycaster.intersectObjects(t,!1)[0]?.object;if(!r)return null;for(const n of this._constraintHelpers.values()){const a=n.controlFor(r);if(a)return{helper:n,control:a}}return null}_updateConstraintControlHover(e){if(e.buttons&1)return this._constraintControlPointerSession;const t=this._hoverConstraintControlAt(e);return t?(this._hoveredSpatialHandle&&(Dn(this._hoveredSpatialHandle,!1),this._hoveredSpatialHandle=null),this._canvas.style.cursor=t,!0):(this._canvas.style.cursor="",!1)}_hoverConstraintControlAt(e){const t=this._raycastConstraintControl(e),i=this._hoveredConstraintControl;return t?(i?.mesh!==t.control.mesh&&(i&&i.helper.setHoveredControl(null),t.helper.setHoveredControl(t.control.mesh),this._hoveredConstraintControl={helper:t.helper,mesh:t.control.mesh}),this._authoringIdForObject(t.control.object)?"pointer":"not-allowed"):(this._clearConstraintControlHover(),null)}_clearConstraintControlHover(){this._hoveredConstraintControl?.helper.setHoveredControl(null),this._hoveredConstraintControl=null}_selectConstraintControlAt(e,t=!0){const i=this._raycastConstraintControl(e);if(!i)return!1;this._constraintControlPointerSession=t;const s=this._authoringIdForObject(i.control.object);if(s){const r=this._authoring();fs(r,[s],{intent:"exact"})||this._store.shell.select(s),st(`${i.control.label} selected — move it with the gizmo.`)}else st(`${i.control.label} is a runtime-only constraint control.`);return!0}_syncCameraHelpers(e=null){if(e===null){const i=new Map;for(const[s,r]of this._objectMap){const n=this._nativeCamera(r);n&&i.set(s,n)}for(const[s,r]of this._cameraHelpers)i.get(s)!==r.source&&this._disposeCameraHelper(s,r);for(const[s,r]of i)this._ensureCameraHelper(s,r)}else{let i=!1;for(const s of e){const r=this._objectMap.get(s),n=r?this._nativeCamera(r):null,a=this._cameraHelpers.get(s);a&&a.source!==n&&(n===null&&(i=!0),this._disposeCameraHelper(s,a)),n&&![...this._cameraHelpers.values()].some(l=>l.source===n)&&this._ensureCameraHelper(s,n)}if(i){this._syncCameraHelpers();return}}const t=this._threeSurfaceShowing&&this._store.shell.showHelpers&&this._store.shell.helperVisibility.cameras;for(const i of this._cameraHelpers.values())i.helper.visible=t,i.helper.update()}_syncLightHelpers(e=null){if(e===null){const i=new Map;for(const[s,r]of this._objectMap){const n=this._nativeLight(r);n&&i.set(s,n)}for(const[s,r]of this._lightHelpers)i.get(s)!==r.source&&this._disposeLightHelper(s,r);for(const[s,r]of i)this._ensureLightHelper(s,r)}else{let i=!1;for(const s of e){const r=this._objectMap.get(s),n=r?this._nativeLight(r):null,a=this._lightHelpers.get(s);a&&a.source!==n&&(n===null&&(i=!0),this._disposeLightHelper(s,a)),n&&![...this._lightHelpers.values()].some(l=>l.source===n)&&this._ensureLightHelper(s,n)}if(i){this._syncLightHelpers();return}}const t=this._threeSurfaceShowing&&this._store.shell.showHelpers&&this._store.shell.helperVisibility.lights;for(const i of this._lightHelpers.values())i.helper.visible=t,i.helper.update?.()}_nativeLight(e){return e.userData.volterOwnOverlay?null:e.isLight?e:null}_disposeLightHelper(e,t){t.helper.removeFromParent(),t.helper.dispose?.(),this._lightHelpers.delete(e)}_ensureLightHelper(e,t){if(this._lightHelpers.has(e))return;const i=.5;let s=null;const r=t;try{r.isDirectionalLight?s=new su(t,i):r.isPointLight?s=new ru(t,i):r.isSpotLight?s=new nu(t):r.isHemisphereLight&&(s=new ou(t,i))}catch{s=null}s&&(s.name=`Light helper: ${t.name||e}`,s.userData.editorOnly=!0,s.traverse(n=>n.layers.set(K)),s.layers.set(K),this._lightHelpers.set(e,{source:t,helper:s}),this._scene.add(s))}_syncAudioHelpers(e=null){if(e===null){const i=new Map;for(const[s,r]of this._objectMap){const n=this._nativeAudio(r);n&&i.set(s,n)}for(const[s,r]of this._audioHelpers)i.get(s)!==r.source&&this._disposeAudioHelper(s,r);for(const[s,r]of i)this._ensureAudioHelper(s,r)}else for(const i of e){const s=this._objectMap.get(i),r=s?this._nativeAudio(s):null,n=this._audioHelpers.get(i);n&&n.source!==r&&this._disposeAudioHelper(i,n),r&&![...this._audioHelpers.values()].some(a=>a.source===r)&&this._ensureAudioHelper(i,r)}const t=this._threeSurfaceShowing&&this._store.shell.showHelpers&&this._store.shell.helperVisibility.audio;for(const i of this._audioHelpers.values())i.helper.visible=t}_nativeAudio(e){const t=e.type;return t==="Audio"||t==="PositionalAudio"||t==="AudioListener"?e:null}_ensureAudioHelper(e,t){if(this._audioHelpers.has(e))return;const i=new je,s=t.type==="AudioListener"?8377599:16763274,r=new O(new ui(.16),new Le({color:s,wireframe:!0,depthTest:!1}));i.add(r),i.name=`Audio helper: ${t.name||e}`,i.userData.editorOnly=!0,i.traverse(n=>n.layers.set(K)),i.layers.set(K),t.add(i),this._audioHelpers.set(e,{source:t,helper:i})}_disposeAudioHelper(e,t){t.helper.traverse(i=>{const s=i;s.geometry?.dispose?.(),s.material?.dispose?.()}),t.helper.removeFromParent(),this._audioHelpers.delete(e)}_disposeCameraHelper(e,t){t.helper.removeFromParent(),t.helper.dispose(),this._cameraHelpers.delete(e)}_ensureCameraHelper(e,t){if(this._cameraHelpers.has(e))return;let i;try{i=new au(t)}catch(s){this._refuseCameraOverlay(e,t,s);return}i.name=`Camera frustum: ${t.name||e}`,i.userData.editorOnly=!0,i.layers.set(K),this._cameraHelpers.set(e,{source:t,helper:i}),this._scene.add(i)}_refusedCameraOverlays=new Set;_refuseCameraOverlay(e,t,i){this._refusedCameraOverlays.has(e)||(this._refusedCameraOverlays.add(e),Fi.warn(`Helpers → Cameras draws no frustum for "${t.name||t.type}": ${i instanceof Error?i.message:String(i)}. This world's camera was constructed by the GAME's own copy of three, and \`THREE.CameraHelper\` is the editor's class reading fields off it that that revision does not define. Every other camera capability (framing, selection, inspection) is unaffected. It closes when the game resolves \`three\` to the host's instance — a bare, un-rewritten \`import 'three'\` in its own source.`,"authoring"))}_nativeCamera(e){if(e.userData.volterOwnOverlay)return null;if(e.isCamera)return e;const t=Ee(e,"_camera");return t?.isCamera?t:null}_syncSpatialHandles(){fl(this._spatialHandleRoots),this._spatialHandleRoots=[],this._spatialHandleMeshes=[],this._hoveredSpatialHandle=null;const e=xn(this._authoring());if(!e||!this._threejsToolContextActive||!this._store.shell.showHelpers)return;const t=this._store.shell.helperVisibility;for(const i of this._store.shell.selectedEntityIds){const s=e.layers(i).filter(n=>n.category in t?t[n.category]:!0),r=Sf(i,s);for(const n of r.handles)pl(n,this._screenCamera);for(const n of r.roots)this._scene.add(n);this._spatialHandleRoots.push(...r.roots),this._spatialHandleMeshes.push(...r.handles)}}_raycastSpatialHandle(e){if(this._spatialHandleMeshes.length===0)return null;const t=this._canvas.getBoundingClientRect(),i=new Oe((e.clientX-t.left)/t.width*2-1,-((e.clientY-t.top)/t.height)*2+1);return this._spatialHandleRaycaster.setFromCamera(i,this._screenCamera),this._spatialHandleRaycaster.intersectObjects(this._spatialHandleMeshes,!1)[0]?.object??null}_spatialHandleWorldPoint(e){const t=this._canvas.getBoundingClientRect(),i=new Oe((e.clientX-t.left)/t.width*2-1,-((e.clientY-t.top)/t.height)*2+1);this._spatialHandleRaycaster.setFromCamera(i,this._screenCamera);const s=new v;return this._spatialHandleRaycaster.ray.intersectPlane(this._spatialHandleDragPlane,s)?s.add(this._spatialHandleDragOffset):null}_finishSpatialHandleDrag(e){const t=this._activeSpatialHandle;this._activeSpatialHandle=null,this.orbitControls.enabled=this._orbitEnabledBeforeHandleDrag,this.transformControls.enabled=this._transformEnabledBeforeHandleDrag,this.syncFromStore(),this._canvas.style.cursor="",e&&t&&xn(this._authoring())?.commit(t.nodeId,t.handle.id,[this._spatialHandleDragPoint.x,this._spatialHandleDragPoint.y,this._spatialHandleDragPoint.z])}_updateSpatialHandleDrag(e){const t=this._activeSpatialHandle;if(!t)return!1;const i=this._spatialHandleWorldPoint(e);return i&&(this._spatialHandleDragPoint.copy(i),xn(this._authoring())?.preview(t.nodeId,t.handle.id,[i.x,i.y,i.z]),this._syncSpatialHandles(),this._canvas.style.cursor="grabbing"),!0}_updateSpatialHandleHover(e){if(e.buttons&1||this._spatialHandleMeshes.length===0)return;const t=this._raycastSpatialHandle(e);if(t===this._hoveredSpatialHandle)return;if(this._hoveredSpatialHandle&&Dn(this._hoveredSpatialHandle,!1),this._hoveredSpatialHandle=t,!t){this._canvas.style.cursor="";return}Dn(t,!0);const i=ul(t);this._canvas.style.cursor=i?.handle.writable?"grab":"not-allowed"}_updateEditorHandleInteraction(e){return this._updateSpatialHandleDrag(e)||this._updateConstraintControlHover(e)}_previewInfrastructure(){return[this.grid,...this._axisLines?[this._axisLines]:[],this._gizmoHelper,this._auxRotateControls.getHelper(),this._auxScaleControls.getHelper(),...this._boxHelpers.values(),...this._constraintHelpers.values(),...this._reflectionProbeHelpers.values(),...this._triggerVolumeHelpers.values(),...[...this._cameraHelpers.values()].map(({helper:e})=>e),...this._spatialHandleRoots]}_suspendPreviewInfrastructure(){const e=this._previewInfrastructure().map(t=>[t,t.visible]);for(const[t]of e)t.visible=!1;return()=>{for(const[t,i]of e)t.visible=i}}_allGizmos(){return[this.transformControls,this._auxRotateControls,this._auxScaleControls]}_anyGizmoDragging(){return this._allGizmos().some(e=>e.dragging)}_attachGizmosTo(e){this.transformControls.attach(e),this._auxRotateControls.attach(e),this._auxScaleControls.attach(e)}_detachGizmos(){for(const e of this._allGizmos())e.detach()}syncFromStore(){this._gizmoHelper.traverse(b=>b.layers.set(K));const e=this._store.shell.transformMode,i=e==="combined"||e==="select"?"translate":e;this.transformControls.mode!==i&&this.transformControls.setMode(i),this._applySnapToGizmos();for(const b of this._allGizmos())b.setSpace(this._store.shell.transformSpace);const s=Pr(),r=this._authoring(),n=s.toolOwner(r,this._store.shell.selectedEntityIds);this._threejsToolContextActive=(this._standaloneAuthoring||s.toolOwnerPainted(this._store.shell,n))&&n?.kind==="three";const a=this._standaloneAuthoring||s.threeSurfaceShowing(this._store.shell,r);this._threeSurfaceShowing=a,this.grid.visible=this._presentationGrid&&a,this._axisLines&&(this._axisLines.visible=this.grid.visible&&this._axesWanted);const l=this._store.shell.helperVisibility,c=this._standaloneAuthoring?null:s.threeViewportRootId(this._store.shell),h=c!==null&&ch(c);h&&s.applyRootHiddenVisibility(this._objectMap,c),h&&s.suppressRootEnvironment(this._scene);const d=this._store.gizmoEpoch,p=`${this._store.shell.showHelpers}|${this._store.shell.showGizmos}|${JSON.stringify(l)}|${c??""}|${h}|${this._threejsToolContextActive}`,u=this._objectMap!==this._lastGizmoObjectMap,f=p!==this._lastGizmoSig,m=u?null:this._store.ingestObjectMapMembershipChangesSince(this._lastGizmoEpoch),y=u||f||m===null?null:m.changedIds,_=y===null||y.size>0;if(this._lastGizmoObjectMap=this._objectMap,this._lastGizmoSig=p,this._lastGizmoEpoch=d,_){s.applyRootHiddenVisibility(this._objectMap,c);const b=y===null?Zf(this._objectMap):Qf(this._objectMap,y);for(const M of b)M.traverse(z=>{if(Ee(z,"editorIcon")){z.visible=this._store.shell.showHelpers;return}if(!Ee(z,"editorHelper"))return;const F=Ee(z,"editorHelperType");if(F==="skeletons"){z.visible=this._store.shell.showHelpers&&(l.skeletons||!!Ee(z,"skeletonEnabled"));return}F&&F in l?z.visible=this._store.shell.showHelpers&&l[F]:z.visible=this._store.shell.showHelpers});for(const[M,z]of this._helpers)z.visible=this._store.shell.showHelpers&&(!(M in l)||l[M]);this._syncCameraHelpers(y),this._syncLightHelpers(y)}this._syncAudioHelpers(y),this._syncReflectionProbeHelpers(y),this._syncTriggerVolumeHelpers(y),this._syncConstraintHelpers(y);const w=this._threejsToolContextActive&&r.capabilities.transform&&e!=="select"?this._store.shell.selectedEntityId:null,x=e==="translate"||e==="combined"?"position":e==="rotate"?"rotation":"scale",C=w?e==="combined"?(b=>["position","rotation","scale"].some(M=>r.transforms?.editability?.(b,M).writable??!0))(w):r.transforms?.editability?.(w,x).writable??!0:!1;if(w&&C&&this._store.shell.showGizmos){if(!this._anyGizmoDragging())if(this._store.shell.pivotMode==="median-point"&&this._store.shell.selectedEntityIds.size>1){const b=new v;let M=0;for(const z of this._store.shell.selectedEntityIds){if(!(r.transforms?.editability?.(z,x).writable??!0))continue;const F=this._objectForAuthoringId(z);F&&(b.add(F.getWorldPosition(tm)),M++)}M>0&&b.divideScalar(M),this._pivotDummy.position.copy(b),this._pivotDummy.quaternion.identity(),this._pivotDummy.scale.set(1,1,1),this._attachedAuthoringId=null,this._dummyIsPresentationAnchor=!1,this._attachGizmosTo(this._pivotDummy)}else{const b=this._objectForAuthoringId(w),M=Ee(b,"pivot"),z=M&&(M[0]!==0||M[1]!==0||M[2]!==0),F=z?null:this._centreAnchorFor(b);if(F&&b)this._pivotDummy.position.copy(F),this._pivotDummy.quaternion.copy(b.getWorldQuaternion(Gn)),this._pivotDummy.scale.copy(b.getWorldScale(wl)),this._attachedAuthoringId=w,this._dummyIsPresentationAnchor=!0,this._attachGizmosTo(this._pivotDummy);else if(z&&b){const R=new v(M[0],M[1],M[2]);R.applyQuaternion(b.getWorldQuaternion(Gn)),this._pivotDummy.position.copy(b.getWorldPosition(vl)).add(R),this._pivotDummy.quaternion.copy(Gn),this._pivotDummy.scale.copy(b.getWorldScale(wl)),this._attachedAuthoringId=w,this._dummyIsPresentationAnchor=!1,this._attachGizmosTo(this._pivotDummy)}else this._dummyIsPresentationAnchor=!1,this.attach(w)}}else this.detach();this._syncBoxHelpers(),this._syncSpatialHandles(),this._syncCombinedGizmoHalves()}_applySnapToGizmos(){const e=this._store.shell.snapEnabled||this._snapHold,t=this._store.shell.snapValues;for(const i of this._allGizmos())i.setTranslationSnap(e?t.translate:null),i.setRotationSnap(e?Be.degToRad(t.rotate):null),i.setScaleSnap(e?t.scale:null)}_modifiedZoom=!1;_onAltOrbitStart=e=>{e.button===1&&(e.ctrlKey||e.metaKey)&&Ke().orbit==="middle"&&(this._modifiedZoom=!0,this.orbitControls.mouseButtons.MIDDLE=Ie.DOLLY),e.altKey&&e.button===0&&(this._altDragOrbit=!0,this.orbitControls.mouseButtons.LEFT=Ie.ROTATE)};_onAltOrbitRelease=e=>{this._modifiedZoom&&(!e||e.type==="pointercancel"||e.button===1)&&(this._modifiedZoom=!1,this.applyKeymapNavigation()),this._altDragOrbit&&(this._altDragOrbit=!1,this.orbitControls.mouseButtons.LEFT=-1)};_onSnapHoldKey=e=>{const t=e.ctrlKey||e.metaKey;if(t!==this._snapHold&&(this._snapHold=t,this._applySnapToGizmos(),t&&this._anyGizmoDragging()&&!this._store.shell.snapEnabled)){const{translate:i,rotate:s,scale:r}=this._store.shell.snapValues;st(`Snapping while held: ${i} units · ${s}° · ×${r}`)}};_syncCombinedGizmoHalves(){if(this._anyGizmoDragging())return;const e=this._store.shell.transformMode==="combined",t=this._attachedAuthoringId,i=this._authoring().transforms?.editability,s=c=>t===null||(i?.(t,c).writable??!0),r=e&&this._auxRotateControls.object!==void 0&&s("rotation"),n=e&&this._transformHandles.scale&&this._auxScaleControls.object!==void 0&&s("scale");this._auxRotateControls.enabled=r,this._auxScaleControls.enabled=n;const a=this._auxRotateControls.getHelper(),l=this._auxScaleControls.getHelper();a.visible=r,l.visible=n;for(const c of[a,l])c.traverse(h=>h.layers.set(K));this.transformControls.enabled=!0}moveGizmosTo(e){const t=this._gizmoObjects();for(const i of t)e.add(i)}restoreGizmos(){const e=this._gizmoObjects();for(const t of e)this._scene.add(t)}_gizmoObjects(){return[this.grid,...this._axisLines?[this._axisLines]:[],this._editorAmbient,this._editorDirLight,this.batchedRenderer,this._gizmoHelper,this._auxRotateControls.getHelper(),this._auxScaleControls.getHelper(),this._pivotDummy,this._surfaceSnapIndicator,...[...this._cameraHelpers.values()].map(({helper:e})=>e),...this._spatialHandleRoots]}_contentBounds(e=!1){const t=performance.now(),i=this._contentBoundsAt===0||t-this._contentBoundsAt>$f;if(e||i){this._contentBoundsBox.makeEmpty();for(const s of this._scene.children)at(s)||fd(this._contentBoundsBox,s);this._contentBoundsAt=t}return this._contentBoundsBox}_measureContentBounds(){const e=[];for(const t of this._scene.children)at(t)||md(t,e);this._contentBoundsBox.makeEmpty();for(const t of e)this._contentBoundsBox.union(t);return this._contentBoundsAt=performance.now(),e}_updateClipPlanes(){const e=this._contentBounds();let t=0,i=0;e.isEmpty()||(e.getBoundingSphere(jn),t=this.freeCamera.position.distanceTo(jn.center),i=jn.radius);const{near:s,far:r}=Ru(t,i);s===this.camera.near&&r===this.camera.far||(this.camera.near=s,this.camera.far=r,this.camera.updateProjectionMatrix(),this.orthographicCamera.near=s,this.orthographicCamera.far=r,this.orthographicCamera.updateProjectionMatrix())}seedFromGameCamera(e){const t=cl(this._measureContentBounds()),i=hf(e,t);if(!i)return!1;const s=this.camera.position.clone(),r=this.orbitControls.target.clone();this.camera.position.copy(i.position),this.orbitControls.target.copy(i.target),this.camera.lookAt(this.orbitControls.target),this.camera.updateMatrixWorld(!0);const n=this._scene.children.filter(a=>!at(a));return ff(this.camera,n,i.position.distanceTo(i.target))?(this._updateClipPlanes(),this.orbitControls.update(),!0):(this.camera.position.copy(s),this.orbitControls.target.copy(r),this.camera.lookAt(this.orbitControls.target),this.camera.updateMatrixWorld(!0),!1)}focusOnScene(){const e=cl(this._measureContentBounds());if(e.isEmpty())return!1;const t=e.getCenter(new v),i=this.camera.position.clone().sub(this.orbitControls.target).normalize(),s=yi(e,this.camera,i);return Number.isFinite(s)?(this.camera.position.copy(t).add(i.multiplyScalar(s)),this.orbitControls.target.copy(t),this._orthographicHeight=Math.max(e.getSize(new v).y,e.getSize(new v).x/this._viewportAspect)*1.15,this._syncOrthographicFromPerspective(!0),this._updateClipPlanes(),!0):!1}focusOn(e){const t=this._contentOrProbeBounds(e),i=t.getCenter(new v),s=this.camera.position.clone().sub(this.orbitControls.target).normalize(),r=yi(t,this.camera,s);this.camera.position.copy(i).add(s.multiplyScalar(r)),this.orbitControls.target.copy(i);const n=t.getSize(new v);this._orthographicHeight=Math.max(n.y,n.x/this._viewportAspect,.01)*1.15,this._syncOrthographicFromPerspective(!0)}activateVertexSnap(){this._vertexSnapTargets=this._collectVertices(this._store.shell.selectedEntityIds)}deactivateVertexSnap(){this._vertexSnapTargets=[],this._vertexSnapIndicator.visible=!1}focusOnMultiple(e){if(e.length===0)return;if(e.length===1){this.focusOn(e[0]);return}const t=new St;for(const a of e)t.union(this._contentOrProbeBounds(a));const i=t.getCenter(new v),s=this.camera.position.clone().sub(this.orbitControls.target).normalize(),r=yi(t,this.camera,s);this.camera.position.copy(i).add(s.multiplyScalar(r)),this.orbitControls.target.copy(i);const n=t.getSize(new v);this._orthographicHeight=Math.max(n.y,n.x/this._viewportAspect,.01)*1.15,this._syncOrthographicFromPerspective(!0)}_centreAnchorFor(e){const t=this._store.shell.gizmoAnchor;if(!e||t==="pivot"||t==="auto"&&gd(e)===0)return null;const i=mi(e);if(i.isEmpty()||t==="auto"&&!yd(e,i)?.worldAnchored)return null;const s=i.getCenter(new v);return e.updateWorldMatrix(!0,!1),s.distanceToSquared(e.getWorldPosition(vl))<im?null:s}_contentOrProbeBounds(e){const t=ys(e);if(!t)return mi(e);const i=t.config,[s,r,n]=i.size,a=i.shape==="sphere"?new v(1,1,1).multiplyScalar(Math.max(.01,i.radius)):new v(Math.max(.01,s),Math.max(.01,r),Math.max(.01,n)).multiplyScalar(.5);return e.updateWorldMatrix(!0,!1),new St(a.clone().negate(),a).applyMatrix4(e.matrixWorld)}setHelper(e,t){$();const i=this._helpers.get(e);if(i&&(this._scene.remove(i),this._helpers.delete(e)),!t)return;Ze(t,"editorHelper",!0),Ze(t,"editorHelperType",e);const s=this._store.shell.helperVisibility;t.visible=this._store.shell.showHelpers&&(!(e in s)||s[e]),this._scene.add(t),this._helpers.set(e,t)}visibleHelpers(){return[...this._helpers.values()].filter(e=>e.visible&&e.parent!==null)}setViewPreset(e){this._projection==="orthographic"&&this.setProjection("perspective");const t=this.orbitControls.target.clone(),i=this.camera.position.distanceTo(t),s=new v;switch(e){case"top":s.set(0,1,0);break;case"front":s.set(0,0,1);break;case"right":s.set(1,0,0);break;case"bottom":s.set(0,-1,0);break;case"back":s.set(0,0,-1);break;case"left":s.set(-1,0,0);break;case"perspective":s.set(1,1,1).normalize();break}this.camera.position.copy(t).add(s.multiplyScalar(i)),e==="top"?this.camera.up.set(0,0,-1):e==="bottom"?this.camera.up.set(0,0,1):this.camera.up.set(0,1,0),this.camera.lookAt(t),e!=="perspective"&&this.setProjection("orthographic"),this.orbitControls.update()}setFieldOfView(e){if(!Number.isFinite(e.degrees)||e.degrees<=0||e.degrees>=180||e.degrees===this._fieldOfView.degrees&&e.axis===this._fieldOfView.axis)return;const t=s=>Math.tan(Be.degToRad(s*.5)),i=t(this.camera.fov);this._canvas.clientWidth>0&&this._canvas.clientHeight>0&&(this._viewportAspect=this._canvas.clientWidth/this._canvas.clientHeight,this.camera.aspect=this._viewportAspect),this._fieldOfView=e,this.camera.fov=Xn(this._viewportAspect,e),this.camera.updateProjectionMatrix(),this._projection==="orthographic"&&(this._orthographicHeight*=t(this.camera.fov)/i),this._applyOrthographicFrustum()}setPose(e,t,i,s){this.setProjection("perspective"),s?this.camera.up.set(s.x,s.y,s.z):this.camera.up.set(0,1,0),this.camera.position.set(e.x,e.y,e.z),this.orbitControls.target.set(t.x,t.y,t.z),this.camera.lookAt(this.orbitControls.target),i!==void 0&&this.setFieldOfView({degrees:i,axis:"vertical"}),this.orbitControls.update()}resize(e,t){this._viewportAspect=Math.max(1,e)/Math.max(1,t),this.camera.aspect=this._viewportAspect,this.camera.fov=Xn(this._viewportAspect,this._fieldOfView),this.camera.updateProjectionMatrix(),this._applyOrthographicFrustum(),this._applyGizmoSize()}resolvePresentation(){this._presentation?.rig.resolveSource({light:this._store.isAdoptedSceneActive})}update(e=0){this._ensureSparkRenderer(),this._syncLookBackground();const t=this.transformControls.object;if(t&&t!==this._pivotDummy&&!t.parent&&(this._detachGizmos(),this.syncFromStore()),this._updateFlyCamera(e),this.orbitControls.update(),this._snapAnimating){const i=performance.now()-this._snapStartTime;let s=Math.min(i/this._snapDuration,1);s=s<.5?4*s*s*s:1-(-2*s+2)**3/2;const r=new pe().slerpQuaternions(this._snapQ1,this._snapQ2,s),n=new v(0,0,1).applyQuaternion(r);this.freeCamera.position.copy(this.orbitControls.target).add(n.multiplyScalar(this._snapDist)),this.freeCamera.quaternion.copy(r),this.freeCamera.up.set(0,1,0).applyQuaternion(r),s>=1&&(this._snapAnimating=!1)}this._presentation&&(this.resolvePresentation(),this._presentation.rig.update(this.camera));for(const i of this._boxHelpers.values()){const s=i._wireOf;if(s){i.matrix.copy(s.matrixWorld),i.matrixWorldNeedsUpdate=!0;continue}if(i instanceof Un){i.updateIfNeeded();continue}const r=i;r._entityObj?r._entityObj.getWorldPosition(i.position):i instanceof Fa&&i.update()}for(const i of this._constraintHelpers.values())i.update(this.camera);for(const i of this._reflectionProbeHelpers.values())i.update();for(const i of this._triggerVolumeHelpers.values())i.update();for(const{helper:i}of this._cameraHelpers.values())i.update();for(const i of this._spatialHandleMeshes)pl(i,this._screenCamera);this._enforceLodForcedLevels(),this.alignGridToView(this.renderCamera,this._renderer?.domElement.width??1),this._updateClipPlanes()}_enforceLodForcedLevels(){const e=new Set(this._objectMap.values());for(const[t,i]of this._store.lodForcedLevels){const s=this._objectMap.get(t),r=s?_d(s,a=>e.has(a)):null;if(!r||r.levels.length===0)continue;r.autoUpdate=!1;const n=Math.min(Math.max(i,0),r.levels.length-1);for(let a=0;a<r.levels.length;a++)r.levels[a].object.visible=a===n}}renderWithInfrastructure(e){const t=this._sparkRenderer,i=this._cameraView?this._suspendPreviewInfrastructure():null;t&&this._scene.add(t);try{e()}finally{t?.removeFromParent(),i?.()}}renderViewCube(e){if(!this._threeSurfaceShowing||this._navigation==="hidden"||!this._store.shell.showGizmos||this._cameraView)return;const t=e.domElement.clientWidth,i=e.domElement.clientHeight,s=this._vcSize,r=this._vcDir.subVectors(this.freeCamera.position,this.orbitControls.target).normalize();this._vcCamera.position.copy(r.multiplyScalar(4)),this._vcCamera.up.copy(this.freeCamera.up),this._vcCamera.lookAt(0,0,0),this._syncOrientationGizmoDepth();const n=this._vcOrigin(t,i,this._chromeInsetPx),a=n.left,l=i-s-n.top,c=e.autoClear;try{e.setScissorTest(!0),e.setViewport(a,l,s,s),e.setScissor(a,l,s,s),e.clear(!1,!0,!1),e.autoClear=!1,e.render(this._vcScene,this._vcCamera)}finally{e.autoClear=c,e.setScissorTest(!1),e.setViewport(0,0,t,i)}}renderCameraPreview(e,t,i){if(!t||!i||this._cameraView)return;const s=e.domElement.clientWidth,r=e.domElement.clientHeight,n=e.domElement.getBoundingClientRect(),a=i.getBoundingClientRect(),l=Math.round(a.left-n.left),c=Math.round(n.bottom-a.bottom),h=Math.max(1,Math.round(a.width)),d=Math.max(1,Math.round(a.height));if(l>=s||c>=r||l+h<=0||c+d<=0)return;const p=this._suspendPreviewInfrastructure(),u=e.getClearColor(this._previewClearColor),f=e.getClearAlpha();try{e.setScissorTest(!0),e.setViewport(l,c,h,d),e.setScissor(l,c,h,d),e.setClearColor(1118740,1),e.clear(),e.render(this._scene,t)}finally{e.setScissorTest(!1),e.setViewport(0,0,s,r),e.setClearColor(u,f),p()}}get isFlying(){return this._flyActive}_inputDisconnected=!1;disconnectInput(){if(!this._inputDisconnected){this._inputDisconnected=!0,this._publishPickContext&&ol(null),window.removeEventListener("keydown",this._onFlyKeyDown),window.removeEventListener("keyup",this._onFlyKeyUp),this._interactionElement.removeEventListener("pointerdown",this._onFlyPointerDown),this._canvas.removeEventListener("pointerdown",this._onAltOrbitStart,{capture:!0}),window.removeEventListener("pointerup",this._onAltOrbitRelease,{capture:!0}),window.removeEventListener("pointercancel",this._onAltOrbitRelease,{capture:!0}),window.removeEventListener("keydown",this._onSnapHoldKey),window.removeEventListener("keyup",this._onSnapHoldKey),this._interactionElement.removeEventListener("pointerup",this._onFlyPointerUp),this._interactionElement.removeEventListener("pointermove",this._onFlyPointerMove),this._interactionElement.removeEventListener("wheel",this._onFlyWheel),this._interactionElement.removeEventListener("wheel",this._onTrackpadWheel),this._canvas.removeEventListener("pointerdown",this._onPointerDown),this._interactionElement.removeEventListener("pointermove",this._onPointerMove),this._onInteractionPointerUp&&this._interactionElement.removeEventListener("pointerup",this._onInteractionPointerUp),this._onInteractionDblClick&&this._interactionElement.removeEventListener("dblclick",this._onInteractionDblClick),this._canvas.removeEventListener("dragover",this._onDragOver),this._canvas.removeEventListener("dragleave",this._onDragLeave),this._canvas.removeEventListener("drop",this._onDrop),this.orbitControls.dispose();for(const e of this._allGizmos())e.dispose()}}_applyViewportLook(e){this._lookGridHex=e.grid??10066329;const t=this.grid.material.uniforms.uGrazingFade;if(t&&(t.value=e.background!==null?1:0),this._paintLookGrid(),this._lookAxisHexes=[e.axisX,e.axisY,e.axisZ],this._axisLines&&(this._axisLines.material.linewidth=this._axisLineCss(e.axisLineWidth)),this._verticalAxisLine&&(this._verticalAxisLine.material.linewidth=this._axisLineCss(e.axisLineWidth)),this._axisLineWidth=e.axisLineWidth,this._rebuildAxisLines(),e.background!==null){const i=this._scene.background,s=i===null||i instanceof U&&[this._lookBackgroundHex,e.background].includes(i.getHex());this._lookBackgroundHex=e.background,s&&this._paintLookBackground()}else this._lookBackgroundHex=null}bindPresentation(e,t){this._presentation?.stop();const i=new hc(this._scene),s=i.roots();this._editorObjects.push(...s),$n(e,t);const r=()=>{const l=hi(e);this._renderer&&i.apply(l,this._renderer,void 0,{tone:!1,sky:!1,floor:!1}),this.setStageFunction(l.world,l.interaction),this.setFieldOfView(l.camera.fov),this.setSelectionMarks(l.overlays.selection),this.setGridMajorEvery(l.overlays.grid.majorEvery),this.setAxisLines(l.overlays.axes),this.setNavigation(l.overlays.navigation),this.setGridVisible(l.overlays.grid.visible),$()},n=Vr(r),a={rig:i,stop:()=>{n(),i.dispose(),this._editorObjects=this._editorObjects.filter(c=>!s.includes(c)),this._presentation===a&&(this._presentation=null);const l=this._lightRig&&!this._store.isAdoptedSceneActive;this._editorAmbient.visible=l,this._editorDirLight.visible=l}};return this._presentation=a,this._editorAmbient.visible=!1,this._editorDirLight.visible=!1,r(),a.stop}setSelectionMarks(e){const t=this._selectionMarks;t.outline===e.outline&&t.wire===e.wire&&t.box===e.box||(this._selectionMarks={outline:e.outline,wire:e.wire,box:e.box},this._syncBoxHelpers())}alignGridToView(e,t){const i=this.grid.material.uniforms,s=i.uPlaneNormal.value;let r=-1;e.isOrthographicCamera&&(e.getWorldDirection(us),r=[Math.abs(us.x),Math.abs(us.y),Math.abs(us.z)].findIndex(d=>d>1-1e-4),r!==-1&&!vu(Ri.set(0,1,0).applyQuaternion(e.getWorldQuaternion(bm)))&&(r=-1)),s.set(r===0?1:0,r===-1||r===1?1:0,r===2?1:0),this.grid.quaternion.setFromUnitVectors(Sm,s),this.grid.position.set(0,0,0),this.grid.scale.setScalar(1);const n=i.uCenter.value;if(n.set(0,0),i.uReach.value=1,this._axisLines?.position.set(0,0,0),this._axisLines?.scale.setScalar(1),r!==-1){const h=e;e.getWorldPosition(Ri);const d=Ri.clone().addScaledVector(s,-Ri.dot(s));n.set(r===1||r===2?d.x:d.z,r===1?d.z:d.y);const p=Math.hypot(h.right-h.left,h.top-h.bottom)/(2*h.zoom),u=Math.max(1,p/(this.grid.geometry.parameters.width*.5*.55));i.uReach.value=u,this.grid.scale.setScalar(u),Ri.addScaledVector(us,h.far*.98);const f=s.clone().multiplyScalar(Ri.dot(s));this.grid.position.copy(d).add(f),this._axisLines?.position.copy(f),this._axisLines?.scale.setScalar(Math.max(1,(n.length()+p)/Lo))}let a=1,l=1;if(r!==-1){const h=e,p=60*((h.right-h.left)/h.zoom)/Math.max(t,1);a=10**Math.floor(Math.log10(p)),l=1-(p-a)/(a*10-a)}i.uUnit.value=a,i.uMinorFade.value=l,i.uAligned.value=r===-1?0:1;const c=this._axisLineCss(r===-1?this._axisLineWidth:1);for(const h of[this._axisLines,this._verticalAxisLine]){const d=h?.material;d&&d.linewidth!==c&&(d.linewidth=c)}}setGridMajorEvery(e){const t=this.grid.material.uniforms.uMajorEvery;t&&Number.isFinite(e)&&e>=1&&(t.value=e)}_gridMajorContrast=1;_applyGridLines(e){const t=this.grid.material.uniforms;t.uLineWidth&&(t.uLineWidth.value=e.lineWidth),t.uMajorWidth&&(t.uMajorWidth.value=e.majorWidth),this._gridMajorContrast=e.majorContrast,this._paintLookGrid()}_paintLookGrid(){const e=this._lookGridHex;if(e===null)return;const t=this._lookBackgroundHex??4144959,i=a=>{const l=e>>a&255,c=t>>a&255;return Math.round(Math.min(255,Math.max(0,c+(l-c)*this._gridMajorContrast)))},s=i(16)<<16|i(8)<<8|i(0),r=yl(e,this._renderer),n=yl(s,this._renderer);this.grid.material.uniforms.uColor?.value?.copy(r),this.grid.material.uniforms.uMajorColor?.value?.copy(n)}_rebuildAxisLines(){const e=this._axisLines;if(!e)return;const t=this._stageAxisFrame,i=this._stageAxes,s=[0,1,2].filter(l=>{const c=t[l][0];return i==="floor"?l!==1:["x","y","z"].some((h,d)=>d===c&&i[h])});if(this._axesWanted=s.length>0,e.visible=this.grid.visible&&this._axesWanted,!this._axesWanted)return;const r=l=>{const c=[],h=[];for(const p of l){const u=t[p][0],f=this._lookAxisHexes[u],m=f==null?this._gizmoAxisColor(u):new U(f);c.push(...Sl(p));for(let y=0;y<go*2;y++)h.push(m.r,m.g,m.b)}const d=new jr;return d.setPositions(c),d.setColors(h),d},n=s.filter(l=>l!==1),a=s.includes(1);if(e.material.visible=n.length>0,n.length>0&&(e.geometry.dispose(),e.geometry=r(n)),a&&!this._verticalAxisLine){const l=e.material;this._verticalAxisLine=new Ur(r([1]),new Gr({vertexColors:!0,linewidth:l.linewidth,transparent:!0,opacity:1,depthWrite:!1,toneMapped:!1})),this._verticalAxisLine.layers.set(K),e.add(this._verticalAxisLine)}else a&&this._verticalAxisLine&&(this._verticalAxisLine.geometry.dispose(),this._verticalAxisLine.geometry=r([1]));this._verticalAxisLine&&(this._verticalAxisLine.visible=a)}setAxisLines(e){e===this._stageAxes||typeof e=="object"&&typeof this._stageAxes=="object"&&e.x===this._stageAxes.x&&e.y===this._stageAxes.y&&e.z===this._stageAxes.z||(this._stageAxes=typeof e=="object"?{x:e.x,y:e.y,z:e.z}:e,this._rebuildAxisLines())}_paintLookBackground(){if(this._lookBackgroundHex===null)return;const e=this._scene.background;e instanceof U&&e.getHex()===this._lookBackgroundHex||(this._scene.background=new U(this._lookBackgroundHex))}_syncLookBackground(){this._renderer&&(this._renderer.toneMapping===this._lookToneMapping&&this._renderer.toneMappingExposure===this._lookExposure||(this._paintLookGrid(),this._lookToneMapping=this._renderer.toneMapping,this._lookExposure=this._renderer.toneMappingExposure))}dispose(){this._unsubscribeKeymap(),this._disposed=!0,this._unsubscribeSelectionTheme(),this._verticalAxisLine&&(this._verticalAxisLine.geometry.dispose(),this._verticalAxisLine.material.dispose(),this._verticalAxisLine=null),this._axisLines&&(this._scene.remove(this._axisLines),this._axisLines.geometry.dispose(),this._axisLines.material.dispose(),this._axisLines=null),this.clearCameraView(),this._sparkRenderer&&(this._scene.remove(this._sparkRenderer),vd(this._sparkRenderer),this._sparkRenderer=null),this.disconnectInput(),this._hideDropOverlay();for(const e of this._helpers.values())this._scene.remove(e);this._helpers.clear();for(const e of this._boxHelpers.values())this._scene.remove(e),e.geometry.dispose(),e.material.dispose();this._boxHelpers.clear();for(const e of this._reflectionProbeHelpers.values())e.dispose();this._reflectionProbeHelpers.clear();for(const e of this._triggerVolumeHelpers.values())e.dispose();this._triggerVolumeHelpers.clear();for(const e of this._constraintHelpers.values())e.dispose();this._constraintHelpers.clear();for(const{helper:e}of this._cameraHelpers.values())e.dispose();this._cameraHelpers.clear(),fl(this._spatialHandleRoots),this._spatialHandleRoots=[],this._spatialHandleMeshes=[]}_ensureSparkRenderer(){if(!this._renderer||this._sparkRenderer||this._sparkRendererLoading||this._sparkRendererFailed)return;const e=performance.now();wd(this._lastSparkDiscoveryAt,e)&&(this._lastSparkDiscoveryAt=e,xd(this._scene)&&(this._sparkRendererLoading=!0,wi(async()=>{const{SparkRenderer:t}=await import("./spark.module-CTTm62aa.js");return{SparkRenderer:t}},__vite__mapDeps([0,1,2])).then(({SparkRenderer:t})=>{if(this._disposed||!this._renderer)return;const i=new t({renderer:this._renderer,enableLod:!1});i.traverse(s=>Ze(s,"engineInternal",!0)),this._sparkRenderer=i,$()}).catch(t=>{this._sparkRendererFailed=!0,console.error("Failed to install SparkRenderer in the editor viewport.",t)}).finally(()=>{this._sparkRendererLoading=!1})))}_buildOrientationGizmo(){if(this._vcScene!==void 0){for(const e of[...this._vcScene.children]){this._vcScene.remove(e);const t=e;t.isSprite||t.geometry?.dispose();const i=t.material;i?.map?.dispose(),i?.dispose()}this._vcBalls.length=0,this._vcStalks.length=0,this._vcSolids.length=0,this._vcClickTargets.length=0,this._initOrientationGizmo()}}_initOrientationGizmo(){const e=this._gizmoLook.navigationForm;if(e!=="balls"&&e!=="godot"){this._initNavigationForm(e);return}const t=bt/3,i=po/t,s=mm/t,r=fo/t/2,n=[new v(1,0,0),new v(0,1,0),new v(0,0,1)],a=new kt(i*.6,8,8),l=new Le({visible:!1});for(let c=0;c<3;c++){const[h,d]=this._stageAxisFrame[c],p=this._gizmoLook.navigation??this._gizmoLook.axes,u=p===null?new U(...Wn[h]):new U(p[h]),f=bl[h],m=n[c].clone().multiplyScalar(d);for(const y of[1,-1]){const _=m.clone().multiplyScalar(y),w=new O(new ke(r,r,s,8),new Le({color:u,transparent:!0,depthTest:!1,toneMapped:!1}));w.position.copy(_).multiplyScalar(s/2),w.quaternion.setFromUnitVectors(new v(0,1,0),_),this._vcScene.add(w),this._vcStalks.push({mesh:w,direction:_.clone(),positive:y>0,color:u});const x=z=>{const F=new so(new Da({map:z,transparent:!0,depthTest:!1,toneMapped:!1}));return F.position.copy(_).multiplyScalar(s),F.scale.setScalar(i),this._vcScene.add(F),F},S=x(dm()),C=x(um()),b=x(pm(y>0?f:`-${f}`));this._vcBalls.push({fill:S,ring:C,letter:b,direction:_.clone(),positive:y>0,axis:c,color:u});const M=new O(a,l);M.position.copy(S.position),Ze(M,"vcDirIdx",c*2+(d*y>0?0:1)),this._vcScene.add(M),this._vcClickTargets.push(M)}}}_initNavigationForm(e){const t=bt/3,i=new v(0,1,0),s=[new v(1,0,0),new v(0,1,0),new v(0,0,1)],r=this._gizmoLook.navigation??this._gizmoLook.axes,n=(a,l,c,h)=>{const d=new so(new Da({map:hm(a,l),transparent:!0,depthTest:!1,toneMapped:!1}));d.position.copy(c),d.scale.setScalar(h/t),d.renderOrder=200,this._vcScene.add(d)};for(let a=0;a<3;a++){const[l,c]=this._stageAxisFrame[a],h=r===null?new U(...Wn[l]):new U(r[l]),d=bl[l],p=s[a].clone().multiplyScalar(c);if(e==="triad"){const u=this._gizmoLook.navigationSize??1,f=24*u/t,m=fo*Math.sqrt(u)/t/2,y=new O(new ke(m,m,f,6),new Le({color:h,transparent:!0,depthTest:!1,toneMapped:!1}));y.position.copy(p).multiplyScalar(f/2),y.quaternion.setFromUnitVectors(i,p),this._vcScene.add(y),this._vcSolids.push({mesh:y,direction:p.clone()}),n(h,d,p.clone().multiplyScalar(f+7*u/t),12*u);continue}for(const u of[1,-1]){const f=p.clone().multiplyScalar(u),m=new O(new lu(6/t,15/t,20),new Le({color:u>0?h:new U(14277081),transparent:!0,depthTest:!1,toneMapped:!1}));m.position.copy(f).multiplyScalar(19/t),m.quaternion.setFromUnitVectors(i,f.clone().negate()),Ze(m,"vcDirIdx",a*2+(c*u>0?0:1)),this._vcScene.add(m),this._vcSolids.push({mesh:m,direction:f.clone()}),this._vcClickTargets.push(m),u>0&&n(h,d.toLowerCase(),f.clone().multiplyScalar(34/t),12)}}if(e==="cones"){const a=new O(new Se(11/t,11/t,11/t),new Le({color:12434877,transparent:!0,depthTest:!1,toneMapped:!1}));a.renderOrder=50,this._vcScene.add(a)}}_syncOrientationGizmoDepth(){const e=bt/3,t=this._vcDir.copy(this._vcCamera.position).normalize();if(this._gizmoLook.navigationForm==="godot"){this._syncGodotNavigation(t);return}const i=new U(this._gizmoLook.background??4013373),s=new U(1,1,1),r=(c,h,d,p)=>{const u=c.getRGB({r:0,g:0,b:0},wt),f=h.getRGB({r:0,g:0,b:0},wt);return p.setRGB(u.r+(f.r-u.r)*d,u.g+(f.g-u.g)*d,u.b+(f.b-u.b)*d,wt)};let n=-1;for(const{direction:c,axis:h}of this._vcBalls)1-c.dot(t)**2<1e-6&&(n=h);const a=new U,l=new U(0,0,0);for(const{fill:c,ring:h,letter:d,direction:p,positive:u,axis:f,color:m}of this._vcBalls){const y=p.dot(t),_=(y+1)/2,w=y<=.01*(u?-1:1),x=f===n&&!w,S=f===n&&w,C=r(i,m,(y+1)*.25+.5,new U),b=c.material,M=h.material,z=d.material,F=Math.min(y+1,1);u||x?(b.color.copy(C),b.opacity=1):(b.color.copy(r(i,m,.25,a)),b.opacity=F),!u&&x?(M.color.copy(r(s,m,.5,a)),M.opacity=F):(M.color.copy(C),M.opacity=1),z.color.copy(r(l,b.color,lm,a)),c.visible=!S,h.visible=!S,d.visible=(u||f===n)&&!S;const R=(po+gm*_)/e,H=10+Math.round(_*100)*3;for(const[se,ve]of[[c,0],[h,1],[d,2]])se.scale.setScalar(R),se.renderOrder=H+ve}for(const{mesh:c,direction:h,positive:d,color:p}of this._vcStalks){const u=h.dot(t),f=(u+1)/2,m=c.material;r(i,p,(.75+(u+1)*.25+.5)/2,m.color),m.opacity=1,c.visible=d||n!==-1,c.renderOrder=10+Math.round(f*100)*3-1}for(const{mesh:c,direction:h}of this._vcSolids)c.renderOrder=Math.round((h.dot(t)+1)/2*100)}_syncGodotNavigation(e){const i=16/(bt/3),s=r=>{const n=r.getRGB({r:0,g:0,b:0},wt);return new U().setRGB(n.r*.6,n.g*.6,n.b*.6,wt)};for(const{fill:r,ring:n,letter:a,direction:l,positive:c,color:h}of this._vcBalls){const d=(l.dot(e)+1)/2,p=Math.min(1,.35+d/.5*.65),u=r.material,f=n.material,m=a.material;u.color.copy(c?h:s(h)),u.opacity=p,f.color.copy(h),f.opacity=p,m.color.setRGB(0,0,0),m.opacity=p*.6,r.visible=!0,n.visible=!0,a.visible=c;const y=10+Math.round(d*100)*3;for(const[_,w]of[[r,0],[n,1],[a,2]])_.scale.setScalar(i),_.renderOrder=y+w}for(const{mesh:r,direction:n,positive:a,color:l}of this._vcStalks){const c=(n.dot(e)+1)/2,h=r.material;h.color.copy(l),h.opacity=Math.min(1,.35+c/.5*.65),r.visible=a,r.renderOrder=10+Math.round(c*100)*3-1}}_isOverViewCube(e,t){if(this._navigation!=="interactive"||this._gizmoLook.navigationForm==="triad"||!this._store.shell.showGizmos)return!1;const i=this._canvas.getBoundingClientRect(),s=e-i.left,r=t-i.top,{left:n,top:a}=this._vcOrigin(i.width,i.height,this._chromeInsetPx);return s>=n&&s<=n+this._vcSize&&r>=a&&r<=a+this._vcSize}_vcOrigin(e,t,i){return this._gizmoLook.navigationCorner==="bottom-left"?{left:4+i,top:t-this._vcSize-48-i}:{left:e-this._vcSize-this._vcMarginRight-i,top:this._vcMarginTop+i}}setGridVisible(e){e!==this._presentationGrid&&(this._presentationGrid=e,this._applyGridVisibility())}_applyGridVisibility(){this.grid.visible=this._presentationGrid&&this._threeSurfaceShowing,this._axisLines&&(this._axisLines.visible=this.grid.visible&&this._axesWanted),$()}setNavigation(e){e!==this._navigation&&(this._navigation=e,$())}_handleViewCubeClick(e){if(!this._isOverViewCube(e.clientX,e.clientY))return!1;const t=this._canvas.getBoundingClientRect(),i=e.clientX-t.left,s=e.clientY-t.top,{left:r,top:n}=this._vcOrigin(t.width,t.height,this._chromeInsetPx),a=(i-r)/this._vcSize*2-1,l=-((s-n)/this._vcSize*2-1);this._vcRaycaster.setFromCamera(new Oe(a,l),this._vcCamera);const c=this._vcRaycaster.intersectObjects(this._vcClickTargets);if(c.length===0)return!0;const h=Ee(c[0].object,"vcDirIdx"),d=sm[h];for(const f of[...this._axisViewListeners].reverse())if(f())break;const p=this.orbitControls;p._sphericalDelta.set(0,0,0),p._panOffset.set(0,0,0);const u=d.y>.5?new v(0,0,-1):d.y<-.5?new v(0,0,1):new v(0,1,0);return this._snapDist=this.freeCamera.position.distanceTo(this.orbitControls.target),this._snapQ1.copy(this.freeCamera.quaternion),this._snapQ2.setFromRotationMatrix(new Tt().lookAt(d,new v,u)),this._snapStartTime=performance.now(),this._snapAnimating=!0,!0}_flushGizmoToStoreLive(){this._skipNextSync=!0;const e=this._authoring(),t=(s,r)=>{s&&va(e,s,{position:r.position.toArray(),rotation:r.quaternion.toArray(),scale:r.scale.toArray()})},i=this._activeGizmo.object;i&&i!==this._pivotDummy&&t(this._attachedAuthoringId??this._authoringIdForObject(i),i);for(const{id:s,obj:r}of this._otherDragObjects)t(s,r);for(const{id:s,obj:r}of this._allDragObjects)t(s,r);for(const{id:s,obj:r}of this._preservedChildObjects)t(s,r)}_preparePreservedChildren(e){if(!this._store.shell.preserveChildrenTransform)return[];const t=this._authoring(),i=new Set(e),s=new Map;for(const r of i){const n=this._preservedChildrenForParent(t,r,i,s);if(typeof n=="string")return st(n),[];for(const a of n)s.set(a.id,a)}return[...s.values()]}_preservedChildrenForParent(e,t,i,s){const r=[];for(const n of e.hierarchy.node(t)?.childIds??[]){if(i.has(n)||s.has(n))continue;const a=this._objectForAuthoringId(n);if(!a?.parent)continue;const l=this._unwritableTransformChannel(e,n);if(l){const c=e.hierarchy.node(n)?.label??n;return`Preserve Children Transform needs writable ${l} on ${c}. The parent will transform normally.`}a.updateWorldMatrix(!0,!1),r.push({id:n,obj:a,worldMatrix:a.matrixWorld.clone()})}return r}_unwritableTransformChannel(e,t){return["position","rotation","scale"].find(i=>!(e.transforms?.editability?.(t,i).writable??!1))}_restorePreservedChildren(){const e=new Tt;for(const t of this._preservedChildObjects){const i=t.obj.parent;i&&(i.updateWorldMatrix(!0,!1),e.copy(i.matrixWorld).invert().multiply(t.worldMatrix),e.decompose(t.obj.position,t.obj.quaternion,t.obj.scale),t.obj.updateMatrix(),t.obj.updateWorldMatrix(!1,!0))}}_belongsToRoots(e,t){let i=e;for(;i;){if(t.has(i))return!0;i=i.parent}return!1}_floorSnapPosition(e,t){e.updateWorldMatrix(!0,!0);const i=mi(e);if(i.isEmpty())return null;const s=Math.min((i.max.x-i.min.x)*.1,.05),r=Math.min((i.max.z-i.min.z)*.1,.05),n=[[(i.min.x+i.max.x)/2,(i.min.z+i.max.z)/2],[i.min.x+s,i.min.z+r],[i.max.x-s,i.min.z+r],[i.min.x+s,i.max.z-r],[i.max.x-s,i.max.z-r]],a=new lt;a.layers.enableAll();const l=i.min.y+Math.max((i.max.y-i.min.y)*.001,.001);let c=Number.NEGATIVE_INFINITY;for(const[p,u]of n){a.set(new v(p,l,u),new v(0,-1,0));const f=a.intersectObjects(this._scene.children,!0).find(m=>!this._belongsToRoots(m.object,t)&&!at(m.object)&&m.point.y<=l);f&&(c=Math.max(c,f.point.y))}if(!Number.isFinite(c))return null;const h=c-i.min.y;if(Math.abs(h)<1e-6)return null;const d=e.getWorldPosition(new v);return d.y+=h,e.parent?(e.parent.updateWorldMatrix(!0,!1),e.parent.worldToLocal(d)):d}snapSelectionToFloor(){const e=this._authoring(),t=e.transforms;if(!t){st("This document does not expose writable transforms.");return}const i=[...this._store.shell.selectedEntityIds].map(l=>({id:l,obj:this._objectForAuthoringId(l)})).filter(l=>!!l.obj&&(t.editability?.(l.id,"position").writable??!0)),s=new Set(i.map(({obj:l})=>l)),r=i.filter(({obj:l})=>{let c=l.parent;for(;c;){if(s.has(c))return!1;c=c.parent}return!0});if(r.length===0){st("Select an object with a writable position first.");return}const n=new Set(r.map(({obj:l})=>l)),a=[];for(const l of r){const c=this._floorSnapPosition(l.obj,n);c&&a.push({...l,position:c})}if(a.length===0){st("No solid scene surface was found beneath the selection.");return}for(const{id:l}of a)_a(e,l);for(const{obj:l,position:c}of a)l.position.copy(c);this._skipNextSync=!0;for(const{id:l,obj:c}of a)va(e,l,{position:c.position.toArray(),rotation:c.quaternion.toArray(),scale:c.scale.toArray()});for(const{id:l}of a)wa(e,l);this.syncFromStore()}_applySurfaceSnap(e,t){const i=new Set,s=this._attachedAuthoringId??this._authoringIdForObject(e);s&&i.add(s);for(const{id:c}of t)i.add(c);const r=[];for(const[c,h]of this._objectMap)i.has(c)||r.push(h);if(r.push(this.grid),r.length===0){this._surfaceSnapIndicator.visible=!1;return}const n=e.position.clone();n.y+=50,this._surfaceSnapRaycaster.set(n,new v(0,-1,0)),this._surfaceSnapRaycaster.far=200;const l=this._surfaceSnapRaycaster.intersectObjects(r,!0).find(c=>c.object===this.grid||!at(c.object));if(l){const c=l.point,h=c.y,d=h-e.position.y;e.position.y=h;for(const{obj:u}of t)u.position.y+=d;this._surfaceSnapIndicator.position.copy(c),this._surfaceSnapIndicator.position.y+=.01;const p=l.face?.normal;if(p){const u=p.clone().transformDirection(l.object.matrixWorld);this._surfaceSnapIndicator.quaternion.setFromUnitVectors(new v(0,1,0),u)}this._surfaceSnapIndicator.visible=!0}else this._surfaceSnapIndicator.visible=!1}_collectVertices(e){const t=[];for(const[s,r]of this._objectMap)e.has(s)||r.traverse(n=>{if(at(n))return;const a=n;if(!a.isMesh||!a.geometry)return;const l=a.geometry.getAttribute("position");if(!l)return;const c=Math.min(l.count,1e3),h=a.matrixWorld;for(let d=0;d<c;d++){const p=new v(l.getX(d),l.getY(d),l.getZ(d));p.applyMatrix4(h),t.push(p)}});return t}_applyVertexSnap(e,t){const i=e.position,s=i.clone().project(this._screenCamera),r=this._canvas.getBoundingClientRect(),n=(s.x+1)/2*r.width,a=(-s.y+1)/2*r.height;let l=this._vertexSnapThreshold,c=null;for(const h of this._vertexSnapTargets){const d=h.clone().project(this._screenCamera);if(d.z>1)continue;const p=(d.x+1)/2*r.width,u=(-d.y+1)/2*r.height,f=n-p,m=a-u,y=Math.sqrt(f*f+m*m);y<l&&(l=y,c=h)}if(c){const h=c.clone().sub(i);e.position.copy(c);for(const{obj:p}of t)p.position.add(h);this._vertexSnapIndicator.position.copy(c),this._vertexSnapIndicator.visible=!0;const d=c.distanceTo(this._screenCamera.position);this._vertexSnapIndicator.scale.setScalar(d*.008)}else this._vertexSnapIndicator.visible=!1}_flushGizmoToStore(){this._flushGizmoToStoreLive();const e=this._activeTransformEditIds;this._activeTransformEditIds=[],this._otherDragObjects=[],this._allDragObjects=[],this._preservedChildObjects=[];const t=this._authoring();for(const i of e)wa(t,i)}consumeSkipSync(){return this._skipNextSync?(this._skipNextSync=!1,!0):!1}_applyGizmoSize(){if(this.transformControls===void 0)return;const e=this._lookGizmoSizePx,t=Math.max(1,this._canvas.clientHeight),i=e===null?null:2*e,s=i===null?1:this.transformControls.camera.isOrthographicCamera?4*i/t:i/(.2375*t);for(const r of this._allGizmos())r.size=s}_dropNegativeAxisHandles(e,t){const i=e.children.find(r=>r.isTransformControlsGizmo);if(!i)return;const s={X:new v(1,0,0),Y:new v(0,1,0),Z:new v(0,0,1)};for(const r of t)for(const n of[i.gizmo[r],i.picker[r]])if(n)for(const a of[...n.children]){const l=s[a.name];if(l===void 0)continue;const c=a;if(!c.geometry)continue;c.geometry.computeBoundingBox();const h=c.geometry.boundingBox;h&&h.getCenter(new v).dot(l)<0&&n.remove(a)}}_axisColorMap(){const e=r=>this._gizmoAxisColor(this._stageAxisFrame[r][0]),t=e(0),i=e(1),s=e(2);return{X:t,Y:i,Z:s,XY:s,YZ:t,XZ:i}}_readLookStage(e){this._applyGizmoAxisFrame(),this._buildOrientationGizmo()}setStageFunction(e,t){this._stageBoxSelect=t.boxSelect;const i=t.transformHandles;(i.scale!==this._transformHandles.scale||i.viewRotate!==this._transformHandles.viewRotate||i.freeMove!==this._transformHandles.freeMove)&&(this._transformHandles={scale:i.scale,viewRotate:i.viewRotate,freeMove:i.freeMove},this._syncCombinedGizmoHalves(),$());const s=e.upAxis==="z"?e.handedness==="left"?nm:rm:xl;s!==this._stageAxisFrame&&(this._stageAxisFrame=s,this._applyGizmoAxisFrame(),this._buildOrientationGizmo(),this._rebuildAxisLines())}_applyGizmoAxisFrame(){if(this.transformControls===void 0)return;const e=this._stageAxisFrame.map(([,a])=>a),t=[0,1,2].map(a=>e[a]===this._appliedAxisSigns[a]?1:-1),i=t.some(a=>a===-1),s=this._axisColorMap(),r={X:this._gizmoAxisColor(0),Y:this._gizmoAxisColor(1),Z:this._gizmoAxisColor(2),XY:this._gizmoAxisColor(2),YZ:this._gizmoAxisColor(0),XZ:this._gizmoAxisColor(1)},n=(a,l,c,h,d)=>{a&&a.traverse(p=>{const u=p;c&&u.geometry&&u.geometry.scale(t[0],t[1],t[2]),h&&u.material&&!Array.isArray(u.material)&&!u.userData.volterOwnMaterial&&(u.material=u.material.clone(),u.userData.volterOwnMaterial=!0);const f=u.material;if(!f||Array.isArray(f))return;c&&(f.side=Di);const m=l[p.name];if(m&&f.color){if(d){const y=f.userData.volterBaseOpacity??=f.opacity;f.opacity=y*(this._gizmoLook.opacity??1),f._opacity=void 0}f.color.copy(m),f._color=void 0}})};for(const a of this._allGizmos()){const l=a.getHelper().children.find(c=>c.isTransformControlsGizmo);if(l)for(const c of["gizmo","picker","helper"]){const h=c==="gizmo";n(l[c]?.translate,s,i,!1,h),n(l[c]?.rotate,s,!1,!1,h),n(l[c]?.scale,r,!1,!0,h)}}i&&(this._appliedAxisSigns=e)}_gizmoAxisColor(e){const t=this._gizmoLook.axes;return t===null?new U().setRGB(...Wn[e],wt):new U(t[e])}_installGizmoHighlight(e){const t=e.getHelper().children.find(s=>s.isTransformControlsGizmo);if(!t)return;const i=t.updateMatrixWorld.bind(t);t.updateMatrixWorld=s=>{i(s);const r=this._store.shell.transformMode==="combined",n=t.mode==="translate"&&!this._transformHandles.freeMove?"XYZ":r&&t.mode==="rotate"&&!this._transformHandles.viewRotate?"E":null;if(n!==null)for(const h of[t.gizmo,t.picker])for(const d of h[t.mode]?.children??[])d.name===n&&(d.visible=!1);const a=this._gizmoLook,l=t.axis;if(!t.enabled||!l||a.hover===null&&a.axes===null&&a.highlightSaturation===null&&a.highlightValue===null)return;const c=t.dragging?a.drag??a.hover:a.hover;for(const h of t.gizmo[t.mode]?.children??[]){if(h.name!==l&&!l.split("").some(y=>h.name===y))continue;const d=h.material;if(!d||Array.isArray(d)||!d.color)continue;if(c!==null){d.color.setHex(c);continue}const p=(d._color??d.color).clone().convertLinearToSRGB(),u=om(p),f=u.s*(a.highlightSaturation??1),m=a.highlightValue??u.v;am(u.h,f,m,d.color).convertSRGBToLinear()}}}_applyGizmoArrows(){if(this.transformControls===void 0)return;this._applyGizmoRings();const e={length:this._gizmoLook.arrowLength??1.2,head:this._gizmoLook.arrowHead??1},t=this._appliedArrow;if(e.length===t.length&&e.head===t.head)return;const i=.5,s=.1,r=p=>i*p.length-s*p.head;if(r(e)<=.05)return;const n=r(e)/r(t),a=e.head/t.head,l=e.length/t.length,c=this.transformControls.getHelper().children.find(p=>p.isTransformControlsGizmo);if(!c)return;const h={X:0,Y:1,Z:2},d=(p,u)=>[0,1,2].map(f=>f===p?u:1);for(const p of c.gizmo.translate?.children??[]){const u=h[p.name],f=p.geometry;if(u===void 0||!f)continue;if(!(f.parameters?.radiusTop===0)){f.scale(...d(u,n));continue}f.computeBoundingBox();const _=f.boundingBox,w=[_.min.x,_.min.y,_.min.z][u],x=[_.max.x,_.max.y,_.max.z][u],S=Math.abs(w)<Math.abs(x)?w:x,C=[0,0,0];C[u]=-S,f.translate(...C),f.scale(a,a,a),C[u]=S*n,f.translate(...C)}for(const p of c.picker.translate?.children??[]){const u=h[p.name],f=p.geometry;u===void 0||!f||f.scale(...d(u,l))}this._appliedArrow=e}_applyGizmoRings(){const e=this._gizmoLook.ringWidth??1;if(e<=0||e===this._appliedRingWidth)return;const t=e/this._appliedRingWidth,i=new v,s=new v,r=new v;for(const n of[this.transformControls,this._auxRotateControls]){const a=n.getHelper().children.find(l=>l.isTransformControlsGizmo);for(const l of a?.gizmo.rotate?.children??[]){const c=l.geometry;if(!["X","Y","Z"].includes(l.name)||!c||c.type!=="TorusGeometry")continue;const h=c.parameters.radius;c.computeBoundingBox(),c.boundingBox.getSize(r);const d=r.x<=r.y&&r.x<=r.z?0:r.y<=r.z?1:2,p=c.getAttribute("position");for(let u=0;u<p.count;u++)i.fromBufferAttribute(p,u),s.copy(i).setComponent(d,0),s.lengthSq()!==0&&(s.setLength(h),i.sub(s).multiplyScalar(t).add(s),p.setXYZ(u,i.x,i.y,i.z));p.needsUpdate=!0,c.computeBoundingSphere()}}this._appliedRingWidth=e}_patchGizmo(e){const t=this._axisColorMap(),i={XY:[-.075,-.075,0],YZ:[0,-.075,-.075],XZ:[-.075,0,-.075]};e.traverse(s=>{const r=s,n=t[s.name];if(n&&r.material){const l=r.material;l.color&&l.color.copy(n)}const a=i[s.name];a&&r.geometry&&r.geometry.translate(a[0],a[1],a[2])})}_patchCombinedScaleGizmo(e){const i=e.children.find(a=>a.isTransformControlsGizmo);if(!i)return;const s={X:new v(1,0,0),Y:new v(0,1,0),Z:new v(0,0,1)},r=.54+.55,n=.3;for(const[a,l]of[[i.gizmo.scale,!1],[i.picker.scale,!0]])if(a)for(const c of[...a.children]){const h=c,d=s[c.name],p=d!==void 0&&h.geometry?.type==="CylinderGeometry"&&h.geometry.parameters.radiusTop<.05;if(d===void 0||p){a.remove(c);continue}h.geometry.computeBoundingBox();const u=h.geometry.boundingBox;if(!u)continue;const f=Math.sign(u.getCenter(new v).dot(d))||1;if(l){const y=d.clone().multiplyScalar(f*r);h.geometry.dispose(),h.geometry=new Se(n,n,n).translate(y.x,y.y,y.z);continue}const m=d.clone().multiplyScalar(f*.55);h.geometry.translate(m.x,m.y,m.z)}}_projectToScreen(e){const t=new v;e.getWorldPosition(t),t.project(this._screenCamera);const i=this._canvas.getBoundingClientRect();return new Oe((t.x+1)/2*i.width+i.left,(-t.y+1)/2*i.height+i.top)}static _FLY_KEYS=new Set(["w","a","s","d","q","e"]);_enterFlyMode(){this._flyActive||this._cameraViewMode!=="view"&&(this._flyActive=!0,this._snapAnimating=!1,this.orbitControls.enabled=!1,this._flyEuler.setFromQuaternion(this.renderCamera.quaternion,"YXZ"),this.orbitControls.dispatchEvent({type:"start"}),this._canvas.requestPointerLock?.())}_exitFlyMode(){if(!this._flyActive)return;this._flyActive=!1,this._flyKeys.clear(),this.orbitControls.enabled=this._cameraViewMode!=="view",document.exitPointerLock();const e=this.renderCamera,t=new v(0,0,-1).applyQuaternion(e.quaternion),i=e.position.distanceTo(this.orbitControls.target);this.orbitControls.target.copy(e.position).add(t.multiplyScalar(Math.max(i,5))),this.orbitControls.dispatchEvent({type:"end"})}_updateFlyCamera(e){if(!this._flyActive||this._flyKeys.size===0)return;const t=this.renderCamera,i=this._flySpeed*(this._flyKeys.has("shift")?3:1),s=new v(0,0,-1).applyQuaternion(t.quaternion),r=new v(1,0,0).applyQuaternion(t.quaternion),n=new v;this._flyKeys.has("w")&&n.add(s),this._flyKeys.has("s")&&n.sub(s),this._flyKeys.has("d")&&n.add(r),this._flyKeys.has("a")&&n.sub(r),this._flyKeys.has("e")&&(n.y+=1),this._flyKeys.has("q")&&(n.y-=1),n.lengthSq()>0&&(n.normalize().multiplyScalar(i*e),t.position.add(n),this.orbitControls.dispatchEvent({type:"change"}))}_onFlyKeyDown=e=>{if(!this._rightMouseDown||e.target instanceof HTMLInputElement||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLSelectElement)return;const t=e.key.toLowerCase();if(t==="shift"){this._flyKeys.add("shift");return}Bo._FLY_KEYS.has(t)&&(e.preventDefault(),e.stopPropagation(),this._flyKeys.add(t),this._flyActive||this._enterFlyMode())};_onFlyKeyUp=e=>{const t=e.key.toLowerCase();if(t==="shift"){this._flyKeys.delete("shift");return}this._flyKeys.delete(t)};_onFlyPointerDown=e=>{e.button===2&&(this._rightMouseDown=!0)};_onFlyPointerUp=e=>{e.button===2&&(this._rightMouseDown=!1,this._flyActive&&this._exitFlyMode())};_onFlyPointerMove=e=>{if(!this._flyActive)return;const t=.002;this._flyEuler.y-=e.movementX*t,this._flyEuler.x-=e.movementY*t,this._flyEuler.x=Math.max(-Math.PI/2+.01,Math.min(Math.PI/2-.01,this._flyEuler.x)),this.renderCamera.quaternion.setFromEuler(this._flyEuler),this.orbitControls.dispatchEvent({type:"change"})};_onTrackpadWheel=e=>{if(this._flyActive||!this.orbitControls.enabled||e.ctrlKey||Math.abs(e.deltaX)<.5&&!e.shiftKey)return;e.preventDefault(),e.stopImmediatePropagation();const t=this._interactionElement.clientHeight||1,i=this.camera.position.distanceTo(this.orbitControls.target),s=2*Math.tan(this.camera.fov/2*Math.PI/180)*i/t,r=e.deltaMode===1?16:1,n=h=>Math.sign(h)*Math.min(Math.abs(h*r),30),a=new v().setFromMatrixColumn(this.camera.matrix,0),l=new v().setFromMatrixColumn(this.camera.matrix,1),c=a.multiplyScalar(n(e.deltaX)*s).add(l.multiplyScalar(-n(e.deltaY)*s));this.camera.position.add(c),this.orbitControls.target.add(c),this.orbitControls.update()};_onFlyWheel=e=>{if(!this._flyActive)return;e.preventDefault();const t=e.deltaY>0?.85:1.18;this._flySpeed=Math.max(.5,Math.min(100,this._flySpeed*t))};_onPointerDown=e=>{if(this._pointerDownPos.set(e.clientX,e.clientY),this._pointerDownButton=e.button,this._marqueeActive=!1,this._pointerSessionActive=!0,this._constraintControlPointerSession=!1,e.button===0&&!e.altKey){if(this._selectConstraintControlAt(e))return;const t=this._raycastSpatialHandle(e),i=t?ul(t):null;if(t&&i?.handle.writable){e.stopPropagation(),this._activeSpatialHandle=i,this._spatialHandleDragPoint.copy(t.position),this._orbitEnabledBeforeHandleDrag=this.orbitControls.enabled,this._transformEnabledBeforeHandleDrag=this.transformControls.enabled,this.orbitControls.enabled=!1;for(const n of this._allGizmos())n.enabled=!1;const s=this._screenCamera.getWorldDirection(new v);this._spatialHandleDragPlane.setFromNormalAndCoplanarPoint(s,t.position),this._spatialHandleDragOffset.set(0,0,0);const r=this._spatialHandleWorldPoint(e);r&&this._spatialHandleDragOffset.subVectors(t.position,r),this._canvas.style.cursor="grabbing"}}};_onPointerMove=e=>{if(this._updateEditorHandleInteraction(e)||(this._updateSpatialHandleHover(e),!this._pointerSessionActive)||!(e.buttons&1)||this._pointerDownButton!==0||this._anyGizmoDragging()||this._altDragOrbit)return;const t=e.clientX-this._pointerDownPos.x,i=e.clientY-this._pointerDownPos.y;if(!this._marqueeActive&&Math.sqrt(t*t+i*i)>5){if(this._isOverViewCube(this._pointerDownPos.x,this._pointerDownPos.y))return;this._marqueeActive=!0,this.orbitControls.enabled=!1,this._marqueeDiv||(this._marqueeDiv=document.createElement("div"),Object.assign(this._marqueeDiv.style,{position:"fixed",pointerEvents:"none",zIndex:xa.sticky}),(document.getElementById("editor-chrome-root")??document.body).appendChild(this._marqueeDiv)),Object.assign(this._marqueeDiv.style,Cm(hh(this._canvas)))}if(this._marqueeActive&&this._marqueeDiv){const s=Math.min(this._pointerDownPos.x,e.clientX),r=Math.min(this._pointerDownPos.y,e.clientY),n=Math.abs(e.clientX-this._pointerDownPos.x),a=Math.abs(e.clientY-this._pointerDownPos.y);Object.assign(this._marqueeDiv.style,{left:`${s}px`,top:`${r}px`,width:`${n}px`,height:`${a}px`,display:"block"})}};_onPointerUp=e=>{if(!this._pointerSessionActive)return;if(this._pointerSessionActive=!1,this._activeSpatialHandle){this._finishSpatialHandleDrag(!0);return}if(this._constraintControlPointerSession){this._constraintControlPointerSession=!1;return}if(this._marqueeActive){this._marqueeActive=!1,this.orbitControls.enabled=!0,this._marqueeDiv&&(this._marqueeDiv.style.display="none");const n=Math.min(this._pointerDownPos.x,e.clientX),a=Math.max(this._pointerDownPos.x,e.clientX),l=Math.min(this._pointerDownPos.y,e.clientY),c=Math.max(this._pointerDownPos.y,e.clientY),h=[],d=new v,p=new St;for(const[u,f]of this._objectMap){if(!f.visible||f.isCamera===!0)continue;if(p.setFromObject(f),p.isEmpty()){const z=this._projectToScreen(f);z.x>=n&&z.x<=a&&z.y>=l&&z.y<=c&&h.push(u);continue}const m=this._stageBoxSelect==="touch",y=this._canvas.getBoundingClientRect(),_=this._screenCamera;let w=!0,x=Number.POSITIVE_INFINITY,S=Number.NEGATIVE_INFINITY,C=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY;for(let z=0;z<8;z++){if(d.set(z&1?p.max.x:p.min.x,z&2?p.max.y:p.min.y,z&4?p.max.z:p.min.z),d.project(_),d.z<-1||d.z>1){if(w=!1,!m)break;continue}const F=y.left+(d.x+1)*y.width/2,R=y.top+(1-d.y)*y.height/2;(F<n||F>a||R<l||R>c)&&(w=!1),x=Math.min(x,F),S=Math.max(S,F),C=Math.min(C,R),b=Math.max(b,R)}const M=x<=S&&S>=n&&x<=a&&b>=l&&C<=c;(m?M:w)&&h.push(u)}if(e.shiftKey)for(const u of h)this._store.shell.addToSelection(u);else fs(this._authoring(),h);return}if(e.button!==0)return;const t=e.clientX-this._pointerDownPos.x,i=e.clientY-this._pointerDownPos.y;if(Math.sqrt(t*t+i*i)>5||this._anyGizmoDragging()||this._threejsToolContextActive&&this._handleViewCubeClick(e))return;const s=e.shiftKey&&(e.metaKey||e.ctrlKey),r=dh(this._scopeAuthoring(),()=>this._pickAt(e.clientX,e.clientY,s?"deep":"normal"));s?fs(this._authoring(),r?[r]:[]):e.shiftKey&&r?this._store.shell.toggleSelection(r):(e.metaKey||e.ctrlKey)&&r?this._store.shell.toggleSelection(r):fs(this._authoring(),r?[r]:[])};_scopeAuthoring(){return this._standaloneAuthoring?this._authoring():Pr().panelAuthoring(this._store.shell)}_pickAt(e,t,i){return this._pick?this._pick(e,t):Pr().pick(this._store.shell,e,t,i)}_onDoubleClick=e=>{if(e.button!==0||this._anyGizmoDragging()||this._marqueeActive||this._threejsToolContextActive&&this._isOverViewCube(e.clientX,e.clientY))return;const t=this._pickAt(e.clientX,e.clientY,"normal");t&&uh(this._scopeAuthoring(),t,()=>this._pickAt(e.clientX,e.clientY,"normal"))};_raycastGroundPlane(e){const t=this._canvas.getBoundingClientRect(),i=new Oe((e.clientX-t.left)/t.width*2-1,-((e.clientY-t.top)/t.height)*2+1);this.raycaster.setFromCamera(i,this._screenCamera);const s=ba("three");this._groundPlane.set(s.up==="z"?em:Kf,-s.groundHeight);const r=new v;return this.raycaster.ray.intersectPlane(this._groundPlane,r)}_showDropOverlay(){if(this._dropOverlay)return;const e=document.createElement("div");Object.assign(e.style,{position:"fixed",inset:"0",pointerEvents:"none",border:`2px dashed ${Ot.accent.default}`,background:Ot.accent.muted,zIndex:xa.base}),(document.getElementById("editor-chrome-root")??document.body).appendChild(e),this._dropOverlay=e}_hideDropOverlay(){this._dropOverlay&&(this._dropOverlay.remove(),this._dropOverlay=null)}_onDragOver=e=>{e.dataTransfer?.types.includes("application/x-editor-asset")&&(e.preventDefault(),e.dataTransfer.dropEffect="copy",this._showDropOverlay())};_onDragLeave=e=>{this._hideDropOverlay()};_onDrop=e=>{this._hideDropOverlay();const t=e.dataTransfer?.getData("application/x-editor-asset");if(!t)return;e.preventDefault();let i;try{i=JSON.parse(t)}catch{return}const s=ba("three"),r=this._raycastGroundPlane(e),n=d=>Math.round(d*100)/100,a=s.up==="z"?[n(r?.x??0),n(r?.y??0),s.groundHeight]:[n(r?.x??0),s.groundHeight,n(r?.z??0)],l=this._authoring(),c=l.assetDrop,h=i.component??{kind:"file",name:i.name};if(!c){Fi.warn(`Dropped “${i.name}” was not placed: this document does not accept dropped assets.`,"editor");return}if(i.online){const d=i.online,p=this._onlineAssetResolver;if(!p){Fi.warn(`Dropped “${i.name}” was not placed: this viewport has no online-asset resolver installed.`,"editor");return}st(`Downloading ${d.name} from the library…`),p(d).then(u=>{u?(st(`${d.name} downloaded — placing it.`),Sa(l,"",u,{position:a})):st(`Could not download ${d.name} — see the Console.`)}).catch(()=>{st(`Could not download ${d.name} — see the Console.`),Fi.error(`Could not download ${d.name}.`,"asset")});return}Sa(l,"",i.path,{position:a,item:h})}}class Pm extends je{constructor(e,t){super(),this.bones=e;const i=new Set;for(const a of e){const l=a.parent;l?.isBone&&this.addSegment(l,a,i);for(const c of a.children)c.isBone&&this.addSegment(a,c,i)}this.linePositions=new Float32Array(Math.max(this.segments.length*6,6));const s=new jr;s.setPositions(this.linePositions),this.lineMaterial=new Gr({color:t,linewidth:5,worldUnits:!1,depthTest:!1,depthWrite:!1,toneMapped:!1,alphaToCoverage:!0}),this.lines=new Ur(s,this.lineMaterial),this.lines.onBeforeRender=a=>{a.getSize(this.lineMaterial.resolution)},this.lines.frustumCulled=!1,this.lines.renderOrder=1001,this.add(this.lines),this.pointPositions=new Float32Array(Math.max(e.length*3,3));const r=new It;r.setAttribute("position",new vt(this.pointPositions,3));const n=new lc({color:t,size:11,sizeAttenuation:!1,depthTest:!1,depthWrite:!1,toneMapped:!1});this.points=new wo(r,n),this.points.frustumCulled=!1,this.points.renderOrder=1002,this.add(this.points),this.name="__object3d_document_bone_selection",to(this,"editorHelper",!0),this.traverse(a=>a.layers.set(K)),this.update()}segments=[];linePositions;pointPositions;lines;lineMaterial;points;worldPosition=new v;setColor(e){this.lineMaterial.color.setHex(e),this.points.material.color.setHex(e)}update(){let e=0;for(const[s,r]of this.segments)s.getWorldPosition(this.worldPosition),this.linePositions.set(this.worldPosition.toArray(),e),r.getWorldPosition(this.worldPosition),this.linePositions.set(this.worldPosition.toArray(),e+3),e+=6;const t=this.lines.geometry.getAttribute("instanceStart");t&&(t.data.needsUpdate=!0),e=0;for(const s of this.bones)s.getWorldPosition(this.worldPosition),this.pointPositions.set(this.worldPosition.toArray(),e),e+=3;const i=this.points.geometry.getAttribute("position");i&&(i.needsUpdate=!0)}dispose(){this.lines.geometry.dispose(),this.lineMaterial.dispose(),this.points.geometry.dispose(),this.points.material.dispose()}addSegment(e,t,i){const s=`${e.uuid}:${t.uuid}`;i.has(s)||(i.add(s),this.segments.push([e,t]))}}const Am="skeletons",qn=new U(58879),Yn=new U(16756736);function zm(o){const e=o.geometry.getAttribute("color");for(let i=0;i<e.count;i+=2)e.setXYZ(i,qn.r,qn.g,qn.b),i+1<e.count&&e.setXYZ(i+1,Yn.r,Yn.g,Yn.b);e.needsUpdate=!0,o.renderOrder=999;const t=o.material;t.depthTest=!1,t.depthWrite=!1,t.toneMapped=!1,to(o,"editorHelper",!0),to(o,"editorHelperType",Am),o.traverse(i=>i.layers.set(K))}const Ml=o=>!$s(o),Em=1,Om=700,Tm=.001,km=Math.PI-.001,Rm=o=>o<.5?4*o*o*o:1-(-2*o+2)**3/2,Im=o=>o;function Ii(o,e){return typeof o=="number"&&Number.isFinite(o)?o:e}const Cl={mode:"solid",background:"neutral",projection:"perspective",skeleton:!1,bounds:!1},Pl=1119773;class Lm{constructor(e,t,i,s,r,n,a=new U(2106410),l=null){this.documentId=e,this.root=t,this.scene=i,this.renderer=s,this.viewport=r,this.authoring=n,this.neutralBackground=a,this.frameBox=l,this.unsubscribeSelectionTheme=Kr(s.domElement,this.syncSelectionTheme),r.orbitControls.addEventListener("start",this.cancelLookForHuman),this.unsubscribeRotateStart=r.onRotateStart(this.autoPerspective),this.unsubscribeAxisView=r.onAxisView(this.axisView)}profiler=mh();shading=new bd;depthDrawMaterials=new Ou;helpers=[];skeletonHelper=null;boundsHelper=null;boneSelectionHighlight=null;boneSelectionSignature="";composer=null;displayTransform=null;displayTarget=null;setDisplayTransform(e){this.displayTransform!==e&&(this.displayTransform=e,e||(this.displayTarget?.dispose(),this.displayTarget=null),$())}materialDisplayTransform(){return this.state.mode==="rendered"||this.state.mode==="preview"?this.displayTransform:null}composerLoading=!1;disposed=!1;sceneRenderPass=null;selectionOutline=null;selectionOutlinePass=null;selectedObjects=[];selectionOrigins=null;renderWidth=1;renderHeight=1;orthographicCamera=new Ui;captureAspect=null;cameraOverride=null;cameraViewSource=null;through=null;leaving=!1;viewMemo=null;throughPerspective=new bo;throughOrthographic=new Ui;beforeRender=null;state=Cl;version=0;listeners=new Set;unsubscribeSelectionTheme=()=>{};flight=null;flightPose=new v;topologyOverlay=null;topologyFollowers=[];unsubscribeRotateStart;unsubscribeAxisView;axisView=()=>(this.leaveCameraView(!1),this.settleFlight("superseded"),Ke().autoPerspective&&this.setProjection("orthographic"),!0);autoPerspective=()=>{if(!Ke().autoPerspective||this.cameraView()!==null||this.state.projection!=="orthographic")return;const e=this.viewport.camera,t=e.position.clone().sub(this.viewport.orbitControls.target),i=new v(0,1,0).applyQuaternion(e.quaternion);ji(t,i)!==null&&this.setProjection("perspective")};replaceContent(e,t){$(),this.selectionOutline?.selection.clear(),this.selectedObjects=[],this.boneSelectionSignature="",this.clearBoneSelectionHighlight(),this.clearSkeletonHelper(),this.clearBoundsHelper(),this.clearTopologyOverlay(),this.root=e,this.authoring=t,this.state.mode==="wireframe"&&this.buildTopologyOverlay(),this.state.bounds&&(this.boundsHelper=new Va(e,16757844),this.addHelper(this.boundsHelper,"bounds")),this.syncSelectionPresentation(),this.refreshSkeletonHelper(),this.notify()}cancelLookForHuman=()=>{this.settleFlight("human")};selectionColors=null;syncSelectionTheme=()=>{this.selectionColors=et(this.renderer.domElement);const e=this.selectionColors.visible;this.selectionOutline&&Uf(this.selectionOutline,et(this.renderer.domElement)),this.boneSelectionHighlight?.setColor(e)};subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));getSnapshot=()=>this.version;presentation(){return this.state}resolveFrameBounds(e="selection"){const t=e==="all"?[]:this.authoring?.selection?.get()??[];if(t.length>0){const i=new St;let s=!1;for(const r of t){const n=this.authoring?pi(this.authoring.hierarchy,r):null;if(!n)continue;const a=mi(n);a.isEmpty()||(i.union(a),s=!0)}if(s)return i}return this.frameBox&&!this.frameBox.isEmpty()?this.frameBox:mi(this.root)}frame(e=1,t="selection"){this.leaveCameraView(!1);const i=this.resolveFrameBounds(t);if(i.isEmpty()){let l=0,c=0;return this.root.traverse(h=>{const d=h.geometry;d&&(l+=1,c+=d.getAttribute("position")?.count??0)}),Fi.warn(`frame: nothing to frame — root "${this.root.name}" (${this.root.children.length} children, ${l} meshes, ${c} positions), selection ${JSON.stringify(this.authoring?.selection?.get()??[])}, frameBox ${this.frameBox?this.frameBox.isEmpty()?"empty":"set":"none"}`,"document"),!1}this.settleFlight("superseded");const s=i.getCenter(new v),r=this.viewport.camera.position.clone().sub(this.viewport.orbitControls.target).normalize();r.lengthSq()===0&&r.set(.8,.5,-1).normalize();const n=Math.min(10,Math.max(.1,Ii(e,1))),a=yi(i,this.viewport.camera,r)*n;return this.viewport.setPose(s.clone().addScaledVector(r,a),s),!0}orbit(e){return this.launchFlight(Ii(e.azimuth,0),Ii(e.elevation,0),Math.min(60,Math.max(0,Ii(e.duration,.6))),Rm)}turntable(e){const t=Ii(e.revolutions,1);return this.launchFlight(t*Math.PI*2,0,Math.min(60,Math.max(0,Ii(e.seconds,6))),Im)}looking(){return this.flight!==null}launchFlight(e,t,i,s){this.settleFlight("superseded");const r=this.viewport.camera,n=this.viewport.orbitControls.target.clone(),a=new cu().setFromVector3(r.position.clone().sub(n)),l=a.radius>1e-4?a.radius:Math.max(this.resolveFrameBounds().getSize(new v).length(),1),c={pivot:n,radius:l,startTheta:a.theta,startPhi:a.phi,deltaTheta:e,deltaPhi:-t,duration:i,ease:s,elapsed:0,theta:a.theta,phi:a.phi,settle:null};this.flight=c;const h=new Promise(d=>{c.settle=d});return this.applyFlightPose(c,0),i<=0&&this.settleFlight(null),h}applyFlightPose(e,t){const i=e.ease(t);e.theta=e.startTheta+e.deltaTheta*i,e.phi=Math.min(km,Math.max(Tm,e.startPhi+e.deltaPhi*i));const s=this.viewport.camera;s.position.setFromSphericalCoords(e.radius,e.phi,e.theta).add(e.pivot),this.viewport.orbitControls.target.copy(e.pivot),s.lookAt(e.pivot),s.updateMatrixWorld(),this.flightPose.copy(s.position)}advanceLook(e){const t=this.flight;if(!t)return;const i=Math.max(1e-4,t.radius*.001);if(this.viewport.camera.position.distanceToSquared(this.flightPose)>i*i){this.settleFlight("human");return}e>0&&Number.isFinite(e)&&(t.elapsed+=e);const s=t.duration<=0?1:Math.min(1,t.elapsed/t.duration);this.applyFlightPose(t,s),s>=1&&this.settleFlight(null)}settleFlight(e){const t=this.flight;if(!t)return;this.flight=null;const i={completed:e===null,azimuth:t.theta,elevation:Math.PI/2-t.phi,seconds:Math.min(t.elapsed,t.duration)};t.settle?.(e===null?i:{...i,cancelledBy:e})}select(e){$(),this.authoring&&fs(this.authoring,[...e])}selection(){return[...this.authoring?.selection?.get()??[]]}idForObject(e){return this.authoring?.hierarchy.idForObject3D?.(e)??null}syncSelectionPresentation(){$();const e=(this.authoring?.selection?.get()??[]).map(s=>this.authoring?pi(this.authoring.hierarchy,s):null).filter(s=>s!==null);if(this.selectedObjects=e,this.selectionOutline&&(gl(this.selectionOutline,this.selectionOutlineWanted?e:[]),this.syncComposerOutput()),this.selectionOrigins){const s=et(this.renderer.domElement);this.selectionOrigins.update(e,{visible:s.visible,...s.active?{active:s.active.visible}:{}})}const t=e.filter(s=>!!s.isBone),i=t.map(s=>s.uuid).join("\0");i!==this.boneSelectionSignature&&(this.boneSelectionSignature=i,this.clearBoneSelectionHighlight(),t.length>0&&(this.boneSelectionHighlight=new Pm(t,et(this.renderer.domElement).visible),this.scene.add(this.boneSelectionHighlight)),this.refreshSkeletonHelper())}frameSelection(){return this.frameIds(this.authoring?.selection?.get()??[])}frameIds(e){this.leaveCameraView(!1),this.settleFlight("superseded");const t=e.map(i=>this.authoring?pi(this.authoring.hierarchy,i):null).filter(i=>i!==null);return t.length===0?!1:t.every(i=>i.isBone)?(this.frameBones(t),!0):(this.viewport.focusOnMultiple(t),!0)}setViewPreset(e,t="bounds"){$(),this.leaveCameraView(!1),this.settleFlight("superseded");const i=wu(e);let s,r;if(t==="view")s=this.viewport.orbitControls.target.clone(),r=this.viewport.camera.position.distanceTo(s);else{const l=this.resolveFrameBounds();if(l.isEmpty())return;s=l.getCenter(new v),r=yi(l,this.viewport.camera,i)}const n=s.clone().addScaledVector(i,r),a=e==="top"?{x:0,y:0,z:-1}:e==="bottom"?{x:0,y:0,z:1}:{x:0,y:1,z:0};this.viewport.setPose(n,s,void 0,a),this.setProjection(e==="isometric"?"perspective":"orthographic")}setCameraPose(e,t,i){$(),this.leaveCameraView(!1),this.settleFlight("superseded"),i!==void 0&&Number.isFinite(i)&&i>0&&i<180&&Wl(this.documentId,{camera:{fov:{degrees:i,axis:"vertical"}}}),this.viewport.setPose(e,t,i)}cameraPose(){return{position:this.viewport.camera.position.toArray(),target:this.viewport.orbitControls.target.toArray(),fov:this.viewport.camera.fov}}camera(){if(this.cameraOverride)return this.cameraOverride;const e=this.drawnCamera();return this.viewport.setGizmoCamera(e===this.viewport.camera?null:e),e}drawnCamera(){const e=this.through?this.cameraView():null;return e?this.throughCamera(e):(this.through&&!this.leaving&&(this.leaving=!0,queueMicrotask(()=>{this.leaving=!1,this.through&&!this.cameraView()&&this.leaveCameraView(!1)})),this.state.projection==="perspective"?this.viewport.camera:(this.syncOrthographicCamera(),this.orthographicCamera))}setCameraViewSource(e){this.cameraViewSource!==e&&(this.cameraViewSource=e,e||this.leaveCameraView(!1),this.notify())}hasCameraView(){return this.cameraViewSource!==null}cameraView(){const e=this.through,t=this.cameraViewSource;if(!e||!t)return null;const i=this.renderer.domElement,s=this.captureAspect?{width:this.captureAspect,height:1}:{width:i.clientWidth,height:i.clientHeight},r=this.viewport.camera,n=e.locked?`${r.position.toArray().join(",")}|${r.quaternion.toArray().join(",")}`:"",a=`${e.camera}|${s.width}|${s.height}|${e.zoom}|${e.offset.join(",")}|${n}`;if(this.viewMemo?.key===a)return this.viewMemo.view;const l=t.view(e.camera,s,e.zoom,e.offset),c=l&&e.locked?{...l,position:r.position.toArray(),quaternion:r.quaternion.toArray()}:l;return this.viewMemo={key:a,view:c},queueMicrotask(()=>{this.viewMemo=null}),c}toggleCameraView(){if(this.through)return this.leaveCameraView(!0),!0;const e=this.cameraViewSource,t=e?.camera()??null;if(!e)return!1;if(t===null)return Fi.warn("camera view: No active camera — the scene has no camera to look through","document"),!1;$(),this.settleFlight("superseded");const i=this.viewport,s=i.orbitControls,r=s.enableDamping;return s.enableDamping=!1,s.update(),s.enableDamping=r,this.through={camera:t,zoom:e.zoom.opening,offset:[0,0],left:{position:i.camera.position.clone(),target:i.orbitControls.target.clone(),up:i.camera.up.clone(),projection:this.state.projection},release:this.captureCameraViewInput(),locked:!1},e.showing?.(t),this.notify(),!0}cameraViewLocked(){return!this.through||!this.cameraViewSource?.setPose?null:this.through.locked}toggleCameraViewLock(){const e=this.through,t=this.cameraViewSource;if(!(!e||!t?.setPose)){if(e.release(),e.locked=!e.locked,!e.locked)e.release=this.captureCameraViewInput();else{const i=this.cameraView(),s=this.viewport.orbitControls,r=this.viewport.camera;if(i){const y=new v(...i.position),_=new pe(...i.quaternion),w=e.left.position.distanceTo(e.left.target);r.up.set(0,1,0).applyQuaternion(_),r.position.copy(y),r.quaternion.copy(_),s.target.copy(y).addScaledVector(new v(0,0,-1).applyQuaternion(_),w),s.update()}const n=s.enabled;s.enabled=!0;const a=s.enableDamping;s.enableDamping=!1;const l=e.camera,c=y=>({position:r.position.toArray(),quaternion:r.quaternion.toArray(),final:y});let h=!1,d=null,p=!1;const u=y=>{if(h){d={...y,final:y.final||(d?.final??!1)};return}h=!0,d=null,Promise.resolve(t.setPose(l,y.position,y.quaternion,y.final)).catch(()=>{}).finally(()=>{h=!1,d&&u(d)})},f=()=>{p=!0,$(),this.notify(),u(c(!1))},m=()=>{p&&(p=!1,u(c(!0)))};s.addEventListener("change",f),s.addEventListener("end",m),e.release=()=>{m(),s.removeEventListener("change",f),s.removeEventListener("end",m),s.enabled=n,s.enableDamping=a}}this.viewMemo=null,$(),this.notify()}}cameraViewZoom(){return this.through?.zoom??null}setCameraViewZoom(e){const t=this.through,i=this.cameraViewSource;!t||!i||!Number.isFinite(e)||e<=0||(t.zoom=Math.min(i.zoom.max,Math.max(i.zoom.min,e)),$(),this.notify())}zoomCameraView(e){this.through&&this.setCameraViewZoom(this.through.zoom*e)}panCameraView(e,t){const i=this.through,s=this.cameraViewSource;if(!i||!s)return;const[r,n]=s.pan(i.offset,i.zoom,e,t);i.offset=[r,n],$(),this.notify()}leaveCameraView(e){const t=this.through;if(!t)return;const i=this.cameraView();t.release(),this.through=null,this.viewMemo=null,this.cameraViewSource?.showing?.(null),this.viewport.setGizmoCamera(null);const s=this.viewport;if(e)s.camera.position.copy(t.left.position),s.camera.up.copy(t.left.up),s.orbitControls.target.copy(t.left.target),this.state={...this.state,projection:t.left.projection};else if(i){const r=t.left.position.distanceTo(t.left.target),n=new v(...i.position),a=new pe(...i.quaternion),l=new v(0,0,-1).applyQuaternion(a);s.camera.up.set(0,1,0).applyQuaternion(a),s.camera.position.copy(n),s.orbitControls.target.copy(n).addScaledVector(l,r);const c=ji(t.left.position.clone().sub(t.left.target),t.left.up)!==null,h=Ke().autoPerspective&&c?"perspective":t.left.projection;this.state={...this.state,projection:h}}s.camera.lookAt(s.orbitControls.target),s.orbitControls.update(),$(),this.notify()}throughCamera(e){const{left:t,right:i,top:s,bottom:r}=e.window,n=this.viewport.camera.layers.mask;if(e.projection==="orthographic"){const l=this.throughOrthographic;return Object.assign(l,{left:t,right:i,top:s,bottom:r,near:e.near,far:e.far,zoom:1}),l.position.set(...e.position),l.quaternion.set(...e.quaternion),l.layers.mask=n,l.updateProjectionMatrix(),l.updateMatrixWorld(!0),l}const a=this.throughPerspective;return a.near=e.near,a.far=e.far,a.fov=Be.radToDeg(2*Math.atan((s-r)/2)),a.aspect=(i-t)/(s-r),a.zoom=1,a.position.set(...e.position),a.quaternion.set(...e.quaternion),a.layers.mask=n,a.projectionMatrix.makePerspective(t*e.near,i*e.near,s*e.near,r*e.near,e.near,e.far),a.projectionMatrixInverse.copy(a.projectionMatrix).invert(),a.updateMatrixWorld(!0),a}captureCameraViewInput(){const e=this.viewport.orbitControls,t=this.renderer.domElement,i=t.parentElement??t,s=e.enabled;e.enabled=!1;const r=a=>{a.target!==t||a.deltaY===0||(a.preventDefault(),this.zoomCameraView(a.deltaY<0?1.2:1/1.2))},n=a=>{if(a.target!==t)return;const l=e.mouseButtons;let c=[l.LEFT,l.MIDDLE,l.RIGHT][a.button]??null;const h=a.ctrlKey||a.metaKey||a.shiftKey;if(a.button===1&&(a.ctrlKey||a.metaKey)&&c===Ie.ROTATE?c=Ie.DOLLY:h&&c===Ie.ROTATE?c=Ie.PAN:h&&c===Ie.PAN&&(c=Ie.ROTATE),c===Ie.ROTATE){this.leaveCameraView(!1);return}if(c!==Ie.PAN&&c!==Ie.DOLLY)return;a.preventDefault();const d=t.getBoundingClientRect();let p=a.clientX,u=a.clientY;const f=this.through?.zoom??1,m=Math.max(5+a.clientY-d.top,1),y=w=>{if(c===Ie.PAN){this.panCameraView((w.clientX-p)/Math.max(d.width,1),(w.clientY-u)/Math.max(d.height,1)),p=w.clientX,u=w.clientY;return}const x=Math.max(.01,2*((5+w.clientY-d.top)/m-1)+1);this.setCameraViewZoom(f/x)},_=()=>{window.removeEventListener("pointermove",y),window.removeEventListener("pointerup",_),window.removeEventListener("pointercancel",_)};window.addEventListener("pointermove",y),window.addEventListener("pointerup",_),window.addEventListener("pointercancel",_)};return i.addEventListener("wheel",r,{capture:!0,passive:!1}),i.addEventListener("pointerdown",n,{capture:!0}),()=>{i.removeEventListener("wheel",r,{capture:!0}),i.removeEventListener("pointerdown",n,{capture:!0}),e.enabled=s}}projection(){return this.state.projection}setProjection(e){$(),this.state.projection!==e&&(this.state={...this.state,projection:e},this.notify())}setMode(e){if(e!=="uv"&&e!=="vertex-colors"&&!Sd.includes(e))throw new Error(`Unknown document shading mode "${e}".`);$(),this.state.mode!==e&&(this.clearDiagnosticPresentation(),this.state={...this.state,mode:e},e==="uv"?this.scene.overrideMaterial=new vs({vertexShader:"varying vec2 vUv; void main(){ vUv=uv; gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0); }",fragmentShader:"varying vec2 vUv; void main(){ gl_FragColor=vec4(vUv,0.0,1.0); }"}):e==="vertex-colors"?this.scene.overrideMaterial=new Le({vertexColors:!0}):e==="wireframe"&&this.buildTopologyOverlay(),this.notify())}buildTopologyOverlay(){const e=new je,t=[];this.root.updateMatrixWorld(!0),this.root.traverse(i=>{const s=i;if(!s.isMesh||!s.geometry)return;const r=new Vi(new So(s.geometry,Em),new $t({color:Pl,toneMapped:!1,transparent:!0,opacity:.85,depthTest:!1,depthWrite:!1}));r.matrixAutoUpdate=!1,r.matrixWorldAutoUpdate=!1,r.matrixWorld.copy(s.matrixWorld),r.frustumCulled=!1,r.renderOrder=2,e.add(r),t.push({line:r,source:s})}),t.length!==0&&(this.topologyOverlay=e,this.topologyFollowers=t,this.addHelper(e,"topology"))}syncTopologyOverlay(){this.topologyFollowers.some(({source:s})=>s.parent===null)&&(this.clearTopologyOverlay(),this.buildTopologyOverlay()),this.selectionColors??=et(this.renderer.domElement);const e=this.selectionColors,t=this.selectedObjects.at(-1)??null,i=(s,r)=>{for(let n=s;n;n=n.parent)if(n===r)return!0;return!1};for(const{line:s,source:r}of this.topologyFollowers){s.matrixWorld.copy(r.matrixWorld),s.visible=r.visible;const n=s.material,a=t!==null&&i(r,t),l=a||this.selectedObjects.some(h=>i(r,h)),c=a?e.active?.visible??e.visible:l?e.visible:null;n.color.setHex(c??Pl)}}clearTopologyOverlay(){for(const{line:i}of this.topologyFollowers.splice(0))i.geometry.dispose(),i.material.dispose();const e=this.topologyOverlay;if(this.topologyOverlay=null,!e)return;e.removeFromParent();const t=this.helpers.indexOf(e);t>=0&&this.helpers.splice(t,1)}setBounds(e){$(),this.state.bounds!==e&&(this.state={...this.state,bounds:e},e?(this.boundsHelper=new Va(this.root,16757844),this.addHelper(this.boundsHelper,"bounds")):this.clearBoundsHelper(),this.notify())}setSkeleton(e){$(),this.state.skeleton!==e&&(this.state={...this.state,skeleton:e},this.refreshSkeletonHelper(),this.notify())}neutralBackgroundTexture(){return this.neutralBackground}setNeutralBackground(e){$();const t=this.scene.background,i=this.neutralBackground,s=t===i||t instanceof U&&i instanceof U&&t.equals(i);this.neutralBackground=e,s&&(this.scene.background=e)}setBackground(e){$(),this.state.background!==e&&(this.scene.background=e==="transparent"?null:this.neutralBackground,this.state={...this.state,background:e},this.notify())}resetPresentation(){$(),gh(this.documentId),this.clearDiagnosticPresentation(),this.state=Cl,this.refreshSkeletonHelper(),this.clearBoundsHelper(),this.scene.background=this.neutralBackground,this.viewport.camera.up.set(0,1,0),this.frame(),this.notify()}setBeforeRender(e){this.beforeRender=e}presentedFrameWaiters=[];presentsFrames=!1;setPresentsFrames(e){this.presentsFrames=e,e||this.resolvePresentedFrame(null)}requestPresentedFrame(){return this.presentsFrames?new Promise(e=>{let t=!1;const i=s=>{t||(t=!0,e(s))};this.presentedFrameWaiters.push(i),$(),setTimeout(()=>i(null),Om)}):Promise.resolve(null)}needsFrame(){return this.flight!==null||this.presentedFrameWaiters.length>0}servePresentedFrame(){if(this.presentedFrameWaiters.length===0)return;const e=this.renderer.domElement,t=document.createElement("canvas");t.width=Math.max(1,e.width),t.height=Math.max(1,e.height);const i=t.getContext("2d");if(!i){this.resolvePresentedFrame(null);return}i.drawImage(e,0,0),this.resolvePresentedFrame(t)}resolvePresentedFrame(e){const t=this.presentedFrameWaiters;this.presentedFrameWaiters=[];for(const i of t)i(e)}render(e,t=!1){const i=this.beforeRender?.(t),s=this.depthDrawMaterials.bind(this.renderer);try{this.boneSelectionHighlight?.update();const r=this.camera(),n=this.state.mode;if(this.boundsHelper?.update(),this.selectionOrigins?.place(),n==="uv"||n==="vertex-colors"){e(r);return}if(n==="wireframe"&&this.topologyOverlay){if(this.syncTopologyOverlay(),this.xray.enabled&&this.xray.alpha<=0){const a=new Set;this.root.traverse(l=>{const c=l;if(c.isMesh)for(const h of Array.isArray(c.material)?c.material:[c.material])h?.visible&&(h.visible=!1,a.add(h))});try{e(r)}finally{for(const l of a)l.visible=!0}return}this.shading.render(this.scene,"clay",()=>e(r),Ml);return}this.shading.render(this.scene,n,()=>e(r),Ml)}finally{s(),i?.()}}renderViewport(e=0,t=!1){this.advanceLook(e),this.ensureComposer();const i=this.materialDisplayTransform();if(i){const s=this.renderer.getDrawingBufferSize(new Oe),r=this.displayTarget??=new Sn(s.x,s.y,{type:Mn,samples:4});r.setSize(s.x,s.y);const n=this.renderer.getRenderTarget();try{this.renderer.setRenderTarget(r),this.render(a=>this.renderLinearScene(a,r),t),i.render(this.renderer,r,n,!1)}finally{this.renderer.setRenderTarget(n)}return}this.render(s=>{const r=this.composer;if(!r){this.renderer.render(this.scene,s);return}r.setMainScene(this.scene),r.setMainCamera(s),r.render(e)},t)}resize(e,t){$(),this.renderWidth=Math.max(1,e),this.renderHeight=Math.max(1,t),this.composer?.setSize(this.renderWidth,this.renderHeight)}renderCapture(e,t){this.render(i=>{if(!t){e(i);return}const s=this.scene.background,r=this.renderer.getClearColor(new U),n=this.renderer.getClearAlpha();try{this.scene.background=null,this.renderer.setClearColor(0,0),e(i)}finally{this.scene.background=s,this.renderer.setClearColor(r,n)}})}captureImage(e=512){const t=typeof e=="number"?e:e.width,i=typeof e=="number"?e:e.height;if(!Number.isFinite(t)||t<1||!Number.isFinite(i)||i<1)return null;const s=Math.min(2048,Math.round(t)),r=Math.min(2048,Math.round(i)),n=s*2,a=r*2,l=new Sn(n,a,{type:Mn}),c=this.materialDisplayTransform(),h=new Sn(c?s:n,c?r:a);let d=null;const p=this.renderer.getRenderTarget(),u=this.viewport.camera,f=u.aspect;try{this.captureAspect=s/r;const m=typeof e=="number"?void 0:e.camera;m?this.cameraOverride=m:(u.aspect=s/r,u.updateProjectionMatrix()),this.renderer.setRenderTarget(l),this.renderCapture(z=>this.renderSolidForCapture(z,l,n,a),typeof e!="number"&&e.transparent===!0);const y=typeof e!="number"&&e.transparent===!0;c?(d=fu(this.renderer,l,s,r),c.render(this.renderer,d,h,y)):zd(y).render(this.renderer,h,l,0,!1);const _=h.width*4,w=new Uint8Array(_*h.height);this.renderer.readRenderTargetPixels(h,0,0,h.width,h.height,w);const x=document.createElement("canvas");x.width=h.width,x.height=h.height;const S=x.getContext("2d");if(!S)return null;const C=S.createImageData(h.width,h.height);for(let z=0;z<h.height;z++){const F=(h.height-1-z)*_,R=z*_;C.data.set(w.subarray(F,F+_),R)}S.putImageData(C,0,0);const b=document.createElement("canvas");b.width=s,b.height=r;const M=b.getContext("2d");return M?(M.drawImage(x,0,0,s,r),b.toDataURL("image/png")):null}finally{this.captureAspect=null,this.cameraOverride=null,u.aspect=f,u.updateProjectionMatrix(),this.renderer.setRenderTarget(p),h.dispose(),d?.dispose(),l.dispose(),$()}}dispose(){this.disposed=!0,this.leaveCameraView(!1),this.selectionOrigins?.dispose(),this.selectionOrigins=null,this.settleFlight("closed"),this.viewport.orbitControls.removeEventListener("start",this.cancelLookForHuman),this.unsubscribeRotateStart(),this.unsubscribeAxisView(),this.unsubscribeSelectionTheme(),this.clearDiagnosticPresentation(),this.clearBoneSelectionHighlight(),this.clearBoundsHelper(),this.clearSkeletonHelper(),this.selectionOutline&&Df(this.renderer,this.selectionOutline,this.selectionOutlinePass),this.composer?.dispose(),this.displayTarget?.dispose(),this.displayTarget=null,this.displayTransform=null,this.sceneRenderPass=null,this.selectionOutline=null,this.selectionOutlinePass=null,this.composer=null,this.shading.dispose(),this.depthDrawMaterials.dispose(),this.listeners.clear()}addHelper(e,t){e.name=`__object3d_document_${t}`,Ze(e,"editorHelper",!0),this.scene.add(e),this.helpers.push(e)}get selectionOutlineEnabled(){return this.selectionOutlineWanted}set selectionOutlineEnabled(e){e!==this.selectionOutlineWanted&&(this.selectionOutlineWanted=e,e?this.syncSelectionPresentation():(this.selectionOutline?.selection.clear(),this.syncComposerOutput()))}selectionOutlineWanted=!0;xray={enabled:!1,alpha:1};setXray(e){this.xray.enabled===e.enabled&&this.xray.alpha===e.alpha||(this.xray=e,$())}set selectionOriginsEnabled(e){e!==(this.selectionOrigins!==null)&&(e?(this.selectionOrigins=new Nm,this.scene.add(this.selectionOrigins),this.syncSelectionPresentation()):(this.selectionOrigins?.dispose(),this.selectionOrigins=null,$()))}ensureComposer(){this.selectionOutlineWanted&&(this.composer||this.composerLoading||this.disposed||(this.composerLoading=!0,wi(()=>import("./index-C8BwtQGN.js"),__vite__mapDeps([3,1])).then(e=>{if(this.composerLoading=!1,this.disposed||this.composer)return;const t=this.camera(),i=new e.EffectComposer(this.renderer,{frameBufferType:Mn});this.sceneRenderPass=new e.RenderPass(this.scene,t),i.addPass(this.sceneRenderPass),this.selectionOutline=Hf(e,this.renderer,this.scene,t,et(this.renderer.domElement)),this.syncSelectionTheme(),gl(this.selectionOutline,this.selectedObjects),this.selectionOutlinePass=new e.EffectPass(t,this.selectionOutline),i.addPass(this.selectionOutlinePass),this.composer=i,this.syncComposerOutput(),i.setSize(this.renderWidth,this.renderHeight),$()}).catch(()=>{this.composerLoading=!1})))}renderSolidForCapture(e,t,i,s){const r=this.composer,n=(this.selectionOutline?.selection.size??0)>0;if(!r||!n||!this.sceneRenderPass||!this.selectionOutlinePass){this.renderLinearScene(e,t);return}const a=this.renderer.getDrawingBufferSize(new Oe);try{this.resizeComposerBuffers(i,s),this.renderLinearScene(e,t)}finally{this.resizeComposerBuffers(a.x,a.y),this.syncComposerOutput(),this.renderer.setRenderTarget(t)}}resizeComposerBuffers(e,t){const i=this.composer;if(i){i.inputBuffer.setSize(e,t),i.outputBuffer.setSize(e,t);for(const s of i.passes)s.setSize(e,t)}}renderLinearScene(e,t){const i=this.composer,s=(this.selectionOutline?.selection.size??0)>0;if(!i||!s||!this.sceneRenderPass||!this.selectionOutlinePass){this.renderer.setRenderTarget(t),this.renderer.clear(!0,!0,!1),this.renderer.render(this.scene,e);return}try{i.setMainScene(this.scene),i.setMainCamera(e),this.sceneRenderPass.renderToScreen=!1,this.selectionOutlinePass.renderToScreen=!1,this.sceneRenderPass.render(this.renderer,i.inputBuffer,i.outputBuffer,0),this.selectionOutlinePass.render(this.renderer,i.inputBuffer,t,0)}finally{this.syncComposerOutput(),this.renderer.setRenderTarget(t)}}syncComposerOutput(){const e=(this.selectionOutline?.selection.size??0)>0;this.sceneRenderPass&&(this.sceneRenderPass.renderToScreen=!e),this.selectionOutlinePass&&(this.selectionOutlinePass.enabled=e,this.selectionOutlinePass.renderToScreen=e)}refreshSkeletonHelper(){const e=this.state.skeleton||this.boneSelectionHighlight!==null;e&&!this.skeletonHelper?(this.skeletonHelper=new hu(this.root),zm(this.skeletonHelper),this.scene.add(this.skeletonHelper)):e||this.clearSkeletonHelper()}clearSkeletonHelper(){this.skeletonHelper&&(this.skeletonHelper.removeFromParent(),this.skeletonHelper.dispose(),this.skeletonHelper=null)}clearBoneSelectionHighlight(){this.boneSelectionHighlight&&(this.boneSelectionHighlight.removeFromParent(),this.boneSelectionHighlight.dispose(),this.boneSelectionHighlight=null)}clearBoundsHelper(){if(!this.boundsHelper)return;const e=this.boundsHelper;this.boundsHelper=null;const t=this.helpers.indexOf(e);t>=0&&this.helpers.splice(t,1),e.removeFromParent(),e.geometry.dispose(),Array.isArray(e.material)?e.material.forEach(i=>{i.dispose()}):e.material.dispose()}frameBones(e){const t=new St,i=new v;for(const l of e){t.expandByPoint(l.getWorldPosition(i)),l.parent?.isBone&&t.expandByPoint(l.parent.getWorldPosition(i));for(const c of l.children)c.isBone&&t.expandByPoint(c.getWorldPosition(i))}const s=t.getCenter(new v),r=Math.max(t.getSize(new v).length(),.2);t.expandByScalar(r*.35);const n=this.viewport.camera.position.clone().sub(this.viewport.orbitControls.target).normalize(),a=yi(t,this.viewport.camera,n);this.viewport.setPose(s.clone().addScaledVector(n,a),s)}syncOrthographicCamera(){const e=this.viewport.camera,t=this.viewport.orbitControls.target,i=Math.max(e.position.distanceTo(t),.001),s=Math.max(i*Math.tan(Be.degToRad(e.fov)/2),.001),r=Math.max(this.renderer.domElement.clientWidth,1),n=Math.max(this.renderer.domElement.clientHeight,1),a=this.captureAspect??r/n;this.orthographicCamera.left=-s*a,this.orthographicCamera.right=s*a,this.orthographicCamera.top=s,this.orthographicCamera.bottom=-s,this.orthographicCamera.near=e.near,this.orthographicCamera.far=e.far,this.orthographicCamera.position.copy(e.position),this.orthographicCamera.quaternion.copy(e.quaternion),this.orthographicCamera.up.copy(e.up),this.orthographicCamera.layers.mask=e.layers.mask,this.orthographicCamera.updateProjectionMatrix(),this.orthographicCamera.updateMatrixWorld(!0)}clearDiagnosticPresentation(){this.clearTopologyOverlay(),this.scene.overrideMaterial?.dispose(),this.scene.overrideMaterial=null;for(const e of this.helpers.splice(0)){e.removeFromParent();const t=e;t.geometry?.dispose();const i=t.material;Array.isArray(i)?i.forEach(s=>{s.dispose()}):i?.dispose()}}notify(){this.version++;for(const e of this.listeners)e()}}const Bm=7;let ps=null;function Fm(){if(ps)return ps;const o=64,e=document.createElement("canvas");e.width=o,e.height=o;const t=e.getContext("2d");return t.beginPath(),t.arc(o/2,o/2,o/2-1,0,Math.PI*2),t.fillStyle="rgba(0, 0, 0, 0.75)",t.fill(),t.beginPath(),t.arc(o/2,o/2,o/2-8,0,Math.PI*2),t.fillStyle="#ffffff",t.fill(),ps=new Co(e),ps.colorSpace=wt,ps}class Nm extends wo{objects=[];origin=new v;constructor(){super(new It,new lc({map:Fm(),size:Bm,sizeAttenuation:!1,transparent:!0,alphaTest:.05,depthTest:!1,depthWrite:!1,toneMapped:!1})),this.name="volter:selection-origins",this.userData.editorHelper=!0,this.renderOrder=1e3,this.frustumCulled=!1,this.raycast=()=>{}}update(e,t){this.objects=e,this.material.color.setHex(e.length===1&&t.active!==void 0?t.active:t.visible),this.visible=e.length>0}place(){const e=this.objects.length;let t=this.geometry.getAttribute("position");(t===void 0||t.count<e)&&(this.geometry.dispose(),t=new vt(new Float32Array(Math.max(e,8)*3),3),this.geometry.setAttribute("position",t)),this.geometry.setDrawRange(0,e),this.objects.forEach((i,s)=>{i.getWorldPosition(this.origin),t.setXYZ(s,this.origin.x,this.origin.y,this.origin.z)}),t.needsUpdate=!0}dispose(){this.removeFromParent(),this.geometry.dispose(),this.material.dispose()}}class Hm{constructor(e){this.options=e}active=null;settling=!1;idleWaiters=new Set;begin(e){if(this.active||this.settling)return!1;try{const t=this.options.begin(e);return t?(this.active={pointerId:e.pointerId,gesture:t},!0):!1}catch(t){return this.options.reportError(t),!1}}update(e){if(!(!this.active||this.active.pointerId!==e.pointerId))try{this.active.gesture.update(e)}catch(t){this.cancelWithError(t)}}async commit(e){const t=this.take(e.pointerId);if(!t)return!1;this.settling=!0;try{return await t.commit(e),await this.options.persist(t.label),!0}catch(i){try{await t.cancel()}catch(s){return this.options.reportError({operationError:i,rollbackError:s}),!1}return this.options.reportError(i),!1}finally{this.settling=!1;for(const i of this.idleWaiters)i();this.idleWaiters.clear()}}async cancel(e){const t=this.take(e);if(!t)return!1;this.settling=!0;try{return await t.cancel(),!0}catch(i){return this.options.reportError(i),!1}finally{this.settling=!1;for(const i of this.idleWaiters)i();this.idleWaiters.clear()}}async settle(){this.active&&await this.cancel(),this.settling&&await new Promise(e=>this.idleWaiters.add(e))}hasActiveGesture(){return this.active!==null}take(e){if(!this.active||e!==void 0&&this.active.pointerId!==e)return null;const t=this.active.gesture;return this.active=null,t}async cancelWithError(e){const t=this.take();if(t){this.settling=!0;try{await t.cancel(),this.options.reportError(e)}catch(i){this.options.reportError({operationError:e,rollbackError:i})}finally{this.settling=!1;for(const i of this.idleWaiters)i();this.idleWaiters.clear()}}}}function Zt(o){const e=Ee(o,"authoringSubject");return e&&typeof e.label=="string"&&typeof e.kind=="string"?e:null}function Al(o){return o.depthWrite===!1&&o.side===du}function Dm(o){const e=o.material;return e?Array.isArray(e)?e.length>0&&e.every(Al):Al(e):!1}function Ac(o,e,t,i=()=>!1,s){const r=Zp();if(!r)return[];const n=r.canvas.getBoundingClientRect();if(n.width<=0||n.height<=0||!Number.isFinite(e)||!Number.isFinite(t)||e<n.left||t<n.top||e>=n.left+n.width||t>=n.top+n.height)return[];const a=new Oe((e-n.left)/n.width*2-1,-((t-n.top)/n.height)*2+1),l=new lt;l.layers.enableAll(),l.setFromCamera(a,r.camera);const c=new Set(s?.objects??o.objectMap.values()),h=[...c].filter(f=>{for(let m=f.parent;m;m=m.parent)if(c.has(m))return!1;return!0});for(const f of h)f.traverse(m=>{const y=m;y.isSkinnedMesh&&(y.boundingBox=null,y.boundingSphere=null)});const d=l.intersectObjects(h,!0),p=[],u=new Set;for(const f of d){if(at(f.object)||Dm(f.object))continue;let m=f.object,y=null;if(s)for(;m&&y===null;)y=s.idForObject3D(m),m=m.parent;else{const _=Md(m);y=_?yo(_)??null:null}y!==null&&!i(y)&&!u.has(y)&&(u.add(y),p.push(y))}return Vm(p,h,d.length,e,t),p}function Vm(o,e,t,i,s){o.length>0||i===0&&s===0||console.info(`[viewport-pick] click selected nothing (candidates ${e.length}, rayHits ${t}, resolvedIds 0)`)}function Um(o,e,t,i=()=>!1,s){return Ac(o,e,t,i,s)[0]??null}const zl={count:0,meshes:0,lights:0,instancedMeshes:0,instances:0};let El=0;function jm(o){let e=0,t=0;for(const i of o.values()){const s=i.object;s.isInstancedMesh&&(e++,t+=typeof s.count=="number"?s.count:0)}return{instancedMeshes:e,instances:t}}function zc(o){let e=0,t=0;for(const i of o.values()){const s=i.object;s.isLight?t++:s.isMesh&&e++}return{count:o.size,meshes:e,lights:t,...jm(o)}}function Gm(o,e){const t=new Map,i=[],s=e.skip??$s;e.begin?.(o);const r=(n,a,l,c)=>{if(s(n))return;const h=e.identify(n,{path:a,ownerId:l,ownedByAncestor:c});h!==null&&(Jl(n,h),t.set(h,{object:n,id:h,parentId:l,childIds:[]}),l===null?i.push(h):t.get(l)?.childIds.push(h));const d=c||h!==null;n.children.forEach((p,u)=>{r(p,[...a,u],h??l,d)}),e.leave?.(n,h)};return o.children.forEach((n,a)=>{r(n,[a],null,!1)}),{nodes:t,rootIds:i,stats:zc(t)}}const Wm="r3f:";function Xm(o,e){return`${Wm}${o}:${e}`}function qm(o){return{project:e=>Gm(e,{skip:t=>!!Ee(t,"editorHelper")||t.isSkeletonHelper===!0,identify:(t,i)=>`source-object:${o}:${i.path.join(".")}`})}}function Ym(o){const e=Zt(o);return e?e.kind:Wr(o).length>0?"constraint-owner":ys(o)?"reflection-probe":o.isSkinnedMesh?"skinned-mesh":o.isBone?"bone":o.isLight?"light":o.isCamera?"camera":o.type==="Audio"||o.type==="PositionalAudio"||o.type==="AudioListener"?"audio":o.isMesh?"mesh":o.children.length>0?"group":"object"}function Jm(o,e){for(let t=o.parent;t!==null;t=t.parent)if(t===e)return!0;return!1}function Ol(o,e){if(o===e)return!0;for(let t=o.parent;t!==null;t=t.parent)if(t===e)return!0;return!1}class Zm{constructor(e,t={}){this.identity=e,this.options=t}nodesById=new Map;objectsById=new Map;idsByObjectIndex=new Map;roots=[];walkStats=zl;project(e){if(!e)return this.nodesById=new Map,this.objectsById=new Map,this.idsByObjectIndex=new Map,this.roots=[],this.walkStats=zl,this.walkStats;const{nodes:t,rootIds:i,stats:s}=this.identity.project(e);return this.nodesById=t,this.objectsById=new Map([...t].map(([r,n])=>[r,n.object])),this.idsByObjectIndex=new Map([...t].map(([r,n])=>[n.object,r])),this.roots=i,this.walkStats=s,s}projectSubtrees(e,t){const i=this.identity.incremental;if(e===null||i?.kind!=="live-oid")return null;const s=t.filter((_,w)=>t.indexOf(_)===w&&!t.some(x=>x!==_&&Jm(_,x))),r=this.roots,n=new Set,a=new Set,l=new Set;for(const _ of s)_.traverse(w=>{const x=this.idsByObjectIndex.get(w);if(x===void 0)return;const S=this.nodesById.get(x);S?.parentId!==null&&S?.parentId!==void 0&&l.add(S.parentId),n.add(x),this.nodesById.delete(x),this.objectsById.delete(x),this.idsByObjectIndex.delete(w)});const c=$s,h=(_,w)=>{const x=this.objectsById.get(_);return x===void 0||x===w},d=(_,w)=>{const x=yo(_);if(x!==void 0&&h(x,_))return x;const S=Cd(_);if(S!==void 0){const C=Xm(i.worldId,S);let b=0,M=Na(C,b);for(;!h(M,_);)M=Na(C,++b);return M}if(!w||Ee(_,"authoringRoot")===!0){let C=`live:${i.worldId}:${El++}`;for(;!h(C,_);)C=`live:${i.worldId}:${El++}`;return C}return null},p=(_,w,x)=>{if(c(_))return;const S=d(_,x);S!==null&&(Jl(_,S),this.nodesById.set(S,{object:_,id:S,parentId:w,childIds:[]}),this.objectsById.set(S,_),this.idsByObjectIndex.set(_,S),a.add(S),w!==null&&l.add(w));const C=S??w,b=x||S!==null;for(const M of _.children)p(M,C,b)};for(const _ of s){if(!Ol(_,e))continue;let w=_.parent,x=null;for(;w!==null&&w!==e;){const S=this.idsByObjectIndex.get(w);if(S!==void 0){x=S;break}w=w.parent}p(_,x,x!==null)}const u=_=>{const w=[],x=S=>{if(c(S))return;const C=this.idsByObjectIndex.get(S);if(C!==void 0){w.push(C);return}for(const b of S.children)x(b)};for(const S of _.children)x(S);return w};for(const _ of l){const w=this.nodesById.get(_);w!==void 0&&w.childIds.splice(0,w.childIds.length,...u(w.object))}for(const _ of a){const w=this.nodesById.get(_);w!==void 0&&w.childIds.splice(0,w.childIds.length,...u(w.object))}const f=u(e),m=this.roots.filter(_=>{const w=this.objectsById.get(_);return w!==void 0&&!Ol(w,e)&&!n.has(_)});this.roots=[...f,...m],this.walkStats=zc(this.nodesById);const y=r.length!==this.roots.length||r.some((_,w)=>_!==this.roots[w]);return{removedIds:n,addedIds:a,changedParentIds:l,rootsChanged:y}}get nodes(){return this.nodesById}get objects(){return this.objectsById}get idsByObject(){return this.idsByObjectIndex}get rootIds(){return this.roots}get stats(){return this.walkStats}node(e){return this.nodesById.get(e)??null}rootNodes(){return this.roots.map(e=>this.nodesById.get(e)).filter(e=>e!==void 0)}objectOf(e){return this.objectsById.get(e)??null}idOf(e){return this.idsByObjectIndex.get(e)??null}childIdsOf(e){const t=[];for(const i of e){const s=this.idsByObjectIndex.get(i);s!==void 0&&t.push(s)}return t}objectMapSnapshot(){return new Map(this.objectsById)}pick(e,t,i,s){return Um(e,t,i,s,this.pickProjection())}candidates(e,t,i,s){return Ac(e,t,i,s,this.pickProjection())}pickProjection(){if(this.options.pickScope!=="store-object-map")return{objects:this.objectsById.values(),idForObject3D:e=>this.idOf(e)}}}const Tl=new v,kl=new pe,Rl=new v;function Qm(o){return o.matrixAutoUpdate===!1?(o.matrix.decompose(Tl,kl,Rl),{position:Tl.toArray(),quaternion:kl.toArray(),scale:Rl.toArray()}):{position:o.position.toArray(),quaternion:o.quaternion.toArray(),scale:o.scale.toArray()}}function $m(o,e){return o.length===e.length&&o.every((t,i)=>t===e[i])}class Km{constructor(e){this.options=e,this.selected=[...e.initial]}adopted=[];selected;current(){const e=[...this.options.store.selectedEntityIds].filter(this.options.owns);return $m(e,this.adopted)||(this.adopted=e,this.selected=e,this.options.onChange?.(e)),[...this.selected]}publish(e){this.selected=[...e];const t=this.selected.filter(this.options.owns);this.adopted=t,this.options.onChange?.(t),this.options.store.selectMultiple(t)}}function eg(o){if(!o)return{position:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1]};const e=Qm(o);return{position:e.position,rotation:e.quaternion,scale:e.scale}}function Jn(o){return o.type==="Object3D"&&o.name===""&&Zt(o)===null&&o.userData.oid===void 0&&Ee(o,"authoringInstance")===void 0&&Ee(o,"authoringRoot")!==!0&&Ee(o,"volterComponentRoot")===void 0}class tg{constructor(e){this.options=e,this.rootIdSet=new Set(e.rootIds)}rootIdSet;childObjects(e){return e.children.flatMap(t=>$s(t)?[]:Jn(t)?this.childObjects(t):[t])}childIds(e){return this.options.projector.childIdsOf(this.childObjects(e))}rootObjects(){return this.options.rootIds.flatMap(e=>{const t=this.options.projector.objectOf(e);return t?Jn(t)?this.childObjects(t):[t]:[]})}rootIds(){return this.options.projector.childIdsOf(this.rootObjects())}parentId(e){const{projector:t,scene:i,documentNodeId:s}=this.options,r=t.idOf(e);if(r!==null&&this.rootIdSet.has(r))return s;let n=e.parent;for(;n&&n!==i&&Jn(n);)n=n.parent;return n&&n!==i?t.idOf(n)??s:s}node(e){const t=Zt(e);return{id:this.options.projector.idOf(e),label:t?.label||e.name||e.type||"Object3D",role:"entity",kind:Ym(e),...t?.typeLabel?{typeLabel:t.typeLabel}:{},parentId:this.parentId(e),childIds:this.childIds(e)}}}const Il=new WeakMap;function ig(o){let e=!1;if(o.traverse(s=>{Ee(s,"gaussianSplat")&&(e=!0)}),e)return"Gaussian splat";const t=xu(o),i=bu(o);return{static:"Static model",animated:"Animated model",rigged:"Rigged model",skinned:"Skinned model"}[Su(t,i)]}function Ll(o){const e=o.material;return Array.isArray(e)?e[0]??null:e??null}function Bl(o){return o?.color??null}class Fo{constructor(e,t,i){if(this.store=e,this.scene=t,this.options=i,this.provenance=i.provenance??(i.documentKind==="asset"?{source:"document",label:"derived asset",detail:"Loaded from an ordinary project asset. Edit its source or import recipe."}:{source:"source-code",label:"source",detail:"Instantiated from project TypeScript. Edit source or exposed parameters, then rebuild."}),this.documentNodeId=`object3d-document:${i.documentId}`,this.projector=new Zm(qm(i.documentId)),this.indexGraph(),i.hierarchyRoots&&new Set(i.hierarchyRoots).size!==i.hierarchyRoots.length)throw new Error(`Object3D document "${i.title}" declared the same hierarchy root twice.`);const s=new Set(i.hierarchyRoots??[]);for(const r of s){let n=r.parent;for(;n&&n!==t;){if(s.has(n))throw new Error(`Object3D document "${i.title}" declared nested hierarchy roots; roots must be non-overlapping.`);n=n.parent}}this.hierarchyRootIds=i.hierarchyRoots?i.hierarchyRoots.map(r=>{const n=this.idByObject.get(r);if(!n)throw new Error(`Object3D document "${i.title}" declared a hierarchy root outside its native graph.`);return n}):[...this.projector.rootIds],this.view=new tg({projector:this.projector,scene:t,documentNodeId:this.documentNodeId,rootIds:this.hierarchyRootIds}),this.selectionState=new Km({store:e.shell,owns:r=>this.byId.has(r),initial:[this.documentNodeId],onChange:r=>this.syncMarkedSelection(r)})}documentNodeId;projector;hierarchyRootIds;view;selectionState;markedSelection=new Set;capabilities={transform:!1,inspectorFields:!0,persist:!1};provenance;disposed=!1;dispose(){if(!this.disposed){this.disposed=!0;for(const e of this.watchedForStructure)e.removeEventListener("childadded",this.onStructureChanged),e.removeEventListener("childremoved",this.onStructureChanged);this.watchedForStructure=[]}}watchedForStructure=[];structureReindexQueued=!1;onStructureChanged=e=>{$s(e.child)||this.scheduleStructureReindex()};indexGraph(){this.projector.project(this.scene),this.watchStructure()}watchStructure(){const e=i=>i;for(const i of this.watchedForStructure)e(i).removeEventListener("childadded",this.onStructureChanged),e(i).removeEventListener("childremoved",this.onStructureChanged);this.watchedForStructure=[];const t=i=>{e(i).addEventListener("childadded",this.onStructureChanged),e(i).addEventListener("childremoved",this.onStructureChanged),this.watchedForStructure.push(i)};t(this.scene);for(const[,i]of this.byId)t(i)}scheduleStructureReindex(){this.disposed||this.structureReindexQueued||(this.structureReindexQueued=!0,queueMicrotask(()=>{if(this.structureReindexQueued=!1,this.disposed||(this.indexGraph(),this.store.scene!==this.scene))return;const e=this.store.objectMap;e.clear();for(const[i,s]of this.byId)e.set(i,s);const t=[...this.store.shell.selectedEntityIds].filter(i=>i===this.documentNodeId||this.byId.has(i));t.length!==this.store.shell.selectedEntityIds.size&&this.store.shell.selectMultiple(t),this.store.notifyIngestObjectMapEdit()}))}get byId(){return this.projector.objects}get idByObject(){return this.projector.idsByObject}documentTypeLabel(){if(this.options.documentKind!=="asset")return;const e=this.scene.children.find(s=>this.idByObject.has(s))??null;if(!e)return;const t=Il.get(e);if(t!==void 0)return t;const i=ig(e);return Il.set(e,i),i}hierarchy={roots:()=>[this.hierarchy.node(this.documentNodeId)],node:e=>{if(e===this.documentNodeId){const i=this.documentTypeLabel();return{id:e,label:this.options.title,secondaryLabel:this.options.sourcePath,role:"document",kind:this.options.documentKind==="asset"?"model-asset":"three-source",...i?{typeLabel:i}:{},parentId:null,childIds:this.view.rootIds()}}const t=this.byId.get(e);return t?this.view.node(t):null},object3D:e=>this.byId.get(e)??null,idForObject3D:e=>this.idByObject.get(e)??null};selection={get:()=>this.selectionState.current(),set:e=>this.selectionState.publish(e.filter(t=>t===this.documentNodeId||this.byId.has(t)))};static READ_ONLY_REASON="This document shows what the module builds; its properties are read-only here. Edit the module.";readOnly=()=>({writable:!1,reason:Fo.READ_ONLY_REASON});transforms={get:e=>eg(this.byId.get(e)??null),beginEdit:()=>{},apply:()=>{},endEdit:()=>{}};inspector={properties:e=>{if(e===this.documentNodeId)return this.options.audit===!1?[]:[{path:"name",label:"Name",type:"string",readonly:!0},{path:"source.path",label:"Source",type:"string",readonly:!0}];const t=this.byId.get(e);if(!t)return[];const i=Zt(t);if(i?.fields)return i.fields().map(({value:l,...c})=>c);const s=[{path:"name",label:"Name",type:"string",readonly:!0},{path:"visible",label:"Visible",type:"boolean",readonly:!0},{path:"object.type",label:"Native type",type:"string",readonly:!0}],r=t;if(r.isMesh&&r.geometry){const l=r.geometry.getAttribute("position");s.push({path:"mesh.vertices",label:"Vertices",type:"number",readonly:!0,group:"Mesh"}),l&&s.push({path:"mesh.triangles",label:"Triangles",type:"number",readonly:!0,group:"Mesh"})}const n=Ll(t);n&&(s.push({path:"material.type",label:"Material",type:"string",readonly:!0,group:"Material"}),Bl(n)&&s.push({path:"material.color",label:"Color",type:"color",readonly:!0,group:"Material"}));const a=t;return a.isSkinnedMesh&&a.skeleton&&s.push({path:"skin.bones",label:"Bones",type:"number",readonly:!0,group:"Skin"}),s},get:(e,t)=>{if(e===this.documentNodeId)return t==="name"?this.options.title:t==="source.path"?this.options.sourcePath:void 0;const i=this.byId.get(e);if(!i)return;const r=Zt(i)?.fields?.().find(l=>l.path===t);if(r)return r.value();if(t==="name")return i.name||i.type;if(t==="visible")return i.visible;if(t==="object.type")return i.type;const n=i;if(t==="mesh.vertices")return n.geometry?.getAttribute("position")?.count??0;if(t==="mesh.triangles"){const l=n.geometry;return(l?.index?.count??l?.getAttribute("position")?.count??0)/3}const a=Ll(i);if(t==="material.type")return a?.type;if(t==="material.color"){const l=Bl(a);return l?`#${l.getHexString()}`:void 0}if(t==="skin.bones")return i.skeleton?.bones.length??0},set:()=>{},editability:()=>this.readOnly()};subscribe(e){return this.store.shell.subscribe(e)}get documentId(){return this.documentNodeId}get documentRootObject(){const e=this.hierarchy.node(this.documentNodeId)?.childIds[0];return e?this.byId.get(e)??null:null}syncMarkedSelection(e){const t=new Set(e.map(i=>this.byId.get(i)??null).filter(i=>i!==null).filter(i=>Zt(i)?.selectionChanged!==void 0));for(const i of this.markedSelection)t.has(i)||Zt(i)?.selectionChanged?.(!1);for(const i of t)this.markedSelection.has(i)||Zt(i)?.selectionChanged?.(!0);this.markedSelection=t}}const sg=new Set(["solid","clay","unlit","wireframe","normals","overdraw"]);function rg(o,e){return{read:()=>{const t=o.cameraPose;if(!t)return null;const{position:i,target:s}=t;return{camera:{position:{x:i.x,y:i.y,z:i.z},target:{x:s.x,y:s.y,z:s.z},...t.fov?{fov:t.fov}:{}},diagnostic:o.shadingMode,grid:yh(e)}},setDiagnostic:t=>sg.has(t)?(o.setShadingMode(t),!0):!1,setCamera:t=>typeof t!="string"?(o.shell.setCameraPose(t.position,t.target,t.fov),!0):t==="isometric"?!1:(o.shell.setViewPreset(t),!0),frame:t=>t==="document"?!1:(o.shell.focusOnSelection(),!0)}}function ng(o){const e=Kn();return e?_h(Xl(e.shell,o)):"none"}const og=k.lazy(()=>wi(()=>import("./stage-transform-tools-B3kiH81y.js"),__vite__mapDeps([4,5,6,2,1,7,8,9,10,11,12,13])).then(o=>({default:o.ThreeStageTransformTools}))),ag=k.lazy(()=>wi(()=>import("./stage-transform-tools-B3kiH81y.js"),__vite__mapDeps([4,5,6,2,1,7,8,9,10,11,12,13])).then(o=>({default:o.ThreeStageTransformControls})));function Fl(o){return{transformTools:()=>ng(o),TransformTools:og,TransformControls:ag}}const lg=k.lazy(async()=>({default:(await wi(()=>import("./stage-overlay-set-B8PO_8GO.js"),__vite__mapDeps([14,5,8,15,6,2,1,7,9,10,11,12,13]))).StageOverlaySet}));function cg(o){return E.jsx(k.Suspense,{fallback:null,children:E.jsx(lg,{...o})})}function Nl(o,e,t){if(e==="orthographic"){const i=ji(o.camera.position.clone().sub(o.orbitControls.target),new v(0,1,0).applyQuaternion(o.camera.quaternion));return i!==null?i:t==="short"?"Iso":"Orthographic"}return t==="short"?"Persp":"Perspective"}const hg=()=>()=>{},Hl=()=>0;function dg({shell:o,documentId:e,label:t,kebab:i=!1}){const s=k.useSyncExternalStore(vh,Ma,Ma);k.useSyncExternalStore(mu,gu);const r=e?yu(e):null;k.useSyncExternalStore(r?.subscribe??hg,r?.getSnapshot??Hl,r?.getSnapshot??Hl);const n=r?r.projection():s.projection,a=p=>{r?r.setProjection(p):Aa(p)},[l,c]=k.useState(!1),h=k.useRef(null);k.useEffect(()=>{if(!l)return;const p=u=>{h.current?.contains(u.target)||c(!1)};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[l]);const d=p=>{if(r){r.setViewPreset(p,"view");return}Aa("orthographic"),o.setViewPreset(p)};return E.jsxs("div",{ref:h,className:"volter-viewport-popover-anchor",children:[t===void 0?E.jsx(Bi,{text:n==="perspective"?"Perspective":"Orthographic",children:E.jsx(di,{"aria-label":"Viewport views","aria-expanded":l,size:"comfortable",onClick:()=>c(p=>!p),children:E.jsx(Et,{icon:l?wh:xh,size:"md"})})}):E.jsxs(Ti,{size:"comfortable",variant:"ghost","aria-label":"Viewport views","aria-expanded":l,"data-testid":"viewport-view-name",onClick:()=>c(p=>!p),children:[i?E.jsx(Et,{icon:bh,size:"sm"}):null,t]}),l?E.jsx(Sh,{style:{minWidth:230},children:E.jsxs(Mh,{gap:3,children:[E.jsx(Ca,{variant:"caption",tone:"muted",children:"Projection"}),E.jsxs(Pa,{gap:1,children:[E.jsx(Ti,{size:"compact",variant:n==="perspective"?"primary":"ghost",onClick:()=>a("perspective"),children:"Perspective"}),E.jsx(Ti,{size:"compact",variant:n==="orthographic"?"primary":"ghost",onClick:()=>a("orthographic"),children:"Orthographic"})]}),E.jsx(Ca,{variant:"caption",tone:"muted",children:"Axis View"}),E.jsxs(Pa,{gap:1,children:[E.jsx(Ti,{size:"compact",variant:"ghost",onClick:()=>d("top"),children:"Top"}),E.jsx(Ti,{size:"compact",variant:"ghost",onClick:()=>d("front"),children:"Front"}),E.jsx(Ti,{size:"compact",variant:"ghost",onClick:()=>d("right"),children:"Right"})]})]})}):null]})}const ug=wm;function Dl(o){return Kr(null,o)}const pg=()=>()=>{},Vl=()=>0,fg=5,mg=58;function gg(o,e){const t=e?.camera()??o.renderCamera,i=o.camera.position,s=o.orbitControls.target,r=t.isOrthographicCamera?Ec(t,o,e):0;return[i.x,i.y,i.z,s.x,s.y,s.z,r].map(n=>n.toPrecision(6)).join(",")}function Ec(o,e,t){const i=e.orbitControls.domElement,s=Math.max(1,t?.renderer.domElement.height??(i?.clientHeight??1)*(i?.ownerDocument.defaultView?.devicePixelRatio??1));return(o.top-o.bottom)/o.zoom/s}function yg({viewport:o,documentId:e,session:t,store:i,projection:s,displayName:r,objectName:n,statistics:a,subject:l,gridScale:c}){k.useSyncExternalStore(i.subscribe,i.getShellSnapshot??i.getSnapshot),k.useSyncExternalStore(k.useCallback(R=>{const H=o?.orbitControls;return H?.addEventListener("change",R),()=>H?.removeEventListener("change",R)},[o]),()=>o?gg(o,t):""),k.useSyncExternalStore(t?.subscribe??pg,t?.getSnapshot??Vl,t?.getSnapshot??Vl);const h=k.useSyncExternalStore(Dl,ql),d=k.useSyncExternalStore(Dl,Ch),p=h&&!d?Ot.content.onAccent:Ot.content.primary,u=Ph();k.useSyncExternalStore(Vr,za,za);const f=hi(e).overlays.navigationControls;if(!o)return null;const m=ji(o.camera.position.clone().sub(o.orbitControls.target),new v(0,1,0).applyQuaternion(o.camera.quaternion))??"User",y=t?.projection()??s,_=t?.cameraView()??null,w=_?`Camera ${_.projection==="perspective"?"Perspective":"Orthographic"}`:`${m} ${y==="perspective"?"Perspective":"Orthographic"}`,x=i.selectedEntityId,S=(x===null?null:n(x))||null,C=l??(S===null||S===r?r:`${r} | ${S}`),b=t?.camera()??o.renderCamera,M=c&&!_&&m!=="User"&&b.isOrthographicCamera?c(Ec(b,o,t)):null,z=R=>{R.preventDefault();const H=R.currentTarget;H.setPointerCapture(R.pointerId);const se=o.orbitControls.domElement?.getBoundingClientRect().top??0,ve=Math.max(5+R.clientY-se,1),ee=o.camera,X=o.orbitControls.target,ue=ee.position.clone().sub(X),j=!t&&o.renderCamera instanceof Ui?o.renderCamera:null,ne=j?.zoom??1,G=t?.cameraViewZoom()??null,fe=Me=>{const xe=5+Me.clientY-se,Ce=Math.max(.01,2*(xe/ve-1)+1);G!==null&&t?.cameraView()?t.setCameraViewZoom(G/Ce):j?(j.zoom=ne/Ce,j.updateProjectionMatrix()):ee.position.copy(X).addScaledVector(ue,Ce),o.orbitControls.update()},Y=()=>{H.removeEventListener("pointermove",fe),H.removeEventListener("pointerup",Y),H.removeEventListener("pointercancel",Y),H.removeEventListener("lostpointercapture",Y)};H.addEventListener("pointermove",fe),H.addEventListener("pointerup",Y),H.addEventListener("pointercancel",Y),H.addEventListener("lostpointercapture",Y)},F=R=>{R.preventDefault();const H=R.currentTarget;H.setPointerCapture(R.pointerId);let se=R.clientX,ve=R.clientY;const ee=new v,X=new v,ue=ne=>{const G=ne.clientX-se,fe=ne.clientY-ve;if(se=ne.clientX,ve=ne.clientY,t?.cameraView()){const He=t.renderer.domElement;t.panCameraView(G/Math.max(He.clientWidth,1),fe/Math.max(He.clientHeight,1));return}const Y=o.camera,Me=o.orbitControls.target,xe=Y.position.distanceTo(Me),Ce=Math.max(1,H.ownerDocument.defaultView?.innerHeight??1),Ne=2*xe*Math.tan(Be.degToRad(Y.fov/2))/Ce;ee.setFromMatrixColumn(Y.matrixWorld,0).multiplyScalar(-G*Ne),X.setFromMatrixColumn(Y.matrixWorld,1).multiplyScalar(fe*Ne),Y.position.add(ee).add(X),Me.add(ee).add(X),o.orbitControls.update()},j=()=>{H.removeEventListener("pointermove",ue),H.removeEventListener("pointerup",j),H.removeEventListener("pointercancel",j),H.removeEventListener("lostpointercapture",j)};H.addEventListener("pointermove",ue),H.addEventListener("pointerup",j),H.addEventListener("pointercancel",j),H.addEventListener("lostpointercapture",j)};return E.jsxs(E.Fragment,{children:[u.viewName==="text"&&i.showHelpers?E.jsxs("div",{"data-testid":"viewport-view-text","aria-hidden":"true",style:{position:"absolute",top:"var(--volter-space-3)",left:"calc(var(--volter-space-4) + var(--volter-control-comfortable-height) * 2 + var(--volter-space-4))",display:"flex",flexDirection:"column",gap:"var(--volter-space-1)",fontSize:"var(--volter-font-sm)",color:p,textShadow:"var(--volter-content-text-shadow, none)",pointerEvents:"none",userSelect:"none"},children:[E.jsx("span",{children:w}),E.jsx("span",{children:C}),M?E.jsx("span",{"data-testid":"viewport-grid-scale",children:M}):null,a&&a.length>0?E.jsx("div",{"data-testid":"viewport-statistics",style:{display:"grid",gridTemplateColumns:`${mg}px auto`,rowGap:"var(--volter-space-1)",marginTop:Ah[fg]},children:a.map(R=>E.jsxs(k.Fragment,{children:[E.jsx("span",{children:R.label}),E.jsx("span",{children:R.value})]},R.id))}):null]}):null,u.viewName==="menu"?E.jsx("div",{className:"volter-viewport-view-pill",style:{position:"absolute",top:"var(--volter-viewport-overlay-top, var(--volter-space-4))",left:"var(--volter-stage-name-left, calc(var(--volter-space-4) + var(--volter-control-comfortable-height) * 2 + var(--volter-space-4)))",zIndex:"calc(var(--volter-z-dropdown, 1000) - 1)",pointerEvents:"auto"},children:E.jsx(dg,{shell:i,documentId:e,label:Nl(o,y,"long"),kebab:!0})}):null,u.viewName==="gizmo"?E.jsxs("button",{type:"button","data-testid":"viewport-view-name",className:"volter-viewport-gizmo-label","aria-label":y==="perspective"?"Switch to orthographic":"Switch to perspective",onClick:()=>{const R=y==="perspective"?"orthographic":"perspective";t?t.setProjection(R):o.setProjection(R)},style:{position:"absolute",top:vm+4,right:_m,transform:"translateX(50%)",display:"inline-flex",alignItems:"center",gap:"var(--volter-space-1)",padding:0,border:0,background:"none",fontSize:"var(--volter-font-sm)",color:p,textShadow:"var(--volter-content-text-shadow, none)",cursor:"pointer",pointerEvents:"auto"},children:[E.jsx(Et,{size:"xs",icon:y==="perspective"?zh:Eh}),Nl(o,y,"short")]}):null,f&&i.showGizmos?E.jsxs("div",{"data-testid":"viewport-navigation",role:"toolbar","aria-label":"Navigation","aria-orientation":"vertical",className:"volter-chrome-island volter-viewport-navigation",style:{position:"absolute",top:ug,right:"var(--volter-space-6)",display:"flex",flexDirection:"column",gap:"var(--volter-space-1)",padding:"var(--volter-space-1) 0",borderRadius:"var(--volter-radius-full)",background:"var(--volter-island-surface, var(--volter-surface-overlay))",pointerEvents:"auto"},children:[E.jsx(Bi,{text:"Zoom (drag)",children:E.jsx(di,{size:"comfortable","aria-label":"Zoom the view",onPointerDown:z,children:E.jsx(Et,{size:"2xl",icon:At.viewport.zoomIn})})}),E.jsx(Bi,{text:"Pan (drag)",children:E.jsx(di,{size:"comfortable","aria-label":"Pan the view",onPointerDown:F,children:E.jsx(Et,{size:"2xl",icon:At.viewport.pan})})}),t?.hasCameraView()?E.jsx(Bi,{text:_?"Leave the camera view":"Look through the camera",children:E.jsx(di,{size:"comfortable","aria-label":"Toggle the camera view",onClick:()=>t.toggleCameraView(),children:E.jsx(Et,{size:"2xl",icon:_?At.viewport.cameraView:At.viewport.camera})})}):null,_&&t?.cameraViewLocked()!==null?E.jsx(Bi,{text:t?.cameraViewLocked()?"Unlock the camera from the view":"Lock the camera to the view",children:E.jsx(di,{size:"comfortable","aria-label":"Lock the camera to the view",onClick:()=>t?.toggleCameraViewLock(),children:E.jsx(Et,{size:"2xl",icon:t?.cameraViewLocked()?At.viewport.cameraLocked:At.viewport.cameraUnlocked})})}):null,_||u.viewName==="gizmo"?null:E.jsx(Bi,{text:y==="perspective"?"Orthographic":"Perspective",children:E.jsx(di,{size:"comfortable","aria-label":"Toggle perspective and orthographic",onClick:()=>{const R=y==="perspective"?"orthographic":"perspective";t?t.setProjection(R):o.setProjection(R)},children:E.jsx(Et,{size:"2xl",icon:y==="orthographic"?At.viewport.projectionOrthographic:At.viewport.projection})})})]}):null,_&&t?E.jsx(_g,{view:_,canvas:t.renderer.domElement,locked:t.cameraViewLocked()===!0}):null]})}function _g({view:o,canvas:e,locked:t}){const[i,s]=k.useState(null),[,r]=k.useState(0);k.useEffect(()=>{const y=new ResizeObserver(()=>r(_=>_+1));return y.observe(e),()=>y.disconnect()},[e]);const n=e.clientWidth,a=e.clientHeight,l=e.ownerDocument.defaultView?.devicePixelRatio??1,c=e.getBoundingClientRect(),h=i?.getBoundingClientRect(),d=1/l,p=o.frame.left*n-d,u=o.frame.top*a-d,f=o.frame.width*n+2*d,m=o.frame.height*a+2*d;return E.jsx("div",{ref:s,"aria-hidden":"true",style:{position:"absolute",inset:0,pointerEvents:"none"},children:h?E.jsxs("svg",{"data-testid":"viewport-camera-frame",width:n,height:a,style:{position:"absolute",left:c.left-h.left,top:c.top-h.top},children:[o.passepartout.opacity>0?E.jsx("path",{d:`M0 0H${n}V${a}H0Z M${p} ${u}V${u+m}H${p+f}V${u}Z`,fill:o.passepartout.color,fillOpacity:o.passepartout.opacity,fillRule:"evenodd"}):null,o.passepartout.opacity>0?E.jsx("rect",{x:p,y:u,width:f,height:m,fill:"none",stroke:o.border.solid,strokeWidth:d,shapeRendering:"crispEdges"}):null,E.jsx("rect",{x:p,y:u,width:f,height:m,fill:"none",stroke:o.border.dashed,strokeWidth:d,strokeDasharray:`${3*d} ${3*d}`,shapeRendering:"crispEdges"}),t?E.jsx("rect",{x:p-d,y:u-d,width:f+2*d,height:m+2*d,fill:"none",stroke:o.border.locked,strokeWidth:d,strokeDasharray:`${3*d} ${3*d}`,shapeRendering:"crispEdges"}):null]}):null})}const vg=k.lazy(async()=>({default:(await wi(()=>import("./stage-keyboard-CfcRPwij.js"),__vite__mapDeps([16,5,8]))).StageKeyboardBinding})),wg=o=>{const e=o.split(":");return(e[0]==="document"?e[1]:e[0])??o},Ul=()=>hd(),Zn=12;function jl(o){if(!o)return null;const e=new St(new v(o.min[0],o.min[1],o.min[2]),new v(o.max[0],o.max[1],o.max[2]));return e.isEmpty()?null:e}const xg=500;function bg(o){return Kr(null,o)}const Sg=["solid","preview","rendered","clay","unlit","wireframe","matcap","normals","overdraw"];let Mg=0;const Li=new Bh(o=>({documentId:o,store:Zl(new Yl),inUse:!1,source:null,camera:null,presentation:null,transport:null,contentSeconds:0,transportAdvances:0}),o=>jh().some(e=>e.descriptor.id===o),Gh);function Cg({canvasHostRef:o}){return E.jsx("div",{ref:o,style:{position:"absolute",inset:0}})}function Pg(o,e,t,i,s){if(e==="inspector-preview"){const l=Od();return l.canvas.setAttribute("aria-label",`${t} authoring viewport`),o.appendChild(l.canvas),{canvas:l.canvas,renderer:l.renderer,lease:l}}const r=Ad(i.width,i.height,s),{canvas:n,renderer:a}=r;return n.setAttribute("aria-label",`${t} authoring viewport`),n.setAttribute("data-volter-root-surface","true"),o.appendChild(n),{canvas:n,renderer:a,lease:r}}class Gl{constructor(e,t,i){this.lane=e,this.surface=t,this.store=i??Zl(new Yl),this.transport=new ld(this.store.shell)}scene=new dc;store;cleanups=[];rendererSession=new cd((e,t)=>this.frame?.(e,t),()=>{});viewport=null;session=null;dressing=null;presentationRig=null;applyPresentation=null;backdropOverridden=!1;documentStudio=null;contentLights=[];contentHas={light:!1,"directional-light":!1};darkened=[];darkenContentLights(){for(const t of this.contentLights)t.visible&&(t.visible=!1,this.darkened.push(t));if(this.darkened.length===0)return 0;const e=this.darkened.length;return this.scene.onAfterRender=()=>{for(const t of this.darkened)t.visible=!0;this.darkened=[],this.scene.onAfterRender=()=>{}},e}defaultEnvironment=null;defaultBackground=null;adapter=null;presentationAdapter=null;content=null;frame=null;syncHostScene=null;presence=null;initialized=!1;contentSeconds=0;transportAdvances=0;users=0;closed=!1;released=!1;get isClosed(){return this.closed}transport;borrow(){this.users++;let e=!1;return()=>{e||(e=!0,this.users--,this.releaseIfClosed())}}close(){this.closed=!0,this.frame=null,this.syncHostScene=null,this.session?.setBeforeRender(null),this.session?.setPresentsFrames(!1),this.rendererSession.setActive(!1),this.content?.dispose(),this.transport.dispose(),this.releaseIfClosed()}releaseIfClosed(){if(!this.closed||this.users!==0||this.released)return;this.released=!0;const{lease:e,renderer:t,canvas:i}=this.surface;for(const s of[...this.cleanups.splice(0),()=>this.session?.dispose(),()=>this.viewport?.dispose(),()=>this.rendererSession.dispose(),()=>this.dressing?.dispose(),()=>i.removeAttribute("data-volter-root-surface"),...e?[()=>e.release()]:[()=>t.dispose(),()=>t.forceContextLoss(),()=>i.remove()]])try{s()}catch(r){console.error("Object3D document cleanup failed.",r)}}}function Oc({documentId:o,sourcePath:e,build:t,displayName:i="Source Object3D",background:s,cameraDirection:r,persistence:n,documentSource:a,authoring:l,interaction:c,selectionOutline:h=!0,active:d=!0,audit:p=!0,chromeless:u=!1,fillContainer:f=!1,modelSource:m,assetType:y,sourceAuthoring:_,dressing:w,rendererLane:x="own",onOpenNode:S,frameBounds:C,openingFrameBounds:b,openingFit:M,openingView:z,presentation:F,cameraView:R,stageKind:H,statistics:se,subject:ve,gridScale:ee,content:X}){const ue=H??wg(o);k.useEffect(()=>{if(!u)return Oh(o)},[o,u]);const j=Pd(Th()),ne=j??Kn(),G=ne?Xl(ne.shell,o,u?"embedded":"document"):null,fe=k.useSyncExternalStore(bg,ql),Y=G!==null&&kh(G,fe),Me=k.useRef(Y);Me.current=Y;const xe=G!==null&&Rh(G),Ce=k.useRef(xe);Ce.current=xe;const Ne=G!==null&&Ih(G),He=k.useRef(Ne);He.current=Ne;const we=Lh(),Kt=k.useRef(we);Kt.current=we;const ei=k.useRef(null),ti=k.useRef(null),le=k.useRef(null),tt=k.useRef(null);(!tt.current||tt.current.documentId!==o)&&(tt.current&&Li.release(tt.current),tt.current=Li.claim(o)),k.useEffect(()=>{const Z=tt.current,it=Li.generation(Z);return()=>Li.release(Z,it)},[o]);const oe=tt.current,dt=X?.kind==="world-root",ii=d||dt,xi=k.useRef(X?.kind==="world-root"?X.load:null);xi.current=X?.kind==="world-root"?X.load:null;const[ut,si]=k.useState(ii);k.useEffect(()=>si(ii),[ii]);const ri=k.useRef(h);k.useEffect(()=>{ri.current=h;const Z=le.current?.session;Z&&(Z.selectionOutlineEnabled=x!=="inspector-preview"&&h),le.current?.applyPresentation?.()},[h,x]);const bi=k.useRef(Promise.resolve()),Ct=k.useRef(!1);k.useEffect(()=>{if(ut)return Ki.current=!1,rn("building"),()=>{const Z=le.current;if(Z&&!dt){Ct.current=!pt.current;const it=Z.store.cameraPose;oe.camera=it&&Z.viewport?{...it,up:Z.viewport.camera.up.clone()}:null,oe.presentation=Z.session?.presentation()??null,oe.transport=Z.transport.snapshot(),oe.contentSeconds=Z.contentSeconds,oe.transportAdvances=Z.transportAdvances}rr.current=null,nr.current=null,sr.current=null,ir.current=null,Z?.close(),le.current=null}},[o,x,oe,ut,dt]);const Lt=k.useRef(S);Lt.current=S;const Bt=k.useRef(C);Bt.current=C;const Ft=k.useRef(b);Ft.current=b;const Pt=k.useRef(z);Pt.current=z;const Nt=k.useRef(F);Nt.current=F;const Ht=k.useRef(R);Ht.current=R;const pt=k.useRef(d);pt.current=d;const Dt=k.useRef(d),ce=k.useRef({build:t,sourcePath:e});k.useEffect(()=>{const Z=ce.current;ce.current={build:t,sourcePath:e},!(Z.build===t&&Z.sourcePath===e)&&!ut&&oe.source&&(oe.source.dispose(),oe.source=null)},[t,oe,e,ut]);const ir=k.useRef(null),Ki=k.useRef(!1),sr=k.useRef(null),rr=k.useRef(null),nr=k.useRef(null),[tn,Xe]=k.useState(null),[sn,rn]=k.useState("building"),[No,Tc]=k.useState(null),[kc,Rc]=k.useState("mounting"),[Ic,Lc]=k.useState([]),Ho=k.useRef(null),[Do,Bc]=k.useState("perspective"),[Fc,Vo]=k.useState(null),or=k.useRef(null);or.current=Fc;const nn=r?.[0],on=r?.[1],an=r?.[2],es=m?.kind,ln=m?.kind==="project-file"?m.path:void 0,ar=m?.kind==="entity"?m.entityId:void 0,Uo=w?.environment,jo=w?.background,Go=w?.keyLight,cn=w?.grid,ts=w?.viewLocked,hn=w?.toneMapping;d&&Fh(o),k.useEffect(()=>{let Z=!1;if(!ut)return;const it=async Vt=>{const ye=ei.current,is=ti.current;if(!ye||!is||le.current)return;const W=Kt.current;if(!W){Xe("The world root needs the editor shell above it; this host has none.");return}const ss=await Vt();if(Z||le.current)return;Tc(()=>ss),Ea();const g=new Gl("own",ss.mountWorldRootSurface(is,ye,i),Kn()??void 0);le.current=g,g.cleanups.push(Oa(o,g.store.shell)),g.cleanups.push(Ta(o,g.transport)),g.cleanups.push(ad(o,{...rg(g.store,o),...Fl(o)}));const qe=ss.installWorldRootStage({store:g.store,documentId:o,container:ye,canvas:g.surface.canvas,renderer:g.surface.renderer,stats:W,cameraPreview:()=>Ho.current,onMountStatus:Rc,onRootIds:Lc,runFrame:Ut=>ja(o,Ut)});g.viewport=qe.viewport,g.frame=qe.frame,g.content={scene:qe.scene,settle:()=>Promise.resolve(),dispose:async()=>qe.dispose()};const Q=Wa(()=>g.store.scene??qe.scene,g.transport,{rescanOnLiveMixers:()=>g.store.shell.playState==="stopped"});let Ge=0;g.cleanups.push(()=>Q.dispose()),g.cleanups.push(g.store.shell.subscribe(()=>{if(g.store.shell.playState!=="stopped")return;const Ut=performance.now();Ut-Ge<xg||(Ge=Ut,Q.refresh())})),g.cleanups.push(Ga({camera:qe.viewport.camera,drawCamera:()=>qe.viewport.renderCamera,orbit:qe.viewport.orbitControls,scene:qe.scene},qe.present,qe.setHelper,{documentId:o})),ir.current=g.rendererSession,g.initialized=!0,Ba(),rn("ready"),g.rendererSession.setActive(!0)},Hc=async()=>{for(await le.current?.content?.settle();Wh();)await Xh();if(Z)return;const Vt=xi.current;if(Vt)return it(Vt);const ye=ei.current,is=ti.current;if(!ye||!is)return;if(!t||e===void 0){Xe("This stage shows `build` content and was given no `build()`/`sourcePath`.");return}let W;const ss=Li.generation(oe);try{W=oe.source??t(),oe.source=null}catch(De){Xe(De instanceof Error?De.message:String(De));return}try{le.current||(Ea(),le.current=new Gl(x,Pg(is,x,i,{width:Math.max(1,ye.clientWidth),height:Math.max(1,ye.clientHeight)},()=>{si(!1),window.setTimeout(()=>{pt.current&&si(!0)},0)}),oe.store),le.current.contentSeconds=oe.contentSeconds,le.current.transportAdvances=oe.transportAdvances)}catch(De){throw W.dispose(),De}const g=le.current,qe=g.borrow(),{renderer:Q,canvas:Ge,lease:Ut}=g.surface,re=g.store;u||(g.cleanups.push(Oa(o,re.shell)),g.cleanups.push(Ta(o,g.transport)));const cr=ka();cr&&re.shell.attachHistory(cr);const un=x==="inspector-preview",Si=Me.current,Xo=Ce.current,qo=He.current,he=new dc,hr=W.root.parent;he.add(W.root),W.animations&&(W.root.animations=[...W.animations]);const pn={root:W.root,animations:W.root.animations};let Mi=null,Ci=null,Pi=null,jt=null,$e=null,dr=null,ur=null,pr=null,fr=null,mr=null,fn=null,Yo=null,Jo=null,Zo=!1,gr=!1,yr=null;const mn={scene:he,settle:()=>$e?.settle()??Promise.resolve(),dispose:()=>{if(yr)return yr;gr=!0;const De=Ct.current;return Ct.current=!1,dr&&ye.removeEventListener("pointerdown",dr,!0),ur&&ye.removeEventListener("pointermove",ur,!0),pr&&ye.removeEventListener("pointerup",pr,!0),fr&&ye.removeEventListener("pointercancel",fr,!0),mr&&window.removeEventListener("keydown",mr),fn?.(),fn=null,yr=(async()=>{await $e?.settle();const rs=[];for(const _r of[()=>jt?.dispose(),()=>Ci?.dispose?.(),()=>Mi?.dispose(),()=>he.removeFromParent(),()=>{De?Li.retain(oe,W,ss):W.dispose()},qe])try{_r()}catch(ft){rs.push(ft)}rs.length&&console.error("Object3D source cleanup failed.",...rs)})(),yr}};try{const De=async P=>{try{const I=pn;if(a&&!n){if(!I)throw new Error("Project history is unavailable; the edit was not saved.");const A=ka();if(!A)throw new Error("Project history is unavailable; the edit was not saved.");const L=a.serialize(I);if(L===null)return Xe(null),!1;const T=await Ul().replaceSource(A,{file:a.path,source:L,label:P??a.label??`Edit ${i}`});return Xe(null),T}if(!n)throw new Error("This Asset Lab document has no persistence binding.");if(!Pi||!I)throw new Error("Project history is unavailable; the edit was not saved.");const{persisted:D}=await(await Pi).commit(I,P);return Xe(null),D}catch(I){throw Xe(I instanceof Error?I.message:JSON.stringify(I)),I}};Mi=new Fo(re,he,{documentId:o,title:i,sourcePath:e,documentKind:qo?"asset":"source",audit:p,...W.hierarchyRoots?{hierarchyRoots:W.hierarchyRoots}:{},...es==="project-file"&&ln?{modelSource:{kind:es,path:ln}}:es==="entity"&&ar?{modelSource:{kind:es,entityId:ar}}:{}});const rs={documentId:o,sourcePath:e,root:W.root,animations:W.root.animations,scene:he,defaultAdapter:Mi,commit:De};Ci=l?.(rs)??null;const _r=Ci?Mi:null;!Ci&&_&&(Ci=_({store:re,scene:he,...W.hierarchyRoots?{hierarchyRoots:W.hierarchyRoots}:{}}),Mi.dispose()),Pi=n&&cr?Ul().openPersistence({binding:n,document:pn,history:cr}):null,Pi&&Pi.catch(P=>{!gr&&le.current?.content===mn&&Xe(P instanceof Error?P.message:JSON.stringify(P))});const ft=Ci?.adapter??Mi;if(!g.dressing){Q.outputColorSpace=wt,Q.toneMapping=hn??oc,Q.shadowMap.enabled=!0,Q.shadowMap.type=uu,Q.info.autoReset=!1,Q.setPixelRatio(Math.min(window.devicePixelRatio,2)),Si&&Q.setClearColor(0,0);const P=Uo===!1?null:Ut&&"environment"in Ut?Ut.environment():Ed(Q),I=Qn(Ge);g.dressing=Mu(g.scene,{environment:P,background:!Si&&s===void 0&&jo!==!1,keyLight:!1,grid:cn===!0,content:W.root}),!Si&&s!==void 0?g.scene.background=new U(s):!Si&&I.background!==null&&(g.scene.background=new U(I.background)),g.defaultEnvironment=g.scene.environment,g.defaultBackground=g.scene.background;{const D=new hc(g.scene,$);g.presentationRig=D,$n(o,ue);let A=g.store.shell.showHelpers;const L=()=>{const T=hi(o);if(A=g.store.shell.showHelpers,D.apply(T,Q,hn),g.viewport?.setStageFunction(T.world,T.interaction),g.viewport?.setFieldOfView(T.camera.fov),g.viewport?.setSelectionMarks(T.overlays.selection),g.viewport?.setGridMajorEvery(T.overlays.grid.majorEvery),g.viewport?.setAxisLines(T.overlays.axes),g.viewport?.setNavigation(T.overlays.navigation),g.viewport?.setGridVisible(T.overlays.grid.visible&&A),g.session){const J=g.session.presentation().mode==="wireframe"&&T.xray.enabled&&T.xray.alpha<=0;g.session.selectionOutlineEnabled=!un&&A&&ri.current&&T.overlays.selection.outline&&!J,g.session.selectionOriginsEnabled=!un&&A&&T.overlays.selection.origins,g.session.setXray(T.xray)}$()};g.applyPresentation=L,L(),g.cleanups.push(Vr(L)),g.cleanups.push(g.store.shell.subscribe(()=>{g.store.shell.showHelpers!==A&&L()})),g.cleanups.push(qh(()=>{D.forgetFailedImages(),L()})),g.cleanups.push(()=>{D.dispose(),g.presentationRig===D&&(g.presentationRig=null)})}g.cleanups.push(()=>{g.defaultBackground instanceof Ua&&g.defaultBackground!==g.dressing?.backgroundTexture&&g.defaultBackground.dispose()})}const Qo=(P,I)=>{const D=g.adapter,A=g.viewport;if(!D||!A)return null;const L=Ge.getBoundingClientRect(),T=new Oe((P-L.left)/Math.max(L.width,1)*2-1,-((I-L.top)/Math.max(L.height,1))*2+1),J=new lt;J.layers.enableAll(),J.params.Line2={threshold:4},J.setFromCamera(T,g.session?.camera()??A.camera);const be=g.presentationAdapter,Ye=me=>{for(let ge=me;ge;ge=ge.parent){const Wt=be?.hierarchy.idForObject3D?.(ge)??D.hierarchy.idForObject3D?.(ge);if(Wt)return Wt}return null};let mt=null;for(const me of J.intersectObjects([...re.objectMap.values()],!0)){if(at(me.object))continue;const ge=Ye(me.object);if(ge){mt={distance:me.distance,id:ge};break}}const Ei=A.visibleHelpers().filter(me=>me.userData.volterPickable===!0);for(const me of J.intersectObjects(Ei,!0)){let ge=null,Wt=!0;for(let Xt=me.object;Xt;Xt=Xt.parent)Xt.visible||(Wt=!1),ge??=Xt.userData.volterPicksAs??null;if(!Wt)continue;const oi=ge?Ye(ge):null;if(oi){(!mt||me.distance<mt.distance)&&(mt={distance:me.distance,id:oi});break}}return mt?.id??null};if(!g.viewport){g.viewport=new Bo(Ge,g.scene,re,ye,{renderer:Q,authoring:()=>g.adapter??ft,pick:Qo,drawCamera:()=>g.session?.camera()??g.viewport.camera,publishPickContext:!1,onProjectionChange:Bc,chromeInsetPx:u||Xo||f?0:Zn,lightRig:!1}),cn===!0&&g.viewport.grid.removeFromParent();const P=I=>{const D=Qo(I.clientX,I.clientY),A=D&&g.adapter?pi(g.adapter.hierarchy,D):null;A&&Lt.current?.(A)};ye.addEventListener("dblclick",P),g.cleanups.push(()=>ye.removeEventListener("dblclick",P))}const V=g.viewport;if(ts){const P=V.camera;g.scene.add(P);const I=new je;I.name="volter:document-studio",I.add(ts),P.add(I),g.documentStudio=I,g.cleanups.push(()=>{ts.removeFromParent(),I.removeFromParent(),g.documentStudio===I&&(g.documentStudio=null),P.removeFromParent()})}if(c){const P=new je;P.name="__object3d_document_overlay",Ze(P,"editorHelper",!0),he.add(P),jt=c.setup({root:W.root,scene:he,renderer:Q,overlay:P,camera:()=>g.session?.camera()??V.camera,writable:n!==void 0||a!==void 0});const I=A=>{const L=Ge.getBoundingClientRect(),T=new Oe((A.clientX-L.left)/Math.max(L.width,1)*2-1,-((A.clientY-L.top)/Math.max(L.height,1))*2+1),J=new lt;return J.layers.enableAll(),J.setFromCamera(T,g.session?.camera()??V.camera),{pointerId:A.pointerId,button:A.button,buttons:A.buttons,clientX:A.clientX,clientY:A.clientY,altKey:A.altKey,ctrlKey:A.ctrlKey,metaKey:A.metaKey,shiftKey:A.shiftKey,ray:J.ray.clone(),hits:J.intersectObjects([W.root,P],!0)}};$e=new Hm({begin:A=>{if(!n&&!a)throw new Error("This Asset Lab document has no persistence binding; project gestures are read-only.");return jt.begin(A)},persist:async A=>{await De(A)},reportError:A=>Xe(A instanceof Error?A.message:JSON.stringify(A))});const D=A=>{A.preventDefault(),A.stopPropagation()};dr=A=>{A.target instanceof Element&&A.target.closest('[role="alert"], [role="toolbar"]')!==null||$e?.begin(I(A))&&(D(A),A.isTrusted&&Ge.setPointerCapture?.(A.pointerId))},ur=A=>{$e?.hasActiveGesture()&&(D(A),$e.update(I(A)))},pr=A=>{$e?.hasActiveGesture()&&(D(A),Ge.hasPointerCapture?.(A.pointerId)&&Ge.releasePointerCapture?.(A.pointerId),$e.commit(I(A)))},fr=A=>{$e?.hasActiveGesture()&&(D(A),$e.cancel(A.pointerId))},mr=A=>{A.key!=="Escape"||!$e?.hasActiveGesture()||(A.preventDefault(),$e.cancel())},Yo=()=>{ye.addEventListener("pointerdown",dr,!0),ye.addEventListener("pointermove",ur,!0),ye.addEventListener("pointerup",pr,!0),ye.addEventListener("pointercancel",fr,!0),window.addEventListener("keydown",mr)}}const ni=g.content,$o=[...re.shell.selectedEntityIds],ns=g.adapter,Vc=g.presentationAdapter,Uc=new Map(re.objectMap),Ai=g.session?.root,jc=g.frame,Gc=g.syncHostScene,Wc=rr.current,Xc=nr.current,qc=sr.current,Ko=g.session?.neutralBackgroundTexture(),Yc=g.dressing.lights.map(P=>P.visible),Jc=g.cleanups.length,Zc=g.initialized;if(Jo=()=>{he.removeFromParent(),hr&&hr.add(W.root),ni&&g.scene.add(ni.scene),g.adapter=ns,g.presentationAdapter=Vc,g.content=ni,g.frame=jc,g.syncHostScene=Gc,g.initialized=Zc;for(const P of g.cleanups.splice(Jc))P();!Ai&&g.session&&(g.session.dispose(),g.session=null),re.objectMap.clear();for(const[P,I]of Uc)re.objectMap.set(P,I);ni&&re.bindScene(ni.scene,Q,V.batchedRenderer,V.camera),Ai&&ns&&g.session?.replaceContent(Ai,ns),rr.current=Wc,nr.current=Xc,sr.current=qc,or.current=ns,Vo(ns),Ko!==void 0&&g.session?.setNeutralBackground(Ko),g.dressing?.lights.forEach((P,I)=>{P.visible=Yc[I]??!0}),Ai&&(g.dressing?.frameContent(Ai),g.presentationRig?.placeFloor(Ai)),re.shell.selectMultiple($o),re.notifyIngestObjectMapEdit()},ni?.scene.removeFromParent(),g.scene.add(he),g.adapter=ft,g.presentationAdapter=_r,g.content=mn,re.bindScene(he,Q,V.batchedRenderer,V.camera),re.setOrbitTarget(V.orbitControls.target),re.objectMap.clear(),he.traverse(P=>{const I=_r?.hierarchy.idForObject3D?.(P)??ft.hierarchy.idForObject3D?.(P);I&&re.objectMap.set(I,P)}),g.session)g.session.replaceContent(W.root,ft);else{const P=jl(Bt.current),I=jl(Ft.current)??P,D=hi(o).camera;V.setFieldOfView(D.fov);const A=Pt.current,L=nn!==void 0&&on!==void 0&&an!==void 0;if(!A&&!L){const T=V.orbitControls.target,J=V.camera.position.distanceTo(T);V.camera.position.copy(T).addScaledVector(new v(...D.opening).normalize(),J)}if(I||V.focusOn(W.root),A){const T=new v(...A.target),J=new v(...A.direction).normalize();V.camera.position.copy(T).addScaledVector(J,A.distance),V.camera.up.set(0,1,0),A.up&&V.camera.up.set(...A.up),V.orbitControls.target.copy(T)}else if(L){const T=I??mi(W.root),J=T.getCenter(new v),be=new v(nn,on,an).normalize(),Ye=yi(T,V.camera,be)*Math.min(10,Math.max(.1,M??1));V.camera.position.copy(J).add(be.multiplyScalar(Ye)),V.orbitControls.target.copy(J)}if(g.session=new Lm(o,W.root,g.scene,Q,V,ft,Si?null:s===void 0?g.dressing.backgroundTexture:new U(s),P),g.session.selectionOutlineEnabled=!un&&ri.current,g.session.setCameraViewSource(Ht.current??null),g.applyPresentation?.(),Pt.current?.projection==="orthographic"&&g.session.setProjection("orthographic"),!Si&&s===void 0&&g.dressing.backgroundTexture){const T=g.session;g.cleanups.push(Cu(()=>{const J=Qn(Ge).background,be=g.defaultBackground;g.defaultBackground=J!==null?new U(J):Pu(),T.neutralBackgroundTexture()===be&&T.setNeutralBackground(g.defaultBackground),be instanceof Ua&&be!==g.dressing?.backgroundTexture&&be.dispose()}))}}const os=oe.camera;os&&(V.setPose(os.position,os.target,os.fov||void 0,os.up),V.setProjection(Do),oe.camera=null);const ae=g.session;rr.current=pn,nr.current=Pi,sr.current=jt,or.current=ft,Vo(ft);const gn=Yh(ue)?.all?.lighting!==void 0||Jh(ue)?null:ts?{all:{lighting:{source:"studio",studioPreset:Ra.id,auto:null}}}:Go===!1?{all:{lighting:{source:"scene"}}}:null,vr=Nt.current??null;$n(o,ue,gn&&vr?Zh(gn,vr):vr??gn);const yn=new Set(Sg);let ea;const ta=()=>{const P=g.session?.presentation().mode;P!==ea&&(ea=P,g.applyPresentation?.()),!(P===void 0||!yn.has(P))&&hi(o).drawMode!==P&&Wl(o,{drawMode:P})},_n=vr?.drawMode??Qh(o).drawMode;_n!==void 0&&yn.has(_n)&&g.session&&g.session.setMode(_n),ta();const Qc=g.session?.subscribe(ta),$c=Vr(()=>{const P=g.session,I=hi(o).drawMode;P&&P.presentation().mode!==I&&yn.has(P.presentation().mode)&&P.setMode(I)});g.cleanups.push(()=>{Qc?.(),$c()});const wr=[];W.root.traverse(P=>{P.isLight&&wr.push(P)});const Kc={light:wr.length>0,"directional-light":wr.some(P=>P.isDirectionalLight)};g.contentLights=wr,g.contentHas=Kc,g.dressing.frameContent(W.root),g.presentationRig?.placeFloor(W.root),g.cleanups.push(re.shell.subscribe(()=>g.presentationRig?.placeFloor(W.root)));const ia=new Set;re.shell.selectMultiple($o.filter(P=>{const I=re.objectMap.get(P)??pi(ft.hierarchy,P);if(I===null&&!re.objectMap.has(P))return!1;const D=I??P;return ia.has(D)?!1:(ia.add(D),!0)})),re.notifyIngestObjectMapEdit(),ae.syncSelectionPresentation(),Yo?.(),Xe(null),u||Ia(o);let xr=he.background;ae.setNeutralBackground(xr??g.defaultBackground);const zi=oe.presentation;zi&&(ae.setMode(zi.mode),ae.setBackground(zi.background),ae.setProjection(zi.projection),ae.setSkeleton(zi.skeleton),ae.setBounds(zi.bounds),oe.presentation=null);const eh=()=>{xr!==he.background&&(xr=he.background,ae.setNeutralBackground(xr??g.defaultBackground)),g.viewport?.alignGridToView(ae.camera(),Q.domElement.width),g.scene.environment=he.environment??g.defaultEnvironment,g.scene.fog=he.fog,g.scene.environmentIntensity=he.environmentIntensity,g.scene.environmentRotation.copy(he.environmentRotation),g.scene.backgroundIntensity=he.backgroundIntensity,g.scene.backgroundBlurriness=he.backgroundBlurriness,g.scene.backgroundRotation.copy(he.backgroundRotation);const P=g.presentationRig;if(P){const I=P.resolveSource({...g.contentHas,environment:he.environment!==null}),D=P.environment();D&&(g.scene.environment=D.texture??g.defaultEnvironment,g.scene.environmentIntensity=D.intensity,g.scene.environmentRotation.set(0,D.rotation,0));const A=P.backdrop();A!=="keep"?(g.scene.background=A.value,g.scene.backgroundBlurriness=A.blur,g.scene.backgroundIntensity=A.intensity,g.scene.backgroundRotation.set(0,A.rotation,0),g.backdropOverridden=!0):g.backdropOverridden&&(g.scene.background=ae.neutralBackgroundTexture(),g.scene.backgroundBlurriness=he.backgroundBlurriness,g.scene.backgroundIntensity=he.backgroundIntensity,g.backdropOverridden=!1);const L=I==="studio"&&P.presetId()===Ra.id;g.documentStudio&&(g.documentStudio.visible=L);const T=I==="studio"&&!L||I==="preview"&&!P.sceneLightsShown()?g.darkenContentLights():0;P.update(ae.camera()),$h(o,{source:I,presetId:P.presetId(),presetLights:P.lightsVisible(),documentStudio:g.documentStudio?g.documentStudio.visible:null,contentLights:g.contentLights.length,contentLightsDarkened:T,environmentIntensity:g.scene.environmentIntensity,environmentImage:P.imageReport().shown,environmentImagePending:P.imageReport().pending,toneMapping:String(Q.toneMapping)})}};g.syncHostScene=eh,ae.setBeforeRender(P=>{g.syncHostScene?.();const I=ae.presentation().mode,D=P&&["solid","preview","clay","unlit","matcap"].includes(I);return W.prepareDraw?.(ae.camera(),{interactive:D,height:Q.domElement.height,multiDraw:Q.extensions.has("WEBGL_multi_draw"),renderer:Q})}),ae.setPresentsFrames(!0);const th=P=>{gr||!(P>0)||!Number.isFinite(P)||(g.contentSeconds+=P,g.transportAdvances++,W.update?.(P))},ih=Wa(W.root,g.transport);g.cleanups.push(()=>ih.dispose());const Gt=oe.transport;Gt&&(Gt.activeSubject&&g.transport.setActiveSubject(Gt.activeSubject),g.transport.setLoop(Gt.range.loop),g.transport.setTimeScale(Gt.timeScale),g.transport.seek(Gt.time),Gt.playbackState==="playing"?g.transport.play():Gt.playbackState==="paused"&&g.transport.pause(),oe.transport=null);let vn=performance.now();const sa=typeof W.onChange=="function";let br=!0;const Sr=()=>{br=!0};if(sa){const P=W.onChange(Sr),I=re.shell.subscribe(Sr),D=["pointerdown","pointermove","pointerup","pointerleave","wheel","keydown","keyup"];for(const A of D)ye.addEventListener(A,Sr,{capture:!0,passive:!0});fn=()=>{P(),I();for(const A of D)ye.removeEventListener(A,Sr,{capture:!0})}}let ra=-1;const na=new Tt,oa=new Tt,aa=new Oe,la=new Oe;let ca,ha=null,da=Number.NaN;const sh=P=>{if(!sa||br||P>0||La()!==ra||ae.needsFrame()||g.presence?.live()||jt?.prepareFrame||jt?.update||(V.batchedRenderer.batches?.length??0)>0)return!0;const I=ae.camera();return I.updateMatrixWorld(),Q.getDrawingBufferSize(la),!I.matrixWorld.equals(na)||!I.projectionMatrix.equals(oa)||!la.equals(aa)||g.scene.background!==ca||Q.toneMapping!==ha||Q.toneMappingExposure!==da},rh=()=>{br=!1,ra=La();const P=ae.camera();na.copy(P.matrixWorld),oa.copy(P.projectionMatrix),Q.getDrawingBufferSize(aa),ca=g.scene.background,ha=Q.toneMapping,da=Q.toneMappingExposure};let as=null;const ua=(P,I)=>{if(gr||!Q||!V)return;const D=Q,A=V,L=ae?.profiler;L?.beginFrame(),I&&(vn=P);const T=Math.min((P-vn)/1e3,.1);vn=P,L?.beginPhase();const J=g.transport.tick(T);if(J>0&&th(J),jt?.prepareFrame?.(T),jt?.update?.(T),L?.endPhase("animation"),L?.beginPhase(),g.presence?.syncMarkers(T),V.update(T),u||ja(o,T),as){const ge=ae.camera();ge.quaternion.copy(as),ge.updateMatrixWorld(!0)}if(V.batchedRenderer.update(T),L?.endPhase("editor"),!I&&!sh(J)){L?.endFrame();return}L?.beginPhase(),D.info.reset();const be=!Ki.current&&Kh()===o;be&&ed(o);const Ye=be?Date.now():0,mt=g.scene.overrideMaterial,Ei=ae.presentation().mode;Ei!=="uv"&&Ei!=="vertex-colors"&&(g.scene.overrideMaterial=he.overrideMaterial);try{A.renderWithInfrastructure(()=>{ae.renderViewport(T,as!==null||!I&&!ae.needsFrame()),A.renderViewCube(D)})}finally{g.scene.overrideMaterial=mt}ae.servePresentedFrame(),rh(),Ki.current||(Ki.current=!0,be&&td("first-render",Date.now()-Ye),id(o),rn("ready")),L?.reportRender({gpuMs:null,drawCalls:D.info.render.calls,triangles:D.info.render.triangles,geometries:D.info.memory.geometries,textures:D.info.memory.textures}),L?.endPhase("render"),L?.endFrame();const me=Kt.current;if(me&&j&&sd(j.shell)===re.shell){const ge=ae.cameraPose();me.frameTime=T*1e3,me.fps=T>0?1/T:0,me.drawCalls=D.info.render.calls,me.triangles=D.info.render.triangles,me.cameraPosition.x=ge.position[0],me.cameraPosition.y=ge.position[1],me.cameraPosition.z=ge.position[2],me.cameraTarget.x=ge.target[0],me.cameraTarget.y=ge.target[1],me.cameraTarget.z=ge.target[2]}};g.frame=ua;const nh=(P,I="full")=>{if(!Q)throw new Error("This stage has no renderer yet.");const D=Q,A=D.getContext(),L=new Uint8Array(4),T=[],J=[],be=[],Ye=ae.camera(),mt=Ye.quaternion.clone(),Ei=new v(0,1,0);try{for(let Ve=0;Ve<=P;Ve++){I==="navigation"&&(as=mt.clone().multiply(new pe().setFromAxisAngle(Ei,(Ve+1)*5e-4)));const We=performance.now();ua(We,!0);const ai=performance.now();A.readPixels(0,0,1,1,A.RGBA,A.UNSIGNED_BYTE,L);const Cr=performance.now();Ve>0&&(T.push(Cr-We),J.push(ai-We),be.push(Cr-ai))}}finally{as=null,Ye.quaternion.copy(mt),Ye.updateMatrixWorld(!0),br=!0}const me={calls:D.info.render.calls,triangles:D.info.render.triangles};let ge=0,Wt=0;g.scene.traverseVisible(Ve=>{const We=Ve;if(!We.isMesh||!We.geometry||at(We))return;ge++;const ai=We.geometry.getIndex(),Cr=ai?ai.count:We.geometry.getAttribute("position")?.count??0;Wt+=Math.floor(Cr/3)*(We.count??1)});const oi=[...T].sort((Ve,We)=>Ve-We),Xt=Ve=>oi[Math.min(oi.length-1,Math.floor(Ve*oi.length))]??0,Mr=D.getDrawingBufferSize(new Oe),wn=D.getPixelRatio(),Oi=Ve=>Math.round(Ve*100)/100,pa=Ve=>Oi(Ve.sort((We,ai)=>We-ai)[Math.floor(Ve.length/2)]??0);return{frames:P,quality:I,medianMs:Oi(Xt(.5)),p95Ms:Oi(Xt(.95)),minMs:Oi(oi[0]??0),submitMedianMs:pa(J),completionWaitMedianMs:pa(be),width:Mr.x,height:Mr.y,cssWidth:Oi(Mr.x/wn),cssHeight:Oi(Mr.y/wn),devicePixelRatio:wn,drawn:me,scene:{meshes:ge,triangles:Wt},drawMode:hi(o).drawMode}};if(ir.current=g.rendererSession,!g.initialized){u||(g.cleanups.push(Ga({camera:V.camera,drawCamera:()=>g.session?.camera()??V.camera,orbit:V.orbitControls,scene:g.scene,frameCost:(L,T)=>nh(L,T)},()=>null,(L,T)=>V.setHelper(L,T),{documentId:o})),wi(()=>import("./stage-presence-markers-CheQj0g2.js"),__vite__mapDeps([17,5,6,2,1,7,8])).then(L=>{if(g.isClosed||le.current!==g||g.presence)return;const T=L.bindStagePresenceMarkers({scene:g.scene,store:re,documentId:o,container:ye,canvas:Ge,viewport:V,readVisibleCameraPose:()=>{const J=g.session?.camera()??V.renderCamera,be=J.getWorldPosition(new v),Ye=J.fov;return{position:be,target:V.orbitControls.target,fov:typeof Ye=="number"?Ye:0}}});g.presence=T,g.cleanups.push(()=>T.dispose())}),g.cleanups.push(_u(ae,Fl(o))),g.cleanups.push(rd({id:o,label:i,kind:qo?"asset":"source",profiler:ae.profiler}))),!u&&!Xo&&g.cleanups.push(nd(o,()=>({adapter:g.adapter,nodeId:g.adapter?.selection?.get()[0]??null})));const P=u?`${o}#chromeless-${++Mg}`:o;g.cleanups.push(od({id:P,label:i,contentClock:()=>g.contentSeconds,transportAdvances:()=>g.transportAdvances})),g.cleanups.push(re.shell.onViewportAction(L=>{switch(L.type){case"focus-selection":case"focus-scene":!g.session?.frame()&&g.session?.root&&V.focusOn(g.session.root);break;case"focus-entity":{const T=g.adapter?pi(g.adapter.hierarchy,L.id):null;T&&V.focusOn(T);break}case"snap-selection-to-floor":V.snapSelectionToFloor();break;case"set-view-preset":g.session?g.session.setViewPreset(L.preset==="perspective"?"isometric":L.preset,"view"):V.setViewPreset(L.preset);break;case"toggle-camera-view":g.session?.toggleCameraView();break;case"frame-all":!g.session?.frame(1,"all")&&g.session?.root?V.focusOn(g.session.root):g.session||V.focusOnScene();break;case"zoom-view":g.session?.cameraView()&&!g.session.cameraViewLocked()?g.session.zoomCameraView(L.direction>0?1.2:1/1.2):V.zoomStep(L.direction);break;case"step-view":if(g.session?.cameraView()&&!g.session.cameraViewLocked())break;V.stepView(L.step);break;case"toggle-projection":{const T=g.session;if(T?.cameraView())break;const be=(T?T.projection():V.projection)==="perspective"?"orthographic":"perspective";T?T.setProjection(be):V.setProjection(be);break}case"set-camera-pose":g.session?g.session.setCameraPose(L.position,L.target,L.fov):V.setPose(L.position,L.target,L.fov);break}}));let I="";g.cleanups.push(re.shell.subscribe(()=>{V.objectMap=re.objectMap,V.syncFromStore(),g.session?.syncSelectionPresentation();const L=(g.adapter?.selection?.get()??[]).join("\0");L!==I&&(I=L,u||Ia(o))}));const D=()=>{const L=Math.max(1,ye.clientWidth),T=Math.max(1,ye.clientHeight),J=Q.getPixelRatio();(Ge.width!==Math.floor(L*J)||Ge.height!==Math.floor(T*J))&&Q.setSize(L,T,!1),V.resize(L,T),g.session?.resize(L,T),g.rendererSession.redraw()},A=new ResizeObserver(D);A.observe(ye),g.cleanups.push(()=>A.disconnect()),D(),g.initialized=!0,Ba()}V.objectMap=re.objectMap,V.syncFromStore(),g.rendererSession.setActive(pt.current),g.rendererSession.redraw(),Zo=!0,ni?.dispose()}catch(De){if(!Zo)try{Jo?.()}finally{hr&&W.root.parent===he&&hr.add(W.root),mn.dispose()}console.error(`[object3d document] ${i}: source update failed`,De),Xe(De instanceof Error?De.message:String(De))}},Dc=bi.current.then(Hc);return bi.current=Dc.catch(Vt=>{Z||Xe(Vt instanceof Error?Vt.message:String(Vt))}),()=>{Z=!0}},[l,s,t,nn,on,an,i,o,Y,jo,Uo,cn,Go,ts,hn,u,f,ar,es,ln,c,n,a,x,oe,ut,_,e,dt]),k.useEffect(()=>{const Z=ir.current,it=d&&!Dt.current;Dt.current=d,Z&&(it&&(Ki.current=!1,Nh(o)),Z.setActive(d||dt))},[d,o,dt]);const lr=le.current,dn=sn==="ready"&&lr?.viewport?{store:lr.store,viewport:lr.viewport,canvas:lr.surface.canvas}:null,Nc=k.useCallback(()=>{const Z=or.current;return Z?{adapter:Z,nodeId:Z.selection?.get()[0]??Z.hierarchy.roots()[0]?.id??null}:null},[]),Wo=E.jsx("div",{"data-testid":"tool-object3d-authoring","data-volter-chromeless":u||void 0,className:Y?"volter-object3d-studio-stage":void 0,style:{position:u||xe?"relative":"absolute",...u?{width:"100%",height:"100%"}:xe?{flex:1,minHeight:0}:{inset:f?0:-Zn},overflow:"hidden",background:Y?void 0:Ot.surface.raised,pointerEvents:"auto"},children:E.jsxs("div",{ref:ei,style:{position:"absolute",inset:0,minHeight:0,overflow:"hidden"},children:[E.jsx(Cg,{canvasHostRef:ti}),d&&dn&&!u?E.jsx(k.Suspense,{fallback:null,children:E.jsx(vg,{stage:dn})}):null,j&&!u?E.jsx(cg,{store:j,documentId:o,stage:dn,active:d,chrome:"document"}):null,j&&No?E.jsx(No.Overlays,{store:j,documentId:o,cameraPreviewRef:Ho,mountStatus:kc,rootIds:Ic}):null,tn&&E.jsx("div",{role:"alert",style:{position:"absolute",insetInline:0,top:0,display:"flex",justifyContent:"center",padding:"var(--volter-space-3)",pointerEvents:"none"},children:E.jsxs("div",{className:"volter-chrome-island",style:{display:"flex",alignItems:"center",gap:"var(--volter-space-3)",maxWidth:"80%",padding:"var(--volter-space-2) var(--volter-space-3)",borderRadius:"var(--volter-radius-md)",border:`var(--volter-stroke-resting) solid ${Ot.semantic.danger}`,background:Ot.surface.raised,color:Ot.semantic.danger,pointerEvents:"auto"},children:[E.jsx("span",{children:tn}),E.jsx(di,{size:"compact","aria-label":"Dismiss",onClick:()=>Xe(null),"data-testid":"object3d-document-error-dismiss",children:E.jsx(Et,{icon:At.action.close})})]})}),!tn&&sn==="building"&&E.jsx(Hh,{testId:"object3d-document-status",children:Dh}),E.jsx("div",{style:{position:"absolute",inset:u||xe||f?0:Zn,pointerEvents:"none"},children:!u&&sn==="ready"&&le.current&&E.jsx(yg,{viewport:le.current.viewport,documentId:o,session:le.current.session,store:le.current.store.shell,projection:Do,displayName:i,...se?{statistics:se}:{},...ve!==void 0?{subject:ve}:{},...ee?{gridScale:ee}:{},objectName:Z=>(it=>it?pi(it.hierarchy,Z)?.name:void 0)(le.current?.adapter)??le.current?.store.objectMap.get(Z)?.name??null})})]})});return xe?E.jsx(Vh,{documentId:o,active:d,type:y??(ar?"entity":"model"),title:i,status:e,selection:Nc,fill:!0,children:E.jsxs("div",{className:"volter-object3d-asset-workspace",children:[Wo,E.jsx(Uh,{transport:le.current?.transport??null})]})}):Wo}function Ag(o){return E.jsx(Oc,{...o})}const Ug=Object.freeze(Object.defineProperty({__proto__:null,Object3DDocumentViewport:Oc,ToolObject3DAuthoring:Ag},Symbol.toStringTag,{value:"Module"}));export{Po as C,Jr as G,Oc as O,Vg as Q,Ug as S,q as V,dg as a,Nl as s,ng as t};
|