@volter/game-editor 0.5.67 → 0.5.68

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.
Files changed (357) hide show
  1. package/BUNDLED_NOTICES +20 -20
  2. package/catalog/entries/blender.json +1 -1
  3. package/catalog/entries/music.json +3 -3
  4. package/catalog/project-source/src/lib/music/music-player.ts +18 -12
  5. package/dist/.vite/manifest.json +2307 -2166
  6. package/dist/assets/{AssetBudgetPanel-x_FNJbfZ.js → AssetBudgetPanel-P2PeL_X5.js} +9 -9
  7. package/dist/assets/{AudioViewer-BDPqHDfU.js → AudioViewer-xFb5Wv7A.js} +1 -1
  8. package/dist/assets/CanvasBoardDocument-BFJdTVGp.js +1 -0
  9. package/dist/assets/CanvasSceneViewport-vqBlOz8P.js +1 -0
  10. package/dist/assets/{ColorInput-QUPS1pEB.js → ColorInput-CX1UZjYO.js} +1 -1
  11. package/dist/assets/{EntityModelDocument-CzUHsH9E.js → EntityModelDocument-Du8wIbyK.js} +1 -1
  12. package/dist/assets/{EnvironmentAssetDocument-ByEB7_4A.js → EnvironmentAssetDocument-_SttfMY_.js} +1 -1
  13. package/dist/assets/{GameplaySessionTimeline-dhG-oiqd.js → GameplaySessionTimeline-CWudWnfd.js} +1 -1
  14. package/dist/assets/{ImageViewer-tlVvkdM4.js → ImageViewer-shZzMd91.js} +1 -1
  15. package/dist/assets/InspectorObjectPreview-BMOvJaOw.js +1 -0
  16. package/dist/assets/{JsonAssetDocument-CPmcWFPW.js → JsonAssetDocument-D_HXneWE.js} +1 -1
  17. package/dist/assets/{LiveModuleDocument-DL8QHSlk.js → LiveModuleDocument-BWjOzO_6.js} +1 -1
  18. package/dist/assets/{LutAssetDocument-BImiug2M.js → LutAssetDocument-DIc6nsht.js} +1 -1
  19. package/dist/assets/ModelAssetDocument-_CqTsX_A.js +1 -0
  20. package/dist/assets/{NonThreeAuthoringBootstrap-B40qmGGS.js → NonThreeAuthoringBootstrap-C-V23E1e.js} +1 -1
  21. package/dist/assets/Object3DDocumentToolbar-BfPH9jz5.js +1 -0
  22. package/dist/assets/Object3DDocumentViewport-BaXWtATg.js +2 -0
  23. package/dist/assets/{Object3DPreview-ClYDoH2L.js → Object3DPreview-BPHEr3vI.js} +1 -1
  24. package/dist/assets/OnlineAssetDetail-BxibUH6K.js +1 -0
  25. package/dist/assets/PlayBar-DRANyO01.js +1 -0
  26. package/dist/assets/{QuarksAssetDocument-B-VOj-n4.js → QuarksAssetDocument-4Dne3EHx.js} +1 -1
  27. package/dist/assets/ReactCanvasControls-K98jOX9b.js +1 -0
  28. package/dist/assets/RootSelectionOverlay-BQC12Gdd.js +1 -0
  29. package/dist/assets/{ShaderAssetDocument-Kn8IvRGV.js → ShaderAssetDocument-W3ZjLCkt.js} +4 -4
  30. package/dist/assets/ShadowEditor-DP1LWynl.js +1 -0
  31. package/dist/assets/{SourceAssetViewer-CLQ95VSD.js → SourceAssetViewer-BGUeDAEv.js} +1 -1
  32. package/dist/assets/StageHost-V_0opXFt.js +2 -0
  33. package/dist/assets/{StoryPreviewMount-D2lg37et.js → StoryPreviewMount-Di8uMovM.js} +1 -1
  34. package/dist/assets/{ThreeBoardDocument-BAgHrbtu.js → ThreeBoardDocument-tgcaZDqQ.js} +2 -2
  35. package/dist/assets/{ThreeIsolationSceneContent-DbYIylZQ.js → ThreeIsolationSceneContent-BAKurKW5.js} +1 -1
  36. package/dist/assets/{ToolObject3DPreview-WEi6C9uU.js → ToolObject3DPreview-CffvGJ1h.js} +1 -1
  37. package/dist/assets/Toolbar-uLgsrB2z.js +1 -0
  38. package/dist/assets/{TransientHint-BpDLhRLd.js → TransientHint-CgmkrmKF.js} +1 -1
  39. package/dist/assets/{VideoViewer-DMV8lf4P.js → VideoViewer-ClUJ6_uy.js} +1 -1
  40. package/dist/assets/ViewportShadingMenu-Bdkc6jcd.js +1 -0
  41. package/dist/assets/{active-ingest-DA426a81.js → active-ingest-CnAeQcuQ.js} +3 -3
  42. package/dist/assets/{animation-clock-Bm80XdqP.js → animation-clock-fLmY_3--.js} +1 -1
  43. package/dist/assets/{animation-mixers.service-DK64IuYq.js → animation-mixers.service-DiecMX_A.js} +1 -1
  44. package/dist/assets/{animation-timeline.utility-D-g0zrOl.js → animation-timeline.utility-C71vPJgs.js} +1 -1
  45. package/dist/assets/{asset-budget-asset.menu-CEgP0Kiw.js → asset-budget-asset.menu-BDRDWrvx.js} +1 -1
  46. package/dist/assets/{asset-budget.action-D4R1c3wi.js → asset-budget.action-tQmNGQHC.js} +1 -1
  47. package/dist/assets/{asset-budget.document-Syzjn1U1.js → asset-budget.document-BthgX37Z.js} +1 -1
  48. package/dist/assets/{asset-budget.menu-BbRiqXeM.js → asset-budget.menu-DfyWVH6p.js} +1 -1
  49. package/dist/assets/{asset-editor-persistence-BGWIqZdk.js → asset-editor-persistence-BQgjOCrm.js} +1 -1
  50. package/dist/assets/{asset-loaders-C0KQI5eY.js → asset-loaders-5PIUVvmH.js} +1 -1
  51. package/dist/assets/{asset-preview-B1tDziF1.js → asset-preview-Cv7tfD98.js} +1 -1
  52. package/dist/assets/{audio-unlock.service-ucMfCVBw.js → audio-unlock.service-BvHvZjzx.js} +1 -1
  53. package/dist/assets/{audio.utility-BmE9WMUg.js → audio.utility-D9Vk_WYS.js} +1 -1
  54. package/dist/assets/autoplay.service-CFJoLPLw.js +1 -0
  55. package/dist/assets/{babylon-authoring-adapter-C8mFMXSr.js → babylon-authoring-adapter-Cg5ALSpr.js} +1 -1
  56. package/dist/assets/binding-resolver-C_9MBSMa.js +2 -0
  57. package/dist/assets/{blender-node-editor.document-C1YmwWls.js → blender-node-editor.document-B92MO51u.js} +1 -1
  58. package/dist/assets/{blender-properties-tab-B8lyjgj3.js → blender-properties-tab-CDVyDAbf.js} +1 -1
  59. package/dist/assets/{blender-runtime-host-CyQlImSR.js → blender-runtime-host-CuniE0sy.js} +1 -1
  60. package/dist/assets/{blender-runtime-skin-BK7ShZ6z.js → blender-runtime-skin-B_tOz5j5.js} +1 -1
  61. package/dist/assets/{blender-runtime.document-B0nVQs0P.js → blender-runtime.document-DxUwLiEW.js} +1 -1
  62. package/dist/assets/{blender-timeline.document-CMcdE2CK.js → blender-timeline.document-BdEEoQbK.js} +1 -1
  63. package/dist/assets/{blender-uv-editor.document-CjqNo4sZ.js → blender-uv-editor.document-EMSUlRh4.js} +1 -1
  64. package/dist/assets/{blender-version.status-OsFoc9SA.js → blender-version.status-DtfwUahB.js} +1 -1
  65. package/dist/assets/{blender.command-C6NmRBo5.js → blender.command-BkBML2SY.js} +1 -1
  66. package/dist/assets/blender.keymap-BmOBRY7p.js +1 -0
  67. package/dist/assets/{board-guides-BEKPgD9M.js → board-guides-_3R1t_-2.js} +1 -1
  68. package/dist/assets/bridge.command-VnplZ81v.js +3 -0
  69. package/dist/assets/{browserAll-lF_dLQVz.js → browserAll-BCmkqg8n.js} +1 -1
  70. package/dist/assets/build-player.document-DV7YcJQt.js +1 -0
  71. package/dist/assets/build-profiles.document-CZxDuhzz.js +2 -0
  72. package/dist/assets/{build-progress.status-Bo1ZgJcb.js → build-progress.status-Dk5u3C67.js} +1 -1
  73. package/dist/assets/build-session-BGe0eGrQ.js +9 -0
  74. package/dist/assets/{build.action-DRX2IcYt.js → build.action-Bdj4ZEL_.js} +1 -1
  75. package/dist/assets/{build.command-BGvLaLG0.js → build.command-DAWiYvPa.js} +1 -1
  76. package/dist/assets/build.header--xqH6uTP.js +1 -0
  77. package/dist/assets/{build.menu-UenrjPWS.js → build.menu-BiRNC_xc.js} +1 -1
  78. package/dist/assets/{build.service-BIUoTY6l.js → build.service-Dw9K6VSF.js} +1 -1
  79. package/dist/assets/{camera-DrvaM47S.js → camera-C-qXzXFf.js} +1 -1
  80. package/dist/assets/{camera-runtime.inspector-CjJALNO8.js → camera-runtime.inspector-BDrwWRlU.js} +1 -1
  81. package/dist/assets/canvas-design-mount-DLn49Zle.js +6 -0
  82. package/dist/assets/canvas-entry-runtime-DVeh71nC.js +2 -0
  83. package/dist/assets/{canvas-preview-frames-C0QTagA3.js → canvas-preview-frames-B5xFRjhQ.js} +1 -1
  84. package/dist/assets/{canvas-story-capture.service-Dgjr-rT1.js → canvas-story-capture.service-DQ_leYyi.js} +2 -2
  85. package/dist/assets/{capability-coverage-DZ-onC5j.js → capability-coverage-DQgg6UJe.js} +3 -3
  86. package/dist/assets/{collaboration-presence-BVIQuN1l.js → collaboration-presence-BOS1t8wI.js} +1 -1
  87. package/dist/assets/{collider-C7SbIYKY.js → collider-Bf4Uk6LW.js} +1 -1
  88. package/dist/assets/{component-board.service-CWFaGMCO.js → component-board.service-CpVXGhz5.js} +2 -2
  89. package/dist/assets/{component-board.service-BEsFAw4_.js → component-board.service-DFSSCaCf.js} +2 -2
  90. package/dist/assets/{component-board.service-q_TM9BCw.js → component-board.service-DgujG90T.js} +2 -2
  91. package/dist/assets/{component-contracts.service-CPbfXE1h.js → component-contracts.service-Bc_2Xxh_.js} +1 -1
  92. package/dist/assets/{component-instance-root-B0C5oNEm.js → component-instance-root-df4ofoOR.js} +1 -1
  93. package/dist/assets/{component-verbs.command-oNtGgzQL.js → component-verbs.command-DGzZAV_Z.js} +1 -1
  94. package/dist/assets/component-verbs.service-D1rVRogp.js +1 -0
  95. package/dist/assets/{config-_wCzzlM_.js → config-D-EAAhqP.js} +4 -4
  96. package/dist/assets/{configurations-BXU4GGbV.js → configurations-_HZOWZPy.js} +1 -1
  97. package/dist/assets/{connection.status-Yvt0bX0r.js → connection.status-CCX-mgmr.js} +1 -1
  98. package/dist/assets/{constraints.inspector-4r8jWq5a.js → constraints.inspector-CwEEREsf.js} +1 -1
  99. package/dist/assets/{content-bounds-BeuIXKYu.js → content-bounds-DKBD7nsv.js} +1 -1
  100. package/dist/assets/{contract-system-adapters-Bic_7sev.js → contract-system-adapters-h6OUBRYA.js} +1 -1
  101. package/dist/assets/{coverage.service-DcpEoBuf.js → coverage.service-CV7b5Sqn.js} +2 -2
  102. package/dist/assets/create-runtime-Bg2uYMfh.js +3 -0
  103. package/dist/assets/{curve-DVd18iAX.js → curve-BKuiAPpj.js} +1 -1
  104. package/dist/assets/{data-asset-DfQ2Pjse.js → data-asset-7Nfmx-28.js} +1 -1
  105. package/dist/assets/{data-ref-CWnkj-HX.js → data-ref-DyFQqqX6.js} +1 -1
  106. package/dist/assets/debug-bridge-CESAxmlz.js +1 -0
  107. package/dist/assets/{debug-registry-P0_YQGWd.js → debug-registry-l7k5Hjc8.js} +1 -1
  108. package/dist/assets/{deferred-ingest-play-BdR4qGk6.js → deferred-ingest-play-Bej67_y9.js} +2 -2
  109. package/dist/assets/{design-time-canvas-mount-DPQeHSN2.js → design-time-canvas-mount-CFW9ZWuk.js} +2 -2
  110. package/dist/assets/{design-time-layers-ChswRUJt.js → design-time-layers-CQgnmqc8.js} +1 -1
  111. package/dist/assets/{design-time-mount.service-Ks-5Wkcs.js → design-time-mount.service-DJeAPUB_.js} +2 -2
  112. package/dist/assets/{design-time-mount.service-Ca-DZGFV.js → design-time-mount.service-_R1UDCw3.js} +2 -2
  113. package/dist/assets/{design-time-react-mount-C85KfXOd.js → design-time-react-mount-CFvIk_rV.js} +1 -1
  114. package/dist/assets/{document-preview-three-DThkjI1S.js → document-preview-three-5cbuuJMH.js} +1 -1
  115. package/dist/assets/{dom-authoring-adapter-BrLU8IJ_.js → dom-authoring-adapter-CoESNvrM.js} +1 -1
  116. package/dist/assets/{draco3d-B2cwv46o.js → draco3d-Sk9K4AUT.js} +1 -1
  117. package/dist/assets/{edit-mode-audio.service-D4ITNbsm.js → edit-mode-audio.service-CH6J-8N7.js} +1 -1
  118. package/dist/assets/{edit-mode-authoring-DeCxPcHM.js → edit-mode-authoring-DBjaBTxM.js} +1 -1
  119. package/dist/assets/{edit-mode-networking.service-BNv-FTRh.js → edit-mode-networking.service-C4o2pGHX.js} +1 -1
  120. package/dist/assets/editor-api-D2azVray.js +1 -0
  121. package/dist/assets/{editor-layers-BDJnAAzj.js → editor-layers-B4oYfpj8.js} +1 -1
  122. package/dist/assets/{editor-shell-store-ChLcVeNB.js → editor-shell-store-Bh1S7M54.js} +1 -1
  123. package/dist/assets/{entity-object-JmYMfLsx.js → entity-object-B_5Gc0Ky.js} +1 -1
  124. package/dist/assets/{extend-Cc-nEa_A.js → extend-DcEyE5jI.js} +1 -1
  125. package/dist/assets/fork-menu-CKjNh3MO.js +1 -0
  126. package/dist/assets/{frame-debugger-store-DaCbAYSW.js → frame-debugger-store-D5YViF_8.js} +1 -1
  127. package/dist/assets/{game-contract-seams-BnPFGLll.js → game-contract-seams-C0AVYwvO.js} +1 -1
  128. package/dist/assets/{game-css-scope-transform-D_p7cVgW.js → game-css-scope-transform-8GOvVu1s.js} +1 -1
  129. package/dist/assets/game-document.service-FdG_gFPU.js +1 -0
  130. package/dist/assets/game-eval.command-4wa9vqWE.js +2 -0
  131. package/dist/assets/{game-module-access-o3iXZpCA.js → game-module-access-DulnT3NH.js} +1 -1
  132. package/dist/assets/game-network-Bo_nlDR5.js +22 -0
  133. package/dist/assets/{gameplay-export-BzYzLZPi.js → gameplay-export-K5AcStVC.js} +1 -1
  134. package/dist/assets/{gameplay-replay-BwdxV4oF.js → gameplay-replay-CnWnlogY.js} +1 -1
  135. package/dist/assets/gameplay.command-DoWqBWhH.js +1 -0
  136. package/dist/assets/{generation-jobs-BZhOMrp-.js → generation-jobs-CiabIfR0.js} +1 -1
  137. package/dist/assets/generation.service-D2yeZaJu.js +1 -0
  138. package/dist/assets/{generations-DVDht_31.js → generations-DU9rCeQR.js} +1 -1
  139. package/dist/assets/{generations.status-BvzgHlyk.js → generations.status-3CrPw_n5.js} +1 -1
  140. package/dist/assets/{hierarchy-marks-Cc_3lxw6.js → hierarchy-marks-C25dY2fR.js} +1 -1
  141. package/dist/assets/{hosted-asset-materialization-BpbnhJac.js → hosted-asset-materialization-DYdcFlDf.js} +1 -1
  142. package/dist/assets/{index-0Lm0Nf1M.css → index-B5WjeCHm.css} +1 -1
  143. package/dist/assets/{index-C1c3eOmm.js → index-BcH5GC3b.js} +1 -1
  144. package/dist/assets/{index-cNc-iFbq.js → index-BsYc2Oyj.js} +1 -1
  145. package/dist/assets/{index-SS9EugVg.js → index-C20Flc1s.js} +2 -2
  146. package/dist/assets/{index-Ck3JFh48.js → index-C4AUQbmq.js} +1 -1
  147. package/dist/assets/{index-DUZeuA7g.js → index-CC1puVjo.js} +1 -1
  148. package/dist/assets/{index-BRJMIUK0.js → index-CaG87ZF-.js} +321 -321
  149. package/dist/assets/index-CwCDkEl1.js +1 -0
  150. package/dist/assets/{index-C3Pw-9So.js → index-Kb9_s5aP.js} +1 -1
  151. package/dist/assets/{index-BeK4RPgj.js → index-n3QdTv-T.js} +1 -1
  152. package/dist/assets/{inference-diagnostics-xecGdohW.js → inference-diagnostics-MGcIHEX6.js} +1 -1
  153. package/dist/assets/{ingest-boot-viewport-DAt8WFSy.js → ingest-boot-viewport-D2okO6JI.js} +1 -1
  154. package/dist/assets/ingest-siblings-CkxW__go.js +1 -0
  155. package/dist/assets/{ingest-source-persistence-Dmdo-UBp.js → ingest-source-persistence-6peGfPAS.js} +1 -1
  156. package/dist/assets/{ingest.service-vbCucMz7.js → ingest.service-Cc73WMIW.js} +1 -1
  157. package/dist/assets/{inspect-Dr4qvDpJ.js → inspect-C8RP8G5F.js} +1 -1
  158. package/dist/assets/instances.command-CxKGnrNl.js +1 -0
  159. package/dist/assets/{json-history-resource-DwS10tqD.js → json-history-resource-CTXRV4GD.js} +1 -1
  160. package/dist/assets/layered-pick-B_-BRrRD.js +1 -0
  161. package/dist/assets/{light-DcFqVCmv.js → light-CskDQ8gF.js} +1 -1
  162. package/dist/assets/{live-project-verbs-C3LzprCe.js → live-project-verbs-BOAQN3ME.js} +1 -1
  163. package/dist/assets/{machine.document-BzZxubYQ.js → machine.document-BxOoCOo9.js} +1 -1
  164. package/dist/assets/{machines.finder-BR02bfVG.js → machines.finder-CqEceWzS.js} +1 -1
  165. package/dist/assets/{material-B_V78pTt.js → material-BwFzKPi0.js} +1 -1
  166. package/dist/assets/{material-factory-COz7qZhC.js → material-factory-qB9pzcQf.js} +1 -1
  167. package/dist/assets/{mesh-DcmO-mWI.js → mesh-5--4qA-C.js} +1 -1
  168. package/dist/assets/model-asset-sections.service-TZ2SaBmH.js +1 -0
  169. package/dist/assets/{model-inspection-CXHxrafK.js → model-inspection-MrJY0U_-.js} +1 -1
  170. package/dist/assets/{model-thumbnail-BEKPWg4l.js → model-thumbnail-uk-2sblh.js} +1 -1
  171. package/dist/assets/{models.finder-c1I0tp2M.js → models.finder-rk8dhgO8.js} +1 -1
  172. package/dist/assets/module-mode-B79jV5tQ.js +2 -0
  173. package/dist/assets/mount-canvas-ingest-root-BhaYNuhY.js +2 -0
  174. package/dist/assets/mount-dom-ingest-root-BQb1u0LX.js +2 -0
  175. package/dist/assets/mount-ingest-root-BC3-1Cw1.js +2 -0
  176. package/dist/assets/mount-manifest-QJOB11Kv.js +1 -0
  177. package/dist/assets/{mount-three-ingest-root-DVbACDUy.js → mount-three-ingest-root-DIDBfvIH.js} +1 -1
  178. package/dist/assets/{mounted-authoring-Clftxx0x.js → mounted-authoring-B7RL_V28.js} +1 -1
  179. package/dist/assets/{mounted-story-viewport-source-B4-eAYGI.js → mounted-story-viewport-source-CnYhX3vW.js} +1 -1
  180. package/dist/assets/{native-debug-module-2_HVupdg.js → native-debug-module-B-rWJfWE.js} +1 -1
  181. package/dist/assets/{navigation-CH3-zr1n.js → navigation-BVu-aVmF.js} +1 -1
  182. package/dist/assets/{navmesh.menu-Dfi-Pk-8.js → navmesh.menu-C3M63eR4.js} +1 -1
  183. package/dist/assets/{navmesh.service-Cz7QFY-M.js → navmesh.service-B0H1fUfn.js} +1 -1
  184. package/dist/assets/network-observer.service-CiR4Q9Q0.js +1 -0
  185. package/dist/assets/network.utility-CNG3eJ0E.js +1 -0
  186. package/dist/assets/{object3d-document-session-registry-DJDEDM0p.js → object3d-document-session-registry-OjqzJ86S.js} +2 -2
  187. package/dist/assets/{oid-transform-D5Kxt6ij.js → oid-transform-Bzc2ZJSH.js} +1 -1
  188. package/dist/assets/{particles-vRp0Lf3o.js → particles-Be7AvO4c.js} +1 -1
  189. package/dist/assets/pixi-authoring-adapter-B42K4md-.js +1 -0
  190. package/dist/assets/{pixi-live-write-target-BjDsBQbp.js → pixi-live-write-target-D56tQEe_.js} +1 -1
  191. package/dist/assets/play.command-CIGRq8ow.js +2 -0
  192. package/dist/assets/presentation-DGBuGP6i.js +1 -0
  193. package/dist/assets/{product-CxmUIxmr.js → product-BN31wSnB.js} +1 -1
  194. package/dist/assets/{profiler.action-Dzy9DuAc.js → profiler.action-D57Kj9ym.js} +1 -1
  195. package/dist/assets/{profiler.menu-jLDO3U6N.js → profiler.menu-Dh9Q5DDx.js} +1 -1
  196. package/dist/assets/{profiler.utility-Do2Bw7MY.js → profiler.utility-DLNySW3w.js} +1 -1
  197. package/dist/assets/{project-authoring-session-C3eusefK.js → project-authoring-session-LCJAwGrD.js} +2 -2
  198. package/dist/assets/{properties-bone-constraints.inspector-B_PbSMV7.js → properties-bone-constraints.inspector-CaIDq5nN.js} +1 -1
  199. package/dist/assets/{properties-bone.inspector-CMDEQuBd.js → properties-bone.inspector-D2fcQGMF.js} +1 -1
  200. package/dist/assets/{properties-collection.inspector-D7Ay8yRj.js → properties-collection.inspector-CF5AtTAd.js} +1 -1
  201. package/dist/assets/{properties-constraints.inspector-DS1fZgXK.js → properties-constraints.inspector-Bj2itDrS.js} +1 -1
  202. package/dist/assets/{properties-data.inspector-k2pGN2Mp.js → properties-data.inspector-BfRqk0Xo.js} +1 -1
  203. package/dist/assets/{properties-material.inspector-Bb3yAGUx.js → properties-material.inspector-Bf8H0mvu.js} +1 -1
  204. package/dist/assets/{properties-modifiers.inspector-BcJfe-Wy.js → properties-modifiers.inspector-BKShc1TH.js} +1 -1
  205. package/dist/assets/{properties-object.inspector-CUSfXJuq.js → properties-object.inspector-YBh8ABnN.js} +1 -1
  206. package/dist/assets/{properties-output.inspector-BTVW2kn1.js → properties-output.inspector-CVkzfs-l.js} +1 -1
  207. package/dist/assets/{properties-particles.inspector-Cw0fxx3B.js → properties-particles.inspector-ChDpAq-2.js} +1 -1
  208. package/dist/assets/{properties-physics.inspector-C-0bD2bu.js → properties-physics.inspector-BLEM7aMj.js} +1 -1
  209. package/dist/assets/{properties-render.inspector-C8D5UpjX.js → properties-render.inspector-vU4D9xLL.js} +1 -1
  210. package/dist/assets/{properties-scene.inspector-HjK6QHGg.js → properties-scene.inspector-C-DoN-kL.js} +1 -1
  211. package/dist/assets/{properties-texture.inspector-CckZgUaI.js → properties-texture.inspector-DySxy1oU.js} +1 -1
  212. package/dist/assets/{properties-view-layer.inspector-C1ajtVSk.js → properties-view-layer.inspector-DEKxMahJ.js} +1 -1
  213. package/dist/assets/{properties-world.inspector-BiT_EdT-.js → properties-world.inspector-m5qL_TQV.js} +1 -1
  214. package/dist/assets/r3f-design-session-C0DPEChS.js +2 -0
  215. package/dist/assets/{r3f-physics-binding-DzrbpqjM.js → r3f-physics-binding-Bgzzd4ol.js} +1 -1
  216. package/dist/assets/{r3f-source-authoring-adapter-DbbeRcvt.js → r3f-source-authoring-adapter-C8oMjdTL.js} +2 -2
  217. package/dist/assets/{react-canvas-navigation-Cp3cOHJa.js → react-canvas-navigation-Jowa_lJq.js} +1 -1
  218. package/dist/assets/react-inspector.service-TfTdj_Qk.js +1 -0
  219. package/dist/assets/{react-story-board-GaXqr03H.js → react-story-board-Bx7qYytV.js} +1 -1
  220. package/dist/assets/{react-three-rapier.esm-U8J7g6tH.js → react-three-rapier.esm-BR2ttgLS.js} +1 -1
  221. package/dist/assets/{react-world-authoring-adapter-DOjv2pYm.js → react-world-authoring-adapter-C1jPW_cN.js} +1 -1
  222. package/dist/assets/{realm-services-CnY105XU.js → realm-services-DefTrXnY.js} +1 -1
  223. package/dist/assets/{reflection-probe-capture.inspector-DqSW9p1v.js → reflection-probe-capture.inspector-C-6zrzZb.js} +1 -1
  224. package/dist/assets/{registry-CaCdF63N.js → registry-Z28XSZHF.js} +1 -1
  225. package/dist/assets/{relative-import-specifier-BFKIWEWs.js → relative-import-specifier-DQzkawgj.js} +1 -1
  226. package/dist/assets/{render-env-BkKZ4uMA.js → render-env-BZ7LsGfk.js} +1 -1
  227. package/dist/assets/{render-features-rxbawsRb.js → render-features-C7QwmhCo.js} +1 -1
  228. package/dist/assets/{render-settings-DS5leCed.js → render-settings-BBvkacR3.js} +1 -1
  229. package/dist/assets/{resolve-three-CVnMRHxw.js → resolve-three-C7zDbK29.js} +9 -9
  230. package/dist/assets/{root-seam-contract-CxLZaRio.js → root-seam-contract-rGNbiX6q.js} +1 -1
  231. package/dist/assets/run-selection-BUeubtHj.js +2 -0
  232. package/dist/assets/{scene-capture-0a-bTjT8.js → scene-capture-BTWgUzhI.js} +1 -1
  233. package/dist/assets/{scene-document.service-CeDwVA7t.js → scene-document.service-DJJp-la1.js} +2 -2
  234. package/dist/assets/{scene-framing-BQt72ZCw.js → scene-framing-PVMqGU8h.js} +1 -1
  235. package/dist/assets/{seeded-random-BgCwIAAU.js → seeded-random-38To73fI.js} +1 -1
  236. package/dist/assets/{setup-renderer-Cwkl1Ar6.js → setup-renderer-OOw1SykJ.js} +1 -1
  237. package/dist/assets/{source-object3d-authoring-adapter-DF679Ncb.js → source-object3d-authoring-adapter-RmutT5Dt.js} +1 -1
  238. package/dist/assets/{source-persistence-backend-CwLYVPXj.js → source-persistence-backend-HviqjKZ2.js} +1 -1
  239. package/dist/assets/{stage-keyboard-B8BEW592.js → stage-keyboard-DDi7S27C.js} +1 -1
  240. package/dist/assets/stage-overlay-set-olkNSZmq.js +1 -0
  241. package/dist/assets/{stage-presence-markers-DIP7YMcO.js → stage-presence-markers-cznMN_qq.js} +1 -1
  242. package/dist/assets/stage-transform-tools-BDUZqRIR.js +1 -0
  243. package/dist/assets/{standard-viewport-dressing-BCA51Tum.js → standard-viewport-dressing-BZyuxyVl.js} +1 -1
  244. package/dist/assets/{state-watch.action-DnR5Zjr-.js → state-watch.action-DEdb1mNa.js} +1 -1
  245. package/dist/assets/{state-watch.menu-wYLCLsAw.js → state-watch.menu-jWbUM3kw.js} +1 -1
  246. package/dist/assets/{state-watch.utility-CFG1Tu1m.js → state-watch.utility-DDmn3G25.js} +1 -1
  247. package/dist/assets/{story-capture-BmnwHGDV.js → story-capture-Dj1xkeKH.js} +1 -1
  248. package/dist/assets/{story-documents-BTo90DiA.js → story-documents-8ehMyYHo.js} +2 -2
  249. package/dist/assets/{story-documents.service-yagl1wGp.js → story-documents.service-BzQCuNBu.js} +1 -1
  250. package/dist/assets/{story-documents.service-B6v7Z-WE.js → story-documents.service-iNP-ORNr.js} +1 -1
  251. package/dist/assets/{story-media-presence-BqRMu572.js → story-media-presence-zTPlU9HR.js} +1 -1
  252. package/dist/assets/{story-pixi-preview-Da6afqLg.js → story-pixi-preview-B7THvSl7.js} +1 -1
  253. package/dist/assets/{story-presentation-DMSYRWaz.js → story-presentation-BLXYPadR.js} +1 -1
  254. package/dist/assets/{story-three-preview-R1JvrggS.js → story-three-preview-B1nNiPwP.js} +2 -2
  255. package/dist/assets/{studio-environment-DRxxq_QX.js → studio-environment-yaKaHPxH.js} +1 -1
  256. package/dist/assets/{surface-state-1lTOi8FD.js → surface-state-D9j6qNu8.js} +1 -1
  257. package/dist/assets/{syntactic-prop-specs-eiQXwMIc.js → syntactic-prop-specs-BTnsMOvH.js} +1 -1
  258. package/dist/assets/team-playtest.service-Ds9tkO4q.js +1 -0
  259. package/dist/assets/{three-authoring-adapter-htbnVej2.js → three-authoring-adapter-BrkGH4cd.js} +1 -1
  260. package/dist/assets/three-authoring.service-DoamZDMx.js +2 -0
  261. package/dist/assets/{three-ingest-runtime-B7rtg3QE.js → three-ingest-runtime-CXKjNysA.js} +1 -1
  262. package/dist/assets/{three-integration-BdN5Nhsg.js → three-integration-CuAnYaTW.js} +2 -2
  263. package/dist/assets/three-integration.service-Db-VabIm.js +1 -0
  264. package/dist/assets/{three-TCuY32m_.js → three-oYrcK5SQ.js} +1 -1
  265. package/dist/assets/{three-projection-core-CG01r5Ta.js → three-projection-core-jBJVt6O0.js} +1 -1
  266. package/dist/assets/{three-state-DwFE3ay2.js → three-state-wXRU3rLr.js} +1 -1
  267. package/dist/assets/{three-story-capture.service-CvpV3v5a.js → three-story-capture.service-DMJRcqjr.js} +2 -2
  268. package/dist/assets/{three-story-model-C2r2BuiA.js → three-story-model-DgiAP-oQ.js} +1 -1
  269. package/dist/assets/{three-viewport-presentation-B0z_cECu.js → three-viewport-presentation-CgO3eWJ-.js} +1 -1
  270. package/dist/assets/transform-mode-request-BnKpgRUW.js +1 -0
  271. package/dist/assets/transport-strip-a9yLoPsI.js +1 -0
  272. package/dist/assets/transport.header-CpfoppXc.js +1 -0
  273. package/dist/assets/{tuples-DfWSY2tr.js → tuples-CKsHOV9T.js} +1 -1
  274. package/dist/assets/ui-board-document-DtTR_mBr.js +2 -0
  275. package/dist/assets/{user-data-Bpj7diUS.js → user-data-CqOoAowZ.js} +1 -1
  276. package/dist/assets/{utility-view-state-CAfbFbKQ.js → utility-view-state-Db97zwDz.js} +1 -1
  277. package/dist/assets/{viewport-door-Bj_ZIP85.js → viewport-door-DVkMQazS.js} +1 -1
  278. package/dist/assets/{viewport-root-presentation-vgxsTyj4.js → viewport-root-presentation-B35t51xX.js} +1 -1
  279. package/dist/assets/{viewport-surface-status-cwCiBGa7.js → viewport-surface-status-D5kZtFW5.js} +1 -1
  280. package/dist/assets/{webworkerAll-Cm3gTjWi.js → webworkerAll-CfKEb4Ao.js} +1 -1
  281. package/dist/assets/{workspace-arrangement-BdAlBwvd.js → workspace-arrangement-DIMM7ska.js} +1 -1
  282. package/dist/assets/world-documents-C4t3iOD-.js +1 -0
  283. package/dist/assets/world-root-stage-binding-ydl3JN1a.js +1 -0
  284. package/dist/assets/{xstate-animation-binding-BGLxcZT_.js → xstate-animation-binding-aQEmNSpm.js} +1 -1
  285. package/dist/assets/{xstate-animation-meta-D_T441Ru.js → xstate-animation-meta-CnMX1Sc1.js} +1 -1
  286. package/dist-node/cli.js +29 -24
  287. package/dist-node/create.js +14 -9
  288. package/package.json +18 -16
  289. package/template/.agents/skills/vgai-music/SKILL.md +28 -4
  290. package/template/package.json +13 -11
  291. package/template/src/input.ts +1 -1
  292. package/template/src/main.ts +74 -3
  293. package/dist/assets/CanvasBoardDocument-mxL0oJ3N.js +0 -1
  294. package/dist/assets/CanvasSceneViewport-C_mapCwC.js +0 -1
  295. package/dist/assets/InspectorObjectPreview-W-y079DS.js +0 -1
  296. package/dist/assets/ModelAssetDocument-De1HKuxG.js +0 -1
  297. package/dist/assets/Object3DDocumentToolbar-Cks81kCS.js +0 -1
  298. package/dist/assets/Object3DDocumentViewport-DCwiSY3O.js +0 -2
  299. package/dist/assets/OnlineAssetDetail-CNuwSQRQ.js +0 -1
  300. package/dist/assets/PlayBar-bT8Xdrap.js +0 -1
  301. package/dist/assets/ReactCanvasControls-CnJrPj-B.js +0 -1
  302. package/dist/assets/RootSelectionOverlay-CpaGluQu.js +0 -1
  303. package/dist/assets/ShadowEditor-CVtMlALn.js +0 -1
  304. package/dist/assets/StageHost-B89HKcvd.js +0 -2
  305. package/dist/assets/Toolbar-DkTHnQto.js +0 -1
  306. package/dist/assets/ViewportShadingMenu-CXPi6fl8.js +0 -1
  307. package/dist/assets/adapter-runtime-bindings-4cmsRvRh.js +0 -2
  308. package/dist/assets/autoplay.service-CjPnv3QW.js +0 -1
  309. package/dist/assets/binding-resolver-dE0GnZT5.js +0 -2
  310. package/dist/assets/blender.keymap-_rF_vRX8.js +0 -1
  311. package/dist/assets/bridge.command-BF00Iefm.js +0 -3
  312. package/dist/assets/build-profiles.document-CqNrDdh9.js +0 -2
  313. package/dist/assets/build-session-GZcSAfPN.js +0 -9
  314. package/dist/assets/build.header-Bt1kwHWl.js +0 -1
  315. package/dist/assets/canvas-design-mount-BbLW_Nci.js +0 -6
  316. package/dist/assets/canvas-entry-runtime-UNYuSfG0.js +0 -2
  317. package/dist/assets/component-verbs.service-CnA11bJq.js +0 -1
  318. package/dist/assets/create-runtime-DBfUy0SO.js +0 -3
  319. package/dist/assets/debug-bridge-D3_-EgRE.js +0 -1
  320. package/dist/assets/editor-api-BFTIRlWa.js +0 -1
  321. package/dist/assets/entry-adjudication-Dc18TIqT.js +0 -1
  322. package/dist/assets/fork-menu-DpKqRhF5.js +0 -1
  323. package/dist/assets/game-document.service-Chmt4065.js +0 -1
  324. package/dist/assets/game-eval.command-DRSvOJ_1.js +0 -2
  325. package/dist/assets/game-network-Ct2FQYmu.js +0 -1
  326. package/dist/assets/gameplay.command-Boqv1hnc.js +0 -1
  327. package/dist/assets/generation.service-o9aXlsx4.js +0 -1
  328. package/dist/assets/index-BHoAKyAC.js +0 -1
  329. package/dist/assets/ingest-siblings-BtiEXLnh.js +0 -1
  330. package/dist/assets/instances.command-BwayrqNm.js +0 -1
  331. package/dist/assets/layered-pick-kiQf53t5.js +0 -1
  332. package/dist/assets/model-asset-sections.service-CqSclZGY.js +0 -1
  333. package/dist/assets/module-mode-BH2R93XP.js +0 -2
  334. package/dist/assets/mount-canvas-ingest-root-D1z9i5B3.js +0 -2
  335. package/dist/assets/mount-dom-ingest-root-BAmmNxlm.js +0 -2
  336. package/dist/assets/mount-ingest-root-DYR0TMIt.js +0 -2
  337. package/dist/assets/mount-manifest-DdkFYdVA.js +0 -1
  338. package/dist/assets/network-observer.service-Ce83TdsU.js +0 -1
  339. package/dist/assets/network.utility-DFDul2Xb.js +0 -1
  340. package/dist/assets/pixi-authoring-adapter-BChknIdC.js +0 -1
  341. package/dist/assets/play-mode-DICV4cKP.js +0 -22
  342. package/dist/assets/play.command-NHyi5rzF.js +0 -2
  343. package/dist/assets/presentation-BeNFBfKg.js +0 -1
  344. package/dist/assets/r3f-design-session-B5GsZI5M.js +0 -2
  345. package/dist/assets/react-inspector.service-Bm0OnanU.js +0 -1
  346. package/dist/assets/run-selection-DzEkGesJ.js +0 -2
  347. package/dist/assets/stage-overlay-set-BGE03mqb.js +0 -1
  348. package/dist/assets/stage-transform-tools-BQB7EY4l.js +0 -1
  349. package/dist/assets/team-playtest.service-hLfjgScx.js +0 -1
  350. package/dist/assets/three-authoring.service-BIQAtVdX.js +0 -2
  351. package/dist/assets/three-integration.service-CS8Nvbd2.js +0 -1
  352. package/dist/assets/transform-mode-request-DzD9aUNA.js +0 -1
  353. package/dist/assets/transport-strip-CUjNltnb.js +0 -1
  354. package/dist/assets/transport.header-Bb4FpQ8J.js +0 -1
  355. package/dist/assets/ui-board-document-CCiiXjX9.js +0 -2
  356. package/dist/assets/world-documents-DBybpBq8.js +0 -1
  357. package/dist/assets/world-root-stage-binding-ZVYIgr74.js +0 -1
