@volter/game-editor 0.5.65 → 0.5.66
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 +1962 -363
- package/catalog/entries/bake.json +0 -1
- package/catalog/entries/blender.json +2 -2
- package/catalog/entries/reflections.json +2 -4
- package/catalog/project-source/src/lib/bake/asset-seed.ts +1 -2
- package/catalog/project-source/src/lib/bake/clip-layering.ts +3 -4
- package/catalog/project-source/src/lib/bake/gltf-bake.ts +1 -1
- package/catalog/project-source/src/lib/bake/params.ts +3 -5
- package/catalog/project-source/src/lib/bake/rest-relative-animation.ts +2 -3
- package/dist/.vite/manifest.json +2406 -2182
- package/dist/assets/{AssetBudgetPanel-J9--TZPU.js → AssetBudgetPanel-csYWK2H4.js} +8 -8
- package/dist/assets/{AudioViewer-CR7333fe.js → AudioViewer-BH_LUYs5.js} +1 -1
- package/dist/assets/{BVHLoader-6bQIXhMX.js → BVHLoader-Jkzh8hMf.js} +1 -1
- package/dist/assets/BufferGeometryUtils-CAbuTPOA.js +1 -0
- package/dist/assets/{CCDIKSolver-CD7vLpsK.js → CCDIKSolver-D4NvkJ8d.js} +1 -1
- package/dist/assets/{CSS3DRenderer-CL7ABLVK.js → CSS3DRenderer-CAS2WZZy.js} +1 -1
- package/dist/assets/CanvasSceneViewport-BlsRTk-X.js +1 -0
- package/dist/assets/ColladaLoader-DxYB89DA.js +3 -0
- package/dist/assets/{ColorInput-DQBNrW-K.js → ColorInput-CPQNsDf1.js} +1 -1
- package/dist/assets/{ConvexGeometry-CAzXlPVG.js → ConvexGeometry-Dinf-sev.js} +1 -1
- package/dist/assets/{ConvexHull-BINCESFp.js → ConvexHull-CrJ8FY-w.js} +1 -1
- package/dist/assets/{DecalGeometry-160KRdfg.js → DecalGeometry-owkbefLa.js} +1 -1
- package/dist/assets/EffectComposer-BHDH-NLz.js +1 -0
- package/dist/assets/EntityModelDocument-DuQivdvc.js +1 -0
- package/dist/assets/EnvironmentAssetDocument-CnTEMn3A.js +1 -0
- package/dist/assets/FBXLoader-BMUbIhtE.js +1 -0
- package/dist/assets/Fbo-DrK7CWlB.js +1 -0
- package/dist/assets/{FontLoader-CvGoVI5a.js → FontLoader-BR_K6Baw.js} +2 -2
- package/dist/assets/GLTFExporter-BZqAQJbw.js +1 -0
- package/dist/assets/{GameplaySessionTimeline-B52W3FVZ.js → GameplaySessionTimeline-Crqwv2fP.js} +1 -1
- package/dist/assets/Gltf-7cVbZUzT.js +2 -0
- package/dist/assets/ImageViewer-BkFie7Hm.js +1 -0
- package/dist/assets/InspectorObjectPreview-Dl3tyJBn.js +1 -0
- package/dist/assets/JsonAssetDocument-BUFzubHM.js +2 -0
- package/dist/assets/{LineSegments2-CsOpKSiM.js → LineSegments2-Cicm_Hu1.js} +2 -2
- package/dist/assets/LiveModuleDocument-C3OQxiba.js +1 -0
- package/dist/assets/LutAssetDocument-DVzd1RZ9.js +1 -0
- package/dist/assets/{MTLLoader-_Xzd4_0p.js → MTLLoader-Bg_grNiT.js} +2 -2
- package/dist/assets/{MarchingCubes-Bsp4wrzd.js → MarchingCubes-a78AL3HB.js} +1 -1
- package/dist/assets/MeshBVH-BCSLNEeP.js +1 -0
- package/dist/assets/ModelAssetDocument-pN84goRT.js +1 -0
- package/dist/assets/{NonThreeAuthoringBootstrap-C3woOMxX.js → NonThreeAuthoringBootstrap-BKNejRiW.js} +1 -1
- package/dist/assets/{OBJLoader-BhIC6Hwo.js → OBJLoader-BiwzVj5b.js} +2 -2
- package/dist/assets/Object3DDocumentToolbar-D5Bg5FEf.js +1 -0
- package/dist/assets/Object3DDocumentViewport-DFHqru3a.js +2 -0
- package/dist/assets/Object3DPreview-BTtZ-41z.js +2 -0
- package/dist/assets/OnlineAssetDetail-BAqozdAp.js +1 -0
- package/dist/assets/{OrbitControls-DLpayAaK.js → OrbitControls-CzKVCORl.js} +1 -1
- package/dist/assets/{OrbitControls-CM3bPray.js → OrbitControls-CzTRRI7x.js} +1 -1
- package/dist/assets/{OrthographicCamera-bQozawrh.js → OrthographicCamera-CSDDsvu7.js} +1 -1
- package/dist/assets/{PLYLoader-DYQqs5Ik.js → PLYLoader-QxrxxMpE.js} +2 -2
- package/dist/assets/{PerspectiveCamera-CQ2lh01o.js → PerspectiveCamera-DzD_NfVh.js} +1 -1
- package/dist/assets/PlayBar-qVJpgwJt.js +2 -0
- package/dist/assets/QuarksAssetDocument-B4vBlUsS.js +2 -0
- package/dist/assets/RGBELoader-WQ7xZofE.js +1 -0
- package/dist/assets/RectAreaLightUniformsLib-CwcuoVqt.js +1 -0
- package/dist/assets/{RenderPass-DPrn-Uky.js → RenderPass-C_CeQNdh.js} +1 -1
- package/dist/assets/{ResolutionPicker-C67vs1F3.js → ResolutionPicker-DpHVJxn5.js} +1 -1
- package/dist/assets/RootSelectionOverlay-BxvsunO4.js +1 -0
- package/dist/assets/{RoundedBox-BDGBg6QZ.js → RoundedBox-B_cZ0NFy.js} +1 -1
- package/dist/assets/{RoundedBoxGeometry-CyUuYPfW.js → RoundedBoxGeometry-Y4rcSIvX.js} +1 -1
- package/dist/assets/STLLoader-Bej_Nkpr.js +1 -0
- package/dist/assets/{SelectionBox-D_75KrNW.js → SelectionBox-Cn9vm7f9.js} +1 -1
- package/dist/assets/ShaderAssetDocument-Dx2x8CLr.js +12 -0
- package/dist/assets/{ShaderPass-QYRpPuFJ.js → ShaderPass-qtkA7CQ8.js} +1 -1
- package/dist/assets/{ShadowEditor-DkImwu1Y.js → ShadowEditor-BEIUkrHL.js} +1 -1
- package/dist/assets/SimplifyModifier-D2EesGr2.js +1 -0
- package/dist/assets/{SkeletonUtils-Cps8GOC6.js → SkeletonUtils-C8ayciDc.js} +1 -1
- package/dist/assets/{Sky-CQKCgYDs.js → Sky-BBpnAJZV.js} +1 -1
- package/dist/assets/SourceAssetViewer-BpMbbuy6.js +1 -0
- package/dist/assets/StageHost-lB8f---y.js +2 -0
- package/dist/assets/{StoryPreviewMount-DjyxRCXu.js → StoryPreviewMount-BIfxmkYh.js} +1 -1
- package/dist/assets/{TDSLoader-D_T8XJ81.js → TDSLoader-rHl5Uwc0.js} +1 -1
- package/dist/assets/{TextGeometry-DOWAEUV0.js → TextGeometry-BRHSufuM.js} +1 -1
- package/dist/assets/ThreeBoardDocument-BHV92Ia3.js +2 -0
- package/dist/assets/{ThreeIsolationSceneContent-C8C8whSF.js → ThreeIsolationSceneContent-BqtgDHBK.js} +1 -1
- package/dist/assets/{ToolObject3DPreview-BRoDWe4Q.js → ToolObject3DPreview-CcaPJTyH.js} +1 -1
- package/dist/assets/Toolbar-keHcSvDD.js +1 -0
- package/dist/assets/{TrackballControls-DfznuQTh.js → TrackballControls-Cce-6Ff5.js} +1 -1
- package/dist/assets/{TransientHint-BB1fwrvK.js → TransientHint-Dlslh3oX.js} +1 -1
- package/dist/assets/{UnrealBloomPass-CR-cS_K5.js → UnrealBloomPass-DiseEiFK.js} +2 -2
- package/dist/assets/{VideoViewer-C6kocgIU.js → VideoViewer-naGSXHd6.js} +1 -1
- package/dist/assets/ViewportShadingMenu-C7Hdhtca.js +1 -0
- package/dist/assets/{active-ingest-CT6jSGhr.js → active-ingest-DEgq9JiA.js} +3 -3
- package/dist/assets/{animation-clock-CnjZqfJp.js → animation-clock-lTIb6nk3.js} +1 -1
- package/dist/assets/animation-mixers.service-2O2rVwQf.js +1 -0
- package/dist/assets/asset-budget-asset.menu-9NhdHAC9.js +1 -0
- package/dist/assets/asset-budget.action-yg6-luUJ.js +1 -0
- package/dist/assets/asset-budget.document-B46_VFqa.js +1 -0
- package/dist/assets/asset-budget.menu-DuH07N-e.js +1 -0
- package/dist/assets/{asset-editor-persistence-BBaONOJt.js → asset-editor-persistence-BVtzjadu.js} +1 -1
- package/dist/assets/{asset-loaders-BOy5Ss8k.js → asset-loaders-BxG1LykH.js} +2 -2
- package/dist/assets/{assets-BuSoGjBX.js → assets-Do88ZdV_.js} +1 -1
- package/dist/assets/{audio-unlock.service-CfUgUQVy.js → audio-unlock.service-BJH0mWvX.js} +1 -1
- package/dist/assets/{audio.utility-C6K6jem8.js → audio.utility-Cp4aVYFU.js} +1 -1
- package/dist/assets/autoplay.service-FxpRy7Ev.js +1 -0
- package/dist/assets/{babylon-authoring-adapter-CL02gWDn.js → babylon-authoring-adapter-B_8iE8fK.js} +1 -1
- package/dist/assets/{binding-resolver-Dsh-6Vor.js → binding-resolver-BWwG10zJ.js} +2 -2
- package/dist/assets/blender-emscripten-engine-CEsWgnR7.js +2 -0
- package/dist/assets/{blender-node-editor.document-iIDkB9sI.js → blender-node-editor.document-DTgwy8KC.js} +1 -1
- package/dist/assets/blender-properties-tab-DWSJpkxq.js +3 -0
- package/dist/assets/blender-runtime-host-OGjPjTrG.js +4 -0
- package/dist/assets/{blender-runtime-skin-DyQ9B6CR.js → blender-runtime-skin-DymtXlpt.js} +37 -39
- package/dist/assets/blender-runtime.document-CzH2ohHR.js +8 -0
- package/dist/assets/{blender-timeline.document-77fx96N7.js → blender-timeline.document-BRy_QPHt.js} +1 -1
- package/dist/assets/{blender-uv-editor.document-fsT7B4gV.js → blender-uv-editor.document-D-AbUCqz.js} +1 -1
- package/dist/assets/{blender-version.status-o6dBm3n6.js → blender-version.status-B7flzX_7.js} +1 -1
- package/dist/assets/{blender-wali-engine-wTOcrOMC.js → blender-wali-engine-D3iKpzn9.js} +1 -1
- package/dist/assets/blender.command-BVHtgTQy.js +1 -0
- package/dist/assets/blender.environment-CG-pC7sk.js +1 -0
- package/dist/assets/{blender.style-Dcem5f_T.js → blender.style-CxfbTFcE.js} +1 -1
- package/dist/assets/{board-guides-DziKSTss.js → board-guides-C3usUZZk.js} +1 -1
- package/dist/assets/body-marks-D8iaje6y.js +1 -0
- package/dist/assets/bridge.command-BF9u6r0A.js +3 -0
- package/dist/assets/browserAll-38aBu-cf.js +1 -0
- package/dist/assets/{build-profiles.document-kW8iw8Xj.js → build-profiles.document-DO7oNRuo.js} +2 -2
- package/dist/assets/{build-progress.status-BNRLytg2.js → build-progress.status-COeNVhYd.js} +1 -1
- package/dist/assets/{build-session-C_sg3CEn.js → build-session-IWIriS5P.js} +1 -1
- package/dist/assets/{build.action-lYjTLb7K.js → build.action-DlkFvZf6.js} +1 -1
- package/dist/assets/{build.command-DIGgUPU_.js → build.command-DPqQIYj_.js} +1 -1
- package/dist/assets/{build.header-CKajx5U3.js → build.header-CNLG-pV8.js} +1 -1
- package/dist/assets/{build.menu-BdU0QXny.js → build.menu-hUlH6loi.js} +1 -1
- package/dist/assets/{build.service-CbBAyeu3.js → build.service-C86Td3_9.js} +1 -1
- package/dist/assets/{camera-KEsKvOL7.js → camera-CKbyBXMe.js} +1 -1
- package/dist/assets/camera-authoring-Ci3KnE-W.js +1 -0
- package/dist/assets/{camera-runtime.inspector-B7unX4g1.js → camera-runtime.inspector-DdR3P2BF.js} +1 -1
- package/dist/assets/canvas-entry-runtime-E5YjSgre.js +2 -0
- package/dist/assets/canvas-preview-frames-CiAx7dpV.js +1 -0
- package/dist/assets/{capability-coverage-Czas4C18.js → capability-coverage-CfUeULDN.js} +5 -5
- package/dist/assets/city-EkhAOo5s.exr +0 -0
- package/dist/assets/{collaboration-presence-DLoZ7EA3.js → collaboration-presence-CSLFNT7m.js} +1 -1
- package/dist/assets/{collider-Bw0mXlsW.js → collider-DRSaLRM9.js} +1 -1
- package/dist/assets/{component-board.service-DCwcUssB.js → component-board.service-B7Sv8b7m.js} +2 -2
- package/dist/assets/component-board.service-B8UHw8dn.js +2 -0
- package/dist/assets/component-contracts.service-LFGekycZ.js +1 -0
- package/dist/assets/{component-verbs.command-7xzfjGMZ.js → component-verbs.command-D4SvFjfG.js} +1 -1
- package/dist/assets/component-verbs.service-TGvWxf2b.js +1 -0
- package/dist/assets/{config-CEZk921y.js → config-DB_RH-hO.js} +3 -3
- package/dist/assets/{configurations-DTBMdaTL.js → configurations-C2qgJNnW.js} +1 -1
- package/dist/assets/{connection.status-BifnQdOs.js → connection.status-CG7X2brL.js} +1 -1
- package/dist/assets/{console-bridge-CHcb-xk5.js → console-bridge-B5Ltae37.js} +1 -1
- package/dist/assets/{constraint-De8f1Uiq.js → constraint-C_Jj7dXy.js} +1 -1
- package/dist/assets/constraints.inspector-D6QZJS4b.js +1 -0
- package/dist/assets/courtyard-DqlebbpC.exr +0 -0
- package/dist/assets/coverage.service-Clo86874.js +3 -0
- package/dist/assets/{create-runtime-CVCc1BDx.js → create-runtime-lmA910XT.js} +1 -1
- package/dist/assets/{curve-7Q79VgU4.js → curve-6-TR6dNb.js} +1 -1
- package/dist/assets/{data-asset-4hjS642k.js → data-asset-BNbd309U.js} +1 -1
- package/dist/assets/{data-ref-CQI28C0D.js → data-ref-Dvmd7eb1.js} +1 -1
- package/dist/assets/{debug-bridge-CCohG-d-.js → debug-bridge-BUNhgyY6.js} +1 -1
- package/dist/assets/{debug-registry-Dgvitx8M.js → debug-registry-B3Cnne3x.js} +1 -1
- package/dist/assets/deferred-ingest-play-7V8OrW3e.js +2 -0
- package/dist/assets/design-time-layers-g9VS6amb.js +1 -0
- package/dist/assets/design-time-mount.service-HtMr_vBd.js +2 -0
- package/dist/assets/design-time-react-mount-Dx6fJ-Hg.js +1 -0
- package/dist/assets/{directional-shadow-fit-BVkOKAv2.js → directional-shadow-fit-Cjz_Eg2b.js} +1 -1
- package/dist/assets/{document-preview-three-Kbg2GCLm.js → document-preview-three-C3y0syYQ.js} +1 -1
- package/dist/assets/{dom-authoring-adapter-CY8C7f4T.js → dom-authoring-adapter-CEeFyatF.js} +1 -1
- package/dist/assets/{draco3d-BBUTcNkz.js → draco3d-FKy0apkb.js} +1 -1
- package/dist/assets/drei-asset-caches-jJoHXbTj.js +2 -0
- package/dist/assets/{edit-mode-audio.service-Bzetwd5B.js → edit-mode-audio.service-DZTnrW6t.js} +1 -1
- package/dist/assets/edit-mode-authoring-D_BiHCQj.js +1 -0
- package/dist/assets/{edit-mode-networking.service-YCX6RRb_.js → edit-mode-networking.service-BzMI2VxO.js} +1 -1
- package/dist/assets/editor-api-Bzmo0o8_.js +1 -0
- package/dist/assets/{entry-adjudication-Cq8Yeb74.js → entry-adjudication-BYy7TXOB.js} +1 -1
- package/dist/assets/{events-156d8d12.esm-ErOhDXXB.js → events-156d8d12.esm-C734MYnx.js} +7 -7
- package/dist/assets/{extend-B-eOccUm.js → extend-CLG0ymiX.js} +1 -1
- package/dist/assets/forest-P_CQY3b_.exr +0 -0
- package/dist/assets/fork-menu-De7HU6_H.js +1 -0
- package/dist/assets/{frame-debugger-store-D1Mf_5up.js → frame-debugger-store-BZgIOlU6.js} +1 -1
- package/dist/assets/{game-DHOZVb-7.js → game-D5EJoILQ.js} +1 -1
- package/dist/assets/{game-contract-seams-a5YXejOu.js → game-contract-seams-TCpIMmHP.js} +1 -1
- package/dist/assets/{game-css-scope-transform-Eng4wS8E.js → game-css-scope-transform-NbpajQr-.js} +1 -1
- package/dist/assets/game-document.service-6eRlrI-d.js +1 -0
- package/dist/assets/game-eval.command-hKnSMlX0.js +2 -0
- package/dist/assets/{game-input-seams-CIQdetRw.js → game-input-seams-BC6xhZy3.js} +1 -1
- package/dist/assets/{game-module-access-B2mFxv-i.js → game-module-access-ry3xb1Ix.js} +1 -1
- package/dist/assets/{gameplay-export-BoKXm51x.js → gameplay-export-DiLQuPpn.js} +1 -1
- package/dist/assets/gameplay-replay-Bsre-1K8.js +1 -0
- package/dist/assets/{gameplay-rng-trap-CTNhm-UW.js → gameplay-rng-trap-BhRx_CtU.js} +1 -1
- package/dist/assets/gameplay.command-BqiyGn-I.js +1 -0
- package/dist/assets/{generation-jobs-BQrXbGp_.js → generation-jobs-BYcpgeGk.js} +1 -1
- package/dist/assets/generation.service-O81IqA-6.js +1 -0
- package/dist/assets/{generations-DzUogZsM.js → generations-CsGQ3twi.js} +1 -1
- package/dist/assets/{generations.status-CgOUBCum.js → generations.status-C3YU0_ml.js} +1 -1
- package/dist/assets/godot.style-DxJaFWOP.js +1 -0
- package/dist/assets/godot.view-BFsHk8b2.js +1 -0
- package/dist/assets/{hosted-asset-materialization-CiIvWkGU.js → hosted-asset-materialization-Bk-plQF6.js} +2 -2
- package/dist/assets/{ibl-override-material-BlmCxFKq.js → ibl-override-material-BhbGwgS1.js} +1 -1
- package/dist/assets/{index-mjWQmGhM.js → index-0n9eSzwT.js} +1 -1
- package/dist/assets/index-B4bmKkgY.css +1 -0
- package/dist/assets/index-BLo2LE8C.js +3404 -0
- package/dist/assets/index-BWW4-DBH.js +1 -0
- package/dist/assets/index-CLcsjKUs.js +1 -0
- package/dist/assets/index-CU5YUq-x.js +134 -0
- package/dist/assets/{index-DUpHH6JR.js → index-Cb6o_Td_.js} +1 -1
- package/dist/assets/index-Ckxb31Yz.js +1500 -0
- package/dist/assets/index-CnpsJMao.js +1 -0
- package/dist/assets/index-Cr23XhNm.js +1 -0
- package/dist/assets/index-DO1rWQ_r.js +487 -0
- package/dist/assets/{index-BcCBqgM_.js → index-DUh02lTr.js} +1 -1
- package/dist/assets/index-DXEHfb0b.js +1 -0
- package/dist/assets/{index-V1R-e5Bd.js → index-wRCvCebM.js} +1 -1
- package/dist/assets/{inference-diagnostics-Dhmtfbq_.js → inference-diagnostics-YW0yJkKx.js} +1 -1
- package/dist/assets/{ingest-BbYMC2vQ.js → ingest-BlQnR7s3.js} +1 -1
- package/dist/assets/ingest-boot-viewport-uG9jQ1zm.js +1 -0
- package/dist/assets/ingest-siblings-DRQXSWax.js +1 -0
- package/dist/assets/{ingest-source-persistence-C_6Hiyra.js → ingest-source-persistence-DH6ioCOu.js} +1 -1
- package/dist/assets/{ingest.service-BTDnQfM1.js → ingest.service-GeaWMaZX.js} +1 -1
- package/dist/assets/{input-manager-DH_hGW6d.js → input-manager-Cxx3RJgG.js} +1 -1
- package/dist/assets/{input-router-BNQvtIqw.js → input-router-FzxO5ld6.js} +1 -1
- package/dist/assets/{inspect-BZfi3mmo.js → inspect-BRgDdtVk.js} +1 -1
- package/dist/assets/instances.command-CFOMPSj3.js +1 -0
- package/dist/assets/{instruments-CKR02Y8I.js → instruments-IKn-vvNb.js} +1 -1
- package/dist/assets/interior-Bo_lba15.exr +0 -0
- package/dist/assets/{json-history-resource-BbxllWfV.js → json-history-resource-r-9q_hxP.js} +1 -1
- package/dist/assets/{light-D-_wsKTq.js → light-CFAor97k.js} +1 -1
- package/dist/assets/light-camera-factory-D1sgz3YB.js +1 -0
- package/dist/assets/live-mixers-BRkRHd6g.js +1 -0
- package/dist/assets/{loader-CaF_I7Yt.js → loader-BbMsvIxP.js} +1 -1
- package/dist/assets/machine.document-CgmsOh-s.js +24 -0
- package/dist/assets/machines.finder-nxiCgQc2.js +1 -0
- package/dist/assets/matcap-texture-Dh65bX5V.js +1 -0
- package/dist/assets/{material-CpAdjDxn.js → material-D5kXEZWQ.js} +1 -1
- package/dist/assets/{material-factory-Bz6h__6g.js → material-factory-0Qb0VuZ5.js} +1 -1
- package/dist/assets/material-preview.view-DqNcpd_b.js +1 -0
- package/dist/assets/{mesh-B3WPtNKO.js → mesh-BKPgNTwh.js} +1 -1
- package/dist/assets/{mesh-shadow-CZnXrw_l.js → mesh-shadow-BDQP4mHs.js} +1 -1
- package/dist/assets/model-asset-sections.service-DWPLmkqa.js +1 -0
- package/dist/assets/model-inspection-Cxfg_Fei.js +1 -0
- package/dist/assets/model.layout-BpZE1W9V.js +1 -0
- package/dist/assets/{models.finder-G2jQgIRu.js → models.finder-DHW17ZEa.js} +1 -1
- package/dist/assets/module-mode-CRfHyIMS.js +2 -0
- package/dist/assets/mount-canvas-ingest-root-BZZ8M3Lu.js +2 -0
- package/dist/assets/mount-dom-ingest-root-D1GV6Jjt.js +2 -0
- package/dist/assets/{mount-game-6t9cKNo4.js → mount-game-F9e76auh.js} +1 -1
- package/dist/assets/mount-ingest-root-B5D-Lmmk.js +2 -0
- package/dist/assets/{mount-manifest-CGVxhmAw.js → mount-manifest-cYRhgHfo.js} +1 -1
- package/dist/assets/mount-three-ingest-root-BNnouaBn.js +1 -0
- package/dist/assets/{mounted-authoring-Dmg5xmhP.js → mounted-authoring-TIN5EnCb.js} +1 -1
- package/dist/assets/{mounted-story-viewport-source-DjP6RA9U.js → mounted-story-viewport-source-CAlEmE0_.js} +1 -1
- package/dist/assets/{native-debug-module-CWicoSGD.js → native-debug-module-j-MekcLS.js} +1 -1
- package/dist/assets/{navigation-CIiCx-SM.js → navigation-DmR1BDVo.js} +1 -1
- package/dist/assets/{navmesh.menu-CAKiH8PW.js → navmesh.menu-FhL1pGx1.js} +1 -1
- package/dist/assets/{navmesh.service-jgDWlgj1.js → navmesh.service-usyDeJlm.js} +1 -1
- package/dist/assets/{network.utility-CEu5nHf7.js → network.utility-BPh4hTmh.js} +1 -1
- package/dist/assets/night-CvV4Gybt.exr +0 -0
- package/dist/assets/{object3d-authoring-subject-CH5sI2oP.js → object3d-authoring-subject-CyE4rQ2A.js} +1 -1
- package/dist/assets/oid-transform-BOqL6YH6.js +2 -0
- package/dist/assets/{particles-Y626p22p.js → particles-C47L-dda.js} +1 -1
- package/dist/assets/particles-factory-CRqPLdS7.js +1 -0
- package/dist/assets/pixi-authoring-adapter-C5Ikqj5-.js +1 -0
- package/dist/assets/{pixi-live-write-target-DuWydlWb.js → pixi-live-write-target-OWBk79dp.js} +1 -1
- package/dist/assets/pixi-primitive-D5igywJ_.js +1 -0
- package/dist/assets/pixi-react-root-factory-9lZ0Yz-n.js +1 -0
- package/dist/assets/play-mode-DomOvQie.js +22 -0
- package/dist/assets/play.command-DoqjH-Pp.js +2 -0
- package/dist/assets/{playtest-BXIL1JEF.js → playtest-BnFenMBW.js} +1 -1
- package/dist/assets/{pose-guard-6Osb2cFu.js → pose-guard-Bb3gZOzk.js} +1 -1
- package/dist/assets/{product-DFhyARJj.js → product-CTDJoVo5.js} +1 -1
- package/dist/assets/{profiler.action-CaXJDp3t.js → profiler.action-C_OFGkDw.js} +1 -1
- package/dist/assets/{profiler.menu-BIMF6Bi4.js → profiler.menu-BJbnVoo4.js} +1 -1
- package/dist/assets/{profiler.utility-BExw9wBO.js → profiler.utility-qpfhuwRw.js} +1 -1
- package/dist/assets/project-authoring-session-BV-MM8Fl.js +2 -0
- package/dist/assets/{project-provenance-BoP3nrle.js → project-provenance-4ldz-EOG.js} +1 -1
- package/dist/assets/{properties-bone-constraints.inspector-ByT6p7S-.js → properties-bone-constraints.inspector-C-ByIdg1.js} +1 -1
- package/dist/assets/{properties-bone.inspector-z4qJwKO5.js → properties-bone.inspector-CXY0xCQB.js} +1 -1
- package/dist/assets/{properties-collection.inspector-D0_3ijWU.js → properties-collection.inspector-DIfkZAel.js} +1 -1
- package/dist/assets/{properties-constraints.inspector-CESzjuls.js → properties-constraints.inspector-BaunL5nT.js} +1 -1
- package/dist/assets/{properties-data.inspector-hG8Wgyzb.js → properties-data.inspector-DQD-jfO2.js} +1 -1
- package/dist/assets/{properties-material.inspector-CzY0JCQ6.js → properties-material.inspector-A0HZ4SX6.js} +1 -1
- package/dist/assets/{properties-modifiers.inspector-3dDhwf7g.js → properties-modifiers.inspector-GUnVhVwZ.js} +1 -1
- package/dist/assets/{properties-object.inspector-CiarfxkT.js → properties-object.inspector-Chsfa4Xa.js} +1 -1
- package/dist/assets/{properties-output.inspector-DKJxmKSD.js → properties-output.inspector-U7ZmD0Me.js} +1 -1
- package/dist/assets/{properties-particles.inspector-CCEdYWGm.js → properties-particles.inspector-umkW-OlI.js} +1 -1
- package/dist/assets/{properties-physics.inspector-B2c0KUyA.js → properties-physics.inspector-CLVBlWwL.js} +1 -1
- package/dist/assets/{properties-render.inspector-Bcm0HLRW.js → properties-render.inspector-D0u9taKy.js} +1 -1
- package/dist/assets/{properties-scene.inspector-PIM_eTb_.js → properties-scene.inspector-JwGCZQAx.js} +1 -1
- package/dist/assets/{properties-texture.inspector-CgFlnyr8.js → properties-texture.inspector-B1vC28pw.js} +1 -1
- package/dist/assets/{properties-view-layer.inspector-DGjF_Aqo.js → properties-view-layer.inspector-BuUKyBFp.js} +1 -1
- package/dist/assets/{properties-world.inspector-CrMvaRvB.js → properties-world.inspector-VXUj4dT4.js} +1 -1
- package/dist/assets/r3f-design-session-qJ2v5SrB.js +2 -0
- package/dist/assets/r3f-physics-binding-C8OqNRG2.js +1 -0
- package/dist/assets/{r3f-root-factory-z9llD1OU.js → r3f-root-factory-DjGnbU4n.js} +1 -1
- package/dist/assets/r3f-source-authoring-adapter-CG9heazM.js +12 -0
- package/dist/assets/{rapier-physics-bridge-CMoeVo3Y.js → rapier-physics-bridge-B-EK7KYV.js} +1 -1
- package/dist/assets/react-inspector.service-DWeXDHJq.js +1 -0
- package/dist/assets/{react-root-CEz5NTck.js → react-root-DGLRLr-F.js} +1 -1
- package/dist/assets/react-story-board-CSqHY0Cg.js +1 -0
- package/dist/assets/{react-three-fiber.esm-CycrbDlA.js → react-three-fiber.esm-BxIoqVh1.js} +1 -1
- package/dist/assets/{react-three-rapier.esm-CEfKpvxT.js → react-three-rapier.esm-BYzLhdSV.js} +1 -1
- package/dist/assets/react-world-authoring-adapter-BMT9kLWU.js +1 -0
- package/dist/assets/{realm-services-CobQsq_X.js → realm-services-D25JHoqD.js} +1 -1
- package/dist/assets/{reflection-probe-Don-M3Fj.js → reflection-probe-CqXWlicu.js} +1 -1
- package/dist/assets/{reflection-probe-capture.inspector-CmFUoJCx.js → reflection-probe-capture.inspector-B7Qa30vB.js} +1 -1
- package/dist/assets/regions-DWeEBnE2.js +1 -0
- package/dist/assets/{register-render-vitals-BiZk29b2.js → register-render-vitals-BO7x64kR.js} +1 -1
- package/dist/assets/{registry-02YZjMNp.js → registry-DlTluc4x.js} +1 -1
- package/dist/assets/{render-audio-control-vMRlePWb.js → render-audio-control-DCa_bOBI.js} +1 -1
- package/dist/assets/{render-batch-system-0vq7p0VC.js → render-batch-system-CzCp9YKM.js} +1 -1
- package/dist/assets/{render-control-Df3yTiyr.js → render-control-BNQr1eNO.js} +1 -1
- package/dist/assets/{render-env-D2IV2x5k.js → render-env-emvlfeTG.js} +1 -1
- package/dist/assets/{render-features-CPQ_e568.js → render-features-COF7MSQ9.js} +1 -1
- package/dist/assets/{render-settings-Bw4W9SYF.js → render-settings-C_kIMq8Y.js} +1 -1
- package/dist/assets/{resolve-three-SZE_WWUM.js → resolve-three-C-nx-QdA.js} +13 -13
- package/dist/assets/{root-seam-contract-Z0VWX3Bk.js → root-seam-contract-C7GOxf5x.js} +1 -1
- package/dist/assets/{run-ticks-settled-C4ksViyA.js → run-ticks-settled-B0cTtmhQ.js} +1 -1
- package/dist/assets/{scene-capture-CGYF-Viw.js → scene-capture-CLOc7GXc.js} +1 -1
- package/dist/assets/{scene-capture-BQKzU0NT.js → scene-capture-D10Nxkvp.js} +1 -1
- package/dist/assets/scene-document.service-B7kAVTko.js +2 -0
- package/dist/assets/{scene-framing-Cat0GtyJ.js → scene-framing-50N7SKuX.js} +1 -1
- package/dist/assets/{scene-index-B6BZOHMk.js → scene-index-Bce459yu.js} +1 -1
- package/dist/assets/{scene-query-C7_N-TpI.js → scene-query-IUZhw6pA.js} +1 -1
- package/dist/assets/{schema-kl9-2B_J.js → schema-Iy-mbzll.js} +1 -1
- package/dist/assets/sculpt.layout-D-K5cLw6.js +1 -0
- package/dist/assets/{seeded-random-i3mtgBKZ.js → seeded-random-CN0scLZj.js} +1 -1
- package/dist/assets/{session-CZ5JPg-z.js → session-CsR0lApe.js} +24 -15
- package/dist/assets/{setup-audio-S8GQF91f.js → setup-audio-BJ18gvXZ.js} +1 -1
- package/dist/assets/setup-particles-B6H-GbAA.js +1 -0
- package/dist/assets/{setup-physics-BeZ7-LKD.js → setup-physics-GugbTT0J.js} +1 -1
- package/dist/assets/{setup-renderer-DVXaSGin.js → setup-renderer-wt_a-p8r.js} +20 -20
- package/dist/assets/shading.layout-CZZHKBer.js +1 -0
- package/dist/assets/{sim-clock-CLflx7kg.js → sim-clock-DEfbb_-P.js} +1 -1
- package/dist/assets/{soft-particle-depth-DGvfQDi1.js → soft-particle-depth-CKUS1j0Y.js} +1 -1
- package/dist/assets/source-object3d-authoring-adapter-CfHQLFAL.js +1 -0
- package/dist/assets/{source-persistence-backend-C-aR-B_Y.js → source-persistence-backend-_-JMEXxE.js} +1 -1
- package/dist/assets/{spark-renderer-lifecycle-ynWESJcv.js → spark-renderer-lifecycle-9mnMW3Z4.js} +1 -1
- package/dist/assets/{spark.module-4pXQoz5d.js → spark.module-CXth-y_a.js} +1 -1
- package/dist/assets/stage-keyboard-C0FdDLOQ.js +1 -0
- package/dist/assets/stage-overlay-set-CwhCzbOy.js +1 -0
- package/dist/assets/stage-presence-markers-DVMDKiB-.js +1 -0
- package/dist/assets/stage-transform-tools-B09Z7v0o.js +1 -0
- package/dist/assets/standard-viewport-dressing-GUUr6GuK.js +20 -0
- package/dist/assets/{state-watch.action-BOvQR2qt.js → state-watch.action-CgF8qoFC.js} +1 -1
- package/dist/assets/{state-watch.menu-CNLvDeeY.js → state-watch.menu-CIMncESW.js} +1 -1
- package/dist/assets/{state-watch.utility-Bg1tTTQU.js → state-watch.utility-zTHkUALC.js} +1 -1
- package/dist/assets/static-batch-advisor-DqfXWRUq.js +1 -0
- package/dist/assets/story-capture-COQgezzl.js +1 -0
- package/dist/assets/story-documents-DQ0KORmd.js +3 -0
- package/dist/assets/story-documents.service-DOSaqPqv.js +1 -0
- package/dist/assets/story-documents.service-Gb7oUkbg.js +1 -0
- package/dist/assets/{story-media-presence-BHzk2IV5.js → story-media-presence-nW3zJqKv.js} +1 -1
- package/dist/assets/story-pixi-preview-COPTEsHo.js +1 -0
- package/dist/assets/story-presentation-CxADj5oz.js +1 -0
- package/dist/assets/{story-three-preview-BHEDZzcl.js → story-three-preview-C9W__8Or.js} +2 -2
- package/dist/assets/{structural-ids-Dc-7rEwi.js → structural-ids-CblajJQK.js} +1 -1
- package/dist/assets/studio-CysTBGIb.exr +0 -0
- package/dist/assets/sunrise-Dj0psFrf.exr +0 -0
- package/dist/assets/sunset-Bw3x2Bot.exr +0 -0
- package/dist/assets/{surface-state-DaxyruCj.js → surface-state-BAUJu6GY.js} +1 -1
- package/dist/assets/{system-runner-DkOjxEBt.js → system-runner-D_DtVrer.js} +1 -1
- package/dist/assets/team-playtest.service--79O6xkx.js +1 -0
- package/dist/assets/{three-CDSueJyJ.js → three-DSsr_Lvp.js} +1 -1
- package/dist/assets/{three-authoring-adapter-CmSQ3Vui.js → three-authoring-adapter-Yqsank46.js} +1 -1
- package/dist/assets/three-authoring.service-BDos-bRt.js +2 -0
- package/dist/assets/{three-ingest-runtime-QzDYk6tU.js → three-ingest-runtime-DWijtqQ8.js} +1 -1
- package/dist/assets/{three-projection-core-BmKMZ-nf.js → three-projection-core-kubBTx0s.js} +1 -1
- package/dist/assets/three-story-model-BraQFA9h.js +1 -0
- package/dist/assets/three-viewport-presentation-BL7Uc2i6.js +1 -0
- package/dist/assets/{three.module-D396a9Mn.js → three.module-IFn-4i31.js} +1 -1
- package/dist/assets/three.quarks.esm-CRKGjKAH.js +1039 -0
- package/dist/assets/transform-mode-request-Cu7ewbtr.js +1 -0
- package/dist/assets/{transform-writer-BhBBTx33.js → transform-writer-DXxrI4t7.js} +1 -1
- package/dist/assets/transport.header-CeND8Vzh.js +1 -0
- package/dist/assets/{trigger-volume-BNK2XzPL.js → trigger-volume-BCVRS3NM.js} +1 -1
- package/dist/assets/{tuples-CIQ4Bn1U.js → tuples-DKDGrN1t.js} +1 -1
- package/dist/assets/ui-board-document-DD2CAEAo.js +2 -0
- package/dist/assets/unity.style-vCmLw4gI.js +1 -0
- package/dist/assets/unity.view-DIn2S6Do.js +1 -0
- package/dist/assets/unreal.style-BQn-HhOX.js +1 -0
- package/dist/assets/unreal.view-adNBETZK.js +1 -0
- package/dist/assets/user-data-CZqsJDk-.js +1 -0
- package/dist/assets/{utility-view-state-BHypxA33.js → utility-view-state-DYJY8V8O.js} +1 -1
- package/dist/assets/uv-editing.layout-A8RA-cbM.js +1 -0
- package/dist/assets/{vgai-shared-three-Bc5PvpLM.js → vgai-shared-three-D_RAEumG.js} +1 -1
- package/dist/assets/{viewport-root-presentation-CWsE56K6.js → viewport-root-presentation-C9M98VNM.js} +1 -1
- package/dist/assets/{viewport-shading-BuA88e_A.js → viewport-shading-BzcvgJhK.js} +1 -1
- package/dist/assets/viewport-shading-boundary-CBvvzS-p.js +84 -0
- package/dist/assets/{viewport-surface-status-B3om4Kcf.js → viewport-surface-status-BFmnWp7z.js} +1 -1
- package/dist/assets/voxel-surface-ROWYug7H.js +1 -0
- package/dist/assets/webgl-frame-capture-CRKX73E9.js +1 -0
- package/dist/assets/webworkerAll-CehoCtFb.js +1 -0
- package/dist/assets/{worker-UrMcrc5_.js → worker-B7zhIsFh.js} +2 -2
- package/dist/assets/world-documents-DErHq15h.js +1 -0
- package/dist/assets/world-root-stage-binding-BIymcQ4K.js +1 -0
- package/dist/assets/{world-state-BWG-IcOd.js → world-state-ZGDGY_Xl.js} +1 -1
- package/dist/assets/{writer-B-KovzkA.js → writer-BPbm4_my.js} +5 -5
- package/dist/assets/xstate-animation-binding-Cvd4JbEY.js +1 -0
- package/dist/assets/{xstate-animation-meta-Q3u9zh_m.js → xstate-animation-meta-B3OZR8Q2.js} +1 -1
- package/dist/vgai-shared-three.json +1 -1
- package/dist-node/cli.js +317 -73
- package/dist-node/create.js +59 -19
- package/package.json +16 -13
- package/src/index.ts +6 -0
- package/template/.agents/skills/vgai-3d-models/SKILL.md +3 -3
- package/template/.agents/skills/vgai-threejs-authoring/SKILL.md +4 -9
- package/template/.claude/skills/vgai-3d-models/SKILL.md +3 -3
- package/template/.claude/skills/vgai-threejs-authoring/SKILL.md +4 -9
- package/template/.github/skills/vgai-3d-models/SKILL.md +3 -3
- package/template/.github/skills/vgai-threejs-authoring/SKILL.md +4 -9
- package/template/AGENTS.md +1 -1
- package/template/check-idioms.ts +4 -5
- package/template/package.json +9 -9
- package/template/tsconfig.json +1 -0
- package/template/vgai.adapter.ts +1 -0
- package/template-dotfiles/gitignore +2 -0
- package/workbench/src/media/game-cover.css +1 -1
- package/catalog/project-source/src/lib/bake/mesh-slice.ts +0 -157
- package/dist/assets/BufferGeometryUtils-Nz37EVXf.js +0 -1
- package/dist/assets/CanvasSceneViewport-Bpi6gVTC.js +0 -1
- package/dist/assets/ColladaLoader-aVOPIsCh.js +0 -3
- package/dist/assets/EXRLoader-Cdans_oJ.js +0 -1
- package/dist/assets/EffectComposer-DQxfsXBZ.js +0 -1
- package/dist/assets/EntityModelDocument-Ccvw66N9.js +0 -1
- package/dist/assets/EnvironmentAssetDocument-Dg-Qq6O6.js +0 -1
- package/dist/assets/FBXLoader-B4MoUtAn.js +0 -1
- package/dist/assets/Fbo-Dz-Soul3.js +0 -1
- package/dist/assets/GLTFExporter-HgrCle4L.js +0 -1
- package/dist/assets/Gltf-UHVWKz65.js +0 -2
- package/dist/assets/HDRLoader-THU88oVD.js +0 -5
- package/dist/assets/ImageViewer-Tn7s_MnW.js +0 -1
- package/dist/assets/InspectorObjectPreview-CVejvLRg.js +0 -1
- package/dist/assets/JsonAssetDocument-C7VGcLhu.js +0 -3
- package/dist/assets/MeshBVH-BiDHDcu-.js +0 -1
- package/dist/assets/ModelAssetDocument-F5GACirk.js +0 -1
- package/dist/assets/Object3DDocumentViewport-DB7T0NTl.js +0 -2
- package/dist/assets/Object3DPreview-DL8oi7Xs.js +0 -2
- package/dist/assets/OnlineAssetDetail-C6z9RvYK.js +0 -2
- package/dist/assets/PlayBar-BR-Vg3Jb.js +0 -2
- package/dist/assets/RGBELoader-BgBcQv8j.js +0 -1
- package/dist/assets/RectAreaLightUniformsLib-CMMoWfll.js +0 -1
- package/dist/assets/RootSelectionOverlay-BZPlxmXU.js +0 -1
- package/dist/assets/STLLoader-Dyv3lsxY.js +0 -1
- package/dist/assets/SimplifyModifier-C8ayvRzd.js +0 -1
- package/dist/assets/SourceAssetViewer-2SWQoUut.js +0 -12
- package/dist/assets/StageHost-BN-IoTef.js +0 -2
- package/dist/assets/ThreeBoardDocument-CVncZyIq.js +0 -2
- package/dist/assets/asset-budget-asset.menu-Di3KiQCd.js +0 -1
- package/dist/assets/asset-budget.action-DCzzcuTh.js +0 -1
- package/dist/assets/asset-budget.document-BWU8wnVW.js +0 -1
- package/dist/assets/asset-budget.menu-BGZpT_31.js +0 -1
- package/dist/assets/autoplay.service-BZBGNSvt.js +0 -1
- package/dist/assets/blender-emscripten-engine-9ZIRYNhe.js +0 -2
- package/dist/assets/blender-properties-tab-C5CyPydi.js +0 -3
- package/dist/assets/blender-runtime-host-BpBwGv7r.js +0 -4
- package/dist/assets/blender-runtime.document-lIYhhPtv.js +0 -8
- package/dist/assets/blender.command-BtJeWk-A.js +0 -1
- package/dist/assets/body-marks-h_xDxiDE.js +0 -1
- package/dist/assets/bridge.command-o5gDNEwa.js +0 -3
- package/dist/assets/browserAll-DeWblVez.js +0 -1
- package/dist/assets/canvas-entry-runtime-SfBxaR9M.js +0 -2
- package/dist/assets/component-board.service-DidCyM4O.js +0 -2
- package/dist/assets/component-verbs.service-Bv9jId3q.js +0 -1
- package/dist/assets/constraints.inspector-B9U9Yj-u.js +0 -1
- package/dist/assets/coverage.service-VTX5Mcsx.js +0 -3
- package/dist/assets/deferred-ingest-play-DCJi_Pgu.js +0 -2
- package/dist/assets/design-time-layers-wYgOTgni.js +0 -1
- package/dist/assets/design-time-mount.service-BzY21e1F.js +0 -2
- package/dist/assets/design-time-react-mount-DM9WLrF2.js +0 -1
- package/dist/assets/edit-mode-authoring-B47TfLqu.js +0 -1
- package/dist/assets/editor-api-BoJIcyZG.js +0 -1
- package/dist/assets/fflate.module-DPuTF8aG.js +0 -6
- package/dist/assets/fork-menu-BoVyw2Wu.js +0 -1
- package/dist/assets/game-document.service-DbRfx2V0.js +0 -1
- package/dist/assets/game-eval.command-D-7Dxbj_.js +0 -2
- package/dist/assets/gameplay-replay-e5umMlXv.js +0 -1
- package/dist/assets/gameplay.command-DxcVYX6F.js +0 -1
- package/dist/assets/generation.service-CDIgObuw.js +0 -1
- package/dist/assets/index-96FBF1Oj.js +0 -1
- package/dist/assets/index-BAWkB0dv.js +0 -1
- package/dist/assets/index-BDnS2b6S.js +0 -1
- package/dist/assets/index-BjTCPEQ7.js +0 -134
- package/dist/assets/index-CVCb_ImQ.js +0 -1
- package/dist/assets/index-CZd9o7Lu.js +0 -1
- package/dist/assets/index-D2fNXpHa.css +0 -1
- package/dist/assets/index-GIL7oGEO.js +0 -4894
- package/dist/assets/index-OrYXPk3Z.js +0 -487
- package/dist/assets/ingest-boot-viewport-D5rI_Kk_.js +0 -1
- package/dist/assets/ingest-siblings-Bop2kqVl.js +0 -1
- package/dist/assets/instances.command-D6UkZNO8.js +0 -1
- package/dist/assets/light-camera-factory-CWbbe9gI.js +0 -1
- package/dist/assets/live-behaviors-Bxq49Maz.js +0 -1
- package/dist/assets/matcap-texture-CVfalpWT.js +0 -1
- package/dist/assets/model-asset-sections.service-CHhFS3ZX.js +0 -1
- package/dist/assets/model.layout-BJUEQYUI.js +0 -1
- package/dist/assets/module-mode-DVBLT9d-.js +0 -2
- package/dist/assets/mount-canvas-ingest-root-DDuAWf_C.js +0 -2
- package/dist/assets/mount-dom-ingest-root-D_EiBgpn.js +0 -2
- package/dist/assets/mount-ingest-root-glv2SSWf.js +0 -2
- package/dist/assets/mount-three-ingest-root-hrUt9VVU.js +0 -1
- package/dist/assets/particles-factory-DnLOHXT8.js +0 -1
- package/dist/assets/pasteboard-materialize-BqSS4QzV.js +0 -20
- package/dist/assets/pasteboard.action-DU3UHtJG.js +0 -2
- package/dist/assets/pixi-authoring-adapter-CjibysC3.js +0 -1
- package/dist/assets/pixi-primitive-DlWbUPN9.js +0 -1
- package/dist/assets/pixi-react-root-factory-DYsznYRQ.js +0 -1
- package/dist/assets/play-mode-BFU2PCkG.js +0 -22
- package/dist/assets/play.command-BpqqLqkq.js +0 -2
- package/dist/assets/project-authoring-session-Bnt6icLr.js +0 -2
- package/dist/assets/r3f-design-session-D-4yyDO9.js +0 -2
- package/dist/assets/r3f-physics-binding-BBo8oma9.js +0 -1
- package/dist/assets/r3f-source-authoring-adapter-w6Bc60K-.js +0 -13
- package/dist/assets/react-inspector.service-B_neRnSK.js +0 -1
- package/dist/assets/react-story-board-BDDwiE2H.js +0 -1
- package/dist/assets/react-world-authoring-adapter-DmrwM3py.js +0 -1
- package/dist/assets/runtime-inspection-l2iFQSsg.js +0 -1
- package/dist/assets/scene-document.service-qkDjUrlP.js +0 -2
- package/dist/assets/sculpt.layout-zJF55yCR.js +0 -1
- package/dist/assets/setup-particles-GCXlnkj_.js +0 -1
- package/dist/assets/shading.layout-DULYZV6M.js +0 -1
- package/dist/assets/source-object3d-authoring-adapter-B-L6Ha6f.js +0 -1
- package/dist/assets/stage-invalidation-DBg3C3Ta.js +0 -1
- package/dist/assets/stage-keyboard-n-5kKH-m.js +0 -1
- package/dist/assets/stage-overlay-set-B9zp2sLB.js +0 -1
- package/dist/assets/stage-presence-markers-DiGI6A45.js +0 -1
- package/dist/assets/standard-viewport-dressing-CzjAe_0A.js +0 -7
- package/dist/assets/static-batch-advisor-B13QEH7d.js +0 -1
- package/dist/assets/story-capture-_gC8dXV-.js +0 -1
- package/dist/assets/story-documents--TDLaPeL.js +0 -3
- package/dist/assets/story-documents.service-BiS_YbNQ.js +0 -1
- package/dist/assets/story-documents.service-CxOPYJ2j.js +0 -1
- package/dist/assets/story-pixi-preview-BUrOJZXS.js +0 -1
- package/dist/assets/story-presentation-j2AVN-mK.js +0 -1
- package/dist/assets/team-playtest.service-DqOinFVA.js +0 -1
- package/dist/assets/three-authoring.service-iuHLwtf1.js +0 -2
- package/dist/assets/three-viewport-presentation-QBQpSdMh.js +0 -1
- package/dist/assets/three.quarks.esm-B1C61jGo.js +0 -1039
- package/dist/assets/transport.header-B-6HQlU2.js +0 -1
- package/dist/assets/ui-board-document-Bwtt--xp.js +0 -2
- package/dist/assets/use-live-actor-state-DErbWQWF.js +0 -1
- package/dist/assets/user-data-BB2Of6Ht.js +0 -1
- package/dist/assets/uv-editing.layout-BEKHxmHw.js +0 -1
- package/dist/assets/viewport-shading-boundary-B_-_gABg.js +0 -82
- package/dist/assets/voxel-surface-DtcsSWRL.js +0 -1
- package/dist/assets/webgl-frame-capture-FlF9zQmW.js +0 -1
- package/dist/assets/webworkerAll-CM2o_dnz.js +0 -1
- package/dist/assets/world-documents-147tiFZe.js +0 -1
- package/dist/assets/world-root-stage-binding-vwTrtBz6.js +0 -1
- package/dist/assets/xstate-animation-binding-Brd0NST6.js +0 -1
- package/dist/assets/xstate-behavior.action-B8UluFBK.js +0 -1
- package/dist/assets/xstate-behavior.document-CKAsE45I.js +0 -1
- package/dist/assets/xstate-behavior.inspector-vJJyuifc.js +0 -1
- package/dist/assets/xstate-behavior.menu-BXbPICIh.js +0 -1
- package/dist/assets/xstate-inspection-BsZv8LS9.js +0 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/spark.module-CXth-y_a.js","assets/three.module-IFn-4i31.js","assets/index-Ckxb31Yz.js","assets/index-nmcBqr7Y.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-FUuS4qwW.js","assets/client-DNXj_opT.js","assets/index-B4bmKkgY.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{aI as K,fG as W,fK as x,e1 as ze,e2 as Di,lS as Ri,d$ as Bt,kr as $,lT as fe,lU as zt,kM as Fi,kt as Gi,lV as Te,f9 as Tt,dW as B,X as It,lW as Kt,lX as Bi,lY as Wi,lZ as Vi,l_ as Xi,l$ as Ni,g7 as Yi,bO as qi,fT as Zi,m0 as Qi,m1 as Ui,kO as Ie,kP as Le,kQ as Oe,dT as ke,ap as Lt,m2 as Ki,m3 as $i,m4 as je,hD as De,bQ as Ji,e9 as ts,_ as es,aJ as is}from"./index-Ckxb31Yz.js";import{a as ss,i as tt}from"./standard-viewport-dressing-GUUr6GuK.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{E as Re,a as Fe,f as os}from"./clip-planes-CnAI6DZn.js";import{e as me,r as Wt}from"./three-DSsr_Lvp.js";import{OrbitControls as ns}from"./OrbitControls-CzTRRI7x.js";import{C as rs,V as p,Q as L,q as st,O as Nt,x as R,aW as at,bG as k,B as E,ax as pt,aV as bt,M as v,ct as nt,be as N,cu as mt,z as Z,aN as gi,a as Qt,w as vi,al as Yt,aU as Q,cv as as,v as M,o as Y,cw as yi,aZ as qt,cn as wi,j as vt,bN as ls,cm as cs,bM as hs,bL as ds,s as ps,a5 as Me,bS as us,n as Ge,g as et,t as fs,u as ms,an as $t,bK as _s,bA as gs,k as Jt,cx as vs,c4 as ys,cy as ws,cz as bs,cA as xs,cB as Ss,ba as Cs,p as Ms,bb as Be,bc as We,cC as As,r as Ae,h as Hs,H as bi,a0 as xi}from"./three.module-IFn-4i31.js";import{L as _e,a as ge,b as ve}from"./LineSegments2-Cicm_Hu1.js";import{B as Ps}from"./three.quarks.esm-CRKGjKAH.js";import{b as Es,e as zs}from"./live-gesture-lock-DJbrjOqf.js";import{s as Ve}from"./viewport-pick-context-DkawXbEi.js";import{f as Xe,v as Ts,s as Is}from"./scene-framing-50N7SKuX.js";import{a as Ls}from"./live-mixers-BRkRHd6g.js";function ye(a){const t=K(a,"triggerVolume");if(!t||typeof t!="object")return null;const{radius:e}=t;return typeof e=="number"&&Number.isFinite(e)&&e>0?{radius:e}:null}const it=new st,j=new p,U=new p,H=new L,Ne={X:new p(1,0,0),Y:new p(0,1,0),Z:new p(0,0,1)},te={type:"change"},Ye={type:"mouseDown",mode:null},qe={type:"mouseUp",mode:null},Ze={type:"objectChange"};class ee extends rs{constructor(t,e=null){super(void 0,e);const i=new Fs(this);this._root=i;const s=new Gs;this._gizmo=s,i.add(s);const o=new Bs;this._plane=o,i.add(o);const n=this;function r(w,z){let T=z;Object.defineProperty(n,w,{get:function(){return T!==void 0?T:z},set:function(S){T!==S&&(T=S,o[w]=S,s[w]=S,n.dispatchEvent({type:w+"-changed",value:S}),n.dispatchEvent(te))}}),n[w]=z,o[w]=z,s[w]=z}r("camera",t),r("object",void 0),r("enabled",!0),r("axis",null),r("mode","translate"),r("translationSnap",null),r("rotationSnap",null),r("scaleSnap",null),r("space","world"),r("size",1),r("dragging",!1),r("showX",!0),r("showY",!0),r("showZ",!0),r("minX",-1/0),r("maxX",1/0),r("minY",-1/0),r("maxY",1/0),r("minZ",-1/0),r("maxZ",1/0);const l=new p,c=new p,h=new L,d=new L,f=new p,u=new L,m=new p,_=new p,g=new p,b=0,y=new p;r("worldPosition",l),r("worldPositionStart",c),r("worldQuaternion",h),r("worldQuaternionStart",d),r("cameraPosition",f),r("cameraQuaternion",u),r("pointStart",m),r("pointEnd",_),r("rotationAxis",g),r("rotationAngle",b),r("eye",y),this._offset=new p,this._startNorm=new p,this._endNorm=new p,this._cameraScale=new p,this._parentPosition=new p,this._parentQuaternion=new L,this._parentQuaternionInv=new L,this._parentScale=new p,this._worldScaleStart=new p,this._worldQuaternionInv=new L,this._worldScale=new p,this._positionStart=new p,this._quaternionStart=new L,this._scaleStart=new p,this._getPointer=Os.bind(this),this._onPointerDown=js.bind(this),this._onPointerHover=ks.bind(this),this._onPointerMove=Ds.bind(this),this._onPointerUp=Rs.bind(this),e!==null&&this.connect(e)}connect(t){super.connect(t),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(t){if(this.object===void 0||this.dragging===!0)return;t!==null&&it.setFromCamera(t,this.camera);const e=ie(this._gizmo.picker[this.mode],it);e?this.axis=e.object.name:this.axis=null}pointerDown(t){if(!(this.object===void 0||this.dragging===!0||t!=null&&t.button!==0)&&this.axis!==null){t!==null&&it.setFromCamera(t,this.camera);const e=ie(this._plane,it,!0);e&&(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(e.point).sub(this.worldPositionStart)),this.dragging=!0,Ye.mode=this.mode,this.dispatchEvent(Ye)}}pointerMove(t){const e=this.axis,i=this.mode,s=this.object;let o=this.space;if(i==="scale"?o="local":(e==="E"||e==="XYZE"||e==="XYZ")&&(o="world"),s===void 0||e===null||this.dragging===!1||t!==null&&t.button!==-1)return;t!==null&&it.setFromCamera(t,this.camera);const n=ie(this._plane,it,!0);if(n){if(this.pointEnd.copy(n.point).sub(this.worldPositionStart),i==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),o==="local"&&e!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),e.indexOf("X")===-1&&(this._offset.x=0),e.indexOf("Y")===-1&&(this._offset.y=0),e.indexOf("Z")===-1&&(this._offset.z=0),o==="local"&&e!=="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&&(o==="local"&&(s.position.applyQuaternion(H.copy(this._quaternionStart).invert()),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.position.applyQuaternion(this._quaternionStart)),o==="world"&&(s.parent&&s.position.add(j.setFromMatrixPosition(s.parent.matrixWorld)),e.search("X")!==-1&&(s.position.x=Math.round(s.position.x/this.translationSnap)*this.translationSnap),e.search("Y")!==-1&&(s.position.y=Math.round(s.position.y/this.translationSnap)*this.translationSnap),e.search("Z")!==-1&&(s.position.z=Math.round(s.position.z/this.translationSnap)*this.translationSnap),s.parent&&s.position.sub(j.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(e.search("XYZ")!==-1){let r=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(r*=-1),U.set(r,r,r)}else j.copy(this.pointStart),U.copy(this.pointEnd),j.applyQuaternion(this._worldQuaternionInv),U.applyQuaternion(this._worldQuaternionInv),U.divide(j),e.search("X")===-1&&(U.x=1),e.search("Y")===-1&&(U.y=1),e.search("Z")===-1&&(U.z=1);s.scale.copy(this._scaleStart).multiply(U),this.scaleSnap&&(e.search("X")!==-1&&(s.scale.x=Math.round(s.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.search("Y")!==-1&&(s.scale.y=Math.round(s.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),e.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 r=20/this.worldPosition.distanceTo(j.setFromMatrixPosition(this.camera.matrixWorld));let l=!1;e==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(j.copy(this.rotationAxis).cross(this.eye))*r):(e==="X"||e==="Y"||e==="Z")&&(this.rotationAxis.copy(Ne[e]),j.copy(Ne[e]),o==="local"&&j.applyQuaternion(this.worldQuaternion),j.cross(this.eye),j.length()===0?l=!0:this.rotationAngle=this._offset.dot(j.normalize())*r),(e==="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),o==="local"&&e!=="E"&&e!=="XYZE"?(s.quaternion.copy(this._quaternionStart),s.quaternion.multiply(H.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),s.quaternion.copy(H.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),s.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(te),this.dispatchEvent(Ze)}}pointerUp(t){t!==null&&t.button!==0||(this.dragging&&this.axis!==null&&(qe.mode=this.mode,this.dispatchEvent(qe)),this.dragging=!1,this.axis=null)}dispose(){this.disconnect(),this._root.dispose()}attach(t){return this.object=t,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(te),this.dispatchEvent(Ze),this.pointStart.copy(this.pointEnd))}getRaycaster(){return it}getMode(){return this.mode}setMode(t){this.mode=t}setTranslationSnap(t){this.translationSnap=t}setRotationSnap(t){this.rotationSnap=t}setScaleSnap(t){this.scaleSnap=t}setSize(t){this.size=t}setSpace(t){this.space=t}setColors(t,e,i,s){const o=this._gizmo.materialLib;o.xAxis.color.set(t),o.yAxis.color.set(e),o.zAxis.color.set(i),o.active.color.set(s),o.xAxisTransparent.color.set(t),o.yAxisTransparent.color.set(e),o.zAxisTransparent.color.set(i),o.activeTransparent.color.set(s),o.xAxis._color&&o.xAxis._color.set(t),o.yAxis._color&&o.yAxis._color.set(e),o.zAxis._color&&o.zAxis._color.set(i),o.active._color&&o.active._color.set(s),o.xAxisTransparent._color&&o.xAxisTransparent._color.set(t),o.yAxisTransparent._color&&o.yAxisTransparent._color.set(e),o.zAxisTransparent._color&&o.zAxisTransparent._color.set(i),o.activeTransparent._color&&o.activeTransparent._color.set(s)}}function Os(a){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:a.button};{const t=this.domElement.getBoundingClientRect();return{x:(a.clientX-t.left)/t.width*2-1,y:-(a.clientY-t.top)/t.height*2+1,button:a.button}}}function ks(a){if(this.enabled)switch(a.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(a));break}}function js(a){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(a.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(a)),this.pointerDown(this._getPointer(a)))}function Ds(a){this.enabled&&this.pointerMove(this._getPointer(a))}function Rs(a){this.enabled&&(this.domElement.releasePointerCapture(a.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(a)))}function ie(a,t,e){const i=t.intersectObject(a,!0);for(let s=0;s<i.length;s++)if(i[s].object.visible||e)return i[s];return!1}const Ot=new gi,A=new p(0,1,0),Qe=new p(0,0,0),Ue=new Qt,kt=new L,Vt=new L,X=new p,Ke=new Qt,yt=new p(1,0,0),ot=new p(0,1,0),wt=new p(0,0,1),jt=new p,_t=new p,gt=new p;class Fs extends Nt{constructor(t){super(),this.isTransformControlsRoot=!0,this.controls=t,this.visible=!1}updateMatrixWorld(t){const e=this.controls;e.object!==void 0&&(e.object.updateMatrixWorld(),e.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):e.object.parent.matrixWorld.decompose(e._parentPosition,e._parentQuaternion,e._parentScale),e.object.matrixWorld.decompose(e.worldPosition,e.worldQuaternion,e._worldScale),e._parentQuaternionInv.copy(e._parentQuaternion).invert(),e._worldQuaternionInv.copy(e.worldQuaternion).invert()),e.camera.updateMatrixWorld(),e.camera.matrixWorld.decompose(e.cameraPosition,e.cameraQuaternion,e._cameraScale),e.camera.isOrthographicCamera?e.camera.getWorldDirection(e.eye).negate():e.eye.copy(e.cameraPosition).sub(e.worldPosition).normalize(),super.updateMatrixWorld(t)}dispose(){this.traverse(function(t){t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose()})}}class Gs extends Nt{constructor(){super(),this.isTransformControlsGizmo=!0,this.type="TransformControlsGizmo";const t=new R({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),e=new at({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=t.clone();i.opacity=.15;const s=e.clone();s.opacity=.5;const o=t.clone();o.color.setHex(16711680);const n=t.clone();n.color.setHex(65280);const r=t.clone();r.color.setHex(255);const l=t.clone();l.color.setHex(16711680),l.opacity=.5;const c=t.clone();c.color.setHex(65280),c.opacity=.5;const h=t.clone();h.color.setHex(255),h.opacity=.5;const d=t.clone();d.opacity=.25;const f=t.clone();f.color.setHex(16776960),f.opacity=.25;const u=t.clone();u.color.setHex(16776960);const m=t.clone();m.color.setHex(7895160),this.materialLib={xAxis:o,yAxis:n,zAxis:r,active:u,xAxisTransparent:l,yAxisTransparent:c,zAxisTransparent:h,activeTransparent:f};const _=new k(0,.04,.1,12);_.translate(0,.05,0);const g=new E(.08,.08,.08);g.translate(0,.04,0);const b=new pt;b.setAttribute("position",new bt([0,0,0,1,0,0],3));const y=new k(.0075,.0075,.5,3);y.translate(0,.25,0);function w(F,At){const G=new mt(F,.0075,3,64,At*Math.PI*2);return G.rotateY(Math.PI/2),G.rotateX(Math.PI/2),G}function z(){const F=new pt;return F.setAttribute("position",new bt([0,0,0,1,1,1],3)),F}const T={X:[[new v(_,o),[.5,0,0],[0,0,-Math.PI/2]],[new v(_,o),[-.5,0,0],[0,0,Math.PI/2]],[new v(y,o),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new v(_,n),[0,.5,0]],[new v(_,n),[0,-.5,0],[Math.PI,0,0]],[new v(y,n)]],Z:[[new v(_,r),[0,0,.5],[Math.PI/2,0,0]],[new v(_,r),[0,0,-.5],[-Math.PI/2,0,0]],[new v(y,r),null,[Math.PI/2,0,0]]],XYZ:[[new v(new nt(.1,0),d),[0,0,0]]],XY:[[new v(new E(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new v(new E(.15,.15,.01),l),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new v(new E(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]]},S={X:[[new v(new k(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new v(new k(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new v(new k(.2,0,.6,4),i),[0,.3,0]],[new v(new k(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new v(new k(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new v(new k(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new v(new nt(.2,0),i)]],XY:[[new v(new E(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new v(new E(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new v(new E(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]]},C={START:[[new v(new nt(.01,2),s),null,null,null,"helper"]],END:[[new v(new nt(.01,2),s),null,null,null,"helper"]],DELTA:[[new N(z(),s),null,null,null,"helper"]],X:[[new N(b,s),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new N(b,s),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new N(b,s),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},P={XYZE:[[new v(w(.5,1),m),null,[0,Math.PI/2,0]]],X:[[new v(w(.5,.5),o)]],Y:[[new v(w(.5,.5),n),null,[0,0,-Math.PI/2]]],Z:[[new v(w(.5,.5),r),null,[0,Math.PI/2,0]]],E:[[new v(w(.75,1),f),null,[0,Math.PI/2,0]]]},I={AXIS:[[new N(b,s),[-1e3,0,0],null,[1e6,1,1],"helper"]]},Mt={XYZE:[[new v(new Z(.25,10,8),i)]],X:[[new v(new mt(.5,.1,4,24),i),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new v(new mt(.5,.1,4,24),i),[0,0,0],[Math.PI/2,0,0]]],Z:[[new v(new mt(.5,.1,4,24),i),[0,0,0],[0,0,-Math.PI/2]]],E:[[new v(new mt(.75,.1,2,24),i)]]},Li={X:[[new v(g,o),[.5,0,0],[0,0,-Math.PI/2]],[new v(y,o),[0,0,0],[0,0,-Math.PI/2]],[new v(g,o),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new v(g,n),[0,.5,0]],[new v(y,n)],[new v(g,n),[0,-.5,0],[0,0,Math.PI]]],Z:[[new v(g,r),[0,0,.5],[Math.PI/2,0,0]],[new v(y,r),[0,0,0],[Math.PI/2,0,0]],[new v(g,r),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new v(new E(.15,.15,.01),h),[.15,.15,0]]],YZ:[[new v(new E(.15,.15,.01),l),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new v(new E(.15,.15,.01),c),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new v(new E(.1,.1,.1),d)]]},Oi={X:[[new v(new k(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new v(new k(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new v(new k(.2,0,.6,4),i),[0,.3,0]],[new v(new k(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new v(new k(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new v(new k(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new v(new E(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new v(new E(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new v(new E(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new v(new E(.2,.2,.2),i),[0,0,0]]]},ki={X:[[new N(b,s),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new N(b,s),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new N(b,s),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function q(F){const At=new Nt;for(const G in F)for(let lt=F[G].length;lt--;){const D=F[G][lt][0].clone(),Ht=F[G][lt][1],Pt=F[G][lt][2],Et=F[G][lt][3],ji=F[G][lt][4];D.name=G,D.tag=ji,Ht&&D.position.set(Ht[0],Ht[1],Ht[2]),Pt&&D.rotation.set(Pt[0],Pt[1],Pt[2]),Et&&D.scale.set(Et[0],Et[1],Et[2]),D.updateMatrix();const Ee=D.geometry.clone();Ee.applyMatrix4(D.matrix),D.geometry=Ee,D.renderOrder=1/0,D.position.set(0,0,0),D.rotation.set(0,0,0),D.scale.set(1,1,1),At.add(D)}return At}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=q(T)),this.add(this.gizmo.rotate=q(P)),this.add(this.gizmo.scale=q(Li)),this.add(this.picker.translate=q(S)),this.add(this.picker.rotate=q(Mt)),this.add(this.picker.scale=q(Oi)),this.add(this.helper.translate=q(C)),this.add(this.helper.rotate=q(I)),this.add(this.helper.scale=q(ki)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(t){const i=(this.mode==="scale"?"local":this.space)==="local"?this.worldQuaternion:Vt;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 o=0;o<s.length;o++){const n=s[o];n.visible=!0,n.rotation.set(0,0,0),n.position.copy(this.worldPosition);let r;if(this.camera.isOrthographicCamera?r=(this.camera.top-this.camera.bottom)/this.camera.zoom:r=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(r*this.size/4),n.tag==="helper"){n.visible=!1,n.name==="AXIS"?(n.visible=!!this.axis,this.axis==="X"&&(H.setFromEuler(Ot.set(0,0,0)),n.quaternion.copy(i).multiply(H),Math.abs(A.copy(yt).applyQuaternion(i).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Y"&&(H.setFromEuler(Ot.set(0,0,Math.PI/2)),n.quaternion.copy(i).multiply(H),Math.abs(A.copy(ot).applyQuaternion(i).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="Z"&&(H.setFromEuler(Ot.set(0,Math.PI/2,0)),n.quaternion.copy(i).multiply(H),Math.abs(A.copy(wt).applyQuaternion(i).dot(this.eye))>.9&&(n.visible=!1)),this.axis==="XYZE"&&(H.setFromEuler(Ot.set(0,Math.PI/2,0)),A.copy(this.rotationAxis),n.quaternion.setFromRotationMatrix(Ue.lookAt(Qe,A,ot)),n.quaternion.multiply(H),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),j.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),j.applyQuaternion(this.worldQuaternionStart.clone().invert()),n.scale.copy(j),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(A.copy(yt).applyQuaternion(i).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Y"&&Math.abs(A.copy(ot).applyQuaternion(i).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="Z"&&Math.abs(A.copy(wt).applyQuaternion(i).dot(this.eye))>.99&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XY"&&Math.abs(A.copy(wt).applyQuaternion(i).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="YZ"&&Math.abs(A.copy(yt).applyQuaternion(i).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),n.name==="XZ"&&Math.abs(A.copy(ot).applyQuaternion(i).dot(this.eye))<.2&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1)):this.mode==="rotate"&&(kt.copy(i),A.copy(this.eye).applyQuaternion(H.copy(i).invert()),n.name.search("E")!==-1&&n.quaternion.setFromRotationMatrix(Ue.lookAt(this.eye,Qe,ot)),n.name==="X"&&(H.setFromAxisAngle(yt,Math.atan2(-A.y,A.z)),H.multiplyQuaternions(kt,H),n.quaternion.copy(H)),n.name==="Y"&&(H.setFromAxisAngle(ot,Math.atan2(A.x,A.z)),H.multiplyQuaternions(kt,H),n.quaternion.copy(H)),n.name==="Z"&&(H.setFromAxisAngle(wt,Math.atan2(A.y,A.x)),H.multiplyQuaternions(kt,H),n.quaternion.copy(H))),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(t)}}class Bs extends v{constructor(){super(new vi(1e5,1e5,2,2),new R({visible:!1,wireframe:!0,side:Yt,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(t){let e=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(e="local"),jt.copy(yt).applyQuaternion(e==="local"?this.worldQuaternion:Vt),_t.copy(ot).applyQuaternion(e==="local"?this.worldQuaternion:Vt),gt.copy(wt).applyQuaternion(e==="local"?this.worldQuaternion:Vt),A.copy(_t),this.mode){case"translate":case"scale":switch(this.axis){case"X":A.copy(this.eye).cross(jt),X.copy(jt).cross(A);break;case"Y":A.copy(this.eye).cross(_t),X.copy(_t).cross(A);break;case"Z":A.copy(this.eye).cross(gt),X.copy(gt).cross(A);break;case"XY":X.copy(gt);break;case"YZ":X.copy(jt);break;case"XZ":A.copy(gt),X.copy(_t);break;case"XYZ":case"E":X.set(0,0,0);break}break;case"rotate":default:X.set(0,0,0)}X.length()===0?this.quaternion.copy(this.cameraQuaternion):(Ke.lookAt(j.set(0,0,0),X,A),this.quaternion.setFromRotationMatrix(Ke)),super.updateMatrixWorld(t)}}const se=new M(4441855),Dt=new M(16758858),Rt=new M(14185983),Ws=new M(16731496),$e=new M(16777215);function oe(a){return new N(new pt,new at({color:a,depthTest:!1,depthWrite:!1,transparent:!0,toneMapped:!1}))}function ne(a,t){return new v(a,new R({color:t,depthTest:!1,depthWrite:!1,transparent:!0,toneMapped:!1}))}function re(a,t){if(a.visible=t.length>1,!a.visible)return;let e=a.geometry.getAttribute("position");(!e||e.count!==t.length)&&(e=new bt(t.length*3,3),a.geometry.setAttribute("position",e));for(let i=0;i<t.length;i++)e.setXYZ(i,t[i].x,t[i].y,t[i].z);e.needsUpdate=!0,a.geometry.computeBoundingSphere()}class Vs extends Q{constructor(t){super(),this.source=t,this.name="Constraint Helper",this.renderOrder=999,W(this,"editorHelper",!0),W(this,"editorHelperType","constraints"),this.layers.set(x),this.refreshStructure()}selected=!1;hoveredControl=null;selectedObjects=new Set;visuals=[];setSelected(t){this.selected=t}setSelectedObjects(t){this.selectedObjects=t}controlMeshes(){return this.visuals.flatMap(t=>[t.targetHit,t.poleHit].filter(e=>e.visible))}presents(t){return t===this.source?!0:this.visuals.some(e=>{const i=e.mark.getSnapshot();return t===i.target||t===i.pole})}controlFor(t){for(const e of this.visuals){const i=e.mark.getSnapshot();if((t===e.target||t===e.targetHit)&&i.target)return{kind:"target",label:i.target.name||`${e.mark.config.label} target`,object:i.target,mesh:e.target};if((t===e.pole||t===e.poleHit)&&i.pole)return{kind:"pole",label:i.pole.name||`${e.mark.config.label} pole`,object:i.pole,mesh:e.pole}}return null}setHoveredControl(t){this.hoveredControl=t}update(t){this.refreshStructure();for(const e of this.visuals)this.updateVisual(e,t)}dispose(){this.clearVisuals(),this.removeFromParent()}refreshStructure(){const t=me(this.source);t.length===this.visuals.length&&t.every((i,s)=>{const o=i.getSnapshot(),n=o.chain.length>0?o.chain.length:o.constrained?1:0;return this.visuals[s]?.mark===i&&this.visuals[s]?.positions.length===n})||(this.clearVisuals(),this.visuals=t.map(i=>this.makeVisual(i)))}makeVisual(t){const e=t.getSnapshot(),i=e.chain.length>0?e.chain:e.constrained?[e.constrained]:[],s=oe(se),o=oe(Dt),n=oe(Rt),r=i.map(()=>ne(new Z(.035,10,7),se)),l=ne(new nt(.085),Dt),c=ne(new as(.075),Rt),h=new R({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1,colorWrite:!1}),d=new v(new Z(.16,10,7),h),f=new v(new Z(.15,10,7),h.clone());for(const u of[s,o,n,...r,l,c,d,f])u.renderOrder=this.renderOrder,u.layers.set(x),this.add(u);return{mark:t,chain:s,targetLine:o,poleLine:n,joints:r,target:l,pole:c,targetHit:d,poleHit:f,positions:i.map(()=>new p),targetPosition:new p,polePosition:new p}}updateVisual(t,e){const i=t.mark.getSnapshot(),s=i.chain.length>0?i.chain:i.constrained?[i.constrained]:[];for(let f=0;f<s.length;f++)s[f].getWorldPosition(t.positions[f]);re(t.chain,t.positions);for(let f=0;f<t.joints.length;f++){const u=t.joints[f],m=t.positions[f];u.visible=!!m,m&&(u.position.copy(m),u.scale.setScalar(this.handleScale(e,m)))}const o=t.positions.at(-1),n=i.target?.getWorldPosition(t.targetPosition)??null,r=i.pole?.getWorldPosition(t.polePosition)??null;re(t.targetLine,o&&n?[o,n]:[]),re(t.poleLine,t.positions[0]&&r?[t.positions[0],r]:[]),t.target.visible=n!==null,n&&(t.target.position.copy(n),t.target.scale.setScalar(this.handleScale(e,n)*(this.hoveredControl===t.target?1.22:1))),t.targetHit.visible=n!==null,n&&(t.targetHit.position.copy(n),t.targetHit.scale.copy(t.target.scale)),t.pole.visible=r!==null,r&&(t.pole.position.copy(r),t.pole.scale.setScalar(this.handleScale(e,r)*(this.hoveredControl===t.pole?1.22:1))),t.poleHit.visible=r!==null,r&&(t.poleHit.position.copy(r),t.poleHit.scale.copy(t.pole.scale));const l=i.status==="error"||i.status==="unresolved",c=this.selected?1:.52;for(const f of[t.chain,...t.joints]){const u=f.material;u.color.copy(l?Ws:se),u.opacity=c}const h=this.hoveredControl===t.target||i.target!==null&&this.selectedObjects.has(i.target),d=this.hoveredControl===t.pole||i.pole!==null&&this.selectedObjects.has(i.pole);t.target.material.color.copy(h?$e:Dt),t.pole.material.color.copy(d?$e:Rt),t.targetLine.material.color.copy(Dt),t.poleLine.material.color.copy(Rt),t.targetLine.material.opacity=c,t.poleLine.material.opacity=c,t.target.material.opacity=h?1:c,t.pole.material.opacity=d?1:c}handleScale(t,e){return Y.clamp(t.position.distanceTo(e)/8,.65,4)}clearVisuals(){for(const t of[...this.children]){t.removeFromParent();const e=t;e.geometry.dispose();const i=Array.isArray(e.material)?e.material:[e.material];for(const s of i)s.dispose()}this.visuals=[],this.hoveredControl=null}}const Xs=5742335;function Si(a,t,e){return a<<16|t<<8|e}function Je(a){const t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.exec(a.trim())?.[1];if(t){const s=t.length===3?[...t].map(o=>`${o}${o}`).join(""):t;return Number.parseInt(s.slice(0,6),16)}const e=/^rgba?\(\s*(\d+(?:\.\d+)?)\s*(?:,\s*|\s+)(\d+(?:\.\d+)?)\s*(?:,\s*|\s+)(\d+(?:\.\d+)?)/i.exec(a.trim());if(!e)return null;const i=e.slice(1,4).map(s=>Math.round(Number(s)));return i.some(s=>s<0||s>255)?null:Si(i[0],i[1],i[2])}function xt(a){const t=Je(a);if(t!==null||typeof document>"u")return t;if(typeof CSS<"u"&&!CSS.supports("color",a))return null;const e=document.createElement("canvas").getContext("2d");return e?(e.fillStyle="#010203",e.fillStyle=a,Je(String(e.fillStyle))):null}function J(a){return typeof document>"u"?null:a?.closest(`.${ze}`)??document.querySelector(`.${ze}`)}function ti(a){const t=Math.round((a>>16&255)*.42),e=Math.round((a>>8&255)*.42),i=Math.round((a&255)*.42);return Si(t,e,i)}function O(a,t){return a&&typeof getComputedStyle<"u"?getComputedStyle(a).getPropertyValue(t).trim():""}const Ci={"--vgai-viewport-background":"--vscode-vgai-viewport-background","--vgai-viewport-grid":"--vscode-vgai-viewport-grid","--vgai-viewport-axis-x":"--vscode-vgai-viewport-axisX","--vgai-viewport-axis-y":"--vscode-vgai-viewport-axisY","--vgai-viewport-axis-z":"--vscode-vgai-viewport-axisZ","--vgai-viewport-selection":"--vscode-vgai-viewport-selection","--vgai-viewport-active":"--vscode-vgai-viewport-active","--vgai-viewport-wire":"--vscode-vgai-viewport-wire","--vgai-gizmo-x":"--vscode-vgai-gizmo-x","--vgai-gizmo-y":"--vscode-vgai-gizmo-y","--vgai-gizmo-z":"--vscode-vgai-gizmo-z","--vgai-gizmo-navigation-x":"--vscode-vgai-gizmo-navigationX","--vgai-gizmo-navigation-y":"--vscode-vgai-gizmo-navigationY","--vgai-gizmo-navigation-z":"--vscode-vgai-gizmo-navigationZ","--vgai-gizmo-hover":"--vscode-vgai-gizmo-hover","--vgai-gizmo-drag":"--vscode-vgai-gizmo-drag"};function St(a,t){const e=Ci[t];return(e?O(a,e):"")||O(a,t)}function ct(a){const t=J(a),e=St(t,"--vgai-viewport-selection")||O(t,"--vgai-accent"),i=xt(e||Di.color.accent.default)??Xs,s=xt(St(t,"--vgai-viewport-active")),o=O(t,"--vgai-viewport-outline-style"),n=Number.parseFloat(O(t,"--vgai-viewport-outline-width")),r=O(t,"--vgai-viewport-outline-hidden");return{visible:i,hidden:ti(i),...s===null?{}:{active:{visible:s,hidden:ti(s)}},...o===""&&r===""&&!Number.isFinite(n)?{}:{outline:{style:o==="crisp"?"crisp":"soft",width:Number.isFinite(n)&&n>0?n:null,hidden:r!=="false"}}}}function vn(a){return He(a).background!==null}function yn(a){const t=He(a).background;if(t===null)return!1;const e=t>>16&255,i=t>>8&255,s=t&255;return(.2126*e+.7152*i+.0722*s)/255>.5}function He(a){const t=J(a),e=i=>{const s=St(t,i);return s?xt(s):null};return{background:e("--vgai-viewport-background"),grid:e("--vgai-viewport-grid"),axisX:e("--vgai-viewport-axis-x"),axisY:e("--vgai-viewport-axis-y"),axisZ:e("--vgai-viewport-axis-z"),axisLineWidth:(()=>{const i=O(t,"--vgai-viewport-axis-line-width"),s=i?Number.parseFloat(i):Number.NaN;return Number.isFinite(s)?s:null})(),active:e("--vgai-viewport-active")}}function ei(a){const t=J(a),e=o=>{const n=St(t,o);return n?xt(n):null},i=o=>{const n=O(t,o);if(!n)return null;const r=Number.parseFloat(n);return Number.isFinite(r)?r:null},s=o=>{const n=e(`${o}-x`),r=e(`${o}-y`),l=e(`${o}-z`);return n!==null&&r!==null&&l!==null?[n,r,l]:null};return{axes:s("--vgai-gizmo"),navigation:s("--vgai-gizmo-navigation"),hover:e("--vgai-gizmo-hover"),drag:e("--vgai-gizmo-drag"),opacity:i("--vgai-viewport-gizmo-opacity"),arrowLength:i("--vgai-viewport-gizmo-arrow-length"),arrowHead:i("--vgai-viewport-gizmo-arrow-head"),ringWidth:i("--vgai-viewport-gizmo-ring-width"),navigationSize:i("--vgai-viewport-navigation-size"),navigationForm:(o=>o==="cones"||o==="triad"?o:"balls")(O(t,"--vgai-viewport-navigation-gizmo")),navigationCorner:O(t,"--vgai-viewport-navigation-corner")==="bottom-left"?"bottom-left":"top-right",highlightSaturation:i("--vgai-viewport-gizmo-highlight-saturation"),highlightValue:i("--vgai-viewport-gizmo-highlight-value")}}function ii(a){const t=O(J(a),"--vgai-viewport-gizmo-size");if(!t)return null;const e=Number.parseFloat(t);return Number.isFinite(e)&&e>0?e:null}function Ns(a){const t=J(a),e=(s,o)=>{const n=Number.parseFloat(O(t,s)??"");return Number.isFinite(n)&&n>0?n:o},i=e("--vgai-viewport-grid-line-width",1);return{lineWidth:i,majorWidth:e("--vgai-viewport-grid-major-width",i),majorContrast:e("--vgai-viewport-grid-major-contrast",1)}}function si(a){const t=J(a),e=St(t,"--vgai-viewport-wire"),i=Number.parseFloat(O(t,"--vgai-viewport-wire-opacity"));return{color:e?xt(e):null,opacity:Number.isFinite(i)?i:null}}function oi(a){const t=J(a),e=Number.parseFloat(O(t,"--vgai-viewport-selection-box-width"));return{edges:O(t,"--vgai-viewport-selection-box")==="edges",frame:O(t,"--vgai-viewport-selection-box-frame")==="object"?"object":"world",lineWidth:Number.isFinite(e)&&e>0?e:null}}function Ys(a,t){t();const e=J(a);if(!e||typeof MutationObserver>"u")return()=>{};const i=new MutationObserver(t);i.observe(e,{attributes:!0,attributeFilter:["style"]});const s=qs(e,t);return()=>{i.disconnect(),s()}}const Ft=new Set;let ht=null,ae="";function qs(a,t){const e=()=>Object.values(Ci).map(i=>O(a,i)).join("|");return Ft.add(t),!ht&&typeof document<"u"&&document.head&&(ae=e(),ht=new MutationObserver(()=>{const i=e();if(i!==ae){ae=i;for(const s of[...Ft])s()}}),ht.observe(document.head,{childList:!0,subtree:!0,characterData:!0})),()=>{Ft.delete(t),Ft.size===0&&ht&&(ht.disconnect(),ht=null)}}const Zs=new M(4892927),Qs=new M(7718143),Us=new M(16758858),Ks=new M(16777215);class $s extends Q{constructor(t){super(),this.source=t,this.name="Reflection Probe Helper",this.matrixAutoUpdate=!1,this.renderOrder=998,W(this,"editorHelper",!0),W(this,"editorHelperType","reflection-probes"),this.layers.set(x),this.refresh(!0)}signature="";selected=!1;setSelected(t){this.selected!==t&&(this.selected=t,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(t){const e=Wt(this.source);if(!e)return;const i=e.config,s=JSON.stringify(i);if(!t&&s===this.signature)return;this.signature=s,this.clearVisuals();const o=this.selected?Qs:Zs,n=this.selected?1:.62,r=Math.max(0,i.blendDistance);if(i.shape==="sphere"){const c=Math.max(.01,i.radius);this.addWire(new Z(c,24,16),o,n),r>0&&c-r>.01&&this.addWire(new Z(c-r,20,12),o,this.selected?.55:.28)}else{const[c,h,d]=i.size.map(u=>Math.max(.01,u));this.addWire(new E(c,h,d),o,n);const f=[c-r*2,h-r*2,d-r*2];r>0&&f.every(u=>u>.01)&&this.addWire(new E(f[0],f[1],f[2]),o,this.selected?.55:.28)}if(i.parallaxProjection){const[c,h,d]=i.parallaxSize.map(u=>Math.max(.01,u));this.addWire(new E(c,h,d),Us,this.selected?.9:.45).position.fromArray(i.parallaxOffset)}this.addWire(new nt(this.selected?.16:.11),Ks,this.selected?1:.72).position.fromArray(i.captureOffset),this.traverse(c=>c.layers.set(x))}addWire(t,e,i){const s=new yi(t);t.dispose();const o=new at({color:e,depthTest:!1,transparent:!0,opacity:i,toneMapped:!1}),n=new qt(s,o);return n.renderOrder=this.renderOrder,this.add(n),n}clearVisuals(){for(const t of[...this.children]){t.removeFromParent();const e=t;e.geometry?.dispose();const i=Array.isArray(e.material)?e.material:[e.material];for(const s of i)s?.dispose()}}}const Pe=new WeakMap,Mi=new Z(1,12,8);function ut(a){return new p(a[0],a[1],a[2])}function Ct(a){const t={color:a.color,transparent:!0,opacity:a.opacity??.68,depthTest:!1};return a.dashed?new wi({...t,dashSize:.18,gapSize:.12}):new at(t)}function V(a,t,e,i=!1){const s=i&&t.length>0?[...t,t[0]]:[...t],o=new N(new pt().setFromPoints(s),e);o.renderOrder=997,o.layers.set(x),e instanceof wi&&o.computeLineDistances(),a.add(o)}function Xt(a,t,e,i,s=64){const o=[];for(let n=0;n<s;n++){const r=n/s*Math.PI*2;o.push(a.clone().addScaledVector(e,Math.cos(r)*t).addScaledVector(i,Math.sin(r)*t))}return o}function Js(a){const t=new Q,e=ut(a.center),i=Ct(a);return V(t,Xt(e,a.radius,new p(1,0,0),new p(0,1,0)),i,!0),V(t,Xt(e,a.radius,new p(1,0,0),new p(0,0,1)),i,!0),V(t,Xt(e,a.radius,new p(0,1,0),new p(0,0,1)),i,!0),t}function to(a){const t=new Q;return V(t,a.points.map(ut),Ct(a)),t}function eo(a){const t=new Q,e=ut(a.origin),i=ut(a.direction).normalize(),s=Math.abs(i.y)<.9?new p(0,1,0):new p(1,0,0),o=new p().crossVectors(s,i).normalize(),n=new p().crossVectors(i,o).normalize(),r=Y.degToRad(Math.max(0,Math.min(360,a.angle))/2),l=Ct(a),c=[];for(let h=0;h<64;h++){const d=h/64*Math.PI*2,f=o.clone().multiplyScalar(Math.cos(d)).addScaledVector(n,Math.sin(d));c.push(e.clone().addScaledVector(i,Math.cos(r)*a.length).addScaledVector(f,Math.sin(r)*a.length))}V(t,c,l,!0);for(const h of[0,16,32,48])V(t,[e,c[h]],l);return t}function io(a,t,e){return a.applyQuaternion(new L(...e)).add(new p(...t))}function so(a){const t=new Q,e=Ct(a),[i,s,o]=a.halfExtents,n=[[-i,-s,-o],[i,-s,-o],[i,s,-o],[-i,s,-o],[-i,-s,o],[i,-s,o],[i,s,o],[-i,s,o]].map(([r,l,c])=>io(new p(r,l,c),a.center,a.rotation));for(const[r,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]])V(t,[n[r],n[l]],e);return t}function oo(a){const t=new Q,e=Ct(a),i=new L(...a.rotation),s=ut(a.center),o=r=>r.applyQuaternion(i).add(s),n=(r,l,c)=>Xt(new p(0,r,0),a.radius,l,c).map(o);V(t,n(a.halfHeight,new p(1,0,0),new p(0,0,1)),e,!0),V(t,n(-a.halfHeight,new p(1,0,0),new p(0,0,1)),e,!0);for(const[r,l]of[[a.radius,0],[-a.radius,0],[0,a.radius],[0,-a.radius]])V(t,[o(new p(r,-a.halfHeight,l)),o(new p(r,a.halfHeight,l))],e);for(const r of["x","z"]){const l=[];for(let c=0;c<=32;c++){const h=c/32*Math.PI,d=new p(0,a.halfHeight+Math.sin(h)*a.radius,0);d[r]=Math.cos(h)*a.radius,l.push(o(d))}for(let c=0;c<=32;c++){const h=Math.PI+c/32*Math.PI,d=new p(0,-a.halfHeight+Math.sin(h)*a.radius,0);d[r]=Math.cos(h)*a.radius,l.push(o(d))}V(t,l,e)}return t}function no(a){const t=a.kind==="line"?to(a):a.kind==="sphere"?Js(a):a.kind==="cone"?eo(a):a.kind==="box"?so(a):oo(a);return t.layers.set(x),t.traverse(e=>e.layers.set(x)),t}function ro(a,t){const e=new R({color:t.color,depthTest:!1,transparent:!0,opacity:t.writable?.92:.35}),i=new v(Mi,e);return Object.defineProperty(i,"isSpatialHandleMesh",{value:!0}),i.position.copy(ut(t.position)),i.renderOrder=998,i.layers.set(x),Pe.set(i,{nodeId:a,handle:t}),i}function ao(a,t){const e=[],i=[];for(const s of t){for(const o of s.guides)e.push(no(o));for(const o of s.handles){const n=ro(a,o);e.push(n),i.push(n)}}return{roots:e,handles:i}}function ni(a){return Pe.get(a)??null}function le(a,t){const e=Pe.get(a);a.material.color.set(t&&e?.handle.writable?"#ffffff":e?.handle.color??"#ffffff")}function ri(a,t){const e=a.position.distanceTo(t.position);a.scale.setScalar(Math.max(.025,e*.012))}function lo(a,t,e){const i=a,s=i.geometry;s&&s!==Mi&&!t.has(s)&&(s.dispose(),t.add(s));const o=Array.isArray(i.material)?i.material:i.material?[i.material]:[];for(const n of o)e.has(n)||(n.dispose(),e.add(n))}function ai(a){const t=new Set,e=new Set;for(const i of a)i.removeFromParent(),i.traverse(s=>lo(s,t,e))}function ce(a,t,e,i=1.15){if(a.isEmpty())return 3;const s=e.clone().normalize(),o=Math.abs(s.dot(t.up))>.999?new p(0,0,1):t.up,n=new p().crossVectors(o,s).normalize(),r=new p().crossVectors(s,n).normalize(),l=a.getCenter(new p);let c=0,h=0,d=0;for(const _ of[a.min.x,a.max.x])for(const g of[a.min.y,a.max.y])for(const b of[a.min.z,a.max.z]){const y=new p(_,g,b).sub(l);d=Math.max(d,Math.abs(y.dot(n))),h=Math.max(h,Math.abs(y.dot(r))),c=Math.max(c,Math.abs(y.dot(s)))}const f=Y.degToRad(t.fov*.5),u=Math.atan(Math.tan(f)*Math.max(t.aspect,.01)),m=Math.max(h/Math.tan(f),d/Math.tan(u));return Math.max(m*i+c,t.near*4,.01)}const co=3,ho=.05,po=.03,uo=.6,fo=.15,mo=.08,_o=3,go=.45,Ai=.001,vo=24,yo=6,wo=[[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 bo(a){const t=Y.clamp(a*fo,mo,_o);return Math.max(Math.min(t,a*go),Ai)}function he(a){return Y.clamp(a*ho,po,uo)}function xo(a,t,e=!1){const{min:i,max:s}=a,o=h=>e?Math.max(h/2,Ai):bo(h),n=o(s.x-i.x),r=o(s.y-i.y),l=o(s.z-i.z);let c=0;for(const[h,d,f]of wo){const u=h===0?i.x:s.x,m=d===0?i.y:s.y,_=f===0?i.z:s.z,g=h===0?n:-n,b=d===0?r:-r,y=f===0?l:-l;t[c++]=u,t[c++]=m,t[c++]=_,t[c++]=u+g,t[c++]=m,t[c++]=_,t[c++]=u,t[c++]=m,t[c++]=_,t[c++]=u,t[c++]=m+b,t[c++]=_,t[c++]=u,t[c++]=m,t[c++]=_,t[c++]=u,t[c++]=m,t[c++]=_+y}}class de extends _e{entityObject;_fixedSize;_edges;_objectFrame;_toObject=new Qt;_point=new p;_axisX=new p;_axisY=new p;_axisZ=new p;_scale=new p;_positions=new Float32Array(vo*yo);_box=new vt;_worldPos=new p;_fixedExtent=new p;_standoff=new p;_lastRootMatrix=new Float32Array(16);_requiresContinuousBounds;constructor(t,e){const i=new ge,s=new ve({color:e.color,linewidth:e.lineWidth??co,worldUnits:!1,alphaToCoverage:!0,toneMapped:!1,depthTest:!1,depthWrite:!1});super(i,s),this.entityObject=t,this._fixedSize=e.fixedSize,this._edges=e.edges===!0,this._objectFrame=e.frame==="object";let o=!1;t.traverse(n=>{const r=n;(n.isSkinnedMesh||Array.isArray(r.morphTargetInfluences)&&r.morphTargetInfluences.length>0||Ls(n)!==null)&&(o=!0)}),this._requiresContinuousBounds=o,this.renderOrder=1,this.frustumCulled=!1,i.setPositions(this._positions),this.update()}setColor(t){this.material.color.setHex(t)}updateIfNeeded(){this.entityObject.updateWorldMatrix(!0,!1);const t=this.entityObject.matrixWorld.elements;let e=!1;for(let i=0;i<t.length;i++)if(t[i]!==this._lastRootMatrix[i]){e=!0;break}(e||this._requiresContinuousBounds)&&this.update()}update(){this.entityObject.updateWorldMatrix(!0,!1);const t=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 e=t?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(t?(this._toObject.copy(this.entityObject.matrixWorld).invert(),Ri(this.entityObject,this._toObject,this._box)):Bt(this.entityObject,this._box),this._box.isEmpty())return;if(this._box.getSize(this._standoff).multiply(e),this._standoff.set(he(this._standoff.x),he(this._standoff.y),he(this._standoff.z)).divide(e),this._box.expandByVector(this._standoff),xo(this._box,this._positions,this._edges),t){const s=this.entityObject.matrixWorld;for(let o=0;o<this._positions.length;o+=3)this._point.set(this._positions[o],this._positions[o+1],this._positions[o+2]).applyMatrix4(s),this._positions[o]=this._point.x,this._positions[o+1]=this._point.y,this._positions[o+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 So({BlendFunction:a,KernelSize:t,OutlineEffect:e},i,s,o){const n=new e(i,s,{blendFunction:a.ALPHA,visibleEdgeColor:o.visible,hiddenEdgeColor:o.hidden,edgeStrength:5,pulseSpeed:0,blur:!0,kernelSize:t.MEDIUM,resolutionScale:.5,xRay:!0});n.selectionLayer=fe,s.layers.disable(fe);const r=n.getFragmentShader(),l="vec3 color=edge.x*visibleEdgeColor+edge.y*hiddenEdgeColor;";r.includes(l)&&(n.setFragmentShader(r.replace("uniform float edgeStrength;","uniform float edgeStrength;uniform float vgaiCrisp;").replace(l,`${l}if(vgaiCrisp>0.5){float vgaiSum=edge.x+edge.y;if(vgaiSum>0.0)color/=vgaiSum;edge=min(edge,vec2(1.0));}`)),n.uniforms.set("vgaiCrisp",{value:0}));const c=n.update.bind(n);return n.update=(h,d,f)=>{const u=n.camera,m=u.layers.isEnabled(x);u.layers.disable(x);try{c(h,d,f)}finally{m&&u.layers.enable(x)}},ft.set(n,{colors:o,roots:0}),Ut(n),n}const we=new WeakMap;function wn(a,t,e,i,s){const o=we.get(t)?.pop();return o?(o.mainScene=e,o.mainCamera=i,i.layers.disable(fe),ft.set(o,{colors:s,roots:0}),Ut(o),o):So(a,e,i,s)}function bn(a,t,e){t.selection.clear(),e?.setEffects([]);const i=we.get(a)??[];i.includes(t)||i.push(t),we.set(a,i)}const ft=new WeakMap;function Ut(a){const t=ft.get(a);if(!t)return;const e=t.roots===1&&t.colors.active?t.colors.active:t.colors;a.visibleEdgeColor.setHex(e.visible),a.hiddenEdgeColor.setHex(e.hidden);const i=t.colors.outline,s=i?.style==="crisp",o=i?.width??2;a.resolution.scale=s?1:.5,a.blurPass.enabled=!0,a.blurPass.kernelSize=s?o<=2?0:o<=4?1:o<=6?2:3:2,a.edgeStrength=s?8:5;const n=a.uniforms.get("vgaiCrisp");n&&(n.value=s?1:0),a.xRay=i?.hidden??!0}function xn(a,t){ft.set(a,{colors:t,roots:ft.get(a)?.roots??0}),Ut(a)}function Co(a){return a.isBone?!1:a.isMesh||a.isLine||a.isPoints||a.isSprite}function Hi(a){const t=[],e=new Set;for(const i of a)i.isBone||i.traverse(s=>{e.has(s)||$(s)||!Co(s)||(e.add(s),t.push(s))});return t}function Sn(a,t){const e=[...t],i=e.filter(n=>!n.isBone).length,s=ft.get(a);s&&s.roots!==i&&(s.roots=i,Ut(a));const o=Hi(e);a.selection.size===o.length&&o.every(n=>a.selection.has(n))||a.selection.set(o)}function li(a,t){const e=new M(a);if(!t||t.toneMapping===ls)return e;const i=t.toneMappingExposure||1;if(t.toneMapping===cs)return e.multiplyScalar(1/i);if(t.toneMapping===hs)return Mo(e,i);if(t.toneMapping===ds)return Ao(e,i);if(t.toneMapping!==ps)return e;const s=[[.59719,.35458,.04823],[.076,.90834,.01566],[.0284,.13383,.83777]],o=[[1.60475,-.53108,-.07367],[-.10208,1.10813,-.00605],[-.00327,-.07276,1.07602]],n=d=>(d*(d+.0245786)-90537e-9)/(d*(.983729*d+.432951)+.238081),r=d=>{let f=0,u=64;for(let m=0;m<60;m++){const _=(f+u)/2;n(_)<d?f=_:u=_}return(f+u)/2},c=dt(Zt(o),[e.r,e.g,e.b]).map(d=>d<=0?0:r(Math.min(d,.999))),h=dt(Zt(s),c).map(d=>Math.max(0,d)*(.6/i));return new M().setRGB(h[0],h[1],h[2],Me)}function Mo(a,t){const e=[[.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]],o=[[1.1271005818144368,-.11060664309660323,-.016493938717834573],[-.1413297634984383,1.157823702216272,-.016493938717834257],[-.14132976349843826,-.11060664309660294,1.2519364065950405]],n=-12.47393,r=4.026069,l=m=>{const _=m*m,g=_*_;return 15.5*g*_-40.14*g*m+31.96*g-6.868*_*m+.4298*_+.1191*m-.00232},c=m=>{let _=0,g=1;for(let b=0;b<60;b++){const y=(_+g)/2;l(y)<m?_=y:g=y}return(_+g)/2},h=dt(e,[a.r,a.g,a.b]),f=dt(Zt(o),h.map(m=>Math.max(0,m)**(1/2.2))).map(m=>2**(c(m)*(r-n)+n)),u=dt(i,dt(Zt(s),f)).map(m=>Math.max(0,m)/t);return new M().setRGB(u[0],u[1],u[2],Me)}function dt(a,t){return[a[0][0]*t[0]+a[0][1]*t[1]+a[0][2]*t[2],a[1][0]*t[0]+a[1][1]*t[1]+a[1][2]*t[2],a[2][0]*t[0]+a[2][1]*t[1]+a[2][2]*t[2]]}function Zt(a){const[[t,e,i],[s,o,n],[r,l,c]]=a,h=o*c-n*l,d=-(s*c-n*r),f=s*l-o*r,u=t*h+e*d+i*f;return[[h/u,-(e*c-i*l)/u,(e*n-i*o)/u],[d/u,(t*c-i*r)/u,-(t*n-i*s)/u],[f/u,-(t*l-e*r)/u,(t*o-e*s)/u]]}function Ao(a,t){const e=n=>(n*(.88*n+.06)+.002)/(n*(.88*n+.6)+.06)-.03333333333333333,i=e(1),s=n=>e(n)/i,o=n=>{if(n<=0)return 0;let r=0,l=1;for(let c=0;c<60;c++){const h=(r+l)/2;s(h)<n?r=h:l=h}return(r+l)/2};return new M().setRGB(o(Math.min(a.r,.999))/t,o(Math.min(a.g,.999))/t,o(Math.min(a.b,.999))/t,Me)}const Ho=new M(5231045),Po=new M(10481896),ci=64,Eo=.6;class zo extends Q{constructor(t){super(),this.source=t,this.name="Trigger Volume Helper",this.matrixAutoUpdate=!1,this.renderOrder=998,W(this,"editorHelper",!0),W(this,"editorHelperType","trigger-volumes"),this.layers.set(x),this.refresh(!0)}signature="";selected=!1;setSelected(t){this.selected!==t&&(this.selected=t,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(t){const e=ye(this.source);if(!e)return;const i=e.radius,s=String(i);if(!t&&s===this.signature)return;this.signature=s,this.clearVisuals();const o=this.selected?Po:Ho,n=this.selected?1:.62,r=[];for(let u=0;u<ci;u+=1){const m=u/ci*Math.PI*2;r.push(Math.cos(m)*i,0,Math.sin(m)*i)}const l=new pt;l.setAttribute("position",new bt(r,3));const c=new us(l,this.lineMaterial(o,n));c.renderOrder=this.renderOrder,this.add(c);const h=[];for(const[u,m]of[[i,0],[-i,0],[0,i],[0,-i]])h.push(u,0,m,u,Eo,m);const d=new pt;d.setAttribute("position",new bt(h,3));const f=new qt(d,this.lineMaterial(o,n));f.renderOrder=this.renderOrder,this.add(f),this.traverse(u=>u.layers.set(x))}lineMaterial(t,e){return new at({color:t,depthTest:!1,transparent:!0,opacity:e,toneMapped:!1})}clearVisuals(){for(const t of[...this.children]){t.removeFromParent();const e=t;e.geometry?.dispose();const i=Array.isArray(e.material)?e.material:[e.material];for(const s of i)s?.dispose()}}}function To(a){const t=new Set(a.values()),e=[];for(const i of t){let s=i.parent,o=!1;for(;s!==null;){if(t.has(s)){o=!0;break}s=s.parent}o||e.push(i)}return e}function Io(a,t){const e=new Set;for(const i of t){const s=a.get(i);s&&e.add(s)}return[...e].filter(i=>{for(let s=i.parent;s!==null;s=s.parent)if(e.has(s))return!1;return!0})}const Gt=.5,Lo=1e3,Oo=new p(0,1,0),ko=new p(0,0,1),pe=new Ms,jo=new p,hi=new p,ue=new L,di=new p,Do=1e-8,Ro=[new p(1,0,0),new p(-1,0,0),new p(0,1,0),new p(0,-1,0),new p(0,0,1),new p(0,0,-1)],Fo=[[.96,.2,.32],[.53,.84,.01],[.16,.55,.96]],pi=[[0,1],[1,1],[2,1]],Go=[[0,1],[2,1],[1,-1]],Bo=[[0,1],[2,1],[1,1]],ui=["X","Y","Z"],Wo=62.6;function fi(a){const t=Number.isFinite(a)&&a>.01?a:1,e=Y.degToRad(Wo/2),i=t>=1?Math.atan(Math.tan(e)/t):e;return Y.radToDeg(i*2)}function Vo(a){const t=Math.max(a.r,a.g,a.b),e=Math.min(a.r,a.g,a.b),i=t-e;let s=0;return i>0&&(t===a.r?s=((a.g-a.b)/i+6)%6:t===a.g?s=(a.b-a.r)/i+2:s=(a.r-a.g)/i+4,s/=6),{h:s,s:t===0?0:i/t,v:t}}function Xo(a,t,e,i){const s=Math.floor(a*6),o=a*6-s,n=e*(1-t),r=e*(1-o*t),l=e*(1-(1-o)*t),[c,h,d]=[[e,l,n],[r,e,n],[n,e,l],[n,r,e],[l,n,e],[e,n,r]][(s%6+6)%6];return i.setRGB(c,h,d)}const mi=[new M(16070225),new M(7316507),new M(3048419)],No=.356,Yo=7.5/17.5;function qo(a,t){const i=document.createElement("canvas");i.width=32,i.height=32;const s=i.getContext("2d");s&&(s.fillStyle=`#${a.getHexString()}`,s.font=`bold ${Math.round(32*.8)}px system-ui, -apple-system, sans-serif`,s.textAlign="center",s.textBaseline="middle",s.fillText(t,32/2,32/2+1));const o=new bi(i);return o.generateMipmaps=!1,o.minFilter=xi,o.colorSpace=Ae,o}function Zo(a,t){const i=document.createElement("canvas");i.width=32,i.height=32;const s=i.getContext("2d");if(s){const n=`#${a.getHexString()}`,r=32/2-1;if(t===null){const l=xe/be*32;s.beginPath(),s.arc(32/2,32/2,r,0,Math.PI*2),s.fillStyle=n,s.globalAlpha=.35,s.fill(),s.globalAlpha=1,s.beginPath(),s.arc(32/2,32/2,r-l/2,0,Math.PI*2),s.lineWidth=l,s.strokeStyle=n,s.stroke()}else{s.beginPath(),s.arc(32/2,32/2,r,0,Math.PI*2),s.fillStyle=n,s.fill();const l=a.clone().multiplyScalar(No);s.fillStyle=`#${l.getHexString()}`;const c=Yo*(2*r);s.font=`bold ${Math.round(c/.72)}px system-ui, -apple-system, sans-serif`,s.textAlign="center",s.textBaseline="middle",s.fillText(t,32/2,32/2+2)}}const o=new bi(i);return o.colorSpace=Ae,o.generateMipmaps=!1,o.minFilter=xi,o}const Qo=new p(.8187,.4458,.3617),rt=90,Uo=32,be=15,Ko=2.75,xe=2,$o=74.5,Pi=73.5,Jo=8.5+$o/2-rt/2,Ei=38+Pi/2-rt/2,Cn=Ei+rt/2+Pi/2+16-14.5,zi=`
|
|
3
|
+
float vgaiGrazingFade(vec3 worldPosition, vec3 eye, vec3 planeNormal, float amount) {
|
|
4
|
+
vec3 toEye = eye - worldPosition;
|
|
5
|
+
float toEyeLength = max(length(toEye), 1e-6);
|
|
6
|
+
float graze = 1.0 - abs(dot(toEye / toEyeLength, planeNormal));
|
|
7
|
+
graze *= graze;
|
|
8
|
+
return mix(1.0, 1.0 - graze * graze, amount);
|
|
9
|
+
}
|
|
10
|
+
`,Ti=200,Se=2,Ce=Ti*2/Se;function _i(a){const t=[];for(let e=0;e<Ce;e++){const i=-Ti+e*Se,s=i+Se;a===0?t.push(i,.001,0,s,.001,0):a===2?t.push(0,.001,i,0,.001,s):t.push(0,i,0,0,s,0)}return t}function tn(a,t){a.onBeforeCompile=e=>{e.uniforms.uGrazingFade=t,e.vertexShader=e.vertexShader.replace("void main() {",`varying vec3 vAxisWorld;
|
|
11
|
+
void main() {`).replace("vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );",`vAxisWorld = ( modelMatrix * vec4( position.y < 0.5 ? instanceStart : instanceEnd, 1.0 ) ).xyz;
|
|
12
|
+
vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );`),e.fragmentShader=e.fragmentShader.replace("void main() {",`varying vec3 vAxisWorld;
|
|
13
|
+
uniform float uGrazingFade;
|
|
14
|
+
${zi}
|
|
15
|
+
void main() {`).replace("gl_FragColor = vec4( diffuseColor.rgb, alpha );","gl_FragColor = vec4( diffuseColor.rgb, alpha * vgaiGrazingFade( vAxisWorld, cameraPosition, vec3( 0.0, 1.0, 0.0 ), uGrazingFade ) );")},a.customProgramCacheKey=()=>"vgai-axis-grazing-fade"}function en(a){const t=new vi(a,a);t.rotateX(-Math.PI/2);const e=new Hs({uniforms:{uColor:{value:new M(10066329)},uMajorColor:{value:new M(10066329)},uOpacity:{value:1},uLineWidth:{value:1},uMajorWidth:{value:1},uMajorEvery:{value:10},uFadeStart:{value:a/2*.55},uFadeEnd:{value:a/2},uGrazingFade:{value:0}},vertexShader:`
|
|
16
|
+
varying vec3 vWorld;
|
|
17
|
+
void main() {
|
|
18
|
+
vWorld = (modelMatrix * vec4(position, 1.0)).xyz;
|
|
19
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
20
|
+
}
|
|
21
|
+
`,fragmentShader:`
|
|
22
|
+
uniform vec3 uColor;
|
|
23
|
+
uniform vec3 uMajorColor;
|
|
24
|
+
uniform float uOpacity;
|
|
25
|
+
uniform float uLineWidth;
|
|
26
|
+
uniform float uMajorWidth;
|
|
27
|
+
uniform float uMajorEvery;
|
|
28
|
+
uniform float uFadeStart;
|
|
29
|
+
uniform float uFadeEnd;
|
|
30
|
+
uniform float uGrazingFade;
|
|
31
|
+
varying vec3 vWorld;
|
|
32
|
+
${zi}
|
|
33
|
+
// Coverage of a line WIDTH device pixels across, with a one-pixel
|
|
34
|
+
// anti-aliased edge — so its core is FULL, the way Blender's is. The
|
|
35
|
+
// earlier form (1 - distance/width) was a triangle with no plateau:
|
|
36
|
+
// whether a line reached its own colour depended on where the nearest
|
|
37
|
+
// fragment centre happened to fall, and the measured peak wandered
|
|
38
|
+
// between 0.67 and 1 of it.
|
|
39
|
+
float gridLine(vec2 coord, float width) {
|
|
40
|
+
vec2 d = max(fwidth(coord), vec2(1e-6));
|
|
41
|
+
vec2 dist = abs(fract(coord - 0.5) - 0.5) / d;
|
|
42
|
+
vec2 cov = clamp(width * 0.5 - dist + 0.5, 0.0, 1.0);
|
|
43
|
+
return max(cov.x, cov.y);
|
|
44
|
+
}
|
|
45
|
+
void main() {
|
|
46
|
+
vec2 p = vWorld.xz;
|
|
47
|
+
vec2 pixelsPerMetre = 1.0 / max(fwidth(p), vec2(1e-6));
|
|
48
|
+
float minorVisible = smoothstep(4.0, 14.0, min(pixelsPerMetre.x, pixelsPerMetre.y));
|
|
49
|
+
// Both levels reach FULL strength in their own colour, as Blender's
|
|
50
|
+
// do: the 1 m line is measured at exactly the palette's grid colour
|
|
51
|
+
// and the 10 m line brighter than it (see uMajorColor). The minor
|
|
52
|
+
// level's only attenuation is its own drop-out as cells shrink.
|
|
53
|
+
float minor = gridLine(p, uLineWidth) * minorVisible;
|
|
54
|
+
// The 10 m level is WIDER as well as brighter, which is what lets it
|
|
55
|
+
// reach full coverage — and so its full colour. Measured across one
|
|
56
|
+
// scanline of modeling-object-none.png at device resolution: the 1 m
|
|
57
|
+
// line is 4 px at half rise and plateaus at 83, the 10 m line is 6 px
|
|
58
|
+
// and plateaus at 101. At one shared width ours drew a 10 m line that
|
|
59
|
+
// never exceeded 0.75 coverage and so measured 91, not 102.
|
|
60
|
+
float major = gridLine(p / uMajorEvery, uMajorWidth);
|
|
61
|
+
float line = max(minor, major);
|
|
62
|
+
float fade = 1.0 - smoothstep(uFadeStart, uFadeEnd, length(p));
|
|
63
|
+
// The floor's DEPTH, beside the band that ends its finite extent:
|
|
64
|
+
// Blender's own grazing-angle profile, transcribed from its frames
|
|
65
|
+
// (see GRAZING_FADE_GLSL above). Without it this lattice reads the
|
|
66
|
+
// same ink at the front of the frame and at the horizon.
|
|
67
|
+
fade *= vgaiGrazingFade(vWorld, cameraPosition, vec3(0.0, 1.0, 0.0), uGrazingFade);
|
|
68
|
+
float alpha = line * fade * uOpacity;
|
|
69
|
+
if (alpha <= 0.002) discard;
|
|
70
|
+
// WHICH level a fragment belongs to is the major's SHARE of the
|
|
71
|
+
// coverage being drawn, never a comparison of the two and never the
|
|
72
|
+
// major's raw coverage. Every 10 m line is also a 1 m line, so there
|
|
73
|
+
// the two are equal: a step() between them compares values equal to
|
|
74
|
+
// within rounding and flips per fragment (photographed with the major
|
|
75
|
+
// forced white: the 10 m lines came out DOTTED), and mixing by the raw
|
|
76
|
+
// coverage dilutes the colour by the line's own anti-aliasing (the
|
|
77
|
+
// same lines then measured 91 where Blender's is 102). As a share it
|
|
78
|
+
// is exactly 1 wherever the major draws — core and skirt alike, and in
|
|
79
|
+
// the far field where the minor has dropped out — and 0 on a 1 m line.
|
|
80
|
+
float majorShare = clamp(major / max(line, 1e-6), 0.0, 1.0);
|
|
81
|
+
gl_FragColor = vec4(mix(uColor, uMajorColor, majorShare), alpha);
|
|
82
|
+
#include <colorspace_fragment>
|
|
83
|
+
}
|
|
84
|
+
`,transparent:!0,depthWrite:!1,side:Yt}),i=new v(t,e);return i.name="editor-floor-grid",i}class Ii{setTransformMode(t){this._store.setTransformMode(t)}camera;orthographicCamera;orbitControls;transformControls;_auxRotateControls;_auxScaleControls;_activeGizmo;raycaster=(()=>{const t=new st;return t.layers.enableAll(),t})();grid;_boxHelpers=new Map;_selectionMarks={outline:!0,wire:!1,box:!1};_unsubscribeSelectionTheme=()=>{};_constraintHelpers=new Map;_constraintControlRaycaster=(()=>{const t=new st;return t.layers.enableAll(),t})();_hoveredConstraintControl=null;_constraintControlPointerSession=!1;_reflectionProbeHelpers=new Map;_triggerVolumeHelpers=new Map;_cameraHelpers=new Map;_lightHelpers=new Map;_audioHelpers=new Map;_spatialHandleRoots=[];_spatialHandleMeshes=[];_spatialHandleRaycaster=(()=>{const t=new st;return t.layers.enableAll(),t})();_activeSpatialHandle=null;_hoveredSpatialHandle=null;_spatialHandleDragPlane=new Ge;_spatialHandleDragOffset=new p;_spatialHandleDragPoint=new p;_orbitEnabledBeforeHandleDrag=!0;_transformEnabledBeforeHandleDrag=!0;_gizmoHelper;_editorAmbient;_editorDirLight;_lightRig;_scene;_contentBoundsBox=new vt;_contentBoundsAt=0;_renderer;_sparkRenderer=null;_sparkRendererLoading=!1;_sparkRendererFailed=!1;_lastSparkDiscoveryAt=Number.NEGATIVE_INFINITY;_disposed=!1;_editorObjects=[];_presentation=null;_axisLines=null;_verticalAxisLine=null;_axesWanted=!1;_stageAxes="floor";_lookAxisHexes=[null,null,null];_lookGridHex=null;_lookBackgroundHex=null;_lookToneMapping=null;_lookExposure=null;_lookGizmoSizePx=null;_stageAxisFrame=pi;_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",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;_standaloneAuthoring;_publishPickContext;_onlineAssetResolver;_onProjectionChange;_pointerDownPos=new et;_skipNextSync=!1;_marqueeActive=!1;_pointerSessionActive=!1;_marqueeDiv=null;_pointerDownButton=-1;_altDragOrbit=!1;_vcScene=new fs;_vcCamera;_vcClickTargets=[];_vcBalls=[];_vcStalks=[];_vcSolids=[];_vcSize=rt;_navigation="interactive";_marksLook="";_presentationGrid=!0;_vcMarginRight=Jo;_vcMarginTop=Ei;_chromeInsetPx=0;_vcDir=new p;_previewClearColor=new M;_cameraView=null;_projection="perspective";_pendingProjection=null;_viewportAspect=1;_orthographicHeight=10;_cameraViewMode=null;_orbitEnabledBeforeCameraView=!0;_orbitTargetBeforeCameraView=new p;_lastGizmoObjectMap=null;_lastGizmoSig="";_lastGizmoEpoch=-1;_threejsToolContextActive=!1;_threeSurfaceShowing=!1;_vcRaycaster=new st;_dropOverlay=null;_groundPlane=new Ge(new p(0,1,0),0);_dragStartPos=new p;_dragStartQuat=new L;_dragStartScale=new p;_attachedAuthoringId=null;_otherDragObjects=[];_allDragObjects=[];_preservedChildObjects=[];_activeTransformEditIds=[];_pivotDummy=new Nt;_dummyIsPresentationAnchor=!1;_pivotPos=new p;_surfaceSnapRaycaster=new st;_surfaceSnapIndicator;_vertexSnapTargets=[];_vertexSnapIndicator;_vertexSnapThreshold=20;batchedRenderer;_helpers=new Map;_snapAnimating=!1;_snapStartTime=0;_snapDuration=400;_snapQ1=new L;_snapQ2=new L;_snapDist=0;_flyActive=!1;_snapHold=!1;_flyKeys=new Set;_flySpeed=5;_flyEuler=new gi(0,0,0,"YXZ");_rightMouseDown=!1;constructor(t,e,i,s=t,o={}){this._canvas=t,this._interactionElement=s,this._scene=e,this._renderer=o.renderer,this._store=i,this._authoring=o.authoring??(()=>zt().activeAuthoring(this._store)),this._pick=o.pick,this._standaloneAuthoring=o.authoring!==void 0,this._publishPickContext=o.publishPickContext??!0,this._chromeInsetPx=o.chromeInsetPx??0,this._onlineAssetResolver=o.onlineAssetResolver,this._onProjectionChange=o.onProjectionChange,this.camera=new ms(fi(t.clientWidth/Math.max(1,t.clientHeight)),t.clientWidth/t.clientHeight,Re,Fe),this.camera.position.copy(Qo).multiplyScalar(17.32),this.camera.lookAt(0,0,0),this.camera.layers.enableAll(),this._viewportAspect=t.clientWidth/Math.max(1,t.clientHeight),this.orthographicCamera=new $t(-5,5,5,-5,Re,Fe),this.orthographicCamera.layers.enableAll(),this._syncOrthographicFromPerspective(),this.grid=en(400),this.grid.layers.set(x),e.add(this.grid);const n=new ge;n.setPositions(_i(0)),n.setColors(new Array(Ce*2*3).fill(1)),this._axisLines=new _e(n,new ve({vertexColors:!0,linewidth:2,transparent:!0,opacity:1,depthWrite:!1,toneMapped:!1})),tn(this._axisLines.material,this.grid.material.uniforms.uGrazingFade),this._axisLines.visible=!1,this._axisLines.layers.set(x),e.add(this._axisLines),this._unsubscribeSelectionTheme=Ys(t,()=>{tt();const l=JSON.stringify([ct(t),oi(t),si(t)]);l!==this._marksLook&&(this._marksLook=l,this._boxHelpers.size>0&&this._syncBoxHelpers()),this._gizmoLook=ei(t),this._applyViewportLook(He(t)),this._applyGridLines(Ns(t)),this._lookGizmoSizePx=ii(t),this._applyGizmoSize(),this._applyGizmoArrows(),this._readLookStage(t)}),this._lightRig=o?.lightRig!==!1,this._editorAmbient=new _s(16777215,.5),this._editorAmbient.layers.set(x),e.add(this._editorAmbient),this._editorDirLight=new gs(16777215,1),this._editorDirLight.position.set(10,20,10),this._editorDirLight.layers.set(x),e.add(this._editorDirLight),this._editorAmbient.visible=this._lightRig,this._editorDirLight.visible=this._lightRig,this.batchedRenderer=new Ps,this.batchedRenderer.layers.set(x),e.add(this.batchedRenderer),s.addEventListener("wheel",this._onTrackpadWheel,{passive:!1}),this.orbitControls=new ns(this.camera,s),this.orbitControls.enableDamping=!0,this.orbitControls.dampingFactor=.1,this.orbitControls.mouseButtons={LEFT:-1,MIDDLE:Jt.PAN,RIGHT:Jt.ROTATE},this.transformControls=new ee(this.camera,t),this._auxScaleControls=new ee(this.camera,t),this._auxScaleControls.setMode("scale"),this._auxRotateControls=new ee(this.camera,t),this._auxRotateControls.setMode("rotate"),this._activeGizmo=this.transformControls;const r=l=>{l.getRaycaster().layers.enableAll(),l.addEventListener("dragging-changed",c=>{const h=c.value;if(h?Es():zs(),this.orbitControls.enabled=!h,h){this._activeGizmo=l;for(const _ of this._allGizmos())_!==l&&(_.enabled=!1);const d=l.object,f=l.mode==="translate"?"position":l.mode==="rotate"?"rotation":"scale",u=_=>this._authoring().transforms?.editability?.(_,f).writable??!0,m=this._attachedAuthoringId??(d&&this._authoringIdForObject(d))??"";if(d){if(this._dragStartPos.copy(d.position),this._dragStartQuat.copy(d.quaternion),this._dragStartScale.copy(d.scale),this._otherDragObjects=[],this._allDragObjects=[],this._pivotPos.copy(d.position),d===this._pivotDummy?null:this._authoringIdForObject(d))for(const y of this._store.selectedEntityIds){if(y===m||!u(y))continue;const w=this._objectForAuthoringId(y);w&&this._otherDragObjects.push({id:y,obj:w,startPos:w.position.clone(),startQuat:w.quaternion.clone(),startScale:w.scale.clone()})}else for(const y of this._store.selectedEntityIds){if(!u(y))continue;const w=this._objectForAuthoringId(y);w&&this._allDragObjects.push({id:y,obj:w,startPos:w.position.clone(),startQuat:w.quaternion.clone(),startScale:w.scale.clone()})}const g=d===this._pivotDummy?this._allDragObjects.map(({id:y})=>y):[m,...this._otherDragObjects.map(({id:y})=>y)];this._preservedChildObjects=this._preparePreservedChildren(g.filter(Boolean)),this._activeTransformEditIds=[...new Set([...g.filter(Boolean),...this._preservedChildObjects.map(({id:y})=>y)])];const b=this._authoring();for(const y of this._activeTransformEditIds)Ie(b,y)}}else this._surfaceSnapIndicator.visible=!1,this._vertexSnapIndicator.visible=!1,this.syncFromStore()}),l.addEventListener("objectChange",()=>{const c=l.object;if(!c)return;const h=l.mode,d=this._store.pivotMode==="individual-origins"||this._dummyIsPresentationAnchor,u=this._allDragObjects.length>0?this._allDragObjects:this._otherDragObjects;if(u.length>0){if(h==="translate"){const m=c.position.clone().sub(this._dragStartPos);for(const{obj:_,startPos:g}of u)_.position.copy(g).add(m)}else if(h==="rotate"){const m=c.quaternion.clone().multiply(this._dragStartQuat.clone().invert());if(d)for(const{obj:_,startQuat:g}of u)_.quaternion.copy(m).multiply(g);else for(const{obj:_,startPos:g,startQuat:b}of u){const y=g.clone().sub(this._pivotPos);y.applyQuaternion(m),_.position.copy(this._pivotPos).add(y),_.quaternion.copy(m).multiply(b)}}else if(h==="scale"){const m=new p(this._dragStartScale.x!==0?c.scale.x/this._dragStartScale.x:1,this._dragStartScale.y!==0?c.scale.y/this._dragStartScale.y:1,this._dragStartScale.z!==0?c.scale.z/this._dragStartScale.z:1);if(d)for(const{obj:_,startScale:g}of u)_.scale.copy(g).multiply(m);else for(const{obj:_,startPos:g,startScale:b}of u){const y=g.clone().sub(this._pivotPos);y.multiply(m),_.position.copy(this._pivotPos).add(y),_.scale.copy(b).multiply(m)}}}h==="translate"&&this._store.vertexSnapActive&&this._vertexSnapTargets.length>0?this._applyVertexSnap(c,u):h==="translate"&&this._store.snapToSurface&&this._applySurfaceSnap(c,u),this._restorePreservedChildren();for(const m of this._boxHelpers.values())"update"in m&&m.update();this._flushGizmoToStoreLive()}),l.addEventListener("mouseUp",()=>{this._flushGizmoToStore()})};r(this.transformControls),r(this._auxRotateControls),r(this._auxScaleControls),this._gizmoHelper=this.transformControls.getHelper(),this._gizmoHelper.traverse(l=>l.layers.set(x)),e.add(this._gizmoHelper);for(const l of[this._auxRotateControls,this._auxScaleControls]){const c=l.getHelper();c.traverse(h=>h.layers.set(x)),c.visible=!1,e.add(c)}this._pivotDummy.layers.set(x),e.add(this._pivotDummy),this._surfaceSnapIndicator=new v(new vs(.08,.12,16),new R({color:65416,side:Yt,depthTest:!1})),this._surfaceSnapIndicator.rotation.x=-Math.PI/2,this._surfaceSnapIndicator.visible=!1,this._surfaceSnapIndicator.renderOrder=999,this._surfaceSnapIndicator.layers.set(x),e.add(this._surfaceSnapIndicator),this._vertexSnapIndicator=new v(new Z(1,8,8),new R({color:65450,depthTest:!1})),this._vertexSnapIndicator.visible=!1,this._vertexSnapIndicator.renderOrder=999,this._vertexSnapIndicator.layers.set(x),e.add(this._vertexSnapIndicator),this._gizmoLook=ei(t),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=ii(t),this._applyGizmoSize(),this._applyGizmoAxisFrame(),this._vcCamera=new $t(-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}),t.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),t.addEventListener("pointerdown",this._onPointerDown),s.addEventListener("pointermove",this._onPointerMove),this._onInteractionPointerUp=l=>{(l.target===t||l.target===s||this._pointerSessionActive)&&this._onPointerUp(l)},s.addEventListener("pointerup",this._onInteractionPointerUp),this._onInteractionDblClick=l=>{(l.target===t||l.target===s)&&this._onDoubleClick(l)},s.addEventListener("dblclick",this._onInteractionDblClick),t.addEventListener("dragover",this._onDragOver),t.addEventListener("dragleave",this._onDragLeave),t.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(t){if(t===this._scene)return;for(const i of this._editorObjects)i.removeFromParent(),t.add(i);for(const i of this._boxHelpers.values())i.removeFromParent(),t.add(i);for(const i of this._constraintHelpers.values())i.removeFromParent(),t.add(i);for(const i of this._reflectionProbeHelpers.values())i.removeFromParent(),t.add(i);for(const i of this._triggerVolumeHelpers.values())i.removeFromParent(),t.add(i);for(const{helper:i}of this._cameraHelpers.values())i.removeFromParent(),t.add(i);for(const i of this._spatialHandleRoots)i.removeFromParent(),t.add(i);this._scene=t,this._contentBoundsAt=0;const e=this._lightRig&&!this._store.isAdoptedSceneActive&&this._presentation===null;this._editorAmbient.visible=e,this._editorDirLight.visible=e}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(t){this._publishPickContext&&Ve({camera:t,canvas:this._canvas,editorControls:{activate:(e,i)=>this._selectConstraintControlAt({clientX:e,clientY:i},!1),hover:(e,i)=>this._hoverConstraintControlAt({clientX:e,clientY:i}),clearHover:()=>this._clearConstraintControlHover()}})}setProjection(t){if(this._cameraView){this._pendingProjection=t;return}if(this._projection===t)return;t==="orthographic"?this._syncOrthographicFromPerspective():this._syncPerspectiveFromOrthographic(),this._projection=t;const e=this.freeCamera;this.orbitControls.object=e;for(const i of this._allGizmos())i.camera=e;this._applyGizmoSize(),this.orbitControls.update(),this._installPickContext(e),this._onProjectionChange?.(t)}_syncOrthographicFromPerspective(t=!1){const e=Math.max(.01,this.camera.position.distanceTo(this.orbitControls?.target??new p));t||(this._orthographicHeight=2*e*Math.tan(Y.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 e=this._orthographicHeight/Math.max(this.orthographicCamera.zoom,.01)/(2*Math.tan(Y.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(e)),this.camera.quaternion.copy(this.orthographicCamera.quaternion),this.camera.up.copy(this.orthographicCamera.up),this.camera.updateMatrixWorld(!0)}_applyOrthographicFrustum(){const t=this._orthographicHeight*.5,e=t*this._viewportAspect;this.orthographicCamera.left=-e,this.orthographicCamera.right=e,this.orthographicCamera.top=t,this.orthographicCamera.bottom=-t,this.orthographicCamera.updateProjectionMatrix()}get cameraViewMode(){return this._cameraViewMode}setCameraView(t,e){if(this.clearCameraView(),this._cameraView=t,this._cameraViewMode=e,this._orbitEnabledBeforeCameraView=this.orbitControls.enabled,this._orbitTargetBeforeCameraView.copy(this.orbitControls.target),e==="pilot"){const i=t.getWorldPosition(new p),s=t.getWorldDirection(new p),o=Math.max(1,this.freeCamera.position.distanceTo(this.orbitControls.target));this.orbitControls.object=t,this.orbitControls.target.copy(i).add(s.multiplyScalar(o)),this.orbitControls.enabled=!0,this.orbitControls.update()}else this.orbitControls.enabled=!1;this._publishPickContext&&this._installPickContext(t)}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 t=this._pendingProjection;this._pendingProjection=null,t&&t!==this._projection&&this.setProjection(t),this._publishPickContext&&this._installPickContext(this.freeCamera)}get objectMap(){return this._objectMap}set objectMap(t){this._objectMap=t}attach(t){const e=this._objectForAuthoringId(t);e&&(this._attachedAuthoringId=t,this._attachGizmosTo(e))}detach(){this._attachedAuthoringId=null,this._detachGizmos()}_objectForAuthoringId(t){const e=this._authoring();return e.hierarchy.node(t)===null?null:Fi(e,this._objectMap,t)}_authoringIdForObject(t){return this._authoring().hierarchy.idForObject3D?.(t)??Gi(t)??null}_hasBoundableGeometry(t){return Hi([t]).length>0}_makeDiagnosticBounds(t){if(this._hasBoundableGeometry(t))return new Te(t,ct(this._canvas).visible);const e=new E(Gt,Gt,Gt),i=new yi(e);e.dispose();const s=new at({color:new M(ct(this._canvas).visible),toneMapped:!1}),o=new qt(i,s);return t.getWorldPosition(o.position),o.isBoxHelper=!0,o._entityObj=t,o}_syncBoxHelpers(){for(const e of this._boxHelpers.values())this._scene.remove(e),e.geometry.dispose(),e.material.dispose();this._boxHelpers.clear();const t=(e,i)=>{i.layers.set(x),this._scene.add(i),this._boxHelpers.set(e,i)};if(this._store.showHelpers&&this._store.helperVisibility.bounds)for(const e of this._objectMap.keys()){const i=this._objectForAuthoringId(e);i&&t(`bounds:${e}`,this._makeDiagnosticBounds(i))}for(const e of this._store.selectedEntityIds){const i=this._objectForAuthoringId(e);if(!i)continue;const s=this._hasBoundableGeometry(i);if(s&&this._selectionMarks.wire){let o=0;i.traverse(n=>{const r=n;if(!r.isMesh||!r.geometry||$(r))return;const l=si(this._canvas),c=new qt(new ys(r.geometry),new at({color:l.color??ct(this._canvas).visible,transparent:!0,opacity:l.opacity??.5,depthTest:!0}));c.matrixAutoUpdate=!1,c._wireOf=r,t(`wire:${e}:${o++}`,c)})}if(!(s&&!this._selectionMarks.box)){if(s){const o=oi(this._canvas);t(`selection:${e}`,new de(i,{color:ct(this._canvas).visible,edges:o.edges,frame:o.frame,...o.lineWidth===null?{}:{lineWidth:o.lineWidth}}));continue}this._standaloneAuthoring&&i.isBone||[...this._constraintHelpers.values()].some(o=>o.presents(i))||t(`selection:${e}`,new de(i,{fixedSize:Gt,color:ct(this._canvas).visible}))}}}_syncReflectionProbeHelpers(t=null){if(t===null){const e=new Map,i=new Set;for(const[s,o]of this._objectMap)!o||i.has(o)||!Wt(o)||(i.add(o),e.set(s,o));for(const[s,o]of this._reflectionProbeHelpers)e.get(s)!==o.source&&(o.dispose(),this._reflectionProbeHelpers.delete(s));for(const[s,o]of e)this._ensureReflectionProbeHelper(s,o)}else{let e=!1;for(const i of t){const s=this._objectMap.get(i),o=s&&Wt(s)?s:null,n=this._reflectionProbeHelpers.get(i);n&&n.source!==o&&(o===null&&(e=!0),n.dispose(),this._reflectionProbeHelpers.delete(i)),o&&![...this._reflectionProbeHelpers.values()].some(r=>r.source===o)&&this._ensureReflectionProbeHelper(i,o)}if(e){this._syncReflectionProbeHelpers();return}}for(const[e,i]of this._reflectionProbeHelpers)i.setSelected(this._store.selectedEntityIds.has(e)),i.visible=this._threejsToolContextActive&&this._store.showHelpers&&this._store.helperVisibility.reflectionProbes,i.update()}_ensureReflectionProbeHelper(t,e){if(this._reflectionProbeHelpers.has(t))return;const i=new $s(e);this._reflectionProbeHelpers.set(t,i),this._scene.add(i)}_syncTriggerVolumeHelpers(t=null){if(t===null){const i=new Map,s=new Set;for(const[o,n]of this._objectMap)!n||s.has(n)||!ye(n)||(s.add(n),i.set(o,n));for(const[o,n]of this._triggerVolumeHelpers)i.get(o)!==n.source&&this._disposeTriggerVolumeHelper(o,n);for(const[o,n]of i)this._ensureTriggerVolumeHelper(o,n)}else{let i=!1;for(const s of t){const o=this._objectMap.get(s),n=o&&ye(o)?o:null,r=this._triggerVolumeHelpers.get(s);r&&r.source!==n&&(n===null&&(i=!0),this._disposeTriggerVolumeHelper(s,r)),n&&![...this._triggerVolumeHelpers.values()].some(l=>l.source===n)&&this._ensureTriggerVolumeHelper(s,n)}if(i){this._syncTriggerVolumeHelpers();return}}const e=this._threeSurfaceShowing&&this._store.showHelpers&&this._store.helperVisibility.triggerVolumes;for(const[i,s]of this._triggerVolumeHelpers)s.setSelected(this._store.selectedEntityIds.has(i)),s.visible=e,s.update()}_ensureTriggerVolumeHelper(t,e){if(this._triggerVolumeHelpers.has(t))return;const i=new zo(e);this._triggerVolumeHelpers.set(t,i),this._scene.add(i)}_disposeTriggerVolumeHelper(t,e){e.dispose(),this._triggerVolumeHelpers.delete(t)}_syncConstraintHelpers(t=null){if(t===null){const i=new Map,s=new Set;for(const[o,n]of this._objectMap)!n||s.has(n)||me(n).length===0||(s.add(n),i.set(o,n));for(const[o,n]of this._constraintHelpers)i.get(o)!==n.source&&(this._disposeConstraintHelper(n),this._constraintHelpers.delete(o));for(const[o,n]of i)this._ensureConstraintHelper(o,n)}else{let i=!1;for(const s of t){const o=this._objectMap.get(s),n=o&&me(o).length>0?o:null,r=this._constraintHelpers.get(s);r&&r.source!==n&&(n===null&&(i=!0),this._disposeConstraintHelper(r),this._constraintHelpers.delete(s)),n&&![...this._constraintHelpers.values()].some(l=>l.source===n)&&this._ensureConstraintHelper(s,n)}if(i){this._syncConstraintHelpers();return}}const e=new Set;for(const i of this._store.selectedEntityIds){const s=this._objectForAuthoringId(i);s&&e.add(s)}for(const[i,s]of this._constraintHelpers)s.setSelected(this._store.selectedEntityIds.has(i)),s.setSelectedObjects(e),s.visible=this._threejsToolContextActive&&this._store.showHelpers&&this._store.helperVisibility.constraints,s.update(this.camera)}_ensureConstraintHelper(t,e){if(this._constraintHelpers.has(t))return;const i=new Vs(e);this._constraintHelpers.set(t,i),this._scene.add(i)}_disposeConstraintHelper(t){this._hoveredConstraintControl?.helper===t&&(this._hoveredConstraintControl=null),t.dispose()}_raycastConstraintControl(t){const e=[];for(const n of this._constraintHelpers.values())n.visible&&e.push(...n.controlMeshes());if(e.length===0)return null;const i=this._canvas.getBoundingClientRect(),s=new et((t.clientX-i.left)/i.width*2-1,-((t.clientY-i.top)/i.height)*2+1);this._constraintControlRaycaster.setFromCamera(s,this.renderCamera);const o=this._constraintControlRaycaster.intersectObjects(e,!1)[0]?.object;if(!o)return null;for(const n of this._constraintHelpers.values()){const r=n.controlFor(o);if(r)return{helper:n,control:r}}return null}_updateConstraintControlHover(t){if(t.buttons&1)return this._constraintControlPointerSession;const e=this._hoverConstraintControlAt(t);return e?(this._hoveredSpatialHandle&&(le(this._hoveredSpatialHandle,!1),this._hoveredSpatialHandle=null),this._canvas.style.cursor=e,!0):(this._canvas.style.cursor="",!1)}_hoverConstraintControlAt(t){const e=this._raycastConstraintControl(t),i=this._hoveredConstraintControl;return e?(i?.mesh!==e.control.mesh&&(i&&i.helper.setHoveredControl(null),e.helper.setHoveredControl(e.control.mesh),this._hoveredConstraintControl={helper:e.helper,mesh:e.control.mesh}),this._authoringIdForObject(e.control.object)?"pointer":"not-allowed"):(this._clearConstraintControlHover(),null)}_clearConstraintControlHover(){this._hoveredConstraintControl?.helper.setHoveredControl(null),this._hoveredConstraintControl=null}_selectConstraintControlAt(t,e=!0){const i=this._raycastConstraintControl(t);if(!i)return!1;this._constraintControlPointerSession=e;const s=this._authoringIdForObject(i.control.object);if(s){const o=this._authoring();Tt(o,[s],{intent:"exact"})||this._store.select(s),B(`${i.control.label} selected — move it with the gizmo.`)}else B(`${i.control.label} is a runtime-only constraint control.`);return!0}_syncCameraHelpers(t=null){if(t===null){const i=new Map;for(const[s,o]of this._objectMap){const n=this._nativeCamera(o);n&&i.set(s,n)}for(const[s,o]of this._cameraHelpers)i.get(s)!==o.source&&this._disposeCameraHelper(s,o);for(const[s,o]of i)this._ensureCameraHelper(s,o)}else{let i=!1;for(const s of t){const o=this._objectMap.get(s),n=o?this._nativeCamera(o):null,r=this._cameraHelpers.get(s);r&&r.source!==n&&(n===null&&(i=!0),this._disposeCameraHelper(s,r)),n&&![...this._cameraHelpers.values()].some(l=>l.source===n)&&this._ensureCameraHelper(s,n)}if(i){this._syncCameraHelpers();return}}const e=this._threeSurfaceShowing&&this._store.showHelpers&&this._store.helperVisibility.cameras;for(const i of this._cameraHelpers.values())i.helper.visible=e,i.helper.update()}_syncLightHelpers(t=null){if(t===null){const i=new Map;for(const[s,o]of this._objectMap){const n=this._nativeLight(o);n&&i.set(s,n)}for(const[s,o]of this._lightHelpers)i.get(s)!==o.source&&this._disposeLightHelper(s,o);for(const[s,o]of i)this._ensureLightHelper(s,o)}else{let i=!1;for(const s of t){const o=this._objectMap.get(s),n=o?this._nativeLight(o):null,r=this._lightHelpers.get(s);r&&r.source!==n&&(n===null&&(i=!0),this._disposeLightHelper(s,r)),n&&![...this._lightHelpers.values()].some(l=>l.source===n)&&this._ensureLightHelper(s,n)}if(i){this._syncLightHelpers();return}}const e=this._threeSurfaceShowing&&this._store.showHelpers&&this._store.helperVisibility.lights;for(const i of this._lightHelpers.values())i.helper.visible=e,i.helper.update?.()}_nativeLight(t){return t.isLight?t:null}_disposeLightHelper(t,e){e.helper.removeFromParent(),e.helper.dispose?.(),this._lightHelpers.delete(t)}_ensureLightHelper(t,e){if(this._lightHelpers.has(t))return;const i=.5;let s=null;const o=e;try{o.isDirectionalLight?s=new ws(e,i):o.isPointLight?s=new bs(e,i):o.isSpotLight?s=new xs(e):o.isHemisphereLight&&(s=new Ss(e,i))}catch{s=null}s&&(s.name=`Light helper: ${e.name||t}`,s.userData.editorOnly=!0,s.traverse(n=>n.layers.set(x)),s.layers.set(x),this._lightHelpers.set(t,{source:e,helper:s}),this._scene.add(s))}_syncAudioHelpers(t=null){if(t===null){const i=new Map;for(const[s,o]of this._objectMap){const n=this._nativeAudio(o);n&&i.set(s,n)}for(const[s,o]of this._audioHelpers)i.get(s)!==o.source&&this._disposeAudioHelper(s,o);for(const[s,o]of i)this._ensureAudioHelper(s,o)}else for(const i of t){const s=this._objectMap.get(i),o=s?this._nativeAudio(s):null,n=this._audioHelpers.get(i);n&&n.source!==o&&this._disposeAudioHelper(i,n),o&&![...this._audioHelpers.values()].some(r=>r.source===o)&&this._ensureAudioHelper(i,o)}const e=this._threeSurfaceShowing&&this._store.showHelpers&&this._store.helperVisibility.audio;for(const i of this._audioHelpers.values())i.helper.visible=e}_nativeAudio(t){const e=t.type;return e==="Audio"||e==="PositionalAudio"||e==="AudioListener"?t:null}_ensureAudioHelper(t,e){if(this._audioHelpers.has(t))return;const i=new Q,s=e.type==="AudioListener"?8377599:16763274,o=new v(new nt(.16),new R({color:s,wireframe:!0,depthTest:!1}));i.add(o),i.name=`Audio helper: ${e.name||t}`,i.userData.editorOnly=!0,i.traverse(n=>n.layers.set(x)),i.layers.set(x),e.add(i),this._audioHelpers.set(t,{source:e,helper:i})}_disposeAudioHelper(t,e){e.helper.traverse(i=>{const s=i;s.geometry?.dispose?.(),s.material?.dispose?.()}),e.helper.removeFromParent(),this._audioHelpers.delete(t)}_disposeCameraHelper(t,e){e.helper.removeFromParent(),e.helper.dispose(),this._cameraHelpers.delete(t)}_ensureCameraHelper(t,e){if(this._cameraHelpers.has(t))return;let i;try{i=new Cs(e)}catch(s){this._refuseCameraOverlay(t,e,s);return}i.name=`Camera frustum: ${e.name||t}`,i.userData.editorOnly=!0,i.layers.set(x),this._cameraHelpers.set(t,{source:e,helper:i}),this._scene.add(i)}_refusedCameraOverlays=new Set;_refuseCameraOverlay(t,e,i){this._refusedCameraOverlays.has(t)||(this._refusedCameraOverlays.add(t),It.warn(`Helpers → Cameras draws no frustum for "${e.name||e.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(t){if(t.isCamera)return t;const e=K(t,"_camera");return e?.isCamera?e:null}_syncSpatialHandles(){ai(this._spatialHandleRoots),this._spatialHandleRoots=[],this._spatialHandleMeshes=[],this._hoveredSpatialHandle=null;const t=Kt(this._authoring());if(!t||!this._threejsToolContextActive||!this._store.showHelpers)return;const e=this._store.helperVisibility;for(const i of this._store.selectedEntityIds){const s=t.layers(i).filter(n=>n.category in e?e[n.category]:!0),o=ao(i,s);for(const n of o.handles)ri(n,this.renderCamera);for(const n of o.roots)this._scene.add(n);this._spatialHandleRoots.push(...o.roots),this._spatialHandleMeshes.push(...o.handles)}}_raycastSpatialHandle(t){if(this._spatialHandleMeshes.length===0)return null;const e=this._canvas.getBoundingClientRect(),i=new et((t.clientX-e.left)/e.width*2-1,-((t.clientY-e.top)/e.height)*2+1);return this._spatialHandleRaycaster.setFromCamera(i,this.renderCamera),this._spatialHandleRaycaster.intersectObjects(this._spatialHandleMeshes,!1)[0]?.object??null}_spatialHandleWorldPoint(t){const e=this._canvas.getBoundingClientRect(),i=new et((t.clientX-e.left)/e.width*2-1,-((t.clientY-e.top)/e.height)*2+1);this._spatialHandleRaycaster.setFromCamera(i,this.renderCamera);const s=new p;return this._spatialHandleRaycaster.ray.intersectPlane(this._spatialHandleDragPlane,s)?s.add(this._spatialHandleDragOffset):null}_finishSpatialHandleDrag(t){const e=this._activeSpatialHandle;this._activeSpatialHandle=null,this.orbitControls.enabled=this._orbitEnabledBeforeHandleDrag,this.transformControls.enabled=this._transformEnabledBeforeHandleDrag,this.syncFromStore(),this._canvas.style.cursor="",t&&e&&Kt(this._authoring())?.commit(e.nodeId,e.handle.id,[this._spatialHandleDragPoint.x,this._spatialHandleDragPoint.y,this._spatialHandleDragPoint.z])}_updateSpatialHandleDrag(t){const e=this._activeSpatialHandle;if(!e)return!1;const i=this._spatialHandleWorldPoint(t);return i&&(this._spatialHandleDragPoint.copy(i),Kt(this._authoring())?.preview(e.nodeId,e.handle.id,[i.x,i.y,i.z]),this._syncSpatialHandles(),this._canvas.style.cursor="grabbing"),!0}_updateSpatialHandleHover(t){if(t.buttons&1||this._spatialHandleMeshes.length===0)return;const e=this._raycastSpatialHandle(t);if(e===this._hoveredSpatialHandle)return;if(this._hoveredSpatialHandle&&le(this._hoveredSpatialHandle,!1),this._hoveredSpatialHandle=e,!e){this._canvas.style.cursor="";return}le(e,!0);const i=ni(e);this._canvas.style.cursor=i?.handle.writable?"grab":"not-allowed"}_updateEditorHandleInteraction(t){return this._updateSpatialHandleDrag(t)||this._updateConstraintControlHover(t)}_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:t})=>t),...this._spatialHandleRoots]}_suspendPreviewInfrastructure(){const t=this._previewInfrastructure().map(e=>[e,e.visible]);for(const[e]of t)e.visible=!1;return()=>{for(const[e,i]of t)e.visible=i}}_allGizmos(){return[this.transformControls,this._auxRotateControls,this._auxScaleControls]}_anyGizmoDragging(){return this._allGizmos().some(t=>t.dragging)}_attachGizmosTo(t){this.transformControls.attach(t),this._auxRotateControls.attach(t),this._auxScaleControls.attach(t)}_detachGizmos(){for(const t of this._allGizmos())t.detach()}syncFromStore(){this._gizmoHelper.traverse(S=>S.layers.set(x));const t=this._store.transformMode,i=t==="combined"||t==="select"?"translate":t;this.transformControls.mode!==i&&this.transformControls.setMode(i),this._applySnapToGizmos();for(const S of this._allGizmos())S.setSpace(this._store.transformSpace);const s=zt(),o=this._authoring(),n=s.toolOwner(o,this._store.selectedEntityIds);this._threejsToolContextActive=(this._standaloneAuthoring||s.toolOwnerPainted(this._store,n))&&n?.kind==="three";const r=this._standaloneAuthoring||s.threeSurfaceShowing(this._store,o);this._threeSurfaceShowing=r,this.grid.visible=this._presentationGrid&&r,this._axisLines&&(this._axisLines.visible=this.grid.visible&&this._axesWanted);const l=this._store.helperVisibility,c=this._standaloneAuthoring?null:s.threeViewportRootId(this._store),h=c!==null&&ts(c);h&&s.applyRootHiddenVisibility(this._objectMap,c),h&&s.suppressRootEnvironment(this._scene);const d=this._store.gizmoEpoch,f=`${this._store.showHelpers}|${JSON.stringify(l)}|${c??""}|${h}|${this._threejsToolContextActive}`,u=this._objectMap!==this._lastGizmoObjectMap,m=f!==this._lastGizmoSig,_=u?null:this._store.ingestObjectMapMembershipChangesSince(this._lastGizmoEpoch),g=u||m||_===null?null:_.changedIds,b=g===null||g.size>0;if(this._lastGizmoObjectMap=this._objectMap,this._lastGizmoSig=f,this._lastGizmoEpoch=d,b){s.applyRootHiddenVisibility(this._objectMap,c);const S=g===null?To(this._objectMap):Io(this._objectMap,g);for(const C of S)C.traverse(P=>{if(K(P,"editorIcon")){P.visible=this._store.showHelpers;return}if(!K(P,"editorHelper"))return;const I=K(P,"editorHelperType");if(I==="skeletons"){P.visible=this._store.showHelpers&&(l.skeletons||!!K(P,"skeletonEnabled"));return}I&&I in l?P.visible=this._store.showHelpers&&l[I]:P.visible=this._store.showHelpers});for(const[C,P]of this._helpers)P.visible=this._store.showHelpers&&(!(C in l)||l[C]);this._syncCameraHelpers(g),this._syncLightHelpers(g)}this._syncAudioHelpers(g),this._syncReflectionProbeHelpers(g),this._syncTriggerVolumeHelpers(g),this._syncConstraintHelpers(g);const y=this._threejsToolContextActive&&o.capabilities.transform&&t!=="select"?this._store.selectedEntityId:null,w=t==="translate"||t==="combined"?"position":t==="rotate"?"rotation":"scale",T=y?t==="combined"?(S=>["position","rotation","scale"].some(C=>o.transforms?.editability?.(S,C).writable??!0))(y):o.transforms?.editability?.(y,w).writable??!0:!1;if(y&&T){if(!this._anyGizmoDragging())if(this._store.pivotMode==="median-point"&&this._store.selectedEntityIds.size>1){const S=new p;let C=0;for(const P of this._store.selectedEntityIds){if(!(o.transforms?.editability?.(P,w).writable??!0))continue;const I=this._objectForAuthoringId(P);I&&(S.add(I.getWorldPosition(jo)),C++)}C>0&&S.divideScalar(C),this._pivotDummy.position.copy(S),this._pivotDummy.quaternion.identity(),this._pivotDummy.scale.set(1,1,1),this._attachedAuthoringId=null,this._dummyIsPresentationAnchor=!1,this._attachGizmosTo(this._pivotDummy)}else{const S=this._objectForAuthoringId(y),C=K(S,"pivot"),P=C&&(C[0]!==0||C[1]!==0||C[2]!==0),I=P?null:this._centreAnchorFor(S);if(I&&S)this._pivotDummy.position.copy(I),this._pivotDummy.quaternion.copy(S.getWorldQuaternion(ue)),this._pivotDummy.scale.copy(S.getWorldScale(di)),this._attachedAuthoringId=y,this._dummyIsPresentationAnchor=!0,this._attachGizmosTo(this._pivotDummy);else if(P&&S){const Mt=new p(C[0],C[1],C[2]);Mt.applyQuaternion(S.getWorldQuaternion(ue)),this._pivotDummy.position.copy(S.getWorldPosition(hi)).add(Mt),this._pivotDummy.quaternion.copy(ue),this._pivotDummy.scale.copy(S.getWorldScale(di)),this._attachedAuthoringId=y,this._dummyIsPresentationAnchor=!1,this._attachGizmosTo(this._pivotDummy)}else this._dummyIsPresentationAnchor=!1,this.attach(y)}}else this.detach();this._syncBoxHelpers(),this._syncSpatialHandles(),this._syncCombinedGizmoHalves()}_applySnapToGizmos(){const t=this._store.snapEnabled||this._snapHold,e=this._store.snapValues;for(const i of this._allGizmos())i.setTranslationSnap(t?e.translate:null),i.setRotationSnap(t?Y.degToRad(e.rotate):null),i.setScaleSnap(t?e.scale:null)}_onAltOrbitStart=t=>{t.altKey&&t.button===0&&(this._altDragOrbit=!0,this.orbitControls.mouseButtons.LEFT=Jt.ROTATE)};_onAltOrbitRelease=()=>{this._altDragOrbit&&(this._altDragOrbit=!1,this.orbitControls.mouseButtons.LEFT=-1)};_onSnapHoldKey=t=>{const e=t.ctrlKey||t.metaKey;if(e!==this._snapHold&&(this._snapHold=e,this._applySnapToGizmos(),e&&this._anyGizmoDragging()&&!this._store.snapEnabled)){const{translate:i,rotate:s,scale:o}=this._store.snapValues;B(`Snapping while held: ${i} units · ${s}° · ×${o}`)}};_syncCombinedGizmoHalves(){if(this._anyGizmoDragging())return;const t=this._store.transformMode==="combined",e=this._attachedAuthoringId,i=this._authoring().transforms?.editability,s=c=>e===null||(i?.(e,c).writable??!0),o=t&&this._auxRotateControls.object!==void 0&&s("rotation"),n=t&&this._transformHandles.scale&&this._auxScaleControls.object!==void 0&&s("scale");this._auxRotateControls.enabled=o,this._auxScaleControls.enabled=n;const r=this._auxRotateControls.getHelper(),l=this._auxScaleControls.getHelper();r.visible=o,l.visible=n;for(const c of[r,l])c.traverse(h=>h.layers.set(x));this.transformControls.enabled=!0}moveGizmosTo(t){const e=this._gizmoObjects();for(const i of e)t.add(i)}restoreGizmos(){const t=this._gizmoObjects();for(const e of t)this._scene.add(e)}_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:t})=>t),...this._spatialHandleRoots]}_contentBounds(t=!1){const e=performance.now(),i=this._contentBoundsAt===0||e-this._contentBoundsAt>Lo;if(t||i){this._contentBoundsBox.makeEmpty();for(const s of this._scene.children)$(s)||Bi(this._contentBoundsBox,s);this._contentBoundsAt=e}return this._contentBoundsBox}_measureContentBounds(){const t=[];for(const e of this._scene.children)$(e)||Wi(e,t);this._contentBoundsBox.makeEmpty();for(const e of t)this._contentBoundsBox.union(e);return this._contentBoundsAt=performance.now(),t}_updateClipPlanes(){const t=this._contentBounds();let e=0,i=0;t.isEmpty()||(t.getBoundingSphere(pe),e=this.freeCamera.position.distanceTo(pe.center),i=pe.radius);const{near:s,far:o}=os(e,i);s===this.camera.near&&o===this.camera.far||(this.camera.near=s,this.camera.far=o,this.camera.updateProjectionMatrix(),this.orthographicCamera.near=s,this.orthographicCamera.far=o,this.orthographicCamera.updateProjectionMatrix())}seedFromGameCamera(t){const e=Xe(this._measureContentBounds()),i=Ts(t,e);if(!i)return!1;const s=this.camera.position.clone(),o=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(r=>!$(r));return Is(this.camera,n,i.position.distanceTo(i.target))?(this._updateClipPlanes(),this.orbitControls.update(),!0):(this.camera.position.copy(s),this.orbitControls.target.copy(o),this.camera.lookAt(this.orbitControls.target),this.camera.updateMatrixWorld(!0),!1)}focusOnScene(){const t=Xe(this._measureContentBounds());if(t.isEmpty())return!1;const e=t.getCenter(new p),i=this.camera.position.clone().sub(this.orbitControls.target).normalize(),s=ce(t,this.camera,i);return Number.isFinite(s)?(this.camera.position.copy(e).add(i.multiplyScalar(s)),this.orbitControls.target.copy(e),this._orthographicHeight=Math.max(t.getSize(new p).y,t.getSize(new p).x/this._viewportAspect)*1.15,this._syncOrthographicFromPerspective(!0),this._updateClipPlanes(),!0):!1}focusOn(t){const e=this._contentOrProbeBounds(t),i=e.getCenter(new p),s=this.camera.position.clone().sub(this.orbitControls.target).normalize(),o=ce(e,this.camera,s);this.camera.position.copy(i).add(s.multiplyScalar(o)),this.orbitControls.target.copy(i);const n=e.getSize(new p);this._orthographicHeight=Math.max(n.y,n.x/this._viewportAspect,.01)*1.15,this._syncOrthographicFromPerspective(!0)}activateVertexSnap(){this._vertexSnapTargets=this._collectVertices(this._store.selectedEntityIds)}deactivateVertexSnap(){this._vertexSnapTargets=[],this._vertexSnapIndicator.visible=!1}focusOnMultiple(t){if(t.length===0)return;if(t.length===1){this.focusOn(t[0]);return}const e=new vt;for(const r of t)e.union(this._contentOrProbeBounds(r));const i=e.getCenter(new p),s=this.camera.position.clone().sub(this.orbitControls.target).normalize(),o=ce(e,this.camera,s);this.camera.position.copy(i).add(s.multiplyScalar(o)),this.orbitControls.target.copy(i);const n=e.getSize(new p);this._orthographicHeight=Math.max(n.y,n.x/this._viewportAspect,.01)*1.15,this._syncOrthographicFromPerspective(!0)}_centreAnchorFor(t){const e=this._store.gizmoAnchor;if(!t||e==="pivot"||e==="auto"&&Vi(t)===0)return null;const i=Bt(t);if(i.isEmpty()||e==="auto"&&!Xi(t,i)?.worldAnchored)return null;const s=i.getCenter(new p);return t.updateWorldMatrix(!0,!1),s.distanceToSquared(t.getWorldPosition(hi))<Do?null:s}_contentOrProbeBounds(t){const e=Wt(t);if(!e)return Bt(t);const i=e.config,[s,o,n]=i.size,r=i.shape==="sphere"?new p(1,1,1).multiplyScalar(Math.max(.01,i.radius)):new p(Math.max(.01,s),Math.max(.01,o),Math.max(.01,n)).multiplyScalar(.5);return t.updateWorldMatrix(!0,!1),new vt(r.clone().negate(),r).applyMatrix4(t.matrixWorld)}setHelper(t,e){tt();const i=this._helpers.get(t);if(i&&(this._scene.remove(i),this._helpers.delete(t)),!e)return;W(e,"editorHelper",!0),W(e,"editorHelperType",t);const s=this._store.helperVisibility;e.visible=this._store.showHelpers&&(!(t in s)||s[t]),this._scene.add(e),this._helpers.set(t,e)}setViewPreset(t){this._projection==="orthographic"&&this.setProjection("perspective");const e=this.orbitControls.target.clone(),i=this.camera.position.distanceTo(e),s=new p;switch(t){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"perspective":s.set(1,1,1).normalize();break}this.camera.position.copy(e).add(s.multiplyScalar(i)),this.camera.lookAt(e),t!=="perspective"&&this.setProjection("orthographic"),this.orbitControls.update()}setPose(t,e,i){this.setProjection("perspective"),this.camera.position.set(t.x,t.y,t.z),this.orbitControls.target.set(e.x,e.y,e.z),this.camera.lookAt(this.orbitControls.target),i!==void 0&&(this.camera.fov=i,this.camera.updateProjectionMatrix()),this.orbitControls.update()}resize(t,e){this._viewportAspect=Math.max(1,t)/Math.max(1,e),this.camera.aspect=this._viewportAspect,this.camera.fov=fi(this._viewportAspect),this.camera.updateProjectionMatrix(),this._applyOrthographicFrustum(),this._applyGizmoSize()}update(t=0){this._ensureSparkRenderer(),this._syncLookBackground();const e=this.transformControls.object;if(e&&e!==this._pivotDummy&&!e.parent&&(this._detachGizmos(),this.syncFromStore()),this._updateFlyCamera(t),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 o=new L().slerpQuaternions(this._snapQ1,this._snapQ2,s),n=new p(0,0,1).applyQuaternion(o);this.freeCamera.position.copy(this.orbitControls.target).add(n.multiplyScalar(this._snapDist)),this.freeCamera.lookAt(this.orbitControls.target),s>=1&&(this._snapAnimating=!1)}this._presentation&&(this._presentation.rig.resolveSource({light:this._store.isAdoptedSceneActive}),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 de){i.updateIfNeeded();continue}const o=i;o._entityObj?o._entityObj.getWorldPosition(i.position):i instanceof Te&&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)ri(i,this.renderCamera);this._enforceLodForcedLevels(),this._updateClipPlanes()}_enforceLodForcedLevels(){const t=new Set(this._objectMap.values());for(const[e,i]of this._store.lodForcedLevels){const s=this._objectMap.get(e),o=s?Ni(s,r=>t.has(r)):null;if(!o||o.levels.length===0)continue;o.autoUpdate=!1;const n=Math.min(Math.max(i,0),o.levels.length-1);for(let r=0;r<o.levels.length;r++)o.levels[r].object.visible=r===n}}renderWithInfrastructure(t){const e=this._sparkRenderer,i=this._cameraView?this._suspendPreviewInfrastructure():null;e&&this._scene.add(e);try{t()}finally{e?.removeFromParent(),i?.()}}renderViewCube(t){if(!this._threeSurfaceShowing||this._navigation==="hidden"||this._cameraView)return;const e=t.domElement.clientWidth,i=t.domElement.clientHeight,s=this._vcSize,o=this._vcDir.subVectors(this.freeCamera.position,this.orbitControls.target).normalize();this._vcCamera.position.copy(o.multiplyScalar(4)),this._vcCamera.up.copy(this.freeCamera.up),this._vcCamera.lookAt(0,0,0),this._syncOrientationGizmoDepth();const n=this._vcOrigin(e,i,this._chromeInsetPx),r=n.left,l=i-s-n.top,c=t.autoClear;try{t.setScissorTest(!0),t.setViewport(r,l,s,s),t.setScissor(r,l,s,s),t.clear(!1,!0,!1),t.autoClear=!1,t.render(this._vcScene,this._vcCamera)}finally{t.autoClear=c,t.setScissorTest(!1),t.setViewport(0,0,e,i)}}renderCameraPreview(t,e,i){if(!e||!i||this._cameraView)return;const s=t.domElement.clientWidth,o=t.domElement.clientHeight,n=t.domElement.getBoundingClientRect(),r=i.getBoundingClientRect(),l=Math.round(r.left-n.left),c=Math.round(n.bottom-r.bottom),h=Math.max(1,Math.round(r.width)),d=Math.max(1,Math.round(r.height));if(l>=s||c>=o||l+h<=0||c+d<=0)return;const f=this._suspendPreviewInfrastructure(),u=t.getClearColor(this._previewClearColor),m=t.getClearAlpha();try{t.setScissorTest(!0),t.setViewport(l,c,h,d),t.setScissor(l,c,h,d),t.setClearColor(1118740,1),t.clear(),t.render(this._scene,e)}finally{t.setScissorTest(!1),t.setViewport(0,0,s,o),t.setClearColor(u,m),f()}}get isFlying(){return this._flyActive}_inputDisconnected=!1;disconnectInput(){if(!this._inputDisconnected){this._inputDisconnected=!0,this._publishPickContext&&Ve(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 t of this._allGizmos())t.dispose()}}_applyViewportLook(t){this._lookGridHex=t.grid??10066329;const e=this.grid.material.uniforms.uGrazingFade;if(e&&(e.value=t.background!==null?1:0),this._paintLookGrid(),this._lookAxisHexes=[t.axisX,t.axisY,t.axisZ],this._axisLines&&(this._axisLines.material.linewidth=t.axisLineWidth??2),this._verticalAxisLine&&(this._verticalAxisLine.material.linewidth=t.axisLineWidth??2),this._rebuildAxisLines(),t.background!==null){const i=this._scene.background,s=i===null||i instanceof M&&[this._lookBackgroundHex,t.background].includes(i.getHex());this._lookBackgroundHex=t.background,s&&this._paintLookBackground()}else this._lookBackgroundHex=null}bindPresentation(t,e){this._presentation?.stop();const i=new ss(this._scene),s=i.roots();this._editorObjects.push(...s),Yi(t,e);const o=()=>{const l=Ji(t);this._renderer&&i.apply(l,this._renderer,void 0,{tone:!1,sky:!1,floor:!1}),this.setStageFunction(l.world,l.interaction),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),tt()},n=qi(o),r={rig:i,stop:()=>{n(),i.dispose(),this._editorObjects=this._editorObjects.filter(c=>!s.includes(c)),this._presentation===r&&(this._presentation=null);const l=this._lightRig&&!this._store.isAdoptedSceneActive;this._editorAmbient.visible=l,this._editorDirLight.visible=l}};return this._presentation=r,this._editorAmbient.visible=!1,this._editorDirLight.visible=!1,o(),r.stop}setSelectionMarks(t){const e=this._selectionMarks;e.outline===t.outline&&e.wire===t.wire&&e.box===t.box||(this._selectionMarks={outline:t.outline,wire:t.wire,box:t.box},this._syncBoxHelpers())}setGridMajorEvery(t){const e=this.grid.material.uniforms.uMajorEvery;e&&Number.isFinite(t)&&t>=1&&(e.value=t)}_gridMajorContrast=1;_applyGridLines(t){const e=this.grid.material.uniforms;e.uLineWidth&&(e.uLineWidth.value=t.lineWidth),e.uMajorWidth&&(e.uMajorWidth.value=t.majorWidth),this._gridMajorContrast=t.majorContrast,this._paintLookGrid()}_paintLookGrid(){const t=this._lookGridHex;if(t===null)return;const e=this._lookBackgroundHex??4144959,i=r=>{const l=t>>r&255,c=e>>r&255;return Math.round(Math.min(255,Math.max(0,c+(l-c)*this._gridMajorContrast)))},s=i(16)<<16|i(8)<<8|i(0),o=li(t,this._renderer),n=li(s,this._renderer);this.grid.material.uniforms.uColor?.value?.copy(o),this.grid.material.uniforms.uMajorColor?.value?.copy(n)}_rebuildAxisLines(){const t=this._axisLines;if(!t)return;const e=this._stageAxisFrame,i=this._stageAxes,s=[0,1,2].filter(l=>{const c=e[l][0];return i==="floor"?l!==1:["x","y","z"].some((h,d)=>d===c&&i[h])});if(this._axesWanted=s.length>0,t.visible=this.grid.visible&&this._axesWanted,!this._axesWanted)return;const o=l=>{const c=[],h=[];for(const f of l){const u=e[f][0],m=this._lookAxisHexes[u],_=m==null?this._gizmoAxisColor(u):new M(m);c.push(..._i(f));for(let g=0;g<Ce*2;g++)h.push(_.r,_.g,_.b)}const d=new ge;return d.setPositions(c),d.setColors(h),d},n=s.filter(l=>l!==1),r=s.includes(1);if(t.material.visible=n.length>0,n.length>0&&(t.geometry.dispose(),t.geometry=o(n)),r&&!this._verticalAxisLine){const l=t.material;this._verticalAxisLine=new _e(o([1]),new ve({vertexColors:!0,linewidth:l.linewidth,transparent:!0,opacity:1,depthWrite:!1,toneMapped:!1})),this._verticalAxisLine.layers.set(x),t.add(this._verticalAxisLine)}else r&&this._verticalAxisLine&&(this._verticalAxisLine.geometry.dispose(),this._verticalAxisLine.geometry=o([1]));this._verticalAxisLine&&(this._verticalAxisLine.visible=r)}setAxisLines(t){t===this._stageAxes||typeof t=="object"&&typeof this._stageAxes=="object"&&t.x===this._stageAxes.x&&t.y===this._stageAxes.y&&t.z===this._stageAxes.z||(this._stageAxes=typeof t=="object"?{x:t.x,y:t.y,z:t.z}:t,this._rebuildAxisLines())}_paintLookBackground(){if(this._lookBackgroundHex===null)return;const t=this._scene.background;t instanceof M&&t.getHex()===this._lookBackgroundHex||(this._scene.background=new M(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._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),Zi(this._sparkRenderer),this._sparkRenderer=null),this.disconnectInput(),this._hideDropOverlay();for(const t of this._helpers.values())this._scene.remove(t);this._helpers.clear();for(const t of this._boxHelpers.values())this._scene.remove(t),t.geometry.dispose(),t.material.dispose();this._boxHelpers.clear();for(const t of this._reflectionProbeHelpers.values())t.dispose();this._reflectionProbeHelpers.clear();for(const t of this._triggerVolumeHelpers.values())t.dispose();this._triggerVolumeHelpers.clear();for(const t of this._constraintHelpers.values())t.dispose();this._constraintHelpers.clear();for(const{helper:t}of this._cameraHelpers.values())t.dispose();this._cameraHelpers.clear(),ai(this._spatialHandleRoots),this._spatialHandleRoots=[],this._spatialHandleMeshes=[]}_ensureSparkRenderer(){if(!this._renderer||this._sparkRenderer||this._sparkRendererLoading||this._sparkRendererFailed)return;const t=performance.now();Qi(this._lastSparkDiscoveryAt,t)&&(this._lastSparkDiscoveryAt=t,Ui(this._scene)&&(this._sparkRendererLoading=!0,es(async()=>{const{SparkRenderer:e}=await import("./spark.module-CXth-y_a.js");return{SparkRenderer:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).then(({SparkRenderer:e})=>{if(this._disposed||!this._renderer)return;const i=new e({renderer:this._renderer,enableLod:!1});i.traverse(s=>W(s,"engineInternal",!0)),this._sparkRenderer=i,tt()}).catch(e=>{this._sparkRendererFailed=!0,console.error("Failed to install SparkRenderer in the editor viewport.",e)}).finally(()=>{this._sparkRendererLoading=!1})))}_buildOrientationGizmo(){if(this._vcScene!==void 0){for(const t of[...this._vcScene.children]){this._vcScene.remove(t);const e=t;e.isSprite||e.geometry?.dispose();const i=e.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 t=this._gizmoLook.navigationForm;if(t!=="balls"){this._initNavigationForm(t);return}const e=rt/3,i=be/e,s=Uo/e,o=xe/e/2,n=[new p(1,0,0),new p(0,1,0),new p(0,0,1)],r=new Z(i*.6,8,8),l=new R({visible:!1});for(let c=0;c<3;c++){const[h,d]=this._stageAxisFrame[c],f=this._gizmoLook.navigation??this._gizmoLook.axes,u=f===null?mi[h]:new M(f[h]),m=ui[h],_=n[c].clone().multiplyScalar(d),g=new v(new k(o,o,s,8),new R({color:u,transparent:!0,depthTest:!1}));g.position.copy(_).multiplyScalar(s/2),g.quaternion.setFromUnitVectors(new p(0,1,0),_),this._vcScene.add(g),this._vcStalks.push({mesh:g,direction:_.clone()});for(const b of[1,-1]){const y=_.clone().multiplyScalar(b),w=new Be(new We({map:Zo(u,b>0?m:null),transparent:!0,depthTest:!1}));w.position.copy(y).multiplyScalar(s),w.scale.setScalar(i),this._vcScene.add(w),this._vcBalls.push({sprite:w,direction:y.clone(),positive:b>0});const z=new v(r,l);z.position.copy(w.position),W(z,"vcDirIdx",c*2+(d*b>0?0:1)),this._vcScene.add(z),this._vcClickTargets.push(z)}}}_initNavigationForm(t){const e=rt/3,i=new p(0,1,0),s=[new p(1,0,0),new p(0,1,0),new p(0,0,1)],o=this._gizmoLook.navigation??this._gizmoLook.axes,n=(r,l,c,h)=>{const d=new Be(new We({map:qo(r,l),transparent:!0,depthTest:!1}));d.position.copy(c),d.scale.setScalar(h/e),d.renderOrder=200,this._vcScene.add(d)};for(let r=0;r<3;r++){const[l,c]=this._stageAxisFrame[r],h=o===null?mi[l]:new M(o[l]),d=ui[l],f=s[r].clone().multiplyScalar(c);if(t==="triad"){const u=this._gizmoLook.navigationSize??1,m=24*u/e,_=xe*Math.sqrt(u)/e/2,g=new v(new k(_,_,m,6),new R({color:h,transparent:!0,depthTest:!1}));g.position.copy(f).multiplyScalar(m/2),g.quaternion.setFromUnitVectors(i,f),this._vcScene.add(g),this._vcSolids.push({mesh:g,direction:f.clone()}),n(h,d,f.clone().multiplyScalar(m+7*u/e),12*u);continue}for(const u of[1,-1]){const m=f.clone().multiplyScalar(u),_=new v(new As(6/e,15/e,20),new R({color:u>0?h:new M(14277081),transparent:!0,depthTest:!1}));_.position.copy(m).multiplyScalar(19/e),_.quaternion.setFromUnitVectors(i,m.clone().negate()),W(_,"vcDirIdx",r*2+(c*u>0?0:1)),this._vcScene.add(_),this._vcSolids.push({mesh:_,direction:m.clone()}),this._vcClickTargets.push(_),u>0&&n(h,d.toLowerCase(),m.clone().multiplyScalar(34/e),12)}}if(t==="cones"){const r=new v(new E(11/e,11/e,11/e),new R({color:12434877,transparent:!0,depthTest:!1}));r.renderOrder=50,this._vcScene.add(r)}}_syncOrientationGizmoDepth(){const t=rt/3,e=this._vcDir.copy(this._vcCamera.position).normalize();for(const{sprite:i,direction:s,positive:o}of this._vcBalls){const n=(s.dot(e)+1)/2,r=i.material;r.opacity=o?1:.56+n*.44,i.scale.setScalar((be+Ko*n)/t),i.renderOrder=10+Math.round(n*100)}for(const{mesh:i,direction:s}of this._vcStalks){const o=(s.dot(e)+1)/2;i.material.opacity=.35+o*.65,i.renderOrder=Math.round(o*100)}for(const{mesh:i,direction:s}of this._vcSolids)i.renderOrder=Math.round((s.dot(e)+1)/2*100)}_isOverViewCube(t,e){if(this._navigation!=="interactive"||this._gizmoLook.navigationForm==="triad")return!1;const i=this._canvas.getBoundingClientRect(),s=t-i.left,o=e-i.top,{left:n,top:r}=this._vcOrigin(i.width,i.height,this._chromeInsetPx);return s>=n&&s<=n+this._vcSize&&o>=r&&o<=r+this._vcSize}_vcOrigin(t,e,i){return this._gizmoLook.navigationCorner==="bottom-left"?{left:4+i,top:e-this._vcSize-48-i}:{left:t-this._vcSize-this._vcMarginRight-i,top:this._vcMarginTop+i}}setGridVisible(t){t!==this._presentationGrid&&(this._presentationGrid=t,this._applyGridVisibility())}_applyGridVisibility(){this.grid.visible=this._presentationGrid&&this._threeSurfaceShowing,this._axisLines&&(this._axisLines.visible=this.grid.visible&&this._axesWanted),tt()}setNavigation(t){t!==this._navigation&&(this._navigation=t,tt())}_handleViewCubeClick(t){if(!this._isOverViewCube(t.clientX,t.clientY))return!1;const e=this._canvas.getBoundingClientRect(),i=t.clientX-e.left,s=t.clientY-e.top,{left:o,top:n}=this._vcOrigin(e.width,e.height,this._chromeInsetPx),r=(i-o)/this._vcSize*2-1,l=-((s-n)/this._vcSize*2-1);this._vcRaycaster.setFromCamera(new et(r,l),this._vcCamera);const c=this._vcRaycaster.intersectObjects(this._vcClickTargets);if(c.length===0)return!0;const h=K(c[0].object,"vcDirIdx"),d=Ro[h],f=new p().subVectors(this.freeCamera.position,this.orbitControls.target).normalize();return this._snapDist=this.freeCamera.position.distanceTo(this.orbitControls.target),this._snapQ1.setFromUnitVectors(new p(0,0,1),f),this._snapQ2.setFromUnitVectors(new p(0,0,1),d),this._snapStartTime=performance.now(),this._snapAnimating=!0,!0}_flushGizmoToStoreLive(){this._skipNextSync=!0;const t=this._authoring(),e=(s,o)=>{s&&Le(t,s,{position:o.position.toArray(),rotation:o.quaternion.toArray(),scale:o.scale.toArray()})},i=this._activeGizmo.object;i&&i!==this._pivotDummy&&e(this._attachedAuthoringId??this._authoringIdForObject(i),i);for(const{id:s,obj:o}of this._otherDragObjects)e(s,o);for(const{id:s,obj:o}of this._allDragObjects)e(s,o);for(const{id:s,obj:o}of this._preservedChildObjects)e(s,o)}_preparePreservedChildren(t){if(!this._store.preserveChildrenTransform)return[];const e=this._authoring(),i=new Set(t),s=new Map;for(const o of i){const n=this._preservedChildrenForParent(e,o,i,s);if(typeof n=="string")return B(n),[];for(const r of n)s.set(r.id,r)}return[...s.values()]}_preservedChildrenForParent(t,e,i,s){const o=[];for(const n of t.hierarchy.node(e)?.childIds??[]){if(i.has(n)||s.has(n))continue;const r=this._objectForAuthoringId(n);if(!r?.parent)continue;const l=this._unwritableTransformChannel(t,n);if(l){const c=t.hierarchy.node(n)?.label??n;return`Preserve Children Transform needs writable ${l} on ${c}. The parent will transform normally.`}r.updateWorldMatrix(!0,!1),o.push({id:n,obj:r,worldMatrix:r.matrixWorld.clone()})}return o}_unwritableTransformChannel(t,e){return["position","rotation","scale"].find(i=>!(t.transforms?.editability?.(e,i).writable??!1))}_restorePreservedChildren(){const t=new Qt;for(const e of this._preservedChildObjects){const i=e.obj.parent;i&&(i.updateWorldMatrix(!0,!1),t.copy(i.matrixWorld).invert().multiply(e.worldMatrix),t.decompose(e.obj.position,e.obj.quaternion,e.obj.scale),e.obj.updateMatrix(),e.obj.updateWorldMatrix(!1,!0))}}_belongsToRoots(t,e){let i=t;for(;i;){if(e.has(i))return!0;i=i.parent}return!1}_floorSnapPosition(t,e){t.updateWorldMatrix(!0,!0);const i=Bt(t);if(i.isEmpty())return null;const s=Math.min((i.max.x-i.min.x)*.1,.05),o=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+o],[i.max.x-s,i.min.z+o],[i.min.x+s,i.max.z-o],[i.max.x-s,i.max.z-o]],r=new st;r.layers.enableAll();const l=i.min.y+Math.max((i.max.y-i.min.y)*.001,.001);let c=Number.NEGATIVE_INFINITY;for(const[f,u]of n){r.set(new p(f,l,u),new p(0,-1,0));const m=r.intersectObjects(this._scene.children,!0).find(_=>!this._belongsToRoots(_.object,e)&&!$(_.object)&&_.point.y<=l);m&&(c=Math.max(c,m.point.y))}if(!Number.isFinite(c))return null;const h=c-i.min.y;if(Math.abs(h)<1e-6)return null;const d=t.getWorldPosition(new p);return d.y+=h,t.parent?(t.parent.updateWorldMatrix(!0,!1),t.parent.worldToLocal(d)):d}snapSelectionToFloor(){const t=this._authoring(),e=t.transforms;if(!e){B("This document does not expose writable transforms.");return}const i=[...this._store.selectedEntityIds].map(l=>({id:l,obj:this._objectForAuthoringId(l)})).filter(l=>!!l.obj&&(e.editability?.(l.id,"position").writable??!0)),s=new Set(i.map(({obj:l})=>l)),o=i.filter(({obj:l})=>{let c=l.parent;for(;c;){if(s.has(c))return!1;c=c.parent}return!0});if(o.length===0){B("Select an object with a writable position first.");return}const n=new Set(o.map(({obj:l})=>l)),r=[];for(const l of o){const c=this._floorSnapPosition(l.obj,n);c&&r.push({...l,position:c})}if(r.length===0){B("No solid scene surface was found beneath the selection.");return}for(const{id:l}of r)Ie(t,l);for(const{obj:l,position:c}of r)l.position.copy(c);this._skipNextSync=!0;for(const{id:l,obj:c}of r)Le(t,l,{position:c.position.toArray(),rotation:c.quaternion.toArray(),scale:c.scale.toArray()});for(const{id:l}of r)Oe(t,l);this.syncFromStore()}_applySurfaceSnap(t,e){const i=new Set,s=this._attachedAuthoringId??this._authoringIdForObject(t);s&&i.add(s);for(const{id:c}of e)i.add(c);const o=[];for(const[c,h]of this._objectMap)i.has(c)||o.push(h);if(o.push(this.grid),o.length===0){this._surfaceSnapIndicator.visible=!1;return}const n=t.position.clone();n.y+=50,this._surfaceSnapRaycaster.set(n,new p(0,-1,0)),this._surfaceSnapRaycaster.far=200;const l=this._surfaceSnapRaycaster.intersectObjects(o,!0).find(c=>c.object===this.grid||!$(c.object));if(l){const c=l.point,h=c.y,d=h-t.position.y;t.position.y=h;for(const{obj:u}of e)u.position.y+=d;this._surfaceSnapIndicator.position.copy(c),this._surfaceSnapIndicator.position.y+=.01;const f=l.face?.normal;if(f){const u=f.clone().transformDirection(l.object.matrixWorld);this._surfaceSnapIndicator.quaternion.setFromUnitVectors(new p(0,1,0),u)}this._surfaceSnapIndicator.visible=!0}else this._surfaceSnapIndicator.visible=!1}_collectVertices(t){const e=[];for(const[s,o]of this._objectMap)t.has(s)||o.traverse(n=>{if($(n))return;const r=n;if(!r.isMesh||!r.geometry)return;const l=r.geometry.getAttribute("position");if(!l)return;const c=Math.min(l.count,1e3),h=r.matrixWorld;for(let d=0;d<c;d++){const f=new p(l.getX(d),l.getY(d),l.getZ(d));f.applyMatrix4(h),e.push(f)}});return e}_applyVertexSnap(t,e){const i=t.position,s=i.clone().project(this.renderCamera),o=this._canvas.getBoundingClientRect(),n=(s.x+1)/2*o.width,r=(-s.y+1)/2*o.height;let l=this._vertexSnapThreshold,c=null;for(const h of this._vertexSnapTargets){const d=h.clone().project(this.renderCamera);if(d.z>1)continue;const f=(d.x+1)/2*o.width,u=(-d.y+1)/2*o.height,m=n-f,_=r-u,g=Math.sqrt(m*m+_*_);g<l&&(l=g,c=h)}if(c){const h=c.clone().sub(i);t.position.copy(c);for(const{obj:f}of e)f.position.add(h);this._vertexSnapIndicator.position.copy(c),this._vertexSnapIndicator.visible=!0;const d=c.distanceTo(this.renderCamera.position);this._vertexSnapIndicator.scale.setScalar(d*.008)}else this._vertexSnapIndicator.visible=!1}_flushGizmoToStore(){this._flushGizmoToStoreLive();const t=this._activeTransformEditIds;this._activeTransformEditIds=[],this._otherDragObjects=[],this._allDragObjects=[],this._preservedChildObjects=[];const e=this._authoring();for(const i of t)Oe(e,i)}consumeSkipSync(){return this._skipNextSync?(this._skipNextSync=!1,!0):!1}_applyGizmoSize(){if(this.transformControls===void 0)return;const t=this._lookGizmoSizePx,e=Math.max(1,this._canvas.clientHeight),i=t===null?null:2*t,s=i===null?1:this.freeCamera instanceof $t?4*i/e:i/(.2375*e);for(const o of this._allGizmos())o.size=s}_dropNegativeAxisHandles(t,e){const i=t.children.find(o=>o.isTransformControlsGizmo);if(!i)return;const s={X:new p(1,0,0),Y:new p(0,1,0),Z:new p(0,0,1)};for(const o of e)for(const n of[i.gizmo[o],i.picker[o]])if(n)for(const r of[...n.children]){const l=s[r.name];if(l===void 0)continue;const c=r;if(!c.geometry)continue;c.geometry.computeBoundingBox();const h=c.geometry.boundingBox;h&&h.getCenter(new p).dot(l)<0&&n.remove(r)}}_axisColorMap(){const t=o=>this._gizmoAxisColor(this._stageAxisFrame[o][0]),e=t(0),i=t(1),s=t(2);return{X:e,Y:i,Z:s,XY:s,YZ:e,XZ:i}}_readLookStage(t){this._applyGizmoAxisFrame(),this._buildOrientationGizmo()}setStageFunction(t,e){this._stageBoxSelect=e.boxSelect;const i=e.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(),tt());const s=t.upAxis==="z"?t.handedness==="left"?Bo:Go:pi;s!==this._stageAxisFrame&&(this._stageAxisFrame=s,this._applyGizmoAxisFrame(),this._buildOrientationGizmo(),this._rebuildAxisLines())}_applyGizmoAxisFrame(){if(this.transformControls===void 0)return;const t=this._stageAxisFrame.map(([,r])=>r),e=[0,1,2].map(r=>t[r]===this._appliedAxisSigns[r]?1:-1),i=e.some(r=>r===-1),s=this._axisColorMap(),o={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=(r,l,c,h,d)=>{r&&r.traverse(f=>{const u=f;c&&u.geometry&&u.geometry.scale(e[0],e[1],e[2]),h&&u.material&&!Array.isArray(u.material)&&!u.userData.vgaiOwnMaterial&&(u.material=u.material.clone(),u.userData.vgaiOwnMaterial=!0);const m=u.material;if(!m||Array.isArray(m))return;c&&(m.side=Yt);const _=l[f.name];if(_&&m.color){if(d){const g=m.userData.vgaiBaseOpacity??=m.opacity;m.opacity=g*(this._gizmoLook.opacity??1),m._opacity=void 0}m.color.copy(_),m._color=void 0}})};for(const r of this._allGizmos()){const l=r.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,o,!1,!0,h)}}i&&(this._appliedAxisSigns=t)}_gizmoAxisColor(t){const e=this._gizmoLook.axes;return e===null?new M().setRGB(...Fo[t],Ae):new M(e[t])}_installGizmoHighlight(t){const e=t.getHelper().children.find(s=>s.isTransformControlsGizmo);if(!e)return;const i=e.updateMatrixWorld.bind(e);e.updateMatrixWorld=s=>{i(s);const o=this._store.transformMode==="combined",n=e.mode==="translate"&&!this._transformHandles.freeMove?"XYZ":o&&e.mode==="rotate"&&!this._transformHandles.viewRotate?"E":null;if(n!==null)for(const h of[e.gizmo,e.picker])for(const d of h[e.mode]?.children??[])d.name===n&&(d.visible=!1);const r=this._gizmoLook,l=e.axis;if(!e.enabled||!l||r.hover===null&&r.axes===null&&r.highlightSaturation===null&&r.highlightValue===null)return;const c=e.dragging?r.drag??r.hover:r.hover;for(const h of e.gizmo[e.mode]?.children??[]){if(h.name!==l&&!l.split("").some(g=>h.name===g))continue;const d=h.material;if(!d||Array.isArray(d)||!d.color)continue;if(c!==null){d.color.setHex(c);continue}const f=(d._color??d.color).clone().convertLinearToSRGB(),u=Vo(f),m=u.s*(r.highlightSaturation??1),_=r.highlightValue??u.v;Xo(u.h,m,_,d.color).convertSRGBToLinear()}}}_applyGizmoArrows(){if(this.transformControls===void 0)return;this._applyGizmoRings();const t={length:this._gizmoLook.arrowLength??1.2,head:this._gizmoLook.arrowHead??1},e=this._appliedArrow;if(t.length===e.length&&t.head===e.head)return;const i=.5,s=.1,o=f=>i*f.length-s*f.head;if(o(t)<=.05)return;const n=o(t)/o(e),r=t.head/e.head,l=t.length/e.length,c=this.transformControls.getHelper().children.find(f=>f.isTransformControlsGizmo);if(!c)return;const h={X:0,Y:1,Z:2},d=(f,u)=>[0,1,2].map(m=>m===f?u:1);for(const f of c.gizmo.translate?.children??[]){const u=h[f.name],m=f.geometry;if(u===void 0||!m)continue;if(!(m.parameters?.radiusTop===0)){m.scale(...d(u,n));continue}m.computeBoundingBox();const b=m.boundingBox,y=[b.min.x,b.min.y,b.min.z][u],w=[b.max.x,b.max.y,b.max.z][u],z=Math.abs(y)<Math.abs(w)?y:w,T=[0,0,0];T[u]=-z,m.translate(...T),m.scale(r,r,r),T[u]=z*n,m.translate(...T)}for(const f of c.picker.translate?.children??[]){const u=h[f.name],m=f.geometry;u===void 0||!m||m.scale(...d(u,l))}this._appliedArrow=t}_applyGizmoRings(){const t=this._gizmoLook.ringWidth??1;if(t<=0||t===this._appliedRingWidth)return;const e=t/this._appliedRingWidth,i=new p,s=new p,o=new p;for(const n of[this.transformControls,this._auxRotateControls]){const r=n.getHelper().children.find(l=>l.isTransformControlsGizmo);for(const l of r?.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(o);const d=o.x<=o.y&&o.x<=o.z?0:o.y<=o.z?1:2,f=c.getAttribute("position");for(let u=0;u<f.count;u++)i.fromBufferAttribute(f,u),s.copy(i).setComponent(d,0),s.lengthSq()!==0&&(s.setLength(h),i.sub(s).multiplyScalar(e).add(s),f.setXYZ(u,i.x,i.y,i.z));f.needsUpdate=!0,c.computeBoundingSphere()}}this._appliedRingWidth=t}_patchGizmo(t){const e=this._axisColorMap(),i={XY:[-.075,-.075,0],YZ:[0,-.075,-.075],XZ:[-.075,0,-.075]};t.traverse(s=>{const o=s,n=e[s.name];if(n&&o.material){const l=o.material;l.color&&l.color.copy(n)}const r=i[s.name];r&&o.geometry&&o.geometry.translate(r[0],r[1],r[2])})}_patchCombinedScaleGizmo(t){const i=t.children.find(r=>r.isTransformControlsGizmo);if(!i)return;const s={X:new p(1,0,0),Y:new p(0,1,0),Z:new p(0,0,1)},o=.54+.55,n=.3;for(const[r,l]of[[i.gizmo.scale,!1],[i.picker.scale,!0]])if(r)for(const c of[...r.children]){const h=c,d=s[c.name],f=d!==void 0&&h.geometry?.type==="CylinderGeometry"&&h.geometry.parameters.radiusTop<.05;if(d===void 0||f){r.remove(c);continue}h.geometry.computeBoundingBox();const u=h.geometry.boundingBox;if(!u)continue;const m=Math.sign(u.getCenter(new p).dot(d))||1;if(l){const g=d.clone().multiplyScalar(m*o);h.geometry.dispose(),h.geometry=new E(n,n,n).translate(g.x,g.y,g.z);continue}const _=d.clone().multiplyScalar(m*.55);h.geometry.translate(_.x,_.y,_.z)}}_projectToScreen(t){const e=new p;t.getWorldPosition(e),e.project(this.renderCamera);const i=this._canvas.getBoundingClientRect();return new et((e.x+1)/2*i.width+i.left,(-e.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 t=this.renderCamera,e=new p(0,0,-1).applyQuaternion(t.quaternion),i=t.position.distanceTo(this.orbitControls.target);this.orbitControls.target.copy(t.position).add(e.multiplyScalar(Math.max(i,5))),this.orbitControls.dispatchEvent({type:"end"})}_updateFlyCamera(t){if(!this._flyActive||this._flyKeys.size===0)return;const e=this.renderCamera,i=this._flySpeed*(this._flyKeys.has("shift")?3:1),s=new p(0,0,-1).applyQuaternion(e.quaternion),o=new p(1,0,0).applyQuaternion(e.quaternion),n=new p;this._flyKeys.has("w")&&n.add(s),this._flyKeys.has("s")&&n.sub(s),this._flyKeys.has("d")&&n.add(o),this._flyKeys.has("a")&&n.sub(o),this._flyKeys.has("e")&&(n.y+=1),this._flyKeys.has("q")&&(n.y-=1),n.lengthSq()>0&&(n.normalize().multiplyScalar(i*t),e.position.add(n),this.orbitControls.dispatchEvent({type:"change"}))}_onFlyKeyDown=t=>{if(!this._rightMouseDown||t.target instanceof HTMLInputElement||t.target instanceof HTMLTextAreaElement||t.target instanceof HTMLSelectElement)return;const e=t.key.toLowerCase();if(e==="shift"){this._flyKeys.add("shift");return}Ii._FLY_KEYS.has(e)&&(t.preventDefault(),t.stopPropagation(),this._flyKeys.add(e),this._flyActive||this._enterFlyMode())};_onFlyKeyUp=t=>{const e=t.key.toLowerCase();if(e==="shift"){this._flyKeys.delete("shift");return}this._flyKeys.delete(e)};_onFlyPointerDown=t=>{t.button===2&&(this._rightMouseDown=!0)};_onFlyPointerUp=t=>{t.button===2&&(this._rightMouseDown=!1,this._flyActive&&this._exitFlyMode())};_onFlyPointerMove=t=>{if(!this._flyActive)return;const e=.002;this._flyEuler.y-=t.movementX*e,this._flyEuler.x-=t.movementY*e,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=t=>{if(this._flyActive||!this.orbitControls.enabled||t.ctrlKey||Math.abs(t.deltaX)<.5&&!t.shiftKey)return;t.preventDefault(),t.stopImmediatePropagation();const e=this._interactionElement.clientHeight||1,i=this.camera.position.distanceTo(this.orbitControls.target),s=2*Math.tan(this.camera.fov/2*Math.PI/180)*i/e,o=t.deltaMode===1?16:1,n=h=>Math.sign(h)*Math.min(Math.abs(h*o),30),r=new p().setFromMatrixColumn(this.camera.matrix,0),l=new p().setFromMatrixColumn(this.camera.matrix,1),c=r.multiplyScalar(n(t.deltaX)*s).add(l.multiplyScalar(-n(t.deltaY)*s));this.camera.position.add(c),this.orbitControls.target.add(c),this.orbitControls.update()};_onFlyWheel=t=>{if(!this._flyActive)return;t.preventDefault();const e=t.deltaY>0?.85:1.18;this._flySpeed=Math.max(.5,Math.min(100,this._flySpeed*e))};_onPointerDown=t=>{if(this._pointerDownPos.set(t.clientX,t.clientY),this._pointerDownButton=t.button,this._marqueeActive=!1,this._pointerSessionActive=!0,this._constraintControlPointerSession=!1,t.button===0&&!t.altKey){if(this._selectConstraintControlAt(t))return;const e=this._raycastSpatialHandle(t),i=e?ni(e):null;if(e&&i?.handle.writable){t.stopPropagation(),this._activeSpatialHandle=i,this._spatialHandleDragPoint.copy(e.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.renderCamera.getWorldDirection(new p);this._spatialHandleDragPlane.setFromNormalAndCoplanarPoint(s,e.position),this._spatialHandleDragOffset.set(0,0,0);const o=this._spatialHandleWorldPoint(t);o&&this._spatialHandleDragOffset.subVectors(e.position,o),this._canvas.style.cursor="grabbing"}}};_onPointerMove=t=>{if(this._updateEditorHandleInteraction(t)||(this._updateSpatialHandleHover(t),!this._pointerSessionActive)||!(t.buttons&1)||this._pointerDownButton!==0||this._anyGizmoDragging()||this._altDragOrbit)return;const e=t.clientX-this._pointerDownPos.x,i=t.clientY-this._pointerDownPos.y;if(!this._marqueeActive&&Math.sqrt(e*e+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",border:`1px solid ${Lt.accent.default}`,background:Lt.accent.muted,pointerEvents:"none",zIndex:ke.sticky}),(document.getElementById("editor-chrome-root")??document.body).appendChild(this._marqueeDiv))}if(this._marqueeActive&&this._marqueeDiv){const s=Math.min(this._pointerDownPos.x,t.clientX),o=Math.min(this._pointerDownPos.y,t.clientY),n=Math.abs(t.clientX-this._pointerDownPos.x),r=Math.abs(t.clientY-this._pointerDownPos.y);Object.assign(this._marqueeDiv.style,{left:`${s}px`,top:`${o}px`,width:`${n}px`,height:`${r}px`,display:"block"})}};_onPointerUp=t=>{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,t.clientX),r=Math.max(this._pointerDownPos.x,t.clientX),l=Math.min(this._pointerDownPos.y,t.clientY),c=Math.max(this._pointerDownPos.y,t.clientY),h=[],d=new p,f=new vt;for(const[u,m]of this._objectMap){if(!m.visible||m.isCamera===!0)continue;if(f.setFromObject(m),f.isEmpty()){const C=this._projectToScreen(m);C.x>=n&&C.x<=r&&C.y>=l&&C.y<=c&&h.push(u);continue}const _=this._stageBoxSelect==="touch",g=this._canvas.getBoundingClientRect();let b=!0,y=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY,z=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY;for(let C=0;C<8;C++){if(d.set(C&1?f.max.x:f.min.x,C&2?f.max.y:f.min.y,C&4?f.max.z:f.min.z),d.project(this.camera),d.z<-1||d.z>1){if(b=!1,!_)break;continue}const P=g.left+(d.x+1)*g.width/2,I=g.top+(1-d.y)*g.height/2;(P<n||P>r||I<l||I>c)&&(b=!1),y=Math.min(y,P),w=Math.max(w,P),z=Math.min(z,I),T=Math.max(T,I)}const S=y<=w&&w>=n&&y<=r&&T>=l&&z<=c;(_?S:b)&&h.push(u)}if(t.shiftKey)for(const u of h)this._store.addToSelection(u);else Tt(this._authoring(),h);return}if(t.button!==0)return;const e=t.clientX-this._pointerDownPos.x,i=t.clientY-this._pointerDownPos.y;if(Math.sqrt(e*e+i*i)>5||this._anyGizmoDragging()||this._threejsToolContextActive&&this._handleViewCubeClick(t))return;const s=t.shiftKey&&(t.metaKey||t.ctrlKey),o=Ki(this._scopeAuthoring(),()=>this._pickAt(t.clientX,t.clientY,s?"deep":"normal"));s?Tt(this._authoring(),o?[o]:[]):t.shiftKey&&o?this._store.toggleSelection(o):(t.metaKey||t.ctrlKey)&&o?this._store.toggleSelection(o):Tt(this._authoring(),o?[o]:[])};_scopeAuthoring(){return this._standaloneAuthoring?this._authoring():zt().panelAuthoring(this._store)}_pickAt(t,e,i){return this._pick?this._pick(t,e):zt().pick(this._store,t,e,i)}_onDoubleClick=t=>{if(t.button!==0||this._anyGizmoDragging()||this._marqueeActive||this._threejsToolContextActive&&this._isOverViewCube(t.clientX,t.clientY))return;const e=this._pickAt(t.clientX,t.clientY,"normal");e&&$i(this._scopeAuthoring(),e,()=>this._pickAt(t.clientX,t.clientY,"normal"))};_raycastGroundPlane(t){const e=this._canvas.getBoundingClientRect(),i=new et((t.clientX-e.left)/e.width*2-1,-((t.clientY-e.top)/e.height)*2+1);this.raycaster.setFromCamera(i,this.renderCamera);const s=je("three");this._groundPlane.set(s.up==="z"?ko:Oo,-s.groundHeight);const o=new p;return this.raycaster.ray.intersectPlane(this._groundPlane,o)}_showDropOverlay(){if(this._dropOverlay)return;const t=document.createElement("div");Object.assign(t.style,{position:"fixed",inset:"0",pointerEvents:"none",border:`2px dashed ${Lt.accent.default}`,background:Lt.accent.muted,zIndex:ke.base}),(document.getElementById("editor-chrome-root")??document.body).appendChild(t),this._dropOverlay=t}_hideDropOverlay(){this._dropOverlay&&(this._dropOverlay.remove(),this._dropOverlay=null)}_onDragOver=t=>{t.dataTransfer?.types.includes("application/x-editor-asset")&&(t.preventDefault(),t.dataTransfer.dropEffect="copy",this._showDropOverlay())};_onDragLeave=t=>{this._hideDropOverlay()};_onDrop=t=>{this._hideDropOverlay();const e=t.dataTransfer?.getData("application/x-editor-asset");if(!e)return;t.preventDefault();let i;try{i=JSON.parse(e)}catch{return}const s=je("three"),o=this._raycastGroundPlane(t),n=d=>Math.round(d*100)/100,r=s.up==="z"?[n(o?.x??0),n(o?.y??0),s.groundHeight]:[n(o?.x??0),s.groundHeight,n(o?.z??0)],l=this._authoring(),c=l.assetDrop,h=i.component??{kind:"file",name:i.name};if(!c){It.warn(`Dropped “${i.name}” was not placed: this document does not accept dropped assets.`,"editor");return}if(i.online){const d=i.online,f=this._onlineAssetResolver;if(!f){It.warn(`Dropped “${i.name}” was not placed: this viewport has no online-asset resolver installed.`,"editor");return}B(`Downloading ${d.name} from the library…`),f(d).then(u=>{u?(B(`${d.name} downloaded — placing it.`),De(l,"",u,{position:r})):B(`Could not download ${d.name} — see the Console.`)}).catch(()=>{B(`Could not download ${d.name} — see the Console.`),It.error(`Could not download ${d.name}.`,"asset")});return}De(l,"",i.path,{position:r,item:h})}}const Mn=a=>!is(a);export{Cn as C,Ii as E,wn as a,ct as b,Sn as c,xn as d,yn as e,Mn as i,vn as l,He as n,ce as p,bn as r,Ys as s};
|
package/dist/assets/{viewport-surface-status-B3om4Kcf.js → viewport-surface-status-BFmnWp7z.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r}from"./jsx-runtime-DPjLkJKQ.js";import"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{
|
|
1
|
+
import{a as r}from"./jsx-runtime-DPjLkJKQ.js";import"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{ap as i}from"./index-Ckxb31Yz.js";const m="Preparing the viewport…",n="Preparing 3D component previews…";function c(e){return!Number.isFinite(e)||e<1?n:e===1?"Preparing 1 component preview…":`Preparing ${e} component previews…`}function u({testId:e,children:t}){return r.jsx("div",{"data-testid":e,style:{position:"absolute",inset:0,padding:16,fontSize:12,color:i.content.muted,pointerEvents:"none"},children:t})}export{m as O,u as V,c as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{v as F,ax as b,ay as z}from"./three.module-IFn-4i31.js";class w extends Error{constructor(o){super(o),this.name="VoxelSurfaceError"}}const E=[{normal:[1,0,0],corners:[[1,0,1],[1,0,0],[1,1,0],[1,1,1]]},{normal:[-1,0,0],corners:[[0,0,0],[0,0,1],[0,1,1],[0,1,0]]},{normal:[0,1,0],corners:[[0,1,1],[1,1,1],[1,1,0],[0,1,0]]},{normal:[0,-1,0],corners:[[0,0,0],[1,0,0],[1,0,1],[0,0,1]]},{normal:[0,0,1],corners:[[0,0,1],[1,0,1],[1,1,1],[0,1,1]]},{normal:[0,0,-1],corners:[[1,0,0],[0,0,0],[0,1,0],[1,1,0]]}];function Y(e,o){if(e.length%2!==0)throw new w(`a run list is [count, type] pairs, so its length must be even; got ${e.length}`);let n=0,t=0;for(let s=0;s<e.length;s+=2){const l=e[s];if(!Number.isInteger(l)||l<=0)throw new w(`run ${s/2} has a count of ${l}; counts are positive`);t+=l,n=Math.max(n,e[s+1])}if(t!==o)throw new w(`the runs cover ${t} cells; the volume holds ${o}`);const c=n>65535?new Uint32Array(o):new Uint16Array(o);let d=0;for(let s=0;s<e.length;s+=2){const l=e[s];c.fill(e[s+1],d,d+l),d+=l}return c}function U(e){const[o,n,t]=e.size;if(o<=0||n<=0||t<=0)throw new w(`a volume needs a positive size on every axis; got ${e.size}`);const c=o*n*t;if(e.cells.length!==c)throw new w(`a ${o}×${n}×${t} volume holds ${c} cells; got ${e.cells.length}`);return[o,n,t]}function C(e,o,n,t){if(e===void 0)return;const c=e.get(o);if(c===void 0)throw new w(`no colour for type ${o}, which cell ${n} holds — every solid type in the volume needs a row, so a forgotten one fails here rather than drawing white`);return t.setHex(c)}function M(e,o,n,t,c,d){const[s,l,f]=o;let g=0;for(const m of E){const[x,y,$]=m.normal;if(c(s+x,l+y,f+$))continue;const h=e.positions.length/3;for(const[u,B,A]of m.corners)e.positions.push(...d(s+u,l+B,f+A)),e.normals.push(x,y,$),t!==void 0&&e.colors.push(t.r,t.g,t.b);e.indices.push(h,h+1,h+2,h,h+2,h+3),e.quadsByType.set(n,(e.quadsByType.get(n)??0)+1),g+=1}return g}function Z(e,o={}){const[n,t,c]=U(e),d=o.emptyType??0,s=o.closedBoundary!==!0,l=e.cellSize??1,[f,g,m]=e.origin??[0,0,0],x=e.cells,y=(r,i,a)=>x[(i*c+a)*n+r],$=(r,i,a)=>r<0||i<0||a<0||r>=n||i>=t||a>=c?!s:y(r,i,a)!==d,h=(r,i,a)=>[f+r*l,g+i*l,m+a*l],u={positions:[],normals:[],colors:[],indices:[],quadsByType:new Map},B=new F;let A=0,S=0;for(let r=0;r<t;r+=1)for(let i=0;i<c;i+=1)for(let a=0;a<n;a+=1){const v=y(a,r,i);if(v===d)continue;A+=1;const T=C(o.colors,v,`(${a}, ${r}, ${i})`,B);S+=M(u,[a,r,i],v,T,$,h)}const p=new b;p.setAttribute("position",new z(new Float32Array(u.positions),3)),p.setAttribute("normal",new z(new Float32Array(u.normals),3)),o.colors!==void 0&&p.setAttribute("color",new z(new Float32Array(u.colors),3));const V=u.positions.length/3,q=V>65535?new Uint32Array(u.indices):new Uint16Array(u.indices);return p.setIndex(new z(q,1)),p.computeBoundingSphere(),p.computeBoundingBox(),{geometry:p,quads:S,vertices:V,triangles:S*2,solidCells:A,quadsByType:new Map([...u.quadsByType].sort(([r],[i])=>r-i))}}export{w as VoxelSurfaceError,Z as buildVoxelSurface,Y as expandVoxelRuns};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a9 as k,c5 as W,c6 as Y,a8 as z,c7 as j,aD as J,ab as K,aL as V,az as X,c8 as q,ai as Q,c9 as Z,ac as ee,a2 as te,aa as re,ca as ne,aP as ae,cb as se,cc as oe,Y as ie}from"./three.module-IFn-4i31.js";function ue(e,r){if(e||!r||typeof r!="object")return null;const o=r;return typeof o.getExtension!="function"||typeof o.drawArrays!="function"||typeof o.drawElements!="function"?null:r}function ce(e){const r=e;return!!(r.isMesh||r.isSkinnedMesh||r.isPoints||r.isLine||r.isSprite)}function le(e){const r=e,o=r.geometry,c=r.material,s=Array.isArray(c)?c[0]:c,u=e.userData?.entityId;return{object:{name:e.name||e.type,type:e.type,...u!==void 0?{entityId:String(u)}:{}},geometry:{type:o?.type??"unknown",name:o?.name??"",attributes:o?Object.keys(o.attributes):[],indexed:!!o?.index},material:{type:s?.type??"unknown",name:s?.name??""}}}function de(e){const{capture:r,scene:o,memory:c}=e,s=e.timeoutMs??5e3,u=e.setTimeoutFn??((a,f)=>setTimeout(a,f)),l=e.clearTimeoutFn??(a=>clearTimeout(a));let y=null;function F(){const a=[];return o&&o.traverse(f=>{if(!ce(f))return;const R=f.onBeforeRender;f.onBeforeRender=function(...T){r.annotateNextDraw(le(f)),R.apply(this,T)},a.push(()=>{f.onBeforeRender=R})}),a}function E(){const a=y;if(a&&!a.settled){a.settled=!0,l(a.timer);for(const f of a.restores)f();return y=null,a}return null}return{adapter:{captureFrame(){return y?Promise.reject(new Error("RenderDebugAdapter: a frame capture is already pending")):new Promise((a,f)=>{const R=F();r.arm();const b={resolve:a,reject:f,restores:R,timer:null,settled:!1};y=b,b.timer=u(()=>{E()&&f(new Error(`RenderDebugAdapter: no frame rendered within ${s}ms — the world may be paused or stopped`))},s)})},...c?{memorySnapshot:()=>c()}:{}},beforeRender(){r.beginPass()},afterRender(){const a=r.endPass();a&&y&&E()?.resolve(a)},dispose(){const a=E();a&&a.reject(new Error("RenderDebugAdapter: disposed before a frame was captured"))}}}const _e=Object.freeze(Object.defineProperty({__proto__:null,createRenderDebugAdapter:de,frameCaptureContextFor:ue},Symbol.toStringTag,{value:"Module"})),S=10,fe={[Z]:1,[Q]:1,[q]:1,[X]:2,[V]:2,[K]:4,[J]:4,[j]:1,[z]:2},me={[ie]:1,[oe]:1,[se]:2,[ae]:2,[ne]:4,[re]:4,[te]:4,[ee]:2},pe={[Y]:2,[W]:2,[k]:4};function ye(e,r){const o=pe[r];if(o!==void 0)return o;const c=fe[e],s=me[r];return c===void 0||s===void 0?null:c*s}function M(e){const r=new Set;let o=0;const c=s=>{s&&!r.has(s)&&(r.add(s),o+=s.byteLength)};for(const s of Object.values(e.attributes)){const u=s.data?.array;c(u??s.array)}return c(e.index?.array),o}function L(e){const r=e;if(r.isCompressedTexture&&Array.isArray(r.mipmaps)){let y=0;for(const F of r.mipmaps){const E=F.data;E?.byteLength&&(y+=E.byteLength)}return y}const o=e.image,c=o?.width,s=o?.height;if(!c||!s)return null;const u=ye(e.format,e.type);if(u===null)return null;const l=c*s*u;return e.generateMipmaps?Math.round(l*1.333):l}function D(e){return e.name||e.image?.src||`texture:${e.uuid}`}function Ee(e){return e.name||`${e.type}:${e.uuid}`}function Re(e){const r=e.image;return!r?.width||!r?.height?"no image dimensions available":`unsupported format/type (format 0x${e.format.toString(16)}, type 0x${e.type.toString(16)})`}function Te(e){const r=new Map,o=new Map,c=s=>{for(const u of Object.values(s))if(u&&u.isTexture){const l=u;o.set(l.uuid,l)}};e.traverse(s=>{const u=s.geometry;u?.isBufferGeometry&&r.set(u.uuid,u);const l=s.material;Array.isArray(l)?l.forEach(c):l&&c(l)});for(const s of[e])for(const u of[s.background,s.environment])if(u&&u.isTexture){const l=u;o.set(l.uuid,l)}return{geometries:r,textures:o}}function Fe(e,r){const{geometries:o,textures:c}=Te(e),s=[];let u=0;for(const p of o.values()){const a=M(p);u+=a,s.push({name:Ee(p),bytes:a})}const l=[],y=[];let F=0;for(const p of c.values()){const a=L(p);if(a===null){y.push({name:D(p),reason:Re(p)});continue}F+=a,l.push({name:D(p),bytes:a})}const E=(p,a)=>a.bytes-p.bytes;return{counts:{geometries:r.memory.geometries,textures:r.memory.textures,programs:r.programs?r.programs.length:null},estimatedTextureBytes:F,estimatedGeometryBytes:u,topTextures:l.sort(E).slice(0,S),topGeometries:s.sort(E).slice(0,S),unestimated:y}}const Pe=Object.freeze(Object.defineProperty({__proto__:null,collectRenderMemory:Fe,estimateGeometryBytes:M,estimateTextureBytes:L},Symbol.toStringTag,{value:"Module"})),be=5e3;function he(e){return new Map([[e.POINTS,"POINTS"],[e.LINES,"LINES"],[e.LINE_LOOP,"LINE_LOOP"],[e.LINE_STRIP,"LINE_STRIP"],[e.TRIANGLES,"TRIANGLES"],[e.TRIANGLE_STRIP,"TRIANGLE_STRIP"],[e.TRIANGLE_FAN,"TRIANGLE_FAN"]])}function Ae(e,r={}){const o=r.now??(()=>Date.now()),c=r.maxDrawCalls??be,s=he(e),u=new Map,l=new Map;let y=0,F=0,E=0,p=null,a=null,f=[0,0,0,0],R=!1,b=!1,T=[],w=0,B=[],A=null;const I=new Map,N=new Set;function O(t){return s.get(t)??`0x${t.toString(16)}`}function U(t){if(!t)return null;let n=u.get(t);return n===void 0&&(n=`program#${y++}`,u.set(t,n)),n}function v(){try{if(e.getFramebufferAttachmentParameter(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)===e.RENDERBUFFER){const n=e.getFramebufferAttachmentParameter(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME);if(!n)return{width:null,height:null};const i=e.getParameter(e.RENDERBUFFER_BINDING);e.bindRenderbuffer(e.RENDERBUFFER,n);const d=e.getRenderbufferParameter(e.RENDERBUFFER,e.RENDERBUFFER_WIDTH),m=e.getRenderbufferParameter(e.RENDERBUFFER,e.RENDERBUFFER_HEIGHT);return e.bindRenderbuffer(e.RENDERBUFFER,i),{width:d,height:m}}}catch{}return{width:null,height:null}}function C(){if(!a)return{kind:"canvas"};let t=l.get(a);t===void 0&&(t=`framebuffer#${F++}`,l.set(a,t));const{width:n,height:i}=v();return{kind:"framebuffer",width:n,height:i,label:t}}function x(){return e.getParameter(e.CULL_FACE)?e.getParameter(e.CULL_FACE_MODE)===e.FRONT?"front":"back":"none"}function _(t,n,i,d){if(T.length>=c){w++,A=null;return}const m=A;A=null,T.push({index:T.length,entryPoint:t,mode:O(n),count:i,instanceCount:d,programLabel:U(p),target:C(),viewport:[...f],state:{blend:!!e.getParameter(e.BLEND),depthTest:!!e.getParameter(e.DEPTH_TEST),depthWrite:!!e.getParameter(e.DEPTH_WRITEMASK),cull:x(),scissor:!!e.getParameter(e.SCISSOR_TEST)},annotation:m??null})}const P=e;function h(t,n){const i=P[t];I.set(t,i),Object.hasOwn(e,t)&&N.add(t),P[t]=n(i.bind(e))}function G(){for(const[t,n]of I)N.has(t)?P[t]=n:delete P[t];I.clear(),N.clear()}function H(){try{const t=e.getParameter(e.VIEWPORT);t&&t.length>=4&&(f=[t[0],t[1],t[2],t[3]]),a=e.getParameter(e.FRAMEBUFFER_BINDING),p=e.getParameter(e.CURRENT_PROGRAM)}catch{}h("useProgram",t=>n=>(p=n??null,t(n))),h("bindFramebuffer",t=>(n,i)=>((n===e.FRAMEBUFFER||n===e.DRAW_FRAMEBUFFER)&&(a=i??null),t(n,i))),h("viewport",t=>(n,i,d,m)=>(f=[n,i,d,m],t(n,i,d,m))),h("drawArrays",t=>(n,i,d)=>(_("drawArrays",n,d,null),t(n,i,d))),h("drawElements",t=>(n,i,d,m)=>(_("drawElements",n,i,null),t(n,i,d,m))),h("drawArraysInstanced",t=>(n,i,d,m)=>(_("drawArraysInstanced",n,d,m),t(n,i,d,m))),h("drawElementsInstanced",t=>(n,i,d,m,g)=>(_("drawElementsInstanced",n,i,g),t(n,i,d,m,g))),h("drawRangeElements",t=>(n,i,d,m,g,$)=>(_("drawRangeElements",n,m,null),t(n,i,d,m,g,$)))}return{arm(){R=!0},get armed(){return R},beginPass(){!R||b||(b=!0,T=[],w=0,B=[],A=null,H())},endPass(){if(!b)return R=!1,null;try{w>0&&B.push(`Draw list capped at ${c}; ${w} later draw(s) were not recorded.`);const t=T.reduce((n,i)=>n+(i.annotation===null?1:0),0);return{id:++E,capturedAt:o(),drawCalls:T.slice(),totals:{drawCalls:T.length,unattributed:t,truncated:w},notes:B.slice()}}finally{G(),b=!1,R=!1,A=null}},annotateNextDraw(t){A=t}}}const ge=Object.freeze(Object.defineProperty({__proto__:null,createWebGLFrameCapture:Ae},Symbol.toStringTag,{value:"Module"}));export{de as a,Fe as b,Ae as c,Pe as d,ue as f,_e as r,ge as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as t,d as i,f as r,g as m}from"./index-BLo2LE8C.js";import"./index-Ckxb31Yz.js";import"./index-nmcBqr7Y.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./jsx-runtime-DPjLkJKQ.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./three.module-IFn-4i31.js";t.add(i,r);t.add(m);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const d="/work/.vgai-session",ae=`${d}/session.py`,se=[`${d}/in`,`${d}/reply`],I="/__editor/blender-wasm";function D(e){return new URL(`${I}/${e}`,import.meta.url).href}async function M(){const e=await fetch(D("status"));return e.ok?await e.json():{available:!1,skew:null,dir:null,sizes:{},encoded:{},missing:[`${I}/status answered ${e.status}`]}}async function J(e){const t=await M();if(!t.available)throw new Error(`The headless Blender WebAssembly build is not served by this editor: ${t.missing.join("; ")}`);if(t.skew==="wali"){const{startWaliBlenderEngine:n}=await import("./blender-wali-engine-wTOcrOMC.js");return n(e,t)}const{startEmscriptenBlenderEngine:r}=await import("./blender-emscripten-engine-9ZIRYNhe.js");return r(e,t)}function U(e){return e<200?1:e<5e3?5:25}const C=e=>new Promise(t=>setTimeout(t,e)),B=new TextDecoder;function ie(e,t,r){let n=0,a=0;const o=new Set;async function s(u){for(const l of o)u.has(`${l}.done`)||(await e.unlink(`${d}/reply/${l}.json`),await e.unlink(`${d}/reply/${l}.done`),o.delete(l))}async function i(){let u;try{u=await e.readdir(`${d}/ask`)}catch{return}const l=new Set(u.filter(h=>h.endsWith(".done")));await s(l);for(const h of l){const w=h.slice(0,-5);if(Number(w)<=a)continue;a=Number(w);const m=JSON.parse(B.decode(await e.readFile(`${d}/ask/${w}.json`)));let S;try{S=await t.ask(m)}catch(v){S={error:v instanceof Error?v.message:String(v)}}await e.writeFile(`${d}/reply/${w}.json`,JSON.stringify(S??null)),await e.writeFile(`${d}/reply/${w}.done`,"1"),o.add(w)}}async function c(u){const l=String(++n);await e.writeFile(`${d}/in/${l}.json`,JSON.stringify(u)),await e.writeFile(`${d}/in/${l}.done`,"1");const h=performance.now();for(;;){if(await i(),await e.stat(`${d}/out/${l}.done`)){const m=JSON.parse(B.decode(await e.readFile(`${d}/out/${l}.json`)));if(await e.unlink(`${d}/in/${l}.json`),await e.unlink(`${d}/in/${l}.done`),m.error)throw new Error(m.error);return m.result}const w=r?.();if(w)throw new Error(`Blender is gone, so this call will never be answered: ${w}. The session keeps its directory and its cached banner, so every later call would wait on the same missing answer; start a new program with \`blender-start {fresh: true}\` (\`VGAI_BLENDER_FRESH_SESSION=1\` for the battery harness).`);await C(U(performance.now()-h))}}return{request:c}}const N=e=>typeof e=="object"&&e!==null&&typeof e.offset=="number"&&typeof e.length=="number"&&typeof e.dtype=="string"&&typeof e.count=="number"&&typeof e.stride=="number",W={f32:e=>new Float32Array(e.buffer,e.byteOffset,e.byteLength>>2),f64:e=>new Float64Array(e.buffer,e.byteOffset,e.byteLength>>3),u32:e=>new Uint32Array(e.buffer,e.byteOffset,e.byteLength>>2),i32:e=>new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),u16:e=>new Uint16Array(e.buffer,e.byteOffset,e.byteLength>>1),i16:e=>new Int16Array(e.buffer,e.byteOffset,e.byteLength>>1),u8:e=>e,i8:e=>new Int8Array(e.buffer,e.byteOffset,e.byteLength)};function z(e,t,r){const n=W[r.dtype];if(!n)throw new Error(`Blender frame column ${t}: unknown dtype ${r.dtype}`);const{offset:a,length:o}=r;if(a<0||o<0||a+o>e.byteLength)throw new Error(`Blender frame column ${t}: bytes ${a}..${a+o} lie outside the ${e.byteLength}-byte export arena`);const s=e.subarray(a,a+o).slice(),i=n(s),c=r.count*r.stride;if(i.length!==c)throw new Error(`Blender frame column ${t}: ${i.length} values, ${c} declared (${r.count} x ${r.stride})`);return i}function H(e,t){const r=(n,a)=>{if(N(n)){const o=z(e,a,n);return a==="co"?Float64Array.from(o):o}if(Array.isArray(n))return n.map(o=>r(o,a));if(typeof n=="object"&&n!==null){const o={};for(const[s,i]of Object.entries(n))o[s]=r(i,s);return o}return n};return r(t,"")}async function V(e,t){const r=async(n,a)=>{if(N(n)){const{offset:o,length:s,dtype:i}=n;if(o<0||s<0||o+s>e.byteLength)throw new Error(`Blender frame column ${a}: bytes ${o}..${o+s} lie outside the ${e.byteLength}-byte export arena`);const c=e.subarray(o,o+s).slice(),u=await crypto.subtle.digest("SHA-256",c),l=[...new Uint8Array(u)].map(h=>h.toString(16).padStart(2,"0")).join("");return{dtype:i,length:s,sha256:l}}if(Array.isArray(n))return Promise.all(n.map(o=>r(o,a)));if(typeof n=="object"&&n!==null){const o={};for(const[s,i]of Object.entries(n))o[s]=await r(i,s);return o}return n};return r(t,"")}const b=e=>self.postMessage(e),O=(e,t)=>b({op:"log",level:e,text:t});let p=null,E=null,G=0;const j=new Map;function K(e,t,r){const n=++G,a=[],o=e;for(const s of[o?.meshes??{},o?.images??{}])for(const i of Object.values(s))for(const c of Object.values(i))ArrayBuffer.isView(c)&&c.buffer instanceof ArrayBuffer&&!a.includes(c.buffer)&&a.push(c.buffer);return new Promise((s,i)=>{j.set(n,{resolve:s,reject:i}),self.postMessage({op:"present",id:n,frame:e,description:t,...r?{capture:r}:{}},a)})}let f=null,$=null,P=!1,A=Promise.resolve();function Q(e){const t=A.then(e);return A=t.catch(()=>{}),t}function _(e){P=e,b({op:"document-dirty",dirty:e})}async function F(){if(!f||$===null)return;const e=$;let t;try{t=await f.request({op:"save-document"})}catch(n){throw new Error(`The Blender document ${e} could not be saved: ${g(n)}`)}if(!t?.saved||typeof t.path!="string")throw new Error(`Blender did not save the document ${e}`);let r;try{r=await f.files.readFile(t.path)}catch(n){throw new Error(`The Blender document ${e} could not be read back out of the engine: ${g(n)}`)}y.delete(t.path);try{const n=await fetch(`/__editor/blender-document?path=${encodeURIComponent(e)}`,{method:"POST",headers:{"content-type":"application/octet-stream"},body:new Blob([r])});if(!n.ok){const a=await n.text().catch(()=>"");throw new Error(`HTTP ${n.status} ${a}`)}}catch(n){throw new Error(`The Blender document ${e} was not written to the project: ${g(n)}`)}_(!1),O("log",`@@VGAI-DOCUMENT ${JSON.stringify({path:e,bytes:r.length})}`)}async function X(e,t){const r={engine:null},n=await J({project:e,log:O,ask:async({frame:o,capture:s,saveDue:i})=>{if(!r.engine)throw new Error("The Blender session presented before it started");i&&$!==null&&_(!0);const c=await r.engine.readArena(),u=await V(c,o),l=await K(H(c,o),u,s);return{...typeof l.capture=="object"&&l.capture!==null?l.capture:{},..."held"in l?{held:l.held}:{}}}});r.engine=n,f=n,t&&await L(n.files,e);const a=await n.request({op:"start",project:e,...t?{document:t}:{}});return t&&($=t),p={start:async()=>a,execute:async o=>{const s=await n.request({op:"execute",code:o});return s.error?`Error executing code: ${s.error}`:`Code executed successfully: ${s.result}`},sceneInfo:async()=>JSON.stringify(await n.request({op:"scene-info"}),null,2),objectInfo:async o=>JSON.stringify(await n.request({op:"object-info",name:o}),null,2),screenshotView:async o=>(await n.request({op:"present",capture:{size:o}}),JSON.stringify({view:{size:o}}))},{...a,engine:"blender-wasm",skew:n.skew,bootMs:Math.round(n.bootMs),releasedPayloadMB:n.releasedPayloadBytes===null?null:Math.round(n.releasedPayloadBytes/1048576)}}async function Y(){try{const e=await fetch("/__editor/blender-wasm/status");return e.ok?await e.json():{available:!1,missing:[`status answered ${e.status}`]}}catch(e){return{available:!1,missing:[String(e)]}}}async function Z(e,t){if(p)throw new Error("The Blender session is already started");if(!e.startsWith("/"))throw new Error("The Blender session needs the project's absolute path");if(t!==void 0&&!q(t))throw new Error(`The Blender document must be a project-relative .blend path with no traversal (models/model.blend); got ${JSON.stringify(t)}`);const r=await Y();if(!r.available)throw new Error(`Headless Blender is not served by this editor, so there is no modeling engine: ${r.missing.join("; ")}. The engine is Blender compiled to WebAssembly (packages/blender-engine/wasm, or the directory VGAI_BLENDER_WASM_DIR names); nothing stands in for it.`);return E=e,X(e,t)}function q(e){return!e.endsWith(".blend")||e.startsWith("/")||e.includes("\\")?!1:e.split("/").every(r=>r!==""&&r!=="."&&r!=="..")}const T=new Set;function k(e){T.has(e)||(T.add(e),O("error",e))}async function ee(e){const t=s=>(k(`The project's files are not readable from Python: ${s}`),null);let r;try{r=await fetch("/__editor/blender-project-index")}catch(s){return t(String(s))}if(!r.ok)return t(`/__editor/blender-project-index answered ${r.status}`);let n;try{if(n=await r.json(),typeof n?.root!="string"||!Array.isArray(n.files))return t("invalid project index")}catch(s){return t(String(s))}const{root:a,files:o}=n;return a!==e&&k(`The editor serving this tab has ${a} open, not ${e}; its files are mounted at ${e}, which is where Python is looking.`),o}const y=new Map;async function te(e,t){const r=await e.stat(t);return r?`${r.size}:${r.mtimeMs}`:""}async function L(e,t){const r=await ee(t);if(!r)return;const n=new Set(r.map(a=>`${t}/${a.path}`));for(const a of[...y.keys()])if(!n.has(a)){try{await e.unlink(a)}catch{}y.delete(a)}for(const a of r){const o=`${t}/${a.path}`,s=`${a.size}:${a.mtime}`;if(y.get(o)?.host===s||!y.has(o)&&await e.stat(o)!==null)continue;const i=await fetch(`/__editor/blender-project-file?path=${encodeURIComponent(a.path)}`);if(!i.ok){k(`${a.path}: HTTP ${i.status}`);continue}const c=o.slice(0,o.lastIndexOf("/"));c&&await e.mkdirTree(c),await e.writeFile(o,new Uint8Array(await i.arrayBuffer())),y.set(o,{host:s,engine:await te(e,o)})}}async function ne(e,t){const r=[],n=async a=>{let o;try{o=await e.readdir(a)}catch{return}for(const s of o){if(s==="."||s==="..")continue;const i=`${a.replace(/\/$/,"")}/${s}`,c=await e.stat(i);if(c){if((c.mode&61440)===16384){await n(i);continue}y.get(i)?.engine!==`${c.size}:${c.mtimeMs}`&&r.push({path:i,size:c.size,mtime:c.mtimeMs})}}};return await n(t),r}async function R(e){switch(e.op){case"start":return Z(e.project,e.document);case"present-result":{const n=j.get(e.id);j.delete(e.id),n&&(e.error?n.reject(new Error(e.error)):n.resolve({...e.capture===void 0?{}:{capture:e.capture},..."held"in e?{held:e.held}:{}}));return}}if(!p||!E||!f)throw new Error("The Blender session has not started");const t=f.files,r=f.request.bind(f);switch(e.op){case"flush-document":return await F(),{saved:!0};case"history-begin":case"history-end":return r({op:e.op});case"history-step":return r({op:"history-step",token:e.token,direction:e.direction});case"execute":await L(t,E);{const n=await r({op:"execute",code:e.code,history:e.history??!0,label:e.label??"Blender Python"});return n.error?`Error executing code: ${n.error}`:`Code executed successfully: ${n.result}`}case"present":return r({op:"present"});case"scene-info":return p.sceneInfo();case"object-info":return p.objectInfo(e.name);case"rna":return r({op:"rna",path:e.path,...e.names===void 0?{}:{names:e.names}});case"rna-context":return r({op:"rna-context",...e.object===void 0?{}:{object:e.object},...e.collection===void 0?{}:{collection:e.collection}});case"rna-set":return r({op:"rna-set",history:e.history!==!1,path:e.path,property:e.property,value:e.value,...e.index===void 0?{}:{index:e.index}});case"outliner":return r({op:"outliner",...e.selected===void 0?{}:{selected:[...e.selected]}});case"node-tree":return r({op:"node-tree",...e.path===void 0?{}:{path:e.path},...e.material===void 0?{}:{material:e.material}});case"uv-layout":return r({op:"uv-layout",...e.object===void 0?{}:{object:e.object},...e.uvLayer===void 0?{}:{uvLayer:e.uvLayer}});case"rig":return r({op:"rig",...e.object===void 0?{}:{object:e.object}});case"action-clip":return r({op:"action-clip",...e.object===void 0?{}:{object:e.object},...e.bake===void 0?{}:{bake:e.bake}});case"outliner-set":return r({op:"outliner-set",path:e.path,column:e.column,value:e.value});case"screenshot-view":return JSON.parse(await p.screenshotView(e.maxSize));case"read-file":return t.readFile(e.path);case"write-file":{const n=e.path.slice(0,e.path.lastIndexOf("/"));n&&await t.mkdirTree(n),await t.writeFile(e.path,e.bytes),y.delete(e.path);return}case"list-files":return ne(t,e.path)}throw new Error(`Unknown Blender worker request ${e.op}`)}function g(e){if(e instanceof Error)return e.stack??`${e.name}: ${e.message}`;if(typeof e=="object"&&e!==null){const t=e;if(typeof t.message=="string")return typeof t.name=="string"?`${t.name}: ${t.message}`:t.message;try{return JSON.stringify(e)??Object.prototype.toString.call(e)}catch{return Object.prototype.toString.call(e)}}return String(e)}function re(){if(!f)return;const e=f.memoryBytes();e!==null&&b({op:"memory",bytes:e})}self.onmessage=e=>{const t=e.data;if(t.op==="present-result"){R(t);return}Q(()=>oe(t))};async function oe(e){try{const t=await R(e);P&&await F(),await x(),b({id:e.id,result:t})}catch(t){let r=g(t);try{await x()}catch(n){r+=`
|
|
2
|
-
Unable to deliver Blender history: ${g(n)}`}b({id:e.id,error:r})}re()}async function
|
|
1
|
+
const d="/work/.vgai-session",ae=`${d}/session.py`,se=[`${d}/in`,`${d}/reply`],N="/__editor/blender-wasm";function D(e){return new URL(`${N}/${e}`,import.meta.url).href}async function M(){const e=await fetch(D("status"));return e.ok?await e.json():{available:!1,skew:null,dir:null,sizes:{},encoded:{},missing:[`${N}/status answered ${e.status}`]}}async function J(e){const t=await M();if(!t.available)throw new Error(`The headless Blender WebAssembly build is not served by this editor: ${t.missing.join("; ")}`);if(t.skew==="wali"){const{startWaliBlenderEngine:n}=await import("./blender-wali-engine-D3iKpzn9.js");return n(e,t)}const{startEmscriptenBlenderEngine:r}=await import("./blender-emscripten-engine-CEsWgnR7.js");return r(e,t)}function U(e){return e<200?1:e<5e3?5:25}const C=e=>new Promise(t=>setTimeout(t,e)),A=new TextDecoder;function ie(e,t,r){let n=0,a=0;const o=new Set;async function s(u){for(const l of o)u.has(`${l}.done`)||(await e.unlink(`${d}/reply/${l}.json`),await e.unlink(`${d}/reply/${l}.done`),o.delete(l))}async function i(){let u;try{u=await e.readdir(`${d}/ask`)}catch{return}const l=new Set(u.filter(h=>h.endsWith(".done")));await s(l);for(const h of l){const w=h.slice(0,-5);if(Number(w)<=a)continue;a=Number(w);const m=JSON.parse(A.decode(await e.readFile(`${d}/ask/${w}.json`)));let S;try{S=await t.ask(m)}catch(v){S={error:v instanceof Error?v.message:String(v)}}await e.writeFile(`${d}/reply/${w}.json`,JSON.stringify(S??null)),await e.writeFile(`${d}/reply/${w}.done`,"1"),o.add(w)}}async function c(u){const l=String(++n);await e.writeFile(`${d}/in/${l}.json`,JSON.stringify(u)),await e.writeFile(`${d}/in/${l}.done`,"1");const h=performance.now();for(;;){if(await i(),await e.stat(`${d}/out/${l}.done`)){const m=JSON.parse(A.decode(await e.readFile(`${d}/out/${l}.json`)));if(await e.unlink(`${d}/in/${l}.json`),await e.unlink(`${d}/in/${l}.done`),m.error)throw new Error(m.error);return m.result}const w=r?.();if(w)throw new Error(`Blender is gone, so this call will never be answered: ${w}. The session keeps its directory and its cached banner, so every later call would wait on the same missing answer; start a new program with \`blender-start {fresh: true}\` (\`VGAI_BLENDER_FRESH_SESSION=1\` for the battery harness).`);await C(U(performance.now()-h))}}return{request:c}}const P=e=>typeof e=="object"&&e!==null&&typeof e.offset=="number"&&typeof e.length=="number"&&typeof e.dtype=="string"&&typeof e.count=="number"&&typeof e.stride=="number",W={f32:e=>new Float32Array(e.buffer,e.byteOffset,e.byteLength>>2),f64:e=>new Float64Array(e.buffer,e.byteOffset,e.byteLength>>3),u32:e=>new Uint32Array(e.buffer,e.byteOffset,e.byteLength>>2),i32:e=>new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),u16:e=>new Uint16Array(e.buffer,e.byteOffset,e.byteLength>>1),i16:e=>new Int16Array(e.buffer,e.byteOffset,e.byteLength>>1),u8:e=>e,i8:e=>new Int8Array(e.buffer,e.byteOffset,e.byteLength)};function z(e,t,r){const n=W[r.dtype];if(!n)throw new Error(`Blender frame column ${t}: unknown dtype ${r.dtype}`);const{offset:a,length:o}=r;if(a<0||o<0||a+o>e.byteLength)throw new Error(`Blender frame column ${t}: bytes ${a}..${a+o} lie outside the ${e.byteLength}-byte export arena`);const s=e.subarray(a,a+o).slice(),i=n(s),c=r.count*r.stride;if(i.length!==c)throw new Error(`Blender frame column ${t}: ${i.length} values, ${c} declared (${r.count} x ${r.stride})`);return i}function H(e,t){const r=(n,a)=>{if(P(n)){const o=z(e,a,n);return a==="co"?Float64Array.from(o):o}if(Array.isArray(n))return n.map(o=>r(o,a));if(typeof n=="object"&&n!==null){const o={};for(const[s,i]of Object.entries(n))o[s]=r(i,s);return o}return n};return r(t,"")}async function V(e,t){const r=async(n,a)=>{if(P(n)){const{offset:o,length:s,dtype:i}=n;if(o<0||s<0||o+s>e.byteLength)throw new Error(`Blender frame column ${a}: bytes ${o}..${o+s} lie outside the ${e.byteLength}-byte export arena`);const c=e.subarray(o,o+s).slice(),u=await crypto.subtle.digest("SHA-256",c),l=[...new Uint8Array(u)].map(h=>h.toString(16).padStart(2,"0")).join("");return{dtype:i,length:s,sha256:l}}if(Array.isArray(n))return Promise.all(n.map(o=>r(o,a)));if(typeof n=="object"&&n!==null){const o={};for(const[s,i]of Object.entries(n))o[s]=await r(i,s);return o}return n};return r(t,"")}const b=e=>self.postMessage(e),O=(e,t)=>b({op:"log",level:e,text:t});let p=null,E=null,G=0;const j=new Map;function K(e,t,r){const n=++G,a=[],o=e;for(const s of[o?.meshes??{},o?.images??{}])for(const i of Object.values(s))for(const c of Object.values(i))ArrayBuffer.isView(c)&&c.buffer instanceof ArrayBuffer&&!a.includes(c.buffer)&&a.push(c.buffer);return new Promise((s,i)=>{j.set(n,{resolve:s,reject:i}),self.postMessage({op:"present",id:n,frame:e,description:t,...r?{capture:r}:{}},a)})}let f=null,$=null,B=!1,T=Promise.resolve();function Q(e){const t=T.then(e);return T=t.catch(()=>{}),t}function _(e){B=e,b({op:"document-dirty",dirty:e})}async function F(){if(!f||$===null)return;const e=$;let t;try{t=await f.request({op:"save-document"})}catch(n){throw new Error(`The Blender document ${e} could not be saved: ${g(n)}`)}if(!t?.saved||typeof t.path!="string")throw new Error(`Blender did not save the document ${e}`);let r;try{r=await f.files.readFile(t.path)}catch(n){throw new Error(`The Blender document ${e} could not be read back out of the engine: ${g(n)}`)}y.delete(t.path);try{const n=await fetch(`/__editor/blender-document?path=${encodeURIComponent(e)}`,{method:"POST",headers:{"content-type":"application/octet-stream"},body:new Blob([r])});if(!n.ok){const a=await n.text().catch(()=>"");throw new Error(`HTTP ${n.status} ${a}`)}}catch(n){throw new Error(`The Blender document ${e} was not written to the project: ${g(n)}`)}_(!1),O("log",`@@VGAI-DOCUMENT ${JSON.stringify({path:e,bytes:r.length})}`)}async function X(e,t){const r={engine:null},n=await J({project:e,log:O,ask:async({frame:o,capture:s,saveDue:i})=>{if(!r.engine)throw new Error("The Blender session presented before it started");i&&$!==null&&_(!0);const c=await r.engine.readArena(),u=await V(c,o),l=await K(H(c,o),u,s);return{...typeof l.capture=="object"&&l.capture!==null?l.capture:{},..."held"in l?{held:l.held}:{}}}});r.engine=n,f=n,t&&await L(n.files,e);const a=await n.request({op:"start",project:e,...t?{document:t}:{}});return t&&($=t),p={start:async()=>a,execute:async o=>{const s=await n.request({op:"execute",code:o});return s.error?`Error executing code: ${s.error}`:`Code executed successfully: ${s.result}`},sceneInfo:async()=>JSON.stringify(await n.request({op:"scene-info"}),null,2),objectInfo:async o=>JSON.stringify(await n.request({op:"object-info",name:o}),null,2),screenshotView:async o=>(await n.request({op:"present",capture:{size:o}}),JSON.stringify({view:{size:o}}))},{...a,engine:"blender-wasm",skew:n.skew,bootMs:Math.round(n.bootMs),releasedPayloadMB:n.releasedPayloadBytes===null?null:Math.round(n.releasedPayloadBytes/1048576)}}async function Y(){try{const e=await fetch("/__editor/blender-wasm/status");return e.ok?await e.json():{available:!1,missing:[`status answered ${e.status}`]}}catch(e){return{available:!1,missing:[String(e)]}}}async function Z(e,t){if(p)throw new Error("The Blender session is already started");if(!e.startsWith("/"))throw new Error("The Blender session needs the project's absolute path");if(t!==void 0&&!q(t))throw new Error(`The Blender document must be a project-relative .blend path with no traversal (models/model.blend); got ${JSON.stringify(t)}`);const r=await Y();if(!r.available)throw new Error(`Headless Blender is not served by this editor, so there is no modeling engine: ${r.missing.join("; ")}. The engine is Blender compiled to WebAssembly (packages/blender-engine/wasm, or the directory VGAI_BLENDER_WASM_DIR names); nothing stands in for it.`);return E=e,X(e,t)}function q(e){return!e.endsWith(".blend")||e.startsWith("/")||e.includes("\\")?!1:e.split("/").every(r=>r!==""&&r!=="."&&r!=="..")}const x=new Set;function k(e){x.has(e)||(x.add(e),O("error",e))}async function ee(e){const t=s=>(k(`The project's files are not readable from Python: ${s}`),null);let r;try{r=await fetch("/__editor/blender-project-index")}catch(s){return t(String(s))}if(!r.ok)return t(`/__editor/blender-project-index answered ${r.status}`);let n;try{if(n=await r.json(),typeof n?.root!="string"||!Array.isArray(n.files))return t("invalid project index")}catch(s){return t(String(s))}const{root:a,files:o}=n;return a!==e&&k(`The editor serving this tab has ${a} open, not ${e}; its files are mounted at ${e}, which is where Python is looking.`),o}const y=new Map;async function te(e,t){const r=await e.stat(t);return r?`${r.size}:${r.mtimeMs}`:""}async function L(e,t){const r=await ee(t);if(!r)return;const n=new Set(r.map(a=>`${t}/${a.path}`));for(const a of[...y.keys()])if(!n.has(a)){try{await e.unlink(a)}catch{}y.delete(a)}for(const a of r){const o=`${t}/${a.path}`,s=`${a.size}:${a.mtime}`;if(y.get(o)?.host===s||!y.has(o)&&await e.stat(o)!==null)continue;const i=await fetch(`/__editor/blender-project-file?path=${encodeURIComponent(a.path)}`);if(!i.ok){k(`${a.path}: HTTP ${i.status}`);continue}const c=o.slice(0,o.lastIndexOf("/"));c&&await e.mkdirTree(c),await e.writeFile(o,new Uint8Array(await i.arrayBuffer())),y.set(o,{host:s,engine:await te(e,o)})}}async function ne(e,t){const r=[],n=async a=>{let o;try{o=await e.readdir(a)}catch{return}for(const s of o){if(s==="."||s==="..")continue;const i=`${a.replace(/\/$/,"")}/${s}`,c=await e.stat(i);if(c){if((c.mode&61440)===16384){await n(i);continue}y.get(i)?.engine!==`${c.size}:${c.mtimeMs}`&&r.push({path:i,size:c.size,mtime:c.mtimeMs})}}};return await n(t),r}async function R(e){switch(e.op){case"start":return Z(e.project,e.document);case"present-result":{const n=j.get(e.id);j.delete(e.id),n&&(e.error?n.reject(new Error(e.error)):n.resolve({...e.capture===void 0?{}:{capture:e.capture},..."held"in e?{held:e.held}:{}}));return}}if(!p||!E||!f)throw new Error("The Blender session has not started");const t=f.files,r=f.request.bind(f);switch(e.op){case"flush-document":return B?(await F(),{saved:!0}):{saved:!1};case"history-begin":case"history-end":return r({op:e.op});case"history-step":return r({op:"history-step",token:e.token,direction:e.direction});case"execute":await L(t,E);{const n=await r({op:"execute",code:e.code,history:e.history??!0,label:e.label??"Blender Python"});return n.error?`Error executing code: ${n.error}`:`Code executed successfully: ${n.result}`}case"present":return r({op:"present"});case"scene-info":return p.sceneInfo();case"object-info":return p.objectInfo(e.name);case"rna":return r({op:"rna",path:e.path,...e.names===void 0?{}:{names:e.names}});case"rna-context":return r({op:"rna-context",...e.object===void 0?{}:{object:e.object},...e.collection===void 0?{}:{collection:e.collection}});case"rna-set":return r({op:"rna-set",history:e.history!==!1,path:e.path,property:e.property,value:e.value,...e.index===void 0?{}:{index:e.index}});case"outliner":return r({op:"outliner",...e.selected===void 0?{}:{selected:[...e.selected]}});case"node-tree":return r({op:"node-tree",...e.path===void 0?{}:{path:e.path},...e.material===void 0?{}:{material:e.material}});case"uv-layout":return r({op:"uv-layout",...e.object===void 0?{}:{object:e.object},...e.uvLayer===void 0?{}:{uvLayer:e.uvLayer}});case"rig":return r({op:"rig",...e.object===void 0?{}:{object:e.object}});case"action-clip":return r({op:"action-clip",...e.object===void 0?{}:{object:e.object},...e.bake===void 0?{}:{bake:e.bake}});case"outliner-set":return r({op:"outliner-set",path:e.path,column:e.column,value:e.value});case"screenshot-view":return JSON.parse(await p.screenshotView(e.maxSize));case"read-file":return t.readFile(e.path);case"write-file":{const n=e.path.slice(0,e.path.lastIndexOf("/"));n&&await t.mkdirTree(n),await t.writeFile(e.path,e.bytes),y.delete(e.path);return}case"list-files":return ne(t,e.path)}throw new Error(`Unknown Blender worker request ${e.op}`)}function g(e){if(e instanceof Error)return e.stack??`${e.name}: ${e.message}`;if(typeof e=="object"&&e!==null){const t=e;if(typeof t.message=="string")return typeof t.name=="string"?`${t.name}: ${t.message}`:t.message;try{return JSON.stringify(e)??Object.prototype.toString.call(e)}catch{return Object.prototype.toString.call(e)}}return String(e)}function re(){if(!f)return;const e=f.memoryBytes();e!==null&&b({op:"memory",bytes:e})}self.onmessage=e=>{const t=e.data;if(t.op==="present-result"){R(t);return}Q(()=>oe(t))};async function oe(e){try{const t=await R(e);B&&await F(),await I(),b({id:e.id,result:t})}catch(t){let r=g(t);try{await I()}catch(n){r+=`
|
|
2
|
+
Unable to deliver Blender history: ${g(n)}`}b({id:e.id,error:r})}re()}async function I(){if(!f||!p)return;const e=await f.request({op:"history-events"});e.length&&b({op:"history",entries:e})}export{N as A,se as P,d as S,ae as a,D as b,ie as o,C as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as s}from"./jsx-runtime-DPjLkJKQ.js";import{e7 as P,ec as N,f7 as B,br as tt,h6 as I,eb as et,dG as ot,a5 as W,bV as D,a6 as M,ga as nt,gb as st,bW as at,c2 as rt,h7 as it,fF as lt,dA as j,h8 as $,h9 as ct,dz as z,ha as dt,dB as F,eS as O,e3 as ut,aQ as pt,hb as ht,aO as mt,hc as ft,hd as bt,he as xt,hf as gt,hg as vt,hh as wt,g6 as yt,hi as St,aH as kt,hj as U,hk as Rt,gh as Ct}from"./index-Ckxb31Yz.js";import{r as p}from"./index-nmcBqr7Y.js";import{d as Et,m as It}from"./design-time-layers-g9VS6amb.js";import{I as jt}from"./edit-mode-authoring-D_BiHCQj.js";import{i as zt,a as At,C as L,b as Dt,c as Mt}from"./CanvasSceneViewport-BlsRTk-X.js";import{a as Bt,g as Tt,d as $t,e as Ft,f as Vt,s as H,h as _t,t as Pt,R as _,i as Nt}from"./react-story-board-CSqHY0Cg.js";import{s as Gt,c as Wt,a as Ot,b as Ut}from"./component-board-registry-DrIa2csL.js";import{e as Lt,S as Ht}from"./surface-state-BAUJu6GY.js";import"./index-CtzuWnCS.js";import{c as Zt,d as Xt,r as Z,e as X,f as Yt,m as Y,b as Kt,a as qt,s as Qt}from"./board-guides-C3usUZZk.js";import{R as Jt}from"./RootSelectionOverlay-BxvsunO4.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./three.module-IFn-4i31.js";import"./design-time-mount-registry-DUpXCg1U.js";import"./Toolbar-keHcSvDD.js";import"./transform-mode-request-Cu7ewbtr.js";import"./TransientHint-Dlslh3oX.js";import"./eyedropper-session-bjPXnfeX.js";import"./viewport-pick-context-DkawXbEi.js";import"./inspect-BRgDdtVk.js";import"./inference-diagnostics-YW0yJkKx.js";const y=16,V="rgba(255, 82, 82, 0.9)",K="rgba(18, 22, 26, 0.92)",A="rgba(255, 255, 255, 0.28)";function te(n){return[10,25,50,100,250,500,1e3,2500,5e3].find(i=>i*n>=60)??1e4}function q(n){return Math.abs(n)>=1e3?`${n/1e3}k`:String(n)}function ee({docId:n,containerRef:c}){const i=p.useSyncExternalStore(P,N),h=p.useSyncExternalStore(Zt,()=>Xt(n)),[o,d]=p.useState(null),b=p.useRef(null);p.useEffect(()=>{const e=c.current;if(!e)return;const a=e.getBoundingClientRect();return Z(n,{originX:a.left,originY:a.top,panX:i.x,panY:i.y,zoom:i.zoom}),()=>Z(n,null)},[n,c,i.x,i.y,i.zoom]);const f=(e,a)=>Math.round((e-(a==="x"?i.x:i.y))/i.zoom),m=(e,a)=>(a==="x"?i.x:i.y)+e*i.zoom,x=e=>{const a=c.current?.getBoundingClientRect();return a?{x:e.clientX-a.left,y:e.clientY-a.top}:{x:0,y:0}},k=e=>a=>{a.preventDefault(),a.currentTarget.setPointerCapture(a.pointerId);const t=x(a);d({kind:"place",axis:e,id:null,at:e==="x"?t.x:t.y})},w=e=>a=>{a.preventDefault(),a.stopPropagation(),a.currentTarget.setPointerCapture(a.pointerId);const t=x(a);d({kind:"move",axis:e.axis,id:e.id,at:e.axis==="x"?t.x:t.y})},R=e=>{if(!o)return;const a=x(e),t=o.axis==="x"?a.x:a.y;d({...o,at:t}),o.kind==="move"&&o.id&&Y(n,o.id,f(t,o.axis))},C=e=>{if(!o)return;const a=x(e),t=o.axis==="x"?a.x:a.y,l=t<=y;o.kind==="place"?l||Yt(n,o.axis,f(t,o.axis)):o.id&&(l?X(n,o.id):Y(n,o.id,f(t,o.axis))),d(null)},r=e=>{const a=c.current,t=a?e==="x"?a.clientWidth:a.clientHeight:0,l=te(i.zoom),g=Math.ceil(f(y,e)/l)*l,S=f(t,e),v=[];for(let E=g;E<=S&&v.length<200;E+=l)v.push(E);return v},u={position:"absolute",background:K,zIndex:61,userSelect:"none",touchAction:"none",overflow:"hidden"};return s.jsxs("div",{ref:b,"data-testid":"board-rulers",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:60},onPointerMove:R,onPointerUp:C,children:[h.map(e=>{const a=m(e.value,e.axis),t=e.axis==="x";return s.jsx("div",{"data-testid":`board-guide-${e.axis}-${e.value}`,title:`${e.axis} = ${e.value} — drag to move, drop on the ruler or double-click to remove`,onPointerDown:w(e),onPointerMove:R,onPointerUp:C,onDoubleClick:()=>X(n,e.id),style:{position:"absolute",pointerEvents:"auto",cursor:t?"col-resize":"row-resize",zIndex:60,...t?{left:a-2,top:0,bottom:0,width:5}:{top:a-2,left:0,right:0,height:5}},children:s.jsx("div",{style:{position:"absolute",background:V,...t?{left:2,top:0,bottom:0,width:1}:{top:2,left:0,right:0,height:1}}})},e.id)}),o&&s.jsx("div",{style:{position:"absolute",background:V,zIndex:62,...o.axis==="x"?{left:o.at,top:0,bottom:0,width:1}:{top:o.at,left:0,right:0,height:1}},children:s.jsx("span",{style:{position:"absolute",...o.axis==="x"?{top:y+4,left:4}:{left:y+4,top:4},fontSize:9,fontFamily:"ui-monospace, monospace",color:V,background:K,padding:"1px 3px",borderRadius:3,whiteSpace:"nowrap"},children:f(o.at,o.axis)})}),s.jsx("div",{"data-testid":"board-ruler-top",onPointerDown:k("y"),style:{...u,top:0,left:y,right:0,height:y,cursor:"row-resize",pointerEvents:"auto"},children:r("x").map(e=>s.jsx("span",{style:{position:"absolute",left:m(e,"x"),bottom:0,borderLeft:`1px solid ${A}`,height:5},children:s.jsx("span",{style:{position:"absolute",left:2,bottom:3,fontSize:8,color:A,fontFamily:"ui-monospace, monospace"},children:q(e)})},e))}),s.jsx("div",{"data-testid":"board-ruler-left",onPointerDown:k("x"),style:{...u,top:y,left:0,bottom:0,width:y,cursor:"col-resize",pointerEvents:"auto"},children:r("y").map(e=>s.jsx("span",{style:{position:"absolute",top:m(e,"y"),right:0,borderTop:`1px solid ${A}`,width:5},children:s.jsx("span",{style:{position:"absolute",top:1,right:3,fontSize:8,color:A,fontFamily:"ui-monospace, monospace",writingMode:"vertical-rl"},children:q(e)})},e))}),s.jsx(oe,{}),s.jsx("div",{style:{...u,top:0,left:0,width:y,height:y,borderRight:`1px solid ${B.border}`,borderBottom:`1px solid ${B.border}`}})]})}function oe(){const n=p.useSyncExternalStore(Kt,qt);return n?s.jsxs("button",{type:"button","data-testid":"board-breakpoint-pill",title:"Style edits are scoped to this breakpoint — click to return to Base",onClick:()=>Qt(null),style:{position:"absolute",top:y+8,right:12,zIndex:62,pointerEvents:"auto",background:"rgba(18, 22, 26, 0.92)",color:B.accent,border:`1px solid ${B.accent}`,borderRadius:999,fontSize:10,padding:"3px 10px",cursor:"pointer"},children:["@ ",n," · editing this breakpoint — click to clear"]}):null}const Q={fill:null,desktop:{width:1440,height:900},tablet:{width:768,height:1024},mobile:{width:390,height:844}};function ne({boardViewport:n,containerRef:c,selectViewport:i,viewportValue:h}){return s.jsxs(s.Fragment,{children:[s.jsxs(rt,{"aria-label":"Responsive viewport",title:n?.locked?"Viewport is locked by this story’s globals.viewport":"Responsive viewport",value:h,disabled:n?.locked===!0,onChange:o=>i(o.target.value),className:"vgai-react-viewport-select",children:[s.jsx("option",{value:"fill",children:"Responsive"}),n?n.choices.map(o=>s.jsxs("option",{value:o.id,children:[o.label," · ",o.width,"×",o.height]},o.id)):s.jsxs(s.Fragment,{children:[s.jsx("option",{value:"desktop",children:"Desktop · 1440×900"}),s.jsx("option",{value:"tablet",children:"Tablet · 768×1024"}),s.jsx("option",{value:"mobile",children:"Mobile · 390×844"})]})]}),n&&s.jsx(D,{"aria-label":"Rotate viewport",title:n.locked?"Viewport is locked by this story’s globals.viewport":"Rotate viewport",size:"comfortable",disabled:n.locked,onClick:()=>Pt(c.current),children:s.jsx(M,{icon:it,size:"md"})})]})}function se({containerRef:n,context:c,boardOnly:i=!1}){const h=tt();p.useSyncExternalStore(h.subscribe,h.getSnapshot);const o=p.useSyncExternalStore(P,N),d=p.useSyncExternalStore(Bt,Tt),b=p.useSyncExternalStore($t,()=>Ft(n.current),()=>null),f=p.useCallback(r=>{const u=n.current;if(!u)return;const e=Math.min(4,Math.max(.1,r)),a=u.clientWidth/2,t=u.clientHeight/2,l=(a-o.x)/o.zoom,g=(t-o.y)/o.zoom;I(a-l*e,t-g*e,e)},[n,o]),m=p.useCallback(()=>{const r=n.current,u=[...h.selectedEntityIds].at(-1);if(!r||!u)return;const e=c?.adapter.rects?.rect(u);if(!e||e.width<=0||e.height<=0)return;const a=Math.max(1,r.clientWidth-96),t=Math.max(1,r.clientHeight-96),l=Math.min(4,Math.max(.1,Math.min(a/e.width,t/e.height)));I(r.clientWidth/2-(e.x+e.width/2)*l,r.clientHeight/2-(e.y+e.height/2)*l,l)},[n,c,h]),x=p.useCallback(r=>{const u=n.current;if(b){Vt(u,r==="fill"?null:r);return}const e=Q[r];if(!u||e===null){H(null,null),I(0,0,1);return}H(e.width,e.height);const a=Math.min(1,Math.max(.1,Math.min((u.clientWidth-96)/e.width,(u.clientHeight-96)/e.height)));I((u.clientWidth-e.width*a)/2,(u.clientHeight-e.height*a)/2,a)},[b,n]),k=p.useCallback(()=>{const r=n.current;r&&_t(r)},[n]),w=b!==null,R=c?.kind==="dom"&&!!c.adapter.rects;if(i?!w:!R)return null;const C=b?b.selectedViewportId??"fill":Object.entries(Q).find(([,r])=>r===null?d.width===null:r.width===d.width&&r.height===d.height)?.[0]??"fill";return s.jsxs(s.Fragment,{children:[!w&&d.width!==null&&d.height!==null&&s.jsx("div",{"data-testid":"react-canvas-device-frame",style:{position:"absolute",left:0,top:0,zIndex:0,width:d.width,height:d.height,transform:et(o),transformOrigin:"0 0",pointerEvents:"none",background:"#fff",boxShadow:"0 0 0 1px #ffffff40, 0 8px 30px #0009"}}),s.jsxs(ot,{label:i?"2D component board view":"React canvas view","data-testid":i?"canvas-board-zoom-controls":"react-canvas-zoom-controls","data-vgai-canvas-navigation-ignore":"true",className:"vgai-react-canvas-controls",children:[!i&&s.jsx(ne,{boardViewport:b,containerRef:n,selectViewport:x,viewportValue:C}),w&&s.jsx(W,{variant:"ghost","aria-label":"Fit story board",title:"Fit all stories",size:"comfortable",onClick:k,children:"Fit board"}),s.jsx(D,{"aria-label":"Zoom out",title:"Zoom out",size:"comfortable",onClick:()=>f(o.zoom/1.2),children:s.jsx(M,{icon:nt,size:"md"})}),s.jsxs(W,{variant:"ghost","aria-label":"Reset zoom to 100%",title:"Reset zoom to 100%",size:"comfortable",onClick:()=>f(1),children:[Math.round(o.zoom*100),"%"]}),s.jsx(D,{"aria-label":"Zoom in",title:"Zoom in",size:"comfortable",onClick:()=>f(o.zoom*1.2),children:s.jsx(M,{icon:st,size:"md"})}),!i&&s.jsx(D,{"aria-label":"Zoom to selection",title:"Zoom to selection",size:"comfortable",onClick:m,children:s.jsx(M,{icon:at,size:"md"})})]})]})}const ae="Scene";function re({active:n,composite:c,descriptor:i,documentId:h,store:o}){const d=p.useRef(null),b=p.useRef(null),[f]=p.useState(ft),m=i.kind==="canvas",x=m?f:yt;p.useSyncExternalStore(o.subscribe,o.getSnapshot);const k=p.useSyncExternalStore(bt,xt),w=p.useSyncExternalStore(gt,vt),[R,C]=p.useState(null),r=c.childAdapters().find(v=>v.worldId===i.worldId)?.adapter??R??void 0,u=m&&r?.provenance?.label==="babylon",e=r?.hierarchy.roots()??[],a=new Set(r?.rects?.emptyContainers?.().map(v=>v.id)??[]),t=e.some(v=>!a.has(v.id)),l=Lt({surface:m?"Scene":i.kind==="dom"?"UI":"World",rootIds:[i.worldId],playSuspended:o.playState!=="stopped"&&(!r||r.provenance?.source==="boundary"),phase:!r||r.provenance?.source==="boundary"?"loading":"ready",content:!r||r.provenance?.source==="boundary"?"unknown":t?"present":"empty",readiness:k,failures:w});p.useEffect(()=>{if(r)return wt(h,()=>({adapter:r,nodeId:[...o.selectedEntityIds].find(v=>r.hierarchy.node(v))??null}))},[c,r,h,o]),p.useEffect(()=>{const v=d.current;if(v&&!u)return m?zt(v,x):At(v,x)},[x,u,m]),p.useEffect(()=>{if(!n)return;if(!!!b.current&&d.current){b.current=It(d.current,c,o,[i],(le,J)=>C(J),m?{canvasSceneView:f}:void 0,h);return}let E=0,T=0;const G=()=>{if(E+=1,E<2){T=requestAnimationFrame(G);return}Ct(h)};return T=requestAnimationFrame(G),()=>cancelAnimationFrame(T)},[n,f,c,i,h,m,o]),p.useEffect(()=>()=>{b.current?.(),b.current=null},[]);const g=St(kt(o),o.selectedEntityIds),S=g?.worldId===i.worldId?g:r?.rects?{worldId:i.worldId,kind:"dom",adapter:r}:null;return s.jsxs("div",{ref:d,"data-testid":`world-document:${i.worldId}`,"data-vgai-backdrop-color":n?u?"#111827":m?L:_:void 0,"data-vgai-backdrop-policy":n?"dark-frost":void 0,onPointerDown:()=>Rt("viewport"),style:{position:"absolute",inset:0,overflow:"hidden",pointerEvents:"auto",backgroundColor:u?"#111827":m?L:_,touchAction:"none"},children:[u?null:m?s.jsx(Dt,{view:f,documentId:h}):s.jsx(ie,{}),s.jsx(Jt,{...r?{adapter:r}:{},...m&&!u?{view:f,transformModeAware:!0}:{}},`selection:${U(r)}`),s.jsx(Ht,{explanation:l,testId:`world-surface-status:${i.worldId}`,style:{zIndex:20}}),u?null:m?s.jsx(Mt,{active:n,...r?{adapter:r}:{},containerRef:d,view:f,documentId:h},`controls:${U(r)}`):s.jsxs(s.Fragment,{children:[s.jsx(ee,{docId:i.worldId,containerRef:d}),s.jsx(se,{containerRef:d,context:S})]})]})}function ie(){const n=p.useSyncExternalStore(P,N),c=Math.max(8,24*n.zoom),i=Math.max(.7,Math.min(1.4,n.zoom));return s.jsx("div",{"data-testid":"react-design-canvas-backdrop","aria-hidden":"true",style:{position:"absolute",inset:0,pointerEvents:"none",backgroundColor:_,backgroundImage:`radial-gradient(circle, ${Nt} ${i}px, transparent ${i}px)`,backgroundPosition:`${n.x}px ${n.y}px`,backgroundSize:`${c}px ${c}px`}})}function $e(n,c){const i=pt(),h=c.childAdapters().some(t=>t.role==="world"&&t.kind==="three"),o=c.childAdapters().some(t=>t.kind===jt);!h&&!o&<(j,{discardDirty:!0});const d=new Set,b=[];let f=!1;for(const t of c.childAdapters())t.role==="world"&&t.kind==="three"&&b.push($(t.worldId,j));const m=Et(c),x=m.find(t=>t.kind==="canvas");x&&b.push($(x.worldId,z));const k=new Set([...c.childAdapters().filter(t=>t.role==="world"&&t.kind==="three"),...x?[x]:[]].map(t=>t.worldId)),w=new Map;function R(){for(const t of m){if(k.has(t.worldId)||w.has(t.worldId))continue;const l=Ot(t.kind);if(!l)continue;const g=$(t.worldId,l.documentId),S=ht(t.worldId,()=>l.presence()==="absent"?`Root "${t.worldId}" has no document of its own: its design surface is the project's ${l.title} board (${l.documentId}). ${l.absentReason()}`:null);w.set(t.worldId,()=>{S(),g()})}}b.push(ct(t=>{const l=mt();if(l.some(S=>S.descriptor.id===t))return null;const g=Ut(t);return g?g.presence()==="absent"?g.absentReason():null:`No workspace document is named "${t}". Open in this session: ${l.map(S=>S.descriptor.id).join(", ")||"(none)"}. A component board is present only when the package that owns its medium says this project has one, so a board id can be absent for this project and present for another.`}));function C(t){const l=g=>s.jsx(re,{...g,composite:c,descriptor:t,store:n});ut({id:z,title:ae,kind:"world",workspaceRole:"authored-subject",provenance:{rootId:t.worldId,...t.path?{sourcePath:t.path}:{}},Content:l,presentation:()=>({kind:"world",id:t.worldId})},{category:"scene",default:!h,rootId:t.worldId})}function r(t){d.add(t.documentId);const l=()=>{d.delete(t.documentId)};try{Promise.resolve(t.install({store:n,composite:c})).catch(l)}catch{l()}}function u(){if(!f){R();for(const t of Wt()){const l=t.presence();if(l===null)continue;const g=d.has(t.documentId);l==="present"!==g&&(l==="present"?r(t):(O(t.documentId),d.delete(t.documentId)))}}}x&&(C(x),d.add(z)),u();const e=Gt(u),a=x?z:[...d][0];return!h&&a!==void 0&&(i===null||i===j||i===dt)?F(a):i?F(i):h&&F(j),()=>{f=!0,e();for(const t of b)t();for(const t of w.values())t();w.clear();for(const t of d)O(t)}}export{re as RootDocumentContent,$e as installRootDocuments};
|