@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
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as Ge}from"./index-GIL7oGEO.js";import{O as ke,aB as Ve,z as We,M as j,aC as ie,V as Ye,C as Qe,a as ne,bt as Xe}from"./three.module-D396a9Mn.js";import{DEFAULTS as le}from"./defaults-DKiBJCPN.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";const $e=["Recast","Detour","DetourNavMeshBuilder","DetourTileCacheBuilder","NavMeshImporter","NavMeshExporter","CrowdUtils","ChunkyTriMeshUtils","RecastDebugDraw","DetourDebugDraw"],qe=["rcConfig","rcContext","dtNavMeshParams","dtNavMeshCreateParams","RecastLinearAllocator","RecastFastLZCompressor","rcChunkyTriMesh","dtTileCacheParams","dtTileCacheLayerHeader","Vec3","BoolRef","IntRef","UnsignedIntRef","UnsignedCharRef","UnsignedShortRef","FloatRef","IntArray","UnsignedIntArray","UnsignedCharArray","UnsignedShortArray","FloatArray"],s={isNull:a=>s.Module.getPointer(a)===0,destroy:a=>{s.Module.destroy(a)}},g={},f={},Ke=async a=>{if(s.Module===void 0){{const e=(await Ge(async()=>{const{default:t}=await import("./recast-navigation.wasm-compat-Dsoa_MD-.js");return{default:t}},[])).default;s.Module=await e()}for(const e of $e)s[e]=new s.Module[e];for(const e of qe)s[e]=s.Module[e];g.RC_BORDER_REG=s.Recast.BORDER_REG,g.RC_MULTIPLE_REGS=s.Recast.MULTIPLE_REGS,g.RC_BORDER_VERTEX=s.Recast.BORDER_VERTEX,g.RC_AREA_BORDER=s.Recast.AREA_BORDER,g.RC_CONTOUR_REG_MASK=s.Recast.CONTOUR_REG_MASK,g.RC_MESH_NULL_IDX=s.Recast.MESH_NULL_IDX,g.RC_NULL_AREA=s.Recast.NULL_AREA,g.RC_WALKABLE_AREA=s.Recast.WALKABLE_AREA,g.RC_NOT_CONNECTED=s.Recast.NOT_CONNECTED,g.RC_CONTOUR_TESS_WALL_EDGES=s.Module.RC_CONTOUR_TESS_WALL_EDGES,g.RC_CONTOUR_TESS_AREA_EDGES=s.Module.RC_CONTOUR_TESS_AREA_EDGES,g.RC_LOG_PROGRESS=s.Module.RC_LOG_PROGRESS,g.RC_LOG_WARNING=s.Module.RC_LOG_WARNING,g.RC_LOG_ERROR=s.Module.RC_LOG_ERROR,g.RC_TIMER_TOTAL=s.Module.RC_TIMER_TOTAL,g.RC_TIMER_TEMP=s.Module.RC_TIMER_TEMP,g.RC_TIMER_RASTERIZE_TRIANGLES=s.Module.RC_TIMER_RASTERIZE_TRIANGLES,g.RC_TIMER_BUILD_COMPACTHEIGHTFIELD=s.Module.RC_TIMER_BUILD_COMPACTHEIGHTFIELD,g.RC_TIMER_BUILD_CONTOURS=s.Module.RC_TIMER_BUILD_CONTOURS,g.RC_TIMER_BUILD_CONTOURS_TRACE=s.Module.RC_TIMER_BUILD_CONTOURS_TRACE,g.RC_TIMER_BUILD_CONTOURS_SIMPLIFY=s.Module.RC_TIMER_BUILD_CONTOURS_SIMPLIFY,g.RC_TIMER_FILTER_BORDER=s.Module.RC_TIMER_FILTER_BORDER,g.RC_TIMER_FILTER_WALKABLE=s.Module.RC_TIMER_FILTER_WALKABLE,g.RC_TIMER_MEDIAN_AREA=s.Module.RC_TIMER_MEDIAN_AREA,g.RC_TIMER_FILTER_LOW_OBSTACLES=s.Module.RC_TIMER_FILTER_LOW_OBSTACLES,g.RC_TIMER_BUILD_POLYMESH=s.Module.RC_TIMER_BUILD_POLYMESH,g.RC_TIMER_MERGE_POLYMESH=s.Module.RC_TIMER_MERGE_POLYMESH,g.RC_TIMER_ERODE_AREA=s.Module.RC_TIMER_ERODE_AREA,g.RC_TIMER_MARK_BOX_AREA=s.Module.RC_TIMER_MARK_BOX_AREA,g.RC_TIMER_MARK_CYLINDER_AREA=s.Module.RC_TIMER_MARK_CYLINDER_AREA,g.RC_TIMER_MARK_CONVEXPOLY_AREA=s.Module.RC_TIMER_MARK_CONVEXPOLY_AREA,g.RC_TIMER_BUILD_DISTANCEFIELD=s.Module.RC_TIMER_BUILD_DISTANCEFIELD,g.RC_TIMER_BUILD_DISTANCEFIELD_DIST=s.Module.RC_TIMER_BUILD_DISTANCEFIELD_DIST,g.RC_TIMER_BUILD_DISTANCEFIELD_BLUR=s.Module.RC_TIMER_BUILD_DISTANCEFIELD_BLUR,g.RC_TIMER_BUILD_REGIONS=s.Module.RC_TIMER_BUILD_REGIONS,g.RC_TIMER_BUILD_REGIONS_WATERSHED=s.Module.RC_TIMER_BUILD_REGIONS_WATERSHED,g.RC_TIMER_BUILD_REGIONS_EXPAND=s.Module.RC_TIMER_BUILD_REGIONS_EXPAND,g.RC_TIMER_BUILD_REGIONS_FLOOD=s.Module.RC_TIMER_BUILD_REGIONS_FLOOD,g.RC_TIMER_BUILD_REGIONS_FILTER=s.Module.RC_TIMER_BUILD_REGIONS_FILTER,g.RC_TIMER_BUILD_LAYERS=s.Module.RC_TIMER_BUILD_LAYERS,g.RC_TIMER_BUILD_POLYMESHDETAIL=s.Module.RC_TIMER_BUILD_POLYMESHDETAIL,g.RC_TIMER_MERGE_POLYMESHDETAIL=s.Module.RC_TIMER_MERGE_POLYMESHDETAIL,g.RC_MAX_TIMERS=s.Module.RC_MAX_TIMERS,f.DT_FAILURE=s.Detour.FAILURE,f.DT_SUCCESS=s.Detour.SUCCESS,f.DT_IN_PROGRESS=s.Detour.IN_PROGRESS,f.DT_STATUS_DETAIL_MASK=s.Detour.STATUS_DETAIL_MASK,f.DT_WRONG_MAGIC=s.Detour.WRONG_MAGIC,f.DT_WRONG_VERSION=s.Detour.WRONG_VERSION,f.DT_OUT_OF_MEMORY=s.Detour.OUT_OF_MEMORY,f.DT_INVALID_PARAM=s.Detour.INVALID_PARAM,f.DT_BUFFER_TOO_SMALL=s.Detour.BUFFER_TOO_SMALL,f.DT_OUT_OF_NODES=s.Detour.OUT_OF_NODES,f.DT_PARTIAL_RESULT=s.Detour.PARTIAL_RESULT,f.DT_ALREADY_OCCUPIED=s.Detour.ALREADY_OCCUPIED,f.DT_VERTS_PER_POLYGON=s.Detour.VERTS_PER_POLYGON,f.DT_NAVMESH_MAGIC=s.Detour.NAVMESH_MAGIC,f.DT_NAVMESH_VERSION=s.Detour.NAVMESH_VERSION,f.DT_NAVMESH_STATE_MAGIC=s.Detour.NAVMESH_STATE_MAGIC,f.DT_NAVMESH_STATE_VERSION=s.Detour.NAVMESH_STATE_VERSION,f.DT_TILECACHE_MAGIC=s.Detour.TILECACHE_MAGIC,f.DT_TILECACHE_VERSION=s.Detour.TILECACHE_VERSION,f.DT_TILECACHE_NULL_AREA=s.Detour.TILECACHE_NULL_AREA,f.DT_TILECACHE_WALKABLE_AREA=s.Detour.TILECACHE_WALKABLE_AREA,f.DT_TILECACHE_NULL_IDX=s.Detour.TILECACHE_NULL_IDX,f.DT_NULL_LINK=s.Detour.NULL_LINK,f.DT_NULL_LINK=s.Detour.NULL_LINK,f.DT_EXT_LINK=s.Detour.EXT_LINK,f.DT_OFFMESH_CON_BIDIR=s.Detour.OFFMESH_CON_BIDIR,f.DT_STRAIGHTPATH_START=s.Module.DT_STRAIGHTPATH_START,f.DT_STRAIGHTPATH_END=s.Module.DT_STRAIGHTPATH_END,f.DT_STRAIGHTPATH_OFFMESH_CONNECTION=s.Module.DT_STRAIGHTPATH_OFFMESH_CONNECTION,f.DT_STRAIGHTPATH_AREA_CROSSINGS=s.Module.DT_STRAIGHTPATH_AREA_CROSSINGS,f.DT_STRAIGHTPATH_ALL_CROSSINGS=s.Module.DT_STRAIGHTPATH_ALL_CROSSINGS,f.DT_FINDPATH_ANY_ANGLE=s.Module.DT_FINDPATH_ANY_ANGLE,f.DT_RAYCAST_USE_COSTS=s.Module.DT_RAYCAST_USE_COSTS,f.DT_CROWDAGENT_STATE_INVALID=s.Module.DT_CROWDAGENT_STATE_INVALID,f.DT_CROWDAGENT_STATE_WALKING=s.Module.DT_CROWDAGENT_STATE_WALKING,f.DT_CROWDAGENT_STATE_OFFMESH=s.Module.DT_CROWDAGENT_STATE_OFFMESH,f.DT_CROWDAGENT_TARGET_NONE=s.Module.DT_CROWDAGENT_TARGET_NONE,f.DT_CROWDAGENT_TARGET_FAILED=s.Module.DT_CROWDAGENT_TARGET_FAILED,f.DT_CROWDAGENT_TARGET_VALID=s.Module.DT_CROWDAGENT_TARGET_VALID,f.DT_CROWDAGENT_TARGET_REQUESTING=s.Module.DT_CROWDAGENT_TARGET_REQUESTING,f.DT_CROWDAGENT_TARGET_WAITING_FOR_QUEUE=s.Module.DT_CROWDAGENT_TARGET_WAITING_FOR_QUEUE,f.DT_CROWDAGENT_TARGET_WAITING_FOR_PATH=s.Module.DT_CROWDAGENT_TARGET_WAITING_FOR_PATH,f.DT_CROWDAGENT_TARGET_VELOCITY=s.Module.DT_CROWDAGENT_TARGET_VELOCITY,f.DT_COMPRESSEDTILE_FREE_DATA=s.Module.DT_COMPRESSEDTILE_FREE_DATA,f.DT_TILE_FREE_DATA=s.Module.DT_TILE_FREE_DATA}};class K{get size(){return this.raw.size}constructor(e){this.raw=e}get(e){return this.raw.get(e)}set(e,t){this.raw.set(e,t)}resize(e){this.raw.resize(e)}copy(e){this.raw.resize(e.length),this.getHeapView().set(e)}destroy(){s.destroy(this.raw)}getHeapView(){const e=this.getHeap();return new this.ArrayConstructor(e.buffer,this.raw.getDataPointer(),this.size)}toTypedArray(){const e=this.getHeapView(),t=new this.ArrayConstructor(new ArrayBuffer(this.size*e.BYTES_PER_ELEMENT),0,this.size);return t.set(e),t}}class W extends K{ArrayConstructor=Int32Array;constructor(e){super(e??new s.Module.IntArray)}getHeap(){return s.Module.HEAP32}static fromRaw(e){return new W(e)}}class z extends K{ArrayConstructor=Uint32Array;constructor(e){super(e??new s.Module.UnsignedIntArray)}getHeap(){return s.Module.HEAPU32}static fromRaw(e){return new z(e)}}class Y extends K{ArrayConstructor=Uint8Array;constructor(e){super(e??new s.Module.UnsignedCharArray)}getHeap(){return s.Module.HEAPU8}static fromRaw(e){return new Y(e)}}class k extends K{ArrayConstructor=Float32Array;constructor(e){super(e??new s.Module.FloatArray)}getHeap(){return s.Module.HEAPF32}static fromRaw(e){return new k(e)}}const ue=k,he=W,Z=Y,je=W,m={toRaw:({x:a,y:e,z:t},r)=>r?(r.x=a,r.y=e,r.z=t,r):new s.Module.Vec3(a,e,t),fromRaw:a=>{const{x:e,y:t,z:r}=a;return{x:e,y:t,z:r}},fromArray:([a,e,t])=>({x:a,y:e,z:t}),toArray:({x:a,y:e,z:t})=>[a,e,t],lerp:(a,e,t,r={x:0,y:0,z:0})=>{r.x=a.x+(e.x-a.x)*t,r.y=a.y+(e.y-a.y)*t,r.z=a.z+(e.z-a.z)*t},copy:(a,e={x:0,y:0,z:0})=>{e.x=a.x,e.y=a.y,e.z=a.z}},v=(a,e)=>{const t=[];for(let r=0;r<e;r++)t.push(a(r));return t},L=a=>s.Detour.statusSucceed(a),Ze=a=>s.Detour.statusFailed(a),Je=a=>{if(s.Detour.statusSucceed(a))return"success";if(s.Detour.statusInProgress(a))return"in progress";if(s.Detour.statusFailed(a)){let e;const t={DT_WRONG_MAGIC:f.DT_WRONG_MAGIC,DT_WRONG_VERSION:f.DT_WRONG_VERSION,DT_OUT_OF_MEMORY:f.DT_OUT_OF_MEMORY,DT_INVALID_PARAM:f.DT_INVALID_PARAM,DT_BUFFER_TOO_SMALL:f.DT_BUFFER_TOO_SMALL,DT_OUT_OF_NODES:f.DT_OUT_OF_NODES,DT_PARTIAL_RESULT:f.DT_PARTIAL_RESULT,DT_ALREADY_OCCUPIED:f.DT_ALREADY_OCCUPIED};for(const[r,i]of Object.entries(t))if(s.Detour.statusDetail(a,i)){e=r;break}return e?`failed - ${e}`:"failed - unknown"}return"unknown"};class et{constructor(e){this.raw=e}vertBase(){return this.raw.vertBase}triBase(){return this.raw.triBase}vertCount(){return this.raw.vertCount}triCount(){return this.raw.triCount}}class tt{constructor(e){this.raw=e}ref(){return this.raw.ref}next(){return this.raw.next}edge(){return this.raw.edge}side(){return this.raw.side}bmin(){return this.raw.bmin}bmax(){return this.raw.bmax}}class rt{constructor(e){this.raw=e}bmin(){return m.fromArray(v(e=>this.raw.get_bmin(e),3))}bmax(){return m.fromArray(v(e=>this.raw.get_bmax(e),3))}i(){return this.raw.i}}class ce{constructor(e){this.raw=e}pos(e){return this.raw.get_pos(e)}rad(){return this.raw.rad}poly(){return this.raw.poly}flags(){return this.raw.flags}side(){return this.raw.side}userId(){return this.raw.userId}}class st{constructor(e){this.raw=e}magic(){return this.raw.magic}version(){return this.raw.version}x(){return this.raw.x}y(){return this.raw.y}layer(){return this.raw.layer}userId(){return this.raw.userId}polyCount(){return this.raw.polyCount}vertCount(){return this.raw.vertCount}maxLinkCount(){return this.raw.maxLinkCount}detailMeshCount(){return this.raw.detailMeshCount}detailVertCount(){return this.raw.detailVertCount}detailTriCount(){return this.raw.detailTriCount}bvNodeCount(){return this.raw.bvNodeCount}offMeshConCount(){return this.raw.offMeshConCount}offMeshBase(){return this.raw.offMeshBase}walkableHeight(){return this.raw.walkableHeight}walkableRadius(){return this.raw.walkableRadius}walkableClimb(){return this.raw.walkableClimb}bmin(e){return this.raw.get_bmin(e)}bmax(e){return this.raw.get_bmax(e)}bvQuantFactor(){return this.raw.bvQuantFactor}}class J{constructor(e){this.raw=e}firstLink(){return this.raw.firstLink}verts(e){return this.raw.get_verts(e)}neis(e){return this.raw.get_neis(e)}flags(){return this.raw.flags}vertCount(){return this.raw.vertCount}areaAndType(){return this.raw.get_areaAndtype()}getType(){return this.raw.getType()}}class B{constructor(e){this.raw=e}salt(){return this.raw.salt}linksFreeList(){return this.raw.linksFreeList}header(){return s.isNull(this.raw.header)?null:new st(this.raw.header)}polys(e){return new J(this.raw.get_polys(e))}verts(e){return this.raw.get_verts(e)}links(e){return new tt(this.raw.get_links(e))}detailMeshes(e){return new et(this.raw.get_detailMeshes(e))}detailVerts(e){return this.raw.get_detailVerts(e)}detailTris(e){return this.raw.get_detailTris(e)}bvTree(e){return new rt(this.raw.get_bvTree(e))}offMeshCons(e){return new ce(this.raw.get_offMeshCons(e))}data(e){return this.raw.get_data(e)}dataSize(){return this.raw.dataSize}flags(){return this.raw.flags}next(){return new B(this.raw.next)}}const de=a=>{const e=s.DetourNavMeshBuilder.createNavMeshData(a.raw);return{success:e.success,navMeshData:Y.fromRaw(e.navMeshData)}};class we{constructor(e){this.raw=e??new s.Module.dtNavMeshCreateParams}setPolyMeshCreateParams(e){s.DetourNavMeshBuilder.setPolyMeshCreateParams(this.raw,e.raw)}setPolyMeshDetailCreateParams(e){s.DetourNavMeshBuilder.setPolyMeshDetailCreateParams(this.raw,e.raw)}setOffMeshConnections(e){if(e.length<=0)return;const t=[],r=[],i=[],o=[],l=[],n=[];for(let u=0;u<e.length;u++){const d=e[u];t.push(d.startPosition.x,d.startPosition.y,d.startPosition.z),t.push(d.endPosition.x,d.endPosition.y,d.endPosition.z),r.push(d.radius),i.push(d.bidirectional?1:0),o.push(d.area??0),l.push(d.flags??1),n.push(d.userId??1e3+u)}s.DetourNavMeshBuilder.setOffMeshConnections(this.raw,e.length,t,r,i,o,l,n)}verts(e){return this.raw.get_verts(e)}setVerts(e,t){this.raw.set_verts(e,t)}vertCount(){return this.raw.vertCount}polys(e){return this.raw.get_polys(e)}setPolys(e,t){this.raw.set_polys(e,t)}polyAreas(e){return this.raw.get_polyAreas(e)}setPolyAreas(e,t){this.raw.set_polyAreas(e,t)}polyFlags(e){return this.raw.get_polyFlags(e)}setPolyFlags(e,t){this.raw.set_polyFlags(e,t)}polyCount(){return this.raw.polyCount}nvp(){return this.raw.nvp}setNvp(e){this.raw.nvp=e}detailMeshes(e){return this.raw.get_detailMeshes(e)}setDetailMeshes(e,t){this.raw.set_detailMeshes(e,t)}detailVerts(e){return this.raw.get_detailVerts(e)}setDetailVerts(e,t){this.raw.set_detailVerts(e,t)}detailVertsCount(){return this.raw.detailVertsCount}detailTris(e){return this.raw.get_detailTris(e)}setDetailTris(e,t){this.raw.set_detailTris(e,t)}detailTriCount(){return this.raw.detailTriCount}offMeshConVerts(e){return this.raw.get_offMeshConVerts(e)}offMeshConRad(e){return this.raw.get_offMeshConRad(e)}offMeshConDir(e){return this.raw.get_offMeshConDir(e)}offMeshConAreas(e){return this.raw.get_offMeshConAreas(e)}offMeshConFlags(e){return this.raw.get_offMeshConFlags(e)}offMeshConUserID(e){return this.raw.get_offMeshConUserID(e)}offMeshConCount(){return this.raw.offMeshConCount}userId(){return this.raw.userId}tileX(){return this.raw.tileX}setTileX(e){this.raw.tileX=e}tileY(){return this.raw.tileY}setTileY(e){this.raw.tileY=e}tileLayer(){return this.raw.tileLayer}setTileLayer(e){this.raw.tileLayer=e}boundsMin(){return v(e=>this.raw.get_bmin(e),3)}setBoundsMin(e){this.raw.set_bmin(0,e[0]),this.raw.set_bmin(1,e[1]),this.raw.set_bmin(2,e[2])}boundsMax(){return v(e=>this.raw.get_bmax(e),3)}setBoundsMax(e){this.raw.set_bmax(0,e[0]),this.raw.set_bmax(1,e[1]),this.raw.set_bmax(2,e[2])}walkableHeight(){return this.raw.walkableHeight}setWalkableHeight(e){this.raw.walkableHeight=e}walkableRadius(){return this.raw.walkableRadius}setWalkableRadius(e){this.raw.walkableRadius=e}walkableClimb(){return this.raw.walkableClimb}setWalkableClimb(e){this.raw.walkableClimb=e}cellSize(){return this.raw.cs}setCellSize(e){this.raw.cs=e}cellHeight(){return this.raw.ch}setCellHeight(e){this.raw.ch=e}buildBvTree(){return this.raw.buildBvTree}setBuildBvTree(e){this.raw.buildBvTree=e}}class ge{get includeFlags(){return this.raw.getIncludeFlags()}set includeFlags(e){this.raw.setIncludeFlags(e)}get excludeFlags(){return this.raw.getExcludeFlags()}set excludeFlags(e){this.raw.setExcludeFlags(e)}constructor(e){this.raw=e??new s.Module.dtQueryFilter}getAreaCost(e){return this.raw.getAreaCost(e)}setAreaCost(e,t){this.raw.setAreaCost(e,t)}}class ee{defaultQueryHalfExtents={x:1,y:1,z:1};constructor(e,t){e instanceof s.Module.NavMeshQuery?this.raw=e:(this.raw=new s.Module.NavMeshQuery,this.raw.init(e.raw,t?.maxNodes??2048)),t?.defaultQueryFilter?this.defaultFilter=t.defaultQueryFilter:(this.defaultFilter=new ge,this.defaultFilter.includeFlags=65535,this.defaultFilter.excludeFlags=0)}findNearestPoly(e,t){const r=new s.UnsignedIntRef,i=new s.Vec3,o=new s.BoolRef,l=this.raw.findNearestPoly(m.toArray(e),m.toArray(t?.halfExtents??this.defaultQueryHalfExtents),t?.filter?.raw??this.defaultFilter.raw,r,i,o),n=m.fromRaw(i);s.destroy(i);const u=r.value;s.destroy(r);const d=o.value;return s.destroy(o),{success:L(l),status:l,nearestRef:u,nearestPoint:n,isOverPoly:d}}findPolysAroundCircle(e,t,r,i){const o=i?.filter??this.defaultFilter,l=i?.maxPolys??256,n=new z,u=new z,d=new k;n.resize(l),u.resize(l),d.resize(l);const _=new s.IntRef,h=this.raw.findPolysAroundCircle(e,m.toArray(t),r,o.raw,n.raw,u.raw,d.raw,_,l),y=[...n.getHeapView()];n.destroy();const M=[...u.getHeapView()];u.destroy();const p=[...d.getHeapView()];d.destroy();const C=_.value;return s.destroy(_),{success:L(h),status:h,resultRefs:y,resultParents:M,resultCost:p,resultCount:C}}queryPolygons(e,t,r){const i=r?.filter??this.defaultFilter,o=r?.maxPolys??256,l=new z;l.resize(o);const n=new s.IntRef,u=this.raw.queryPolygons(m.toArray(e),m.toArray(t),i.raw,l.raw,n,o),d=n.value;s.destroy(n);const _=[...l.getHeapView()].slice(0,d);return l.destroy(),{success:L(u),status:u,polyRefs:_}}closestPointOnPoly(e,t){const r=new s.Vec3,i=new s.BoolRef,o=this.raw.closestPointOnPoly(e,m.toArray(t),r,i),l=m.fromRaw(r);s.destroy(r);const n=i.value;return s.destroy(i),{success:L(o),status:o,closestPoint:l,isPointOverPoly:n}}findClosestPoint(e,t){const r=t?.filter??this.defaultFilter,i=t?.halfExtents??this.defaultQueryHalfExtents,o=new s.UnsignedIntRef,l=new s.Vec3,n=new s.BoolRef,u=this.raw.findClosestPoint(m.toArray(e),m.toArray(i),r.raw,o,l,n),d=o.value;s.destroy(o);const _=m.fromRaw(l);s.destroy(l);const h=n.value;return s.destroy(n),{success:L(u),status:u,polyRef:d,point:_,isPointOverPoly:h}}findRandomPointAroundCircle(e,t,r){const i=r?.filter??this.defaultFilter,o=r?.halfExtents??this.defaultQueryHalfExtents;let l;if(r?.startRef)l=r.startRef;else{const y=this.findNearestPoly(e,{filter:i,halfExtents:o});if(!y.success)return{success:!1,status:y.status,randomPolyRef:0,randomPoint:{x:0,y:0,z:0}};l=y.nearestRef}const n=new s.UnsignedIntRef,u=new s.Vec3,d=this.raw.findRandomPointAroundCircle(l,m.toArray(e),t,i.raw,n,u),_=n.value;s.destroy(n);const h=m.fromRaw(u);return s.destroy(u),{success:L(d),status:d,randomPolyRef:_,randomPoint:h}}moveAlongSurface(e,t,r,i){const o=i?.maxVisitedSize??256,l=new s.Vec3,n=new z,u=i?.filter?.raw??this.defaultFilter.raw,d=this.raw.moveAlongSurface(e,m.toArray(t),m.toArray(r),u,l,n.raw,o),_=m.fromRaw(l);s.destroy(l);const h=[...n.getHeapView()];return n.destroy(),{success:L(d),status:d,resultPosition:_,visited:h}}findRandomPoint(e){const t=new s.UnsignedIntRef,r=new s.Vec3,i=this.raw.findRandomPoint(e?.filter?.raw??this.defaultFilter.raw,t,r),o=t.value;s.destroy(t);const l=m.fromRaw(r);return s.destroy(r),{success:L(i),status:i,randomPolyRef:o,randomPoint:l}}getPolyHeight(e,t){const r=new s.FloatRef,i=this.raw.getPolyHeight(e,m.toArray(t),r),o=r.value;return s.destroy(r),{success:L(i),status:i,height:o}}computePath(e,t,r){const i=r?.filter??this.defaultFilter,o=r?.halfExtents??this.defaultQueryHalfExtents,l=this.findNearestPoly(e,{filter:i,halfExtents:o});if(!l.success)return{success:!1,error:{name:"findNearestPoly for start position failed",status:l.status},path:[]};const n=this.findNearestPoly(t,{filter:i,halfExtents:o});if(!n.success)return{success:!1,error:{name:"findNearestPoly for end position failed",status:n.status},path:[]};const u=l.nearestRef,d=n.nearestRef,_=r?.maxPathPolys??256,h=this.findPath(u,d,e,t,{filter:i,maxPathPolys:_});if(!h.success)return{success:!1,error:{name:"findPath unsuccessful",status:h.status},path:[]};if(h.polys.size<=0)return{success:!1,error:{name:"no polygon path found"},path:[]};const y=h.polys.get(h.polys.size-1);let M={x:t.x,y:t.y,z:t.z};if(y!==d){const A=this.closestPointOnPoly(y,t);if(!A.success)return{success:!1,error:{name:"no closest point on last polygon found",status:A.status},path:[]};M=A.closestPoint}const p=r?.maxStraightPathPoints,C=this.findStraightPath(e,M,h.polys,{maxStraightPathPoints:p});if(!C.success)return{success:!1,error:{name:"findStraightPath unsuccessful",status:C.status},path:[]};const{straightPath:I,straightPathCount:w}=C,P=[];for(let A=0;A<w;A++)P.push({x:I.get(A*3),y:I.get(A*3+1),z:I.get(A*3+2)});return h.polys.destroy(),C.straightPath.destroy(),C.straightPathFlags.destroy(),C.straightPathRefs.destroy(),{success:!0,path:P}}findPath(e,t,r,i,o){const l=o?.filter??this.defaultFilter,n=o?.maxPathPolys??256,u=new z;u.resize(n);const d=this.raw.findPath(e,t,m.toArray(r),m.toArray(i),l.raw,u.raw,n);return{success:L(d),status:d,polys:u}}findStraightPath(e,t,r,i){const o=i?.maxStraightPathPoints??256,l=i?.straightPathOptions??0;let n;Array.isArray(r)?(n=new z,n.copy(r)):n=r;const u=new k;u.resize(o*3);const d=new Y;d.resize(o);const _=new z;_.resize(o);const h=new s.IntRef,y=this.raw.findStraightPath(m.toArray(e),m.toArray(t),n.raw,u.raw,d.raw,_.raw,h,o,l),M=h.value;return s.destroy(h),Array.isArray(r)&&n.destroy(),{success:L(y),status:y,straightPath:u,straightPathFlags:d,straightPathRefs:_,straightPathCount:M}}raycast(e,t,r,i){const o=new s.Module.dtRaycastHit,l=i?.raycastOptions??0,n=i?.prevRef??0,u=i?.filter?.raw??this.defaultFilter.raw,d=this.raw.raycast(e,m.toArray(t),m.toArray(r),u,l,o,n),_={success:L(d),status:d,t:o.t,hitNormal:m.fromArray(v(h=>o.get_hitNormal(h),3)),hitEdgeIndex:o.hitEdgeIndex,path:v(h=>o.get_path(h),o.pathCount),maxPath:o.maxPath,pathCost:o.pathCost};return s.destroy(o),_}destroy(){this.raw.destroy()}}const _e={radius:.5,height:1,maxAcceleration:20,maxSpeed:6,collisionQueryRange:2.5,pathOptimizationRange:0,separationWeight:0,updateFlags:7,obstacleAvoidanceType:0,queryFilterType:0,userData:0};class at{get radius(){return this.raw.params.radius}set radius(e){this.raw.params.radius=e}get height(){return this.raw.params.height}set height(e){this.raw.params.height=e}get maxAcceleration(){return this.raw.params.maxAcceleration}set maxAcceleration(e){this.raw.params.maxAcceleration=e}get maxSpeed(){return this.raw.params.maxSpeed}set maxSpeed(e){this.raw.params.maxSpeed=e}get collisionQueryRange(){return this.raw.params.collisionQueryRange}set collisionQueryRange(e){this.raw.params.collisionQueryRange=e}get pathOptimizationRange(){return this.raw.params.pathOptimizationRange}set pathOptimizationRange(e){this.raw.params.pathOptimizationRange=e}get separationWeight(){return this.raw.params.separationWeight}set separationWeight(e){this.raw.params.separationWeight=e}get updateFlags(){return this.raw.params.updateFlags}set updateFlags(e){this.raw.params.updateFlags=e}get obstacleAvoidanceType(){return this.raw.params.obstacleAvoidanceType}set obstacleAvoidanceType(e){this.raw.params.obstacleAvoidanceType=e}get queryFilterType(){return this.raw.params.queryFilterType}set queryFilterType(e){this.raw.params.queryFilterType=e}get userData(){return this.raw.params.userData}set userData(e){this.raw.params.userData=e}interpolatedPosition={x:0,y:0,z:0};constructor(e,t){this.crowd=e,this.agentIndex=t,this.raw=e.raw.getEditableAgent(t),this.interpolatedPosition=this.position()}requestMoveTarget(e){const{nearestPoint:t,nearestRef:r}=this.crowd.navMeshQuery.findNearestPoly(e,{halfExtents:this.crowd.navMeshQuery.defaultQueryHalfExtents,filter:this.crowd.navMeshQuery.defaultFilter});return this.crowd.raw.requestMoveTarget(this.agentIndex,r,m.toArray(t))}requestMoveVelocity(e){return this.crowd.raw.requestMoveVelocity(this.agentIndex,m.toArray(e))}resetMoveTarget(){this.crowd.raw.resetMoveTarget(this.agentIndex)}teleport(e){s.CrowdUtils.agentTeleport(this.crowd.raw,this.agentIndex,m.toArray(e),m.toArray(this.crowd.navMeshQuery.defaultQueryHalfExtents),this.crowd.navMeshQuery.defaultFilter.raw),m.copy(e,this.interpolatedPosition)}position(){return{x:this.raw.get_npos(0),y:this.raw.get_npos(1),z:this.raw.get_npos(2)}}velocity(){return{x:this.raw.get_vel(0),y:this.raw.get_vel(1),z:this.raw.get_vel(2)}}desiredVelocity(){return{x:this.raw.get_dvel(0),y:this.raw.get_dvel(1),z:this.raw.get_dvel(2)}}desiredVelocityObstacleAdjusted(){return{x:this.raw.get_nvel(0),y:this.raw.get_nvel(1),z:this.raw.get_nvel(2)}}state(){return this.raw.state}target(){return{x:this.raw.get_targetPos(0),y:this.raw.get_targetPos(1),z:this.raw.get_targetPos(2)}}nextTargetInPath(){return{x:this.raw.get_cornerVerts(0),y:this.raw.get_cornerVerts(1),z:this.raw.get_cornerVerts(2)}}corners(){const e=[];for(let t=0;t<this.raw.ncorners;t++)e.push({x:this.raw.get_cornerVerts(t*3),y:this.raw.get_cornerVerts(t*3+1),z:this.raw.get_cornerVerts(t*3+2)});return e}parameters(){const{params:e}=this.raw;return{radius:e.radius,height:e.height,maxAcceleration:e.maxAcceleration,maxSpeed:e.maxSpeed,collisionQueryRange:e.collisionQueryRange,pathOptimizationRange:e.pathOptimizationRange,separationWeight:e.separationWeight,updateFlags:e.updateFlags,obstacleAvoidanceType:e.obstacleAvoidanceType,queryFilterType:e.queryFilterType,userData:e.userData}}updateParameters(e){const t={...this.parameters(),...e};this.setParameters(t)}setParameters(e){const t={..._e,...e},r=new s.Module.dtCrowdAgentParams;r.radius=t.radius,r.height=t.height,r.maxAcceleration=t.maxAcceleration,r.maxSpeed=t.maxSpeed,r.collisionQueryRange=t.collisionQueryRange,r.pathOptimizationRange=t.pathOptimizationRange,r.separationWeight=t.separationWeight,r.updateFlags=t.updateFlags,r.obstacleAvoidanceType=t.obstacleAvoidanceType,r.queryFilterType=t.queryFilterType,r.userData=t.userData,this.crowd.raw.updateAgentParameters(this.agentIndex,r)}overOffMeshConnection(){return s.CrowdUtils.overOffMeshConnection(this.crowd.raw,this.agentIndex)}}class it{agents={};accumulator=0;constructor(e,{maxAgents:t,maxAgentRadius:r}){this.navMesh=e,this.raw=s.Detour.allocCrowd(),this.raw.init(t,r,e.raw.getNavMesh()),this.navMeshQuery=new ee(new s.Module.NavMeshQuery(this.raw.getNavMeshQuery()))}update(e,t,r=10){if(t===void 0)this.raw.update(e,void 0);else{this.accumulator+=t;let i=0;for(;this.accumulator>=e&&i<r;)this.raw.update(e,void 0),this.accumulator-=e,i++;const o=this.accumulator%e/e,l=this.getAgents();for(const n of l)m.lerp(n.interpolatedPosition,n.position(),o,n.interpolatedPosition)}}addAgent(e,t){const r={..._e,...t},i=new s.Module.dtCrowdAgentParams;i.radius=r.radius,i.height=r.height,i.maxAcceleration=r.maxAcceleration,i.maxSpeed=r.maxSpeed,i.collisionQueryRange=r.collisionQueryRange,i.pathOptimizationRange=r.pathOptimizationRange,i.separationWeight=r.separationWeight,i.updateFlags=r.updateFlags,i.obstacleAvoidanceType=r.obstacleAvoidanceType,i.queryFilterType=r.queryFilterType,i.userData=r.userData;const o=this.raw.addAgent(m.toArray(e),i),l=new at(this,o);return this.agents[o]=l,l}getAgent(e){const t=this.agents[e];return t||null}removeAgent(e){const t=typeof e=="number"?e:e.agentIndex;this.raw.removeAgent(t),delete this.agents[t]}getAgentCount(){return this.raw.getAgentCount()}getActiveAgentCount(){return s.CrowdUtils.getActiveAgentCount(this.raw)}getAgents(){return Object.values(this.agents)}getFilter(e){return new ge(this.raw.getEditableFilter(e))}destroy(){s.Detour.freeCrowd(this.raw)}}class nt{constructor(e){this.raw=e}tiles(e){return new B(this.raw.get_tiles(e))}tileCount(){return this.raw.tileCount}}class ot{constructor(e){this.raw=e}data(){return v(e=>this.raw.get_data(e),this.raw.dataSize)}dataSize(){return this.raw.dataSize}}class lt{constructor(e){this.raw=e}tileX(){return this.raw.tileX}tileY(){return this.raw.tileY}}class ut{constructor(e){this.raw=e}data(){return v(e=>this.raw.get_data(e),this.raw.dataSize)}dataSize(){return this.raw.dataSize}}class Q{constructor(e){this.raw=e}static create(e){const t=new s.Module.dtNavMeshParams;return t.set_orig(0,e.orig.x),t.set_orig(1,e.orig.y),t.set_orig(2,e.orig.z),t.tileWidth=e.tileWidth,t.tileHeight=e.tileHeight,t.maxTiles=e.maxTiles,t.maxPolys=e.maxPolys,new Q(t)}clone(){return Q.create({orig:{x:this.raw.get_orig(0),y:this.raw.get_orig(1),z:this.raw.get_orig(2)},tileWidth:this.raw.tileWidth,tileHeight:this.raw.tileHeight,maxTiles:this.raw.maxTiles,maxPolys:this.raw.maxPolys})}}class te{constructor(e){this.raw=e??new s.Module.NavMesh}initSolo(e){return this.raw.initSolo(e.raw)}initTiled(e){return this.raw.initTiled(e.raw)}addTile(e,t,r){const i=new s.UnsignedIntRef,o=this.raw.addTile(e.raw,t,r,i),l=i.value;return s.destroy(i),{status:o,tileRef:l}}decodePolyId(e){const t=new s.UnsignedIntRef,r=new s.UnsignedIntRef,i=new s.UnsignedIntRef;this.raw.decodePolyId(e,t,r,i);const o=t.value;s.destroy(t);const l=r.value;s.destroy(r);const n=i.value;return s.destroy(i),{tileSalt:o,tileIndex:l,tilePolygonIndex:n}}encodePolyId(e,t,r){return this.raw.encodePolyId(e,t,r)}removeTile(e){return new ot(this.raw.removeTile(e))}calcTileLoc(e){return new lt(this.raw.calcTileLoc(m.toArray(e)))}getTileAt(e,t,r){const i=this.raw.getTileAt(e,t,r);return s.isNull(i)?null:new B(i)}getTilesAt(e,t,r){return new nt(this.raw.getTilesAt(e,t,r))}getTileRefAt(e,t,r){return this.raw.getTileRefAt(e,t,r)}getTileRef(e){return this.raw.getTileRef(e.raw)}getTileByRef(e){const t=this.raw.getTileByRef(e);return s.isNull(t)?null:new B(t)}getMaxTiles(){return this.raw.getMaxTiles()}getTile(e){return new B(this.raw.getTile(e))}getTileAndPolyByRef(e){const t=this.raw.getTileAndPolyByRef(e),r=new B(t.tile),i=new J(t.poly);return{success:L(t.status),status:t.status,tile:r,poly:i}}getTileAndPolyByRefUnsafe(e){const t=this.raw.getTileAndPolyByRef(e),r=new B(t.tile),i=new J(t.poly);return{tile:r,poly:i}}isValidPolyRef(e){return this.raw.isValidPolyRef(e)}getPolyRefBase(e){return this.raw.getPolyRefBase(e.raw)}getOffMeshConnectionPolyEndPoints(e,t){const r=new s.Vec3,i=new s.Vec3,o=this.raw.getOffMeshConnectionPolyEndPoints(e,t,r,i),l=m.fromRaw(r);s.destroy(r);const n=m.fromRaw(i);return s.destroy(i),{success:L(o),status:o,start:l,end:n}}getOffMeshConnectionByRef(e){return new ce(this.raw.getOffMeshConnectionByRef(e))}setPolyFlags(e,t){return this.raw.setPolyFlags(e,t)}getPolyFlags(e){const t=new s.UnsignedShortRef,r=this.raw.getPolyFlags(e,t),i=t.value;return s.destroy(t),{status:r,flags:i}}setPolyArea(e,t){return this.raw.setPolyArea(e,t)}getPolyArea(e){const t=new s.UnsignedCharRef,r=this.raw.getPolyArea(e,t),i=t.value;return s.destroy(t),{status:r,area:i}}getTileStateSize(e){return this.raw.getTileStateSize(e.raw)}storeTileState(e,t){return new ut(this.raw.storeTileState(e.raw,t))}restoreTileState(e,t,r){return this.raw.restoreTileState(e.raw,t,r)}destroy(){this.raw.destroy(),s.Module.destroy(this.raw)}}const ht=(a,e)=>{const t=[],r=[];let i=0;const o=a.getMaxTiles();for(let l=0;l<o;l++){const n=a.getTile(l),u=n.header();if(!u)continue;const d=u.polyCount();for(let _=0;_<d;++_){const h=n.polys(_);if(h.getType()===1)continue;const y=h.vertCount(),M=n.detailMeshes(_),p=M.triBase(),C=M.triCount();for(let I=0;I<C;++I){const w=(p+I)*4;for(let P=0;P<3;++P){if(n.detailTris(w+P)<y){const A=h.verts(n.detailTris(w+P))*3;t.push(n.verts(A),n.verts(A+1),n.verts(A+2))}else{const A=(M.vertBase()+n.detailTris(w+P)-h.vertCount())*3;t.push(n.detailVerts(A),n.detailVerts(A+1),n.detailVerts(A+2))}r.push(i++)}}}}return[t,r]},re={borderSize:0,tileSize:0,cs:.2,ch:.2,walkableSlopeAngle:60,walkableHeight:2,walkableClimb:2,walkableRadius:.5,maxEdgeLen:12,maxSimplificationError:1.3,minRegionArea:8,mergeRegionArea:20,maxVertsPerPoly:6,detailSampleDist:6,detailSampleMaxError:1},fe=a=>{const e={...re,...a},t=new s.Module.rcConfig;return t.borderSize=e.borderSize,t.tileSize=e.tileSize,t.cs=e.cs,t.ch=e.ch,t.walkableSlopeAngle=e.walkableSlopeAngle,t.walkableHeight=e.walkableHeight,t.walkableClimb=e.walkableClimb,t.walkableRadius=e.walkableRadius,t.maxEdgeLen=e.maxEdgeLen,t.maxSimplificationError=e.maxSimplificationError,t.minRegionArea=e.minRegionArea,t.mergeRegionArea=e.mergeRegionArea,t.maxVertsPerPoly=e.maxVertsPerPoly,t.detailSampleDist=e.detailSampleDist,t.detailSampleMaxError=e.detailSampleMaxError,t},ct=a=>{const e=new s.Module.rcConfig;return e.set_bmin(0,a.get_bmin(0)),e.set_bmin(1,a.get_bmin(1)),e.set_bmin(2,a.get_bmin(2)),e.set_bmax(0,a.get_bmax(0)),e.set_bmax(1,a.get_bmax(1)),e.set_bmax(2,a.get_bmax(2)),e.width=a.width,e.height=a.height,e.borderSize=a.borderSize,e.tileSize=a.tileSize,e.cs=a.cs,e.ch=a.ch,e.walkableSlopeAngle=a.walkableSlopeAngle,e.walkableHeight=a.walkableHeight,e.walkableClimb=a.walkableClimb,e.walkableRadius=a.walkableRadius,e.maxEdgeLen=a.maxEdgeLen,e.maxSimplificationError=a.maxSimplificationError,e.minRegionArea=a.minRegionArea,e.mergeRegionArea=a.mergeRegionArea,e.maxVertsPerPoly=a.maxVertsPerPoly,e.detailSampleDist=a.detailSampleDist,e.detailSampleMaxError=a.detailSampleMaxError,e};class se{logs=[];startTimes={};accumulatedTimes={};constructor(e=!0){const t=new s.Module.RecastBuildContextJsImpl;t.log=(r,i,o)=>{if(!this.raw.logEnabled())return;const l=i,n=new Uint8Array(s.Module.HEAPU8.buffer,l,o),u=new Uint8Array(o);u.set(n);const d=new TextDecoder().decode(u);this.log(r,d)},t.resetLog=()=>{this.resetLog()},t.startTimer=r=>{this.raw.timerEnabled()&&this.startTimer(r)},t.stopTimer=r=>{this.raw.timerEnabled()&&this.stopTimer(r)},t.getAccumulatedTime=r=>this.raw.timerEnabled()?this.getAccumulatedTime(r):-1,t.resetTimers=()=>{this.raw.timerEnabled()&&(this.startTimes={},this.accumulatedTimes={})},this.raw=new s.Module.RecastBuildContext(t),this.raw.enableTimer(e),this.raw.enableLog(e),this.resetTimers()}log(e,t){this.logs.push({category:e,msg:t})}resetLog(){this.logs=[]}startTimer(e){this.startTimes[e]=performance.now()}stopTimer(e){const r=performance.now()-this.startTimes[e];this.accumulatedTimes[e]===-1?this.accumulatedTimes[e]=r:this.accumulatedTimes[e]+=r}getAccumulatedTime(e){return this.accumulatedTimes[e]}resetTimers(){for(let e=0;e<g.RC_MAX_TIMERS;e++)this.startTimes[e]=-1,this.accumulatedTimes[e]=-1}}class dt{constructor(e){this.raw=e??new s.rcChunkyTriMesh}init(e,t,r,i){return s.ChunkyTriMeshUtils.createChunkyTriMesh(e.raw,t.raw,r,i,this.raw)}getChunksOverlappingRect(e,t,r,i){return s.ChunkyTriMeshUtils.getChunksOverlappingRect(this.raw,e,t,r.raw,i)}getNodeTris(e){return W.fromRaw(s.ChunkyTriMeshUtils.getChunkyTriMeshNodeTris(this.raw,e))}nodes(e){return this.raw.get_nodes(e)}maxTrisPerChunk(){return this.raw.maxTrisPerChunk}}class V{constructor(e){this.raw=e}smin(){return this.raw.smin}smax(){return this.raw.smax}area(){return this.raw.area}next(){return s.isNull(this.raw.next)?null:new V(this.raw.next)}}class ae{constructor(e){this.raw=e}next(){return s.isNull(this.raw.next)?null:new ae(this.raw.next)}items(e){return new V(this.raw.get_items(e))}}class wt{constructor(e){this.raw=e}width(){return this.raw.width}height(){return this.raw.height}bmin(){return m.fromArray(v(e=>this.raw.get_bmin(e),3))}bmax(){return m.fromArray(v(e=>this.raw.get_bmax(e),3))}cs(){return this.raw.cs}ch(){return this.raw.ch}spans(e){return new V(this.raw.get_spans(e))}pools(e){return new ae(this.raw.get_pools(e))}freelist(e){return new V(this.raw.get_freelist(e))}}class gt{constructor(e){this.raw=e}index(){return this.raw.get_index()}count(){return this.raw.get_count()}}class _t{constructor(e){this.raw=e}y(){return this.raw.get_y()}reg(){return this.raw.get_reg()}con(){return this.raw.get_con()}h(){return this.raw.get_h()}}class ft{constructor(e){this.raw=e}width(){return this.raw.width}height(){return this.raw.height}spanCount(){return this.raw.spanCount}walkableHeight(){return this.raw.walkableHeight}walkableClimb(){return this.raw.walkableClimb}borderSize(){return this.raw.borderSize}maxDistance(){return this.raw.maxDistance}maxRegions(){return this.raw.maxRegions}bmin(){return m.fromArray(v(e=>this.raw.get_bmin(e),3))}bmax(){return m.fromArray(v(e=>this.raw.get_bmax(e),3))}cs(){return this.raw.cs}ch(){return this.raw.ch}cells(e){return new gt(this.raw.get_cells(e))}spans(e){return new _t(this.raw.get_spans(e))}dist(e){return this.raw.get_dist(e)}areas(e){return this.raw.get_areas(e)}}class Rt{constructor(e){this.raw=e}verts(e){return this.raw.get_verts(e)}nverts(){return this.raw.nverts}rverts(e){return this.raw.get_rverts(e)}nrverts(){return this.raw.nrverts}reg(){return this.raw.reg}area(){return this.raw.area}}class Tt{constructor(e){this.raw=e}conts(e){return new Rt(this.raw.get_conts(e))}nconts(){return this.raw.nconts}bmin(){return m.fromArray(v(e=>this.raw.get_bmin(e),3))}bmax(){return m.fromArray(v(e=>this.raw.get_bmax(e),3))}cs(){return this.raw.cs}ch(){return this.raw.ch}width(){return this.raw.width}height(){return this.raw.height}borderSize(){return this.raw.borderSize}maxError(){return this.raw.maxError}}class mt{constructor(e){this.raw=e}verts(e){return this.raw.get_verts(e)}polys(e){return this.raw.get_polys(e)}regs(e){return this.raw.get_regs(e)}flags(e){return this.raw.get_flags(e)}setFlags(e,t){this.raw.set_flags(e,t)}areas(e){return this.raw.get_areas(e)}setAreas(e,t){this.raw.set_areas(e,t)}nverts(){return this.raw.nverts}npolys(){return this.raw.npolys}maxpolys(){return this.raw.maxpolys}nvp(){return this.raw.nvp}bmin(){return m.fromArray(v(e=>this.raw.get_bmin(e),3))}bmax(){return m.fromArray(v(e=>this.raw.get_bmax(e),3))}cs(){return this.raw.cs}ch(){return this.raw.ch}borderSize(){return this.raw.borderSize}maxEdgeError(){return this.raw.maxEdgeError}}class yt{constructor(e){this.raw=e}meshes(e){return this.raw.get_meshes(e)}verts(e){return this.raw.get_verts(e)}tris(e){return this.raw.get_tris(e)}nmeshes(){return this.raw.nmeshes}nverts(){return this.raw.nverts}ntris(){return this.raw.ntris}}const Re=(a,e,t)=>s.Recast.calcGridSize(a,e,t),Te=(a,e,t,r,i,o,l,n)=>s.Recast.createHeightfield(a.raw,e.raw,t,r,i,o,l,n),me=(a,e,t,r,i,o,l)=>s.Recast.markWalkableTriangles(a.raw,e,t.raw,r,i.raw,o,l.raw),ye=(a,e,t,r,i,o,l,n=1)=>s.Recast.rasterizeTriangles(a.raw,e.raw,t,r.raw,i.raw,o,l.raw,n),Ae=(a,e,t)=>s.Recast.filterLowHangingWalkableObstacles(a.raw,e,t.raw),Me=(a,e,t,r)=>s.Recast.filterLedgeSpans(a.raw,e,t,r.raw),Ee=(a,e,t)=>s.Recast.filterWalkableLowHeightSpans(a.raw,e,t.raw),pe=(a,e,t,r,i)=>s.Recast.buildCompactHeightfield(a.raw,e,t,r.raw,i.raw),Ce=(a,e,t)=>s.Recast.erodeWalkableArea(a.raw,e,t.raw),Se=(a,e)=>s.Recast.buildDistanceField(a.raw,e.raw),Ie=(a,e,t,r,i)=>s.Recast.buildRegions(a.raw,e.raw,t,r,i),De=(a,e,t,r,i,o=g.RC_CONTOUR_TESS_WALL_EDGES)=>s.Recast.buildContours(a.raw,e.raw,t,r,i.raw,o),be=(a,e,t,r)=>s.Recast.buildPolyMesh(a.raw,e.raw,t,r.raw),Pe=(a,e,t,r,i,o)=>s.Recast.buildPolyMeshDetail(a.raw,e.raw,t.raw,r,i,o.raw),xe=()=>new wt(s.Recast.allocHeightfield()),X=a=>s.Recast.freeHeightfield(a.raw),ve=()=>new ft(s.Recast.allocCompactHeightfield()),$=a=>s.Recast.freeCompactHeightfield(a.raw),Ne=()=>new Tt(s.Recast.allocContourSet()),q=a=>s.Recast.freeContourSet(a.raw),Oe=()=>new mt(s.Recast.allocPolyMesh()),Le=a=>s.Recast.freePolyMesh(a.raw),Fe=()=>new yt(s.Recast.allocPolyMeshDetail()),He=a=>s.Recast.freePolyMeshDetail(a.raw),At=(a,e)=>{const t=s.NavMeshExporter.exportNavMesh(a.raw,e?.raw),r=new Uint8Array(s.Module.HEAPU8.buffer,t.dataPointer,t.size),i=new Uint8Array(t.size);return i.set(r),s.NavMeshExporter.freeNavMeshExport(t),i},Mt=a=>At(a),Et=a=>{const e=a.length*a.BYTES_PER_ELEMENT,t=s.Module._malloc(e),r=new Uint8Array(s.Module.HEAPU8.buffer,t,e);r.set(a);const i=new s.Module.NavMeshExport;return i.dataPointer=r.byteOffset,i.size=a.length,{navMeshExport:i,dataHeap:r}},pt=a=>{const{navMeshExport:e,dataHeap:t}=Et(a),r=s.NavMeshImporter.importNavMesh(e,void 0);return s.Module._free(t.byteOffset),{navMesh:new te(r.navMesh)}},ze=(a,e)=>{const t={x:1/0,y:1/0,z:1/0},r={x:-1/0,y:-1/0,z:-1/0};for(let i=0;i<e.length;i++){const o=e[i],l=a[o*3],n=a[o*3+1],u=a[o*3+2];t.x=Math.min(t.x,l),t.y=Math.min(t.y,n),t.z=Math.min(t.z,u),r.x=Math.max(r.x,l),r.y=Math.max(r.y,n),r.z=Math.max(r.z,u)}return{bbMin:m.toArray(t),bbMax:m.toArray(r)}},Ct=a=>{let e=0,t=0;return e=+(a>65535)<<4,a>>=e,t=+(a>255)<<3,a>>=t,e|=t,t=+(a>15)<<2,a>>=t,e|=t,t=+(a>3)<<1,a>>=t,e|=t,e|=a>>1,e},St=a=>(a--,a|=a>>1,a|=a>>2,a|=a>>4,a|=a>>8,a|=a>>16,a++,a),It={...re,buildBvTree:!0},Dt=(a,e,t={},r=!1)=>{const i=new se,o={type:"solo",buildContext:i},l=()=>{r||(o.heightfield&&(X(o.heightfield),o.heightfield=void 0),o.compactHeightfield&&($(o.compactHeightfield),o.compactHeightfield=void 0),o.contourSet&&(q(o.contourSet),o.contourSet=void 0),o.polyMesh&&(Le(o.polyMesh),o.polyMesh=void 0),o.polyMeshDetail&&(He(o.polyMeshDetail),o.polyMeshDetail=void 0))},n=T=>(l(),{navMeshData:void 0,success:!1,intermediates:o,error:T}),u=a,d=e.length,_=new ue;_.copy(u);const h=e,y=e.length/3,M=new he;M.copy(h);let p,C;if(t.bounds)p=t.bounds[0],C=t.bounds[1];else{const T=ze(a,e);p=T.bbMin,C=T.bbMax}const I={...It,...t},w=fe(I);w.minRegionArea=w.minRegionArea*w.minRegionArea,w.mergeRegionArea=w.mergeRegionArea*w.mergeRegionArea,w.detailSampleDist=w.detailSampleDist<.9?0:w.cs*w.detailSampleDist,w.detailSampleMaxError=w.ch*w.detailSampleMaxError;const P=Re(p,C,w.cs);w.width=P.width,w.height=P.height;const A=xe();if(o.heightfield=A,!Te(i,A,w.width,w.height,p,C,w.cs,w.ch))return n("Could not create heightfield");const E=new Z;if(E.resize(y),me(i,w.walkableSlopeAngle,_,d,M,y,E),!ye(i,_,d,M,E,y,A,w.walkableClimb))return n("Could not rasterize triangles");E.destroy(),_.destroy(),M.destroy(),Ae(i,w.walkableClimb,A),Me(i,w.walkableHeight,w.walkableClimb,A),Ee(i,w.walkableHeight,A);const D=ve();if(o.compactHeightfield=D,!pe(i,w.walkableHeight,w.walkableClimb,A,D))return n("Failed to build compact data");if(r||(X(A),o.heightfield=void 0),!Ce(i,w.walkableRadius,D))return n("Failed to erode walkable area");if(!Se(i,D))return n("Failed to build distance field");if(!Ie(i,D,w.borderSize,w.minRegionArea,w.mergeRegionArea))return n("Failed to build regions");const b=Ne();if(o.contourSet=b,!De(i,D,w.maxSimplificationError,w.maxEdgeLen,b,g.RC_CONTOUR_TESS_WALL_EDGES))return n("Failed to create contours");const S=Oe();if(o.polyMesh=S,!be(i,b,w.maxVertsPerPoly,S))return n("Failed to triangulate contours");const N=Fe();if(o.polyMeshDetail=N,!Pe(i,S,D,w.detailSampleDist,w.detailSampleMaxError,N))return n("Failed to build detail mesh");r||($(D),o.compactHeightfield=void 0,q(b),o.contourSet=void 0);for(let T=0;T<S.npolys();T++)S.areas(T)===g.RC_WALKABLE_AREA&&S.setAreas(T,0),S.areas(T)===0&&S.setFlags(T,1);const c=new we;c.setPolyMeshCreateParams(S),c.setPolyMeshDetailCreateParams(N),c.setWalkableHeight(w.walkableHeight*w.ch),c.setWalkableRadius(w.walkableRadius*w.cs),c.setWalkableClimb(w.walkableClimb*w.ch),c.setCellSize(w.cs),c.setCellHeight(w.ch),c.setBuildBvTree(I.buildBvTree),t.offMeshConnections&&c.setOffMeshConnections(t.offMeshConnections);const R=de(c);return R.success?(l(),{navMeshData:R.navMeshData,success:!0,intermediates:o}):n("Failed to create Detour navmesh data")},bt=(a,e,t={},r=!1)=>{if(!s.Module)throw new Error('"init" must be called before using any recast-navigation-js APIs. See: https://github.com/isaac-mason/recast-navigation-js?tab=readme-ov-file#initialization');const i=Dt(a,e,t,r);if(!i.success)return{navMesh:void 0,success:!1,intermediates:i.intermediates,error:i.error};const{navMeshData:o}=i,l=new te;return l.initSolo(o)?{success:!0,navMesh:l,intermediates:i.intermediates}:(o.destroy(),{navMesh:void 0,success:!1,intermediates:i.intermediates,error:"Failed to initialize solo NavMesh"})},Pt=({recastConfig:a,navMeshBounds:[e,t]})=>{const r=fe(a),i=Re(e,t,r.cs);r.width=i.width,r.height=i.height,r.minRegionArea=r.minRegionArea*r.minRegionArea,r.mergeRegionArea=r.mergeRegionArea*r.mergeRegionArea,r.tileSize=Math.floor(r.tileSize),r.borderSize=r.walkableRadius+3,r.width=r.tileSize+r.borderSize*2,r.height=r.tileSize+r.borderSize*2,r.detailSampleDist=r.detailSampleDist<.9?0:r.cs*r.detailSampleDist,r.detailSampleMaxError=r.ch*r.detailSampleMaxError;const o=Math.floor(r.tileSize),l=Math.floor((i.width+o-1)/o),n=Math.floor((i.height+o-1)/o),u=r.tileSize*r.cs,d=m.fromArray(e);let _=Math.min(Math.floor(Ct(St(l*n))),14);_>14&&(_=14);const h=22-_,y=1<<_,M=1<<h;return{config:r,gridSize:i,tileSize:o,tileWidth:l,tileHeight:n,tcs:u,orig:d,maxTiles:y,maxPolysPerTile:M}},Be={...re,chunkyTriMeshTrisPerChunk:256,buildBvTree:!0},xt=(a,e,t,r,i,o={},l=!1,n=new se)=>{const u={x:i.x,y:i.y},d=()=>{l||(u.compactHeightfield&&($(u.compactHeightfield),u.compactHeightfield=void 0),u.heightfield&&(X(u.heightfield),u.heightfield=void 0),u.contourSet&&(q(u.contourSet),u.contourSet=void 0),u.polyMesh&&(Le(u.polyMesh),u.polyMesh=void 0),u.polyMeshDetail&&(He(u.polyMeshDetail),u.polyMeshDetail=void 0))},_=T=>(n.log(g.RC_LOG_ERROR,T),d(),{success:!1,error:T,intermediates:u}),h=ct(t),y=[...i.bmin],M=[...i.bmax];y[0]-=h.borderSize*h.cs,y[2]-=h.borderSize*h.cs,M[0]+=h.borderSize*h.cs,M[2]+=h.borderSize*h.cs,h.set_bmin(0,y[0]),h.set_bmin(1,y[1]),h.set_bmin(2,y[2]),h.set_bmax(0,M[0]),h.set_bmax(1,M[1]),h.set_bmax(2,M[2]),n.resetTimers(),n.startTimer(g.RC_TIMER_TOTAL),n.log(g.RC_LOG_PROGRESS,`Building tile at x: ${i.x}, y: ${i.y}`),n.log(g.RC_LOG_PROGRESS,` - ${h.width} x ${h.height} cells`),n.log(g.RC_LOG_PROGRESS,` - ${a.size/3/1e3}K verts, ${e.size/3/1e3}K tris`);const p=xe();if(u.heightfield=p,!Te(n,p,h.width,h.height,y,M,h.cs,h.ch))return _("Could not create heightfield");new Z().resize(r.maxTrisPerChunk());const I=[y[0],y[2]],w=[M[0],M[2]],P=512,A=new je;A.resize(P);const E=r.getChunksOverlappingRect(I,w,A,P);if(E===0)return{success:!0,intermediates:u};for(let T=0;T<E;++T){const x=A.get(T),H=r.nodes(x).n,U=r.getNodeTris(x),F=new Z;F.resize(H),me(n,h.walkableSlopeAngle,a,e.size,U,H,F);const G=ye(n,a,e.size,U,F,H,p,h.walkableClimb);if(F.destroy(),!G)return _("Could not rasterize triangles")}Ae(n,h.walkableClimb,p),Me(n,h.walkableHeight,h.walkableClimb,p),Ee(n,h.walkableHeight,p);const D=ve();if(u.compactHeightfield=D,!pe(n,h.walkableHeight,h.walkableClimb,p,D))return _("Could not build compact heightfield");if(l||(X(u.heightfield),u.heightfield=void 0),!Ce(n,h.walkableRadius,D))return _("Could not erode walkable area");if(!Se(n,D))return _("Failed to build distance field");if(!Ie(n,D,h.borderSize,h.minRegionArea,h.mergeRegionArea))return _("Failed to build regions");const b=Ne();if(u.contourSet=b,!De(n,D,h.maxSimplificationError,h.maxEdgeLen,b,g.RC_CONTOUR_TESS_WALL_EDGES))return _("Failed to create contours");const S=Oe();if(u.polyMesh=S,!be(n,b,h.maxVertsPerPoly,S))return _("Failed to triangulate contours");const N=Fe();if(u.polyMeshDetail=N,!Pe(n,S,D,h.detailSampleDist,h.detailSampleMaxError,N))return _("Failed to build detail mesh");l||($(D),u.compactHeightfield=void 0,q(b),u.contourSet=void 0);for(let T=0;T<S.npolys();T++)S.areas(T)===g.RC_WALKABLE_AREA&&S.setAreas(T,0),S.areas(T)===0&&S.setFlags(T,1);const c=new we;c.setPolyMeshCreateParams(S),c.setPolyMeshDetailCreateParams(N),c.setWalkableHeight(h.walkableHeight*h.ch),c.setWalkableRadius(h.walkableRadius*h.cs),c.setWalkableClimb(h.walkableClimb*h.ch),c.setCellSize(h.cs),c.setCellHeight(h.ch),c.setBuildBvTree(o.buildBvTree??Be.buildBvTree),o.offMeshConnections&&c.setOffMeshConnections(o.offMeshConnections),c.setTileX(i.x),c.setTileY(i.y);const R=de(c);return R.success?(n.log(g.RC_LOG_PROGRESS,`>> Polymesh: ${S.nverts()} vertices ${S.npolys()} polygons`),{success:!0,data:R.navMeshData,intermediates:u}):_("Failed to create Detour navmesh data")},vt=(a,e,t={},r=!1)=>{if(!s.Module)throw new Error('"init" must be called before using any recast-navigation-js APIs. See: https://github.com/isaac-mason/recast-navigation-js?tab=readme-ov-file#initialization');const i=new se,o={type:"tiled",buildContext:i,chunkyTriMesh:void 0,tileIntermediates:[]},l=new te,n=a,u=new ue;u.copy(n);const d=e,_=e.length/3,h=new he;h.copy(d);const y=()=>{u.destroy(),h.destroy(),!r&&o.chunkyTriMesh&&(o.chunkyTriMesh=void 0)},M=x=>(y(),l.destroy(),{success:!1,navMesh:void 0,intermediates:o,error:x}),p={...Be,...t};let C,I;if(t.bounds)C=t.bounds[0],I=t.bounds[1];else{const x=ze(a,e);C=x.bbMin,I=x.bbMax}const{config:w,tileWidth:P,tileHeight:A,tcs:E,orig:D,maxTiles:b,maxPolysPerTile:S}=Pt({recastConfig:p,navMeshBounds:[C,I]}),N=Q.create({orig:D,tileWidth:p.tileSize*p.cs,tileHeight:p.tileSize*p.cs,maxTiles:b,maxPolys:S});if(!l.initTiled(N))return M("Could not init nav mesh for tiled use");const c=new dt;if(o.chunkyTriMesh=c,!c.init(u,h,_,p.chunkyTriMeshTrisPerChunk))return M("Failed to build chunky triangle mesh");i.startTimer(g.RC_TIMER_TEMP);const R=[0,0,0],T=[0,0,0];for(let x=0;x<A;x++)for(let O=0;O<P;O++){R[0]=C[0]+O*E,R[1]=C[1],R[2]=C[2]+x*E,T[0]=C[0]+(O+1)*E,T[1]=I[1],T[2]=C[2]+(x+1)*E;const H={x:O,y:x,bmin:R,bmax:T},U={offMeshConnections:p.offMeshConnections,buildBvTree:p.buildBvTree},F=xt(u,h,w,c,H,U,r,i);if(o.tileIntermediates.push(F.intermediates),F.success&&F.data){l.removeTile(l.getTileRefAt(O,x,0));const G=l.addTile(F.data,f.DT_TILE_FREE_DATA,0);Ze(G.status)&&(i.log(g.RC_LOG_WARNING,`Failed to add tile to nav mesh tx: ${O}, ty: ${x}, status: ${Je(G.status)} (${G.status})`),F.data.destroy())}}return i.stopTimer(g.RC_TIMER_TEMP),r||y(),{success:!0,navMesh:l,intermediates:o}},Nt=a=>{const e=[],t=[],r={};let i=0;for(const{positions:o,indices:l}of a)for(let n=0;n<l.length;n++){const u=l[n]*3,d=o[u],_=o[u+1],h=o[u+2],y=`${d}_${_}_${h}`;let M=r[y];M||(r[y]=M=i,e.push(d,_,h),i++),t.push(M)}return[Float32Array.from(e),Uint32Array.from(t)]};new Qe;class Ot extends ke{constructor(e,t){super(),this.navMesh=e,this.navMeshGeometry=new Ve,this.navMeshMaterial=t?.navMeshMaterial?t.navMeshMaterial:new We({color:"orange",transparent:!0,opacity:.7,depthWrite:!1}),this.update(),this.mesh=new j(this.navMeshGeometry,this.navMeshMaterial),this.add(this.mesh)}update(){const[e,t]=ht(this.navMesh);this.navMeshGeometry.setAttribute("position",new ie(Float32Array.from(e),3)),this.navMeshGeometry.setIndex(new ie(Uint32Array.from(t),1)),this.navMeshGeometry.computeVertexNormals()}}const Lt=new Ye,Ue=a=>{const e=[];for(const t of a){const r=t.geometry.attributes.position;if(!r||r.itemSize!==3)continue;t.updateMatrixWorld();const i=new Float32Array(r.array);for(let l=0;l<i.length;l+=3){const n=Lt.set(i[l],i[l+1],i[l+2]);t.localToWorld(n),i[l]=n.x,i[l+1]=n.y,i[l+2]=n.z}let o=t.geometry.getIndex()?.array;if(o===void 0){const l=[];for(let n=0;n<r.count;n++)l.push(n);o=l}e.push({positions:i,indices:o})}return Nt(e)},Ft=(a,e={},t=!1)=>{const[r,i]=Ue(a);return bt(r,i,e,t)},Ht=(a,e={},t=!1)=>{const[r,i]=Ue(a);return vt(r,i,e,t)},zt=["invalid","walking","offmesh"];let oe=!1;async function ir(){oe||(await Ke(),oe=!0)}function Bt(a){const e=a.getIndex();if(e===null){const t=a.getAttribute("position").clone();for(let r=0;r+2<t.count;r+=3)for(let i=0;i<t.itemSize;i+=1){const o=t.getComponent(r+1,i);t.setComponent(r+1,i,t.getComponent(r+2,i)),t.setComponent(r+2,i,o)}a.setAttribute("position",t);return}for(let t=0;t+2<e.count;t+=3){const r=e.getX(t+1);e.setX(t+1,e.getX(t+2)),e.setX(t+2,r)}e.needsUpdate=!0}function Ut(a){const e=a.getAttribute("position"),t=a.getIndex(),r=l=>t?.getX(l)??l;let i=0;const o=t?.count??e.count;for(let l=0;l+2<o;l+=3){const n=r(l),u=r(l+1),d=r(l+2),_=e.getX(u)-e.getX(n),h=e.getZ(u)-e.getZ(n),y=e.getX(d)-e.getX(n),M=e.getZ(d)-e.getZ(n);i+=h*y-_*M}return i}function Gt(a){const e=[],t=(l,n)=>{if(n.determinant()<0){const d=l.clone().applyMatrix4(n);return Ut(d)<0&&Bt(d),e.push(d),new j(d)}const u=new j(l);return u.matrixAutoUpdate=!1,u.matrix.copy(n),u.matrixWorldNeedsUpdate=!0,u},r=[],i=new ne,o=new ne;for(const l of a){if(l.updateWorldMatrix(!0,!1),l instanceof Xe){for(let n=0;n<l.count;n+=1)l.getMatrixAt(n,i),o.multiplyMatrices(l.matrixWorld,i),r.push(t(l.geometry,o));continue}r.push(l.matrixWorld.determinant()>=0?l:t(l.geometry,l.matrixWorld))}return{meshes:r,temporaryGeometries:e}}const kt=1297302868,Vt=1,Wt=1145979222,Yt=7;function Qt(a){let e=1;for(;e<a;)e*=2;return e}function Xt(a,e){const t=a.vertices.length,r=a.polygons.length;if(t===0||r===0)throw new Error("NavMeshManager.buildFromPolygons: vertices and polygons must be non-empty");if(t>65535)throw new Error(`NavMeshManager.buildFromPolygons: ${t} vertices exceed Detour's uint16 tile index`);if(a.detailMeshes.length!==r)throw new Error(`NavMeshManager.buildFromPolygons: ${r} polygons require the same number of detail rows`);const i=a.polygons.map(c=>c.vertices.map(()=>0)),o=new Map;let l=0;for(let c=0;c<r;c+=1){const R=a.polygons[c];if(R.vertices.length<3||R.vertices.length>6)throw new Error(`NavMeshManager.buildFromPolygons: polygon ${c} has ${R.vertices.length} vertices; Detour permits 3..6`);l+=R.vertices.length;for(let T=0;T<R.vertices.length;T+=1){const x=R.vertices[T],O=R.vertices[(T+1)%R.vertices.length];if(!Number.isInteger(x)||!Number.isInteger(O)||x<0||O<0||x>=t||O>=t)throw new Error(`NavMeshManager.buildFromPolygons: polygon ${c} references an invalid vertex`);const H=`${x},${O}`;if(o.has(H))throw new Error(`NavMeshManager.buildFromPolygons: directed edge ${H} occurs more than once`);const U=o.get(`${O},${x}`);if(U===void 0)o.set(H,[c,T]);else{const[F,G]=U;i[c][T]=F+1,i[F][G]=c+1}}}for(let c=0;c<r;c+=1){const R=a.detailMeshes[c];if(R.vertexBase<0||R.vertexCount<0||R.vertexBase+R.vertexCount>a.detailVertices.length||R.triangleBase<0||R.triangleCount<0||R.triangleBase+R.triangleCount>a.detailTriangles.length||R.vertexCount>255||R.triangleCount>255)throw new Error(`NavMeshManager.buildFromPolygons: polygon ${c} has an invalid detail row`)}for(const c of a.detailTriangles)if(c.some(R=>!Number.isInteger(R)||R<0||R>255))throw new Error("NavMeshManager.buildFromPolygons: detail triangles must contain uint8 values");const n=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],u=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const c of[...a.vertices,...a.detailVertices])for(let R=0;R<3;R+=1){const T=c[R];if(!Number.isFinite(T))throw new Error("NavMeshManager.buildFromPolygons: every vertex component must be finite");n[R]=Math.min(n[R],T),u[R]=Math.max(u[R],T)}const d=100,_=32,h=12,p=d+t*12+r*_+l*h+r*12+a.detailVertices.length*12+a.detailTriangles.length*4,C=new Uint8Array(48+p),I=new DataView(C.buffer);let w=0;const P=c=>{I.setUint8(w,c),w+=1},A=c=>{I.setUint16(w,c,!0),w+=2},E=c=>{I.setUint32(w,c,!0),w+=4},D=c=>{I.setInt32(w,c,!0),w+=4},b=c=>{I.setFloat32(w,c,!0),w+=4},S=Qt(r);E(kt),E(Vt),E(1);for(const c of n)b(c);b(Math.max(u[0]-n[0],Number.EPSILON)),b(Math.max(u[2]-n[2],Number.EPSILON)),E(1),E(S),E(S),E(p),E(Wt),E(Yt),D(0),D(0),D(0),E(0),E(r),E(t),E(l),E(r),E(a.detailVertices.length),E(a.detailTriangles.length),E(0),E(0),E(r);const N=le.navigation;b(e?.walkableHeight??N.walkableHeight),b(e?.walkableRadius??N.walkableRadius),b(e?.walkableClimb??N.walkableClimb);for(const c of n)b(c);for(const c of u)b(c);b(1/(e?.cellSize??N.cellSize));for(const c of a.vertices)for(const R of c)b(R);for(let c=0;c<r;c+=1){const R=a.polygons[c];E(4294967295);for(let T=0;T<6;T+=1)A(R.vertices[T]??0);for(let T=0;T<6;T+=1)A(i[c]?.[T]??0);A(R.flags??1),P(R.vertices.length),P((R.area??0)&63)}w+=l*h;for(const c of a.detailMeshes)E(c.vertexBase),E(c.triangleBase),P(c.vertexCount),P(c.triangleCount),A(0);for(const c of a.detailVertices)for(const R of c)b(R);for(const c of a.detailTriangles)for(const R of c)P(R);if(w!==C.length)throw new Error(`NavMeshManager.buildFromPolygons: encoded ${w} bytes into a ${C.length}-byte allocation`);return C}class nr{navMesh=null;query=null;crowd=null;helper=null;buildFromMeshes(e,t){const r=le.navigation,i=Gt(e),o=i.meshes.reduce((u,d)=>{const _=d.geometry.getIndex(),h=d.geometry.getAttribute("position").count;return u+Math.floor((_?.count??h)/3)},0),l={cs:t?.cellSize??r.cellSize,ch:t?.cellHeight??r.cellHeight,walkableSlopeAngle:t?.walkableSlopeAngle??r.walkableSlopeAngle,walkableHeight:t?.walkableHeight??r.walkableHeight,walkableClimb:t?.walkableClimb??r.walkableClimb,walkableRadius:t?.walkableRadius??r.walkableRadius,maxEdgeLen:t?.maxEdgeLen??r.maxEdgeLen,maxSimplificationError:t?.maxSimplificationError??r.maxSimplificationError,minRegionArea:t?.minRegionArea??r.minRegionArea,mergeRegionArea:t?.mergeRegionArea??r.mergeRegionArea,maxVertsPerPoly:6,detailSampleDist:6,detailSampleMaxError:1};let n;try{n=t?.tiled===!0||i.meshes.length>256||o>1e4?Ht(i.meshes,{...l,tileSize:t?.tileSize??256}):Ft(i.meshes,l)}finally{for(const u of i.temporaryGeometries)u.dispose()}return!n.success||!n.navMesh?!1:(this.destroyRecast(),this.navMesh=n.navMesh,this.query=new ee(this.navMesh),!0)}buildFromPolygons(e,t){try{return this.loadFromData(Xt(e,t)),!0}catch{return!1}}destroyRecast(){this.helper&&(this.helper.parent?.remove(this.helper),this.helper.dispose?.(),this.helper=null),this.crowd&&(this.crowd.destroy(),this.crowd=null),this.query&&(this.query.destroy(),this.query=null),this.navMesh&&(this.navMesh.destroy(),this.navMesh=null)}hasNavMesh(){return this.navMesh!==null}findPath(e,t){if(!this.query)throw new Error("NavMeshManager.findPath: no navmesh has been built, so no path can be queried. Build one first (buildFromMeshes/importNavMesh) — gate on hasNavMesh() if the caller can run before a bake.");const r=this.query.computePath(e,t);if(!r.success&&r.error)throw new Error(`NavMeshManager.findPath: recast could not complete the query (${r.error.name}${r.error.status===void 0?"":`, status ${r.error.status}`}).`);return r.path}createCrowd(e){if(!this.navMesh)throw new Error("Build navmesh first");return this.crowd=new it(this.navMesh,{maxAgents:e,maxAgentRadius:.6}),this.crowd}updateCrowd(e){this.crowd?.update(e)}getCrowdAgents(){return this.crowd?this.crowd.getAgents().map(e=>{const t=e.interpolatedPosition,r=e.velocity(),i=e.target(),o=zt[e.state()]??"invalid",l=o==="invalid"?[]:e.corners().map(n=>({x:n.x,y:n.y,z:n.z}));return{position:{x:t.x,y:t.y,z:t.z},velocity:{x:r.x,y:r.y,z:r.z},radius:e.radius,height:e.height,state:o,target:{x:i.x,y:i.y,z:i.z},corners:l}}):[]}getDebugMesh(e){return this.navMesh?(this.helper||(this.helper=new Ot(this.navMesh),e.add(this.helper)),this.helper):null}exportData(){if(!this.navMesh)throw new Error("No navmesh to export");return Mt(this.navMesh)}loadFromData(e){const{navMesh:t}=pt(e);this.destroyRecast(),this.navMesh=t,this.query=new ee(this.navMesh)}dispose(e){this.helper&&e.remove(this.helper),this.destroyRecast()}}export{nr as NavMeshManager,ir as initNavigation};
|
|
1
|
+
import{_ as Ge}from"./index-Ckxb31Yz.js";import{O as ke,ax as Ve,x as We,M as j,ay as ie,V as Ye,v as Qe,a as ne,bp as Xe}from"./three.module-IFn-4i31.js";import{DEFAULTS as le}from"./defaults-DKiBJCPN.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";const $e=["Recast","Detour","DetourNavMeshBuilder","DetourTileCacheBuilder","NavMeshImporter","NavMeshExporter","CrowdUtils","ChunkyTriMeshUtils","RecastDebugDraw","DetourDebugDraw"],qe=["rcConfig","rcContext","dtNavMeshParams","dtNavMeshCreateParams","RecastLinearAllocator","RecastFastLZCompressor","rcChunkyTriMesh","dtTileCacheParams","dtTileCacheLayerHeader","Vec3","BoolRef","IntRef","UnsignedIntRef","UnsignedCharRef","UnsignedShortRef","FloatRef","IntArray","UnsignedIntArray","UnsignedCharArray","UnsignedShortArray","FloatArray"],s={isNull:a=>s.Module.getPointer(a)===0,destroy:a=>{s.Module.destroy(a)}},g={},f={},Ke=async a=>{if(s.Module===void 0){{const e=(await Ge(async()=>{const{default:t}=await import("./recast-navigation.wasm-compat-Dsoa_MD-.js");return{default:t}},[])).default;s.Module=await e()}for(const e of $e)s[e]=new s.Module[e];for(const e of qe)s[e]=s.Module[e];g.RC_BORDER_REG=s.Recast.BORDER_REG,g.RC_MULTIPLE_REGS=s.Recast.MULTIPLE_REGS,g.RC_BORDER_VERTEX=s.Recast.BORDER_VERTEX,g.RC_AREA_BORDER=s.Recast.AREA_BORDER,g.RC_CONTOUR_REG_MASK=s.Recast.CONTOUR_REG_MASK,g.RC_MESH_NULL_IDX=s.Recast.MESH_NULL_IDX,g.RC_NULL_AREA=s.Recast.NULL_AREA,g.RC_WALKABLE_AREA=s.Recast.WALKABLE_AREA,g.RC_NOT_CONNECTED=s.Recast.NOT_CONNECTED,g.RC_CONTOUR_TESS_WALL_EDGES=s.Module.RC_CONTOUR_TESS_WALL_EDGES,g.RC_CONTOUR_TESS_AREA_EDGES=s.Module.RC_CONTOUR_TESS_AREA_EDGES,g.RC_LOG_PROGRESS=s.Module.RC_LOG_PROGRESS,g.RC_LOG_WARNING=s.Module.RC_LOG_WARNING,g.RC_LOG_ERROR=s.Module.RC_LOG_ERROR,g.RC_TIMER_TOTAL=s.Module.RC_TIMER_TOTAL,g.RC_TIMER_TEMP=s.Module.RC_TIMER_TEMP,g.RC_TIMER_RASTERIZE_TRIANGLES=s.Module.RC_TIMER_RASTERIZE_TRIANGLES,g.RC_TIMER_BUILD_COMPACTHEIGHTFIELD=s.Module.RC_TIMER_BUILD_COMPACTHEIGHTFIELD,g.RC_TIMER_BUILD_CONTOURS=s.Module.RC_TIMER_BUILD_CONTOURS,g.RC_TIMER_BUILD_CONTOURS_TRACE=s.Module.RC_TIMER_BUILD_CONTOURS_TRACE,g.RC_TIMER_BUILD_CONTOURS_SIMPLIFY=s.Module.RC_TIMER_BUILD_CONTOURS_SIMPLIFY,g.RC_TIMER_FILTER_BORDER=s.Module.RC_TIMER_FILTER_BORDER,g.RC_TIMER_FILTER_WALKABLE=s.Module.RC_TIMER_FILTER_WALKABLE,g.RC_TIMER_MEDIAN_AREA=s.Module.RC_TIMER_MEDIAN_AREA,g.RC_TIMER_FILTER_LOW_OBSTACLES=s.Module.RC_TIMER_FILTER_LOW_OBSTACLES,g.RC_TIMER_BUILD_POLYMESH=s.Module.RC_TIMER_BUILD_POLYMESH,g.RC_TIMER_MERGE_POLYMESH=s.Module.RC_TIMER_MERGE_POLYMESH,g.RC_TIMER_ERODE_AREA=s.Module.RC_TIMER_ERODE_AREA,g.RC_TIMER_MARK_BOX_AREA=s.Module.RC_TIMER_MARK_BOX_AREA,g.RC_TIMER_MARK_CYLINDER_AREA=s.Module.RC_TIMER_MARK_CYLINDER_AREA,g.RC_TIMER_MARK_CONVEXPOLY_AREA=s.Module.RC_TIMER_MARK_CONVEXPOLY_AREA,g.RC_TIMER_BUILD_DISTANCEFIELD=s.Module.RC_TIMER_BUILD_DISTANCEFIELD,g.RC_TIMER_BUILD_DISTANCEFIELD_DIST=s.Module.RC_TIMER_BUILD_DISTANCEFIELD_DIST,g.RC_TIMER_BUILD_DISTANCEFIELD_BLUR=s.Module.RC_TIMER_BUILD_DISTANCEFIELD_BLUR,g.RC_TIMER_BUILD_REGIONS=s.Module.RC_TIMER_BUILD_REGIONS,g.RC_TIMER_BUILD_REGIONS_WATERSHED=s.Module.RC_TIMER_BUILD_REGIONS_WATERSHED,g.RC_TIMER_BUILD_REGIONS_EXPAND=s.Module.RC_TIMER_BUILD_REGIONS_EXPAND,g.RC_TIMER_BUILD_REGIONS_FLOOD=s.Module.RC_TIMER_BUILD_REGIONS_FLOOD,g.RC_TIMER_BUILD_REGIONS_FILTER=s.Module.RC_TIMER_BUILD_REGIONS_FILTER,g.RC_TIMER_BUILD_LAYERS=s.Module.RC_TIMER_BUILD_LAYERS,g.RC_TIMER_BUILD_POLYMESHDETAIL=s.Module.RC_TIMER_BUILD_POLYMESHDETAIL,g.RC_TIMER_MERGE_POLYMESHDETAIL=s.Module.RC_TIMER_MERGE_POLYMESHDETAIL,g.RC_MAX_TIMERS=s.Module.RC_MAX_TIMERS,f.DT_FAILURE=s.Detour.FAILURE,f.DT_SUCCESS=s.Detour.SUCCESS,f.DT_IN_PROGRESS=s.Detour.IN_PROGRESS,f.DT_STATUS_DETAIL_MASK=s.Detour.STATUS_DETAIL_MASK,f.DT_WRONG_MAGIC=s.Detour.WRONG_MAGIC,f.DT_WRONG_VERSION=s.Detour.WRONG_VERSION,f.DT_OUT_OF_MEMORY=s.Detour.OUT_OF_MEMORY,f.DT_INVALID_PARAM=s.Detour.INVALID_PARAM,f.DT_BUFFER_TOO_SMALL=s.Detour.BUFFER_TOO_SMALL,f.DT_OUT_OF_NODES=s.Detour.OUT_OF_NODES,f.DT_PARTIAL_RESULT=s.Detour.PARTIAL_RESULT,f.DT_ALREADY_OCCUPIED=s.Detour.ALREADY_OCCUPIED,f.DT_VERTS_PER_POLYGON=s.Detour.VERTS_PER_POLYGON,f.DT_NAVMESH_MAGIC=s.Detour.NAVMESH_MAGIC,f.DT_NAVMESH_VERSION=s.Detour.NAVMESH_VERSION,f.DT_NAVMESH_STATE_MAGIC=s.Detour.NAVMESH_STATE_MAGIC,f.DT_NAVMESH_STATE_VERSION=s.Detour.NAVMESH_STATE_VERSION,f.DT_TILECACHE_MAGIC=s.Detour.TILECACHE_MAGIC,f.DT_TILECACHE_VERSION=s.Detour.TILECACHE_VERSION,f.DT_TILECACHE_NULL_AREA=s.Detour.TILECACHE_NULL_AREA,f.DT_TILECACHE_WALKABLE_AREA=s.Detour.TILECACHE_WALKABLE_AREA,f.DT_TILECACHE_NULL_IDX=s.Detour.TILECACHE_NULL_IDX,f.DT_NULL_LINK=s.Detour.NULL_LINK,f.DT_NULL_LINK=s.Detour.NULL_LINK,f.DT_EXT_LINK=s.Detour.EXT_LINK,f.DT_OFFMESH_CON_BIDIR=s.Detour.OFFMESH_CON_BIDIR,f.DT_STRAIGHTPATH_START=s.Module.DT_STRAIGHTPATH_START,f.DT_STRAIGHTPATH_END=s.Module.DT_STRAIGHTPATH_END,f.DT_STRAIGHTPATH_OFFMESH_CONNECTION=s.Module.DT_STRAIGHTPATH_OFFMESH_CONNECTION,f.DT_STRAIGHTPATH_AREA_CROSSINGS=s.Module.DT_STRAIGHTPATH_AREA_CROSSINGS,f.DT_STRAIGHTPATH_ALL_CROSSINGS=s.Module.DT_STRAIGHTPATH_ALL_CROSSINGS,f.DT_FINDPATH_ANY_ANGLE=s.Module.DT_FINDPATH_ANY_ANGLE,f.DT_RAYCAST_USE_COSTS=s.Module.DT_RAYCAST_USE_COSTS,f.DT_CROWDAGENT_STATE_INVALID=s.Module.DT_CROWDAGENT_STATE_INVALID,f.DT_CROWDAGENT_STATE_WALKING=s.Module.DT_CROWDAGENT_STATE_WALKING,f.DT_CROWDAGENT_STATE_OFFMESH=s.Module.DT_CROWDAGENT_STATE_OFFMESH,f.DT_CROWDAGENT_TARGET_NONE=s.Module.DT_CROWDAGENT_TARGET_NONE,f.DT_CROWDAGENT_TARGET_FAILED=s.Module.DT_CROWDAGENT_TARGET_FAILED,f.DT_CROWDAGENT_TARGET_VALID=s.Module.DT_CROWDAGENT_TARGET_VALID,f.DT_CROWDAGENT_TARGET_REQUESTING=s.Module.DT_CROWDAGENT_TARGET_REQUESTING,f.DT_CROWDAGENT_TARGET_WAITING_FOR_QUEUE=s.Module.DT_CROWDAGENT_TARGET_WAITING_FOR_QUEUE,f.DT_CROWDAGENT_TARGET_WAITING_FOR_PATH=s.Module.DT_CROWDAGENT_TARGET_WAITING_FOR_PATH,f.DT_CROWDAGENT_TARGET_VELOCITY=s.Module.DT_CROWDAGENT_TARGET_VELOCITY,f.DT_COMPRESSEDTILE_FREE_DATA=s.Module.DT_COMPRESSEDTILE_FREE_DATA,f.DT_TILE_FREE_DATA=s.Module.DT_TILE_FREE_DATA}};class K{get size(){return this.raw.size}constructor(e){this.raw=e}get(e){return this.raw.get(e)}set(e,t){this.raw.set(e,t)}resize(e){this.raw.resize(e)}copy(e){this.raw.resize(e.length),this.getHeapView().set(e)}destroy(){s.destroy(this.raw)}getHeapView(){const e=this.getHeap();return new this.ArrayConstructor(e.buffer,this.raw.getDataPointer(),this.size)}toTypedArray(){const e=this.getHeapView(),t=new this.ArrayConstructor(new ArrayBuffer(this.size*e.BYTES_PER_ELEMENT),0,this.size);return t.set(e),t}}class W extends K{ArrayConstructor=Int32Array;constructor(e){super(e??new s.Module.IntArray)}getHeap(){return s.Module.HEAP32}static fromRaw(e){return new W(e)}}class z extends K{ArrayConstructor=Uint32Array;constructor(e){super(e??new s.Module.UnsignedIntArray)}getHeap(){return s.Module.HEAPU32}static fromRaw(e){return new z(e)}}class Y extends K{ArrayConstructor=Uint8Array;constructor(e){super(e??new s.Module.UnsignedCharArray)}getHeap(){return s.Module.HEAPU8}static fromRaw(e){return new Y(e)}}class k extends K{ArrayConstructor=Float32Array;constructor(e){super(e??new s.Module.FloatArray)}getHeap(){return s.Module.HEAPF32}static fromRaw(e){return new k(e)}}const ue=k,he=W,Z=Y,je=W,m={toRaw:({x:a,y:e,z:t},r)=>r?(r.x=a,r.y=e,r.z=t,r):new s.Module.Vec3(a,e,t),fromRaw:a=>{const{x:e,y:t,z:r}=a;return{x:e,y:t,z:r}},fromArray:([a,e,t])=>({x:a,y:e,z:t}),toArray:({x:a,y:e,z:t})=>[a,e,t],lerp:(a,e,t,r={x:0,y:0,z:0})=>{r.x=a.x+(e.x-a.x)*t,r.y=a.y+(e.y-a.y)*t,r.z=a.z+(e.z-a.z)*t},copy:(a,e={x:0,y:0,z:0})=>{e.x=a.x,e.y=a.y,e.z=a.z}},v=(a,e)=>{const t=[];for(let r=0;r<e;r++)t.push(a(r));return t},L=a=>s.Detour.statusSucceed(a),Ze=a=>s.Detour.statusFailed(a),Je=a=>{if(s.Detour.statusSucceed(a))return"success";if(s.Detour.statusInProgress(a))return"in progress";if(s.Detour.statusFailed(a)){let e;const t={DT_WRONG_MAGIC:f.DT_WRONG_MAGIC,DT_WRONG_VERSION:f.DT_WRONG_VERSION,DT_OUT_OF_MEMORY:f.DT_OUT_OF_MEMORY,DT_INVALID_PARAM:f.DT_INVALID_PARAM,DT_BUFFER_TOO_SMALL:f.DT_BUFFER_TOO_SMALL,DT_OUT_OF_NODES:f.DT_OUT_OF_NODES,DT_PARTIAL_RESULT:f.DT_PARTIAL_RESULT,DT_ALREADY_OCCUPIED:f.DT_ALREADY_OCCUPIED};for(const[r,i]of Object.entries(t))if(s.Detour.statusDetail(a,i)){e=r;break}return e?`failed - ${e}`:"failed - unknown"}return"unknown"};class et{constructor(e){this.raw=e}vertBase(){return this.raw.vertBase}triBase(){return this.raw.triBase}vertCount(){return this.raw.vertCount}triCount(){return this.raw.triCount}}class tt{constructor(e){this.raw=e}ref(){return this.raw.ref}next(){return this.raw.next}edge(){return this.raw.edge}side(){return this.raw.side}bmin(){return this.raw.bmin}bmax(){return this.raw.bmax}}class rt{constructor(e){this.raw=e}bmin(){return m.fromArray(v(e=>this.raw.get_bmin(e),3))}bmax(){return m.fromArray(v(e=>this.raw.get_bmax(e),3))}i(){return this.raw.i}}class ce{constructor(e){this.raw=e}pos(e){return this.raw.get_pos(e)}rad(){return this.raw.rad}poly(){return this.raw.poly}flags(){return this.raw.flags}side(){return this.raw.side}userId(){return this.raw.userId}}class st{constructor(e){this.raw=e}magic(){return this.raw.magic}version(){return this.raw.version}x(){return this.raw.x}y(){return this.raw.y}layer(){return this.raw.layer}userId(){return this.raw.userId}polyCount(){return this.raw.polyCount}vertCount(){return this.raw.vertCount}maxLinkCount(){return this.raw.maxLinkCount}detailMeshCount(){return this.raw.detailMeshCount}detailVertCount(){return this.raw.detailVertCount}detailTriCount(){return this.raw.detailTriCount}bvNodeCount(){return this.raw.bvNodeCount}offMeshConCount(){return this.raw.offMeshConCount}offMeshBase(){return this.raw.offMeshBase}walkableHeight(){return this.raw.walkableHeight}walkableRadius(){return this.raw.walkableRadius}walkableClimb(){return this.raw.walkableClimb}bmin(e){return this.raw.get_bmin(e)}bmax(e){return this.raw.get_bmax(e)}bvQuantFactor(){return this.raw.bvQuantFactor}}class J{constructor(e){this.raw=e}firstLink(){return this.raw.firstLink}verts(e){return this.raw.get_verts(e)}neis(e){return this.raw.get_neis(e)}flags(){return this.raw.flags}vertCount(){return this.raw.vertCount}areaAndType(){return this.raw.get_areaAndtype()}getType(){return this.raw.getType()}}class B{constructor(e){this.raw=e}salt(){return this.raw.salt}linksFreeList(){return this.raw.linksFreeList}header(){return s.isNull(this.raw.header)?null:new st(this.raw.header)}polys(e){return new J(this.raw.get_polys(e))}verts(e){return this.raw.get_verts(e)}links(e){return new tt(this.raw.get_links(e))}detailMeshes(e){return new et(this.raw.get_detailMeshes(e))}detailVerts(e){return this.raw.get_detailVerts(e)}detailTris(e){return this.raw.get_detailTris(e)}bvTree(e){return new rt(this.raw.get_bvTree(e))}offMeshCons(e){return new ce(this.raw.get_offMeshCons(e))}data(e){return this.raw.get_data(e)}dataSize(){return this.raw.dataSize}flags(){return this.raw.flags}next(){return new B(this.raw.next)}}const de=a=>{const e=s.DetourNavMeshBuilder.createNavMeshData(a.raw);return{success:e.success,navMeshData:Y.fromRaw(e.navMeshData)}};class we{constructor(e){this.raw=e??new s.Module.dtNavMeshCreateParams}setPolyMeshCreateParams(e){s.DetourNavMeshBuilder.setPolyMeshCreateParams(this.raw,e.raw)}setPolyMeshDetailCreateParams(e){s.DetourNavMeshBuilder.setPolyMeshDetailCreateParams(this.raw,e.raw)}setOffMeshConnections(e){if(e.length<=0)return;const t=[],r=[],i=[],o=[],l=[],n=[];for(let u=0;u<e.length;u++){const d=e[u];t.push(d.startPosition.x,d.startPosition.y,d.startPosition.z),t.push(d.endPosition.x,d.endPosition.y,d.endPosition.z),r.push(d.radius),i.push(d.bidirectional?1:0),o.push(d.area??0),l.push(d.flags??1),n.push(d.userId??1e3+u)}s.DetourNavMeshBuilder.setOffMeshConnections(this.raw,e.length,t,r,i,o,l,n)}verts(e){return this.raw.get_verts(e)}setVerts(e,t){this.raw.set_verts(e,t)}vertCount(){return this.raw.vertCount}polys(e){return this.raw.get_polys(e)}setPolys(e,t){this.raw.set_polys(e,t)}polyAreas(e){return this.raw.get_polyAreas(e)}setPolyAreas(e,t){this.raw.set_polyAreas(e,t)}polyFlags(e){return this.raw.get_polyFlags(e)}setPolyFlags(e,t){this.raw.set_polyFlags(e,t)}polyCount(){return this.raw.polyCount}nvp(){return this.raw.nvp}setNvp(e){this.raw.nvp=e}detailMeshes(e){return this.raw.get_detailMeshes(e)}setDetailMeshes(e,t){this.raw.set_detailMeshes(e,t)}detailVerts(e){return this.raw.get_detailVerts(e)}setDetailVerts(e,t){this.raw.set_detailVerts(e,t)}detailVertsCount(){return this.raw.detailVertsCount}detailTris(e){return this.raw.get_detailTris(e)}setDetailTris(e,t){this.raw.set_detailTris(e,t)}detailTriCount(){return this.raw.detailTriCount}offMeshConVerts(e){return this.raw.get_offMeshConVerts(e)}offMeshConRad(e){return this.raw.get_offMeshConRad(e)}offMeshConDir(e){return this.raw.get_offMeshConDir(e)}offMeshConAreas(e){return this.raw.get_offMeshConAreas(e)}offMeshConFlags(e){return this.raw.get_offMeshConFlags(e)}offMeshConUserID(e){return this.raw.get_offMeshConUserID(e)}offMeshConCount(){return this.raw.offMeshConCount}userId(){return this.raw.userId}tileX(){return this.raw.tileX}setTileX(e){this.raw.tileX=e}tileY(){return this.raw.tileY}setTileY(e){this.raw.tileY=e}tileLayer(){return this.raw.tileLayer}setTileLayer(e){this.raw.tileLayer=e}boundsMin(){return v(e=>this.raw.get_bmin(e),3)}setBoundsMin(e){this.raw.set_bmin(0,e[0]),this.raw.set_bmin(1,e[1]),this.raw.set_bmin(2,e[2])}boundsMax(){return v(e=>this.raw.get_bmax(e),3)}setBoundsMax(e){this.raw.set_bmax(0,e[0]),this.raw.set_bmax(1,e[1]),this.raw.set_bmax(2,e[2])}walkableHeight(){return this.raw.walkableHeight}setWalkableHeight(e){this.raw.walkableHeight=e}walkableRadius(){return this.raw.walkableRadius}setWalkableRadius(e){this.raw.walkableRadius=e}walkableClimb(){return this.raw.walkableClimb}setWalkableClimb(e){this.raw.walkableClimb=e}cellSize(){return this.raw.cs}setCellSize(e){this.raw.cs=e}cellHeight(){return this.raw.ch}setCellHeight(e){this.raw.ch=e}buildBvTree(){return this.raw.buildBvTree}setBuildBvTree(e){this.raw.buildBvTree=e}}class ge{get includeFlags(){return this.raw.getIncludeFlags()}set includeFlags(e){this.raw.setIncludeFlags(e)}get excludeFlags(){return this.raw.getExcludeFlags()}set excludeFlags(e){this.raw.setExcludeFlags(e)}constructor(e){this.raw=e??new s.Module.dtQueryFilter}getAreaCost(e){return this.raw.getAreaCost(e)}setAreaCost(e,t){this.raw.setAreaCost(e,t)}}class ee{defaultQueryHalfExtents={x:1,y:1,z:1};constructor(e,t){e instanceof s.Module.NavMeshQuery?this.raw=e:(this.raw=new s.Module.NavMeshQuery,this.raw.init(e.raw,t?.maxNodes??2048)),t?.defaultQueryFilter?this.defaultFilter=t.defaultQueryFilter:(this.defaultFilter=new ge,this.defaultFilter.includeFlags=65535,this.defaultFilter.excludeFlags=0)}findNearestPoly(e,t){const r=new s.UnsignedIntRef,i=new s.Vec3,o=new s.BoolRef,l=this.raw.findNearestPoly(m.toArray(e),m.toArray(t?.halfExtents??this.defaultQueryHalfExtents),t?.filter?.raw??this.defaultFilter.raw,r,i,o),n=m.fromRaw(i);s.destroy(i);const u=r.value;s.destroy(r);const d=o.value;return s.destroy(o),{success:L(l),status:l,nearestRef:u,nearestPoint:n,isOverPoly:d}}findPolysAroundCircle(e,t,r,i){const o=i?.filter??this.defaultFilter,l=i?.maxPolys??256,n=new z,u=new z,d=new k;n.resize(l),u.resize(l),d.resize(l);const _=new s.IntRef,h=this.raw.findPolysAroundCircle(e,m.toArray(t),r,o.raw,n.raw,u.raw,d.raw,_,l),y=[...n.getHeapView()];n.destroy();const M=[...u.getHeapView()];u.destroy();const p=[...d.getHeapView()];d.destroy();const C=_.value;return s.destroy(_),{success:L(h),status:h,resultRefs:y,resultParents:M,resultCost:p,resultCount:C}}queryPolygons(e,t,r){const i=r?.filter??this.defaultFilter,o=r?.maxPolys??256,l=new z;l.resize(o);const n=new s.IntRef,u=this.raw.queryPolygons(m.toArray(e),m.toArray(t),i.raw,l.raw,n,o),d=n.value;s.destroy(n);const _=[...l.getHeapView()].slice(0,d);return l.destroy(),{success:L(u),status:u,polyRefs:_}}closestPointOnPoly(e,t){const r=new s.Vec3,i=new s.BoolRef,o=this.raw.closestPointOnPoly(e,m.toArray(t),r,i),l=m.fromRaw(r);s.destroy(r);const n=i.value;return s.destroy(i),{success:L(o),status:o,closestPoint:l,isPointOverPoly:n}}findClosestPoint(e,t){const r=t?.filter??this.defaultFilter,i=t?.halfExtents??this.defaultQueryHalfExtents,o=new s.UnsignedIntRef,l=new s.Vec3,n=new s.BoolRef,u=this.raw.findClosestPoint(m.toArray(e),m.toArray(i),r.raw,o,l,n),d=o.value;s.destroy(o);const _=m.fromRaw(l);s.destroy(l);const h=n.value;return s.destroy(n),{success:L(u),status:u,polyRef:d,point:_,isPointOverPoly:h}}findRandomPointAroundCircle(e,t,r){const i=r?.filter??this.defaultFilter,o=r?.halfExtents??this.defaultQueryHalfExtents;let l;if(r?.startRef)l=r.startRef;else{const y=this.findNearestPoly(e,{filter:i,halfExtents:o});if(!y.success)return{success:!1,status:y.status,randomPolyRef:0,randomPoint:{x:0,y:0,z:0}};l=y.nearestRef}const n=new s.UnsignedIntRef,u=new s.Vec3,d=this.raw.findRandomPointAroundCircle(l,m.toArray(e),t,i.raw,n,u),_=n.value;s.destroy(n);const h=m.fromRaw(u);return s.destroy(u),{success:L(d),status:d,randomPolyRef:_,randomPoint:h}}moveAlongSurface(e,t,r,i){const o=i?.maxVisitedSize??256,l=new s.Vec3,n=new z,u=i?.filter?.raw??this.defaultFilter.raw,d=this.raw.moveAlongSurface(e,m.toArray(t),m.toArray(r),u,l,n.raw,o),_=m.fromRaw(l);s.destroy(l);const h=[...n.getHeapView()];return n.destroy(),{success:L(d),status:d,resultPosition:_,visited:h}}findRandomPoint(e){const t=new s.UnsignedIntRef,r=new s.Vec3,i=this.raw.findRandomPoint(e?.filter?.raw??this.defaultFilter.raw,t,r),o=t.value;s.destroy(t);const l=m.fromRaw(r);return s.destroy(r),{success:L(i),status:i,randomPolyRef:o,randomPoint:l}}getPolyHeight(e,t){const r=new s.FloatRef,i=this.raw.getPolyHeight(e,m.toArray(t),r),o=r.value;return s.destroy(r),{success:L(i),status:i,height:o}}computePath(e,t,r){const i=r?.filter??this.defaultFilter,o=r?.halfExtents??this.defaultQueryHalfExtents,l=this.findNearestPoly(e,{filter:i,halfExtents:o});if(!l.success)return{success:!1,error:{name:"findNearestPoly for start position failed",status:l.status},path:[]};const n=this.findNearestPoly(t,{filter:i,halfExtents:o});if(!n.success)return{success:!1,error:{name:"findNearestPoly for end position failed",status:n.status},path:[]};const u=l.nearestRef,d=n.nearestRef,_=r?.maxPathPolys??256,h=this.findPath(u,d,e,t,{filter:i,maxPathPolys:_});if(!h.success)return{success:!1,error:{name:"findPath unsuccessful",status:h.status},path:[]};if(h.polys.size<=0)return{success:!1,error:{name:"no polygon path found"},path:[]};const y=h.polys.get(h.polys.size-1);let M={x:t.x,y:t.y,z:t.z};if(y!==d){const A=this.closestPointOnPoly(y,t);if(!A.success)return{success:!1,error:{name:"no closest point on last polygon found",status:A.status},path:[]};M=A.closestPoint}const p=r?.maxStraightPathPoints,C=this.findStraightPath(e,M,h.polys,{maxStraightPathPoints:p});if(!C.success)return{success:!1,error:{name:"findStraightPath unsuccessful",status:C.status},path:[]};const{straightPath:I,straightPathCount:w}=C,P=[];for(let A=0;A<w;A++)P.push({x:I.get(A*3),y:I.get(A*3+1),z:I.get(A*3+2)});return h.polys.destroy(),C.straightPath.destroy(),C.straightPathFlags.destroy(),C.straightPathRefs.destroy(),{success:!0,path:P}}findPath(e,t,r,i,o){const l=o?.filter??this.defaultFilter,n=o?.maxPathPolys??256,u=new z;u.resize(n);const d=this.raw.findPath(e,t,m.toArray(r),m.toArray(i),l.raw,u.raw,n);return{success:L(d),status:d,polys:u}}findStraightPath(e,t,r,i){const o=i?.maxStraightPathPoints??256,l=i?.straightPathOptions??0;let n;Array.isArray(r)?(n=new z,n.copy(r)):n=r;const u=new k;u.resize(o*3);const d=new Y;d.resize(o);const _=new z;_.resize(o);const h=new s.IntRef,y=this.raw.findStraightPath(m.toArray(e),m.toArray(t),n.raw,u.raw,d.raw,_.raw,h,o,l),M=h.value;return s.destroy(h),Array.isArray(r)&&n.destroy(),{success:L(y),status:y,straightPath:u,straightPathFlags:d,straightPathRefs:_,straightPathCount:M}}raycast(e,t,r,i){const o=new s.Module.dtRaycastHit,l=i?.raycastOptions??0,n=i?.prevRef??0,u=i?.filter?.raw??this.defaultFilter.raw,d=this.raw.raycast(e,m.toArray(t),m.toArray(r),u,l,o,n),_={success:L(d),status:d,t:o.t,hitNormal:m.fromArray(v(h=>o.get_hitNormal(h),3)),hitEdgeIndex:o.hitEdgeIndex,path:v(h=>o.get_path(h),o.pathCount),maxPath:o.maxPath,pathCost:o.pathCost};return s.destroy(o),_}destroy(){this.raw.destroy()}}const _e={radius:.5,height:1,maxAcceleration:20,maxSpeed:6,collisionQueryRange:2.5,pathOptimizationRange:0,separationWeight:0,updateFlags:7,obstacleAvoidanceType:0,queryFilterType:0,userData:0};class at{get radius(){return this.raw.params.radius}set radius(e){this.raw.params.radius=e}get height(){return this.raw.params.height}set height(e){this.raw.params.height=e}get maxAcceleration(){return this.raw.params.maxAcceleration}set maxAcceleration(e){this.raw.params.maxAcceleration=e}get maxSpeed(){return this.raw.params.maxSpeed}set maxSpeed(e){this.raw.params.maxSpeed=e}get collisionQueryRange(){return this.raw.params.collisionQueryRange}set collisionQueryRange(e){this.raw.params.collisionQueryRange=e}get pathOptimizationRange(){return this.raw.params.pathOptimizationRange}set pathOptimizationRange(e){this.raw.params.pathOptimizationRange=e}get separationWeight(){return this.raw.params.separationWeight}set separationWeight(e){this.raw.params.separationWeight=e}get updateFlags(){return this.raw.params.updateFlags}set updateFlags(e){this.raw.params.updateFlags=e}get obstacleAvoidanceType(){return this.raw.params.obstacleAvoidanceType}set obstacleAvoidanceType(e){this.raw.params.obstacleAvoidanceType=e}get queryFilterType(){return this.raw.params.queryFilterType}set queryFilterType(e){this.raw.params.queryFilterType=e}get userData(){return this.raw.params.userData}set userData(e){this.raw.params.userData=e}interpolatedPosition={x:0,y:0,z:0};constructor(e,t){this.crowd=e,this.agentIndex=t,this.raw=e.raw.getEditableAgent(t),this.interpolatedPosition=this.position()}requestMoveTarget(e){const{nearestPoint:t,nearestRef:r}=this.crowd.navMeshQuery.findNearestPoly(e,{halfExtents:this.crowd.navMeshQuery.defaultQueryHalfExtents,filter:this.crowd.navMeshQuery.defaultFilter});return this.crowd.raw.requestMoveTarget(this.agentIndex,r,m.toArray(t))}requestMoveVelocity(e){return this.crowd.raw.requestMoveVelocity(this.agentIndex,m.toArray(e))}resetMoveTarget(){this.crowd.raw.resetMoveTarget(this.agentIndex)}teleport(e){s.CrowdUtils.agentTeleport(this.crowd.raw,this.agentIndex,m.toArray(e),m.toArray(this.crowd.navMeshQuery.defaultQueryHalfExtents),this.crowd.navMeshQuery.defaultFilter.raw),m.copy(e,this.interpolatedPosition)}position(){return{x:this.raw.get_npos(0),y:this.raw.get_npos(1),z:this.raw.get_npos(2)}}velocity(){return{x:this.raw.get_vel(0),y:this.raw.get_vel(1),z:this.raw.get_vel(2)}}desiredVelocity(){return{x:this.raw.get_dvel(0),y:this.raw.get_dvel(1),z:this.raw.get_dvel(2)}}desiredVelocityObstacleAdjusted(){return{x:this.raw.get_nvel(0),y:this.raw.get_nvel(1),z:this.raw.get_nvel(2)}}state(){return this.raw.state}target(){return{x:this.raw.get_targetPos(0),y:this.raw.get_targetPos(1),z:this.raw.get_targetPos(2)}}nextTargetInPath(){return{x:this.raw.get_cornerVerts(0),y:this.raw.get_cornerVerts(1),z:this.raw.get_cornerVerts(2)}}corners(){const e=[];for(let t=0;t<this.raw.ncorners;t++)e.push({x:this.raw.get_cornerVerts(t*3),y:this.raw.get_cornerVerts(t*3+1),z:this.raw.get_cornerVerts(t*3+2)});return e}parameters(){const{params:e}=this.raw;return{radius:e.radius,height:e.height,maxAcceleration:e.maxAcceleration,maxSpeed:e.maxSpeed,collisionQueryRange:e.collisionQueryRange,pathOptimizationRange:e.pathOptimizationRange,separationWeight:e.separationWeight,updateFlags:e.updateFlags,obstacleAvoidanceType:e.obstacleAvoidanceType,queryFilterType:e.queryFilterType,userData:e.userData}}updateParameters(e){const t={...this.parameters(),...e};this.setParameters(t)}setParameters(e){const t={..._e,...e},r=new s.Module.dtCrowdAgentParams;r.radius=t.radius,r.height=t.height,r.maxAcceleration=t.maxAcceleration,r.maxSpeed=t.maxSpeed,r.collisionQueryRange=t.collisionQueryRange,r.pathOptimizationRange=t.pathOptimizationRange,r.separationWeight=t.separationWeight,r.updateFlags=t.updateFlags,r.obstacleAvoidanceType=t.obstacleAvoidanceType,r.queryFilterType=t.queryFilterType,r.userData=t.userData,this.crowd.raw.updateAgentParameters(this.agentIndex,r)}overOffMeshConnection(){return s.CrowdUtils.overOffMeshConnection(this.crowd.raw,this.agentIndex)}}class it{agents={};accumulator=0;constructor(e,{maxAgents:t,maxAgentRadius:r}){this.navMesh=e,this.raw=s.Detour.allocCrowd(),this.raw.init(t,r,e.raw.getNavMesh()),this.navMeshQuery=new ee(new s.Module.NavMeshQuery(this.raw.getNavMeshQuery()))}update(e,t,r=10){if(t===void 0)this.raw.update(e,void 0);else{this.accumulator+=t;let i=0;for(;this.accumulator>=e&&i<r;)this.raw.update(e,void 0),this.accumulator-=e,i++;const o=this.accumulator%e/e,l=this.getAgents();for(const n of l)m.lerp(n.interpolatedPosition,n.position(),o,n.interpolatedPosition)}}addAgent(e,t){const r={..._e,...t},i=new s.Module.dtCrowdAgentParams;i.radius=r.radius,i.height=r.height,i.maxAcceleration=r.maxAcceleration,i.maxSpeed=r.maxSpeed,i.collisionQueryRange=r.collisionQueryRange,i.pathOptimizationRange=r.pathOptimizationRange,i.separationWeight=r.separationWeight,i.updateFlags=r.updateFlags,i.obstacleAvoidanceType=r.obstacleAvoidanceType,i.queryFilterType=r.queryFilterType,i.userData=r.userData;const o=this.raw.addAgent(m.toArray(e),i),l=new at(this,o);return this.agents[o]=l,l}getAgent(e){const t=this.agents[e];return t||null}removeAgent(e){const t=typeof e=="number"?e:e.agentIndex;this.raw.removeAgent(t),delete this.agents[t]}getAgentCount(){return this.raw.getAgentCount()}getActiveAgentCount(){return s.CrowdUtils.getActiveAgentCount(this.raw)}getAgents(){return Object.values(this.agents)}getFilter(e){return new ge(this.raw.getEditableFilter(e))}destroy(){s.Detour.freeCrowd(this.raw)}}class nt{constructor(e){this.raw=e}tiles(e){return new B(this.raw.get_tiles(e))}tileCount(){return this.raw.tileCount}}class ot{constructor(e){this.raw=e}data(){return v(e=>this.raw.get_data(e),this.raw.dataSize)}dataSize(){return this.raw.dataSize}}class lt{constructor(e){this.raw=e}tileX(){return this.raw.tileX}tileY(){return this.raw.tileY}}class ut{constructor(e){this.raw=e}data(){return v(e=>this.raw.get_data(e),this.raw.dataSize)}dataSize(){return this.raw.dataSize}}class Q{constructor(e){this.raw=e}static create(e){const t=new s.Module.dtNavMeshParams;return t.set_orig(0,e.orig.x),t.set_orig(1,e.orig.y),t.set_orig(2,e.orig.z),t.tileWidth=e.tileWidth,t.tileHeight=e.tileHeight,t.maxTiles=e.maxTiles,t.maxPolys=e.maxPolys,new Q(t)}clone(){return Q.create({orig:{x:this.raw.get_orig(0),y:this.raw.get_orig(1),z:this.raw.get_orig(2)},tileWidth:this.raw.tileWidth,tileHeight:this.raw.tileHeight,maxTiles:this.raw.maxTiles,maxPolys:this.raw.maxPolys})}}class te{constructor(e){this.raw=e??new s.Module.NavMesh}initSolo(e){return this.raw.initSolo(e.raw)}initTiled(e){return this.raw.initTiled(e.raw)}addTile(e,t,r){const i=new s.UnsignedIntRef,o=this.raw.addTile(e.raw,t,r,i),l=i.value;return s.destroy(i),{status:o,tileRef:l}}decodePolyId(e){const t=new s.UnsignedIntRef,r=new s.UnsignedIntRef,i=new s.UnsignedIntRef;this.raw.decodePolyId(e,t,r,i);const o=t.value;s.destroy(t);const l=r.value;s.destroy(r);const n=i.value;return s.destroy(i),{tileSalt:o,tileIndex:l,tilePolygonIndex:n}}encodePolyId(e,t,r){return this.raw.encodePolyId(e,t,r)}removeTile(e){return new ot(this.raw.removeTile(e))}calcTileLoc(e){return new lt(this.raw.calcTileLoc(m.toArray(e)))}getTileAt(e,t,r){const i=this.raw.getTileAt(e,t,r);return s.isNull(i)?null:new B(i)}getTilesAt(e,t,r){return new nt(this.raw.getTilesAt(e,t,r))}getTileRefAt(e,t,r){return this.raw.getTileRefAt(e,t,r)}getTileRef(e){return this.raw.getTileRef(e.raw)}getTileByRef(e){const t=this.raw.getTileByRef(e);return s.isNull(t)?null:new B(t)}getMaxTiles(){return this.raw.getMaxTiles()}getTile(e){return new B(this.raw.getTile(e))}getTileAndPolyByRef(e){const t=this.raw.getTileAndPolyByRef(e),r=new B(t.tile),i=new J(t.poly);return{success:L(t.status),status:t.status,tile:r,poly:i}}getTileAndPolyByRefUnsafe(e){const t=this.raw.getTileAndPolyByRef(e),r=new B(t.tile),i=new J(t.poly);return{tile:r,poly:i}}isValidPolyRef(e){return this.raw.isValidPolyRef(e)}getPolyRefBase(e){return this.raw.getPolyRefBase(e.raw)}getOffMeshConnectionPolyEndPoints(e,t){const r=new s.Vec3,i=new s.Vec3,o=this.raw.getOffMeshConnectionPolyEndPoints(e,t,r,i),l=m.fromRaw(r);s.destroy(r);const n=m.fromRaw(i);return s.destroy(i),{success:L(o),status:o,start:l,end:n}}getOffMeshConnectionByRef(e){return new ce(this.raw.getOffMeshConnectionByRef(e))}setPolyFlags(e,t){return this.raw.setPolyFlags(e,t)}getPolyFlags(e){const t=new s.UnsignedShortRef,r=this.raw.getPolyFlags(e,t),i=t.value;return s.destroy(t),{status:r,flags:i}}setPolyArea(e,t){return this.raw.setPolyArea(e,t)}getPolyArea(e){const t=new s.UnsignedCharRef,r=this.raw.getPolyArea(e,t),i=t.value;return s.destroy(t),{status:r,area:i}}getTileStateSize(e){return this.raw.getTileStateSize(e.raw)}storeTileState(e,t){return new ut(this.raw.storeTileState(e.raw,t))}restoreTileState(e,t,r){return this.raw.restoreTileState(e.raw,t,r)}destroy(){this.raw.destroy(),s.Module.destroy(this.raw)}}const ht=(a,e)=>{const t=[],r=[];let i=0;const o=a.getMaxTiles();for(let l=0;l<o;l++){const n=a.getTile(l),u=n.header();if(!u)continue;const d=u.polyCount();for(let _=0;_<d;++_){const h=n.polys(_);if(h.getType()===1)continue;const y=h.vertCount(),M=n.detailMeshes(_),p=M.triBase(),C=M.triCount();for(let I=0;I<C;++I){const w=(p+I)*4;for(let P=0;P<3;++P){if(n.detailTris(w+P)<y){const A=h.verts(n.detailTris(w+P))*3;t.push(n.verts(A),n.verts(A+1),n.verts(A+2))}else{const A=(M.vertBase()+n.detailTris(w+P)-h.vertCount())*3;t.push(n.detailVerts(A),n.detailVerts(A+1),n.detailVerts(A+2))}r.push(i++)}}}}return[t,r]},re={borderSize:0,tileSize:0,cs:.2,ch:.2,walkableSlopeAngle:60,walkableHeight:2,walkableClimb:2,walkableRadius:.5,maxEdgeLen:12,maxSimplificationError:1.3,minRegionArea:8,mergeRegionArea:20,maxVertsPerPoly:6,detailSampleDist:6,detailSampleMaxError:1},fe=a=>{const e={...re,...a},t=new s.Module.rcConfig;return t.borderSize=e.borderSize,t.tileSize=e.tileSize,t.cs=e.cs,t.ch=e.ch,t.walkableSlopeAngle=e.walkableSlopeAngle,t.walkableHeight=e.walkableHeight,t.walkableClimb=e.walkableClimb,t.walkableRadius=e.walkableRadius,t.maxEdgeLen=e.maxEdgeLen,t.maxSimplificationError=e.maxSimplificationError,t.minRegionArea=e.minRegionArea,t.mergeRegionArea=e.mergeRegionArea,t.maxVertsPerPoly=e.maxVertsPerPoly,t.detailSampleDist=e.detailSampleDist,t.detailSampleMaxError=e.detailSampleMaxError,t},ct=a=>{const e=new s.Module.rcConfig;return e.set_bmin(0,a.get_bmin(0)),e.set_bmin(1,a.get_bmin(1)),e.set_bmin(2,a.get_bmin(2)),e.set_bmax(0,a.get_bmax(0)),e.set_bmax(1,a.get_bmax(1)),e.set_bmax(2,a.get_bmax(2)),e.width=a.width,e.height=a.height,e.borderSize=a.borderSize,e.tileSize=a.tileSize,e.cs=a.cs,e.ch=a.ch,e.walkableSlopeAngle=a.walkableSlopeAngle,e.walkableHeight=a.walkableHeight,e.walkableClimb=a.walkableClimb,e.walkableRadius=a.walkableRadius,e.maxEdgeLen=a.maxEdgeLen,e.maxSimplificationError=a.maxSimplificationError,e.minRegionArea=a.minRegionArea,e.mergeRegionArea=a.mergeRegionArea,e.maxVertsPerPoly=a.maxVertsPerPoly,e.detailSampleDist=a.detailSampleDist,e.detailSampleMaxError=a.detailSampleMaxError,e};class se{logs=[];startTimes={};accumulatedTimes={};constructor(e=!0){const t=new s.Module.RecastBuildContextJsImpl;t.log=(r,i,o)=>{if(!this.raw.logEnabled())return;const l=i,n=new Uint8Array(s.Module.HEAPU8.buffer,l,o),u=new Uint8Array(o);u.set(n);const d=new TextDecoder().decode(u);this.log(r,d)},t.resetLog=()=>{this.resetLog()},t.startTimer=r=>{this.raw.timerEnabled()&&this.startTimer(r)},t.stopTimer=r=>{this.raw.timerEnabled()&&this.stopTimer(r)},t.getAccumulatedTime=r=>this.raw.timerEnabled()?this.getAccumulatedTime(r):-1,t.resetTimers=()=>{this.raw.timerEnabled()&&(this.startTimes={},this.accumulatedTimes={})},this.raw=new s.Module.RecastBuildContext(t),this.raw.enableTimer(e),this.raw.enableLog(e),this.resetTimers()}log(e,t){this.logs.push({category:e,msg:t})}resetLog(){this.logs=[]}startTimer(e){this.startTimes[e]=performance.now()}stopTimer(e){const r=performance.now()-this.startTimes[e];this.accumulatedTimes[e]===-1?this.accumulatedTimes[e]=r:this.accumulatedTimes[e]+=r}getAccumulatedTime(e){return this.accumulatedTimes[e]}resetTimers(){for(let e=0;e<g.RC_MAX_TIMERS;e++)this.startTimes[e]=-1,this.accumulatedTimes[e]=-1}}class dt{constructor(e){this.raw=e??new s.rcChunkyTriMesh}init(e,t,r,i){return s.ChunkyTriMeshUtils.createChunkyTriMesh(e.raw,t.raw,r,i,this.raw)}getChunksOverlappingRect(e,t,r,i){return s.ChunkyTriMeshUtils.getChunksOverlappingRect(this.raw,e,t,r.raw,i)}getNodeTris(e){return W.fromRaw(s.ChunkyTriMeshUtils.getChunkyTriMeshNodeTris(this.raw,e))}nodes(e){return this.raw.get_nodes(e)}maxTrisPerChunk(){return this.raw.maxTrisPerChunk}}class V{constructor(e){this.raw=e}smin(){return this.raw.smin}smax(){return this.raw.smax}area(){return this.raw.area}next(){return s.isNull(this.raw.next)?null:new V(this.raw.next)}}class ae{constructor(e){this.raw=e}next(){return s.isNull(this.raw.next)?null:new ae(this.raw.next)}items(e){return new V(this.raw.get_items(e))}}class wt{constructor(e){this.raw=e}width(){return this.raw.width}height(){return this.raw.height}bmin(){return m.fromArray(v(e=>this.raw.get_bmin(e),3))}bmax(){return m.fromArray(v(e=>this.raw.get_bmax(e),3))}cs(){return this.raw.cs}ch(){return this.raw.ch}spans(e){return new V(this.raw.get_spans(e))}pools(e){return new ae(this.raw.get_pools(e))}freelist(e){return new V(this.raw.get_freelist(e))}}class gt{constructor(e){this.raw=e}index(){return this.raw.get_index()}count(){return this.raw.get_count()}}class _t{constructor(e){this.raw=e}y(){return this.raw.get_y()}reg(){return this.raw.get_reg()}con(){return this.raw.get_con()}h(){return this.raw.get_h()}}class ft{constructor(e){this.raw=e}width(){return this.raw.width}height(){return this.raw.height}spanCount(){return this.raw.spanCount}walkableHeight(){return this.raw.walkableHeight}walkableClimb(){return this.raw.walkableClimb}borderSize(){return this.raw.borderSize}maxDistance(){return this.raw.maxDistance}maxRegions(){return this.raw.maxRegions}bmin(){return m.fromArray(v(e=>this.raw.get_bmin(e),3))}bmax(){return m.fromArray(v(e=>this.raw.get_bmax(e),3))}cs(){return this.raw.cs}ch(){return this.raw.ch}cells(e){return new gt(this.raw.get_cells(e))}spans(e){return new _t(this.raw.get_spans(e))}dist(e){return this.raw.get_dist(e)}areas(e){return this.raw.get_areas(e)}}class Rt{constructor(e){this.raw=e}verts(e){return this.raw.get_verts(e)}nverts(){return this.raw.nverts}rverts(e){return this.raw.get_rverts(e)}nrverts(){return this.raw.nrverts}reg(){return this.raw.reg}area(){return this.raw.area}}class Tt{constructor(e){this.raw=e}conts(e){return new Rt(this.raw.get_conts(e))}nconts(){return this.raw.nconts}bmin(){return m.fromArray(v(e=>this.raw.get_bmin(e),3))}bmax(){return m.fromArray(v(e=>this.raw.get_bmax(e),3))}cs(){return this.raw.cs}ch(){return this.raw.ch}width(){return this.raw.width}height(){return this.raw.height}borderSize(){return this.raw.borderSize}maxError(){return this.raw.maxError}}class mt{constructor(e){this.raw=e}verts(e){return this.raw.get_verts(e)}polys(e){return this.raw.get_polys(e)}regs(e){return this.raw.get_regs(e)}flags(e){return this.raw.get_flags(e)}setFlags(e,t){this.raw.set_flags(e,t)}areas(e){return this.raw.get_areas(e)}setAreas(e,t){this.raw.set_areas(e,t)}nverts(){return this.raw.nverts}npolys(){return this.raw.npolys}maxpolys(){return this.raw.maxpolys}nvp(){return this.raw.nvp}bmin(){return m.fromArray(v(e=>this.raw.get_bmin(e),3))}bmax(){return m.fromArray(v(e=>this.raw.get_bmax(e),3))}cs(){return this.raw.cs}ch(){return this.raw.ch}borderSize(){return this.raw.borderSize}maxEdgeError(){return this.raw.maxEdgeError}}class yt{constructor(e){this.raw=e}meshes(e){return this.raw.get_meshes(e)}verts(e){return this.raw.get_verts(e)}tris(e){return this.raw.get_tris(e)}nmeshes(){return this.raw.nmeshes}nverts(){return this.raw.nverts}ntris(){return this.raw.ntris}}const Re=(a,e,t)=>s.Recast.calcGridSize(a,e,t),Te=(a,e,t,r,i,o,l,n)=>s.Recast.createHeightfield(a.raw,e.raw,t,r,i,o,l,n),me=(a,e,t,r,i,o,l)=>s.Recast.markWalkableTriangles(a.raw,e,t.raw,r,i.raw,o,l.raw),ye=(a,e,t,r,i,o,l,n=1)=>s.Recast.rasterizeTriangles(a.raw,e.raw,t,r.raw,i.raw,o,l.raw,n),Ae=(a,e,t)=>s.Recast.filterLowHangingWalkableObstacles(a.raw,e,t.raw),Me=(a,e,t,r)=>s.Recast.filterLedgeSpans(a.raw,e,t,r.raw),Ee=(a,e,t)=>s.Recast.filterWalkableLowHeightSpans(a.raw,e,t.raw),pe=(a,e,t,r,i)=>s.Recast.buildCompactHeightfield(a.raw,e,t,r.raw,i.raw),Ce=(a,e,t)=>s.Recast.erodeWalkableArea(a.raw,e,t.raw),Se=(a,e)=>s.Recast.buildDistanceField(a.raw,e.raw),Ie=(a,e,t,r,i)=>s.Recast.buildRegions(a.raw,e.raw,t,r,i),De=(a,e,t,r,i,o=g.RC_CONTOUR_TESS_WALL_EDGES)=>s.Recast.buildContours(a.raw,e.raw,t,r,i.raw,o),be=(a,e,t,r)=>s.Recast.buildPolyMesh(a.raw,e.raw,t,r.raw),Pe=(a,e,t,r,i,o)=>s.Recast.buildPolyMeshDetail(a.raw,e.raw,t.raw,r,i,o.raw),xe=()=>new wt(s.Recast.allocHeightfield()),X=a=>s.Recast.freeHeightfield(a.raw),ve=()=>new ft(s.Recast.allocCompactHeightfield()),$=a=>s.Recast.freeCompactHeightfield(a.raw),Ne=()=>new Tt(s.Recast.allocContourSet()),q=a=>s.Recast.freeContourSet(a.raw),Oe=()=>new mt(s.Recast.allocPolyMesh()),Le=a=>s.Recast.freePolyMesh(a.raw),Fe=()=>new yt(s.Recast.allocPolyMeshDetail()),He=a=>s.Recast.freePolyMeshDetail(a.raw),At=(a,e)=>{const t=s.NavMeshExporter.exportNavMesh(a.raw,e?.raw),r=new Uint8Array(s.Module.HEAPU8.buffer,t.dataPointer,t.size),i=new Uint8Array(t.size);return i.set(r),s.NavMeshExporter.freeNavMeshExport(t),i},Mt=a=>At(a),Et=a=>{const e=a.length*a.BYTES_PER_ELEMENT,t=s.Module._malloc(e),r=new Uint8Array(s.Module.HEAPU8.buffer,t,e);r.set(a);const i=new s.Module.NavMeshExport;return i.dataPointer=r.byteOffset,i.size=a.length,{navMeshExport:i,dataHeap:r}},pt=a=>{const{navMeshExport:e,dataHeap:t}=Et(a),r=s.NavMeshImporter.importNavMesh(e,void 0);return s.Module._free(t.byteOffset),{navMesh:new te(r.navMesh)}},ze=(a,e)=>{const t={x:1/0,y:1/0,z:1/0},r={x:-1/0,y:-1/0,z:-1/0};for(let i=0;i<e.length;i++){const o=e[i],l=a[o*3],n=a[o*3+1],u=a[o*3+2];t.x=Math.min(t.x,l),t.y=Math.min(t.y,n),t.z=Math.min(t.z,u),r.x=Math.max(r.x,l),r.y=Math.max(r.y,n),r.z=Math.max(r.z,u)}return{bbMin:m.toArray(t),bbMax:m.toArray(r)}},Ct=a=>{let e=0,t=0;return e=+(a>65535)<<4,a>>=e,t=+(a>255)<<3,a>>=t,e|=t,t=+(a>15)<<2,a>>=t,e|=t,t=+(a>3)<<1,a>>=t,e|=t,e|=a>>1,e},St=a=>(a--,a|=a>>1,a|=a>>2,a|=a>>4,a|=a>>8,a|=a>>16,a++,a),It={...re,buildBvTree:!0},Dt=(a,e,t={},r=!1)=>{const i=new se,o={type:"solo",buildContext:i},l=()=>{r||(o.heightfield&&(X(o.heightfield),o.heightfield=void 0),o.compactHeightfield&&($(o.compactHeightfield),o.compactHeightfield=void 0),o.contourSet&&(q(o.contourSet),o.contourSet=void 0),o.polyMesh&&(Le(o.polyMesh),o.polyMesh=void 0),o.polyMeshDetail&&(He(o.polyMeshDetail),o.polyMeshDetail=void 0))},n=T=>(l(),{navMeshData:void 0,success:!1,intermediates:o,error:T}),u=a,d=e.length,_=new ue;_.copy(u);const h=e,y=e.length/3,M=new he;M.copy(h);let p,C;if(t.bounds)p=t.bounds[0],C=t.bounds[1];else{const T=ze(a,e);p=T.bbMin,C=T.bbMax}const I={...It,...t},w=fe(I);w.minRegionArea=w.minRegionArea*w.minRegionArea,w.mergeRegionArea=w.mergeRegionArea*w.mergeRegionArea,w.detailSampleDist=w.detailSampleDist<.9?0:w.cs*w.detailSampleDist,w.detailSampleMaxError=w.ch*w.detailSampleMaxError;const P=Re(p,C,w.cs);w.width=P.width,w.height=P.height;const A=xe();if(o.heightfield=A,!Te(i,A,w.width,w.height,p,C,w.cs,w.ch))return n("Could not create heightfield");const E=new Z;if(E.resize(y),me(i,w.walkableSlopeAngle,_,d,M,y,E),!ye(i,_,d,M,E,y,A,w.walkableClimb))return n("Could not rasterize triangles");E.destroy(),_.destroy(),M.destroy(),Ae(i,w.walkableClimb,A),Me(i,w.walkableHeight,w.walkableClimb,A),Ee(i,w.walkableHeight,A);const D=ve();if(o.compactHeightfield=D,!pe(i,w.walkableHeight,w.walkableClimb,A,D))return n("Failed to build compact data");if(r||(X(A),o.heightfield=void 0),!Ce(i,w.walkableRadius,D))return n("Failed to erode walkable area");if(!Se(i,D))return n("Failed to build distance field");if(!Ie(i,D,w.borderSize,w.minRegionArea,w.mergeRegionArea))return n("Failed to build regions");const b=Ne();if(o.contourSet=b,!De(i,D,w.maxSimplificationError,w.maxEdgeLen,b,g.RC_CONTOUR_TESS_WALL_EDGES))return n("Failed to create contours");const S=Oe();if(o.polyMesh=S,!be(i,b,w.maxVertsPerPoly,S))return n("Failed to triangulate contours");const N=Fe();if(o.polyMeshDetail=N,!Pe(i,S,D,w.detailSampleDist,w.detailSampleMaxError,N))return n("Failed to build detail mesh");r||($(D),o.compactHeightfield=void 0,q(b),o.contourSet=void 0);for(let T=0;T<S.npolys();T++)S.areas(T)===g.RC_WALKABLE_AREA&&S.setAreas(T,0),S.areas(T)===0&&S.setFlags(T,1);const c=new we;c.setPolyMeshCreateParams(S),c.setPolyMeshDetailCreateParams(N),c.setWalkableHeight(w.walkableHeight*w.ch),c.setWalkableRadius(w.walkableRadius*w.cs),c.setWalkableClimb(w.walkableClimb*w.ch),c.setCellSize(w.cs),c.setCellHeight(w.ch),c.setBuildBvTree(I.buildBvTree),t.offMeshConnections&&c.setOffMeshConnections(t.offMeshConnections);const R=de(c);return R.success?(l(),{navMeshData:R.navMeshData,success:!0,intermediates:o}):n("Failed to create Detour navmesh data")},bt=(a,e,t={},r=!1)=>{if(!s.Module)throw new Error('"init" must be called before using any recast-navigation-js APIs. See: https://github.com/isaac-mason/recast-navigation-js?tab=readme-ov-file#initialization');const i=Dt(a,e,t,r);if(!i.success)return{navMesh:void 0,success:!1,intermediates:i.intermediates,error:i.error};const{navMeshData:o}=i,l=new te;return l.initSolo(o)?{success:!0,navMesh:l,intermediates:i.intermediates}:(o.destroy(),{navMesh:void 0,success:!1,intermediates:i.intermediates,error:"Failed to initialize solo NavMesh"})},Pt=({recastConfig:a,navMeshBounds:[e,t]})=>{const r=fe(a),i=Re(e,t,r.cs);r.width=i.width,r.height=i.height,r.minRegionArea=r.minRegionArea*r.minRegionArea,r.mergeRegionArea=r.mergeRegionArea*r.mergeRegionArea,r.tileSize=Math.floor(r.tileSize),r.borderSize=r.walkableRadius+3,r.width=r.tileSize+r.borderSize*2,r.height=r.tileSize+r.borderSize*2,r.detailSampleDist=r.detailSampleDist<.9?0:r.cs*r.detailSampleDist,r.detailSampleMaxError=r.ch*r.detailSampleMaxError;const o=Math.floor(r.tileSize),l=Math.floor((i.width+o-1)/o),n=Math.floor((i.height+o-1)/o),u=r.tileSize*r.cs,d=m.fromArray(e);let _=Math.min(Math.floor(Ct(St(l*n))),14);_>14&&(_=14);const h=22-_,y=1<<_,M=1<<h;return{config:r,gridSize:i,tileSize:o,tileWidth:l,tileHeight:n,tcs:u,orig:d,maxTiles:y,maxPolysPerTile:M}},Be={...re,chunkyTriMeshTrisPerChunk:256,buildBvTree:!0},xt=(a,e,t,r,i,o={},l=!1,n=new se)=>{const u={x:i.x,y:i.y},d=()=>{l||(u.compactHeightfield&&($(u.compactHeightfield),u.compactHeightfield=void 0),u.heightfield&&(X(u.heightfield),u.heightfield=void 0),u.contourSet&&(q(u.contourSet),u.contourSet=void 0),u.polyMesh&&(Le(u.polyMesh),u.polyMesh=void 0),u.polyMeshDetail&&(He(u.polyMeshDetail),u.polyMeshDetail=void 0))},_=T=>(n.log(g.RC_LOG_ERROR,T),d(),{success:!1,error:T,intermediates:u}),h=ct(t),y=[...i.bmin],M=[...i.bmax];y[0]-=h.borderSize*h.cs,y[2]-=h.borderSize*h.cs,M[0]+=h.borderSize*h.cs,M[2]+=h.borderSize*h.cs,h.set_bmin(0,y[0]),h.set_bmin(1,y[1]),h.set_bmin(2,y[2]),h.set_bmax(0,M[0]),h.set_bmax(1,M[1]),h.set_bmax(2,M[2]),n.resetTimers(),n.startTimer(g.RC_TIMER_TOTAL),n.log(g.RC_LOG_PROGRESS,`Building tile at x: ${i.x}, y: ${i.y}`),n.log(g.RC_LOG_PROGRESS,` - ${h.width} x ${h.height} cells`),n.log(g.RC_LOG_PROGRESS,` - ${a.size/3/1e3}K verts, ${e.size/3/1e3}K tris`);const p=xe();if(u.heightfield=p,!Te(n,p,h.width,h.height,y,M,h.cs,h.ch))return _("Could not create heightfield");new Z().resize(r.maxTrisPerChunk());const I=[y[0],y[2]],w=[M[0],M[2]],P=512,A=new je;A.resize(P);const E=r.getChunksOverlappingRect(I,w,A,P);if(E===0)return{success:!0,intermediates:u};for(let T=0;T<E;++T){const x=A.get(T),H=r.nodes(x).n,U=r.getNodeTris(x),F=new Z;F.resize(H),me(n,h.walkableSlopeAngle,a,e.size,U,H,F);const G=ye(n,a,e.size,U,F,H,p,h.walkableClimb);if(F.destroy(),!G)return _("Could not rasterize triangles")}Ae(n,h.walkableClimb,p),Me(n,h.walkableHeight,h.walkableClimb,p),Ee(n,h.walkableHeight,p);const D=ve();if(u.compactHeightfield=D,!pe(n,h.walkableHeight,h.walkableClimb,p,D))return _("Could not build compact heightfield");if(l||(X(u.heightfield),u.heightfield=void 0),!Ce(n,h.walkableRadius,D))return _("Could not erode walkable area");if(!Se(n,D))return _("Failed to build distance field");if(!Ie(n,D,h.borderSize,h.minRegionArea,h.mergeRegionArea))return _("Failed to build regions");const b=Ne();if(u.contourSet=b,!De(n,D,h.maxSimplificationError,h.maxEdgeLen,b,g.RC_CONTOUR_TESS_WALL_EDGES))return _("Failed to create contours");const S=Oe();if(u.polyMesh=S,!be(n,b,h.maxVertsPerPoly,S))return _("Failed to triangulate contours");const N=Fe();if(u.polyMeshDetail=N,!Pe(n,S,D,h.detailSampleDist,h.detailSampleMaxError,N))return _("Failed to build detail mesh");l||($(D),u.compactHeightfield=void 0,q(b),u.contourSet=void 0);for(let T=0;T<S.npolys();T++)S.areas(T)===g.RC_WALKABLE_AREA&&S.setAreas(T,0),S.areas(T)===0&&S.setFlags(T,1);const c=new we;c.setPolyMeshCreateParams(S),c.setPolyMeshDetailCreateParams(N),c.setWalkableHeight(h.walkableHeight*h.ch),c.setWalkableRadius(h.walkableRadius*h.cs),c.setWalkableClimb(h.walkableClimb*h.ch),c.setCellSize(h.cs),c.setCellHeight(h.ch),c.setBuildBvTree(o.buildBvTree??Be.buildBvTree),o.offMeshConnections&&c.setOffMeshConnections(o.offMeshConnections),c.setTileX(i.x),c.setTileY(i.y);const R=de(c);return R.success?(n.log(g.RC_LOG_PROGRESS,`>> Polymesh: ${S.nverts()} vertices ${S.npolys()} polygons`),{success:!0,data:R.navMeshData,intermediates:u}):_("Failed to create Detour navmesh data")},vt=(a,e,t={},r=!1)=>{if(!s.Module)throw new Error('"init" must be called before using any recast-navigation-js APIs. See: https://github.com/isaac-mason/recast-navigation-js?tab=readme-ov-file#initialization');const i=new se,o={type:"tiled",buildContext:i,chunkyTriMesh:void 0,tileIntermediates:[]},l=new te,n=a,u=new ue;u.copy(n);const d=e,_=e.length/3,h=new he;h.copy(d);const y=()=>{u.destroy(),h.destroy(),!r&&o.chunkyTriMesh&&(o.chunkyTriMesh=void 0)},M=x=>(y(),l.destroy(),{success:!1,navMesh:void 0,intermediates:o,error:x}),p={...Be,...t};let C,I;if(t.bounds)C=t.bounds[0],I=t.bounds[1];else{const x=ze(a,e);C=x.bbMin,I=x.bbMax}const{config:w,tileWidth:P,tileHeight:A,tcs:E,orig:D,maxTiles:b,maxPolysPerTile:S}=Pt({recastConfig:p,navMeshBounds:[C,I]}),N=Q.create({orig:D,tileWidth:p.tileSize*p.cs,tileHeight:p.tileSize*p.cs,maxTiles:b,maxPolys:S});if(!l.initTiled(N))return M("Could not init nav mesh for tiled use");const c=new dt;if(o.chunkyTriMesh=c,!c.init(u,h,_,p.chunkyTriMeshTrisPerChunk))return M("Failed to build chunky triangle mesh");i.startTimer(g.RC_TIMER_TEMP);const R=[0,0,0],T=[0,0,0];for(let x=0;x<A;x++)for(let O=0;O<P;O++){R[0]=C[0]+O*E,R[1]=C[1],R[2]=C[2]+x*E,T[0]=C[0]+(O+1)*E,T[1]=I[1],T[2]=C[2]+(x+1)*E;const H={x:O,y:x,bmin:R,bmax:T},U={offMeshConnections:p.offMeshConnections,buildBvTree:p.buildBvTree},F=xt(u,h,w,c,H,U,r,i);if(o.tileIntermediates.push(F.intermediates),F.success&&F.data){l.removeTile(l.getTileRefAt(O,x,0));const G=l.addTile(F.data,f.DT_TILE_FREE_DATA,0);Ze(G.status)&&(i.log(g.RC_LOG_WARNING,`Failed to add tile to nav mesh tx: ${O}, ty: ${x}, status: ${Je(G.status)} (${G.status})`),F.data.destroy())}}return i.stopTimer(g.RC_TIMER_TEMP),r||y(),{success:!0,navMesh:l,intermediates:o}},Nt=a=>{const e=[],t=[],r={};let i=0;for(const{positions:o,indices:l}of a)for(let n=0;n<l.length;n++){const u=l[n]*3,d=o[u],_=o[u+1],h=o[u+2],y=`${d}_${_}_${h}`;let M=r[y];M||(r[y]=M=i,e.push(d,_,h),i++),t.push(M)}return[Float32Array.from(e),Uint32Array.from(t)]};new Qe;class Ot extends ke{constructor(e,t){super(),this.navMesh=e,this.navMeshGeometry=new Ve,this.navMeshMaterial=t?.navMeshMaterial?t.navMeshMaterial:new We({color:"orange",transparent:!0,opacity:.7,depthWrite:!1}),this.update(),this.mesh=new j(this.navMeshGeometry,this.navMeshMaterial),this.add(this.mesh)}update(){const[e,t]=ht(this.navMesh);this.navMeshGeometry.setAttribute("position",new ie(Float32Array.from(e),3)),this.navMeshGeometry.setIndex(new ie(Uint32Array.from(t),1)),this.navMeshGeometry.computeVertexNormals()}}const Lt=new Ye,Ue=a=>{const e=[];for(const t of a){const r=t.geometry.attributes.position;if(!r||r.itemSize!==3)continue;t.updateMatrixWorld();const i=new Float32Array(r.array);for(let l=0;l<i.length;l+=3){const n=Lt.set(i[l],i[l+1],i[l+2]);t.localToWorld(n),i[l]=n.x,i[l+1]=n.y,i[l+2]=n.z}let o=t.geometry.getIndex()?.array;if(o===void 0){const l=[];for(let n=0;n<r.count;n++)l.push(n);o=l}e.push({positions:i,indices:o})}return Nt(e)},Ft=(a,e={},t=!1)=>{const[r,i]=Ue(a);return bt(r,i,e,t)},Ht=(a,e={},t=!1)=>{const[r,i]=Ue(a);return vt(r,i,e,t)},zt=["invalid","walking","offmesh"];let oe=!1;async function ir(){oe||(await Ke(),oe=!0)}function Bt(a){const e=a.getIndex();if(e===null){const t=a.getAttribute("position").clone();for(let r=0;r+2<t.count;r+=3)for(let i=0;i<t.itemSize;i+=1){const o=t.getComponent(r+1,i);t.setComponent(r+1,i,t.getComponent(r+2,i)),t.setComponent(r+2,i,o)}a.setAttribute("position",t);return}for(let t=0;t+2<e.count;t+=3){const r=e.getX(t+1);e.setX(t+1,e.getX(t+2)),e.setX(t+2,r)}e.needsUpdate=!0}function Ut(a){const e=a.getAttribute("position"),t=a.getIndex(),r=l=>t?.getX(l)??l;let i=0;const o=t?.count??e.count;for(let l=0;l+2<o;l+=3){const n=r(l),u=r(l+1),d=r(l+2),_=e.getX(u)-e.getX(n),h=e.getZ(u)-e.getZ(n),y=e.getX(d)-e.getX(n),M=e.getZ(d)-e.getZ(n);i+=h*y-_*M}return i}function Gt(a){const e=[],t=(l,n)=>{if(n.determinant()<0){const d=l.clone().applyMatrix4(n);return Ut(d)<0&&Bt(d),e.push(d),new j(d)}const u=new j(l);return u.matrixAutoUpdate=!1,u.matrix.copy(n),u.matrixWorldNeedsUpdate=!0,u},r=[],i=new ne,o=new ne;for(const l of a){if(l.updateWorldMatrix(!0,!1),l instanceof Xe){for(let n=0;n<l.count;n+=1)l.getMatrixAt(n,i),o.multiplyMatrices(l.matrixWorld,i),r.push(t(l.geometry,o));continue}r.push(l.matrixWorld.determinant()>=0?l:t(l.geometry,l.matrixWorld))}return{meshes:r,temporaryGeometries:e}}const kt=1297302868,Vt=1,Wt=1145979222,Yt=7;function Qt(a){let e=1;for(;e<a;)e*=2;return e}function Xt(a,e){const t=a.vertices.length,r=a.polygons.length;if(t===0||r===0)throw new Error("NavMeshManager.buildFromPolygons: vertices and polygons must be non-empty");if(t>65535)throw new Error(`NavMeshManager.buildFromPolygons: ${t} vertices exceed Detour's uint16 tile index`);if(a.detailMeshes.length!==r)throw new Error(`NavMeshManager.buildFromPolygons: ${r} polygons require the same number of detail rows`);const i=a.polygons.map(c=>c.vertices.map(()=>0)),o=new Map;let l=0;for(let c=0;c<r;c+=1){const R=a.polygons[c];if(R.vertices.length<3||R.vertices.length>6)throw new Error(`NavMeshManager.buildFromPolygons: polygon ${c} has ${R.vertices.length} vertices; Detour permits 3..6`);l+=R.vertices.length;for(let T=0;T<R.vertices.length;T+=1){const x=R.vertices[T],O=R.vertices[(T+1)%R.vertices.length];if(!Number.isInteger(x)||!Number.isInteger(O)||x<0||O<0||x>=t||O>=t)throw new Error(`NavMeshManager.buildFromPolygons: polygon ${c} references an invalid vertex`);const H=`${x},${O}`;if(o.has(H))throw new Error(`NavMeshManager.buildFromPolygons: directed edge ${H} occurs more than once`);const U=o.get(`${O},${x}`);if(U===void 0)o.set(H,[c,T]);else{const[F,G]=U;i[c][T]=F+1,i[F][G]=c+1}}}for(let c=0;c<r;c+=1){const R=a.detailMeshes[c];if(R.vertexBase<0||R.vertexCount<0||R.vertexBase+R.vertexCount>a.detailVertices.length||R.triangleBase<0||R.triangleCount<0||R.triangleBase+R.triangleCount>a.detailTriangles.length||R.vertexCount>255||R.triangleCount>255)throw new Error(`NavMeshManager.buildFromPolygons: polygon ${c} has an invalid detail row`)}for(const c of a.detailTriangles)if(c.some(R=>!Number.isInteger(R)||R<0||R>255))throw new Error("NavMeshManager.buildFromPolygons: detail triangles must contain uint8 values");const n=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],u=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const c of[...a.vertices,...a.detailVertices])for(let R=0;R<3;R+=1){const T=c[R];if(!Number.isFinite(T))throw new Error("NavMeshManager.buildFromPolygons: every vertex component must be finite");n[R]=Math.min(n[R],T),u[R]=Math.max(u[R],T)}const d=100,_=32,h=12,p=d+t*12+r*_+l*h+r*12+a.detailVertices.length*12+a.detailTriangles.length*4,C=new Uint8Array(48+p),I=new DataView(C.buffer);let w=0;const P=c=>{I.setUint8(w,c),w+=1},A=c=>{I.setUint16(w,c,!0),w+=2},E=c=>{I.setUint32(w,c,!0),w+=4},D=c=>{I.setInt32(w,c,!0),w+=4},b=c=>{I.setFloat32(w,c,!0),w+=4},S=Qt(r);E(kt),E(Vt),E(1);for(const c of n)b(c);b(Math.max(u[0]-n[0],Number.EPSILON)),b(Math.max(u[2]-n[2],Number.EPSILON)),E(1),E(S),E(S),E(p),E(Wt),E(Yt),D(0),D(0),D(0),E(0),E(r),E(t),E(l),E(r),E(a.detailVertices.length),E(a.detailTriangles.length),E(0),E(0),E(r);const N=le.navigation;b(e?.walkableHeight??N.walkableHeight),b(e?.walkableRadius??N.walkableRadius),b(e?.walkableClimb??N.walkableClimb);for(const c of n)b(c);for(const c of u)b(c);b(1/(e?.cellSize??N.cellSize));for(const c of a.vertices)for(const R of c)b(R);for(let c=0;c<r;c+=1){const R=a.polygons[c];E(4294967295);for(let T=0;T<6;T+=1)A(R.vertices[T]??0);for(let T=0;T<6;T+=1)A(i[c]?.[T]??0);A(R.flags??1),P(R.vertices.length),P((R.area??0)&63)}w+=l*h;for(const c of a.detailMeshes)E(c.vertexBase),E(c.triangleBase),P(c.vertexCount),P(c.triangleCount),A(0);for(const c of a.detailVertices)for(const R of c)b(R);for(const c of a.detailTriangles)for(const R of c)P(R);if(w!==C.length)throw new Error(`NavMeshManager.buildFromPolygons: encoded ${w} bytes into a ${C.length}-byte allocation`);return C}class nr{navMesh=null;query=null;crowd=null;helper=null;buildFromMeshes(e,t){const r=le.navigation,i=Gt(e),o=i.meshes.reduce((u,d)=>{const _=d.geometry.getIndex(),h=d.geometry.getAttribute("position").count;return u+Math.floor((_?.count??h)/3)},0),l={cs:t?.cellSize??r.cellSize,ch:t?.cellHeight??r.cellHeight,walkableSlopeAngle:t?.walkableSlopeAngle??r.walkableSlopeAngle,walkableHeight:t?.walkableHeight??r.walkableHeight,walkableClimb:t?.walkableClimb??r.walkableClimb,walkableRadius:t?.walkableRadius??r.walkableRadius,maxEdgeLen:t?.maxEdgeLen??r.maxEdgeLen,maxSimplificationError:t?.maxSimplificationError??r.maxSimplificationError,minRegionArea:t?.minRegionArea??r.minRegionArea,mergeRegionArea:t?.mergeRegionArea??r.mergeRegionArea,maxVertsPerPoly:6,detailSampleDist:6,detailSampleMaxError:1};let n;try{n=t?.tiled===!0||i.meshes.length>256||o>1e4?Ht(i.meshes,{...l,tileSize:t?.tileSize??256}):Ft(i.meshes,l)}finally{for(const u of i.temporaryGeometries)u.dispose()}return!n.success||!n.navMesh?!1:(this.destroyRecast(),this.navMesh=n.navMesh,this.query=new ee(this.navMesh),!0)}buildFromPolygons(e,t){try{return this.loadFromData(Xt(e,t)),!0}catch{return!1}}destroyRecast(){this.helper&&(this.helper.parent?.remove(this.helper),this.helper.dispose?.(),this.helper=null),this.crowd&&(this.crowd.destroy(),this.crowd=null),this.query&&(this.query.destroy(),this.query=null),this.navMesh&&(this.navMesh.destroy(),this.navMesh=null)}hasNavMesh(){return this.navMesh!==null}findPath(e,t){if(!this.query)throw new Error("NavMeshManager.findPath: no navmesh has been built, so no path can be queried. Build one first (buildFromMeshes/importNavMesh) — gate on hasNavMesh() if the caller can run before a bake.");const r=this.query.computePath(e,t);if(!r.success&&r.error)throw new Error(`NavMeshManager.findPath: recast could not complete the query (${r.error.name}${r.error.status===void 0?"":`, status ${r.error.status}`}).`);return r.path}createCrowd(e){if(!this.navMesh)throw new Error("Build navmesh first");return this.crowd=new it(this.navMesh,{maxAgents:e,maxAgentRadius:.6}),this.crowd}updateCrowd(e){this.crowd?.update(e)}getCrowdAgents(){return this.crowd?this.crowd.getAgents().map(e=>{const t=e.interpolatedPosition,r=e.velocity(),i=e.target(),o=zt[e.state()]??"invalid",l=o==="invalid"?[]:e.corners().map(n=>({x:n.x,y:n.y,z:n.z}));return{position:{x:t.x,y:t.y,z:t.z},velocity:{x:r.x,y:r.y,z:r.z},radius:e.radius,height:e.height,state:o,target:{x:i.x,y:i.y,z:i.z},corners:l}}):[]}getDebugMesh(e){return this.navMesh?(this.helper||(this.helper=new Ot(this.navMesh),e.add(this.helper)),this.helper):null}exportData(){if(!this.navMesh)throw new Error("No navmesh to export");return Mt(this.navMesh)}loadFromData(e){const{navMesh:t}=pt(e);this.destroyRecast(),this.navMesh=t,this.query=new ee(this.navMesh)}dispose(e){this.helper&&e.remove(this.helper),this.destroyRecast()}}export{nr as NavMeshManager,ir as initNavigation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ae as e}from"./index-Ckxb31Yz.js";import{d as s,a as i,n as a,b as t}from"./navmesh-workflow-store-Cmnm57TB.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";const k="workspace.menu",u={menu:"debug",items:[{id:"navmesh-bake",label:()=>t()?"Rebake NavMesh":"Bake NavMesh",testId:"navmesh-bake",disabled:()=>a()||!e().navigation?.bake,execute:s},{id:"navmesh-clear",label:"Clear NavMesh",testId:"navmesh-clear",disabled:()=>a()||!t()||!e().navigation?.clear,execute:i}]};export{u as menu,k as point};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{q as e,
|
|
1
|
+
import{q as e,ae as d}from"./index-Ckxb31Yz.js";import{getUserData as E}from"./user-data-CZqsJDk-.js";import{N as k,c as M,e as B,f as i,m as A,r as u,n as H}from"./navmesh-workflow-store-Cmnm57TB.js";import{x as T,t as $}from"./three.module-IFn-4i31.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"./object-marks-DwvIEBOK.js";function j(){let c=null;const g=new T({color:3900150,transparent:!0,opacity:.5,depthWrite:!1});function p(a){a.traverse(t=>{t.isMesh&&(t.material=g)})}function h(a){const t=new Set;for(const[r,o]of e().hierarchy.objects())E(o,"navRole")===a&&t.add(r);return t}function l(){e().viewport.setHelper("navmesh",null)}function f(){const a=d().navigation??null;if(a!==c&&(c=a,l()),!a){u();return}let t=!1;try{t=a.hasNavMesh()}catch(s){e().console.error(`Navigation adapter failed to report its state: ${s}`,"navigation")}if(!t){u();return}A();const r=e().viewport.rig()?.scene;if(!r)return;let o=null;try{o=a.debugMesh(r)}catch(s){e().console.error(`Navigation adapter failed to create its debug mesh: ${s}`,"navigation")}o&&(p(o),e().viewport.setHelper("navmesh",o))}const m=async()=>{if(H())return;B(),await new Promise(n=>requestAnimationFrame(()=>n(null)));const a=d().navigation;if(!a){const n="The mounted game has no NavigationAdapter";e().console.warn(`${n} — nothing can be baked`,"navigation"),i(n);return}if(!a.bake){const n="The mounted NavigationAdapter is inspect-only and does not support baking";e().console.warn(n,"navigation"),i(n);return}const t=h("walkable");if(t.size===0){e().console.warn('No walkable entities found — tag meshes as "walkable" in the Navigation section',"navigation"),i("No walkable-tagged entities in the scene");return}const r=[];for(const n of[...t,...h("obstacle")]){const w=e().hierarchy.objects().get(n);w&&w.traverse(N=>{N.isMesh&&r.push(N)})}if(r.length===0){e().console.error("NavMesh bake failed: the walkable-tagged entities have no meshes","navigation"),i("Walkable entities have no meshes");return}let o=!1;try{o=a.bake(r)}catch(n){e().console.error(`NavMesh bake failed: ${n}`,"navigation"),i(`Bake failed: ${n}`);return}if(!o){e().console.error("NavMesh bake failed","navigation"),i("Bake failed (recast rejected the input geometry)");return}c=a;const s=e().viewport.rig()?.scene,v=s?a.debugMesh(s):null;v&&(p(v),e().viewport.setHelper("navmesh",v)),i(null)},b=()=>{const a=d().navigation;if(!a){e().console.warn("The mounted game has no NavigationAdapter to clear","navigation");return}if(!a.clear){e().console.warn("The mounted NavigationAdapter is inspect-only and does not support clearing","navigation");return}try{a.clear(e().viewport.rig()?.scene??new $)}catch(t){e().console.error(`NavMesh clear failed: ${t}`,"navigation");return}l(),u()};window.addEventListener(k,m),window.addEventListener(M,b);const y=e().systems.subscribe(f);return f(),()=>{window.removeEventListener(k,m),window.removeEventListener(M,b),y(),l(),g.dispose()}}const F="workspace.service";function K(){return j()}export{F as point,K as start};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{q as I,dR as g,ao as s,dP as a,a4 as N,bo as M,b5 as w,e6 as F}from"./index-GIL7oGEO.js";import{r as p}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.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-D396a9Mn.js";function T(t){return t?{connectionState:t.getConnectionState?.(),roomInfo:t.getRoomInfo?.(),stats:t.getReplicationStats?.()}:null}function q(t){return t?{stateTree:typeof t.getStateSnapshot=="function",messageLog:typeof t.messageEvents=="function",rates:typeof t.getRates=="function",conditioning:typeof t.getConditioning=="function"&&typeof t.setConditioning=="function",connection:typeof t.getConnectionState=="function",room:typeof t.getRoomInfo=="function",stats:typeof t.getReplicationStats=="function",identity:typeof t.getPlayerIdentity=="function",identitySettable:typeof t.setPlayerIdentity=="function"}:null}class P{constructor(n=500){this.capacity=n}entries=[];lastSeq=0;paused=!1;pull(n){if(this.paused||!n?.messageEvents)return 0;const i=n.messageEvents(this.lastSeq);if(i.length===0)return 0;for(const o of i)this.entries.push(o),o.seq>this.lastSeq&&(this.lastSeq=o.seq);return this.entries.length>this.capacity&&this.entries.splice(0,this.entries.length-this.capacity),i.length}get all(){return this.entries}clear(){this.entries=[]}}function B(t,n){const i=n.trim().toLowerCase();return i?t.filter(o=>o.type.toLowerCase().includes(i)):[...t]}class j{constructor(n=60){this.capacity=n}values=[];push(n){this.values.push(n),this.values.length>this.capacity&&this.values.shift()}get data(){return this.values}get latest(){return this.values.length>0?this.values[this.values.length-1]:null}}class ${msgsIn=new j;msgsOut=new j;bytesIn=new j;bytesOut=new j;sample(n){this.msgsIn.push(n.msgsInPerSec),this.msgsOut.push(n.msgsOutPerSec),n.bytesInPerSec!==void 0&&this.bytesIn.push(n.bytesInPerSec),n.bytesOutPerSec!==void 0&&this.bytesOut.push(n.bytesOutPerSec)}}function D(t,n,i,o=1){if(t.length<2)return"";const r=Math.max(1,...t),l=i-o*2,h=n/(t.length-1);return t.map((m,d)=>{const u=d*h,S=o+l*(1-m/r);return`${u.toFixed(1)},${S.toFixed(1)}`}).join(" ")}const W={disconnected:s.content.muted,connecting:s.semantic.warning,connected:s.semantic.success,error:s.semantic.danger},x={fontFamily:s.typography.mono,fontSize:g.base};function y({children:t,testId:n}){return e.jsx("div",{"data-testid":n,style:{padding:a[4],color:s.content.muted,fontSize:g.base,fontStyle:"italic"},children:t})}function V(t){return t!==null&&typeof t=="object"}function K(t){return typeof t=="string"?`"${t}"`:typeof t=="number"?Number.isInteger(t)?String(t):t.toFixed(3):String(t)}function O({name:t,value:n,depth:i}){const[o,r]=p.useState(i===0),l={...x,paddingLeft:8+i*14,lineHeight:"18px",whiteSpace:"nowrap"};if(!V(n))return e.jsxs("div",{style:l,"data-testid":"net-tree-leaf",children:[e.jsx("span",{style:{color:s.content.primary},children:t}),e.jsx("span",{style:{color:s.content.muted},children:": "}),e.jsx("span",{style:{color:s.content.primary},children:K(n)})]});const h=Object.entries(n);return e.jsxs("div",{children:[e.jsxs("div",{style:{...l,cursor:"pointer",userSelect:"none"},"data-testid":"net-tree-branch","data-expanded":o||void 0,onClick:()=>r(m=>!m),children:[e.jsx("span",{style:{color:s.content.muted,display:"inline-block",width:12},children:e.jsx(F,{direction:o?"down":"right"})}),e.jsx("span",{style:{color:s.content.primary},children:t}),e.jsxs("span",{style:{color:s.content.dim},children:[" ",Array.isArray(n)?`[${h.length}]`:`{${h.length}}`]})]}),o&&h.map(([m,d])=>e.jsx(O,{name:m,value:d,depth:i+1},m))]})}const L=96,z=22,_=p.memo(function({points:n,color:i}){return e.jsx("svg",{width:L,height:z,style:{display:"block",background:s.surface.inset,borderRadius:s.shape.small},role:"img","aria-label":"rate sparkline",children:n&&e.jsx("polyline",{points:n,fill:"none",stroke:i,strokeWidth:1.2})})});function b({label:t,series:n,unit:i,color:o,testId:r}){const l=n.latest;return e.jsxs("div",{"data-testid":r,style:{display:"flex",flexDirection:"column",gap:a[1]},children:[e.jsxs("div",{style:{fontSize:g.sm,color:s.content.muted},children:[t," ",e.jsx("span",{style:{color:s.content.primary,fontFamily:s.typography.mono},children:l===null?"n/a":`${l}${i}`})]}),e.jsx(_,{points:D(n.data,L,z),color:o})]})}function G({event:t}){const n=t.direction==="in"?s.semantic.success:s.accent.default;return e.jsxs("div",{"data-testid":"net-log-row","data-direction":t.direction,style:{...x,display:"grid",gridTemplateColumns:"64px 24px 1fr 56px",gap:a[2],lineHeight:"17px",padding:`0 ${a[4]}`,opacity:t.dropped?.55:1},children:[e.jsxs("span",{style:{color:s.content.dim},children:[(t.time/1e3).toFixed(2),"s"]}),e.jsx("span",{style:{color:n},children:t.direction==="in"?"↓in":"↑out"}),e.jsxs("span",{style:{color:s.content.primary,textDecoration:t.dropped?"line-through":"none",overflow:"hidden",textOverflow:"ellipsis"},children:[t.type,t.dropped?" (dropped)":""]}),e.jsx("span",{style:{color:s.content.muted,textAlign:"right"},children:t.size!==void 0?`${t.size} B`:"—"})]})}function U({adapter:t}){const[n,i]=p.useState(()=>t.getConditioning?.()??{latencyMs:0,jitterMs:0,packetLoss:0}),o=r=>{i(r),t.setConditioning?.(r)};return e.jsxs("div",{"data-testid":"net-conditioner",style:{display:"flex",gap:a[4],alignItems:"center",padding:`${a[2]} ${a[4]}`},children:[e.jsx("span",{style:{fontSize:g.sm,color:s.content.muted},children:"Conditioner"}),e.jsx(w,{label:"latency ms",value:n.latencyMs,step:10,testId:"net-cond-latency",onChange:r=>o({...n,latencyMs:Math.max(0,r)})}),e.jsx(w,{label:"jitter ms",value:n.jitterMs,step:5,testId:"net-cond-jitter",onChange:r=>o({...n,jitterMs:Math.max(0,r)})}),e.jsx(w,{label:"loss %",value:n.packetLoss*100,step:5,testId:"net-cond-loss",onChange:r=>o({...n,packetLoss:Math.min(1,Math.max(0,r/100))})})]})}function X({adapter:t,settable:n}){const[i,o]=p.useState(()=>t.getPlayerIdentity?.()?.name??""),r=()=>{const l=i.trim();l&&t.setPlayerIdentity?.({name:l})};return e.jsxs("div",{"data-testid":"net-identity",style:{display:"flex",gap:a[4],alignItems:"center",padding:`${a[2]} ${a[4]}`},children:[e.jsx("span",{style:{fontSize:g.sm,color:s.content.muted},children:"Player name"}),n?e.jsx(M,{"data-testid":"net-identity-name",value:i,onChange:l=>o(l.target.value),onBlur:r,onKeyDown:l=>{l.key==="Enter"&&l.currentTarget.blur()},style:{width:140}}):e.jsx("span",{"data-testid":"net-identity-name",style:{...x,color:s.content.primary},children:i||"—"})]})}function J({view:t,caps:n,rates:i}){return e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:a[6],alignItems:"center",padding:`${a[2]} ${a[4]}`,borderBottom:`1px solid ${s.boundary.default}`},children:[t.connectionState!==void 0?e.jsxs("span",{"data-testid":"net-connection-state",style:{color:W[t.connectionState]},children:["● ",t.connectionState]}):e.jsx(y,{testId:"net-connection-state-absent",children:"Connection state not provided by this adapter."}),t.roomInfo===void 0?e.jsx(y,{testId:"net-room-absent",children:"Room info not provided by this adapter."}):t.roomInfo?e.jsxs("span",{style:{...x,color:s.content.primary},children:[t.roomInfo.roomName," · ",t.roomInfo.roomId," · session ",t.roomInfo.sessionId]}):e.jsx("span",{style:{color:s.content.muted},children:"no room"}),t.stats?e.jsxs("span",{style:{color:s.content.muted},children:["entities ",e.jsx("span",{style:{color:s.content.primary},children:t.stats.entities})]}):e.jsx(y,{testId:"net-stats-absent",children:"Replication stats not provided by this adapter."}),n.rates?e.jsxs("div",{"data-testid":"net-sparklines",style:{display:"flex",gap:a[5]},children:[e.jsx(b,{label:"msgs in",unit:"/s",series:i.msgsIn,color:s.semantic.success,testId:"net-rate-msgs-in"}),e.jsx(b,{label:"msgs out",unit:"/s",series:i.msgsOut,color:s.accent.default,testId:"net-rate-msgs-out"}),e.jsx(b,{label:"bytes in",unit:" B/s",series:i.bytesIn,color:s.semantic.success,testId:"net-rate-bytes-in"}),e.jsx(b,{label:"bytes out",unit:" B/s",series:i.bytesOut,color:s.accent.default,testId:"net-rate-bytes-out"})]}):e.jsx(y,{testId:"net-rates-absent",children:"Rates not provided by this adapter."})]})}function Q(){const[,t]=p.useReducer(c=>c+1,0),n=p.useRef(new P),i=p.useRef(new $),o=p.useRef(null),[r,l]=p.useState(!1),[h,m]=p.useState("");p.useEffect(()=>{const c=()=>{const f=I().systems.inspectedNetworking()??null;return f!==o.current&&(o.current=f,n.current=new P,n.current.paused=r,i.current=new $),f},R=()=>{const f=c();n.current.pull(f),t()};R();const H=setInterval(R,250),A=setInterval(()=>{const C=c()?.getRates?.();C&&i.current.sample(C)},1e3),E=I().systems.inspectedNetworking()?.subscribe(()=>t());return()=>{clearInterval(H),clearInterval(A),E?.()}},[r]);const d=o.current??I().systems.inspectedNetworking()??null,u=q(d);if(!d||!u)return e.jsxs("div",{"data-testid":"network-inspector-empty",style:{padding:a[8],color:s.content.muted,fontSize:g.md,lineHeight:"18px"},children:[e.jsx("div",{style:{color:s.content.primary,marginBottom:a[2]},children:"No networking adapter is registered."}),"Games expose replication state to this inspector by registering a"," ",e.jsx("code",{style:x,children:"NetworkingAdapter"})," during setup:"," ",e.jsx("code",{style:x,children:"ctx.registerSystemAdapter?.('networking', adapter)"})," — see the third-person-arena example. Single-player games register none; there is nothing to inspect."]});const S=T(d),k=u.stateTree?d.getStateSnapshot?.():void 0,v=B(n.current.all,h);return e.jsxs("div",{"data-testid":"network-inspector",className:"vgai-content-frost",style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",fontSize:g.md},children:[e.jsx(J,{view:S,caps:u,rates:i.current}),u.identity?e.jsx(X,{adapter:d,settable:u.identitySettable},d.getPlayerIdentity?.()?.name??""):null,u.conditioning?e.jsx(U,{adapter:d}):e.jsx(y,{testId:"net-conditioner-absent",children:"Link conditioning not provided by this adapter."}),e.jsxs("div",{style:{flex:1,minHeight:0,display:"flex"},children:[e.jsx("div",{"data-testid":"net-state-tree",style:{flex:1,minWidth:0,overflow:"auto",borderRight:`1px solid ${s.boundary.default}`,padding:`${a[2]} 0`},children:u.stateTree?k!=null?e.jsx(O,{name:"state",value:k,depth:0}):e.jsx(y,{children:"Not connected — no replicated state to show."}):e.jsx(y,{testId:"net-tree-absent",children:"Replicated-state snapshot not provided by this adapter."})}),e.jsx("div",{"data-testid":"net-message-log",style:{flex:1,minWidth:0,display:"flex",flexDirection:"column"},children:u.messageLog?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",gap:a[3],alignItems:"center",padding:a[2]},children:[e.jsx(N,{type:"button",variant:"ghost","data-testid":"net-log-pause",onClick:()=>{const c=!r;n.current.paused=c,l(c)},children:r?"Resume":"Pause"}),e.jsx(N,{type:"button",variant:"ghost","data-testid":"net-log-clear",onClick:()=>{n.current.clear(),t()},children:"Clear"}),e.jsx(M,{"data-testid":"net-log-filter",placeholder:"Filter by type",value:h,onChange:c=>m(c.target.value),style:{flex:1,minWidth:60}}),e.jsxs("span",{style:{fontSize:g.sm,color:s.content.muted},children:[v.length,"/",n.current.all.length]})]}),e.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto"},children:v.length===0?e.jsx(y,{children:"No messages captured yet."}):v.map(c=>e.jsx(G,{event:c},c.seq))})]}):e.jsx(y,{testId:"net-log-absent",children:"Message log not provided by this adapter."})})]})]})}const lt="workspace.utility",ct="Network",dt=25,pt=()=>I().systems.inspectedNetworking()!==null;function ut(){return e.jsx(Q,{})}export{pt as available,ut as default,dt as order,lt as point,ct as title};
|
|
1
|
+
import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{q as I,eH as g,ap as s,eF as a,a5 as N,bD as M,bB as w,eX as B}from"./index-Ckxb31Yz.js";import{r as p}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.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";function E(t){return t?{connectionState:t.getConnectionState?.(),roomInfo:t.getRoomInfo?.(),stats:t.getReplicationStats?.()}:null}function T(t){return t?{stateTree:typeof t.getStateSnapshot=="function",messageLog:typeof t.messageEvents=="function",rates:typeof t.getRates=="function",conditioning:typeof t.getConditioning=="function"&&typeof t.setConditioning=="function",connection:typeof t.getConnectionState=="function",room:typeof t.getRoomInfo=="function",stats:typeof t.getReplicationStats=="function",identity:typeof t.getPlayerIdentity=="function",identitySettable:typeof t.setPlayerIdentity=="function"}:null}class P{constructor(n=500){this.capacity=n}entries=[];lastSeq=0;paused=!1;pull(n){if(this.paused||!n?.messageEvents)return 0;const i=n.messageEvents(this.lastSeq);if(i.length===0)return 0;for(const o of i)this.entries.push(o),o.seq>this.lastSeq&&(this.lastSeq=o.seq);return this.entries.length>this.capacity&&this.entries.splice(0,this.entries.length-this.capacity),i.length}get all(){return this.entries}clear(){this.entries=[]}}function q(t,n){const i=n.trim().toLowerCase();return i?t.filter(o=>o.type.toLowerCase().includes(i)):[...t]}class j{constructor(n=60){this.capacity=n}values=[];push(n){this.values.push(n),this.values.length>this.capacity&&this.values.shift()}get data(){return this.values}get latest(){return this.values.length>0?this.values[this.values.length-1]:null}}class ${msgsIn=new j;msgsOut=new j;bytesIn=new j;bytesOut=new j;sample(n){this.msgsIn.push(n.msgsInPerSec),this.msgsOut.push(n.msgsOutPerSec),n.bytesInPerSec!==void 0&&this.bytesIn.push(n.bytesInPerSec),n.bytesOutPerSec!==void 0&&this.bytesOut.push(n.bytesOutPerSec)}}function D(t,n,i,o=1){if(t.length<2)return"";const r=Math.max(1,...t),l=i-o*2,h=n/(t.length-1);return t.map((m,d)=>{const u=d*h,S=o+l*(1-m/r);return`${u.toFixed(1)},${S.toFixed(1)}`}).join(" ")}const W={disconnected:s.content.muted,connecting:s.semantic.warning,connected:s.semantic.success,error:s.semantic.danger},x={fontFamily:s.typography.mono,fontSize:g.base};function y({children:t,testId:n}){return e.jsx("div",{"data-testid":n,style:{padding:a[4],color:s.content.muted,fontSize:g.base,fontStyle:"italic"},children:t})}function V(t){return t!==null&&typeof t=="object"}function K(t){return typeof t=="string"?`"${t}"`:typeof t=="number"?Number.isInteger(t)?String(t):t.toFixed(3):String(t)}function O({name:t,value:n,depth:i}){const[o,r]=p.useState(i===0),l={...x,paddingLeft:8+i*14,lineHeight:"18px",whiteSpace:"nowrap"};if(!V(n))return e.jsxs("div",{style:l,"data-testid":"net-tree-leaf",children:[e.jsx("span",{style:{color:s.content.primary},children:t}),e.jsx("span",{style:{color:s.content.muted},children:": "}),e.jsx("span",{style:{color:s.content.primary},children:K(n)})]});const h=Object.entries(n);return e.jsxs("div",{children:[e.jsxs("div",{style:{...l,cursor:"pointer",userSelect:"none"},"data-testid":"net-tree-branch","data-expanded":o||void 0,onClick:()=>r(m=>!m),children:[e.jsx("span",{style:{color:s.content.muted,display:"inline-block",width:12},children:e.jsx(B,{direction:o?"down":"right"})}),e.jsx("span",{style:{color:s.content.primary},children:t}),e.jsxs("span",{style:{color:s.content.dim},children:[" ",Array.isArray(n)?`[${h.length}]`:`{${h.length}}`]})]}),o&&h.map(([m,d])=>e.jsx(O,{name:m,value:d,depth:i+1},m))]})}const H=96,L=22,_=p.memo(function({points:n,color:i}){return e.jsx("svg",{width:H,height:L,style:{display:"block",background:s.surface.inset,borderRadius:s.shape.small},role:"img","aria-label":"rate sparkline",children:n&&e.jsx("polyline",{points:n,fill:"none",stroke:i,strokeWidth:1.2})})});function b({label:t,series:n,unit:i,color:o,testId:r}){const l=n.latest;return e.jsxs("div",{"data-testid":r,style:{display:"flex",flexDirection:"column",gap:a[1]},children:[e.jsxs("div",{style:{fontSize:g.sm,color:s.content.muted},children:[t," ",e.jsx("span",{style:{color:s.content.primary,fontFamily:s.typography.mono},children:l===null?"n/a":`${l}${i}`})]}),e.jsx(_,{points:D(n.data,H,L),color:o})]})}function X({event:t}){const n=t.direction==="in"?s.semantic.success:s.accent.default;return e.jsxs("div",{"data-testid":"net-log-row","data-direction":t.direction,style:{...x,display:"grid",gridTemplateColumns:"64px 24px 1fr 56px",gap:a[2],lineHeight:"17px",padding:`0 ${a[4]}`,opacity:t.dropped?.55:1},children:[e.jsxs("span",{style:{color:s.content.dim},children:[(t.time/1e3).toFixed(2),"s"]}),e.jsx("span",{style:{color:n},children:t.direction==="in"?"↓in":"↑out"}),e.jsxs("span",{style:{color:s.content.primary,textDecoration:t.dropped?"line-through":"none",overflow:"hidden",textOverflow:"ellipsis"},children:[t.type,t.dropped?" (dropped)":""]}),e.jsx("span",{style:{color:s.content.muted,textAlign:"right"},children:t.size!==void 0?`${t.size} B`:"—"})]})}function G({adapter:t}){const[n,i]=p.useState(()=>t.getConditioning?.()??{latencyMs:0,jitterMs:0,packetLoss:0}),o=r=>{i(r),t.setConditioning?.(r)};return e.jsxs("div",{"data-testid":"net-conditioner",style:{display:"flex",gap:a[4],alignItems:"center",padding:`${a[2]} ${a[4]}`},children:[e.jsx("span",{style:{fontSize:g.sm,color:s.content.muted},children:"Conditioner"}),e.jsx(w,{label:"latency ms",value:n.latencyMs,step:10,testId:"net-cond-latency",onChange:r=>o({...n,latencyMs:Math.max(0,r)})}),e.jsx(w,{label:"jitter ms",value:n.jitterMs,step:5,testId:"net-cond-jitter",onChange:r=>o({...n,jitterMs:Math.max(0,r)})}),e.jsx(w,{label:"loss %",value:n.packetLoss*100,step:5,testId:"net-cond-loss",onChange:r=>o({...n,packetLoss:Math.min(1,Math.max(0,r/100))})})]})}function U({adapter:t,settable:n}){const[i,o]=p.useState(()=>t.getPlayerIdentity?.()?.name??""),r=()=>{const l=i.trim();l&&t.setPlayerIdentity?.({name:l})};return e.jsxs("div",{"data-testid":"net-identity",style:{display:"flex",gap:a[4],alignItems:"center",padding:`${a[2]} ${a[4]}`},children:[e.jsx("span",{style:{fontSize:g.sm,color:s.content.muted},children:"Player name"}),n?e.jsx(M,{"data-testid":"net-identity-name",value:i,onChange:l=>o(l.target.value),onBlur:r,onKeyDown:l=>{l.key==="Enter"&&l.currentTarget.blur()},style:{width:140}}):e.jsx("span",{"data-testid":"net-identity-name",style:{...x,color:s.content.primary},children:i||"—"})]})}function J({view:t,caps:n,rates:i}){return e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:a[6],alignItems:"center",padding:`${a[2]} ${a[4]}`,borderBottom:`1px solid ${s.boundary.default}`},children:[t.connectionState!==void 0?e.jsxs("span",{"data-testid":"net-connection-state",style:{color:W[t.connectionState]},children:["● ",t.connectionState]}):e.jsx(y,{testId:"net-connection-state-absent",children:"Connection state not provided by this adapter."}),t.roomInfo===void 0?e.jsx(y,{testId:"net-room-absent",children:"Room info not provided by this adapter."}):t.roomInfo?e.jsxs("span",{style:{...x,color:s.content.primary},children:[t.roomInfo.roomName," · ",t.roomInfo.roomId," · session ",t.roomInfo.sessionId]}):e.jsx("span",{style:{color:s.content.muted},children:"no room"}),t.stats?e.jsxs("span",{style:{color:s.content.muted},children:["entities ",e.jsx("span",{style:{color:s.content.primary},children:t.stats.entities})]}):e.jsx(y,{testId:"net-stats-absent",children:"Replication stats not provided by this adapter."}),n.rates?e.jsxs("div",{"data-testid":"net-sparklines",style:{display:"flex",gap:a[5]},children:[e.jsx(b,{label:"msgs in",unit:"/s",series:i.msgsIn,color:s.semantic.success,testId:"net-rate-msgs-in"}),e.jsx(b,{label:"msgs out",unit:"/s",series:i.msgsOut,color:s.accent.default,testId:"net-rate-msgs-out"}),e.jsx(b,{label:"bytes in",unit:" B/s",series:i.bytesIn,color:s.semantic.success,testId:"net-rate-bytes-in"}),e.jsx(b,{label:"bytes out",unit:" B/s",series:i.bytesOut,color:s.accent.default,testId:"net-rate-bytes-out"})]}):e.jsx(y,{testId:"net-rates-absent",children:"Rates not provided by this adapter."})]})}function Q(){const[,t]=p.useReducer(c=>c+1,0),n=p.useRef(new P),i=p.useRef(new $),o=p.useRef(null),[r,l]=p.useState(!1),[h,m]=p.useState("");p.useEffect(()=>{const c=()=>{const f=I().systems.inspectedNetworking()??null;return f!==o.current&&(o.current=f,n.current=new P,n.current.paused=r,i.current=new $),f},C=()=>{const f=c();n.current.pull(f),t()};C();const z=setInterval(C,250),A=setInterval(()=>{const R=c()?.getRates?.();R&&i.current.sample(R)},1e3),F=I().systems.inspectedNetworking()?.subscribe(()=>t());return()=>{clearInterval(z),clearInterval(A),F?.()}},[r]);const d=o.current??I().systems.inspectedNetworking()??null,u=T(d);if(!d||!u)return e.jsxs("div",{"data-testid":"network-inspector-empty",style:{padding:a[8],color:s.content.muted,fontSize:g.md,lineHeight:"18px"},children:[e.jsx("div",{style:{color:s.content.primary,marginBottom:a[2]},children:"No networking adapter is registered."}),"Games expose replication state to this inspector by registering a"," ",e.jsx("code",{style:x,children:"NetworkingAdapter"})," during setup:"," ",e.jsx("code",{style:x,children:"ctx.registerSystemAdapter?.('networking', adapter)"})," — see the third-person-arena example. Single-player games register none; there is nothing to inspect."]});const S=E(d),k=u.stateTree?d.getStateSnapshot?.():void 0,v=q(n.current.all,h);return e.jsxs("div",{"data-testid":"network-inspector",className:"vgai-content-frost",style:{flex:1,minHeight:0,display:"flex",flexDirection:"column",fontSize:g.md},children:[e.jsx(J,{view:S,caps:u,rates:i.current}),u.identity?e.jsx(U,{adapter:d,settable:u.identitySettable},d.getPlayerIdentity?.()?.name??""):null,u.conditioning?e.jsx(G,{adapter:d}):e.jsx(y,{testId:"net-conditioner-absent",children:"Link conditioning not provided by this adapter."}),e.jsxs("div",{style:{flex:1,minHeight:0,display:"flex"},children:[e.jsx("div",{"data-testid":"net-state-tree",style:{flex:1,minWidth:0,overflow:"auto",borderRight:`1px solid ${s.boundary.default}`,padding:`${a[2]} 0`},children:u.stateTree?k!=null?e.jsx(O,{name:"state",value:k,depth:0}):e.jsx(y,{children:"Not connected — no replicated state to show."}):e.jsx(y,{testId:"net-tree-absent",children:"Replicated-state snapshot not provided by this adapter."})}),e.jsx("div",{"data-testid":"net-message-log",style:{flex:1,minWidth:0,display:"flex",flexDirection:"column"},children:u.messageLog?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"flex",gap:a[3],alignItems:"center",padding:a[2]},children:[e.jsx(N,{type:"button",variant:"ghost","data-testid":"net-log-pause",onClick:()=>{const c=!r;n.current.paused=c,l(c)},children:r?"Resume":"Pause"}),e.jsx(N,{type:"button",variant:"ghost","data-testid":"net-log-clear",onClick:()=>{n.current.clear(),t()},children:"Clear"}),e.jsx(M,{"data-testid":"net-log-filter",placeholder:"Filter by type",value:h,onChange:c=>m(c.target.value),style:{flex:1,minWidth:60}}),e.jsxs("span",{style:{fontSize:g.sm,color:s.content.muted},children:[v.length,"/",n.current.all.length]})]}),e.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto"},children:v.length===0?e.jsx(y,{children:"No messages captured yet."}):v.map(c=>e.jsx(X,{event:c},c.seq))})]}):e.jsx(y,{testId:"net-log-absent",children:"Message log not provided by this adapter."})})]})]})}const lt="workspace.utility",ct="Network",dt=25,pt=()=>I().systems.inspectedNetworking()!==null;function ut(){return e.jsx(Q,{})}export{pt as available,ut as default,dt as order,lt as point,ct as title};
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getUserData as r,deleteUserData as n,setUserData as o}from"./user-data-
|
|
1
|
+
import{getUserData as r,deleteUserData as n,setUserData as o}from"./user-data-CZqsJDk-.js";import"./object-marks-DwvIEBOK.js";function i(e){const t=r(e,"authoringSubject");return t&&typeof t.label=="string"&&typeof t.kind=="string"?t:null}function a(e,t){o(e,"authoringSubject",t)}function b(e){n(e,"authoringSubject")}export{b as clearObject3DAuthoringSubject,i as object3DAuthoringSubjectOf,a as setObject3DAuthoringSubject};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{aK as i}from"./index-Ckxb31Yz.js";import{p as h,a as M,r as $}from"./r3f-physics-binding-C8OqNRG2.js";const x=["position","rotation","scale"],O={"@react-three/rapier":{RigidBody:{root:"single",rootTag:"group",transformProps:[...x]}}},z={"@react-three/rapier":{RigidBodyProps:"group"}};function _(t){const n=new Map;for(const r of t.statements){if(!i.isImportDeclaration(r)||!i.isStringLiteral(r.moduleSpecifier))continue;const e=z[r.moduleSpecifier.text],o=r.importClause?.namedBindings;if(!(!e||!o||!i.isNamedImports(o)))for(const s of o.elements){const a=s.propertyName?.text??s.name.text,l=e[a];l&&n.set(s.name.text,l)}}return n}function D(t){return t?Object.values(O).some(n=>Object.values(n).includes(t)):!1}function j(t,n){return O[t]?.[n]}function K(t){const n=new Map;if(!i.isStringLiteral(t.moduleSpecifier))return n;const r=t.importClause?.namedBindings;if(!r||!i.isNamedImports(r))return n;for(const e of r.elements){const o=j(t.moduleSpecifier.text,e.propertyName?.text??e.name.text);o&&n.set(e.name.text,o)}return n}function ft(t,n){const r=h(n,t),e=new Map;for(const o of r.statements)if(i.isImportDeclaration(o))for(const[s,a]of K(o))e.set(s,a);return e}function P(t){let n=t;for(;i.isParenthesizedExpression(n)||i.isAsExpression(n)||i.isSatisfiesExpression(n);)n=n.expression;return n}function k(t){if(!i.isBlock(t))return P(t);const n=t.statements.filter(i.isReturnStatement);if(!(n.length!==1||!n[0]?.expression))return P(n[0].expression)}function Z(t,n,r){for(const[e,o]of r)if(o===n&&new RegExp(`\\b${e}\\b`).test(t))return!0;return!1}function b(t,n,r,e,o,s=new Set){if(!t)return!1;const a=t.getText(r),l=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\bThreeElements\\s*\\[\\s*['"]${l}['"]\\s*\\]`).test(a)||Z(a,n,o))return!0;if(i.isTypeReferenceNode(t)&&i.isIdentifier(t.typeName)){const u=t.typeName.text;if(s.has(u))return!1;const f=e.get(u);return f?(s.add(u),b(f.type,n,f.sf,e,o,s)):!1}for(const[u,f]of e){if(s.has(u)||!new RegExp(`\\b${u}\\b`).test(a))continue;const p=new Set(s).add(u);if(b(f.type,n,f.sf,e,o,p))return!0}return!1}function L(t){if(i.isJsxSelfClosingElement(t))return t;if(i.isJsxElement(t))return t.openingElement}function U(t,n){return t==="multiple"||n==="multiple"?"multiple":t==="unknown"||n==="unknown"?"unknown":t+n>=2?"multiple":t+n}function I(t,n,r){const o=(i.isJsxElement(t)?t.openingElement:t).tagName.getText(n);if(!/^[A-Z]/.test(o))return B(o)?0:1;const s=r.get(o);return!s||s.root==="unknown"?"unknown":s.root==="non-spatial"?0:s.root==="multiple"?"multiple":1}function V(t,n,r){if(!i.isPropertyAccessExpression(t.expression)||t.expression.name.text!=="map")return;const e=t.arguments[0];if(!e||!i.isArrowFunction(e)&&!i.isFunctionExpression(e))return"unknown";const o=k(e.body);if(!o)return"unknown";const s=v(o,n,r);return s===0?0:s==="unknown"?"unknown":"multiple"}function v(t,n,r){const e=P(t);return e.kind===i.SyntaxKind.NullKeyword||e.kind===i.SyntaxKind.FalseKeyword?0:i.isJsxFragment(e)?y(e,n,r):i.isJsxElement(e)||i.isJsxSelfClosingElement(e)?I(e,n,r):i.isCallExpression(e)?V(e,n,r)??"unknown":"unknown"}function W(t,n,r){return i.isJsxText(t)?t.text.trim()===""?0:"unknown":i.isJsxExpression(t)?t.expression?v(t.expression,n,r):0:i.isJsxElement(t)||i.isJsxSelfClosingElement(t)?I(t,n,r):i.isJsxFragment(t)?y(t,n,r):"unknown"}function y(t,n,r){let e=0;for(const o of t.children)e=U(e,W(o,n,r));return e}function q(t,n,r){const e=y(t,n,r);return e===0?{root:"non-spatial",transformProps:[]}:e==="multiple"?{root:"multiple",transformProps:[]}:{root:"unknown",transformProps:[]}}function B(t){return/^[A-Z]/.test(t)?!1:/(Material|Geometry|Attribute)$/.test(t)||t==="fog"||t==="fogExp2"||t==="color"}function G(t){return x.includes(t)}function F(t){return G(t)||t==="visible"}function Y(t,n,r,e,o){const s={standardRootProps:b(t?.type,n,r,e,o),localBindingByProp:new Map};if(!t)return s;if(i.isIdentifier(t.name))return s.wholePropsName=t.name.text,s;if(!i.isObjectBindingPattern(t.name))return s;for(const a of t.name.elements){if(a.dotDotDotToken&&i.isIdentifier(a.name)){s.restPropsName=a.name.text;continue}if(!i.isIdentifier(a.name))continue;const l=a.propertyName?.getText(r)??a.name.text;F(l)&&s.localBindingByProp.set(l,a.name.text)}return s}function H(t,n,r){if(!t)return!1;const e=t.getText(r).replace(/\s+/g,""),o=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^(React\\.)?(Parameters<typeof${o}>\\[0\\]|ComponentProps(WithoutRef|WithRef)?<typeof${o}>)`).test(e)}function Q(t,n){return!n.standardRootProps||!i.isIdentifier(t.expression)?!1:t.expression.text===n.wholePropsName||t.expression.text===n.restPropsName}function X(t,n,r){const e=t.name.getText(r);if(!F(e)||!t.initializer||!i.isJsxExpression(t.initializer))return;const o=t.initializer.expression;if(!o)return;const s=n.localBindingByProp.get(e);if(s&&i.isIdentifier(o)&&o.text===s||n.wholePropsName&&i.isPropertyAccessExpression(o)&&i.isIdentifier(o.expression)&&o.expression.text===n.wholePropsName&&o.name.text===e)return e}function tt(t,n,r){const e=new Set;for(const s of t.attributes.properties){if(i.isJsxSpreadAttribute(s)){if(Q(s,n)){for(const l of x)e.add(l);e.add("visible")}continue}const a=X(s,n,r);a&&e.add(a)}return[...x,"visible"].filter(s=>e.has(s))}const nt=/\b([A-Za-z_$][\w$]*)\.current\??\.(?:position|rotation|quaternion|scale)(?:\??\.[xyzw]+)?\s*(?:[+\-*/]?=|\??\.(?:set|setScalar|copy|add|sub|multiply|lerp|slerp|fromArray)\s*\()/g;function et(t,n){const r=new Set,e=o=>{if(i.isCallExpression(o)&&/(^|\.)useFrame$/.test(o.expression.getText(n)))for(const s of o.getText(n).matchAll(nt))r.add(s[1]);i.forEachChild(o,e)};return e(t),r}function rt(t,n,r){if(n.length>0)return{};const e=$(t);return e&&r.has(e)?{simulationOwnedTransform:!0}:{}}function ot(t,n,r,e,o,s,a,l){const u=k(n);if(!u)return{root:"unknown",transformProps:[]};if(u.kind===i.SyntaxKind.NullKeyword)return{root:"non-spatial",transformProps:[]};if(i.isJsxFragment(u))return q(u,r,s);if(!i.isJsxElement(u)&&!i.isJsxSelfClosingElement(u))return{root:"unknown",transformProps:[]};const f=L(u);if(!f)return{root:"unknown",transformProps:[]};const p=f.tagName.getText(r);if(B(p))return{root:"non-spatial",transformProps:[]};const c=/^[A-Z]/.test(p)?s.get(p):void 0;if(/^[A-Z]/.test(p)&&!c)return{root:"unknown",transformProps:[]};if(c&&c.root!=="single")return c;const d=c?.rootTag??p,g=l.get(f),E=g?.apiDriven??[],T=(g?.forwarded??[]).filter(m=>!E.includes(m)),R=Y(t[0],d,r,e,o),A=!R.standardRootProps&&c&&H(t[0]?.type,p,r)?{...R,standardRootProps:!0}:R,N=tt(f,A,r),S=x.filter(m=>N.includes(m)||T.includes(m)),w=c?S.filter(m=>c.transformProps.includes(m)):S,J=N.includes("visible")&&(!c||c.visibleProp===!0);if(D(c)&&w.length===0)return{root:"unknown",transformProps:[]};const C=w.filter(m=>T.includes(m));return{root:"single",rootTag:d,transformProps:w,...C.length>0?{bodyForwarded:C}:{},...J?{visibleProp:!0}:{},...rt(f,w,a),...E.length>0?{simulationOwnedTransform:!0}:{}}}function it(t){return i.isFunctionDeclaration(t)&&t.name&&t.body?/^[A-Z]/.test(t.name.text)?[{name:t.name.text,parameters:t.parameters,body:t.body}]:[]:i.isVariableStatement(t)?t.declarationList.declarations.flatMap(n=>!i.isIdentifier(n.name)||!/^[A-Z]/.test(n.name.text)||!n.initializer||!i.isArrowFunction(n.initializer)&&!i.isFunctionExpression(n.initializer)?[]:[{name:n.name.text,parameters:n.initializer.parameters,body:n.initializer.body}]):[]}function st(t,n=new Map,r=new Map){const e=new Map(r);for(const f of t.statements)i.isTypeAliasDeclaration(f)&&e.set(f.name.text,{type:f.type,sf:t});const o=_(t),s=t.statements.flatMap(it),a=et(t,t),l=M(t),u=new Map(n);for(let f=0;f<=s.length;f+=1){let p=!1;for(const c of s){const d=ot(c.parameters,c.body,t,e,o,u,a,l),g=u.get(c.name);JSON.stringify(g)!==JSON.stringify(d)&&(u.set(c.name,d),p=!0)}if(!p)break}return u}function ct(t,n,r=new Map,e=new Map){const o=h(n,t);return st(o,r,e)}function lt(t,n,r){let e=0,o=1;for(;o<n;){const s=t.indexOf(`
|
|
2
|
+
`,e);if(s===-1)return t.length;e=s+1,o+=1}return e+r}export{ct as a,ft as b,lt as l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Vec3Schema as a}from"./tuples-
|
|
1
|
+
import{Vec3Schema as a}from"./tuples-DKDGrN1t.js";import{cB as c,r as i,O as e,cz as o,t as n,cy as s,v as t,u as p}from"./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";const b=i({type:t("ConstantValue"),value:e()}),h=i({type:t("IntervalValue"),a:e(),b:e()}),u=i({p0:e(),p1:e(),p2:e(),p3:e()}),f=i({type:t("PiecewiseBezier"),functions:n(i({function:u,start:e()}))}),r=c("type",[b,h,f]).describe("Numeric value: constant, random interval, or bezier curve"),l=i({r:e(),g:e(),b:e(),a:e()}),v=i({r:e(),g:e(),b:e()}),y=i({type:t("CLinearFunction"),subType:t("Color"),keys:n(i({value:v,pos:e()}))}),S=i({type:t("CLinearFunction"),subType:t("Number"),keys:n(i({value:e(),pos:e()}))}),g=i({type:t("ConstantColor"),color:l}),C=i({type:t("ColorRange"),a:l,b:l}),d=i({type:t("Gradient"),color:y,alpha:S}),w=i({type:t("RandomColorBetweenGradient"),gradient1:d,gradient2:d}),m=c("type",[g,C,d,w]).describe("Color generator: constant, range, gradient, or random between gradients"),B=i({type:t("point")}),L=i({type:t("sphere"),radius:e().optional().describe("Sphere radius"),arc:e().optional().describe("Arc angle in radians (2π = full sphere)"),thickness:e().optional().describe("Shell thickness 0–1 (1 = solid, 0 = surface only)")}),O=i({type:t("hemisphere"),radius:e().optional().describe("Hemisphere radius"),arc:e().optional().describe("Arc angle in radians"),thickness:e().optional().describe("Shell thickness 0–1")}),x=i({type:t("cone"),radius:e().optional().describe("Cone base radius"),arc:e().optional().describe("Arc angle in radians"),thickness:e().optional().describe("Shell thickness 0–1"),angle:e().optional().describe("Cone opening angle in radians")}),F=i({type:t("circle"),radius:e().optional().describe("Circle radius"),arc:e().optional().describe("Arc angle in radians"),thickness:e().optional().describe("Ring thickness 0–1")}),P=i({type:t("donut"),radius:e().optional().describe("Donut major radius"),arc:e().optional().describe("Arc angle in radians"),thickness:e().optional().describe("Ring thickness 0–1"),donutRadius:e().optional().describe("Donut tube (minor) radius")}),R=i({type:t("rectangle"),width:e().optional().describe("Rectangle width"),height:e().optional().describe("Rectangle height"),thickness:e().optional().describe("Extrusion depth 0–1")}),T=i({type:t("grid"),width:e().optional().describe("Grid total width"),height:e().optional().describe("Grid total height"),column:e().int().optional().describe("Number of columns"),row:e().int().optional().describe("Number of rows")}),G=c("type",[B,L,O,x,F,P,R,T]).describe("Particle emitter shape"),k=i({type:t("ApplyForce"),direction:a.describe("Force direction vector"),magnitude:r.describe("Force magnitude")}),z=i({type:t("ColorOverLife"),color:m.describe("Color curve over particle lifetime")}),E=i({type:t("SizeOverLife"),size:r.describe("Size curve over particle lifetime")}),A=i({type:t("SpeedOverLife"),speed:r.describe("Speed multiplier curve over lifetime")}),N=i({type:t("RotationOverLife"),angularVelocity:r.describe("Angular velocity in radians/sec")}),D=i({type:t("ForceOverLife"),x:r.describe("Force along X axis over lifetime"),y:r.describe("Force along Y axis over lifetime"),z:r.describe("Force along Z axis over lifetime")}),I=i({type:t("OrbitOverLife"),orbitSpeed:r.describe("Orbit speed over lifetime"),axis:a.optional().describe("Orbit axis. Defaults to [0, 1, 0]")}),V=i({type:t("Noise"),frequency:r.describe("Noise frequency"),power:r.describe("Noise amplitude"),positionAmount:r.optional().describe("Position displacement amount"),rotationAmount:r.optional().describe("Rotation displacement amount")}),H=i({type:t("TurbulenceField"),scale:a.describe("Turbulence field scale"),octaves:e().int().describe("Noise octave count"),velocityMultiplier:a.describe("Velocity multiplier per axis"),timeScale:a.describe("Time scale per axis")}),M=i({type:t("FrameOverLife"),frame:r.describe("Sprite sheet frame index over lifetime")}),W=i({type:t("LimitSpeedOverLife"),speed:r.describe("Maximum speed over lifetime"),dampen:e().describe("Damping factor when speed exceeds limit (0–1)")}),j=i({type:t("ChangeEmitDirection"),angle:r.describe("Angle deviation from original emit direction")}),q=i({type:t("GravityForce"),center:a.describe("Gravity center point"),magnitude:e().describe("Gravity force strength")}),U=i({type:t("WidthOverLength"),width:r.describe("Trail width over trail length")}),X=c("type",[k,z,E,A,N,D,I,V,H,M,W,j,q,U]).describe("Particle behavior applied over lifetime"),Y=s(["billboard","stretchedBillboard","mesh","trail","horizontalBillboard","verticalBillboard"]).describe("How particles are rendered"),Z=i({wrap:s(["clamp","repeat","mirror"]).optional().describe("How UVs outside [0,1] address the sprite image (three wrapS/wrapT)"),filter:s(["linear","nearest"]).optional().describe("Texel interpolation — nearest keeps a pixel-art sprite crisp"),mipmaps:o().optional().describe("Generate and sample a mip chain"),anisotropy:e().optional().describe("Anisotropic filtering samples, for sprites viewed at grazing angles")}).describe("Sprite texture sampler state"),_=i({type:s(["basic","standard"]).optional().describe("Particle material shading model"),color:p().optional().describe("Particle color as CSS hex string"),map:p().optional().describe("Path to particle sprite texture"),mapSampler:Z.optional().describe("Sampler state applied to the sprite texture named by `map`"),blending:s(["normal","additive"]).optional().describe("Blending mode (additive for glowing/fire effects)"),transparent:o().optional().describe("Enable transparency"),depthWrite:o().optional().describe("Write to depth buffer (disable for additive effects)"),side:s(["front","back","double"]).optional().describe("Which face sides to render")}).describe("Particle material settings"),J=i({time:e().describe("Time offset in seconds within the emission cycle"),count:r.describe("Number of particles to emit"),cycle:e().optional().describe("Burst repeat interval in seconds"),interval:e().optional().describe("Delay between burst repetitions"),probability:e().optional().describe("Chance of burst firing (0–1)")}).describe("Timed particle burst"),ce=i({autoDestroy:o().optional().describe("Destroy the particle system when all particles have died"),looping:o().optional().describe("Continuously emit particles"),prewarm:o().optional().describe("Simulate one full cycle on start so particles appear immediately"),duration:e().optional().describe("Total emission duration in seconds"),shape:G.optional().describe("Emitter shape that defines where particles spawn"),startLife:r.optional().describe("Initial particle lifetime in seconds"),startSpeed:r.optional().describe("Initial particle speed"),startSize:r.optional().describe("Initial particle size"),startRotation:r.optional().describe("Initial particle rotation in radians"),startColor:m.optional().describe("Initial particle color"),startLength:r.optional().describe("Initial trail length (trail render mode only)"),startTileIndex:r.optional().describe("Initial sprite sheet tile index"),emissionOverTime:r.optional().describe("Particles emitted per second"),emissionOverDistance:r.optional().describe("Particles emitted per unit of emitter movement"),emissionBursts:n(J).optional().describe("Timed burst emissions"),behaviors:n(X).optional().describe("Behaviors applied to particles over their lifetime"),renderMode:Y.optional().describe("How particles are rendered (billboard, trail, mesh, etc.)"),worldSpace:o().optional().describe("Simulate particles in world space instead of local space"),renderOrder:e().optional().describe("Render order for sorting (higher = rendered later)"),uTileCount:e().int().optional().describe("Horizontal tile count in sprite sheet"),vTileCount:e().int().optional().describe("Vertical tile count in sprite sheet"),blendTiles:o().optional().describe("Blend between sprite sheet tiles for smooth animation"),softParticles:o().optional().describe("Enable soft particle depth fading"),softFarFade:e().optional().describe("Far fade distance for soft particles"),softNearFade:e().optional().describe("Near fade distance for soft particles"),material:_.describe("Particle material settings")}).describe("Particle system configuration");export{X as BehaviorSchema,m as ColorGeneratorSchema,G as EmitterShapeSchema,ce as ParticlesDescriptorSchema,Y as RenderModeSchema,r as ValueGeneratorSchema};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{R as l,P as w,G as g,a as O,D as L,C as y,b as T,H as C,S as b,c as F,V as M,d as B,W as D,e as P,f as c,g as R,L as x,F as k,T as E,N as z,O as N,h as G,i as I,j as A,k as W,l as V,A as H}from"./three.quarks.esm-CRKGjKAH.js";import{armSoftParticleDepth as J,disarmSoftParticleDepth as _}from"./soft-particle-depth-CKUS1j0Y.js";import{textureLoader as $}from"./loader-BbMsvIxP.js";import{bJ as q,b4 as K,ak as Q,al as U,am as X,y as Y,x as Z,H as j,r as ee,bx as ie,I as re,ag as te,a0 as d,K as h,bu as ne,ar as ae}from"./three.module-IFn-4i31.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";const oe={billboard:l.BillBoard,stretchedBillboard:l.StretchedBillBoard,mesh:l.Mesh,trail:l.Trail,horizontalBillboard:l.HorizontalBillBoard,verticalBillboard:l.VerticalBillBoard},f={clamp:te,repeat:re,mirror:ie},se={"linear/mips":ae,"linear/no-mips":d,"nearest/mips":ne,"nearest/no-mips":h},m=new Map;function le(e,i){const n=i===void 0?e:`${e}\0${JSON.stringify(i)}`,r=m.get(n);if(r)return r;const a=$.load(e);return a.colorSpace=ee,i!==void 0&&ce(a,i),m.set(n,a),a}function ce(e,i){if(i.wrap!==void 0&&(e.wrapS=f[i.wrap],e.wrapT=f[i.wrap]),i.filter!==void 0||i.mipmaps!==void 0){const n=i.filter??"linear",r=i.mipmaps===!1?"no-mips":"mips";i.filter!==void 0&&(e.magFilter=n==="linear"?d:h),e.minFilter=se[`${n}/${r}`]}i.mipmaps!==void 0&&(e.generateMipmaps=i.mipmaps),i.anisotropy!==void 0&&(e.anisotropy=i.anisotropy)}function s(e){const i={};for(const[n,r]of Object.entries(e))r!==void 0&&(i[n]=r);return i}function v(e){switch(e.type){case"point":return new F;case"sphere":return new b(s({radius:e.radius,arc:e.arc,thickness:e.thickness}));case"hemisphere":return new C(s({radius:e.radius,arc:e.arc,thickness:e.thickness}));case"cone":return new T(s({radius:e.radius,arc:e.arc,thickness:e.thickness,angle:e.angle}));case"circle":return new y(s({radius:e.radius,arc:e.arc,thickness:e.thickness}));case"donut":return new L(s({radius:e.radius,arc:e.arc,thickness:e.thickness,donutRadius:e.donutRadius}));case"rectangle":return new O(s({width:e.width,height:e.height,thickness:e.thickness}));case"grid":return new g(s({width:e.width,height:e.height,column:e.column,row:e.row}))}}function t(e){return M(e)}function u(e){return B(e)}function S(e){switch(e.type){case"ApplyForce":return new H(new c(e.direction[0],e.direction[1],e.direction[2]),t(e.magnitude));case"ColorOverLife":return new V(u(e.color));case"SizeOverLife":return new W(t(e.size));case"SpeedOverLife":return new A(t(e.speed));case"RotationOverLife":return new I(t(e.angularVelocity));case"ForceOverLife":return new G(t(e.x),t(e.y),t(e.z));case"OrbitOverLife":return new N(t(e.orbitSpeed),e.axis?new c(e.axis[0],e.axis[1],e.axis[2]):void 0);case"Noise":return new z(t(e.frequency),t(e.power),e.positionAmount?t(e.positionAmount):void 0,e.rotationAmount?t(e.rotationAmount):void 0);case"TurbulenceField":return new E(new c(e.scale[0],e.scale[1],e.scale[2]),e.octaves,new c(e.velocityMultiplier[0],e.velocityMultiplier[1],e.velocityMultiplier[2]),new c(e.timeScale[0],e.timeScale[1],e.timeScale[2]));case"FrameOverLife":return new k(t(e.frame));case"LimitSpeedOverLife":return new x(t(e.speed),e.dampen);case"ChangeEmitDirection":return new R(t(e.angle));case"GravityForce":return new P(new c(e.center[0],e.center[1],e.center[2]),e.magnitude);case"WidthOverLength":return new D(t(e.width))}}function pe(e){const i={};e.map&&(i.map=le(e.map,e.mapSampler));const n=e.blending==="normal"?q:K,r=e.transparent!==!1,a=e.depthWrite??!1,o=e.side==="back"?Q:e.side==="double"?U:X;return e.type==="standard"?new Y({color:e.color??"#ffffff",...i,blending:n,transparent:r,depthWrite:a,side:o}):new Z({color:e.color??"#ffffff",...i,blending:n,transparent:r,depthWrite:a,side:o})}let p=null;function ue(){if(p)return p;const e=document.createElement("canvas");e.width=16,e.height=16;const i=e.getContext("2d"),n=i.createRadialGradient(8,8,0,8,8,8);return n.addColorStop(0,"rgba(255,255,255,1)"),n.addColorStop(1,"rgba(255,255,255,0)"),i.fillStyle=n,i.fillRect(0,0,16,16),p=new j(e),p}function be(e,i){const n=pe(e.material);(i?.defaultSprite??!0)&&!e.material.map&&"map"in n&&(n.map=ue());const r={material:n};e.autoDestroy!=null&&(r.autoDestroy=e.autoDestroy),e.looping!=null&&(r.looping=e.looping),e.prewarm!=null&&(r.prewarm=e.prewarm),e.duration!=null&&(r.duration=e.duration),i?.shape?r.shape=i.shape:e.shape&&(r.shape=v(e.shape)),i?.instancingGeometry&&(r.instancingGeometry=i.instancingGeometry),e.startLife&&(r.startLife=t(e.startLife)),e.startSpeed&&(r.startSpeed=t(e.startSpeed)),e.startSize&&(r.startSize=t(e.startSize)),e.startRotation&&(r.startRotation=t(e.startRotation)),i?.startColor?r.startColor=i.startColor:e.startColor&&(r.startColor=u(e.startColor)),e.startTileIndex&&(r.startTileIndex=t(e.startTileIndex)),e.renderMode==="trail"&&e.startLength&&(r.rendererEmitterSettings={startLength:t(e.startLength)}),e.emissionOverTime&&(r.emissionOverTime=t(e.emissionOverTime)),e.emissionOverDistance&&(r.emissionOverDistance=t(e.emissionOverDistance)),e.emissionBursts&&(r.emissionBursts=e.emissionBursts.map(o=>({time:o.time,count:t(o.count),cycle:o.cycle??1,interval:o.interval??0,probability:o.probability??1}))),e.behaviors&&(r.behaviors=e.behaviors.map(S)),e.renderMode!=null&&(r.renderMode=oe[e.renderMode]),e.worldSpace!=null&&(r.worldSpace=e.worldSpace),e.renderOrder!=null&&(r.renderOrder=e.renderOrder),e.uTileCount!=null&&(r.uTileCount=e.uTileCount),e.vTileCount!=null&&(r.vTileCount=e.vTileCount),e.blendTiles!=null&&(r.blendTiles=e.blendTiles),e.softParticles!=null&&(r.softParticles=e.softParticles),e.softFarFade!=null&&(r.softFarFade=e.softFarFade),e.softNearFade!=null&&(r.softNearFade=e.softNearFade);const a=new w(r);return{emitter:a.emitter,system:a}}function Fe(e,i){i.duration!=null&&(e.duration=i.duration),i.looping!=null&&(e.looping=i.looping),i.prewarm!=null&&(e.prewarm=i.prewarm),i.shape&&(e.emitterShape=v(i.shape)),i.startLife&&(e.startLife=t(i.startLife)),i.startSpeed&&(e.startSpeed=t(i.startSpeed)),i.startSize&&(e.startSize=t(i.startSize)),i.startRotation&&(e.startRotation=t(i.startRotation)),i.startColor&&(e.startColor=u(i.startColor)),i.startTileIndex&&(e.startTileIndex=t(i.startTileIndex)),i.emissionOverTime&&(e.emissionOverTime=t(i.emissionOverTime)),i.emissionOverDistance&&(e.emissionOverDistance=t(i.emissionOverDistance)),e.emissionBursts=(i.emissionBursts??[]).map(n=>({time:n.time,count:t(n.count),cycle:n.cycle??1,interval:n.interval??0,probability:n.probability??1})),e.behaviors=(i.behaviors??[]).map(S)}function Me(e,i,n=1/60){e.restart();const r=Math.max(0,i);let a=0;for(;a<r;){const o=Math.min(n,r-a);e.update(o),a+=o}e.pause()}function Be(e,i){e.addSystem(i),i.softParticles&&J(e)}function De(e,i){e.deleteSystem(i),i.softParticles&&_(e)}function Pe(){return{looping:!0,duration:2,shape:{type:"cone",radius:.1,angle:.3},startLife:{type:"IntervalValue",a:.5,b:1.5},startSpeed:{type:"IntervalValue",a:1,b:3},startSize:{type:"IntervalValue",a:.05,b:.15},startColor:{type:"ConstantColor",color:{r:1,g:.8,b:.2,a:1}},emissionOverTime:{type:"ConstantValue",value:30},behaviors:[{type:"SizeOverLife",size:{type:"PiecewiseBezier",functions:[{function:{p0:1,p1:.67,p2:.33,p3:0},start:0}]}}],material:{type:"basic",blending:"additive",transparent:!0,depthWrite:!1}}}export{Fe as applyParticlesDataLive,be as createParticleSystemFromData,Pe as defaultParticlesData,Be as registerParticleSystem,Me as scrubParticleSystemTo,De as unregisterParticleSystem};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{AuthoringAdapter2D as O}from"./authoring-CgcOFhGS.js";import{s as j}from"./index-BLo2LE8C.js";import{X as g,gv as T,ci as m,cj as v}from"./index-Ckxb31Yz.js";import{c as A}from"./source-persistence-backend-_-JMEXxE.js";import{J as N}from"./json-history-resource-r-9q_hxP.js";import{f as F,a as L}from"./pixi-transform-channels-VjdohT11.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-nmcBqr7Y.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";import"./ingest-source-persistence-DH6ioCOu.js";const H={count:0,sprites:0};class _{constructor(t,e,r,i=n=>queueMicrotask(n)){this.root=t,this.index=e,this.mapping=r,this.scheduleWindowClose=i,this.refresh()}current={nodes:new Map,rootIds:[],stats:H};projectionFresh=!1;refresh(){const t=this.index.refresh();return this.current=this.readProjection(t),this.openProjectionWindow(),t}project(){return this.projectionFresh?this.current:this.reproject()}reproject(){const t=this.index.reindex();return this.current=this.readProjection(t),this.openProjectionWindow(),this.current}invalidate(){this.projectionFresh=!1}openProjectionWindow(){this.projectionFresh||(this.projectionFresh=!0,this.scheduleWindowClose(()=>{this.projectionFresh=!1}))}projection(){return this.current}object(t){const e=this.current.nodes.get(t)?.object??null;return e===null||e.destroyed?null:e}node(t){const e=this.current.nodes.get(t);if(!e)return null;const r=this.index.node(t);return r?{...r,parentId:e.parentId,childIds:[...e.childIds]}:null}roots(){return this.current.rootIds.map(t=>this.node(t)).filter(t=>t!==null)}pick(t,e,r){return this.candidates(t,e,r)[0]??null}candidates(t,e,r){const i=this.pointFromClient(t,e);return i?(this.project(),this.hitIds(i,r)):[]}pointFromClient(t,e){const r=this.mapping?.surface()??null;if(!r)return null;const i=r.getBoundingClientRect();if(i.width<=0||i.height<=0)return null;const n=this.mapping?.pointFromClient?.(t,e,i)??null;if(this.mapping?.pointFromClient)return n;const c=Number(r.dataset?.vgaiStageWidth??i.width),a=Number(r.dataset?.vgaiStageHeight??i.height);return!(c>0)||!(a>0)?null:{x:(t-i.left)*(c/i.width),y:(e-i.top)*(a/i.height)}}hitIds(t,e){const r=[],i=[];this.collectHits(this.root,t,"visual",r),this.collectHits(this.root,t,"hitArea",i);const n=[],c=new Set;for(const a of[...r,...i]){const s=a.__authId;s&&!e(s)&&!c.has(s)&&(c.add(s),n.push(s))}return n}rect(t){const e=this.object(t);if(!e||typeof e.getBounds!="function")return null;const r=e.getBounds();return!(r.width>0)||!(r.height>0)?null:{x:r.x,y:r.y,width:r.width,height:r.height}}contextRects(t){const e=this.node(t);if(!e)return{siblings:[]};const r=e.parentId?this.node(e.parentId)?.childIds??[]:this.current.rootIds,i=e.parentId?this.rect(e.parentId):null;return{...i?{parent:i}:{},siblings:r.filter(n=>n!==t).map(n=>this.rect(n)).filter(n=>n!==null)}}readProjection(t){const e=new Map,r=[],i=n=>{const c=this.index.displayObject(n.id);if(!c)return;const a={object:c,id:n.id,parentId:n.parentId,childIds:[...n.childIds]};e.set(n.id,a);for(const s of n.childIds){const u=this.index.node(s);u&&i(u)}};for(const n of this.index.roots())r.push(n.id),i(n);return{nodes:e,rootIds:r,stats:t}}collectHits(t,e,r,i){const n=t.children??[];for(let c=n.length-1;c>=0;c--){const a=n[c];if(!a.visible||!a.renderable)continue;a.updateLocalTransform();const s={x:0,y:0};a.localTransform.applyInverse(e,s),this.collectHits(a,s,r,i),this.contains(a,s,r)&&i.push(a)}}contains(t,e,r){if(!t.__authId)return!1;const i=t;return r==="hitArea"?i.hitArea?i.hitArea.contains(e.x,e.y):!1:typeof i.containsPoint=="function"?i.containsPoint(e):!1}}const $="data-authoring-instance",M="data-authoring-label",R="data-authoring-component";function y(o,t){if(!o||typeof o!="object")return;const e=o[t];return typeof e=="string"&&e.length>0?e:void 0}function x(o){return y(o,$)}function P(o){return y(o,M)}function D(o){return y(o,R)}function U(o){const t=x(o);return t?x(o.parent)!==t:!1}const w="#root";function X(o){if(!(!o.position||!o.scale||!o.pivot||!o.skew))return{x:o.position.x,y:o.position.y,rotation:o.rotation,scaleX:o.scale.x,scaleY:o.scale.y,pivotX:o.pivot.x,pivotY:o.pivot.y,skewX:o.skew.x,skewY:o.skew.y}}function Y(o,t){!o.position||!o.scale||!o.pivot||!o.skew||(o.position.set(t.x,t.y),o.scale.set(t.scaleX,t.scaleY),o.pivot.set(t.pivotX,t.pivotY),o.skew.set(t.skewX,t.skewY),o.rotation=t.rotation)}class B{constructor(t,e,r,i){this.root=t,this.onRestored=i;const n=e.projectHistory;this.resource=n?new N({history:n,kind:"session-state",scope:"session",subject:{...r,id:`${r.id}/world-2d-structure`},displayName:"World 2D structure",capture:()=>this.capture(),conflictIdentity:c=>Object.fromEntries(Object.entries(c.placements).map(([a,s])=>[a,s.parent])),restore:async c=>{this.restore(c)}}):null}byUid=new Map;resource;track(t){return this.uidOf(t)}run(t,e){this.resource?.assertCanMutate();const r=this.capture(),i=e();return this.resource&&this.resource.record(t,r,this.capture()).catch(n=>{g.error(`[canvas] failed to journal "${t}" into project history — the structural edit is applied but has no history entry (it cannot be undone): ${n instanceof Error?n.message:String(n)}`,"authoring")}),i}dispose(){this.resource?.dispose(),this.byUid.clear()}uidOf(t){if(t===this.root)return w;const e=t,r=e.__vgaiStructUid;if(r&&this.byUid.get(r)===t)return r;const i=r??`s${crypto.randomUUID()}`;return e.__vgaiStructUid=i,this.byUid.set(i,t),i}capture(){const t={};for(const[e,r]of this.byUid){const i=r.parent??null,n=X(r);t[e]={parent:i?this.uidOf(i):null,index:i?i.children?.indexOf(r)??-1:-1,...n?{pose:n}:{}}}return{placements:t}}restore(t){const e=Object.entries(t.placements);for(const[r,i]of e){if(i.parent!==null)continue;const n=this.byUid.get(r);n?.parent?.removeChild(n)}for(const[r,i]of e.filter(([,n])=>n.parent!==null).sort((n,c)=>n[1].index-c[1].index)){const n=this.byUid.get(r);if(!n)continue;const c=i.parent===w?this.root:this.byUid.get(i.parent);if(!c||typeof c.addChildAt!="function")continue;const a=c.children.length-(n.parent===c?1:0);c.addChildAt(n,Math.max(0,Math.min(i.index,a))),i.pose&&Y(n,i.pose)}this.onRestored()}}const k=[{kind:"container",label:"Container"},{kind:"sprite",label:"Sprite"},{kind:"text",label:"Text"},{kind:"graphics",label:"Graphics"}],b=/\.(png|jpe?g|webp|gif|svg)(\?.*)?$/i,W="a canvas structural edit would have to add, delete or move a construction statement in the world's own source, and this lane plans property writes only — an editor-created node has no construction site there at all",S="origin",z="#ff2d92",G="this world's write target has no origin write, so the pivot/anchor can be seen here but not dragged";function I(o){const t=o,e=t.anchor,r=t.texture;return e&&r?.orig?{anchor:e,texture:r}:null}function Q(o){const t=I(o);if(!t)return null;const e=o.bounds;return typeof e?.width=="number"&&typeof e.height=="number"?{x:e.width,y:e.height}:{x:t.texture.orig.width,y:t.texture.orig.height}}function q(o){return k.find(e=>e.kind===o)?.label??o}function K(o,t){switch(t){case"container":return new o.Container;case"sprite":{const e=new o.Sprite(o.Texture.WHITE);return e.setSize(64,64),e}case"text":return new o.Text({text:"Text",style:{fill:16777215,fontSize:24}});case"graphics":return new o.Graphics().rect(0,0,100,100).fill(16777215);default:return null}}function C(o,t){const e=V(o,t);Z(t,e);for(const r of t.children??[])e.addChild(C(o,r));return e}function V(o,t){if(t.constructor===o.Container)return new o.Container;if(t.constructor===o.Sprite){const e=t,r=new o.Sprite(e.texture);return r.anchor.set(e.anchor.x,e.anchor.y),r}if(t.constructor===o.Text){const e=t,r=new o.Text({text:e.text,style:e.style.clone()});return r.anchor.set(e.anchor.x,e.anchor.y),r}if(t.constructor===o.Graphics)return t.clone(!0);throw new Error(`"${t.label??t.constructor?.name??"this node"}" cannot be duplicated: a ${t.constructor?.name??"custom"} is constructed by the game's own code, and copying only its display half would put a lookalike with no behaviour into the world.`)}function Z(o,t){t.label=o.label,t.position.set(o.position.x,o.position.y),t.scale.set(o.scale.x,o.scale.y),t.pivot.set(o.pivot.x,o.pivot.y),t.skew.set(o.skew.x,o.skew.y),t.rotation=o.rotation,t.alpha=o.alpha,t.visible=o.visible,"tint"in o&&"tint"in t&&(t.tint=o.tint)}function J(o){const t=new Set;return(o.x!==void 0||o.y!==void 0||o.originX!==void 0||o.originY!==void 0)&&t.add("position"),(o.width!==void 0||o.height!==void 0||o.scaleXFactor!==void 0||o.scaleYFactor!==void 0)&&(t.add("scale"),(o.width!==void 0||o.height!==void 0)&&t.add("position")),o.rotate!==void 0&&t.add("rotation"),[...t]}function tt(o,t){const e=t*Math.PI/180/2,r=Math.sin(e),i=Math.cos(e),[n,c,a,s]=o.rotation;return[n*i+c*r,c*i-n*r,a*i+s*r,s*i-a*r]}function et(o,t){const e={position:[...o.transform.position],rotation:[...o.transform.rotation],scale:[...o.transform.scale]},r=t.rotate;r!==void 0&&(e.rotation=tt(o.transform,r));const i=t.width;i!==void 0&&o.rect.width>0&&(e.scale[0]=o.transform.scale[0]*Math.max(1e-4,i/o.rect.width));const n=t.height;n!==void 0&&o.rect.height>0&&(e.scale[1]=o.transform.scale[1]*Math.max(1e-4,n/o.rect.height));const c=t.scaleStep,a=h=>c!==void 0&&c>0?Math.round(h/c)*c:h,s=h=>Math.abs(h)>=1e-4?h:h<0?-1e-4:1e-4,u=t.scaleXFactor;u!==void 0&&(e.scale[0]=s(a(o.transform.scale[0]*u)));const l=t.scaleYFactor;return l!==void 0&&(e.scale[1]=s(a(o.transform.scale[1]*l))),e}function rt(o,t,e,r){return r.originX!==void 0||r.originY!==void 0?{dx:r.originX!==void 0&&o?r.originX-o.x:0,dy:r.originY!==void 0&&o?r.originY-o.y:0}:{dx:t?(r.x??e.x)-t.x:0,dy:t?(r.y??e.y)-t.y:0}}class xt{constructor(t,e,r){this.root=t,this.store=e,this.target=r.target,this.pixi=r.pixi??j,this.transforms={dimensions:()=>"2d",get:s=>{const u=this.a2d.getTransform(s);return u?L(u):{position:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1]}},editability:(s,u)=>this.target.transformEditability(s,u),beginEdit:s=>this.target.beginTransformEdit(s),apply:(s,u)=>{this.target.writeTransform(s,F(u)),this.notify()},endEdit:s=>this.target.endTransformEdit(s),...this.target.removeTransform?{remove:(s,u)=>this.target.removeTransform?.(s,u)}:{}},this.loadTexture=r.loadTexture??(s=>this.pixi.Assets.load(s)),this.capturePreview=r.capturePreview,this.structureHistory=new B(t,e,r.journal,()=>this.afterStructuralChange()),this.a2d=new O(t,{...r.identity?{identity:r.identity}:{}}),this.projector=new _(t,this.a2d,{surface:r.surface??(()=>null),...r.pointFromClient?{pointFromClient:r.pointFromClient}:{}}),this.provenance=this.target.provenance,r.surface&&(this.pickable={pick:(s,u)=>this.projector.pick(s,u,l=>this.isPickLocked(l)),candidates:(s,u)=>this.projector.candidates(s,u,l=>this.isPickLocked(l))},this.rects={rect:s=>this.projector.rect(s),contextRects:s=>this.projector.contextRects(s)}),r.stories&&(this.stories=r.stories),this.watchStructure(t),this.capabilities={transform:!0,inspectorFields:!0,persist:this.target.provenance.source==="source-code"&&this.target.persistence!==void 0},this.target.bind({a2d:this.a2d,store:e,journal:r.journal,notify:()=>this.notify()}),this.structure=this.target.structure??this.liveStructure,this.assetDrop=this.target.assetDrop??{accepts:(s,u)=>b.test(u)&&this.containerFor(s||null)!==null,drop:(s,u,l)=>this.dropAsset(s,u,l)};const n=this.target.persistence;n&&(this.persistence=n);const c=this.target.truth?.bind(this.target);c&&(this.truth={resolve:(s,u)=>c(s,u)},this.related=A(s=>c(s,"position").site)),!r.stories&&this.target.componentIdentity&&(this.stories=T("canvas",e,s=>this.target.componentIdentity?.(s)??null));const a=this.target.instances?.();a&&(this.instances={describe:s=>a.describe(s),...a.openComponent?{openComponent:s=>a.openComponent?.(s)}:{},revert:(s,u)=>a.revert(s,u),applyToComponent:(s,u)=>a.applyToComponent(s,u)})}capabilities;provenance;pickable;rects;persistence;truth;related;structure;stories;instances;transforms;a2d;projector;target;pixi;structureHistory;loadTexture;capturePreview;listeners=new Set;boxEditSessions=new Map;lockedIds=new Set;refresh(){return this.projector.refresh()}previewImage(t,e,r){const i=this.projector.object(t);return i&&this.capturePreview?this.capturePreview(i,{width:e,height:r}):Promise.resolve(null)}notify(){for(const t of this.listeners)t()}watchedForStructure=[];structureNotifyQueued=!1;onStructureChanged=()=>{this.projector.invalidate(),!this.structureNotifyQueued&&(this.structureNotifyQueued=!0,queueMicrotask(()=>{this.structureNotifyQueued=!1,this.projector.reproject(),this.watchStructure(this.root),this.target.onReindex(),this.notify(),this.store.notifyIngestEdit()}))};watchStructure(t){for(const r of this.watchedForStructure)r.off("childAdded",this.onStructureChanged),r.off("childRemoved",this.onStructureChanged);this.watchedForStructure=[];const e=r=>{typeof r.on=="function"&&typeof r.off=="function"&&(r.on("childAdded",this.onStructureChanged),r.on("childRemoved",this.onStructureChanged),this.watchedForStructure.push(r));for(const i of r.children??[])e(i)};e(t)}hierarchy={roots:()=>(this.projector.project(),this.projector.roots().map(t=>this.toEditorNode(t.id)).filter(t=>t!==null)),node:t=>this.toEditorNode(t)};toEditorNode(t){const e=this.projector.node(t);if(!e)return null;const r=this.projector.object(t),i=r?U(r):!1,n=i?D(r):void 0;return{id:e.id,label:(i&&r?P(r):void 0)??e.label,role:i?"component":"entity",kind:e.kind,...n?{typeLabel:n}:{},parentId:e.parentId,childIds:e.childIds}}selection={get:()=>[...this.store.selectedEntityIds],set:t=>{this.store.selectMultiple(t),this.notify()}};liveStructure={create:(t,e)=>this.createStructuralNode(t,e??null),remove:t=>this.removeStructuralNodes([t]),removeMany:t=>this.removeStructuralNodes(t),duplicate:t=>this.duplicateStructuralNode(t),reparent:(t,e)=>this.reparentStructuralNode(t,e),reorder:(t,e)=>this.reorderStructuralNode(t,e),creatableKinds:()=>k.map(t=>({...t}))};containerFor(t){if(!t)return this.root;const e=this.projector.object(t);return!e||typeof e.addChild!="function"?null:e}refuseStructure(t){return m({resolve:()=>v(t),record:()=>{},report:e=>g.warn(`[canvas] structural edit refused — ${e}`,"authoring")})}reportStructureLiveOnly(t){return m({resolve:()=>v(W),record:()=>{},report:e=>{if(this.target.reportStructureLiveOnly){this.target.reportStructureLiveOnly(t,e);return}g.log(`[canvas] ${t} is live-only — ${e}.`,"authoring")}})}afterStructuralChange(){this.projector.reproject(),this.watchStructure(this.root),this.target.onReindex(),this.notify(),this.store.notifyIngestEdit()}idOf(t){return t.__authId??""}createStructuralNode(t,e){const r=this.containerFor(e);if(!r)return{id:"",ack:this.refuseStructure(`no node with id "${e}" can hold children.`)};const i=K(this.pixi,t);if(!i)return{id:"",ack:this.refuseStructure(`"${t}" is not a kind this canvas surface can construct.`)};i.label=q(t);const n=`Create ${i.label}`;return this.structureHistory.track(r),this.structureHistory.track(i),this.structureHistory.run(n,()=>{r.addChild(i)}),this.afterStructuralChange(),{id:this.idOf(i),ack:this.reportStructureLiveOnly(n)}}removeStructuralNodes(t){const e=[];let r=null;for(const n of t){const c=this.projector.object(n);if(!c?.parent){r=this.refuseStructure(`"${n}" is not a removable node in this tree.`);continue}e.push(c)}if(e.length===0)return r??this.refuseStructure("the selection held no removable node.");const i=e.length===1?`Delete ${e[0].label??"node"}`:`Delete ${e.length} nodes`;for(const n of e)this.structureHistory.track(n),n.parent&&this.structureHistory.track(n.parent);return this.structureHistory.run(i,()=>{for(const n of e)n.parent?.removeChild(n)}),this.afterStructuralChange(),this.reportStructureLiveOnly(i)}duplicateStructuralNode(t){const e=this.projector.object(t),r=e?.parent??null;if(!e||!r)throw new Error(`"${t}" is not a duplicable node in this tree.`);const i=C(this.pixi,e);i.label=`${e.label||"node"} copy`;const n=`Duplicate ${e.label??"node"}`,c=r.children.indexOf(e);return this.structureHistory.track(r),this.structureHistory.track(i),this.structureHistory.run(n,()=>{r.addChildAt(i,c+1)}),this.afterStructuralChange(),{id:this.idOf(i),ack:this.reportStructureLiveOnly(n)}}reparentStructuralNode(t,e){const r=this.projector.object(t);if(!r)return this.refuseStructure(`"${t}" is not a node in this tree.`);const i=this.containerFor(e);if(!i)return this.refuseStructure(`no node with id "${e}" can hold children.`);if(i===r||this.isAncestorOf(r,i))return this.refuseStructure("a node cannot be reparented into itself or its own descendant.");const n=this.localToRootMatrix(r),c=this.localToRootMatrix(i),a=`Move ${r.label??"node"}`;return this.structureHistory.track(r),r.parent&&this.structureHistory.track(r.parent),this.structureHistory.track(i),this.structureHistory.run(a,()=>{i.addChild(r),r.setFromMatrix(c.clone().invert().append(n))}),this.afterStructuralChange(),this.reportStructureLiveOnly(a)}reorderStructuralNode(t,e){const r=this.projector.object(t),i=r?.parent??null;if(!r||!i)return this.refuseStructure(`"${t}" is not a reorderable node in this tree.`);const n=e?this.projector.object(e):null;if(e&&(!n||n.parent!==i))return this.refuseStructure(`"${e}" is not a sibling of "${t}".`);const c=`Reorder ${r.label??"node"}`;return this.structureHistory.track(i),this.structureHistory.track(r),this.structureHistory.run(c,()=>{const a=i.children.indexOf(r),s=n?i.children.indexOf(n):i.children.length;i.addChildAt(r,Math.max(0,a<s?s-1:s))}),this.afterStructuralChange(),this.reportStructureLiveOnly(c)}isAncestorOf(t,e){let r=e.parent;for(;r;){if(r===t)return!0;r=r.parent}return!1}localToRootMatrix(t){const e=[];let r=t;for(;r&&r!==this.root;)e.push(r),r=r.parent;const i=new this.pixi.Matrix;for(let n=e.length-1;n>=0;n--){const c=e[n];c.updateLocalTransform(),i.append(c.localTransform)}return i}assetDrop;async dropAsset(t,e,r){if(!b.test(e))return this.refuseStructure(`${e} is not an image. A canvas world mounts an image as a Sprite; a model or an audio file has no display object to become here.`);const i=this.containerFor(t||null);if(!i)return this.refuseStructure(`no node with id "${t}" can hold a dropped asset.`);let n;try{n=await this.loadTexture(e)}catch(u){return this.refuseStructure(`${e} could not be loaded as a texture: ${u instanceof Error?u.message:String(u)}`)}const c=new this.pixi.Sprite(n);c.anchor.set(.5,.5),c.label=e.split("/").pop()??"Sprite";const a=r?.position;if(a){const u=this.localToRootMatrix(i).clone().invert().apply({x:a[0],y:a[1]});c.position.set(u.x,u.y)}const s=`Add ${c.label}`;return this.structureHistory.track(i),this.structureHistory.track(c),this.structureHistory.run(s,()=>{i.addChild(c)}),this.afterStructuralChange(),this.reportStructureLiveOnly(s)}boxEdit={begin:t=>{const e=this.projector.rect(t);if(!e){this.boxEditSessions.delete(t);return}this.boxEditSessions.set(t,{id:t,rect:e,transform:this.transforms.get(t)}),this.transforms.beginEdit?.(t)},apply:(t,e)=>this.applyBoxEdit(t,e),end:t=>{const e=this.boxEditSessions.get(t);this.boxEditSessions.delete(t),e&&this.transforms.endEdit?.(t)},gizmoOrigin:t=>this.gizmoOriginOf(t)};gizmoOriginOf(t){const e=this.projector.object(t);if(!e||typeof e.getGlobalPosition!="function")return null;const r=e.getGlobalPosition();return{x:r.x,y:r.y}}applyBoxEdit(t,e){const r=this.boxEditSessions.get(t);if(!r||J(e).some(n=>this.transforms.editability?.(t,n).writable===!1))return;const i=et(r,e);this.transforms.apply(t,i),!(e.x===void 0&&e.y===void 0&&e.originX===void 0&&e.originY===void 0&&e.width===void 0&&e.height===void 0)&&this.repositionBoxEditBounds(t,r,e,i)}repositionBoxEditBounds(t,e,r,i){const n=this.projector.object(t);if(!n)return;const c=this.gizmoOriginOf(t),a=this.projector.rect(t),{dx:s,dy:u}=rt(c,a,e.rect,r),l=n.parent;if(l&&typeof l.toLocal=="function"){const h=l.toLocal({x:0,y:0}),d=l.toLocal({x:s,y:u});i.position[0]+=d.x-h.x,i.position[1]+=d.y-h.y}else i.position[0]+=s,i.position[1]+=u;this.transforms.apply(t,i)}spatialHandles={layers:t=>{const e=this.originOf(t);if(!e)return[];const r=this.target.transformEditability(t,"position"),i=!!this.target.writeOrigin&&r.writable;return[{id:`origin:${t}`,category:"origin",guides:[],handles:[{id:S,label:e.kind==="anchor"?"Sprite anchor":"Pivot",position:[e.world.x,e.world.y,0],color:z,writable:i,...i?{}:{reason:this.target.writeOrigin&&r.reason?r.reason:G}}]}]},preview:(t,e,r)=>{this.moveOrigin(t,e,r,"preview")},commit:(t,e,r)=>this.moveOrigin(t,e,r,"commit")};originEditId=null;originOf(t){const e=this.projector.object(t);if(!e||typeof e.updateLocalTransform!="function")return null;const r=I(e),i=r?"anchor":"pivot",n=r?{x:r.anchor.x,y:r.anchor.y}:{x:e.pivot.x,y:e.pivot.y},c=r?{x:0,y:0}:n,a=this.localToRootMatrix(e).apply({x:c.x,y:c.y});return{kind:i,value:n,world:{x:a.x,y:a.y}}}moveOrigin(t,e,r,i){if(e!==S)return;const n=this.originOf(t),c=this.projector.object(t),a=this.target.writeOrigin;if(!n||!c||!a||!this.target.transformEditability(t,"position").writable)return;this.originEditId!==t&&(this.target.beginTransformEdit(t),this.originEditId=t),c.updateLocalTransform();const s=this.localToRootMatrix(c).clone().invert().apply({x:r[0],y:r[1]}),u=n.kind==="anchor"?{x:0,y:0}:n.value,l={x:s.x-u.x,y:s.y-u.y},h=n.kind==="anchor"?Q(c):null;if(n.kind==="anchor"&&(!h||h.x===0||h.y===0))return;const d=h?[n.value.x+l.x/h.x,n.value.y+l.y/h.y]:[s.x,s.y],p=c.localTransform,f=this.a2d.getTransform(t);if(a(t,n.kind,d),f&&this.target.writeTransform(t,{...f,position:[f.position[0]+p.a*l.x+p.c*l.y,f.position[1]+p.b*l.x+p.d*l.y]}),this.notify(),i==="commit"){const E=this.target.endTransformEdit(t);return this.originEditId=null,E}}inspector={properties:t=>[...this.target.properties(t),{path:"locked",label:"Locked",type:"boolean",group:"Visibility"}],get:(t,e)=>e==="locked"?this.lockedIds.has(t):this.target.get(t,e),set:(t,e,r)=>{if(e==="locked"){r===!0?this.lockedIds.add(t):this.lockedIds.delete(t),this.notify();return}return this.target.set(t,e,r)},remove:(t,e)=>this.target.remove?.(t,e)};isPickLocked(t){let e=t;for(;e;){if(this.lockedIds.has(e))return!0;e=this.projector.node(e)?.parentId??null}return!1}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}dispose(){this.boxEditSessions.clear(),this.lockedIds.clear();for(const t of this.watchedForStructure)t.off("childAdded",this.onStructureChanged),t.off("childRemoved",this.onStructureChanged);this.watchedForStructure=[],this.structureHistory.dispose(),this.target.dispose(),this.listeners.clear()}}export{xt as PixiAuthoringAdapter};
|