@@ -1,3 +0,0 @@
1
- import{assertNever as ce}from"./adapter-surface-Y37Nzcyw.js";import{createRootBinding as le}from"./binding-Bmxqznjk.js";import{stackOrder as B,resolveClaimingRoot as W}from"./root-stacking-BEd9ZvxC.js";import{createAssetCache as ue}from"./assets-BcrMQHRv.js";import{createHostRenderer as fe}from"./setup-renderer-Cwkl1Ar6.js";import{T as me}from"./three.module-BLhyNg0e.js";import{T as K,c as pe,p as he,r as ge,a as we,D as ye,b as be}from"./seeded-random-BgCwIAAU.js";import{c as ee,a as ve,r as Re,D as Ee,g as ke}from"./debug-registry-P0_YQGWd.js";import{formatLoopGateMessage as Se,formatAudioGateMessage as $e}from"./loop-gate-report-N52EWFGD.js";import{bindScopedSystem as Ae}from"./system-slot-E2mEdiih.js";import{hasUserData as Pe}from"./user-data-dHvLdpwM.js";import{e3 as F,kx as _}from"./index-BRJMIUK0.js";import{c as Oe}from"./performance-profiler-OwnXQX0M.js";const De=1e3;function xe(e){const t=e.fixedTimestep??.016666666666666666,n=e.maxSubSteps??8,o=e.externalDrive??!1;let u=0,d=0,f=!1,w=0,g=1,b=!1,r=!1;function s(){o||!r||typeof document>"u"||(document.hidden?f&&(f=!1,cancelAnimationFrame(w),b=!0):b&&(b=!1,f=!0,d=performance.now(),u=0,w=requestAnimationFrame(p)))}function a(){s()}function p(E){if(!f)return;w=requestAnimationFrame(p);const v=(E-d)/1e3;d=E;const $=he(u,v,g,{fixedDt:t,maxSubSteps:n});u=$.accumulator;for(let P=0;P<$.steps;P++)e.update(t);e.render?.($.alpha,$.displayDt)}return{start(){if(!f&&(f=!0,b=!1,d=performance.now(),u=0,!o)){if(!r&&typeof document<"u"&&(document.addEventListener("visibilitychange",a),r=!0),typeof document<"u"&&document.hidden){f=!1,b=!0;return}w=requestAnimationFrame(p)}},stop(){f=!1,b=!1,cancelAnimationFrame(w),r&&typeof document<"u"&&(document.removeEventListener("visibilitychange",a),r=!1)},get isRunning(){return s(),f},get liveness(){return s(),b||f&&!o&&performance.now()-d>De?"loop-starved":f?"running":"stopped"},set timeScale(E){const v=pe(E);v!==E&&console.warn(`[game-loop] timeScale ${E} is out of range [${K.min}, ${K.max}]; clamped to ${v}.`),g=v},get timeScale(){return g},get fixedDt(){return t}}}const Fe={cancel(){}};function j(e){return new DOMException(e,"AbortError")}function H(e,t){if(!Number.isFinite(t)||t<0)throw new RangeError(`SimClock.${e}: seconds must be a finite, non-negative number, got ${t}`)}function Te(e){const t=e.dispose;let n=0,o=0,u=0,d=!1;const f=new Set,w=new Set;function g(r){r.cancelled||(r.cancelled=!0,f.delete(r),r.detachAbort?.(),r.detachAbort=null)}function b(r,s,a){H("after",r);const p=a?.signal;if(d||p?.aborted)return Fe;const E={dueAt:n+r,seq:u++,fn:s,cancelled:!1,detachAbort:null};if(f.add(E),p){const v=()=>g(E);p.addEventListener("abort",v,{once:!0}),E.detachAbort=()=>p.removeEventListener("abort",v)}return{cancel(){g(E)}}}return{now:()=>n,tickNow:()=>o,after:b,delay(r,s){H("delay",r);const a=s?.signal;return a?.aborted?Promise.reject(j("SimClock.delay: aborted before it was scheduled")):d?Promise.reject(j("SimClock.delay: the sim clock is disposed")):new Promise((p,E)=>{let v=null,$=null,P=!1;const D=()=>{P=!0,w.delete(T),$?.(),$=null};function T(C){P||(D(),v?.cancel(),E(j(C)))}if(v=b(r,()=>{P||(D(),p())}),w.add(T),a){const C=()=>T("SimClock.delay: aborted");a.addEventListener("abort",C,{once:!0}),$=()=>a.removeEventListener("abort",C)}})},disposeAfter(r,s){return H("disposeAfter",s),b(s,()=>t(r))},flush(r){if(d||(n=r,o++,f.size===0))return;const s=[];for(const a of f)!a.cancelled&&a.dueAt<=n&&s.push(a);if(s.length!==0){s.sort((a,p)=>a.dueAt-p.dueAt||a.seq-p.seq);for(const a of s)if(!a.cancelled){g(a);try{a.fn()}catch(p){console.error("[sim-clock] timer callback threw:",p)}}}},dispose(){if(d)return;d=!0;for(const s of f)s.detachAbort?.(),s.detachAbort=null,s.cancelled=!0;f.clear();const r=[...w];w.clear();for(const s of r)s("SimClock: disposed while a delay was pending")}}}const Ce=ee("sim-clock");function Me(e,t){Ce.set(e,t)}function Le(e,t="world"){const n=new Map,o=[],u=new Map;let d=0;for(const r of F)n.set(r,[]);let f=!1;const w=new Map;for(const r of F)w.set(r,new Set);const g=new Set;function b(r,s,a){const p=u.get(r)??r.name??`anonymous-${++d}`;u.set(r,p),e?.beginSystem(t,s,p);try{r(a)}catch(E){const v=r.name?`"${r.name}"`:"(anonymous)";console.error(`[system-runner] system ${v} in phase "${s}" threw:`,E)}finally{e?.endSystem(t,s,p)}}return{add(r,s,a){const p=n.get(r);if(!p)throw new Error(`Unknown phase: ${r}. Valid phases: ${F.join(", ")}`);p.push(s),u.set(s,a?.name??s.name??`anonymous-${++d}`)},remove(r,s){const a=n.get(r);if(!a)return;const p=a.indexOf(s);p!==-1&&a.splice(p,1),w.get(r)?.delete(s)},register(r){const s=n.get(r.phase);if(!s)throw new Error(`Unknown phase: ${r.phase}. Valid phases: ${F.join(", ")}`);s.push(r.update),u.set(r.update,r.name??r.update.name??`anonymous-${++d}`),o.push(r)},unregister(r){const s=n.get(r.phase);if(s){const p=s.indexOf(r.update);p!==-1&&s.splice(p,1)}w.get(r.phase)?.delete(r.update);const a=o.indexOf(r);a!==-1&&o.splice(a,1),g.delete(r),r.dispose?.()},runInit(){const r=[...o].sort((s,a)=>F.indexOf(s.phase)-F.indexOf(a.phase));for(const s of r)s.init?.()},runDispose(){for(const r of o){const s=n.get(r.phase);if(s){const a=s.indexOf(r.update);a!==-1&&s.splice(a,1)}r.dispose?.()}o.length=0},runPhase(r,s){const a=n.get(r);if(!a)throw new Error(`Unknown phase: ${r}. Valid phases: ${F.join(", ")}`);const p=w.get(r),E=[];for(const v of a)f&&!p.has(v)?E.push(v):b(v,r,s);for(const v of E)b(v,r,s)},run(r){for(const s of F)this.runPhase(s,r)},markEngineBoundary(){for(const r of F){const s=w.get(r);for(const a of n.get(r))s.add(a)}for(const r of o)g.add(r);f=!0},removeAllNonEngine(){if(!f)return;const r=o.filter(a=>g.has(a)),s=o.filter(a=>!g.has(a));o.length=0,o.push(...r);for(const a of s)a.dispose?.();for(const a of F){const p=n.get(a),E=w.get(a),v=p.filter($=>E.has($));p.length=0,p.push(...v)}},count(r){if(r)return n.get(r)?.length??0;let s=0;for(const a of n.values())s+=a.length;return s}}}function _e(e){if(!e)return"<unknown call site — no stack captured>";const t=e.split(`
2
- `);return(t[2]??t[1]??t[0]??"<unknown call site>").trim()}function Ie(e=t=>{console.warn(t)}){const t=new Set;let n;function o(){const u=_e(new Error().stack);return t.has(u)||(t.add(u),e(`[determinism] the global Math.random generator was drawn from during a gameplay frame while this project declares determinism.seededRandom — use ctx.random() / ctx.random.stream(name) instead. Call site:
3
- ${u}`)),n()}return{enable(){n=Math.random,Math.random=o},disable(){Math.random===o&&n&&(Math.random=n,n=void 0)}}}const te=ee("gameplay-rng-trap");function Ge(e,t){te.set(e,t)}function At(e){return te.get(e)??null}const Ne=F.filter(e=>e===_.PRE_RENDER||e===_.RENDER);function U(e){const{id:t,kind:n,pausable:o=!0,adapter:u,mounted:d,scene:f,canvasRoot:w,container:g,physics:b,collisions:r,physics2d:s,camera:a,frame:p,binding:E=null}=e;if(n==="three"&&!f)throw new Error(`RootInstance "${t}" (kind: three): a three world requires a scene — pass \`scene\` in RootInstanceInit.`);if(n==="canvas"&&w==null)throw new Error(`RootInstance "${t}" (kind: canvas): a canvas world requires a native substrate root — pass \`canvasRoot\` in RootInstanceInit.`);if(n==="dom"&&!g)throw new Error(`RootInstance "${t}" (kind: react): a react world requires a container — pass \`container\` in RootInstanceInit.`);let v=!1;const $=d.dispose.bind(d);return d.dispose=()=>{v=!0,$()},{id:t,kind:n,pausable:o,adapter:u,mounted:d,physics:b,collisions:r,physics2d:s,camera:a,frame:p?{runPhase(D,T){v||p.runPhase(D,T)},endFrame(){v||p.endFrame?.()}}:void 0,binding:E,get disposed(){return v},threeScene(){if(n!=="three"||!f)throw new Error(`RootInstance "${t}" (kind: ${n}): threeScene() requested but this world is not a three world`);return f},canvasRoot(){if(n!=="canvas"||w===void 0||w===null)throw new Error(`RootInstance "${t}" (kind: ${n}): canvasRoot() requested but this world is not a canvas world`);return w},reactRoot(){if(n!=="dom"||!g)throw new Error(`RootInstance "${t}" (kind: ${n}): reactRoot() requested but this world is not a react world`);return g}}}function ze(e){const{physics:t,rapierWorld:n}=e;return!t||!n?null:{physics:t,rapierWorld:n}}function qe(e,t){const n=[];e.traverse(o=>n.push(o));for(const o of t){const u=ze(o);if(u)for(const d of n){const f=u.physics.get(d);f&&(u.rapierWorld.removeRigidBody(f.body),u.physics.remove(d))}}e.removeFromParent();for(const o of n){const u=o;Pe(o,"__sharedGeometry")||u.geometry?.dispose();const d=u.material;if(Array.isArray(d))for(const f of d)f.dispose();else d?.dispose()}}function je(e){return[]}function He(e){const t=[],n=Oe(),o=Le(n.systemObserver,"game"),u=we(e.seed??ye),d=Ie();let f=!1;const w={setEnabled(i){f=i},get enabled(){return f}};let g=0,b=0,r=0;const s=new Set,a=Te({dispose:i=>qe(i,t.flatMap(je))}),p=ve({getTick:()=>g,getSimT:()=>b,getFixedDt:()=>e.loop.fixedDt,getDefaultRootId:()=>t.length>0?v().id:null,getLoopLiveness:()=>e.loop.liveness});let E=!1;function v(){if(t.length===0)throw new Error("Game.defaultRoot: no roots registered yet");return t.find(i=>i.kind==="three")??t[0]}const $=new Set,P=new Set,D=new Map,T=new Map;function C(){const i={debug:p.adapter},h=new Map([["debug","(game)"]]),k=(y,c,R)=>{for(const l of Object.keys(c)){if(c[l]===void 0)continue;const m=h.get(l);if(m!==void 0){if(i[l]===c[l]||R?.has(l))continue;$.has(l)||($.add(l),console.warn(`[game] systemAdapters: "${l}" is registered by both ${m} and ${y} — the FIRST registration (${m}) wins; the later one is shadowed (game-scoped system adapters).`));continue}i[l]=c[l],h.set(l,y)}};for(const y of t){const c=D.get(y.id);c&&k(`world "${y.id}" (declared systems export)`,c);const R=y.mounted.systems;R&&k(`world "${y.id}"`,R,c?new Set(Object.keys(c)):void 0)}return i}let A=!1;const x=new Set;function I(i,h,k){const y=`${i}:${h}`;if(x.has(y))return;x.add(y);const c=i==="loop"?Se({worldId:h,reason:k}):$e({worldId:h,reason:k});console.warn(c)}const L=new WeakMap;function z(i){for(const h of t){if(h.disposed||!h.pausable)continue;h.mounted.drivesOwnLoop&&(h.mounted.setPaused?h.mounted.setPaused(i):i&&I("loop",h.id,"self-driven world, adapter declares no setPaused capability"));const k=D.get(h.id)?.audio??h.mounted.systems?.audio;k?i?(L.has(k)||L.set(k,k.isMuted()),k.setMuted(!0)):L.has(k)&&(k.setMuted(L.get(k)),L.delete(k)):i&&!T.get(h.id)?.some(y=>y.slot==="audio")&&I("audio",h.id,"no SystemAdapters.audio on this world")}}function G(i,h){f&&d.enable(),n.beginFrame();const k=h?.skipRenderPhases??!1,y=h?.onlyFrozen??!1,c=t.length;E=!1;for(let l=0;l<c;l++){const m=t[l];if(!m.disposed){if(y){if(A&&m.pausable&&!m.mounted.drivesOwnLoop){E=!0;break}}else if(m.mounted.drivesOwnLoop?!A||!m.pausable||!m.mounted.setPaused:!A||!m.pausable){E=!0;break}}}let R=!1;if(!y)for(let l=0;l<c;l++){const m=t[l];if(!m.disposed&&m.mounted.drivesOwnLoop&&(!A||!m.pausable||!m.mounted.setPaused)){R=!0;break}}if(y){for(const l of F){n.beginPhase(),E&&o.runPhase(l,i);for(let m=0;m<c;m++){const S=t[m];if(!S.disposed&&!S.mounted.drivesOwnLoop&&A&&S.pausable)try{S.frame?.runPhase(l,i)}catch(O){console.error(`[game] world "${S.id}" (kind: ${S.kind}) runPhase("${l}") threw (step()):`,O)}}n.endPhase(l)}for(let l=0;l<c;l++){const m=t[l];if(!m.disposed&&!m.mounted.drivesOwnLoop&&A&&m.pausable)if(R=!0,m.frame)try{m.frame.endFrame?.()}catch(S){console.error(`[game] world "${m.id}" (kind: ${m.kind}) endFrame() threw (step()):`,S)}else try{m.mounted.update?.(i)}catch(S){console.error(`[game] world "${m.id}" (kind: ${m.kind}) update() threw (step()):`,S)}}}else{for(const l of F){if(n.beginPhase(),!(k&&(l===_.PRE_RENDER||l===_.RENDER))){o.runPhase(l,i);for(let S=0;S<c;S++){const O=t[S];if(O.disposed||O.mounted.drivesOwnLoop)continue;const V=A&&O.pausable;if(V&&l!==_.RENDER)continue;const ae=V?0:i;try{O.frame?.runPhase(l,ae)}catch(de){console.error(`[game] world "${O.id}" (kind: ${O.kind}) runPhase("${l}") threw:`,de)}}}n.endPhase(l)}for(let l=0;l<c;l++){const m=t[l];if(!(m.disposed||m.mounted.drivesOwnLoop||A&&m.pausable)){if(R=!0,m.frame)try{m.frame.endFrame?.()}catch(O){console.error(`[game] world "${m.id}" (kind: ${m.kind}) endFrame() threw:`,O)}else if(!(k&&m.mounted.updateCadence==="display"))try{m.mounted.update?.(i)}catch(O){console.error(`[game] world "${m.id}" (kind: ${m.kind}) update() threw:`,O)}}}}R&&(g++,b+=i,a.flush(b)),n.endFrame(),f&&d.disable()}function q(i,h){if(r=i,f&&d.enable(),n.beginFrame(),s.size>0)for(const y of[...s])try{y(i,h)}catch(c){console.error("[game] an onRenderStep callback threw:",c)}const k=t.length;for(const y of Ne){n.beginPhase(),o.runPhase(y,h);for(let c=0;c<k;c++){const R=t[c];if(R.disposed||R.mounted.drivesOwnLoop)continue;const l=A&&R.pausable;if(!(l&&y!==_.RENDER))try{R.frame?.runPhase(y,l?0:h)}catch(m){console.error(`[game] world "${R.id}" (kind: ${R.kind}) runPhase("${y}") threw (display frame):`,m)}}n.endPhase(y)}for(let y=0;y<k;y++){const c=t[y];if(c.disposed||c.mounted.drivesOwnLoop||c.frame||c.mounted.updateCadence!=="display")continue;const R=A&&c.pausable;try{c.mounted.update?.(R?0:h)}catch(l){console.error(`[game] world "${c.id}" (kind: ${c.kind}) update() threw (display frame):`,l)}}n.endFrame(),f&&d.disable()}const M={loop:e.loop,assets:e.assets,playtest:e.playtest??null,profiler:n,systems:o,get roots(){return t},world(i){return t.find(h=>h.id===i)??null},get defaultRoot(){return v()},get systemAdapters(){return C()},subscribeSystemAdapters(i){return P.add(i),()=>P.delete(i)},notifySystemAdaptersChanged(){for(const i of P)i()},get declaredSystemAbsences(){return[...T.values()].flat()},installDeclaredSystemAdapters(i,h,k=[]){const y=t.find(l=>l.id===i);if(!y)throw new Error(`installDeclaredSystemAdapters: no mounted root is named "${i}" (mounted: ${t.map(l=>`"${l.id}"`).join(", ")||"none"}).`);if(D.has(i))throw new Error(`installDeclaredSystemAdapters: root "${i}" already installed its declared systems — a declaration is static and installs exactly once per mount.`);const c=y.mounted.systemScope??y.mounted,R=Object.fromEntries(Object.entries(h).map(([l,m])=>[l,m===void 0?void 0:Ae(m,c)]));D.set(i,R),T.set(i,k),M.notifySystemAdaptersChanged()},play:{get paused(){return A},pause(){A||(A=!0,z(!0))},resume(){A&&(A=!1,z(!1))},step(i=1/60){if(A)for(const h of t)h.disposed||!h.pausable||!h.mounted.drivesOwnLoop||h.mounted.setPaused&&(h.mounted.step?h.mounted.step():I("loop",h.id,"self-driven world, adapter declares no step capability"));G(i,{onlyFrozen:!0})}},registerRoot(i){if(t.some(h=>h.id===i.id))throw new Error(`Game.registerRoot: duplicate world id "${i.id}"`);if(t.some(h=>h.mounted===i.mounted))throw new Error(`Game.registerRoot: world "${i.id}" shares its \`mounted\` object with an already-registered world ("${t.find(h=>h.mounted===i.mounted).id}") — the same mount cannot be registered twice.`);t.push(i),M.notifySystemAdaptersChanged(),i.mounted.drivesOwnLoop&&i.kind!=="dom"&&!i.mounted.observe&&console.warn(`[game] world "${i.id}" (kind: ${i.kind}, adapter: "${i.adapter.id}"): no state bridge — this mounted game has no \`observe\` (RootStateObserver); the editor's observations cannot subscribe to its state.`)},runFrame(i,h){G(i,h)},runRenderFrame(i,h){q(i,h)},get renderAlpha(){return r},onRenderStep(i,h){const k=h?.signal;if(k?.aborted)return()=>{};s.add(i);let y=null;const c=()=>{s.delete(i),y?.(),y=null};return k&&(k.addEventListener("abort",c,{once:!0}),y=()=>k.removeEventListener("abort",c)),c},runTicks(i,h){if(!Number.isInteger(i)||i<0)throw new RangeError(`Game.runTicks: n must be a non-negative integer, got ${i}`);if(A)throw new Ee("RUN_TICKS_PAUSED","Game.runTicks: refused — Game.play.paused is true; stepping the frozen set is Game.play.step()'s contract, not runTicks'");const k=h?.render??"last",y=e.loop.fixedDt;for(let c=0;c<i;c++){const R=c===i-1;G(y,{skipRenderPhases:k==="all"?!1:k==="none"?!0:!R})}},dispose(){a.dispose(),p.strip()}};return Re(M,p),p.setRunTicksTarget({runTicks:M.runTicks}),ge(M,u),Ge(M,w),Me(M,a),M}function Be(e){B(e).forEach((n,o)=>{n.canvas.style.pointerEvents=o===0?"auto":"none"})}const X=["pointerdown","pointerup","pointermove","click","wheel"];function Ue(e){const t=e,n=["clientX","clientY","screenX","screenY","offsetX","offsetY","button","buttons","ctrlKey","altKey","shiftKey","metaKey","pointerId","pointerType","pressure","isPrimary","deltaX","deltaY","deltaZ","deltaMode"],o={bubbles:!1,cancelable:!0,composed:!0};for(const u of n)u in t&&(o[u]=t[u]);return o}function Ye(e,t){const n=globalThis,o=t.type==="wheel"?n.WheelEvent:t.type.startsWith("pointer")?n.PointerEvent:n.MouseEvent??n.PointerEvent;if(!(!o||typeof e.dispatchEvent!="function"))try{e.dispatchEvent(new o(t.type,Ue(t)))}catch{}}function Ve(e,t){Be(t);const n=new Map(t.map(d=>[d.id,d])),o=B(t)[0]?.id,u=d=>{const f=e.getBoundingClientRect?.()??{left:0,top:0},w=d.clientX??0,g=d.clientY??0,b=w-f.left,r=g-f.top,s=W(t,b,r);if(s&&s!==o){const a=n.get(s);a&&Ye(a.canvas,d)}};for(const d of X)e.addEventListener?.(d,u,!0);return{resolveClaim:(d,f)=>W(t,d,f),dispose(){for(const d of X)e.removeEventListener?.(d,u,!0)}}}function ne(e){return new URLSearchParams(e.search).get(be)==="1"}const We=[_.PRE_RENDER,_.RENDER];async function Ke(e){const t=Xe(e);for(const n of We){e.systems.runPhase(n,0);for(const o of t)o.frame.runPhase(n,0)}await Je()}function Xe(e){const t=[];for(const n of e.roots){if(n.mounted.drivesOwnLoop){Q(n.id,"drives its own loop — renderOnce() cannot frame-gate it");continue}if(!n.frame){Q(n.id,`(kind: ${n.kind}) has no phase hooks — renderOnce() cannot drive it (opaque/foreign mount with no frame-gated entry point)`);continue}t.push({id:n.id,frame:n.frame})}return t}function Q(e,t){console.warn(`[render-control] world "${e}" ${t}.`)}function Qe(e){const t=[];for(const n of e.roots){if(n.mounted.drivesOwnLoop){t.push(`world "${n.id}" drives its own loop — cannot be frame-gated for deterministic capture (the policy is to FAIL LOUDLY, or be excluded only by an explicit declared policy).`);continue}n.frame||t.push(`world "${n.id}" (kind: ${n.kind}) has no phase hooks — an opaque/foreign mount with no frame-gated entry point cannot participate in deterministic capture.`)}return t}function Z(e){let t=0,n=0;const o=[...e.children??[]];for(;o.length>0;){const u=o.pop();t++,u.userData?.entityId!==void 0&&n++,u.children&&o.push(...u.children)}return{nodes:t,entities:n}}function Ze(e){const t=[];for(const n of e.roots)n.kind==="three"?t.push({id:n.id,kind:n.kind,...Z(n.threeScene())}):n.kind==="canvas"&&n.mounted.kind==="canvas"&&n.mounted.substrate.name==="pixi"&&t.push({id:n.id,kind:n.kind,...Z(n.canvasRoot())});return t}function J(){return new Promise(e=>{requestAnimationFrame(()=>e())})}async function Je(){await J(),await J()}async function N(e){if(!e)return{status:"not-applicable"};try{return await e(),{status:"ready"}}catch(t){return{status:"error",detail:t instanceof Error?t.message:String(t)}}}async function et(){if(typeof document>"u"||!document.fonts)return{status:"not-applicable"};try{return await document.fonts.ready,{status:"ready"}}catch(e){return{status:"error",detail:e instanceof Error?e.message:String(e)}}}async function tt(e){const[t,n,o,u,d,f]=await Promise.all([N(e.assets),N(e.shaders),et(),N(e.sequences),N(e.tone),N(e.scene)]);return{assets:t,shaders:n,fonts:o,sequences:u,tone:d,scene:f}}function nt(e){const t=e.location??window.location;if(!ne(t))return;const{game:n,clock:o,readiness:u={}}=e,d=e.target??window,f=e.frameAdvancers??[],w=e.simulateFixedDt??1/60,g=e.excludedFromDeterminism??[],b={seek(r){o.seek(r)},seekFrame(r,s){o.seekFrame(r,s)},advanceFrame(r){for(const s of f)s(r)},renderOnce(){return Ke(n)},ready(){return tt(u)},simulateSubsteps(r){for(let s=0;s<r;s++)n.runFrame(w)},excludedFromDeterminism(){return[...g,...Qe(n)]},simulateFixedDt(){return w},perfSample(r){const s=n.profiler,a=s.enabled;s.enabled=!0,s.clear();const p=[];try{for(let E=0;E<r;E++){n.runFrame(w);const v=s.getSnapshot(),$=v.frames.at(-1);p.push({cpuMs:$?.cpuMs??0,phases:Object.fromEntries(($?.phases??[]).map(P=>[P.name,P.ms])),render:{...v.render}})}}finally{s.enabled=a}return{frames:p,worlds:Ze(n)}}};return d.__vgaiRender=b,b}function re(e,t,n,o){const u=o?.pausable??!0,d=U({id:o?.id??"main",kind:"three",pausable:u,adapter:t,mounted:n,scene:n.scene,binding:Y(e,o?.declaration,{surface:"three",adapter:t},n,u)});return e.registerRoot(d),d}function Y(e,t,n,o,u){return t?le({...t,adapter:n,mounted:o,pausable:u,debugRegistry:ke(e)}):null}function oe(e,t,n,o){const u=o?.id??"main",d=o?.pausable??!0,f=U({id:u,kind:"canvas",pausable:d,adapter:t,mounted:n,canvasRoot:n.substrate.root,binding:Y(e,o?.declaration,{surface:"canvas",adapter:t},n,d)});return e.registerRoot(f),f}function se(e,t,n,o,u){const d=u?.pausable??!0,f=U({id:u?.id??"main",kind:"dom",pausable:d,adapter:t,mounted:n,container:o,binding:Y(e,u?.declaration,{surface:"dom",adapter:t},n,d)});return e.registerRoot(f),f}async function rt(e){return ft(e)}function ot(e){return{domElement:e,render(){},setPixelRatio(){},setClearColor(){},setSize(){},dispose(){},forceContextLoss(){}}}function ie(e,t){try{e.mounted.dispose()}finally{e.renderer?.dispose(),e.renderer?.forceContextLoss();try{(e.element.parentNode??t).removeChild(e.element)}catch{}}}async function st(e,t){const{game:n,canvas:o,w:u,h:d,dpr:f,isBottom:w,headless:g,assets:b,antialias:r}=t,s=g?ot(o):fe(o,u,d,r===void 0?void 0:{antialias:r},{alpha:!w,preserveDrawingBuffer:!0});s.setSize(u,d,!1),o.style.width="100%",o.style.height="100%",s.setPixelRatio(f),w||s.setClearColor(0,0);const a={three:me,surface:{canvas:o,width:u,height:d},renderer:s,assets:b,headless:g,game:n},p=await e.adapter.mount(a);return re(n,e.adapter,p,{id:e.id,pausable:e.pausable,declaration:e.declaration}),{mountedEntry:{id:e.id,kind:"three",element:o,mounted:p,renderer:s},routerEntry:{id:e.id,zOrder:e.zOrder??0,canvas:o,hitTest:e.hitTest}}}async function it(e,t){const{game:n,canvas:o,w:u,h:d,dpr:f,headless:w,isBottom:g}=t,b={canvas:o,width:u,height:d,game:n,headless:w,dpr:f,transparent:!g,preserveDrawingBuffer:!0},r=await e.adapter.mount(b);return oe(n,e.adapter,r,{id:e.id,pausable:e.pausable,declaration:e.declaration}),{mountedEntry:{id:e.id,kind:"canvas",element:o,mounted:r,renderer:void 0},routerEntry:{id:e.id,zOrder:e.zOrder??0,canvas:o,hitTest:e.hitTest}}}async function at(e,t,n){n.style.pointerEvents="none",n.style.width="100%",n.style.height="100%";const o={container:n,game:t},u=await e.adapter.mount(o);return se(t,e.adapter,u,n,{id:e.id,pausable:e.pausable,declaration:e.declaration}),{mountedEntry:{id:e.id,kind:"dom",element:n,mounted:u,renderer:void 0}}}function dt(e){return()=>{}}async function ct(e,t,n){const{surfacesById:o,container:u,...d}=n,f=[],w=[];try{for(const g of e){const b=g.id===t;if(g.kind==="dom"){const E=o.get(g.id),{mountedEntry:v}=await at(g,d.game,E);f.push(v);continue}const r=o.get(g.id),s={...d,canvas:r,isBottom:b};let a,p;g.kind==="three"?{mountedEntry:a,routerEntry:p}=await st(g,s):g.kind==="canvas"?{mountedEntry:a,routerEntry:p}=await it(g,s):ce(g,"create-runtime mount loop"),f.push(a),w.push(p)}}catch(g){for(let b=f.length-1;b>=0;b--){const r=f[b];try{ie(r,u)}catch(s){console.error(`createGameRuntime: rolling back root "${r.id}" after a mount failure threw:`,s)}}throw g}return{mountedEntries:f,routerEntries:w}}function lt(e,t,n){const o=n??(typeof window<"u"?window:void 0);if(o!==void 0)return nt({game:e,clock:{seek(){},seekFrame(){}},readiness:{scene(){}},location:t,target:o}),()=>{delete o.__vgaiRender}}function ut(e,t,n){try{e.dispose()}catch(o){console.error("createGameRuntime: disposing the game after a mount failure threw:",o)}for(const o of t)try{(o.parentNode??n).removeChild(o)}catch{}}async function ft(e){const{container:t,roots:n,width:o,height:u,headless:d=!1,seed:f,playtest:w}=e;if(n.length===0)throw new Error("createGameRuntime: `roots` must contain at least one root.");const g=n,b=Math.max(1,o??t.clientWidth??0),r=Math.max(1,u??t.clientHeight??0),s=d?1:Math.min(typeof window<"u"&&window.devicePixelRatio||1,2);t.style.position||(t.style.position="relative");const a=g.map(c=>({id:c.id,zOrder:c.zOrder??0,hitTest:c.hitTest})),p=B(a),E=p[0]?.id,v=new Map(g.map(c=>[c.id,c.kind])),$=new Map;p.forEach((c,R)=>{const l=v.get(c.id)==="dom",m=document.createElement(l?"div":"canvas");if(m.dataset.vgaiRootSurface="true",m.dataset.vgaiRootId=c.id,!l){const S=m;S.width=b,S.height=r}m.style.cssText=`position:absolute;top:0;left:0;width:100%;height:100%;z-index:${R+1};contain:layout paint;`,t.appendChild(m),$.set(c.id,m)});const P=ue(),D=e.renderControl?.location??(typeof window<"u"?window.location:void 0),T=D!==void 0&&ne(D);let C=!1;const A=xe({fixedTimestep:1/60,maxSubSteps:8,externalDrive:T,update:c=>{C&&x.runFrame(c,{skipRenderPhases:!0})},render:(c,R)=>{C&&x.runRenderFrame(c,R)}}),x=He({loop:A,assets:P,seed:f,playtest:w});let I;try{I=await ct(g,E,{game:x,surfacesById:$,container:t,w:b,h:r,dpr:s,headless:d,assets:P,antialias:e.antialias})}catch(c){throw ut(x,$.values(),t),c}const{mountedEntries:L,routerEntries:z}=I,G=Ve(t,z);C=!0,A.start();const q=dt(),M=T&&D!==void 0?lt(x,D,e.renderControl?.target):void 0;let i;const h=new Promise(c=>{i=c});let k=!1;function y(){if(k)return;k=!0;const c=[],R=(l,m)=>{try{m()}catch(S){c.push({step:l,error:S})}};try{R("loop.stop",()=>A.stop()),R("router.dispose",()=>G.dispose());for(const l of L)R(`root "${l.id}"`,()=>ie(l,t));R("game.dispose",()=>x.dispose()),R("dev globals",()=>q()),R("render harness",()=>M?.())}finally{Promise.allSettled(L.map(l=>l.mounted.disposeComplete??Promise.resolve())).then(()=>i())}if(c.length>0)throw new AggregateError(c.map(l=>l.error),`Game session teardown failed in ${c.length} step(s): ${c.map(l=>l.step).join(", ")}. Every other step still ran.`)}return{stop:y,stopComplete:h,pause(){x.play.pause()},resume(){x.play.resume()},step(){x.play.step()},resize(c,R,l){const m=Math.max(1,c),S=Math.max(1,R);for(const O of L)l!==void 0&&O.renderer?.setPixelRatio(l),O.renderer?.setSize(m,S,!1),O.mounted.resize?.(m,S)},game:x}}const Pt=Object.freeze(Object.defineProperty({__proto__:null,createGameRuntime:rt,registerCanvasRoot:oe,registerReactRoot:se,registerThreeRoot:re},Symbol.toStringTag,{value:"Module"}));export{He as a,xe as b,rt as c,re as d,Pt as e,At as g,oe as r};
@@ -1 +0,0 @@
1
- import{D as v}from"./debug-registry-P0_YQGWd.js";import{r as _}from"./play-mode-DICV4cKP.js";const D="vgai-debug",T=100,E=50,k=100,P=60,b=2e3,V="the host loop reported liveness 'loop-starved' and this session has no way to drive ticks — no recent rAF progress was observed. Check `vgai status` for the separate visibility readings; foreground/reload the editor, or start play to wire the run-ticks target, then retry.";async function L(n,s,d){const i=()=>n.state("time"),c=i();let l=c.tick,u=0,g=0;for(;;){const r=i();if(r.simSeconds-c.simSeconds>=s)return{stalled:!1};if(r.loopLiveness==="loop-starved"){if(!d)return{stalled:!0,starvedWithoutDriver:!0};if(g>=b)return{stalled:!0};g+=1;const e=s-(r.simSeconds-c.simSeconds),t=r.fixedDt,o=t!==void 0&&Number.isFinite(t)&&t>0?Math.max(1,Math.ceil(e/t-1e-9)):1;d(Math.min(P,o));const a=i();if(a.tick===r.tick&&a.simSeconds===r.simSeconds)return{stalled:!0};l=a.tick,u=0,await Promise.resolve();continue}if(u=r.tick===l?u+1:0,l=r.tick,u>=k)return{stalled:!0};await new Promise(e=>setTimeout(e,E))}}function h(){return typeof window<"u"}function S(n){return new URLSearchParams(n.search).get(D)==="1"}function A(n){return n.debug?.allowInProduction===!0}function I(n){const{registry:s,manifest:d}=n,i=s.adapter,c=[];function l(e){c.push(e),c.length>T&&c.shift()}const u=e=>{l(e.message||String(e.error))},g=e=>{l(`Unhandled promise rejection: ${String(e.reason)}`)};n.window.addEventListener?.("error",u),n.window.addEventListener?.("unhandledrejection",g);function r(e,t){const o=s.getVirtualInputTarget(t);if(!o)throw new v("DEBUG_INPUT_UNAVAILABLE",`debug bridge: ${e}() has no virtual-input target wired — no root entry exports \`debug.input\` (the game's own input door), or none has mounted yet`);return o}return{version:1,providers:i.providers,state:i.state,stateAll:i.stateAll,commands:i.commands,events:i.events,async invoke(e,t){if(!A(d))throw new v("DEBUG_COMMANDS_UNSUPPORTED",`debug: command "${e}" invocation refused — production build without debug.allowInProduction (D18)`,{name:e});return i.invoke(e,t)},input:{setVirtualAction:(e,t,o)=>r("setVirtualAction",o).setVirtualAction(e,t),tapVirtualAction:(e,t)=>r("tapVirtualAction",t).tapVirtualAction(e),clearVirtualActions:e=>r("clearVirtualActions",e).clearVirtualActions(),scheduleActionAtTick:(e,t,o,a)=>r("scheduleActionAtTick",a).scheduleActionAtTick(e,t,o),startRecording:e=>r("startRecording",e).startInputRecording(),stopRecording:e=>r("stopRecording",e).stopInputRecording(),isRecording:e=>r("isRecording",e).isInputRecording(),injectPointerDelta:(e,t,o)=>r("injectPointerDelta",o).injectPointerDelta(e,t),injectPointerPosition:(e,t,o)=>r("injectPointerPosition",o).injectPointerPosition(e,t)},snapshot(e){return{time:i.state("time"),state:i.stateAll(),events:i.events(e),pageErrors:c.slice()}},runTicks(e,t){const o=s.getRunTicksTarget();if(!o)throw new v("DEBUG_RUN_TICKS_UNAVAILABLE","debug bridge: runTicks() has no run-ticks target wired — no Game has mounted yet");o.runTicks(e,t)},runTicksSettled(e,t){return _(s,e,t)},async holdFor(e,t,o){const a=r("holdFor",o),w=a.setVirtualAction(e,!0);if(!w.delivered)return a.clearVirtualActions(),w.reason!==void 0?{delivered:!1,reason:w.reason}:{delivered:!1};const f=s.getRunTicksTarget(),{stalled:m,starvedWithoutDriver:p}=await L(i,t,f?R=>f.runTicks(R,{render:"last"}):void 0);return a.clearVirtualActions(),m?{delivered:!1,reason:p?V:"play stopped during hold"}:{delivered:!0}},uninstall(){n.window.removeEventListener?.("error",u),n.window.removeEventListener?.("unhandledrejection",g),delete n.window.__vgai}}}function U(n){const s=n.url??(h()?window.location:void 0);if(!s||!S(s))return;const d=n.window??(h()?window:void 0);if(!d)return;if(!A(n.manifest)){console.warn("[debug] ?vgai-debug=1 ignored: production build without debug.allowInProduction (D18)");return}const i=I({registry:n.registry,manifest:n.manifest,window:d});return d.__vgai=i,i}export{V as H,U as m,L as w};
@@ -1 +0,0 @@
1
- import{O as e,X as r,bz as i,bA as a,bB as p,bC as m}from"./index-BRJMIUK0.js";import{bD as Ut,bE as qt,bF as Bt,bG as Jt,bH as Mt,bI as Vt,bJ as Xt,a$ as Yt,bK as Zt,bL as zt,bM as Kt,bN as Nt,bO as Qt,aY as _t,bP as te,bQ as ee,bR as re,bS as oe,bT as se,bU as ie,bV as ae,bW as pe,bX as me,bY as ne,bZ as ce,b_ as le,b$ as de,c0 as be,c1 as ge,c2 as ue,c3 as Ee,c4 as Se,c5 as ye,c6 as Pe,c7 as je,c8 as fe,c9 as he,ca as ve,cb as Ae,cc as ke,cd as Ce,ce as Re,cf as we,cg as Fe,ch as Te,ci as xe,cj as Le,ck as De,cl as Ge,cm as We,cn as $e,aZ as Oe,co as Ie,cp as He,cq as Ue,cr as qe,cs as Be,ct as Je,cu as Me}from"./index-BRJMIUK0.js";import{m as Xe,o as Ye,q as Ze}from"./play-mode-DICV4cKP.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"./adapter-runtime-bindings-4cmsRvRh.js";import"./native-debug-module-2_HVupdg.js";import"./native-entry-surface-BE8LJNdu.js";import"./debug-registry-P0_YQGWd.js";import"./contract-system-adapters-Bic_7sev.js";import"./game-contract-seams-BnPFGLll.js";import"./seeded-random-BgCwIAAU.js";import"./game-audio-CaGKzia4.js";import"./game-network-Ct2FQYmu.js";import"./index-OZVqp6xS.js";import"./index-Da9JhEvW.js";import"./rapier-physics-adapter-CaZqWLu0.js";import"./events-156d8d12.esm-CYeuVCYr.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./index-bQE2NA0D.js";import"./live-project-verbs-C3LzprCe.js";import"./capability-coverage-DZ-onC5j.js";import"./edit-mode-authoring-DeCxPcHM.js";import"./json-history-resource-DwS10tqD.js";import"./binding-resolver-dE0GnZT5.js";import"./adapter-surface-Y37Nzcyw.js";import"./entry-adjudication-Dc18TIqT.js";import"./structural-signature-Dc7skRiy.js";import"./webgl-frame-capture-DdJkM2mi.js";import"./realm-services-CnY105XU.js";import"./canvas-entry-runtime-UNYuSfG0.js";import"./three-ingest-runtime-B7rtg3QE.js";import"./EffectComposer-BEAt0PtQ.js";import"./CopyShader-BzTUYzf6.js";import"./ShaderPass-DTnDQXm0.js";import"./Pass-D1MRT672.js";import"./CSS3DRenderer-BsAqfavI.js";import"./relative-path-guard-GiM7Lsz8.js";import"./react-root-BHA-cdrW.js";import"./editor-presentation-activity-C7SNSmTd.js";import"./active-ingest-DA426a81.js";import"./ingest-source-persistence-Dmdo-UBp.js";import"./pixi-story-model-DNkfnWUV.js";import"./surface-content-Dg9Kkazf.js";import"./viewport-root-presentation-vgxsTyj4.js";import"./mounted-authoring-Clftxx0x.js";import"./entity-object-JmYMfLsx.js";import"./user-data-Bpj7diUS.js";import"./workspace-arrangement-BdAlBwvd.js";import"./three-contract-Dkt6PmWY.js";import"./three-TCuY32m_.js";import"./editor-layers-BDJnAAzj.js";import"./component-instance-root-B0C5oNEm.js";import"./viewport-editor-controls-BYaAZ_Ku.js";import"./three-authoring-adapter-htbnVej2.js";import"./source-persistence-backend-CwLYVPXj.js";import"./three-projection-core-CG01r5Ta.js";import"./body-marks-RKb_LTwL.js";import"./user-data-dHvLdpwM.js";import"./object-marks-DwvIEBOK.js";import"./structural-ids-Br2zjINh.js";import"./object3d-authoring-subject-BDrxd1GA.js";import"./r3f-physics-binding-DzrbpqjM.js";import"./deferred-ingest-play-BdR4qGk6.js";import"./rrweb-Cd2ifIRP.js";import"./react-world-authoring-adapter-DOjv2pYm.js";import"./board-guides-BEKPgD9M.js";import"./relative-import-specifier-BFKIWEWs.js";import"./story-arg-descriptors-Ek86ExX7.js";import"./inspect-Dr4qvDpJ.js";import"./inference-diagnostics-xecGdohW.js";import"./writer-tw6EcuVO.js";import"./three-state-DwFE3ay2.js";import"./editor-shell-store-ChLcVeNB.js";import"./output-pass-HurwNl0G.js";import"./viewport-door-Bj_ZIP85.js";async function Wt(){try{const t=await fetch(`${e}/examples`);return(await r(t,`GET ${e}/examples failed`)).examples}catch{return[]}}function $t(t){return t.startsWith("/")?t:`${e}/learn-thumbnail?file=${encodeURIComponent(t)}`}async function Ot(){const t=await fetch(`${e}/templates`);return(await r(t,`GET ${e}/templates failed`)).templates}export{Ut as AssetDeliveryError,m as abortGameplayRecordingSink,qt as adaptProjectFolder,Bt as appendGameplayRecordingAsset,a as appendGameplayRecordingChunk,Jt as appendGameplayRecordingDomEvents,Mt as archiveEditorWorktree,Vt as assetDeliveryIssueMessage,i as beginGameplayRecordingSink,Xt as browseFolder,Yt as captureProjectAssetHistory,Zt as connectEvents,zt as connectTabPresence,Kt as createEditorWorktree,Nt as createProject,Qt as delegateEditorTask,_t as downloadOnlineAsset,Xe as endLogSession,p as finishGameplayRecordingSink,Ye as flushLogEntries,te as getAssetLibraryCategories,ee as getCurrentServerProject,re as getDownloadUrl,oe as getDownloadedAssetPath,se as getEditorCompatibility,ie as getEditorRepositoryPresence,ae as getEditorSessionWorktreeIdentity,pe as getLauncherSettings,me as getOnlineAssetFiles,ne as getOnlineAssetPreview,ce as getServerValidationLog,le as inspectProjectFolder,$t as learnThumbnailUrl,de as listAssets,be as listDelegateHarnesses,ge as listEditorWorktrees,Wt as listExamples,ue as listProjectComponents,Ee as listProjectSourceFiles,Se as listRecentProjects,Ot as listTemplates,ye as loadDownloadedAssets,Pe as loadEditorState,je as onAssetDownloaded,fe as openEditorWorktree,he as openProjectOnServer,ve as pollEditorLeaseIdentity,Ae as probeCurrentServerProject,ke as probeProjectFile,Ce as projectFileExists,Re as readProjectSourceText,we as readProjectTextFile,Fe as removeRecentProject,Te as reportCommandListener,xe as reportCommandReceived,Le as reportCommandResult,De as reportEditorState,Ge as reportPlayBootPhase,We as reportTabRoute,$e as requireEditorCompatibility,Oe as restoreProjectAssetHistory,Ie as revealInFinder,He as saveEditorState,Ue as saveFile,qe as saveThumbnail,Be as searchOnlineAssets,Ze as startLogSession,Je as stopEditorWorktreeSession,Me as updateLauncherSettings};
@@ -1 +0,0 @@
1
- import{e9 as T,u as z,by as ie,L as ae,gW as le}from"./index-BRJMIUK0.js";import{r as F}from"./index-nmcBqr7Y.js";import{staticBatchSkipReason as ce,materialMergeSignature as ue}from"./structural-signature-Dc7skRiy.js";import{fd as de}from"./three.core-3arARmh6.js";import{f as fe,c as me,a as pe,b as he}from"./webgl-frame-capture-DdJkM2mi.js";import{g as ge}from"./debug-registry-P0_YQGWd.js";import{y as we,f as ye,e as Ee,n as be,g as Re}from"./events-156d8d12.esm-CYeuVCYr.js";const Q=40,X=30;function Z(e){const r=e;return r.isMesh||r.isSkinnedMesh?r:null}function x(e){const r=e.geometry;if(!r)return 0;const t=r.getIndex?.()??null,s=r.getAttribute?.("position")??null,o=t?t.count:s?.count??0,a=e.isInstancedMesh?e.count??1:1;return Math.round(o/3)*a}function B(e,r){if(!e.visible)return;const t=Z(e);t&&r(t);for(const s of e.children)B(s,r)}const v="(unnamed)";function L(e,r="(scene)"){const t=new Map;let s=0,o=0;if(!e.visible)return{root:r,totalMeshes:0,totalTriangles:0,subtreeCount:0,subtrees:[]};const a=(l,c)=>{B(c,m=>{const p=x(m),n=t.get(l)??{meshes:0,triangles:0};n.meshes+=1,n.triangles+=p,t.set(l,n),s+=1,o+=p})},d=Z(e);if(d){const l=x(d);t.set(e.name||r,{meshes:1,triangles:l}),s+=1,o+=l}for(const l of e.children)a(l.name||v,l);const u=[...t.entries()].map(([l,c])=>({name:l,meshes:c.meshes,triangles:c.triangles})).sort((l,c)=>c.triangles-l.triangles||c.meshes-l.meshes);return{root:r,totalMeshes:s,totalTriangles:o,subtreeCount:u.length,subtrees:u.slice(0,Q)}}function W(e,r){if(e.name===r)return e;for(const t of e.children){const s=W(t,r);if(s)return s}return null}function ve(e){const r=new Map;let t=0;B(e,a=>{if(a.isInstancedMesh)return;const d=a.geometry;if(!d)return;const u=a.material,l=Array.isArray(u)?u.map(p=>p.uuid).join("+"):u?.uuid??"none",c=`${d.uuid}/${l}`;t+=1;const m=r.get(c);if(m){m.meshes+=1;return}r.set(c,{meshes:1,triangles:x(a),example:`${a.parent?.name||v}/${a.name||v}`})});const s=[...r.values()].sort((a,d)=>d.meshes-a.meshes),o=s.slice(0,X);return{plainMeshes:t,familyCount:s.length,top:o,meshesInTop:o.reduce((a,d)=>a+d.meshes,0)}}function G(e){const r=new Map,t={},s=[];let o=0;const a=(n,i)=>{if(!n.visible)return!1;const f=ce(n);if(f==="opted-out")return t["opted-out"]=(t["opted-out"]??0)+1,!1;if(f===null){const w=n,_=w.material,M=`${ue(_)}|${n.castShadow?1:0}${n.receiveShadow?1:0}`;o+=1,s.push({key:M,subtree:i});const C=r.get(M);C?C.meshes+=1:r.set(M,{meshes:1,triangles:x(w),example:`${n.parent?.name||v}/${n.name||v}`})}else f!=="not-a-mesh"&&(t[f]=(t[f]??0)+1);return!0},d=(n,i)=>{if(a(n,i))for(const f of n.children)d(f,i)};if(a(e,e.name||v))for(const n of e.children)d(n,n.name||v);const u=new Set([...r.entries()].filter(([,n])=>n.meshes>=2).map(([n])=>n)),l=new Map;let c=0;for(const n of s)u.has(n.key)&&(c+=1,l.set(n.subtree,(l.get(n.subtree)??0)+1));const m=[...r.values()].sort((n,i)=>i.meshes-n.meshes),p=m.slice(0,X);return{plainMeshes:o,familyCount:m.length,top:p,meshesInTop:p.reduce((n,i)=>n+i.meshes,0),collapsible:c,skipped:t,bySubtree:[...l.entries()].map(([n,i])=>({name:n,collapsible:i})).sort((n,i)=>i.collapsible-n.collapsible).slice(0,Q)}}const ee="render.submit",Me=["input","prePhysics","physics","postPhysics","gameLogic","animation"],Ce=300,Se=50,_e=.05,Ae=.1;function Te(e,r,t){const s=e-r-t;return{totalMs:e,renderMs:r,simMs:t,otherMs:s,text:`${e.toFixed(0)}ms = render ${r.toFixed(0)} + sim ${t.toFixed(0)} + other ${s.toFixed(0)}`}}function Fe(){return{lastFrameId:0,lastPresentAt:null,pendingSimMs:0,frameTimeMs:null,renderCpuMs:null,drawCalls:null,triangles:null,renderPasses:null,worstCurrentMs:0,worstPreviousMs:0,worstWindowFrames:0,lastHitch:null,presentedFrames:0}}function Pe(e,r){let t=0;for(const s of e.phases)r.includes(s.name)&&(t+=s.ms);return t}function xe(e){for(const r of e.phases)if(r.name===ee)return r.ms;return null}function K(e,r,t){return e===null?r:e*(1-t)+r*t}function Ie(e,r){if(r.id<=e.lastFrameId)return!1;e.lastFrameId=r.id,r.render.renderPasses!==null&&(e.drawCalls=r.render.drawCalls,e.triangles=r.render.triangles,e.renderPasses=r.render.renderPasses),e.pendingSimMs+=Pe(r,Me);const t=xe(r);if(t===null)return!1;const s=e.pendingSimMs;e.pendingSimMs=0,e.presentedFrames+=1,e.renderCpuMs=K(e.renderCpuMs,t,Ae);const o=e.lastPresentAt;if(e.lastPresentAt=r.timestamp,o===null)return!0;const a=r.timestamp-o;return e.frameTimeMs=K(e.frameTimeMs,a,_e),a>e.worstCurrentMs&&(e.worstCurrentMs=a),e.worstWindowFrames+=1,e.worstWindowFrames>=Ce&&(e.worstPreviousMs=e.worstCurrentMs,e.worstCurrentMs=0,e.worstWindowFrames=0),a>=Se&&(e.lastHitch=Te(a,t,s)),!0}function P(e,r){if(e===null)return null;const t=10**r;return Math.round(e*t)/t}function De(e){const r=P(e.frameTimeMs,2),t=Math.max(e.worstCurrentMs,e.worstPreviousMs);return{frameTimeMs:r,fps:r!==null&&r>0?P(1e3/r,1):null,drawCalls:e.drawCalls,triangles:e.triangles,renderCpuMs:P(e.renderCpuMs,2),renderPasses:e.renderPasses,worstFrameMs:e.frameTimeMs===null?null:P(t,2),lastHitch:e.lastHitch,presentedFrames:e.presentedFrames}}function $e(e){const r=Fe(),t=e.subscribe(()=>{const o=e.getSnapshot().frames.at(-1);o&&Ie(r,o)});let s=!1;return{read:()=>De(r),dispose(){s||(s=!0,t())}}}const ke=500,Le=.5,Oe=.4,Ne=120;function O(e){return e.toLocaleString("en-US")}function He(e){const{drawCalls:r,census:t,structural:s}=e;if(r===null||r<ke)return null;const{collapsible:o}=s;if(o<r*Le)return null;const a=new Set(t.subtrees.map(p=>p.name)),d=s.bySubtree[0],u=d&&d.collapsible>=o*Oe&&a.has(d.name)?d.name:null,l=u===null?"<Frozen>":`<Frozen name="${u}">`,c=u===null?"spread across the scene":`mostly under "${u}"`,m=`[static-batch] ${O(r)} draw calls this frame; ~${O(o)} meshes are repeats of ${O(s.familyCount)} structural families, ${c}. If that scenery is mount-static — nothing under it moves, re-colours or unmounts after mount — one wrapper collapses it to a few draws: wrap it in ${l}…</Frozen> (vgai add static-batch). Reactive scenery goes outside the wrapper, and a subtree that must stay unbatched declares it: userData={{ staticBatch: false }}.`;return{drawCalls:r,collapsible:o,subtree:u,fix:l,message:m}}const re="__vgaiStaticBatchAdvised";function We(){return globalThis[re]===!0}function Be(e){console.warn(e)}function Ve(e,r=Be){return We()?!1:(globalThis[re]=!0,r(e.message),!0)}const N="render.vitals",je="render.census",Ue="render.families",ze="render.toggle",Ge="render.dpr",Ke="render.dpr: this world has no WebGL renderer (headless mount), so there is no pixel ratio to change. The other render.* commands still work — they read the scene graph.";function Ye(e){const{registry:r,worldId:t,profiler:s,scene:o,renderer:a}=e;if(r.adapter.providers().some(i=>i.name===N))return console.warn(`[render-vitals] world "${t}" did not get the ${N} door: another live world already owns it (the names are fixed, so the first three root to mount wins). Its draws still fold into the readings — the profiler is game-scoped — but render.census/families/toggle address the owning root. If this world IS the current one, the previous mount was torn down AFTER this one seeded and its strip() took the door with it.`),null;const u=$e(s),l=r.forRoot(t);l.registerStateProvider(N,()=>u.read()),l.registerCommand(je,{description:"Visible meshes and triangles per subtree — the address book behind the draw-call reading. Pass a subtree name (as listed by a previous census) to drill into it.",args:T([z().optional()]),locus:"client"},i=>{if(i===void 0||i==="")return L(o);const f=W(o,i);if(!f)throw new Error(`render.census: no node named "${i}" in this world. Run render.census with no argument to list the addressable subtrees.`);return L(f,i)}),l.registerCommand(Ue,{description:"Meshes grouped by shared (geometry, material) identity, largest group first — the instancing shortlist for a draw-call diet. `structural` is the same scan keyed by VALUE instead of object identity: what would collapse under a <Frozen> wrapper (vgai add static-batch) even when every mesh carries its own inline material.",args:T([]),locus:"client"},()=>({...ve(o),structural:G(o)})),l.registerCommand(ze,{description:"Show/hide a named subtree (as listed by render.census) and read render.vitals again — the difference is what that subtree costs.",args:T([z()]),locus:"client"},i=>{const f=W(o,i);if(!f)throw new Error(`render.toggle: no node named "${i}" in this world. Run render.census to list the addressable subtrees.`);return f.visible=!f.visible,{name:i,visible:f.visible}}),l.registerCommand(Ge,{description:"Set the renderer pixel ratio (retina default is ~2) to probe GPU fill cost — render CPU that does not move when the drawing buffer shrinks was never fill-bound.",args:T([ie().positive().max(8)]),locus:"client"},i=>{if(!a)throw new Error(Ke);const f=a.getSize(new de);return a.setPixelRatio(i),a.setSize(f.x,f.y,!1),{pixelRatio:a.getPixelRatio(),drawingBuffer:{width:a.domElement.width,height:a.domElement.height}}});let c=null,m=!1;const p=()=>{if(m||u.read().presentedFrames<Ne)return;m=!0,c?.(),c=null;const i=He({drawCalls:u.read().drawCalls,census:L(o),structural:G(o)});i&&Ve(i)};c=s.subscribe(p);let n=!1;return{vitals:u,dispose(){n||(n=!0,c?.(),c=null,u.dispose())}}}const qe={};function Je(e){return qe?.VITE_VGAI_DEV_BUILD==="true"}const Y=new WeakMap;function Qe(e){const r=Y.get(e.Component);if(r)return r;class t extends e.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(o){this.props.onError(o)}render(){return this.state.failed?null:this.props.children}}return Y.set(e.Component,t),t}function Xe(e,r,t){const{createElement:s,Fragment:o,useEffect:a,createRoot:d,extend:u,advance:l,flushSync:c}=t,m=Qe(t),p=s(r);return{id:e,async mount(n){u(n.three);const i=n.game?ge(n.game):null,f=n.surface.canvas,w=d(f);let _;const M=new Promise(h=>{_=h});let C;const te=new Promise(h=>{C=h});function ne(){return a(C,[]),null}await w.configure({gl:n.renderer,shadows:n.renderer.shadowMap?.enabled??!1,frameloop:"never",size:{width:n.surface.width,height:n.surface.height,top:0,left:0},...n.headless?{}:{events:t.events},onCreated:h=>_(h)});const se=s(o,null,p,s(ne,{key:"vgai-mount-effects-ready"})),A=await new Promise((h,E)=>{const b=R=>{k(),w.unmount(),i?.strip(e),E(new Error(`three world "${e}": fiber crashed before its first commit — ${R}`))},g=R=>{b(R.message)},$=setTimeout(()=>{k(),w.unmount(),i?.strip(e),E(new Error(`three world "${e}": onCreated did not fire within 10s — the R3F tree never reached its first commit (mount() fails loudly instead of hanging)`))},1e4),k=()=>{clearTimeout($),typeof window<"u"&&window.removeEventListener("error",g)};typeof window<"u"&&window.addEventListener("error",g),w.render(s(m,{onError:R=>b(R.message)},se)),Promise.all([M,te]).then(([R])=>{k(),h(R)})});A.clock.autoStart=!1,A.clock.stop();const y=()=>A.get();let I=null;if(!n.headless&&n.game&&Je()){if(n.game.profiler.enabled=!0,!i)throw new Error(`three world "${e}": mounted Game has no debug registry.`);I=Ye({registry:i,worldId:e,profiler:n.game.profiler,scene:y().scene,renderer:n.renderer})}const oe=typeof n.renderer.getContext=="function"?n.renderer.getContext():void 0,V=fe(n.headless??!1,oe),j=V?me(V):null,S=j?pe({capture:j,scene:A.scene,memory:()=>he(y().scene,n.renderer.info)}):null,U=i?{debug:i.adapter}:{};S&&(U.renderDebug=S.adapter);let D=0;return{kind:"three",get scene(){return y().scene},get camera(){return y().camera},drivesOwnLoop:!1,updateCadence:"display",systems:U,systemScope:y().scene,update(h){D+=h;const E=y();try{S?.beforeRender();const b=n.game?.profiler;if(!b?.enabled){l(D,!0,E);return}const g=n.renderer.info,$=g?.render.frame??0;b.beginPhase();try{l(D,!0,E)}finally{b.endPhase(ee)}g&&b.reportRender({gpuMs:null,drawCalls:g.render.calls,triangles:g.render.triangles,geometries:g.memory.geometries,textures:g.memory.textures,renderPasses:g.render.frame-$})}finally{S?.afterRender()}},resize(h,E){y().setSize(h,E)},dispose(){S?.dispose(),c(()=>w.unmount()),I?.dispose(),I=null,i?.strip(e)}}}}}function q(e,r,t){const s=e;return typeof s?.default=="function"?Xe(r,s.default,t):null}const Ze={createElement:F.createElement,Fragment:F.Fragment,Component:F.Component,useEffect:F.useEffect,createRoot:ye,extend:Ee,advance:be,flushSync:we,events:Re};let H=null;const er=["createElement","Fragment","Component","useEffect","createR3FRoot","extendThree","advance","flushSync","events"];async function rr(){const e=await import(le),r=er.filter(t=>e[t]===void 0);if(r.length>0||typeof e.projectThree!="object"||e.projectThree===null)throw new Error(`The packaged runtime's synthetic R3F module did not export ${[...r,...e.projectThree?[]:["projectThree"]].join(", ")} — see R3F_DOORWAY in vite-plugin-module-doorways.ts.`);return{runtime:{createElement:e.createElement,Fragment:e.Fragment,Component:e.Component,useEffect:e.useEffect,createRoot:e.createR3FRoot,extend:e.extendThree,advance:e.advance,flushSync:e.flushSync,events:e.events},projectThree:e.projectThree}}function tr(e,r){return{id:e.id,mount(t){return e.mount({...t,three:r})}}}async function J(e,r){if(!await ae())return q(e,r,Ze);H||(H=rr());const{runtime:t,projectThree:s}=await H,o=q(e,r,t);return o?tr(o,s):null}function nr(e){if(e===null||typeof e!="object")return!1;const r=e;return typeof r.id=="string"&&r.id.length>0&&typeof r.mount=="function"}async function dr(e,r,t){const s=t?.namedExport;if(s!==void 0){const o=e[s];if(typeof o!="function")throw new Error(`three root "${r}": ${t?.entryPath??"the entry module"} has no exported component "${s}" (manifest \`world.export\`) — it exports ${Object.keys(e).join(", ")||"(nothing)"}.`);return J({default:o},r)}return nr(e.adapter)?e.adapter:J(e,r)}export{dr as a};
@@ -1 +0,0 @@
1
- import{fn as s,fo as c,av as o,di as u}from"./index-BRJMIUK0.js";import{E as h,a as E,F as g,c as m}from"./instance-fork-actions-D3sRzS3K.js";import{t as i}from"./editor-shell-store-ChLcVeNB.js";function l(e,t){return s(e,t)}function F(e,t){const n=o(e.shell);return E(n.hierarchy.node(t),l(n,t),t)}let r=null;function O(){r||(r=c(({nodeId:e,store:t})=>F(i(t),e),({nodeId:e,store:t})=>{const n=l(o(t),e);return[{label:h,action:()=>{n?.extractComponent?.(e).then(u)}}]}))}function b(){r?.(),r=null}function f(e,t){return s(e,t)}function p(e,t){const n=o(e.shell);return m(n.hierarchy.node(t),f(n,t),t)}let a=null;function A(){a||(a=c(({nodeId:e,store:t})=>p(i(t),e),({nodeId:e,store:t})=>{const n=f(o(t),e);return[{label:g,action:()=>{n?.forkComponent?.(e).then(u)}}]}))}function C(){a?.(),a=null}export{l as a,A as b,C as c,O as e,f as i,b as u};
@@ -1 +0,0 @@
1
- import{kT as ht,kU as be,kV as gt,d2 as vt,J as K,kW as yt,kX as we,kY as xt,kZ as Se,Z as H,$ as ue,k_ as bt,k$ as wt,cR as J,cS as G,l0 as St,l1 as jt,a3 as de,l2 as Et,aI as $e,l3 as Mt,l4 as It,eE as Te,au as ze,fR as Rt,fS as Ct,fT as Dt,fU as Pt,q as ie,ad as h,M as kt,gE as At,gF as je,gH as Ft,ga as _t,eO as Ne,l5 as $t,cU as Tt,l6 as zt,p as Oe}from"./index-BRJMIUK0.js";import{a as s}from"./jsx-runtime-DPjLkJKQ.js";import{r}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{u as Nt,d as Ot,c as Gt}from"./frame-debugger-store-DaCbAYSW.js";import{m as Vt}from"./audio-meter-Cddyq1vI.js";import{p as Ge}from"./utility-view-state-CAfbFbKQ.js";import{P as Ht}from"./PlayBar-bT8Xdrap.js";import{a as Ee,r as Lt,f as Bt,R as Ut}from"./presentation-BeNFBfKg.js";import{setUserData as Ve}from"./user-data-dHvLdpwM.js";import{E as pe,F as Wt,G as ne,H as qt,I as He,J as Le,K as Be,L as Ue,v as Kt,w as Xt,M as me,u as Y,N as Yt,O as Zt,P as Jt,Q as se,R as We,S as Me,T as qe,U as Qt,V as Ke,i as en,W as tn,X as Ie,Y as nn,a as Xe,Z as sn}from"./play-mode-DICV4cKP.js";import{aq as on,cp as Ye,aI as rn,bX as an,ey as ln,bh as fe,co as Re,s as cn,fo as U,bV as un,N as Ze,M as Ce,dg as dn,df as pn}from"./three.core-3arARmh6.js";import{e as mn,S as fn}from"./surface-state-1lTOi8FD.js";import{d as hn}from"./surface-content-Dg9Kkazf.js";import{a as gn,R as Je}from"./active-ingest-DA426a81.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./configurations-BXU4GGbV.js";import"./run-selection-DzEkGesJ.js";import"./ingest-source-persistence-Dmdo-UBp.js";import"./capability-coverage-DZ-onC5j.js";import"./game-contract-seams-BnPFGLll.js";import"./object-marks-DwvIEBOK.js";import"./adapter-runtime-bindings-4cmsRvRh.js";import"./native-debug-module-2_HVupdg.js";import"./native-entry-surface-BE8LJNdu.js";import"./debug-registry-P0_YQGWd.js";import"./contract-system-adapters-Bic_7sev.js";import"./seeded-random-BgCwIAAU.js";import"./game-audio-CaGKzia4.js";import"./game-network-Ct2FQYmu.js";import"./index-OZVqp6xS.js";import"./index-Da9JhEvW.js";import"./rapier-physics-adapter-CaZqWLu0.js";import"./events-156d8d12.esm-CYeuVCYr.js";import"./three.module-BLhyNg0e.js";import"./index-bQE2NA0D.js";import"./live-project-verbs-C3LzprCe.js";import"./edit-mode-authoring-DeCxPcHM.js";import"./json-history-resource-DwS10tqD.js";import"./binding-resolver-dE0GnZT5.js";import"./adapter-surface-Y37Nzcyw.js";import"./entry-adjudication-Dc18TIqT.js";import"./structural-signature-Dc7skRiy.js";import"./webgl-frame-capture-DdJkM2mi.js";import"./realm-services-CnY105XU.js";import"./canvas-entry-runtime-UNYuSfG0.js";import"./three-ingest-runtime-B7rtg3QE.js";import"./EffectComposer-BEAt0PtQ.js";import"./CopyShader-BzTUYzf6.js";import"./ShaderPass-DTnDQXm0.js";import"./Pass-D1MRT672.js";import"./CSS3DRenderer-BsAqfavI.js";import"./relative-path-guard-GiM7Lsz8.js";import"./react-root-BHA-cdrW.js";import"./editor-presentation-activity-C7SNSmTd.js";import"./pixi-story-model-DNkfnWUV.js";import"./viewport-root-presentation-vgxsTyj4.js";import"./mounted-authoring-Clftxx0x.js";import"./entity-object-JmYMfLsx.js";import"./user-data-Bpj7diUS.js";import"./workspace-arrangement-BdAlBwvd.js";import"./three-contract-Dkt6PmWY.js";import"./three-TCuY32m_.js";import"./editor-layers-BDJnAAzj.js";import"./component-instance-root-B0C5oNEm.js";import"./viewport-editor-controls-BYaAZ_Ku.js";import"./three-authoring-adapter-htbnVej2.js";import"./source-persistence-backend-CwLYVPXj.js";import"./three-projection-core-CG01r5Ta.js";import"./body-marks-RKb_LTwL.js";import"./structural-ids-Br2zjINh.js";import"./object3d-authoring-subject-BDrxd1GA.js";import"./r3f-physics-binding-DzrbpqjM.js";import"./deferred-ingest-play-BdR4qGk6.js";import"./rrweb-Cd2ifIRP.js";import"./react-world-authoring-adapter-DOjv2pYm.js";import"./board-guides-BEKPgD9M.js";import"./relative-import-specifier-BFKIWEWs.js";import"./story-arg-descriptors-Ek86ExX7.js";import"./inspect-Dr4qvDpJ.js";import"./inference-diagnostics-xecGdohW.js";import"./writer-tw6EcuVO.js";import"./three-state-DwFE3ay2.js";import"./editor-shell-store-ChLcVeNB.js";import"./output-pass-HurwNl0G.js";import"./viewport-door-Bj_ZIP85.js";const Qe=8,oe=1e3/60;function vn(e,t=Qe){return!(e>0)||t<=0?0:Math.min(t,Math.max(1,Math.round(Vt(e)/100*t)))}function De(e,t){const n=e.filter(a=>a.id>t),o=n.at(-1)?.id??t,i=n.map(a=>a.intervalMs).filter(a=>Number.isFinite(a)&&a>0).sort((a,m)=>a-m);if(i.length===0)return{frameId:o,intervalMs:null};const l=Math.floor((i.length-1)*.95);return{frameId:o,intervalMs:i[l]??null}}function yn(e){const t=e.slice(-3);return t.slice(-2).length===2&&t.slice(-2).every(n=>n>=50)?"danger":t.length===3&&t.every(n=>n>oe*1.05)?"warning":"normal"}function xn(e,t,n,o=50){if(e.length===0||t<=0||n<=0)return"";const i=Math.max(1,e.length-1);return e.map((l,a)=>{const m=a/i*t,d=Math.min(1,Math.max(0,l/o)),g=n-d*n;return`${m.toFixed(1)},${g.toFixed(1)}`}).join(" ")}const et="muted",Pe={enabled:!1,recording:!1,fps:0,cpuMs:0,p95Ms:0,p99Ms:0,frames:[],phases:[],systems:[],components:[],render:{gpuMs:null,drawCalls:0,triangles:0,geometries:0,textures:0,renderPasses:0}};function ke(){return St(et)===!0}function bn(e){jt(et,e)}function wn(e,t){const n=t.find(i=>i.id==="master")?.level;if(!e.isMuted()&&n!==void 0)return n;const o=t.filter(i=>i.id!=="master").map(i=>i.level);return o.length>0?Math.max(...o):n??0}function Sn(){const e=K();r.useSyncExternalStore(e.subscribe,e.getShellSnapshot??e.getSnapshot);const t=e.playState==="playing",[n,o]=r.useState(!1),[i,l]=r.useState(0),[a,m]=r.useState(!1),[d,g]=r.useState(!1),[u,T]=r.useState(ke),R=r.useRef(ke()),E=r.useRef(new WeakMap),x=r.useRef(null),C=r.useSyncExternalStore(yt,we,we),v=xt();r.useEffect(()=>{const p=R.current||!t;for(const f of Se())E.current.get(f)!==p&&(f.setMuted(p),E.current.set(f,p))},[C,t]),r.useEffect(()=>{if(!v){l(0),m(!1),g(!1);return}const p=v.acquireMeters?.()??null;g(p!==null);const f=()=>{m(v.isMuted()),l(p?wn(v,p.read()):0)};f();const k=setInterval(f,100);return()=>{clearInterval(k),p?.dispose()}},[v]);const M=()=>{const p=!R.current,f=p||!t;for(const k of Se())k.resume?.(),k.setMuted(f),E.current.set(k,f);R.current=p,T(p),bn(p),m(f)},D=vn(i),z=v&&a&&!u&&!t?" (not playing)":"",P=v?a?"Audio muted":i>0?"Audio playing":"Audio quiet":"Audio unavailable";return s.jsxs("div",{className:"vgai-header-audio","data-muted":a||void 0,"data-available":!!v,children:[s.jsxs(H,{ref:x,type:"button",variant:"ghost",size:"compact",className:"vgai-header-telemetry-button","data-testid":"header-audio-telemetry","aria-label":`${P}; open audio controls`,"aria-haspopup":"menu","aria-expanded":n,title:`${P}${z}${d?"":" · level metering unavailable"}`,onClick:()=>o(p=>!p),children:[s.jsx(ue,{icon:a?bt:wt,size:"sm"}),s.jsx("span",{className:"vgai-audio-vu","aria-hidden":"true",children:Array.from({length:Qe},(p,f)=>s.jsx("i",{"data-filled":f<D||void 0},f))})]}),n&&s.jsx(J,{anchorRef:x,onDismiss:()=>o(!1),gap:3,children:s.jsx(G,{onClick:()=>{M(),o(!1)},children:u?"Unmute audio":"Mute audio"})})]})}function jn(){const e=Nt(),t=e?.profiler??null,[n,o]=r.useState(Pe),[i,l]=r.useState([]);r.useEffect(()=>{if(!t){o(Pe),l([]);return}const R=t.telemetryEnabled;t.telemetryEnabled=!0;const E=t.getSnapshot(),x=De(E.frames,0);let C=x.frameId;o(E),l(x.intervalMs===null?[]:[x.intervalMs]);let v=null;const M=()=>{v=null;const z=t.getSnapshot(),P=De(z.frames,C);C=P.frameId,o(z);const p=P.intervalMs;p!==null&&l(f=>[...f,p].slice(-24))},D=t.subscribe(()=>{v===null&&(v=setTimeout(M,500))});return()=>{D(),v!==null&&clearTimeout(v),R||(t.telemetryEnabled=!1)}},[t]);const a=i.at(-1)??null,m=xn(i,72,18),d=a?Math.round(1e3/a):n.fps>0?Math.round(n.fps):null,g=a??(n.fps>0?1e3/n.fps:null),u=yn(i),T=e?`${e.label}: ${d??"—"} FPS · ${g?.toFixed(1)??"—"} ms frame time · open Profiler`:"The active document has no live render loop to profile";return s.jsxs(H,{type:"button",variant:"ghost",size:"compact",className:"vgai-header-telemetry-button vgai-header-performance","data-testid":"header-performance-telemetry","data-performance-tone":u,disabled:!e,"aria-label":T,title:T,onClick:()=>Ge.open("profiler"),children:[s.jsxs("svg",{className:"vgai-performance-graph","aria-hidden":"true",viewBox:"0 0 72 18",width:"72",height:"18",children:[s.jsx("line",{className:"vgai-performance-budget",x1:"0",x2:"72",y1:18-oe/50*18,y2:18-oe/50*18}),m&&s.jsx("polyline",{className:"vgai-performance-sparkline",points:m})]}),s.jsxs("span",{className:"vgai-performance-readout",children:[s.jsxs("strong",{className:"vgai-header-fps",children:[d??"—"," FPS"]}),s.jsxs("span",{className:"vgai-header-frame-ms",children:[g?.toFixed(1)??"—"," ms"]})]})]})}function En(){return r.useSyncExternalStore(ht,be,be),gt().telemetry==="hidden"?null:s.jsxs(vt,{className:"vgai-header-telemetry vgai-chrome-island vgai-glass-island","data-island-scale":"compact",align:"center",gap:1,children:[s.jsx(Sn,{}),s.jsx(jn,{})]})}let Z=!1,re=0,w=null,N=null;const Mn=new on(1,1,1,16,1,!0),In=new Ye({color:2280686,transparent:!0,opacity:.45,side:rn,depthWrite:!1}),Rn=new an({color:16755200,transparent:!0,opacity:.9}),Cn=new ln(.12,12,8),Dn=new Ye({color:16755200,depthWrite:!1}),Pn=16724804,kn=2280686;let $=[];function Ae(){return Z}function An(e){e!==Z&&(Z=e,e?re=requestAnimationFrame(tt):(cancelAnimationFrame(re),$n()))}function tt(){if(!Z)return;re=requestAnimationFrame(tt);const e=pe(),t=e?de().navigation?.crowdAgents?.()??[]:[];if(e!==N&&(N&&w&&N.remove(w),N=e,e&&(w||(w=new fe,w.name="crowd-debug-draw",Ve(w,"editorHelper",!0)),e.add(w))),!(!w||!e)){Fn(w,t.length);for(let n=0;n<t.length;n++)_n($[n],t[n])}}function Fn(e,t){for(;$.length<t;){const n=new fe,o=In.clone(),i=new Re(Mn,o),l=new cn(new U(1,0,0),new U,1,16755200),a=new un(new Ze,Rn),m=new Re(Cn,Dn);n.add(i),n.add(l),e.add(n),e.add(a),e.add(m),$.push({root:n,cylinder:i,cylinderMaterial:o,arrow:l,path:a,target:m})}for(;$.length>t;){const n=$.pop();e.remove(n.root),e.remove(n.path),e.remove(n.target),n.arrow.dispose(),n.path.geometry.dispose(),n.cylinderMaterial.dispose()}}function _n(e,t){e.root.position.set(t.position.x,t.position.y,t.position.z),e.cylinder.scale.set(t.radius,t.height,t.radius),e.cylinder.position.y=t.height/2,e.cylinderMaterial.color.setHex(t.state==="invalid"?Pn:kn);const n=t.corners??[];n.length>0?(e.path.visible=!0,e.path.geometry.setFromPoints([new U(t.position.x,t.position.y+.05,t.position.z),...n.map(i=>new U(i.x,i.y+.05,i.z))])):e.path.visible=!1,t.target&&n.length>0?(e.target.visible=!0,e.target.position.set(t.target.x,t.target.y+.05,t.target.z)):e.target.visible=!1;const o=Math.hypot(t.velocity.x,t.velocity.y,t.velocity.z);o>.01?(e.arrow.visible=!0,e.arrow.position.y=t.height/2,e.arrow.setDirection(new U(t.velocity.x/o,t.velocity.y/o,t.velocity.z/o)),e.arrow.setLength(Math.max(o*.5,.2))):e.arrow.visible=!1}function $n(){if(w){N?.remove(w);for(const e of $)e.arrow.dispose();w.clear()}$=[],w=null,N=null}function Tn({onPresetChange:e}){const[t,n]=r.useState(!1),o=r.useRef(null),i=He(),l=i.kind==="fit";return s.jsxs("div",{className:"vgai-playbar-popover-anchor",children:[s.jsxs(H,{ref:o,variant:"ghost",size:"comfortable","aria-haspopup":"menu","aria-expanded":t,"aria-controls":t?"vgai-device-preset-menu":void 0,"data-testid":"device-preset-picker",onClick:()=>n(a=>!a),title:"Device preview — constrain the game to a device resolution + DPR. Phone/tablet presets show the safe area, set --vgai-safe-area-inset-top/right/bottom/left CSS vars on the game mount, and send mouse input as touch.",children:[s.jsx(ue,{icon:Et,size:"md"}),s.jsx($e,{variant:"code",children:l?"Device":`${i.width}×${i.height}`})]}),t&&s.jsxs(J,{id:"vgai-device-preset-menu",anchorRef:o,className:"vgai-resolution-menu",gap:4,onDismiss:()=>n(!1),children:[Wt.map(a=>s.jsx(G,{role:"menuitemradio","aria-checked":a.id===i.id,"data-testid":`device-preset-${a.id}`,onSelect:()=>{e(a),n(!1)},children:a.label},a.id)),s.jsxs(G,{role:"menuitemcheckbox","aria-checked":ne(),"data-testid":"device-touch-toggle",onSelect:()=>qt(!ne()),children:[ne()?"✓ ":" ","Pointer as touch"]})]})]})}function zn(){const e=Mt(()=>It()??null),n=Ot(e)?.capture===!0;return s.jsx(H,{type:"button",size:"compact",variant:"ghost","data-testid":"game-capture-frame",className:"vgai-frame-capture-game-button",disabled:!n,title:n?"Capture one rendered frame and open the Frame debugger":"No render-debug adapter registered for this world — frame capture is unavailable",onClick:()=>{Gt(e),Ge.open("frame")},children:"Capture frame"})}let nt={label:"Fill",width:null,height:null},ae=1,st=0;const le=new Set;function V(){st++;for(const e of le)e()}function it(e){return le.add(e),()=>{le.delete(e)}}const ot=()=>st;function rt(){return nt}function at(e){nt=e,V()}function lt(e,t){return e.width!==null||!t?e:{label:`Project — ${t.width}×${t.height}`,width:t.width,height:t.height}}function Nn(e){return e?[lt({label:"Fill",width:null,height:null},e),...Ee.filter(t=>t.width!==null)]:Ee}function ct(e){Le(e.id),at(e.width===null||e.height===null?{label:"Fill",width:null,height:null}:{label:e.label,width:e.width,height:e.height})}function On(e){e!==ae&&(ae=e,V())}function Gn(){return ae}function ut(e){return Array.from(e.children).filter(t=>t.dataset?.vgaiRootSurface==="true")}function Vn(e,t,n){for(const o of t)o.contains(e)||e.appendChild(o);if(n)for(const o of ut(n))e.appendChild(o)}function Hn({name:e}){return s.jsx("div",{"data-testid":"game-instance-name",style:{flex:"0 0 auto",padding:"3px 10px",background:h.surface.chrome,color:h.content.primary,borderBottom:`1px solid ${h.boundary.default}`,fontSize:11,fontWeight:600,userSelect:"none"},children:e})}function dt({name:e,testId:t,borderLeft:n,focused:o,onFocus:i,children:l}){return s.jsxs("div",{"data-testid":t,"data-focused":o||void 0,onPointerDownCapture:i,style:{flex:1,minWidth:0,height:"100%",display:"flex",flexDirection:"column",overflow:"hidden",position:"relative",cursor:i&&!o?"pointer":void 0,...n?{borderLeft:`1px solid ${h.boundary.default}`}:{}},children:[s.jsx(Hn,{name:e}),s.jsx("div",{style:{flex:1,minHeight:0,position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:l}),o&&s.jsx("div",{"aria-hidden":!0,style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:40,border:`2px solid ${h.accent.default}`,boxShadow:`inset 0 0 0 1px ${h.accent.default}`}})]})}function Ln({index:e}){const t=r.useRef(null),n=qe(e+1),o=r.useSyncExternalStore(Ke,en),[i,l]=r.useState(null),a=r.useSyncExternalStore(me,Y);return r.useEffect(()=>{const m=t.current;if(!m||!o)return;let d=null,g=!1;return tn(m,n).then(u=>{g?Ie(u):(d=u,l(u))},u=>{kt.error(`Failed to mount ${n}: ${u}`,"play-mode")}),()=>{g=!0,l(null),d&&Ie(d)}},[e,o]),s.jsx(dt,{name:n,testId:`game-instance-slot-${e+1}`,borderLeft:!0,focused:i!=null&&a===i,onFocus:i?()=>We(i):void 0,children:s.jsx("div",{ref:t,"data-vgai-instance-viewport":"",style:{position:"absolute",inset:0}})})}function Bn({style:e}){const t=r.useSyncExternalStore(Te,ze),o=K().playState!=="stopped",i=r.useRef(null);r.useSyncExternalStore(it,ot),r.useSyncExternalStore(Be,Ue);const l=r.useSyncExternalStore(Kt,Xt),a=l>0,m=r.useSyncExternalStore(me,Y),d=He(),g=rt(),[u,T]=r.useState({width:0,height:0}),[R,E]=r.useState(0),x=r.useRef(null),C=r.useSyncExternalStore(Rt,Ct),v=r.useSyncExternalStore(Dt,Pt),M=Qt(),D=gn(),z=M.length>0?M.map(c=>c.rootId):D?[D.worldId]:C.filter(c=>c.mechanism==="host-mount").map(c=>c.rootId),P=!!(x.current&&hn(x.current)),p=M.length>0?M.some(c=>c.hasRenderableContent):P,f=M.length>0||D!==null,k=o?mn({surface:"Game",rootIds:z,phase:f?"ready":"loading",content:f?p?"present":"empty":"unknown",readiness:C,failures:v}):null;r.useEffect(()=>{if(!o||!f||p)return;const c=window.setTimeout(()=>E(y=>y+1),250);return()=>window.clearTimeout(c)},[R,p,o,f]),r.useEffect(()=>{const c=i.current;if(!c||typeof MutationObserver>"u")return;const y=new MutationObserver(()=>E(I=>I+1));return y.observe(c,{childList:!0,subtree:!0,characterData:!0}),()=>y.disconnect()},[]),r.useEffect(()=>{const c=Yt();c.width!==null&&(ct(c),V())},[]);const Q=r.useRef([]),he=r.useCallback(c=>{if(c===x.current)return;!c&&x.current&&(Q.current=ut(x.current)),c&&(Vn(c,Q.current,x.current),Q.current=[]);const y=x.current;x.current=c,c?ie().workspace.liveDocument.setContainer(c):y&&ie().workspace.liveDocument.releaseContainer(y),c?Zt(c):y&&Jt(y)},[]);r.useEffect(()=>{const c=i.current;if(!c)return;const y=new ResizeObserver(([I])=>{if(!I)return;const{width:X,height:xe}=I.contentRect;T(te=>te.width===X&&te.height===xe?te:{width:X,height:xe})});return y.observe(c),()=>y.disconnect()},[]);const mt=t?.config.resolution,A=Lt(g,mt),ge=A.kind==="fill",ft=ge||a,L=A.kind==="logical"?A.width:null,B=A.kind==="logical"?A.height:null,ve=d.dpr;r.useEffect(()=>{const c=ve??nn();a?u.width>0&&u.height>0&&se(u.width/(l+1),u.height,c):L===null||B===null?u.width>0&&u.height>0&&se(u.width,u.height,c):se(L,B,c)},[L,B,u.width,u.height,ve,o,a,l]);const ee=Bt(u,{width:L??0,height:B??0},{allowUpscale:A.kind==="logical"&&A.allowUpscale}),F=ge?1:ee.scale;r.useEffect(()=>{On(F)},[F]);const b=d.safeArea,ye={"--vgai-safe-area-inset-top":`${b?.top??0}px`,"--vgai-safe-area-inset-right":`${b?.right??0}px`,"--vgai-safe-area-inset-bottom":`${b?.bottom??0}px`,"--vgai-safe-area-inset-left":`${b?.left??0}px`};return s.jsx("div",{style:{overflow:"hidden",position:"relative",flexDirection:"column",...e},children:s.jsxs("div",{ref:i,style:{flex:1,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",position:"relative"},children:[(()=>{const c=ft?s.jsx("div",{ref:he,"data-testid":"game-runtime-container","aria-hidden":"true",style:{position:"absolute",inset:0,...o?{}:{visibility:"hidden"},...ye}},"game-mount-fill"):s.jsxs("div",{style:{position:"relative",width:ee.width,height:ee.height,overflow:"hidden",...o?{}:{visibility:"hidden"}},children:[s.jsx("div",{ref:he,"data-testid":"game-runtime-container","aria-hidden":"true",style:{width:L??0,height:B??0,transformOrigin:"top left",transform:`scale(${F})`,...ye}}),b&&s.jsx("div",{"data-testid":"device-safe-area-overlay",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:2},children:[["top",b.top,{top:0,left:0,right:0,height:b.top*F}],["bottom",b.bottom,{bottom:0,left:0,right:0,height:b.bottom*F}],["left",b.left,{top:0,bottom:0,left:0,width:b.left*F}],["right",b.right,{top:0,bottom:0,right:0,width:b.right*F}]].map(([y,I,X])=>I>0?s.jsx("div",{"data-testid":`device-safe-area-${y}`,style:{position:"absolute",...X,background:h.semantic.dangerFaint,boxShadow:`inset 0 0 0 1px ${h.semantic.dangerMuted}`}},y):null)})]},"game-mount-device");return a?s.jsxs(s.Fragment,{children:[s.jsx(dt,{name:qe(0),testId:"game-instance-slot-0",focused:m===Me(),onFocus:()=>We(Me()),children:c}),Array.from({length:l},(y,I)=>s.jsx(Ln,{index:I},I))]}):c})(),!o&&s.jsxs("div",{"data-testid":"game-stopped-placeholder",style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:6,background:h.surface.shell,color:h.content.dim,fontSize:11,pointerEvents:"none"},children:[s.jsx("span",{style:{color:h.content.primary,fontSize:13},children:"Game is stopped"}),s.jsx("span",{children:"Press Play to start the composed runtime."})]}),o&&s.jsx(fn,{explanation:k,testId:"game-surface-status",style:{zIndex:30,background:h.surface.shell}})]})})}function Fe(){return Xe().map(({id:e,name:t})=>`${e}\0${t}`).join("")}function Un({instanceId:e}){const t=K();r.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot);const n=r.useSyncExternalStore(me,Y,Y),[,o]=r.useState(0);r.useEffect(()=>{const g=window.setInterval(()=>o(u=>u+1),250);return()=>window.clearInterval(g)},[]);const i=Je(e),l=zt(),a=i?(i.loop.activeTimeouts??0)+(i.loop.activeIntervals??0)+(i.loop.activeAnimationFrames??0)+i.loop.pending:0,m=i?i.listeners.window+i.listeners.document:0,d=[["Mount",e],["Simulation",t.playState==="paused"?"Paused":"Running"],["Input",n===e?"Keyboard focus":"Inactive"],["Input events",i?`${i.loop.input??0} observed · ${i.loop.inputBlocked??0} blocked`:"Not measured"],["Network",l?l.getConnectionState?.()??"Not reported by this adapter":"Not registered"],["Owned callbacks",String(a)],["Owned listeners",String(m)],["Realm globals",String(i?.globals??0)],["Browser storage",i?`Shared origin · ${i.storage.local.reads+i.storage.session.reads} reads · ${i.storage.local.writes+i.storage.session.writes} writes`:"Shared origin"]];return s.jsx("div",{role:"none",style:{display:"grid",gridTemplateColumns:"112px minmax(120px, 1fr)",gap:"4px 12px",padding:"8px 10px",fontSize:10,lineHeight:"15px"},children:d.map(([g,u])=>s.jsxs("div",{style:{display:"contents"},children:[s.jsx("span",{style:{color:h.content.dim},children:g}),s.jsx("span",{style:{color:h.content.primary,fontFamily:g==="Mount"?h.typography.mono:void 0,overflow:"hidden",textOverflow:"ellipsis"},children:u})]},g))})}function Wn(){r.useSyncExternalStore(Ke,Fe,Fe),r.useSyncExternalStore(At,je,je);const e=Xe(),t=Ft(),n=e.find(d=>d.id===t)??e[0],[o,i]=r.useState(!1),l=r.useRef(null);if(e.length<2||!n)return null;const m=(Je(n.id)?.loop.firedWhileHeld??0)>0;return s.jsxs("div",{className:"vgai-playbar-popover-anchor",children:[s.jsxs(H,{ref:l,variant:"ghost",size:"compact","aria-haspopup":"menu","aria-expanded":o,onClick:()=>i(d=>!d),title:`Runtime instruments inspect ${n.name}; agent-addressed commands are unchanged`,children:[s.jsx(ue,{icon:_t,size:"sm",style:{color:m?h.semantic.warning:void 0}}),s.jsxs($e,{variant:"code",children:["Inspect ",n.name]}),s.jsx(Ne,{direction:"down"})]}),o&&s.jsxs(J,{anchorRef:l,gap:3,onDismiss:()=>i(!1),style:{minWidth:270},children:[e.map(d=>s.jsxs(G,{role:"menuitemradio","aria-checked":d.id===n.id,onSelect:()=>$t(d.id),children:[d.id===n.id?"✓ ":" ",d.name]},d.id)),s.jsx(Tt,{}),s.jsx(Un,{instanceId:n.id})]})]})}let q=!1,ce=0,S=null,O=null,W=null,j=null,_=0;function _e(){return q}function qn(e){e!==q&&(q=e,e?ce=requestAnimationFrame(pt):(cancelAnimationFrame(ce),W?.setDebugDrawEnabled?.(!1),Zn()))}function pt(){if(!q)return;ce=requestAnimationFrame(pt);const e=pe(),t=e?Oe(de().physics):null;if(t!==W&&(W?.setDebugDrawEnabled?.(!1),W=t,t?.setDebugDrawEnabled?.(!0)),Kn(e),!S||!e)return;const n=t?.contactPoints?.()??null;Xn(S,n)}function Kn(e){e!==O&&(O&&S&&O.remove(S),O=e,e&&(S||(S=new fe,S.name="physics-debug-draw",Ve(S,"editorHelper",!0)),e.add(S)))}function Xn(e,t){const n=t?t.length/3:0;if(!j){_=64;const l=new Ze;l.setAttribute("position",new Ce(new Float32Array(_*3),3));const a=new dn({color:16724821,size:10,sizeAttenuation:!1,depthTest:!1,transparent:!0,opacity:.95});j=new pn(l,a),j.renderOrder=999,j.frustumCulled=!1,e.add(j)}const o=j.geometry;if(n>_){for(;_<n;)_*=2;o.setAttribute("position",new Ce(new Float32Array(_*3),3))}const i=o.getAttribute("position");t&&n>0&&i.array.set(t),i.needsUpdate=!0,o.setDrawRange(0,n),j.visible=n>0}function Yn(){const e=pe(),n=(e?Oe(de().physics):null)?.debugDraw?.()??null;let o=!1;n&&e&&e.traverse(a=>{a===n&&(o=!0)});const i=n?.geometry.getAttribute("position"),l=j?.geometry.drawRange.count??0;return{enabled:q,wireframeInScene:o,wireframeVisible:n?.visible??!1,wireframeVertexCount:i?.count??0,contactMarkerCount:j?.visible&&Number.isFinite(l)?l:0}}typeof window<"u"&&(window.__vgaiPhysicsDebug=Yn);function Zn(){S&&(O?.remove(S),j&&(j.geometry.dispose(),j.material.dispose()),S.clear()),j=null,_=0,S=null,O=null,W=null}function Jn(){const[e,t]=r.useState(!1),n=r.useRef(null);return s.jsxs("div",{style:{position:"relative"},children:[s.jsxs(H,{ref:n,type:"button",variant:"outline",size:"compact","data-testid":"game-debug-menu","aria-haspopup":"menu","aria-expanded":e,"aria-controls":e?"vgai-game-debug-menu":void 0,onClick:()=>t(o=>!o),children:[s.jsx("span",{children:"Debug"}),s.jsx(Ne,{direction:"down"})]}),e&&s.jsxs(J,{id:"vgai-game-debug-menu",anchorRef:n,gap:3,onDismiss:()=>t(!1),style:{minWidth:190},children:[s.jsxs(G,{onClick:()=>{An(!Ae()),V()},children:[Ae()?"✓ ":" ","Crowd debug draw"]}),s.jsxs(G,{onClick:()=>{qn(!_e()),V()},children:[_e()?"✓ ":" ","Physics debug draw"]})]})]})}function Qn(e){const t=r.useSyncExternalStore(Te,ze),n=K();return r.useSyncExternalStore(n.subscribe,n.getShellSnapshot??n.getSnapshot),r.useSyncExternalStore(it,ot),r.useSyncExternalStore(Be,Ue),s.jsxs("div",{"data-testid":"game-doc-toolbar",style:{display:"grid",alignItems:"center",gridTemplateColumns:"minmax(0, 1fr) auto minmax(0, 1fr)",width:"100%",gap:6,padding:"2px 8px"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",minWidth:0,overflow:"auto"},children:[s.jsx(Wn,{}),s.jsx(Tn,{onPresetChange:o=>{ct(o),V()}}),s.jsx(Ut,{resolution:lt(rt(),t?.config.resolution),options:Nn(t?.config.resolution),onResolutionChange:o=>{Le(sn),at(o)},scale:Gn(),title:"Change game resolution"}),s.jsx(Jn,{}),n.playState!=="stopped"&&s.jsx(zn,{})]}),s.jsx(Ht,{placement:"runtime"}),s.jsx("div",{style:{display:"flex",justifyContent:"flex-end",minWidth:0},children:s.jsx(En,{})})]})}function es(e){const t=K();r.useSyncExternalStore(t.subscribe,t.getShellSnapshot??t.getSnapshot);const n=t.playState!=="stopped";return s.jsxs("div",{style:{flex:1,position:"relative",display:"flex",flexDirection:"column"},children:[s.jsx(Bn,{style:{flex:1,position:"relative",display:"flex",flexDirection:"column",pointerEvents:"auto",...t.playState==="playing"?{outline:`2px solid ${h.semantic.success}`,outlineOffset:-2}:n?{outline:`2px solid ${h.semantic.warning}`,outlineOffset:-2}:{}}}),t.playState==="paused"&&s.jsx("div",{"data-testid":"game-paused-notice",style:{position:"absolute",left:"50%",top:12,transform:"translateX(-50%)",padding:"6px 12px",borderRadius:6,background:"rgba(0,0,0,.72)",color:h.content.primary,fontSize:12,letterSpacing:".04em",pointerEvents:"none",zIndex:2},children:"Paused by the editor — press ▶ Play to resume (Escape pauses)"})]})}const zi="workspace.service";function Ni(){return ie().workspace.liveDocument.register({Content:es,Toolbar:Qn})}export{zi as point,Ni as start};
@@ -1,2 +0,0 @@
1
- import{createGameModuleResolver as k,setFocusedInstanceProvider as M}from"./game-module-access-o3iXZpCA.js";import{n as d}from"./command-results-CUQD49AB.js";import{i as g}from"./active-ingest-DA426a81.js";import{i as y,t as h,u as w}from"./play-mode-DICV4cKP.js";import"./index-BRJMIUK0.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"./game-contract-seams-BnPFGLll.js";import"./capability-coverage-DZ-onC5j.js";import"./ingest-source-persistence-Dmdo-UBp.js";import"./contract-system-adapters-Bic_7sev.js";import"./adapter-runtime-bindings-4cmsRvRh.js";import"./native-debug-module-2_HVupdg.js";import"./native-entry-surface-BE8LJNdu.js";import"./debug-registry-P0_YQGWd.js";import"./seeded-random-BgCwIAAU.js";import"./game-audio-CaGKzia4.js";import"./game-network-Ct2FQYmu.js";import"./index-OZVqp6xS.js";import"./index-Da9JhEvW.js";import"./rapier-physics-adapter-CaZqWLu0.js";import"./events-156d8d12.esm-CYeuVCYr.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./index-bQE2NA0D.js";import"./live-project-verbs-C3LzprCe.js";import"./edit-mode-authoring-DeCxPcHM.js";import"./json-history-resource-DwS10tqD.js";import"./binding-resolver-dE0GnZT5.js";import"./adapter-surface-Y37Nzcyw.js";import"./entry-adjudication-Dc18TIqT.js";import"./structural-signature-Dc7skRiy.js";import"./webgl-frame-capture-DdJkM2mi.js";import"./realm-services-CnY105XU.js";import"./canvas-entry-runtime-UNYuSfG0.js";import"./three-ingest-runtime-B7rtg3QE.js";import"./EffectComposer-BEAt0PtQ.js";import"./CopyShader-BzTUYzf6.js";import"./ShaderPass-DTnDQXm0.js";import"./Pass-D1MRT672.js";import"./CSS3DRenderer-BsAqfavI.js";import"./relative-path-guard-GiM7Lsz8.js";import"./react-root-BHA-cdrW.js";import"./editor-presentation-activity-C7SNSmTd.js";import"./pixi-story-model-DNkfnWUV.js";import"./surface-content-Dg9Kkazf.js";import"./viewport-root-presentation-vgxsTyj4.js";import"./mounted-authoring-Clftxx0x.js";import"./entity-object-JmYMfLsx.js";import"./user-data-Bpj7diUS.js";import"./workspace-arrangement-BdAlBwvd.js";import"./three-contract-Dkt6PmWY.js";import"./three-TCuY32m_.js";import"./editor-layers-BDJnAAzj.js";import"./component-instance-root-B0C5oNEm.js";import"./viewport-editor-controls-BYaAZ_Ku.js";import"./three-authoring-adapter-htbnVej2.js";import"./source-persistence-backend-CwLYVPXj.js";import"./three-projection-core-CG01r5Ta.js";import"./body-marks-RKb_LTwL.js";import"./user-data-dHvLdpwM.js";import"./object-marks-DwvIEBOK.js";import"./structural-ids-Br2zjINh.js";import"./object3d-authoring-subject-BDrxd1GA.js";import"./r3f-physics-binding-DzrbpqjM.js";import"./deferred-ingest-play-BdR4qGk6.js";import"./rrweb-Cd2ifIRP.js";import"./react-world-authoring-adapter-DOjv2pYm.js";import"./board-guides-BEKPgD9M.js";import"./relative-import-specifier-BFKIWEWs.js";import"./story-arg-descriptors-Ek86ExX7.js";import"./inspect-Dr4qvDpJ.js";import"./inference-diagnostics-xecGdohW.js";import"./writer-tw6EcuVO.js";import"./three-state-DwFE3ay2.js";import"./editor-shell-store-ChLcVeNB.js";import"./output-pass-HurwNl0G.js";import"./viewport-door-Bj_ZIP85.js";class E extends Error{member;supported;constructor(e,r,o){super(`playwright-shim: ${e}.${r} is not supported by the in-page shim. Supported ${e} members: ${o.join(", ")}. This shim is DOM-only — canvas gameplay input must use game.input.*, while React-only DOM games may use Page keyboard/locator input. See packages/editor/src/playwright-shim.ts for the full supported subset and the wire's closure-capture limitation.`),this.name="PageShimUnsupportedError",this.member=r,this.supported=o}}function b(t,e){const r=Object.keys(t);return new Proxy(t,{get(o,i,n){if(typeof i=="symbol"||i in o)return Reflect.get(o,i,n);throw new E(e,i,r)}})}function m(t){return t.replace(/\s+/g," ").trim()}function O(t){const e=t.tagName.toLowerCase();if(e==="button")return"button";if(e==="a"&&t.hasAttribute("href"))return"link";if(/^h[1-6]$/.test(e))return"heading";if(e==="textarea")return"textbox";if(e==="select")return"combobox";if(e==="img")return"img";if(e==="input"){const r=(t.getAttribute("type")??"text").toLowerCase();return r==="button"||r==="submit"||r==="reset"?"button":r==="checkbox"?"checkbox":r==="radio"?"radio":"textbox"}return null}function v(t){return t.getAttribute("role")??O(t)}function S(t){const e=t.getAttribute("aria-label");return e&&e.trim()?m(e):m(t.textContent??"")}function T(t,e){if(e===void 0)return!0;const r=S(t);return e instanceof RegExp?e.test(r):r===e}function x(t,e,r){return Array.from(t.querySelectorAll("*")).filter(i=>v(i)===e&&T(i,r?.name))}function I(t,e){const r=Array.from(t.querySelectorAll("*")).filter(n=>n.tagName!=="SCRIPT"&&n.tagName!=="STYLE"),o=n=>{const s=m(n.textContent??"");return s.length===0?!1:e instanceof RegExp?e.test(s):s.includes(e)},i=r.filter(o);return i.filter(n=>!i.some(s=>s!==n&&n.contains(s)))}function C(t,e){return Array.from(t.querySelectorAll("[data-testid]")).filter(r=>{const o=r.getAttribute("data-testid")??"";return e instanceof RegExp?e.test(o):o===e})}function L(t){if(!(t instanceof HTMLElement))return!0;if(t.hidden)return!1;const e=getComputedStyle(t);return e.display!=="none"&&e.visibility!=="hidden"&&e.opacity!=="0"}function _(t){const e=t.getBoundingClientRect?.()??{left:0,top:0,width:0,height:0},r=e.left+e.width/2,o=e.top+e.height/2,i={bubbles:!0,cancelable:!0,clientX:r,clientY:o,button:0};typeof PointerEvent<"u"&&t.dispatchEvent(new PointerEvent("pointerdown",{...i,pointerId:1,isPrimary:!0})),t.dispatchEvent(new MouseEvent("mousedown",i)),typeof PointerEvent<"u"&&t.dispatchEvent(new PointerEvent("pointerup",{...i,pointerId:1,isPrimary:!0})),t.dispatchEvent(new MouseEvent("mouseup",i)),t.dispatchEvent(new MouseEvent("click",i))}function N(t){const e=t instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(e,"value");return o=>{r?.set?r.set.call(t,o):t.value=o}}function G(t,e){if(!(t instanceof HTMLInputElement)&&!(t instanceof HTMLTextAreaElement))throw new Error(`playwright-shim: fill() target is not an <input>/<textarea> (got <${t.tagName.toLowerCase()}>)`);t.focus(),N(t)(e),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))}const l=new Set(["Alt","Control","Meta","Shift"]);function p(t){return t!=="ControlOrMeta"?t:/Mac|iPhone|iPad/.test(navigator.platform)?"Meta":"Control"}function B(t){return/^[a-z]$/i.test(t)?`Key${t.toUpperCase()}`:/^[0-9]$/.test(t)?`Digit${t}`:t===" "?"Space":t}function K(t){const e=document.activeElement;return e instanceof HTMLElement&&t.contains(e)?e:t}function f(t,e,r,o){K(t).dispatchEvent(new KeyboardEvent(e,{key:r,code:B(r),bubbles:!0,cancelable:!0,altKey:o.has("Alt"),ctrlKey:o.has("Control"),metaKey:o.has("Meta"),shiftKey:o.has("Shift")}))}function F(t){const e=new Set,r=async i=>{const n=p(i);e.add(n),f(t,"keydown",n,e)},o=async i=>{const n=p(i);f(t,"keyup",n,e),e.delete(n)};return{down:r,up:o,async press(i){const n=i.split("+").map(p),s=n.filter(c=>l.has(c)),a=n.find(c=>!l.has(c));for(const c of s)await r(c);a&&(await r(a),await o(a));for(const c of s.reverse())await o(c)}}}function R(t){const e=[];function r(o,i){const n=v(o);if(n){const a=S(o);e.push(`${" ".repeat(i)}- ${n}${a?` "${a}"`:""}`)}const s=n?i+1:i;for(const a of Array.from(o.children))r(a,s)}for(const o of Array.from(t.children))r(o,0);return e.join(`
2
- `)}function u(t,e){const r=i=>{const n=t()[0];if(!n)throw new Error(`playwright-shim: ${i}() found no element for ${e}`);return n};return b({async click(){_(r("click"))},async fill(i){G(r("fill"),i)},async textContent(){const i=t()[0];return i?i.textContent??null:null},async evaluate(i,n){return i(r("evaluate"),n)},async count(){return t().length},async waitFor(i){const n=i?.timeout??5e3,s=i?.state??"visible",a=Date.now()+n;for(;;){const c=t()[0];if(c&&(s==="attached"||L(c)))return;if(Date.now()>=a)throw new Error(`playwright-shim: waitFor() timed out after ${n}ms waiting for ${e} to be ${s}`);await new Promise(P=>setTimeout(P,50))}},first(){return u(()=>t().slice(0,1),`${e}.first()`)},nth(i){return u(()=>{const n=t()[i];return n?[n]:[]},`${e}.nth(${i})`)},async ariaSnapshot(){return R(r("ariaSnapshot"))}},"Locator")}async function D(t,e){if(typeof t=="function")return t(e);if(typeof t=="string")return new Function("arg",`return (${t})(arg)`)(e);throw new Error("playwright-shim: evaluate() requires a function or a function-source string")}function A(t){const e={keyboard:F(t),evaluate:async(r,o)=>D(r,o),locator:r=>u(()=>Array.from(t.querySelectorAll(r)),`locator(${JSON.stringify(r)})`),getByRole:(r,o)=>u(()=>x(t,r,o),`getByRole(${JSON.stringify(r)}${o?.name!==void 0?`, {name: ${JSON.stringify(String(o.name))}}`:""})`),getByText:r=>u(()=>I(t,r),`getByText(${JSON.stringify(String(r))})`),getByTestId:r=>u(()=>C(t,r),`getByTestId(${JSON.stringify(String(r))})`),click:async r=>{await e.locator(r).click()},fill:async(r,o)=>{await e.locator(r).fill(o)},ariaSnapshot:async()=>R(t)};return b(e,"Page")}const Ee="workspace.command";typeof window<"u"&&(M(w),window.__vgaiGameEval=async(t,e)=>{const r=await $({src:t,...e===void 0?{}:{instance:e}});if(!r.ok)throw new Error(r.error??"game-eval failed");return r.data?.result??null});async function $(t){if(!y()&&!g())return d();const e=t.src;if(typeof e!="string")return{ok:!1,error:`game-eval requires a string "src" (the step's toString())`};const r=h();if(!r)return{ok:!1,error:"game-eval: no play-mode game container is mounted yet",data:{code:"GAME_EVAL_ERROR"}};const o=t.instance,i=typeof o=="string"?o:void 0;let n;try{n=new Function("scope",`return (${e})(scope)`)}catch(a){return{ok:!1,error:`game-eval: failed to reconstruct the step function from source — ${a instanceof Error?a.message:String(a)}`,data:{code:"GAME_EVAL_ERROR"}}}const s={page:A(r),modules:k(i),instanceId:i??w()};try{const a=await n(s),c=a===void 0?null:a;try{JSON.stringify(c)}catch{return{ok:!1,error:`game-eval: the step returned an unserializable value (${Object.prototype.toString.call(c)}) — return plain data (numbers, strings, arrays, plain objects), not live module objects.`,data:{code:"GAME_EVAL_UNSERIALIZABLE"}}}return{ok:!0,data:{result:c}}}catch(a){return{ok:!1,error:`game-eval step failed: ${a instanceof Error?a.stack??a.message:String(a)}`,data:{code:"GAME_EVAL_ERROR"}}}}async function H(t){if(!y()&&!g())return d();const e=t.src;if(typeof e!="string")return{ok:!1,error:`page-script requires a string "src" (the step's toString())`};const r=h();if(!r)return{ok:!1,error:"page-script: no play-mode game container is mounted yet",data:{code:"PAGE_SCRIPT_ERROR"}};let o;try{o=new Function("page",`return (${e})(page)`)}catch(n){return{ok:!1,error:`page-script: failed to reconstruct the step function from source — ${n instanceof Error?n.message:String(n)}`,data:{code:"PAGE_SCRIPT_ERROR"}}}const i=A(r);try{const n=await o(i);return{ok:!0,data:{result:n===void 0?null:n}}}catch(n){return n instanceof E?{ok:!1,error:n.message,data:{code:"PAGE_SHIM_UNSUPPORTED",member:n.member,supported:[...n.supported]}}:{ok:!1,error:`page-script: step threw — ${n instanceof Error?n.message:String(n)}`,data:{code:"PAGE_SCRIPT_ERROR"}}}}const be={"game-eval":{timeoutMs:6e4,derivedRefresh:"always",handle:$},"page-script":{timeoutMs:6e4,derivedRefresh:"always",handle:H}};export{be as commands,Ee as point};
@@ -1 +0,0 @@
1
- import{S as B,u as N,p as z}from"./index-OZVqp6xS.js";import{decode as d,encode as x}from"./index-Da9JhEvW.js";const R=10,D=11,k=12,S=13,W=14,J=15,P=17,M=18,A=2e3,u=[],_=new WeakMap,y=new WeakMap;let I={latencyMs:0,jitterMs:0,packetLoss:0};function $(e,t,s){const{latencyMs:n,jitterMs:o}=I,r=performance.now(),i=t==="in"?e.dueIn:e.dueOut;if(n<=0&&o<=0&&i<=r){s();return}const c=Math.max(i,r+n+Math.random()*o);t==="in"?e.dueIn=c:e.dueOut=c,setTimeout(s,c-r)}const w=new Map,p=[];let L=0;const O=new Set;let g={start:0,msgsIn:0,msgsOut:0,bytesIn:0,bytesOut:0},h={msgsIn:0,msgsOut:0,bytesIn:0,bytesOut:0};function f(){for(const e of O)e()}function E(e){const t=e-g.start;t<1e3||(h=t<2e3?{...g}:{msgsIn:0,msgsOut:0,bytesIn:0,bytesOut:0},g={start:e,msgsIn:0,msgsOut:0,bytesIn:0,bytesOut:0})}function a(e,t,s,n,o){const r=Date.now();E(r),t==="in"?(g.msgsIn+=1,g.bytesIn+=n):(g.msgsOut+=1,g.bytesOut+=n);let i=e.types.get(s);i||(i={type:s,countIn:0,countOut:0,bytesIn:0,bytesOut:0},e.types.set(s,i)),t==="in"?(i.countIn+=1,i.bytesIn+=n):(i.countOut+=1,i.bytesOut+=n),o!==void 0&&(i.last=o),L+=1,p.push({seq:L,time:performance.now(),direction:t,type:s,size:n}),p.length>A&&p.splice(0,p.length-A)}function b(e,t){const s=e;return d.stringCheck(s,t)?d.string(s,t):String(d.number(s,t))}function G(e,t){const s=t[0],n={offset:1},o=t;try{if(s===R)d.utf8Read(o,n,t[n.offset++]),d.utf8Read(o,n,t[n.offset++])==="schema"&&!e.serializer&&(e.serializer=new B,t.byteLength>n.offset&&e.serializer.handshake(t,n)),e.state="connected",e.joinedAt??=Date.now(),a(e,"in","join",t.byteLength);else if(s===D){const r=d.number(o,n),i=d.string(o,n);e.error=`${r}: ${i}`,e.state="error",a(e,"in","error",t.byteLength)}else if(s===k)a(e,"in","leave",t.byteLength);else if(s===W)e.serializer?.setState(t,n),e.stateBytes=t.byteLength,a(e,"in","state",t.byteLength);else if(s===J)e.serializer?.patch(t,n),e.patches+=1,e.patchBytes+=t.byteLength,a(e,"in","patch",t.byteLength);else if(s===S){const r=b(t,n),i=t.byteLength>n.offset?N(t,{start:n.offset}):void 0;a(e,"in",r,t.byteLength,i)}else if(s===P)a(e,"in",b(t,n),t.byteLength);else if(s===M){e.pingSentAt!==null&&(e.rttMs=Math.round(performance.now()-e.pingSentAt)),e.pingSentAt=null;const r=y.get(e);y.delete(e),r&&e.rttMs!==null&&r(e.rttMs),a(e,"in","ping",t.byteLength)}}catch(r){e.error||(e.error=`the editor could not read a frame (code ${s}): ${String(r)}`)}f()}function q(e,t){const s=t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):null;if(!s||s.byteLength===0)return;const n=s[0],o={offset:1};try{if(n===S){const r=b(s,o),i=s.byteLength>o.offset?N(s,{start:o.offset}):void 0;a(e,"out",r,s.byteLength,i)}else n===P?a(e,"out",b(s,o),s.byteLength):n===M?(e.pingSentAt=performance.now(),a(e,"out","ping",s.byteLength)):n===R?a(e,"out","join",s.byteLength):n===k&&a(e,"out","leave",s.byteLength)}catch{}f()}function F(e){let t;try{t=new URL(e,location.href)}catch{return null}const s=t.searchParams.get("sessionId"),n=t.pathname.split("/").filter(Boolean);if(!s||n.length<2)return null;const o=n[n.length-1];return{processId:n[n.length-2],roomId:o,sessionId:s,endpoint:`${t.protocol}//${t.host}`}}function V(e,t){const s=F(t);if(!s)return;const n={...s,state:"connecting",joinedAt:null,closedAt:null,closeCode:null,error:null,serializer:null,pingSentAt:null,rttMs:null,stateBytes:0,patches:0,patchBytes:0,types:new Map,socket:e,dueIn:0,dueOut:0};u.push(n),_.set(e,n),e.addEventListener("message",r=>{r.data instanceof ArrayBuffer&&G(n,new Uint8Array(r.data))}),e.addEventListener("close",r=>{n.state="disconnected",n.closedAt=Date.now(),n.closeCode=r.code,f()}),e.addEventListener("error",()=>{n.state="error",n.error??="the socket reported an error",f()});const o=e.send.bind(e);e.send=r=>{q(n,r),$(n,"out",()=>{e.readyState===e.OPEN&&o(r)})},f()}function Y(e,t){const s=typeof e=="string"?e:e instanceof URL?e.href:e.url;/\/matchmake\//.test(s)&&t.clone().json().then(n=>{const o=n.room??n;typeof o.roomId=="string"&&typeof o.name=="string"&&(w.set(o.roomId,o.name),f())}).catch(()=>{})}function Z(){const e=window;if(e.__vgaiNetworkObserver)return;e.__vgaiNetworkObserver=!0;const t=window.WebSocket;if(typeof t=="function"){const n=class extends t{constructor(o,r){super(o,r),V(this,String(o))}set onmessage(o){const r=_.get(this);super.onmessage=o&&r?i=>$(r,"in",()=>o.call(this,i)):o}get onmessage(){return super.onmessage}};window.WebSocket=n}const s=window.fetch;typeof s=="function"&&(window.fetch=async(n,o)=>{const r=await s(n,o);return Y(n,r),r})}function j(e){if(typeof e=="string")return e;if(typeof e=="function")return"schema";if(e&&typeof e=="object"){const[t,s]=Object.entries(e)[0]??[];if(t)return`${t}<${j(s)}>`}return"unknown"}function H(e,t){let s=e,n=null,o=null;for(const r of t){if(s==null)return null;const i=s.constructor?.[Symbol.metadata];if(i&&typeof i[r]=="number")o=i[i[r]]?.type??null,n=o&&typeof o=="object"?Object.values(o)[0]:null,s=s[r];else{o=n,n=null;const c=s;s=c.get?c.get(String(r)):c.at?c.at(Number(r)):void 0}}return o===null?null:j(o)}function U(e){return`${e.endpoint.replace(/^ws/,"http")}/monitor/api`}async function T(e){const t=await fetch(e).catch(()=>null);return!t||!t.ok?null:await t.json().catch(()=>null)}async function m(e,t,s,n){const o=l();if(!o)throw new Error("No room is observed.");const r=new URLSearchParams({roomId:n??o.roomId,method:e,args:JSON.stringify(t)}),i=await fetch(`${U(o)}/room/call?${r}`);if(i.status===404)throw new Error(`The room server serves no Monitor view, so ${s} has nowhere to go (its \`server\` configuration sets VGAI_ROOM_MONITOR=1).`);if(!i.ok)throw new Error(`The room server refused ${s} (${i.status}).`)}function l(){for(let e=u.length-1;e>=0;e-=1)if(u[e].state!=="disconnected")return u[e];return u[u.length-1]??null}function K(e){const t=e?.serializer?.getState();return t?.toJSON?t.toJSON():t}function C(){return E(Date.now()),{msgsInPerSec:h.msgsIn,msgsOutPerSec:h.msgsOut,bytesInPerSec:h.bytesIn,bytesOutPerSec:h.bytesOut}}const ee={peers(){return u.filter(e=>e.state==="connected").map(e=>({id:e.sessionId,label:`${w.get(e.roomId)??e.roomId} (this client)`}))},networkId:()=>null,authority:()=>"server",editable:()=>!1,getConnectionState(){return l()?.state??"disconnected"},getRoomInfo(){const e=l();return e?{roomId:e.roomId,sessionId:e.sessionId,roomName:w.get(e.roomId)??""}:null},getReplicationStats(){const t=l()?.serializer?.decoder?.root?.refs,s=C();return{entities:t?.size??0,msgsInPerSec:s.msgsInPerSec,msgsOutPerSec:s.msgsOutPerSec}},subscribe(e){return O.add(e),()=>{O.delete(e)}},getStateSnapshot:()=>K(l()),messageEvents(e=0){return p.filter(t=>t.seq>e)},getRates:C,sendMessage(e,t){const s=l();if(!s||s.state!=="connected")throw new Error("No room is connected to send into.");const n=new Uint8Array(6+e.length*3);n[0]=S;const o={offset:1};x.string(n,e,o);const r=t===void 0?new Uint8Array(0):new Uint8Array(z(t)),i=new Uint8Array(o.offset+r.byteLength);i.set(n.subarray(0,o.offset)),i.set(r,o.offset),s.socket.send(i)},getConditioning:()=>({...I}),setConditioning(e){I={latencyMs:Math.max(0,e.latencyMs),jitterMs:Math.max(0,e.jitterMs),packetLoss:0},f()},getConditioningLimits:()=>({packetLoss:"A WebSocket is reliable and ordered: a lost packet is resent, so loss is not simulated here."}),ping(){const e=l();return!e||e.state!=="connected"?Promise.reject(new Error("No room is connected to ping.")):new Promise((t,s)=>{y.set(e,t),setTimeout(()=>{y.get(e)===t&&(y.delete(e),s(new Error("The server did not answer the ping within 5 s.")))},5e3),e.socket.send(new Uint8Array([M]))})},async inspectServer(e){const t=l();if(!t)return null;const s=U(t),n=await T(`${s}/`);if(!n)return null;const o=e??t.roomId,r=await T(`${s}/room?roomId=${encodeURIComponent(o)}`),i=c=>{const v=Number(c);return Number.isFinite(v)?v:null};return{rooms:(n.rooms??[]).map(c=>({roomId:c.roomId,name:c.name,clients:c.clients,maxClients:i(c.maxClients),locked:c.locked===!0,elapsedMs:c.elapsedTime??0})),connections:n.connections??0,cpuPercent:typeof n.cpu=="number"&&Number.isFinite(n.cpu)?n.cpu:null,memory:n.memory?.usedMemMb!==void 0&&n.memory.totalMemMb!==void 0?{usedMb:n.memory.usedMemMb,totalMb:n.memory.totalMemMb}:null,room:r?{roomId:o,clients:(r.clients??[]).map(c=>({sessionId:c.sessionId,elapsedMs:c.elapsedTime})),stateBytes:r.stateSize??0,...r.state!==void 0?{state:r.state}:{}}:null}},disconnectClient:(e,t)=>m("_forceClientDisconnect",[e],"the disconnect",t),editServerState:(e,t,s)=>m("_editStateProperty",[e,t],"the state edit",s),deleteServerState:(e,t)=>m("_deleteStateProperty",[e],"the state delete",t),sendToClient:(e,t,s,n)=>m("_sendMessageToClient",[e,t,s],"the send",n),broadcast:(e,t,s)=>m("broadcast",[e,t],"the broadcast",s),disposeRoom:e=>m("disconnect",[],"the dispose",e),clearTraffic(){for(const e of u)e.types.clear(),e.patches=0,e.patchBytes=0;f()},stateFieldType(e){return H(l()?.serializer?.getState(),e)},getTrafficByType(){const e=l();return e?[...e.types.values()].map(({type:t,countIn:s,countOut:n,bytesIn:o,bytesOut:r})=>({type:t,countIn:s,countOut:n,bytesIn:o,bytesOut:r})):[]},getServerConfig(){const e=l();if(!e)return null;const t=w.get(e.roomId);return t?{endpoint:e.endpoint,roomName:t}:{endpoint:e.endpoint}}};export{Z as i,ee as o};
@@ -1 +0,0 @@
1
- import{a3 as a}from"./index-BRJMIUK0.js";import{s as n,n as s}from"./command-results-CUQD49AB.js";import{g as m,i as p}from"./play-mode-DICV4cKP.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"./adapter-runtime-bindings-4cmsRvRh.js";import"./native-debug-module-2_HVupdg.js";import"./native-entry-surface-BE8LJNdu.js";import"./debug-registry-P0_YQGWd.js";import"./contract-system-adapters-Bic_7sev.js";import"./game-contract-seams-BnPFGLll.js";import"./seeded-random-BgCwIAAU.js";import"./game-audio-CaGKzia4.js";import"./game-network-Ct2FQYmu.js";import"./index-OZVqp6xS.js";import"./index-Da9JhEvW.js";import"./rapier-physics-adapter-CaZqWLu0.js";import"./events-156d8d12.esm-CYeuVCYr.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./index-bQE2NA0D.js";import"./live-project-verbs-C3LzprCe.js";import"./capability-coverage-DZ-onC5j.js";import"./edit-mode-authoring-DeCxPcHM.js";import"./json-history-resource-DwS10tqD.js";import"./binding-resolver-dE0GnZT5.js";import"./adapter-surface-Y37Nzcyw.js";import"./entry-adjudication-Dc18TIqT.js";import"./structural-signature-Dc7skRiy.js";import"./webgl-frame-capture-DdJkM2mi.js";import"./realm-services-CnY105XU.js";import"./canvas-entry-runtime-UNYuSfG0.js";import"./three-ingest-runtime-B7rtg3QE.js";import"./EffectComposer-BEAt0PtQ.js";import"./CopyShader-BzTUYzf6.js";import"./ShaderPass-DTnDQXm0.js";import"./Pass-D1MRT672.js";import"./CSS3DRenderer-BsAqfavI.js";import"./relative-path-guard-GiM7Lsz8.js";import"./react-root-BHA-cdrW.js";import"./editor-presentation-activity-C7SNSmTd.js";import"./active-ingest-DA426a81.js";import"./ingest-source-persistence-Dmdo-UBp.js";import"./pixi-story-model-DNkfnWUV.js";import"./surface-content-Dg9Kkazf.js";import"./viewport-root-presentation-vgxsTyj4.js";import"./mounted-authoring-Clftxx0x.js";import"./entity-object-JmYMfLsx.js";import"./user-data-Bpj7diUS.js";import"./workspace-arrangement-BdAlBwvd.js";import"./three-contract-Dkt6PmWY.js";import"./three-TCuY32m_.js";import"./editor-layers-BDJnAAzj.js";import"./component-instance-root-B0C5oNEm.js";import"./viewport-editor-controls-BYaAZ_Ku.js";import"./three-authoring-adapter-htbnVej2.js";import"./source-persistence-backend-CwLYVPXj.js";import"./three-projection-core-CG01r5Ta.js";import"./body-marks-RKb_LTwL.js";import"./user-data-dHvLdpwM.js";import"./object-marks-DwvIEBOK.js";import"./structural-ids-Br2zjINh.js";import"./object3d-authoring-subject-BDrxd1GA.js";import"./r3f-physics-binding-DzrbpqjM.js";import"./deferred-ingest-play-BdR4qGk6.js";import"./rrweb-Cd2ifIRP.js";import"./react-world-authoring-adapter-DOjv2pYm.js";import"./board-guides-BEKPgD9M.js";import"./relative-import-specifier-BFKIWEWs.js";import"./story-arg-descriptors-Ek86ExX7.js";import"./inspect-Dr4qvDpJ.js";import"./inference-diagnostics-xecGdohW.js";import"./writer-tw6EcuVO.js";import"./three-state-DwFE3ay2.js";import"./editor-shell-store-ChLcVeNB.js";import"./output-pass-HurwNl0G.js";import"./viewport-door-Bj_ZIP85.js";const Ve="workspace.command",Be={"list-gameplay-state":{derivedRefresh:"if-content-changed",handle:()=>{const e=a().debug;return e?{ok:!0,data:{providers:e.providers()}}:p()?{ok:!0,data:{providers:[]}}:s()}},"inspect-gameplay-state":{derivedRefresh:"if-content-changed",handle:e=>{const t=a().debug;if(!t)return p()?{ok:!0,data:{state:null}}:s();const r=e.keys;try{const o={};if(r&&r.length>0)for(const i of r)o[i]=t.state(i);else Object.assign(o,t.stateAll());return{ok:!0,data:{state:o}}}catch(o){return n(o)}}},"list-debug-commands":{derivedRefresh:"if-content-changed",handle:()=>{const e=a().debug;return e?{ok:!0,data:{commands:e.commands()}}:p()?{ok:!0,data:{commands:[]}}:s()}},"invoke-debug-command":{derivedRefresh:"always",handle:async e=>{const t=a().debug;if(!t)return p()?{ok:!1,error:`debug: no command registered under "${e.name}" — this game exposes no debug adapter`,data:{code:"DEBUG_COMMAND_NOT_REGISTERED",registered:[]}}:s();try{return{ok:!0,data:{result:await t.invoke(e.name,e.args??[])}}}catch(r){return n(r)}}},"inject-input":{derivedRefresh:"none",handle:e=>{const t=m();if(!t)return{ok:!1,error:"not in play mode — start play before injecting input"};let r;try{r=t.getInputTarget(e.worldId)}catch(o){return n(o)}if(!r)return{ok:!1,error:"this play session has no input door: no root entry exports `debug.input`"};try{if(e.kind==="action"){const i=e.atTick;return typeof i=="number"?(r.scheduleActionAtTick(i,e.action,e.value),{ok:!0,data:{scheduled:!0,tick:i}}):{ok:!0,data:r.setVirtualAction(e.action,e.value)}}const o=e.sourceId;switch(e.kind){case"axis":r.injectAxis(o,e.value);break;case"vector2":r.injectVector2(o,e.value);break;case"pointerDelta":r.injectPointerDelta(o,e.value);break;case"pointerPosition":r.injectPointerPosition(o,e.value);break;default:return{ok:!1,error:`unknown injection kind "${e.kind}"`}}return{ok:!0,data:{delivered:!0}}}catch(o){return n(o)}}},"set-time-scale":{derivedRefresh:"none",handle:e=>{const t=m();return t?(t.loop.timeScale=e.timeScale,{ok:!0,data:{timeScale:t.loop.timeScale}}):{ok:!1,error:"not in play mode — start play before setting time-scale"}}},"set-seed":{derivedRefresh:"none",handle:e=>{const t=m();return t?t.determinismDeclared?t.random?(t.random.reseed(e.seed),{ok:!0,data:{seed:t.random.seed}}):{ok:!1,error:"this play session has no first-party ctx.random to reseed"}:{ok:!1,error:"this project's manifest does not declare determinism.seededRandom — play.seed.set has no documented contract to reseed against (D15)",data:{code:"DETERMINISM_NOT_DECLARED"}}:{ok:!1,error:"not in play mode — start play before setting the seed"}}},"run-ticks":{derivedRefresh:"none",handle:async e=>{const t=m();if(!t)return{ok:!1,error:"not in play mode — start play before running ticks"};if(!t.runTicks)return{ok:!1,error:"this play session has no first-party Game to run ticks on",data:{code:"RUN_TICKS_UNAVAILABLE"}};try{const r=e.n,o=e.render;return t.runTicksSettled?await t.runTicksSettled(r,o?{render:o}:void 0):t.runTicks(r,o?{render:o}:void 0),{ok:!0}}catch(r){return n(r)}}}};export{Be as commands,Ve as point};
@@ -1 +0,0 @@
1
- import{jR as V,jS as Y,fi as O,dB as D,gS as E,jT as Q,jU as b,aK as X,Z as p,gU as Z,fu as H,jV as ee,jW as te,jX as w,jY as ne,jZ as ae,j_ as re,j$ as ie,k0 as oe,k1 as se,d4 as le,aI as h,iz as ce,eG as P,ij as R,e1 as B,M as de,$ as _,g3 as ue,k2 as ge,k3 as me,k4 as pe,gP as ve,k5 as fe,b4 as he,k6 as xe,fc as ye,a5 as Ce,fe as Ne}from"./index-BRJMIUK0.js";import{a as t}from"./jsx-runtime-DPjLkJKQ.js";import{r as u}from"./index-nmcBqr7Y.js";import{m as je}from"./model-thumbnail-BEKPWg4l.js";import"./index-CtzuWnCS.js";import{s as T,g as x,c as M,f as U,i as Ee,b as z,p as Se,r as J,d as ke,e as Te,m as $e,h as Ae,j as be,a as we}from"./generation-jobs-BZhOMrp-.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./renderer-ownership-BovSEcLv.js";import"./studio-environment-DRxxq_QX.js";import"./user-data-Bpj7diUS.js";import"./workspace-arrangement-BdAlBwvd.js";import"./KTX2Loader-CaqVE6nY.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./GLTFLoader-KeoruJgS.js";import"./BufferGeometryUtils-B22h7jo4.js";import"./environment-Dg-YaLsA.js";import"./RoomEnvironment-BkknvS_I.js";import"./EXRLoader-CITMBvGd.js";import"./HDRLoader-BTGuGhVo.js";function y(e){switch(e.status){case"queued":return"queued";case"running":return"running";case"failed":return"failed";case"cancelled":return"cancelled";default:return e.acceptedAt?"ready":e.accept?e.pollError?"save-failed":"saving":"no-asset"}}function F(e){const n=y(e);return n!=="queued"&&n!=="running"&&n!=="saving"}function L(e,n){return e.status==="succeeded"&&!!e.accept&&!e.acceptedAt&&!!(e.pollError??n)}const $={queued:"Queued",running:"Running",saving:"Saving","save-failed":"Couldn't save",ready:"In project","no-asset":"No file",failed:"Failed",cancelled:"Cancelled"},Re=new Map([...["png","jpg","jpeg","webp","gif","avif","svg","bmp"].map(e=>[e,"image"]),...["mp4","webm","ogv","mov","m4v"].map(e=>[e,"video"]),...["mp3","wav","ogg","oga","m4a","flac","aac"].map(e=>[e,"audio"]),...["glb","gltf","fbx","obj","stl","ply","dae","3ds","usdz","spz"].map(e=>[e,"model"])]);function Ge(e){const n=e.slice(e.lastIndexOf("/")+1).toLowerCase(),a=n.lastIndexOf(".");return a>0?n.slice(a+1):""}function q(e){return(e.outputPaths??[]).map(n=>{const a=V.find(r=>n.startsWith(`${r}/`)),i=a?Y(a,n.slice(a.length+1)):null;return{path:n,name:n.slice(n.lastIndexOf("/")+1),kind:Re.get(Ge(n))??"file",url:i}})}function G(e,n){const a=e.trim();return a.length<=n?a:`${a.slice(0,n-1).trimEnd()}…`}function j(e){const n=De(e);if(n)return n;const a=q(e);if(a.length===0)return G(e.label,64);const i=a[0],r=Oe(i.path);return a.length>1?r?`${r} · ${a.length} files`:`${a.length} files`:Ie.test(i.name)?r?`${r}/${i.name}`:G(e.label,64):i.name}const Ie=/^(image|video|audio|model|panorama|output)(-\d+)?\./;function Oe(e){const n=e.split("/").slice(-2,-1)[0];return n?/^[0-9a-f]{8,}$/i.test(n)||/^[0-9a-f-]{16,}$/i.test(n)?null:n:null}function De(e){const n=e.accept?.input;if(!n||typeof n!="object")return null;const a=n.outputName;return typeof a=="string"&&a.trim().length>0?a.trim():null}function Pe(e){for(const n of[e.accept?.input,e.poll.input]){const a=W(n,0);if(a)return a}return null}function W(e,n){if(n>3||typeof e!="object"||e===null)return null;const a=e,i=a.prompt;if(typeof i=="string"&&i.trim().length>0)return i.trim();for(const r of Object.values(a)){const l=W(r,n+1);if(l)return l}return null}function I(e){return e.operation}function Be(e){return e.mode==="managed"?"VGAI subscription":e.mode==="direct"?"Your provider key":"Mock"}function _e(e){return e.route==="mock"?"Free · mock":e.route==="managed"?e.settledCredits!==void 0?`${e.settledCredits} credits`:e.estimatedCredits!==void 0?`Up to ${e.estimatedCredits} credits`:"Credit estimate unavailable":e.settledAmount!==void 0?`$${e.settledAmount.toFixed(3)}`:e.estimatedAmount!==void 0?`Up to $${e.estimatedAmount.toFixed(3)}`:"USD estimate unavailable"}function Me(e){return e.route==="mock"?!0:e.route==="managed"?e.settledCredits!==void 0:e.settledAmount!==void 0}function Ue(e){const n=Math.floor((Date.now()-Date.parse(e))/6e4);if(!Number.isFinite(n)||n<1)return"just now";if(n<60)return`${n}m ago`;const a=Math.floor(n/60);if(a<24)return`${a}h ago`;const i=Math.floor(a/24);return i<7?`${i}d ago`:`${Math.floor(i/7)}w ago`}const S="generation:",ze="generation:create";function Je(e){return e.route==="mock"?"Free mock":e.route==="managed"?e.settledCredits!==void 0?`${e.settledCredits} credits settled`:e.estimatedCredits!==void 0?`Up to ${e.estimatedCredits} credits`:"VGAI subscription · estimate unavailable":e.settledAmount!==void 0?`$${e.settledAmount.toFixed(3)} settled`:e.estimatedAmount!==void 0?`Up to $${e.estimatedAmount.toFixed(3)}`:"BYOK · estimate unavailable"}function K(e){return O({id:`${S}${e.id}`,title:e.label,kind:"generation",workspaceRole:"authored-subject",provenance:{origin:`${e.provider}:${e.externalId}`},Content:qe,closeable:!0,presentation:()=>({kind:"generation",id:e.id})})}function k(){return O({id:ze,title:"Create Asset",kind:"generation",workspaceRole:"workspace-task",provenance:{origin:"registered generation tools"},Content:Fe,closeable:!0,presentation:()=>({kind:"generation",id:"create"})})}function Fe(){u.useSyncExternalStore(D,E),u.useSyncExternalStore(Q,b,b);const e=ee(),[n,a]=u.useState(""),i=n.trim().toLowerCase(),r=E().filter(s=>s.point==="workspace.document"&&s.tool?.generation?.role==="submit").filter(s=>i?[s.title,s.tool?.generation?.provider,s.tool?.summary,s.tool?.description].filter(Boolean).some(c=>String(c).toLowerCase().includes(i)):!0),l=new Map;for(const s of r){const c=s.tool?.generation?.provider??"other";l.set(c,[...l.get(c)??[],s])}return t.jsxs("div",{className:"vgai-tool-page","data-testid":"generation-create-catalog",children:[t.jsxs("header",{className:"vgai-tool-header",children:[t.jsx("div",{className:"vgai-tool-eyebrow",children:"Installed provider extensions"}),t.jsx("h2",{className:"vgai-tool-title",children:"Create an asset"}),t.jsxs("p",{className:"vgai-tool-description",children:["Choose a native provider operation. Mock, managed, and BYOK execution remain explicit in the operation you open. Current default: ",e.preferredRoute,"."]})]}),t.jsx(X,{type:"search","aria-label":"Search generation tools",placeholder:"Search operations or providers…",value:n,onChange:s=>a(s.target.value)}),[...l.entries()].map(([s,c])=>t.jsxs("section",{className:"vgai-tool-card",children:[t.jsx("h3",{className:"vgai-tool-section-title",children:s}),t.jsx("div",{className:"vgai-generation-create-grid",children:c.map(g=>t.jsxs(p,{variant:"ghost",className:"vgai-generation-create-card",onClick:()=>Z(g.id),children:[t.jsx("strong",{children:g.title}),t.jsx("span",{children:g.tool?.summary})]},g.id))})]},s)),r.length===0&&t.jsx("div",{className:"vgai-generation-document-empty",children:"No installed generation operation matches this search."})]})}function Le({job:e,result:n,documentId:a,active:i}){u.useSyncExternalStore(D,E),u.useSyncExternalStore(te,w,w);const r=ne(e.poll.tool,e,n);if(!r)return t.jsx("pre",{className:"vgai-generation-native-result",children:JSON.stringify(n,null,2)});const l=r.Component;return t.jsx(ae,{file:r.file,children:t.jsx(l,{tool:r.tool,contributionId:r.id,client:se(),surfaces:re,account:oe(),play:ie(),documentId:a,active:i,job:e,result:n})})}function qe({documentId:e,active:n}){const{jobs:a}=u.useSyncExternalStore(T,x,x),i=e.startsWith(S)?e.slice(S.length):e,r=a.find(d=>d.id===i),[l,s]=u.useState(),[c,g]=u.useState(!1),[o,m]=u.useState(null),[v,f]=u.useState(!1),C=async d=>{g(!0),m(null);try{s(await Ee(d))}catch(N){m(N instanceof Error?N.message:String(N))}finally{g(!1)}};if(u.useEffect(()=>{r&&C(r)},[r?.id,r?.status]),!r)return t.jsx("div",{className:"vgai-generation-document-empty",children:"This generation is no longer in project activity."});const A=o??(y(r)==="save-failed"?`Could not save into the project: ${r.pollError}`:null);return t.jsxs("div",{className:"vgai-generation-document","data-status":r.status,children:[t.jsxs("header",{className:"vgai-generation-document-header",children:[t.jsxs("div",{children:[t.jsxs("div",{className:"vgai-tool-eyebrow",children:[r.provider," · ",r.operation]}),t.jsx("h2",{className:"vgai-tool-title",children:r.label}),t.jsxs("div",{className:"vgai-generation-job-meta",children:[$[y(r)]," · ",Je(r.billing)]})]}),t.jsxs("div",{className:"vgai-tool-actions",children:[t.jsx(p,{size:"compact",variant:"ghost",disabled:c,onClick:()=>void C(r),children:c?"Refreshing…":"Refresh"}),L(r,o)&&t.jsx(p,{size:"compact",variant:"primary",disabled:v,onClick:()=>{f(!0),m(null),M(r).catch(d=>m(d instanceof Error?d.message:String(d))).finally(()=>f(!1))},children:v?"Saving…":"Retry save"})]})]}),r.message&&t.jsx("div",{className:"vgai-tool-status",children:r.message}),A&&t.jsx("div",{className:"vgai-tool-status","data-tone":"error",role:"alert",children:A}),t.jsx("section",{className:"vgai-generation-result","aria-label":"Generation result",children:l===void 0?t.jsx("div",{className:"vgai-generation-document-empty",children:c?"Loading provider result…":"No provider result is available yet."}):t.jsx(Le,{job:r,result:l,documentId:e,active:n})}),r.outputPaths&&r.outputPaths.length>0&&t.jsxs("section",{className:"vgai-generation-output-paths",children:[t.jsx("strong",{children:"Project assets"}),r.outputPaths.map(d=>t.jsx("code",{children:d},d))]}),F(r)&&t.jsx("div",{className:"vgai-generation-document-footer",children:t.jsx(p,{size:"compact",variant:"ghost",disabled:v,onClick:()=>{f(!0),U(r.id).then(()=>H(e)).catch(d=>m(d instanceof Error?d.message:String(d))).finally(()=>f(!1))},children:"Remove from activity"})})]})}function We({output:e,onOpen:n}){const a=e.url;if(a&&e.kind==="image"){const i=t.jsx("img",{className:"vgai-generation-output-media",src:a,alt:e.name,loading:"lazy"});return n?t.jsx(p,{variant:"ghost",className:"vgai-generation-output-open",onClick:n,"aria-label":`Open ${e.name}`,children:i}):i}return a&&e.kind==="video"?t.jsx("video",{className:"vgai-generation-output-media",src:a,controls:!0,preload:"metadata",playsInline:!0,title:e.name}):a&&e.kind==="audio"?t.jsxs("div",{className:"vgai-generation-output-audio",children:[t.jsx(ge,{url:a,name:e.name}),t.jsx("audio",{src:a,controls:!0,preload:"metadata",title:e.name})]}):e.url&&e.kind==="model"&&je(e.url)?t.jsx(me,{url:e.url}):t.jsxs("div",{className:"vgai-generation-output-file",children:[t.jsx(_,{icon:e.kind==="model"?pe:ve}),t.jsx(h,{variant:"caption",tone:"muted",children:e.name}),n&&t.jsx(p,{size:"compact",variant:"ghost",onClick:n,children:"Open file"})]})}const Ke={queued:"loading",running:"loading",saving:"loading","save-failed":"error",ready:"success","no-asset":"neutral",failed:"error",cancelled:"neutral"},Ve={queued:e=>e.queuePosition===void 0?"Waiting for the provider to start.":`Position ${e.queuePosition} in the provider queue.`,running:e=>e.message??"The provider is working on it.",saving:()=>"Downloading the finished output into this project.","save-failed":e=>e.pollError??"The finished output could not be saved.",ready:()=>"Saved into this project.","no-asset":()=>"The operation finished without a file this project can hold.",failed:e=>e.message??"The provider reported a failure.",cancelled:()=>"This generation was cancelled."};function Ye({job:e,state:n}){const a=n==="queued"||n==="running"||n==="saving",i=n==="failed"||n==="save-failed";return t.jsxs("div",{className:"vgai-generation-state-media","data-state":n,children:[t.jsx(P,{compact:!0,tone:Ke[n],...i?{icon:t.jsx(_,{icon:ue})}:{},title:$[n],description:Ve[n](e)}),a&&t.jsx("progress",{className:"vgai-generation-progress","aria-label":`${e.label} progress`,...n==="running"&&e.progress!==void 0?{value:e.progress,max:1}:{}})]})}function Qe({job:e,busy:n,error:a,run:i}){return t.jsxs("div",{className:"vgai-generation-card-actions",children:[L(e,a)&&t.jsx(p,{size:"compact",variant:"primary",disabled:n,onClick:()=>i(()=>M(e)),children:n?"Saving…":"Retry save"}),t.jsx(p,{size:"compact",variant:"ghost",onClick:()=>K(e),children:"Details"}),F(e)&&t.jsx(p,{size:"compact",variant:"ghost",disabled:n,onClick:()=>i(()=>U(e.id)),children:"Remove"})]})}function Xe({job:e,busy:n,error:a,run:i}){const r=y(e),l=q(e),s=Pe(e),c=Te(e),g=o=>{if(!o.url)return;const m=fe(he(o.name));if(m)return()=>xe(o.url,m)};return t.jsxs("article",{className:"vgai-generation-card","data-state":r,"aria-busy":z(e),"aria-label":j(e),onClickCapture:()=>{c&&$e(e.id).catch(o=>{de.warn(`Could not mark generation as seen: ${o instanceof Error?o.message:String(o)}`,"generations")})},children:[t.jsx("div",{className:"vgai-generation-card-media","data-outputs":Math.min(l.length,4),children:l.length===0?t.jsx(Ye,{job:e,state:r}):l.map(o=>t.jsx("div",{className:"vgai-generation-output",title:o.path,children:t.jsx(We,{output:o,onOpen:g(o)})},o.path))}),t.jsxs("div",{className:"vgai-generation-card-body",children:[t.jsxs("div",{className:"vgai-generation-card-heading",children:[t.jsx(h,{variant:"label",truncate:!0,title:j(e),children:j(e)}),t.jsxs(R,{className:"vgai-generation-chip","data-state":r,children:[$[r],r==="running"&&e.progress!==void 0?` · ${Math.round(e.progress*100)}%`:""]}),c&&t.jsx(R,{className:"vgai-generation-chip","data-state":"new",children:"New"})]}),t.jsxs(h,{variant:"caption",tone:"muted",truncate:!0,title:I(e),children:[e.provider," · ",I(e)]}),t.jsxs(h,{variant:"caption",tone:"dim",children:[_e(e.billing),Me(e.billing)?"":" (est.)"," · ",Be(e)," ·"," ",Ue(e.updatedAt)]}),s&&t.jsx("p",{className:"vgai-generation-card-prompt",title:s,children:s}),(a??e.pollError)&&t.jsx(B,{tone:a||r==="save-failed"?"error":"warning",className:"vgai-generation-card-alert",children:a??(r==="save-failed"?`Could not save into the project: ${e.pollError}`:`Polling will retry: ${e.pollError}`)}),t.jsx(Qe,{job:e,busy:n,error:a,run:i})]})]})}function Ze(){const{jobs:e}=u.useSyncExternalStore(T,x,x),[n,a]=u.useState(null),[i,r]=u.useState({}),l=e.filter(z).length,s=e.filter(o=>y(o)==="saving").length,c=async(o,m)=>{a(o),r(v=>{const f={...v};return delete f[o],f});try{await m()}catch(v){const f=v instanceof Error?v.message:String(v);r(C=>({...C,[o]:f}))}finally{a(null)}},g=ke();return t.jsxs("div",{className:"vgai-generation-gallery",children:[t.jsxs(le,{label:"Generations",compact:!0,className:"vgai-generation-gallery-bar",children:[t.jsx(h,{variant:"label",children:"Generations"}),t.jsxs(h,{variant:"caption",tone:"muted",children:[e.length," ",e.length===1?"generation":"generations",l>0?` · ${l} running`:"",s>0?` · ${s} saving`:""]}),t.jsx(ce,{}),t.jsx(p,{size:"compact",variant:"ghost",onClick:()=>void Se().then(J),children:"Refresh"}),t.jsx(p,{size:"compact",variant:"primary",onClick:()=>k(),children:"New asset"})]}),g&&t.jsx(B,{tone:"error",className:"vgai-generation-gallery-alert",children:g}),e.length===0?t.jsx(P,{className:"vgai-generation-gallery-empty",title:"No generated assets yet",description:"Preview generated images, video, audio and models here. Create an asset to get started.",action:t.jsx(p,{size:"compact",variant:"primary",onClick:()=>k(),children:"New asset"})}):t.jsx("section",{className:"vgai-generation-grid","aria-label":"Generated assets",children:e.map(o=>t.jsx(Xe,{job:o,busy:n===o.id,error:i[o.id]??null,run:m=>void c(o.id,m)},o.id))})]})}const kt="workspace.service",He="generation";function et(){const e=we(x().jobs);return e>0?{count:e,severity:"info"}:null}function Tt(){const e=[Ae(),ye({...Ce.generations,order:15,Content:Ze,badge:et,subscribeBadge:T,badgeSnapshot:be,visibleByDefault:!1,closeable:!0}),Ne({id:He,owner:"@volter/editor-game/generation",open:(n,a)=>{if(a.id==="create")return k();const i=x().jobs.find(r=>r.id===a.id);return i?K(i):null},settle:J})];return()=>{for(const n of e)n()}}export{kt as point,Tt as start};
@@ -1 +0,0 @@
1
- import{cR as nt,aK as st,ad as ot,e$ as x,dJ as U,Z as at,i0 as it,i1 as rt}from"./index-BRJMIUK0.js";import{i2 as vt,i3 as Rt,i4 as wt,aP as Ft,dL as Nt,i5 as _t,i6 as Ct,i7 as Ot,i8 as kt,i9 as Lt,ia as Bt,ib as Gt,eO as Pt,ic as $t,f4 as Ht,id as Wt,ie as zt,ig as Vt,ih as Kt,ii as Jt,dm as Ut,ij as Yt,e1 as qt,$ as Qt,ev as Xt,d0 as Zt,gR as te,ik as ee,il as ne,d4 as se,im as oe,io as ae,ip as ie,f2 as re,fk as ce,iq as ue,fl as le,ir as de,cE as pe,is as fe,aJ as me,d2 as he,it as Ee,iu as xe,iv as ge,d3 as Se,f7 as Te,g9 as be,cS as je,cU as De,h5 as ye,h6 as Me,iw as Ie,aQ as Ae,ix as ve,iy as Re,aR as we,du as Fe,iz as Ne,cY as _e,d1 as Ce,eG as Oe,iA as ke,iB as Le,aI as Be,f5 as Ge,hS as Pe,iC as $e,gy as He,iD as We,cF as ze,iE as Ve,iF as Ke,ex as Je,iG as Ue,iH as Ye,iI as qe,iJ as Qe,iK as Xe,et as Ze,eu as tn,iL as en,iM as nn,iN as sn,iO as on,eA as an,iP as rn,iQ as cn,iR as un,iS as ln,iT as dn,a0 as pn,iU as fn,iV as mn,iW as hn,iX as En,iY as xn,iZ as gn,eB as Sn,i_ as Tn,i$ as bn,ey as jn,j0 as Dn,j1 as yn,j2 as Mn,dn as In,j3 as An,j4 as vn,j5 as Rn,j6 as wn,j7 as Fn,j8 as Nn,j9 as _n,f0 as Cn,ja as On,jb as kn,jc as Ln,jd as Bn,je as Gn,jf as Pn,eC as $n,jg as Hn,jh as Wn,ji as zn,f6 as Vn,jj as Kn,jk as Jn,jl as Un,jm as Yn,dd as qn,ew as Qn,jn as Xn,jo as Zn,jp as ts,ez as es,jq as ns,aW as ss,dK as os,jr as as,js as is,jt as rs,dc as cs}from"./index-BRJMIUK0.js";import{C as ls}from"./ColorInput-QUPS1pEB.js";import{a as p}from"./jsx-runtime-DPjLkJKQ.js";import{r as b}from"./index-nmcBqr7Y.js";import{A as ps,k as fs,B as ms,a as hs,l as Es,C as xs,D as gs,m as Ss,F as Ts,h as bs,G as js,n as Ds,Q as ys,S as Ms,f as Is,o as As,T as vs,d as Rs,c as ws,g as Fs,i as Ns,j as _s,b as Cs,p as Os,e as ks,u as Ls,q as Bs}from"./ShadowEditor-CVtMlALn.js";import"./index-CtzuWnCS.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";function jt({preview:t,children:e,...i}){const[o,a]=b.useState(!1),l=b.useRef(null),c=b.useId(),s=()=>a(!1),d=r=>{l.current=r,a(!0)};let h=e;if(b.isValidElement(e)){const r=[e.props["aria-describedby"],o?c:null].filter(Boolean).join(" ");h=b.cloneElement(e,r?{"aria-describedby":r}:{})}return p.jsxs("span",{className:"vgai-tooltip-anchor",onMouseEnter:r=>d(r.currentTarget),onMouseLeave:s,onFocusCapture:r=>d(r.currentTarget),onBlurCapture:r=>{r.currentTarget.contains(r.relatedTarget)||s()},onKeyDown:r=>{r.key!=="Escape"||!o||(r.preventDefault(),r.stopPropagation(),s())},children:[h,o&&l.current&&p.jsx(nt,{...i,anchorRef:l,id:c,role:"tooltip",autoFocusFirst:!1,onDismiss:s,children:t})]})}function Dt({value:t,onCommit:e,style:i,disabled:o=!1}){const a=t===void 0?"":JSON.stringify(t),[l,c]=b.useState(a),[s,d]=b.useState(!1),h=b.useRef(!1);b.useEffect(()=>{c(a),d(!1)},[a]);const r=()=>{if(h.current){h.current=!1;return}if(l===a){d(!1);return}let m;try{m=JSON.parse(l)}catch{d(!0);return}d(!1),e(m)};return p.jsxs("div",{children:[p.jsx(st,{"data-testid":"json-input","aria-invalid":s||void 0,"data-tone":s?"danger":void 0,disabled:o,value:l,onChange:m=>{c(m.target.value),s&&d(!1)},onBlur:r,onKeyDown:m=>{m.key==="Enter"?r():m.key==="Escape"&&(h.current=!0,c(a),d(!1),m.target.blur())},style:i,title:s?"Not valid JSON — nothing written. Fix the JSON or press Escape to revert.":void 0}),s&&p.jsx("div",{"data-testid":"json-input-error",style:{fontSize:"var(--vgai-font-sm)",color:ot.semantic.danger,marginTop:2},children:"Not valid JSON — nothing written. Fix the JSON or press Escape to revert."})]})}function A(t,e){return e+1<t.length?t[e+1].start:1}function ct(t){const e=t.map(o=>({time:o.start,value:o.function.p0})),i=t[t.length-1];return i&&e.push({time:1,value:i.function.p3}),e}function G(t){return t.map(e=>({start:e.start,function:{...e.function}}))}const B=.01;function N(t,e,i,o){const a=G(t),l=a.length;if(e<0||e>l)return a;if(e<l){const c=a[e],s=o-c.function.p0;if(c.function.p0=o,c.function.p1+=s,e>0){const d=a[e-1],h=o-d.function.p3;d.function.p3=o,d.function.p2+=h;const r=d.start+B,m=A(a,e)-B;c.start=Math.min(m,Math.max(r,i))}}else{const c=a[l-1],s=o-c.function.p3;c.function.p3=o,c.function.p2+=s}return a}function Y(t,e,i,o){const a=G(t);return i==="out"&&e<a.length?a[e].function.p1=o:i==="in"&&e>0&&e<=a.length&&(a[e-1].function.p2=o),a}function D(t,e,i){return t+(e-t)*i}function yt(t,e){for(let i=0;i<t.length;i++){const o=t[i].start,a=A(t,i);if(e>=o&&e<=a){const l=a>o?(e-o)/(a-o):0,{p0:c,p1:s,p2:d,p3:h}=t[i].function,r=D(c,s,l),m=D(s,d,l),g=D(d,h,l),M=D(r,m,l),I=D(m,g,l);return D(M,I,l)}}return 0}function ut(t,e){for(let i=0;i<t.length;i++){const o=t[i].start,a=A(t,i);if(e<=o+B||e>=a-B||e<o||e>a)continue;const l=(e-o)/(a-o),{p0:c,p1:s,p2:d,p3:h}=t[i].function,r=D(c,s,l),m=D(s,d,l),g=D(d,h,l),M=D(r,m,l),I=D(m,g,l),j=D(M,I,l),S=G(t);return S.splice(i,1,{start:o,function:{p0:c,p1:r,p2:M,p3:j}},{start:e,function:{p0:j,p1:I,p2:g,p3:h}}),S}return t}function q(t,e){if(e<=0||e>=t.length)return t;const i=t[e-1],o=t[e],a=o.start-i.start,l=A(t,e)-o.start,c=a+l;if(c<=0)return t;const s=i.function,d=o.function,h={start:i.start,function:{p0:s.p0,p1:s.p0+(s.p1-s.p0)*(a>0?c/a:1),p2:d.p3+(d.p2-d.p3)*(l>0?c/l:1),p3:d.p3}},r=G(t);return r.splice(e-1,2,h),r}function lt(t){let e=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const o of t)for(const a of[o.function.p0,o.function.p1,o.function.p2,o.function.p3])a<e&&(e=a),a>i&&(i=a);return!Number.isFinite(e)||!Number.isFinite(i)?{min:0,max:1}:{min:e,max:i}}const _=34,Q=6,V=6,dt=14,L=260;function pt(t){return Math.abs(t)>=100?t.toFixed(0):Math.abs(t)>=1?String(Math.round(t*100)/100):String(Math.round(t*1e3)/1e3)}function Mt({value:t,onChange:e,onChangeEnd:i,disabled:o,height:a=90,color:l,testId:c="curve-editor"}){const[s,d]=b.useState(0),h=b.useRef(null),r=b.useRef(null),m=b.useMemo(()=>ct(t),[t]),g=b.useMemo(()=>{const{min:n,max:u}=lt(t);if(u-n<1e-6)return{min:n-1,max:u+1};const f=(u-n)*.1;return{min:n-f,max:u+f}},[t]),M=L-_-Q,I=a-V-dt,j=n=>_+n*M,S=n=>V+(1-(n-g.min)/(g.max-g.min))*I,X=n=>Math.max(0,Math.min(1,(n-_)/M)),Z=n=>g.min+(1-(n-V)/I)*(g.max-g.min),P=n=>{const u=h.current?.getBoundingClientRect();if(!u)return{t:0,v:0};const f=(n.clientX-u.left)/u.width*L,T=(n.clientY-u.top)/u.height*a;return{t:X(f),v:Z(T)}},tt=b.useMemo(()=>{if(t.length===0)return"";let n=`M ${j(t[0].start)} ${S(t[0].function.p0)}`;for(let u=0;u<t.length;u++){const f=t[u],T=A(t,u),y=T-f.start;n+=` C ${j(f.start+y/3)} ${S(f.function.p1)}, ${j(f.start+2*y/3)} ${S(f.function.p2)}, ${j(T)} ${S(f.function.p3)}`}return n},[t,g,a]),v=n=>it({onChange:e,onChangeEnd:i},n),$=n=>rt({onChange:e},n),H=(n,u)=>{if(o)return;n.preventDefault(),n.stopPropagation(),r.current=t;const f=y=>{const{t:F,v:z}=P(y),k=u(r.current??t,F,z);r.current=k,$(k)},T=y=>{const{t:F,v:z}=P(y),k=u(r.current??t,F,z);r.current=null,v(k),window.removeEventListener("pointermove",f),window.removeEventListener("pointerup",T)};window.addEventListener("pointermove",f),window.addEventListener("pointerup",T)},K=l??x.accent,J=t.length,E=m[s],W=s>0&&s<J,C=s<J?t[s]:void 0,O=s>0?t[s-1]:void 0,R=C?{x:j(C.start+(A(t,s)-C.start)/3),y:S(C.function.p1)}:null,w=O?{x:j(O.start+(A(t,s-1)-O.start)*2/3),y:S(O.function.p2)}:null,et=[g.min,(g.min+g.max)/2,g.max];return p.jsxs("div",{"data-testid":c,children:[p.jsxs("svg",{ref:h,"data-testid":`${c}-plot`,viewBox:`0 0 ${L} ${a}`,style:{width:"100%",height:a,display:"block",background:x.inputBg,border:`1px solid ${x.border}`,borderRadius:x.radiusSmall,touchAction:"none",outline:"none"},tabIndex:0,role:"application","aria-label":"Curve editor",onKeyDown:n=>{(n.key==="Delete"||n.key==="Backspace")&&W&&!o&&(n.preventDefault(),v(q(t,s)),d(Math.max(0,s-1)))},onDoubleClick:n=>{if(o)return;const{t:u}=P(n),f=ut(t,u);f!==t&&(v(f),d(f.findIndex(T=>Math.abs(T.start-u)<1e-6)))},children:[et.map(n=>p.jsxs("g",{children:[p.jsx("line",{x1:_,x2:L-Q,y1:S(n),y2:S(n),stroke:x.border,strokeWidth:.5}),p.jsx("text",{x:_-3,y:S(n)+2.5,fontSize:7,fill:x.textMuted,textAnchor:"end",children:pt(n)})]},n)),[0,.5,1].map(n=>p.jsx("text",{x:j(n),y:a-3,fontSize:7,fill:x.textMuted,textAnchor:"middle",children:n},n)),p.jsx("path",{d:tt,fill:"none",stroke:K,strokeWidth:1.5}),E&&R&&p.jsxs("g",{children:[p.jsx("line",{x1:j(E.time),y1:S(E.value),x2:R.x,y2:R.y,stroke:x.textMuted,strokeDasharray:"2 2",strokeWidth:.75}),p.jsx("circle",{"data-testid":`${c}-tangent-out`,cx:R.x,cy:R.y,r:3,fill:x.surface,stroke:x.textMuted,style:{cursor:o?"not-allowed":"ns-resize"},onPointerDown:n=>H(n,(u,f,T)=>Y(u,s,"out",T))})]}),E&&w&&p.jsxs("g",{children:[p.jsx("line",{x1:j(E.time),y1:S(E.value),x2:w.x,y2:w.y,stroke:x.textMuted,strokeDasharray:"2 2",strokeWidth:.75}),p.jsx("circle",{"data-testid":`${c}-tangent-in`,cx:w.x,cy:w.y,r:3,fill:x.surface,stroke:x.textMuted,style:{cursor:o?"not-allowed":"ns-resize"},onPointerDown:n=>H(n,(u,f,T)=>Y(u,s,"in",T))})]}),m.map((n,u)=>p.jsx("circle",{"data-testid":`${c}-key-${u}`,cx:j(n.time),cy:S(n.value),r:4,fill:u===s?x.accent:x.surface,stroke:u===s?x.onAccent:K,strokeWidth:1.25,style:{cursor:o?"not-allowed":"move"},onPointerDown:f=>{d(u),H(f,(T,y,F)=>N(T,u,y,F))}},u))]}),p.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center",marginTop:3},children:[p.jsxs("span",{style:{fontSize:9,color:x.textMuted,flex:"0 0 auto"},children:["Key ",s+1,"/",m.length]}),p.jsx(U,{label:"t",value:E?Math.round(E.time*1e3)/1e3:null,step:.05,testId:`${c}-key-time`,onChange:n=>{E&&$(N(t,s,n,E.value))},onChangeEnd:n=>{E&&v(N(t,s,n,E.value))}}),p.jsx(U,{label:"v",value:E?Math.round(E.value*1e3)/1e3:null,step:.05,testId:`${c}-key-value`,onChange:n=>{E&&$(N(t,s,E.time,n))},onChangeEnd:n=>{E&&v(N(t,s,E.time,n))}}),p.jsx(at,{type:"button",variant:"ghost",size:"compact","data-testid":`${c}-delete-key`,disabled:!W||o===!0,"aria-label":"Delete curve key",title:W?"Delete key":"Endpoint keys cannot be deleted",onClick:()=>{v(q(t,s)),d(Math.max(0,s-1))},children:"×"})]})]})}export{vt as Actions,ps as AlignmentGrid,fs as AnchorPresets,nt as AnchoredMenu,Rt as AssetSlotPicker,ms as BorderEditor,hs as BorderRadiusEditor,at as Button,wt as CLASSIC_MATERIAL,Ft as Checkbox,ls as ColorInput,Es as ColorPicker,xs as ColorSwatch,Nt as ColorSwatchInput,Mt as CurveEditor,_t as DEFAULT_ICON_SET_ID,gs as DEFAULT_SHADOW,Ss as DEFAULT_TEXT_SHADOW,Ct as Dialog,Ot as DialogBody,kt as DialogField,Lt as DialogFieldLabel,Bt as DialogFooter,Gt as DialogHeader,Pt as DisclosureIcon,$t as Divider,Ht as DraftTextInput,Wt as DropIndicator,zt as EDITOR_CATEGORY_NAMES,Vt as EDITOR_MATERIALS,Kt as EDITOR_MATERIAL_IDS,Jt as EDITOR_REGION_NAMES,Ut as EDITOR_THEME_CLASS,Yt as EditorBadge,qt as EditorBanner,Qt as EditorIcon,Xt as EditorListButton,Zt as EditorPopover,te as EditorSurface,ee as EditorTab,ne as EditorTabList,se as EditorToolbar,oe as EditorTree,ae as EditorTreeRow,ie as FONT,re as FONT_MONO,ce as FieldGroup,ue as FieldLabel,le as FieldRow,de as FileInput,Ts as FilterEditor,pe as FloatingToolbar,bs as FontPicker,fe as GLASS_MATERIAL,js as GradientEditor,Ds as GradientStopsTrack,jt as HoverPreview,me as IconButton,he as Inline,Ee as InteractiveEditScopeContext,xe as JoinedField,ge as JoinedFieldSuffix,Dt as JsonInput,Se as Keycap,Te as LABEL_COL_WIDTH,be as Menu,je as MenuItem,De as MenuSeparator,ye as MenuSubmenu,Me as MenuTrigger,U as NumberInput,Ie as Panel,ys as QuarksGradientEditor,Ae as RangeInput,ve as ResizeHandle,Re as STAGE_WORD_MODES,Ms as ScrubbableInput,we as SectionHeader,Fe as Select,Is as ShadowEditor,As as ShadowListEditor,Ne as Spacer,_e as SplitButtonGroup,Ce as Stack,Oe as StateSurface,x as THEME,ke as TONE_ERROR,Le as TONE_WARNING,Be as Text,Ge as TextArea,st as TextInput,vs as TextShadowEditor,Pe as ThemeRootPortal,$e as ToggleButton,He as ToolbarDivider,We as ToolbarGroup,ze as Tooltip,Ve as TreeDisclosureIcon,Ke as Vec3Input,Je as accent,Ue as accentMuted,Ye as activeIconGlyph,qe as activeIconSetSnapshot,Qe as applyEditorTheme,Xe as areaEmbossValue,Ze as bg,tn as border,en as chromeSize,nn as clampRectToViewport,sn as composeEditorAppearance,Rs as composeFilter,ws as composeGradient,Fs as composeShadows,on as controlSize,ct as curveKeys,lt as curveValueRange,an as danger,rn as dangerFaint,cn as dangerMuted,q as deleteKey,un as dynamic,ln as dynamicBg,dn as editorIconSets,pn as editorIcons,fn as editorMaterials,mn as editorThemeVariables,hn as editorThemes,En as fieldLabelStyle,rt as fireChange,it as fireEnd,xn as focusFirstMenuItem,gn as focusRing,Sn as fontMono,Tn as fontSans,bn as fontSize,jn as fontSizeVar,Dn as fontWeight,yn as glassDarkEditorTheme,Mn as glassDarkLiteEditorTheme,In as graphiteDarkEditorTheme,An as graphiteNeutralEditorTheme,vn as groupLabelStyle,Rn as iconSize,wn as isEditorIconSetId,Fn as isEditorMaterialId,Nn as isEditorThemeId,Ns as isUniformBorder,_s as isUniformRadius,_n as lineHeight,Cn as lineHeightVar,On as liquidGlassEditorTheme,kn as liquidGlassLiteEditorTheme,Ln as midnightHighContrastEditorTheme,Bn as motion,Gn as motionVar,N as moveKey,Y as moveTangent,Cs as parseFilterFunctions,Os as parseGradient,Pn as parseNumericValue,ks as parseShadows,$n as radius,Hn as regionRowAltValue,Wn as registerContributedIconSet,zn as registerContributedMaterial,Vn as rowStyle,yt as sampleCurve,Kn as scrim,A as segmentEnd,Jn as selection,Un as setActiveIconSet,Yn as shadow,qn as space,Qn as spaceVar,ut as splitAt,Xn as strokeWidth,Zn as subscribeEditorMaterials,ts as subscribeIconSets,es as success,ns as successMuted,ss as text,ot as themeVars,Ls as uniformBorder,Bs as uniformRadius,os as useInteractiveEditScope,as as usesGlassMaterial,is as warn,rs as warnMuted,cs as zIndex};
@@ -1 +0,0 @@
1
- import{a8 as y,M as v,bn as b,bo as R,dj as S,dk as E,bq as f}from"./index-BRJMIUK0.js";import{w as k}from"./mounted-authoring-Clftxx0x.js";import{P as w}from"./pixi-authoring-adapter-BChknIdC.js";import{createLiveCanvasWriteTarget as A}from"./pixi-live-write-target-BjDsBQbp.js";import{resolveCanvasPixiForEditor as x}from"./canvas-entry-runtime-UNYuSfG0.js";import{C}from"./crash-null-boundary-v3a0uEgw.js";import{a as l}from"./json-history-resource-DwS10tqD.js";import{a as I}from"./realm-services-CnY105XU.js";import{r as P}from"./react-root-BHA-cdrW.js";import{D as $}from"./dom-authoring-adapter-BrLU8IJ_.js";import{w as M,R as D}from"./react-world-authoring-adapter-DOjv2pYm.js";import{createPhysics2DRegistry as j}from"./physics-registry-B2Jkp8e6.js";import{createPhysicsAdapter2D as z}from"./system-adapters-rIC8FSGP.js";import{s as B}from"./three-authoring-adapter-htbnVej2.js";import{r as h}from"./index-nmcBqr7Y.js";import{r as F}from"./index-CtzuWnCS.js";import{a as O}from"./client-DNXj_opT.js";import{mountModuleRootRuntime as T}from"./module-mode-BH2R93XP.js";import"./jsx-runtime-DPjLkJKQ.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-FUuS4qwW.js";import"./entity-object-JmYMfLsx.js";import"./user-data-Bpj7diUS.js";import"./workspace-arrangement-BdAlBwvd.js";import"./three-contract-Dkt6PmWY.js";import"./index-SS9EugVg.js";import"./source-persistence-backend-CwLYVPXj.js";import"./ingest-source-persistence-Dmdo-UBp.js";import"./component-instance-root-B0C5oNEm.js";import"./pixi-transform-channels-P4rvmusc.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./debug-registry-P0_YQGWd.js";import"./three-ingest-runtime-B7rtg3QE.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./EffectComposer-BEAt0PtQ.js";import"./CopyShader-BzTUYzf6.js";import"./ShaderPass-DTnDQXm0.js";import"./Pass-D1MRT672.js";import"./CSS3DRenderer-BsAqfavI.js";import"./inspect-Dr4qvDpJ.js";import"./inference-diagnostics-xecGdohW.js";import"./board-guides-BEKPgD9M.js";import"./relative-import-specifier-BFKIWEWs.js";import"./story-arg-descriptors-Ek86ExX7.js";import"./writer-tw6EcuVO.js";import"./three-projection-core-CG01r5Ta.js";import"./editor-layers-BDJnAAzj.js";import"./three-TCuY32m_.js";import"./viewport-editor-controls-BYaAZ_Ku.js";import"./body-marks-RKb_LTwL.js";import"./user-data-dHvLdpwM.js";import"./object-marks-DwvIEBOK.js";import"./structural-ids-Br2zjINh.js";import"./object3d-authoring-subject-BDrxd1GA.js";import"./rapier-physics-adapter-CaZqWLu0.js";import"./r3f-physics-binding-DzrbpqjM.js";import"./capability-coverage-DZ-onC5j.js";import"./game-contract-seams-BnPFGLll.js";import"./binding-resolver-dE0GnZT5.js";import"./native-debug-module-2_HVupdg.js";import"./native-entry-surface-BE8LJNdu.js";import"./contract-system-adapters-Bic_7sev.js";import"./adapter-surface-Y37Nzcyw.js";import"./entry-adjudication-Dc18TIqT.js";import"./structural-signature-Dc7skRiy.js";import"./webgl-frame-capture-DdJkM2mi.js";import"./events-156d8d12.esm-CYeuVCYr.js";import"./index-bQE2NA0D.js";import"./relative-path-guard-GiM7Lsz8.js";function g(t,i,n){t.style.position="absolute",t.style.top="0",t.style.left="0",t.style.width="100%",t.style.height="100%",t.style.zIndex=String(i.zOrder??0),t.style.pointerEvents=n}async function W(t,i,n,m){const r=await I(n,S()),a=await P(t,r),e=document.createElement("div");e.dataset.vgaiRootSurface="true",g(e,t,"none"),i.appendChild(e);const u=O.createRoot(e);let s=null;if(F.flushSync(()=>{u.render(h.createElement(C,{onCaught:c=>{s=c}},h.createElement(a)))}),s!==null)throw u.unmount(),e.remove(),s instanceof Error?s:new Error(String(s));let o;if(m)if(M(e).nodes.size>0){const p=E("An ingest sibling’s react layer");o=new D(e,m.shell,{...p?{writeBackend:p}:{}})}else o=new $(e,m,{journal:l(t.id)});return{worldId:t.id,...o?{authoring:o}:{},dispose(){u.unmount(),e.remove()}}}async function L(t,i,n,m,r){const a=document.createElement("div");g(a,i,"auto"),n.appendChild(a);try{const e=n.clientWidth||800,u=n.clientHeight||600,{session:s}=await T(t,i,m,a,e,u),o=s.game.roots[0],c=o.mounted.authoring;let p;if(r)if(c)p=k(c,r);else if(o.kind==="three")p=B(r,o.threeScene(),{frameControl:"host",journal:l(i.id)});else if(o.kind==="canvas")if(o.mounted.kind!=="canvas"||o.mounted.substrate.name!=="pixi")p=o.mounted.authoring??f(r.shell,`${i.id} (${o.mounted.kind==="canvas"?o.mounted.substrate.name:"unknown"} authoring unavailable)`);else{const d=z(o.physics2d??j());p=new w(o.canvasRoot(),r,{pixi:await x(),target:A({physics:d}),journal:l(i.id),surface:()=>a})}else p=f(r.shell,`${i.id} (no authoring surface)`);return{worldId:i.id,...p?{authoring:p}:{},setPaused(d){d?s.pause():s.resume()},dispose(){s.stop(),a.remove()}}}catch(e){throw a.remove(),e}}function N(t){throw new Error(`sibling world "${t.id}" (kind: ${t.surface}, adapter identity: "${t.adapter.identity}") has no known composite-sibling mount path — every currently-resolvable identity (three/canvas/dom/module) is routed above; this is reached only for a genuinely unroutable shape.`)}function q(t){return t.adapter.type==="module"||t.adapter.identity==="three"||t.adapter.identity==="canvas"?"scoped-runtime":t.adapter.identity==="dom"?"react-layer":null}async function H(t,i,n,m,r){switch(q(i)){case"scoped-runtime":return L(t,i,n,m,r);case"react-layer":return W(i,n,m,r);default:N(i)}}async function me(t,i,n,m,r){const a=[];for(const e of y(t))if(e.id!==i)try{a.push(await H(t,e,n,m,r))}catch(u){v.error(`Composite sibling "${e.id}" failed to mount: ${u}`,"ingest"),b({worldId:e.id,kind:e.surface,identity:e.adapter.identity,message:R(u)})}return a}export{me as mountIngestSiblings,q as siblingMountRoute};
@@ -1 +0,0 @@
1
- import{a9 as m}from"./index-BRJMIUK0.js";import{a as p,i as e,b as n,s}from"./play-mode-DICV4cKP.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"./adapter-runtime-bindings-4cmsRvRh.js";import"./native-debug-module-2_HVupdg.js";import"./native-entry-surface-BE8LJNdu.js";import"./debug-registry-P0_YQGWd.js";import"./contract-system-adapters-Bic_7sev.js";import"./game-contract-seams-BnPFGLll.js";import"./seeded-random-BgCwIAAU.js";import"./game-audio-CaGKzia4.js";import"./game-network-Ct2FQYmu.js";import"./index-OZVqp6xS.js";import"./index-Da9JhEvW.js";import"./rapier-physics-adapter-CaZqWLu0.js";import"./events-156d8d12.esm-CYeuVCYr.js";import"./three.module-BLhyNg0e.js";import"./three.core-3arARmh6.js";import"./index-bQE2NA0D.js";import"./live-project-verbs-C3LzprCe.js";import"./capability-coverage-DZ-onC5j.js";import"./edit-mode-authoring-DeCxPcHM.js";import"./json-history-resource-DwS10tqD.js";import"./binding-resolver-dE0GnZT5.js";import"./adapter-surface-Y37Nzcyw.js";import"./entry-adjudication-Dc18TIqT.js";import"./structural-signature-Dc7skRiy.js";import"./webgl-frame-capture-DdJkM2mi.js";import"./realm-services-CnY105XU.js";import"./canvas-entry-runtime-UNYuSfG0.js";import"./three-ingest-runtime-B7rtg3QE.js";import"./EffectComposer-BEAt0PtQ.js";import"./CopyShader-BzTUYzf6.js";import"./ShaderPass-DTnDQXm0.js";import"./Pass-D1MRT672.js";import"./CSS3DRenderer-BsAqfavI.js";import"./relative-path-guard-GiM7Lsz8.js";import"./react-root-BHA-cdrW.js";import"./editor-presentation-activity-C7SNSmTd.js";import"./active-ingest-DA426a81.js";import"./ingest-source-persistence-Dmdo-UBp.js";import"./pixi-story-model-DNkfnWUV.js";import"./surface-content-Dg9Kkazf.js";import"./viewport-root-presentation-vgxsTyj4.js";import"./mounted-authoring-Clftxx0x.js";import"./entity-object-JmYMfLsx.js";import"./user-data-Bpj7diUS.js";import"./workspace-arrangement-BdAlBwvd.js";import"./three-contract-Dkt6PmWY.js";import"./three-TCuY32m_.js";import"./editor-layers-BDJnAAzj.js";import"./component-instance-root-B0C5oNEm.js";import"./viewport-editor-controls-BYaAZ_Ku.js";import"./three-authoring-adapter-htbnVej2.js";import"./source-persistence-backend-CwLYVPXj.js";import"./three-projection-core-CG01r5Ta.js";import"./body-marks-RKb_LTwL.js";import"./user-data-dHvLdpwM.js";import"./object-marks-DwvIEBOK.js";import"./structural-ids-Br2zjINh.js";import"./object3d-authoring-subject-BDrxd1GA.js";import"./r3f-physics-binding-DzrbpqjM.js";import"./deferred-ingest-play-BdR4qGk6.js";import"./rrweb-Cd2ifIRP.js";import"./react-world-authoring-adapter-DOjv2pYm.js";import"./board-guides-BEKPgD9M.js";import"./relative-import-specifier-BFKIWEWs.js";import"./story-arg-descriptors-Ek86ExX7.js";import"./inspect-Dr4qvDpJ.js";import"./inference-diagnostics-xecGdohW.js";import"./writer-tw6EcuVO.js";import"./three-state-DwFE3ay2.js";import"./editor-shell-store-ChLcVeNB.js";import"./output-pass-HurwNl0G.js";import"./viewport-door-Bj_ZIP85.js";const Ct="workspace.command",a=()=>({ok:!1,error:"not in play mode — start play before using the debug seam"}),Gt={"set-instance-count":{derivedRefresh:"always",handle:o=>{if(!e())return a();const r=o.names;if(Array.isArray(r)&&r.every(i=>typeof i=="string"))return r.length<1?{ok:!1,error:'set-instance-count "names" must have at least one entry.'}:(n(r),{ok:!0});const t=o.count;return typeof t!="number"||!Number.isFinite(t)||t<1?{ok:!1,error:`set-instance-count requires a whole "count" >= 1 (or a "names" array), got ${String(t)}.`}:(s(Math.floor(t)-1),{ok:!0})}},"list-instances":{derivedRefresh:"if-content-changed",handle:()=>({ok:!0,data:{instances:m(),named:p()}})}};export{Gt as commands,Ct as point};
@@ -1 +0,0 @@
1
- import{stackOrder as C}from"./root-stacking-BEd9ZvxC.js";import{av as D,ay as O,az as g,aA as y,aB as z,w as S,aC as b}from"./index-BRJMIUK0.js";function p(a,o,r,d){const n=a.pickable?.pick(o,r)??null;return n?a.selection?.resolve?.(n,{intent:d,scopeId:z()})?.id??n:null}function I(a,o,r,d){const n=a.pickable?.candidates?.(o,r)??[],s=[],c=new Set;for(const f of n){const i=a.selection?.resolve?.(f,{intent:d,scopeId:z()})?.id??f;c.has(i)||(c.add(i),s.push(i))}return s}function P(a,o,r,d={}){const n=d.intent??"normal",s=D(a);if(!(s instanceof O))return p(s,o,r,n);const c=s.childAdapters(),i=S()===b?[]:c.filter(t=>t.kind!=="three"),m=c.filter(t=>t.kind==="three"),h=i.map(t=>({id:t.worldId,zOrder:t.zOrder,worldId:t.worldId,adapter:t.adapter})),k=[...C(h).reverse(),...m];for(const{worldId:t,adapter:u}of k){if(g(t)||y(t))continue;const e=p(u,o,r,n);if(e)return e}return null}function R(a,o,r,d={}){const n=d.intent??"normal",s=d.adapter??D(a);if(!(s instanceof O)){const e=I(s,o,r,n),l=p(s,o,r,n);return e.length>0?e:l?[l]:[]}const c=s.childAdapters(),i=S()===b?[]:c.filter(e=>e.kind!=="three"),m=c.filter(e=>e.kind==="three"),h=i.map(e=>({id:e.worldId,zOrder:e.zOrder,worldId:e.worldId,adapter:e.adapter})),k=[...C(h).reverse(),...m],t=[],u=new Set;for(const{worldId:e,adapter:l}of k){if(g(e)||y(e))continue;const w=I(l,o,r,n),A=p(l,o,r,n);for(const v of w.length>0?w:A?[A]:[])u.has(v)||(u.add(v),t.push(v))}return t}export{R as a,P as p};
@@ -1 +0,0 @@
1
- import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{a as I}from"./three-contract-Dkt6PmWY.js";import{i as N,a as $,b as A,m as P}from"./model-inspection-CXHxrafK.js";import{eR as y,eT as V,d6 as B,eS as p,gO as F,eX as w,gP as G,gQ as E,dU as U,dH as m,eG as O,e1 as v,$ as R,a0 as M,fk as j,fl as t,aI as x,aK as z,gR as T,Z as L,f1 as q,dB as _,gS as W,gT as Z,gU as H,gV as K}from"./index-BRJMIUK0.js";import{S as C}from"./source-object3d-authoring-adapter-DF679Ncb.js";import{a as Q}from"./project-provenance-4ldz-EOG.js";import{object3DAuthoringSubjectOf as J}from"./object3d-authoring-subject-BDrxd1GA.js";import{getUserData as S}from"./user-data-dHvLdpwM.js";import{r as b}from"./index-nmcBqr7Y.js";import"./index-CtzuWnCS.js";import{fo as X}from"./three.core-3arARmh6.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./user-data-Bpj7diUS.js";import"./workspace-arrangement-BdAlBwvd.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./editor-layers-BDJnAAzj.js";import"./three-TCuY32m_.js";import"./component-instance-root-B0C5oNEm.js";import"./entity-object-JmYMfLsx.js";import"./viewport-editor-controls-BYaAZ_Ku.js";import"./three-projection-core-CG01r5Ta.js";import"./object-marks-DwvIEBOK.js";function Y(n,s){return s instanceof C&&n?.id===s.documentId}function ee(n,s){return s instanceof C&&n!==null&&n.id!==s.documentId}function r({children:n,code:s=!1}){return e.jsx(x,{variant:s?"code":"body",selectable:!0,truncate:!0,title:typeof n=="string"?n:void 0,children:n})}function D(n){let s=null;return n?.traverse(i=>{!s&&S(i,"gaussianSplat")&&(s=i)}),s}function ne({splat:n}){const s=S(n,"gaussianSplat"),i=n.getBoundingBox().getSize(new X);return e.jsxs(j,{children:[e.jsx(t,{label:"Gaussians",children:e.jsx(r,{children:s.numSplats.toLocaleString()})}),e.jsx(t,{label:"Format",children:e.jsx(r,{children:"SPZ"})}),e.jsx(t,{label:"Bounds",children:e.jsx(r,{children:`${i.x.toFixed(2)} × ${i.y.toFixed(2)} × ${i.z.toFixed(2)}`})}),e.jsx(t,{label:"Level of detail",children:e.jsx(r,{children:"Full source"})}),e.jsx(t,{label:"Picking",children:e.jsx(r,{children:"Gaussian raycast"})}),e.jsx(t,{label:"Collision",hint:"Gaussian splats are visual environment data; use a separate mesh collider.",children:e.jsx(r,{children:"Separate collider required"})})]})}function te({inspection:n,rig:s}){if(!n)return e.jsx(O,{compact:!0,tone:"error",title:"Model unavailable",description:"The native Object3D graph could not be inspected."});const i=[...n.meshes===0?["The asset has no renderable geometry."]:[],...n.geometry.nonFiniteAttributeValues>0?[`${n.geometry.nonFiniteAttributeValues.toLocaleString()} non-finite geometry values can break bounds and selection.`]:[],...s&&!s.valid?["Rig or animation bindings require attention."]:[]];return e.jsxs(e.Fragment,{children:[i.length>0&&e.jsx(v,{tone:"warning",icon:e.jsx(R,{icon:M.status.warning}),children:e.jsx("div",{children:i.map(o=>e.jsx("div",{children:o},o))})}),e.jsxs(j,{children:[e.jsx(t,{label:"Meshes",children:e.jsx(r,{children:n.meshes.toLocaleString()})}),e.jsx(t,{label:"Primitives",children:e.jsx(r,{children:n.primitives.toLocaleString()})}),e.jsx(t,{label:"Vertices",children:e.jsx(r,{children:n.vertices.toLocaleString()})}),e.jsx(t,{label:"Triangles",children:e.jsx(r,{children:n.triangles.toLocaleString()})}),e.jsx(t,{label:"Indexing",children:e.jsxs(r,{children:[n.geometry.indexedMeshes," indexed · ",n.geometry.nonIndexedMeshes," ","non-indexed"]})}),e.jsx(t,{label:"Attributes",children:e.jsx(r,{children:n.geometry.attributes.map(o=>o.name).join(", ")||"None"})}),e.jsx(t,{label:"UV channels",children:e.jsx(r,{children:n.geometry.uvChannels.join(", ")||"None"})}),e.jsx(t,{label:"Morph targets",children:e.jsx(r,{children:n.morphTargets})}),e.jsx(t,{label:"Bounds",children:e.jsx(r,{children:n.bounds?`${n.bounds.x.toFixed(2)} × ${n.bounds.y.toFixed(2)} × ${n.bounds.z.toFixed(2)}`:"None"})}),e.jsx(t,{label:"GPU estimate",children:e.jsxs(r,{children:[(n.memoryBytes/1048576).toFixed(2)," MiB"]})}),e.jsx(t,{label:"Invalid values",children:e.jsx(x,{tone:n.geometry.nonFiniteAttributeValues?"warning":"muted",children:n.geometry.nonFiniteAttributeValues.toLocaleString()})}),e.jsx(t,{label:"LODs",children:e.jsx(r,{children:n.geometry.lodGroups?`${n.geometry.lodLevels} levels`:"Not authored"})}),e.jsx(t,{label:"Collision",hint:"Collision remains a source/import operation when no model metadata exists.",children:e.jsx(r,{children:"Not authored"})})]})]})}function se({rig:n}){const s=[["Non-normalized weights",n.nonNormalizedVertices],["Zero-weight vertices",n.zeroWeightVertices],["Invalid joint indices",n.invalidJointIndices],["Inverse-bind mismatches",n.inverseBindMismatches],["External bones",n.externalBones],["Non-finite animation values",n.nonFiniteAnimationValues],["Unresolved track targets",n.unresolvedTrackTargets.length]];return e.jsxs(e.Fragment,{children:[!n.valid&&e.jsx(v,{tone:"warning",icon:e.jsx(R,{icon:M.status.warning}),children:"Review the non-zero integrity checks below."}),e.jsxs(j,{children:[e.jsx(t,{label:"Deformation",children:e.jsx(r,{children:n.kind==="skinned"?"Skinned mesh":"Rigid attachments"})}),e.jsx(t,{label:"Bones",children:e.jsx(r,{children:n.uniqueBones})}),e.jsx(t,{label:"Root bones",children:e.jsx(r,{children:n.rootBones.join(", ")||"None"})}),n.kind==="skinned"?e.jsxs(e.Fragment,{children:[e.jsx(t,{label:"Skeletons",children:e.jsx(r,{children:n.skeletons})}),e.jsx(t,{label:"Bind mode",children:e.jsx(r,{children:n.bindModes.join(", ")||"None"})}),e.jsx(t,{label:"Weighted vertices",children:e.jsx(r,{children:n.weightedVertices.toLocaleString()})})]}):null,s.filter(([,i])=>i>0).map(([i,o])=>e.jsx(t,{label:i,children:e.jsx(x,{tone:"warning",children:o.toLocaleString()})},i)),n.unresolvedTrackTargets.length?e.jsx(t,{label:"Missing targets",children:e.jsx(r,{children:n.unresolvedTrackTargets.join(", ")})}):null]})]})}function re({adapter:n,inspection:s}){const[i,o]=b.useState(""),a=n.documentRootObject,d=(s?.materialSlots??[]).map((l,u)=>({material:l,rowKey:`${l.id}:${u}`})).filter(({material:l})=>`${l.name} ${l.type} ${l.textureSlots.join(" ")}`.toLowerCase().includes(i.trim().toLowerCase())),c=l=>{if(!a)return;const u=P(a,{id:l})[0],g=u?n.hierarchy.idForObject3D?.(u):null;g&&q(n,[g])};return e.jsxs(e.Fragment,{children:[e.jsx(j,{children:e.jsx(t,{label:"Filter",htmlFor:"model-material-filter",children:e.jsx(z,{id:"model-material-filter",type:"search",value:i,placeholder:"Name, type, or map",onChange:l=>o(l.target.value)})})}),e.jsxs("div",{className:"vgai-model-inspector-list",children:[d.map(({material:l,rowKey:u})=>e.jsxs(T,{variant:"raised",border:!0,className:"vgai-model-inspector-row",children:[e.jsx("span",{className:"vgai-model-material-swatch",style:{background:l.color??void 0},"aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx(x,{as:"strong",variant:"label",truncate:!0,children:l.name}),e.jsxs(x,{variant:"caption",tone:"muted",truncate:!0,children:[l.type," · ",l.usageCount," object",l.usageCount===1?"":"s"," ","· ",l.textureSlots.join(", ")||"no maps",l.transparent?" · transparent":""]})]}),e.jsx(L,{type:"button",variant:"ghost",size:"compact",onClick:()=>c(l.id),children:"Inspect"})]},u)),d.length===0?e.jsx(O,{compact:!0,title:"No matching materials"}):null]})]})}function ie({adapter:n,provenance:s,provenanceLoaded:i}){b.useSyncExternalStore(_,W);const o=s?Z().find(a=>a.tool?.name===s.operationName):void 0;return e.jsxs(e.Fragment,{children:[o?e.jsx("div",{className:"vgai-model-inspector-actions",children:e.jsx(L,{type:"button",variant:"ghost",size:"compact",onClick:()=>H(o.id),children:"Open Source"})}):null,e.jsxs(j,{children:[e.jsx(t,{label:"Path",children:e.jsx(r,{code:!0,children:n.options.sourcePath})}),e.jsx(t,{label:"Truth",children:e.jsx(r,{children:n.provenance.label})}),e.jsx(t,{label:"Ownership",hint:n.provenance.detail,children:e.jsx(r,{children:n.provenance.source})}),i?null:e.jsx(t,{label:"Provenance",children:e.jsx(r,{children:"Loading…"})}),s?e.jsxs(e.Fragment,{children:[e.jsx(t,{label:"Generated by",children:e.jsx(r,{children:s.operationName})}),e.jsx(t,{label:"Tool",children:e.jsx(r,{code:!0,children:s.operationSource??"Not recorded"})}),e.jsx(t,{label:"Generated",children:e.jsx(r,{children:new Date(s.createdAt).toLocaleString()})}),e.jsx(t,{label:"Output hash",children:e.jsx(r,{code:!0,children:s.output.sha256})})]}):i?e.jsx(t,{label:"Provenance",children:e.jsx(r,{children:"Not recorded"})}):null]})]})}const k=new WeakMap;function oe(n){const s=n.documentRootObject??null;if(!s)return;const i=k.get(s);if(i!==void 0)return i??void 0;const o=D(s)?null:N(s),a=o?`${o.meshes} meshes · ${o.triangles.toLocaleString()} triangles`:null;return k.set(s,a),a??void 0}function le({adapter:n}){const s=n,[i,o]=b.useState(null),[a,d]=b.useState(!1),c=s.options.modelSource,l=c?.kind==="project-file"?c.path:null;return b.useEffect(()=>{let u=!1;if(d(!1),!l){o(null),d(!0);return}return Q(l).then(g=>{u||(o(g),d(!0))},()=>{u||(o(null),d(!0))}),()=>{u=!0}},[l]),e.jsx("div",{"data-testid":"model-asset-inspector",children:e.jsx(ie,{adapter:s,provenance:i,provenanceLoaded:a})})}function ae({inspection:n}){return e.jsxs(j,{children:[e.jsx(t,{label:"Native type",children:e.jsx(r,{children:n.type})}),e.jsx(t,{label:"Visible",children:e.jsx(r,{children:n.visible?"Yes":"No"})}),e.jsx(t,{label:"Children",children:e.jsx(r,{children:n.children})}),e.jsx(t,{label:"Descendants",children:e.jsx(r,{children:n.descendants})}),e.jsx(t,{label:"Render order",children:e.jsx(r,{children:n.renderOrder})}),e.jsx(t,{label:"Layer mask",children:e.jsxs(r,{code:!0,children:["0x",n.layers.toString(16)]})})]})}function de({geometry:n}){return e.jsxs(e.Fragment,{children:[n.nonFiniteAttributeValues?e.jsxs(v,{tone:"warning",children:[n.nonFiniteAttributeValues.toLocaleString()," non-finite buffer values can break bounds, picking, and selection outlines."]}):null,e.jsxs(j,{children:[e.jsx(t,{label:"Vertices",children:e.jsx(r,{children:n.vertices.toLocaleString()})}),e.jsx(t,{label:"Triangles",children:e.jsx(r,{children:n.triangles.toLocaleString()})}),e.jsx(t,{label:"Index buffer",children:e.jsx(r,{children:n.indexed?"Indexed":"Non-indexed"})}),e.jsx(t,{label:"Attributes",children:e.jsx(r,{children:n.attributes.join(", ")})}),e.jsx(t,{label:"UV channels",children:e.jsx(r,{children:n.uvChannels.join(", ")||"None"})}),e.jsx(t,{label:"Morph targets",children:e.jsx(r,{children:n.morphTargets})}),e.jsx(t,{label:"Invalid values",children:e.jsx(x,{tone:n.nonFiniteAttributeValues?"warning":"muted",children:n.nonFiniteAttributeValues.toLocaleString()})})]})]})}function ce({materials:n}){return e.jsx("div",{className:"vgai-model-inspector-list",children:n.map(s=>e.jsxs(T,{variant:"raised",border:!0,className:"vgai-model-inspector-row",children:[e.jsx("span",{className:"vgai-model-material-swatch",style:{background:s.color??void 0},"aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx(x,{as:"strong",variant:"label",truncate:!0,children:s.name}),e.jsxs(x,{variant:"caption",tone:"muted",truncate:!0,children:[s.type," · ",s.textureSlots.join(", ")||"no maps"]})]})]},s.id))})}function ue({skin:n}){return e.jsxs(j,{children:[e.jsx(t,{label:"Bones",children:e.jsx(r,{children:n.bones})}),e.jsx(t,{label:"Root bones",children:e.jsx(r,{children:n.rootBones.join(", ")||"None"})}),e.jsx(t,{label:"Bind mode",children:e.jsx(r,{children:n.bindMode})})]})}function he({bone:n}){return e.jsxs(j,{children:[e.jsx(t,{label:"Parent",children:e.jsx(r,{children:n.parent??"Skeleton root"})}),e.jsx(t,{label:"Children",children:e.jsx(r,{children:n.children.join(", ")||"None"})})]})}const h={splat:m,geometry:m+10,rig:m+20,materials:m+40,source:m+50},je=new WeakMap,xe=new WeakMap,me=new WeakMap;function f(n,s,i){const o=n.get(s);if(o!==void 0)return o;const a=i();return n.set(s,a),a}function be(n){const s=n,i=s.documentRootObject,o=[],a=D(i);if(i&&a){const d=S(a,"gaussianSplat");o.push({id:"splat",title:"Gaussian Splat",icon:K,order:h.splat,description:`${d.numSplats.toLocaleString()} Gaussians · native SPZ`,body:{kind:"custom",render:()=>e.jsx(ne,{splat:a})}})}else if(i){const d=f(je,i,()=>N(i)),c=f(xe,i,()=>$(i)),l=oe(n);o.push({id:p,title:"Geometry",icon:B,order:h.geometry,...l?{description:l}:{},body:{kind:"custom",render:()=>e.jsx(te,{inspection:d,rig:c})}}),(c.skinnedMeshes>0||c.uniqueBones>0)&&o.push({id:"rig",title:"Rig",icon:F,order:h.rig,description:c.kind==="skinned"?`${c.uniqueBones} bones · ${c.skinnedMeshes} skinned meshes`:`${c.uniqueBones} bones · rigid hierarchy`,body:{kind:"custom",render:()=>e.jsx(se,{rig:c})}}),o.push({id:"materials",title:"Materials",icon:w,order:h.materials,description:`${d.materials} materials`,body:{kind:"custom",render:()=>e.jsx(re,{adapter:s,inspection:d})}})}return o.push({id:"source",title:"Source",icon:G,order:h.source,description:s.provenance.label,defaultOpen:!1,body:{kind:"custom",render:()=>e.jsx(le,{adapter:n})}}),s.options.audit===!1?o.filter(d=>d.id!==p&&d.id!=="source"):o}function ge(n,s){const i=n?I(s.hierarchy,n.id):null;if(!i)return[];if(J(i))return[];const o=f(me,i,()=>A(i)),a=[{id:p,title:"Object",icon:E,order:h.geometry,description:o.type,body:{kind:"custom",render:()=>e.jsx(ae,{inspection:o})}}],d=o.geometry;d&&a.push({id:"geometry",title:"Geometry",icon:B,order:h.geometry+1,description:`${d.triangles.toLocaleString()} triangles`,body:{kind:"custom",render:()=>e.jsx(de,{geometry:d})}}),o.materials.length>0&&a.push({id:"materials",title:"Materials",icon:w,order:h.materials,description:`${o.materials.length} slots`,body:{kind:"custom",render:()=>e.jsx(ce,{materials:o.materials})}});const c=o.skin;c&&a.push({id:"skin",title:"Skin",icon:F,order:h.rig,description:`${c.bones} bones`,body:{kind:"custom",render:()=>e.jsx(ue,{skin:c})}});const l=o.bone;return l&&a.push({id:"bone",title:"Bone",icon:U,order:h.rig+1,description:l.parent??"Skeleton root",body:{kind:"custom",render:()=>e.jsx(he,{bone:l})}}),a}const pe=V();function fe(){pe.ensure(n=>{n(y({match:Y,sections:(s,i)=>be(i)})),n(y({match:ee,sections:ge}))})}const _e="workspace.service";function We(){return fe(),()=>{}}export{_e as point,We as start};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/create-runtime-DBfUy0SO.js","assets/adapter-surface-Y37Nzcyw.js","assets/binding-Bmxqznjk.js","assets/root-stacking-BEd9ZvxC.js","assets/assets-BcrMQHRv.js","assets/loader-BTUKnX5Q.js","assets/KTX2Loader-CaqVE6nY.js","assets/three.module-BLhyNg0e.js","assets/three.core-3arARmh6.js","assets/GLTFLoader-KeoruJgS.js","assets/BufferGeometryUtils-B22h7jo4.js","assets/setup-renderer-Cwkl1Ar6.js","assets/index-DHhMOs_s.js","assets/defaults-DKiBJCPN.js","assets/render-settings-DS5leCed.js","assets/render-features-rxbawsRb.js","assets/index-BRJMIUK0.js","assets/index-nmcBqr7Y.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-FUuS4qwW.js","assets/client-DNXj_opT.js","assets/index-0Lm0Nf1M.css","assets/seeded-random-BgCwIAAU.js","assets/debug-registry-P0_YQGWd.js","assets/loop-gate-report-N52EWFGD.js","assets/system-slot-E2mEdiih.js","assets/user-data-dHvLdpwM.js","assets/object-marks-DwvIEBOK.js","assets/performance-profiler-OwnXQX0M.js"])))=>i.map(i=>d[i]);
2
- import{y as v,z as R,a8 as _,M as s,bn as b,bo as A,au as I,bp as P,bq as S,br as M,bs as g,bt as y,bu as C,_ as E,bv as F}from"./index-BRJMIUK0.js";import{m as G}from"./capability-coverage-DZ-onC5j.js";import{r as $}from"./binding-resolver-dE0GnZT5.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"./game-contract-seams-BnPFGLll.js";import"./native-debug-module-2_HVupdg.js";import"./native-entry-surface-BE8LJNdu.js";import"./debug-registry-P0_YQGWd.js";import"./contract-system-adapters-Bic_7sev.js";import"./adapter-surface-Y37Nzcyw.js";import"./entry-adjudication-Dc18TIqT.js";import"./structural-signature-Dc7skRiy.js";import"./three.core-3arARmh6.js";import"./webgl-frame-capture-DdJkM2mi.js";import"./events-156d8d12.esm-CYeuVCYr.js";import"./three.module-BLhyNg0e.js";import"./index-bQE2NA0D.js";import"./realm-services-CnY105XU.js";import"./canvas-entry-runtime-UNYuSfG0.js";import"./three-ingest-runtime-B7rtg3QE.js";import"./EffectComposer-BEAt0PtQ.js";import"./CopyShader-BzTUYzf6.js";import"./ShaderPass-DTnDQXm0.js";import"./Pass-D1MRT672.js";import"./CSS3DRenderer-BsAqfavI.js";import"./relative-path-guard-GiM7Lsz8.js";import"./react-root-BHA-cdrW.js";let u=null;function h(){return u!==null}function j(t,o){return t.selection?t:{...t,selection:{get:()=>[...o.shell.selectedEntityIds],set:e=>o.shell.selectMultiple(e)}}}function k(){const t=u;if(t){u=null,M(null),g(null),y(),t.store.shell.setPlayState("stopped");try{t.stop()}catch{}delete window.__vgaiModule,s.log("Module adapter mode stopped","adapter")}}async function D(t,o,e,i,r,l){const{createGameRuntime:m}=await E(async()=>{const{createGameRuntime:c}=await import("./create-runtime-DBfUy0SO.js").then(a=>a.e);return{createGameRuntime:c}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32])),n=await $({...t,roots:[o]},e);return{session:await m({container:i,roots:n,width:r,height:l}),specs:n}}async function L(t,o,e,i){await P();const r=C();if(!r){s.error("Game container not mounted — cannot auto-mount module adapter","adapter");return}t.shell.setPlayState("playing"),s.log(`Mounting custom adapter module for world "${e.id}" (kind: ${e.surface})`,"adapter");const l=r.clientWidth||800,m=r.clientHeight||600,{session:n,specs:p}=await D(o,e,i,r,l,m),a=n.game.roots[0].mounted,f=p[0].adapter.id;u={store:t,stop:()=>n.stop()};let d;a.authoring?d=j(a.authoring,t):d=S(t.shell,`${f} (no authoring surface)`),M(d),g(a.systems??{}),t.shell.notifyIngestEdit(),y();const w=G(a);window.__vgaiModule={worldId:e.id,adapterId:f,reach:w}}async function gt(t){const o=await v().catch(()=>null);if(o&&R(o).length>0)return!1;const e=o?_(o)[0]:void 0;if(e===void 0||e.adapter.type!=="module")return!1;const i=I();if(!i)return s.error("Manifest declares a { module } world but no project is open — cannot auto-mount","adapter"),!0;try{await L(t,o,e,i.rootPath)}catch(r){s.error(`Manifest { module } auto-mount failed: ${r}`,"adapter"),b({worldId:e.id,kind:e.surface,identity:e.adapter.identity,message:A(r)})}return!0}F({id:"module",priority:2,mounted:h,playing:h,stop:k,instanceContainer:()=>null});export{L as enterModuleModeFromManifestRoot,k as exitModuleMode,h as isModuleModeActive,D as mountModuleRootRuntime,gt as tryManifestModuleRoute,j as withStoreSelection};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BRJMIUK0.js","assets/index-nmcBqr7Y.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-FUuS4qwW.js","assets/client-DNXj_opT.js","assets/index-0Lm0Nf1M.css"])))=>i.map(i=>d[i]);
2
- import{E as z,eI as me,fi as he,cv as A,cw as fe,fL as ge,fu as ye,fQ as ve,fR as be,fS as we,fT as Se,fU as Ce,fI as xe,bu as J,M as g,bp as Ee,km as _,_ as N,br as K,bt as X,au as Ie,j as Ae,bs as Pe}from"./index-BRJMIUK0.js";import{m as P}from"./capability-coverage-DZ-onC5j.js";import{n as ke}from"./after-paint-CB4bz1-e.js";import{BabylonAuthoringAdapter as Re}from"./babylon-authoring-adapter-C8mFMXSr.js";import{a as k,S as Y,s as Me,c as De,C as je,D as R,G as $e,B as _e,H as T,E as O,T as Te,j as q,k as Q,l as Z,r as ee,p as te,o as ne,U as Ge,K as se,u as Le}from"./active-ingest-DA426a81.js";import{c as Oe,a as Be}from"./json-history-resource-DwS10tqD.js";import{P as Fe}from"./pixi-authoring-adapter-BChknIdC.js";import{createLiveCanvasWriteTarget as We}from"./pixi-live-write-target-BjDsBQbp.js";import{a as Ne}from"./source-persistence-backend-CwLYVPXj.js";import{resolveCanvasPixiForEditor as He}from"./canvas-entry-runtime-UNYuSfG0.js";import{registerPresentedPixiApps as Ue,capturePixiDisplayObjectThumbnail as Ve}from"./canvas-preview-frames-C0QTagA3.js";import{p as ze}from"./contract-system-adapters-Bic_7sev.js";import{s as Je,d as Ke,f as Xe,b as re,g as Ye,e as ie,w as qe,j as Qe}from"./resolve-three-CVnMRHxw.js";import{createPhysics2DRegistry as Ze}from"./physics-registry-B2Jkp8e6.js";import{composePhysicsAdapters2D as et,createPhysicsAdapter2D as tt}from"./system-adapters-rIC8FSGP.js";import{s as nt}from"./mount-ingest-root-DYR0TMIt.js";import{landIngestBootInEdit as ae}from"./ingest-boot-viewport-DAt8WFSy.js";import{a as C}from"./jsx-runtime-DPjLkJKQ.js";import{b as st}from"./react-canvas-navigation-Cp3cOHJa.js";import{C as H,a as rt,b as it}from"./CanvasSceneViewport-C_mapCwC.js";import{R as at}from"./RootSelectionOverlay-CpaGluQu.js";import{e as ot,S as ct}from"./surface-state-1lTOi8FD.js";import{r as w}from"./index-nmcBqr7Y.js";import{b as dt,e as lt,g as ut}from"./registry-CaCdF63N.js";import"./index-CtzuWnCS.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-CinJrH5C.js";import"./index-D_NuPfjr.js";import"./index-FUuS4qwW.js";import"./client-DNXj_opT.js";import"./game-contract-seams-BnPFGLll.js";import"./ingest-source-persistence-Dmdo-UBp.js";import"./index-SS9EugVg.js";import"./component-instance-root-B0C5oNEm.js";import"./user-data-Bpj7diUS.js";import"./workspace-arrangement-BdAlBwvd.js";import"./pixi-transform-channels-P4rvmusc.js";import"./debug-registry-P0_YQGWd.js";import"./dom-authoring-adapter-BrLU8IJ_.js";import"./react-world-authoring-adapter-DOjv2pYm.js";import"./board-guides-BEKPgD9M.js";import"./relative-import-specifier-BFKIWEWs.js";import"./story-arg-descriptors-Ek86ExX7.js";import"./inspect-Dr4qvDpJ.js";import"./inference-diagnostics-xecGdohW.js";import"./writer-tw6EcuVO.js";import"./webgl-frame-capture-DdJkM2mi.js";import"./three.core-3arARmh6.js";import"./three-state-DwFE3ay2.js";import"./editor-shell-store-ChLcVeNB.js";import"./output-pass-HurwNl0G.js";import"./three.module-BLhyNg0e.js";import"./Pass-D1MRT672.js";import"./editor-layers-BDJnAAzj.js";import"./entity-object-JmYMfLsx.js";import"./three-contract-Dkt6PmWY.js";import"./Toolbar-DkTHnQto.js";import"./transform-mode-request-DzD9aUNA.js";import"./TransientHint-BpDLhRLd.js";import"./eyedropper-session-bjPXnfeX.js";import"./layered-pick-kiQf53t5.js";import"./root-stacking-BEd9ZvxC.js";import"./react-story-board-GaXqr03H.js";import"./viewport-editor-controls-BYaAZ_Ku.js";function pt(t){if(typeof t?.game?.scene?.getScenes=="function")return t.game;const e=t?.Phaser?.GAMES;return Array.isArray(e)?e.find(n=>typeof n?.scene?.getScenes=="function")??null:null}function mt(t){const e=t?.__vgaiBabylon?.engines,n=Array.isArray(e)?e:t?.BABYLON?.Engine?.Instances;return Array.isArray(n)?[...n].reverse().find(s=>Array.isArray(s?.scenes)&&s.scenes.length>0)??null:null}function ht(t){return[0,0,Math.sin(t/2),Math.cos(t/2)]}function ft(t){return 2*Math.atan2(t[2],t[3])}function gt(t){return encodeURIComponent(t||"unnamed")}function yt(t){return Array.isArray(t.list)?t.list:[]}class vt{constructor(e,n){this.game=e,this.store=n}capabilities={transform:!0,inspectorFields:!0,persist:!1};provenance={source:"foreign",label:"live-only",detail:"Live Phaser scene/display lists projected directly — edits apply to native game objects for this session only."};persistence={...Oe(),destination:"live-only (not saved)"};indexed=new Map;listeners=new Set;refresh(){this.reindex();let e=0,n=0;for(const s of this.indexed.values())s.kind==="scene"?e++:n++;return{scenes:e,objects:n}}scenes(){const e=this.game.scene?.getScenes;if(typeof e!="function")return[];const n=e.call(this.game.scene,!0);return Array.isArray(n)?n:[]}reindex(){this.indexed.clear();for(const[e,n]of this.scenes().entries()){const s=n.sys?.settings?.key||`Scene ${e+1}`,r=`phaser:scene:${e}:${gt(s)}`,o=Array.isArray(n.children?.list)?n.children.list:[],a={id:r,label:s,role:"root",kind:"phaser-scene",typeLabel:"Phaser.Scene",parentId:null,childIds:[]};this.indexed.set(r,{kind:"scene",scene:n,node:a}),a.childIds=o.map((i,c)=>this.indexObject(i,r,`${e}/${c}`))}}indexObject(e,n,s){const r=e.type||e.constructor?.name||"GameObject",o=e.name||r,a=`phaser:object:${s}`,i={id:a,label:o,role:"entity",kind:`phaser-${r.toLowerCase()}`,typeLabel:r,parentId:n,childIds:[]};return this.indexed.set(a,{kind:"object",object:e,node:i}),i.childIds=yt(e).map((c,d)=>this.indexObject(c,a,`${s}/${d}`)),a}hierarchy={roots:()=>(this.reindex(),[...this.indexed.values()].filter(e=>e.kind==="scene").map(e=>e.node)),node:e=>(this.reindex(),this.indexed.get(e)?.node??null)};selection={get:()=>[...this.store.shell.selectedEntityIds],set:e=>{this.store.shell.selectMultiple(e),this.notify()}};transforms={dimensions:e=>(this.reindex(),this.indexed.get(e)?.kind==="object"?"2d":null),get:e=>{this.reindex();const n=this.indexed.get(e);if(!n||n.kind!=="object")return{position:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1]};const s=n.object;return{position:[s.x??0,s.y??0,s.depth??0],rotation:ht(s.rotation??0),scale:[s.scaleX??1,s.scaleY??1,1]}},beginEdit:e=>{},apply:(e,n)=>{this.reindex();const s=this.indexed.get(e);!s||s.kind!=="object"||(s.object.x=n.position[0],s.object.y=n.position[1],s.object.depth=n.position[2],s.object.rotation=ft(n.rotation),s.object.scaleX=n.scale[0],s.object.scaleY=n.scale[1],this.notify())},endEdit:e=>{}};inspector={properties:e=>{this.reindex();const n=this.indexed.get(e);return n?n.kind==="scene"?[{path:"key",label:"Scene key",type:"string",readonly:!0}]:[{path:"type",label:"Type",type:"string",readonly:!0},{path:"name",label:"Name",type:"string"},{path:"active",label:"Active",type:"boolean"},{path:"visible",label:"Visible",type:"boolean"},{path:"alpha",label:"Alpha",type:"number"},{path:"depth",label:"Depth",type:"number"}]:[]},get:(e,n)=>{this.reindex();const s=this.indexed.get(e);if(s)return s.kind==="scene"?n==="key"?s.scene.sys?.settings?.key:void 0:n==="type"?s.object.type||s.object.constructor?.name:s.object[n]},set:(e,n,s)=>{this.reindex();const r=this.indexed.get(e);!r||r.kind!=="object"||n==="type"||(r.object[n]=s,this.notify())}};subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}dispose(){this.listeners.clear(),this.indexed.clear()}notify(){for(const e of this.listeners)e();this.store.shell.notifyIngestEdit()}}function bt(t){return We({physics:t.physics,persistence:Ne({history:t.history,writer:t.writer})})}function wt(t,e={}){const s=t.Application.prototype;let r=null,o=0;const a=[],i=Object.getOwnPropertyDescriptor(s,"render"),c=s.render;return Object.defineProperty(s,"render",{configurable:!0,writable:!0,value:function(...d){o++;const u=this.stage;if(!r&&u){const p={stage:u,renderer:this.renderer,app:this};if(e.accept?.(p)??!0){r=p;for(const f of a.splice(0))f(r)}}return c?.apply(this,d)}}),{get captured(){return r},getDrawCount(){return o},setPaused(d){const u=r?.app;u?.ticker&&(d?u.ticker.stop():u.ticker.start())},waitForCapture(d){const u=typeof d=="number"?{timeoutMs:d}:d??{},p=u.timeoutMs??1e4;return r?Promise.resolve(r):new Promise((f,x)=>{const y=Je({budgetMs:p,clock:u.visibility??Ke(),onExpire:()=>{const l=a.indexOf(S);l>=0&&a.splice(l,1),u.onWait?.(null),x(new Error(`pixi scene capture timed out after ${p}ms of VISIBLE time (${Math.round(y.elapsedHiddenMs())}ms browser-suspended, which is not counted because no frame can be presented) — the game never rendered, or it bundles its own (un-shared) copy of pixi.js.`))}}),S=l=>{y.cancel(),u.onWait?.(null),f(l)};a.push(S),u.onWait?.(y)})},uninstall(){i?Object.defineProperty(s,"render",i):c&&Object.defineProperty(s,"render",{configurable:!0,writable:!0,value:c})}}}const oe="IngestGame2DLoadError";class St extends Error{constructor(e,n){super(`pixi ingest: game "${e}" failed to load: ${n}`,{cause:n}),this.name=oe}}async function Ct(t,e,n={}){const s=wt(t,{...n.acceptCapture?{accept:n.acceptCapture}:{}});try{if(await e.load(),await n.preferStructuralRuntime?.())return s.uninstall(),null}catch(o){throw s.uninstall(),new St(e.id,o)}const r=n.captureTimeoutMs??e.captureTimeoutMs??8e3;try{return{stage:(await s.waitForCapture({timeoutMs:r,...n.onWait?{onWait:n.onWait}:{}})).stage,capture:s,setPaused:a=>s.setPaused(a),dispose:()=>s.uninstall()}}catch(o){throw s.uninstall(),new Error(`pixi ingest: game "${e.id}" rendered no capturable frame within ${r}ms: ${o}`)}}const xt=1500,Et=1e4;function It(t,e){const n=e.settleGraceMs??xt,s=e.deadlineMs??Et;let r=null,o=null;const a=i=>{e.isHeld()&&(r??=i,o===null&&e.currentScene()===t&&(o=i),e.render(),!(o!==null&&i-o>=n)&&(o===null&&i-r>=s||e.schedule(a)))};e.schedule(a)}function At(t){const e=k();if(e?.kind!=="canvas"||!e.session.adapter)return()=>{};const n=z()?.scenes;if(n&&me(n))return()=>{};const s=e.worldId;he({id:A,title:"Scene",kind:"world",workspaceRole:"authored-subject",provenance:{rootId:s},Content:t,closeable:!1,presentation:()=>({kind:"world",id:s})}),fe(A);const r=ge(s,A);return()=>{r(),ye(A,{discardDirty:!0})}}function Pt(){const t=z()?.scenes;if(!t?.default)return;const e=t.entries.find(r=>r.id===t.default),n=e?.source?.export??e?.id;return n?(Y()?.storiesFor("")??[]).find(r=>r.label===n||r.id===n)?.id:void 0}function kt({active:t,adapter:e,documentId:n,store:s,worldId:r,contractSceneId:o}){const a=w.useRef(null),c=w.useRef(ve()).current;w.useSyncExternalStore(s.shell.subscribe,s.shell.getSnapshot);const d=w.useSyncExternalStore(be,we),u=w.useSyncExternalStore(Se,Ce),p=k(),f=e.hierarchy.roots(),x=new Set(e.rects?.emptyContainers?.().map(l=>l.id)??[]),y=f.some(l=>!x.has(l.id)),S=ot({surface:"Ingest scene",rootIds:[r],phase:p?.kind==="canvas"&&p.worldId===r&&p.session.hostEl?"ready":"loading",content:p?.kind!=="canvas"||p.worldId!==r||!p.session.hostEl?"unknown":y?"present":"empty",readiness:d,failures:u});return w.useEffect(()=>xe(n,()=>({adapter:e,nodeId:[...s.shell.selectedEntityIds].find(l=>e.hierarchy.node(l))??null})),[e,n,s]),w.useEffect(()=>{const l=a.current;if(l)return st(l,c)},[c]),w.useEffect(()=>{if(!t)return;const l=a.current,v=k(),b=v?.kind==="canvas"?v.session.hostEl:void 0;if(!(!l||!b))return l.appendChild(b),()=>{const E=J();E&&b.parentElement===l&&E.appendChild(b)}},[t]),w.useEffect(()=>{if(!t)return;const l=o??Pt();if(!l)return;const v=Y();v&&v.goToScene(l)},[t,o]),C.jsxs("div",{ref:a,"data-testid":"world-document:ingest-canvas-scene","data-vgai-backdrop-color":t?H:void 0,"data-vgai-backdrop-policy":t?"dark-frost":void 0,style:{position:"absolute",inset:0,overflow:"hidden",pointerEvents:"auto",backgroundColor:H,touchAction:"none"},children:[C.jsx(rt,{view:c,documentId:n}),C.jsx(at,{adapter:e,view:c,transformModeAware:!0}),C.jsx(ct,{explanation:S,testId:"ingest-canvas-surface-status",style:{zIndex:20}}),C.jsx(it,{active:t,adapter:e,containerRef:a,view:c,documentId:n})]})}function ce(t){const e=k();if(e?.kind!=="canvas"||!e.session.adapter)return()=>{};const n=e.session.adapter,s=e.worldId;return At(o=>C.jsx(kt,{...o,adapter:n,store:t,worldId:s}))}function Rt(t,e){const{adapter:n}=t;if(n.type!=="ingest")throw new Error(`resolveIngest2DDescriptor: world "${t.id}" is not an { ingest } world.`);if(!t.entry)throw new Error(`resolveIngest2DDescriptor: world "${t.id}" has no \`entry\` — an ingest root mounts the game's own entry module.`);const s=Xe(e);return{id:t.id,name:t.id,description:t.description??"",...n.captureTimeoutMs!==void 0?{captureTimeoutMs:n.captureTimeoutMs}:{},load:re(s.entry(t.entry),n.contractShim===void 0?void 0:s.module(n.contractShim))}}function U(t,e){const n=ut(t,e),s=lt[n];if(!s)throw new Error(`canvas ingest discovery: "${t}"'s module "${e}" did not match any game module (looked for glob key "${n}").`);return s}function Mt({folderId:t,manifest:e,root:n}){const{adapter:s}=n;if(!n.entry)throw new Error(`canvas ingest discovery: "${t}" has no \`entry\` — an ingest root mounts the game's own entry module.`);return{...{id:n.id,name:e.name,description:n.description??"",...s.captureTimeoutMs!==void 0?{captureTimeoutMs:s.captureTimeoutMs}:{}},load:re(U(t,n.entry),s.contractShim===void 0?void 0:U(t,s.contractShim))}}let G=null;function Dt(){return G||(G=dt("canvas").map(Mt).sort((t,e)=>t.id.localeCompare(e.id))),G}function jt(t){return Dt().find(e=>e.id===t)}const $t="this game imports the host's pixi directly, in the editor's own realm";function de(t,e,n){const s=R()?.systems;let r=null;const{systems:o,renderDebug:a,debugCollisions:i}=qe({contractSystems:s,surface:"canvas",...n?{physics:n}:{},...e?{canvasRuntime:{renderer:e}}:{},setRenderPassHooks:c=>{r?.(),r=c?Qe(e,c):null}});Pe(o),g.log(s?`canvas ingest: "${t}" declares the vgai game contract — ${s.commands?.length??0} commands, ${s.state?.length??0} state providers`:`canvas ingest: "${t}" declares no vgai game contract — game.commands()/game.state() have nothing to answer and will refuse by naming that`,"ingest");for(const c of i)g.error(`canvas ingest: "${t}" — ${c}; it will refuse`,"ingest");return e&&g.log(a?`canvas ingest: "${t}" render debugging is live — the Frame debugger captures through the game's own Pixi renderer (draws are unattributed: Pixi's batcher merges display objects, so no display object is the author of a draw)`:`canvas ingest: "${t}" has no render-debug capability — its renderer exposes no real WebGL2 context, or no prerender/postrender runners to bracket`,"ingest"),{wiring:a,uninstall:()=>r?.()}}function _t(t,e){return e instanceof Error&&e.name===oe?`canvas ingest: game "${t}" never ran — its own modules failed to load, so nothing could render and there is no canvas runtime in the realm to recognize (${e})`:`canvas ingest: game "${t}" mounted no recognized canvas runtime — the host's pixi captured no frame, and the realm holds no Phaser game or Babylon.js engine on their own public registries either (${e})`}function Tt(t,e){const n=t?.canvas;return n instanceof Node&&e.contains(n)}function le(){return Ae(ze(R()?.systems,"canvas").bound.physics)}function L(t,e){const n=pt(e);if(n)return{runtime:"phaser",adapter:new vt(n,t),mechanism:"this game runs its own Phaser instance in the editor's own realm; the host reads that live game’s active scenes and display lists"};const s=mt(e);return s?{runtime:"babylon",adapter:new Re(s,t),mechanism:"this game runs its own Babylon.js engine in the editor's own realm; the host reads that live engine’s scenes and root nodes"}:null}function V(t,e,n,s,r){const o=r.adapter;o.refresh();const a=ie({primary:o,worldId:n,hostEl:s,store:t}),i=se(),c=()=>i?{loop:null,reason:"the same-realm loop gate holds this game’s scheduling, but no probe has measured that control on this route"}:{loop:null,reason:Ge},d=q(i?{setPaused:p=>{p?i.hold():i.release()}}:{pauseGap:`${r.runtime} exposes no host-controlled loop gate`});let u=()=>{};Q({kind:"canvas",session:{store:t,adapter:o,hostEl:s,lifecycle:d,loop:c,dispose:()=>{u(),o.dispose(),O(),s.remove()}},siblings:[],worldId:n}),u=ce(t),Z(()=>t.shell.playState==="playing"&&t.shell.activeViewportTab==="play"),K(a),de(e.name,void 0,le()),ae(),t.shell.notifyIngestEdit(),X(),ee({reach:P({authoring:a}),reachMechanism:r.mechanism,loop:c}),g.log(`canvas ingest: recognized ${r.runtime} in the realm and captured "${e.name}"`,"ingest"),te("__vgaiIngest2D",{gameId:n,...ne(a),runtime:r.runtime,get reflected(){return o.refresh()},...d.setPaused?{setPaused:d.setPaused}:{},reach:P({authoring:a}),adapter:a,store:t})}async function Gt(t,e,n){De(),await Ee();const s=J();if(!s){g.error("Game container not mounted — cannot ingest (canvas)","ingest");return}t.shell.setPlayState("playing"),g.log(`Ingesting unmodified PixiJS game: ${e.name}`,"ingest");const r=je(R());r.malformed!==null&&g.error(`Ingest game "${e.id}" ${r.malformed} — the host is measuring readiness instead.`,"ingest");const o=r.ready===null?"measured-wait":"contract-ready",a=r.ready===null?"measured":"declared";_({rootId:e.id,mechanism:o,source:a,state:"waiting"});const i=document.createElement("div");i.id="container",i.style.cssText=`position:absolute;inset:0;width:100%;height:100%;overflow:hidden;background:#000;${$e}`,s.appendChild(i),_e(i);{const{markGameCssScope:h}=await N(async()=>{const{markGameCssScope:j}=await import("./index-BRJMIUK0.js").then($=>$.tR);return{markGameCssScope:j}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]));h(i);const m=Ie();if(m){const{ensureScopedGameStyles:j}=await N(async()=>{const{ensureScopedGameStyles:$}=await import("./index-BRJMIUK0.js").then(pe=>pe.tS);return{ensureScopedGameStyles:$}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]));await j(m.rootPath)}}window.__vgaiMountCold=!0;const c=await He();let d;try{const h=await Ct(c,e,{...e.captureTimeoutMs!==void 0?{captureTimeoutMs:e.captureTimeoutMs}:{},acceptCapture:({renderer:m})=>Tt(m,i),onWait:m=>nt(e.id,m),preferStructuralRuntime:async()=>{const m=T();return await m.__vgaiBabylon?.ready,L(t,m)!==null}});if(h===null){const m=L(t,T());if(m){V(t,e,n,i,m);return}throw new Error(`canvas ingest: game "${e.id}" reported a structural runtime, but it disappeared before dispatch`)}d=h}catch(h){const m=L(t,T());if(m){V(t,e,n,i,m);return}throw O(),i.remove(),_({rootId:e.id,mechanism:o,source:a,state:"failed",failure:r.ready===null?"no-readiness-declaration":"declared-ready-never-resolved"}),new Error(_t(e.id,h))}const u=d.stage;for(let h=0;h<90&&(u.children?.length??0)===0;h++)await ke();const p=d.capture.captured?.app,f=p?.canvas;f&&(Ye(f),f.parentElement!==i&&i.appendChild(f));const x=Ue(p?[p]:[]),y=le(),S=tt(Ze()),l=y?et([y,S]):S,v=Te(R(),{onSwitchAccepted:h=>It(h,{isHeld:()=>!Le(),currentScene:()=>v?.active("")??null,render:()=>p?.render(),schedule:m=>requestAnimationFrame(m)})}),b=new Fe(u,t,{pixi:c,journal:Be(n),target:bt({physics:l,history:t.shell.projectHistory}),...v?{stories:v}:{},surface:()=>p?.canvas??null,capturePreview:(h,m)=>Ve(h,{...m,pixi:c})}),E=b.refresh(),I=ie({primary:b,worldId:n,hostEl:i,store:t});let M=null,B=()=>{};const F=se(),W=q({setPaused:h=>{d.setPaused(h),h?F?.hold():F?.release()}});Q({kind:"canvas",session:{store:t,adapter:b,hostEl:i,lifecycle:W,dispose:()=>{B(),M?.uninstall(),M?.wiring?.dispose(),x(),d.dispose(),O(),i.remove()}},siblings:[],worldId:n}),B=ce(t),Z(()=>t.shell.playState==="playing"&&t.shell.activeViewportTab==="play"),K(I),M=de(e.name,d.capture.captured?.renderer,y?l:null),ae(),t.shell.notifyIngestEdit(),X();let D="measured";if(r.ready)try{await r.ready(),D="declared"}catch(h){g.error(`Ingest game "${e.id}" declared \`window.vgaiGame.ready\` and it REJECTED (${String(h)}) — the frame was already captured, so the host fell back to the measured settle wait. This root now reports readiness as measured.`,"ingest")}_({rootId:e.id,mechanism:D==="declared"?"contract-ready":"measured-wait",source:D,state:"ready"}),ee({reach:P({authoring:I}),reachMechanism:$t,loop:()=>({loop:null,reason:"the host stops and starts the captured PixiJS Application ticker directly, but no probe has measured whether that holds everything this game schedules"})}),g.log(`pixi ingest: captured "${e.name}" (${E.count} nodes, ${E.sprites} sprites)`,"ingest"),te("__vgaiIngest2D",{gameId:n,...ne(I),drawCount:()=>d.capture.getDrawCount(),get reflected(){return b.refresh()},setPaused:W.setPaused,reach:P({authoring:I}),adapter:I,store:t})}function ue(t,e,n){return Me(()=>Gt(t,e,n))}async function Kn(t,e,n){const s=Rt(e,n);return ue(t,s,e.id)}async function Xn(t,e){const n=jt(e);if(!n){g.error(`Unknown pixi ingest game: ${e}`,"ingest");return}return ue(t,n,e)}export{ue as mountCanvasIngestRoot,Xn as mountCanvasIngestRootById,Kn as mountCanvasIngestRootFromManifest};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/create-runtime-DBfUy0SO.js","assets/adapter-surface-Y37Nzcyw.js","assets/binding-Bmxqznjk.js","assets/root-stacking-BEd9ZvxC.js","assets/assets-BcrMQHRv.js","assets/loader-BTUKnX5Q.js","assets/KTX2Loader-CaqVE6nY.js","assets/three.module-BLhyNg0e.js","assets/three.core-3arARmh6.js","assets/GLTFLoader-KeoruJgS.js","assets/BufferGeometryUtils-B22h7jo4.js","assets/setup-renderer-Cwkl1Ar6.js","assets/index-DHhMOs_s.js","assets/defaults-DKiBJCPN.js","assets/render-settings-DS5leCed.js","assets/render-features-rxbawsRb.js","assets/index-BRJMIUK0.js","assets/index-nmcBqr7Y.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-FUuS4qwW.js","assets/client-DNXj_opT.js","assets/index-0Lm0Nf1M.css","assets/seeded-random-BgCwIAAU.js","assets/debug-registry-P0_YQGWd.js","assets/loop-gate-report-N52EWFGD.js","assets/system-slot-E2mEdiih.js","assets/user-data-dHvLdpwM.js","assets/object-marks-DwvIEBOK.js","assets/performance-profiler-OwnXQX0M.js"])))=>i.map(i=>d[i]);
2
- import{bp as I,M as s,_ as y,br as v,bs as w,bt as R,bu as E}from"./index-BRJMIUK0.js";import{m as j}from"./capability-coverage-DZ-onC5j.js";import{r as G}from"./binding-resolver-dE0GnZT5.js";import{s as H,j as A,k as P,l as b,p as D,m as L,c as O,r as N,n as C,o as M}from"./active-ingest-DA426a81.js";import{a as T}from"./json-history-resource-DwS10tqD.js";import{D as V}from"./dom-authoring-adapter-BrLU8IJ_.js";import{landIngestBootInEdit as k}from"./ingest-boot-viewport-DAt8WFSy.js";import{b as x}from"./registry-CaCdF63N.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"./game-contract-seams-BnPFGLll.js";import"./native-debug-module-2_HVupdg.js";import"./native-entry-surface-BE8LJNdu.js";import"./debug-registry-P0_YQGWd.js";import"./contract-system-adapters-Bic_7sev.js";import"./adapter-surface-Y37Nzcyw.js";import"./entry-adjudication-Dc18TIqT.js";import"./structural-signature-Dc7skRiy.js";import"./three.core-3arARmh6.js";import"./webgl-frame-capture-DdJkM2mi.js";import"./events-156d8d12.esm-CYeuVCYr.js";import"./three.module-BLhyNg0e.js";import"./index-bQE2NA0D.js";import"./realm-services-CnY105XU.js";import"./canvas-entry-runtime-UNYuSfG0.js";import"./three-ingest-runtime-B7rtg3QE.js";import"./EffectComposer-BEAt0PtQ.js";import"./CopyShader-BzTUYzf6.js";import"./ShaderPass-DTnDQXm0.js";import"./Pass-D1MRT672.js";import"./CSS3DRenderer-BsAqfavI.js";import"./relative-path-guard-GiM7Lsz8.js";import"./react-root-BHA-cdrW.js";import"./ingest-source-persistence-Dmdo-UBp.js";import"./react-world-authoring-adapter-DOjv2pYm.js";import"./board-guides-BEKPgD9M.js";import"./relative-import-specifier-BFKIWEWs.js";import"./story-arg-descriptors-Ek86ExX7.js";import"./inspect-Dr4qvDpJ.js";import"./inference-diagnostics-xecGdohW.js";import"./writer-tw6EcuVO.js";function F({folderId:t,manifest:e,root:o}){if(!o.entry)throw new Error(`dom ingest discovery: "${t}" has no \`entry\` — a dom ingest root's \`entry\` must point at the host-shim module in the same folder (D-N2).`);return{folderId:t,manifest:e,worldId:o.id}}let f=null;function W(){return f||(f=x("dom").map(F).sort((t,e)=>t.folderId.localeCompare(e.folderId))),f}function q(t){return W().find(e=>e.folderId===t)}function z(t){return typeof __VGAI_ENGINE_ROOT__!="string"||!__VGAI_ENGINE_ROOT__?void 0:`${__VGAI_ENGINE_ROOT__.endsWith("/")?__VGAI_ENGINE_ROOT__.slice(0,-1):__VGAI_ENGINE_ROOT__}/packages/editor/src/ingest/games/${t}`}const B="this world mounts in the host's native React runtime, so the editor is limited only by what its authoring adapter provides";function S(t){return{reach:j({authoring:t}),reachMechanism:B,loop:L}}async function J(t,e){const o=q(e);if(!o){s.error(`Unknown react ingest game: ${e}`,"ingest");return}const u=z(e);if(!u){s.error(`React ingest "${e}": no __VGAI_ENGINE_ROOT__ available to resolve its entry`,"ingest");return}await I();const i=E();if(!i){s.error("Game container not mounted — cannot ingest (react)","ingest");return}O(),t.shell.setPlayState("playing"),s.log(`Ingesting unmodified native-React game: ${o.manifest.name}`,"ingest"),window.__vgaiMountCold=!0;const{createGameRuntime:g}=await y(async()=>{const{createGameRuntime:r}=await import("./create-runtime-DBfUy0SO.js").then(h=>h.e);return{createGameRuntime:r}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32])),l=await G(o.manifest,u),d=i.clientWidth,_=i.clientHeight,a=await g({container:i,roots:l,width:d,height:_}),m=a.game.roots[0].reactRoot(),n=new V(m,t,{journal:T(e)}),c=A({setPaused:r=>r?a.game.play.pause():a.game.play.resume()});P({kind:"dom",session:{store:t,lifecycle:c,stop:()=>a.stop(),adapter:n},siblings:[],worldId:e}),b(()=>t.shell.playState==="playing"&&t.shell.activeViewportTab==="play"),v(n),w({}),k(),t.shell.notifyIngestEdit(),R();const p=S(n);N(p),D("__vgaiIngestReact",{gameId:e,worldId:o.worldId,...M(n),noAuthoring:!1,reach:p.reach,domEvidence:()=>C(m,n),setPausedPresent:typeof c.setPaused=="function"})}async function xt(t,e,o,u){await I();const i=E();if(!i){s.error("Game container not mounted — cannot ingest (react)","ingest");return}O(),t.shell.setPlayState("playing"),s.log(`Ingesting unmodified native-React game (external folder): ${o.id}`,"ingest"),window.__vgaiMountCold=!0;const{createGameRuntime:g}=await y(async()=>{const{createGameRuntime:r}=await import("./create-runtime-DBfUy0SO.js").then(h=>h.e);return{createGameRuntime:r}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32])),l=await G({...e,roots:[o]},u),d=i.clientWidth,_=i.clientHeight,a=await g({container:i,roots:l,width:d,height:_}),m=a.game.roots[0].reactRoot(),n=new V(m,t,{journal:T(o.id)}),c=A({setPaused:r=>r?a.game.play.pause():a.game.play.resume()});P({kind:"dom",session:{store:t,lifecycle:c,stop:()=>a.stop(),adapter:n},siblings:[],worldId:o.id}),b(()=>t.shell.playState==="playing"&&t.shell.activeViewportTab==="play"),v(n),w({}),k(),t.shell.notifyIngestEdit(),R();const p=S(n);N(p),D("__vgaiIngestReact",{worldId:o.id,...M(n),noAuthoring:!1,reach:p.reach,domEvidence:()=>C(m,n),setPausedPresent:typeof c.setPaused=="function"})}function Ft(t,e){return H(()=>J(t,e))}export{Ft as mountDomIngestRoot,xt as mountDomIngestRootFromManifest};